summaryrefslogtreecommitdiff
path: root/xc/programs
diff options
context:
space:
mode:
authordaryll <daryll>1999-12-05 00:59:08 +0000
committerdaryll <daryll>1999-12-05 00:59:08 +0000
commit504880db5611bf0f57206abe44835959c2729147 (patch)
treef22ff902680775b5a6fb49364d305b846606716a /xc/programs
Initial revision
Diffstat (limited to 'xc/programs')
-rw-r--r--xc/programs/Imakefile83
-rw-r--r--xc/programs/Xserver/GL/Imakefile55
-rw-r--r--xc/programs/Xserver/GL/dri/Imakefile34
-rw-r--r--xc/programs/Xserver/GL/dri/dri.c1468
-rw-r--r--xc/programs/Xserver/GL/dri/dri.h231
-rw-r--r--xc/programs/Xserver/GL/dri/drimodule.c83
-rw-r--r--xc/programs/Xserver/GL/dri/dristruct.h118
-rw-r--r--xc/programs/Xserver/GL/dri/sarea.h58
-rw-r--r--xc/programs/Xserver/GL/dri/xf86dri.c555
-rw-r--r--xc/programs/Xserver/GL/glx/Imakefile52
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab.c711
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab.h546
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab_EXT.c93
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab_EXT.h66
-rw-r--r--xc/programs/Xserver/GL/glx/g_render.c1741
-rw-r--r--xc/programs/Xserver/GL/glx/g_renderswap.c2717
-rw-r--r--xc/programs/Xserver/GL/glx/g_single.c1332
-rw-r--r--xc/programs/Xserver/GL/glx/g_singleswap.c1613
-rw-r--r--xc/programs/Xserver/GL/glx/global.c57
-rw-r--r--xc/programs/Xserver/GL/glx/glxbuf.c276
-rw-r--r--xc/programs/Xserver/GL/glx/glxbuf.h39
-rw-r--r--xc/programs/Xserver/GL/glx/glxcmds.c1548
-rw-r--r--xc/programs/Xserver/GL/glx/glxcmdsswap.c792
-rw-r--r--xc/programs/Xserver/GL/glx/glxcontext.h141
-rw-r--r--xc/programs/Xserver/GL/glx/glxdrawable.h89
-rw-r--r--xc/programs/Xserver/GL/glx/glxerror.h40
-rw-r--r--xc/programs/Xserver/GL/glx/glxext.c491
-rw-r--r--xc/programs/Xserver/GL/glx/glxext.h79
-rw-r--r--xc/programs/Xserver/GL/glx/glxfb.c165
-rw-r--r--xc/programs/Xserver/GL/glx/glxfb.h34
-rw-r--r--xc/programs/Xserver/GL/glx/glximports.c151
-rw-r--r--xc/programs/Xserver/GL/glx/glximports.h46
-rw-r--r--xc/programs/Xserver/GL/glx/glxmem.c134
-rw-r--r--xc/programs/Xserver/GL/glx/glxmem.h30
-rw-r--r--xc/programs/Xserver/GL/glx/glxpix.c114
-rw-r--r--xc/programs/Xserver/GL/glx/glxpix.h30
-rw-r--r--xc/programs/Xserver/GL/glx/glxscreens.c266
-rw-r--r--xc/programs/Xserver/GL/glx/glxscreens.h75
-rw-r--r--xc/programs/Xserver/GL/glx/glxserver.h251
-rw-r--r--xc/programs/Xserver/GL/glx/glxutil.c510
-rw-r--r--xc/programs/Xserver/GL/glx/glxutil.h64
-rw-r--r--xc/programs/Xserver/GL/glx/impsize.h53
-rw-r--r--xc/programs/Xserver/GL/glx/render2.c224
-rw-r--r--xc/programs/Xserver/GL/glx/render2swap.c365
-rw-r--r--xc/programs/Xserver/GL/glx/renderpix.c161
-rw-r--r--xc/programs/Xserver/GL/glx/renderpixswap.c269
-rw-r--r--xc/programs/Xserver/GL/glx/rensize.c569
-rw-r--r--xc/programs/Xserver/GL/glx/rensizetab.c248
-rw-r--r--xc/programs/Xserver/GL/glx/single2.c348
-rw-r--r--xc/programs/Xserver/GL/glx/single2swap.c328
-rw-r--r--xc/programs/Xserver/GL/glx/singlepix.c172
-rw-r--r--xc/programs/Xserver/GL/glx/singlepixswap.c195
-rw-r--r--xc/programs/Xserver/GL/glx/singlesize.c889
-rw-r--r--xc/programs/Xserver/GL/glx/singlesize.h58
-rw-r--r--xc/programs/Xserver/GL/glx/unpack.h219
-rw-r--r--xc/programs/Xserver/GL/glx/xfont.c177
-rw-r--r--xc/programs/Xserver/GL/glxmodule.c96
-rw-r--r--xc/programs/Xserver/GL/include/GL/glx_ansic.h164
-rw-r--r--xc/programs/Xserver/GL/include/GL/xf86glx.h40
-rw-r--r--xc/programs/Xserver/GL/mesa/Imakefile15
-rw-r--r--xc/programs/Xserver/GL/mesa/include/GL/Imakefile13
-rw-r--r--xc/programs/Xserver/GL/mesa/include/Imakefile15
-rw-r--r--xc/programs/Xserver/GL/mesa/src/GLcoremodule.c61
-rw-r--r--xc/programs/Xserver/GL/mesa/src/Imakefile204
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/Imakefile44
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/xf86glx.c926
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c148
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h98
-rw-r--r--xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h122
-rw-r--r--xc/programs/Xserver/GL/opengl/Imakefile140
-rw-r--r--xc/programs/Xserver/Imakefile786
-rw-r--r--xc/programs/Xserver/PEX5/Imakefile75
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/Imakefile16
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/Imakefile16
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/ddpex2.h210
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miClip.h247
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miFont.h132
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miInfo.h349
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miLUT.h432
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miLight.h272
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miLineDash.h72
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miMarkers.h154
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miNS.h136
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miNurbs.h271
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miPick.h133
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miRender.h335
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miStrMacro.h198
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miStruct.h147
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miText.h65
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/miWks.h190
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/mipex.h390
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/include/mixform.h55
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level0/README48
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/Imakefile81
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/mi52stubs.c177
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miDDCtoGC.c589
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miLevel1.c127
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miListUtil.c343
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miLvl1Tab.c80
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miPck1Prim.c403
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndFArea.c526
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndMarkr.c276
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndPLine.c183
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndTStrip.c740
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndText.c122
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/Imakefile117
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/ddContext.c1091
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miBldXform.c709
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miCellArray.c266
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miClip.c246
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miConvert.c954
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miCopy.c1097
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miDestroy.c141
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miFillArea.c1528
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miInquire.c1389
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miLight.c605
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miLvl2Tab.c1143
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miMarkers.c146
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miNCurve.c743
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSTrim.c1943
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c2466
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miNurbs.c378
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c1614
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miPickPrim.c1242
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miPolyLine.c530
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miQuadMesh.c265
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miReplace.c309
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miSOFAS.c216
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miSearch.c295
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miTestOCs.c269
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miText.c2168
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miTrans.c1024
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/miTriStrip.c2219
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level2/pexOCParse.c2249
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level3/Imakefile63
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level3/miRender.c1966
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level3/miRndrPick.c502
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile82
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/css_ex_str.c309
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c222
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/css_tbls.c607
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miDynamics.c222
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miPick.c727
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miSC.c212
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miStruct.c2487
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miTraverse.c596
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/level4/miWks.c2415
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile99
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miClrApLUT.c217
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miColrLUT.c295
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miDCueLUT.c232
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miEdgeLUT.c263
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miFont.c888
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miFontLUT.c228
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miIntLUT.c435
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUT.c835
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUTProcs.ci658
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miLightLUT.c249
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miLineLUT.c280
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miMarkLUT.c258
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miMisc.c870
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miNS.c446
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miPattLUT.c433
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miTextLUT.c257
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miUtils.c624
-rw-r--r--xc/programs/Xserver/PEX5/ddpex/mi/shared/miViewLUT.c258
-rw-r--r--xc/programs/Xserver/PEX5/dipex/Imakefile16
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/Imakefile68
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/dipexBuf.c75
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/dipexExt.c323
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/dipexParse.c131
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/pexDump.c186
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/pexError.c53
-rw-r--r--xc/programs/Xserver/PEX5/dipex/dispatch/pexUtils.c776
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/Imakefile71
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexAccBuf.c138
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexFont.c297
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexInfo.c278
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexLut.c500
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexNs.c187
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexPc.c1514
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexPhigs.c783
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexPick.c284
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexRndr.c1522
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexRndrPick.c307
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexSc.c567
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexStr.c587
-rw-r--r--xc/programs/Xserver/PEX5/dipex/objects/pexTM.c144
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/ConvName.ci51
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/ConvName.h52
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/Convert.c133
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/Imakefile69
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCTables.c64
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCattr.c768
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCattr.h104
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCcolour.c75
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCcolour.ci74
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCcolour.h50
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/OCprim.h83
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/RepTables.c63
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/Replies.ci158
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/ReqTables.c66
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/Requests.ci155
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/Requests.h265
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/SwapConv.h54
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/UconvName.ci49
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/UconvName.h51
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/cOCTables.ci241
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/cOCprim.c835
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/check.c353
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convEv.c58
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convReq.c2549
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convReq.h153
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convUtil.c227
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convUtil.h65
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/convertStr.h196
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/floatconv.c227
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/floatconv.h75
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/uOCTables.ci241
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/uOCprim.c831
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/uconvRep.c2168
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/uconvRep.h107
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/Imakefile26
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.awk150
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.sed94
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/OCTables.awk113
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/ReqSame.awk113
-rw-r--r--xc/programs/Xserver/PEX5/dipex/swap/util/ReqTab.awk97
-rw-r--r--xc/programs/Xserver/PEX5/include/PEX.h1127
-rw-r--r--xc/programs/Xserver/PEX5/include/PEXErr.h63
-rw-r--r--xc/programs/Xserver/PEX5/include/PEXfuncs.h141
-rw-r--r--xc/programs/Xserver/PEX5/include/PEXmacs.h51
-rw-r--r--xc/programs/Xserver/PEX5/include/PEXproto.h2329
-rw-r--r--xc/programs/Xserver/PEX5/include/PEXprotost.h608
-rw-r--r--xc/programs/Xserver/PEX5/include/ddpex.h673
-rw-r--r--xc/programs/Xserver/PEX5/include/ddpex3.h1096
-rw-r--r--xc/programs/Xserver/PEX5/include/ddpex4.h150
-rw-r--r--xc/programs/Xserver/PEX5/include/dipex.h220
-rw-r--r--xc/programs/Xserver/PEX5/include/pexError.h68
-rw-r--r--xc/programs/Xserver/PEX5/include/pexExtract.h361
-rw-r--r--xc/programs/Xserver/PEX5/include/pexLookup.h107
-rw-r--r--xc/programs/Xserver/PEX5/include/pexSwap.h74
-rw-r--r--xc/programs/Xserver/PEX5/include/pexUtils.h96
-rw-r--r--xc/programs/Xserver/PEX5/include/pex_site.h82
-rw-r--r--xc/programs/Xserver/PEX5/include/pexos.h60
-rw-r--r--xc/programs/Xserver/PEX5/ospex/Imakefile81
-rw-r--r--xc/programs/Xserver/PEX5/ospex/osPexFont.c692
-rw-r--r--xc/programs/Xserver/PEX5/pexmodule.c40
-rw-r--r--xc/programs/Xserver/XFree86.def5
-rw-r--r--xc/programs/Xserver/XIE/Imakefile69
-rw-r--r--xc/programs/Xserver/XIE/dixie/Imakefile31
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/Imakefile32
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/echist.c198
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/eclut.c190
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/ecphoto.c698
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/ecroi.c176
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/edraw.c259
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/edrawp.c185
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/elut.c246
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/ephoto.c594
-rw-r--r--xc/programs/Xserver/XIE/dixie/export/eroi.c209
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/Imakefile32
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/iclut.c222
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/icphoto.c778
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/icroi.c153
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/idraw.c206
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/idrawp.c211
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/ilut.c205
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/iphoto.c249
-rw-r--r--xc/programs/Xserver/XIE/dixie/import/iroi.c194
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/Imakefile37
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/parith.c244
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pbandc.c191
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pbande.c190
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pbands.c170
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pblend.c254
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pcfrgb.c396
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pcfromi.c208
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pcnst.c307
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pcomp.c273
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pconv.c297
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pctoi.c416
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pctrgb.c523
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pdither.c272
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pgeom.c379
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/phist.c306
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/plogic.c250
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/pmath.c201
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/ppaste.c239
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/ppoint.c296
-rw-r--r--xc/programs/Xserver/XIE/dixie/process/puncnst.c174
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/Imakefile38
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/colorlst.c342
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/difloat.c105
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/error.c299
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/event.c171
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/flo.c487
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/lut.c189
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/memory.c125
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/photomap.c292
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/protoflo.c852
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/roi.c185
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/session.c343
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/tables.c350
-rw-r--r--xc/programs/Xserver/XIE/dixie/request/technq.c356
-rw-r--r--xc/programs/Xserver/XIE/include/colorlst.h90
-rw-r--r--xc/programs/Xserver/XIE/include/corex.h159
-rw-r--r--xc/programs/Xserver/XIE/include/difloat.h93
-rw-r--r--xc/programs/Xserver/XIE/include/dixie_e.h80
-rw-r--r--xc/programs/Xserver/XIE/include/dixie_i.h72
-rw-r--r--xc/programs/Xserver/XIE/include/dixie_p.h106
-rw-r--r--xc/programs/Xserver/XIE/include/element.h471
-rw-r--r--xc/programs/Xserver/XIE/include/error.h158
-rw-r--r--xc/programs/Xserver/XIE/include/flo.h115
-rw-r--r--xc/programs/Xserver/XIE/include/flodata.h165
-rw-r--r--xc/programs/Xserver/XIE/include/flostr.h220
-rw-r--r--xc/programs/Xserver/XIE/include/lut.h105
-rw-r--r--xc/programs/Xserver/XIE/include/macro.h215
-rw-r--r--xc/programs/Xserver/XIE/include/memory.h82
-rw-r--r--xc/programs/Xserver/XIE/include/photomap.h100
-rw-r--r--xc/programs/Xserver/XIE/include/photospc.h82
-rw-r--r--xc/programs/Xserver/XIE/include/protoflo.h90
-rw-r--r--xc/programs/Xserver/XIE/include/roi.h84
-rw-r--r--xc/programs/Xserver/XIE/include/tables.h135
-rw-r--r--xc/programs/Xserver/XIE/include/technq.h1410
-rw-r--r--xc/programs/Xserver/XIE/mixie/Imakefile36
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/Imakefile36
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/analyze.c184
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/domain.c497
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/floman.c525
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/sched.c244
-rw-r--r--xc/programs/Xserver/XIE/mixie/control/strip.c1228
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/Imakefile37
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mechist.c366
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/meclut.c229
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mecphoto.c824
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mecroi.c245
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/medraw.c359
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/medrawp.c413
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mefax.c609
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mejpeg.c645
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/melut.c215
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/mephoto.c775
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/meroi.c181
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/meuncomp.c1348
-rw-r--r--xc/programs/Xserver/XIE/mixie/export/schoice.c344
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/Imakefile48
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/bits.h461
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/dg31d.c388
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/dg32d.c484
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/dg4.c283
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/dtiff2.c281
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/dtiffpb.c288
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/eg31d.c285
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/eg32d.c666
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/etiff2.c403
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/etiffpb.c377
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/faxint.h91
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/faxtabs.c74
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/faxtabs.h12626
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/fencode.h367
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/fetabs.h325
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/gbits.h461
-rw-r--r--xc/programs/Xserver/XIE/mixie/fax/zeroeven.c125
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/Imakefile37
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/miclut.c265
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/micphoto.c810
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/microi.c386
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/midraw.c620
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/mifax.c577
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/mijpeg.c622
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/milut.c227
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/miphoto.c854
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/miregion.c1088
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/miroi.c229
-rw-r--r--xc/programs/Xserver/XIE/mixie/import/miuncomp.c956
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/domain.h117
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/fax.h222
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/floman.h80
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/jpeg.h87
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/jpegd.h151
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/jpege.h169
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/meuncomp.h140
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/microi.h115
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/miphoto.h81
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/miuncomp.h236
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/mpgeom.h122
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/mppoint.h81
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/sched.h124
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/strip.h330
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/tex.h187
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/texstr.h146
-rw-r--r--xc/programs/Xserver/XIE/mixie/include/xiemd.h222
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/Imakefile68
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/README402
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcdeflts.c629
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcexpand.c170
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jchuff.c1026
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcmcu.c390
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jconfig.h476
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcsample.c732
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcxie.c685
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jcxief.c487
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdbuffer.c146
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jddeflts.c290
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdhuff.c694
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdlossy.c239
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdmcu.c428
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdsample.c505
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdxie.c897
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jdxief.c157
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jelossy.c249
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jfwddct.c376
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jinclude.h199
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jmemmgr.c1684
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c229
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.h198
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jpegdata.h1283
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jrdjfif.c1619
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jrevdct.c447
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jutils.c234
-rw-r--r--xc/programs/Xserver/XIE/mixie/jpeg/jwrjfif.c981
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/Imakefile38
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/bitfun.c424
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mparith.c1181
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpbandc.c230
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpbande.c548
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpbands.c236
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpblend.c904
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpcfromi.c475
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpcnst.c1033
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpcomp.c1222
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpconv.c477
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpctoi.c1061
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpdither.c914
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpgeom.c143
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpgeomaa.c1432
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpgeomnn.c1121
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mphist.c563
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mplogic.c810
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mppaste.c553
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mppoint.c1033
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mprgb.c1341
-rw-r--r--xc/programs/Xserver/XIE/mixie/process/mpuncnst.c310
-rw-r--r--xc/programs/Xserver/XIE/xiemodule.c42
-rw-r--r--xc/programs/Xserver/Xext/EVI.c179
-rw-r--r--xc/programs/Xserver/Xext/EVIstruct.h53
-rw-r--r--xc/programs/Xserver/Xext/Imakefile135
-rw-r--r--xc/programs/Xserver/Xext/SecurityPolicy88
-rw-r--r--xc/programs/Xserver/Xext/anti.c1403
-rw-r--r--xc/programs/Xserver/Xext/anti.h42
-rw-r--r--xc/programs/Xserver/Xext/appgroup.c799
-rw-r--r--xc/programs/Xserver/Xext/bigreq.c90
-rw-r--r--xc/programs/Xserver/Xext/cup.c341
-rw-r--r--xc/programs/Xserver/Xext/dgaproc.h135
-rw-r--r--xc/programs/Xserver/Xext/dpms.c432
-rw-r--r--xc/programs/Xserver/Xext/dpmsproc.h11
-rw-r--r--xc/programs/Xserver/Xext/dpmsstubs.c48
-rw-r--r--xc/programs/Xserver/Xext/extmod/Imakefile108
-rw-r--r--xc/programs/Xserver/Xext/extmod/modinit.c321
-rw-r--r--xc/programs/Xserver/Xext/mbuf.c2085
-rw-r--r--xc/programs/Xserver/Xext/mbufbf.c1051
-rw-r--r--xc/programs/Xserver/Xext/mbufpx.c645
-rw-r--r--xc/programs/Xserver/Xext/mitmisc.c161
-rw-r--r--xc/programs/Xserver/Xext/panoramiX.c1080
-rw-r--r--xc/programs/Xserver/Xext/panoramiXSwap.c154
-rw-r--r--xc/programs/Xserver/Xext/panoramiXprocs.c2602
-rw-r--r--xc/programs/Xserver/Xext/panoramiXstubs.c59
-rw-r--r--xc/programs/Xserver/Xext/sampleEVI.c97
-rw-r--r--xc/programs/Xserver/Xext/saver.c1324
-rw-r--r--xc/programs/Xserver/Xext/security.c1999
-rw-r--r--xc/programs/Xserver/Xext/shape.c1255
-rw-r--r--xc/programs/Xserver/Xext/shm.c1156
-rw-r--r--xc/programs/Xserver/Xext/sleepuntil.c238
-rw-r--r--xc/programs/Xserver/Xext/sync.c2556
-rw-r--r--xc/programs/Xserver/Xext/vidmodeproc.h65
-rw-r--r--xc/programs/Xserver/Xext/xcmisc.c228
-rw-r--r--xc/programs/Xserver/Xext/xf86dga.c289
-rw-r--r--xc/programs/Xserver/Xext/xf86dga2.c725
-rw-r--r--xc/programs/Xserver/Xext/xf86misc.c542
-rw-r--r--xc/programs/Xserver/Xext/xf86miscproc.h59
-rw-r--r--xc/programs/Xserver/Xext/xf86vmode.c1937
-rw-r--r--xc/programs/Xserver/Xext/xprint.c2874
-rw-r--r--xc/programs/Xserver/Xext/xtest.c552
-rw-r--r--xc/programs/Xserver/Xext/xtest1.frags90
-rw-r--r--xc/programs/Xserver/Xext/xtest1dd.c1648
-rw-r--r--xc/programs/Xserver/Xext/xtest1dd.h126
-rw-r--r--xc/programs/Xserver/Xext/xtest1di.c969
-rw-r--r--xc/programs/Xserver/Xext/xvdisp.c1314
-rw-r--r--xc/programs/Xserver/Xext/xvdix.h247
-rw-r--r--xc/programs/Xserver/Xext/xvmain.c1173
-rw-r--r--xc/programs/Xserver/Xext/xvmod.c19
-rw-r--r--xc/programs/Xserver/Xext/xvmodproc.h7
-rw-r--r--xc/programs/Xserver/Xi/Imakefile89
-rw-r--r--xc/programs/Xserver/Xi/allowev.c137
-rw-r--r--xc/programs/Xserver/Xi/allowev.h44
-rw-r--r--xc/programs/Xserver/Xi/chgdctl.c211
-rw-r--r--xc/programs/Xserver/Xi/chgdctl.h53
-rw-r--r--xc/programs/Xserver/Xi/chgfctl.c655
-rw-r--r--xc/programs/Xserver/Xi/chgfctl.h110
-rw-r--r--xc/programs/Xserver/Xi/chgkbd.c209
-rw-r--r--xc/programs/Xserver/Xi/chgkbd.h54
-rw-r--r--xc/programs/Xserver/Xi/chgkmap.c128
-rw-r--r--xc/programs/Xserver/Xi/chgkmap.h44
-rw-r--r--xc/programs/Xserver/Xi/chgprop.c166
-rw-r--r--xc/programs/Xserver/Xi/chgprop.h44
-rw-r--r--xc/programs/Xserver/Xi/chgptr.c257
-rw-r--r--xc/programs/Xserver/Xi/chgptr.h81
-rw-r--r--xc/programs/Xserver/Xi/closedev.c186
-rw-r--r--xc/programs/Xserver/Xi/closedev.h62
-rw-r--r--xc/programs/Xserver/Xi/devbell.c165
-rw-r--r--xc/programs/Xserver/Xi/devbell.h44
-rw-r--r--xc/programs/Xserver/Xi/exevents.c1433
-rw-r--r--xc/programs/Xserver/Xi/exglobals.h76
-rw-r--r--xc/programs/Xserver/Xi/extinit.c1013
-rw-r--r--xc/programs/Xserver/Xi/getbmap.c146
-rw-r--r--xc/programs/Xserver/Xi/getbmap.h53
-rw-r--r--xc/programs/Xserver/Xi/getdctl.c222
-rw-r--r--xc/programs/Xserver/Xi/getdctl.h63
-rw-r--r--xc/programs/Xserver/Xi/getfctl.c414
-rw-r--r--xc/programs/Xserver/Xi/getfctl.h107
-rw-r--r--xc/programs/Xserver/Xi/getfocus.c149
-rw-r--r--xc/programs/Xserver/Xi/getfocus.h53
-rw-r--r--xc/programs/Xserver/Xi/getkmap.c170
-rw-r--r--xc/programs/Xserver/Xi/getkmap.h53
-rw-r--r--xc/programs/Xserver/Xi/getmmap.c150
-rw-r--r--xc/programs/Xserver/Xi/getmmap.h53
-rw-r--r--xc/programs/Xserver/Xi/getprop.c207
-rw-r--r--xc/programs/Xserver/Xi/getprop.h64
-rw-r--r--xc/programs/Xserver/Xi/getselev.c188
-rw-r--r--xc/programs/Xserver/Xi/getselev.h53
-rw-r--r--xc/programs/Xserver/Xi/getvers.c149
-rw-r--r--xc/programs/Xserver/Xi/getvers.h53
-rw-r--r--xc/programs/Xserver/Xi/grabdev.c224
-rw-r--r--xc/programs/Xserver/Xi/grabdev.h65
-rw-r--r--xc/programs/Xserver/Xi/grabdevb.c162
-rw-r--r--xc/programs/Xserver/Xi/grabdevb.h44
-rw-r--r--xc/programs/Xserver/Xi/grabdevk.c166
-rw-r--r--xc/programs/Xserver/Xi/grabdevk.h44
-rw-r--r--xc/programs/Xserver/Xi/gtmotion.c205
-rw-r--r--xc/programs/Xserver/Xi/gtmotion.h53
-rw-r--r--xc/programs/Xserver/Xi/listdev.c399
-rw-r--r--xc/programs/Xserver/Xi/listdev.h119
-rw-r--r--xc/programs/Xserver/Xi/opendev.c197
-rw-r--r--xc/programs/Xserver/Xi/opendev.h53
-rw-r--r--xc/programs/Xserver/Xi/queryst.c207
-rw-r--r--xc/programs/Xserver/Xi/queryst.h53
-rw-r--r--xc/programs/Xserver/Xi/selectev.c151
-rw-r--r--xc/programs/Xserver/Xi/selectev.h44
-rw-r--r--xc/programs/Xserver/Xi/sendexev.c173
-rw-r--r--xc/programs/Xserver/Xi/sendexev.h44
-rw-r--r--xc/programs/Xserver/Xi/setbmap.c162
-rw-r--r--xc/programs/Xserver/Xi/setbmap.h53
-rw-r--r--xc/programs/Xserver/Xi/setdval.c166
-rw-r--r--xc/programs/Xserver/Xi/setdval.h53
-rw-r--r--xc/programs/Xserver/Xi/setfocus.c118
-rw-r--r--xc/programs/Xserver/Xi/setfocus.h44
-rw-r--r--xc/programs/Xserver/Xi/setmmap.c156
-rw-r--r--xc/programs/Xserver/Xi/setmmap.h53
-rw-r--r--xc/programs/Xserver/Xi/setmode.c150
-rw-r--r--xc/programs/Xserver/Xi/setmode.h53
-rw-r--r--xc/programs/Xserver/Xi/stubs.c315
-rw-r--r--xc/programs/Xserver/Xi/ungrdev.c115
-rw-r--r--xc/programs/Xserver/Xi/ungrdev.h44
-rw-r--r--xc/programs/Xserver/Xi/ungrdevb.c170
-rw-r--r--xc/programs/Xserver/Xi/ungrdevb.h44
-rw-r--r--xc/programs/Xserver/Xi/ungrdevk.c176
-rw-r--r--xc/programs/Xserver/Xi/ungrdevk.h44
-rw-r--r--xc/programs/Xserver/Xnest.def4
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/Xprinters43
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/attributes/document38
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/attributes/job25
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/attributes/printer80
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/ddx-config/raster/pcl39
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmfbin0 -> 5632 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmfbin0 -> 5732 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmfbin0 -> 5732 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmfbin0 -> 5716 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmfbin0 -> 5656 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmfbin0 -> 5664 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00081.pmfbin0 -> 5672 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00082.pmfbin0 -> 5660 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00083.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00084.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00085.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00086.pmfbin0 -> 5716 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00087.pmfbin0 -> 5752 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00088.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00089.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00090.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00091.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00092.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00093.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00094.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/README197
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias1
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.dir45
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmfbin0 -> 4296 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/model-config44
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00051.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00052.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00053.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00054.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00055.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00056.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00057.pmfbin0 -> 5632 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00058.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00059.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00060.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00061.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00062.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00063.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00064.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00065.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00066.pmfbin0 -> 5732 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00067.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00068.pmfbin0 -> 5732 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00069.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00070.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00071.pmfbin0 -> 5740 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00072.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00073.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00074.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00075.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00076.pmfbin0 -> 5716 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00077.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00079.pmfbin0 -> 5656 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00080.pmfbin0 -> 5664 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00081.pmfbin0 -> 5672 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00082.pmfbin0 -> 5660 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00083.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00084.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00085.pmfbin0 -> 5724 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00086.pmfbin0 -> 5716 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00087.pmfbin0 -> 5752 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00088.pmfbin0 -> 5720 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00089.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00090.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00091.pmfbin0 -> 5744 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00092.pmfbin0 -> 5736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00093.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00094.pmfbin0 -> 5728 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/README203
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias1
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.dir45
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmfbin0 -> 4296 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/model-config44
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Book.pmfbin0 -> 382972 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-BookOblique.pmfbin0 -> 422340 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Demi.pmfbin0 -> 399140 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-DemiOblique.pmfbin0 -> 432472 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Bold.pmfbin0 -> 319364 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-BoldOblique.pmfbin0 -> 348132 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Oblique.pmfbin0 -> 327004 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier.pmfbin0 -> 299848 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Bold.pmfbin0 -> 388912 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-BoldOblique.pmfbin0 -> 429360 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Oblique.pmfbin0 -> 410500 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica.pmfbin0 -> 357216 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Book.pmfbin0 -> 405084 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-BookOblique.pmfbin0 -> 435380 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Demi.pmfbin0 -> 411324 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-DemiOblique.pmfbin0 -> 448684 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Bold.pmfbin0 -> 434736 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-BoldItalic.pmfbin0 -> 442732 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Italic.pmfbin0 -> 412788 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Roman.pmfbin0 -> 383500 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Demi.pmfbin0 -> 423980 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-DemiItalic.pmfbin0 -> 449796 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Light.pmfbin0 -> 384208 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-LightItalic.pmfbin0 -> 393492 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Symbol.pmfbin0 -> 357252 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Bold.pmfbin0 -> 369068 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-BoldItalic.pmfbin0 -> 380384 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Italic.pmfbin0 -> 341196 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Roman.pmfbin0 -> 339148 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/ZapfDingbats.pmfbin0 -> 478308 bytes
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/fonts.dir14
-rw-r--r--xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/model-config13
-rw-r--r--xc/programs/Xserver/XpConfig/README318
-rw-r--r--xc/programs/Xserver/Xprint/AttrValid.c681
-rw-r--r--xc/programs/Xserver/Xprint/AttrValid.h206
-rw-r--r--xc/programs/Xserver/Xprint/DiPrint.h54
-rw-r--r--xc/programs/Xserver/Xprint/Imakefile124
-rw-r--r--xc/programs/Xserver/Xprint/Init.c1795
-rw-r--r--xc/programs/Xserver/Xprint/Oid.c3179
-rw-r--r--xc/programs/Xserver/Xprint/Oid.h289
-rw-r--r--xc/programs/Xserver/Xprint/OidDefs.h153
-rw-r--r--xc/programs/Xserver/Xprint/OidStrs.h155
-rw-r--r--xc/programs/Xserver/Xprint/Quarks.c373
-rw-r--r--xc/programs/Xserver/Xprint/Util.c390
-rw-r--r--xc/programs/Xserver/Xprint/ValTree.c187
-rw-r--r--xc/programs/Xserver/Xprint/Xlcint.h625
-rw-r--r--xc/programs/Xserver/Xprint/Xresource.h423
-rw-r--r--xc/programs/Xserver/Xprint/Xrm.c2600
-rw-r--r--xc/programs/Xserver/Xprint/XrmI.h68
-rw-r--r--xc/programs/Xserver/Xprint/attributes.c1577
-rw-r--r--xc/programs/Xserver/Xprint/attributes.h77
-rw-r--r--xc/programs/Xserver/Xprint/ddxInit.c380
-rw-r--r--xc/programs/Xserver/Xprint/mediaSizes.c739
-rw-r--r--xc/programs/Xserver/Xprint/pcl-mono/Imakefile6
-rw-r--r--xc/programs/Xserver/Xprint/pcl/Imakefile77
-rw-r--r--xc/programs/Xserver/Xprint/pcl/Pcl.h581
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclArc.c264
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclArea.c485
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclAttVal.c203
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclAttr.c83
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclColor.c862
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclCursor.c110
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclDef.h64
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclFonts.c69
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclGC.c1042
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclInit.c640
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclLine.c311
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclMisc.c294
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclPixel.c154
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclPixmap.c80
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclPolygon.c348
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclPrint.c719
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclSFonts.c432
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclSFonts.h112
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclSpans.c137
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclText.c932
-rw-r--r--xc/programs/Xserver/Xprint/pcl/PclWindow.c452
-rw-r--r--xc/programs/Xserver/Xprint/pcl/Pclmap.h205
-rw-r--r--xc/programs/Xserver/Xprint/ps/Imakefile43
-rw-r--r--xc/programs/Xserver/Xprint/ps/Ps.h512
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsArc.c174
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsArea.c281
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsAttVal.c206
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsAttr.c109
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsColor.c219
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsDef.h89
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsFonts.c181
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsGC.c376
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsInit.c405
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsLine.c185
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsMisc.c317
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsPixel.c150
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsPixmap.c589
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsPolygon.c229
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsPrint.c401
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsSpans.c159
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsText.c298
-rw-r--r--xc/programs/Xserver/Xprint/ps/PsWindow.c456
-rw-r--r--xc/programs/Xserver/Xprint/ps/psout.c1343
-rw-r--r--xc/programs/Xserver/Xprint/ps/psout.h197
-rw-r--r--xc/programs/Xserver/Xprint/raster/Imakefile30
-rw-r--r--xc/programs/Xserver/Xprint/raster/Raster.c1463
-rw-r--r--xc/programs/Xserver/Xprint/raster/Raster.h106
-rw-r--r--xc/programs/Xserver/Xprint/raster/RasterAttVal.c236
-rw-r--r--xc/programs/Xserver/Xserver.man698
-rw-r--r--xc/programs/Xserver/Xvfb.def4
-rw-r--r--xc/programs/Xserver/afb/Imakefile69
-rw-r--r--xc/programs/Xserver/afb/README10
-rw-r--r--xc/programs/Xserver/afb/Xdaniver.doc218
-rw-r--r--xc/programs/Xserver/afb/afb.h1272
-rw-r--r--xc/programs/Xserver/afb/afbbitblt.c476
-rw-r--r--xc/programs/Xserver/afb/afbblt.c566
-rw-r--r--xc/programs/Xserver/afb/afbbres.c321
-rw-r--r--xc/programs/Xserver/afb/afbbresd.c212
-rw-r--r--xc/programs/Xserver/afb/afbbstore.c152
-rw-r--r--xc/programs/Xserver/afb/afbclip.c245
-rw-r--r--xc/programs/Xserver/afb/afbcmap.c121
-rw-r--r--xc/programs/Xserver/afb/afbfillarc.c355
-rw-r--r--xc/programs/Xserver/afb/afbfillrct.c293
-rw-r--r--xc/programs/Xserver/afb/afbfillsp.c1128
-rw-r--r--xc/programs/Xserver/afb/afbfont.c75
-rw-r--r--xc/programs/Xserver/afb/afbgc.c710
-rw-r--r--xc/programs/Xserver/afb/afbgetsp.c163
-rw-r--r--xc/programs/Xserver/afb/afbhrzvert.c206
-rw-r--r--xc/programs/Xserver/afb/afbimage.c297
-rw-r--r--xc/programs/Xserver/afb/afbimggblt.c466
-rw-r--r--xc/programs/Xserver/afb/afbline.c698
-rw-r--r--xc/programs/Xserver/afb/afbmisc.c92
-rw-r--r--xc/programs/Xserver/afb/afbmodule.c49
-rw-r--r--xc/programs/Xserver/afb/afbpixmap.c292
-rw-r--r--xc/programs/Xserver/afb/afbply1rct.c296
-rw-r--r--xc/programs/Xserver/afb/afbplygblt.c461
-rw-r--r--xc/programs/Xserver/afb/afbpntarea.c654
-rw-r--r--xc/programs/Xserver/afb/afbpntwin.c124
-rw-r--r--xc/programs/Xserver/afb/afbpolypnt.c145
-rw-r--r--xc/programs/Xserver/afb/afbpushpxl.c256
-rw-r--r--xc/programs/Xserver/afb/afbscrinit.c244
-rw-r--r--xc/programs/Xserver/afb/afbsetsp.c264
-rw-r--r--xc/programs/Xserver/afb/afbtegblt.c592
-rw-r--r--xc/programs/Xserver/afb/afbtile.c850
-rw-r--r--xc/programs/Xserver/afb/afbwindow.c316
-rw-r--r--xc/programs/Xserver/afb/afbzerarc.c207
-rw-r--r--xc/programs/Xserver/cfb/Imakefile276
-rw-r--r--xc/programs/Xserver/cfb/cfb.h1565
-rw-r--r--xc/programs/Xserver/cfb/cfb16.h94
-rw-r--r--xc/programs/Xserver/cfb/cfb24.h94
-rw-r--r--xc/programs/Xserver/cfb/cfb32.h94
-rw-r--r--xc/programs/Xserver/cfb/cfb8bit.c462
-rw-r--r--xc/programs/Xserver/cfb/cfb8bit.h1572
-rw-r--r--xc/programs/Xserver/cfb/cfb8line.c1482
-rw-r--r--xc/programs/Xserver/cfb/cfballpriv.c88
-rw-r--r--xc/programs/Xserver/cfb/cfbbitblt.c1153
-rw-r--r--xc/programs/Xserver/cfb/cfbblt.c931
-rw-r--r--xc/programs/Xserver/cfb/cfbbres.c334
-rw-r--r--xc/programs/Xserver/cfb/cfbbresd.c398
-rw-r--r--xc/programs/Xserver/cfb/cfbbstore.c141
-rw-r--r--xc/programs/Xserver/cfb/cfbcmap.c126
-rw-r--r--xc/programs/Xserver/cfb/cfbcppl.c478
-rw-r--r--xc/programs/Xserver/cfb/cfbfillarc.c364
-rw-r--r--xc/programs/Xserver/cfb/cfbfillrct.c299
-rw-r--r--xc/programs/Xserver/cfb/cfbfillsp.c994
-rw-r--r--xc/programs/Xserver/cfb/cfbgc.c787
-rw-r--r--xc/programs/Xserver/cfb/cfbgetsp.c195
-rw-r--r--xc/programs/Xserver/cfb/cfbglblt8.c460
-rw-r--r--xc/programs/Xserver/cfb/cfbhrzvert.c516
-rw-r--r--xc/programs/Xserver/cfb/cfbigblt8.c106
-rw-r--r--xc/programs/Xserver/cfb/cfbimage.c191
-rw-r--r--xc/programs/Xserver/cfb/cfbline.c750
-rw-r--r--xc/programs/Xserver/cfb/cfbmap.h195
-rw-r--r--xc/programs/Xserver/cfb/cfbmodule.c59
-rw-r--r--xc/programs/Xserver/cfb/cfbmskbits.c1398
-rw-r--r--xc/programs/Xserver/cfb/cfbmskbits.h893
-rw-r--r--xc/programs/Xserver/cfb/cfbpixmap.c366
-rw-r--r--xc/programs/Xserver/cfb/cfbply1rct.c347
-rw-r--r--xc/programs/Xserver/cfb/cfbpntwin.c734
-rw-r--r--xc/programs/Xserver/cfb/cfbpolypnt.c194
-rw-r--r--xc/programs/Xserver/cfb/cfbpush8.c182
-rw-r--r--xc/programs/Xserver/cfb/cfbrctstp8.c587
-rw-r--r--xc/programs/Xserver/cfb/cfbrrop.c217
-rw-r--r--xc/programs/Xserver/cfb/cfbrrop.h334
-rw-r--r--xc/programs/Xserver/cfb/cfbscrinit.c217
-rw-r--r--xc/programs/Xserver/cfb/cfbsetsp.c303
-rw-r--r--xc/programs/Xserver/cfb/cfbsolid.c1320
-rw-r--r--xc/programs/Xserver/cfb/cfbteblt8.c579
-rw-r--r--xc/programs/Xserver/cfb/cfbtegblt.c221
-rw-r--r--xc/programs/Xserver/cfb/cfbtile32.c495
-rw-r--r--xc/programs/Xserver/cfb/cfbtileodd.c1215
-rw-r--r--xc/programs/Xserver/cfb/cfbunmap.h153
-rw-r--r--xc/programs/Xserver/cfb/cfbwindow.c330
-rw-r--r--xc/programs/Xserver/cfb/cfbzerarc.c313
-rw-r--r--xc/programs/Xserver/cfb/stip68kgnu.h119
-rw-r--r--xc/programs/Xserver/cfb/stipmips.s277
-rw-r--r--xc/programs/Xserver/cfb/stipple68k.s227
-rw-r--r--xc/programs/Xserver/cfb/stipsparc.s277
-rw-r--r--xc/programs/Xserver/cfb/stipsprc32.s278
-rw-r--r--xc/programs/Xserver/cfb16/Imakefile5
-rw-r--r--xc/programs/Xserver/cfb16/cfbmodule.c59
-rw-r--r--xc/programs/Xserver/cfb24/Imakefile5
-rw-r--r--xc/programs/Xserver/cfb24/cfbmodule.c59
-rw-r--r--xc/programs/Xserver/cfb24/cfbrrop24.h60
-rw-r--r--xc/programs/Xserver/cfb32/Imakefile5
-rw-r--r--xc/programs/Xserver/cfb32/cfbmodule.c59
-rw-r--r--xc/programs/Xserver/dbe/Imakefile32
-rw-r--r--xc/programs/Xserver/dbe/dbe.c1981
-rw-r--r--xc/programs/Xserver/dbe/dbemodule.c42
-rw-r--r--xc/programs/Xserver/dbe/dbestruct.h261
-rw-r--r--xc/programs/Xserver/dbe/midbe.c848
-rw-r--r--xc/programs/Xserver/dbe/midbe.h48
-rw-r--r--xc/programs/Xserver/dbe/midbestr.h96
-rw-r--r--xc/programs/Xserver/dix/BuiltInAtoms329
-rw-r--r--xc/programs/Xserver/dix/CHANGES17
-rw-r--r--xc/programs/Xserver/dix/Imakefile88
-rw-r--r--xc/programs/Xserver/dix/atom.c209
-rwxr-xr-xxc/programs/Xserver/dix/buildatoms43
-rw-r--r--xc/programs/Xserver/dix/colormap.c2873
-rw-r--r--xc/programs/Xserver/dix/cursor.c418
-rw-r--r--xc/programs/Xserver/dix/devices.c1752
-rw-r--r--xc/programs/Xserver/dix/dispatch.c4086
-rw-r--r--xc/programs/Xserver/dix/dispatch.h206
-rw-r--r--xc/programs/Xserver/dix/dixfonts.c2215
-rw-r--r--xc/programs/Xserver/dix/dixutils.c1002
-rw-r--r--xc/programs/Xserver/dix/events.c4668
-rw-r--r--xc/programs/Xserver/dix/extension.c468
-rw-r--r--xc/programs/Xserver/dix/ffs.c33
-rw-r--r--xc/programs/Xserver/dix/gc.c1330
-rw-r--r--xc/programs/Xserver/dix/globals.c141
-rw-r--r--xc/programs/Xserver/dix/glyphcurs.c193
-rw-r--r--xc/programs/Xserver/dix/grabs.c487
-rw-r--r--xc/programs/Xserver/dix/initatoms.c80
-rw-r--r--xc/programs/Xserver/dix/main.c820
-rw-r--r--xc/programs/Xserver/dix/pixmap.c146
-rw-r--r--xc/programs/Xserver/dix/privates.c363
-rw-r--r--xc/programs/Xserver/dix/property.c731
-rw-r--r--xc/programs/Xserver/dix/resource.c993
-rw-r--r--xc/programs/Xserver/dix/swaprep.c1471
-rw-r--r--xc/programs/Xserver/dix/swapreq.c1171
-rw-r--r--xc/programs/Xserver/dix/tables.c526
-rw-r--r--xc/programs/Xserver/dix/window.c3916
-rw-r--r--xc/programs/Xserver/dix/xpstubs.c41
-rw-r--r--xc/programs/Xserver/glxStub/Imakefile19
-rw-r--r--xc/programs/Xserver/glxStub/glxstub.c55
-rw-r--r--xc/programs/Xserver/hw/Imakefile22
-rw-r--r--xc/programs/Xserver/hw/dec/ws/Imakefile37
-rw-r--r--xc/programs/Xserver/hw/dec/ws/Xdec.man284
-rw-r--r--xc/programs/Xserver/hw/dec/ws/acc_2da.c68
-rw-r--r--xc/programs/Xserver/hw/dec/ws/acc_3d.c70
-rw-r--r--xc/programs/Xserver/hw/dec/ws/acc_none.c74
-rw-r--r--xc/programs/Xserver/hw/dec/ws/cfbinit.c487
-rw-r--r--xc/programs/Xserver/hw/dec/ws/ext_device.c528
-rw-r--r--xc/programs/Xserver/hw/dec/ws/init.c306
-rw-r--r--xc/programs/Xserver/hw/dec/ws/keynames.h164
-rw-r--r--xc/programs/Xserver/hw/dec/ws/mdepthinit.c270
-rw-r--r--xc/programs/Xserver/hw/dec/ws/ws.h163
-rw-r--r--xc/programs/Xserver/hw/dec/ws/ws_color.c212
-rw-r--r--xc/programs/Xserver/hw/dec/ws/ws_io.c1607
-rw-r--r--xc/programs/Xserver/hw/hp/Imakefile45
-rw-r--r--xc/programs/Xserver/hw/hp/Xhp.man136
-rw-r--r--xc/programs/Xserver/hw/hp/ddx_info.c169
-rw-r--r--xc/programs/Xserver/hw/hp/hpCursorUtils.c145
-rw-r--r--xc/programs/Xserver/hw/hp/hpInit.c804
-rw-r--r--xc/programs/Xserver/hw/hp/include/XHPproto.h216
-rw-r--r--xc/programs/Xserver/hw/hp/include/hppriv.h111
-rw-r--r--xc/programs/Xserver/hw/hp/input/Imakefile69
-rw-r--r--xc/programs/Xserver/hw/hp/input/X11/XHPlib.h757
-rw-r--r--xc/programs/Xserver/hw/hp/input/cr16.s12
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/Imakefile36
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/X0screens3
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/XHPKeymapsbin0 -> 30603 bytes
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/hil_driver.c3584
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/hp7lc2k.c406
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/hp7lc2m.c934
-rw-r--r--xc/programs/Xserver/hw/hp/input/drivers/ps2io.h113
-rw-r--r--xc/programs/Xserver/hw/hp/input/get_tv.c199
-rw-r--r--xc/programs/Xserver/hw/hp/input/getkeysym.c428
-rw-r--r--xc/programs/Xserver/hw/hp/input/hildef.h228
-rw-r--r--xc/programs/Xserver/hw/hp/input/hpKeyMap.c869
-rw-r--r--xc/programs/Xserver/hw/hp/input/hpext.h881
-rw-r--r--xc/programs/Xserver/hw/hp/input/hpkeys.h251
-rw-r--r--xc/programs/Xserver/hw/hp/input/screentab.h73
-rw-r--r--xc/programs/Xserver/hw/hp/input/x_hil.c1691
-rw-r--r--xc/programs/Xserver/hw/hp/input/x_hil.h93
-rw-r--r--xc/programs/Xserver/hw/hp/input/x_hilinit.c2385
-rw-r--r--xc/programs/Xserver/hw/hp/input/x_hilinit.h460
-rw-r--r--xc/programs/Xserver/hw/hp/input/x_serialdrv.h185
-rw-r--r--xc/programs/Xserver/hw/hp/input/xtest1imp.c281
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/Imakefile46
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/dregs.h123
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/hyperScrn.c266
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/ngle.h121
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/ngleblt.c96
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecolormap.c795
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecolormap.h84
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecopy.c154
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecopy.h39
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecursor.c1037
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglecursor.h143
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/ngledevrom.h79
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07bin0 -> 1632 bytes
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/ngleextern.h46
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglehdw.h523
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglenoop.c68
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglenoop.h36
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglescreen.c2095
-rw-r--r--xc/programs/Xserver/hw/hp/ngle/nglescreen.h138
-rw-r--r--xc/programs/Xserver/hw/sun/Imakefile80
-rw-r--r--xc/programs/Xserver/hw/sun/README118
-rw-r--r--xc/programs/Xserver/hw/sun/Xsun.man169
-rw-r--r--xc/programs/Xserver/hw/sun/circleset.h136
-rw-r--r--xc/programs/Xserver/hw/sun/constype.c180
-rw-r--r--xc/programs/Xserver/hw/sun/constype.man55
-rw-r--r--xc/programs/Xserver/hw/sun/kbd_mode.c151
-rw-r--r--xc/programs/Xserver/hw/sun/kbd_mode.man46
-rw-r--r--xc/programs/Xserver/hw/sun/sun.h498
-rw-r--r--xc/programs/Xserver/hw/sun/sunCfb.c519
-rw-r--r--xc/programs/Xserver/hw/sun/sunCfb24.c136
-rw-r--r--xc/programs/Xserver/hw/sun/sunCursor.c296
-rw-r--r--xc/programs/Xserver/hw/sun/sunFbs.c288
-rw-r--r--xc/programs/Xserver/hw/sun/sunGX.c2909
-rw-r--r--xc/programs/Xserver/hw/sun/sunGX.h237
-rw-r--r--xc/programs/Xserver/hw/sun/sunInit.c948
-rw-r--r--xc/programs/Xserver/hw/sun/sunIo.c294
-rw-r--r--xc/programs/Xserver/hw/sun/sunKbd.c1116
-rw-r--r--xc/programs/Xserver/hw/sun/sunKeyMap.c5797
-rw-r--r--xc/programs/Xserver/hw/sun/sunMfb.c104
-rw-r--r--xc/programs/Xserver/hw/sun/sunMouse.c424
-rw-r--r--xc/programs/Xserver/hw/sun/sunMultiDepth.c273
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/Imakefile56
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sun.h480
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c468
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c175
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c630
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c323
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c238
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c88
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunCfb.c471
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunCursor.c250
-rw-r--r--xc/programs/Xserver/hw/sunAmoeba/sunFbs.c304
-rw-r--r--xc/programs/Xserver/hw/sunLynx/Imakefile77
-rw-r--r--xc/programs/Xserver/hw/sunLynx/btreg.h85
-rw-r--r--xc/programs/Xserver/hw/sunLynx/btvar.h78
-rw-r--r--xc/programs/Xserver/hw/sunLynx/cgsixreg.h210
-rw-r--r--xc/programs/Xserver/hw/sunLynx/fbio.h190
-rw-r--r--xc/programs/Xserver/hw/sunLynx/patch.Console428
-rw-r--r--xc/programs/Xserver/hw/sunLynx/patch.Console-2.4.0493
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sun.h547
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyCfb.c372
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyFbs.c328
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyInit.c659
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyIo.c394
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyKbd.c1137
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyMouse.c679
-rw-r--r--xc/programs/Xserver/hw/sunLynx/sunLyUtil.c513
-rw-r--r--xc/programs/Xserver/hw/sunLynx/vuid_event.h92
-rw-r--r--xc/programs/Xserver/hw/vfb/Imakefile69
-rw-r--r--xc/programs/Xserver/hw/vfb/InitInput.c363
-rw-r--r--xc/programs/Xserver/hw/vfb/InitOutput.c989
-rw-r--r--xc/programs/Xserver/hw/vfb/Xvfb.man124
-rw-r--r--xc/programs/Xserver/hw/vfb/lk201kbd.h155
-rw-r--r--xc/programs/Xserver/hw/xfree86/CHANGELOG8695
-rw-r--r--xc/programs/Xserver/hw/xfree86/CHANGELOG.ND418
-rw-r--r--xc/programs/Xserver/hw/xfree86/CHANGELOG.R51249
-rw-r--r--xc/programs/Xserver/hw/xfree86/Imakefile195
-rw-r--r--xc/programs/Xserver/hw/xfree86/RAC.Notes688
-rw-r--r--xc/programs/Xserver/hw/xfree86/Registry320
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/00README85
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights55
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c116
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c131
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c167
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c402
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c325
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c123
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c108
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds18
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist44
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h434
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c64
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog101
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c317
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c511
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c158
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c91
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c254
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c108
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c85
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c75
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c206
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile104
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c83
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c57
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c119
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c929
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std160
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c118
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c152
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c101
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c488
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c259
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c247
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c397
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c256
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c236
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Minix.c228
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c322
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c435
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c145
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c293
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h385
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h35
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c64
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c383
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h751
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c1432
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c140
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c105
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c565
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c183
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c80
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s104
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man207
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c345
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c388
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c113
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c554
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c78
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c117
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c200
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c124
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c60
-rw-r--r--xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def4
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Conf.cpp611
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Conf.man1134
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/CHANGELOG452
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile172
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/LICENSE23
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/README204
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/README.html218
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/TODO125
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man106
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/card.tcl587
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/carddata.tcl520
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c903
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c909
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/done.tcl72
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl105
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/filelist98.tcl99
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/kbddata.tcl79
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/keyboard.tcl292
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/main.c659
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl203
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/mondata.tcl167
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/monitor.tcl330
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/mouse.tcl684
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/mseproto.cpp78
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/ph2notk.tcl67
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/phase1.tcl401
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/phase2.tcl219
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/phase3.tcl75
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/phase4.tcl111
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl91
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.msk388
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.xbm388
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.msk133
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.xbm133
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/Imakefile19
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts80
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/mseconfig.tcl104
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig10
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man55
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/setuplib.tcl805
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/srvflags.tcl108
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclcards.c176
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.c887
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.h204
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclkbd.c877
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/README9
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/button.tcl190
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/combobox.tcl179
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/dialog.tcl130
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/downarrow.xbm6
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/entry.tcl501
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/focus.tcl187
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/init.tcl284
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/license.terms32
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/listbox.tcl453
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/menu.tcl921
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/misc.tcl144
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/narrower.xbm11
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/optionMenu.tcl53
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/palette.tcl227
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/prolog.ps284
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scale.tcl269
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scrollbar.tcl411
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/shorter.xbm11
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/taller.xbm11
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tclIndex117
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tearoff.tcl128
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/text.tcl798
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tk.tcl118
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tkerror.tcl85
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/uparrow.xbm5
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/wider.xbm11
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c564
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.h93
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c558
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.c834
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.h131
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c339
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tclxkbui.c557
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/Imakefile20
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/Imakefile14
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_card.tcl55
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_done.tcl12
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_intro.tcl23
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_keyboard.tcl9
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_modeselect.tcl14
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_monitor.tcl14
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_mouse.tcl38
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_other.tcl10
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/message_proc.tcl77
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/messages.tcl312
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/Imakefile14
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_card.tcl47
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_done.tcl6
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_intro.tcl31
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_keyboard.tcl13
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_modeselect.tcl19
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_monitor.tcl16
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_mouse.tcl82
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_other.tcl8
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/message_proc.tcl88
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/messages.tcl402
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/texts/local_text.tcl132
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/tkother.c185
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/vidmode.tcl470
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Setup/xfsconf.h86
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF98Conf.cpp529
-rw-r--r--xc/programs/Xserver/hw/xfree86/XFree86.man556
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/Imakefile202
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/NOTES.Mice470
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/atKeynames.h311
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/compiler.h1520
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/modeline2c.pl67
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/scoasm.h112
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86.h259
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Beta.c280
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Bus.c4129
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Bus.h121
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.c2264
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.h25
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c367
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DGA.c1055
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c161
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c93
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c111
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Events.c1584
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86ExtInit.h17
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Globals.c207
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Helper.c2337
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h17
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Init.c1584
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Io.c561
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c366
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c542
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c622
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c313
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h401
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c549
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Mode.c1280
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Module.h191
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Mouse.c1308
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Opt.h79
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Option.c728
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h1480
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86PnPMouse.c511
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Priv.h209
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h276
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Resources.h82
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Switch.c229
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c730
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86XKB.c127
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c1536
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h195
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86cmap.c935
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86cmap.h42
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86fbman.c684
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86fbman.h120
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86str.h868
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86xv.c1375
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86xv.h149
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xisb.c171
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xisb.h64
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO97
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/Imakefile28
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/edid.c127
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/edid.h417
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/edid2.h59
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c223
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/interpret_vdif.c120
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/print_edid.c260
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c219
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/vdif.h164
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c354
-rw-r--r--xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.h43
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/AccelCards1700
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/BUILD196
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/BetaReport57
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/CODING35
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/DESIGN5918
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Devices756
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Imakefile97
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/AccelCards1752
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/COPYRIGHT180
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/INSTALL263
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/Imakefile26
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/LinkKit169
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/QuickStart.doc618
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.FreeBSD665
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.Mach64324
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README1128
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Config565
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Linux296
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README.S3670
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README.ati285
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README.cirrus810
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README98193
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/README98.1st141
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/RELNOTES850
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/VGADriver.doc966
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Japanese/VideoModes.doc1158
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/LICENSE558
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/LbxproxyOnly54
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/Monitors1386
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/OS2.Notes227
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/QuickStart.doc554
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/READ.Mach32166
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/READ.Mach64387
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README92
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.3Dlabs99
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.Bsdi596
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.Config493
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DECtga57
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DGA103
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DGux694
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.DRI115
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.FreeBSD291
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.I12895
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.Linux128
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.LynxOS494
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.MGA198
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.NV142
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.NVIDIA57
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.NetBSD489
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.OS2689
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.Oak171
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD336
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.P9000472
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.S3813
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.SCO552
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.SOLX86231
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.SVR4408
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.SiS117
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.Video7102
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.WstDig196
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.agx537
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.apm68
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.ark208
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.ati548
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.chips864
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.cirrus890
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.cyrix80
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.epson134
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.fbdev341
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.fonts696
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.i740172
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.isc556
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.mouse614
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.neomagic198
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.rendition104
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.s3virge65
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.trident180
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/README.tseng1017
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/RELNOTES855
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/ServersOnly72
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/VideoBoard98387
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc1322
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/modeDB.txt2456
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/xinput242
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86Version.h23
-rw-r--r--xc/programs/Xserver/lmfcfb/Imakefile294
1360 files changed, 530446 insertions, 0 deletions
diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile
new file mode 100644
index 000000000..24415a90e
--- /dev/null
+++ b/xc/programs/Imakefile
@@ -0,0 +1,83 @@
+XCOMM $TOG: Imakefile /main/85 1998/02/26 17:14:44 kaleb $
+XCOMM
+XCOMM
+XCOMM
+XCOMM $XFree86: xc/programs/Imakefile,v 3.23 1999/05/04 09:35:24 dawes Exp $
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+#if BuildServer
+ RGBSRCDIR = rgb
+ XSSRCDIR = Xserver
+#endif
+#ifndef Win32Architecture
+#if HasXServer
+ XINITSRCDIR = xinit
+#endif
+#if BuildFontServer
+ XFSSRCDIR = xfs
+#endif
+#if BuildXKBlib
+ XKBSRCDIRS = xkbcomp xkbevd xkbprint xkbutils
+#endif
+#if BuildScreenSaverExt
+SCREENSAVESRCDIR = beforelight
+#endif
+#if BuildXF86VidModeExt
+ XVIDTUNESRCDIR = xvidtune
+#endif
+#if BuildXF86DGA
+ XF86DGASRCDIR = xf86dga
+#endif
+#if BuildXAServer
+ XASSRCDIR = Xaserver
+#endif
+#if BuildLBX
+ LBXPROXYSRCDIR = lbxproxy
+#endif
+ PROXYMGRSRCDIR = proxymngr
+ RSTARTSRCDIR = rstart
+ SMPROXYSRCDIR = smproxy
+ TWMSRCDIR = twm
+ XCONSOLESRCDIR = xconsole
+ XDMSRCDIR = xdm
+XFINDPROXYSRCDIR = xfindproxy
+ XFWPSRCDIR = xfwp
+ XGAMMASRCDIR = xgamma
+ XHOSTSRCDIR = xhost
+#if BuildPlugin
+ XRXSRCDIR = xrx
+#endif
+ XSMSRCDIR = xsm
+ XTERMSRCDIR = xterm
+ SCRIPTSDIR = scripts
+#endif
+#if BuildCID
+ MKCFMSRCDIR = mkcfm
+#endif
+
+ XPMCLIENTDIRS = cxpm sxpm
+
+#if BuildServersOnly
+SUBDIRS = $(XSSRCDIR)
+#else
+SUBDIRS = \
+ appres bdftopcf bitmap \
+ $(SCREENSAVESRCDIR) editres fsinfo fslsfonts fstobdf iceauth \
+ $(MKCFMSRCDIR) \
+ mkfontdir oclock $(PROXYMGRSRCDIR) $(RGBSRCDIR) $(RSTARTSRCDIR) \
+ setxkbmap \
+ $(SMPROXYSRCDIR) $(TWMSRCDIR) x11perf xauth xclipboard xclock \
+ xcmsdb $(XCONSOLESRCDIR) $(XDMSRCDIR) xdpyinfo \
+ $(XF86DGASRCDIR) xedit xfd $(XFSSRCDIR) \
+ $(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) $(XHOSTSRCDIR) \
+ xieperf $(XINITSRCDIR) $(XKBSRCDIRS) xkill xlogo xlsatoms xlsclients \
+ xlsfonts xmag xmodmap xprop xrdb xrefresh $(XRXSRCDIR) xset \
+ xsetroot $(XSMSRCDIR) xstdcmap xsetmode xsetpointer \
+ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \
+ $(XPMCLIENTDIRS) \
+ $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR)
+#endif
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/GL/Imakefile b/xc/programs/Xserver/GL/Imakefile
new file mode 100644
index 000000000..34b3dd0ef
--- /dev/null
+++ b/xc/programs/Xserver/GL/Imakefile
@@ -0,0 +1,55 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.5 1999/08/14 10:49:22 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/Imakefile,v 1.14 1999/06/07 12:56:02 faith Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+#if GlxUseSGISI
+ CORE_SUBDIR = /* opengl */
+#else
+ CORE_SUBDIR = mesa
+#endif
+
+#if BuildXF86DRI
+DRI_SUBDIR = dri
+#endif
+
+SUBDIRS = glx $(DRI_SUBDIR) $(CORE_SUBDIR)
+
+#if DoLoadableServer
+MSRCS = glxmodule.c
+MOBJS = glxmodule.o
+#endif
+
+SRCS = glx/?*.c $(MSRCS)
+OBJS = glx/?*.o $(MOBJS)
+
+DONES = glx/DONE
+
+INCLUDES = -Iinclude -Idri -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \
+ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC)
+DEPEND_DEFINES = $(EXT_DEFINES)
+DEFINES = $(GLX_DEFINES)
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+#if HasGnuMake || HasBsdMake
+$(DONES): $(SUBDIRS)
+#endif
+
+ModuleObjectRule()
+
+NormalDepLibraryTarget(glx,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS))
+
+InstallLibraryModule(glx,$(MODULEDIR),extensions)
+ForceSubdirs($(SUBDIRS))
+
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+InstallDriverSDKLibraryModule(glx,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/xc/programs/Xserver/GL/dri/Imakefile b/xc/programs/Xserver/GL/dri/Imakefile
new file mode 100644
index 000000000..eec83ee85
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/Imakefile
@@ -0,0 +1,34 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.4 1999/08/14 10:49:23 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/dri/Imakefile,v 1.13 1999/06/07 12:55:30 faith Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#if DoLoadableServer
+MSRC = drimodule.c
+MOBJ = drimodule.o
+#endif
+
+ SRCS = xf86dri.c dri.c $(MSRC)
+ OBJS = xf86dri.o dri.o $(MOBJ)
+
+ INCLUDES = -I$(SERVERSRC)/include -I$(XTOP)/include -I$(EXTINCSRC) \
+ -I$(XF86OSSRC) -I$(XF86COMSRC) \
+ -I../include -I../glx -I$(LIBSRC)/GL/include \
+ -I$(SERVERSRC)/mi -I$(FONTINCSRC)
+ DEFINES = $(GLX_DEFINES)
+
+LinkSourceFile(xf86dri.h,$(LIBSRC)/GL/dri)
+LinkSourceFile(xf86dristr.h,$(LIBSRC)/GL/dri)
+
+ModuleObjectRule()
+LibraryModuleTarget(dri,$(OBJS))
+InstallLibraryModule(dri,$(MODULEDIR),extensions)
+
+DependTarget()
+
+InstallDriverSDKLibraryModule(dri,$(DRIVERSDKMODULEDIR),extensions)
+
+InstallDriverSDKNonExecFile(dri.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(sarea.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86dri.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c
new file mode 100644
index 000000000..a23eda856
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/dri.c
@@ -0,0 +1,1468 @@
+/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.3 1999/07/04 06:38:30 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/dri.c,v 1.51 1999/07/02 18:33:49 faith Exp $
+ */
+
+#if XFree86LOADER
+#include "xf86.h"
+#include "xf86_ansic.h"
+#else
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+#include "swaprep.h"
+#include "dri.h"
+#include "sarea.h"
+#include "dristruct.h"
+#include "xf86.h"
+#include "xf86drm.h"
+#include "glxserver.h"
+#include "mi.h"
+#include "xf86Priv.h"
+
+static int DRIScreenPrivIndex = -1;
+static int DRIWindowPrivIndex = -1;
+static unsigned long DRIGeneration = 0;
+static unsigned int DRIDrawableValidationStamp = 0;
+
+static RESTYPE DRIDrawablePrivResType;
+static RESTYPE DRIContextPrivResType;
+
+ /* Wrapper just like xf86DrvMsg, but
+ without the verbosity level checking.
+ This will make it easy to turn off some
+ messages later, based on verbosity
+ level. */
+static void
+DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+ static char buffer[1024];
+
+ va_start(ap, format);
+ vsprintf(buffer, format, ap);
+ ErrorF("(%d): %s", scrnIndex, buffer);
+ va_end(ap);
+}
+
+Bool
+DRIScreenInit(
+ ScreenPtr pScreen,
+ DRIInfoPtr pDRIInfo,
+ int* pDRMSubFD)
+{
+ DRIScreenPrivPtr pDRIPriv;
+ drmContextPtr reserved;
+ int reserved_count;
+ int i;
+
+ if (DRIGeneration != serverGeneration) {
+ if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ DRIGeneration = serverGeneration;
+ }
+
+ if (!drmAvailable()) {
+ return FALSE;
+ }
+
+ if (!(pDRIPriv = (DRIScreenPrivPtr)xalloc(sizeof(DRIScreenPrivRec)))) {
+ return FALSE;
+ }
+ pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer)pDRIPriv;
+
+ pDRIPriv->directRenderingSupport = TRUE;
+ pDRIPriv->pDriverInfo = pDRIInfo;
+
+ /* setup device independent direct rendering memory maps */
+
+ if ((pDRIPriv->drmFD = drmOpenDRM()) < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ return FALSE;
+ }
+
+ if (drmCreateSub(pDRIPriv->drmFD,
+ pDRIPriv->pDriverInfo->drmDriverName,
+ pDRIPriv->pDriverInfo->busIdString) < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ drmCloseDRM(pDRIPriv->drmFD);
+ return FALSE;
+ }
+
+ pDRIPriv->drmSubFD = drmOpenSub(pDRIPriv->pDriverInfo->busIdString);
+ if (pDRIPriv->drmSubFD < 0) {
+ pDRIPriv->directRenderingSupport = FALSE;
+ drmDestroySub(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
+ drmCloseDRM(pDRIPriv->drmFD);
+ return FALSE;
+ }
+ *pDRMSubFD = pDRIPriv->drmSubFD;
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] created \"%s\" driver at busid \"%s\"\n",
+ pDRIPriv->pDriverInfo->drmDriverName,
+ pDRIPriv->pDriverInfo->busIdString);
+
+ if (drmAddMap( pDRIPriv->drmSubFD,
+ 0,
+ pDRIPriv->pDriverInfo->SAREASize,
+ DRM_SHM,
+ DRM_CONTAINS_LOCK,
+ &pDRIPriv->hSAREA) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ drmCloseSub(pDRIPriv->drmSubFD);
+ drmDestroySub(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
+ drmCloseDRM(pDRIPriv->drmFD);
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d byte SAREA at 0x%08lx\n",
+ pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
+
+ if (drmMap( pDRIPriv->drmSubFD,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pDriverInfo->SAREASize,
+ (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ drmCloseSub(pDRIPriv->drmSubFD);
+ drmDestroySub(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
+ drmCloseDRM(pDRIPriv->drmFD);
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA 0x%08lx to %p\n",
+ pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+
+ if (drmAddMap( pDRIPriv->drmSubFD,
+ (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
+ pDRIPriv->pDriverInfo->frameBufferSize,
+ DRM_FRAME_BUFFER,
+ 0,
+ &pDRIPriv->hFrameBuffer) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
+ drmCloseSub(pDRIPriv->drmSubFD);
+ drmDestroySub(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
+ drmCloseDRM(pDRIPriv->drmFD);
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = 0x%08lx\n",
+ pDRIPriv->hFrameBuffer);
+
+ /* Add tags for reserved contexts */
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmSubFD,
+ &reserved_count))) {
+ int i;
+ void *tag;
+
+ for (i = 0; i < reserved_count; i++) {
+ tag = DRICreateContextPrivFromHandle(pScreen,
+ reserved[i],
+ DRI_CONTEXT_RESERVED);
+ drmAddContextTag(pDRIPriv->drmSubFD, reserved[i], tag);
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
+
+ /* validate max drawable table entry set by driver */
+ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) ||
+ (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "Invalid max drawable table size set by driver: %d\n",
+ pDRIPriv->pDriverInfo->maxDrawableTableEntry);
+ }
+
+ /* Initialize drawable tables (screen private and SAREA) */
+ for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
+ pDRIPriv->DRIDrawables[i] = NULL;
+ pDRIPriv->pSAREA->drawableTable[i].stamp = 0;
+ pDRIPriv->pSAREA->drawableTable[i].flags = 0;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIFinishScreenInit(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextFlags flags = 0;
+ DRIContextPrivPtr pDRIContextPriv;
+
+ /* Set up flags for DRICreateContextPriv */
+ switch (pDRIPriv->pDriverInfo->driverSwapMethod) {
+ case DRI_KERNEL_SWAP: flags = DRI_CONTEXT_2DONLY; break;
+ case DRI_HIDE_X_CONTEXT: flags = DRI_CONTEXT_PRESERVED; break;
+ }
+
+ if (!(pDRIContextPriv = DRICreateContextPriv(pScreen,
+ &pDRIPriv->myContext,
+ flags))) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to create server context\n");
+ return FALSE;
+ }
+ pDRIPriv->myContextPriv = pDRIContextPriv;
+
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "X context handle = 0x%08lx\n", pDRIPriv->myContext);
+
+ /* pointers so that we can prevent memory leaks later */
+ pDRIPriv->hiddenContextStore = NULL;
+ pDRIPriv->partial3DContextStore = NULL;
+
+ switch(pDRIPriv->pDriverInfo->driverSwapMethod) {
+ case DRI_HIDE_X_CONTEXT:
+ /* Server will handle 3D swaps, and hide 2D swaps from kernel.
+ * Register server context as a preserved context.
+ */
+
+ /* allocate memory for hidden context store */
+ pDRIPriv->hiddenContextStore
+ = (void **)xalloc(pDRIPriv->pDriverInfo->contextSize);
+ if (!pDRIPriv->hiddenContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to allocate hidden context\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* allocate memory for partial 3D context store */
+ pDRIPriv->partial3DContextStore
+ = (void **)xalloc(pDRIPriv->pDriverInfo->contextSize);
+ if (!pDRIPriv->partial3DContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] failed to allocate partial 3D context\n");
+ xfree(pDRIPriv->hiddenContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* save initial context store */
+ if (pDRIPriv->pDriverInfo->SwapContext) {
+ (*pDRIPriv->pDriverInfo->SwapContext)(
+ pScreen,
+ DRI_NO_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore,
+ DRI_NO_CONTEXT,
+ NULL);
+ }
+ /* fall through */
+
+ case DRI_SERVER_SWAP:
+ /* For swap methods of DRI_SERVER_SWAP and DRI_HIDE_X_CONTEXT
+ * setup signal handler for receiving swap requests from kernel
+ */
+ if (drmInstallSIGIOHandler(pDRIPriv->drmSubFD, DRISwapContext)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to setup DRM signal handler\n");
+ if (pDRIPriv->hiddenContextStore)
+ xfree(pDRIPriv->hiddenContextStore);
+ if (pDRIPriv->partial3DContextStore)
+ xfree(pDRIPriv->partial3DContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ } else {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] installed DRM signal handler\n");
+ }
+
+ default:
+ break;
+ }
+
+ /* Wrap DRI support */
+ pDRIPriv->WakeupHandler = pScreen->WakeupHandler;
+ pDRIPriv->BlockHandler = pScreen->BlockHandler;
+ pDRIPriv->ValidateTree = pScreen->ValidateTree;
+ pDRIPriv->PostValidateTree = pScreen->PostValidateTree;
+ pScreen->WakeupHandler = DRIWakeupHandler;
+ pScreen->BlockHandler = DRIBlockHandler;
+ pScreen->ValidateTree = DRIValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
+
+ /* Potentential optimization: don't wrap the following routines if
+ pDRIPriv->pDriverInfo->bufferRequests == DRI_NO_WINDOWS */
+ pDRIPriv->PaintWindowBackground = pScreen->PaintWindowBackground;
+ pDRIPriv->PaintWindowBorder = pScreen->PaintWindowBorder;
+ pDRIPriv->CopyWindow = pScreen->CopyWindow;
+ pScreen->PaintWindowBackground = DRIPaintWindow;
+ pScreen->PaintWindowBorder = DRIPaintWindow;
+ pScreen->CopyWindow = DRICopyWindow;
+ miClipNotify(DRIClipNotify);
+
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n");
+
+ return TRUE;
+}
+
+void
+DRICloseScreen(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ drmContextPtr reserved;
+ int reserved_count;
+
+ if (pDRIPriv && pDRIPriv->directRenderingSupport) {
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod != DRI_KERNEL_SWAP) {
+ if (drmRemoveSIGIOHandler(pDRIPriv->drmSubFD)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to remove DRM signal handler\n");
+ }
+ }
+
+ if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to destroy server context\n");
+ }
+
+ /* Remove tags for reserved contexts */
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmSubFD,
+ &reserved_count))) {
+ int i;
+
+ for (i = 0; i < reserved_count; i++) {
+ DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmSubFD,
+ reserved[i]));
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] removed %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
+
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] unmapping %d bytes of SAREA 0x%08lx at %p\n",
+ pDRIPriv->pDriverInfo->SAREASize,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pSAREA);
+ if (drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] unable to unmap %d bytes"
+ " of SAREA 0x%08lx at %p\n",
+ pDRIPriv->pDriverInfo->SAREASize,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pSAREA);
+ }
+
+ drmCloseSub(pDRIPriv->drmSubFD);
+ if (drmDestroySub(pDRIPriv->drmFD,
+ pDRIPriv->pDriverInfo->busIdString)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] unable to destroy \"%s\""
+ " at busid \"%s\"\n",
+ pDRIPriv->pDriverInfo->drmDriverName,
+ pDRIPriv->pDriverInfo->busIdString);
+ }
+ drmCloseDRM(pDRIPriv->drmFD);
+ xfree(pDRIPriv);
+ pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ }
+}
+
+Bool
+DRIExtensionInit(void)
+{
+ int i;
+ ScreenPtr pScreen;
+
+ if (DRIScreenPrivIndex < 0) {
+ return FALSE;
+ }
+
+ /* Allocate a window private index with a zero sized private area for
+ * each window, then should a window become a DRI window, we'll hang
+ * a DRIWindowPrivateRec off of this private index.
+ */
+ if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
+ return FALSE;
+
+ DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
+ DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+DRIReset(
+)
+{
+ /*
+ * This stub routine is called when the X Server recycles, resources
+ * allocated by DRIExtensionInit need to be managed here.
+ *
+ * Currently this routine is a stub because all the interesting resources
+ * are managed via the screen init process.
+ */
+}
+
+Bool
+DRIQueryDirectRenderingCapable(
+ ScreenPtr pScreen,
+ Bool* isCapable
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv)
+ *isCapable = pDRIPriv->directRenderingSupport;
+ else
+ *isCapable = FALSE;
+
+ return TRUE;
+}
+
+Bool
+DRIOpenConnection(
+ ScreenPtr pScreen,
+ drmHandlePtr hSAREA,
+ char **busIdString
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *hSAREA = pDRIPriv->hSAREA;
+ *busIdString = pDRIPriv->pDriverInfo->busIdString;
+
+ return TRUE;
+}
+
+Bool
+DRIAuthConnection(
+ ScreenPtr pScreen,
+ drmMagic magic
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (drmAuthMagic(pDRIPriv->drmSubFD, magic)) return FALSE;
+ return TRUE;
+}
+
+Bool
+DRICloseConnection(
+ ScreenPtr pScreen
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ return TRUE;
+}
+
+Bool
+DRIGetClientDriverName(
+ ScreenPtr pScreen,
+ int* ddxDriverMajorVersion,
+ int* ddxDriverMinorVersion,
+ int* ddxDriverPatchVersion,
+ char** clientDriverName
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion;
+ *ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion;
+ *ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion;
+ *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName;
+
+ return TRUE;
+}
+
+/* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper
+ functions that layer on drmCreateContext and drmAddContextTag.
+
+ DRICreateContextPriv always creates a kernel drmContext and then calls
+ DRICreateContextPrivFromHandle to create a DRIContextPriv structure for
+ DRI tracking. For the SIGIO handler, the drmContext is associated with
+ DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv
+ area and are passed to the kernel (if necessary).
+
+ DRICreateContextPriv returns a pointer to newly allocated
+ DRIContextPriv, and returns the kernel drmContext in pHWContext. */
+
+DRIContextPrivPtr
+DRICreateContextPriv(ScreenPtr pScreen,
+ drmContextPtr pHWContext,
+ DRIContextFlags flags)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (drmCreateContext(pDRIPriv->drmSubFD, pHWContext)) {
+ return NULL;
+ }
+
+ return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags);
+}
+
+DRIContextPrivPtr
+DRICreateContextPrivFromHandle(ScreenPtr pScreen,
+ drmContext hHWContext,
+ DRIContextFlags flags)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextPrivPtr pDRIContextPriv;
+ int contextPrivSize;
+
+ contextPrivSize = sizeof(DRIContextPrivRec) +
+ pDRIPriv->pDriverInfo->contextSize;
+ if (!(pDRIContextPriv = xalloc(contextPrivSize))) {
+ return NULL;
+ }
+ pDRIContextPriv->pContextStore = (void **)(pDRIContextPriv + 1);
+
+ drmAddContextTag(pDRIPriv->drmSubFD, hHWContext, pDRIContextPriv);
+
+ pDRIContextPriv->hwContext = hHWContext;
+ pDRIContextPriv->pScreen = pScreen;
+ pDRIContextPriv->flags = flags;
+ pDRIContextPriv->valid3D = FALSE;
+
+ if (flags & DRI_CONTEXT_2DONLY) {
+ if (drmSetContextFlags(pDRIPriv->drmSubFD,
+ hHWContext,
+ DRM_CONTEXT_2DONLY)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set 2D context flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
+ }
+ if (flags & DRI_CONTEXT_PRESERVED) {
+ if (drmSetContextFlags(pDRIPriv->drmSubFD,
+ hHWContext,
+ DRM_CONTEXT_PRESERVED)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set preserved flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
+ }
+ return pDRIContextPriv;
+}
+
+Bool
+DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv)
+{
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (!pDRIContextPriv) return TRUE;
+
+ pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
+
+ if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) {
+ /* Don't delete reserved contexts from
+ kernel area -- the kernel manages its
+ reserved contexts itself. */
+ if (drmDestroyContext(pDRIPriv->drmSubFD, pDRIContextPriv->hwContext))
+ return FALSE;
+ }
+ /* Remove the tag last to prevent a race
+ condition where the context has pending
+ buffers. The context can't be re-used
+ while in this thread, but buffers can be
+ dispatched asynchronously. */
+ drmDelContextTag(pDRIPriv->drmSubFD, pDRIContextPriv->hwContext);
+ xfree(pDRIContextPriv);
+ return TRUE;
+}
+
+Bool
+DRICreateContext(
+ ScreenPtr pScreen,
+ VisualPtr visual,
+ XID context,
+ drmContextPtr pHWContext
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum];
+ __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual;
+ void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
+ DRIContextPrivPtr pDRIContextPriv;
+ int visNum;
+
+ /* Find the GLX visual associated with the one requested */
+ for (visNum = 0;
+ visNum < pGLXScreen->numVisuals;
+ visNum++, pGLXVis++, pVisualConfigPriv++)
+ if (pGLXVis->vid == visual->vid)
+ break;
+ if (visNum == pGLXScreen->numVisuals) {
+ /* No matching GLX visual found */
+ return FALSE;
+ }
+
+ if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) {
+ return FALSE;
+ }
+
+ if (pDRIPriv->pDriverInfo->CreateContext) {
+ if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen,
+ visual,
+ *pHWContext,
+ *pVisualConfigPriv))) {
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+ }
+
+ /* track this in case the client dies before cleanup */
+ AddResource(context, DRIContextPrivResType, (pointer)pDRIContextPriv);
+
+ return TRUE;
+}
+
+Bool
+DRIDestroyContext(
+ ScreenPtr pScreen,
+ XID context
+)
+{
+ FreeResourceByType(context, DRIContextPrivResType, FALSE);
+
+ return TRUE;
+}
+
+/* DRIContextPrivDelete is called by the resource manager. */
+Bool
+DRIContextPrivDelete(
+ pointer pResource,
+ XID id)
+{
+ DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource;
+
+ return DRIDestroyContextPriv(pDRIContextPriv);
+}
+
+Bool
+DRICreateDrawable(
+ ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable,
+ drmDrawablePtr hHWDrawable
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ WindowPtr pWin;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ pDRIDrawablePriv->refCount++;
+ }
+ else {
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
+ return FALSE;
+ }
+
+ /* Only create a drmDrawable once */
+ if (drmCreateDrawable(pDRIPriv->drmSubFD, hHWDrawable)) {
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* add it to the list of DRI drawables for this screen */
+ pDRIDrawablePriv->hwDrawable = *hHWDrawable;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 1;
+ pDRIDrawablePriv->drawableIndex = -1;
+
+ /* save private off of preallocated index */
+ pWin->devPrivates[DRIWindowPrivIndex].ptr =
+ (pointer)pDRIDrawablePriv;
+
+ /* track this in case this window is destroyed */
+ AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIDestroyDrawable(
+ ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable
+)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ WindowPtr pWin;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ pDRIDrawablePriv->refCount--;
+ if (pDRIDrawablePriv->refCount <= 0) {
+ /* This calls back DRIDrawablePrivDelete which frees private area */
+ FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIDrawablePrivDelete(
+ pointer pResource,
+ XID id)
+{
+ DrawablePtr pDrawable = (DrawablePtr)pResource;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ WindowPtr pWin;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv->drawableIndex != -1) {
+ /* release drawable table entry */
+ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
+ }
+
+ if (drmDestroyDrawable(pDRIPriv->drmSubFD,
+ pDRIDrawablePriv->hwDrawable)) {
+ return FALSE;
+ }
+ xfree(pDRIDrawablePriv);
+ pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIGetDrawableInfo(
+ ScreenPtr pScreen,
+ DrawablePtr pDrawable,
+ unsigned int* index,
+ unsigned int* stamp,
+ int* X,
+ int* Y,
+ int* W,
+ int* H,
+ int* numClipRects,
+ XF86DRIClipRectPtr* pClipRects
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv;
+ WindowPtr pWin, pOldWin;
+ int i, oldestIndex = 0;
+ unsigned int oldestStamp;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+
+ /* Manage drawable table */
+ if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */
+
+ /* Search table for empty entry */
+ i = 0;
+ while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ if (!(pDRIPriv->DRIDrawables[i])) {
+ pDRIPriv->DRIDrawables[i] = pDrawable;
+ pDRIDrawablePriv->drawableIndex = i;
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ break;
+ }
+ i++;
+ }
+
+ /* Search table for oldest entry */
+ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ oldestStamp = ~0;
+ i = pDRIPriv->pDriverInfo->maxDrawableTableEntry;
+ while (i--) {
+ if (pDRIPriv->pSAREA->drawableTable[i].stamp <
+ oldestStamp) {
+ oldestIndex = i;
+ oldestStamp =
+ pDRIPriv->pSAREA->drawableTable[i].stamp;
+ }
+ }
+ pDRIDrawablePriv->drawableIndex = oldestIndex;
+
+ /* release oldest drawable table entry */
+ pOldWin = (WindowPtr)pDRIPriv->DRIDrawables[oldestIndex];
+ pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin);
+ pOldDrawPriv->drawableIndex = -1;
+
+ /* claim drawable table entry */
+ pDRIPriv->DRIDrawables[i] = pDrawable;
+
+ /* validate SAREA entry */
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+
+ /* check for stamp wrap around */
+ if (oldestStamp > DRIDrawableValidationStamp) {
+
+ /* walk SAREA table and invalidate all drawables */
+ for( i=0;
+ i < pDRIPriv->pDriverInfo->maxDrawableTableEntry;
+ i++) {
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ }
+ }
+ }
+
+ /* reinit drawable ID if window is visible */
+ if ((pWin->viewable) &&
+ (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS))
+ {
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin,
+ &pWin->clipList, pDRIDrawablePriv->drawableIndex);
+ }
+ }
+
+ *index = pDRIDrawablePriv->drawableIndex;
+ *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp;
+ *X = (int)(pWin->drawable.x);
+ *Y = (int)(pWin->drawable.y);
+ *W = (int)(pWin->winSize.extents.x2 - pWin->winSize.extents.x1);
+ *H = (int)(pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+ *numClipRects = REGION_NUM_RECTS(&pWin->clipList);
+ *pClipRects = (XF86DRIClipRectPtr)REGION_RECTS(&pWin->clipList);
+ }
+ else {
+ /* Not a DRIDrawable */
+ return FALSE;
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIGetDeviceInfo(
+ ScreenPtr pScreen,
+ drmHandlePtr hFrameBuffer,
+ int* fbOrigin,
+ int* fbSize,
+ int* fbStride,
+ int* devPrivateSize,
+ void** pDevPrivate
+)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *hFrameBuffer = pDRIPriv->hFrameBuffer;
+ *fbOrigin = 0;
+ *fbSize = pDRIPriv->pDriverInfo->frameBufferSize;
+ *fbStride = pDRIPriv->pDriverInfo->frameBufferStride;
+ *devPrivateSize = pDRIPriv->pDriverInfo->devPrivateSize;
+ *pDevPrivate = pDRIPriv->pDriverInfo->devPrivate;
+
+ return TRUE;
+}
+
+DRIInfoPtr
+DRICreateInfoRec(void)
+{
+ DRIInfoPtr inforec = xalloc(sizeof(DRIInfoRec));
+ inforec->busIdString = NULL;
+ return inforec;
+}
+
+void
+DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
+{
+ if (DRIInfo->busIdString) xfree(DRIInfo->busIdString);
+ xfree((char*)DRIInfo);
+}
+
+void
+DRIWakeupHandler(
+ int screenNum,
+ pointer wakeupData,
+ unsigned long result,
+ pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ DRM_LIGHT_LOCK(pDRIPriv->drmSubFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
+ }
+
+ /* unwrap */
+ pScreen->WakeupHandler = pDRIPriv->WakeupHandler;
+
+ /* call lower layers */
+ (*pScreen->WakeupHandler)(screenNum, wakeupData, result, pReadmask);
+
+ /* rewrap */
+ pDRIPriv->WakeupHandler = pScreen->WakeupHandler;
+ pScreen->WakeupHandler = DRIWakeupHandler;
+}
+
+void
+DRIBlockHandler(
+ int screenNum,
+ pointer blockData,
+ struct timeval **pTimeout,
+ pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ /* unwrap */
+ pScreen->BlockHandler = pDRIPriv->BlockHandler;
+
+ /* call lower layers */
+ (*pScreen->BlockHandler)(screenNum, blockData, pTimeout, pReadmask);
+
+ /* rewrap */
+ pDRIPriv->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = DRIBlockHandler;
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
+ }
+
+ DRM_UNLOCK(pDRIPriv->drmSubFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
+}
+
+void
+DRISwapContext(
+ int drmSubFD,
+ void *oldctx,
+ void *newctx
+)
+{
+ DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx;
+ DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx;
+ ScreenPtr pScreen = newContext->pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ void** oldContextStore = NULL;
+ DRIContextType oldContextType;
+ void** newContextStore = NULL;
+ DRIContextType newContextType;
+ DRISyncType syncType;
+#ifdef DEBUG
+ static int count = 0;
+#endif
+
+ if (!newContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n",
+ oldContext, newContext);
+ return;
+ }
+
+#ifdef DEBUG
+ /* usefull for debugging, just print out after n context switches */
+ if (!count || !(count % 1)) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d from %p/0x%08x (%d)\n",
+ count,
+ oldContext,
+ oldContext ? oldContext->flags : 0,
+ oldContext ? oldContext->hwContext : -1);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d to %p/0x%08x (%d)\n",
+ count,
+ newContext,
+ newContext ? newContext->flags : 0,
+ newContext ? newContext->hwContext : -1);
+ }
+ ++count;
+#endif
+
+ if (!pDRIPriv->pDriverInfo->SwapContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] DDX driver missing context swap call back\n");
+ return;
+ }
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+
+ /* only 3D contexts are swapped in this case */
+ if (oldContext) {
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ } else {
+ oldContextType = DRI_NO_CONTEXT;
+ }
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
+ else /* default: driverSwapMethod == DRI_SERVER_SWAP */ {
+
+ /* optimize 2D context swaps */
+
+ if (newContext->flags & DRI_CONTEXT_2DONLY) {
+ /* go from 3D context to 2D context and only save 2D
+ * subset of 3D state
+ */
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_3D_SYNC;
+ pDRIPriv->lastPartial3DContext = oldContext;
+ }
+ else if (oldContext->flags & DRI_CONTEXT_2DONLY) {
+ if (pDRIPriv->lastPartial3DContext == newContext) {
+ /* go from 2D context back to previous 3D context and
+ * only restore 2D subset of previous 3D state
+ */
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_2D_SYNC;
+ }
+ else {
+ /* go from 2D context to a different 3D context */
+
+ /* call DDX driver to do partial restore */
+ oldContextStore = DRIGetContextStore(oldContext);
+ newContextStore =
+ DRIGetContextStore(pDRIPriv->lastPartial3DContext);
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_2D_CONTEXT,
+ oldContextStore,
+ DRI_2D_CONTEXT,
+ newContextStore);
+
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_NO_SYNC;
+ }
+ }
+ else {
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
+ }
+
+ /* call DDX driver to perform the swap */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ syncType,
+ oldContextType,
+ oldContextStore,
+ newContextType,
+ newContextStore);
+}
+
+void**
+DRIGetContextStore(DRIContextPrivPtr context)
+{
+ return((void **)context->pContextStore);
+}
+
+void
+DRIPaintWindow(
+ WindowPtr pWin,
+ RegionPtr prgn,
+ int what)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ /* NOT_DONE: HACK until we have newly transitioned 3D->2D
+ * windows computed
+ */
+ if(what == PW_BACKGROUND) {
+ if ((pDRIPriv->pDriverInfo->bufferRequests == DRI_3D_WINDOWS_ONLY) &&
+ (pDRIDrawablePriv)) {
+
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ pDRIDrawablePriv->drawableIndex);
+ }
+ else if (pDRIPriv->pDriverInfo->bufferRequests == DRI_ALL_WINDOWS) {
+ if (pDRIDrawablePriv) {
+
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ pDRIDrawablePriv->drawableIndex);
+ }
+ else {
+
+ /* DMA flush buffers shouldn't be needed here */
+
+ /* call DDX driver's DRI specific InitBuffer */
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ pDRIPriv->pDriverInfo->ddxDrawableTableEntry);
+ }
+ }
+
+ /* unwrap */
+ pScreen->PaintWindowBackground = pDRIPriv->PaintWindowBackground;
+
+ /* call lower layers */
+ (*pScreen->PaintWindowBackground)(pWin, prgn, what);
+
+ /* rewrap */
+ pDRIPriv->PaintWindowBackground = pScreen->PaintWindowBackground;
+ pScreen->PaintWindowBackground = DRIPaintWindow;
+ }
+ else {
+ if (pDRIPriv->pDriverInfo->bufferRequests == DRI_ALL_WINDOWS) {
+ /* call DDX driver's DRI specific InitBuffer */
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ pDRIPriv->pDriverInfo->ddxDrawableTableEntry);
+ }
+
+ /* unwrap */
+ pScreen->PaintWindowBorder = pDRIPriv->PaintWindowBorder;
+
+ /* call lower layers */
+ (*pScreen->PaintWindowBorder)(pWin, prgn, what);
+
+ /* rewrap */
+ pDRIPriv->PaintWindowBorder = pScreen->PaintWindowBorder;
+ pScreen->PaintWindowBorder = DRIPaintWindow;
+ }
+}
+
+void
+DRICopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ /* HACK until we have newly transitioned 3D->2D windows repainted */
+ if ((pDRIPriv->pDriverInfo->bufferRequests == DRI_3D_WINDOWS_ONLY) &&
+ (pDRIDrawablePriv)) {
+
+ (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, prgnSrc,
+ pDRIDrawablePriv->drawableIndex);
+ }
+ else if (pDRIPriv->pDriverInfo->bufferRequests == DRI_ALL_WINDOWS) {
+ if (pDRIDrawablePriv) {
+
+ (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, prgnSrc,
+ pDRIDrawablePriv->drawableIndex);
+ }
+ else {
+ /* call DDX driver's DRI specific InitBuffer */
+ (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, prgnSrc,
+ pDRIPriv->pDriverInfo->ddxDrawableTableEntry);
+ }
+ }
+
+ /* unwrap */
+ pScreen->CopyWindow = pDRIPriv->CopyWindow;
+
+ /* call lower layers */
+ (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+
+ /* rewrap */
+ pDRIPriv->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = DRICopyWindow;
+}
+
+static void
+DRIGetSecs(unsigned long *secs, unsigned long *usecs)
+{
+#if XFree86LOADER
+ xf86getsecs(secs,usecs);
+#else
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ *secs = tv.tv_sec;
+ *usecs = tv.tv_usec;
+#endif
+}
+
+static unsigned long
+DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs,
+ unsigned long f_secs, unsigned long f_usecs)
+{
+ if (f_usecs < s_usecs) {
+ --f_secs;
+ f_usecs += 1000000;
+ }
+ return (f_secs - s_secs) * 1000 + (f_usecs - s_usecs) / 1000;
+}
+
+static void
+DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */)
+{
+ int count = 10000;
+ char ret;
+ unsigned long s_secs, s_usecs;
+ unsigned long f_secs, f_usecs;
+ unsigned long msecs;
+ unsigned long prev = 0;
+
+ DRIGetSecs(&s_secs, &s_usecs);
+
+ do {
+ DRM_SPINLOCK_COUNT(lock, val, count, ret);
+ if (!ret) return; /* Got lock */
+ DRIGetSecs(&f_secs, &f_usecs);
+ msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs);
+ if (msecs - prev < 250) count *= 2; /* Not more than 0.5S */
+ } while (msecs < timeout);
+
+ /* Didn't get lock, so take it. The worst
+ that can happen is that there is some
+ garbage written to the wrong part of the
+ framebuffer that a refresh will repair.
+ That's undesirable, but better than
+ locking the server. This should be a
+ very rare event. */
+ DRM_SPINLOCK_TAKE(lock, val);
+}
+
+int
+DRIValidateTree(
+ WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind)
+{
+ ScreenPtr pScreen = pParent->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ int returnValue;
+
+ /* Prepare to flush outstanding DMA buffers */
+
+ /* Restore the last known 3D context if the X context is hidden */
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
+ }
+
+ /* Call kernel to release lock */
+ DRM_UNLOCK(pDRIPriv->drmSubFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
+
+ /* Grab drawable spin lock: a time out between 10 and 30 seconds is
+ appropriate, since this should never time out except in the case of
+ client death while the lock is being held. The timeout must be
+ greater than any reasonable rendering time. */
+ DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /* 10 secs */
+
+ /* Call kernel flush outstanding buffers and relock */
+ DRM_LOCK(pDRIPriv->drmSubFD, pDRIPriv->pSAREA, pDRIPriv->myContext,
+ DRM_LOCK_QUIESCENT|DRM_LOCK_FLUSH_ALL);
+
+ /* Switch back to our 2D context if the X context is hidden */
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
+ }
+
+ /* unwrap */
+ pScreen->ValidateTree = pDRIPriv->ValidateTree;
+
+ /* call lower layers */
+ returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = DRIValidateTree;
+
+ return returnValue;
+}
+
+void
+DRIPostValidateTree(
+ WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind)
+{
+ ScreenPtr pScreen;
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (pParent) {
+ pScreen = pParent->drawable.pScreen;
+ } else {
+ pScreen = pChild->drawable.pScreen;
+ }
+ pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->PostValidateTree) {
+ /* unwrap */
+ pScreen->PostValidateTree = pDRIPriv->PostValidateTree;
+
+ /* call lower layers */
+ (*pScreen->PostValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
+ }
+
+ if (pParent) {
+ /* Release spin lock */
+ DRM_SPINUNLOCK(&pDRIPriv->pSAREA->drawable_lock, 1);
+ }
+}
+
+void
+DRIClipNotify(
+ WindowPtr pWin,
+ int dx,
+ int dy)
+{
+ DRIScreenPrivPtr pDRIPriv;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ pDRIPriv = DRI_SCREEN_PRIV(pWin->drawable.pScreen);
+ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
+ = DRIDrawableValidationStamp++;
+ }
+}
+
+CARD32
+DRIGetDrawableIndex(
+ WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ CARD32 index;
+
+ if (pDRIDrawablePriv) {
+ index = pDRIDrawablePriv->drawableIndex;
+ }
+ else {
+ index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry;
+ }
+
+ return index;
+}
diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h
new file mode 100644
index 000000000..9f5b3ecfa
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/dri.h
@@ -0,0 +1,231 @@
+/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.2 1999/06/27 14:07:38 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/dri.h,v 1.22 1999/06/16 20:08:35 faith Exp $
+ */
+
+/* Prototypes for DRI functions */
+
+#ifndef _DRI_H_
+
+typedef int DRISyncType;
+
+#define DRI_NO_SYNC 0
+#define DRI_2D_SYNC 1
+#define DRI_3D_SYNC 2
+
+typedef int DRIContextType;
+
+typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
+
+typedef enum _DRIContextFlags
+{
+ DRI_CONTEXT_2DONLY = 0x01,
+ DRI_CONTEXT_PRESERVED = 0x02,
+ DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
+} DRIContextFlags;
+
+#define DRI_NO_CONTEXT 0
+#define DRI_2D_CONTEXT 1
+#define DRI_3D_CONTEXT 2
+
+typedef int DRISwapMethod;
+
+#define DRI_HIDE_X_CONTEXT 0
+#define DRI_SERVER_SWAP 1
+#define DRI_KERNEL_SWAP 2
+
+typedef int DRIWindowRequests;
+
+#define DRI_NO_WINDOWS 0
+#define DRI_3D_WINDOWS_ONLY 1
+#define DRI_ALL_WINDOWS 2
+
+typedef struct {
+ /* driver call back functions */
+ Bool (*CreateContext)(ScreenPtr pScreen,
+ VisualPtr visual,
+ drmContext hHWContext,
+ void* pVisualConfigPriv);
+ void (*SwapContext)(ScreenPtr pScreen,
+ DRISyncType syncType,
+ DRIContextType readContextType,
+ void** readContextStore,
+ DRIContextType writeContextType,
+ void** writeContextStore);
+ void (*InitBuffers)(WindowPtr pWin,
+ RegionPtr prgn,
+ CARD32 index);
+ void (*MoveBuffers)(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc,
+ CARD32 index);
+
+ /* device info */
+ char* drmDriverName;
+ char* clientDriverName;
+ char* busIdString;
+ int ddxDriverMajorVersion;
+ int ddxDriverMinorVersion;
+ int ddxDriverPatchVersion;
+ CARD32 frameBufferPhysicalAddress;
+ long frameBufferSize;
+ long frameBufferStride;
+ long SAREASize;
+ int maxDrawableTableEntry;
+ int ddxDrawableTableEntry;
+ long contextSize;
+ DRISwapMethod driverSwapMethod;
+ DRIWindowRequests bufferRequests;
+ int devPrivateSize;
+ void* devPrivate;
+} DRIInfoRec, *DRIInfoPtr;
+
+extern Bool DRIScreenInit(
+ ScreenPtr pScreen,
+ DRIInfoPtr pDRIInfo,
+ int* pDRMSubFD);
+void DRICloseScreen(ScreenPtr pScreen);
+Bool DRIExtensionInit(void);
+void DRIReset(void);
+Bool DRIQueryDirectRenderingCapable( ScreenPtr pScreen, Bool* isCapable);
+Bool DRIOpenConnection(
+ ScreenPtr pScreen,
+ drmHandlePtr hSAREA,
+ char **busIdString
+);
+Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic);
+Bool DRICloseConnection( ScreenPtr pScreen);
+Bool DRIGetClientDriverName(
+ ScreenPtr pScreen,
+ int* ddxDriverMajorVersion,
+ int* ddxDriverMinorVersion,
+ int* ddxDriverPatchVersion,
+ char** clientDriverName
+);
+Bool DRICreateContext(
+ ScreenPtr pScreen,
+ VisualPtr visual,
+ XID context,
+ drmContextPtr pHWContext
+);
+Bool DRIDestroyContext( ScreenPtr pScreen, XID context);
+Bool DRIContextPrivDelete(
+ pointer pResource,
+ XID id);
+Bool DRICreateDrawable(
+ ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable,
+ drmDrawablePtr hHWDrawable
+);
+Bool DRIDestroyDrawable( ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable);
+Bool DRIDrawablePrivDelete(
+ pointer pResource,
+ XID id);
+Bool DRIGetDrawableInfo(
+ ScreenPtr pScreen,
+ DrawablePtr pDrawable,
+ unsigned int* index,
+ unsigned int* stamp,
+ int* X,
+ int* Y,
+ int* W,
+ int* H,
+ int* numClipRects,
+ XF86DRIClipRectPtr* pClipRects
+);
+Bool DRIGetDeviceInfo(
+ ScreenPtr pScreen,
+ drmHandlePtr hFrameBuffer,
+ int* fbOrigin,
+ int* fbSize,
+ int* fbStride,
+ int* devPrivateSize,
+ void** pDevPrivate
+);
+DRIInfoPtr DRICreateInfoRec(void);
+void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
+Bool DRIFinishScreenInit(ScreenPtr pScreen);
+void DRIWakeupHandler(
+ int screenNum,
+ pointer wakeupData,
+ unsigned long result,
+ pointer pReadmask);
+void DRIBlockHandler(
+ int screenNum,
+ pointer blockData,
+ struct timeval **pTimeout,
+ pointer pReadmask);
+void DRISwapContext(
+ int drmSubFD,
+ void *oldctx,
+ void *newctx);
+void** DRIGetContextStore(DRIContextPrivPtr context);
+void DRIPaintWindow(
+ WindowPtr pWin,
+ RegionPtr prgn,
+ int what);
+void DRICopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+int DRIValidateTree(
+ WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+void DRIPostValidateTree(
+ WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+void DRIClipNotify(
+ WindowPtr pWin,
+ int dx,
+ int dy);
+CARD32 DRIGetDrawableIndex(
+ WindowPtr pWin);
+
+DRIContextPrivPtr
+DRICreateContextPriv(ScreenPtr pScreen,
+ drmContextPtr pHWContext,
+ DRIContextFlags flags);
+DRIContextPrivPtr
+DRICreateContextPrivFromHandle(ScreenPtr pScreen,
+ drmContext hHWContext,
+ DRIContextFlags flags);
+Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
+
+#define _DRI_H_
+
+#endif
diff --git a/xc/programs/Xserver/GL/dri/drimodule.c b/xc/programs/Xserver/GL/dri/drimodule.c
new file mode 100644
index 000000000..b165d21da
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/drimodule.c
@@ -0,0 +1,83 @@
+/**************************************************************************
+
+Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.1 1999/06/14 07:31:20 dawes Exp $ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ * Rickard E. Faith <faith@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/drimodule.c,v 1.1 1999/06/07 12:55:30 faith Exp $
+ */
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(driSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "dri",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+extern void XFree86DRIExtensionInit(INITARGS);
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+
+ExtensionModule XF86DRIExt =
+{
+ XFree86DRIExtensionInit,
+ XF86DRINAME,
+ NULL,
+ NULL
+};
+
+XF86ModuleData driModuleData = { &VersRec, driSetup, NULL };
+
+static pointer
+driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ pointer drm = NULL;
+
+ LoadExtension(&XF86DRIExt);
+
+ drm = LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin);
+ if (!drm)
+ ErrorF("Cannot load the drm library\n");
+
+ /* Need a non-NULL return value to indicate success */
+ return drm;
+}
+
diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h
new file mode 100644
index 000000000..edd54aef3
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/dristruct.h
@@ -0,0 +1,118 @@
+/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.2 1999/06/27 14:07:39 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/dristruct.h,v 1.26 1999/06/16 20:08:35 faith Exp $
+ */
+
+#ifndef DRI_STRUCT_H
+#define DRI_STRUCT_H
+
+#include "xf86drm.h"
+
+
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \
+ ((DRIWindowPrivIndex < 0) ? \
+ NULL : \
+ ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr)))
+
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \
+ ((DRIPixmapPrivIndex < 0) ? \
+ NULL : \
+ ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIWindowPrivIndex].ptr)))
+
+typedef struct _DRIDrawablePrivRec
+{
+ drmDrawable hwDrawable;
+ int drawableIndex;
+ ScreenPtr pScreen;
+ int refCount;
+} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
+
+struct _DRIContextPrivRec
+{
+ drmContext hwContext;
+ ScreenPtr pScreen;
+ Bool valid3D;
+ DRIContextFlags flags;
+ void** pContextStore;
+};
+
+#define DRI_SCREEN_PRIV(pScreen) \
+ ((DRIScreenPrivIndex < 0) ? \
+ NULL : \
+ ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr)))
+
+#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
+ (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
+
+
+typedef struct _DRIScreenPrivRec
+{
+ Bool directRenderingSupport;
+ int drmFD; /* File descriptor for /dev/drm */
+ int drmSubFD; /* File descriptor for /dev/drm? */
+ drmHandle hSAREA; /* Handle to SAREA, for mapping */
+ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
+ drmHandle hFrameBuffer; /* Handle to framebuffer, for mapping */
+ drmContext myContext; /* DDX Driver's context */
+ DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */
+ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
+ void** hiddenContextStore; /* hidden X context */
+ void** partial3DContextStore; /* parital 3D context */
+ DRIInfoPtr pDriverInfo;
+ void (*WakeupHandler)(int screenNum,
+ pointer wakeupData,
+ unsigned long result,
+ pointer pReadmask);
+ void (*BlockHandler)(int screenNum,
+ pointer blockData,
+ struct timeval **pTimeout,
+ pointer pReadmask);
+ void (*PaintWindowBackground)(WindowPtr pWin,
+ RegionPtr prgn,
+ int what);
+ void (*PaintWindowBorder)(WindowPtr pWin,
+ RegionPtr prgn,
+ int what);
+ void (*CopyWindow)(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+ int (*ValidateTree)(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+ void (*PostValidateTree)(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+ DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
+} DRIScreenPrivRec, *DRIScreenPrivPtr;
+
+#endif /* DRI_STRUCT_H */
diff --git a/xc/programs/Xserver/GL/dri/sarea.h b/xc/programs/Xserver/GL/dri/sarea.h
new file mode 100644
index 000000000..8fffebef8
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/sarea.h
@@ -0,0 +1,58 @@
+/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.1 1999/06/14 07:31:20 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/sarea.h,v 1.9 1999/05/19 01:26:35 martin Exp $
+ */
+
+#ifndef _SAREA_H_
+#define _SAREA_H_
+
+#define SAREA_MAX 0x1000
+#define SAREA_MAX_DRAWABLES 256
+
+#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
+
+typedef struct _XF86DRISAREADrawable {
+ unsigned int stamp;
+ unsigned int flags;
+} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
+
+typedef struct _XF86DRISAREA {
+ /* first thing is always the drm locking structure */
+ drmLock lock;
+ /* NOT_DONE: Use readers/writer lock for drawable_lock */
+ drmLock drawable_lock;
+ XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
+} XF86DRISAREARec, *XF86DRISAREAPtr;
+
+#endif
diff --git a/xc/programs/Xserver/GL/dri/xf86dri.c b/xc/programs/Xserver/GL/dri/xf86dri.c
new file mode 100644
index 000000000..77f74e0a8
--- /dev/null
+++ b/xc/programs/Xserver/GL/dri/xf86dri.c
@@ -0,0 +1,555 @@
+/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.2 1999/06/27 14:07:39 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.20 1999/06/24 19:10:40 faith Exp $
+ */
+
+#if XFree86LOADER
+#include "xf86.h"
+#include "xf86_ansic.h"
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+#include "swaprep.h"
+#include "dri.h"
+#include "sarea.h"
+#include "dristruct.h"
+#include "xf86.h"
+#include "xf86drm.h"
+
+static int DRIErrorBase;
+
+static DISPATCH_PROC(ProcXF86DRIQueryVersion);
+static DISPATCH_PROC(ProcXF86DRIQueryDirectRenderingCapable);
+static DISPATCH_PROC(ProcXF86DRIOpenConnection);
+static DISPATCH_PROC(ProcXF86DRICloseConnection);
+static DISPATCH_PROC(ProcXF86DRIGetClientDriverName);
+static DISPATCH_PROC(ProcXF86DRICreateContext);
+static DISPATCH_PROC(ProcXF86DRIDestroyContext);
+static DISPATCH_PROC(ProcXF86DRICreateDrawable);
+static DISPATCH_PROC(ProcXF86DRIDestroyDrawable);
+static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo);
+static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo);
+static DISPATCH_PROC(ProcXF86DRIDispatch);
+static DISPATCH_PROC(ProcXF86DRIAuthConnection);
+
+static DISPATCH_PROC(SProcXF86DRIQueryVersion);
+static DISPATCH_PROC(SProcXF86DRIDispatch);
+
+static void XF86DRIResetProc(ExtensionEntry* extEntry);
+
+static unsigned char DRIReqCode = 0;
+
+extern void XFree86DRIExtensionInit(void);
+
+void
+XFree86DRIExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+#ifdef XF86DRI_EVENTS
+ EventType = CreateNewResourceType(XF86DRIFreeEvents);
+#endif
+
+ if (
+ DRIExtensionInit() &&
+#ifdef XF86DRI_EVENTS
+ EventType && ScreenPrivateIndex != -1 &&
+#endif
+ (extEntry = AddExtension(XF86DRINAME,
+ XF86DRINumberEvents,
+ XF86DRINumberErrors,
+ ProcXF86DRIDispatch,
+ SProcXF86DRIDispatch,
+ XF86DRIResetProc,
+ StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char)extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86DRIResetProc (
+ ExtensionEntry* extEntry
+)
+{
+ DRIReset();
+}
+
+static int
+ProcXF86DRIQueryVersion(
+ register ClientPtr client
+)
+{
+ xXF86DRIQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86DRI_MAJOR_VERSION;
+ rep.minorVersion = XF86DRI_MINOR_VERSION;
+ rep.patchVersion = XF86DRI_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIQueryDirectRenderingCapable(
+ register ClientPtr client
+)
+{
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ Bool isCapable;
+
+ REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+ REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen],
+ &isCapable)) {
+ return BadValue;
+ }
+ rep.isCapable = isCapable;
+
+ WriteToClient(client,
+ sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIOpenConnection(
+ register ClientPtr client
+)
+{
+ xXF86DRIOpenConnectionReply rep;
+ drmHandle hSAREA;
+ char* busIdString;
+
+ REQUEST(xXF86DRIOpenConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
+
+ if (!DRIOpenConnection( screenInfo.screens[stuff->screen],
+ &hSAREA,
+ &busIdString)) {
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.busIdStringLength = 0;
+ if (busIdString)
+ rep.busIdStringLength = strlen(busIdString);
+ rep.length = (SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
+ ((rep.busIdStringLength + 3) & ~3)) >> 2;
+
+ rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff);
+#ifdef LONG64
+ rep.hSAREAHigh = (CARD32)(hSAREA >> 32);
+#else
+ rep.hSAREAHigh = 0;
+#endif
+
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
+ if (rep.busIdStringLength)
+ WriteToClient(client, rep.busIdStringLength, busIdString);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIAuthConnection(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRIAuthConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
+
+ if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic))
+ ErrorF("Failed to authenticate %u\n", stuff->magic);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICloseConnection(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRICloseConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
+
+ DRICloseConnection( screenInfo.screens[stuff->screen]);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetClientDriverName(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetClientDriverNameReply rep;
+ char* clientDriverName;
+
+ REQUEST(xXF86DRIGetClientDriverNameReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
+
+ DRIGetClientDriverName( screenInfo.screens[stuff->screen],
+ (int *)&rep.ddxDriverMajorVersion,
+ (int *)&rep.ddxDriverMinorVersion,
+ (int *)&rep.ddxDriverPatchVersion,
+ &clientDriverName);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.clientDriverNameLength = 0;
+ if (clientDriverName)
+ rep.clientDriverNameLength = strlen(clientDriverName);
+ rep.length = (SIZEOF(xXF86DRIGetClientDriverNameReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.clientDriverNameLength + 3) & ~3)) >> 2;
+
+ WriteToClient(client,
+ sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
+ if (rep.clientDriverNameLength)
+ WriteToClient(client,
+ rep.clientDriverNameLength,
+ clientDriverName);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICreateContext(
+ register ClientPtr client
+)
+{
+ xXF86DRICreateContextReply rep;
+ ScreenPtr pScreen;
+ VisualPtr visual;
+ int i;
+
+ REQUEST(xXF86DRICreateContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ pScreen = screenInfo.screens[stuff->screen];
+ visual = pScreen->visuals;
+
+ /* Find the requested X visual */
+ for (i = 0; i < pScreen->numVisuals; i++, visual++)
+ if (visual->vid == stuff->visual)
+ break;
+ if (i == pScreen->numVisuals) {
+ /* No visual found */
+ return BadValue;
+ }
+
+ if (!DRICreateContext( pScreen,
+ visual,
+ stuff->context,
+ (drmContextPtr)&rep.hHWContext)) {
+ return BadValue;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyContext(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRIDestroyContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
+
+ if (!DRIDestroyContext( screenInfo.screens[stuff->screen],
+ stuff->context)) {
+ return BadValue;
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICreateDrawable(
+ ClientPtr client
+)
+{
+ xXF86DRICreateDrawableReply rep;
+ DrawablePtr pDrawable;
+
+ REQUEST(xXF86DRICreateDrawableReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
+ (Drawable)stuff->drawable,
+ client,
+ SecurityReadAccess))) {
+ return BadValue;
+ }
+
+ if (!DRICreateDrawable( screenInfo.screens[stuff->screen],
+ (Drawable)stuff->drawable,
+ pDrawable,
+ (drmDrawablePtr)&rep.hHWDrawable)) {
+ return BadValue;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyDrawable(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRIDestroyDrawableReq);
+ DrawablePtr pDrawable;
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
+
+ if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
+ (Drawable)stuff->drawable,
+ client,
+ SecurityReadAccess))) {
+ return BadValue;
+ }
+
+ if (!DRIDestroyDrawable( screenInfo.screens[stuff->screen],
+ (Drawable)stuff->drawable,
+ pDrawable)) {
+ return BadValue;
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDrawableInfo(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetDrawableInfoReply rep;
+ DrawablePtr pDrawable;
+ int X, Y, W, H;
+ XF86DRIClipRectPtr pClipRects;
+
+ REQUEST(xXF86DRIGetDrawableInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable(
+ (Drawable)stuff->drawable,
+ client,
+ SecurityReadAccess))) {
+ return BadValue;
+ }
+
+ if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen],
+ pDrawable,
+ (unsigned int*)&rep.drawableTableIndex,
+ (unsigned int*)&rep.drawableTableStamp,
+ (int*)&X,
+ (int*)&Y,
+ (int*)&W,
+ (int*)&H,
+ (int*)&rep.numClipRects,
+ &pClipRects)) {
+ return BadValue;
+ }
+
+ rep.drawableX = X;
+ rep.drawableY = Y;
+ rep.drawableWidth = W;
+ rep.drawableHeight = H;
+
+ rep.length = 0;
+ if (rep.numClipRects) {
+ rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply) +
+ sizeof(XF86DRIClipRectRec) * rep.numClipRects);
+ }
+
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
+ if (rep.length) {
+ WriteToClient(client, rep.length, (char *)pClipRects);
+ }
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDeviceInfo(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetDeviceInfoReply rep;
+ drmHandle hFrameBuffer;
+ void *pDevPrivate;
+
+ REQUEST(xXF86DRIGetDeviceInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DRIGetDeviceInfo( screenInfo.screens[stuff->screen],
+ &hFrameBuffer,
+ (int*)&rep.framebufferOrigin,
+ (int*)&rep.framebufferSize,
+ (int*)&rep.framebufferStride,
+ (int*)&rep.devPrivateSize,
+ &pDevPrivate)) {
+ return BadValue;
+ }
+
+ rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff);
+#ifdef LONG64
+ rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32);
+#else
+ rep.hFrameBufferHigh = 0;
+#endif
+
+ rep.length = 0;
+ if (rep.devPrivateSize) {
+ rep.length = (SIZEOF(xXF86DRIGetDeviceInfoReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.devPrivateSize + 3) & ~3));
+ }
+
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
+ if (rep.length) {
+ WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate);
+ }
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ if (!LocalClient(client))
+ return DRIErrorBase + XF86DRIClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion:
+ return ProcXF86DRIQueryVersion(client);
+ case X_XF86DRIQueryDirectRenderingCapable:
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+ case X_XF86DRIOpenConnection:
+ return ProcXF86DRIOpenConnection(client);
+ case X_XF86DRICloseConnection:
+ return ProcXF86DRICloseConnection(client);
+ case X_XF86DRIGetClientDriverName:
+ return ProcXF86DRIGetClientDriverName(client);
+ case X_XF86DRICreateContext:
+ return ProcXF86DRICreateContext(client);
+ case X_XF86DRIDestroyContext:
+ return ProcXF86DRIDestroyContext(client);
+ case X_XF86DRICreateDrawable:
+ return ProcXF86DRICreateDrawable(client);
+ case X_XF86DRIDestroyDrawable:
+ return ProcXF86DRIDestroyDrawable(client);
+ case X_XF86DRIGetDrawableInfo:
+ return ProcXF86DRIGetDrawableInfo(client);
+ case X_XF86DRIGetDeviceInfo:
+ return ProcXF86DRIGetDeviceInfo(client);
+ case X_XF86DRIAuthConnection:
+ return ProcXF86DRIAuthConnection(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcXF86DRIQueryVersion(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xXF86DRIQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86DRIQueryVersion(client);
+}
+
+static int
+SProcXF86DRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return DRIErrorBase + XF86DRIClientNotLocal;
+
+ /* only local clients are allowed DRI access */
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion:
+ return SProcXF86DRIQueryVersion(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/GL/glx/Imakefile b/xc/programs/Xserver/GL/glx/Imakefile
new file mode 100644
index 000000000..c9e6767c4
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/Imakefile
@@ -0,0 +1,52 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/glx/Imakefile,v 1.6 1999/06/14 14:28:46 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/glx/Imakefile,v 1.11 1999/05/27 03:43:33 jens Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+ SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \
+ glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \
+ glxutil.c render2.c render2swap.c renderpix.c \
+ renderpixswap.c rensize.c rensizetab.c single2.c \
+ single2swap.c singlepix.c singlepixswap.c \
+ singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \
+ g_render.c g_renderswap.c g_single.c g_singleswap.c \
+ $(MSRCS)
+
+ OBJS = global.o glxbuf.o glxcmds.o glxcmdsswap.o glxext.o \
+ glxfb.o glximports.o glxmem.o glxpix.o glxscreens.o \
+ glxutil.o render2.o render2swap.o renderpix.o \
+ renderpixswap.o rensize.o rensizetab.o single2.o \
+ single2swap.o singlepix.o singlepixswap.o \
+ singlesize.o xfont.o g_disptab.o g_disptab_EXT.o \
+ g_render.o g_renderswap.o g_single.o g_singleswap.o \
+ $(MOBJS)
+
+#if GlxUseSGISI
+ INCLUDES = -I. -I../include -I$(SERVERSRC)/include -I$(XTOP)/include \
+ -I$(SERVERSRC)/mi \
+ -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \
+ -I$(XF86SRC) -I$(XF86COMSRC) -I$(XF86OSSRC)
+#else
+ INCLUDES = -I. -I../include -I$(SERVERSRC)/include -I$(XTOP)/include \
+ -I$(SERVERSRC)/mi \
+ -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(LIBSRC)/GL/include \
+ -I$(XF86SRC) -I../mesa/include -I../mesa/src -I../mesa/src/X
+#endif
+XCOMM If you add "-DDEBUG" in DEFINES, then make sure you also
+XCOMM add DEBUG to the define in ../mesa/src/X/xf86glx.c
+ DEFINES = $(GLX_DEFINES)
+
+
+#if DoLoadableServer
+ModuleObjectRule()
+#else
+NormalLibraryObjectRule()
+#endif
+SubdirLibraryRule($(OBJS))
+NormalLibraryTarget(glx,$(OBJS))
+
+LintLibraryTarget(glx,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/GL/glx/g_disptab.c b/xc/programs/Xserver/GL/glx/g_disptab.c
new file mode 100644
index 000000000..f05e213f3
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_disptab.c
@@ -0,0 +1,711 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+__GLXdispatchSingleProcPtr __glXSingleTable[] = {
+ __glXNoSuchSingleOpcode,
+ __glXRender,
+ __glXRenderLarge,
+ __glXCreateContext,
+ __glXDestroyContext,
+ __glXMakeCurrent,
+ __glXIsDirect,
+ __glXQueryVersion,
+ __glXWaitGL,
+ __glXWaitX,
+ __glXCopyContext,
+ __glXSwapBuffers,
+ __glXUseXFont,
+ __glXCreateGLXPixmap,
+ __glXGetVisualConfigs,
+ __glXDestroyGLXPixmap,
+ __glXVendorPrivate,
+ __glXVendorPrivateWithReply,
+ __glXQueryExtensionsString,
+ __glXQueryServerString,
+ __glXClientInfo,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXDisp_NewList,
+ __glXDisp_EndList,
+ __glXDisp_DeleteLists,
+ __glXDisp_GenLists,
+ __glXDisp_FeedbackBuffer,
+ __glXDisp_SelectBuffer,
+ __glXDisp_RenderMode,
+ __glXDisp_Finish,
+ __glXDisp_PixelStoref,
+ __glXDisp_PixelStorei,
+ __glXDisp_ReadPixels,
+ __glXDisp_GetBooleanv,
+ __glXDisp_GetClipPlane,
+ __glXDisp_GetDoublev,
+ __glXDisp_GetError,
+ __glXDisp_GetFloatv,
+ __glXDisp_GetIntegerv,
+ __glXDisp_GetLightfv,
+ __glXDisp_GetLightiv,
+ __glXDisp_GetMapdv,
+ __glXDisp_GetMapfv,
+ __glXDisp_GetMapiv,
+ __glXDisp_GetMaterialfv,
+ __glXDisp_GetMaterialiv,
+ __glXDisp_GetPixelMapfv,
+ __glXDisp_GetPixelMapuiv,
+ __glXDisp_GetPixelMapusv,
+ __glXDisp_GetPolygonStipple,
+ __glXDisp_GetString,
+ __glXDisp_GetTexEnvfv,
+ __glXDisp_GetTexEnviv,
+ __glXDisp_GetTexGendv,
+ __glXDisp_GetTexGenfv,
+ __glXDisp_GetTexGeniv,
+ __glXDisp_GetTexImage,
+ __glXDisp_GetTexParameterfv,
+ __glXDisp_GetTexParameteriv,
+ __glXDisp_GetTexLevelParameterfv,
+ __glXDisp_GetTexLevelParameteriv,
+ __glXDisp_IsEnabled,
+ __glXDisp_IsList,
+ __glXDisp_Flush,
+};
+
+__GLXdispatchRenderProcPtr __glXRenderTable[] = {
+ __glXNoSuchRenderOpcode,
+ __glXDisp_CallList,
+ __glXDisp_CallLists,
+ __glXDisp_ListBase,
+ __glXDisp_Begin,
+ __glXDisp_Bitmap,
+ __glXDisp_Color3bv,
+ __glXDisp_Color3dv,
+ __glXDisp_Color3fv,
+ __glXDisp_Color3iv,
+ __glXDisp_Color3sv,
+ __glXDisp_Color3ubv,
+ __glXDisp_Color3uiv,
+ __glXDisp_Color3usv,
+ __glXDisp_Color4bv,
+ __glXDisp_Color4dv,
+ __glXDisp_Color4fv,
+ __glXDisp_Color4iv,
+ __glXDisp_Color4sv,
+ __glXDisp_Color4ubv,
+ __glXDisp_Color4uiv,
+ __glXDisp_Color4usv,
+ __glXDisp_EdgeFlagv,
+ __glXDisp_End,
+ __glXDisp_Indexdv,
+ __glXDisp_Indexfv,
+ __glXDisp_Indexiv,
+ __glXDisp_Indexsv,
+ __glXDisp_Normal3bv,
+ __glXDisp_Normal3dv,
+ __glXDisp_Normal3fv,
+ __glXDisp_Normal3iv,
+ __glXDisp_Normal3sv,
+ __glXDisp_RasterPos2dv,
+ __glXDisp_RasterPos2fv,
+ __glXDisp_RasterPos2iv,
+ __glXDisp_RasterPos2sv,
+ __glXDisp_RasterPos3dv,
+ __glXDisp_RasterPos3fv,
+ __glXDisp_RasterPos3iv,
+ __glXDisp_RasterPos3sv,
+ __glXDisp_RasterPos4dv,
+ __glXDisp_RasterPos4fv,
+ __glXDisp_RasterPos4iv,
+ __glXDisp_RasterPos4sv,
+ __glXDisp_Rectdv,
+ __glXDisp_Rectfv,
+ __glXDisp_Rectiv,
+ __glXDisp_Rectsv,
+ __glXDisp_TexCoord1dv,
+ __glXDisp_TexCoord1fv,
+ __glXDisp_TexCoord1iv,
+ __glXDisp_TexCoord1sv,
+ __glXDisp_TexCoord2dv,
+ __glXDisp_TexCoord2fv,
+ __glXDisp_TexCoord2iv,
+ __glXDisp_TexCoord2sv,
+ __glXDisp_TexCoord3dv,
+ __glXDisp_TexCoord3fv,
+ __glXDisp_TexCoord3iv,
+ __glXDisp_TexCoord3sv,
+ __glXDisp_TexCoord4dv,
+ __glXDisp_TexCoord4fv,
+ __glXDisp_TexCoord4iv,
+ __glXDisp_TexCoord4sv,
+ __glXDisp_Vertex2dv,
+ __glXDisp_Vertex2fv,
+ __glXDisp_Vertex2iv,
+ __glXDisp_Vertex2sv,
+ __glXDisp_Vertex3dv,
+ __glXDisp_Vertex3fv,
+ __glXDisp_Vertex3iv,
+ __glXDisp_Vertex3sv,
+ __glXDisp_Vertex4dv,
+ __glXDisp_Vertex4fv,
+ __glXDisp_Vertex4iv,
+ __glXDisp_Vertex4sv,
+ __glXDisp_ClipPlane,
+ __glXDisp_ColorMaterial,
+ __glXDisp_CullFace,
+ __glXDisp_Fogf,
+ __glXDisp_Fogfv,
+ __glXDisp_Fogi,
+ __glXDisp_Fogiv,
+ __glXDisp_FrontFace,
+ __glXDisp_Hint,
+ __glXDisp_Lightf,
+ __glXDisp_Lightfv,
+ __glXDisp_Lighti,
+ __glXDisp_Lightiv,
+ __glXDisp_LightModelf,
+ __glXDisp_LightModelfv,
+ __glXDisp_LightModeli,
+ __glXDisp_LightModeliv,
+ __glXDisp_LineStipple,
+ __glXDisp_LineWidth,
+ __glXDisp_Materialf,
+ __glXDisp_Materialfv,
+ __glXDisp_Materiali,
+ __glXDisp_Materialiv,
+ __glXDisp_PointSize,
+ __glXDisp_PolygonMode,
+ __glXDisp_PolygonStipple,
+ __glXDisp_Scissor,
+ __glXDisp_ShadeModel,
+ __glXDisp_TexParameterf,
+ __glXDisp_TexParameterfv,
+ __glXDisp_TexParameteri,
+ __glXDisp_TexParameteriv,
+ __glXDisp_TexImage1D,
+ __glXDisp_TexImage2D,
+ __glXDisp_TexEnvf,
+ __glXDisp_TexEnvfv,
+ __glXDisp_TexEnvi,
+ __glXDisp_TexEnviv,
+ __glXDisp_TexGend,
+ __glXDisp_TexGendv,
+ __glXDisp_TexGenf,
+ __glXDisp_TexGenfv,
+ __glXDisp_TexGeni,
+ __glXDisp_TexGeniv,
+ __glXDisp_InitNames,
+ __glXDisp_LoadName,
+ __glXDisp_PassThrough,
+ __glXDisp_PopName,
+ __glXDisp_PushName,
+ __glXDisp_DrawBuffer,
+ __glXDisp_Clear,
+ __glXDisp_ClearAccum,
+ __glXDisp_ClearIndex,
+ __glXDisp_ClearColor,
+ __glXDisp_ClearStencil,
+ __glXDisp_ClearDepth,
+ __glXDisp_StencilMask,
+ __glXDisp_ColorMask,
+ __glXDisp_DepthMask,
+ __glXDisp_IndexMask,
+ __glXDisp_Accum,
+ __glXDisp_Disable,
+ __glXDisp_Enable,
+ __glXNoSuchRenderOpcode,
+ __glXDisp_PopAttrib,
+ __glXDisp_PushAttrib,
+ __glXDisp_Map1d,
+ __glXDisp_Map1f,
+ __glXDisp_Map2d,
+ __glXDisp_Map2f,
+ __glXDisp_MapGrid1d,
+ __glXDisp_MapGrid1f,
+ __glXDisp_MapGrid2d,
+ __glXDisp_MapGrid2f,
+ __glXDisp_EvalCoord1dv,
+ __glXDisp_EvalCoord1fv,
+ __glXDisp_EvalCoord2dv,
+ __glXDisp_EvalCoord2fv,
+ __glXDisp_EvalMesh1,
+ __glXDisp_EvalPoint1,
+ __glXDisp_EvalMesh2,
+ __glXDisp_EvalPoint2,
+ __glXDisp_AlphaFunc,
+ __glXDisp_BlendFunc,
+ __glXDisp_LogicOp,
+ __glXDisp_StencilFunc,
+ __glXDisp_StencilOp,
+ __glXDisp_DepthFunc,
+ __glXDisp_PixelZoom,
+ __glXDisp_PixelTransferf,
+ __glXDisp_PixelTransferi,
+ __glXDisp_PixelMapfv,
+ __glXDisp_PixelMapuiv,
+ __glXDisp_PixelMapusv,
+ __glXDisp_ReadBuffer,
+ __glXDisp_CopyPixels,
+ __glXDisp_DrawPixels,
+ __glXDisp_DepthRange,
+ __glXDisp_Frustum,
+ __glXDisp_LoadIdentity,
+ __glXDisp_LoadMatrixf,
+ __glXDisp_LoadMatrixd,
+ __glXDisp_MatrixMode,
+ __glXDisp_MultMatrixf,
+ __glXDisp_MultMatrixd,
+ __glXDisp_Ortho,
+ __glXDisp_PopMatrix,
+ __glXDisp_PushMatrix,
+ __glXDisp_Rotated,
+ __glXDisp_Rotatef,
+ __glXDisp_Scaled,
+ __glXDisp_Scalef,
+ __glXDisp_Translated,
+ __glXDisp_Translatef,
+ __glXDisp_Viewport,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXDisp_Indexubv,
+};
+
+__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = {
+ __glXNoSuchSingleOpcode,
+ __glXSwapRender,
+ __glXSwapRenderLarge,
+ __glXSwapCreateContext,
+ __glXSwapDestroyContext,
+ __glXSwapMakeCurrent,
+ __glXSwapIsDirect,
+ __glXSwapQueryVersion,
+ __glXSwapWaitGL,
+ __glXSwapWaitX,
+ __glXSwapCopyContext,
+ __glXSwapSwapBuffers,
+ __glXSwapUseXFont,
+ __glXSwapCreateGLXPixmap,
+ __glXSwapGetVisualConfigs,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapVendorPrivate,
+ __glXSwapVendorPrivateWithReply,
+ __glXSwapQueryExtensionsString,
+ __glXSwapQueryServerString,
+ __glXSwapClientInfo,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXDispSwap_NewList,
+ __glXDispSwap_EndList,
+ __glXDispSwap_DeleteLists,
+ __glXDispSwap_GenLists,
+ __glXDispSwap_FeedbackBuffer,
+ __glXDispSwap_SelectBuffer,
+ __glXDispSwap_RenderMode,
+ __glXDispSwap_Finish,
+ __glXDispSwap_PixelStoref,
+ __glXDispSwap_PixelStorei,
+ __glXDispSwap_ReadPixels,
+ __glXDispSwap_GetBooleanv,
+ __glXDispSwap_GetClipPlane,
+ __glXDispSwap_GetDoublev,
+ __glXDispSwap_GetError,
+ __glXDispSwap_GetFloatv,
+ __glXDispSwap_GetIntegerv,
+ __glXDispSwap_GetLightfv,
+ __glXDispSwap_GetLightiv,
+ __glXDispSwap_GetMapdv,
+ __glXDispSwap_GetMapfv,
+ __glXDispSwap_GetMapiv,
+ __glXDispSwap_GetMaterialfv,
+ __glXDispSwap_GetMaterialiv,
+ __glXDispSwap_GetPixelMapfv,
+ __glXDispSwap_GetPixelMapuiv,
+ __glXDispSwap_GetPixelMapusv,
+ __glXDispSwap_GetPolygonStipple,
+ __glXDispSwap_GetString,
+ __glXDispSwap_GetTexEnvfv,
+ __glXDispSwap_GetTexEnviv,
+ __glXDispSwap_GetTexGendv,
+ __glXDispSwap_GetTexGenfv,
+ __glXDispSwap_GetTexGeniv,
+ __glXDispSwap_GetTexImage,
+ __glXDispSwap_GetTexParameterfv,
+ __glXDispSwap_GetTexParameteriv,
+ __glXDispSwap_GetTexLevelParameterfv,
+ __glXDispSwap_GetTexLevelParameteriv,
+ __glXDispSwap_IsEnabled,
+ __glXDispSwap_IsList,
+ __glXDispSwap_Flush,
+};
+
+__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = {
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_CallList,
+ __glXDispSwap_CallLists,
+ __glXDispSwap_ListBase,
+ __glXDispSwap_Begin,
+ __glXDispSwap_Bitmap,
+ __glXDispSwap_Color3bv,
+ __glXDispSwap_Color3dv,
+ __glXDispSwap_Color3fv,
+ __glXDispSwap_Color3iv,
+ __glXDispSwap_Color3sv,
+ __glXDispSwap_Color3ubv,
+ __glXDispSwap_Color3uiv,
+ __glXDispSwap_Color3usv,
+ __glXDispSwap_Color4bv,
+ __glXDispSwap_Color4dv,
+ __glXDispSwap_Color4fv,
+ __glXDispSwap_Color4iv,
+ __glXDispSwap_Color4sv,
+ __glXDispSwap_Color4ubv,
+ __glXDispSwap_Color4uiv,
+ __glXDispSwap_Color4usv,
+ __glXDispSwap_EdgeFlagv,
+ __glXDispSwap_End,
+ __glXDispSwap_Indexdv,
+ __glXDispSwap_Indexfv,
+ __glXDispSwap_Indexiv,
+ __glXDispSwap_Indexsv,
+ __glXDispSwap_Normal3bv,
+ __glXDispSwap_Normal3dv,
+ __glXDispSwap_Normal3fv,
+ __glXDispSwap_Normal3iv,
+ __glXDispSwap_Normal3sv,
+ __glXDispSwap_RasterPos2dv,
+ __glXDispSwap_RasterPos2fv,
+ __glXDispSwap_RasterPos2iv,
+ __glXDispSwap_RasterPos2sv,
+ __glXDispSwap_RasterPos3dv,
+ __glXDispSwap_RasterPos3fv,
+ __glXDispSwap_RasterPos3iv,
+ __glXDispSwap_RasterPos3sv,
+ __glXDispSwap_RasterPos4dv,
+ __glXDispSwap_RasterPos4fv,
+ __glXDispSwap_RasterPos4iv,
+ __glXDispSwap_RasterPos4sv,
+ __glXDispSwap_Rectdv,
+ __glXDispSwap_Rectfv,
+ __glXDispSwap_Rectiv,
+ __glXDispSwap_Rectsv,
+ __glXDispSwap_TexCoord1dv,
+ __glXDispSwap_TexCoord1fv,
+ __glXDispSwap_TexCoord1iv,
+ __glXDispSwap_TexCoord1sv,
+ __glXDispSwap_TexCoord2dv,
+ __glXDispSwap_TexCoord2fv,
+ __glXDispSwap_TexCoord2iv,
+ __glXDispSwap_TexCoord2sv,
+ __glXDispSwap_TexCoord3dv,
+ __glXDispSwap_TexCoord3fv,
+ __glXDispSwap_TexCoord3iv,
+ __glXDispSwap_TexCoord3sv,
+ __glXDispSwap_TexCoord4dv,
+ __glXDispSwap_TexCoord4fv,
+ __glXDispSwap_TexCoord4iv,
+ __glXDispSwap_TexCoord4sv,
+ __glXDispSwap_Vertex2dv,
+ __glXDispSwap_Vertex2fv,
+ __glXDispSwap_Vertex2iv,
+ __glXDispSwap_Vertex2sv,
+ __glXDispSwap_Vertex3dv,
+ __glXDispSwap_Vertex3fv,
+ __glXDispSwap_Vertex3iv,
+ __glXDispSwap_Vertex3sv,
+ __glXDispSwap_Vertex4dv,
+ __glXDispSwap_Vertex4fv,
+ __glXDispSwap_Vertex4iv,
+ __glXDispSwap_Vertex4sv,
+ __glXDispSwap_ClipPlane,
+ __glXDispSwap_ColorMaterial,
+ __glXDispSwap_CullFace,
+ __glXDispSwap_Fogf,
+ __glXDispSwap_Fogfv,
+ __glXDispSwap_Fogi,
+ __glXDispSwap_Fogiv,
+ __glXDispSwap_FrontFace,
+ __glXDispSwap_Hint,
+ __glXDispSwap_Lightf,
+ __glXDispSwap_Lightfv,
+ __glXDispSwap_Lighti,
+ __glXDispSwap_Lightiv,
+ __glXDispSwap_LightModelf,
+ __glXDispSwap_LightModelfv,
+ __glXDispSwap_LightModeli,
+ __glXDispSwap_LightModeliv,
+ __glXDispSwap_LineStipple,
+ __glXDispSwap_LineWidth,
+ __glXDispSwap_Materialf,
+ __glXDispSwap_Materialfv,
+ __glXDispSwap_Materiali,
+ __glXDispSwap_Materialiv,
+ __glXDispSwap_PointSize,
+ __glXDispSwap_PolygonMode,
+ __glXDispSwap_PolygonStipple,
+ __glXDispSwap_Scissor,
+ __glXDispSwap_ShadeModel,
+ __glXDispSwap_TexParameterf,
+ __glXDispSwap_TexParameterfv,
+ __glXDispSwap_TexParameteri,
+ __glXDispSwap_TexParameteriv,
+ __glXDispSwap_TexImage1D,
+ __glXDispSwap_TexImage2D,
+ __glXDispSwap_TexEnvf,
+ __glXDispSwap_TexEnvfv,
+ __glXDispSwap_TexEnvi,
+ __glXDispSwap_TexEnviv,
+ __glXDispSwap_TexGend,
+ __glXDispSwap_TexGendv,
+ __glXDispSwap_TexGenf,
+ __glXDispSwap_TexGenfv,
+ __glXDispSwap_TexGeni,
+ __glXDispSwap_TexGeniv,
+ __glXDispSwap_InitNames,
+ __glXDispSwap_LoadName,
+ __glXDispSwap_PassThrough,
+ __glXDispSwap_PopName,
+ __glXDispSwap_PushName,
+ __glXDispSwap_DrawBuffer,
+ __glXDispSwap_Clear,
+ __glXDispSwap_ClearAccum,
+ __glXDispSwap_ClearIndex,
+ __glXDispSwap_ClearColor,
+ __glXDispSwap_ClearStencil,
+ __glXDispSwap_ClearDepth,
+ __glXDispSwap_StencilMask,
+ __glXDispSwap_ColorMask,
+ __glXDispSwap_DepthMask,
+ __glXDispSwap_IndexMask,
+ __glXDispSwap_Accum,
+ __glXDispSwap_Disable,
+ __glXDispSwap_Enable,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_PopAttrib,
+ __glXDispSwap_PushAttrib,
+ __glXDispSwap_Map1d,
+ __glXDispSwap_Map1f,
+ __glXDispSwap_Map2d,
+ __glXDispSwap_Map2f,
+ __glXDispSwap_MapGrid1d,
+ __glXDispSwap_MapGrid1f,
+ __glXDispSwap_MapGrid2d,
+ __glXDispSwap_MapGrid2f,
+ __glXDispSwap_EvalCoord1dv,
+ __glXDispSwap_EvalCoord1fv,
+ __glXDispSwap_EvalCoord2dv,
+ __glXDispSwap_EvalCoord2fv,
+ __glXDispSwap_EvalMesh1,
+ __glXDispSwap_EvalPoint1,
+ __glXDispSwap_EvalMesh2,
+ __glXDispSwap_EvalPoint2,
+ __glXDispSwap_AlphaFunc,
+ __glXDispSwap_BlendFunc,
+ __glXDispSwap_LogicOp,
+ __glXDispSwap_StencilFunc,
+ __glXDispSwap_StencilOp,
+ __glXDispSwap_DepthFunc,
+ __glXDispSwap_PixelZoom,
+ __glXDispSwap_PixelTransferf,
+ __glXDispSwap_PixelTransferi,
+ __glXDispSwap_PixelMapfv,
+ __glXDispSwap_PixelMapuiv,
+ __glXDispSwap_PixelMapusv,
+ __glXDispSwap_ReadBuffer,
+ __glXDispSwap_CopyPixels,
+ __glXDispSwap_DrawPixels,
+ __glXDispSwap_DepthRange,
+ __glXDispSwap_Frustum,
+ __glXDispSwap_LoadIdentity,
+ __glXDispSwap_LoadMatrixf,
+ __glXDispSwap_LoadMatrixd,
+ __glXDispSwap_MatrixMode,
+ __glXDispSwap_MultMatrixf,
+ __glXDispSwap_MultMatrixd,
+ __glXDispSwap_Ortho,
+ __glXDispSwap_PopMatrix,
+ __glXDispSwap_PushMatrix,
+ __glXDispSwap_Rotated,
+ __glXDispSwap_Rotatef,
+ __glXDispSwap_Scaled,
+ __glXDispSwap_Scalef,
+ __glXDispSwap_Translated,
+ __glXDispSwap_Translatef,
+ __glXDispSwap_Viewport,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_Indexubv,
+};
diff --git a/xc/programs/Xserver/GL/glx/g_disptab.h b/xc/programs/Xserver/GL/glx/g_disptab.h
new file mode 100644
index 000000000..247b27ea9
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_disptab.h
@@ -0,0 +1,546 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+#ifndef _GLX_g_disptab_h_
+#define _GLX_g_disptab_h_
+/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.2 1999/06/14 07:31:22 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+extern int __glXRender(__GLXclientState*, GLbyte*);
+extern int __glXRenderLarge(__GLXclientState*, GLbyte*);
+extern int __glXCreateContext(__GLXclientState*, GLbyte*);
+extern int __glXDestroyContext(__GLXclientState*, GLbyte*);
+extern int __glXMakeCurrent(__GLXclientState*, GLbyte*);
+extern int __glXIsDirect(__GLXclientState*, GLbyte*);
+extern int __glXQueryVersion(__GLXclientState*, GLbyte*);
+extern int __glXWaitGL(__GLXclientState*, GLbyte*);
+extern int __glXWaitX(__GLXclientState*, GLbyte*);
+extern int __glXCopyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
+extern int __glXUseXFont(__GLXclientState*, GLbyte*);
+extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*);
+extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXVendorPrivate(__GLXclientState*, GLbyte*);
+extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*);
+extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*);
+extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
+extern int __glXClientInfo(__GLXclientState*, GLbyte*);
+extern int __glXDisp_NewList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_EndList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*);
+extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*);
+extern int __glXDisp_Finish(__GLXclientState*, GLbyte*);
+extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*);
+extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*);
+extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetError(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetString(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_Flush(__GLXclientState*, GLbyte*);
+
+extern void __glXDisp_CallList(GLbyte*);
+extern void __glXDisp_CallLists(GLbyte*);
+extern void __glXDisp_ListBase(GLbyte*);
+extern void __glXDisp_Begin(GLbyte*);
+extern void __glXDisp_Bitmap(GLbyte*);
+extern void __glXDisp_Color3bv(GLbyte*);
+extern void __glXDisp_Color3dv(GLbyte*);
+extern void __glXDisp_Color3fv(GLbyte*);
+extern void __glXDisp_Color3iv(GLbyte*);
+extern void __glXDisp_Color3sv(GLbyte*);
+extern void __glXDisp_Color3ubv(GLbyte*);
+extern void __glXDisp_Color3uiv(GLbyte*);
+extern void __glXDisp_Color3usv(GLbyte*);
+extern void __glXDisp_Color4bv(GLbyte*);
+extern void __glXDisp_Color4dv(GLbyte*);
+extern void __glXDisp_Color4fv(GLbyte*);
+extern void __glXDisp_Color4iv(GLbyte*);
+extern void __glXDisp_Color4sv(GLbyte*);
+extern void __glXDisp_Color4ubv(GLbyte*);
+extern void __glXDisp_Color4uiv(GLbyte*);
+extern void __glXDisp_Color4usv(GLbyte*);
+extern void __glXDisp_EdgeFlagv(GLbyte*);
+extern void __glXDisp_End(GLbyte*);
+extern void __glXDisp_Indexdv(GLbyte*);
+extern void __glXDisp_Indexfv(GLbyte*);
+extern void __glXDisp_Indexiv(GLbyte*);
+extern void __glXDisp_Indexsv(GLbyte*);
+extern void __glXDisp_Normal3bv(GLbyte*);
+extern void __glXDisp_Normal3dv(GLbyte*);
+extern void __glXDisp_Normal3fv(GLbyte*);
+extern void __glXDisp_Normal3iv(GLbyte*);
+extern void __glXDisp_Normal3sv(GLbyte*);
+extern void __glXDisp_RasterPos2dv(GLbyte*);
+extern void __glXDisp_RasterPos2fv(GLbyte*);
+extern void __glXDisp_RasterPos2iv(GLbyte*);
+extern void __glXDisp_RasterPos2sv(GLbyte*);
+extern void __glXDisp_RasterPos3dv(GLbyte*);
+extern void __glXDisp_RasterPos3fv(GLbyte*);
+extern void __glXDisp_RasterPos3iv(GLbyte*);
+extern void __glXDisp_RasterPos3sv(GLbyte*);
+extern void __glXDisp_RasterPos4dv(GLbyte*);
+extern void __glXDisp_RasterPos4fv(GLbyte*);
+extern void __glXDisp_RasterPos4iv(GLbyte*);
+extern void __glXDisp_RasterPos4sv(GLbyte*);
+extern void __glXDisp_Rectdv(GLbyte*);
+extern void __glXDisp_Rectfv(GLbyte*);
+extern void __glXDisp_Rectiv(GLbyte*);
+extern void __glXDisp_Rectsv(GLbyte*);
+extern void __glXDisp_TexCoord1dv(GLbyte*);
+extern void __glXDisp_TexCoord1fv(GLbyte*);
+extern void __glXDisp_TexCoord1iv(GLbyte*);
+extern void __glXDisp_TexCoord1sv(GLbyte*);
+extern void __glXDisp_TexCoord2dv(GLbyte*);
+extern void __glXDisp_TexCoord2fv(GLbyte*);
+extern void __glXDisp_TexCoord2iv(GLbyte*);
+extern void __glXDisp_TexCoord2sv(GLbyte*);
+extern void __glXDisp_TexCoord3dv(GLbyte*);
+extern void __glXDisp_TexCoord3fv(GLbyte*);
+extern void __glXDisp_TexCoord3iv(GLbyte*);
+extern void __glXDisp_TexCoord3sv(GLbyte*);
+extern void __glXDisp_TexCoord4dv(GLbyte*);
+extern void __glXDisp_TexCoord4fv(GLbyte*);
+extern void __glXDisp_TexCoord4iv(GLbyte*);
+extern void __glXDisp_TexCoord4sv(GLbyte*);
+extern void __glXDisp_Vertex2dv(GLbyte*);
+extern void __glXDisp_Vertex2fv(GLbyte*);
+extern void __glXDisp_Vertex2iv(GLbyte*);
+extern void __glXDisp_Vertex2sv(GLbyte*);
+extern void __glXDisp_Vertex3dv(GLbyte*);
+extern void __glXDisp_Vertex3fv(GLbyte*);
+extern void __glXDisp_Vertex3iv(GLbyte*);
+extern void __glXDisp_Vertex3sv(GLbyte*);
+extern void __glXDisp_Vertex4dv(GLbyte*);
+extern void __glXDisp_Vertex4fv(GLbyte*);
+extern void __glXDisp_Vertex4iv(GLbyte*);
+extern void __glXDisp_Vertex4sv(GLbyte*);
+extern void __glXDisp_ClipPlane(GLbyte*);
+extern void __glXDisp_ColorMaterial(GLbyte*);
+extern void __glXDisp_CullFace(GLbyte*);
+extern void __glXDisp_Fogf(GLbyte*);
+extern void __glXDisp_Fogfv(GLbyte*);
+extern void __glXDisp_Fogi(GLbyte*);
+extern void __glXDisp_Fogiv(GLbyte*);
+extern void __glXDisp_FrontFace(GLbyte*);
+extern void __glXDisp_Hint(GLbyte*);
+extern void __glXDisp_Lightf(GLbyte*);
+extern void __glXDisp_Lightfv(GLbyte*);
+extern void __glXDisp_Lighti(GLbyte*);
+extern void __glXDisp_Lightiv(GLbyte*);
+extern void __glXDisp_LightModelf(GLbyte*);
+extern void __glXDisp_LightModelfv(GLbyte*);
+extern void __glXDisp_LightModeli(GLbyte*);
+extern void __glXDisp_LightModeliv(GLbyte*);
+extern void __glXDisp_LineStipple(GLbyte*);
+extern void __glXDisp_LineWidth(GLbyte*);
+extern void __glXDisp_Materialf(GLbyte*);
+extern void __glXDisp_Materialfv(GLbyte*);
+extern void __glXDisp_Materiali(GLbyte*);
+extern void __glXDisp_Materialiv(GLbyte*);
+extern void __glXDisp_PointSize(GLbyte*);
+extern void __glXDisp_PolygonMode(GLbyte*);
+extern void __glXDisp_PolygonStipple(GLbyte*);
+extern void __glXDisp_Scissor(GLbyte*);
+extern void __glXDisp_ShadeModel(GLbyte*);
+extern void __glXDisp_TexParameterf(GLbyte*);
+extern void __glXDisp_TexParameterfv(GLbyte*);
+extern void __glXDisp_TexParameteri(GLbyte*);
+extern void __glXDisp_TexParameteriv(GLbyte*);
+extern void __glXDisp_TexImage1D(GLbyte*);
+extern void __glXDisp_TexImage2D(GLbyte*);
+extern void __glXDisp_TexEnvf(GLbyte*);
+extern void __glXDisp_TexEnvfv(GLbyte*);
+extern void __glXDisp_TexEnvi(GLbyte*);
+extern void __glXDisp_TexEnviv(GLbyte*);
+extern void __glXDisp_TexGend(GLbyte*);
+extern void __glXDisp_TexGendv(GLbyte*);
+extern void __glXDisp_TexGenf(GLbyte*);
+extern void __glXDisp_TexGenfv(GLbyte*);
+extern void __glXDisp_TexGeni(GLbyte*);
+extern void __glXDisp_TexGeniv(GLbyte*);
+extern void __glXDisp_InitNames(GLbyte*);
+extern void __glXDisp_LoadName(GLbyte*);
+extern void __glXDisp_PassThrough(GLbyte*);
+extern void __glXDisp_PopName(GLbyte*);
+extern void __glXDisp_PushName(GLbyte*);
+extern void __glXDisp_DrawBuffer(GLbyte*);
+extern void __glXDisp_Clear(GLbyte*);
+extern void __glXDisp_ClearAccum(GLbyte*);
+extern void __glXDisp_ClearIndex(GLbyte*);
+extern void __glXDisp_ClearColor(GLbyte*);
+extern void __glXDisp_ClearStencil(GLbyte*);
+extern void __glXDisp_ClearDepth(GLbyte*);
+extern void __glXDisp_StencilMask(GLbyte*);
+extern void __glXDisp_ColorMask(GLbyte*);
+extern void __glXDisp_DepthMask(GLbyte*);
+extern void __glXDisp_IndexMask(GLbyte*);
+extern void __glXDisp_Accum(GLbyte*);
+extern void __glXDisp_Disable(GLbyte*);
+extern void __glXDisp_Enable(GLbyte*);
+extern void __glXDisp_PopAttrib(GLbyte*);
+extern void __glXDisp_PushAttrib(GLbyte*);
+extern void __glXDisp_Map1d(GLbyte*);
+extern void __glXDisp_Map1f(GLbyte*);
+extern void __glXDisp_Map2d(GLbyte*);
+extern void __glXDisp_Map2f(GLbyte*);
+extern void __glXDisp_MapGrid1d(GLbyte*);
+extern void __glXDisp_MapGrid1f(GLbyte*);
+extern void __glXDisp_MapGrid2d(GLbyte*);
+extern void __glXDisp_MapGrid2f(GLbyte*);
+extern void __glXDisp_EvalCoord1dv(GLbyte*);
+extern void __glXDisp_EvalCoord1fv(GLbyte*);
+extern void __glXDisp_EvalCoord2dv(GLbyte*);
+extern void __glXDisp_EvalCoord2fv(GLbyte*);
+extern void __glXDisp_EvalMesh1(GLbyte*);
+extern void __glXDisp_EvalPoint1(GLbyte*);
+extern void __glXDisp_EvalMesh2(GLbyte*);
+extern void __glXDisp_EvalPoint2(GLbyte*);
+extern void __glXDisp_AlphaFunc(GLbyte*);
+extern void __glXDisp_BlendFunc(GLbyte*);
+extern void __glXDisp_LogicOp(GLbyte*);
+extern void __glXDisp_StencilFunc(GLbyte*);
+extern void __glXDisp_StencilOp(GLbyte*);
+extern void __glXDisp_DepthFunc(GLbyte*);
+extern void __glXDisp_PixelZoom(GLbyte*);
+extern void __glXDisp_PixelTransferf(GLbyte*);
+extern void __glXDisp_PixelTransferi(GLbyte*);
+extern void __glXDisp_PixelMapfv(GLbyte*);
+extern void __glXDisp_PixelMapuiv(GLbyte*);
+extern void __glXDisp_PixelMapusv(GLbyte*);
+extern void __glXDisp_ReadBuffer(GLbyte*);
+extern void __glXDisp_CopyPixels(GLbyte*);
+extern void __glXDisp_DrawPixels(GLbyte*);
+extern void __glXDisp_DepthRange(GLbyte*);
+extern void __glXDisp_Frustum(GLbyte*);
+extern void __glXDisp_LoadIdentity(GLbyte*);
+extern void __glXDisp_LoadMatrixf(GLbyte*);
+extern void __glXDisp_LoadMatrixd(GLbyte*);
+extern void __glXDisp_MatrixMode(GLbyte*);
+extern void __glXDisp_MultMatrixf(GLbyte*);
+extern void __glXDisp_MultMatrixd(GLbyte*);
+extern void __glXDisp_Ortho(GLbyte*);
+extern void __glXDisp_PopMatrix(GLbyte*);
+extern void __glXDisp_PushMatrix(GLbyte*);
+extern void __glXDisp_Rotated(GLbyte*);
+extern void __glXDisp_Rotatef(GLbyte*);
+extern void __glXDisp_Scaled(GLbyte*);
+extern void __glXDisp_Scalef(GLbyte*);
+extern void __glXDisp_Translated(GLbyte*);
+extern void __glXDisp_Translatef(GLbyte*);
+extern void __glXDisp_Viewport(GLbyte*);
+extern void __glXDisp_Indexubv(GLbyte*);
+
+extern int __glXSwapRender(__GLXclientState*, GLbyte*);
+extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*);
+extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*);
+extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*);
+extern int __glXSwapWaitX(__GLXclientState*, GLbyte*);
+extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
+extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*);
+extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
+extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*);
+
+extern void __glXDispSwap_CallList(GLbyte*);
+extern void __glXDispSwap_CallLists(GLbyte*);
+extern void __glXDispSwap_ListBase(GLbyte*);
+extern void __glXDispSwap_Begin(GLbyte*);
+extern void __glXDispSwap_Bitmap(GLbyte*);
+extern void __glXDispSwap_Color3bv(GLbyte*);
+extern void __glXDispSwap_Color3dv(GLbyte*);
+extern void __glXDispSwap_Color3fv(GLbyte*);
+extern void __glXDispSwap_Color3iv(GLbyte*);
+extern void __glXDispSwap_Color3sv(GLbyte*);
+extern void __glXDispSwap_Color3ubv(GLbyte*);
+extern void __glXDispSwap_Color3uiv(GLbyte*);
+extern void __glXDispSwap_Color3usv(GLbyte*);
+extern void __glXDispSwap_Color4bv(GLbyte*);
+extern void __glXDispSwap_Color4dv(GLbyte*);
+extern void __glXDispSwap_Color4fv(GLbyte*);
+extern void __glXDispSwap_Color4iv(GLbyte*);
+extern void __glXDispSwap_Color4sv(GLbyte*);
+extern void __glXDispSwap_Color4ubv(GLbyte*);
+extern void __glXDispSwap_Color4uiv(GLbyte*);
+extern void __glXDispSwap_Color4usv(GLbyte*);
+extern void __glXDispSwap_EdgeFlagv(GLbyte*);
+extern void __glXDispSwap_End(GLbyte*);
+extern void __glXDispSwap_Indexdv(GLbyte*);
+extern void __glXDispSwap_Indexfv(GLbyte*);
+extern void __glXDispSwap_Indexiv(GLbyte*);
+extern void __glXDispSwap_Indexsv(GLbyte*);
+extern void __glXDispSwap_Normal3bv(GLbyte*);
+extern void __glXDispSwap_Normal3dv(GLbyte*);
+extern void __glXDispSwap_Normal3fv(GLbyte*);
+extern void __glXDispSwap_Normal3iv(GLbyte*);
+extern void __glXDispSwap_Normal3sv(GLbyte*);
+extern void __glXDispSwap_RasterPos2dv(GLbyte*);
+extern void __glXDispSwap_RasterPos2fv(GLbyte*);
+extern void __glXDispSwap_RasterPos2iv(GLbyte*);
+extern void __glXDispSwap_RasterPos2sv(GLbyte*);
+extern void __glXDispSwap_RasterPos3dv(GLbyte*);
+extern void __glXDispSwap_RasterPos3fv(GLbyte*);
+extern void __glXDispSwap_RasterPos3iv(GLbyte*);
+extern void __glXDispSwap_RasterPos3sv(GLbyte*);
+extern void __glXDispSwap_RasterPos4dv(GLbyte*);
+extern void __glXDispSwap_RasterPos4fv(GLbyte*);
+extern void __glXDispSwap_RasterPos4iv(GLbyte*);
+extern void __glXDispSwap_RasterPos4sv(GLbyte*);
+extern void __glXDispSwap_Rectdv(GLbyte*);
+extern void __glXDispSwap_Rectfv(GLbyte*);
+extern void __glXDispSwap_Rectiv(GLbyte*);
+extern void __glXDispSwap_Rectsv(GLbyte*);
+extern void __glXDispSwap_TexCoord1dv(GLbyte*);
+extern void __glXDispSwap_TexCoord1fv(GLbyte*);
+extern void __glXDispSwap_TexCoord1iv(GLbyte*);
+extern void __glXDispSwap_TexCoord1sv(GLbyte*);
+extern void __glXDispSwap_TexCoord2dv(GLbyte*);
+extern void __glXDispSwap_TexCoord2fv(GLbyte*);
+extern void __glXDispSwap_TexCoord2iv(GLbyte*);
+extern void __glXDispSwap_TexCoord2sv(GLbyte*);
+extern void __glXDispSwap_TexCoord3dv(GLbyte*);
+extern void __glXDispSwap_TexCoord3fv(GLbyte*);
+extern void __glXDispSwap_TexCoord3iv(GLbyte*);
+extern void __glXDispSwap_TexCoord3sv(GLbyte*);
+extern void __glXDispSwap_TexCoord4dv(GLbyte*);
+extern void __glXDispSwap_TexCoord4fv(GLbyte*);
+extern void __glXDispSwap_TexCoord4iv(GLbyte*);
+extern void __glXDispSwap_TexCoord4sv(GLbyte*);
+extern void __glXDispSwap_Vertex2dv(GLbyte*);
+extern void __glXDispSwap_Vertex2fv(GLbyte*);
+extern void __glXDispSwap_Vertex2iv(GLbyte*);
+extern void __glXDispSwap_Vertex2sv(GLbyte*);
+extern void __glXDispSwap_Vertex3dv(GLbyte*);
+extern void __glXDispSwap_Vertex3fv(GLbyte*);
+extern void __glXDispSwap_Vertex3iv(GLbyte*);
+extern void __glXDispSwap_Vertex3sv(GLbyte*);
+extern void __glXDispSwap_Vertex4dv(GLbyte*);
+extern void __glXDispSwap_Vertex4fv(GLbyte*);
+extern void __glXDispSwap_Vertex4iv(GLbyte*);
+extern void __glXDispSwap_Vertex4sv(GLbyte*);
+extern void __glXDispSwap_ClipPlane(GLbyte*);
+extern void __glXDispSwap_ColorMaterial(GLbyte*);
+extern void __glXDispSwap_CullFace(GLbyte*);
+extern void __glXDispSwap_Fogf(GLbyte*);
+extern void __glXDispSwap_Fogfv(GLbyte*);
+extern void __glXDispSwap_Fogi(GLbyte*);
+extern void __glXDispSwap_Fogiv(GLbyte*);
+extern void __glXDispSwap_FrontFace(GLbyte*);
+extern void __glXDispSwap_Hint(GLbyte*);
+extern void __glXDispSwap_Lightf(GLbyte*);
+extern void __glXDispSwap_Lightfv(GLbyte*);
+extern void __glXDispSwap_Lighti(GLbyte*);
+extern void __glXDispSwap_Lightiv(GLbyte*);
+extern void __glXDispSwap_LightModelf(GLbyte*);
+extern void __glXDispSwap_LightModelfv(GLbyte*);
+extern void __glXDispSwap_LightModeli(GLbyte*);
+extern void __glXDispSwap_LightModeliv(GLbyte*);
+extern void __glXDispSwap_LineStipple(GLbyte*);
+extern void __glXDispSwap_LineWidth(GLbyte*);
+extern void __glXDispSwap_Materialf(GLbyte*);
+extern void __glXDispSwap_Materialfv(GLbyte*);
+extern void __glXDispSwap_Materiali(GLbyte*);
+extern void __glXDispSwap_Materialiv(GLbyte*);
+extern void __glXDispSwap_PointSize(GLbyte*);
+extern void __glXDispSwap_PolygonMode(GLbyte*);
+extern void __glXDispSwap_PolygonStipple(GLbyte*);
+extern void __glXDispSwap_Scissor(GLbyte*);
+extern void __glXDispSwap_ShadeModel(GLbyte*);
+extern void __glXDispSwap_TexParameterf(GLbyte*);
+extern void __glXDispSwap_TexParameterfv(GLbyte*);
+extern void __glXDispSwap_TexParameteri(GLbyte*);
+extern void __glXDispSwap_TexParameteriv(GLbyte*);
+extern void __glXDispSwap_TexImage1D(GLbyte*);
+extern void __glXDispSwap_TexImage2D(GLbyte*);
+extern void __glXDispSwap_TexEnvf(GLbyte*);
+extern void __glXDispSwap_TexEnvfv(GLbyte*);
+extern void __glXDispSwap_TexEnvi(GLbyte*);
+extern void __glXDispSwap_TexEnviv(GLbyte*);
+extern void __glXDispSwap_TexGend(GLbyte*);
+extern void __glXDispSwap_TexGendv(GLbyte*);
+extern void __glXDispSwap_TexGenf(GLbyte*);
+extern void __glXDispSwap_TexGenfv(GLbyte*);
+extern void __glXDispSwap_TexGeni(GLbyte*);
+extern void __glXDispSwap_TexGeniv(GLbyte*);
+extern void __glXDispSwap_InitNames(GLbyte*);
+extern void __glXDispSwap_LoadName(GLbyte*);
+extern void __glXDispSwap_PassThrough(GLbyte*);
+extern void __glXDispSwap_PopName(GLbyte*);
+extern void __glXDispSwap_PushName(GLbyte*);
+extern void __glXDispSwap_DrawBuffer(GLbyte*);
+extern void __glXDispSwap_Clear(GLbyte*);
+extern void __glXDispSwap_ClearAccum(GLbyte*);
+extern void __glXDispSwap_ClearIndex(GLbyte*);
+extern void __glXDispSwap_ClearColor(GLbyte*);
+extern void __glXDispSwap_ClearStencil(GLbyte*);
+extern void __glXDispSwap_ClearDepth(GLbyte*);
+extern void __glXDispSwap_StencilMask(GLbyte*);
+extern void __glXDispSwap_ColorMask(GLbyte*);
+extern void __glXDispSwap_DepthMask(GLbyte*);
+extern void __glXDispSwap_IndexMask(GLbyte*);
+extern void __glXDispSwap_Accum(GLbyte*);
+extern void __glXDispSwap_Disable(GLbyte*);
+extern void __glXDispSwap_Enable(GLbyte*);
+extern void __glXDispSwap_PopAttrib(GLbyte*);
+extern void __glXDispSwap_PushAttrib(GLbyte*);
+extern void __glXDispSwap_Map1d(GLbyte*);
+extern void __glXDispSwap_Map1f(GLbyte*);
+extern void __glXDispSwap_Map2d(GLbyte*);
+extern void __glXDispSwap_Map2f(GLbyte*);
+extern void __glXDispSwap_MapGrid1d(GLbyte*);
+extern void __glXDispSwap_MapGrid1f(GLbyte*);
+extern void __glXDispSwap_MapGrid2d(GLbyte*);
+extern void __glXDispSwap_MapGrid2f(GLbyte*);
+extern void __glXDispSwap_EvalCoord1dv(GLbyte*);
+extern void __glXDispSwap_EvalCoord1fv(GLbyte*);
+extern void __glXDispSwap_EvalCoord2dv(GLbyte*);
+extern void __glXDispSwap_EvalCoord2fv(GLbyte*);
+extern void __glXDispSwap_EvalMesh1(GLbyte*);
+extern void __glXDispSwap_EvalPoint1(GLbyte*);
+extern void __glXDispSwap_EvalMesh2(GLbyte*);
+extern void __glXDispSwap_EvalPoint2(GLbyte*);
+extern void __glXDispSwap_AlphaFunc(GLbyte*);
+extern void __glXDispSwap_BlendFunc(GLbyte*);
+extern void __glXDispSwap_LogicOp(GLbyte*);
+extern void __glXDispSwap_StencilFunc(GLbyte*);
+extern void __glXDispSwap_StencilOp(GLbyte*);
+extern void __glXDispSwap_DepthFunc(GLbyte*);
+extern void __glXDispSwap_PixelZoom(GLbyte*);
+extern void __glXDispSwap_PixelTransferf(GLbyte*);
+extern void __glXDispSwap_PixelTransferi(GLbyte*);
+extern void __glXDispSwap_PixelMapfv(GLbyte*);
+extern void __glXDispSwap_PixelMapuiv(GLbyte*);
+extern void __glXDispSwap_PixelMapusv(GLbyte*);
+extern void __glXDispSwap_ReadBuffer(GLbyte*);
+extern void __glXDispSwap_CopyPixels(GLbyte*);
+extern void __glXDispSwap_DrawPixels(GLbyte*);
+extern void __glXDispSwap_DepthRange(GLbyte*);
+extern void __glXDispSwap_Frustum(GLbyte*);
+extern void __glXDispSwap_LoadIdentity(GLbyte*);
+extern void __glXDispSwap_LoadMatrixf(GLbyte*);
+extern void __glXDispSwap_LoadMatrixd(GLbyte*);
+extern void __glXDispSwap_MatrixMode(GLbyte*);
+extern void __glXDispSwap_MultMatrixf(GLbyte*);
+extern void __glXDispSwap_MultMatrixd(GLbyte*);
+extern void __glXDispSwap_Ortho(GLbyte*);
+extern void __glXDispSwap_PopMatrix(GLbyte*);
+extern void __glXDispSwap_PushMatrix(GLbyte*);
+extern void __glXDispSwap_Rotated(GLbyte*);
+extern void __glXDispSwap_Rotatef(GLbyte*);
+extern void __glXDispSwap_Scaled(GLbyte*);
+extern void __glXDispSwap_Scalef(GLbyte*);
+extern void __glXDispSwap_Translated(GLbyte*);
+extern void __glXDispSwap_Translatef(GLbyte*);
+extern void __glXDispSwap_Viewport(GLbyte*);
+extern void __glXDispSwap_Indexubv(GLbyte*);
+
+#define __GLX_MIN_GLXCMD_OPCODE 1
+#define __GLX_MAX_GLXCMD_OPCODE 20
+#define __GLX_MIN_RENDER_OPCODE 1
+#define __GLX_MAX_RENDER_OPCODE 194
+#define __GLX_MIN_SINGLE_OPCODE 1
+#define __GLX_MAX_SINGLE_OPCODE 142
+#define __GLX_SINGLE_TABLE_SIZE 143
+#define __GLX_RENDER_TABLE_SIZE 195
+extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE];
+extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
+extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE];
+extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
+#endif /* _GLX_g_disptab_h_ */
diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c
new file mode 100644
index 000000000..1ac56e678
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c
@@ -0,0 +1,93 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab_EXT.h"
+__GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = {
+ __glXDisp_PolygonOffset,
+ __glXDisp_TexSubImage1D,
+ __glXDisp_TexSubImage2D,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXDisp_DrawArrays,
+ __glXDisp_BindTexture,
+ __glXDisp_PrioritizeTextures,
+ __glXDisp_CopyTexImage1D,
+ __glXDisp_CopyTexImage2D,
+ __glXDisp_CopyTexSubImage1D,
+ __glXDisp_CopyTexSubImage2D,
+};
+__GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[] = {
+ __glXDisp_AreTexturesResident,
+ __glXDisp_DeleteTextures,
+ __glXDisp_GenTextures,
+ __glXDisp_IsTexture,
+};
+
+
+__GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = {
+ __glXDispSwap_PolygonOffset,
+ __glXDispSwap_TexSubImage1D,
+ __glXDispSwap_TexSubImage2D,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_DrawArrays,
+ __glXDispSwap_BindTexture,
+ __glXDispSwap_PrioritizeTextures,
+ __glXDispSwap_CopyTexImage1D,
+ __glXDispSwap_CopyTexImage2D,
+ __glXDispSwap_CopyTexSubImage1D,
+ __glXDispSwap_CopyTexSubImage2D,
+};
+__GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[] = {
+ __glXDispSwap_AreTexturesResident,
+ __glXDispSwap_DeleteTextures,
+ __glXDispSwap_GenTextures,
+ __glXDispSwap_IsTexture,
+};
+
diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h
new file mode 100644
index 000000000..59c7e3024
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h
@@ -0,0 +1,66 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+#ifndef _GLX_g_disptab_EXT_h_
+#define _GLX_g_disptab_EXT_h_
+/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.2 1999/06/14 07:31:23 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*);
+extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*);
+
+extern void __glXDisp_PolygonOffset(GLbyte*);
+extern void __glXDisp_TexSubImage1D(GLbyte*);
+extern void __glXDisp_TexSubImage2D(GLbyte*);
+extern void __glXDisp_DrawArrays(GLbyte*);
+extern void __glXDisp_BindTexture(GLbyte*);
+extern void __glXDisp_PrioritizeTextures(GLbyte*);
+extern void __glXDisp_CopyTexImage1D(GLbyte*);
+extern void __glXDisp_CopyTexImage2D(GLbyte*);
+extern void __glXDisp_CopyTexSubImage1D(GLbyte*);
+extern void __glXDisp_CopyTexSubImage2D(GLbyte*);
+
+extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*);
+
+extern void __glXDispSwap_PolygonOffset(GLbyte*);
+extern void __glXDispSwap_TexSubImage1D(GLbyte*);
+extern void __glXDispSwap_TexSubImage2D(GLbyte*);
+extern void __glXDispSwap_DrawArrays(GLbyte*);
+extern void __glXDispSwap_BindTexture(GLbyte*);
+extern void __glXDispSwap_PrioritizeTextures(GLbyte*);
+extern void __glXDispSwap_CopyTexImage1D(GLbyte*);
+extern void __glXDispSwap_CopyTexImage2D(GLbyte*);
+extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*);
+extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*);
+
+#define __GLX_MIN_RENDER_OPCODE_EXT 4098
+#define __GLX_MAX_RENDER_OPCODE_EXT 4122
+#define __GLX_MIN_VENDPRIV_OPCODE_EXT 11
+#define __GLX_MAX_VENDPRIV_OPCODE_EXT 14
+#define __GLX_VENDPRIV_TABLE_SIZE_EXT 4
+#define __GLX_RENDER_TABLE_SIZE_EXT 25
+extern __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT];
+extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT];
+extern __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT];
+extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT];
+#endif /* _GLX_g_disptab_EXT_h_ */
diff --git a/xc/programs/Xserver/GL/glx/g_render.c b/xc/programs/Xserver/GL/glx/g_render.c
new file mode 100644
index 000000000..d8214d02a
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_render.c
@@ -0,0 +1,1741 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/* by SGI when creating the GLX sample implementation */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "g_disptab_EXT.h"
+#include "unpack.h"
+#include "impsize.h"
+#include "singlesize.h"
+
+void __glXDisp_CallList(GLbyte *pc)
+{
+ glCallList(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_ListBase(GLbyte *pc)
+{
+ glListBase(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Begin(GLbyte *pc)
+{
+ glBegin(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3bv(GLbyte *pc)
+{
+ glColor3bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glColor3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3fv(GLbyte *pc)
+{
+ glColor3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3iv(GLbyte *pc)
+{
+ glColor3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3sv(GLbyte *pc)
+{
+ glColor3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3ubv(GLbyte *pc)
+{
+ glColor3ubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3uiv(GLbyte *pc)
+{
+ glColor3uiv(
+ (GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color3usv(GLbyte *pc)
+{
+ glColor3usv(
+ (GLushort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4bv(GLbyte *pc)
+{
+ glColor4bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glColor4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4fv(GLbyte *pc)
+{
+ glColor4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4iv(GLbyte *pc)
+{
+ glColor4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4sv(GLbyte *pc)
+{
+ glColor4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4ubv(GLbyte *pc)
+{
+ glColor4ubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4uiv(GLbyte *pc)
+{
+ glColor4uiv(
+ (GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Color4usv(GLbyte *pc)
+{
+ glColor4usv(
+ (GLushort *)(pc + 0)
+ );
+}
+
+void __glXDisp_EdgeFlagv(GLbyte *pc)
+{
+ glEdgeFlagv(
+ (GLboolean *)(pc + 0)
+ );
+}
+
+void __glXDisp_End(GLbyte *pc)
+{
+ glEnd(
+ );
+}
+
+void __glXDisp_Indexdv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ glIndexdv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Indexfv(GLbyte *pc)
+{
+ glIndexfv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Indexiv(GLbyte *pc)
+{
+ glIndexiv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Indexsv(GLbyte *pc)
+{
+ glIndexsv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Normal3bv(GLbyte *pc)
+{
+ glNormal3bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDisp_Normal3dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glNormal3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Normal3fv(GLbyte *pc)
+{
+ glNormal3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Normal3iv(GLbyte *pc)
+{
+ glNormal3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Normal3sv(GLbyte *pc)
+{
+ glNormal3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos2dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glRasterPos2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos2fv(GLbyte *pc)
+{
+ glRasterPos2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos2iv(GLbyte *pc)
+{
+ glRasterPos2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos2sv(GLbyte *pc)
+{
+ glRasterPos2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos3dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glRasterPos3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos3fv(GLbyte *pc)
+{
+ glRasterPos3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos3iv(GLbyte *pc)
+{
+ glRasterPos3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos3sv(GLbyte *pc)
+{
+ glRasterPos3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos4dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glRasterPos4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos4fv(GLbyte *pc)
+{
+ glRasterPos4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos4iv(GLbyte *pc)
+{
+ glRasterPos4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_RasterPos4sv(GLbyte *pc)
+{
+ glRasterPos4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Rectdv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glRectdv(
+ (GLdouble *)(pc + 0),
+ (GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDisp_Rectfv(GLbyte *pc)
+{
+ glRectfv(
+ (GLfloat *)(pc + 0),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Rectiv(GLbyte *pc)
+{
+ glRectiv(
+ (GLint *)(pc + 0),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_Rectsv(GLbyte *pc)
+{
+ glRectsv(
+ (GLshort *)(pc + 0),
+ (GLshort *)(pc + 4)
+ );
+}
+
+void __glXDisp_TexCoord1dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ glTexCoord1dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord1fv(GLbyte *pc)
+{
+ glTexCoord1fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord1iv(GLbyte *pc)
+{
+ glTexCoord1iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord1sv(GLbyte *pc)
+{
+ glTexCoord1sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord2dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glTexCoord2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord2fv(GLbyte *pc)
+{
+ glTexCoord2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord2iv(GLbyte *pc)
+{
+ glTexCoord2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord2sv(GLbyte *pc)
+{
+ glTexCoord2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord3dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glTexCoord3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord3fv(GLbyte *pc)
+{
+ glTexCoord3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord3iv(GLbyte *pc)
+{
+ glTexCoord3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord3sv(GLbyte *pc)
+{
+ glTexCoord3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord4dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glTexCoord4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord4fv(GLbyte *pc)
+{
+ glTexCoord4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord4iv(GLbyte *pc)
+{
+ glTexCoord4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexCoord4sv(GLbyte *pc)
+{
+ glTexCoord4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex2dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glVertex2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex2fv(GLbyte *pc)
+{
+ glVertex2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex2iv(GLbyte *pc)
+{
+ glVertex2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex2sv(GLbyte *pc)
+{
+ glVertex2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex3dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glVertex3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex3fv(GLbyte *pc)
+{
+ glVertex3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex3iv(GLbyte *pc)
+{
+ glVertex3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex3sv(GLbyte *pc)
+{
+ glVertex3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex4dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glVertex4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex4fv(GLbyte *pc)
+{
+ glVertex4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex4iv(GLbyte *pc)
+{
+ glVertex4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Vertex4sv(GLbyte *pc)
+{
+ glVertex4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDisp_ClipPlane(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+ glClipPlane(
+ *(GLenum *)(pc + 32),
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_ColorMaterial(GLbyte *pc)
+{
+ glColorMaterial(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDisp_CullFace(GLbyte *pc)
+{
+ glCullFace(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_Fogf(GLbyte *pc)
+{
+ glFogf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_Fogfv(GLbyte *pc)
+{
+ glFogfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_Fogi(GLbyte *pc)
+{
+ glFogi(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_Fogiv(GLbyte *pc)
+{
+ glFogiv(
+ *(GLenum *)(pc + 0),
+ (GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_FrontFace(GLbyte *pc)
+{
+ glFrontFace(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_Hint(GLbyte *pc)
+{
+ glHint(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDisp_Lightf(GLbyte *pc)
+{
+ glLightf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Lightfv(GLbyte *pc)
+{
+ glLightfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Lighti(GLbyte *pc)
+{
+ glLighti(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_Lightiv(GLbyte *pc)
+{
+ glLightiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_LightModelf(GLbyte *pc)
+{
+ glLightModelf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_LightModelfv(GLbyte *pc)
+{
+ glLightModelfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_LightModeli(GLbyte *pc)
+{
+ glLightModeli(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_LightModeliv(GLbyte *pc)
+{
+ glLightModeliv(
+ *(GLenum *)(pc + 0),
+ (GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_LineStipple(GLbyte *pc)
+{
+ glLineStipple(
+ *(GLint *)(pc + 0),
+ *(GLushort *)(pc + 4)
+ );
+}
+
+void __glXDisp_LineWidth(GLbyte *pc)
+{
+ glLineWidth(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_Materialf(GLbyte *pc)
+{
+ glMaterialf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Materialfv(GLbyte *pc)
+{
+ glMaterialfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Materiali(GLbyte *pc)
+{
+ glMateriali(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_Materialiv(GLbyte *pc)
+{
+ glMaterialiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_PointSize(GLbyte *pc)
+{
+ glPointSize(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_PolygonMode(GLbyte *pc)
+{
+ glPolygonMode(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDisp_Scissor(GLbyte *pc)
+{
+ glScissor(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ );
+}
+
+void __glXDisp_ShadeModel(GLbyte *pc)
+{
+ glShadeModel(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexParameterf(GLbyte *pc)
+{
+ glTexParameterf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexParameterfv(GLbyte *pc)
+{
+ glTexParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexParameteri(GLbyte *pc)
+{
+ glTexParameteri(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexParameteriv(GLbyte *pc)
+{
+ glTexParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexEnvf(GLbyte *pc)
+{
+ glTexEnvf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexEnvfv(GLbyte *pc)
+{
+ glTexEnvfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexEnvi(GLbyte *pc)
+{
+ glTexEnvi(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexEnviv(GLbyte *pc)
+{
+ glTexEnviv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexGend(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glTexGend(
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12),
+ *(GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_TexGendv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint cmdlen;
+ GLint compsize;
+
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGendv_size(pname);
+ if (compsize < 0) compsize = 0;
+ cmdlen = __GLX_PAD(8+compsize*8);
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+
+ glTexGendv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexGenf(GLbyte *pc)
+{
+ glTexGenf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexGenfv(GLbyte *pc)
+{
+ glTexGenfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexGeni(GLbyte *pc)
+{
+ glTexGeni(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_TexGeniv(GLbyte *pc)
+{
+ glTexGeniv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_InitNames(GLbyte *pc)
+{
+ glInitNames(
+ );
+}
+
+void __glXDisp_LoadName(GLbyte *pc)
+{
+ glLoadName(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_PassThrough(GLbyte *pc)
+{
+ glPassThrough(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_PopName(GLbyte *pc)
+{
+ glPopName(
+ );
+}
+
+void __glXDisp_PushName(GLbyte *pc)
+{
+ glPushName(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_DrawBuffer(GLbyte *pc)
+{
+ glDrawBuffer(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_Clear(GLbyte *pc)
+{
+ glClear(
+ *(GLbitfield *)(pc + 0)
+ );
+}
+
+void __glXDisp_ClearAccum(GLbyte *pc)
+{
+ glClearAccum(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ );
+}
+
+void __glXDisp_ClearIndex(GLbyte *pc)
+{
+ glClearIndex(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_ClearColor(GLbyte *pc)
+{
+ glClearColor(
+ *(GLclampf *)(pc + 0),
+ *(GLclampf *)(pc + 4),
+ *(GLclampf *)(pc + 8),
+ *(GLclampf *)(pc + 12)
+ );
+}
+
+void __glXDisp_ClearStencil(GLbyte *pc)
+{
+ glClearStencil(
+ *(GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_ClearDepth(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ glClearDepth(
+ *(GLclampd *)(pc + 0)
+ );
+}
+
+void __glXDisp_StencilMask(GLbyte *pc)
+{
+ glStencilMask(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_ColorMask(GLbyte *pc)
+{
+ glColorMask(
+ *(GLboolean *)(pc + 0),
+ *(GLboolean *)(pc + 1),
+ *(GLboolean *)(pc + 2),
+ *(GLboolean *)(pc + 3)
+ );
+}
+
+void __glXDisp_DepthMask(GLbyte *pc)
+{
+ glDepthMask(
+ *(GLboolean *)(pc + 0)
+ );
+}
+
+void __glXDisp_IndexMask(GLbyte *pc)
+{
+ glIndexMask(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDisp_Accum(GLbyte *pc)
+{
+ glAccum(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_Disable(GLbyte *pc)
+{
+ glDisable(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_Enable(GLbyte *pc)
+{
+ glEnable(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_PopAttrib(GLbyte *pc)
+{
+ glPopAttrib(
+ );
+}
+
+void __glXDisp_PushAttrib(GLbyte *pc)
+{
+ glPushAttrib(
+ *(GLbitfield *)(pc + 0)
+ );
+}
+
+void __glXDisp_MapGrid1d(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+ glMapGrid1d(
+ *(GLint *)(pc + 16),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8)
+ );
+}
+
+void __glXDisp_MapGrid1f(GLbyte *pc)
+{
+ glMapGrid1f(
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_MapGrid2d(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+ glMapGrid2d(
+ *(GLint *)(pc + 32),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLint *)(pc + 36),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ );
+}
+
+void __glXDisp_MapGrid2f(GLbyte *pc)
+{
+ glMapGrid2f(
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLfloat *)(pc + 16),
+ *(GLfloat *)(pc + 20)
+ );
+}
+
+void __glXDisp_EvalCoord1dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ glEvalCoord1dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_EvalCoord1fv(GLbyte *pc)
+{
+ glEvalCoord1fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_EvalCoord2dv(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glEvalCoord2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_EvalCoord2fv(GLbyte *pc)
+{
+ glEvalCoord2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_EvalMesh1(GLbyte *pc)
+{
+ glEvalMesh1(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDisp_EvalPoint1(GLbyte *pc)
+{
+ glEvalPoint1(
+ *(GLint *)(pc + 0)
+ );
+}
+
+void __glXDisp_EvalMesh2(GLbyte *pc)
+{
+ glEvalMesh2(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ );
+}
+
+void __glXDisp_EvalPoint2(GLbyte *pc)
+{
+ glEvalPoint2(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_AlphaFunc(GLbyte *pc)
+{
+ glAlphaFunc(
+ *(GLenum *)(pc + 0),
+ *(GLclampf *)(pc + 4)
+ );
+}
+
+void __glXDisp_BlendFunc(GLbyte *pc)
+{
+ glBlendFunc(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDisp_LogicOp(GLbyte *pc)
+{
+ glLogicOp(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_StencilFunc(GLbyte *pc)
+{
+ glStencilFunc(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLuint *)(pc + 8)
+ );
+}
+
+void __glXDisp_StencilOp(GLbyte *pc)
+{
+ glStencilOp(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8)
+ );
+}
+
+void __glXDisp_DepthFunc(GLbyte *pc)
+{
+ glDepthFunc(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_PixelZoom(GLbyte *pc)
+{
+ glPixelZoom(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_PixelTransferf(GLbyte *pc)
+{
+ glPixelTransferf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_PixelTransferi(GLbyte *pc)
+{
+ glPixelTransferi(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDisp_PixelMapfv(GLbyte *pc)
+{
+ glPixelMapfv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_PixelMapuiv(GLbyte *pc)
+{
+ glPixelMapuiv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLuint *)(pc + 8)
+ );
+}
+
+void __glXDisp_PixelMapusv(GLbyte *pc)
+{
+ glPixelMapusv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLushort *)(pc + 8)
+ );
+}
+
+void __glXDisp_ReadBuffer(GLbyte *pc)
+{
+ glReadBuffer(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_CopyPixels(GLbyte *pc)
+{
+ glCopyPixels(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16)
+ );
+}
+
+void __glXDisp_DepthRange(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ glDepthRange(
+ *(GLclampd *)(pc + 0),
+ *(GLclampd *)(pc + 8)
+ );
+}
+
+void __glXDisp_Frustum(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ glFrustum(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ );
+}
+
+void __glXDisp_LoadIdentity(GLbyte *pc)
+{
+ glLoadIdentity(
+ );
+}
+
+void __glXDisp_LoadMatrixf(GLbyte *pc)
+{
+ glLoadMatrixf(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_LoadMatrixd(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ glLoadMatrixd(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_MatrixMode(GLbyte *pc)
+{
+ glMatrixMode(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDisp_MultMatrixf(GLbyte *pc)
+{
+ glMultMatrixf(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDisp_MultMatrixd(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ glMultMatrixd(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDisp_Ortho(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ glOrtho(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ );
+}
+
+void __glXDisp_PopMatrix(GLbyte *pc)
+{
+ glPopMatrix(
+ );
+}
+
+void __glXDisp_PushMatrix(GLbyte *pc)
+{
+ glPushMatrix(
+ );
+}
+
+void __glXDisp_Rotated(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ glRotated(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ );
+}
+
+void __glXDisp_Rotatef(GLbyte *pc)
+{
+ glRotatef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ );
+}
+
+void __glXDisp_Scaled(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glScaled(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDisp_Scalef(GLbyte *pc)
+{
+ glScalef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Translated(GLbyte *pc)
+{
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ glTranslated(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDisp_Translatef(GLbyte *pc)
+{
+ glTranslatef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDisp_Viewport(GLbyte *pc)
+{
+ glViewport(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ );
+}
+
+void __glXDisp_PolygonOffset(GLbyte *pc)
+{
+ glPolygonOffset(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDisp_CopyTexImage1D(GLbyte *pc)
+{
+ glCopyTexImage1D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLint *)(pc + 24)
+ );
+}
+
+void __glXDisp_CopyTexImage2D(GLbyte *pc)
+{
+ glCopyTexImage2D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLint *)(pc + 28)
+ );
+}
+
+void __glXDisp_CopyTexSubImage1D(GLbyte *pc)
+{
+ glCopyTexSubImage1D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20)
+ );
+}
+
+void __glXDisp_CopyTexSubImage2D(GLbyte *pc)
+{
+ glCopyTexSubImage2D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLsizei *)(pc + 28)
+ );
+}
+
+void __glXDisp_BindTexture(GLbyte *pc)
+{
+ glBindTexture(
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ );
+}
+
+void __glXDisp_PrioritizeTextures(GLbyte *pc)
+{
+ GLsizei n;
+
+ n = *(GLsizei *)(pc + 0);
+
+ glPrioritizeTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4),
+ (GLclampf *)(pc + 4+n*4)
+ );
+}
+
+void __glXDisp_Indexubv(GLbyte *pc)
+{
+ glIndexubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
diff --git a/xc/programs/Xserver/GL/glx/g_renderswap.c b/xc/programs/Xserver/GL/glx/g_renderswap.c
new file mode 100644
index 000000000..5b57a07a3
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_renderswap.c
@@ -0,0 +1,2717 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/* by SGI when creating the GLX sample implementation */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "g_disptab_EXT.h"
+#include "unpack.h"
+#include "impsize.h"
+#include "singlesize.h"
+
+void __glXDispSwap_CallList(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glCallList(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ListBase(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glListBase(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Begin(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glBegin(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3bv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glColor3bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+ glColor3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+ glColor3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glColor3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glColor3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3ubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glColor3ubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3uiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glColor3uiv(
+ (GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color3usv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glColor3usv(
+ (GLushort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4bv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glColor4bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+ glColor4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+ glColor4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+ glColor4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+ glColor4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4ubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glColor4ubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4uiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+ glColor4uiv(
+ (GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Color4usv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+ glColor4usv(
+ (GLushort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EdgeFlagv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glEdgeFlagv(
+ (GLboolean *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_End(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glEnd(
+ );
+}
+
+void __glXDispSwap_Indexdv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+ glIndexdv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Indexfv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+ glIndexfv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Indexiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+
+ glIndexiv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Indexsv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+
+ glIndexsv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Normal3bv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glNormal3bv(
+ (GLbyte *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Normal3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+ glNormal3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Normal3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+ glNormal3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Normal3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glNormal3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Normal3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glNormal3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+ glRasterPos2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+ glRasterPos2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+ glRasterPos2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+ glRasterPos2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+ glRasterPos3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+ glRasterPos3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glRasterPos3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glRasterPos3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+ glRasterPos4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+ glRasterPos4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+ glRasterPos4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_RasterPos4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+ glRasterPos4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Rectdv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
+
+ glRectdv(
+ (GLdouble *)(pc + 0),
+ (GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDispSwap_Rectfv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
+
+ glRectfv(
+ (GLfloat *)(pc + 0),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Rectiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 8, 2);
+
+ glRectiv(
+ (GLint *)(pc + 0),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Rectsv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+
+ glRectsv(
+ (GLshort *)(pc + 0),
+ (GLshort *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_TexCoord1dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+ glTexCoord1dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord1fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+ glTexCoord1fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord1iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+
+ glTexCoord1iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord1sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+
+ glTexCoord1sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+ glTexCoord2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+ glTexCoord2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+ glTexCoord2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+ glTexCoord2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+ glTexCoord3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+ glTexCoord3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glTexCoord3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glTexCoord3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+ glTexCoord4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+ glTexCoord4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+ glTexCoord4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexCoord4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+ glTexCoord4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+ glVertex2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+ glVertex2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+ glVertex2iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+ glVertex2sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+ glVertex3dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+ glVertex3fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+ glVertex3iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+ glVertex3sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+ glVertex4dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+ glVertex4fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+ glVertex4iv(
+ (GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Vertex4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+ glVertex4sv(
+ (GLshort *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ClipPlane(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+ glClipPlane(
+ *(GLenum *)(pc + 32),
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ColorMaterial(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glColorMaterial(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_CullFace(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glCullFace(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Fogf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glFogf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Fogfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glFogfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+
+ glFogfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Fogi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glFogi(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Fogiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glFogiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+
+ glFogiv(
+ *(GLenum *)(pc + 0),
+ (GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_FrontFace(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glFrontFace(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Hint(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glHint(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Lightf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glLightf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Lightfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glLightfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+ glLightfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Lighti(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glLighti(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Lightiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glLightiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+ glLightiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_LightModelf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glLightModelf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LightModelfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glLightModelfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+
+ glLightModelfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LightModeli(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glLightModeli(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LightModeliv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glLightModeliv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+
+ glLightModeliv(
+ *(GLenum *)(pc + 0),
+ (GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LineStipple(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT(pc + 4);
+
+ glLineStipple(
+ *(GLint *)(pc + 0),
+ *(GLushort *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LineWidth(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+ glLineWidth(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Materialf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glMaterialf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Materialfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glMaterialfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+ glMaterialfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Materiali(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glMateriali(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Materialiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glMaterialiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+ glMaterialiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_PointSize(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+ glPointSize(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_PolygonMode(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glPolygonMode(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Scissor(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+
+ glScissor(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ );
+}
+
+void __glXDispSwap_ShadeModel(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glShadeModel(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexParameterf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glTexParameterf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexParameterfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+ glTexParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexParameteri(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glTexParameteri(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexParameteriv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+ glTexParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexEnvf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glTexEnvf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexEnvfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexEnvfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+ glTexEnvfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexEnvi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glTexEnvi(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexEnviv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexEnviv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+ glTexEnviv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexGend(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_DOUBLE(pc + 0);
+
+ glTexGend(
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12),
+ *(GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_TexGendv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint cmdlen;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGendv_size(pname);
+ if (compsize < 0) compsize = 0;
+ cmdlen = __GLX_PAD(8+compsize*8);
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
+
+ glTexGendv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexGenf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glTexGenf(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexGenfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGenfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+ glTexGenfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexGeni(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glTexGeni(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_TexGeniv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGeniv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+ glTexGeniv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_InitNames(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glInitNames(
+ );
+}
+
+void __glXDispSwap_LoadName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glLoadName(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_PassThrough(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+ glPassThrough(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_PopName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glPopName(
+ );
+}
+
+void __glXDispSwap_PushName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glPushName(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_DrawBuffer(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glDrawBuffer(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Clear(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glClear(
+ *(GLbitfield *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ClearAccum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+ glClearAccum(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ );
+}
+
+void __glXDispSwap_ClearIndex(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+ glClearIndex(
+ *(GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ClearColor(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+ glClearColor(
+ *(GLclampf *)(pc + 0),
+ *(GLclampf *)(pc + 4),
+ *(GLclampf *)(pc + 8),
+ *(GLclampf *)(pc + 12)
+ );
+}
+
+void __glXDispSwap_ClearStencil(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glClearStencil(
+ *(GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ClearDepth(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+
+ glClearDepth(
+ *(GLclampd *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_StencilMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glStencilMask(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_ColorMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glColorMask(
+ *(GLboolean *)(pc + 0),
+ *(GLboolean *)(pc + 1),
+ *(GLboolean *)(pc + 2),
+ *(GLboolean *)(pc + 3)
+ );
+}
+
+void __glXDispSwap_DepthMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glDepthMask(
+ *(GLboolean *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_IndexMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glIndexMask(
+ *(GLuint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Accum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glAccum(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_Disable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glDisable(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Enable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glEnable(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_PopAttrib(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glPopAttrib(
+ );
+}
+
+void __glXDispSwap_PushAttrib(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glPushAttrib(
+ *(GLbitfield *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_MapGrid1d(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+
+ glMapGrid1d(
+ *(GLint *)(pc + 16),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_MapGrid1f(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glMapGrid1f(
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_MapGrid2d(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+
+ glMapGrid2d(
+ *(GLint *)(pc + 32),
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLint *)(pc + 36),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ );
+}
+
+void __glXDispSwap_MapGrid2f(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
+
+ glMapGrid2f(
+ *(GLint *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLfloat *)(pc + 16),
+ *(GLfloat *)(pc + 20)
+ );
+}
+
+void __glXDispSwap_EvalCoord1dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+ glEvalCoord1dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EvalCoord1fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+ glEvalCoord1fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EvalCoord2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+ glEvalCoord2dv(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EvalCoord2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+ glEvalCoord2fv(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EvalMesh1(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glEvalMesh1(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_EvalPoint1(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glEvalPoint1(
+ *(GLint *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_EvalMesh2(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+ glEvalMesh2(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16)
+ );
+}
+
+void __glXDispSwap_EvalPoint2(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glEvalPoint2(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_AlphaFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glAlphaFunc(
+ *(GLenum *)(pc + 0),
+ *(GLclampf *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_BlendFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glBlendFunc(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_LogicOp(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glLogicOp(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_StencilFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glStencilFunc(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLuint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_StencilOp(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+ glStencilOp(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ *(GLenum *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_DepthFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glDepthFunc(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_PixelZoom(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glPixelZoom(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_PixelTransferf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glPixelTransferf(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_PixelTransferi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glPixelTransferi(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_PixelMapfv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
+
+ glPixelMapfv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_PixelMapuiv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
+
+ glPixelMapuiv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLuint *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_PixelMapusv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
+
+ glPixelMapusv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ (GLushort *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_ReadBuffer(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glReadBuffer(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_CopyPixels(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+ glCopyPixels(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16)
+ );
+}
+
+void __glXDispSwap_DepthRange(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+
+ glDepthRange(
+ *(GLclampd *)(pc + 0),
+ *(GLclampd *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Frustum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
+
+ glFrustum(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ );
+}
+
+void __glXDispSwap_LoadIdentity(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glLoadIdentity(
+ );
+}
+
+void __glXDispSwap_LoadMatrixf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+
+ glLoadMatrixf(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_LoadMatrixd(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+
+ glLoadMatrixd(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_MatrixMode(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+ glMatrixMode(
+ *(GLenum *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_MultMatrixf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+
+ glMultMatrixf(
+ (GLfloat *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_MultMatrixd(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+
+ glMultMatrixd(
+ (GLdouble *)(pc + 0)
+ );
+}
+
+void __glXDispSwap_Ortho(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
+
+ glOrtho(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24),
+ *(GLdouble *)(pc + 32),
+ *(GLdouble *)(pc + 40)
+ );
+}
+
+void __glXDispSwap_PopMatrix(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glPopMatrix(
+ );
+}
+
+void __glXDispSwap_PushMatrix(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glPushMatrix(
+ );
+}
+
+void __glXDispSwap_Rotated(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+
+ glRotated(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16),
+ *(GLdouble *)(pc + 24)
+ );
+}
+
+void __glXDispSwap_Rotatef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+ glRotatef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8),
+ *(GLfloat *)(pc + 12)
+ );
+}
+
+void __glXDispSwap_Scaled(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+
+ glScaled(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDispSwap_Scalef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glScalef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Translated(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+
+ glTranslated(
+ *(GLdouble *)(pc + 0),
+ *(GLdouble *)(pc + 8),
+ *(GLdouble *)(pc + 16)
+ );
+}
+
+void __glXDispSwap_Translatef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ glTranslatef(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4),
+ *(GLfloat *)(pc + 8)
+ );
+}
+
+void __glXDispSwap_Viewport(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+
+ glViewport(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12)
+ );
+}
+
+void __glXDispSwap_PolygonOffset(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glPolygonOffset(
+ *(GLfloat *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_CopyTexImage1D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+
+ glCopyTexImage1D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLint *)(pc + 24)
+ );
+}
+
+void __glXDispSwap_CopyTexImage2D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+
+ glCopyTexImage2D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLint *)(pc + 28)
+ );
+}
+
+void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+ glCopyTexSubImage1D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLsizei *)(pc + 20)
+ );
+}
+
+void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+
+ glCopyTexSubImage2D(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLint *)(pc + 8),
+ *(GLint *)(pc + 12),
+ *(GLint *)(pc + 16),
+ *(GLint *)(pc + 20),
+ *(GLsizei *)(pc + 24),
+ *(GLsizei *)(pc + 28)
+ );
+}
+
+void __glXDispSwap_BindTexture(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glBindTexture(
+ *(GLenum *)(pc + 0),
+ *(GLuint *)(pc + 4)
+ );
+}
+
+void __glXDispSwap_PrioritizeTextures(GLbyte *pc)
+{
+ GLsizei n;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *)(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n);
+
+ glPrioritizeTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4),
+ (GLclampf *)(pc + 4+n*4)
+ );
+}
+
+void __glXDispSwap_Indexubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+ glIndexubv(
+ (GLubyte *)(pc + 0)
+ );
+}
+
diff --git a/xc/programs/Xserver/GL/glx/g_single.c b/xc/programs/Xserver/GL/glx/g_single.c
new file mode 100644
index 000000000..e86d68f86
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_single.c
@@ -0,0 +1,1332 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/* by SGI when creating the GLX sample implementation */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "g_disptab_EXT.h"
+#include "unpack.h"
+#include "impsize.h"
+#include "singlesize.h"
+
+int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ glNewList(
+ *(GLuint *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ glEndList(
+ );
+ return Success;
+}
+
+int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ glDeleteLists(
+ *(GLuint *)(pc + 0),
+ *(GLsizei *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc)
+{
+ GLuint retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ retval =
+ glGenLists(
+ *(GLsizei *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ glPixelStoref(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ glPixelStorei(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLboolean answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetBooleanv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glGetBooleanv(
+ *(GLenum *)(pc + 0),
+ (GLboolean *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_BYTE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetDoublev_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetDoublev(
+ *(GLenum *)(pc + 0),
+ (GLdouble *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ retval =
+ glGetError(
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetFloatv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetFloatv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetIntegerv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetIntegerv(
+ *(GLenum *)(pc + 0),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetLightfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetLightfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetLightiv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetLightiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapdv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetMapdv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapfv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMapfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapiv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMapiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetMaterialfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMaterialfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetMaterialiv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMaterialiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapfv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetPixelMapfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLuint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapuiv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetPixelMapuiv(
+ *(GLenum *)(pc + 0),
+ (GLuint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLushort answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapusv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*2,2);
+ __glXClearErrorOccured();
+ glGetPixelMapusv(
+ *(GLenum *)(pc + 0),
+ (GLushort *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_SHORT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*2);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_SHORT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexEnvfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexEnvfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexEnviv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexEnviv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGendv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetTexGendv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGenfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexGenfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGeniv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexGeniv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 8);
+ compsize = __glGetTexLevelParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexLevelParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ (GLfloat *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ pname = *(GLenum *)(pc + 8);
+ compsize = __glGetTexLevelParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexLevelParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ (GLint *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(1);
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ retval =
+ glIsEnabled(
+ *(GLenum *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ retval =
+ glIsList(
+ *(GLuint *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLboolean answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ n = *(GLsizei *)(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,n,1);
+ retval =
+ glAreTexturesResident(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4),
+ (GLboolean *) answer
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(n);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(n);
+ return Success;
+}
+
+int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ n = *(GLsizei *)(pc + 0);
+
+ glDeleteTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4)
+ );
+ return Success;
+}
+
+int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLuint answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ n = *(GLsizei *)(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4);
+ glGenTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *) answer
+ );
+ __GLX_BEGIN_REPLY(n*4);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(n);
+ return Success;
+}
+
+int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+
+ retval =
+ glIsTexture(
+ *(GLuint *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
diff --git a/xc/programs/Xserver/GL/glx/g_singleswap.c b/xc/programs/Xserver/GL/glx/g_singleswap.c
new file mode 100644
index 000000000..98f8631a6
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/g_singleswap.c
@@ -0,0 +1,1613 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.3 1999/06/14 07:31:24 dawes Exp $ */
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/* by SGI when creating the GLX sample implementation */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "g_disptab_EXT.h"
+#include "unpack.h"
+#include "impsize.h"
+#include "singlesize.h"
+
+int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glNewList(
+ *(GLuint *)(pc + 0),
+ *(GLenum *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ glEndList(
+ );
+ return Success;
+}
+
+int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glDeleteLists(
+ *(GLuint *)(pc + 0),
+ *(GLsizei *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc)
+{
+ GLuint retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+
+ retval =
+ glGenLists(
+ *(GLsizei *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+ glPixelStoref(
+ *(GLenum *)(pc + 0),
+ *(GLfloat *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ glPixelStorei(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4)
+ );
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLboolean answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetBooleanv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glGetBooleanv(
+ *(GLenum *)(pc + 0),
+ (GLboolean *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_BYTE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetDoublev_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetDoublev(
+ *(GLenum *)(pc + 0),
+ (GLdouble *) answer
+ );
+ __GLX_SWAP_DOUBLE_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ retval =
+ glGetError(
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetFloatv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetFloatv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glGetIntegerv_size(pname);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetIntegerv(
+ *(GLenum *)(pc + 0),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetLightfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetLightfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetLightiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetLightiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapdv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetMapdv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *) answer
+ );
+ __GLX_SWAP_DOUBLE_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapfv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMapfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum query;
+ GLenum target;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ query = *(GLenum *)(pc + 4);
+ target = *(GLenum *)(pc + 0);
+ compsize = __glGetMapiv_size(target,query);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMapiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetMaterialfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMaterialfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetMaterialiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetMaterialiv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapfv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetPixelMapfv(
+ *(GLenum *)(pc + 0),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLuint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapuiv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetPixelMapuiv(
+ *(GLenum *)(pc + 0),
+ (GLuint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum map;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLushort answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ map = *(GLenum *)(pc + 0);
+ compsize = __glGetPixelMapusv_size(map);
+ if (compsize < 0) compsize = 0;
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*2,2);
+ __glXClearErrorOccured();
+ glGetPixelMapusv(
+ *(GLenum *)(pc + 0),
+ (GLushort *) answer
+ );
+ __GLX_SWAP_SHORT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_SHORT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*2);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_SHORT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexEnvfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexEnvfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexEnviv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexEnviv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGendv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8);
+ __glXClearErrorOccured();
+ glGetTexGendv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLdouble *) answer
+ );
+ __GLX_SWAP_DOUBLE_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_DOUBLE();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*8);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGenfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexGenfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexGeniv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexGeniv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glGetTexParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLenum *)(pc + 4),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLfloat answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 8);
+ pname = *(GLenum *)(pc + 8);
+ compsize = __glGetTexLevelParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexLevelParameterfv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ (GLfloat *) answer
+ );
+ __GLX_SWAP_FLOAT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_FLOAT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_FLOAT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 8);
+ pname = *(GLenum *)(pc + 8);
+ compsize = __glGetTexLevelParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4);
+ __glXClearErrorOccured();
+ glGetTexLevelParameteriv(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ (GLint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, compsize);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(0);
+ __GLX_SEND_HEADER();
+ } else if (compsize == 1) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(1);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_PUT_INT();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_PUT_SIZE(compsize);
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+
+ retval =
+ glIsEnabled(
+ *(GLenum *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+
+ retval =
+ glIsList(
+ *(GLuint *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLboolean answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *)(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,n,1);
+ retval =
+ glAreTexturesResident(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4),
+ (GLboolean *) answer
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(n);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(n);
+ return Success;
+}
+
+int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *)(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+
+ glDeleteTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *)(pc + 4)
+ );
+ return Success;
+}
+
+int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei n;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLuint answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *)(pc + 0);
+
+ __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4);
+ glGenTextures(
+ *(GLsizei *)(pc + 0),
+ (GLuint *) answer
+ );
+ __GLX_SWAP_INT_ARRAY(answer, n);
+ __GLX_BEGIN_REPLY(n*4);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_INT_ARRAY(n);
+ return Success;
+}
+
+int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean retval;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_VENDPRIV_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+
+ retval =
+ glIsTexture(
+ *(GLuint *)(pc + 0)
+ );
+ __GLX_PUT_RETVAL(retval);
+ __GLX_SWAP_REPLY_RETVAL();
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
diff --git a/xc/programs/Xserver/GL/glx/global.c b/xc/programs/Xserver/GL/glx/global.c
new file mode 100644
index 000000000..5a7ae7ff9
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/global.c
@@ -0,0 +1,57 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.2 1999/06/14 07:31:24 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+
+/*
+** The last context used by the server. It is the context that is current
+** from the server's perspective.
+*/
+__GLXcontext *__glXLastContext;
+
+/*
+** X resources.
+*/
+RESTYPE __glXContextRes;
+RESTYPE __glXClientRes;
+RESTYPE __glXPixmapRes;
+
+/*
+** Error codes with the extension error base already added in.
+*/
+int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap;
+int __glXBadContextTag, __glXBadCurrentWindow;
+int __glXBadRenderRequest, __glXBadLargeRequest;
+int __glXUnsupportedPrivateRequest;
+
+/*
+** Reply for most singles.
+*/
+xGLXSingleReply __glXReply;
+
+/*
+** A set of state for each client. The 0th one is unused because client
+** indices start at 1, not 0.
+*/
+__GLXclientState *__glXClients[MAXCLIENTS+1];
+
diff --git a/xc/programs/Xserver/GL/glx/glxbuf.c b/xc/programs/Xserver/GL/glx/glxbuf.c
new file mode 100644
index 000000000..6c42e588a
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxbuf.c
@@ -0,0 +1,276 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxbuf.h"
+#include "glxfb.h"
+#include "glxmem.h"
+#include "glxpix.h"
+
+void
+__glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes)
+{
+ __GLdrawablePrivate *glPriv;
+ GLint rgbBits;
+ GLint accumBits;
+
+ glPriv = &glxPriv->glPriv;
+ rgbBits = modes->rgbBits;
+ accumBits = modes->accumRedBits + modes->accumGreenBits +
+ modes->accumBlueBits + modes->accumAlphaBits;
+
+#if defined(__GL_ALIGNED_BUFFERS)
+ /* initialize pixel alignments (for more details see context.h) */
+ glPriv->xAlignment = 1;
+ glPriv->yAlignment = 1;
+#endif
+
+ glxPriv->swapBuffers = __glXFBMemSwapBuffers;
+
+ glPriv->yInverted = GL_TRUE; /* Y is upside-down */
+
+ if (modes->doubleBufferMode) {
+ if (modes->colorIndexMode) {
+ __glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits);
+ __glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits);
+ } else {
+ __glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits);
+ __glXInitMem(&glPriv->backBuffer, glPriv, rgbBits);
+ }
+ } else {
+ if (modes->colorIndexMode) {
+ __glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits);
+ } else {
+ __glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits);
+ }
+ }
+
+#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
+ if (modes->maxAuxBuffers > 0) {
+ GLint i;
+
+ for (i=0; i < modes->maxAuxBuffers; i++) {
+ if (modes->colorIndexMode) {
+ __glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits);
+ } else {
+ __glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits);
+ }
+ }
+ }
+#endif
+
+ if (modes->haveAccumBuffer) {
+ __glXInitMem(&glPriv->accumBuffer, glPriv, accumBits);
+ }
+ if (modes->haveDepthBuffer) {
+ __glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits);
+ }
+ if (modes->haveStencilBuffer) {
+ __glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits);
+ }
+}
+
+void
+__glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes)
+{
+ __GLdrawablePrivate *glPriv;
+ GLint rgbBits;
+ GLint accumBits;
+
+ assert(glxPriv->pGlxPixmap);
+
+ glPriv = &glxPriv->glPriv;
+ rgbBits = modes->rgbBits;
+ accumBits = modes->accumRedBits + modes->accumGreenBits +
+ modes->accumBlueBits + modes->accumAlphaBits;
+
+#if defined(__GL_ALIGNED_BUFFERS)
+ /* initialize pixel alignments (for more details see context.h) */
+ glPriv->xAlignment = 1;
+ glPriv->yAlignment = 1;
+#endif
+
+ glxPriv->swapBuffers = (GLboolean (*)(__GLXdrawablePrivate *))__glXNop;
+
+ glPriv->yInverted = GL_FALSE;
+
+ if (modes->doubleBufferMode) {
+ if (modes->colorIndexMode) {
+ __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
+ glxPriv->drawId, glxPriv->pGlxPixmap);
+ __glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits);
+ } else {
+ __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
+ glxPriv->drawId, glxPriv->pGlxPixmap);
+ __glXInitMem(&glPriv->backBuffer, glPriv, rgbBits);
+ }
+ } else {
+ if (modes->colorIndexMode) {
+ __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
+ glxPriv->drawId, glxPriv->pGlxPixmap);
+ } else {
+ __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits,
+ glxPriv->drawId, glxPriv->pGlxPixmap);
+ }
+ }
+
+#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
+ if (modes->maxAuxBuffers > 0) {
+ GLint i;
+
+ for (i=0; i < modes->maxAuxBuffers; i++) {
+ if (modes->colorIndexMode) {
+ __glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits);
+ } else {
+ __glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits);
+ }
+ }
+ }
+#endif
+
+ if (modes->haveAccumBuffer) {
+ __glXInitMem(&glPriv->accumBuffer, glPriv, accumBits);
+ }
+ if (modes->haveDepthBuffer) {
+ __glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits);
+ }
+ if (modes->haveStencilBuffer) {
+ __glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits);
+ }
+}
+
+
+#define __GLX_SET_ACCEL_BUFFER_MASK(bm) \
+ if (status == GL_FALSE) return GL_FALSE; \
+ if (status == GL_TRUE) accelBufferMask |= bm; \
+ /* for __GL_BUFFER_FALLBACK don't do anything */
+
+GLboolean
+__glXResizeBuffers(__GLdrawablePrivate *glPriv,
+ GLint x, GLint y, GLuint width, GLuint height)
+{
+ __GLcontextModes *modes;
+ __GLdrawableRegion *glRegion;
+ GLboolean status;
+ GLuint accelBufferMask;
+
+ modes = glPriv->modes;
+ accelBufferMask = 0;
+
+ status = (*glPriv->frontBuffer.resize)(&glPriv->frontBuffer,
+ x, y, width, height, glPriv,
+ __GL_FRONT_BUFFER_MASK);
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_FRONT_BUFFER_MASK);
+
+ if (modes->doubleBufferMode) {
+ status = (*glPriv->backBuffer.resize)(&glPriv->backBuffer,
+ x, y, width, height, glPriv,
+ __GL_BACK_BUFFER_MASK);
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_BACK_BUFFER_MASK);
+ }
+
+#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
+ if (modes->maxAuxBuffers > 0) {
+ GLint i;
+
+ for (i=0; i < modes->maxAuxBuffers; i++) {
+ status = (*glPriv->auxBuffers[i].resize)(&glPriv->auxBuffer[i],
+ x, y, width, height,
+ glPriv,
+ __GL_AUX_BUFFER_MASK(i));
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_AUX_BUFFER_MASK(i));
+ }
+ }
+#endif
+
+ if (modes->haveAccumBuffer) {
+ status = (*glPriv->accumBuffer.resize)(&glPriv->accumBuffer,
+ x, y, width, height, glPriv,
+ __GL_ACCUM_BUFFER_MASK);
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_ACCUM_BUFFER_MASK);
+ }
+
+ if (modes->haveDepthBuffer) {
+ status = (*glPriv->depthBuffer.resize)(&glPriv->depthBuffer,
+ x, y, width, height, glPriv,
+ __GL_DEPTH_BUFFER_MASK);
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_DEPTH_BUFFER_MASK);
+ }
+
+ if (modes->haveStencilBuffer) {
+ status = (*glPriv->stencilBuffer.resize)(&glPriv->stencilBuffer,
+ x, y, width, height, glPriv,
+ __GL_STENCIL_BUFFER_MASK);
+ __GLX_SET_ACCEL_BUFFER_MASK(__GL_STENCIL_BUFFER_MASK);
+ }
+
+ glPriv->accelBufferMask = accelBufferMask;
+
+ /* finally, update the ownership region */
+ glRegion = &glPriv->ownershipRegion;
+ glRegion->numRects = 1;
+ glRegion->rects[0].x0 = 0;
+ glRegion->rects[0].y0 = 0;
+ glRegion->rects[0].x1 = width;
+ glRegion->rects[0].y1 = height;
+
+ return GL_TRUE;
+}
+
+void
+__glXFreeBuffers(__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ __GLcontextModes *modes = glPriv->modes;
+
+ if (glPriv->frontBuffer.free) {
+ (*glPriv->frontBuffer.free)(&glPriv->frontBuffer, glPriv);
+ }
+ if (glPriv->backBuffer.free) {
+ (*glPriv->backBuffer.free)(&glPriv->backBuffer, glPriv);
+ }
+
+#if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0)
+ if (modes->maxAuxBuffers > 0) {
+ GLint i;
+
+ for (i=0; i < modes->maxAuxBuffers; i++) {
+ if (glPriv->auxBuffer[i].free) {
+ (*glPriv->auxBuffer[i].free)(&glPriv->auxBuffer[i], glPriv);
+ }
+ }
+ }
+#endif
+
+ if (glPriv->accumBuffer.free) {
+ (*glPriv->accumBuffer.free)(&glPriv->accumBuffer, glPriv);
+ }
+
+ if (glPriv->depthBuffer.free) {
+ (*glPriv->depthBuffer.free)(&glPriv->depthBuffer, glPriv);
+ }
+
+ if (glPriv->stencilBuffer.free) {
+ (*glPriv->stencilBuffer.free)(&glPriv->stencilBuffer, glPriv);
+ }
+}
diff --git a/xc/programs/Xserver/GL/glx/glxbuf.h b/xc/programs/Xserver/GL/glx/glxbuf.h
new file mode 100644
index 000000000..05cea4a44
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxbuf.h
@@ -0,0 +1,39 @@
+#ifndef _glxbuf_h_
+#define _glxbuf_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.2 1999/06/14 07:31:25 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv,
+ __GLcontextModes *modes);
+extern void __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv,
+ __GLcontextModes *modes);
+
+extern GLboolean __glXResizeBuffers(__GLdrawablePrivate *glPriv,
+ GLint x, GLint y,
+ GLuint width, GLuint height);
+
+extern void __glXFreeBuffers(__GLXdrawablePrivate *glxPriv);
+extern void __glXUpdatePalette(__GLXdrawablePrivate *);
+
+#endif /* _glxbuf_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c
new file mode 100644
index 000000000..2504ffa29
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxcmds.c
@@ -0,0 +1,1548 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include <unpack.h>
+#include "g_disptab.h"
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "g_disptab_EXT.h"
+#include "glximports.h"
+#include "glxutil.h"
+#include "glxext.h"
+
+/************************************************************************/
+
+static __GLimports imports = {
+ __glXImpMalloc,
+ __glXImpCalloc,
+ __glXImpRealloc,
+ __glXImpFree,
+ __glXImpWarning,
+ __glXImpFatal,
+ __glXImpGetenv,
+ __glXImpSprintf,
+ __glXImpFopen,
+ __glXImpFclose,
+ __glXImpFprintf,
+ __glXImpGetDrawablePrivate,
+ NULL,
+};
+
+/************************************************************************/
+
+/*
+** Create a GL context with the given properties.
+*/
+int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
+ __GLXcontext *glxc, *shareglxc;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXscreenInfo *pGlxScreen;
+ __GLinterface *shareGC;
+ GLXContextID gcId = req->context;
+ GLXContextID shareList = req->shareList;
+ VisualID visual = req->visual;
+ GLuint screen = req->screen;
+ GLboolean isDirect = req->isDirect;
+ GLint i;
+
+ /*
+ ** Check if screen exists.
+ */
+ if (screen >= screenInfo.numScreens) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+ /*
+ ** Get configuration of the visual. This assumes that the
+ ** glXActiveScreens structure contains visual configurations only for the
+ ** subset of Visuals that are supported by this implementation of the
+ ** OpenGL.
+ */
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+ /*
+ ** Find the display list space that we want to share.
+ **
+ ** NOTE: In a multithreaded X server, we would need to keep a reference
+ ** count for each display list so that if one client detroyed a list that
+ ** another client was using, the list would not really be freed until it
+ ** was no longer in use. Since this sample implementation has no support
+ ** for multithreaded servers, we don't do this.
+ */
+ if (shareList == None) {
+ shareGC = 0;
+ } else {
+ shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
+ if (!shareglxc) {
+ client->errorValue = shareList;
+ return __glXBadContext;
+ }
+ if (shareglxc->isDirect) {
+ /*
+ ** NOTE: no support for sharing display lists between direct
+ ** contexts, even if they are in the same address space.
+ */
+ client->errorValue = shareList;
+ return BadMatch;
+ } else {
+ /*
+ ** Create an indirect context regardless of what the client asked
+ ** for; this way we can share display list space with shareList.
+ */
+ isDirect = GL_FALSE;
+ }
+ shareGC = shareglxc->gc;
+ }
+
+ /*
+ ** Allocate memory for the new context
+ */
+ glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
+ if (!glxc) {
+ return BadAlloc;
+ }
+ __glXMemset(glxc, 0, sizeof(__GLXcontext));
+
+ /*
+ ** Initially, setup the part of the context that could be used by
+ ** a GL core that needs windowing information (e.g., Mesa).
+ */
+ glxc->pScreen = pScreen;
+ glxc->pGlxScreen = pGlxScreen;
+ glxc->pVisual = pVisual;
+ glxc->pGlxVisual = pGlxVisual;
+
+ if (!isDirect) {
+ __GLcontextModes *modes;
+ /*
+ ** first build __GLcontextModes from __GLXvisualConfig
+ */
+ modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
+ glxc->modes = modes;
+ __glXFormatGLModes(modes, pGlxVisual);
+
+ /*
+ ** Allocate a GL context
+ */
+ imports.other = (void *)glxc;
+ glxc->gc = (*pGlxScreen->createContext)(&imports, modes, shareGC);
+ if (!glxc->gc) {
+ __glXFree(glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+ } else {
+ /*
+ ** Don't need local GL context for a direct context.
+ */
+ glxc->gc = 0;
+ }
+ /*
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ if (!isDirect) {
+ (*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc);
+ }
+ __glXFree(glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
+ /*
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
+ glxc->id = gcId;
+ glxc->share_id = shareList;
+ glxc->idExists = GL_TRUE;
+ glxc->isCurrent = GL_FALSE;
+ glxc->isDirect = isDirect;
+ glxc->renderMode = GL_RENDER;
+
+ return Success;
+}
+
+/*
+** Destroy a GL context as an X resource.
+*/
+int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+ GLXContextID gcId = req->context;
+ __GLXcontext *glxc;
+
+ glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
+ if (glxc) {
+ /*
+ ** Just free the resource; don't actually destroy the context,
+ ** because it might be in use. The
+ ** destroy method will be called by the resource destruction routine
+ ** if necessary.
+ */
+ FreeResourceByType(gcId, __glXContextRes, FALSE);
+ return Success;
+ } else {
+ client->errorValue = gcId;
+ return __glXBadContext;
+ }
+}
+
+/*****************************************************************************/
+
+/*
+** For each client, the server keeps a table of all the contexts that are
+** current for that client (each thread of a client may have its own current
+** context). These routines add, change, and lookup contexts in the table.
+*/
+
+/*
+** Add a current context, and return the tag that will be used to refer to it.
+*/
+static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
+{
+ int i;
+ int num = cl->numCurrentContexts;
+ __GLXcontext **table = cl->currentContexts;
+
+ if (!glxc) return -1;
+
+ /*
+ ** Try to find an empty slot and use it.
+ */
+ for (i=0; i < num; i++) {
+ if (!table[i]) {
+ table[i] = glxc;
+ return i+1;
+ }
+ }
+ /*
+ ** Didn't find a free slot, so we'll have to grow the table.
+ */
+ if (!num) {
+ table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *));
+ } else {
+ table = (__GLXcontext **) __glXRealloc(table,
+ (num+1)*sizeof(__GLXcontext *));
+ }
+ table[num] = glxc;
+ cl->currentContexts = table;
+ cl->numCurrentContexts++;
+ return num+1;
+}
+
+/*
+** Given a tag, change the current context for the corresponding entry.
+*/
+static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
+ GLXContextTag tag)
+{
+ __GLXcontext **table = cl->currentContexts;
+ table[tag-1] = glxc;
+}
+
+/*
+** For this implementation we have chosen to simply use the index of the
+** context's entry in the table as the context tag. A tag must be greater
+** than 0.
+*/
+__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+ int num = cl->numCurrentContexts;
+
+ if (tag < 1 || tag > num) {
+ return 0;
+ } else {
+ return cl->currentContexts[tag-1];
+ }
+}
+
+/*****************************************************************************/
+
+static void StopUsingContext(__GLXcontext *glxc)
+{
+ if (glxc) {
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
+ __glXFreeContext(glxc);
+ }
+ }
+}
+
+static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+{
+ glxc->isCurrent = GL_TRUE;
+}
+
+/*****************************************************************************/
+/*
+** Make an OpenGL context and drawable current.
+*/
+int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+ xGLXMakeCurrentReply reply;
+ GLXDrawable drawId = req->drawable;
+ GLXContextID contextId = req->context;
+ __GLXpixmap *pGlxPixmap = 0;
+ __GLXcontext *glxc, *prevglxc;
+ __GLinterface *gc, *prevgc;
+ __GLXdrawablePrivate *glxPriv = NULL;
+ GLXContextTag tag = req->oldContextTag;
+ GLint error;
+
+ /*
+ ** If one is None and the other isn't, it's a bad match.
+ */
+ if ((drawId == None && contextId != None) ||
+ (drawId != None && contextId == None)) {
+ return BadMatch;
+ }
+
+ /*
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
+ if (tag != 0) {
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXBadContextTag;
+ }
+ if (prevglxc->renderMode != GL_RENDER) {
+ /* Oops. Not in render mode render. */
+ client->errorValue = prevglxc->id;
+ return __glXBadContextState;
+ }
+ prevgc = prevglxc->gc;
+ } else {
+ prevglxc = 0;
+ prevgc = 0;
+ }
+
+ /*
+ ** Lookup new context. It must not be current for someone else.
+ */
+ if (contextId != None) {
+ glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
+ if (!glxc) {
+ client->errorValue = contextId;
+ return __glXBadContext;
+ }
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
+ gc = glxc->gc;
+ } else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
+ gc = 0;
+ }
+
+ if (drawId != None) {
+ pDraw = (DrawablePtr) LookupDrawable(drawId, client);
+ if (pDraw) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ WindowPtr pWin = (WindowPtr)pDraw;
+ VisualID vid = wVisual(pWin);
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ } else {
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ } else {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pGlxPixmap->pScreen != glxc->pScreen ||
+ pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+ pDraw = pGlxPixmap->pDraw;
+
+ } else {
+ /*
+ ** Drawable is neither a Window nor a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+ } else {
+ pDraw = 0;
+ }
+
+ /* get the drawable private */
+ if (pDraw) {
+ glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes);
+ if (glxPriv == NULL) {
+ return __glXBadDrawable;
+ }
+ }
+
+ if (prevglxc) {
+ /*
+ ** Flush the previous context if needed.
+ */
+ if (__GLX_HAS_UNFLUSHED_CMDS(prevglxc)) {
+ if (__glXForceCurrent(cl, tag, (int *)&error)) {
+ glFlush();
+ __GLX_NOTE_FLUSHED_CMDS(prevglxc);
+ } else {
+ return error;
+ }
+ }
+
+ /*
+ ** Make the previous context not current.
+ */
+ if (!(*prevgc->exports.loseCurrent)((__GLcontext *)prevgc)) {
+ return __glXBadContext;
+ }
+ __glXDeassociateContext(prevglxc, prevglxc->glxPriv);
+ }
+
+ if ((glxc != 0) && !glxc->isDirect) {
+
+ glxc->glxPriv = glxPriv;
+ __glXCacheDrawableSize(glxPriv);
+
+ /* make the context current */
+ if (!(*gc->exports.makeCurrent)((__GLcontext *)gc, &glxPriv->glPriv)) {
+ glxc->glxPriv = NULL;
+ return __glXBadContext;
+ }
+
+ /* resize the buffers */
+ if (!__glXResizeDrawableBuffers(glxPriv)) {
+ /* could not do initial resize. make current failed */
+ (*gc->exports.loseCurrent)((__GLcontext *)gc);
+ glxc->glxPriv = NULL;
+ return __glXBadContext;
+ }
+
+ glxc->isCurrent = GL_TRUE;
+ __glXAssociateContext(glxc, glxPriv);
+ assert(glxPriv->glxc == glxc);
+ }
+
+ if (prevglxc) {
+ if (prevglxc->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxPixmap->refcnt--;
+ if (!prevglxc->pGlxPixmap->idExists &&
+ !prevglxc->pGlxPixmap->refcnt) {
+ PixmapPtr pPixmap = (PixmapPtr) prevglxc->pGlxPixmap->pDraw;
+ /*
+ ** The DestroyPixmap routine should decrement the
+ ** refcount of the X pixmap and free only if it's zero.
+ */
+ (*prevglxc->pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
+ __glXFree(prevglxc->pGlxPixmap);
+ }
+ prevglxc->pGlxPixmap = 0;
+ }
+ ChangeCurrentContext(cl, glxc, tag);
+ StopUsingContext(prevglxc);
+ } else {
+ tag = AddCurrentContext(cl, glxc);
+ }
+ if (glxc) {
+ if (pGlxPixmap) {
+ pGlxPixmap->refcnt++;
+ glxc->pGlxPixmap = pGlxPixmap;
+ }
+ StartUsingContext(cl, glxc);
+ reply.contextTag = tag;
+ } else {
+ reply.contextTag = 0;
+ }
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapMakeCurrentReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)&reply);
+ }
+ return Success;
+}
+
+int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+ xGLXIsDirectReply reply;
+ __GLXcontext *glxc;
+
+ /*
+ ** Find the GL context.
+ */
+ glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ if (!glxc) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ reply.isDirect = glxc->isDirect;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapIsDirectReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ }
+
+ return Success;
+}
+
+int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+ xGLXQueryVersionReply reply;
+ GLuint major, minor;
+
+ major = req->majorVersion;
+ minor = req->minorVersion;
+
+ /*
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
+ reply.majorVersion = GLX_SERVER_MAJOR_VERSION;
+ reply.minorVersion = GLX_SERVER_MINOR_VERSION;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapQueryVersionReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ }
+ return Success;
+}
+
+int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
+ int error;
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error)) {
+ return error;
+ }
+ glFinish();
+ return Success;
+}
+
+int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ int error;
+
+ if (!__glXForceCurrent(cl, req->contextTag, &error)) {
+ return error;
+ }
+ /*
+ ** In a multithreaded server that had separate X and GL threads, we would
+ ** have to wait for the X thread to finish before returning. As it stands,
+ ** this sample implementation only supports singlethreaded servers, and
+ ** nothing needs to be done here.
+ */
+ return Success;
+}
+
+int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+ GLXContextID source = req->source;
+ GLXContextID dest = req->dest;
+ GLXContextTag tag = req->contextTag;
+ unsigned long mask = req->mask;
+ __GLXcontext *src, *dst;
+ int error;
+
+ /*
+ ** Check that each context exists.
+ */
+ src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
+ if (!src) {
+ client->errorValue = source;
+ return __glXBadContext;
+ }
+ dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
+ if (!dst) {
+ client->errorValue = dest;
+ return __glXBadContext;
+ }
+
+ /*
+ ** They must be in the same address space, and same screen.
+ ** NOTE: no support for direct rendering contexts here.
+ */
+ if (src->isDirect || dst->isDirect ||
+ (src->pGlxScreen != dst->pGlxScreen)) {
+ client->errorValue = source;
+ return BadMatch;
+ }
+
+ /*
+ ** The destination context must not be current for any client.
+ */
+ if (dst->isCurrent) {
+ client->errorValue = dest;
+ return BadAccess;
+ }
+
+ if (tag) {
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXBadContextTag;
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
+ /*
+ ** In this case, glXCopyContext is in both GL and X streams, in terms
+ ** of sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the copy is executed.
+ */
+ glFinish();
+ __GLX_NOTE_FLUSHED_CMDS(tagcx);
+ } else {
+ return error;
+ }
+ }
+ /*
+ ** Issue copy. The only reason for failure is a bad mask.
+ */
+ if (!(*dst->gc->exports.copyContext)((__GLcontext *)dst->gc,
+ (__GLcontext *)src->gc,
+ mask)) {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ return Success;
+}
+
+int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ CARD32 buf[__GLX_TOTAL_CONFIG];
+ unsigned int screen;
+ int i, p;
+
+ screen = req->screen;
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numVisuals = pGlxScreen->numUsableVisuals;
+ reply.numProps = __GLX_TOTAL_CONFIG;
+ reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 *
+ __GLX_TOTAL_CONFIG) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+ for (i=0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *)buf);
+ }
+ return Success;
+}
+
+/*
+** Create a GLX Pixmap from an X Pixmap.
+*/
+int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+ VisualID visual = req->visual;
+ GLuint screenNum = req->screen;
+ XID pixmapId = req->pixmap;
+ XID glxpixmapId = req->glxpixmap;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ __GLXpixmap *pGlxPixmap;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ int i;
+
+ pDraw = (DrawablePtr) LookupDrawable(pixmapId, client);
+ if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) {
+ client->errorValue = pixmapId;
+ return BadPixmap;
+ }
+
+ /*
+ ** Check if screen of visual matches screen of pixmap.
+ */
+ pScreen = pDraw->pScreen;
+ if (screenNum != pScreen->myNum) {
+ return BadMatch;
+ }
+
+ /*
+ ** Find the VisualRec for this visual.
+ */
+ pVisual = pScreen->visuals;
+ for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+ /*
+ ** Check if depth of visual matches depth of pixmap.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ return BadMatch;
+ }
+
+ /*
+ ** Get configuration of the visual.
+ */
+ pGlxScreen = &__glXActiveScreens[screenNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+ pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap));
+ if (!pGlxPixmap) {
+ return BadAlloc;
+ }
+ if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
+ return BadAlloc;
+ }
+ pGlxPixmap->pDraw = pDraw;
+ pGlxPixmap->pGlxScreen = pGlxScreen;
+ pGlxPixmap->pGlxVisual = pGlxVisual;
+ pGlxPixmap->pScreen = pScreen;
+ pGlxPixmap->idExists = True;
+ pGlxPixmap->refcnt = 0;
+
+ /*
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
+ ((PixmapPtr) pDraw)->refcnt++;
+
+ return Success;
+}
+
+int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+ XID glxpixmap = req->glxpixmap;
+
+ /*
+ ** Check if it's a valid GLX pixmap.
+ */
+ if (!LookupIDByType(glxpixmap, __glXPixmapRes)) {
+ client->errorValue = glxpixmap;
+ return __glXBadPixmap;
+ }
+ FreeResource(glxpixmap, FALSE);
+ return Success;
+}
+
+/*****************************************************************************/
+
+/*
+** NOTE: There is no portable implementation for swap buffers as of
+** this time that is of value. Consequently, this code must be
+** implemented by somebody other than SGI.
+*/
+int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+ GLXContextTag tag = req->contextTag;
+ XID drawId = req->drawable;
+ __GLXpixmap *pGlxPixmap;
+ __GLXcontext *glxc = NULL;
+ int error;
+
+ /*
+ ** Check that the GLX drawable is valid.
+ */
+ pDraw = (DrawablePtr) LookupDrawable(drawId, client);
+ if (pDraw) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X window.
+ */
+ } else {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ } else {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ } else {
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
+ /*
+ ** The calling thread is swapping its current drawable. In this case,
+ ** glxSwapBuffers is in both GL and X streams, in terms of
+ ** sequentiality.
+ */
+ if (__glXForceCurrent(cl, tag, &error)) {
+ /*
+ ** Do whatever is needed to make sure that all preceding requests
+ ** in both streams are completed before the swap is executed.
+ */
+ glFinish();
+ __GLX_NOTE_FLUSHED_CMDS(glxc);
+ } else {
+ return error;
+ }
+ }
+
+ if (pDraw) {
+ __GLXdrawablePrivate *glxPriv;
+
+ glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes);
+ if (glxPriv == NULL) {
+ return __glXBadDrawable;
+ }
+
+ if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) {
+ return __glXBadDrawable;
+ }
+ }
+
+ return Success;
+}
+
+
+int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ __GLXcontext *ctx;
+ xGLXQueryContextInfoEXTReq *req;
+ xGLXQueryContextInfoEXTReply reply;
+ int nProps;
+ int *sendBuf, *pSendBuf;
+ int nReplyBytes;
+
+ req = (xGLXQueryContextInfoEXTReq *)pc;
+ ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ if (!ctx) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ nProps = 3;
+ reply.length = nProps << 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.n = nProps;
+
+ nReplyBytes = reply.length << 2;
+ sendBuf = (int *)__glXMalloc((size_t)nReplyBytes);
+ if (sendBuf == NULL) {
+ return __glXBadContext; /* XXX: Is this correct? */
+ }
+ pSendBuf = sendBuf;
+ *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
+ *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = GLX_VISUAL_ID_EXT;
+ *pSendBuf++ = (int)(ctx->pVisual->vid);
+ *pSendBuf++ = GLX_SCREEN_EXT;
+ *pSendBuf++ = (int)(ctx->pScreen->myNum);
+
+ if (client->swapped) {
+ __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ }
+ __glXFree((char *)sendBuf);
+
+ return Success;
+}
+
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+/*
+** Execute all the drawing commands in a request.
+*/
+int __glXRender(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderReq *req;
+ ClientPtr client= cl->client;
+ int left, cmdlen, error;
+ int commandsDone;
+ CARD16 opcode;
+ __GLXrenderHeader *hdr;
+ __GLXcontext *glxc;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderReq *) pc;
+ glxc = __glXForceCurrent(cl, req->contextTag, &error);
+ if (!glxc) {
+ return error;
+ }
+
+ commandsDone = 0;
+ pc += sz_xGLXRenderReq;
+ left = (req->length << 2) - sz_xGLXRenderReq;
+ while (left > 0) {
+ __GLXrenderSizeData *entry;
+ int extra;
+ void (* proc)(GLbyte *);
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ entry = &__glXRenderSizeTable[opcode];
+ proc = __glXRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ entry =
+ &__glXRenderSizeTable_EXT[opcode -
+ __GLX_MIN_RENDER_OPCODE_EXT];
+ proc = __glXRenderTable_EXT[opcode -
+ __GLX_MIN_RENDER_OPCODE_EXT];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = commandsDone;
+ return __glXBadRenderRequest;
+ }
+
+ if (!entry->bytes) {
+ /* unused opcode */
+ client->errorValue = commandsDone;
+ return __glXBadRenderRequest;
+ }
+ if (entry->varsize) {
+ /* variable size command */
+ extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False);
+ if (extra < 0) {
+ extra = 0;
+ }
+ if (cmdlen != __GLX_PAD(entry->bytes + extra)) {
+ return BadLength;
+ }
+ } else {
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry->bytes)) {
+ return BadLength;
+ }
+ }
+ if (left < cmdlen) {
+ return BadLength;
+ }
+
+ /*
+ ** Skip over the header and execute the command. We allow the
+ ** caller to trash the command memory. This is useful especially
+ ** for things that require double alignment - they can just shift
+ ** the data towards lower memory (trashing the header) by 4 bytes
+ ** and achieve the required alignment.
+ */
+ (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+ pc += cmdlen;
+ left -= cmdlen;
+ commandsDone++;
+ }
+ __GLX_NOTE_UNFLUSHED_CMDS(glxc);
+ return Success;
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderLargeReq *req;
+ ClientPtr client= cl->client;
+ GLuint dataBytes;
+ void (*proc)(GLbyte *);
+ __GLXrenderLargeHeader *hdr;
+ __GLXcontext *glxc;
+ int error;
+ CARD16 opcode;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderLargeReq *) pc;
+ glxc = __glXForceCurrent(cl, req->contextTag, &error);
+ if (!glxc) {
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return error;
+ }
+ dataBytes = req->dataBytes;
+
+ /*
+ ** Check the request length.
+ */
+ if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
+ client->errorValue = req->length;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return BadLength;
+ }
+ pc += sz_xGLXRenderLargeReq;
+
+ if (cl->largeCmdRequestsSoFar == 0) {
+ __GLXrenderSizeData *entry;
+ int extra, cmdlen;
+ /*
+ ** This is the first request of a multi request command.
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (req->requestNumber != 1) {
+ client->errorValue = req->requestNumber;
+ return __glXBadLargeRequest;
+ }
+
+ hdr = (__GLXrenderLargeHeader *) pc;
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ /*
+ ** Check for core opcodes and grab entry data.
+ */
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ entry = &__glXRenderSizeTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ opcode -= __GLX_MIN_RENDER_OPCODE_EXT;
+ entry = &__glXRenderSizeTable_EXT[opcode];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+
+ if (!entry->bytes) {
+ /* unused opcode */
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+ if (entry->varsize) {
+ /*
+ ** If it's a variable-size command (a command whose length must
+ ** be computed from its parameters), all the parameters needed
+ ** will be in the 1st request, so it's okay to do this.
+ */
+ extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False);
+ if (extra < 0) {
+ extra = 0;
+ }
+ /* large command's header is 4 bytes longer, so add 4 */
+ if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) {
+ return BadLength;
+ }
+ } else {
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry->bytes + 4)) {
+ return BadLength;
+ }
+ }
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < cmdlen) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen);
+ } else {
+ cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf,
+ (size_t)cmdlen);
+ }
+ if (!cl->largeCmdBuf) {
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = cmdlen;
+ }
+ __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+
+ cl->largeCmdBytesSoFar = dataBytes;
+ cl->largeCmdBytesTotal = cmdlen;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ return Success;
+
+ } else {
+ /*
+ ** We are receiving subsequent (i.e. not the first) requests of a
+ ** multi request command.
+ */
+
+ /*
+ ** Check the request number and the total request count.
+ */
+ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
+ client->errorValue = req->requestNumber;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ if (req->requestTotal != cl->largeCmdRequestsTotal) {
+ client->errorValue = req->requestTotal;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Check that we didn't get too much data.
+ */
+ if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ cl->largeCmdBytesSoFar += dataBytes;
+ cl->largeCmdRequestsSoFar++;
+
+ if (req->requestNumber == cl->largeCmdRequestsTotal) {
+ /*
+ ** This is the last request; it must have enough bytes to complete
+ ** the command.
+ */
+ /* NOTE: the two pad macros have been added below; they are needed
+ ** because the client library pads the total byte count, but not
+ ** the per-request byte counts. The Protocol Encoding says the
+ ** total byte count should not be padded, so a proposal will be
+ ** made to the ARB to relax the padding constraint on the total
+ ** byte count, thus preserving backward compatibility. Meanwhile,
+ ** the padding done below fixes a bug that did not allow
+ ** large commands of odd sizes to be accepted by the server.
+ */
+ if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
+ __GLX_PAD(cl->largeCmdBytesTotal)) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
+ opcode = hdr->opcode;
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ proc = __glXRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ opcode -= __GLX_MIN_RENDER_OPCODE_EXT;
+ proc = __glXRenderTable_EXT[opcode];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Skip over the header and execute the command.
+ */
+ (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+ __GLX_NOTE_UNFLUSHED_CMDS(glxc);
+
+ /*
+ ** Reset for the next RenderLarge series.
+ */
+ __glXResetLargeCommandStatus(cl);
+ } else {
+ /*
+ ** This is neither the first nor the last request.
+ */
+ }
+ return Success;
+ }
+}
+
+
+/************************************************************************/
+
+/*
+** No support is provided for the vendor-private requests other than
+** allocating the entry points in the dispatch table.
+*/
+
+int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req;
+ GLint vendorcode;
+
+ req = (xGLXVendorPrivateReq *) pc;
+ vendorcode = req->vendorCode;
+
+ if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) &&
+ (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) {
+ (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])
+ (cl, (GLbyte*)req);
+ return Success;
+ }
+ /*
+ ** This sample implemention does not support any private requests.
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+}
+
+int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+ GLint vendorcode;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+ vendorcode = req->vendorCode;
+
+ switch (vendorcode) {
+ case X_GLXvop_QueryContextInfoEXT:
+ return __glXQueryContextInfoEXT(cl, pc);
+ default:
+ break;
+ }
+
+ if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) &&
+ (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) {
+ return
+ (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])
+ (cl, (GLbyte*)req);
+ }
+
+ cl->client->errorValue = vendorcode;
+ return __glXUnsupportedPrivateRequest;
+}
+
+int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
+ xGLXQueryExtensionsStringReply reply;
+ GLint screen;
+ size_t n, length;
+ const char *ptr;
+ char *buf;
+
+ screen = req->screen;
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+ ptr = __glXActiveScreens[screen].GLXextensions;
+
+ n = __glXStrlen(ptr) + 1;
+ length = __GLX_PAD(n) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = n;
+
+ if ((buf = (char *) __glXMalloc(length << 2)) == NULL) {
+ return BadAlloc;
+ }
+ __glXStrncpy(buf, ptr, n);
+
+ if (client->swapped) {
+ glxSwapQueryExtensionsStringReply(client, &reply, buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
+ WriteToClient(client, (int)(length << 2), (char *)buf);
+ }
+
+ __glXFree(buf);
+ return Success;
+}
+
+int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+ xGLXQueryServerStringReply reply;
+ int name;
+ GLint screen;
+ size_t n, length;
+ const char *ptr;
+ char *buf;
+
+ name = req->name;
+ screen = req->screen;
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+ switch(name) {
+ case GLX_VENDOR:
+ ptr = __glXActiveScreens[screen].GLXvendor;
+ break;
+ case GLX_VERSION:
+ ptr = __glXActiveScreens[screen].GLXversion;
+ break;
+ case GLX_EXTENSIONS:
+ ptr = __glXActiveScreens[screen].GLXextensions;
+ break;
+ default:
+ return BadValue;
+ }
+
+ n = __glXStrlen(ptr) + 1;
+ length = __GLX_PAD(n) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = n;
+
+ if ((buf = (char *) Xalloc(length << 2)) == NULL) {
+ return BadAlloc;
+ }
+ __glXStrncpy(buf, ptr, n);
+
+ if (client->swapped) {
+ glxSwapQueryServerStringReply(client, &reply, buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
+ WriteToClient(client, (int)(length << 2), buf);
+ }
+
+ __glXFree(buf);
+ return Success;
+}
+
+int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+ const char *buf;
+
+ cl->GLClientmajorVersion = req->major;
+ cl->GLClientminorVersion = req->minor;
+ if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ buf = (const char *)(req+1);
+ cl->GLClientextensions = __glXStrdup(buf);
+
+ return Success;
+}
+
diff --git a/xc/programs/Xserver/GL/glx/glxcmdsswap.c b/xc/programs/Xserver/GL/glx/glxcmdsswap.c
new file mode 100644
index 000000000..6437c2938
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxcmdsswap.c
@@ -0,0 +1,792 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include "glxutil.h"
+#include <GL/glxtokens.h>
+#include <unpack.h>
+#include <g_disptab.h>
+#include <g_disptab_EXT.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxext.h"
+
+/************************************************************************/
+
+/*
+** Byteswapping versions of GLX commands. In most cases they just swap
+** the incoming arguments and then call the unswapped routine. For commands
+** that have replies, a separate swapping routine for the reply is provided;
+** it is called at the end of the unswapped routine.
+*/
+
+int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXCreateContext(cl, pc);
+}
+
+int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDestroyContext(cl, pc);
+}
+
+int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXMakeCurrent(cl, pc);
+}
+
+int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXIsDirect(cl, pc);
+}
+
+int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->majorVersion);
+ __GLX_SWAP_INT(&req->minorVersion);
+
+ return __glXQueryVersion(cl, pc);
+}
+
+int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXWaitGL(cl, pc);
+}
+
+int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXWaitX(cl, pc);
+}
+
+int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->source);
+ __GLX_SWAP_INT(&req->dest);
+ __GLX_SWAP_INT(&req->mask);
+
+ return __glXCopyContext(cl, pc);
+}
+
+int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ CARD32 buf[__GLX_TOTAL_CONFIG];
+ unsigned int screen;
+ int i, p;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->screen);
+ screen = req->screen;
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numVisuals = pGlxScreen->numUsableVisuals;
+ reply.numProps = __GLX_TOTAL_CONFIG;
+ reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 *
+ __GLX_TOTAL_CONFIG) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+ for (i=0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *)buf);
+ }
+ return Success;
+}
+
+int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXCreateGLXPixmap(cl, pc);
+}
+
+int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDestroyGLXPixmap(cl, pc);
+}
+
+int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->drawable);
+
+ return __glXSwapBuffers(cl, pc);
+}
+
+int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->font);
+ __GLX_SWAP_INT(&req->first);
+ __GLX_SWAP_INT(&req->count);
+ __GLX_SWAP_INT(&req->listBase);
+
+ return __glXUseXFont(cl, pc);
+}
+
+
+int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryExtensionsStringReq *req = NULL;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+
+ return __glXQueryExtensionsString(cl, pc);
+}
+
+int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->name);
+
+ return __glXQueryServerString(cl, pc);
+}
+
+int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->major);
+ __GLX_SWAP_INT(&req->minor);
+ __GLX_SWAP_INT(&req->numbytes);
+
+ return __glXClientInfo(cl, pc);
+}
+
+int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXQueryContextInfoEXT(cl, (GLbyte *)pc);
+}
+
+/************************************************************************/
+
+/*
+** Swap replies.
+*/
+
+void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->contextTag);
+ WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)reply);
+}
+
+void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply);
+}
+
+void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->majorVersion);
+ __GLX_SWAP_INT(&reply->minorVersion);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply);
+}
+
+void glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply *reply, char *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
+ __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, length << 2, buf);
+}
+
+void glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply *reply, char *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply);
+ /** no swap is needed for an array of chars **/
+ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
+ WriteToClient(client, length << 2, buf);
+}
+
+void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
+ __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, length << 2, (char *)buf);
+}
+
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderReq *req;
+ ClientPtr client= cl->client;
+ int left, cmdlen, error;
+ int commandsDone;
+ CARD16 opcode;
+ __GLXrenderHeader *hdr;
+ __GLXcontext *cx;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ /*
+ ** NOTE: much of this code also appears in the nonswapping version of this
+ ** routine, __glXRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ cx = __glXForceCurrent(cl, req->contextTag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ commandsDone = 0;
+ pc += sz_xGLXRenderReq;
+ left = (req->length << 2) - sz_xGLXRenderReq;
+ while (left > 0) {
+ __GLXrenderSizeData *entry, renderEntry;
+ int extra;
+ void (* proc)(GLbyte *);
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ entry = &__glXRenderSizeTable[opcode];
+ proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ entry = &__glXRenderSizeTable_EXT[index];
+ proc = __glXSwapRenderTable_EXT[index];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = commandsDone;
+ return __glXBadRenderRequest;
+ }
+ if (!entry->bytes) {
+ /* unused opcode */
+ client->errorValue = commandsDone;
+ return __glXBadRenderRequest;
+ }
+ if (entry->varsize) {
+ /* variable size command */
+ extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True);
+ if (extra < 0) {
+ extra = 0;
+ }
+ if (cmdlen != __GLX_PAD(entry->bytes + extra)) {
+ return BadLength;
+ }
+ } else {
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry->bytes)) {
+ return BadLength;
+ }
+ }
+ if (left < cmdlen) {
+ return BadLength;
+ }
+
+ /*
+ ** Skip over the header and execute the command. We allow the
+ ** caller to trash the command memory. This is useful especially
+ ** for things that require double alignment - they can just shift
+ ** the data towards lower memory (trashing the header) by 4 bytes
+ ** and achieve the required alignment.
+ */
+ (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+ pc += cmdlen;
+ left -= cmdlen;
+ commandsDone++;
+ }
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderLargeReq *req;
+ ClientPtr client= cl->client;
+ size_t dataBytes;
+ void (*proc)(GLbyte *);
+ __GLXrenderLargeHeader *hdr;
+ __GLXcontext *cx;
+ int error;
+ CARD16 opcode;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ /*
+ ** NOTE: much of this code also appears in the nonswapping version of this
+ ** routine, __glXRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderLargeReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->dataBytes);
+ __GLX_SWAP_SHORT(&req->requestNumber);
+ __GLX_SWAP_SHORT(&req->requestTotal);
+ cx = __glXForceCurrent(cl, req->contextTag, &error);
+ if (!cx) {
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return error;
+ }
+ dataBytes = req->dataBytes;
+
+ /*
+ ** Check the request length.
+ */
+ if ((req->length << 2) != __GLX_PAD(dataBytes) + sz_xGLXRenderLargeReq) {
+ client->errorValue = req->length;
+ /* Reset in case this isn't 1st request. */
+ __glXResetLargeCommandStatus(cl);
+ return BadLength;
+ }
+ pc += sz_xGLXRenderLargeReq;
+
+ if (cl->largeCmdRequestsSoFar == 0) {
+ __GLXrenderSizeData *entry, renderEntry;
+ int extra;
+ size_t cmdlen;
+ /*
+ ** This is the first request of a multi request command.
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (req->requestNumber != 1) {
+ client->errorValue = req->requestNumber;
+ return __glXBadLargeRequest;
+ }
+ hdr = (__GLXrenderLargeHeader *) pc;
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
+ cmdlen = hdr->length;
+ opcode = hdr->opcode;
+
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ entry = &__glXRenderSizeTable[opcode];
+ proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ entry = &__glXRenderSizeTable_EXT[index];
+ proc = __glXSwapRenderTable_EXT[index];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+
+ if (!entry->bytes) {
+ /* unused opcode */
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+ if (entry->varsize) {
+ /*
+ ** If it's a variable-size command (a command whose length must
+ ** be computed from its parameters), all the parameters needed
+ ** will be in the 1st request, so it's okay to do this.
+ */
+ extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True);
+ if (extra < 0) {
+ extra = 0;
+ }
+ /* large command's header is 4 bytes longer, so add 4 */
+ if (cmdlen != __GLX_PAD(entry->bytes + 4 + extra)) {
+ return BadLength;
+ }
+ } else {
+ /* constant size command */
+ if (cmdlen != __GLX_PAD(entry->bytes + 4)) {
+ return BadLength;
+ }
+ }
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < cmdlen) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen);
+ } else {
+ cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen);
+ }
+ if (!cl->largeCmdBuf) {
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = cmdlen;
+ }
+ __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+
+ cl->largeCmdBytesSoFar = dataBytes;
+ cl->largeCmdBytesTotal = cmdlen;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ return Success;
+
+ } else {
+ /*
+ ** We are receiving subsequent (i.e. not the first) requests of a
+ ** multi request command.
+ */
+
+ /*
+ ** Check the request number and the total request count.
+ */
+ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) {
+ client->errorValue = req->requestNumber;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ if (req->requestTotal != cl->largeCmdRequestsTotal) {
+ client->errorValue = req->requestTotal;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Check that we didn't get too much data.
+ */
+ if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ cl->largeCmdBytesSoFar += dataBytes;
+ cl->largeCmdRequestsSoFar++;
+
+ if (req->requestNumber == cl->largeCmdRequestsTotal) {
+ /*
+ ** This is the last request; it must have enough bytes to complete
+ ** the command.
+ */
+ /* NOTE: the two pad macros have been added below; they are needed
+ ** because the client library pads the total byte count, but not
+ ** the per-request byte counts. The Protocol Encoding says the
+ ** total byte count should not be padded, so a proposal will be
+ ** made to the ARB to relax the padding constraint on the total
+ ** byte count, thus preserving backward compatibility. Meanwhile,
+ ** the padding done below fixes a bug that did not allow
+ ** large commands of odd sizes to be accepted by the server.
+ */
+ if (__GLX_PAD(cl->largeCmdBytesSoFar) !=
+ __GLX_PAD(cl->largeCmdBytesTotal)) {
+ client->errorValue = dataBytes;
+ __glXResetLargeCommandStatus(cl);
+ return __glXBadLargeRequest;
+ }
+ hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf;
+ /*
+ ** The opcode and length field in the header had already been
+ ** swapped when the first request was received.
+ */
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ opcode = hdr->opcode;
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ proc = __glXSwapRenderTable_EXT[index];
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = opcode;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Skip over the header and execute the command.
+ */
+ (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+
+ /*
+ ** Reset for the next RenderLarge series.
+ */
+ __glXResetLargeCommandStatus(cl);
+ } else {
+ /*
+ ** This is neither the first nor the last request.
+ */
+ }
+ return Success;
+ }
+}
+
+/************************************************************************/
+
+/*
+** No support is provided for the vendor-private requests other than
+** allocating these entry points in the dispatch table.
+*/
+
+int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req;
+ GLint vendorcode;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+
+ vendorcode = req->vendorCode;
+
+ if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) &&
+ (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) {
+ (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req);
+ return Success;
+ }
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+}
+
+int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+ GLint vendorcode;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+
+ vendorcode = req->vendorCode;
+
+ if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) &&
+ (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) {
+ return (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req);
+ }
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+}
diff --git a/xc/programs/Xserver/GL/glx/glxcontext.h b/xc/programs/Xserver/GL/glx/glxcontext.h
new file mode 100644
index 000000000..c3e353fc7
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxcontext.h
@@ -0,0 +1,141 @@
+#ifndef _GLX_context_h_
+#define _GLX_context_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+typedef struct __GLXcontextRec __GLXcontext;
+
+#include "GL/internal/glcore.h"
+
+struct __GLXcontextRec {
+ /*
+ ** list of context structs
+ */
+ struct __GLXcontextRec *last;
+ struct __GLXcontextRec *next;
+
+ /*
+ ** list of contexts bound to the same drawable
+ */
+ struct __GLXcontextRec *nextPriv;
+
+ /*
+ ** Opaque pointer the context object created by the GL that the
+ ** server is bound with. Never dereferenced by this code, but used
+ ** as a handle to feed to the routines in the screen info struct.
+ */
+ __GLinterface *gc;
+
+ /*
+ ** mode struct for this context
+ */
+ __GLcontextModes *modes;
+
+ /*
+ ** Pointer to screen info data for this context. This is set
+ ** when the context is created.
+ */
+ ScreenPtr pScreen;
+ __GLXscreenInfo *pGlxScreen;
+
+ /*
+ ** This context is created with respect to this visual.
+ */
+ VisualRec *pVisual;
+ __GLXvisualConfig *pGlxVisual;
+
+ /*
+ ** The XID of this context.
+ */
+ XID id;
+
+ /*
+ ** The XID of the shareList context.
+ */
+ XID share_id;
+
+ /*
+ ** Visual id.
+ */
+ VisualID vid;
+
+ /*
+ ** screen number.
+ */
+ GLint screen;
+
+ /*
+ ** Whether this context's ID still exists.
+ */
+ GLboolean idExists;
+
+ /*
+ ** Whether this context is current for some client.
+ */
+ GLboolean isCurrent;
+
+ /*
+ ** Whether this context is a direct rendering context.
+ */
+ GLboolean isDirect;
+
+ /*
+ ** Window pending state
+ */
+ GLuint pendingState;
+
+ /*
+ ** This flag keeps track of whether there are unflushed GL commands.
+ */
+ GLboolean hasUnflushedCommands;
+
+ /*
+ ** Current rendering mode for this context.
+ */
+ GLenum renderMode;
+
+ /*
+ ** Buffers for feedback and selection.
+ */
+ GLfloat *feedbackBuf;
+ GLint feedbackBufSize; /* number of elements allocated */
+ GLuint *selectBuf;
+ GLint selectBufSize; /* number of elements allocated */
+
+ /*
+ ** Set only if current drawable is a glx pixmap.
+ */
+ __GLXpixmap *pGlxPixmap;
+
+ /*
+ ** The drawable private this context is bound to
+ */
+ __GLXdrawablePrivate *glxPriv;
+};
+
+/* pending state defines */
+#define __GLX_PENDING_RESIZE 0x1
+#define __GLX_PENDING_DESTROY 0x2
+#define __GLX_PENDING_SWAP 0x4
+
+#endif /* !__GLX_context_h__ */
diff --git a/xc/programs/Xserver/GL/glx/glxdrawable.h b/xc/programs/Xserver/GL/glx/glxdrawable.h
new file mode 100644
index 000000000..89fe4dbcb
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxdrawable.h
@@ -0,0 +1,89 @@
+#ifndef _GLX_drawable_h_
+#define _GLX_drawable_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+typedef struct {
+
+ DrawablePtr pDraw;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXscreenInfo *pGlxScreen;
+ ScreenPtr pScreen;
+ Bool idExists;
+ int refcnt;
+
+} __GLXpixmap;
+
+struct __GLXdrawablePrivateRec {
+ /*
+ ** list of drawable private structs
+ */
+ struct __GLXdrawablePrivateRec *last;
+ struct __GLXdrawablePrivateRec *next;
+
+ DrawablePtr pDraw;
+ XID drawId;
+ __GLXpixmap *pGlxPixmap;
+
+ /*
+ ** Either DRAWABLE_PIXMAP or DRAWABLE_WINDOW, copied from pDraw above.
+ ** Needed by the resource freer because pDraw might already have been
+ ** freed.
+ */
+ int type;
+
+ /*
+ ** Configuration of the visual to which this drawable was created.
+ */
+ __GLXvisualConfig *pGlxVisual;
+
+ /*
+ ** cached drawable size and origin
+ */
+ GLint xorigin, yorigin;
+ GLint width, height;
+
+ /*
+ ** list of contexts bound to this drawable
+ */
+ struct __GLXcontextRec *glxc;
+
+ /*
+ ** "methods" that the drawble should be able to respond to.
+ */
+ void (*freeBuffers)(struct __GLXdrawablePrivateRec *);
+ void (*updatePalette)(struct __GLXdrawablePrivateRec *);
+ GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *);
+
+ /*
+ ** The GL drawable (information shared between GLX and the GL core
+ */
+ __GLdrawablePrivate glPriv;
+
+ /*
+ ** reference count
+ */
+ int refCount;
+};
+
+#endif /* !__GLX_drawable_h__ */
diff --git a/xc/programs/Xserver/GL/glx/glxerror.h b/xc/programs/Xserver/GL/glx/glxerror.h
new file mode 100644
index 000000000..d6adf95a6
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxerror.h
@@ -0,0 +1,40 @@
+#ifndef _GLX_error_h_
+#define _GLX_error_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** Error codes. These have the extension error base added to them
+** when the extension initializes.
+*/
+extern int __glXBadContext;
+extern int __glXBadContextState;
+extern int __glXBadDrawable;
+extern int __glXBadPixmap;
+extern int __glXBadCurrentWindow;
+extern int __glXBadContextTag;
+extern int __glXBadRenderRequest;
+extern int __glXBadLargeRequest;
+extern int __glXUnsupportedPrivateRequest;
+
+#endif
diff --git a/xc/programs/Xserver/GL/glx/glxext.c b/xc/programs/Xserver/GL/glx/glxext.c
new file mode 100644
index 000000000..bc09e1c53
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxext.c
@@ -0,0 +1,491 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.4 1999/06/14 07:31:26 dawes Exp $
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include <windowstr.h>
+#include <propertyst.h>
+#include <os.h>
+#include "g_disptab.h"
+#include "unpack.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "micmap.h"
+
+
+extern __GLXextensionInfo __glDDXExtensionInfo;
+
+__GLXextensionInfo *__glXExt = &__glDDXExtensionInfo;
+
+/*
+** Forward declarations.
+*/
+static int __glXSwapDispatch(ClientPtr);
+static int __glXDispatch(ClientPtr);
+
+/*
+** Called when the extension is reset.
+*/
+static void ResetExtension(ExtensionEntry* extEntry)
+{
+ __glXFlushContextCache();
+ (*__glXExt->resetExtension)();
+}
+
+/*
+** Initialize the per-client context storage.
+*/
+static void ResetClientState(int clientIndex)
+{
+ __GLXclientState *cl = __glXClients[clientIndex];
+
+ if (cl->returnBuf) __glXFree(cl->returnBuf);
+ if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
+ if (cl->currentContexts) __glXFree(cl->currentContexts);
+ __glXMemset(cl, 0, sizeof(__GLXclientState));
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+
+}
+
+/*
+** Reset state used to keep track of large (multi-request) commands.
+*/
+void __glXResetLargeCommandStatus(__GLXclientState *cl)
+{
+ cl->largeCmdBytesSoFar = 0;
+ cl->largeCmdBytesTotal = 0;
+ cl->largeCmdRequestsSoFar = 0;
+ cl->largeCmdRequestsTotal = 0;
+}
+
+/*
+** This procedure is called when the client who created the context goes
+** away OR when glXDestroyContext is called. In either case, all we do is
+** flag that the ID is no longer valid, and (maybe) free the context.
+** use.
+*/
+static int ContextGone(__GLXcontext* cx, XID id)
+{
+ cx->idExists = GL_FALSE;
+ if (!cx->isCurrent) {
+ __glXFreeContext(cx);
+ }
+
+ return True;
+}
+
+/*
+** Free a client's state.
+*/
+static int ClientGone(int clientIndex, XID id)
+{
+ __GLXcontext *cx;
+ __GLXclientState *cl = __glXClients[clientIndex];
+ int i;
+
+ if (cl) {
+ /*
+ ** Free all the contexts that are current for this client.
+ */
+ for (i=0; i < cl->numCurrentContexts; i++) {
+ cx = cl->currentContexts[i];
+ if (cx) {
+ __glXDeassociateContext(cx, cx->glxPriv);
+ cx->isCurrent = GL_FALSE;
+ if (!cx->idExists) {
+ __glXFreeContext(cx);
+ }
+ }
+ }
+ /*
+ ** Re-initialize the client state structure. Don't free it because
+ ** we'll probably get another client with this index and use the struct
+ ** again. There is a maximum of MAXCLIENTS of these structures.
+ */
+ ResetClientState(clientIndex);
+ }
+
+ return True;
+}
+
+/*
+** Free a GLX Pixmap.
+*/
+static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
+{
+ PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
+
+ pGlxPixmap->idExists = False;
+ if (!pGlxPixmap->refcnt) {
+ /*
+ ** The DestroyPixmap routine should decrement the refcount and free
+ ** only if it's zero.
+ */
+ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
+ __glXFree(pGlxPixmap);
+ }
+
+ return True;
+}
+
+/*
+** Free a context.
+*/
+GLboolean __glXFreeContext(__GLXcontext *cx)
+{
+ if (cx->idExists || cx->isCurrent) return GL_FALSE;
+
+ if (!cx->isDirect) {
+ if ((*cx->gc->exports.destroyContext)((__GLcontext *)cx->gc) == GL_FALSE) {
+ return GL_FALSE;
+ }
+ }
+ if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
+ if (cx->selectBuf) __glXFree(cx->selectBuf);
+ __glXFree(cx);
+ if (cx == __glXLastContext) {
+ __glXFlushContextCache();
+ }
+
+ return GL_TRUE;
+}
+
+/************************************************************************/
+
+/*
+** These routines can be used to check whether a particular GL command
+** has caused an error. Specifically, we use them to check whether a
+** given query has caused an error, in which case a zero-length data
+** reply is sent to the client.
+*/
+
+static GLboolean errorOccured = GL_FALSE;
+
+/*
+** The GL was will call this routine if an error occurs.
+*/
+void __glXErrorCallBack(__GLinterface *gc, GLenum code)
+{
+ errorOccured = GL_TRUE;
+}
+
+/*
+** Clear the error flag before calling the GL command.
+*/
+void __glXClearErrorOccured(void)
+{
+ errorOccured = GL_FALSE;
+}
+
+/*
+** Check if the GL command caused an error.
+*/
+GLboolean __glXErrorOccured(void)
+{
+ return errorOccured;
+}
+
+/************************************************************************/
+
+/*
+** Initialize the GLX extension.
+*/
+void GlxExtensionInit(void)
+{
+ ExtensionEntry *extEntry, *AddExtension();
+ int i;
+
+#ifdef X11R5
+ __glXContextRes = CreateNewResourceType(ContextGone);
+ __glXClientRes = CreateNewResourceType(ClientGone);
+ __glXPixmapRes = CreateNewResourceType(PixmapGone);
+#else
+ __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
+ __glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
+ __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
+#endif
+
+ /*
+ ** Add extension to server extensions.
+ */
+ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
+ __GLX_NUMBER_ERRORS, __glXDispatch,
+ __glXSwapDispatch, ResetExtension,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
+ }
+ if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
+ }
+
+ __glXBadContext = extEntry->errorBase + GLXBadContext;
+ __glXBadContextState = extEntry->errorBase + GLXBadContextState;
+ __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
+ __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
+ __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
+ __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
+ __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
+ __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
+ __glXUnsupportedPrivateRequest = extEntry->errorBase +
+ GLXUnsupportedPrivateRequest;
+
+ /*
+ ** Initialize table of client state. There is never a client 0.
+ */
+ for (i=1; i <= MAXCLIENTS; i++) {
+ __glXClients[i] = 0;
+ }
+
+ /*
+ ** Initialize screen specific data.
+ */
+ __glXScreenInit(screenInfo.numScreens);
+}
+
+/************************************************************************/
+
+Bool __glXCoreType(void)
+{
+ return __glXExt->type;
+}
+
+/************************************************************************/
+
+void GlxSetVisualConfigs(int nconfigs,
+ __GLXvisualConfig *configs, void **privates)
+{
+ (*__glXExt->setVisualConfigs)(nconfigs, configs, privates);
+}
+
+static miInitVisualsProcPtr saveInitVisualsProc;
+
+Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp,
+ int *rootDepthp, VisualID *defaultVisp,
+ unsigned long sizes, int bitsPerRGB,
+ int preferredVis)
+{
+ Bool ret;
+
+ if (saveInitVisualsProc) {
+ ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
+ rootDepthp, defaultVisp, sizes, bitsPerRGB,
+ preferredVis);
+ if (!ret)
+ return False;
+ }
+ (*__glXExt->initVisuals)(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB);
+ return True;
+}
+
+void
+GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
+{
+ saveInitVisualsProc = *initVisProc;
+ *initVisProc = GlxInitVisuals;
+}
+
+/************************************************************************/
+
+void __glXFlushContextCache(void)
+{
+ __glXLastContext = 0;
+}
+
+/*
+** Make a context the current one for the GL (in this implementation, there
+** is only one instance of the GL, and we use it to serve all GL clients by
+** switching it between different contexts). While we are at it, look up
+** a context by its tag and return its (__GLXcontext *).
+*/
+__GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
+ int *error)
+{
+ __GLXcontext *cx;
+
+ /*
+ ** See if the context tag is legal; it is managed by the extension,
+ ** so if it's invalid, we have an implementation error.
+ */
+ cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag);
+ if (!cx) {
+ cl->client->errorValue = tag;
+ *error = __glXBadContextTag;
+ return 0;
+ }
+
+ if (!cx->isDirect) {
+ if (cx->glxPriv == NULL) {
+ /*
+ ** The drawable has vanished. It must be a window, because only
+ ** windows can be destroyed from under us; GLX pixmaps are
+ ** refcounted and don't go away until no one is using them.
+ */
+ *error = __glXBadCurrentWindow;
+ return 0;
+ }
+ }
+
+ if (cx == __glXLastContext) {
+ /* No need to re-bind */
+ return cx;
+ }
+
+ /* Make this context the current one for the GL. */
+ if (!cx->isDirect) {
+ if (!(*cx->gc->exports.forceCurrent)((__GLcontext *)cx->gc)) {
+ /* Bind failed, and set the error code. Bummer */
+ cl->client->errorValue = cx->id;
+ *error = __glXBadContextState;
+ return 0;
+ }
+ }
+ __glXLastContext = cx;
+ return cx;
+}
+
+/************************************************************************/
+
+/*
+** Top level dispatcher; all commands are executed from here down.
+*/
+static int __glXDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc)(__GLXclientState *cl, GLbyte *pc);
+ __GLXcontext *cx;
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+ __glXMemset(cl, 0, sizeof(__GLXclientState));
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+ if (!AddResource( xid, __glXClientRes, (pointer)client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** If we're expecting a glXRenderLarge request, this better be one.
+ */
+ if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) {
+ client->errorValue = stuff->glxCode;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSingleTable[opcode];
+ return (*proc)(cl, (GLbyte *) stuff);
+}
+
+static int __glXSwapDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc)(__GLXclientState *cl, GLbyte *pc);
+ __GLXcontext *cx;
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+ __glXMemset(cl, 0, sizeof(__GLXclientState));
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+ if (!AddResource( xid, __glXClientRes, (pointer)client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSwapSingleTable[opcode];
+ return (*proc)(cl, (GLbyte *) stuff);
+}
+
+int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
+{
+ return BadRequest;
+}
+
+void __glXNoSuchRenderOpcode(GLbyte *pc)
+{
+ return;
+}
+
diff --git a/xc/programs/Xserver/GL/glx/glxext.h b/xc/programs/Xserver/GL/glx/glxext.h
new file mode 100644
index 000000000..543eefcd6
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxext.h
@@ -0,0 +1,79 @@
+#ifndef _glxext_h_
+#define _glxext_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.3 1999/06/14 07:31:27 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+typedef struct {
+ int type;
+ void (*resetExtension)(void);
+ Bool (*initVisuals)(
+ VisualPtr * visualp,
+ DepthPtr * depthp,
+ int * nvisualp,
+ int * ndepthp,
+ int * rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB
+ );
+ void (*setVisualConfigs)(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **privates
+ );
+} __GLXextensionInfo;
+
+extern GLboolean __glXFreeContext(__GLXcontext *glxc);
+extern void __glXFlushContextCache(void);
+
+extern void __glXNoSuchRenderOpcode(GLbyte*);
+extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*);
+extern void __glXErrorCallBack(__GLinterface *gc, GLenum code);
+extern void __glXClearErrorOccured(void);
+extern GLboolean __glXErrorOccured(void);
+extern void __glXResetLargeCommandStatus(__GLXclientState*);
+
+extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc);
+
+extern Bool __glXCoreType(void);
+extern void GlxExtensionInit(void);
+extern void GlxSetVisualConfigs(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **privates
+);
+extern int GlxInitVisuals(
+ VisualPtr * visualp,
+ DepthPtr * depthp,
+ int * nvisualp,
+ int * ndepthp,
+ int * rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB,
+ int preferredVis
+);
+
+#endif /* _glxext_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glxfb.c b/xc/programs/Xserver/GL/glx/glxfb.c
new file mode 100644
index 000000000..67ea31434
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxfb.c
@@ -0,0 +1,165 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.2 1999/06/14 07:31:27 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** An implementation of a buffer which is part of the front buffer
+*/
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxfb.h"
+
+#include <gcstruct.h>
+
+/* can't include glmath.h */
+extern GLuint __glFloorLog2(GLuint);
+
+typedef struct __GLFBbufferInfoRec {
+ GCPtr pGC;
+} __GLFBbufferInfo;
+
+extern PixmapPtr __glXPrivPixGetPtr(__GLdrawableBuffer *);
+
+/* ---------------------------------------------------------- */
+
+static GLboolean
+Resize(__GLdrawableBuffer *buf,
+ GLint x, GLint y, GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv, GLuint bufferMask)
+{
+ buf->width = width;
+ buf->height = height;
+ buf->byteWidth = width * buf->elementSize;
+ buf->outerWidth = width;
+
+ return GL_TRUE;
+}
+
+static void
+Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+static void
+Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+/*
+** Do a swap buffer with
+** a memory surface as a back buffer
+** a FB surface as a front buffer
+*/
+GLboolean
+__glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ __GLdrawableBuffer *front = &glPriv->frontBuffer;
+ __GLdrawableBuffer *back = &glPriv->backBuffer;
+ __GLFBbufferInfo *bufferInfo;
+ GCPtr pGC;
+ GLint width, height, depth, pad;
+ GLubyte *buf;
+
+ bufferInfo = (__GLFBbufferInfo *) front->other;
+ pGC = bufferInfo->pGC;
+
+ width = back->width;
+ height = back->height;
+ depth = back->depth;
+ buf = back->base;
+ pad = back->outerWidth - back->width; /* back buffer padding */
+ /* adjust buffer padding. X wants left, GL has right */
+ buf -= pad;
+
+ ValidateGC(glxPriv->pDraw, pGC);
+ (*pGC->ops->PutImage)(glxPriv->pDraw, pGC,
+ depth,
+ 0, 0, width, height,
+ pad, ZPixmap,
+ (char *)buf);
+
+ return GL_TRUE;
+}
+
+static void
+Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+ __GLFBbufferInfo *bufferInfo;
+
+ bufferInfo = (__GLFBbufferInfo *) buf->other;
+
+ if (bufferInfo->pGC) {
+ FreeScratchGC(bufferInfo->pGC);
+ }
+
+ __glXFree(bufferInfo);
+ buf->other = NULL;
+}
+
+/*
+** function to return the X GC of this buffer (to be used by DDX)
+*/
+GCPtr __glXFBGetGC(__GLdrawableBuffer *buf)
+{
+ __GLFBbufferInfo *bufferInfo;
+
+ bufferInfo = (__GLFBbufferInfo *) buf->other;
+
+ if (bufferInfo) {
+ return bufferInfo->pGC;
+ } else {
+ return NULL;
+ }
+}
+
+
+void
+__glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
+{
+ __GLFBbufferInfo *bufferInfo;
+ __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *) glPriv->other;
+ GCPtr pGC;
+
+ buf->depth = bits;
+ buf->width = buf->height = 0; /* to be filled during Update */
+ buf->handle = buf->base = NULL; /* to be filled during Update */
+ buf->size = 0;
+ buf->byteWidth = 0;
+ buf->elementSize = ((bits-1) / 8) + 1;
+ buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
+
+ buf->resize = Resize;
+ buf->lock = Lock;
+ buf->unlock = Unlock;
+ buf->fill = NULL;
+ buf->free = Free;
+
+ /* allocate local information */
+ bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo));
+ buf->other = (void *) bufferInfo;
+
+ pGC = CreateScratchGC(glxPriv->pDraw->pScreen,
+ glxPriv->pDraw->depth);
+ bufferInfo->pGC = pGC;
+ (*pGC->funcs->ChangeClip)(pGC, CT_NONE, NULL, 0);
+}
diff --git a/xc/programs/Xserver/GL/glx/glxfb.h b/xc/programs/Xserver/GL/glx/glxfb.h
new file mode 100644
index 000000000..9b6022591
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxfb.h
@@ -0,0 +1,34 @@
+#ifndef _glxfb_h_
+#define _glxfb_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
+ GLint bits);
+
+extern GCPtr __glXFBGetGC(__GLdrawableBuffer *buf);
+
+extern GLboolean __glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv);
+
+#endif /* _glxfb_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glximports.c b/xc/programs/Xserver/GL/glx/glximports.c
new file mode 100644
index 000000000..2dc836571
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glximports.c
@@ -0,0 +1,151 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include "glxserver.h"
+#include "glxcontext.h"
+#include "glximports.h"
+
+void *__glXImpMalloc(__GLcontext *gc, size_t size)
+{
+ void *addr;
+
+ if (size == 0) {
+ return NULL;
+ }
+ addr = xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ return addr;
+}
+
+void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize)
+{
+ void *addr;
+ size_t size;
+
+ if ((numElements == 0) || (elementSize == 0)) {
+ return NULL;
+ }
+ size = numElements * elementSize;
+ addr = xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ /* zero out memory */
+ __glXMemset(addr, 0, size);
+
+ return addr;
+}
+
+void __glXImpFree(__GLcontext *gc, void *addr)
+{
+ if (addr) {
+ xfree(addr);
+ }
+}
+
+void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize)
+{
+ void *newAddr;
+
+ if (addr) {
+ if (newSize == 0) {
+ xfree(addr);
+ return NULL;
+ }
+ newAddr = xrealloc(addr, newSize);
+ } else {
+ if (newSize == 0) {
+ return NULL;
+ }
+ newAddr = xalloc(newSize);
+ }
+ if (newAddr == NULL) {
+ return NULL; /* XXX: out of memory error */
+ }
+
+ return newAddr;
+}
+
+void __glXImpWarning(__GLcontext *gc, char *msg)
+{
+ ErrorF((char *)msg);
+}
+
+void __glXImpFatal(__GLcontext *gc, char *msg)
+{
+ ErrorF((char *)msg);
+ __glXAbort();
+}
+
+char *__glXImpGetenv(__GLcontext *gc, const char *var)
+{
+ return __glXGetenv(var);
+}
+
+int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ /* have to deal with var args */
+ va_start(ap, fmt);
+ ret = __glXVsprintf(str, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
+void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode)
+{
+ return (void *) __glXFopen(path, mode);
+}
+
+int __glXImpFclose(__GLcontext *gc, void *stream)
+{
+ return __glXFclose((FILE *)stream);
+}
+
+int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ /* have to deal with var args */
+ va_start(ap, fmt);
+ ret = __glXVfprintf((FILE *)stream, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
+
+__GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc)
+{
+ __GLinterface *glci = (__GLinterface *) gc;
+ __GLXcontext *glrc = (__GLXcontext *) glci->imports.other;
+
+ return &glrc->glxPriv->glPriv;
+}
diff --git a/xc/programs/Xserver/GL/glx/glximports.h b/xc/programs/Xserver/GL/glx/glximports.h
new file mode 100644
index 000000000..b6a1580c7
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glximports.h
@@ -0,0 +1,46 @@
+#ifndef _glximports_h_
+#define _glximports_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void *__glXImpMalloc(__GLcontext *gc, size_t size);
+extern void *__glXImpCalloc(__GLcontext *gc, size_t nElem, size_t eSize);
+extern void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize);
+extern void __glXImpFree(__GLcontext *gc, void *addr);
+
+extern void __glXImpWarning(__GLcontext *gc, char *msg);
+extern void __glXImpFatal(__GLcontext *gc, char *msg);
+
+extern char *__glXImpGetenv(__GLcontext *gc, const char *var);
+extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...);
+extern void *__glXImpFopen(__GLcontext *gc, const char *path,
+ const char *mode);
+extern int __glXImpFclose(__GLcontext *gc, void *stream);
+extern int __glXImpFprintf(__GLcontext *gc, void *stream,
+ const char *fmt, ...);
+
+extern __GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc);
+
+
+#endif /* _glximports_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glxmem.c b/xc/programs/Xserver/GL/glx/glxmem.c
new file mode 100644
index 000000000..52a60f848
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxmem.c
@@ -0,0 +1,134 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** Implementation of a buffer in main memory
+*/
+
+#include "glxserver.h"
+#include "glxmem.h"
+#include "glxext.h"
+#include "GL/internal/glcore.h"
+
+/* don't want to include glmath.h */
+extern GLuint __glFloorLog2(GLuint);
+
+/* ---------------------------------------------------------- */
+
+#define BUF_ALIGN 32 /* x86 cache alignment (used for assembly paths) */
+#define BUF_ALIGN_MASK (BUF_ALIGN-1)
+
+static GLboolean
+Resize(__GLdrawableBuffer *buf,
+ GLint x, GLint y, GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv, GLuint bufferMask)
+{
+ __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *) glPriv->other;
+ GLuint newSize;
+ void *ubase;
+ GLint pixelWidth;
+ GLint alignedWidth;
+
+ /*
+ ** Note:
+ ** buf->handle : unaligned base
+ ** buf->base : aligned base
+ */
+
+ pixelWidth = BUF_ALIGN / buf->elementSize;
+ alignedWidth = (width & ~(pixelWidth-1)) + pixelWidth;
+
+ newSize = alignedWidth * height * buf->elementSize;
+
+ /*
+ ** Only allocate buffer space for the SGI core.
+ ** Mesa handles its own buffer allocations.
+ */
+#if defined(__GL_BUFFER_SIZE_TRACKS_WINDOW)
+ if (__glXCoreType() == GL_CORE_SGI) {
+#else
+ if (newSize > buf->size && __glXCoreType() == GL_CORE_SGI) {
+#endif
+ if (buf->handle) {
+ ubase = (*glPriv->realloc)(buf->handle, newSize + BUF_ALIGN_MASK);
+ if (ubase == NULL) {
+ return GL_FALSE;
+ }
+ } else {
+ ubase = (*glPriv->malloc)(newSize + BUF_ALIGN_MASK);
+ if (ubase == NULL) {
+ return GL_FALSE;
+ }
+ }
+ buf->size = newSize;
+
+ buf->handle = ubase;
+ buf->base = (void *)(((size_t)ubase + BUF_ALIGN_MASK) &
+ (unsigned int) ~BUF_ALIGN_MASK);
+ assert(((size_t)buf->base % BUF_ALIGN) == 0);
+ }
+
+ buf->width = width;
+ buf->height = height;
+ buf->byteWidth = alignedWidth * buf->elementSize;
+ buf->outerWidth = alignedWidth;
+
+ return GL_TRUE;
+}
+
+static void
+Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+static void
+Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+static void
+Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+ if (buf->handle) {
+ (*glPriv->free)(buf->handle);
+ buf->handle = NULL;
+ }
+}
+
+
+void
+__glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
+{
+ buf->width = buf->height = 0; /* to be filled during Update */
+ buf->depth = bits;
+ buf->size = 0;
+ buf->handle = buf->base = NULL; /* to be filled during Update */
+ buf->byteWidth = 0;
+ buf->elementSize = ((bits - 1) / 8) + 1;
+ buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
+
+ buf->resize = Resize;
+ buf->lock = Lock;
+ buf->unlock = Unlock;
+ buf->fill = NULL;
+ buf->free = Free;
+}
diff --git a/xc/programs/Xserver/GL/glx/glxmem.h b/xc/programs/Xserver/GL/glx/glxmem.h
new file mode 100644
index 000000000..1c208a2f5
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxmem.h
@@ -0,0 +1,30 @@
+#ifndef _glxmem_h_
+#define _glxmem_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
+ GLint bits);
+
+#endif /* _glxmem_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glxpix.c b/xc/programs/Xserver/GL/glx/glxpix.c
new file mode 100644
index 000000000..1383263bd
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxpix.c
@@ -0,0 +1,114 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.2 1999/06/14 07:31:31 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** An implementation of a glx pixmap buffer
+*/
+
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxpix.h"
+
+#include <gcstruct.h>
+
+/* don't want to include glmath.h */
+extern GLuint __glFloorLog2(GLuint);
+
+typedef struct __GLPixBufferInfoRec {
+ GCPtr pGC;
+} __GLPixBufferInfo;
+
+/* ---------------------------------------------------------- */
+
+static GLboolean
+Resize(__GLdrawableBuffer *buf,
+ GLint x, GLint y, GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv, GLuint bufferMask)
+{
+ buf->width = width;
+ buf->height = width;
+ buf->byteWidth = width * buf->elementSize;
+ buf->outerWidth = width;
+
+ return GL_TRUE;
+}
+
+static void
+Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+static void
+Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+}
+
+static void
+Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
+{
+ __GLPixBufferInfo *bufferInfo;
+
+ if (LookupIDByType((XID)buf->handle, __glXPixmapRes)) {
+ FreeResource((XID)buf->handle, FALSE);
+ buf->handle = NULL;
+ }
+
+ bufferInfo = (__GLPixBufferInfo *) buf->other;
+
+ if (bufferInfo->pGC) {
+ FreeScratchGC(bufferInfo->pGC);
+ }
+
+ __glXFree(bufferInfo);
+ buf->other = NULL;
+}
+
+void
+__glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
+ GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap)
+{
+ __GLPixBufferInfo *bufferInfo;
+
+ buf->width = buf->height = 0; /* to be filled during Update */
+ buf->depth = bits;
+ buf->size = 0;
+ buf->base = NULL;
+ buf->byteWidth = 0;
+ buf->elementSize = ((bits-1) / 8) + 1;
+ buf->elementSizeLog2 = __glFloorLog2(buf->elementSize);
+
+ buf->handle = (void *) glxpixmapId;
+ pGlxPixmap->refcnt++;
+
+ buf->resize = Resize;
+ buf->lock = Lock;
+ buf->unlock = Unlock;
+ buf->fill = NULL;
+ buf->free = Free;
+
+ /* allocate local information */
+ bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo));
+ buf->other = (void *) bufferInfo;
+
+ bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen,
+ pGlxPixmap->pDraw->depth);
+}
diff --git a/xc/programs/Xserver/GL/glx/glxpix.h b/xc/programs/Xserver/GL/glx/glxpix.h
new file mode 100644
index 000000000..09a33a80a
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxpix.h
@@ -0,0 +1,30 @@
+#ifndef _glxpix_h_
+#define _glxpix_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
+ GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap);
+
+#endif /* _glxpix_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c
new file mode 100644
index 000000000..d10696847
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxscreens.c
@@ -0,0 +1,266 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.2 1999/06/14 07:31:32 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include <string.h>
+#include <signal.h>
+#include <windowstr.h>
+
+#include "glxserver.h"
+#include "glxutil.h"
+
+/*
+** We have made the simplifying assuption that the same extensions are
+** supported across all screens in a multi-screen system.
+*/
+static char GLXServerVendorName[] = "SGI";
+static char GLXServerVersion[] = "1.2";
+static char GLXServerExtensions[] =
+ "GLX_EXT_visual_info "
+ "GLX_EXT_visual_rating "
+ "GLX_EXT_import_context ";
+
+/*
+** This comes from the GL library that the server will link with. Right
+** now, that is the DDX Sample OpenGL.
+*/
+extern __GLXscreenInfo __glDDXScreenInfo;
+
+__GLXscreenInfo *__glXScreens[] = {
+ &__glDDXScreenInfo,
+};
+
+GLint __glXNumStaticScreens = (sizeof __glXScreens / sizeof __glXScreens[0]);
+
+__GLXscreenInfo *__glXActiveScreens;
+GLint __glXNumActiveScreens;
+
+RESTYPE __glXDrawableRes;
+
+static int
+CountBits(unsigned long mask)
+{
+ int count = 0;
+
+ while(mask) {
+ count += (mask&1);
+ mask >>= 1;
+ }
+
+ return count;
+}
+
+/*
+** A typical implementation would not probably not run through the screen's
+** visuals to find ones that match the visual configs supplied by the DDX
+** Sample OpenGL as we do here; we have done this to make this code easy to
+** drop into an existing X server.
+*/
+static int matchVisuals(__GLXvisualConfig *pGlxVisual, int numVisuals,
+ int screen)
+{
+ int i, j;
+ __GLXvisualConfig *pvis = pGlxVisual;
+ ScreenPtr pScreen = screenInfo.screens[screen];
+ VisualPtr pVisual;
+ int numMatchingVisuals = 0;
+ int *used;
+
+ used = (int *)__glXMalloc(pScreen->numVisuals*sizeof(int));
+ __glXMemset(used, 0, pScreen->numVisuals*sizeof(int));
+
+ for (i=0; i < numVisuals; i++, pvis++) {
+ /*
+ ** Look through all the server's visuals to see which match.
+ */
+ pvis->vid = 0;
+ pVisual = pScreen->visuals;
+ for (j=0; j < pScreen->numVisuals; j++, pVisual++) {
+ if (pvis->class == pVisual->class &&
+ pvis->bufferSize == pVisual->nplanes &&
+ !used[j]) {
+ int rBits, gBits, bBits, aBits;
+
+ /* count bits per rgb */
+ rBits = CountBits(pVisual->redMask);
+ gBits = CountBits(pVisual->greenMask);
+ bBits = CountBits(pVisual->blueMask);
+ aBits = 0;
+ if ((pvis->redSize == rBits) &&
+ (pvis->greenSize == gBits) &&
+ (pvis->blueSize == bBits) &&
+ (pvis->alphaSize == aBits)) {
+ /*
+ ** We'll consider this a match.
+ */
+ pvis->vid = pVisual->vid;
+ pvis->redMask = pVisual->redMask;
+ pvis->greenMask = pVisual->greenMask;
+ pvis->blueMask = pVisual->blueMask;
+ pvis->alphaMask = 0;
+ numMatchingVisuals++;
+ used[j] = 1;
+ break;
+ }
+ }
+ }
+ }
+ __glXFree(used);
+ return numMatchingVisuals;
+}
+
+/*
+** Destroy routine that gets called when a drawable is freed. A drawable
+** contains the ancillary buffers needed for rendering.
+*/
+static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid)
+{
+ __GLXcontext *cx, *cx1;
+
+ /*
+ ** Use glxPriv->type to figure out what kind of drawable this is. Don't
+ ** use glxPriv->pDraw->type because by the time this routine is called,
+ ** the pDraw might already have been freed.
+ */
+ if (glxPriv->type == DRAWABLE_WINDOW) {
+ /*
+ ** When a window is destroyed, notify all context bound to
+ ** it, that there are no longer bound to anything.
+ */
+ for (cx = glxPriv->glxc; cx; cx = cx1) {
+ cx1 = cx->nextPriv;
+ cx->pendingState |= __GLX_PENDING_DESTROY;
+ }
+ }
+
+ /*
+ ** set the size to 0, so that context that may still be using this
+ ** drawable not do anything harmful
+ */
+ glxPriv->xorigin = 0;
+ glxPriv->yorigin = 0;
+ glxPriv->width = 0;
+ glxPriv->height = 0;
+
+ __glXUnrefDrawablePrivate(glxPriv);
+
+ return True;
+}
+
+/*
+** This hook gets called when a window moves or changes size.
+*/
+static Bool PositionWindow(WindowPtr pWin, int x, int y)
+{
+ ScreenPtr pScreen;
+ __GLXcontext *glxc;
+ __GLXdrawablePrivate *glxPriv;
+ int i;
+ Bool ret;
+
+ /*
+ ** Call wrapped position window routine
+ */
+ pScreen = pWin->drawable.pScreen;
+ pScreen->PositionWindow =
+ __glXActiveScreens[pScreen->myNum].WrappedPositionWindow;
+ ret = (*pScreen->PositionWindow)(pWin, x, y);
+ pScreen->PositionWindow = PositionWindow;
+
+ /*
+ ** Tell all contexts rendering into this window that the window size
+ ** has changed.
+ */
+ glxPriv = (__GLXdrawablePrivate *) LookupIDByType(pWin->drawable.id,
+ __glXDrawableRes);
+ if (glxPriv == NULL) {
+ /*
+ ** This window is not being used by the OpenGL.
+ */
+ return ret;
+ }
+
+ /*
+ ** resize the drawable
+ */
+ /* first change the drawable size */
+ if (__glXResizeDrawableBuffers(glxPriv) == GL_FALSE) {
+ /* resize failed! */
+ /* XXX: what can we possibly do here? */
+ ret = False;
+ }
+ /* mark contexts as needing resize */
+ glxc = NULL;
+ for (glxc = glxPriv->glxc; glxc; glxc = glxc->nextPriv) {
+ glxc->pendingState |= __GLX_PENDING_RESIZE;
+ }
+
+ return ret;
+}
+
+/*
+** Wrap our own PositionWindow routine around the server's, so we can
+** be notified when a window changes size
+*/
+static void wrapPositionWindow(int screen)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen];
+
+ __glXActiveScreens[screen].WrappedPositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = PositionWindow;
+}
+
+void __glXScreenInit(GLint numscreens)
+{
+ GLint i,j;
+
+ /*
+ ** This alloc has to work or else the server might as well core dump.
+ */
+ __glXActiveScreens =
+ (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens);
+
+ for (i=0; i < numscreens; i++) {
+ /*
+ ** Probe each static screen to see which exists.
+ */
+ for (j=0; j < __glXNumStaticScreens; j++) {
+ if ((*__glXScreens[j]->screenProbe)(i)) {
+ __glXActiveScreens[i] = *__glXScreens[j];
+
+ __glXActiveScreens[i].numUsableVisuals =
+ matchVisuals(__glXActiveScreens[i].pGlxVisual,
+ __glXActiveScreens[i].numVisuals, i);
+ __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName);
+ __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
+ __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions);
+
+#ifdef X11R5
+ __glXDrawableRes = CreateNewResourceType(DrawableGone);
+#else
+ __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
+#endif
+ wrapPositionWindow(i);
+ }
+ }
+ }
+ __glXNumActiveScreens = numscreens;
+}
diff --git a/xc/programs/Xserver/GL/glx/glxscreens.h b/xc/programs/Xserver/GL/glx/glxscreens.h
new file mode 100644
index 000000000..771ecf866
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxscreens.h
@@ -0,0 +1,75 @@
+#ifndef _GLX_screens_h_
+#define _GLX_screens_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include "GL/internal/glcore.h"
+
+/*
+** Screen dependent data. These methods are the interface between the DIX
+** and DDX layers of the GLX server extension. The methods provide an
+** interface for context management on a screen.
+*/
+typedef struct {
+ /*
+ ** Probe the screen and see if it supports GL rendering. It will
+ ** return GL_FALSE if it doesn't, GL_TRUE otherwise.
+ */
+ Bool (*screenProbe)(int screen);
+
+ /*
+ ** Create a context using configuration information from modes.
+ ** Use imports as callbacks back to the OS. Return an opaque handle
+ ** on the context (NULL if failure).
+ */
+ __GLinterface *(*createContext)(__GLimports *imports,
+ __GLcontextModes *modes,
+ __GLinterface *shareGC);
+
+ /*
+ ** Create a buffer using information from glxPriv. This routine
+ ** sets up any wrappers necessary to resize, swap or destroy the
+ ** buffer.
+ */
+ void (*createBuffer)(__GLXdrawablePrivate *glxPriv);
+
+ __GLXvisualConfig *pGlxVisual;
+ void **pVisualPriv;
+ GLint numVisuals;
+ GLint numUsableVisuals;
+
+ char *GLXvendor;
+ char *GLXversion;
+ char *GLXextensions;
+
+ /*
+ ** Things that are not statically set.
+ */
+ Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y);
+
+} __GLXscreenInfo;
+
+
+extern void __glXScreenInit(GLint);
+
+#endif /* !__GLX_screens_h__ */
diff --git a/xc/programs/Xserver/GL/glx/glxserver.h b/xc/programs/Xserver/GL/glx/glxserver.h
new file mode 100644
index 000000000..80a23ce1a
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxserver.h
@@ -0,0 +1,251 @@
+#ifndef _GLX_server_h_
+#define _GLX_server_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xmd.h>
+#include <misc.h>
+#include <dixstruct.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+#include <extnsionst.h>
+#include <resource.h>
+#include <scrnintstr.h>
+#include "GL/glx_ansic.h"
+
+
+/*
+** The X header misc.h defines these math functions.
+*/
+#undef abs
+#undef fabs
+
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <GL/glxint.h>
+
+/* For glxscreens.h */
+typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate;
+
+#include "glxscreens.h"
+#include "glxdrawable.h"
+#include "glxcontext.h"
+#include "glxerror.h"
+
+
+#define GLX_SERVER_MAJOR_VERSION 1
+#define GLX_SERVER_MINOR_VERSION 2
+
+#ifndef True
+#define True 1
+#endif
+#ifndef False
+#define False 0
+#endif
+
+/*
+** GLX resources.
+*/
+typedef XID GLXContextID;
+typedef XID GLXPixmap;
+typedef XID GLXDrawable;
+
+typedef struct __GLXcontextRec *GLXContext;
+typedef struct __GLXclientStateRec __GLXclientState;
+
+extern __GLXscreenInfo *__glXActiveScreens;
+extern GLint __glXNumActiveScreens;
+
+/************************************************************************/
+
+/*
+** The last context used (from the server's persective) is cached.
+*/
+extern __GLXcontext *__glXLastContext;
+extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
+
+/*
+** Macros to set, unset, and retrieve the flag that says whether a context
+** has unflushed commands.
+*/
+#define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
+#define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
+#define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
+
+/************************************************************************/
+
+/*
+** State kept per client.
+*/
+struct __GLXclientStateRec {
+ /*
+ ** Whether this structure is currently being used to support a client.
+ */
+ Bool inUse;
+
+ /*
+ ** Buffer for returned data.
+ */
+ GLbyte *returnBuf;
+ GLint returnBufSize;
+
+ /*
+ ** Keep track of large rendering commands, which span multiple requests.
+ */
+ GLint largeCmdBytesSoFar; /* bytes received so far */
+ GLint largeCmdBytesTotal; /* total bytes expected */
+ GLint largeCmdRequestsSoFar; /* requests received so far */
+ GLint largeCmdRequestsTotal; /* total requests expected */
+ GLbyte *largeCmdBuf;
+ GLint largeCmdBufSize;
+
+ /*
+ ** Keep a list of all the contexts that are current for this client's
+ ** threads.
+ */
+ __GLXcontext **currentContexts;
+ GLint numCurrentContexts;
+
+ /* Back pointer to X client record */
+ ClientPtr client;
+
+ int GLClientmajorVersion;
+ int GLClientminorVersion;
+ char *GLClientextensions;
+};
+
+extern __GLXclientState *__glXClients[];
+
+/************************************************************************/
+
+/*
+** Dispatch tables.
+*/
+typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
+typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
+typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
+extern __GLXdispatchRenderProcPtr __glXRenderTable[];
+extern __GLXdispatchSingleProcPtr __glXSingleTable[];
+extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
+extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
+extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
+extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
+
+/*
+ * Dispatch for GLX commands.
+ */
+typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
+extern __GLXprocPtr __glXProcTable[];
+
+/*
+ * Tables for computing the size of each rendering command.
+ */
+typedef struct {
+ int bytes;
+ int (*varsize)(GLbyte *pc, Bool swap);
+} __GLXrenderSizeData;
+extern __GLXrenderSizeData __glXRenderSizeTable[];
+extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
+
+/************************************************************************/
+
+/*
+** X resources.
+*/
+extern RESTYPE __glXContextRes;
+extern RESTYPE __glXClientRes;
+extern RESTYPE __glXPixmapRes;
+extern RESTYPE __glXDrawableRes;
+
+/************************************************************************/
+
+/*
+** Prototypes.
+*/
+
+
+extern char *__glXcombine_strings(const char *, const char *);
+
+extern void __glXDisp_DrawArrays(GLbyte*);
+extern void __glXDispSwap_DrawArrays(GLbyte*);
+
+
+/*
+** Routines for sending swapped replies.
+*/
+
+extern void __glXSwapMakeCurrentReply(ClientPtr client,
+ xGLXMakeCurrentReply *reply);
+extern void __glXSwapIsDirectReply(ClientPtr client,
+ xGLXIsDirectReply *reply);
+extern void __glXSwapQueryVersionReply(ClientPtr client,
+ xGLXQueryVersionReply *reply);
+extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
+ xGLXQueryContextInfoEXTReply *reply,
+ int *buf);
+extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply *reply, char *buf);
+extern void glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply *reply, char *buf);
+
+
+/*
+ * Routines for computing the size of variably-sized rendering commands.
+ */
+
+extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
+extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
+extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
+extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
+extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
+extern int __glXTypeSize(GLenum enm);
+extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
+extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
+
+#endif /* !__GLX_server_h__ */
diff --git a/xc/programs/Xserver/GL/glx/glxutil.c b/xc/programs/Xserver/GL/glx/glxutil.c
new file mode 100644
index 000000000..c5d33d604
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxutil.c
@@ -0,0 +1,510 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include <unpack.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxutil.h"
+#include "glxbuf.h"
+
+/************************************************************************/
+
+void __glXNop(void) {}
+
+/************************************************************************/
+
+/* Memory Allocation for GLX */
+
+void *
+__glXMalloc(size_t size)
+{
+ void *addr;
+
+ if (size == 0) {
+ return NULL;
+ }
+ addr = (void *) xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ return addr;
+}
+
+void *
+__glXCalloc(size_t numElements, size_t elementSize)
+{
+ void *addr;
+ size_t size;
+
+ if ((numElements == 0) || (elementSize == 0)) {
+ return NULL;
+ }
+ size = numElements * elementSize;
+ addr = (void *) xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ __glXMemset(addr, 0, size);
+ return addr;
+}
+
+void *
+__glXRealloc(void *addr, size_t newSize)
+{
+ void *newAddr;
+
+ if (addr) {
+ if (newSize == 0) {
+ xfree(addr);
+ return NULL;
+ } else {
+ newAddr = xrealloc(addr, newSize);
+ }
+ } else {
+ if (newSize == 0) {
+ return NULL;
+ } else {
+ newAddr = xalloc(newSize);
+ }
+ }
+ if (newAddr == NULL) {
+ return NULL; /* XXX: out of memory */
+ }
+
+ return newAddr;
+}
+
+void
+__glXFree(void *addr)
+{
+ if (addr) {
+ xfree(addr);
+ }
+}
+
+/************************************************************************/
+/* Context stuff */
+
+
+/*
+** associate a context with a drawable
+*/
+void
+__glXAssociateContext(__GLXcontext *glxc, __GLXdrawablePrivate *glxPriv)
+{
+ glxc->nextPriv = glxPriv->glxc;
+ glxPriv->glxc = glxc;
+
+ __glXRefDrawablePrivate(glxPriv);
+}
+
+/*
+** Deassociate a context from a drawable
+*/
+void
+__glXDeassociateContext(__GLXcontext *glxc, __GLXdrawablePrivate *glxPriv)
+{
+ __GLXcontext *glxc1, *glxc2;
+
+ glxc2 = NULL;
+ for (glxc1=glxPriv->glxc; glxc1; glxc2=glxc1, glxc1=glxc1->nextPriv) {
+ if (glxc1 == glxc) {
+ /* found context. Deassociate. */
+ if (glxc2 == NULL) {
+ glxPriv->glxc = glxc1->nextPriv;
+ } else {
+ glxc2->nextPriv = glxc1->nextPriv;
+ }
+ glxc1->nextPriv = NULL;
+ __glXUnrefDrawablePrivate(glxPriv);
+ break;
+ }
+ }
+}
+
+/************************************************************************/
+
+void
+__glXGetDrawableSize(__GLdrawablePrivate *glPriv,
+ GLint *x, GLint *y, GLuint *width, GLuint *height)
+{
+ __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other;
+
+ if (glxPriv) {
+ *x = glxPriv->xorigin;
+ *y = glxPriv->yorigin;
+ *width = glxPriv->width;
+ *height = glxPriv->height;
+ } else {
+ *x = *y = *width = *height = 0;
+ }
+}
+
+GLboolean
+__glXResizeDrawable(__GLdrawablePrivate *glPriv)
+{
+ /* nothing to be done here */
+ return GL_TRUE;
+}
+
+
+/************************************************************************/
+
+void
+__glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config)
+{
+ __glXMemset(modes, 0, sizeof(__GLcontextModes));
+
+ modes->rgbMode = (config->rgba != 0);
+ modes->colorIndexMode = !(modes->rgbMode);
+ modes->doubleBufferMode = (config->doubleBuffer != 0);
+ modes->stereoMode = (config->stereo != 0);
+
+ modes->haveAccumBuffer = ((config->accumRedSize +
+ config->accumGreenSize +
+ config->accumBlueSize +
+ config->accumAlphaSize) > 0);
+ modes->haveDepthBuffer = (config->depthSize > 0);
+ modes->haveStencilBuffer = (config->stencilSize > 0);
+
+ modes->redBits = config->redSize;
+ modes->greenBits = config->greenSize;
+ modes->blueBits = config->blueSize;
+ modes->alphaBits = config->alphaSize;
+ modes->redMask = config->redMask;
+ modes->greenMask = config->greenMask;
+ modes->blueMask = config->blueMask;
+ modes->alphaMask = config->alphaMask;
+ modes->rgbBits = modes->redBits + modes->greenBits +
+ modes->blueBits + modes->alphaBits;
+ modes->indexBits = config->bufferSize;
+
+ modes->accumRedBits = config->accumRedSize;
+ modes->accumGreenBits = config->accumGreenSize;
+ modes->accumBlueBits = config->accumBlueSize;
+ modes->accumAlphaBits = config->accumAlphaSize;
+ modes->depthBits = config->depthSize;
+ modes->stencilBits = config->stencilSize;
+
+ modes->numAuxBuffers = 0; /* XXX: should be picked up from the visual */
+
+ modes->level = config->level;
+}
+
+/*****************************************************************************/
+/* accessing the drawable private */
+
+static void
+LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc)
+{
+ __GLinterface *glci = (__GLinterface *) gc;
+ __GLXcontext *glxc = (__GLXcontext *) glci->imports.other;
+
+ /* quick exit test */
+ if ((glxc->pendingState &
+ (__GLX_PENDING_RESIZE |
+ __GLX_PENDING_DESTROY |
+ __GLX_PENDING_SWAP)) == 0x0)
+ return;
+
+ /* some pending state. Deal with it */
+ if (glxc->pendingState & __GLX_PENDING_RESIZE) {
+ __GLXdrawablePrivate *glxPriv = glxc->glxPriv;
+
+ glxc->pendingState &= ~__GLX_PENDING_RESIZE;
+
+ (*glci->exports.notifyResize)(gc);
+ assert((glxc->pendingState & __GLX_PENDING_RESIZE) == 0x0);
+ }
+ if (glxc->pendingState & __GLX_PENDING_DESTROY) {
+ __GLXdrawablePrivate *glxPriv = glxc->glxPriv;
+
+ glxc->pendingState &= ~__GLX_PENDING_DESTROY;
+
+ assert(glxPriv->xorigin == 0);
+ assert(glxPriv->yorigin == 0);
+ assert(glxPriv->width == 0);
+ assert(glxPriv->height == 0);
+ (*glci->exports.notifyDestroy)(gc);
+ __glXDeassociateContext(glxc, glxPriv);
+ assert((glxc->pendingState & __GLX_PENDING_DESTROY) == 0x0);
+ }
+ if (glxc->pendingState & __GLX_PENDING_SWAP) {
+
+ glxc->pendingState &= ~__GLX_PENDING_SWAP;
+
+ (*glci->exports.notifySwapBuffers)(gc);
+ assert((glxc->pendingState & __GLX_PENDING_SWAP) == 0x0);
+ }
+}
+
+static void
+UnlockDP(__GLdrawablePrivate *glPriv)
+{
+}
+
+/*****************************************************************************/
+/* Drawable private stuff */
+
+void
+__glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv)
+{
+ glxPriv->refCount++;
+}
+
+void
+__glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv)
+{
+ glxPriv->refCount--;
+ if (glxPriv->refCount == 0) {
+ __glXDestroyDrawablePrivate(glxPriv);
+ }
+}
+
+__GLXdrawablePrivate *
+__glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
+ __GLcontextModes *modes)
+{
+ __GLXdrawablePrivate *glxPriv;
+ __GLdrawablePrivate *glPriv;
+ __GLXscreenInfo *pGlxScreen;
+
+ glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv));
+ __glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
+
+ glxPriv->type = pDraw->type;
+ glxPriv->pDraw = pDraw;
+ glxPriv->drawId = drawId;
+
+ /* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */
+ glxPriv->pGlxPixmap = (__GLXpixmap *)
+ LookupIDByType(drawId, __glXPixmapRes);
+ /* since we are creating the drawablePrivate, drawId should be new */
+ if (!AddResource(drawId, __glXDrawableRes, glxPriv)) {
+ /* oops! */
+ __glXFree(glxPriv);
+ return NULL;
+ }
+
+ /* fill up glPriv */
+ glPriv = &glxPriv->glPriv;
+ glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
+ *glPriv->modes = *modes;
+ glPriv->malloc = __glXMalloc;
+ glPriv->calloc = __glXCalloc;
+ glPriv->realloc = __glXRealloc;
+ glPriv->free = __glXFree;
+ glPriv->addSwapRect = NULL;
+ glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop;
+ glPriv->lockDP = LockDP;
+ glPriv->unlockDP = UnlockDP;
+ glPriv->getDrawableSize = __glXGetDrawableSize;
+ glPriv->resize = __glXResizeDrawable;
+ glPriv->other = glxPriv;
+
+ /* allocate a one-rect ownership region */
+ glPriv->ownershipRegion.rects =
+ (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect));
+ glPriv->ownershipRegion.numRects = 1;
+
+ glxPriv->freeBuffers = __glXFreeBuffers;
+ glxPriv->updatePalette = (void (*)(__GLXdrawablePrivate *)) __glXNop;
+
+ pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
+
+ /* allocate the buffers */
+ if (glxPriv->type == DRAWABLE_WINDOW) {
+ int i;
+ VisualID vid = wVisual((WindowPtr)pDraw);
+ __GLXvisualConfig *pGlxVisual = pGlxScreen->pGlxVisual;
+
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == vid) {
+ glxPriv->pGlxVisual = pGlxVisual;
+ break;
+ }
+ }
+ __glXFBInitDrawable(glxPriv, modes);
+ } else {
+ glxPriv->pGlxVisual = glxPriv->pGlxPixmap->pGlxVisual;
+ __glXPixInitDrawable(glxPriv, modes);
+ }
+
+ /* initialize the core's private buffer information */
+ (*pGlxScreen->createBuffer)(glxPriv);
+
+ return glxPriv;
+}
+
+GLboolean
+__glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+
+ /* remove the drawable from the drawable list */
+ FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
+
+ /* Have the core free any memory it may have attached to the drawable */
+ if (glPriv->freePrivate) {
+ (*glPriv->freePrivate)(glPriv);
+ }
+
+ /* Free any framebuffer memory attached to the drawable */
+ if (glxPriv->freeBuffers) {
+ (*glxPriv->freeBuffers)(glxPriv);
+ }
+
+ /* Free the drawable Private */
+ __glXFree(glxPriv->glPriv.modes);
+ __glXFree(glxPriv->glPriv.ownershipRegion.rects);
+ __glXFree(glxPriv);
+
+ return GL_TRUE;
+}
+
+__GLXdrawablePrivate *
+__glXFindDrawablePrivate(XID drawId)
+{
+ __GLXdrawablePrivate *glxPriv;
+
+ glxPriv = (__GLXdrawablePrivate *)LookupIDByType(drawId, __glXDrawableRes);
+
+ return glxPriv;
+}
+
+__GLXdrawablePrivate *
+__glXGetDrawablePrivate(DrawablePtr pDraw, XID drawId,
+ __GLcontextModes *modes)
+{
+ __GLXdrawablePrivate *glxPriv;
+
+ glxPriv = __glXFindDrawablePrivate(drawId);
+
+ if (glxPriv == NULL) {
+ glxPriv = __glXCreateDrawablePrivate(pDraw, drawId, modes);
+ if (glxPriv) {
+ __glXRefDrawablePrivate(glxPriv);
+ }
+ }
+
+ return glxPriv;
+}
+
+void
+__glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv)
+{
+ if (glxPriv) {
+ if (glxPriv->pDraw) {
+ glxPriv->xorigin = glxPriv->pDraw->x;
+ glxPriv->yorigin = glxPriv->pDraw->y;
+ glxPriv->width = glxPriv->pDraw->width;
+ glxPriv->height = glxPriv->pDraw->height;
+ }
+ }
+}
+
+/*
+** resize/move the drawable. Called during the actual resize callback
+** to update the drawable side of the buffers
+*/
+GLboolean
+__glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ GLint x, y;
+ GLuint w, h;
+#if defined(__GL_ALIGNED_BUFFERS)
+ GLint xAlignment, yAlignment;
+ GLint xOffset, yOffset;
+ GLint xStart, xEnd;
+ GLint yStart, yEnd;
+ GLuint xAlignedMask, yAlignedMask;
+#endif
+ GLboolean status = GL_TRUE;
+
+ __glXCacheDrawableSize(glxPriv);
+
+ w = glxPriv->width;
+ h = glxPriv->height;
+ x = glxPriv->xorigin;
+ y = glxPriv->yorigin;
+
+#if defined(__GL_ALIGNED_BUFFERS)
+ xAlignment = glPriv->xAlignment;
+ yAlignment = glPriv->yAlignment;
+
+ xOffset = x & (xAlignment-1);
+ yOffset = y & (yAlignment-1);
+
+ xAlignedMask = ~(xAlignment-1);
+ yAlignedMask = ~(yAlignment-1);
+
+ xStart = x; xEnd = x+w;
+ yStart = y; yEnd = y+h;
+
+ xStart &= xAlignedMask;
+ if (xEnd & ~xAlignedMask) {
+ xEnd = (xEnd&xAlignedMask) + xAlignment;
+ }
+ yStart &= yAlignedMask;
+ if (yEnd & ~yAlignedMask) {
+ yEnd = (yEnd&yAlignedMask) + yAlignment;
+ }
+
+ x = xStart; y = yStart;
+ w = xEnd-xStart; h = yEnd-yStart;
+#endif
+
+ if ((x != glPriv->xOrigin) ||
+ (y != glPriv->yOrigin) ||
+#if defined(__GL_ALIGNED_BUFFERS)
+ (xOffset != glPriv->xOffset) ||
+ (yOffset != glPriv->yOffset) ||
+#endif
+ (w != glPriv->width) ||
+ (h != glPriv->height) ||
+ (!w && !h)) {
+ /* set up the glPriv info */
+ glPriv->width = w;
+ glPriv->height = h;
+ glPriv->xOrigin = x;
+ glPriv->yOrigin = y;
+#if defined(__GL_ALIGNED_BUFFERS)
+ glPriv->xOffset = xOffset;
+ glPriv->yOffset = yOffset;
+#endif
+
+ /* notify the buffers */
+ status = __glXResizeBuffers(glPriv, x, y, w, h);
+ }
+
+ return status;
+}
+
+/************************************************************************/
+
diff --git a/xc/programs/Xserver/GL/glx/glxutil.h b/xc/programs/Xserver/GL/glx/glxutil.h
new file mode 100644
index 000000000..d074d77ce
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/glxutil.h
@@ -0,0 +1,64 @@
+#ifndef _glxcmds_h_
+#define _glxcmds_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern void __glXNop(void);
+
+/* memory management */
+extern void *__glXMalloc(size_t size);
+extern void *__glXCalloc(size_t numElements, size_t elementSize);
+extern void *__glXRealloc(void *addr, size_t newSize);
+extern void __glXFree(void *ptr);
+
+/* relate contexts with drawables */
+extern void __glXAssociateContext(__GLXcontext *glxc, __GLXdrawablePrivate *glxPriv);
+extern void __glXDeassociateContext(__GLXcontext *glxc, __GLXdrawablePrivate *glxPriv);
+
+/* drawable operation */
+extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv,
+ GLint *x, GLint *y,
+ GLuint *width, GLuint *height);
+extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv);
+extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv);
+extern void __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config);
+
+/* drawable management */
+extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv);
+extern void __glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv);
+extern __GLXdrawablePrivate *__glXCreateDrawablePrivate(DrawablePtr pDraw,
+ XID glxpixmapId,
+ __GLcontextModes *modes);
+extern GLboolean __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv);
+extern __GLXdrawablePrivate *__glXFindDrawablePrivate(XID glxpixmapId);
+extern __GLXdrawablePrivate *__glXGetDrawablePrivate(DrawablePtr pDraw,
+ XID glxpixmapId,
+ __GLcontextModes *modes);
+extern void __glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv);
+
+/* context helper routines */
+extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
+
+
+#endif /* _glxcmds_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/impsize.h b/xc/programs/Xserver/GL/glx/impsize.h
new file mode 100644
index 000000000..597da569e
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/impsize.h
@@ -0,0 +1,53 @@
+#ifndef _impsize_h_
+#define _impsize_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** These are defined in libsampleGL.a. They are not technically part of
+** the defined interface between libdixGL.a and libsampleGL.a (that interface
+** being the functions in the __glXScreenInfo structure, plus the OpenGL API
+** itself), but we thought it was better to call these routines than to
+** replicate the code in here.
+*/
+extern int __glCallLists_size(GLsizei n, GLenum type);
+extern int __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h);
+extern int __glFogfv_size(GLenum pname);
+extern int __glFogiv_size(GLenum pname);
+extern int __glLightModelfv_size(GLenum pname);
+extern int __glLightModeliv_size(GLenum pname);
+extern int __glLightfv_size(GLenum pname);
+extern int __glLightiv_size(GLenum pname);
+extern int __glMaterialfv_size(GLenum pname);
+extern int __glMaterialiv_size(GLenum pname);
+extern int __glTexEnvfv_size(GLenum e);
+extern int __glTexEnviv_size(GLenum e);
+extern int __glTexGendv_size(GLenum e);
+extern int __glTexGenfv_size(GLenum e);
+extern int __glTexGeniv_size(GLenum pname);
+extern int __glTexParameterfv_size(GLenum e);
+extern int __glTexParameteriv_size(GLenum e);
+
+extern int __glEvalComputeK(GLenum target);
+
+#endif /* _impsize_h_ */
diff --git a/xc/programs/Xserver/GL/glx/render2.c b/xc/programs/Xserver/GL/glx/render2.c
new file mode 100644
index 000000000..01a57411d
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/render2.c
@@ -0,0 +1,224 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/* #define NEED_REPLIES */
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+extern GLint __glEvalComputeK(GLenum target);
+
+void __glXDisp_Map1f(GLbyte *pc)
+{
+ GLint order, k;
+ GLfloat u1, u2, *points;
+ GLenum target;
+
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ points = (GLfloat *)(pc + 16);
+ k = __glEvalComputeK(target);
+
+ glMap1f(target, u1, u2, k, order, points);
+}
+
+void __glXDisp_Map2f(GLbyte *pc)
+{
+ GLint uorder, vorder, ustride, vstride, k;
+ GLfloat u1, u2, v1, v2, *points;
+ GLenum target;
+
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ v1 = *(GLfloat *)(pc + 16);
+ v2 = *(GLfloat *)(pc + 20);
+ points = (GLfloat *)(pc + 28);
+
+ k = __glEvalComputeK(target);
+ ustride = vorder * k;
+ vstride = k;
+
+ glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+}
+
+void __glXDisp_Map1d(GLbyte *pc)
+{
+ GLint order, k, compsize;
+ GLenum target;
+ GLdouble u1, u2, *points;
+
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
+ k = __glEvalComputeK(target);
+ if (order < 0 || k < 0) {
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ pc += 24;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+ glMap1d(target, u1, u2, k, order, points);
+}
+
+void __glXDisp_Map2d(GLbyte *pc)
+{
+ GLdouble u1, u2, v1, v2, *points;
+ GLint uorder, vorder, ustride, vstride, k, compsize;
+ GLenum target;
+
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
+ k = __glEvalComputeK(target);
+ if (vorder < 0 || uorder < 0 || k < 0) {
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_GET_DOUBLE(v1,pc+16);
+ __GLX_GET_DOUBLE(v2,pc+24);
+ pc += 44;
+
+ ustride = vorder * k;
+ vstride = k;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+ glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+}
+
+void __glXDisp_CallLists(GLbyte *pc)
+{
+ GLenum type;
+ GLsizei n;
+
+ type = *(GLenum *)(pc + 4);
+ n = *(GLsizei *)(pc + 0);
+ glCallLists(n, type, pc + 8);
+}
+
+void __glXDisp_DrawArrays(GLbyte *pc)
+{
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysComponentHeader *compHeader;
+ GLint numVertexes = hdr->numVertexes;
+ GLint numComponents = hdr->numComponents;
+ GLenum primType = hdr->primType;
+ GLint stride = 0;
+ int i;
+
+ pc += sizeof(__GLXdispatchDrawArraysHeader);
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc;
+
+ /* compute stride (same for all component arrays) */
+ for (i = 0; i < numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+
+ stride += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ }
+
+ pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader);
+
+ /* set up component arrays */
+ for (i = 0; i < numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_NORMAL_ARRAY:
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glNormalPointer(datatype, stride, pc);
+ break;
+ case GL_COLOR_ARRAY:
+ glEnableClientState(GL_COLOR_ARRAY);
+ glColorPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_INDEX_ARRAY:
+ glEnableClientState(GL_INDEX_ARRAY);
+ glIndexPointer(datatype, stride, pc);
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ glEnableClientState(GL_EDGE_FLAG_ARRAY);
+ glEdgeFlagPointer(stride, (const GLboolean *)pc);
+ break;
+ default:
+ break;
+ }
+
+ pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ }
+
+ glDrawArrays(primType, 0, numVertexes);
+
+ /* turn off anything we might have turned on */
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_INDEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_EDGE_FLAG_ARRAY);
+}
diff --git a/xc/programs/Xserver/GL/glx/render2swap.c b/xc/programs/Xserver/GL/glx/render2swap.c
new file mode 100644
index 000000000..040a24594
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/render2swap.c
@@ -0,0 +1,365 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/* #define NEED_REPLIES */
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+extern GLint __glEvalComputeK(GLenum target);
+
+void __glXDispSwap_Map1f(GLbyte *pc)
+{
+ GLint order, k;
+ GLfloat u1, u2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ points = (GLfloat *)(pc + 16);
+ k = __glEvalComputeK(target);
+
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+ glMap1f(target, u1, u2, k, order, points);
+}
+
+void __glXDispSwap_Map2f(GLbyte *pc)
+{
+ GLint uorder, vorder, ustride, vstride, k;
+ GLfloat u1, u2, v1, v2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
+
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ v1 = *(GLfloat *)(pc + 16);
+ v2 = *(GLfloat *)(pc + 20);
+ points = (GLfloat *)(pc + 28);
+
+ k = __glEvalComputeK(target);
+ ustride = vorder * k;
+ vstride = k;
+
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+ glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+}
+
+void __glXDispSwap_Map1d(GLbyte *pc)
+{
+ GLint order, k, compsize;
+ GLenum target;
+ GLdouble u1, u2, *points;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
+ k = __glEvalComputeK(target);
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ pc += 24;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+ glMap1d(target, u1, u2, k, order, points);
+}
+
+void __glXDispSwap_Map2d(GLbyte *pc)
+{
+ GLdouble u1, u2, v1, v2, *points;
+ GLint uorder, vorder, ustride, vstride, k, compsize;
+ GLenum target;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_INT(pc + 40);
+
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
+ k = __glEvalComputeK(target);
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_GET_DOUBLE(v1,pc+16);
+ __GLX_GET_DOUBLE(v2,pc+24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ pc += 44;
+ ustride = vorder * k;
+ vstride = k;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+ glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+}
+
+void __glXDispSwap_CallLists(GLbyte *pc)
+{
+ GLenum type;
+ GLsizei n;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ type = *(GLenum *)(pc + 4);
+ n = *(GLsizei *)(pc + 0);
+
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ __GLX_SWAP_SHORT_ARRAY(pc+8, n);
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ __GLX_SWAP_INT_ARRAY(pc+8, n);
+ break;
+ case GL_FLOAT:
+ __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
+ break;
+ }
+
+ glCallLists(n, type, pc+8);
+}
+
+static void swapArray(GLint numVals, GLenum datatype,
+ GLint stride, GLint numVertexes, GLbyte *pc)
+{
+ int i,j;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ switch (datatype) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ /* don't need to swap */
+ return;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ for (i=0; i<numVertexes; i++) {
+ GLshort *pVal = (GLshort *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_SHORT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ for (i=0; i<numVertexes; i++) {
+ GLint *pVal = (GLint *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_INT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_FLOAT:
+ for (i=0; i<numVertexes; i++) {
+ GLfloat *pVal = (GLfloat *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_FLOAT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_DOUBLE:
+ for (i=0; i<numVertexes; i++) {
+ GLdouble *pVal = (GLdouble *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_DOUBLE(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+void __glXDispSwap_DrawArrays(GLbyte *pc)
+{
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysComponentHeader *compHeader;
+ GLint numVertexes = hdr->numVertexes;
+ GLint numComponents = hdr->numComponents;
+ GLenum primType = hdr->primType;
+ GLint stride = 0;
+ int i;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&numVertexes);
+ __GLX_SWAP_INT(&numComponents);
+ __GLX_SWAP_INT(&primType);
+
+ pc += sizeof(__GLXdispatchDrawArraysHeader);
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
+
+ /* compute stride (same for all component arrays) */
+ for (i=0; i<numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
+
+ __GLX_SWAP_INT(&datatype);
+ __GLX_SWAP_INT(&numVals);
+ __GLX_SWAP_INT(&component);
+
+ stride += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ }
+
+ pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader);
+
+ /* set up component arrays */
+ for (i=0; i<numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLenum component = compHeader[i].component;
+
+ swapArray(numVals, datatype, stride, numVertexes, pc);
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_NORMAL_ARRAY:
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glNormalPointer(datatype, stride, pc);
+ break;
+ case GL_COLOR_ARRAY:
+ glEnableClientState(GL_COLOR_ARRAY);
+ glColorPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_INDEX_ARRAY:
+ glEnableClientState(GL_INDEX_ARRAY);
+ glIndexPointer(datatype, stride, pc);
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(numVals, datatype, stride, pc);
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ glEnableClientState(GL_EDGE_FLAG_ARRAY);
+ glEdgeFlagPointer(stride, (const GLboolean *)pc);
+ break;
+ default:
+ break;
+ }
+
+ pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
+ }
+
+ glDrawArrays(primType, 0, numVertexes);
+
+ /* turn off anything we might have turned on */
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_INDEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_EDGE_FLAG_ARRAY);
+}
diff --git a/xc/programs/Xserver/GL/glx/renderpix.c b/xc/programs/Xserver/GL/glx/renderpix.c
new file mode 100644
index 000000000..bbaab81a9
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/renderpix.c
@@ -0,0 +1,161 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+void __glXDisp_PolygonStipple(GLbyte *pc)
+{
+ __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glPolygonStipple((GLubyte *)(hdr+1));
+}
+
+void __glXDisp_Bitmap(GLbyte *pc)
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glBitmap((GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ (GLfloat) hdr->xorig,
+ (GLfloat) hdr->yorig,
+ (GLfloat) hdr->xmove,
+ (GLfloat) hdr->ymove,
+ (GLubyte *)(hdr+1));
+}
+
+void __glXDisp_TexImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexImage1D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->components,
+ (GLsizei) hdr->width,
+ (GLint) hdr->border,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDisp_TexImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexImage2D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->components,
+ (GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ (GLint) hdr->border,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDisp_DrawPixels(GLbyte *pc)
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glDrawPixels((GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDisp_TexSubImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexSubImage1D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->xoffset,
+ (GLsizei) hdr->width,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDisp_TexSubImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexSubImage2D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->xoffset,
+ (GLint) hdr->yoffset,
+ (GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
diff --git a/xc/programs/Xserver/GL/glx/renderpixswap.c b/xc/programs/Xserver/GL/glx/renderpixswap.c
new file mode 100644
index 000000000..51e96844e
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/renderpixswap.c
@@ -0,0 +1,269 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+void __glXDispSwap_PolygonStipple(GLbyte *pc)
+{
+ __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glPolygonStipple((GLubyte *)(hdr+1));
+}
+
+void __glXDispSwap_Bitmap(GLbyte *pc)
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glBitmap((GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ (GLfloat) hdr->xorig,
+ (GLfloat) hdr->yorig,
+ (GLfloat) hdr->xmove,
+ (GLfloat) hdr->ymove,
+ (GLubyte *)(hdr+1));
+}
+
+void __glXDispSwap_TexImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->components);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->border);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexImage1D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->components,
+ (GLsizei) hdr->width,
+ (GLint) hdr->border,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDispSwap_TexImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->components);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->border);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexImage2D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->components,
+ (GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ (GLint) hdr->border,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDispSwap_DrawPixels(GLbyte *pc)
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glDrawPixels((GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDispSwap_TexSubImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexSubImage1D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->xoffset,
+ (GLsizei) hdr->width,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
+
+void __glXDispSwap_TexSubImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+ glTexSubImage2D(hdr->target,
+ (GLint) hdr->level,
+ (GLint) hdr->xoffset,
+ (GLint) hdr->yoffset,
+ (GLsizei) hdr->width,
+ (GLsizei) hdr->height,
+ hdr->format,
+ hdr->type,
+ (GLvoid *)(hdr+1));
+}
diff --git a/xc/programs/Xserver/GL/glx/rensize.c b/xc/programs/Xserver/GL/glx/rensize.c
new file mode 100644
index 000000000..484a16eab
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/rensize.c
@@ -0,0 +1,569 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include "glxserver.h"
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include "unpack.h"
+#include "impsize.h"
+
+#define SWAPL(a) \
+ (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \
+ ((a & 0xff00U)<<8) | ((a & 0xffU)<<24))
+
+int __glXCallListsReqSize(GLbyte *pc, Bool swap )
+{
+ GLsizei n = *(GLsizei *)(pc + 0);
+ GLenum type = *(GLenum *)(pc + 4);
+
+ if (swap) {
+ n = SWAPL( n );
+ type = SWAPL( type );
+ }
+ return __glCallLists_size( n, type ); /* defined in samplegl lib */
+}
+
+int __glXFogivReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 0);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glFogiv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXFogfvReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXFogivReqSize( pc, swap );
+}
+
+int __glXLightfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXLightivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXLightfvReqSize( pc, swap );
+}
+
+int __glXLightModelfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 0);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glLightModelfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXLightModelivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXLightModelfvReqSize( pc, swap );
+}
+
+int __glXMaterialfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glMaterialfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXMaterialivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXMaterialfvReqSize( pc, swap );
+}
+
+int __glXTexGendvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 8 * __glTexGendv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXTexGenfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glTexGenfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXTexGenivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXTexGenfvReqSize( pc, swap );
+}
+
+int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glTexParameterfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXTexParameterivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXTexParameterfvReqSize( pc, swap );
+}
+
+int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum pname = *(GLenum *)(pc + 4);
+ if (swap) {
+ pname = SWAPL( pname );
+ }
+ return 4 * __glTexEnvfv_size( pname ); /* defined in samplegl lib */
+}
+
+int __glXTexEnvivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXTexEnvfvReqSize( pc, swap );
+}
+
+static int Map1Size( GLint k, GLint order)
+{
+ if (order <= 0 || k < 0) return -1;
+ return k * order;
+}
+
+int __glXMap1dReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum target;
+ GLint order, k;
+
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
+ if (swap) {
+ target = SWAPL( target );
+ order = SWAPL( order );
+ }
+ k = __glEvalComputeK( target );
+ return 8 * Map1Size( k, order );
+}
+
+int __glXMap1fReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum target;
+ GLint order, k;
+
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
+ if (swap) {
+ target = SWAPL( target );
+ order = SWAPL( order );
+ }
+ k = __glEvalComputeK(target);
+ return 4 * Map1Size(k, order);
+}
+
+static int Map2Size(int k, int majorOrder, int minorOrder)
+{
+ if (majorOrder <= 0 || minorOrder <= 0 || k < 0) return -1;
+ return k * majorOrder * minorOrder;
+}
+
+int __glXMap2dReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum target;
+ GLint uorder, vorder, k;
+
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
+ if (swap) {
+ target = SWAPL( target );
+ uorder = SWAPL( uorder );
+ vorder = SWAPL( vorder );
+ }
+ k = __glEvalComputeK( target );
+ return 8 * Map2Size( k, uorder, vorder );
+}
+
+int __glXMap2fReqSize(GLbyte *pc, Bool swap )
+{
+ GLenum target;
+ GLint uorder, vorder, k;
+
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
+ if (swap) {
+ target = SWAPL( target );
+ uorder = SWAPL( uorder );
+ vorder = SWAPL( vorder );
+ }
+ k = __glEvalComputeK( target );
+ return 4 * Map2Size( k, uorder, vorder );
+}
+
+int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap )
+{
+ GLint mapsize;
+ mapsize = *(GLint *)(pc + 4);
+ if (swap) {
+ mapsize = SWAPL( mapsize );
+ }
+ return 4 * mapsize;
+}
+
+int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap )
+{
+ return __glXPixelMapfvReqSize( pc, swap );
+}
+
+int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap )
+{
+ GLint mapsize;
+ mapsize = *(GLint *)(pc + 4);
+ if (swap) {
+ mapsize = SWAPL( mapsize );
+ }
+ return 2 * mapsize;
+}
+
+static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h,
+ GLint rowLength, GLint skipRows, GLint alignment )
+{
+ GLint bytesPerElement, elementsPerGroup, groupsPerRow;
+ GLint groupSize, rowSize, padding;
+
+ if (w < 0 || h < 0 ||
+ (type == GL_BITMAP &&
+ (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) {
+ return -1;
+ }
+ if (w==0 || h==0) return 0;
+
+ if (type == GL_BITMAP) {
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ } else {
+ groupsPerRow = w;
+ }
+ rowSize = (groupsPerRow + 7) >> 3;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ return ((h + skipRows) * rowSize);
+ } else {
+ switch(type) {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ bytesPerElement = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ bytesPerElement = 2;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ bytesPerElement = 4;
+ break;
+ default:
+ return -1;
+ }
+ switch(format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elementsPerGroup = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elementsPerGroup = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elementsPerGroup = 2;
+ break;
+ case GL_RGB:
+ elementsPerGroup = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elementsPerGroup = 4;
+ break;
+ default:
+ return -1;
+ }
+ groupSize = bytesPerElement * elementsPerGroup;
+ if (rowLength > 0) {
+ groupsPerRow = rowLength;
+ } else {
+ groupsPerRow = w;
+ }
+ rowSize = groupsPerRow * groupSize;
+ padding = (rowSize % alignment);
+ if (padding) {
+ rowSize += alignment - padding;
+ }
+ return ((h + skipRows) * rowSize);
+ }
+}
+
+int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+ GLenum format = hdr->format;
+ GLenum type = hdr->type;
+ GLint w = hdr->width;
+ GLint h = hdr->height;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ h = SWAPL( h );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ return ImageSize( format, type, w, h, rowLength, skipRows, alignment );
+}
+
+int __glXBitmapReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+ GLint w = hdr->width;
+ GLint h = hdr->height;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ w = SWAPL( w );
+ h = SWAPL( h );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ return ImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h,
+ rowLength, skipRows, alignment );
+}
+
+int __glXTexImage1DReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ GLenum target = hdr->target;
+ GLenum format = hdr->format;
+ GLenum type = hdr->type;
+ GLint w = hdr->width;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ target = SWAPL( target );
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ if (target == GL_PROXY_TEXTURE_1D) {
+ return 0;
+ } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) {
+ return -1;
+ }
+ return ImageSize( format, type, w, 1, rowLength, skipRows, alignment );
+}
+
+int __glXTexImage2DReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ GLenum target = hdr->target;
+ GLenum format = hdr->format;
+ GLenum type = hdr->type;
+ GLint w = hdr->width;
+ GLint h = hdr->height;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ target = SWAPL( target );
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ h = SWAPL( h );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ if (target == GL_PROXY_TEXTURE_2D) {
+ return 0;
+ } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) {
+ return -1;
+ }
+ return ImageSize( format, type, w, h, rowLength, skipRows, alignment );
+}
+
+int __glXTypeSize(GLenum enm)
+{
+ switch(enm) {
+ case GL_BYTE: return sizeof(GLbyte);
+ case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
+ case GL_SHORT: return sizeof(GLshort);
+ case GL_UNSIGNED_SHORT: return sizeof(GLushort);
+ case GL_INT: return sizeof(GLint);
+ case GL_UNSIGNED_INT: return sizeof(GLint);
+ case GL_FLOAT: return sizeof(GLfloat);
+ case GL_DOUBLE: return sizeof(GLdouble);
+ default: return -1;
+ }
+}
+
+int __glXDrawArraysSize( GLbyte *pc, Bool swap )
+{
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
+ __GLXdispatchDrawArraysComponentHeader *compHeader;
+ GLint numVertexes = hdr->numVertexes;
+ GLint numComponents = hdr->numComponents;
+ GLint arrayElementSize = 0;
+ int i;
+
+ if (swap) {
+ numVertexes = SWAPL( numVertexes );
+ numComponents = SWAPL( numComponents );
+ }
+
+ pc += sizeof(__GLXdispatchDrawArraysHeader);
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
+
+ for (i=0; i<numComponents; i++) {
+ GLenum datatype = compHeader[i].datatype;
+ GLint numVals = compHeader[i].numVals;
+ GLint component = compHeader[i].component;
+
+ if (swap) {
+ datatype = SWAPL( datatype );
+ numVals = SWAPL( numVals );
+ component = SWAPL( component );
+ }
+
+ switch (component) {
+ case GL_VERTEX_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ break;
+ case GL_NORMAL_ARRAY:
+ if (numVals != 3) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_INDEX_ARRAY:
+ if (numVals != 1) {
+ /* bad size */
+ return -1;
+ }
+ break;
+ case GL_EDGE_FLAG_ARRAY:
+ if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) {
+ /* bad size or bad type */
+ return -1;
+ }
+ break;
+ default:
+ /* unknown component type */
+ return -1;
+ }
+
+ arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype));
+
+ pc += sizeof(__GLXdispatchDrawArraysComponentHeader);
+ }
+
+ return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) +
+ (numVertexes * arrayElementSize));
+}
+
+int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap )
+{
+ GLint n = *(GLsizei *)(pc + 0);
+ if (swap) n = SWAPL(n);
+ return(8*n); /* 4*n for textures, 4*n for priorities */
+}
+
+int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ GLenum target = hdr->target;
+ GLenum format = hdr->format;
+ GLenum type = hdr->type;
+ GLint w = hdr->width;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ return ImageSize( format, type, w, 1, rowLength, skipRows, alignment );
+}
+
+int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap )
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ GLenum target = hdr->target;
+ GLenum format = hdr->format;
+ GLenum type = hdr->type;
+ GLint w = hdr->width;
+ GLint h = hdr->height;
+ GLint rowLength = hdr->rowLength;
+ GLint skipRows = hdr->skipRows;
+ GLint alignment = hdr->alignment;
+
+ if (swap) {
+ format = SWAPL( format );
+ type = SWAPL( type );
+ w = SWAPL( w );
+ h = SWAPL( h );
+ rowLength = SWAPL( rowLength );
+ skipRows = SWAPL( skipRows );
+ alignment = SWAPL( alignment );
+ }
+ return ImageSize( format, type, w, h, rowLength, skipRows, alignment );
+}
diff --git a/xc/programs/Xserver/GL/glx/rensizetab.c b/xc/programs/Xserver/GL/glx/rensizetab.c
new file mode 100644
index 000000000..229fa3c30
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/rensizetab.c
@@ -0,0 +1,248 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include "glxserver.h"
+
+__GLXrenderSizeData __glXRenderSizeTable[] = {
+ /* no such opcode */ { 0, 0 },
+ /* CallList */ { 8, 0 },
+ /* CallLists */ { 12, __glXCallListsReqSize },
+ /* ListBase */ { 8, 0 },
+ /* Begin */ { 8, 0 },
+ /* Bitmap */ { 48, __glXBitmapReqSize },
+ /* Color3bv */ { 8, 0 },
+ /* Color3dv */ { 28, 0 },
+ /* Color3fv */ { 16, 0 },
+ /* Color3iv */ { 16, 0 },
+ /* Color3sv */ { 12, 0 },
+ /* Color3ubv */ { 8, 0 },
+ /* Color3uiv */ { 16, 0 },
+ /* Color3usv */ { 12, 0 },
+ /* Color4bv */ { 8, 0 },
+ /* Color4dv */ { 36, 0 },
+ /* Color4fv */ { 20, 0 },
+ /* Color4iv */ { 20, 0 },
+ /* Color4sv */ { 12, 0 },
+ /* Color4ubv */ { 8, 0 },
+ /* Color4uiv */ { 20, 0 },
+ /* Color4usv */ { 12, 0 },
+ /* EdgeFlagv */ { 8, 0 },
+ /* End */ { 4, 0 },
+ /* Indexdv */ { 12, 0 },
+ /* Indexfv */ { 8, 0 },
+ /* Indexiv */ { 8, 0 },
+ /* Indexsv */ { 8, 0 },
+ /* Normal3bv */ { 8, 0 },
+ /* Normal3dv */ { 28, 0 },
+ /* Normal3fv */ { 16, 0 },
+ /* Normal3iv */ { 16, 0 },
+ /* Normal3sv */ { 12, 0 },
+ /* RasterPos2dv */ { 20, 0 },
+ /* RasterPos2fv */ { 12, 0 },
+ /* RasterPos2iv */ { 12, 0 },
+ /* RasterPos2sv */ { 8, 0 },
+ /* RasterPos3dv */ { 28, 0 },
+ /* RasterPos3fv */ { 16, 0 },
+ /* RasterPos3iv */ { 16, 0 },
+ /* RasterPos3sv */ { 12, 0 },
+ /* RasterPos4dv */ { 36, 0 },
+ /* RasterPos4fv */ { 20, 0 },
+ /* RasterPos4iv */ { 20, 0 },
+ /* RasterPos4sv */ { 12, 0 },
+ /* Rectdv */ { 36, 0 },
+ /* Rectfv */ { 20, 0 },
+ /* Rectiv */ { 20, 0 },
+ /* Rectsv */ { 12, 0 },
+ /* TexCoord1dv */ { 12, 0 },
+ /* TexCoord1fv */ { 8, 0 },
+ /* TexCoord1iv */ { 8, 0 },
+ /* TexCoord1sv */ { 8, 0 },
+ /* TexCoord2dv */ { 20, 0 },
+ /* TexCoord2fv */ { 12, 0 },
+ /* TexCoord2iv */ { 12, 0 },
+ /* TexCoord2sv */ { 8, 0 },
+ /* TexCoord3dv */ { 28, 0 },
+ /* TexCoord3fv */ { 16, 0 },
+ /* TexCoord3iv */ { 16, 0 },
+ /* TexCoord3sv */ { 12, 0 },
+ /* TexCoord4dv */ { 36, 0 },
+ /* TexCoord4fv */ { 20, 0 },
+ /* TexCoord4iv */ { 20, 0 },
+ /* TexCoord4sv */ { 12, 0 },
+ /* Vertex2dv */ { 20, 0 },
+ /* Vertex2fv */ { 12, 0 },
+ /* Vertex2iv */ { 12, 0 },
+ /* Vertex2sv */ { 8, 0 },
+ /* Vertex3dv */ { 28, 0 },
+ /* Vertex3fv */ { 16, 0 },
+ /* Vertex3iv */ { 16, 0 },
+ /* Vertex3sv */ { 12, 0 },
+ /* Vertex4dv */ { 36, 0 },
+ /* Vertex4fv */ { 20, 0 },
+ /* Vertex4iv */ { 20, 0 },
+ /* Vertex4sv */ { 12, 0 },
+ /* ClipPlane */ { 40, 0 },
+ /* ColorMaterial */ { 12, 0 },
+ /* CullFace */ { 8, 0 },
+ /* Fogf */ { 12, 0 },
+ /* Fogfv */ { 8, __glXFogfvReqSize },
+ /* Fogi */ { 12, 0 },
+ /* Fogiv */ { 8, __glXFogivReqSize },
+ /* FrontFace */ { 8, 0 },
+ /* Hint */ { 12, 0 },
+ /* Lightf */ { 16, 0 },
+ /* Lightfv */ { 12, __glXLightfvReqSize },
+ /* Lighti */ { 16, 0 },
+ /* Lightiv */ { 12, __glXLightivReqSize },
+ /* LightModelf */ { 12, 0 },
+ /* LightModelfv */ { 8, __glXLightModelfvReqSize },
+ /* LightModeli */ { 12, 0 },
+ /* LightModeliv */ { 8, __glXLightModelivReqSize },
+ /* LineStipple */ { 12, 0 },
+ /* LineWidth */ { 8, 0 },
+ /* Materialf */ { 16, 0 },
+ /* Materialfv */ { 12, __glXMaterialfvReqSize },
+ /* Materiali */ { 16, 0 },
+ /* Materialiv */ { 12, __glXMaterialivReqSize },
+ /* PointSize */ { 8, 0 },
+ /* PolygonMode */ { 12, 0 },
+ /* PolygonStipple */ { 152, 0 },
+ /* Scissor */ { 20, 0 },
+ /* ShadeModel */ { 8, 0 },
+ /* TexParameterf */ { 16, 0 },
+ /* TexParameterfv */ { 12, __glXTexParameterfvReqSize },
+ /* TexParameteri */ { 16, 0 },
+ /* TexParameteriv */ { 12, __glXTexParameterivReqSize },
+ /* TexImage1D */ { 56, __glXTexImage1DReqSize },
+ /* TexImage2D */ { 56, __glXTexImage2DReqSize },
+ /* TexEnvf */ { 16, 0 },
+ /* TexEnvfv */ { 12, __glXTexEnvfvReqSize },
+ /* TexEnvi */ { 16, 0 },
+ /* TexEnviv */ { 12, __glXTexEnvivReqSize },
+ /* TexGend */ { 20, 0 },
+ /* TexGendv */ { 12, __glXTexGendvReqSize },
+ /* TexGenf */ { 16, 0 },
+ /* TexGenfv */ { 12, __glXTexGenfvReqSize },
+ /* TexGeni */ { 16, 0 },
+ /* TexGeniv */ { 12, __glXTexGenivReqSize },
+ /* InitNames */ { 4, 0 },
+ /* LoadName */ { 8, 0 },
+ /* PassThrough */ { 8, 0 },
+ /* PopName */ { 4, 0 },
+ /* PushName */ { 8, 0 },
+ /* DrawBuffer */ { 8, 0 },
+ /* Clear */ { 8, 0 },
+ /* ClearAccum */ { 20, 0 },
+ /* ClearIndex */ { 8, 0 },
+ /* ClearColor */ { 20, 0 },
+ /* ClearStencil */ { 8, 0 },
+ /* ClearDepth */ { 12, 0 },
+ /* StencilMask */ { 8, 0 },
+ /* ColorMask */ { 8, 0 },
+ /* DepthMask */ { 8, 0 },
+ /* IndexMask */ { 8, 0 },
+ /* Accum */ { 12, 0 },
+ /* Disable */ { 8, 0 },
+ /* Enable */ { 8, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* PopAttrib */ { 4, 0 },
+ /* PushAttrib */ { 8, 0 },
+ /* Map1d */ { 28, __glXMap1dReqSize },
+ /* Map1f */ { 20, __glXMap1fReqSize },
+ /* Map2d */ { 48, __glXMap2dReqSize },
+ /* Map2f */ { 32, __glXMap2fReqSize },
+ /* MapGrid1d */ { 24, 0 },
+ /* MapGrid1f */ { 16, 0 },
+ /* MapGrid2d */ { 44, 0 },
+ /* MapGrid2f */ { 28, 0 },
+ /* EvalCoord1dv */ { 12, 0 },
+ /* EvalCoord1fv */ { 8, 0 },
+ /* EvalCoord2dv */ { 20, 0 },
+ /* EvalCoord2fv */ { 12, 0 },
+ /* EvalMesh1 */ { 16, 0 },
+ /* EvalPoint1 */ { 8, 0 },
+ /* EvalMesh2 */ { 24, 0 },
+ /* EvalPoint2 */ { 12, 0 },
+ /* AlphaFunc */ { 12, 0 },
+ /* BlendFunc */ { 12, 0 },
+ /* LogicOp */ { 8, 0 },
+ /* StencilFunc */ { 16, 0 },
+ /* StencilOp */ { 16, 0 },
+ /* DepthFunc */ { 8, 0 },
+ /* PixelZoom */ { 12, 0 },
+ /* PixelTransferf */ { 12, 0 },
+ /* PixelTransferi */ { 12, 0 },
+ /* PixelMapfv */ { 12, __glXPixelMapfvReqSize },
+ /* PixelMapuiv */ { 12, __glXPixelMapuivReqSize },
+ /* PixelMapusv */ { 12, __glXPixelMapusvReqSize },
+ /* ReadBuffer */ { 8, 0 },
+ /* CopyPixels */ { 24, 0 },
+ /* DrawPixels */ { 40, __glXDrawPixelsReqSize },
+ /* DepthRange */ { 20, 0 },
+ /* Frustum */ { 52, 0 },
+ /* LoadIdentity */ { 4, 0 },
+ /* LoadMatrixf */ { 68, 0 },
+ /* LoadMatrixd */ { 132, 0 },
+ /* MatrixMode */ { 8, 0 },
+ /* MultMatrixf */ { 68, 0 },
+ /* MultMatrixd */ { 132, 0 },
+ /* Ortho */ { 52, 0 },
+ /* PopMatrix */ { 4, 0 },
+ /* PushMatrix */ { 4, 0 },
+ /* Rotated */ { 36, 0 },
+ /* Rotatef */ { 20, 0 },
+ /* Scaled */ { 28, 0 },
+ /* Scalef */ { 16, 0 },
+ /* Translated */ { 28, 0 },
+ /* Translatef */ { 16, 0 },
+ /* Viewport */ { 20, 0 },
+ /* PolygonOffset */ { 12, 0 },
+ /* DrawArrays */ { 16, __glXDrawArraysSize },
+ /* Indexubv */ { 8, 0 },
+};
+__GLXrenderSizeData __glXRenderSizeTable_EXT[] = {
+ /* PolygonOffset */ { 12, 0 },
+ /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize },
+ /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* no such opcode */ { 0, 0 },
+ /* BindTexture */ { 12, 0 },
+ /* PrioritizeTextures */ { 8, __glXPrioritizeTexturesReqSize },
+ /* CopyTexImage1D */ { 32, 0 },
+ /* CopyTexImage2D */ { 36, 0 },
+ /* CopyTexSubImage1D */ { 28, 0 },
+ /* CopyTexSubImage2D */ { 36, 0 },
+};
diff --git a/xc/programs/Xserver/GL/glx/single2.c b/xc/programs/Xserver/GL/glx/single2.c
new file mode 100644
index 000000000..d62c22a1b
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/single2.c
@@ -0,0 +1,348 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei size;
+ GLenum type;
+ __GLXcontext *cx;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ size = *(GLsizei *)(pc+0);
+ type = *(GLenum *)(pc+4);
+ if (cx->feedbackBufSize < size) {
+ cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ (size_t)size
+ * __GLX_SIZE_FLOAT32);
+ if (!cx->feedbackBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->feedbackBufSize = size;
+ }
+ glFeedbackBuffer(size, type, cx->feedbackBuf);
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ GLsizei size;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ size = *(GLsizei *)(pc+0);
+ if (cx->selectBufSize < size) {
+ cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ (size_t) size
+ * __GLX_SIZE_CARD32);
+ if (!cx->selectBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->selectBufSize = size;
+ }
+ glSelectBuffer(size, cx->selectBuf);
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client;
+ xGLXRenderModeReply reply;
+ __GLXcontext *cx;
+ GLint nitems=0, retBytes=0, retval, newModeCheck;
+ GLubyte *retBuffer = NULL;
+ GLenum newMode;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ newMode = *(GLenum*) pc;
+ retval = glRenderMode(newMode);
+
+ /* Check that render mode worked */
+ glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
+ if (newModeCheck != newMode) {
+ /* Render mode change failed. Bail */
+ newMode = newModeCheck;
+ goto noChangeAllowed;
+ }
+
+ /*
+ ** Render mode might have still failed if we get here. But in this
+ ** case we can't really tell, nor does it matter. If it did fail, it
+ ** will return 0, and thus we won't send any data across the wire.
+ */
+
+ switch (cx->renderMode) {
+ case GL_RENDER:
+ cx->renderMode = newMode;
+ break;
+ case GL_FEEDBACK:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->feedbackBufSize;
+ } else {
+ nitems = retval;
+ }
+ retBytes = nitems * __GLX_SIZE_FLOAT32;
+ retBuffer = (GLubyte*) cx->feedbackBuf;
+ cx->renderMode = newMode;
+ break;
+ case GL_SELECT:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->selectBufSize;
+ } else {
+ GLuint *bp = cx->selectBuf;
+ GLint i;
+
+ /*
+ ** Figure out how many bytes of data need to be sent. Parse
+ ** the selection buffer to determine this fact as the
+ ** return value is the number of hits, not the number of
+ ** items in the buffer.
+ */
+ nitems = 0;
+ i = retval;
+ while (--i >= 0) {
+ GLuint n;
+
+ /* Parse select data for this hit */
+ n = *bp;
+ bp += 3 + n;
+ }
+ nitems = bp - cx->selectBuf;
+ }
+ retBytes = nitems * __GLX_SIZE_CARD32;
+ retBuffer = (GLubyte*) cx->selectBuf;
+ cx->renderMode = newMode;
+ break;
+ }
+
+ /*
+ ** First reply is the number of elements returned in the feedback or
+ ** selection array, as per the API for glRenderMode itself.
+ */
+ noChangeAllowed:;
+ client = cl->client;
+ reply.length = nitems;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.retval = retval;
+ reply.size = nitems;
+ reply.newMode = newMode;
+ WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply);
+ if (retBytes) {
+ WriteToClient(client, retBytes, (char *)retBuffer);
+ }
+ return Success;
+}
+
+int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ glFlush();
+ __GLX_NOTE_FLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client;
+ int error;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ /* Do a local glFinish */
+ glFinish();
+ __GLX_NOTE_FLUSHED_CMDS(cx);
+
+ /* Send empty reply packet to indicate finish is finished */
+ client = cl->client;
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ return Success;
+}
+
+#define SEPARATOR " "
+
+char *__glXcombine_strings(const char *cext_string, const char *sext_string)
+{
+ size_t clen, slen;
+ char *combo_string, *token, *s1;
+ const char *s2, *end;
+
+ /*
+ ** String can't be longer than min(cstring, sstring)
+ ** pull tokens out of shortest string
+ ** include space in combo_string for final separator and null terminator
+ */
+ if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) {
+ combo_string = (char *) __glXMalloc(slen + 2);
+ s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string);
+ s2 = cext_string;
+ } else {
+ combo_string = (char *) __glXMalloc(clen + 2);
+ s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string);
+ s2 = sext_string;
+ }
+ if (!combo_string || !s1) {
+ if (combo_string) __glXFree(combo_string);
+ if (s1) __glXFree(s1);
+ return NULL;
+ }
+ combo_string[0] = '\0';
+
+ /* Get first extension token */
+ token = __glXStrtok( s1, SEPARATOR);
+ while ( token != NULL ) {
+
+ /*
+ ** if token in second string then save it
+ ** beware of extension names which are prefixes of other extension names
+ */
+ const char *p = s2;
+ end = p + __glXStrlen(p);
+ while (p < end) {
+ size_t n = __glXStrcspn(p, SEPARATOR);
+ if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) {
+ combo_string = __glXStrcat( combo_string, token);
+ combo_string = __glXStrcat( combo_string, SEPARATOR);
+ }
+ p += (n + 1);
+ }
+
+ /* Get next extension token */
+ token = __glXStrtok( NULL, SEPARATOR);
+ }
+ __glXFree(s1);
+ return combo_string;
+}
+
+int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client;
+ __GLXcontext *cx;
+ GLenum name;
+ const char *string;
+ GLint length;
+ int error;
+ GLubyte *answer;
+ char *buf;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ name = *(GLenum *)(pc + 0);
+ string = (const char *)glGetString(name);
+ client = cl->client;
+
+ if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) {
+ buf = __glXcombine_strings(string,
+ cl->GLClientextensions);
+ } else {
+ buf = __glXMalloc(__glXStrlen(string) + 2);
+ __glXStrcpy(buf, string);
+ }
+ if (!buf) {
+ length = 0;
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ } else {
+ length = __glXStrlen((const char *) buf) + 1;
+ __GLX_BEGIN_REPLY(length);
+ __GLX_PUT_SIZE(length);
+ }
+
+ __GLX_SEND_HEADER();
+ WriteToClient(client, length, buf);
+ __glXFree(buf);
+ return Success;
+}
+
+int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answer[4];
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+
+ __glXClearErrorOccured();
+ glGetClipPlane(*(GLenum *)(pc + 0), answer);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(32);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(4);
+ }
+ return Success;
+}
+
diff --git a/xc/programs/Xserver/GL/glx/single2swap.c b/xc/programs/Xserver/GL/glx/single2swap.c
new file mode 100644
index 000000000..3aa1af0f7
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/single2swap.c
@@ -0,0 +1,328 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei size;
+ GLenum type;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc+0);
+ __GLX_SWAP_INT(pc+4);
+ size = *(GLsizei *)(pc+0);
+ type = *(GLenum *)(pc+4);
+ if (cx->feedbackBufSize < size) {
+ cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ (size_t) size
+ * __GLX_SIZE_FLOAT32);
+ if (!cx->feedbackBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->feedbackBufSize = size;
+ }
+ glFeedbackBuffer(size, type, cx->feedbackBuf);
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ GLsizei size;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc+0);
+ size = *(GLsizei *)(pc+0);
+ if (cx->selectBufSize < size) {
+ cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ (size_t) size
+ * __GLX_SIZE_CARD32);
+ if (!cx->selectBuf) {
+ cl->client->errorValue = size;
+ return BadAlloc;
+ }
+ cx->selectBufSize = size;
+ }
+ glSelectBuffer(size, cx->selectBuf);
+ __GLX_NOTE_UNFLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client;
+ __GLXcontext *cx;
+ xGLXRenderModeReply reply;
+ GLint nitems=0, retBytes=0, retval, newModeCheck;
+ GLubyte *retBuffer = NULL;
+ GLenum newMode;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ int error;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc);
+ newMode = *(GLenum*) pc;
+ retval = glRenderMode(newMode);
+
+ /* Check that render mode worked */
+ glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
+ if (newModeCheck != newMode) {
+ /* Render mode change failed. Bail */
+ newMode = newModeCheck;
+ goto noChangeAllowed;
+ }
+
+ /*
+ ** Render mode might have still failed if we get here. But in this
+ ** case we can't really tell, nor does it matter. If it did fail, it
+ ** will return 0, and thus we won't send any data across the wire.
+ */
+
+ switch (cx->renderMode) {
+ case GL_RENDER:
+ cx->renderMode = newMode;
+ break;
+ case GL_FEEDBACK:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->feedbackBufSize;
+ } else {
+ nitems = retval;
+ }
+ retBytes = nitems * __GLX_SIZE_FLOAT32;
+ retBuffer = (GLubyte*) cx->feedbackBuf;
+ __GLX_SWAP_FLOAT_ARRAY((GLbyte *)retBuffer, nitems);
+ cx->renderMode = newMode;
+ break;
+ case GL_SELECT:
+ if (retval < 0) {
+ /* Overflow happened. Copy the entire buffer */
+ nitems = cx->selectBufSize;
+ } else {
+ GLuint *bp = cx->selectBuf;
+ GLint i;
+
+ /*
+ ** Figure out how many bytes of data need to be sent. Parse
+ ** the selection buffer to determine this fact as the
+ ** return value is the number of hits, not the number of
+ ** items in the buffer.
+ */
+ nitems = 0;
+ i = retval;
+ while (--i >= 0) {
+ GLuint n;
+
+ /* Parse select data for this hit */
+ n = *bp;
+ bp += 3 + n;
+ }
+ nitems = bp - cx->selectBuf;
+ }
+ retBytes = nitems * __GLX_SIZE_CARD32;
+ retBuffer = (GLubyte*) cx->selectBuf;
+ __GLX_SWAP_INT_ARRAY((GLbyte *)retBuffer, nitems);
+ cx->renderMode = newMode;
+ break;
+ }
+
+ /*
+ ** First reply is the number of elements returned in the feedback or
+ ** selection array, as per the API for glRenderMode itself.
+ */
+ noChangeAllowed:;
+ client = cl->client;
+ reply.length = nitems;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.retval = retval;
+ reply.size = nitems;
+ reply.newMode = newMode;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.retval);
+ __GLX_SWAP_INT(&reply.size);
+ __GLX_SWAP_INT(&reply.newMode);
+ WriteToClient(client, sz_xGLXRenderModeReply, (char *)&reply);
+ if (retBytes) {
+ WriteToClient(client, retBytes, (char *)retBuffer);
+ }
+ return Success;
+}
+
+int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ glFlush();
+ __GLX_NOTE_FLUSHED_CMDS(cx);
+ return Success;
+}
+
+int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client;
+ int error;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ /* Do a local glFinish */
+ glFinish();
+ __GLX_NOTE_FLUSHED_CMDS(cx);
+
+ /* Send empty reply packet to indicate finish is finished */
+ client = cl->client;
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_RETVAL(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+
+ return Success;
+}
+
+int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client;
+ __GLXcontext *cx;
+ GLenum name;
+ const char *string;
+ GLint length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ int error;
+ GLubyte *answer;
+ char *buf;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+ name = *(GLenum *)(pc + 0);
+ string = (const char *)glGetString(name);
+ client = cl->client;
+
+ if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) {
+ buf = __glXcombine_strings(string,
+ cl->GLClientextensions);
+ } else {
+ buf = __glXMalloc(__glXStrlen(string) + 2);
+ __glXStrcpy(buf, string);
+ }
+ if (!buf) {
+ length = 0;
+ __GLX_BEGIN_REPLY(0);
+ __GLX_PUT_SIZE(0);
+ } else {
+ length = __glXStrlen((const char *) buf) + 1;
+ __GLX_BEGIN_REPLY(length);
+ __GLX_PUT_SIZE(length);
+ }
+
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ WriteToClient(client, length, buf);
+ __glXFree(buf);
+
+ return Success;
+}
+
+int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLdouble answer[4];
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc + 0);
+
+ __glXClearErrorOccured();
+ glGetClipPlane(*(GLenum *)(pc + 0), answer);
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_SWAP_DOUBLE_ARRAY((GLbyte *)answer, 4);
+ __GLX_BEGIN_REPLY(32);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_DOUBLE_ARRAY(4);
+ }
+ return Success;
+}
diff --git a/xc/programs/Xserver/GL/glx/singlepix.c b/xc/programs/Xserver/GL/glx/singlepix.c
new file mode 100644
index 000000000..830bdd50c
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/singlepix.c
@@ -0,0 +1,172 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "singlesize.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ GLint compsize;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ width = *(GLsizei *)(pc + 8);
+ height = *(GLsizei *)(pc + 12);
+ format = *(GLenum *)(pc + 16);
+ type = *(GLenum *)(pc + 20);
+ swapBytes = *(GLboolean *)(pc + 24);
+ lsbFirst = *(GLboolean *)(pc + 25);
+ compsize = __glReadPixels_size(format,type,width,height);
+ if (compsize < 0) compsize = 0;
+
+ glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
+ glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glReadPixels(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16),
+ *(GLenum *)(pc + 20),
+ answer
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+{
+ GLint level, compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width=0, height=0;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ level = *(GLint *)(pc + 4);
+ format = *(GLenum *)(pc + 8);
+ type = *(GLenum *)(pc + 12);
+ target = *(GLenum *)(pc + 0);
+ swapBytes = *(GLboolean *)(pc + 16);
+
+ glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
+ glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target,level,format,type,width,height);
+ if (compsize < 0) compsize = 0;
+
+ glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glGetTexImage(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12),
+ answer
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ ((xGLXGetTexImageReply *)&__glXReply)->width = width;
+ ((xGLXGetTexImageReply *)&__glXReply)->height = height;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean lsbFirst;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLubyte answerBuffer[200];
+ char *answer;
+
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ lsbFirst = *(GLboolean *)(pc + 0);
+
+ glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,128,1);
+
+ __glXClearErrorOccured();
+ glGetPolygonStipple(
+ (GLubyte *) answer
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(128);
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(128);
+ }
+ return Success;
+}
+
+
diff --git a/xc/programs/Xserver/GL/glx/singlepixswap.c b/xc/programs/Xserver/GL/glx/singlepixswap.c
new file mode 100644
index 000000000..39ca57ef4
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/singlepixswap.c
@@ -0,0 +1,195 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "singlesize.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+{
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc+0);
+ __GLX_SWAP_INT(pc+4);
+ __GLX_SWAP_INT(pc+8);
+ __GLX_SWAP_INT(pc+12);
+ __GLX_SWAP_INT(pc+16);
+ __GLX_SWAP_INT(pc+20);
+
+ width = *(GLsizei *)(pc + 8);
+ height = *(GLsizei *)(pc + 12);
+ format = *(GLenum *)(pc + 16);
+ type = *(GLenum *)(pc + 20);
+ swapBytes = *(GLboolean *)(pc + 24);
+ lsbFirst = *(GLboolean *)(pc + 25);
+ compsize = __glReadPixels_size(format,type,width,height);
+ if (compsize < 0) compsize = 0;
+
+ glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
+ glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glReadPixels(
+ *(GLint *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLsizei *)(pc + 8),
+ *(GLsizei *)(pc + 12),
+ *(GLenum *)(pc + 16),
+ *(GLenum *)(pc + 20),
+ answer
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+{
+ GLint level, compsize;
+ GLenum format, type, target;
+ GLboolean swapBytes, lsbFirst;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ char *answer, answerBuffer[200];
+ GLint width=0, height=0;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+
+ pc += __GLX_SINGLE_HDR_SIZE;
+ __GLX_SWAP_INT(pc+0);
+ __GLX_SWAP_INT(pc+4);
+ __GLX_SWAP_INT(pc+8);
+ __GLX_SWAP_INT(pc+12);
+
+ level = *(GLint *)(pc + 4);
+ format = *(GLenum *)(pc + 8);
+ type = *(GLenum *)(pc + 12);
+ target = *(GLenum *)(pc + 0);
+ swapBytes = *(GLboolean *)(pc + 16);
+
+ glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
+ glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
+ /*
+ * The two queries above might fail if we're in a state where queries
+ * are illegal, but then width and height would still be zero anyway.
+ */
+ compsize = __glGetTexImage_size(target,level,format,type,width,height);
+ if (compsize < 0) compsize = 0;
+
+ glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
+ __glXClearErrorOccured();
+ glGetTexImage(
+ *(GLenum *)(pc + 0),
+ *(GLint *)(pc + 4),
+ *(GLenum *)(pc + 8),
+ *(GLenum *)(pc + 12),
+ answer
+ );
+
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(compsize);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ ((xGLXGetTexImageReply *)&__glXReply)->width = width;
+ ((xGLXGetTexImageReply *)&__glXReply)->height = height;
+ __GLX_SEND_HEADER();
+ __GLX_SEND_VOID_ARRAY(compsize);
+ }
+ return Success;
+}
+
+int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
+{
+ GLboolean lsbFirst;
+ __GLXcontext *cx;
+ ClientPtr client = cl->client;
+ int error;
+ GLubyte answerBuffer[200];
+ char *answer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag);
+ cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
+ if (!cx) {
+ return error;
+ }
+ pc += __GLX_SINGLE_HDR_SIZE;
+ lsbFirst = *(GLboolean *)(pc + 0);
+
+ glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
+ __GLX_GET_ANSWER_BUFFER(answer,cl,128,1);
+
+ __glXClearErrorOccured();
+ glGetPolygonStipple(
+ (GLubyte *) answer
+ );
+ if (__glXErrorOccured()) {
+ __GLX_BEGIN_REPLY(0);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ } else {
+ __GLX_BEGIN_REPLY(128);
+ __GLX_SWAP_REPLY_HEADER();
+ __GLX_SEND_HEADER();
+ __GLX_SEND_BYTE_ARRAY(128);
+ }
+ return Success;
+}
diff --git a/xc/programs/Xserver/GL/glx/singlesize.c b/xc/programs/Xserver/GL/glx/singlesize.c
new file mode 100644
index 000000000..1cff4c3a7
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/singlesize.c
@@ -0,0 +1,889 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 1999/06/14 07:31:35 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#include <GL/gl.h>
+#include "singlesize.h"
+
+/*
+** These routines compute the size of variable-size returned parameters.
+** Unlike the similar routines that do the same thing for variable-size
+** incoming parameters, the samplegl library itself doesn't use these routines.
+** Hence, they are located here, in the GLX extension library.
+*/
+
+GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
+{
+ GLint elements, esize;
+ GLint rowsize, padding;
+
+ if (w < 0 || h < 0) {
+ return -1;
+ }
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return -1;
+ }
+ /*
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ rowsize = ((w * elements)+7)/8;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ return (rowsize * h);
+ } else {
+ return -1;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ default:
+ return -1;
+ }
+ rowsize = w * elements * esize;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ return (rowsize * h);
+}
+
+GLint __glGetTexEnvfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ return 1;
+ case GL_TEXTURE_ENV_COLOR:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+
+GLint __glGetTexEnviv_size(GLenum pname)
+{
+ return __glGetTexEnvfv_size(pname);
+}
+
+GLint __glGetTexGenfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ return 1;
+ case GL_OBJECT_PLANE:
+ return 4;
+ case GL_EYE_PLANE:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetTexGendv_size(GLenum pname)
+{
+ return __glGetTexGenfv_size(pname);
+}
+
+GLint __glGetTexGeniv_size(GLenum pname)
+{
+ return __glGetTexGenfv_size(pname);
+}
+
+GLint __glGetTexParameterfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_WRAP_S:
+ return 1;
+ case GL_TEXTURE_WRAP_T:
+ return 1;
+ case GL_TEXTURE_MIN_FILTER:
+ return 1;
+ case GL_TEXTURE_MAG_FILTER:
+ return 1;
+ case GL_TEXTURE_BORDER_COLOR:
+ return 4;
+ case GL_TEXTURE_PRIORITY:
+ return 1;
+ case GL_TEXTURE_RESIDENT:
+ return 1;
+
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetTexParameteriv_size(GLenum pname)
+{
+ return __glGetTexParameterfv_size(pname);
+}
+
+GLint __glGetLightfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_POSITION:
+ return 4;
+ case GL_SPOT_DIRECTION:
+ return 3;
+ case GL_SPOT_EXPONENT:
+ return 1;
+ case GL_SPOT_CUTOFF:
+ return 1;
+ case GL_CONSTANT_ATTENUATION:
+ return 1;
+ case GL_LINEAR_ATTENUATION:
+ return 1;
+ case GL_QUADRATIC_ATTENUATION:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetLightiv_size(GLenum pname)
+{
+ return __glGetLightfv_size(pname);
+}
+
+static GLint EvalComputeK(GLenum target)
+{
+ switch(target) {
+ case GL_MAP1_VERTEX_4:
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_4:
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_TEXTURE_COORD_4:
+ return 4;
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_NORMAL:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_NORMAL:
+ return 3;
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_2:
+ return 2;
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP1_INDEX:
+ case GL_MAP2_INDEX:
+ return 1;
+ }
+ return 0;
+}
+
+GLint __glGetMap_size(GLenum target, GLenum query)
+{
+ GLint k, order=0, majorMinor[2];
+
+ /*
+ ** Assume target and query are both valid.
+ */
+ switch (target) {
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_NORMAL:
+ case GL_MAP1_INDEX:
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_VERTEX_4:
+ switch (query) {
+ case GL_COEFF:
+ k = EvalComputeK(target);
+ glGetMapiv(target, GL_ORDER, &order);
+ /*
+ ** The query above might fail, but then order will be zero anyway.
+ */
+ return (order * k);
+ case GL_DOMAIN:
+ return 2;
+ case GL_ORDER:
+ return 1;
+ }
+ break;
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_NORMAL:
+ case GL_MAP2_INDEX:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_VERTEX_4:
+ switch (query) {
+ case GL_COEFF:
+ k = EvalComputeK(target);
+ majorMinor[0] = majorMinor[1] = 0;
+ glGetMapiv(target, GL_ORDER, majorMinor);
+ /*
+ ** The query above might fail, but then majorMinor will be zeroes
+ */
+ return (majorMinor[0] * majorMinor[1] * k);
+ case GL_DOMAIN:
+ return 4;
+ case GL_ORDER:
+ return 2;
+ }
+ break;
+ }
+ return -1;
+}
+
+GLint __glGetMapdv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint __glGetMapfv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint __glGetMapiv_size(GLenum target, GLenum query)
+{
+ return __glGetMap_size(target, query);
+}
+
+GLint __glGetMaterialfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_SHININESS:
+ return 1;
+ case GL_COLOR_INDEXES:
+ return 3;
+ case GL_EMISSION:
+ return 4;
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_AMBIENT_AND_DIFFUSE:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetMaterialiv_size(GLenum pname)
+{
+ return __glGetMaterialfv_size(pname);
+}
+
+GLint __glGetPixelMap_size(GLenum map)
+{
+ GLint size;
+ GLenum query;
+
+ switch (map) {
+ case GL_PIXEL_MAP_I_TO_I:
+ query = GL_PIXEL_MAP_I_TO_I_SIZE;
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ query = GL_PIXEL_MAP_S_TO_S_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_R:
+ query = GL_PIXEL_MAP_I_TO_R_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_G:
+ query = GL_PIXEL_MAP_I_TO_G_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_B:
+ query = GL_PIXEL_MAP_I_TO_B_SIZE;
+ break;
+ case GL_PIXEL_MAP_I_TO_A:
+ query = GL_PIXEL_MAP_I_TO_A_SIZE;
+ break;
+ case GL_PIXEL_MAP_R_TO_R:
+ query = GL_PIXEL_MAP_R_TO_R_SIZE;
+ break;
+ case GL_PIXEL_MAP_G_TO_G:
+ query = GL_PIXEL_MAP_G_TO_G_SIZE;
+ break;
+ case GL_PIXEL_MAP_B_TO_B:
+ query = GL_PIXEL_MAP_B_TO_B_SIZE;
+ break;
+ case GL_PIXEL_MAP_A_TO_A:
+ query = GL_PIXEL_MAP_A_TO_A_SIZE;
+ break;
+ default:
+ return -1;
+ }
+ glGetIntegerv(query, &size);
+ return size;
+}
+
+GLint __glGetPixelMapfv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+GLint __glGetPixelMapuiv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+GLint __glGetPixelMapusv_size(GLenum map)
+{
+ return __glGetPixelMap_size(map);
+}
+
+/*
+** Return the number of words needed to pass back the requested
+** value.
+*/
+GLint __glGet_size(GLenum sq)
+{
+ switch (sq) {
+ case GL_MAX_TEXTURE_SIZE:
+ return 1;
+ case GL_SUBPIXEL_BITS:
+ return 1;
+ case GL_MAX_LIST_NESTING:
+ return 1;
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_INDEX:
+ case GL_MAP1_NORMAL:
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_VERTEX_4:
+ return 1;
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_INDEX:
+ case GL_MAP2_NORMAL:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_VERTEX_4:
+ return 1;
+ case GL_AUTO_NORMAL:
+ return 1;
+ case GL_CURRENT_COLOR:
+ return 4;
+ case GL_CURRENT_INDEX:
+ return 1;
+ case GL_CURRENT_NORMAL:
+ return 3;
+ case GL_CURRENT_TEXTURE_COORDS:
+ return 4;
+ case GL_CURRENT_RASTER_INDEX:
+ return 1;
+ case GL_CURRENT_RASTER_COLOR:
+ return 4;
+ case GL_CURRENT_RASTER_TEXTURE_COORDS:
+ return 4;
+ case GL_CURRENT_RASTER_POSITION:
+ return 4;
+ case GL_CURRENT_RASTER_POSITION_VALID:
+ return 1;
+ case GL_CURRENT_RASTER_DISTANCE:
+ return 1;
+ case GL_POINT_SIZE:
+ return 1;
+ case GL_POINT_SIZE_RANGE:
+ return 2;
+ case GL_POINT_SIZE_GRANULARITY:
+ return 1;
+ case GL_POINT_SMOOTH:
+ return 1;
+ case GL_LINE_SMOOTH:
+ return 1;
+ case GL_LINE_WIDTH:
+ return 1;
+ case GL_LINE_WIDTH_RANGE:
+ return 2;
+ case GL_LINE_WIDTH_GRANULARITY:
+ return 1;
+ case GL_LINE_STIPPLE_PATTERN:
+ return 1;
+ case GL_LINE_STIPPLE_REPEAT:
+ return 1;
+ case GL_LINE_STIPPLE:
+ return 1;
+ case GL_POLYGON_MODE:
+ return 2;
+ case GL_POLYGON_SMOOTH:
+ return 1;
+ case GL_POLYGON_STIPPLE:
+ return 1;
+ case GL_EDGE_FLAG:
+ return 1;
+ case GL_CULL_FACE:
+ return 1;
+ case GL_CULL_FACE_MODE:
+ return 1;
+ case GL_FRONT_FACE:
+ return 1;
+ case GL_LIGHTING:
+ return 1;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ return 1;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return 1;
+ case GL_LIGHT_MODEL_AMBIENT:
+ return 4;
+ case GL_COLOR_MATERIAL:
+ return 1;
+ case GL_COLOR_MATERIAL_FACE:
+ return 1;
+ case GL_COLOR_MATERIAL_PARAMETER:
+ return 1;
+ case GL_SHADE_MODEL:
+ return 1;
+ case GL_FOG:
+ return 1;
+ case GL_FOG_INDEX:
+ return 1;
+ case GL_FOG_DENSITY:
+ return 1;
+ case GL_FOG_START:
+ return 1;
+ case GL_FOG_END:
+ return 1;
+ case GL_FOG_MODE:
+ return 1;
+ case GL_FOG_COLOR:
+ return 4;
+ case GL_DEPTH_RANGE:
+ return 2;
+ case GL_DEPTH_TEST:
+ return 1;
+ case GL_DEPTH_WRITEMASK:
+ return 1;
+ case GL_DEPTH_CLEAR_VALUE:
+ return 1;
+ case GL_DEPTH_FUNC:
+ return 1;
+ case GL_ACCUM_CLEAR_VALUE:
+ return 4;
+ case GL_STENCIL_TEST:
+ return 1;
+ case GL_STENCIL_CLEAR_VALUE:
+ return 1;
+ case GL_STENCIL_FUNC:
+ return 1;
+ case GL_STENCIL_VALUE_MASK:
+ return 1;
+ case GL_STENCIL_FAIL:
+ return 1;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ return 1;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ return 1;
+ case GL_STENCIL_REF:
+ return 1;
+ case GL_STENCIL_WRITEMASK:
+ return 1;
+ case GL_MATRIX_MODE:
+ return 1;
+ case GL_NORMALIZE:
+ return 1;
+ case GL_VIEWPORT:
+ return 4;
+ case GL_ATTRIB_STACK_DEPTH:
+ return 1;
+ case GL_MODELVIEW_STACK_DEPTH:
+ return 1;
+ case GL_PROJECTION_STACK_DEPTH:
+ return 1;
+ case GL_TEXTURE_STACK_DEPTH:
+ return 1;
+ case GL_MODELVIEW_MATRIX:
+ return 16;
+ case GL_PROJECTION_MATRIX:
+ return 16;
+ case GL_TEXTURE_MATRIX:
+ return 16;
+ case GL_ALPHA_TEST:
+ return 1;
+ case GL_ALPHA_TEST_FUNC:
+ return 1;
+ case GL_ALPHA_TEST_REF:
+ return 1;
+ case GL_DITHER:
+ return 1;
+ case GL_BLEND_DST:
+ return 1;
+ case GL_BLEND_SRC:
+ return 1;
+ case GL_BLEND:
+ return 1;
+ case GL_LOGIC_OP_MODE:
+ return 1;
+ case GL_LOGIC_OP:
+ return 1;
+ case GL_DRAW_BUFFER:
+ return 1;
+ case GL_READ_BUFFER:
+ return 1;
+ case GL_SCISSOR_TEST:
+ return 1;
+ case GL_SCISSOR_BOX:
+ return 4;
+ case GL_INDEX_CLEAR_VALUE:
+ return 1;
+ case GL_INDEX_MODE:
+ return 1;
+ case GL_INDEX_WRITEMASK:
+ return 1;
+ case GL_COLOR_CLEAR_VALUE:
+ return 4;
+ case GL_RGBA_MODE:
+ return 1;
+ case GL_COLOR_WRITEMASK:
+ return 4;
+ case GL_RENDER_MODE:
+ return 1;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ return 1;
+ case GL_POINT_SMOOTH_HINT:
+ return 1;
+ case GL_LINE_SMOOTH_HINT:
+ return 1;
+ case GL_POLYGON_SMOOTH_HINT:
+ return 1;
+ case GL_FOG_HINT:
+ return 1;
+ case GL_LIST_BASE:
+ return 1;
+ case GL_LIST_INDEX:
+ return 1;
+ case GL_LIST_MODE:
+ return 1;
+ case GL_TEXTURE_GEN_S:
+ return 1;
+ case GL_TEXTURE_GEN_T:
+ return 1;
+ case GL_TEXTURE_GEN_R:
+ return 1;
+ case GL_TEXTURE_GEN_Q:
+ return 1;
+ case GL_PACK_SWAP_BYTES:
+ return 1;
+ case GL_PACK_LSB_FIRST:
+ return 1;
+ case GL_PACK_ROW_LENGTH:
+ return 1;
+ case GL_PACK_SKIP_ROWS:
+ return 1;
+ case GL_PACK_SKIP_PIXELS:
+ return 1;
+ case GL_PACK_ALIGNMENT:
+ return 1;
+ case GL_UNPACK_SWAP_BYTES:
+ return 1;
+ case GL_UNPACK_LSB_FIRST:
+ return 1;
+ case GL_UNPACK_ROW_LENGTH:
+ return 1;
+ case GL_UNPACK_SKIP_ROWS:
+ return 1;
+ case GL_UNPACK_SKIP_PIXELS:
+ return 1;
+ case GL_UNPACK_ALIGNMENT:
+ return 1;
+ case GL_MAP_COLOR:
+ return 1;
+ case GL_MAP_STENCIL:
+ return 1;
+ case GL_INDEX_SHIFT:
+ return 1;
+ case GL_INDEX_OFFSET:
+ return 1;
+ case GL_RED_SCALE:
+ case GL_GREEN_SCALE:
+ case GL_BLUE_SCALE:
+ case GL_ALPHA_SCALE:
+ case GL_DEPTH_SCALE:
+ return 1;
+ case GL_RED_BIAS:
+ case GL_GREEN_BIAS:
+ case GL_BLUE_BIAS:
+ case GL_ALPHA_BIAS:
+ case GL_DEPTH_BIAS:
+ return 1;
+ case GL_ZOOM_X:
+ case GL_ZOOM_Y:
+ return 1;
+ case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE:
+ case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE:
+ case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE:
+ case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE:
+ case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE:
+ return 1;
+ case GL_MAX_EVAL_ORDER:
+ return 1;
+ case GL_MAX_LIGHTS:
+ return 1;
+ case GL_MAX_CLIP_PLANES:
+ return 1;
+ case GL_MAX_PIXEL_MAP_TABLE:
+ return 1;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ return 1;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ return 1;
+ case GL_MAX_NAME_STACK_DEPTH:
+ return 1;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ return 1;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ return 1;
+ case GL_INDEX_BITS:
+ return 1;
+ case GL_RED_BITS:
+ return 1;
+ case GL_GREEN_BITS:
+ return 1;
+ case GL_BLUE_BITS:
+ return 1;
+ case GL_ALPHA_BITS:
+ return 1;
+ case GL_DEPTH_BITS:
+ return 1;
+ case GL_STENCIL_BITS:
+ return 1;
+ case GL_ACCUM_RED_BITS:
+ case GL_ACCUM_GREEN_BITS:
+ case GL_ACCUM_BLUE_BITS:
+ case GL_ACCUM_ALPHA_BITS:
+ return 1;
+ case GL_MAP1_GRID_DOMAIN:
+ return 2;
+ case GL_MAP1_GRID_SEGMENTS:
+ return 1;
+ case GL_MAP2_GRID_DOMAIN:
+ return 4;
+ case GL_MAP2_GRID_SEGMENTS:
+ return 2;
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ return 1;
+ case GL_NAME_STACK_DEPTH:
+ return 1;
+ case GL_MAX_VIEWPORT_DIMS:
+ return 2;
+ case GL_DOUBLEBUFFER:
+ return 1;
+ case GL_AUX_BUFFERS:
+ return 1;
+ case GL_STEREO:
+ return 1;
+ case GL_CLIP_PLANE0: case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2: case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4: case GL_CLIP_PLANE5:
+ return 1;
+ case GL_LIGHT0: case GL_LIGHT1:
+ case GL_LIGHT2: case GL_LIGHT3:
+ case GL_LIGHT4: case GL_LIGHT5:
+ case GL_LIGHT6: case GL_LIGHT7:
+ return 1;
+ case GL_VERTEX_ARRAY:
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_VERTEX_ARRAY_TYPE:
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY:
+ case GL_NORMAL_ARRAY_TYPE:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_TYPE:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_INDEX_ARRAY:
+ case GL_INDEX_ARRAY_TYPE:
+ case GL_INDEX_ARRAY_STRIDE:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ case GL_EDGE_FLAG_ARRAY:
+ case GL_EDGE_FLAG_ARRAY_STRIDE:
+ return 1;
+ case GL_TEXTURE_BINDING_1D:
+ case GL_TEXTURE_BINDING_2D:
+ return 1;
+ case GL_BLEND_COLOR_EXT:
+ return 4;
+ case GL_BLEND_EQUATION_EXT:
+ return 1;
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetDoublev_size(GLenum sq)
+{
+ return __glGet_size(sq);
+}
+
+GLint __glGetFloatv_size(GLenum sq)
+{
+ return __glGet_size(sq);
+}
+
+GLint __glGetIntegerv_size(GLenum sq)
+{
+ return __glGet_size(sq);
+}
+
+GLint __glGetBooleanv_size(GLenum sq)
+{
+ return __glGet_size(sq);
+}
+
+GLint __glGetTexLevelParameterfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_TEXTURE_WIDTH:
+ case GL_TEXTURE_HEIGHT:
+ case GL_TEXTURE_COMPONENTS:
+ case GL_TEXTURE_BORDER:
+ case GL_TEXTURE_RED_SIZE:
+ case GL_TEXTURE_GREEN_SIZE:
+ case GL_TEXTURE_BLUE_SIZE:
+ case GL_TEXTURE_ALPHA_SIZE:
+ case GL_TEXTURE_LUMINANCE_SIZE:
+ case GL_TEXTURE_INTENSITY_SIZE:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetTexLevelParameteriv_size(GLenum pname)
+{
+ return __glGetTexLevelParameterfv_size(pname);
+}
+
+GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
+ GLenum type, GLint width, GLint height)
+{
+ GLint elements, esize;
+ GLint padding, rowsize;
+
+ switch (format) {
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ default:
+ return -1;
+ }
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ default:
+ return -1;
+ }
+ /*
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
+ rowsize = width * elements * esize;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ return (rowsize * height);
+}
diff --git a/xc/programs/Xserver/GL/glx/singlesize.h b/xc/programs/Xserver/GL/glx/singlesize.h
new file mode 100644
index 000000000..97381639a
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/singlesize.h
@@ -0,0 +1,58 @@
+#ifndef _singlesize_h_
+#define _singlesize_h_
+
+/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+extern GLint __glReadPixels_size(GLenum format, GLenum type,
+ GLint width, GLint height);
+extern GLint __glGetTexEnvfv_size(GLenum pname);
+extern GLint __glGetTexEnviv_size(GLenum pname);
+extern GLint __glGetTexGenfv_size(GLenum pname);
+extern GLint __glGetTexGendv_size(GLenum pname);
+extern GLint __glGetTexGeniv_size(GLenum pname);
+extern GLint __glGetTexParameterfv_size(GLenum pname);
+extern GLint __glGetTexParameteriv_size(GLenum pname);
+extern GLint __glGetLightfv_size(GLenum pname);
+extern GLint __glGetLightiv_size(GLenum pname);
+extern GLint __glGetMap_size(GLenum pname, GLenum query);
+extern GLint __glGetMapdv_size(GLenum target, GLenum query);
+extern GLint __glGetMapfv_size(GLenum target, GLenum query);
+extern GLint __glGetMapiv_size(GLenum target, GLenum query);
+extern GLint __glGetMaterialfv_size(GLenum pname);
+extern GLint __glGetMaterialiv_size(GLenum pname);
+extern GLint __glGetPixelMap_size(GLenum map);
+extern GLint __glGetPixelMapfv_size(GLenum map);
+extern GLint __glGetPixelMapuiv_size(GLenum map);
+extern GLint __glGetPixelMapusv_size(GLenum map);
+extern GLint __glGet_size(GLenum sq);
+extern GLint __glGetDoublev_size(GLenum sq);
+extern GLint __glGetFloatv_size(GLenum sq);
+extern GLint __glGetIntegerv_size(GLenum sq);
+extern GLint __glGetBooleanv_size(GLenum sq);
+extern GLint __glGetTexLevelParameterfv_size(GLenum pname);
+extern GLint __glGetTexLevelParameteriv_size(GLenum pname);
+extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
+ GLenum type, GLint width, GLint height);
+
+#endif /* _singlesize_h_ */
+
diff --git a/xc/programs/Xserver/GL/glx/unpack.h b/xc/programs/Xserver/GL/glx/unpack.h
new file mode 100644
index 000000000..80a805aab
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/unpack.h
@@ -0,0 +1,219 @@
+#ifndef __GLX_unpack_h__
+#define __GLX_unpack_h__
+
+/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define __GLX_PAD(s) (((s)+3) & (GLuint)~3)
+
+/*
+** Fetch the context-id out of a SingleReq request pointed to by pc.
+*/
+#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
+#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
+
+/*
+** Fetch a double from potentially unaligned memory.
+*/
+#ifdef __GLX_ALIGN64
+#define __GLX_MEM_COPY(dst,src,n) memcpy(dst,src,n)
+#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
+#else
+#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
+#endif
+
+extern void __glXMemInit();
+
+extern xGLXSingleReply __glXReply;
+
+#define __GLX_BEGIN_REPLY(size) \
+ __glXReply.length = __GLX_PAD(size) >> 2; \
+ __glXReply.type = X_Reply; \
+ __glXReply.sequenceNumber = client->sequence;
+
+#define __GLX_SEND_HEADER() \
+ WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
+
+#define __GLX_PUT_RETVAL(a) \
+ __glXReply.retval = (a);
+
+#define __GLX_PUT_SIZE(a) \
+ __glXReply.size = (a);
+
+#define __GLX_PUT_RENDERMODE(m) \
+ __glXReply.pad3 = (m)
+
+/*
+** Get a buffer to hold returned data, with the given alignment. If we have
+** to realloc, allocate size+align, in case the pointer has to be bumped for
+** alignment. The answerBuffer should already be aligned.
+**
+** NOTE: the cast (long)res below assumes a long is large enough to hold a
+** pointer.
+*/
+#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
+ if ((size) > sizeof(answerBuffer)) { \
+ int bump; \
+ if ((cl)->returnBufSize < (size)+(align)) { \
+ (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \
+ (size)+(align)); \
+ if (!(cl)->returnBuf) { \
+ return BadAlloc; \
+ } \
+ (cl)->returnBufSize = (size)+(align); \
+ } \
+ res = (char*)cl->returnBuf; \
+ bump = (long)(res) % (align); \
+ if (bump) res += (align) - (bump); \
+ } else { \
+ res = (char *)answerBuffer; \
+ }
+
+#define __GLX_PUT_BYTE() \
+ *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer
+
+#define __GLX_PUT_SHORT() \
+ *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer
+
+#define __GLX_PUT_INT() \
+ *(GLint *)&__glXReply.pad3 = *(GLint *)answer
+
+#define __GLX_PUT_FLOAT() \
+ *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer
+
+#define __GLX_PUT_DOUBLE() \
+ *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
+
+#define __GLX_SEND_BYTE_ARRAY(len) \
+ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
+
+#define __GLX_SEND_SHORT_ARRAY(len) \
+ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
+
+#define __GLX_SEND_INT_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
+
+#define __GLX_SEND_FLOAT_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
+
+#define __GLX_SEND_DOUBLE_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
+
+
+#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
+#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
+#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
+#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
+
+/*
+** PERFORMANCE NOTE:
+** Machine dependent optimizations abound here; these swapping macros can
+** conceivably be replaced with routines that do the job faster.
+*/
+#define __GLX_DECLARE_SWAP_VARIABLES \
+ GLbyte sw; \
+ GLbyte *swapPC; \
+ GLbyte *swapEnd
+
+#define __GLX_SWAP_INT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = sw;
+
+#define __GLX_SWAP_SHORT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = sw;
+
+#define __GLX_SWAP_DOUBLE(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \
+ ((GLbyte *)(pc))[7] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \
+ ((GLbyte *)(pc))[6] = sw; \
+ sw = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \
+ ((GLbyte *)(pc))[5] = sw; \
+ sw = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \
+ ((GLbyte *)(pc))[4] = sw;
+
+#define __GLX_SWAP_FLOAT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = sw;
+
+#define __GLX_SWAP_INT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_INT(swapPC); \
+ swapPC += __GLX_SIZE_INT32; \
+ }
+
+#define __GLX_SWAP_SHORT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_SHORT(swapPC); \
+ swapPC += __GLX_SIZE_INT16; \
+ }
+
+#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_DOUBLE(swapPC); \
+ swapPC += __GLX_SIZE_FLOAT64; \
+ }
+
+#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_FLOAT(swapPC); \
+ swapPC += __GLX_SIZE_FLOAT32; \
+ }
+
+#define __GLX_SWAP_REPLY_HEADER() \
+ __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \
+ __GLX_SWAP_INT(&__glXReply.length);
+
+#define __GLX_SWAP_REPLY_RETVAL() \
+ __GLX_SWAP_INT(&__glXReply.retval)
+
+#define __GLX_SWAP_REPLY_SIZE() \
+ __GLX_SWAP_INT(&__glXReply.size)
+
+#endif /* !__GLX_unpack_h__ */
+
+
+
+
+
diff --git a/xc/programs/Xserver/GL/glx/xfont.c b/xc/programs/Xserver/GL/glx/xfont.c
new file mode 100644
index 000000000..8bf6e8116
--- /dev/null
+++ b/xc/programs/Xserver/GL/glx/xfont.c
@@ -0,0 +1,177 @@
+/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.2 1999/06/14 07:31:36 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxutil.h"
+#include "g_disptab.h"
+#include <unpack.h>
+#include <GL/gl.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include <dixfontstr.h>
+
+extern XID clientErrorValue; /* imported kludge from dix layer */
+
+/*
+** Make a single GL bitmap from a single X glyph
+*/
+static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
+{
+ int i, j;
+ int widthPadded; /* width of glyph in bytes, as padded by X */
+ int allocBytes; /* bytes to allocate to store bitmap */
+ int w; /* width of glyph in bits */
+ int h; /* height of glyph */
+ register unsigned char *pglyph;
+ register unsigned char *p;
+ unsigned char *allocbuf;
+#define __GL_CHAR_BUF_SIZE 2048
+ unsigned char buf[__GL_CHAR_BUF_SIZE];
+
+ w = GLYPHWIDTHPIXELS(pci);
+ h = GLYPHHEIGHTPIXELS(pci);
+ widthPadded = GLYPHWIDTHBYTESPADDED(pci);
+
+ /*
+ ** Use the local buf if possible, otherwise malloc.
+ */
+ allocBytes = widthPadded * h;
+ if (allocBytes <= __GL_CHAR_BUF_SIZE) {
+ p = buf;
+ allocbuf = 0;
+ } else {
+ p = (unsigned char *) __glXMalloc(allocBytes);
+ if (!p)
+ return BadAlloc;
+ allocbuf = p;
+ }
+
+ /*
+ ** We have to reverse the picture, top to bottom
+ */
+
+ pglyph = FONTGLYPHBITS(FONTGLYPHS(font), pci) + (h-1)*widthPadded;
+ for (j=0; j < h; j++) {
+ for (i=0; i < widthPadded; i++) {
+ p[i] = pglyph[i];
+ }
+ pglyph -= widthPadded;
+ p += widthPadded;
+ }
+ glBitmap(w, h, -pci->metrics.leftSideBearing, pci->metrics.descent,
+ pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf);
+
+ if (allocbuf) {
+ __glXFree(allocbuf);
+ }
+ return Success;
+#undef __GL_CHAR_BUF_SIZE
+}
+
+/*
+** Create a GL bitmap for each character in the X font. The bitmap is stored
+** in a display list.
+*/
+
+static int
+MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
+{
+ unsigned long i, nglyphs;
+ CARD8 chs[2]; /* the font index we are going after */
+ CharInfoPtr pci;
+ int rv; /* return value */
+ int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit;
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, FALSE);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, GLYPHPADBYTES);
+ for (i=0; i < count; i++) {
+ chs[0] = (first + i) >> 8; /* high byte is first byte */
+ chs[1] = first + i;
+
+ (*pFont->get_glyphs)(pFont, 1, chs, (FontEncoding)encoding,
+ &nglyphs, &pci);
+
+ /*
+ ** Define a display list containing just a glBitmap() call.
+ */
+ glNewList(list_base + i, GL_COMPILE);
+ if (nglyphs ) {
+ rv = __glXMakeBitmapFromGlyph(pFont, pci);
+ if (rv) {
+ return rv;
+ }
+ }
+ glEndList();
+ }
+ return Success;
+}
+
+/************************************************************************/
+
+int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXUseXFontReq *req;
+ FontPtr pFont;
+ GC *pGC;
+ GLuint currentListIndex;
+ __GLXcontext *cx;
+ int error;
+
+ req = (xGLXUseXFontReq *) pc;
+ cx = __glXForceCurrent(cl, req->contextTag, &error);
+ if (!cx) {
+ return error;
+ }
+
+ glGetIntegerv(GL_LIST_INDEX, (GLint*) &currentListIndex);
+ if (currentListIndex != 0) {
+ /*
+ ** A display list is currently being made. It is an error
+ ** to try to make a font during another lists construction.
+ */
+ client->errorValue = cx->id;
+ return __glXBadContextState;
+ }
+
+ /*
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
+ pFont = (FontPtr)LookupIDByType(req->font, RT_FONT);
+ if (!pFont) {
+ pGC = (GC *)LookupIDByType(req->font, RT_GC);
+ if (!pGC) {
+ client->errorValue = req->font;
+ return BadFont;
+ }
+ pFont = pGC->font;
+ }
+
+ return MakeBitmapsFromFont(pFont, req->first, req->count,
+ req->listBase);
+}
diff --git a/xc/programs/Xserver/GL/glxmodule.c b/xc/programs/Xserver/GL/glxmodule.c
new file mode 100644
index 000000000..715c9fc72
--- /dev/null
+++ b/xc/programs/Xserver/GL/glxmodule.c
@@ -0,0 +1,96 @@
+
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+/* $XFree86: xc/programs/Xserver/GL/glxmodule.c,v 1.5 1999/06/14 07:31:19 dawes Exp $ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/glxmodule.c,v 1.10 1999/06/08 11:01:04 faith Exp $
+ */
+
+#include "xf86Module.h"
+#include "colormap.h"
+#include "micmap.h"
+
+static MODULESETUPPROTO(glxSetup);
+
+extern void GlxExtensionInit(INITARGS);
+extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+extern void InitGlxWrapInitVisuals(void (*f)(miInitVisualsProcPtr *));
+
+ExtensionModule GLXExt =
+{
+ GlxExtensionInit,
+ "GLX",
+ NULL,
+ NULL
+};
+
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "glx",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
+
+static pointer
+glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ pointer GLcore = NULL;
+#ifdef GLX_USE_SGI_SI
+ char GLcoreName[] = "libGL";
+#else
+ char GLcoreName[] = "libGLcore";
+#endif
+
+ LoadExtension(&GLXExt);
+
+ /* Wrap the init visuals routine in micmap.c */
+ GlxWrapInitVisuals(&miInitVisualsProc);
+ /* Make sure this gets wrapped each time InitVisualWrap is called. */
+ miHookInitVisuals(NULL, GlxWrapInitVisuals);
+
+ GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+ if (!GLcore)
+ ErrorF("Cannot load the GL core library: %s\n", GLcoreName);
+
+ /* Need a non-NULL return value to indicate success */
+ return GLcore;
+}
diff --git a/xc/programs/Xserver/GL/include/GL/glx_ansic.h b/xc/programs/Xserver/GL/include/GL/glx_ansic.h
new file mode 100644
index 000000000..e6ccd3a2f
--- /dev/null
+++ b/xc/programs/Xserver/GL/include/GL/glx_ansic.h
@@ -0,0 +1,164 @@
+#ifndef _glx_ansic_h_
+#define _glx_ansic_h_
+
+/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.3 1999/07/11 08:49:18 dawes Exp $ */
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+** $SGI$
+*/
+
+/*
+** this needs to check whether we're using XFree86 at all, and then
+** which version we're using. Use these macros if version is 3.9+, else
+** use normal commands below.
+*/
+
+/*
+** turns out this include file only exists for XFree86 3.9+
+** I notice that not having it is not an error and does not stop the build,
+** but having it will allow opengl and glx to be built for 3.9+. We no longer
+** need an explicit define in the Makefile, just point to the correct X source
+** tree and all should be taken care of.
+*/
+
+#ifdef XFree86Server
+#include <xf86Version.h>
+#define XF_Minimum_Version ( (3 * 10) + (9) )
+#define XF_Version ( (XF86_VERSION_MAJOR * 10) + (XF86_VERSION_MINOR) )
+#endif
+
+#if defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version)
+#include "xf86_ansic.h"
+#else
+#endif
+
+#if 0 && defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version)
+
+#include "xf86Module.h"
+
+/*
+** I'm not sure if this is entirely correct. xf86_ansic needs to be told
+** whether to include these definitions or not. Near as I can tell, a
+** necessary define is included when XFree86 is built (as part of the build).
+** When we build the glx server, this define isn't present. I don't recall
+** having to do this before, but this seems to work. Perhaps I just need to
+** include the proper header file, but I can't find it. Anyways, if need be
+** this can be fixed later, but works for now...
+** I'm specifically refering to NEED_XF86_TYPES being declared here.
+*/
+
+#define NEED_XF86_TYPES
+#include "xf86_ansic.h"
+
+#define GLX_STDOUT xf86stdout
+#define GLX_STDERR xf86stderr
+#define __glXPrintf xf86printf
+#define __glXFprintf xf86fprintf
+#define __glXSprintf xf86sprintf
+#define __glXVfprintf xf86vfprintf
+#define __glXVsprintf xf86vsprintf
+#define __glXFopen xf86fopen
+#define __glXFclose xf86fclose
+#define __glXCos(x) xf86cos(x)
+#define __glXSin(x) xf86sin(x)
+#define __glXAtan(x) xf86atan(x)
+#define __glXAbs(x) xf86abs(x)
+#define __glXLog(x) xf86log(x)
+#define __glXCeil(x) xf86ceil(x)
+#define __glXFloor(x) xf86floor(x)
+#define __glXSqrt(x) xf86sqrt(x)
+#define __glXPow(x, y) xf86pow(x, y)
+#define __glXMemmove(dest, src, n) xf86memmove(dest, src, n)
+#define __glXMemcpy(dest, src, n) xf86memcpy(dest, src, n)
+#define __glXMemset(s, c, n) xf86memset(s, c, n)
+#define __glXStrdup(str) xf86strdup(str)
+#define __glXStrcpy(dest, src) xf86strcpy(dest, src)
+#define __glXStrncpy(dest, src, n) xf86strncpy(dest, src, n)
+#define __glXStrcat(dest, src) xf86strcat(dest, src)
+#define __glXStrncat(dest, src, n) xf86strncat(dest, src, n)
+#define __glXStrcmp(s1, s2) xf86strcmp(s1, s2)
+#define __glXStrncmp(s1, s2, n) xf86strncmp(s1, s2, n)
+#define __glXStrlen(str) xf86strlen(str)
+#define __glXAbort() xf86abort()
+#define __glXStrtok(s, delim) xf86strtok(s, delim)
+#define __glXStrcspn(s, reject) xf86strcspn(s, reject)
+#define __glXGetenv(a) xf86getenv(a)
+
+#ifndef assert
+#define assert(a)
+#endif
+
+#else
+
+/*
+** Either not a loadable module, or pre X3.9
+*/
+
+/* assert() is named __assert() in the LynxOS libc. We might get
+ * unresolved externals if we #undef assert and include assert.h
+ * if assert.h was already included on our way here....
+ */
+#if defined(Lynx) && defined(__assert_h)
+#undef __assert_h
+#endif
+
+#ifdef assert
+#undef assert
+#endif
+
+#include <assert.h>
+
+#define GLX_STDOUT stdout
+#define GLX_STDERR stderr
+#define __glXPrintf printf
+#define __glXFprintf fprintf
+#define __glXSprintf sprintf
+#define __glXVfprintf vfprintf
+#define __glXVsprintf vsprintf
+#define __glXFopen fopen
+#define __glXFclose fclose
+#define __glXCos(x) cos(x)
+#define __glXSin(x) sin(x)
+#define __glXAtan(x) atan(x)
+#define __glXAbs(x) abs(x)
+#define __glXLog(x) log(x)
+#define __glXCeil(x) ceil(x)
+#define __glXFloor(x) floor(x)
+#define __glXSqrt(x) sqrt(x)
+#define __glXPow(x, y) pow(x, y)
+#define __glXMemmove(dest, src, n) memmove(dest, src, n)
+#define __glXMemcpy(dest, src, n) memcpy(dest, src, n)
+#define __glXMemset(s, c, n) memset(s, c, n)
+#define __glXStrdup(str) strdup(str)
+#define __glXStrcpy(dest, src) strcpy(dest, src)
+#define __glXStrncpy(dest, src, n) strncpy(dest, src, n)
+#define __glXStrcat(dest, src) strcat(dest, src)
+#define __glXStrncat(dest, src, n) strncat(dest, src, n)
+#define __glXStrcmp(s1, s2) strcmp(s1, s2)
+#define __glXStrncmp(s1, s2, n) strncmp(s1, s2, n)
+#define __glXStrlen(str) strlen(str)
+#define __glXAbort() abort()
+#define __glXStrtok(s, delim) strtok(s, delim)
+#define __glXStrcspn(s, reject) strcspn(s, reject)
+#define __glXGetenv(a) getenv(a)
+
+#endif
+
+#endif /* _glx_ansic_h_ */
+
diff --git a/xc/programs/Xserver/GL/include/GL/xf86glx.h b/xc/programs/Xserver/GL/include/GL/xf86glx.h
new file mode 100644
index 000000000..f8a668cd1
--- /dev/null
+++ b/xc/programs/Xserver/GL/include/GL/xf86glx.h
@@ -0,0 +1,40 @@
+/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.6 1999/06/10 00:31:50 martin Exp $
+ */
+
+#include "miscstruct.h"
+
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
diff --git a/xc/programs/Xserver/GL/mesa/Imakefile b/xc/programs/Xserver/GL/mesa/Imakefile
new file mode 100644
index 000000000..397cb646d
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/Imakefile
@@ -0,0 +1,15 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.3 1999/06/14 14:37:12 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/mesa/Imakefile,v 1.3 1999/03/15 17:11:59 martin Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+ SUBDIRS = include src
+ DEFINES = $(GLX_DEFINES)
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile
new file mode 100644
index 000000000..03769a520
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile
@@ -0,0 +1,13 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.2 1999/06/14 07:31:42 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.6 1999/03/15 21:36:09 martin Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+ DEFINES = $(GLX_DEFINES)
+
+LinkSourceFile(gl.h,../../../../../../lib/GL/mesa/include/GL)
+LinkSourceFile(glx.h,../../../../../../lib/GL/mesa/include/GL)
+LinkSourceFile(xmesa.h,../../../../../../lib/GL/mesa/include/GL)
+LinkSourceFile(xmesa_x.h,../../../../../../lib/GL/mesa/include/GL)
+LinkSourceFile(xmesa_xf86.h,../../../../../../lib/GL/mesa/include/GL)
diff --git a/xc/programs/Xserver/GL/mesa/include/Imakefile b/xc/programs/Xserver/GL/mesa/include/Imakefile
new file mode 100644
index 000000000..c42ca7c75
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/include/Imakefile
@@ -0,0 +1,15 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/Imakefile,v 1.2 1999/06/14 07:31:41 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/mesa/include/Imakefile,v 1.4 1999/03/15 21:36:09 martin Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+ SUBDIRS = GL
+ DEFINES = $(GLX_DEFINES)
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/GL/mesa/src/GLcoremodule.c b/xc/programs/Xserver/GL/mesa/src/GLcoremodule.c
new file mode 100644
index 000000000..c112e9fe9
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/GLcoremodule.c
@@ -0,0 +1,61 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/GLcoremodule.c,v 1.3 1999/06/14 07:31:42 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/mesa/src/GLcoremodule.c,v 1.6 1999/05/27 03:43:46 jens Exp $
+ */
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(GLcoreSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "GLcore",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+XF86ModuleData libGLcoreModuleData = { &VersRec, GLcoreSetup, NULL };
+
+static pointer
+GLcoreSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile
new file mode 100644
index 000000000..01afa639b
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/Imakefile
@@ -0,0 +1,204 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.4 1999/08/14 10:49:23 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.9 1999/05/27 03:43:46 jens Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+ SUBDIRS = X
+
+LinkSourceFile(accum.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(accum.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(all.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(alpha.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(alpha.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(alphabuf.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(alphabuf.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(api.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(api1.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(api2.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(apiext.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(asm_386.S,../../../../../lib/GL/mesa/src)
+LinkSourceFile(asm_386.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(asm_mmx.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(asm_mmx.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(attrib.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(attrib.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(bitmap.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(bitmap.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(blend.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(blend.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(clip.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(clip.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(colortab.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(colortab.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(config.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(context.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(context.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(copypix.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(copypix.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(dd.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(ddsample.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(depth.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(depth.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(dlist.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(dlist.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(drawpix.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(drawpix.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(enable.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(enable.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(eval.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(eval.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(feedback.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(feedback.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(fixed.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(fog.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(fog.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(get.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(get.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(glmisc.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(glmisc.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(hash.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(hash.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(image.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(image.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(light.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(light.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(lines.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(lines.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(linetemp.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(lnaatemp.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(logic.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(logic.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(macros.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(masking.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(masking.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(matrix.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(matrix.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mesa_api.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mesa_api_wrap.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mmath.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mmath.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mthreads.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(mthreads.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pb.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pb.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pixel.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pixel.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pointers.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(pointers.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(points.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(points.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(polygon.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(polygon.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(quads.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(quads.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(rastpos.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(rastpos.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(readpix.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(readpix.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(rect.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(rect.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(scissor.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(scissor.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(shade.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(shade.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(span.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(span.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(stencil.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(stencil.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(teximage.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(teximage.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texobj.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texobj.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texstate.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texstate.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texture.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(texture.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(triangle.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(triangle.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(tritemp.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(types.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(varray.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(varray.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vb.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vb.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbfill.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbfill.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbrender.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbrender.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbxform.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(vbxform.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(winpos.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(winpos.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(xform.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(xform.h,../../../../../lib/GL/mesa/src)
+LinkSourceFile(zoom.c,../../../../../lib/GL/mesa/src)
+LinkSourceFile(zoom.h,../../../../../lib/GL/mesa/src)
+
+ CORE_SRCS = accum.c alpha.c alphabuf.c api1.c api2.c apiext.c \
+ attrib.c bitmap.c blend.c clip.c colortab.c context.c \
+ copypix.c depth.c dlist.c drawpix.c enable.c eval.c \
+ feedback.c fog.c get.c glmisc.c hash.c image.c light.c \
+ lines.c logic.c masking.c matrix.c mmath.c mthreads.c \
+ pb.c pixel.c points.c pointers.c polygon.c quads.c \
+ rastpos.c readpix.c rect.c scissor.c shade.c span.c \
+ stencil.c teximage.c texobj.c texstate.c texture.c \
+ triangle.c varray.c winpos.c vb.c vbfill.c vbrender.c \
+ vbxform.c xform.c zoom.c
+ CORE_OBJS = accum.o alpha.o alphabuf.o api1.o api2.o apiext.o \
+ attrib.o bitmap.o blend.o clip.o colortab.o context.o \
+ copypix.o depth.o dlist.o drawpix.o enable.o eval.o \
+ feedback.o fog.o get.o glmisc.o hash.o image.o light.o \
+ lines.o logic.o masking.o matrix.o mmath.o mthreads.o \
+ pb.o pixel.o points.o pointers.o polygon.o quads.o \
+ rastpos.o readpix.o rect.o scissor.o shade.o span.o \
+ stencil.o teximage.o texobj.o texstate.o texture.o \
+ triangle.o varray.o winpos.o vb.o vbfill.o vbrender.o \
+ vbxform.o xform.o zoom.o
+
+ ASM_SRCS = asm_386.S
+ ASM_OBJS = asm_386.o
+
+#if DoLoadableServer
+ MSRCS = GLcoremodule.c
+ MOBJS = GLcoremodule.o
+
+ XOBJS = X/?*.o
+#endif
+
+ SRCS = $(CORE_SRCS) /*$(ASM_SRCS)*/ $(MSRCS)
+ OBJS = $(CORE_OBJS) /*$(ASM_OBJS)*/ $(MOBJS)
+
+ INCLUDES = -I. -I../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I../../include -I../../glx
+ DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM */
+
+#if DoLoadableServer
+ DONES = X/DONE
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+ModuleObjectRule()
+
+DepLibraryModuleTarget(GLcore,$(SUBDIRS) $(DONES) $(OBJS),$(OBJS) $(XOBJS))
+InstallLibraryModule(GLcore,$(MODULEDIR),extensions)
+ForceSubdirs($(SUBDIRS))
+
+#else
+MakeSubdirs($(SUBDIRS))
+NormalLibraryTarget(GLcore,$(OBJS))
+NormalLibraryObjectRule()
+#endif
+
+DependTarget()
+
+InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions)
+
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
diff --git a/xc/programs/Xserver/GL/mesa/src/X/Imakefile b/xc/programs/Xserver/GL/mesa/src/X/Imakefile
new file mode 100644
index 000000000..2e2d27da0
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/X/Imakefile
@@ -0,0 +1,44 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.4 1999/06/14 07:31:43 dawes Exp $
+XCOMM $PI: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.6 1999/03/15 21:36:10 martin Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+LinkSourceFile(xmesa1.c,../../../../../../lib/GL/mesa/src/X)
+LinkSourceFile(xmesa2.c,../../../../../../lib/GL/mesa/src/X)
+LinkSourceFile(xmesa3.c,../../../../../../lib/GL/mesa/src/X)
+LinkSourceFile(xmesa4.c,../../../../../../lib/GL/mesa/src/X)
+LinkSourceFile(xmesaP.h,../../../../../../lib/GL/mesa/src/X)
+
+LinkSourceFile(compsize.c,../../../../../../lib/GL/glx)
+LinkSourceFile(size.h,../../../../../../lib/GL/glx)
+
+ DRIVER_SRCS = xmesa1.c xmesa2.c xmesa3.c xmesa4.c
+ DRIVER_OBJS = xmesa1.o xmesa2.o xmesa3.o xmesa4.o
+
+ GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c
+ GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o
+
+ SRCS = $(DRIVER_SRCS) $(GLX_SRCS)
+ OBJS = $(DRIVER_OBJS) $(GLX_OBJS)
+
+ INCLUDES = -I. -I.. -I../../include \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I../../../include -I../../../glx \
+ -I$(LIBSRC)/GL/include \
+ -I$(XF86SRC) -I$(XTOP)/include
+
+ DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/
+
+#if DoLoadableServer
+ModuleObjectRule()
+SubdirLibraryRule($(OBJS))
+#else
+NormalLibraryTarget(GLcoreX,$(OBJS))
+NormalLibraryObjectRule()
+#endif
+
+LintLibraryTarget(dri,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
new file mode 100644
index 000000000..6ab579535
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c
@@ -0,0 +1,926 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.4 1999/06/14 07:31:43 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.13 1999/06/10 00:54:25 martin Exp $
+ */
+
+#include <miscstruct.h>
+#include <resource.h>
+#include <GL/gl.h>
+#include <GL/glxint.h>
+#include <GL/glxtokens.h>
+#include <scrnintstr.h>
+#include <config.h>
+#include <glxserver.h>
+#include <glxscreens.h>
+#include <glxdrawable.h>
+#include <glxcontext.h>
+#include <glxext.h>
+#include <glxutil.h>
+#include "xf86glxint.h"
+#include "xmesaP.h"
+#include <GL/xf86glx.h>
+
+/*
+ * This define is for the glcore.h header file.
+ * If you add it here, then make sure you also add it in
+ * ../../../glx/Imakefile.
+ */
+#if 0
+#define DEBUG
+#include <GL/internal/glcore.h>
+#undef DEBUG
+#else
+#include <GL/internal/glcore.h>
+#endif
+
+
+/*
+ * This structure is statically allocated in the __glXScreens[]
+ * structure. This struct is not used anywhere other than in
+ * __glXScreenInit to initialize each of the active screens
+ * (__glXActiveScreens[]). Several of the fields must be initialized by
+ * the screenProbe routine before they are copied to the active screens
+ * struct. In particular, the contextCreate, pGlxVisual, numVisuals,
+ * and numUsableVisuals fields must be initialized.
+ */
+__GLXscreenInfo __glDDXScreenInfo = {
+ __MESA_screenProbe, /* Must be generic and handle all screens */
+ __MESA_createContext, /* Substitute screen's createContext routine */
+ __MESA_createBuffer, /* Substitute screen's createBuffer routine */
+ NULL, /* Set up pGlxVisual in probe */
+ NULL, /* Set up pVisualPriv in probe */
+ 0, /* Set up numVisuals in probe */
+ 0, /* Set up numUsableVisuals in probe */
+ "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */
+ "Version String", /* GLXversion is overwritten by __glXScreenInit */
+ "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */
+ NULL /* WrappedPositionWindow is overwritten */
+};
+
+__GLXextensionInfo __glDDXExtensionInfo = {
+ GL_CORE_MESA,
+ __MESA_resetExtension,
+ __MESA_initVisuals,
+ __MESA_setVisualConfigs
+};
+
+__MESA_screen MESAScreens[MAXSCREENS];
+__GLcontext *MESA_CC = NULL;
+
+int numConfigs = 0;
+__GLXvisualConfig *visualConfigs = NULL;
+void **visualPrivates = NULL;
+
+static int count_bits(unsigned int n)
+{
+ int bits = 0;
+
+ while (n > 0) {
+ if (n & 1) bits++;
+ n >>= 1;
+ }
+ return bits;
+}
+
+static XMesaVisual find_mesa_visual(int screen, VisualID vid)
+{
+ XMesaVisual xm_vis = NULL;
+ __MESA_screen *pMScr = &MESAScreens[screen];
+ int i;
+
+ for (i = 0; i < pMScr->num_vis; i++) {
+ if (pMScr->glx_vis[i].vid == vid) {
+ break;
+ }
+ }
+
+ if (i < pMScr->num_vis) {
+ xm_vis = pMScr->xm_vis[i];
+ }
+ return xm_vis;
+}
+
+#define VISUAL_CONFIG(rgba,accum,back,depth,stencil,rating) \
+{ \
+ -1, /* vid */ \
+ -1, /* class */ \
+ rgba, /* rgba */ \
+ -1, -1, -1, 0, /* rgba sizes, alpha not supported, yet */ \
+ -1, -1, -1, 0, /* rgba masks, alpha not supported, yet */ \
+ accum, accum, accum, accum, /* rgba accum sizes */ \
+ back, /* doubleBuffer */ \
+ GL_FALSE, /* stereo */ \
+ -1, /* bufferSize */ \
+ depth, /* depthSize */ \
+ stencil, /* stencilSize */ \
+ 0, /* auxBuffers */ \
+ 0, /* level */ \
+ rating, /* visualRating */ \
+ 0, /* transparentPixel */ \
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ \
+ 0 /* transparentIndex */ \
+}
+
+#define IS_RGBA GL_TRUE
+#define IS_CI GL_FALSE
+#define HAS_ACCUM ACCUM_BITS
+#define NO_ACCUM 0
+#define HAS_BACK GL_TRUE
+#define NO_BACK GL_FALSE
+#define HAS_DEPTH DEPTH_BITS
+#define NO_DEPTH 0
+#define HAS_STENCIL STENCIL_BITS
+#define NO_STENCIL 0
+
+static __GLXvisualConfig __MESAvisualConfigs[] = {
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0),
+ VISUAL_CONFIG(IS_RGBA, HAS_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0),
+ VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0),
+};
+
+static int __numMESAvisualConfigs =
+ sizeof(__MESAvisualConfigs)/sizeof(__GLXvisualConfig);
+static int __numRGBconfigs = -1;
+static int __numCIconfigs = -1;
+
+static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
+ VisualID *defaultVisp,
+ int ndepth, DepthPtr pdepth,
+ int rootDepth)
+{
+ int numVisuals = *nvisualp;
+ int numMesaVisuals = 0;
+ int numMergedVisualConfigs = 0;
+ VisualPtr pVisual = *visualp;
+ VisualPtr pVisualNew = NULL;
+ VisualID *orig_vid = NULL;
+ __GLXvisualConfig *glXVisualPtr = NULL;
+ __GLXvisualConfig *pMergedVisualConfigs = NULL;
+ void **glXVisualPriv;
+ void **pMergedVisualPriv;
+ int *mesaConfigUsed;
+ int *driverConfigUsed;
+ int found_default = FALSE;
+ int i, j, k;
+ int is_rgb;
+ Bool match;
+
+ /* Alloc space for the list of merged GLX visuals */
+ pMergedVisualConfigs =
+ (__GLXvisualConfig *)__glXMalloc((numConfigs +
+ __numMESAvisualConfigs) *
+ sizeof(__GLXvisualConfig));
+ if (!pMergedVisualConfigs) {
+ return FALSE;
+ }
+
+ /* Alloc space for the list of merged GLX visual privates */
+ pMergedVisualPriv =
+ (void **)__glXMalloc((numConfigs + __numMESAvisualConfigs) *
+ sizeof(void *));
+ if (!pMergedVisualPriv) {
+ __glXFree(pMergedVisualConfigs);
+ return FALSE;
+ }
+
+ /* Compute the intersection of the driver's visual configs */
+ mesaConfigUsed = __glXCalloc(__numMESAvisualConfigs, sizeof(int));
+ driverConfigUsed = __glXCalloc(numConfigs, sizeof(int));
+
+ for (i = j = 0; i < numConfigs; i++) {
+ k = 0;
+ while ((k < __numMESAvisualConfigs) && (!driverConfigUsed[i])) {
+ if (!mesaConfigUsed[k]) {
+
+#ifdef DEBUG_VISUAL_CONFIG
+#define TEST_AND_COPY(fld) do { \
+ if (match) { \
+ if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \
+ (__MESAvisualConfigs[k].fld == -1)) { \
+ pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \
+ } \
+ else if (visualConfigs[i].fld == -1) { \
+ pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \
+ } \
+ else { \
+ match = FALSE; \
+ xf86DrvMsg (0, 0, "[GLXVisualInit] mismatch: " \
+ "(%s) DriverVisualConfig[%d] MesaVisualConfig[%d]\n", \
+ #fld, i, k); \
+ } \
+ } \
+ } while (0)
+#else
+#define TEST_AND_COPY(fld) do { \
+ if (match) { \
+ if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \
+ (__MESAvisualConfigs[k].fld == -1)) { \
+ pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \
+ } \
+ else if (visualConfigs[i].fld == -1) { \
+ pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \
+ } \
+ else { \
+ match = FALSE; \
+ } \
+ } \
+ } while (0)
+#endif
+
+ match = TRUE;
+ TEST_AND_COPY(class);
+ TEST_AND_COPY(rgba);
+ TEST_AND_COPY(redSize);
+ TEST_AND_COPY(greenSize);
+ TEST_AND_COPY(blueSize);
+ TEST_AND_COPY(alphaSize);
+ TEST_AND_COPY(redMask);
+ TEST_AND_COPY(greenMask);
+ TEST_AND_COPY(blueMask);
+ TEST_AND_COPY(alphaMask);
+ TEST_AND_COPY(accumRedSize);
+ TEST_AND_COPY(accumGreenSize);
+ TEST_AND_COPY(accumBlueSize);
+ TEST_AND_COPY(accumAlphaSize);
+ TEST_AND_COPY(doubleBuffer);
+ TEST_AND_COPY(stereo);
+ TEST_AND_COPY(bufferSize);
+ TEST_AND_COPY(depthSize);
+ TEST_AND_COPY(stencilSize);
+ TEST_AND_COPY(auxBuffers);
+ TEST_AND_COPY(level);
+ TEST_AND_COPY(visualRating);
+ TEST_AND_COPY(transparentPixel);
+ TEST_AND_COPY(transparentRed);
+ TEST_AND_COPY(transparentGreen);
+ TEST_AND_COPY(transparentBlue);
+ TEST_AND_COPY(transparentAlpha);
+ TEST_AND_COPY(transparentIndex);
+ if (match) {
+ driverConfigUsed[i] = TRUE;
+ mesaConfigUsed[k] = TRUE;
+ pMergedVisualPriv[j] = visualPrivates[i];
+ j++;
+#ifdef DEBUG_VISUAL_CONFIG
+ xf86DrvMsg (0, 0, "[GLXVisualInit] MATCH: "
+ "DriverVisualConfig[%d] MesaVisualConfig[%d]\n", i, k);
+#endif
+ }
+ }
+ k++;
+ }
+ }
+
+ /*
+ ** If SetVisualConfigs was not called, then just make all of Mesa's
+ ** visual configs available.
+ */
+ if (!numConfigs) {
+ memcpy(pMergedVisualConfigs, __MESAvisualConfigs,
+ sizeof(__GLXvisualConfig) * __numMESAvisualConfigs);
+ memset(pMergedVisualPriv, 0, sizeof(void *) * __numMESAvisualConfigs);
+ memset(mesaConfigUsed, TRUE, sizeof(int) * __numMESAvisualConfigs);
+ j = __numMESAvisualConfigs;
+ }
+
+ /*
+ ** This code is not currently used. When the visual caveat
+ ** extension is supported by the DRI and Mesa, we can take advantage
+ ** of this code.
+ */
+#if 0
+ /* Add any unclaimed MESA configs w/ slow caveat */
+ for (i = 0; i < __numMESAvisualConfigs; i++) {
+ if (!mesaConfigUsed[i]) {
+ memcpy(&pMergedVisualConfigs[j], &__MESAvisualConfigs[i],
+ sizeof(__GLXvisualConfig));
+ pMergedVisualConfigs[j].visualRating = GLX_SLOW_VISUAL_EXT;
+ j++;
+#ifdef DEBUG_VISUAL_CONFIG
+ xf86DrvMsg (0, 0, "[GLXVisualInit] slow config: "
+ "MesaVisualConfig[%d]\n", i);
+#endif
+ }
+ }
+
+ /* Add any unclaimed driver configs w/ nonconformant caveat */
+ for (i = 0; i < numConfigs; i++) {
+ if (!driverConfigUsed[i]) {
+ memcpy(&pMergedVisualConfigs[j], &visualConfigs[i],
+ sizeof(__GLXvisualConfig));
+ pMergedVisualConfigs[j].visualRating = GLX_NON_CONFORMANT_VISUAL_EXT;
+ j++;
+#ifdef DEBUG_VISUAL_CONFIG
+ xf86DrvMsg (0, 0, "[GLXVisualInit] non-conformant config: "
+ "DriverVisualConfig[%d]\n", i);
+#endif
+ }
+ }
+#endif
+
+ numMergedVisualConfigs = j;
+
+ /* Count the number of RGB and CI visual configs */
+ __numRGBconfigs = __numCIconfigs = 0;
+ for (i = 0; i < numMergedVisualConfigs; i++) {
+ if (pMergedVisualConfigs[i].rgba)
+ __numRGBconfigs++;
+ else
+ __numCIconfigs++;
+ }
+
+ /* Count the total number of visuals to compute */
+ for (i = 0; i < numVisuals; i++) {
+ numMesaVisuals +=
+ (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor)
+ ? __numRGBconfigs : __numCIconfigs;
+ }
+
+ /* Reset variables for use with the next screen/driver's visual configs */
+ visualConfigs = NULL;
+ numConfigs = 0;
+
+ /* Alloc temp space for the list of orig VisualIDs for each new visual */
+ orig_vid = (VisualID *)__glXMalloc(numMesaVisuals * sizeof(VisualID));
+ if (!orig_vid) {
+ __glXFree(pMergedVisualPriv);
+ __glXFree(pMergedVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisuals */
+ glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numMesaVisuals *
+ sizeof(__GLXvisualConfig));
+ if (!glXVisualPtr) {
+ __glXFree(orig_vid);
+ __glXFree(pMergedVisualPriv);
+ __glXFree(pMergedVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisualPrivates */
+ glXVisualPriv = (void **)__glXMalloc(numMesaVisuals * sizeof(void *));
+ if (!glXVisualPriv) {
+ __glXFree(glXVisualPtr);
+ __glXFree(orig_vid);
+ __glXFree(pMergedVisualPriv);
+ __glXFree(pMergedVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the new list of the X server's visuals */
+ pVisualNew = (VisualPtr)__glXMalloc(numMesaVisuals * sizeof(VisualRec));
+ if (!pVisualNew) {
+ __glXFree(glXVisualPriv);
+ __glXFree(glXVisualPtr);
+ __glXFree(orig_vid);
+ __glXFree(pMergedVisualPriv);
+ __glXFree(pMergedVisualConfigs);
+ return FALSE;
+ }
+
+ /* Initialize the new visuals */
+ for (i = j = 0; i < numVisuals; i++) {
+ is_rgb = (pVisual[i].class == TrueColor ||
+ pVisual[i].class == DirectColor);
+
+ for (k = 0; k < numMergedVisualConfigs; k++) {
+ if (pMergedVisualConfigs[k].rgba != is_rgb)
+ continue;
+
+ /* Initialize the new visual */
+ pVisualNew[j] = pVisual[i];
+ pVisualNew[j].vid = FakeClientID(0);
+
+ /* Check for the default visual */
+ if (!found_default && pVisual[i].vid == *defaultVisp) {
+ *defaultVisp = pVisualNew[j].vid;
+ found_default = TRUE;
+ }
+
+ /* Save the old VisualID */
+ orig_vid[j] = pVisual[i].vid;
+
+ /* Initialize the glXVisual */
+ glXVisualPtr[j] = pMergedVisualConfigs[k];
+ glXVisualPtr[j].vid = pVisualNew[j].vid;
+
+ /*
+ * If the class is -1, then assume the X visual information
+ * is identical to what GLX needs, and take them from the X
+ * visual. NOTE: if class != -1, then all other fields MUST
+ * be initialized.
+ */
+ if (glXVisualPtr[j].class == -1) {
+ glXVisualPtr[j].class = pVisual[i].class;
+ glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask);
+ glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask);
+ glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask);
+ glXVisualPtr[j].alphaSize = 0; /* Not supported in Mesa */
+ glXVisualPtr[j].redMask = pVisual[i].redMask;
+ glXVisualPtr[j].greenMask = pVisual[i].greenMask;
+ glXVisualPtr[j].blueMask = pVisual[i].blueMask;
+ glXVisualPtr[j].alphaMask = 0; /* Not supported in Mesa */
+ glXVisualPtr[j].bufferSize = rootDepth;
+ }
+
+ /* Save the device-dependent private for this visual */
+ glXVisualPriv[j] = pMergedVisualPriv[k];
+
+ j++;
+ }
+ }
+
+ /* Save the GLX visuals in the screen structure */
+ MESAScreens[screenInfo.numScreens-1].num_vis = numMesaVisuals;
+ MESAScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr;
+ MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv;
+
+ /* Set up depth's VisualIDs */
+ for (i = 0; i < ndepth; i++) {
+ int numVids = 0;
+ VisualID *pVids = NULL;
+ int k, n = 0;
+
+ /* Count the new number of VisualIDs at this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numMesaVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ numVids++;
+
+ /* Allocate a new list of VisualIDs for this depth */
+ pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
+
+ /* Initialize the new list of VisualIDs for this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numMesaVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ pVids[n++] = pVisualNew[k].vid;
+
+ /* Update this depth's list of VisualIDs */
+ __glXFree(pdepth[i].vids);
+ pdepth[i].vids = pVids;
+ pdepth[i].numVids = numVids;
+ }
+
+ /* Update the X server's visuals */
+ *nvisualp = numMesaVisuals;
+ *visualp = pVisualNew;
+
+ /* Free the old list of the X server's visuals */
+ __glXFree(pVisual);
+
+ /* Clean up temporary allocations */
+ __glXFree(orig_vid);
+ __glXFree(pMergedVisualPriv);
+ __glXFree(pMergedVisualConfigs);
+
+ /* Free the private list created by DDX HW driver */
+ xfree(visualPrivates);
+
+ return TRUE;
+}
+
+void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates)
+{
+ numConfigs = nconfigs;
+ visualConfigs = configs;
+ visualPrivates = privates;
+}
+
+Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp, int *rootDepthp,
+ VisualID *defaultVisp, unsigned long sizes,
+ int bitsPerRGB)
+{
+ /*
+ * Setup the visuals supported by this particular screen.
+ */
+ return init_visuals(nvisualp, visualp, defaultVisp,
+ *ndepthp, *depthp, *rootDepthp);
+}
+
+static void fixup_visuals(int screen)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen];
+ __MESA_screen *pMScr = &MESAScreens[screen];
+ __GLXvisualConfig *pGLXVis = pMScr->glx_vis;
+ VisualPtr pVis;
+ int i, j;
+
+ for (i = 0; i < pMScr->num_vis; i++, pGLXVis++) {
+ pVis = pScreen->visuals;
+
+ /* Find a visual that matches the GLX visual's class and size */
+ for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
+ if (pVis->class == pGLXVis->class &&
+ pVis->nplanes == pGLXVis->bufferSize) {
+
+ /* Fixup the masks */
+ pGLXVis->redMask = pVis->redMask;
+ pGLXVis->greenMask = pVis->greenMask;
+ pGLXVis->blueMask = pVis->blueMask;
+
+ /* Recalc the sizes */
+ pGLXVis->redSize = count_bits(pGLXVis->redMask);
+ pGLXVis->greenSize = count_bits(pGLXVis->greenMask);
+ pGLXVis->blueSize = count_bits(pGLXVis->blueMask);
+ }
+ }
+ }
+}
+
+static void init_screen_visuals(int screen)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen];
+ __GLXvisualConfig *pGLXVis = MESAScreens[screen].glx_vis;
+ XMesaVisual *pXMesaVisual;
+ VisualPtr pVis;
+ int *used;
+ int i, j;
+
+ /* Alloc space for the list of XMesa visuals */
+ pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis *
+ sizeof(XMesaVisual));
+
+ used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int));
+ __glXMemset(used, 0, pScreen->numVisuals * sizeof(int));
+
+ for (i = 0; i < MESAScreens[screen].num_vis; i++, pGLXVis++) {
+
+ pVis = pScreen->visuals;
+ for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
+
+ if (pVis->class == pGLXVis->class &&
+ pVis->nplanes == pGLXVis->bufferSize &&
+ !used[j]) {
+
+ if (pVis->redMask == pGLXVis->redMask &&
+ pVis->greenMask == pGLXVis->greenMask &&
+ pVis->blueMask == pGLXVis->blueMask) {
+
+ /* Create the XMesa visual */
+ pXMesaVisual[i] =
+ XMesaCreateVisual(pScreen,
+ pVis,
+ pGLXVis->rgba,
+ (pGLXVis->alphaSize > 0),
+ pGLXVis->doubleBuffer,
+ pGLXVis->stereo,
+ GL_TRUE, /* ximage_flag */
+ pGLXVis->depthSize,
+ pGLXVis->stencilSize,
+ pGLXVis->accumRedSize,
+ pGLXVis->level);
+
+ /* Set the VisualID */
+ pGLXVis->vid = pVis->vid;
+
+ /* Mark this visual used */
+ used[j] = 1;
+ break;
+ }
+ }
+ }
+ }
+
+ __glXFree(used);
+
+ MESAScreens[screen].xm_vis = pXMesaVisual;
+}
+
+Bool __MESA_screenProbe(int screen)
+{
+ /*
+ * Set up the current screen's visuals.
+ */
+ __glDDXScreenInfo.pGlxVisual = MESAScreens[screen].glx_vis;
+ __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private;
+ __glDDXScreenInfo.numVisuals =
+ __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis;
+
+ /*
+ * Set the current screen's createContext routine. This could be
+ * wrapped by a DDX GLX context creation routine.
+ */
+ __glDDXScreenInfo.createContext = __MESA_createContext;
+
+ /*
+ * The ordering of the rgb compenents might have been changed by the
+ * driver after mi initialized them.
+ */
+ fixup_visuals(screen);
+
+ /*
+ * Find the GLX visuals that are supported by this screen and create
+ * XMesa's visuals.
+ */
+ init_screen_visuals(screen);
+
+ return TRUE;
+}
+
+extern void __MESA_resetExtension(void)
+{
+ int i, j;
+
+ XMesaReset();
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ for (j = 0; j < MESAScreens[i].num_vis; j++) {
+ XMesaDestroyVisual(MESAScreens[i].xm_vis[j]);
+ }
+ __glXFree(MESAScreens[i].glx_vis);
+ MESAScreens[i].glx_vis = NULL;
+ MESAScreens[i].num_vis = 0;
+ }
+ MESA_CC = NULL;
+}
+
+void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv)
+{
+ DrawablePtr pDraw = glxPriv->pDraw;
+ XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum,
+ glxPriv->pGlxVisual->vid);
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ __MESA_buffer buf;
+
+ buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec));
+
+ /* Create Mesa's buffers */
+ if (glxPriv->type == DRAWABLE_WINDOW) {
+ buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis,
+ (WindowPtr)pDraw);
+ } else {
+ buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis,
+ (PixmapPtr)pDraw, 0);
+ }
+
+ /* Wrap the front buffer's resize routine */
+ buf->fbresize = glPriv->frontBuffer.resize;
+ glPriv->frontBuffer.resize = __MESA_resizeBuffers;
+
+ /* Wrap the swap buffers routine */
+ buf->fbswap = glxPriv->swapBuffers;
+ glxPriv->swapBuffers = __MESA_swapBuffers;
+
+ /* Save Mesa's private buffer structure */
+ glPriv->private = (void *)buf;
+ glPriv->freePrivate = __MESA_destroyBuffer;
+}
+
+GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer,
+ GLint x, GLint y,
+ GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv,
+ GLuint bufferMask)
+{
+ __MESA_buffer buf = (__MESA_buffer)glPriv->private;
+
+ if (buf->xm_buf && buf->xm_buf->xm_context) {
+ XMesaForceCurrent(buf->xm_buf->xm_context);
+ (*buf->xm_buf->xm_context->gl_ctx->API.ResizeBuffersMESA)(buf->xm_buf->xm_context->gl_ctx);
+ XMesaForceCurrent(MESA_CC->xm_ctx);
+ }
+
+ return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask);
+}
+
+GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv)
+{
+ __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private;
+
+ /*
+ ** Do not call the wrapped swap buffers routine since Mesa has
+ ** already done the swap.
+ */
+ XMesaSwapBuffers(buf->xm_buf);
+
+ return GL_TRUE;
+}
+
+void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv)
+{
+ __MESA_buffer buf = (__MESA_buffer)glPriv->private;
+ __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other;
+
+ /* Destroy Mesa's buffers */
+ if (buf->xm_buf)
+ XMesaDestroyBuffer(buf->xm_buf);
+
+ /* Unwrap these routines */
+ glxPriv->swapBuffers = buf->fbswap;
+ glPriv->frontBuffer.resize = buf->fbresize;
+
+ __glXFree(glPriv->private);
+ glPriv->private = NULL;
+}
+
+__GLinterface *__MESA_createContext(__GLimports *imports,
+ __GLcontextModes *modes,
+ __GLinterface *shareGC)
+{
+ __GLcontext *gl_ctx;
+ XMesaContext m_share = NULL;
+ XMesaVisual xm_vis;
+ __GLXcontext *glxc = (__GLXcontext *)imports->other;
+
+ gl_ctx = (__GLcontext *)__glXMalloc(sizeof(__GLcontext));
+ if (!gl_ctx)
+ return NULL;
+
+ gl_ctx->iface.imports = *imports;
+
+ gl_ctx->iface.exports.destroyContext = __MESA_destroyContext;
+ gl_ctx->iface.exports.loseCurrent = __MESA_loseCurrent;
+ gl_ctx->iface.exports.makeCurrent = __MESA_makeCurrent;
+ gl_ctx->iface.exports.shareContext = __MESA_shareContext;
+ gl_ctx->iface.exports.copyContext = __MESA_copyContext;
+ gl_ctx->iface.exports.forceCurrent = __MESA_forceCurrent;
+ gl_ctx->iface.exports.notifyResize = __MESA_notifyResize;
+ gl_ctx->iface.exports.notifyDestroy = __MESA_notifyDestroy;
+ gl_ctx->iface.exports.notifySwapBuffers = __MESA_notifySwapBuffers;
+ gl_ctx->iface.exports.dispatchExec = __MESA_dispatchExec;
+ gl_ctx->iface.exports.beginDispatchOverride = __MESA_beginDispatchOverride;
+ gl_ctx->iface.exports.endDispatchOverride = __MESA_endDispatchOverride;
+
+ if (shareGC) m_share = ((__GLcontext *)shareGC)->xm_ctx;
+ xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->pGlxVisual->vid);
+ if (xm_vis) {
+ gl_ctx->xm_ctx = XMesaCreateContext(xm_vis, m_share);
+ } else {
+ __glXFree(gl_ctx);
+ gl_ctx = NULL;
+ }
+
+ return (__GLinterface *)gl_ctx;
+}
+
+GLboolean __MESA_destroyContext(__GLcontext *gc)
+{
+ XMesaDestroyContext(gc->xm_ctx);
+ __glXFree(gc);
+ return GL_TRUE;
+}
+
+GLboolean __MESA_loseCurrent(__GLcontext *gc)
+{
+ MESA_CC = NULL;
+ __glXLastContext = NULL;
+ return XMesaLoseCurrent(gc->xm_ctx);
+}
+
+GLboolean __MESA_makeCurrent(__GLcontext *gc, __GLdrawablePrivate *glPriv)
+{
+ __MESA_buffer buf = (__MESA_buffer)glPriv->private;
+
+ MESA_CC = gc;
+ return XMesaMakeCurrent(gc->xm_ctx, buf->xm_buf);
+}
+
+GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_shareContext\n");
+ return GL_FALSE;
+}
+
+GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src,
+ GLuint mask)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_copyContext\n");
+ return GL_FALSE;
+}
+
+GLboolean __MESA_forceCurrent(__GLcontext *gc)
+{
+ MESA_CC = gc;
+ return XMesaForceCurrent(gc->xm_ctx);
+}
+
+GLboolean __MESA_notifyResize(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_notifyResize\n");
+ return GL_FALSE;
+}
+
+void __MESA_notifyDestroy(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_notifyDestroy\n");
+ return;
+}
+
+void __MESA_notifySwapBuffers(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_notifySwapBuffers\n");
+ return;
+}
+
+struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_dispatchExec\n");
+ return NULL;
+}
+
+void __MESA_beginDispatchOverride(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_beginDispatchOverride\n");
+ return;
+}
+
+void __MESA_endDispatchOverride(__GLcontext *gc)
+{
+ /* NOT_DONE */
+ ErrorF("__MESA_endDispatchOverride\n");
+ return;
+}
+
+GLint __glEvalComputeK(GLenum target)
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_4:
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_4:
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_TEXTURE_COORD_4:
+ return 4;
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_NORMAL:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_NORMAL:
+ return 3;
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_2:
+ return 2;
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP1_INDEX:
+ case GL_MAP2_INDEX:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+GLuint __glFloorLog2(GLuint val)
+{
+ int c = 0;
+
+ while (val > 1) {
+ c++;
+ val >>= 1;
+ }
+ return c;
+}
+
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c
new file mode 100644
index 000000000..c0cafaa8e
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c
@@ -0,0 +1,148 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c,v 1.3 1999/06/14 07:31:43 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c,v 1.6 1999/05/27 03:43:48 jens Exp $
+ */
+
+#include <gcstruct.h>
+#include "pixmapstr.h"
+#include "xf86glx_util.h"
+#include <X11/Xmd.h>
+#include "GL/xf86glx.h"
+
+#ifdef ROUNDUP
+#undef ROUNDUP
+#endif
+
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
+
+XMesaImage *XMesaCreateImage(int depth, int width, int height, char *data)
+{
+ XMesaImage *image;
+
+ image = (XMesaImage *)xalloc(sizeof(XMesaImage));
+
+ if (image) {
+ image->width = width;
+ image->height = height;
+ image->data = data;
+ /* Always pad to 32 bits */
+ image->bytes_per_line = ROUNDUP((depth * width), 32);
+ image->bits_per_pixel = depth;
+ }
+
+ return image;
+}
+
+void XMesaDestroyImage(XMesaImage *image)
+{
+ if (image->data)
+ free(image->data);
+ xfree(image);
+}
+
+unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
+{
+ CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
+ CARD8 *i8;
+ CARD16 *i16;
+ CARD32 *i32;
+ switch (image->bits_per_pixel) {
+ case 8:
+ i8 = (CARD8 *)row;
+ return i8[x];
+ break;
+ case 15:
+ case 16:
+ i16 = (CARD16 *)row;
+ return i16[x];
+ break;
+ case 24: /* WARNING: architecture specific code */
+ i8 = (CARD8 *)row;
+ return (((CARD32)i8[x*3]) |
+ (((CARD32)i8[x*3+1])<<8) |
+ (((CARD32)i8[x*3+2])<<16));
+ break;
+ case 32:
+ i32 = (CARD32 *)row;
+ return i32[x];
+ break;
+ }
+ return 0;
+}
+
+#ifndef XMESA_USE_PUTPIXEL_MACRO
+void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
+{
+ CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
+ CARD8 *i8;
+ CARD16 *i16;
+ CARD32 *i32;
+ switch (image->bits_per_pixel) {
+ case 8:
+ i8 = (CARD8 *)row;
+ i8[x] = (CARD8)pixel;
+ break;
+ case 15:
+ case 16:
+ i16 = (CARD16 *)row;
+ i16[x] = (CARD16)pixel;
+ break;
+ case 24: /* WARNING: architecture specific code */
+ i8 = (CARD8 *)__row;
+ i8[x*3] = (CARD8)(p);
+ i8[x*3+1] = (CARD8)(p>>8);
+ i8[x*3+2] = (CARD8)(p>>16);
+ case 32:
+ i32 = (CARD32 *)row;
+ i32[x] = (CARD32)pixel;
+ break;
+ }
+}
+#endif
+
+void XMesaPutImageHelper(ScreenPtr display,
+ DrawablePtr d, GCPtr gc,
+ XMesaImage *image,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ unsigned int width, unsigned int height)
+{
+ /* NOT_DONE: Verify that the following works for all depths */
+ char *src = (image->data +
+ src_y * image->bytes_per_line +
+ ((src_x * image->bits_per_pixel) >> 3));
+
+ ValidateGC(d, gc);
+ (*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height,
+ 0, ZPixmap, src);
+}
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h
new file mode 100644
index 000000000..e5a88fe86
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h
@@ -0,0 +1,98 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.2 1999/06/14 07:31:43 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.5 1999/03/15 21:36:10 martin Exp $
+ */
+
+#ifndef _XF86GLX_UTIL_H_
+#define _XF86GLX_UTIL_H_
+
+#include <screenint.h>
+#include <pixmap.h>
+#include <gc.h>
+#include "GL/xmesa.h"
+
+#define XMESA_USE_PUTPIXEL_MACRO
+
+struct _XMesaImageRec {
+ int width, height;
+ char *data;
+ int bytes_per_line; /* Padded to 32 bits */
+ int bits_per_pixel;
+};
+
+extern XMesaImage *XMesaCreateImage(int depth, int width, int height,
+ char *data);
+extern void XMesaDestroyImage(XMesaImage *image);
+extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y);
+#ifdef XMESA_USE_PUTPIXEL_MACRO
+#define XMesaPutPixel(__i,__x,__y,__p) \
+{ \
+ CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \
+ CARD8 *__i8; \
+ CARD16 *__i16; \
+ CARD32 *__i32; \
+ switch (__i->bits_per_pixel) { \
+ case 8: \
+ __i8 = (CARD8 *)__row; \
+ __i8[__x] = (CARD8)__p; \
+ break; \
+ case 15: \
+ case 16: \
+ __i16 = (CARD16 *)__row; \
+ __i16[__x] = (CARD16)__p; \
+ break; \
+ case 24: /* WARNING: architecture specific code */ \
+ __i8 = (CARD8 *)__row; \
+ __i8[__x*3] = (CARD8)(__p); \
+ __i8[__x*3+1] = (CARD8)(__p>>8); \
+ __i8[__x*3+2] = (CARD8)(__p>>16); \
+ break; \
+ case 32: \
+ __i32 = (CARD32 *)__row; \
+ __i32[__x] = (CARD32)__p; \
+ break; \
+ } \
+}
+#else
+extern void XMesaPutPixel(XMesaImage *image, int x, int y,
+ unsigned long pixel);
+#endif
+
+extern void XMesaPutImageHelper(ScreenPtr display,
+ DrawablePtr d, GCPtr gc,
+ XMesaImage *image,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ unsigned int width, unsigned int height);
+
+#endif /* _XF86GLX_UTIL_H_ */
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h b/xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h
new file mode 100644
index 000000000..bd000fde8
--- /dev/null
+++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h
@@ -0,0 +1,122 @@
+/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h,v 1.2 1999/06/14 07:31:44 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ * $PI: xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h,v 1.7 1999/04/11 04:20:55 martin Exp $
+ */
+
+#ifndef _XF86GLXINT_H_
+#define _XF86GLXINT_H_
+
+#include <miscstruct.h>
+#include <GL/gl.h>
+#include <GL/xmesa.h>
+
+struct __GLcontextRec {
+ __GLinterface iface;
+ XMesaContext xm_ctx;
+};
+
+typedef struct __MESA_screenRec __MESA_screen;
+struct __MESA_screenRec {
+ int num_vis;
+ __GLXvisualConfig *glx_vis;
+ XMesaVisual *xm_vis;
+ void **private;
+};
+
+typedef struct __MESA_bufferRec *__MESA_buffer;
+struct __MESA_bufferRec {
+ XMesaBuffer xm_buf;
+ GLboolean (*fbresize)(__GLdrawableBuffer *buf,
+ GLint x, GLint y, GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv, GLuint bufferMask);
+ GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv);
+};
+
+extern void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates);
+extern Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp, int *rootDepthp,
+ VisualID *defaultVisp, unsigned long sizes,
+ int bitsPerRGB);
+extern Bool __MESA_screenProbe(int screen);
+
+extern void __MESA_resetExtension(void);
+
+extern void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv);
+extern GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buf,
+ GLint x, GLint y,
+ GLuint width, GLuint height,
+ __GLdrawablePrivate *glPriv,
+ GLuint bufferMask);
+extern GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv);
+extern void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv);
+
+extern __GLinterface *__MESA_createContext(__GLimports *imports,
+ __GLcontextModes *modes,
+ __GLinterface *shareGC);
+extern GLboolean __MESA_destroyContext(__GLcontext *gc);
+extern GLboolean __MESA_loseCurrent(__GLcontext *gc);
+extern GLboolean __MESA_makeCurrent(__GLcontext *gc,
+ __GLdrawablePrivate *glPriv);
+extern GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare);
+extern GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src,
+ GLuint mask);
+extern GLboolean __MESA_forceCurrent(__GLcontext *gc);
+
+extern GLboolean __MESA_notifyResize(__GLcontext *gc);
+extern void __MESA_notifyDestroy(__GLcontext *gc);
+extern void __MESA_notifySwapBuffers(__GLcontext *gc);
+extern struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc);
+extern void __MESA_beginDispatchOverride(__GLcontext *gc);
+extern void __MESA_endDispatchOverride(__GLcontext *gc);
+
+extern GLint __glCallLists_size(GLsizei n, GLenum type);
+extern GLint __glEvalComputeK(GLenum target);
+extern GLuint __glFloorLog2(GLuint val);
+extern GLint __glFogfv_size(GLenum pname);
+extern GLint __glFogiv_size(GLenum pname);
+extern GLint __glLightModelfv_size(GLenum pname);
+extern GLint __glLightModeliv_size(GLenum pname);
+extern GLint __glLightfv_size(GLenum pname);
+extern GLint __glLightiv_size(GLenum pname);
+extern GLint __glMaterialfv_size(GLenum pname);
+extern GLint __glMaterialiv_size(GLenum pname);
+extern GLint __glTexEnvfv_size(GLenum pname);
+extern GLint __glTexEnviv_size(GLenum pname);
+extern GLint __glTexGendv_size(GLenum pname);
+extern GLint __glTexGenfv_size(GLenum pname);
+extern GLint __glTexGeniv_size(GLenum pname);
+extern GLint __glTexParameterfv_size(GLenum pname);
+extern GLint __glTexParameteriv_size(GLenum pname);
+
+#endif /* _XF86GLXINT_H_ */
diff --git a/xc/programs/Xserver/GL/opengl/Imakefile b/xc/programs/Xserver/GL/opengl/Imakefile
new file mode 100644
index 000000000..ec21bc7f0
--- /dev/null
+++ b/xc/programs/Xserver/GL/opengl/Imakefile
@@ -0,0 +1,140 @@
+XCOMM $XFree86: xc/programs/Xserver/GL/opengl/Imakefile,v 1.2 1999/06/14 07:31:44 dawes Exp $
+
+XCOMM The contents of this file are subject to the GLX Public License Version 1.0
+XCOMM (the "License"). You may not use this file except in compliance with the
+XCOMM License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+XCOMM attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+XCOMM or at http://www.sgi.com/software/opensource/glx/license.html.
+XCOMM
+XCOMM Software distributed under the License is distributed on an "AS IS"
+XCOMM basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+XCOMM IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+XCOMM PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+XCOMM language governing rights and limitations under the License.
+XCOMM
+XCOMM The Original Software is GLX version 1.2 source code, released February,
+XCOMM 1999. The developer of the Original Software is Silicon Graphics, Inc.
+XCOMM Those portions of the Subject Software created by Silicon Graphics, Inc.
+XCOMM are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+
+#include <Library.tmpl>
+
+OBJS = \
+ ddxci.o \
+ ddxcx.o \
+ ddxrgb.o \
+ ddxscreens.o \
+ dl_block.o \
+ dl_heap.o \
+ dl_init.o \
+ dl_list.o \
+ dl_mopt.o \
+ dl_opt.o \
+ dl_pplst.o \
+ dl_splc.o \
+ dl_splst.o \
+ dl_table.o \
+ g_api.o \
+ g_disp.o \
+ g_lcmpex.o \
+ g_lcomp.o \
+ g_lexec.o \
+ g_ltab.o \
+ g_noptab.o \
+ g_splcmp.o \
+ px_api.o \
+ px_mod.o \
+ px_pack.o \
+ px_paths.o \
+ px_read.o \
+ px_rend.o \
+ px_upack.o \
+ s_accum.o \
+ s_atest.o \
+ s_attrib.o \
+ s_bitmap.o \
+ s_blend.o \
+ s_btdraw.o \
+ s_buffer.o \
+ s_capi.o \
+ s_ci.o \
+ s_clear.o \
+ s_clip.o \
+ s_contxt.o \
+ s_cpydsp.o \
+ s_ctable.o \
+ s_depth.o \
+ s_dlist.o \
+ s_eval.o \
+ s_export.o \
+ s_feed.o \
+ s_finish.o \
+ s_fog.o \
+ s_get.o \
+ s_global.o \
+ s_image.o \
+ s_lcache.o \
+ s_lcomp.o \
+ s_light.o \
+ s_lnclip.o \
+ s_lndraw.o \
+ s_lnfast.o \
+ s_lnfin.o \
+ s_lnspan.o \
+ s_math.o \
+ s_memmgr.o \
+ s_names.o \
+ s_napi.o \
+ s_pgaa.o \
+ s_pgclip.o \
+ s_pgdraw.o \
+ s_pgfin.o \
+ s_pgmode.o \
+ s_pgspan.o \
+ s_pick.o \
+ s_prim.o \
+ s_ptaa.o \
+ s_ptdraw.o \
+ s_ptfin.o \
+ s_rapi.o \
+ s_rect.o \
+ s_rgb.o \
+ s_rpos.o \
+ s_select.o \
+ s_size.o \
+ s_span.o \
+ s_sten.o \
+ s_store.o \
+ s_tapi.o \
+ s_tex.o \
+ s_texel.o \
+ s_texmgr.o \
+ s_trap.o \
+ s_vapi.o \
+ s_varray.o \
+ s_vertex.o \
+ s_xform.o \
+ s_zfuncs.o \
+ vc_cache.o \
+ vc_line.o \
+ vc_point.o \
+ vc_poly.o
+
+INCLUDES = \
+ -I. \
+ -I.. \
+ -Iinclude \
+ -I$(TOP)/server/include \
+ -I$(TOP)/programs/Xserver/include \
+ -I$(TOP)/include \
+ -I$(TOP)/include/GL \
+ -I$(INCLUDESRC)
+
+DEFINES = \
+ -D_LANGUAGE_C \
+ -Dunix
+
+NormalLibraryTarget(GL, $(OBJS))
+NormalLibraryObjectRule()
+
+DependTarget()
diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile
new file mode 100644
index 000000000..4b96fedd0
--- /dev/null
+++ b/xc/programs/Xserver/Imakefile
@@ -0,0 +1,786 @@
+XCOMM $TOG: Imakefile /main/249 1997/12/11 11:18:14 kaleb $
+/*
+ * Server Master Makefile
+ */
+XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.168 1999/08/14 10:49:21 dawes Exp $
+
+#ifndef InstallXserverSetUID
+#define InstallXserverSetUID NO
+#endif
+#define InstallServerSetUID InstallXserverSetUID
+
+#include <Server.tmpl>
+
+#ifdef XFree86Version
+/* Do not strip server binaries */
+INSTPGMFLAGS =
+#endif
+
+#define PreFbLibs $(DIX) $(OS) $(XPDDX)
+#define PreFbLibsNoFont $(DIX) $(OS)
+#define BarePostFbLibs $(MFB) $(XPFBLIBS) $(MI)
+#define PostFbLibs BarePostFbLibs $(EXTENSIONS)
+#define NoMfbBarePostFbLibs $(XPFBLIBS) $(MI)
+#ifndef BuildXinerama
+#define NoMfbPostFbLibs NoMfbBarePostFbLibs $(EXTENSIONS)
+#else
+#define NoMfbPostFbLibs $(EXTENSIONS) NoMfbBarePostFbLibs $(EXTENSIONS)
+#endif
+
+#define MFBBareLibs PreFbLibs BarePostFbLibs
+#define NoMFBBareLibs PreFbLibs NoMfbBarePostFbLibs
+#define MFBLibs PreFbLibs PostFbLibs
+#define NoMFBLibs PreFbLibs NoMfbPostFbLibs
+#define CFBLibs PreFbLibs $(CFB) PostFbLibs
+#define CFB4Libs PreFbLibs $(CFB4) PostFbLibs
+#if BuildLowMem
+#define LMFCFBLibs PreFbLibs $(LMFCFB) NoMfbBarePostFbLibs $(EXTENSIONS)
+#endif
+#define CFB8Libs PreFbLibs $(CFB8) PostFbLibs
+#define CFB16Libs PreFbLibs $(CFB16) PostFbLibs
+#define CFB24Libs PreFbLibs $(CFB24) PostFbLibs
+#define CFB32Libs PreFbLibs $(CFB32) PostFbLibs
+
+#define NoMFBCFBLibs PreFbLibs $(CFB) NoMfbPostFbLibs
+#define NoMFBCFB8Libs PreFbLibs $(CFB8) NoMfbPostFbLibs
+
+#if BuildPexExt
+ PEXLIBS = PEX5/dipex/dispatch/ModuleLibraryTargetName(didipex) \
+ PEX5/dipex/swap/ModuleLibraryTargetName(diswapex) \
+ PEX5/dipex/objects/ModuleLibraryTargetName(diobpex) \
+ PEX5/dipex/dispatch/ModuleLibraryTargetName(didipex) \
+ PEX5/ddpex/mi/level4/ModuleLibraryTargetName(ddpex4) \
+ PEX5/ddpex/mi/level3/ModuleLibraryTargetName(ddpex3) \
+ PEX5/ddpex/mi/shared/ModuleLibraryTargetName(ddpexs) \
+ PEX5/ddpex/mi/level2/ModuleLibraryTargetName(ddpex2) \
+ PEX5/ddpex/mi/level1/ModuleLibraryTargetName(ddpex1) \
+ PEX5/ospex/ModuleLibraryTargetName(ospex)
+ PEXDIR = PEX5
+#endif
+
+#if BuildGlxExt
+#if GlxStubLib && !DoLoadableServer
+ GLXLIB = glxStub/LibraryTargetName(ServerGlx)
+ GLXDIR = glxStub
+#else
+#if defined(GlxStaticServerLib) && !DoLoadableServer
+ GLXLIB = GlxStaticServerLib
+ GLXDIR =
+#else
+#if BuildXF86DRI
+ DRILIB = GL/dri/ModuleLibraryTargetName(dri)
+#else
+ DRILIB =
+#endif
+#if GlxUseSGISI
+ GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \
+ GL/sgi-si/ModuleLibraryTargetName(GLcore) \
+ $(DRILIB)
+#else
+#if DoLoadableServer
+ GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \
+ GL/mesa/src/ModuleLibraryTargetName(GLcore)
+#else
+ GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \
+ GL/mesa/src/ModuleLibraryTargetName(GLcore) \
+ GL/mesa/src/X/ModuleLibraryTargetName(GLcoreX) \
+ $(DRILIB)
+#endif
+#endif
+ GLXDIR = GL
+ GLXEXT = $(GLXLIB)
+#endif
+#endif
+#endif
+
+#if BuildXInputExt
+ XINPUTEXT = Xi/LibraryTargetName(xinput)
+ XIDIR = Xi
+#endif
+#if BuildXIE
+ XIEEXT = XIE/dixie/ModuleLibraryTargetName(dixie) XIE/mixie/ModuleLibraryTargetName(mixie)
+#endif
+#if BuildXIE || BuildXIElib
+ XIEDIR = XIE
+#endif
+#if BuildXKB
+ XKBEXT = xkb/LibraryTargetName(xkb)
+ XKBDIR = xkb
+#endif
+#if BuildLBX
+ LBXEXT = lbx/LibraryTargetName(lbx) \
+ $(TOP)/lib/lbxutil/LibraryTargetName(lbxutil)
+ LBXDIRS = lbx
+#endif
+#if BuildDBE
+ DBEEXT = dbe/LibraryTargetName(dbe)
+#endif
+#if BuildDBE || BuildDBElib
+ DBEDIR = dbe
+#endif
+#if BuildRECORD
+ RECORDEXT = record/LibraryTargetName(record)
+#endif
+#if BuildRECORD || BuildRECORDlib
+ RECORDDIR = record
+#endif
+#ifdef SiteExtensionLibs
+ SITEEXTS = SiteExtensionLibs
+#endif
+#ifdef SiteExtensionDirs
+ SITEEXTDIRS = SiteExtensionDirs
+#endif
+#if DoLoadableServer && HasDlopen
+ LIBDL = DlLibrary
+#endif
+ LIBREGEX = RegexLibrary
+
+#if DoLoadableServer
+ LIBCWRAPPER = os/libcwrapper.o
+#endif
+
+#if BuildXprint
+
+#ifndef XpRasterDDX
+#define XpRasterDDX NO
+#endif
+#ifndef XpColorPclDDX
+#define XpColorPclDDX YES
+#endif
+#ifndef XpMonoPclDDX
+#define XpMonoPclDDX NO
+#endif
+#ifndef XpPostScriptDDX
+#define XpPostScriptDDX YES
+#endif
+
+#if XpRasterDDX
+XPRASTLIB = Xprint/raster/LibraryTargetName(raster)
+#endif
+#if XpColorPclDDX
+XPPCLLIB = Xprint/pcl/LibraryTargetName(pcl)
+#endif
+#if XpMonoPclDDX
+XPMPCLLIB = Xprint/pcl-mono/LibraryTargetName(pcl)
+#endif
+#if XpPostScriptDDX
+XPPSLIB = Xprint/ps/LibraryTargetName(ps)
+#endif
+
+XPDDXLIBS = Xprint/LibraryTargetName(printer) $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB)
+XPDDXFBLIBS = $(MFB) $(CFB32)
+#if !PrintOnlyServer
+ XPFBLIBS = $(XPDDXFBLIBS)
+ XPDDX = $(XPDDXLIBS)
+#endif
+ XPDDXDIR = Xprint
+#endif
+#if !BuildXprint || PrintOnlyServer
+XPFBLIBS = dix/LibraryTargetName(xpstubs)
+#endif
+
+#if DoLoadableServer
+ EXTENSIONS = $(OTHEREXTS)
+ LOADABLEEXTS = $(PEXLIBS) $(XIEEXT) $(MISCEXT) $(DBEEXT) $(RECORDEXT) \
+ $(GLXEXT)
+ MISCEXT = Xext/LibraryTargetName(ext)
+ OTHEREXTS = Xext/LibraryTargetName(exts) $(XKBEXT) $(XINPUTEXT) \
+ $(LBXEXT) $(SITEEXTS)
+#else
+ EXTENSIONS = $(OTHEREXTS) $(PEXLIBS) $(GLXEXT)
+ OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \
+ $(XIEEXT) $(LBXEXT) $(DBEEXT) $(RECORDEXT) $(SITEEXTS)
+#endif
+ EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(XIEDIR) $(PEXDIR) $(GLXDIR) \
+ $(LBXDIRS) $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS)
+ XAULIB = $(XAUTHSRC)/LibraryTargetName(Xau)
+ XDMCPLIB = $(XDMCPLIBSRC)/LibraryTargetName(Xdmcp)
+#if BuildLBX || GzipFontCompression
+ ZLIB = GzipLibrary
+#endif
+ OS = os/LibraryTargetName(os) $(XAULIB) $(XDMCPLIB)
+ BSDEMUL = $(DEPXBSDLIB)
+#if DoLoadableServer
+ MFB = mfb/ModuleLibraryTargetName(mfb)
+ CFB = cfb/ModuleLibraryTargetName(cfb) \
+ cfb16/ModuleLibraryTargetName(cfb16) \
+ cfb24/ModuleLibraryTargetName(cfb24) \
+ cfb32/ModuleLibraryTargetName(cfb32)
+ CFB8 = cfb/ModuleLibraryTargetName(cfb)
+ CFB4 = cfb/ModuleLibraryTargetName(cfb) \
+ cfb4/ModuleLibraryTargetName(cfb4)
+ CFB16 = cfb/ModuleLibraryTargetName(cfb) \
+ cfb16/ModuleLibraryTargetName(cfb16)
+ CFB24 = cfb/ModuleLibraryTargetName(cfb) \
+ cfb24/ModuleLibraryTargetName(cfb24)
+ CFB32 = cfb/ModuleLibraryTargetName(cfb) \
+ cfb32/ModuleLibraryTargetName(cfb32)
+#else
+ MFB = mfb/LibraryTargetName(mfb)
+ CFB = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb16) \
+ cfb24/LibraryTargetName(cfb24) cfb32/LibraryTargetName(cfb32)
+ CFB8 = cfb/LibraryTargetName(cfb)
+ CFB4 = cfb/LibraryTargetName(cfb) cfb4/LibraryTargetName(cfb4)
+ CFB16 = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb16)
+ CFB24 = cfb/LibraryTargetName(cfb) cfb24/LibraryTargetName(cfb24)
+ CFB32 = cfb/LibraryTargetName(cfb) cfb32/LibraryTargetName(cfb32)
+#endif
+#if BuildLowMem
+ LMFCFB = lmfcfb/LibraryTargetName(cfb)
+#endif
+ MI = mi/LibraryTargetName(mi)
+ MIINITEXTOBJ = mi/miinitext.o
+ DIX = dix/LibraryTargetName(dix)
+ FONTBASE = $(FONTLIBSRC)/fontbase.o \
+ $(FONTLIBSRC)/LibraryTargetName(fontbase)
+ FONT = $(XFONTLIB) $(XPFBLIBS)
+ FONTLIBS = $(LDPRELIB) $(FONT)
+#ifdef ServerExtraSysLibs
+ EXTRASYSLIBS = ServerExtraSysLibs
+#endif
+#if SystemV4 || defined(SGIArchitecture) || UseRgbTxt
+ SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(EXTRASYSLIBS)
+#else
+ SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(EXTRASYSLIBS)
+#endif
+ CBRT = mi/LibraryTargetName(cbrt)
+ STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS)
+
+XCOMM
+XCOMM This turns off the default rule for compiling .c files because
+XCOMM this makefile does not really know how to build it. This is really
+XCOMM just a hack because of the Sun version of make and nfs.
+XCOMM
+.c.o:
+
+.s.o:
+
+/* Build rule blocks, add one for each server
+ *
+ * If a server needs mfb, its build block should have a line like:
+ * MFBDIR = mfb
+ * Similarly, its build block should have:
+ * CFB4DIR = cfb4 (if the server needs 4 bit cfb)
+ * CFB8DIR = cfb (8 bit cfb)
+ * CFB16DIR = cfb16 (16 bit cfb)
+ * CFB24DIR = cfb24 (24 bit cfb)
+ * CFB32DIR = cfb32 (32 bit cfb)
+ *
+ * If a server does not need all of the above components, simply
+ * omit the relevant lines from the build block.
+ *
+ * Additional ddx directories can be split across three variables:
+ * DDXDIR1, DDXDIR2, and DDXDIR3. Most servers only use DDXDIR1,
+ * but if two servers can be built on a platform then DDXDIR1 is
+ * typically set to the ddx directories that are shared by both
+ * servers, DDXDIR2 is the directories unique to one of the servers,
+ * and DDXDIR3 is the directories unique to the other server.
+ *
+ * If these guidelines are followed, a make at the top of the server
+ * tree should result in each subdirectory being built only once,
+ * even if multiple servers that share subdirectories are being built.
+ */
+
+#if BuildLowMem
+LMFCFBDIR = lmfcfb
+#endif
+
+#if XdecServer
+XCOMM
+XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond)
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+DDXDIR1 = hw/dec/ws
+#if BuildLowMem
+DECDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS)
+#else
+DECDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
+#endif
+DECOBJS = hw/dec/ws/init.o hw/dec/ws/sdepthinit.o
+#if BuildLowMem
+DECLIBS = hw/dec/ws/LibraryTargetName(dec) LMFCFBLibs
+#else
+DECLIBS = hw/dec/ws/LibraryTargetName(dec) CFB8Libs
+#endif
+ServerTarget(Xdec,$(DECDIRS),$(DECOBJS),$(DECLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xdec
+#endif
+#endif /* XdecServer */
+
+
+#if XdecMultiDepthServer
+XCOMM
+XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond)
+XCOMM Supports 8, 12, and 24 bit pixmaps
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB16DIR = cfb16
+CFB24DIR = cfb24
+CFB32DIR = cfb32
+DDXDIR1 = hw/dec/ws
+DECDIRS1 = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS)
+DECOBJS1 = hw/dec/ws/init.o hw/dec/ws/mdepthinit.o
+DECLIBS1 = hw/dec/ws/LibraryTargetName(dec) CFBLibs
+ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1),$(DECLIBS1),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xdec_md
+#endif
+#endif /* XdecMultiDepthServer */
+
+
+#if XsunServer
+XCOMM
+XCOMM Sun server
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+DDXDIR1 = hw/sun
+#ifndef AmoebaArchitecture
+SUNOBJS = hw/sun/sunInit.o
+#else
+SUNOBJS = hw/sun/sunInitColor.o
+#endif
+#if BuildLowMem
+SUNDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS)
+SUNLIBS = hw/sun/LibraryTargetName(sun) LMFCFBLibs
+#else
+SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
+SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs
+#endif
+SUNSYSLIBS = $(FONTLIBS) $(WIDECHARSYSLIB) $(SYSLIBS)
+SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SUNSYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xsun
+#endif
+#endif /* XsunServer */
+
+
+#if Xsun24Server
+XCOMM
+XCOMM Sun multiple pixmap depth (8, 12, 24) server
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB16DIR = cfb16
+CFB24DIR = cfb24
+CFB32DIR = cfb32
+DDXDIR1 = hw/sun
+SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS)
+SUN24OBJS = hw/sun/sunInitMulti.o
+SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs
+SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS),$(SUN24LIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xsun24
+#endif
+#endif /* Xsun24Server */
+
+
+#if XsunMonoServer
+XCOMM
+XCOMM Sun monochrome server
+XCOMM
+MFBDIR = mfb
+DDXDIR1 = hw/sun
+SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS)
+SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o
+SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS)
+SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall XsunMono
+#endif
+#endif /* XsunMonoServer */
+
+
+#if XsunAmoebaServer
+XCOMM
+XCOMM Sun server for Amoeba
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+DDXDIR1 = hw/sunAmoeba
+SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
+SUNOBJS = hw/sunAmoeba/sunInitColor.o
+SUNLIBS = hw/sunAmoeba/LibraryTargetName(sun) CFB8Libs
+ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xsun
+#endif
+#endif /* XsunAmoebaServer */
+
+
+#if XsunAmoebaMonoServer
+XCOMM
+XCOMM Sun monochrome server for Amoeba
+XCOMM
+MFBDIR = mfb
+DDXDIR1 = hw/sunAmoeba
+SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS)
+SUNMOBJS = hw/sunAmoeba/sunInitMono.o hw/sunAmoeba/sunInExMono.o
+SUNMLIBS = hw/sunAmoeba/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS)
+ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall XsunMono
+#endif
+#endif /* XsunAmoebaMonoServer */
+
+
+#if XsunLynxServer
+XCOMM
+XCOMM Sun server for LynxOS microSPARC 2.4.0
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+DDXDIR1 = hw/sunLynx
+SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
+SUNOBJS = hw/sunLynx/sunLyInit.o
+SUNLIBS = hw/sunLynx/libsun.a CFB8Libs
+ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xsun
+#endif
+#endif /* XsunLynxServer */
+
+
+#if XsunLynxMonoServer
+XCOMM
+XCOMM Sun monochrome server for LynxOS microSPARC 2.4.0
+XCOMM
+MFBDIR = mfb
+DDXDIR1 = hw/sunLynx
+SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS)
+SUNMOBJS = hw/sunLynx/sunInitMono.o hw/sunLynx/sunInExMono.o
+SUNMLIBS = hw/sunLynx/libsun.a MFBBareLibs $(OTHEREXTS)
+ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall XsunMono
+#endif
+#endif /* XsunLynxMonoServer */
+
+
+#if XibmServer
+XCOMM
+XCOMM IBM server
+XCOMM
+#if SpecialMalloc
+IBMALLOCLIB = hw/ibm/common/LibraryTargetName(ibmalloc)
+#else
+IBMALLOCLIB =
+#endif
+MFBDIR = mfb
+CFB8DIR = cfb
+DDXDIR1 = hw/ibm
+IBMDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
+IBMOBJS = hw/ibm/common/ibmcomm.o hw/ibm/common/ibmDate.o
+IBMLIBS = hw/ibm/AIX/hft.o hw/ibm/LibraryTargetName(ibm) $(IBMALLOCLIB) CFB8Libs
+ServerTarget(Xibm,$(IBMDIRS),$(IBMOBJS),$(IBMLIBS),$(FONTLIBS) $(SYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xibm
+#endif
+#endif /* XibmServer */
+
+
+#if XhpServer
+XCOMM
+XCOMM Hewlett Packard CFB Server
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB32DIR = cfb32
+DDXDIR1 = hw/hp
+HPOBJS = hw/hp/hp.o
+#if BuildLowMem
+HPSUBDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS)
+HPLIBS = LMFCFBLibs
+#else
+HPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS)
+HPLIBS = CFB32Libs
+#endif
+HPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS)
+ServerTarget(Xhp,$(HPSUBDIRS),$(HPOBJS),$(HPLIBS),$(HPSYSLIBS))
+#ifndef ServerToInstall
+#define ServerToInstall Xhp
+#endif
+#endif /* XhpServer */
+
+
+#if HasParallelMake
+XCOMM
+XCOMM force non-parallel build of XF86 servers to prevent MUTEX overrides
+XCOMM
+#if XF86Server
+XF86SERVER = XFree86
+#endif
+#if XnestServer && !MakeDllModules
+XNEST = Xnest
+#endif
+#if XVirtualFramebufferServer && !MakeDllModules
+XVFB = Xvfb
+#endif
+#if defined(XF86Server) || (!MakeDllModules &&
+ (defined(XnestServer) || defined(XVirtualFramebufferServer)))
+MakeMutex($(XF86SERVER) $(XNEST) $(XVFB))
+#endif
+MakeMutex($(STDDIRS) mfb cfb cfb16 cfb32)
+#endif
+
+
+#if XF86Server
+XCOMM
+XCOMM XFree86 Server
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB16DIR = cfb16
+CFB24DIR = cfb24
+CFB32DIR = cfb32
+#if XF86AFB
+AFBDIR = afb
+#endif
+DDXDIR1 = hw/xfree86
+XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(AFBDIR) $(DDXDIR1) $(DEPDIRS)
+XF86INIT = $(XF86COMSRC)/xf86Init.o $(XF86COMSRC)/xf86IniExt.o
+XF86COMLIB = $(XF86COMSRC)/LibraryTargetName(xf86)
+XF86PARSLIB= $(XF86PARSERSRC)/LibraryTargetName(xf86config)
+XF86OSLIB = $(XF86OSSRC)/LibraryTargetName(xf86_os)
+XF86HWLIB = $(XF86HWSRC)/LibraryTargetName(common_hw)
+#if XF86XAA
+XF86XAALIB = $(XF86SRC)/xaa/LibraryTargetName(xaa)
+#endif
+#if XF86VgaHw
+XF86VGAHWLIB = $(XF86SRC)/vgahw/LibraryTargetName(vgahw)
+#endif
+#if XF86FBDevHw
+XF86FBDEVHWLIB = $(XF86SRC)/fbdevhw/LibraryTargetName(fbdevhw)
+#endif
+#if XF1Bpp || XF4Bpp
+XF1BPPLIB = $(XF86SRC)/xf1bpp/LibraryTargetName(xf1bpp)
+#endif
+#if XF4Bpp
+XF4BPPLIB = $(XF86SRC)/xf4bpp/LibraryTargetName(xf4bpp)
+#endif
+#if XF8_32Bpp
+XF8_32BPPLIB = $(XF86SRC)/xf8_32bpp/LibraryTargetName(xf8_32bpp)
+#endif
+#if XF8_16Bpp
+XF8_16BPPLIB = $(XF86SRC)/xf8_16bpp/LibraryTargetName(xf8_16bpp)
+#endif
+#if XF24_32Bpp
+XF24_32BPPLIB = $(XF86SRC)/xf24_32bpp/LibraryTargetName(xf24_32bpp)
+#endif
+#if XFShadowFB
+XFSHADOWFBLIB = $(XF86SRC)/shadowfb/LibraryTargetName(shadowfb)
+#endif
+#if XF86AFB
+AFBLIB = afb/LibraryTargetName(afb)
+#endif
+XF86DRIVERLIB = $(XF86SRC)/drivers/LibraryTargetName(driver)
+#if XF86Ramdac
+XF86RAMDACLIB = $(XF86SRC)/ramdac/LibraryTargetName(ramdac)
+#endif
+#if XF86I2C
+XF86I2CLIB = $(XF86SRC)/i2c/LibraryTargetName(i2c)
+#endif
+#if XF86DDC
+XF86DDCLIB = $(XF86SRC)/ddc/LibraryTargetName(ddc)
+#endif
+#if XF86RAC
+XF86RACLIB = $(XF86SRC)/rac/LibraryTargetName(rac)
+#endif
+XF86IDRIVERLIB = $(XF86SRC)/input/LibraryTargetName(idriver)
+#if !DoLoadableServer
+XF86DRVOBJS = $(XF86SRC)/drivers/drvConf.o
+XF86DRVLIBS = $(XF86DRIVERLIB) $(XF86RAMDACLIB) $(XF86DDCLIB) $(XF86I2CLIB) \
+ $(XF86XAALIB) $(XF86VGAHWLIB) $(XF86FBDEVHWLIB) \
+ $(XF8_32BPPLIB) $(XF8_16BPPLIB) $(XF24_32BPPLIB) \
+ $(XF4BPPLIB) $(XF1BPPLIB) $(XFSHADOWFBLIB) $(AFBLIB)
+XF86IDRVOBJS = $(XF86SRC)/input/drvConf.o
+XF86IDRVLIBS = $(XF86IDRIVERLIB)
+XF86SCANLIB = $(XF86SRC)/scanpci/LibraryTargetName(scanpci)
+XF86LIBS = $(XF86INIT) $(XF86COMLIB) $(XF86RACLIB) $(XF86PARSLIB) $(XF86OSLIB)
+#else
+XF86LIBS = $(XF86INIT) $(XF86COMLIB) $(XF86PARSLIB) $(XF86OSLIB)
+#endif
+#if DoLoadableServer
+XF86LOADERLIB = $(XF86SRC)/loader/LibraryTargetName(loader)
+XF86MAINLIBS = PreFbLibsNoFont $(FONTBASE) $(OTHEREXTS) $(XF86COMLIB) \
+ NoMfbPostFbLibs
+XF86SERVERSYSLIBS = $(SYSLIBS) $(LIBDL) $(LIBREGEX)
+/* Mouse driver */
+XF86IDRVOBJS = $(XF86SRC)/input/mouse/mouse_drv.o
+#else
+XF86MAINLIBS = CFBLibs $(XF86COMLIB) $(MI)
+XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX)
+#endif
+XF86SERVEROBJS = $(XF86DRVOBJS) $(XF86IDRVOBJS)
+XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \
+ $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB)
+#if HasParallelMake
+MakeMutex($(XF86SERVERSUBDIRS) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS))
+#endif
+#if HasGnuMake
+$(XF86SERVERLIBS) $(XF86SERVERSYSLIBS):: $(XF86SERVERSUBDIRS)
+ @if [ -f $@ ]; then touch $@; fi
+#endif
+SetUIDServerTarget(XFree86,$(XF86SERVERSUBDIRS),$(XF86SERVEROBJS),$(XF86SERVERLIBS),$(XF86SERVERSYSLIBS))
+#if DoLoadableServer
+ServerDriverSDKTarget(XFree86)
+#endif
+#ifndef ServerToInstall
+#define ServerToInstall XFree86
+#endif
+#endif /* XF86Server */
+
+
+#if XprtServer && !MakeDllModules
+XCOMM
+XCOMM Print Server
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB32DIR = cfb32
+XPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DEPDIRS)
+#if PrintOnlyServer
+#if BuildXinerama
+XPPANSTUBOBJS = Xprint/panoramiXstubs.o
+#endif
+#if BuildDPMS
+XPDPMSSTUBOBJS = Xprint/dpmsstubs.o
+#endif
+XPOBJS = Xprint/ddxInit.o Xprint/miinitext.o $(XPPANSTUBOBJS) $(XPDPMSSTUBOBJS)
+XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs
+#else
+XPOBJS = Xprint/ddxInit.o
+XPLIBS = PreFbLibs PostFbLibs
+#endif
+#if (defined(SunArchitecture) || defined(SparcArchitecture)) && defined(SVR4Architecture)
+XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) -lw
+#else
+XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS)
+#endif
+#if HasParallelMake
+MakeMutex($(XPSUBDIRS) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS))
+#endif
+#if HasGnuMake
+$(XPOBJS) $(XPLIBS) $(XPSYSLIBS):: $(XPSUBDIRS)
+ @if [ -f $@ ]; then touch $@; fi
+#endif
+ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS),$(XPLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XPSYSLIBS))
+#endif /* XprtServer */
+
+#if XnestServer && !MakeDllModules
+XCOMM
+XCOMM Server with Xlib-based ddx
+XCOMM
+#ifndef Win32Architecture
+XNESTDDXDIR = hw/xnest
+#else
+XNESTDDXDIR = hw
+#endif
+XNESTDIRS = $(STDDIRS) $(XNESTDDXDIR) $(DEPDIRS)
+#if !defined(LynxOSArchitecture) && !defined(Win32Architecture)
+XNESTOBJS = hw/xnest/miinitext.o
+#else
+XNESTOBJS = hw/xnest/miinitext.o dix/main.o
+#endif
+XNEST = hw/xnest/LibraryTargetName(xnest)
+#if DoLoadableServer
+XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XNEST)
+#else
+XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XF86OSLIB) $(XNEST)
+#endif
+XNESTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS)
+#if HasParallelMake
+MakeMutex($(XNESTDIRS) $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS))
+#endif
+#if HasGnuMake
+$(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS):: $(XNESTDIRS)
+ @if [ -f $@ ]; then touch $@; fi
+#endif
+ServerTarget(Xnest,$(XNESTDIRS),$(XNESTOBJS), \
+ $(XNESTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XNESTSYSLIBS))
+#endif /* XnestServer */
+
+
+#if XnonServer
+XCOMM
+XCOMM non server, just compile sources for build test
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB16DIR = cfb16
+CFB32DIR = cfb32
+#if HasParallelMake
+MakeMutex($(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS))
+#endif
+Xnon: $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS)
+#endif /* XnonServer */
+
+
+#if XVirtualFramebufferServer && !MakeDllModules
+XCOMM
+XCOMM server with Virtual (malloced) framebuffer
+XCOMM
+MFBDIR = mfb
+CFB8DIR = cfb
+CFB16DIR = cfb16
+CFB24DIR = cfb24
+CFB32DIR = cfb32
+#ifndef Win32Architecture
+XVFBDDXDIR = hw/vfb
+#else
+XVFBDDXDIR = hw
+#endif
+XVFBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XVFBDDXDIR) $(DEPDIRS)
+#ifndef Win32Architecture
+#if BuildXinerama
+XVFBPANSTUBOBJS = hw/vfb/panoramiXstubs.o
+#endif
+#if BuildDPMS
+XVFBDPMSSTUBOBJS = hw/vfb/dpmsstubs.o
+#endif
+XVFBOBJS = hw/vfb/stubs.o hw/vfb/miinitext.o $(XVFBPANSTUBOBJS) $(XVFBDPMSSTUBOBJS)
+#else
+XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o
+#endif
+XVFB = hw/vfb/LibraryTargetName(vfb)
+#if DoLoadableServer
+XVFBLIBS = PreFbLibs $(XVFB) $(CFB) PostFbLibs $(MI)
+#else
+XVFBLIBS = PreFbLibs $(XVFB) $(CFB) PostFbLibs $(XF86OSLIB) $(MI)
+#endif
+XVFBSYSLIBS = $(FONTLIBS) $(SYSLIBS)
+#if HasParallelMake
+MakeMutex($(XVFBDIRS) $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS))
+#endif
+#if HasGnuMake
+$(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS):: $(XVFBDIRS)
+ @if [ -f $@ ]; then touch $@; fi
+#endif
+ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS), \
+ $(XVFBLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XVFBSYSLIBS))
+#endif /* XVirtualFramebufferServer */
+
+
+CFBDIRS = $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR)
+IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR)
+DDXDIRS = $(DDXDIR1) $(DDXDIR2) $(DDXDIR3) $(XVFBDDXDIR) $(XNESTDDXDIR)
+SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFBDIRS) $(IPLANDIRS) $(ILBMDIR) $(AFBDIR) \
+ $(LMFCFBDIR) $(DDXDIRS)
+
+#if defined(ServerToInstall) && !defined(OS2Architecture)
+install::
+ -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) ServerToInstall X)
+#endif
+
+#define IHaveSubdirs
+
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+ForceSubdirs($(DEPDIRS) $(SUBDIRS))
+
+InstallManPage(Xserver,$(MANDIR))
diff --git a/xc/programs/Xserver/PEX5/Imakefile b/xc/programs/Xserver/PEX5/Imakefile
new file mode 100644
index 000000000..b0840fd94
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/Imakefile
@@ -0,0 +1,75 @@
+XCOMM $XConsortium: Imakefile /main/11 1996/12/02 10:18:28 lehors $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/Imakefile,v 3.13 1999/08/14 10:49:24 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+#ifndef PexDipexCDebugFlags
+#define PexDipexCDebugFlags ServerCDebugFlags
+#endif
+
+ CDEBUGFLAGS = PexDipexCDebugFlags
+
+#ifndef Win32Architecture
+ SUBDIRS = dipex/dispatch dipex/swap dipex/objects ddpex/mi/level1 \
+ ddpex/mi/level2 ddpex/mi/level3 ddpex/mi/level4 \
+ ddpex/mi/shared ospex
+#else
+ SUBDIRS = dipex ddpex ospex
+#endif
+
+#if DoLoadableServer
+
+MSRCS = pexmodule.c
+MOBJS = pexmodule.o
+
+SRCS = $(MSRCS)
+
+OBJS = \
+ dipex/dispatch/?*.o \
+ dipex/swap/?*.o \
+ dipex/objects/?*.o \
+ ddpex/mi/level1/?*.o \
+ ddpex/mi/level2/?*.o \
+ ddpex/mi/level3/?*.o \
+ ddpex/mi/level4/?*.o \
+ ddpex/mi/shared/?*.o \
+ ospex/?*.o \
+ $(MOBJS)
+
+DONES = \
+ dipex/dispatch/DONE \
+ dipex/swap/DONE \
+ dipex/objects/DONE \
+ ddpex/mi/level1/DONE \
+ ddpex/mi/level2/DONE \
+ ddpex/mi/level3/DONE \
+ ddpex/mi/level4/DONE \
+ ddpex/mi/shared/DONE \
+ ospex/DONE
+
+INCLUDES = -Iinclude -I$(XINCLUDESRC) -I$(SERVERSRC)/include
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+ModuleObjectRule()
+
+DepLibraryModuleTarget(pex5,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS))
+InstallLibraryModule(pex5,$(MODULEDIR),extensions)
+ForceSubdirs($(SUBDIRS))
+
+#else
+MakeSubdirs($(SUBDIRS))
+#endif
+
+DependTarget()
+
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+InstallDriverSDKLibraryModule(pex5,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/xc/programs/Xserver/PEX5/ddpex/Imakefile b/xc/programs/Xserver/PEX5/ddpex/Imakefile
new file mode 100644
index 000000000..b01d7bae2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/Imakefile
@@ -0,0 +1,16 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/12/02 10:18:43 lehors $
+XCOMM This is only used on NT where we do not know how to jump over this dir
+
+#ifdef Win32Architecture
+
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+ SUBDIRS = mi
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/Imakefile
new file mode 100644
index 000000000..8af6bc664
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/Imakefile
@@ -0,0 +1,16 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/12/02 10:18:54 lehors $
+XCOMM This is only used on NT where we do not know how to jump over this dir
+
+#ifdef Win32Architecture
+
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+ SUBDIRS = level1 level2 level3 level4 shared
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/ddpex2.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/ddpex2.h
new file mode 100644
index 000000000..aab4f486e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/ddpex2.h
@@ -0,0 +1,210 @@
+/* $TOG: ddpex2.h /main/3 1998/02/10 12:38:12 kaleb $ */
+
+/***********************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef DDPEX2_H
+#define DDPEX2_H 1
+
+#include "miRender.h"
+
+/*
+No! this is just the same as miGenericStr
+typedef struct {
+ ddUSHORT ocNumber;
+ ddUSHORT pexOCLength;
+} ddGenericOCStr, *ddGenericOCPtr;
+*/
+
+typedef listofColour miColourStruct;
+
+typedef miListHeader miMarkerStruct;
+
+typedef struct {
+ ddCoord3D *pOrigin; /* origin of the string */
+ ddCoord3D *pDirections; /* 2 orientation vectors */
+ ddUSHORT numEncodings; /* # of mono encodings */
+ pexMonoEncoding *pText; /* text strings */
+} miTextStruct;
+
+typedef struct {
+ ddCoord2D *pOrigin; /* origin of the string */
+ ddUSHORT numEncodings; /* # of mono encodings */
+ pexMonoEncoding *pText; /* text strings */
+} miText2DStruct;
+
+typedef struct {
+ ddCoord3D *pOrigin; /* origin of the string */
+ ddCoord3D *pOffset; /* offset */
+ ddUSHORT numEncodings; /* # of mono encodings */
+ pexMonoEncoding *pText; /* text string */
+} miAnnoTextStruct;
+
+typedef struct {
+ ddCoord2D *pOrigin; /* origin of the string */
+ ddCoord2D *pOffset; /* offset */
+ ddUSHORT numEncodings; /* # of mono encodings */
+ pexMonoEncoding *pText; /* text string */
+} miAnnoText2DStruct;
+
+typedef miListHeader miPolylineStruct;
+
+typedef struct {
+ ddUSHORT order; /* curve order */
+ ddFLOAT uMin;
+ ddFLOAT uMax;
+ ddUSHORT numKnots;
+ ddFLOAT *pKnots;
+ ddListBounds bounds;
+ miListHeader points;
+} miNurbStruct;
+
+typedef struct {
+ ddUSHORT shape;
+ ddUCHAR ignoreEdges;
+ ddUCHAR contourHint;
+ listofddFacet *pFacets;
+ ddListBounds bounds;
+ miListHeader points;
+} miFillAreaStruct;
+
+typedef struct {
+ ddUSHORT numLists;
+ ddUSHORT maxData;
+ ddUSHORT *pConnects;
+} miConnList;
+
+typedef struct {
+ ddUSHORT numLists;
+ ddUSHORT maxData;
+ miConnList *pConnLists;
+} miConnListList;
+
+typedef struct {
+ ddUSHORT numListLists;
+ ddUSHORT maxData;
+ miConnListList *data;
+} miConnHeader;
+
+typedef struct {
+ ddUSHORT shape;
+ ddUSHORT edgeAttribs;
+ ddUCHAR contourHint;
+ ddUCHAR contourCountsFlag;
+ ddUSHORT numFAS;
+ ddUSHORT numEdges;
+ ddUCHAR *edgeData;
+ listofddFacet pFacets;
+ ddListBounds bounds;
+ miListHeader points;
+ miConnHeader connects;
+} miSOFASStruct;
+
+typedef struct {
+ listofddFacet *pFacets;
+ ddListBounds bounds;
+ miListHeader points;
+} miTriangleStripStruct;
+
+typedef struct {
+ ddUSHORT mPts;
+ ddUSHORT nPts;
+ ddUSHORT shape;
+ listofddFacet *pFacets;
+ ddListBounds bounds;
+ miListHeader points;
+} miQuadMeshStruct;
+
+typedef struct {
+ ddUSHORT uOrder;
+ ddUSHORT vOrder;
+ ddUSHORT mPts;
+ ddUSHORT nPts;
+ ddULONG numUknots;
+ ddFLOAT *pUknots;
+ ddULONG numVknots;
+ ddFLOAT *pVknots;
+ miListHeader points;
+ ddULONG numTrimCurveLists;
+ listofTrimCurve *trimCurves;
+} miNurbSurfaceStruct;
+
+
+typedef struct {
+ ddEnumTypeIndex type;
+ union {
+ char *pNone;
+ char *pImpDep;
+ ddPSC_IsoparametricCurves *pIsoCurves;
+ ddPSC_LevelCurves *pMcLevelCurves;
+ ddPSC_LevelCurves *pWcLevelCurves;
+ } data;
+} miPSurfaceCharsStruct;
+
+typedef struct {
+ listofObj *enableList;
+ listofObj *disableList;
+} miLightStateStruct;
+
+typedef struct {
+ ddUSHORT operator;
+ listofObj *halfspaces;
+} miMCVolume_Struct;
+
+typedef struct {
+ ddULONG dx;
+ ddULONG dy;
+ ddListBounds bounds;
+ miListHeader point;
+ listofColour colours;
+} miCellArrayStruct;
+
+
+typedef struct {
+ ddULONG GDPid;
+ ddULONG numBytes;
+ miListHeader points;
+ ddPointer pData;
+} miGdpStruct;
+
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miClip.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miClip.h
new file mode 100644
index 000000000..faca364f8
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miClip.h
@@ -0,0 +1,247 @@
+/* $TOG: miClip.h /main/4 1998/02/10 12:38:18 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifndef MI_CLIP_H
+#define MI_CLIP_H
+#include "miLight.h"
+/*
+ * CLIP_POINT4D - set oc to the clip code for the specified point.
+ *
+ */
+
+#define CLIP_POINT4D(in_pt, oc, clip_mode) \
+ if ((clip_mode) == MI_MCLIP) { \
+ float t; \
+ int count; \
+ int num_halfspaces = pddc->Static.misc.ms_MCV->numObj; \
+ ddHalfSpace *MC_HSpace = \
+ (ddHalfSpace *)(pddc->Static.misc.ms_MCV->pList); \
+ \
+ for (count = 0, (oc) = 0; count < num_halfspaces; count++) { \
+ DOT_PRODUCT(&(MC_HSpace->vector), (in_pt), t); \
+ if ((t) < MC_HSpace->dist ) \
+ (oc) |= MI_CLIP_LEFT; /* any one will do */ \
+ MC_HSpace++; \
+ } \
+ } else { \
+ if (((ddCoord4D *)(in_pt))->x < -((ddCoord4D *)(in_pt))->w) \
+ (oc) = MI_CLIP_LEFT; \
+ else if (((ddCoord4D *)(in_pt))->x > ((ddCoord4D *)(in_pt))->w) \
+ (oc) = MI_CLIP_RIGHT; \
+ else (oc) = 0; \
+ if (((ddCoord4D *)(in_pt))->y < -((ddCoord4D *)(in_pt))->w) \
+ (oc) |= MI_CLIP_BOTTOM; \
+ else if (((ddCoord4D *)(in_pt))->y > ((ddCoord4D *)(in_pt))->w) \
+ (oc) |= MI_CLIP_TOP; \
+ if (((ddCoord4D *)(in_pt))->z < -((ddCoord4D *)(in_pt))->w) \
+ (oc) |= MI_CLIP_FRONT; \
+ else if (((ddCoord4D *)(in_pt))->z > ((ddCoord4D *)(in_pt))->w) \
+ (oc) |= MI_CLIP_BACK; \
+ }
+
+#endif
+/*********************************************************************/
+
+/* COMPUTE_CLIP_PARAMS - compute whether or not a point is clipped, and
+ * how far it is to the current clipping boundary
+ */
+
+#define COMPUTE_CLIP_PARAMS(pt,t,Shift,mode,c_clip,HSpace,clip_code ) \
+ \
+ /* pt -4D point in question \
+ * t -floating point scale factor \
+ * Shift -Portion of clip code to work on \
+ * mode -Model or view clipping \
+ * c_clip -current clip plane for view clipping \
+ * HSpace -pointer to half space for model clip \
+ * clip_code -composire clipping code output \
+ */ \
+ \
+ if((mode) == MI_MCLIP) { \
+ \
+ DOT_PRODUCT(&(HSpace)->vector, (pt).ptr, t); \
+ if((t)< ((HSpace)->dist)) clip_code |= (1<<(Shift)); \
+ \
+ } else { \
+ switch (c_clip) \
+ { \
+ case MI_CLIP_LEFT: \
+ if ((pt).p4Dpt->x < -(pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w + (pt).p4Dpt->x; \
+ break; \
+ case MI_CLIP_RIGHT: \
+ if ((pt).p4Dpt->x > (pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w - (pt).p4Dpt->x; \
+ break; \
+ case MI_CLIP_BOTTOM: \
+ if ((pt).p4Dpt->y < -(pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w + (pt).p4Dpt->y; \
+ break; \
+ case MI_CLIP_TOP: \
+ if ((pt).p4Dpt->y > (pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w - (pt).p4Dpt->y; \
+ break; \
+ case MI_CLIP_FRONT: \
+ if ((pt).p4Dpt->z < -(pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w + (pt).p4Dpt->z; \
+ break; \
+ case MI_CLIP_BACK: \
+ if ((pt).p4Dpt->z > (pt).p4Dpt->w) \
+ clip_code |= (1 << (Shift)); \
+ (t) = (pt).p4Dpt->w - (pt).p4Dpt->z; \
+ break; \
+ } \
+ }
+
+
+ /* remember that ALL vertex types are of the form:
+ *
+ * |---------------------------|---------|----------|---------|
+ * coords color normal edge
+ * (opt) (opt) (opt)
+ */
+
+/* Assumes that point A is "out" and point B is "in" */
+#define CLIP_AND_COPY(pt_type, in_ptA, t_A, in_ptB, t_B, out_pt) \
+ { \
+ float t; \
+ if (clip_mode == MI_MCLIP) \
+ t = ((MC_HSpace->dist - t_A) / (t_B - t_A)); \
+ else t = (t_A) / ((t_A) - (t_B)); \
+ \
+ *(out_pt).p4Dpt = *(in_ptA).p4Dpt; \
+ \
+ (out_pt).p4Dpt->x += t * ((in_ptB).p4Dpt->x - (in_ptA).p4Dpt->x); \
+ (out_pt).p4Dpt->y += t * ((in_ptB).p4Dpt->y - (in_ptA).p4Dpt->y); \
+ (out_pt).p4Dpt->z += t * ((in_ptB).p4Dpt->z - (in_ptA).p4Dpt->z); \
+ (out_pt).p4Dpt->w += t * ((in_ptB).p4Dpt->w - (in_ptA).p4Dpt->w); \
+ \
+ (in_ptA).p4Dpt++; \
+ (in_ptB).p4Dpt++; \
+ (out_pt).p4Dpt++; \
+ \
+ if (DD_IsVertColour(pt_type)) \
+ { \
+ *(out_pt).pRgbFloatClr = *(in_ptA).pRgbFloatClr; \
+ \
+ (out_pt).pRgbFloatClr->red += \
+ t * ((in_ptB).pRgbFloatClr->red - \
+ (in_ptA).pRgbFloatClr->red); \
+ (out_pt).pRgbFloatClr->green += \
+ t * ((in_ptB).pRgbFloatClr->green - \
+ (in_ptA).pRgbFloatClr->green); \
+ (out_pt).pRgbFloatClr->blue += \
+ t * ((in_ptB).pRgbFloatClr->blue - \
+ (in_ptA).pRgbFloatClr->blue); \
+ (in_ptA).pRgbFloatClr++; \
+ (in_ptB).pRgbFloatClr++; \
+ (out_pt).pRgbFloatClr++; \
+ } \
+ if (DD_IsVertNormal(pt_type)) \
+ { \
+ *(out_pt).pNormal = *(in_ptA).pNormal; \
+ \
+ (out_pt).pNormal->x += \
+ t * ((in_ptB).pNormal->x - \
+ (in_ptA).pNormal->x); \
+ (out_pt).pNormal->y += \
+ t * ((in_ptB).pNormal->y - \
+ (in_ptA).pNormal->y); \
+ (out_pt).pNormal->z += \
+ t * ((in_ptB).pNormal->z - \
+ (in_ptA).pNormal->z); \
+ (in_ptA).pNormal++; \
+ (in_ptB).pNormal++; \
+ (out_pt).pNormal++; \
+ } \
+ \
+ if (DD_IsVertEdge(pt_type)) { \
+ *(out_pt).pEdge = *(in_ptA).pEdge; \
+ (in_ptA).pEdge++; \
+ (in_ptB).pEdge++; \
+ (out_pt).pEdge++; \
+ } \
+ (in_ptA).ptr -= point_size; \
+ (in_ptB).ptr -= point_size; \
+ (out_pt).ptr -= point_size; \
+ }
+
+
+/* Macros to manipulate the forward and backward edge flags of the triangle
+ * strip and quad mesh primitives
+ */
+#define FWD_EDGE_FLAG (1<<0)
+#define BKWD_EDGE_FLAG (1<<1)
+
+#define SET_FWD_EDGE(v_ptr, edge_offset) *(v_ptr + edge_offset) |= FWD_EDGE_FLAG
+#define CLEAR_FWD_EDGE(v_ptr, edge_offset) *(v_ptr + edge_offset) &= ~FWD_EDGE_FLAG
+#define SET_BKWD_EDGE(v_ptr, edge_offset) *(v_ptr + edge_offset) |= BKWD_EDGE_FLAG
+#define CLEAR_BKWD_EDGE(v_ptr, edge_offset) *(v_ptr + edge_offset) \
+ &= ~BKWD_EDGE_FLAG
+
+#define IS_ODD(num) (num & 1) /* macro to determine the correct "sense" of
+ * triangle strip facet in order to correctly
+ * calculate facet normals.
+ */
+
+#define MI_MCLIP 0
+#define MI_VCLIP 1
+
+
+/* JSH - assuming copy may overlap */
+#define COPY_POINT(in_pt, out_pt, point_size) \
+ memmove( (out_pt).ptr, (in_pt).ptr, (point_size) )
+
+/* JSH - assuming copy may overlap */
+#define COPY_FACET(in_fct, out_fct, facet_size) \
+ memmove( (out_fct), (in_fct), (facet_size) )
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miFont.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miFont.h
new file mode 100644
index 000000000..5abed9142
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miFont.h
@@ -0,0 +1,132 @@
+/* $TOG: miFont.h /main/5 1998/02/10 12:38:22 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/include/miFont.h,v 1.2 1999/01/31 12:21:27 dawes Exp $ */
+/*
+ * font internal format
+ */
+#ifndef MI_FONT_H
+#define MI_FONT_H
+
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "miRender.h"
+#include "PEXprotost.h"
+
+#define START_PROPS 0x100
+#define START_DISPATCH(_num_props) (START_PROPS + 160 * _num_props)
+#define START_PATH(_num_ch_, _num_props) (START_DISPATCH(_num_props) + sizeof(Dispatch) * _num_ch_)
+#define NUM_DISPATCH 128
+
+#ifndef PADDING
+#define PADDING(n) ( (n)%4 ? (4 - (n)%4) : 0)
+#endif /* PADDING */
+
+/* definitions in the local font coordinate system */
+#define FONT_COORD_HEIGHT 100.0
+#define FONT_COORD_BASE 0.0
+#define FONT_COORD_CAP 100.0
+#define FONT_COORD_HALF 50.0
+
+typedef enum {
+ PATH_2D=0,
+ PATH_3D=1,
+ PATH_4D=2
+} Font_path_type;
+
+typedef struct {
+ Font_path_type type;
+ ddFLOAT center;
+ ddFLOAT right;
+ ddULONG n_vertices;
+ miListHeader strokes;
+} Ch_stroke_data;
+
+typedef enum {
+ FONT_POLYLINES=0,
+ FONT_SPLINES=1,
+ FONT_POLYGONS=2
+} Font_type;
+
+typedef struct {
+ Font_type font_type;
+ char name[80];
+ unsigned long num_ch;
+ float top, bottom, max_width;
+ Ch_stroke_data **ch_data; /* list of *Ch_stroke_data, one per char */
+ pexFontInfo font_info;
+ pexFontProp *properties; /* list of associated properties */
+ int lutRefCount;/* number of LUTs referencing this font */
+ int freeFlag; /* should this be freed when no more refs */
+} miFontHeader;
+
+typedef struct {
+ ddFLOAT top, bottom, width;
+} Meta_font;
+
+typedef struct {
+ char propname[80];
+ char propvalue[80];
+}Property;
+
+typedef struct
+{
+ int magic; /* magic number */
+ char name[80]; /* name of this font */
+ float top, /* extreme values */
+ bottom,
+ max_width;
+ int num_ch; /* no. of fonts in the set */
+ int num_props; /* no. of font properties */
+ Property *properties; /* array of properties */
+} Font_file_header;
+
+typedef struct
+{
+ float center, /* center of the character */
+ right; /* right edge */
+ long offset; /* offset in the file of the character
+ * description */
+} Dispatch;
+
+#endif /* MI_FONT_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miInfo.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miInfo.h
new file mode 100644
index 000000000..3005e82dc
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miInfo.h
@@ -0,0 +1,349 @@
+/* $TOG: miInfo.h /main/5 1998/02/10 12:38:27 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+/* this file contains the definitions for the enum type and imp dep constant
+ * values
+ * Theoretically, these values can depend on the capabilities of the
+ * different workstation types, which basically depends on the drawable
+ * of the workstation. Currently, the SI support is the same for all
+ * drawables. If your implementation requires different support for each
+ * drawables, then define a similar set of values as these for
+ * each type. They are then loaded in a table which is accessed
+ * according to the drawable type (see ddpex/shared/miMisc.c).
+ */
+
+#ifndef MI_INFO_H
+#define MI_INFO_H
+
+#include "miNS.h"
+/* imp dep constants */
+
+/* These values are in two arrays that can be accessed by
+ * the PEXID constant value. Two arrays are used since some values are CARD32 and
+ * some are FLOAT. SI_NUM_..._IMPS define how many values there are of each type
+ */
+
+/* card32s */
+#define SI_NUM_INT_IMPS 22
+
+#define SI_DITHERING_SUPPORTED MI_FALSE
+#define SI_MAX_EDGE_WIDTH ~((unsigned long)0)
+#define SI_MAX_LINE_WIDTH ~((unsigned long)0)
+#define SI_MAX_MARKER_SIZE ~((unsigned long)0)
+#define SI_MAX_MODEL_CLIP_PLANES 64
+#define SI_MAX_NAME_SET_NAMES MINS_NAMESET_SIZE
+#define SI_MAX_NON_AMBIENT_LIGHTS 64
+#define SI_MAX_NURB_ORDER 10
+#define SI_MAX_TRIM_CURVE_ORDER 6
+#define SI_MIN_EDGE_WIDTH 1
+#define SI_MIN_LINE_WIDTH 1
+#define SI_MIN_MARKER_SIZE 1
+#define SI_NOM_EDGE_WIDTH 1 /* nominal edge width */
+#define SI_NOM_LINE_WIDTH 1 /* nominal line width */
+#define SI_NOM_MARKER_SIZE 1 /* nominal marker size */
+#define SI_SUPP_EDGE_WIDTHS ~((unsigned long)0) /* number of supported edge widths */
+#define SI_SUPP_LINE_WIDTHS ~((unsigned long)0) /* number of supported line widths */
+#define SI_SUPP_MARKER_SIZES ~((unsigned long)0) /* number of supported marker sizes */
+#define SI_BEST_COLOUR_APPROX_VALUES PEXColourApproxAnyValues
+#define SI_TRANSPARENCY_SUPPORTED MI_FALSE
+#define SI_DOUBLE_BUFFERING_SUPPORTED MI_TRUE
+#define SI_MAX_HITS_EVENT_SUPPORTED MI_TRUE
+
+/* floats */
+#define SI_NUM_FLOAT_IMPS 12
+
+/* ALL CIE primary chromaticity coefficients are taken from
+ * Rodgers' Procedural Elements for Computer Graphics
+ * for Color CRT monitor aligned to d6500 white
+ */
+#define SI_CHROM_RED_U 0.628
+#define SI_CHROM_RED_V 0.346
+#define SI_LUM_RED 1.0
+#define SI_CHROM_GREEN_U 0.268
+#define SI_CHROM_GREEN_V 0.588
+#define SI_LUM_GREEN 1.0
+#define SI_CHROM_BLUE_U 0.150
+#define SI_CHROM_BLUE_V 0.070
+#define SI_LUM_BLUE 1.0
+#define SI_CHROM_WHITE_U 0.313
+#define SI_CHROM_WHITE_V 0.329
+#define SI_LUM_WHITE 1.0
+
+
+/* enumerated type info */
+
+/* the SI_..._NUM value is the number of supported types */
+
+/* If you are changing these values.....
+ * OK, I blew it here. You gotta change the NUM info here
+ * AND you gotta go into ../shared/miMisc.c and change the
+ * stuff that's in the info tables. Maybe there's a way
+ * to do this so you can just go to one place and change it
+ * Also, this info isn't coded to match what's really happening
+ * in the rendering, so's if you change what happens during
+ * rendering, you gotta come here and change dese tables too.
+ * It isn't all done automagically and it probably should, but
+ * it's too late now. These values are used when setting the
+ * real_entry of LUTS.
+ */
+
+/* marker type */
+#define SI_MARKER_NUM 5
+#define SI_MARKER_1 "Dot"
+#define SI_MARKER_2 "Cross"
+#define SI_MARKER_3 "Asterisk"
+#define SI_MARKER_4 "Circle"
+#define SI_MARKER_5 "X"
+
+/* annotation text style */
+#define SI_ATEXT_NUM 2
+#define SI_ATEXT_1 "NotConnected"
+#define SI_ATEXT_2 "Connected"
+
+/* interior style */
+#define SI_INT_NUM 3
+#define SI_INT_1 "Hollow"
+#define SI_INT_2 "Solid"
+#define SI_INT_5 "Empty"
+/* others */
+#define SI_INT_3 "Pattern"
+#define SI_INT_4 "Hatch"
+
+/* hatch style */
+#define SI_HATCH_NUM 0
+
+/* line type */
+#define SI_LINE_NUM 4
+#define SI_LINE_1 "Solid"
+#define SI_LINE_2 "Dashed"
+#define SI_LINE_3 "Dotted"
+#define SI_LINE_4 "DashDot"
+
+/* surface edge type */
+#define SI_EDGE_NUM 4
+#define SI_EDGE_1 "Solid"
+#define SI_EDGE_2 "Dashed"
+#define SI_EDGE_3 "Dotted"
+#define SI_EDGE_4 "DashDot"
+
+/* pick device type */
+#define SI_PICK_DEVICE_NUM 2
+#define SI_PICK_DEVICE_1 "DC_HitBox"
+#define SI_PICK_DEVICE_2 "NPC_HitVolume"
+
+/* pick one methods */
+#define SI_PICK_ONE_NUM 1
+#define SI_PICK_ONE_LAST "Last"
+/* others */
+#define SI_PICK_ONE_CLOSEST_Z "ClosestZ"
+#define SI_PICK_ONE_VISIBLE_ANY "VisibleAny"
+#define SI_PICK_ONE_VISIBLE_CLOSEST "VisibleClosest"
+
+/* pick all methods */
+#define SI_PICK_ALL_NUM 1
+#define SI_PICK_ALL_ALL "All"
+/* others */
+#define SI_PICK_ALL_VISIBLE "Visible"
+
+/* polyline interpolation method */
+#define SI_LINE_INTERP_NUM 1
+#define SI_LINE_INTERP_1 "None"
+/* others */
+#define SI_LINE_INTERP_2 "Color"
+
+/* curve approximation method */
+#define SI_CURVE_APPROX_NUM 6
+#define SI_CURVE_APPROX_1 "ConstantBetweenKnots" /* (Imp. Dep.) */
+#define SI_CURVE_APPROX_2 "ConstantBetweenKnots"
+#define SI_CURVE_APPROX_3 "WCS_ChordalSize"
+#define SI_CURVE_APPROX_4 "NPC_ChordalSize"
+#define SI_CURVE_APPROX_6 "WCS_ChordalDev"
+#define SI_CURVE_APPROX_7 "NPC_ChordalDev"
+/* others */
+#define SI_CURVE_APPROX_5 "DC_ChordalSize"
+#define SI_CURVE_APPROX_8 "DC_ChordalDev"
+#define SI_CURVE_APPROX_9 "WCS_Relative"
+#define SI_CURVE_APPROX_10 "NPC_Relative"
+#define SI_CURVE_APPROX_11 "DC_Relative"
+
+/* reflection method */
+#define SI_REFLECT_NUM 4
+#define SI_REFLECT_1 "NoShading"
+#define SI_REFLECT_2 "Ambient"
+#define SI_REFLECT_3 "Diffuse"
+#define SI_REFLECT_4 "Specular"
+/* others */
+
+/* surface interpolation method */
+#define SI_SURF_INTERP_NUM 1
+#define SI_SURF_INTERP_1 "None"
+/* others */
+#define SI_SURF_INTERP_2 "Color"
+#define SI_SURF_INTERP_3 "DotProduct"
+#define SI_SURF_INTERP_4 "Normal"
+
+/* surface approximation method */
+#define SI_SURF_APPROX_NUM 6
+#define SI_SURF_APPROX_1 "ConstantBetweenKnots" /* (Imp. Dep.) */
+#define SI_SURF_APPROX_2 "ConstantBetweenKnots"
+#define SI_SURF_APPROX_3 "WCS_ChordalSize"
+#define SI_SURF_APPROX_4 "NPC_ChordalSize"
+#define SI_SURF_APPROX_6 "WCS_PlanarDev"
+#define SI_SURF_APPROX_7 "NPC_PlanarDev"
+/* others */
+#define SI_SURF_APPROX_5 "DC_ChordalSize"
+#define SI_SURF_APPROX_8 "DC_PlanarDev"
+#define SI_SURF_APPROX_9 "WCS_Relative"
+#define SI_SURF_APPROX_10 "NPC_Relative"
+#define SI_SURF_APPROX_11 "DC_Relative"
+
+/* trim curve approximation method */
+#define SI_TRIM_CURVE_NUM 2
+#define SI_TRIM_CURVE_1 "ConstantBetweenKnots" /* (Imp. Dep.) */
+#define SI_TRIM_CURVE_2 "ConstantBetweenKnots"
+
+/* model clip operator */
+#define SI_MODEL_CLIP_NUM 2
+#define SI_MODEL_CLIP_1 "Replace"
+#define SI_MODEL_CLIP_2 "Intersection"
+
+/* light type */
+#define SI_LIGHT_NUM 4
+#define SI_LIGHT_1 "Ambient"
+#define SI_LIGHT_2 "WCS_Vector"
+#define SI_LIGHT_3 "WCS_Point"
+#define SI_LIGHT_4 "WCS_Spot"
+
+/* colour type */
+#define SI_COLOUR_NUM 2
+#define SI_COLOUR_0 "Indexed"
+#define SI_COLOUR_1 "RGBFloat"
+/* others */
+#define SI_COLOUR_2 "CIEFloat"
+#define SI_COLOUR_3 "HSVFloat"
+#define SI_COLOUR_4 "HLSFloat"
+#define SI_COLOUR_5 "RGBInt8"
+#define SI_COLOUR_6 "RGBInt16"
+
+/* float format */
+#define SI_FLOAT_NUM 2
+#define SI_FLOAT_1 "IEEE_754_32"
+#define SI_FLOAT_2 "DEC_F_Floating"
+/* others */
+#define SI_FLOAT_3 "IEEE_754_64"
+#define SI_FLOAT_4 "DEC_D_Floating"
+
+/* hlhsr mode */
+#define SI_HLHSR_NUM 1
+#define SI_HLHSR_1 "Off"
+/* others */
+#define SI_HLHSR_2 "ZBuffer"
+#define SI_HLHSR_3 "Painters"
+#define SI_HLHSR_4 "Scanline"
+#define SI_HLHSR_5 "HiddenLineOnly"
+#define SI_HLHSR_6 "ZBufferId"
+
+/* prompt echo type */
+#define SI_PET_NUM 1
+#define SI_PET_1 "EchoPrimitive"
+/* others */
+#define SI_PET_2 "EchoStructure"
+#define SI_PET_3 "EchoNetwork"
+
+/* display update mode */
+#define SI_UPDATE_NUM 5
+#define SI_UPDATE_1 "VisualizeEach"
+#define SI_UPDATE_2 "VisualizeEasy"
+#define SI_UPDATE_3 "VisualizeNone"
+#define SI_UPDATE_4 "SimulateSome"
+#define SI_UPDATE_5 "VisualizeWhenever"
+
+/* colour approximation type */
+#define SI_CLR_APPROX_TYPE_NUM 2
+#define SI_CLR_APPROX_TYPE_1 "ColorSpace"
+#define SI_CLR_APPROX_TYPE_2 "ColorRange"
+
+/* colour approximation model */
+#define SI_CLR_APPROX_MODEL_NUM 1
+#define SI_CLR_APPROX_MODEL_1 "RGB"
+/* others */
+#define SI_CLR_APPROX_MODEL_2 "CIE"
+#define SI_CLR_APPROX_MODEL_3 "HSV"
+#define SI_CLR_APPROX_MODEL_4 "HLS"
+#define SI_CLR_APPROX_MODEL_5 "YIQ"
+
+/* gdp */
+#define SI_GDP_NUM 0
+
+/* gdp3 */
+#define SI_GDP3_NUM 0
+
+/* gse */
+#define SI_GSE_NUM 0
+
+/* escape */
+#define SI_ESCAPE_NUM 1
+#define SI_ESCAPE_1 "SetEchoColor"
+
+/* rendering colour model */
+#define SI_REND_COLOUR_NUM 1
+#define SI_REND_COLOUR_1 "RGB"
+/* others */
+#define SI_REND_COLOUR_0 "(Imp. Dep.)"
+#define SI_REND_COLOUR_2 "CIE"
+#define SI_REND_COLOUR_3 "HSV"
+#define SI_REND_COLOUR_4 "HLS"
+
+/* parametric surface characteristics */
+#define SI_P_SURF_CHAR_NUM 3
+#define SI_P_SURF_CHAR_1 "None"
+#define SI_P_SURF_CHAR_2 "None"
+#define SI_P_SURF_CHAR_3 "IsoparametricCurves"
+/* others */
+#define SI_P_SURF_CHAR_4 "MC_LevelCurves"
+#define SI_P_SURF_CHAR_5 "WC_Levelcurves"
+
+#endif /* MI_INFO_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miLUT.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLUT.h
new file mode 100644
index 000000000..14b8b86b2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLUT.h
@@ -0,0 +1,432 @@
+/* $TOG: miLUT.h /main/5 1998/02/10 12:38:32 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#ifndef MILUT_H
+#define MILUT_H
+
+#include "mipex.h"
+
+/****** devPriv data structures ******/
+/* pex-si uses data which looks like pex protocol format */
+
+typedef struct {
+ ddEnumTypeIndex lineType;
+ ddEnumTypeIndex polylineInterp;
+ ddCurveApprox curveApprox;
+ ddFLOAT lineWidth; /* this is really a scale */
+ ddColourSpecifier lineColour;
+} ddLineBundleEntry;
+
+typedef struct {
+ ddEnumTypeIndex markerType;
+ ddSHORT unused;
+ ddFLOAT markerScale; /* this really is a scale */
+ ddColourSpecifier markerColour;
+} ddMarkerBundleEntry;
+
+typedef struct {
+ ddUSHORT textFontIndex;
+ ddUSHORT textPrecision;
+ ddFLOAT charExpansion;
+ ddFLOAT charSpacing;
+ ddColourSpecifier textColour;
+} ddTextBundleEntry;
+
+typedef struct {
+ ddEnumTypeIndex interiorStyle;
+ ddSHORT interiorStyleIndex;
+ ddEnumTypeIndex reflectionModel;
+ ddEnumTypeIndex surfaceInterp;
+ ddEnumTypeIndex bfInteriorStyle;
+ ddSHORT bfInteriorStyleIndex;
+ ddEnumTypeIndex bfReflectionModel;
+ ddEnumTypeIndex bfSurfaceInterp;
+ ddSurfaceApprox surfaceApprox;
+ ddColourSpecifier surfaceColour;
+ ddReflectionAttr reflectionAttr;
+ ddColourSpecifier bfSurfaceColour;
+ ddReflectionAttr bfReflectionAttr;
+} ddInteriorBundleEntry;
+
+typedef struct {
+ ddSwitch edges;
+ ddUCHAR unused;
+ ddEnumTypeIndex edgeType;
+ ddFLOAT edgeWidth; /* this is really a scale */
+ ddColourSpecifier edgeColour;
+} ddEdgeBundleEntry;
+
+typedef struct {
+ ddSHORT colourType;
+ ddUSHORT numx;
+ ddUSHORT numy;
+ ddUSHORT unused;
+ /* LISTof Colour(numx, numy) 2D array of colours */
+ union {
+ ddIndexedColour *indexed;
+ ddRgb8Colour *rgb8;
+ ddRgb16Colour *rgb16;
+ ddRgbFloatColour *rgbFloat;
+ ddHsvColour *hsvFloat;
+ ddHlsColour *hlsFloat;
+ ddCieColour *cieFloat;
+ } colours;
+} ddPatternEntry;
+
+/* a ddColourEntry is just ddColourSpecifier */
+
+#define MILUT_MAX_CS_PER_ENTRY 16
+/* Much easier to code if this is a fixed size entry, thus we'll have it
+ * max out at MAX_CS_PER_ENTRY charsets per entry, MAX_CS_PER_ENTRY character
+ * sets per font group seems plenty reasonable. */
+
+typedef struct {
+ ddULONG numFonts;
+ diFontHandle fonts[MILUT_MAX_CS_PER_ENTRY]; /* list of fonts */
+} ddTextFontEntry;
+
+/* a ddViewEntry is defined in ddpex.h */
+
+typedef struct {
+ ddEnumTypeIndex lightType;
+ ddSHORT unused;
+ ddVector3D direction;
+ ddCoord3D point;
+ ddFLOAT concentration;
+ ddFLOAT spreadAngle;
+ ddFLOAT attenuation1;
+ ddFLOAT attenuation2;
+ ddColourSpecifier lightColour;
+} ddLightEntry;
+
+typedef struct {
+ ddUCHAR mode;
+ ddUCHAR unused;
+ ddUSHORT unused2;
+ ddFLOAT frontPlane;
+ ddFLOAT backPlane;
+ ddFLOAT frontScaling;
+ ddFLOAT backScaling;
+ ddColourSpecifier depthCueColour;
+} ddDepthCueEntry;
+
+typedef struct {
+ ddEnumTypeIndex approxType;
+ ddEnumTypeIndex approxModel;
+ ddUSHORT max1;
+ ddUSHORT max2;
+ ddUSHORT max3;
+ ddUCHAR dither;
+ ddUCHAR unused;
+ ddULONG mult1;
+ ddULONG mult2;
+ ddULONG mult3;
+ ddFLOAT weight1;
+ ddFLOAT weight2;
+ ddFLOAT weight3;
+ ddULONG basePixel;
+} ddColourApproxEntry;
+
+/* table entry definitions */
+/* some definitions contain a set and realized entry. this happens when
+ * realized data can differ from set data.
+ */
+
+/* status values */
+#define MILUT_UNDEFINED 0
+#define MILUT_PREDEFINED 1
+#define MILUT_DEFINED 2
+
+/* the device independent information for all table entries */
+typedef struct {
+ ddUSHORT status;
+ ddTableIndex index;
+} miTableEntry;
+
+typedef struct _miLineBundleEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddLineBundleEntry entry; /* set entry */
+ ddLineBundleEntry real_entry; /* realized entry */
+} miLineBundleEntry;
+
+typedef struct _miMarkerBundleEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddMarkerBundleEntry entry; /* set entry */
+ ddMarkerBundleEntry real_entry; /* realized entry */
+} miMarkerBundleEntry;
+
+typedef struct _miTextBundleEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddTextBundleEntry entry; /* set entry */
+ ddTextBundleEntry real_entry; /* realized entry */
+} miTextBundleEntry;
+
+typedef struct _miInteriorBundleEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddInteriorBundleEntry entry; /* set entry */
+ ddInteriorBundleEntry real_entry; /* realized entry */
+} miInteriorBundleEntry;
+
+typedef struct _miEdgeBundleEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddEdgeBundleEntry entry; /* set entry */
+ ddEdgeBundleEntry real_entry; /* realized entry */
+} miEdgeBundleEntry;
+
+typedef struct _miPatternEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddPatternEntry entry; /* set entry = realized entry */
+} miPatternEntry;
+
+/* each entry in the font table is a list of PEX or X fonts. */
+typedef struct _miTextFontEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddTextFontEntry entry; /* set entry = realized entry */
+} miTextFontEntry;
+
+typedef struct _miColourEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddColourSpecifier entry; /* set entry = realized entry */
+} miColourEntry;
+
+typedef struct _miViewEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddViewEntry entry; /* set entry = realized entry */
+ ddFLOAT vom[4][4]; /* concated mats */
+ ddFLOAT vom_inv[4][4]; /* inverse of vom */
+ ddBOOL inv_flag; /* is vom_inv current */
+} miViewEntry;
+
+typedef struct _miLightEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddLightEntry entry; /* set entry = realized entry */
+ double cosSpreadAngle; /* cosine */
+} miLightEntry;
+
+typedef struct _miDepthCueEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddDepthCueEntry entry; /* set entry = realized entry */
+} miDepthCueEntry;
+
+typedef struct _miColourApproxEntry {
+ miTableEntry entry_info;
+/* device dependent data */
+ ddColourApproxEntry entry; /* set entry = realized entry */
+} miColourApproxEntry;
+
+typedef ddpex43rtn (*miOpsTableType)();
+
+typedef struct _miLUTHeader {
+ /* the resource id is in the dipex resource structure */
+ /* the lut type is also in the dipex resource structure */
+ ddDrawableInfo drawExample;
+ ddSHORT drawType;
+ /* there are macros defined in this file to get at these: */
+ ddUSHORT startIndex;
+ ddUSHORT defaultIndex;
+ ddUSHORT numDefined;
+ ddTableInfo tableInfo;
+ /**/
+ listofObj *wksRefList;
+ listofObj *rendRefList;
+ ddBOOL freeFlag;
+/* the lut entries are just an array of entries. this works OK
+ * for small tables. if you want a large table, you'll probably
+ * want to change this scheme to use a hash table into the array
+ * or maybe n-ary trees to improve performance of searching for
+ * entries (see macros below). PEX-SI does linear search
+ */
+ union {
+ miLineBundleEntry *line;
+ miMarkerBundleEntry *marker;
+ miTextBundleEntry *text;
+ miInteriorBundleEntry *interior;
+ miEdgeBundleEntry *edge;
+ miPatternEntry *pattern;
+ miTextFontEntry *font;
+ miColourEntry *colour;
+ miViewEntry *view;
+ miLightEntry *light;
+ miDepthCueEntry *depthCue;
+ miColourApproxEntry *colourApprox;
+ } plut;
+/* Table of operation procs for luts. One for each lut request & some
+ * internal ones.
+ * Individual procedures can be loaded depending on the lut type.
+ * These procs are defined in the files mi<type>LUT.c.
+ * diPEX always calls 'general' procedures (defined in miLUT.c)
+ * directly. Those procedures then call the individual procs through
+ * this table as needed. Not all requests need to be handled
+ * differently for each table type. For those requests, the
+ * general procedure does all of the work and there is no individual
+ * procedure. The general procedure is loaded into the table for
+ * that op.
+ */
+#define MILUT_MIN_REQUEST PEX_CreateLookupTable
+#define MILUT_MAX_REQUEST PEX_DeleteTableEntries
+#define MILUT_IMPDEP_REQUESTS 6
+#define MILUT_NUM_REQUESTS (MILUT_MAX_REQUEST - MILUT_MIN_REQUEST + 1 + MILUT_IMPDEP_REQUESTS)
+/* map pex request opcode to index into op table */
+#define MILUT_REQUEST_OP(req) ((req) - MILUT_MIN_REQUEST)
+/* imp dep opcodes to use to map into op table */
+#define milut_InquireEntryAddress (MILUT_MAX_REQUEST + 1)
+#define milut_entry_check (milut_InquireEntryAddress + 1)
+#define milut_copy_pex_to_mi (milut_entry_check + 1)
+#define milut_copy_mi_to_pex (milut_copy_pex_to_mi + 1)
+#define milut_realize_entry (milut_copy_mi_to_pex + 1)
+#define milut_mod_call_back (milut_realize_entry + 1)
+
+ miOpsTableType ops[MILUT_NUM_REQUESTS];
+} miLUTHeader;
+
+#define MILUT_HEADER(handle) \
+ ((miLUTHeader *)(handle)->deviceData)
+
+#define MILUT_DEFINE_HEADER(handle, phead) \
+ miLUTHeader *(phead) = MILUT_HEADER(handle)
+
+#define MILUT_DESTROY_HEADER( phead ) \
+ puDeleteList( (phead)->wksRefList ); \
+ puDeleteList( (phead)->rendRefList ); \
+ xfree((phead)->plut.line); \
+ xfree((phead))
+
+#define MILUT_CHECK_DESTROY( handle, phead ) \
+ if ( (phead)->freeFlag && \
+ !(phead)->wksRefList->numObj && \
+ !(phead)->rendRefList->numObj ) \
+ { \
+ MILUT_DESTROY_HEADER( phead ); \
+ xfree(handle); \
+ }
+
+#define MILUT_MAX_INDEX 65535
+
+#define MILUT_TYPE(handle) (handle->lutType)
+
+#define MILUT_START_INDEX( pheader ) \
+ (pheader)->startIndex
+
+/* max number of definable entries */
+#define MILUT_DEF_ENTS( pheader ) \
+ (pheader)->tableInfo.definableEntries
+
+#define MILUT_ALLOC_ENTS( pheader ) \
+ (MILUT_DEF_ENTS(pheader))
+
+/* number of predefined entries */
+#define MILUT_PRENUM( pheader ) \
+ (pheader)->tableInfo.numPredefined
+
+/* index of first predefined entry */
+#define MILUT_PREMIN( pheader ) \
+ (pheader)->tableInfo.predefinedMin
+
+/* index of last predefined entry: premax = premin + prenum - 1 */
+#define MILUT_PREMAX( pheader ) \
+ (pheader)->tableInfo.predefinedMax
+
+/* number of defined entries (includes predefined ones) */
+#define MILUT_NUM_ENTS( pheader ) \
+ (pheader)->numDefined
+
+/* index of default entry */
+#define MILUT_DEFAULT_INDEX( pheader ) \
+ (pheader)->defaultIndex
+
+#define MILUT_COPY_COLOUR(Colour, Buf, Type) \
+ mibcopy((Colour), (Buf), colour_type_sizes[(int) (Type)])
+
+/* set status of entries
+ * i must be declared when using this
+ * and pentry must be pointing to the first entry to set status
+ * if the flag is TRUE, the entry's index is also set
+ * The flag is used to 'set up' the table to be used with a full table
+ * of contiguous indices (as apposed to a sparse table where entries
+ * can have any index value) most efficiently. Sparse entries will
+ * work, but continguous entries are used more often (I know - sparse
+ * entries haven't worked for almost 2 years and no-one has complained)
+ */
+#define MILUT_SET_STATUS( pentry, num_ents, stat, flag ) \
+ for ( i=0; i<(num_ents); i++, (pentry)++ ) { \
+ (pentry)->entry_info.status = (stat); \
+ if (flag) (pentry)->entry_info.index = i; }
+
+/* return pointer to entry with index 'index'. if that entry
+ * is not defined, return NULL
+ * pentry must be initially pointing to entry where search is to
+ * begin
+ * plast must be pointing to the last definable entry in the lut
+ * This does a linear search. Change this to a more efficient
+ * method for large tables
+ */
+#define MILUT_GET_ENTRY(ind, pentry, plast) \
+ while ( ((pentry) < (plast)) && ((ind) != (pentry)->entry_info.index) ) \
+ (pentry)++; \
+ if ((pentry) == (plast)) pentry = NULL; \
+ else if ((ind) != (pentry)->entry_info.index) pentry = NULL
+
+#define MILUT_INIT_COLOUR(Colour) \
+ (Colour).colourType = PEXIndexedColour; \
+ (Colour).colour.indexed.index = 1
+
+/* modification types passed to call back procedure */
+#define MILUT_COPY_MOD 0
+#define MILUT_SET_MOD 1
+#define MILUT_DEL_MOD 2
+
+#endif /* MILUT_H */
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miLight.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLight.h
new file mode 100644
index 000000000..65edb6b19
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLight.h
@@ -0,0 +1,272 @@
+/* $TOG: miLight.h /main/5 1998/02/10 12:38:37 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/include/miLight.h,v 1.4 1998/10/04 09:34:07 dawes Exp $ */
+
+#ifndef MI_LIGHT_H
+#define MI_LIGHT_H
+
+/* Macros for lighting calculations */
+
+/****
+ *
+ * Name: NEAR_ZERO
+ * Synopsis: determine if a floating point ia approximately 0.
+ *
+ ****/
+#define ZERO_TOLERANCE 1.0e-30
+#define NEAR_ZERO(a) \
+ ( ((a) < 0) ? ((a) > -ZERO_TOLERANCE) : ((a) < ZERO_TOLERANCE) )
+
+/****
+ *
+ * Name: DOT_PRODUCT
+ * Synopsis: Compute the Dot (or inner) product of two vectors
+ *
+ ****/
+#define DOT_PRODUCT(v1, v2, v1_dot_v2) \
+{ \
+ ddFLOAT *t1, *t2; \
+ t1 = (ddFLOAT *) (v1); \
+ t2 = (ddFLOAT *) (v2); \
+ (v1_dot_v2) = (*(t1++) * *(t2++)); \
+ (v1_dot_v2) += (*(t1++) * *(t2++)); \
+ (v1_dot_v2) += (*(t1 ) * *(t2 )); \
+}
+
+
+/****
+ *
+ * Name: CROSS_PRODUCT
+ * Synopsis: Give three points p0, p1, p2, compute the cross product
+ * of the two vectors (p1p0)x(p1p2). This corresponds to
+ * computing the geomtric normal of a facet whose coordinates
+ * are specified in counter-clockwise order.
+ *
+ ****/
+#define CROSS_PRODUCT(p0, p1, p2, v) \
+{ \
+ register ddFLOAT *t; \
+ t = (ddFLOAT *) (v); \
+ *(t++) = (((p2->y-p1->y)*(p0->z-p1->z))-((p0->y-p1->y)*(p2->z-p1->z))); \
+ *(t++) = -(((p2->x-p1->x)*(p0->z-p1->z))-((p0->x-p1->x)*(p2->z-p1->z))); \
+ *(t ) = (((p2->x-p1->x)*(p0->y-p1->y))-((p0->x-p1->x)*(p2->y-p1->y))); \
+}
+
+
+/****
+ *
+ * Name: COPY_VECTOR
+ * Synopsis: Copy a 3-component vector.
+ *
+ ****/
+#define COPY_VECTOR(dest, src) \
+{ \
+ register ddFLOAT *d, *s; \
+ d = (ddFLOAT *) (dest); \
+ s = (ddFLOAT *) (src); \
+ *(d++) = *(s++); \
+ *(d++) = *(s++); \
+ *(d ) = *(s ); \
+}
+
+
+/****
+ *
+ * Name: NEGATE_VECTOR
+ * Synopsis: Reverse direction of a 3-component vector.
+ *
+ ****/
+#define NEGATE_VECTOR(dest, src) \
+{ \
+ register ddFLOAT *d, *s; \
+ d = (ddFLOAT *) (dest); \
+ s = (ddFLOAT *) (src); \
+ *(d++) = -(*(s++)); \
+ *(d++) = -(*(s++)); \
+ *(d ) = -(*(s )); \
+}
+
+
+/****
+ *
+ * Name: NORMALIZE_VECTOR
+ * Synopsis: Normalize a 3-component vector.
+ * Description: Replace arbitrary vector with unit vector (same direction)
+ * and also return the original length.
+ *
+ ****/
+#define NORMALIZE_VECTOR(vector, length) \
+{ \
+ ddFLOAT *v; \
+ v = (ddFLOAT *) (vector); \
+ DOT_PRODUCT(v, v, (length)); \
+ (length) = sqrt ((length)); \
+ if (length != 0.0) { \
+ *(v++) /= (length); \
+ *(v++) /= (length); \
+ *(v ) /= (length); \
+ } \
+}
+
+
+/****
+ *
+ * Name: CALCULATE_REFLECTION_VECTOR
+ * Synopsis: Calculates the reflection vector as determined by
+ * the laws of geometrical optics.
+ *
+ ****/
+#define CALCULATE_REFLECTION_VECTOR(refl, n_dot_l, normal, light) \
+{ \
+ ddFLOAT *r, *n, *l; \
+ ddFLOAT temp; \
+ r = (ddFLOAT *) (refl); \
+ temp = 2.0 * (n_dot_l); \
+ n = (ddFLOAT *) (normal); \
+ l = (ddFLOAT *) (light); \
+ *(r++) = temp * (*(n++)) - *(l++); \
+ *(r++) = temp * (*(n++)) - *(l++); \
+ *(r ) = temp * (*(n )) - *(l ); \
+}
+
+
+/****
+ *
+ * Name: CALCULATE_DIRECTION_VECTOR
+ * Synopsis: Calculates the direction vector (without normalization)
+ * from one position to another.
+ *
+ ****/
+#define CALCULATE_DIRECTION_VECTOR(to, from, dir) \
+{ \
+ register ddFLOAT *d, *t, *f; \
+ d = (ddFLOAT *) (dir); \
+ t = (ddFLOAT *) (to); \
+ f = (ddFLOAT *) (from); \
+ *(d++) = *(t++) - *(f++); \
+ *(d++) = *(t++) - *(f++); \
+ *(d ) = *(t ) - *(f ); \
+}
+
+/****
+ *
+ * Name: APPLY_DEPTH_CUING
+ * Synopsis: Applies depth cueing calculation to a colour
+ * value according to the suggested equations of
+ * the PHIGS spec, "Annex E - Informative"
+ *
+ ****/
+#define APPLY_DEPTH_CUEING(dcue_entry, pt_depth, in_color, out_color) \
+{ \
+ float tmp1, tmp2; \
+ \
+ if ((pt_depth) > (dcue_entry).frontPlane) { \
+ tmp1 = (1.0 - ((dcue_entry).frontScaling)); \
+ (out_color)->red = \
+ ((dcue_entry).frontScaling * (in_color)->red) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.red); \
+ \
+ (out_color)->green = \
+ ((dcue_entry).frontScaling * (in_color)->green) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.green);\
+ \
+ (out_color)->blue = \
+ ((dcue_entry).frontScaling * (in_color)->blue) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.blue); \
+ \
+ } else if ((pt_depth) < (dcue_entry).backPlane) { \
+ tmp1 = (1.0 - ((dcue_entry).backScaling)); \
+ (out_color)->red = \
+ ((dcue_entry).backScaling * (in_color)->red) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.red); \
+ \
+ (out_color)->green = \
+ ((dcue_entry).backScaling * (in_color)->green) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.green);\
+ \
+ (out_color)->blue = \
+ ((dcue_entry).backScaling * (in_color)->blue) + \
+ ((tmp1) * (dcue_entry).depthCueColour.colour.rgbFloat.blue); \
+ \
+ } else { /* between front and back planes */ \
+ \
+ tmp1 = ((dcue_entry).backScaling + \
+ (((pt_depth) - (dcue_entry).backPlane) * \
+ (((dcue_entry).frontScaling-(dcue_entry).backScaling) / \
+ ((dcue_entry).frontPlane-(dcue_entry).backPlane)) ) ); \
+ \
+ tmp2 = (1.0 - tmp1); \
+ \
+ (out_color)->red = (((tmp1) * (in_color)->red) + \
+ (tmp2 * (dcue_entry).depthCueColour.colour.rgbFloat.red)); \
+ \
+ (out_color)->green = (((tmp1) * (in_color)->green) + \
+ (tmp2 * (dcue_entry).depthCueColour.colour.rgbFloat.green)); \
+ \
+ (out_color)->blue = (((tmp1) * (in_color)->blue) + \
+ (tmp2 * (dcue_entry).depthCueColour.colour.rgbFloat.blue)); \
+ } \
+}
+
+/*
+ *
+ * Name: AVERAGE
+ * Synopsis: Give three points p0, p1, p2, compute the average
+ * position in world coordinates
+ *
+ ****/
+#define AVERAGE(p0, p1, p2, avg) \
+{ \
+ register ddFLOAT *t; \
+ t = (ddFLOAT *) (avg); \
+ *(t++) = ((p0->x) + (p1->x) + (p2->x)) / 3.0; \
+ *(t++) = ((p0->y) + (p1->y) + (p2->y)) / 3.0; \
+ *(t ) = ((p0->z) + (p1->z) + (p2->z)) / 3.0; \
+}
+
+
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miLineDash.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLineDash.h
new file mode 100644
index 000000000..601226301
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miLineDash.h
@@ -0,0 +1,72 @@
+/* $TOG: miLineDash.h /main/3 1998/02/10 12:38:43 kaleb $ */
+
+/*****************************************************************
+
+Copyright 1989,1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989,1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef MI_LINEDASH_H
+#define MI_LINEDASH_H
+
+/*
+ * Define the pre-defined PEX line dash types for ddx
+ *
+ * PEX defines four line dash styles:
+ *
+ * PEXLineTypeSolid
+ * clearly no pattern needed here!
+ * PEXLineTypeDashed
+ * defined for this implementation as 7 pixels on, 7 off.....
+ * PEXLineTypeDotted
+ * defined for this implementation as 1 pixels on, 5 off.....
+ * PEXLineTypeDashDot
+ * defined for this implementation as
+ * 9 pixels on, 3 off, 1 on, 3 off....
+ */
+#define MAX_LINE_DASH_LENGTH_SIZE 4*sizeof(unsigned char)
+static int mi_line_dashed_length = 2;
+static unsigned char mi_line_dashed[] = {7,7};
+static int mi_line_dotted_length = 2;
+static unsigned char mi_line_dotted[] = {1,5};
+static int mi_line_dashdot_length = 4;
+static unsigned char mi_line_dashdot[] = {7,3,1,3};
+
+#endif /* MI_LINEDASH_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miMarkers.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miMarkers.h
new file mode 100644
index 000000000..9536c79f3
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miMarkers.h
@@ -0,0 +1,154 @@
+/* $TOG: miMarkers.h /main/3 1998/02/10 12:38:47 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifndef MI_MARKERS_H
+#define MI_MARKERS_H
+
+/*
+ * Marker geometry definitions
+ *
+ * There are five predefined marker types:
+ * PEXMarkerDot: draw a single pixel
+ * PEXMarkerCross: draws a "+" sign
+ * PEXMarkerAsterisk: draws an "*"
+ * PEXMarkerCircle: draws a circle.
+ * PEXMarkerX: draw an "X"
+ *
+ * The geometry for a pixel is simple and requires no pre-definition.
+ * the geometry for a circle must be computed on the fly.
+ *
+ * The geomtries for the remaining three marker types are pre-defined
+ * in the following data structures.
+ *
+ */
+
+/*
+ * PEXMarkerCross
+ *
+ * the cross is defined as two polylines: (-1.0, 0.0) <-> (1.0, 0.0)
+ * (0.0, -1.0) <-> (0.0, 1.0)
+ */
+static ddCoord2D cross_data_1[2]={ -1.0, 0.0,
+ 1.0, 0.0 };
+static ddCoord2D cross_data_2[2]={ 0.0, -1.0,
+ 0.0, 1.0 };
+static MarkerlistofddPoint cross_list[2]={
+ 2, /* numPoints */
+ 2*sizeof(ddCoord2D), /* maxData */
+ cross_data_1, /* data pointer */
+ 2, /* numPoints */
+ 2*sizeof(ddCoord2D), /* maxData */
+ cross_data_2 }; /* data pointer */
+static miListHeader cross_header={ DD_2D_POINT, /* type */
+ 0, /* flags */
+ 2, /* numLists */
+ 2, /* maxLists */
+ (listofddPoint *)cross_list }; /* listofddPoint */
+
+/*
+ * PEXMarkerAsterisk
+ *
+ * the Asterisk is defined as four polylines:
+ * (-1.0, 0.0) <-> (1.0, 0.0)
+ * (0.0, -1.0) <-> (0.0, 1.0)
+ * (-0.707, -0.707) <-> (0.707, 0.707)
+ * (0.707, -0.707) <-> (-0.707, 0.707)
+ *
+ * Note that 0.707 is ~ sqrt(2.0)/2.0, or the endpoints of either of the
+ * vertical or horizontal segments rotated by 45 degrees.
+ */
+static ddCoord2D asterisk_data_1[2]={ -1.0, 0.0,
+ 1.0, 0.0 };
+static ddCoord2D asterisk_data_2[2]={ 0.0, -1.0,
+ 0.0, 1.0 };
+static ddCoord2D asterisk_data_3[2]={ -0.7071, -0.7071,
+ 0.7071, 0.7071 };
+static ddCoord2D asterisk_data_4[2]={ 0.7071, -0.7071,
+ -0.7071, 0.7071 };
+static MarkerlistofddPoint asterisk_list[4]={
+ 2, /*numPoints*/
+ 2*sizeof(ddCoord2D), /* maxData */
+ asterisk_data_1, /* data */
+ 2, /*numPoints*/
+ 2*sizeof(ddCoord2D), /* maxData */
+ asterisk_data_2, /* data */
+ 2, /*numPoints*/
+ 2*sizeof(ddCoord2D), /* maxData */
+ asterisk_data_3, /* data */
+ 2, /*numPoints*/
+ 2*sizeof(ddCoord2D), /* maxData */
+ asterisk_data_4 }; /* data */
+static miListHeader asterisk_header={ DD_2D_POINT, /* type */
+ 0, /* flags */
+ 4, /* numLists */
+ 4, /* maxLists */
+ (listofddPoint *)asterisk_list }; /* data */
+
+/*
+ * PEXMarkerX
+ *
+ * the X is defined as two polylines: (-1.0, -1.0) <-> (1.0, 1.0)
+ * (1.0, -1.0) <-> (-1.0, 1.0)
+ */
+static ddCoord2D X_data_1[2]={ -1.0, -1.0,
+ 1.0, 1.0 };
+static ddCoord2D X_data_2[2]={ 1.0, -1.0,
+ -1.0, 1.0 };
+static MarkerlistofddPoint X_list[2]={
+ 2, /* numPoints */
+ 16, /* maxData */
+ X_data_1, /* data pointer */
+ 2, /* numPoints */
+ 2*sizeof(ddCoord2D), /* maxData */
+ X_data_2 }; /* data pointer */
+static miListHeader X_header={ DD_2D_POINT, /* type */
+ 0, /* flags */
+ 2, /* numLists */
+ 2, /* maxLists */
+ (listofddPoint *)X_list }; /* listofddPoint */
+
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miNS.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miNS.h
new file mode 100644
index 000000000..c67b2eb3e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miNS.h
@@ -0,0 +1,136 @@
+/* $TOG: miNS.h /main/3 1998/02/10 12:38:52 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "ddpex.h"
+
+#ifndef MINS_H
+#define MINS_H
+
+typedef ddULONG ddNamePiece;
+typedef ddNamePiece *ddNamePtr;
+
+#define MINS_MIN_NAME 0
+#define MINS_MAX_NAME 255
+#define MINS_NAMESET_SIZE (MINS_MAX_NAME - MINS_MIN_NAME +1)
+
+#define MINS_VALID_NAME(name) \
+ ( ((name) >= MINS_MIN_NAME) && ((name) <= MINS_MAX_NAME) )
+
+#define MINS_COUNT_BITS(type_or_var) (sizeof(type_or_var) * 8)
+
+/* Name N is present if bit MINS_NAMESET_BIT(N) is set in
+ * nameset word[ MINS_NAMESET_WORD(N) ]
+ */
+#define MINS_NAMESET_WORD_COUNT \
+ (MINS_NAMESET_SIZE / MINS_COUNT_BITS(ddNamePiece))
+
+#define MINS_NAMESET_WORD_NUM(one_name) \
+ ((one_name) / MINS_COUNT_BITS(ddNamePiece))
+
+#define MINS_NAMESET_BIT(one_name) \
+ (1 << ((one_name) % MINS_COUNT_BITS(ddNamePiece)))
+
+#define MINS_EMPTY_NAMESET(nameset) \
+ { register ddNamePtr n = nameset; \
+ register ddNamePtr end = &nameset[MINS_NAMESET_WORD_COUNT]; \
+ do { *n = 0; n++; } while (n < end); }
+
+#define MINS_FILL_NAMESET(nameset) \
+ { register ddNamePtr n = nameset; \
+ register ddNamePtr end = &nameset[MINS_NAMESET_WORD_COUNT]; \
+ do { *n = ~0; n++; } while (n < end); }
+
+#define MINS_COPY_NAMESET(source, dest) \
+ { register ddNamePtr s = (source), d = (dest); \
+ register ddNamePtr end = &(d)[MINS_NAMESET_WORD_COUNT]; \
+ do { *d = *s; d++; s++; } while (d < end); }
+
+#define MINS_OR_NAMESETS(source, dest) \
+ { register ddNamePtr s = (source), d = (dest); \
+ register ddNamePtr end = &(d)[MINS_NAMESET_WORD_COUNT]; \
+ do { *d |= *s; d++; s++; } while (d < end); }
+
+#define MINS_IS_NAME_IN_SET(one_name, nameset) \
+ ((nameset)[MINS_NAMESET_WORD_NUM(one_name)] & \
+ MINS_NAMESET_BIT(one_name))
+
+#define MINS_ADD_TO_NAMESET(one_name, nameset) \
+ (nameset)[MINS_NAMESET_WORD_NUM(one_name)] |= \
+ MINS_NAMESET_BIT(one_name)
+
+#define MINS_REMOVE_FROM_NAMESET(one_name, nameset) \
+ (nameset)[MINS_NAMESET_WORD_NUM(one_name)] &= \
+ ~MINS_NAMESET_BIT(one_name)
+
+#define MINS_NOT_NAMESET(nameset) \
+ { register ddNamePtr n = nameset; \
+ register ddNamePtr end = &nameset[MINS_NAMESET_WORD_COUNT];\
+ do { *n = ~(*n); n++; } \
+ while (n < end); }
+
+#define MINS_IS_NAMESET_EMPTY(nameset, isempty) \
+ { register ddNamePtr n = nameset; \
+ register ddNamePtr end = &nameset[MINS_NAMESET_WORD_COUNT];\
+ (isempty) = ~0; \
+ do { (isempty) = (isempty) && !(*n); n++; } \
+ while (n < end); }
+
+#define MINS_MATCH_NAMESETS(names1, names2, match) \
+ { register ddNamePtr n1 = names1, n2=names2; \
+ register ddNamePtr end = &names1[MINS_NAMESET_WORD_COUNT]; \
+ (match) = 0; \
+ do { (match) = (match) || ((*n1) & (*n2)); n1++; n2++; } \
+ while (n1 < end); }
+
+typedef struct _miNSHeader {
+ /* the resource id is in the dipex resource structure */
+ listofObj *wksRefList;
+ listofObj *rendRefList;
+ ddULONG refCount; /* pick & search context*/
+ ddULONG nameCount;
+ ddNamePiece names[ MINS_NAMESET_WORD_COUNT ];
+ ddBOOL freeFlag;
+} miNSHeader;
+
+#endif /* MINS_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miNurbs.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miNurbs.h
new file mode 100644
index 000000000..924141c1c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miNurbs.h
@@ -0,0 +1,271 @@
+/* $TOG: miNurbs.h /main/4 1998/02/10 12:38:57 kaleb $ */
+
+/*****************************************************************
+
+Copyright 1989,1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989,1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef MI_NURB_H
+#define MI_NURB_H 1
+
+#ifdef NDEBUG
+extern unsigned nurb_debug_flags;
+#define NURB_DEBUG_FLAG(_b) (nurb_debug_flags & (_b))
+#endif /* NDEBUG */
+
+/* Nurb Debug Flags:
+ * 0x01 (1) Surface edge paths
+ * 0x02 (2) Surface iso curve paths
+ * 0x04 (4) Trimming data, tessellated and ordered
+ * 0x08 (8) Surface facet paths for untrimmed surfaces
+ * 0x10 (16) Trimmed surface polygons
+ * 0x20 (32) Surface facet paths
+ * 0x40 (64) Surface polygons before trimming
+ * 0x80 (128) Surface hollow-edge paths
+ * 0x100 (256) Surface grids
+ * 0x200 (512) Initial data
+ */
+
+#define MAXORD 10
+#define MAXTCORD 6
+
+#define XX 0
+#define YY 1
+#define ZZ 2
+#define WW 3
+
+#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
+
+extern double mi_nu_ptofd[MAXORD][MAXORD];
+
+#define NURB_TRIM_DATA_INIT( _t ) \
+ { \
+ (_t).nloops = 0; \
+ (_t).loops = (Nurb_trim_loop_rep *)NULL; \
+ (_t).cur_vertex = 1; \
+ (_t).vertices = (Nurb_param_point *)NULL; \
+ (_t).ep_index = 0; \
+ (_t).ep_list_size = 0; \
+ (_t).ep_list = (Nurb_edge_point *)NULL; \
+ }
+
+#define NURB_SURF_STATE_INIT( _s ) \
+ { \
+ (_s)->reps.facets = 0; \
+ (_s)->reps.edges = 0; \
+ (_s)->reps.isocrvs = 0; \
+ (_s)->reps.markers = 0; \
+ (_s)->reps.hollow = 0; \
+ (_s)->reps.grids = 0; \
+ (_s)->reps.normals = 0; \
+ (_s)->reps.trim_data = 0; \
+ (_s)->grids.number = 0; \
+ (_s)->grids.flags.normals = 0; \
+ (_s)->grids.grids = (Nurb_grid *)NULL; \
+ (_s)->ruknots = (ddFLOAT *)NULL; \
+ (_s)->rvknots = (ddFLOAT *)NULL; \
+ (_s)->facets = (miListHeader *)NULL; \
+ (_s)->sofas = (miSOFASStruct *)NULL; \
+ (_s)->edges = (miListHeader *)NULL; \
+ (_s)->isocrvs = (miListHeader *)NULL; \
+ (_s)->markers = (miListHeader *)NULL; \
+ (_s)->hollow = (miListHeader *)NULL; \
+ NURB_TRIM_DATA_INIT((_s)->trim_data); \
+ }
+
+#define NURB_INIT_RANGE_LIST( _r ) \
+ (_r)->size = 0; \
+ (_r)->number = 0; \
+ (_r)->limits = (Nurb_limit *)NULL;
+
+#define EXTENTS_OVERLAP( _ea, _eb ) \
+ (!((_eb).umin > (_ea).umax || (_eb).umax < (_ea).umin || \
+ (_eb).vmin > (_ea).vmax || (_eb).vmax < (_ea).vmin))
+
+#define GET_TRIM_CURVE_TOLERANCE( _crv, _tolerance ) \
+ switch ( (_crv)->curveApprox.approxMethod ) { \
+ case PEXApproxImpDep: \
+ case PEXApproxConstantBetweenKnots: \
+ (_tolerance) = (_crv)->curveApprox.tolerance; \
+ break; \
+ default: \
+ (_tolerance) = 1.0; \
+ }
+
+#define ADD_POINT_TO_LIST( _l, _r, _op, _pt ) \
+if ((_l)) { \
+ listofddPoint *pddlist; \
+ if ( (_op) == PT_MOVE ) { \
+ (_l)->numLists++; \
+ MI_ALLOCLISTHEADER( (_l), \
+ MI_ROUND_LISTHEADERCOUNT( (_l)->numLists ) ); \
+ } \
+ pddlist = &((_l)->ddList[(_l)->numLists-1]); \
+ pddlist->numPoints++; \
+ if ( (_r) ) { \
+ MI_ALLOCLISTOFDDPOINT( pddlist, \
+ MI_ROUND_LISTHEADERCOUNT(pddlist->numPoints),\
+ sizeof(ddCoord4D) ); \
+ pddlist->pts.p4Dpt[pddlist->numPoints - 1] = *((ddCoord4D *)(_pt)); \
+ } else { \
+ MI_ALLOCLISTOFDDPOINT( pddlist, \
+ MI_ROUND_LISTHEADERCOUNT(pddlist->numPoints),\
+ sizeof(ddCoord3D) ); \
+ pddlist->pts.p3Dpt[pddlist->numPoints - 1] = *((ddCoord3D *)(_pt)); \
+ } \
+}
+
+typedef enum {
+ PT_NOP,
+ PT_MOVE,
+ PT_LINE,
+ PT_MARKER
+} Nurb_path_op;
+
+typedef enum {
+ NURB_SAME_CONTOUR = 0,
+ NURB_NEW_CONTOUR = 1,
+ NURB_NEW_FACET = 2
+} Nurb_facet_op;
+
+typedef struct {
+ unsigned facets: 1;
+ unsigned isocrvs: 1;
+ unsigned edges: 1;
+ unsigned markers: 1; /* first order in u and v, use markers */
+ unsigned hollow: 1;
+ unsigned grids: 1;
+ unsigned normals: 1;
+ unsigned trim_data: 1;
+} Nurb_rep_flags;
+
+typedef struct {
+ double lmin;
+ double lmax;
+} Nurb_limit;
+
+typedef struct {
+ int size;
+ int number;
+ Nurb_limit *limits;
+} Nurb_limitlst;
+
+typedef struct {
+ double u;
+ double v;
+} Nurb_param_point;
+
+typedef struct {
+ double umin, umax;
+ double vmin, vmax;
+} Nurb_param_limit;
+
+typedef struct Nurb_trim_segment {
+ int first, last; /* indices in vertex list */
+ int start, end; /* effective limit of seg */
+ int current;
+ unsigned dir;
+ ddULONG vis;
+ Nurb_param_limit extent; /* of segment */
+ struct Nurb_trim_segment *next;
+} Nurb_trim_segment;
+
+typedef struct {
+ Nurb_param_limit extent; /* of loop */
+ Nurb_trim_segment *segs; /* linked list of segments, NULL terminated */
+} Nurb_trim_loop_rep;
+
+typedef struct {
+ int flags;
+ int count; /* of rectangles this point is part of */
+ double u, v;
+ ddCoord4D pt;
+ ddVector3D normal;
+ int next, prev, branch;
+} Nurb_edge_point;
+
+typedef struct {
+ Nurb_param_point *vertices; /* of tessellated curves */
+ int cur_vertex; /* index of current vertex */
+ int nloops;
+ Nurb_trim_loop_rep *loops; /* array of representations */
+ Nurb_edge_point *ep_list; /* polygon edge points */
+ int ep_index; /* index of current one */
+ int ep_list_size; /* # allocated entries */
+} Nurb_trim_data;
+
+typedef struct {
+ Nurb_edge_point *pts;
+ int nu, nv;
+ Nurb_param_limit extent;
+} Nurb_grid;
+
+typedef struct {
+ int number;
+ struct {
+ unsigned normals;
+ } flags;
+ Nurb_grid *grids;
+} Nurb_gridlst;
+
+typedef struct {
+ int gitype;
+ int isocount[2];
+ int approx_type;
+ ddFLOAT approx_value[2];
+ Nurb_param_limit range;
+ Nurb_param_limit param_limits;
+ Nurb_rep_flags reps;
+ ddFLOAT *ruknots;
+ ddFLOAT *rvknots;
+ Nurb_gridlst grids;
+ Nurb_trim_data trim_data;
+ Nurb_param_point corners[5];
+ Nurb_trim_segment edge_segs[4];
+ miListHeader *facets;
+ miSOFASStruct *sofas;
+ miListHeader *edges;
+ miListHeader *isocrvs;
+ miListHeader *markers;
+ miListHeader *hollow;
+} Nurb_surf_state;
+
+#endif /* MI_NURB_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miPick.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miPick.h
new file mode 100644
index 000000000..90e669e0e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miPick.h
@@ -0,0 +1,133 @@
+/* $TOG: miPick.h /main/3 1998/02/10 12:39:02 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "mipex.h"
+#include "ddpex4.h"
+
+#ifndef MIPICK_H
+#define MIPICK_H
+
+ /* there is one data rec and one input record for each pick device */
+ /* supported pick devices are defined in miInfo.h */
+#define MIWKS_NUM_PICK_DEVICES SI_PICK_DEVICE_NUM
+
+typedef struct {
+ ddEnumTypeIndex type; /* dc_hitbox or npc_hitvolume */
+ ddUSHORT status; /* PEXOk or PEXNoPick */
+ listofObj *path; /* start path */
+ ddUSHORT pathOrder;
+ diNSHandle inclusion;
+ diNSHandle exclusion;
+ union {
+ char dc_data_rec; /* none */
+ char npc_data_rec; /* none */
+ } data_rec; /* place holder */
+ ddEnumTypeIndex pet;
+ ddViewport echoVolume;
+ ddUSHORT echoSwitch;
+ ddPointer devPriv;
+} miPickDevice;
+
+typedef struct {
+ /* the resource id is in the dipex resource structure */
+ diWKSHandle pWks;
+ ddEnumTypeIndex type; /* dc_hitbox or npc_hitvolume */
+ ddUSHORT status; /* PEXOk or PEXNoPick */
+ listofObj *path; /* list of pick element refs */
+ ddUSHORT pathOrder;
+ diNSHandle incl_handle;
+ diNSHandle excl_handle;
+ union {
+ char dc_data_rec;
+ char npc_data_rec;
+ } data_rec;
+ union {
+ ddPC_DC_HitBox dc_hit_box;
+ ddPC_NPC_HitVolume npc_hit_volume;
+ } input_rec;
+ ddPointer devPriv;
+} miPickMeasureStr;
+
+
+/* macros for pick devices and pick measures */
+
+/* set this to return the index into array of pick devices based
+ * on the device type specified
+ * device types:
+ * PEXPickDeviceDC_HitBox 1
+ * PEXPickDeviceNPC_HitVolume 2
+ */
+#define MIWKS_PICK_DEV_INDEX(devindex, devtype) \
+ (devindex) = (devtype) - 1
+
+/* for both pick device and pick measure */
+#define MIWKS_SIZE_DATA_REC_1 \
+ sizeof(char)
+
+#define MIWKS_SIZE_DATA_REC_2 \
+ sizeof(char)
+
+/* for pick measure */
+#define MIWKS_PM_DATA_REC_1(pPick) \
+ (pPick)->data_rec.dc_data_rec
+
+#define MIWKS_PM_DATA_REC_2(pPick) \
+ (pPick)->data_rec.npc_data_rec
+
+#define MIWKS_PM_INPUT_STR_1 ddPC_DC_HitBox
+#define MIWKS_PM_INPUT_REC_1(pPick) \
+ (pPick)->input_rec.dc_hit_box
+
+#define MIWKS_PM_INPUT_STR_2 ddPC_NPC_HitVolume
+#define MIWKS_PM_INPUT_REC_2(pPick) \
+ (pPick)->input_rec.npc_hit_volume
+
+/* for pick device */
+#define MIWKS_PD_DATA_REC_1(pPick) \
+ (pPick)->data_rec.dc_data_rec
+
+#define MIWKS_PD_DATA_REC_2(pPick) \
+ (pPick)->data_rec.npc_data_rec
+
+#endif /* MIPICK_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miRender.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miRender.h
new file mode 100644
index 000000000..d611fc343
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miRender.h
@@ -0,0 +1,335 @@
+
+/* $TOG: miRender.h /main/5 1998/02/10 12:39:06 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+******************************************************************/
+
+#ifndef MI_RENDER_H
+#define MI_RENDER_H
+
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "ddpex4.h"
+#include "gc.h"
+#include "miNS.h"
+#include "PEXprotost.h"
+#include "miLUT.h"
+
+/*
+ * Create a data list header. THis list header is simply
+ * used as a pointer to the start of the scratch data areas
+ * maintained for transformation and clipping.
+ */
+typedef struct _miListHeader {
+ ddPointType type; /* type of vertices in lists */
+ ddUSHORT flags; /* various random path flags */
+ ddULONG numLists; /* number of list headers */
+ ddULONG maxLists; /* allocated number of list headers */
+ listofddPoint *ddList; /* data area pointer */
+} miListHeader;
+
+/*
+ * The DD context is divided into two parts: values that remain
+ * static across structure and values that can vary within structures.
+ * Only the dynamic values (those in miDynamicDDContext) must be stored
+ * across structure references - such as in BeginStructure
+ */
+typedef struct _miDynamicDDContext {
+ ddPCAttr *pPCAttr; /* Pipeline context for renderer */
+ ddNamePiece currentNames[MINS_NAMESET_WORD_COUNT];
+ struct _miDynamicDDContext *next; /* Next pointer for stacking */
+ ddFLOAT mc_to_wc_xform[4][4];
+ ddFLOAT wc_to_npc_xform[4][4];
+ ddFLOAT mc_to_npc_xform[4][4];
+ ddFLOAT wc_to_cc_xform[4][4];
+ ddFLOAT cc_to_dc_xform[4][4];
+ ddFLOAT mc_to_cc_xform[4][4];
+ ddFLOAT mc_to_dc_xform[4][4];
+ ddFLOAT npc_to_cc_xform[4][4];
+ ddUSHORT clipFlags;
+ ddUSHORT filter_flags;
+ ddUSHORT do_prims;
+} miDynamicDDContext;
+
+/* definitions for filter_flags */
+#define MI_DDC_HIGHLIGHT_FLAG 1<<0
+#define MI_DDC_INVISIBLE_FLAG 1<<1
+#define MI_DDC_DETECTABLE_FLAG 1<<2
+
+#define MI_DDC_DO_PRIMS(pRend) \
+ ((miDDContext *)(pRend)->pDDContext)->Dynamic->do_prims
+
+#define MI_DDC_SET_DO_PRIMS(pRend, pddc) \
+ (pddc)->Dynamic->do_prims = \
+ !((pddc)->Dynamic->filter_flags & MI_DDC_INVISIBLE_FLAG) \
+ && ( !(pRend)->render_mode || \
+ ((pRend)->render_mode && \
+ ((pddc)->Dynamic->filter_flags & MI_DDC_DETECTABLE_FLAG)) )
+
+#define MI_DDC_IS_HIGHLIGHT(pddc) \
+ ((pddc)->Dynamic->filter_flags & MI_DDC_HIGHLIGHT_FLAG)
+
+#define MI_DDC_SET_HIGHLIGHT(pddc) \
+ (pddc)->Dynamic->filter_flags |= MI_DDC_HIGHLIGHT_FLAG
+
+#define MI_DDC_CLEAR_HIGHLIGHT(pddc) \
+ (pddc)->Dynamic->filter_flags &= ~MI_DDC_HIGHLIGHT_FLAG
+
+#define MI_DDC_IS_INVISIBLE(pddc) \
+ ((pddc)->Dynamic->filter_flags & MI_DDC_INVISIBLE_FLAG)
+
+#define MI_DDC_SET_INVISIBLE(pddc) \
+ (pddc)->Dynamic->filter_flags |= MI_DDC_INVISIBLE_FLAG
+
+#define MI_DDC_CLEAR_INVISIBLE(pddc) \
+ (pddc)->Dynamic->filter_flags &= ~MI_DDC_INVISIBLE_FLAG
+
+#define MI_DDC_IS_DETECTABLE(pddc) \
+ ((pddc)->Dynamic->filter_flags & MI_DDC_DETECTABLE_FLAG)
+
+#define MI_DDC_SET_DETECTABLE(pddc) \
+ (pddc)->Dynamic->filter_flags |= MI_DDC_DETECTABLE_FLAG
+
+#define MI_DDC_CLEAR_DETECTABLE(pddc) \
+ (pddc)->Dynamic->filter_flags &= ~MI_DDC_DETECTABLE_FLAG
+
+/*
+ * The static portion of the DD context is itself divided into several parts:
+ * immediate rendering attributes from the pipeline context, a jump
+ * table for the level 1 rendering routines, and other assorted intermediate
+ * values that are used during rendering.
+ * Note that immediate rendering attributes means that bundled attributes
+ * have been extracted from the appropriate LUTs. Code that uses the
+ * DDC rendering attributes, therefore, do not need to check the ASF's.
+ */
+
+/*
+ *Level 1 rendering Procedure Vector used in DDC
+ * The index of a procedure is arbitrarily specified
+ * the following defines.
+ */
+#define POLYLINE_RENDER_TABLE_INDEX 0
+#define FILLAREA_RENDER_TABLE_INDEX 1
+#define TEXT_RENDER_TABLE_INDEX 2
+#define MARKER_RENDER_TABLE_INDEX 3
+#define TRISTRIP_RENDER_TABLE_INDEX 4
+#define RENDER_TABLE_LENGTH 5
+
+typedef ddpex2rtn (*RendTableType)();
+
+/*
+ * This structure is a copy of the attributes in the PipeLine context
+ * with the exception that all references to bundles and bundled
+ * attributes have been removed. Furthermore, this list contains
+ * references to no attributes that are no bundled: they are
+ * just as easily accessed from the dynamic copy of the PC.
+ */
+typedef struct _miDDContextRendAttrs {
+ ddEnumTypeIndex markerType;
+ ddFLOAT markerScale;
+ ddColourSpecifier markerColour;
+ ddUSHORT textFont;
+ ddUSHORT textPrecision;
+ ddFLOAT charExpansion;
+ ddFLOAT charSpacing;
+ ddColourSpecifier textColour;
+ ddFLOAT charHeight;
+ ddVector2D charUp;
+ ddUSHORT textPath;
+ ddTextAlignmentData textAlignment;
+ ddFLOAT atextHeight;
+ ddVector2D atextUp;
+ ddUSHORT atextPath;
+ ddTextAlignmentData atextAlignment;
+ ddEnumTypeIndex atextStyle;
+ ddEnumTypeIndex lineType;
+ ddFLOAT lineWidth;
+ ddColourSpecifier lineColour;
+ ddCurveApprox curveApprox;
+ ddEnumTypeIndex lineInterp;
+ ddEnumTypeIndex intStyle;
+ ddColourSpecifier surfaceColour;
+ ddReflectionAttr reflAttr;
+ ddEnumTypeIndex reflModel;
+ ddEnumTypeIndex surfInterp;
+ ddEnumTypeIndex bfIntStyle;
+ ddColourSpecifier bfSurfColour;
+ ddReflectionAttr bfReflAttr;
+ ddEnumTypeIndex bfReflModel;
+ ddEnumTypeIndex bfSurfInterp;
+ ddSurfaceApprox surfApprox;
+ ddCoord2D patternSize;
+ ddCoord3D patternRefPt;
+ ddVector3D patternRefV1;
+ ddVector3D patternRefV2;
+ ddUSHORT edges;
+ ddEnumTypeIndex edgeType;
+ ddFLOAT edgeWidth;
+ ddColourSpecifier edgeColour;
+ ddUSHORT modelClip;
+ ddULONG pickId;
+ ddULONG hlhsrType;
+ ddColourSpecifier backgroundColour;
+ ddUSHORT clearI;
+ ddUSHORT clearZ;
+ ddUSHORT echoMode;
+ ddColourSpecifier echoColour;
+} miDDContextRendAttrs;
+
+#define MI_MAXTEMPDATALISTS 4 /* Note, must be 2^n for macros to work */
+#define MI_MAXTEMPFACETLISTS 4 /* Note, must be 2^n for macros to work */
+
+/*
+ * the following defines are bit mask flags for the flags field
+ * in the miDDContextMisc struct.
+ *
+ * Note that all these flag are true when the corresponding entry
+ * is INVALID. ie the flag is set if the entry must be updated!
+ */
+
+#define POLYLINEGCFLAG (1<<0) /* change flag for polyline GC */
+#define FILLAREAGCFLAG (1<<1) /* change flag for fill area GC */
+#define EDGEGCFLAG (1<<2) /* change flag for F.A. edge GC */
+#define MARKERGCFLAG (1<<3) /* change flag for marker GC */
+#define TEXTGCFLAG (1<<4) /* change flag for text GC */
+#define NOLINEDASHFLAG (1<<5) /* No Line Dash storage allocated in line GC */
+#define CC_DCUEVERSION (1<<6) /* invalid cc version of depth cue entry */
+#define MCVOLUMEFLAG (1<<7) /* invalid model clip planes entry */
+
+#define INVTRMCTOWCXFRMFLAG (1<<8) /* invalid flag - inverse mc2wc xform */
+#define INVTRWCTOCCXFRMFLAG (1<<9) /* invalid flag - inverse wc2cc xform */
+#define INVTRMCTOCCXFRMFLAG (1<<10) /* invalid flag - inverse mc2cc xform */
+#define INVTRCCTODCXFRMFLAG (1<<11) /* invalid flag - inverse cc2dc xform */
+#define INVVIEWXFRMFLAG (1<<12) /* invalid flag - inverse view xform */
+
+typedef struct _miDDContextMisc {
+ ddULONG listIndex; /* index into following array */
+ miListHeader list4D[MI_MAXTEMPDATALISTS]; /* temp data areas */
+ miListHeader list2D; /* temp area for 2D data */
+ ddULONG facetIndex; /* index into following array */
+ listofddFacet facets[MI_MAXTEMPFACETLISTS]; /* temp facet areas */
+ ddFLOAT viewport_xform[4][4]; /* from npc to viewport */
+ ddULONG flags; /* valid flags for following fields */
+ GCPtr pPolylineGC; /* ddx GC for rendering polylines */
+ GCPtr pFillAreaGC; /* ddx GC for rendering fill areas */
+ GCPtr pEdgeGC; /* ddx GC for rendering F. A. edges */
+ GCPtr pPolyMarkerGC; /* ddx GC for rendering poly markers*/
+ GCPtr pTextGC; /* ddx GC for rendering Text */
+ ddFLOAT inv_tr_mc_to_wc_xform[4][4]; /* inverse transpose */
+ ddFLOAT inv_tr_wc_to_cc_xform[4][4]; /* for normal xforms */
+ ddFLOAT inv_tr_mc_to_cc_xform[4][4];
+ ddFLOAT inv_tr_cc_to_dc_xform[4][4];
+ ddFLOAT inv_vpt_xform[4][4]; /* from viewport to NPC */
+ ddFLOAT inv_view_xform[4][4]; /* from npc to WC */
+ listofObj *ms_MCV; /* modelling space version of the */
+ /* model clipping volume. */
+ ddCoord4D eye_pt; /* eye point in WC */
+ ddColourSpecifier highlight_colour;
+ ddDepthCueEntry cc_dcue_entry; /* cc version of current
+ * depth cue bundle entry */
+} miDDContextMisc;
+
+typedef struct {
+ ddEnumTypeIndex type; /* DC_HitBox or NPC_HitVolume */
+ ddUSHORT status; /* PEXOk or PEXNoPick */
+ ddNamePiece inclusion[MINS_NAMESET_WORD_COUNT];
+ ddNamePiece exclusion[MINS_NAMESET_WORD_COUNT];
+ union {
+ char dc_data_rec; /* none */
+ char npc_data_rec; /* none */
+ } data_rec; /* place holder */
+ union {
+ ddPC_DC_HitBox dc_hit_box;
+ ddPC_NPC_HitVolume npc_hit_volume;
+ } input_rec;
+ ddPointer devPriv;
+} ddPickDeviceStr;
+
+typedef struct _ddSearchDevPriv {
+ ddUSHORT status; /* PEXFound or PEXNotFound */
+ ddCoord3D position;
+ ddFLOAT distance;
+ ddBOOL modelClipFlag;
+ ddNamePiece norm_inclusion[MINS_NAMESET_WORD_COUNT];
+ ddNamePiece norm_exclusion[MINS_NAMESET_WORD_COUNT];
+ ddNamePiece invert_inclusion[MINS_NAMESET_WORD_COUNT];
+ ddNamePiece invert_exclusion[MINS_NAMESET_WORD_COUNT];
+ ddPointer devPriv;
+} ddSearchDeviceStr;
+
+typedef struct _miStaticDDContext {
+ miDDContextRendAttrs *attrs; /* Immediate rendering attributes */
+ miDDContextMisc misc; /* misc. rendering temp vals */
+ RendTableType RenderProcs[RENDER_TABLE_LENGTH]; /* lvl1 jmp table */
+ ddPickDeviceStr pick;
+ ddSearchDeviceStr search;
+} miStaticDDContext;
+
+/*
+ * Finally! the ddContext itself....
+ */
+typedef struct _miDDContext {
+ miStaticDDContext Static;
+ miDynamicDDContext *Dynamic;
+} miDDContext;
+
+/*
+ * the following macro return a pointer to the next free
+ * work data area from the list4D array in the static portion
+ * of the ddContext.
+ */
+#define MI_NEXTTEMPDATALIST(pddc) \
+&((pddc)->Static.misc.list4D[(++(pddc)->Static.misc.listIndex)&(MI_MAXTEMPDATALISTS-1)])
+
+/*
+ * the following macro return a pointer to the next free
+ * work facet area from the facets array in the static portion
+ * of the ddContext.
+ */
+#define MI_NEXTTEMPFACETLIST(pddc) \
+&((pddc)->Static.misc.facets[(++(pddc)->Static.misc.facetIndex)&(MI_MAXTEMPFACETLISTS-1)])
+
+#define NULL4x4 (float (*)[4])0
+extern ddFLOAT ident4x4[4][4];
+
+#endif /* MI_RENDER_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miStrMacro.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miStrMacro.h
new file mode 100644
index 000000000..0ce8cbf88
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miStrMacro.h
@@ -0,0 +1,198 @@
+/* $TOG: miStrMacro.h /main/6 1998/02/10 12:39:11 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* some macros to use */
+
+#include "miStruct.h"
+#include "mipex.h"
+
+#ifndef MISTRMACRO_H
+#define MISTRMACRO_H
+
+/* structure information */
+#define MISTR_NUM_EL(PS) (PS)->numElements
+
+#define MISTR_EDIT_MODE(PS) (PS)->editMode
+
+#define MISTR_LENGTH(PS) (PS)->totalSize
+
+#define MISTR_NUM_CHILDREN(PS) (PS)->children->numObj
+
+#define MISTR_NUM_PARENTS(PS) (PS)->parents->numObj
+
+#define MISTR_CURR_EL_OFFSET(PS) (PS)->currElementOffset
+
+#define MISTR_CURR_EL_PTR(PS) (PS)->pCurrElement
+
+#define MISTR_ZERO_EL(PS) (PS)->pZeroElement
+
+#define MISTR_LAST_EL(PS) (PS)->pLastElement
+
+#define MISTR_NEXT_EL(PE) (PE)->next
+
+#define MISTR_PREV_EL(PE) (PE)->prev
+
+#define MISTR_EL_DATA(PE) ((PE)->element)
+
+#define MISTR_EL_TYPE(PE) (PE)->element.elementType
+
+#define MISTR_EL_LENGTH(PE) (PE)->element.pexOClength
+
+/* todo: make this more efficient by searching backwards if it's closer */
+/*
+ if (offset < current && offset < curr - off)
+ then start at 0 and go forward
+ else if (offset < current && offset > curr - off)
+ then start at curr and go backward
+ else if (offset > current && offset - curr < off - last)
+ then start at curr and go forward
+ else if (offset > current && offset - curr > off - last)
+ then start at last and go backward
+*/
+
+#define MISTR_FIND_EL(PSTRUCT, OFFSET, PE) \
+ if ((OFFSET) <= 0) \
+ (PE) = MISTR_ZERO_EL(PSTRUCT); \
+ else if ((OFFSET) >= MISTR_NUM_EL(PSTRUCT)) \
+ (PE) = MISTR_PREV_EL(MISTR_LAST_EL(PSTRUCT)); \
+ else if ((OFFSET) == MISTR_CURR_EL_OFFSET(PSTRUCT)) \
+ (PE) = MISTR_CURR_EL_PTR(PSTRUCT); \
+ else { \
+ register int _i, _start; \
+ if ((OFFSET) < MISTR_CURR_EL_OFFSET(PSTRUCT)) { \
+ (PE) = MISTR_ZERO_EL(PSTRUCT); \
+ _start = 0; \
+ } else { \
+ _start = MISTR_CURR_EL_OFFSET(PSTRUCT); \
+ (PE) = MISTR_CURR_EL_PTR(PSTRUCT); \
+ } \
+ for (_i=_start; _i<(OFFSET); _i++, (PE) = MISTR_NEXT_EL(PE)); \
+ }
+
+/* given pointer to element, find out what its OFFSET is in the struct */
+/* the element better be in the struct! */
+/* for now, don't know whether the element is near the beginning or end of
+ * the structure. todo: add hint to improve efficiency such as
+ * whether to start from the beginning or end or maybe some element
+ * and its known OFFSET from whic to start at (and go forwards)
+ */
+#define MISTR_FIND_OFFSET(PSTRUCT, PEL, OFFSET) \
+ if (PEL == MISTR_PREV_EL(MISTR_LAST_EL(PSTRUCT))) \
+ (OFFSET) = MISTR_NUM_EL(PSTRUCT); \
+ else { \
+ register int i; \
+ register miGenericElementPtr ptemp; \
+ for (i = 0, ptemp = MISTR_ZERO_EL(PSTRUCT); \
+ ((i < MISTR_NUM_EL(PSTRUCT)) && (ptemp != (PEL))); \
+ i++, ptemp = MISTR_NEXT_EL(ptemp)); \
+ (OFFSET) = i; \
+ }
+
+/* Must check Proprietary and in Range to avoid Null function ptrs */
+#define MISTR_DEL_ONE_EL(PSTRUCT, PPREV, PEL) { \
+ MISTR_NEXT_EL(PPREV) = MISTR_NEXT_EL(PEL); \
+ MISTR_PREV_EL(MISTR_NEXT_EL(PEL)) = (PPREV); \
+ if (MI_HIGHBIT_ON(MISTR_EL_TYPE(PEL))) \
+ (*DestroyCSSElementTable[MI_OC_PROP])((PSTRUCT), (PEL)); \
+ else \
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE(PEL))) \
+ (*DestroyCSSElementTable[MISTR_EL_TYPE(PEL)])((PSTRUCT), (PEL));\
+ }
+
+#define MISTR_INSERT_ONE_EL(PPREV, PEL) \
+ MISTR_NEXT_EL(PEL) = MISTR_NEXT_EL(PPREV); \
+ MISTR_PREV_EL(MISTR_NEXT_EL(PEL)) = PEL; \
+ MISTR_NEXT_EL(PPREV) = (PEL); \
+ MISTR_PREV_EL(PEL) = (PPREV)
+
+/* PSTRUCT is structure handle; DDSTRUCT is dd structure header */
+/* first can't be 0, last can't be more than number in structure */
+/* inclusive delete, does not update structure header info */
+/* Must check Proprietary and in Range to avoid Null function ptrs */
+#define MISTR_DEL_ELS(PSTRUCT, DDSTRUCT, FIRST, LAST) \
+ if ((int)((LAST) - (FIRST)) >= 0) { \
+ register int num; \
+ register miGenericElementPtr pe, pe1, pe2; \
+ MISTR_FIND_EL((DDSTRUCT), (FIRST), pe1); \
+ pe = MISTR_PREV_EL(pe1); \
+ for (num = (FIRST); num <= (LAST); num++) { \
+ pe2 = MISTR_NEXT_EL(pe1); \
+ if (MI_HIGHBIT_ON(MISTR_EL_TYPE(pe1))) \
+ (*DestroyCSSElementTable[MI_OC_PROP]) \
+ ((PSTRUCT), pe1); \
+ else \
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE(pe1))) \
+ (*DestroyCSSElementTable[MISTR_EL_TYPE(pe1)]) \
+ ((PSTRUCT), pe1); \
+ pe1 = pe2; \
+ } \
+ MISTR_NEXT_EL(pe) = pe1; \
+ MISTR_PREV_EL(pe1) = pe; \
+ }
+
+/* macros for accessing specific data in some elements
+ * these MUST be changed to reflect the storage format of the elements
+ */
+
+/* this macro returns the structure id in an execute structure element.
+ * for the SI, this element has the structure handle in the id field
+ * can't use these on left side of statement because of casting */
+#define MISTR_GET_EXSTR_STR(PEL) \
+ ((pexExecuteStructure *)((PEL)+1))->id
+
+#define MISTR_GET_EXSTR_ID(PEL) \
+ ((ddStructResource *)((pexExecuteStructure *)((PEL)+1))->id)->id
+
+/* use this to change structure in ChangeStructureRefs */
+#define MISTR_PUT_EXSTR_STR(PEL, PSTRUCT) \
+ { pexExecuteStructure *pexstr; \
+ pexstr = (pexExecuteStructure *)((PEL)+1);\
+ pexstr->id = (pexStructure)(PSTRUCT); \
+ }
+
+#define MISTR_GET_LABEL(PEL) ((pexLabel *)((PEL)+1))->label
+
+#define MISTR_GET_PICK_ID(PEL) ((pexPickId *)((PEL)+1))->pickId
+
+#endif /* MISTRMACRO_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miStruct.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miStruct.h
new file mode 100644
index 000000000..edf4c13fc
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miStruct.h
@@ -0,0 +1,147 @@
+/* $TOG: miStruct.h /main/6 1998/02/10 12:39:15 kaleb $ */
+
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/include/miStruct.h,v 1.3 1998/10/04 09:34:07 dawes Exp $ */
+
+#ifndef MISTRUCT_H
+#define MISTRUCT_H
+
+#include "X.h"
+#include "PEXproto.h"
+#include "ddpex.h"
+
+typedef ddpex4rtn (*cssTableType)();
+
+typedef struct {
+ ddUSHORT elementType;
+ ddUSHORT pexOClength;
+ /* concatenate imp. dep. data definitions here */
+ /* sample server definitions are listed later in this file */
+
+ /* do the following to pad to 64 bit alignment for alpha */
+#if defined(__alpha) || defined(__alpha__)
+ ddUSHORT unused0;
+ ddUSHORT unused1;
+#endif
+} miGenericStr;
+
+typedef struct _miCSSElement {
+ struct _miCSSElement *prev, *next;
+ diStructHandle pStruct;
+ miGenericStr element; /* replace this with imp.
+ * dep. data structure */
+} miGenericElementStr, *miGenericElementPtr;
+
+typedef struct _miCSSElementHead {
+ struct _miCSSElementHead *next, *prev;
+} miElementHeadStr;
+
+#define EL_HEAD_SIZE sizeof(miElementHeadStr)
+
+typedef struct _miStructHeader {
+ /* the resource id is in the dipex resource structure */
+ ddUSHORT editMode;
+ ddULONG numElements;
+ ddULONG totalSize; /* of elements when in PEX format */
+ miGenericElementPtr pZeroElement; /* dummy */
+ miGenericElementPtr pLastElement; /* dummy */
+ miGenericElementPtr pCurrElement;
+ ddLONG currElementOffset;
+ listofObj *parents;
+ listofObj *children;
+ listofObj *wksPostedTo; /* directly posted to */
+ listofObj *wksAppearOn; /* indirectly, thru inherit.*/
+ ddULONG refCount; /* for search context & pick measure */
+ ddBOOL freeFlag; /* keep structure until no sc or
+ * pick measure uses it */
+} miStructStr, *miStructPtr;
+
+/* sample server element definitions */
+
+/* all fixed sized elements use the PEX protocol format and are not
+ * defined explicitely
+ */
+
+/*
+ * See ddpex2.h for data definitions for the others
+ */
+
+/* traverser state info. passed to level 4 traverser which is used by
+ * level 4 structure traversal and by level 3 mixed mode traversal.
+ * When following initial path before pick/search, don't want to
+ * follow all execute structure elements, only follow ones in search
+ * path. Also, when following initial path, don't want to call
+ * primitive OCS because actual pick/search isn't done until
+ * start path has been traversed. Use this enum value to determine
+ * when to follow exec.str element and when to bypass primitives
+ */
+typedef enum {
+ ES_YES = 0, /* do 'normal' traversal */
+ ES_POP = 1, /* pick or search is done, pop out of traverser */
+ ES_FOLLOW_PICK = 2, /* follow initial pick path before picking */
+ ES_FOLLOW_SEARCH = 3 /* follow initial search path before search */
+} miExecStrState;
+
+/* added to allow SI to do pick last */
+typedef struct _miPPLevel {
+ ddPickPath pp;
+ struct _miPPLevel *up;
+} miPPLevel;
+
+
+/*
+ * level 3 traversal doesn't do picking or search, so it ALWAYS sets
+ * exec_str_flag to YES and the element pointers to NULL
+ */
+typedef struct {
+ miExecStrState exec_str_flag;
+ ddULONG pickId;
+ ddULONG ROCoffset;
+ ddPickPath *p_curr_pick_el;
+ ddElementRef *p_curr_sc_el;
+ ddSHORT max_depth; /* max depth reached in pick or search */
+ miPPLevel *p_pick_path;
+} miTraverserState;
+
+#endif /* MISTRUCT_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miText.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miText.h
new file mode 100644
index 000000000..53c73875a
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miText.h
@@ -0,0 +1,65 @@
+/* $TOG: miText.h /main/3 1998/02/10 12:39:20 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989,1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989,1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef MI_TEXT_H
+#define MI_TEXT_H
+
+#include "miRender.h"
+
+#define HEIGHT 100.0
+
+typedef struct {
+ ddVector2D trans; /* Translation per character */
+ miListHeader *path; /* Strokes for char */
+ }miCharPath;
+
+typedef struct {
+ /* Following can be cached */
+ miCharPath *paths; /* Char data */
+ ddFLOAT xform[4][4]; /* CC_to_MC_Xform */
+ /* More cache data may follow, e.g. text attrs. */
+ }miTextElement;
+
+#endif /*MI_TEXT_H*/
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/miWks.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/miWks.h
new file mode 100644
index 000000000..b1b97f3c6
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/miWks.h
@@ -0,0 +1,190 @@
+/* $TOG: miWks.h /main/5 1998/02/10 12:39:24 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "mipex.h"
+#include "ddpex4.h"
+#include "miNS.h"
+#include "miLUT.h"
+#include "miInfo.h"
+#include "miPick.h"
+
+#ifndef MIWKS_H
+#define MIWKS_H
+
+typedef struct _ddOrdStruct {
+ diStructHandle pstruct;
+ ddFLOAT priority;
+ struct _ddOrdStruct *next;
+} ddOrdStruct;
+
+typedef struct {
+ ddULONG numStructs;
+ ddOrdStruct *postruct; /* the first element in the list is a dummy */
+} listofOrdStruct;
+
+/**********************************************************************
+ View numbers sparsely fill the range 0 - 65534
+ Since there is no way to predetermine which views will be defined,
+ all views must be in the original priority list. The original
+ list contains all views possible prioritized in numerical
+ order, 0 is highest priority and 65534 is lowest.
+ Each entry in the priority list contains a range of
+ views. All views in that range are prioritized numerically.
+ When a view is defined, it is put in an entry by itself with
+ first_view = last_view and defined = T. Only defined views can
+ have their priority changed, so putting them in their own entry
+ makes this easier. If a view is deleted, its entry in the priority
+ list has defined=F and stays in the list. If the view is set again,
+ defined is set to T again and it stays in the list whereever it is.
+
+ The higher and lower fields contain the index of the entry containing
+ the higher and lower priority views, resp. When view priorities
+ are set, these values are changed. The highest priority view has
+ higher = -1. The lowest priority view has lower = -1. Invalid
+ entries are kept in a free list.
+ NOTE: higher and lower contain index values into the view priority
+ tables. These values do not correspond to view numbers.
+
+ The max number of defined views is possible. With defined views
+ using one entry and all other views defined in ranges which at
+ most will use one entry between and around every defined view,
+ the max number of entries will be MAX_DEFINED_VIEWS *2 +1.
+ Then, add 2 dummies entries as the head and tail of the list.
+**********************************************************************/
+
+#define MIWKS_MAX_VIEWS 6 /* same as in miViewLUT.c */
+#define MIWKS_MAX_ORD_VIEWS ( MIWKS_MAX_VIEWS * 2 + 3)
+
+typedef struct _ddOrdView {
+ short defined;
+ ddUSHORT first_view; /* view number */
+ ddUSHORT last_view; /* view number */
+ struct _ddOrdView *higher; /* next higher view */
+ struct _ddOrdView *lower; /* next lower view */
+} ddOrdView;
+
+typedef struct {
+ ddULONG defined_views; /* number of defined views */
+ ddOrdView *highest; /* highest pri view */
+ ddOrdView *lowest; /* lowest pri view */
+ ddOrdView *free; /* first unused entry */
+ ddOrdView entries[MIWKS_MAX_ORD_VIEWS];
+} listofOrdView;
+
+#define MIWKS_NEW_OV_ENTRY( plist, index ) \
+ (index) = plist->free; \
+ if ((index) != NULL) { \
+ plist->free = index->lower; \
+ plist->free->higher = NULL; }
+
+typedef struct _miWks {
+ /* the resource id is in the dipex resource structure */
+ ddEnumTypeIndex displayUpdate;
+ ddBYTE visualState;
+ ddBYTE displaySurface;
+ ddBYTE viewUpdate;
+ /* list of defined views and their priorities */
+ /* highest priority is first on the list */
+ listofOrdView views;
+ diLUTHandle reqViewTable;
+ /* deltaviewMask tells which entries in view table are pending */
+ /* VIEW MASKS ONLY GOOD FOR VIEW TABLES WHOSE MAX SIZE IS 32 */
+ ddULONG deltaviewMask;
+ /* current view table is in renderer */
+ ddBYTE wksUpdate;
+ /* wksMask tells if wks window or viewport is pending */
+ ddBYTE wksMask;
+ ddNpcSubvolume reqNpcSubvolume;
+ /* current NPCsubvolume is in renderer */
+ ddViewport reqviewport;
+ /* current Viewport is in renderer */
+ ddBYTE hlhsrUpdate;
+ ddEnumTypeIndex reqhlhsrMode;
+ /* current HLHSR mode is in renderer */
+ ddRendererPtr pRend;
+ /* stuff in renderer: *
+ * render id (same as wks id ) *
+ * pointer to pc (NULL) *
+ * example drawable info *
+ * rendering drawable *
+ * current path *
+ * renderer state *
+ * marker bundle lut handle *
+ * text bundle lut handle *
+ * line bundle lut handle *
+ * interior bundle lut handle *
+ * edge bundle lut handle *
+ * (current) view table handle *
+ * color table lut handle *
+ * depth cue table lut handle *
+ * light table lut handle *
+ * approx tables lut handles *
+ * pattern table lut handle *
+ * font table lut handle *
+ * highlight incl name set *
+ * highlight excl name set *
+ * invis incl name set *
+ * invis excl name set *
+ * current hlhsr mode *
+ * current npc subvolume *
+ * current viewport */
+ ddBYTE bufferUpdate;
+ ddUSHORT curBufferMode;
+ ddUSHORT reqBufferMode;
+ listofOrdStruct postedStructs;
+ ddBYTE dynamics[MAX_DYNAMIC];
+ /* pick measures use workstation, so keep a free flage & reference count */
+ ddBOOL freeFlag;
+ ddLONG refCount;
+ miPickDevice devices[MIWKS_NUM_PICK_DEVICES];
+ /* pwksList is extra object used by deal with dynamics */
+ listofObj *pwksList;
+ DrawablePtr doubleDrawables[2];
+ int curDoubleBuffer;
+ int hasDoubleBuffer;
+ int usingDoubleBuffer;
+ DrawablePtr pCurDrawable;
+} miWksStr, *miWksPtr;
+
+#endif /* MIWKS_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/mipex.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/mipex.h
new file mode 100644
index 000000000..8af5996af
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/mipex.h
@@ -0,0 +1,390 @@
+/* $TOG: mipex.h /main/6 1998/02/10 12:39:29 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/include/mipex.h,v 3.1 1998/10/04 09:34:08 dawes Exp $ */
+
+#ifndef MI_H
+#define MI_H
+
+#include "ddpex.h"
+#include "X.h"
+#include "scrnintstr.h"
+
+#define MI_TRUE 1
+#define MI_FALSE 0
+
+#define MI_MAXUSHORT 65535 /* max value for unsigned short int: 2**16 */
+#define MI_PI 3.14159265358979323846 /* from values.h */
+
+#define MI_FIRSTTABLETYPE 1 /* a useful constant that's not in PEX.h */
+
+#define MI_BACKGROUND 0
+#define MI_FOREGROUND 1
+
+/* high bit mask for proprietary OCs */
+#define MI_OC_HIGHBIT 0x8000
+
+/* a redefinable location for use in branching on proprietary OCs */
+#define MI_OC_PROP 0
+
+/* see if propietary bit is set in OC Type */
+#define MI_HIGHBIT_ON(octype) ((octype) & MI_OC_HIGHBIT)
+
+/* see if OC Type (or element) is in range of PEX OCs */
+#define MI_IS_PEX_OC(octype) (((octype) > PEXOCAll) && ((octype) <= PEXMaxOC))
+
+/** redefine ASSURE even if it's already defined **/
+#ifdef ASSURE
+#undef ASSURE
+#endif
+
+
+typedef void (*destroyTableType)();
+
+
+#ifdef DDTEST
+#define ASSURE(test) \
+ if (!(test)) { \
+ ErrorF( "test \n"); \
+ ErrorF( "Failed: Line %d, File %s\n\n", __LINE__, __FILE__); \
+ }
+#else
+#define ASSURE(test)
+#endif /* DDTEST */
+
+/* the WHICDRAW macro looks at the given drawable and determines which
+ * of the suported drawable types it matches
+ * WHICHDRAW should compare the data in the given drawable with the
+ * drawable types defined here to define a impe dep drawable type id
+ * For now, only one drawable type is supported and it
+ * handles all drawables.
+ */
+#define MI_MAXDRAWABLES 1
+/* type depth rootDepth rootVisual */
+#define MI_DRAWABLE0 0/*ANY ANY ANY ANY */
+
+#define MI_SETDRAWEXAMPLE( pdraw, peg ) \
+ (peg)->type = (pdraw)->type; \
+ (peg)->class = (pdraw)->class; \
+ (peg)->depth = (pdraw)->depth; \
+ (peg)->bitsPerPixel = (pdraw)->bitsPerPixel; \
+ (peg)->rootDepth = (pdraw)->pScreen->rootDepth; \
+ (peg)->rootVisual = (pdraw)->pScreen->rootVisual
+
+#define MI_WHICHDRAW( pdraw, type ) \
+ type = MI_DRAWABLE0
+
+/* dd internal error codes */
+#define MI_SUCCESS 0
+#define MI_ALLOCERR 1
+#define MI_EXISTERR 2
+
+#define MI_DEFAULT_COLOUR_FORMAT PEXRgbFloatColour
+
+/* only do indexed & rgb floats now */
+#define MI_BADCOLOURTYPE( format ) \
+ ( (format!=PEXIndexedColour) && \
+ (format!=PEXRgbFloatColour) ) /* && \
+ (format!=PEXCieFloatColour) && \
+ (format!=PEXHsvFloatColour) && \
+ (format!=PEXHlsFloatColour) && \
+ (format!=PEXRgbInt8Colour) && \
+ (format!=PEXRgbInt16Colour) )
+ */
+
+/* JSH - assuming copy may overlap */
+#define mibcopy(pfrom, pto, size) \
+ memmove( (char *)(pto), (char *)(pfrom), (int)(size))
+
+extern int PexErrorBase;
+#define PEXERR( pexerrnum ) (pexerrnum) + PexErrorBase
+
+#ifndef ABS
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+#endif
+
+#define MI_ZERO_TOLERANCE 1.0e-30
+#define MI_NEAR_ZERO( s ) (ABS(s) < MI_ZERO_TOLERANCE)
+#define MI_ZERO_MAG( s ) ((s) < MI_ZERO_TOLERANCE)
+
+#define MI_MAT_IDENTITY( mat, dim ) \
+ { register int i,j; \
+ for (i=0; i<dim; i++) \
+ for (j=0; j<dim; j++) \
+ (mat)[i][j] = ( (i==j) ? 1.0 : 0.0 ); \
+ }
+
+
+typedef struct {
+ ddEnumTypeIndex index;
+ char *name;
+} miEnumType;
+
+typedef enum {
+ VIEW_REP_DYNAMIC=0,
+ MARKER_BUNDLE_DYNAMIC=1,
+ TEXT_BUNDLE_DYNAMIC=2,
+ LINE_BUNDLE_DYNAMIC=3,
+ INTERIOR_BUNDLE_DYNAMIC=4,
+ EDGE_BUNDLE_DYNAMIC=5,
+ COLOUR_TABLE_DYNAMIC=6,
+ PATTERN_TABLE_DYNAMIC=7,
+ WKS_TRANSFORM_DYNAMIC=8,
+ HIGH_FILTER_DYNAMIC=9,
+ INVIS_FILTER_DYNAMIC=10,
+ HLHSR_MODE_DYNAMIC=11,
+ STR_MODIFY_DYNAMIC=12,
+ POST_STR_DYNAMIC=13,
+ UNPOST_STR_DYNAMIC=14,
+ DELETE_STR_DYNAMIC=15,
+ REF_MODIFY_DYNAMIC=16,
+ BUFFER_MODIFY_DYNAMIC=17,
+ LIGHT_TABLE_DYNAMIC=18,
+ DEPTH_CUE_DYNAMIC=19,
+ COLOUR_APPROX_TABLE_DYNAMIC=20,
+ MAX_DYNAMIC = 21
+} ddDynamic;
+
+#ifdef DDTEST
+#define PRINTOC( ptr ) { \
+ ddUSHORT elType, length; \
+ \
+ elType = ((pexElementInfo *)ptr)->elementType; \
+ length = ((pexElementInfo *)ptr)->length; \
+ \
+ ErrorF("Element Type: %3d - %s Length: %d\n", \
+ elType, ocNames[elType], length ); \
+ }
+#else /* DDTEST */
+#define PRINTOC( ptr )
+#endif
+
+/* dd clip routine status returns */
+#define MI_CLIP_LEFT (1<<0)
+#define MI_CLIP_TOP (1<<2)
+#define MI_CLIP_RIGHT (1<<1)
+#define MI_CLIP_BOTTOM (1<<3)
+#define MI_CLIP_FRONT (1<<4)
+#define MI_CLIP_BACK (1<<5)
+
+#define MI_CLIP_TRIVIAL_ACCEPT 0
+#define MI_CLIP_POINT_1 1
+#define MI_CLIP_POINT_2 2
+#define MI_CLIP_TRIVIAL_REJECT 4
+
+/*
+ * Memory management macros for use with data lists in static ddcontext
+ */
+
+/*
+ * MI_ROUND_LISTHEADERCOUNT is used by the clip routines to round up the
+ * header block count by 16 - in other words to allocated headerblocks
+ * in increment of 16 and thus reduce calls to xrealloc.
+ * Note that this doesn't work for beans w/ negative numbers (although
+ * allocating a negative number of header blocks doesn't work well either!).
+ */
+#define MI_ROUND_LISTHEADERCOUNT(val) (((val) + 15) & ~15)
+
+/*
+ * MI_ALLOCLISTHEADER insures that there are numlists headers in the
+ * header array. It also returns either a pointer to the base of the
+ * new header array, or 0 in the event of an xrealloc error.
+ */
+#define MI_ALLOCLISTHEADER(list, numlists) \
+ if ((list)->maxLists < (numlists)) { \
+ int i; \
+ listofddPoint *listptr; \
+ if ((list)->maxLists) \
+ (list)->ddList = \
+ (listofddPoint *)xrealloc((list)->ddList, \
+ (numlists)*sizeof(listofddPoint)); \
+ else \
+ (list)->ddList = \
+ (listofddPoint *)xalloc((numlists)*sizeof(listofddPoint)); \
+ listptr = &(list)->ddList[(list)->maxLists]; \
+ for (i = (list)->maxLists; i < (numlists); i++) { \
+ listptr->numPoints = listptr->maxData = 0; \
+ (listptr++)->pts.p2Dpt = 0; \
+ } \
+ (list)->maxLists=(numlists); \
+ }
+
+/*
+ * MI_FREELISTHEADER xfree's all allocated data associated with
+ * a ListHeader data structure.
+ */
+#define MI_FREELISTHEADER(list) \
+ if ((list)->maxLists) \
+ { \
+ ddULONG maxlists = (list)->maxLists; \
+ listofddPoint *listptr = (list)->ddList; \
+ int mi_freelistheader_counter; \
+ for (mi_freelistheader_counter = 0; \
+ mi_freelistheader_counter < maxlists; \
+ mi_freelistheader_counter++) { \
+ if (listptr->maxData) xfree(listptr->pts.p2Dpt); \
+ listptr++; \
+ } \
+ xfree((list)->ddList); \
+ (list)->maxLists = 0; \
+ }
+
+/*
+ * MI_ALLOCLISTOFDDPOINT insures that there are numpoints in the
+ * vertex array of type type. It also returns either a pointer
+ * to the base of the new data array, or 0 in the event of
+ * an xrealloc error.
+ */
+#define MI_ALLOCLISTOFDDPOINT(buff, numpoints, bytes_per_vert) \
+ if ((buff)->maxData) { \
+ if ((buff)->maxData < (numpoints)*bytes_per_vert) { \
+ (buff)->maxData = (numpoints) * bytes_per_vert; \
+ (buff)->pts.p2Dpt=(ddCoord2D *)xrealloc((buff)->pts.p2Dpt, \
+ (buff)->maxData); \
+ } \
+ } else { \
+ (buff)->maxData = (numpoints) * bytes_per_vert; \
+ (buff)->pts.p2Dpt=(ddCoord2D *)xalloc((buff)->maxData); \
+ }
+
+/*
+ * MI_FREELISTOFDDPOINT frees the data area associated with
+ * the specified list header.
+ * It also sets the list pointer to 0, and the max data count to 0.
+ */
+#define MI_FREELISTOFDDPOINT(buff, numpoints, bytes_per_vert) \
+ if (buff) \
+ { \
+ xfree((buff)->pts.p2Dpt); \
+ (buff)->pts.p2Dpt = 0; \
+ (buff)->maxData = 0; \
+ }
+
+
+/*
+ * Memory management macros for use with facet lists in static ddcontext
+ */
+
+/*
+ * MI_ALLOCLISTOFDDFACET insures that there are numfacets in the
+ * facet array of type type. It also returns either a pointer
+ * to the base of the new data array, or 0 in the event of
+ * an xrealloc error.
+ */
+#define MI_ALLOCLISTOFDDFACET(buff, numfacets, bytes_per_facet) \
+ if ((buff)->maxData) { \
+ if ((buff)->maxData < (numfacets)*bytes_per_facet) { \
+ (buff)->maxData = (numfacets) * bytes_per_facet; \
+ (buff)->facets.pFacetRgbFloatN = \
+ (ddRgbFloatNormal *)xrealloc((buff)->facets.pFacetRgbFloatN, \
+ (buff)->maxData); \
+ } \
+ } else { \
+ (buff)->maxData = (numfacets) * bytes_per_facet; \
+ (buff)->facets.pFacetRgbFloatN = \
+ (ddRgbFloatNormal *)xalloc((buff)->maxData); \
+ }
+
+/*
+ * MI_FREELISTOFDDFACET frees the data area associated with
+ * the specified facet list.
+ * It also sets the list pointer to 0, and the max data count to 0.
+ */
+#define MI_FREELISTOFDDFACET(buff) \
+ if (buff) \
+ { \
+ xfree((buff)->pts.p2Dpt); \
+ (buff)->facets.pFacetRgbFloatN = 0; \
+ (buff)->maxData = 0; \
+ }
+
+
+/* bit handling macros for renderer dynamics change flags */
+
+#define MI_SET_ALL_CHANGES(prend) \
+ prend->tablesChanges = ~0; \
+ prend->namesetsChanges = ~0; \
+ prend->attrsChanges = ~0
+
+#define MI_ZERO_ALL_CHANGES(prend) \
+ prend->tablesChanges = 0; \
+ prend->namesetsChanges = 0; \
+ prend->attrsChanges = 0
+
+
+/* Inverse transform validation routines */
+
+#define VALIDATEINVTRMCTOWCXFRM(pddc) \
+ if (pddc->Static.misc.flags & INVTRMCTOWCXFRMFLAG) { \
+ miMatCopy(pddc->Dynamic->mc_to_wc_xform, \
+ pddc->Static.misc.inv_tr_mc_to_wc_xform); \
+ miMatInverseTranspose(pddc->Static.misc.inv_tr_mc_to_wc_xform);\
+ pddc->Static.misc.flags &= ~INVTRMCTOWCXFRMFLAG; \
+ }
+
+#define VALIDATEINVTRWCTOCCXFRM(pddc) \
+ if (pddc->Static.misc.flags & INVTRWCTOCCXFRMFLAG) { \
+ miMatCopy(pddc->Dynamic->wc_to_cc_xform, \
+ pddc->Static.misc.inv_tr_wc_to_cc_xform); \
+ miMatInverseTranspose(pddc->Static.misc.inv_tr_wc_to_cc_xform);\
+ pddc->Static.misc.flags &= ~INVTRWCTOCCXFRMFLAG; \
+ }
+
+#define VALIDATEINVTRMCTOCCXFRM(pddc) \
+ if (pddc->Static.misc.flags & INVTRMCTOCCXFRMFLAG) { \
+ miMatCopy(pddc->Dynamic->mc_to_cc_xform, \
+ pddc->Static.misc.inv_tr_mc_to_cc_xform); \
+ miMatInverseTranspose(pddc->Static.misc.inv_tr_mc_to_cc_xform);\
+ pddc->Static.misc.flags &= ~INVTRMCTOCCXFRMFLAG; \
+ }
+
+#define VALIDATEINVTRCCTODCXFRM(pddc) \
+ if (pddc->Static.misc.flags & INVTRCCTODCXFRMFLAG) { \
+ miMatCopy(pddc->Dynamic->cc_to_dc_xform, \
+ pddc->Static.misc.inv_tr_cc_to_dc_xform); \
+ miMatInverseTranspose(pddc->Static.misc.inv_tr_cc_to_dc_xform);\
+ pddc->Static.misc.flags &= ~INVTRCCTODCXFRMFLAG; \
+ }
+
+#endif /* MI_H */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/include/mixform.h b/xc/programs/Xserver/PEX5/ddpex/mi/include/mixform.h
new file mode 100644
index 000000000..490f6657f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/include/mixform.h
@@ -0,0 +1,55 @@
+/* $TOG: mixform.h /main/3 1998/02/10 12:39:35 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+******************************************************************/
+/*
+** Definition of some global transformation matrices for fastdd3
+*/
+
+#include "ddpex.h"
+
+ddFLOAT mc_to_dc_xform[4][4];
+ddFLOAT mc_to_npc_xform[4][4];
+ddFLOAT mc_to_wc_xform[4][4];
+ddFLOAT wc_to_npc_xform[4][4];
+ddFLOAT npc_to_dc_xform[4][4];
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level0/README b/xc/programs/Xserver/PEX5/ddpex/mi/level0/README
new file mode 100644
index 000000000..4f88f8689
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level0/README
@@ -0,0 +1,48 @@
+
+/* $TOG: README /main/3 1998/02/10 13:59:41 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+This directory contains the lowest level support for PEX. The sample
+implementation uses the core X device-dependent code (ddx) for this level.
+Please go to directory Xsrc/server/ddx to find this code.
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/level1/Imakefile
new file mode 100644
index 000000000..7aa86e3f1
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/Imakefile
@@ -0,0 +1,81 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/10 1996/09/28 16:54:08 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level1/Imakefile,v 3.10 1999/04/17 09:08:15 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDdpexCDebugFlags
+#define PexDdpexCDebugFlags ServerCDebugFlags
+#endif
+
+XCOMM -D defines for ddpex:
+XCOMM DDTEST turns on some fprintf(stderr...)s for debugging
+
+ DEFINES = PexDdpexDefines
+CDEBUGFLAGS = PexDdpexCDebugFlags
+
+ PEXSERVINC = ../../../include
+DDPEXINCLUDE = ../include
+
+INCLUDES = -I. \
+ -I$(DDPEXINCLUDE) \
+ -I$(XINCLUDESRC) \
+ -I$(PEXSERVINC) \
+ -I$(SERVERSRC)/include
+
+SRCS = miDDCtoGC.c \
+ miListUtil.c \
+ miLvl1Tab.c \
+ miRndFArea.c \
+ miRndPLine.c \
+ miRndMarkr.c \
+ miRndText.c \
+ miRndTStrip.c \
+ miPck1Prim.c \
+ mi52stubs.c
+
+OBJS = miDDCtoGC.o \
+ miListUtil.o \
+ miLvl1Tab.o \
+ miRndFArea.o \
+ miRndPLine.o \
+ miRndMarkr.o \
+ miRndText.o \
+ miRndTStrip.o \
+ miPck1Prim.o \
+ mi52stubs.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ddpex1,$(OBJS))
+
+LintLibraryTarget(dp1, $(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/mi52stubs.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/mi52stubs.c
new file mode 100644
index 000000000..d381d4823
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/mi52stubs.c
@@ -0,0 +1,177 @@
+/* $TOG: mi52stubs.c /main/2 1998/02/10 12:40:32 kaleb $ */
+
+/***********************************************************
+
+Copyright 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+******************************************************************/
+
+#include "X.h"
+#include "PEX.h"
+#include "pexError.h"
+#include "pex_site.h"
+#include "pexLookup.h"
+#include "ddpex4.h"
+
+ErrorCode
+PutZBuffer(prend, x, y, width, height, normalizedValues, numValues, Zbuffer)
+ ddRendererStr prend;
+ int x, y;
+ unsigned int width, height;
+ pexSwitch normalizedValues;
+ unsigned int numValues;
+ ddPointer *Zbuffer;
+{
+ return Success;
+}
+
+
+ErrorCode
+SetStructurePermission(pstr, permission)
+ diStructHandle pstr;
+ unsigned int permission;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyPixmapToAlpha(prend, pDrawable)
+ ddRendererStr prend;
+ DrawablePtr pDrawable;
+{
+ return Success;
+}
+
+
+ErrorCode
+InitMultipass(prend)
+ ddRendererStr prend;
+{
+ return Success;
+}
+
+
+ErrorCode
+GetZBuffer(prend, x, y, width, height, normalizedValues, numValues,
+ undefinedValues, pPEXBuffer)
+ ddRendererStr prend;
+ int x, y;
+ unsigned int width, height;
+ pexSwitch normalizedValues;
+ ddULONG *numValues;
+ pexSwitch *undefinedValues;
+ ddBuffer *pPEXBuffer;
+{
+ return Success;
+}
+
+
+ErrorCode
+ClearRenderer(prend, clearControl)
+ ddRendererStr prend;
+ pexBitmask clearControl;
+{
+ return Success;
+}
+
+
+ErrorCode
+NextPassWoutReply(prend, multipass_control)
+ ddRendererStr prend;
+ unsigned int multipass_control;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyZBufferToPixmap(prend, pDrawable)
+ ddRendererStr prend;
+ DrawablePtr pDrawable;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyPipelineStateToPC(prend, ppc, itemMask)
+ ddRendererStr prend;
+ ddPCStr *ppc;
+ unsigned int itemMask;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyAlphaToPixmap(prend, pDrawable)
+ ddRendererStr prend;
+ DrawablePtr pDrawable;
+{
+ return Success;
+}
+
+
+ErrorCode
+NextPass(prend, multipass_control, count)
+ ddRendererStr prend;
+ unsigned int multipass_control;
+ ddLONG *count;
+{
+ return Success;
+}
+
+
+ErrorCode
+FlushRenderer(prend, flushFlag)
+ ddRendererStr prend;
+ pexSwitch flushFlag;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyPixmapToZBuffer(prend, pDrawable)
+ ddRendererStr prend;
+ DrawablePtr pDrawable;
+{
+ return Success;
+}
+
+
+ErrorCode
+SetElementPointerAtPickID(pstr, pickId, offset)
+ diStructHandle pstr;
+ int pickId;
+ int offset;
+{
+ return Success;
+}
+
+
+ErrorCode
+CopyPCToPipelineState(prend, ppc, itemMask)
+ ddRendererStr *prend;
+ ddPCStr *ppc;
+ pexBitmask itemMask;
+{
+ return Success;
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miDDCtoGC.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miDDCtoGC.c
new file mode 100644
index 000000000..68f8a34b2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miDDCtoGC.c
@@ -0,0 +1,589 @@
+/* $TOG: miDDCtoGC.c /main/7 1998/02/10 12:39:39 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level1/miDDCtoGC.c,v 3.6 1998/10/04 09:34:09 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "miLineDash.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miDDC_to_GC_polyline
+ |
+ | Function Description:
+ | Initializes the attributes in a GC in order to correctly
+ | render a polyline. Currently, therefore, the following
+ | attributes are set:
+ |
+ | line width
+ | dashing
+ |
+ | Note(s):
+ | This routine currently performs no optimization of this
+ | process. For example, no effort is made to globally check
+ | whether this process is even necessary.
+ | Note that this routine assumes that the proper defaults
+ | are set for the GC attributes not used by PEX (attributes
+ | such as line join style or end cap style).
+ |
+ --*/
+
+ddpex3rtn
+miDDC_to_GC_polyline(pRend, pddc, pgc)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* dd Context handle */
+GCPtr pgc; /* X GC handle */
+{
+ ddLONG gcmask = 0;
+ ddUSHORT status;
+ ddColourSpecifier linecolour;
+ miColourEntry *plinecolour;
+ ddULONG colourindex;
+ ddSHORT linewidth;
+
+
+ /*
+ * Set line colour.
+ * The colour must be processed according
+ * to the contents of the current colour approximation table
+ * entry to compute the proper direct colour.
+ */
+
+ /*
+ * Calculate final color index.
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ linecolour = pddc->Static.attrs->echoColour;
+ else
+ linecolour = pddc->Static.attrs->lineColour;
+
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &linecolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pgc->fgPixel) {
+ gcmask |= GCForeground;
+ pgc->fgPixel = colourindex;
+ }
+
+ /*
+ * Set line width. PEX line width is defined as
+ * the product of the line width scale factor (lineWidth in
+ * the PC) and the workstation nominal line width (1 for X).
+ * therefore the linewidth is simply equal to the line width
+ * scale factor. Note that this code sets lineWidth of 1
+ * to ddx linewidth 0. Although this is technically wrong,
+ * it sure does speed things up!
+ */
+ if (pddc->Static.attrs->lineWidth <= 1.0) linewidth = 0;
+ else linewidth = (ddSHORT)pddc->Static.attrs->lineWidth;
+
+ /* Only set GC value if necessary */
+ if (linewidth != pgc->lineWidth) {
+ gcmask |= GCLineWidth;
+ pgc->lineWidth = linewidth;
+ }
+
+ /*
+ * Set the line dash. PEX defines three line dash
+ * types: solid (no dashing), dashed (equally spaced dashes)
+ * dotted (equally spaced dots) and dash dot (alternating
+ * dots and dashes). Note that the default dashing is
+ * defined in miLineDash.h.
+ */
+ /* Only set dashes if necessary */
+ switch (pddc->Static.attrs->lineType) {
+
+ case PEXLineTypeSolid:
+ if (pgc->lineStyle != LineSolid) {
+ gcmask |= GCLineStyle;
+ pgc->lineStyle = LineSolid;
+ }
+ break;
+
+ case PEXLineTypeDashed:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dashed_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashed,
+ sizeof(mi_line_dashed));
+
+ } else if (pgc->dash != mi_line_dashed) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dashed_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashed,
+ sizeof(mi_line_dashed));
+ }
+ break;
+
+ case PEXLineTypeDotted:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dotted_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dotted,
+ sizeof(mi_line_dotted));
+
+ } else if (pgc->dash != mi_line_dotted) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dotted_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dotted,
+ sizeof(mi_line_dotted));
+ }
+ break;
+
+ case PEXLineTypeDashDot:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dashdot_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashdot,
+ sizeof(mi_line_dashdot));
+
+ } else if (pgc->dash != mi_line_dashdot) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dashdot_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashdot,
+ sizeof(mi_line_dashdot));
+ }
+ break;
+ }
+
+ /* Register changes with ddx */
+ if (gcmask) {
+ pgc->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgc->stateChanges |= gcmask;
+ (*pgc->funcs->ChangeGC)(pgc, gcmask);
+ }
+
+ /* Clear polyline GC change flag */
+ pddc->Static.misc.flags &= ~POLYLINEGCFLAG;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miDDC_to_GC_edges
+ |
+ | Function Description:
+ | Initializes the attributes in a GC in order to correctly
+ | render the edges of a fill area. Currently, therefore,
+ | the following attributes are set:
+ |
+ | line width
+ | dashing
+ |
+ | Note(s):
+ | Note, that no colour initialization is performed - this attribute
+ | changes too often within the rendering pipeline.
+ | Lastly, note that this routine assumes that the proper defaults
+ | are set for the GC attributes not used by PEX (attributes
+ | such as stipple mask, etc...)
+ |
+ --*/
+
+ddpex3rtn
+miDDC_to_GC_edges(pRend, pddc, pgc)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* dd Context handle */
+GCPtr pgc; /* X GC handle */
+{
+ ddLONG gcmask = 0;
+ ddUSHORT status;
+ ddColourSpecifier edgecolour;
+ miColourEntry *pedgecolour;
+ ddULONG colourindex;
+ ddSHORT edgewidth;
+
+
+ /*
+ * Set edge colour.
+ * The colour must be processed according
+ * to the contents of the current colour approximation table
+ * entry to compute the proper direct colour.
+ */
+
+ /*
+ * Calculate final color index.
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ edgecolour = pddc->Static.attrs->echoColour;
+ else
+ edgecolour = pddc->Static.attrs->edgeColour;
+
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &edgecolour, &colourindex);
+
+
+ /* Only set GC value if necessary */
+ if (colourindex != pgc->fgPixel) {
+ gcmask |= GCForeground;
+ pgc->fgPixel = colourindex;
+ }
+
+ /*
+ * Set edge width. PEX edge width is defined as
+ * the product of the edge width scale factor (lineWidth in
+ * the PC) and the workstation nominal line width (1 for X).
+ * therefore the edge is simply equal to the edge width
+ * scale factor. Note that this code sets edgeWidth of 1
+ * to ddx linewidth 0. Although this is technically wrong,
+ * it sure does speed things up!
+ */
+ if (pddc->Static.attrs->edgeWidth <= 1.0) edgewidth = 0;
+ else edgewidth = (ddSHORT)pddc->Static.attrs->edgeWidth;
+
+ /* Only set GC value if necessary */
+ if (edgewidth != pgc->lineWidth) {
+ gcmask |= GCLineWidth;
+ pgc->lineWidth = edgewidth;
+ }
+
+ /*
+ * Next, set the edge dash. PEX defines three line dash
+ * types: solid (no dashing), dashed (equally spaced dashes)
+ * dotted (equally spaced dots) and dash dot (alternating
+ * dots and dashes). Note that the default dashing is
+ * defined in miLineDash.h.
+ */
+ switch (pddc->Static.attrs->edgeType) {
+
+ case PEXLineTypeSolid:
+ if (pgc->lineStyle != LineSolid) {
+ gcmask |= GCLineStyle;
+ pgc->lineStyle = LineSolid;
+ }
+ break;
+
+ case PEXLineTypeDashed:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dashed_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashed,
+ sizeof(mi_line_dashed));
+
+ } else if (pgc->dash != mi_line_dashed) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dashed_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashed,
+ sizeof(mi_line_dashed));
+ }
+ break;
+
+ case PEXLineTypeDotted:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dotted_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dotted,
+ sizeof(mi_line_dotted));
+
+ } else if (pgc->dash != mi_line_dotted) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dotted_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dotted,
+ sizeof(mi_line_dotted));
+ }
+ break;
+
+ case PEXLineTypeDashDot:
+ if (pgc->lineStyle != LineOnOffDash) {
+ gcmask |= (GCLineStyle | GCDashList);
+ pgc->lineStyle = LineOnOffDash;
+ pgc->numInDashList = mi_line_dashdot_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashdot,
+ sizeof(mi_line_dashdot));
+
+ } else if (pgc->dash != mi_line_dashdot) {
+ gcmask |= GCDashList;
+ pgc->numInDashList = mi_line_dashdot_length;
+ if (pddc->Static.misc.flags & NOLINEDASHFLAG) {
+ pgc->dash = (unsigned char *)xalloc(MAX_LINE_DASH_LENGTH_SIZE);
+ pddc->Static.misc.flags &= ~NOLINEDASHFLAG;
+ }
+ memcpy( (char *)(pgc->dash), (char *)mi_line_dashdot,
+ sizeof(mi_line_dashdot));
+ }
+ break;
+ }
+
+ /* Register changes with ddx */
+ if (gcmask) {
+ pgc->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgc->stateChanges |= gcmask;
+ (*pgc->funcs->ChangeGC)(pgc, gcmask);
+ }
+
+ /* Clear polyline GC change flag */
+ pddc->Static.misc.flags &= ~EDGEGCFLAG;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miDDC_to_GC_fill_area
+ |
+ | Function Description:
+ | Initializes the attributes in a GC in order to correctly
+ | render a fill area. Currently, therefore,
+ | the following attributes are set:
+ |
+ | interior colour
+ |
+ | Note(s):
+ | Note that this routine assumes that the proper defaults
+ | are set for the GC attributes not used by PEX (attributes
+ | such as stipple mask, etc...)
+ |
+ --*/
+
+ddpex3rtn
+miDDC_to_GC_fill_area(pRend, pddc, pgc)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* dd Context handle */
+GCPtr pgc; /* X GC handle */
+{
+ ddLONG gcmask = 0;
+
+
+}
+
+/*++
+ |
+ | Function Name: miDDC_to_GC_marker
+ |
+ | Function Description:
+ | Initializes the attributes in a GC in order to correctly
+ | render a marker. Currently, therefore,
+ | the following attributes are set:
+ |
+ | colour
+ |
+ | Note(s):
+ | Note that this routine assumes that the proper defaults
+ | are set for the GC attributes not used by PEX (attributes
+ | such as stipple mask, etc...)
+ |
+ --*/
+
+ddpex3rtn
+miDDC_to_GC_marker(pRend, pddc, pgc)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* dd Context handle */
+GCPtr pgc; /* X GC handle */
+{
+ ddLONG gcmask = 0;
+ ddUSHORT status;
+ ddColourSpecifier markercolour;
+ miColourEntry *pmarkercolour;
+ ddULONG colourindex;
+
+
+ /*
+ * Set the marker colour.
+ * The colour must be processed according
+ * to the contents of the current colour approximation table
+ * entry to compute the proper direct colour.
+ */
+
+ /*
+ * Calculate final color index.
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ markercolour = pddc->Static.attrs->echoColour;
+ else
+ markercolour = pddc->Static.attrs->markerColour;
+
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &markercolour, &colourindex);
+
+
+ /* Only set GC value if necessary */
+ if (colourindex != pgc->fgPixel) {
+ gcmask |= GCForeground;
+ pgc->fgPixel = colourindex;
+ }
+
+ /* Register changes with ddx */
+ if (gcmask) {
+ pgc->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgc->stateChanges |= gcmask;
+ (*pgc->funcs->ChangeGC)(pgc, gcmask);
+ }
+
+ /* Clear polyline GC change flag */
+ pddc->Static.misc.flags &= ~MARKERGCFLAG;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miDDC_to_GC_text
+ |
+ | Function Description:
+ | Initializes the attributes in a GC in order to correctly
+ | render a text. Currently, therefore,
+ | the following attributes are set:
+ |
+ | colour
+ |
+ | Note(s):
+ | Note that this routine assumes that the proper defaults
+ | are set for the GC attributes not used by PEX (attributes
+ | such as stipple mask, etc...)
+ |
+ --*/
+
+ddpex3rtn
+miDDC_to_GC_text(pRend, pddc, pgc)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* dd Context handle */
+GCPtr pgc; /* X GC handle */
+{
+ ddLONG gcmask = 0;
+ ddUSHORT status;
+ ddColourSpecifier textcolour;
+ miColourEntry *ptextcolour;
+ ddULONG colourindex;
+
+ /*
+ * Set text colour.
+ * The colour must be processed according
+ * to the contents of the current colour approximation table
+ * entry to compute the proper direct colour.
+ */
+
+ /*
+ * Calculate final color index.
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ textcolour = pddc->Static.attrs->echoColour;
+ else
+ textcolour = pddc->Static.attrs->textColour;
+
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &textcolour, &colourindex);
+
+
+ /* Only set GC value if necessary */
+ if (colourindex != pgc->fgPixel) {
+ gcmask |= GCForeground;
+ pgc->fgPixel = colourindex;
+ }
+
+ /* Register changes with ddx */
+ if (gcmask) {
+ pgc->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgc->stateChanges |= gcmask;
+ (*pgc->funcs->ChangeGC)(pgc, gcmask);
+ }
+
+ /* Clear polyline GC change flag */
+ pddc->Static.misc.flags &= ~TEXTGCFLAG;
+
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLevel1.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLevel1.c
new file mode 100644
index 000000000..3abdd5b42
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLevel1.c
@@ -0,0 +1,127 @@
+/* $TOG: miLevel1.c /main/3 1998/02/10 12:39:44 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#include "ddpex.h"
+
+ddpex1rtn
+PexTriangle(pRend, pPt1, pPt2, pPt3, pColour1, pColour2, pColour3)
+/* in */
+ ddRendererPtr pRend;
+ ddDeviceCoord *pPt1;
+ ddDeviceCoord *pPt2;
+ ddDeviceCoord *pPt3;
+ ddColourSpecifier *pColour1;
+ ddColourSpecifier *pColour2;
+ ddColourSpecifier *pColour3;
+/* out */
+{
+ return(Success);
+}
+
+ddpex1rtn
+PexTrapezoid(pRend, pPt1, pPt2, pPt3, pPt4, pColour1, pColour2, pColour3, pColour4)
+/* in */
+ ddRendererPtr pRend;
+ ddDeviceCoord *pPt1;
+ ddDeviceCoord *pPt2;
+ ddDeviceCoord *pPt3;
+ ddDeviceCoord *pPt4;
+ ddColourSpecifier *pColour1;
+ ddColourSpecifier *pColour2;
+ ddColourSpecifier *pColour3;
+ ddColourSpecifier *pColour4;
+/* out */
+{
+ return(Success);
+}
+
+ddpex1rtn
+PexInterpSpan1(pRend, pPt1, pPt2, startColour, numSteps)
+/* in */
+ ddRendererPtr pRend;
+ ddDeviceCoord *pPt1;
+ ddDeviceCoord *pPt2;
+ ddTableIndex startColour;
+ ddUSHORT numSteps;
+/* out */
+{
+ return(Success);
+}
+
+ddpex1rtn
+PexInterpSpan2(pRend, pPt1, pPt2, startColour, endColour)
+/* in */
+ ddRendererPtr pRend;
+ ddDeviceCoord *pPt1;
+ ddDeviceCoord *pPt2;
+ ddTableIndex startColour;
+ ddTableIndex endColour;
+/* out */
+{
+ return(Success);
+}
+
+typedef struct {
+ ddULONG width;
+ ddULONG height;
+ ddULONG depth;
+ ddULONG numBytes;
+ ddPointer pBytes;
+} ddGlyphStr;
+
+ddpex1rtn
+PexGlyph(pRend, pUpperLeft, pForeground, pBackground, pGlyph)
+/* in */
+ ddRendererPtr pRend;
+ ddDeviceCoord *pUpperLeft;
+ ddColourSpecifier *pForeground;
+ ddColourSpecifier *pBackground;
+ ddGlyphStr *pGlyph;
+/* out */
+{
+ return(Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miListUtil.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miListUtil.c
new file mode 100644
index 000000000..952e5a7d2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miListUtil.c
@@ -0,0 +1,343 @@
+/* $TOG: miListUtil.c /main/4 1998/02/10 12:39:50 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level1/miListUtil.c,v 3.5 1998/10/04 09:34:10 dawes Exp $ */
+
+#include "miRender.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "gcstruct.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miCopyPath
+ |
+ | Function Description:
+ | Copies the data in a path to a second path.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miCopyPath(pddc, vinput, voutput, flags)
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *vinput;
+ miListHeader **voutput;
+ int flags;
+{
+ miListHeader *output;
+ int j;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int point_size;
+
+ /* Use the pre-defined 4D list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = vinput->type;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ DD_VertPointSize(vinput->type, point_size);
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((pddolist->numPoints = pddilist->numPoints) <= 0) continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),point_size);
+ if (!pddolist->pts.p4Dpt) return(BadAlloc);
+
+ memcpy( (char *)pddolist->pts.p4Dpt,
+ (char *)pddilist->pts.p4Dpt,
+ ((int)(pddilist->numPoints))*point_size);
+
+ pddilist++;
+ pddolist++;
+ }
+
+ return(Success);
+}
+
+#define VERTEX_FLAG (1 << 0)
+#define COLOR_FLAG (1 << 1)
+#define NORMAL_FLAG (1 << 2)
+#define EDGE_FLAG (1 << 3)
+/*++
+ |
+ | Function Name: miFilterPath
+ |
+ | Function Description:
+ | Copies the supplied input path to the output path,
+ | but only copying the indicated fields.
+ |
+ | Note(s):
+ |
+ | fields: (1 << 0) - point data
+ | (1 << 1) - color data
+ | (1 << 2) - normal data
+ | (1 << 3) - edge data
+ |
+ | any combination of the above flags are valid.
+ | if the indicated field doesn not exist, it is ignored.
+ |
+ --*/
+
+ddpex3rtn
+miFilterPath(pddc, vinput, voutput, fields)
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *vinput;
+ miListHeader **voutput;
+ int fields;
+{
+ char *in_pt, *out_pt;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ miListHeader *output;
+ int in_point_size, out_point_size;
+ int color_offset, normal_offset, edge_offset;
+ int vertex_size, color_size;
+ int i, j;
+
+ /* Use the pre-defined 4D list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = vinput->type;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ if (fields & VERTEX_FLAG) {
+ if (DD_IsVertFloat(vinput->type)) {
+ if (DD_IsVert2D(vinput->type)) vertex_size = sizeof(ddCoord2D);
+ else if (DD_IsVert3D(vinput->type)) vertex_size = sizeof(ddCoord3D);
+ else vertex_size = sizeof(ddCoord4D);
+ } else {
+ if (DD_IsVert2D(vinput->type)) vertex_size = sizeof(ddCoord2DS);
+ else vertex_size = sizeof(ddCoord3DS);
+ }
+ } else DD_UnSetVertCoord(output->type);
+
+ if (fields & COLOR_FLAG) {
+ DD_VertOffsetColor(vinput->type, color_offset);
+ if (color_offset < 0) fields &= ~COLOR_FLAG;
+ else {
+ if (DD_IsVertIndexed(vinput->type))
+ color_size = sizeof(ddIndexedColour);
+ else if (DD_IsVertRGB8(vinput->type))
+ color_size = sizeof(ddRgb8Colour);
+ else if (DD_IsVertRGB16(vinput->type))
+ color_size = sizeof(ddRgb16Colour);
+ else color_size = sizeof(ddRgbFloatColour);
+ }
+ } else DD_UnSetColour(output->type);
+
+ if (fields & NORMAL_FLAG) {
+ DD_VertOffsetNormal(vinput->type, normal_offset);
+ if (normal_offset < 0) fields &= ~NORMAL_FLAG;
+ } else DD_UnSetVertNormal(output->type);
+
+ if (fields & EDGE_FLAG) {
+ DD_VertOffsetEdge(vinput->type, edge_offset);
+ if (edge_offset < 0) fields &= ~EDGE_FLAG;
+ } else DD_UnSetVertEdge(output->type);
+
+ DD_VertPointSize(vinput->type, in_point_size);
+ DD_VertPointSize(output->type, out_point_size);
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((pddolist->numPoints = pddilist->numPoints) <= 0) continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),out_point_size);
+ if (!pddolist->pts.p4Dpt) return(BadAlloc);
+ out_pt = (char *)pddolist->pts.p4Dpt;
+ in_pt = (char *)pddilist->pts.p4Dpt;
+
+ for (i = 0; i < pddilist->numPoints; i++) {
+ if (fields & VERTEX_FLAG) memcpy( out_pt, in_pt, vertex_size);
+ if (fields & COLOR_FLAG) memcpy( (out_pt+ color_offset),
+ (in_pt + color_offset),
+ color_size);
+ if (fields & NORMAL_FLAG) memcpy( (out_pt+ color_offset),
+ (in_pt + normal_offset),
+ sizeof(ddVector3D));
+ if (fields & EDGE_FLAG) memcpy( (out_pt+ color_offset),
+ (in_pt + edge_offset),
+ sizeof(ddULONG));
+ in_pt += in_point_size;
+ out_pt += out_point_size;
+ }
+
+ pddilist++;
+ pddolist++;
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miComputeListBounds
+ |
+ | Function Description:
+ | Computes the extents of the supplied list.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miComputeListBounds(pddc, vinput, bounds)
+/* in */
+ miDDContext *pddc;
+ miListHeader *vinput;
+ ddListBounds *bounds;
+{
+/* uses */
+ char *in_pt;
+ listofddPoint *pddilist;
+ int vert_count;
+ int point_size;
+ int j;
+ char first = 1;
+
+ if (DD_IsVert2D(vinput->type)) {
+ bounds->zmin = bounds->zmax = 0.0;
+ bounds->wmin = bounds->wmax = 1.0;
+ } else if (DD_IsVert3D(vinput->type)) {
+ bounds->wmin = bounds->wmax = 1.0;
+ }
+
+ pddilist = vinput->ddList;
+ DD_VertPointSize(vinput->type, point_size);
+
+ /* Now, clip each list */
+
+ for (j = 0; j < vinput->numLists; j++) {
+
+ /* Skip list if no points */
+ if ((vert_count = pddilist->numPoints) <= 0) {
+ pddilist++;
+ continue;
+ }
+
+ in_pt = pddilist->pts.ptr;
+
+ if (first) {
+ bounds->xmin = bounds->xmax = ((ddCoord4D *)in_pt)->x;
+ bounds->ymin = bounds->ymax = ((ddCoord4D *)in_pt)->y;
+ if (DD_IsVert3D(vinput->type))
+ bounds->zmin = bounds->zmax = ((ddCoord4D *)in_pt)->z;
+ else if (DD_IsVert4D(vinput->type))
+ bounds->wmin = bounds->wmax = ((ddCoord4D *)in_pt)->w;
+ first = 0;
+ }
+
+ /* For each vertex, clip a polyline segment */
+ while (vert_count--) {
+
+ if (((ddCoord4D *)in_pt)->x < bounds->xmin)
+ bounds->xmin = ((ddCoord4D *)in_pt)->x;
+ if (((ddCoord4D *)in_pt)->x > bounds->xmax)
+ bounds->xmax = ((ddCoord4D *)in_pt)->x;
+ if (((ddCoord4D *)in_pt)->y < bounds->ymin)
+ bounds->ymin = ((ddCoord4D *)in_pt)->y;
+ if (((ddCoord4D *)in_pt)->y > bounds->ymax)
+ bounds->ymax = ((ddCoord4D *)in_pt)->y;
+
+ if (DD_IsVert3D(vinput->type)) {
+ if (((ddCoord4D *)in_pt)->z < bounds->zmin)
+ bounds->zmin = ((ddCoord4D *)in_pt)->z;
+ if (((ddCoord4D *)in_pt)->z > bounds->zmax)
+ bounds->zmax = ((ddCoord4D *)in_pt)->z;
+
+ } else if (DD_IsVert4D(vinput->type)) {
+ if (((ddCoord4D *)in_pt)->z < bounds->zmin)
+ bounds->zmin = ((ddCoord4D *)in_pt)->z;
+ if (((ddCoord4D *)in_pt)->z > bounds->zmax)
+ bounds->zmax = ((ddCoord4D *)in_pt)->z;
+ if (((ddCoord4D *)in_pt)->w < bounds->wmin)
+ bounds->wmin = ((ddCoord4D *)in_pt)->w;
+ if (((ddCoord4D *)in_pt)->w > bounds->wmax)
+ bounds->wmax = ((ddCoord4D *)in_pt)->w;
+ }
+
+ in_pt += point_size;
+ }
+
+ /* skip to next list */
+ pddilist++;
+
+ }
+
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLvl1Tab.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLvl1Tab.c
new file mode 100644
index 000000000..8743f3195
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miLvl1Tab.c
@@ -0,0 +1,80 @@
+/* $TOG: miLvl1Tab.c /main/3 1998/02/10 12:39:55 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* Level I Rendering routine tables */
+
+#include "mipex.h"
+#include "miRender.h"
+
+/* Rendering procedures for ExecuteOCTable */
+extern ddpex2rtn miRenderPolyLine(),
+ miRenderFillArea(),
+ miRenderText(),
+ miRenderMarker(),
+ miRenderTriStrip();
+
+RendTableType RenderPrimitiveTable[] = {
+ miRenderPolyLine, /* 0 Polylines */
+ miRenderFillArea, /* 1 Fill Areas */
+ miRenderText, /* 2 Text */
+ miRenderMarker, /* 3 Markers */
+ miRenderTriStrip, /* 4 Triangle Strips */
+};
+
+/* Picking procedures for ExecuteOCTable */
+extern ddpex2rtn miPick1PolyLine(),
+ miPick1FillArea(),
+ miPick1Text(),
+ miPick1Marker(),
+ miPick1TriStrip();
+
+RendTableType PickPrimitiveTable[] = {
+ miPick1PolyLine, /* 0 Polylines */
+ miPick1FillArea, /* 1 Fill Areas */
+ miPick1Text, /* 2 Text */
+ miPick1Marker, /* 3 Markers */
+ miPick1TriStrip, /* 4 Triangle Strips */
+};
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miPck1Prim.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miPck1Prim.c
new file mode 100644
index 000000000..311ad9297
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miPck1Prim.c
@@ -0,0 +1,403 @@
+/* $TOG: miPck1Prim.c /main/4 1998/02/10 12:40:00 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#include "miRender.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "miFont.h"
+#include "miWks.h"
+#include "miText.h"
+#include "miClip.h"
+
+
+/*++
+ |
+ | Function Name: miPick1PolyLine
+ |
+ | Function Description:
+ | Handles the level 1picking of Polyline 3D, Polyline 2D,
+ | Polyline 3D with data OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPick1PolyLine(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ miListHeader *input_list;
+{
+/* calls */
+
+ /* Check if anything is remaining. If so, the pick volume */
+ /* intersects the polyline(s). If not, everything has been */
+ /* clipped out. Accordingly, update the global Pick_Flag. */
+
+ if (input_list->numLists > 0) {
+ pddc->Static.pick.status = PEXOk;
+ }
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miPick1Text
+ |
+ | Function Description:
+ | Handles the level 1 picking of Text OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPick1Text(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ miListHeader *input_list;
+/* out */
+{
+/* calls */
+
+ /* Check if anything is remaining. If so, the pick volume */
+ /* intersects the polyline(s). If not, everything has been */
+ /* clipped out. Accordingly, update the global Pick_Flag. */
+
+ if (input_list->numLists > 0) {
+ pddc->Static.pick.status = PEXOk;
+ }
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miPick1Marker
+ |
+ | Function Description:
+ | Handles the level 1 picking of Marker OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPick1Marker(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ miListHeader *input_list;
+/* out */
+{
+/* calls */
+
+ /* Check if anything is remaining. If so, the pick volume */
+ /* intersects the polymarker(s). If not, everything has been*/
+ /* clipped out. Accordingly, update the global Pick_Flag. */
+
+ if (input_list->numLists > 0) {
+ pddc->Static.pick.status = PEXOk;
+ }
+ return (Success);
+}
+
+
+/*
+ * Function Name: CheckFillAreaPick
+ *
+ * Purpose: Check if the input set of points represents a polygon that
+ * is INSIDE or OUTSIDE of the pick aperture.
+ *
+ * Return: Success if the points represent a polygon that is inside.
+ * Otherwise, return a negative number indicating NO_PICK.
+ *
+ */
+static
+ddpex2rtn
+CheckFAreaPick1 (in_list)
+/* in */
+ miListHeader *in_list;
+/* out */
+{
+/* calls */
+
+/* Local variables */
+
+ listofddPoint *poly_list;
+ ddPointUnion pt_list;
+ int pt_size;
+ ddCoord2D v1, v2;
+ ddSHORT x_same, y_same;
+ int i, j;
+ int vcount, hcount;
+
+ /*----------------------Picking Algorithm-------------------------*/
+ /* */
+ /* The first step is to look for trivial acceptance. I.E., the re-*/
+ /* maining polygon is partially enclosed by the pick aperture and */
+ /* at least one point lies completely within the aperture. */
+ /* If not, we have a possible degenerate case wherein, the edges */
+ /* of the remaining polygon is coinciding with the faces of the */
+ /* pick aperture. This also means that all the edges are either */
+ /* horizontal or vertical. There can be no 3D diagonal edges. */
+ /* */
+ /* The algorithm implemented here uses the odd-even rule. The idea*/
+ /* is to treat the input points, a pair at a time as an edge of */
+ /* the polygon remaining. The edge is tested to see if it is hor- */
+ /* -izontal, or vertical or diagonal. Note that we use the 3D def-*/
+ /* inition of horizontal, vertical, and diagonal here. A horizon- */
+ /* edge is an edge parallel to X or Z axis, a vertical edge is one*/
+ /* being parallel to only Y axis, and a diagonal edge is one which*/
+ /* is NOT parallel to any of the three axes of the 3D aperture. */
+ /* */
+ /* Thus, clearly, any diagonal edge present means that the polygon*/
+ /* is intersecting the pick aperture and hence a PICK condition is*/
+ /* detected. However, if there are no diagonal edges, then we have*/
+ /* a degenerate situation with the vertical or horizontal edges at*/
+ /* or on the boundaries of the pick aperture. */
+ /* Using the odd-even rule it is clear that if there are an odd */
+ /* number of vertical edges either to the left or in front of the */
+ /* center of the pick aperture, or to the right or in back of the */
+ /* center of the pick aperture, then the pick is sorrounded by the*/
+ /* polygon and hence is picked. On the other hand, if the number */
+ /* of vertical edges is even, then we have the pick aperture OUT-*/
+ /* SIDE of the polygon, and thus is not picked. The horizontal */
+ /* edges testing come into picture when there are no vertical ones*/
+ /* present. The test once again is to check whether the count of */
+ /* horizontal edges either to the left or front, or right or back */
+ /* of the center of the aperture, is even or odd. If odd, detect */
+ /* a PICK, else, detect a NO_PICK. */
+ /* */
+ /*----------------------------------------------------------------*/
+
+ /* Test for trivial pick case. i.e., at least one point is fully */
+ /* contained within the converted pick aperture in CC. */
+
+ poly_list = in_list->ddList; /* Initialize poly list pointer */
+
+ DD_VertPointSize (in_list->type, pt_size); /* Get point size */
+
+ for (i=0; i<in_list->numLists; i++, poly_list++) {
+
+ /* Get the pointer to the next points list */
+
+ pt_list.ptr = poly_list->pts.ptr;
+
+ for (j=0; j<in_list->ddList->numPoints; j++) {
+
+ /* Update pt_list to point to next point */
+
+ pt_list.ptr += pt_size;
+
+ /* Test for containment within the pick aperture */
+
+ if ((pt_list.p2DSpt->x > -1) &&
+ (pt_list.p2DSpt->x < 1) &&
+ (pt_list.p2DSpt->y > -1) &&
+ (pt_list.p2DSpt->y < 1))
+
+ /* This point is fully within the pick aperture. */
+ /* No need to test further. Just detect PICK. */
+
+ return (Success);
+ }
+ }
+
+ /* We have a degenerate polygon. Test further to determine if the */
+ /* pick aperture is fully or partially enclosed by the polygon. */
+
+ /* Initialize the vertical and horizontal edge counters */
+
+ vcount = hcount = 0;
+
+ /* Set up a loop for testing edges and counting vertical edges */
+ /* and horizontal edges. */
+
+ poly_list = in_list->ddList; /* Initialize poly list pointer */
+
+ for (i=0; i<in_list->numLists; i++, poly_list++) { /* Do for all Polys */
+
+ /* Get the pointer to the next points list */
+
+ pt_list.ptr = poly_list->pts.ptr;
+
+ for (j=0; j<in_list->ddList->numPoints-1; j++) { /* Do for all edges */
+
+ /* Get the first vertex of current edge */
+
+ v1.x = pt_list.p2DSpt->x;
+ v1.y = pt_list.p2DSpt->y;
+
+ /* Update pt_list to point to next point */
+
+ pt_list.ptr += pt_size;
+
+ /* Get the next vertex of current edge */
+
+ v2.x = pt_list.p2DSpt->x;
+ v2.y = pt_list.p2DSpt->y;
+
+ /* Test the edge type and update the vcount and the hcount */
+
+ if (MI_NEAR_ZERO(v1.x-v2.x))
+ x_same = 1;
+ else
+ x_same = 0;
+
+ if (MI_NEAR_ZERO(v1.y-v2.y))
+ y_same = 1;
+ else
+ y_same = 0;
+
+ if ((x_same)&&(v1.x > 0))
+ /* Edge is parallel to Y axis AND is to the right */
+ /* of the center of pick aperture; Increment vcount*/
+
+ vcount++;
+
+ if ((y_same)&&(v1.y > 0))
+ /* Edge is parallel to X axis AND is to the top of */
+ /* the center of pick aperture; Increment the hcount*/
+
+ hcount++;
+
+ } /* Loop for all edges of current polygon */
+
+ /* Test if vcount = odd; if so, detect PICK */
+
+ if (vcount%2) {
+ return (Success);
+ }
+ else {
+
+ /* Else, if vcount == 0, test if hcount = odd; */
+ /* if so, detect PICK. */
+
+ if ((vcount == 0)&&(hcount%2)) return (Success);
+ }
+
+ continue; /* Try the next polygon for containment test */
+
+ } /* Loop for all polygons */
+
+ return (-1); /* Return negative to indicate NO_PICK */
+}
+
+
+/*++
+ |
+ | Function Name: miPick1FillArea
+ |
+ | Function Description:
+ | Handles the level 1 picking of FillArea OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPick1FillArea(pRend, pddc, input_list, input_facet, shape, noedges)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ miListHeader *input_list;
+ listofddFacet *input_facet;
+ ddBitmaskShort shape;
+ ddUCHAR noedges;
+/* out */
+{
+/* calls */
+
+ /* Check for successful polygon pick */
+
+ if (CheckFAreaPick1 (input_list) == Success) {
+ pddc->Static.pick.status = PEXOk;
+ }
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miPick1TriStrip
+ |
+ | Function Description:
+ | Handles the level 1 picking of Triangle Strip OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPick1TriStrip(pRend, pddc, input_list, input_facet)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ miListHeader *input_list;
+ listofddFacet *input_facet;
+/* out */
+{
+/* calls */
+
+ /* Check for successful triangle strip pick. */
+ /* Note that clipper for triangle strips will*/
+ /* NOT generate dengenerate cases and hence */
+ /* any remaining vertices will constitute a */
+ /* Pick situation. */
+
+ if ((input_list->numLists) > 0) {
+ pddc->Static.pick.status = PEXOk;
+ }
+ return (Success);
+}
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndFArea.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndFArea.c
new file mode 100644
index 000000000..bbd9be537
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndFArea.c
@@ -0,0 +1,526 @@
+/* $TOG: miRndFArea.c /main/6 1998/02/10 12:40:05 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#define NEED_EVENTS
+#include "miRender.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+
+
+/*++
+ |
+ | Function Name: miRenderFillArea
+ |
+ | Function Description:
+ | Renders fill areas to the screen
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRenderFillArea(pRend, pddc, input_list, input_facet, shape, noedges)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *input_list; /* fill area data */
+ listofddFacet *input_facet; /* per facet data */
+ ddBitmaskShort shape; /* shape hint */
+ ddUCHAR noedges; /*ignore edges flag*/
+/* out */
+{
+
+/* calls */
+ ddpex3rtn miDDC_to_GC_fill_area();
+ ddpex3rtn miCopyPath();
+ ddpex3rtn miFilterPath();
+ ddpex3rtn miRemoveInvisibleEdges();
+
+
+/* Local variable definitions */
+ ddPointUnion in_pt;
+ ddFacetUnion out_fct;
+ listofddPoint *pddlist;
+ listofddFacet *fct_list;
+ miListHeader *copy_list;
+ miListHeader *temp_list;
+ GCPtr pGC;
+ int point_size, facet_size;
+ int num_points;
+ ddULONG colourindex;
+ ddColourSpecifier intcolour;
+ miColourEntry *pintcolour;
+ int j, k;
+ ddpex3rtn err = Success;
+ ddUSHORT status = 0;
+
+
+ /*
+ * ddx trashes the input data by adding window offsets.
+ * Thus, if the data is going to be re-used for rendering
+ * of edges, it must be saved :-(.
+ */
+ if ((pddc->Static.attrs->edges != PEXOff) &&
+ (!noedges) &&
+ (pddc->Static.attrs->intStyle != PEXInteriorStyleEmpty))
+ miCopyPath(pddc, input_list, &copy_list, 0);
+ else copy_list = input_list;
+
+ /*
+ * Update the fill area GC to reflect the current
+ * fill area attributes
+ */
+ pGC = pddc->Static.misc.pFillAreaGC;
+ if (pddc->Static.misc.flags & FILLAREAGCFLAG)
+ miDDC_to_GC_fill_area(pRend, pddc, pGC);
+
+ /*
+ * Render that path.
+ */
+ switch (pddc->Static.attrs->intStyle) {
+
+ case PEXInteriorStyleHollow:
+ {
+ /*
+ * The final fill area color is determined by a hierarchy
+ * of sources. The first source is the by vertex colors.
+ * If the data has vertex colors, then the final color
+ * is an average of the vertex colors. If there are no
+ * vertex colors, then the fill area is set to the facet
+ * color for the current facet. IF there are no facet colors,
+ * then the color is determined by the surface color attribute.
+ */
+
+ if ( (DD_IsVertColour(input_list->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+ /*
+ * If vertex colors, simply create a facet list.
+ */
+ DDFacetSIZE(DD_FACET_RGBFLOAT, facet_size);
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = DD_FACET_RGBFLOAT;
+ MI_ALLOCLISTOFDDFACET(fct_list, 1, facet_size);
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = fct_list->facets;
+ DD_VertPointSize(input_list->type, point_size);
+ point_size -= sizeof(ddCoord2DS);
+
+ out_fct.pFacetRgbFloat->red = 0.0;
+ out_fct.pFacetRgbFloat->green = 0.0;
+ out_fct.pFacetRgbFloat->blue = 0.0;
+ num_points = 0;
+
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+
+ in_pt = pddlist->pts;
+
+ /* Compute average facet color. Note that we exclude */
+ /* the last point from the average, since it is the */
+ /* same as the first point */
+ for (k = 1; k < pddlist->numPoints; k++) {
+ in_pt.p2DSpt++; /* skip coord data */
+ out_fct.pFacetRgbFloat->red
+ += in_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += in_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += in_pt.pRgbFloatClr->blue;
+ in_pt.ptr += point_size; /* skip color and normal */
+ num_points++;
+ }
+ }
+
+ /* complete average */
+ if (num_points > 0) {
+ out_fct.pFacetRgbFloat->red /= num_points;
+ out_fct.pFacetRgbFloat->green /= num_points;
+ out_fct.pFacetRgbFloat->blue /= num_points;
+ }
+ /* clamp on saturation */
+ if (out_fct.pFacetRgbFloat->red > 1.0)
+ out_fct.pFacetRgbFloat->red = 1.0;
+ if (out_fct.pFacetRgbFloat->green > 1.0)
+ out_fct.pFacetRgbFloat->green = 1.0;
+ if (out_fct.pFacetRgbFloat->blue > 1.0)
+ out_fct.pFacetRgbFloat->blue = 1.0;
+
+ /* new facet colors override input ones */
+ fct_list->numFacets = 1;
+ input_facet = fct_list;
+ }
+
+ /* Remove all data from vertex data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ if (err = miFilterPath(pddc, input_list, &temp_list, 1))
+ return(err);
+ input_list = temp_list;
+ }
+
+ if ( (input_facet) &&
+ (input_facet->numFacets > 0) &&
+ (DD_IsFacetColour(input_facet->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+
+ /* Compute index value for ddx */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour.colourType = PEXRgbFloatColour;
+ intcolour.colour.rgbFloat = *input_facet->facets.pFacetRgbFloat;
+ }
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render each bound as a polyline */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+
+ if (pddlist->numPoints > 0) {
+
+ /* Call ddx to render the polygon */
+ (*GetGCValue(pGC, ops->Polylines))
+ (pRend->pDrawable,
+ pGC,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+ }
+ }
+
+ else {
+
+ /*
+ * If no vertex or facet colors, use surface attributes.
+ * Surface attributes are set to highlight colour
+ * if highlighting
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else
+ intcolour = pddc->Static.attrs->surfaceColour;
+
+ miColourtoIndex( pRend,
+ pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render each bound as a polyline */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++)
+ if (pddlist->numPoints > 0)
+ /* Call ddx to render the polygon */
+ (*GetGCValue(pGC, ops->Polylines))
+ (pRend->pDrawable,
+ pGC,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+ break;
+ }
+
+ /* Note that patterns and hatching are currently not implemented */
+ case PEXInteriorStylePattern:
+ case PEXInteriorStyleHatch:
+ case PEXInteriorStyleSolid:
+ {
+ /*
+ * The final fill area color is determined by a hierarchy
+ * of sources. The first source is the by vertex colors.
+ * If the data has vertex colors, then the final color
+ * is an average of the vertex colors. If there are no
+ * vertex colors, then the fill area is set to the facet
+ * color for the current facet. IF there are no facet colors,
+ * then the color is determined by the surface color attribute.
+ */
+
+ if ( (DD_IsVertColour(input_list->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+ /*
+ * If vertex colors, simply create a facet list.
+ */
+ DDFacetSIZE(DD_FACET_RGBFLOAT, facet_size);
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = DD_FACET_RGBFLOAT;
+ MI_ALLOCLISTOFDDFACET(fct_list, 1, facet_size);
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = fct_list->facets;
+ DD_VertPointSize(input_list->type, point_size);
+ point_size -= sizeof(ddCoord2DS);
+
+ out_fct.pFacetRgbFloat->red = 0.0;
+ out_fct.pFacetRgbFloat->green = 0.0;
+ out_fct.pFacetRgbFloat->blue = 0.0;
+ num_points = 0;
+
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+
+ in_pt = pddlist->pts;
+
+ /* Compute average facet color. Note that we exclude */
+ /* the last point from the average, since it is the */
+ /* same as the first point */
+ for (k = 1; k < pddlist->numPoints; k++) {
+ in_pt.p2DSpt++; /* skip coord data */
+ out_fct.pFacetRgbFloat->red
+ += in_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += in_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += in_pt.pRgbFloatClr->blue;
+ in_pt.ptr += point_size; /* skip color and normal */
+ num_points++;
+ }
+ }
+
+ /* complete average */
+ if (num_points > 0) {
+ out_fct.pFacetRgbFloat->red /= num_points;
+ out_fct.pFacetRgbFloat->green /= num_points;
+ out_fct.pFacetRgbFloat->blue /= num_points;
+ }
+ /* clamp on saturation */
+ if (out_fct.pFacetRgbFloat->red > 1.0)
+ out_fct.pFacetRgbFloat->red = 1.0;
+ if (out_fct.pFacetRgbFloat->green > 1.0)
+ out_fct.pFacetRgbFloat->green = 1.0;
+ if (out_fct.pFacetRgbFloat->blue > 1.0)
+ out_fct.pFacetRgbFloat->blue = 1.0;
+
+ /* new facet colors override input ones */
+ fct_list->numFacets = 1;
+ input_facet = fct_list;
+ }
+
+ /* Remove all data from vertex data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ if (err = miFilterPath(pddc, input_list, &temp_list, 1))
+ return(err);
+ input_list = temp_list;
+ }
+
+ if ( (input_facet) &&
+ (input_facet->numFacets > 0) &&
+ (DD_IsFacetColour(input_facet->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+
+ /* Compute index value for ddx */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour.colourType = PEXRgbFloatColour;
+ intcolour.colour.rgbFloat = *input_facet->facets.pFacetRgbFloat;
+ }
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render the polygon. */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+
+ if (pddlist->numPoints > 0) {
+
+ /* Call ddx to render the polygon */
+ (*GetGCValue(pGC, ops->FillPolygon))
+ (pRend->pDrawable,
+ pGC,
+ shape != PEXUnknownShape ? shape : PEXComplex,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+ }
+ }
+
+ else {
+
+ /*
+ * If no vertex or facet colors, use surface attributes.
+ * Surface attributes are set to highlight colour
+ * if highlighting
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else
+ intcolour = pddc->Static.attrs->surfaceColour;
+
+ miColourtoIndex( pRend,
+ pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render each bound as a polyline */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++)
+ if (pddlist->numPoints > 0)
+ /* Call ddx to render the polygon */
+ (*GetGCValue(pGC, ops->FillPolygon))
+ (pRend->pDrawable,
+ pGC,
+ shape != PEXUnknownShape ? shape : PEXComplex,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+ break;
+ }
+
+ case PEXInteriorStyleEmpty:
+ break;
+ }
+
+ /*
+ * Now check to see if fill area edges are to be drawn
+ */
+ if ((pddc->Static.attrs->edges != PEXOff) && (!noedges)) {
+
+ /* If edge flags, remove invisible edges */
+ if (DD_IsVertEdge(copy_list->type))
+ miRemoveInvisibleEdges(pddc, copy_list, &input_list);
+ else input_list = copy_list;
+
+ /* Remove all data from vertex data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ if (err = miFilterPath(pddc, input_list, &copy_list, 1))
+ return(err);
+ input_list = copy_list;
+ }
+
+ /*
+ * Update the fill area GC to reflect the current
+ * fill area attributes
+ */
+ if (pddc->Static.misc.flags & EDGEGCFLAG)
+ miDDC_to_GC_edges(pRend, pddc, pddc->Static.misc.pEdgeGC);
+
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pEdgeGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pEdgeGC);
+
+ /* Render each bound as a polyline */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++)
+ if (pddlist->numPoints > 0)
+ /* Call ddx to render the polygon */
+ (*GetGCValue(pddc->Static.misc.pEdgeGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pEdgeGC,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+
+ return(Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndMarkr.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndMarkr.c
new file mode 100644
index 000000000..013bdd38d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndMarkr.c
@@ -0,0 +1,276 @@
+/* $TOG: miRndMarkr.c /main/7 1998/02/10 12:40:10 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndMarkr.c,v 3.6 1998/10/04 09:34:12 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "miRender.h"
+#include "Xprotostr.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miMarkers.h"
+#include "pexos.h"
+
+#define FULL_CIRCLE 360*64
+
+
+/*++
+ |
+ | Function Name: miRenderMarker
+ |
+ | Function Description:
+ | Renders Polylines to the screen.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRenderMarker(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *input_list; /* fill area data */
+{
+/* calls */
+ ddpex3rtn miTransform();
+ ddpex3rtn miClipPointList();
+
+/* Local variable definitions */
+ miListHeader *temp_list;
+ miListHeader save_list;
+ int i, j, k;
+ miListHeader *input_marker_list, *xformed_marker;
+ listofddPoint *pddlist1, *pddlist2;
+ float marker_trans[4][4];
+ ddCoord2DS *in_pt;
+ ddpex3rtn status;
+
+
+ /* Remove all data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ status = miFilterPath(pddc, input_list, &temp_list, 0);
+ if (status) return(status);
+ input_list = temp_list;
+ }
+
+ /*
+ * Update the marker GC to reflect the current
+ * marker attributes
+ */
+ if (pddc->Static.misc.flags & MARKERGCFLAG)
+ miDDC_to_GC_marker(pRend, pddc, pddc->Static.misc.pPolyMarkerGC);
+
+ /*
+ * Now render the appropriate marker
+ */
+ switch (pddc->Static.attrs->markerType) {
+
+ case PEXMarkerDot:
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pPolyMarkerGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolyMarkerGC);
+
+ /*
+ * Render a pixel at each marker position
+ */
+ for (j = 0, pddlist1 = input_list->ddList;
+ j < input_list->numLists; j++, pddlist1++)
+ if (pddlist1->numPoints > 0)
+ /* Call ddx to render the polylines */
+ (*GetGCValue(pddc->Static.misc.pPolyMarkerGC, ops->PolyPoint))
+ (pRend->pDrawable,
+ pddc->Static.misc.pPolyMarkerGC,
+ CoordModeOrigin,
+ pddlist1->numPoints,
+ pddlist1->pts.p2DSpt);
+ break;
+
+ case PEXMarkerCross:
+ /* new path contains the default marker description to render */
+ input_marker_list = &cross_header;
+ goto render_marker;
+
+ case PEXMarkerAsterisk:
+ /* new path contains the default marker description to render */
+ input_marker_list = &asterisk_header;
+ goto render_marker;
+
+ case PEXMarkerCircle:
+ {
+ xArc *parcs=0, /* ddx polyarc input structure */
+ *pcurarcs;
+
+ /*
+ * Draw a circle for each position in the PolyMarker list.
+ */
+ for (i = 0, pddlist1 = input_list->ddList;
+ i < input_list->numLists; i++, pddlist1++) {
+ /*
+ * Ensure enough arc structures
+ */
+ if (parcs)
+ pcurarcs = parcs =
+ (xArc *)xrealloc(parcs,sizeof(xArc)*pddlist1->numPoints);
+ else pcurarcs = parcs =
+ (xArc *)xalloc(sizeof(xArc)*pddlist1->numPoints);
+
+ in_pt = pddlist1->pts.p2DSpt;
+
+ /* Create an arc structure for every PolyMarker point */
+ for (j = 0; j < pddlist1->numPoints; j++) {
+ pcurarcs->x = in_pt->x
+ - (ddUSHORT)pddc->Static.attrs->markerScale;
+ pcurarcs->y = (in_pt++)->y
+ - (ddUSHORT)pddc->Static.attrs->markerScale;
+ pcurarcs->width = (ddUSHORT)(pddc->Static.attrs->markerScale*2);
+ pcurarcs->height = pcurarcs->width;
+ pcurarcs->angle1 = 0;
+ (pcurarcs++)->angle2 = FULL_CIRCLE;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pPolyMarkerGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolyMarkerGC);
+
+ /* Call ddx to render a circle */
+ (*GetGCValue(pddc->Static.misc.pPolyMarkerGC, ops->PolyArc))
+ (pRend->pDrawable,
+ pddc->Static.misc.pPolyMarkerGC,
+ pddlist1->numPoints,
+ parcs);
+ }
+
+ /* free temporary resources */
+ if (parcs) xfree(parcs);
+
+ }
+ break;
+
+ case PEXMarkerX:
+ /* new path contains the default marker description to render */
+ input_marker_list = &X_header;
+
+render_marker:
+ /*
+ * marker_trans contains the transformation to transform
+ * the unit marker default specification to the final
+ * screen size/position. The scale factor used in x and y
+ * is the PC makerScale, while the translation is provided
+ * by the (now DC) marker position specified in the input
+ * vertex list.
+ */
+ memcpy( (char *) marker_trans,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ marker_trans[0][0] = pddc->Static.attrs->markerScale;
+ marker_trans[1][1] = pddc->Static.attrs->markerScale;
+
+ /*
+ * the transform routine automatically" selects the
+ * output data area. In order to not overwrite the
+ * polymarker data, the list header is copied to
+ * a temporary area. Note that the maxLists field
+ * associated with the old list is zeroed so that
+ * new data will be alloc'ed on the next transform.
+ */
+ save_list = *input_list;
+ input_list->maxLists = 0;
+
+ /*
+ * Draw a marker for each position in the PolyMarker list.
+ */
+ for (i = 0, pddlist1 = save_list.ddList;
+ i < save_list.numLists; i++, pddlist1++) {
+
+ in_pt = pddlist1->pts.p2DSpt;
+
+ /* for every PolyMarker point */
+ for (j = 0; j < pddlist1->numPoints; j++) {
+
+ /* Transform marker description into screen coords */
+ marker_trans[0][3] = (float)in_pt->x;
+ marker_trans[1][3] = (float)(in_pt++)->y;
+ if (status = miTransform(pddc,
+ input_marker_list, &xformed_marker,
+ marker_trans,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pPolyMarkerGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolyMarkerGC);
+
+ /* We should have DC paths here; Render them */
+ for (k = 0, pddlist2 = xformed_marker->ddList;
+ k < xformed_marker->numLists; k++, pddlist2++)
+ if (pddlist2->numPoints > 0)
+ /* Call ddx to render the polylines */
+ (*GetGCValue(pddc->Static.misc.pPolyMarkerGC,ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pPolyMarkerGC,
+ CoordModeOrigin,
+ pddlist2->numPoints,
+ pddlist2->pts.p2DSpt);
+ }
+ }
+ MI_FREELISTHEADER(&save_list);
+ break;
+
+ default:
+ break;
+ }
+
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndPLine.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndPLine.c
new file mode 100644
index 000000000..2bdcce576
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndPLine.c
@@ -0,0 +1,183 @@
+/* $TOG: miRndPLine.c /main/3 1998/02/10 12:40:15 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#define NEED_EVENTS
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+
+
+/*++
+ |
+ | Function Name: miRenderPolyLine
+ |
+ | Function Description:
+ | Renders Polylines to the screen.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRenderPolyLine(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *input_list; /* fill area data */
+{
+/* calls */
+ ddpex3rtn miFilterPath();
+ ddpex3rtn miClipPolyLines();
+
+/* Local variable definitions */
+ listofddPoint *pddlist;
+ ddPointUnion pt;
+ ddCoord2DS line[2];
+ GCPtr pGC;
+ ddULONG colourindex;
+ ddColourSpecifier intcolour;
+ int j;
+ int count;
+
+ /*
+ * Update the fill area GC to reflect the current
+ * polyline attributes
+ */
+ if (pddc->Static.misc.flags & POLYLINEGCFLAG)
+ miDDC_to_GC_polyline(pRend, pddc, pddc->Static.misc.pPolylineGC);
+
+ /* Polyline with Data ? */
+ if (!DD_IsVertColour(input_list->type))
+ {
+
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pPolylineGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolylineGC);
+
+ /* We should have DC paths here; Render them */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+ if (pddlist->numPoints > 0) {
+
+ /* Call ddx to render the polylines */
+ (*GetGCValue(pddc->Static.misc.pPolylineGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pPolylineGC,
+ CoordModeOrigin,
+ pddlist->numPoints,
+ pddlist->pts.p2DSpt);
+ }
+ }
+ }
+ else
+ {
+ pGC = pddc->Static.misc.pPolylineGC;
+
+ intcolour.colourType = PEXRgbFloatColour;
+
+ /* Render each bound as a polyline */
+ for (j = 0, pddlist = input_list->ddList;
+ j < input_list->numLists; j++, pddlist++) {
+
+ if ((count = pddlist->numPoints) <= 1) continue;
+
+ pt = pddlist->pts;
+
+ /* Each polyline segment has a (potentially) different color */
+ while (--count) {
+
+ /* Compute index value for ddx */
+ line[0] = *(pt.p2DSpt++);
+ /* Use first vertex color for line color if no interpolation
+ * Use line color attribute if highlighting.
+ */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc))
+ intcolour.colour.rgbFloat = *(pt.pRgbFloatClr++);
+ else {
+ intcolour.colour.rgbFloat =
+ pddc->Static.attrs->lineColour.colour.rgbFloat;
+ pt.pRgbFloatClr++;
+ }
+ /* Note, can't have any other per-vertex data other than color */
+ line[1] = *pt.p2DSpt;
+
+ miColourtoIndex( pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Call ddx to render the polyline */
+ (*GetGCValue(pGC, ops->Polylines))
+ (pRend->pDrawable,
+ pGC,
+ CoordModeOrigin,
+ 2,
+ line);
+ }
+ }
+ }
+
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndTStrip.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndTStrip.c
new file mode 100644
index 000000000..67425a7f1
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndTStrip.c
@@ -0,0 +1,740 @@
+/* $TOG: miRndTStrip.c /main/4 1998/02/10 12:40:21 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#define NEED_EVENTS
+#include "miRender.h"
+#include "miClip.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+
+
+/*++
+ |
+ | Function Name: miRenderTriStrip
+ |
+ | Function Description:
+ | Renders a triangle strip to a drawable
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRenderTriStrip(pRend, pddc, input_list, input_facet)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *input_list; /* triangle strip vertex data */
+ listofddFacet *input_facet; /* per facet data */
+{
+
+
+/* calls */
+ ddpex3rtn miDDC_to_GC_fill_area();
+ ddpex3rtn miCopyPath();
+ ddpex3rtn miFilterPath();
+ ddpex3rtn miCloseFillArea();
+ ddpex3rtn miRemoveInvisibleEdges();
+
+
+/* Local variable definitions */
+ ddPointUnion in_pt, tmp_pt;
+ ddFacetUnion out_fct;
+ listofddPoint *pddlist;
+ listofddFacet *fct_list;
+ miListHeader *edge_copy;
+ miListHeader *temp_list;
+ GCPtr pGC;
+ int point_size, facet_size, num_facets,
+ color_offset, edge_offset;
+ ddULONG colourindex;
+ ddColourSpecifier intcolour;
+ miColourEntry *pintcolour;
+ ddCoord2DS output_array[4];
+ int i, j, k;
+ ddpex3rtn err = Success;
+ ddUSHORT status = 0;
+
+ /* remember that ALL vertex types are of the form:
+ *
+ * |---------------------------|---------|----------|---------|
+ * coords color normal edge
+ * (opt) (opt) (opt)
+ */
+
+
+
+ if (input_list->numLists == 0) return(1);
+
+ else {
+ /*
+ * ddx trashes the input data by adding window offsets.
+ * Thus, if the data is going to be re-used for rendering
+ * of edges, it must be saved :-(.
+ */
+
+ if (pddc->Static.attrs->edges != PEXOff)
+ miCopyPath(pddc, input_list, &edge_copy, 0);
+
+ /*
+ * Update the fill area GC to reflect the current
+ * fill area attributes
+ */
+ pGC = pddc->Static.misc.pFillAreaGC;
+ if (pddc->Static.misc.flags & FILLAREAGCFLAG)
+ miDDC_to_GC_fill_area(pRend, pddc, pddc->Static.misc.pFillAreaGC);
+
+ /*
+ * Render appropriately. One can assume that facets have been
+ * pre-computed if we need facet data.
+ */
+
+ switch (pddc->Static.attrs->intStyle) {
+
+ case PEXInteriorStyleHollow:
+
+ /* At this point, for a fully implemented level1, there would
+ * be another "switch" statement here that would select between
+ * interpolation methods. This switch would exist also exist
+ * for the "solid" fill styles as well. We have, for now,
+ * only implemented InterpNone (flat shading)
+ */
+
+ {
+ /*
+ * The final fill area color is determined by a hierarchy
+ * of sources. The first source is the vertex colors.
+ * If the data has vertex colors, then the final color
+ * is an average of the vertex colors. If there are no
+ * vertex colors, then the facet is set to the
+ * color for the current facet. IF there are no facet colors,
+ * then the color is determined by the surface color attribute.
+ * If highlighting is on, then the color is determined by
+ * the surface color attribute which has been set to the
+ * highlight color
+ */
+
+ if ( (DD_IsVertColour(input_list->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+ /*
+ * If vertex colors, simply create a facet list.
+ */
+ DDFacetSIZE(DD_FACET_RGBFLOAT, facet_size);
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = DD_FACET_RGBFLOAT;
+
+
+ MI_ALLOCLISTOFDDFACET(fct_list, input_facet->numFacets, facet_size);
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = fct_list->facets;
+ DD_VertPointSize(input_list->type, point_size);
+ DD_VertOffsetColor(input_list->type, color_offset);
+
+ for(i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+ in_pt = pddlist->pts;
+ in_pt.ptr += color_offset; /* skip coord data */
+
+ /* Compute average facet color */
+ for (k = 2; k < (pddlist->numPoints); k++) {
+ out_fct.pFacetRgbFloat->red = 0.0;
+ out_fct.pFacetRgbFloat->green = 0.0;
+ out_fct.pFacetRgbFloat->blue = 0.0;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ out_fct.pFacetRgbFloat->red
+ += in_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += in_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += in_pt.pRgbFloatClr->blue;
+
+ out_fct.pFacetRgbFloat->red
+ += tmp_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += tmp_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += tmp_pt.pRgbFloatClr->blue;
+ tmp_pt.ptr += point_size;
+ out_fct.pFacetRgbFloat->red
+ += tmp_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += tmp_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += tmp_pt.pRgbFloatClr->blue;
+
+ if (pddlist->numPoints > 2) {
+ out_fct.pFacetRgbFloat->red /= 3;
+ out_fct.pFacetRgbFloat->green /= 3;
+ out_fct.pFacetRgbFloat->blue /= 3;
+ }
+ /* clamp on saturation */
+ if (out_fct.pFacetRgbFloat->red > 1.0)
+ out_fct.pFacetRgbFloat->red = 1.0;
+ if (out_fct.pFacetRgbFloat->green > 1.0)
+ out_fct.pFacetRgbFloat->green = 1.0;
+ if (out_fct.pFacetRgbFloat->blue > 1.0)
+ out_fct.pFacetRgbFloat->blue = 1.0;
+
+
+ in_pt.ptr += point_size; /* skip to next point */
+ out_fct.pFacetRgbFloat++;
+ fct_list->numFacets++;
+ }
+ ++pddlist;
+ }
+ /* new facet colors override input ones */
+ input_facet = fct_list;
+ }
+
+ /* Remove all data from vertex data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ if (err = miFilterPath(pddc, input_list, &temp_list, 1))
+ return(err);
+ input_list = temp_list;
+ }
+
+ if ( (input_facet) &&
+ (input_facet->numFacets > 0) &&
+ (DD_IsFacetColour(input_facet->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+
+ pGC = pddc->Static.misc.pFillAreaGC;
+ out_fct = input_facet->facets;
+ DDFacetSIZE(input_facet->type, facet_size);
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour.colourType = PEXRgbFloatColour;
+ intcolour.colour.rgbFloat = *out_fct.pFacetRgbFloat;
+ }
+ miColourtoIndex( pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ }
+
+ else {
+
+ /*
+ * If no vertex or facet colors, use surface attributes.
+ * If highlighting is on, then the color is determined by
+ * the surface color attribute which has been set to the
+ * highlight color
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour = pddc->Static.attrs->surfaceColour;
+ }
+
+ miColourtoIndex( pRend,
+ pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+ }
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render each bound as a polyline.
+ * Note - Additional functionality should be able
+ * to distinguesh between "real" and degenerate facets
+ * (produced by clipping) by some internal mechanism,
+ * possibly more bits in the edge flags, and NOT
+ * draw the boundaries for degenerate facets here.
+ */
+
+ DD_VertPointSize(input_list->type, point_size);
+
+ for(i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+
+ for (j = 2, in_pt.ptr = pddlist->pts.ptr;
+ j < pddlist->numPoints; j++) {
+
+ output_array[0] = *in_pt.p2DSpt;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ output_array[1] = *tmp_pt.p2DSpt;
+
+ tmp_pt.ptr += point_size;
+
+ output_array[2] = *tmp_pt.p2DSpt;
+
+ output_array[3] = *in_pt.p2DSpt;
+
+ /* Call ddx to fill polygon */
+ (*GetGCValue
+ (pddc->Static.misc.pFillAreaGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pFillAreaGC,
+ CoordModeOrigin,
+ 4,
+ output_array);
+
+ in_pt.ptr += point_size;
+
+ if ( (input_facet) &&
+ (input_facet->numFacets > 0) &&
+ (DD_IsFacetColour(input_facet->type)) ) {
+ out_fct.pNoFacet += facet_size;
+
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour.colourType = PEXRgbFloatColour;
+ intcolour.colour.rgbFloat = *out_fct.pFacetRgbFloat;
+ }
+ miColourtoIndex( pRend,
+ pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ }
+ }
+ ++pddlist;
+ }
+
+ }
+ break;
+
+ case PEXInteriorStylePattern:
+ case PEXInteriorStyleHatch:
+ case PEXInteriorStyleSolid:
+ {
+ /*
+ * The final facet color is determined by a hierarchy
+ * of sources. The first source is the by vertex colors.
+ * If the data has vertex colors, then the final color
+ * is an average of the vertex colors. If there are no
+ * vertex colors, then the fill area is set to the facet
+ * color for the current facet. IF there are no facet colors,
+ * then the color is determined by the surface color attribute.
+ * If highlighting is on, then the color is determined by
+ * the surface color attribute which has been set to the
+ * highlight color
+ */
+
+ if ( (DD_IsVertColour(input_list->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+ /*
+ * If vertex colors, simply create a facet list.
+ */
+ DDFacetSIZE(DD_FACET_RGBFLOAT, facet_size);
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = DD_FACET_RGBFLOAT;
+
+ /* Determine number of facets */
+ for (i = 0, num_facets = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+ if (pddlist->numPoints > 2)
+ num_facets += (pddlist->numPoints - 2);
+ pddlist++;
+ }
+
+ MI_ALLOCLISTOFDDFACET(fct_list, num_facets, facet_size);
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = fct_list->facets;
+
+ DD_VertPointSize(input_list->type, point_size);
+ DD_VertOffsetColor(input_list->type, color_offset);
+
+ for(i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+ in_pt = pddlist->pts;
+ in_pt.ptr += color_offset; /* skip coord data */
+
+ /* Compute average facet color */
+ for (k = 2; k < (pddlist->numPoints); k++) {
+ out_fct.pFacetRgbFloat->red = 0.0;
+ out_fct.pFacetRgbFloat->green = 0.0;
+ out_fct.pFacetRgbFloat->blue = 0.0;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ out_fct.pFacetRgbFloat->red
+ += in_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += in_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += in_pt.pRgbFloatClr->blue;
+
+ out_fct.pFacetRgbFloat->red
+ += tmp_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += tmp_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += tmp_pt.pRgbFloatClr->blue;
+ tmp_pt.ptr += point_size;
+ out_fct.pFacetRgbFloat->red
+ += tmp_pt.pRgbFloatClr->red;
+ out_fct.pFacetRgbFloat->green
+ += tmp_pt.pRgbFloatClr->green;
+ out_fct.pFacetRgbFloat->blue
+ += tmp_pt.pRgbFloatClr->blue;
+
+ if (pddlist->numPoints > 2) {
+ out_fct.pFacetRgbFloat->red /= 3.0;
+ out_fct.pFacetRgbFloat->green /= 3.0;
+ out_fct.pFacetRgbFloat->blue /= 3.0;
+ }
+ /* clamp on saturation */
+ if (out_fct.pFacetRgbFloat->red > 1.0)
+ out_fct.pFacetRgbFloat->red = 1.0;
+ if (out_fct.pFacetRgbFloat->green > 1.0)
+ out_fct.pFacetRgbFloat->green = 1.0;
+ if (out_fct.pFacetRgbFloat->blue > 1.0)
+ out_fct.pFacetRgbFloat->blue = 1.0;
+
+
+ in_pt.ptr += point_size; /* skip to next point */
+ out_fct.pFacetRgbFloat++;
+ fct_list->numFacets++;
+ }
+ ++pddlist;
+ }
+ /* new facet colors override input ones */
+ input_facet = fct_list;
+
+ }
+
+ /* Remove all data from vertex data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ if (err = miFilterPath(pddc, input_list, &temp_list, 1))
+ return(err);
+ input_list = temp_list;
+ }
+
+ if ( (input_facet) &&
+ (input_facet->numFacets > 0) &&
+ (DD_IsFacetColour(input_facet->type)) &&
+ (!MI_DDC_IS_HIGHLIGHT(pddc)) ) {
+
+ pGC = pddc->Static.misc.pFillAreaGC;
+ out_fct = input_facet->facets;
+ DDFacetSIZE(input_facet->type, facet_size);
+
+
+ /* Render each bound as a polygon */
+
+ DD_VertPointSize(input_list->type, point_size);
+
+ for(i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+
+ for (j = 2, in_pt.ptr = pddlist->pts.ptr;
+ j < pddlist->numPoints; j++) {
+
+ output_array[0] = *in_pt.p2DSpt;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ output_array[1] = *tmp_pt.p2DSpt;
+
+ tmp_pt.ptr += point_size;
+
+ output_array[2] = *tmp_pt.p2DSpt;
+
+ output_array[3] = *in_pt.p2DSpt;
+
+
+ /* Compute index value for ddx */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour.colourType = PEXRgbFloatColour;
+ intcolour.colour.rgbFloat = *out_fct.pFacetRgbFloat;
+ }
+ miColourtoIndex(pRend, pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber != pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Call ddx to fill polygon */
+ (*GetGCValue(pGC, ops->FillPolygon))
+ (pRend->pDrawable,
+ pGC,
+ Convex,
+ CoordModeOrigin,
+ 4,
+ output_array);
+
+
+
+ in_pt.ptr += point_size;
+ out_fct.pNoFacet += facet_size;
+ }
+ pddlist++;
+ }
+ }
+
+ else {
+
+ /*
+ * If no vertex or facet colors, use surface attributes.
+ * If highlighting is on, then the color is determined by
+ * the surface color attribute which has been set to the
+ * highlight color
+ */
+ if (pddc->Static.attrs->echoMode == PEXEcho)
+ intcolour = pddc->Static.attrs->echoColour;
+ else {
+ intcolour = pddc->Static.attrs->surfaceColour;
+ }
+
+ miColourtoIndex( pRend,
+ pddc->Dynamic->pPCAttr->colourApproxIndex,
+ &intcolour, &colourindex);
+
+ /* Only set GC value if necessary */
+ if (colourindex != pGC->fgPixel) {
+ pGC->fgPixel = colourindex;
+ /* Register changes with ddx */
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->stateChanges |= GCForeground;
+ (*pGC->funcs->ChangeGC)(pGC, GCForeground);
+ /* Insure that the GC is reset to proper color next time */
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /* validate GC prior to start of rendering */
+ if (pGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pGC);
+
+ /* Render each bound as a polyline */
+ DD_VertPointSize(input_list->type, point_size);
+
+ for(i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+
+ for (j = 2, in_pt.ptr = pddlist->pts.ptr;
+ j < pddlist->numPoints; j++) {
+
+ output_array[0] = *in_pt.p2DSpt;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ output_array[1] = *tmp_pt.p2DSpt;
+
+ tmp_pt.ptr += point_size;
+
+ output_array[2] = *tmp_pt.p2DSpt;
+
+ output_array[3] = *in_pt.p2DSpt;
+
+ /* Call ddx to fill polygon */
+ (*GetGCValue(pGC, ops->FillPolygon))
+ (pRend->pDrawable,
+ pGC,
+ Convex,
+ CoordModeOrigin,
+ 4,
+ output_array);
+
+ in_pt.ptr += point_size;
+ }
+ pddlist++;
+ }
+
+
+ break;
+ }
+ }
+
+ case PEXInteriorStyleEmpty:
+ break;
+
+ } /*End of area rendering */
+
+ /*
+ * Now check to see if fill area edges are to be drawn
+ */
+ if (pddc->Static.attrs->edges != PEXOff) {
+
+ input_list = edge_copy;
+
+ DD_VertPointSize(input_list->type, point_size);
+ DD_VertOffsetEdge(input_list->type, edge_offset);
+
+ /*
+ * Update the fill area GC to reflect the current
+ * fill area attributes
+ */
+ if (pddc->Static.misc.flags & EDGEGCFLAG)
+ miDDC_to_GC_edges(pRend, pddc, pddc->Static.misc.pEdgeGC);
+
+ /* validate GC prior to start of rendering */
+ if (pddc->Static.misc.pEdgeGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pEdgeGC);
+
+
+ for (i = 0, pddlist = input_list->ddList;
+ i < input_list->numLists; i++) {
+
+
+ /* Render each bound as a polyline */
+
+ /*
+ * Within an edge flag, there are two bits determining edge
+ * visibility. Bit zero determines whether an edge is drawn
+ * between the current vertex N and vertex N-2, while bit one
+ * determines if an edge is drawn between edge N and N+1.
+ * If N-2 < 0 or N+1 > numfacets the edge is not drawn.
+ *
+ * 2_________ _4
+ * /\ /|\
+ * / \ / \
+ * / \ / \
+ * / \ / \
+ * 1<--------+3+---------5
+ *
+ * So, for the third element in the edge list,
+ * bit 0 indicates presence of an edge from 3 -> 4
+ * (forward edge)
+ * bit 1 indicates presence of an edge from 3 -> 1
+ * (backward edge)
+ *
+ */
+
+
+ for (j = 0, in_pt.ptr = pddlist->pts.ptr;
+ j < pddlist->numPoints; j++) {
+
+ if((j+1) < pddlist->numPoints){
+ if(FWD_EDGE_FLAG & *(in_pt.ptr + edge_offset)) {
+
+ output_array[0] = *in_pt.p2DSpt;
+
+ tmp_pt.ptr = in_pt.ptr + point_size;
+
+ output_array[1] = *tmp_pt.p2DSpt;
+
+ (*GetGCValue(pddc->Static.misc.pEdgeGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pEdgeGC,
+ CoordModeOrigin,
+ 2,
+ output_array);
+ }
+ }
+ if (j > 1){
+ if(BKWD_EDGE_FLAG & *(in_pt.ptr + edge_offset)) {
+
+ output_array[0] = *in_pt.p2DSpt;
+
+ tmp_pt.ptr = in_pt.ptr - (2 * point_size);
+
+ output_array[1] = *tmp_pt.p2DSpt;
+
+ (*GetGCValue(pddc->Static.misc.pEdgeGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pEdgeGC,
+ CoordModeOrigin,
+ 2,
+ output_array);
+
+ }
+ }
+ in_pt.ptr += point_size;
+ }
+ ++pddlist;
+ }
+ }
+
+ return (Success);
+ }
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndText.c b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndText.c
new file mode 100644
index 000000000..0ed05fcee
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndText.c
@@ -0,0 +1,122 @@
+/* $TOG: miRndText.c /main/3 1998/02/10 12:40:27 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level1/miRndText.c,v 3.5 1998/10/04 09:34:13 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "miRender.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+
+
+/*++
+ |
+ | Function Name: miRenderText
+ |
+ | Function Description:
+ | Renders Text to the screen.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRenderText(pRend, pddc, input_list)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+ miListHeader *input_list; /* fill area data */
+{
+/* calls */
+ ddpex3rtn miFilterPath();
+
+/* Local variable definitions */
+ miListHeader *temp_list;
+ listofddPoint *sp;
+ int j;
+ ddpex3rtn err = Success;
+
+ /* Remove all data but vertex coordinates */
+ if ((DD_IsVertNormal(input_list->type)) ||
+ (DD_IsVertEdge(input_list->type)) ||
+ (DD_IsVertColour(input_list->type)) ) {
+ err = miFilterPath(pddc, input_list, &temp_list, 1);
+ if (err) return (err);
+ input_list = temp_list;
+ }
+
+ /*
+ * Update the text GC to reflect the current
+ * text attributes
+ */
+ if (pddc->Static.misc.flags & TEXTGCFLAG)
+ miDDC_to_GC_text(pRend, pddc, pddc->Static.misc.pTextGC);
+
+ /* Validate GC prior to start of rendering */
+
+ if (pddc->Static.misc.pTextGC->serialNumber !=
+ pRend->pDrawable->serialNumber)
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pTextGC);
+
+ /* We should have DC paths here; Render them */
+
+ for (j = 0, sp = input_list->ddList;
+ j < input_list->numLists; j++, sp++) {
+ if (sp->numPoints > 0) {
+
+ /* Call ddx to render the polylines */
+ (*GetGCValue(pddc->Static.misc.pTextGC, ops->Polylines))
+ (pRend->pDrawable,
+ pddc->Static.misc.pTextGC,
+ CoordModeOrigin,
+ sp->numPoints,
+ sp->pts.p2DSpt);
+ }
+ }
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/level2/Imakefile
new file mode 100644
index 000000000..b9ed7c86c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/Imakefile
@@ -0,0 +1,117 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/8 1996/09/28 16:54:14 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/Imakefile,v 3.9 1999/04/17 09:08:16 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDdpexCDebugFlags
+#define PexDdpexCDebugFlags ServerCDebugFlags
+#endif
+
+XCOMM -D defines for ddpex:
+XCOMM DDTEST turns on some fprintf(stderr...)s for debugging
+
+ DEFINES = PexDdpexDefines
+CDEBUGFLAGS = PexDdpexCDebugFlags
+
+ PEXSERVINC = ../../../include
+DDPEXINCLUDE = ../include
+
+INCLUDES = -I. \
+ -I$(DDPEXINCLUDE) \
+ -I$(XINCLUDESRC) \
+ -I$(PEXSERVINC) \
+ -I$(SERVERSRC)/include
+
+SRCS = ddContext.c \
+ miBldXform.c \
+ miClip.c \
+ miCellArray.c \
+ miConvert.c \
+ miDestroy.c \
+ miFillArea.c \
+ miLight.c \
+ miLvl2Tab.c \
+ miMarkers.c \
+ miNCurve.c \
+ miNSurf.c \
+ miNSTrim.c \
+ miNurbs.c \
+ miOCs.c \
+ miPolyLine.c \
+ miQuadMesh.c \
+ miSOFAS.c \
+ miTestOCs.c \
+ miText.c \
+ miTrans.c \
+ miTriStrip.c \
+ miCopy.c \
+ miInquire.c \
+ miReplace.c \
+ miPickPrim.c \
+ miSearch.c \
+ pexOCParse.c
+
+OBJS = ddContext.o \
+ miBldXform.o \
+ miClip.o \
+ miConvert.o \
+ miCellArray.o \
+ miDestroy.o \
+ miFillArea.o \
+ miLight.o \
+ miLvl2Tab.o \
+ miMarkers.o \
+ miNCurve.o \
+ miNSurf.o \
+ miNSTrim.o \
+ miNurbs.o \
+ miOCs.o \
+ miPolyLine.o \
+ miQuadMesh.o \
+ miSOFAS.o \
+ miTestOCs.o \
+ miText.o \
+ miTrans.o \
+ miTriStrip.o \
+ miCopy.o \
+ miInquire.o \
+ miReplace.o \
+ miPickPrim.o \
+ miSearch.o \
+ pexOCParse.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ddpex2,$(OBJS))
+
+LintLibraryTarget(dp2, $(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/ddContext.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/ddContext.c
new file mode 100644
index 000000000..1322cce00
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/ddContext.c
@@ -0,0 +1,1091 @@
+/* $TOG: ddContext.c /main/11 1998/02/10 12:40:37 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/ddContext.c,v 3.5 1998/10/04 09:34:15 dawes Exp $ */
+
+#include "miWks.h"
+#include "miStruct.h"
+#include "miRender.h"
+#include "PEXErr.h"
+#include "pexUtils.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "miscstruct.h"
+#include "pexos.h"
+
+
+static void deleteDynamicDDContext();
+
+/* External variables used */
+
+extern void miMatMult();
+extern RendTableType RenderPrimitiveTable[];
+extern RendTableType PickPrimitiveTable[];
+
+/* pcflag is initialized in ddpexInit() */
+extern ddBOOL pcflag;
+extern ddPCAttr defaultPCAttr;
+#define MI_GET_DEFAULT_PC(pPC) \
+ if (!pcflag) { \
+ DefaultPC(pPC); \
+ pcflag = MI_TRUE; }
+
+/*++
+ |
+ | Function Name: CreateDDContext
+ |
+ | Function Description:
+ | Creates and initializes a DDContext structure and
+ | intializes the Renderer pointer.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+CreateDDContext(pRend)
+ ddRendererPtr pRend; /* renderer handle */
+{
+
+ extern GCPtr CreateScratchGC();
+ miDDContext *pddc;
+ ddPCAttr *ppca;
+ listofObj *pMC, *pLS;
+ int i;
+
+ pRend->pDDContext = NULL;
+
+ /*
+ * Create the dd attribute context: this requires creating both the
+ * static and Dynamic portions of the DDContext.
+ */
+ pddc = (miDDContext *) xalloc(sizeof(miDDContext));
+ if (!pddc)
+ return (BadAlloc);
+ pddc->Dynamic = (miDynamicDDContext *) xalloc(sizeof(miDynamicDDContext));
+ if (!pddc->Dynamic) {
+ xfree((char *) pddc);
+ return (BadAlloc);
+ }
+ /* allocate storage for local copy of PC */
+ pddc->Dynamic->pPCAttr = (ddPCAttr *) xalloc(sizeof(ddPCAttr));
+ if (!pddc->Dynamic->pPCAttr) {
+ xfree((char *) pddc->Dynamic);
+ xfree((char *) pddc);
+ return (BadAlloc);
+ }
+
+ /* initialize pointers so that panic-caused freeing is clean */
+ pddc->Static.misc.ms_MCV = NULL;
+ pddc->Static.attrs = NULL;
+ pddc->Dynamic->next = NULL;
+ pddc->Dynamic->pPCAttr->modelClipVolume = NULL;
+ pddc->Dynamic->pPCAttr->lightState = NULL;
+ pddc->Static.misc.pPolylineGC = NULL;
+ pddc->Static.misc.pFillAreaGC = NULL;
+ pddc->Static.misc.pEdgeGC = NULL;
+ pddc->Static.misc.pPolyMarkerGC = NULL;
+ pddc->Static.misc.pTextGC = NULL;
+
+
+ /* don't forget Model Clip and lightState in PC */
+ pddc->Dynamic->pPCAttr->modelClipVolume = puCreateList(DD_HALF_SPACE);
+ if (!pddc->Dynamic->pPCAttr->modelClipVolume) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+
+ pddc->Dynamic->pPCAttr->lightState = puCreateList(DD_INDEX);
+ if (!pddc->Dynamic->pPCAttr->lightState) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+
+ /* don't forget transformed versions of MCVolume in PC */
+ pddc->Static.misc.ms_MCV = puCreateList(DD_HALF_SPACE);
+ if (!pddc->Static.misc.ms_MCV) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+
+ /*
+ * Initialize the newly created ddcontext.
+ */
+ ppca = pddc->Dynamic->pPCAttr;
+ pMC = ppca->modelClipVolume;
+ pLS = ppca->lightState;
+ if (pRend->pPC != NULL) {
+ *ppca = *pRend->pPC->pPCAttr;
+
+ /*
+ * don't forget the model clip half planes and list of light sources,
+ * which are only pointed to
+ */
+ if (puCopyList(pRend->pPC->pPCAttr->modelClipVolume, pMC)) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (puCopyList(pRend->pPC->pPCAttr->lightState, pLS)) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ } else { /* use default PC values */
+ MI_GET_DEFAULT_PC(&defaultPCAttr);
+ *ppca = defaultPCAttr;
+
+ /*
+ * don't forget the model clip half planes and list of light sources,
+ * which are only pointed to
+ */
+ if (puCopyList(defaultPCAttr.modelClipVolume, pMC)) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (puCopyList(defaultPCAttr.lightState, pLS)) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ }
+ ppca->modelClipVolume = pMC;
+ ppca->lightState = pLS;
+
+ /* copy the current name set from the ns resource to the renderer */
+ MINS_EMPTY_NAMESET(pddc->Dynamic->currentNames);
+ if (ppca->pCurrentNS) {
+ miNSHeader *pns = (miNSHeader *) ppca->pCurrentNS->deviceData;
+
+ MINS_COPY_NAMESET(pns->names, pddc->Dynamic->currentNames);
+ }
+ pddc->Dynamic->filter_flags = 0;
+ pddc->Dynamic->do_prims = 1;
+
+ /*
+ * Initialize level 1 rendering procedure jump table
+ */
+ memcpy( (char *) pddc->Static.RenderProcs,
+ (char *) RenderPrimitiveTable,
+ sizeof(RendTableType) * RENDER_TABLE_LENGTH);
+
+ /*
+ * Allocate storage and initialize the DD context rendering attributes.
+ */
+ if (!(pddc->Static.attrs =
+ (miDDContextRendAttrs *) xalloc(sizeof(miDDContextRendAttrs)))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+
+ /*
+ * Intialize the scratch data pointer areas Setting the maxlists or
+ * maxData fields to 0 insures that headers are allocated the first time
+ * the lists are used.
+ */
+ pddc->Static.misc.listIndex = 0;
+ for (i = 0; i < MI_MAXTEMPDATALISTS; i++)
+ pddc->Static.misc.list4D[i].maxLists = 0;
+ pddc->Static.misc.list2D.maxLists = 0;
+
+ for (i = 0; i < MI_MAXTEMPFACETLISTS; i++)
+ pddc->Static.misc.facets[i].maxData = 0;
+
+ /*
+ * get a GC use the default values for now a scratch gc should be OK,
+ * it's the same as a regular gc except it doesn't create the tile or
+ * stipple I don't think we need to express interest in any change to the
+ * GC, since the ddpex code which uses the gc is the only one who should
+ * be changing it. But, we may need to express interest in window events
+ * or something if we can.
+ *
+ * a GC is created for each primitive type. THis should reduce the number of
+ * calls to change GC as otherwise this call would be required for each
+ * primitive. Note, that the down-side of this approach is that many
+ * hardware platforms only support a single graphics context, and thus
+ * will have to be re-loaded at every validate GC anyways.... There is no
+ * drawable if doing a search (ISS), so don't create the GCs. They aren't
+ * needed.
+ */
+
+ if (pRend->pDrawable) {
+ pddc->Static.misc.flags |= (POLYLINEGCFLAG | FILLAREAGCFLAG |
+ EDGEGCFLAG | MARKERGCFLAG | TEXTGCFLAG |
+ NOLINEDASHFLAG);
+
+ if (!(pddc->Static.misc.pPolylineGC =
+ CreateScratchGC(pRend->pDrawable->pScreen, pRend->pDrawable->depth))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (!(pddc->Static.misc.pFillAreaGC =
+ CreateScratchGC(pRend->pDrawable->pScreen, pRend->pDrawable->depth))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (!(pddc->Static.misc.pEdgeGC =
+ CreateScratchGC(pRend->pDrawable->pScreen, pRend->pDrawable->depth))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (!(pddc->Static.misc.pPolyMarkerGC =
+ CreateScratchGC(pRend->pDrawable->pScreen, pRend->pDrawable->depth))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ if (!(pddc->Static.misc.pTextGC =
+ CreateScratchGC(pRend->pDrawable->pScreen, pRend->pDrawable->depth))) {
+ DeleteDDContext(pddc);
+ return (BadAlloc);
+ }
+ }
+ /* init pick and search structs */
+ pddc->Static.pick.type = 0;
+ pddc->Static.pick.status = PEXNoPick;
+
+ MINS_EMPTY_NAMESET(pddc->Static.pick.inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.pick.exclusion);
+
+ pddc->Static.search.status = PEXNotFound;
+
+ MINS_EMPTY_NAMESET(pddc->Static.search.norm_inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.norm_exclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.invert_inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.invert_exclusion);
+
+ /* Indicate all xforms in static are invalid */
+ pddc->Static.misc.flags |= ( INVTRCCTODCXFRMFLAG | INVTRWCTOCCXFRMFLAG
+ | INVTRMCTOCCXFRMFLAG | INVTRMCTOWCXFRMFLAG | INVVIEWXFRMFLAG );
+
+ /* Mark as invalid any transform dependant fields in ddContext
+ */
+ pddc->Static.misc.flags |= (MCVOLUMEFLAG | CC_DCUEVERSION);
+
+ /* If successfull, initialize Renderer pointer and return */
+ pRend->pDDContext = (ddPointer) pddc;
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: DeleteDDContext
+ |
+ | Function Description:
+ | Deletes all of the storage used by the ddPEX attribute context.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+DeleteDDContext(pDDContext)
+/* in */
+ miDDContext *pDDContext; /* ddPEX attribute structure */
+/* out */
+{
+ miDynamicDDContext *pdddc, *pdddc2;
+ int i;
+
+#ifdef DDTEST
+ ErrorF(" DeleteDDContext\n");
+#endif
+
+ if (!pDDContext) return(Success); /* just in case */
+
+ /* Free the ddcontext attribute store */
+ if (pDDContext->Static.attrs) {
+ xfree((char *) (pDDContext->Static.attrs));
+ pDDContext->Static.attrs = 0;
+ }
+
+ /*
+ * free the scratch rendering data buffers.
+ */
+ for (i = 0; i < MI_MAXTEMPDATALISTS; i++) {
+ MI_FREELISTHEADER(&(pDDContext->Static.misc.list4D[i]));
+ }
+ MI_FREELISTHEADER(&pDDContext->Static.misc.list2D);
+
+ for (i = 0; i < MI_MAXTEMPFACETLISTS; i++)
+ if (pDDContext->Static.misc.facets[i].maxData) {
+ xfree((char *)(pDDContext->Static.misc.facets[i].facets.pNoFacet));
+ pDDContext->Static.misc.facets[i].facets.pNoFacet = 0;
+ }
+
+ if (pDDContext->Static.misc.ms_MCV) {
+ puDeleteList(pDDContext->Static.misc.ms_MCV);
+ pDDContext->Static.misc.ms_MCV = 0;
+ }
+
+ /*
+ * Free the graphics contexts.
+ */
+ if (pDDContext->Static.misc.pPolylineGC)
+ FreeScratchGC(pDDContext->Static.misc.pPolylineGC);
+
+ if (pDDContext->Static.misc.pFillAreaGC)
+ FreeScratchGC(pDDContext->Static.misc.pFillAreaGC);
+
+ if (pDDContext->Static.misc.pEdgeGC)
+ FreeScratchGC(pDDContext->Static.misc.pEdgeGC);
+
+ if (pDDContext->Static.misc.pPolyMarkerGC)
+ FreeScratchGC(pDDContext->Static.misc.pPolyMarkerGC);
+
+ if (pDDContext->Static.misc.pTextGC)
+ FreeScratchGC(pDDContext->Static.misc.pTextGC);
+
+ /* free the Dynamic part(s) */
+ pdddc = pDDContext->Dynamic;
+ while (pdddc) {
+ pdddc2 = pdddc->next;
+ deleteDynamicDDContext(pdddc);
+ pdddc = pdddc2;
+ }
+
+ /* zero pointers to force illumination of any server bugs */
+ pDDContext->Static.misc.ms_MCV = NULL;
+ pDDContext->Static.attrs = NULL;
+ pDDContext->Static.misc.pPolylineGC = NULL;
+ pDDContext->Static.misc.pFillAreaGC = NULL;
+ pDDContext->Static.misc.pEdgeGC = NULL;
+ pDDContext->Static.misc.pPolyMarkerGC = NULL;
+ pDDContext->Static.misc.pTextGC = NULL;
+
+ pDDContext->Dynamic = NULL;
+
+ /* Lastly, free the ddcontext pointer itself.... */
+ xfree((char *) (pDDContext));
+
+ return (Success);
+} /* DeleteDDContext */
+
+/*++
+ |
+ | Function Name: deleteDynamicDDContext
+ |
+ | Function Description:
+ | Deletes all of the storage used by the DynamicDDContext
+ | attribute context.
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+void
+deleteDynamicDDContext(pdddc)
+/* in */
+ miDynamicDDContext *pdddc;
+{
+ /* delete the dynamic part of the DDContext */
+
+ if (!pdddc) return;
+
+ /* delete the pc attributes */
+ if (pdddc->pPCAttr) {
+ /* model clip volume */
+ if (pdddc->pPCAttr->modelClipVolume) {
+ puDeleteList(pdddc->pPCAttr->modelClipVolume);
+ pdddc->pPCAttr->modelClipVolume = NULL;
+ }
+ /* list of light source indices */
+ if (pdddc->pPCAttr->lightState) {
+ puDeleteList(pdddc->pPCAttr->lightState);
+ pdddc->pPCAttr->lightState = NULL;
+ }
+ /* pc attr */
+ xfree((char *) pdddc->pPCAttr);
+ pdddc->pPCAttr = NULL;
+ }
+ xfree((char *) pdddc);
+} /* deleteDynamicDDContext */
+
+/*++
+ |
+ | Function Name: PushddContext
+ |
+ | Function Description:
+ | Pushes an instance of the ddContext on the stack, and creates
+ | a new "current" copy.
+ |
+ | The ddContext is divided into two parts: static and dynamic.
+ | The static attributes of the ddContext are either invarient
+ | across CSS hierarchy levels, or must be recomputed when moving
+ | up a level in the hierarchy. Dybnamic attributes, on the other
+ | hand, are stored in the stack when decending down the CSS, and
+ | thus can be restored by a simple "pop" operation when climbing
+ | back up through the CSS hierarchy.
+ |
+ | This routine, therefore, saves the current dynamic ddContext
+ | attributes on the stack, and initializes a new dynamic ddContext.
+ |
+ | Note(s):
+ | Since some of the dynamic ddContext elements contain and/or
+ | are pointers to objects, the info cannot be copied directly,
+ | but new objects must be made to be pointed to and their contents copied.
+ | So, the sequence that this procedure goes through is this:
+ | create a new dd context data structure
+ | copy old context to the new context, but remember
+ | that pointers to objects will be replaced.
+ | create a new PCAttr structure and copy old to new
+ | update the current path and transform matrices
+ | push the new context onto the stack
+ |
+ --*/
+
+ddpex3rtn
+PushddContext(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+ miDDContext *pDDContext = (miDDContext *) (pRend->pDDContext);
+ miDynamicDDContext *oldDContext = pDDContext->Dynamic;
+ miDynamicDDContext *newDContext;
+
+#ifdef DDTEST
+ ErrorF(" BeginStructure %d\n", sId);
+#endif
+
+ /* First, create a new dynamic dd context */
+ if (!(newDContext = (miDynamicDDContext *) xalloc(sizeof(miDynamicDDContext)))) {
+ return (BadAlloc);
+ }
+
+ /*
+ * copy the contents of the old Dynamic ddContext to the new one this
+ * also copies the current name set
+ */
+ *newDContext = *oldDContext;
+
+ /* now, create a new PC for the new dd context */
+ if (!(newDContext->pPCAttr = (ddPCAttr *) xalloc(sizeof(ddPCAttr)))) {
+ xfree((char *) newDContext);
+ return (BadAlloc);
+ }
+ /* Copy static portion of PC attrs */
+ *newDContext->pPCAttr = *oldDContext->pPCAttr;
+
+ /* now create new stuff for pointers in new PCAttr to point to */
+ /* model clip volume */
+ newDContext->pPCAttr->modelClipVolume = puCreateList(DD_HALF_SPACE);
+ if (!newDContext->pPCAttr->modelClipVolume) {
+ deleteDynamicDDContext(newDContext);
+ return (BadAlloc);
+ }
+ if (puCopyList(oldDContext->pPCAttr->modelClipVolume,
+ newDContext->pPCAttr->modelClipVolume)) {
+ deleteDynamicDDContext(newDContext);
+ return (BadAlloc);
+ }
+ /* light source indices */
+ newDContext->pPCAttr->lightState = puCreateList(DD_INDEX);
+ if (!newDContext->pPCAttr->lightState) {
+ deleteDynamicDDContext(newDContext);
+ return (BadAlloc);
+ }
+ if (puCopyList(oldDContext->pPCAttr->lightState,
+ newDContext->pPCAttr->lightState)) {
+ deleteDynamicDDContext(newDContext);
+ return (BadAlloc);
+ }
+ /** Concatenate the local and global transforms into the new
+ ** global transform, then identity out the local one **/
+ miMatMult(newDContext->pPCAttr->globalMat,
+ oldDContext->pPCAttr->localMat,
+ oldDContext->pPCAttr->globalMat);
+
+ memcpy( (char *) newDContext->pPCAttr->localMat,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /** Push the new context onto the renderer DDContext **/
+ /* newContext points to the old context */
+ newDContext->next = pDDContext->Dynamic;
+ /* renderer points to the new context */
+ pDDContext->Dynamic = newDContext;
+
+ return (Success);
+} /* PushddContext */
+
+/*++
+ |
+ | Function Name: PopddContext
+ |
+ | Function Description:
+ | Pops an instance of a dynamic ddContext structure off the stack.
+ | (See description above.)
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+PopddContext(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+ miDynamicDDContext *oldDDDContext;
+
+#ifdef DDTEST
+ ErrorF(" EndStructure\n");
+#endif
+
+ /** Pop off top of attr context stack **/
+ oldDDDContext = pddc->Dynamic;
+ pddc->Dynamic = oldDDDContext->next;
+
+ /** Free up storage used by oldContext **/
+ deleteDynamicDDContext(oldDDDContext);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG |
+ INVTRMCTOCCXFRMFLAG | INVTRCCTODCXFRMFLAG |
+ INVVIEWXFRMFLAG);
+
+ /* Mark as invalid any transform dependant fields in ddContext */
+ pddc->Static.misc.flags |= (MCVOLUMEFLAG | CC_DCUEVERSION);
+
+ return (Success);
+
+} /* PopddContext */
+
+/*++
+ |
+ | Function Name: ValidateDDContextAttrs
+ |
+ | Function Description:
+ | Updates the rendering attributes to match the
+ | attributes associated with the current PC.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* ddPEX attribute structure */
+ ddBitmask tables, namesets, attrs;
+{
+ ddpex3rtn miConvertColor();
+ miLineBundleEntry *linebundle = 0;
+ miTextBundleEntry *textbundle = 0;
+ miMarkerBundleEntry *markerbundle = 0;
+ miInteriorBundleEntry *intbundle = 0;
+ miEdgeBundleEntry *edgebundle = 0;
+ miViewEntry *view = 0;
+ ddUSHORT status = 0;
+ char colors;
+
+ colors = (tables & PEXDynColourTable) || (tables & PEXDynColourTableContents);
+
+ /*
+ * Marker Attributes
+ */
+ if ((tables & PEXDynMarkerBundle) ||
+ (tables & PEXDynMarkerBundleContents) ||
+ colors) {
+ if (~(pddc->Dynamic->pPCAttr->asfs
+ & (PEXMarkerTypeAsf | PEXMarkerScaleAsf | PEXMarkerColourAsf))) {
+
+ if ((InquireLUTEntryAddress(PEXMarkerBundleLUT,
+ pRend->lut[PEXMarkerBundleLUT],
+ pddc->Dynamic->pPCAttr->markerIndex,
+ &status, (ddPointer *) (&markerbundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+ /* always try to set the color */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &markerbundle->real_entry.markerColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->markerColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->markerColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->markerColour);
+ }
+ }
+ /* only set these if it's the bundle that changed */
+ if ((tables & PEXDynMarkerBundle) ||
+ (tables & PEXDynMarkerBundleContents)) {
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerTypeAsf) == PEXBundled)
+ pddc->Static.attrs->markerType = markerbundle->real_entry.markerType;
+ else
+ pddc->Static.attrs->markerType = pddc->Dynamic->pPCAttr->markerType;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerScaleAsf) == PEXBundled)
+ pddc->Static.attrs->markerScale =
+ markerbundle->real_entry.markerScale;
+ else
+ pddc->Static.attrs->markerScale =
+ pddc->Dynamic->pPCAttr->markerScale;
+
+ }
+ pddc->Static.misc.flags |= MARKERGCFLAG;
+ }
+
+ /*
+ * Text Attributes
+ */
+ if ((tables & PEXDynTextBundle) ||
+ (tables & PEXDynTextBundleContents) ||
+ colors) {
+ if (~(pddc->Dynamic->pPCAttr->asfs
+ & (PEXTextFontIndexAsf | PEXTextPrecAsf | PEXCharExpansionAsf |
+ PEXCharSpacingAsf | PEXTextColourAsf))) {
+
+ if ((InquireLUTEntryAddress(PEXTextBundleLUT,
+ pRend->lut[PEXTextBundleLUT],
+ pddc->Dynamic->pPCAttr->textIndex,
+ &status, (ddPointer *) (&textbundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+ /* First, bundled attributes */
+ /* always try to set the color */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &textbundle->real_entry.textColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->textColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->textColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->textColour);
+ }
+ }
+ /* only set these if it's the bundle that changed */
+ if ((tables & PEXDynTextBundle) ||
+ (tables & PEXDynTextBundleContents)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextFontIndexAsf) == PEXBundled)
+ pddc->Static.attrs->textFont = textbundle->real_entry.textFontIndex;
+ else
+ pddc->Static.attrs->textFont = pddc->Dynamic->pPCAttr->textFont;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextPrecAsf) == PEXBundled)
+ pddc->Static.attrs->textPrecision =
+ textbundle->real_entry.textPrecision;
+ else
+ pddc->Static.attrs->textPrecision =
+ pddc->Dynamic->pPCAttr->textPrecision;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXCharExpansionAsf) == PEXBundled)
+ pddc->Static.attrs->charExpansion =
+ textbundle->real_entry.charExpansion;
+ else
+ pddc->Static.attrs->charExpansion =
+ pddc->Dynamic->pPCAttr->charExpansion;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXCharSpacingAsf) == PEXBundled)
+ pddc->Static.attrs->charSpacing = textbundle->real_entry.charSpacing;
+ else
+ pddc->Static.attrs->charSpacing = pddc->Dynamic->pPCAttr->charSpacing;
+ }
+ }
+
+ /*
+ * Next, unbundled attributes always do these, but there may be some way
+ * to put some smarts in about this
+ */
+ pddc->Static.attrs->charHeight = pddc->Dynamic->pPCAttr->charHeight;
+ pddc->Static.attrs->charUp = pddc->Dynamic->pPCAttr->charUp;
+ pddc->Static.attrs->textPath = pddc->Dynamic->pPCAttr->textPath;
+ pddc->Static.attrs->textAlignment = pddc->Dynamic->pPCAttr->textAlignment;
+ pddc->Static.attrs->atextHeight = pddc->Dynamic->pPCAttr->atextHeight;
+ pddc->Static.attrs->atextUp = pddc->Dynamic->pPCAttr->atextUp;
+ pddc->Static.attrs->atextPath = pddc->Dynamic->pPCAttr->atextPath;
+ pddc->Static.attrs->atextAlignment = pddc->Dynamic->pPCAttr->atextAlignment;
+ pddc->Static.attrs->atextStyle = pddc->Dynamic->pPCAttr->atextStyle;
+
+ pddc->Static.misc.flags |= TEXTGCFLAG;
+
+ /*
+ * Line Attributes
+ */
+ if ((tables & PEXDynLineBundle) ||
+ (tables & PEXDynLineBundleContents) ||
+ colors) {
+ if (~(pddc->Dynamic->pPCAttr->asfs
+ & (PEXLineTypeAsf | PEXLineWidthAsf | PEXLineColourAsf |
+ PEXCurveApproxAsf | PEXPolylineInterpAsf))) {
+ if ((InquireLUTEntryAddress(PEXLineBundleLUT,
+ pRend->lut[PEXLineBundleLUT],
+ pddc->Dynamic->pPCAttr->lineIndex,
+ &status, (ddPointer *) (&linebundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+ /* Update DDC rendering attributes if bundled */
+ /* always try to set the color */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &linebundle->real_entry.lineColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->lineColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->lineColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->lineColour);
+ }
+ }
+ /* only set these if it's the bundle that changed */
+ if ((tables & PEXDynLineBundle) ||
+ (tables & PEXDynLineBundleContents)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineTypeAsf) == PEXBundled)
+ pddc->Static.attrs->lineType = linebundle->real_entry.lineType;
+ else
+ pddc->Static.attrs->lineType = pddc->Dynamic->pPCAttr->lineType;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineWidthAsf) == PEXBundled)
+ pddc->Static.attrs->lineWidth = linebundle->real_entry.lineWidth;
+ else
+ pddc->Static.attrs->lineWidth = pddc->Dynamic->pPCAttr->lineWidth;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXCurveApproxAsf) == PEXBundled)
+ pddc->Static.attrs->curveApprox = linebundle->real_entry.curveApprox;
+ else
+ pddc->Static.attrs->curveApprox = pddc->Dynamic->pPCAttr->curveApprox;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXPolylineInterpAsf) == PEXBundled)
+ pddc->Static.attrs->lineInterp = linebundle->real_entry.polylineInterp;
+ else
+ pddc->Static.attrs->lineInterp = pddc->Dynamic->pPCAttr->lineInterp;
+ }
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ }
+
+ /*
+ * Surface Attributes
+ */
+
+ if ((tables & PEXDynInteriorBundle) ||
+ (tables & PEXDynInteriorBundleContents) ||
+ colors) {
+ if (~(pddc->Dynamic->pPCAttr->asfs
+ & (PEXInteriorStyleAsf | PEXInteriorStyleIndexAsf |
+ PEXSurfaceColourAsf | PEXSurfaceInterpAsf |
+ PEXReflectionModelAsf | PEXReflectionAttrAsf |
+ PEXBfInteriorStyleAsf | PEXBfInteriorStyleIndexAsf |
+ PEXBfSurfaceColourAsf | PEXBfSurfaceInterpAsf |
+ PEXBfReflectionModelAsf | PEXBfReflectionAttrAsf |
+ PEXSurfaceApproxAsf))) {
+ if ((InquireLUTEntryAddress(PEXInteriorBundleLUT,
+ pRend->lut[PEXInteriorBundleLUT],
+ pddc->Dynamic->pPCAttr->intIndex,
+ &status, (ddPointer *) (&intbundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+ /* Update DDC rendering attributes if bundled */
+ /* always try to set the color */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &intbundle->real_entry.surfaceColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->surfaceColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->surfaceColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->surfaceColour);
+ }
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXBfSurfaceColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &intbundle->real_entry.bfSurfaceColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->bfSurfColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->bfSurfColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->bfSurfColour);
+ }
+
+ }
+ /* only set these if it's the bundle that changed */
+ if ((tables & PEXDynInteriorBundle) ||
+ (tables & PEXDynInteriorBundleContents)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceInterpAsf)
+ == PEXBundled)
+ pddc->Static.attrs->surfInterp =
+ intbundle->real_entry.surfaceInterp;
+ else
+ pddc->Static.attrs->surfInterp =
+ pddc->Dynamic->pPCAttr->surfInterp;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXReflectionModelAsf)
+ == PEXBundled)
+ pddc->Static.attrs->reflModel =
+ intbundle->real_entry.reflectionModel;
+ else
+ pddc->Static.attrs->reflModel =
+ pddc->Dynamic->pPCAttr->reflModel;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXReflectionAttrAsf)
+ == PEXBundled){
+ pddc->Static.attrs->reflAttr =
+ intbundle->real_entry.reflectionAttr;
+ miConvertColor(pRend,
+ &intbundle->real_entry.reflectionAttr.specularColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->reflAttr.specularColour);
+ } else {
+ pddc->Static.attrs->reflAttr = pddc->Dynamic->pPCAttr->reflAttr;
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->reflAttr.specularColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->reflAttr.specularColour);
+ }
+
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXInteriorStyleAsf)
+ == PEXBundled)
+ pddc->Static.attrs->intStyle =
+ intbundle->real_entry.interiorStyle;
+ else
+ pddc->Static.attrs->intStyle = pddc->Dynamic->pPCAttr->intStyle;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXBfSurfaceInterpAsf)
+ == PEXBundled)
+ pddc->Static.attrs->bfSurfInterp =
+ intbundle->real_entry.bfSurfaceInterp;
+ else
+ pddc->Static.attrs->bfSurfInterp =
+ pddc->Dynamic->pPCAttr->bfSurfInterp;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXBfReflectionModelAsf)
+ == PEXBundled)
+ pddc->Static.attrs->bfReflModel =
+ intbundle->real_entry.bfReflectionModel;
+ else
+ pddc->Static.attrs->bfReflModel =
+ pddc->Dynamic->pPCAttr->bfReflModel;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXBfReflectionAttrAsf)
+ == PEXBundled){
+ pddc->Static.attrs->bfReflAttr =
+ intbundle->real_entry.bfReflectionAttr;
+ miConvertColor(pRend,
+ &intbundle->real_entry.bfReflectionAttr.specularColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->bfReflAttr.specularColour);
+ } else {
+ pddc->Static.attrs->bfReflAttr =
+ pddc->Dynamic->pPCAttr->bfReflAttr;
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->bfReflAttr.specularColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->bfReflAttr.specularColour);
+ }
+
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXBfInteriorStyleAsf)
+ == PEXBundled)
+ pddc->Static.attrs->bfIntStyle =
+ intbundle->real_entry.bfInteriorStyle;
+ else
+ pddc->Static.attrs->bfIntStyle =
+ pddc->Dynamic->pPCAttr->bfIntStyle;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceApproxAsf)
+ == PEXBundled)
+ pddc->Static.attrs->surfApprox =
+ intbundle->real_entry.surfaceApprox;
+ else
+ pddc->Static.attrs->surfApprox =
+ pddc->Dynamic->pPCAttr->surfApprox;
+ }
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+
+ /*
+ * Surface edge Attributes
+ */
+ if ((tables & PEXDynEdgeBundle) ||
+ (tables & PEXDynEdgeBundleContents) ||
+ colors) {
+ if (~(pddc->Dynamic->pPCAttr->asfs
+ & (PEXSurfaceEdgeTypeAsf | PEXSurfaceEdgeWidthAsf |
+ PEXSurfaceEdgeColourAsf | PEXSurfaceEdgesAsf))) {
+ if ((InquireLUTEntryAddress(PEXEdgeBundleLUT,
+ pRend->lut[PEXEdgeBundleLUT],
+ pddc->Dynamic->pPCAttr->edgeIndex,
+ &status, (ddPointer *) (&edgebundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+ /* always try to set the color */
+ if (!MI_DDC_IS_HIGHLIGHT(pddc)) {
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeColourAsf) == PEXBundled) {
+ miConvertColor(pRend,
+ &edgebundle->real_entry.edgeColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->edgeColour);
+ } else {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->edgeColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->edgeColour);
+ }
+ }
+ /* only set these if it's the bundle that changed */
+ if ((tables & PEXDynEdgeBundle) ||
+ (tables & PEXDynEdgeBundleContents)) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgesAsf) == PEXBundled)
+ pddc->Static.attrs->edges = edgebundle->real_entry.edges;
+ else
+ pddc->Static.attrs->edges = pddc->Dynamic->pPCAttr->edges;
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeTypeAsf) == PEXBundled)
+ pddc->Static.attrs->edgeType = edgebundle->real_entry.edgeType;
+ else
+ pddc->Static.attrs->edgeType = pddc->Dynamic->pPCAttr->edgeType;
+
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeWidthAsf) == PEXBundled)
+ pddc->Static.attrs->edgeWidth = edgebundle->real_entry.edgeWidth;
+ else
+ pddc->Static.attrs->edgeWidth = pddc->Dynamic->pPCAttr->edgeWidth;
+ }
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ }
+
+ /*
+ * View table
+ */
+ if ((attrs & PEXDynNpcSubvolume) || (attrs & PEXDynViewport)) {
+ extern ddpex3rtn miBldViewport_xform();
+
+ miBldViewport_xform(pRend, pRend->pDrawable,
+ pddc->Static.misc.viewport_xform, pddc );
+ }
+ if ((tables & PEXDynViewTable) || (tables & PEXDynViewTableContents)) {
+ extern ddpex3rtn miBldCC_xform();
+
+ miBldCC_xform(pRend, pddc);
+ }
+
+ /* the echo colour change always take places */
+ pddc->Static.attrs->echoColour = pRend->echoColour;
+
+ /* If the echo mode changes, we have to change all these GCs */
+ if( attrs & PEXDynEchoMode )
+ {
+ pddc->Static.attrs->echoMode = pRend->echoMode;
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ pddc->Static.misc.flags |= MARKERGCFLAG;
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ pddc->Static.misc.flags |= TEXTGCFLAG;
+ }
+
+ /*
+ * Set the Clip List in each GC if there are any
+ * all GCs are defined at the same time so check if any one exists
+ */
+ if ((attrs & PEXDynClipList) && pddc->Static.misc.pPolylineGC)
+ {
+
+ extern int SetClipRects();
+ extern void ValidateGC();
+ xRectangle *xrects, *p;
+ ddDeviceRect *ddrects;
+ ddLONG numrects;
+ XID gcval;
+ int i;
+
+ numrects = pRend->clipList->numObj;
+ if (numrects) {
+ ddrects = (ddDeviceRect *) pRend->clipList->pList;
+ xrects = (xRectangle*) xalloc(numrects * sizeof(xRectangle));
+ if (!xrects) return BadAlloc;
+ /* Need to convert to XRectangle format */
+ for (i = 0, p = xrects; i < numrects; i++, p++, ddrects++) {
+ p->x = ddrects->xmin;
+ p->y = pRend->pDrawable->height - ddrects->ymax;
+ p->width = ddrects->xmax - ddrects->xmin + 1;
+ p->height = ddrects->ymax - ddrects->ymin + 1;
+ }
+
+ SetClipRects(pddc->Static.misc.pPolylineGC, 0, 0,
+ (int)numrects, xrects, Unsorted);
+ SetClipRects(pddc->Static.misc.pFillAreaGC, 0, 0,
+ (int)numrects, xrects, Unsorted);
+ SetClipRects(pddc->Static.misc.pEdgeGC, 0, 0,
+ (int)numrects, xrects, Unsorted);
+ SetClipRects(pddc->Static.misc.pPolyMarkerGC, 0, 0,
+ (int)numrects, xrects, Unsorted);
+ SetClipRects(pddc->Static.misc.pTextGC, 0, 0,
+ (int)numrects, xrects, Unsorted);
+ xfree((char*)xrects);
+ }
+ else {
+ gcval = None;
+ ChangeGC(pddc->Static.misc.pPolylineGC, GCClipMask, &gcval);
+ ChangeGC(pddc->Static.misc.pFillAreaGC, GCClipMask, &gcval);
+ ChangeGC(pddc->Static.misc.pEdgeGC, GCClipMask, &gcval);
+ ChangeGC(pddc->Static.misc.pPolyMarkerGC, GCClipMask, &gcval);
+ ChangeGC(pddc->Static.misc.pTextGC, GCClipMask, &gcval);
+ }
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolylineGC);
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pFillAreaGC);
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pEdgeGC);
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pPolyMarkerGC);
+ ValidateGC(pRend->pDrawable, pddc->Static.misc.pTextGC);
+ }
+
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miBldXform.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miBldXform.c
new file mode 100644
index 000000000..9bca71000
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miBldXform.c
@@ -0,0 +1,709 @@
+/* $TOG: miBldXform.c /main/8 1998/02/10 12:40:42 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name Sun Microsystems not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miBldXform.c,v 3.5 1998/10/04 09:34:16 dawes Exp $ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "miLUT.h"
+#include "PEXErr.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "miscstruct.h"
+#include "miRender.h"
+#include "pexos.h"
+
+/* External variables and functions */
+extern void miMatMult();
+extern void miMatCopy();
+extern ddpex3rtn InquireLUTEntryAddress();
+extern void SetViewportClip();
+
+
+/*++
+ |
+ | Function Name: miBldViewport_xform
+ |
+ | Function Description:
+ | Computes the viewport_xform with special handling for the ddc.
+ | This is used for setting up for drawing, picking, searching,
+ | and MapDCtoWC/MapWCtoDC
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miBldViewport_xform(pRend, pDrawable, xform, pddc )
+ ddRendererPtr pRend; /* renderer handle */
+ DrawablePtr pDrawable; /* pointer to X drawable */
+ ddFLOAT xform[4][4]; /* returned transform */
+ miDDContext *pddc; /* dd context handle */
+{
+
+ ddFLOAT Sx, Sy, Sz;
+ ddFLOAT Sxy;
+ ddFLOAT Tx, Ty, Tz;
+
+ /*
+ * Determine the npc -> dc viewport transform. Let's represent
+ * this transform as follows :
+ *
+ * Sx 0 0 0
+ * 0 Sy 0 0
+ * 0 0 Sz 0
+ * Tx Ty Tz 1
+ *
+ * There are two components to this transformation.
+ *
+ * NOTE THAT THE TRANSLATION COMPONENTS DETERMINED IN THE BeginRenderi
+ng
+ * CODE ARE DIFFERENT FOR THE PICKING CASE. WE USE THE PHIGS DC SPACE
+ * TO REPRESENT THE PICK APERTURE AS OPPOSED TO THE X'S SCREEN SPACE.
+ *
+ *
+ * The elements Sx, Sy, Tx, and Ty are computed in two stages as
+ * follows :
+ *
+ * First, the npc subvolume in the renderer determines
+ * the subvolume that is projected onto the viewport.
+ * This tranformation is implemented by "magnifying" this
+ * subvolume to the range (0, 0, 0)-(1,1,1)
+ *
+ * NPC space "magnified" space
+ *
+ * +-----+(c,d) +--------+(1,1)
+ * | | | |
+ * | | <====> | |
+ * | | | |
+ * (a,b)+-----+ (0,0)+--------+
+ *
+ * 1/(c-a) 0 0
+ * 0 1/(d-b) 0
+ * -a/(c-a) -b/(d-b) 0
+ *
+ */
+ /*
+ * Initialize the scaling components Sx, Sy, and Sz.
+ *
+ */
+
+ Sx = 1/(pRend->npcSubvolume.maxval.x - pRend->npcSubvolume.minval.x);
+ Sy = 1/(pRend->npcSubvolume.maxval.y - pRend->npcSubvolume.minval.y);
+ Sz = 1/(pRend->npcSubvolume.maxval.z - pRend->npcSubvolume.minval.z);
+
+ /*
+ * Secondly, if the useDrawable flag in the viewport is set, then
+ * get the min and max of the drawable from the pDrawable passed
+ * and store it in the viewport as the default values. Otherwise,
+ * the values are as available in the viewport slot of renderer
+ * context already set up. Note that the same aspect ratio limitation
+ * used above also applies to the viewport transform.
+ */
+ memcpy( (char *) xform, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ if (pRend->viewport.useDrawable) { /* Use the drawable width and height */
+ /* FOR RENDERING:
+ * Note that The origin is always 0,0 since ddx points
+ * are specified relative to the window origin
+ * Lastly, note that the screen origin is at the upper left
+ * corner of the window, the viewing space origin is at the
+ * lower left corner. To "flip" the coordinates to match
+ * the screen space, apply the following transform:
+ *
+ * 1 0 0 0
+ * 0 -1 0 0
+ * 0 0 1 0
+ * 0 window_y_max 0 0
+ *
+ *
+ * ie y' = (window_y_max - y)
+ *
+ */
+ /* FOR PICKING:
+ * Note that The origin is always 0,0 since DC points
+ * are specified relative to the window origin. The
+ * required transform is :
+ *
+ * Sx 0 0 0
+ * 0 Sy 0 0
+ * 0 0 1 0
+ * 0 0 0 0
+ *
+ */
+ /*
+ * Modify the scaling components Sx and Sy to include the second
+ * transform as follows :
+ */
+
+ Sx *= (ddFLOAT)pDrawable->width;
+ Sy *= (ddFLOAT)pDrawable->height;
+
+ /*
+ * Initialize the translation components Tx, Ty and Tz
+ * Note the difference for picking and searching from
+ * drawing. drawing flips the y value. the others don't
+ */
+
+ Tx = 0.0;
+ if ((pRend->render_mode == MI_REND_PICKING) || (!pddc))
+ Ty = 0.0;
+ else if ((pRend->render_mode == MI_REND_DRAWING) && (pddc))
+ Ty = pDrawable->height;
+ Tz = 0.0;
+
+ } else {
+
+ xRectangle viewport;
+
+ /* FOR RENDERING:
+ * Limit the rendering for each of the GC's to the viewport
+ * Note that The origin is always 0,0 since ddx points
+ * are specified relative to the window origin
+ * Lastly, note that the screen origin is at the upper left
+ * corner of the window, the viewing space origin is at the
+ * lower left corner. Furthermore, primitives must also be
+ * translated from this lower left origin to the viewport origin.
+ * To "flip" the coordinates to match the screen space, apply
+ * the following transform:
+ *
+ * 1 0 0 0
+ * 0 -1 0 0
+ * 0 0 1 0
+ * viewport_origin_x (window_y_max - viewport_origin_y) 0 0
+ *
+ *
+ * ie y' = (window_y_max - viewport_origin_y - y)
+ *
+ * Lastly, note that the origin of the clipping rectangle for
+ * ddx is relative to the upper left corner of the rectangle,
+ * thus this corner must still be further offset by the viewport
+ * height.
+ *
+ */
+ /* FOR PICKING:
+ * Limit the picking for each of the primitives to the viewport
+ * Note that The origin is always 0,0 since DC points
+ * are specified relative to the window origin. The required
+ * transform is :
+ *
+ * Sx 0 0 0
+ * 0 Sy 0 0
+ * 0 0 1 0
+ * Tx Ty 0 0
+ *
+ */
+ /* FOR SEARCHING: (this is called when initializing the renderer)
+ * there is no drawable, so work around that. None of what this
+ * procedure does is needed for searching, so there may be a better
+ * way to deal with this.
+ */
+ viewport.width = pRend->viewport.maxval.x - pRend->viewport.minval.x;
+ viewport.height = pRend->viewport.maxval.y - pRend->viewport.minval.y;
+
+ viewport.x = pRend->viewport.minval.x;
+ if (pDrawable)
+ viewport.y = pDrawable->height -
+ pRend->viewport.minval.y -
+ viewport.height;
+ else
+ viewport.y = 0;
+
+ /*
+ * Modify the scaling components Sx and Sy to include the second
+ * transform as follows :
+ */
+
+ Sx *= (ddFLOAT)viewport.width;
+ Sy *= (ddFLOAT)viewport.height;
+
+ /*
+ * Initialize the translation components Tx, Ty and Tz.
+ */
+
+ Tx = (ddFLOAT)pRend->viewport.minval.x;
+
+ if ((pRend->render_mode == MI_REND_PICKING) || (!pddc))
+ Ty = (ddFLOAT)pRend->viewport.minval.y;
+ else if ((pRend->render_mode == MI_REND_DRAWING) && (pddc))
+ if (pDrawable)
+ Ty = (ddFLOAT)(pDrawable->height - pRend->viewport.minval.y);
+ else Ty = 0.0;
+ Tz = 0.0;
+
+ if ((pRend->render_mode == MI_REND_DRAWING) && pDrawable && pddc) {
+ /* Set the GC clip mask to clip to the viewport */
+
+ ddLONG numrects = pRend->clipList->numObj;
+
+ if (numrects > 0) {
+ xRectangle *xrects, *p;
+ ddDeviceRect *ddrects;
+ RegionPtr clipRegion;
+ RegionRec tempRegion;
+ GCPtr pGC;
+ BoxRec box;
+ int i;
+
+ ddrects = (ddDeviceRect *) pRend->clipList->pList;
+ xrects = (xRectangle*) xalloc (numrects * sizeof(xRectangle));
+ if (!xrects) return BadAlloc;
+ /* Need to convert to XRectangle format */
+ for (i = 0, p = xrects; i < numrects; i++, p++, ddrects++) {
+ p->x = ddrects->xmin;
+ p->y = pRend->pDrawable->height - ddrects->ymax;
+ p->width = ddrects->xmax - ddrects->xmin + 1;
+ p->height = ddrects->ymax - ddrects->ymin + 1;
+ }
+
+ /*
+ * Compute the intersection of the viewport and the GC's
+ * clip region. Note that there is a GC for each of the
+ * primitive types, and we only have to compute the
+ * intersected region for one of them. This computed region
+ * will be good for all of the GC's.
+ */
+
+ pGC = pddc->Static.misc.pPolylineGC;
+
+ clipRegion = RECTS_TO_REGION(pGC->pScreen, numrects,
+ xrects, Unsorted);
+
+ xfree((char *) xrects);
+
+ box.x1 = viewport.x;
+ box.y1 = viewport.y;
+ box.x2 = viewport.x + viewport.width;
+ box.y2 = viewport.y + viewport.height;
+
+ REGION_INIT(pGC->pScreen, &tempRegion, &box, 1);
+ REGION_INTERSECT(pGC->pScreen, clipRegion, clipRegion, &tempRegion);
+ REGION_UNINIT(pGC->pScreen, &tempRegion);
+
+
+ /*
+ * Now set the GC clip regions.
+ */
+
+ SetViewportClip (pddc->Static.misc.pPolylineGC, clipRegion);
+ SetViewportClip (pddc->Static.misc.pFillAreaGC, clipRegion);
+ SetViewportClip (pddc->Static.misc.pEdgeGC, clipRegion);
+ SetViewportClip (pddc->Static.misc.pPolyMarkerGC, clipRegion);
+ SetViewportClip (pddc->Static.misc.pTextGC, clipRegion);
+
+ REGION_DESTROY(pGC->pScreen, clipRegion);
+ }
+ else {
+ SetClipRects(pddc->Static.misc.pPolylineGC,
+ 0, 0, 1, &viewport,YXBanded);
+ SetClipRects(pddc->Static.misc.pFillAreaGC,
+ 0, 0, 1, &viewport,YXBanded);
+ SetClipRects(pddc->Static.misc.pEdgeGC,
+ 0, 0, 1, &viewport,YXBanded);
+ SetClipRects(pddc->Static.misc.pPolyMarkerGC,
+ 0, 0, 1, &viewport,YXBanded);
+ SetClipRects(pddc->Static.misc.pTextGC,
+ 0, 0, 1, &viewport,YXBanded);
+ }
+ }
+ }
+
+ /*
+ * Note that Phigs requires that aspect ratio be maintained.
+ * Therefore, choose the minimum X or y ratio to represent the
+ * x and y view port scaling factor. Note that Z is exempt
+ * from this aspect ratio restriction.
+ */
+ Sxy = (Sx < Sy) ? Sx : Sy;
+
+ /*
+ * Finally, set the viewport transform components using Sxy, Sz,
+ * and the initial Tx, Ty, Tz modified suitably.
+ */
+
+ xform[0][0]= Sxy;
+ /* Negate the value to "flip" the screen (see above), IF WE ARE */
+ /* RENDERING. On the other hand, since we are PICKING, we need */
+ /* the PHIGS DC, i.e., the lower left is the origin and NO FLIP */
+ /* of y is required. */
+ /* In case pddc is NULL, this routine is being called from Map- */
+ /* DcWc and the situation is similar to PICKING. i.e., No y flip*/
+ /* is required. */
+ if ((pRend->render_mode == MI_REND_PICKING) || (!pddc))
+ xform[1][1]= Sxy;
+ else if ((pRend->render_mode == MI_REND_DRAWING) && (pddc))
+ xform[1][1]= -Sxy;
+ xform[2][2]= Sz;
+
+ xform[0][3] = Tx - (pRend->npcSubvolume.minval.x * Sxy);
+
+ /* Note, the "+" compensates for negating the [1][1] term above */
+ if ((pRend->render_mode == MI_REND_PICKING) || (!pddc))
+ xform[1][3]= Ty - (pRend->npcSubvolume.minval.y * Sxy);
+ else if ((pRend->render_mode == MI_REND_DRAWING) && (pddc))
+ xform[1][3]= Ty + (pRend->npcSubvolume.minval.y * Sxy);
+
+ xform[2][3]= Tz - (pRend->npcSubvolume.minval.z * Sz);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ if (pddc)
+ pddc->Static.misc.flags |= ( INVTRCCTODCXFRMFLAG );
+
+}
+
+/*++
+ |
+ | Function Name: miBldCC_xform
+ |
+ | Function Description:
+ | Computes the transformation to go from NPC to the PEX-SI's
+ | clipping space.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miBldCC_xform(pRend, pddc)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd context handle */
+
+{
+
+ ddNpcSubvolume *cliplimits;
+ miViewEntry *viewbundle;
+ ddFLOAT cc_to_npc[4][4];
+ ddUSHORT status;
+
+ /*
+ * Check if a view LUT is available and accordingly, get the view
+ * matrices either from the view LUT or from the defaults.
+ */
+
+ if (!(pRend->lut[PEXViewLUT])) { /* Use defaults */
+
+ memcpy( (char *) pddc->Dynamic->npc_to_cc_xform,
+ (char *) ident4x4,
+ 16 * sizeof(ddFLOAT));
+ pddc->Dynamic->npc_to_cc_xform[0][0] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[1][1] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[2][2] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[0][3] = -1.0;
+ pddc->Dynamic->npc_to_cc_xform[1][3] = -1.0;
+ pddc->Dynamic->npc_to_cc_xform[2][3] = -1.0;
+
+ memcpy( (char *) pddc->Dynamic->wc_to_npc_xform,
+ (char *) ident4x4,
+ 16*(sizeof(ddFLOAT)));
+
+ memcpy( (char *) cc_to_npc,
+ (char *) ident4x4,
+ 16 * sizeof(ddFLOAT));
+ cc_to_npc[0][0] = 0.5;
+ cc_to_npc[1][1] = 0.5;
+ cc_to_npc[2][2] = 0.5;
+ cc_to_npc[0][3] = 0.5;
+ cc_to_npc[1][3] = 0.5;
+ cc_to_npc[2][3] = 0.5;
+
+/* THIS SHOULD GO AWAY EVENTUALLY... */
+pddc->Dynamic->clipFlags = 0;
+
+ } else {
+
+ /* Get the view table entry at current view index first */
+
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ pddc->Dynamic->pPCAttr->viewIndex,
+ &status, (ddPointer *)(&viewbundle)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ miMatCopy(viewbundle->vom, pddc->Dynamic->wc_to_npc_xform);
+
+/* THIS SHOULD GO AWAY EVENTUALLY... */
+pddc->Dynamic->clipFlags = viewbundle->entry.clipFlags;
+
+ if (viewbundle->entry.clipFlags)
+ {
+ /* Use the clip limits as set up in the current view */
+
+ cliplimits = &viewbundle->entry.clipLimits;
+ /*
+ * Compute the npc_to_cc & cc_to_npc
+ * transformations.
+ * The Pex view clipper can only clip against a cube with
+ * corners (-1,-1,-1) (1,1,1).
+ * It is therefore necessary to append an additional
+ * transformation to the wc_to_cc_xform transform such
+ * that the view clip volume is transformed to this cube,
+ * rather than leave the space untouched and clip against actual
+ * clip planes specified in the view lut.
+ * Note that this transformation must be undone by the
+ * subsequent cc_to_dc_xform, so the inverse of this
+ * matrix is pre-pended to this transform.
+ *
+ * two matrices then (note these extend trivially into 3D):
+ *
+ * NPC subvolume SI clipping space
+ *
+ * +-----+(c,d) +--------+(1,1)
+ * | | | |
+ * | | <====> | |
+ * | | | |
+ * (a,b)+-----+ (-1,-1)+--------+
+ *
+ * npc_to_clip: 2/(c-a) 0 0
+ * 0 2/(d-b) 0
+ * (c+a)/(a-c) (d+b)/b-d) 0
+ *
+ * clip_to_npc: (c-a)/2 0 0
+ * 0 (d-b)/2 0
+ * (c+a)/2 (d+b)/2 0
+ *
+ * Last, note that the cliplimits from the view table entry are only
+ * used if enabled by the clip flags.
+ */
+ memcpy( (char *) pddc->Dynamic->npc_to_cc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) cc_to_npc,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* set up X & Y clip limits */
+
+ if (viewbundle->entry.clipFlags & PEXClipXY) {
+ pddc->Dynamic->npc_to_cc_xform[0][0] =
+ 2.0/(cliplimits->maxval.x - cliplimits->minval.x);
+ pddc->Dynamic->npc_to_cc_xform[1][1] =
+ 2.0/(cliplimits->maxval.y - cliplimits->minval.y);
+ pddc->Dynamic->npc_to_cc_xform[0][3] =
+ (cliplimits->maxval.x + cliplimits->minval.x) /
+ (cliplimits->minval.x - cliplimits->maxval.x);
+ pddc->Dynamic->npc_to_cc_xform[1][3] =
+ (cliplimits->maxval.y + cliplimits->minval.y) /
+ (cliplimits->minval.y - cliplimits->maxval.y);
+
+ cc_to_npc[0][0] =
+ (cliplimits->maxval.x - cliplimits->minval.x)/2.0;
+ cc_to_npc[1][1] =
+ (cliplimits->maxval.y - cliplimits->minval.y)/2.0;
+ cc_to_npc[0][3] =
+ (cliplimits->maxval.x + cliplimits->minval.x)/2.0;
+ cc_to_npc[1][3] =
+ (cliplimits->maxval.y + cliplimits->minval.y)/2.0;
+ } else {
+
+ /* Use default NPC clip limits (0.0 <-> 1.0) */
+
+ pddc->Dynamic->npc_to_cc_xform[0][0] = 2.0/(1.0 - 0.0);
+ pddc->Dynamic->npc_to_cc_xform[1][1] = 2.0/(1.0 - 0.0);
+ pddc->Dynamic->npc_to_cc_xform[0][3] = (1.0 + 0.0)/(0.0 - 1.0);
+ pddc->Dynamic->npc_to_cc_xform[1][3] = (1.0 + 0.0)/(0.0 - 1.0);
+
+ cc_to_npc[0][0] = (1.0 - 0.0)/2.0;
+ cc_to_npc[1][1] = (1.0 - 0.0)/2.0;
+ cc_to_npc[0][3] = (1.0 + 0.0)/2.0;
+ cc_to_npc[1][3] = (1.0 + 0.0)/2.0;
+ }
+
+ /* Now, front & back clip limits */
+
+ if ( (viewbundle->entry.clipFlags & PEXClipFront) &&
+ (viewbundle->entry.clipFlags & PEXClipBack) ) {
+
+ /* Both front and back clipping on */
+
+ pddc->Dynamic->npc_to_cc_xform[2][2] =
+ 2.0/(cliplimits->maxval.z - cliplimits->minval.z);
+ pddc->Dynamic->npc_to_cc_xform[2][3] =
+ (cliplimits->maxval.z + cliplimits->minval.z) /
+ (cliplimits->minval.z - cliplimits->maxval.z);
+
+ cc_to_npc[2][2] =
+ (cliplimits->maxval.z - cliplimits->minval.z)/2.0;
+ cc_to_npc[2][3] =
+ (cliplimits->maxval.z + cliplimits->minval.z)/2.0;
+
+ } else if (viewbundle->entry.clipFlags & PEXClipFront) {
+
+ /* Only front clipping ON; Use default NPC Back value */
+
+ pddc->Dynamic->npc_to_cc_xform[2][2] =
+ 2.0/(1.0 - cliplimits->minval.z);
+ pddc->Dynamic->npc_to_cc_xform[2][3] =
+ (1.0 + cliplimits->minval.z) /
+ (cliplimits->minval.z - 1.0);
+
+ cc_to_npc[2][2] =
+ (1.0 - cliplimits->minval.z)/2.0;
+ cc_to_npc[2][3] =
+ (1.0 + cliplimits->minval.z)/2.0;
+
+ } else if (viewbundle->entry.clipFlags & PEXClipBack) {
+
+ /* Only back clipping ON; Use default NPC Front value */
+
+ pddc->Dynamic->npc_to_cc_xform[2][2] = 2.0/(cliplimits->maxval.z);
+ pddc->Dynamic->npc_to_cc_xform[2][3] = -1.0;
+
+ cc_to_npc[2][2] = (cliplimits->maxval.z)/2.0;
+ cc_to_npc[2][3] = (cliplimits->maxval.z)/2.0;
+
+ } else {
+
+ /* Both front and back clipping OFF; Use default NPC space */
+
+ pddc->Dynamic->npc_to_cc_xform[2][2] = 2.0/(1.0 - 0.0);
+ pddc->Dynamic->npc_to_cc_xform[2][3] = (1.0 + 0.0) / (0.0 - 1.0);
+
+ cc_to_npc[2][2] = (1.0 - 0.0)/2.0;
+ cc_to_npc[2][3] = (1.0 + 0.0)/2.0;
+ }
+
+ }
+ else /* All clipping OFF; Use the entire NPC space, i.e., (0,0,0) */
+ /* to (1,1,1) */
+ {
+
+ memcpy( (char *) pddc->Dynamic->npc_to_cc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ pddc->Dynamic->npc_to_cc_xform[0][0] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[1][1] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[2][2] = 2.0;
+ pddc->Dynamic->npc_to_cc_xform[0][3] = -1.0;
+ pddc->Dynamic->npc_to_cc_xform[1][3] = -1.0;
+ pddc->Dynamic->npc_to_cc_xform[2][3] = -1.0;
+
+ memcpy( (char *) cc_to_npc,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ cc_to_npc[0][0] = 0.5;
+ cc_to_npc[1][1] = 0.5;
+ cc_to_npc[2][2] = 0.5;
+ cc_to_npc[0][3] = 0.5;
+ cc_to_npc[1][3] = 0.5;
+ cc_to_npc[2][3] = 0.5;
+
+ }
+ }
+
+ /*
+ * Compute the various composites stored in the
+ * dd context.
+ */
+ /*
+ * Compute the composite cc -> dc, i.e., Clip to Device.
+ */
+ miMatMult ( pddc->Dynamic->cc_to_dc_xform,
+ cc_to_npc,
+ pddc->Static.misc.viewport_xform);
+
+ /*
+ * Compute the composite wc -> cc, i.e., World to Clip.
+ */
+ miMatMult ( pddc->Dynamic->wc_to_cc_xform,
+ pddc->Dynamic->wc_to_npc_xform,
+ pddc->Dynamic->npc_to_cc_xform);
+ /*
+ * Compute the composite mc -> wc, i.e. Modelling to World
+ */
+ miMatMult( pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ /*
+ * Compute the composite mc -> npc, i.em Modelling to NPC
+ */
+ miMatMult ( pddc->Dynamic->mc_to_npc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_npc_xform);
+
+ /*
+ * Compute the composite [VCM], i.e, Modelling to Clip.
+ */
+ miMatMult ( pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_cc_xform);
+ /*
+ * Compute the composite mc -> dc transform, i.e., Modelling to Device.
+ */
+ miMatMult ( pddc->Dynamic->mc_to_dc_xform,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->cc_to_dc_xform);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRWCTOCCXFRMFLAG | INVTRMCTOCCXFRMFLAG |
+ INVVIEWXFRMFLAG | CC_DCUEVERSION);
+
+}
+
+
+void SetViewportClip(pGC, clipRegion)
+ GCPtr pGC;
+ RegionPtr clipRegion;
+{
+ /*
+ * When we call the GC's ChangeClip function, it destroys
+ * the region we pass to it. Since this function is called
+ * for each of the GC's, we copy clipRegion into tempRegion
+ * and use tempRegion when calling ChangeClip.
+ */
+
+ RegionPtr tempRegion = REGION_CREATE(pGC->pScreen, NullBox, 0);
+
+ REGION_COPY(pGC->pScreen, tempRegion, clipRegion);
+
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ pGC->stateChanges |= GCClipXOrigin|GCClipYOrigin;
+ (*pGC->funcs->ChangeClip)(pGC, CT_REGION, tempRegion, 0);
+ if (pGC->funcs->ChangeGC)
+ (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCellArray.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCellArray.c
new file mode 100644
index 000000000..b0f51733d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCellArray.c
@@ -0,0 +1,266 @@
+/* $TOG: miCellArray.c /main/7 1998/02/10 12:40:49 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miCellArray.c,v 3.6 1998/10/04 09:34:17 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "ddpex2.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miCellArray
+ |
+ | Function Description:
+ |
+ | Draws the outline of the cell array parallelogram using
+ | the current polyline attributes.
+ |
+ | Note(s): A whole lot-o work needs to be done in order to
+ | support full color indexing (which is really an
+ | attempt at texture mapping)
+ |
+ | The Parse routine (in pexOCParse) should be enhanced to detect
+ | whether |dR|, |dQ|, dx or dy are of zero length
+ |
+ |
+ |
+ --*/
+
+
+ddpex3rtn
+miCellArray(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend;
+ miGenericStr *pExecuteOC;
+
+ {
+
+/***************************************************************************/
+
+ /* calls */
+ extern ocTableType InitExecuteOCTable[];
+
+ /* Local variable definitions */
+ miGenericStr *pGStr;
+ miCellArrayStruct *ddCell = (miCellArrayStruct *)(pExecuteOC+1);
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *input = &ddCell->point;
+ miPolylineStruct *output;
+ listofddPoint *pddolist;
+ int point_size, nGridLines, i;
+ ddPointUnion in_pt, out_pt, Ppt, Qpt, Rpt, Spt;
+ ddpex3rtn status;
+ ddCoord3D dRpt, dQpt, x_step, y_step,
+ basept, endpt;
+ ddCoord2D tempQ, tempR;
+
+
+
+/*
+ * A Cell Array is defined by three points, P, Q, and R-> This
+ * defines a parallelogram, closed by an implied S
+ *
+ * P-----(dR)---->R
+ * \ \
+ * \ \
+ * (dQ) \
+ * \ \
+ * \ \
+ * Q--------------S (implied)
+ *
+ * S = P + dR + dQ
+ */
+
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miPolylineStruct)))))
+ return(BadAlloc);
+
+ pGStr->elementType = PEXOCPolylineSet;
+
+ output = (miPolylineStruct *) (pGStr + 1);
+
+ /* We need to initialize the maxLists to zero since the MI_ALLOCLISTHEADER
+ macro does reallocs only when necessary, based on this field. The
+ intent is to use the temp lists of the renderer over & over, but
+ in this case we are not getting a header from MI_NEXTTEMPDATALIST */
+
+ output->maxLists = 0;
+
+ nGridLines = (ddCell->dx) + (ddCell->dy) + 2;
+ MI_ALLOCLISTHEADER(output,MI_ROUND_LISTHEADERCOUNT(nGridLines));
+
+ point_size = sizeof(ddCoord3DL);
+ for(i = 0, pddolist = output->ddList; i < nGridLines; i++){
+ MI_ALLOCLISTOFDDPOINT(pddolist, 2, point_size);
+ pddolist++;
+ }
+
+ /* Initialize output listHeader */
+ output->type = DD_3D_POINT;
+ output->flags = input->flags;
+ output->numLists = nGridLines;
+
+ /* Get input points */
+ if (DD_IsVert3D(input->type))
+ {
+ Ppt.ptr = ddCell->point.ddList->pts.ptr;
+ Rpt.ptr = Ppt.ptr + sizeof(ddCoord3D);
+ Qpt.ptr = Rpt.ptr + sizeof(ddCoord3D);
+ }
+ else
+ {
+ Ppt.ptr = ddCell->point.ddList->pts.ptr;
+ Spt.ptr = Ppt.ptr + sizeof(ddCoord2D);
+
+ tempR.x = Spt.p2Dpt->x;
+ tempR.y = Ppt.p2Dpt->y;
+ tempQ.x = Ppt.p2Dpt->x;
+ tempQ.y = Spt.p2Dpt->y;
+
+ Rpt.p2Dpt = &tempR;
+ Qpt.p2Dpt = &tempQ;
+ }
+
+ /* Calculate DQ and DR */
+ dQpt.x = Qpt.p2Dpt->x - Ppt.p2Dpt->x;
+ dQpt.y = Qpt.p2Dpt->y - Ppt.p2Dpt->y;
+ dRpt.x = Rpt.p2Dpt->x - Ppt.p2Dpt->x;
+ dRpt.y = Rpt.p2Dpt->y - Ppt.p2Dpt->y;
+
+ /* Calculate step sizes for grid lines */
+ x_step.x = (dRpt.x / ddCell->dx);
+ x_step.y = (dRpt.y / ddCell->dx);
+ y_step.x = (dQpt.x / ddCell->dy);
+ y_step.y = (dQpt.y / ddCell->dy);
+
+ /* Add Z component if necessary */
+ if DD_IsVert3D(input->type) {
+ dQpt.z = Rpt.p3Dpt->z - Ppt.p3Dpt->z;
+ dRpt.z = Qpt.p3Dpt->z - Ppt.p3Dpt->z;
+ x_step.z = (dRpt.z / ddCell->dx);
+ y_step.z = (dRpt.z / ddCell->dy);
+ } else {
+ x_step.z = 0.0;
+ y_step.z = 0.0;
+ }
+
+ basept.x = Ppt.p2Dpt->x;
+ basept.y = Ppt.p2Dpt->y;
+ if DD_IsVert3D(input->type) basept.z = Ppt.p3Dpt->z;
+ else basept.z = 0.0;
+
+ pddolist = output->ddList;
+ /* "x" lines */
+ for(i = 0, out_pt.ptr = pddolist->pts.ptr;
+ i <= ddCell->dy; i++){
+
+ out_pt.ptr = pddolist->pts.ptr;
+ endpt.x = basept.x + dRpt.x;
+ endpt.y = basept.y + dRpt.y;
+ endpt.z = basept.z + dRpt.z;
+
+ memcpy( out_pt.ptr, (char *)&basept, point_size);
+ out_pt.ptr += point_size;
+ memcpy( out_pt.ptr, (char *)&endpt, point_size);
+ out_pt.ptr += point_size;
+
+ basept.x += y_step.x;
+ basept.y += y_step.y;
+ basept.z += y_step.z;
+
+ pddolist->numPoints = 2;
+ pddolist++;
+ }
+
+ basept.x = Ppt.p2Dpt->x;
+ basept.y = Ppt.p2Dpt->y;
+ if DD_IsVert3D(input->type) basept.z = Ppt.p3Dpt->z;
+ else basept.z = 0.0;
+
+ /* "y" lines */
+ for(i = 0; i <= ddCell->dx; i++){
+
+ out_pt.ptr = pddolist->pts.ptr;
+ endpt.x = basept.x + dQpt.x;
+ endpt.y = basept.y + dQpt.y;
+ endpt.z = basept.z + dQpt.z;
+
+ memcpy( out_pt.ptr, (char *)&basept, point_size);
+ out_pt.ptr += point_size;
+ memcpy( out_pt.ptr, (char *)&endpt, point_size);
+ out_pt.ptr += point_size;
+
+ basept.x += x_step.x;
+ basept.y += x_step.y;
+ basept.z += x_step.z;
+
+ pddolist->numPoints = 2;
+ pddolist++;
+ }
+ output->numLists = nGridLines;
+
+ /* Call Polyline routine with output array */
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ /* clean up memory allocation */
+
+ for(i = 0, pddolist = output->ddList; i < nGridLines; i++){
+ xfree((char *)pddolist->pts.ptr);
+ pddolist++;
+ }
+ xfree((char *)output->ddList);
+ xfree((char *)pGStr);
+
+ return(status);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miClip.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miClip.c
new file mode 100644
index 000000000..8866cc04f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miClip.c
@@ -0,0 +1,246 @@
+/* $TOG: miClip.c /main/5 1998/02/10 12:40:54 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miClip.c,v 3.5 1998/10/04 09:34:17 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miClip.h"
+#include "gcstruct.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miClipPointList
+ |
+ | Function Description:
+ | Clips each point is a listofddPoint. Clipping here means
+ | that the point is either copied or not copied to the
+ | output list.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miClipPointList(pddc, vinput, voutput, clip_mode)
+/* in */
+ miDDContext *pddc;
+ miListHeader *vinput;
+ miListHeader **voutput;
+ ddUSHORT clip_mode;
+{
+
+/* uses */
+ char *in_pt;
+ char *out_pt;
+ miListHeader *output;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int num_lists;
+ int vert_count;
+ int num_points;
+ int point_size, clip_code;
+ int j,k, num_passes;
+ float t;
+ ddUSHORT oc, clipflags;
+ ddHalfSpace *MC_HSpace;
+
+ /* Vertex data must be homogeneous for clipper */
+ if (!(DD_IsVert4D(vinput->type))) return(1);
+
+ /* Reformat clipflags to internal format */
+ if (pddc->Dynamic->clipFlags & PEXClipXY)
+ clipflags=(MI_CLIP_LEFT | MI_CLIP_RIGHT | MI_CLIP_TOP | MI_CLIP_BOTTOM);
+ else clipflags = 0;
+ if (pddc->Dynamic->clipFlags & PEXClipFront) clipflags |= MI_CLIP_FRONT;
+ if (pddc->Dynamic->clipFlags & PEXClipBack) clipflags |= MI_CLIP_BACK;
+
+ /* Use the pre-defined clip list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Allocate an initial number of headers */
+ MI_ALLOCLISTHEADER(output, MI_ROUND_LISTHEADERCOUNT(vinput->numLists))
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = vinput->type;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+ DD_VertPointSize(vinput->type, point_size);
+
+ num_lists = 0;
+
+ /* Now, clip each list */
+ for (j = 0; j < vinput->numLists; j++) {
+
+ /* Skip list if no points */
+ if ((vert_count = pddilist->numPoints) <= 0) {
+ pddilist++;
+ continue;
+ }
+
+ /* Insure sufficient room for each vertex */
+ MI_ALLOCLISTOFDDPOINT(pddolist, vert_count, point_size);
+ if (!(out_pt = pddolist->pts.ptr)) return(BadAlloc);
+
+ in_pt = pddilist->pts.ptr;
+
+ num_points = 0;
+
+
+ /* For each vertex, clip a polyline segment */
+ while (vert_count--) {
+
+ /* this is really only used for annotation text, so going */
+ /* through all the half-spaces for each point is not */
+ /* a big deal */
+
+ CLIP_POINT4D(in_pt, oc, clip_mode);
+
+ if (!(oc)) {
+ /* Copy the next point into the clip array */
+ memcpy( out_pt, in_pt, point_size);
+ num_points++;
+ out_pt += point_size;
+ }
+
+ /* skip to next point */
+ in_pt += point_size;
+ }
+
+ /* skip to next list */
+ pddilist++;
+
+ /* Don't increment list count unless points were added to last list */
+ if (num_points > 0) {
+ pddolist->numPoints = num_points;
+ num_lists++;
+ pddolist++;
+ }
+ }
+
+
+ output->numLists = num_lists;
+
+ return (Success);
+
+}
+
+
+
+/*++
+ |
+ | ComputeMCVolume(pRend, pddc)
+ |
+ | Compute a modelling coordinate version of the model clipping
+ | volume;
+ |
+ --*/
+ddpex3rtn
+ComputeMCVolume(pRend, pddc)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+{
+ extern void miMatCopy();
+ extern void miMatMatInverse();
+
+ ddHalfSpace *wcHS, /* world coord half spaces */
+ mcHS; /* model coord half spaces */
+
+ int i, count;
+ float pxform[4][4]; /* point transform */
+ float vxform[4][4]; /* vector transform */
+ float length;
+
+
+ /* check to see if already computed */
+ if (pddc->Static.misc.flags & MCVOLUMEFLAG) {
+
+ /* Verify inverse transform */
+ VALIDATEINVTRMCTOWCXFRM(pddc);
+
+ /* Don't want transpose of inverse for point xform! */
+ miMatCopy(pddc->Static.misc.inv_tr_mc_to_wc_xform,
+ pxform);
+ miMatTranspose(pxform);
+
+ /* Want transpose of forward point xform for inverse vector xform */
+ miMatCopy(pddc->Dynamic->mc_to_wc_xform, vxform);
+ miMatTranspose(vxform);
+
+ count = pddc->Dynamic->pPCAttr->modelClipVolume->numObj;
+ wcHS = (ddHalfSpace *)(pddc->Dynamic->pPCAttr->modelClipVolume->pList);
+
+ pddc->Static.misc.ms_MCV->numObj = 0;
+
+ for(i = 0; i < count; i++) {
+
+ miTransformPoint(&wcHS->point, pxform,
+ &mcHS.point);
+
+ miTransformVector(&wcHS->vector, vxform, &mcHS.vector);
+
+ NORMALIZE_VECTOR(&mcHS.vector, length);
+
+ DOT_PRODUCT(&mcHS.vector, &mcHS.point, mcHS.dist);
+
+ puAddToList(&mcHS, 1, pddc->Static.misc.ms_MCV);
+
+ ++wcHS;
+
+ }
+
+ /* Clear ddc status flag */
+ pddc->Static.misc.flags &= ~MCVOLUMEFLAG;
+ }
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miConvert.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miConvert.c
new file mode 100644
index 000000000..65c093643
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miConvert.c
@@ -0,0 +1,954 @@
+/* $TOG: miConvert.c /main/8 1998/02/10 12:40:59 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miConvert.c,v 1.7 1998/10/04 09:34:17 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "pexos.h"
+
+
+typedef void (*ColorConversionTableType)();
+static void PEXIndexedColour_to_PEXRdrColourModelRGB();
+static void PEXRgb8Colour_to_PEXRdrColourModelRGB();
+static void PEXRgb16Colour_to_PEXRdrColourModelRGB();
+static void NoChange();
+
+/*
+ * Color conversion jump table for miConvertVertexColors,
+ * miConvertFacetColors and miConvertColor.
+ *
+ * Note that only conversions supported are
+ *
+ * indexed ->rgbFloat
+ * Rgb8 ->rgbFloat
+ * Rgb16 ->rgbFloat
+ *
+ */
+
+static
+ColorConversionTableType
+ColourConversionRoutine[(PEXRdrColourModelHLS+1)*(PEXMaxColour+1)] = {
+/* Convert to Implementation dependant Color Model */
+ PEXIndexedColour_to_PEXRdrColourModelRGB, /* Indexed -> ImpDep */
+ NoChange, /* RgbFloat -> ImpDep */
+ NULL, /* Cie -> ImpDep */
+ NULL, /* Hsv -> ImpDep */
+ NULL, /* Hls -> ImpDep */
+ PEXRgb8Colour_to_PEXRdrColourModelRGB, /* Rgb8 -> ImpDep */
+ PEXRgb16Colour_to_PEXRdrColourModelRGB, /* Rgb16 -> ImpDep */
+/* Convert to Rgb Float */
+ PEXIndexedColour_to_PEXRdrColourModelRGB, /* Indexed -> RgbFloat */
+ NoChange, /* RgbFloat -> RgbFloat */
+ NULL, /* Cie -> RgbFloat */
+ NULL, /* Hsv -> RgbFloat */
+ NULL, /* Hls -> RgbFloat */
+ PEXRgb8Colour_to_PEXRdrColourModelRGB, /* Rgb8 -> RgbFloat */
+ PEXRgb16Colour_to_PEXRdrColourModelRGB, /* Rgb16 -> RgbFloat */
+/* Convert to Cie Float */
+ NULL, /* Indexed -> CieFloat */
+ NULL, /* RgbFloat -> CieFloat */
+ NULL, /* Cie -> CieFloat */
+ NULL, /* Hsv -> CieFloat */
+ NULL, /* Hls -> CieFloat */
+ NULL, /* Rgb8 -> CieFloat */
+ NULL, /* Rgb16 -> CieFloat */
+/* Convert to Hsv Float */
+ NULL, /* Indexed -> HsvFloat */
+ NULL, /* RgbFloat -> HsvFloat */
+ NULL, /* Cie -> HsvFloat */
+ NULL, /* Hsv -> HsvFloat */
+ NULL, /* Hls -> HsvFloat */
+ NULL, /* Rgb8 -> HsvFloat */
+ NULL, /* Rgb16 -> HsvFloat */
+/* Convert to Hls Float */
+ NULL, /* Indexed -> HlsFloat */
+ NULL, /* RgbFloat -> HlsFloat */
+ NULL, /* Cie -> HlsFloat */
+ NULL, /* Hsv -> HlsFloat */
+ NULL, /* Hls -> HlsFloat */
+ NULL, /* Rgb8 -> HlsFloat */
+ NULL, /* Rgb16 -> HlsFloat */
+};
+
+/*++
+ |
+ | Function Name: PEXIndexedColour_to_PEXRdrColourModelRGB
+ |
+ | Function Description:
+ | Convert vertex colors to the specified rendering color model
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+void
+PEXIndexedColour_to_PEXRdrColourModelRGB(pRend, in_col, out_col)
+ddRendererPtr pRend; /* renderer handle */
+ddIndexedColour **in_col;
+ddRgbFloatColour **out_col;
+{
+ miColourEntry *pintcolour;
+ ddUSHORT status;
+
+ InquireLUTEntryAddress (PEXColourLUT, pRend->lut[PEXColourLUT],
+ ((*in_col)++)->index,
+ &status,
+ (ddPointer *)&pintcolour);
+
+ /* Insure that LUT entry is in correct color model */
+ if (pintcolour->entry.colourType != PEXRgbFloatColour)
+ ColourConversionRoutine[pintcolour->entry.colourType*PEXRdrColourModelRGB]
+ (pRend, &pintcolour->entry.colour.rgbFloat, out_col);
+ else *((*out_col)++) = pintcolour->entry.colour.rgbFloat;
+
+}
+
+/*++
+ |
+ | Function Name: PEXRgb8Colour_to_PEXRdrColourModelRGB
+ |
+ | Function Description:
+ | Convert vertex colors to the specified rendering color model
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+void
+PEXRgb8Colour_to_PEXRdrColourModelRGB(pRend, in_col, out_col)
+ddRendererPtr pRend; /* renderer handle */
+ddRgb8Colour **in_col;
+ddRgbFloatColour **out_col;
+{
+ (*out_col)->red = (*in_col)->red;
+ (*out_col)->green = (*in_col)->green;
+ ((*out_col)++)->blue = ((*in_col)++)->blue;
+}
+
+/*++
+ |
+ | Function Name: PEXRgb16Colour_to_PEXRdrColourModelRGB
+ |
+ | Function Description:
+ | Convert vertex colors to the specified rendering color model
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+void
+PEXRgb16Colour_to_PEXRdrColourModelRGB(pRend, in_col, out_col)
+ddRendererPtr pRend; /* renderer handle */
+ddRgb16Colour **in_col;
+ddRgbFloatColour **out_col;
+{
+ (*out_col)->red = (*in_col)->red;
+ (*out_col)->green = (*in_col)->green;
+ ((*out_col)++)->blue = ((*in_col)++)->blue;
+}
+
+/*++
+ |
+ | Function Name: NoChange
+ |
+ | Function Description:
+ | Dummy label to indicate no color change needed.
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+void
+NoChange(pRend, in_col, out_col)
+ddRendererPtr pRend; /* renderer handle */
+ddRgb16Colour **in_col;
+ddRgbFloatColour **out_col;
+{
+}
+
+/*++
+ |
+ | Function Name: miConvertColor
+ |
+ | Function Description:
+ | Converts a ddColourSpecifier to the specified rendering color model.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miConvertColor(pRend, cinput, rdrColourModel, coutput)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+ddColourSpecifier *cinput; /* input color */
+ddSHORT rdrColourModel; /* output color model */
+/* out */
+ddColourSpecifier *coutput; /* output color */
+{
+/* uses */
+ ColorConversionTableType convert;
+ ddSHORT input_color;
+ char *icolptr;
+ char *ocolptr;
+
+ /* find proper conversion routine */
+ convert = ColourConversionRoutine[cinput->colourType*rdrColourModel];
+
+ /* convert is 1 if input and output color model are the same */
+ if (convert == NoChange) {
+ /* no conversion necessary */
+ *coutput = *cinput;
+ return Success;
+ }
+
+ /* convert is NULL if output color model not supported */
+ if (convert == NULL) {
+ return 1;
+ }
+
+ /* set output color type */
+ switch(rdrColourModel) {
+ case PEXRdrColourModelImpDep:
+ coutput->colourType = PEXRgbFloatColour;
+ break;
+ case PEXRdrColourModelRGB:
+ coutput->colourType = PEXRgbFloatColour;
+ break;
+ case PEXRdrColourModelHSV:
+ coutput->colourType = PEXHsvFloatColour;
+ break;
+ case PEXRdrColourModelHLS:
+ coutput->colourType = PEXHlsFloatColour;
+ break;
+ case PEXRdrColourModelCIE:
+ coutput->colourType = PEXCieFloatColour;
+ break;
+ }
+
+ /* convert color data */
+ icolptr = (char *)&(cinput->colour.indexed);
+ ocolptr = (char *)&(coutput->colour.indexed);
+ (*convert)(pRend, &icolptr, &ocolptr);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miConvertVertexColors
+ |
+ | Function Description:
+ | Convert vertex colors to the specified rendering color model
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miConvertVertexColors(pRend, vinput, rdrColourModel, voutput)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+miListHeader *vinput; /* input vertex list */
+ddSHORT rdrColourModel; /* output color model */
+/* out */
+miListHeader **voutput; /* output vertex list */
+{
+/* uses */
+ ddPointUnion in_pt, out_pt;
+ miListHeader *output;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ miDDContext *pddc = (miDDContext *)pRend->pDDContext;
+ int list_count = 0;
+ int vert_count;
+ int point_size, out_point_size;
+ int coord_size;
+ ddPointType type;
+ int i, j;
+ ColorConversionTableType convert;
+ ddSHORT input_color;
+
+ /* if no vertex colors, done! */
+ if (!DD_IsVertColour(vinput->type)) {
+ *voutput = vinput;
+ return Success;
+ }
+
+ /* extract vertex color type */
+ if (DD_IsVertIndexed(vinput->type)) input_color = PEXIndexedColour;
+ else if (DD_IsVertRGBFLOAT(vinput->type)) input_color = PEXRgbFloatColour;
+ else if (DD_IsVertRGB8(vinput->type)) input_color = PEXRgb8Colour;
+ else if (DD_IsVertRGB16(vinput->type)) input_color = PEXRgb16Colour;
+ else if (DD_IsVertHSV(vinput->type)) input_color = PEXHsvFloatColour;
+ else if (DD_IsVertHLS(vinput->type)) input_color = PEXHlsFloatColour;
+ else if (DD_IsVertCIE(vinput->type)) input_color = PEXCieFloatColour;
+
+ /* find proper conversion routine */
+ convert = ColourConversionRoutine[input_color*rdrColourModel];
+
+ /* convert is 1 if input and output color model are the same */
+ if (convert == NoChange) {
+ /* no conversion necessary */
+ *voutput = vinput;
+ return Success;
+ }
+
+ /* convert is NULL if output color model not supported */
+ if (convert == NULL) {
+ return 1;
+ }
+
+ /* Initialize output list */
+ output = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(output, MI_ROUND_LISTHEADERCOUNT(vinput->numLists))
+ if (!output->ddList) return(BadAlloc);
+
+ type = vinput->type;
+ DD_VertPointSize( (type & (DDPT_SHORT | DDPT_4D)), coord_size );
+
+ /* set output color type */
+ switch(rdrColourModel) {
+ case PEXRdrColourModelImpDep:
+ case PEXRdrColourModelRGB:
+ DD_SetVertRGBFLOAT(type);
+ break;
+ case PEXRdrColourModelHSV:
+ DD_SetVertHSV(type);
+ break;
+ case PEXRdrColourModelHLS:
+ DD_SetVertHLS(type);
+ break;
+ case PEXRdrColourModelCIE:
+ DD_SetVertCIE(type);
+ break;
+ }
+ output->type = type;
+ DD_VertPointSize( type, out_point_size );
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /*
+ * Traverse each list.
+ */
+ for (i = 0; i < vinput->numLists; i++) {
+
+ if ((vert_count = pddolist->numPoints = pddilist->numPoints) <= 1) {
+ pddilist++;
+ continue;
+ }
+
+ /* Insure sufficient room for each vertex */
+ MI_ALLOCLISTOFDDPOINT(pddolist, vert_count+1, out_point_size);
+ if (!pddolist->pts.p2DSpt) return(BadAlloc);
+
+ /*
+ * Copy each point and initialize the edges.
+ * Note that the edge flag is always the last
+ * ddULONG of a vertex. Thus incrementing the
+ * destination pointer by the size of the input
+ * point "automatically" places the pointer
+ * at the start of the edge flag field.
+ */
+ in_pt = pddilist->pts;
+ out_pt = pddolist->pts;
+
+ for (j = 0; j < vert_count; j++) {
+
+ /* Copy the coordinate data to the output list */
+ memcpy( out_pt.ptr, in_pt.ptr, coord_size);
+ in_pt.ptr += coord_size;
+ out_pt.ptr += coord_size;
+
+ /* convert the color */
+ (*convert)(pRend, &(in_pt.ptr), &(out_pt.ptr));
+
+ /* Copy the normal data to the output list */
+ if (DD_IsVertNormal(vinput->type))
+ *(out_pt.pNormal++) = *(in_pt.pNormal++);
+
+ /* Copy the edge flag data to the output list */
+ if (DD_IsVertEdge(vinput->type))
+ *(out_pt.pEdge++) = *(in_pt.pEdge++);
+ }
+
+ /* Now, skip to next input list */
+ pddilist++;
+ pddolist++;
+ list_count++;
+ }
+
+ output->numLists = list_count;
+ *voutput = output;
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miConvertFacetColors
+ |
+ | Function Description:
+ | Convert vertex colors to the specified rendering color model
+ |
+ | Note(s):
+ | Currently, this will ONLY convert from indexed -> RGBFLOAT
+ |
+ --*/
+
+ddpex3rtn
+miConvertFacetColors(pRend, finput, rdrColourModel, foutput)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+listofddFacet *finput; /* input facet list */
+ddSHORT rdrColourModel; /* output color model */
+/* out */
+listofddFacet **foutput; /* output facet list */
+{
+ listofddFacet *fct_list;
+ ddFacetUnion in_fct;
+ ddFacetUnion out_fct;
+ miDDContext *pddc = (miDDContext *)pRend->pDDContext;
+ int j;
+ int facet_size;
+ ColorConversionTableType convert;
+ ddSHORT input_color;
+
+ /* if no vertex colors, done! */
+ if ((!DD_IsFacetColour(finput->type)) || (finput->type == DD_FACET_NONE)) {
+ *foutput = finput;
+ return Success;
+ }
+
+ /* extract facet color type */
+ switch(finput->type) {
+ case DD_FACET_INDEX:
+ case DD_FACET_INDEX_NORM:
+ input_color = PEXIndexedColour;
+ break;
+ case DD_FACET_RGB8:
+ case DD_FACET_RGB8_NORM:
+ input_color = PEXRgb8Colour;
+ break;
+ case DD_FACET_RGB16:
+ case DD_FACET_RGB16_NORM:
+ input_color = PEXRgb16Colour;
+ break;
+ case DD_FACET_RGBFLOAT:
+ case DD_FACET_RGBFLOAT_NORM:
+ input_color = PEXRgbFloatColour;
+ break;
+ case DD_FACET_HSV:
+ case DD_FACET_HSV_NORM:
+ input_color = PEXHsvFloatColour;
+ break;
+ case DD_FACET_HLS:
+ case DD_FACET_HLS_NORM:
+ input_color = PEXHlsFloatColour;
+ break;
+ case DD_FACET_CIE:
+ case DD_FACET_CIE_NORM:
+ input_color = PEXCieFloatColour;
+ break;
+ }
+
+ /* find proper conversion routine */
+ convert = ColourConversionRoutine[input_color*rdrColourModel];
+
+ /* convert is 1 if input and output color model are the same */
+ if (convert == NoChange) {
+ /* no conversion necessary */
+ *foutput = finput;
+ return Success;
+ }
+
+ /* convert is NULL if output color model not supported */
+ if (convert == NULL) {
+ return 1;
+ }
+
+ /* Get next free facet list header */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+
+ /* set output color type */
+ switch(rdrColourModel) {
+ case PEXRdrColourModelImpDep:
+ case PEXRdrColourModelRGB:
+ if (DD_IsFacetNormal(finput->type))
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+ else fct_list->type = DD_FACET_RGBFLOAT;
+ break;
+ case PEXRdrColourModelHSV:
+ if (DD_IsFacetNormal(finput->type))
+ fct_list->type = DD_FACET_HSV_NORM;
+ else fct_list->type = DD_FACET_HSV;
+ break;
+ case PEXRdrColourModelHLS:
+ if (DD_IsFacetNormal(finput->type))
+ fct_list->type = DD_FACET_HLS_NORM;
+ else fct_list->type = DD_FACET_HLS;
+ break;
+ case PEXRdrColourModelCIE:
+ if (DD_IsFacetNormal(finput->type))
+ fct_list->type = DD_FACET_CIE_NORM;
+ else fct_list->type = DD_FACET_CIE;
+ break;
+ }
+
+ /*
+ * Allocate storage for the facet list
+ */
+ DDFacetSIZE(fct_list->type, facet_size);
+ MI_ALLOCLISTOFDDFACET(fct_list, finput->numFacets, facet_size);
+ if (!(out_fct.pNoFacet = fct_list->facets.pNoFacet)) return(BadAlloc);
+
+ in_fct = finput->facets;
+
+ /* Remember, facet data is of the form:
+ *
+ * |--------------|--------------------------|
+ * color (opt) normal (opt)
+ */
+
+ for (j = 0; j < finput->numFacets; j++) {
+
+ /* convert the color */
+ (*convert)(pRend, &(in_fct.pNoFacet), &(out_fct.pNoFacet));
+
+ /* Copy the input normal */
+ if (DD_IsFacetNormal(finput->type))
+ *(out_fct.pFacetN++) = *(in_fct.pFacetN++);
+
+ }
+
+ fct_list->numFacets = finput->numFacets;
+ *foutput = fct_list;
+
+ return(Success);
+
+}
+
+/*++
+ |
+ | Function Name: miColourtoIndex
+ |
+ | Function Description:
+ | Convert a direct color to an index using the
+ | color approximation table.
+ |
+ | Note(s):
+ | Dithering is ignored as there is no screen data with which to dither.
+ |
+ --*/
+
+ddpex3rtn
+miColourtoIndex(pRend, colourApproxIndex, directcolour, colourindex)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+ddTableIndex colourApproxIndex; /* colour approx table index */
+ddColourSpecifier *directcolour; /* Direct colour input */
+/* out */
+ddULONG *colourindex; /* output colour index */
+{
+ miColourApproxEntry *pLUT;
+ ddColourApproxEntry *pentry;
+ ddUSHORT status;
+
+ /* Fetch current color approximation table entry */
+ if ((InquireLUTEntryAddress (PEXColourApproxLUT,
+ pRend->lut[PEXColourApproxLUT],
+ colourApproxIndex,
+ &status, (ddPointer *)&pLUT))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ pentry = &pLUT->entry;
+
+ /******************************************
+ * Need color mode conversion code here!!!
+ * for now, do nothing....
+ *****************************************/
+ if (directcolour->colourType != pentry->approxModel) {}
+
+ /* now perform direct -> index conversion. */
+ if (pentry->approxType == PEXColourSpace) {
+ switch (pentry->approxModel) {
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ {
+ *colourindex =
+ ((ddULONG)(directcolour->colour.rgbFloat.red*pentry->max1))
+ * pentry->mult1;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgbFloat.green*pentry->max2))
+ * pentry->mult2;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgbFloat.blue*pentry->max3))
+ * pentry->mult3;
+
+ *colourindex += pentry->basePixel;
+ break;
+ }
+
+ case PEXRgb8Colour:
+ *colourindex =
+ ((ddULONG)(directcolour->colour.rgb8.red*pentry->max1))
+ * pentry->mult1;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgb8.green*pentry->max2))
+ * pentry->mult2;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgb8.blue*pentry->max3))
+ * pentry->mult3;
+
+ *colourindex += pentry->basePixel;
+ break;
+
+ case PEXRgb16Colour:
+ *colourindex =
+ ((ddULONG)(directcolour->colour.rgb16.red*pentry->max1))
+ * pentry->mult1;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgb16.green*pentry->max2))
+ * pentry->mult2;
+
+ *colourindex +=
+ ((ddULONG)(directcolour->colour.rgb16.blue*pentry->max3))
+ * pentry->mult3;
+
+ *colourindex += pentry->basePixel;
+ break;
+ }
+ } else /* if (pentry->approxType == PEXColourRange) */ {
+ ddFLOAT floatindex;
+ ddFLOAT nw1, nw2, nw3;
+
+ /* use floatindex as temp var */
+ floatindex = pentry->weight1 + pentry->weight2 + pentry->weight3;
+ nw1 = pentry->weight1 / floatindex;
+ nw2 = pentry->weight2 / floatindex;
+ nw3 = pentry->weight3 / floatindex;
+
+ switch (pentry->approxModel) {
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ {
+ floatindex = directcolour->colour.rgbFloat.red * nw1;
+ floatindex += directcolour->colour.rgbFloat.green * nw2;
+ floatindex += directcolour->colour.rgbFloat.blue * nw3;
+
+ floatindex *= pentry->max1;
+ *colourindex = (ddULONG)(floatindex * pentry->mult1) +
+ (ddULONG)(floatindex * pentry->mult2) +
+ (ddULONG)(floatindex * pentry->mult3) +
+ pentry->basePixel;
+ break;
+ }
+
+ case PEXRgb8Colour:
+ floatindex = directcolour->colour.rgb8.red * nw1;
+ floatindex += directcolour->colour.rgb8.green * nw2;
+ floatindex += directcolour->colour.rgb8.blue * nw3;
+
+ floatindex *= pentry->max1;
+ *colourindex = (ddULONG)(floatindex * pentry->mult1) +
+ (ddULONG)(floatindex * pentry->mult2) +
+ (ddULONG)(floatindex * pentry->mult3) +
+ pentry->basePixel;
+ break;
+
+ case PEXRgb16Colour:
+ floatindex = directcolour->colour.rgb16.red * nw1;
+ floatindex += directcolour->colour.rgb16.green * nw2;
+ floatindex += directcolour->colour.rgb16.blue * nw3;
+
+ floatindex *= pentry->max1;
+ *colourindex = (ddULONG)(floatindex * pentry->mult1) +
+ (ddULONG)(floatindex * pentry->mult2) +
+ (ddULONG)(floatindex * pentry->mult3) +
+ pentry->basePixel;
+ break;
+ }
+ }
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miAddEdgeFlag
+ |
+ | Function Description:
+ | Add edge visibility flags to a list of vertices.
+ | Performs not operation if there already are edge
+ | flags in the data. Note all edges are set to "visible".
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miAddEdgeFlag(pddc, vinput, voutput)
+/* in */
+ miDDContext *pddc;
+ miListHeader *vinput;
+ miListHeader **voutput;
+{
+/* uses */
+ char *in_pt, *out_pt;
+ ddULONG *edge_ptr;
+ miListHeader *output;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int list_count = 0;
+ int vert_count;
+ int point_size, out_point_size;
+ int i, j;
+
+ /* If already have vertices, then simply return */
+ if (DD_IsVertEdge(vinput->type)) {
+ *voutput = vinput;
+ return(Success);
+ }
+
+ /* Initialize output list */
+ output = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(output, MI_ROUND_LISTHEADERCOUNT(vinput->numLists))
+ if (!output->ddList) return(BadAlloc);
+
+ DD_VertPointSize(vinput->type, point_size);
+ output->type = vinput->type;
+ DD_SetVertEdge(output->type);
+ DD_VertPointSize(output->type, out_point_size);
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /*
+ * Traverse each list.
+ */
+ for (i = 0; i < vinput->numLists; i++) {
+
+ if ((vert_count = pddolist->numPoints = pddilist->numPoints) <= 1) {
+ pddilist++;
+ continue;
+ }
+
+ /* Insure sufficient room for each vertex */
+ MI_ALLOCLISTOFDDPOINT(pddolist, vert_count+1, out_point_size);
+ if (!pddolist->pts.p2DSpt) return(BadAlloc);
+
+ /*
+ * Copy each point and initialize the edges.
+ * Note that the edge flag is always the last
+ * ddULONG of a vertex. Thus incrementing the
+ * destination pointer by the size of the input
+ * point "automatically" places the pointer
+ * at the start of the edge flag field.
+ */
+ in_pt = pddilist->pts.ptr;
+ out_pt = pddolist->pts.ptr;
+
+ for (j = 0; j < vert_count; j++) {
+ memcpy( out_pt, in_pt, point_size);
+ in_pt += point_size;
+ out_pt += point_size;
+ edge_ptr = (ddULONG *)out_pt;
+ *(edge_ptr++) = ~0;
+ out_pt = (char *)edge_ptr;
+ }
+
+ /* Now, skip to next input list */
+ pddilist++;
+ pddolist++;
+ list_count++;
+ }
+
+ output->numLists = list_count;
+ *voutput = output;
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miRemoveInvisibleEdges
+ |
+ | Function Description:
+ | Checks the edge flags of each edge in the input
+ | vertex list and removes the "invisible" ones.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miRemoveInvisibleEdges(pddc, vinput, voutput)
+/* in */
+ miDDContext *pddc;
+ miListHeader *vinput;
+ miListHeader **voutput;
+{
+/* uses */
+ char *in_pt, *out_pt;
+ ddULONG *edge_ptr;
+ miListHeader *output;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int list_count = 0;
+ int vert_count, counter;
+ int point_size;
+ int edge_offset;
+ int i, j;
+
+ /* If already have vertices, then simply return */
+ if (!(DD_IsVertEdge(vinput->type))) {
+ *voutput = vinput;
+ return(Success);
+ }
+
+ /* Initialize output list */
+ output = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(output, MI_ROUND_LISTHEADERCOUNT(vinput->numLists))
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = vinput->type;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ DD_VertPointSize(vinput->type, point_size);
+ DD_VertOffsetEdge(vinput->type, edge_offset);
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /*
+ * Traverse each list.
+ */
+ for (i = 0; i < vinput->numLists; i++) {
+
+ if ((vert_count = pddilist->numPoints) <= 1) {
+ pddilist++;
+ continue;
+ }
+
+ /* Insure sufficient room for each vertex */
+ MI_ALLOCLISTOFDDPOINT(pddolist, vert_count, point_size);
+ if (!pddolist->pts.p2DSpt) return(BadAlloc);
+
+ /*
+ * Copy each point and initialize the edges.
+ * Note that the edge flag is always the last
+ * ddULONG of a vertex. Thus incrementing the
+ * destination pointer by the size of the input
+ * point "automatically" places the pointer
+ * at the start of the edge flag field.
+ */
+ in_pt = pddilist->pts.ptr;
+ out_pt = pddolist->pts.ptr;
+
+ for (j = 0, counter = 0; j < vert_count; j++) {
+ edge_ptr = (ddULONG *)(in_pt + edge_offset);
+ if (*edge_ptr) {
+ memcpy( out_pt, in_pt, point_size);
+ out_pt += point_size;
+ counter++;
+ } else if (counter) {
+ /* if edge is invisible, start new list */
+
+ /* First, end last edge of previous edge */
+ memcpy( out_pt, in_pt, point_size);
+ pddolist->numPoints = counter + 1;
+ counter = 0;
+
+ /* Insure enough room for new list header */
+ list_count++;
+ MI_ALLOCLISTHEADER(output,
+ MI_ROUND_LISTHEADERCOUNT(list_count));
+ if (!output->ddList) return(BadAlloc);
+ pddolist = &output->ddList[list_count];
+
+ /* Next, insure enough room for vertices in new list */
+ MI_ALLOCLISTOFDDPOINT(pddolist, vert_count - j, point_size);
+ if (!(out_pt = pddolist->pts.ptr)) return(BadAlloc);
+ }
+
+ in_pt += point_size;
+ }
+
+ /* Now, skip to next input list */
+ pddilist++;
+ if (counter > 1) {
+ pddolist->numPoints = counter;
+ list_count++;
+ MI_ALLOCLISTHEADER(output, MI_ROUND_LISTHEADERCOUNT(list_count));
+ if (!output->ddList) return(BadAlloc);
+ pddolist = &output->ddList[list_count];
+ }
+ }
+
+ output->numLists = list_count;
+ *voutput = output;
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCopy.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCopy.c
new file mode 100644
index 000000000..477010e66
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miCopy.c
@@ -0,0 +1,1097 @@
+/* $TOG: miCopy.c /main/10 1998/02/10 12:41:05 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miCopy.c,v 3.6 1998/10/04 09:34:18 dawes Exp $ */
+
+
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "pexExtract.h"
+#include "ddpex2.h"
+#include "miStruct.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+/*
+ bcopy data, fix up pointers
+ */
+/*
+ Please note that any routines added to this file may also cause
+ a corresponding modification to the level function tables (miTables.c)
+ */
+
+/*
+ Coders must ensure that storage is allocated in the same chunks as for the
+ corresponding parse function, otherwise unfortunate things may
+ happen during freeing of storage.
+ */
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CAT(a,b) a##b
+#else
+#define CAT(a,b) a/**/b
+#endif
+
+#define OC_COPY_FUNC_HEADER(suffix) \
+ ddpex2rtn CAT(copy,suffix)(pSrc, ppDst) \
+ miGenericElementStr *pSrc; \
+ miGenericElementStr **ppDst;
+
+#define DST_STORE_AND_COPY(DD_ST, TYPE, SIZE) \
+ *ppDst = (miGenericElementPtr) \
+ xalloc((unsigned long)((SIZE) + sizeof(miGenericElementStr))); \
+ if (!(*ppDst)) return (BadAlloc); \
+ memmove( (char *)(*ppDst), (char *)pSrc, \
+ (int)((SIZE) + sizeof(miGenericElementStr))); \
+ DD_ST = (TYPE *)((*ppDst)+1);
+
+#define COPY_DECL(NAME,TYPE) \
+ TYPE * CAT(dst,NAME) = 0, * CAT(src,NAME) = (TYPE *)(pSrc + 1);
+
+#define COPY_MORE(DST, TYPE, NUMBER, SRC) \
+ if ((NUMBER) > 0) { \
+ DST = (TYPE *)xalloc((unsigned long)((NUMBER) * sizeof(TYPE))); \
+ if (!(DST)) err = BadAlloc; \
+ else memmove((char *)(DST),(char *)(SRC),(int)((NUMBER)*sizeof(TYPE))); } \
+ else DST = 0;
+
+/*
+ Returns number of bytes used to store the data
+ Differs from similar routine in pexOCParse.c because that one counts
+ from the protocol format; this one counts dd native format instead
+ */
+static int
+CountddFacetOptData(pFacet)
+listofddFacet *pFacet;
+{
+ switch(pFacet->type){
+ case DD_FACET_INDEX_NORM:
+ return (sizeof(ddIndexNormal) * pFacet->numFacets);
+
+ case DD_FACET_RGBFLOAT_NORM:
+ return (sizeof(ddRgbFloatNormal) * pFacet->numFacets);
+
+ case DD_FACET_CIE_NORM:
+ return (sizeof(ddCieNormal) * pFacet->numFacets);
+
+ case DD_FACET_HSV_NORM:
+ return (sizeof(ddHsvNormal) * pFacet->numFacets);
+
+ case DD_FACET_HLS_NORM:
+ return (sizeof(ddHlsNormal) * pFacet->numFacets);
+
+ case DD_FACET_RGB8_NORM:
+ return (sizeof(ddRgb8Normal) * pFacet->numFacets);
+
+ case DD_FACET_RGB16_NORM:
+ return (sizeof(ddRgb16Normal) * pFacet->numFacets);
+
+ case DD_FACET_NORM:
+ return (sizeof(ddVector3D) * pFacet->numFacets);
+
+ case DD_FACET_INDEX:
+ return (sizeof(ddIndexedColour) * pFacet->numFacets);
+
+ case DD_FACET_RGBFLOAT:
+ return (sizeof(ddRgbFloatColour) * pFacet->numFacets);
+
+ case DD_FACET_CIE:
+ return (sizeof(ddCieColour) * pFacet->numFacets);
+
+ case DD_FACET_HSV:
+ return (sizeof(ddHsvColour) * pFacet->numFacets);
+
+ case DD_FACET_HLS:
+ return (sizeof(ddHlsColour) * pFacet->numFacets);
+
+ case DD_FACET_RGB8:
+ return (sizeof(ddRgb8Colour) * pFacet->numFacets);
+
+ case DD_FACET_NONE:
+ default:
+ return (0);
+ }
+}
+
+static int
+CountddVertexData(pPoint, point_type)
+listofddPoint *pPoint;
+ddPointType point_type;
+{
+ switch (point_type) {
+ case DD_INDEX_NORM_EDGE_POINT:
+ return (sizeof(ddIndexNormEdgePoint) * pPoint->numPoints);
+
+ case DD_RGBFLOAT_NORM_EDGE_POINT:
+ return (sizeof(ddRgbFloatNormEdgePoint) * pPoint->numPoints);
+
+ case DD_CIE_NORM_EDGE_POINT:
+ return (sizeof(ddCieNormEdgePoint) * pPoint->numPoints);
+
+ case DD_HSV_NORM_EDGE_POINT:
+ return (sizeof(ddHsvNormEdgePoint) * pPoint->numPoints);
+
+ case DD_HLS_NORM_EDGE_POINT:
+ return (sizeof(ddHlsNormEdgePoint) * pPoint->numPoints);
+
+ case DD_RGB8_NORM_EDGE_POINT:
+ return (sizeof(ddRgb8NormEdgePoint) * pPoint->numPoints);
+
+ case DD_RGB16_NORM_EDGE_POINT:
+ return (sizeof(ddRgb16NormEdgePoint) * pPoint->numPoints);
+
+ case DD_NORM_EDGE_POINT:
+ return (sizeof(ddNormEdgePoint) * pPoint->numPoints);
+
+ case DD_INDEX_NORM_POINT:
+ return (sizeof(ddIndexNormalPoint) * pPoint->numPoints);
+
+ case DD_RGBFLOAT_NORM_POINT:
+ return (sizeof(ddRgbFloatNormalPoint) * pPoint->numPoints);
+
+ case DD_CIE_NORM_POINT:
+ return (sizeof(ddCieNormalPoint) * pPoint->numPoints);
+
+ case DD_HSV_NORM_POINT:
+ return (sizeof(ddHsvNormalPoint) * pPoint->numPoints);
+
+ case DD_HLS_NORM_POINT:
+ return (sizeof(ddHlsNormalPoint) * pPoint->numPoints);
+
+ case DD_RGB8_NORM_POINT:
+ return (sizeof(ddRgb8NormalPoint) * pPoint->numPoints);
+
+ case DD_RGB16_NORM_POINT:
+ return (sizeof(ddRgb16NormalPoint) * pPoint->numPoints);
+
+ case DD_NORM_POINT:
+ return (sizeof(ddNormalPoint) * pPoint->numPoints);
+
+ case DD_INDEX_EDGE_POINT:
+ return (sizeof(ddIndexEdgePoint) * pPoint->numPoints);
+
+ case DD_RGBFLOAT_EDGE_POINT:
+ return (sizeof(ddRgbFloatEdgePoint) * pPoint->numPoints);
+
+ case DD_CIE_EDGE_POINT:
+ return (sizeof(ddCieEdgePoint) * pPoint->numPoints);
+
+ case DD_HSV_EDGE_POINT:
+ return (sizeof(ddHsvEdgePoint) * pPoint->numPoints);
+
+ case DD_HLS_EDGE_POINT:
+ return (sizeof(ddHlsEdgePoint) * pPoint->numPoints);
+
+ case DD_RGB8_EDGE_POINT:
+ return (sizeof(ddRgb8EdgePoint) * pPoint->numPoints);
+
+ case DD_RGB16_EDGE_POINT:
+ return (sizeof(ddRgb16EdgePoint) * pPoint->numPoints);
+
+ case DD_INDEX_POINT:
+ return (sizeof(ddIndexPoint) * pPoint->numPoints);
+
+ case DD_RGBFLOAT_POINT:
+ return (sizeof(ddRgbFloatPoint) * pPoint->numPoints);
+
+ case DD_CIE_POINT:
+ return (sizeof(ddCiePoint) * pPoint->numPoints);
+
+ case DD_HSV_POINT:
+ return (sizeof(ddHsvPoint) * pPoint->numPoints);
+
+ case DD_HLS_POINT:
+ return (sizeof(ddHlsPoint) * pPoint->numPoints);
+
+ case DD_RGB8_POINT:
+ return (sizeof(ddRgb8Point) * pPoint->numPoints);
+
+ case DD_RGB16_POINT:
+ return (sizeof(ddRgb16Point) * pPoint->numPoints);
+
+ case DD_EDGE_POINT:
+ return (sizeof(ddEdgePoint) * pPoint->numPoints);
+
+ case DD_3D_POINT:
+ return (sizeof(ddCoord3D) * pPoint->numPoints);
+
+ default:
+ return(0);
+ }
+}
+
+
+OC_COPY_FUNC_HEADER(ColourOC)
+{
+ COPY_DECL(Colour,miColourStruct);
+
+ switch (srcColour->colourType) {
+ case PEXIndexedColour: {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddIndexedColour)));
+ dstColour->colour.pIndex = (ddIndexedColour *)(dstColour+1);
+ break; }
+
+ case PEXRgbFloatColour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddRgbFloatColour)));
+ dstColour->colour.pRgbFloat = (ddRgbFloatColour *)(dstColour+1);
+ break; }
+
+ case PEXCieFloatColour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddCieColour)));
+ dstColour->colour.pCie = (ddCieColour *)(dstColour+1);
+ break; }
+
+ case PEXHsvFloatColour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddHsvColour)));
+ dstColour->colour.pHsv = (ddHsvColour *)(dstColour+1);
+ break; }
+
+ case PEXHlsFloatColour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddHlsColour)));
+ dstColour->colour.pHls = (ddHlsColour *)(dstColour+1);
+ break; }
+
+ case PEXRgb8Colour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddRgb8Colour)));
+ dstColour->colour.pRgb8 = (ddRgb8Colour *)(dstColour+1);
+ break; }
+
+ case PEXRgb16Colour : {
+ DST_STORE_AND_COPY( dstColour, miColourStruct,
+ (sizeof(miColourStruct)
+ + sizeof(ddRgb16Colour)));
+ dstColour->colour.pRgb16 = (ddRgb16Colour *)(dstColour+1);
+ break; }
+
+ }
+
+ return(Success);
+}
+
+OC_COPY_FUNC_HEADER(ColourIndexOC)
+{
+ COPY_DECL(Colour,miColourStruct);
+
+ DST_STORE_AND_COPY( dstColour, miColourStruct, (sizeof(miColourStruct)
+ + sizeof(ddIndexedColour)));
+ dstColour->colour.pIndex = (ddIndexedColour *)(dstColour+1);
+
+ return(Success);
+}
+
+OC_COPY_FUNC_HEADER(LightState)
+{
+ COPY_DECL(LightState,miLightStateStruct);
+
+ DST_STORE_AND_COPY( dstLightState, miLightStateStruct,
+ sizeof(miLightStateStruct)
+ + 2 * sizeof(listofObj)
+ + sizeof(CARD16) *
+ (srcLightState->enableList->maxObj
+ + srcLightState->disableList->maxObj));
+
+ dstLightState->enableList = (listofObj *)(dstLightState + 1);
+ dstLightState->enableList->pList = (ddPointer)(dstLightState->enableList +1);
+ dstLightState->disableList =
+ (listofObj *)((dstLightState->enableList->pList +
+ sizeof(CARD16) * dstLightState->enableList->maxObj));
+ dstLightState->disableList->pList =
+ (ddPointer)(dstLightState->disableList + 1);
+ return(Success);
+}
+
+/* can use the same for both 3D and 2D */
+OC_COPY_FUNC_HEADER(MCVolume)
+{
+ int listSize = 0;
+ COPY_DECL(MCVolume, miMCVolume_Struct);
+ listSize = puCountList( DD_HALF_SPACE, srcMCVolume->halfspaces->numObj);
+ DST_STORE_AND_COPY(dstMCVolume, miMCVolume_Struct,
+ sizeof(miMCVolume_Struct) + listSize);
+ dstMCVolume->halfspaces = (listofObj *)(dstMCVolume+1);
+ return(Success);
+}
+
+OC_COPY_FUNC_HEADER(Marker)
+{
+ listofddPoint *dstPoint;
+ COPY_DECL(Marker, miMarkerStruct);
+
+ DST_STORE_AND_COPY( dstMarker, miListHeader,
+ sizeof(miListHeader) + sizeof(listofddPoint)
+ + srcMarker->ddList->numPoints * sizeof(pexCoord3D));
+ dstPoint = (listofddPoint *)(dstMarker+1);
+ dstMarker->ddList = dstPoint;
+ dstPoint->pts.p3Dpt = (ddCoord3D *)(dstPoint + 1);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(Marker2D)
+{
+ listofddPoint *dstPoint;
+ COPY_DECL(Marker, miMarkerStruct);
+
+ DST_STORE_AND_COPY( dstMarker, miListHeader,
+ sizeof(miListHeader) + sizeof(listofddPoint)
+ + srcMarker->ddList->numPoints * sizeof(pexCoord2D));
+ dstPoint = (listofddPoint *)(dstMarker+1);
+ dstMarker->ddList = dstPoint;
+ dstPoint->pts.p2Dpt = (ddCoord2D *)(dstPoint + 1);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(Text)
+{
+ COPY_DECL(Text, miTextStruct);
+
+ DST_STORE_AND_COPY( dstText, miTextStruct, sizeof(miTextStruct)
+ + 3 * sizeof(ddCoord3D)
+ + pSrc->element.pexOClength * sizeof(CARD32)
+ - sizeof(pexText));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ dstText->pOrigin = (ddCoord3D *)(dstText + 1);
+ dstText->pDirections = (dstText->pOrigin) + 1;
+ dstText->pText = (pexMonoEncoding *)((dstText->pDirections) + 2);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(Text2D)
+{
+ COPY_DECL(Text, miText2DStruct);
+
+ DST_STORE_AND_COPY( dstText, miText2DStruct, sizeof(miText2DStruct)
+ + sizeof(ddCoord2D)
+ + pSrc->element.pexOClength * sizeof(CARD32)
+ - sizeof(pexText2D));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ dstText->pOrigin = (ddCoord2D *)(dstText + 1);
+ dstText->pText = (pexMonoEncoding *)((dstText->pOrigin) + 1);
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(AnnotationText)
+{
+ COPY_DECL(Text, miAnnoTextStruct);
+
+ DST_STORE_AND_COPY( dstText, miAnnoTextStruct, sizeof(miAnnoTextStruct)
+ + 2 * sizeof(ddCoord3D)
+ + pSrc->element.pexOClength * sizeof(CARD32)
+ - sizeof(pexAnnotationText));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ dstText->pOrigin = (ddCoord3D *)(dstText + 1);
+ dstText->pOffset = (dstText->pOrigin) + 1;
+ dstText->pText = (pexMonoEncoding *)((dstText->pOffset) + 1);
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(AnnotationText2D)
+{
+ COPY_DECL(Text, miAnnoText2DStruct);
+
+ DST_STORE_AND_COPY( dstText, miAnnoText2DStruct, sizeof(miAnnoText2DStruct)
+ + 2 * sizeof(ddCoord2D)
+ + pSrc->element.pexOClength * sizeof(CARD32)
+ - sizeof(pexAnnotationText2D));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ dstText->pOrigin = (ddCoord2D *)(dstText + 1);
+ dstText->pOffset = (dstText->pOrigin) + 1;
+ dstText->pText = (pexMonoEncoding *)((dstText->pOffset) + 1);
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(Polyline2D)
+{
+ listofddPoint *dstPoint;
+ COPY_DECL(Poly, miPolylineStruct);
+
+ DST_STORE_AND_COPY( dstPoly, miListHeader,
+ sizeof(miListHeader) + sizeof(listofddPoint)
+ + srcPoly->ddList->numPoints * sizeof(ddCoord2D));
+ dstPoint = (listofddPoint *)(dstPoly+1);
+ dstPoly->ddList = dstPoint;
+ dstPoint->pts.p2Dpt = (ddCoord2D *)(dstPoint + 1);
+
+ return(Success);
+
+}
+
+
+
+OC_COPY_FUNC_HEADER(Polyline)
+{
+ listofddPoint *dstPoint;
+ COPY_DECL(Poly, miPolylineStruct);
+
+ DST_STORE_AND_COPY( dstPoly, miListHeader,
+ sizeof(miListHeader) + sizeof(listofddPoint)
+ + srcPoly->ddList->numPoints * sizeof(ddCoord3D));
+ dstPoint = (listofddPoint *)(dstPoly+1);
+ dstPoly->ddList = dstPoint;
+ dstPoint->pts.p3Dpt = (ddCoord3D *)(dstPoint + 1);
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(PolylineSet)
+{
+ listofddPoint *pPoint;
+ ddUSHORT i;
+ int vertexSize = 0;
+ ddPointer ddPtr = 0;
+ ddpex2rtn err = Success;
+ COPY_DECL(Poly, miPolylineStruct);
+
+ for (i=0, pPoint = srcPoly->ddList; i<srcPoly->numLists; i++, pPoint++)
+ vertexSize += CountddVertexData(pPoint, srcPoly->type);
+ DST_STORE_AND_COPY( dstPoly, miListHeader,
+ (sizeof(miListHeader) + vertexSize
+ + srcPoly->numLists * sizeof(listofddPoint)));
+
+ dstPoly->ddList = (listofddPoint *)(dstPoly+1);
+ for (i=0, pPoint = dstPoly->ddList, vertexSize = 0,
+ ddPtr = (ddPointer)(dstPoly->ddList + dstPoly->numLists);
+ i<dstPoly->numLists;
+ i++, pPoint++) {
+ vertexSize = CountddVertexData(pPoint, dstPoly->type);
+ pPoint->pts.ptr = (char *)ddPtr;
+ ddPtr += vertexSize;
+ /* could have subtracted pointers, but this is more maintainable */
+ }
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(NurbCurve)
+{
+ ddUSHORT pointSize = 0;
+ COPY_DECL(Nurb, miNurbStruct);
+
+ pointSize = (srcNurb->points.type == DDPT_4D)
+ ? sizeof(ddCoord4D) : sizeof(ddCoord3D);
+ DST_STORE_AND_COPY( dstNurb, miNurbStruct,
+ sizeof(miNurbStruct) + sizeof(listofddPoint)
+ + srcNurb->numKnots * sizeof(PEXFLOAT)
+ + srcNurb->points.ddList->numPoints * pointSize);
+ dstNurb->pKnots = (ddFLOAT *)(dstNurb+1);
+ dstNurb->points.ddList =
+ (listofddPoint *)(dstNurb->pKnots + srcNurb->numKnots);
+ if (srcNurb->points.type == DDPT_4D) {
+ dstNurb->points.ddList->pts.p4Dpt =
+ (ddCoord4D *)((dstNurb->points.ddList)+1);
+ } else {
+ dstNurb->points.ddList->pts.p3Dpt =
+ (ddCoord3D *)((dstNurb->points.ddList)+1);
+ }
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(FillArea2D)
+{
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct, (sizeof(miFillAreaStruct) +
+ sizeof(listofddFacet) + sizeof(listofddPoint)
+ + srcFill->points.ddList->numPoints *sizeof(ddCoord2D)));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+ dstFill->points.ddList->pts.p2Dpt = (ddCoord2D *)((dstFill->points.ddList) + 1);
+
+ return(Success);
+}
+
+
+
+
+OC_COPY_FUNC_HEADER(FillArea)
+{
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct, (sizeof(miFillAreaStruct) +
+ sizeof(listofddFacet) + sizeof(listofddPoint)
+ + srcFill->points.ddList->numPoints *sizeof(ddCoord3D)));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+ dstFill->points.ddList->pts.p3Dpt = (ddCoord3D *)((dstFill->points.ddList) + 1);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(ExtFillArea)
+{
+ ddpex2rtn err = Success;
+ int facetSize = 0, vertexSize = 0;
+ ddPointer facetPtr = 0, vertexPtr = 0;
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ facetSize = CountddFacetOptData(srcFill->pFacets);
+ vertexSize = CountddVertexData(srcFill->points.ddList, srcFill->points.type);
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + facetSize + vertexSize
+ + sizeof(listofddFacet) + sizeof(listofddPoint)));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+
+ facetPtr = (ddPointer)(dstFill->points.ddList + 1);
+ if (facetSize == 0)
+ dstFill->pFacets->facets.pNoFacet = 0;
+ else
+ dstFill->pFacets->facets.pNoFacet = facetPtr;
+
+ vertexPtr = facetPtr + facetSize;
+ if (vertexSize == 0)
+ dstFill->points.ddList->pts.ptr = 0;
+ else
+ dstFill->points.ddList->pts.ptr = (char *)vertexPtr;
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(FillAreaSet2D)
+{
+ listofddPoint *ddPoint;
+ ddpex2rtn err = Success;
+ int listSize = 0;
+ ddUSHORT i;
+ ddPointer ddPtr = 0;
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ for ( i=0, ddPoint = srcFill->points.ddList;
+ i < srcFill->points.numLists;
+ i++, ddPoint++ )
+ listSize += ddPoint->numPoints * sizeof(ddCoord2D);
+
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + listSize
+ + (srcFill->points.numLists * sizeof(listofddPoint))));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+
+ for ( i=0, ddPoint = dstFill->points.ddList,
+ ddPtr = (ddPointer)(ddPoint + dstFill->points.numLists);
+ i<dstFill->points.numLists;
+ i++, ddPoint++ ) {
+
+ ddPoint->pts.p2Dpt = (ddCoord2D *)ddPtr;
+ ddPtr += ddPoint->numPoints * sizeof(ddCoord2D);
+ }
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(FillAreaSet)
+{
+ listofddPoint *ddPoint;
+ ddpex2rtn err = Success;
+ int listSize = 0;
+ ddUSHORT i;
+ ddPointer ddPtr = 0;
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ for ( i=0, ddPoint = srcFill->points.ddList;
+ i < srcFill->points.numLists;
+ i++, ddPoint++ )
+ listSize += ddPoint->numPoints * sizeof(ddCoord3D);
+
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + listSize
+ + (srcFill->points.numLists * sizeof(listofddPoint))));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+
+ for ( i=0, ddPoint = dstFill->points.ddList,
+ ddPtr = (ddPointer)(ddPoint + dstFill->points.numLists);
+ i<dstFill->points.numLists;
+ i++, ddPoint++ ) {
+
+ ddPoint->pts.p3Dpt = (ddCoord3D *)ddPtr;
+ ddPtr += ddPoint->numPoints * sizeof(ddCoord3D);
+ }
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(ExtFillAreaSet)
+{
+ listofddPoint *dstPoint, *srcPoint;
+ ddUSHORT i;
+ int facetSize = 0, vertexSize = 0;
+ ddPointer facetPtr = 0, vertexPtr = 0;
+ ddpex2rtn err = Success;
+ COPY_DECL(Fill, miFillAreaStruct);
+
+ facetSize = CountddFacetOptData(srcFill->pFacets);
+ for (i=0, srcPoint=srcFill->points.ddList;
+ i<srcFill->points.numLists;
+ i++, srcPoint++) {
+ vertexSize += CountddVertexData(srcPoint, srcFill->points.type); }
+
+ DST_STORE_AND_COPY( dstFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + facetSize + vertexSize
+ + (srcFill->points.numLists * sizeof(listofddPoint))));
+ dstFill->pFacets = (listofddFacet *)(dstFill+1);
+ dstFill->points.ddList = (listofddPoint *)((dstFill->pFacets)+1);
+
+ facetPtr = (ddPointer)(dstFill->points.ddList + dstFill->points.numLists);
+ if (facetSize == 0)
+ dstFill->pFacets->facets.pNoFacet = 0;
+ else
+ dstFill->pFacets->facets.pNoFacet = facetPtr;
+
+ vertexPtr = facetPtr + facetSize;
+
+ for (i=0, dstPoint=dstFill->points.ddList, vertexSize = 0;
+ i<dstFill->points.numLists;
+ i++, dstPoint++, srcPoint++) {
+
+ vertexSize = CountddVertexData(dstPoint, dstFill->points.type);
+ dstPoint->pts.ptr = (char *)vertexPtr;
+ vertexPtr += vertexSize;
+ }
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(SOFAS)
+{
+ ddUSHORT i,j, k;
+ miConnListList *dstCLL, *srcCLL;
+ miConnList *dstCList, *srcCList;
+ ddpex2rtn err = Success;
+ int vertexSize = 0, facetSize = 0, edgeSize = 0;
+ ddPointer ptr;
+ extern void destroySOFAS();
+ COPY_DECL(Fill, miSOFASStruct);
+
+ facetSize = CountddFacetOptData( &srcFill->pFacets);
+ vertexSize = CountddVertexData( srcFill->points.ddList,
+ srcFill->points.type);
+ if (srcFill->edgeData) {
+ edgeSize = srcFill->numEdges * sizeof(ddUCHAR);
+ edgeSize += ((4 - (edgeSize & 3)) & 3);
+ }
+
+ DST_STORE_AND_COPY( dstFill, miSOFASStruct,
+ sizeof(miSOFASStruct) + sizeof(listofddPoint)
+ + srcFill->numEdges * sizeof(ddUCHAR)
+ + facetSize + vertexSize + edgeSize +
+ srcFill->connects.numListLists * sizeof(miConnListList));
+
+ dstFill->points.ddList = (listofddPoint *)(dstFill + 1);
+ ptr = (ddPointer)(dstFill->points.ddList + 1);
+ if (facetSize == 0) dstFill->pFacets.facets.pNoFacet = 0;
+ else dstFill->pFacets.facets.pNoFacet = ptr;
+ ptr += facetSize;
+ if (vertexSize == 0) dstFill->points.ddList->pts.ptr = 0;
+ else dstFill->points.ddList->pts.ptr = (char *)ptr;
+ ptr += vertexSize;
+ if (edgeSize == 0) dstFill->edgeData = 0;
+ else dstFill->edgeData = ptr;
+ ptr += edgeSize;
+ dstFill->connects.data = (miConnListList *)ptr;
+ for ( i=0, dstCLL = dstFill->connects.data, srcCLL = srcFill->connects.data;
+ i<srcFill->numFAS;
+ i++, dstCLL++, srcCLL++) {
+ COPY_MORE( dstCLL->pConnLists, miConnList,
+ srcCLL->numLists * sizeof(miConnList),
+ srcCLL->pConnLists);
+ if (err != Success) {
+ destroySOFAS(dstFill);
+ return(BadAlloc);
+ }
+ for ( j=0,dstCList = dstCLL->pConnLists, srcCList = srcCLL->pConnLists;
+ j<dstCLL->numLists;
+ j++, dstCList++, srcCList++) {
+ COPY_MORE( dstCList->pConnects, ddUSHORT,
+ srcCList->numLists * sizeof(ddUSHORT),
+ srcCList->pConnects);
+ if (err != Success) {
+ destroySOFAS(dstFill);
+ return(BadAlloc);
+ }
+ }
+ }
+
+ return(Success);
+}
+
+
+
+OC_COPY_FUNC_HEADER(TriangleStrip)
+{
+ ddpex2rtn err = Success;
+ int vertexSize = 0, facetSize = 0;
+ COPY_DECL(Triangle, miTriangleStripStruct);
+
+ facetSize = CountddFacetOptData(srcTriangle->pFacets);
+ vertexSize = CountddVertexData( srcTriangle->points.ddList,
+ srcTriangle->points.type);
+ DST_STORE_AND_COPY( dstTriangle, miTriangleStripStruct,
+ (sizeof(miTriangleStripStruct) + sizeof(listofddFacet)
+ + vertexSize + facetSize + sizeof(listofddPoint)));
+ dstTriangle->pFacets = (listofddFacet *)(dstTriangle+1);
+ dstTriangle->points.ddList = (listofddPoint *)((dstTriangle->pFacets)+1);
+ dstTriangle->pFacets->facets.pNoFacet
+ = (ddPointer)(dstTriangle->points.ddList + 1);
+ dstTriangle->points.ddList->pts.ptr
+ = (char *)(dstTriangle->pFacets->facets.pNoFacet + facetSize);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(QuadrilateralMesh)
+{
+ ddpex2rtn err = Success;
+ int vertexSize = 0, facetSize = 0;
+ COPY_DECL(Quad, miQuadMeshStruct);
+
+ facetSize = CountddFacetOptData(srcQuad->pFacets);
+ vertexSize = CountddVertexData(srcQuad->points.ddList, srcQuad->points.type);
+ DST_STORE_AND_COPY( dstQuad, miQuadMeshStruct, (sizeof(miQuadMeshStruct)
+ + vertexSize + facetSize
+ + sizeof(listofddFacet) + sizeof(listofddPoint)));
+ dstQuad->pFacets = (listofddFacet *)(dstQuad+1);
+ dstQuad->points.ddList = (listofddPoint *)((dstQuad->pFacets)+1);
+ dstQuad->pFacets->facets.pNoFacet
+ = (ddPointer)(dstQuad->points.ddList + 1);
+ dstQuad->points.ddList->pts.ptr
+ = (char *)(dstQuad->pFacets->facets.pNoFacet + facetSize);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(NurbSurface)
+{
+ ddULONG i, j, k;
+ listofTrimCurve *dstTrim, *srcTrim;
+ ddTrimCurve *dstTC, *srcTC;
+ ddpex2rtn err = Success;
+ extern void destroyNurbSurface();
+ COPY_DECL(Nurb, miNurbSurfaceStruct);
+
+ DST_STORE_AND_COPY(dstNurb, miNurbSurfaceStruct, (sizeof(miNurbSurfaceStruct)
+ + (srcNurb->numUknots * srcNurb->numVknots) * (sizeof(ddFLOAT))
+ + (sizeof(listofddPoint))
+ + (srcNurb->mPts * srcNurb->nPts * sizeof(ddCoord4D)
+ + (sizeof(listofTrimCurve))
+ + srcNurb->numTrimCurveLists * sizeof(ddTrimCurve))));
+ dstNurb->pUknots = (ddFLOAT *)(dstNurb+1);
+ dstNurb->pVknots = (ddFLOAT *)((dstNurb->pUknots) + srcNurb->numUknots);
+ dstNurb->points.ddList =
+ (listofddPoint *)((dstNurb->pVknots) + srcNurb->numVknots);
+ dstNurb->points.ddList->pts.ptr = (char *)(dstNurb->points.ddList + 1);
+ dstNurb->trimCurves =
+ (listofTrimCurve *)((dstNurb->points.ddList->pts.ptr)
+ + (srcNurb->mPts * srcNurb->nPts * sizeof(ddCoord4D)));
+
+ for (i=0, dstTrim = dstNurb->trimCurves, srcTrim = srcNurb->trimCurves;
+ i<dstNurb->numTrimCurveLists;
+ i++, dstTrim++, srcTrim++) {
+
+ dstTrim->pTC = (ddTrimCurve *)xalloc(srcTrim->count*sizeof(ddTrimCurve));
+ COPY_MORE(dstTrim->pTC, ddTrimCurve, srcTrim->count, srcTrim->pTC);
+ if (err) {
+ destroyNurbSurface(dstNurb);
+ return(BadAlloc);
+ }
+
+ for ( k=0, dstTC = dstTrim->pTC, srcTC = srcTrim->pTC;
+ k < dstTrim->count;
+ k++, dstTC++, srcTC++) {
+ COPY_MORE(dstTC->pKnots, ddFLOAT, dstTC->numKnots, srcTC->pKnots );
+ if (err) {
+ dstTC->points.pts.ptr = 0;
+ destroyNurbSurface(dstNurb);
+ return(BadAlloc);
+ }
+ if (srcTC->pttype == DD_3D_POINT) {
+ /* Note that this only works because these points are
+ * never transformed */
+ COPY_MORE( dstTC->points.pts.p3Dpt, ddCoord3D,
+ dstTC->points.numPoints, srcTC->points.pts.p3Dpt );
+ } else {
+ COPY_MORE( dstTC->points.pts.p2Dpt, ddCoord2D,
+ dstTC->points.numPoints, srcTC->points.pts.p2Dpt );
+ }
+ if (err) {
+ destroyNurbSurface(dstNurb);
+ return(BadAlloc);
+ }
+ }
+ }
+ return(Success);
+
+}
+
+OC_COPY_FUNC_HEADER(CellArray2D)
+{
+ COPY_DECL(Cell, miCellArrayStruct);
+
+ DST_STORE_AND_COPY( dstCell, miCellArrayStruct,
+ sizeof(miCellArrayStruct) + sizeof(listofddPoint)
+ + 2 * sizeof(ddCoord2D)
+ + srcCell->dx * srcCell->dy * sizeof(ddIndexedColour));
+ dstCell->point.ddList = (listofddPoint *)(dstCell+1);
+ dstCell->point.ddList->pts.p2Dpt =
+ (ddCoord2D *)((dstCell->point.ddList) + 1);
+ dstCell->colours.colour.pIndex =
+ (ddIndexedColour *)((dstCell->point.ddList->pts.p2Dpt) + 2);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(CellArray)
+{
+ COPY_DECL(Cell, miCellArrayStruct);
+
+ DST_STORE_AND_COPY( dstCell, miCellArrayStruct,
+ sizeof(miCellArrayStruct) + sizeof(listofddPoint)
+ + 3 * sizeof(ddCoord3D)
+ + srcCell->dx * srcCell->dy * sizeof(ddIndexedColour));
+ dstCell->point.ddList = (listofddPoint *)(dstCell+1);
+ dstCell->point.ddList->pts.p3Dpt =
+ (ddCoord3D *)((dstCell->point.ddList) + 1);
+ dstCell->colours.colour.pIndex =
+ (ddIndexedColour *)((dstCell->point.ddList->pts.p3Dpt) + 3);
+
+ return(Success);
+
+}
+
+OC_COPY_FUNC_HEADER(ExtCellArray)
+{
+ unsigned long size;
+ COPY_DECL(Cell, miCellArrayStruct);
+
+ size = (((srcCell->colours.colourType==PEXIndexedColour)
+ || (srcCell->colours.colourType==PEXRgb8Colour)) ? 4 :
+ ((srcCell->colours.colourType==PEXRgb16Colour) ? 8 : 12 ));
+ DST_STORE_AND_COPY( dstCell, miCellArrayStruct,
+ sizeof(miCellArrayStruct) + sizeof(listofddPoint)
+ + 3 * sizeof(ddCoord3D)
+ + srcCell->dx * srcCell->dy * size);
+ dstCell->point.ddList = (listofddPoint *)(dstCell+1);
+
+ dstCell->point.ddList->pts.p3Dpt =
+ (ddCoord3D *)((dstCell->point.ddList) + 1);
+
+ switch (srcCell->colours.colourType) {
+ case PEXIndexedColour: {
+ dstCell->colours.colour.pIndex =
+ (ddIndexedColour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXRgbFloatColour : {
+ dstCell->colours.colour.pRgbFloat =
+ (ddRgbFloatColour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXCieFloatColour : {
+ dstCell->colours.colour.pCie =
+ (ddCieColour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXHsvFloatColour : {
+ dstCell->colours.colour.pHsv =
+ (ddHsvColour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXHlsFloatColour : {
+ dstCell->colours.colour.pHls =
+ (ddHlsColour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXRgb8Colour : {
+ dstCell->colours.colour.pRgb8 =
+ (ddRgb8Colour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ case PEXRgb16Colour : {
+ dstCell->colours.colour.pRgb16 =
+ (ddRgb16Colour *)((dstCell->point.ddList->pts.p3Dpt)+3);
+ break; }
+ }
+
+ return(Success);
+
+}
+
+
+OC_COPY_FUNC_HEADER(PSurfaceChars)
+{
+ COPY_DECL(PSC, miPSurfaceCharsStruct);
+
+ switch (srcPSC->type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ DST_STORE_AND_COPY( dstPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct));
+ break;
+
+ case PEXPSCIsoCurves: {
+ DST_STORE_AND_COPY( dstPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_IsoparametricCurves));
+ dstPSC->data.pIsoCurves = (ddPSC_IsoparametricCurves *)(dstPSC + 1);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves: {
+ DST_STORE_AND_COPY( dstPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_LevelCurves));
+ dstPSC->data.pMcLevelCurves = (ddPSC_LevelCurves *)(dstPSC + 1);
+ break;
+ }
+
+ case PEXPSCWcLevelCurves: {
+ DST_STORE_AND_COPY( dstPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_LevelCurves));
+ dstPSC->data.pWcLevelCurves = (ddPSC_LevelCurves *)(dstPSC + 1);
+ break;
+ }
+ }
+
+ return(Success);
+}
+
+
+
+
+OC_COPY_FUNC_HEADER(Gdp2D)
+{
+ COPY_DECL(Gdp, miGdpStruct);
+
+ DST_STORE_AND_COPY( dstGdp, miGdpStruct, (sizeof(miGdpStruct)
+ + sizeof(listofddPoint) + srcGdp->numBytes
+ + srcGdp->points.ddList->numPoints * sizeof(ddCoord2D)));
+ dstGdp->points.ddList = (listofddPoint *)(dstGdp+1);
+ dstGdp->points.ddList->pts.p2Dpt = (ddCoord2D *)((dstGdp->points.ddList) +1);
+ dstGdp->pData = ((ddUCHAR *)(dstGdp->points.ddList))
+ + srcGdp->points.ddList->numPoints * sizeof(ddCoord2D);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(Gdp)
+{
+ COPY_DECL(Gdp, miGdpStruct);
+
+ DST_STORE_AND_COPY( dstGdp, miGdpStruct, (sizeof(miGdpStruct)
+ + sizeof(listofddPoint) + srcGdp->numBytes
+ + srcGdp->points.ddList->numPoints * sizeof(ddCoord3D)));
+ dstGdp->points.ddList = (listofddPoint *)(dstGdp+1);
+ dstGdp->points.ddList->pts.p3Dpt = (ddCoord3D *)((dstGdp->points.ddList) +1);
+ dstGdp->pData = ((ddUCHAR *)(dstGdp->points.ddList))
+ + srcGdp->points.ddList->numPoints * sizeof(ddCoord3D);
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(SetAttribute)
+{
+ COPY_DECL(Attrib, pexElementInfo);
+
+ DST_STORE_AND_COPY( dstAttrib, pexElementInfo,
+ srcAttrib->length * sizeof(CARD32));
+
+ return(Success);
+}
+
+
+OC_COPY_FUNC_HEADER(PropOC)
+{
+ COPY_DECL(PropOC, pexElementInfo);
+
+ DST_STORE_AND_COPY( dstPropOC, pexElementInfo,
+ srcPropOC->length * sizeof(CARD32));
+
+ return(Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miDestroy.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miDestroy.c
new file mode 100644
index 000000000..184886794
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miDestroy.c
@@ -0,0 +1,141 @@
+/* $TOG: miDestroy.c /main/5 1998/02/10 12:41:10 kaleb $ */
+
+/***********************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "pexExtract.h"
+#include "ddpex2.h"
+#include "miStruct.h"
+#include "pexUtils.h"
+
+
+/** This file contains the definition for the OC Destroy Functions,
+ ** each of which takes one parameter: a pointer to the element to be
+ ** destroyed (in server native internal format).
+ ****Note that these functions may be replaced by PEX server porters.
+ **/
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CAT(a,b) a##b
+#else
+#define CAT(a,b) a/**/b
+#endif /* __STDC__ */
+
+#define OC_DESTROY_FUNC_HEADER(suffix) \
+ void CAT(destroy,suffix)(pExecuteOC) \
+ miGenericElementPtr pExecuteOC; /* internal format */
+
+
+/* nothing to delete */
+OC_DESTROY_FUNC_HEADER(NoOp)
+{
+ return;
+}
+
+/* Most OC's are allocated in one hunk */
+OC_DESTROY_FUNC_HEADER(OC_PEX)
+{
+ xfree(pExecuteOC); /* was allocated in one hunk */
+ return;
+}
+
+/* others are more chewy */
+OC_DESTROY_FUNC_HEADER(NurbSurface)
+{
+ miNurbSurfaceStruct *ddNurb = (miNurbSurfaceStruct *)(pExecuteOC + 1);
+ listofTrimCurve *ddTrim;
+ ddTrimCurve *ddTC;
+ ddULONG i, j;
+
+ if (!pExecuteOC) return;
+
+ for ( i=0, ddTrim = ddNurb->trimCurves;
+ i < ddNurb->numTrimCurveLists;
+ i++, ddTrim++ ) {
+ if (ddTrim->pTC) {
+ for ( j=0, ddTC = ddTrim->pTC;
+ j < ddTrim->count;
+ j++, ddTC++ ) {
+ if (ddTC->pKnots) xfree(ddTC->pKnots);
+ if (ddTC->points.pts.ptr) xfree(ddTC->points.pts.ptr);
+ else break;
+ }
+ xfree(ddTrim->pTC);
+ } else break;
+ }
+
+ xfree(pExecuteOC);
+
+ return;
+}
+
+/* and sofas have a LOT of stuffing */
+OC_DESTROY_FUNC_HEADER(SOFAS)
+{
+ ddUSHORT i,j;
+ miSOFASStruct *ddFill = (miSOFASStruct *)(pExecuteOC + 1);
+ miConnListList *pCLL;
+ miConnList *pCList;
+
+ if (!pExecuteOC) return;
+
+ for ( i=0, pCLL = ddFill->connects.data;
+ i<ddFill->connects.numListLists;
+ i++, pCLL++) {
+ if (pCLL->pConnLists) {
+ for ( j=0, pCList=(miConnList *)(pCLL->pConnLists);
+ j<pCLL->numLists;
+ j++, pCList++) {
+ if (pCList->pConnects) xfree(pCList->pConnects);
+ else break;
+ }
+ } else break;
+ xfree(pCLL->pConnLists);
+ }
+ xfree(pExecuteOC);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miFillArea.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miFillArea.c
new file mode 100644
index 000000000..1d39115f6
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miFillArea.c
@@ -0,0 +1,1528 @@
+/* $TOG: miFillArea.c /main/11 1998/02/10 12:41:15 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miFillArea.c,v 3.5 1998/10/04 09:34:19 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miLight.h"
+#include "miClip.h"
+#include "pexos.h"
+
+
+static ddpex3rtn Complete_FillArea_Facetlist();
+static ddpex3rtn Calculate_FillArea_Facet_Normal();
+static ddpex3rtn Calculate_FillArea_Vertex_Color_and_Normal();
+
+/*++
+ |
+ | Function Name: miFillArea
+ |
+ | Function Description:
+ | Handles the Fill area 3D, Fill area 2D, Fill area 3D with data,
+ | Fill are set 2D, Fill are set 3D, Fill are set 3D with data ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miFillArea(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+/* calls */
+ ddpex3rtn miTransform();
+ ddpex3rtn miConvertVertexColors();
+ ddpex3rtn miConvertFacetColors();
+ ddpex3rtn miLightFillArea();
+ ddpex3rtn miClipFillArea();
+ ddpex3rtn miCullFillArea();
+ ddpex3rtn miRenderFillArea();
+
+/* Local variable definitions */
+ miFillAreaStruct *ddFill = (miFillAreaStruct *)(pExecuteOC+1);
+ miListHeader *input_list = &ddFill->points; /* Input points */
+ ddBitmaskShort shape = ddFill->shape; /* shape hint */
+ ddUCHAR noEdges = ddFill->ignoreEdges; /* edge flag*/
+ listofddFacet *input_facet = ddFill->pFacets; /* facets */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+
+ miListHeader *color_list,
+ *mc_list,
+ *mc_clist,
+ *wc_list,
+ *light_list,
+ *cc_list,
+ *clip_list,
+ *dcue_list,
+ *cull_list,
+ *dc_list;
+
+ listofddFacet *color_facet,
+ *mc_facet,
+ *wc_facet,
+ *light_facet,
+ *cc_facet,
+ *clip_facet,
+ *cull_facet,
+ *dc_facet;
+
+ listofddPoint *sp;
+ int i, j;
+ ddUSHORT clip_mode;
+ ddpex3rtn status;
+ ddPointType out_type;
+
+ /*
+ * Convert per-vertex and per-facet colors to rendering color model.
+ * Note that this implementation only supports rgb float.
+ */
+
+ if (DD_IsVertColour(input_list->type)) {
+ if (status = miConvertVertexColors(pRend,
+ input_list, PEXRdrColourModelRGB,
+ &color_list))
+ return (status);
+ } else {
+ color_list = input_list;
+ }
+
+ if ((input_facet) && (DD_IsFacetColour(input_facet->type))) {
+ if (status = miConvertFacetColors(pRend,
+ input_facet, PEXRdrColourModelRGB,
+ &color_facet))
+ return (status);
+ } else {
+ color_facet = input_facet;
+ }
+
+ /* Check for Model clipping */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+ /* Compute modelling coord version of clipping volume */
+ ComputeMCVolume(pRend, pddc);
+ clip_mode = MI_MCLIP;
+
+ /* Tranform points to 4D for clipping */
+ out_type = color_list->type;
+ if (status = miTransform(pddc,
+ color_list, &mc_clist,
+ ident4x4,
+ ident4x4,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+
+ if (status = miClipFillArea(pddc, mc_clist, color_facet,
+ &mc_list, &mc_facet, clip_mode))
+ return (status);
+
+ /* if nothing left after modeling clip, return early */
+ if (mc_list->numLists <= 0) return(Success);
+
+ } else {
+ mc_list = color_list;
+ mc_facet = color_facet;
+ }
+
+ clip_mode = MI_VCLIP;
+
+ /*
+ * First, check lighting requirements
+ */
+ if (pddc->Static.attrs->reflModel != PEXReflectionNoShading) {
+
+ /* Transform to WC prior to applying lighting */
+ out_type = mc_list->type;
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRMCTOWCXFRM(pddc);
+ if (status = miTransform(pddc, mc_list, &wc_list,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Static.misc.inv_tr_mc_to_wc_xform,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ((mc_facet) &&
+ (mc_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(mc_facet->type))) {
+ VALIDATEINVTRMCTOWCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ mc_facet, &wc_facet,
+ pddc->Static.misc.inv_tr_mc_to_wc_xform))
+ return (status);
+ } else wc_facet = mc_facet;
+
+ /* Apply lighting */
+ if (status = miLightFillArea(pRend, pddc,
+ wc_list, wc_facet,
+ &light_list, &light_facet))
+ return (status);
+
+
+ /* Transform to CC for clipping */
+ if (DD_IsVertNormal(light_list->type)) VALIDATEINVTRWCTOCCXFRM(pddc);
+ if (status = miTransform(pddc, light_list, &cc_list,
+ pddc->Dynamic->wc_to_cc_xform,
+ pddc->Static.misc.inv_tr_wc_to_cc_xform,
+ light_list->type))
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ( (light_facet) &&
+ (light_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(light_facet->type)) ) {
+ VALIDATEINVTRWCTOCCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ light_facet, &cc_facet,
+ pddc->Static.misc.inv_tr_wc_to_cc_xform))
+ return (status);
+ } else cc_facet = light_facet;
+
+ }
+ else {
+
+ out_type = mc_list->type;
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRMCTOCCXFRM(pddc);
+ if (status = miTransform(pddc, mc_list, &cc_list,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Static.misc.inv_tr_mc_to_cc_xform,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+
+ if ((mc_facet) &&
+ (mc_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(mc_facet->type))) {
+ VALIDATEINVTRMCTOCCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ mc_facet, &cc_facet,
+ pddc->Static.misc.inv_tr_mc_to_cc_xform))
+ return (status);
+ } else cc_facet = mc_facet;
+ }
+
+ /* View clip primitive */
+ if (status = miClipFillArea(pddc, cc_list, cc_facet,
+ &clip_list, &clip_facet, clip_mode))
+ return (status);
+
+ /* if nothing left after view clip, return early */
+ if (clip_list->numLists <= 0) return(Success);
+
+ /* Now cull according to current culling mode */
+ if (pddc->Dynamic->pPCAttr->cullMode) {
+ if (status = miCullFillArea(pddc, clip_list, clip_facet,
+ &cull_list, &cull_facet))
+ return (status);
+
+ /* if nothing left after culling, return early */
+ if (cull_list->numLists <= 0) return(Success);
+ clip_list = cull_list;
+ clip_facet = cull_facet;
+ } else {
+ cull_list = clip_list;
+ cull_facet = clip_facet;
+ }
+
+ /* DEPTH CUEING */
+ if (pddc->Dynamic->pPCAttr->depthCueIndex) {
+ miDepthCueFillArea(pRend, cull_list, cull_facet, &dcue_list);
+ cull_list = dcue_list;
+ }
+
+ /* Lastly, transform to DC coordinates */
+ out_type = cull_list->type;
+ DD_SetVert2D(out_type);
+ DD_SetVertShort(out_type);
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRCCTODCXFRM(pddc);
+ if (status = miTransform(pddc, cull_list, &dc_list,
+ pddc->Dynamic->cc_to_dc_xform,
+ pddc->Static.misc.inv_tr_cc_to_dc_xform,
+ out_type) )
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ( (clip_facet) &&
+ (clip_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(clip_facet->type)) ) {
+ VALIDATEINVTRCCTODCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ clip_facet, &dc_facet,
+ pddc->Static.misc.inv_tr_cc_to_dc_xform))
+ return (status);
+ } else dc_facet = clip_facet;
+
+
+ return (pddc->Static.RenderProcs[FILLAREA_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_list,
+ dc_facet,
+ shape,
+ noEdges));
+}
+
+/*++
+ |
+ | Function Name: miClipFillArea
+ |
+ | Function Description:
+ | Handles the fill area 3D, fill area 2D,
+ | and fill area set 3D with data ocs.
+ |
+ | Note(s):
+ |
+ | This routine uses a Sutherland-Hodgman approach for
+ | polygon clipping. (See, for example, Rodger's "Procedural
+ | Elements for Computer Graphics", pp 169-179)).
+ | Each list is clipped successively against each (enabled)
+ | clipping boundary.
+ |
+ --*/
+ddpex3rtn
+miClipFillArea(pddc, input_vert, input_fct, output_vert, output_fct, clip_mode)
+/* in */
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+ ddUSHORT clip_mode; /* view or model clipping */
+{
+/* calls */
+ ddpex3rtn miCloseFillArea();
+
+/* uses */
+ ddPointUnion in_ptP, in_ptQ;
+ ddPointUnion out_pt;
+ float t_ptP, t_ptQ;
+ char *in_fct, *out_fct;
+ int point_size;
+ int facet_size;
+ int num_points;
+ int extra_point;
+ int vert_count;
+ miListHeader *input, *output, *list1, *list2;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ listofddFacet *finput, *foutput, *fct_list1, *fct_list2;
+ int num_lists;
+ int i, j, k, num_planes;
+ ddUSHORT clipflags;
+ ddUSHORT current_clip;
+ int edge_offset, clip_code, pts_inlist;
+ ddULONG *edge_ptr;
+ ddHalfSpace *MC_HSpace;
+ ddpex3rtn status;
+ char do_edges,
+ outside; /* flag to indicate current */
+ /* point of interest is outside */
+
+
+
+ /* Vertex data must be homogeneous for view clipping */
+ if ((clip_mode == MI_VCLIP) && !(DD_IsVert4D(input_vert->type)))
+ return(1);
+
+ /* Insure that the polygon bounds form closed contours */
+ if (status = miCloseFillArea(input_vert)) return(status);
+
+ /* PHIGS specifies a single facet for a set of fill areas */
+ *output_fct = input_fct;
+
+ /*
+ * Use the pre-defined clip lists for output
+ * Note that two buffers are used in "ping-pong" fashion:
+ * first the first buffer is used for output, then the second.
+ */
+ list1 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list1, MI_ROUND_LISTHEADERCOUNT(input_vert->numLists));
+ if (!list1->ddList) return(BadAlloc);
+
+ list2 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list2, MI_ROUND_LISTHEADERCOUNT(input_vert->numLists));
+ if (!list2->ddList) return(BadAlloc);
+
+ /*
+ * Must have edge flags in vertex if edges are to be drawn -
+ * otherwise, cannot determine wich edges are "original" and
+ * which edges where added by the clipper.
+ */
+
+ if (pddc->Static.attrs->edges != PEXOff) {
+ do_edges = PEXOn;
+ if (!(DD_IsVertEdge(input_vert->type))) {
+ if (status = miAddEdgeFlag(pddc, input_vert, &list1))
+ return(status);
+ input = list1;
+ } else input = input_vert;
+ } else {
+ do_edges = PEXOff;
+ /* Allocate an initial number of headers */
+ input = input_vert;
+ }
+ /* Note that adding edges will change the input type */
+ list1->type = input->type;
+ list2->type = input->type;
+ list1->flags = input->flags;
+ list2->flags = input->flags;
+ output = list2;
+
+
+ /* Get point size so that this works for all point types */
+ DD_VertPointSize(input->type, point_size);
+ DD_VertOffsetEdge(input->type, edge_offset);
+
+ /*
+ * Each list is now clipped in turn against each (enabled) boundary.
+ */
+
+
+ if (clip_mode == MI_MCLIP) {
+ num_planes = pddc->Static.misc.ms_MCV->numObj;
+ MC_HSpace = (ddHalfSpace *)(pddc->Static.misc.ms_MCV->pList);
+ }
+ else num_planes = 6; /* view clipping to a cube */
+
+ for (i = 0; i < num_planes; i++) {
+ current_clip = 1 << i; /* current_clip is new clip bound */
+
+ num_lists = 0; /* Restart list counter each pass */
+
+ for (j = 0, pddilist = input->ddList, pddolist = output->ddList,
+ output->numLists = 0;
+ j < input->numLists; j++) {
+
+
+ /* Don't process if no points */
+ if ((vert_count = pddilist->numPoints) <= 0) {
+ pddilist++;
+ continue;
+ }
+
+ /*
+ * Insure sufficient room for each vertex.
+ * Note that twice the vertex count is an upper-bound for
+ * a clipped polygon (although there is probably a "tighter fit").
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist, 2*vert_count, point_size);
+ if (!(out_pt.ptr = (char *)pddolist->pts.ptr)) return(BadAlloc);
+ pts_inlist = 0;
+ clip_code = 0;
+ /* Aquire two points */
+ /* and generate clip code */
+ in_ptP.ptr = pddilist->pts.ptr;
+ COMPUTE_CLIP_PARAMS(in_ptP,t_ptP,0,clip_mode,
+ current_clip,MC_HSpace,clip_code);
+
+ if(!(clip_code)) {
+ COPY_POINT(in_ptP, out_pt, point_size);
+ ++pts_inlist;
+ out_pt.ptr += point_size;
+ }
+
+ in_ptQ.ptr = in_ptP.ptr + point_size;
+
+ for (k = 1; k < pddilist->numPoints; k++){
+
+ COMPUTE_CLIP_PARAMS(in_ptQ, t_ptQ, 1, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+
+ switch(clip_code) {
+ case 0: /* both P and Q are in bounds */
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ ++pts_inlist;
+ outside = PEXOff;
+ break;
+ case 1: /* P is out, Q is in */
+ CLIP_AND_COPY(input->type, in_ptP, t_ptP,
+ in_ptQ, t_ptQ, out_pt);
+ out_pt.ptr += point_size;
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_inlist += 2;
+ outside = PEXOff;
+ break;
+ case 2: /* P is in, Q is out */
+ CLIP_AND_COPY(input->type, in_ptQ, t_ptQ,
+ in_ptP, t_ptP, out_pt);
+ if (do_edges == PEXOn) {
+ edge_ptr = (ddULONG *)(out_pt.ptr + edge_offset);
+ *edge_ptr = 0;
+ }
+ out_pt.ptr += point_size;
+ ++pts_inlist;
+ outside = PEXOn;
+ break;
+ case 3: /* both are out */
+ outside = PEXOn;
+ break;
+ }
+
+ in_ptP.ptr = in_ptQ.ptr;
+ t_ptP = t_ptQ;
+ in_ptQ.ptr += point_size;
+ clip_code >>= 1;
+ }
+
+ if (pts_inlist > 1) {
+ if (outside == PEXOn) {
+ /* special case where last segment clipped out. Need to
+ close the fill area */
+ COPY_POINT(pddolist->pts, out_pt, point_size);
+ pts_inlist++;
+ }
+ pddolist->numPoints = pts_inlist;
+ pddolist++;
+ num_lists++;
+
+ }
+
+ /* Now, skip to next input list */
+ pddilist++;
+ }
+
+ /* Complete initialization of output list header */
+ output->numLists = num_lists;
+
+ /* Use result of previous clip for input to next clip */
+ input = output;
+ if (output == list2)
+ output = list1;
+ else output = list2;
+
+ if (clip_mode == MI_MCLIP) MC_HSpace++;
+ } /* end of processing for all planes */
+
+ /* Current input list is last processed (clipped) list */
+ *output_vert = input;
+ return (Success);
+
+}
+
+/*++
+ |
+ | miLightFillArea(pRend, pddc, input_vert, input_fct, output_vert, output_fct)
+ |
+ | Perform lighting calculations for the vertex or facet
+ | data provided according to the current attributes.
+ |
+ --*/
+ddpex3rtn
+miLightFillArea(pRend, pddc, input_vert, input_fct, output_vert, output_fct)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd Context pointer */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+{
+/* calls */
+ ddpex3rtn miApply_Lighting();
+ ddpex3rtn miFilterPath();
+
+/* uses */
+ listofddFacet *fct_list;
+ miListHeader *out_vert;
+ ddRgbFloatNormal *in_fct;
+ ddRgbFloatColour *out_fct;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddRgbFloatNormalPoint4D *in_pt;
+ ddRgbFloatPoint4D *out_pt;
+ int i, j;
+ ddpex3rtn status;
+
+ /*
+ * First, Insure that the vertex and/or facet data
+ * is sufficient for the current Surface Interpolation method.
+ * Note that this implementation does not support
+ * PEXSurfaceInterpDotProduct and PEXSurfaceInterpNormal and
+ * that these surface interpolation types are approximated by
+ * PEXSurfaceInterpColour. The cases dealt with here, therefore,
+ * are constant surface color (thus a single color is computed
+ * per facet) and interpolated surface color (thus a color
+ * per verted is required).
+ */
+ switch(pddc->Static.attrs->surfInterp) {
+
+ case PEXSurfaceInterpNone:
+
+ /*
+ * Insure that input facet data is in proper format
+ * for flat shading.
+ */
+ if ((!input_fct) ||
+ (input_fct->numFacets == 0) ||
+ (!( (DD_IsFacetColour(input_fct->type)) &&
+ (DD_IsFacetNormal(input_fct->type))))) {
+ Complete_FillArea_Facetlist(pddc, input_vert, input_fct,
+ output_fct);
+ input_fct = *output_fct;
+ }
+
+ /*
+ * Should have facets with normals and surface colors now.
+ * Since we are flat shading, there is no further use
+ * for per-vertex color or normal data (however, leave
+ * any edge information). Remove it to prevent confusion
+ * further down the pipeline.
+ */
+ if ( (DD_IsVertNormal(input_vert->type)) ||
+ (DD_IsVertNormal(input_vert->type)) ) {
+ if (status = miFilterPath(pddc, input_vert, output_vert,
+ ((1 << 3) | 1) ))
+ return(status);
+ } else {
+ *output_vert = input_vert;
+ }
+
+ /*
+ * allocate storage for the facet list
+ * Note that the output facet list only contains colors.
+ */
+ *output_fct = fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->numFacets = input_fct->numFacets;
+ fct_list->type = DD_FACET_RGBFLOAT;
+ MI_ALLOCLISTOFDDFACET(fct_list, input_fct->numFacets,
+ sizeof(ddRgbFloatColour));
+ if (!(out_fct = fct_list->facets.pFacetRgbFloat)) return(BadAlloc);
+ in_fct = input_fct->facets.pFacetRgbFloatN;
+ pddilist = input_vert->ddList;
+
+ /*
+ * Compute lighted facet color for each facet.
+ * Facet color is simply the sum of the lighting contributions
+ * from each light source.
+ */
+ for (i= 0; i < input_fct->numFacets; i++) {
+ if (status = miApply_Lighting(pRend, pddc,
+ pddilist->pts.p4Dpt,
+ &(in_fct->colour),
+ &(in_fct->normal),
+ out_fct ))
+ return(status);
+
+ in_fct++;
+ out_fct++;
+ pddilist++;
+ }
+ break;
+
+ case PEXSurfaceInterpColour:
+ case PEXSurfaceInterpDotProduct:
+ case PEXSurfaceInterpNormal:
+
+ if ( (!DD_IsVertColour(input_vert->type)) ||
+ (!DD_IsVertNormal(input_vert->type)) ) {
+ Calculate_FillArea_Vertex_Color_and_Normal(pddc, input_vert,
+ input_fct,
+ output_vert);
+ input_vert = *output_vert;
+ }
+
+ /* No further need for per facet data */
+ *output_fct = 0;
+
+ /* Perform shading on a per-vertex basis */
+ if (pddc->Static.attrs->reflModel != PEXReflectionNoShading) {
+
+ /* Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert, input_vert->numLists)
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = DD_RGBFLOAT_POINT4D;
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+
+ for (i = 0; i < input_vert->numLists; i++) {
+
+ pddolist->numPoints = pddilist->numPoints;
+
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ sizeof(ddRgbFloatPoint4D));
+ if (!(out_pt = pddolist->pts.pRgbFloatpt4D)) return(BadAlloc);
+ in_pt = pddilist->pts.pRgbFloatNpt4D;
+
+ for (j = 0; j < pddilist->numPoints; j++)
+ {
+ out_pt->pt = in_pt->pt;
+ if (status = miApply_Lighting(pRend, pddc,
+ &(in_pt->pt),
+ &(in_pt->colour),
+ &(in_pt->normal),
+ &(out_pt->colour)))
+ return(status);
+
+ in_pt++;
+ out_pt++;
+ }
+ pddilist++;
+ pddolist++;
+ }
+
+ }
+
+ break;
+
+ default:
+ *output_vert = input_vert;
+ *output_fct = input_fct;
+
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | miCullFillArea(pddc, input_vert, input_fct, output_vert, output_fct)
+ |
+ | Perform lighting calculations for the vertex or facet
+ | data provided according to the current attributes.
+ |
+ --*/
+ddpex3rtn
+miCullFillArea(pddc, input_vert, input_fct, output_vert, output_fct)
+ miDDContext *pddc; /* dd Context pointer */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+{
+/* uses */
+ miListHeader *out_vert;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ listofddFacet *fct_list;
+ ddFacetUnion in_fct;
+ ddFacetUnion out_fct;
+ listofddPoint temp;
+ int i, j;
+ char accept;
+ char return_facet_list;
+ int numLists=0;
+ int point_size, facet_size;
+
+ /*
+ * Create facet normals if necessary. These are used to determine
+ * if the facet is to be culled. Note: only return a facet list
+ * if a valid facet list is input.
+ */
+ if ( (!input_fct) || (input_fct->numFacets <= 0) ) {
+ Calculate_FillArea_Facet_Normal(pddc, input_vert,
+ (listofddFacet *)0, &input_fct);
+ return_facet_list = 0;
+ *output_fct = 0;
+
+ } else {
+ if (!(DD_IsFacetNormal(input_fct->type))) {
+ Calculate_FillArea_Facet_Normal(pddc, input_vert,
+ input_fct, output_fct);
+ input_fct = *output_fct;
+ }
+ return_facet_list = 1;
+ }
+
+ /*
+ * allocate storage for the output vertex and facet list
+ */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+ out_vert->type = input_vert->type;
+ out_vert->flags = input_vert->flags;
+ MI_ALLOCLISTHEADER(out_vert, input_vert->numLists)
+ if (!out_vert->ddList) return(BadAlloc);
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+ DD_VertPointSize(input_vert->type, point_size);
+
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = input_fct->type;
+ DDFacetSIZE(input_fct->type, facet_size);
+ MI_ALLOCLISTOFDDFACET(fct_list, input_fct->numFacets, facet_size);
+ out_fct = fct_list->facets;
+ if (!out_fct.pNoFacet) return(BadAlloc);
+ in_fct = input_fct->facets;
+
+
+ /*
+ * This test is performed in NPC space. As a result,
+ * the sign of the z component of the facet normal
+ * indicates the direction in which the facet is pointing.
+ * Therefore if the cullmode is PEXBackFaces and the
+ * z component is negative, reject the facet. Similarily,
+ * if the z component of the normal is positive, and
+ * the cullmode is PEXFrontFaces, also reject the face.
+ * Lastly, note that it is not necessary to copy the vertex
+ * data - it is sufficient to copy the listofddPoint header.
+ * To avoid alloc problems, however, the headers
+ * are interchanged. (As opposed to over-writing the destination
+ * header)
+ */
+ for (i= 0; i < input_fct->numFacets; i++) {
+
+ accept = 0;
+
+ if (pddc->Dynamic->pPCAttr->cullMode == PEXBackFaces) {
+ if (DD_IsFacetColour(input_fct->type)) {
+ if (in_fct.pFacetRgbFloatN->normal.z >= 0) accept = 1;
+ } else if (in_fct.pFacetN->z >= 0) accept = 1;
+ } else /* pddc->Dynamic->pPCAttr->cullMode == PEXFrontFaces */ {
+ if (DD_IsFacetColour(input_fct->type)) {
+ if (in_fct.pFacetRgbFloatN->normal.z < 0) accept = 1;
+ } else if (in_fct.pFacetN->z < 0) accept = 1;
+ }
+
+
+ if (accept) {
+ /* First, swap the listofddPoint headers */
+ temp = *pddilist;
+ *pddilist = *pddolist;
+ *(pddolist++) = temp;
+
+ /* Now, copy the facet info */
+ if (DD_IsFacetColour(input_fct->type))
+ *(out_fct.pFacetRgbFloatN++) = *in_fct.pFacetRgbFloatN;
+ else *(out_fct.pFacetN++) = *in_fct.pFacetN;
+
+ numLists++;
+ }
+
+ pddilist++;
+ if (DD_IsFacetColour(input_fct->type)) in_fct.pFacetRgbFloatN++;
+ else in_fct.pFacetN++;
+ }
+
+ out_vert->numLists = numLists;
+ fct_list->numFacets = numLists;
+
+ /*
+ * Only return facet list if one was passed in. Reduces the
+ * information that must be processed by the rest of the pipeline.
+ */
+ if (return_facet_list) *output_fct = fct_list;
+
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miCloseFillArea
+ |
+ | Function Description:
+ | Close each bound in a list of vertex lists. "Closing"
+ | a bound means insuring that the last point in the
+ | bound is the same as the first point. This routine is
+ | used, for example, to close each bound in a polygon
+ | prior to "hollow" style rendering.
+ |
+ | Note(s):
+ | Note this routine does its work in place - the input
+ | list of vertices is (potentially) modified.
+ |
+ --*/
+
+ddpex3rtn
+miCloseFillArea(vinput)
+/* in */
+ miListHeader *vinput;
+{
+/* uses */
+ char *first_pt, *last_pt;
+ listofddPoint *pddlist;
+ int vert_count;
+ int point_size;
+ int i, j;
+ int close;
+
+ pddlist = vinput->ddList;
+ DD_VertPointSize(vinput->type, point_size);
+
+ /*
+ * Close each list.
+ */
+ for (i = 0; i < vinput->numLists; i++) {
+
+ if ((vert_count = pddlist->numPoints) <= 1) {
+ pddlist++;
+ continue;
+ }
+
+ close = 1;
+
+ /*
+ * Insure that the list forms a closed bound.
+ * Note that comparison is point type dependant.
+ */
+ first_pt = (char *)pddlist->pts.p4Dpt;
+ last_pt = ((char *)pddlist->pts.p4Dpt) + (vert_count-1)*point_size;
+
+ if (DD_IsVertFloat(vinput->type)) {
+
+ if ((DD_IsVert2D(vinput->type)) &&
+ (((ddCoord4D *)first_pt)->x == ((ddCoord4D *)last_pt)->x) &&
+ (((ddCoord4D *)first_pt)->y == ((ddCoord4D *)last_pt)->y))
+ close = 0;
+
+ else
+ if ((DD_IsVert3D(vinput->type)) &&
+ (((ddCoord4D *)first_pt)->x == ((ddCoord4D *)last_pt)->x) &&
+ (((ddCoord4D *)first_pt)->y == ((ddCoord4D *)last_pt)->y) &&
+ (((ddCoord4D *)first_pt)->z == ((ddCoord4D *)last_pt)->z))
+ close = 0;
+
+ else
+ if ((((ddCoord4D *)first_pt)->x == ((ddCoord4D *)last_pt)->x) &&
+ (((ddCoord4D *)first_pt)->y == ((ddCoord4D *)last_pt)->y) &&
+ (((ddCoord4D *)first_pt)->z == ((ddCoord4D *)last_pt)->z) &&
+ (((ddCoord4D *)first_pt)->w == ((ddCoord4D *)last_pt)->w))
+ close = 0;
+
+ } else {
+
+ if ((DD_IsVert2D(vinput->type)) &&
+ (((ddCoord3DS *)first_pt)->x == ((ddCoord3DS *)last_pt)->x) &&
+ (((ddCoord3DS *)first_pt)->y == ((ddCoord3DS *)last_pt)->y))
+ close = 0;
+
+ else
+ if ((((ddCoord3DS *)first_pt)->x == ((ddCoord3DS *)last_pt)->x) &&
+ (((ddCoord3DS *)first_pt)->y == ((ddCoord3DS *)last_pt)->y) &&
+ (((ddCoord3DS *)first_pt)->z == ((ddCoord3DS *)last_pt)->z))
+ close = 0;
+
+ }
+
+
+ /*
+ * if close is set then need to close the bound.
+ * Copy the first point to one poast the last point
+ * in the bound.
+ */
+ if (close) {
+
+ /* Insure sufficient room for each vertex */
+ MI_ALLOCLISTOFDDPOINT(pddlist, vert_count+1, point_size);
+ if (!pddlist->pts.p2DSpt) return(BadAlloc);
+
+ /* Insure realloc didn't move array */
+ first_pt = (char *)pddlist->pts.p4Dpt;
+ last_pt = ((char *)pddlist->pts.p4Dpt)
+ + (vert_count * point_size);
+
+ /* copy first point to end of list */
+ /* JSH - assuming copy may overlap */
+ memmove( last_pt, first_pt, point_size);
+
+ /* Increment point count */
+ pddlist->numPoints += 1;
+ }
+
+ /* Now, ski to next input list */
+ pddlist++;
+ }
+ return (Success);
+}
+
+/*++
+ |
+ | Complete_FillArea_Facetlist(pddc, input_vert, input_fct, output_fct)
+ |
+ | Create an output facet list with facet color and normal using
+ | proper precedence rules.
+ |
+ --*/
+static
+ddpex3rtn
+Complete_FillArea_Facetlist(pddc, input_vert, input_fct, output_fct)
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ listofddFacet **output_fct; /* output facet data */
+{
+
+ listofddFacet *fct_list;
+ ddRgbFloatNormal *out_fct;
+ listofddPoint *pddlist;
+ char *in_pt;
+ ddFacetUnion in_fct;
+ int point_size, color_offset, normal_offset;
+ int numPoints;
+ ddCoord3D *vert1, *vert2, *vert3;
+ int i,j;
+ int point_count;
+ float length;
+ char have_colors, have_normals, done;
+
+ have_colors = have_normals = 0;
+
+ /* What data must be added to output facet list ? */
+ if ((input_fct) && (input_fct->type != DD_FACET_NONE)) {
+ in_fct.pNoFacet = input_fct->facets.pNoFacet;
+ if DD_IsFacetNormal(input_fct->type) have_normals = ~0;
+ if DD_IsFacetColour(input_fct->type) have_colors = ~0;
+ }
+
+ if ((have_colors) && (have_normals)) { /* Why are we here? */
+ *output_fct = input_fct;
+ return(Success);
+ }
+
+ /*
+ * Allocate storage for the facet list
+ */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ MI_ALLOCLISTOFDDFACET(fct_list, 1, sizeof(ddRgbFloatNormal));
+ if (!fct_list->facets.pFacetRgbFloatN) return(BadAlloc);
+ out_fct = (ddRgbFloatNormal *)fct_list->facets.pFacetRgbFloatN;
+
+ DD_VertPointSize(input_vert->type, point_size);
+
+ /*
+ * Compute "intrinsic" color of facet.
+ * There is a "hierarchy" of sources for a facet's intrinsic
+ * color:
+ * vertex_color present? facet_color = vertex_color
+ * else facet_color present? facet_color = facet_color
+ * else facet_color = PC_surface_color
+ * Obviously there is no pre-defined facet color in this routine,
+ * so either use vertex color or surface color from PC.
+ */
+
+ if (DD_IsVertColour(input_vert->type)) {
+ /* Compute average facet color */
+ point_count = 0;
+ pddlist = input_vert->ddList;
+ out_fct->colour.red=out_fct->colour.green=out_fct->colour.blue=0.0;
+ for (i = 0; i < input_vert->numLists; i++, pddlist++) {
+ in_pt = pddlist->pts.ptr;
+ for (j = 0; j < input_vert->numLists;
+ j++, in_pt += point_size, point_count++) {
+ out_fct->colour.red += ((ddRgbFloatPoint4D *)in_pt)->colour.red;
+ out_fct->colour.green += ((ddRgbFloatPoint4D *)in_pt)->colour.green;
+ out_fct->colour.blue += ((ddRgbFloatPoint4D *)in_pt)->colour.blue;
+ }
+ }
+ out_fct->colour.red /= point_count;
+ out_fct->colour.green /= point_count;
+ out_fct->colour.blue /= point_count;
+
+ } else if (have_colors) {
+ out_fct->colour = *in_fct.pFacetRgbFloat;
+
+ } else {
+ /* use front face colors. This needs to get generalized
+ to deal with back-facing attributes*/
+ out_fct->colour = pddc->Static.attrs->surfaceColour.colour.rgbFloat;
+ }
+
+ if (!(have_normals)) {
+
+ done = PEXOff;
+ pddlist = input_vert->ddList;
+
+ for (j = 0; ((j < input_vert->numLists) && !(done)); j++) {
+
+ /* Don't process if insufficient number of points */
+ if ((numPoints = pddlist->numPoints) > 2) {
+
+ in_pt = pddlist->pts.ptr;
+
+ /*
+ * Compute surface normal.
+ * The Surface normal is the cross product of the first
+ * three non-colinear points.
+ */
+
+ vert1 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ vert2 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ vert3 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+
+ numPoints -= 3;
+
+ CROSS_PRODUCT(vert1, vert2, vert3, &(out_fct->normal));
+ NORMALIZE_VECTOR(&(out_fct->normal), length);
+
+ while (NEAR_ZERO(length) && (numPoints > 0)) {
+ vert1 = vert2;
+ vert2 = vert3;
+ vert3 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ CROSS_PRODUCT(vert1, vert2, vert3, &(out_fct->normal));
+ NORMALIZE_VECTOR(&(out_fct->normal), length);
+ numPoints--;
+ }
+ if (!(NEAR_ZERO(length))) done = PEXOn; /* :-) */
+
+ }
+ pddlist++;
+ }
+
+ } else {
+ /* use input facet normals */
+ out_fct->normal = *in_fct.pFacetN;
+ }
+
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+ fct_list->numFacets = 1;
+
+ *output_fct = fct_list;
+
+ return(Success);
+}
+
+/*++
+ |
+ | Calculate_FillArea_Facet_Normal
+ |
+ | Add facet normals to a facet list.
+ |
+ --*/
+static ddpex3rtn
+Calculate_FillArea_Facet_Normal(pddc, input_vert, input_fct, output_fct)
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ listofddFacet **output_fct; /* output facet data */
+{
+
+ listofddFacet *fct_list;
+ ddRgbFloatColour *in_fct;
+ ddFacetUnion out_fct;
+ listofddPoint *pddlist;
+ char *in_pt;
+ ddVector3D normal;
+ int point_size;
+ int numPoints;
+ ddCoord3D *vert1, *vert2, *vert3;
+ int numfacets;
+ int i, j;
+ float length;
+ char done;
+
+ /* Some quick error checking */
+ if ((input_fct) && (DD_IsFacetNormal(input_fct->type))) return(Success);
+
+ /*
+ * Allocate storage for the output facet list
+ */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ if ((input_fct) && DD_IsFacetColour(input_fct->type)) {
+ in_fct = input_fct->facets.pFacetRgbFloat;
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+ numfacets = 1;
+ MI_ALLOCLISTOFDDFACET(fct_list, 1, sizeof(ddRgbFloatNormal));
+ } else {
+ in_fct = 0;
+ fct_list->type = DD_FACET_NORM;
+ numfacets = 1;
+ MI_ALLOCLISTOFDDFACET(fct_list, 1, sizeof(ddVector3D));
+ }
+
+ fct_list->numFacets = numfacets;
+
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = fct_list->facets;
+
+ DD_VertPointSize(input_vert->type, point_size);
+
+ pddlist = input_vert->ddList;
+
+
+ /* Copy the input facet color */
+ if (in_fct) {
+ *out_fct.pFacetRgbFloat = *in_fct;
+ in_fct++;
+ }
+
+ done = PEXOff;
+
+ for(i = 0; ((i < input_vert->numLists) && (!(done))); i++) {
+
+
+ if ((numPoints = pddlist->numPoints) > 2) {
+
+ in_pt = pddlist->pts.ptr;
+
+ /*
+ * Compute surface normal.
+ * The Surface normal is the cross product of the first
+ * three non-colinear points.
+ */
+ numPoints -= 3;
+ vert1 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ vert2 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ vert3 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ CROSS_PRODUCT(vert1, vert2, vert3, &normal);
+ NORMALIZE_VECTOR(&normal, length);
+
+ while (NEAR_ZERO(length) && (--numPoints >= 0)) {
+ vert1 = vert2;
+ vert2 = vert3;
+ vert3 = ((ddCoord3D *)in_pt);
+ in_pt += point_size;
+ CROSS_PRODUCT(vert1, vert2, vert3, &normal);
+ NORMALIZE_VECTOR(&normal, length);
+ }
+
+ /* Initialize to some arbitrary value if degenerate */
+ if (!NEAR_ZERO(length)) {
+ done = PEXOn;
+
+ if (in_fct) (out_fct.pFacetRgbFloatN++)->normal = normal;
+ else *(out_fct.pFacetN++) = normal;
+ }
+ }
+
+ pddlist++;
+ }
+
+ *output_fct = fct_list;
+
+ return(Success);
+}
+
+/*++
+ |
+ | Calculate_FillArea_Vertex_Color_and_Normal
+ |
+ | Add vertex normals and colors to a vertex list.
+ |
+ --*/
+static ddpex3rtn
+Calculate_FillArea_Vertex_Color_and_Normal(pddc, input_vert, input_fct,
+ output_vert)
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+{
+ miListHeader *out_vert;
+ listofddFacet *fct_list;
+ ddRgbFloatNormal *out_fct;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddRgbFloatNormalPoint4D *out_pt;
+ ddPointUnion in_pt;
+ ddFacetUnion in_fct;
+ int point_size, facet_size;
+ int numFacets=0;
+ int numPoints;
+ int i,j;
+ char done;
+
+ /* Some quick error checking */
+ if ((DD_IsVertNormal(input_vert->type)) &&
+ (DD_IsVertColour(input_vert->type)))
+ return(Success);
+
+ /* Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert, input_vert->numLists)
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = DD_RGBFLOAT_NORM_POINT4D;
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+
+ DD_VertPointSize(input_vert->type, point_size);
+
+ /* Compute facet normals if no per-vertex normals with data */
+ if (!(DD_IsVertNormal(input_vert->type))) {
+
+ if (!(input_fct)) {
+ if (i = Calculate_FillArea_Facet_Normal(pddc, input_vert,
+ input_fct, &fct_list))
+ return(i);
+ input_fct = fct_list;
+
+ }
+
+ else if (!(DD_IsFacetNormal(input_fct->type))) {
+ if (i = Calculate_FillArea_Facet_Normal(pddc, input_vert,
+ input_fct, &fct_list))
+ return(i);
+ input_fct = fct_list;
+ }
+ }
+
+ if ((input_fct) && (input_fct->numFacets > 0))
+ in_fct = input_fct->facets;
+ else in_fct.pNoFacet = 0;
+
+ DDFacetSIZE(input_fct->type, facet_size);
+
+ done = PEXOff;
+
+ for (i = 0; i < input_vert->numLists; i++) {
+
+ pddolist->numPoints = pddilist->numPoints;
+
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ sizeof(ddRgbFloatNormalPoint4D));
+ if (!(out_pt = pddolist->pts.pRgbFloatNpt4D)) return(BadAlloc);
+ in_pt = pddilist->pts;
+
+ for (j = 0; j < pddilist->numPoints; j++)
+ {
+ /* First copy over coordinate data */
+ out_pt->pt = *in_pt.p4Dpt;
+
+ /*
+ * Next color
+ * Colour is derived first from the vertex, second from the
+ * facet, and third from the current PC attributes.
+ */
+ if (DD_IsVertColour(input_vert->type))
+ out_pt->colour = in_pt.pRgbFloatpt4D->colour;
+ else if ((in_fct.pNoFacet) && (DD_IsFacetColour(input_fct->type)))
+ out_pt->colour = *in_fct.pFacetRgbFloat;
+ else
+ out_pt->colour = pddc->Static.attrs->surfaceColour.colour.rgbFloat;
+
+ /*
+ * Next normals
+ * Colour is derived first from the vertex, second from the
+ * facet (note that we insured above that there were facet normals).
+ */
+ if (DD_IsVertNormal(input_vert->type))
+ out_pt->normal = in_pt.pNpt4D->normal;
+ else if (DD_IsFacetColour(input_fct->type))
+ out_pt->normal = in_fct.pFacetRgbFloatN->normal;
+ else out_pt->normal = *in_fct.pFacetN;
+
+ out_pt++;
+ in_pt.ptr += point_size;
+ }
+
+ pddilist++;
+ pddolist++;
+ }
+
+ return(Success);
+}
+
+
+
+/*++
+ |
+ | DepthCueFillArea(pRend, input_vert, input_fct, output_vert)
+ |
+ | Applies depth cueing to the vertex colors in a FillArea data list
+ |
+ --*/
+ddpex3rtn
+miDepthCueFillArea(pRend, input_vert, input_fct, output_vert)
+ ddRendererPtr pRend; /* renderer handle */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *out_vert;
+ listofddFacet *fct_list;
+ ddRgbFloatNormal *out_fct;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddPointUnion in_pt, out_pt;
+ ddRgbFloatColour *in_color;
+ ddFacetUnion in_fct;
+ int point_size, facet_size;
+ int numFacets=0;
+ int numPoints;
+ int i,j,outpoint_size;
+ miColourEntry *pintcolour;
+ ddFLOAT pt_depth;
+ ddULONG colourindex;
+ ddColourSpecifier intcolour;
+ ddUSHORT status;
+ ddDepthCueEntry *dcue_entry;
+
+ /* look for empty list header */
+ if (input_vert->numLists == 0) return(Success);
+
+ /* validate CC version of Depth Cue information */
+ if (pddc->Static.misc.flags & CC_DCUEVERSION)
+ Compute_CC_Dcue(pRend, pddc);
+
+ /* check to make sure depth cuing is enabled */
+ if (pddc->Static.misc.cc_dcue_entry.mode == PEXOff) {
+ *output_vert = input_vert;
+ return(Success);
+ }
+
+ /* Else, depth cue! Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert, input_vert->numLists)
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = input_vert->type;
+ DD_SetVertRGBFLOAT(out_vert->type);
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+ DD_VertPointSize(input_vert->type, point_size);
+
+ if ((input_fct) && (input_fct->numFacets > 0)){
+ in_fct = input_fct->facets;
+ DDFacetSIZE(input_fct->type, facet_size);
+ }
+ else in_fct.pNoFacet = 0;
+
+ /* Get current surface color if appropriate */
+ if (!(DD_IsVertColour(input_vert->type)) &&
+ (pddc->Static.attrs->surfaceColour.colourType
+ == PEXIndexedColour)) {
+ if ((InquireLUTEntryAddress (PEXColourLUT, pRend->lut[PEXColourLUT],
+ pddc->Static.attrs->surfaceColour.colour.indexed.index,
+ &status, (ddPointer *)&pintcolour)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+
+ DD_VertPointSize(out_vert->type, outpoint_size);
+
+ for (i = 0; i < input_vert->numLists; i++) {
+
+ pddolist->numPoints = pddilist->numPoints;
+
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ outpoint_size);
+ if (!(out_pt.ptr = pddolist->pts.ptr)) return(BadAlloc);
+ in_pt = pddilist->pts;
+
+ for (j = 0; j < pddilist->numPoints; j++) {
+ /* First copy over coordinate data */
+ pt_depth = in_pt.p4Dpt->z;
+ *out_pt.p4Dpt = *in_pt.p4Dpt;
+ in_pt.p4Dpt++;
+ out_pt.p4Dpt++;
+
+ /*
+ * Next color
+ * Colour is derived first from the vertex, second from the
+ * facet, and third from the current PC attributes.
+ */
+
+ if (DD_IsVertColour(input_vert->type)){
+ in_color = in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ }
+ else {
+ if ((in_fct.pNoFacet) && (DD_IsFacetColour(input_fct->type)))
+ in_color = in_fct.pFacetRgbFloat;
+ else {
+ if (pddc->Static.attrs->surfaceColour.colourType
+ == PEXIndexedColour)
+ in_color = &pintcolour->entry.colour.rgbFloat;
+ else in_color =
+ &(pddc->Static.attrs->surfaceColour.colour.rgbFloat);
+ }
+ }
+
+ APPLY_DEPTH_CUEING(pddc->Static.misc.cc_dcue_entry,
+ pt_depth, in_color, out_pt.pRgbFloatClr)
+
+ out_pt.pRgbFloatClr++;
+
+ /*
+ * Next normals
+ * Colour is derived first from the vertex, second from the
+ * facet (note that we insured above that there were facet normals).
+ */
+
+ if DD_IsVertNormal(input_vert->type) {
+ *out_pt.pNormal = *in_pt.pNormal;
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ /* Next pass along edge info if there is any */
+ if (DD_IsVertEdge(out_vert->type)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+
+ }
+
+ pddilist++;
+ pddolist++;
+ }
+
+ return(Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miInquire.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miInquire.c
new file mode 100644
index 000000000..54ef871a7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miInquire.c
@@ -0,0 +1,1389 @@
+/* $TOG: miInquire.c /main/11 1998/02/10 12:41:21 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miInquire.c,v 3.6 1998/10/04 09:34:20 dawes Exp $ */
+
+
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "pexExtract.h"
+#include "ddpex2.h"
+#include "miStruct.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+/*
+ opposites of parse, although since we know in advance (from storing)
+ the size of the original OC, we only need to one memory allocation
+ per OC, and since all output is written to the pex buffer, only
+ checking for sufficient size and reallocing is necessary
+ */
+
+/*
+ Please note that any routines added to this file may also cause
+ a corresponding modification to the level function tables (miTables.c)
+ */
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CAT(a,b) a##b
+#else
+#define CAT(a,b) a/**/b
+#endif
+
+#define OC_INQ_FUNC_HEADER(suffix) \
+ ddpex2rtn CAT(inquire,suffix)(pExecuteOC, pBuf, ppPEXOC) \
+ miGenericElementStr *pExecuteOC; /* internal format */ \
+ ddBuffer *pBuf; \
+ pexElementInfo **ppPEXOC; /* PEX format */
+
+#define COPY_PTR(PTR) ddPointer PTR;
+
+#define LEN_WO_HEADER(OCtype) (pPEXOC->length * sizeof(CARD32) - sizeof(OCtype))
+
+#define GET_INQ_STORAGE(PEX_ST, PEX_TYPE, DD_ST, DD_TYPE) \
+ if (PU_BUF_TOO_SMALL( pBuf, (pExecuteOC->element.pexOClength)<<2)) { \
+ if ((puBuffRealloc(pBuf, (pExecuteOC->element.pexOClength)<<2)) != Success) {\
+ return (BadAlloc); } } \
+ *ppPEXOC = (pexElementInfo *)(pBuf->pBuf); \
+ (*ppPEXOC)->elementType = pExecuteOC->element.elementType; \
+ (*ppPEXOC)->length = pExecuteOC->element.pexOClength; \
+ (PEX_ST) = (PEX_TYPE *)(*ppPEXOC); \
+ DD_ST = (DD_TYPE *)(pExecuteOC + 1);
+
+#define GET_MORE_STORAGE(DD_ST, TYPE, SIZE) \
+ (DD_ST) = (TYPE *)xalloc((unsigned long)(SIZE)); \
+ if (!(DD_ST)) return (BadAlloc);
+
+
+
+
+
+static void
+InqFacetOptData(pFacetList, ptr, rcolourType, rfacetMask, rptr)
+listofddFacet *pFacetList;
+ddPointer ptr;
+INT16 *rcolourType; /* out */
+CARD16 *rfacetMask; /* out */
+ddPointer *rptr; /* out */
+{
+ switch (pFacetList->type) {
+
+ case DD_FACET_INDEX_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXIndexedColour;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddIndexNormal,
+ pFacetList->facets.pFacetIndexN, ptr);
+ break; }
+
+ case DD_FACET_RGBFLOAT_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXRgbFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgbFloatNormal,
+ pFacetList->facets.pFacetRgbFloatN, ptr);
+ break; }
+
+ case DD_FACET_CIE_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXCieFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddCieNormal,
+ pFacetList->facets.pFacetCieN, ptr);
+ break; }
+
+ case DD_FACET_HSV_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXHsvFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddHsvNormal,
+ pFacetList->facets.pFacetHsvN, ptr);
+ break; }
+
+ case DD_FACET_HLS_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXHlsFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddHlsNormal,
+ pFacetList->facets.pFacetHlsN, ptr);
+ break; }
+
+ case DD_FACET_RGB8_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXRgb8Colour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgb8Normal,
+ pFacetList->facets.pFacetRgb8N, ptr);
+ break; }
+
+ case DD_FACET_RGB16_NORM: {
+ *rfacetMask = PEXGAColour | PEXGANormal;
+ *rcolourType = PEXRgb16Colour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgb16Normal,
+ pFacetList->facets.pFacetRgb16N, ptr);
+ break; }
+
+
+ case DD_FACET_NORM: {
+ *rfacetMask = PEXGANormal;
+ /* return an out of range value instead of 0 */
+ *rcolourType = 666;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddVector3D,
+ pFacetList->facets.pFacetN, ptr);
+ break; }
+
+ case DD_FACET_INDEX: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXIndexedColour;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddIndexedColour,
+ pFacetList->facets.pFacetIndex, ptr);
+
+ break; }
+
+ case DD_FACET_RGBFLOAT: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXRgbFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgbFloatColour,
+ pFacetList->facets.pFacetRgbFloat, ptr);
+ break; }
+
+ case DD_FACET_CIE: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXCieFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddCieColour,
+ pFacetList->facets.pFacetCie, ptr);
+ break; }
+
+ case DD_FACET_HSV: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXHsvFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddHsvColour,
+ pFacetList->facets.pFacetHsv, ptr);
+ break; }
+
+ case DD_FACET_HLS: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXHlsFloatColour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddHlsColour,
+ pFacetList->facets.pFacetHls, ptr);
+ break; }
+
+ case DD_FACET_RGB8: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXRgb8Colour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgb8Colour,
+ pFacetList->facets.pFacetRgb8, ptr);
+ break; }
+
+ case DD_FACET_RGB16: {
+ *rfacetMask = PEXGAColour;
+ *rcolourType = PEXRgb16Colour ;
+ PACK_LISTOF_STRUCT( pFacetList->numFacets, ddRgb16Colour,
+ pFacetList->facets.pFacetRgb16, ptr);
+ break; }
+
+ case DD_FACET_NONE: {
+ /* neither Colour nor Normal specified */
+ *rfacetMask = 0;
+ /* return an out of range value instead of 0 */
+ *rcolourType = 666;
+ break; }
+ }
+
+ *rptr = ptr;
+}
+
+
+static void
+InqVertexData(pVertexList, point_type, ptr, rcolourType, rvertexMask, rptr)
+listofddPoint *pVertexList;
+ddPointType point_type;
+ddPointer ptr;
+INT16 *rcolourType; /* out */
+CARD16 *rvertexMask; /* out */
+ddPointer *rptr; /* out */
+{
+ switch (point_type) {
+ case DD_INDEX_NORM_EDGE_POINT: {
+ *rcolourType = PEXIndexedColour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddIndexNormEdgePoint,
+ pVertexList->pts.pIndexNEpt, ptr);
+ break; }
+
+ case DD_RGBFLOAT_NORM_EDGE_POINT: {
+ *rcolourType = PEXRgbFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgbFloatNormEdgePoint,
+ pVertexList->pts.pRgbFloatNEpt, ptr);
+ break; }
+
+ case DD_CIE_NORM_EDGE_POINT: {
+ *rcolourType = PEXCieFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddCieNormEdgePoint,
+ pVertexList->pts.pCieNEpt, ptr);
+ break; }
+
+ case DD_HSV_NORM_EDGE_POINT: {
+ *rcolourType = PEXHsvFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHsvNormEdgePoint,
+ pVertexList->pts.pHsvNEpt, ptr);
+ break; }
+
+ case DD_HLS_NORM_EDGE_POINT: {
+ *rcolourType = PEXHlsFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHlsNormEdgePoint,
+ pVertexList->pts.pHlsNEpt, ptr);
+ break; }
+
+ case DD_RGB8_NORM_EDGE_POINT: {
+ *rcolourType = PEXRgb8Colour ;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb8NormEdgePoint,
+ pVertexList->pts.pRgb8NEpt, ptr);
+ break; }
+
+ case DD_RGB16_NORM_EDGE_POINT: {
+ *rcolourType = PEXRgb16Colour;
+ *rvertexMask = PEXGAColour | PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb16NormEdgePoint,
+ pVertexList->pts.pRgb16NEpt, ptr);
+ break; }
+
+ case DD_NORM_EDGE_POINT: {
+ /* take this out to prevent overwrite of valid facet colortype
+ *rcolourType = 0;
+ */
+ *rvertexMask = PEXGANormal | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddNormEdgePoint,
+ pVertexList->pts.pNEpt, ptr);
+ break; }
+
+ case DD_INDEX_NORM_POINT: {
+ *rcolourType = PEXIndexedColour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddIndexNormalPoint,
+ pVertexList->pts.pIndexNpt, ptr);
+ break; }
+
+ case DD_RGBFLOAT_NORM_POINT: {
+ *rcolourType = PEXRgbFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgbFloatNormalPoint,
+ pVertexList->pts.pRgbFloatNpt, ptr);
+ break; }
+
+ case DD_CIE_NORM_POINT: {
+ *rcolourType = PEXCieFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddCieNormalPoint,
+ pVertexList->pts.pCieNpt, ptr);
+ break; }
+
+ case DD_HSV_NORM_POINT: {
+ *rcolourType = PEXHsvFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHsvNormalPoint,
+ pVertexList->pts.pHsvNpt, ptr);
+ break; }
+
+ case DD_HLS_NORM_POINT: {
+ *rcolourType = PEXHlsFloatColour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHlsNormalPoint,
+ pVertexList->pts.pHlsNpt, ptr);
+ break; }
+
+ case DD_RGB8_NORM_POINT: {
+ *rcolourType = PEXRgb8Colour ;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb8NormalPoint,
+ pVertexList->pts.pRgb8Npt, ptr);
+ break; }
+
+ case DD_RGB16_NORM_POINT: {
+ *rcolourType = PEXRgb16Colour;
+ *rvertexMask = PEXGAColour | PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb16NormalPoint,
+ pVertexList->pts.pRgb16Npt, ptr);
+ break; }
+
+ case DD_NORM_POINT: {
+ /* take this out to prevent overwrite of valid facet colortype
+ *rcolourType = 0;
+ */
+ *rvertexMask = PEXGANormal;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddNormalPoint,
+ pVertexList->pts.pNpt, ptr);
+ break; }
+
+ case DD_INDEX_EDGE_POINT: {
+ *rcolourType = PEXIndexedColour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddIndexEdgePoint,
+ pVertexList->pts.pIndexEpt, ptr);
+ break; }
+
+ case DD_RGBFLOAT_EDGE_POINT: {
+ *rcolourType = PEXRgbFloatColour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgbFloatEdgePoint,
+ pVertexList->pts.pRgbFloatEpt, ptr);
+ break; }
+
+ case DD_CIE_EDGE_POINT: {
+ *rcolourType = PEXCieFloatColour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddCieEdgePoint,
+ pVertexList->pts.pCieEpt, ptr);
+ break; }
+
+ case DD_HSV_EDGE_POINT: {
+ *rcolourType = PEXHsvFloatColour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHsvEdgePoint,
+ pVertexList->pts.pHsvEpt, ptr);
+ break; }
+
+ case DD_HLS_EDGE_POINT: {
+ *rcolourType = PEXHlsFloatColour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHlsEdgePoint,
+ pVertexList->pts.pHlsEpt, ptr);
+ break; }
+
+ case DD_RGB8_EDGE_POINT: {
+ *rcolourType = PEXRgb8Colour ;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb8EdgePoint,
+ pVertexList->pts.pRgb8Ept, ptr);
+ break; }
+
+ case DD_RGB16_EDGE_POINT: {
+ *rcolourType = PEXRgb16Colour;
+ *rvertexMask = PEXGAColour | PEXGAEdges;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb16EdgePoint,
+ pVertexList->pts.pRgb16Ept, ptr);
+ break; }
+
+ case DD_EDGE_POINT: {
+ /* neither Colour nor Normal specified */
+ /* take this out to prevent overwrite of valid facet colortype
+ *rcolourType = 0;
+ */
+ *rvertexMask = 0;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddEdgePoint,
+ pVertexList->pts.pEpt, ptr);
+ break; }
+ case DD_INDEX_POINT: {
+ *rcolourType = PEXIndexedColour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddIndexPoint,
+ pVertexList->pts.pIndexpt, ptr);
+ break; }
+
+ case DD_RGBFLOAT_POINT: {
+ *rcolourType = PEXRgbFloatColour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgbFloatPoint,
+ pVertexList->pts.pRgbFloatpt, ptr);
+ break; }
+
+ case DD_CIE_POINT: {
+ *rcolourType = PEXCieFloatColour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddCiePoint,
+ pVertexList->pts.pCiept, ptr);
+ break; }
+
+ case DD_HSV_POINT: {
+ *rcolourType = PEXHsvFloatColour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHsvPoint,
+ pVertexList->pts.pHsvpt, ptr);
+ break; }
+
+ case DD_HLS_POINT: {
+ *rcolourType = PEXHlsFloatColour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddHlsPoint,
+ pVertexList->pts.pHlspt, ptr);
+ break; }
+
+ case DD_RGB8_POINT: {
+ *rcolourType = PEXRgb8Colour ;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb8Point,
+ pVertexList->pts.pRgb8pt, ptr);
+ break; }
+
+ case DD_RGB16_POINT: {
+ *rcolourType = PEXRgb16Colour;
+ *rvertexMask = PEXGAColour;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddRgb16Point,
+ pVertexList->pts.pRgb16pt, ptr);
+ break; }
+
+ case DD_3D_POINT: {
+ /* neither Colour nor Normal specified */
+ /* take this out to prevent overwrite of valid facet colortype
+ *rcolourType = 0;
+ */
+ *rvertexMask = 0;
+ PACK_LISTOF_STRUCT( pVertexList->numPoints, ddCoord3D,
+ pVertexList->pts.p3Dpt, ptr);
+ break; }
+ }
+
+ *rptr = ptr;
+ if (DD_IsVertEdge(point_type)) *rvertexMask |= PEXGAEdges;
+}
+
+
+OC_INQ_FUNC_HEADER(ColourOC)
+{
+ pexMarkerColour *pColour;
+ miColourStruct *ddColour;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pColour, pexMarkerColour, ddColour, miColourStruct);
+ ptr = (ddPointer)&(pColour->colourSpec);
+ PACK_CARD16(ddColour->colourType, ptr);
+ SKIP_PADDING(ptr,2);
+
+ switch (ddColour->colourType) {
+ case PEXIndexedColour: {
+ PACK_STRUCT(pexIndexedColour, ddColour->colour.pIndex, ptr);
+ break; }
+ case PEXRgbFloatColour : {
+ PACK_STRUCT(pexRgbFloatColour, ddColour->colour.pRgbFloat, ptr);
+ break; }
+ case PEXCieFloatColour : {
+ PACK_STRUCT(pexCieColour, ddColour->colour.pCie, ptr);
+ break; }
+ case PEXHsvFloatColour : {
+ PACK_STRUCT(pexHsvColour, ddColour->colour.pHsv, ptr);
+ break; }
+ case PEXHlsFloatColour : {
+ PACK_STRUCT(pexHlsColour, ddColour->colour.pHls, ptr);
+ break; }
+ case PEXRgb8Colour : {
+ PACK_STRUCT(pexRgb8Colour, ddColour->colour.pRgb8, ptr);
+ break; }
+ case PEXRgb16Colour : {
+ PACK_STRUCT(pexRgb16Colour, ddColour->colour.pRgb16, ptr);
+ break; }
+ }
+
+ return(Success);
+}
+
+OC_INQ_FUNC_HEADER(ColourIndexOC)
+{
+ miColourStruct *ddColour;
+ pexMarkerColourIndex *pColour;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pColour, pexMarkerColourIndex, ddColour, miColourStruct);
+ ptr = (ddPointer)&(pColour->index);
+ PACK_CARD16(ddColour->colour.pIndex->index,ptr);
+
+ return(Success);
+}
+
+OC_INQ_FUNC_HEADER(LightState)
+{
+ miLightStateStruct *ddLightState;
+ pexLightState *pLightState;
+ ddUSHORT i, *pi;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pLightState, pexLightState, ddLightState,
+ miLightStateStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pLightState)+1);
+ PACK_CARD16(ddLightState->enableList->numObj, ptr);
+ PACK_CARD16(ddLightState->disableList->numObj, ptr);
+
+ for ( i=0, pi=(ddUSHORT *)(ddLightState->enableList->pList);
+ i<ddLightState->enableList->numObj;
+ i++, pi++ ) {
+ PACK_CARD16(*pi, ptr);
+ }
+
+ SKIP_PADDING(ptr, ((ddLightState->enableList->numObj) %2)*sizeof(CARD16));
+
+ for ( i=0, pi=(ddUSHORT *)(ddLightState->disableList->pList);
+ i<ddLightState->disableList->numObj;
+ i++, pi++ ) {
+ PACK_CARD16(*pi, ptr);
+ }
+
+ return(Success);
+}
+
+OC_INQ_FUNC_HEADER(MCVolume)
+{
+
+ miMCVolume_Struct *ddMCVolume;
+ pexModelClipVolume *pMCVolume;
+
+ ddHalfSpace *ddHS;
+ pexHalfSpace *pHS;
+ ddUSHORT i;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pMCVolume, pexModelClipVolume,
+ ddMCVolume, miMCVolume_Struct);
+ ptr = (ddPointer)(((pexElementInfo *)pMCVolume)+1);
+ PACK_CARD16(ddMCVolume->operator, ptr);
+ PACK_CARD16(ddMCVolume->halfspaces->numObj, ptr);
+
+ for ( i=0, ddHS=(ddHalfSpace *)(ddMCVolume->halfspaces->pList);
+ i < ddMCVolume->halfspaces->numObj; i++) {
+
+ PACK_COORD3D(&ddHS->orig_point, ptr);
+ PACK_VECTOR3D(&ddHS->orig_vector, ptr);
+ ddHS++;
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(MCVolume2D)
+{
+
+ miMCVolume_Struct *ddMCVolume2D;
+ pexModelClipVolume2D *pMCVolume2D;
+
+ ddHalfSpace *ddHS;
+ pexHalfSpace2D *pHS;
+ int i;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pMCVolume2D, pexModelClipVolume2D,
+ ddMCVolume2D, miMCVolume_Struct)
+ ptr = (ddPointer)(((pexElementInfo *)pMCVolume2D)+1);
+ PACK_CARD16(ddMCVolume2D->operator, ptr);
+ PACK_CARD16(ddMCVolume2D->halfspaces->numObj, ptr);
+
+ for (i=0, ddHS=(ddHalfSpace *)(ddMCVolume2D->halfspaces->pList),
+ pHS = (pexHalfSpace2D *)(ptr);
+ i < ddMCVolume2D->halfspaces->numObj; i++) {
+
+ PACK_COORD2D(&(ddHS->orig_point), ptr);
+ PACK_VECTOR2D(&(ddHS->orig_vector), ptr);
+ ddHS++;
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Marker)
+{
+ miMarkerStruct *ddMarker;
+ pexMarker *pMarker;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pMarker, pexMarker, ddMarker, miListHeader);
+ ptr = (ddPointer)(pMarker + 1);
+ PACK_LISTOF_COORD3D( ddMarker->ddList->numPoints,
+ ddMarker->ddList->pts.p3Dpt, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Marker2D)
+{
+ miMarkerStruct *ddMarker;
+ pexMarker2D *pMarker;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pMarker, pexMarker2D, ddMarker, miListHeader);
+ ptr = (ddPointer)(pMarker + 1);
+ PACK_LISTOF_COORD2D( ddMarker->ddList->numPoints,
+ ddMarker->ddList->pts.p2Dpt, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Text)
+{
+ miTextStruct *ddText;
+ pexText *pText;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pText, pexText, ddText, miTextStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pText)+1);
+ PACK_COORD3D( ddText->pOrigin, ptr);
+ PACK_COORD3D( ddText->pDirections, ptr);
+ PACK_COORD3D( (ddText->pDirections) + 1, ptr);
+ PACK_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ memcpy( (char *)ptr, (char *)(ddText->pText),
+ (int)( sizeof(CARD32) * pText->head.length
+ - sizeof(pexText)));
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Text2D)
+{
+ miText2DStruct *ddText;
+ pexText2D *pText;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pText, pexText2D, ddText, miText2DStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pText)+1);
+ PACK_COORD2D( ddText->pOrigin, ptr);
+ PACK_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ memcpy( (char *)ptr, (char *)(ddText->pText),
+ (int)( sizeof(CARD32) * pText->head.length
+ - sizeof(pexText2D)));
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(AnnotationText)
+{
+ miAnnoTextStruct *ddText;
+ pexAnnotationText *pText;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pText, pexAnnotationText, ddText, miAnnoTextStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pText)+1);
+ PACK_COORD3D( ddText->pOrigin, ptr);
+ PACK_COORD3D( ddText->pOffset, ptr);
+ PACK_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ memcpy( (char *)ptr, (char *)(ddText->pText),
+ (int)( sizeof(CARD32) * pText->head.length
+ - sizeof(pexAnnotationText)));
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(AnnotationText2D)
+{
+ miAnnoText2DStruct *ddText;
+ pexAnnotationText2D *pText;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pText, pexAnnotationText2D, ddText, miAnnoText2DStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pText)+1);
+ PACK_COORD2D( ddText->pOrigin, ptr);
+ PACK_COORD2D( ddText->pOffset, ptr);
+ PACK_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ memcpy( (char *)ptr, (char *)(ddText->pText),
+ (int)( sizeof(CARD32) * pText->head.length
+ - sizeof(pexAnnotationText2D)));
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Polyline2D)
+{
+ miPolylineStruct *ddPoly;
+ pexPolyline2D *pPoly;
+ listofddPoint *ddPoint;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pPoly, pexPolyline2D, ddPoly, miListHeader);
+ ptr = (ddPointer)(pPoly + 1);
+ ddPoint = (listofddPoint *)(ddPoly+1);
+ PACK_LISTOF_COORD2D(ddPoint->numPoints,ddPoint->pts.p2Dpt,ptr);
+
+ return(Success);
+}
+
+
+
+OC_INQ_FUNC_HEADER(Polyline)
+{
+ miPolylineStruct *ddPoly;
+ pexPolyline *pPoly;
+ listofddPoint *ddPoint;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pPoly, pexPolyline, ddPoly, miListHeader);
+ ptr = (ddPointer)(pPoly + 1);
+ ddPoint = (listofddPoint *)(ddPoly+1);
+ PACK_LISTOF_COORD3D(ddPoint->numPoints,ddPoint->pts.p3Dpt,ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(PolylineSet)
+{
+ miPolylineStruct *ddPoly;
+ pexPolylineSet *pPoly;
+ listofddPoint *ddPoint;
+ ddUSHORT i;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pPoly, pexPolylineSet, ddPoly, miListHeader);
+ ptr = (ddPointer)(pPoly + 1);
+
+ for (i=0, ddPoint = (listofddPoint *)(ddPoly+1);
+ i<ddPoly->numLists;
+ i++, ddPoint++) {
+
+ PACK_CARD32(ddPoint->numPoints, ptr);
+ InqVertexData( ddPoint, ddPoly->type, ptr, &(pPoly->colourType),
+ &(pPoly->vertexAttribs), &rptr);
+ ptr = rptr;
+ }
+
+ pPoly->numLists = ddPoly->numLists;
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(NurbCurve)
+{
+ miNurbStruct *ddNurb;
+ pexNurbCurve *pNurb;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pNurb, pexNurbCurve, ddNurb, miNurbStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pNurb)+1);
+ PACK_CARD16(ddNurb->order, ptr);
+ SKIP_PADDING(ptr, 2); /* type place holder (see below) */
+ PACK_FLOAT(ddNurb->uMin, ptr);
+ PACK_FLOAT(ddNurb->uMax, ptr);
+ PACK_CARD32(ddNurb->numKnots, ptr);
+ PACK_CARD32(ddNurb->points.ddList->numPoints, ptr);
+
+ PACK_LISTOF_STRUCT( ddNurb->numKnots, PEXFLOAT, ddNurb->pKnots, ptr);
+
+ if (ddNurb->points.type == DDPT_4D) {
+ pNurb->coordType = PEXRational;
+ PACK_LISTOF_STRUCT( ddNurb->points.ddList->numPoints, ddCoord4D,
+ ddNurb->points.ddList->pts.p4Dpt, ptr);
+ } else {
+ pNurb->coordType = PEXNonRational;
+ PACK_LISTOF_STRUCT( ddNurb->points.ddList->numPoints, ddCoord3D,
+ ddNurb->points.ddList->pts.p3Dpt, ptr);
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(FillArea2D)
+{
+ miFillAreaStruct *ddFill;
+ pexFillArea2D *pFill;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexFillArea2D, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+ SKIP_PADDING(ptr, 1);
+
+ PACK_LISTOF_COORD2D( ddFill->points.ddList->numPoints,
+ ddFill->points.ddList->pts.p2Dpt,ptr);
+
+ return(Success);
+}
+
+
+
+
+OC_INQ_FUNC_HEADER(FillArea)
+{
+ miFillAreaStruct *ddFill;
+ pexFillArea *pFill;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexFillArea, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+ SKIP_PADDING(ptr, 1);
+
+ PACK_LISTOF_COORD3D( ddFill->points.ddList->numPoints,
+ ddFill->points.ddList->pts.p3Dpt, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(ExtFillArea)
+{
+ miFillAreaStruct *ddFill;
+ pexExtFillArea *pFill;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexExtFillArea, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+
+ ptr = (ddPointer)(pFill+1);
+ PACK_CARD32(ddFill->points.ddList->numPoints, ptr);
+ InqFacetOptData( ddFill->pFacets, ptr, &(pFill->colourType),
+ &(pFill->facetAttribs), &rptr);
+ ptr = rptr;
+
+ InqVertexData( ddFill->points.ddList, ddFill->points.type, ptr,
+ &(pFill->colourType), &(pFill->vertexAttribs), &rptr);
+ ptr = rptr;
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(FillAreaSet2D)
+{
+ miFillAreaStruct *ddFill;
+ pexFillAreaSet2D *pFill;
+ ddULONG i;
+ listofddPoint *ddPoint;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexFillAreaSet2D, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+ PACK_CARD8(ddFill->contourHint, ptr);
+
+ PACK_CARD32(ddFill->points.numLists, ptr);
+
+ for (i=0, ddPoint = ddFill->points.ddList;
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+
+ PACK_CARD32(ddPoint->numPoints, ptr);
+ PACK_LISTOF_STRUCT( ddPoint->numPoints, ddCoord2D,
+ ddPoint->pts.p2Dpt, ptr);
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(FillAreaSet)
+{
+ miFillAreaStruct *ddFill;
+ pexFillAreaSet *pFill;
+ ddULONG i;
+ listofddPoint *ddPoint;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexFillAreaSet, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+ PACK_CARD8(ddFill->contourHint, ptr);
+
+ PACK_CARD32(ddFill->points.numLists, ptr);
+
+ for (i=0, ddPoint = ddFill->points.ddList;
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+
+ PACK_CARD32( ddPoint->numPoints, ptr);
+ PACK_LISTOF_STRUCT( ddPoint->numPoints, ddCoord3D,
+ ddPoint->pts.p3Dpt, ptr);
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(ExtFillAreaSet)
+{
+ miFillAreaStruct *ddFill;
+ pexExtFillAreaSet *pFill;
+ ddULONG i;
+ listofddPoint *ddPoint;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pFill, pexExtFillAreaSet, ddFill, miFillAreaStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pFill)+1);
+ PACK_CARD16(ddFill->shape, ptr);
+ PACK_CARD8(ddFill->ignoreEdges, ptr);
+ PACK_CARD8(ddFill->contourHint, ptr);
+ pFill->numLists = ddFill->points.numLists;
+ ptr = (ddPointer)(pFill+1);
+
+ InqFacetOptData( ddFill->pFacets, ptr, &(pFill->colourType),
+ &(pFill->facetAttribs), &rptr);
+ ptr = rptr;
+
+ for (i=0, ddPoint = ddFill->points.ddList;
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+
+ PACK_CARD32( ddPoint->numPoints, ptr);
+ InqVertexData( ddPoint, ddFill->points.type, ptr, &(pFill->colourType),
+ &(pFill->vertexAttribs), &rptr);
+ ptr = rptr;
+ }
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(SOFAS)
+{
+ miSOFASStruct *ddFill;
+ pexSOFAS *pFill;
+ CARD16 i,j;
+ miConnListList *pCLL;
+ miConnList *pCList;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pFill, pexSOFAS, ddFill, miSOFASStruct);
+ pFill->shape = ddFill->shape;
+ pFill->edgeAttributes = ddFill->edgeAttribs;
+ pFill->contourHint = ddFill->contourHint;
+ pFill->contourCountsFlag = ddFill->contourCountsFlag;
+ pFill->numFAS = ddFill->numFAS;
+ pFill->numVertices = ddFill->points.ddList->numPoints;
+ pFill->numEdges = ddFill->numEdges;
+ pFill->numContours = ddFill->connects.numListLists;
+
+ ptr = (ddPointer)(pFill+1);
+ InqFacetOptData( &(ddFill->pFacets), ptr, &(pFill->colourType),
+ &(pFill->FAS_Attributes), &rptr);
+ ptr = rptr;
+
+ InqVertexData( ddFill->points.ddList, ddFill->points.type, ptr,
+ &(pFill->colourType), &(pFill->vertexAttributes), &rptr);
+ ptr = rptr;
+
+ if (pFill->edgeAttributes) {
+ PACK_LISTOF_STRUCT(ddFill->numEdges, ddUCHAR, ddFill->edgeData, ptr);
+ SKIP_PADDING(ptr,((((int)((pFill->numEdges + 3)/4))*4)));
+ }
+
+ for (i=0, pCLL = ddFill->connects.data; i<pFill->numContours; i++, pCLL++) {
+ PACK_CARD16(pCLL->numLists,ptr);
+ for (j=0, pCList=pCLL->pConnLists; j<pCLL->numLists; j++, pCList++) {
+ PACK_CARD16(pCList->numLists,ptr);
+ PACK_LISTOF_STRUCT( pCList->numLists, ddUSHORT,
+ pCList->pConnects, ptr);
+ }
+ }
+
+ return(Success);
+}
+
+
+
+OC_INQ_FUNC_HEADER(TriangleStrip)
+{
+ miTriangleStripStruct *ddTriangle;
+ pexTriangleStrip *pTriangle;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pTriangle, pexTriangleStrip, ddTriangle,
+ miTriangleStripStruct);
+ pTriangle->numVertices = ddTriangle->points.ddList->numPoints;
+ ptr = (ddPointer)(pTriangle +1);
+
+ InqFacetOptData( ddTriangle->pFacets, ptr, &(pTriangle->colourType),
+ &(pTriangle->facetAttribs), &rptr);
+ ptr = rptr;
+
+ InqVertexData( ddTriangle->points.ddList, ddTriangle->points.type, ptr,
+ &(pTriangle->colourType), &(pTriangle->vertexAttribs),
+ &rptr);
+ ptr = rptr;
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(QuadrilateralMesh)
+{
+ miQuadMeshStruct *ddQuad;
+ pexQuadrilateralMesh *pQuad;
+ ddPointer rptr = 0;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE(pQuad, pexQuadrilateralMesh, ddQuad, miQuadMeshStruct);
+ pQuad->mPts = ddQuad->mPts;
+ pQuad->nPts = ddQuad->nPts;
+ pQuad->shape = ddQuad->shape;
+ ptr = (ddPointer)(pQuad+1);
+
+ InqFacetOptData( ddQuad->pFacets, ptr, &(pQuad->colourType),
+ &(pQuad->facetAttribs), &rptr);
+ ptr = rptr;
+
+ InqVertexData( ddQuad->points.ddList, ddQuad->points.type, ptr,
+ &(pQuad->colourType), &(pQuad->vertexAttribs), &rptr);
+ ptr = rptr;
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(NurbSurface)
+{
+ miNurbSurfaceStruct *ddNurb;
+ pexNurbSurface *pNurb;
+ ddULONG i, j;
+ listofTrimCurve *ddTrim;
+ ddTrimCurve *ddTC;
+ ddUSHORT type;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pNurb, pexNurbSurface, ddNurb, miNurbSurfaceStruct);
+ ptr = (ddPointer)(((pexElementInfo *)pNurb)+1);
+
+ SKIP_PADDING(ptr, 2); /* type place holder (see below) */
+ PACK_CARD16(ddNurb->uOrder, ptr);
+ PACK_CARD16(ddNurb->vOrder, ptr);
+ SKIP_PADDING(ptr, 2);
+ PACK_CARD32(ddNurb->numUknots, ptr);
+ PACK_CARD32(ddNurb->numVknots, ptr);
+ PACK_CARD16(ddNurb->mPts, ptr);
+ PACK_CARD16(ddNurb->nPts, ptr);
+ PACK_CARD32(ddNurb->numTrimCurveLists, ptr);
+
+ PACK_LISTOF_STRUCT(ddNurb->numUknots, PEXFLOAT, ddNurb->pUknots, ptr);
+ PACK_LISTOF_STRUCT(ddNurb->numVknots, PEXFLOAT, ddNurb->pVknots, ptr);
+
+ i = ddNurb->mPts * ddNurb->nPts;
+ if (ddNurb->points.type == DD_HOMOGENOUS_POINT) {
+ pNurb->type = PEXRational;
+ PACK_LISTOF_STRUCT(i, ddCoord4D, ddNurb->points.ddList->pts.p4Dpt, ptr);
+ } else {
+ pNurb->type = PEXNonRational;
+ PACK_LISTOF_STRUCT(i, ddCoord3D, ddNurb->points.ddList->pts.p3Dpt, ptr);
+ }
+
+ for (i=0, ddTrim = ddNurb->trimCurves;
+ i<ddNurb->numTrimCurveLists;
+ i++, ddTrim++) {
+
+ PACK_CARD32(ddTrim->count, ptr);
+ for (j=0, ddTC=ddTrim->pTC; j<ddTrim->count; j++, ddTC++) {
+ PACK_CARD8(ddTC->visibility, ptr);
+ SKIP_PADDING(ptr, 1);
+ PACK_CARD16(ddTC->order, ptr);
+ type = (ddTC->pttype = DD_3D_POINT) ? PEXRational : PEXNonRational;
+ PACK_CARD16(type, ptr);
+ PACK_INT16(ddTC->curveApprox.approxMethod, ptr);
+ PACK_FLOAT(ddTC->curveApprox.tolerance, ptr);
+ PACK_FLOAT(ddTC->uMin, ptr);
+ PACK_FLOAT(ddTC->uMax, ptr);
+ PACK_CARD32(ddTC->numKnots, ptr);
+ PACK_CARD32(ddTC->points.numPoints, ptr);
+ PACK_LISTOF_STRUCT(ddTC->numKnots,PEXFLOAT,ddTC->pKnots, ptr);
+ if (ddTC->pttype == DD_3D_POINT) {
+ PACK_LISTOF_STRUCT( ddTC->points.numPoints, ddCoord4D,
+ ddTC->points.pts.p4Dpt, ptr);
+ } else {
+ PACK_LISTOF_STRUCT( ddTC->points.numPoints, ddCoord3D,
+ ddTC->points.pts.p3Dpt, ptr);
+ }
+
+ }
+ }
+
+ return(Success);
+
+}
+
+
+OC_INQ_FUNC_HEADER(CellArray2D)
+{
+ miCellArrayStruct *ddCell;
+ pexCellArray2D *pCell;
+ int i=2;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pCell, pexCellArray2D, ddCell, miCellArrayStruct);
+ ptr = (ddPointer)&(pCell->point1);
+
+ PACK_LISTOF_COORD2D(i, ddCell->point.ddList->pts.p2Dpt, ptr);
+
+ PACK_CARD32(ddCell->dx, ptr);
+ PACK_CARD32(ddCell->dy, ptr);
+ i = ddCell->dx * ddCell->dy;
+ PACK_LISTOF_STRUCT(i, ddIndexedColour, ddCell->colours.colour.pIndex, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(CellArray)
+{
+ miCellArrayStruct *ddCell;
+ pexCellArray *pCell;
+ int i=3;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pCell, pexCellArray, ddCell, miCellArrayStruct);
+ ptr = (ddPointer)&(pCell->point1);
+
+ PACK_LISTOF_COORD3D(i, ddCell->point.ddList->pts.p3Dpt, ptr);
+
+ PACK_CARD32(ddCell->dx, ptr);
+ PACK_CARD32(ddCell->dy, ptr);
+ i = ddCell->dx * ddCell->dy;
+ PACK_LISTOF_STRUCT(i, ddIndexedColour, ddCell->colours.colour.pIndex, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(ExtCellArray)
+{
+ miCellArrayStruct *ddCell;
+ pexExtCellArray *pCell;
+ int i=3;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pCell, pexExtCellArray, ddCell, miCellArrayStruct);
+ ptr = (ddPointer)&(pCell->colourType);
+
+ PACK_CARD16(ddCell->colours.colourType, ptr);
+ SKIP_PADDING(ptr, 2);
+
+ PACK_LISTOF_COORD3D(i, ddCell->point.ddList->pts.p3Dpt, ptr);
+ PACK_CARD32(ddCell->dx, ptr);
+ PACK_CARD32(ddCell->dy, ptr);
+ i = ddCell->dx * ddCell->dy;
+
+ switch (pCell->colourType) {
+ case PEXIndexedColour: {
+ PACK_LISTOF_STRUCT( i, ddIndexedColour,
+ ddCell->colours.colour.pIndex, ptr);
+ break; }
+ case PEXRgbFloatColour : {
+ PACK_LISTOF_STRUCT( i, ddRgbFloatColour,
+ ddCell->colours.colour.pRgbFloat, ptr);
+ break; }
+ case PEXCieFloatColour : {
+ PACK_LISTOF_STRUCT( i, ddCieColour,
+ ddCell->colours.colour.pCie, ptr);
+ break; }
+ case PEXHsvFloatColour : {
+ PACK_LISTOF_STRUCT( i, ddHsvColour,
+ ddCell->colours.colour.pHsv, ptr);
+ break; }
+ case PEXHlsFloatColour : {
+ PACK_LISTOF_STRUCT( i, ddHlsColour,
+ ddCell->colours.colour.pHls, ptr);
+ break; }
+ case PEXRgb8Colour : {
+ PACK_LISTOF_STRUCT( i, ddRgb8Colour,
+ ddCell->colours.colour.pRgb8, ptr);
+ break; }
+ case PEXRgb16Colour : {
+ PACK_LISTOF_STRUCT( i, ddRgb16Colour,
+ ddCell->colours.colour.pRgb16, ptr);
+ break; }
+ }
+
+ return(Success);
+
+}
+
+
+OC_INQ_FUNC_HEADER(PSurfaceChars)
+{
+ miPSurfaceCharsStruct *ddPSC = (miPSurfaceCharsStruct *)(pExecuteOC+1);
+ pexParaSurfCharacteristics *pPSC;
+ COPY_PTR(ptr);
+
+ switch (ddPSC->type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ GET_INQ_STORAGE( pPSC, pexParaSurfCharacteristics, ddPSC,
+ miPSurfaceCharsStruct);
+ ptr = (ddPointer)(pPSC+1);
+ break;
+
+ case PEXPSCIsoCurves: {
+ GET_INQ_STORAGE( pPSC, pexParaSurfCharacteristics, ddPSC,
+ miPSurfaceCharsStruct);
+ pPSC->characteristics = ddPSC->type;
+ pPSC->length = 4 * sizeof(CARD16);
+ ptr = (ddPointer)(pPSC+1);
+ PACK_CARD16(ddPSC->data.pIsoCurves->placementType, ptr);
+ SKIP_PADDING(ptr,2);
+ PACK_CARD16(ddPSC->data.pIsoCurves->numUcurves, ptr);
+ PACK_CARD16(ddPSC->data.pIsoCurves->numVcurves, ptr);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves: {
+ GET_INQ_STORAGE( pPSC, pexParaSurfCharacteristics, ddPSC,
+ miPSurfaceCharsStruct);
+ pPSC->characteristics = ddPSC->type;
+ pPSC->length = sizeof(pexCoord3D) + sizeof(pexVector3D) +
+ (2 *sizeof(CARD16)) + (sizeof(PEXFLOAT)*
+ ddPSC->data.pMcLevelCurves->numberIntersections);
+ ptr = (ddPointer)(pPSC+1);
+ PACK_STRUCT(pexCoord3D, &(ddPSC->data.pMcLevelCurves->origin),ptr);
+ PACK_STRUCT(pexVector3D, &(ddPSC->data.pMcLevelCurves->direction),ptr);
+ PACK_CARD16(ddPSC->data.pMcLevelCurves->numberIntersections, ptr);
+ SKIP_PADDING(ptr,2);
+ PACK_LISTOF_STRUCT(ddPSC->data.pMcLevelCurves->numberIntersections,
+ PEXFLOAT, ddPSC->data.pMcLevelCurves->pPoints,
+ ptr);
+ break;
+ }
+
+ case PEXPSCWcLevelCurves: {
+ GET_INQ_STORAGE( pPSC, pexParaSurfCharacteristics, ddPSC,
+ miPSurfaceCharsStruct);
+ pPSC->characteristics = ddPSC->type;
+ pPSC->length = sizeof(pexCoord3D) + sizeof(pexVector3D) +
+ (2 *sizeof(CARD16)) + (sizeof(PEXFLOAT)*
+ ddPSC->data.pWcLevelCurves->numberIntersections);
+ ptr = (ddPointer)(pPSC+1);
+ PACK_STRUCT(pexCoord3D, &(ddPSC->data.pWcLevelCurves->origin),ptr);
+ PACK_STRUCT(pexVector3D, &(ddPSC->data.pWcLevelCurves->direction),ptr);
+ PACK_CARD16(ddPSC->data.pWcLevelCurves->numberIntersections, ptr);
+ SKIP_PADDING(ptr,2);
+ PACK_LISTOF_STRUCT(ddPSC->data.pWcLevelCurves->numberIntersections,
+ PEXFLOAT, ddPSC->data.pWcLevelCurves->pPoints,
+ ptr);
+ break;
+ }
+ }
+
+ pPSC->characteristics = ddPSC->type;
+ pPSC->length=(CARD16)((*ppPEXOC)->length-sizeof(pexParaSurfCharacteristics));
+ return(Success);
+}
+
+
+
+
+OC_INQ_FUNC_HEADER(Gdp2D)
+{
+ miGdpStruct *ddGdp;
+ pexGdp2D *pGdp;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pGdp, pexGdp2D, ddGdp, miGdpStruct);
+ pGdp->gdpId = ddGdp->GDPid;
+ pGdp->numPoints = ddGdp->points.ddList->numPoints;
+ pGdp->numBytes = ddGdp->numBytes;
+ ptr = (ddPointer)(pGdp + 1);
+ PACK_LISTOF_COORD2D( ddGdp->points.ddList->numPoints,
+ ddGdp->points.ddList->pts.p2Dpt, ptr);
+ PACK_LISTOF_STRUCT( ddGdp->numBytes, ddUCHAR, ddGdp->pData, ptr);
+
+ return(Success);
+}
+
+
+OC_INQ_FUNC_HEADER(Gdp)
+{
+ miGdpStruct *ddGdp;
+ pexGdp *pGdp;
+ COPY_PTR(ptr);
+
+ GET_INQ_STORAGE( pGdp, pexGdp, ddGdp, miGdpStruct);
+ pGdp->gdpId = ddGdp->GDPid;
+ pGdp->numPoints = ddGdp->points.ddList->numPoints;
+ pGdp->numBytes = ddGdp->numBytes;
+ ptr = (ddPointer)(pGdp + 1);
+ PACK_LISTOF_COORD3D( ddGdp->points.ddList->numPoints,
+ ddGdp->points.ddList->pts.p3Dpt, ptr);
+ PACK_LISTOF_STRUCT( ddGdp->numBytes, ddUCHAR, ddGdp->pData, ptr);
+
+ return(Success);
+
+}
+
+
+
+OC_INQ_FUNC_HEADER(SetAttribute)
+{
+ /** The function vector should be set up to have this
+ ** SetAttribute function as the entry for all of the OC entries other
+ ** than those listed above or those NULL'd out
+ **/
+
+ ddElementInfo *dstAttrib, *srcAttrib;
+
+ GET_INQ_STORAGE( dstAttrib, ddElementInfo, srcAttrib, ddElementInfo);
+
+ memcpy( (char *)dstAttrib, (char *)srcAttrib,
+ (int)(srcAttrib->length * sizeof(CARD32)));
+
+ return(Success);
+}
+
+OC_INQ_FUNC_HEADER(PropOC)
+{
+ /** The function Handles Proprietary Vendor OCs
+ **/
+
+ ddElementInfo *dstPropOC, *srcPropOC;
+
+ GET_INQ_STORAGE( dstPropOC, ddElementInfo, srcPropOC, ddElementInfo);
+
+ memcpy( (char *)dstPropOC, (char *)srcPropOC,
+ (int)(srcPropOC->length * sizeof(CARD32)));
+
+ return(Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLight.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLight.c
new file mode 100644
index 000000000..a3065b0b2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLight.c
@@ -0,0 +1,605 @@
+/* $TOG: miLight.c /main/5 1998/02/10 12:41:26 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miLight.c,v 1.7 1998/10/04 09:34:20 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miLight.h"
+#include "pexos.h"
+
+
+extern ddpex3rtn InquireLUTEntryAddress();
+ddpex3rtn ComputeWCEyePosition();
+
+/*++
+ |
+ | Apply_Lighting(pRend, pddc, input_vert, output_fct)
+ |
+ | Create a facet list for the fill area defined by the
+ | specified vertex list.
+ |
+ | NOTE: This routine does not use back-facing lighting parameters.
+ | Furthermore, it assumes that the input lights are
+ | specified in rgb.
+ |
+ --*/
+ddpex3rtn
+miApply_Lighting(pRend, pddc, point, mat_color, normal, out_color)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+ ddCoord4D *point;
+ ddRgbFloatColour *mat_color;
+ ddVector3D *normal;
+ ddRgbFloatColour *out_color;
+{
+/* calls */
+#ifndef XFree86LOADER
+ double pow();
+#endif
+
+/* uses */
+ listofObj *light_sources = pddc->Dynamic->pPCAttr->lightState;
+ ddUSHORT *index = (ddUSHORT *)light_sources->pList;
+ miLightEntry *pLUT;
+ ddLightEntry *lightentry;
+ ddUSHORT status;
+ ddFLOAT n_dot_l, v_dot_r, d_dot_l;
+ ddFLOAT distance;
+ ddFLOAT atten;
+ ddVector3D view_vec, refl_vec, light_vec;
+ int j;
+
+
+ /* some quick bounds checking */
+ if (light_sources->numObj <= 0) {
+ *out_color = *mat_color;
+ return(Success);
+ }
+
+ out_color->red = out_color->green = out_color->blue = 0.0;
+
+ for (j = 0; j < light_sources->numObj; j++) {
+ /* Fetch light source data from LUT */
+ if ((InquireLUTEntryAddress (PEXLightLUT,
+ pRend->lut[PEXLightLUT], *index,
+ &status, (ddPointer *)(&pLUT)))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ lightentry = &pLUT->entry;
+
+ /*
+ * Insure that light color is same model as the current
+ * rendering model.
+ */
+ if (lightentry->lightColour.colourType) {}
+
+ /* The shading equations are different for each light type */
+ switch(lightentry->lightType) {
+
+ case PEXLightAmbient:
+ /*
+ * An ambient light simply adds a constant background
+ * color term to all the facets in a scene.
+ */
+ out_color->red +=
+ pddc->Static.attrs->reflAttr.ambient *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ mat_color->red);
+ out_color->green +=
+ pddc->Static.attrs->reflAttr.ambient *
+ (lightentry->lightColour.colour.rgbFloat.green*
+ mat_color->green);
+ out_color->blue +=
+ pddc->Static.attrs->reflAttr.ambient *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ mat_color->blue);
+ break;
+
+ case PEXLightWcsVector:
+ /*
+ * A directional light source is located at an
+ * infinite distance from the object along
+ * the specified direction.
+ */
+ n_dot_l = 0.0;
+
+ /* compute reflect view vector */
+ DOT_PRODUCT(&lightentry->direction, normal, n_dot_l);
+ /* negate because light vector should point towards light */
+ n_dot_l = -n_dot_l;
+ if (n_dot_l <= 0.0) break;
+
+ switch(pddc->Static.attrs->reflModel) {
+ /*
+ * Note that the total light source contribution
+ * is the sum of the specular, diffuse and ambient
+ * contributions.
+ */
+ case PEXReflectionSpecular:
+
+ CALCULATE_REFLECTION_VECTOR(&refl_vec, -n_dot_l,
+ normal,
+ &lightentry->direction);
+ refl_vec.x *= -1.0;
+ refl_vec.y *= -1.0;
+ refl_vec.z *= -1.0;
+ NORMALIZE_VECTOR (&refl_vec, v_dot_r);
+
+ /*
+ * Insure eye point is correct for view vector
+ * calculation. As eye_point is computed from
+ * the inverse view matrix, this matrix must
+ * be valid for eye point to be correct.
+ */
+ if (pddc->Static.misc.flags & INVVIEWXFRMFLAG)
+ ComputeWCEyePosition(pRend, pddc);
+
+ if (NEAR_ZERO(pddc->Static.misc.eye_pt.w)) {
+ /*
+ * if the homogeneous component of the eye
+ * position is near zero after the inverse
+ * transform from NPC space, it indicates that
+ * the view transform is an orthographic, as oppposed
+ * to perspective transformation and that the eye
+ * point thus represents a vector rather than a point
+ */
+ view_vec.x = pddc->Static.misc.eye_pt.x;
+ view_vec.y = pddc->Static.misc.eye_pt.y;
+ view_vec.z = pddc->Static.misc.eye_pt.z;
+ } else {
+ /*
+ * Compute the view vector.
+ */
+ CALCULATE_DIRECTION_VECTOR(&pddc->Static.misc.eye_pt,
+ point,
+ &view_vec);
+ NORMALIZE_VECTOR (&view_vec, v_dot_r);
+ }
+
+ DOT_PRODUCT(&refl_vec, &view_vec, v_dot_r);
+ if (v_dot_r > 0.0)
+ {
+ v_dot_r = pow(v_dot_r,
+ pddc->Static.attrs->reflAttr.specularConc);
+ out_color->red +=
+ v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.red);
+ out_color->green +=
+ v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.green);
+ out_color->blue +=
+ v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.blue);
+ }
+
+ case PEXReflectionDiffuse:
+
+ out_color->red += n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ mat_color->red);
+ out_color->green += n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ mat_color->green);
+ out_color->blue += n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ mat_color->blue);
+
+ case PEXReflectionAmbient:
+ /* No ambient contribution except from ambient lights */
+
+ break;
+ }
+ break;
+
+ case PEXLightWcsPoint:
+ /*
+ * A point light source is a radiating point source
+ * located at the specified position.
+ */
+ n_dot_l = 0.0;
+ /*
+ * Note that the total light source contribution
+ * is the sum if the specular, diffuse and ambient
+ * contributions.
+ */
+
+ CALCULATE_DIRECTION_VECTOR(&lightentry->point,
+ point,
+ &light_vec);
+ NORMALIZE_VECTOR (&light_vec, distance);
+
+ /* compute reflect view vector */
+ DOT_PRODUCT(&light_vec, normal, n_dot_l);
+ if (n_dot_l <= 0.0) break;
+
+ /* Compute light attenuation */
+ atten = 1.0/(lightentry->attenuation1 +
+ (lightentry->attenuation2 * distance));
+
+ switch(pddc->Static.attrs->reflModel) {
+
+ case PEXReflectionSpecular:
+
+ CALCULATE_REFLECTION_VECTOR(&refl_vec, n_dot_l,
+ normal,
+ &light_vec);
+ NORMALIZE_VECTOR (&refl_vec, v_dot_r);
+
+ /*
+ * Insure eye point is correct for view vector
+ * calculation. As eye_point is computed from
+ * the inverse view matrix, this matrix must
+ * be valid for eye point to be correct.
+ */
+ if (pddc->Static.misc.flags & INVVIEWXFRMFLAG)
+ ComputeWCEyePosition(pRend, pddc);
+
+ if (NEAR_ZERO(pddc->Static.misc.eye_pt.w)) {
+ /*
+ * if the homogeneous component of the eye
+ * position is near zero after the inverse
+ * transform from NPC space, it indicates that
+ * the view transform is an orthographic, as oppposed
+ * to perspective transformation and that the eye
+ * point thus represents a vector rather than a point
+ */
+ view_vec.x = pddc->Static.misc.eye_pt.x;
+ view_vec.y = pddc->Static.misc.eye_pt.y;
+ view_vec.z = pddc->Static.misc.eye_pt.z;
+ } else {
+ /*
+ * Compute the view vector.
+ */
+ CALCULATE_DIRECTION_VECTOR(&pddc->Static.misc.eye_pt,
+ point,
+ &view_vec);
+ NORMALIZE_VECTOR (&view_vec, v_dot_r);
+ }
+
+ DOT_PRODUCT(&refl_vec, &view_vec, v_dot_r);
+ if (v_dot_r > 0.0)
+ {
+ v_dot_r = pow(v_dot_r,
+ pddc->Static.attrs->reflAttr.specularConc);
+ out_color->red +=
+ atten * v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.red);
+ out_color->green +=
+ atten * v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.green);
+ out_color->blue +=
+ atten * v_dot_r *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.blue);
+ }
+
+ case PEXReflectionDiffuse:
+
+ out_color->red += atten * n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ mat_color->red);
+ out_color->green += atten * n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ mat_color->green);
+ out_color->blue += atten * n_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ mat_color->blue);
+
+ case PEXReflectionAmbient:
+ /* No ambient contribution except from ambient lights */
+ break;
+ }
+ break;
+
+ case PEXLightWcsSpot:
+ /*
+ * A spot light source is a radiating point source
+ * output whose output is limited by a cone of specified
+ * direction and angle.
+ */
+ n_dot_l = 0.0;
+ /*
+ * Note that the total light source contribution
+ * is the sum if the specular, diffuse and ambient
+ * contributions.
+ */
+
+ CALCULATE_DIRECTION_VECTOR(&lightentry->point,
+ point,
+ &light_vec);
+ NORMALIZE_VECTOR (&light_vec, distance);
+
+ /* Check that object is within spot angle. */
+ DOT_PRODUCT(&lightentry->direction, &light_vec, d_dot_l);
+ /* Negate because light vec should point other way for this test */
+ d_dot_l = -d_dot_l;
+ if (d_dot_l <= pLUT->cosSpreadAngle) break;
+ d_dot_l = pow(d_dot_l, lightentry->concentration);
+
+ /* compute reflect view vector */
+ DOT_PRODUCT(&light_vec, normal, n_dot_l);
+ if (n_dot_l <= 0.0) break;
+
+ /* Compute light attenuation */
+ atten = 1.0/(lightentry->attenuation1 +
+ (lightentry->attenuation2 * distance));
+
+ switch(pddc->Static.attrs->reflModel) {
+
+ case PEXReflectionSpecular:
+
+ CALCULATE_REFLECTION_VECTOR(&refl_vec, n_dot_l,
+ normal,
+ &light_vec);
+ NORMALIZE_VECTOR (&refl_vec, v_dot_r);
+
+ /*
+ * Insure eye point is correct for view vector
+ * calculation. As eye_point is computed from
+ * the inverse view matrix, this matrix must
+ * be valid for eye point to be correct.
+ */
+ if (pddc->Static.misc.flags & INVVIEWXFRMFLAG)
+ ComputeWCEyePosition(pRend, pddc);
+
+ if (NEAR_ZERO(pddc->Static.misc.eye_pt.w)) {
+ /*
+ * if the homogeneous component of the eye
+ * position is near zero after the inverse
+ * transform from NPC space, it indicates that
+ * the view transform is an orthographic, as oppposed
+ * to perspective transformation and that the eye
+ * point thus represents a vector rather than a point
+ */
+ view_vec.x = pddc->Static.misc.eye_pt.x;
+ view_vec.y = pddc->Static.misc.eye_pt.y;
+ view_vec.z = pddc->Static.misc.eye_pt.z;
+ } else {
+ /*
+ * Compute the view vector.
+ */
+ CALCULATE_DIRECTION_VECTOR(&pddc->Static.misc.eye_pt,
+ point,
+ &view_vec);
+ NORMALIZE_VECTOR (&view_vec, v_dot_r);
+ }
+
+ DOT_PRODUCT(&refl_vec, &view_vec, v_dot_r);
+ if (v_dot_r > 0.0)
+ {
+ v_dot_r = pow(v_dot_r,
+ pddc->Static.attrs->reflAttr.specularConc);
+ out_color->red +=
+ atten * v_dot_r * d_dot_l *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.red);
+ out_color->green +=
+ atten * v_dot_r * d_dot_l *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.green);
+ out_color->blue +=
+ atten * v_dot_r * d_dot_l *
+ pddc->Static.attrs->reflAttr.specular *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ pddc->Static.attrs->reflAttr.specularColour.colour.rgbFloat.blue);
+ }
+
+ case PEXReflectionDiffuse:
+
+ out_color->red += atten * n_dot_l * d_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.red *
+ mat_color->red);
+ out_color->green += atten * n_dot_l * d_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.green *
+ mat_color->green);
+ out_color->blue += atten * n_dot_l * d_dot_l *
+ pddc->Static.attrs->reflAttr.diffuse *
+ (lightentry->lightColour.colour.rgbFloat.blue *
+ mat_color->blue);
+
+ case PEXReflectionAmbient:
+ /* No ambient contribution except from ambient lights */
+ break;
+ }
+ }
+ index++; /* skip to next light source index in list */
+
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | ComputeWCEyePosition(pRend, pddc)
+ |
+ | Compute a WC eye position from the inverse view transform.
+ |
+ --*/
+ddpex3rtn ComputeWCEyePosition(pRend, pddc)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+{
+ extern void miMatCopy();
+
+ /* First, update inverse view matrix */
+ miViewEntry *pLUT;
+ ddUSHORT status;
+ ddCoord4D NPCEye;
+ ddFLOAT mag;
+
+ /* Get the view table entry at current view index first */
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ pddc->Dynamic->pPCAttr->viewIndex,
+ &status, (ddPointer *)&pLUT))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+
+ /* Compute the composite [VOM] next */
+/*
+ ddViewEntry *viewbundle;
+ viewbundle = &pLUT->entry;
+ miMatMult (pddc->Static.misc.inv_view_xform,
+ viewbundle->orientation,
+ viewbundle->mapping );
+*/
+
+ if (!pLUT->inv_flag)
+ {
+ /* compute the inverse */
+ miMatCopy(pLUT->vom, pddc->Static.misc.inv_view_xform);
+ miMatInverse(pddc->Static.misc.inv_view_xform);
+ miMatCopy(pddc->Static.misc.inv_view_xform, pLUT->vom_inv);
+ pLUT->inv_flag = MI_TRUE;
+ }
+ else
+ miMatCopy(pLUT->vom_inv, pddc->Static.misc.inv_view_xform);
+
+ /* Clear ddc status flag */
+ pddc->Static.misc.flags &= ~INVVIEWXFRMFLAG;
+
+ /*
+ * Multiply NPC eye point by inverse view matrix
+ * NPC eye point is defined as (0.0, 0.0, 1.0, 0.0) in NPC space
+ */
+ NPCEye.x = 0.0;
+ NPCEye.y = 0.0;
+ NPCEye.z = 1.0;
+ NPCEye.w = 0.0;
+ miTransformPoint(&NPCEye, pddc->Static.misc.inv_view_xform,
+ &pddc->Static.misc.eye_pt);
+
+ /* normalize the result if a eye pint is a vector in WC */
+ if (NEAR_ZERO(pddc->Static.misc.eye_pt.w)) {
+ NORMALIZE_VECTOR (&(pddc->Static.misc.eye_pt), mag);
+ }
+}
+
+
+/*++
+ |
+ | Compute_CC_Dcue(pRend, pddc)
+ |
+ | Compute a CC version of the current depth cue bundle entry
+ |
+ --*/
+ddpex3rtn Compute_CC_Dcue(pRend, pddc)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc;
+{
+ ddpex3rtn miConvertColor();
+
+ ddUSHORT status;
+ miDepthCueEntry *dcue_entry;
+ ddFLOAT *matrix, cc_frontplane, cc_backplane;
+
+ /* Check valid flag */
+ if (!(pddc->Static.misc.flags & CC_DCUEVERSION)) return(Success);
+
+ /* Get current depth cueing information */
+ if ((InquireLUTEntryAddress (PEXDepthCueLUT, pRend->lut[PEXDepthCueLUT],
+ pddc->Dynamic->pPCAttr->depthCueIndex,
+ &status, (ddPointer *)&dcue_entry)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ /* Compute cc versions of front and back planes
+ We assume that the transformation matrix from npc to cc is
+ diagonal, and only tranform the "z" portion */
+
+ matrix = (ddFLOAT *)(pddc->Dynamic->npc_to_cc_xform);
+
+ /* skip to Z translate and scale terms */
+ matrix += 10;
+
+ cc_frontplane = (*matrix * dcue_entry->entry.frontPlane) + *(matrix + 1);
+ cc_backplane = (*matrix * dcue_entry->entry.backPlane) + *(matrix + 1);
+
+ /* copy over relevant info */
+ pddc->Static.misc.cc_dcue_entry.mode = dcue_entry->entry.mode;
+ pddc->Static.misc.cc_dcue_entry.frontScaling =
+ dcue_entry->entry.frontScaling;
+ pddc->Static.misc.cc_dcue_entry.backScaling =
+ dcue_entry->entry.backScaling;
+
+ pddc->Static.misc.cc_dcue_entry.frontPlane = cc_frontplane;
+ pddc->Static.misc.cc_dcue_entry.backPlane = cc_backplane;
+
+ /* Convert depth cue color to proper rendering model during copy */
+ miConvertColor(pRend,
+ &dcue_entry->entry.depthCueColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.misc.cc_dcue_entry.depthCueColour);
+
+ /* validate flag */
+ pddc->Static.misc.flags &= ~CC_DCUEVERSION;
+
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLvl2Tab.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLvl2Tab.c
new file mode 100644
index 000000000..7cb056ca7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miLvl2Tab.c
@@ -0,0 +1,1143 @@
+/* $TOG: miLvl2Tab.c /main/6 1998/02/10 12:41:32 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+/* Level II output command handling tables */
+
+#include "mipex.h"
+
+
+/* procedures for PickExecuteOCTable and SearchExecuteOCTable */
+
+extern ddpex2rtn miTestPickGdp3d(),
+ miTestPickGdp2d(),
+ miPickAnnoText3D(),
+ miPickAnnoText2D(),
+ miPickPrimitives(),
+ miTestSearchGdp3d(),
+ miTestSearchGdp2d(),
+ miSearchPrimitives();
+
+/* procedures for ExecuteOCTable */
+
+extern ddpex2rtn miMarkerType(),
+ miMarkerScale(),
+ miMarkerColourOC(),
+ miMarkerBundleIndex(),
+ miTextFontIndex(),
+ miTextPrecision(),
+ miCharExpansion(),
+ miCharSpacing(),
+ miTextColourOC(),
+ miCharHeight(),
+ miCharUpVector(),
+ miTextPath(),
+ miTextAlignment(),
+ miAtextHeight(),
+ miAtextUpVector(),
+ miAtextPath(),
+ miAtextAlignment(),
+ miAtextStyle(),
+ miTextBundleIndex(),
+ miLineType(),
+ miLineWidth(),
+ miLineColourOC(),
+ miCurveApproximation(),
+ miTestSetAttribute(),
+ miLineBundleIndex(),
+ miInteriorStyle(),
+ miTestSetAttribute(),
+ miSurfaceColourOC(),
+ miSurfaceReflAttr(),
+ miSurfaceReflModel(),
+ miSurfaceInterp(),
+ miSurfaceApproximation(),
+ miTestSetAttribute(),
+ miTestColourOC(),
+ miCullingMode(),
+ miInteriorBundleIndex(),
+ miSurfaceEdgeFlag(),
+ miSurfaceEdgeType(),
+ miSurfaceEdgeWidth(),
+ miEdgeColourOC(),
+ miEdgeBundleIndex(),
+ miSetAsfValues(),
+ miLocalTransform(),
+ miLocalTransform2D(),
+ miGlobalTransform(),
+ miGlobalTransform2D(),
+ miModelClip(),
+ miSetMCVolume(),
+ miSetMCVolume(),
+ miRestoreMCV(),
+ miViewIndex(),
+ miLightStateOC(),
+ miPickId(),
+ miColourApproxIndex(),
+ miRenderingColourModel(),
+ miParaSurfCharacteristics(),
+ miAddToNameSet(),
+ miExecuteStructure(),
+ miNoop(),
+ miPolyMarker(),
+ miText3D(),
+ miText2D(),
+ miAnnoText3D(),
+ miAnnoText2D(),
+ miPolyLines(),
+ miNurbsCurve(),
+ miFillArea(),
+ miTriangleStrip(),
+ miQuadMesh(),
+ miSOFAS(),
+ miNurbsSurface(),
+ miCellArray(),
+ miTestExtCellArray(),
+ miTestGDP(),
+ miDepthCueIndex() ;
+
+
+/* for now, use the old parse routines from dipex. These use the
+ * ocs in PEX format and convert them to the original level III
+ * calls and these call the execute procedure directly
+ */
+
+extern ddpex2rtn
+ parseColourOC(),
+ parseLightState(),
+ parseColourIndexOC(),
+ parseApplicationData(),
+ parseGse(),
+ parseMarker(),
+ parseMarker2D(),
+ parseText(),
+ parseText2D(),
+ parseAnnotationText(),
+ parseAnnotationText2D(),
+ parsePolyline(),
+ parsePolyline2D(),
+ parsePolylineSet(),
+ parseNurbCurve(),
+ parseFillArea(),
+ parseFillArea2D(),
+ parseExtFillArea(),
+ parseFillAreaSet(),
+ parseFillAreaSet2D(),
+ parseExtFillAreaSet(),
+ parseTriangleStrip(),
+ parseQuadrilateralMesh(),
+ parseNurbSurface(),
+ parseCellArray(),
+ parseCellArray2D(),
+ parseExtCellArray(),
+ parseGdp(),
+ parseGdp2D(),
+ parseSetAttribute(),
+ parsePropOC(),
+ parseSOFAS(),
+ parsePSurfaceChars(),
+ parseSetMCVolume(),
+ parseSetMCVolume2D();
+
+ocTableType ParseOCTable[] = {
+ parsePropOC, /* 0 dummy entry */
+ parseSetAttribute, /* 1 marker type */
+ parseSetAttribute, /* 2 marker scale */
+ parseColourIndexOC, /* 3 marker colour index */
+ parseColourOC, /* 4 marker colour */
+ parseSetAttribute, /* 5 marker bundle index */
+ parseSetAttribute, /* 6 text font index */
+ parseSetAttribute, /* 7 text precision */
+ parseSetAttribute, /* 8 character expansion */
+ parseSetAttribute, /* 9 character spacing */
+ parseColourIndexOC, /* 10 text colour index */
+ parseColourOC, /* 11 text colour */
+ parseSetAttribute, /* 12 character height */
+ parseSetAttribute, /* 13 character up vector */
+ parseSetAttribute, /* 14 text path */
+ parseSetAttribute, /* 15 text alignment */
+ parseSetAttribute, /* 16 annotation text height */
+ parseSetAttribute, /* 17 annotation text up vector */
+ parseSetAttribute, /* 18 annotation text path */
+ parseSetAttribute, /* 19 annotation text alignment */
+ parseSetAttribute, /* 20 annotation text style */
+ parseSetAttribute, /* 21 text bundle index */
+ parseSetAttribute, /* 22 line type */
+ parseSetAttribute, /* 23 line width */
+ parseColourIndexOC, /* 24 line colour index */
+ parseColourOC, /* 25 line colour */
+ parseSetAttribute, /* 26 curve approximation method */
+ parseSetAttribute, /* 27 polyline interpolation method */
+ parseSetAttribute, /* 28 line bundle index */
+ parseSetAttribute, /* 29 surface interior style */
+ parseSetAttribute, /* 30 surface interior style index */
+ parseColourIndexOC, /* 31 surface colour index */
+ parseColourOC, /* 32 surface colour */
+ parseSetAttribute, /* 33 surface reflection attributes */
+ parseSetAttribute, /* 34 surface reflection model */
+ parseSetAttribute, /* 35 surface interpolation method */
+ parseSetAttribute, /* 36 backface surface interior style */
+ parseSetAttribute, /* 37 backface surface interior style index */
+ parseColourIndexOC, /* 38 backface surface colour index */
+ parseColourOC, /* 39 backface surface colour */
+ parseSetAttribute, /* 40 backface surface reflection
+ * attributes */
+ parseSetAttribute, /* 41 backface surface reflection model */
+ parseSetAttribute, /* 42 backface surface interpolation method */
+ parseSetAttribute, /* 43 surface approximation */
+ parseSetAttribute, /* 44 facet culling mode */
+ parseSetAttribute, /* 45 facet distinguish flag */
+ parseSetAttribute, /* 46 pattern size */
+ parseSetAttribute, /* 47 pattern reference point */
+ parseSetAttribute, /* 48 pattern reference point and vectors */
+ parseSetAttribute, /* 49 interior bundle index */
+ parseSetAttribute, /* 50 surface edge flag */
+ parseSetAttribute, /* 51 surface edge type */
+ parseSetAttribute, /* 52 surface edge width */
+ parseColourIndexOC, /* 53 surface edge colour index */
+ parseColourOC, /* 54 surface edge colour */
+ parseSetAttribute, /* 55 edge bundle index */
+ parseSetAttribute, /* 56 set individual asf */
+ parseSetAttribute, /* 57 local transform 3d */
+ parseSetAttribute, /* 58 local transform 2d */
+ parseSetAttribute, /* 59 global transform 3d */
+ parseSetAttribute, /* 60 global transform 2d */
+ parseSetAttribute, /* 61 model clip */
+ parseSetMCVolume, /* 62 set model clip volume 3d */
+ parseSetMCVolume2D, /* 63 set model clip volume 2d */
+ parseSetAttribute, /* 64 restore model clip volume */
+ parseSetAttribute, /* 65 view index */
+ parseLightState, /* 66 light source state */
+ parseSetAttribute, /* 67 depth cue index */
+ parseSetAttribute, /* 68 pick id */
+ parseSetAttribute, /* 69 hlhsr identifier */
+ parseSetAttribute, /* 70 colour approx index */
+ parseSetAttribute, /* 71 rendering colour model */
+ parsePSurfaceChars, /* 72 parametric surface attributes */
+ parseSetAttribute, /* 73 add names to name set */
+ parseSetAttribute, /* 74 remove names from name set */
+ parseSetAttribute, /* 75 execute structure */
+ parseSetAttribute, /* 76 label */
+ parseSetAttribute, /* 77 application data */
+ parseSetAttribute, /* 78 gse */
+ parseMarker, /* 79 marker 3d */
+ parseMarker2D, /* 80 marker 2d */
+ parseText, /* 81 text3d */
+ parseText2D, /* 82 text2d */
+ parseAnnotationText, /* 83 annotation text3d */
+ parseAnnotationText2D, /* 84 annotation text2d */
+ parsePolyline, /* 85 polyline3d */
+ parsePolyline2D, /* 86 polyline2d */
+ parsePolylineSet, /* 87 polyline set 3d with data */
+ parseNurbCurve, /* 88 non-uniform b spline curve */
+ parseFillArea, /* 89 fill area 3d */
+ parseFillArea2D, /* 90 fill area 2d */
+ parseExtFillArea, /* 91 fill area 3d with data */
+ parseFillAreaSet, /* 92 fill area set 3d */
+ parseFillAreaSet2D, /* 93 fill area set 2d */
+ parseExtFillAreaSet, /* 94 fill area set 3d with data */
+ parseTriangleStrip, /* 95 triangle strip */
+ parseQuadrilateralMesh, /* 96 quadrilateral mesh */
+ parseSOFAS, /* 97 set of fill area sets */
+ parseNurbSurface, /* 98 non-uniform b spline surface */
+ parseCellArray, /* 99 cell array 3d */
+ parseCellArray2D, /* 100 cell array 2d */
+ parseExtCellArray, /* 101 extended cell array 3d */
+ parseGdp, /* 102 gdp 3d */
+ parseGdp2D, /* 103 gdp 2d */
+ parseSetAttribute /* 104 Noop */
+};
+
+extern void destroyOC_PEX(),
+ destroyNoOp(),
+ destroySOFAS(),
+ destroyNurbSurface();
+
+destroyTableType DestroyOCTable[] = {
+ destroyOC_PEX, /* 0 entry for proprietary OCs */
+ destroyOC_PEX, /* 1 marker type */
+ destroyOC_PEX, /* 2 marker scale */
+ destroyOC_PEX, /* 3 marker colour index */
+ destroyOC_PEX, /* 4 marker colour */
+ destroyOC_PEX, /* 5 marker bundle index */
+ destroyOC_PEX, /* 6 text font index */
+ destroyOC_PEX, /* 7 text precision */
+ destroyOC_PEX, /* 8 character expansion */
+ destroyOC_PEX, /* 9 character spacing */
+ destroyOC_PEX, /* 10 text colour index */
+ destroyOC_PEX, /* 11 text colour */
+ destroyOC_PEX, /* 12 character height */
+ destroyOC_PEX, /* 13 character up vector */
+ destroyOC_PEX, /* 14 text path */
+ destroyOC_PEX, /* 15 text alignment */
+ destroyOC_PEX, /* 16 annotation text height */
+ destroyOC_PEX, /* 17 annotation text up vector */
+ destroyOC_PEX, /* 18 annotation text path */
+ destroyOC_PEX, /* 19 annotation text alignment */
+ destroyOC_PEX, /* 20 annotation text style */
+ destroyOC_PEX, /* 21 text bundle index */
+ destroyOC_PEX, /* 22 line type */
+ destroyOC_PEX, /* 23 line width */
+ destroyOC_PEX, /* 24 line colour index */
+ destroyOC_PEX, /* 25 line colour */
+ destroyOC_PEX, /* 26 curve approximation method */
+ destroyOC_PEX, /* 27 polyline interpolation method */
+ destroyOC_PEX, /* 28 line bundle index */
+ destroyOC_PEX, /* 29 surface interior style */
+ destroyOC_PEX, /* 30 surface interior style index */
+ destroyOC_PEX, /* 31 surface colour index */
+ destroyOC_PEX, /* 32 surface colour */
+ destroyOC_PEX, /* 33 surface reflection attributes */
+ destroyOC_PEX, /* 34 surface reflection model */
+ destroyOC_PEX, /* 35 surface interpolation method */
+ destroyOC_PEX, /* 36 backface surface interior style */
+ destroyOC_PEX, /* 37 backface surface interior style index */
+ destroyOC_PEX, /* 38 backface surface colour index */
+ destroyOC_PEX, /* 39 backface surface colour */
+ destroyOC_PEX, /* 40 backface surface reflection */
+ destroyOC_PEX, /* 41 backface surface reflection model */
+ destroyOC_PEX, /* 42 backface surface interpolation method */
+ destroyOC_PEX, /* 43 surface approximation */
+ destroyOC_PEX, /* 44 facet culling mode */
+ destroyOC_PEX, /* 45 facet distinguish flag */
+ destroyOC_PEX, /* 46 pattern size */
+ destroyOC_PEX, /* 47 pattern reference point */
+ destroyOC_PEX, /* 48 pattern reference point and vectors */
+ destroyOC_PEX, /* 49 interior bundle index */
+ destroyOC_PEX, /* 50 surface edge flag */
+ destroyOC_PEX, /* 51 surface edge type */
+ destroyOC_PEX, /* 52 surface edge width */
+ destroyOC_PEX, /* 53 surface edge colour index */
+ destroyOC_PEX, /* 54 surface edge colour */
+ destroyOC_PEX, /* 55 edge bundle index */
+ destroyOC_PEX, /* 56 set individual asf */
+ destroyOC_PEX, /* 57 local transform 3d */
+ destroyOC_PEX, /* 58 local transform 2d */
+ destroyOC_PEX, /* 59 global transform 3d */
+ destroyOC_PEX, /* 60 global transform 2d */
+ destroyOC_PEX, /* 61 model clip */
+ destroyOC_PEX, /* 62 destroy model clip volume 3d */
+ destroyOC_PEX, /* 63 destroy model clip volume 2d */
+ destroyOC_PEX, /* 64 restore model clip volume */
+ destroyOC_PEX, /* 65 view index */
+ destroyOC_PEX, /* 66 light source state */
+ destroyOC_PEX, /* 67 depth cue index */
+ destroyOC_PEX, /* 68 pick id */
+ destroyOC_PEX, /* 69 hlhsr identifier */
+ destroyOC_PEX, /* 70 colour approx index */
+ destroyOC_PEX, /* 71 rendering colour model */
+ destroyOC_PEX, /* 72 parametric surface characteristics */
+ destroyOC_PEX, /* 73 add names to name set */
+ destroyOC_PEX, /* 74 remove names from name set */
+ destroyOC_PEX, /* 75 execute structure */
+ destroyOC_PEX, /* 76 label */
+ destroyOC_PEX, /* 77 application data */
+ destroyOC_PEX, /* 78 gse */
+ destroyOC_PEX, /* 79 marker 3d */
+ destroyOC_PEX, /* 80 marker 2d */
+ destroyOC_PEX, /* 81 text3d */
+ destroyOC_PEX, /* 82 text2d */
+ destroyOC_PEX, /* 83 annotation text3d */
+ destroyOC_PEX, /* 84 annotation text2d */
+ destroyOC_PEX, /* 85 polyline3d */
+ destroyOC_PEX, /* 86 polyline2d */
+ destroyOC_PEX, /* 87 polyline set 3d with data */
+ destroyOC_PEX, /* 88 non-uniform b spline curve */
+ destroyOC_PEX, /* 89 fill area 3d */
+ destroyOC_PEX, /* 90 fill area 2d */
+ destroyOC_PEX, /* 91 fill area 3d with data */
+ destroyOC_PEX, /* 92 fill area set 3d */
+ destroyOC_PEX, /* 93 fill area set 2d */
+ destroyOC_PEX, /* 94 fill area set 3d with data */
+ destroyOC_PEX, /* 95 triangle strip */
+ destroyOC_PEX, /* 96 quadrilateral mesh */
+ destroySOFAS, /* 97 set of fill area sets */
+ destroyNurbSurface, /* 98 non-uniform b spline surface */
+ destroyOC_PEX, /* 99 cell array 3d */
+ destroyOC_PEX, /* 100 cell array 2d */
+ destroyOC_PEX, /* 101 extended cell array 3d */
+ destroyOC_PEX, /* 102 gdp 3d */
+ destroyOC_PEX, /* 103 gdp 2d */
+ destroyOC_PEX /* 104 Noop */
+};
+
+/* initial setup for output command table in renderers */
+
+ocTableType InitExecuteOCTable[] = {
+ miNoop, /* 0 dummy entry */
+ miMarkerType, /* 1 marker type */
+ miMarkerScale, /* 2 marker scale */
+ miMarkerColourOC, /* 3 marker colour index */
+ miMarkerColourOC, /* 4 marker colour */
+ miMarkerBundleIndex, /* 5 marker bundle index */
+ miTextFontIndex, /* 6 text font index */
+ miTextPrecision, /* 7 text precision */
+ miCharExpansion, /* 8 character expansion */
+ miCharSpacing, /* 9 character spacing */
+ miTextColourOC, /* 10 text colour index */
+ miTextColourOC, /* 11 text colour */
+ miCharHeight, /* 12 character height */
+ miCharUpVector, /* 13 character up vector */
+ miTextPath, /* 14 text path */
+ miTextAlignment, /* 15 text alignment */
+ miAtextHeight, /* 16 annotation text height */
+ miAtextUpVector, /* 17 annotation text up vector */
+ miAtextPath, /* 18 annotation text path */
+ miAtextAlignment, /* 19 annotation text alignment */
+ miAtextStyle, /* 20 annotation text style */
+ miTextBundleIndex, /* 21 text bundle index */
+ miLineType, /* 22 line type */
+ miLineWidth, /* 23 line width */
+ miLineColourOC, /* 24 line colour index */
+ miLineColourOC, /* 25 line colour */
+ miCurveApproximation, /* 26 curve approximation method */
+ miTestSetAttribute, /* 27 polyline interpolation method */
+ miLineBundleIndex, /* 28 line bundle index */
+ miInteriorStyle, /* 29 surface interior style */
+ miTestSetAttribute, /* 30 surface interior style index */
+ miSurfaceColourOC, /* 31 surface colour index */
+ miSurfaceColourOC, /* 32 surface colour */
+ miSurfaceReflAttr, /* 33 surface reflection attributes */
+ miSurfaceReflModel, /* 34 surface reflection model */
+ miSurfaceInterp, /* 35 surface interpolation method */
+ miTestSetAttribute, /* 36 backface surface interior style */
+ miTestSetAttribute, /* 37 backface surface interior style index */
+ miTestColourOC, /* 38 backface surface colour index */
+ miTestColourOC, /* 39 backface surface colour */
+ miTestSetAttribute, /* 40 backface surface reflection attributes */
+ miTestSetAttribute, /* 41 backface surface reflection model */
+ miTestSetAttribute, /* 42 backface surface interpolation method */
+ miSurfaceApproximation, /* 43 surface approximation */
+ miCullingMode, /* 44 facet culling mode */
+ miTestSetAttribute, /* 45 facet distinguish flag */
+ miTestSetAttribute, /* 46 pattern size */
+ miTestSetAttribute, /* 47 pattern reference point */
+ miTestSetAttribute, /* 48 pattern reference point and vectors */
+ miInteriorBundleIndex, /* 49 interior bundle index */
+ miSurfaceEdgeFlag, /* 50 surface edge flag */
+ miSurfaceEdgeType, /* 51 surface edge type */
+ miSurfaceEdgeWidth, /* 52 surface edge width */
+ miEdgeColourOC, /* 53 surface edge colour index */
+ miEdgeColourOC, /* 54 surface edge colour */
+ miEdgeBundleIndex, /* 55 edge bundle index */
+ miSetAsfValues, /* 56 set individual asf */
+ miLocalTransform, /* 57 local transform 3d */
+ miLocalTransform2D, /* 58 local transform 2d */
+ miGlobalTransform, /* 59 global transform 3d */
+ miGlobalTransform2D, /* 60 global transform 2d */
+ miModelClip, /* 61 model clip */
+ miSetMCVolume, /* 62 set model clip volume 3d */
+ miSetMCVolume, /* 63 set model clip volume 2d */
+ miRestoreMCV, /* 64 restore model clip volume */
+ miViewIndex, /* 65 view index */
+ miLightStateOC, /* 66 light source state */
+ miDepthCueIndex, /* 67 depth cue index */
+ miPickId, /* 68 pick id */
+ miTestSetAttribute, /* 69 hlhsr identifier */
+ miColourApproxIndex, /* 70 colour approx index */
+ miRenderingColourModel, /* 71 rendering colour model */
+ miParaSurfCharacteristics, /* 72 parametric surface characteristics */
+ miAddToNameSet, /* 73 add names to name set */
+ miAddToNameSet, /* 74 remove names from name set */
+ miExecuteStructure, /* 75 execute structure */
+ miNoop, /* 76 label */
+ miNoop, /* 77 application data */
+ miNoop, /* 78 gse */
+ miPolyMarker, /* 79 marker 3d */
+ miPolyMarker, /* 80 marker 2d */
+ miText3D, /* 81 text3d */
+ miText2D, /* 82 text2d */
+ miAnnoText3D, /* 83 annotation text3d */
+ miAnnoText2D, /* 84 annotation text2d */
+ miPolyLines, /* 85 polyline3d */
+ miPolyLines, /* 86 polyline2d */
+ miPolyLines, /* 87 polyline set 3d with data */
+ miNurbsCurve, /* 88 non-uniform b spline curve */
+ miFillArea, /* 89 fill area 3d */
+ miFillArea, /* 90 fill area 2d */
+ miFillArea, /* 91 fill area 3d with data */
+ miFillArea, /* 92 fill area set 3d */
+ miFillArea, /* 93 fill area set 2d */
+ miFillArea, /* 94 fill area set 3d with data */
+ miTriangleStrip, /* 95 triangle strip */
+ miQuadMesh, /* 96 quadrilateral mesh */
+ miSOFAS, /* 97 set of fill area sets */
+ miNurbsSurface, /* 98 non-uniform b spline surface */
+ miCellArray, /* 99 cell array 3d */
+ miCellArray, /* 100 cell array 2d */
+ miCellArray, /* 101 extended cell array 3d */
+ miTestGDP, /* 102 gdp 3d */
+ miTestGDP, /* 103 gdp 2d */
+ miNoop /* 104 Noop */
+};
+
+/* initial setup for output command table for picking */
+
+ocTableType PickExecuteOCTable[] = {
+ miNoop, /* 0 dummy entry */
+ miMarkerType, /* 1 marker type */
+ miMarkerScale, /* 2 marker scale */
+ miMarkerColourOC, /* 3 marker colour index */
+ miMarkerColourOC, /* 4 marker colour */
+ miMarkerBundleIndex, /* 5 marker bundle index */
+ miTextFontIndex, /* 6 text font index */
+ miTextPrecision, /* 7 text precision */
+ miCharExpansion, /* 8 character expansion */
+ miCharSpacing, /* 9 character spacing */
+ miTextColourOC, /* 10 text colour index */
+ miTextColourOC, /* 11 text colour */
+ miCharHeight, /* 12 character height */
+ miCharUpVector, /* 13 character up vector */
+ miTextPath, /* 14 text path */
+ miTextAlignment, /* 15 text alignment */
+ miAtextHeight, /* 16 annotation text height */
+ miAtextUpVector, /* 17 annotation text up vector */
+ miAtextPath, /* 18 annotation text path */
+ miAtextAlignment, /* 19 annotation text alignment */
+ miAtextStyle, /* 20 annotation text style */
+ miTextBundleIndex, /* 21 text bundle index */
+ miLineType, /* 22 line type */
+ miLineWidth, /* 23 line width */
+ miLineColourOC, /* 24 line colour index */
+ miLineColourOC, /* 25 line colour */
+ miCurveApproximation, /* 26 curve approximation method */
+ miTestSetAttribute, /* 27 polyline interpolation method */
+ miLineBundleIndex, /* 28 line bundle index */
+ miInteriorStyle, /* 29 surface interior style */
+ miTestSetAttribute, /* 30 surface interior style index */
+ miSurfaceColourOC, /* 31 surface colour index */
+ miSurfaceColourOC, /* 32 surface colour */
+ miSurfaceReflAttr, /* 33 surface reflection attributes */
+ miSurfaceReflModel, /* 34 surface reflection model */
+ miSurfaceInterp, /* 35 surface interpolation method */
+ miTestSetAttribute, /* 36 backface surface interior style */
+ miTestSetAttribute, /* 37 backface surface interior style index */
+ miTestColourOC, /* 38 backface surface colour index */
+ miTestColourOC, /* 39 backface surface colour */
+ miTestSetAttribute, /* 40 backface surface reflection attributes */
+ miTestSetAttribute, /* 41 backface surface reflection model */
+ miTestSetAttribute, /* 42 backface surface interpolation method */
+ miSurfaceApproximation, /* 43 surface approximation */
+ miCullingMode, /* 44 facet culling mode */
+ miTestSetAttribute, /* 45 facet distinguish flag */
+ miTestSetAttribute, /* 46 pattern size */
+ miTestSetAttribute, /* 47 pattern reference point */
+ miTestSetAttribute, /* 48 pattern reference point and vectors */
+ miInteriorBundleIndex, /* 49 interior bundle index */
+ miSurfaceEdgeFlag, /* 50 surface edge flag */
+ miSurfaceEdgeType, /* 51 surface edge type */
+ miSurfaceEdgeWidth, /* 52 surface edge width */
+ miEdgeColourOC, /* 53 surface edge colour index */
+ miEdgeColourOC, /* 54 surface edge colour */
+ miEdgeBundleIndex, /* 55 edge bundle index */
+ miSetAsfValues, /* 56 set individual asf */
+ miLocalTransform, /* 57 local transform 3d */
+ miLocalTransform2D, /* 58 local transform 2d */
+ miGlobalTransform, /* 59 global transform 3d */
+ miGlobalTransform2D, /* 60 global transform 2d */
+ miModelClip, /* 61 model clip */
+ miSetMCVolume, /* 62 set model clip volume 3d */
+ miSetMCVolume, /* 63 set model clip volume 2d */
+ miRestoreMCV, /* 64 restore model clip volume */
+ miViewIndex, /* 65 view index */
+ miLightStateOC, /* 66 light source state */
+ miDepthCueIndex, /* 67 depth cue index */
+ miPickId, /* 68 pick id */
+ miTestSetAttribute, /* 69 hlhsr identifier */
+ miColourApproxIndex, /* 70 colour approx index */
+ miRenderingColourModel, /* 71 rendering colour model */
+ miParaSurfCharacteristics, /* 72 parametric surface characteristics */
+ miAddToNameSet, /* 73 add names to name set */
+ miAddToNameSet, /* 74 remove names from name set */
+ miExecuteStructure, /* 75 execute structure */
+ miNoop, /* 76 label */
+ miNoop, /* 77 application data */
+ miNoop, /* 78 gse */
+ miPickPrimitives, /* 79 marker 3d */
+ miPickPrimitives, /* 80 marker 2d */
+ miPickPrimitives, /* 81 text3d */
+ miPickPrimitives, /* 82 text2d */
+ miPickAnnoText3D, /* 83 annotation text3d */
+ miPickAnnoText2D, /* 84 annotation text2d */
+ miPickPrimitives, /* 85 polyline3d */
+ miPickPrimitives, /* 86 polyline2d */
+ miPickPrimitives, /* 87 polyline set 3d with data */
+ miPickPrimitives, /* 88 non-uniform b spline curve */
+ miPickPrimitives, /* 89 fill area 3d */
+ miPickPrimitives, /* 90 fill area 2d */
+ miPickPrimitives, /* 91 fill area 3d with data */
+ miPickPrimitives, /* 92 fill area set 3d */
+ miPickPrimitives, /* 93 fill area set 2d */
+ miPickPrimitives, /* 94 fill area set 3d with data */
+ miPickPrimitives, /* 95 triangle strip */
+ miPickPrimitives, /* 96 quadrilateral mesh */
+ miPickPrimitives, /* 97 set of fill area sets */
+ miPickPrimitives, /* 98 non-uniform b spline surface */
+ miPickPrimitives, /* 99 cell array 3d */
+ miPickPrimitives, /* 100 cell array 2d */
+ miPickPrimitives, /* 101 extended cell array 3d */
+ miTestPickGdp3d, /* 102 gdp 3d */
+ miTestPickGdp2d, /* 103 gdp 2d */
+ miNoop /* 104 Noop */
+};
+
+
+/* initial setup for output command table for searching */
+
+ocTableType SearchExecuteOCTable[] = {
+ miNoop, /* 0 dummy entry */
+ miMarkerType, /* 1 marker type */
+ miMarkerScale, /* 2 marker scale */
+ miMarkerColourOC, /* 3 marker colour index */
+ miMarkerColourOC, /* 4 marker colour */
+ miMarkerBundleIndex, /* 5 marker bundle index */
+ miTextFontIndex, /* 6 text font index */
+ miTextPrecision, /* 7 text precision */
+ miCharExpansion, /* 8 character expansion */
+ miCharSpacing, /* 9 character spacing */
+ miTextColourOC, /* 10 text colour index */
+ miTextColourOC, /* 11 text colour */
+ miCharHeight, /* 12 character height */
+ miCharUpVector, /* 13 character up vector */
+ miTextPath, /* 14 text path */
+ miTextAlignment, /* 15 text alignment */
+ miAtextHeight, /* 16 annotation text height */
+ miAtextUpVector, /* 17 annotation text up vector */
+ miAtextPath, /* 18 annotation text path */
+ miAtextAlignment, /* 19 annotation text alignment */
+ miAtextStyle, /* 20 annotation text style */
+ miTextBundleIndex, /* 21 text bundle index */
+ miLineType, /* 22 line type */
+ miLineWidth, /* 23 line width */
+ miLineColourOC, /* 24 line colour index */
+ miLineColourOC, /* 25 line colour */
+ miCurveApproximation, /* 26 curve approximation method */
+ miTestSetAttribute, /* 27 polyline interpolation method */
+ miLineBundleIndex, /* 28 line bundle index */
+ miInteriorStyle, /* 29 surface interior style */
+ miTestSetAttribute, /* 30 surface interior style index */
+ miSurfaceColourOC, /* 31 surface colour index */
+ miSurfaceColourOC, /* 32 surface colour */
+ miSurfaceReflAttr, /* 33 surface reflection attributes */
+ miSurfaceReflModel, /* 34 surface reflection model */
+ miSurfaceInterp, /* 35 surface interpolation method */
+ miTestSetAttribute, /* 36 backface surface interior style */
+ miTestSetAttribute, /* 37 backface surface interior style index */
+ miTestColourOC, /* 38 backface surface colour index */
+ miTestColourOC, /* 39 backface surface colour */
+ miTestSetAttribute, /* 40 backface surface reflection attributes */
+ miTestSetAttribute, /* 41 backface surface reflection model */
+ miTestSetAttribute, /* 42 backface surface interpolation method */
+ miSurfaceApproximation, /* 43 surface approximation */
+ miCullingMode, /* 44 facet culling mode */
+ miTestSetAttribute, /* 45 facet distinguish flag */
+ miTestSetAttribute, /* 46 pattern size */
+ miTestSetAttribute, /* 47 pattern reference point */
+ miTestSetAttribute, /* 48 pattern reference point and vectors */
+ miInteriorBundleIndex, /* 49 interior bundle index */
+ miSurfaceEdgeFlag, /* 50 surface edge flag */
+ miSurfaceEdgeType, /* 51 surface edge type */
+ miSurfaceEdgeWidth, /* 52 surface edge width */
+ miEdgeColourOC, /* 53 surface edge colour index */
+ miEdgeColourOC, /* 54 surface edge colour */
+ miEdgeBundleIndex, /* 55 edge bundle index */
+ miSetAsfValues, /* 56 set individual asf */
+ miLocalTransform, /* 57 local transform 3d */
+ miLocalTransform2D, /* 58 local transform 2d */
+ miGlobalTransform, /* 59 global transform 3d */
+ miGlobalTransform2D, /* 60 global transform 2d */
+ miModelClip, /* 61 model clip */
+ miSetMCVolume, /* 62 set model clip volume 3d */
+ miSetMCVolume, /* 63 set model clip volume 2d */
+ miRestoreMCV, /* 64 restore model clip volume */
+ miViewIndex, /* 65 view index */
+ miLightStateOC, /* 66 light source state */
+ miDepthCueIndex, /* 67 depth cue index */
+ miPickId, /* 68 pick id */
+ miTestSetAttribute, /* 69 hlhsr identifier */
+ miColourApproxIndex, /* 70 colour approx index */
+ miRenderingColourModel, /* 71 rendering colour model */
+ miParaSurfCharacteristics, /* 72 parametric surface characteristics */
+ miAddToNameSet, /* 73 add names to name set */
+ miAddToNameSet, /* 74 remove names from name set */
+ miExecuteStructure, /* 75 execute structure */
+ miNoop, /* 76 label */
+ miNoop, /* 77 application data */
+ miNoop, /* 78 gse */
+ miSearchPrimitives, /* 79 marker 3d */
+ miSearchPrimitives, /* 80 marker 2d */
+ miSearchPrimitives, /* 81 text3d */
+ miSearchPrimitives, /* 82 text2d */
+ miSearchPrimitives, /* 83 annotation text3d */
+ miSearchPrimitives, /* 84 annotation text2d */
+ miSearchPrimitives, /* 85 polyline3d */
+ miSearchPrimitives, /* 86 polyline2d */
+ miSearchPrimitives, /* 87 polyline set 3d with data */
+ miSearchPrimitives, /* 88 non-uniform b spline curve */
+ miSearchPrimitives, /* 89 fill area 3d */
+ miSearchPrimitives, /* 90 fill area 2d */
+ miSearchPrimitives, /* 91 fill area 3d with data */
+ miSearchPrimitives, /* 92 fill area set 3d */
+ miSearchPrimitives, /* 93 fill area set 2d */
+ miSearchPrimitives, /* 94 fill area set 3d with data */
+ miSearchPrimitives, /* 95 triangle strip */
+ miSearchPrimitives, /* 96 quadrilateral mesh */
+ miSearchPrimitives, /* 97 set of fill area sets */
+ miSearchPrimitives, /* 98 non-uniform b spline surface */
+ miSearchPrimitives, /* 99 cell array 3d */
+ miSearchPrimitives, /* 100 cell array 2d */
+ miSearchPrimitives, /* 101 extended cell array 3d */
+ miTestSearchGdp3d, /* 102 gdp 3d */
+ miTestSearchGdp2d, /* 103 gdp 2d */
+ miNoop /* 104 Noop */
+};
+
+
+extern ddpex2rtn
+ copyAnnotationText(),
+ copyAnnotationText2D(),
+ copyCellArray(),
+ copyCellArray2D(),
+ copyColourIndexOC(),
+ copyColourOC(),
+ copyExtCellArray(),
+ copyExtFillArea(),
+ copyExtFillAreaSet(),
+ copyFillArea(),
+ copyFillArea2D(),
+ copyFillAreaSet(),
+ copyFillAreaSet2D(),
+ copyGdp(),
+ copyGdp2D(),
+ copyLightState(),
+ copyMarker(),
+ copyMarker2D(),
+ copyNurbCurve(),
+ copyNurbSurface(),
+ copyPolyline(),
+ copyPolyline2D(),
+ copyPolylineSet(),
+ copyPSurfaceChars(),
+ copyMCVolume(),
+ copyQuadrilateralMesh(),
+ copySetAttribute(),
+ copyPropOC(),
+ copySOFAS(),
+ copyText(),
+ copyText2D(),
+ copyTriangleStrip();
+
+
+
+ocTableType CopyOCTable[] = {
+ copyPropOC, /* 0 dummy entry */
+ copySetAttribute, /* 1 marker type */
+ copySetAttribute, /* 2 marker scale */
+ copyColourIndexOC, /* 3 marker colour index */
+ copyColourOC, /* 4 marker colour */
+ copySetAttribute, /* 5 marker bundle index */
+ copySetAttribute, /* 6 text font index */
+ copySetAttribute, /* 7 text precision */
+ copySetAttribute, /* 8 character expansion */
+ copySetAttribute, /* 9 character spacing */
+ copyColourIndexOC, /* 10 text colour index */
+ copyColourOC, /* 11 text colour */
+ copySetAttribute, /* 12 character height */
+ copySetAttribute, /* 13 character up vector */
+ copySetAttribute, /* 14 text path */
+ copySetAttribute, /* 15 text alignment */
+ copySetAttribute, /* 16 annotation text height */
+ copySetAttribute, /* 17 annotation text up vector */
+ copySetAttribute, /* 18 annotation text path */
+ copySetAttribute, /* 19 annotation text alignment */
+ copySetAttribute, /* 20 annotation text style */
+ copySetAttribute, /* 21 text bundle index */
+ copySetAttribute, /* 22 line type */
+ copySetAttribute, /* 23 line width */
+ copyColourIndexOC, /* 24 line colour index */
+ copyColourOC, /* 25 line colour */
+ copySetAttribute, /* 26 curve approximation method */
+ copySetAttribute, /* 27 polyline interpolation method */
+ copySetAttribute, /* 28 line bundle index */
+ copySetAttribute, /* 29 surface interior style */
+ copySetAttribute, /* 30 surface interior style index */
+ copyColourIndexOC, /* 31 surface colour index */
+ copyColourOC, /* 32 surface colour */
+ copySetAttribute, /* 33 surface reflection attributes */
+ copySetAttribute, /* 34 surface reflection model */
+ copySetAttribute, /* 35 surface interpolation method */
+ copySetAttribute, /* 36 backface surface interior style */
+ copySetAttribute, /* 37 backface surface interior style index */
+ copyColourIndexOC, /* 38 backface surface colour index */
+ copyColourOC, /* 39 backface surface colour */
+ copySetAttribute, /* 40 backface surface reflection
+ * attributes */
+ copySetAttribute, /* 41 backface surface reflection model */
+ copySetAttribute, /* 42 backface surface interpolation method */
+ copySetAttribute, /* 43 surface approximation */
+ copySetAttribute, /* 44 facet culling mode */
+ copySetAttribute, /* 45 facet distinguish flag */
+ copySetAttribute, /* 46 pattern size */
+ copySetAttribute, /* 47 pattern reference point */
+ copySetAttribute, /* 48 pattern reference point and vectors */
+ copySetAttribute, /* 49 interior bundle index */
+ copySetAttribute, /* 50 surface edge flag */
+ copySetAttribute, /* 51 surface edge type */
+ copySetAttribute, /* 52 surface edge width */
+ copyColourIndexOC, /* 53 surface edge colour index */
+ copyColourOC, /* 54 surface edge colour */
+ copySetAttribute, /* 55 edge bundle index */
+ copySetAttribute, /* 56 set individual asf */
+ copySetAttribute, /* 57 local transform 3d */
+ copySetAttribute, /* 58 local transform 2d */
+ copySetAttribute, /* 59 global transform 3d */
+ copySetAttribute, /* 60 global transform 2d */
+ copySetAttribute, /* 61 model clip */
+ copyMCVolume, /* 62 copy model clip volume 3d */
+ copyMCVolume, /* 63 copy model clip volume 2d */
+ copySetAttribute, /* 64 restore model clip volume */
+ copySetAttribute, /* 65 view index */
+ copyLightState, /* 66 light source state */
+ copySetAttribute, /* 67 depth cue index */
+ copySetAttribute, /* 68 pick id */
+ copySetAttribute, /* 69 hlhsr identifier */
+ copySetAttribute, /* 70 colour approx index */
+ copySetAttribute, /* 71 rendering colour model */
+ copyPSurfaceChars, /* 72 parametric surface attributes */
+ copySetAttribute, /* 73 add names to name set */
+ copySetAttribute, /* 74 remove names from name set */
+ copySetAttribute, /* 75 execute structure */
+ copySetAttribute, /* 76 label */
+ copySetAttribute, /* 77 application data */
+ copySetAttribute, /* 78 gse */
+ copyMarker, /* 79 marker 3d */
+ copyMarker2D, /* 80 marker 2d */
+ copyText, /* 81 text3d */
+ copyText2D, /* 82 text2d */
+ copyAnnotationText, /* 83 annotation text3d */
+ copyAnnotationText2D, /* 84 annotation text2d */
+ copyPolyline, /* 85 polyline3d */
+ copyPolyline2D, /* 86 polyline2d */
+ copyPolylineSet, /* 87 polyline set 3d with data */
+ copyNurbCurve, /* 88 non-uniform b spline curve */
+ copyFillArea, /* 89 fill area 3d */
+ copyFillArea2D, /* 90 fill area 2d */
+ copyExtFillArea, /* 91 fill area 3d with data */
+ copyFillAreaSet, /* 92 fill area set 3d */
+ copyFillAreaSet2D, /* 93 fill area set 2d */
+ copyExtFillAreaSet, /* 94 fill area set 3d with data */
+ copyTriangleStrip, /* 95 triangle strip */
+ copyQuadrilateralMesh, /* 96 quadrilateral mesh */
+ copySOFAS, /* 97 set of fill area sets */
+ copyNurbSurface, /* 98 non-uniform b spline surface */
+ copyCellArray, /* 99 cell array 3d */
+ copyCellArray2D, /* 100 cell array 2d */
+ copyExtCellArray, /* 101 extended cell array 3d */
+ copyGdp, /* 102 gdp 3d */
+ copyGdp2D, /* 103 gdp 2d */
+ copySetAttribute /* 104 Noop */
+};
+
+
+extern ddpex2rtn
+ inquireAnnotationText(),
+ inquireAnnotationText2D(),
+ inquireCellArray(),
+ inquireCellArray2D(),
+ inquireColourIndexOC(),
+ inquireColourOC(),
+ inquireExtCellArray(),
+ inquireExtFillArea(),
+ inquireExtFillAreaSet(),
+ inquireFillArea(),
+ inquireFillArea2D(),
+ inquireFillAreaSet(),
+ inquireFillAreaSet2D(),
+ inquireGdp(),
+ inquireGdp2D(),
+ inquireLightState(),
+ inquireMarker(),
+ inquireMarker2D(),
+ inquireMCVolume(),
+ inquireMCVolume2D(),
+ inquireNurbCurve(),
+ inquireNurbSurface(),
+ inquirePolyline(),
+ inquirePolyline2D(),
+ inquirePolylineSet(),
+ inquirePSurfaceChars(),
+ inquireQuadrilateralMesh(),
+ inquireSetAttribute(),
+ inquirePropOC(),
+ inquireSOFAS(),
+ inquireText(),
+ inquireText2D(),
+ inquireTriangleStrip(),
+ inquireMCVolume(),
+ inquireMCVolume2D();
+
+
+ocTableType InquireOCTable[] = {
+ inquirePropOC, /* 0 dummy entry */
+ inquireSetAttribute, /* 1 marker type */
+ inquireSetAttribute, /* 2 marker scale */
+ inquireColourIndexOC, /* 3 marker colour index */
+ inquireColourOC, /* 4 marker colour */
+ inquireSetAttribute, /* 5 marker bundle index */
+ inquireSetAttribute, /* 6 text font index */
+ inquireSetAttribute, /* 7 text precision */
+ inquireSetAttribute, /* 8 character expansion */
+ inquireSetAttribute, /* 9 character spacing */
+ inquireColourIndexOC, /* 10 text colour index */
+ inquireColourOC, /* 11 text colour */
+ inquireSetAttribute, /* 12 character height */
+ inquireSetAttribute, /* 13 character up vector */
+ inquireSetAttribute, /* 14 text path */
+ inquireSetAttribute, /* 15 text alignment */
+ inquireSetAttribute, /* 16 annotation text height */
+ inquireSetAttribute, /* 17 annotation text up vector */
+ inquireSetAttribute, /* 18 annotation text path */
+ inquireSetAttribute, /* 19 annotation text alignment */
+ inquireSetAttribute, /* 20 annotation text style */
+ inquireSetAttribute, /* 21 text bundle index */
+ inquireSetAttribute, /* 22 line type */
+ inquireSetAttribute, /* 23 line width */
+ inquireColourIndexOC, /* 24 line colour index */
+ inquireColourOC, /* 25 line colour */
+ inquireSetAttribute, /* 26 curve approximation method */
+ inquireSetAttribute, /* 27 polyline interpolation method */
+ inquireSetAttribute, /* 28 line bundle index */
+ inquireSetAttribute, /* 29 surface interior style */
+ inquireSetAttribute, /* 30 surface interior style index */
+ inquireColourIndexOC, /* 31 surface colour index */
+ inquireColourOC, /* 32 surface colour */
+ inquireSetAttribute, /* 33 surface reflection attributes */
+ inquireSetAttribute, /* 34 surface reflection model */
+ inquireSetAttribute, /* 35 surface interpolation method */
+ inquireSetAttribute, /* 36 backface surface interior style */
+ inquireSetAttribute, /* 37 backface surface interior style index */
+ inquireColourIndexOC, /* 38 backface surface colour index */
+ inquireColourOC, /* 39 backface surface colour */
+ inquireSetAttribute, /* 40 backface surface reflection attributes */
+ inquireSetAttribute, /* 41 backface surface reflection model */
+ inquireSetAttribute, /* 42 backface surface interpolation method */
+ inquireSetAttribute, /* 43 surface approximation */
+ inquireSetAttribute, /* 44 facet culling mode */
+ inquireSetAttribute, /* 45 facet distinguish flag */
+ inquireSetAttribute, /* 46 pattern size */
+ inquireSetAttribute, /* 47 pattern reference point */
+ inquireSetAttribute, /* 48 pattern reference point and vectors */
+ inquireSetAttribute, /* 49 interior bundle index */
+ inquireSetAttribute, /* 50 surface edge flag */
+ inquireSetAttribute, /* 51 surface edge type */
+ inquireSetAttribute, /* 52 surface edge width */
+ inquireColourIndexOC, /* 53 surface edge colour index */
+ inquireColourOC, /* 54 surface edge colour */
+ inquireSetAttribute, /* 55 edge bundle index */
+ inquireSetAttribute, /* 56 set individual asf */
+ inquireSetAttribute, /* 57 local transform 3d */
+ inquireSetAttribute, /* 58 local transform 2d */
+ inquireSetAttribute, /* 59 global transform 3d */
+ inquireSetAttribute, /* 60 global transform 2d */
+ inquireSetAttribute, /* 61 model clip */
+ inquireMCVolume, /* 62 model clip volume 3d */
+ inquireMCVolume2D, /* 63 model clip volume 2d */
+ inquireSetAttribute, /* 64 restore model clip volume */
+ inquireSetAttribute, /* 65 view index */
+ inquireLightState, /* 66 light source state */
+ inquireSetAttribute, /* 67 depth cue index */
+ inquireSetAttribute, /* 68 pick id */
+ inquireSetAttribute, /* 69 hlhsr identifier */
+ inquireSetAttribute, /* 70 colour approx index */
+ inquireSetAttribute, /* 71 rendering colour model */
+ inquirePSurfaceChars, /* 72 parametric surface attributes */
+ inquireSetAttribute, /* 73 add names to name set */
+ inquireSetAttribute, /* 74 remove names from name set */
+ inquireSetAttribute, /* 75 execute structure */
+ inquireSetAttribute, /* 76 label */
+ inquireSetAttribute, /* 77 application data */
+ inquireSetAttribute, /* 78 gse */
+ inquireMarker, /* 79 marker 3d */
+ inquireMarker2D, /* 80 marker 2d */
+ inquireText, /* 81 text3d */
+ inquireText2D, /* 82 text2d */
+ inquireAnnotationText, /* 83 annotation text3d */
+ inquireAnnotationText2D, /* 84 annotation text2d */
+ inquirePolyline, /* 85 polyline3d */
+ inquirePolyline2D, /* 86 polyline2d */
+ inquirePolylineSet, /* 87 polyline set 3d with data */
+ inquireNurbCurve, /* 88 non-uniform b spline curve */
+ inquireFillArea, /* 89 fill area 3d */
+ inquireFillArea2D, /* 90 fill area 2d */
+ inquireExtFillArea, /* 91 fill area 3d with data */
+ inquireFillAreaSet, /* 92 fill area set 3d */
+ inquireFillAreaSet2D, /* 93 fill area set 2d */
+ inquireExtFillAreaSet, /* 94 fill area set 3d with data */
+ inquireTriangleStrip, /* 95 triangle strip */
+ inquireQuadrilateralMesh, /* 96 quadrilateral mesh */
+ inquireSOFAS, /* 97 set of fill area sets */
+ inquireNurbSurface, /* 98 non-uniform b spline surface */
+ inquireCellArray, /* 99 cell array 3d */
+ inquireCellArray2D, /* 100 cell array 2d */
+ inquireExtCellArray, /* 101 extended cell array 3d */
+ inquireGdp, /* 102 gdp 3d */
+ inquireGdp2D, /* 103 gdp 2d */
+ inquireSetAttribute /* 104 Noop */
+};
+
+
+
+extern ddpex2rtn
+ replaceNurbSurface(),
+ replaceLightState(),
+ replaceSOFAS();
+
+
+ocTableType ReplaceOCTable[] = {
+ parsePropOC, /* 0 dummy entry */
+ parseSetAttribute, /* 1 marker type */
+ parseSetAttribute, /* 2 marker scale */
+ parseColourIndexOC, /* 3 marker colour index */
+ parseColourOC, /* 4 marker colour */
+ parseSetAttribute, /* 5 marker bundle index */
+ parseSetAttribute, /* 6 text font index */
+ parseSetAttribute, /* 7 text precision */
+ parseSetAttribute, /* 8 character expansion */
+ parseSetAttribute, /* 9 character spacing */
+ parseColourIndexOC, /* 10 text colour index */
+ parseColourOC, /* 11 text colour */
+ parseSetAttribute, /* 12 character height */
+ parseSetAttribute, /* 13 character up vector */
+ parseSetAttribute, /* 14 text path */
+ parseSetAttribute, /* 15 text alignment */
+ parseSetAttribute, /* 16 annotation text height */
+ parseSetAttribute, /* 17 annotation text up vector */
+ parseSetAttribute, /* 18 annotation text path */
+ parseSetAttribute, /* 19 annotation text alignment */
+ parseSetAttribute, /* 20 annotation text style */
+ parseSetAttribute, /* 21 text bundle index */
+ parseSetAttribute, /* 22 line type */
+ parseSetAttribute, /* 23 line width */
+ parseColourIndexOC, /* 24 line colour index */
+ parseColourOC, /* 25 line colour */
+ parseSetAttribute, /* 26 curve approximation method */
+ parseSetAttribute, /* 27 polyline interpolation method */
+ parseSetAttribute, /* 28 line bundle index */
+ parseSetAttribute, /* 29 surface interior style */
+ parseSetAttribute, /* 30 surface interior style index */
+ parseColourIndexOC, /* 31 surface colour index */
+ parseColourOC, /* 32 surface colour */
+ parseSetAttribute, /* 33 surface reflection attributes */
+ parseSetAttribute, /* 34 surface reflection model */
+ parseSetAttribute, /* 35 surface interpolation method */
+ parseSetAttribute, /* 36 backface surface interior style */
+ parseSetAttribute, /* 37 backface surface interior style index */
+ parseColourIndexOC, /* 38 backface surface colour index */
+ parseColourOC, /* 39 backface surface colour */
+ parseSetAttribute, /* 40 backface surface reflection attributes */
+ parseSetAttribute, /* 41 backface surface reflection model */
+ parseSetAttribute, /* 42 backface surface interpolation method */
+ parseSetAttribute, /* 43 surface approximation */
+ parseSetAttribute, /* 44 facet culling mode */
+ parseSetAttribute, /* 45 facet distinguish flag */
+ parseSetAttribute, /* 46 pattern size */
+ parseSetAttribute, /* 47 pattern reference point */
+ parseSetAttribute, /* 48 pattern reference point and vectors */
+ parseSetAttribute, /* 49 interior bundle index */
+ parseSetAttribute, /* 50 surface edge flag */
+ parseSetAttribute, /* 51 surface edge type */
+ parseSetAttribute, /* 52 surface edge width */
+ parseColourIndexOC, /* 53 surface edge colour index */
+ parseColourOC, /* 54 surface edge colour */
+ parseSetAttribute, /* 55 edge bundle index */
+ parseSetAttribute, /* 56 set individual asf */
+ parseSetAttribute, /* 57 local transform 3d */
+ parseSetAttribute, /* 58 local transform 2d */
+ parseSetAttribute, /* 59 global transform 3d */
+ parseSetAttribute, /* 60 global transform 2d */
+ parseSetAttribute, /* 61 model clip */
+ parseSetMCVolume, /* 62 set model clip volume 3d */
+ parseSetMCVolume2D, /* 63 set model clip volume 2d */
+ parseSetAttribute, /* 64 restore model clip volume */
+ parseSetAttribute, /* 65 view index */
+ replaceLightState, /* 66 light source state */
+ parseSetAttribute, /* 67 depth cue index */
+ parseSetAttribute, /* 68 pick id */
+ parseSetAttribute, /* 69 hlhsr identifier */
+ parseSetAttribute, /* 70 colour approx index */
+ parseSetAttribute, /* 71 rendering colour model */
+ parsePSurfaceChars, /* 72 parametric surface attributes */
+ parseSetAttribute, /* 73 add names to name set */
+ parseSetAttribute, /* 74 remove names from name set */
+ parseSetAttribute, /* 75 execute structure */
+ parseSetAttribute, /* 76 label */
+ parseSetAttribute, /* 77 application data */
+ parseSetAttribute, /* 78 gse */
+ parseMarker, /* 79 marker 3d */
+ parseMarker2D, /* 80 marker 2d */
+ parseText, /* 81 text3d */
+ parseText2D, /* 82 text2d */
+ parseAnnotationText, /* 83 annotation text3d */
+ parseAnnotationText2D, /* 84 annotation text2d */
+ parsePolyline, /* 85 polyline3d */
+ parsePolyline2D, /* 86 polyline2d */
+ parsePolylineSet, /* 87 polyline set 3d with data */
+ parseNurbCurve, /* 88 non-uniform b spline curve */
+ parseFillArea, /* 89 fill area 3d */
+ parseFillArea2D, /* 90 fill area 2d */
+ parseExtFillArea, /* 91 fill area 3d with data */
+ parseFillAreaSet, /* 92 fill area set 3d */
+ parseFillAreaSet2D, /* 93 fill area set 2d */
+ parseExtFillAreaSet, /* 94 fill area set 3d with data */
+ parseTriangleStrip, /* 95 triangle strip */
+ parseQuadrilateralMesh, /* 96 quadrilateral mesh */
+ replaceSOFAS, /* 97 set of fill area sets */
+ replaceNurbSurface, /* 98 non-uniform b spline surface */
+ parseCellArray, /* 99 cell array 3d */
+ parseCellArray2D, /* 100 cell array 2d */
+ parseExtCellArray, /* 101 extended cell array 3d */
+ parseGdp, /* 102 gdp 3d */
+ parseGdp2D, /* 103 gdp 2d */
+ parseSetAttribute /* 104 Noop */
+};
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miMarkers.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miMarkers.c
new file mode 100644
index 000000000..49f427708
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miMarkers.c
@@ -0,0 +1,146 @@
+/* $TOG: miMarkers.c /main/6 1998/02/10 12:41:39 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miMarkers.c,v 3.5 1998/10/04 09:34:21 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miMarkers.h"
+#include "miClip.h"
+
+
+/*++
+ |
+ | Function Name: miPolyMarker
+ |
+ | Function Description:
+ | Handles the Polymarker 3D, and Polymarker 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miPolyMarker(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+ ddpex3rtn miTransform();
+ ddpex3rtn miClipPointList();
+
+/* Local variable definitions */
+ miMarkerStruct *ddmarker = (miMarkerStruct *)(pExecuteOC+1);
+ miListHeader *input_list = (miListHeader *)ddmarker;
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ ddpex3rtn status;
+ miListHeader *mc_list,
+ *mc_clist,
+ *cc_list,
+ *clip_list,
+ *dc_list;
+ ddUSHORT clip_mode; /* view or model clipping */
+ ddPointType out_type;
+
+ /* Check for Model clipping */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ clip_mode = MI_MCLIP;
+
+ /* Tranform points to 4D for clipping */
+ out_type = input_list->type;
+ if (status = miTransform(pddc, input_list, &mc_clist,
+ ident4x4,
+ ident4x4,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+ if (status = miClipPointList(pddc, mc_clist, &mc_list, clip_mode))
+ return(status);
+
+ } else mc_list = input_list;
+
+ clip_mode = MI_VCLIP;
+
+
+ /*
+ * Transform and clip the input list of marker positions.
+ */
+ if (status = miTransform(pddc, mc_list, &cc_list,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Note that miClipPointList discards clipped points */
+ if (status = miClipPointList(pddc, cc_list, &clip_list, clip_mode))
+ return(status);
+
+ /* if nothing left, return early */
+ if (clip_list->numLists <= 0) return(Success);
+
+
+ /* Transform to DC coordinates */
+ if (status = miTransform(pddc, clip_list, &dc_list,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+
+ return (pddc->Static.RenderProcs[MARKER_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_list));
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNCurve.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNCurve.c
new file mode 100644
index 000000000..c422157da
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNCurve.c
@@ -0,0 +1,743 @@
+/* $TOG: miNCurve.c /main/4 1998/02/10 12:41:43 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNCurve.c,v 3.6 1998/10/04 09:34:22 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miNurbs.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miNurbsCurve
+ |
+ | Function Description:
+ | Handles the Nurbs Curve Pex OC.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miNurbsCurve(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+ ddpex3rtn tessellate_curve();
+ extern ocTableType InitExecuteOCTable[];
+
+/* Local variable definitions */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miNurbStruct *ddCurve = (miNurbStruct *)(pExecuteOC+1);
+ miGenericStr *pGStr;
+ miListHeader *tesselated_list;
+ miListHeader *polyline_list;
+ ddpex3rtn status;
+
+ switch(pddc->Static.attrs->curveApprox.approxMethod) {
+
+ case PEXApproxImpDep:
+ case PEXApproxConstantBetweenKnots:
+ case PEXApproxDcChordalSize:
+ case PEXCurveApproxDcChordalDev:
+ case PEXApproxDcRelative:
+ default:
+
+ case PEXApproxWcsChordalSize:
+ case PEXCurveApproxWcsChordalDev:
+ case PEXApproxWcsRelative:
+
+ /* apply curve approximation criteria in wc */
+ if (status = tessellate_curve( pddc, ddCurve,
+ &tesselated_list,
+ pddc->Dynamic->mc_to_wc_xform ))
+ return (status);
+
+ break;
+
+
+ case PEXApproxNpcChordalSize:
+ case PEXCurveApproxNpcChordalDev:
+ case PEXApproxNpcRelative:
+
+ /* apply curve approximation criteria in wc */
+ if (status = tessellate_curve( pddc, ddCurve,
+ &tesselated_list,
+ pddc->Dynamic->mc_to_npc_xform ))
+ return (status);
+
+ break;
+ }
+
+ /* allocate polyline command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miListHeader)))))
+ return(BadAlloc);
+
+ pGStr->elementType = PEXOCPolylineSet;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ polyline_list = (miListHeader *) (pGStr + 1);
+ *polyline_list = *tesselated_list;
+
+ /* render tesselated curve */
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ xfree(pGStr);
+
+ return (status);
+
+}
+
+/*++
+ |
+ | Function Name: multiply_basis_func_control_pts
+ |
+ | Function Description:
+ |
+ | Multiply nurb basis func and control points to get polynomial coeffs
+ |
+ | |poly[0]| |C0,0 C0,1 C0,2 C0,3| |Pxi+3|
+ | |poly[1]| = |C1,0 C1,1 C1,2 C1,3| |Pxi+2|
+ | |poly[2]| |C2,0 C2,1 C2,2 C2,3| |Pxi+1|
+ | |poly[3]| |C3,0 C3,1 C3,2 C3,3| |Pxi |
+ |
+ |
+ | Note(s):
+ |
+ --*/
+static
+void
+multiply_basis_func_control_pts( pt_type, order, span, pts, C, poly )
+ ddPointType pt_type;
+ ddUSHORT order;
+ int span;
+ char *pts; /* control points */
+ double C[MAXORD][MAXORD]; /* span basis matrix */
+ double poly[4][MAXORD]; /* computed polynomial basis mtx */
+{
+ int i, k;
+ double x, y, z, w;
+ char *pt;
+ int point_size;
+
+ DD_VertPointSize(pt_type, point_size);
+
+ for ( k = 0; k < order; k++ ) {
+ x = y = z = w = 0.0;
+ pt = pts + point_size * (span - order);
+ for ( i = 0; i < order; i++ ) { /* for all coeffs */
+ pt += point_size;
+ x += C[k][i] * ((ddCoord4D *)pt)->x;
+ y += C[k][i] * ((ddCoord4D *)pt)->y;
+ if ( !DD_IsVert2D(pt_type) ) {
+ z += C[k][i] * ((ddCoord4D *)pt)->z;
+ if ( DD_IsVert4D(pt_type) )
+ w += C[k][i] * ((ddCoord4D *)pt)->w;
+ }
+ }
+ poly[XX][k] = x;
+ poly[YY][k] = y;
+ poly[ZZ][k] = z;
+ poly[WW][k] = w;
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_fwd_matrix2D
+ |
+ | Function Description:
+ |
+ | initial scale and convert coefficients to forward difference basis
+ |
+ | |1 0 0 0 | |1 0 0 0 | |polyx[0]|
+ | |fdx[0]| |0 1 1 1 | |0 dt 0 0 | |polyx[1]|
+ | |fdx[1]| = | | | 2 | | |
+ | |fdx[2]| |0 0 2 6 | |0 0 dt 0 | |polyx[2]|
+ | |fdx[3]| | | | 3| | |
+ | |0 0 0 6 | |0 0 0 dt | |polyx[3]|
+ |
+ |
+ | Note(s):
+ |
+ --*/
+static
+void
+compute_fwd_matrix2D( pt_type, order, dt, poly )
+ ddPointType pt_type;
+ ddUSHORT order;
+ float dt;
+ double poly[MAXORD][MAXORD];
+{
+ int i, j, k;
+ double fd[MAXORD];
+ double sptofd[MAXORD][MAXORD];
+ double dtpow[MAXORD];
+
+ register double a0;
+
+ dtpow[0] = 1.0; /* make scale matrix */
+ for ( i = 1; i < order; i++ )
+ dtpow[i] = dtpow[i-1] * dt;
+
+ for ( i = 0; i < order; i++ ) /* scale matrix x fwd matrix */
+ for (j = i; j < order; j++ )
+ sptofd[i][j] = mi_nu_ptofd[i][j] * dtpow[j];
+
+ for ( i = 0; i < 3; i++ ) { /* x, y, z */
+ for ( j = 0; j < order; j++ ) {
+ a0 = 0.0;
+ for ( k = j; k < order; k++ )
+ a0 += sptofd[j][k] * poly[i][k];
+ fd[j] = a0;
+ }
+ for ( j = 0; j < order; j++ )
+ poly[i][j] = fd[j];
+ }
+
+ if ( DD_IsVert4D(pt_type) ) {
+ for ( j = 0; j < order; j++ ) {
+ a0 = 0.0;
+ for ( k = j; k < order; k++ )
+ a0 += sptofd[j][k] * poly[WW][k];
+ fd[j] = a0;
+ }
+ for ( j = 0; j < order; j++ )
+ poly[WW][j] = fd[j];
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: ofd_curve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+static
+void
+ofd_curve( pt_type, order, knot, num_segs, dt, A, pts )
+ ddPointType pt_type;
+ ddUSHORT order;
+ ddFLOAT *knot;
+ int num_segs;
+ float dt;
+ register double A[4][MAXORD];
+ char *pts;
+{
+ register int i, j;
+ register int point_size;
+
+ DD_VertPointSize(pt_type, point_size);
+
+ /* Move to the first point of the span. */
+ ((ddCoord4D *)pts)->x = A[XX][0];
+ ((ddCoord4D *)pts)->y = A[YY][0];
+ ((ddCoord4D *)pts)->z = A[ZZ][0];
+ ((ddCoord4D *)pts)->w = A[WW][0];
+ pts += point_size;
+
+ for ( i = 1; i <= num_segs; i++ ) { /* number of steps */
+ for ( j = 0; j < order - 1; j++ ) { /* forward difference */
+ A[XX][j] += A[XX][j+1];
+ A[YY][j] += A[YY][j+1];
+ }
+
+ ((ddCoord4D *)pts)->x = A[XX][0];
+ ((ddCoord4D *)pts)->y = A[YY][0];
+
+ if ( !DD_IsVert2D(pt_type) ) {
+
+ for ( j = 0; j < order - 1; j++ )
+ A[ZZ][j] += A[ZZ][j+1];
+
+ ((ddCoord4D *)pts)->z = A[ZZ][0];
+
+ if ( DD_IsVert4D(pt_type) ) {
+
+ for ( j = 0; j < order - 1; j++ )
+ A[WW][j] += A[WW][j+1];
+
+ ((ddCoord4D *)pts)->w = A[WW][0];
+ }
+ }
+
+ pts += point_size;
+ }
+
+ return;
+}
+
+
+
+/*++
+ |
+ | Function Name: nu_compute_nurb_curve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+static
+ddpex3rtn
+nu_compute_nurb_curve( pddc, curve, aptype, apval, curve_list )
+ miDDContext *pddc;
+ miNurbStruct *curve;
+ int aptype;
+ ddFLOAT apval;
+ miListHeader **curve_list;
+{
+ ddUSHORT order = curve->order;
+ int i;
+
+ miListHeader *control_points = &curve->points;
+ ddFLOAT (*rknots)[MAXORD]=0; /* reciprocal of knot diff */
+ double C[MAXORD][MAXORD]; /* bspline to poly matrix */
+ double A[4][MAXORD]; /* xyzw curve coefficients */
+ int numKnots; /* number of knots aftetr insertion */
+ int numnewKnots;
+ ddFLOAT *knots = 0; /* new knots after insertion */
+ ddCoord4D *cpts = 0; /* new ctrl pts after insertion */
+ ddCoord4D *out_pts; /* output data pointer */
+ listofddPoint *pddlist; /* data list pointer */
+ int num_cpts, num_subsegs, num_additional_knots;
+ float additional_knots[2];
+ float dt;
+
+ if (curve->numKnots != control_points->ddList->numPoints + order)
+ return 0;
+
+ if ( !(curve->numKnots > 0 && control_points->ddList->numPoints > 0) )
+ return 0;
+
+ /* Trimming by knot insertion (if needed). */
+ num_additional_knots = 0;
+ if ( curve->uMin > curve->pKnots[order-1] )
+ additional_knots[num_additional_knots++] = curve->uMin;
+
+ if ( curve->uMax < curve->pKnots[curve->numKnots - order] )
+ additional_knots[num_additional_knots++] = curve->uMax;
+
+ if ( num_additional_knots > 0 ) {
+
+ if ( !( knots = (ddFLOAT *)
+ xalloc((num_additional_knots + curve->numKnots)*sizeof(float))))
+ goto no_mem;
+
+ if ( !( cpts = (ddCoord4D *)
+ xalloc( (num_additional_knots + control_points->ddList->numPoints)
+ * sizeof(ddCoord4D))) )
+ goto no_mem;
+
+ numnewKnots = num_additional_knots;
+ for ( i = 0; i < num_additional_knots; i++ )
+ knots[i] = additional_knots[i];
+
+ if ( !mi_nu_insert_knots( order, control_points->type,
+ curve->numKnots, curve->pKnots,
+ (ddFLOAT *)(control_points->ddList->pts.ptr),
+ &numnewKnots, knots,
+ (ddFLOAT *)cpts ) )
+ goto no_mem;
+
+ numKnots = numnewKnots;
+ num_cpts = numnewKnots - order;
+
+ } else {
+
+ numKnots = curve->numKnots;
+ knots = curve->pKnots;
+ num_cpts = numKnots - order;
+ cpts = control_points->ddList->pts.p4Dpt;
+ }
+
+
+
+ /* Build the tessellation. */
+ if ( order > MAXORD || order == 1 ) {
+
+ /*
+ * if order > MAXORD, Draw only the control polygon.
+ * if order == 1, draw point at each control point.
+ */
+ *curve_list = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER((*curve_list), 1);
+
+ if ( DD_IsVert4D(control_points->type) ) {
+
+ ddCoord4D *in_pt4D, *out_pt4D;
+
+ (*curve_list)->type = DDPT_4D;
+ MI_ALLOCLISTOFDDPOINT( (*curve_list)->ddList, num_cpts,
+ sizeof(ddCoord4D) );
+ out_pt4D = (*curve_list)->ddList->pts.p4Dpt;
+ if ( !out_pt4D ) return(BadAlloc);
+ in_pt4D = cpts;
+
+ for ( i = 0; i < num_cpts; i++ ) *(out_pt4D++) = *(in_pt4D++);
+
+ } else if ( DD_IsVert3D(control_points->type) ) {
+
+ ddCoord3D *in_pt3D, *out_pt3D;
+
+ (*curve_list)->type = DDPT_3D;
+ MI_ALLOCLISTOFDDPOINT( (*curve_list)->ddList, num_cpts,
+ sizeof(ddCoord3D) );
+ out_pt3D = (*curve_list)->ddList->pts.p3Dpt;
+ if ( !out_pt3D ) return(BadAlloc);
+ in_pt3D = (ddCoord3D *)cpts;
+
+ for ( i = 0; i < num_cpts; i++ ) *(out_pt3D++) = *(in_pt3D++);
+
+ } else {
+
+ ddCoord2D *in_pt2D, *out_pt2D;
+
+ (*curve_list)->type = DDPT_2D;
+ MI_ALLOCLISTOFDDPOINT( (*curve_list)->ddList, num_cpts,
+ sizeof(ddCoord2D) );
+ out_pt2D = (*curve_list)->ddList->pts.p2Dpt;
+ if ( !out_pt2D ) return(BadAlloc);
+ in_pt2D = (ddCoord2D *)cpts;
+
+ for ( i = 0; i < num_cpts; i++ ) *(out_pt2D++) = *(in_pt2D++);
+
+ }
+
+ } else { /* ( order > 1 and <= MAXORD ) */
+
+ switch( aptype ) {
+ case PEXApproxImpDep:
+ case PEXApproxConstantBetweenKnots:
+ default:
+ if ( apval <= 0.0 ) {
+ dt = 1.0;
+ num_subsegs = 1;
+
+ } else {
+ dt = 1.0 / (apval + 1.0);
+ num_subsegs = apval + 1; /* assume it's been clamped */
+ }
+
+ if ( !( rknots = (ddFLOAT (*)[MAXORD])
+ xalloc( MAXORD * numKnots * sizeof(float))) )
+ goto no_mem;
+
+ mi_nu_preprocess_knots( order, numKnots, knots, rknots );
+
+ /* build a new list for each span */
+ (*curve_list) = MI_NEXTTEMPDATALIST(pddc);
+ (*curve_list)->type = control_points->type;
+ (*curve_list)->numLists = 0;
+ MI_ALLOCLISTHEADER((*curve_list), num_cpts);
+ if (!(pddlist = (*curve_list)->ddList )) return(BadAlloc);
+
+ for ( i = order - 1; i < num_cpts; i++ ) {
+ if ( knots[i+1] > knots[i]
+ && knots[i] >= curve->uMin
+ && knots[i+1] <= curve->uMax )
+ {
+ mi_nu_compute_nurb_basis_function( order, i,
+ knots, rknots, C );
+ multiply_basis_func_control_pts( control_points->type,
+ order, i,
+ (char *)cpts, C, A );
+ compute_fwd_matrix2D( control_points->type,order,dt,A );
+
+ MI_ALLOCLISTOFDDPOINT(pddlist, num_subsegs + 1,
+ sizeof(ddCoord4D));
+ if (!(out_pts = pddlist->pts.p4Dpt))
+ return(BadAlloc);
+
+ ofd_curve( control_points->type, order, &knots[i],
+ num_subsegs, dt, A, (char *)out_pts );
+
+ (pddlist++)->numPoints = num_subsegs + 1;
+ (*curve_list)->numLists += 1;
+ }
+ }
+
+ break;
+ } /* end switch on approx type */
+ }
+
+ if (knots != curve->pKnots) xfree(knots);
+ if (cpts != control_points->ddList->pts.p4Dpt) xfree(cpts);
+ xfree(rknots);
+
+ return 0;
+
+no_mem:
+ if ((knots)&&(knots != curve->pKnots)) xfree(knots);
+ if ((cpts)&&(cpts != control_points->ddList->pts.p4Dpt)) xfree(cpts);
+ if (rknots) xfree(rknots);
+
+ return (BadAlloc);
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_adaptive_crv_interval
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+static
+ddpex3rtn
+compute_adaptive_crv_interval( pddc, curve, xform, apxval )
+ miDDContext *pddc;
+ miNurbStruct *curve;
+ ddFLOAT xform[4][4];
+ ddFLOAT *apxval;
+{
+ ddFLOAT a_coeff, b_coeff, c_coeff, denom, z1, z2, z3;
+ int i, use_z_coord = 0;
+ int npts = curve->points.ddList->numPoints;
+ ddCoord4D *xpts, *pa, *pb, *pc;
+ ddPointUnion in_pt;
+ double w, perp_d, max_perp_d = 0.0;
+ miListHeader *tmp_list;
+ int point_size;
+ ddpex3rtn status;
+
+ /*
+ * Compute the constant parametric between knots interval needed to
+ * come close to meeting the specified approximation criteria. The
+ * method used is a gross compromise for the adaptive approximation
+ * criteria, but fulfills the basic need for an adaptive approximation
+ * method.
+ * Note that for the NPC approximation criteria NPC isn't even the space
+ * being used, it's clipping space, which is [-1,1], [-1,1], [0,1].
+ * The Z component is ignored in this case though since the Z dimension
+ * is perpendicular to the screen.
+ */
+ *apxval = 0.0;
+ switch ( pddc->Static.attrs->curveApprox.approxMethod ) {
+ case PEXApproxNpcChordalSize:
+ case PEXCurveApproxNpcChordalDev:
+ use_z_coord = 0;
+ break;
+
+ case PEXApproxWcsChordalSize:
+ case PEXCurveApproxWcsChordalDev:
+ use_z_coord = 1;
+ break;
+ }
+
+ if ( xform ) {
+ if (status = miTransform( pddc, &curve->points, &tmp_list,
+ xform, NULL4x4, DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Normalize result by w */
+ xpts = tmp_list->ddList->pts.p4Dpt;
+ for ( i = 0, pa = xpts; i < npts; i++, pa++ ) {
+ w = 1.0 / pa->w;
+ pa->x *= w; pa->y *= w;
+ if ( use_z_coord ) pa->z *= w;
+ }
+
+ } else {
+
+ DD_VertPointSize(curve->points.type, point_size);
+
+ if ( !( xpts = (ddCoord4D *)xalloc(npts * sizeof(ddCoord4D))) ) {
+ return BadAlloc;
+ }
+
+ if ( DD_IsVert4D(curve->points.type) ) {
+
+ /* if homogeneous values, then normalize by w */
+ for ( i = 0, in_pt.p4Dpt = curve->points.ddList->pts.p4Dpt, pa = xpts;
+ i < npts;
+ i++ ) {
+
+ w = 1.0 / in_pt.p4Dpt->w;
+ pa->x = in_pt.p4Dpt->x * w;
+ pa->y = in_pt.p4Dpt->y * w;
+ if ( use_z_coord ) pa->z = in_pt.p4Dpt->z * w;
+
+ in_pt.ptr += point_size;
+ pa++;
+ }
+
+ } else {
+
+ if ( DD_IsVert2D(curve->points.type) ) use_z_coord = 0;
+
+ /* Copy 2D or 3D points into 4D array */
+ for ( i = 0, in_pt.p4Dpt = curve->points.ddList->pts.p4Dpt, pa = xpts;
+ i < npts;
+ i++ ) {
+
+ pa->x = in_pt.p4Dpt->x;
+ pa->y = in_pt.p4Dpt->y;
+ if ( use_z_coord ) pa->z = in_pt.p4Dpt->z;
+
+ in_pt.ptr += point_size;
+ pa++;
+ }
+
+ }
+
+ }
+
+ /*
+ * For the above approx. types, the approx. value is the max. allowable
+ * distance between the actual curve and the generated chord.
+ * The distance of the ctrl point from the line joining the ctrl pts on
+ * either side of it is calculated for every ctrl pt. This is calculated
+ * in 2D. For approx. in WC, the 3D length is got from the 2D-length
+ * and the z values of the ctrl pts. The max of all these lengths is
+ * found. The final approx. value is obtd. from the ratio of the max length
+ * and the required approx. value.
+ */
+
+ pa = xpts; pb = pa + 2, pc = pa + 1;
+ for ( i = 1; i < npts-1; i++, pa++, pb++, pc++ ) {
+ a_coeff = pb->y - pa->y;
+ b_coeff = pa->x - pb->x;
+ c_coeff = pb->x * pa->y - pa->x * pb->y;
+ denom = ( a_coeff * a_coeff + b_coeff * b_coeff );
+ perp_d = (a_coeff * pc->x + b_coeff * pc->y + c_coeff);
+ if ( use_z_coord ) {
+ z1 = pc->z;
+ z2 = (pa->z + pb->z) /2.0;
+ z3 = z1 - z2;
+ perp_d = sqrt( (perp_d * perp_d + z3 * z3 * denom) /denom );
+ } else
+ perp_d = perp_d/ (sqrt(denom));
+ perp_d = fabs(perp_d);
+ if ( perp_d > max_perp_d )
+ max_perp_d = perp_d;
+ }
+
+ *apxval = (int)(1 + sqrt( 10*max_perp_d /
+ (pddc->Static.attrs->curveApprox.tolerance > 0.0
+ ? pddc->Static.attrs->curveApprox.tolerance : 0.01)));
+
+ if (xpts != tmp_list->ddList->pts.p4Dpt) xfree(xpts);
+
+ return Success;
+}
+
+/*++
+ |
+ | Function Name: tessellate_curve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+ddpex3rtn
+tessellate_curve( pddc, curve, curve_list, xform )
+ miDDContext *pddc;
+ miNurbStruct *curve;
+ miListHeader **curve_list;
+ ddFLOAT xform[4][4];
+{
+ int approx_type;
+ ddFLOAT approx_value;
+ ddpex3rtn status = 0; /* !0 if successful */
+
+ if ( curve->points.ddList->numPoints <= 0 )
+ return status;
+
+ switch ( pddc->Static.attrs->curveApprox.approxMethod ) {
+ case PEXApproxImpDep:
+ case PEXApproxConstantBetweenKnots:
+ approx_type = PEXApproxConstantBetweenKnots;
+ approx_value=MAX((int)pddc->Static.attrs->curveApprox.tolerance,0);
+ break;
+
+ case PEXApproxWcsChordalSize:
+ case PEXApproxNpcChordalSize:
+ case PEXCurveApproxWcsChordalDev:
+ case PEXCurveApproxNpcChordalDev:
+ /* The same approximation method is used for all these
+ * approximation types, and it's not exactly any of them.
+ * But the method used serves the same purpose and
+ * PHIGS PLUS allows us to approximate the defined methods.
+ */
+ approx_type = PEXApproxConstantBetweenKnots;
+ compute_adaptive_crv_interval( pddc, curve, xform,
+ &approx_value );
+ break;
+
+ default:
+ approx_type = PEXApproxConstantBetweenKnots;
+ approx_value = 1.0;
+ break;
+ }
+
+ return(nu_compute_nurb_curve( pddc, curve,
+ approx_type, approx_value,
+ curve_list ));
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSTrim.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSTrim.c
new file mode 100644
index 000000000..30354c1b9
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSTrim.c
@@ -0,0 +1,1943 @@
+/* $TOG: miNSTrim.c /main/6 1998/02/10 12:41:47 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSTrim.c,v 3.5 1998/10/04 09:34:22 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "miRender.h"
+#include "PEXErr.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miNurbs.h"
+#include "pexos.h"
+
+#define INACTIVE 0
+
+#define NEW_SEG( _td ) \
+ ((Nurb_trim_segment *)xalloc( sizeof(Nurb_trim_segment) ))
+
+/*++
+ |
+ | Function Name: phg_nt_free_trim_data
+ |
+ | Function Description:
+ |
+ | frees data allocated during the triming process.
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+phg_nt_free_trim_data( tdata )
+ register Nurb_trim_data *tdata;
+{
+
+ register int i;
+ register Nurb_trim_segment *seg, *next_seg;
+
+ for ( i = 0; i < tdata->nloops; i++ ) {
+ for ( seg = tdata->loops[i].segs; seg; seg = next_seg ) {
+ next_seg = seg->next;
+ xfree( seg );
+ }
+ }
+ tdata->nloops = 0;
+
+ if ( tdata->vertices ) {
+ xfree( tdata->vertices );
+ tdata->vertices = (Nurb_param_point *)NULL;
+ }
+ if ( tdata->loops ) {
+ xfree( tdata->loops );
+ tdata->loops = (Nurb_trim_loop_rep *)NULL;
+ }
+ if ( tdata->ep_list_size > 0 ) {
+ xfree( tdata->ep_list );
+ tdata->ep_list_size = 0;
+ tdata->ep_list = (Nurb_edge_point *)NULL;
+ }
+}
+
+
+
+#define CHUNK_SIZE 5
+
+/*++
+ |
+ | Function Name: grow_range_list
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+grow_range_list( itr, inters )
+ int itr;
+ double **inters;
+{
+ if ( itr == 0 )
+ *inters = (double *)xalloc( CHUNK_SIZE * sizeof(double) );
+ else
+ *inters = (double *)xrealloc( *inters,
+ (itr + CHUNK_SIZE) * sizeof(double) );
+
+ return (*inters ? Success : BadAlloc);
+}
+
+/*++
+ |
+ | Function Name: compute_intersections
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+compute_intersections( state, dir, s, inters, inter_count )
+ Nurb_surf_state *state;
+ int dir; /* coordinate direction, 1 ==> U, 2 ==> V */
+ double s;
+ double **inters;
+ int *inter_count;
+{
+ register int i, j;
+ register int itr;
+ register Nurb_trim_data *tdata;
+ register Nurb_trim_segment *cur;
+ register Nurb_param_limit *ext;
+ register Nurb_param_point *trim_pts;
+ register double pa, pb, pc, pd;
+ register double alpha;
+
+ itr = 0;
+ tdata = &state->trim_data;
+ trim_pts = tdata->vertices;
+
+ for ( i = 0; i < tdata->nloops; i++ ) {
+ ext = &tdata->loops[i].extent;
+ if ( (dir == 1 && s > ext->umin && s <= ext->umax )
+ || (dir == 2 && s > ext->vmin && s <= ext->vmax ) ) {
+ for ( cur = tdata->loops[i].segs; cur; cur = cur->next ) {
+ ext = &cur->extent;
+ if ( (dir == 1 && s > ext->umin && s <= ext->umax )
+ || (dir == 2 && s > ext->vmin && s <= ext->vmax ) ) {
+ for ( j = cur->first; j < cur->last; j++ ) {
+ if ( dir == 1 ) { /* U direction */
+ pa = trim_pts[j].u; pb = trim_pts[j+1].u;
+ pc = trim_pts[j].v; pd = trim_pts[j+1].v;
+ } else { /* V direction */
+ pa = trim_pts[j].v; pb = trim_pts[j+1].v;
+ pc = trim_pts[j].u; pd = trim_pts[j+1].u;
+ }
+ if ( s > pa && s <= pb || s > pb && s <= pa ) {
+ if ( itr % CHUNK_SIZE == 0 )
+ if ( grow_range_list( itr, inters ) ) {
+ return (BadAlloc);
+ }
+ alpha = (s - pa) / (pb - pa);
+ (*inters)[itr++] = pc + alpha * (pd - pc);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ *inter_count = itr;
+ return ( Success );
+}
+#undef CHUNK_SIZE
+
+
+
+/*++
+ |
+ | Function Name: phg_nt_compute_trim_range
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+int
+phg_nt_compute_trim_range( state, dir, s, knot_min, knot_max,
+ ranges, trim_range_count )
+ Nurb_surf_state *state;
+ int dir; /* coordinate direction, 1 ==> U, 2 ==> V */
+ double s;
+ double knot_min;
+ double knot_max;
+ Nurb_limitlst *ranges;
+ int *trim_range_count;
+{
+ /* -1 ==> paint entire curve
+ * 0 ==> discard the curve
+ * >0 ==> paint in between trim ranges
+ */
+
+ int inter_count;
+ double tmp;
+ double *intersections = (double *)NULL;
+ int trim_ranges = -1;
+ int status;
+
+ register int i, j;
+
+ if ( state->trim_data.nloops <= 0 ) {
+ *trim_range_count = -1;
+ return ( Success );
+ }
+
+ if ( status = compute_intersections( state, dir, s,
+ &intersections, &inter_count ))
+ return(status);
+
+ if ( inter_count == -1 || inter_count == 0 ) {
+ /* All painted or none painted. */
+ trim_ranges = inter_count;
+
+ } else if ( inter_count == 1 && intersections[0] <= knot_min ) {
+ /* All painted */
+ trim_ranges = -1;
+
+ } else {
+ ranges->number = 0;
+ if ( inter_count % 2 == 1 ) {
+ /* Odd number of intersections. */
+ intersections[inter_count] = 1.0E30;
+ }
+
+ if ( inter_count > 0 ) {
+ /* Get space for range values. */
+ if ( inter_count > ranges->size ) {
+ if ( ranges->size <= 0 ) {
+ ranges->size = inter_count;
+ ranges->limits = (Nurb_limit *)
+ xalloc( ranges->size * sizeof(Nurb_limit) );
+ } else {
+ ranges->size = inter_count;
+ ranges->limits = (Nurb_limit *) xrealloc( ranges->limits,
+ ranges->size * sizeof(Nurb_limit) );
+ }
+
+ if ( ! ranges->limits ) {
+ ranges->size = 0;
+ xfree( intersections );
+ return ( BadAlloc );
+ }
+ }
+ }
+
+ if ( inter_count > 1 ) {
+ /* Sort intersections, lowest to highest. */
+ for ( j = 0; j < inter_count-1; j++ ) {
+ for ( i = j+1; i < inter_count; i++ ) {
+ if ( intersections[j] > intersections[i] ) {
+ tmp = intersections[i];
+ intersections[i] = intersections[j];
+ intersections[j] = tmp;
+ }
+ }
+ }
+ }
+
+ /* Compute trim ranges. */
+ for ( j = 0; j < inter_count; ) {
+ if ( intersections[j] >= knot_max ) {
+ /* Out of range, not painted. */
+ break;
+ } else {
+ if ( intersections[j] <= knot_min )
+ ranges->limits[ranges->number].lmin = knot_min;
+ else
+ ranges->limits[ranges->number].lmin = intersections[j];
+ ++j;
+
+ if ( intersections[j] >= knot_min ) {
+ if ( intersections[j] >= knot_max)
+ ranges->limits[ranges->number].lmax = knot_max;
+ else
+ ranges->limits[ranges->number].lmax = intersections[j];
+ ++ranges->number;
+ }
+ ++j;
+ }
+ }
+ trim_ranges = ranges->number;
+ }
+
+ if ( intersections )
+ xfree( intersections );
+
+ *trim_range_count = trim_ranges;
+
+ return( Success );
+}
+
+
+
+/*++
+ |
+ | Function Name: evaluate_trim_curve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+evaluate_trim_curve( crv, span, t, p )
+ ddTrimCurve *crv;
+ int span;
+ double t;
+ ddCoord3D *p;
+{
+ ddCoord3D temp_points[MAXORD] ;
+ double alpha;
+
+ register int i, j, k, left;
+ register int order = crv->order;
+ register ddFLOAT *knots = crv->pKnots;
+ register ddCoord3D *tmp;
+ char rat;
+
+ /* Find the span where t belongs if not specified. */
+ if ( span )
+ left = span - order;
+ else {
+ left = crv->numKnots - 1;
+ if ( knots[left] == t )
+ while ( knots[left] >= t )
+ --left;
+ else
+ while ( knots[left] > t )
+ --left;
+ left -= order - 1;
+ }
+
+ /* Note that 3D implies homogeneous for trim curves */
+ rat = DD_IsVert3D(crv->pttype);
+
+ if (rat) {
+ ddCoord3D *cpts3;
+
+ /* Copy points to temp space. */
+ cpts3 = &crv->points.pts.p3Dpt[left];
+ tmp = temp_points;
+ memcpy( (char *)tmp, (char *)cpts3, order * sizeof(ddCoord3D) );
+
+ } else {
+ ddCoord2D *cpts2;
+
+ /* Copy points to temp space. */
+ cpts2 = &crv->points.pts.p2Dpt[left];
+ tmp = temp_points;
+ for ( i = 0; i < order; i++, cpts2++, tmp++ ) {
+ tmp->x = cpts2->x;
+ tmp->y = cpts2->y;
+ tmp->z = 1.0;
+ }
+
+ }
+
+ /* Evaluate the span. */
+ tmp = temp_points;
+ for ( k = 1; k < order; k++ ) {
+ for ( j = order-1; j >= k; j-- ) {
+ i = left + j;
+ alpha = (t - knots[i]) / (knots[i+order-k] - knots[i]);
+ tmp[j].x = tmp[j-1].x + alpha * (tmp[j].x - tmp[j-1].x);
+ tmp[j].y = tmp[j-1].y + alpha * (tmp[j].y - tmp[j-1].y);
+ if ( rat )
+ tmp[j].z = tmp[j-1].z + alpha * (tmp[j].z - tmp[j-1].z);
+ }
+ }
+
+ p->x = tmp[order-1].x;
+ p->y = tmp[order-1].y;
+ p->z = ( ( rat ) ? tmp[order-1].z : 1.0 );
+}
+
+
+
+#define ADD_TRIM_POINT( _r, _u, _v, _w ) \
+ { \
+ if ( (_r) ) { \
+ tdata->vertices[tdata->cur_vertex].u = (_u) / (_w); \
+ tdata->vertices[tdata->cur_vertex].v = (_v) / (_w); \
+ } else { \
+ tdata->vertices[tdata->cur_vertex].u = (_u); \
+ tdata->vertices[tdata->cur_vertex].v = (_v); \
+ } \
+ ++tdata->cur_vertex; \
+ }
+
+/*++
+ |
+ | Function Name: add_trim_curve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+add_trim_curve( state, crv, tdata, seg )
+ Nurb_surf_state *state;
+ ddTrimCurve *crv;
+ Nurb_trim_data *tdata;
+ Nurb_trim_segment *seg;
+{
+ double t, dt;
+ double tmin = crv->uMin;
+ double tmax = crv->uMax;
+ double left, right;
+ ddCoord3D p;
+ char rat;
+
+ int i;
+ ddFLOAT *knots = crv->pKnots;
+ ddFLOAT tolerance;
+
+ /* Initialize segment and store location of first curve vertex. */
+ seg->vis = crv->visibility;
+ seg->start = tdata->cur_vertex;
+ seg->first = seg->start;
+
+ /* Note that 3D implies homogeneous for trim curves */
+ rat = DD_IsVert3D(crv->pttype);
+
+ /* Tessellate the trim curve and add the points to the vertex list. */
+
+ /* Special case second order (linear) curves. */
+ if ( crv->order == 2 ) {
+ double alpha, beta;
+
+ if (rat) {
+
+ ddCoord3D *pts3 = crv->points.pts.p3Dpt;
+
+ /* Find first interval of interest. */
+ if (tmin < knots[1]) tmin = knots[1];
+ for ( i = 2; knots[i] <= tmin; i++ )
+ ;
+
+ /* First point. */
+ alpha = (tmin - knots[i-1]) / (knots[i] - knots[i-1]);
+ beta = 1.0 - alpha;
+ p.x = beta * pts3[i-2].x + alpha * pts3[i-1].x;
+ p.y = beta * pts3[i-2].y + alpha * pts3[i-1].y;
+ p.z = beta * pts3[i-2].z + alpha * pts3[i-1].z;
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+
+ /* Interior points. */
+ if (tmax > knots[crv->numKnots - 2]) tmax = knots[crv->numKnots - 2];
+ for ( ; knots[i] < tmax; i++ ) {
+ ADD_TRIM_POINT( rat, pts3[i-1].x, pts3[i-1].y, pts3[i-1].z )
+ }
+
+ /* Last point. */
+ alpha = (tmax - knots[i-1]) / (knots[i] - knots[i-1]);
+ beta = 1.0 - alpha;
+ p.x = beta * pts3[i-2].x + alpha * pts3[i-1].x;
+ p.y = beta * pts3[i-2].y + alpha * pts3[i-1].y;
+ p.z = beta * pts3[i-2].z + alpha * pts3[i-1].z;
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+
+ } else {
+
+ ddCoord2D *pts2 = crv->points.pts.p2Dpt;
+
+ /* Find first interval of interest. */
+ if (tmin < knots[1]) tmin = knots[1];
+ for ( i = 2; knots[i] <= tmin; i++ )
+ ;
+
+ /* First point. */
+ alpha = (tmin - knots[i-1]) / (knots[i] - knots[i-1]);
+ beta = 1.0 - alpha;
+ p.x = beta * pts2[i-2].x + alpha * pts2[i-1].x;
+ p.y = beta * pts2[i-2].y + alpha * pts2[i-1].y;
+ ADD_TRIM_POINT( rat, p.x, p.y, 1.0 );
+
+ /* Interior points. */
+ if (tmax > knots[crv->numKnots - 2]) tmax = knots[crv->numKnots - 2];
+ for ( ; knots[i] < tmax; i++ ) {
+ ADD_TRIM_POINT( rat, pts2[i-1].x, pts2[i-1].y, 1.0 )
+ }
+
+ /* Last point. */
+ alpha = (tmax - knots[i-1]) / (knots[i] - knots[i-1]);
+ beta = 1.0 - alpha;
+ p.x = beta * pts2[i-2].x + alpha * pts2[i-1].x;
+ p.y = beta * pts2[i-2].y + alpha * pts2[i-1].y;
+ ADD_TRIM_POINT( rat, p.x, p.y, 1.0 );
+ }
+
+ } else if ( crv->order > MAXTCORD || crv->order < 2) { /* unsupported */
+ /* Use untrimmed control polygon. */
+ if (rat) {
+ ddCoord3D *pts3 = crv->points.pts.p3Dpt;
+ for ( i = 0; i < crv->points.numPoints; i++ )
+ ADD_TRIM_POINT(rat, pts3[i].x, pts3[i].y, pts3[i].z );
+ } else {
+ ddCoord2D *pts2 = crv->points.pts.p2Dpt;
+ for ( i = 0; i < crv->points.numPoints; i++ )
+ ADD_TRIM_POINT(rat, pts2[i].x, pts2[i].y, 1.0 );
+ }
+
+ } else { /* supported order > 2 */
+ GET_TRIM_CURVE_TOLERANCE(crv, tolerance);
+
+#ifdef BWEE
+ if ( crv->curveApprox.approxMethod == PCURV_CONSTANT_PARAMETRIC ) {
+ /* First point. */
+ evaluate_trim_curve( crv, 0, tmin, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+
+ /* Interior points. */
+ dt = (tmax - tmin) / (tolerance + 1);
+ for ( t = tmin + dt; t < tmax; t += dt ) {
+ evaluate_trim_curve( crv, 0, t, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+ }
+
+ /* Last point. */
+ evaluate_trim_curve( crv, 0, tmax, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+
+ } else
+#endif /* BWEE */
+
+ {
+
+ for ( i = crv->order - 1; i < crv->points.numPoints; i++ ) {
+ if ( knots[i] != knots[i+1]
+ && knots[i] <= tmax && knots[i+1] >= tmin ) {
+ left = knots[i];
+ right = knots[i+1];
+ dt = (right - left) / (tolerance + 1);
+ t = left;
+
+ /* If interval contains tmin get first point(s). */
+ if ( left <= tmin && right >= tmin ) {
+ while ( t < tmin )
+ t += dt;
+ evaluate_trim_curve( crv, i+1, tmin, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+ if ( t > tmin ) {
+ evaluate_trim_curve( crv, i+1, t, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+ }
+ t += dt;
+ }
+
+ /* Interior points. */
+ while ( t < right && t < tmax ) {
+ evaluate_trim_curve( crv, i+1, t, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+ t += dt;
+ }
+
+ /* If interval contains tmax get last point. */
+ if ( left <= tmax && right >= tmax ) {
+ evaluate_trim_curve( crv, i+1, tmax, &p );
+ ADD_TRIM_POINT( rat, p.x, p.y, p.z );
+ break; /* all done */
+ }
+ }
+ }
+ }
+ }
+
+ /* Store location of last vertex */
+ seg->end = tdata->cur_vertex - 1;
+ seg->last = seg->end;
+ seg->next = NULL;
+}
+
+
+
+#define CONNECT(_pa, _pb) \
+ { \
+ (_pb).u = (_pa).u; \
+ (_pb).v = (_pa).v; \
+ }
+
+/*++
+ |
+ | Function Name: connect_trim_endpoints
+ |
+ | Function Description:
+ |
+ | Insures that a list of tesselated trim curve segments
+ | forms a closed loop.
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+connect_trim_endpoints( tdata, seglist )
+ Nurb_trim_data *tdata;
+ register Nurb_trim_segment *seglist; /* linked list of segments */
+{
+ register Nurb_param_point *trim_pts = tdata->vertices;
+ register Nurb_trim_segment *cur;
+
+ /* Connect the tail of each curve to the head of the following curve. */
+ for ( cur = seglist; cur; cur = cur->next ) {
+ if ( cur->next )
+ CONNECT( trim_pts[cur->last], trim_pts[cur->next->first] )
+ else /* tail of last one to head of first one */
+ CONNECT( trim_pts[seglist->first], trim_pts[cur->last] )
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: make_segments_monotonic
+ |
+ | Function Description:
+ |
+ | Each curve segment description is traversed and, if
+ | necessary, subdivided into smaller segments until
+ | each remaining segment in the list of segments contains
+ | only monotonically increasing or decreasing (in both u & v)
+ | line segments (in other words, there are no changes in sign
+ | in the slope in either u and v in any segment).
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+make_segments_monotonic( tdata, tdloop )
+ Nurb_trim_data *tdata;
+ Nurb_trim_loop_rep *tdloop;
+{
+ unsigned old_u, old_v, u_direc, v_direc;
+
+ register int top, bot, mid;
+ register Nurb_param_point *trim_pts = tdata->vertices;
+ register Nurb_trim_segment *cur, *new;
+
+ for ( cur = tdloop->segs; cur; cur = cur->next ) {
+ top = cur->first;
+ mid = top;
+ bot = cur->last;
+ old_u = old_v = 0;
+ while (1) {
+ ++mid ;
+ if ( trim_pts[mid].u > trim_pts[top].u)
+ u_direc = 1;
+ else if ( trim_pts[mid].u < trim_pts[top].u )
+ u_direc = 2;
+ else
+ u_direc = old_u;
+
+ if ( trim_pts[mid].v > trim_pts[top].v )
+ v_direc = 1;
+ else if ( trim_pts[mid].v < trim_pts[top].v )
+ v_direc = 2;
+ else
+ v_direc = old_v;
+
+ if ( (u_direc | old_u) == 3 || (v_direc | old_v) == 3 ) {
+ cur->dir = ((old_u < 2) << 1) | (old_v < 2);
+ if ( !(new = NEW_SEG( tdata )) )
+ return BadAlloc; /* RETURN */
+
+ new->next = cur->next;
+ cur->next = new;
+ cur->end = cur->last = top;
+ new->start = new->first = top;
+ new->end = new->last = bot;
+ new->vis = cur->vis;
+ cur = new;
+ old_u = old_v = 0;
+ }
+ old_u = u_direc;
+ old_v = v_direc;
+ if ( mid == bot ) { /* LOOP EXIT CONDITION */
+ cur->dir = ((old_u < 2) << 1) | (old_v < 2);
+ break;
+ }
+ top = mid;
+ } /* while (1) */
+ }
+
+ return Success;
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_trim_curve_extents
+ |
+ | Function Description:
+ |
+ | This function computes a trim loop extent
+ | as well as the extents of each of the segments
+ | in the loop.
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+compute_trim_curve_extents( tdata, tdloop )
+ Nurb_trim_data *tdata;
+ Nurb_trim_loop_rep *tdloop;
+{
+ double umin, vmin, umax, vmax;
+
+ register int top, bot;
+ register Nurb_param_point *trim_pts = tdata->vertices;
+ register Nurb_trim_segment *cur;
+
+ umin = vmin = 1.0E30; /* large number */
+ umax = vmax = -umin;
+ /* Assumes each segment is monotonic in both directions. */
+ for ( cur = tdloop->segs; cur; cur = cur->next ) {
+ if ( cur->start == INACTIVE || cur->end == INACTIVE )
+ continue;
+ top = cur->start;
+ bot = cur->end;
+
+ if ( trim_pts[top].u >= trim_pts[bot].u ) {
+ cur->extent.umin = trim_pts[bot].u;
+ cur->extent.umax = trim_pts[top].u;
+ } else {
+ cur->extent.umin = trim_pts[top].u;
+ cur->extent.umax = trim_pts[bot].u;
+ }
+
+ if ( trim_pts[top].v >= trim_pts[bot].v ) {
+ cur->extent.vmin = trim_pts[bot].v;
+ cur->extent.vmax = trim_pts[top].v;
+ } else {
+ cur->extent.vmin = trim_pts[top].v;
+ cur->extent.vmax = trim_pts[bot].v;
+ }
+
+ if ( cur->extent.umin < umin )
+ umin = cur->extent.umin;
+ if ( cur->extent.umax > umax )
+ umax = cur->extent.umax;
+ if ( cur->extent.vmin < vmin )
+ vmin = cur->extent.vmin;
+ if ( cur->extent.vmax > vmax )
+ vmax = cur->extent.vmax;
+ }
+ tdloop->extent.umin = umin;
+ tdloop->extent.umax = umax;
+ tdloop->extent.vmin = vmin;
+ tdloop->extent.vmax = vmax;
+}
+
+
+
+/*++
+ |
+ | Function Name: phg_nt_install_trim_loops
+ |
+ | Function Description:
+ |
+ | this routine creates a linked list of sorted tesselated
+ | curve segments as a prelude to trimming.
+ |
+ | Note(s):
+ |
+ --*/
+
+int
+phg_nt_install_trim_loops( surface, state )
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+{
+ int interval_count;
+ listofTrimCurve *loop;
+ Nurb_trim_segment *seg;
+
+ int i, j;
+ Nurb_trim_data *tdata = &state->trim_data;
+ ddTrimCurve *crv;
+ Nurb_trim_loop_rep *tdloop;
+ Nurb_trim_segment **last_segp;
+ ddFLOAT tolerance;
+
+ /* Determine sizes for initial memory allocations. */
+ interval_count = 0;
+ loop = surface->trimCurves;
+ for ( i = 0; i < surface->numTrimCurveLists; i++, loop++ ) {
+ crv = loop->pTC;
+ for (j = 0; j < loop->count; j++, crv++) {
+ GET_TRIM_CURVE_TOLERANCE( crv, tolerance );
+ interval_count += (crv->points.numPoints * (tolerance + 4));
+ }
+ }
+
+ if ( ! (tdata->vertices = (Nurb_param_point *)
+ xalloc( interval_count * sizeof(tdata->vertices[0]) )) )
+ goto abort;
+
+ if ( ! (tdata->loops = (Nurb_trim_loop_rep *)
+ xalloc( surface->numTrimCurveLists * sizeof(tdata->loops[0]) )) )
+ goto abort;
+
+ /* Initialize the loop structures. */
+ for ( i = 0; i < surface->numTrimCurveLists; i++ )
+ tdata->loops[i].segs = (Nurb_trim_segment *)NULL;
+
+ /* Build the initial (non-monotonic) trim curve segments. */
+ for ( i = 0, loop = surface->trimCurves;
+ i < surface->numTrimCurveLists; i++, loop++ ) {
+
+ tdloop = &tdata->loops[i];
+ for ( j = 0, crv = loop->pTC; j < loop->count; j++, crv++ ) {
+ if ( !(seg = NEW_SEG( tdata )) )
+ goto abort;
+ add_trim_curve( state, crv, tdata, seg );
+ /* Add the new segment to the end of the list. */
+ last_segp = &tdloop->segs;
+ while ( *last_segp )
+ last_segp = &(*last_segp)->next;
+ *last_segp = seg;
+
+ }
+
+ ++tdata->nloops;
+ connect_trim_endpoints( tdata, tdloop->segs );
+ if ( make_segments_monotonic( tdata, tdloop ) )
+ goto abort;
+ compute_trim_curve_extents( tdata, tdloop );
+ }
+
+ return Success;
+
+abort:
+ phg_nt_free_trim_data( &state->trim_data );
+ return BadAlloc;
+}
+
+
+
+#ifdef NDEBUG
+
+#define PRINT_EXTENT( _e ) \
+ fprintf( stderr, "extent: u = ( %f, %f), v = ( %f, %f)\n", \
+ (_e).umin, (_e).umax, (_e).vmin, (_e).vmax );
+
+/*++
+ |
+ | Function Name: phg_nt_print_trim_rep_data
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+phg_nt_print_trim_rep_data( state )
+ Nurb_surf_state *state;
+{
+ Nurb_trim_data *tdata = &state->trim_data;
+ Nurb_trim_loop_rep *loop;
+ Nurb_trim_segment *cur;
+
+ register int i, j;
+
+ fprintf( stderr, "Trim data: %d loops\n", tdata->nloops );
+ loop = tdata->loops;
+ for ( i = 0; i < tdata->nloops; i++, loop++ ) {
+ fprintf( stderr, "loop %d\n", i );
+ PRINT_EXTENT( loop->extent )
+ for ( cur = loop->segs; cur; cur = cur->next ) {
+ fprintf( stderr, "\n\tsegment: visibility = %s, direction = %d\n",
+ cur->vis ? "PON" : "POFF", cur->dir );
+ fprintf( stderr, "\tfirst = %d, last = %d, start = %d, end = %d\n",
+ cur->first, cur->last, cur->start, cur->end );
+ fprintf( stderr, "\t" );
+ PRINT_EXTENT( cur->extent )
+ for ( j = cur->first; j <= cur->last; j++ )
+ fprintf( stderr, "\t\t%3d: ( %10f, %10f)\n", j,
+ tdata->vertices[j].u, tdata->vertices[j].v );
+ }
+ }
+}
+#endif /* NDEBUG */
+
+
+
+/* Polygon Trimming Code */
+
+#define INACTIVE 0
+
+#define VISITED 4
+#define NEXT 2
+#define LAST 1
+
+#define EP_LIST_CHUNK 10 /* must be >= 5 */
+
+#define xin(_a,_b,_x) ((_x) >= (_a) && (_x) <= (_b))
+
+
+#define ROOM_IN_EP_LIST( _td ) \
+ ( (_td)->ep_index < (_td)->ep_list_size || !grow_ep_list(_td) )
+
+/*++
+ |
+ | Function Name: grow_ep_list
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+grow_ep_list( tdata )
+ Nurb_trim_data *tdata;
+{
+ /* TODO: Error reporting for failed allocations. */
+ tdata->ep_list_size += EP_LIST_CHUNK;
+ if ( tdata->ep_list_size == EP_LIST_CHUNK )
+ tdata->ep_list = (Nurb_edge_point *) xalloc(
+ EP_LIST_CHUNK * sizeof(Nurb_edge_point) );
+ else
+ tdata->ep_list = (Nurb_edge_point *) xrealloc( tdata->ep_list,
+ tdata->ep_list_size * sizeof(Nurb_edge_point) );
+
+ if ( !tdata->ep_list )
+ tdata->ep_list_size = 0;
+
+ return (tdata->ep_list ? Success : BadAlloc);
+}
+
+
+
+/*++
+ |
+ | Function Name: linear_interpolate
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+linear_interpolate( alpha, rat, normflag, a, b, out )
+ double alpha;
+ char rat;
+ unsigned normflag;
+ register Nurb_edge_point *a, *b, *out;
+{
+ out->pt.x = a->pt.x + (b->pt.x - a->pt.x) * alpha;
+ out->pt.y = a->pt.y + (b->pt.y - a->pt.y) * alpha;
+ out->pt.z = a->pt.z + (b->pt.z - a->pt.z) * alpha;
+ if ( rat )
+ out->pt.w = a->pt.w + (b->pt.w - a->pt.w) * alpha;
+ if ( normflag ) {
+ out->normal.x = a->normal.x + (b->normal.x - a->normal.x) * alpha;
+ out->normal.y = a->normal.y + (b->normal.y - a->normal.y) * alpha;
+ out->normal.z = a->normal.z + (b->normal.z - a->normal.z) * alpha;
+ }
+}
+
+/*++
+ |
+ | Function Name: bilinear
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+bilinear( alpha, beta, rat, normflag, a, b, c, d, out )
+ double alpha, beta;
+ char rat;
+ unsigned normflag;
+ Nurb_edge_point *a, *b, *c, *d;
+ Nurb_edge_point *out;
+{
+ Nurb_edge_point top, bot;
+
+ linear_interpolate( alpha, rat, normflag, a, b, &top );
+ linear_interpolate( alpha, rat, normflag, d, c, &bot );
+ linear_interpolate( beta, rat, normflag, &top, &bot, out );
+}
+
+
+
+/*++
+ |
+ | Function Name: append_pt
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+append_pt( tdata, normflag, rat, u, v, epa, epb, epc, epd )
+ Nurb_trim_data *tdata;
+ unsigned normflag;
+ char rat;
+ double u, v;
+ int epa, epb, epc, epd;
+{
+ double alpha, beta;
+ int status = BadAlloc;
+
+ register Nurb_edge_point *ep_list;
+ register Nurb_edge_point *cur_ep;
+
+ if ( ROOM_IN_EP_LIST(tdata) ) {
+ ep_list = tdata->ep_list;
+ cur_ep = &ep_list[tdata->ep_index];
+ cur_ep->u = u; cur_ep->v = v;
+ cur_ep->flags = 0;
+ alpha = (v - ep_list[epa].v) / (ep_list[epc].v - ep_list[epa].v);
+ beta = (u - ep_list[epa].u) / (ep_list[epc].u - ep_list[epa].u);
+ bilinear( alpha, beta, rat, normflag, &ep_list[epa], &ep_list[epb],
+ &ep_list[epc], &ep_list[epd], cur_ep );
+ cur_ep->branch = 0;
+ cur_ep->prev = tdata->ep_index - 1;
+ cur_ep->next = tdata->ep_index + 1;
+ ++tdata->ep_index;
+ status = Success;
+ }
+
+ return status;
+}
+
+
+
+/*++
+ |
+ | Function Name: insert_pt
+ |
+ | Function Description:
+ |
+ | This routine takes two indices into the
+ | Nurb_edge_point list, a point along one of the
+ | segment between the two edge points indicated
+ | by the two indices, and inserts a new edge
+ | point into the list corresponding to the
+ | supplied point.
+ |
+ | Inserting a new point means that the next and
+ | previous indices of the neighboring edge points are
+ | updated, and (x,y,z) and (if necessary) normal data
+ | is computed from the neighboring points for the new point.
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+insert_pt( tdata, normflag, rat, u, v, epa, epb, edge, branch )
+ Nurb_trim_data *tdata;
+ unsigned normflag;
+ char rat;
+ int epa, epb;
+ double u, v;
+ int edge, branch;
+{
+ double alpha;
+ int status = BadAlloc;
+
+ register int eptr;
+ register Nurb_edge_point *ep_list;
+ register Nurb_edge_point *cur_ep;
+
+ if ( ROOM_IN_EP_LIST(tdata) ) {
+ ep_list = tdata->ep_list;
+ cur_ep = &ep_list[tdata->ep_index];
+ cur_ep->u = u; cur_ep->v = v;
+ cur_ep->flags = 0;
+ switch ( edge ) {
+ case 0:
+ case 2:
+ alpha = (v - ep_list[epa].v)/(ep_list[epb].v - ep_list[epa].v);
+ break;
+ case 1:
+ case 3:
+ alpha = (u - ep_list[epa].u)/(ep_list[epb].u - ep_list[epa].u);
+ break;
+ default:
+ break;
+ }
+ linear_interpolate( alpha, rat, normflag, &ep_list[epa],
+ &ep_list[epb], cur_ep );
+ eptr = epa;
+ while ( eptr != epb ) {
+ double a, e, b;
+
+ switch ( edge ) {
+ case 0:
+ a = ep_list[eptr].v;
+ e = v;
+ b = ep_list[ep_list[eptr].next].v;
+ break;
+ case 1:
+ a = ep_list[eptr].u;
+ e = u;
+ b = ep_list[ep_list[eptr].next].u;
+ break;
+ case 2:
+ a = ep_list[ep_list[eptr].next].v;
+ e = v;
+ b = ep_list[eptr].v;
+ break;
+ case 3:
+ a = ep_list[ep_list[eptr].next].u;
+ e = u;
+ b = ep_list[eptr].u;
+ break;
+ default:
+ break;
+ }
+ if (xin(a, b, e) ) {
+ cur_ep->prev = eptr;
+ cur_ep->next = ep_list[eptr].next;
+ ep_list[ep_list[eptr].next].prev = tdata->ep_index;
+ ep_list[eptr].next = tdata->ep_index;
+ break; /* out of while */
+ }
+ eptr = ep_list[eptr].next;
+ }
+ cur_ep->branch = branch ? tdata->ep_index - 1 : tdata->ep_index + 1;
+ ++tdata->ep_index;
+ status = Success;
+ }
+
+ return status;
+}
+
+
+
+/*++
+ |
+ | Function Name: traverse
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+traverse( state, surface, output, ddSOFAS, el, winding )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ ddpex3rtn (*output)();
+ miSOFASStruct *ddSOFAS;
+ int el;
+ int winding;
+{
+ int inside, branch, forward;
+ int more = 1;
+ Nurb_facet_op start = NURB_NEW_FACET;
+
+ register int i, ep, epstart, ep_index;
+ register Nurb_edge_point *ep_list = state->trim_data.ep_list;
+
+ ep = epstart = el;
+ inside = winding & 1;
+ /* Preprocess to mark edges. */
+ do {
+ if ( ep_list[ep].branch ) {
+ ep_list[ep].flags = (inside) ? LAST : NEXT;
+ inside = !inside;
+ }
+ ep = ep_list[ep].next;
+ } while ( ep != epstart );
+
+ inside = winding & 1;
+ branch = 0;
+ forward = 1;
+ /* Currently ep = epstart = el. */;
+ do { /* for all loops */
+ if ( start != NURB_NEW_FACET )
+ start = NURB_NEW_CONTOUR;
+ do { /* for all points in loop */
+ ep_list[ep].flags |= VISITED;
+ if ( branch ) { /* when on a branch */
+ (*output)( state, surface, ddSOFAS, start, &ep_list[ep] );
+ start = NURB_SAME_CONTOUR;
+ if ( ep_list[ep].branch ) { /* branch hits edge */
+ branch = 0;
+ forward = (ep_list[ep].flags & NEXT);
+ ep = (forward) ? ep_list[ep].next : ep_list[ep].prev;
+ } else { /* continue along branch */
+ ep = (forward) ? ep_list[ep].next : ep_list[ep].prev;
+ }
+ } else { /* when on the u,v quad boundary */
+ if ( ep_list[ep].branch ) { /* edge hits branch */
+ (*output)( state, surface, ddSOFAS, start, &ep_list[ep] );
+ start = NURB_SAME_CONTOUR;
+ branch = 1;
+ if ( !inside ) {
+ inside = 1;
+ epstart = ep;
+ }
+ forward = (ep_list[ ep_list[ep].branch].prev == ep);
+ ep = ep_list[ep].branch;
+ } else { /* continue along edge */
+ if ( inside ) {
+ (*output)(state, surface, ddSOFAS, start, &ep_list[ep]);
+ start = NURB_SAME_CONTOUR;
+ }
+ ep = (forward) ? ep_list[ep].next : ep_list[ep].prev;
+ }
+ }
+ } while ( ep != epstart );
+ forward = 1;
+ branch = 0;
+ inside = 1;
+ if ( more ) {
+ do { /* find next edge start pt */
+ if ( !(ep_list[epstart].flags & VISITED) &&
+ (ep_list[epstart].flags & LAST) )
+ break;
+ else
+ epstart = ep_list[epstart].next;
+ } while ( more = epstart != el );
+ }
+ /* Find next inside start pt. */
+ if ( !more ) {
+ epstart = 0;
+ /* Note: the first ep_index starts at 5. */
+ ep_index = state->trim_data.ep_index;
+ for ( i = 5; i < ep_index; i++ ) {
+ if ( !(ep_list[i].flags & VISITED) )
+ epstart = i;
+ }
+ branch = 1;
+ }
+ } while ( ep = epstart );
+}
+
+
+
+/* NEXT_TRIM_POINT gets next trim_pt and assign a bit pattern = <l b r t >
+ *
+ * 1001 | 0001 | 0011 9 | 1 | 3
+ * -------------------- u0 ------------
+ * 1000 | 0000 | 0010 8 | 0 | 2
+ * -------------------- u1 ------------
+ * 1100 | 0100 | 0110 12 | 4 | 6
+ * v0 v1
+ */
+#define NEXT_TRIM_POINT( _idx, _ptrn, _u, _v ) \
+ { \
+ (_u) = trim_pts[_idx].u; (_v) = trim_pts[_idx].v; \
+ if ( (_u) < u0 ) \
+ (_ptrn) = (_v) < v0 ? 9 : (_v) <= v1 ? 1 : 3 ; \
+ else if ( (_u) <= u1 ) \
+ (_ptrn) = (_v) < v0 ? 8 : (_v) <= v1 ? 0 : 2 ; \
+ else \
+ (_ptrn) = (_v) < v0 ? 12 : (_v) <= v1 ? 4 : 6 ; \
+ }
+
+/* NOTE: These are different than the ones in the surface code. */
+#define LL 1
+#define LR 4
+#define UR 3
+#define UL 2
+
+#define INSERT_PT( _u, _v, _ea, _eb, _ed, _br ) \
+ ( insert_pt( tdata, state->reps.normals, \
+ rat, (_u), (_v), (_ea), (_eb), (_ed), (_br) ) )
+
+#define APPEND_PT( _u, _v, _ea, _eb, _ec, _ed ) \
+ ( append_pt( tdata, state->reps.normals, \
+ rat, (_u), (_v), (_ea), (_eb), (_ec), (_ed) ) )
+
+
+
+
+/*++
+ |
+ | Function Name: phg_nt_trim_rect
+ |
+ | Function Description:
+ |
+ | This routine takes as input a list of trim curves
+ | (each trim curve loop described as a linked list
+ | of tesselated line segments broken into montonic
+ | sections), and a rectangle in u,v space, and creates
+ | a SOFAS description of the intersection of the rectangle
+ | and the trim curve loops.
+ |
+ | Note(s):
+ |
+ --*/
+
+int
+phg_nt_trim_rect( state, surface, rect, output, ddSOFAS )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ Nurb_edge_point **rect;
+ ddpex3rtn (*output)();
+ miSOFASStruct *ddSOFAS;
+{
+ double u0, u1, v0, v1; /* rectangle in u,v space */
+ double itr;
+ double oldu, oldv, newu, newv;
+ int winding;
+ int old_out, new_out, tmp, index, first_pt;
+ Nurb_param_limit *ext;
+ char rat;
+
+ register int j;
+ register Nurb_trim_data *tdata = &state->trim_data;
+ register Nurb_edge_point *ep_list;
+ register Nurb_trim_segment *seg;
+ register Nurb_param_point *trim_pts = tdata->vertices;
+
+ /* Note that 3D implies homogeneous for trim curves */
+ rat = DD_IsVert3D(surface->points.type);
+
+ /* Make room for at least 4 points. */
+ if ( tdata->ep_list_size < 5 )
+ if ( grow_ep_list( tdata ) )
+ goto abort;
+
+ /* Copy the rectangle into ep_list[1,2,3,4] */
+ ep_list = tdata->ep_list;
+ for ( j = 1; j < 5; j++, rect++ ) {
+ ep_list[j].u = (*rect)->u;
+ ep_list[j].v = (*rect)->v;
+ ep_list[j].flags = 0;
+ ep_list[j].branch = 0;
+ ep_list[j].pt.x = (*rect)->pt.x;
+ ep_list[j].pt.y = (*rect)->pt.y;
+ ep_list[j].pt.z = (*rect)->pt.z;
+ if ( rat )
+ ep_list[j].pt.w = (*rect)->pt.w;
+ if ( state->reps.normals ) {
+ ep_list[j].normal.x = (*rect)->normal.x;
+ ep_list[j].normal.y = (*rect)->normal.y;
+ ep_list[j].normal.z = (*rect)->normal.z;
+ }
+ ep_list[j].next = j+1;
+ ep_list[j].prev = j-1;
+ }
+ /* Link the first and last elements */
+ ep_list[1].prev = 4;
+ ep_list[4].next = 1;
+ tdata->ep_index = 5; /* elements 1 to 4 used */
+
+ if ( tdata->nloops > 0 ) {
+ winding = 0;
+ u0 = ep_list[LL].u; v0 = ep_list[LL].v;
+ u1 = ep_list[UR].u; v1 = ep_list[UR].v;
+ } else
+ winding = 1; /* if no trim curves, default winding = 1 */
+
+ /* Intersect each trim loop against the rectangle bounds */
+ for ( j = 0; j < tdata->nloops ; j++ ) {
+
+ /* First, check against trim loop extent. */
+ if ( (tdata->loops[j].extent.umin > u1) ||
+ (tdata->loops[j].extent.umax < u0) ||
+ (tdata->loops[j].extent.vmin > v1) ||
+ (tdata->loops[j].extent.vmax < v0) )
+ /* Cannot intersect rectangle */
+ continue;
+
+ seg = tdata->loops[j].segs;
+ if ( seg ) { /* first point of the loop */
+ NEXT_TRIM_POINT( seg->start, new_out, newu, newv );
+ first_pt = new_out ? 0 : tdata->ep_index;
+ }
+ for ( ; seg; seg = seg->next ) {
+ if ( seg->start == 0 )
+ continue;
+ ext = &seg->extent;
+ if ( ext->umin > u1 || ext->vmin > v1 || ext->umax < u0 )
+ continue;
+ if ( ext->vmax < v0 ) {
+ if ( ext->umin < u0 && ext->umax >= u0 )
+ ++ winding;
+ continue;
+ }
+ index = seg->start;
+ NEXT_TRIM_POINT( index, new_out, newu, newv );
+ /* Note: first point is not inserted because trim_loop is closed */
+ while ( index != seg->end ) {
+ oldu = newu;
+ oldv = newv;
+ old_out = new_out;
+ ++index;
+ NEXT_TRIM_POINT( index, new_out, newu, newv );
+ if ( tmp = (new_out & old_out) ) { /* in same region */
+ if ( (tmp & 010)
+ && (newu < u0 && oldu >= u0 || newu >= u0 && oldu < u0))
+ ++ winding;
+ continue;
+ }
+ if ( old_out ) {
+ /* Intersects top edge between a and b? */
+ if ( (old_out & 01) && xin( v0, v1,
+ itr = oldv+(u0-oldu)*(newv-oldv)/(newu-oldu)) ) {
+ if ( INSERT_PT( u0, itr, LL, UL, 0, 0 ) )
+ goto abort;
+ } else {
+ if ( (old_out & 01) && itr < v0)
+ ++winding;
+ /* Intersects right edge between b and c? */
+ if ( (old_out & 02) && xin( u0, u1,
+ itr = oldu+(v1-oldv)*(newu-oldu)/(newv-oldv))){
+ if ( INSERT_PT(itr, v1, UL, UR, 1, 0) )
+ goto abort;
+ /* Intersects bottom edge between c and d? */
+ } else if ((old_out & 04) && xin(v0, v1,
+ itr = oldv+(u1-oldu)*(newv-oldv)/(newu-oldu))){
+ if ( INSERT_PT( u1, itr, UR, LR, 2, 0 ) )
+ goto abort;
+ /* intersects left edge between d and a? */
+ } else if ((old_out & 010) && xin( u0, u1,
+ itr = oldu+(v0-oldv)*(newu-oldu)/(newv-oldv))){
+ if ( INSERT_PT( itr, v0, LR, LL, 3, 0 ) )
+ goto abort;
+ }
+ }
+ }
+
+ if ( new_out == 0 ) {
+ if ( APPEND_PT( newu, newv, LL, UL, UR, LR ) )
+ goto abort;
+ } else {
+ /* Intersect top edge? */
+ if (( new_out & 01) && xin( v0, v1,
+ itr = oldv+(u0-oldu)*(newv-oldv)/(newu-oldu))) {
+ if ( INSERT_PT( u0, itr, LL, UL, 0, 1 ) )
+ goto abort;
+ } else {
+ if ( (new_out & 01) && itr < v0 )
+ ++winding;
+ /* Intersects right edge? */
+ if ( (new_out & 02) && xin( u0, u1,
+ itr = oldu+(v1-oldv)*(newu-oldu)/(newv-oldv))){
+ if ( INSERT_PT(itr, v1, UL, UR, 1, 1) )
+ goto abort;
+ /* Intersects bottom? */
+ } else if ( (new_out&04) && xin( v0, v1,
+ itr = oldv+(u1-oldu)*(newv-oldv)/(newu-oldu))){
+ if ( INSERT_PT(u1, itr, UR, LR, 2, 1) )
+ goto abort;
+ /* Intersects left edge? */
+ } else if ( (new_out & 010) && xin( u0, u1,
+ itr = oldu+(v0-oldv)*(newu-oldu)/(newv-oldv))){
+ if ( INSERT_PT(itr, v0, LR, LL, 3, 1) )
+ goto abort;
+ }
+ /* Left region? */
+ if ( (new_out & 010) && newu >= u0
+ && trim_pts[seg->end].u < u0 )
+ ++winding;
+ }
+ break; /* Skip remaining points in segment. */
+ }
+ } /* while ( not at end of segment ) */
+ } /* for all segments */
+
+ if ( first_pt ) {
+ index = tdata->ep_index - 1; /* back upto the last edge pt */
+ if ( tdata->ep_list[index].branch )
+ tdata->ep_list[index].branch = first_pt;
+ else
+ tdata->ep_list[index].next = first_pt;
+
+ if ( tdata->ep_list[first_pt].branch )
+ tdata->ep_list[first_pt].branch = index;
+ else
+ tdata->ep_list[first_pt].prev = index;
+ }
+ }
+
+ /* Traverse net and generate polygons. */
+ traverse( state, surface, output, ddSOFAS, LL, winding );
+
+ return Success;
+
+abort:
+ return BadAlloc;
+}
+
+
+
+#ifdef NDEBUG
+
+/*++
+ |
+ | Function Name: print_rect
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+print_rect( rat, rect )
+ char rat;
+ Nurb_edge_point **rect;
+{
+ fprintf( stderr, "\n" );
+ if ( rat ) {
+ fprintf( stderr, "LL: ( %f, %f) ==> ( %f, %f, %f, %f)\n",
+ rect[LL-1]->u, rect[LL-1]->v,
+ rect[LL-1]->pt.x, rect[LL-1]->pt.y, rect[LL-1]->pt.z,
+ rect[LL-1]->pt.w );
+ fprintf( stderr, "LR: ( %f, %f) ==> ( %f, %f, %f, %f)\n",
+ rect[LR-1]->u, rect[LR-1]->v,
+ rect[LR-1]->pt.x, rect[LR-1]->pt.y, rect[LR-1]->pt.z,
+ rect[LR-1]->pt.w );
+ fprintf( stderr, "UR: ( %f, %f) ==> ( %f, %f, %f, %f)\n",
+ rect[UR-1]->u, rect[UR-1]->v,
+ rect[UR-1]->pt.x, rect[UR-1]->pt.y, rect[UR-1]->pt.z,
+ rect[UR-1]->pt.w );
+ fprintf( stderr, "UL: ( %f, %f) ==> ( %f, %f, %f, %f)\n",
+ rect[UL-1]->u, rect[UL-1]->v,
+ rect[UL-1]->pt.x, rect[UL-1]->pt.y, rect[UL-1]->pt.z,
+ rect[UL-1]->pt.w );
+ } else {
+ fprintf( stderr, "LL: ( %f, %f) ==> ( %f, %f, %f)\n",
+ rect[LL-1]->u, rect[LL-1]->v,
+ rect[LL-1]->pt.x, rect[LL-1]->pt.y, rect[LL-1]->pt.z );
+ fprintf( stderr, "LR: ( %f, %f) ==> ( %f, %f, %f)\n",
+ rect[LR-1]->u, rect[LR-1]->v,
+ rect[LR-1]->pt.x, rect[LR-1]->pt.y, rect[LR-1]->pt.z );
+ fprintf( stderr, "UR: ( %f, %f) ==> ( %f, %f, %f)\n",
+ rect[UR-1]->u, rect[UR-1]->v,
+ rect[UR-1]->pt.x, rect[UR-1]->pt.y, rect[UR-1]->pt.z );
+ fprintf( stderr, "UL: ( %f, %f) ==> ( %f, %f, %f)\n",
+ rect[UL-1]->u, rect[UL-1]->v,
+ rect[UL-1]->pt.x, rect[UL-1]->pt.y, rect[UL-1]->pt.z );
+ }
+}
+#endif
+
+
+
+#define IN_SAME_REGION( _oca, _ocb ) ((_oca) & (_ocb))
+
+#define MORE_TRIM_POINTS( _s ) \
+ ((_s) && ((_s)->current != (_s)->last || (_s)->next))
+
+#define NEXT_POINT( _pts, _s, _p, _v ) \
+ { if ((_s)->current < 0) \
+ (_s)->current = (_s)->first; \
+ else if ((_s)->current != (_s)->last) \
+ ++(_s)->current; \
+ else { \
+ (_s) = (_s)->next; \
+ if ( (_s) ) \
+ (_s)->current = (_s)->first; \
+ } \
+ if ( _s ) { \
+ (_p).u = (_pts)[(_s)->current].u; \
+ (_p).v = (_pts)[(_s)->current].v; \
+ (_v) = (_s)->vis; \
+ } \
+ }
+
+/* Outcodes */
+#define IN 0
+#define OUT_TL 3
+#define OUT_TC 2
+#define OUT_TR 6
+#define OUT_CL 1
+#define OUT_CR 4
+#define OUT_BL 9
+#define OUT_BC 8
+#define OUT_BR 12
+
+#define LEFT OUT_CL
+#define RIGHT OUT_CR
+#define TOP OUT_TC
+#define BOTTOM OUT_BC
+
+#define OUTCODE( _e, _p, _c ) \
+ { if ( (_p).u < (_e).umin ) \
+ (_c) = (_p).v < (_e).vmin ? OUT_BL : \
+ (_p).v <= (_e).vmax ? OUT_CL : OUT_TL; \
+ else if ( (_p).u <= (_e).umax ) \
+ (_c) = (_p).v < (_e).vmin ? OUT_BC : \
+ (_p).v <= (_e).vmax ? IN : OUT_TC; \
+ else \
+ (_c) = (_p).v < (_e).vmin ? OUT_BR : \
+ (_p).v <= (_e).vmax ? OUT_CR : OUT_TR; \
+ }
+
+#define ADJACENT_RECT( _g, _e, _r ) \
+ switch ( _e ) { \
+ case LEFT: \
+ --(_r)[LL]; --(_r)[LR]; --(_r)[UL]; --(_r)[UR]; \
+ break; \
+ case RIGHT: \
+ ++(_r)[LL]; ++(_r)[LR]; ++(_r)[UL]; ++(_r)[UR]; \
+ break; \
+ case TOP: \
+ (_r)[LL]+=(_g)->nu; (_r)[LR]+=(_g)->nu; \
+ (_r)[UL]+=(_g)->nu; (_r)[UR]+=(_g)->nu; \
+ break; \
+ case BOTTOM: \
+ (_r)[LL]-=(_g)->nu; (_r)[LR]-=(_g)->nu; \
+ (_r)[UL]-=(_g)->nu; (_r)[UR]-=(_g)->nu; \
+ break; \
+ }
+
+#define RECT_EXTENT( _r, _e ) \
+ { \
+ (_e).umin = (_r)[LL]->u; (_e).umax = (_r)[UR]->u; \
+ (_e).vmin = (_r)[LL]->v; (_e).vmax = (_r)[UR]->v; \
+ }
+
+#define AT_EDGE( _g, _e, _p ) \
+ ( ((_e) & LEFT && (_p).u <= (_g)->extent.umin) \
+ || ((_e) & RIGHT && (_p).u >= (_g)->extent.umax) \
+ || ((_e) & BOTTOM && (_p).v <= (_g)->extent.vmin) \
+ || ((_e) & TOP && (_p).v >= (_g)->extent.vmax))
+
+
+/*++
+ |
+ | Function Name: intersect
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+intersect( ext, old_out, new_out, old, new, inter )
+ Nurb_param_limit *ext;
+ unsigned old_out, new_out;
+ Nurb_param_point *old, *new, *inter;
+{
+ double t;
+ int edge;
+
+ if ( ((old_out == IN && new_out & OUT_CL) || (old_out & OUT_CL))
+ && xin( ext->vmin, ext->vmax,
+ t = old->v + (ext->umin-old->u) * (new->v-old->v)/(new->u-old->u))){
+ inter->u = ext->umin;
+ inter->v = t;
+ edge = LEFT;
+ } else if ( ((old_out == IN && new_out & OUT_TC) || (old_out & OUT_TC))
+ && xin( ext->umin, ext->umax,
+ t = old->u + (ext->vmax-old->v) * (new->u-old->u)/(new->v-old->v))){
+ inter->u = t;
+ inter->v = ext->vmax;
+ edge = TOP;
+ } else if ( ((old_out == IN && new_out & OUT_CR) || (old_out & OUT_CR))
+ && xin( ext->vmin, ext->vmax,
+ t = old->v + (ext->umax-old->u) * (new->v-old->v)/(new->u-old->u))){
+ inter->u = ext->umax;
+ inter->v = t;
+ edge = RIGHT;
+ } else if ( ((old_out == IN && new_out & OUT_BC) || (old_out & OUT_BC))
+ && xin( ext->umin, ext->umax,
+ t = old->u + (ext->vmin-old->v) * (new->u-old->u)/(new->v-old->v))){
+ inter->u = t;
+ inter->v = ext->vmin;
+ edge = BOTTOM;
+ } else
+ edge = 0;
+
+ return edge;
+}
+
+
+
+/*++
+ |
+ | Function Name: find_containing_rect
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+find_containing_rect( pt, grid, rect )
+ register Nurb_param_point *pt;
+ register Nurb_grid *grid;
+ Nurb_edge_point *rect[5];
+{
+ register Nurb_edge_point *gpt = &grid->pts[grid->nu+1];
+
+ for ( ; gpt->u < pt->u; gpt++ )
+ ;
+ for ( ; gpt->v < pt->v; gpt += grid->nu )
+ ;
+ rect[UR] = gpt;
+ rect[UL] = gpt - 1;
+ rect[LL] = rect[UL] - grid->nu;
+ rect[LR] = rect[UR] - grid->nu;
+}
+
+
+
+/*++
+ |
+ | Function Name: add_point
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+add_point( state, surface, vert_list, op, pt, edge, rect )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ miListHeader *vert_list;
+ Nurb_path_op op;
+ Nurb_param_point *pt;
+ int edge;
+ Nurb_edge_point *rect[5];
+{
+ Nurb_edge_point new, *pa, *pb;
+ double alpha, beta;
+ char rat;
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ new.u = pt->u; new.v = pt->v;
+ if ( edge ) {
+ switch ( edge ) {
+ case LEFT:
+ alpha = (pt->v - rect[LL]->v)/(rect[UL]->v - rect[LL]->v);
+ pa = rect[LL]; pb = rect[UL];
+ break;
+ case RIGHT:
+ alpha = (pt->v - rect[LR]->v)/(rect[UR]->v - rect[LR]->v);
+ pa = rect[LR]; pb = rect[UR];
+ break;
+ case TOP:
+ alpha = (pt->u - rect[UL]->u)/(rect[UR]->u - rect[UL]->u);
+ pa = rect[UL]; pb = rect[UR];
+ break;
+ case BOTTOM:
+ alpha = (pt->u - rect[LL]->u)/(rect[LR]->u - rect[LL]->u);
+ pa = rect[LL]; pb = rect[LR];
+ break;
+ }
+ linear_interpolate( alpha, rat, 0, pa, pb, &new );
+ } else {
+ alpha = (pt->v - rect[LL]->v)/(rect[UR]->v - rect[LL]->v);
+ beta = (pt->u - rect[LL]->u)/(rect[UR]->u - rect[LL]->u);
+ bilinear( alpha, beta, rat, 0, rect[LL], rect[UL],
+ rect[UR], rect[LR], &new );
+ }
+
+ ADD_POINT_TO_LIST( vert_list, rat, op, &new.pt );
+
+}
+
+
+
+#define NPATH_OP( _o, _n ) \
+ ((_o) ? ((_n) ? PT_LINE : PT_NOP) : ((_n) ? PT_MOVE : PT_NOP))
+
+/*++
+ |
+ | Function Name: follow_segs
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static Nurb_trim_segment *
+follow_segs(state, surface, grid, tpts, seg, vert_list, start_pt,use_edge_flags)
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ Nurb_grid *grid;
+ Nurb_param_point *tpts;
+ Nurb_trim_segment *seg;
+ miListHeader *vert_list;
+ Nurb_param_point *start_pt;
+ int use_edge_flags;
+{
+ Nurb_edge_point *rect[5];
+ Nurb_param_limit extent;
+ unsigned old_out, new_out;
+ Nurb_param_point old, new;
+ int edge, done = 0;
+ ddULONG new_vis, old_vis;
+ Nurb_path_op op;
+
+ find_containing_rect( start_pt, grid, rect );
+
+ RECT_EXTENT( rect, extent )
+
+ op = use_edge_flags ? NPATH_OP( 0, seg->vis ) : PT_MOVE;
+ if ( op != PT_NOP )
+ add_point( state, surface, vert_list, op, start_pt, 0, rect );
+
+ old = *start_pt;
+ old_vis = seg->vis;
+ NEXT_POINT( tpts, seg, new, new_vis )
+ op = use_edge_flags ? NPATH_OP( old_vis, new_vis ) : PT_LINE;
+ while ( !done ) {
+ OUTCODE( extent, new, new_out )
+ if ( new_out == IN ) {
+ if ( op != PT_NOP )
+ add_point( state, surface, vert_list, op, &new, 0, rect );
+ old = new; old_vis = new_vis;
+ if ( MORE_TRIM_POINTS(seg) ) {
+ NEXT_POINT( tpts, seg, new, new_vis )
+ if ( use_edge_flags )
+ op = NPATH_OP( old_vis, new_vis );
+ } else
+ done = 1;
+ } else {
+ OUTCODE( extent, old, old_out )
+ edge = intersect( &extent, old_out, new_out, &old, &new, &old );
+ if ( op != PT_NOP )
+ add_point( state, surface, vert_list, op, &old, edge, rect );
+ if ( !AT_EDGE( grid, edge, old ) ) {
+ ADJACENT_RECT( grid, edge, rect )
+ RECT_EXTENT( rect, extent )
+ } else /* hit an edge of the grid */
+ done = 1;
+ }
+ }
+
+ /* Segments are monotonic so we're done with this one when an
+ * edge is hit.
+ */
+ seg = seg->next;
+ if ( seg )
+ seg->current = -1;
+ return seg;
+}
+
+
+
+/*++
+ |
+ | Function Name: phg_nt_draw_segs
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+int
+phg_nt_draw_segs( state, surface, grid, seg, spts, use_edge_flags, vert_list )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ Nurb_grid *grid;
+ register Nurb_trim_segment *seg;
+ Nurb_param_point *spts;
+ int use_edge_flags;
+ miListHeader *vert_list;
+{
+ unsigned old_out, new_out;
+ Nurb_param_point old, new;
+ Nurb_param_limit *ext;
+ ddULONG vis;
+
+ ext = &grid->extent;
+ seg->current = -1;
+ old_out = IN;
+ for ( ; MORE_TRIM_POINTS(seg); old = new, old_out = new_out ) {
+ NEXT_POINT( spts, seg, new, vis )
+ OUTCODE( *ext, new, new_out )
+ if ( new_out == IN ) {
+ if ( old_out ) {
+ (void)intersect( ext, old_out, new_out, &old, &new, &new );
+ }
+ --seg->current;
+ seg = follow_segs( state, surface, grid, spts, seg, vert_list,
+ &new, use_edge_flags );
+ old_out = IN;
+ continue;
+ } else if ( old_out ) {
+ if ( IN_SAME_REGION(old_out, new_out) )
+ continue;
+ if ( intersect( ext, old_out, new_out, &old, &new, &new )) {
+ --seg->current;
+ seg = follow_segs( state, surface, grid, spts, seg, vert_list,
+ &new, use_edge_flags );
+ old_out = IN;
+ continue;
+ }
+ }
+ }
+}
+
+#define WS_NTRM_BOTTOM
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c
new file mode 100644
index 000000000..06da5fb96
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c
@@ -0,0 +1,2466 @@
+/* $TOG: miNSurf.c /main/11 1998/02/10 12:41:53 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c,v 3.6 1998/10/04 09:34:23 dawes Exp $ */
+
+#define TRIMING 1
+
+#include <math.h>
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miNurbs.h"
+#include "pexos.h"
+
+
+static ddpex3rtn build_surf_reps();
+static int add_grid();
+static int uniform_isocurves();
+static int nonuniform_isocurves();
+static void nurb_surf_state_free();
+static ddpex3rtn compute_adaptive_surf_interval();
+static void determine_reps_required();
+static ddpex3rtn compute_nurb_surface();
+static ddpex3rtn build_facets();
+static ddpex3rtn build_control_polygon();
+static ddpex3rtn build_surf_markers();
+static ddpex3rtn span_grids();
+static void compute_edge_point_normals();
+static void build_edge_reps();
+static void make_edge_segments();
+static void span_evaluation_points();
+#ifdef TRIMING
+static ddpex3rtn add_pgon_point();
+#endif
+
+
+/*
+ * This convention is established in the trimming code.
+ * Note that it's clockwise from lower left.
+ */
+#define LL 0
+#define LR 3
+#define UR 2
+#define UL 1
+
+#define xin(_a,_b,_x) ((_x) >= (_a) && (_x) <= (_b))
+
+/*++
+ |
+ | Function Name: miNurbsSurface
+ |
+ | Function Description:
+ | Handles the Nurbs Surface Pex OC.
+ |
+ | Rendering a surface path is a 4 step process in this
+ | implementation.
+ |
+ | The first step is to determine the proper parametric step
+ | size according to the specified surface tolerance. Note
+ | that tesselation is performed in Model Coordinates in this
+ | implementation. However, surface tolerances are specified
+ | in one of WC, NPC, or DC. Thus the control points are tranformed
+ | in a temporary buffer into the specified space for determination
+ | of the maximum parametric step size.
+ |
+ | Once this step size is determined, a series of grid descriptions
+ | are created - one grid per knot interval. In other words,
+ | each grid describes the area specified by the four knot pairs
+ | (u,v), (u+1,v), (u,v+1), (u+1,v+1). These grids are then
+ | subdivided according to the u,v step size computed above
+ | and the (x,y,z,w) coordinates corresponding to each of the
+ | (u,v) steps computed. The result of this operation is a linked
+ | list of (u,v) (x,y,z,w) pairs for each span in the surface.
+ |
+ | The third step in the process is to trim this surface according
+ | to the supplied trim curve bounds. NEED MORE TEXT HERE.
+ |
+ | The fourth and last step in the procedure is to convert
+ | the (potentially trimmed) grid description od the surface
+ | into miListHeader point lists that can be used by the
+ | rest of the system. Note that no "direct" rendering is performed
+ | by this routine. Rather, the data that resulted from the
+ | previous steps are converted into one of the other primitive
+ | in the system (ie SOFAS, quad mesh, polyline, etc...) and
+ | rendered by one of these routines.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miNurbsSurface(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+ ddpex3rtn build_surf_reps();
+ extern ocTableType InitExecuteOCTable[];
+
+/* Local variable definitions */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miNurbSurfaceStruct *ddSurface = (miNurbSurfaceStruct *)(pExecuteOC+1);
+ miListHeader *input_list = &ddSurface->points;
+ miListHeader *listheader;
+ Nurb_surf_state surface_state;
+ miGenericStr *pGStr;
+ miMarkerStruct *ddMarker;
+ miPolylineStruct *ddPolyline;
+ miFillAreaStruct *ddFillArea;
+ Nurb_grid *grid;
+ miQuadMeshStruct *ddQuad;
+ miSOFASStruct *ddSOFAS;
+ listofddFacet facet_list;
+ ddUSHORT save_edges;
+ ddEnumTypeIndex save_intStyle;
+ int num_points;
+ int i, j;
+ ddpex3rtn status = Success;
+
+
+
+ switch(pddc->Static.attrs->surfApprox.approxMethod) {
+
+ case PEXApproxImpDep:
+ case PEXApproxConstantBetweenKnots:
+ case PEXApproxDcChordalSize:
+ case PEXSurfaceApproxDcPlanarDev:
+ case PEXApproxDcRelative:
+ default:
+
+ case PEXApproxWcsChordalSize:
+ case PEXSurfaceApproxWcsPlanarDev:
+ case PEXApproxWcsRelative:
+
+ /* Transform to WC prior to tesselation */
+ /* tesselate surface into facets */
+ if (status = build_surf_reps( pddc, ddSurface, &surface_state,
+ pddc->Dynamic->mc_to_wc_xform ))
+ goto exit;
+
+ break;
+
+
+ case PEXApproxNpcChordalSize:
+ case PEXSurfaceApproxNpcPlanarDev:
+ case PEXApproxNpcRelative:
+
+ /* tesselate surface into facets */
+ if (status = build_surf_reps( pddc, ddSurface, &surface_state,
+ pddc->Dynamic->mc_to_npc_xform ))
+ goto exit;
+
+ break;
+ }
+
+
+ /*
+ * render the computed structures.
+ *
+ * Note that the final structure can be rendered in many ways
+ * according to the surface data and rendering attributes.
+ * the surface_state.reps structure contains flags to indicate
+ * the data created during the tesselation process.
+ */
+ if ( surface_state.reps.markers ) {
+
+ /* allocate polyline command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miMarkerStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCMarker;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddMarker = (miMarkerStruct *) (pGStr + 1);
+ *ddMarker = *((miMarkerStruct *)(surface_state.markers));
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ xfree(pGStr);
+
+ } else {
+
+ if ( surface_state.reps.facets ) {
+
+ /* Don't draw edges here - they are drawn seperately */
+ save_edges = pddc->Static.attrs->edges;
+ pddc->Static.attrs->edges = PEXOff;
+
+ if ( ddSurface->numTrimCurveLists <= 0 ) {
+ /*
+ * If no trimming, then each tesselated surface
+ * is described by a number of grids, each grid containing
+ * a single quad mesh. Therefore, loop through the
+ * grid list in the surface state, and call quad mesh
+ * for each grid.
+ */
+
+ /* allocate polyline command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miQuadMeshStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCQuadrilateralMesh;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddQuad = (miQuadMeshStruct *) (pGStr + 1);
+
+ /* Initialize quad mesh structure */
+ /*** ddQuad->shape = ***/
+
+ facet_list.numFacets = 0;
+ facet_list.type = DD_FACET_NONE;
+ facet_list.facets.pNoFacet = NULL;
+ facet_list.maxData = 0;
+ ddQuad->pFacets = &facet_list;
+
+ grid = surface_state.grids.grids;
+ listheader = surface_state.facets;
+
+ for (i = 0; i < surface_state.grids.number; i++) {
+
+ ddQuad->mPts = grid->nu;
+ ddQuad->nPts = (grid++)->nv;
+ ddQuad->points = *(listheader++);
+
+ if(status=InitExecuteOCTable[(int)(pGStr->elementType)](pRend,pGStr))
+ break;
+
+ }
+
+ } else {
+ /*
+ * If trimming is enabled, then SOFAS are output from
+ * the tesselation code.
+ * The SOFAS structure is already built, so just call the
+ * SOFAS routine.
+ */
+
+ /* allocate polyline command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miSOFASStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCSOFAS;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddSOFAS = (miSOFASStruct *) (pGStr + 1);
+ *ddSOFAS = *((miSOFASStruct *)(surface_state.sofas));
+
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ }
+
+ xfree(pGStr);
+ /* restore edge flag */
+ pddc->Static.attrs->edges = save_edges;
+
+ } else if ( surface_state.reps.hollow ) {
+
+ /* allocate fill area command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miFillAreaStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCFillAreaSet;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddFillArea = (miFillAreaStruct *) (pGStr + 1);
+ ddFillArea->shape = PEXUnknownShape;
+ ddFillArea->ignoreEdges = PEXOn;
+ ddFillArea->contourHint = PEXUnknownContour;
+ facet_list.numFacets = 0;
+ facet_list.type = DD_FACET_NONE;
+ facet_list.facets.pNoFacet = NULL;
+ facet_list.maxData = 0;
+ ddFillArea->pFacets = &facet_list;
+ ddFillArea->points = *(surface_state.hollow);
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ xfree(pGStr);
+
+ }
+
+ if ( surface_state.reps.isocrvs ) {
+
+ /* allocate polyline command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miPolylineStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCPolylineSet;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddPolyline = (miPolylineStruct *) (pGStr + 1);
+ *ddPolyline = *((miPolylineStruct *)(surface_state.isocrvs));
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ xfree(pGStr);
+
+ }
+
+ if ( surface_state.reps.edges ) {
+
+ /* set edge flag and interior style such that only edges are drawn */
+ save_edges = pddc->Static.attrs->edges;
+ pddc->Static.attrs->edges = PEXOn;
+
+ save_intStyle = pddc->Static.attrs->intStyle;
+ pddc->Static.attrs->intStyle = PEXInteriorStyleEmpty;
+
+ /* allocate fill area command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miFillAreaStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ pGStr->elementType = PEXOCFillAreaSet;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddFillArea = (miFillAreaStruct *) (pGStr + 1);
+ ddFillArea->shape = PEXUnknownShape;
+ ddFillArea->ignoreEdges = PEXOff;
+ ddFillArea->contourHint = PEXUnknownContour;
+ facet_list.numFacets = 0;
+ facet_list.type = DD_FACET_NONE;
+ facet_list.facets.pNoFacet = NULL;
+ facet_list.maxData = 0;
+ ddFillArea->pFacets = &facet_list;
+ ddFillArea->points = *(surface_state.edges);
+ status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr);
+
+ xfree(pGStr);
+
+ /* restore edge flag */
+ pddc->Static.attrs->edges = save_edges;
+ /* restore interior style */
+ pddc->Static.attrs->intStyle = save_intStyle;
+
+ }
+ }
+
+exit:
+
+ /* free all temporary storage */
+ nurb_surf_state_free(&surface_state);
+
+ return (status);
+
+}
+
+
+
+#define ANY_REP_NEEDED(_st) \
+ ( (_st)->reps.edges || (_st)->reps.facets || (_st)->reps.isocrvs \
+ || (_st)->reps.markers || (_st)->reps.hollow )
+
+#define NEED_NORMALS(_st) ( (_st)->reps.facets )
+
+/*++
+ |
+ | Function Name: build_surf_reps
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+ddpex3rtn
+build_surf_reps( pddc, surface, state, trans )
+ miDDContext *pddc;
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+ ddFLOAT trans[4][4];
+{
+ /* uses */
+ ddpex3rtn status = Success; /* assume success */
+
+ if ( surface->mPts <= 0 || surface->nPts <= 0 )
+ return 0;
+
+ NURB_SURF_STATE_INIT(state);
+
+ switch ( pddc->Static.attrs->surfApprox.approxMethod ) {
+ case PEXApproxConstantBetweenKnots:
+ case PEXApproxImpDep:
+ default:
+ state->approx_type = PEXApproxConstantBetweenKnots;
+ state->approx_value[0] =
+ MAX((int)pddc->Static.attrs->surfApprox.uTolerance,0);
+ state->approx_value[1] =
+ MAX((int)pddc->Static.attrs->surfApprox.vTolerance,0);
+ break;
+
+ case PEXApproxWcsChordalSize:
+ case PEXApproxNpcChordalSize:
+ case PEXSurfaceApproxWcsPlanarDev:
+ case PEXSurfaceApproxNpcPlanarDev:
+ case PEXApproxWcsRelative:
+ case PEXApproxNpcRelative:
+ /* The same approximation method is used for all these
+ * approximation types, and it's not exactly any of them.
+ * But the method used serves the same purpose and
+ * PHIGS PLUS allows us to approximate the defined methods.
+ */
+ state->approx_type = PEXApproxConstantBetweenKnots;
+ compute_adaptive_surf_interval( pddc, surface, state, trans );
+ break;
+ }
+
+ determine_reps_required( pddc, surface, state );
+
+ if ( ANY_REP_NEEDED(state) ) {
+ status = compute_nurb_surface( pddc, surface, state );
+ }
+
+ return ( status );
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_adaptive_surf_interval
+ |
+ | Function Description:
+ |
+ | This routine computes the number of steps that must
+ | be taken in the u & v directions. Note that although
+ | the actual tesselation takes place in model coordinates
+ | (to ease integration with the remainder of the rendering code),
+ | the control points must be transformed here to the
+ | space specified by the curve approximation criteria
+ | to guarantee the proper number of steps are computed.
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+ddpex3rtn
+compute_adaptive_surf_interval( pddc, surface, state, trans )
+ miDDContext *pddc;
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+ ddFLOAT trans[4][4];
+{
+/* uses */
+ ddFLOAT uval, vval, a_coeff, b_coeff, c_coeff, denom,
+ z1, z2, z3;
+ ddCoord4D p;
+ double perp_d, max_u_perp_d = 0.0, max_v_perp_d = 0.0;
+
+ int i, j, use_z_coord = 0;
+ int nu = surface->mPts;
+ int nv = surface->nPts;
+ ddCoord4D *upper, *lower, *middle, *pa, *pb, *pc, *coord_buf;
+ char *ctlpts, *pin;
+ double w;
+ miListHeader *input = &surface->points;
+ char rat;
+ int point_size;
+ ddPointType out_type;
+ ddpex3rtn status;
+
+ /*
+ * Compute the constant parametric between knots interval needed to
+ * come close to meeting the specified approximation criteria. The
+ * method used is a gross compromise for the adaptive approximation
+ * criteria, but fulfills the basic need for an adaptive approximation
+ * method.
+ * Note that for the NPC approximation criteria NPC isn't even the space
+ * being used, it's clipping space, which is [-1,1], [-1,1], [0,1].
+ * The Z component is ignored in this case though since the Z dimension
+ * is perpendicular to the screen.
+ */
+ state->approx_value[0] = 0.0;
+ state->approx_value[1] = 0.0;
+ switch ( pddc->Static.attrs->surfApprox.approxMethod ) {
+ case PEXApproxNpcChordalSize:
+ case PEXSurfaceApproxNpcPlanarDev:
+ use_z_coord = 0;
+ break;
+ case PEXApproxWcsChordalSize:
+ case PEXSurfaceApproxWcsPlanarDev:
+ use_z_coord = 1;
+ break;
+ }
+
+ /*
+ * transform comtrol points into space specified by
+ * approximation tolerance
+ */
+ if ( trans ) {
+ miListHeader *temp;
+
+ /* Transform to WC prior to applying lighting */
+ out_type = input->type;
+ if (status = miTransform( pddc, input, &temp,
+ trans, NULL4x4, DD_SetVert4D(out_type)))
+ return (status);
+ input = temp;
+ }
+
+ rat = DD_IsVert4D(input->type);
+ ctlpts = input->ddList->pts.ptr;
+ DD_VertPointSize(input->type, point_size);
+
+
+ /* Allocate temporary control point store */
+ if (!(coord_buf = (ddCoord4D *)xalloc(3 * nu * sizeof(ddCoord4D))))
+ return(BadAlloc);
+
+ /*
+ * For the above approx. types, the approx. value is the max. allowable
+ * distance between the actual surface and the generated segments.
+ * The distance of the ctrl point from the line joining the ctrl pts on
+ * either side of it is calculated for every ctrl pt. This is calculated
+ * in 2D. For approx. in WC, the 3D length is got from the 2D-length
+ * and the z values of the ctrl pts. The max of all these lengths is
+ * found. This is repeated for all the ctrl pts in the u and v directions.
+ * The final approx. value is obtd. from the ratio of the max length
+ * and the required approx. value.
+ */
+
+ upper = coord_buf; middle = coord_buf + nu; lower = coord_buf + 2*nu;
+ for ( j = 0; j < nv-1; j++, ctlpts += nu*point_size ) {
+
+ /*
+ * project the points from homogeneous space.
+ */
+ if ( rat ) {
+ for ( i = 0, pin = ctlpts, pa = lower;
+ i < nu;
+ i++, pa++, pin += point_size ) {
+ if (((ddCoord4D *)pin)->w == 1.0) *pa = *((ddCoord4D *)pin);
+ else {
+ w = 1.0 / ((ddCoord4D *)pin)->w;
+ pa->x = ((ddCoord4D *)pin)->x * w;
+ pa->y = ((ddCoord4D *)pin)->y * w;
+ if ( use_z_coord ) pa->z = ((ddCoord4D *)pin)->z * w;
+ }
+ }
+ } else {
+ for ( i = 0, pin = ctlpts, pa = lower;
+ i < nu;
+ i++, pa++, pin += point_size ) {
+ memcpy( (char *)pa, pin, point_size);
+ pa->w = 1.0;
+ }
+ }
+
+ /* Find the required u interval between points of this row. */
+ pa = lower; pb = pa + 2, pc = pa + 1;
+ for ( i = 1; i < nu-1; i++, pa++, pb++,pc++) {
+ a_coeff = pb->y - pa->y;
+ b_coeff = pa->x - pb->x;
+ c_coeff = pb->x * pa->y - pa->x * pb->y;
+ denom = ( a_coeff * a_coeff + b_coeff * b_coeff );
+ perp_d = (a_coeff * pc->x + b_coeff * pc->y + c_coeff);
+ if ( use_z_coord ) {
+ z1 = pc->z;
+ z2 = (pa->z + pb->z) /2.0;
+ z3 = z1-z2;
+ perp_d = sqrt( (perp_d * perp_d + z3 * z3 * denom) /denom );
+ } else {
+ perp_d = perp_d/ (sqrt(denom));
+ }
+ perp_d = fabs(perp_d);
+ if ( perp_d > max_u_perp_d )
+ max_u_perp_d = perp_d;
+ }
+
+ if ( j > 1 ) {
+ /* Find the required v interval between these two rows. */
+ pa = upper; pb = lower, pc = middle;
+ for ( i = 0; i < nu; i++, pa++, pb++, pc++ ) {
+ a_coeff = pb->y - pa->y;
+ b_coeff = pa->x - pb->x;
+ c_coeff = pb->x * pa->y - pa->x * pb->y;
+ denom = ( a_coeff * a_coeff + b_coeff * b_coeff );
+ perp_d = (a_coeff * pc->x + b_coeff * pc->y + c_coeff);
+ if ( use_z_coord ) {
+ z1 = pc->z;
+ z2 = (pa->z + pb->z) /2.0;
+ z3 = z1-z2;
+ perp_d = sqrt( (perp_d * perp_d + z3 * z3 * denom) /denom );
+ } else {
+ perp_d = perp_d/ (sqrt(denom));
+ }
+ perp_d = fabs(perp_d);
+ if ( perp_d > max_v_perp_d )
+ max_v_perp_d = perp_d;
+ }
+ }
+
+ /* Swap row pointers so that next row is the "lower" row. */
+ pa = upper;
+ upper = middle;
+ middle = lower;
+ lower = pa;
+ }
+
+ switch ( pddc->Static.attrs->surfApprox.approxMethod ) {
+ case PEXApproxWcsChordalSize:
+ case PEXApproxNpcChordalSize:
+ uval = pddc->Static.attrs->surfApprox.uTolerance;
+ vval = pddc->Static.attrs->surfApprox.vTolerance;
+ break;
+ case PEXSurfaceApproxWcsPlanarDev:
+ case PEXSurfaceApproxNpcPlanarDev:
+ uval = pddc->Static.attrs->surfApprox.uTolerance;
+ vval = pddc->Static.attrs->surfApprox.uTolerance;
+ break;
+ }
+ state->approx_value[0] = (int)( 1 + sqrt(10*max_u_perp_d
+ / (uval > 0.0 ? uval : 0.01)));
+ state->approx_value[1] = (int)( 1 + sqrt(10*max_v_perp_d
+ / (vval > 0.0 ? vval : 0.01)));
+
+ xfree(coord_buf);
+
+ return(Success);
+}
+
+
+
+/*++
+ |
+ | Function Name: determine_reps_required
+ |
+ | Function Description:
+ |
+ | This routine selects the format of the data
+ | created for rendering the speecified surface patch.
+ | Different data descriptions are generated according
+ | to both the surface data and the current rendering
+ | attributes. For example, quad mesh data is created
+ | to describe an un-trimmed solid surface; polyline
+ | data, however, is created if surface iso-curves
+ | are enabled.
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+determine_reps_required( pddc, surface, state )
+ miDDContext *pddc;
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+{
+ if ( surface->uOrder <= 1 && surface->vOrder <= 1 ) {
+ state->reps.markers = 1;
+
+ } else if ( (surface->uOrder > MAXORD) || (surface->vOrder > MAXORD) ) {
+ /* Order is not supported; just draw the control net. */
+ state->reps.isocrvs = 1;
+ state->isocount[0] = 1;
+ state->isocount[1] = 1;
+
+ } else {
+
+ /*
+ * First evaluate interior style
+ */
+ switch ( pddc->Static.attrs->intStyle ) {
+ case PEXInteriorStyleSolid:
+ state->reps.facets = 1;
+ /* Only compute normals if lighting enabled */
+ if (pddc->Static.attrs->reflModel != PEXReflectionNoShading)
+ state->reps.normals = 1;
+ break;
+ case PEXInteriorStyleHollow:
+ state->reps.hollow = 1;
+ break;
+ case PEXInteriorStylePattern:
+ case PEXInteriorStyleHatch:
+ state->reps.facets = 1;
+ /* Only compute normals if lighting enabled */
+ if (pddc->Static.attrs->reflModel != PEXReflectionNoShading)
+ state->reps.normals = 1;
+ break;
+ case PEXInteriorStyleEmpty:
+ /* No addtional action required. */
+ break;
+ }
+
+ /*
+ * Next, parametric surface characteristics.
+ */
+ switch ( pddc->Dynamic->pPCAttr->psc.type ) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+ case PEXPSCIsoCurves:
+ state->reps.isocrvs = 1;
+ /* Negative curve counts mean no curves between knots. */
+ state->isocount[0] =
+ MAX(pddc->Dynamic->pPCAttr->psc.data.isoCurves.numUcurves,0);
+ state->isocount[1] =
+ MAX(pddc->Dynamic->pPCAttr->psc.data.isoCurves.numVcurves,0);
+ break;
+ case PEXPSCMcLevelCurves:
+ case PEXPSCWcLevelCurves:
+ /* Note that level curves are not implemented */
+ break;
+ }
+
+ if ( pddc->Static.attrs->edges == PEXOn )
+ state->reps.edges = 1;
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_nurb_surface
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+ddpex3rtn
+compute_nurb_surface( pddc, surface, state )
+ miDDContext *pddc;
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+{
+
+/* calls */
+#ifdef TRIMING
+ ddpex3rtn phg_nt_install_trim_loops();
+#endif
+
+/* uses */
+ ddpex3rtn status = Success;
+ int i;
+
+ state->range.umin = surface->pUknots[surface->uOrder - 1];
+ state->range.umax = surface->pUknots[surface->numUknots - surface->uOrder];
+ state->range.vmin = surface->pVknots[surface->vOrder - 1];
+ state->range.vmax = surface->pVknots[surface->numVknots - surface->vOrder];
+
+ state->param_limits.umin = state->range.umin;
+ state->param_limits.umax = state->range.umax;
+ state->param_limits.vmin = state->range.vmin;
+ state->param_limits.vmax = state->range.vmax;
+
+ /* Check for unsupported order. */
+ if ( surface->uOrder > MAXORD || surface->uOrder > MAXORD ) {
+ /* Draw *only* the control polygon. */
+ return build_control_polygon( surface, state );
+ }
+
+ if ( state->reps.markers ) {
+ return build_surf_markers( surface, state );
+ }
+
+ /*
+ * build initial grid description
+ */
+ if (status = span_grids( state, surface ))
+ goto abort;
+
+ if ( state->reps.normals ) {
+ for ( i = 0; i < state->grids.number; i++ )
+ compute_edge_point_normals( surface, &state->grids.grids[i] );
+ state->grids.flags.normals = 1;
+ }
+
+ if ( surface->numTrimCurveLists > 0 ) {
+#ifdef TRIMING
+ if ( status = phg_nt_install_trim_loops( surface, state ) )
+ goto abort;
+#endif /* TRIMING */
+ }
+
+ if ( state->reps.edges || state->reps.hollow ) {
+ if ( surface->numTrimCurveLists <= 0 )
+ make_edge_segments( state );
+ if ( state->reps.edges )
+ build_edge_reps( pddc, state, surface, &state->edges, 1 );
+ if ( state->reps.hollow )
+ build_edge_reps( pddc, state, surface, &state->hollow, 0 );
+ }
+
+ if ( state->reps.facets ) {
+ status = build_facets( state, surface );
+ }
+
+ if ( state->reps.isocrvs ) {
+ switch( pddc->Dynamic->pPCAttr->psc.data.isoCurves.placementType ) {
+ default:
+ case 0 /* PEXPSCUniform */:
+ status = uniform_isocurves( state, surface );
+ break;
+ case 1 /* PEXPSCNonUniform */:
+ status = nonuniform_isocurves( state, surface );
+ break;
+ }
+ }
+
+abort:
+ return (status);
+
+}
+
+
+
+/*++
+ |
+ | Function Name: span_grids
+ |
+ | Function Description:
+ |
+ | This routine is the first step in creating a tesselated
+ | polygon description of a surface patch. The rendering
+ |
+ |
+ | Note(s):
+ |
+ --*/
+
+static
+ddpex3rtn
+span_grids( state, surface )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+{
+/* uses */
+ double *uvals = 0,
+ *vvals = 0; /* need double precision */
+ int num_uvals, num_vvals;
+ int ucount, vcount;
+ int uspan, vspan;
+ int *uspans = 0,
+ *vspans = 0;
+ int num_uspans, num_vspans;
+
+ int i, j;
+ ddFLOAT *uknots = surface->pUknots;
+ ddFLOAT *vknots = surface->pVknots;
+ ddpex3rtn status = Success;
+
+ /* Small inaccuracies sometimes cause span_evaluation_points() to
+ * generate an extra point or two, so allocate the arrays two sizes
+ * larger than the expected need.
+ */
+ ucount = state->approx_value[0] + 4;
+ vcount = state->approx_value[1] + 4;
+
+ if ( !( uvals = (double *) xalloc(ucount * sizeof(double))) ) {
+ status = BadAlloc;
+ goto abort;
+ }
+
+ if ( !( vvals = (double *) xalloc(vcount * sizeof(double))) ) {
+ status = BadAlloc;
+ goto abort;
+ }
+
+ num_uspans = 1; uspans = &uspan;
+ num_vspans = 1; vspans = &vspan;
+ for ( i = surface->uOrder - 1; i < surface->mPts; i++ ) {
+ if ( uknots[i] != uknots[i+1] ) {
+ uspan = i + 1;
+ span_evaluation_points( uknots, i,
+ state->range.umin, state->range.umax,
+ state->approx_value[0],
+ &num_uvals, uvals );
+ if ( num_uvals <= 0 )
+ continue;
+
+ for ( j = surface->vOrder - 1; j < surface->nPts; j++ ) {
+ if ( vknots[j] != vknots[j+1] ) {
+ vspan = j + 1;
+ span_evaluation_points( vknots, j,
+ state->range.vmin,state->range.vmax,
+ state->approx_value[1],
+ &num_vvals, vvals );
+ if ( num_vvals <= 0 )
+ continue;
+
+ if ( status = add_grid( state, surface,
+ num_uvals, num_vvals,
+ uvals, vvals,
+ num_uspans, num_vspans,
+ uspans, vspans ) )
+ goto abort;
+ }
+ }
+ }
+ }
+
+abort:
+ if (uvals) xfree(uvals);
+ if (vvals) xfree(vvals);
+
+ return (status);
+}
+
+
+
+/*++
+ |
+ | Function Name: span_evaluation_points
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+span_evaluation_points( knots, span, tmin, tmax, apxval, num_vals, vals )
+ ddFLOAT *knots;
+ int span;
+ double tmin, tmax;
+ double apxval;
+ int *num_vals;
+ double *vals;
+{
+ double t, dt;
+ double left, right;
+
+ int count = 0, maxvals;
+ double *ep = vals;
+
+ if ( knots[span] < tmax && knots[span+1] > tmin ) {
+ /* maxvals is used to control the number of positions generated so
+ * that very small nearly zero-width intervals aren't generated
+ * due to small floating point inaccuracies.
+ */
+ maxvals = apxval + 2;
+ left = knots[span];
+ right = knots[span+1];
+ dt = (right - left) / (double)(maxvals - 1);
+ t = left;
+
+ /* If tmin is in the interval then start with it. */
+ if ( tmin > left && tmin < right ) {
+ ep[count++] = tmin;
+ while ( t <= tmin ) {
+ t += dt; --maxvals;
+ }
+ }
+ ep[count++] = t;
+ t += dt; --maxvals;
+
+ /* Interior values. */
+ for ( ; maxvals > 1 && t < tmax; t += dt, --maxvals )
+ ep[count++] = t;
+
+ /* Last value. */
+ if ( right > tmax )
+ ep[count++] = tmax;
+ else
+ ep[count++] = right;
+ }
+ *num_vals = count;
+}
+
+
+
+#define GRID_LIST_CHUNK 5
+
+/*++
+ |
+ | Function Name: add_grid
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+add_grid( state, surface, ucount, vcount, uvals, vvals,
+ num_uspans, num_vspans, uspans, vspans )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ int ucount, vcount;
+ double *uvals, *vvals;
+ int num_uspans, num_vspans;
+ int *uspans, *vspans;
+{
+/* calls */
+ void phg_ns_evaluate_surface_in_span();
+
+/* uses */
+ int uspan, vspan;
+ int i, j;
+ Nurb_edge_point *ep;
+ Nurb_grid *grid;
+
+ if ( ucount <= 0 || vcount <= 0 )
+ return 1;
+
+ if ( state->grids.number % GRID_LIST_CHUNK == 0 ) {
+ if ( state->grids.number == 0 )
+ state->grids.grids = (Nurb_grid *)xalloc(
+ GRID_LIST_CHUNK * sizeof(Nurb_grid) );
+ else
+ state->grids.grids = (Nurb_grid *)xrealloc( state->grids.grids,
+ (state->grids.number + GRID_LIST_CHUNK) * sizeof(Nurb_grid) );
+ }
+ if ( !state->grids.grids ) {
+ return (BadAlloc);
+ }
+
+ ++state->grids.number;
+
+ grid = &state->grids.grids[state->grids.number-1];
+ if ( !( grid->pts = (Nurb_edge_point *)
+ xalloc(ucount * vcount * sizeof(Nurb_edge_point))) ) {
+ return (BadAlloc);
+ }
+
+ /* Calculate vertex coordinates. */
+ ep = grid->pts;
+ for ( j = 0; j < vcount; j++ ) {
+ vspan = (num_vspans > 1) ? vspans[j] : vspans[0];
+ for ( i = 0; i < ucount; i++, ep++ ) {
+ ep->count = 0;
+ ep->u = uvals[i]; ep->v = vvals[j];
+ uspan = (num_uspans > 1) ? uspans[i]:uspans[0];
+ phg_ns_evaluate_surface_in_span( surface, ep->u, ep->v,
+ uspan, vspan, &ep->pt );
+ }
+ }
+ grid->nu = ucount; grid->nv = vcount;
+ grid->extent.umin = uvals[0]; grid->extent.umax = uvals[ucount-1];
+ grid->extent.vmin = vvals[0]; grid->extent.vmax = vvals[vcount-1];
+
+ return (Success);
+}
+
+
+
+/*++
+ |
+ | Function Name: phg_ns_evaluate_surface_in_span
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+phg_ns_evaluate_surface_in_span( surface, u, v, uspan, vspan, spt )
+ miNurbSurfaceStruct *surface;
+ register double u, v;
+ int uspan, vspan;
+ ddCoord4D *spt;
+{
+ ddCoord4D npt[MAXORD], tmppts[MAXORD];
+ int iu, iv;
+ int i;
+ double alpha, alpha1;
+ int nu, nv, j, k;
+ int uorder = surface->uOrder;
+ int vorder = surface->vOrder;
+ ddFLOAT *uknots = surface->pUknots;
+ ddFLOAT *vknots = surface->pVknots;
+ ddCoord4D *tmp;
+ char rat;
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ iu = uspan - uorder; iv = vspan - vorder;
+ for ( nv = 0; nv < vorder; nv++ ) {
+
+ if ( rat ) {
+ for ( nu = 0; nu < uorder; nu++ )
+ tmppts[nu] = surface->points.ddList->pts.p4Dpt[(iv + nv) * surface->mPts + (iu + nu)];
+ } else {
+ for ( nu = 0; nu < uorder; nu++ ) {
+ tmppts[nu].x = surface->points.ddList->pts.p3Dpt[(iv + nv) * surface->mPts + (iu + nu)].x;
+ tmppts[nu].y = surface->points.ddList->pts.p3Dpt[(iv + nv) * surface->mPts + (iu + nu)].y;
+ tmppts[nu].z = surface->points.ddList->pts.p3Dpt[(iv + nv) * surface->mPts + (iu + nu)].z;
+ }
+ }
+
+ for ( k = 1; k < uorder; k++ ) {
+ for ( j = uorder-1, tmp = &tmppts[j]; j >= k; j--, tmp--) {
+ i= j + iu;
+ alpha = (u - uknots[i]) / (uknots[i+uorder-k] - uknots[i]);
+ alpha1 = 1.0 - alpha;
+ tmp->x = alpha * tmp->x + alpha1 * (tmp-1)->x;
+ tmp->y = alpha * tmp->y + alpha1 * (tmp-1)->y;
+ tmp->z = alpha * tmp->z + alpha1 * (tmp-1)->z;
+ if ( rat )
+ tmp->w = alpha * tmp->w + alpha1 * (tmp-1)->w;
+ }
+ }
+
+ npt[nv] = tmppts[uorder - 1];
+ }
+
+ for ( nv = 0; nv < vorder; nv++ ) {
+ tmppts[nv] = npt[nv];
+ }
+
+ for ( k = 1; k < vorder; k++ ) {
+ for ( j = vorder - 1, tmp = &tmppts[j]; j >= k; j--, tmp--) {
+ i= j + iv;
+ alpha = (v - vknots[i]) / (vknots[i+vorder-k] - vknots[i]);
+ alpha1 = 1.0 - alpha;
+ tmp->x = alpha * tmp->x + alpha1 * (tmp-1)->x;
+ tmp->y = alpha * tmp->y + alpha1 * (tmp-1)->y;
+ tmp->z = alpha * tmp->z + alpha1 * (tmp-1)->z;
+ if ( rat )
+ tmp->w = alpha * tmp->w + alpha1 * (tmp-1)->w;
+ }
+ }
+
+ *spt = tmppts[vorder-1];
+ if ( !rat )
+ spt->w = 1.0;
+}
+
+
+
+/*++
+ |
+ | Function Name: phg_ns_evaluate_surface
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+phg_ns_evaluate_surface( surface, u, v, spt )
+ miNurbSurfaceStruct *surface;
+ register double u, v;
+ ddCoord4D *spt;
+{
+ int iu, iv;
+
+ register ddFLOAT *uknots = surface->pUknots;
+ register ddFLOAT *vknots = surface->pVknots;
+
+ iu = surface->numUknots - 1;
+ iv = surface->numVknots - 1;
+
+ /* Ensure parameters are within range. */
+ if ( u < uknots[0] )
+ u = uknots[0];
+ else if ( u > uknots[iu] )
+ u = uknots[iu];
+
+ if ( v < vknots[0] )
+ v = vknots[0];
+ else if ( v > vknots[iv] )
+ v = vknots[iv];
+
+ /* Find the span where u,v belong. */
+ if ( uknots[iu] == u )
+ while ( uknots[iu] >= u ) --iu;
+ else
+ while ( uknots[iu] > u ) --iu;
+
+ if ( vknots[iv] == v )
+ while ( vknots[iv] >= v ) --iv;
+ else
+ while ( vknots[iv] > v ) --iv;
+ phg_ns_evaluate_surface_in_span( surface, u, v, ++iu, ++iv, spt );
+}
+
+
+
+/*++
+ |
+ | Function Name: avg_vertex_normal
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+avg_vertex_normal( count, pt, ptp, ptq, nout )
+ int count;
+ ddCoord3D *pt, *ptp, *ptq;
+ ddVector3D *nout;
+{
+ ddVector3D pvec, qvec;
+ ddVector3D nscratch;
+ double h;
+
+ ddVector3D *p = &pvec,
+ *q = &qvec;
+ ddVector3D *n;
+
+ /* Calculate the vertex normal for the specified vertex by computing
+ * the cross product of the vectors connecting "pt" to "ptp" and "ptq,"
+ * N = (ptp - pt) X (ptq - pt). If the count is > 0 average this normal
+ * into the vertex normal rather than just writing it there. This
+ * facilitates computing the average normal derived from all polygons
+ * adjacent to the vertex.
+ */
+ p->x = ptp->x - pt->x; p->y = ptp->y - pt->y; p->z = ptp->z - pt->z;
+ q->x = ptq->x - pt->x; q->y = ptq->y - pt->y; q->z = ptq->z - pt->z;
+ n = count > 0 ? &nscratch : nout;
+ n->x = p->y * q->z - q->y * p->z;
+ n->y = q->x * p->z - p->x * q->z;
+ n->z = p->x * q->y - q->x * p->y;
+ /* Normalize. */
+ h = 1.0 / sqrt(n->x * n->x + n->y * n->y + n->z * n->z);
+ n->x *= h; n->y *= h; n->z *= h;
+ if ( count > 0 ) {
+ /* Average in this normal. */
+ h = 1.0 / (double)(count + 1);
+ nout->x = h * ((double)count * nout->x + n->x);
+ nout->y = h * ((double)count * nout->y + n->y);
+ nout->z = h * ((double)count * nout->z + n->z);
+ /* Normalize the new average. */
+ n = nout;
+ h = 1.0 / sqrt(n->x * n->x + n->y * n->y + n->z * n->z);
+ n->x *= h; n->y *= h; n->z *= h;
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: build_facets
+ |
+ | Function Description:
+ |
+ | The purpose of this function is to take the surface internal
+ | descriptions of the grids and trim curves and convert them
+ | into descriptions of either quad meshes or SOFAS for
+ | rendering.
+ |
+ | Note that quad meshes are output if there are no trim curves,
+ | otherwise SOFAS are used.
+ |
+ | Note(s):
+ |
+ --*/
+
+static ddpex3rtn
+build_facets( state, surface )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+{
+
+#ifdef TRIMING
+ ddpex3rtn phg_nt_trim_rect();
+#endif /* TRIMING */
+
+ Nurb_edge_point *rect[4];
+ int g;
+ int i, j;
+ int ucount, vcount;
+ Nurb_grid *grid;
+ miListHeader *listheader;
+ char rat;
+ ddpex3rtn status;
+
+ /* Set the Path_d flags. */
+ if ( state->grids.number <= 0 ) return (Success);
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ if ( surface->numTrimCurveLists > 0 ) {
+#ifdef TRIMING
+ /*
+ * If trim curves are present, build a SOFAS description
+ * of the trimmed surface.
+ */
+
+ /* Initialize output SOFAS structure */
+ state->sofas = (miSOFASStruct *)xalloc(sizeof(miSOFASStruct));
+ state->sofas->edgeAttribs = 0;
+ state->sofas->numFAS = state->sofas->numEdges = 0;
+ state->sofas->pFacets.type = DD_FACET_NONE;
+ state->sofas->pFacets.numFacets = state->sofas->pFacets.maxData = 0;
+ state->sofas->pFacets.facets.pNoFacet = 0;
+ state->sofas->points.numLists = state->sofas->points.maxLists = 0;
+ state->sofas->points.ddList = 0;
+ state->sofas->connects.numListLists = state->sofas->connects.maxData = 0;
+ state->sofas->connects.data = 0;
+
+ /* Note that each rectangle of each grid is trimmed separately */
+ for ( g = 0; g < state->grids.number; g++ ) {
+ grid = &state->grids.grids[g];
+ ucount = grid->nu; vcount = grid->nv;
+ if ( surface->numTrimCurveLists > 0 ) {
+ register Nurb_edge_point *ll, *lr, *ur, *ul;
+
+ /* Determine the facets and pass them to the trimming code. */
+ ll = &grid->pts[0]; lr = ll + 1;
+ ul = &grid->pts[ucount]; ur = ul + 1;
+ for ( j = 0; j < vcount-1; j++, ll++, lr++, ur++, ul++ ) {
+ for ( i = 0; i < ucount-1; i++, ll++, lr++, ur++, ul++ ) {
+ rect[LL] = ll;
+ rect[LR] = lr;
+ rect[UR] = ur;
+ rect[UL] = ul;
+ if ( status = phg_nt_trim_rect( state, surface, rect,
+ add_pgon_point,
+ state->sofas ) )
+ return status;
+ }
+ }
+ }
+ }
+#endif /* TRIMING */
+ } else {
+
+ /*
+ * no triming
+ * Create a list of quad meshes from the grid data.
+ */
+
+ state->facets =
+ (miListHeader *)xalloc(state->grids.number*sizeof(miListHeader));
+
+ listheader = state->facets;
+ grid = state->grids.grids;
+
+ /*
+ * Create a quad mesh for each grid
+ */
+ for ( g = 0; g < state->grids.number; g++ ) {
+
+ int j;
+ ddPointUnion new_point;
+ int num_pts = grid->nu * grid->nv;
+ Nurb_edge_point *ep = grid->pts;
+
+ listheader->flags = 0;
+ listheader->numLists = 0;
+ listheader->maxLists = 0;
+ listheader->ddList = 0;
+
+ MI_ALLOCLISTHEADER( listheader, 1);
+
+ /*
+ * Note that the data in the grid is already organized
+ * in quad mesh order. Therefore, all that needs to be
+ * done is to copy the data from the list of edge_points to
+ * a listofddPoints.
+ */
+ if ( rat ) {
+
+ if (state->reps.normals) {
+ listheader->type = DD_NORM_POINT4D;
+ MI_ALLOCLISTOFDDPOINT( listheader->ddList,
+ num_pts, sizeof(ddNormalPoint4D));
+ } else {
+ listheader->type = DD_HOMOGENOUS_POINT;
+ MI_ALLOCLISTOFDDPOINT( listheader->ddList,
+ num_pts, sizeof(ddCoord4D));
+ }
+
+ new_point = listheader->ddList->pts;
+ if (!(new_point.ptr)) return(BadAlloc);
+
+ for ( j = 0; j < num_pts; j++, ep++ ) {
+ *(new_point.p4Dpt++) = ep->pt;
+ if (state->reps.normals) *(new_point.pNormal++) = ep->normal;
+ }
+
+ listheader->ddList->numPoints = num_pts;
+
+ } else {
+
+ if (state->reps.normals) {
+ listheader->type = DD_NORM_POINT;
+ MI_ALLOCLISTOFDDPOINT( listheader->ddList,
+ num_pts, sizeof(ddNormalPoint));
+ } else {
+ listheader->type = DD_3D_POINT;
+ MI_ALLOCLISTOFDDPOINT( listheader->ddList,
+ num_pts, sizeof(ddCoord3D));
+ }
+
+ new_point = listheader->ddList->pts;
+ if (!(new_point.ptr)) return(BadAlloc);
+
+ for ( j = 0; j < num_pts; j++, ep++ ) {
+ *(new_point.p3Dpt++) = *((ddCoord3D *)(&ep->pt));
+ if (state->reps.normals) *(new_point.pNormal++) = ep->normal;
+ }
+
+ listheader->ddList->numPoints = num_pts;
+
+ }
+
+ /* skip to next grid and point list */
+ listheader++;
+ grid++;
+
+ }
+ }
+
+ return ( Success );
+}
+
+
+
+/*++
+ |
+ | Function Name: build_edge_reps
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+build_edge_reps( pddc, state, surface, edge_list, use_edge_flags )
+ miDDContext *pddc;
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ miListHeader **edge_list;
+ int use_edge_flags;
+{
+ Nurb_grid *grid = state->grids.grids;
+ miListHeader *out_list;
+ register int i, j;
+
+ /* Initialize output structure */
+ out_list = (miListHeader *)xalloc(sizeof(miListHeader));
+ *edge_list = out_list;
+ out_list->type = surface->points.type;
+ out_list->numLists = out_list->maxLists = 0;
+ out_list->ddList = 0;
+
+ if ( surface->numTrimCurveLists > 0 ) {
+#ifdef TRIMING
+ Nurb_trim_data *tdata = &state->trim_data;
+ Nurb_trim_segment *seg;
+
+ for ( i = 0; i < state->grids.number; i++, grid++ ) {
+ for ( j = 0; j < tdata->nloops; j++ ) {
+ if ( !EXTENTS_OVERLAP( grid->extent, tdata->loops[j].extent) )
+ continue;
+ if ( !(seg = tdata->loops[j].segs) )
+ continue;
+ phg_nt_draw_segs( state, surface, grid, seg, tdata->vertices,
+ use_edge_flags, out_list );
+ }
+ }
+#endif /* TRIMING */
+ } else {
+ for ( i = 0; i < state->grids.number; i++, grid++ ) {
+ phg_nt_draw_segs( state, surface, grid, state->edge_segs,
+ state->corners, use_edge_flags, out_list );
+ }
+ }
+}
+
+
+/*++
+ |
+ | Function Name: isocurve
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+isocurve( state, surface, dir, val, tmin, tmax, curve_list )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ int dir; /* 1 ==> constant U, 2 ==> constant V */
+ double val;
+ double tmin, tmax;
+ miListHeader *curve_list;
+{
+ Nurb_trim_segment seg;
+ Nurb_param_point spts[2];
+ int i, j;
+ Nurb_grid *grid;
+ ddpex3rtn status;
+
+ /* Dummy up one or more trimming segments for this iso curve and pass
+ * them to the trim segment drawer.
+ */
+ seg.first = seg.start = 0; seg.last = seg.end = 1;
+ seg.next = (Nurb_trim_segment *)NULL;
+ if ( dir == 2 ) { /* constant V */
+ spts[0].v = spts[1].v = val;
+ seg.extent.vmin = seg.extent.vmax = val;
+ } else { /* constant U */
+ spts[0].u = spts[1].u = val;
+ seg.extent.umin = seg.extent.umax = val;
+ }
+
+ if ( surface->numTrimCurveLists > 0 ) {
+#ifdef TRIMING
+ ddpex3rtn phg_nt_compute_trim_range();
+ Nurb_limitlst ranges;
+ Nurb_limit no_limit;
+ int tc;
+
+ /* Get the trimming intervals. */
+ NURB_INIT_RANGE_LIST(&ranges);
+ if (status = phg_nt_compute_trim_range( state, dir, val,
+ tmin, tmax, &ranges, &tc ))
+ return( status );
+
+ if ( tc == -1) {
+ tc = 1;
+ ranges.limits = &no_limit;
+ no_limit.lmin = tmin;
+ no_limit.lmax = tmax;
+ }
+
+ for ( i = 0; i < tc; i++ ) {
+ if ( dir == 2 ) { /* constant V */
+ spts[0].u = seg.extent.umin = ranges.limits[i].lmin;
+ spts[1].u = seg.extent.umax = ranges.limits[i].lmax;
+ } else { /* constant U */
+ spts[0].v = seg.extent.vmin = ranges.limits[i].lmin;
+ spts[1].v = seg.extent.vmax = ranges.limits[i].lmax;
+ }
+ grid = state->grids.grids;
+ for ( j = 0; j < state->grids.number; j++, grid++ ) {
+ if ( dir == 1 && xin(grid->extent.umin,grid->extent.umax,val)
+ || dir == 2 && xin(grid->extent.vmin,grid->extent.vmax,val))
+ phg_nt_draw_segs(state, surface, grid, &seg, spts, 0, curve_list);
+ }
+ }
+
+ if ( ranges.size > 0 )
+ xfree( ranges.limits );
+
+#endif /* TRIMING */
+ } else { /* no trimming */
+ if ( dir == 2 ) { /* constant V */
+ spts[0].u = seg.extent.umin = tmin;
+ spts[1].u = seg.extent.umax = tmax;
+ } else { /* constant U */
+ spts[0].v = seg.extent.vmin = tmin;
+ spts[1].v = seg.extent.vmax = tmax;
+ }
+
+ grid = state->grids.grids;
+ for ( i = 0; i < state->grids.number; i++, grid++ ) {
+ if ( dir == 1 && xin(grid->extent.umin,grid->extent.umax,val)
+ || dir == 2 && xin(grid->extent.vmin,grid->extent.vmax,val))
+ phg_nt_draw_segs( state, surface, grid, &seg, spts, 0, curve_list );
+ }
+ }
+
+ return Success;
+}
+
+
+
+/*++
+ |
+ | Function Name: uniform_isocurves
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+uniform_isocurves( state, surface )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+{
+ double t, dt;
+ int j;
+ Nurb_param_limit *range = &state->param_limits;
+
+ /* Initialize output structure */
+ state->isocrvs = (miListHeader *)xalloc(sizeof(miListHeader));
+ state->isocrvs->type = surface->points.type;
+ state->isocrvs->numLists = state->isocrvs->maxLists = 0;
+ state->isocrvs->ddList = 0;
+
+ /* Place curves uniformly between the specified parameter limits.
+ * Also place curves at the parameter limits, only if there is no
+ * trimming.
+ */
+
+ /* First curve of constant U. */
+ t = range->umin;
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming */
+#endif /* CADAM */
+ (void)isocurve( state, surface, 1, t, range->vmin, range->vmax,
+ state->isocrvs );
+#ifdef CADAM
+ }
+#endif /* CADAM */
+
+ /* Interior curves of constant U. */
+ dt = (range->umax - range->umin) / (state->isocount[0] + 1);
+ for ( j = 0, t += dt; j < state->isocount[0]; j++, t += dt ) {
+ (void)isocurve( state, surface, 1, t, range->vmin, range->vmax,
+ state->isocrvs );
+ }
+
+ /* Last curve of constant U. */
+ t = range->umax;
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming */
+#endif /* CADAM */
+ (void)isocurve( state, surface, 1, t, range->vmin, range->vmax,
+ state->isocrvs );
+#ifdef CADAM
+ }
+#endif /* CADAM */
+
+
+ /* First curve of constant V. */
+ t = range->vmin;
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming */
+#endif /* CADAM */
+ (void)isocurve( state, surface, 2, t, range->umin, range->umax,
+ state->isocrvs );
+#ifdef CADAM
+ }
+#endif /* CADAM */
+
+ /* Interior curves of constant V. */
+ dt = (range->vmax - range->vmin) / (state->isocount[1] + 1);
+ for ( j = 0, t += dt; j < state->isocount[1]; j++, t += dt ) {
+ (void)isocurve( state, surface, 2, t, range->umin, range->umax,
+ state->isocrvs );
+ }
+
+ /* Last curve of constant V. */
+ t = range->vmax;
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming */
+#endif /* CADAM */
+ (void)isocurve( state, surface, 2, t, range->umin, range->umax,
+ state->isocrvs );
+#ifdef CADAM
+ }
+#endif /* CADAM */
+
+ return Success;
+}
+
+
+/*++
+ |
+ | Function Name: nonuniform_isocurves
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static int
+nonuniform_isocurves( state, surface )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+{
+ ddFLOAT *uknots = surface->pUknots;
+ ddFLOAT *vknots = surface->pVknots;
+ double t, dt;
+
+ int i, j;
+ Nurb_param_limit *range = &state->range;
+
+ /* Initialize output structure */
+ state->isocrvs = (miListHeader *)xalloc(sizeof(miListHeader));
+ state->isocrvs->type = surface->points.type;
+ state->isocrvs->numLists = state->isocrvs->maxLists = 0;
+ state->isocrvs->ddList = 0;
+
+ /*
+ * Place curves uniformly between each non-vacuous span.
+ * For each non-vacuous U span draw the iso U curves for all
+ * surface V.
+ */
+ for ( i = surface->uOrder - 1; i < surface->mPts; i++ ) {
+ if ( uknots[i] != uknots[i+1] ) {
+ /* First curve of span. */
+ t = uknots[i];
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming
+*/
+#endif /* CADAM */
+ if ( t >= range->umin && t <= range->umax )
+ (void)isocurve( state, surface, 1, t,
+ range->vmin, range->vmax,
+ state->isocrvs );
+#ifdef CADAM
+ } else {
+ if ( t > range->umin && t < range->umax )
+ (void)isocurve( state, surface, 1, t,
+ range->vmin, range->vmax,
+ state->isocrvs );
+ }
+#endif /* CADAM */
+
+ /* Interior curves of span. */
+ dt = (uknots[i+1] - uknots[i]) / (state->isocount[0] +
+1);
+ for ( j = 0, t += dt; j < state->isocount[0]; j++, t +=
+dt ) {
+ if ( t >= range->umin && t <= range->umax )
+ (void)isocurve( state, surface, 1, t,
+ range->vmin, range->vmax,
+ state->isocrvs );
+ }
+
+ /* Last curve of span. */
+ t = uknots[i+1];
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming
+*/
+#endif /* CADAM */
+ if ( t >= range->umin && t <= range->umax )
+ (void)isocurve( state, surface, 1, t,
+ range->vmin, range->vmax,
+ state->isocrvs );
+#ifdef CADAM
+ } else {
+ if ( t > range->umin && t < range->umax )
+ (void)isocurve( state, surface, 1, t,
+ range->vmin, range->vmax,
+ state->isocrvs );
+ }
+#endif /* CADAM */
+ }
+ }
+
+ /* For each non-vacuous V span draw the iso V curves for all
+surface U. */
+ for ( i = surface->vOrder - 1; i < surface->nPts; i++ ) {
+ if ( vknots[i] != vknots[i+1] ) {
+ /* First curve of span. */
+ t = vknots[i];
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming
+*/
+#endif /* CADAM */
+ if ( t >= range->vmin && t <= range->vmax )
+ (void)isocurve( state, surface, 2, t,
+ range->umin, range->umax,
+ state->isocrvs );
+#ifdef CADAM
+ } else {
+ if ( t > range->vmin && t < range->vmax )
+ (void)isocurve( state, surface, 2, t,
+ range->umin, range->umax,
+ state->isocrvs );
+ }
+#endif /* CADAM */
+
+ /* Inteior curves of span. */
+ dt = (vknots[i+1] - vknots[i]) / (state->isocount[1] +
+1);
+ for ( j = 0, t += dt; j < state->isocount[1]; j++, t +=
+dt ) {
+ if ( t >= range->vmin && t <= range->vmax )
+ (void)isocurve( state, surface, 2, t,
+ range->umin, range->umax,
+ state->isocrvs );
+ }
+
+ /* Last curve of span. */
+ t = vknots[i+1];
+#ifdef CADAM
+ if ( surface->numTrimCurveLists <= 0 ) { /* no trimming
+*/
+#endif /* CADAM */
+ if ( t >= range->vmin && t <= range->vmax )
+ (void)isocurve( state, surface, 2, t,
+ range->umin, range->umax,
+ state->isocrvs );
+#ifdef CADAM
+ } else {
+ if ( t > range->vmin && t < range->vmax )
+ (void)isocurve( state, surface, 2, t,
+ range->umin, range->umax,
+ state->isocrvs );
+ }
+#endif /* CADAM */
+ }
+ }
+
+ return Success;
+}
+
+
+
+/*++
+ |
+ | Function Name: compute_average_edge_point_normals
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+compute_average_edge_point_normals( surface, grid )
+ miNurbSurfaceStruct *surface;
+ Nurb_grid *grid;
+{
+ int i, j;
+ int ucount = grid->nu,
+ vcount = grid->nv;
+ Nurb_edge_point *ll, *lr, *ur, *ul;
+ char rat;
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ /* Step along the surface and calculate averaged normals. */
+ ll = &grid->pts[0]; lr = ll + 1;
+ ul = &grid->pts[ucount]; ur = ul + 1;
+ for ( j = 0; j < vcount-1; j++, ll++, lr++, ul++, ur++ ) {
+ for ( i = 0; i < ucount-1; i++, ll++, lr++, ul++, ur++ ) {
+ /* Calculate and average vertex normals. */
+ if ( rat ) {
+ ddCoord3D pll, plr, pur, pul;
+ register ddCoord4D *pt;
+ register double h;
+
+ pt = &ll->pt; h = 1.0 / pt->w;
+ pll.x = h * pt->x; pll.y = h * pt->y; pll.z = h * pt->z;
+ pt = &lr->pt; h = 1.0 / pt->w;
+ plr.x = h * pt->x; plr.y = h * pt->y; plr.z = h * pt->z;
+ pt = &ur->pt; h = 1.0 / pt->w;
+ pur.x = h * pt->x; pur.y = h * pt->y; pur.z = h * pt->z;
+ pt = &ul->pt; h = 1.0 / pt->w;
+ pul.x = h * pt->x; pul.y = h * pt->y; pul.z = h * pt->z;
+ avg_vertex_normal( ll->count, &pll, &plr, &pul, &ll->normal );
+ avg_vertex_normal( lr->count, &plr, &pur, &pll, &lr->normal );
+ avg_vertex_normal( ur->count, &pur, &pul, &plr, &ur->normal );
+ avg_vertex_normal( ul->count, &pul, &pll, &pur, &ul->normal );
+ } else {
+ avg_vertex_normal( ll->count, (ddCoord3D*)&ll->pt,
+ (ddCoord3D*)&lr->pt, (ddCoord3D*)&ul->pt, &ll->normal );
+ avg_vertex_normal( lr->count, (ddCoord3D*)&lr->pt,
+ (ddCoord3D*)&ur->pt, (ddCoord3D*)&ll->pt, &lr->normal );
+ avg_vertex_normal( ur->count, (ddCoord3D*)&ur->pt,
+ (ddCoord3D*)&ul->pt, (ddCoord3D*)&lr->pt, &ur->normal );
+ avg_vertex_normal( ul->count, (ddCoord3D*)&ul->pt,
+ (ddCoord3D*)&ll->pt, (ddCoord3D*)&ur->pt, &ul->normal );
+ }
+ ++ll->count; ++lr->count; ++ur->count; ++ul->count;
+ }
+ }
+}
+
+
+/*++
+ |
+ | Function Name: compute_edge_point_normals
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+compute_edge_point_normals( surface, grid )
+ miNurbSurfaceStruct *surface;
+ Nurb_grid *grid;
+{
+ register int i, j;
+ register int ucount = grid->nu, vcount = grid->nv;
+ register Nurb_edge_point *ll, *lr, *ur, *ul;
+ char rat;
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ /* Step along the surface and calculate normals. */
+ ll = &grid->pts[0]; lr = ll + 1;
+ ul = &grid->pts[ucount]; ur = ul + 1;
+ for ( j = 0; j < vcount-1; j++, ll++, lr++, ul++, ur++ ) {
+ for ( i = 0; i < ucount-1; i++, ll++, lr++, ul++, ur++ ) {
+ /* Calculate vertex normals. */
+ if ( rat ) {
+ ddCoord3D pll, plr, pur, pul;
+ register ddCoord4D *pt;
+ register double h;
+
+ pt = &ll->pt; h = 1.0 / pt->w;
+ pll.x = h * pt->x; pll.y = h * pt->y; pll.z = h * pt->z;
+ pt = &lr->pt; h = 1.0 / pt->w;
+ plr.x = h * pt->x; plr.y = h * pt->y; plr.z = h * pt->z;
+ pt = &ul->pt; h = 1.0 / pt->w;
+ pul.x = h * pt->x; pul.y = h * pt->y; pul.z = h * pt->z;
+ avg_vertex_normal( 0, &pll, &plr, &pul, &ll->normal );
+
+ /* Calculate normals at edge of grid. */
+ if ( i == ucount-2 || j == vcount-2 ) {
+ pt = &ur->pt; h = 1.0 / pt->w;
+ pur.x = h * pt->x; pur.y = h * pt->y; pur.z = h * pt->z;
+ }
+ if ( i == ucount-2 )
+ avg_vertex_normal( 0, &plr, &pur, &pll, &lr->normal );
+ if ( j == vcount-2 )
+ avg_vertex_normal( 0, &pul, &pll, &pur, &ul->normal );
+ if ( i == ucount-2 && j == vcount-2 )
+ avg_vertex_normal( 0, &pur, &pul, &plr, &ur->normal );
+ } else {
+ avg_vertex_normal( 0, (ddCoord3D*)&ll->pt,
+ (ddCoord3D*)&lr->pt, (ddCoord3D*)&ul->pt, &ll->normal );
+
+ /* Calculate normals at edge of grid. */
+ if ( i == ucount-2 )
+ avg_vertex_normal( 0, (ddCoord3D*)&lr->pt,
+ (ddCoord3D*)&ur->pt, (ddCoord3D*)&ll->pt, &lr->normal );
+ if ( j == vcount-2 )
+ avg_vertex_normal( 0, (ddCoord3D*)&ul->pt,
+ (ddCoord3D*)&ll->pt, (ddCoord3D*)&ur->pt, &ul->normal );
+ if ( i == ucount-2 && j == vcount-2 )
+ avg_vertex_normal( 0, (ddCoord3D*)&ur->pt,
+ (ddCoord3D*)&ul->pt, (ddCoord3D*)&lr->pt, &ur->normal );
+ }
+ }
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: make_edge_segments
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+make_edge_segments( state )
+ Nurb_surf_state *state;
+{
+ int i;
+ Nurb_param_point *corners = state->corners;
+ Nurb_trim_segment *segs = state->edge_segs;
+ Nurb_trim_segment *seg;
+
+ /* Generate the edges by building a fake trimming segment for each edge
+ * and calling the trim edge generator.
+ */
+ corners[0].u = state->range.umin; corners[0].v = state->range.vmin;
+ corners[1].u = state->range.umax; corners[1].v = state->range.vmin;
+ corners[2].u = state->range.umax; corners[2].v = state->range.vmax;
+ corners[3].u = state->range.umin; corners[3].v = state->range.vmax;
+ corners[4].u = state->range.umin; corners[4].v = state->range.vmin;
+ segs[0].first = segs[0].start = 0; segs[0].last = segs[0].end = 1;
+ segs[1].first = segs[1].start = 1; segs[1].last = segs[1].end = 2;
+ segs[2].first = segs[2].start = 2; segs[2].last = segs[2].end = 3;
+ segs[3].first = segs[3].start = 3; segs[3].last = segs[3].end = 4;
+ segs[0].next = &segs[1];
+ segs[1].next = &segs[2];
+ segs[2].next = &segs[3];
+ segs[3].next = (Nurb_trim_segment *)NULL;
+
+ for ( i = 0, seg = segs; i < 4; i++, seg++ ) {
+ seg->vis = ~0;
+ if ( corners[seg->first].u <= corners[seg->last].u ) {
+ seg->extent.umin = corners[seg->first].u;
+ seg->extent.umax = corners[seg->last].u;
+ } else {
+ seg->extent.umin = corners[seg->last].u;
+ seg->extent.umax = corners[seg->first].u;
+ }
+ if ( corners[seg->first].v <= corners[seg->last].v ) {
+ seg->extent.vmin = corners[seg->first].v;
+ seg->extent.vmax = corners[seg->last].v;
+ } else {
+ seg->extent.vmin = corners[seg->last].v;
+ seg->extent.vmax = corners[seg->first].v;
+ }
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: build_surf_markers
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static ddpex3rtn
+build_surf_markers( surface, state )
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+{
+
+ if (!state->markers)
+ state->markers = (miListHeader *)xalloc(sizeof(miListHeader));
+
+ *state->markers = surface->points;
+
+ return Success;
+}
+
+
+
+/*++
+ |
+ | Function Name: build_control_polygon
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+static ddpex3rtn
+build_control_polygon( surface, state )
+ miNurbSurfaceStruct *surface;
+ Nurb_surf_state *state;
+{
+ int i, j;
+ listofddPoint *pddolist;
+ ddCoord3D *cpts3, *out_pt3;
+ ddCoord4D *cpts4, *out_pt4;
+ char rat;
+
+ rat = DD_IsVert4D(surface->points.type);
+
+ if (!state->isocrvs)
+ if (!(state->isocrvs = (miListHeader *)xalloc(sizeof(miListHeader))))
+ return(BadAlloc);
+
+ MI_ALLOCLISTHEADER(state->isocrvs, surface->mPts * surface->nPts);
+ if (!(pddolist = state->isocrvs->ddList)) return(BadAlloc);
+
+ state->isocrvs->type = surface->points.type;
+ state->isocrvs->flags = surface->points.flags;
+ state->isocrvs->numLists = surface->mPts * surface->nPts;
+
+ /* Connect the points in the U dimension. */
+ if ( rat ) {
+
+ for ( j = 0; j < surface->mPts; j++ ) {
+ cpts4 = &surface->points.ddList->pts.p4Dpt[j * surface->mPts];
+ MI_ALLOCLISTOFDDPOINT(pddolist, surface->mPts, sizeof(ddCoord4D));
+ if (!(out_pt4 = pddolist->pts.p4Dpt)) return(BadAlloc);
+ for ( i = 1; i < surface->mPts; i++ ) {
+ *(out_pt4++) = *(cpts4++);
+ }
+ (pddolist++)->numPoints = surface->mPts;
+ }
+
+ } else {
+
+ for ( j = 0; j < surface->mPts; j++ ) {
+ cpts3 = &surface->points.ddList->pts.p3Dpt[j * surface->mPts];
+ MI_ALLOCLISTOFDDPOINT(pddolist, surface->mPts, sizeof(ddCoord3D));
+ if (!(out_pt3 = pddolist->pts.p3Dpt)) return(BadAlloc);
+ for ( i = 1; i < surface->mPts; i++ ) {
+ *(out_pt3++) = *(cpts3++);
+ }
+ (pddolist++)->numPoints = surface->mPts;
+ }
+
+ }
+
+ /* Connect the points in the V dimension. */
+ if ( rat ) {
+
+ for ( j = 0; j < surface->nPts; j++ ) {
+ cpts4 = &surface->points.ddList->pts.p4Dpt[j];
+ MI_ALLOCLISTOFDDPOINT(pddolist, surface->nPts, sizeof(ddCoord4D));
+ if (!(out_pt4 = pddolist->pts.p4Dpt)) return(BadAlloc);
+ for ( i = 1; i < surface->nPts; i++ ) {
+ *(out_pt4++) = *cpts4;
+ cpts4 += surface->mPts;
+ }
+ (pddolist++)->numPoints = surface->nPts;
+ }
+
+ } else {
+
+ for ( j = 0; j < surface->nPts; j++ ) {
+ cpts3 = &surface->points.ddList->pts.p3Dpt[j];
+ MI_ALLOCLISTOFDDPOINT(pddolist, surface->nPts, sizeof(ddCoord3D));
+ if (!(out_pt3 = pddolist->pts.p3Dpt)) return(BadAlloc);
+ for ( i = 1; i < surface->nPts; i++ ) {
+ *(out_pt3++) = *cpts3;
+ cpts3 += surface->mPts;
+ }
+ (pddolist++)->numPoints = surface->nPts;
+ }
+
+ }
+
+ return Success;
+}
+
+
+
+/*++
+ |
+ | Function Name: free_grids
+ |
+ | Function Description:
+ |
+ | free the allocated data associated with a list of grids.
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+free_grids( grids )
+ Nurb_gridlst *grids;
+{
+ int i;
+
+ if ( grids && grids->number > 0 ) {
+ for ( i = 0; i < grids->number; i++ ) {
+ if ( grids->grids[i].pts )
+ xfree( grids->grids[i].pts );
+ }
+ xfree( grids->grids );
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: nurb_surf_state_free
+ |
+ | Function Description:
+ |
+ | free all of the allocated data associated with a surface
+ | Nurb_surf_state data structure.
+ |
+ | Note(s):
+ |
+ --*/
+
+static void
+nurb_surf_state_free( state )
+ Nurb_surf_state *state;
+{
+ int facet;
+
+ /* Free everything but the cache data. */
+ if ( state->ruknots )
+ xfree( state->ruknots );
+ if ( state->rvknots )
+ xfree( state->rvknots );
+
+#ifdef TRIMING
+ phg_nt_free_trim_data( &state->trim_data );
+#endif /* TRIMING */
+
+ if ( state->reps.facets ) {
+ if ( state->facets ) {
+ MI_FREELISTHEADER(state->facets);
+ for (facet = 0; facet < state->grids.number; facet++)
+ MI_FREELISTHEADER(state->facets + facet);
+ xfree(state->facets);
+ }
+ else if ( state->sofas ) {
+ MI_FREELISTHEADER(&(state->sofas->points));
+ xfree(state->sofas);
+ }
+ }
+ if ( state->reps.edges && state->edges ) {
+ MI_FREELISTHEADER(state->edges);
+ xfree(state->edges);
+ }
+ if ( state->reps.isocrvs && state->isocrvs ) {
+ MI_FREELISTHEADER(state->isocrvs);
+ xfree(state->isocrvs);
+ }
+ if ( state->reps.markers && state->markers) {
+ /* Note that markers are a copy of the input data - DON`T FREE IT */
+ xfree(state->markers);
+ }
+ if ( state->reps.hollow && state->hollow ) {
+ MI_FREELISTHEADER(state->hollow);
+ xfree(state->hollow);
+ }
+
+ if ( state->grids.number > 0 ) {
+ free_grids( &state->grids );
+ state->grids.number = 0;
+ state->grids.grids = (Nurb_grid *)NULL;
+ }
+}
+
+
+
+#ifdef TRIMING
+
+/*++
+ |
+ | Function Name: add_pgon_point
+ |
+ | Function Description:
+ |
+ | Enter the specified edge point into a miSOFASStruct
+ | according to the specified operation.
+ |
+ | Note(s):
+ |
+ --*/
+
+static ddpex3rtn
+add_pgon_point( state, surface, ddSOFAS, op, ep )
+ Nurb_surf_state *state;
+ miNurbSurfaceStruct *surface;
+ miSOFASStruct *ddSOFAS;
+ Nurb_facet_op op;
+ Nurb_edge_point *ep;
+{
+ miConnListList *ConnListList;
+ miConnList *ConnList;
+ int num_points, data_count, i;
+
+ /* a new point for the vertex list */
+ if (ddSOFAS->points.ddList)
+ num_points = ddSOFAS->points.ddList->numPoints;
+ else num_points = 0;
+
+ switch (op) {
+
+ /*
+ * A new facet is to be started in the SOFAS output structure.
+ * The first task to complete is to insure that there is sufficient
+ * space for the new list od list of indices in the connection lists.
+ */
+ case NURB_NEW_FACET:
+ ddSOFAS->connects.numListLists++;
+ data_count = MI_ROUND_LISTHEADERCOUNT(ddSOFAS->connects.numListLists)
+ * sizeof(miConnListList);
+
+ if (data_count > ddSOFAS->connects.maxData) {
+ if (ddSOFAS->connects.data) {
+ ddSOFAS->connects.data =
+ (miConnListList *)xrealloc(ddSOFAS->connects.data, data_count);
+ ddSOFAS->connects.maxData = data_count;
+ } else {
+ ddSOFAS->connects.data = (miConnListList *)xalloc(data_count);
+ ddSOFAS->connects.maxData = data_count;
+ }
+
+ if (!(ddSOFAS->connects.data)) return(BadAlloc);
+
+ /* Initialize newly created entries */
+ ConnListList = &ddSOFAS->connects.data[ddSOFAS->numFAS];
+ for (i = MI_ROUND_LISTHEADERCOUNT(ddSOFAS->connects.numListLists) -
+ ddSOFAS->numFAS;
+ i > 0;
+ i--) {
+ ConnListList->numLists = ConnListList->maxData = 0;
+ (ConnListList++)->pConnLists = 0;
+
+ }
+ }
+
+ ddSOFAS->numFAS++;
+
+
+ /*
+ * a new contour is to be started in the SOFAS output structure.
+ * The first task is to insure that there is sufficient output
+ * space for the contour is the list of contour index lists
+ */
+ case NURB_NEW_CONTOUR:
+ ConnListList = &ddSOFAS->connects.data[ddSOFAS->numFAS - 1];
+
+ data_count = MI_ROUND_LISTHEADERCOUNT( ConnListList->numLists+1 )
+ * sizeof(miConnList);
+
+ if (data_count > ConnListList->maxData) {
+
+ if (ConnListList->pConnLists) {
+ ConnListList->pConnLists =
+ (miConnList *)xrealloc(ConnListList->pConnLists,
+ data_count );
+ ConnListList->maxData = data_count;
+ } else {
+ ConnListList->pConnLists = (miConnList *)xalloc(data_count);
+ ConnListList->maxData = data_count;
+ }
+
+ if (!(ConnListList->pConnLists)) return (BadAlloc);
+
+ /* Initialize newly created entries */
+ ConnList = &ConnListList->pConnLists[ConnListList->numLists];
+ for (i = MI_ROUND_LISTHEADERCOUNT( ConnListList->numLists+1 ) -
+ ConnListList->numLists;
+ i > 0;
+ i--) {
+ ConnList->numLists = ConnList->maxData = 0;
+ (ConnList++)->pConnects = 0;
+
+ }
+ }
+
+ ConnListList->numLists++;
+
+ /*
+ * Finally, insure sufficent space for the index!
+ */
+ case NURB_SAME_CONTOUR:
+ ConnListList = &ddSOFAS->connects.data[ddSOFAS->numFAS - 1];
+ ConnList = &ConnListList->pConnLists[ConnListList->numLists - 1];
+
+ data_count = MI_ROUND_LISTHEADERCOUNT( ConnList->numLists+1 )
+ * sizeof(ddUSHORT);
+
+ if (data_count > ConnList->maxData) {
+ if (ConnList->pConnects) {
+ ConnList->pConnects = (ddUSHORT *)xrealloc( ConnList->pConnects,
+ data_count);
+ ConnList->maxData = data_count;
+ } else {
+ ConnList->pConnects = (ddUSHORT *)xalloc(data_count);
+ ConnList->maxData = data_count;
+ }
+
+ if (!(ConnList->pConnects)) return (BadAlloc);
+ }
+
+ /* Lastly, enter the index into the appropriate list */
+ ConnList->pConnects[ConnList->numLists] = num_points;
+ ConnList->numLists++;
+
+
+ }
+
+
+ /* Insure there is a list for the vertex data */
+ if (!(ddSOFAS->points.ddList)) {
+
+ MI_ALLOCLISTHEADER(&ddSOFAS->points, 1)
+ if (!(ddSOFAS->points.ddList)) return(BadAlloc);
+
+ if (state->reps.normals) ddSOFAS->points.type = DD_NORM_POINT4D;
+ else ddSOFAS->points.type = DD_HOMOGENOUS_POINT;
+
+ ddSOFAS->points.flags = 0;
+ ddSOFAS->points.numLists = 1;
+
+ }
+
+ /* Now, enter the point information into the point array */
+ if (state->reps.normals) {
+
+ MI_ALLOCLISTOFDDPOINT(ddSOFAS->points.ddList,
+ MI_ROUND_LISTHEADERCOUNT(num_points + 1),
+ sizeof(ddNormalPoint4D));
+ if (!(ddSOFAS->points.ddList->pts.ptr))
+ return(BadAlloc);
+
+ ddSOFAS->points.ddList->pts.pNpt4D[num_points].pt = ep->pt;
+ ddSOFAS->points.ddList->pts.pNpt4D[num_points].normal = ep->normal;
+
+ } else {
+
+ MI_ALLOCLISTOFDDPOINT(ddSOFAS->points.ddList,
+ MI_ROUND_LISTHEADERCOUNT(num_points + 1),
+ sizeof(ddCoord4D));
+ if (!(ddSOFAS->points.ddList->pts.ptr))
+ return(BadAlloc);
+
+ ddSOFAS->points.ddList->pts.p4Dpt[num_points] = ep->pt;
+ }
+
+ ddSOFAS->points.ddList->numPoints = num_points + 1;
+
+}
+
+#endif /* TRIMING */
+
+#define WS_NSRF_BOTTOM
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNurbs.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNurbs.c
new file mode 100644
index 000000000..f5a2530ef
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNurbs.c
@@ -0,0 +1,378 @@
+/* $TOG: miNurbs.c /main/6 1998/02/10 12:42:00 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNurbs.c,v 3.6 1999/01/31 12:21:28 dawes Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "ddpex.h"
+#include "ddpex3.h"
+#include "miRender.h"
+#include "ddpex2.h"
+#include "miNurbs.h"
+#include "pexos.h"
+
+
+/*
+ * mtx to convert polynomial coeffs ai, to fwd basis coeffs Aj is
+ * D j+1 k i
+ * Aj = Sum [Sum (-1) * (j!/k!(j-k)!)*(j-k) ] * ai where D=degree
+ * i=0 k=0
+ */
+
+#if MAXORD == 4
+/* Debugging is often easier if MAXORD is made small. */
+
+double mi_nu_ptofd[MAXORD][MAXORD] = {
+{ 1.0, 0.0, 0.0, 0.0},
+{ 0.0, 1.0, 1.0, 1.0},
+{ 0.0, 0.0, 2.0, 6.0},
+{ 0.0, 0.0, 0.0, 6.0}
+};
+
+#else
+
+double mi_nu_ptofd[MAXORD][MAXORD] = {
+{ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+{ 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0},
+{ 0.0, 0.0, 2.0, 6.0, 14.0, 30.0, 62.0, 126.0, 254.0, 510.0},
+{ 0.0, 0.0, 0.0, 6.0, 36.0, 150.0, 540.0, 1806.0, 5796.0, 18150.0},
+{ 0.0, 0.0, 0.0, 0.0, 24.0, 240.0, 1560.0, 8400.0, 40824.0, 186480.0},
+{ 0.0, 0.0, 0.0, 0.0, 0.0, 120.0, 1800.0, 16800.0, 126000.0, 834120.0},
+{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 720.0, 15120.0, 191520.0, 1905120.0},
+{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5040.0, 141120.0, 2328480.0},
+{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 40320.0, 1451520.0},
+{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 362880.0}
+};
+
+#endif
+
+#undef HUGE
+#define HUGE 10E30
+
+
+
+/*++
+ |
+ | Function Name: mi_nu_preprocess_knots
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+mi_nu_preprocess_knots( order, nk, knots, rp )
+ ddUSHORT order;
+ int nk;
+ ddFLOAT *knots;
+ ddFLOAT rp[][MAXORD]; /* reciprocal of knots diff */
+{
+ double x;
+
+ register int i, j;
+
+ for ( i = 0; i < nk; i++ )
+ rp[i][0] = 1.0 ;
+ for ( j = 1; j < order; j++ ) {
+ for ( i = 0; i <= nk - j; i++ ) {
+ if ( (x = knots[i+j] - knots[i]) == 0.0 ) {
+ rp[i][j] = HUGE;
+ } else {
+ rp[i][j] = 1.0 / x;
+ }
+ }
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: mi_nu_compute_nurb_basis_function
+ |
+ | Function Description:
+ |
+ | Recursive definition of polynomial coefficients for span (0<= s <=1).
+ | C(i,j,k) = a*C(i,j-1,k-1) + b*C(i,j,k-1) + c*C(i+1,j-1,k-1) + d*C(i+1,j,k-1)
+ | a = (s(l+1) - s(l))/(s(i+k-1) - s(i)), b = (s(l) - s(i))/(s(i+k-1) - s(i))
+ | c = -(s(l+1) - s(l))/(s(i+k) - s(i+1)), d = (s(i+k) - s(l))/(s(i+k) - s(i+1))
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+mi_nu_compute_nurb_basis_function( order, span, knots, kr, C )
+ ddUSHORT order;
+ int span;
+ ddFLOAT *knots;
+ ddFLOAT kr[][MAXORD]; /* reciprocal of knots diff */
+ double C[MAXORD][MAXORD];
+{
+ int i, j, k, m, im, degree = order - 1;
+ double t0, t1, t2, t3;
+
+ if ( order == 2 ) {
+ C[0][0] = 1.0;
+ C[0][1] = 0.0;
+ C[1][0] = -1.0;
+ C[1][1] = 1.0;
+ return;
+ }
+
+ /* Compute the coefficients of Nik in polynomial basis, for the span
+ * knots[i] to knots[i+1] where s goes from 0 to 1.0
+ */
+ t1 = knots[span+1] - knots[span];
+ C[0][degree] = 1.0; /* Ni1 = 1.0 within span */
+ for ( k = 1; k < order; k++ ) { /* recurse on order for Cj,i,k */
+ t0 = t1 * kr[span-k+1][k];
+ im = degree - k;
+ C[0][im] = t0 * C[0][im+1]; /* top left coeff */
+ for ( j = k-1; j > 0; j-- )
+ C[j][im] = t0 * ( C[j][im+1] - C[j-1][im+1] ); /*middle*/
+ C[k][im] = -t0 * C[k-1][im+1]; /* top right coeff */
+ for (m=k-1; m>0; m--) { /* central section */
+ i = span - m; /* right edge first */
+ im = degree - m;
+ C[k][im] = t1 * (kr[i][k] * C[k-1][im] - kr[i+1][k] * C[k-1][im+1]);
+ t2 = knots[i+k+1] - knots[span];
+ t3 = knots[span] - knots[i];
+ for ( j = k-1; j > 0; j-- ) /* then j down to 1 */
+ C[j][im] =
+ kr[i][k] * (t1 * C[j-1][im]
+ + t3 * C[j][im])
+ + kr[i+1][k] * (t2 * C[j][im+1] - t1 * C[j-1][im+1]);
+ C[0][im] = kr[i][k] * t3 * C[0][im]
+ + kr[i+1][k] * t2 * C[0][im+1]; /* left edge */
+ }
+ t0 = t1 * kr[span][k]; /* bottom rt,middle coeffs */
+ for ( j = k; j > 0; j-- )
+ C[j][degree] = t0 * C[j-1][degree];
+ C[0][degree] = 0.0; /* bottom left coeff */
+ }
+}
+
+
+
+/*++
+ |
+ | Function Name: mi_nu_insert_knots
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+int
+mi_nu_insert_knots( order, pt_type,
+ numinknots, oknots, opoints,
+ numoutknots, nknots, npoints )
+ ddUSHORT order;
+ ddPointType pt_type;
+ ddUSHORT numinknots;
+ ddFLOAT *oknots; /* original knots */
+ ddFLOAT *opoints; /* original control points */
+ int *numoutknots;
+ ddFLOAT *nknots; /* new knots */
+ ddFLOAT *npoints; /* new control points */
+{
+ /*
+ * Assumptions: - inserted knots are within range of original knots.
+ */
+ int i, k, iok, ink, mult, num_pts;
+ int numtmpknots;
+ ddFLOAT *tmpknots;
+ ddFLOAT alpha, alph1;
+ ddCoord2D *npts2;
+ ddCoord3D *npts3;
+ ddCoord4D *npts4;
+
+ /* Check to see if new knots needed. Copy and return if not. */
+ if ( *numoutknots <= 0 ) {
+ *numoutknots = numinknots;
+ memcpy( (char *)nknots, (char *)oknots, (int)numinknots * sizeof(ddFLOAT) );
+ return 1;
+ }
+
+ /* Copy old control points into new space. */
+ num_pts = numinknots - order;
+ if ( DD_IsVert2D(pt_type) ) {
+ memcpy( (char *)npoints, (char *)opoints, num_pts * sizeof(ddCoord2D));
+ npts2 = (ddCoord2D *)npoints;
+ } else if ( DD_IsVert3D(pt_type) ) {
+ memcpy( (char *)npoints, (char *)opoints, num_pts * sizeof(ddCoord3D));
+ npts3 = (ddCoord3D *)npoints;
+ } else if ( DD_IsVert4D(pt_type) ) {
+ memcpy( (char *)npoints, (char *)opoints, num_pts * sizeof(ddCoord4D));
+ npts4 = (ddCoord4D *)npoints;
+ } else return (1);
+
+ if ( !(tmpknots = (ddFLOAT *)
+ xalloc( (numinknots + *numoutknots) * sizeof(float))) )
+ return 0;
+
+ /* Insert new knots and control points, starting from the end of the
+ * original lists.
+ */
+ memcpy( (char *)tmpknots, (char *)oknots, (int)numinknots * sizeof(ddFLOAT) );
+ numtmpknots = numinknots;
+ ink = *numoutknots;
+ iok = numinknots - 1;
+
+ while ( ink > 0 ) {
+
+ mult = 1;
+ --ink;
+ /* Count mutiplicity of the new knot to be inserted. */
+ while ( ink > 0 && nknots[ink] == nknots[ink-1] ) {
+ ++mult;
+ --ink;
+ }
+
+ /* Find position of knot(s) to insert. */
+ while ( iok >= 0 && tmpknots[iok] >= nknots[ink] )
+ --iok;
+
+ /* Move control points down to make space for inserted ones.
+ * Use memove so that the overlap is handled.
+ */
+ /* note that the funky &blah[...] notation is equivalent
+ to blah+... since blah is a pointer. JSH 4-10-91
+ */
+ if ( DD_IsVert2D(pt_type) )
+ memmove((char *)(&npts2[iok + 1 + mult]),(char *)(&npts2[iok + 1]),
+ ((num_pts - iok) - 1) * sizeof(ddCoord2D) );
+ else if ( DD_IsVert3D(pt_type) )
+ memmove((char *)(&npts3[iok + 1 + mult]),(char *)(&npts3[iok + 1]),
+ ((num_pts - iok) - 1) * sizeof(ddCoord3D) );
+ else
+ memmove((char *)(&npts4[iok + 1 + mult]),(char *)(&npts4[iok + 1]),
+ ((num_pts - iok) - 1) * sizeof(ddCoord4D) );
+
+ /* Do de Boor to insert new knot with multiplicity `mult'. */
+ if ( DD_IsVert2D(pt_type) ) {
+ for ( k = 1; k <= mult; k++ ) {
+ /* Move pts down recursively. */
+ for ( i = iok + k; i > iok; i-- ) {
+ npts2[i].x = npts2[i-1].x;
+ npts2[i].y = npts2[i-1].y;
+/********************************************************
+ if ( rat == PRATIONAL )
+ npts2[i].z = npts2[i-1].z;
+********************************************************/
+ }
+ for ( i = iok; i > iok - order + k; i-- ) {
+ alpha = (nknots[ink] - tmpknots[i])
+ / (tmpknots[i + order - k] - tmpknots[i]);
+ alph1 = 1.0 - alpha;
+ npts2[i].x = alpha * npts2[i].x + alph1 * npts2[i-1].x;
+ npts2[i].y = alpha * npts2[i].y + alph1 * npts2[i-1].y;
+/********************************************************
+ if ( rat == PRATIONAL )
+ npts2[i].z = alpha * npts2[i].z + alph1 * npts2[i-1].z;
+********************************************************/
+ }
+ }
+
+ } else if ( DD_IsVert3D(pt_type) ) { /* dim is 3 */
+ for ( k = 1; k <= mult; k++ ) {
+ for ( i = iok + k; i > iok; i-- ) {
+ npts3[i].x = npts3[i-1].x;
+ npts3[i].y = npts3[i-1].y;
+ npts3[i].z = npts3[i-1].z;
+ }
+ for ( i = iok; i > iok - order + k; i-- ) {
+ alpha = (nknots[ink] - tmpknots[i])
+ / (tmpknots[i + order - k] - tmpknots[i]);
+ alph1 = 1.0 - alpha;
+ npts3[i].x = alpha * npts3[i].x + alph1 * npts3[i-1].x;
+ npts3[i].y = alpha * npts3[i].y + alph1 * npts3[i-1].y;
+ npts3[i].z = alpha * npts3[i].z + alph1 * npts3[i-1].z;
+ }
+ }
+ } else /* if ( DD_IsVert4D(pt_type) ) */ { /* dim is 4 */
+ for ( k = 1; k <= mult; k++ ) {
+ for ( i = iok + k; i > iok; i-- ) {
+ npts4[i].x = npts4[i-1].x;
+ npts4[i].y = npts4[i-1].y;
+ npts4[i].z = npts4[i-1].z;
+ npts4[i].w = npts4[i-1].w;
+ }
+ for ( i = iok; i > iok - order + k; i-- ) {
+ alpha = (nknots[ink] - tmpknots[i])
+ / (tmpknots[i + order - k] - tmpknots[i]);
+ alph1 = 1.0 - alpha;
+ npts4[i].x = alpha * npts4[i].x + alph1 * npts4[i-1].x;
+ npts4[i].y = alpha * npts4[i].y + alph1 * npts4[i-1].y;
+ npts4[i].z = alpha * npts4[i].z + alph1 * npts4[i-1].z;
+ npts4[i].w = alpha * npts4[i].w + alph1 * npts4[i-1].w;
+ }
+ }
+ }
+
+ /* Total number of points and knots increased by `mult'. */
+ for ( k = numtmpknots - 1; k > iok; k-- )
+ tmpknots[k + mult] = tmpknots[k];
+ for ( k = 1; k <= mult; k++ )
+ tmpknots[iok + k] = nknots[ink];
+ numtmpknots += mult;
+ num_pts +=mult;
+ }
+
+
+ /* copy results into output buffers */
+ *numoutknots = numtmpknots; /* resulting total knots */
+ memcpy( (char *)nknots, (char *)tmpknots, numtmpknots * sizeof(ddFLOAT) );
+
+ xfree( (char *)tmpknots );
+ return 1;
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c
new file mode 100644
index 000000000..2c9b78133
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c
@@ -0,0 +1,1614 @@
+/* $TOG: miOCs.c /main/7 1998/02/10 12:42:05 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c,v 3.5 1998/10/04 09:34:24 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "ddpex2.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "gcstruct.h"
+#include "miLight.h"
+#include "pexos.h"
+
+
+/* Level II Output Command Attributes */
+
+/*
+ * Marker type
+ */
+ddpex2rtn
+miMarkerType(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexMarkerType *pMT = (pexMarkerType *)(pOC+1);
+
+ pddc->Dynamic->pPCAttr->markerType = pMT->markerType;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerTypeAsf) != PEXBundled)
+ pddc->Static.attrs->markerType = pMT->markerType;
+
+ return(Success);
+}
+
+/*
+ * Marker scale
+ */
+ddpex2rtn
+miMarkerScale(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexMarkerScale *pMS = (pexMarkerScale *)(pOC+1);
+
+ pddc->Dynamic->pPCAttr->markerScale = pMS->scale;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerScaleAsf) != PEXBundled)
+ pddc->Static.attrs->markerScale = pMS->scale;
+
+ return(Success);
+}
+
+/*
+ * Marker Bundle Index
+ */
+ddpex2rtn
+miMarkerBundleIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexMarkerBundleIndex *pMBI = (pexMarkerBundleIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pddc->Dynamic->pPCAttr->markerIndex != pMBI->index) {
+ pddc->Dynamic->pPCAttr->markerIndex = pMBI->index;
+
+ namesets = attrs = 0;
+ tables = PEXDynMarkerBundle;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ }
+ return(Success);
+}
+
+/*
+ * Text Font Index
+ */
+ddpex2rtn
+miTextFontIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexTextFontIndex *pMBI = (pexTextFontIndex *)(pOC+1);
+ pddc->Dynamic->pPCAttr->textFont = pMBI->index;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextFontIndexAsf) != PEXBundled)
+ pddc->Static.attrs->textFont = pMBI->index;
+ return(Success);
+}
+
+/*
+ * Text Precision
+ */
+ddpex2rtn
+miTextPrecision(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexTextPrecision *pMBI = (pexTextPrecision *)(pOC+1);
+ pddc->Dynamic->pPCAttr->textPrecision = pMBI->precision;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextPrecAsf) != PEXBundled)
+ pddc->Static.attrs->textPrecision = pMBI->precision;
+ return(Success);
+}
+
+/*
+ * Character Expansion
+ */
+ddpex2rtn
+miCharExpansion(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCharExpansion *pMBI = (pexCharExpansion *)(pOC+1);
+ pddc->Dynamic->pPCAttr->charExpansion = pMBI->expansion;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXCharExpansionAsf) != PEXBundled)
+ pddc->Static.attrs->charExpansion = pMBI->expansion;
+ return(Success);
+}
+
+/*
+ * Character Spacing
+ */
+ddpex2rtn
+miCharSpacing(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCharSpacing *pMBI = (pexCharSpacing *)(pOC+1);
+ pddc->Dynamic->pPCAttr->charSpacing = pMBI->spacing;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXCharSpacingAsf) != PEXBundled)
+ pddc->Static.attrs->charSpacing = pMBI->spacing;
+ return(Success);
+}
+
+/*
+ * Character Height
+ */
+ddpex2rtn
+miCharHeight(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCharHeight *pMBI = (pexCharHeight *)(pOC+1);
+ pddc->Dynamic->pPCAttr->charHeight = pMBI->height;
+ pddc->Static.attrs->charHeight = pMBI->height;
+ return(Success);
+}
+
+/*
+ * Character Up Vector
+ */
+ddpex2rtn
+miCharUpVector(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCharUpVector *pMBI = (pexCharUpVector *)(pOC+1);
+ pddc->Dynamic->pPCAttr->charUp.x = pMBI->up.x;
+ pddc->Dynamic->pPCAttr->charUp.y = pMBI->up.y;
+ pddc->Static.attrs->charUp = pddc->Dynamic->pPCAttr->charUp;
+ return(Success);
+}
+
+/*
+ * Text Path
+ */
+ddpex2rtn
+miTextPath(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexTextPath *pMBI = (pexTextPath *)(pOC+1);
+ pddc->Dynamic->pPCAttr->textPath = pMBI->path;
+ pddc->Static.attrs->textPath = pMBI->path;
+ return(Success);
+}
+
+/*
+ * Text Alignment
+ */
+ddpex2rtn
+miTextAlignment(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexTextAlignment *pMBI = (pexTextAlignment *)(pOC+1);
+ pddc->Dynamic->pPCAttr->textAlignment.vertical =
+ (ddUSHORT) pMBI->alignment.vertical;
+ pddc->Dynamic->pPCAttr->textAlignment.horizontal =
+ (ddUSHORT) pMBI->alignment.horizontal;
+ pddc->Static.attrs->textAlignment =
+ pddc->Dynamic->pPCAttr->textAlignment;
+
+ return(Success);
+}
+
+/*
+ * Annotation Text Height
+ */
+ddpex2rtn
+miAtextHeight(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAtextHeight *pMBI = (pexAtextHeight *)(pOC+1);
+ pddc->Dynamic->pPCAttr->atextHeight = pMBI->height;
+ pddc->Static.attrs->atextHeight = pMBI->height;
+ return(Success);
+}
+
+/*
+ * Annotation Text Up Vector
+ */
+ddpex2rtn
+miAtextUpVector(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAtextUpVector *pMBI = (pexAtextUpVector *)(pOC+1);
+ pddc->Dynamic->pPCAttr->atextUp.x = pMBI->up.x;
+ pddc->Dynamic->pPCAttr->atextUp.y = pMBI->up.y;
+ pddc->Static.attrs->atextUp = pddc->Dynamic->pPCAttr->atextUp;
+ return(Success);
+}
+
+/*
+ * Annotation Text Path
+ */
+ddpex2rtn
+miAtextPath(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAtextPath *pMBI = (pexAtextPath *)(pOC+1);
+ pddc->Dynamic->pPCAttr->atextPath = pMBI->path;
+ pddc->Static.attrs->atextPath = pMBI->path;
+ return(Success);
+}
+
+/*
+ * Annotation Text Alignment
+ */
+ddpex2rtn
+miAtextAlignment(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAtextAlignment *pMBI = (pexAtextAlignment *)(pOC+1);
+ pddc->Dynamic->pPCAttr->atextAlignment.vertical =
+ (ddUSHORT) pMBI->alignment.vertical;
+ pddc->Dynamic->pPCAttr->atextAlignment.horizontal =
+ (ddUSHORT) pMBI->alignment.horizontal;
+ pddc->Static.attrs->atextAlignment =
+ pddc->Dynamic->pPCAttr->atextAlignment;
+ return(Success);
+}
+
+/*
+ * Annotation Text Style
+ */
+ddpex2rtn
+miAtextStyle(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAtextStyle *pMT = (pexAtextStyle *)(pOC+1);
+ pddc->Dynamic->pPCAttr->atextStyle = pMT->style;
+ pddc->Static.attrs->atextStyle = pMT->style;
+ return(Success);
+}
+
+/*
+ * Text Bundle Index
+ */
+ddpex2rtn
+miTextBundleIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexTextBundleIndex *pTBI = (pexTextBundleIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pddc->Dynamic->pPCAttr->textIndex != pTBI->index) {
+ pddc->Dynamic->pPCAttr->textIndex = pTBI->index;
+
+ namesets = attrs = 0;
+ tables = PEXDynTextBundle;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ }
+ return(Success);
+}
+
+/*
+ * Line type (Dashing style)
+ */
+ddpex2rtn
+miLineType(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexLineType *pLT = (pexLineType *)(pOC+1);
+ pddc->Dynamic->pPCAttr->lineType = pLT->lineType;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineTypeAsf) != PEXBundled) {
+ pddc->Static.attrs->lineType = pLT->lineType;
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ }
+ return(Success);
+}
+
+
+/*
+ * Line Width
+ */
+ddpex2rtn
+miLineWidth(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexLineWidth *pLW = (pexLineWidth *)(pOC+1);
+ pddc->Dynamic->pPCAttr->lineWidth = pLW->width;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineWidthAsf) != PEXBundled) {
+ pddc->Static.attrs->lineWidth = pLW->width;
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ }
+ return(Success);
+}
+
+/*
+ * Line Bundle Index
+ */
+ddpex2rtn
+miLineBundleIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexLineBundleIndex *pLBI = (pexLineBundleIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pddc->Dynamic->pPCAttr->lineIndex != pLBI->index) {
+ pddc->Dynamic->pPCAttr->lineIndex = pLBI->index;
+
+ namesets = attrs = 0;
+ tables = PEXDynLineBundle;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ }
+ return(Success);
+}
+
+/*
+ * curve approximation method
+ */
+ddpex2rtn
+miCurveApproximation(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCurveApproximation *pCA = (pexCurveApproximation *)(pOC+1);
+ pddc->Dynamic->pPCAttr->curveApprox.approxMethod = pCA->approx.approxMethod;
+ pddc->Dynamic->pPCAttr->curveApprox.tolerance = pCA->approx.tolerance;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineWidthAsf) != PEXBundled)
+ pddc->Static.attrs->curveApprox=pddc->Dynamic->pPCAttr->curveApprox;
+
+ return(Success);
+}
+
+
+/*
+ * Surface interior style
+ */
+ddpex2rtn
+miInteriorStyle(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexInteriorStyle *pIS = (pexInteriorStyle *)(pOC+1);
+ pddc->Dynamic->pPCAttr->intStyle = pIS->interiorStyle;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXInteriorStyleAsf) != PEXBundled) {
+ pddc->Static.attrs->intStyle = pIS->interiorStyle;
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+ return(Success);
+}
+
+/*
+ * Depth Cue Bundle Index
+ */
+ddpex2rtn
+miDepthCueIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexDepthCueIndex *pDCI = (pexDepthCueIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ pddc->Dynamic->pPCAttr->depthCueIndex = pDCI->index;
+
+ /* Mark as invalid cc version of depth cue entry in dd context */
+ pddc->Static.misc.flags |= CC_DCUEVERSION;
+
+ namesets = attrs = 0;
+ tables = PEXDynDepthCueTableContents;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+
+ return(Success);
+}
+
+/*
+ * Interior Bundle Index
+ */
+ddpex2rtn
+miInteriorBundleIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexInteriorBundleIndex *pIBI = (pexInteriorBundleIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pddc->Dynamic->pPCAttr->intIndex != pIBI->index) {
+ pddc->Dynamic->pPCAttr->intIndex = pIBI->index;
+
+ namesets = attrs = 0;
+ tables = PEXDynInteriorBundle;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ }
+ return(Success);
+}
+
+/*
+ * Surface reflection attributes
+ */
+ddpex2rtn
+miSurfaceReflAttr(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceReflAttr *pSRA = (pexSurfaceReflAttr *)(pOC+1);
+ ddColourSpecifier *pSC =
+ (ddColourSpecifier *)&pSRA->reflectionAttr.specularColour;
+
+ pddc->Dynamic->pPCAttr->reflAttr.ambient =
+ (ddFLOAT)pSRA->reflectionAttr.ambient;
+ pddc->Dynamic->pPCAttr->reflAttr.diffuse =
+ (ddFLOAT)pSRA->reflectionAttr.diffuse;
+ pddc->Dynamic->pPCAttr->reflAttr.specular =
+ (ddFLOAT)pSRA->reflectionAttr.specular;
+ pddc->Dynamic->pPCAttr->reflAttr.specularConc =
+ (ddFLOAT)pSRA->reflectionAttr.specularConc;
+ pddc->Dynamic->pPCAttr->reflAttr.transmission =
+ (ddFLOAT)pSRA->reflectionAttr.transmission;
+
+ switch (pddc->Dynamic->pPCAttr->reflAttr.specularColour.colourType =
+ pSC->colourType) {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.indexed =
+ pSC->colour.indexed;
+ break;
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgbFloat =
+ pSC->colour.rgbFloat;
+ break;
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgb8 =
+ pSC->colour.rgb8;
+ break;
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgb16 =
+ pSC->colour.rgb16;
+ break;
+ }
+
+ /* Update DDC rendering attributes if not bundled */
+ if((pddc->Dynamic->pPCAttr->asfs & PEXReflectionAttrAsf) != PEXBundled)
+ pddc->Static.attrs->reflAttr = pddc->Dynamic->pPCAttr->reflAttr;
+
+ return(Success);
+}
+/*
+ * Surface reflection model
+ */
+ddpex2rtn
+miSurfaceReflModel(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceReflModel *pSRM = (pexSurfaceReflModel *)(pOC+1);
+ pddc->Dynamic->pPCAttr->reflModel = pSRM->reflectionModel;
+ /* Update DDC rendering attributes if not bundled */
+ if((pddc->Dynamic->pPCAttr->asfs & PEXReflectionModelAsf)!=PEXBundled)
+ pddc->Static.attrs->reflModel = pSRM->reflectionModel;
+ return(Success);
+}
+
+/*
+ * Surface interpolation scheme
+ */
+ddpex2rtn
+miSurfaceInterp(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceInterp *pSI = (pexSurfaceInterp *)(pOC+1);
+ pddc->Dynamic->pPCAttr->surfInterp = pSI->surfaceInterp;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceInterpAsf) != PEXBundled)
+ pddc->Static.attrs->surfInterp = pSI->surfaceInterp;
+ return(Success);
+}
+
+/*
+ * Surface approximation criteria
+ */
+ddpex2rtn
+miSurfaceApproximation(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceApproximation *pSA = (pexSurfaceApproximation *)(pOC+1);
+ pddc->Dynamic->pPCAttr->surfApprox.approxMethod = pSA->approx.approxMethod;
+ pddc->Dynamic->pPCAttr->surfApprox.uTolerance = pSA->approx.uTolerance;
+ pddc->Dynamic->pPCAttr->surfApprox.vTolerance = pSA->approx.vTolerance;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceApproxAsf) != PEXBundled)
+ pddc->Static.attrs->surfApprox = pddc->Dynamic->pPCAttr->surfApprox;
+ return(Success);
+}
+
+/*
+ * Cull back or front facing facets.
+ */
+ddpex2rtn
+miCullingMode(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexCullingMode *pCM = (pexCullingMode *)(pOC+1);
+ pddc->Dynamic->pPCAttr->cullMode = pCM->cullMode;
+ return(Success);
+}
+
+/*
+ * Surface edge flag (enable/disable dispaly of fill area edges)
+ */
+ddpex2rtn
+miSurfaceEdgeFlag(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceEdgeFlag *pSEF = (pexSurfaceEdgeFlag *)(pOC+1);
+ pddc->Dynamic->pPCAttr->edges = pSEF->onoff;
+ /*set the dd context edge visibility flag if not a bundled attribute*/
+ if((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgesAsf) != PEXBundled) {
+ pddc->Static.attrs->edges = pSEF->onoff;
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ }
+ return(Success);
+}
+/*
+ * Surface edge type (Dashing style)
+ */
+ddpex2rtn
+miSurfaceEdgeType(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceEdgeType *pSET = (pexSurfaceEdgeType *)(pOC+1);
+ pddc->Dynamic->pPCAttr->edgeType = pSET->edgeType;
+ /* Update DDC rendering attributes if not bundled */
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeTypeAsf)!=PEXBundled) {
+ pddc->Static.attrs->edgeType = pSET->edgeType;
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ }
+ return(Success);
+}
+
+
+/*
+ * Surface edge Width
+ */
+ddpex2rtn
+miSurfaceEdgeWidth(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSurfaceEdgeWidth *pSEW = (pexSurfaceEdgeWidth *)(pOC+1);
+ pddc->Dynamic->pPCAttr->edgeWidth = pSEW->width;
+ /* Update DDC rendering attributes if not bundled */
+ if((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeWidthAsf)!=PEXBundled) {
+ pddc->Static.attrs->edgeWidth = pSEW->width;
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ }
+ return(Success);
+}
+/*
+ * Surface edge Bundle Index
+ */
+ddpex2rtn
+miEdgeBundleIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexEdgeBundleIndex *pEBI = (pexEdgeBundleIndex *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pddc->Dynamic->pPCAttr->edgeIndex != pEBI->index) {
+ pddc->Dynamic->pPCAttr->edgeIndex = pEBI->index;
+
+ namesets = attrs = 0;
+ tables = PEXDynEdgeBundle;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ }
+ return(Success);
+}
+
+/*
+ * Set ASF values
+ */
+ddpex2rtn
+miSetAsfValues(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexSetAsfValues *pSAV = (pexSetAsfValues *)(pOC+1);
+ ddBitmask tables, namesets, attrs;
+
+ if (pSAV->source == PEXBundled) { /* Note that PEXBundled == 0 */
+ pddc->Dynamic->pPCAttr->asfs &= ~(pSAV->attribute);
+
+ } else {
+ pddc->Dynamic->pPCAttr->asfs |= pSAV->attribute;
+
+ }
+
+ /* changing the table behaves the same as changing
+ * the asf, so use that for ValidateDDContext
+ */
+ tables = namesets = attrs = 0;
+ if (pSAV->attribute & ( PEXMarkerTypeAsf |
+ PEXMarkerScaleAsf |
+ PEXMarkerColourAsf))
+ tables |= PEXDynMarkerBundle;
+ if (pSAV->attribute & (PEXTextFontIndexAsf |
+ PEXTextPrecAsf |
+ PEXCharExpansionAsf |
+ PEXCharSpacingAsf |
+ PEXTextColourAsf))
+ tables |= PEXDynTextBundle;
+ if (pSAV->attribute & (PEXLineTypeAsf |
+ PEXLineWidthAsf |
+ PEXLineColourAsf |
+ PEXCurveApproxAsf |
+ PEXPolylineInterpAsf))
+ tables |= PEXDynLineBundle;
+ if (pSAV->attribute & (PEXInteriorStyleAsf |
+ PEXInteriorStyleIndexAsf |
+ PEXSurfaceColourAsf |
+ PEXSurfaceInterpAsf |
+ PEXReflectionModelAsf |
+ PEXReflectionAttrAsf |
+ PEXBfInteriorStyleAsf |
+ PEXBfInteriorStyleIndexAsf |
+ PEXBfSurfaceColourAsf |
+ PEXBfSurfaceInterpAsf |
+ PEXBfReflectionModelAsf |
+ PEXBfReflectionAttrAsf |
+ PEXSurfaceApproxAsf))
+ tables |= PEXDynInteriorBundle;
+ if (pSAV->attribute & ( PEXSurfaceEdgeTypeAsf |
+ PEXSurfaceEdgeWidthAsf |
+ PEXSurfaceEdgeColourAsf |
+ PEXSurfaceEdgesAsf ))
+ tables |= PEXDynEdgeBundle;
+
+ /* Re-initialize the dd context rendering attributes */
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+
+ return(Success);
+}
+
+/*
+ * Local transformations
+ */
+ddpex2rtn
+miLocalTransform(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexLocalTransform *pLT = (pexLocalTransform *)(pOC+1);
+
+ switch (pLT->compType) {
+ case PEXPreConcatenate:
+ miMatMult( pddc->Dynamic->pPCAttr->localMat,
+ pLT->matrix, pddc->Dynamic->pPCAttr->localMat);
+ break;
+ case PEXPostConcatenate:
+ miMatMult( pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->localMat, pLT->matrix);
+ break;
+ case PEXReplace:
+ memcpy( (char *)(pddc->Dynamic->pPCAttr->localMat),
+ (char *)(pLT->matrix),
+ 16*sizeof(ddFLOAT));
+ break;
+ }
+
+ /* Update composite transforms */
+ /* First, composite [CMM] */
+ miMatMult( pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ /* Next, composite [VCM] next */
+ miMatMult( pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_cc_xform);
+
+ /* Lastly, Compute the composite mc -> dc transform */
+ miMatMult( pddc->Dynamic->mc_to_dc_xform,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->cc_to_dc_xform);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);
+
+ return(Success);
+}
+
+ddpex2rtn
+miLocalTransform2D(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexLocalTransform2D *pLT = (pexLocalTransform2D *)(pOC+1);
+ ddFLOAT *s, *d;
+ ddFLOAT temp[4][4];
+
+ /*
+ * 2D -> 3D transform as follows:
+ *
+ * a d g a d 0 g
+ * b e h b e 0 h
+ * c f i 0 0 1 0
+ * c f 0 i
+ *
+ */
+ s = (ddFLOAT *)pLT->matrix3X3;
+ d = (ddFLOAT *)temp;
+
+ *d++ = *s++; /* [0][0] */
+ *d++ = *s++; /* [0][1] */
+ *d++ = 0.0; /* [0][2] */
+ *d++ = *s++; /* [0][3] */
+ *d++ = *s++; /* [1][0] */
+ *d++ = *s++; /* [1][1] */
+ *d++ = 0.0; /* [1][2] */
+ *d++ = *s++; /* [1][3] */
+ *d++ = 0.0; /* [2][0] */
+ *d++ = 0.0; /* [2][1] */
+ *d++ = 1.0; /* [2][2] */
+ *d++ = 0.0; /* [2][3] */
+ *d++ = *s++; /* [3][0] */
+ *d++ = *s++; /* [3][0] */
+ *d++ = 0.0; /* [3][0] */
+ *d++ = *s++; /* [3][0] */
+
+ switch (pLT->compType) {
+ case PEXPreConcatenate:
+ miMatMult( pddc->Dynamic->pPCAttr->localMat,
+ temp, pddc->Dynamic->pPCAttr->localMat);
+ break;
+ case PEXPostConcatenate:
+ miMatMult( pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->localMat, temp);
+ break;
+ case PEXReplace:
+ memcpy( (char *)(pddc->Dynamic->pPCAttr->localMat), (char *)temp,
+ 16*sizeof(ddFLOAT));
+ break;
+ }
+
+ /* Update composite transforms */
+ /* First, composite [CMM] */
+ miMatMult( pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ /* Next, composite [VCM] next */
+ miMatMult( pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_cc_xform);
+
+ /* Lastly, Compute the composite mc -> dc transform */
+ miMatMult( pddc->Dynamic->mc_to_dc_xform,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->cc_to_dc_xform);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);
+
+ return(Success);
+}
+
+
+/*
+ * Global transformations
+ */
+ddpex2rtn
+miGlobalTransform(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexGlobalTransform *pGT = (pexGlobalTransform *)(pOC+1);
+
+ memcpy( (char *)(pddc->Dynamic->pPCAttr->globalMat), (char *)(pGT->matrix),
+ 16 * sizeof(ddFLOAT));
+
+ /* Update composite transforms */
+ /* First, composite [CMM] */
+ miMatMult( pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ /* Next, composite [VCM] next */
+ miMatMult( pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_cc_xform);
+
+ /* Lastly, Compute the composite mc -> dc transform */
+ miMatMult( pddc->Dynamic->mc_to_dc_xform,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->cc_to_dc_xform);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);
+
+ return(Success);
+}
+
+ddpex2rtn
+miGlobalTransform2D(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexGlobalTransform2D *pGT = (pexGlobalTransform2D *)(pOC+1);
+ ddFLOAT *s, *d;
+
+ /*
+ * 2D -> 3D transform as follows:
+ *
+ * a d g a d 0 g
+ * b e h b e 0 h
+ * c f i 0 0 1 0
+ * c f 0 i
+ *
+ */
+ s = (ddFLOAT *)pGT->matrix3X3;
+ d = (ddFLOAT *)pddc->Dynamic->pPCAttr->globalMat;
+
+ *d++ = *s++; /* [0][0] */
+ *d++ = *s++; /* [0][1] */
+ *d++ = 0.0; /* [0][2] */
+ *d++ = *s++; /* [0][3] */
+ *d++ = *s++; /* [1][0] */
+ *d++ = *s++; /* [1][1] */
+ *d++ = 0.0; /* [1][2] */
+ *d++ = *s++; /* [1][3] */
+ *d++ = 0.0; /* [2][0] */
+ *d++ = 0.0; /* [2][1] */
+ *d++ = 1.0; /* [2][2] */
+ *d++ = 0.0; /* [2][3] */
+ *d++ = *s++; /* [3][0] */
+ *d++ = *s++; /* [3][0] */
+ *d++ = 0.0; /* [3][0] */
+ *d++ = *s++; /* [3][0] */
+
+ /* Update composite transforms */
+ /* First, composite [CMM] */
+ miMatMult( pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ /* Next, composite [VCM] next */
+ miMatMult( pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_cc_xform);
+
+ /* Lastly, Compute the composite mc -> dc transform */
+ miMatMult( pddc->Dynamic->mc_to_dc_xform,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Dynamic->cc_to_dc_xform);
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);
+
+ return(Success);
+}
+
+ddpex2rtn
+miModelClip(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexModelClip *pMC = (pexModelClip *)(pOC+1);
+ pddc->Dynamic->pPCAttr->modelClip = pMC->onoff;
+
+ return(Success);
+}
+
+
+
+ddpex2rtn
+miViewIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexViewIndex *pVI = (pexViewIndex *)(pOC+1);
+
+ /* first, make sure this is a new index */
+ if (pddc->Dynamic->pPCAttr->viewIndex == pVI->index) return(Success);
+
+ /* Copy new index into ddContext */
+ pddc->Dynamic->pPCAttr->viewIndex = pVI->index;
+
+ /* Now, update internal transform cache to reflect new index */
+ miBldCC_xform(pRend, pddc);
+
+ return(Success);
+}
+
+
+
+ddpex2rtn
+miPickId(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexPickId *pPI = (pexPickId *)(pOC+1);
+
+ pddc->Dynamic->pPCAttr->pickId = pPI->pickId;
+ return(Success);
+}
+
+
+ddpex2rtn
+miColourApproxIndex(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexColourApproxIndex *pCAI = (pexColourApproxIndex *)(pOC+1);
+ pddc->Dynamic->pPCAttr->colourApproxIndex = pCAI->index;
+ return(Success);
+}
+
+
+ddpex2rtn
+miRenderingColourModel(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexRenderingColourModel *pRCM = (pexRenderingColourModel *)(pOC+1);
+ pddc->Dynamic->pPCAttr->rdrColourModel = pRCM->model;
+ return(Success);
+}
+
+
+ddpex2rtn
+miParaSurfCharacteristics(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miPSurfaceCharsStruct *pPSC = (miPSurfaceCharsStruct *)(pOC+1);
+ switch (pddc->Dynamic->pPCAttr->psc.type = pPSC->type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+ case PEXPSCIsoCurves:
+ pddc->Dynamic->pPCAttr->psc.data.isoCurves = *pPSC->data.pIsoCurves;
+ break;
+ case PEXPSCMcLevelCurves:
+ /* Note that level curves are not implemented */
+ pddc->Dynamic->pPCAttr->psc.data.mcLevelCurves =
+ *pPSC->data.pMcLevelCurves;
+ break;
+ case PEXPSCWcLevelCurves:
+ /* Note that level curves are not implemented */
+ pddc->Dynamic->pPCAttr->psc.data.wcLevelCurves =
+ *pPSC->data.pWcLevelCurves;
+ break;
+ default:
+ break;
+ }
+ return(Success);
+
+}
+
+ddpex2rtn
+miAddToNameSet(pRend, pOC) /* and RemoveNameFromNameSet */
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ pexAddToNameSet *pANS = (pexAddToNameSet *)(pOC+1);
+ ddULONG *pName = (ddULONG *)(pANS + 1);
+ register int num = (pANS->head.length) - 1;
+ ddUSHORT save_flags = pddc->Dynamic->filter_flags;
+ ddBitmask namesets;
+ extern void ValidateFilters();
+
+ for (; num>0; num--, pName++)
+ /* ignore values that are out of range */
+ if ( MINS_VALID_NAME(*pName) ) {
+ if (pANS->head.elementType == PEXOCAddToNameSet) {
+ MINS_ADD_TO_NAMESET(*pName, pddc->Dynamic->currentNames);
+ } else {
+ MINS_REMOVE_FROM_NAMESET(*pName, pddc->Dynamic->currentNames);
+ }
+ }
+
+ /* changing current namesset, so update all filters */
+ namesets = PEXDynHighlightNameset |
+ PEXDynInvisibilityNameset |
+ PEXDynHighlightNamesetContents |
+ PEXDynInvisibilityNamesetContents;
+
+
+ ValidateFilters(pRend, pddc, namesets);
+
+ return(Success);
+}
+
+
+ddpex2rtn
+miExecuteStructure(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ extern void execute_structure_OC();
+
+ execute_structure_OC(pRend, (pexExecuteStructure *)(pOC+1));
+ return(Success);
+}
+
+
+ddpex2rtn
+miNoop(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+ return (Success);
+}
+
+
+ddpex2rtn
+miUndefined(pRend, pOC)
+ ddRendererPtr pRend;
+ miGenericStr *pOC;
+{
+#ifdef PR_INFO
+ ErrorF( "Attribute is not implemented\n");
+#endif
+ return (PEXNYI);
+}
+
+
+
+/*++
+ |
+ | Function Name: miLightStateOC
+ |
+ | Function Description:
+ | Handles PEXOCLightState OC
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miLightStateOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miLightStateStruct *pLS = (miLightStateStruct *)(pOC+1);
+ ddUSHORT *ptr;
+ int i;
+
+ /*
+ * Merge in a new set of light source indices
+ */
+ if (pLS->enableList->numObj > 0)
+ puMergeLists( pddc->Dynamic->pPCAttr->lightState, pLS->enableList,
+ pddc->Dynamic->pPCAttr->lightState);
+
+ if (pLS->disableList->numObj > 0)
+ for (i = pLS->disableList->numObj,
+ ptr = (ddUSHORT *)pLS->disableList->pList;
+ i > 0;
+ --i, ptr++)
+ puRemoveFromList(ptr, pddc->Dynamic->pPCAttr->lightState);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: SetMCVolume
+ |
+ | Function Description:
+ | Handles Handles SetModelClipVolume and
+ | SetModelClipVolume2D OCs
+ |
+ | Note(s): Although model clipping half spaces are specified
+ | in modelling space, the pipeline stores the current clipping
+ | volume in world coordinates. This is because the modelling
+ | transformation matrix can change independently of this particular
+ | OC, and world coordinates are the the only common coordinates to
+ | intersect. HOWEVER, when model clipping is enabled, this
+ | intersect volume is transferred BACK to model space and stored
+ | in pddc->Static->ms_MCV for the actual clipping. This is done
+ | in order to "prune" out as many primitives as early as possible
+ | in the pipeline.
+ |
+ | Whenever the modelling transformation matrix is changed, or
+ | when a new renderer is created, the model space version of
+ | the model clipping volume is invalidated; the world
+ | coordinate volume is the "reference." The validation flag is
+ | the INVMCXFRMFLAG defined in ddpex/mi/include/miRender.h
+ |
+ --*/
+ddpex2rtn
+miSetMCVolume(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miMCVolume_Struct *OC_MCV = (miMCVolume_Struct *)(pOC+1);
+ listofObj *pc_MCV;
+ ddHalfSpace *OC_HS, tmp_HS;
+ int i, count;
+ ddFLOAT length;
+
+ static ddFLOAT vect_xform[4][4];
+
+
+ pc_MCV = pddc->Dynamic->pPCAttr->modelClipVolume;
+ if (!(OC_MCV->operator == PEXModelClipIntersection)) pc_MCV->numObj = 0;
+ /* invalidate flag */
+ pddc->Static.misc.flags |= MCVOLUMEFLAG;
+
+
+ /* overwrite list */
+ OC_HS = (ddHalfSpace *)(OC_MCV->halfspaces->pList);
+ count = OC_MCV->halfspaces->numObj;
+ for(i = 0; i < count; i++) {
+
+ /* transform ref point and vector to world coords */
+ /* transform ref point */
+
+ miTransformPoint(&OC_HS->orig_point, pddc->Dynamic->mc_to_wc_xform,
+ &tmp_HS.point);
+
+ /* transform ref vector
+ * Vectors are transformed using the inverse transpose
+ */
+
+ miMatCopy(pddc->Dynamic->mc_to_wc_xform,
+ vect_xform);
+
+ miMatInverse(vect_xform);
+
+ miMatTranspose(vect_xform);
+
+ miTransformVector(&OC_HS->orig_vector, vect_xform,
+ &tmp_HS.vector);
+
+ puAddToList(&tmp_HS, 1, pc_MCV);
+ OC_HS++;
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miRestoreMCV
+ |
+ | Function Description:
+ | Restores the model clipping volume to that of the
+ | parent, or nil if this is the first structure.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miRestoreMCV(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+{
+
+
+ miDDContext *thispddc = (miDDContext *)(pRend->pDDContext);
+ miDynamicDDContext *parentpddc =
+ (miDynamicDDContext *)(thispddc->Dynamic->next);
+
+ if (!(thispddc->Dynamic->next)) /* First structure */
+ thispddc->Dynamic->pPCAttr->modelClipVolume->numObj = 0;
+ else {
+ /* invalidate flag */
+ thispddc->Static.misc.flags |= MCVOLUMEFLAG;
+ if (puCopyList(parentpddc->pPCAttr->modelClipVolume,
+ thispddc->Dynamic->pPCAttr->modelClipVolume ))
+
+ return (BadAlloc);
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miMarkerColourOC
+ |
+ | Function Description:
+ | Handles PEXOCMarkerColourIndex and PEXOCMarkerColour.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miMarkerColourOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ ddpex3rtn miConvertColor();
+
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miColourStruct *pMC = (miColourStruct *)(pOC+1);
+
+
+ switch (pddc->Dynamic->pPCAttr->markerColour.colourType = pMC->colourType)
+ {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->markerColour.colour.indexed =
+ *pMC->colour.pIndex;
+ break;
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->markerColour.colour.rgbFloat =
+ *pMC->colour.pRgbFloat;
+ break;
+
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->markerColour.colour.rgb8 =
+ *pMC->colour.pRgb8;
+ break;
+
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->markerColour.colour.rgb16 =
+ *pMC->colour.pRgb16;
+ break;
+ }
+
+ if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerColourAsf) != PEXBundled) {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->markerColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->markerColour);
+ pddc->Static.misc.flags |= MARKERGCFLAG;
+ }
+ }
+ return(Success);
+}
+
+
+/*++
+ |
+ | Function Name: miTextColourOC
+ |
+ | Function Description:
+ | Handles PEXOCTextColourIndex and PEXOCTextColour.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miTextColourOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ ddpex3rtn miConvertColor();
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miColourStruct *pTC = (miColourStruct *)(pOC+1);
+
+ switch (pddc->Dynamic->pPCAttr->textColour.colourType = pTC->colourType)
+ {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->textColour.colour.indexed =
+ *pTC->colour.pIndex;
+ break;
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->textColour.colour.rgbFloat =
+ *pTC->colour.pRgbFloat;
+ break;
+
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->textColour.colour.rgb8 =
+ *pTC->colour.pRgb8;
+ break;
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->textColour.colour.rgb16 =
+ *pTC->colour.pRgb16;
+ break;
+ }
+
+ if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXTextColourAsf) != PEXBundled) {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->textColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->textColour);
+ pddc->Static.misc.flags |= TEXTGCFLAG;
+ }
+ }
+ return(Success);
+}
+
+
+/*++
+ |
+ | Function Name: miLineColourOC
+ |
+ | Function Description:
+ | Handles PEXOCLineColourIndex and PEXOCLineColour.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miLineColourOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ ddpex3rtn miConvertColor();
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miColourStruct *pLC = (miColourStruct *)(pOC+1);
+
+ switch (pddc->Dynamic->pPCAttr->lineColour.colourType = pLC->colourType)
+ {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->lineColour.colour.indexed =
+ *pLC->colour.pIndex;
+ break;
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->lineColour.colour.rgbFloat =
+ *pLC->colour.pRgbFloat;
+ break;
+
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->lineColour.colour.rgb8 = *pLC->colour.pRgb8;
+ break;
+
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->lineColour.colour.rgb16 =
+ *pLC->colour.pRgb16;
+ break;
+ }
+
+ if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXLineColourAsf) != PEXBundled) {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->lineColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->lineColour);
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ }
+ }
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miSurfaceColourOC
+ |
+ | Function Description:
+ | Handles PEXOCSurfaceColourIndex and PEXOCSurfaceColour.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miSurfaceColourOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ ddpex3rtn miConvertColor();
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miColourStruct *pSC = (miColourStruct *)(pOC+1);
+
+ switch (pddc->Dynamic->pPCAttr->surfaceColour.colourType=pSC->colourType)
+ {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->surfaceColour.colour.indexed =
+ *pSC->colour.pIndex;
+ break;
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->surfaceColour.colour.rgbFloat =
+ *pSC->colour.pRgbFloat;
+ break;
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->surfaceColour.colour.rgb8 =
+ *pSC->colour.pRgb8;
+ break;
+
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->surfaceColour.colour.rgb16 =
+ *pSC->colour.pRgb16;
+ break;
+ }
+
+ if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
+ if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceColourAsf)!=PEXBundled) {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->surfaceColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->surfaceColour);
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ }
+ }
+ return(Success);
+}
+
+/*++
+ |
+ | Function Name: miEdgeColourOC
+ |
+ | Function Description:
+ | Handles PEXOCSurfaceEdgeColourIndex and PEXOCSurfaceEdgeColour.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex2rtn
+miEdgeColourOC(pRend, pOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pOC; /* output command */
+/* out */
+{
+ ddpex3rtn miConvertColor();
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miColourStruct *pSEC = (miColourStruct *)(pOC+1);
+
+ switch (pddc->Dynamic->pPCAttr->edgeColour.colourType = pSEC->colourType)
+ {
+ case PEXIndexedColour:
+ pddc->Dynamic->pPCAttr->edgeColour.colour.indexed =
+ *pSEC->colour.pIndex;
+ break;
+
+ case PEXRgbFloatColour:
+ case PEXCieFloatColour:
+ case PEXHsvFloatColour:
+ case PEXHlsFloatColour:
+ pddc->Dynamic->pPCAttr->edgeColour.colour.rgbFloat =
+ *pSEC->colour.pRgbFloat;
+ break;
+
+ case PEXRgb8Colour:
+ pddc->Dynamic->pPCAttr->edgeColour.colour.rgb8 = *pSEC->colour.pRgb8;
+ break;
+ case PEXRgb16Colour:
+ pddc->Dynamic->pPCAttr->edgeColour.colour.rgb16 =
+ *pSEC->colour.pRgb16;
+ break;
+ }
+
+ if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
+ if ((pddc->Dynamic->pPCAttr->asfs &PEXSurfaceEdgeColourAsf)!=PEXBundled)
+ {
+ miConvertColor(pRend,
+ &pddc->Dynamic->pPCAttr->edgeColour,
+ pddc->Dynamic->pPCAttr->rdrColourModel,
+ &pddc->Static.attrs->edgeColour);
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ }
+ }
+ return(Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPickPrim.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPickPrim.c
new file mode 100644
index 000000000..6183580b6
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPickPrim.c
@@ -0,0 +1,1242 @@
+/* $TOG: miPickPrim.c /main/9 1998/02/10 12:42:11 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miPickPrim.c,v 3.6 1998/10/04 09:34:25 dawes Exp $ */
+
+#include "miWks.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "ddpex2.h"
+#include "miFont.h"
+#include "miText.h"
+#include "miClip.h"
+#include "pexos.h"
+
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
+extern ocTableType InitExecuteOCTable[];
+extern int atx_el_to_path();
+extern void text2_xform();
+extern void text3_xform();
+
+/*
+ * Function Name: compute_pick_volume
+ *
+ * Purpose: Compute the intersection of the clip limits and the
+ * pick aperture. PEX-SI's pick aperture can be a DC_HitBox
+ * or an NPC_HitVolume. However, for pick correllation purposes,
+ * the pick aperture will always be a NPC subvolume. i.e., the
+ * DC_HitBox has been mapped into NPC.
+ * Return:
+ * pick volume, if any.
+ */
+ddpex2rtn
+compute_pick_volume(aperture, view, pDDC, pick_volume)
+/* in */
+register ddNpcSubvolume *aperture; /* NPC Pick Aperture */
+ ddViewEntry *view; /* View clipping info.
+ * view->clipLimits contains
+ * the desired clip limits */
+ miDDContext *pDDC; /* Pointer to DDContext */
+/* out */
+register ddNpcSubvolume *pick_volume; /* Intersection to use */
+{
+ register ddNpcSubvolume *clip_limit;
+ ddUSHORT all_clipped;
+ ddCoord4D NPC_Min, NPC_Max;
+/* calls */
+
+ all_clipped = 0;
+ clip_limit = &(view->clipLimits);
+
+ NPC_Max.x = clip_limit->maxval.x;
+ NPC_Max.y = clip_limit->maxval.y;
+ NPC_Max.z = clip_limit->maxval.z;
+ NPC_Max.w = 1.0;
+ NPC_Min.x = clip_limit->minval.x;
+ NPC_Min.y = clip_limit->minval.y;
+ NPC_Min.z = clip_limit->minval.z;
+ NPC_Min.w = 1.0;
+
+ if (view->clipFlags != 0) {
+ /*
+ * only test intersection of volumes if any view clipping flags are on
+ */
+ all_clipped =
+ ( (aperture->minval.x > NPC_Max.x) ||
+ (aperture->minval.y > NPC_Max.y) ||
+ (aperture->minval.z > NPC_Max.z) ||
+ (aperture->maxval.x < NPC_Min.x) ||
+ (aperture->maxval.y < NPC_Min.y) ||
+ (aperture->maxval.z < NPC_Min.z) );
+
+ if (all_clipped) {
+ /*
+ * the intersection of the volumes is null;
+ * everything is always clipped.
+ */
+ return (all_clipped); /*
+ * I.E., trivial reject situation, nothing
+ * will be picked
+ */
+ }
+ }
+
+ /* look at X-Y */
+ if (view->clipFlags >= PEXClipXY) {
+ /* not clipping to the clip limit so use all of aperture */
+ pick_volume->minval.x = aperture->minval.x;
+ pick_volume->minval.y = aperture->minval.y;
+ pick_volume->maxval.x = aperture->maxval.x;
+ pick_volume->maxval.y = aperture->maxval.y;
+ }
+ else {
+ pick_volume->minval.x = MAX(aperture->minval.x, NPC_Min.x);
+ pick_volume->minval.y = MAX(aperture->minval.y, NPC_Min.y);
+ pick_volume->maxval.x = MIN(aperture->maxval.x, NPC_Max.x);
+ pick_volume->maxval.y = MIN(aperture->maxval.y, NPC_Max.y);
+ }
+
+ /* look at Z */
+ if (view->clipFlags >= PEXClipBack)
+ pick_volume->maxval.z = aperture->maxval.z;
+ else
+ pick_volume->maxval.z = MIN(aperture->maxval.z, NPC_Max.z);
+
+ if (view->clipFlags >= PEXClipFront)
+ pick_volume->minval.z = aperture->minval.z;
+ else
+ pick_volume->minval.z = MAX(aperture->minval.z, NPC_Min.z);
+
+ return (Success);
+}
+
+
+/*
+ * Function Name: compute_pick_volume_xform
+ *
+ * Purpose: Compute the transformation that transform the primitive
+ * to be picked from pick_volume to CC. Remember that we
+ * will use the standard primitive clipping functions to figure
+ * out whether a given primitive lies within the pick aperture.
+ * Return:
+ * pv_to_cc_xform to be used to figure out pick hits.
+ */
+void
+compute_pick_volume_xform(pick_volume, pv_to_cc_xform)
+/* in */
+ ddNpcSubvolume *pick_volume;
+/* out */
+ ddFLOAT pv_to_cc_xform[4][4];
+/* calls */
+{
+ /* The transformation needed here is to go from pick_volume to clip_volume
+ * as shown in 2D below. We extend the transform to handle the 3D case
+ * trivially.
+ *
+ * pick_volume clip_volume
+ * ----------- -----------
+ *
+ * +-----+(c,d) +---------+(1,1)
+ * | | | |
+ * | | =======> | |
+ * | | | |
+ * (a,b)+-----+ (-1,-1)+---------+
+ *
+ * pv_to_cc_xform (2D): 2/(c-a) 0 (c+a)/(a-c)
+ * 0 2/(d-b) (d+b)/(b-d)
+ * 0 0 0
+ */
+
+ memcpy( (char *)pv_to_cc_xform, (char *)ident4x4, 16 * sizeof(ddFLOAT));
+ pv_to_cc_xform[0][0] =
+ 2.0 / (pick_volume->maxval.x - pick_volume->minval.x);
+ pv_to_cc_xform[1][1] =
+ 2.0 / (pick_volume->maxval.y - pick_volume->minval.y);
+ pv_to_cc_xform[2][2] =
+ 2.0 / (pick_volume->maxval.z - pick_volume->minval.z);
+ pv_to_cc_xform[0][3] =
+ (pick_volume->maxval.x + pick_volume->minval.x) /
+ (pick_volume->minval.x - pick_volume->maxval.x);
+ pv_to_cc_xform[1][3] =
+ (pick_volume->maxval.y + pick_volume->minval.y) /
+ (pick_volume->minval.y - pick_volume->maxval.y);
+ pv_to_cc_xform[2][3] =
+ (pick_volume->maxval.z + pick_volume->minval.z) /
+ (pick_volume->minval.z - pick_volume->maxval.z);
+}
+
+
+/*
+ * Function Name: convert_dcHitBox_to_npc
+ *
+ * Purpose: Convert a dcHitBox into an equivalent NPCHitVolume. This
+ * is to facilitate picking to be done always in NPC.
+ * Return:
+ * NPCHitVolume to be used as the aperture.
+ */
+void
+convert_dcHitBox_to_npc (pRend, aperture)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+ ddPC_NPC_HitVolume *aperture;
+{
+/* calls */
+ void miTransformPoint();
+
+/* Local variable definitions */
+ miDDContext *pDDC = (miDDContext *)(pRend->pDDContext);
+ ddCoord4D DC_Min, DC_Max, NPC_Min, NPC_Max;
+ ddFLOAT inv_xform[4][4];
+ ddPC_DC_HitBox dcHitBox;
+
+ /* Get the DC pick aperture first */
+
+ dcHitBox = pDDC->Static.pick.input_rec.dc_hit_box;
+
+ /* Figure out the square aperture centered around the DC_HitBox */
+ /* position and sides along X and Y equal to twice the distance */
+ /* specified in the DC_HitBox. */
+
+ DC_Min.x = (ddFLOAT)(dcHitBox.position.x - dcHitBox.distance);
+ DC_Min.y = (ddFLOAT)(dcHitBox.position.y - dcHitBox.distance);
+ DC_Min.z = 0.0; /* This is a DONT CARE value */
+ DC_Min.w = 1.0;
+ DC_Max.x = (ddFLOAT)(dcHitBox.position.x + dcHitBox.distance);
+ DC_Max.y = (ddFLOAT)(dcHitBox.position.y + dcHitBox.distance);
+ DC_Max.z = 0.0; /* This is a DONT CARE value */
+ DC_Max.w = 1.0;
+
+ /* Now get the inverse viewport transform to transform the DC_HitBox */
+ /* into NPC_HitVolume. */
+
+ memcpy( (char *)inv_xform, (char *)pDDC->Static.misc.inv_vpt_xform,
+ 16*sizeof(ddFLOAT));
+
+ /* Compute the corners of the DC_HitBox in NPC */
+
+ miTransformPoint (&DC_Min, inv_xform, &NPC_Min);
+ miTransformPoint (&DC_Max, inv_xform, &NPC_Max);
+
+ /* Use the z coordinates of the current NPC subvolume in use to */
+ /* set up the DC aperture as an equivalent NPC sub-volume. */
+
+ aperture->minval.x = NPC_Min.x;
+ aperture->minval.y = NPC_Min.y;
+ aperture->minval.z = pRend->viewport.minval.z;
+ aperture->maxval.x = NPC_Max.x;
+ aperture->maxval.y = NPC_Max.y;
+ aperture->maxval.z = pRend->viewport.maxval.z;
+}
+
+
+/*
+ * Function Name: ClipNPCPoint4D
+ *
+ * Purpose: Dtermine if the 4D NPC point is within the current NPC
+ * sub-volume and set the outcode accordingly.
+ * Return:
+ * outcode to indicate whether the 4D point is in or out.
+ */
+static ddpex2rtn
+ClipNPCPoint4D (pRend, in_pt, oc)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ ddCoord4D *in_pt;
+/* out */
+ ddUSHORT *oc;
+{
+/* Local variables */
+ ddCoord3D npc_pt;
+ ddNpcSubvolume *cliplimits;
+ int j;
+ ddUSHORT status;
+ miViewEntry *view_entry;
+ ddUSHORT cur_index;
+
+ /* Get the actual 3D point by dividing by w first */
+
+ npc_pt.x = (in_pt->x)/(in_pt->w);
+ npc_pt.y = (in_pt->y)/(in_pt->w);
+ npc_pt.z = (in_pt->z)/(in_pt->w);
+
+ /* Get the next defined view entry from the View LUT */
+
+ cur_index = ((miDDContext *)pRend->pDDContext)->Dynamic
+ ->pPCAttr->viewIndex;
+
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ cur_index, &status, (ddPointer *)&view_entry))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ /* Get the pointer to current NPC subvolume clip limits */
+
+ cliplimits = &(view_entry->entry.clipLimits);
+
+ *oc = 0; /* Initialize oc to NOT CLIPPED state */
+
+ /* Compare the npc_pt against these cliplimits and set the oc */
+
+ if (npc_pt.x < cliplimits->minval.x)
+ *oc |= MI_CLIP_LEFT;
+ else if (npc_pt.x > cliplimits->maxval.x)
+ *oc |= MI_CLIP_RIGHT;
+ if (npc_pt.y < cliplimits->minval.y)
+ *oc |= MI_CLIP_BOTTOM;
+ else if (npc_pt.y > cliplimits->maxval.y)
+ *oc |= MI_CLIP_TOP;
+ if (npc_pt.z < cliplimits->minval.z)
+ *oc |= MI_CLIP_FRONT;
+ else if (npc_pt.z > cliplimits->maxval.z)
+ *oc |= MI_CLIP_BACK;
+}
+
+
+/*++
+ |
+ | Function Name: miPickAnnoText2D
+ |
+ | Function Description:
+ | Handles the picking of Annotation text 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miPickAnnoText2D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ /* local */
+ miAnnoText2DStruct *ddText = (miAnnoText2DStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ ddCoord2D *pOrigin = ddText->pOrigin; /* string origin */
+ ddCoord2D *pOffset = ddText->pOffset;
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+ extern void miTransformPoint();
+
+/* Define required temporary variables */
+
+ ddPC_NPC_HitVolume aperture;
+ ddNpcSubvolume pv;
+ miViewEntry *view_entry;
+ ddViewEntry *view;
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_npc_xform[4][4];
+ ddFLOAT buf_xform[4][4], buf1_xform[4][4];
+ ddFLOAT buf2_xform[4][4];
+ miDDContext *pDDC, *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first, pty_first;
+ int i, j, k;
+ int count; /* Count of characters to be picked */
+ ddFLOAT ei0npc, ei1npc, ei3npc;
+ miCharPath *save_ptr;
+ miListHeader *cc_path, *clip_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag, LUTstatus;
+ ddCoord4D MC_Origin, CC_Origin, NPC_Origin;
+ ddUSHORT oc; /* Outcode for 4D point clipping */
+ ddUSHORT Pick_Flag, cur_index;
+
+ /* Get the DDContext handle for local use */
+
+ pddc = pDDC = (miDDContext *)pRend->pDDContext;
+
+ /* Transform and clip the text origin first to see if any picking */
+ /* needs to be done at all. If the NPC subvolume does not contain */
+ /* the origin, the annotation text is not picked. */
+
+ MC_Origin.x = pOrigin->x;
+ MC_Origin.y = pOrigin->y;
+ MC_Origin.z = 0.0;
+ MC_Origin.w = 1.0;
+
+ if (pDDC->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ CLIP_POINT4D(&MC_Origin, oc, MI_MCLIP);
+
+ if (oc) {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success); /* origin model clipped out */
+ }
+ }
+
+ /* Get the current view index and the corresponding transforms */
+
+ cur_index = pDDC->Dynamic->pPCAttr->viewIndex;
+
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ cur_index, &LUTstatus, (ddPointer *)&view_entry))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ /* Compute the mc_to_npc for the current view */
+
+ miMatMult (pDDC->Dynamic->mc_to_npc_xform,
+ pDDC->Dynamic->mc_to_wc_xform,
+ view_entry->vom);
+
+ miTransformPoint (&MC_Origin, pDDC->Dynamic->mc_to_npc_xform,
+ &NPC_Origin);
+
+ if ((ClipNPCPoint4D (pRend, &NPC_Origin, &oc)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+ if (oc) {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success); /* Don't pick anything; origin clipped out */
+ }
+
+
+ /* Keep the NPC_Origin computed above for later use */
+
+ /* Get the pick aperture and convert into NPC, if required. */
+
+ if (pDDC->Static.pick.type == PEXPickDeviceDC_HitBox) {
+
+ /* Convert the dcHitBox into a NPCHitVolume */
+
+ convert_dcHitBox_to_npc (pRend, &aperture);
+ }
+ else {
+
+ /* Copy data straight from the NPC pick aperture input record */
+
+ aperture = pDDC->Static.pick.input_rec.npc_hit_volume;
+ }
+
+ /* Set the annotation text flag to one */
+
+ aflag = 1;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success);
+ }
+
+
+ /* Convert text string into required paths */
+
+ if ((status = atx_el_to_path (pRend, pDDC, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text2_xform (pOrigin, pDDC->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Set up the new composite transform first. Note that in the case */
+ /* of annotation text, only the text origin is transformed by the */
+ /* complete pipeline transform. The text itself is affected only by*/
+ /* the transformed origin in NPC, the NPC offset , npc_to_cc, and */
+ /* the workstation transform. */
+
+ /* Now compute the initial composite transform for the first char. */
+ /* The required transforms for characters are - text space to model */
+ /* space transform, transformation of the annotation text origin, if*/
+ /* any. Note the ABSENCE of npc to cc transform here because of the */
+ /* PICKING as opposed to rendering. */
+
+ /* Get the translation due to the transformation of the annotation */
+ /* text origin by mc_to_npc_xform into buf1_xform. */
+
+ memcpy( (char *)buf1_xform, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ buf1_xform[0][3] += NPC_Origin.x - MC_Origin.x;
+ buf1_xform[1][3] += NPC_Origin.y - MC_Origin.y;
+
+ miMatMult (buf2_xform, text_el.xform, buf1_xform);
+
+ /* Add the offset in NPC */
+
+ buf2_xform[0][3] += pOffset->x;
+ buf2_xform[1][3] += pOffset->y;
+
+ /* Pick the paths in text_el as polylines */
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pDDC->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ Pick_Flag = 0; /* Initialize flag to indicate NO_PICK */
+
+ /* Get the current defined view entry from the View LUT */
+
+ view = &(view_entry->entry);
+
+ /* Compute the intersection of the pick aperture with the NPC */
+ /* sub-volume defined for the current view. */
+
+ if (compute_pick_volume (&aperture, view, pDDC, &pv)) {
+
+ /* We have NO intersection between the pick aperture */
+ /* and the NPC subvolume defined for the current view */
+
+ goto TextHit; /* NoPick, Skip everything else */
+ }
+
+ /* Get the transform to go from pick volume to CC - buf1_xform */
+
+ compute_pick_volume_xform (&pv, buf1_xform);
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Pick characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space */
+ /* char. If so just skip to next character in the ISTRING and*/
+ /* continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the */
+ /* text path is Up or Down. If so, we need to modify tx by */
+ /* first character translation to align with the rest of the*/
+ /* characters in the string. */
+
+ if ((pDDC->Static.attrs->atextPath == PEXPathUp ||
+ pDDC->Static.attrs->atextPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE */
+ /* FIRST CHARACTER IN THE STRING. ptx FOR ALL OTHERS WILL */
+ /* BE RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE*/
+ /* REQUIRED EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS */
+ /* NOT A PROBLEM HERE SINCE WE NEED THIS SPECIAL CASE ONLY*/
+ /* FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE */
+ /* OF += */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to*/
+ /* get just the character width. */
+
+ ptx_first += (pDDC->Static.attrs->charSpacing) *
+ FONT_COORD_HEIGHT;
+
+ pty_first = pty; /* Save first character height */
+
+ /* Adjust the translation by character spacing factor to*/
+ /* get just the character height. */
+
+ pty_first += (pDDC->Static.attrs->charSpacing) *
+ FONT_COORD_HEIGHT;
+ }
+
+ /* Check to see if the text path is Left. If so, we need */
+ /* to modify tx by the first character width so as to start*/
+ /* the string to the left of the text origin. */
+
+ if (pDDC->Static.attrs->atextPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Buffer the tc_to_npc_xform first */
+
+ memcpy( (char *)tc_to_npc_xform, (char *)buf2_xform,16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by */
+ /* directly modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0npc = tc_to_npc_xform[i][0];
+ ei1npc = tc_to_npc_xform[i][1];
+ ei3npc = tc_to_npc_xform[i][3];
+ /* Modify the transform */
+ tc_to_npc_xform[i][0] = exp * ei0npc;
+ tc_to_npc_xform[i][3] = tx * ei0npc + ty * ei1npc + ei3npc;
+ }
+
+ /* Get buf_xform = (tc_to_npc_xform * buf1_xform) */
+
+ miMatMult (buf_xform, tc_to_npc_xform, buf1_xform);
+
+ /* Transform and clip the paths corresponding to current */
+ /* character. */
+
+ if (status = miTransform(pDDC, text_el.paths->path, &cc_path,
+ buf_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Now pass the paths through the line clipper to see if */
+ /* it lies within the pick aperture. If anything remains,*/
+ /* then return a PICK. Otherwise, return a NO_PICK. */
+
+ if (status = miClipPolyLines (pDDC, cc_path, &clip_path,
+ MI_VCLIP)) {
+
+ /* BadAlloc, or NOT 4D points */
+
+ return (status);
+ }
+ else {
+ /* Check if anything is remaining. If so, the pick volume */
+ /* intersects the text string. If not, this char has been */
+ /* clipped out. Accordingly, update the Pick_Flag. */
+
+ if (clip_path->numLists > 0) {
+ Pick_Flag = 1;
+ goto TextHit;
+ }
+ }
+
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+
+ } /* Loop for all characters in the text string */
+
+ TextHit:
+
+ if (Pick_Flag)
+
+ /* Update the ddContext pick status to PICK */
+
+ pDDC->Static.pick.status = PEXOk;
+ else
+ /* Update the ddContext pick status to NO_PICK */
+
+ pDDC->Static.pick.status = PEXNoPick;
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miPickAnnoText3D
+ |
+ | Function Description:
+ | Handles the picking of Annotation text 3D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miPickAnnoText3D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ /* local */
+ miAnnoTextStruct *ddText = (miAnnoTextStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ ddCoord3D *pOrigin = ddText->pOrigin; /* string origin */
+ ddCoord3D *pOffset = ddText->pOffset;
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+ extern void miTransformPoint();
+
+/* Define required temporary variables */
+
+ ddPC_NPC_HitVolume aperture;
+ ddNpcSubvolume pv;
+ miViewEntry *view_entry;
+ ddViewEntry *view;
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_npc_xform[4][4];
+ ddFLOAT buf_xform[4][4], buf1_xform[4][4];
+ ddFLOAT buf2_xform[4][4];
+ miDDContext *pDDC, *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first, pty_first;
+ int i, j, k;
+ int count; /* Count of characters to be picked */
+ ddFLOAT ei0npc, ei1npc, ei3npc;
+ miCharPath *save_ptr;
+ miListHeader *cc_path, *clip_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag, LUTstatus;
+ static ddVector3D Directions[2] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0};
+ ddCoord3D *pDirections = (ddCoord3D *)Directions;
+ ddCoord4D MC_Origin, CC_Origin, NPC_Origin;
+ ddUSHORT oc; /* Outcode for 4D point clipping */
+ ddUSHORT Pick_Flag, cur_index;
+
+ /* Get the DDContext handle for local use */
+
+ pddc = pDDC = (miDDContext *)pRend->pDDContext;
+
+ /* Transform and clip the text origin first to see if any picking */
+ /* needs to be done at all. If the NPC subvolume does not contain */
+ /* the origin, the annotation text is not picked. */
+
+ MC_Origin.x = pOrigin->x;
+ MC_Origin.y = pOrigin->y;
+ MC_Origin.z = pOrigin->z;
+ MC_Origin.w = 1.0;
+
+ if (pDDC->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ CLIP_POINT4D(&MC_Origin, oc, MI_MCLIP);
+
+ if (oc) {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success); /* origin model clipped out */
+ }
+ }
+
+ /* Get the current view index and the corresponding transforms */
+
+ cur_index = pDDC->Dynamic->pPCAttr->viewIndex;
+
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ cur_index, &LUTstatus, (ddPointer *)&view_entry))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ /* Compute the mc_to_npc for the current view */
+
+ miMatMult (pDDC->Dynamic->mc_to_npc_xform,
+ pDDC->Dynamic->mc_to_wc_xform,
+ view_entry->vom);
+
+ miTransformPoint (&MC_Origin, pDDC->Dynamic->mc_to_npc_xform,
+ &NPC_Origin);
+
+ if ((ClipNPCPoint4D (pRend, &NPC_Origin, &oc)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+ if (oc) {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success); /* Don't pick anything; origin clipped out */
+ }
+
+ /* Keep the NPC_Origin computed above for later use */
+
+ /* Get the pick aperture and convert into NPC, if required. */
+
+ if (pDDC->Static.pick.type == PEXPickDeviceDC_HitBox) {
+
+ /* Convert the dcHitBox into a NPCHitVolume */
+
+ convert_dcHitBox_to_npc (pRend, &aperture);
+ }
+ else {
+
+ /* Copy data straight from the NPC pick aperture input record */
+
+ aperture = pDDC->Static.pick.input_rec.npc_hit_volume;
+ }
+
+ /* Set the annotation text flag to one */
+
+ aflag = 1;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ {
+ pDDC->Static.pick.status = PEXNoPick;
+ return (Success);
+ }
+
+
+ /* Convert text string into required paths */
+
+ if ((status = atx_el_to_path (pRend, pDDC, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text3_xform (pOrigin,pDirections, (pDirections+1),
+ pDDC->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Set up the new composite transform first. Note that in the case */
+ /* of annotation text, only the text origin is transformed by the */
+ /* complete pipeline transform. The text itself is affected only by*/
+ /* the transformed origin in NPC, the NPC offset , npc_to_cc, and */
+ /* the workstation transform. */
+
+ /* Now compute the initial composite transform for the first char. */
+ /* The required transforms for characters are - text space to model */
+ /* space transform, transformation of the annotation text origin, if*/
+ /* any. Note the ABSENCE of npc to cc transform here because of the */
+ /* PICKING as opposed to rendering. */
+
+ /* Get the translation due to the transformation of the annotation */
+ /* text origin by mc_to_npc_xform into buf1_xform. */
+
+ memcpy( (char *)buf1_xform, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ buf1_xform[0][3] += NPC_Origin.x - MC_Origin.x;
+ buf1_xform[1][3] += NPC_Origin.y - MC_Origin.y;
+ buf1_xform[2][3] += NPC_Origin.z - MC_Origin.z;
+
+ miMatMult (buf2_xform, text_el.xform, buf1_xform);
+
+ /* Add the offset in NPC */
+
+ buf2_xform[0][3] += pOffset->x;
+ buf2_xform[1][3] += pOffset->y;
+ buf2_xform[2][3] += pOffset->z;
+
+ /* Pick the paths in text_el as polylines */
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pDDC->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ Pick_Flag = 0; /* Initialize flag to indicate NO_PICK */
+
+ /* Get the current defined view entry from the View LUT */
+
+ view = &(view_entry->entry);
+
+ /* Compute the intersection of the pick aperture with the NPC */
+ /* sub-volume defined for the current view. */
+
+ if (compute_pick_volume (&aperture, view, pDDC, &pv)) {
+
+ /* We have NO intersection between the pick aperture */
+ /* and the NPC subvolume defined for the current view */
+
+ goto TextHit; /* NoPick, Skip everything else */
+ }
+
+ /* Get the transform to go from pick volume to CC - buf1_xform */
+
+ compute_pick_volume_xform (&pv, buf1_xform);
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Pick characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space */
+ /* char. If so just skip to next character in the ISTRING and*/
+ /* continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the */
+ /* text path is Up or Down. If so, we need to modify tx by */
+ /* first character translation to align with the rest of the*/
+ /* characters in the string. */
+
+ if ((pDDC->Static.attrs->atextPath == PEXPathUp ||
+ pDDC->Static.attrs->atextPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE */
+ /* FIRST CHARACTER IN THE STRING. ptx FOR ALL OTHERS WILL */
+ /* BE RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE*/
+ /* REQUIRED EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS */
+ /* NOT A PROBLEM HERE SINCE WE NEED THIS SPECIAL CASE ONLY*/
+ /* FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE */
+ /* OF += */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to*/
+ /* get just the character width. */
+
+ ptx_first += (pDDC->Static.attrs->charSpacing) *
+ FONT_COORD_HEIGHT;
+
+ pty_first = pty; /* Save first character height */
+
+ /* Adjust the translation by character spacing factor to*/
+ /* get just the character height. */
+
+ pty_first += (pDDC->Static.attrs->charSpacing) *
+ FONT_COORD_HEIGHT;
+ }
+
+ /* Check to see if the text path is Left. If so, we need */
+ /* to modify tx by the first character width so as to start*/
+ /* the string to the left of the text origin. */
+
+ if (pDDC->Static.attrs->atextPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Buffer the tc_to_npc_xform first */
+
+ memcpy( (char *)tc_to_npc_xform, (char *)buf2_xform,16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by */
+ /* directly modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0npc = tc_to_npc_xform[i][0];
+ ei1npc = tc_to_npc_xform[i][1];
+ ei3npc = tc_to_npc_xform[i][3];
+ /* Modify the transform */
+ tc_to_npc_xform[i][0] = exp * ei0npc;
+ tc_to_npc_xform[i][3] = tx * ei0npc + ty * ei1npc + ei3npc;
+ }
+
+ /* Get buf_xform = (tc_to_npc_xform * buf1_xform) */
+
+ miMatMult (buf_xform, tc_to_npc_xform, buf1_xform);
+
+ /* Transform and clip the paths corresponding to current */
+ /* character. */
+
+ if (status = miTransform(pDDC, text_el.paths->path, &cc_path,
+ buf_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Now pass the paths through the line clipper to see if */
+ /* it lies within the pick aperture. If anything remains,*/
+ /* then return a PICK. Otherwise, return a NO_PICK. */
+
+ if (status = miClipPolyLines (pDDC, cc_path, &clip_path,
+ MI_VCLIP)) {
+
+ /* BadAlloc, or NOT 4D points */
+
+ return (status);
+ }
+ else {
+ /* Check if anything is remaining. If so, the pick volume */
+ /* intersects the text string. If not, this char has been */
+ /* clipped out. Accordingly, update the Pick_Flag. */
+
+ if (clip_path->numLists > 0) {
+ Pick_Flag = 1;
+ goto TextHit;
+ }
+ }
+
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+
+ } /* Loop for all characters in the text string */
+
+ TextHit:
+
+ if (Pick_Flag)
+
+ /* Update the ddContext pick status to PICK */
+
+ pDDC->Static.pick.status = PEXOk;
+ else
+ /* Update the ddContext pick status to NO_PICK */
+
+ pDDC->Static.pick.status = PEXNoPick;
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miPickPrimitives
+ |
+ | Function Description:
+ | Handles the picking of most primitives in a generic fashion.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miPickPrimitives(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+
+/* Local variable definitions */
+ miDDContext *pDDC = (miDDContext *)(pRend->pDDContext);
+ ddPC_NPC_HitVolume aperture;
+ ddNpcSubvolume pv;
+ miViewEntry *view_entry;
+ ddViewEntry *view;
+ ddFLOAT buf1_xform[4][4];
+ ddUSHORT cur_index;
+ ddUSHORT status;
+
+ /* Get the pick aperture and convert into NPC, if required. */
+
+ if (pDDC->Static.pick.type == PEXPickDeviceDC_HitBox) {
+
+ /* Convert the dcHitBox into a NPCHitVolume */
+
+ convert_dcHitBox_to_npc (pRend, &aperture);
+
+ }
+ else {
+
+ /* Copy data straight from the NPC pick aperture input record */
+
+ aperture = pDDC->Static.pick.input_rec.npc_hit_volume;
+ }
+
+ /* Clear out the cc_to_dc_xform, since we will not be going to DC */
+
+ memcpy( (char *) pDDC->Dynamic->cc_to_dc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* Get the current defined view entry from the View LUT */
+
+ cur_index = pDDC->Dynamic->pPCAttr->viewIndex;
+
+ if ((InquireLUTEntryAddress (PEXViewLUT, pRend->lut[PEXViewLUT],
+ cur_index, &status, (ddPointer *)&view_entry))
+ == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ view = &(view_entry->entry);
+
+ /* Compute the intersection of the pick aperture with the NPC */
+ /* sub-volume defined for the current view. */
+
+ if (compute_pick_volume (&aperture, view, pDDC, &pv)) {
+
+ /* We have NO intersection between the pick aperture */
+ /* and the NPC subvolume defined for the current view */
+
+ return (Success); /* NoPick, Just return */
+ }
+
+ /* Get the transform to go from pick volume to CC - buf1_xform */
+
+ compute_pick_volume_xform (&pv, buf1_xform);
+
+ /* Compute the mc_to_npc for the current view */
+
+ miMatMult (pDDC->Dynamic->mc_to_npc_xform,
+ pDDC->Dynamic->mc_to_wc_xform,
+ view_entry->vom);
+
+ /* Get wc_to_cc_xform = (wc_to_npc_xform * buf1_xform) */
+ /* Note that wc_to_npc_xform == view_entry->vom. */
+
+ miMatMult (pDDC->Dynamic->wc_to_cc_xform,
+ view_entry->vom, buf1_xform);
+
+ /* Get mc_to_cc_xform = (mc_to_npc_xform * buf1_xform) */
+
+ miMatMult (pDDC->Dynamic->mc_to_cc_xform,
+ pDDC->Dynamic->mc_to_npc_xform, buf1_xform);
+
+ /* Now, call the level 2 rendering function to transform and */
+ /* clip the primitive. Note that the level 1 function vector */
+ /* now has PICKING routines instead of rendering routines. If*/
+ /* a pick is detected the GLOBAL PICK FLAG will have been up-*/
+ /* dated. Check this flag to determine if anything was indeed*/
+ /* picked by the level 1 picking routines. */
+
+ InitExecuteOCTable[(int)(pExecuteOC->elementType)]
+ (pRend, pExecuteOC);
+
+ /* If successful PICK, just return */
+
+ if (pDDC->Static.pick.status == PEXOk) ;; /* For debug */
+
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miTestPickGdp3d
+ |
+ | Function Description:
+ | Provides the dummy test routine for picking 3d Gdps.
+ | with data OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miTestPickGdp3d(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ ErrorF ("miTestPickGdp3d\n");
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miTestPickGdp2d
+ |
+ | Function Description:
+ | Provides the dummy test routine for picking 2d Gdps.
+ | with data OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miTestPickGdp2d(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ ErrorF ("miTestPickGdp2d\n");
+ return (Success);
+}
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPolyLine.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPolyLine.c
new file mode 100644
index 000000000..7b8d6ff5e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miPolyLine.c
@@ -0,0 +1,530 @@
+/* $TOG: miPolyLine.c /main/6 1998/02/10 12:42:19 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miPolyLine.c,v 3.5 1998/10/04 09:34:25 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miClip.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miPolyLines
+ |
+ | Function Description:
+ | Handles the Polyline 3D, Polyline 2D, Polyline set 3D with data ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miPolyLines(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+ ddpex3rtn miTransform();
+ ddpex3rtn miConvertVertexColors();
+ ddpex3rtn miClipPolyLines();
+ ddpex3rtn miRenderPolyLine();
+
+/* Local variable definitions */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miPolylineStruct *ddPoly = (miPolylineStruct *)(pExecuteOC+1);
+ miListHeader *input_list = (miListHeader *)ddPoly;
+ miListHeader *color_list,
+ *mc_list,
+ *mc_clist,
+ *cc_list,
+ *clip_list,
+ *dcue_list,
+ *dc_list;
+ ddpex3rtn status;
+ ddPointType out_type;
+ ddUSHORT clip_mode; /* view or model clipping */
+
+ /*
+ * Convert per-vertex colors to rendering color model.
+ * Note that this implementation only supports rgb float.
+ */
+
+ if (DD_IsVertColour(input_list->type)) {
+ if (status = miConvertVertexColors(pRend,
+ input_list, PEXRdrColourModelRGB,
+ &color_list))
+ return (status);
+ } else {
+ color_list = input_list;
+ }
+
+ /* Check for Model clipping */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ clip_mode = MI_MCLIP;
+
+
+ /* Tranform points to 4D for clipping */
+ out_type = color_list->type;
+ if (status = miTransform(pddc, color_list, &mc_clist,
+ ident4x4,
+ ident4x4,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+
+ if (status = miClipPolyLines(pddc, mc_clist, &mc_list, clip_mode))
+ return(status);
+
+ /* if nothing left, return early */
+ if (mc_list->numLists <= 0) return(Success);
+
+
+ } else mc_list = color_list;
+
+ clip_mode = MI_VCLIP;
+
+
+ /* Transform and clip the paths created */
+ out_type = mc_list->type;
+ if (status = miTransform(pddc, mc_list, &cc_list,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+ if (status = miClipPolyLines(pddc, cc_list, &clip_list, clip_mode))
+ return(status);
+
+ /* if nothing left, return early */
+ if (clip_list->numLists <= 0) return(Success);
+
+ /* DEPTH CUEING */
+ if (pddc->Dynamic->pPCAttr->depthCueIndex) {
+ miDepthCuePLine(pRend, clip_list, &dcue_list);
+ clip_list = dcue_list;
+ }
+
+ /* Transform to DC coordinates */
+ out_type = clip_list->type;
+ DD_SetVert2D(out_type);
+ DD_SetVertShort(out_type);
+ if (status = miTransform(pddc, clip_list, &dc_list,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ out_type))
+ return (status);
+
+
+ return (pddc->Static.RenderProcs[POLYLINE_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_list));
+}
+
+/*++
+ |
+ | Function Name: miClipPolyLines
+ |
+ | Function Description:
+ | Handles the Polyline 3D, Polyline 2D, Polyline set 3D with data ocs.
+ |
+ | Note(s):
+ | This routine modifies both the input and output
+ | data structures - the input had better not
+ | be pointing at the CSS data store!
+ |
+ --*/
+
+ddpex3rtn
+miClipPolyLines(pddc, vinput, voutput, clip_mode)
+/* in */
+ miDDContext *pddc;
+ miListHeader *vinput;
+ miListHeader **voutput;
+ ddUSHORT clip_mode; /* view or model clipping */
+{
+
+/* uses */
+ ddPointUnion in_ptP, in_ptQ;
+ ddPointUnion out_pt;
+ float t_ptP, t_ptQ;
+ miListHeader *input, *output, *list1, *list2;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int num_lists;
+ int vert_count;
+ int point_size, num_planes;
+ int current_plane,j,k,
+ clip_code, pts_in_list;
+ ddHalfSpace *MC_HSpace;
+ ddUSHORT current_clip;
+ char new_list;
+
+
+ /* Vertex data must be homogeneous for view clipping */
+ if ((clip_mode == MI_VCLIP) && !(DD_IsVert4D(vinput->type)))
+ return(1);
+
+
+ /* Allocate an initial number of headers */
+ list1 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list1, MI_ROUND_LISTHEADERCOUNT(vinput->numLists));
+ if (!list1->ddList) return(BadAlloc);
+ list1->type = vinput->type;
+ list1->flags = vinput->flags;
+ input = vinput;
+
+ list2 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list2, MI_ROUND_LISTHEADERCOUNT(vinput->numLists));
+ if (!list2->ddList) return(BadAlloc);
+ list2->type = vinput->type;
+ list2->flags = vinput->flags;
+
+ *voutput = output = list2;
+
+ DD_VertPointSize(vinput->type, point_size);
+
+ num_lists = 0;
+
+ /* Now, clip each list */
+
+ /* Get point size so that this works for all point types */
+ DD_VertPointSize(vinput->type, point_size);
+
+ /*
+ * Each list is now clipped in turn against each (enabled) boundary.
+ */
+
+
+ if (clip_mode == MI_MCLIP) {
+ num_planes = pddc->Static.misc.ms_MCV->numObj;
+ MC_HSpace = (ddHalfSpace *)(pddc->Static.misc.ms_MCV->pList);
+ }
+
+ else num_planes = 6; /* view clipping to a cube */
+
+ for (current_plane = 0; current_plane < num_planes; current_plane++) {
+ current_clip = 1 << current_plane;
+
+ num_lists = 0; /* Restart list counter each pass */
+
+ for (j = 0, pddilist = input->ddList, pddolist = output->ddList,
+ output->numLists = 0, num_lists = 0, new_list = 1;
+ j < input->numLists; j++) {
+
+
+ /* Don't process if no points */
+ if ((vert_count = pddilist->numPoints) <= 0) {
+ pddilist++;
+ continue;
+ }
+
+ /*
+ * Insure sufficient room for each vertex.
+ * Note that twice the vertex count is an upper-bound for
+ * a clipped polygon (although there is probably a "tighter fit").
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist, 2*vert_count, point_size);
+ if (!(out_pt.ptr = (char *)pddolist->pts.ptr)) return(BadAlloc);
+ pts_in_list = 0;
+ clip_code = 0;
+
+ /* Aquire two points */
+ /* and generate clip code */
+ in_ptP.ptr = pddilist->pts.ptr;
+ COMPUTE_CLIP_PARAMS(in_ptP,t_ptP,0,clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ /*
+ * Initialize the output array. If the first point is
+ * inside the bounds, load it.
+ */
+
+ if(!(clip_code)) {
+ COPY_POINT(in_ptP, out_pt, point_size);
+ ++pts_in_list;
+ out_pt.ptr += point_size;
+ }
+
+ in_ptQ.ptr = in_ptP.ptr + point_size;
+
+ for (k = 1; k < pddilist->numPoints; k++){
+
+ COMPUTE_CLIP_PARAMS(in_ptQ, t_ptQ, 1, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+
+ switch(clip_code) {
+ case 0: /* both P and Q are in bounds */
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ ++pts_in_list;
+ break;
+
+ case 1: /* P is out, Q is in */
+ CLIP_AND_COPY(input->type, in_ptP, t_ptP,
+ in_ptQ, t_ptQ, out_pt);
+ out_pt.ptr += point_size;
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_in_list = 2;
+ break;
+
+ case 2: /* P is in, Q is out */
+ CLIP_AND_COPY(input->type, in_ptQ, t_ptQ,
+ in_ptP, t_ptP, out_pt);
+ out_pt.ptr += point_size;
+ ++pts_in_list;
+ pddolist->numPoints = pts_in_list;
+ pddolist++;
+ output->numLists++;
+ num_lists++;
+ MI_ALLOCLISTHEADER(output,
+ MI_ROUND_LISTHEADERCOUNT(output->numLists));
+ /* skip to next output list */
+ pddolist = output->ddList + num_lists;
+
+ /* Insure sufficient room for remaining verts
+ and degenerate points */
+ MI_ALLOCLISTOFDDPOINT(pddolist,
+ ((pddilist->numPoints - k)+1),
+ point_size);
+
+ out_pt.ptr = pddolist->pts.ptr;
+ if (!out_pt.ptr) return(BadAlloc);
+ pts_in_list = 0; /*start a new list*/
+ break;
+
+ case 3: /* both are out; do nothing */
+ break;
+
+ }
+ in_ptP.ptr = in_ptQ.ptr;
+ t_ptP = t_ptQ;
+ in_ptQ.ptr += point_size;
+ clip_code >>= 1;
+ }
+ if (pts_in_list > 1) {
+ pddolist->numPoints = pts_in_list;
+ pddolist++;
+ num_lists++;
+ } /* else use the same output list */
+
+ /* Now, skip to next input list */
+ pddilist++;
+ }
+
+
+
+ /* Complete initialization of output list header */
+ output->numLists = num_lists;
+
+ /* Use result of previous clip for input to next clip */
+ input = output;
+ if (output == list2)
+ output = list1;
+ else output = list2;
+
+ if (clip_mode == MI_MCLIP) MC_HSpace++;
+
+ } /* end of processing for all planes */
+
+ /* Current input list is last processed (clipped) list */
+ *voutput = input;
+
+ return (Success);
+
+}
+
+
+/*++
+ |
+ | DepthCuePLine(pRend, input_vert, output_vert)
+ |
+ | Applies depth cueing to the vertex colors in a data list
+ |
+ --*/
+ddpex3rtn
+miDepthCuePLine(pRend, input_vert, output_vert)
+ ddRendererPtr pRend; /* renderer handle */
+ miListHeader *input_vert; /* input vertex data */
+ miListHeader **output_vert; /* output vertex data */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *out_vert;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddPointUnion in_pt, out_pt;
+ ddRgbFloatColour *in_color;
+ int point_size, facet_size;
+ int numPoints;
+ int i,j,outpoint_size;
+ miColourEntry *pintcolour;
+ ddFLOAT pt_depth;
+ ddULONG colourindex;
+ ddColourSpecifier intcolour;
+ ddUSHORT status;
+ ddDepthCueEntry *dcue_entry;
+
+ /* look for empty list header */
+ if (input_vert->numLists == 0) return(Success);
+
+ /* validate CC version of Depth Cue information */
+ if (pddc->Static.misc.flags & CC_DCUEVERSION)
+ Compute_CC_Dcue(pRend, pddc);
+
+ /* check to make sure depth cuing is enabled */
+ if (pddc->Static.misc.cc_dcue_entry.mode == PEXOff) {
+ *output_vert = input_vert;
+ return(Success);
+ }
+
+ /* Else, depth cue! Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert, input_vert->numLists)
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = input_vert->type;
+ DD_SetVertRGBFLOAT(out_vert->type);
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+ DD_VertPointSize(input_vert->type, point_size);
+
+ /* Get current line color if appropriate */
+ if (!(DD_IsVertColour(input_vert->type)) &&
+ (pddc->Static.attrs->lineColour.colourType
+ == PEXIndexedColour)) {
+ if ((InquireLUTEntryAddress (PEXColourLUT, pRend->lut[PEXColourLUT],
+ pddc->Static.attrs->lineColour.colour.indexed.index,
+ &status, (ddPointer *)&pintcolour)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+ }
+
+ DD_VertPointSize(out_vert->type, outpoint_size);
+
+ for (i = 0; i < input_vert->numLists; i++) {
+
+ pddolist->numPoints = pddilist->numPoints;
+
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ outpoint_size);
+ if (!(out_pt.ptr = pddolist->pts.ptr)) return(BadAlloc);
+ in_pt = pddilist->pts;
+
+ for (j = 0; j < pddilist->numPoints; j++)
+ {
+ /* First copy over coordinate data */
+ pt_depth = in_pt.p4Dpt->z;
+ *out_pt.p4Dpt = *in_pt.p4Dpt;
+ in_pt.p4Dpt++;
+ out_pt.p4Dpt++;
+
+ /*
+ * Next color
+ * Colour is derived first from the vertex, second from the
+ * from the current PC attributes.
+ */
+
+ if (DD_IsVertColour(input_vert->type)){
+ in_color = in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ }
+ else {
+ if (pddc->Static.attrs->lineColour.colourType
+ == PEXIndexedColour)
+ in_color = &pintcolour->entry.colour.rgbFloat;
+ else in_color =
+ &(pddc->Static.attrs->lineColour.colour.rgbFloat);
+ }
+
+ APPLY_DEPTH_CUEING(pddc->Static.misc.cc_dcue_entry,
+ pt_depth, in_color, out_pt.pRgbFloatClr)
+
+ out_pt.pRgbFloatClr++;
+
+ /*
+ * Next normals
+ * Colour is derived first from the vertex, second from the
+ * facet (note that we insured above that there were facet normals).
+ */
+
+ if DD_IsVertNormal(input_vert->type) {
+ *out_pt.pNormal = *in_pt.pNormal;
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ /* Next pass along edge info if there is any */
+ if (DD_IsVertEdge(out_vert->type)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+
+ }
+
+ pddilist++;
+ pddolist++;
+ }
+
+ return(Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miQuadMesh.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miQuadMesh.c
new file mode 100644
index 000000000..7597cd9b6
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miQuadMesh.c
@@ -0,0 +1,265 @@
+/* $TOG: miQuadMesh.c /main/6 1998/02/10 12:42:23 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miQuadMesh.c,v 3.6 1998/10/04 09:34:25 dawes Exp $ */
+
+#include "miLUT.h"
+#include "ddpex2.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "miClip.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miQuadMesh
+ |
+ | Function Description:
+ | Handles the Quad Mesh OC
+ |
+ | Note(s):This routine decomposes Quad Meshes to a series of triangle
+ | meshes for rendering
+ |
+ --*/
+
+ddpex3rtn
+miQuadMesh(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend;
+ miGenericStr *pExecuteOC;
+
+
+{
+
+/* Calls */
+ extern ocTableType InitExecuteOCTable[];
+
+/* Local variable definitions */
+ miQuadMeshStruct *ddQuad = (miQuadMeshStruct *)(pExecuteOC+1);
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+
+ miGenericStr *pGStr;
+ miTriangleStripStruct
+ *ddTri; /*pointer to temporary
+ |triangle strip structure
+ |for decomposed QuadMesh
+ |row of cells
+ */
+ miListHeader *tri_list;
+
+ ddPointUnion in_pt, out_pt;
+
+ listofddFacet *tri_facets;
+
+ char *quad_fptr, /* pointers to */
+ *tri_fptr; /* facet data */
+
+ ddpex3rtn status;
+
+ int inpoint_size,
+ outpoint_size,
+ facet_size,
+ row_size,
+ edge_offset,
+ i,j,
+ num_cols,
+ num_rows;
+
+/***********************************************************************/
+
+
+ /* Initialize status */
+
+ status = Success;
+
+ /* Allocate space for a Generic Structure Element */
+
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miTriangleStripStruct))))) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ /* Initialize the header data into allocated generic struct */
+
+ pGStr->elementType = PEXOCTriangleStrip;
+
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddTri = (miTriangleStripStruct *) (pGStr + 1);
+
+ num_cols = (ddQuad->mPts - 1);
+ num_rows = (ddQuad->nPts - 1);
+
+ /* At this point, we need to check if the edges are visible or not. */
+ /* If they are we need to explicitly add them. This is part of the */
+ /* because they are in the FillArea primitive, and we didn't wish */
+ /* to have special cases all over the code. (particularly structure */
+ /* storage and readback on both sides of the wire) */
+
+ DD_VertPointSize(ddQuad->points.type, inpoint_size);
+
+ in_pt.ptr = ddQuad->points.ddList->pts.ptr;
+ row_size = (inpoint_size * (num_cols+ 1));
+ quad_fptr = (char *)ddQuad->pFacets->facets.pNoFacet;
+
+ for (i = 1; i <= num_rows ; i++) {
+
+ /* All temporary storage must be reallocated
+ * each time, since the allocation routines rotate through
+ * the headers, and will overwrite any particular header
+ * after four calls. This coould perhaps be avoided by
+ * directly using xalloc, but we do it this way for
+ * consistency.
+ */
+
+
+ tri_list = MI_NEXTTEMPDATALIST(pddc); /* get new miListHeader */
+ MI_ALLOCLISTHEADER(tri_list, 1); /* get new ddList attached */
+
+ tri_list->ddList->numPoints = 2 * (num_cols + 1);
+ tri_list->type = ddQuad->points.type;
+ if ((pddc->Static.attrs->edges != PEXOff) &&
+ (!(DD_IsVertEdge(ddQuad->points.type)))) {
+ DD_SetVertEdge(tri_list->type);
+ DD_VertOffsetEdge(tri_list->type, edge_offset);
+ }
+ DD_VertPointSize(tri_list->type, outpoint_size);
+ tri_list->flags = ddQuad->points.flags;
+ tri_list->numLists = 1;
+ MI_ALLOCLISTOFDDPOINT( /* get vertex storage */
+ tri_list->ddList, (2 * (num_cols + 1)), (outpoint_size));
+
+ /* Allocate triangle strip facet storage if necessary*/
+ if (ddQuad->pFacets) {
+ if (ddQuad->pFacets->numFacets > 0) {
+ DDFacetSIZE(ddQuad->pFacets->type, facet_size);
+ tri_facets = MI_NEXTTEMPFACETLIST(pddc);
+ tri_facets->type = ddQuad->pFacets->type;
+ MI_ALLOCLISTOFDDFACET(tri_facets, 2 * num_cols, facet_size);
+ if (!tri_facets->facets.pFacetRgbFloatN) {
+ status = BadAlloc;
+ goto exit;
+ }
+ tri_fptr = (char *)tri_facets->facets.pNoFacet;
+ tri_facets->numFacets = 2 * num_cols;
+ ddTri->pFacets = tri_facets;
+ }
+ else {
+ quad_fptr = 0;
+ tri_fptr = 0;
+ tri_facets = 0;
+ ddTri->pFacets = 0;
+ }
+
+ } else {
+ quad_fptr = 0;
+ tri_fptr = 0;
+ tri_facets = 0;
+ ddTri->pFacets = 0;
+ }
+
+ out_pt.ptr = tri_list->ddList->pts.ptr;
+
+ memcpy( out_pt.ptr, in_pt.ptr, inpoint_size);
+ if (pddc->Static.attrs->edges != PEXOff) {
+ *(out_pt.ptr + edge_offset) = ~0;
+ }
+ out_pt.ptr += outpoint_size;
+
+ memcpy( out_pt.ptr, (in_pt.ptr + row_size), inpoint_size);
+ if (pddc->Static.attrs->edges != PEXOff) {
+ *(out_pt.ptr + edge_offset) = ~0;
+ CLEAR_FWD_EDGE(out_pt.ptr, edge_offset);
+ }
+ in_pt.ptr += inpoint_size;
+ out_pt.ptr += outpoint_size;
+
+ /* Build up a triangle strip */
+ for (j = 1; j <= num_cols; j++) {
+
+ memcpy( out_pt.ptr, in_pt.ptr, inpoint_size);
+ if (pddc->Static.attrs->edges != PEXOff) {
+ *(out_pt.ptr + edge_offset) = ~0;
+ }
+ out_pt.ptr += outpoint_size;
+ memcpy( out_pt.ptr, (in_pt.ptr + row_size), inpoint_size);
+ if (pddc->Static.attrs->edges != PEXOff){
+ *(out_pt.ptr + edge_offset) = ~0;
+ CLEAR_FWD_EDGE(out_pt.ptr, edge_offset);
+ }
+ in_pt.ptr += inpoint_size;
+ out_pt.ptr += outpoint_size;
+
+ if (ddQuad->pFacets->numFacets > 0) {
+ memcpy( tri_fptr, quad_fptr, facet_size);
+ tri_fptr += facet_size;
+ memcpy( tri_fptr, quad_fptr, facet_size);
+ tri_fptr += facet_size;
+ quad_fptr += facet_size;
+ }
+ }
+
+ ddTri->points = *tri_list;
+
+ /*fire off the triangle strip routine*/
+ if (status = InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr))
+ goto exit;
+ }
+
+ /* Free up allocated space for generic struct and return */
+
+ exit:
+
+ xfree((char *)pGStr);
+ return (status);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miReplace.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miReplace.c
new file mode 100644
index 000000000..febda7820
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miReplace.c
@@ -0,0 +1,309 @@
+/* $TOG: miReplace.c /main/6 1998/02/10 12:42:28 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miReplace.c,v 3.6 1998/10/04 09:34:26 dawes Exp $ */
+
+
+#include "ddpex2.h"
+#include "miStruct.h"
+#include "pexExtract.h"
+#include "pexUtils.h"
+#include "miLight.h"
+#include "pexos.h"
+
+
+/** Replace functions:
+ ** Each takes two parameters: a pointer to the element to be
+ ** parsed (in PEX format) and a pointer to a pointer to return the
+ ** parsed element (in server native internal format).
+ **
+ ** See comments in pexOCParse.c
+ **
+ ** The routines in this file are exceptions to the symmetry
+ ** in parsing that allows us to use the same routines for creation
+ ** and replacement.
+ **
+ ** Note that these routines DO NOT allocate any memory; the calling
+ ** routines must ensure that sufficient memory has been allocated
+ ** in which to store the parsed element. Coders adding routines
+ ** to this file must obide by this rule.
+ **/
+
+
+extern void ParseFacetOptData();
+extern void ParseVertexData();
+extern int CountFacetOptData();
+extern int CountVertexData();
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CAT(a,b) a##b
+#else
+#define CAT(a,b) a/**/b
+#endif
+
+#define OC_REPLACE_FUNC_HEADER(suffix) \
+ ddpex2rtn CAT(replace,suffix)(pPEXOC, ppExecuteOC) \
+ ddElementInfo *pPEXOC; /* PEX format */ \
+ miGenericElementPtr *ppExecuteOC; /* internal format */
+
+#define OC_REPLACE_RETURN(ANSWER) \
+ return(Success);
+
+#define PARSER_PTR(PTR) \
+ ddPointer PTR = (ddPointer)(pPEXOC + 1)
+
+#define LEN_WO_HEADER(OCtype) (pPEXOC->length * sizeof(CARD32) - sizeof(OCtype))
+
+/* Note this macro assumes that if the old size is the same as the new
+ size, then the replace in place can happen. This may not be sufficient
+ proof. Counterexamples are dealt with on a case by case basis
+ (e.g., see replaceLightState below).
+ */
+#define CHECK_REPLACE(DD_ST, TYPE) \
+ if (!*ppExecuteOC) return (BadAlloc); \
+ if (pPEXOC->length != (*ppExecuteOC)->element.pexOClength) \
+ return (BadAlloc); \
+ (DD_ST) = (TYPE *)((*ppExecuteOC)+1);
+
+
+
+OC_REPLACE_FUNC_HEADER(LightState)
+{
+ miLightStateStruct *ddLightState;
+ pexLightState *pLight = (pexLightState *)pPEXOC;
+ extern ddpex2rtn parseLightState();
+
+ CHECK_REPLACE( ddLightState, miLightStateStruct);
+
+ /*
+ may have padding due to pointer alignment insurance
+ */
+ if ((MAKE_EVEN(pLight->numEnable) + MAKE_EVEN(pLight->numDisable))
+ != (MAKE_EVEN(ddLightState->enableList->numObj)
+ + MAKE_EVEN(ddLightState->disableList->numObj)))
+ return(BadAlloc);
+
+ return(parseLightState(pPEXOC, ppExecuteOC));
+}
+
+
+OC_REPLACE_FUNC_HEADER(SOFAS)
+{
+ miSOFASStruct *ddFill;
+ pexSOFAS *pFill = (pexSOFAS *)pPEXOC;
+ PARSER_PTR(ptr);
+ CARD16 i,j;
+ miConnListList *pCLL;
+ miConnList *pCList;
+ ddPointer rptr = 0;
+ ddPointer vertexPtr = 0;
+ ddPointer facetPtr = 0;
+ int edgeSize = 0;
+ int facetSize = 0;
+ int vertexSize = 0;
+ ddpex2rtn err = Success;
+
+ CHECK_REPLACE( ddFill, miSOFASStruct);
+ if ( (pFill->numFAS != ddFill->numFAS)
+ || (pFill->numEdges != ddFill->numEdges)
+ || (pFill->numVertices != ddFill->points.ddList->maxData))
+ return(BadAlloc); /* still not a sufficient check... */
+
+ facetSize = CountFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)(pFill->numFAS),
+ pFill->FAS_Attributes);
+ vertexSize = CountVertexData( ptr, pFill->colourType,
+ (CARD32)(pFill->numVertices),
+ pFill->vertexAttributes);
+ if (pFill->edgeAttributes){
+ edgeSize = pFill->numEdges * sizeof(ddUCHAR);
+ edgeSize += ((4 - (edgeSize & 3)) & 3);
+ }
+
+ EXTRACT_CARD16(ddFill->shape, ptr);
+ ddFill->contourHint = pFill->contourHint;
+ ddFill->contourCountsFlag = pFill->contourCountsFlag;
+ ddFill->numFAS = pFill->numFAS;
+ ddFill->numEdges = pFill->numEdges;
+ ptr = (ddPointer)(pFill+1);
+ ddFill->points.ddList = (listofddPoint *)(ddFill + 1);
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = 1;
+ ddFill->points.maxLists = 1;
+
+ facetPtr = (ddPointer)(ddFill->points.ddList + 1);
+ ParseFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)(pFill->numFAS),
+ pFill->FAS_Attributes, &(ddFill->pFacets),
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ ParseVertexData( ptr, pFill->colourType, (CARD32)(pFill->numVertices),
+ pFill->vertexAttributes, ddFill->points.ddList,
+ &vertexPtr, &(ddFill->points.type), &rptr);
+ ptr = rptr;
+
+ ddFill->edgeAttribs = pFill->edgeAttributes;
+ if (pFill->edgeAttributes) {
+ ddFill->edgeData = (ddUCHAR *)vertexPtr;
+ EXTRACT_STRUCT(ddFill->numEdges, ddUCHAR, ddFill->edgeData, ptr);
+ SKIP_PADDING( ptr, ((4 - (ddFill->numEdges & 3)) & 3) );
+ }
+ else { ddFill->edgeData = 0; }
+ vertexPtr += edgeSize;
+
+ ddFill->connects.numListLists = pFill->numFAS;
+ ddFill->connects.data = (miConnListList *)vertexPtr;
+ ddFill->connects.maxData = ddFill->numFAS * sizeof(miConnListList);
+ for (i=0, pCLL = ddFill->connects.data; i<pFill->numFAS; i++, pCLL++) {
+ EXTRACT_CARD16(pCLL->numLists,ptr);
+ pCLL->maxData = pCLL->numLists * sizeof(miConnList);
+ for (j=0, pCList=pCLL->pConnLists; j<pCLL->numLists; j++, pCList++) {
+ EXTRACT_CARD16(pCList->numLists,ptr);
+ EXTRACT_STRUCT(pCList->numLists, ddUSHORT, pCList->pConnects, ptr);
+ pCList->maxData = pCList->numLists * sizeof(ddUSHORT);
+ }
+ }
+ OC_REPLACE_RETURN(ddFill);
+
+}
+
+
+
+OC_REPLACE_FUNC_HEADER(NurbSurface)
+{
+ miNurbSurfaceStruct *ddNurb;
+ PARSER_PTR(ptr);
+ pexNurbSurface *pNurb = (pexNurbSurface *)pPEXOC;
+ ddULONG i, j, k;
+ listofTrimCurve *ddTrim;
+ ddTrimCurve *ddtc;
+ ddUSHORT type;
+
+ CHECK_REPLACE( ddNurb, miNurbSurfaceStruct);
+ if ( (pNurb->numUknots != ddNurb->numUknots)
+ || (pNurb->numVknots != ddNurb->numVknots)
+ || (pNurb->mPts != ddNurb->mPts)
+ || (pNurb->nPts != ddNurb->nPts)
+ || (pNurb->numLists != ddNurb->numTrimCurveLists)
+ || (pNurb->uOrder != ddNurb->uOrder)
+ || (pNurb->vOrder != ddNurb->vOrder)
+ || ( (pNurb->type == PEXRational)
+ && (ddNurb->points.type != DD_HOMOGENOUS_POINT))
+ || ( (pNurb->type == PEXNonRational)
+ && (ddNurb->points.type != DD_3D_POINT)))
+ return(BadAlloc); /* still not a sufficient check... */
+
+ ddNurb->pUknots = (ddFLOAT *)(ddNurb+1);
+ ddNurb->pVknots = (ddFLOAT *)((ddNurb->pUknots) + pNurb->numUknots);
+ ddNurb->points.ddList =
+ (listofddPoint *)((ddNurb->pVknots) + pNurb->numVknots);
+ ddNurb->points.ddList->pts.ptr = (char *)(ddNurb->points.ddList + 1);
+ ddNurb->trimCurves =
+ (listofTrimCurve *)((ddNurb->points.ddList->pts.ptr)
+ + (pNurb->mPts * pNurb->nPts) * sizeof(ddCoord4D));
+
+ SKIP_PADDING(ptr, 2); /* place holder for type */
+ EXTRACT_CARD16(ddNurb->uOrder, ptr);
+ EXTRACT_CARD16(ddNurb->vOrder, ptr);
+ SKIP_PADDING(ptr, 2);
+ EXTRACT_CARD32(ddNurb->numUknots, ptr);
+ EXTRACT_CARD32(ddNurb->numVknots, ptr);
+ EXTRACT_CARD16(ddNurb->mPts, ptr);
+ EXTRACT_CARD16(ddNurb->nPts, ptr);
+ EXTRACT_CARD32(ddNurb->numTrimCurveLists, ptr); /* is pNurb->numLists */
+
+ EXTRACT_STRUCT(ddNurb->numUknots, PEXFLOAT, ddNurb->pUknots, ptr);
+ EXTRACT_STRUCT(ddNurb->numVknots, PEXFLOAT, ddNurb->pVknots, ptr);
+
+ ddNurb->points.numLists = 1;
+ ddNurb->points.maxLists = 1;
+ if (pNurb->type == PEXRational) {
+ ddNurb->points.type = DD_HOMOGENOUS_POINT;
+ EXTRACT_STRUCT( ddNurb->mPts * ddNurb->nPts, ddCoord4D,
+ ddNurb->points.ddList->pts.p4Dpt, ptr);
+ } else {
+ ddNurb->points.type = DD_3D_POINT;
+ EXTRACT_STRUCT( ddNurb->mPts * ddNurb->nPts, ddCoord3D,
+ ddNurb->points.ddList->pts.p3Dpt, ptr);
+ }
+
+ for ( i=0, ddTrim = ddNurb->trimCurves;
+ i<ddNurb->numTrimCurveLists;
+ i++, ddTrim++) {
+ EXTRACT_CARD32(ddTrim->count, ptr);
+
+ for ( j=0, ddtc = ddTrim->pTC;
+ j < ddTrim->count;
+ j++, ddtc++) {
+ EXTRACT_CARD8(ddtc->visibility, ptr);
+ SKIP_PADDING(ptr, 1);
+ EXTRACT_CARD16(ddtc->order, ptr);
+ EXTRACT_CARD16(type, ptr);
+ EXTRACT_CARD16(ddtc->curveApprox.approxMethod, ptr);
+ EXTRACT_FLOAT(ddtc->curveApprox.tolerance, ptr);
+ EXTRACT_FLOAT(ddtc->uMin, ptr);
+ EXTRACT_FLOAT(ddtc->uMax, ptr);
+ EXTRACT_CARD32(ddtc->numKnots, ptr);
+ EXTRACT_CARD32(ddtc->points.numPoints, ptr);
+ EXTRACT_STRUCT( ddtc->numKnots, PEXFLOAT, ddtc->pKnots, ptr);
+ if (type == PEXRational) {
+ /* Note this only works because these points are never
+ transformed */
+ ddtc->pttype = DD_3D_POINT;
+ ddtc->points.pts.p3Dpt = 0;
+ EXTRACT_STRUCT( ddtc->points.numPoints, ddCoord3D,
+ ddtc->points.pts.p3Dpt, ptr);
+ } else {
+ ddtc->pttype = DD_2D_POINT;
+ ddtc->points.pts.p2Dpt = 0;
+ EXTRACT_STRUCT( ddtc->points.numPoints, ddCoord2D,
+ ddtc->points.pts.p2Dpt, ptr);
+ }
+ }
+ }
+ OC_REPLACE_RETURN(ddNurb);
+
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSOFAS.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSOFAS.c
new file mode 100644
index 000000000..46080f59c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSOFAS.c
@@ -0,0 +1,216 @@
+/* $TOG: miSOFAS.c /main/5 1998/02/10 12:42:32 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miSOFAS.c,v 3.6 1998/10/04 09:34:26 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "ddpex2.h"
+#include "miLight.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miSOFAS
+ |
+ | Function Description:
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miSOFAS(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+/* calls */
+ extern ocTableType InitExecuteOCTable[];
+
+/* Local variable definitions */
+ miSOFASStruct *ddSOFAS = (miSOFASStruct *)(pExecuteOC+1);
+ miFillAreaStruct *ddFill;
+ miGenericStr *pGStr;
+ listofddFacet *input_facet = &ddSOFAS->pFacets; /* facets */
+ miConnHeader *index_list_hdr = &ddSOFAS->connects; /* vertex index */
+ miConnListList *index_list_list = index_list_hdr->data;
+ miConnList *index_list;
+ ddUSHORT *index;
+ ddUCHAR *edge_ptr = ddSOFAS->edgeData;
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *fillarea;
+ listofddFacet *fillareafacet;
+ listofddPoint *pddilist, *pddolist;
+ char *in_pt;
+ ddPointUnion out_pt;
+ ddPointer in_fct, out_fct;
+ int i, j, k;
+ int point_size, out_point_size, facet_size;
+ ddpex3rtn status = Success;
+
+ /*
+ * This implementation does not implement SOFAS directly.
+ * Instead, the SOFAS data is re-organized to describe a
+ * fill area set, and the fill area set code is then called
+ * to perform the rendering.
+ */
+ /* Allocate storage for the fill area command block */
+ if (!(pGStr = (miGenericStr *) (xalloc(sizeof(miGenericStr) +
+ sizeof(miFillAreaStruct)))))
+ return(BadAlloc);
+
+ pGStr->elementType = PEXOCFillAreaSet;
+ /* The length data is ignored by the rendering routine and hence is */
+ /* left as whatever GARBAGE that will be present at the alloc time. */
+
+ ddFill = (miFillAreaStruct *) (pGStr + 1);
+
+ /* Initialize constant part of fill area command structure */
+ ddFill->shape = ddSOFAS->shape; /* shape hint */
+ ddFill->ignoreEdges = PEXOff; /* edge flag */
+ ddFill->contourHint = ddSOFAS->contourHint;/* contour hint */
+ ddFill->points.type = ddSOFAS->points.type;
+ if (ddSOFAS->edgeAttribs) DD_SetVertEdge(ddFill->points.type);
+ ddFill->points.flags = ddSOFAS->points.flags;
+ ddFill->pFacets = NULL;
+
+ DD_VertPointSize( ddSOFAS->points.type, point_size);
+ DD_VertPointSize( ddFill->points.type, out_point_size);
+ DDFacetSIZE( input_facet->type, facet_size);
+
+ /* Only one input vertex list */
+ pddilist = ddSOFAS->points.ddList;
+ in_pt = pddilist->pts.ptr;
+ if (input_facet->type != DD_FACET_NONE)
+ in_fct = input_facet->facets.pNoFacet;
+ else in_fct = NULL;
+
+ /* one fill area set call per facet */
+ for (i = 0; i < ddSOFAS->numFAS; i++) {
+
+ /* get next set of vertex indices */
+ index_list = index_list_list->pConnLists;
+ ddFill->points.numLists = index_list_list->numLists;
+
+ /* Get next free vertex list header */
+ fillarea = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(fillarea,
+ MI_ROUND_LISTHEADERCOUNT(index_list_list->numLists));
+ if (!(pddolist = fillarea->ddList)) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ /* get next free facet list header */
+ if (in_fct) {
+ fillareafacet = MI_NEXTTEMPFACETLIST(pddc);
+ MI_ALLOCLISTOFDDFACET(fillareafacet, 1, facet_size);
+ ddFill->pFacets = fillareafacet;
+ fillareafacet->type = input_facet->type;
+ fillareafacet->numFacets = 1;
+ out_fct = fillareafacet->facets.pNoFacet;
+ }
+
+ /* Now, transform each list */
+ for (j = 0; j < index_list_list->numLists; j++) {
+ /*
+ * Insure sufficient room for each vertex
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,index_list->numLists,out_point_size);
+ if (!(pddolist->pts.ptr)) {
+ status = BadAlloc;
+ goto exit;
+ }
+
+ out_pt = pddolist->pts;
+
+ index = index_list->pConnects;
+
+ for (k = 0; k < index_list->numLists; k++) {
+ memcpy( out_pt.ptr, (in_pt+(*index * point_size)), point_size);
+ out_pt.ptr += point_size;
+ if (ddSOFAS->edgeAttribs) *(out_pt.pEdge++) = *(edge_ptr++);
+ index++;
+ }
+
+ pddolist->numPoints = index_list->numLists;
+
+ /* Prepare for next bound */
+ pddolist++;
+ /* get indices for next bound */
+ index_list++;
+ }
+
+ /* Copy facet data for FAS */
+ if (in_fct) {
+ memcpy( (char *)out_fct, (char *)in_fct, facet_size);
+ out_fct += facet_size;
+ in_fct += facet_size;
+ }
+
+ /* Render fill area */
+ ddFill->points.numLists = index_list_list->numLists;
+ ddFill->points.ddList = fillarea->ddList;
+ if (status=InitExecuteOCTable[(int)(pGStr->elementType)](pRend, pGStr))
+ goto exit;
+
+ index_list_list++;
+ }
+
+exit:
+ xfree(pGStr);
+
+ return(status);
+
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSearch.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSearch.c
new file mode 100644
index 000000000..ab119a907
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miSearch.c
@@ -0,0 +1,295 @@
+/* $TOG: miSearch.c /main/7 1998/02/10 12:42:37 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miSearch.c,v 3.5 1998/10/04 09:34:27 dawes Exp $ */
+
+#include "miWks.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "ddpex2.h"
+#include "miFont.h"
+#include "miText.h"
+#include "miClip.h"
+#include "pexos.h"
+
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
+extern ocTableType InitExecuteOCTable[];
+
+/*
+ * Function Name: compute_search_volume
+ *
+ * Purpose: Compute the intersection of the clip limits and the
+ * search aperture. The search aperture is defined as
+ * a cube centered around search position and search
+ * distance being the distance between the center and the
+ * faces of the cube.
+ * Return:
+ * search volume.
+ */
+ddpex2rtn
+compute_search_volume(pDDC, search_volume)
+/* in */
+ miDDContext *pDDC;
+
+/* out */
+register ddNpcSubvolume *search_volume; /* Intersection to use */
+{
+/* calls */
+
+/* Local variable definitions */
+ ddCoord3D pos;
+ ddFLOAT dis;
+
+ /* Get the search position and distance first */
+
+ pos = pDDC->Static.search.position;
+ dis = pDDC->Static.search.distance;
+
+ if (dis <= 0.0) dis = 0.0001; /* Make sure we have the search volume */
+ /* collapsing almost to reference point */
+ /* when the distance is negative or zero*/
+
+ /* Compute a search volume centered around the search position and */
+ /* of half width, half height, and half length equal to the search */
+ /* distance. */
+
+ search_volume->minval.x = pos.x - dis;
+ search_volume->maxval.x = pos.x + dis;
+
+ search_volume->minval.y = pos.y - dis;
+ search_volume->maxval.y = pos.y + dis;
+
+ search_volume->minval.z = pos.z - dis;
+ search_volume->maxval.z = pos.z + dis;
+
+ return (Success);
+}
+
+
+/*
+ * Function Name: compute_search_volume_xform
+ *
+ * Purpose: Compute the transformation that transform the primitive
+ * to be searched from search_volume to CC. Remember that we
+ * will use the standard primitive clipping functions to figure
+ * out whether a given primitive lies within the search aperture.
+ * Return:
+ * sv_to_cc_xform to be used to figure out search hits.
+ */
+void
+compute_search_volume_xform(search_volume, sv_to_cc_xform)
+/* in */
+ ddNpcSubvolume *search_volume;
+/* out */
+ ddFLOAT sv_to_cc_xform[4][4];
+/* calls */
+{
+ /* The transformation needed here is to go from search_volume to clip_
+ * volume as shown in 2D below. We extend the transform to handle the 3D
+ * trivially.
+ *
+ * search_volume clip_volume
+ * ------------- -----------
+ *
+ * +-----+(c,d) +---------+(1,1)
+ * | | | |
+ * | | =======> | |
+ * | | | |
+ * (a,b)+-----+ (-1,-1)+---------+
+ *
+ * sv_to_cc_xform (2D): 2/(c-a) 0 (c+a)/(a-c)
+ * 0 2/(d-b) (d+b)/(b-d)
+ * 0 0 0
+ */
+
+ memcpy( (char *)sv_to_cc_xform, (char *)ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* Check for trivial search volume, I.E., a point or a cube with */
+ /* zero dimensions. If so, initialize the transform to ? ? ? */
+
+ if (search_volume->maxval.x == search_volume->minval.x) {
+
+ /* Plug in the special ? ? ? */
+
+ return;
+ }
+
+ /* The search volume is NOT trivially a point; it is a finite */
+ /* volume for which a transform can be computed to go to CC. */
+
+ sv_to_cc_xform[0][0] =
+ 2.0 / (search_volume->maxval.x - search_volume->minval.x);
+ sv_to_cc_xform[1][1] =
+ 2.0 / (search_volume->maxval.y - search_volume->minval.y);
+ sv_to_cc_xform[2][2] =
+ 2.0 / (search_volume->maxval.z - search_volume->minval.z);
+ sv_to_cc_xform[0][3] =
+ (search_volume->maxval.x + search_volume->minval.x) /
+ (search_volume->minval.x - search_volume->maxval.x);
+ sv_to_cc_xform[1][3] =
+ (search_volume->maxval.y + search_volume->minval.y) /
+ (search_volume->minval.y - search_volume->maxval.y);
+ sv_to_cc_xform[2][3] =
+ (search_volume->maxval.z + search_volume->minval.z) /
+ (search_volume->minval.z - search_volume->maxval.z);
+}
+
+
+/*++
+ |
+ | Function Name: miSearchPrimitives
+ |
+ | Function Description:
+ | Handles the searching of most primitives in a generic fashion.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miSearchPrimitives(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+/* calls */
+
+/* Local variable definitions */
+ miDDContext *pDDC = (miDDContext *)(pRend->pDDContext);
+ ddNpcSubvolume sv;
+ ddFLOAT buf1_xform[4][4];
+
+ /* Compute the search volume to do the ISS */
+
+ compute_search_volume (pDDC, &sv);
+
+ /* Get the transform to go from search volume to CC - buf1_xform */
+
+ compute_search_volume_xform (&sv, buf1_xform);
+
+ /* Get wc_to_cc_xform = (wc_to_npc_xform * buf1_xform) */
+
+ miMatMult (pDDC->Dynamic->wc_to_cc_xform,
+ pDDC->Dynamic->wc_to_npc_xform, buf1_xform);
+
+ /* Get mc_to_cc_xform = (mc_to_wc_xform * wc_to_cc_xform) */
+
+ miMatMult (pDDC->Dynamic->mc_to_cc_xform,
+ pDDC->Dynamic->mc_to_wc_xform,
+ pDDC->Dynamic->wc_to_cc_xform);
+
+ /* Now, call the level 2 rendering function to transform and */
+ /* clip the primitive. Note that the level 1 function vector */
+ /* now has PICKING routines instead of rendering routines. If*/
+ /* a search is detected the GLOBAL FLAG will have been up- */
+ /* dated. Check this flag to determine if anything was indeed*/
+ /* searched by the level 1 searching routines. */
+
+ InitExecuteOCTable[(int)(pExecuteOC->elementType)]
+ (pRend, pExecuteOC);
+
+ /* If successful PICK, set the search status flag */
+
+ if (pDDC->Static.pick.status == PEXOk)
+ pDDC->Static.search.status = PEXFound;
+
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miTestSearchGdp3d
+ |
+ | Function Description:
+ | Provides the dummy test routine for searching 3d Gdps.
+ | with data OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miTestSearchGdp3d(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ ErrorF ("miTestSearchGdp3d\n");
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miTestSearchGdp2d
+ |
+ | Function Description:
+ | Provides the dummy test routine for searching 2d Gdps.
+ | with data OCs.
+ |
+ | Note(s):
+ |
+ ++*/
+
+ddpex2rtn
+miTestSearchGdp2d(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ ErrorF ("miSearchPickGdp2d\n");
+ return (Success);
+}
+
+
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTestOCs.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTestOCs.c
new file mode 100644
index 000000000..3022e42ad
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTestOCs.c
@@ -0,0 +1,269 @@
+/* $TOG: miTestOCs.c /main/3 1998/02/10 12:42:41 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#include "mipex.h"
+#include "ddpex3.h"
+#include "miStruct.h"
+#include "miRender.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+
+
+/* Level III Output Command Primitives */
+
+static char *ptTypeNames[] = {
+ "DD_2D_POINT", /* 2D point */
+ "DD_3D_POINT", /* 3D point */
+ "DD_INDEX_POINT", /* 3D point w/ colour */
+ "DD_RGB8_POINT", /* 3D point w/ colour */
+ "DD_RGB16_POINT", /* 3D point w/ colour */
+ "DD_RGBFLOAT_POINT", /* 3D point w/ colour */
+ "DD_HSV_POINT", /* 3D point w/ colour */
+ "DD_HLS_POINT", /* 3D point w/ colour */
+ "DD_CIE_POINT", /* 3D point w/ colour */
+ "DD_NORM_POINT", /* 3D point w/ normal */
+ "DD_EDGE_POINT", /* 3D point w/ edge flag */
+ "DD_INDEX_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_RGB8_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_RGB16_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_RGBFLOAT_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_HSV_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_HLS_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_CIE_NORM_POINT", /* 3D point w/ colour & normal */
+ "DD_INDEX_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_RGB8_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_RGB16_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_RGBFLOAT_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_HSV_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_HLS_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_CIE_EDGE_POINT", /* 3D point w/ colour & edge flag */
+ "DD_NORM_EDGE_POINT", /* 3D point w/ normal & edge flag */
+ "DD_INDEX_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_RGB8_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_RGB16_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_RGBFLOAT_NORM_EDGE_POINT",/* 3D point w/ colour, normal & edge */
+ "DD_HSV_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_HLS_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_CIE_NORM_EDGE_POINT", /* 3D point w/ colour, normal & edge */
+ "DD_HOMOGENOUS_POINT" /* homogenous point (4D) */
+};
+
+static char *pfTypeNames[] = {
+ "DD_FACET_NONE", /* no facet attributes */
+ "DD_FACET_INDEX", /* facet colour */
+ "DD_FACET_RGB8", /* facet colour */
+ "DD_FACET_RGB16", /* facet colour */
+ "DD_FACET_RGBFLOAT", /* facet colour */
+ "DD_FACET_HSV", /* facet colour */
+ "DD_FACET_HLS", /* facet colour */
+ "DD_FACET_CIE", /* facet colour */
+ "DD_FACET_NORM", /* facet normal */
+ "DD_FACET_INDEX_NORM", /* facet colour & normal */
+ "DD_FACET_RGB8_NORM", /* facet colour & normal */
+ "DD_FACET_RGB16_NORM", /* facet colour & normal */
+ "DD_FACET_RGBFLOAT_NORM", /* facet colour & normal */
+ "DD_FACET_HSV_NORM", /* facet colour & normal */
+ "DD_FACET_HLS_NORM", /* facet colour & normal */
+ "DD_FACET_CIE_NORM" /* facet colour & normal */
+};
+
+static char *piTypeNames[] = {
+ "DD_VERTEX",
+ "DD_VERTEX_EDGE"
+};
+
+static int test_print_flag = 0;
+
+#define PRINT_POINT_INFO( pt ) \
+\
+ ErrorF( "\tPoint Type: %d %s\tNum Lists: %d\n", \
+ (pt)->type, ptTypeNames[(int)((pt)->type)], (pt)->numLists )
+
+#define PRINT_FACET_INFO( pf ) \
+\
+ ErrorF( "\tFacet Type: %d %s\tNum Facets: %d\n", \
+ (pf)->type, pfTypeNames[(int)((pf)->type)], (pf)->numFacets )
+
+#define PRINT_INDEX_INFO( pi ) \
+\
+ ErrorF( "\tIndex Type: %d %s\tNum Index: %d\n", \
+ (pi)->type, piTypeNames[(int)((pi)->type)], (pi)->numIndex )
+
+/*++
+ |
+ | Function Name: miTestNurbSurface
+ |
+ | Function Description:
+ | Handles the Non-uniform B-spline surfac ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestNurbSurface(pRend, pSurf, numCurves, pTrimCurve)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ ddNurbSurface *pSurf; /* surface data */
+ ddULONG numCurves;/* number of trim curves */
+ listofTrimCurve *pTrimCurve; /* trim curve */
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestNurbSurface\n");
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miTestCellArrays
+ |
+ | Function Description:
+ | Handles the Cell array 3D, Cell array 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestCellArrays(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestCellArrays\n");
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miTestExtCellArray
+ |
+ | Function Description:
+ | Handles the Extended Cell array ocs
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestExtCellArray(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestExtCellArray\n");
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miTestGDP
+ |
+ | Function Description:
+ | Handles the GDP 3D, GDP 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestGDP(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestGDP\n");
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miTestSetAttribute
+ |
+ | Function Description:
+ | Handles the All Other ocs (to set attributes).
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestSetAttribute(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC; /* output command */
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestSetAttribute\n");
+ return (Success);
+}
+
+
+
+/*++
+ |
+ | Function Name: miTestColourOC
+ |
+ | Function Description:
+ | Handles the Colour setting OC's.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex2rtn
+miTestColourOC(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ if (test_print_flag) ErrorF( "miTestColourOC\n");
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miText.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miText.c
new file mode 100644
index 000000000..45b415eed
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miText.c
@@ -0,0 +1,2168 @@
+/* $TOG: miText.c /main/14 1998/02/10 12:42:46 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miText.c,v 3.6 1998/10/04 09:34:28 dawes Exp $ */
+
+#include "miLUT.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "ddpex3.h"
+#include "ddpex2.h"
+#include "miRender.h"
+#include "miFont.h"
+#include "miText.h"
+#include "miClip.h"
+#include "gcstruct.h"
+#include "pexos.h"
+
+#ifndef PADDING
+#define PADDING(n) ( (n)%4 ? (4 - ((n)%4)) : 0)
+#endif
+
+extern ddpex3rtn ComputeMCVolume();
+
+ddpex2rtn
+tx_el_to_path(pRend, pddc, numFragments, pString, numChars, tx_el,
+ align_pt, count_ret)
+/* in */
+ ddRendererPtr pRend; /* Renderer handle */
+ miDDContext *pddc; /* Context handle */
+ ddUSHORT numFragments; /* # of mono encodings */
+ pexMonoEncoding *pString; /* Pointer to ISTRING */
+ ddULONG numChars; /* Total # of chars in ISTRING */
+/* out */
+ miTextElement *tx_el; /* text element data */
+ ddCoord2D *align_pt; /* text alignment */
+ ddULONG *count_ret; /* return character count */
+{
+/* Define required temporary variables */
+
+ miCharPath *CharPtr;
+ ddUSHORT fontIndex;
+ ddUSHORT path;
+ ddFLOAT expansion;
+ ddFLOAT spacing;
+ ddTextAlignmentData *pAlignment;
+ diLUTHandle fontTable;
+ register ddPointer ptr, save_ptr;
+ miTextFontEntry *ptr1;
+ pexMonoEncoding *mono_enc;
+ int fragnum, charnum, some_characters, signum, bytes;
+ CARD32 charval;
+ diFontHandle font_handle;
+ miFontHeader *font;
+ Ch_stroke_data *char_data;
+ ddFLOAT sp;
+ Meta_font meta_font;
+ pexCoord2D cur, end, cpt;
+ float xmin, xmax, ymin, ymax;
+ ddTextFontEntry *fontEntry;
+ ddUSHORT es, clip_mode;
+ extern void micalc_cpt_and_align();
+
+ *count_ret = 0;
+
+ fontIndex = pddc->Static.attrs->textFont;
+ expansion = ABS(pddc->Static.attrs->charExpansion);
+ spacing = pddc->Static.attrs->charSpacing;
+ path = pddc->Static.attrs->textPath;
+ sp = spacing * FONT_COORD_HEIGHT;
+ pAlignment = &(pddc->Static.attrs->textAlignment);
+
+ /* Get the handle for font table */
+
+ fontTable = pRend->lut[PEXTextFontLUT];
+
+ /* Inquire the Font table to get the ddTextFontEntry member */
+
+ if ((InquireLUTEntryAddress (PEXTextFontLUT, fontTable, fontIndex, &es,
+ (ddPointer *)&ptr1)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ fontEntry = &ptr1->entry;
+
+ /* Allocate space for stroke definitions of all chars in ISTRING */
+
+ if (!((tx_el->paths) = (miCharPath *) xalloc(numChars *
+ sizeof(miCharPath))))
+ return (BadAlloc);
+
+ /* signum is used later on to encapsulate addition vs. subtraction */
+
+ if (path == PEXPathRight || path == PEXPathUp)
+ signum = 1;
+ else
+ signum = -1;
+
+ ptr = (ddPointer) pString;
+
+ /* Process the input ISTRING */
+
+ meta_font.top = -1.0e20;
+ meta_font.bottom = 1.0e20;
+ meta_font.width = 1.0e-20;
+
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = 0.0;
+ cur.x = end.x = cur.y = end.y = 0.0;
+
+ some_characters = 0; /* Make TRUE when a valid character is found */
+
+ save_ptr = ptr; /* Save this for later use */
+
+ /* First determine the largest character box size within ISTRING */
+ /* Do for each MONO_ENCODING fragment within the ISTRING */
+
+ for (fragnum = 0; fragnum < numFragments; fragnum++) {
+
+ mono_enc = (pexMonoEncoding *)ptr;
+ ptr += sizeof(pexMonoEncoding);
+
+ if (mono_enc->characterSet < 1 ||
+ mono_enc->characterSet > fontEntry->numFonts)
+ mono_enc->characterSet = 1;
+
+ font_handle = fontEntry->fonts[mono_enc->characterSet - 1];
+
+ /* This is the font that this MONO_ENCODING would be rendered with */
+
+ font = (miFontHeader *)(font_handle->deviceData);
+
+ /* Bump up ISTRINGS extremes if appropriate */
+
+ if (font->top > meta_font.top)
+ meta_font.top = font->top;
+ if (font->bottom < meta_font.bottom)
+ meta_font.bottom = font->bottom;
+ if (font->max_width > meta_font.width)
+ meta_font.width = font->max_width;
+
+ bytes = mono_enc->numChars *
+ ((mono_enc->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((mono_enc->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+
+ ptr += (bytes + PADDING (bytes));
+ }
+
+ /* Now get the character definition and the required per character */
+ /* translation component required to be applied during rendering. */
+
+ ptr = save_ptr; /* Restore the ptr */
+ CharPtr = tx_el->paths; /* Initialize the pointer to character data */
+
+ for (fragnum = 0; fragnum < numFragments; fragnum++) {
+
+ mono_enc = (pexMonoEncoding *)ptr;
+ ptr += sizeof(pexMonoEncoding);
+
+ font_handle = fontEntry->fonts[mono_enc->characterSet - 1];
+ font = (miFontHeader *)(font_handle->deviceData);
+
+ /* Do for each character within the MONO_ENCODING */
+
+ for (charnum = 0; charnum < mono_enc->numChars; charnum++) {
+
+ switch (mono_enc->characterSetWidth) {
+ case PEXCSByte :
+ charval = (CARD32)(*(CARD8 *)ptr);
+ ptr += sizeof(CARD8);
+ break;
+ case PEXCSShort :
+ charval = (CARD32)(*(CARD16 *)ptr);
+ ptr += sizeof(CARD16);
+ break;
+ case PEXCSLong :
+ charval = *(CARD32 *)ptr;
+ ptr += sizeof(CARD32);
+ break;
+ }
+
+ if (!(font->ch_data[charval])) /* undefined character */
+ if (font->font_info.defaultGlyph == 0 &&
+ font->font_info.firstGlyph > 0) /* no default */
+ /* no extent info is calculated for undefined indices
+ * in charsets where there is no default glyph */
+ continue;
+ else
+ charval = font->font_info.defaultGlyph;
+
+ some_characters = 1;
+ char_data = font->ch_data[charval]; /* Get strokes for char */
+
+ switch (path) {
+
+ case PEXPathRight :
+ case PEXPathLeft :
+ end.x = cur.x + signum*(char_data->right)*expansion;
+ if (cur.x > xmax) xmax = cur.x;
+ if (cur.x < xmin) xmin = cur.x;
+ if (end.x > xmax) xmax = end.x;
+ if (end.x < xmin) xmin = end.x;
+ cur.x = end.x + signum * sp;
+ break;
+
+ case PEXPathUp :
+ case PEXPathDown :
+ end.y = cur.y + signum * (meta_font.top -
+ meta_font.bottom);
+ if (cur.y > ymax) ymax = cur.y;
+ if (cur.y < ymin) ymin = cur.y;
+ if (end.y > ymax) ymax = end.y;
+ if (end.y < ymin) ymin = end.y;
+ cur.y = end.y + signum * sp;
+ cur.x += -char_data->right * 0.5 * expansion;
+ break;
+ }
+
+ /* Save the stroke definitions for the character */
+
+ CharPtr->path = &(char_data->strokes);
+
+ /* Save the translation per character */
+
+ (CharPtr->trans).x = cur.x;
+ (CharPtr->trans).y = cur.y;
+
+ /* Set cur.x back to lower left corner of character box */
+ /* for the cases of PEXPathUp and PEXPathDown. */
+
+ if (path==PEXPathUp || path==PEXPathDown)
+ cur.x -= -char_data->right * 0.5 * expansion;
+
+ CharPtr++; (*count_ret)++; /* Update pointer and count */
+
+ } /* for each character */
+
+ ptr += PADDING(mono_enc->numChars *
+ ((mono_enc->characterSetWidth == PEXCSByte)
+ ? sizeof(CARD8)
+ : ((mono_enc->characterSetWidth == PEXCSShort)
+ ? sizeof(CARD16)
+ : sizeof(CARD32))));
+
+ } /* for each MONO_ENCODING (fragment) */
+
+ /* Compute the alignment and concatenation point; however, */
+ /* the concatenation point (cpt) can be ignored here ! */
+
+ if (some_characters) {
+
+ micalc_cpt_and_align(&meta_font, &xmin, &xmax, &ymin, &ymax, path,
+ expansion, pAlignment, &cpt, align_pt);
+
+ } else {
+ /* no valid characters */
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = align_pt->x = align_pt->y = 0.0;
+ }
+
+ return (Success);
+}
+
+
+ddpex2rtn
+atx_el_to_path(pRend, pddc, numFragments, pString, numChars, tx_el,
+ align_pt, count_ret)
+/* in */
+ ddRendererPtr pRend; /* Renderer handle */
+ miDDContext *pddc; /* Context handle */
+ ddUSHORT numFragments; /* # of mono encodings */
+ pexMonoEncoding *pString; /* Pointer to ISTRING */
+ ddULONG numChars; /* Total # of chars in ISTRING */
+/* out */
+ miTextElement *tx_el; /* text element data */
+ ddCoord2D *align_pt; /* text alignment */
+ ddULONG *count_ret; /* return character count */
+{
+/* Define required temporary variables */
+
+ miCharPath *CharPtr;
+ ddUSHORT fontIndex;
+ ddUSHORT path;
+ ddFLOAT expansion;
+ ddFLOAT spacing;
+ ddTextAlignmentData *pAlignment;
+ diLUTHandle fontTable;
+ register ddPointer ptr, save_ptr;
+ miTextFontEntry *ptr1;
+ pexMonoEncoding *mono_enc;
+ int fragnum, charnum, some_characters, signum, bytes;
+ CARD32 charval;
+ diFontHandle font_handle;
+ miFontHeader *font;
+ Ch_stroke_data *char_data;
+ ddFLOAT sp;
+ Meta_font meta_font;
+ pexCoord2D cur, end, cpt;
+ float xmin, xmax, ymin, ymax;
+ ddTextFontEntry *fontEntry;
+ ddUSHORT es;
+ extern void micalc_cpt_and_align();
+
+ *count_ret = 0;
+
+ fontIndex = pddc->Static.attrs->textFont;
+ expansion = ABS(pddc->Static.attrs->charExpansion);
+ spacing = pddc->Static.attrs->charSpacing;
+ path = pddc->Static.attrs->atextPath;
+ sp = spacing * FONT_COORD_HEIGHT;
+ pAlignment = &(pddc->Static.attrs->atextAlignment);
+
+ /* Get the handle for font table */
+
+ fontTable = pRend->lut[PEXTextFontLUT];
+
+ /* Inquire the Font table to get the ddTextFontEntry member */
+
+ if ((InquireLUTEntryAddress (PEXTextFontLUT, fontTable, fontIndex, &es,
+ (ddPointer *)&ptr1)) == PEXLookupTableError)
+ return (PEXLookupTableError);
+
+ fontEntry = &ptr1->entry;
+
+ /* Allocate space for stroke definitions of all chars in ISTRING */
+
+ if (!((tx_el->paths) = (miCharPath *) xalloc(numChars *
+ sizeof(miCharPath))))
+ return (BadAlloc);
+
+ /* signum is used later on to encapsulate addition vs. subtraction */
+
+ if (path == PEXPathRight || path == PEXPathUp)
+ signum = 1;
+ else
+ signum = -1;
+
+ ptr = (ddPointer) pString;
+
+ /* Process the input ISTRING */
+
+ meta_font.top = -1.0e20;
+ meta_font.bottom = 1.0e20;
+ meta_font.width = 1.0e-20;
+
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = 0.0;
+ cur.x = end.x = cur.y = end.y = 0.0;
+
+ some_characters = 0; /* Make TRUE when a valid character is found */
+
+ save_ptr = ptr; /* Save this for later use */
+
+ /* First determine the largest character box size within ISTRING */
+ /* Do for each MONO_ENCODING fragment within the ISTRING */
+
+ for (fragnum = 0; fragnum < numFragments; fragnum++) {
+
+ mono_enc = (pexMonoEncoding *)ptr;
+ ptr += sizeof(pexMonoEncoding);
+
+ if (mono_enc->characterSet < 1 ||
+ mono_enc->characterSet > fontEntry->numFonts)
+ mono_enc->characterSet = 1;
+
+ font_handle = fontEntry->fonts[mono_enc->characterSet - 1];
+
+ /* This is the font that this MONO_ENCODING would be rendered with */
+
+ font = (miFontHeader *)(font_handle->deviceData);
+
+ /* Bump up ISTRINGS extremes if appropriate */
+
+ if (font->top > meta_font.top)
+ meta_font.top = font->top;
+ if (font->bottom < meta_font.bottom)
+ meta_font.bottom = font->bottom;
+ if (font->max_width > meta_font.width)
+ meta_font.width = font->max_width;
+
+ bytes = mono_enc->numChars *
+ ((mono_enc->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((mono_enc->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+
+ ptr += (bytes + PADDING (bytes));
+ }
+
+ /* Now get the character definition and the required per character */
+ /* translation component required to be applied during rendering. */
+
+ ptr = save_ptr; /* Restore the ptr */
+ CharPtr = tx_el->paths; /* Initialize the pointer to character data */
+
+ for (fragnum = 0; fragnum < numFragments; fragnum++) {
+
+ mono_enc = (pexMonoEncoding *)ptr;
+ ptr += sizeof(pexMonoEncoding);
+
+ font_handle = fontEntry->fonts[mono_enc->characterSet - 1];
+ font = (miFontHeader *)(font_handle->deviceData);
+
+ /* Do for each character within the MONO_ENCODING */
+
+ for (charnum = 0; charnum < mono_enc->numChars; charnum++) {
+
+ switch (mono_enc->characterSetWidth) {
+ case PEXCSByte :
+ charval = (CARD32)(*(CARD8 *)ptr);
+ ptr += sizeof(CARD8);
+ break;
+ case PEXCSShort :
+ charval = (CARD32)(*(CARD16 *)ptr);
+ ptr += sizeof(CARD16);
+ break;
+ case PEXCSLong :
+ charval = *(CARD32 *)ptr;
+ ptr += sizeof(CARD32);
+ break;
+ }
+
+ if (!(font->ch_data[charval])) /* undefined character */
+ if (font->font_info.defaultGlyph == 0 &&
+ font->font_info.firstGlyph > 0) /* no default */
+ /* no extent info is calculated for undefined indices
+ * in charsets where there is no default glyph */
+ continue;
+ else
+ charval = font->font_info.defaultGlyph;
+
+ some_characters = 1;
+ char_data = font->ch_data[charval]; /* Get strokes for char */
+
+ switch (path) {
+
+ case PEXPathRight :
+ case PEXPathLeft :
+ end.x = cur.x + signum*(char_data->right)*expansion;
+ if (cur.x > xmax) xmax = cur.x;
+ if (cur.x < xmin) xmin = cur.x;
+ if (end.x > xmax) xmax = end.x;
+ if (end.x < xmin) xmin = end.x;
+ cur.x = end.x + signum * sp;
+ break;
+
+ case PEXPathUp :
+ case PEXPathDown :
+ end.y = cur.y + signum * (meta_font.top -
+ meta_font.bottom);
+ if (cur.y > ymax) ymax = cur.y;
+ if (cur.y < ymin) ymin = cur.y;
+ if (end.y > ymax) ymax = end.y;
+ if (end.y < ymin) ymin = end.y;
+ cur.y = end.y + signum * sp;
+ cur.x += -char_data->right * 0.5 * expansion;
+ break;
+ }
+
+ /* Save the stroke definitions for the character */
+
+ CharPtr->path = &(char_data->strokes);
+
+ /* Save the translation per character */
+
+ (CharPtr->trans).x = cur.x;
+ (CharPtr->trans).y = cur.y;
+
+ /* Set cur.x back to lower left corner of character box */
+ /* for the cases of PEXPathUp and PEXPathDown. */
+
+ if (path==PEXPathUp || path==PEXPathDown)
+ cur.x -= -char_data->right * 0.5 * expansion;
+
+ CharPtr++; (*count_ret)++; /* Update pointer and count */
+
+ } /* for each character */
+
+ ptr += PADDING(mono_enc->numChars *
+ ((mono_enc->characterSetWidth == PEXCSByte)
+ ? sizeof(CARD8)
+ : ((mono_enc->characterSetWidth == PEXCSShort)
+ ? sizeof(CARD16)
+ : sizeof(CARD32))));
+
+ } /* for each MONO_ENCODING (fragment) */
+
+ /* Compute the alignment and concatenation point; however, */
+ /* the concatenation point (cpt) can be ignored here ! */
+
+ if (some_characters) {
+
+ micalc_cpt_and_align(&meta_font, &xmin, &xmax, &ymin, &ymax, path,
+ expansion, pAlignment, &cpt, align_pt);
+
+ } else {
+ /* no valid characters */
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = align_pt->x = align_pt->y = 0.0;
+ }
+
+ return (Success);
+}
+
+
+void
+text2_xform( pos, attrs, align, xf, aflag)
+ ddCoord2D *pos;
+ miDDContextRendAttrs *attrs;
+ ddVector2D *align;
+ register ddFLOAT xf[4][4];
+ ddUSHORT aflag;
+{
+ ddFLOAT ht_scale, inv_mag;
+ ddCoord2D vup;
+ ddCoord2D vbase;
+ register ddFLOAT a, b;
+ ddFLOAT temp[4][4], temp1[4][4];
+
+ /* Get the text or annotation text attribute values */
+
+ if (aflag == 0) {
+ ht_scale = ABS(attrs->charHeight / HEIGHT);
+ vup.x = attrs->charUp.x;
+ vup.y = attrs->charUp.y;
+ }
+ else {
+ ht_scale = ABS(attrs->atextHeight / HEIGHT);
+ vup.x = attrs->atextUp.x;
+ vup.y = attrs->atextUp.y;
+ }
+
+ inv_mag = 1.0 / sqrt( vup.x * vup.x + vup.y * vup.y);
+ vup.x *= inv_mag;
+ vup.y *= inv_mag;
+
+ /* Compute base vector = up vector rotated by 90 in Z */
+
+ vbase.x = vup.y;
+ vbase.y = -vup.x;
+
+ inv_mag = 1.0 / sqrt( vbase.x * vbase.x + vbase.y * vbase.y);
+ vbase.x *= inv_mag;
+ vbase.y *= inv_mag;
+
+ a = -ht_scale * align->x;
+ b = -ht_scale * align->y;
+
+ /* Initialize temp to identity */
+
+ miMatIdent (temp);
+
+ /* Store the scaling components */
+
+ temp[0][0] = temp[1][1] = ht_scale;
+
+ /* Store the translation components */
+
+ temp[0][3] = a;
+ temp[1][3] = b;
+
+ /* Let temp1 hold the base vector, the up vector, and the
+ text position. */
+
+ temp1[0][0] = vbase.x;
+ temp1[0][1] = vup.x;
+ temp1[0][2] = 0.0;
+ temp1[0][3] = pos->x;
+
+ temp1[1][0] = vbase.y;
+ temp1[1][1] = vup.y;
+ temp1[1][2] = 0.0;
+ temp1[1][3] = pos->y;
+
+ temp1[2][0] = temp1[3][0] = 0.0;
+ temp1[2][1] = temp1[3][1] = 0.0;
+ temp1[2][2] = temp1[3][3] = 1.0;
+ temp1[2][3] = 0.0;
+ temp1[3][2] = 0.0;
+
+ miMatMult( xf, temp, temp1 );
+}
+
+
+void
+text3_xform( pos, u, v, attrs, align, xf, aflag)
+ ddCoord3D *pos;
+ register ddVector3D *u, *v;
+ miDDContextRendAttrs *attrs;
+ ddVector2D *align;
+ register ddFLOAT xf[4][4];
+ ddUSHORT aflag;
+{
+ ddFLOAT ht_scale, inv_mag;
+ ddCoord3D vup;
+ ddCoord3D vbase;
+ register ddFLOAT a, b;
+ ddFLOAT temp[4][4], temp1[4][4];
+ ddFLOAT temp2[4][4], temp3[4][4];
+ ddVector3D e_one, e_two, e_three;
+ register ddVector3D *e3 = &e_three, *e2 = &e_two, *e1 = &e_one;
+
+ /* Get the text or annotation text attribute values */
+
+ if (aflag == 0) {
+ ht_scale = ABS(attrs->charHeight / HEIGHT);
+ vup.x = attrs->charUp.x;
+ vup.y = attrs->charUp.y;
+ vup.z = 0.0;
+ }
+ else {
+ ht_scale = ABS(attrs->atextHeight / HEIGHT);
+ vup.x = attrs->atextUp.x;
+ vup.y = attrs->atextUp.y;
+ vup.z = 0.0;
+ }
+
+ inv_mag = 1.0 / sqrt( vup.x * vup.x + vup.y * vup.y);
+ vup.x *= inv_mag;
+ vup.y *= inv_mag;
+
+ /* Compute base vector = up vector rotated by 90 in Z */
+
+ vbase.x = vup.y;
+ vbase.y = -vup.x;
+ vbase.z = 0.0;
+
+ inv_mag = 1.0 / sqrt( vbase.x * vbase.x + vbase.y * vbase.y);
+ vbase.x *= inv_mag;
+ vbase.y *= inv_mag;
+
+ a = -align->x * ht_scale;
+ b = -align->y * ht_scale;
+
+ /* Initialize temp to identity */
+
+ miMatIdent (temp);
+
+ /* Store the scaling components */
+
+ temp[0][0] = temp[1][1] = ht_scale;
+
+ /* Store the translation components */
+
+ temp[0][3] = a;
+ temp[1][3] = b;
+
+ /* Let temp1 hold the base vector and the up vector */
+
+ temp1[0][0] = vbase.x;
+ temp1[0][1] = vup.x;
+ temp1[0][2] = 0.0;
+ temp1[0][3] = 0.0;
+
+ temp1[1][0] = vbase.y;
+ temp1[1][1] = vup.y;
+ temp1[1][2] = 0.0;
+ temp1[1][3] = 0.0;
+
+ temp1[2][0] = temp1[3][0] = 0.0;
+ temp1[2][1] = temp1[3][1] = 0.0;
+ temp1[2][2] = temp1[3][3] = 1.0;
+ temp1[2][3] = 0.0;
+ temp1[3][2] = 0.0;
+
+ /* e3 is the cross-product of direction vectors u and v */
+
+ e3->x = u->y * v->z - u->z * v->y;
+ e3->y = u->z * v->x - u->x * v->z;
+ e3->z = u->x * v->y - u->y * v->x;
+
+ inv_mag = sqrt(e3->x * e3->x + e3->y * e3->y + e3->z * e3->z);
+
+ /* See if the direction is valid or if we can get by with a 2D
+ transform, i.e. if u and v are collinear. */
+
+ if ( MI_ZERO_MAG( inv_mag) ) {
+ miMatMult( xf, temp, temp1 );
+
+ } else { /* Build a 3D transform. */
+
+/* The rotation matrix, temp2, for orienting the text
+ coordinate space consists of the row vectors, e1, e2 and e3,
+ and the position. */
+
+/* Normalized vector e3 is row 3 of the rotation matrix */
+
+ inv_mag = 1.0 / inv_mag;
+ temp2[0][2] = e3->x*inv_mag;
+ temp2[1][2] = e3->y*inv_mag;
+ temp2[2][2] = e3->z*inv_mag;
+ temp2[3][2] = 0.0;
+
+/* e1 is the normalized u vector and is row 1 of the rotation
+ matrix. */
+
+ inv_mag = 1.0 / sqrt(u->x * u->x + u->y * u->y + u->z * u->z);
+ temp2[0][0] = e1->x = u->x * inv_mag;
+ temp2[1][0] = e1->y = u->y * inv_mag;
+ temp2[2][0] = e1->z = u->z * inv_mag;
+ temp2[3][0] = 0.0;
+
+/* e2 is the normalized v vector, (u X v) X u, and is row 2
+ of the rotation matrix. */
+
+ e2->x = e3->y * e1->z - e3->z * e1->y;
+ e2->y = e3->z * e1->x - e3->x * e1->z;
+ e2->z = e3->x * e1->y - e3->y * e1->x;
+ inv_mag = 1.0 / sqrt(e2->x * e2->x + e2->y * e2->y + e2->z * e2->z);
+ temp2[0][1] = (e2->x *= inv_mag);
+ temp2[1][1] = (e2->y *= inv_mag);
+ temp2[2][1] = (e2->z *= inv_mag);
+ temp2[3][1] = 0.0;
+
+ temp2[0][3] = pos->x;
+ temp2[1][3] = pos->y;
+ temp2[2][3] = pos->z;
+ temp2[3][3] = 1.0;
+
+/* The final transformation matrix, xf, is the product of the
+ 3 matrices: temp2 x temp1 x temp. */
+
+ miMatMult( temp3, temp1, temp2 );
+ miMatMult( xf, temp, temp3 );
+ }
+}
+
+
+/*++
+ |
+ | Function Name: miText3D
+ |
+ | Function Description:
+ | Handles the Text 3D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miText3D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+/* local */
+ miTextStruct *ddText = (miTextStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ ddCoord3D *pOrigin = ddText->pOrigin; /* string origin */
+ ddCoord3D *pDirections = ddText->pDirections;/* orientation */
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+
+/* Define required temporary variables */
+
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_cc_xform[4][4];
+ ddFLOAT tc_to_mc_xform[4][4];
+ ddFLOAT buf_xform[4][4];
+ miDDContext *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first;
+ int i, j, k;
+ int count; /* Count of characters to be rendered */
+ ddFLOAT ei0cc, ei1cc, ei3cc;
+ ddFLOAT ei0mc, ei1mc, ei3mc;
+ miCharPath *save_ptr;
+ miListHeader *mc_path, *mclip_path, *cc_path, *clip_path, *dc_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag, clip_mode;
+
+ /* Set the annotation text flag to zero */
+
+ aflag = 0;
+
+ /* Get the DDContext handle for local use */
+
+ pddc = (miDDContext *)pRend->pDDContext;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ return (Success);
+
+
+ /* Convert text string into required paths */
+
+ if ((status = tx_el_to_path (pRend, pddc, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text3_xform (pOrigin, pDirections, (pDirections+1),
+ pddc->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Render the paths in text_el as polylines */
+
+ /* Set up the new composite transform first */
+
+ miMatMult (buf_xform, text_el.xform,
+ pddc->Dynamic->mc_to_cc_xform);
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pddc->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ /* Check for modelling clip and set up the volume if required */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+ ComputeMCVolume(pRend, pddc); /* Get the current model clip volume */
+ }
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Render characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space char. */
+ /* If so just skip to next character in the ISTRING and continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the text */
+ /* path is Up or Down. If so, we need to modify tx by the first */
+ /* character translation to align with the rest of the characters*/
+ /* in the string. */
+
+ if ((pddc->Static.attrs->textPath == PEXPathUp ||
+ pddc->Static.attrs->textPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE FIRST */
+ /* CHARACTER IN THE STRING. ptx FOR ALL OTHER CHARACTERS WILL BE */
+ /* RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE REQUIRED */
+ /* EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS NOT A PROBLEM HERE*/
+ /* SINCE WE NEED THIS SPECIAL CASE ONLY FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE OF += */
+
+ /* Check to see if the text path is Left. If so, we need to modify */
+ /* tx by the first character width so as to start the string to the*/
+ /* left of the text origin. */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to get */
+ /* just the character width. */
+
+ ptx_first += (pddc->Static.attrs->charSpacing) * FONT_COORD_HEIGHT;
+ }
+
+ if (pddc->Static.attrs->textPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Check to see if modelling clip is required. If so, apply it */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Buffer the tc_to_mc_xform first */
+
+ memcpy( (char *)tc_to_mc_xform, (char *)text_el.xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0mc = tc_to_mc_xform[i][0];
+ ei1mc = tc_to_mc_xform[i][1];
+ ei3mc = tc_to_mc_xform[i][3];
+ /* Modify the transform */
+ tc_to_mc_xform[i][0] = exp * ei0mc;
+ tc_to_mc_xform[i][3] = tx * ei0mc + ty * ei1mc + ei3mc;
+ }
+ /* Transform the character strokes into Model space */
+
+ if (status = miTransform(pddc, text_el.paths->path, &mc_path,
+ tc_to_mc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ if (status = miClipPolyLines(pddc, mc_path, &mclip_path, MI_MCLIP))
+ return (status);
+
+ }
+ else {
+ mclip_path = text_el.paths->path;
+ }
+
+ /* Buffer the tc_to_cc_xform first */
+
+ memcpy( (char *)tc_to_cc_xform, (char *)buf_xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0cc = tc_to_cc_xform[i][0];
+ ei1cc = tc_to_cc_xform[i][1];
+ ei3cc = tc_to_cc_xform[i][3];
+ /* Modify the transform */
+ tc_to_cc_xform[i][0] = exp * ei0cc;
+ tc_to_cc_xform[i][3] = tx * ei0cc + ty * ei1cc + ei3cc;
+ }
+
+ /* Transform and clip the paths corresponding to current character */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Note that we are already in Model space here */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+ else {
+
+ /* Note that we are still in text local space here ! */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ tc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* if nothing left, then update pointers and continue */
+ if (clip_path->numLists <= 0) {
+ text_el.paths++;
+ continue;
+ }
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Text to screen */
+
+ pddc->Static.RenderProcs[TEXT_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+ }
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miText2D
+ |
+ | Function Description:
+ | Handles the Text 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miText2D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+/* local */
+ miText2DStruct *ddText = (miText2DStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddCoord2D *pOrigin = ddText->pOrigin; /* string origin */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+
+/* Define required temporary variables */
+
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_cc_xform[4][4];
+ ddFLOAT tc_to_mc_xform[4][4];
+ ddFLOAT buf_xform[4][4];
+ miDDContext *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first;
+ int i, j, k;
+ int count; /* Count of characters to be rendered */
+ ddFLOAT ei0cc, ei1cc, ei3cc;
+ ddFLOAT ei0mc, ei1mc, ei3mc;
+ miCharPath *save_ptr;
+ miListHeader *mc_path, *mclip_path, *cc_path, *clip_path, *dc_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag, clip_mode;
+
+ /* Set the annotation text flag to zero */
+
+ aflag = 0;
+
+ /* Get the DDContext handle for local use */
+
+ pddc = (miDDContext *)pRend->pDDContext;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ return (Success);
+
+
+ /* Convert text string into required paths */
+
+ if ((status = tx_el_to_path (pRend, pddc, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text2_xform (pOrigin, pddc->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Render the paths in text_el as polylines */
+
+ /* Set up the new composite transform first */
+
+ miMatMult (buf_xform, text_el.xform,
+ pddc->Dynamic->mc_to_cc_xform);
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pddc->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ /* Check for modelling clip and set up the volume if required */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+ ComputeMCVolume(pRend, pddc); /* Get the current model clip volume */
+ }
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Render characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space char. */
+ /* If so just skip to next character in the ISTRING and continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the text */
+ /* path is Up or Down. If so, we need to modify tx by the first */
+ /* character translation to align with the rest of the characters*/
+ /* in the string. */
+
+ if ((pddc->Static.attrs->textPath == PEXPathUp ||
+ pddc->Static.attrs->textPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE FIRST */
+ /* CHARACTER IN THE STRING. ptx FOR ALL OTHER CHARACTERS WILL BE */
+ /* RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE REQUIRED */
+ /* EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS NOT A PROBLEM HERE*/
+ /* SINCE WE NEED THIS SPECIAL CASE ONLY FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE OF += */
+
+ /* Check to see if the text path is Left. If so, we need to modify */
+ /* tx by the first character width so as to start the string to the*/
+ /* left of the text origin. */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to get */
+ /* just the character width. */
+
+ ptx_first += (pddc->Static.attrs->charSpacing) * FONT_COORD_HEIGHT;
+ }
+
+ if (pddc->Static.attrs->textPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Check to see if modelling clip is required. If so, apply it */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Buffer the tc_to_mc_xform first */
+
+ memcpy( (char *)tc_to_mc_xform, (char *)text_el.xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0mc = tc_to_mc_xform[i][0];
+ ei1mc = tc_to_mc_xform[i][1];
+ ei3mc = tc_to_mc_xform[i][3];
+ /* Modify the transform */
+ tc_to_mc_xform[i][0] = exp * ei0mc;
+ tc_to_mc_xform[i][3] = tx * ei0mc + ty * ei1mc + ei3mc;
+ }
+ /* Transform the character strokes into Model space */
+
+ if (status = miTransform(pddc, text_el.paths->path, &mc_path,
+ tc_to_mc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ if (status = miClipPolyLines(pddc, mc_path, &mclip_path, MI_MCLIP))
+ return (status);
+ }
+ else {
+ mclip_path = text_el.paths->path;
+ }
+
+ /* Buffer the tc_to_cc_xform first */
+
+ memcpy( (char *)tc_to_cc_xform, (char *)buf_xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0cc = tc_to_cc_xform[i][0];
+ ei1cc = tc_to_cc_xform[i][1];
+ ei3cc = tc_to_cc_xform[i][3];
+ /* Modify the transform */
+ tc_to_cc_xform[i][0] = exp * ei0cc;
+ tc_to_cc_xform[i][3] = tx * ei0cc + ty * ei1cc + ei3cc;
+ }
+
+ /* Transform and clip the paths corresponding to current character */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Note that we are already in Model space here */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ }
+ else {
+
+ /* Note that we are still in text local space here ! */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ tc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* if nothing left, then update pointers and continue */
+ if (clip_path->numLists <= 0) {
+ text_el.paths++;
+ continue;
+ }
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Text to screen */
+
+ pddc->Static.RenderProcs[TEXT_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+ }
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: miAnnoText3D
+ |
+ | Function Description:
+ | Handles the Annotation text 3D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miAnnoText3D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ /* local */
+ miAnnoTextStruct *ddText = (miAnnoTextStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ ddCoord3D *pOrigin = ddText->pOrigin; /* string origin */
+ ddCoord3D *pOffset = ddText->pOffset;
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+
+/* Define required temporary variables */
+
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_cc_xform[4][4];
+ ddFLOAT tc_to_mc_xform[4][4];
+ ddFLOAT buf_xform[4][4];
+ ddFLOAT buf1_xform[4][4];
+ miDDContext *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first, pty_first;
+ int i, j, k;
+ int count; /* Count of characters to be rendered */
+ ddFLOAT ei0cc, ei1cc, ei3cc;
+ ddFLOAT ei0mc, ei1mc, ei3mc;
+ miCharPath *save_ptr;
+ miListHeader *mc_path, *mclip_path, *cc_path, *clip_path, *dc_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag;
+ static ddVector3D Directions[2] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0};
+ ddCoord3D *pDirections = (ddCoord3D *)Directions;
+ miListHeader Connector;
+ ddCoord4D CC_Offset; /* Offset in Clipping Coordinates */
+ ddCoord4D MC_Origin, CC_Origin, NPC_Origin;
+ ddUSHORT oc; /* Outcode for 4D point clipping */
+ ddUSHORT clip_mode; /* distinguish model from view " */
+
+ /* Get the DDContext handle for local use */
+
+ pddc = (miDDContext *)pRend->pDDContext;
+
+ /* Transform and clip the text origin first to see if any rendering*/
+ /* needs to be done at all. If the NPC sub-volume does not contain */
+ /* the origin, the annotation text is not rendered. */
+
+ MC_Origin.x = pOrigin->x;
+ MC_Origin.y = pOrigin->y;
+ MC_Origin.z = pOrigin->z;
+ MC_Origin.w = 1.0;
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ clip_mode = MI_MCLIP;
+ CLIP_POINT4D(&MC_Origin, oc, clip_mode);
+
+ if (oc) return (Success); /* origin model clipped out */
+ }
+
+ miTransformPoint (&MC_Origin, pddc->Dynamic->mc_to_cc_xform,
+ &CC_Origin);
+
+ clip_mode = MI_VCLIP;
+ CLIP_POINT4D(&CC_Origin, oc, clip_mode);
+ if (oc) {
+ return (Success); /* origin view clipped out */
+ }
+
+ /* Compute the NPC_Origin for later use */
+
+ miMatMult (buf_xform, pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_npc_xform);
+ miTransformPoint (&MC_Origin, buf_xform, &NPC_Origin);
+
+ /* Set the annotation text flag to one */
+
+ aflag = 1;
+
+ /* Transform the NPC Offset to CC. Note that we are transforming a */
+ /* vector. i.e., only scaling components of the viewport transform */
+ /* need be applied. This is simply done by multiplication of the x */
+ /* and y components by the respective scale factors. */
+
+ CC_Offset.x = pOffset->x * pddc->Dynamic->npc_to_cc_xform[0][0];
+ CC_Offset.y = pOffset->y * pddc->Dynamic->npc_to_cc_xform[1][1];
+ CC_Offset.z = pOffset->z * pddc->Dynamic->npc_to_cc_xform[2][2];
+ CC_Offset.w = 0.0;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ return (Success);
+
+
+ /* Convert text string into required paths */
+
+ if ((status = atx_el_to_path (pRend, pddc, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text3_xform (pOrigin, pDirections, (pDirections+1),
+ pddc->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Set up the new composite transform first. Note that in the case */
+ /* of annotation text, only the text origin is transformed by the */
+ /* complete pipeline transform. The text itself is affected only by*/
+ /* the transformed origin in NPC, the NPC offset , npc_to_cc, and */
+ /* the workstation transform. */
+
+ /* Now compute the initial composite transform for the first char. */
+ /* The required transforms for characters are - text space to model */
+ /* space transform, transformation of the annotation text origin, if*/
+ /* any, and the npc to cc transform. */
+
+ /* Get the translation due to the transformation of the annotation */
+ /* text origin by mc_to_npc_xform into buf1_xform. */
+
+ memcpy( (char *)buf1_xform, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ buf1_xform[0][3] += NPC_Origin.x - MC_Origin.x;
+ buf1_xform[1][3] += NPC_Origin.y - MC_Origin.y;
+ buf1_xform[2][3] += NPC_Origin.z - MC_Origin.z;
+
+ miMatMult (buf_xform, text_el.xform, buf1_xform);
+ miMatMult (buf_xform, buf_xform, pddc->Dynamic->npc_to_cc_xform);
+
+ /* Add the offset in CC */
+
+ buf_xform[0][3] += CC_Offset.x;
+ buf_xform[1][3] += CC_Offset.y;
+ buf_xform[2][3] += CC_Offset.z;
+
+ /******** Render the text string first, and then the connector ********/
+
+ /* Render the paths in text_el as polylines */
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pddc->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Render characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space char. */
+ /* If so just skip to next character in the ISTRING and continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the text */
+ /* path is Up or Down. If so, we need to modify tx by the first */
+ /* character translation to align with the rest of the characters*/
+ /* in the string. */
+
+ if ((pddc->Static.attrs->atextPath == PEXPathUp ||
+ pddc->Static.attrs->atextPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE FIRST */
+ /* CHARACTER IN THE STRING. ptx FOR ALL OTHER CHARACTERS WILL BE */
+ /* RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE REQUIRED */
+ /* EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS NOT A PROBLEM HERE*/
+ /* SINCE WE NEED THIS SPECIAL CASE ONLY FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE OF += */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to get */
+ /* just the character width. */
+
+ ptx_first += (pddc->Static.attrs->charSpacing) * FONT_COORD_HEIGHT;
+
+ pty_first = pty; /* Save first character height */
+ }
+
+ /* Check to see if the text path is Left. If so, we need to modify */
+ /* tx by the first character width so as to start the string to the*/
+ /* left of the text origin. */
+
+ if (pddc->Static.attrs->atextPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Check to see if modelling clip is required. If so, apply it */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Buffer the tc_to_mc_xform first */
+
+ memcpy( (char *)tc_to_mc_xform, (char *)text_el.xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0mc = tc_to_mc_xform[i][0];
+ ei1mc = tc_to_mc_xform[i][1];
+ ei3mc = tc_to_mc_xform[i][3];
+ /* Modify the transform */
+ tc_to_mc_xform[i][0] = exp * ei0mc;
+ tc_to_mc_xform[i][3] = tx * ei0mc + ty * ei1mc + ei3mc;
+ }
+ /* Transform the character strokes into Model space */
+
+ if (status = miTransform(pddc, text_el.paths->path, &mc_path,
+ tc_to_mc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ if (status = miClipPolyLines(pddc, mc_path, &mclip_path, MI_MCLIP))
+ return (status);
+ }
+ else {
+ mclip_path = text_el.paths->path;
+ }
+
+ /* Buffer the tc_to_cc_xform first */
+ memcpy( (char *)tc_to_cc_xform, (char *)buf_xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0cc = tc_to_cc_xform[i][0];
+ ei1cc = tc_to_cc_xform[i][1];
+ ei3cc = tc_to_cc_xform[i][3];
+ /* Modify the transform */
+ tc_to_cc_xform[i][0] = exp * ei0cc;
+ tc_to_cc_xform[i][3] = tx * ei0cc + ty * ei1cc + ei3cc;
+ }
+
+ /* Transform and clip the paths corresponding to current character */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Note that we are already in Model space here */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+ else {
+
+ /* Note that we are still in text local space here ! */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ tc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+
+ /* Clip */
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* if nothing left, then update pointers and continue */
+ if (clip_path->numLists <= 0) {
+ text_el.paths++;
+ continue;
+ }
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Text to screen */
+
+ pddc->Static.RenderProcs[TEXT_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+ }
+
+ /* Check the annotation style and draw a connecting line to the text */
+
+ if (pddc->Static.attrs->atextStyle == 2) {
+
+ /* Use the offset and text origin to build a polyline */
+
+ Connector.type = DD_3D_POINT;
+ Connector.numLists = 1;
+ if (!(Connector.ddList = (listofddPoint *)
+ xalloc(sizeof(listofddPoint))))
+ return (BadAlloc);
+ Connector.ddList->numPoints = 2;
+ if (!((Connector.ddList->pts.p3Dpt) = (ddCoord3D *)
+ xalloc(sizeof(ddCoord3D) * 2)))
+ return (BadAlloc);
+
+ Connector.ddList->pts.p3Dpt->x = pOrigin->x;
+ Connector.ddList->pts.p3Dpt->y = pOrigin->y;
+ Connector.ddList->pts.p3Dpt->z = pOrigin->z;
+ Connector.ddList->pts.p3Dpt++;
+ Connector.ddList->pts.p3Dpt->x = pOrigin->x;
+ Connector.ddList->pts.p3Dpt->y = pOrigin->y;
+ Connector.ddList->pts.p3Dpt->z = pOrigin->z;
+ Connector.ddList->pts.p3Dpt--; /* Reset pointer to head of the list */
+
+ /* Render the connector as a polyline */
+
+ /* Transform and clip the connector polyline */
+
+ if (status = miTransform(pddc, &Connector, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Modify the second point by the amount of transformed offset. */
+
+ cc_path->ddList->pts.p4Dpt++;
+ cc_path->ddList->pts.p4Dpt->x += CC_Offset.x;
+ cc_path->ddList->pts.p4Dpt->y += CC_Offset.y;
+ cc_path->ddList->pts.p4Dpt->z += CC_Offset.z;
+ cc_path->ddList->pts.p4Dpt--; /* Reset pointer to head of the list */
+
+ /* Clip */
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Connector to screen */
+
+ pddc->Static.RenderProcs[POLYLINE_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+
+ } /* if atextStyle == 2 */
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: miAnnoText2D
+ |
+ | Function Description:
+ | Handles the Annotation text 2D ocs.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miAnnoText2D(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+/* out */
+{
+ /* local */
+ miAnnoText2DStruct *ddText = (miAnnoText2DStruct *)(pExecuteOC+1);
+ miTextElement text_el; /* text element */
+ ddUSHORT numEncodings = ddText->numEncodings;
+ ddCoord2D *pOrigin = ddText->pOrigin; /* string origin */
+ ddCoord2D *pOffset = ddText->pOffset;
+ pexMonoEncoding *pText = ddText->pText; /* text string */
+
+/* calls */
+ extern ddpex3rtn miTransform();
+ extern ddpex3rtn miClipPolyLines();
+
+/* Define required temporary variables */
+
+ ddULONG numChars; /* Needed for xalloc */
+ pexMonoEncoding *pMono;
+ ddCoord2D align; /* alignment info */
+ ddFLOAT tc_to_cc_xform[4][4];
+ ddFLOAT tc_to_mc_xform[4][4];
+ ddFLOAT buf_xform[4][4];
+ ddFLOAT buf1_xform[4][4];
+ miDDContext *pddc;
+ ddFLOAT exp, tx, ty;
+ ddFLOAT ptx, pty, ptx_first, pty_first;
+ int i, j, k;
+ int count; /* Count of characters to be rendered */
+ ddFLOAT ei0cc, ei1cc, ei3cc;
+ ddFLOAT ei0mc, ei1mc, ei3mc;
+ miCharPath *save_ptr;
+ miListHeader *mc_path, *mclip_path, *cc_path, *clip_path, *dc_path;
+ listofddPoint *sp;
+ XID temp;
+ int status;
+ ddUSHORT aflag;
+ miListHeader Connector;
+ ddCoord4D CC_Offset; /* Offset in Clipping Coordinates */
+ ddCoord4D MC_Origin, CC_Origin, NPC_Origin;
+ ddUSHORT oc; /* Outcode for 4D point clipping */
+ ddUSHORT clip_mode;
+
+ /* Get the DDContext handle for local use */
+
+ pddc = (miDDContext *)pRend->pDDContext;
+
+ /* Transform and clip the text origin first to see if any rendering*/
+ /* needs to be done at all. If the NPC sub-volume does not contain */
+ /* the origin, the annotation text is not rendered. */
+
+ MC_Origin.x = pOrigin->x;
+ MC_Origin.y = pOrigin->y;
+ MC_Origin.z = 0.0;
+ MC_Origin.w = 1.0;
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ ComputeMCVolume(pRend, pddc); /* Compute modelling coord version
+ of clipping volume */
+ clip_mode = MI_MCLIP;
+ CLIP_POINT4D(&MC_Origin, oc, clip_mode);
+
+ if (oc) return (Success); /* origin model clipped out */
+ }
+
+ miTransformPoint (&MC_Origin, pddc->Dynamic->mc_to_cc_xform,
+ &CC_Origin);
+
+ clip_mode = MI_VCLIP;
+ CLIP_POINT4D(&CC_Origin, oc, clip_mode);
+ if (oc) {
+ return (Success); /* Don't render anything; origin clipped out */
+ }
+
+ /* Compute the NPC_Origin for later use */
+
+ miMatMult (buf_xform, pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->wc_to_npc_xform);
+ miTransformPoint (&MC_Origin, buf_xform, &NPC_Origin);
+
+ /* Set the annotation text flag to one */
+
+ aflag = 1;
+
+ /* Transform the NPC Offset to CC. Note that we are transforming a */
+ /* vector. i.e., only scaling components of the viewport transform */
+ /* need be applied. This is simply done by multiplication of the x */
+ /* and y components by the respective scale factors. */
+
+ CC_Offset.x = pOffset->x * pddc->Dynamic->npc_to_cc_xform[0][0];
+ CC_Offset.y = pOffset->y * pddc->Dynamic->npc_to_cc_xform[1][1];
+ CC_Offset.z = 0.0;
+ CC_Offset.w = 0.0;
+
+ /* Determine the total number of characters in the ISTRING */
+
+ numChars = 0;
+ pMono = pText;
+ for (i=0; i<numEncodings; i++) {
+ int bytes = pMono->numChars * ((pMono->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pMono->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+ numChars += (ddULONG)pMono->numChars;
+ pMono = (pexMonoEncoding *) ((char *) (pMono + 1) +
+ bytes + PADDING (bytes));
+ }
+
+ if (numChars == 0)
+ return (Success);
+
+
+ /* Convert text string into required paths */
+
+ if ((status = atx_el_to_path (pRend, pddc, numEncodings, pText,
+ numChars, &text_el, &align, &count)) != Success) {
+ return (status);
+ }
+
+ /* Compute the required Character Space to Modelling Space Transform */
+
+ text2_xform (pOrigin, pddc->Static.attrs, &align, text_el.xform, aflag);
+
+ /* Set up the new composite transform first. Note that in the case */
+ /* of annotation text, only the text origin is transformed by the */
+ /* complete pipeline transform. The text itself is affected only by*/
+ /* the transformed origin in NPC, the NPC offset , npc_to_cc, and */
+ /* the workstation transform. */
+
+ /* Now compute the initial composite transform for the first char. */
+ /* The required transforms for characters are - text space to model */
+ /* space transform, transformation of the annotation text origin, if*/
+ /* any, and the npc to cc transform. */
+
+ /* Get the translation due to the transformation of the annotation */
+ /* text origin by mc_to_npc_xform into buf1_xform. */
+
+ memcpy( (char *)buf1_xform, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ buf1_xform[0][3] += NPC_Origin.x - MC_Origin.x;
+ buf1_xform[1][3] += NPC_Origin.y - MC_Origin.y;
+
+ miMatMult (buf_xform, text_el.xform, buf1_xform);
+ miMatMult (buf_xform, buf_xform, pddc->Dynamic->npc_to_cc_xform);
+
+ /* Add the offset in CC */
+
+ buf_xform[0][3] += CC_Offset.x;
+ buf_xform[1][3] += CC_Offset.y;
+
+ /******** Render the text string first, and then the connector ********/
+
+ /* Render the paths in text_el as polylines */
+
+ /* Get the current character expansion factor */
+
+ exp = ABS((ddFLOAT)pddc->Static.attrs->charExpansion);
+
+ /* Save the pointer to the beginning of the character data */
+
+ save_ptr = text_el.paths;
+
+ /* Do for all characters (paths) in the text_el */
+
+ /* Initialize the previous translation components */
+
+ ptx = pty = 0.0;
+
+ for (k=0; k<count; k++) { /* Render characters one by one */
+
+ /* Check if the character is not renderable, for e.g., space char. */
+ /* If so just skip to next character in the ISTRING and continue. */
+
+ if (!(text_el.paths->path->ddList)) {
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+ text_el.paths++;
+ continue;
+ }
+
+ /* Modify the composite transform by the previous translation */
+ /* and the current scaling in x realizing the char expansion */
+
+ tx = ptx;
+ ty = pty;
+
+ ptx = (ddFLOAT)(((text_el.paths)->trans).x);
+ pty = (ddFLOAT)(((text_el.paths)->trans).y);
+
+ /* Check to see if this is the very first character and the text */
+ /* path is Up or Down. If so, we need to modify tx by the first */
+ /* character translation to align with the rest of the characters*/
+ /* in the string. */
+
+ if ((pddc->Static.attrs->atextPath == PEXPathUp ||
+ pddc->Static.attrs->atextPath == PEXPathDown) && k == 0)
+ tx += ptx;
+
+ /* NOTE THAT THE ABOVE COMPUTATION WILL ONLY WORK FOR THE FIRST */
+ /* CHARACTER IN THE STRING. ptx FOR ALL OTHER CHARACTERS WILL BE */
+ /* RELATIVE TO THE TEXT ORIGIN AND SO WILL NOT GIVE THE REQUIRED */
+ /* EFFECTIVE CHARACTER WIDTH. HOWEVER, THIS IS NOT A PROBLEM HERE*/
+ /* SINCE WE NEED THIS SPECIAL CASE ONLY FOR THE FIRST CHARACTER. */
+ /* */
+ /* FURTHER, NOTE THAT ptx WILL BE NEGATIVE AND HENCE USE OF += */
+
+ if (k == 0) {
+ ptx_first = ptx; /* Get the first character translation */
+
+ /* Adjust the translation by character spacing factor to get */
+ /* just the character width. */
+
+ ptx_first += (pddc->Static.attrs->charSpacing) * FONT_COORD_HEIGHT;
+
+ pty_first = pty; /* Save first character height */
+
+ /* Adjust the translation by character spacing factor to get */
+ /* just the character height. */
+
+ pty_first += (pddc->Static.attrs->charSpacing) * FONT_COORD_HEIGHT;
+ }
+
+ /* Check to see if the text path is Left. If so, we need to modify */
+ /* tx by the first character width so as to start the string to the*/
+ /* left of the text origin. */
+
+ if (pddc->Static.attrs->atextPath == PEXPathLeft)
+ tx += ptx_first;
+
+ /* Check to see if modelling clip is required. If so, apply it */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Buffer the tc_to_mc_xform first */
+
+ memcpy( (char *)tc_to_mc_xform, (char *)text_el.xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0mc = tc_to_mc_xform[i][0];
+ ei1mc = tc_to_mc_xform[i][1];
+ ei3mc = tc_to_mc_xform[i][3];
+ /* Modify the transform */
+ tc_to_mc_xform[i][0] = exp * ei0mc;
+ tc_to_mc_xform[i][3] = tx * ei0mc + ty * ei1mc + ei3mc;
+ }
+ /* Transform the character strokes into Model space */
+
+ if (status = miTransform(pddc, text_el.paths->path, &mc_path,
+ tc_to_mc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ if (status = miClipPolyLines(pddc, mc_path, &mclip_path, MI_MCLIP))
+ return (status);
+ }
+ else {
+ mclip_path = text_el.paths->path;
+ }
+
+ /* Buffer the tc_to_cc_xform first */
+
+ memcpy( (char *)tc_to_cc_xform, (char *)buf_xform, 16*sizeof(ddFLOAT));
+
+ /* Apply the per character translation and scaling by directly */
+ /* modifying the concerned matrix elements. */
+
+ for (i=0; i<4; ++i) {
+ /* Buffer the element values */
+ ei0cc = tc_to_cc_xform[i][0];
+ ei1cc = tc_to_cc_xform[i][1];
+ ei3cc = tc_to_cc_xform[i][3];
+ /* Modify the transform */
+ tc_to_cc_xform[i][0] = exp * ei0cc;
+ tc_to_cc_xform[i][3] = tx * ei0cc + ty * ei1cc + ei3cc;
+ }
+
+ /* Transform and clip the paths corresponding to current character */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Note that we are already in Model space here */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ }
+ else {
+
+ /* Note that we are still in text local space here ! */
+
+ if (status = miTransform(pddc, mclip_path, &cc_path,
+ tc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+ }
+
+ /* Clip */
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* if nothing left, then update pointers and continue */
+ if (clip_path->numLists <= 0) {
+ text_el.paths++;
+ continue;
+ }
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Text to screen */
+
+ pddc->Static.RenderProcs[TEXT_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+
+ /* Update the pointer to next character */
+
+ text_el.paths++;
+ }
+
+ /* Check the annotation style and draw a connecting line to the text */
+
+ if (pddc->Static.attrs->atextStyle == 2) {
+
+ /* Use the offset and the text origin to build a polyline */
+
+ Connector.type = DD_2D_POINT;
+ Connector.numLists = 1;
+ if (!(Connector.ddList = (listofddPoint *) xalloc(sizeof(listofddPoint))))
+ return (BadAlloc);
+ Connector.ddList->numPoints = 2;
+ if (!((Connector.ddList->pts.p2Dpt) = (ddCoord2D *)
+ xalloc(sizeof(ddCoord2D) * 2)))
+ return (BadAlloc);
+ Connector.ddList->pts.p2Dpt->x = pOrigin->x;
+ Connector.ddList->pts.p2Dpt->y = pOrigin->y;
+ Connector.ddList->pts.p2Dpt++;
+ Connector.ddList->pts.p2Dpt->x = pOrigin->x;
+ Connector.ddList->pts.p2Dpt->y = pOrigin->y;
+ Connector.ddList->pts.p2Dpt--; /* Reset pointer to head of the list */
+
+ /* Render the connector as a polyline */
+
+ /* Transform and clip the connector polyline */
+
+ if (status = miTransform(pddc, &Connector, &cc_path,
+ pddc->Dynamic->mc_to_cc_xform,
+ NULL4x4,
+ DD_HOMOGENOUS_POINT))
+ return (status);
+
+ /* Modify the second point by the amount of transformed offset. */
+
+ cc_path->ddList->pts.p4Dpt++;
+ cc_path->ddList->pts.p4Dpt->x += CC_Offset.x;
+ cc_path->ddList->pts.p4Dpt->y += CC_Offset.y;
+ cc_path->ddList->pts.p4Dpt--; /* Reset pointer to head of the list */
+
+ /* Clip */
+
+ clip_mode = MI_VCLIP;
+ if (status = miClipPolyLines(pddc, cc_path, &clip_path, clip_mode))
+ return (status);
+
+ /* Transform to DC coordinates */
+
+ if (status = miTransform(pddc, clip_path, &dc_path,
+ pddc->Dynamic->cc_to_dc_xform,
+ NULL4x4,
+ DD_2DS_POINT))
+ return (status);
+
+ /* Render Connector to screen */
+
+ pddc->Static.RenderProcs[POLYLINE_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_path);
+ } /* if atextStyle == 2 */
+
+ /* Free up space allocated for text stroke data */
+
+ xfree ((char *)save_ptr);
+
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTrans.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTrans.c
new file mode 100644
index 000000000..8c5f041e7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTrans.c
@@ -0,0 +1,1024 @@
+/* $TOG: miTrans.c /main/4 1998/02/10 12:42:53 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miTrans.c,v 1.7 1998/10/04 09:34:29 dawes Exp $ */
+
+#include "mipex.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "PEXErr.h"
+#include "miRender.h"
+#include "miLight.h"
+#include "pexos.h"
+
+#define IRINT(x) ( ((x) >= 0.0) ? ((int)((x) + 0.5)) : ((int)((x) - 0.5)) )
+
+/*++
+ |
+ | miTransform(pddc, vinput, voutput,
+ | vert_mat, norm_mat, outtype)
+ |
+ | Generalized vertex list transform routine.
+ |
+ | This routine takes in four parameters: a list of vertices,
+ | an output point type, and two matrices: one for transforming
+ | vertex data, the second for transforming normal data.
+ | The following assumptions are made:
+ | a) 2DS input is never used
+ | b) 2D input does not support normal, color or edge info
+ | c) output types do not have more attributes (color, normal or edge)
+ | than input data types
+ | d) only color specifiers with triplets of float values are
+ | supported
+ |
+ | All other cases produce undefined output
+ |
+ --*/
+
+ddpex3rtn
+miTransform(pddc, vinput, voutput, vert_mat, norm_mat, outtype)
+ miDDContext *pddc;
+ miListHeader *vinput;
+ miListHeader **voutput;
+ ddFLOAT vert_mat[4][4];
+ ddFLOAT norm_mat[4][4];
+ ddPointType outtype;
+{
+ ddCoord4D new_pt;
+ miListHeader *output;
+
+
+ register int i, j;
+ register listofddPoint *pddilist;
+ register listofddPoint *pddolist;
+
+ ddPointUnion in_pt,
+ out_pt;
+
+ ddCoord2D tmp_pt;
+
+ ddFLOAT length;
+
+ int output_size;
+
+ /* remember that ALL vertex types are of the form:
+ *
+ * |---------------------------|---------|----------|---------|
+ * coords color normal edge
+ * (opt) (opt) (opt)
+ */
+
+ /* Don't pass on normals unless valid xform */
+ if (norm_mat == NULL) DD_UnSetVertNormal(outtype);
+
+ DD_VertPointSize(outtype, output_size);
+
+
+ switch (outtype) {
+
+ case DD_RGBFLOAT_POINT4D:
+ case DD_HSV_POINT4D:
+ case DD_HLS_POINT4D:
+ case DD_CIE_POINT4D:
+ case DD_NORM_POINT4D:
+ case DD_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_POINT4D:
+ case DD_HSV_NORM_POINT4D:
+ case DD_HLS_NORM_POINT4D:
+ case DD_CIE_NORM_POINT4D:
+ case DD_RGBFLOAT_EDGE_POINT4D:
+ case DD_HSV_EDGE_POINT4D:
+ case DD_HLS_EDGE_POINT4D:
+ case DD_CIE_EDGE_POINT4D:
+ case DD_NORM_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_EDGE_POINT4D:
+ case DD_HSV_NORM_EDGE_POINT4D:
+ case DD_HLS_NORM_EDGE_POINT4D:
+ case DD_CIE_NORM_EDGE_POINT4D:
+ case DD_HOMOGENOUS_POINT:
+ {
+ switch (vinput->type) {
+ case DD_2D_POINT:
+ {
+
+ /* Use the pre-defined 4D list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(i+1),output_size);
+ if(!(out_pt.p4Dpt = (pddolist->pts.p4Dpt)))
+ return(BadAlloc);
+
+ in_pt.p2Dpt = pddilist->pts.p2Dpt;
+
+ /* Note - just assume z = 0.0, w = 1.0 */
+ while (i--) {
+
+ out_pt.p4Dpt->x = vert_mat[0][0]*in_pt.p2Dpt->x;
+ out_pt.p4Dpt->x += vert_mat[0][1]*in_pt.p2Dpt->y;
+ out_pt.p4Dpt->x += vert_mat[0][3];
+
+ out_pt.p4Dpt->y = vert_mat[1][0]*in_pt.p2Dpt->x;
+ out_pt.p4Dpt->y += vert_mat[1][1]*in_pt.p2Dpt->y;
+ out_pt.p4Dpt->y += vert_mat[1][3];
+
+ out_pt.p4Dpt->z = vert_mat[2][0]*in_pt.p2Dpt->x;
+ out_pt.p4Dpt->z += vert_mat[2][1]*in_pt.p2Dpt->y;
+ out_pt.p4Dpt->z += vert_mat[2][3];
+
+ out_pt.p4Dpt->w = vert_mat[3][0]*in_pt.p2Dpt->x;
+ out_pt.p4Dpt->w += vert_mat[3][1]*in_pt.p2Dpt->y;
+ out_pt.p4Dpt->w += vert_mat[3][3];
+
+ in_pt.p2Dpt++;
+ out_pt.p4Dpt++;
+
+ /* At this point we should be pointing to
+ * to the beginning of the next vertex
+ */
+
+ }
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+ case DD_RGBFLOAT_POINT:
+ case DD_HSV_POINT:
+ case DD_HLS_POINT:
+ case DD_CIE_POINT:
+ case DD_NORM_POINT:
+ case DD_EDGE_POINT:
+ case DD_RGBFLOAT_NORM_POINT:
+ case DD_HSV_NORM_POINT:
+ case DD_HLS_NORM_POINT:
+ case DD_CIE_NORM_POINT:
+ case DD_RGBFLOAT_EDGE_POINT:
+ case DD_HSV_EDGE_POINT:
+ case DD_HLS_EDGE_POINT:
+ case DD_CIE_EDGE_POINT:
+ case DD_NORM_EDGE_POINT:
+ case DD_RGBFLOAT_NORM_EDGE_POINT:
+ case DD_HSV_NORM_EDGE_POINT:
+ case DD_HLS_NORM_EDGE_POINT:
+ case DD_CIE_NORM_EDGE_POINT:
+ case DD_3D_POINT:
+ {
+
+ /* Use the pre-defined 4D list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(i+1),output_size);
+ if(!(out_pt.p4Dpt = (pddolist->pts.p4Dpt)))
+ return(BadAlloc);
+
+ in_pt.p3Dpt = pddilist->pts.p3Dpt;
+
+ /* Note - just assume w = 1.0 */
+ while (i--) {
+
+ /* cast operands & transform the coordinates
+ portions */
+
+
+ out_pt.p4Dpt->x = vert_mat[0][0]*in_pt.p3Dpt->x;
+ out_pt.p4Dpt->x += vert_mat[0][1]*in_pt.p3Dpt->y;
+ out_pt.p4Dpt->x += vert_mat[0][2]*in_pt.p3Dpt->z;
+ out_pt.p4Dpt->x += vert_mat[0][3];
+
+ out_pt.p4Dpt->y = vert_mat[1][0]*in_pt.p3Dpt->x;
+ out_pt.p4Dpt->y += vert_mat[1][1]*in_pt.p3Dpt->y;
+ out_pt.p4Dpt->y += vert_mat[1][2]*in_pt.p3Dpt->z;
+ out_pt.p4Dpt->y += vert_mat[1][3];
+
+ out_pt.p4Dpt->z = vert_mat[2][0]*in_pt.p3Dpt->x;
+ out_pt.p4Dpt->z += vert_mat[2][1]*in_pt.p3Dpt->y;
+ out_pt.p4Dpt->z += vert_mat[2][2]*in_pt.p3Dpt->z;
+ out_pt.p4Dpt->z += vert_mat[2][3];
+
+ out_pt.p4Dpt->w = vert_mat[3][0]*in_pt.p3Dpt->x;
+ out_pt.p4Dpt->w += vert_mat[3][1]*in_pt.p3Dpt->y;
+ out_pt.p4Dpt->w += vert_mat[3][2]*in_pt.p3Dpt->z;
+ out_pt.p4Dpt->w += vert_mat[3][3];
+
+ in_pt.p3Dpt++;
+ out_pt.p4Dpt++;
+
+ if (!DD_IsVertCoordsOnly(outtype)) {
+
+ if DD_IsVertColour(outtype) {
+ *out_pt.pRgbFloatClr =
+ *in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ out_pt.pRgbFloatClr++;
+ }
+
+
+ if DD_IsVertNormal(outtype) {
+
+
+ out_pt.pNormal->x = norm_mat[0][0]*in_pt.pNormal->x;
+ out_pt.pNormal->x += norm_mat[0][1]*in_pt.pNormal->y;
+ out_pt.pNormal->x += norm_mat[0][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->y = norm_mat[1][0]*in_pt.pNormal->x;
+ out_pt.pNormal->y += norm_mat[1][1]*in_pt.pNormal->y;
+ out_pt.pNormal->y += norm_mat[1][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->z = norm_mat[2][0]*in_pt.pNormal->x;
+ out_pt.pNormal->z += norm_mat[2][1]*in_pt.pNormal->y;
+ out_pt.pNormal->z += norm_mat[2][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ NORMALIZE_VECTOR (out_pt.pNormal, length);
+
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ if (DD_IsVertEdge(outtype)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+ }
+
+ /* At this point we should be pointing to
+ * to the beginning of the next vertex
+ */
+ }
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+ case DD_RGBFLOAT_POINT4D:
+ case DD_HSV_POINT4D:
+ case DD_HLS_POINT4D:
+ case DD_CIE_POINT4D:
+ case DD_NORM_POINT4D:
+ case DD_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_POINT4D:
+ case DD_HSV_NORM_POINT4D:
+ case DD_HLS_NORM_POINT4D:
+ case DD_CIE_NORM_POINT4D:
+ case DD_RGBFLOAT_EDGE_POINT4D:
+ case DD_HSV_EDGE_POINT4D:
+ case DD_HLS_EDGE_POINT4D:
+ case DD_CIE_EDGE_POINT4D:
+ case DD_NORM_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_EDGE_POINT4D:
+ case DD_HSV_NORM_EDGE_POINT4D:
+ case DD_HLS_NORM_EDGE_POINT4D:
+ case DD_CIE_NORM_EDGE_POINT4D:
+ case DD_HOMOGENOUS_POINT:
+ {
+
+ /* Use the pre-defined 4D list for output */
+ *voutput = output = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(i+1),output_size);
+ if(!(out_pt.p4Dpt = (pddolist->pts.p4Dpt)))
+ return(BadAlloc);
+
+ in_pt.p4Dpt = pddilist->pts.p4Dpt;
+
+ /* Note - just assume w = 1.0 */
+ while (i--) {
+
+ /* cast operands & transform the coordinates */
+
+ out_pt.p4Dpt->x = vert_mat[0][0]*in_pt.p4Dpt->x;
+ out_pt.p4Dpt->x += vert_mat[0][1]*in_pt.p4Dpt->y;
+ out_pt.p4Dpt->x += vert_mat[0][2]*in_pt.p4Dpt->z;
+ out_pt.p4Dpt->x += vert_mat[0][3]*in_pt.p4Dpt->w;
+
+ out_pt.p4Dpt->y = vert_mat[1][0]*in_pt.p4Dpt->x;
+ out_pt.p4Dpt->y += vert_mat[1][1]*in_pt.p4Dpt->y;
+ out_pt.p4Dpt->y += vert_mat[1][2]*in_pt.p4Dpt->z;
+ out_pt.p4Dpt->y += vert_mat[1][3]*in_pt.p4Dpt->w;
+
+ out_pt.p4Dpt->z = vert_mat[2][0]*in_pt.p4Dpt->x;
+ out_pt.p4Dpt->z += vert_mat[2][1]*in_pt.p4Dpt->y;
+ out_pt.p4Dpt->z += vert_mat[2][2]*in_pt.p4Dpt->z;
+ out_pt.p4Dpt->z += vert_mat[2][3]*in_pt.p4Dpt->w;
+
+ out_pt.p4Dpt->w = vert_mat[3][0]*in_pt.p4Dpt->x;
+ out_pt.p4Dpt->w += vert_mat[3][1]*in_pt.p4Dpt->y;
+ out_pt.p4Dpt->w += vert_mat[3][2]*in_pt.p4Dpt->z;
+ out_pt.p4Dpt->w += vert_mat[3][3]*in_pt.p4Dpt->w;
+
+ in_pt.p4Dpt++;
+ out_pt.p4Dpt++;
+
+ if (!DD_IsVertCoordsOnly(outtype)) {
+
+ if DD_IsVertColour(outtype) {
+ *out_pt.pRgbFloatClr =
+ *in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ out_pt.pRgbFloatClr++;
+ }
+
+ if DD_IsVertNormal(outtype) {
+
+ out_pt.pNormal->x = norm_mat[0][0]*in_pt.pNormal->x;
+ out_pt.pNormal->x += norm_mat[0][1]*in_pt.pNormal->y;
+ out_pt.pNormal->x += norm_mat[0][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->y = norm_mat[1][0]*in_pt.pNormal->x;
+ out_pt.pNormal->y += norm_mat[1][1]*in_pt.pNormal->y;
+ out_pt.pNormal->y += norm_mat[1][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->z = norm_mat[2][0]*in_pt.pNormal->x;
+ out_pt.pNormal->z += norm_mat[2][1]*in_pt.pNormal->y;
+ out_pt.pNormal->z += norm_mat[2][2]*in_pt.pNormal->z;
+
+ NORMALIZE_VECTOR (out_pt.pNormal, length);
+
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ if (DD_IsVertEdge(outtype)) {
+ *out_pt.pEdge= *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+ }
+
+ }
+
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+ default:
+ *voutput = NULL;
+ return(1);
+ }
+
+ return(0);
+ }
+
+ /*
+ * Next case output a 2DS point. Note that this point is
+ * normalized by w if necessary.
+ */
+ case DD_2DS_POINT:
+ case DD_RGBFLOAT_POINT2DS:
+ case DD_HSV_POINT2DS:
+ case DD_HLS_POINT2DS:
+ case DD_CIE_POINT2DS:
+ case DD_NORM_POINT2DS:
+ case DD_EDGE_POINT2DS:
+ case DD_RGBFLOAT_NORM_POINT2DS:
+ case DD_HSV_NORM_POINT2DS:
+ case DD_HLS_NORM_POINT2DS:
+ case DD_CIE_NORM_POINT2DS:
+ case DD_RGBFLOAT_EDGE_POINT2DS:
+ case DD_HSV_EDGE_POINT2DS:
+ case DD_HLS_EDGE_POINT2DS:
+ case DD_CIE_EDGE_POINT2DS:
+ case DD_NORM_EDGE_POINT2DS:
+ case DD_RGBFLOAT_NORM_EDGE_POINT2DS:
+ case DD_HSV_NORM_EDGE_POINT2DS:
+ case DD_HLS_NORM_EDGE_POINT2DS:
+ case DD_CIE_NORM_EDGE_POINT2DS:
+ {
+ ddFLOAT w;
+ switch (vinput->type) {
+ case DD_2D_POINT:
+ {
+
+ /* Use the pre-defined 2D list for output */
+ *voutput = output = &pddc->Static.misc.list2D;
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(i+1),output_size);
+ if(!(out_pt.p2DSpt = (pddolist->pts.p2DSpt)))
+ return(BadAlloc);
+
+
+ in_pt.p2DSpt = pddilist->pts.p2DSpt;
+
+ /* Note - just assume z = 0.0, w = 1.0 */
+ while (i--) {
+
+ /* cast operands & transform the coordinates */
+
+ tmp_pt.x = vert_mat[0][0]*in_pt.p2Dpt->x;
+ tmp_pt.x += vert_mat[0][1]*in_pt.p2Dpt->y;
+ tmp_pt.x += vert_mat[0][3];
+
+ tmp_pt.y = vert_mat[1][0]*in_pt.p2Dpt->x;
+ tmp_pt.y += vert_mat[1][1]*in_pt.p2Dpt->y;
+ tmp_pt.y += vert_mat[1][3];
+
+ /* Skip Z transformation */
+
+ /* The w must be computed to normalize the result */
+ w = vert_mat[3][0]*in_pt.p2Dpt->x;
+ w += vert_mat[3][1]*in_pt.p2Dpt->y;
+ w += vert_mat[3][3];
+
+ /* Now round and normalize the result */
+ if (w != 1.0) {
+ out_pt.p2DSpt->x = (ddSHORT)(tmp_pt.x / w);
+ out_pt.p2DSpt->y = (ddSHORT)(tmp_pt.y / w);
+ } else {
+ out_pt.p2DSpt->x = (ddSHORT)(tmp_pt.x);
+ out_pt.p2DSpt->y = (ddSHORT)(tmp_pt.y);
+ }
+ in_pt.p2Dpt++;
+ out_pt.p2DSpt++;
+
+
+ /* At this point we should be pointing to
+ * to the beginning of the next vertex
+ */
+
+ }
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+ case DD_3D_POINT:
+ case DD_RGBFLOAT_POINT:
+ case DD_HSV_POINT:
+ case DD_HLS_POINT:
+ case DD_CIE_POINT:
+ case DD_NORM_POINT:
+ case DD_EDGE_POINT:
+ case DD_RGBFLOAT_NORM_POINT:
+ case DD_HSV_NORM_POINT:
+ case DD_HLS_NORM_POINT:
+ case DD_CIE_NORM_POINT:
+ case DD_RGBFLOAT_EDGE_POINT:
+ case DD_HSV_EDGE_POINT:
+ case DD_HLS_EDGE_POINT:
+ case DD_CIE_EDGE_POINT:
+ case DD_NORM_EDGE_POINT:
+ case DD_RGBFLOAT_NORM_EDGE_POINT:
+ case DD_HSV_NORM_EDGE_POINT:
+ case DD_HLS_NORM_EDGE_POINT:
+ case DD_CIE_NORM_EDGE_POINT:
+ {
+
+ /* Use the pre-defined 2D list for output */
+ *voutput = output = &pddc->Static.misc.list2D;
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->numLists = vinput->numLists;
+ output->flags = vinput->flags;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j=0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist,(i+1),output_size);
+ if(!(out_pt.p2DSpt = (pddolist->pts.p2DSpt)))
+ return(BadAlloc);
+
+
+ in_pt.p3Dpt = pddilist->pts.p3Dpt;
+
+ /* Note - just assume z = 0.0, w = 1.0 */
+ while (i--) {
+
+ /* cast operands & transform the coordinates */
+
+ tmp_pt.x = vert_mat[0][0]*in_pt.p3Dpt->x;
+ tmp_pt.x += vert_mat[0][1]*in_pt.p3Dpt->y;
+ tmp_pt.x += vert_mat[0][2]*in_pt.p3Dpt->z;
+ tmp_pt.x += vert_mat[0][3];
+
+ tmp_pt.y = vert_mat[1][0]*in_pt.p3Dpt->x;
+ tmp_pt.y += vert_mat[1][1]*in_pt.p3Dpt->y;
+ tmp_pt.y += vert_mat[1][2]*in_pt.p3Dpt->z;
+ tmp_pt.y += vert_mat[1][3];
+
+ /* Skip Z transformation */
+
+ /* The w must be computed to normalize the result */
+ w = vert_mat[3][0]*in_pt.p3Dpt->x;
+ w += vert_mat[3][1]*in_pt.p3Dpt->y;
+ w += vert_mat[3][2]*in_pt.p3Dpt->z;
+ w += vert_mat[3][3];
+
+ /* Now round and normalize the result */
+ if (w != 1.0) {
+ out_pt.p2DSpt->x = IRINT(tmp_pt.x / w);
+ out_pt.p2DSpt->y = IRINT(tmp_pt.y / w);
+ } else {
+ out_pt.p2DSpt->x = IRINT(tmp_pt.x);
+ out_pt.p2DSpt->y = IRINT(tmp_pt.y);
+ }
+ in_pt.p3Dpt++;
+ out_pt.p2DSpt++;
+
+
+ if (!DD_IsVertCoordsOnly(outtype)) {
+
+ if DD_IsVertColour(outtype) {
+ *out_pt.pRgbFloatClr =
+ *in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ out_pt.pRgbFloatClr++;
+ }
+
+ if DD_IsVertNormal(outtype) {
+
+ out_pt.pNormal->x = norm_mat[0][0]*in_pt.pNormal->x;
+ out_pt.pNormal->x += norm_mat[0][1]*in_pt.pNormal->y;
+ out_pt.pNormal->x += norm_mat[0][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->y = norm_mat[1][0]*in_pt.pNormal->x;
+ out_pt.pNormal->y += norm_mat[1][1]*in_pt.pNormal->y;
+ out_pt.pNormal->y += norm_mat[1][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->z = norm_mat[2][0]*in_pt.pNormal->x;
+ out_pt.pNormal->z += norm_mat[2][1]*in_pt.pNormal->y;
+ out_pt.pNormal->z += norm_mat[2][2]*in_pt.pNormal->z;
+
+ NORMALIZE_VECTOR (out_pt.pNormal, length);
+
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ if (DD_IsVertEdge(outtype)) {
+ *out_pt.pEdge= *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+ }
+
+ }
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+ case DD_RGBFLOAT_POINT4D:
+ case DD_HSV_POINT4D:
+ case DD_HLS_POINT4D:
+ case DD_CIE_POINT4D:
+ case DD_NORM_POINT4D:
+ case DD_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_POINT4D:
+ case DD_HSV_NORM_POINT4D:
+ case DD_HLS_NORM_POINT4D:
+ case DD_CIE_NORM_POINT4D:
+ case DD_RGBFLOAT_EDGE_POINT4D:
+ case DD_HSV_EDGE_POINT4D:
+ case DD_HLS_EDGE_POINT4D:
+ case DD_CIE_EDGE_POINT4D:
+ case DD_NORM_EDGE_POINT4D:
+ case DD_RGBFLOAT_NORM_EDGE_POINT4D:
+ case DD_HSV_NORM_EDGE_POINT4D:
+ case DD_HLS_NORM_EDGE_POINT4D:
+ case DD_CIE_NORM_EDGE_POINT4D:
+ case DD_HOMOGENOUS_POINT:
+ {
+
+ /* Use the pre-defined 2D list for output */
+ *voutput = output = &pddc->Static.misc.list2D;
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(output, vinput->numLists)
+ if (!output->ddList) return(BadAlloc);
+
+ output->type = outtype;
+ output->flags = vinput->flags;
+ output->numLists = vinput->numLists;
+
+ pddilist = vinput->ddList;
+ pddolist = output->ddList;
+
+ /* Now, transform each list */
+ for(j = 0; j < vinput->numLists; j++) {
+
+ if ((i = pddolist->numPoints = pddilist->numPoints) <= 0)
+ continue;
+
+ /*
+ * Insure sufficient room for each vertex
+ * Add one to leave room for possible polygon close.
+ */
+ MI_ALLOCLISTOFDDPOINT(pddolist, (i+1), output_size);
+ if(!(out_pt.p2DSpt = (pddolist->pts.p2DSpt)))
+ return(BadAlloc);
+
+ in_pt.p4Dpt = pddilist->pts.p4Dpt;
+
+ /* Note - just assume w = 1.0 */
+ while (i--) {
+
+ /* cast operands & transform the coordinates */
+
+ tmp_pt.x = vert_mat[0][0]*in_pt.p4Dpt->x;
+ tmp_pt.x += vert_mat[0][1]*in_pt.p4Dpt->y;
+ tmp_pt.x += vert_mat[0][2]*in_pt.p4Dpt->z;
+ tmp_pt.x += vert_mat[0][3]*in_pt.p4Dpt->w;
+
+ tmp_pt.y = vert_mat[1][0]*in_pt.p4Dpt->x;
+ tmp_pt.y += vert_mat[1][1]*in_pt.p4Dpt->y;
+ tmp_pt.y += vert_mat[1][2]*in_pt.p4Dpt->z;
+ tmp_pt.y += vert_mat[1][3]*in_pt.p4Dpt->w;
+
+ /* Skip Z transformation */
+
+ w = vert_mat[3][0]*in_pt.p4Dpt->x;
+ w += vert_mat[3][1]*in_pt.p4Dpt->y;
+ w += vert_mat[3][2]*in_pt.p4Dpt->z;
+ w += vert_mat[3][3]*in_pt.p4Dpt->w;
+
+ /* Now round and normal->ze the result */
+ if (w != 1.0) {
+ out_pt.p2DSpt->x = IRINT(tmp_pt.x / w);
+ out_pt.p2DSpt->y = IRINT(tmp_pt.y / w);
+ } else {
+ out_pt.p2DSpt->x = IRINT(tmp_pt.x);
+ out_pt.p2DSpt->y = IRINT(tmp_pt.y);
+ }
+
+ in_pt.p4Dpt++;
+ out_pt.p2DSpt++;
+
+
+ if (!DD_IsVertCoordsOnly(outtype)) {
+
+ if DD_IsVertColour(outtype) {
+ *out_pt.pRgbFloatClr =
+ *in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ out_pt.pRgbFloatClr++;
+ }
+
+ if DD_IsVertNormal(outtype) {
+
+ out_pt.pNormal->x = norm_mat[0][0]*in_pt.pNormal->x;
+ out_pt.pNormal->x += norm_mat[0][1]*in_pt.pNormal->y;
+ out_pt.pNormal->x += norm_mat[0][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->y = norm_mat[1][0]*in_pt.pNormal->x;
+ out_pt.pNormal->y += norm_mat[1][1]*in_pt.pNormal->y;
+ out_pt.pNormal->y += norm_mat[1][2]*in_pt.pNormal->z;
+ /* no translation */
+
+ out_pt.pNormal->z = norm_mat[2][0]*in_pt.pNormal->x;
+ out_pt.pNormal->z += norm_mat[2][1]*in_pt.pNormal->y;
+ out_pt.pNormal->z += norm_mat[2][2]*in_pt.pNormal->z;
+
+ NORMALIZE_VECTOR (out_pt.pNormal, length);
+
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ if (DD_IsVertEdge(outtype)) {
+ *out_pt.pEdge= *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+ }
+
+ }
+ pddilist++;
+ pddolist++;
+ }
+ break;
+ }
+
+ /* no more input types for 2DS outputs*/
+ default:
+ *voutput = NULL;
+ return(1);
+ break;
+ }
+
+ return(0);
+ }
+
+ /* no more output types left */
+ default:
+ *voutput = NULL;
+ return(1);
+ break;
+ }
+
+
+}
+
+/*++
+ |
+ | miFacetTransform(pddc, finput, foutput, norm_mat)
+ |
+ | Facet list transform routine.
+ |
+ | General transform routine for PEX.
+ |
+ | This routine takes in four parameters: a list of vertices,
+ | an output point type, and two matrices: one for transforming
+ | vertex data, the second for transforming normal data.
+ | The following assumptions are made:
+ | a) 2DS input is never used
+ | b) 2D input does not support normal, color or edge info
+ | c) output types do not have more attributes (color, normal or edge)
+ | than input data types
+ | d) only color specifiers with triplets of float values are
+ | supported
+ |
+ | All other cases produce undefined output
+ |
+ --*/
+
+ddpex3rtn
+miFacetTransform(pddc, finput, foutput, norm_mat)
+ miDDContext *pddc;
+ listofddFacet *finput;
+ listofddFacet **foutput;
+ ddFLOAT norm_mat[4][4];
+{
+
+ listofddFacet *fct_list;
+ ddFacetUnion in_fct;
+ ddFacetUnion out_fct;
+ ddFLOAT length;
+ char color_flag;
+ int j;
+ int facet_size;
+
+ /* Some quick error checking */
+ if (!DD_IsFacetNormal(finput->type)) {
+ *foutput = finput;
+ return(Success);
+ }
+
+ /*
+ * First, allocate storage for the facet list
+ */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = finput->type;
+
+ DDFacetSIZE(finput->type, facet_size);
+ MI_ALLOCLISTOFDDFACET(fct_list, finput->numFacets, facet_size);
+ if (!(out_fct.pNoFacet = fct_list->facets.pNoFacet)) return(BadAlloc);
+
+ color_flag = DD_IsFacetColour(finput->type);
+
+ in_fct = finput->facets;
+
+
+
+ /* Remember, facet data is of the form:
+ *
+ * |--------------|--------------------------|
+ * color (opt) normal (opt)
+ */
+
+ for (j = 0; j < finput->numFacets; j++) {
+
+ /* Copy the input facet color */
+ if (color_flag)
+ *(out_fct.pFacetRgbFloat++) = *(in_fct.pFacetRgbFloat++);
+
+ out_fct.pFacetN->x = norm_mat[0][0]*in_fct.pFacetN->x;
+ out_fct.pFacetN->x += norm_mat[0][1]*in_fct.pFacetN->y;
+ out_fct.pFacetN->x += norm_mat[0][2]*in_fct.pFacetN->z;
+ /* no translation */
+
+ out_fct.pFacetN->y = norm_mat[1][0]*in_fct.pFacetN->x;
+ out_fct.pFacetN->y += norm_mat[1][1]*in_fct.pFacetN->y;
+ out_fct.pFacetN->y += norm_mat[1][2]*in_fct.pFacetN->z;
+ /* no translation */
+
+ out_fct.pFacetN->z = norm_mat[2][0]*in_fct.pFacetN->x;
+ out_fct.pFacetN->z += norm_mat[2][1]*in_fct.pFacetN->y;
+ out_fct.pFacetN->z += norm_mat[2][2]*in_fct.pFacetN->z;
+
+ NORMALIZE_VECTOR (out_fct.pFacetN, length);
+
+ /* Process next facet */
+ in_fct.pFacetN++;
+ out_fct.pFacetN++;
+ }
+
+ fct_list->numFacets = finput->numFacets;
+ *foutput = fct_list;
+
+ return(Success);
+
+}
+
+/*++
+ |
+ | miBoundsTransform(pddc, ibounds, obounds, mat)
+ |
+ | Transforms a ddListBounds stucture by the specified matrix.
+ |
+ --*/
+
+ddpex3rtn
+miBoundsTransform(pddc, ibounds, obounds, mat)
+ miDDContext *pddc;
+ ddListBounds *ibounds;
+ ddListBounds *obounds;
+ ddFLOAT *mat;
+{
+
+ ddFLOAT *f = mat;
+
+ obounds->xmin = (*f++)*ibounds->xmin;
+ obounds->xmin += (*f++)*ibounds->ymin;
+ obounds->xmin += (*f++)*ibounds->zmin;
+ obounds->xmin += (*f++)*ibounds->wmin;
+
+ obounds->ymin = (*f++)*ibounds->xmin;
+ obounds->ymin += (*f++)*ibounds->ymin;
+ obounds->ymin += (*f++)*ibounds->zmin;
+ obounds->ymin += (*f++)*ibounds->wmin;
+
+ obounds->zmin = (*f++)*ibounds->xmin;
+ obounds->zmin += (*f++)*ibounds->ymin;
+ obounds->zmin += (*f++)*ibounds->zmin;
+ obounds->zmin += (*f++)*ibounds->wmin;
+
+ obounds->wmin = (*f++)*ibounds->xmin;
+ obounds->wmin += (*f++)*ibounds->ymin;
+ obounds->wmin += (*f++)*ibounds->zmin;
+ obounds->wmin += (*f++)*ibounds->wmin;
+
+ f = mat;
+
+ obounds->xmax = (*f++)*ibounds->xmax;
+ obounds->xmax += (*f++)*ibounds->ymax;
+ obounds->xmax += (*f++)*ibounds->zmax;
+ obounds->xmax += (*f++)*ibounds->wmax;
+
+ obounds->ymax = (*f++)*ibounds->xmax;
+ obounds->ymax += (*f++)*ibounds->ymax;
+ obounds->ymax += (*f++)*ibounds->zmax;
+ obounds->ymax += (*f++)*ibounds->wmax;
+
+ obounds->zmax = (*f++)*ibounds->xmax;
+ obounds->zmax += (*f++)*ibounds->ymax;
+ obounds->zmax += (*f++)*ibounds->zmax;
+ obounds->zmax += (*f++)*ibounds->wmax;
+
+ obounds->wmax = (*f++)*ibounds->xmax;
+ obounds->wmax += (*f++)*ibounds->ymax;
+ obounds->wmax += (*f++)*ibounds->zmax;
+ obounds->wmax += (*f++)*ibounds->wmax;
+
+ return(Success);
+
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTriStrip.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTriStrip.c
new file mode 100644
index 000000000..5ab54c137
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miTriStrip.c
@@ -0,0 +1,2219 @@
+/* $TOG: miTriStrip.c /main/13 1998/02/10 12:42:58 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miTriStrip.c,v 3.5 1998/10/04 09:34:30 dawes Exp $ */
+
+#include "miClip.h"
+#include "misc.h"
+#include "miscstruct.h"
+#include "ddpex3.h"
+#include "PEXErr.h"
+#include "miStruct.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "gcstruct.h"
+#include "miLight.h"
+#include "ddpex2.h"
+#include "pexos.h"
+
+
+static ddpex3rtn miClipTriStrip();
+static ddpex3rtn miCullTriStrip();
+static ddpex3rtn miDepthCueTriStrip();
+static ddpex3rtn Complete_TriFacetList();
+static ddpex3rtn Calculate_TriStrip_Facet_Normal();
+static ddpex3rtn Calculate_TriStrip_Vertex_Color_and_Normal();
+static ddpex3rtn Breakup_TriStrip();
+
+/*++
+ |
+ | Function Name: miTriangleStrip
+ |
+ | Function Description:
+ | Handles the triangle strip OC.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+miTriangleStrip(pRend, pExecuteOC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ miGenericStr *pExecuteOC;
+{
+
+/* calls */
+ ddpex3rtn miTransform();
+ ddpex3rtn miConvertVertexColors();
+ ddpex3rtn miConvertFacetColors();
+ ddpex3rtn miLightTriStrip();
+ ddpex3rtn miRenderTriStrip();
+ ddpex3rtn ComputeMCVolume();
+
+/* Local variable definitions */
+ miTriangleStripStruct *ddTri
+ = (miTriangleStripStruct *)(pExecuteOC+1);
+ miListHeader *input_list = &(ddTri->points); /* Input points */
+ listofddFacet *input_facet = ddTri->pFacets; /* facets */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *color_list,
+ *mc_list,
+ *wc_list,
+ *mc_clist,
+ *light_list,
+ *cc_list,
+ *clip_list,
+ *cull_list,
+ *dcue_list,
+ *dc_list;
+
+ listofddFacet *color_facet,
+ *mc_facet,
+ *wc_facet,
+ *light_facet,
+ *cc_facet,
+ *clip_facet,
+ *cull_facet,
+ *dc_facet;
+ listofddPoint *sp;
+ int i, j;
+ ddpex3rtn status;
+ ddPointType out_type;
+ ddUSHORT clip_mode;
+
+
+ /*
+ * First, check data input
+ * At this point, the data is all in one list
+ */
+
+ if (input_list->numLists == 0) return(Success);
+
+ /*
+ * Convert per-vertex and per-facet colors to rendering color model.
+ * Note that this implementation only supports rgb float.
+ */
+
+ if (DD_IsVertColour(input_list->type)) {
+ if (status = miConvertVertexColors(pRend,
+ input_list, PEXRdrColourModelRGB,
+ &color_list))
+ return (status);
+ } else {
+ color_list = input_list;
+ }
+
+ if ((input_facet) && (DD_IsFacetColour(input_facet->type))) {
+ if (status = miConvertFacetColors(pRend,
+ input_facet, PEXRdrColourModelRGB,
+ &color_facet))
+ return (status);
+ } else {
+ color_facet = input_facet;
+ }
+
+ /* Check for Model clipping */
+
+ if (pddc->Dynamic->pPCAttr->modelClip == PEXClip) {
+
+ /* Compute modelling coord version of clipping volume */
+ ComputeMCVolume(pRend, pddc);
+
+ clip_mode = MI_MCLIP;
+
+ /* Tranform points to 4D for clipping */
+ out_type = color_list->type;
+ if (status = miTransform(pddc,
+ color_list, &mc_clist,
+ ident4x4,
+ ident4x4,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+
+ if (status = miClipTriStrip(pddc, mc_clist, color_facet,
+ &mc_list, &mc_facet, clip_mode))
+ return (status);
+
+ /* if nothing left after model clip, return early */
+ if (mc_list->numLists <= 0) return(Success);
+
+ } else {
+ mc_list = color_list;
+ mc_facet = color_facet;
+ }
+
+ /* Note - After clipping the triangle strip may have
+ * decomposed into a number of separate triangle strips
+ */
+
+
+ /*
+ * Next, check lighting requirements
+ */
+
+ if (pddc->Static.attrs->reflModel != PEXReflectionNoShading) {
+
+ /* Transform to WC prior to applying lighting */
+ out_type = mc_list->type;
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRMCTOWCXFRM(pddc);
+ if (status = miTransform(pddc,
+ mc_list, &wc_list,
+ pddc->Dynamic->mc_to_wc_xform,
+ pddc->Static.misc.inv_tr_mc_to_wc_xform,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ((mc_facet) &&
+ (mc_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(mc_facet->type))) {
+ VALIDATEINVTRMCTOWCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ mc_facet, &wc_facet,
+ pddc->Static.misc.inv_tr_mc_to_wc_xform))
+ return (status);
+ } else wc_facet = mc_facet;
+
+ /* Apply lighting */
+ if (status = miLightTriStrip(pRend, pddc,
+ wc_list, wc_facet,
+ &light_list, &light_facet))
+ return (status);
+
+
+ /* Transform to CC for clipping */
+ if (DD_IsVertNormal(light_list->type)) VALIDATEINVTRWCTOCCXFRM(pddc);
+ if (status = miTransform(pddc,
+ light_list, &cc_list,
+ pddc->Dynamic->wc_to_cc_xform,
+ pddc->Static.misc.inv_tr_wc_to_cc_xform,
+ light_list->type))
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ( (light_facet) &&
+ (light_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(light_facet->type)) ) {
+ VALIDATEINVTRWCTOCCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ light_facet, &cc_facet,
+ pddc->Static.misc.inv_tr_wc_to_cc_xform))
+ return (status);
+ } else cc_facet = light_facet;
+
+ } else {
+
+ /* PEXReflectionNoShading case */
+
+ /* Now transform points and facets normals to CC */
+ out_type = mc_list->type;
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRMCTOCCXFRM(pddc);
+ if (status = miTransform(pddc,
+ mc_list, &cc_list,
+ pddc->Dynamic->mc_to_cc_xform,
+ pddc->Static.misc.inv_tr_mc_to_cc_xform,
+ DD_SetVert4D(out_type)))
+ return (status);
+
+ if ( (mc_facet) &&
+ (mc_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(mc_facet->type)) ) {
+ VALIDATEINVTRMCTOCCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ mc_facet, &cc_facet,
+ pddc->Static.misc.inv_tr_mc_to_cc_xform))
+ return (status);
+ } else cc_facet = mc_facet;
+
+ }
+
+ /* View clip primitive */
+ clip_mode = MI_VCLIP;
+ if (status = miClipTriStrip(pddc, cc_list, cc_facet,
+ &clip_list, &clip_facet, clip_mode))
+ return (status);
+
+ /* if nothing left after view clip, return early */
+ if (clip_list->numLists <= 0) return(Success);
+
+ /* Note - After View clipping, the triangle strip may have
+ * decomposed into a number of separate triangle strips
+ */
+
+ if (pddc->Dynamic->pPCAttr->cullMode) {
+ /* Now cull according to current culling mode */
+ if (status = miCullTriStrip(pddc, clip_list, clip_facet,
+ &cull_list, &cull_facet))
+ return (status);
+
+ /* if nothing left after culling, return early */
+ if (cull_list->numLists <= 0) return(Success);
+ } else {
+ cull_list = clip_list;
+ cull_facet = clip_facet;
+ }
+
+ /* DEPTH CUEING */
+ if (pddc->Dynamic->pPCAttr->depthCueIndex) {
+ miDepthCueTriStrip(pRend, cull_list, cull_facet, &dcue_list);
+ cull_list = dcue_list;
+ }
+
+ /* Lastly, transform to DC coordinates */
+ out_type = cull_list->type;
+ DD_SetVert2D(out_type);
+ DD_SetVertShort(out_type);
+ if (DD_IsVertNormal(out_type)) VALIDATEINVTRCCTODCXFRM(pddc);
+ if (status = miTransform(pddc,
+ cull_list, &dc_list,
+ pddc->Dynamic->cc_to_dc_xform,
+ pddc->Static.misc.inv_tr_cc_to_dc_xform,
+ out_type) )
+ return (status);
+
+ /* Transform facet normals if necessary */
+ if ( (cull_facet) &&
+ (cull_facet->numFacets > 0) &&
+ (DD_IsFacetNormal(cull_facet->type)) ) {
+ VALIDATEINVTRCCTODCXFRM(pddc);
+ if (status = miFacetTransform(pddc,
+ cull_facet, &dc_facet,
+ pddc->Static.misc.inv_tr_cc_to_dc_xform))
+ return (status);
+ } else dc_facet = cull_facet;
+
+ return (pddc->Static.RenderProcs[TRISTRIP_RENDER_TABLE_INDEX](pRend,
+ pddc,
+ dc_list,
+ dc_facet));
+}
+/*************************************************************************/
+
+/*++
+ |
+ | Function Name: miClipTriStrip
+ |
+ | Function Description:
+ | Clips a triangle strip. Note that this routine
+ | will return a triangle strip, though it sometimes creates
+ | "degenerate" (ie colinear vertices) triangles to achieve
+ | this result. At this point "hollow" filled triangles will
+ | exhibit clipping artifacts, (degenerate triangles) whereas
+ | "empty" fill with edge visibility enabled will not.
+ |
+ | Note(s):
+ |
+ | This routine uses a Sutherland-Hodgman approach for
+ | polygon clipping. (See, for example, Rodger's "Procedural
+ | Elements for Computer Graphics", pp 169-179).
+ | Each triangle strip is clipped successively against each (enabled)
+ | clipping boundary.
+ |
+ --*/
+
+static
+ddpex3rtn
+miClipTriStrip(pddc, input_vert, input_fct, output_vert, output_fct,clip_mode)
+/* in */
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+ ddUSHORT clip_mode;
+{
+/* uses */
+ ddPointUnion in_ptP, in_ptQ, in_ptR;
+ ddPointUnion out_pt;
+ float t_ptP, t_ptQ, t_ptR;
+ char *in_fct, *out_fct;
+ miListHeader *vinput, *voutput, *list1, *list2;
+ listofddFacet *finput, *foutput, *fct_list1, *fct_list2;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ int point_size;
+ int facet_size;
+ int pts_in_list;
+ int vert_count;
+ int new_facets;
+ int clip_plane, j, k, out_listnum;
+ ddUSHORT clipflags;
+ ddUSHORT current_clip;
+ int edge_offset;
+ ddHalfSpace *MC_HSpace;
+ ddVector3D PdotN, QdotN;
+ int clip_code;
+ ddULONG *edge_ptr;
+ char new_list;
+ ddpex3rtn status;
+ int num_planes;
+
+ /* Vertex data must be homogeneous and contain more than two points
+ * for clipper
+ */
+ if (!(DD_IsVert4D(input_vert->type))
+ || (input_vert->numLists == 0)) return(1);
+
+ /*
+ * Use the pre-defined clip lists for output
+ */
+
+ /*
+ * Must have edge flags in vertex if edges are to be drawn -
+ * otherwise, cannot determine wich edges are "original" and
+ * which edges where added by the clipper.
+ */
+ if ((pddc->Static.attrs->edges != PEXOff) &&
+ (!(DD_IsVertEdge(input_vert->type))))
+ {
+ if (status = miAddEdgeFlag(pddc, input_vert, &list1)) return(status);
+ vinput = list1;
+
+ } else {
+ /* Allocate an initial number of headers */
+ list1 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list1,
+ MI_ROUND_LISTHEADERCOUNT(input_vert->numLists));
+ if (!list1->ddList) return(BadAlloc);
+ list1->type = input_vert->type;
+ list1->flags = input_vert->flags;
+ vinput = input_vert; /* Initially set to input list */
+ }
+
+ list2 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list2,
+ MI_ROUND_LISTHEADERCOUNT(vinput->numLists));
+ if (!list2->ddList) return(BadAlloc);
+ list2->type = vinput->type;
+ list2->flags = vinput->flags;
+ voutput = list2;
+
+ /*
+ * Initialize an output facet list. Note that facet lists are only
+ * maintained if an initial one is supplied.
+ * Note that twice the number of input facets is an upper bound,
+ * although there is probably a tighter "fit".
+ */
+ if ((input_fct) && (input_fct->numFacets)) {
+ finput = input_fct;
+ DDFacetSIZE(input_fct->type, facet_size);
+ fct_list1 = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list1->type = input_fct->type;
+ MI_ALLOCLISTOFDDFACET(fct_list1, 3*input_fct->numFacets, facet_size);
+ if (!fct_list1->facets.pFacetRgbFloatN)
+ return(BadAlloc);
+ foutput = fct_list1;
+
+ fct_list2 = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list2->type = input_fct->type;
+ MI_ALLOCLISTOFDDFACET(fct_list2, 3*input_fct->numFacets, facet_size);
+ if (!fct_list2->facets.pFacetRgbFloatN)
+ return(BadAlloc);
+ } else
+ finput = foutput = fct_list1 = fct_list2 = 0;
+
+ /*
+ * Get point size so that this works for all point types
+ */
+ DD_VertPointSize(vinput->type, point_size);
+ if DD_IsVertEdge(vinput->type)
+ DD_VertOffsetEdge(vinput->type, edge_offset);
+
+ /*
+ * Each list is now clipped in turn against each (enabled) boundary.
+ */
+
+ if (clip_mode == MI_MCLIP)
+ num_planes = pddc->Static.misc.ms_MCV->numObj;
+ else num_planes = 6;
+
+ if (clip_mode == MI_MCLIP)
+ MC_HSpace = (ddHalfSpace *)(pddc->Static.misc.ms_MCV->pList);
+
+ for (clip_plane = 0; clip_plane < num_planes; clip_plane++) {
+
+ /* do entire list against one clipping plane at a time */
+ current_clip = 1 << clip_plane; /* current_clip is new clip bound */
+
+ /*
+ * Triangle strips begin with only one input and output
+ * vertex list. If a facet is found to be entirely out
+ * of bounds, A new list is started at the new included
+ * point. This new series of lists is clipped in turn
+ * against the next clipping planei, and may be decomposed into
+ * yet more lists. However, only a single facet list is
+ * maintained, at it is assumed that a one<->one correspondence
+ * exists between vertex triads and facets (within a single list)
+ * even if degenerate facets are added.
+ */
+
+ if (finput) {
+ in_fct = (char *)(finput->facets.pNoFacet);
+ MI_ALLOCLISTOFDDFACET(foutput,
+ (3*finput->numFacets), facet_size);
+ out_fct = (char *)(foutput->facets.pNoFacet);
+ }
+
+ for (j = 0, out_listnum = 0, new_list = 1, new_facets = 0,
+ pddilist = vinput->ddList, pddolist = voutput->ddList,
+ voutput->numLists = 0;
+ j < vinput->numLists; j++) {
+
+
+ /* Don't process if not enough points */
+ if ((vert_count = pddilist->numPoints) < 3) {
+ pddilist++;
+ continue;
+ }
+
+
+ /* Insure sufficient room for vertecies and degenerate points
+ * Note that twice the vertex count is an upper-bound for
+ * a clipped triangle(although there is probably a "tighter fit").
+ */
+
+ MI_ALLOCLISTOFDDPOINT(pddolist, 2*vert_count, point_size);
+ out_pt = pddolist->pts;
+ if (!out_pt.ptr) return(BadAlloc);
+
+ clip_code = 0;
+ /* Aquire first three points */
+ /* and generate clip code */
+ in_ptP.ptr = pddilist->pts.ptr;
+ COMPUTE_CLIP_PARAMS(in_ptP,t_ptP,0,clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ in_ptQ.ptr = in_ptP.ptr + point_size;
+ COMPUTE_CLIP_PARAMS(in_ptQ, t_ptQ, 1, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ in_ptR.ptr = in_ptQ.ptr + point_size;
+ /*
+ * Initialize the output array. The output array is expected
+ * to always contain the first two points, so load them -
+ * clipped if necessary.
+ */
+ switch(clip_code)
+ {
+ case 0: /* both P and Q are in bounds */
+ COPY_POINT(in_ptP, out_pt, point_size);
+ out_pt.ptr += point_size;
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_in_list = 2;
+ break;
+ case 1: /* P is out, Q is in */
+ CLIP_AND_COPY(vinput->type, in_ptP, t_ptP,
+ in_ptQ, t_ptQ, out_pt);
+ out_pt.ptr += point_size;
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_in_list = 2;
+ break;
+ case 2: /* P is in, Q is out */
+ COPY_POINT(in_ptP, out_pt, point_size);
+ out_pt.ptr += point_size;
+ CLIP_AND_COPY(vinput->type, in_ptQ, t_ptQ,
+ in_ptP, t_ptP, out_pt);
+ out_pt.ptr += point_size;
+ pts_in_list = 2;
+ break;
+ case 3: /* both are out */
+ pts_in_list = 0;
+ break;
+ }
+
+ /*
+ * For each vertex, clip a triangle.
+ * Each case assumes that points P & Q (the first and
+ * second points in the triangle, pointed to in the input
+ * list by in_ptR & in_ptQ) are already copied
+ * into the output array (clipped, if necessary and except for
+ * case 3), while R will be copied into the output array (pointed
+ * to by out_pt) if necessary during execution of the case
+ * statement.
+ *
+ * It is important to note that if a facet is completely
+ * rejected, a new list is formed. Also, to maintain
+ * the correct "sense" of the normals, if the new
+ * list is about to begin on an even facet #, a
+ * degenerate facet is placed at the beginning of the
+ * new list.
+ *
+ * Also, note that if additional facets are generated
+ * (cases 1,2,3,4,& 6) the artifact edge flag is set to zero.
+ * Within an edge flag, there are two bits determining edge
+ * visibility. Bit zero determines whether an edge is drawn
+ * between the current vertex N and vertex N-2, while bit one
+ * determines if an edge is drawn between edge N and N+1.
+ * If N-2 < 0 or N+1 > numfacets the edge is not drawn.
+ *
+ * 2_________ _4
+ * /\ /|\
+ * / \ / \
+ * / \ / \
+ * / \ / \
+ * 1<--------+3+---------5
+ *
+ * So, for the third element in the edge list,
+ * bit 0 indicates presence of an edge from 3 -> 4
+ * (forward edge)
+ * bit 1 indicates presence of an edge from 3 -> 1
+ * (backward edge)
+ *
+ * Also note that clipping in PHIGS does NOT
+ * display clipped edges along the boundaries, whereas fill
+ * area attribute HOLLOW does. This implementation does
+ * not handle the HOLLOW fill style properly in that respect.
+ * One possible solution is to use additional bits in the
+ * edge flag field.
+ */
+
+ for (k = 2; k < vert_count; k++) {
+ /*
+ * Clip the new triangle
+ * There are 8 possible ways that the triangle (P, Q, R) can
+ * be intersected by a clipping plane:
+ *
+ * P, Q, R in P, Q, R out
+ * P in Q, R out P, Q in R out P, R in, Q out
+ * Q in P, R out Q, R in P out
+ * R in P, Q out
+ *
+ * Each of these cases are handled separately.
+ */
+
+ new_list = 0;
+ COMPUTE_CLIP_PARAMS(in_ptR, t_ptR, 2, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+
+ switch(clip_code)
+ {
+ /*
+ * Case 0 - trivial accept P, Q, and R
+ * Proceed to next triangle.
+ */
+ case 0:
+ COPY_POINT(in_ptR, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_in_list++;
+ if (finput) {
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ ++new_facets;
+ }
+ break;
+
+ /*
+ * Case 1 - P is outside, Q & R are inside clip zone.
+ * This is a complex case which results in the creation
+ * of several new triangles including a "degenerate" triangle
+ * (two identical endpoints). Point "A" and point "Q" are
+ * already in the output list. Output vertex list is A-Q-B-Q-R
+ *
+ * |Q+ |Q+
+ * | /\ | /\
+ * |/ \ |/ \
+ * | \ ===> A+ \
+ * /| \ | \
+ * P+-|------+R B+------+R
+ * | |
+ * triangle PQR triangles AQB, QBQ(degenerate)
+ * & BQR
+ *
+ */
+ case 1:
+ /* If edges are visible,
+ * we wish to disable the edge from
+ * Q to B. This edge is specified
+ * by the forward edge of the first Q,
+ * the forward edge of B, and the
+ * backward edge of the second Q
+ */
+ if (pddc->Static.attrs->edges != PEXOff) {
+ out_pt.ptr -= point_size;
+ CLEAR_FWD_EDGE(out_pt.ptr, edge_offset);
+ /* edge from Q -> B */
+ out_pt.ptr += point_size;
+ }
+
+ CLIP_AND_COPY(vinput->type, in_ptP, t_ptP,
+ in_ptR, t_ptR, out_pt);
+ /* Places point "B" into output list */
+ if (pddc->Static.attrs->edges != PEXOff) {
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /* edge from B -> Q */
+ CLEAR_BKWD_EDGE(out_pt.ptr,edge_offset);
+ /* edge from B -> A */
+ }
+ out_pt.ptr += point_size;
+
+ COPY_POINT(in_ptQ, out_pt, point_size); /* degenerate point */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_BKWD_EDGE(out_pt.ptr,edge_offset);
+ out_pt.ptr += point_size;
+
+ COPY_POINT(in_ptR, out_pt, point_size);
+ out_pt.ptr += point_size;
+ pts_in_list += 3;
+
+ if (finput) {
+ /*
+ * Add three identical facets
+ */
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ new_facets += 3;
+ }
+ break;
+
+ /*
+ * Case 2 - P is inside, Q is outside, R is inside.
+ * Points P and A are already in the output list.
+ * Output list is P-A-R-B-R : disable edges from
+ * A to R
+ *
+ * Q+
+ * /\ A B
+ * ---------- ---+--+---
+ * / \ ===> / \
+ * / \ / \
+ * P+--------+R P+--------+R
+ *
+ * triangle PQR triangles PAR, ARB, RBR
+ *
+ */
+ case 2:
+ if (pddc->Static.attrs->edges != PEXOff) {
+ out_pt.ptr -= point_size;
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from A -> R */
+ out_pt.ptr += point_size;
+ }
+
+ COPY_POINT(in_ptR, out_pt, point_size);
+ /* Place point "R" into output list */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from R -> B */
+ out_pt.ptr += point_size;
+
+ CLIP_AND_COPY(vinput->type, in_ptQ, t_ptQ,
+ in_ptR, t_ptR, out_pt);
+ /*place point "B" into output list */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_BKWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from B -> A */
+ out_pt.ptr += point_size;
+
+ COPY_POINT(in_ptR, out_pt, point_size); /* degenerate point */
+ out_pt.ptr += point_size;
+ pts_in_list += 3;
+
+ if (finput) {
+ /*
+ * Add three identical facets
+ */
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ new_facets += 3;
+ }
+ break;
+
+ /*
+ * Case 3 - P and Q outside, R inside.
+ * Note - this is the first triangle in a new list
+ *
+ * Output list is A-B-R. If beginning on odd facet
+ * output list is B-A-B-R
+ *
+ *
+ * Q+ | |
+ * /\ | |
+ * / \| |
+ * / | ===> B+
+ * / |\ |\
+ * P+------|-+R A+-+R
+ * | |
+ * triangle PQR triangle ABR or BABR
+ *
+ *
+ */
+ case 3:
+ /*
+ * Note - this is the first triangle in a
+ * list, so copy the first two points in
+ * addition to copying the last point. Also,
+ * in model clipping we must be careful to
+ * preserve the "sense" of the normals, so
+ * add a degenerate facet if necessary.
+ */
+
+ if(IS_ODD(k)) {
+ CLIP_AND_COPY(vinput->type, in_ptQ, t_ptQ,
+ in_ptR, t_ptR, out_pt);
+ /*Places point "B" into output list */
+ out_pt.ptr += point_size;
+ pts_in_list++;
+ if (finput) {
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ ++new_facets;
+ }
+ }
+
+ CLIP_AND_COPY(vinput->type, in_ptP, t_ptP,
+ in_ptR, t_ptR, out_pt);
+ /*Places point "A" into output list */
+
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /*Edge from A -> B */
+ out_pt.ptr += point_size;
+
+ CLIP_AND_COPY(vinput->type, in_ptQ, t_ptQ,
+ in_ptR, t_ptR, out_pt);
+ /*Places point "B" into output list */
+ out_pt.ptr += point_size;
+
+
+ COPY_POINT(in_ptR, out_pt, point_size);
+ /*Places point "R" into output list */
+ out_pt.ptr += point_size;
+
+ if (finput) {
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ ++new_facets;
+ }
+ pts_in_list += 3;
+ break;
+
+ /*
+ * Case 4 - P and Q inside, R outside
+ * Output list is P-Q-B-Q-A
+ *
+ * Q+ | Q+ |
+ * /\ | /\ |
+ * / \| / \|
+ * / | ===> / +A
+ * / |\ / |
+ * P+------|-+R P+------+B
+ * | |
+ *
+ * triangle PQR triangles PQB, BQB, BQA
+ *
+ */
+ case 4:
+
+ if (pddc->Static.attrs->edges != PEXOff) {
+ out_pt.ptr -= point_size;
+ CLEAR_FWD_EDGE(out_pt.ptr, edge_offset);
+ /* edge from Q -> B */
+ out_pt.ptr += point_size;
+ }
+
+ CLIP_AND_COPY(vinput->type, in_ptR, t_ptR,
+ in_ptP, t_ptP, out_pt);
+ /* Places "B" into output */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from B -> Q */
+ out_pt.ptr += point_size;
+
+ COPY_POINT(in_ptQ, out_pt, point_size);
+ /* Places "Q" into output */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from Q -> B */
+ out_pt.ptr += point_size;
+
+ CLIP_AND_COPY(vinput->type, in_ptR, t_ptR,
+ in_ptQ, t_ptQ, out_pt);
+ /* Places "A" into output */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_BKWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from A -> B */
+ out_pt.ptr += point_size;
+ pts_in_list += 3;
+
+ if (finput) {
+ /*
+ * Add three identical facets
+ */
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ new_facets += 3;
+ }
+ break;
+
+ /*
+ * Case 5 - P and R are outside, Q in inside.
+ * Output list is A-Q-B. A and Q already in list
+ *
+ * Q+ Q+
+ * /\ /\
+ * ---------- ---+--+---
+ * / \ ===> A B
+ * / \
+ * P+--------+R
+ *
+ * triangle PQR triangles AQB
+ *
+ */
+ case 5:
+ CLIP_AND_COPY(vinput->type, in_ptR, t_ptR,
+ in_ptQ, t_ptQ, out_pt);
+ /*Places point "B" into output list */
+ if (pddc->Static.attrs->edges != PEXOff)
+ CLEAR_BKWD_EDGE(out_pt.ptr,edge_offset);
+ /* Edge from B -> A */
+ out_pt.ptr += point_size;
+ pts_in_list++;
+
+ if (finput) {
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ ++new_facets;
+ }
+ break;
+
+ /*
+ * Case 6 - P is inside, R and Q are outside
+ * Output list is: P-A-B
+ *
+ * |Q+ |
+ * | /\ |
+ * |/ \ |
+ * | \ ===> +A
+ * /| \ /|
+ * P+-|------+R P+-+B
+ * | |
+ * triangle PQR triangles
+ *
+ */
+ case 6:
+ if (pddc->Static.attrs->edges != PEXOff) {
+ out_pt.ptr -= point_size;
+ CLEAR_FWD_EDGE(out_pt.ptr,edge_offset);
+ out_pt.ptr += point_size;
+ }
+
+ CLIP_AND_COPY(vinput->type, in_ptR, t_ptR,
+ in_ptP, t_ptP, out_pt);
+ /* Places "B" into output list */
+ out_pt.ptr += point_size;
+ pts_in_list += 1;
+
+ if (finput) {
+ COPY_FACET(in_fct, out_fct, facet_size);
+ out_fct += facet_size;
+ ++new_facets;
+ }
+ break;
+
+ /*
+ * Case 7 - P, Q, and R are outside
+ * trivial rejection; begin new list
+ * at first "included" point if
+ * sufficient number of points
+ *
+ * Q+
+ * /\
+ * / \
+ * / \ ===>
+ * / \
+ * P+--------+R
+ *
+ */
+ case 7:
+ /* Complete initialization of last list */
+ if (pts_in_list > 2) {
+ /* Generate a new output list, increment list count. */
+ pddolist->numPoints = pts_in_list;
+ voutput->numLists++;
+ out_listnum++;
+ MI_ALLOCLISTHEADER(voutput,
+ MI_ROUND_LISTHEADERCOUNT(voutput->numLists));
+ /* skip to next output list */
+ pddolist = voutput->ddList + out_listnum;
+
+ /* Insure sufficient room for remaining verts
+ and degenerate points */
+ MI_ALLOCLISTOFDDPOINT(pddolist,
+ 2*(vert_count - k), point_size);
+
+ out_pt.ptr = pddolist->pts.ptr;
+ if (!out_pt.ptr) return(BadAlloc);
+ }
+
+ else {
+ /* Not enough points for output list */
+ pddolist->numPoints = 0;
+ }
+
+ /* Look for next point inside bounds */
+ do {
+ clip_code = 0;
+ in_ptR.ptr += point_size;
+ if (finput) in_fct += facet_size;
+ k++;
+ if (k == vert_count)
+ break;
+ COMPUTE_CLIP_PARAMS(in_ptR, t_ptR, 2, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ } while(clip_code);
+ if (k < vert_count) {
+ /*
+ * k is incremented by the for loop, but because we have
+ * a new_list, the pointers won't get bumped. Therefore,
+ * k must be decremented to keep it consistent with the
+ * pointers for reentering the for loop.
+ *
+ * However, k must not be adjusted when k == vert_count,
+ * because in this case P, Q and R are all clipped and it
+ * is necessary to leave k == vert_count to terminate the
+ * for loop.
+ */
+ k--;
+
+ /* Get P & Q; re-enter loop.
+ * Next case encountered will be 3, which will
+ * handle the odd-even rule for normals.
+ */
+ in_ptQ.ptr = in_ptR.ptr - point_size;
+ in_ptP.ptr = in_ptQ.ptr - point_size;
+ clip_code = 0; /* Q's ORd in at top of loop */
+ COMPUTE_CLIP_PARAMS(in_ptP, t_ptP, 0, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ COMPUTE_CLIP_PARAMS(in_ptQ, t_ptQ, 1, clip_mode,
+ current_clip,MC_HSpace,clip_code);
+ }
+ new_list = 1;
+ pts_in_list = 0; /*start a new list*/
+ break;
+
+ } /* end of cases */
+
+ if (!new_list) {
+ /* Prepare for next point */
+ in_ptP = in_ptQ; t_ptP = t_ptQ;
+ in_ptQ = in_ptR; t_ptQ = t_ptR;
+ in_ptR.ptr += point_size;
+ if (finput) in_fct += facet_size;
+ clip_code >>= 1;
+ }
+
+ } /* end of single list processing */
+
+ if (pts_in_list > 2) { /* Got some points! */
+ /* skip to next list, increment list count. */
+ pddolist->numPoints = pts_in_list;
+ ++pddolist;
+ ++out_listnum;
+ ++voutput->numLists;
+ }
+ else pddolist->numPoints = 0; /* use same list */
+
+ pddilist++;
+ } /* end of list of lists processing */
+
+ if (foutput) foutput->numFacets = new_facets;
+
+ if (out_listnum > 0) {
+ /* Use result of previous clip for input to next clip */
+ vinput = voutput;
+ if (voutput == list2) voutput = list1; /* ping-pong */
+ else voutput = list2;
+
+ if (finput) {
+ /* Use result of previous clip for input to next clip */
+ finput = foutput;
+ if (foutput == fct_list2) foutput = fct_list1;
+ else foutput = fct_list2;
+ }
+ } else {
+ /* If no lists, exit loop */
+ vinput = voutput;
+ finput = foutput;
+ }
+ if (clip_mode == MI_MCLIP) MC_HSpace++;
+
+ } /* end of processing for all clip planes */
+
+
+ /* Current input list is last processed (clipped) list */
+ *output_vert = vinput;
+ if (finput) *output_fct = finput;
+ else *output_fct = input_fct;
+
+
+ return (Success);
+
+}
+
+
+
+/*++
+ |
+ | miLightTriStrip
+ |
+ | Perform lighting calculations for the vertex or facet
+ | data provided according to the current attributes.
+ |
+ --*/
+
+ddpex3rtn
+miLightTriStrip(pRend, pddc, input_vert, input_fct, output_vert, output_fct)
+ ddRendererPtr pRend; /* renderer handle */
+ miDDContext *pddc; /* dd Context pointer */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+{
+/* calls */
+ ddpex3rtn miApply_Lighting();
+ ddpex3rtn miFilterPath();
+
+/* uses */
+ listofddFacet *fct_list, *broken_fct;
+ miListHeader *out_vert, *broken_list;
+ ddVector3D in_vertnorm;
+ ddRgbFloatColour in_vertcolour;
+ ddRgbFloatNormal *in_fct;
+ ddRgbFloatColour *out_fct;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddPointUnion in_pt, out_pt;
+ int i, j, k, num_facets,
+ inpoint_size, outpoint_size;
+ ddpex3rtn status;
+
+
+ /* Look for empty fill style. Still might have to render edges. */
+ if (pddc->Static.attrs->intStyle == PEXInteriorStyleEmpty)
+ return(Success);
+
+ /*
+ * First, Insure that the vertex and/or facet data
+ * is sufficient for the current Surface Interpolation method.
+ * Note that this implementation does not support
+ * PEXSurfaceInterpDotProduct and PEXSurfaceInterpNormal and
+ * that these surface interpolation types are approximated by
+ * PEXSurfaceInterpColour. The cases dealt with here, therefore,
+ * are constant surface color (thus a single color is computed
+ * per facet) and interpolated surface color (thus a color
+ * per vertex is required).
+ */
+
+ DD_VertPointSize(input_vert->type, inpoint_size);
+ switch(pddc->Static.attrs->surfInterp) {
+
+ case PEXSurfaceInterpNone: /* Flat shading */
+
+ if ((!input_fct) ||
+ (input_fct->numFacets == 0) ||
+ (!( (DD_IsFacetColour(input_fct->type)) &&
+ (DD_IsFacetNormal(input_fct->type))))) {
+
+ Complete_TriFacetList(pRend, input_vert, input_fct,
+ output_fct);
+
+ input_fct = *output_fct;
+ }
+
+ /*
+ * Should have facets with normals and surface colors now.
+ * Since we are flat shading, there is no further use
+ * for per-vertex color or normal data (however, leave
+ * any edge information). Remove it to prevent confusion
+ * further down the pipeline.
+ */
+ if ( (DD_IsVertNormal(input_vert->type)) ||
+ (DD_IsVertColour(input_vert->type)) ) {
+ if (status = miFilterPath(pddc, input_vert, output_vert,
+ ((1 << 3) | 1) ))
+ return(status);
+ } else {
+ *output_vert = input_vert;
+ }
+
+ /*
+ * Now allocate storage for the output facet list
+ * Note that the output facet list only contains colors.
+ */
+ *output_fct = fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->numFacets = input_fct->numFacets;
+ fct_list->type = DD_FACET_RGBFLOAT;
+ MI_ALLOCLISTOFDDFACET(fct_list, input_fct->numFacets,
+ sizeof(ddRgbFloatColour));
+ if (!(out_fct = fct_list->facets.pFacetRgbFloat)) return(BadAlloc);
+ in_fct = input_fct->facets.pFacetRgbFloatN;
+ pddilist = input_vert->ddList;
+ for(i = 0, in_pt.ptr = pddilist->pts.ptr;
+ i < input_vert->numLists; i++) {
+
+ /*
+ * Compute lighted facet color for each facet.
+ * Facet color is simply the sum of the lighting contributions
+ * from each light source.
+ */
+ for (k = 2; k < pddilist->numPoints; k++) {
+
+ /* One point at a time. Again, it is assumed there is a */
+ /* one<->one correspondence between the points in the lists */
+ /* and individual facets. Also note that we are associating */
+ /* arbitrarily the first point with the "position" of the */
+ /* facet. Perhaps a more correct method would use that average */
+
+ if (status = miApply_Lighting(pRend, pddc,
+ in_pt.p4Dpt,
+ &(in_fct->colour),
+ &(in_fct->normal),
+ out_fct ))
+ return(status);
+
+ in_pt.ptr += inpoint_size;
+ in_fct++;
+ out_fct++;
+ }
+ /* skip to next input vertex list */
+ pddilist++;
+ }
+ break;
+
+ case PEXSurfaceInterpColour:
+ case PEXSurfaceInterpDotProduct:
+ case PEXSurfaceInterpNormal:
+
+ if (!DD_IsVertNormal(input_vert->type)) {
+ /* Here, and only here, we must create a separate list for
+ * facet of the triangle strip. The reason for this is that
+ * we can only associate with each vertex a single normal,
+ * when in reality a vertex has different normals depending
+ * upon which facet is being rendered. The lighting effects
+ * only appear in positional lights, because the dot
+ * product with the vertex normals is indeed dependent upon
+ * position */
+
+ if (i = Breakup_TriStrip(pddc, input_vert, input_fct,
+ &broken_list, &broken_fct)) return (i);
+ input_vert = broken_list;
+ input_fct = broken_fct;
+ }
+
+ /* Insure sufficient info for calculation */
+ if ( (!DD_IsVertColour(input_vert->type)) ||
+ (!DD_IsVertNormal(input_vert->type)) ) {
+ Calculate_TriStrip_Vertex_Color_and_Normal(pRend, input_vert,
+ input_fct,
+ output_vert);
+ input_vert = *output_vert;
+ }
+
+ /* From here facet data only used in culling operation */
+ *output_fct = input_fct;
+
+ /* Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert,
+ MI_ROUND_LISTHEADERCOUNT(input_vert->numLists))
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = DD_RGBFLOAT_POINT4D;
+ if (pddc->Static.attrs->edges != PEXOff &&
+ DD_IsVertEdge(input_vert->type)) {
+ DD_SetVertEdge(out_vert->type);
+ }
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ DD_VertPointSize(out_vert->type, outpoint_size);
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+
+ for(i = 0; i < input_vert->numLists; i++) {
+
+ pddolist->numPoints = pddilist->numPoints;
+ MI_ALLOCLISTOFDDPOINT(pddolist, pddolist->numPoints,
+ outpoint_size);
+ if (!(out_pt.ptr = pddolist->pts.ptr)) return(BadAlloc);
+
+ for (j = 0, in_pt.ptr = pddilist->pts.ptr;
+ j < pddilist->numPoints; j++) {
+
+ /* Copy over the coordinate info */
+ *out_pt.p4Dpt = *in_pt.p4Dpt;
+
+ /* move output pointer to colour field */
+ out_pt.p4Dpt++;
+
+ /* miApplyLighting works on a single point at a time */
+ if (status = miApply_Lighting(pRend, pddc,
+ in_pt.p4Dpt,
+ &(in_pt.pRgbFloatNpt4D->colour),
+ &(in_pt.pRgbFloatNpt4D->normal),
+ out_pt.pRgbFloatClr))
+ return(status);
+
+ /* increment pointers */
+ in_pt.pRgbFloatNpt4D++;
+ out_pt.pRgbFloatClr++;
+
+ if (DD_IsVertEdge(out_vert->type)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ out_pt.pEdge++;
+ in_pt.pEdge++;
+ }
+
+
+ }
+ /* skip to next input and output vertex list */
+ pddilist++;
+ pddolist++;
+ }
+
+ break;
+
+ default:
+ *output_vert = input_vert;
+ *output_fct = input_fct;
+
+ }
+
+ return(Success);
+}
+
+/*++
+ |
+ | Complete_TriFacetList(pRend, input_vert, output_fct)
+ |
+ | Generates a facet list with colors and normals
+ | This routine should get folded into one with
+ | Create_Normals, with some form of flag to signal
+ | the type of output required. It would also be the
+ | place to put back-face attribute distinction.
+ |
+ --*/
+/* calls */
+
+static
+ddpex3rtn
+Complete_TriFacetList(pRend, input_vert, input_fct, output_fct)
+ ddRendererPtr pRend; /* renderer handle */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ listofddFacet **output_fct; /* output facet data */
+{
+/* local */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ listofddFacet *fct_list;
+ ddRgbFloatNormal *out_fct;
+ listofddPoint *pddlist;
+ ddPointUnion in_pt, tmp_pt;
+ ddFacetUnion in_fct;
+ int point_size;
+ ddRgbFloatPoint4D *vert1, *vert2, *vert3;
+ int total_facets;
+ int i,j;
+ float length;
+ ddpex3rtn status;
+ char have_colors, have_normals;
+
+ have_colors = have_normals = 0;
+
+ /* What data must be added to output facet list ? */
+ if (!(input_fct) || (input_fct->type == DD_FACET_NONE)) {
+ /*
+ * Since we are creating the facet list for the first
+ * we need to learn how many verticies are in all the
+ * lists.
+ */
+ pddlist = input_vert->ddList;
+ for (i = 0, total_facets = 0; i < input_vert->numLists; pddlist++, i++)
+ total_facets += (pddlist->numPoints - 2);
+ } else {
+ /* use input facet information */
+ total_facets = input_fct->numFacets;
+ in_fct.pNoFacet = input_fct->facets.pNoFacet;
+ if DD_IsFacetNormal(input_fct->type) have_normals = ~0;
+ if DD_IsFacetColour(input_fct->type) have_colors = ~0;
+ }
+
+ if ((have_colors) && (have_normals)) { /* Why are we here? */
+ *output_fct = input_fct;
+ return(Success);
+ }
+
+ /*
+ * Allocate storage for the facet list
+ */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+ MI_ALLOCLISTOFDDFACET(fct_list, total_facets, sizeof(ddRgbFloatNormal));
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+ out_fct = (ddRgbFloatNormal *)fct_list->facets.pFacetRgbFloatN;
+
+ DD_VertPointSize(input_vert->type, point_size);
+
+ /* Don't process if insufficient number of points */
+
+ if (input_vert->numLists > 0) {
+
+ pddlist = input_vert->ddList;
+
+ for (i = 0; i < input_vert->numLists; i++) {
+
+ in_pt.ptr = pddlist->pts.ptr;
+
+ for (j = 2; j < pddlist->numPoints; j++) {
+
+ /*
+ * Compute "intrinsic" color of facet.
+ * There is a "hierarchy" of sources for a facet's intrinsic
+ * color:
+ * vertex_colors present? facet_color =
+ * vertex_color of 1st point of facet
+ * else facet_color present? facet_color = facet_color
+ * else facet_color = PC_surface_color
+ * Note - this needs to be enhanced, using a dot product
+ * with the eye position to determine which surface color
+ * should be assigned in the case of front/back face
+ * distinguishing. this entire routine might get rolled into
+ * miLightTriStrip, and the correct color and reflectance
+ * model get passed into miApplyLighting.
+ */
+
+ if (DD_IsVertColour(input_vert->type)) {
+
+ out_fct->colour.red=out_fct->colour.green=out_fct->colour.blue=0.0;
+ vert1 = in_pt.pRgbFloatpt4D;
+ tmp_pt.ptr = in_pt.ptr + point_size;
+ vert2 = tmp_pt.pRgbFloatpt4D;
+ tmp_pt.ptr += point_size;
+ vert3 = tmp_pt.pRgbFloatpt4D;
+
+ out_fct->colour.red = ( vert1->colour.red +
+ vert2->colour.red +
+ vert3->colour.red )/3.0;
+ out_fct->colour.green = ( vert1->colour.green +
+ vert2->colour.green +
+ vert3->colour.green )/3.0;
+ out_fct->colour.blue = ( vert1->colour.blue +
+ vert2->colour.blue +
+ vert3->colour.blue )/3.0;
+
+ } else if (have_colors) {
+ out_fct->colour = *in_fct.pFacetRgbFloat;
+ in_fct.pFacetRgbFloat++;
+ } else {
+ /* use front face colors. This needs to get generalized
+ to deal with back-facing attributes*/
+ out_fct->colour =
+ (pddc->Static.attrs->surfaceColour.colour.rgbFloat);
+ }
+
+ if (!(have_normals)) {
+ /*
+ * Compute surface normal. Normals are required in
+ * Apply_Lighting for directional and positional lights,
+ * as well as culling (if enabled). One COULD check
+ * for ambient only, no culling, to optimize.
+ *
+ * The Surface normal is the cross product
+ * of three non-colinear points, in correct order.
+ */
+
+ vert1 = in_pt.pRgbFloatpt4D;
+ tmp_pt.ptr = in_pt.ptr + point_size;
+ vert2 = tmp_pt.pRgbFloatpt4D;
+ tmp_pt.ptr += point_size;
+ vert3 = tmp_pt.pRgbFloatpt4D;
+
+ if IS_ODD(j) {
+ CROSS_PRODUCT((&(vert3->pt)), (&(vert2->pt)), (&(vert1->pt)),
+ &(out_fct->normal));
+ }
+ else {
+ CROSS_PRODUCT((&(vert1->pt)), (&(vert2->pt)), (&(vert3->pt)),
+ &(out_fct->normal));
+ }
+
+ NORMALIZE_VECTOR(&(out_fct->normal), length);
+
+ /* Initialize to zero if triangle is
+ * degenerate and points are co-linear
+ */
+
+ if NEAR_ZERO(length) {
+ /* degenerate facet */
+ (out_fct->normal.x = 0.0);
+ (out_fct->normal.y = 0.0);
+ (out_fct->normal.z = 0.0);
+ }
+ } else {
+ /* use input facet normals */
+ out_fct->normal = *in_fct.pFacetN;
+ in_fct.pFacetN++;
+ }
+
+ /* Process next facet */
+ out_fct++;
+ in_pt.ptr += point_size;
+ }
+
+ pddlist++;
+ }
+
+ fct_list->numFacets = total_facets;
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+
+ } else {
+ fct_list->type = DD_FACET_NONE;
+ fct_list->numFacets = 0;
+ }
+
+ *output_fct = fct_list;
+ return(Success);
+
+}
+
+/*++
+ |
+ | Calculate_TriStrip_Facet_Normal
+ |
+ | Add facet normals to a facet list.
+ | Here we are counting on the fact that there is a one to one
+ | correspondance between input facets and vertex ordering.
+ |
+ --*/
+static
+ddpex3rtn
+Calculate_TriStrip_Facet_Normal(pddc, input_vert, input_fct, output_fct)
+ miDDContext *pddc;
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ listofddFacet **output_fct; /* output facet data */
+{
+
+ listofddFacet *fct_list;
+ ddRgbFloatColour *in_fct;
+ ddFacetUnion out_fct;
+ listofddPoint *pddlist;
+ ddPointUnion in_pt, nxt_pt;
+ ddVector3D normal;
+ int point_size;
+ ddCoord3D *vert1, *vert2, *vert3;
+ int numfacets;
+ int i,j;
+ float length;
+
+
+ /* Some quick error checking */
+ if ((input_fct) && (DD_IsFacetNormal(input_fct->type))) return(Success);
+
+
+ /*
+ * First, allocate storage for the facet list
+ */
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ if ((input_fct) && DD_IsFacetColour(input_fct->type)) {
+ in_fct = input_fct->facets.pFacetRgbFloat;
+ fct_list->type = DD_FACET_RGBFLOAT_NORM;
+ numfacets = input_fct->numFacets;
+ MI_ALLOCLISTOFDDFACET(fct_list, numfacets, sizeof(ddRgbFloatNormal));
+ } else {
+ in_fct = 0;
+ fct_list->type = DD_FACET_NORM;
+
+
+ /* Determine the total number of facets in all the lists */
+ for (i = 0, numfacets = 0, pddlist = input_vert->ddList;
+ i < input_vert->numLists; pddlist++, i++)
+ numfacets += (pddlist->numPoints - 2);
+
+ MI_ALLOCLISTOFDDFACET(fct_list, numfacets, sizeof(ddVector3D));
+ }
+
+ fct_list->numFacets = numfacets;
+ if (!fct_list->facets.pNoFacet) return(BadAlloc);
+
+ /* Otherwise... */
+ out_fct = fct_list->facets;
+ DD_VertPointSize(input_vert->type, point_size);
+
+ /* Don't process if no facets (!) */
+ if (numfacets == 0) return(1);
+
+ else {
+ for(i = 0, pddlist = input_vert->ddList;
+ i < input_vert->numLists; i++) {
+ for (j = 2, in_pt.ptr = pddlist->pts.ptr;
+ j < pddlist->numPoints; j++) {
+
+ /* Copy the input facet color */
+ if (in_fct) {
+ *out_fct.pFacetRgbFloat = *in_fct;
+ in_fct++;
+ }
+
+ /* Calculate and copy normal */
+
+ vert1 = in_pt.p3Dpt;
+ nxt_pt.ptr = in_pt.ptr + point_size;
+ vert2 = nxt_pt.p3Dpt;
+ nxt_pt.ptr += point_size;
+ vert3 = nxt_pt.p3Dpt;
+
+ if (IS_ODD(j)) {
+ CROSS_PRODUCT(vert3, vert2, vert1, &normal);
+ } else {
+ CROSS_PRODUCT(vert1, vert2, vert3, &normal);
+ }
+
+ NORMALIZE_VECTOR(&normal, length)
+
+ /* Initialize to zero if triangle is
+ * degenerate and points are co-linear
+ */
+
+ if (length == 0.0) {
+ (normal.x = 0.0);
+ (normal.y = 0.0);
+ (normal.z = 0.0);
+ }
+
+
+ if (in_fct) (out_fct.pFacetRgbFloatN++)->normal = normal;
+ else *(out_fct.pFacetN++) = normal;
+
+ in_pt.ptr += point_size;
+ }
+ pddlist++;
+ }
+ }
+
+ *output_fct = fct_list;
+
+ return(Success);
+}
+
+
+/*++
+ |
+ | Breakup_TriStrip
+ |
+ | Breaks up a triangle strip into as many lists as there are facets.
+ | This is necessary for shading interpolation methods as we need to
+ | facilitate a set of normals per facet.
+ |
+ |
+ |
+ --*/
+static
+ddpex3rtn
+Breakup_TriStrip(pddc, input_vert, input_fct, output_vert, output_fct)
+ miDDContext *pddc;
+ miListHeader *input_vert;
+ miListHeader **output_vert;
+ listofddFacet *input_fct; /* input facet data */
+ listofddFacet **output_fct; /* output facet data */
+{
+ miListHeader *list1;
+ listofddFacet *fct_list;
+ ddRgbFloatColour *in_fct;
+ ddFacetUnion out_fct;
+ listofddPoint *pddilist, *pddolist;
+ ddPointUnion pt_in, nxt_pt;
+ char *in_vert, *out_vert;
+ int point_size;
+ int numfacets, facetofpoints;
+ int i,j;
+
+
+
+ /* make sure that we have a facet list, and that it has normals */
+ if (!((input_fct) && (DD_IsFacetNormal(input_fct->type)))) {
+ if (i = Calculate_TriStrip_Facet_Normal(pddc, input_vert,
+ input_fct, &fct_list))
+ return(i);
+ input_fct = fct_list;
+ }
+
+ list1 = MI_NEXTTEMPDATALIST(pddc);
+ MI_ALLOCLISTHEADER(list1,
+ MI_ROUND_LISTHEADERCOUNT(input_fct->numFacets));
+ if (!list1->ddList) return(BadAlloc);
+ list1->type = input_vert->type;
+ list1->flags = input_vert->flags;
+
+ list1->numLists = input_fct->numFacets;
+
+
+ DD_VertPointSize(input_vert->type, point_size);
+ facetofpoints = 3 * point_size;
+
+ for(i = 0, pddilist = input_vert->ddList,
+ pddolist = list1->ddList;
+ i < input_vert->numLists; i++) {
+
+ for (j = 2, pt_in.ptr = pddilist->pts.ptr;
+ j < pddilist->numPoints; j++) {
+
+ MI_ALLOCLISTOFDDPOINT(pddolist, 1, facetofpoints);
+
+ /*
+ * Note that to preserver correct normals, must
+ * flip the order of the vertices every other facet.
+ */
+ if IS_ODD(j) {
+
+ in_vert = pt_in.ptr + 2*point_size;
+ out_vert = pddolist->pts.ptr;
+ memcpy( out_vert, in_vert, point_size);
+ in_vert -= point_size; out_vert += point_size;
+ memcpy( out_vert, in_vert, point_size);
+ out_vert += point_size;
+ memcpy( out_vert, pt_in.ptr, point_size);
+
+ } else {
+
+ memcpy( pddolist->pts.ptr, pt_in.ptr, facetofpoints);
+
+ }
+
+ pddolist->numPoints = 3;
+ pddolist++; /* one list per facet */
+ pt_in.ptr += point_size;
+ }
+ pddilist++;
+ }
+
+ *output_fct = input_fct;
+ *output_vert = list1;
+ return(Success);
+}
+
+
+
+
+
+/*++
+ |
+ | Calculate_TriStrip_Vertex_Color_and_Normal
+ |
+ | Add vertex normals and colors to a vertex list.
+ |
+ --*/
+static
+ddpex3rtn
+Calculate_TriStrip_Vertex_Color_and_Normal(pRend, input_vert, input_fct,
+ output_vert)
+
+ ddRendererPtr pRend; /* renderer handle */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *out_vert;
+ listofddFacet *fct_list;
+ ddRgbFloatNormal *out_fct;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddPointUnion in_pt, out_pt;
+ ddFacetUnion in_fct;
+ int inpoint_size, outpoint_size;
+ int facet_size;
+ int numFacets=0;
+ int i,j;
+ ddpex3rtn status;
+
+
+ /* Some quick error checking */
+ if ((DD_IsVertNormal(input_vert->type)) &&
+ (DD_IsVertColour(input_vert->type)))
+ return(Success);
+
+ /* Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert,
+ MI_ROUND_LISTHEADERCOUNT(input_vert->numLists))
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = DD_RGBFLOAT_NORM_POINT4D;
+ if (pddc->Static.attrs->edges != PEXOff &&
+ DD_IsVertEdge(input_vert->type)) {
+ DD_SetVertEdge(out_vert->type);
+ }
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+
+ DD_VertPointSize(input_vert->type, inpoint_size);
+ DD_VertPointSize(out_vert->type, outpoint_size);
+
+ /* Compute facet normals if no per-vertex normals with data */
+ if ( (!(DD_IsVertNormal(input_vert->type))) &&
+ ((!(input_fct)) || (!(DD_IsFacetNormal(input_fct->type)))) ) {
+
+ if (i = Calculate_TriStrip_Facet_Normal(pddc, input_vert,
+ input_fct, &fct_list))
+ return(i);
+
+ input_fct = fct_list;
+ }
+
+ if ((input_fct) && (input_fct->numFacets > 0)) {
+ in_fct = input_fct->facets;
+ DDFacetSIZE(input_fct->type, facet_size);
+ }
+ else in_fct.pNoFacet = 0;
+
+
+ for(i = 0; i < input_vert->numLists; i++) {
+ pddolist->numPoints = pddilist->numPoints;
+ in_pt.ptr = pddilist->pts.ptr;
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ outpoint_size);
+ if (!(out_pt.ptr = pddolist->pts.ptr)) return(BadAlloc);
+
+ for (j = 0, in_pt.ptr = pddilist->pts.ptr,
+ out_pt.ptr = pddolist->pts.ptr;
+ j < pddilist->numPoints; j++) {
+
+ /* First copy over coordinate data */
+ *out_pt.p4Dpt = *in_pt.p4Dpt;
+ in_pt.p4Dpt++;
+ out_pt.p4Dpt++;
+
+ /*
+ * Next color
+ * Colour is derived first from the vertex, second from the
+ * facet, and third from the current PC attributes.
+ */
+ if (DD_IsVertColour(input_vert->type)){
+ *out_pt.pRgbFloatClr = *in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ }
+ else {
+ if ((in_fct.pNoFacet) && (DD_IsFacetColour(input_fct->type)))
+ *out_pt.pRgbFloatClr = *in_fct.pFacetRgbFloat;
+ else {
+ *out_pt.pRgbFloatClr =
+ (pddc->Static.attrs->surfaceColour.colour.rgbFloat);
+ }
+ }
+
+ out_pt.pRgbFloatClr++;
+
+ /*
+ * Next normals
+ * Normals are derived first from the vertex, second from the
+ * facet (note that we insured above that there were facet normals).
+ */
+ if DD_IsVertNormal(input_vert->type) {
+ *out_pt.pNormal = *in_pt.pNormal;
+ in_pt.pNormal++;
+ }
+ else if (DD_IsFacetColour(input_fct->type))
+ *out_pt.pNormal = in_fct.pFacetRgbFloatN->normal;
+ else *out_pt.pNormal = *in_fct.pFacetN;
+
+ out_pt.pNormal++;
+
+ /* Next pass along edge info if there is any */
+ if (DD_IsVertEdge(out_vert->type)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+ }
+ if ((in_fct.pNoFacet)) in_fct.pNoFacet += facet_size;
+ pddilist++;
+ pddolist++;
+ }
+ return(Success);
+}
+
+/*++
+ |
+ | miCullTriStrip(pddc, input_vert, input_fct, output_vert, output_fct)
+ |
+ | Perform culling of facets, and their associated data points,
+ | according to the current culling mode.
+ |
+ --*/
+
+static
+ddpex3rtn
+miCullTriStrip(pddc, input_vert, input_fct, output_vert, output_fct)
+ miDDContext *pddc; /* dd Context pointer */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+ listofddFacet **output_fct; /* output facet data */
+{
+/* uses */
+ miListHeader *out_vert;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ listofddFacet *fct_list;
+ ddFacetUnion in_fct;
+ ddFacetUnion out_fct;
+ ddPointUnion in_pt,out_pt;
+ listofddPoint temp;
+ int i, j;
+ char accept, new_list;
+ char return_facet_list;
+ int point_size, facet_size;
+ int verts_in_list, out_listnum;
+
+ /*
+ * Create facet normals if necessary. These are used to determine
+ * if the facet is to be culled. Note: only return a facet list
+ * if a valid facet list is input.
+ */
+ if ( (!input_fct) || (input_fct->numFacets <= 0) ) {
+ Calculate_TriStrip_Facet_Normal(pddc, input_vert,
+ (listofddFacet *)0, &input_fct);
+ return_facet_list = 0;
+ *output_fct = 0;
+ } else {
+ if (!(DD_IsFacetNormal(input_fct->type))) {
+ Calculate_TriStrip_Facet_Normal(pddc, input_vert,
+ input_fct, output_fct);
+ input_fct = *output_fct;
+ }
+ return_facet_list = 1;
+ }
+
+ /*
+ * allocate storage for the output vertex and facet list
+ */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+ out_vert->type = input_vert->type;
+ out_vert->flags = input_vert->flags;
+ out_vert->numLists = 0;
+ MI_ALLOCLISTHEADER(out_vert,
+ MI_ROUND_LISTHEADERCOUNT(input_vert->numLists))
+ if (!out_vert->ddList) return(BadAlloc);
+
+
+ DD_VertPointSize(input_vert->type, point_size);
+
+ fct_list = MI_NEXTTEMPFACETLIST(pddc);
+ fct_list->type = input_fct->type;
+ DDFacetSIZE(input_fct->type, facet_size);
+ MI_ALLOCLISTOFDDFACET(fct_list, input_fct->numFacets, facet_size);
+ out_fct = fct_list->facets;
+ if (!out_fct.pNoFacet) return(BadAlloc);
+ in_fct = input_fct->facets;
+
+
+ /*
+ * This test is performed in NPC space. As a result,
+ * the sign of the z component of the facet normal
+ * indicates the direction in which the facet is pointing.
+ * Therefore if the cullmode is PEXBackFaces and the
+ * z component is negative, reject the facet. Similarily,
+ * if the z component of the normal is positive, and
+ * the cullmode is PEXFrontFaces, also reject the face.
+ */
+
+ for(i = 0, out_listnum = 1, fct_list->numFacets = 0,
+ out_vert->numLists = 0,
+ pddilist = input_vert->ddList, pddolist = out_vert->ddList;
+ i < input_vert->numLists; i++) {
+
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),point_size);
+ if (!pddolist->pts.ptr) return(BadAlloc);
+
+ for (j= 2, verts_in_list = 0, new_list = 1,
+ in_pt.ptr = pddilist->pts.ptr + (2 * point_size),
+ out_pt.ptr = pddolist->pts.ptr,
+ pddolist->numPoints = 0;
+ j < pddilist->numPoints; j++) {
+
+ accept = 0;
+
+ if (pddc->Dynamic->pPCAttr->cullMode == PEXBackFaces) {
+ if (DD_IsFacetColour(input_fct->type)) {
+ if (in_fct.pFacetRgbFloatN->normal.z >= 0) accept = 1;
+ } else if (in_fct.pFacetN->z >= 0) accept = 1;
+ } else /* pddc->Dynamic->pPCAttr->cullMode == PEXFrontFaces */ {
+ if (DD_IsFacetColour(input_fct->type)) {
+ if (in_fct.pFacetRgbFloatN->normal.z < 0) accept = 1;
+ } else if (in_fct.pFacetN->z < 0) accept = 1;
+ }
+
+ if (accept) {
+
+ if (new_list) { /* starting new list after facet(s) culled */
+ /*initialize first points for the first facet */
+ memcpy( out_pt.ptr, in_pt.ptr - (2 * point_size), (2*point_size));
+ out_pt.ptr += 2 * point_size;
+ new_list = 0;
+ verts_in_list += 2;
+ }
+
+ /* copy the vertex info associated with this facet */
+ memcpy( out_pt.ptr, in_pt.ptr, point_size);
+ out_pt.ptr += point_size;
+ ++verts_in_list;
+
+ /* copy the facet info */
+ if (DD_IsFacetColour(input_fct->type))
+ *out_fct.pFacetRgbFloatN = *in_fct.pFacetRgbFloatN;
+ else *out_fct.pFacetN = *in_fct.pFacetN;
+
+ /* increment the output pointer */
+ out_fct.pNoFacet += facet_size;
+ fct_list->numFacets++;
+
+ } else {
+ /* Facet culled; terminate output vertex list */
+ if (verts_in_list > 2) { /* facets in this list */
+ pddolist->numPoints = verts_in_list;
+ ++out_vert->numLists;
+ out_listnum++;
+ /* create a new output vertex list; load first points */
+ MI_ALLOCLISTHEADER(out_vert,
+ MI_ROUND_LISTHEADERCOUNT(out_listnum))
+ if (!out_vert->ddList) return(BadAlloc);
+
+ pddolist = out_vert->ddList + (out_listnum - 1);
+ pddolist->numPoints = 0;
+ MI_ALLOCLISTOFDDPOINT(pddolist,
+ (pddilist->numPoints - j + 2), point_size);
+ if (!pddolist->pts.ptr) return(BadAlloc);
+ out_pt.ptr = pddolist->pts.ptr;
+ verts_in_list = 0;
+ }
+ new_list = 1;
+ }
+ in_pt.ptr += point_size;
+ in_fct.pNoFacet += facet_size;
+ }
+ ++pddilist;
+ if (verts_in_list > 2) {
+ pddolist->numPoints = verts_in_list;
+ ++out_listnum;
+ ++out_vert->numLists;
+ ++pddolist;
+ }
+ }
+
+ /*
+ * Only return facet list if one was passed in. Reduces the
+ * information that must be processed by the rest of the pipeline.
+ */
+ if (return_facet_list) *output_fct = fct_list;
+
+ return(Success);
+}
+
+/*++
+ |
+ | miDepthCueTriStrip(pddc, input_vert, input_fct, output_vert, output_fct)
+ |
+ | Performs Depth cueing of triangle strips data lists..
+ | Assigns per-vertex colors to the data list according to the
+ | "Annex E - Informative" discussion of the ISO PHIGS PLUS spec.
+ |
+ |
+ --*/
+static
+ddpex3rtn
+miDepthCueTriStrip(pRend, input_vert, input_fct, output_vert)
+
+ ddRendererPtr pRend; /* renderer handle */
+ miListHeader *input_vert; /* input vertex data */
+ listofddFacet *input_fct; /* input facet data */
+ miListHeader **output_vert; /* output vertex data */
+{
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ miListHeader *out_vert;
+ listofddFacet *fct_list;
+ ddFLOAT pt_depth;
+ listofddPoint *pddilist;
+ listofddPoint *pddolist;
+ ddPointUnion in_pt, out_pt;
+ ddRgbFloatColour *in_color;
+ ddFacetUnion in_fct;
+ int inpoint_size, outpoint_size;
+ int facet_size;
+ int numFacets=0;
+ int i,j;
+ ddpex3rtn status;
+ ddDepthCueEntry *dcue_entry;
+
+ /* look for empty list header */
+ if (input_vert->numLists == 0) return(Success);
+
+ /* validate CC version of Depth Cue information */
+ if (pddc->Static.misc.flags & CC_DCUEVERSION)
+ Compute_CC_Dcue(pRend, pddc);
+
+ /* check to make sure depth cuing is enabled */
+ if (pddc->Static.misc.cc_dcue_entry.mode == PEXOff) {
+ *output_vert = input_vert;
+ return(Success);
+ }
+
+ /* Else, depth cue! Use one of the pre-defined 4D list for output */
+ *output_vert = out_vert = MI_NEXTTEMPDATALIST(pddc);
+
+ /* Insure sufficient room for each header */
+ MI_ALLOCLISTHEADER(out_vert,
+ MI_ROUND_LISTHEADERCOUNT(input_vert->numLists))
+ if (!out_vert->ddList) return(BadAlloc);
+
+ out_vert->type = input_vert->type;
+ if (!(DD_IsVertColour(input_vert->type)))
+ DD_SetVertRGBFLOAT(out_vert->type);
+ out_vert->numLists = input_vert->numLists;
+ out_vert->flags = input_vert->flags;
+
+ pddilist = input_vert->ddList;
+ pddolist = out_vert->ddList;
+
+ DD_VertPointSize(input_vert->type, inpoint_size);
+ DD_VertPointSize(out_vert->type, outpoint_size);
+
+ if ((input_fct) && (input_fct->numFacets > 0)) {
+ in_fct = input_fct->facets;
+ DDFacetSIZE(input_fct->type, facet_size);
+ } else in_fct.pNoFacet = 0;
+
+ for(i = 0; i < input_vert->numLists; i++) {
+ pddolist->numPoints = pddilist->numPoints;
+ in_pt.ptr = pddilist->pts.ptr;
+ MI_ALLOCLISTOFDDPOINT(pddolist,(pddilist->numPoints+1),
+ outpoint_size);
+ if (!(out_pt.ptr = pddolist->pts.ptr)) return(BadAlloc);
+
+ for (j = 0, in_pt.ptr = pddilist->pts.ptr,
+ out_pt.ptr = pddolist->pts.ptr;
+ j < pddilist->numPoints; j++) {
+
+ /* First copy over coordinate data */
+ pt_depth = in_pt.p4Dpt->z;
+ *out_pt.p4Dpt = *in_pt.p4Dpt;
+ in_pt.p4Dpt++;
+ out_pt.p4Dpt++;
+
+ /*
+ * Next color
+ * Colour is derived first from the vertex, second from the
+ * facet, and third from the current PC attributes.
+ */
+ if (DD_IsVertColour(input_vert->type)){
+ in_color = in_pt.pRgbFloatClr;
+ in_pt.pRgbFloatClr++;
+ }
+ else {
+ if ((in_fct.pNoFacet) && (DD_IsFacetColour(input_fct->type)))
+ in_color = in_fct.pFacetRgbFloat;
+ else {
+ in_color =
+ &(pddc->Static.attrs->surfaceColour.colour.rgbFloat);
+ }
+ }
+
+ APPLY_DEPTH_CUEING(pddc->Static.misc.cc_dcue_entry,
+ pt_depth, in_color, out_pt.pRgbFloatClr)
+
+ out_pt.pRgbFloatClr++;
+
+ /*
+ * Next normals
+ * Normals are derived first from the vertex, second from the
+ * facet (note that we insured above that there were facet normals).
+ */
+ if DD_IsVertNormal(input_vert->type) {
+ *out_pt.pNormal = *in_pt.pNormal;
+ in_pt.pNormal++;
+ out_pt.pNormal++;
+ }
+
+ /* Next pass along edge info if there is any */
+ if (DD_IsVertEdge(out_vert->type)) {
+ *out_pt.pEdge = *in_pt.pEdge;
+ in_pt.pEdge++;
+ out_pt.pEdge++;
+ }
+
+ }
+ if ((in_fct.pNoFacet)) in_fct.pNoFacet += facet_size;
+ pddilist++;
+ pddolist++;
+ }
+ return(Success);
+}
+
+
+
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/pexOCParse.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/pexOCParse.c
new file mode 100644
index 000000000..7719736f6
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/pexOCParse.c
@@ -0,0 +1,2249 @@
+/* $TOG: pexOCParse.c /main/11 1998/02/10 12:43:05 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/pexOCParse.c,v 3.6 1998/10/04 09:34:30 dawes Exp $ */
+
+
+#include "miStruct.h"
+#include "ddpex2.h"
+#include "pexExtract.h"
+#include "pexUtils.h"
+#include "miLight.h"
+#include "pexos.h"
+
+
+/** Parsing functions:
+ ** Each function takes two parameters: a pointer to the element to be
+ ** parsed (in PEX format) and a pointer to a pointer to return the
+ ** parsed element (in server native internal format).
+ **
+ ** These routines may be used in most cases for both creation
+ ** and replacement of structure elements. If the second argument
+ ** points to a NULL, then the memory is allocated for the creation
+ ** of the structure element. Otherwise, no new memory is
+ ** allocated and the structure element is replaced in place.
+ ** This scheme requires that the calling routine ensure
+ ** that there is sufficient memory already allocated for replacing
+ ** in place.
+ **
+ ** To support this scheme, parse routine writers must calculate
+ ** the amount of memory required to store the element in server
+ ** native format before allocating it, and pass this number of
+ ** bytes as the 3rd argument to the below macro GET_DD_STORAGE.
+ ** Then the parse routine can be put in both the parse and
+ ** replace tables as the entry for handling the OC.
+ **
+ ** Note that there are 3 exceptions to this symmetry:
+ ** LightState
+ ** SOFAS
+ ** NurbSurfaces
+ **
+ ** For each of these, there are separate parse and replace
+ ** routines.
+ **
+ ** For any OC that follows the above scheme, the corresponding
+ ** entry in the destroy table can be the default (destroyOC_PEX),
+ ** since memory allocation is therefore in one chunk. If the
+ ** coder of a parse routine cannot write the routine so that all
+ ** of the memory is allocated at once, then they must also write
+ ** a special destroy routine for this element (to ensure no
+ ** memory leakage).
+ **
+ ** Coders of parsing routines must also provide corresponding
+ ** copy and inquire routines (see miCopy.c and miInquire.c).
+ **/
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CAT(a,b) a##b
+#else
+#define CAT(a,b) a/**/b
+#endif
+
+#define OC_PARSER_FUNC_HEADER(suffix) \
+ ddpex2rtn CAT(parse,suffix)(pPEXOC, ppExecuteOC)\
+ ddElementInfo *pPEXOC; /* PEX format */ \
+ miGenericElementPtr *ppExecuteOC; /* internal format */
+
+#define OC_PARSER_RETURN(ANSWER) \
+ return(Success);
+
+#define PARSER_PTR(PTR) \
+ ddPointer PTR = (ddPointer)(pPEXOC + 1)
+
+#define LEN_WO_HEADER(OCtype) (pPEXOC->length * sizeof(CARD32) - sizeof(OCtype))
+
+#define GET_DD_STORAGE(DD_ST, TYPE, SIZE) \
+ if (*ppExecuteOC == 0) { \
+ *ppExecuteOC = \
+ (miGenericElementPtr) xalloc((unsigned long)((SIZE) \
+ + sizeof(miGenericElementStr)));\
+ if (!(*ppExecuteOC)) return (BadAlloc); \
+ } \
+ (DD_ST) = (TYPE *)((*ppExecuteOC)+1);
+
+#define GET_MORE_STORAGE(DD_ST, TYPE, SIZE) \
+ if ((SIZE) > 0) { \
+ (DD_ST) = (TYPE *)xalloc((unsigned long)(SIZE)); \
+ if (!(DD_ST)) err = BadAlloc; } \
+ else DD_ST = 0;
+
+
+extern void freeTrimCurves();
+extern void freeKnots();
+
+
+/*
+ Returns number of bytes required to store the indicated data
+ */
+int
+CountFacetOptData(ptr, colourType, numFacets, facetMask)
+ddPointer ptr;
+CARD16 colourType;
+CARD32 numFacets;
+CARD16 facetMask;
+{
+ ASSURE(facetMask <= 3);
+
+ switch (facetMask) {
+ case PEXGAColour | PEXGANormal : {
+
+ switch (colourType) {
+
+ case PEXIndexedColour:
+ return(numFacets * sizeof(ddIndexNormal));
+
+ case PEXRgbFloatColour :
+ return(numFacets * sizeof(ddRgbFloatNormal));
+
+ case PEXCieFloatColour :
+ return(numFacets * sizeof(ddCieNormal));
+
+ case PEXHsvFloatColour :
+ return(numFacets * sizeof(ddHsvNormal));
+
+ case PEXHlsFloatColour :
+ return(numFacets * sizeof(ddHlsNormal));
+
+ case PEXRgb8Colour :
+ return(numFacets * sizeof(ddRgb8Normal));
+
+ case PEXRgb16Colour :
+ return(numFacets * sizeof(ddRgb16Normal));
+ default:
+ return(0);
+ }
+ break; }
+
+ case PEXGANormal :
+
+ return(numFacets * sizeof(ddVector3D));
+
+ case PEXGAColour : {
+
+ switch (colourType) {
+
+ case PEXIndexedColour:
+ return(numFacets * sizeof(ddIndexedColour));
+ /* force lword alignment for any adjacent pointers */
+
+ case PEXRgbFloatColour :
+ return(numFacets * sizeof(ddRgbFloatColour));
+
+ case PEXCieFloatColour :
+ return(numFacets * sizeof(ddCieColour));
+
+ case PEXHsvFloatColour :
+ return(numFacets * sizeof(ddHsvColour));
+
+ case PEXHlsFloatColour :
+ return(numFacets * sizeof(ddHlsColour));
+
+ case PEXRgb8Colour :
+ return(numFacets * sizeof(ddRgb8Colour));
+
+ case PEXRgb16Colour :
+ return(numFacets * sizeof(ddRgb16Colour));
+
+ default:
+ return(0);
+ }
+ break; }
+
+ case 0x0000 :
+ return(0);
+ default:
+ return(0);
+ }
+
+}
+
+
+/*
+ Parses facet data into already allocated memory (pFacetData)
+*/
+void
+ParseFacetOptData(ptr, colourType, numFacets, facetMask, pFacetList, pFacetData,rptr)
+ddPointer ptr;
+CARD16 colourType;
+CARD32 numFacets;
+CARD16 facetMask;
+listofddFacet *pFacetList;
+ddPointer pFacetData;
+ddPointer *rptr;
+{
+ ASSURE(facetMask <= 3);
+
+ switch (facetMask) {
+ case PEXGAColour | PEXGANormal : {
+
+ pFacetList->numFacets = numFacets;
+
+ switch (colourType) {
+
+ case PEXIndexedColour: {
+ pFacetList->type = DD_FACET_INDEX_NORM;
+ pFacetList->facets.pFacetIndexN
+ = (ddIndexNormal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddIndexNormal);
+ EXTRACT_STRUCT( numFacets, ddIndexNormal,
+ pFacetList->facets.pFacetIndexN, ptr);
+
+ break; }
+
+ case PEXRgbFloatColour : {
+ pFacetList->type = DD_FACET_RGBFLOAT_NORM;
+ pFacetList->facets.pFacetRgbFloatN
+ = (ddRgbFloatNormal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddRgbFloatNormal);
+ EXTRACT_STRUCT( numFacets, ddRgbFloatNormal,
+ pFacetList->facets.pFacetRgbFloatN, ptr);
+ break; }
+
+ case PEXCieFloatColour : {
+ pFacetList->type = DD_FACET_CIE_NORM;
+ pFacetList->facets.pFacetCieN = (ddCieNormal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddCieNormal);
+ EXTRACT_STRUCT( numFacets, ddCieNormal,
+ pFacetList->facets.pFacetCieN, ptr);
+ break; }
+
+ case PEXHsvFloatColour : {
+ pFacetList->type = DD_FACET_HSV_NORM;
+ pFacetList->facets.pFacetHsvN = (ddHsvNormal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddHsvNormal);
+ EXTRACT_STRUCT( numFacets, ddHsvNormal,
+ pFacetList->facets.pFacetHsvN, ptr);
+ break; }
+
+ case PEXHlsFloatColour : {
+ pFacetList->type = DD_FACET_HLS_NORM;
+ pFacetList->facets.pFacetHlsN = (ddHlsNormal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddHlsNormal);
+ EXTRACT_STRUCT( numFacets, ddHlsNormal,
+ pFacetList->facets.pFacetHlsN, ptr);
+ break; }
+
+ case PEXRgb8Colour : {
+ pFacetList->type = DD_FACET_RGB8_NORM;
+ pFacetList->facets.pFacetRgb8N = (ddRgb8Normal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddRgb8Normal);
+ EXTRACT_STRUCT( numFacets, ddRgb8Normal,
+ pFacetList->facets.pFacetRgb8N, ptr);
+ break; }
+
+ case PEXRgb16Colour : {
+ pFacetList->type = DD_FACET_RGB16_NORM;
+ pFacetList->facets.pFacetRgb16N
+ = (ddRgb16Normal *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddRgb16Normal);
+ EXTRACT_STRUCT( numFacets, ddRgb16Normal,
+ pFacetList->facets.pFacetRgb16N, ptr);
+ break; }
+
+ }
+ break; }
+
+ case PEXGANormal : {
+
+ pFacetList->type = DD_FACET_NORM;
+ pFacetList->numFacets = numFacets;
+ pFacetList->facets.pFacetN = (ddVector3D *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddVector3D);
+ EXTRACT_STRUCT( numFacets, ddVector3D, pFacetList->facets.pFacetN,
+ ptr);
+ break; }
+
+ case PEXGAColour : {
+
+ pFacetList->numFacets = numFacets;
+
+ switch (colourType) {
+
+ case PEXIndexedColour: {
+ pFacetList->type = DD_FACET_INDEX;
+ pFacetList->facets.pFacetIndex =
+ (ddIndexedColour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddIndexedColour);
+ EXTRACT_STRUCT( numFacets, ddIndexedColour,
+ pFacetList->facets.pFacetIndex, ptr);
+
+ break; }
+
+ case PEXRgbFloatColour : {
+ pFacetList->type = DD_FACET_RGBFLOAT;
+ pFacetList->facets.pFacetRgbFloat =
+ (ddRgbFloatColour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddRgbFloatColour);
+ EXTRACT_STRUCT( numFacets, ddRgbFloatColour,
+ pFacetList->facets.pFacetRgbFloat, ptr);
+ break; }
+
+ case PEXCieFloatColour : {
+ pFacetList->type = DD_FACET_CIE;
+ pFacetList->facets.pFacetCie = (ddCieColour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddCieColour);
+ EXTRACT_STRUCT( numFacets, ddCieColour,
+ pFacetList->facets.pFacetCie, ptr);
+ break; }
+
+ case PEXHsvFloatColour : {
+ pFacetList->type = DD_FACET_HSV;
+ pFacetList->facets.pFacetHsv = (ddHsvColour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddHsvColour);
+ EXTRACT_STRUCT( numFacets, ddHsvColour,
+ pFacetList->facets.pFacetHsv, ptr);
+ break; }
+
+ case PEXHlsFloatColour : {
+ pFacetList->type = DD_FACET_HLS;
+ pFacetList->facets.pFacetHls = (ddHlsColour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddHlsColour);
+ EXTRACT_STRUCT( numFacets, ddHlsColour,
+ pFacetList->facets.pFacetHls, ptr);
+ break; }
+
+ case PEXRgb8Colour : {
+ pFacetList->type = DD_FACET_RGB8;
+ pFacetList->facets.pFacetRgb8 = (ddRgb8Colour *)pFacetData;
+ EXTRACT_STRUCT( numFacets, ddRgb8Colour,
+ pFacetList->facets.pFacetRgb8, ptr);
+ pFacetList->maxData = numFacets * sizeof(ddRgb8Colour);
+ break; }
+
+ case PEXRgb16Colour : {
+ pFacetList->type = DD_FACET_RGB16;
+ pFacetList->facets.pFacetRgb16 = (ddRgb16Colour *)pFacetData;
+ pFacetList->maxData = numFacets * sizeof(ddRgb16Colour);
+ EXTRACT_STRUCT( numFacets, ddRgb16Colour,
+ pFacetList->facets.pFacetRgb16, ptr);
+ break; }
+
+ }
+ break; }
+
+ case 0x0000 : {
+ /* neither Colour nor Normal specified */
+ pFacetList->numFacets = 0;
+ pFacetList->type = DD_FACET_NONE;
+ pFacetList->facets.pNoFacet = NULL;
+ pFacetList->maxData = 0;
+ break; }
+ }
+
+ *rptr = ptr;
+}
+
+
+/*
+ Returns number of bytes needed to store this vertex data
+ */
+int
+CountVertexData(ptr, colourType, numVertices, vertexMask)
+ddPointer ptr;
+INT16 colourType;
+CARD32 numVertices;
+CARD16 vertexMask;
+{
+ ASSURE(vertexMask <= 7);
+
+ switch (vertexMask) {
+
+ case PEXGAColour | PEXGANormal | PEXGAEdges : {
+
+ switch (colourType) {
+ case PEXIndexedColour:
+ return(numVertices * sizeof(ddIndexNormEdgePoint));
+
+ case PEXRgbFloatColour :
+ return(numVertices * sizeof(ddRgbFloatNormEdgePoint));
+
+ case PEXCieFloatColour :
+ return(numVertices *sizeof(ddCieNormEdgePoint));
+
+ case PEXHsvFloatColour :
+ return(numVertices *sizeof(ddHsvNormEdgePoint));
+
+ case PEXHlsFloatColour :
+ return(numVertices *sizeof(ddHlsNormEdgePoint));
+
+ case PEXRgb8Colour :
+ return(numVertices*sizeof(ddRgb8NormEdgePoint));
+
+ case PEXRgb16Colour :
+ return(numVertices * sizeof(ddRgb16NormEdgePoint));
+
+ default:
+ return(0);
+ }
+ break; }
+
+ case PEXGAColour | PEXGANormal : {
+
+ switch (colourType) {
+ case PEXIndexedColour:
+ return(numVertices* sizeof(ddIndexNormalPoint));
+
+ case PEXRgbFloatColour :
+ return(numVertices * sizeof(ddRgbFloatNormalPoint));
+
+ case PEXCieFloatColour :
+ return(numVertices * sizeof(ddCieNormalPoint));
+
+ case PEXHsvFloatColour :
+ return(numVertices * sizeof(ddHsvNormalPoint));
+
+ case PEXHlsFloatColour :
+ return(numVertices * sizeof(ddHlsNormalPoint));
+
+ case PEXRgb8Colour :
+ return(numVertices * sizeof(ddRgb8NormalPoint));
+
+ case PEXRgb16Colour :
+ return(numVertices * sizeof(ddRgb16NormalPoint));
+
+ default:
+ return(0);
+ }
+ break; }
+
+ case PEXGANormal | PEXGAEdges:
+ return(numVertices * sizeof(ddNormEdgePoint));
+
+ case PEXGANormal :
+ return(numVertices * sizeof(ddNormalPoint));
+
+ case PEXGAEdges :
+ return(numVertices * sizeof(ddEdgePoint));
+
+ case PEXGAColour | PEXGAEdges : {
+
+ switch (colourType) {
+ case PEXIndexedColour:
+ return(numVertices * sizeof(ddIndexEdgePoint));
+
+ case PEXRgbFloatColour :
+ return(numVertices*sizeof(ddRgbFloatEdgePoint));
+
+ case PEXCieFloatColour :
+ return(numVertices * sizeof(ddCieEdgePoint));
+
+ case PEXHsvFloatColour :
+ return(numVertices * sizeof(ddHsvEdgePoint));
+
+ case PEXHlsFloatColour :
+ return(numVertices * sizeof(ddHlsEdgePoint));
+
+ case PEXRgb8Colour :
+ return(numVertices * sizeof(ddRgb8EdgePoint));
+
+ case PEXRgb16Colour :
+ return(numVertices * sizeof(ddRgb16EdgePoint));
+
+ default:
+ return(0);
+ }
+ break; }
+
+ case PEXGAColour: {
+
+ switch (colourType) {
+ case PEXIndexedColour:
+ return(numVertices * sizeof(ddIndexPoint));
+
+ case PEXRgbFloatColour :
+ return(numVertices * sizeof(ddRgbFloatPoint));
+
+ case PEXCieFloatColour :
+ return(numVertices * sizeof(ddCiePoint));
+
+ case PEXHsvFloatColour :
+ return(numVertices * sizeof(ddHsvPoint));
+
+ case PEXHlsFloatColour :
+ return(numVertices * sizeof(ddHlsPoint));
+
+ case PEXRgb8Colour :
+ return(numVertices * sizeof(ddRgb8Point));
+
+ case PEXRgb16Colour :
+ return(numVertices * sizeof(ddRgb16Point));
+
+ default:
+ return(0);
+ }
+ break; }
+
+ case 0x0000 :
+ /* none of Colour nor Normal nor Edge specified */
+ return(numVertices * sizeof(ddCoord3D));
+
+ default:
+ return(0);
+ }
+
+}
+
+
+/*
+ Parses vertex data into already allocated memory (pVertexData)
+*/
+void
+ParseVertexData(ptr, colourType, numVertices, vertexMask, pVertexList, pVertexData, rtype, rptr)
+ddPointer ptr;
+INT16 colourType;
+CARD32 numVertices;
+CARD16 vertexMask;
+listofddPoint *pVertexList; /* out */
+ddPointer *pVertexData; /* out */
+ddPointType *rtype; /* out */
+ddPointer *rptr; /* out */
+{
+ ASSURE(vertexMask <= 7);
+
+ pVertexList->numPoints = numVertices;
+ switch (vertexMask) {
+
+ case PEXGAColour | PEXGANormal | PEXGAEdges : {
+
+ switch (colourType) {
+ case PEXIndexedColour: {
+ *rtype = DD_INDEX_NORM_EDGE_POINT;
+ pVertexList->pts.pIndexNEpt
+ = (ddIndexNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices* sizeof(ddIndexNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddIndexNormEdgePoint,
+ pVertexList->pts.pIndexNEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddIndexNormEdgePoint);
+ break; }
+
+ case PEXRgbFloatColour : {
+ *rtype = DD_RGBFLOAT_NORM_EDGE_POINT;
+ pVertexList->pts.pRgbFloatNEpt
+ = (ddRgbFloatNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgbFloatNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgbFloatNormEdgePoint,
+ pVertexList->pts.pRgbFloatNEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgbFloatNormEdgePoint);
+ break; }
+
+ case PEXCieFloatColour : {
+ *rtype = DD_CIE_NORM_EDGE_POINT;
+ pVertexList->pts.pCieNEpt = (ddCieNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices *sizeof(ddCieNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddCieNormEdgePoint,
+ pVertexList->pts.pCieNEpt, ptr);
+ pVertexList->maxData = numVertices *sizeof(ddCieNormEdgePoint);
+ break; }
+
+ case PEXHsvFloatColour : {
+ *rtype = DD_HSV_NORM_EDGE_POINT;
+ pVertexList->pts.pHsvNEpt = (ddHsvNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices *sizeof(ddHsvNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddHsvNormEdgePoint,
+ pVertexList->pts.pHsvNEpt, ptr);
+ pVertexList->maxData = numVertices *sizeof(ddHsvNormEdgePoint);
+ break; }
+
+ case PEXHlsFloatColour : {
+ *rtype = DD_HLS_NORM_EDGE_POINT;
+ pVertexList->pts.pHlsNEpt = (ddHlsNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices *sizeof(ddHlsNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddHlsNormEdgePoint,
+ pVertexList->pts.pHlsNEpt, ptr);
+ pVertexList->maxData = numVertices *sizeof(ddHlsNormEdgePoint);
+ break; }
+
+ case PEXRgb8Colour : {
+ *rtype = DD_RGB8_NORM_EDGE_POINT;
+ pVertexList->pts.pRgb8NEpt
+ = (ddRgb8NormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices*sizeof(ddRgb8NormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgb8NormEdgePoint,
+ pVertexList->pts.pRgb8NEpt, ptr);
+ pVertexList->maxData = numVertices*sizeof(ddRgb8NormEdgePoint);
+ break; }
+
+ case PEXRgb16Colour : {
+ *rtype = DD_RGB16_NORM_EDGE_POINT;
+ pVertexList->pts.pRgb16NEpt
+ = (ddRgb16NormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices* sizeof(ddRgb16NormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgb16NormEdgePoint,
+ pVertexList->pts.pRgb16NEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb16NormEdgePoint);
+ break; }
+
+ }
+ break; }
+
+ case PEXGAColour | PEXGANormal : {
+
+ switch (colourType) {
+ case PEXIndexedColour: {
+ *rtype = DD_INDEX_NORM_POINT;
+ pVertexList->pts.pIndexNpt
+ = (ddIndexNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices* sizeof(ddIndexNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddIndexNormalPoint,
+ pVertexList->pts.pIndexNpt, ptr);
+ pVertexList->maxData = numVertices* sizeof(ddIndexNormalPoint);
+ break; }
+
+ case PEXRgbFloatColour : {
+ *rtype = DD_RGBFLOAT_NORM_POINT;
+ pVertexList->pts.pRgbFloatNpt
+ = (ddRgbFloatNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgbFloatNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddRgbFloatNormalPoint,
+ pVertexList->pts.pRgbFloatNpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgbFloatNormalPoint);
+ break; }
+
+ case PEXCieFloatColour : {
+ *rtype = DD_CIE_NORM_POINT;
+ pVertexList->pts.pCieNpt = (ddCieNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddCieNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddCieNormalPoint,
+ pVertexList->pts.pCieNpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddCieNormalPoint);
+ break; }
+
+ case PEXHsvFloatColour : {
+ *rtype = DD_HSV_NORM_POINT;
+ pVertexList->pts.pHsvNpt = (ddHsvNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHsvNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddHsvNormalPoint,
+ pVertexList->pts.pHsvNpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHsvNormalPoint);
+ break; }
+
+ case PEXHlsFloatColour : {
+ *rtype = DD_HLS_NORM_POINT;
+ pVertexList->pts.pHlsNpt = (ddHlsNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHlsNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddHlsNormalPoint,
+ pVertexList->pts.pHlsNpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHlsNormalPoint);
+ break; }
+
+ case PEXRgb8Colour : {
+ *rtype = DD_RGB8_NORM_POINT;
+ pVertexList->pts.pRgb8Npt = (ddRgb8NormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgb8NormalPoint);
+ EXTRACT_STRUCT( numVertices, ddRgb8NormalPoint,
+ pVertexList->pts.pRgb8Npt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb8NormalPoint);
+ break; }
+
+ case PEXRgb16Colour : {
+ *rtype = DD_RGB16_NORM_POINT;
+ pVertexList->pts.pRgb16Npt = (ddRgb16NormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices* sizeof(ddRgb16NormalPoint);
+ EXTRACT_STRUCT( numVertices, ddRgb16NormalPoint,
+ pVertexList->pts.pRgb16Npt, ptr);
+ pVertexList->maxData = numVertices* sizeof(ddRgb16NormalPoint);
+ break; }
+
+ }
+ break; }
+
+ case PEXGANormal | PEXGAEdges: {
+ *rtype = DD_NORM_EDGE_POINT;
+ pVertexList->pts.pNEpt = (ddNormEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddNormEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddNormEdgePoint,
+ pVertexList->pts.pNEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddNormEdgePoint);
+ break; }
+
+ case PEXGANormal : {
+ *rtype = DD_NORM_POINT;
+ pVertexList->pts.pNpt = (ddNormalPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddNormalPoint);
+ EXTRACT_STRUCT( numVertices, ddNormalPoint,
+ pVertexList->pts.pNpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddNormalPoint);
+ break; }
+
+ case PEXGAEdges : {
+ *rtype = DD_EDGE_POINT;
+ pVertexList->pts.pEpt = (ddEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddEdgePoint,
+ pVertexList->pts.pEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddEdgePoint);
+ break; }
+
+ case PEXGAColour | PEXGAEdges : {
+
+ switch (colourType) {
+ case PEXIndexedColour: {
+ *rtype = DD_INDEX_EDGE_POINT;
+ pVertexList->pts.pIndexEpt = (ddIndexEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddIndexEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddIndexEdgePoint,
+ pVertexList->pts.pIndexEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddIndexEdgePoint);
+ break; }
+
+ case PEXRgbFloatColour : {
+ *rtype = DD_RGBFLOAT_EDGE_POINT;
+ pVertexList->pts.pRgbFloatEpt = (ddRgbFloatEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices*sizeof(ddRgbFloatEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgbFloatEdgePoint,
+ pVertexList->pts.pRgbFloatEpt, ptr);
+ pVertexList->maxData = numVertices*sizeof(ddRgbFloatEdgePoint);
+ break; }
+
+ case PEXCieFloatColour : {
+ *rtype = DD_CIE_EDGE_POINT;
+ pVertexList->pts.pCieEpt = (ddCieEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddCieEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddCieEdgePoint,
+ pVertexList->pts.pCieEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddCieEdgePoint);
+ break; }
+
+ case PEXHsvFloatColour : {
+ *rtype = DD_HSV_EDGE_POINT;
+ pVertexList->pts.pHsvEpt = (ddHsvEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHsvEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddHsvEdgePoint,
+ pVertexList->pts.pHsvEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHsvEdgePoint);
+ break; }
+
+ case PEXHlsFloatColour : {
+ *rtype = DD_HLS_EDGE_POINT;
+ pVertexList->pts.pHlsEpt = (ddHlsEdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHlsEdgePoint);
+ EXTRACT_STRUCT( numVertices, ddHlsEdgePoint,
+ pVertexList->pts.pHlsEpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHlsEdgePoint);
+ break; }
+
+ case PEXRgb8Colour : {
+ *rtype = DD_RGB8_EDGE_POINT;
+ pVertexList->pts.pRgb8Ept = (ddRgb8EdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgb8EdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgb8EdgePoint,
+ pVertexList->pts.pRgb8Ept, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb8EdgePoint);
+ break; }
+
+ case PEXRgb16Colour : {
+ *rtype = DD_RGB16_EDGE_POINT;
+ pVertexList->pts.pRgb16Ept = (ddRgb16EdgePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgb16EdgePoint);
+ EXTRACT_STRUCT( numVertices, ddRgb16EdgePoint,
+ pVertexList->pts.pRgb16Ept, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb16EdgePoint);
+ break; }
+
+ }
+ break; }
+
+ case PEXGAColour: {
+
+ switch (colourType) {
+ case PEXIndexedColour: {
+ *rtype = DD_INDEX_POINT;
+ pVertexList->pts.pIndexpt = (ddIndexPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddIndexPoint);
+ EXTRACT_STRUCT( numVertices, ddIndexPoint,
+ pVertexList->pts.pIndexpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddIndexPoint);
+ break; }
+
+ case PEXRgbFloatColour : {
+ *rtype = DD_RGBFLOAT_POINT;
+ pVertexList->pts.pRgbFloatpt = (ddRgbFloatPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgbFloatPoint);
+ EXTRACT_STRUCT( numVertices, ddRgbFloatPoint,
+ pVertexList->pts.pRgbFloatpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgbFloatPoint);
+ break; }
+
+ case PEXCieFloatColour : {
+ *rtype = DD_CIE_POINT;
+ pVertexList->pts.pCiept = (ddCiePoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddCiePoint);
+ EXTRACT_STRUCT( numVertices, ddCiePoint,
+ pVertexList->pts.pCiept, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddCiePoint);
+ break; }
+
+ case PEXHsvFloatColour : {
+ *rtype = DD_HSV_POINT;
+ pVertexList->pts.pHsvpt = (ddHsvPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHsvPoint);
+ EXTRACT_STRUCT( numVertices, ddHsvPoint,
+ pVertexList->pts.pHsvpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHsvPoint);
+ break; }
+
+ case PEXHlsFloatColour : {
+ *rtype = DD_HLS_POINT;
+ pVertexList->pts.pHlspt = (ddHlsPoint *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddHlsPoint);
+ EXTRACT_STRUCT( numVertices, ddHlsPoint,
+ pVertexList->pts.pHlspt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddHlsPoint);
+ break; }
+
+ case PEXRgb8Colour : {
+ *rtype = DD_RGB8_POINT;
+ pVertexList->pts.pRgb8pt = (ddRgb8Point *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgb8Point);
+ EXTRACT_STRUCT( numVertices, ddRgb8Point,
+ pVertexList->pts.pRgb8pt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb8Point);
+ break; }
+
+ case PEXRgb16Colour : {
+ *rtype = DD_RGB16_POINT;
+ pVertexList->pts.pRgb16pt = (ddRgb16Point *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddRgb16Point);
+ EXTRACT_STRUCT( numVertices, ddRgb16Point,
+ pVertexList->pts.pRgb16pt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddRgb16Point);
+ break; }
+
+ }
+ break; }
+
+ case 0x0000 : {
+ /* none of Colour nor Normal nor Edge specified */
+ *rtype = DD_3D_POINT;
+ pVertexList->pts.p3Dpt = (ddCoord3D *)(*pVertexData);
+ (*pVertexData) += numVertices * sizeof(ddCoord3D);
+ EXTRACT_STRUCT( numVertices, ddCoord3D, pVertexList->pts.p3Dpt, ptr);
+ pVertexList->maxData = numVertices * sizeof(ddCoord3D);
+ break; }
+ }
+
+ *rptr = ptr;
+
+}
+
+
+OC_PARSER_FUNC_HEADER(ColourOC)
+{
+ CARD16 colourType;
+ miColourStruct *ddColour;
+ PARSER_PTR(ptr);
+
+ EXTRACT_CARD16(colourType,ptr);/*temp since we haven't alloc'd ddColour yet*/
+ SKIP_PADDING(ptr,2);
+ switch (colourType) {
+
+ case PEXIndexedColour: {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddIndexedColour)))
+ ddColour->colour.pIndex = (ddIndexedColour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddIndexedColour, ddColour->colour.pIndex, ptr);
+ break; }
+
+ case PEXRgbFloatColour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddRgbFloatColour)));
+ ddColour->colour.pRgbFloat = (ddRgbFloatColour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddRgbFloatColour, ddColour->colour.pRgbFloat, ptr);
+ break; }
+
+ case PEXCieFloatColour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddCieColour)));
+ ddColour->colour.pCie = (ddCieColour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddCieColour, ddColour->colour.pCie, ptr);
+ break; }
+
+ case PEXHsvFloatColour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddHsvColour)));
+ ddColour->colour.pHsv = (ddHsvColour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddHsvColour, ddColour->colour.pHsv, ptr);
+ break; }
+
+ case PEXHlsFloatColour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddHlsColour)));
+ ddColour->colour.pHls = (ddHlsColour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddHlsColour, ddColour->colour.pHls, ptr);
+ break; }
+
+ case PEXRgb8Colour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddRgb8Colour)));
+ ddColour->colour.pRgb8 = (ddRgb8Colour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddRgb8Colour, ddColour->colour.pRgb8, ptr);
+ break; }
+
+ case PEXRgb16Colour : {
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddRgb16Colour)));
+ ddColour->colour.pRgb16 = (ddRgb16Colour *)(ddColour+1);
+ EXTRACT_STRUCT(1, ddRgb16Colour, ddColour->colour.pRgb16, ptr);
+ break; }
+ }
+
+ ddColour->colourType = colourType;
+ OC_PARSER_RETURN(ddColour);
+}
+
+OC_PARSER_FUNC_HEADER(ColourIndexOC)
+{
+ miColourStruct *ddColour;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddColour, miColourStruct,
+ (sizeof(miColourStruct) + sizeof(ddIndexedColour)));
+ ddColour->colour.pIndex = (ddIndexedColour *)(ddColour+1);
+ ddColour->colourType = PEXIndexedColour;
+ EXTRACT_CARD16(ddColour->colour.pIndex->index,ptr);
+
+ OC_PARSER_RETURN(ddColour);
+}
+
+OC_PARSER_FUNC_HEADER(LightState)
+{
+ miLightStateStruct *ddLightState;
+ PARSER_PTR(ptr);
+ ddSHORT enable_count, disable_count;
+ ddSHORT en_count, dis_count;
+ int listSize = 0;
+
+ EXTRACT_CARD16(enable_count, ptr);
+ EXTRACT_CARD16(disable_count, ptr);
+
+ /* must modify counts so they are always even to guarantee
+ * pointer alignment at 4 byte boundary
+ */
+ en_count = MAKE_EVEN(enable_count);
+ dis_count = MAKE_EVEN(disable_count); /* probably unnecessary */
+ listSize = puCountList(DD_INDEX, en_count) + puCountList(DD_INDEX,dis_count);
+ GET_DD_STORAGE( ddLightState,miLightStateStruct,
+ sizeof(miLightStateStruct) + listSize);
+
+ ddLightState->enableList = (listofObj *)(ddLightState + 1);
+ puInitList(ddLightState->enableList, DD_INDEX, en_count);
+ puAddToList(ptr, enable_count, ddLightState->enableList);
+
+ SKIP_PADDING(ptr, (en_count * sizeof(CARD16)) );
+
+ listSize = puCountList(DD_INDEX, en_count);
+ ddLightState->disableList =
+ (listofObj *)(((ddPointer)(ddLightState->enableList)) + listSize);
+ puInitList(ddLightState->disableList, DD_INDEX, dis_count);
+ puAddToList(ptr, disable_count, ddLightState->disableList);
+
+ OC_PARSER_RETURN(ddLightState);
+}
+
+OC_PARSER_FUNC_HEADER(SetMCVolume)
+{
+ miMCVolume_Struct *ddMCV;
+ PARSER_PTR(ptr);
+
+ ddHalfSpace ddHS;
+ INT16 i, count, operator;
+ int listSize = 0;
+ ddFLOAT length;
+
+ EXTRACT_INT16(operator, ptr);
+ EXTRACT_INT16(count, ptr);
+ listSize = puCountList(DD_HALF_SPACE, count);
+ GET_DD_STORAGE( ddMCV, miMCVolume_Struct,
+ sizeof(miMCVolume_Struct) + listSize);
+
+ ddMCV->operator = operator;
+ ddMCV->halfspaces = (listofObj *)(ddMCV + 1);
+ puInitList(ddMCV->halfspaces, DD_HALF_SPACE, count);
+
+ for (i = 0; i < count; i++){
+ EXTRACT_COORD3D(&ddHS.orig_point, ptr);
+ ddHS.orig_point.w = 0.0; /* JSH */
+ ddHS.point.w = 0.5; /* ? */
+ EXTRACT_VECTOR3D(&ddHS.orig_vector, ptr);
+
+ puAddToList(&ddHS, 1, ddMCV->halfspaces);
+ }
+
+ OC_PARSER_RETURN(ddMCV);
+}
+
+OC_PARSER_FUNC_HEADER(SetMCVolume2D)
+{
+
+ miMCVolume_Struct *ddMCV;
+ PARSER_PTR(ptr);
+ ddHalfSpace ddHS;
+ INT16 i, count, operator;
+ int listSize = 0;
+ ddFLOAT length;
+
+ EXTRACT_INT16(operator, ptr);
+ EXTRACT_INT16(count, ptr);
+ listSize = puCountList(DD_HALF_SPACE, count);
+ GET_DD_STORAGE( ddMCV, miMCVolume_Struct,
+ sizeof(miMCVolume_Struct) + listSize);
+
+ ddMCV->operator = operator;
+ ddMCV->halfspaces = (listofObj *)(ddMCV + 1);
+ puInitList(ddMCV->halfspaces, DD_HALF_SPACE, count);
+
+ for (i = 0; i < count; i++){
+ EXTRACT_COORD2D(&ddHS.orig_point, ptr);
+ ddHS.orig_point.z = 0.0;
+ ddHS.orig_point.w = 0.0;
+ ddHS.point.w = 0.5; /* ? */
+ EXTRACT_VECTOR2D(&ddHS.orig_vector, ptr);
+ ddHS.orig_vector.z = 0.0;
+
+ puAddToList(&ddHS, 1, ddMCV->halfspaces);
+ }
+
+ OC_PARSER_RETURN(ddMCV);
+}
+
+OC_PARSER_FUNC_HEADER(Marker)
+{
+ miMarkerStruct *ddMarker;
+ listofddPoint *ddPoint;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexMarker) / sizeof(pexCoord3D);
+ GET_DD_STORAGE( ddMarker, miListHeader, (sizeof(miListHeader) +
+ sizeof(listofddPoint) + numPoints * sizeof(ddCoord3D)));
+ ddPoint = (listofddPoint *)(ddMarker+1);
+ ddMarker->type = DD_3D_POINT;
+ ddMarker->flags = 0;
+ ddMarker->numLists = 1;
+ ddMarker->maxLists = 1;
+ ddMarker->ddList = ddPoint;
+ ddPoint->numPoints = numPoints;
+ ddPoint->pts.p3Dpt = (ddCoord3D *)(ddPoint + 1);
+ EXTRACT_LISTOF_COORD3D(ddPoint->numPoints,ddPoint->pts.p3Dpt,ptr);
+
+ OC_PARSER_RETURN(ddMarker);
+}
+
+
+OC_PARSER_FUNC_HEADER(Marker2D)
+{
+ miMarkerStruct *ddMarker;
+ listofddPoint *ddPoint;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexMarker2D) / sizeof(pexCoord2D);
+ GET_DD_STORAGE( ddMarker, miListHeader, (sizeof(miListHeader) +
+ sizeof(listofddPoint) + numPoints * sizeof(ddCoord2D)));
+ ddPoint = (listofddPoint *)(ddMarker+1);
+ ddMarker->type = DD_2D_POINT;
+ ddMarker->flags = 0;
+ ddMarker->numLists = 1;
+ ddMarker->maxLists = 1;
+ ddMarker->ddList = ddPoint;
+ ddPoint->numPoints = numPoints;
+ ddPoint->pts.p2Dpt = (ddCoord2D *)(ddPoint + 1);
+ EXTRACT_LISTOF_COORD2D(ddPoint->numPoints,ddPoint->pts.p2Dpt,ptr);
+
+ OC_PARSER_RETURN(ddMarker);
+}
+
+
+OC_PARSER_FUNC_HEADER(Text)
+{
+ miTextStruct *ddText;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddText, miTextStruct, sizeof(miTextStruct)
+ + 3 * sizeof(ddCoord3D)
+ + ((pexText *)pPEXOC)->head.length * sizeof(CARD32)
+ - sizeof(pexText));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ ddText->pOrigin = (ddCoord3D *)(ddText + 1);
+ ddText->pDirections = (ddText->pOrigin) + 1;
+ EXTRACT_LISTOF_COORD3D(1, ddText->pOrigin, ptr);
+ EXTRACT_LISTOF_COORD3D(2, ddText->pDirections, ptr);
+ EXTRACT_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ ddText->pText = (pexMonoEncoding *)((ddText->pDirections) + 2);
+ memcpy( (char *)(ddText->pText), (char *)ptr,
+ (int)( sizeof(CARD32) * ((pexText *)pPEXOC)->head.length
+ - sizeof(pexText)));
+
+ OC_PARSER_RETURN(ddText);
+}
+
+
+OC_PARSER_FUNC_HEADER(Text2D)
+{
+ miText2DStruct *ddText;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddText, miText2DStruct, sizeof(miText2DStruct)
+ + sizeof(ddCoord2D)
+ + ((pexText2D *)pPEXOC)->head.length * sizeof(CARD32)
+ - sizeof(pexText2D));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ ddText->pOrigin = (ddCoord2D *)(ddText + 1);
+ EXTRACT_LISTOF_COORD2D(1, ddText->pOrigin, ptr);
+ EXTRACT_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ ddText->pText = (pexMonoEncoding *)((ddText->pOrigin) + 1);
+ memcpy( (char *)(ddText->pText), (char *)ptr,
+ (int)( sizeof(CARD32) * ((pexText2D *)pPEXOC)->head.length
+ - sizeof(pexText2D)));
+
+ OC_PARSER_RETURN(ddText);
+}
+
+
+OC_PARSER_FUNC_HEADER(AnnotationText)
+{
+ miAnnoTextStruct *ddText;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddText, miAnnoTextStruct, sizeof(miAnnoTextStruct)
+ + 2 * sizeof(ddCoord3D)
+ + ((pexAnnotationText *)pPEXOC)->head.length
+ * sizeof(CARD32)
+ - sizeof(pexAnnotationText));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ ddText->pOrigin = (ddCoord3D *)(ddText + 1);
+ ddText->pOffset = (ddText->pOrigin) + 1;
+ EXTRACT_LISTOF_COORD3D(1, ddText->pOrigin, ptr);
+ EXTRACT_LISTOF_COORD3D(1, ddText->pOffset, ptr);
+ EXTRACT_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ ddText->pText = (pexMonoEncoding *)((ddText->pOffset) + 1);
+ memcpy( (char *)(ddText->pText), (char *)ptr,
+ (int)( sizeof(CARD32) * ((pexAnnotationText *)pPEXOC)->head.length
+ - sizeof(pexAnnotationText)));
+
+ OC_PARSER_RETURN(ddText);
+
+}
+
+
+
+
+OC_PARSER_FUNC_HEADER(AnnotationText2D)
+{
+ miAnnoText2DStruct *ddText;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddText, miAnnoText2DStruct, sizeof(miAnnoText2DStruct)
+ + 2 * sizeof(ddCoord2D)
+ + ((pexAnnotationText2D *)pPEXOC)->head.length
+ * sizeof(CARD32)
+ - sizeof(pexAnnotationText2D));
+ /* this also allocates any trailing pads, but so
+ much the better */
+ ddText->pOrigin = (ddCoord2D *)(ddText + 1);
+ ddText->pOffset = (ddText->pOrigin) + 1;
+ EXTRACT_LISTOF_COORD2D(1, ddText->pOrigin, ptr);
+ EXTRACT_LISTOF_COORD2D(1, ddText->pOffset, ptr);
+ EXTRACT_CARD16(ddText->numEncodings, ptr);
+ SKIP_PADDING(ptr, 2);
+ ddText->pText = (pexMonoEncoding *)((ddText->pOffset) + 1);
+ memcpy( (char *)(ddText->pText), (char *)ptr,
+ (int)( sizeof(CARD32) * ((pexAnnotationText2D *)pPEXOC)->head.length
+ - sizeof(pexAnnotationText2D)));
+
+ OC_PARSER_RETURN(ddText);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(Polyline2D)
+{
+ miPolylineStruct *ddPoly;
+ listofddPoint *ddPoint;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexPolyline2D) / sizeof(pexCoord2D);
+ GET_DD_STORAGE( ddPoly, miListHeader, sizeof(miListHeader) +
+ sizeof(listofddPoint) + numPoints * sizeof(ddCoord2D));
+ ddPoint = (listofddPoint *)(ddPoly+1);
+ ddPoly->type = DD_2D_POINT;
+ ddPoly->flags = 0;
+ ddPoly->numLists = 1;
+ ddPoly->maxLists = 1;
+ ddPoly->ddList = ddPoint;
+ ddPoint->numPoints = numPoints;
+ ddPoint->maxData = numPoints * sizeof(ddCoord2D);
+ ddPoint->pts.p2Dpt = (ddCoord2D *)(ddPoint + 1);
+ EXTRACT_LISTOF_COORD2D(ddPoint->numPoints,ddPoint->pts.p2Dpt,ptr);
+
+ OC_PARSER_RETURN(ddPoly);
+
+}
+
+
+
+OC_PARSER_FUNC_HEADER(Polyline)
+{
+ miPolylineStruct *ddPoly;
+ listofddPoint *ddPoint;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexPolyline) / sizeof(pexCoord3D);
+ GET_DD_STORAGE( ddPoly, miListHeader, sizeof(miListHeader) +
+ sizeof(listofddPoint) + numPoints * sizeof(ddCoord3D));
+ ddPoint = (listofddPoint *)(ddPoly+1);
+ ddPoly->type = DD_3D_POINT;
+ ddPoly->flags = 0;
+ ddPoly->numLists = 1;
+ ddPoly->maxLists = 1;
+ ddPoly->ddList = ddPoint;
+ ddPoint->numPoints = numPoints;
+ ddPoint->maxData = numPoints * sizeof(ddCoord3D);
+ ddPoint->pts.p3Dpt = (ddCoord3D *)(ddPoint + 1);
+ EXTRACT_LISTOF_COORD3D(ddPoint->numPoints,ddPoint->pts.p3Dpt,ptr);
+
+ OC_PARSER_RETURN(ddPoly);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(PolylineSet)
+{
+ miPolylineStruct *ddPoly;
+ listofddPoint *ddPoint;
+ pexPolylineSet *pPoly = (pexPolylineSet *)pPEXOC;
+ PARSER_PTR(ptr);
+ ddULONG i;
+ CARD32 numPoints;
+ int vertexSize = 0;
+ ddPointer vertexPtr = 0;
+ ddPointer rptr = 0;
+ ddpex2rtn err = Success;
+
+ ptr = (ddPointer)(pPoly+1);
+ for (i=0; i<pPoly->numLists; i++) {
+ EXTRACT_CARD32(numPoints, ptr);
+ ptr += CountVertexData( ptr, pPoly->colourType, numPoints,
+ pPoly->vertexAttribs); }
+
+ vertexSize = ptr - (ddPointer)(pPoly+1) -
+ pPoly->numLists * sizeof(CARD32);
+
+ GET_DD_STORAGE( ddPoly, miListHeader,
+ (sizeof(miListHeader) + vertexSize
+ + pPoly->numLists * sizeof(listofddPoint)));
+ ddPoly->numLists = (ddULONG)(pPoly->numLists);
+ ddPoly->maxLists = ddPoly->numLists;
+ ddPoly->flags = 0;
+ ddPoly->ddList = (listofddPoint *)(ddPoly+1);
+ ptr = (ddPointer)(pPoly+1);
+
+ for (i=0, ddPoint = (listofddPoint *)(ddPoly+1),
+ vertexPtr = (ddPointer)(ddPoly->ddList + ddPoly->numLists);
+ i<ddPoly->numLists;
+ i++, ddPoint++) {
+
+ EXTRACT_CARD32(numPoints, ptr);
+ ParseVertexData( ptr, pPoly->colourType, numPoints,
+ pPoly->vertexAttribs, ddPoint,
+ &vertexPtr, &(ddPoly->type), &rptr);
+ ptr = rptr;
+ }
+
+ OC_PARSER_RETURN(ddPoly);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(NurbCurve)
+{
+ miNurbStruct *ddNurb;
+ pexNurbCurve *pNurb = (pexNurbCurve *)pPEXOC;
+ ddUSHORT pointSize = 0;
+ PARSER_PTR(ptr);
+
+
+ pointSize = ((pNurb->coordType == PEXRational)
+ ? sizeof(ddCoord4D) : sizeof(ddCoord3D));
+ GET_DD_STORAGE( ddNurb, miNurbStruct, (sizeof(miNurbStruct)
+ + sizeof(listofddPoint) + pNurb->numKnots * sizeof(ddFLOAT)
+ + pNurb->numPoints) * pointSize);
+ ddNurb->pKnots = (ddFLOAT *)(ddNurb+1);
+ ddNurb->points.ddList = (listofddPoint *)(ddNurb->pKnots + pNurb->numKnots);
+ EXTRACT_CARD16(ddNurb->order, ptr);
+ SKIP_PADDING(ptr,2); /* place holder for type */
+ EXTRACT_FLOAT(ddNurb->uMin, ptr);
+ EXTRACT_FLOAT(ddNurb->uMax, ptr);
+ EXTRACT_CARD32(ddNurb->numKnots, ptr);
+ EXTRACT_CARD32(ddNurb->points.ddList->numPoints, ptr);
+
+ EXTRACT_STRUCT(ddNurb->numKnots, PEXFLOAT, ddNurb->pKnots, ptr);
+ if (pNurb->coordType == PEXRational) {
+ ddNurb->points.type = DDPT_4D;
+ ddNurb->points.ddList->pts.p4Dpt =
+ (ddCoord4D *)((ddNurb->points.ddList)+1);
+ EXTRACT_STRUCT( ddNurb->points.ddList->numPoints, ddCoord4D,
+ ddNurb->points.ddList->pts.p4Dpt, ptr);
+ } else {
+ ddNurb->points.type = DDPT_3D;
+ ddNurb->points.ddList->pts.p3Dpt =
+ (ddCoord3D *)((ddNurb->points.ddList)+1);
+ EXTRACT_STRUCT( ddNurb->points.ddList->numPoints, ddCoord3D,
+ ddNurb->points.ddList->pts.p3Dpt, ptr);
+ }
+
+ ddNurb->points.numLists = 1;
+ ddNurb->points.maxLists = 1;
+ ddNurb->points.flags = 0;
+
+ OC_PARSER_RETURN(ddNurb);
+}
+
+
+OC_PARSER_FUNC_HEADER(FillArea2D)
+{
+ miFillAreaStruct *ddFill;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexFillArea2D) / sizeof(pexCoord2D);
+ GET_DD_STORAGE( ddFill, miFillAreaStruct, (sizeof(miFillAreaStruct) +
+ sizeof(listofddFacet) + sizeof(listofddPoint)
+ + numPoints * sizeof(ddCoord2D)));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ EXTRACT_CARD16(ddFill->shape, ptr);
+ EXTRACT_CARD8(ddFill->ignoreEdges, ptr);
+ SKIP_PADDING(ptr, 1);
+
+ ddFill->pFacets->type = DD_FACET_NONE;
+ ddFill->pFacets->numFacets = 0;
+ ddFill->pFacets->facets.pNoFacet = NULL;
+ ddFill->contourHint = 0;
+
+ ddFill->points.type = DD_2D_POINT;
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = 1;
+ ddFill->points.maxLists = 1;
+ ddFill->points.ddList->numPoints = numPoints;
+ ddFill->points.ddList->pts.p2Dpt = (ddCoord2D *)((ddFill->points.ddList) +1);
+ EXTRACT_LISTOF_COORD2D( ddFill->points.ddList->numPoints,
+ ddFill->points.ddList->pts.p2Dpt,ptr);
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+
+
+OC_PARSER_FUNC_HEADER(FillArea)
+{
+ miFillAreaStruct *ddFill;
+ ddULONG numPoints;
+ PARSER_PTR(ptr);
+
+ numPoints = LEN_WO_HEADER(pexFillArea) / sizeof(pexCoord3D);
+ GET_DD_STORAGE( ddFill, miFillAreaStruct, (sizeof(miFillAreaStruct) +
+ sizeof(listofddFacet) + sizeof(listofddPoint)
+ + numPoints * sizeof(ddCoord3D)));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ EXTRACT_CARD16(ddFill->shape, ptr);
+ EXTRACT_CARD8(ddFill->ignoreEdges, ptr);
+ SKIP_PADDING(ptr, 1);
+ ddFill->contourHint = 0;
+
+ ddFill->pFacets->type = DD_FACET_NONE;
+ ddFill->pFacets->numFacets = 0;
+ ddFill->pFacets->facets.pNoFacet = NULL;
+
+ ddFill->points.type = DD_3D_POINT;
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = 1;
+ ddFill->points.maxLists = 1;
+ ddFill->points.ddList->numPoints = numPoints;
+ ddFill->points.ddList->pts.p3Dpt = (ddCoord3D *)((ddFill->points.ddList) +1);
+ EXTRACT_LISTOF_COORD3D( ddFill->points.ddList->numPoints,
+ ddFill->points.ddList->pts.p3Dpt,ptr);
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+OC_PARSER_FUNC_HEADER(ExtFillArea)
+{
+ miFillAreaStruct *ddFill;
+ pexExtFillArea *pFill = (pexExtFillArea *)pPEXOC;
+ PARSER_PTR(ptr);
+ ddPointer rptr = 0;
+ ddPointer facetPtr = 0;
+ int facetSize = 0;
+ ddPointer vertexPtr = 0;
+ int vertexSize = 0;
+ ddpex2rtn err = Success;
+ CARD32 totalVertices;
+
+ ptr = (ddPointer)(pFill+1);
+ facetSize = CountFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)1, pFill->facetAttribs);
+
+ ptr += facetSize; /* this works because dd types == protocol types */
+ EXTRACT_CARD32(totalVertices, ptr);
+ vertexSize = CountVertexData( ptr, pFill->colourType, totalVertices,
+ pFill->vertexAttribs);
+ GET_DD_STORAGE( ddFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + sizeof(listofddPoint) + facetSize + vertexSize));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ ddFill->shape = pFill->shape;
+ ddFill->ignoreEdges = pFill->ignoreEdges;
+ ddFill->contourHint = 0;
+ ddFill->points.numLists = 1;
+ ddFill->points.maxLists = 1;
+ ddFill->points.flags = 0;
+
+ ptr = (ddPointer)(pFill+1);
+ facetPtr = (ddPointer)(ddFill->points.ddList + 1);
+ ParseFacetOptData( ptr, (CARD16)(pFill->colourType), (CARD32)1,
+ pFill->facetAttribs, ddFill->pFacets,
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ ParseVertexData( ptr, pFill->colourType, totalVertices,
+ pFill->vertexAttribs, ddFill->points.ddList,
+ &vertexPtr, &(ddFill->points.type), &rptr);
+ ptr = rptr;
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+OC_PARSER_FUNC_HEADER(FillAreaSet2D)
+{
+ miFillAreaStruct *ddFill;
+ PARSER_PTR(ptr);
+ ddULONG i;
+ int listSize = 0, numPoints = 0;
+ listofddPoint *ddPoint;
+ ddPointer ddPtr;
+ pexFillAreaSet2D *pFill = (pexFillAreaSet2D *)pPEXOC;
+
+ ptr = (ddPointer)(pFill+1);
+ for (i=0; i<pFill->numLists; i++) {
+ EXTRACT_CARD32( numPoints, ptr);
+ listSize += numPoints * sizeof(ddCoord2D);
+ ptr += numPoints * sizeof(ddCoord2D); }
+
+ GET_DD_STORAGE( ddFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + (pFill->numLists * sizeof(listofddPoint))
+ + listSize ));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ ddFill->shape = pFill->shape;
+ ddFill->ignoreEdges = pFill->ignoreEdges;
+ ddFill->contourHint = pFill->contourHint;
+
+ ddFill->pFacets->type = DD_FACET_NONE;
+ ddFill->pFacets->numFacets = 0;
+ ddFill->pFacets->facets.pNoFacet = NULL;
+
+ ddFill->points.type = DD_2D_POINT;
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = pFill->numLists;
+ ddFill->points.maxLists = ddFill->points.numLists;
+
+ ptr = (ddPointer)(pFill+1);
+ for (i=0, ddPoint = ddFill->points.ddList,
+ ddPtr = (ddPointer)(ddFill->points.ddList + ddFill->points.numLists);
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+ EXTRACT_CARD32( ddPoint->numPoints, ptr);
+ ddPoint->pts.p2Dpt = (ddCoord2D *)ddPtr;
+ ddPtr += ddPoint->numPoints * sizeof(ddCoord2D);
+ EXTRACT_STRUCT( ddPoint->numPoints, ddCoord2D,
+ ddPoint->pts.p2Dpt, ptr);
+ }
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+OC_PARSER_FUNC_HEADER(FillAreaSet)
+{
+ miFillAreaStruct *ddFill;
+ PARSER_PTR(ptr);
+ ddULONG i;
+ int listSize = 0, numPoints = 0;
+ listofddPoint *ddPoint;
+ ddPointer ddPtr;
+ pexFillAreaSet *pFill = (pexFillAreaSet *)pPEXOC;
+
+ ptr = (ddPointer)(pFill+1);
+ for (i=0; i<pFill->numLists; i++) {
+ EXTRACT_CARD32( numPoints, ptr);
+ listSize += numPoints * sizeof(ddCoord3D);
+ ptr += numPoints * sizeof(ddCoord3D); }
+
+ GET_DD_STORAGE( ddFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct)
+ + sizeof(listofddFacet)
+ + (pFill->numLists * sizeof(listofddPoint))
+ + listSize ));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ ddFill->shape = pFill->shape;
+ ddFill->ignoreEdges = pFill->ignoreEdges;
+ ddFill->contourHint = pFill->contourHint;
+
+ ddFill->pFacets->type = DD_FACET_NONE;
+ ddFill->pFacets->numFacets = 0;
+ ddFill->pFacets->facets.pNoFacet = NULL;
+
+ ddFill->points.type = DD_3D_POINT;
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = pFill->numLists;
+ ddFill->points.maxLists = ddFill->points.numLists;
+
+ ptr = (ddPointer)(pFill+1);
+ for (i=0, ddPoint = ddFill->points.ddList,
+ ddPtr = (ddPointer)(ddFill->points.ddList + ddFill->points.numLists);
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+ EXTRACT_CARD32( ddPoint->numPoints, ptr);
+ ddPoint->pts.p3Dpt = (ddCoord3D *)ddPtr;
+ ddPtr += ddPoint->numPoints * sizeof(ddCoord3D);
+ EXTRACT_STRUCT( ddPoint->numPoints, ddCoord3D,
+ ddPoint->pts.p3Dpt, ptr);
+ }
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+OC_PARSER_FUNC_HEADER(ExtFillAreaSet)
+{
+ miFillAreaStruct *ddFill;
+ PARSER_PTR(ptr);
+ ddULONG i;
+ ddULONG numPoints;
+ listofddPoint *ddPoint;
+ pexExtFillAreaSet *pFill = (pexExtFillAreaSet *)(pPEXOC);
+ ddPointer rptr = 0;
+ ddPointer facetPtr = 0;
+ int facetSize = 0;
+ ddPointer vertexPtr = 0;
+ int vertexSize = 0;
+ ddpex2rtn err = Success;
+
+ ptr = (ddPointer)(pFill+1);
+ facetSize = CountFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)1, pFill->facetAttribs);
+ ptr += facetSize; /* this works because dd types == protocol types */
+ for (i=0; i<pFill->numLists; i++) {
+ EXTRACT_CARD32( numPoints, ptr);
+ ptr += CountVertexData( ptr, pFill->colourType, numPoints,
+ pFill->vertexAttribs); }
+
+ vertexSize = ptr - (ddPointer)(pFill+1) - facetSize;
+ GET_DD_STORAGE( ddFill, miFillAreaStruct,
+ (sizeof(miFillAreaStruct) + sizeof(listofddFacet)
+ + (pFill->numLists * sizeof(listofddPoint)
+ + facetSize + vertexSize)));
+ ddFill->pFacets = (listofddFacet *)(ddFill+1);
+ ddFill->points.ddList = (listofddPoint *)((ddFill->pFacets)+1);
+ ddFill->shape = pFill->shape;
+ ddFill->ignoreEdges = pFill->ignoreEdges;
+ ddFill->contourHint = pFill->contourHint;
+ ddFill->points.numLists = (ddULONG)(pFill->numLists);
+ ddFill->points.maxLists = ddFill->points.numLists;
+ ddFill->points.flags = 0;
+ ptr = (ddPointer)(pFill+1);
+
+ facetPtr = (ddPointer)(ddFill->points.ddList + pFill->numLists);
+ ParseFacetOptData( ptr, (CARD16)(pFill->colourType), (CARD32)1,
+ pFill->facetAttribs, ddFill->pFacets,
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ for (i=0, ddPoint = ddFill->points.ddList;
+ i<ddFill->points.numLists;
+ i++, ddPoint++) {
+
+ EXTRACT_CARD32( numPoints, ptr);
+ ParseVertexData( ptr, pFill->colourType, numPoints,
+ pFill->vertexAttribs, ddPoint, &vertexPtr,
+ &(ddFill->points.type), &rptr);
+ ptr = rptr;
+ }
+
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+OC_PARSER_FUNC_HEADER(SOFAS)
+{
+ miSOFASStruct *ddFill;
+ pexSOFAS *pFill = (pexSOFAS *)pPEXOC;
+ PARSER_PTR(ptr);
+ CARD16 i,j,k;
+ miConnListList *pCLL;
+ miConnList *pCList;
+ ddPointer rptr = 0;
+ ddpex2rtn err = Success;
+ ddPointer facetPtr = 0;
+ ddPointer vertexPtr = 0;
+ int facetSize = 0;
+ int vertexSize = 0;
+ int edgeSize = 0;
+ extern void destroySOFAS();
+
+ facetSize = CountFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)(pFill->numFAS),
+ pFill->FAS_Attributes);
+ vertexSize = CountVertexData( ptr, pFill->colourType,
+ (CARD32)(pFill->numVertices),
+ pFill->vertexAttributes);
+ if (pFill->edgeAttributes) {
+ edgeSize = pFill->numEdges * sizeof(ddUCHAR);
+ edgeSize += ((4 - (edgeSize & 3)) & 3); /* force lword alignment for
+ connects data */
+ }
+
+ GET_DD_STORAGE( ddFill, miSOFASStruct, (sizeof(miSOFASStruct) +
+ sizeof(listofddPoint) +
+ facetSize + vertexSize + edgeSize +
+ (pFill->numFAS * sizeof(miConnListList))));
+ EXTRACT_CARD16(ddFill->shape, ptr);
+ ddFill->contourHint = pFill->contourHint;
+ ddFill->contourCountsFlag = pFill->contourCountsFlag;
+ ddFill->numFAS = pFill->numFAS;
+ ddFill->numEdges = pFill->numEdges;
+ ptr = (ddPointer)(pFill+1);
+ ddFill->points.ddList = (listofddPoint *)(ddFill + 1);
+ ddFill->points.flags = 0;
+ ddFill->points.numLists = 1;
+ ddFill->points.maxLists = 1;
+
+ facetPtr = (ddPointer)(ddFill->points.ddList + 1);
+ ParseFacetOptData( ptr, (CARD16)(pFill->colourType),
+ (CARD32)(pFill->numFAS),
+ pFill->FAS_Attributes, &(ddFill->pFacets),
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ ParseVertexData( ptr, pFill->colourType, (CARD32)(pFill->numVertices),
+ pFill->vertexAttributes, ddFill->points.ddList,
+ &vertexPtr, &(ddFill->points.type), &rptr);
+ ptr = rptr;
+
+ ddFill->edgeAttribs = pFill->edgeAttributes;
+ if (pFill->edgeAttributes){
+ ddFill->edgeData = (ddUCHAR *)vertexPtr;
+ EXTRACT_STRUCT(ddFill->numEdges, ddUCHAR, ddFill->edgeData, ptr);
+ SKIP_PADDING( ptr, ((4 - (ddFill->numEdges & 3)) & 3) );
+ }
+ else { ddFill->edgeData = 0; }
+ vertexPtr += edgeSize;
+
+ ddFill->connects.numListLists = pFill->numFAS;
+ ddFill->connects.data = (miConnListList *)vertexPtr;
+ ddFill->connects.maxData = ddFill->numFAS * sizeof(miConnListList);
+ for (i=0, pCLL = ddFill->connects.data; i<pFill->numFAS; i++, pCLL++) {
+ EXTRACT_CARD16(pCLL->numLists,ptr);
+ GET_MORE_STORAGE( pCLL->pConnLists, miConnList,
+ pCLL->numLists * sizeof(miConnList));
+ if (err) {
+ destroySOFAS(ddFill);
+ return(BadAlloc);
+ }
+ pCLL->maxData = pCLL->numLists * sizeof(miConnList);
+ for (j=0, pCList=pCLL->pConnLists; j<pCLL->numLists; j++, pCList++) {
+ EXTRACT_CARD16(pCList->numLists,ptr);
+ GET_MORE_STORAGE( pCList->pConnects, ddUSHORT,
+ pCList->numLists * sizeof(ddUSHORT));
+ if (err) {
+ destroySOFAS(ddFill);
+ return(BadAlloc);
+ }
+ EXTRACT_STRUCT(pCList->numLists, ddUSHORT, pCList->pConnects, ptr);
+ pCList->maxData = pCList->numLists * sizeof(ddUSHORT);
+ }
+ }
+
+ OC_PARSER_RETURN(ddFill);
+}
+
+
+
+OC_PARSER_FUNC_HEADER(TriangleStrip)
+{
+ miTriangleStripStruct *ddTriangle;
+ PARSER_PTR(ptr);
+ pexTriangleStrip *pTriangle = (pexTriangleStrip *)pPEXOC;
+ ddPointer rptr = 0;
+ ddpex2rtn err = Success;
+ ddPointer facetPtr = 0;
+ int facetSize = 0;
+ ddPointer vertexPtr = 0;
+ int vertexSize = 0;
+
+ facetSize = CountFacetOptData( ptr, (CARD16)(pTriangle->colourType),
+ (CARD32)(pTriangle->numVertices - 2),
+ pTriangle->facetAttribs);
+ vertexSize = CountVertexData( ptr, pTriangle->colourType,
+ pTriangle->numVertices,
+ pTriangle->vertexAttribs);
+ GET_DD_STORAGE( ddTriangle, miTriangleStripStruct,
+ (sizeof(miTriangleStripStruct) + sizeof(listofddFacet)
+ + sizeof(listofddPoint) + facetSize + vertexSize));
+ ddTriangle->pFacets = (listofddFacet *)(ddTriangle+1);
+ ddTriangle->points.numLists = 1;
+ ddTriangle->points.maxLists = 1;
+ ddTriangle->points.ddList = (listofddPoint *)((ddTriangle->pFacets)+1);
+ ptr = (ddPointer)(pTriangle +1);
+
+ facetPtr = (ddPointer)(ddTriangle->points.ddList + 1);
+ ParseFacetOptData( ptr, (CARD16)(pTriangle->colourType),
+ (pTriangle->numVertices - 2),
+ pTriangle->facetAttribs, ddTriangle->pFacets,
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ ParseVertexData( ptr, pTriangle->colourType, pTriangle->numVertices,
+ pTriangle->vertexAttribs, ddTriangle->points.ddList,
+ &vertexPtr, &(ddTriangle->points.type), &rptr);
+ ptr = rptr;
+
+ OC_PARSER_RETURN(ddTriangle);
+}
+
+
+OC_PARSER_FUNC_HEADER(QuadrilateralMesh)
+{
+ miQuadMeshStruct *ddQuad;
+ PARSER_PTR(ptr);
+ pexQuadrilateralMesh *pQuad = (pexQuadrilateralMesh *)pPEXOC;
+ ddPointer rptr = 0;
+ ddpex2rtn err = Success;
+ ddPointer facetPtr = 0;
+ int facetSize = 0;
+ ddPointer vertexPtr = 0;
+ int vertexSize = 0;
+
+ facetSize = CountFacetOptData( ptr, (CARD16)(pQuad->colourType),
+ (CARD32)((pQuad->mPts-1)*(pQuad->nPts-1)),
+ pQuad->facetAttribs);
+ vertexSize = CountVertexData( ptr, pQuad->colourType,
+ (CARD32)(pQuad->mPts * pQuad->nPts),
+ pQuad->vertexAttribs);
+ GET_DD_STORAGE( ddQuad, miQuadMeshStruct,
+ (sizeof(miQuadMeshStruct) + facetSize + vertexSize
+ + sizeof(listofddFacet) + sizeof(listofddPoint)));
+ ddQuad->pFacets = (listofddFacet *)(ddQuad+1);
+ ddQuad->points.numLists = 1;
+ ddQuad->points.maxLists = 1;
+ ddQuad->points.ddList = (listofddPoint *)((ddQuad->pFacets)+1);
+ ddQuad->mPts = pQuad->mPts;
+ ddQuad->nPts = pQuad->nPts;
+ ddQuad->shape = (ddUSHORT)(pQuad->shape);
+ ptr = (ddPointer)(pQuad+1);
+
+ /** Now we should be at the head of the opt data **/
+ facetPtr = (ddPointer)(ddQuad->points.ddList + 1);
+ ParseFacetOptData( ptr, (CARD16)(pQuad->colourType),
+ (CARD32)((pQuad->mPts-1)*(pQuad->nPts-1)),
+ pQuad->facetAttribs, ddQuad->pFacets,
+ facetPtr, &rptr);
+ ptr = rptr;
+
+ vertexPtr = facetPtr + facetSize;
+ ParseVertexData( ptr, pQuad->colourType,
+ (CARD32)(pQuad->mPts*pQuad->nPts),
+ pQuad->vertexAttribs, ddQuad->points.ddList,
+ &vertexPtr, &(ddQuad->points.type), &rptr);
+ ptr = rptr;
+
+ OC_PARSER_RETURN(ddQuad);
+}
+
+
+OC_PARSER_FUNC_HEADER(NurbSurface)
+{
+ miNurbSurfaceStruct *ddNurb;
+ PARSER_PTR(ptr);
+ pexNurbSurface *pNurb = (pexNurbSurface *)pPEXOC;
+ ddULONG i, j;
+ listofTrimCurve *ddTrim;
+ ddTrimCurve *ddtc;
+ ddUSHORT type;
+ ddpex2rtn err = Success;
+
+ GET_DD_STORAGE(ddNurb, miNurbSurfaceStruct, (sizeof(miNurbSurfaceStruct)
+ + (pNurb->numUknots * pNurb->numVknots) * (sizeof(ddFLOAT))
+ + (sizeof(listofddPoint))
+ + pNurb->mPts * pNurb->nPts * sizeof(ddCoord4D)
+ + (sizeof(listofTrimCurve))
+ + pNurb->numLists * sizeof(ddTrimCurve)));
+
+ ddNurb->pUknots = (ddFLOAT *)(ddNurb+1);
+ ddNurb->pVknots = (ddFLOAT *)((ddNurb->pUknots) + pNurb->numUknots);
+ ddNurb->points.ddList =
+ (listofddPoint *)((ddNurb->pVknots) + pNurb->numVknots);
+ ddNurb->points.ddList->pts.ptr = (char *)(ddNurb->points.ddList + 1);
+ ddNurb->trimCurves =
+ (listofTrimCurve *)((ddNurb->points.ddList->pts.ptr)
+ + (pNurb->mPts * pNurb->nPts) * sizeof(ddCoord4D));
+
+ SKIP_PADDING(ptr, 2); /* place holder for type */
+ EXTRACT_CARD16(ddNurb->uOrder, ptr);
+ EXTRACT_CARD16(ddNurb->vOrder, ptr);
+ SKIP_PADDING(ptr, 2);
+ EXTRACT_CARD32(ddNurb->numUknots, ptr);
+ EXTRACT_CARD32(ddNurb->numVknots, ptr);
+ EXTRACT_CARD16(ddNurb->mPts, ptr);
+ EXTRACT_CARD16(ddNurb->nPts, ptr);
+ EXTRACT_CARD32(ddNurb->numTrimCurveLists, ptr); /* is pNurb->numLists */
+
+ EXTRACT_STRUCT(ddNurb->numUknots, PEXFLOAT, ddNurb->pUknots, ptr);
+ EXTRACT_STRUCT(ddNurb->numVknots, PEXFLOAT, ddNurb->pVknots, ptr);
+
+ ddNurb->points.numLists = 1;
+ ddNurb->points.maxLists = 1;
+ ddNurb->points.ddList->numPoints = ddNurb->mPts * ddNurb->nPts;
+ if (pNurb->type == PEXRational) {
+ ddNurb->points.type = DD_HOMOGENOUS_POINT;
+ EXTRACT_STRUCT( ddNurb->points.ddList->numPoints, ddCoord4D,
+ ddNurb->points.ddList->pts.p4Dpt, ptr);
+ } else {
+ ddNurb->points.type = DD_3D_POINT;
+ EXTRACT_STRUCT( ddNurb->points.ddList->numPoints, ddCoord3D,
+ ddNurb->points.ddList->pts.p3Dpt, ptr);
+ }
+
+ for ( i=0, ddTrim = ddNurb->trimCurves;
+ i<ddNurb->numTrimCurveLists;
+ i++, ddTrim++) {
+ EXTRACT_CARD32(ddTrim->count, ptr);
+ GET_MORE_STORAGE( ddTrim->pTC, ddTrimCurve,
+ ddTrim->count*sizeof(ddTrimCurve));
+ if (err) {
+ destroyNurbSurface(ddNurb);
+ return (BadAlloc);
+ }
+
+ for ( j=0, ddtc = ddTrim->pTC;
+ j < ddTrim->count;
+ j++, ddtc++) {
+ EXTRACT_CARD8(ddtc->visibility, ptr);
+ SKIP_PADDING(ptr, 1);
+ EXTRACT_CARD16(ddtc->order, ptr);
+ EXTRACT_CARD16(type, ptr);
+ EXTRACT_CARD16(ddtc->curveApprox.approxMethod, ptr);
+ EXTRACT_FLOAT(ddtc->curveApprox.tolerance, ptr);
+ EXTRACT_FLOAT(ddtc->uMin, ptr);
+ EXTRACT_FLOAT(ddtc->uMax, ptr);
+ EXTRACT_CARD32(ddtc->numKnots, ptr);
+ EXTRACT_CARD32(ddtc->points.numPoints, ptr);
+ GET_MORE_STORAGE( ddtc->pKnots, ddFLOAT,
+ sizeof(ddFLOAT) * ddtc->numKnots );
+ if (err) {
+ ddtc->points.pts.ptr = 0;
+ destroyNurbSurface(ddNurb);
+ return(BadAlloc);
+ }
+ EXTRACT_STRUCT( ddtc->numKnots, PEXFLOAT, ddtc->pKnots, ptr);
+ if (type == PEXRational) {
+ /* Note this only works because these points are never
+ transformed */
+ ddtc->pttype = DD_3D_POINT;
+ ddtc->points.pts.p3Dpt = 0;
+ GET_MORE_STORAGE( ddtc->points.pts.p3Dpt, ddCoord3D,
+ sizeof(ddCoord3D)*ddtc->points.numPoints);
+ EXTRACT_STRUCT( ddtc->points.numPoints, ddCoord3D,
+ ddtc->points.pts.p3Dpt, ptr);
+ } else {
+ ddtc->pttype = DD_2D_POINT;
+ ddtc->points.pts.p2Dpt = 0;
+ GET_MORE_STORAGE( ddtc->points.pts.p2Dpt, ddCoord2D,
+ sizeof(ddCoord2D)*ddtc->points.numPoints );
+ EXTRACT_STRUCT( ddtc->points.numPoints, ddCoord2D,
+ ddtc->points.pts.p2Dpt, ptr);
+ }
+ if (err) {
+ destroyNurbSurface(ddNurb);
+ return(BadAlloc);
+ }
+ }
+ }
+
+ OC_PARSER_RETURN(ddNurb);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(CellArray2D)
+{
+ miCellArrayStruct *ddCell;
+ PARSER_PTR(ptr);
+ pexCellArray2D *pCell = (pexCellArray2D *)pPEXOC;
+
+ GET_DD_STORAGE( ddCell, miCellArrayStruct, sizeof(miCellArrayStruct)
+ + sizeof(listofddPoint) + 2 * sizeof(ddCoord2D)
+ + pCell->dx * pCell->dy * sizeof(ddIndexedColour));
+ ddCell->point.ddList = (listofddPoint *)(ddCell+1);
+
+ ddCell->point.type = DD_2D_POINT;
+ ddCell->point.numLists = 1;
+ ddCell->point.maxLists = 1;
+ ddCell->point.ddList->numPoints = 2;
+ ddCell->point.ddList->pts.p2Dpt =
+ (ddCoord2D *)((ddCell->point.ddList) + 1);
+ EXTRACT_LISTOF_COORD2D(2, ddCell->point.ddList->pts.p2Dpt, ptr);
+
+ EXTRACT_CARD32(ddCell->dx, ptr);
+ EXTRACT_CARD32(ddCell->dy, ptr);
+ ddCell->colours.colour.pIndex =
+ (ddIndexedColour *)((ddCell->point.ddList->pts.p2Dpt) + 2);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddIndexedColour,
+ ddCell->colours.colour.pIndex, ptr);
+
+ OC_PARSER_RETURN(ddCell);
+}
+
+
+OC_PARSER_FUNC_HEADER(CellArray)
+{
+ miCellArrayStruct *ddCell;
+ PARSER_PTR(ptr);
+ pexCellArray *pCell = (pexCellArray *)pPEXOC;
+
+ GET_DD_STORAGE( ddCell, miCellArrayStruct, sizeof(miCellArrayStruct)
+ + sizeof(listofddPoint) + 3 * sizeof(ddCoord3D)
+ + pCell->dx * pCell->dy * sizeof(ddIndexedColour));
+ ddCell->point.ddList = (listofddPoint *)(ddCell+1);
+
+ ddCell->point.type = DD_3D_POINT;
+ ddCell->point.numLists = 1;
+ ddCell->point.maxLists = 1;
+ ddCell->point.ddList->numPoints = 3;
+ ddCell->point.ddList->pts.p3Dpt =
+ (ddCoord3D *)((ddCell->point.ddList) + 1);
+ EXTRACT_LISTOF_COORD3D(3, ddCell->point.ddList->pts.p3Dpt, ptr);
+
+ EXTRACT_CARD32(ddCell->dx, ptr);
+ EXTRACT_CARD32(ddCell->dy, ptr);
+ ddCell->colours.colour.pIndex =
+ (ddIndexedColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddIndexedColour,
+ ddCell->colours.colour.pIndex, ptr);
+
+ OC_PARSER_RETURN(ddCell);
+}
+
+
+OC_PARSER_FUNC_HEADER(ExtCellArray)
+{
+ miCellArrayStruct *ddCell;
+ PARSER_PTR(ptr);
+ pexExtCellArray *pCell = (pexExtCellArray *)pPEXOC;
+ unsigned long size;
+
+ size = (((pCell->colourType==PEXIndexedColour)
+ || (pCell->colourType==PEXRgb8Colour)) ? 4 :
+ ((pCell->colourType==PEXRgb16Colour) ? 8 : 12 ));
+ GET_DD_STORAGE( ddCell, miCellArrayStruct, sizeof(miCellArrayStruct)
+ + sizeof(listofddPoint) + 3 * sizeof(ddCoord3D)
+ + pCell->dx * pCell->dy * size);
+ ddCell->point.ddList = (listofddPoint *)(ddCell+1);
+
+ EXTRACT_CARD16(ddCell->colours.colourType, ptr);
+ SKIP_PADDING(ptr, 2);
+
+ ddCell->point.type = DD_3D_POINT;
+ ddCell->point.numLists = 1;
+ ddCell->point.maxLists = 1;
+ ddCell->point.ddList->numPoints = 3;
+ ddCell->point.ddList->pts.p3Dpt =
+ (ddCoord3D *)((ddCell->point.ddList) + 1);
+ EXTRACT_LISTOF_COORD3D(3, ddCell->point.ddList->pts.p3Dpt, ptr);
+ EXTRACT_CARD32(ddCell->dx, ptr);
+ EXTRACT_CARD32(ddCell->dy, ptr);
+
+ switch (pCell->colourType) {
+
+ case PEXIndexedColour: {
+ ddCell->colours.colour.pIndex =
+ (ddIndexedColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddIndexedColour,
+ ddCell->colours.colour.pIndex, ptr);
+ break; }
+
+ case PEXRgbFloatColour : {
+ ddCell->colours.colour.pRgbFloat =
+ (ddRgbFloatColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddRgbFloatColour,
+ ddCell->colours.colour.pRgbFloat, ptr);
+ break; }
+
+ case PEXCieFloatColour : {
+ ddCell->colours.colour.pCie =
+ (ddCieColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddCieColour,
+ ddCell->colours.colour.pCie, ptr);
+ break; }
+
+ case PEXHsvFloatColour : {
+ ddCell->colours.colour.pHsv =
+ (ddHsvColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddHsvColour,
+ ddCell->colours.colour.pHsv, ptr);
+ break; }
+
+ case PEXHlsFloatColour : {
+ ddCell->colours.colour.pHls =
+ (ddHlsColour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddHlsColour,
+ ddCell->colours.colour.pHls, ptr);
+ break; }
+
+ case PEXRgb8Colour : {
+ ddCell->colours.colour.pRgb8 =
+ (ddRgb8Colour *)((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddRgb8Colour,
+ ddCell->colours.colour.pRgb8, ptr);
+ break; }
+
+ case PEXRgb16Colour : {
+ ddCell->colours.colour.pRgb16 =
+ (ddRgb16Colour *) ((ddCell->point.ddList->pts.p3Dpt) + 3);
+ EXTRACT_STRUCT( ddCell->dx * ddCell->dy, ddRgb16Colour,
+ ddCell->colours.colour.pRgb16, ptr);
+ break; }
+
+ }
+
+ OC_PARSER_RETURN(ddCell);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(PSurfaceChars)
+{
+ miPSurfaceCharsStruct *ddPSC;
+ ddULONG sType = 0;
+ ddPointer ptr = (ddPointer)pPEXOC;
+
+ sType = ((pexParaSurfCharacteristics *)pPEXOC)->characteristics;
+ SKIP_PADDING(ptr,sizeof(pexParaSurfCharacteristics));
+
+ switch (sType) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ GET_DD_STORAGE( ddPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct));
+ break;
+
+ case PEXPSCIsoCurves: {
+ GET_DD_STORAGE( ddPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_IsoparametricCurves));
+ ddPSC->data.pIsoCurves = (ddPSC_IsoparametricCurves *)(ddPSC + 1);
+ EXTRACT_CARD16(ddPSC->data.pIsoCurves->placementType, ptr);
+ SKIP_PADDING(ptr, 2);
+ EXTRACT_CARD16(ddPSC->data.pIsoCurves->numUcurves, ptr);
+ EXTRACT_CARD16(ddPSC->data.pIsoCurves->numVcurves, ptr);
+ break; }
+
+ case PEXPSCMcLevelCurves: {
+ GET_DD_STORAGE( ddPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_LevelCurves));
+ ddPSC->data.pMcLevelCurves = (ddPSC_LevelCurves *)(ddPSC + 1);
+ EXTRACT_STRUCT( 1,ddPSC_LevelCurves,ddPSC->data.pMcLevelCurves, ptr);
+ break; }
+
+ case PEXPSCWcLevelCurves: {
+ GET_DD_STORAGE( ddPSC, miPSurfaceCharsStruct,
+ sizeof(miPSurfaceCharsStruct)
+ + sizeof(ddPSC_LevelCurves));
+ ddPSC->data.pWcLevelCurves = (ddPSC_LevelCurves *)(ddPSC + 1);
+ EXTRACT_STRUCT( 1,ddPSC_LevelCurves,ddPSC->data.pWcLevelCurves, ptr);
+ break; }
+ }
+
+ ddPSC->type = sType;
+
+ OC_PARSER_RETURN(ddPSC);
+}
+
+
+
+
+OC_PARSER_FUNC_HEADER(Gdp2D)
+{
+ miGdpStruct *ddGdp;
+ pexGdp2D *pGdp = (pexGdp2D *)pPEXOC;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddGdp, miGdpStruct, (sizeof(miGdpStruct) +
+ sizeof(listofddPoint) + pGdp->numBytes
+ + pGdp->numPoints * sizeof(ddCoord2D)));
+ ddGdp->points.ddList = (listofddPoint *)(ddGdp+1);
+ ddGdp->GDPid = pGdp->gdpId;
+ ddGdp->points.ddList->numPoints = pGdp->numPoints;
+ ddGdp->numBytes = pGdp->numBytes;
+ ddGdp->points.type = DD_2D_POINT;
+ ddGdp->points.numLists = 1;
+ ddGdp->points.maxLists = 1;
+ ddGdp->points.ddList->pts.p2Dpt = (ddCoord2D *)((ddGdp->points.ddList) + 1);
+ ptr = (ddPointer)(pGdp+1);
+ EXTRACT_LISTOF_COORD2D(ddGdp->points.ddList->numPoints,
+ ddGdp->points.ddList->pts.p2Dpt, ptr);
+ ddGdp->pData = ((ddUCHAR *)(ddGdp->points.ddList))
+ + pGdp->numPoints * sizeof(ddCoord2D);
+ EXTRACT_STRUCT( ddGdp->numBytes, ddUCHAR, ddGdp->pData, ptr);
+
+ OC_PARSER_RETURN(ddGdp);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(Gdp)
+{
+ miGdpStruct *ddGdp;
+ pexGdp *pGdp = (pexGdp *)pPEXOC;
+ PARSER_PTR(ptr);
+
+ GET_DD_STORAGE( ddGdp, miGdpStruct, (sizeof(miGdpStruct) +
+ sizeof(listofddPoint) + pGdp->numBytes
+ + pGdp->numPoints * sizeof(ddCoord3D)));
+ ddGdp->points.ddList = (listofddPoint *)(ddGdp+1);
+ ddGdp->GDPid = pGdp->gdpId;
+ ddGdp->points.ddList->numPoints = pGdp->numPoints;
+ ddGdp->numBytes = pGdp->numBytes;
+ ddGdp->points.type = DD_3D_POINT;
+ ddGdp->points.numLists = 1;
+ ddGdp->points.maxLists = 1;
+ ddGdp->points.ddList->pts.p3Dpt = (ddCoord3D *)((ddGdp->points.ddList) + 1);
+ ptr = (ddPointer)(pGdp+1);
+ EXTRACT_LISTOF_COORD3D(ddGdp->points.ddList->numPoints,
+ ddGdp->points.ddList->pts.p3Dpt, ptr);
+ ddGdp->pData = ((ddUCHAR *)(ddGdp->points.ddList))
+ + pGdp->numPoints * sizeof(ddCoord3D);
+ EXTRACT_STRUCT( ddGdp->numBytes, ddUCHAR, ddGdp->pData, ptr);
+
+ OC_PARSER_RETURN(ddGdp);
+
+}
+
+
+OC_PARSER_FUNC_HEADER(SetAttribute)
+{
+ /** The function vector should be set up to have this
+ ** SetAttribute function as the entry for all of the OC entries other
+ ** than those listed above or those NULL'd out
+ **/
+
+ ddElementInfo *dstAttrib;
+
+ GET_DD_STORAGE( dstAttrib, ddElementInfo,
+ pPEXOC->length * sizeof(CARD32));
+
+ memcpy( (char *)dstAttrib, (char *)pPEXOC,
+ (int)(pPEXOC->length * sizeof(CARD32)));
+
+ OC_PARSER_RETURN(pPEXOC);
+}
+
+
+OC_PARSER_FUNC_HEADER(PropOC)
+{
+ /** This handles storing ProprietaryOC
+ **/
+
+ ddElementInfo *dstPropOC;
+
+ GET_DD_STORAGE( dstPropOC, ddElementInfo,
+ pPEXOC->length * sizeof(CARD32));
+
+ memcpy( (char *)dstPropOC, (char *)pPEXOC,
+ (int)(pPEXOC->length * sizeof(CARD32)));
+
+ OC_PARSER_RETURN(pPEXOC);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level3/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/level3/Imakefile
new file mode 100644
index 000000000..d11e1e072
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level3/Imakefile
@@ -0,0 +1,63 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/9 1996/09/28 16:54:20 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level3/Imakefile,v 3.9 1999/04/17 09:08:16 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM or the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDdpexCDebugFlags
+#define PexDdpexCDebugFlags ServerCDebugFlags
+#endif
+
+XCOMM -D defines for ddpex:
+XCOMM DDTEST turns on some fprintf(stderr...)s for debugging
+
+ DEFINES = PexDdpexDefines
+CDEBUGFLAGS = PexDdpexCDebugFlags
+
+ PEXSERVINC = ../../../include
+DDPEXINCLUDE = ../include
+
+INCLUDES = -I. \
+ -I$(DDPEXINCLUDE) \
+ -I$(XINCLUDESRC) \
+ -I$(PEXSERVINC) \
+ -I$(SERVERSRC)/include
+
+SRCS = miRender.c miRndrPick.c
+
+OBJS = miRender.o miRndrPick.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ddpex3,$(OBJS))
+
+LintLibraryTarget(dp3, $(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRender.c b/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRender.c
new file mode 100644
index 000000000..037328e10
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRender.c
@@ -0,0 +1,1966 @@
+/* $TOG: miRender.c /main/22 1998/02/10 12:43:12 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level3/miRender.c,v 3.5 1998/10/04 09:34:37 dawes Exp $ */
+
+#include "miLUT.h"
+#include "dipex.h"
+#include "ddpex3.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "PEXErr.h"
+#include "pexUtils.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "miscstruct.h"
+#include "dixstruct.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "miWks.h"
+#include "ddpex4.h"
+#include "gcstruct.h"
+#include "pexos.h"
+
+
+/* External variables used */
+
+extern void mi_set_filters();
+extern void miMatMult();
+extern ddpex3rtn miBldViewport_xform();
+extern ddpex3rtn miBldCC_xform();
+extern ocTableType ParseOCTable[];
+extern void (*DestroyOCTable[])();
+extern ocTableType InitExecuteOCTable[];
+extern ocTableType PickExecuteOCTable[];
+extern ocTableType SearchExecuteOCTable[];
+extern RendTableType RenderPrimitiveTable[];
+extern RendTableType PickPrimitiveTable[];
+
+/* pcflag is initialized in ddpexInit() */
+ddBOOL pcflag;
+ddPCAttr defaultPCAttr;
+#define MI_GET_DEFAULT_PC(pPC) \
+ if (!pcflag) { \
+ DefaultPC(pPC); \
+ pcflag = MI_TRUE; }
+
+ddFLOAT ident4x4[4][4] = {
+ {1.0, 0.0, 0.0, 0.0},
+ {0.0, 1.0, 0.0, 0.0},
+ {0.0, 0.0, 1.0, 0.0},
+ {0.0, 0.0, 0.0, 1.0}
+};
+
+
+/* Level III Rendering Procedures */
+
+/*++
+ |
+ | Function Name: InitRenderer
+ |
+ | Function Description:
+ | Initializes the dd stuff in the renderer for the
+ | PEXCreateRenderer request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+InitRenderer(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+
+ extern GCPtr CreateScratchGC();
+ extern ddpex3rtn CreateDDContext();
+
+ ddpex3rtn err = Success;
+
+
+#ifdef DDTEST
+ ErrorF( " InitRenderer\n");
+#endif
+
+ /* set renderer dynamics */
+ /* for now, set them all to be dynamic regardless of drawable type
+ * bit value of 0 means dynamic modifications
+ * bit value of 1 means no dynamic modifications
+ * todo: change this to be easy to specify individual dynamics
+ * OR with PEXDynxxx for static; OR with ~PEXDynxxx for dynamics
+ */
+ /* since we don't actually make copies of namesets
+ * or luts so that their values are bound at BeginRendering,
+ * any change made in those tables/ns will be noticed anytime
+ * info is read from an lut/ns, therefore, the tables and namesets
+ * are dynamics and anytime a change is made, anything affected
+ * by that change must be updated. The update is done in
+ * ValidateRenderer, which is called at appropriate times to
+ * make sure everything is updated.
+ */
+ pRend->tablesMask = 0;
+ pRend->namesetsMask = 0;
+ pRend->attrsMask = 0;
+
+ /*
+ * Create a DDContext and associate it with the Renderer
+ */
+ if (err = CreateDDContext(pRend)) return(err);
+
+ /* copy the initial oc functions to the OC table */
+ pRend->render_mode = MI_REND_DRAWING;
+ memcpy( (char *)pRend->executeOCs,
+ (char *)InitExecuteOCTable,
+ sizeof(ocTableType)*OCTABLE_LENGTH);
+
+ MI_SET_ALL_CHANGES(pRend);
+ ValidateRenderer(pRend);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: DefaultPC
+ |
+ | Function Description:
+ | Initializes a global static copy of the PC to the default values.
+ | This copy is, in turn, used to initialize PC's the the initial values.
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+DefaultPC(pPC)
+ ddPCAttr *pPC;
+{
+ pPC->markerType = PEXMarkerAsterisk;
+ pPC->markerScale = 1.0;
+ pPC->markerColour.colourType = PEXIndexedColour;
+ pPC->markerColour.colour.indexed.index = 1;
+ pPC->markerIndex = 1;
+ pPC->textFont = 1;
+ pPC->textPrecision = PEXStringPrecision;
+ pPC->charExpansion = 1.0;
+ pPC->charSpacing = 0.0;
+ pPC->textColour.colourType = PEXIndexedColour;
+ pPC->textColour.colour.indexed.index = 1;
+ pPC->charHeight = 0.01;
+ pPC->charUp.x = 0.0;
+ pPC->charUp.y = 1.0;
+ pPC->textPath = PEXPathRight;
+ pPC->textAlignment.vertical = PEXValignNormal;
+ pPC->textAlignment.horizontal = PEXHalignNormal;
+ pPC->atextHeight = 0.01;
+ pPC->atextUp.x = 0.0;
+ pPC->atextUp.y = 1.0;
+ pPC->atextPath = PEXPathRight;
+ pPC->atextAlignment.vertical = PEXValignNormal;
+ pPC->atextAlignment.horizontal = PEXHalignNormal;
+ pPC->atextStyle = PEXATextNotConnected;
+ pPC->textIndex = 1;
+ pPC->lineType = PEXLineTypeSolid;
+ pPC->lineWidth = 1.0;
+ pPC->lineColour.colourType = PEXIndexedColour;
+ pPC->lineColour.colour.indexed.index = 1;
+ pPC->curveApprox.approxMethod = PEXApproxConstantBetweenKnots;
+ pPC->curveApprox.tolerance = 1.0;
+ pPC->lineInterp = PEXPolylineInterpNone;
+ pPC->lineIndex = 1;
+ pPC->intStyle = PEXInteriorStyleHollow;
+ pPC->intStyleIndex = 1;
+ pPC->surfaceColour.colourType = PEXIndexedColour;
+ pPC->surfaceColour.colour.indexed.index = 1;
+ pPC->reflAttr.ambient = 1.0;
+ pPC->reflAttr.diffuse = 1.0;
+ pPC->reflAttr.specular = 1.0;
+ pPC->reflAttr.specularConc = 0.0;
+ pPC->reflAttr.transmission = 0.0;
+ pPC->reflAttr.specularColour.colourType = PEXIndexedColour;
+ pPC->reflAttr.specularColour.colour.indexed.index = 1;
+ pPC->reflModel = PEXReflectionNoShading;
+ pPC->surfInterp = PEXSurfaceInterpNone;
+ pPC->bfIntStyle = PEXInteriorStyleHollow;
+ pPC->bfIntStyleIndex = 1;
+ pPC->bfSurfColour.colourType = PEXIndexedColour;
+ pPC->bfSurfColour.colour.indexed.index = 1;
+ pPC->bfReflAttr.ambient = 1.0;
+ pPC->bfReflAttr.diffuse = 1.0;
+ pPC->bfReflAttr.specular = 1.0;
+ pPC->bfReflAttr.specularConc = 0.0;
+ pPC->bfReflAttr.transmission = 0.0;
+ pPC->bfReflAttr.specularColour.colourType = PEXIndexedColour;
+ pPC->bfReflAttr.specularColour.colour.indexed.index = 1;
+ pPC->bfReflModel = PEXReflectionNoShading;
+ pPC->bfSurfInterp = PEXSurfaceInterpNone;
+
+ pPC->surfApprox.approxMethod = PEXApproxConstantBetweenKnots;
+ pPC->surfApprox.uTolerance = 1.0;
+ pPC->surfApprox.vTolerance = 1.0;
+
+ pPC->cullMode = 0;
+ pPC->distFlag = FALSE;
+ pPC->patternSize.x = 1.0;
+ pPC->patternSize.y = 1.0;
+ pPC->patternRefPt.x = 0.0;
+ pPC->patternRefPt.y = 0.0;
+ pPC->patternRefPt.z = 0.0;
+ pPC->patternRefV1.x = 1.0;
+ pPC->patternRefV1.y = 0.0;
+ pPC->patternRefV1.z = 0.0;
+ pPC->patternRefV2.x = 0.0;
+ pPC->patternRefV2.y = 1.0;
+ pPC->patternRefV2.z = 0.0;
+ pPC->intIndex = 1;
+ pPC->edges = PEXOff;
+ pPC->edgeType = PEXSurfaceEdgeSolid;
+ pPC->edgeWidth = 1.0;
+ pPC->edgeColour.colourType = PEXIndexedColour;
+ pPC->edgeColour.colour.indexed.index = 1;
+ pPC->edgeIndex = 1;
+ memcpy( (char *) pPC->localMat, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ memcpy( (char *) pPC->globalMat, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+ pPC->modelClip = PEXNoClip;
+ pPC->modelClipVolume = puCreateList(DD_HALF_SPACE);
+ pPC->viewIndex = 0;
+ pPC->lightState = puCreateList(DD_INDEX);
+ pPC->depthCueIndex = 0;
+ pPC->colourApproxIndex = 0;
+ pPC->rdrColourModel = PEXRdrColourModelRGB;
+ pPC->psc.type = PEXPSCNone;
+ pPC->psc.data.none = '0';
+ pPC->asfs = ~0L;
+ pPC->pickId = 0;
+ pPC->hlhsrType = 0;
+ pPC->pCurrentNS = NULL;
+
+ return;
+}
+
+/*++
+ |
+ | Function Name: InquireRendererDynamics
+ |
+ | Function Description:
+ | Supports the PEXGetRendererDynamics request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+InquireRendererDynamics(pRend, pTablesMask, pNSMask, pAttrMask)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+ ddBitmask *pTablesMask; /* dynamics mask for luts */
+ ddBitmask *pNSMask; /* dynamics mask for name sets */
+ ddBitmask *pAttrMask;/* dynamics mask for renderer attributes */
+{
+
+#ifdef DDTEST
+ ErrorF( " InquireRendererDynamics\n");
+#endif
+
+ *pTablesMask = pRend->tablesMask;
+ *pNSMask = pRend->namesetsMask;
+ *pAttrMask = pRend->attrsMask;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: RenderOCs
+ |
+ | Function Description:
+ | Supports the PEXRenderOutputCommands request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+RenderOCs(pRend, numOCs, pOCs)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ ddULONG numOCs;
+ ddElementInfo *pOCs;
+/* out */
+{
+ register ddElementInfo *poc;
+ miGenericElementPtr pexoc;
+ ddpex2rtn err = Success;
+ XID fakestr;
+ diStructHandle sh = 0, ph;
+ pexStructure *ps;
+ pexOutputCommandError *pErr;
+ ddULONG offset1, offset2, numberOCs;
+ miTraverserState trav_state;
+ diPMHandle pPM = (diPMHandle) NULL;
+ unsigned long PEXStructType;
+ miStructPtr pheader;
+ ddPickPath *strpp;
+ miPPLevel *travpp;
+ int i, ROCdepth;
+ ddUSHORT serverstate;
+
+
+#ifdef DDTEST
+ ErrorF( " RenderOCs\n");
+#endif
+
+ /* if renderer idle ignore.... */
+ if (pRend->state == PEXIdle)
+ return Success;
+
+ ValidateRenderer(pRend);
+
+ /* state == PEXPicking, call through traverser */
+ if (pRend->state == PEXPicking) {
+
+ /* get the structure handle from the last pickpath in the list of
+ fake structures (these are added by BeginStructure)
+ */
+ ROCdepth = (pRend->pickstr.fakeStrlist)->numObj-1;
+ strpp = (ddPickPath *)(pRend->pickstr.fakeStrlist)->pList;
+ sh = strpp[ROCdepth].structure;
+
+ /* set up incoming state properly for traverser */
+ if (ROCdepth > 0) {
+ travpp = (miPPLevel *) xalloc(sizeof(miPPLevel));
+ trav_state.p_pick_path = travpp;
+ travpp->pp = strpp[ROCdepth-1];
+ for (i = ROCdepth-2; i >= 0; i--) {
+ travpp->up = (miPPLevel *) xalloc(sizeof(miPPLevel));
+ travpp = travpp->up;
+ travpp->pp = strpp[i];
+ }
+ }
+
+
+ /* now do the work of storing stuff into the structure */
+ numberOCs = numOCs;
+ for ( poc=pOCs; numberOCs>0; numberOCs-- )
+ {
+
+ err = StoreElements( sh, 1, poc, &pErr);
+ if (err != Success) return(err);
+
+ poc += poc->length;
+ }
+
+ /* now call the traverser to traverse this structure */
+ /* set exec_str_flag */
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+ trav_state.max_depth = ROCdepth;
+ trav_state.pickId = strpp[ROCdepth].pickid;
+ trav_state.ROCoffset = strpp[ROCdepth].offset;
+ pPM = pRend->pickstr.pseudoPM;
+
+ /* turn off this flag so BeginStructure calls made inside traverser
+ do not cause fake structures to be allocated
+ */
+ serverstate = pRend->pickstr.server;
+ pRend->pickstr.server = DD_NEITHER;
+ offset1 = 1;
+ offset2 = numOCs;
+
+ err = traverser(pRend, sh, offset1, offset2, pPM, NULL, &trav_state);
+
+ /* restore the state flag */
+ pRend->pickstr.server = serverstate;
+
+ /* save pickid returned by traverser */
+ strpp[ROCdepth].pickid = trav_state.pickId;
+ strpp[ROCdepth].offset += numOCs;
+
+ /* clean up structure */
+ {
+ miStructPtr pheader = (miStructPtr) sh->deviceData;
+ extern cssTableType DestroyCSSElementTable[];
+
+ MISTR_DEL_ELS(sh, pheader, 1, numOCs);
+ MISTR_CURR_EL_PTR(pheader) = MISTR_ZERO_EL(pheader);
+ MISTR_CURR_EL_OFFSET(pheader) = 0;
+
+ }
+
+ }
+ else {
+ /* state == PEXRendering, call directly to level 2 for efficiency */
+ for ( poc=pOCs; numOCs>0; numOCs-- )
+ {
+ switch( poc->elementType ) {
+ /* drawing primitives */
+ case PEXOCMarker:
+ case PEXOCMarker2D:
+ case PEXOCText:
+ case PEXOCText2D:
+ case PEXOCAnnotationText:
+ case PEXOCAnnotationText2D:
+ case PEXOCPolyline:
+ case PEXOCPolyline2D:
+ case PEXOCPolylineSet:
+ case PEXOCNurbCurve:
+ case PEXOCFillArea:
+ case PEXOCFillArea2D:
+ case PEXOCExtFillArea:
+ case PEXOCFillAreaSet:
+ case PEXOCFillAreaSet2D:
+ case PEXOCExtFillAreaSet:
+ case PEXOCTriangleStrip:
+ case PEXOCQuadrilateralMesh:
+ case PEXOCSOFAS:
+ case PEXOCNurbSurface:
+ case PEXOCCellArray:
+ case PEXOCCellArray2D:
+ case PEXOCExtCellArray:
+ case PEXOCGdp:
+ case PEXOCGdp2D:
+
+ /* drop out if not doing primitives
+ * otherwise fall through */
+ if (!MI_DDC_DO_PRIMS(pRend))
+ break;
+
+ default:
+ /* if a Proprietary OC bump the counter and continue */
+ if (MI_HIGHBIT_ON((int)poc->elementType)) {
+ ((ddElementRef *)pRend->curPath->pList)
+ [pRend->curPath->numObj - 1].offset++;
+ break;
+ }
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC((int)poc->elementType)){
+
+ pexoc = 0;
+ err = ParseOCTable[ (int)poc->elementType ]
+ ( (ddPointer)poc, &pexoc );
+ }
+ else
+ err = !Success;
+ }
+
+ if (err != Success)
+ return( PEXERR(PEXOutputCommandError) );
+
+ /* If we make it here it is a valid OC no more checking to do */
+
+ /* add one to the current_path's element offset if a
+ * begin structure has been done
+ */
+ if (pRend->curPath->numObj)
+ ((ddElementRef *)pRend->curPath->pList)[pRend->curPath->numObj - 1].offset++;
+ pRend->executeOCs[ (int)poc->elementType ]( pRend, &pexoc->element );
+
+ DestroyOCTable[ (int)poc->elementType ]( pexoc );
+ }
+
+ poc += poc->length; /* length is in four byte units & sizeof(poc) is 4 */
+ }
+ }
+
+ return (err);
+}
+
+ddpex3rtn
+convertoffset(pstruct, ppos, poffset)
+/* in */
+ miStructStr *pstruct; /* pointer to the structure involved */
+ ddElementPos *ppos; /* the position information */
+/* out */
+ ddULONG *poffset; /* valid offset calculated from the postition */
+
+{
+ /* shamelessly lifted from the pos2offset routine in miStruct.c */
+
+ ddUSHORT whence = ppos->whence;
+ ddLONG offset = ppos->offset, temp;
+
+ switch (whence) {
+ case PEXBeginning:
+ temp = offset;
+ break;
+
+ case PEXCurrent:
+ temp = MISTR_CURR_EL_OFFSET(pstruct) + offset;
+ break;
+
+ case PEXEnd:
+ /* numElements is the same as the last elements offset */
+ temp = MISTR_NUM_EL(pstruct) + offset;
+ break;
+
+ default:
+ /* value error */
+ return (BadValue);
+ break;
+ }
+
+ /* now check that the new offset is in range of the structure */
+ if (temp < 0)
+ *poffset = 0;
+ else if (temp > MISTR_NUM_EL(pstruct))
+ *poffset = MISTR_NUM_EL(pstruct);
+ else
+ *poffset = temp;
+
+ return (Success);
+
+}
+
+
+
+/*++
+ |
+ | Function Name: RenderElements
+ |
+ | Function Description:
+ | Supports the PEXRenderElements request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+RenderElements(pRend, pStr, range)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ diStructHandle pStr;
+ ddElementRange *range;
+/* out */
+{
+ ddpex3rtn err = Success;
+ miStructPtr pstruct;
+ miGenericElementPtr pel;
+ ddULONG offset1, offset2, i;
+ miTraverserState trav_state;
+ diPMHandle pPM = (diPMHandle) NULL;
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+ int eltype, ROCdepth, j;
+ ddPickPath *strpp, sIDpp, *sIDlist;
+ miPPLevel *travpp;
+ XID fakeStrID;
+ diStructHandle sh = 0, REfakeStr;
+ ddUSHORT serverstate;
+ ddElementPos REfakePos;
+
+
+
+
+ /* if renderer idle ignore.... */
+ if (pRend->state == PEXIdle)
+ return Success;
+
+ pstruct = (miStructPtr) pStr->deviceData;
+
+ /* convert the offset based on whence value */
+ if (convertoffset(pstruct, &(range->position1), &offset1))
+ return (BadValue); /* bad whence value */
+
+ if (convertoffset(pstruct, &(range->position2), &offset2))
+ return (BadValue); /* bad whence value */
+
+ /* flip the range if necessary */
+ if (offset1 > offset2) {
+ i = offset1;
+ offset1 = offset2;
+ offset2 = i;
+ }
+
+ /* return early if offsets out of range */
+ if (offset1 == 0)
+ if (offset2 == 0)
+ return(Success);
+ else
+ offset1 = 1;
+
+ ValidateRenderer(pRend);
+
+ if (pRend->state == PEXPicking) {
+
+ /* in client side picking RenderElements could be called
+ at different levels of nested Begin Structures. In
+ order to uniquely store a correspondence between
+ structure handles and the correct ID a fake structure
+ must be allocated
+ */
+
+ REfakeStr = (diStructHandle)xalloc((unsigned long)
+ sizeof(ddStructResource));
+ if (!REfakeStr) return (BadAlloc);
+ REfakeStr->id = -666;
+ err = CreateStructure(REfakeStr);
+ if (err != Success) {
+ xfree((pointer)(REfakeStr));
+ return (err);
+ }
+
+ /* now copy the desired elements out of the structure passed in
+ and into the fake structure
+ */
+ REfakePos.whence = PEXBeginning;
+ REfakePos.offset = 0;
+ err = CopyElements(pStr, range, REfakeStr, &REfakePos);
+ if (err != Success) {
+ xfree((pointer)(REfakeStr));
+ return (err);
+ }
+
+
+ /* need to handle case where RenderElements is called
+ after a ROC that may or may not have Begin/End structures
+ nested in it
+ */
+ ROCdepth = (pRend->pickstr.fakeStrlist)->numObj-1;
+ strpp = (ddPickPath *)(pRend->pickstr.fakeStrlist)->pList;
+ sh = strpp[ROCdepth].structure;
+
+
+ /* set up incoming state properly for traverser */
+ if (ROCdepth > 0) {
+ travpp = (miPPLevel *) xalloc(sizeof(miPPLevel));
+ trav_state.p_pick_path = travpp;
+ travpp->pp = strpp[ROCdepth-1];
+ for (j = ROCdepth-2; j >= 0; j--) {
+ travpp->up = (miPPLevel *) xalloc(sizeof(miPPLevel));
+ travpp = travpp->up;
+ travpp->pp = strpp[j];
+ }
+ }
+
+
+ /* set exec_str_flag */
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+ trav_state.max_depth = ROCdepth;
+ trav_state.pickId = strpp[ROCdepth].pickid;
+ trav_state.ROCoffset = strpp[ROCdepth].offset;
+
+ pPM = pRend->pickstr.pseudoPM;
+
+ /* turn off this flag so BeginStructure calls made inside traverser
+ do not cause fake structures to be allocated
+ */
+ serverstate = pRend->pickstr.server;
+ pRend->pickstr.server = DD_NEITHER;
+ /* redefine the offsets into the fake structure from the originals */
+ offset2 = (offset2 - offset1 + 1);
+ offset1 = 1;
+
+ err = traverser(pRend, REfakeStr, offset1, offset2, pPM, NULL, &trav_state);
+
+ /* restore the state flag */
+ pRend->pickstr.server = serverstate;
+
+ /* save pickid returned by traverser */
+ strpp[ROCdepth].pickid = trav_state.pickId;
+ strpp[ROCdepth].offset += offset2;
+
+ /* now find the ID that corresponds to the handle sh and
+ save that as the corresponding ID for pStr in the sIDlist
+ note that the IDs ARE stored in the pickid field
+ */
+ sIDpp.structure = REfakeStr;
+ sIDpp.offset = 0;
+ sIDlist = (ddPickPath *) (pRend->pickstr.sIDlist)->pList;
+ for (j = 0; j < (pRend->pickstr.sIDlist)->numObj; j++, sIDlist++)
+ if (sh == sIDlist->structure) {
+ sIDpp.pickid = sIDlist->pickid;
+ break;
+ }
+
+ err = puAddToList((ddPointer) &sIDpp, (ddULONG) 1, pRend->pickstr.sIDlist);
+ if (err != Success) return (err);
+
+ /* clean up structure */
+ {
+ miStructPtr pheader = (miStructPtr) REfakeStr->deviceData;
+ extern cssTableType DestroyCSSElementTable[];
+
+ MISTR_DEL_ELS(REfakeStr, pheader, offset1, offset2);
+ MISTR_CURR_EL_PTR(pheader) = MISTR_ZERO_EL(pheader);
+ MISTR_CURR_EL_OFFSET(pheader) = 0;
+
+ }
+
+ }
+ else {
+ /* state == PEXRendering call directly into level 2 for efficiency */
+ for (i = offset1; i <= offset2; i++){
+
+ /* set the element pointer */
+ if ( i == offset1) {
+ MISTR_FIND_EL(pstruct, offset1, pel);
+ }
+ else
+ pel = MISTR_NEXT_EL(pel);
+
+ eltype = MISTR_EL_TYPE (pel);
+
+ switch (eltype) {
+ /* drawing primitives */
+ case PEXOCMarker:
+ case PEXOCMarker2D:
+ case PEXOCText:
+ case PEXOCText2D:
+ case PEXOCAnnotationText:
+ case PEXOCAnnotationText2D:
+ case PEXOCPolyline:
+ case PEXOCPolyline2D:
+ case PEXOCPolylineSet:
+ case PEXOCNurbCurve:
+ case PEXOCFillArea:
+ case PEXOCFillArea2D:
+ case PEXOCExtFillArea:
+ case PEXOCFillAreaSet:
+ case PEXOCFillAreaSet2D:
+ case PEXOCExtFillAreaSet:
+ case PEXOCTriangleStrip:
+ case PEXOCQuadrilateralMesh:
+ case PEXOCSOFAS:
+ case PEXOCNurbSurface:
+ case PEXOCCellArray:
+ case PEXOCCellArray2D:
+ case PEXOCExtCellArray:
+ case PEXOCGdp:
+
+ /* drop out if not doing primitives
+ * otherwise fall through */
+ if (!MI_DDC_DO_PRIMS(pRend))
+ break;
+ default:
+ /* if a Proprietary OC call the correct routine */
+ if (MI_HIGHBIT_ON(eltype)) {
+ pRend->executeOCs[MI_OC_PROP]( pRend,
+ (ddPointer)&(MISTR_EL_DATA (pel)));
+ }
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(eltype))
+ pRend->executeOCs[ eltype]( pRend,
+ (ddPointer)&(MISTR_EL_DATA (pel)));
+ else
+ err = !Success;
+ }
+
+ if (err != Success)
+ return( PEXERR(PEXOutputCommandError) );
+
+ }
+ }
+ }
+
+ return(err);
+}
+
+/*++
+ |
+ | Function Name: AccumulateState
+ |
+ | Function Description:
+ | Supports the PEXAccumulateState request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+AccumulateState(pRend, pAccSt )
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ddAccStPtr pAccSt; /* accumulate state handle */
+/* out */
+{
+ register int depth, offset;
+ ddpex3rtn err = Success;
+ ddElementRef *elemRef;
+ miStructPtr structPtr;
+ miGenericElementPtr elemPtr;
+
+ /* if renderer idle ignore.... */
+ if (pRend->state == PEXIdle)
+ return Success;
+
+ ValidateRenderer(pRend);
+
+ /* The path has already been validated */
+
+ elemRef = (ddElementRef *) pAccSt->Path->pList;
+ for (depth = 1; depth <= pAccSt->numElRefs; depth++) {
+ structPtr = (miStructPtr) elemRef->structure->deviceData;
+ elemPtr = MISTR_NEXT_EL (MISTR_ZERO_EL (structPtr));
+ for (offset = 0; offset < elemRef->offset; offset++) {
+ switch (MISTR_EL_TYPE (elemPtr)) {
+ case PEXOCMarkerType:
+ case PEXOCMarkerScale:
+ case PEXOCMarkerColourIndex:
+ case PEXOCMarkerColour:
+ case PEXOCMarkerBundleIndex:
+ case PEXOCTextFontIndex:
+ case PEXOCTextPrecision:
+ case PEXOCCharExpansion:
+ case PEXOCCharSpacing:
+ case PEXOCTextColourIndex:
+ case PEXOCTextColour:
+ case PEXOCCharHeight:
+ case PEXOCCharUpVector:
+ case PEXOCTextPath:
+ case PEXOCTextAlignment:
+ case PEXOCAtextHeight:
+ case PEXOCAtextUpVector:
+ case PEXOCAtextPath:
+ case PEXOCAtextAlignment:
+ case PEXOCAtextStyle:
+ case PEXOCTextBundleIndex:
+ case PEXOCLineType:
+ case PEXOCLineWidth:
+ case PEXOCLineColourIndex:
+ case PEXOCLineColour:
+ case PEXOCCurveApproximation:
+ case PEXOCPolylineInterp:
+ case PEXOCLineBundleIndex:
+ case PEXOCInteriorStyle:
+ case PEXOCInteriorStyleIndex:
+ case PEXOCSurfaceColourIndex:
+ case PEXOCSurfaceColour:
+ case PEXOCSurfaceReflAttr:
+ case PEXOCSurfaceReflModel:
+ case PEXOCSurfaceInterp:
+ case PEXOCBfInteriorStyle:
+ case PEXOCBfInteriorStyleIndex:
+ case PEXOCBfSurfaceColourIndex:
+ case PEXOCBfSurfaceColour:
+ case PEXOCBfSurfaceReflAttr:
+ case PEXOCBfSurfaceReflModel:
+ case PEXOCBfSurfaceInterp:
+ case PEXOCSurfaceApproximation:
+ case PEXOCCullingMode:
+ case PEXOCDistinguishFlag:
+ case PEXOCPatternSize:
+ case PEXOCPatternRefPt:
+ case PEXOCPatternAttr:
+ case PEXOCInteriorBundleIndex:
+ case PEXOCSurfaceEdgeFlag:
+ case PEXOCSurfaceEdgeType:
+ case PEXOCSurfaceEdgeWidth:
+ case PEXOCSurfaceEdgeColourIndex:
+ case PEXOCSurfaceEdgeColour:
+ case PEXOCEdgeBundleIndex:
+ case PEXOCSetAsfValues:
+ case PEXOCLocalTransform:
+ case PEXOCLocalTransform2D:
+ case PEXOCGlobalTransform:
+ case PEXOCGlobalTransform2D:
+ case PEXOCModelClip:
+ case PEXOCModelClipVolume:
+ case PEXOCModelClipVolume2D:
+ case PEXOCRestoreModelClip:
+ case PEXOCViewIndex:
+ case PEXOCLightState:
+ case PEXOCDepthCueIndex:
+ case PEXOCPickId:
+ case PEXOCHlhsrIdentifier:
+ case PEXOCColourApproxIndex:
+ case PEXOCRenderingColourModel:
+ case PEXOCParaSurfCharacteristics:
+ case PEXOCAddToNameSet:
+ case PEXOCRemoveFromNameSet:
+ /* if a Proprietary OC call the correct routine */
+ if (MI_HIGHBIT_ON(MISTR_EL_TYPE (elemPtr))) {
+ pRend->executeOCs[MI_OC_PROP]( pRend,
+ (ddPointer)&(MISTR_EL_DATA (elemPtr)));
+ }
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE (elemPtr)))
+ pRend->executeOCs[(int) MISTR_EL_TYPE (elemPtr)]( pRend,
+ (ddPointer)&(MISTR_EL_DATA (elemPtr)));
+ else
+ err = !Success;
+ }
+
+ if (err != Success)
+ return( PEXERR(PEXOutputCommandError) );
+
+ break;
+ default:
+ break;
+ }
+
+ elemPtr = MISTR_NEXT_EL (elemPtr);
+ }
+
+ elemRef++;
+ }
+
+ return(err);
+}
+
+
+/*++
+ |
+ | Function Name: init_def_matrix
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+init_def_matrix (matrix)
+ddFLOAT matrix[4][4];
+{
+ memcpy( (char *) matrix, (char *) ident4x4, 16 * sizeof(ddFLOAT));
+}
+
+
+/*++
+ |
+ | Function Name: init_pipeline
+ |
+ | Function Description:
+ | does stuff common to BeginRendering, BeginPicking, BeginSearching
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+init_pipeline(pRend, pDrawable)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ DrawablePtr pDrawable;/* pointer to drawable */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+ ddPCAttr *ppca;
+ listofObj *pMC, *pLS;
+
+#ifdef DDTEST
+ ErrorF( " init_pipeline\n");
+#endif
+
+ /*
+ * check that drawable is OK for renderer this means it's ok for the
+ * luts, ns, and GC since they are ok for the example drawable
+ */
+
+ /* empty current path */
+ PU_EMPTY_LIST(pRend->curPath);
+
+ /*
+ * Initialize ddcontext.
+ */
+ ppca = pddc->Dynamic->pPCAttr;
+ pMC = ppca->modelClipVolume;
+ pLS = ppca->lightState;
+ if (pRend->pPC != NULL) {
+ *ppca = *pRend->pPC->pPCAttr;
+ /*
+ * don't forget the model clip half planes and list of
+ * light sources, which are only pointed to
+ */
+ if (puCopyList(pRend->pPC->pPCAttr->modelClipVolume, pMC))
+ return(BadAlloc);
+ if (puCopyList(pRend->pPC->pPCAttr->lightState, pLS))
+ return(BadAlloc);
+ } else { /* use default PC values */
+ MI_GET_DEFAULT_PC(&defaultPCAttr);
+ *ppca = defaultPCAttr;
+ /*
+ * don't forget the model clip half planes and list of
+ * light sources, which are only pointed to
+ */
+ if (puCopyList(defaultPCAttr.modelClipVolume, pMC))
+ return(BadAlloc);
+ if (puCopyList(defaultPCAttr.lightState, pLS))
+ return(BadAlloc);
+ }
+ ppca->modelClipVolume = pMC;
+ ppca->lightState = pLS;
+
+ /* copy the current name set from the ns resource to the renderer */
+ MINS_EMPTY_NAMESET(pddc->Dynamic->currentNames);
+ if (ppca->pCurrentNS)
+ {
+ miNSHeader *pns = (miNSHeader *)ppca->pCurrentNS->deviceData;
+
+ MINS_COPY_NAMESET(pns->names, pddc->Dynamic->currentNames);
+ }
+
+ /* set the filter_flags in pddc for high, invis, pick, search */
+ mi_set_filters(pRend, pddc);
+
+ MI_DDC_SET_DO_PRIMS(pRend, pddc);
+
+ /* this must be called before the rendering state is set
+ * and after the filters are set */
+
+ MI_SET_ALL_CHANGES(pRend);
+ ValidateRenderer(pRend);
+
+ /*
+ * Compute composite 4x4s for use in the rendering pipeline
+ * Computed composites: 1. [GM][LM] = [CMM] or mc_to_wc_xform
+ * 2. [VO][VM] = [VOM] or wc_to_npc_xform
+ * 3. [CMM][VOM] = [VCM] or mc_to_npc_xform
+ * Reminder: [GM] and [LM] are in pipeline context, [VO]
+ * and [VM] are in the View LUT indexed by the
+ * view index set in the pipeline context.
+ */
+
+ /* Compute the composite [CMM] next */
+ miMatMult (pddc->Dynamic->mc_to_wc_xform,
+ pddc->Dynamic->pPCAttr->localMat,
+ pddc->Dynamic->pPCAttr->globalMat);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: BeginRendering
+ |
+ | Function Description:
+ | Supports the PEXBeginRendering request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+BeginRendering(pRend, pDrawable)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ DrawablePtr pDrawable;/* pointer to drawable */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+
+#ifdef DDTEST
+ ErrorF( " BeginRendering\n");
+#endif
+
+ pRend->render_mode = MI_REND_DRAWING;
+
+ init_pipeline(pRend, pDrawable);
+
+ /*
+ * Determine the npc -> dc viewport transform
+ */
+ miBldViewport_xform(pRend, pDrawable, pddc->Static.misc.viewport_xform, pddc );
+
+ /*
+ * compute cc xform, concatenate to appropriate dd context matrices.
+ */
+ miBldCC_xform(pRend, pddc);
+
+ /*
+ * Clear the window if clearI flag is on.
+ * Use the background color in the renderer attributes.
+ * The default (0) entry in the Color Approx Table is used
+ * to compute the pixel.
+ */
+ if (pRend->clearI) {
+
+ unsigned long colorindex, gcmask;
+ GCPtr pGC;
+ extern GCPtr CreateScratchGC();
+ extern int ChangeGC();
+ extern void ValidateGC();
+ xRectangle xrect;
+ DrawablePtr pDraw;
+ xRectangle *xrects, *p;
+ ddDeviceRect *ddrects;
+ ddLONG numrects;
+ int i;
+ ddTableIndex colourApproxIndex;
+
+ pDraw = pRend->pDrawable;
+ if ((!pRend->pPC) || (!pRend->pPC->pPCAttr)) colourApproxIndex = 0;
+ else colourApproxIndex = pRend->pPC->pPCAttr->colourApproxIndex;
+ miColourtoIndex(pRend, colourApproxIndex,
+ &pRend->backgroundColour, &colorindex);
+ pGC = CreateScratchGC(pDraw->pScreen, pDraw->depth);
+ gcmask = GCForeground;
+ ChangeGC(pGC, gcmask, &colorindex);
+ /* Set the Clip List if there is one */
+ numrects = pRend->clipList->numObj;
+ if (numrects) {
+ ddrects = (ddDeviceRect *) pRend->clipList->pList;
+ xrects = (xRectangle*) xalloc(numrects * sizeof(xRectangle));
+ if (!xrects) return BadAlloc;
+ /* Need to convert to XRectangle format and flip Y */
+ for (i = 0, p = xrects; i < numrects; i++, p++, ddrects++) {
+ p->x = ddrects->xmin;
+ p->y = pDraw->height - ddrects->ymax;
+ p->width = ddrects->xmax - ddrects->xmin + 1;
+ p->height = ddrects->ymax - ddrects->ymin + 1;
+ }
+ SetClipRects(pGC, 0, 0, (int)numrects, xrects, Unsorted);
+ xfree((char*)xrects);
+ }
+ ValidateGC(pDraw, pGC);
+ /* Now draw a filled rectangle to clear the image buffer */
+ xrect.x = 0;
+ xrect.y = 0;
+ xrect.width = pDraw->width;
+ xrect.height = pDraw->height;
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &xrect);
+ gcmask = GCClipMask;
+ colorindex = 0;
+ ChangeGC(pGC, gcmask, &colorindex);
+ FreeScratchGC(pGC);
+ }
+
+ /* do double buffering stuff */
+ /* do hlhsr stuff */
+
+ pRend->state = PEXRendering;
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: EndRendering
+ |
+ | Function Description:
+ | Supports the PEXEndRendering request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+EndRendering(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+
+#ifdef DDTEST
+ ErrorF( " EndRendering\n");
+#endif
+
+ pRend->state = PEXIdle;
+ /* switch display buffers if doing multi-buffers */
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: BeginStructure
+ |
+ | Function Description:
+ | Supports the PEXBeginStructure request.
+ |
+ | Note(s):
+ | This procedure creates a new ddcontext which looks like the
+ | old (current) context.
+ |
+ | Since some of these elements contain and/or are pointers to
+ | objects, the info cannot be copied directly, but new objects
+ | must be made to be pointed to and their contents copied.
+ | So, the sequence that this procedure goes through is this:
+ | create a new dd context data structure
+ | copy old context to the new context, but remember
+ | that pointers to objects will be replaced.
+ | create a new PCAttr structure and copy old to new
+ | update the current path and transform matrices
+ | push the new context onto the stack
+ |
+ --*/
+
+ddpex3rtn
+BeginStructure(pRend, sId)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ ddResourceId sId; /* structure id */
+/* out */
+{
+ ddpex3rtn PushddContext();
+ ddpex3rtn err = Success;
+ ddElementRef newRef;
+ ddpex3rtn status;
+ XID fakeStrID;
+ diStructHandle fakeStr;
+ ddPickPath fakeStrpp, sIDpp, *curpp;
+
+
+#ifdef DDTEST
+ ErrorF( " BeginStructure %d\n", sId);
+#endif
+
+ /* if renderer idle ignore.... */
+ if (pRend->state == PEXIdle)
+ return Success;
+
+ /*
+ * Push the current ddContext attributes onto the stack and create
+ * a new instance of these attributes.
+ */
+ if (status = PushddContext(pRend)) return(status);
+
+ /* update offset of existing path to count execute structure element */
+ if (pRend->curPath->numObj)
+ ((ddElementRef *)pRend->curPath->pList)[pRend->curPath->numObj-1].offset++;
+
+ /** Add a new element to the cur_path for the new structure **/
+ /* sid is really an id not a handle*/
+ newRef.structure = (diStructHandle)sId;
+ newRef.offset = 0;
+
+ /* puAddToList returns 0 if it's successful, other there's an error */
+ if (puAddToList((ddPointer)&newRef, (ddULONG)1, pRend->curPath))
+ {
+ return (BadAlloc);
+ }
+
+ /* when doing client side picking fake structures must be allocated
+ and the correspondence between their structure handles and IDs
+ saved for later lookup by the appropriate EndPick routine
+ */
+ if ((pRend->state == PEXPicking) && (pRend->pickstr.server == DD_CLIENT)) {
+
+ /* bump up the offset in the current element to simulate ExecStr */
+ curpp = (ddPickPath *)(pRend->pickstr.fakeStrlist)->pList;
+ curpp[(pRend->pickstr.fakeStrlist)->numObj-1].offset++;
+
+ /* allocate a new fake structure and add to both lists */
+ fakeStr = (diStructHandle)xalloc((unsigned long)
+ sizeof(ddStructResource));
+ if (!fakeStr) return (BadAlloc);
+ fakeStr->id = -666;
+ err = CreateStructure(fakeStr);
+ if (err != Success) {
+ xfree((pointer)(fakeStr));
+ return (err);
+ }
+
+ fakeStrpp.structure = fakeStr;
+ fakeStrpp.offset = 0;
+ fakeStrpp.pickid = 0;
+ err = puAddToList((ddPointer) &fakeStrpp, (ddULONG) 1, pRend->pickstr.fakeStrlist);
+ if (err != Success) {
+ xfree((pointer)(fakeStr));
+ return (err);
+ }
+
+ sIDpp.structure = fakeStr;
+ sIDpp.offset = 0;
+ /* Store the supplied structure ID here for retrieval at EndPick */
+ sIDpp.pickid = sId;
+ err = puAddToList((ddPointer) &sIDpp, (ddULONG) 1, pRend->pickstr.sIDlist);
+ if (err != Success) {
+ xfree((pointer)(fakeStr));
+ return (err);
+ }
+
+ }
+ return (Success);
+} /* BeginStructure */
+
+/*++
+ |
+ | Function Name: EndStructure
+ |
+ | Function Description:
+ | Supports the PEXEndStructure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+EndStructure(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+ ddpex3rtn PopddContext();
+ ddpex3rtn status;
+ miStructPtr pheader;
+ diStructHandle sh = 0;
+ ddPickPath *strpp;
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+
+
+
+
+#ifdef DDTEST
+ ErrorF( " EndStructure\n");
+#endif
+
+ /* if renderer idle ignore.... */
+ if (pRend->state == PEXIdle)
+ return Success;
+
+ /* if there is no next then BeginStructure has not been
+ called so simply ignore this EndStructure call....
+ */
+ if (pddc->Dynamic->next == NULL)
+ return Success;
+
+ /*
+ * Pop ddContext off stack - retrieve attributes for current structure */
+ if (status = PopddContext(pRend)) return (status);
+
+ /*
+ * could put more intelligence here,
+ * but for now assume everything changes
+ */
+ MI_SET_ALL_CHANGES(pRend);
+ ValidateRenderer(pRend);
+
+ /** Remove the last currentPath element from the renderer **/
+ PU_REMOVE_LAST_OBJ(pRend->curPath);
+
+ if ((pRend->state == PEXPicking) && (pRend->pickstr.server == DD_CLIENT)) {
+
+ /* the fake structure can not be freed until End Picking
+ since otherwise that chunk of memory could be allocated
+ to another client provided sID thus destroying the 1 to 1
+ mapping that the sIDlist counts up, so just remove the info
+ for the structure from the fakeStrlist. The handle and ID
+ must stay on the sID list until after the reply is processed
+ */
+ PU_REMOVE_LAST_OBJ(pRend->pickstr.fakeStrlist);
+ }
+
+ return (Success);
+
+} /* EndStructure */
+
+static void
+set_highlight_colours(pRend, pddc)
+ ddRendererPtr pRend;
+ miDDContext *pddc;
+{
+ pddc->Static.attrs->lineColour = pddc->Static.misc.highlight_colour;
+ pddc->Static.attrs->edgeColour = pddc->Static.misc.highlight_colour;
+ pddc->Static.attrs->markerColour = pddc->Static.misc.highlight_colour;
+ pddc->Static.attrs->surfaceColour = pddc->Static.misc.highlight_colour;
+ pddc->Static.attrs->textColour = pddc->Static.misc.highlight_colour;
+
+ pddc->Static.misc.flags |= POLYLINEGCFLAG;
+ pddc->Static.misc.flags |= EDGEGCFLAG;
+ pddc->Static.misc.flags |= MARKERGCFLAG;
+ pddc->Static.misc.flags |= FILLAREAGCFLAG;
+ pddc->Static.misc.flags |= TEXTGCFLAG;
+ return;
+}
+
+static void
+unset_highlight_colours(pRend, pddc)
+ ddRendererPtr pRend;
+ miDDContext *pddc;
+{
+ ddBitmask tables, namesets, attrs;
+
+ /* not too efficient: ValidateDDContextAttrs does more than
+ * just colours
+ */
+ tables = PEXDynMarkerBundle | PEXDynTextBundle | PEXDynLineBundle
+ | PEXDynInteriorBundle | PEXDynEdgeBundle;
+ namesets = 0;
+ attrs = 0;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ return;
+}
+
+/*++
+ |
+ | Function Name: ValidateFilters
+ |
+ | Function Description:
+ | updates filters flags
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+ValidateFilters(pRend, pddc, namesets)
+ddRendererPtr pRend; /* renderer handle */
+miDDContext *pddc; /* ddPEX attribute structure */
+ddBitmask namesets;
+{
+ ddUSHORT save_flags;
+
+ if ((namesets & PEXDynHighlightNameset) ||
+ (namesets & PEXDynInvisibilityNameset) ||
+ (namesets & PEXDynHighlightNamesetContents) ||
+ (namesets & PEXDynInvisibilityNamesetContents)) {
+
+ save_flags = pddc->Dynamic->filter_flags;
+
+ mi_set_filters(pRend, pddc, namesets);
+
+ if ( (MI_DDC_IS_HIGHLIGHT(pddc)) &&
+ !(save_flags & MI_DDC_HIGHLIGHT_FLAG) )
+ /* just turned on highlighting */
+ set_highlight_colours(pRend, pddc);
+ else if ( (!(MI_DDC_IS_HIGHLIGHT(pddc))) &&
+ (save_flags & MI_DDC_HIGHLIGHT_FLAG) )
+ /* just turned off highlighting */
+ unset_highlight_colours(pRend, pddc);
+
+ MI_DDC_SET_DO_PRIMS(pRend, pddc);
+ }
+}
+
+/*++
+ |
+ | Function Name: ValidateRenderer
+ |
+ | Function Description:
+ | loads executeOC table in renderer correctly and calls
+ | to validate the ddcontext
+ |
+ | Note(s):
+ |
+ --*/
+
+ValidateRenderer(pRend)
+ ddRendererPtr pRend; /* renderer handle */
+{
+ ddpex3rtn ValidateDDContextAttrs();
+
+ miDDContext *pddc = (miDDContext *)pRend->pDDContext;
+ ddBitmask tables, namesets, attrs;
+ extern void inq_last_colour_entry();
+
+ /* load in different executeOCs if needed
+ * can do this here or in ValidateDDContextAttrs as needed
+ * eg, if there are multiple procs in a set for an oc (different
+ * ones for hollow fill areas and solid ones), then load
+ * them here or in ValidateDDContextAttrs when the attribute
+ * controlling it changes
+ */
+
+ /* set highlight colour if necessary */
+ if (pRend->tablesChanges & (PEXDynColourTable | PEXDynColourTableContents))
+ inq_last_colour_entry(pRend->lut[PEXColourLUT], &pddc->Static.misc.highlight_colour);
+
+ /* validate the attributes */
+ if (pRend->state == PEXRendering)
+ {
+ /* validate only dynamic attrs */
+ tables = pRend->tablesChanges & ~pRend->tablesMask;
+ namesets = pRend->namesetsChanges & ~pRend->namesetsMask;
+ attrs = pRend->attrsChanges & ~pRend->attrsMask;
+ ValidateFilters(pRend, pddc, namesets);
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ pRend->tablesChanges &= (~tables);
+ pRend->namesetsChanges &= (~namesets);
+ pRend->attrsChanges &= (~attrs);
+ } else
+ {
+ /* validate all attrs */
+ tables = pRend->tablesChanges;
+ namesets = pRend->namesetsChanges;
+ attrs = pRend->attrsChanges;
+ ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
+ ValidateFilters(pRend, pddc, namesets);
+ /* reset change masks */
+ MI_ZERO_ALL_CHANGES(pRend);
+ }
+}
+
+/*++
+ |
+ | Function Name: BeginPicking
+ |
+ | Function Description:
+ | Sets up the pipeline to do Picking.
+ |
+ | Note(s): This is a copy of BeginRendering with extraneous rendering
+ | stuff removed. Wherever, the code has been removed, comments
+ | have been placed to identify the removals.
+ |
+ --*/
+
+ddpex3rtn
+BeginPicking(pRend, pPM)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ diPMHandle pPM; /* pick measure */
+/* out */
+{
+ miPickMeasureStr *ppm = (miPickMeasureStr *) pPM->deviceData;
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+ DrawablePtr pDrawable = pRend->pDrawable;
+ ddPCAttr *ppca;
+ ddFLOAT inv_xform[4][4];
+
+#ifdef DDTEST
+ ErrorF( " BeginPicking\n");
+#endif
+
+ /* set device info needed for picking */
+ pddc->Static.pick.type = ppm->type;
+ pddc->Static.pick.status = ppm->status;
+ switch (ppm->type)
+ {
+ case PEXPickDeviceDC_HitBox:
+ pddc->Static.pick.data_rec.dc_data_rec =
+ ppm->data_rec.dc_data_rec;
+ pddc->Static.pick.input_rec.dc_hit_box =
+ ppm->input_rec.dc_hit_box;
+ break;
+
+ case PEXPickDeviceNPC_HitVolume:
+ pddc->Static.pick.data_rec.npc_data_rec =
+ ppm->data_rec.npc_data_rec;
+ pddc->Static.pick.input_rec.npc_hit_volume =
+ ppm->input_rec.npc_hit_volume;
+ break;
+ }
+
+ MINS_EMPTY_NAMESET(pddc->Static.pick.inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.pick.exclusion);
+ if (ppm->incl_handle) {
+ miNSHeader *pns = (miNSHeader *)ppm->incl_handle->deviceData;
+ MINS_COPY_NAMESET(pns->names, pddc->Static.pick.inclusion);
+ }
+ if (ppm->excl_handle) {
+ miNSHeader *pns = (miNSHeader *)ppm->excl_handle->deviceData;
+ MINS_COPY_NAMESET(pns->names, pddc->Static.pick.exclusion);
+ }
+
+/* load picking procs into executeOCs */
+
+ memcpy( (char *)pRend->executeOCs,
+ (char *)PickExecuteOCTable,
+ sizeof(ocTableType)*OCTABLE_LENGTH);
+
+ pRend->render_mode = MI_REND_PICKING;
+
+ /* make sure this gets initialized for every pick */
+ pRend->pickstr.more_hits = PEXNoMoreHits;
+
+
+ /*
+ * Reinitialize level 1 procedure jump table for PICKING !
+ */
+ memcpy( (char *)pddc->Static.RenderProcs,
+ (char *)PickPrimitiveTable,
+ sizeof(RendTableType) * RENDER_TABLE_LENGTH);
+
+ init_pipeline(pRend, pDrawable);
+
+ /*
+ * Determine the npc -> dc viewport transform
+ */
+ miBldViewport_xform( pRend, pDrawable, pddc->Static.misc.viewport_xform, pddc );
+
+ /* Compute the inverse of the viewport transform to be used to */
+ /* convert DC_HitBoxes to NPC_HitVolumes. */
+
+ memcpy( (char *)inv_xform,
+ (char *)pddc->Static.misc.viewport_xform, 16*sizeof(ddFLOAT));
+ miMatInverse (inv_xform);
+ memcpy( (char *)pddc->Static.misc.inv_vpt_xform,
+ (char *) inv_xform, 16*sizeof(ddFLOAT));
+
+ /* Now, clear out the viewport transform computed above to identity */
+ /* since we are PICKING, and we do not need this to go to final ddx */
+ /* space. THIS IS IMPORTANT SINCE WE WILL BE USING THE LEVEL 2 REND-*/
+ /* ERING ROUTINES TO DO TRANSFORMATIONS AND CLIPPING. ONLY LEVEL 1 */
+ /* PICKING ROUTINES WILL ACTUALLY DO THE PICK HIT TEST IN CC. THUS */
+ /* BY MAKING THE viewport transform IDENTITY WE WILL STAY IN CC. */
+
+ memcpy( (char *) pddc->Static.misc.viewport_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* Clear out the cc_to_dc_xform also, since we will not be going to DC */
+
+ memcpy( (char *) pddc->Dynamic->cc_to_dc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG |
+ INVTRMCTOCCXFRMFLAG | INVTRCCTODCXFRMFLAG |
+ INVVIEWXFRMFLAG);
+
+ /* Mark as invalid any transform dependant fields in ddContext */
+ pddc->Static.misc.flags |= (MCVOLUMEFLAG | CC_DCUEVERSION);
+
+ /*
+ * Computation of the composite mc -> dc transform has been REMOVED.
+ */
+
+ /* do double buffering stuff */
+ /* do hlhsr stuff */
+
+ pRend->state = PEXPicking;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: EndPicking
+ |
+ | Function Description:
+ | Handles the stuff to be done after a Pick traversal.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+EndPicking(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+/* Locals */
+ miDDContext *pddc = (miDDContext *)(pRend->pDDContext);
+ ddPickPath *strpp;
+ diStructHandle sh = 0;
+ int i;
+
+
+#ifdef DDTEST
+ ErrorF( " EndPicking\n");
+#endif
+
+ if (pRend->immediateMode == TRUE) {
+ /* empty listoflist for Pick All
+ this assumes the individual pick paths lists that this
+ pointed to have already been deleted by the EndPickAll routine
+ */
+ PU_EMPTY_LIST(pRend->pickstr.list);
+
+ /* free all but the first the fake structure
+ it should always be there to support ROCs
+ */
+ strpp = (ddPickPath *)(pRend->pickstr.sIDlist)->pList;
+ for (i = 1; i < (pRend->pickstr.sIDlist)->numObj; i++) {
+ sh = strpp[i].structure;
+ DeleteStructure(sh, sh->id);
+ }
+
+ (pRend->pickstr.sIDlist)->numObj = 1;
+ }
+
+ pRend->state = PEXIdle;
+
+ pRend->render_mode = MI_REND_DRAWING;
+
+ /* copy the initial oc functions to the OC table */
+
+ memcpy( (char *)pRend->executeOCs,
+ (char *)InitExecuteOCTable,
+ sizeof(ocTableType)*OCTABLE_LENGTH);
+
+ /*
+ * Reinitialize level 1 procedure jump table for Rendering !
+ */
+ memcpy( (char *)pddc->Static.RenderProcs,
+ (char *)RenderPrimitiveTable,
+ sizeof(RendTableType) * RENDER_TABLE_LENGTH);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: InquirePickStatus
+ |
+ | Function Description:
+ | returns current pick status
+ |
+ | Note(s):
+
+ |
+ --*/
+
+/*
+#define PEX_SI_FAKE_PICK
+*/
+#ifdef PEX_SI_FAKE_PICK
+/*dummy proc to use to fake hit:
+ hit occurs when traversal depth = 3, structure offset = 3,
+ current pick id = 4
+ need p_trav_state for this, but p_trav_state will not be a
+ parameter when real picking is done
+*/
+InquirePickStatus(pRend, pStatus, p_trav_state)
+ ddRendererPtr pRend;
+ ddUSHORT *pStatus;
+ miTraverserState *p_trav_state;
+{
+ if ( (p_trav_state->max_depth == 3) &&
+ (((ddElementRef *)pRend->curPath-> pList)[pRend->curPath->numObj - 1].offset == 3) &&
+ ( ((miDDContext *)pRend->pDDContext)->Dynamic->pPCAttr->pickId == 4) )
+ *pStatus = PEXOk;
+ else
+ *pStatus = PEXNoPick;
+ return;
+}
+#else
+
+void
+InquirePickStatus(pRend, pStatus, p_trav_state)
+ ddRendererPtr pRend;
+ ddUSHORT *pStatus;
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+
+ *pStatus = pddc->Static.pick.status;
+ pddc->Static.pick.status = PEXNoPick;
+ return;
+}
+#endif
+
+/*++
+ |
+ | Function Name: BeginSearching
+ |
+ | Function Description:
+ | Sets up the pipeline to do spatial search
+ |
+ | Note(s): This is a copy of BeginRendering with extraneous rendering
+ | stuff removed. Wherever, the code has been removed, comments
+ | have been placed to identify the removals.
+ |
+ --*/
+
+ddpex3rtn
+BeginSearching(pRend, pSC)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+ ddSCStr *pSC; /* search context */
+/* out */
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+ DrawablePtr pDrawable = pRend->pDrawable;
+ ddNSPair *pPairs;
+ miNSHeader *pns;
+ register int i;
+
+#ifdef DDTEST
+ ErrorF( " BeginSearching\n");
+#endif
+
+ /* set device info needed for searching */
+ pddc->Static.search.status = PEXNotFound;
+ pddc->Static.search.position = pSC->position;
+ pddc->Static.search.distance = pSC->distance;
+ pddc->Static.search.modelClipFlag = pSC->modelClipFlag;
+
+ MINS_EMPTY_NAMESET(pddc->Static.search.norm_inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.norm_exclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.invert_inclusion);
+ MINS_EMPTY_NAMESET(pddc->Static.search.invert_exclusion);
+
+ if (pSC->normal.numPairs) {
+ pPairs = pSC->normal.pPairs;
+ for (i=0; i<pSC->normal.numPairs; i++, pPairs++ ) {
+
+ if (pPairs->incl) {
+ pns = (miNSHeader *)pPairs->incl->deviceData;
+ MINS_OR_NAMESETS(pns->names, pddc->Static.search.norm_inclusion);
+ }
+ if (pPairs->excl) {
+ pns = (miNSHeader *)pPairs->excl->deviceData;
+ MINS_OR_NAMESETS(pns->names, pddc->Static.search.norm_exclusion);
+ }
+ }
+ }
+ if (pSC->inverted.numPairs) {
+ pPairs = pSC->inverted.pPairs;
+ for (i=0; i<pSC->inverted.numPairs; i++, pPairs++ ) {
+
+ if (pPairs->incl) {
+ pns = (miNSHeader *)pPairs->incl->deviceData;
+ MINS_OR_NAMESETS(pns->names, pddc->Static.search.invert_inclusion);
+ }
+ if (pPairs->excl) {
+ pns = (miNSHeader *)pPairs->excl->deviceData;
+ MINS_OR_NAMESETS(pns->names, pddc->Static.search.invert_exclusion);
+ }
+ }
+ }
+
+ /* load searching procs into executeOCs */
+
+ memcpy( (char *)pRend->executeOCs,
+ (char *)SearchExecuteOCTable,
+ sizeof(ocTableType)*OCTABLE_LENGTH);
+
+ /*
+ * Reinitialize level 1 procedure jump table for Searching.
+ * Note that we use the same table as Picking.
+ */
+ memcpy( (char *)pddc->Static.RenderProcs,
+ (char *)PickPrimitiveTable,
+ sizeof(RendTableType) * RENDER_TABLE_LENGTH);
+
+ /* Set the model clipping flag to value in search context
+ resource */
+ pddc->Dynamic->pPCAttr->modelClip = pSC->modelClipFlag;
+
+ pRend->render_mode = MI_REND_SEARCHING;
+
+ init_pipeline(pRend, pDrawable);
+
+ /*
+ * Since searching is done in world coordinate space, we need NOT
+ * compute any of the rest of the matrices. They must all be set
+ * to identity.
+ */
+
+ memcpy( (char *) pddc->Static.misc.viewport_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->wc_to_npc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->mc_to_npc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->wc_to_cc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->cc_to_dc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->mc_to_cc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->mc_to_dc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ memcpy( (char *) pddc->Dynamic->npc_to_cc_xform,
+ (char *) ident4x4, 16 * sizeof(ddFLOAT));
+
+ /* Mark as invalid appropriate inverse transforms in dd context */
+ pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG |
+ INVTRMCTOCCXFRMFLAG | INVTRCCTODCXFRMFLAG |
+ INVVIEWXFRMFLAG);
+
+ /* Mark as invalid any transform dependant fields in ddContext */
+ pddc->Static.misc.flags |= (MCVOLUMEFLAG | CC_DCUEVERSION);
+
+ /*
+ * Computation of the composite mc -> dc transform has been REMOVED.
+ */
+
+ /* do double buffering stuff */
+ /* do hlhsr stuff */
+
+ pRend->state = PEXRendering;
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: EndSearching
+ |
+ | Function Description:
+ | Handles the stuff to be done after a search traversal.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex3rtn
+EndSearching(pRend)
+/* in */
+ ddRendererPtr pRend; /* renderer handle */
+/* out */
+{
+
+#ifdef DDTEST
+ ErrorF( " EndSearching\n");
+#endif
+
+ pRend->state = PEXIdle;
+
+ pRend->render_mode = MI_REND_DRAWING;
+ /* copy the initial oc functions to the OC table */
+ memcpy( (char *)pRend->executeOCs,
+ (char *)InitExecuteOCTable,
+ sizeof(ocTableType)*OCTABLE_LENGTH);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: InquireSearchStatus
+ |
+ | Function Description:
+ | returns current spatial search status
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+InquireSearchStatus(pRend, pStatus)
+ ddRendererPtr pRend;
+ ddUSHORT *pStatus; /* PEXFound or PEXNotFound */
+{
+ miDDContext *pddc = (miDDContext *) pRend->pDDContext;
+
+ *pStatus = pddc->Static.search.status;
+ return;
+}
+
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRndrPick.c b/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRndrPick.c
new file mode 100644
index 000000000..d3e7358fd
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level3/miRndrPick.c
@@ -0,0 +1,502 @@
+/* $TOG: miRndrPick.c /main/12 1998/02/10 12:43:20 kaleb $ */
+
+/************************************************************
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level3/miRndrPick.c,v 1.7 1998/10/04 09:34:37 dawes Exp $ */
+
+#include "miLUT.h"
+#include "ddpex3.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "pexExtract.h"
+#include "PEXErr.h"
+#include "pexUtils.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "miscstruct.h"
+#include "miRender.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "miWks.h"
+#include "ddpex4.h"
+#include "pexos.h"
+
+
+/* External variables used */
+
+extern void mi_set_filters();
+extern void miMatMult();
+extern ddpex3rtn miBldViewport_xform();
+extern ddpex3rtn miBldCC_xform();
+extern ocTableType ParseOCTable[];
+extern void (*DestroyOCTable[])();
+extern ocTableType InitExecuteOCTable[];
+extern ocTableType PickExecuteOCTable[];
+extern ocTableType SearchExecuteOCTable[];
+extern RendTableType RenderPrimitiveTable[];
+extern RendTableType PickPrimitiveTable[];
+
+
+/* Level III Renderer Pick Procedures */
+
+/*++
+|
+| Function Name: CreatePseudoPickMeasure
+|
+| Function Description:
+| Create a Pick Measure for Renderer Picking use
+|
+| Note(s):
+|
+--*/
+
+ddpex3rtn
+CreatePseudoPickMeasure( pRend)
+ddRendererPtr pRend; /* renderer handle */
+{
+ register miPickMeasureStr *ppm;
+
+ ppm = (miPickMeasureStr *) xalloc(sizeof(miPickMeasureStr));
+ if (!ppm) return (BadAlloc);
+
+ ppm->path = puCreateList(DD_PICK_PATH);
+ if (!ppm->path) {
+ xfree(ppm);
+ return (BadAlloc);
+ }
+
+ /* initialize pointers to NULL values */
+ ppm->pWks = 0;
+ /* initialize type to an out of range value */
+ ppm->type = -1;
+ ppm->status = PEXNoPick;
+ ppm->pathOrder = PEXTopFirst;
+ ppm->incl_handle = 0;
+ ppm->excl_handle = 0;
+ ppm->devPriv = (ddPointer) NULL;
+
+ (pRend->pickstr.pseudoPM)->deviceData = (ddPointer) ppm;
+ return(Success);
+}
+
+
+/*++
+|
+| Function Name: ChangePseudoPickMeasure
+|
+| Function Description:
+| Change a Pick Measure for Renderer Picking use
+|
+| Note(s):
+|
+--*/
+
+ddpex3rtn
+ChangePseudoPickMeasure( pRend, pRec)
+ddRendererPtr pRend; /* renderer handle */
+ddPickRecord *pRec; /* PickRecord */
+{
+ register miPickMeasureStr *ppm;
+
+ ppm = (miPickMeasureStr *) (pRend->pickstr.pseudoPM)->deviceData;
+
+ if (!ppm->path) {
+ ppm->path = puCreateList(DD_PICK_PATH);
+ if (!ppm->path) {
+ xfree(ppm);
+ return (BadAlloc);
+ }
+ } else {
+ if (puCopyList(pRend->pickStartPath, ppm->path)) {
+ puDeleteList(ppm->path);
+ xfree(ppm);
+ return (BadAlloc);
+ }
+ }
+ ppm->incl_handle = pRend->ns[DD_PICK_INCL_NS];
+ ppm->excl_handle = pRend->ns[DD_PICK_EXCL_NS];
+
+ if (ppm->incl_handle)
+ UpdateNSRefs( ppm->incl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ if (ppm->excl_handle)
+ UpdateNSRefs( ppm->excl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ /* now store the pick record */
+ ppm->type = pRec->pickType;
+ switch (ppm->type) {
+ case PEXPickDeviceDC_HitBox:
+ memcpy( (char *)&(ppm->input_rec.dc_hit_box),
+ (char *)&(pRec->hit_box.DC_HitBox),
+ sizeof(pexPD_DC_HitBox));
+ break;
+
+ case PEXPickDeviceNPC_HitVolume:
+ memcpy( (char *)&(ppm->input_rec.npc_hit_volume),
+ (char *)&(pRec->hit_box.NPC_HitVolume),
+ sizeof(pexPD_NPC_HitVolume));
+ break;
+ }
+
+
+ ppm->status = PEXNoPick;
+
+ return(Success);
+}
+
+ddpex3rtn
+EndPickOne( pRend, pBuffer, numPickElRefs, pickStatus, betterPick)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+/* out */
+ddBufferPtr pBuffer; /* list of pick element ref */
+ddULONG *numPickElRefs;
+ddUSHORT *pickStatus;
+ddUSHORT *betterPick;
+{
+ ddpex3rtn err = Success;
+ miPickMeasureStr *ppm;
+ int numbytes, i, j;
+ ddPickPath *per;
+ pexPickElementRef *dest;
+ ddPickPath *sIDpp;
+
+ ppm = (miPickMeasureStr *) (pRend->pickstr.pseudoPM)->deviceData;
+ *numPickElRefs = 0;
+ *pickStatus = ppm->status;
+ *betterPick = 0;
+
+ if (ppm->status == PEXOk && ppm->path) { /* we have a pick */
+
+ /* send back the number of objects */
+ *numPickElRefs = ppm->path->numObj;
+
+ /* Now, tack on the list of Element Refs to the back of the reply
+ Note that we do NOT include the length of the list.
+ The length is found in the reply itself.
+ */
+ numbytes = sizeof(ddPickPath) * ppm->path->numObj;
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, numbytes);
+ /* Copy the Pick Path to the buffer */
+ for (per = (ddPickPath*) ppm->path->pList,
+ dest = (pexPickElementRef*) pBuffer->pBuf, i=0;
+ i < ppm->path->numObj; per++, dest++, i++) {
+
+ /* if returned structure handle is in the sIDlist
+ then the pick was on a path below an immediate OC
+ so return the struct id the user sent over in the BeginPick
+ request, otherwise return the resource ID as normal
+ */
+ sIDpp = (ddPickPath *) (pRend->pickstr.sIDlist)->pList;
+ for (j = 0; j < (pRend->pickstr.sIDlist)->numObj; j++, sIDpp++) {
+ if ((diStructHandle)(per->structure) == sIDpp->structure) {
+ /* this is CORRECT, pickid is used to store the client
+ provided structure id, yes it is a kludge...
+ */
+ dest->sid = sIDpp->pickid;
+ break;
+ }
+ else
+ dest->sid = ((ddStructResource*)(per->structure))->id;
+ }
+ dest->offset = per->offset;
+ dest->pickid = per->pickid;
+ }
+
+ pBuffer->dataSize = numbytes; /* tells dipex how long the reply is */
+ }
+
+ if (ppm->path) {
+ puDeleteList(ppm->path);
+ ppm->path = NULL;
+ }
+
+ if (ppm->incl_handle)
+ UpdateNSRefs( ppm->incl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ if (ppm->excl_handle)
+ UpdateNSRefs( ppm->excl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+
+ return(err);
+}
+
+
+ddpex3rtn
+PickOne( pRend)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+{
+ ddpex3rtn err = Success;
+ ddElementRange range;
+ miStructPtr pstruct;
+ miTraverserState trav_state;
+ diPMHandle pPM = (diPMHandle) NULL;
+ ddULONG offset1, offset2;
+ diStructHandle psh = pRend->pickstr.strHandle;
+
+
+ pstruct = (miStructPtr) (pRend->pickstr.strHandle)->deviceData;
+
+
+ /* now call the traverser to traverse this structure */
+ /* set exec_str_flag */
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+ pPM = pRend->pickstr.pseudoPM;
+
+ offset1 = 1;
+ offset2 = MISTR_NUM_EL(pstruct);
+
+ err = traverser(pRend, psh, offset1, offset2, pPM, NULL, &trav_state);
+
+ return(err);
+}
+
+ddpex3rtn
+EndPickAll( pRend, pBuffer)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+/* out */
+ddBufferPtr pBuffer; /* list of pick element ref */
+{
+ ddpex3rtn err = Success;
+
+ pexEndPickAllReply *reply = (pexEndPickAllReply *)(pBuffer->pHead);
+ int i, j, k, numbytes = 0, pbytes, numObj;
+ listofObj *list;
+ listofObj **listofp;
+ ddPickPath *pp, *sIDpp;
+ ddPointer pplist;
+ ddPickElementRef ref;
+ miPickMeasureStr *ppm;
+
+ ppm = (miPickMeasureStr *) (pRend->pickstr.pseudoPM)->deviceData;
+
+ reply->numPicked = (pRend->pickstr.list)->numObj;
+ reply->pickStatus = ((pRend->pickstr.list)->numObj) ?1:0;
+ reply->morePicks = pRend->pickstr.more_hits;
+
+ numObj = (pRend->pickstr.list)->numObj;
+ listofp = (listofObj **)(pRend->pickstr.list)->pList;
+
+ /* convert the pick path to a pick element ref for return */
+ for (i = 0; i < numObj; i++) {
+ list = listofp[0];
+ pbytes = list->numObj * sizeof(ddPickElementRef);
+ numbytes += pbytes + sizeof(CARD32);
+ PU_CHECK_BUFFER_SIZE(pBuffer, numbytes);
+ PACK_CARD32(list->numObj, pBuffer->pBuf);
+ pplist = list->pList;
+
+ /* now convert each pick path to a pick element ref */
+ /* and pack it into the reply buffer */
+ for (j = 0; j < list->numObj; j++) {
+ pp = (ddPickPath *) pplist;
+ pplist = (ddPointer)(pp+1);
+ sIDpp = (ddPickPath *) (pRend->pickstr.sIDlist)->pList;
+ for (k = 0; k < (pRend->pickstr.sIDlist)->numObj; k++, sIDpp++) {
+ if ((diStructHandle)(pp->structure) == sIDpp->structure) {
+ /* this is CORRECT, pickid is used to store the client
+ provided structure id, yes it is a kludge...
+ */
+ ref.sid = sIDpp->pickid;
+ break;
+ }
+ else
+ ref.sid = ((ddStructResource *)(pp->structure))->id;
+ }
+ ref.offset = pp->offset;
+ ref.pickid = pp->pickid;
+ PACK_STRUCT(ddPickElementRef, &ref, pBuffer->pBuf);
+ }
+
+ /* remove the list from the list of list */
+ puRemoveFromList( (ddPointer) &list, pRend->pickstr.list);
+
+ /* if there are more hits when doing a server side pick all
+ save the last hit into the start path
+ */
+ if ((pRend->pickstr.more_hits == PEXMoreHits) && (i == numObj-1)
+ && (pRend->pickstr.server == DD_SERVER))
+ pRend->pickStartPath = list;
+ else
+ puDeleteList( list);
+
+ }
+
+ /* if there were no more hits empty the pickStartPath */
+ if (pRend->pickstr.more_hits == PEXNoMoreHits) {
+ PU_EMPTY_LIST(pRend->pickStartPath);
+ }
+
+ pRend->pickstr.more_hits = PEXNoMoreHits;
+ pBuffer->dataSize = numbytes;
+
+ if (ppm->incl_handle)
+ UpdateNSRefs( ppm->incl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ if (ppm->excl_handle)
+ UpdateNSRefs( ppm->excl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+
+ return(err);
+}
+
+
+ddpex3rtn
+PickAll( pRend)
+/* in */
+ddRendererPtr pRend; /* renderer handle */
+{
+ ddpex3rtn err = Success;
+ miTraverserState trav_state;
+ ddULONG offset1, offset2, numberOCs;
+ diStructHandle pstruct = 0;
+ miStructPtr pheader;
+ ddPickPath *pp;
+ diPMHandle pPM = (diPMHandle) NULL;
+ ddpex3rtn ValidatePickPath();
+
+ if (!pRend->pickStartPath) return (PEXERR(PEXPathError));
+ err = ValidatePickPath(pRend->pickStartPath);
+ if (err != Success) return(err);
+
+ /* now call the traverser to traverse this structure */
+ /* set exec_str_flag */
+ trav_state.exec_str_flag = ES_FOLLOW_PICK;
+ trav_state.p_curr_pick_el = (ddPickPath *) pRend->pickStartPath->pList ;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+ pPM = pRend->pickstr.pseudoPM;
+
+ pp = (ddPickPath *) pRend->pickStartPath->pList ;
+ pstruct = pp->structure;
+ pheader = (miStructPtr) pstruct->deviceData;
+
+ offset1 = 1;
+ offset2 = MISTR_NUM_EL(pheader);
+
+ err = traverser(pRend, pstruct, offset1, offset2, pPM, NULL, &trav_state);
+
+ return(err);
+}
+
+ddpex3rtn
+AddPickPathToList( pRend, depth, path)
+ddRendererPtr pRend; /* renderer handle */
+int depth; /* pick path depth */
+miPPLevel *path; /* the path */
+{
+ listofObj *list;
+ int i, err;
+ ddPickPath *patharray;
+
+
+ /* dont know what this is supposed to do */
+ if ((pRend->pickstr.list)->numObj >= pRend->pickstr.max_hits) {
+ pRend->pickstr.more_hits = PEXMoreHits;
+ return;
+ }
+ else pRend->pickstr.more_hits = PEXNoMoreHits;
+
+ /* allocate space to store path while reversing */
+ patharray = (ddPickPath *) xalloc(depth * sizeof(ddPickPath));
+
+ /* create list to place the path into */
+ list = puCreateList(DD_PICK_PATH);
+
+ /* traverse the list from bottom up and copy into temp store */
+ for (i = 0; i < depth; i++){
+ patharray[i] = path->pp;
+ path = path->up;
+ }
+
+ /* now store the path from top down */
+ for (i = depth-1; i >= 0; i--){
+ err = puAddToList((ddPointer) &patharray[i], (ddULONG) 1, list);
+ if (err != Success) return(err);
+ }
+
+ xfree(patharray);
+
+ err = puAddToList( (ddPointer) &list, (ddULONG) 1, pRend->pickstr.list);
+ if (err != Success) return(err);
+
+ if ((pRend->pickstr.send_event) &&
+ ((pRend->pickstr.list)->numObj == pRend->pickstr.max_hits))
+ err = PEXMaxHitsReachedNotify( pRend->pickstr.client, pRend->rendId);
+
+ return(err);
+}
+
+ddpex3rtn
+ValidatePickPath(pPath)
+ listofObj *pPath;
+{
+ miGenericElementPtr p_element;
+ diStructHandle pStruct, pNextStruct;
+ miStructPtr pstruct;
+ ddULONG offset;
+ int i;
+ ddPickPath *pPickPath;
+
+
+ pPickPath = (ddPickPath *) pPath->pList;
+ pNextStruct = pPickPath->structure;
+
+ for (i = pPath->numObj; i > 0; i--, pPickPath++) {
+ pStruct = pPickPath->structure;
+ if (pNextStruct != pStruct) return (PEXERR(PEXPathError));
+
+ pstruct = (miStructPtr) pStruct->deviceData;
+
+ offset = pPickPath->offset;
+ if (offset > MISTR_NUM_EL(pstruct)) return (PEXERR(PEXPathError));
+
+ /* dont bother with the leaves */
+ if (i == 1) break;
+
+ MISTR_FIND_EL(pstruct, offset, p_element);
+
+ if (MISTR_EL_TYPE(p_element) != PEXOCExecuteStructure)
+ return (PEXERR(PEXPathError));
+
+ pNextStruct = (diStructHandle) MISTR_GET_EXSTR_STR(p_element);
+ }
+ return (Success);
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile
new file mode 100644
index 000000000..2d81ad09d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile
@@ -0,0 +1,82 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/11 1996/09/28 16:54:25 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile,v 3.11 1999/07/04 06:38:31 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM or the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDdpexCDebugFlags
+#define PexDdpexCDebugFlags ServerCDebugFlags
+#endif
+
+XCOMM -D defines for ddpex:
+XCOMM DDTEST turns on some fprintf(stderr...)s for debugging
+
+ DEFINES = PexDdpexDefines
+EXT_DEFINES = ExtensionDefines
+DEPEND_DEFINES = $(EXT_DEFINES)
+CDEBUGFLAGS = PexDdpexCDebugFlags
+
+ PEXSERVINC = ../../../include
+DDPEXINCLUDE = ../include
+
+INCLUDES = -I. \
+ -I$(DDPEXINCLUDE) \
+ -I$(XINCLUDESRC) \
+ -I$(PEXSERVINC) \
+ -I$(SERVERSRC)/include
+
+SRCS = miPick.c \
+ miSC.c \
+ miStruct.c \
+ miTraverse.c \
+ miWks.c \
+ miDynamics.c \
+ css_plain.c \
+ css_ex_str.c \
+ css_tbls.c
+
+OBJS = miPick.o \
+ miSC.o \
+ miStruct.o \
+ miTraverse.o \
+ miWks.o \
+ miDynamics.o \
+ css_plain.o \
+ css_ex_str.o \
+ css_tbls.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ddpex4,$(OBJS))
+
+LintLibraryTarget(dp4,$(SRCS))
+NormalLintTarget($(SRCS))
+
+SpecialCObjectRule(miWks,$(ICONFIGFILES),$(EXT_DEFINES))
+
+DependTarget()
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_ex_str.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_ex_str.c
new file mode 100644
index 000000000..285f86f1f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_ex_str.c
@@ -0,0 +1,309 @@
+/* $TOG: css_ex_str.c /main/3 1998/02/10 12:43:24 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/css_ex_str.c,v 1.8 1999/01/31 12:21:28 dawes Exp $ */
+/*
+ * this file contains the element handling procedures for
+ * the execute structure element. It is stored in PEX format
+ * but needs special handling
+ */
+
+#include "ddpex.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+extern ocTableType ParseOCTable[];
+extern ocTableType CopyOCTable[];
+extern ocTableType InquireOCTable[];
+
+extern void miRemoveWksFromAppearLists();
+extern int miAddWksToAppearLists();
+extern ddpex4rtn destroyCSS_Plain();
+
+#define SET_STR_HEADER(pStruct, pheader) \
+ register miStructPtr pheader = (miStructPtr) pStruct->deviceData
+
+#define PEX_EL_TYPE(POC) ((ddElementInfo *)(POC))->elementType
+
+/* must have err, i and ppwks defined to use this macro */
+#define ADD_WKS( plist, pstr ) \
+ if (puAddToList((ddPointer)(plist)->pList, (ddULONG)(plist)->numObj, \
+ ((miStructPtr)(pstr)->deviceData)->wksAppearOn) == MI_ALLOCERR) \
+ return(MI_ALLOCERR); \
+ for ( i=(plist)->numObj, ppwks=(diWKSHandle *)(plist)->pList; \
+ i > 0; \
+ i--, ppwks++) \
+ if ((err = miAddWksToAppearLists( (pstr), *ppwks )) != MI_SUCCESS) \
+ return(err)
+
+/* must have i and ppwks defined to use this macro */
+#define REMOVE_WKS( plist, pstr ) \
+ for ( i=(plist)->numObj, ppwks=(diWKSHandle *)(plist)->pList; \
+ i > 0; \
+ i--, ppwks++) { \
+ puRemoveFromList( (ddPointer)ppwks, \
+ ((miStructPtr)(pstr)->deviceData)->wksAppearOn); \
+ miRemoveWksFromAppearLists((pstr), *ppwks); }
+
+ddpex4rtn
+createCSS_Exec_Struct(pStruct, pPEXOC, ppCSSElement)
+/* in */
+ diStructHandle pStruct;
+ pexExecuteStructure *pPEXOC;
+/* out */
+ miGenericElementStr **ppCSSElement;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ diStructHandle pexecstr;
+ ddpex4rtn err;
+ register ddULONG i;
+ register diWKSHandle *ppwks;
+
+ *ppCSSElement = (miGenericElementPtr) NULL;
+
+ err = (*ParseOCTable[PEX_EL_TYPE(pPEXOC)]) (pPEXOC, ppCSSElement);
+
+ if (err != Success)
+ return (err);
+
+ /*
+ * update the structure cross reference lists the id in execute
+ * structure elements was replaced with the diStructHandle by diPEX
+ */
+ pexecstr = *((diStructHandle *)&(pPEXOC->id));
+
+ /* update pStructs children list */
+ err = UpdateStructRefs(pStruct, (diResourceHandle) pexecstr,
+ CHILD_STRUCTURE_RESOURCE, ADD);
+ if (err != Success)
+ return (err);
+
+ /* update the executed structs parent list */
+ err = UpdateStructRefs(pexecstr, (diResourceHandle) pStruct,
+ PARENT_STRUCTURE_RESOURCE, ADD);
+ if (err != Success)
+ return (err);
+
+ /* update the wks appears on lists of the subordinate structure */
+ ADD_WKS(pheader->wksPostedTo, pexecstr);
+ ADD_WKS(pheader->wksAppearOn, pexecstr);
+
+ (*ppCSSElement)->pStruct = pStruct;
+ (*ppCSSElement)->element.pexOClength =
+ ((ddElementInfo *) pPEXOC)->length; /* protocol size, not
+ * parsed size */
+ (*ppCSSElement)->element.elementType =
+ ((ddElementInfo *) pPEXOC)->elementType;
+
+ MISTR_NUM_EL(pheader)++;
+ MISTR_LENGTH(pheader) += ((ddElementInfo *) pPEXOC)->length;
+
+ return (Success);
+}
+
+ddpex4rtn
+destroyCSS_Exec_Struct(pStruct, pCSSElement)
+/* in */
+ diStructHandle pStruct;
+ miGenericElementPtr pCSSElement;
+/* out */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ diStructHandle pexecstr;
+ register int i;
+ register diWKSHandle *ppwks;
+
+ pexecstr = (diStructHandle) MISTR_GET_EXSTR_STR(pCSSElement);
+ /* Now remove this child from the parent's list of children */
+
+ UpdateStructRefs(pStruct, (diResourceHandle) pexecstr,
+ CHILD_STRUCTURE_RESOURCE, REMOVE);
+
+ /* and remove the parent from the childs list */
+
+ UpdateStructRefs(pexecstr, (diResourceHandle) pStruct,
+ PARENT_STRUCTURE_RESOURCE, REMOVE);
+
+ /* update the wks appears on lists of the subordinate structure */
+ REMOVE_WKS(pheader->wksPostedTo, pexecstr);
+ REMOVE_WKS(pheader->wksAppearOn, pexecstr);
+
+ return (destroyCSS_Plain(pStruct, pCSSElement));
+}
+
+ddpex4rtn
+copyCSS_Exec_Struct(pSrcCSSElement, pDestStruct, ppDestCSSElement)
+/* in */
+ miGenericElementPtr pSrcCSSElement;
+ diStructHandle pDestStruct;
+/* out */
+ miGenericElementStr **ppDestCSSElement;
+{
+ SET_STR_HEADER(pDestStruct, pheader);
+ diStructHandle pexecstr;
+ ddpex4rtn err;
+ register ddULONG i;
+ register diWKSHandle *ppwks;
+
+ *ppDestCSSElement = (miGenericElementPtr) NULL;
+
+ err = (*CopyOCTable[(int) (pSrcCSSElement->element.elementType)])
+ (pSrcCSSElement, ppDestCSSElement);
+ if (err != Success)
+ return (err);
+
+ /*
+ * update the structure cross reference lists the id in execute
+ * structure elements was replaced with the diStructHandle by diPEX
+ */
+ pexecstr = (diStructHandle) MISTR_GET_EXSTR_STR(pSrcCSSElement);
+
+ /* update pStructs children list */
+ err = UpdateStructRefs(pDestStruct, (diResourceHandle) pexecstr,
+ CHILD_STRUCTURE_RESOURCE, ADD);
+ if (err != Success)
+ return (err);
+
+ /* update the executed structs parent list */
+ err = UpdateStructRefs(pexecstr, (diResourceHandle) pDestStruct,
+ PARENT_STRUCTURE_RESOURCE, ADD);
+ if (err != Success)
+ return (err);
+
+ /* update the wks appears on lists of the subordinate structure */
+ ADD_WKS(pheader->wksPostedTo, pexecstr);
+ ADD_WKS(pheader->wksAppearOn, pexecstr);
+
+ MISTR_NUM_EL(pheader)++;
+ MISTR_LENGTH(pheader) += MISTR_EL_LENGTH(pSrcCSSElement);
+
+ (*ppDestCSSElement)->pStruct = pDestStruct;
+
+ MISTR_EL_LENGTH(*ppDestCSSElement) = MISTR_EL_LENGTH(pSrcCSSElement);
+ MISTR_EL_TYPE(*ppDestCSSElement) = MISTR_EL_TYPE(pSrcCSSElement);
+
+ return (Success);
+}
+
+ddpex4rtn
+replaceCSS_Exec_Struct(pStruct, pCSSElement, pPEXOC)
+/* in */
+ diStructHandle pStruct;
+ miGenericElementPtr pCSSElement;
+ pexExecuteStructure *pPEXOC;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ diStructHandle pexecstr;
+ ddpex4rtn err;
+ register ddULONG i;
+ register diWKSHandle *ppwks;
+
+ pexecstr = (diStructHandle) MISTR_GET_EXSTR_STR(pCSSElement);
+ if (pexecstr != *((diStructHandle *)&(pPEXOC->id))) {
+
+ /*
+ * update the structure cross reference lists the id in
+ * execute structure elements was replaced with the
+ * diStructHandle by diPEX
+ */
+
+ /* update pStructs children list REMOVE the old element */
+ UpdateStructRefs(pStruct, (diResourceHandle) pexecstr,
+ CHILD_STRUCTURE_RESOURCE, REMOVE);
+
+ /* update the executed structs parent list REMOVE the parent */
+ UpdateStructRefs(pexecstr, (diResourceHandle) pStruct,
+ PARENT_STRUCTURE_RESOURCE, REMOVE);
+
+ /*
+ * update the wks appears on lists of the subordinate
+ * structure
+ */
+ REMOVE_WKS(pheader->wksPostedTo, pexecstr);
+ REMOVE_WKS(pheader->wksAppearOn, pexecstr);
+
+ /* update the new executed structs parent list */
+ err = UpdateStructRefs( *((diStructHandle *)&(pPEXOC->id)),
+ (diResourceHandle) pStruct,
+ PARENT_STRUCTURE_RESOURCE, ADD);
+ if (err != Success) return (err);
+
+ /* update pStructs children list with the new child */
+ err = UpdateStructRefs( pStruct,
+ *((diResourceHandle *)&(pPEXOC->id)),
+ CHILD_STRUCTURE_RESOURCE, ADD);
+ if (err != Success) return (err);
+
+ /*
+ * update the wks appears on lists of the subordinate
+ * structure
+ */
+ ADD_WKS(pheader->wksPostedTo,*((diStructHandle *)&(pPEXOC->id)));
+ ADD_WKS(pheader->wksAppearOn,*((diStructHandle *)&(pPEXOC->id)));
+
+ MISTR_PUT_EXSTR_STR(pCSSElement, pPEXOC->id);
+ }
+ return (Success);
+}
+
+
+ddpex4rtn
+inquireCSS_Exec_Struct(pCSSElement, pBuf, ppPEXOC)
+ miGenericElementPtr pCSSElement;
+ ddBuffer *pBuf;
+ ddElementInfo **ppPEXOC;
+{
+ ddpex4rtn err = Success;
+ pexExecuteStructure *pexstr;
+
+ err = (*InquireOCTable[(int) (pCSSElement->element.elementType)])
+ (pCSSElement, pBuf, ppPEXOC);
+
+ pexstr = (pexExecuteStructure *)*ppPEXOC;
+ pexstr->id = (*((diStructHandle *)&(pexstr->id)))->id;
+ return (err);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c
new file mode 100644
index 000000000..42363e44f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c
@@ -0,0 +1,222 @@
+/* $TOG: css_plain.c /main/6 1998/02/10 12:43:29 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/css_plain.c,v 1.8 1999/01/31 12:21:29 dawes Exp $ */
+/*
+ * this file contains the element handling procedures for elements
+ * which are stored in the format they are received. This includes
+ * PEX elements stored in PEX format and any imp. dep. elements which
+ * are not defined by PEX.
+ */
+
+#include "ddpex.h"
+#include "miStrMacro.h"
+#include "pexos.h"
+
+
+extern ocTableType ParseOCTable[];
+extern destroyTableType DestroyOCTable[];
+extern ocTableType CopyOCTable[];
+extern ocTableType InquireOCTable[];
+extern ocTableType ReplaceOCTable[];
+
+#define SET_STR_HEADER(pStruct, pheader) \
+ register miStructPtr pheader = (miStructPtr) pStruct->deviceData
+
+#define PEX_EL_TYPE(POC) ((ddElementInfo *)(POC))->elementType
+
+
+ddpex4rtn
+createCSS_Plain(pStruct, pPEXOC, ppCSSElement)
+/* in */
+ diStructHandle pStruct;
+ ddPointer pPEXOC;
+/* out */
+ miGenericElementStr **ppCSSElement;
+{
+ ddpex4rtn err = Success;
+ SET_STR_HEADER(pStruct, pheader);
+
+ *ppCSSElement = (miGenericElementPtr) NULL;
+
+ /*
+ * Parse into server native format
+ * If we make it here OC is either proprietary or valid PEXOC
+ * still need to check proprietary to avoid Null Function Ptrs
+ */
+ if (MI_HIGHBIT_ON(PEX_EL_TYPE(pPEXOC)))
+ err = (*ParseOCTable[MI_OC_PROP]) (pPEXOC, ppCSSElement);
+ else
+ err = (*ParseOCTable[PEX_EL_TYPE(pPEXOC)])
+ (pPEXOC, ppCSSElement);
+
+ if (err != Success)
+ return (PEXERR(PEXOutputCommandError));
+
+ (*ppCSSElement)->pStruct = pStruct;
+ (*ppCSSElement)->element.pexOClength =
+ ((ddElementInfo *) pPEXOC)->length; /* protocol size, not
+ * parsed size */
+ (*ppCSSElement)->element.elementType =
+ ((ddElementInfo *) pPEXOC)->elementType;
+
+ MISTR_NUM_EL(pheader)++;
+ MISTR_LENGTH(pheader) += ((ddElementInfo *) pPEXOC)->length;
+
+ return (Success);
+}
+
+ddpex4rtn
+destroyCSS_Plain(pStruct, pCSSElement)
+/* in */
+ diStructHandle pStruct;
+ miGenericElementPtr pCSSElement;
+/* out */
+{
+ ddpex4rtn err = Success;
+ SET_STR_HEADER(pStruct, pheader);
+
+ MISTR_NUM_EL(pheader)--;
+ MISTR_LENGTH(pheader) -= MISTR_EL_LENGTH(pCSSElement);
+
+ /*
+ * Free the parsed format
+ * If we make it here OC is either proprietary or valid PEXOC
+ * still need to check proprietary to avoid Null Function Ptrs
+ * even though we use the same destroy routine
+ */
+
+ if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
+ (*DestroyOCTable[MI_OC_PROP]) (pCSSElement);
+ else
+ (*DestroyOCTable[(int) (pCSSElement->element.elementType)])
+ (pCSSElement);
+
+ return (err);
+}
+
+ddpex4rtn
+copyCSS_Plain(pSrcCSSElement, pDestStruct, ppDestCSSElement)
+/* in */
+ miGenericElementPtr pSrcCSSElement;
+ diStructHandle pDestStruct;
+/* out */
+ miGenericElementStr **ppDestCSSElement;
+{
+ ddpex4rtn err = Success;
+ SET_STR_HEADER(pDestStruct, pheader);
+
+ *ppDestCSSElement = (miGenericElementPtr) NULL;
+
+ /*
+ * If we make it here OC is either proprietary or valid PEXOC
+ * still need to check proprietary to avoid Null Function Ptrs
+ */
+ if (MI_HIGHBIT_ON(pSrcCSSElement->element.elementType))
+ err = (*CopyOCTable[MI_OC_PROP])
+ (pSrcCSSElement, ppDestCSSElement);
+ else
+ err = (*CopyOCTable[(int) (pSrcCSSElement->element.elementType)])
+ (pSrcCSSElement, ppDestCSSElement);
+
+ if (err != Success)
+ return (err);
+
+ (*ppDestCSSElement)->pStruct = pDestStruct;
+ (*ppDestCSSElement)->element.pexOClength =
+ pSrcCSSElement->element.pexOClength;
+ (*ppDestCSSElement)->element.elementType =
+ pSrcCSSElement->element.elementType;
+
+ MISTR_NUM_EL(pheader)++;
+ MISTR_LENGTH(pheader) += MISTR_EL_LENGTH(*ppDestCSSElement);
+
+ return (Success);
+}
+
+ddpex4rtn
+replaceCSS_Plain(pStruct, pCSSElement, pPEXOC)
+ diStructHandle pStruct;
+ miGenericElementPtr pCSSElement;
+ ddElementInfo *pPEXOC;
+{
+ ddpex4rtn err = Success;
+
+ /*
+ * If we make it here OC is either proprietary or valid PEXOC
+ * still need to check proprietary to avoid Null Function Ptrs
+ */
+ if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
+ err = (*ReplaceOCTable[MI_OC_PROP]) (pPEXOC, &pCSSElement);
+ else
+ err = (*ReplaceOCTable[(int) (pCSSElement->element.elementType)])
+ (pPEXOC, &pCSSElement);
+
+ if (err == Success) {
+ pCSSElement->pStruct = pStruct;
+ pCSSElement->element.elementType = pPEXOC->elementType;
+ pCSSElement->element.pexOClength = pPEXOC->length;
+ }
+ return (err);
+}
+
+ddpex4rtn
+inquireCSS_Plain(pCSSElement, pBuf, ppPEXOC)
+ miGenericElementPtr pCSSElement;
+ ddBuffer *pBuf;
+ ddElementInfo **ppPEXOC;
+{
+ ddpex4rtn err = Success;
+
+ /*
+ * If we make it here OC is either proprietary or valid PEXOC
+ * still need to check proprietary to avoid Null Function Ptrs
+ */
+ if (MI_HIGHBIT_ON(pCSSElement->element.elementType))
+ err = (*InquireOCTable[MI_OC_PROP]) (pCSSElement, pBuf, ppPEXOC);
+ else
+ err = (*InquireOCTable[(int) (pCSSElement->element.elementType)])
+ (pCSSElement, pBuf, ppPEXOC);
+ return (err);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_tbls.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_tbls.c
new file mode 100644
index 000000000..39700d415
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/css_tbls.c
@@ -0,0 +1,607 @@
+/* $TOG: css_tbls.c /main/5 1998/02/10 12:43:33 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* Automatically generated element handling tables */
+
+#include "ddpex.h"
+#include "miStruct.h"
+
+
+/* declarations for procs which handle elements stored in PEX format
+ * this includes elements stored in PEX format and any extra elements
+ * which are not defined in the protocol
+ */
+
+extern ddpex4rtn createCSS_Plain();
+extern ddpex4rtn destroyCSS_Plain();
+extern ddpex4rtn copyCSS_Plain();
+extern ddpex4rtn replaceCSS_Plain();
+extern ddpex4rtn inquireCSS_Plain();
+
+/* declarations for procs which handle execute structure elements */
+extern ddpex4rtn createCSS_Exec_Struct();
+extern ddpex4rtn destroyCSS_Exec_Struct();
+extern ddpex4rtn copyCSS_Exec_Struct();
+extern ddpex4rtn replaceCSS_Exec_Struct();
+extern ddpex4rtn inquireCSS_Exec_Struct();
+
+cssTableType CreateCSSElementTable[] = {
+ createCSS_Plain, /* 0 Propietary */
+ createCSS_Plain, /* 1 MarkerType */
+ createCSS_Plain, /* 2 MarkerScale */
+ createCSS_Plain, /* 3 MarkerColourIndex */
+ createCSS_Plain, /* 4 MarkerColour */
+ createCSS_Plain, /* 5 MarkerBundleIndex */
+ createCSS_Plain, /* 6 TextFontIndex */
+ createCSS_Plain, /* 7 TextPrecision */
+ createCSS_Plain, /* 8 CharExpansion */
+ createCSS_Plain, /* 9 CharSpacing */
+ createCSS_Plain, /* 10 TextColourIndex */
+ createCSS_Plain, /* 11 TextColour */
+ createCSS_Plain, /* 12 CharHeight */
+ createCSS_Plain, /* 13 CharUpVector */
+ createCSS_Plain, /* 14 TextPath */
+ createCSS_Plain, /* 15 TextAlignment */
+ createCSS_Plain, /* 16 AtextHeight */
+ createCSS_Plain, /* 17 AtextUpVector */
+ createCSS_Plain, /* 18 AtextPath */
+ createCSS_Plain, /* 19 AtextAlignment */
+ createCSS_Plain, /* 20 AtextStyle */
+ createCSS_Plain, /* 21 TextBundleIndex */
+ createCSS_Plain, /* 22 LineType */
+ createCSS_Plain, /* 23 LineWidth */
+ createCSS_Plain, /* 24 LineColourIndex */
+ createCSS_Plain, /* 25 LineColour */
+ createCSS_Plain, /* 26 CurveApproximation */
+ createCSS_Plain, /* 27 PolylineInterp */
+ createCSS_Plain, /* 28 LineBundleIndex */
+ createCSS_Plain, /* 29 InteriorStyle */
+ createCSS_Plain, /* 30 InteriorStyleIndex */
+ createCSS_Plain, /* 31 SurfaceColourIndex */
+ createCSS_Plain, /* 32 SurfaceColour */
+ createCSS_Plain, /* 33 SurfaceReflAttr */
+ createCSS_Plain, /* 34 SurfaceReflModel */
+ createCSS_Plain, /* 35 SurfaceInterp */
+ createCSS_Plain, /* 36 BfInteriorStyle */
+ createCSS_Plain, /* 37 BfInteriorStyleIndex */
+ createCSS_Plain, /* 38 BfSurfaceColourIndex */
+ createCSS_Plain, /* 39 BfSurfaceColour */
+ createCSS_Plain, /* 40 BfSurfaceReflAttr */
+ createCSS_Plain, /* 41 BfSurfaceReflModel */
+ createCSS_Plain, /* 42 BfSurfaceInterp */
+ createCSS_Plain, /* 43 SurfaceApproximation */
+ createCSS_Plain, /* 44 CullingMode */
+ createCSS_Plain, /* 45 DistinguishFlag */
+ createCSS_Plain, /* 46 PatternSize */
+ createCSS_Plain, /* 47 PatternRefPt */
+ createCSS_Plain, /* 48 PatternAttr */
+ createCSS_Plain, /* 49 InteriorBundleIndex */
+ createCSS_Plain, /* 50 SurfaceEdgeFlag */
+ createCSS_Plain, /* 51 SurfaceEdgeType */
+ createCSS_Plain, /* 52 SurfaceEdgeWidth */
+ createCSS_Plain, /* 53 SurfaceEdgeColourIndex */
+ createCSS_Plain, /* 54 SurfaceEdgeColour */
+ createCSS_Plain, /* 55 EdgeBundleIndex */
+ createCSS_Plain, /* 56 SetAsfValues */
+ createCSS_Plain, /* 57 LocalTransform */
+ createCSS_Plain, /* 58 LocalTransform2D */
+ createCSS_Plain, /* 59 GlobalTransform */
+ createCSS_Plain, /* 60 GlobalTransform2D */
+ createCSS_Plain, /* 61 ModelClip */
+ createCSS_Plain, /* 62 ModelClipVolume */
+ createCSS_Plain, /* 63 ModelClipVolume2D */
+ createCSS_Plain, /* 64 RestoreModelClip */
+ createCSS_Plain, /* 65 ViewIndex */
+ createCSS_Plain, /* 66 LightState */
+ createCSS_Plain, /* 67 DepthCueIndex */
+ createCSS_Plain, /* 68 PickId */
+ createCSS_Plain, /* 69 HlhsrIdentifier */
+ createCSS_Plain, /* 70 ColourApproxIndex */
+ createCSS_Plain, /* 71 RenderingColourModel */
+ createCSS_Plain, /* 72 PSurfaceCharacteristics */
+ createCSS_Plain, /* 73 AddToNameSet */
+ createCSS_Plain, /* 74 RemoveFromNameSet */
+ createCSS_Exec_Struct, /* 75 ExecuteStructure */
+ createCSS_Plain, /* 76 Label */
+ createCSS_Plain, /* 77 ApplicationData */
+ createCSS_Plain, /* 78 Gse */
+ createCSS_Plain, /* 79 Marker */
+ createCSS_Plain, /* 80 Marker2D */
+ createCSS_Plain, /* 81 Text */
+ createCSS_Plain, /* 82 Text2D */
+ createCSS_Plain, /* 83 AnnotationText */
+ createCSS_Plain, /* 84 AnnotationText2D */
+ createCSS_Plain, /* 85 Polyline */
+ createCSS_Plain, /* 86 Polyline2D */
+ createCSS_Plain, /* 87 PolylineSet */
+ createCSS_Plain, /* 88 NurbCurve */
+ createCSS_Plain, /* 89 FillArea */
+ createCSS_Plain, /* 90 FillArea2D */
+ createCSS_Plain, /* 91 ExtFillArea */
+ createCSS_Plain, /* 92 FillAreaSet */
+ createCSS_Plain, /* 93 FillAreaSet2D */
+ createCSS_Plain, /* 94 ExtFillAreaSet */
+ createCSS_Plain, /* 95 TriangleStrip */
+ createCSS_Plain, /* 96 QuadrilateralMesh */
+ createCSS_Plain, /* 97 SOFAS */
+ createCSS_Plain, /* 98 NurbSurface */
+ createCSS_Plain, /* 99 CellArray */
+ createCSS_Plain, /* 100 CellArray2D */
+ createCSS_Plain, /* 101 ExtCellArray */
+ createCSS_Plain, /* 102 Gdp */
+ createCSS_Plain, /* 103 Gdp2D */
+ createCSS_Plain /* 104 Noop */
+};
+
+cssTableType DestroyCSSElementTable[] = {
+ destroyCSS_Plain, /* 0 Propietary */
+ destroyCSS_Plain, /* 1 MarkerType */
+ destroyCSS_Plain, /* 2 MarkerScale */
+ destroyCSS_Plain, /* 3 MarkerColourIndex */
+ destroyCSS_Plain, /* 4 MarkerColour */
+ destroyCSS_Plain, /* 5 MarkerBundleIndex */
+ destroyCSS_Plain, /* 6 TextFontIndex */
+ destroyCSS_Plain, /* 7 TextPrecision */
+ destroyCSS_Plain, /* 8 CharExpansion */
+ destroyCSS_Plain, /* 9 CharSpacing */
+ destroyCSS_Plain, /* 10 TextColourIndex */
+ destroyCSS_Plain, /* 11 TextColour */
+ destroyCSS_Plain, /* 12 CharHeight */
+ destroyCSS_Plain, /* 13 CharUpVector */
+ destroyCSS_Plain, /* 14 TextPath */
+ destroyCSS_Plain, /* 15 TextAlignment */
+ destroyCSS_Plain, /* 16 AtextHeight */
+ destroyCSS_Plain, /* 17 AtextUpVector */
+ destroyCSS_Plain, /* 18 AtextPath */
+ destroyCSS_Plain, /* 19 AtextAlignment */
+ destroyCSS_Plain, /* 20 AtextStyle */
+ destroyCSS_Plain, /* 21 TextBundleIndex */
+ destroyCSS_Plain, /* 22 LineType */
+ destroyCSS_Plain, /* 23 LineWidth */
+ destroyCSS_Plain, /* 24 LineColourIndex */
+ destroyCSS_Plain, /* 25 LineColour */
+ destroyCSS_Plain, /* 26 CurveApproximation */
+ destroyCSS_Plain, /* 27 PolylineInterp */
+ destroyCSS_Plain, /* 28 LineBundleIndex */
+ destroyCSS_Plain, /* 29 InteriorStyle */
+ destroyCSS_Plain, /* 30 InteriorStyleIndex */
+ destroyCSS_Plain, /* 31 SurfaceColourIndex */
+ destroyCSS_Plain, /* 32 SurfaceColour */
+ destroyCSS_Plain, /* 33 SurfaceReflAttr */
+ destroyCSS_Plain, /* 34 SurfaceReflModel */
+ destroyCSS_Plain, /* 35 SurfaceInterp */
+ destroyCSS_Plain, /* 36 BfInteriorStyle */
+ destroyCSS_Plain, /* 37 BfInteriorStyleIndex */
+ destroyCSS_Plain, /* 38 BfSurfaceColourIndex */
+ destroyCSS_Plain, /* 39 BfSurfaceColour */
+ destroyCSS_Plain, /* 40 BfSurfaceReflAttr */
+ destroyCSS_Plain, /* 41 BfSurfaceReflModel */
+ destroyCSS_Plain, /* 42 BfSurfaceInterp */
+ destroyCSS_Plain, /* 43 SurfaceApproximation */
+ destroyCSS_Plain, /* 44 CullingMode */
+ destroyCSS_Plain, /* 45 DistinguishFlag */
+ destroyCSS_Plain, /* 46 PatternSize */
+ destroyCSS_Plain, /* 47 PatternRefPt */
+ destroyCSS_Plain, /* 48 PatternAttr */
+ destroyCSS_Plain, /* 49 InteriorBundleIndex */
+ destroyCSS_Plain, /* 50 SurfaceEdgeFlag */
+ destroyCSS_Plain, /* 51 SurfaceEdgeType */
+ destroyCSS_Plain, /* 52 SurfaceEdgeWidth */
+ destroyCSS_Plain, /* 53 SurfaceEdgeColourIndex */
+ destroyCSS_Plain, /* 54 SurfaceEdgeColour */
+ destroyCSS_Plain, /* 55 EdgeBundleIndex */
+ destroyCSS_Plain, /* 56 SetAsfValues */
+ destroyCSS_Plain, /* 57 LocalTransform */
+ destroyCSS_Plain, /* 58 LocalTransform2D */
+ destroyCSS_Plain, /* 59 GlobalTransform */
+ destroyCSS_Plain, /* 60 GlobalTransform2D */
+ destroyCSS_Plain, /* 61 ModelClip */
+ destroyCSS_Plain, /* 62 ModelClipVolume */
+ destroyCSS_Plain, /* 63 ModelClipVolume2D */
+ destroyCSS_Plain, /* 64 RestoreModelClip */
+ destroyCSS_Plain, /* 65 ViewIndex */
+ destroyCSS_Plain, /* 66 LightState */
+ destroyCSS_Plain, /* 67 DepthCueIndex */
+ destroyCSS_Plain, /* 68 PickId */
+ destroyCSS_Plain, /* 69 HlhsrIdentifier */
+ destroyCSS_Plain, /* 70 ColourApproxIndex */
+ destroyCSS_Plain, /* 71 RenderingColourModel */
+ destroyCSS_Plain, /* 72 PSurfaceCharacteristics */
+ destroyCSS_Plain, /* 73 AddToNameSet */
+ destroyCSS_Plain, /* 74 RemoveFromNameSet */
+ destroyCSS_Exec_Struct, /* 75 ExecuteStructure */
+ destroyCSS_Plain, /* 76 Label */
+ destroyCSS_Plain, /* 77 ApplicationData */
+ destroyCSS_Plain, /* 78 Gse */
+ destroyCSS_Plain, /* 79 Marker */
+ destroyCSS_Plain, /* 80 Marker2D */
+ destroyCSS_Plain, /* 81 Text */
+ destroyCSS_Plain, /* 82 Text2D */
+ destroyCSS_Plain, /* 83 AnnotationText */
+ destroyCSS_Plain, /* 84 AnnotationText2D */
+ destroyCSS_Plain, /* 85 Polyline */
+ destroyCSS_Plain, /* 86 Polyline2D */
+ destroyCSS_Plain, /* 87 PolylineSet */
+ destroyCSS_Plain, /* 88 NurbCurve */
+ destroyCSS_Plain, /* 89 FillArea */
+ destroyCSS_Plain, /* 90 FillArea2D */
+ destroyCSS_Plain, /* 91 ExtFillArea */
+ destroyCSS_Plain, /* 92 FillAreaSet */
+ destroyCSS_Plain, /* 93 FillAreaSet2D */
+ destroyCSS_Plain, /* 94 ExtFillAreaSet */
+ destroyCSS_Plain, /* 95 TriangleStrip */
+ destroyCSS_Plain, /* 96 QuadrilateralMesh */
+ destroyCSS_Plain, /* 97 SOFAS */
+ destroyCSS_Plain, /* 98 NurbSurface */
+ destroyCSS_Plain, /* 99 CellArray */
+ destroyCSS_Plain, /* 100 CellArray2D */
+ destroyCSS_Plain, /* 101 ExtCellArray */
+ destroyCSS_Plain, /* 102 Gdp */
+ destroyCSS_Plain, /* 103 Gdp2D */
+ destroyCSS_Plain /* 104 Noop */
+};
+
+cssTableType CopyCSSElementTable[] = {
+ copyCSS_Plain, /* 0 Propietary */
+ copyCSS_Plain, /* 1 MarkerType */
+ copyCSS_Plain, /* 2 MarkerScale */
+ copyCSS_Plain, /* 3 MarkerColourIndex */
+ copyCSS_Plain, /* 4 MarkerColour */
+ copyCSS_Plain, /* 5 MarkerBundleIndex */
+ copyCSS_Plain, /* 6 TextFontIndex */
+ copyCSS_Plain, /* 7 TextPrecision */
+ copyCSS_Plain, /* 8 CharExpansion */
+ copyCSS_Plain, /* 9 CharSpacing */
+ copyCSS_Plain, /* 10 TextColourIndex */
+ copyCSS_Plain, /* 11 TextColour */
+ copyCSS_Plain, /* 12 CharHeight */
+ copyCSS_Plain, /* 13 CharUpVector */
+ copyCSS_Plain, /* 14 TextPath */
+ copyCSS_Plain, /* 15 TextAlignment */
+ copyCSS_Plain, /* 16 AtextHeight */
+ copyCSS_Plain, /* 17 AtextUpVector */
+ copyCSS_Plain, /* 18 AtextPath */
+ copyCSS_Plain, /* 19 AtextAlignment */
+ copyCSS_Plain, /* 20 AtextStyle */
+ copyCSS_Plain, /* 21 TextBundleIndex */
+ copyCSS_Plain, /* 22 LineType */
+ copyCSS_Plain, /* 23 LineWidth */
+ copyCSS_Plain, /* 24 LineColourIndex */
+ copyCSS_Plain, /* 25 LineColour */
+ copyCSS_Plain, /* 26 CurveApproximation */
+ copyCSS_Plain, /* 27 PolylineInterp */
+ copyCSS_Plain, /* 28 LineBundleIndex */
+ copyCSS_Plain, /* 29 InteriorStyle */
+ copyCSS_Plain, /* 30 InteriorStyleIndex */
+ copyCSS_Plain, /* 31 SurfaceColourIndex */
+ copyCSS_Plain, /* 32 SurfaceColour */
+ copyCSS_Plain, /* 33 SurfaceReflAttr */
+ copyCSS_Plain, /* 34 SurfaceReflModel */
+ copyCSS_Plain, /* 35 SurfaceInterp */
+ copyCSS_Plain, /* 36 BfInteriorStyle */
+ copyCSS_Plain, /* 37 BfInteriorStyleIndex */
+ copyCSS_Plain, /* 38 BfSurfaceColourIndex */
+ copyCSS_Plain, /* 39 BfSurfaceColour */
+ copyCSS_Plain, /* 40 BfSurfaceReflAttr */
+ copyCSS_Plain, /* 41 BfSurfaceReflModel */
+ copyCSS_Plain, /* 42 BfSurfaceInterp */
+ copyCSS_Plain, /* 43 SurfaceApproximation */
+ copyCSS_Plain, /* 44 CullingMode */
+ copyCSS_Plain, /* 45 DistinguishFlag */
+ copyCSS_Plain, /* 46 PatternSize */
+ copyCSS_Plain, /* 47 PatternRefPt */
+ copyCSS_Plain, /* 48 PatternAttr */
+ copyCSS_Plain, /* 49 InteriorBundleIndex */
+ copyCSS_Plain, /* 50 SurfaceEdgeFlag */
+ copyCSS_Plain, /* 51 SurfaceEdgeType */
+ copyCSS_Plain, /* 52 SurfaceEdgeWidth */
+ copyCSS_Plain, /* 53 SurfaceEdgeColourIndex */
+ copyCSS_Plain, /* 54 SurfaceEdgeColour */
+ copyCSS_Plain, /* 55 EdgeBundleIndex */
+ copyCSS_Plain, /* 56 SetAsfValues */
+ copyCSS_Plain, /* 57 LocalTransform */
+ copyCSS_Plain, /* 58 LocalTransform2D */
+ copyCSS_Plain, /* 59 GlobalTransform */
+ copyCSS_Plain, /* 60 GlobalTransform2D */
+ copyCSS_Plain, /* 61 ModelClip */
+ copyCSS_Plain, /* 62 ModelClipVolume */
+ copyCSS_Plain, /* 63 ModelClipVolume2D */
+ copyCSS_Plain, /* 64 RestoreModelClip */
+ copyCSS_Plain, /* 65 ViewIndex */
+ copyCSS_Plain, /* 66 LightState */
+ copyCSS_Plain, /* 67 DepthCueIndex */
+ copyCSS_Plain, /* 68 PickId */
+ copyCSS_Plain, /* 69 HlhsrIdentifier */
+ copyCSS_Plain, /* 70 ColourApproxIndex */
+ copyCSS_Plain, /* 71 RenderingColourModel */
+ copyCSS_Plain, /* 72 PSurfaceCharacteristics */
+ copyCSS_Plain, /* 73 AddToNameSet */
+ copyCSS_Plain, /* 74 RemoveFromNameSet */
+ copyCSS_Exec_Struct, /* 75 ExecuteStructure */
+ copyCSS_Plain, /* 76 Label */
+ copyCSS_Plain, /* 77 ApplicationData */
+ copyCSS_Plain, /* 78 Gse */
+ copyCSS_Plain, /* 79 Marker */
+ copyCSS_Plain, /* 80 Marker2D */
+ copyCSS_Plain, /* 81 Text */
+ copyCSS_Plain, /* 82 Text2D */
+ copyCSS_Plain, /* 83 AnnotationText */
+ copyCSS_Plain, /* 84 AnnotationText2D */
+ copyCSS_Plain, /* 85 Polyline */
+ copyCSS_Plain, /* 86 Polyline2D */
+ copyCSS_Plain, /* 87 PolylineSet */
+ copyCSS_Plain, /* 88 NurbCurve */
+ copyCSS_Plain, /* 89 FillArea */
+ copyCSS_Plain, /* 90 FillArea2D */
+ copyCSS_Plain, /* 91 ExtFillArea */
+ copyCSS_Plain, /* 92 FillAreaSet */
+ copyCSS_Plain, /* 93 FillAreaSet2D */
+ copyCSS_Plain, /* 94 ExtFillAreaSet */
+ copyCSS_Plain, /* 95 TriangleStrip */
+ copyCSS_Plain, /* 96 QuadrilateralMesh */
+ copyCSS_Plain, /* 97 SOFAS */
+ copyCSS_Plain, /* 98 NurbSurface */
+ copyCSS_Plain, /* 99 CellArray */
+ copyCSS_Plain, /* 100 CellArray2D */
+ copyCSS_Plain, /* 101 ExtCellArray */
+ copyCSS_Plain, /* 102 Gdp */
+ copyCSS_Plain, /* 103 Gdp2D */
+ copyCSS_Plain /* 104 Noop */
+};
+
+cssTableType ReplaceCSSElementTable[] = {
+ replaceCSS_Plain, /* 0 Propietary */
+ replaceCSS_Plain, /* 1 MarkerType */
+ replaceCSS_Plain, /* 2 MarkerScale */
+ replaceCSS_Plain, /* 3 MarkerColourIndex */
+ replaceCSS_Plain, /* 4 MarkerColour */
+ replaceCSS_Plain, /* 5 MarkerBundleIndex */
+ replaceCSS_Plain, /* 6 TextFontIndex */
+ replaceCSS_Plain, /* 7 TextPrecision */
+ replaceCSS_Plain, /* 8 CharExpansion */
+ replaceCSS_Plain, /* 9 CharSpacing */
+ replaceCSS_Plain, /* 10 TextColourIndex */
+ replaceCSS_Plain, /* 11 TextColour */
+ replaceCSS_Plain, /* 12 CharHeight */
+ replaceCSS_Plain, /* 13 CharUpVector */
+ replaceCSS_Plain, /* 14 TextPath */
+ replaceCSS_Plain, /* 15 TextAlignment */
+ replaceCSS_Plain, /* 16 AtextHeight */
+ replaceCSS_Plain, /* 17 AtextUpVector */
+ replaceCSS_Plain, /* 18 AtextPath */
+ replaceCSS_Plain, /* 19 AtextAlignment */
+ replaceCSS_Plain, /* 20 AtextStyle */
+ replaceCSS_Plain, /* 21 TextBundleIndex */
+ replaceCSS_Plain, /* 22 LineType */
+ replaceCSS_Plain, /* 23 LineWidth */
+ replaceCSS_Plain, /* 24 LineColourIndex */
+ replaceCSS_Plain, /* 25 LineColour */
+ replaceCSS_Plain, /* 26 CurveApproximation */
+ replaceCSS_Plain, /* 27 PolylineInterp */
+ replaceCSS_Plain, /* 28 LineBundleIndex */
+ replaceCSS_Plain, /* 29 InteriorStyle */
+ replaceCSS_Plain, /* 30 InteriorStyleIndex */
+ replaceCSS_Plain, /* 31 SurfaceColourIndex */
+ replaceCSS_Plain, /* 32 SurfaceColour */
+ replaceCSS_Plain, /* 33 SurfaceReflAttr */
+ replaceCSS_Plain, /* 34 SurfaceReflModel */
+ replaceCSS_Plain, /* 35 SurfaceInterp */
+ replaceCSS_Plain, /* 36 BfInteriorStyle */
+ replaceCSS_Plain, /* 37 BfInteriorStyleIndex */
+ replaceCSS_Plain, /* 38 BfSurfaceColourIndex */
+ replaceCSS_Plain, /* 39 BfSurfaceColour */
+ replaceCSS_Plain, /* 40 BfSurfaceReflAttr */
+ replaceCSS_Plain, /* 41 BfSurfaceReflModel */
+ replaceCSS_Plain, /* 42 BfSurfaceInterp */
+ replaceCSS_Plain, /* 43 SurfaceApproximation */
+ replaceCSS_Plain, /* 44 CullingMode */
+ replaceCSS_Plain, /* 45 DistinguishFlag */
+ replaceCSS_Plain, /* 46 PatternSize */
+ replaceCSS_Plain, /* 47 PatternRefPt */
+ replaceCSS_Plain, /* 48 PatternAttr */
+ replaceCSS_Plain, /* 49 InteriorBundleIndex */
+ replaceCSS_Plain, /* 50 SurfaceEdgeFlag */
+ replaceCSS_Plain, /* 51 SurfaceEdgeType */
+ replaceCSS_Plain, /* 52 SurfaceEdgeWidth */
+ replaceCSS_Plain, /* 53 SurfaceEdgeColourIndex */
+ replaceCSS_Plain, /* 54 SurfaceEdgeColour */
+ replaceCSS_Plain, /* 55 EdgeBundleIndex */
+ replaceCSS_Plain, /* 56 SetAsfValues */
+ replaceCSS_Plain, /* 57 LocalTransform */
+ replaceCSS_Plain, /* 58 LocalTransform2D */
+ replaceCSS_Plain, /* 59 GlobalTransform */
+ replaceCSS_Plain, /* 60 GlobalTransform2D */
+ replaceCSS_Plain, /* 61 ModelClip */
+ replaceCSS_Plain, /* 62 ModelClipVolume */
+ replaceCSS_Plain, /* 63 ModelClipVolume2D */
+ replaceCSS_Plain, /* 64 RestoreModelClip */
+ replaceCSS_Plain, /* 65 ViewIndex */
+ replaceCSS_Plain, /* 66 LightState */
+ replaceCSS_Plain, /* 67 DepthCueIndex */
+ replaceCSS_Plain, /* 68 PickId */
+ replaceCSS_Plain, /* 69 HlhsrIdentifier */
+ replaceCSS_Plain, /* 70 ColourApproxIndex */
+ replaceCSS_Plain, /* 71 RenderingColourModel */
+ replaceCSS_Plain, /* 72 PSurfaceCharacteristics */
+ replaceCSS_Plain, /* 73 AddToNameSet */
+ replaceCSS_Plain, /* 74 RemoveFromNameSet */
+ replaceCSS_Exec_Struct, /* 75 ExecuteStructure */
+ replaceCSS_Plain, /* 76 Label */
+ replaceCSS_Plain, /* 77 ApplicationData */
+ replaceCSS_Plain, /* 78 Gse */
+ replaceCSS_Plain, /* 79 Marker */
+ replaceCSS_Plain, /* 80 Marker2D */
+ replaceCSS_Plain, /* 81 Text */
+ replaceCSS_Plain, /* 82 Text2D */
+ replaceCSS_Plain, /* 83 AnnotationText */
+ replaceCSS_Plain, /* 84 AnnotationText2D */
+ replaceCSS_Plain, /* 85 Polyline */
+ replaceCSS_Plain, /* 86 Polyline2D */
+ replaceCSS_Plain, /* 87 PolylineSet */
+ replaceCSS_Plain, /* 88 NurbCurve */
+ replaceCSS_Plain, /* 89 FillArea */
+ replaceCSS_Plain, /* 90 FillArea2D */
+ replaceCSS_Plain, /* 91 ExtFillArea */
+ replaceCSS_Plain, /* 92 FillAreaSet */
+ replaceCSS_Plain, /* 93 FillAreaSet2D */
+ replaceCSS_Plain, /* 94 ExtFillAreaSet */
+ replaceCSS_Plain, /* 95 TriangleStrip */
+ replaceCSS_Plain, /* 96 QuadrilateralMesh */
+ replaceCSS_Plain, /* 97 SOFAS */
+ replaceCSS_Plain, /* 98 NurbSurface */
+ replaceCSS_Plain, /* 99 CellArray */
+ replaceCSS_Plain, /* 100 CellArray2D */
+ replaceCSS_Plain, /* 101 ExtCellArray */
+ replaceCSS_Plain, /* 102 Gdp */
+ replaceCSS_Plain, /* 103 Gdp2D */
+ replaceCSS_Plain /* 104 Noop */
+};
+
+cssTableType InquireCSSElementTable[] = {
+ inquireCSS_Plain, /* 0 Propietary */
+ inquireCSS_Plain, /* 1 MarkerType */
+ inquireCSS_Plain, /* 2 MarkerScale */
+ inquireCSS_Plain, /* 3 MarkerColourIndex */
+ inquireCSS_Plain, /* 4 MarkerColour */
+ inquireCSS_Plain, /* 5 MarkerBundleIndex */
+ inquireCSS_Plain, /* 6 TextFontIndex */
+ inquireCSS_Plain, /* 7 TextPrecision */
+ inquireCSS_Plain, /* 8 CharExpansion */
+ inquireCSS_Plain, /* 9 CharSpacing */
+ inquireCSS_Plain, /* 10 TextColourIndex */
+ inquireCSS_Plain, /* 11 TextColour */
+ inquireCSS_Plain, /* 12 CharHeight */
+ inquireCSS_Plain, /* 13 CharUpVector */
+ inquireCSS_Plain, /* 14 TextPath */
+ inquireCSS_Plain, /* 15 TextAlignment */
+ inquireCSS_Plain, /* 16 AtextHeight */
+ inquireCSS_Plain, /* 17 AtextUpVector */
+ inquireCSS_Plain, /* 18 AtextPath */
+ inquireCSS_Plain, /* 19 AtextAlignment */
+ inquireCSS_Plain, /* 20 AtextStyle */
+ inquireCSS_Plain, /* 21 TextBundleIndex */
+ inquireCSS_Plain, /* 22 LineType */
+ inquireCSS_Plain, /* 23 LineWidth */
+ inquireCSS_Plain, /* 24 LineColourIndex */
+ inquireCSS_Plain, /* 25 LineColour */
+ inquireCSS_Plain, /* 26 CurveApproximation */
+ inquireCSS_Plain, /* 27 PolylineInterp */
+ inquireCSS_Plain, /* 28 LineBundleIndex */
+ inquireCSS_Plain, /* 29 InteriorStyle */
+ inquireCSS_Plain, /* 30 InteriorStyleIndex */
+ inquireCSS_Plain, /* 31 SurfaceColourIndex */
+ inquireCSS_Plain, /* 32 SurfaceColour */
+ inquireCSS_Plain, /* 33 SurfaceReflAttr */
+ inquireCSS_Plain, /* 34 SurfaceReflModel */
+ inquireCSS_Plain, /* 35 SurfaceInterp */
+ inquireCSS_Plain, /* 36 BfInteriorStyle */
+ inquireCSS_Plain, /* 37 BfInteriorStyleIndex */
+ inquireCSS_Plain, /* 38 BfSurfaceColourIndex */
+ inquireCSS_Plain, /* 39 BfSurfaceColour */
+ inquireCSS_Plain, /* 40 BfSurfaceReflAttr */
+ inquireCSS_Plain, /* 41 BfSurfaceReflModel */
+ inquireCSS_Plain, /* 42 BfSurfaceInterp */
+ inquireCSS_Plain, /* 43 SurfaceApproximation */
+ inquireCSS_Plain, /* 44 CullingMode */
+ inquireCSS_Plain, /* 45 DistinguishFlag */
+ inquireCSS_Plain, /* 46 PatternSize */
+ inquireCSS_Plain, /* 47 PatternRefPt */
+ inquireCSS_Plain, /* 48 PatternAttr */
+ inquireCSS_Plain, /* 49 InteriorBundleIndex */
+ inquireCSS_Plain, /* 50 SurfaceEdgeFlag */
+ inquireCSS_Plain, /* 51 SurfaceEdgeType */
+ inquireCSS_Plain, /* 52 SurfaceEdgeWidth */
+ inquireCSS_Plain, /* 53 SurfaceEdgeColourIndex */
+ inquireCSS_Plain, /* 54 SurfaceEdgeColour */
+ inquireCSS_Plain, /* 55 EdgeBundleIndex */
+ inquireCSS_Plain, /* 56 SetAsfValues */
+ inquireCSS_Plain, /* 57 LocalTransform */
+ inquireCSS_Plain, /* 58 LocalTransform2D */
+ inquireCSS_Plain, /* 59 GlobalTransform */
+ inquireCSS_Plain, /* 60 GlobalTransform2D */
+ inquireCSS_Plain, /* 61 ModelClip */
+ inquireCSS_Plain, /* 62 ModelClipVolume */
+ inquireCSS_Plain, /* 63 ModelClipVolume2D */
+ inquireCSS_Plain, /* 64 RestoreModelClip */
+ inquireCSS_Plain, /* 65 ViewIndex */
+ inquireCSS_Plain, /* 66 LightState */
+ inquireCSS_Plain, /* 67 DepthCueIndex */
+ inquireCSS_Plain, /* 68 PickId */
+ inquireCSS_Plain, /* 69 HlhsrIdentifier */
+ inquireCSS_Plain, /* 70 ColourApproxIndex */
+ inquireCSS_Plain, /* 71 RenderingColourModel */
+ inquireCSS_Plain, /* 72 PSurfaceCharacteristics */
+ inquireCSS_Plain, /* 73 AddToNameSet */
+ inquireCSS_Plain, /* 74 RemoveFromNameSet */
+ inquireCSS_Exec_Struct, /* 75 ExecuteStructure */
+ inquireCSS_Plain, /* 76 Label */
+ inquireCSS_Plain, /* 77 ApplicationData */
+ inquireCSS_Plain, /* 78 Gse */
+ inquireCSS_Plain, /* 79 Marker */
+ inquireCSS_Plain, /* 80 Marker2D */
+ inquireCSS_Plain, /* 81 Text */
+ inquireCSS_Plain, /* 82 Text2D */
+ inquireCSS_Plain, /* 83 AnnotationText */
+ inquireCSS_Plain, /* 84 AnnotationText2D */
+ inquireCSS_Plain, /* 85 Polyline */
+ inquireCSS_Plain, /* 86 Polyline2D */
+ inquireCSS_Plain, /* 87 PolylineSet */
+ inquireCSS_Plain, /* 88 NurbCurve */
+ inquireCSS_Plain, /* 89 FillArea */
+ inquireCSS_Plain, /* 90 FillArea2D */
+ inquireCSS_Plain, /* 91 ExtFillArea */
+ inquireCSS_Plain, /* 92 FillAreaSet */
+ inquireCSS_Plain, /* 93 FillAreaSet2D */
+ inquireCSS_Plain, /* 94 ExtFillAreaSet */
+ inquireCSS_Plain, /* 95 TriangleStrip */
+ inquireCSS_Plain, /* 96 QuadrilateralMesh */
+ inquireCSS_Plain, /* 97 SOFAS */
+ inquireCSS_Plain, /* 98 NurbSurface */
+ inquireCSS_Plain, /* 99 CellArray */
+ inquireCSS_Plain, /* 100 CellArray2D */
+ inquireCSS_Plain, /* 101 ExtCellArray */
+ inquireCSS_Plain, /* 102 Gdp */
+ inquireCSS_Plain, /* 103 Gdp2D */
+ inquireCSS_Plain /* 104 Noop */
+};
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miDynamics.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miDynamics.c
new file mode 100644
index 000000000..f97f33e25
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miDynamics.c
@@ -0,0 +1,222 @@
+/* $TOG: miDynamics.c /main/4 1998/02/10 12:43:38 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#include "ddpex.h"
+#include "ddpex4.h"
+#include "pexUtils.h"
+#include "miWks.h"
+#include "miStruct.h"
+#include "miNS.h"
+
+
+/*++
+ |
+ | Function Name: miDealWithDynamics
+ |
+ | Function Description:
+ | Goes through each workstation in the given list and causes a Redraw
+ | of the workstation depending on the supplied dynamic and other values in
+ | the workstation state.
+ |
+ --*/
+
+
+ddpex4rtn
+miDealWithDynamics(dynamic, pwksToLookAt)
+/* in */
+ ddDynamic dynamic;
+ listofObj *pwksToLookAt;
+/* out */
+{
+ register int i;
+ diWKSHandle *pWKS;
+ miWksPtr wksPtr;
+ ddpex4rtn err4 = Success;
+
+ pWKS = (diWKSHandle *) pwksToLookAt->pList;
+ for (i = 0; i < pwksToLookAt->numObj; i++, pWKS++) {
+
+ wksPtr = (miWksPtr) ((*pWKS)->deviceData);
+
+ if (!wksPtr) continue; /* workstation has been freed */
+
+ switch (wksPtr->displayUpdate) {
+ case PEXVisualizeEach:
+ /* always make sure picture is correct */
+ if ( (wksPtr->dynamics[(int) dynamic] != PEXIMM)
+ || (wksPtr->visualState != PEXCorrect)) {
+ if (err4 = RedrawStructures(*pWKS)) return (err4);
+ wksPtr->visualState = PEXCorrect;
+ }
+ break;
+
+ case PEXVisualizeEasy:
+ case PEXVisualizeNone:
+ case PEXVisualizeWhenever:
+ /*
+ * for PEXIMM don't do anything (visual state doesn't change)
+ */
+ if (wksPtr->dynamics[(int) dynamic] != PEXIMM)
+ /* IRG and CBS, the action is deferred */
+ wksPtr->visualState = PEXDeferred;
+ break;
+
+ case PEXSimulateSome:
+
+ /*
+ * don't do anything if dynamic = PEXIMM (visual
+ * state doesn't change)
+ */
+ if (wksPtr->dynamics[(int) dynamic] == PEXIRG)
+ /* the action is deferred */
+ wksPtr->visualState = PEXDeferred;
+ else if (wksPtr->dynamics[(int) dynamic] == PEXCBS)
+
+ /*
+ * the action should not be deferred and the
+ * simulation should be done when the action
+ * is done
+ */
+ if (wksPtr->visualState != PEXDeferred)
+ wksPtr->visualState = PEXSimulated;
+ break;
+ }
+ }
+ return (Success);
+} /* miDealWithDynamics */
+
+/*++
+ |
+ | Function Name: miDealWithStructDynamics
+ |
+ | Function Description:
+ | Goes through each workstation that the structure appears on,
+ | and causes a Redraw of the workstation depending on the supplied
+ | dynamic and other values in the workstation state.
+ |
+ --*/
+
+ddpex4rtn
+miDealWithStructDynamics(dynamic, pStruct)
+/* in */
+ ddDynamic dynamic;
+ diStructHandle pStruct;
+/* out */
+{
+ miStructPtr pstruct = (miStructPtr) pStruct->deviceData;
+ listofObj *pwksToLookAt;
+ ddpex4rtn err = Success;
+
+ /** Build up a list of workstations from the PostedTo and AppearOn
+ ** lists in the structure structure. They are inserted in such a
+ ** manner that duplicates between the lists are eliminated.
+ **/
+
+ if (pstruct->wksPostedTo->numObj || pstruct->wksAppearOn->numObj) {
+ pwksToLookAt = puCreateList(DD_WKS);
+ if (!pwksToLookAt) return (BadAlloc);
+ err = puMergeLists( pstruct->wksPostedTo, pstruct->wksAppearOn,
+ pwksToLookAt);
+
+ err = miDealWithDynamics(dynamic, pwksToLookAt);
+ puDeleteList(pwksToLookAt);
+ }
+ return (err);
+} /* miDealWithStructDynamics */
+
+
+/*++
+ |
+ | Function Name: miDealWithNSDynamics
+ |
+ | Function Description:
+ | Goes through each workstation that uses the name set
+ | and causes a Redraw of the workstation depending on the supplied
+ | dynamic and other values in the workstation state.
+ |
+ --*/
+
+ddpex43rtn
+miDealWithNSDynamics(pNS)
+/* in */
+ diNSHandle pNS;
+/* out */
+{
+ miNSHeader *pns = (miNSHeader *) pNS->deviceData;
+ listofObj *pwksToLookAt;
+ diWKSHandle *pWks;
+ miWksPtr pwks;
+ register int i;
+ ddpex43rtn err = Success;
+
+ if (!pns->wksRefList->numObj) return (Success);
+
+ pwksToLookAt = puCreateList(DD_WKS);
+ if (!pwksToLookAt) return (BadAlloc);
+
+ pWks = (diWKSHandle *) pns->wksRefList->pList;
+ for (i = 0; i < pns->wksRefList->numObj; i++, pWks++) {
+ pwks = (miWksPtr) (*pWks)->deviceData;
+ if ( (pwks->pRend->ns[(int) DD_HIGH_INCL_NS] == pNS)
+ || (pwks->pRend->ns[(int) DD_HIGH_EXCL_NS] == pNS))
+ err = puAddToList((ddPointer) pWks, (ddULONG) 1, pwksToLookAt);
+ }
+
+ err = miDealWithDynamics(HIGH_FILTER_DYNAMIC, pwksToLookAt);
+ if (err == Success) {
+ pWks = (diWKSHandle *) pns->wksRefList->pList;
+ for (i = 0; i < pns->wksRefList->numObj; i++, pWks++) {
+ pwks = (miWksPtr) (*pWks)->deviceData;
+ if ( (pwks->pRend->ns[(int) DD_INVIS_INCL_NS] == pNS)
+ || (pwks->pRend->ns[(int) DD_INVIS_EXCL_NS] == pNS))
+ err = puAddToList((ddPointer) pWks, (ddULONG) 1, pwksToLookAt);
+ }
+
+ err = miDealWithDynamics(INVIS_FILTER_DYNAMIC, pwksToLookAt);
+ }
+ puDeleteList(pwksToLookAt);
+
+ return (err);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miPick.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miPick.c
new file mode 100644
index 000000000..198f90ce8
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miPick.c
@@ -0,0 +1,727 @@
+/* $TOG: miPick.c /main/9 1998/02/10 12:43:42 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/miPick.c,v 1.7 1998/10/04 09:34:40 dawes Exp $ */
+
+#include "miWks.h" /* miPickMeasureStr is defined in here */
+#include "miNS.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "pexUtils.h"
+#include "PEXErr.h"
+#include "pexExtract.h"
+#include "pexos.h"
+
+
+extern ddpex4rtn UpdateStructRefs();
+extern ddpex43rtn UpdateNSRefs();
+extern ddpex3rtn BeginStructure();
+extern ddpex3rtn EndStructure();
+static unsigned char * copy_pick_path_to_buffer();
+void path_update_struct_refs();
+
+/* Level 4 Workstation Support */
+/* picking Procedures */
+
+/*++
+ |
+ | Function Name: InquirePickDevice
+ |
+ | Function Description:
+ | Handles the PEXGetPickDevice request.
+ |
+ | Note(s):
+ don't need pNumItems anymore, but it's not worth changing
+ the interface for now (post alpha release)
+ |
+ --*/
+
+/* depends on mask, num, and dsize being declared */
+#define COUNTBYTES(type,bytes) \
+ if (mask & (type)) \
+ { \
+ num++; \
+ dsize += (bytes); \
+ }
+
+ddpex4rtn
+InquirePickDevice(pWKS, devType, mask, pNumItems, pBuffer)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddEnumTypeIndex devType; /* pick device type */
+ ddBitmask mask; /* item bit mask */
+/* out */
+ ddULONG *pNumItems; /* number of items in list */
+ ddBufferPtr pBuffer; /* list of items */
+{
+
+ ddULONG num, dsize;
+ int dev_index;
+ register ddPointer pbuf;
+
+ miPickDevice *pPickDevice;
+
+#ifdef DDTEST
+ ErrorF(" InquirePickDevice\n");
+#endif
+
+ /* convert devType to index into devices array */
+ MIWKS_PICK_DEV_INDEX(dev_index, devType);
+
+ pPickDevice = &(((miWksPtr) pWKS->deviceData)->devices[dev_index]);
+ *pNumItems = 0;
+
+ num = 0;
+ dsize = 0;
+ COUNTBYTES(PEXPDPickStatus, 4);
+ COUNTBYTES(PEXPDPickPath, 4 + (pPickDevice->path->numObj * 12));
+ COUNTBYTES(PEXPDPickPathOrder, 4);
+ COUNTBYTES(PEXPDPickIncl, 4);
+ COUNTBYTES(PEXPDPickExcl, 4);
+ if (mask & PEXPDPickDataRec)
+ switch (dev_index) {
+ case 0:
+ num++;
+ dsize += MIWKS_SIZE_DATA_REC_1;
+ break;
+ case 1:
+ num++;
+ dsize += MIWKS_SIZE_DATA_REC_2;
+ break;
+ }
+ COUNTBYTES(PEXPDPickPromptEchoType, 4);
+ COUNTBYTES(PEXPDPickEchoVolume, sizeof(ddViewport));
+ COUNTBYTES(PEXPDPickEchoSwitch, 4);
+
+ /* Check the buffer size, and realloc if needed. */
+ PU_CHECK_BUFFER_SIZE(pBuffer, dsize);
+
+ *pNumItems = num;
+ pBuffer->dataSize = dsize;
+ pbuf = pBuffer->pBuf;
+
+ if (mask & PEXPDPickStatus) {
+ PACK_CARD32(pPickDevice->status, pbuf);
+ }
+
+ if (mask & PEXPDPickPath) {
+ PACK_CARD32(pPickDevice->path->numObj, pbuf);
+ pbuf = copy_pick_path_to_buffer(pPickDevice->path, pbuf);
+ }
+
+ if (mask & PEXPDPickPathOrder) {
+ PACK_CARD32(pPickDevice->pathOrder, pbuf);
+ }
+
+ if (mask & PEXPDPickIncl) {
+ ddULONG nsid;
+ if (pPickDevice->inclusion)
+ nsid = pPickDevice->inclusion->id;
+ else
+ nsid = 0;
+ PACK_CARD32(nsid, pbuf);
+ }
+
+ if (mask & PEXPDPickExcl) {
+ ddULONG nsid;
+ if (pPickDevice->inclusion)
+ nsid = pPickDevice->exclusion->id;
+ else
+ nsid = 0;
+ PACK_CARD32(nsid, pbuf);
+ }
+
+ /*
+ * no data recs are defined, so skip this - noone should expect to
+ * get data for this
+ */
+ if (mask & PEXPDPickDataRec) {
+ /* Sun says no data records defined, this is dummy code
+ * switch (dev_index) {
+ * case 0: bcopy((char *) &(MIWKS_PICK_DATA_REC_1(pPickDevice)),
+ * (char *) pbuf, MIWKS_SIZE_DATA_REC_1);
+ * pbuf += MIWKS_SIZE_DATA_REC_1;
+ * break;
+ * case 1: bcopy((char *) &(MIWKS_PICK_DATA_REC_2(pPickDevice)),
+ * (char *) pbuf, MIWKS_SIZE_DATA_REC_2);
+ * pbuf += MIWKS_SIZE_DATA_REC_2;
+ * break;
+ * }
+ */
+ /* if for some reason this bitflag is set return length
+ of zero bytes
+ */
+ PACK_CARD32(0,pbuf);
+ }
+
+ if (mask & PEXPDPickPromptEchoType) {
+ PACK_CARD32(pPickDevice->pet, pbuf);
+ }
+ if (mask & PEXPDPickEchoVolume) {
+ PACK_STRUCT(ddViewport,&(pPickDevice->echoVolume),pbuf);
+ }
+ if (mask & PEXPDPickEchoSwitch) {
+ PACK_CARD32(pPickDevice->echoSwitch,pbuf);
+ }
+ return (Success);
+} /* InquirePickDevice */
+
+/*++
+ |
+ | Function Name: ChangePickDevice
+ |
+ | Function Description:
+ | Handles the PEXChangePickDevice request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+ChangePickDevice(pWKS, devType, mask, pItems)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddEnumTypeIndex devType;/* pick device type */
+ ddBitmask mask; /* item bit mask */
+ ddPointer pItems; /* list of items */
+{
+
+ register ddPointer pbuf;
+ int dev_index;
+ miPickDevice *pPickDevice;
+ CARD16 pickStatus;
+ CARD16 pickPathOrder;
+ CARD16 pickEchoSwitch;
+ INT16 pickPromptEchoType;
+ ddULONG numPickPath;
+ ddpex4rtn err;
+ extern ddpex4rtn ValidateStructurePath();
+
+#ifdef DDTEST
+ ErrorF(" ChangePickDevice\n");
+#endif
+
+ /* convert devType to index into devices array */
+ MIWKS_PICK_DEV_INDEX(dev_index, devType);
+
+ pPickDevice = &(((miWksPtr) pWKS->deviceData)->devices[dev_index]);
+
+ pbuf = pItems;
+
+ /* go through and check for errors first */
+ if (mask & PEXPDPickStatus) {
+ EXTRACT_CARD16_FROM_4B(pickStatus,pbuf);
+ if (!((pickStatus == PEXNoPick) || (pickStatus == PEXOk)))
+ return (BadValue);
+ }
+
+ if (mask & PEXPDPickPath) {
+ /* valid path is checked when it's set */
+ EXTRACT_CARD32(numPickPath,pbuf);
+ SKIP_STRUCT(pbuf,numPickPath,ddPickPath);
+ }
+
+ if (mask & PEXPDPickPathOrder) {
+ EXTRACT_CARD16_FROM_4B(pickPathOrder,pbuf);
+ if (!((pickPathOrder == PEXTopFirst)||(pickPathOrder == PEXBottomFirst)))
+ return (BadValue);
+ }
+ if (mask & PEXPDPickIncl)
+ SKIP_PADDING(pbuf,4);
+
+ if (mask & PEXPDPickExcl)
+ SKIP_PADDING(pbuf,4);
+
+ /*
+ * no data recs are defined, so skip the bytes if they're there
+ */
+ if (mask & PEXPDPickDataRec) {
+ CARD32 i, skip;
+ EXTRACT_CARD32(i,pbuf);
+ skip = (i+3)/4;
+ SKIP_PADDING(pbuf,skip);
+ }
+
+ if (mask & PEXPDPickPromptEchoType) {
+ EXTRACT_INT16_FROM_4B(pickPromptEchoType,pbuf);
+ switch (pickPromptEchoType) {
+ case PEXEchoPrimitive:
+ case PEXEchoStructure:
+ case PEXEchoNetwork:
+ break;
+ default:
+ return (BadValue);
+ }
+ }
+
+ if (mask & PEXPDPickEchoVolume)
+ SKIP_PADDING(pbuf,sizeof(ddViewport));
+
+ if (mask & PEXPDPickEchoSwitch) {
+ EXTRACT_CARD16_FROM_4B(pickEchoSwitch,pbuf);
+ if (!((pickEchoSwitch == PEXOff) || (pickEchoSwitch == PEXOn)))
+ return (BadValue);
+ }
+
+ /* now set the values */
+ pbuf = pItems;
+
+ if (mask & PEXPDPickStatus) {
+ pPickDevice->status = pickStatus;
+ SKIP_PADDING(pbuf,4);
+ }
+
+ if (mask & PEXPDPickPath) {
+ SKIP_PADDING(pbuf,4);
+
+ /* before putting this path in, remove structure ref
+ * count of current path
+ */
+ if (pPickDevice->path->numObj)
+ path_update_struct_refs(pPickDevice->path, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ PU_EMPTY_LIST(pPickDevice->path);
+
+ /* dipex changes struct ids to handles */
+ puAddToList((ddPointer) pbuf, numPickPath, pPickDevice->path);
+ SKIP_STRUCT(pbuf,numPickPath,ddPickPath);
+
+ /*
+ * now go through the path and update the structures's ref. count
+ */
+ path_update_struct_refs( pPickDevice->path, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+ /* make sure it's a valid path */
+ err = ValidateStructurePath(pPickDevice->path);
+ if (err != Success)
+ return (err);
+ }
+
+ if (mask & PEXPDPickPathOrder) {
+ pPickDevice->pathOrder = pickPathOrder;
+ SKIP_PADDING(pbuf,4);
+ }
+
+ if (mask & PEXPDPickIncl) {
+ /*
+ * dipex looked up the nameset handle and passed it to here
+ */
+ if (pPickDevice->inclusion != *(diNSHandle *)pbuf) {
+ if (pPickDevice->inclusion)
+ UpdateNSRefs( pPickDevice->inclusion, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ pPickDevice->inclusion = *(diNSHandle *) pbuf;
+ UpdateNSRefs( pPickDevice->inclusion, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+ }
+ SKIP_PADDING(pbuf,4);
+ }
+
+ if (mask & PEXPDPickExcl) {
+ /*
+ * dipex looked up the nameset handle and passed it to here
+ */
+ if (pPickDevice->exclusion != *(diNSHandle *)pbuf) {
+ if (pPickDevice->exclusion)
+ UpdateNSRefs( pPickDevice->exclusion, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ pPickDevice->exclusion = *(diNSHandle *)pbuf;
+ UpdateNSRefs( pPickDevice->exclusion, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+ }
+ SKIP_PADDING(pbuf,4);
+ }
+
+ /*
+ * no data recs are defined, so skip this - there'd better not be any
+ * data there for these
+ */
+ if (mask & PEXPDPickDataRec) {
+ /* This is dummy code from Sun,
+ * I am adding code to skip bytes if present - JSH
+ * switch (dev_index) { case 0: bcopy((char *) pbuf, (char *)
+ * &(MIWKS_PICK_DATA_REC_1(pPickDevice)), MIWKS_SIZE_DATA_REC_1);
+ * pbuf += MIWKS_SIZE_DATA_REC_1; break; case 1: bcopy((char *) pbuf,
+ * (char *) &(MIWKS_PICK_DATA_REC_2(pPickDevice)),
+ * MIWKS_SIZE_DATA_REC_2); pbuf += MIWKS_SIZE_DATA_REC_2; break; }
+ */
+
+ CARD32 i, skip;
+ EXTRACT_CARD32(i,pbuf);
+ skip = (i+3)/4;
+ SKIP_PADDING(pbuf,skip);
+ }
+
+ if (mask & PEXPDPickPromptEchoType) {
+ pPickDevice->pet = pickPromptEchoType;
+ SKIP_PADDING(pbuf,4);
+ }
+
+ if (mask & PEXPDPickEchoVolume) {
+ EXTRACT_STRUCT(1, ddViewport, &(pPickDevice->echoVolume), pbuf);
+ }
+
+ if (mask & PEXPDPickEchoSwitch) {
+ pPickDevice->echoSwitch = pickEchoSwitch;
+ }
+
+ return (Success);
+} /* ChangePickDevice */
+
+/*++
+ |
+ | Function Name: UpdatePickMeasure
+ |
+ | Function Description:
+ | Handles the PEXUpdatePickMeasure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+UpdatePickMeasure(pPM, size, pInput)
+/* in */
+ diPMHandle pPM; /* pick measure */
+ ddULONG size; /* size of input record */
+ ddPointer pInput; /* input record */
+/* out */
+{
+ miPickMeasureStr *ppm = (miPickMeasureStr *) pPM->deviceData;
+ miWksStr *pwks = (miWksStr *) ppm->pWks->deviceData;
+ MIWKS_PM_INPUT_STR_1 *pIn1 = (MIWKS_PM_INPUT_STR_1 *)pInput;
+ MIWKS_PM_INPUT_STR_2 *pIn2 = (MIWKS_PM_INPUT_STR_2 *)pInput;
+ miTraverserState trav_state;
+ register ddOrdStruct *pos;
+ diStructHandle pstr;
+ ddULONG start_el;
+ ddULONG num_els;
+ ddpex4rtn err;
+ extern ddpex3rtn EndPicking();
+ extern ddpex4rtn traverser();
+
+#ifdef DDTEST
+ ErrorF(" UpdatePickMeasure\n");
+#endif
+
+ if ((pwks->pRend->pDrawable == NULL) ||
+ (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ if (!pwks->postedStructs.numStructs)
+ return (Success);
+
+ switch (ppm->type) {
+ case PEXPickDeviceDC_HitBox:
+ MIWKS_PM_INPUT_REC_1(ppm) = *pIn1;
+ break;
+ case PEXPickDeviceNPC_HitVolume:
+ MIWKS_PM_INPUT_REC_2(ppm) = *pIn2;
+ break;
+ }
+ ppm->status = PEXNoPick;
+
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+ /* set to traverse all posted structs */
+ pos = pwks->postedStructs.postruct;
+ pos = pos->next;
+ pstr = pos->pstruct;
+ start_el = 1;
+ num_els = MISTR_NUM_EL((miStructPtr) pstr->deviceData);
+
+
+ BeginPicking(pwks->pRend, pPM);
+
+ /* traverse posted structs */
+ do {
+ /* reset for each structure */
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+
+ if (MISTR_NUM_EL((miStructPtr) pstr->deviceData)) {
+ BeginStructure(pwks->pRend, pstr->id);
+
+ err = traverser( pwks->pRend, pstr, start_el, num_els, pPM,
+ (ddSCStr *)NULL, &trav_state);
+
+ EndStructure(pwks->pRend);
+ }
+ if (pos)
+ if (pos = pos->next) {
+ pstr = pos->pstruct;
+ num_els = MISTR_NUM_EL((miStructPtr) pstr->deviceData);
+ }
+ } while (pos);
+
+ EndPicking(pwks->pRend);
+
+ if (ppm->status == PEXOk) {
+ /* now, update the structure ref counts */
+ path_update_struct_refs(ppm->path, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+ } else {
+ /* reset pick path??? */
+ return(err);
+ }
+
+ return (Success);
+} /* UpdatePickMeasure */
+
+/*++
+ |
+ | Function Name: CreatePickMeasure
+ |
+ | Function Description:
+ | Handle the PEXCreatePickMeasure request
+ |
+ | Note(s):
+ |
+ --*/
+
+extern void UpdateWksRefs();
+
+ddpex4rtn
+CreatePickMeasure(pWKS, devType, pPM)
+/* in */
+ diWKSHandle pWKS;
+ ddEnumTypeIndex devType;/* pick device type */
+ diPMHandle pPM; /* pick measure handle */
+/* out */
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ register miPickMeasureStr *ppm;
+ int dev_index;
+ register miPickDevice *pPickDevice;
+
+#ifdef DDTEST
+ ErrorF(" CreatePickMeasure\n");
+#endif
+
+ MIWKS_PICK_DEV_INDEX(dev_index, devType);
+
+ ppm = (miPickMeasureStr *) xalloc(sizeof(miPickMeasureStr));
+ if (!ppm) return (BadAlloc);
+
+ ppm->path = puCreateList(DD_PICK_PATH);
+ if (!ppm->path) {
+ xfree(ppm);
+ return (BadAlloc);
+ }
+ pPickDevice = &(pwks->devices[dev_index]);
+
+ ppm->pWks = pWKS;
+ ppm->type = devType;
+ ppm->status = pPickDevice->status;
+ ppm->pathOrder = pPickDevice->pathOrder;
+ ppm->incl_handle = pPickDevice->inclusion;
+ ppm->excl_handle = pPickDevice->exclusion;
+
+ if (ppm->incl_handle)
+ UpdateNSRefs( ppm->incl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ if (ppm->excl_handle)
+ UpdateNSRefs( ppm->excl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+
+ if (puCopyList(pPickDevice->path, ppm->path)) {
+ puDeleteList(ppm->path);
+ xfree(ppm);
+ return (BadAlloc);
+ }
+ /* now go through the path and update the structures' ref. count */
+ path_update_struct_refs( ppm->path, (diResourceHandle) NULL,
+ PICK_RESOURCE, ADD);
+
+ switch (dev_index) {
+ case 0:
+ MIWKS_PM_DATA_REC_1(ppm) = MIWKS_PD_DATA_REC_1(pPickDevice);
+ break;
+ case 1:
+ MIWKS_PM_DATA_REC_2(ppm) = MIWKS_PD_DATA_REC_2(pPickDevice);
+ break;
+ }
+
+ /* no extra data for PEX-SI */
+ ppm->devPriv = (ddPointer) NULL;
+
+ UpdateWksRefs(pWKS, (diResourceHandle) ppm, PICK_RESOURCE, ADD);
+ pPM->deviceData = (ddPointer) ppm;
+ return (Success);
+}
+
+
+/*++
+ |
+ | Function Name: FreePickMeasure
+ |
+ | Function Description:
+ | Handles the PEXFreePickMeasure request
+ |
+ | Note(s):
+ pick measure is not used by other resources, so delete it now
+ |
+ --*/
+
+ddpex4rtn
+FreePickMeasure(pPM, PMid)
+/* in */
+ diPMHandle pPM; /* pick measure */
+ ddResourceId PMid; /* pick measure id */
+/* out */
+{
+ register miPickMeasureStr *ppm = (miPickMeasureStr *) pPM->deviceData;
+
+ if (ppm->devPriv) xfree(ppm->devPriv);
+
+ /* go through the path and update the structures' ref. count */
+ if (ppm->path) path_update_struct_refs( ppm->path, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ if (ppm->path) puDeleteList(ppm->path);
+
+ if (ppm->pWks)
+ UpdateWksRefs(ppm->pWks, (diResourceHandle) ppm, PICK_RESOURCE, REMOVE);
+
+ if (ppm->incl_handle)
+ UpdateNSRefs( ppm->incl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ if (ppm->excl_handle)
+ UpdateNSRefs( ppm->excl_handle, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ xfree(ppm);
+ xfree(pPM);
+
+ return (Success);
+} /* FreePickMeasure */
+
+/*++
+ |
+ | Function Name: InquirePickMeasure
+ |
+ | Function Description:
+ | Handles the PEXInquirePickMeasure request
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquirePickMeasure(pPM, itemMask, pNumItems, pBuffer)
+/* in */
+ diPMHandle pPM; /* pick measure */
+ ddBitmask itemMask; /* pick item bit mask */
+/* out */
+ ddULONG *pNumItems; /* number of items returned */
+ ddBufferPtr pBuffer;/* return buffer */
+{
+ register miPickMeasureStr *ppm = (miPickMeasureStr *) pPM->deviceData;
+ register ddULONG dsize = 0;
+ register ddPointer pbuf;
+
+ *pNumItems = 0;
+ pBuffer->dataSize = 0;
+
+ if (itemMask & PEXPMStatus) {
+ dsize += 4;
+ *pNumItems++;
+ }
+ if (itemMask & PEXPMPath) {
+ dsize += (4 + (ppm->path->numObj * 12));
+ *pNumItems++;
+ }
+ PU_CHECK_BUFFER_SIZE(pBuffer, dsize);
+ pBuffer->dataSize = dsize;
+ pbuf = pBuffer->pBuf;
+
+ if (itemMask & PEXPMStatus) {
+ PACK_CARD32(ppm->status,pbuf);
+ }
+ if (itemMask & PEXPMPath) {
+ PACK_CARD32(ppm->path->numObj,pbuf);
+ pbuf = copy_pick_path_to_buffer(ppm->path, pbuf);
+ }
+ return (Success);
+}
+
+static unsigned char *
+copy_pick_path_to_buffer(pPath, pBuf)
+ listofObj *pPath;
+ ddPointer pBuf;
+{
+ register int i;
+ ddPickPath *pp = (ddPickPath *)(pPath->pList);
+ unsigned char *ptr = pBuf;
+
+ for (i = 0; i < pPath->numObj; i++, pp++) {
+ PACK_CARD32(pp->structure->id, ptr);
+ PACK_CARD32(pp->offset, ptr);
+ PACK_CARD32(pp->pickid, ptr);
+ }
+ return (ptr);
+}
+
+/* pick devices and pick measures are counted */
+void
+path_update_struct_refs(pPath, pResource, which, action)
+ listofObj *pPath;
+ diResourceHandle pResource;
+ ddResourceType which;
+ ddAction action;
+{
+ ddPickPath *pp = (ddPickPath *) pPath->pList;
+ register int i;
+
+ for (i = 0; i < pPath->numObj; pp++, i++)
+ UpdateStructRefs(pp->structure, pResource, which, action);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miSC.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miSC.c
new file mode 100644
index 000000000..4e58e5534
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miSC.c
@@ -0,0 +1,212 @@
+/* $TOG: miSC.c /main/5 1998/02/10 12:43:47 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/miSC.c,v 1.8 1999/01/31 12:21:29 dawes Exp $ */
+
+
+#include "ddpex4.h"
+#include "mipex.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+/* Level 4 Workstation Support */
+/* Search Context procedures */
+
+/*++
+ |
+ | Function Name: SearchNetwork
+ |
+ | Function Description:
+ | Handles the PEXSearchNetwork request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SearchNetwork(pSC, pNumRefs, pBuffer)
+/* in */
+ ddSCStr *pSC; /* search context */
+/* out */
+ ddULONG *pNumRefs; /* number of references returned in list */
+ ddBufferPtr pBuffer;/* list of element references */
+{
+ miTraverserState trav_state;
+ ddpex4rtn err = Success;
+ diStructHandle pstr;
+ register int i;
+ register pexElementRef *pb;
+ register ddElementRef *pr;
+
+#ifdef DDTEST
+ ErrorF(" SearchNetwork\n");
+#endif
+
+ pSC->status = PEXNotFound;
+ *pNumRefs = 0;
+
+ if (pSC->startPath->numObj) {
+ trav_state.exec_str_flag = ES_FOLLOW_SEARCH;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) pSC->startPath->pList;
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+ } else
+ return (PEXERR(PEXPathError));
+
+ pstr = (diStructHandle) trav_state.p_curr_sc_el->structure;
+
+ if (MISTR_NUM_EL((miStructPtr) pstr->deviceData)) {
+ ddRendererStr rend;
+
+ /* init dummy renderer */
+ rend.rendId = PEXAlreadyFreed;
+ rend.pPC = (ddPCPtr)NULL;
+ /* rend.drawExample = ?? */
+ rend.pDrawable = (DrawablePtr)NULL;
+ rend.drawableId = 0;
+ rend.curPath = puCreateList(DD_ELEMENT_REF);
+ if ( !rend.curPath)
+ return(BadAlloc);
+
+ rend.state = PEXIdle;
+ rend.tablesMask = 0;
+ rend.namesetsMask = 0;
+ rend.attrsMask = 0;
+ rend.tablesChanges = 0;
+ rend.namesetsChanges = 0;
+ rend.attrsChanges = 0;
+
+ rend.lut[PEXMarkerBundleLUT] = 0;
+ rend.lut[PEXTextBundleLUT] = 0;
+ rend.lut[PEXLineBundleLUT] = 0;
+ rend.lut[PEXInteriorBundleLUT] = 0;
+ rend.lut[PEXEdgeBundleLUT] = 0;
+ rend.lut[PEXViewLUT] = 0;
+ rend.lut[PEXColourLUT] = 0;
+ rend.lut[PEXDepthCueLUT] = 0;
+ rend.lut[PEXLightLUT] = 0;
+ rend.lut[PEXColourApproxLUT] = 0;
+ rend.lut[PEXPatternLUT] = 0;
+ rend.lut[PEXTextFontLUT] = 0;
+
+ rend.ns[(unsigned)DD_HIGH_INCL_NS] = 0;
+ rend.ns[(unsigned)DD_HIGH_EXCL_NS] = 0;
+ rend.ns[(unsigned)DD_INVIS_INCL_NS] = 0;
+ rend.ns[(unsigned)DD_INVIS_EXCL_NS] = 0;
+
+ rend.hlhsrMode = PEXHlhsrOff;
+ rend.npcSubvolume.minval.x = 0.0;
+ rend.npcSubvolume.minval.y = 0.0;
+ rend.npcSubvolume.minval.z = 0.0;
+ rend.npcSubvolume.maxval.x = 1.0;
+ rend.npcSubvolume.maxval.y = 1.0;
+ rend.npcSubvolume.maxval.z = 1.0;
+
+ /* can't use drawable, it doesn't exist. Is viewport needed??
+ * what viewport to use? default is to use drawable
+ */
+ rend.viewport.useDrawable = 0;
+ rend.viewport.minval.x = 0;
+ rend.viewport.minval.y = 0;
+ rend.viewport.minval.z = 0.0;
+ rend.viewport.maxval.x = 1;
+ rend.viewport.maxval.y = 1;
+ rend.viewport.maxval.z = 1.0;
+ rend.clipList = puCreateList( DD_DEVICE_RECT );
+ if ( !rend.clipList ) {
+ puDeleteList( rend.curPath );
+ return( BadAlloc );
+ }
+
+ rend.immediateMode = FALSE;
+ /* InitRenderer does some stuff not needed for Searching
+ * and since some of that stuff uses a drawable (and searching
+ * doesn't have one), a work-aroundis put in around the drawable
+ * code. * It may be good to sometime reevaluate this and find
+ * another way to deal with it.
+ */
+ err = InitRenderer( &rend );
+ if ( err != Success ) {
+ puDeleteList( rend.curPath );
+ puDeleteList( rend.clipList );
+ return( err );
+ }
+
+ BeginSearching(&rend, pSC);
+
+ BeginStructure(&rend, pstr->id);
+
+ /* always start at the first element in the structure */
+ err = traverser(&rend, pstr, (ddULONG) 1,
+ MISTR_NUM_EL((miStructPtr) pstr->deviceData),
+ (diPMHandle) NULL, pSC, &trav_state);
+
+ EndStructure(&rend);
+
+ /* turn off searching */
+ EndSearching(&rend);
+
+ if (pSC->status == PEXFound) {
+ pBuffer->dataSize = pSC->startPath->numObj * sizeof(pexElementRef);
+ PU_CHECK_BUFFER_SIZE(pBuffer, pBuffer->dataSize);
+ pb = (pexElementRef *)pBuffer->pBuf;
+ pr = (ddElementRef *)pSC->startPath->pList;
+ for (i=pSC->startPath->numObj; i>0; i--, pb++, pr++) {
+ pb->structure = pr->structure->id;
+ pb->offset = pr->offset;
+ }
+ *pNumRefs = pSC->startPath->numObj;
+ } else
+ /* set start path to "not found" */
+ pSC->startPath->numObj = 0;
+ } else
+ return (PEXERR(PEXPathError));
+
+ return (Success);
+} /* SearchNetwork */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miStruct.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miStruct.c
new file mode 100644
index 000000000..68ebb9415
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miStruct.c
@@ -0,0 +1,2487 @@
+/* $TOG: miStruct.c /main/13 1998/02/10 12:43:51 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/miStruct.c,v 3.5 1998/10/04 09:34:41 dawes Exp $ */
+
+#include "mipex.h"
+#include "ddpex4.h"
+#include "miStruct.h"
+#include "PEXErr.h"
+#include "PEXproto.h"
+#include "pexError.h"
+#include "pexUtils.h"
+#include "miStrMacro.h"
+#include "pexos.h"
+
+
+/* Level 4 Workstation Support */
+/* Structure Procedures */
+
+extern cssTableType CreateCSSElementTable[];
+extern cssTableType DestroyCSSElementTable[];
+extern cssTableType CopyCSSElementTable[];
+extern cssTableType ReplaceCSSElementTable[];
+extern cssTableType InquireCSSElementTable[];
+
+extern ddBOOL miGetStructurePriority();
+
+extern ddpex4rtn miDealWithStructDynamics();
+extern ddpex4rtn miDealWithDynamics();
+
+void miPrintPath();
+
+#define SET_STR_HEADER(pStruct, pheader) \
+ register miStructPtr pheader = (miStructPtr) pStruct->deviceData
+
+#define DESTROY_STR_HEADER(pheader) \
+ if (pheader->parents) puDeleteList(pheader->parents); \
+ if (pheader->children) puDeleteList(pheader->children); \
+ if (pheader->wksPostedTo) puDeleteList(pheader->wksPostedTo); \
+ if (pheader->wksAppearOn) puDeleteList(pheader->wksAppearOn); \
+ if (MISTR_ZERO_EL(pheader)) xfree(MISTR_ZERO_EL(pheader)); \
+ if (MISTR_LAST_EL(pheader)) xfree(MISTR_LAST_EL(pheader)); \
+ xfree(pheader)
+
+#define CHECK_DELETE(pHandle, pheader) \
+ if ((pheader)->freeFlag && !(pheader)->refCount) { \
+ DESTROY_STR_HEADER(pheader); \
+ xfree(pHandle); \
+ }
+
+/*++
+ |
+ | Function Name: pos2offset
+ |
+ | Function Description:
+ | a utility function for converting whence, offset values to a valid
+ | structure offset
+ |
+ | Note(s):
+ |
+ --*/
+
+static ddpex4rtn
+pos2offset(pstruct, ppos, poffset)
+/* in */
+ miStructStr *pstruct;/* pointer to the structure involved */
+ ddElementPos *ppos; /* the position information */
+/* out */
+ ddULONG *poffset;/* the valid offset calculated from the
+ * postition */
+{
+ ddUSHORT whence = ppos->whence;
+ ddLONG offset = ppos->offset, temp;
+
+#ifdef DDTEST
+ ErrorF(" POSITION : ");
+#endif
+
+ switch (whence) {
+ case PEXBeginning:
+
+#ifdef DDTEST
+ ErrorF("PEXBeginning, ");
+#endif
+
+ temp = offset;
+ break;
+
+ case PEXCurrent:
+
+#ifdef DDTEST
+ ErrorF("PEXCurrent, ");
+#endif
+
+ temp = MISTR_CURR_EL_OFFSET(pstruct) + offset;
+ break;
+
+ case PEXEnd:
+
+#ifdef DDTEST
+ ErrorF("End, ");
+#endif
+
+ /* numElements is the same as the last elements offset */
+ temp = MISTR_NUM_EL(pstruct) + offset;
+ break;
+
+ default:
+
+#ifdef DDTEST
+ ErrorF("Bad Value\n ");
+#endif
+
+ /* value error */
+ return (BadValue);
+ break;
+ }
+
+#ifdef DDTEST
+ ErrorF("%d", offset);
+#endif
+
+ /* now check that the new offset is in range of the structure */
+ if (temp < 0)
+ *poffset = 0;
+ else if (temp > MISTR_NUM_EL(pstruct))
+ *poffset = MISTR_NUM_EL(pstruct);
+ else
+ *poffset = temp;
+
+#ifdef DDTEST
+ ErrorF(" = %d\n", *poffset);
+#endif
+
+ return (0);
+}
+
+/*++
+ |
+ | Function Name: CreateStructure
+ |
+ | Function Description:
+ | Handles the PEXCreateStructure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+CreateStructure(pStruct)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+/* out */
+{
+ register miStructStr *pheader;
+ register miGenericElementPtr pelement;
+
+#ifdef DDTEST
+ ErrorF("\nCreateStructure %d\n", pStruct->id);
+#endif
+
+ pStruct->deviceData = NULL;
+
+ if ((pheader = (miStructStr *) xalloc(sizeof(miStructStr))) == NULL)
+ return (BadAlloc);
+
+ MISTR_EDIT_MODE(pheader) = PEXStructureInsert;
+ MISTR_NUM_EL(pheader) = 0;
+ MISTR_LENGTH(pheader) = 0;
+
+ pheader->refCount = 0;
+ pheader->freeFlag = MI_FALSE;
+
+ pheader->parents = pheader->children = pheader->wksPostedTo = pheader->wksAppearOn = NULL;
+
+ pheader->parents = puCreateList(DD_STRUCT);
+ pheader->children = puCreateList(DD_STRUCT);
+ pheader->wksPostedTo = puCreateList(DD_WKS);
+ pheader->wksAppearOn = puCreateList(DD_WKS);
+ if ( !pheader->parents || !pheader->children
+ || !pheader->wksPostedTo || !pheader->wksAppearOn) {
+ DESTROY_STR_HEADER(pheader);
+ return (BadAlloc);
+ }
+ /* create dummy first and last elements */
+ if ((pelement = (miGenericElementPtr)xalloc(sizeof(miGenericElementStr)))
+ == NULL) {
+ DESTROY_STR_HEADER(pheader);
+ return (BadAlloc);
+ }
+ MISTR_PREV_EL(pelement) = NULL;
+ MISTR_EL_TYPE(pelement) = PEXOCNil;
+ MISTR_EL_LENGTH(pelement) = 1;
+ MISTR_ZERO_EL(pheader) = MISTR_CURR_EL_PTR(pheader) = pelement;
+ MISTR_CURR_EL_OFFSET(pheader) = 0;
+
+ if ((pelement = (miGenericElementPtr) xalloc(sizeof(miGenericElementStr)))
+ == NULL) {
+ DESTROY_STR_HEADER(pheader);
+ return (BadAlloc);
+ }
+ MISTR_EL_TYPE(pelement) = PEXOCNil;
+ MISTR_EL_LENGTH(pelement) = 1;
+ MISTR_PREV_EL(pelement) = MISTR_ZERO_EL(pheader);
+ MISTR_NEXT_EL(pelement) = NULL;
+ MISTR_NEXT_EL(MISTR_ZERO_EL(pheader)) = pelement;
+ MISTR_LAST_EL(pheader) = pelement;
+
+ pStruct->deviceData = (ddPointer) pheader;
+ return (Success);
+} /* CreateStructure */
+
+/*++
+ |
+ | Function Name: CopyStructure
+ |
+ | Function Description:
+ | Handles the PEXCopyStructure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+CopyStructure(pSrcStruct, pDestStruct)
+/* in */
+ diStructHandle pSrcStruct; /* source structure */
+ diStructHandle pDestStruct; /* destination structure */
+{
+ SET_STR_HEADER(pSrcStruct, psource);
+ SET_STR_HEADER(pDestStruct, pdest);
+ ddpex4rtn err = Success;
+ ddElementRange sourceRange;
+ ddElementPos destPos;
+ miGenericElementPtr pel;
+ register ddULONG i;
+
+#ifdef DDTEST
+ ErrorF("\nCopyStructure\n");
+#endif
+
+ /* to do: make this smarter so it can use Replace if possible */
+
+ i = MISTR_NUM_EL(pdest);
+ MISTR_DEL_ELS(pDestStruct, pdest, 1, i); /* can't use NUM_EL macro here
+ * because the num of els
+ * changes as they are deleted */
+
+ MISTR_CURR_EL_OFFSET(pdest) = 0;
+ MISTR_CURR_EL_PTR(pdest) = MISTR_ZERO_EL(pdest);
+
+ sourceRange.position1.whence = PEXBeginning;
+ sourceRange.position1.offset = 0;
+ sourceRange.position2.whence = PEXEnd;
+ sourceRange.position2.offset = 0;
+ destPos.whence = PEXBeginning;
+ destPos.offset = 0;
+
+ /* Copy Elements will redraw picture if nec */
+ if (err = CopyElements(pSrcStruct, &sourceRange, pDestStruct, &destPos)
+ != Success)
+ return (err);
+
+ MISTR_EDIT_MODE(pdest) = MISTR_EDIT_MODE(psource);
+ MISTR_CURR_EL_OFFSET(pdest) = MISTR_CURR_EL_OFFSET(psource);
+
+ MISTR_FIND_EL(pdest, MISTR_CURR_EL_OFFSET(pdest), pel);
+ MISTR_CURR_EL_PTR(pdest) = pel;
+
+ return (Success);
+} /* CopyStructure */
+
+/* find_execute_structure looks for the specified execute structure element
+ * If the specified structure is NULL, then it finds the next one.
+ * If the element is found, its offset from the start is returned in poffset
+ * When calling this repeatedly to look for all occurrences of the element,
+ * be sure to check that you've reached the end of the structure. Otherwise
+ * you would infinitely loop on finding the last element if it is a match.
+ */
+static ddpex4rtn
+find_execute_structure(pStruct, pStartPos, structHandle, poffset)
+diStructHandle pStruct;/* search this structure */
+ddElementPos *pStartPos;
+diStructHandle structHandle; /* for this exec structure element */
+ddULONG *poffset;
+{
+ SET_STR_HEADER(pStruct, pstruct);
+ ddUSHORT foundExecuteElement;
+ ddUSHORT executeStructureElement = PEXOCExecuteStructure;
+ miGenericElementPtr pel;
+ ddpex4rtn err = Success;
+
+ while (err == Success) {
+ /** Get the position of the next execute structure element **/
+ err = ElementSearch( pStruct, pStartPos, (ddULONG) PEXForward,
+ (ddULONG) 1, (ddULONG) 0,
+ &executeStructureElement, (ddUSHORT *) NULL,
+ &foundExecuteElement, poffset);
+
+ if (foundExecuteElement == PEXFound) {
+ MISTR_FIND_EL(pstruct, *poffset, pel);
+
+ if ( (structHandle == (diStructHandle) MISTR_GET_EXSTR_STR(pel))
+ || (structHandle == (diStructHandle) NULL))
+ return (PEXFound);
+
+ /*
+ * continue searching at the next element unless this one
+ * was the last
+ */
+ if (*poffset == MISTR_NUM_EL(pstruct)) return (PEXNotFound);
+
+ pStartPos->whence = PEXBeginning;
+ pStartPos->offset = *poffset + 1;
+ } else
+ return (PEXNotFound);
+
+ }
+ if (err != Success) return (PEXNotFound);
+ return (PEXFound);
+}
+
+/*++
+ |
+ | Function Name: DeleteStructureRefs
+ |
+ | Function Description:
+ | Handles the PEXDeleteStructures request.
+ |
+ | This routine deletes all structure elements in all of the
+ | structures which reference the specified structure. It is called
+ | by DeleteStructure.
+ |
+ | Note(s):
+ | This does not correct the picture because it is called by
+ | DeleteStructure, which does correct it
+ |
+ --*/
+
+ddpex4rtn
+DeleteStructureRefs(pStruct)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+/* out */
+{
+
+ SET_STR_HEADER(pStruct, pstruct);
+ diStructHandle parentHandle;
+ miStructPtr pparentStruct;
+ ddElementPos position;
+ miGenericElementPtr newPointer;
+ miGenericElementPtr pel, pprevel;
+ ddLONG newOffset;
+ ddULONG offsetFromStart, numParents;
+
+#ifdef DDTEST
+ ErrorF("\nDeleteStructureRefs of structure %d\n", pStruct->id);
+#endif /* DDTEST */
+
+ /** Search through each of the structure's parents **/
+
+ /*
+ * The tricky part here is that each time the execute structure
+ * element is deleted from the parent, the structure's parent list
+ * changes (in DeleteElements) so, remember how many parents there
+ * originally are and look at that many. Each time a parent is
+ * deleted from the list, it's always deleted from the front of the
+ * list, so the next parent will be at the front of the list the next
+ * time through
+ */
+ for (numParents = pstruct->parents->numObj; numParents > 0;) {
+ parentHandle = *(diStructHandle *) pstruct->parents->pList;
+
+ /*
+ * look through all of this structure's elements to delete
+ * all references to the structure being deleted
+ */
+ pparentStruct = (miStructPtr) (parentHandle)->deviceData;
+
+ newOffset = 0;
+ newPointer = NULL;
+
+ /*
+ * look for all execute structure (child) elements in the
+ * parent structure and delete them this could do only one
+ * element at a time. any other elements would be gotten
+ * later because the parent is duplicated in the childs list
+ * for each occurrence and the outer loop would find the
+ * parent again.
+ */
+ /* start looking at the beginning of the parent structure */
+ position.whence = PEXBeginning;
+ position.offset = 0;
+
+ /*
+ * dont' forget we're really comparing the structure handles
+ * because the id was replaced with the handle in the exec
+ * str elements
+ */
+ while (find_execute_structure( parentHandle, &position, pStruct,
+ &offsetFromStart)
+ == PEXFound) {
+ if (offsetFromStart == MISTR_CURR_EL_OFFSET(pparentStruct)) {
+ newOffset = MISTR_CURR_EL_OFFSET(pparentStruct) - 1;
+ newPointer = MISTR_PREV_EL(MISTR_CURR_EL_PTR(pparentStruct));
+ } else if (offsetFromStart < MISTR_CURR_EL_OFFSET(pparentStruct)) {
+ newOffset = MISTR_CURR_EL_OFFSET(pparentStruct) - 1;
+ newPointer = MISTR_CURR_EL_PTR(pparentStruct);
+ } else {
+ newOffset = MISTR_CURR_EL_OFFSET(pparentStruct);
+ newPointer = MISTR_CURR_EL_PTR(pparentStruct);
+ }
+
+ MISTR_FIND_EL(pparentStruct, offsetFromStart, pel);
+ pprevel = MISTR_PREV_EL(pel);
+
+ MISTR_DEL_ONE_EL(parentHandle, pprevel, pel);
+
+ MISTR_CURR_EL_PTR(pparentStruct) = newPointer;
+ MISTR_CURR_EL_OFFSET(pparentStruct) = newOffset;
+
+ numParents--;
+
+ /*
+ * continue looking for other execute structures
+ * after the one found but it just got deleted, so
+ * the next one is now the same offset as the old one
+ */
+ position.whence = PEXBeginning;
+ position.offset = offsetFromStart;
+ }
+
+ }
+
+ return (Success);
+} /* DeleteStructureRefs */
+
+/*++
+ |
+ | Function Name: DeleteStructure
+ |
+ | Function Description:
+ | Deletes all storage associated with the structure
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+DeleteStructure(pStruct, Sid)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddResourceId Sid; /* structure resource id */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ register ddULONG i, imax;
+ diWKSHandle pwks;
+ ddpex4rtn err = Success, next_err = Success;
+ listofObj *pwksToLookAt;
+
+#ifdef DDTEST
+ ErrorF("\nDeleteStructure %d\n", pStruct->id);
+#endif
+
+ /*
+ * Errors are ignored to try to delete and update as much info as possible;
+ * however, if an error is found, the last error detected is returned.
+ */
+
+ /*
+ * Save the posted to list before unposting this structure so wks
+ * pictures can be updated if necessary.
+ */
+ /* Do this here before the parent and children lists are changed. */
+
+ /** Build up a list of workstations from the PostedTo and AppearOn
+ ** lists in the structure structure. They are inserted in such a
+ ** manner so that duplicates between the lists are eliminated.
+ **/
+
+ pwksToLookAt = (listofObj *) NULL;
+
+ if (pheader->wksPostedTo->numObj || pheader->wksAppearOn->numObj) {
+ pwksToLookAt = puCreateList(DD_WKS);
+ if (!pwksToLookAt) err = BadAlloc;
+ else
+ err = puMergeLists( pheader->wksPostedTo, pheader->wksAppearOn,
+ pwksToLookAt);
+ }
+
+ /*
+ * This changes the structures posted to list (because unpost removes
+ * the wks from this list) so always get the first wks from the list.
+ */
+ imax = pheader->wksPostedTo->numObj;
+ for (i = 0; i < imax; i++) {
+ pwks = ((diWKSHandle *) pheader->wksPostedTo->pList)[0];
+ next_err = UnpostStructure(pwks, pStruct);
+ }
+
+ /*
+ * Now, delete all of the references to this struct (i.e. remove this
+ * structure from its parents).
+ */
+ next_err = DeleteStructureRefs(pStruct);
+ if (next_err != Success) err = next_err;
+
+ /* loop through to delete all of the elements */
+ i = MISTR_NUM_EL(pheader);
+ MISTR_DEL_ELS(pStruct, pheader, 1, i);
+
+ /* now redraw picture for all workstations (determined above) */
+ if (pwksToLookAt) {
+ next_err = miDealWithDynamics(DELETE_STR_DYNAMIC, pwksToLookAt);
+ if (next_err != Success) err = next_err;
+ puDeleteList(pwksToLookAt);
+ }
+
+ /*
+ * Don't delete the structure until sc and pick resources aren't using it.
+ */
+ pStruct->id = PEXAlreadyFreed;
+ pheader->freeFlag = MI_TRUE;
+ CHECK_DELETE(pStruct, pheader);
+
+ return (err);
+} /* DeleteStructure */
+
+/*++
+ |
+ | Function Name: InquireStructureInfo
+ |
+ | Function Description:
+ | Handles the PEXGetStructureInfo request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireStructureInfo(fpFormat, pStruct, itemMask, pEditMode, pElOffset, pNumElements, pLength, pHasRefs)
+/* in */
+ ddEnumTypeIndex fpFormat;
+ diStructHandle pStruct; /* structure handle */
+ ddBitmask itemMask;
+/* out */
+ ddUSHORT *pEditMode; /* edit mode */
+ ddULONG *pElOffset; /* current element pointer */
+ ddULONG *pNumElements; /* number of elements in structure */
+ ddULONG *pLength; /* total size of structure */
+ ddUSHORT *pHasRefs; /* is structure referenced by others */
+{
+ SET_STR_HEADER(pStruct, pheader);
+
+#ifdef DDTEST
+ ErrorF("\nInquireStructureInfo of %d\n", pStruct->id);
+#endif
+
+ /* Since all info is easily available and this is a fixed-length
+ * request, ignore itemMask (to the dismay of lint).
+ */
+ *pEditMode = MISTR_EDIT_MODE(pheader);
+ *pElOffset = MISTR_CURR_EL_OFFSET(pheader);
+ *pNumElements = MISTR_NUM_EL(pheader);
+
+ /*
+ * test here: if fpFormat is double precision, then recalculate
+ * length
+ */
+ *pLength = MISTR_LENGTH(pheader);
+ *pHasRefs = MISTR_NUM_PARENTS(pheader) != 0;
+ return (Success);
+} /* InquireStructureInfo */
+
+/*++
+ |
+ | Function Name: InquireElementInfo
+ |
+ | Function Description:
+ | Handles the PEXGetElementInfo request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireElementInfo(pStruct, pRange, pNumElements, pBuffer)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementRange *pRange; /* element range */
+/* out */
+ ddULONG *pNumElements; /* number of items in list */
+ ddBufferPtr pBuffer;/* list of element information */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ ddULONG offset1, offset2, needbytes, i;
+ int peisize;
+ ddPointer pbuf;
+ miGenericElementPtr pel;
+
+#ifdef DDTEST
+ ErrorF("\nInquireElementInfo %d\n", pStruct->id);
+#endif
+
+ peisize = sizeof(pexElementInfo);
+
+ if (pos2offset(pheader, &(pRange->position1), &offset1))
+ return (BadValue); /* bad whence value */
+
+ if (pos2offset(pheader, &(pRange->position2), &offset2))
+ return (BadValue); /* bad whence value */
+
+ if (offset1 > offset2) {
+ i = offset1;
+ offset1 = offset2;
+ offset2 = i;
+ }
+
+ if (offset1 == 0)
+ if (offset2 == 0)
+ return(Success);
+ else
+ offset1 = 1;
+
+
+ /* make sure buffer is large enough */
+ needbytes = (offset2 - offset1 + 1) * peisize;
+ PU_CHECK_BUFFER_SIZE(pBuffer, needbytes);
+
+ pbuf = pBuffer->pBuf;
+
+ MISTR_FIND_EL(pheader, offset1, pel);
+
+ /*
+ * remember that element data is required to have the type & length
+ * first so this is portable
+ */
+ for (i = offset1; i <= offset2; i++, pbuf += peisize) {
+ mibcopy(&MISTR_EL_DATA(pel), pbuf, peisize);
+ pel = MISTR_NEXT_EL(pel);
+ }
+
+ *pNumElements = offset2 - offset1 + 1;
+ pBuffer->dataSize = *pNumElements * peisize;
+
+ return (Success);
+} /* InquireElementInfo */
+
+static ddpex4rtn
+get_structure_net(pStruct, plist)
+ diStructHandle pStruct;
+ listofObj *plist;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ register int i;
+ register diStructHandle *pchild;
+
+ /* put this structure on the list */
+ if (puAddToList((ddPointer) & pStruct, (ddULONG) 1, plist) ==
+ MI_ALLOCERR)
+ return (BadAlloc);
+
+ /* loop through all of the children of this structure */
+ pchild = (diStructHandle *) pheader->children->pList;
+ for (i = 0; i < pheader->children->numObj; i++, pchild++)
+ if (get_structure_net(*pchild, plist) == BadAlloc)
+ return (BadAlloc);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: InquireStructureNetwork
+ |
+ | Function Description:
+ | Handles the PEXGetStructuresInNetwork request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireStructureNetwork(pStruct, which, pNumSids, pBuffer)
+/* in */
+ diStructHandle pStruct; /* structure handle */
+ ddUSHORT which; /* which structures to inquire */
+/* out */
+ ddULONG *pNumSids; /* number of ids in list */
+ ddBufferPtr pBuffer; /* list of structure ids */
+{
+ register int i, j, num;
+ ddResourceId *pbuf;
+ ddStructResource **pstruct, **pparent;
+ listofObj *plist1, *plist2;
+ ddBOOL removing;
+
+#ifdef DDTEST
+ ErrorF("\nInquireStructureNetwork\n");
+#endif
+
+ pBuffer->dataSize = 0;
+ *pNumSids = 0;
+
+ plist1 = puCreateList(DD_STRUCT);
+ if (!plist1) return (BadAlloc);
+
+ plist2 = puCreateList(DD_STRUCT);
+ if (!plist2) {
+ puDeleteList(plist1);
+ return (BadAlloc);
+ }
+
+ if (get_structure_net(pStruct, plist1) != Success) {
+ puDeleteList(plist1);
+ puDeleteList(plist2);
+ return (BadAlloc);
+ }
+ /* now, make the list unique */
+ puMergeLists(plist1, plist2, plist2);
+
+ /* adjust for orphans if requested */
+ if (which == PEXOrphans) {
+
+ /*
+ * Look at the parents of each structure in list 3 if any parent is
+ * not in the list, then that structure is not an orphan (i.e., it
+ * is referenced by a structure not in this net), so remove it from
+ * the list.
+ *
+ * This is a pain though, because we aren't guaranteed that all
+ * parents of a structure precede it in the list; e.g., if plist2
+ * for the network below starting at A is A, B, C, D, then when C
+ * is reached, both of its parents (B & D) are in the list, so it
+ * won't be deleted. But when D is reached, (after C) it will have
+ * parent E not in the list, so D will be deleted. Now C should be
+ * deleted also.
+ *
+ * A E / \ / B D \ / C
+ *
+ * My solution to this is to loop through plist2 multiple times until
+ * it is gone through once without any structs being deleted from it.
+ * If you have a better algorithm for this, then tell me about it.
+ * One solution is to guarantee the list has all parents in it before
+ * their children. I can't think of a way to do this, however.
+ */
+ removing = MI_TRUE;
+ while (removing) {
+ removing = MI_FALSE;
+ pstruct = (ddStructResource **) plist2->pList;
+
+ /*
+ * Note, while going through the list, it may be changed, so be
+ * careful of when pstruct gets incremented and be sure num
+ * reflects the original size of the list, not any changes made
+ * to it.
+ */
+ num = plist2->numObj;
+ for (i = 0; i < num; i++, pstruct++) {
+ pparent = (ddStructResource **)((miStructPtr)(*pstruct)->deviceData)->parents->pList;
+ for ( j = 0;
+ j < ((miStructPtr)(*pstruct)->deviceData)->parents->numObj;
+ j++, pparent++) {
+ if (!puInList((ddPointer) pparent, plist2)) {
+
+ /*
+ * This struct is not an orphan.
+ */
+ puRemoveFromList((ddPointer) pstruct, plist2);
+ removing = MI_TRUE;
+
+ /*
+ * Decrement the pointer so when it gets incremented
+ * in the for loop, it points to where the deleted
+ * struct was,
+ */
+ pstruct--;
+ break;
+ }
+ }
+ }
+ }
+ }
+ /* now, return the structure ids */
+ if (PU_BUF_TOO_SMALL(pBuffer, plist2->numObj * sizeof(ddResourceId))) {
+ if (puBuffRealloc(pBuffer, (ddULONG) plist2->numObj) != Success) {
+ pBuffer->dataSize = 0;
+ puDeleteList(plist1);
+ puDeleteList(plist2);
+ return (BadAlloc);
+ }
+ }
+ *pNumSids = plist2->numObj;
+ pbuf = (ddResourceId *) pBuffer->pBuf;
+ pstruct = (ddStructResource **) plist2->pList;
+ for (i = 0; i < plist2->numObj; i++, pbuf++, pstruct++)
+ *pbuf = (*pstruct)->id;
+
+ pBuffer->dataSize = plist2->numObj * sizeof(ddResourceId);
+
+ puDeleteList(plist1);
+ puDeleteList(plist2);
+ return (Success);
+} /* InquireStructureNetwork */
+
+
+/* bufSave is the size of the buffer header when the buffer is
+ * passed into inq ancestors/descendants. the pBuf pointer
+ * is changed as paths are added to the buffers and bufSave
+ * is used to find where pBuf originally started
+ */
+static int bufSave;
+
+#define MI_ANCESTORS 0
+#define MI_DESCENDANTS 1
+
+/* given a path, which is a list of descendants (in top-down order)
+ * or ancestors (in bottom-down order), see if the depth-length
+ * pathPart part of the list matches any of the lists already
+ * put in the buffer. If it doesn't, then it's unique and this
+ * proc returns MI_TRUE, else it returns MI_FALSE
+ */
+static ddBYTE
+path_unique(pathPart, depth, pNumLists, pBuffer, pPath, which)
+ ddUSHORT pathPart;
+ ddULONG depth;
+ ddULONG *pNumLists;
+ ddBufferPtr pBuffer;
+ listofObj *pPath; /* current path */
+ ddSHORT which;
+{
+ register int i, j;
+ ddPointer pb;
+ ddULONG *ll;
+ ddElementRef *pref, *ppath, *pathstart;
+ ddBYTE match;
+
+ if (!depth || pPath->numObj < depth) depth = pPath->numObj;
+
+ pb = pBuffer->pHead + bufSave;
+ pathstart = (ddElementRef *) pPath->pList;
+ if (which == MI_DESCENDANTS)
+ pathstart += (pathPart == PEXTopPart) ? 0 : pPath->numObj - depth;
+ else
+ pathstart += ((pathPart == PEXTopPart) ? pPath->numObj - 1 : depth - 1);
+
+ for (i = 0; i < *pNumLists; i++) {
+ ll = (ddULONG *) pb;
+ pb += 4;
+ pref = (ddElementRef *) pb;
+ ppath = pathstart;
+ match = MI_TRUE;
+ if (*ll == depth) {
+ if (which==MI_DESCENDANTS) {/* descendants: increment through path */
+ for (j = 0; (j < *ll && match); j++, pref++, ppath++) {
+ if ( (ppath->structure != pref->structure)
+ || (ppath->offset != pref->offset))
+ match = MI_FALSE;
+ }
+ } else {/* ancestors: decrement through path */
+ for (j = 0; (j < *ll && match); j++, pref++, ppath--) {
+ if ( (ppath->structure != pref->structure)
+ || (ppath->offset != pref->offset))
+ match = MI_FALSE;
+ }
+ }
+ }
+ pb += *ll * sizeof(ddElementRef);
+ if (match) return (MI_FALSE);
+ }
+
+ return (MI_TRUE);
+}
+
+static ddpex4rtn
+copy_list_to_buf(pathPart, depth, pNumLists, pBuffer, pPath, which)
+ ddUSHORT pathPart;
+ ddULONG depth;
+ ddULONG *pNumLists;
+ ddBufferPtr pBuffer;
+ listofObj *pPath;
+ ddSHORT which;
+{
+ ddUSHORT listsize;
+ ddULONG *pb;
+ ddElementRef *pref, *pbref;
+
+ if (!depth || (pPath->numObj < depth))
+ depth = pPath->numObj;
+ listsize = depth * sizeof(ddElementRef);
+ PU_CHECK_BUFFER_SIZE(pBuffer, listsize + 4);
+
+ pb = (ddULONG *) pBuffer->pBuf;
+ *pb++ = depth;
+ pref = (ddElementRef *) pPath->pList;
+ if (which == MI_DESCENDANTS) {
+ if (pathPart == PEXTopPart)
+ mibcopy(pref, pb, listsize);
+ else {
+ pbref = (ddElementRef *) pb;
+ pref += pPath->numObj - 1;
+ while (depth--)
+ *pbref++ = *pref--;
+ }
+ } else {
+ if (pathPart == PEXBottomPart)
+ mibcopy(pref, pb, listsize);
+ else {
+ pbref = (ddElementRef *) pb;
+ pref += pPath->numObj - 1;
+ while (depth--)
+ *pbref++ = *pref--;
+ }
+ }
+ (*pNumLists)++;
+ pBuffer->pBuf += listsize + 4;
+ pBuffer->dataSize += listsize + 4;
+
+ return (Success);
+}
+
+static ddpex4rtn
+get_ancestors(pStruct, pathPart, depth, pNumLists, pBuffer, pPath)
+ diStructHandle pStruct;
+ ddUSHORT pathPart;
+ ddULONG depth;
+ ddULONG *pNumLists;
+ ddBufferPtr pBuffer;
+ listofObj *pPath; /* current path */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ diStructHandle pParent;
+ miStructPtr pparent;
+ register int num;
+ ddElementRef newref;
+ ddULONG offset;
+ ddElementPos position;
+ ddpex4rtn err;
+ listofObj *singleparents;
+
+ /* start out with the current struct */
+ if (!pPath->numObj) {
+ newref.structure = (diStructHandle) pStruct->id;
+ newref.offset = 0;
+ if (puAddToList((ddPointer) & newref, (ddULONG) 1, pPath) != Success)
+ return (BadAlloc);
+ }
+ /* we're at the root or have gone far enough */
+ num = pheader->parents->numObj;
+ if (!num || ((pathPart==PEXBottomPart) && depth && (pPath->numObj==depth))) {
+ if ( (pathPart == PEXTopPart) && depth && (pPath->numObj > depth)
+ && !path_unique( pathPart, depth, pNumLists, pBuffer, pPath,
+ MI_ANCESTORS))
+
+ /*
+ * if path is top first and has to be truncated to depth, don't
+ * add it to the buffer unless it's unique
+ */
+ err = Success;
+ else
+ err = copy_list_to_buf( pathPart, depth, pNumLists, pBuffer, pPath,
+ MI_ANCESTORS);
+
+/*>>> pPath->numObj--; */
+ return (err);
+ }
+
+ /* take duplicates out of the list of parents */
+ singleparents = puCreateList(DD_STRUCT);
+ if (!singleparents) return (BadAlloc);
+
+ if (puMergeLists(pheader->parents, singleparents, singleparents) != Success)
+ return (BadAlloc);
+
+ num = singleparents->numObj;
+ while (num--) {
+ pParent = ((diStructHandle *) singleparents->pList)[num];
+ pparent = (miStructPtr) pParent->deviceData;
+
+ /*
+ * now, look for each execute structure of this structure in the parent
+ */
+ position.whence = PEXBeginning;
+ position.offset = 0;
+
+ while (find_execute_structure(pParent, &position, pStruct, &offset)
+ == PEXFound) {
+
+ newref.structure = (diStructHandle) pParent->id;
+ newref.offset = offset;
+ if (puAddToList((ddPointer) & newref, (ddULONG) 1, pPath) != Success)
+ return (BadAlloc);
+
+ /*
+ * get the ancestors of this parent struct
+ */
+ if (err = get_ancestors( pParent, pathPart, depth, pNumLists,
+ pBuffer, pPath) != Success)
+ return (err);
+
+ /*
+ * go on to get the next exec struct element in the parent
+ */
+ position.whence = PEXBeginning;
+ position.offset = offset + 1;
+
+ /*
+ * Remove previous parent/ofset from the pathlist so the same
+ * pathlist can be used for the next path.
+ */
+ pPath->numObj--;
+
+ /*
+ * if the last one found was the last element in the
+ * struct, don't continue
+ */
+ if (offset == MISTR_NUM_EL(pparent)) break;
+
+ } /* end while finding execute structure elements in the parent */
+ } /* end while (num--): while this child has parents to look at */
+
+ puDeleteList(singleparents);
+
+ return (Success);
+}
+
+static ddpex4rtn
+get_descendants(pStruct, pathPart, depth, pNumLists, pBuffer, pPath)
+ diStructHandle pStruct;
+ ddUSHORT pathPart;
+ ddULONG depth;
+ ddULONG *pNumLists;
+ ddBufferPtr pBuffer;
+ listofObj *pPath; /* current path */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ register int num;
+ ddElementRef newref;
+ diStructHandle newstruct;
+ ddULONG offset;
+ ddElementPos position;
+ ddpex4rtn err;
+ miGenericElementPtr pel;
+
+ /* if we're at the end of the path put the path in the buffer */
+ num = pheader->children->numObj;
+ if (!num || ((pathPart == PEXTopPart) && depth && (pPath->numObj == depth))){
+ /* add this structure to the path */
+
+ /*
+ * don't need to do this if (pathPart == PEXTopPart) && depth
+ * && (pPath->numObj == depth), but it's ok to do it because
+ * it won't get put into the buffer
+ */
+ newref.structure = (diStructHandle) pStruct->id;
+ newref.offset = 0;
+ if (puAddToList((ddPointer) & newref, (ddULONG) 1, pPath) != Success)
+ return (BadAlloc);
+
+ if ( (pathPart == PEXBottomPart) && depth && (pPath->numObj > depth)
+ && !path_unique( pathPart, depth, pNumLists, pBuffer, pPath,
+ MI_DESCENDANTS))
+
+ /*
+ * If path is bottom first and has to be truncated to depth,
+ * don't add it to the buffer unless it's unique.
+ */
+ err = Success;
+ else
+ err = copy_list_to_buf( pathPart, depth, pNumLists, pBuffer, pPath,
+ MI_DESCENDANTS);
+
+ pPath->numObj--;
+ return (err);
+ }
+
+ /* now, look for each execute structure element in the structure */
+ position.whence = PEXBeginning;
+ position.offset = 0;
+ while (find_execute_structure( pStruct, &position, (diStructHandle) NULL,
+ &offset)
+ == PEXFound) {
+ newref.structure = (diStructHandle) pStruct->id;
+ newref.offset = offset;
+ if (puAddToList((ddPointer) & newref, (ddULONG) 1, pPath) != Success)
+ return (BadAlloc);
+
+ /*
+ * get the descendants of this child struct remember,
+ */
+ MISTR_FIND_EL(pheader, offset, pel);
+
+ newstruct = (diStructHandle) MISTR_GET_EXSTR_STR(pel);
+ if (err = get_descendants( newstruct, pathPart, depth, pNumLists,
+ pBuffer, pPath) != Success)
+ return (err);
+
+ /* go on to get the next child */
+ position.whence = PEXBeginning;
+ position.offset = offset + 1;
+
+ /*
+ * remove previous child from the pathlist so the same
+ * pathlist can be used for the next path
+ */
+ pPath->numObj--;
+
+ /*
+ * if the last one found was the last element in the struct,
+ * don't continue
+ */
+ if (offset == MISTR_NUM_EL(pheader)) break;
+ }
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: InquireAncestors
+ |
+ | Function Description:
+ | Handles the PEXGetAncestors request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireAncestors(pStruct, pathPart, depth, pNumLists, pBuffer)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddUSHORT pathPart; /* which paths to return */
+ ddULONG depth; /* how deep to search */
+/* out */
+ ddULONG *pNumLists; /* number of lists returned */
+ ddBufferPtr pBuffer;/* list of lists of element refs */
+{
+ listofObj *pathlist;
+ ddpex4rtn err;
+
+#ifdef DDTEST
+ ErrorF("\nInquireAncestors\n");
+#endif
+
+ bufSave = PU_BUF_HDR_SIZE(pBuffer);
+ pBuffer->dataSize = 0;
+ *pNumLists = 0;
+
+ pathlist = puCreateList(DD_ELEMENT_REF);
+ if (!pathlist) return (BadAlloc);
+
+ err = get_ancestors(pStruct, pathPart, depth, pNumLists, pBuffer, pathlist);
+
+ pBuffer->pBuf = pBuffer->pHead + bufSave;
+ puDeleteList(pathlist);
+ return (err);
+} /* InquireAncestors */
+
+/*++
+ |
+ | Function Name: InquireDescendants
+ |
+ | Function Description:
+ | Handles the PEXGetDescendants request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireDescendants(pStruct, pathPart, depth, pNumLists, pBuffer)
+/* in */
+ diStructHandle pStruct; /* structure handle */
+ ddUSHORT pathPart; /* which paths to return */
+ ddULONG depth; /* how deep to search */
+/* out */
+ ddULONG *pNumLists; /* number of lists returned */
+ ddBufferPtr pBuffer; /* list of lists of element refs */
+{
+ listofObj *pathlist;
+ ddpex4rtn err;
+
+#ifdef DDTEST
+ ErrorF("\nInquireDescendants\n");
+#endif
+
+ bufSave = PU_BUF_HDR_SIZE(pBuffer);
+ pBuffer->dataSize = 0;
+ *pNumLists = 0;
+
+ pathlist = puCreateList(DD_ELEMENT_REF);
+ if (!pathlist) return (BadAlloc);
+
+ err = get_descendants(pStruct, pathPart, depth, pNumLists, pBuffer,pathlist);
+
+ pBuffer->pBuf = pBuffer->pHead + bufSave;
+ puDeleteList(pathlist);
+ return (err);
+} /* InquireDescendants */
+
+
+/*++
+ |
+ | Function Name: InquireElements
+ |
+ | Function Description:
+ | Handles the PEXFetchElements request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireElements(pStruct, pRange, pNumOCs, pBuffer)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementRange *pRange; /* range of elements */
+/* out */
+ ddULONG *pNumOCs;/* number of items in list */
+ ddBufferPtr pBuffer;/* list of element OCs */
+{
+ SET_STR_HEADER(pStruct, pheader);
+ ddULONG offset1, offset2, i;
+ miGenericElementPtr pel;
+ ddpex4rtn err;
+
+#ifdef DDTEST
+ ErrorF("\nInquireElements of %d\n", pStruct->id);
+#endif
+
+ *pNumOCs = 0;
+
+ if (pheader->numElements == 0) return(Success);
+
+ if (pos2offset(pheader, &(pRange->position1), &offset1))
+ return (BadValue); /* bad whence value */
+
+ if (pos2offset(pheader, &(pRange->position2), &offset2))
+ return (BadValue); /* bad whence value */
+
+ if (offset1 > offset2) {
+ i = offset1;
+ offset1 = offset2;
+ offset2 = i;
+ }
+
+ if (offset1 == 0)
+ if (offset2 == 0)
+ return(Success);
+ else
+ offset1 = 1;
+
+ MISTR_FIND_EL(pheader, offset1, pel);
+
+ for (i = offset1; i <= offset2; i++) {
+ /* Propreitary calls (and OCNil) through 0th Table Entry */
+ if (MI_HIGHBIT_ON(MISTR_EL_TYPE(pel)))
+ err = (*InquireCSSElementTable[MI_OC_PROP])
+ (pel, pBuffer, &(pBuffer->pBuf));
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE(pel)))
+ err = (*InquireCSSElementTable[MISTR_EL_TYPE(pel)])
+ (pel, pBuffer, &(pBuffer->pBuf));
+ else
+ err = !Success;
+ }
+
+ if (err != Success) {
+ *pNumOCs = i - offset1;
+ return (err);
+ }
+ pBuffer->dataSize += sizeof(CARD32)
+ *(((ddElementInfo *)(pBuffer->pBuf))->length);
+ pBuffer->pBuf += sizeof(CARD32)
+ * (((ddElementInfo *)(pBuffer->pBuf))->length);
+
+ pel = MISTR_NEXT_EL(pel);
+ }
+
+ *pNumOCs = offset2 - offset1 + 1;
+ return (Success);
+
+} /* InquireElements */
+
+/*++
+ |
+ | Function Name: SetEditMode
+ |
+ | Function Description:
+ | Handles the PEXSetEditingMode request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetEditMode(pStruct, editMode)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddUSHORT editMode; /* edit mode */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pheader);
+
+#ifdef DDTEST
+ ErrorF("\nSetEditMode of %d\n", pStruct->id);
+#endif
+
+ switch (editMode) {
+ case PEXStructureInsert:
+ case PEXStructureReplace:
+ MISTR_EDIT_MODE(pheader) = editMode;
+ return (Success);
+
+ default:
+ return (BadValue);
+ }
+} /* SetEditMode */
+
+/*++
+ |
+ | Function Name: SetElementPointer
+ |
+ | Function Description:
+ | Handles the PEXSetElementPointer request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetElementPointer(pStruct, pPosition)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementPos *pPosition; /* position to set pointer at */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pstruct);
+ register miGenericElementPtr pel;
+ ddULONG newoffset;
+
+
+#ifdef DDTEST
+ ErrorF("\nSetElementPointer of %d\n", pStruct->id);
+#endif
+
+ if (pos2offset(pstruct, pPosition, &newoffset)) {
+ /* bad whence value */
+ return (BadValue);
+ }
+ if (newoffset == MISTR_CURR_EL_OFFSET(pstruct))
+ return (Success);
+
+ /* special case */
+ if (newoffset == 0) {
+ MISTR_CURR_EL_OFFSET(pstruct) = 0;
+ MISTR_CURR_EL_PTR(pstruct) = MISTR_ZERO_EL(pstruct);
+ return (Success);
+ }
+ MISTR_FIND_EL(pstruct, newoffset, pel);
+
+ MISTR_CURR_EL_OFFSET(pstruct) = newoffset;
+ MISTR_CURR_EL_PTR(pstruct) = pel;
+ return (Success);
+} /* SetElementPointer */
+
+/* look for the next label */
+static ddpex4rtn
+find_label(pStruct, label, startPos, poffset)
+diStructHandle pStruct;
+ddLONG label;
+ddElementPos startPos;
+ddULONG *poffset;
+{
+ ddUSHORT foundLabelElement;
+ SET_STR_HEADER(pStruct, pstruct);
+ ddUSHORT labelElement = PEXOCLabel;
+ miGenericElementPtr pel;
+ ddpex4rtn err = Success;
+
+ do {
+ err = ElementSearch( pStruct, &startPos, (ddULONG) PEXForward,
+ (ddULONG) 1, (ddULONG) 0, &labelElement,
+ (ddUSHORT *) NULL, &foundLabelElement, poffset);
+
+ if (foundLabelElement == PEXFound) {
+ MISTR_FIND_EL(pstruct, *poffset, pel);
+
+ if (label == MISTR_GET_LABEL(pel)) return (PEXFound);
+
+ if (*poffset == MISTR_NUM_EL(pstruct)) return (PEXNotFound);
+
+ /* continue searching after the new current element */
+ startPos.whence = PEXBeginning;
+ startPos.offset = *poffset + 1;
+
+ } else return (PEXNotFound);
+
+ } while (err == Success);
+
+ if (err != Success) return (PEXNotFound);
+ return (PEXFound);
+}
+
+/*++
+ |
+ | Function Name: SetElementPointerAtLabel
+ |
+ | Function Description:
+ | Handles the PEXSetElementPointerAtLabel request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetElementPointerAtLabel(pStruct, label, offset)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddLONG label; /* label id */
+ ddLONG offset; /* offset from label */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pstruct);
+ ddElementPos position;
+ ddULONG offsetFromStart;
+ miGenericElementPtr pel;
+
+#ifdef DDTEST
+ ErrorF("\nSetElementPointerAtLabel\n");
+#endif
+
+ position.whence = PEXCurrent;
+ position.offset = 1;
+
+ if (find_label(pStruct, label, position, &offsetFromStart) == PEXNotFound)
+ return (PEXERR(PEXLabelError));
+
+ offsetFromStart += offset;
+
+ if (offsetFromStart > MISTR_NUM_EL(pstruct))
+ offsetFromStart = MISTR_NUM_EL(pstruct);
+
+ MISTR_FIND_EL(pstruct, offsetFromStart, pel);
+
+ MISTR_CURR_EL_PTR(pstruct) = pel;
+ MISTR_CURR_EL_OFFSET(pstruct) = offsetFromStart;
+
+ return (Success);
+} /* SetElementPointerAtLabel */
+
+static ddBOOL
+InList(val, numInList, list)
+ register ddUSHORT val;
+ ddULONG numInList;
+ register ddUSHORT list[];
+{
+ /** Just do a linear search **/
+ register int i;
+ for (i = 0; i < numInList; i++) {
+ if ((val == list[i]) || PEXOCAll == list[i])
+ return (MI_TRUE);
+ }
+ return (MI_FALSE);
+}
+
+
+/*++
+ |
+ | Function Name: ElementSearch
+ |
+ | Function Description:
+ | Handles the PEXElementSearch request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+ElementSearch(pStruct, pPosition, direction, numIncl, numExcl,
+ pIncls, pExcls, pStatus, pOffset)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementPos *pPosition; /* search start position */
+ ddULONG direction; /* search direction (forward/backward) */
+ ddULONG numIncl;/* number of types in incl list */
+ ddULONG numExcl;/* number of types in excl list */
+ ddUSHORT *pIncls; /* list of included element types */
+ ddUSHORT *pExcls; /* list of excluded element types */
+/* out */
+ ddUSHORT *pStatus;/* (found/notfound) */
+ ddULONG *pOffset;/* offset from the start position */
+{
+
+ SET_STR_HEADER(pStruct, str);
+ ddULONG positionOffset;
+ miGenericElementPtr pel;
+
+#ifdef DDTEST
+ ErrorF("\nElementSearch of %d\n", pStruct->id);
+#endif
+
+ /** An element is considered "being searched for" if it is in the
+ ** include list and not in the exclude list. Elements in both
+ ** are excluded. An OCAll element specifies that all elements
+ ** match
+ **/
+
+ if (pos2offset(str, pPosition, &positionOffset)) return (BadValue);
+
+ *pStatus = PEXNotFound;
+ *pOffset = 0;
+
+ MISTR_FIND_EL(str, positionOffset, pel);
+
+ /*
+ * search is either forwards or backwards, check for end of search
+ * for both
+ */
+ while ((positionOffset >= 0) && (positionOffset <= MISTR_NUM_EL(str))) {
+ ddUSHORT elType;
+
+ elType = MISTR_EL_TYPE(pel);
+
+ /** If current element is in include list and not in exclude
+ ** list, then succeed PEXOCAll matches all elements, even PEXOCNil */
+ if ( InList(elType, numIncl, pIncls)
+ && !InList(elType, numExcl, pExcls)) {
+ *pStatus = PEXFound;
+ *pOffset = positionOffset;
+ return (Success);
+ } else {
+ if (direction == PEXForward) {
+ positionOffset++;
+ pel = MISTR_NEXT_EL(pel);
+ } else {
+ positionOffset--;
+ pel = MISTR_PREV_EL(pel);
+ }
+ }
+ }
+
+ return (Success);
+} /* ElementSearch */
+
+/*++
+ |
+ | Function Name: StoreElements
+ |
+ | Function Description:
+ | Handles the PEXStoreElements request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+StoreElements(pStruct, numOCs, pOCs, ppErr)
+/* in */
+ diStructHandle pStruct; /* structure handle */
+ register ddULONG numOCs; /* number of output commands */
+ ddElementInfo *pOCs; /* list of output commands */
+/* out */
+ pexOutputCommandError **ppErr;
+{
+ SET_STR_HEADER(pStruct, pstruct);
+ register ddElementInfo *poc;
+ register miGenericElementPtr pprevel, /* insert new one after this */
+ preplel; /* or replace this one: preplel =
+ * pprevel->next */
+ miGenericElementPtr pnewel; /* new el to insert */
+ int count;
+ ddpex4rtn err = Success;
+
+#ifdef DDTEST
+ ErrorF("\nStoreElements in %d\n", pStruct->id);
+#endif
+
+ switch (MISTR_EDIT_MODE(pstruct)) {
+ case PEXStructureReplace:
+ for ( poc = pOCs, count = 0,
+ preplel = MISTR_CURR_EL_PTR(pstruct),
+ pprevel = MISTR_PREV_EL(preplel);
+ numOCs > 0;
+ numOCs--,
+ pprevel = MISTR_NEXT_EL(pprevel),
+ preplel = MISTR_NEXT_EL(pprevel), poc += poc->length) {
+
+ /*
+ * replace iff
+ * we're not at the end
+ * * and the types match
+ * * and we're not at the beginning
+ * * * and elements are the same size
+ */
+
+ if ((preplel != MISTR_LAST_EL(pstruct))
+ && (poc->elementType == MISTR_EL_TYPE(preplel))
+ && (preplel != MISTR_ZERO_EL(pstruct))
+ && (MISTR_EL_LENGTH(preplel) == poc->length)) {
+
+ /*
+ * * Replace calls Parse functions
+ */
+
+ /* Propreitary OC (and OCNil) through 0th Table Entry */
+ if (MI_HIGHBIT_ON(poc->elementType))
+ err = (*ReplaceCSSElementTable[MI_OC_PROP])
+ (pStruct, preplel, poc );
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(poc->elementType))
+ err = (*ReplaceCSSElementTable[poc->elementType])
+ (pStruct, preplel, poc);
+ else {
+ /* Bad Element Type Exit Now */
+ err = !Success;
+ break;
+ }
+ }
+ } else
+ /* Bad Replace */
+ err = !Success;
+
+ if (err != Success) { /* create new el */
+ /* Propreitary OC (and OCNil) through 0th Table Entry */
+ if (MI_HIGHBIT_ON(poc->elementType))
+ err = (*CreateCSSElementTable[MI_OC_PROP])
+ (pStruct, poc, &pnewel);
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(poc->elementType))
+ err = (*CreateCSSElementTable[poc->elementType])
+ (pStruct, poc, &pnewel);
+ else
+ /* Bad Element Type */
+ err = !Success;
+ }
+
+ if (err != Success) break;
+
+ count++;
+ if ( (preplel != MISTR_LAST_EL(pstruct))
+ && (preplel != MISTR_ZERO_EL(pstruct))) {
+ /* get rid of old el */
+ MISTR_DEL_ONE_EL(pStruct, pprevel, preplel);
+ }
+ if (preplel == MISTR_ZERO_EL(pstruct))
+ pprevel = preplel;
+
+ MISTR_INSERT_ONE_EL(pprevel, pnewel);
+ }
+ }
+
+ if (err != Success) break;
+ MISTR_CURR_EL_PTR(pstruct) = pprevel;
+ MISTR_FIND_OFFSET(pstruct, pprevel, MISTR_CURR_EL_OFFSET(pstruct));
+
+ break;
+
+
+ case PEXStructureInsert:
+ for ( count = 0, poc = pOCs, pprevel = MISTR_CURR_EL_PTR(pstruct);
+ numOCs > 0;
+ numOCs--, pprevel = pnewel, poc += poc->length) {
+
+ /* Propreitary OC (and OCNil) through 0th Table Entry */
+ if (MI_HIGHBIT_ON(poc->elementType))
+ err = (*CreateCSSElementTable[MI_OC_PROP])
+ (pStruct, poc, &pnewel);
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(poc->elementType))
+ err = (*CreateCSSElementTable[poc->elementType])
+ (pStruct, poc, &pnewel);
+ else
+ /* Bad Element Type */
+ err = !Success;
+ }
+
+ if (err != Success) break;
+
+ count++;
+ MISTR_INSERT_ONE_EL(pprevel, pnewel);
+ }
+
+ if (err != Success) break;
+ if (count) {
+ MISTR_CURR_EL_PTR(pstruct) = pprevel;
+ MISTR_FIND_OFFSET( pstruct, pprevel,
+ MISTR_CURR_EL_OFFSET(pstruct));
+ }
+ break;
+
+ default:
+ /* better not get here */
+ ErrorF("tsk, tsk, the edit mode was set wrong\n");
+ return (BadImplementation);
+ break;
+ }
+
+ if (err != Success) {
+ *ppErr = (pexOutputCommandError *)xalloc(sizeof(pexOutputCommandError));
+ (*ppErr)->type = 0;
+ (*ppErr)->errorCode = PEX_ERROR_CODE(PEXOutputCommandError);
+ (*ppErr)->resourceId = pStruct->id;
+ (*ppErr)->opcode = poc->elementType;
+ (*ppErr)->numCommands = count;
+ return (err);
+ }
+
+
+ miDealWithStructDynamics(STR_MODIFY_DYNAMIC, pStruct);
+
+ return (Success);
+} /* StoreElements */
+
+/*++
+ |
+ | Function Name: DeleteElements
+ |
+ | Function Description:
+ | Handles the PEXDeleteElements request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+DeleteElements(pStruct, pRange)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementRange *pRange; /* range of elements to delete */
+/* out */
+{
+ ddULONG low, high, temp;
+ SET_STR_HEADER(pStruct, pstruct);
+ ddElementPos newElementPointer;
+ ddpex4rtn err;
+
+#ifdef DDTEST
+ ErrorF("\nDeleteElements in %d\n", pStruct->id);
+#endif
+
+ if (pos2offset(pstruct, &(pRange->position1), &low))
+ return (BadValue); /* bad whence value */
+ if (pos2offset(pstruct, &(pRange->position2), &high))
+ return (BadValue); /* bad whence value */
+
+ /** first pos needn't be lower then second pos, so order them now **/
+ if (low > high) {
+ temp = low;
+ low = high;
+ high = temp;
+ }
+ /** deleting element 0 equivalent to a NO-OP **/
+ if (low == 0) {
+ if (high == 0)
+ return (Success);
+ else
+ low = 1;
+ }
+ MISTR_DEL_ELS(pStruct, pstruct, low, high);
+
+ /*
+ * the current element pointer may now be invalid, so set it back to
+ * the beginning so it can be set correctly
+ */
+ MISTR_CURR_EL_PTR(pstruct) = MISTR_ZERO_EL(pstruct);
+ MISTR_CURR_EL_OFFSET(pstruct) = 0;
+
+ /** Now, according to PEX spec, set element pointer to element
+ ** preceding the range of deletion **/
+ newElementPointer.whence = PEXBeginning;
+ newElementPointer.offset = low - 1;
+ err = SetElementPointer(pStruct, &newElementPointer);
+
+ err = miDealWithStructDynamics(STR_MODIFY_DYNAMIC, pStruct);
+
+ return (err);
+} /* DeleteElements */
+
+/*++
+ |
+ | Function Name: DeleteToLabel
+ |
+ | Function Description:
+ | Handles the PEXDeleteElementsToLabel request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+DeleteToLabel(pStruct, pPosition, label)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddElementPos *pPosition; /* starting position */
+ ddLONG label; /* label id to delete to */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pstruct);
+ ddElementPos position;
+ ddElementRange range;
+ ddULONG labelOffset;
+ ddULONG start;
+
+#ifdef DDTEST
+ ErrorF("\nDeleteToLabel\n");
+#endif
+
+ if (pos2offset(pstruct, pPosition, &start))
+ return (BadValue); /* bad whence value */
+
+ position.whence = PEXBeginning;
+ position.offset = start + 1;
+
+ if (find_label(pStruct, label, position, &labelOffset) == PEXNotFound)
+ return (PEXERR(PEXLabelError));
+
+ /*
+ * Now call DeleteElements to delete the elements, but first adjust
+ * the range since DeleteElements does an inclusive delete and
+ * DeleteToLabel doesn't.
+ */
+ if ((start == labelOffset) || ((start + 1) == labelOffset)) {
+ /* there are no elements between them */
+ /* set the element pointer to point to the offset */
+ return(SetElementPointer(pStruct, pPosition));
+ }
+
+ range.position1.whence = PEXBeginning;
+ range.position1.offset = start + 1;
+ range.position2.whence = PEXBeginning;
+ range.position2.offset = labelOffset - 1;
+
+ /* DeleteElements also updates picture if nec. */
+ return (DeleteElements(pStruct, &range));
+
+} /* DeleteToLabel */
+
+/*++
+ |
+ | Function Name: DeleteBetweenLabels
+ |
+ | Function Description:
+ | Handles the PEXDeleteElementsBetweenLabels request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+DeleteBetweenLabels(pStruct, label1, label2)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ ddLONG label1; /* first label id */
+ ddLONG label2; /* second label id */
+/* out */
+{
+ ddElementPos position;
+ ddULONG labelOffset;
+
+#ifdef DDTEST
+ ErrorF("\nDeleteBetweenLabels\n");
+#endif
+
+ position.whence = PEXCurrent;
+ position.offset = 1;
+
+ if (find_label(pStruct, label1, position, &labelOffset) == PEXNotFound)
+ return (PEXERR(PEXLabelError));
+
+ position.whence = PEXBeginning;
+ position.offset = labelOffset;
+
+ /* DeleteToLabel also updates picture if nec. */
+ return (DeleteToLabel(pStruct, &position, label2));
+
+} /* DeleteBetweenLabels */
+
+/*++
+ |
+ | Function Name: CopyElements
+ |
+ | Function Description:
+ | Handles the PEXCopyElements request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+CopyElements(pSrcStruct, pSrcRange, pDestStruct, pDestPosition)
+/* in */
+ diStructHandle pSrcStruct; /* source structure handle */
+ ddElementRange *pSrcRange; /* element range to copy */
+ diStructHandle pDestStruct; /* destination structure handle */
+ ddElementPos *pDestPosition; /* destination position to put stuff */
+/* out */
+{
+ SET_STR_HEADER(pSrcStruct, psource);
+ SET_STR_HEADER(pDestStruct, pdest);
+ ddULONG src_low, src_high, dest_offset, i, count;
+ miGenericElementPtr psrcel, pdestel, pdestprev;
+ miGenericElementStr pfirst, plast; /* dummies */
+ ddpex4rtn err4 = Success;
+
+
+#ifdef DDTEST
+ ErrorF("\nCopyElements\n");
+#endif
+ if (pos2offset(psource, &(pSrcRange->position1), &src_low))
+ return (BadValue); /* bad whence value */
+
+ if (pos2offset(psource, &(pSrcRange->position2), &src_high))
+ return (BadValue); /* bad whence value */
+
+ if (pos2offset(pdest, pDestPosition, &dest_offset))
+ return (BadValue); /* bad whence value */
+
+ if (src_low > src_high) {
+ i = src_low;
+ src_low = src_high;
+ src_high = i;
+ }
+ if (src_low == 0) {
+ if (src_high == 0)
+ return (Success);
+ else
+ src_low = 1;
+ }
+ MISTR_FIND_EL(psource, src_low, psrcel);
+
+ /*
+ * copy els to dummy list, then add dummy list to dest NOTE:
+ * CopyCSSElement procedure is passed pDestStruct for the copy even
+ * though the element is not really being inserted into the structure
+ * yet. This should be OK, but beware!!
+ */
+ MISTR_NEXT_EL(&pfirst) = &plast;
+ MISTR_PREV_EL(&plast) = &pfirst;
+ MISTR_PREV_EL(&pfirst) = MISTR_NEXT_EL(&plast) = NULL;
+ pdestprev = &pfirst;
+
+ for (i = src_low, count = 0; i <= src_high; i++) {
+
+ /* Propreitary OC (and OCNil) through 0th Table Entry */
+ if (MI_HIGHBIT_ON(MISTR_EL_TYPE(psrcel)))
+ err4 = (*CopyCSSElementTable[MI_OC_PROP])
+ (psrcel, pDestStruct, &pdestel);
+ else {
+ /* not Proprietary see if valid PEX OC */
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE(psrcel)))
+ err4 = (*CopyCSSElementTable[MISTR_EL_TYPE(psrcel)])
+ (psrcel, pDestStruct, &pdestel);
+ else
+ /* Bad Element Type - Problem if you get here */
+ err4 = !Success;
+ }
+
+ if (err4 != Success)
+ break;
+
+ count++;
+ MISTR_INSERT_ONE_EL(pdestprev, pdestel);
+ pdestprev = pdestel;
+ psrcel = MISTR_NEXT_EL(psrcel);
+ }
+
+ if (count) {
+ MISTR_FIND_EL(pdest, dest_offset, pdestprev);
+
+ MISTR_NEXT_EL(MISTR_PREV_EL(&plast)) = MISTR_NEXT_EL(pdestprev);
+ MISTR_PREV_EL(MISTR_NEXT_EL(pdestprev)) = MISTR_PREV_EL(&plast);
+
+ MISTR_NEXT_EL(pdestprev) = MISTR_NEXT_EL(&pfirst);
+ MISTR_PREV_EL(MISTR_NEXT_EL(&pfirst)) = pdestprev;
+
+ MISTR_CURR_EL_PTR(pdest) = MISTR_PREV_EL(&plast);
+ MISTR_FIND_OFFSET(pdest, MISTR_CURR_EL_PTR(pdest), MISTR_CURR_EL_OFFSET(pdest));
+ }
+ err4 = miDealWithStructDynamics(STR_MODIFY_DYNAMIC, pDestStruct);
+
+ return (err4);
+} /* CopyElements */
+
+/*++
+ |
+ | Function Name: ChangeStructureReferences
+ |
+ | Function Description:
+ | Handles the PEXChangeStructureReferences request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+ChangeStructureReferences(pStruct, pNewStruct)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ diStructHandle pNewStruct; /* new structure resource */
+/* out */
+{
+
+ SET_STR_HEADER(pStruct, pstruct);
+ SET_STR_HEADER(pNewStruct, pnewstruct);
+ diStructHandle parentHandle;
+ miStructPtr pparentStruct;
+ int loopcount;
+ ddElementPos position;
+ ddpex4rtn foundExecuteElement, err;
+ ddULONG offsetFromStart;
+ diWKSHandle pWks;
+ miGenericElementPtr pel;
+ pexExecuteStructure execStrOC;
+ ddFLOAT prity;
+
+#ifdef DDTEST
+ ErrorF("\nChangeStructureReferences\n");
+#endif /* DDTEST */
+
+ /* set up OC with new structure that will replace old */
+ execStrOC.head.elementType = PEXOCExecuteStructure;
+ execStrOC.head.length = 2;
+ execStrOC.id = (pexStructure) pNewStruct;
+
+ /*
+ * Update all references to this structure by walking through the
+ * structure's parent list. Note that if the structure is referenced
+ * more than once by a parent structure, there will be more than one
+ * occurence of the parent in the parent list.
+ */
+
+ for (loopcount = pstruct->parents->numObj; loopcount > 0; loopcount--) {
+
+ /* The parent list changes in loop, so always get first parent */
+ parentHandle = *(diStructHandle *) pstruct->parents->pList;
+ pparentStruct = (miStructPtr) (parentHandle)->deviceData;
+
+ /* start looking at the beginning of the parent structure */
+ position.whence = PEXBeginning;
+ position.offset = 0;
+ offsetFromStart = 0;
+
+ foundExecuteElement = find_execute_structure (parentHandle, &position,
+ pStruct, &offsetFromStart);
+
+ if (foundExecuteElement == PEXFound) {
+ MISTR_FIND_EL(pparentStruct, offsetFromStart, pel);
+ err = (*ReplaceCSSElementTable[PEXOCExecuteStructure])
+ (parentHandle, pel, &execStrOC);
+ if (err != Success) return (err);
+ } else
+ return (!Success);
+ }
+
+ /*
+ * this changes the old structures posted to list (because unpost removes
+ * the wks from this list) so always get the first wks from the list and
+ * be sure to check the original number of posted wks
+ */
+ for (loopcount = pstruct->wksPostedTo->numObj; loopcount > 0; loopcount--) {
+ pWks = ((diWKSHandle *) pstruct->wksPostedTo->pList)[0];
+ if (puInList((ddPointer) pWks, pnewstruct->wksPostedTo))
+ err = UnpostStructure(pWks, pStruct);
+ else {
+ miGetStructurePriority(pWks, pStruct, &prity);
+ err = PostStructure(pWks, pNewStruct, prity);
+ }
+ if (err) return (err);
+ }
+
+ err = miDealWithStructDynamics(REF_MODIFY_DYNAMIC, pNewStruct);
+
+ return (Success);
+} /* ChangeStructureReferences */
+
+int
+miAddWksToAppearLists(pStruct, pWKS)
+ diStructHandle pStruct;
+ diWKSHandle pWKS;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ register ddULONG i, num;
+ diStructHandle *ps;
+
+ /* loop through the structures list of children */
+ num = pheader->children->numObj;
+ ps = (diStructHandle *) pheader->children->pList;
+ for (i = 0; i < num; i++, ps++) {
+ if (puAddToList( (ddPointer) & pWKS, (ddULONG) 1,
+ ((miStructPtr) (*ps)->deviceData)->wksAppearOn)
+ == MI_ALLOCERR)
+ return (MI_ALLOCERR);
+
+ /* recur to do the children of this child */
+ if (miAddWksToAppearLists(*ps, pWKS) != MI_SUCCESS)
+ return (MI_ALLOCERR);
+ }
+ return (MI_SUCCESS);
+}
+
+void
+miRemoveWksFromAppearLists(pStruct, pWKS)
+ diStructHandle pStruct;
+ diWKSHandle pWKS;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ register ddULONG i, num;
+ diStructHandle *ps;
+
+#ifdef DDTEST
+ ErrorF("\tmiRemoveWksFromAppearLists (of structure %d)\n", pStruct->id);
+#endif
+
+ num = pheader->children->numObj;
+ ps = (diStructHandle *) pheader->children->pList;
+
+ /* look at all children of this structure */
+ for (i = 0; i < num; i++, ps++) {
+ /* remove the wks from the child's list */
+ puRemoveFromList( (ddPointer) & pWKS,
+ ((miStructPtr) (*ps)->deviceData)->wksAppearOn);
+
+ /* recur to do the children of this child */
+ miRemoveWksFromAppearLists(*ps, pWKS);
+ }
+ return;
+}
+
+/*++
+ |
+ | Function Name: UpdateStructRefs
+ |
+ | Function Description:
+ | A utility function to change the cross-reference lists in the structure.
+ | Each structure has a list of every workstation and structure which uses
+ | it.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+UpdateStructRefs(pStruct, pResource, which, action)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+ diResourceHandle pResource; /* wks, struct, sc handle */
+ ddResourceType which; /* wks, struct, pick, sc */
+ ddAction action; /* add or remove */
+/* out */
+{
+ SET_STR_HEADER(pStruct, pheader);
+
+#ifdef DDTEST
+ ErrorF("\nUpdateStructRefs\n");
+#endif
+
+ switch (which) {
+ case WORKSTATION_RESOURCE:
+
+ /*
+ * for each workstation, do it to the specified structures
+ * wksPostedTo list and do it to the wksAppearOn list of all
+ * of the structures children
+ */
+ if (action == ADD) {
+ if (puAddToList( (ddPointer) & pResource, (ddULONG) 1,
+ pheader->wksPostedTo) == MI_ALLOCERR)
+ return (BadAlloc); /* couldn't add to list */
+ if (miAddWksToAppearLists(pStruct, (diWKSHandle) pResource))
+ return (BadAlloc); /* couldn't add to list */
+ } else {
+ puRemoveFromList((ddPointer) & pResource, pheader->wksPostedTo);
+ miRemoveWksFromAppearLists(pStruct, (diWKSHandle) pResource);
+ }
+
+ break;
+
+ case PARENT_STRUCTURE_RESOURCE:
+ if (action == ADD) {
+ if (puAddToList( (ddPointer) & pResource, (ddULONG) 1,
+ pheader->parents) == MI_ALLOCERR)
+ return (BadAlloc); /* couldn't add to list */
+ } else
+ puRemoveFromList((ddPointer) & pResource, pheader->parents);
+
+ break;
+
+ case CHILD_STRUCTURE_RESOURCE:
+ if (action == ADD) {
+ if (puAddToList( (ddPointer) & pResource, (ddULONG) 1,
+ pheader->children) == MI_ALLOCERR)
+ return (BadAlloc); /* couldn't add to list */
+ } else
+ puRemoveFromList((ddPointer) & pResource, pheader->children);
+
+ break;
+
+ case SEARCH_CONTEXT_RESOURCE:
+ case PICK_RESOURCE: /* for both pick device & pick measure */
+ if (action == ADD)
+ pheader->refCount++;
+ else {
+ pheader->refCount--;
+ CHECK_DELETE(pStruct, pheader);
+ }
+ break;
+
+ default: /* better not get here */
+ break;
+ }
+ return (Success);
+}
+
+/* get_wks_postings for InquireWksPostings
+ * implement it here since it uses structure stuff
+ */
+ddpex4rtn
+get_wks_postings(pStruct, pBuffer)
+ diStructHandle pStruct;
+ ddBufferPtr pBuffer;
+{
+ SET_STR_HEADER(pStruct, pheader);
+ listofObj *wkslist;
+ diWKSHandle *pwks;
+ ddResourceId *pbuf;
+ register int i;
+
+ pBuffer->dataSize = 0;
+
+ wkslist = pheader->wksPostedTo;
+
+ if (PU_BUF_TOO_SMALL(pBuffer,(ddULONG)wkslist->numObj *sizeof(ddResourceId)))
+ if (puBuffRealloc( pBuffer,
+ (ddULONG)(wkslist->numObj * sizeof(ddResourceId)))
+ != Success) {
+ puDeleteList(wkslist);
+ return (BadAlloc);
+ }
+ pwks = (diWKSHandle *) wkslist->pList;
+ pbuf = (ddResourceId *) pBuffer->pBuf;
+ for (i = 0; i < wkslist->numObj; i++, pwks++, pbuf++) *pbuf = (*pwks)->id;
+ pBuffer->dataSize = wkslist->numObj * sizeof(ddResourceId);
+
+ return (Success);
+}
+
+/* make a generic puPrintList and put it in dipex/util/pexUtils.c sometime */
+void
+miPrintPath(pPath)
+ listofObj *pPath;
+{
+ register int i;
+ register ddElementRef *pref;
+
+ ErrorF("\nELEMENT REF PATH\n");
+ pref = (ddElementRef *) pPath->pList;
+ for (i = 0; i < pPath->numObj; i++, pref++)
+ ErrorF("\tstructure id: %d\toffset: %d\n",
+ pref->structure, pref->offset);
+ ErrorF("\nEND PATH\n");
+}
+
+/*++
+ |
+ | Function Name: miPrintStructure
+ |
+ | Function Description:
+ | Prints out the contents of a structure for debugging
+ | purposes.
+ |
+ | Input Description:
+ | miStructPtr pStruct;
+ | int strLevel - amount of struct info to display
+ | Output Description:
+ | Switch strLevel :
+ | case 0 :
+ | don't do anything.
+ | case 1 :
+ | print structure header and nothing more
+ | case 2 :
+ | print structure header and affil. structs and wks
+ |
+ --*/
+
+static void printWorkstations(), printStructures();
+
+void
+miPrintStructure(S, strLevel)
+ diStructHandle S;
+ int strLevel;
+{
+ miStructPtr s = (miStructPtr) S->deviceData;
+
+ if (strLevel > 0) {
+
+ ErrorF("\n\n\n**********************************\n");
+ ErrorF("* Printing Structure at 0x%x *\n", s);
+ ErrorF("**********************************\n");
+ ErrorF("ID = %ld\n", S->id);
+ ErrorF("Edit Mode = %s\n", (s->editMode == PEXStructureReplace) ?
+ "REPLACE" : "INSERT");
+ ErrorF("Num Elements = %ld\nTotal Size in 4 byte units = %ld\n",
+ s->numElements, s->totalSize);
+ ErrorF("Curr Offset = %ld\nCurr Elt Ptr = 0x%x\n",
+ s->currElementOffset, s->pCurrElement);
+ ErrorF("Zero El Ptr = 0x%x\nLast El Ptr = 0x%x\n",
+ s->pZeroElement, s->pLastElement);
+
+ if (strLevel == 2) {
+ ErrorF("\nParent Structures :\n");
+ printStructures(s->parents);
+ ErrorF("\nChild Structures :\n");
+ printStructures(s->children);
+ ErrorF("\nWKS posted to:\n");
+ printWorkstations(s->wksPostedTo);
+ ErrorF("\nWKS appearing on:\n");
+ printWorkstations(s->wksAppearOn);
+ }
+ }
+}
+
+static void
+printStructures(list)
+ listofObj *list;
+{
+ int i;
+ diStructHandle *str;
+
+ str = (diStructHandle *) list->pList;
+ for (i = 0; i < list->numObj; i++, str++) {
+ ErrorF("\tStruct Address: 0x%x\t\tId: %ld\n",
+ (*str)->deviceData, (*str)->id);
+ }
+}
+
+static void
+printWorkstations(list)
+ listofObj *list;
+{
+ int i;
+ diWKSHandle *wks;
+
+ wks = (diWKSHandle *) list->pList;
+ for (i = 0; i < list->numObj; i++, wks++) {
+ ErrorF("\tWks Address: 0x%x\t\tId: %ld\n",
+ (*wks)->deviceData, (*wks)->id);
+ }
+}
+
+
+/*++
+ |
+ | Function Name: ValidateStructurePath
+ |
+ | Function Description:
+ Follows the given search or pick path to see if it's valid
+ |
+ --*/
+
+ddpex4rtn
+ValidateStructurePath(pPath)
+ listofObj *pPath;
+{
+ miGenericElementPtr p_element;
+ diStructHandle pStruct, pNextStruct;
+ miStructPtr pstruct;
+ ddULONG offset;
+ int i, j;
+
+ if (pPath->type == DD_ELEMENT_REF) {
+ ddElementRef *pSCPath;
+
+ pSCPath = (ddElementRef *) pPath->pList;
+ pNextStruct = pSCPath->structure;
+
+ for (i = pPath->numObj; i > 0; i--, pSCPath++) {
+ pStruct = pSCPath->structure;
+ if (pNextStruct != pStruct) return (PEXERR(PEXPathError));
+
+ pstruct = (miStructPtr) pStruct->deviceData;
+
+ offset = pSCPath->offset;
+ if (offset > MISTR_NUM_EL(pstruct)) return (PEXERR(PEXPathError));
+
+ /* dont' check what the last element is */
+ if (i == 1) break;
+
+ MISTR_FIND_EL(pstruct, offset, p_element);
+ if (MISTR_EL_TYPE(p_element) != PEXOCExecuteStructure)
+ return (PEXERR(PEXPathError));
+
+ pNextStruct = (diStructHandle) MISTR_GET_EXSTR_STR(p_element);
+ }
+ } else {
+ ddPickPath *pPickPath;
+ ddULONG pickId;
+
+ /*
+ * pick has to step through each element to check pick id also
+ */
+ pPickPath = (ddPickPath *) pPath->pList;
+ pNextStruct = pPickPath->structure;
+ pickId = 0;
+
+ for (i = pPath->numObj; i > 0; i--, pPickPath++) {
+
+ pStruct = pPickPath->structure;
+ if (pNextStruct != pStruct) return (PEXERR(PEXPathError));
+
+ pstruct = (miStructPtr) pStruct->deviceData;
+
+ offset = pPickPath->offset;
+ if (offset > MISTR_NUM_EL(pstruct)) return (PEXERR(PEXPathError));
+
+ /*
+ * start at the first element and look at each
+ * element until the offset is reached
+ */
+ MISTR_FIND_EL(pstruct, 1, p_element);
+
+ for (j = 1; j < offset; j++ ) {
+ if (MISTR_EL_TYPE(p_element) == PEXOCPickId)
+ pickId = MISTR_GET_PICK_ID(p_element);
+ p_element = MISTR_NEXT_EL(p_element);
+ }
+
+ if (pickId != pPickPath->pickid) return (PEXERR(PEXPathError));
+
+ /* dont' check what the last element is */
+ if (i == 1) break;
+
+ if (MISTR_EL_TYPE(p_element) != PEXOCExecuteStructure)
+ return (PEXERR(PEXPathError));
+
+ pNextStruct = (diStructHandle) MISTR_GET_EXSTR_STR(p_element);
+ }
+ }
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miTraverse.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miTraverse.c
new file mode 100644
index 000000000..3c4f41952
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miTraverse.c
@@ -0,0 +1,596 @@
+/* $TOG: miTraverse.c /main/7 1998/02/10 12:43:58 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/miTraverse.c,v 1.8 1999/01/31 12:21:29 dawes Exp $ */
+
+#include "miWks.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "miRender.h"
+#include "miPick.h"
+#include "miStruct.h"
+#include "miStrMacro.h"
+#include "pexos.h"
+
+
+extern void InquirePickStatus();
+extern void InquireSearchStatus();
+
+extern ddpex3rtn BeginStructure();
+extern ddpex3rtn EndStructure();
+extern ocTableType ExecuteOCTable[];
+
+ddpex4rtn traverser();
+
+#ifdef DDTEST
+#define ASSURE(test) \
+ if (!(test)) { \
+ ErrorF( "test \n"); \
+ ErrorF( "Failed: Line %d, File %s\n\n", __LINE__, __FILE__); \
+ }
+#else
+#define ASSURE(test)
+#endif /* DDTEST */
+
+static ddBOOL
+pickES (pRend, p_trav_state, p_str, depth, curr_offset)
+ ddRendererPtr pRend;
+ miTraverserState *p_trav_state;
+ diStructHandle p_str; /* current structure */
+ ddSHORT depth; /* how far down in structures */
+ ddULONG curr_offset;
+{
+
+ if ((p_str->id == p_trav_state->p_curr_pick_el->structure->id) &&
+ (curr_offset == p_trav_state->p_curr_pick_el->offset)) {
+
+ if (depth < pRend->pickStartPath->numObj)
+ /* continue following start path */
+ p_trav_state->p_curr_pick_el++;
+ else
+ /* at end of start path; time to start traversal */
+ p_trav_state->exec_str_flag = ES_YES;
+
+ return(MI_TRUE);
+ }
+ return (MI_FALSE);
+}
+
+static ddBOOL
+searchES(pSC, p_trav_state, p_str, depth, curr_offset)
+ ddSCStr *pSC;
+ miTraverserState *p_trav_state;
+ diStructHandle p_str; /* current structure */
+ ddSHORT depth; /* how far down in structures */
+ ddULONG curr_offset;
+{
+ if ((p_str->id == p_trav_state->p_curr_sc_el->structure->id) &&
+ (curr_offset == p_trav_state->p_curr_sc_el->offset)) {
+ /* OK, this element is in the start path. Now if we're
+ * at the ceiling, don't follow the exec-str
+ */
+ if ((pSC->ceiling == 1) || (depth < pSC->ceiling)) {
+ if (depth < pSC->startPath->numObj)
+ /* continue following start path */
+ p_trav_state->p_curr_sc_el++;
+ else
+ /* at end of start path; time to start traversal */
+ p_trav_state->exec_str_flag = ES_YES;
+ return(MI_TRUE);
+ }
+ }
+ return (MI_FALSE);
+}
+
+int
+miTraverse(pWks )
+ diWKSHandle pWks;
+{
+ register ddOrdStruct *pos;
+ miWksPtr pwks = (miWksPtr) pWks->deviceData;
+ ddpex4rtn err = Success;
+ miTraverserState trav_state;
+ DrawablePtr pRealDrawable;
+
+
+ if ( (pwks->pRend->pDrawable == NULL)
+ || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ if (!pwks->postedStructs.numStructs || !pwks->pCurDrawable) return (Success);
+
+ /* set exec_str_flag */
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = (ddPickPath *) NULL;
+ trav_state.p_curr_sc_el = (ddElementRef *) NULL;
+
+ /* save drawable to be restored later */
+ pRealDrawable = pwks->pRend->pDrawable;
+ pwks->pRend->pDrawable = pwks->pCurDrawable;
+
+ /** call into ddPEX level III Begin Rendering **/
+ BeginRendering(pwks->pRend, pwks->pCurDrawable);
+
+ /* traverse all posted structs */
+ pos = pwks->postedStructs.postruct;
+ while ((pos->next) && (err == Success)) {
+ pos = pos->next;
+ /* reset for each structure */
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+
+
+ if (MISTR_NUM_EL((miStructPtr) pos->pstruct->deviceData)) {
+ BeginStructure(pwks->pRend, pos->pstruct->id);
+
+ /*
+ * always start at the first element in the
+ * structure
+ */
+ err = traverser( pwks->pRend, pos->pstruct, (ddULONG) 1,
+ MISTR_NUM_EL((miStructPtr) pos->pstruct->deviceData),
+ (diPMHandle)NULL, (ddSCStr *) NULL, &trav_state);
+
+ EndStructure(pwks->pRend);
+ pwks->displaySurface = PEXNotEmpty;
+ }
+ }
+
+ EndRendering(pwks->pRend);
+
+ pwks->pRend->pDrawable = pRealDrawable;
+
+ if (err != Success) {
+ /* do stuff here to return error */
+ return(err);
+ }
+
+ return (err);
+} /* miTraverse */
+
+/* this traverses server side structures */
+/* startel must be > 0
+ * stopel must be <= num els in structure
+ */
+/*
+ * begin/end structure keep track of the current path,
+ * but calling the level II OCs directly does not
+ * so do this BEFORE calling the OCs
+ */
+#define INCREMENT_OFFSET(pRend) \
+ if (pRend->curPath->numObj) \
+ ((ddElementRef *)pRend->curPath->pList)[pRend->curPath->numObj-1].offset++
+
+ddpex4rtn
+traverser(pRend, pStruct, startel, stopel, pPM, pSC, p_trav_state)
+ddRendererPtr pRend;
+diStructHandle pStruct;
+ddULONG startel;
+ddULONG stopel;
+diPMHandle pPM;
+ddSCStr *pSC;
+miTraverserState *p_trav_state;
+{
+ register ddULONG currOffset;
+ miPickMeasureStr *ppm;
+ miGenericElementPtr p_element;
+ ddPointer ddElement; /* imp. dep. parsed element */
+ diStructHandle p_next_str; /* execute structure structure */
+ ddSHORT depth; /* how far down in structures */
+ ddULONG pickId, ROCoffset;
+ miStructPtr pstruct = (miStructPtr)(pStruct->deviceData);
+ ddUSHORT pickStatus, searchStatus;
+ ddpex2rtn err;
+ ddPickPath *pl;
+ ddElementRef *sl;
+ int zap;
+ miPPLevel myPickLevel, *pp;
+ int i;
+
+
+ if (pPM)
+ ppm = (miPickMeasureStr *) pPM->deviceData;
+ else
+ ppm = (miPickMeasureStr *) NULL;
+
+ /*
+ * set depth=MaxDepth here when called on way in,
+ * so depth is current depth on way out
+ */
+ p_trav_state->max_depth++;
+ depth = p_trav_state->max_depth;
+ /* same for pick id */
+ pickId = p_trav_state->pickId;
+ MISTR_FIND_EL(pstruct, startel, p_element);
+ currOffset = startel;
+
+ /* when calling traverser from ROC ROCoffset may be non-zero
+ to account for prior ROCs, all other times this should
+ be 0 and we set it to 0 here so recursion doesn't mess
+ up the offsets when processing execute structure
+ */
+ ROCoffset = p_trav_state->ROCoffset;
+ p_trav_state->ROCoffset = 0;
+
+ /* do stuff for following search start path */
+ if (pSC) {
+ /* if following start path, and its at the last element_ref
+ * in the start path, and its after the last element in
+ * the element_ref, then its at the end of the start
+ * path and searching should begin
+ */
+ if ( (p_trav_state->exec_str_flag == ES_FOLLOW_SEARCH) &&
+ (depth == pSC->startPath->numObj) &&
+ (currOffset > p_trav_state->p_curr_sc_el->offset) )
+ p_trav_state->exec_str_flag = ES_YES;
+ }
+
+ /* do stuff for following pick start path */
+ if (pPM) {
+ if ( (p_trav_state->exec_str_flag == ES_FOLLOW_PICK) &&
+ (depth == pRend->pickStartPath->numObj) &&
+ (currOffset > p_trav_state->p_curr_pick_el->offset) )
+ p_trav_state->exec_str_flag = ES_YES;
+ }
+
+ while (currOffset <= stopel) {
+ ddElement = (ddPointer) (&(p_element->element));
+
+ switch (MISTR_EL_TYPE(p_element)) {
+ case PEXOCExecuteStructure: {
+
+ /*
+ * While inside this traverser, don't call level II execute
+ * structure OC. It is used in mixed mode traversals to get
+ * from client-side traversing to server-side traverser
+ */
+ ddBOOL go;
+
+ p_next_str = ((diStructHandle) MISTR_GET_EXSTR_STR(p_element));
+ if (p_trav_state->exec_str_flag == ES_FOLLOW_PICK)
+ go = pickES (pRend, p_trav_state, pStruct, depth, currOffset);
+ else if (p_trav_state->exec_str_flag == ES_FOLLOW_SEARCH)
+ go = searchES(pSC, p_trav_state, pStruct, depth, currOffset);
+ else if (p_trav_state->exec_str_flag == ES_YES)
+ go = MI_TRUE;
+ else
+ go = MI_FALSE;
+
+ if (go) {
+
+ BeginStructure(pRend, p_next_str->id);
+
+ /* build the pick path as we descend the hierarchy */
+ if (pPM) {
+ myPickLevel.up = p_trav_state->p_pick_path;
+ myPickLevel.pp.structure = pStruct;
+ myPickLevel.pp.offset = currOffset + ROCoffset;
+ myPickLevel.pp.pickid = pickId;
+ p_trav_state->p_pick_path = &myPickLevel;
+ }
+
+ err = traverser( pRend, p_next_str, (ddULONG) 1,
+ MISTR_NUM_EL((miStructPtr) p_next_str->deviceData),
+ pPM, pSC, p_trav_state);
+ if (err != Success) return (err);
+ EndStructure(pRend);
+ }
+
+ /*
+ * We built the candidate pick path when it was found. We
+ * do nothing on the way out - except restore pointer.
+ */
+ if (pPM) {
+ p_trav_state->p_pick_path = myPickLevel.up;
+ }
+
+
+ /* do the same for searching, replacing the start
+ * path with the found path
+ */
+ if (pSC && (pSC->status == PEXFound)) {
+
+ sl = (ddElementRef *) pSC->startPath->pList;
+
+ zap = depth -1;
+
+ sl[zap].structure = pStruct;
+ sl[zap].offset = currOffset;
+
+ return (Success);
+ } else
+ /* popping out of Not Found */
+ if (pSC && (p_trav_state->exec_str_flag == ES_POP))
+ return (Success);
+
+ /*
+ * still picking or searching, so keep
+ * adjusting max_depth
+ */
+ if (go)
+ p_trav_state->max_depth--;
+ break;
+ }
+
+ case PEXOCPickId:
+
+ /*
+ * For now, set own pick id and call into level II pick OC.
+ * Could do this in a level 4 pick procedure like execute struct
+ */
+ pickId = p_trav_state->pickId = MISTR_GET_LABEL(p_element);
+
+ INCREMENT_OFFSET(pRend);
+
+ pRend->executeOCs[(int) (p_element->element.elementType)]
+ (pRend, ddElement);
+
+ break;
+
+ /* drawing primitives */
+ case PEXOCMarker:
+ case PEXOCMarker2D:
+ case PEXOCText:
+ case PEXOCText2D:
+ case PEXOCAnnotationText:
+ case PEXOCAnnotationText2D:
+ case PEXOCPolyline:
+ case PEXOCPolyline2D:
+ case PEXOCPolylineSet:
+ case PEXOCNurbCurve:
+ case PEXOCFillArea:
+ case PEXOCFillArea2D:
+ case PEXOCExtFillArea:
+ case PEXOCFillAreaSet:
+ case PEXOCFillAreaSet2D:
+ case PEXOCExtFillAreaSet:
+ case PEXOCTriangleStrip:
+ case PEXOCQuadrilateralMesh:
+ case PEXOCSOFAS:
+ case PEXOCNurbSurface:
+ case PEXOCCellArray:
+ case PEXOCCellArray2D:
+ case PEXOCExtCellArray:
+ case PEXOCGdp:
+ case PEXOCGdp2D:
+ INCREMENT_OFFSET(pRend);
+
+ /* if following pick or search path, don't call prims */
+ if ( (p_trav_state->exec_str_flag == ES_FOLLOW_PICK) ||
+ (p_trav_state->exec_str_flag == ES_FOLLOW_SEARCH) )
+ break;
+
+ if (MI_DDC_DO_PRIMS(pRend)) {
+
+ pRend->executeOCs[(int) (p_element->element.elementType)]
+ (pRend, ddElement);
+ if (pSC) {
+ InquireSearchStatus(pRend, &searchStatus);
+ /* searchStatus is PEXFound or PEXNotFound */
+ pSC->status = searchStatus;
+ if (searchStatus == PEXFound) {
+ sl = (ddElementRef *) pSC->startPath->pList;
+
+ pSC->startPath->numObj = p_trav_state->max_depth;
+
+ if (pSC->startPath->maxObj < p_trav_state->max_depth) {
+ pSC->startPath->pList =
+ (ddPointer) xrealloc(
+ pSC->startPath->pList,
+ p_trav_state->max_depth
+ * sizeof(ddElementRef));
+ pSC->startPath->maxObj = p_trav_state->max_depth;
+ }
+ zap = depth -1;
+
+ sl[zap].structure = pStruct;
+ sl[zap].offset = currOffset;
+
+ p_trav_state->exec_str_flag = ES_POP;
+ return (Success);
+ }
+ }
+ if (pPM) {
+ InquirePickStatus(pRend, &pickStatus, p_trav_state);
+ if (pickStatus == PEXOk) {
+ if (pRend->pickstr.state == DD_PICK_ALL) {
+ myPickLevel.up = p_trav_state->p_pick_path;
+ myPickLevel.pp.structure = pStruct;
+ myPickLevel.pp.offset = currOffset + ROCoffset;
+ myPickLevel.pp.pickid = pickId;
+
+ AddPickPathToList( pRend, depth, &myPickLevel);
+ ppm->status = pickStatus;
+
+ } else {
+
+
+ pl = (ddPickPath *) ppm->path->pList;
+
+ /*
+ * then do stuff to update
+ * pick measure path and stop
+ * traversing
+ */
+ ppm->path->numObj = p_trav_state->max_depth;
+
+ if (ppm->path->maxObj < p_trav_state->max_depth) {
+ ppm->path->pList =
+ (ddPointer) xrealloc(ppm->path->pList,
+ p_trav_state->max_depth
+ * sizeof(ddPickPath));
+ ppm->path->maxObj = p_trav_state->max_depth;
+ }
+
+ /*
+ * oh boy, this is where recursion is fun.
+ * In this current iteration of traverser we know
+ * the last element in the path, so stuff this
+ * element into the bottom/top of the pick path list
+ * depending on whether the top/bottom part was
+ * requested
+ */
+ if (ppm->pathOrder == PEXTopFirst)
+ zap = depth - 1;
+ else
+ zap = p_trav_state->max_depth - depth;
+
+ pl[zap].structure = pStruct;
+ pl[zap].offset = currOffset + ROCoffset;
+ pl[zap].pickid = pickId;
+
+ /*
+ * we want to continue on, so we do not want to
+ * pop off to use the recursion.
+ * follow the linked list down
+ */
+ pp = p_trav_state->p_pick_path;
+ for (i = depth-1; i > 0; i-- ) {
+ if (ppm->pathOrder == PEXTopFirst)
+ zap = i - 1;
+ else
+ zap = p_trav_state->max_depth - i;
+
+ pl[zap] = pp->pp; /* structure assignment */
+ pp = pp->up;
+ }
+ ppm->status = pickStatus;
+
+ }
+ }
+ }
+ }
+ break;
+
+ default: /* all others */
+
+ INCREMENT_OFFSET(pRend);
+
+ /* could maybe skip some if doing pick or search */
+ if (MI_IS_PEX_OC(MISTR_EL_TYPE(p_element)))
+ pRend->executeOCs[(int) (p_element->element.elementType)]
+ (pRend, ddElement);
+
+ break; /* default */
+
+ } /* end switch */
+
+
+ /* do stuff for following search start path */
+ if ( pSC ) {
+ /* now, if its at the ceiling, forget it */
+ if ( (depth == pSC->ceiling) && (pSC->ceiling != 1) &&
+ (currOffset >= stopel) ) {
+ pSC->status = PEXNotFound;
+ p_trav_state->exec_str_flag = ES_POP;
+ return (Success);
+ }
+
+ /* do stuff for following search start path */
+ if (pSC) {
+ /* if following start path, and its at the last element_ref
+ * in the start path, and its after the last element in
+ * the element_ref, then its at the end of the start
+ * path and searching should begin
+ */
+ if ( (p_trav_state->exec_str_flag == ES_FOLLOW_SEARCH) &&
+ (depth == pSC->startPath->numObj) &&
+ (currOffset >= p_trav_state->p_curr_sc_el->offset) )
+ p_trav_state->exec_str_flag = ES_YES;
+ }
+
+ }
+
+ /* do stuff for following search start path */
+ if (pPM) {
+ /* if following start path, and its at the last pick_path
+ * in the start path, and its after the last element in
+ * the pick_path, then its at the end of the start
+ * path and searching should begin
+ */
+ if ( (p_trav_state->exec_str_flag == ES_FOLLOW_PICK) &&
+ (depth == pRend->pickStartPath->numObj) &&
+ (currOffset >= p_trav_state->p_curr_pick_el->offset) )
+ p_trav_state->exec_str_flag = ES_YES;
+ }
+
+ /* go on to the next element */
+ currOffset++;
+ p_element = MISTR_NEXT_EL(p_element);
+ } /* while loop (while there are still elements
+ in the structure) */
+
+ return (Success);
+
+} /* traverser */
+
+
+/* for mixed mode traversals, this supports the execute structure OC */
+void
+execute_structure_OC(pRend, pOC)
+ddRendererPtr pRend;
+pexExecuteStructure *pOC;
+{
+ diStructHandle pstruct = *((diStructHandle *)&(pOC->id));
+ miTraverserState trav_state;
+ ddpex4rtn err = Success;
+ if (MISTR_NUM_EL((miStructPtr) pstruct->deviceData)) {
+
+ BeginStructure(pRend, pstruct->id);
+ trav_state.exec_str_flag = ES_YES;
+ trav_state.p_curr_pick_el = NULL;
+ trav_state.p_curr_sc_el = NULL;
+ trav_state.max_depth = 0;
+ trav_state.pickId = 0;
+ trav_state.ROCoffset = 0;
+
+ err = traverser( pRend, pstruct, (ddULONG)0,
+ MISTR_NUM_EL((miStructPtr)pstruct->deviceData),
+ (diPMHandle)NULL, (ddSCStr *)NULL, &trav_state);
+ EndStructure(pRend);
+
+ }
+ return;
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/miWks.c b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miWks.c
new file mode 100644
index 000000000..d8cb83299
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/miWks.c
@@ -0,0 +1,2415 @@
+/* $TOG: miWks.c /main/17 1998/02/10 12:44:02 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/miWks.c,v 1.7 1998/10/04 09:34:43 dawes Exp $ */
+
+
+#include "miWks.h"
+#include "miInfo.h"
+#include "miLUT.h"
+#include "pexUtils.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexExtract.h"
+#include "Xprotostr.h"
+#include "gcstruct.h"
+#include "resource.h"
+#include "pexos.h"
+
+
+#ifdef MULTIBUFFER
+#define _MULTIBUF_SERVER_
+#include <X11/extensions/multibuf.h>
+#endif
+
+/* Level 4 Workstation Support */
+/* PHIGS Workstation Procedures */
+
+extern ddpex4rtn miDealWithStructDynamics();
+extern ddpex4rtn miDealWithDynamics();
+extern void miMatInverse();
+extern void miTransformPoint();
+extern void path_update_struct_refs();
+extern ddpex3rtn miBldViewport_xform();
+
+ddpex4rtn mi_add_ord_view();
+ddOrdView *mi_find_ord_view();
+
+extern miEnumType miHlhsrModeET[MI_MAXDRAWABLES][SI_HLHSR_NUM];
+extern miEnumType miDisplayUpdateModeET[MI_MAXDRAWABLES][SI_UPDATE_NUM];
+
+static void deletewks();
+
+/* init_pick_flag is initialized in ddpexInit()
+ * there are MIWKS_NUM_PICK_DEVICES pick devices (defined in miWks.h)
+ * pick_devices is the initial state for each of these that
+ * is used to initialize the pick devices in the wks
+ * pick_devices have to be initialized dynamically because
+ * there is a union in them
+ */
+ddBOOL init_pick_flag;
+void initialize_pick_devices();
+miPickDevice pick_devices[MIWKS_NUM_PICK_DEVICES];
+
+static ddNpcSubvolume NPCInit =
+{{0.0, 0.0, 0.0},
+{1.0, 1.0, 1.0}
+};
+
+static ddViewport viewportInit =
+{{0, 0, 0.0},
+{1, 1, 1.0},
+MI_TRUE
+};
+
+/* ugly globals for this module */
+static ddpex4rtn err4;
+static ddpex43rtn err43;
+static ddpex3rtn err3;
+static int err;
+
+#define WKS_WINDOW_MASK 1
+#define WKS_VIEWPORT_MASK 2
+
+/* here are the dynamics that our wks can support */
+
+/* only one so far */
+ddBYTE mi_dynamics[MI_MAXDRAWABLES][MAX_DYNAMIC] = {
+ PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG,
+ PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG, PEXIRG,
+ PEXIRG, PEXIRG, PEXIRG
+};
+
+/* this macro checks to see if a change to the workstation affects
+ * the current display
+ */
+#define WKSIMMEDIATE(pws, attr) \
+ ( (pws->displaySurface == PEXEmpty) || \
+ ((pws)->dynamics[(int)attr] == PEXIMM) )
+
+/* adjust this for the supported dynamics & update modes in your implementation
+ * this should be true if the change to the attribute is visualizable now
+ */
+#define VISUALIZE_NOW( pws, dynamic) \
+ (((pws)->dynamics[(int)(dynamic)] == PEXIMM) || \
+ ((pws)->displayUpdate == PEXVisualizeEach))
+
+SetDoubleDrawable (pwks)
+miWksPtr pwks;
+{
+ /* This routine sets the drawable pointer. It does this with or
+ without the MultiBuffer Extension
+ */
+
+ if (pwks->hasDoubleBuffer)
+ {
+ /* If you have the Double Buffer do whats right for the update mode */
+ switch (pwks->displayUpdate) {
+ case PEXVisualizeEach:
+ case PEXVisualizeWhenever:
+ case PEXVisualizeNone:
+ pwks->pCurDrawable = pwks->doubleDrawables[pwks->curDoubleBuffer];
+ pwks->usingDoubleBuffer = MI_TRUE;
+ break;
+ case PEXSimulateSome:
+ case PEXVisualizeEasy:
+ pwks->pCurDrawable = pwks->pRend->pDrawable;
+ pwks->usingDoubleBuffer = MI_FALSE;
+ break;
+ }
+ }
+ else
+ {
+ /* No Double Buffer so use the renderers drawable */
+ pwks->usingDoubleBuffer = MI_FALSE;
+ pwks->pCurDrawable = pwks->pRend->pDrawable;
+ }
+}
+
+ChangeDoubleBuffers (pwks)
+miWksPtr pwks;
+{
+
+ /* This routine does the actual work to create or delete the
+ Double Buffers. It is a no-op if there is no MultiBuffer
+ Extension, except it still has to SetDoubleBuffers to
+ insure the right drawable gets used
+ */
+
+#ifdef MULTIBUFFER
+
+ if (pwks->curBufferMode == PEXDoubleBuffered && !pwks->hasDoubleBuffer)
+ {
+ /* create the Double Buffers */
+ int i;
+ int client;
+ int result;
+ XID ids[2];
+ extern DrawablePtr GetBufferPointer ();
+
+ client = CLIENT_ID(pwks->pRend->pDrawable->id);
+ for (i = 0; i < 2; i++)
+ ids[i] = FakeClientID (client);
+ result = CreateImageBuffers (pwks->pRend->pDrawable, 2, ids,
+ MultibufferUpdateActionBackground,
+ MultibufferUpdateHintFrequent);
+ if (result != Success)
+ {
+ pwks->pCurDrawable = pwks->pRend->pDrawable;
+ return;
+ }
+ for (i = 0; i < 2; i++)
+ pwks->doubleDrawables[i] = GetBufferPointer (pwks->pRend->pDrawable, i);
+ pwks->curDoubleBuffer = 1;
+ pwks->hasDoubleBuffer = MI_TRUE;
+ }
+ else if (pwks->curBufferMode == PEXSingleBuffered && pwks->hasDoubleBuffer)
+ {
+ /* Destroy the Double Buffers */
+ DestroyImageBuffers (pwks->pRend->pDrawable);
+ pwks->hasDoubleBuffer = MI_FALSE;
+ }
+#endif
+
+ /* With or Without MultiBuffer Call this to set the Drawable Pointer */
+ SetDoubleDrawable (pwks);
+}
+
+SwapDoubleBuffers (pwks)
+miWksPtr pwks;
+{
+ int i;
+
+ /* This one swaps the buffers, a no-op if no MultiBuffer Extension */
+
+#ifdef MULTIBUFFER
+ if (pwks->usingDoubleBuffer)
+ {
+ DisplayImageBuffers (&pwks->pCurDrawable->id, 1);
+ pwks->curDoubleBuffer ^= 1;
+ pwks->pCurDrawable = pwks->doubleDrawables[pwks->curDoubleBuffer];
+ }
+#endif
+}
+
+
+
+/*++
+ |
+ | Function Name: CreatePhigsWks
+ |
+ | Function Description:
+ | Handles the PEXCreatePhigsWKS request.
+ |
+ | Note(s):
+ |
+ --*/
+
+/* set dst = src and if it's not NULL, update the ref list */
+#define MIWKS_SETLUT( SRCLUT, DSTLUT, WKS ) \
+ if ( (DSTLUT) = (SRCLUT) ) { \
+ if(UpdateLUTRefs( (DSTLUT), (diResourceHandle)WKS, \
+ WORKSTATION_RESOURCE, ADD ) ) { \
+ deletewks((miWksPtr)(WKS->deviceData), WKS); \
+ return (BadAlloc); \
+ } }
+
+#define MIWKS_SETNS( SRCNS, DSTNS, WKS ) \
+ if ( (DSTNS) = (SRCNS) ) { \
+ if (UpdateNSRefs( (DSTNS), (diResourceHandle)WKS, \
+ WORKSTATION_RESOURCE, ADD )) { \
+ deletewks((miWksPtr)(WKS->deviceData), WKS); \
+ return (BadAlloc); \
+ } }
+
+ddpex4rtn
+CreatePhigsWks(pInitInfo, pWKS)
+/* in */
+ ddWksInit *pInitInfo; /* workstation info */
+ diWKSHandle pWKS; /* workstation handle */
+/* out */
+{
+ register miWksPtr pwks;
+ register ddRendererPtr prend;
+ ddOrdStruct *pos;
+ diLUTHandle view;
+ register int i;
+ int type;
+
+#ifdef DDTEST
+ ErrorF("\nCreatePhigsWks\n");
+#endif
+ pWKS->deviceData = NULL;
+
+ if (!pInitInfo->pDrawable)
+ return (BadDrawable);
+ MI_WHICHDRAW(pInitInfo->pDrawable, type);
+
+ pwks = (miWksPtr) xalloc(sizeof(miWksStr));
+ if (pwks == NULL)
+ return (BadAlloc);
+ pWKS->deviceData = (ddPointer) pwks;
+
+ pwks->pRend = NULL;
+ pwks->refCount = 0;
+ pwks->freeFlag = 0;
+ pwks->reqViewTable = 0;
+
+ pwks->pwksList = puCreateList(DD_WKS);
+ if (!pwks->pwksList) {
+ xfree(pwks);
+ pWKS->deviceData = NULL;
+ return (BadAlloc);
+ }
+
+ /* see miWks.h for explanation of how view priority list works
+ * there are dummy first and last entries */
+ pwks->views.defined_views = 0;
+ pwks->views.highest = &(pwks->views.entries[0]);
+ pwks->views.lowest = &(pwks->views.entries[1]);
+ pwks->views.entries[0].defined = MI_FALSE;
+ pwks->views.entries[0].first_view = 0;
+ pwks->views.entries[0].last_view = 0;
+ pwks->views.entries[0].higher = NULL;
+ pwks->views.entries[0].lower = &(pwks->views.entries[2]);
+ pwks->views.entries[1].defined = MI_FALSE;
+ pwks->views.entries[1].first_view = 0;
+ pwks->views.entries[1].last_view = 0;
+ pwks->views.entries[1].higher = &(pwks->views.entries[2]);
+ pwks->views.entries[1].lower = NULL;
+ /* set first entry */
+ pwks->views.entries[2].defined = MI_FALSE;
+ pwks->views.entries[2].first_view = 0;
+ pwks->views.entries[2].last_view = 65534;
+ pwks->views.entries[2].higher = &(pwks->views.entries[0]);
+ pwks->views.entries[2].lower = &(pwks->views.entries[1]);
+ /* set free entries */
+ pwks->views.free = &(pwks->views.entries[3]);
+ for (i = 3; i < MIWKS_MAX_ORD_VIEWS - 1; i++) {
+ pwks->views.entries[i].defined = MI_FALSE;
+ pwks->views.entries[i].first_view = 0;
+ pwks->views.entries[i].last_view = 0;
+ pwks->views.entries[i].higher = &(pwks->views.entries[i - 1]);
+ pwks->views.entries[i].lower = &(pwks->views.entries[i + 1]);
+ }
+ /* redefine the higher value for the first free entry */
+ pwks->views.entries[3].higher = NULL;
+ /* now define the last free entry */
+ i = MIWKS_MAX_ORD_VIEWS - 1;
+ pwks->views.entries[i].defined = MI_FALSE;
+ pwks->views.entries[i].first_view = 0;
+ pwks->views.entries[i].last_view = 0;
+ pwks->views.entries[i].higher = &(pwks->views.entries[i - 1]);
+ pwks->views.entries[i].lower = NULL;
+ /* predefined views are set in the priority list later */
+
+ pwks->postedStructs.numStructs = 0;
+ pwks->postedStructs.postruct = NULL;
+
+ prend = (ddRendererPtr) xalloc(sizeof(ddRendererStr));
+ if (prend == NULL) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ pwks->pRend = prend;
+
+ /* initialize the renderer */
+ /* initialize the default pipeline context, if necessary,
+ and set this into the renderer */
+ prend->pPC = NULL;
+
+ /* initialize to 0, just in case we hit an alloc error and
+ call deletewks before finishing creation
+ */
+ for (i = MI_FIRSTTABLETYPE; i <= PEXMaxTableType; i++)
+ prend->lut[i] = 0;
+
+ for (i=0; i< (int) DD_MAX_FILTERS; i++)
+ prend->lut[i] = 0;
+
+ for (i=0; i< MIWKS_NUM_PICK_DEVICES; i++)
+ pwks->devices[i].path = 0;
+
+ /* expect a valid drawable */
+ MI_SETDRAWEXAMPLE(pInitInfo->pDrawable, &(prend->drawExample));
+
+ prend->rendId = pWKS->id;
+ prend->pDrawable = pInitInfo->pDrawable;
+ prend->drawableId = pInitInfo->drawableId;
+ prend->curPath = puCreateList(DD_ELEMENT_REF);
+ prend->clipList = 0;
+ if (!prend->curPath) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ prend->clipList = puCreateList(DD_DEVICE_RECT);
+ if (!prend->clipList) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ prend->state = PEXIdle;
+
+ /* add later: make sure that the drawable is OK for the luts */
+ MIWKS_SETLUT(pInitInfo->pMarkerLUT, prend->lut[PEXMarkerBundleLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pTextLUT, prend->lut[PEXTextBundleLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pLineLUT, prend->lut[PEXLineBundleLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pIntLUT, prend->lut[PEXInteriorBundleLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pEdgeLUT, prend->lut[PEXEdgeBundleLUT], pWKS);
+ /* view table done later */
+ MIWKS_SETLUT(pInitInfo->pColourLUT, prend->lut[PEXColourLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pDepthCueLUT, prend->lut[PEXDepthCueLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pLightLUT, prend->lut[PEXLightLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pColourAppLUT, prend->lut[PEXColourApproxLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pPatternLUT, prend->lut[PEXPatternLUT], pWKS);
+ MIWKS_SETLUT(pInitInfo->pFontLUT, prend->lut[PEXTextFontLUT], pWKS);
+
+ MIWKS_SETNS(pInitInfo->pHighInclSet, prend->ns[(int) DD_HIGH_INCL_NS], pWKS);
+ MIWKS_SETNS(pInitInfo->pHighExclSet, prend->ns[(int) DD_HIGH_EXCL_NS], pWKS);
+ MIWKS_SETNS(pInitInfo->pInvisInclSet, prend->ns[(int) DD_INVIS_INCL_NS], pWKS);
+ MIWKS_SETNS(pInitInfo->pInvisExclSet, prend->ns[(int) DD_INVIS_EXCL_NS], pWKS);
+ /* These are for Renderer Picking, not used for Wks */
+ MIWKS_SETNS(0, prend->ns[(int) DD_PICK_INCL_NS], pWKS);
+ MIWKS_SETNS(0, prend->ns[(int) DD_PICK_EXCL_NS], pWKS);
+
+
+ prend->hlhsrMode = PEXHlhsrOff;
+ prend->npcSubvolume = NPCInit;
+
+ prend->viewport.useDrawable = MI_TRUE;
+ prend->viewport.minval.x = 0.0;
+ prend->viewport.minval.y = 0.0;
+ prend->viewport.minval.z = 0.0;
+ prend->viewport.maxval.x = prend->pDrawable->width;
+ prend->viewport.maxval.y = prend->pDrawable->height;
+ prend->viewport.maxval.z = 1.0;
+ /* don't really use renderer dynamics */
+ prend->tablesMask = 0;
+ prend->namesetsMask = 0;
+ prend->attrsMask = 0;
+ prend->tablesChanges = 0;
+ prend->namesetsChanges = 0;
+ prend->attrsChanges = 0;
+ prend->immediateMode = FALSE;
+
+ prend->pDDContext = NULL;
+
+ /* new flags added for 5.1 need to be initialized */
+ prend->backgroundColour.colourType = PEXIndexedColour;
+ prend->backgroundColour.colour.indexed.index = 0;
+ prend->clearI = FALSE;
+ prend->clearZ = TRUE;
+ prend->echoMode = PEXNoEcho;
+ prend->echoColour.colourType = PEXIndexedColour;
+ prend->echoColour.colour.indexed.index = 0;
+
+
+ pwks->displayUpdate = PEXVisualizeEach;
+ pwks->visualState = PEXCorrect;
+ pwks->displaySurface = PEXEmpty;
+ pwks->viewUpdate = PEXNotPending;
+ pwks->deltaviewMask = 0;
+ pwks->wksUpdate = PEXNotPending;
+ pwks->wksMask = 0;
+
+ pwks->hlhsrUpdate = PEXNotPending;
+
+ pwks->bufferUpdate = PEXNotPending;
+ pwks->curBufferMode = pwks->reqBufferMode = pInitInfo->bufferMode;
+ pwks->hasDoubleBuffer = MI_FALSE;
+
+ pwks->reqNpcSubvolume = NPCInit;
+
+ pwks->reqviewport.useDrawable = MI_TRUE;
+ pwks->reqviewport.minval.x = 0.0;
+ pwks->reqviewport.minval.y = 0.0;
+ pwks->reqviewport.minval.z = 0.0;
+ pwks->reqviewport.maxval.x = prend->pDrawable->width;
+ pwks->reqviewport.maxval.y = prend->pDrawable->height;
+ pwks->reqviewport.maxval.z = 1.0;
+
+ /*
+ * pos: ordered structure list for posted structures. the first pos
+ * is a dummy
+ */
+ pos = (ddOrdStruct *) xalloc(sizeof(ddOrdStruct));
+ if (pos == NULL) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ pos->pstruct = 0;
+ pos->priority = 0;
+ pos->next = NULL;
+ pwks->postedStructs.postruct = pos;
+ pwks->postedStructs.numStructs = 0;
+
+ /*
+ * create the view tables as PEX lookup tables use the wks id as the
+ * lut id. don't put the workstation on the view table's reference
+ * list, we don't want the LUT procedure to generate any picture
+ * redraws this also prevents any nasty side effects when the
+ * resource is deleted
+ */
+
+ /* requested view */
+ /* first create the resource structure that has the table id and type */
+ if (!(view = (diLUTHandle) xalloc(sizeof(ddLUTResource)))) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ view->id = pWKS->id;
+ view->lutType = PEXViewLUT;
+
+ if (err43 = CreateLUT(pInitInfo->pDrawable, view)) {
+ deletewks(pwks, pWKS);
+ return (err43);
+ }
+ pwks->reqViewTable = view;
+
+ /* current view */
+ /* first create the resource structure that has the table id and type */
+ if (!(view = (diLUTHandle) xalloc(sizeof(ddLUTResource)))) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ view->id = pWKS->id;
+ view->lutType = PEXViewLUT;
+
+ if (err43 = CreateLUT(pInitInfo->pDrawable, view)) {
+ deletewks(pwks, pWKS);
+ return (err43);
+ }
+ prend->lut[PEXViewLUT] = view;
+
+ /*
+ * add an entry for each predefined view note that this assumes that
+ * view 0 is defined to the PEX default values as required for PHIGS
+ * wks
+ */
+ if ((MILUT_HEADER(view))->tableInfo.numPredefined) {
+ for (i = (MILUT_HEADER(view))->tableInfo.predefinedMin;
+ i <= (MILUT_HEADER(view))->tableInfo.predefinedMax; i++) {
+ err3 = mi_add_ord_view(&pwks->views, (ddUSHORT)i);
+ }
+ }
+ /* WksDynamics */
+ for (i = 0; i < (int) MAX_DYNAMIC; i++)
+ pwks->dynamics[i] = mi_dynamics[type][i];
+
+ /* call level III procedure to create dd parts of renderer */
+ if (err3 = InitRenderer(prend)) {
+ deletewks(pwks, pWKS);
+ return (err3);
+ }
+
+ /* Pick device */
+ if (!init_pick_flag) {
+ initialize_pick_devices();
+ init_pick_flag = MI_TRUE;
+ }
+ for (i = 0; i < MIWKS_NUM_PICK_DEVICES; i++) {
+ pwks->devices[i] = pick_devices[i];
+ if (!(pwks->devices[i].path = puCreateList(DD_PICK_PATH))) {
+ deletewks(pwks, pWKS);
+ return (BadAlloc);
+ }
+ }
+
+
+ /* do stuff here to set up hlhsr mode */
+
+ /* do stuff here to set up buffer mode */
+ ChangeDoubleBuffers (pwks);
+
+ return (Success);
+} /* CreatePhigsWks */
+
+static void
+deletewks(pwks, pWKS)
+ miWksPtr pwks;
+ diWKSHandle pWKS;
+{
+ register ddRendererPtr prend;
+ register int i;
+ ddOrdStruct *pos, *posn;
+
+ if (pwks == NULL) return;
+ prend = pwks->pRend;
+ if (prend) {
+ register int i;
+ for (i = MI_FIRSTTABLETYPE; i <= PEXMaxTableType; i++) {
+ if (prend->lut[i]) {
+ if (i != PEXViewLUT)
+ err43 = UpdateLUTRefs(prend->lut[i], (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, REMOVE);
+ else
+
+ /*
+ * FreeLUT frees the resource handle structure and the
+ * dd struct if there are no outstanding refs to the LUT
+ */
+ FreeLUT(prend->lut[i], pWKS->id);
+ prend->lut[i] = 0;
+ }
+ }
+ for (i = 0; i < (int) DD_MAX_FILTERS; i++) {
+ if (prend->ns[i])
+ err43 = UpdateNSRefs(prend->ns[i], (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, REMOVE);
+ }
+
+ if (prend->curPath) {
+ puDeleteList(prend->curPath);
+ prend->curPath = 0; }
+ if (prend->clipList) {
+ puDeleteList(prend->clipList);
+ prend->clipList = 0; }
+
+ if (prend->pDDContext) {
+ DeleteDDContext(prend->pDDContext);
+ prend->pDDContext = 0; }
+
+ if (prend->pPC) {
+ xfree(prend->pPC); /* allocated in one chunk */
+ prend->pPC = 0;}
+
+ xfree(prend);
+ pwks->pRend = 0;
+ }
+
+ if (pwks->reqViewTable) {
+ FreeLUT(pwks->reqViewTable, pWKS->id);
+ pwks->reqViewTable; }
+ if (pwks->pwksList) {
+ puDeleteList(pwks->pwksList);
+ pwks->reqViewTable; }
+
+ /* unpost all the structures */
+ if (pwks->postedStructs.postruct) {
+ pos = pwks->postedStructs.postruct->next; /* first element is a dummy */
+ while (pos) {
+ /* take the wks out of the structs wks lists */
+ err4 = UpdateStructRefs( pos->pstruct, (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, REMOVE);
+ posn = pos;
+ pos = posn->next;
+ xfree(posn);
+ }
+ pwks->postedStructs.numStructs = 0;
+ pwks->postedStructs.postruct->next = 0;
+ xfree(pwks->postedStructs.postruct);
+ pwks->postedStructs.postruct = 0;
+ }
+
+ /* pick devices */
+ for (i = 0; i < MIWKS_NUM_PICK_DEVICES; i++) {
+
+ /*
+ * paths are empty on initialization, but remember that structure
+ * reference count are updated when the path changes
+ */
+ path_update_struct_refs(pwks->devices[i].path, (diResourceHandle) NULL,
+ PICK_RESOURCE, REMOVE);
+
+ if (pwks->devices[i].path) {
+ puDeleteList(pwks->devices[i].path);
+ pwks->devices[i].path = 0; }
+ if (pwks->devices[i].inclusion) {
+ err43 = UpdateNSRefs(pwks->devices[i].inclusion,
+ (diResourceHandle) NULL, PICK_RESOURCE, REMOVE);
+ pwks->devices[i].inclusion = 0; }
+ if (pwks->devices[i].exclusion) {
+ err43 = UpdateNSRefs(pwks->devices[i].exclusion,
+ (diResourceHandle) NULL, PICK_RESOURCE, REMOVE);
+ pwks->devices[i].exclusion = 0; }
+ }
+
+ xfree(pwks);
+ pWKS->deviceData = NULL;
+ return;
+} /* deletewks */
+
+#define CHECK_DELETE( pddwks, handle ) \
+ if ((((pddwks)->freeFlag) == MI_TRUE) && (((pddwks)->refCount) <= 0 )) \
+ { deletewks( pddwks, handle ); \
+ xfree((char *)(handle)); \
+ }
+
+/*++
+ |
+ | Function Name: FreePhigsWks
+ |
+ | Function Description:
+ | Handles the PEXFreePhigsWKS request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+FreePhigsWks(pWKS, WKSid)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddResourceId WKSid; /* phigs workstation resource id */
+/* out */
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nFreePhigsWks\n");
+#endif
+
+ pWKS->id = PEXAlreadyFreed;
+ pwks->freeFlag = MI_TRUE;
+ CHECK_DELETE(pwks, pWKS);
+
+ return (Success);
+} /* FreePhigsWks */
+
+/*++
+ |
+ | Function Name: InquireWksInfo
+ |
+ | Function Description:
+ | Handles the PEXGetWKSInfo request.
+ |
+ | Note(s):
+ |
+ --*/
+
+/* depends on 'mask' being defined */
+#define WKS_CHECK_BITMASK( bitIndex ) \
+ if (mask[((bitIndex)/32)] & (((unsigned long)1) << ((bitIndex) % 32)))
+
+/* depends on 'mask' and needbytes being there */
+#define COUNTBYTES( type, bytes ) \
+ WKS_CHECK_BITMASK( type ) \
+ needbytes += (bytes)
+
+static XID ulNULL = 0;
+
+#define PLUTID( plut ) \
+ (plut)==NULL ? &ulNULL : &(plut)->id
+
+#define PNSID( pns ) \
+ (pns)==NULL ? &ulNULL : &(pns)->id
+
+ddpex4rtn
+InquireWksInfo(pWKS, mask, pNumValues, pBuffer)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddBitmask mask[2];/* item mask */
+/* out */
+ ddULONG *pNumValues; /* number of items returned */
+ ddBufferPtr pBuffer;/* workstation information */
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddULONG needbytes;
+ int sshort, sulong, sbyte, sushort, sfloat, spexNpcSubvolume, spexViewport;
+ ddPointer pbyte;
+
+#ifdef DDTEST
+ ErrorF("\nInquireWksInfo\n");
+#endif
+
+ *pNumValues = 0;
+
+ /* calculate the number of bytes needed to return the info */
+ needbytes = 0;
+
+ COUNTBYTES(PEXPWDisplayUpdate, 4);
+ COUNTBYTES(PEXPWVisualState, 4);
+ COUNTBYTES(PEXPWDisplaySurface, 4);
+ COUNTBYTES(PEXPWViewUpdate, 4);
+ COUNTBYTES(PEXPWDefinedViews, (4 + 4 * pwks->views.defined_views));
+ COUNTBYTES(PEXPWWksUpdate, 4);
+ COUNTBYTES(PEXPWReqNpcSubvolume, 24);
+ COUNTBYTES(PEXPWCurNpcSubvolume, 24);
+ COUNTBYTES(PEXPWReqWksViewport, 20);
+ COUNTBYTES(PEXPWCurWksViewport, 20);
+ COUNTBYTES(PEXPWHlhsrUpdate, 4);
+ COUNTBYTES(PEXPWReqHlhsrMode, 4);
+ COUNTBYTES(PEXPWCurHlhsrMode, 4);
+ COUNTBYTES(PEXPWDrawable, 4);
+ COUNTBYTES(PEXPWMarkerBundle, 4);
+ COUNTBYTES(PEXPWTextBundle, 4);
+ COUNTBYTES(PEXPWLineBundle, 4);
+ COUNTBYTES(PEXPWInteriorBundle, 4);
+ COUNTBYTES(PEXPWEdgeBundle, 4);
+ COUNTBYTES(PEXPWColourTable, 4);
+ COUNTBYTES(PEXPWDepthCueTable, 4);
+ COUNTBYTES(PEXPWLightTable, 4);
+ COUNTBYTES(PEXPWColourApproxTable, 4);
+ COUNTBYTES(PEXPWPatternTable, 4);
+ COUNTBYTES(PEXPWTextFontTable, 4);
+ COUNTBYTES(PEXPWHighlightIncl, 4);
+ COUNTBYTES(PEXPWHighlightExcl, 4);
+ COUNTBYTES(PEXPWInvisibilityIncl, 4);
+ COUNTBYTES(PEXPWInvisibilityExcl, 4);
+ COUNTBYTES(PEXPWPostedStructures, (4 + 8 * pwks->postedStructs.numStructs));
+ COUNTBYTES(PEXPWNumPriorities, 4);
+ COUNTBYTES(PEXPWBufferUpdate, 4);
+ COUNTBYTES(PEXPWCurBufferMode, 4);
+ COUNTBYTES(PEXPWReqBufferMode, 4);
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, needbytes);
+
+ /* let's remember a few sizes */
+ sshort = sizeof(ddSHORT);
+ ASSURE(sshort == 2);
+ sbyte = sizeof(ddBYTE);
+ ASSURE(sbyte == 1);
+ sulong = sizeof(ddULONG);
+ ASSURE(sulong == 4);
+ sushort = sizeof(ddUSHORT);
+ ASSURE(sushort == 2);
+ sfloat = sizeof(ddFLOAT);
+ ASSURE(sfloat == 4);
+ spexNpcSubvolume = sizeof(ddNpcSubvolume);
+ ASSURE(spexNpcSubvolume == 24);
+ spexViewport = sizeof(ddViewport);
+ ASSURE(spexViewport == 20);
+
+ pbyte = pBuffer->pBuf;
+
+ /* return the info in the format encoded for the reply */
+
+ /*
+ Took out the micopy usage cause it was a real brain dead way
+ to do this. Note that this stuff NEVER checks the buffer size,
+ maybe I'll add this someday - JSH
+ */
+ WKS_CHECK_BITMASK(PEXPWDisplayUpdate) {
+ PACK_CARD32(pwks->displayUpdate, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWVisualState) {
+ PACK_CARD32(pwks->visualState, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWDisplaySurface) {
+ PACK_CARD32(pwks->displaySurface, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWViewUpdate) {
+ PACK_CARD32(pwks->viewUpdate, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWDefinedViews) {
+ /* returns in order, highest priority view first */
+ ddOrdView *indexer;
+
+ (*pNumValues) += pwks->views.defined_views;
+ PACK_CARD32(pwks->views.defined_views, pbyte);
+ indexer = pwks->views.highest;
+ do {
+ if (indexer->defined) {
+ PACK_CARD32(indexer->first_view, pbyte);
+ }
+ indexer = indexer->lower;
+ } while (indexer != NULL);
+ }
+ WKS_CHECK_BITMASK(PEXPWWksUpdate) {
+ PACK_CARD32(pwks->wksUpdate, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWReqNpcSubvolume) {
+ PACK_STRUCT(ddNpcSubvolume, &(pwks->reqNpcSubvolume), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWCurNpcSubvolume) {
+ PACK_STRUCT(ddNpcSubvolume, &(pwks->pRend->npcSubvolume), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWReqWksViewport) {
+ PACK_STRUCT(ddViewport, &(pwks->reqviewport), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWCurWksViewport) {
+ PACK_STRUCT(ddViewport, &(pwks->pRend->viewport), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWHlhsrUpdate) {
+ PACK_CARD32(pwks->hlhsrUpdate, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWReqHlhsrMode) {
+ PACK_CARD32(pwks->reqhlhsrMode, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWCurHlhsrMode) {
+ PACK_CARD32(pwks->pRend->hlhsrMode, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWDrawable) {
+ PACK_CARD32(pwks->pRend->drawableId, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWMarkerBundle) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXMarkerBundleLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWTextBundle) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXTextBundleLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWLineBundle) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXLineBundleLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWInteriorBundle) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXInteriorBundleLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWEdgeBundle) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXEdgeBundleLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWColourTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXColourLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWDepthCueTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXDepthCueLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWLightTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXLightLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWColourApproxTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXColourApproxLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWPatternTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXPatternLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWTextFontTable) {
+ PACK_CARD32(*(PLUTID(pwks->pRend->lut[PEXTextFontLUT])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWHighlightIncl) {
+ PACK_CARD32(*(PNSID(pwks->pRend->ns[(int) DD_HIGH_INCL_NS])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWHighlightExcl) {
+ PACK_CARD32(*(PNSID(pwks->pRend->ns[(int) DD_HIGH_EXCL_NS])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWInvisibilityIncl) {
+ PACK_CARD32(*(PNSID(pwks->pRend->ns[(int) DD_INVIS_INCL_NS])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWInvisibilityExcl) {
+ PACK_CARD32(*(PNSID(pwks->pRend->ns[(int) DD_INVIS_EXCL_NS])), pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWPostedStructures) {
+ register ddOrdStruct *pos;
+
+ PACK_CARD32(pwks->postedStructs.numStructs, pbyte);
+ pos = pwks->postedStructs.postruct;
+ while (pos->next) {
+ PACK_CARD32(pos->next->pstruct->id, pbyte);
+ PACK_FLOAT(pos->next->priority, pbyte);
+ pos = pos->next;
+ }
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWNumPriorities) {
+
+ /*
+ * return 0 for now - should implement num_priorities as part
+ * of the wks
+ */
+ PACK_CARD32( 0, pbyte);
+ (*pNumValues)++;
+ }
+
+ WKS_CHECK_BITMASK( PEXPWBufferUpdate )
+ {
+ PACK_CARD32( pwks->bufferUpdate, pbyte);
+ (*pNumValues)++;
+ }
+
+ WKS_CHECK_BITMASK(PEXPWReqBufferMode) {
+ PACK_CARD32( pwks->reqBufferMode, pbyte);
+ (*pNumValues)++;
+ }
+ WKS_CHECK_BITMASK(PEXPWCurBufferMode) {
+ PACK_CARD32( pwks->curBufferMode, pbyte);
+ (*pNumValues)++;
+ }
+ pBuffer->dataSize = needbytes;
+ ASSURE(needbytes == (pbyte - pBuffer->pBuf));
+
+ return (Success);
+} /* InquireWksInfo */
+
+/*++
+ |
+ | Function Name: InquireWksDynamics
+ |
+ | Function Description:
+ | Handles the PEXGetDynamics request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireWksDynamics(pDrawable, pValues)
+/* in */
+ DrawablePtr pDrawable; /* drawable */
+/* out */
+ ddWksDynamics *pValues;/* dynamics information */
+{
+ ddBYTE *pdtable;
+ int type;
+
+#ifdef DDTEST
+ ErrorF("\nInquireWksDynamics\n");
+#endif
+
+ MI_WHICHDRAW(pDrawable, type);
+
+ pdtable = mi_dynamics[type];
+ pValues->viewRep = pdtable[(int) VIEW_REP_DYNAMIC];
+ pValues->markerBundle = pdtable[(int) MARKER_BUNDLE_DYNAMIC];
+ pValues->textBundle = pdtable[(int) TEXT_BUNDLE_DYNAMIC];
+ pValues->lineBundle = pdtable[(int) LINE_BUNDLE_DYNAMIC];
+ pValues->interiorBundle = pdtable[(int) INTERIOR_BUNDLE_DYNAMIC];
+ pValues->edgeBundle = pdtable[(int) EDGE_BUNDLE_DYNAMIC];
+ pValues->colourTable = pdtable[(int) COLOUR_TABLE_DYNAMIC];
+ pValues->patternTable = pdtable[(int) PATTERN_TABLE_DYNAMIC];
+ pValues->wksTransform = pdtable[(int) WKS_TRANSFORM_DYNAMIC];
+ pValues->highlightFilter = pdtable[(int) HIGH_FILTER_DYNAMIC];
+ pValues->invisFilter = pdtable[(int) INVIS_FILTER_DYNAMIC];
+ pValues->hlhsrMode = pdtable[(int) HLHSR_MODE_DYNAMIC];
+ pValues->strModify = pdtable[(int) STR_MODIFY_DYNAMIC];
+ pValues->postStr = pdtable[(int) POST_STR_DYNAMIC];
+ pValues->unpostStr = pdtable[(int) UNPOST_STR_DYNAMIC];
+ pValues->deleteStr = pdtable[(int) DELETE_STR_DYNAMIC];
+ pValues->refModify = pdtable[(int) REF_MODIFY_DYNAMIC];
+ pValues->bufferModify = pdtable[(int) BUFFER_MODIFY_DYNAMIC];
+ pValues->lightTable = pdtable[(int) BUFFER_MODIFY_DYNAMIC];
+ pValues->depthCueTable = pdtable[(int) BUFFER_MODIFY_DYNAMIC];
+ pValues->colourApproxTable = pdtable[(int) BUFFER_MODIFY_DYNAMIC];
+
+ return (Success);
+} /* InquireWksDynamics */
+
+/*++
+ |
+ | Function Name: InquireViewRep
+ |
+ | Function Description:
+ | Handles the PEXGetViewRep request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+InquireViewRep(pWKS, index, pUpdate, pRequested, pCurrent)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddTableIndex index; /* view table index */
+/* out */
+ ddUSHORT *pUpdate;/* (pending/notpending) */
+ ddViewRep *pRequested; /* requested view */
+ ddViewRep *pCurrent; /* current view */
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddUSHORT status;
+ ddBuffer buffer;
+
+#ifdef DDTEST
+ ErrorF("\nInquireViewRep\n");
+#endif
+
+ *pUpdate = pwks->viewUpdate;
+ buffer.bufSize = 0;
+ buffer.dataSize = 0;
+ buffer.pBuf = NULL;
+ buffer.pHead = NULL;
+ if (err43 = InquireLUTEntry(pwks->reqViewTable, index, PEXSetValue, &status, &buffer))
+ return (err43);
+ pRequested->index = index;
+ mibcopy(buffer.pBuf, &(pRequested->view), sizeof(ddViewEntry));
+ if (err43 = InquireLUTEntry(pwks->pRend->lut[PEXViewLUT], index, PEXSetValue, &status, &buffer))
+ return (err43);
+ pCurrent->index = index;
+ mibcopy(buffer.pBuf, &(pCurrent->view), sizeof(ddViewEntry));
+ xfree(buffer.pHead);
+ return (Success);
+} /* InquireViewRep */
+
+/*++
+ |
+ | Function Name: RedrawStructures
+ |
+ | Function Description:
+ | Handles the PEXRedrawAllStructures request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+RedrawStructures(pWKS)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+/* out */
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ register DrawablePtr pDraw = pwks->pRend->pDrawable;
+
+
+#ifdef DDTEST
+ ErrorF("\nRedrawStructures\n");
+#endif
+
+ if ( (pDraw == NULL)
+ || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ if (pDraw->class == InputOnly) /* from dix dispatch.c */
+ return (BadMatch);
+ else if (!pwks->usingDoubleBuffer) {/* pixmap: fill the rectangle ???? */
+
+ GCPtr pGC;
+ extern GCPtr CreateScratchGC();
+ extern int ChangeGC();
+ extern void ValidateGC();
+ xRectangle xrect;
+ ddUSHORT status;
+ miColourEntry *pLUT;
+ unsigned long gcmask, colourindex;
+
+ /*
+ * get background colour and convert it to an X pixel use
+ * default entry (0) in colourApprox LUT for the conversion
+ */
+ InquireLUTEntryAddress( PEXColourLUT, pwks->pRend->lut[PEXColourLUT], 0,
+ &status, &pLUT);
+ miColourtoIndex(pwks->pRend, 0, &pLUT->entry, &colourindex);
+
+ pGC = CreateScratchGC(pDraw->pScreen, pDraw->depth);
+ gcmask = GCForeground;
+ ChangeGC(pGC, gcmask, &colourindex);
+ ValidateGC(pDraw, pGC);
+ xrect.x = 0;
+ xrect.y = 0;
+ xrect.width = pDraw->width;
+ xrect.height = pDraw->height;
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &xrect);
+ FreeScratchGC(pGC);
+ pwks->displaySurface = PEXEmpty;
+ }
+
+ /*
+ * If any attributes are set to Pending, make the requested values
+ * current and reset to NotPending - for the following
+ */
+
+ if (pwks->viewUpdate == PEXPending) {
+ register ddUSHORT i, maxviews;
+ ddUSHORT status;
+ ddBuffer buffer;
+
+ buffer.bufSize = sizeof(ddViewEntry);
+ buffer.dataSize = 0;
+ buffer.pHead = buffer.pBuf = (ddPointer) xalloc(sizeof(ddViewEntry));
+
+ if (!buffer.pBuf) return (BadAlloc); /* we're out of memory! */
+
+ /*
+ * loop to check each entry to see if it is pending assume
+ * they are not consecutive entries and set them one at a
+ * time
+ */
+ maxviews = MIWKS_MAX_VIEWS;
+ for (i = 0; i < maxviews; i++) {
+ if (pwks->deltaviewMask & (1L << i)) {
+
+ if (err43 = InquireLUTEntry( pwks->reqViewTable, i,
+ PEXSetValue, &status, &buffer))
+ return (err43); /* we're out of memory! */
+
+ if (err43 = SetLUTEntries( pwks->pRend->lut[PEXViewLUT],
+ i, 1, buffer.pBuf))
+ return (err43); /* we're out of memory! */
+
+ /*
+ * make sure it is in the list of defined
+ * views
+ */
+ err43 = mi_add_ord_view(&pwks->views, i);
+ if (err43) return (err43); /* we're out of memory! */
+ }
+ }
+ pwks->deltaviewMask = 0;
+ xfree(buffer.pBuf);
+ pwks->viewUpdate = PEXNotPending;
+ }
+
+ if (pwks->wksUpdate == PEXPending) {
+ if (pwks->wksMask & WKS_WINDOW_MASK) {
+ pwks->pRend->npcSubvolume = pwks->reqNpcSubvolume;
+ pwks->pRend->attrsChanges |= PEXDynNpcSubvolume;
+ }
+
+ if (pwks->wksMask & WKS_VIEWPORT_MASK) {
+ pwks->pRend->viewport = pwks->reqviewport;
+ pwks->pRend->attrsChanges |= PEXDynViewport;
+ }
+
+ pwks->wksMask = 0;
+ pwks->wksUpdate = PEXNotPending;
+ }
+
+ if (pwks->hlhsrUpdate == PEXPending) {
+ pwks->pRend->hlhsrMode = pwks->reqhlhsrMode;
+ pwks->hlhsrUpdate = PEXNotPending;
+ pwks->pRend->attrsChanges |= PEXDynHlhsrMode;
+ /* do stuff here to effect change in hlhsr mode */
+ }
+
+ if (pwks->bufferUpdate == PEXPending) {
+ pwks->curBufferMode = pwks->reqBufferMode;
+ pwks->bufferUpdate = PEXNotPending;
+ /* do stuff here to effect change in buffer mode */
+ ChangeDoubleBuffers (pwks);
+ }
+ err = miTraverse(pWKS);
+
+ SwapDoubleBuffers (pwks);
+
+ /* Set visual_state to Correct */
+ pwks->visualState = PEXCorrect;
+ /* display Surface is set in miTraverse */
+
+ return (err);
+} /* RedrawStructures */
+
+
+/*++
+ |
+ | Function Name: UpdateWks
+ |
+ | Function Description:
+ | Handles the PEXUpdateWorkstation request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+UpdateWks(pWKS)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+/* out */
+{
+ /* If visual_state is Deferred or Simulated, call RedrawAll */
+ if (((miWksPtr) pWKS->deviceData)->visualState != PEXCorrect) {
+ return (RedrawStructures(pWKS));
+ }
+ return (Success);
+} /* UpdateWks */
+
+/*++
+ |
+ | Function Name: RedrawClipRegion
+ |
+ | Function Description:
+ | Handles the PEXRedrawClipRegion request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+RedrawClipRegion(pWKS, numRects, pRects)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddULONG numRects; /* number of rectangles in list */
+ ddDeviceRect *pRects; /* list of rectangles */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nRedrawClipRegion\n");
+#endif
+
+ /*
+ * set the clip list in the renderer first, empty the clip list
+ */
+ pwks->pRend->clipList->numObj = 0;
+ if (puAddToList((ddPointer) pRects, numRects, pwks->pRend->clipList)
+ == MI_ALLOCERR)
+ return (BadAlloc);
+
+ pwks->pRend->attrsChanges |= PEXDynClipList;
+
+ /* now redraw picture without updating any state */
+ miTraverse(pWKS); /* ignore errors */
+
+
+ /*
+ * The clip list must be emptied so that subsequent workstation
+ * updates redraw the entire display surface.
+ */
+
+ pwks->pRend->clipList->numObj = 0;
+
+ return (Success);
+} /* RedrawClipRegion */
+
+/*++
+ |
+ | Function Name: ExecuteDeferred
+ |
+ | Function Description:
+ | Handles the PEXExecutedDeferredActions request.
+ |
+ | Note(s):
+ There is no definition in PHIGS or PEX of what this
+ is supposed to do. The PHIGS people we have talked
+ to agree with this. Therefore, we have implemented
+ it as a no-op.
+ |
+ --*/
+
+ddpex4rtn
+ExecuteDeferred(pWKS)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+/* out */
+{
+
+#ifdef DDTEST
+ ErrorF("\nExecuteDeferred\n");
+#endif
+
+ return (Success);
+} /* ExecuteDeferred */
+
+/*++
+ |
+ | Function Name: SetViewPriority
+ |
+ | Function Description:
+ | Handles the PEXSetViewPriority request.
+ |
+ | Note(s):
+ move index1 to priority relative to index2
+ |
+ --*/
+
+ddpex4rtn
+SetViewPriority(pWKS, index1, index2, priority)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddTableIndex index1; /* view index */
+ ddTableIndex index2; /* view index */
+ ddUSHORT priority; /* (higher/lower) */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddOrdView *entry1, *entry2;
+
+#ifdef DDTEST
+ ErrorF("\nSetViewPriority\n");
+#endif
+
+ if ((priority != PEXHigher) && (priority != PEXLower))
+ return (BadValue);
+
+ entry1 = mi_find_ord_view(&pwks->views, index1);
+ entry2 = mi_find_ord_view(&pwks->views, index2);
+
+ if ((entry1 == NULL) || (entry2 == NULL))
+ return (BadValue); /* a view is not defined */
+
+ if (index1 == index2)
+ return (Success);
+
+ if (priority == PEXLower) {
+ /* don't do anything if index1 is already next lowest */
+ if (entry2->lower != entry1) {
+ /* take entry1 out of its position */
+ entry1->higher->lower = entry1->lower;
+ entry1->lower->higher = entry1->higher;
+ /* put entry1 before entry2->lower */
+ entry1->lower = entry2->lower;
+ entry2->lower->higher = entry1;
+ /* put entry1 after entry2 */
+ entry2->lower = entry1;
+ entry1->higher = entry2;
+ }
+ } else { /* PEXHigher */
+ /* don't do anything if index1 is already next highest */
+ if (entry2->higher != entry1) {
+ /* take entry1 out of its position */
+ entry1->higher->lower = entry1->lower;
+ entry1->lower->higher = entry1->higher;
+ /* put entry1 after entry2->higher */
+ entry1->higher = entry2->higher;
+ entry2->higher->lower = entry1;
+ /* put entry1 before entry2 */
+ entry2->higher = entry1;
+ entry1->lower = entry2;
+ }
+ }
+
+ return (Success);
+} /* SetViewPriority */
+
+/*++
+ |
+ | Function Name: SetDisplayUpdateMode
+ |
+ | Function Description:
+ | Handles the PEXSetDisplayUpdateMode request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetDisplayUpdateMode(pWKS, mode)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddSHORT mode; /* display update mode */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ register int type, i;
+
+#ifdef DDTEST
+ ErrorF("\nSetDisplayUpdateMode\n");
+#endif
+
+ if ((pwks->pRend->pDrawable == NULL) || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ /* todo: put drawtype in wks header */
+
+ MI_WHICHDRAW(pwks->pRend->pDrawable, type);
+
+ /*
+ * make sure this mode is supported by the drawable in this
+ * implementation
+ */
+ for (i = 0; i < SI_UPDATE_NUM; i++) {
+ if (mode == miDisplayUpdateModeET[type][i].index) {
+ pwks->displayUpdate = mode;
+ SetDoubleDrawable (pwks);
+ if (mode == PEXVisualizeEach)
+
+ /*
+ * you may want to do this if mode =
+ * PEXWhenever, too
+ */
+ {
+ /* regen the picture if it isn't correct */
+ if (pwks->visualState != PEXCorrect) {
+ if (err4 = RedrawStructures(pWKS))
+ return (err4);
+ pwks->visualState = PEXCorrect;
+ }
+ }
+ return (Success);
+ }
+ }
+
+ return (BadValue);
+} /* SetDisplayUpdateMode */
+
+/* get_view gets the view transforms from the view table and
+ * it returns the composit transform and the clipping info
+ * it calculates the composite view transform if the vomFlag is true
+ */
+static int
+get_view(view_table, view_index, clipflag, clips, vom, vomFlag)
+ diLUTHandle view_table;
+ ddTableIndex view_index;
+ ddUSHORT *clipflag;
+ ddNpcSubvolume *clips;
+ ddFLOAT vom[4][4];
+ ddBYTE vomFlag;
+{
+ ddBuffer buffer;
+ ddUSHORT status;
+ ddFLOAT orient[4][4];
+ ddFLOAT map[4][4];
+
+ /* get view rep */
+ buffer.pHead = buffer.pBuf = NULL;
+ buffer.dataSize = buffer.bufSize = 0;
+ err = InquireLUTEntry(view_table, view_index, PEXSetValue, &status, &buffer);
+ if (err != Success)
+ return (err);
+
+ mibcopy(&(((ddViewEntry *) buffer.pBuf)->clipLimits),
+ clips, sizeof(ddNpcSubvolume));
+ *clipflag = ((ddViewEntry *) buffer.pBuf)->clipFlags;
+
+ if (vomFlag) {
+ mibcopy((((ddViewEntry *) buffer.pBuf)->orientation),
+ orient, 16 * sizeof(ddFLOAT));
+ mibcopy((((ddViewEntry *) buffer.pBuf)->mapping),
+ map, 16 * sizeof(ddFLOAT));
+ miMatMult(vom, orient, map);
+ }
+ xfree(buffer.pHead);
+ return (Success);
+}
+
+/* no check for z when using drawable */
+#define PT_IN_LIMIT(prend, lim, pt) \
+ ( (pt)->x >= (lim)->minval.x && (pt)->x <= (lim)->maxval.x \
+ && (pt)->y >= (lim)->minval.y && (pt)->y <= (lim)->maxval.y \
+ && (pt)->z >= (lim)->minval.z && (pt)->z <= (lim)->maxval.z )
+
+/*++
+ |
+ | Function Name: MapDcWc
+ |
+ | Function Description:
+ | Handles the PEXMapDCtoWC request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+MapDcWc(pWKS, numPoints, pDCpoints, pRetPoints, pWCpoints, pView)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddULONG numPoints; /* number of coords */
+ ddDeviceCoord *pDCpoints; /* list of device coords */
+/* out */
+ ddULONG *pRetPoints; /* number of coords returned */
+ ddCoord3D *pWCpoints; /* list of world coords */
+ ddUSHORT *pView; /* view index */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddFLOAT npc_dc_xform[4][4];
+ ddFLOAT npc_to_wc_xform[4][4];
+ ddUSHORT clipFlags;
+ ddNpcSubvolume clipLimits;
+ ddDeviceCoord *pDCpoint;
+ ddCoord3D *pWCpoint;
+ ddCoord4D pt4d1, pt4d2;
+ register int i;
+ ddTableIndex view = 0;
+ int ptcount = 0, tmpcount = 0;
+ ddOrdView *poview;
+ ddBOOL last_view;
+
+#ifdef DDTEST
+ ErrorF("\nMapDcWc\n");
+#endif
+
+ *pView = 0;
+ *pRetPoints = 0;
+
+ /*
+ * transforms: wc_to_npc_xform = [view orient][view map]
+ * npc_to_wc_xform = inverse(wc_to_npc_xform)
+ * npc_to_dc_xform = [Sx 0 0 0]
+ * S=Scale [0 Sy 0 0]
+ * T=Translate [0 0 Sz 0]
+ * [Tx Ty Tz 1]
+ * dc_to_npc_xform = inverse(npc_to_dc_xform)
+ * wc_point = [npc_to_wc_xform][npc_point]
+ * npc_point = * [dc_to_npc_xform][dc_point]
+ * (dc_point is a 4d column vector of the
+ * given dc with w=1.0)
+ */
+ miBldViewport_xform(pwks->pRend, pwks->pRend->pDrawable,
+ npc_dc_xform, NULL);
+ miMatInverse(npc_dc_xform);
+
+ /*
+ * go through each defined view and find the one which has the most
+ * points in it and the highest priority
+ */
+ for (last_view = 0, poview = pwks->views.lowest; !last_view; poview = poview->higher) {
+ if (poview->defined) {
+ err = get_view(pwks->pRend->lut[PEXViewLUT], poview->first_view, &clipFlags,
+ &clipLimits, npc_to_wc_xform, MI_FALSE);
+ if (err != Success)
+ return (err);
+
+ for (i = 0, pWCpoint = pWCpoints, pDCpoint = pDCpoints; i < numPoints; i++, pDCpoint++) {
+ pt4d1.x = pDCpoint->x;
+ pt4d1.y = pDCpoint->y;
+ pt4d1.z = pDCpoint->z;
+ pt4d1.w = 1.0;
+ miTransformPoint(&pt4d1, npc_dc_xform, &pt4d2);
+ if (PT_IN_LIMIT(pwks->pRend, &clipLimits, &pt4d2))
+ tmpcount++;
+ }
+
+ /*
+ * use this view if it has more points. if it has
+ * same number then this view has higher priority
+ */
+ if (tmpcount >= ptcount) {
+ view = poview->first_view;
+ ptcount = tmpcount;
+ }
+ }
+ last_view = (poview == pwks->views.highest);
+ }
+
+ err = get_view(pwks->pRend->lut[PEXViewLUT], view, &clipFlags, &clipLimits,
+ npc_to_wc_xform, MI_TRUE);
+ if (err != Success)
+ return (err);
+ miMatInverse(npc_to_wc_xform);
+
+ for (i = 0, pWCpoint = pWCpoints, pDCpoint = pDCpoints; i < numPoints; i++, pDCpoint++) {
+ pt4d1.x = pDCpoint->x;
+ pt4d1.y = pDCpoint->y;
+ pt4d1.z = pDCpoint->z;
+ pt4d1.w = 1.0;
+ miTransformPoint(&pt4d1, npc_dc_xform, &pt4d2);
+ if (PT_IN_LIMIT(pwks->pRend, &clipLimits, &pt4d2)) {
+ miTransformPoint(&pt4d2, npc_to_wc_xform, &pt4d1);
+ pWCpoint->x = pt4d1.x;
+ pWCpoint->y = pt4d1.y;
+ pWCpoint->z = pt4d1.z;
+ pWCpoint++;
+ (*pRetPoints)++;
+ }
+ }
+
+ *pView = view;
+ return (Success);
+} /* MapDcWc */
+
+/*++
+ |
+ | Function Name: MapWcDc
+ |
+ | Function Description:
+ | Handles the PEXMapWCtoDC request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+MapWcDc(pWKS, numPoints, pWCpoints, view, pRetPoints, pDCpoints)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddULONG numPoints; /* number of coords */
+ ddCoord3D *pWCpoints; /* list of world coords */
+ ddTableIndex view; /* view index */
+/* out */
+ ddULONG *pRetPoints; /* number of coords returned */
+ ddDeviceCoord *pDCpoints; /* list of device coords */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddFLOAT wc_to_npc_xform[4][4];
+ ddFLOAT npc_to_dc_xform[4][4];
+ ddUSHORT clipFlags;
+ ddNpcSubvolume clipLimits;
+ ddDeviceCoord *pDCpoint;
+ ddCoord3D *pWCpoint;
+ ddCoord4D pt4d1, pt4d2;
+ register int i;
+
+#ifdef DDTEST
+ ErrorF("\nMapWcDc\n");
+#endif
+
+ *pRetPoints = 0;
+
+ /*
+ * transforms: wc_to_npc_xform = [view orient][view map]
+ * npc_point = [wc_to_npc_xform][wc_point]
+ * (wc_point is a 4d column vector of the
+ * given wc with w=1.0)
+ * npc_to_dc_xform = [Sx 0 0 0]
+ * S=Scale [0 Sy 0 0]
+ * T=Translate [0 0 Sz 0]
+ * [Tx Ty Tz 1]
+ * dc_point = [npc_to_dc_xform][npc_point]
+ */
+ miBldViewport_xform(pwks->pRend, pwks->pRend->pDrawable,
+ npc_to_dc_xform, NULL);
+
+ err = get_view(pwks->pRend->lut[PEXViewLUT], view, &clipFlags, &clipLimits, wc_to_npc_xform, MI_TRUE);
+ if (err != Success)
+ return (err);
+
+ for (i = 0, pWCpoint = pWCpoints, pDCpoint = pDCpoints; i < numPoints; i++, pWCpoint++) {
+ pt4d1.x = pWCpoint->x;
+ pt4d1.y = pWCpoint->y;
+ pt4d1.z = pWCpoint->z;
+ pt4d1.w = 1.0;
+ miTransformPoint(&pt4d1, wc_to_npc_xform, &pt4d2);
+ if (PT_IN_LIMIT(pwks->pRend, &clipLimits, &pt4d2)) {
+ miTransformPoint(&pt4d2, npc_to_dc_xform, &pt4d1);
+ pDCpoint->x = pt4d1.x;
+ pDCpoint->y = pt4d1.y;
+ pDCpoint->z = pt4d1.z;
+ pDCpoint++;
+ (*pRetPoints)++;
+ }
+ }
+
+ return (Success);
+} /* MapWcDc */
+
+/*++
+ |
+ | Function Name: SetViewRep
+ |
+ | Function Description:
+ | Handles the PEXSetViewRep request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetViewRep(pWKS, pView)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddViewRep *pView; /* view rep */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nSetViewRep\n");
+#endif
+
+ /* set the requested tables */
+ if (err43 = SetLUTEntries(pwks->reqViewTable, pView->index, 1, (ddPointer) & (pView->view)))
+ return (err43);
+
+ if (VISUALIZE_NOW(pwks, VIEW_REP_DYNAMIC)) {
+ /* set the current tables */
+ if (err43 = SetLUTEntries(pwks->pRend->lut[PEXViewLUT], pView->index, 1,
+ (ddPointer) & (pView->view)))
+ return (err43);
+
+ /* set view as defined in view priority list */
+ err43 = mi_add_ord_view(&pwks->views, pView->index);
+ if (err43)
+ return (err43);
+
+ pwks->viewUpdate = PEXNotPending;
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(WKS_TRANSFORM_DYNAMIC, pwks->pwksList);
+ } else {
+
+ /*
+ * set mask to show which entry is pending NOTE: mask is only
+ * big enough for tables <= 32 entries our table only has 6
+ * entries right now
+ */
+ pwks->deltaviewMask |= (1L << pView->index);
+
+ pwks->viewUpdate = PEXPending;
+ pwks->visualState = PEXDeferred;
+ }
+
+ return (Success);
+} /* SetViewRep */
+
+/*++
+ |
+ | Function Name: SetWksWindow
+ |
+ | Function Description:
+ | Handles the PEXSetWKSWindow request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetWksWindow(pWKS, pNpcSubvolume)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddNpcSubvolume *pNpcSubvolume; /* window volume */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nSetWksWindow\n");
+#endif
+
+ pwks->reqNpcSubvolume = *pNpcSubvolume;
+
+ if (VISUALIZE_NOW(pwks, WKS_TRANSFORM_DYNAMIC)) {
+ pwks->pRend->npcSubvolume = *pNpcSubvolume;
+ pwks->pRend->attrsChanges |= PEXDynNpcSubvolume;
+
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(WKS_TRANSFORM_DYNAMIC, pwks->pwksList);
+ } else {
+ /* don't update display */
+ pwks->wksUpdate = PEXPending;
+ pwks->visualState = PEXDeferred;
+ pwks->wksMask |= WKS_WINDOW_MASK;
+ }
+ return (Success);
+} /* SetWksWindow */
+
+/*++
+ |
+ | Function Name: SetWksViewport
+ |
+ | Function Description:
+ | Handles the PEXSetWKSViewport request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetWksViewport(pWKS, pViewport)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddViewport *pViewport; /* viewport */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nSetWksViewport\n");
+#endif
+
+ if ((pwks->pRend->pDrawable == NULL) || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ if (pViewport->useDrawable) {
+ pwks->reqviewport.minval.x = 0.0;
+ pwks->reqviewport.minval.y = 0.0;
+ pwks->reqviewport.minval.z = 0.0;
+ pwks->reqviewport.maxval.x = pwks->pRend->pDrawable->width;
+ pwks->reqviewport.maxval.y = pwks->pRend->pDrawable->height;
+ pwks->reqviewport.maxval.z = 1.0;
+ } else
+ pwks->reqviewport = *pViewport;
+
+ if (VISUALIZE_NOW(pwks, WKS_TRANSFORM_DYNAMIC)) {
+ pwks->pRend->viewport = *pViewport;
+ pwks->pRend->attrsChanges |= PEXDynViewport;
+
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(WKS_TRANSFORM_DYNAMIC, pwks->pwksList);
+ } else {
+ /* don't update display */
+ pwks->wksUpdate = PEXPending;
+ pwks->visualState = PEXDeferred;
+ pwks->wksMask |= WKS_VIEWPORT_MASK;
+ }
+
+ return (Success);
+} /* SetWksViewport */
+
+/*++
+ |
+ | Function Name: SetHlhsrMode
+ |
+ | Function Description:
+ | Handles the PEXSetHLHSRMode request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetHlhsrMode(pWKS, mode)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddEnumTypeIndex mode; /* hlhsr mode */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ register int i, type;
+
+#ifdef DDTEST
+ ErrorF("\nSetHlhsrMode\n");
+#endif
+
+ if ((pwks->pRend->pDrawable == NULL) || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ MI_WHICHDRAW(pwks->pRend->pDrawable, type);
+
+ /*
+ * make sure this mode is supported by the drawable in this
+ * implementation
+ */
+ for (i = 0; i < SI_HLHSR_NUM; i++) {
+ if (mode == miHlhsrModeET[type][i].index) {
+ pwks->reqhlhsrMode = mode;
+ if (WKSIMMEDIATE(pwks, HLHSR_MODE_DYNAMIC))
+ {
+ pwks->pRend->hlhsrMode = mode;
+ pwks->pRend->attrsChanges |= PEXDynHlhsrMode;
+ }
+ /* hlhsrUpdate doesn't change */
+ /* do stuff here to effect change in hlhsr mode */
+ else {
+ /* don't update display */
+ pwks->hlhsrUpdate = PEXPending;
+ pwks->visualState = PEXDeferred;
+ }
+ return (Success);
+ }
+ }
+
+ return (BadValue);
+} /* SetHlhsrMode */
+
+/*++
+ |
+ | Function Name: SetBufferMode
+ |
+ | Function Description:
+ | Handles the PEXSetBufferMode request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+SetBufferMode(pWKS, mode)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ ddUSHORT mode; /* buffer mode */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ register int type;
+
+#ifdef DDTEST
+ ErrorF("\nSetBufferMode\n");
+#endif
+
+ if ((pwks->pRend->pDrawable == NULL) || (pwks->pRend->drawableId == PEXAlreadyFreed))
+ return (BadDrawable);
+
+ MI_WHICHDRAW(pwks->pRend->pDrawable, type);
+
+ /*
+ * make sure this mode is supported by the drawable in this
+ * implementation
+ */
+ if ((mode == PEXSingleBuffered) || (mode == PEXDoubleBuffered)) {
+ pwks->reqBufferMode = mode;
+ if (WKSIMMEDIATE(pwks, BUFFER_MODIFY_DYNAMIC))
+ {
+ pwks->curBufferMode = mode;
+ /* bufferUpdate doesn't change */
+ /* do stuff here to effect change in buffer mode */
+ ChangeDoubleBuffers (pwks);
+ }
+ else {
+ /* don't update display */
+ pwks->bufferUpdate = PEXPending;
+ pwks->visualState = PEXDeferred;
+ }
+ return (Success);
+ } else
+ return (BadValue);
+} /* SetBufferMode */
+
+static int
+miAddStructToOrdList(resource, preflist, prity)
+ diStructHandle resource;
+ listofOrdStruct *preflist;
+ ddFLOAT prity;
+{
+ listofOrdStruct *plist = preflist;
+ register ddOrdStruct *postruct, *pbefore, *pnew, *pnext;
+
+#ifdef DDTEST
+ ErrorF("\tmiAddStructToOrdList \n");
+#endif
+ err = MI_SUCCESS;
+
+ /*
+ * check to see if it's in the list already and find out where it
+ * goes in the list if it's in the list, set its priority to the new
+ * priority
+ */
+ pnew = NULL; /* set this to point to the struct already in
+ * the list */
+ pbefore = NULL; /* set this to point to where the struct
+ * belongs inthe list */
+ postruct = preflist->postruct; /* the first element is a dummy */
+
+ /*
+ * loop until the end of the list OR the resource is found in the
+ * list and where it belongs in the list is known
+ */
+ while (postruct->next && (!pnew || !pbefore)) {
+ pnext = postruct->next;
+ if ((prity < pnext->priority) && !pbefore)
+ pbefore = postruct;
+ if (pnext->pstruct == resource) {
+ pnew = pnext; /* remember the old one */
+ postruct->next = pnext->next; /* take it out of the
+ * list */
+ err = MI_EXISTERR;
+ } else
+ postruct = pnext;
+ }
+ if (!pbefore)
+ pbefore = postruct; /* the last element in the list */
+
+ /* now add it to the list */
+ if (!pnew) {
+ if ((pnew = (ddOrdStruct *) xalloc(sizeof(ddOrdStruct))) == NULL)
+ return (MI_ALLOCERR);
+ else
+ plist->numStructs++; /* increment only if it's new
+ * to the list */
+ }
+ pnew->pstruct = resource;
+ pnew->priority = prity;
+
+ pnew->next = pbefore->next;
+ pbefore->next = pnew;
+
+ return (err);
+} /* miAddStructToOrdList */
+
+static void
+miRemoveStructFromOrdList(resource, preflist)
+ diStructHandle resource;
+ listofOrdStruct *preflist;
+{
+ register ddOrdStruct *postruct, *pnew;
+
+#ifdef DDTEST
+ ErrorF("\tmiRemoveStructFromOrdList \n");
+#endif
+
+ pnew = NULL; /* set this to point to the struct already in
+ * the list */
+ postruct = preflist->postruct; /* the first element is a dummy */
+
+ /*
+ * loop until the end of the list OR the resource is found in the
+ * list
+ */
+ while (postruct->next && !pnew) {
+ if (postruct->next->pstruct == resource)
+ pnew = postruct->next;
+ else
+ postruct = postruct->next;
+ }
+ if (pnew) {
+ postruct->next = pnew->next;
+ xfree(pnew);
+ preflist->numStructs--;
+ }
+ return;
+} /* miRemoveStructFromOrdList */
+
+ddBOOL
+miGetStructurePriority(pWKS, pStruct, ppriority)
+ diWKSHandle pWKS; /* workstation handle */
+ diStructHandle pStruct;/* structure handle */
+ ddFLOAT *ppriority; /* structure priority */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ listofOrdStruct *plist = &pwks->postedStructs;
+ register ddOrdStruct *postruct, *pnext;
+
+ postruct = plist->postruct; /* the first element is a dummy */
+ *ppriority = 0;
+
+ while (postruct->next) {
+ pnext = postruct->next;
+ if (pnext->pstruct == pStruct) {
+ *ppriority = pnext->priority;
+ return (MI_TRUE);
+ } else
+ postruct = pnext;
+ }
+ return (MI_FALSE);
+}
+
+/*++
+ |
+ | Function Name: PostStructure
+ |
+ | Function Description:
+ | Handles the PEXPostStructure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+PostStructure(pWKS, pStruct, priority)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ diStructHandle pStruct;/* structure handle */
+ ddFLOAT priority; /* structure priority */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nPostStructure %d\n", pStruct->id);
+#endif
+
+ if ((err = miAddStructToOrdList(pStruct, &(pwks->postedStructs),
+ priority)) == MI_ALLOCERR)
+ return (BadAlloc);
+
+ if (err == MI_SUCCESS) {/* the structure was added */
+ /* add wks to structures list */
+ if (err4 = UpdateStructRefs(pStruct, (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, ADD))
+ return (err4);
+ }
+ /* else the structure was already posted it now has a new priority */
+
+ /* do stuff to see if picture needs to be changed */
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(POST_STR_DYNAMIC, pwks->pwksList);
+
+ return (Success);
+} /* PostStructure */
+
+/*++
+ |
+ | Function Name: UnpostStructure
+ |
+ | Function Description:
+ | Handles the PEXUnpostStructure request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex4rtn
+UnpostStructure(pWKS, pStruct)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+ diStructHandle pStruct;/* structure handle */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+#ifdef DDTEST
+ ErrorF("\nUnpostStructure\n");
+#endif
+
+ /* take the wks out of the structs wks lists */
+ if (err4 = UpdateStructRefs(pStruct, (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, REMOVE))
+ return (err4); /* unlikely */
+
+ if (!pwks) return (Success); /* workstation already freed */
+
+ /* now, remove the structure from the wks posted list */
+ miRemoveStructFromOrdList(pStruct, &(pwks->postedStructs));
+
+ /* do stuff to see if picture needs to be changed */
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(UNPOST_STR_DYNAMIC, pwks->pwksList);
+
+ return (Success);
+} /* UnpostStructure */
+
+/*++
+ |
+ | Function Name: UnpostAllStructures
+ |
+ | Function Description:
+ | Handles the PEXUnpostAllStructures request.
+ |
+ | Note(s):
+ don't use UnpostStructure because this follows the list of posted structures
+ and removes each one as it goes, instead of having UnpostStructure remove
+ them.
+ |
+ --*/
+
+ddpex4rtn
+UnpostAllStructures(pWKS)
+/* in */
+ diWKSHandle pWKS; /* workstation handle */
+/* out */
+{
+ miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+ ddOrdStruct *pos, *posn;
+
+#ifdef DDTEST
+ ErrorF("\nUnpostAllStructures\n");
+#endif
+
+ if (!pwks) return (Success);
+
+ /* don't forget that the first pos is a dummy */
+ pos = pwks->postedStructs.postruct;
+ posn = pos->next;
+ pos->next = NULL;
+ while (posn) {
+
+ /*
+ * take the wks out of the posted structs and childrens wks
+ * lists
+ */
+ err4 = UpdateStructRefs(posn->pstruct, (diResourceHandle) pWKS,
+ WORKSTATION_RESOURCE, REMOVE);
+
+ pos = posn;
+ posn = pos->next;
+ xfree(pos);
+ }
+ pwks->postedStructs.numStructs = 0;
+
+ /* do stuff to see if picture needs to be changed */
+ PU_EMPTY_LIST(pwks->pwksList);
+ puAddToList((ddPointer) & pWKS, (ddULONG) 1, pwks->pwksList);
+
+ miDealWithDynamics(UNPOST_STR_DYNAMIC, pwks->pwksList);
+ return (Success);
+} /* UnpostAllStructures */
+
+/*++
+ |
+ | Function Name: InquireWksPostings
+ |
+ | Function Description:
+ | Handles the PEXGetWKSPostings request.
+ |
+ | Note(s):
+ |
+ --*/
+
+extern ddpex4rtn get_wks_postings();
+
+ddpex4rtn
+InquireWksPostings(pStruct, pBuffer)
+/* in */
+ diStructHandle pStruct;/* structure handle */
+/* out */
+ ddBufferPtr pBuffer;/* list of workstation ids */
+{
+
+#ifdef DDTEST
+ ErrorF("\nInquireWksPostings\n");
+#endif
+
+ return (get_wks_postings(pStruct, pBuffer));
+} /* InquireWksPostings */
+
+/*++
+ |
+ | Function Name: UpdateWksRefs
+ |
+ | Function Description:
+ | only for pick measure reference count
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+UpdateWksRefs(pWKS, pResource, which, action)
+ diWKSHandle pWKS;
+ diResourceHandle pResource; /* pick measure resource */
+ ddResourceType which;
+ ddAction action;
+{
+ register miWksPtr pwks = (miWksPtr) pWKS->deviceData;
+
+ /* only pick measure counts are used here */
+ if (action == ADD)
+ pwks->refCount++;
+ else if (pwks->refCount > 0)
+ pwks->refCount--;
+
+ CHECK_DELETE(pwks, pWKS);
+
+ return;
+} /* UpdateWksRefs */
+
+ddpex4rtn
+mi_add_ord_view(plist, view)
+ listofOrdView *plist;
+ ddUSHORT view;
+{
+ ddOrdView *free1, *free2, *indexer;
+
+ indexer = plist->highest->lower;
+ do {
+ if ((indexer->first_view == view) &&
+ (indexer->last_view == view)) {
+ /* view is already in the list */
+ if (!indexer->defined) {
+ plist->defined_views++;
+ indexer->defined = MI_TRUE;
+ }
+ return (Success);
+ }
+ if ((indexer->first_view <= view) &&
+ (indexer->last_view >= view)) {
+ MIWKS_NEW_OV_ENTRY(plist, free1);
+ if (free1 == NULL) {
+ /* bad news, no more free entries */
+ return (BadValue);
+ }
+ plist->defined_views++;
+ free1->defined = MI_TRUE;
+ free1->first_view = view;
+ free1->last_view = view;
+ if (indexer->first_view == view) { /* new entry goes in
+ * front */
+ free1->higher = indexer->higher;
+ free1->lower = indexer;
+ indexer->higher = free1;
+ free1->higher->lower = free1;
+ indexer->first_view++;
+ ASSURE(indexer->first_view <= indexer->last_view);
+ } else if (indexer->last_view == view) { /* new entry goes on
+ * back */
+ free1->higher = indexer;
+ free1->lower = indexer->lower;
+ indexer->lower = free1;
+ free1->lower->higher = free1;
+ indexer->last_view--;
+ ASSURE(indexer->first_view <= indexer->last_view);
+ } else {/* new entry goes in middle - need to split
+ * the range. the end of the range goes into
+ * a new entry. ranges are always not defined
+ * views, so all views in that new entry are
+ * still undefined */
+ MIWKS_NEW_OV_ENTRY(plist, free2);
+ free2->defined = MI_FALSE;
+ free2->first_view = view + 1;
+ free2->last_view =
+ indexer->last_view;
+ indexer->last_view = view - 1;
+ free1->higher = indexer;
+ free1->lower = free2;
+ free2->higher = free1;
+ free2->lower = indexer->lower;
+ indexer->lower = free1;
+ free2->lower->higher = free2;
+ }
+ return (Success);
+ }
+ indexer = indexer->lower;
+ } while (indexer != plist->lowest);
+ /* reached end of list: should never get here */
+ return (BadValue);
+
+}
+
+ddOrdView *
+mi_find_ord_view(plist, view)
+ listofOrdView *plist;
+ ddUSHORT view;
+{
+/* finds only defined views */
+ ddOrdView *indexer;
+
+ indexer = plist->highest;
+ do {
+ if (indexer->defined && (indexer->first_view == view))
+ return (indexer);
+
+ indexer = indexer->lower;
+ } while (indexer != NULL);
+ /* view is not defined */
+ return (NULL);
+}
+
+void
+initialize_pick_devices()
+{
+ register int i;
+
+ for (i = 0; i < MIWKS_NUM_PICK_DEVICES; i++) {
+ pick_devices[i].type = i + 1;
+ pick_devices[i].status = PEXNoPick;
+ /* don't put the path in here - create it for the wks devices */
+ pick_devices[i].path = (listofObj *) NULL;
+ pick_devices[i].pathOrder = PEXTopPart;
+ pick_devices[i].inclusion = (diNSHandle) NULL;
+ pick_devices[i].exclusion = (diNSHandle) NULL;
+
+ if (!i)
+ MIWKS_PD_DATA_REC_1(&pick_devices[i]) = 0;
+ else
+ MIWKS_PD_DATA_REC_2(&pick_devices[i]) = 0;
+
+ pick_devices[i].pet = PEXEchoPrimitive;
+ pick_devices[i].echoVolume = viewportInit;
+ pick_devices[i].echoSwitch = PEXNoEcho;
+ }
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile
new file mode 100644
index 000000000..4bb11c1a7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile
@@ -0,0 +1,99 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/12 1996/09/28 16:54:42 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile,v 3.11 1999/07/04 06:38:31 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM or the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDdpexCDebugFlags
+#define PexDdpexCDebugFlags ServerCDebugFlags
+#endif
+
+XCOMM -D defines for ddpex:
+XCOMM DDTEST turns on some fprintf(stderr...)s for debugging
+XCOMM PEX_DEFAULT_FONTPATH defines the default path to PEX fonts
+
+ DEFINES = PexDdpexDefines
+EXT_DEFINES = ExtensionDefines
+CDEBUGFLAGS = PexDdpexCDebugFlags
+
+ PEXSERVINC = ../../../include
+DDPEXINCLUDE = ../include
+
+INCLUDES = -I. \
+ -I$(DDPEXINCLUDE) \
+ -I$(XINCLUDESRC) \
+ -I$(PEXSERVINC) \
+ -I$(SERVERSRC)/include
+
+SRCS = miFont.c \
+ miLUT.c \
+ miLineLUT.c \
+ miMarkLUT.c \
+ miTextLUT.c \
+ miEdgeLUT.c \
+ miIntLUT.c \
+ miPattLUT.c \
+ miFontLUT.c \
+ miViewLUT.c \
+ miColrLUT.c \
+ miClrApLUT.c \
+ miLightLUT.c \
+ miDCueLUT.c \
+ miNS.c \
+ miUtils.c \
+ miMisc.c
+
+OBJS = miFont.o \
+ miLUT.o \
+ miLineLUT.o \
+ miMarkLUT.o \
+ miTextLUT.o \
+ miEdgeLUT.o \
+ miIntLUT.o \
+ miPattLUT.o \
+ miFontLUT.o \
+ miViewLUT.o \
+ miColrLUT.o \
+ miClrApLUT.o \
+ miLightLUT.o \
+ miDCueLUT.o \
+ miNS.o \
+ miUtils.o \
+ miMisc.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ddpexs,$(OBJS))
+
+LintLibraryTarget(dps, $(SRCS))
+NormalLintTarget($(SRCS))
+
+SpecialCObjectRule(miMisc,$(ICONFIGFILES),$(EXT_DEFINES))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miClrApLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miClrApLUT.c
new file mode 100644
index 000000000..51aea512b
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miClrApLUT.c
@@ -0,0 +1,217 @@
+/* $TOG: miClrApLUT.c /main/3 1998/02/10 12:44:09 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miClrApLUT.c,v 1.7 1998/10/04 09:34:45 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXColourApproxLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddColourApproxEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miColourApproxEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexColourApproxEntry
+
+#define LUT_REND_DYN_BIT PEXDynColourApproxContents
+
+#define LUT_START_INDEX 0
+#define LUT_DEFAULT_INDEX 0
+#define LUT_0_DEFINABLE_ENTRIES 6
+#define LUT_0_NUM_PREDEFINED 0
+#define LUT_0_PREDEFINED_MIN 0
+#define LUT_0_PREDEFINED_MAX 0
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.colourApprox
+
+#define DYNAMIC COLOUR_APPROX_TABLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+/* there are no predefined entries, but define 1 entry for default */
+static DD_LUT_ENTRY_STR pdeColourApproxEntry[1];
+#define LUT_PDE_ENTRIES pdeColourApproxEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeColourApproxEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE ColourApproxLUT_free
+#define LUT_INQ_PREDEF ColourApproxLUT_inq_predef
+#define LUT_INQ_ENTRIES ColourApproxLUT_inq_entries
+*/
+#define LUT_COPY ColourApproxLUT_copy
+#define LUT_INQ_INFO ColourApproxLUT_inq_info
+#define LUT_INQ_IND ColourApproxLUT_inq_ind
+#define LUT_INQ_ENTRY ColourApproxLUT_inq_entry
+#define LUT_SET_ENTRIES ColourApproxLUT_set_entries
+#define LUT_DEL_ENTRIES ColourApproxLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS ColourApproxLUT_inq_entry_address
+#define LUT_CREATE ColourApproxLUT_create
+#define LUT_ENTRY_CHECK ColourApproxLUT_entry_check
+#define LUT_COPY_PEX_MI ColourApproxLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX ColourApproxLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK ColourApproxLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ if (pentry == NULL)
+ mibcopy(&(LUT_DEFAULT_VALUES), *ppbuf, sizeof(PEX_LUT_ENTRY_STR));
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ mibcopy(&(LUT_DEFAULT_VALUES), *ppbuf, sizeof(PEX_LUT_ENTRY_STR));
+ else
+ mibcopy(&pentry->entry, *ppbuf, sizeof(PEX_LUT_ENTRY_STR));
+
+ *ppbuf += sizeof(PEX_LUT_ENTRY_STR);
+
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ mibcopy(*ppsrc, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+ *ppsrc += sizeof(PEX_LUT_ENTRY_STR);
+
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ extern miEnumType miColourApproxTypeET[][SI_CLR_APPROX_TYPE_NUM];
+ extern miEnumType miColourApproxModelET[][SI_CLR_APPROX_MODEL_NUM];
+
+ if (((*ppPexEntry)->approxType < miColourApproxTypeET[pheader->drawType][0].index) ||
+ ((*ppPexEntry)->approxType > miColourApproxTypeET[pheader->drawType][SI_CLR_APPROX_TYPE_NUM - 1].index))
+ return(BadValue);
+ if (((*ppPexEntry)->approxModel < miColourApproxModelET[pheader->drawType][0].index) ||
+ ((*ppPexEntry)->approxModel > miColourApproxModelET[pheader->drawType][SI_CLR_APPROX_MODEL_NUM - 1].index))
+ return(BadValue);
+ if (((*ppPexEntry)->dither != PEXOff) && ((*ppPexEntry)->dither != PEXOn))
+ return(BadValue);
+
+ (*ppPexEntry)++;
+ return(Success);
+}
+
+void
+ColourApproxLUT_init_pde()
+{
+ /* Having default values for this makes absolutely no sense.
+ * There is no way for this to know what colors are defined in
+ * the coloramp, and therefor no way to know how to map to them.
+ * This is provided only because something has to be done, but
+ * the likelyhood of this turning out correct colors is small.
+ * The client side MUST set at least one entry in this table
+ * for correct functionality.
+ * These are the sample values in the protocol spec.
+ * They assume a 6x6x6 color cube beginning at location 16.
+ */
+ pdeColourApproxEntry [0].approxType = PEXColourSpace;
+ pdeColourApproxEntry [0].approxModel = PEXColourApproxRGB;
+ pdeColourApproxEntry [0].max1 = 5;
+ pdeColourApproxEntry [0].max2 = 5;
+ pdeColourApproxEntry [0].max3 = 5;
+ pdeColourApproxEntry [0].dither = PEXOff;
+ pdeColourApproxEntry [0].mult1 = 1;
+ pdeColourApproxEntry [0].mult2 = 6;
+ pdeColourApproxEntry [0].mult3 = 36;
+ pdeColourApproxEntry [0].weight1 = 1.0;
+ pdeColourApproxEntry [0].weight2 = 1.0;
+ pdeColourApproxEntry [0].weight3 = 1.0;
+ pdeColourApproxEntry [0].basePixel = 16;
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miColrLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miColrLUT.c
new file mode 100644
index 000000000..fb8a06ee1
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miColrLUT.c
@@ -0,0 +1,295 @@
+/* $TOG: miColrLUT.c /main/3 1998/02/10 12:44:13 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miColrLUT.c,v 1.7 1998/10/04 09:34:46 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXColourLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddColourSpecifier
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miColourEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexColourSpecifier
+
+#define LUT_REND_DYN_BIT PEXDynColourTableContents
+
+#define LUT_START_INDEX 0
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 256
+#define LUT_0_NUM_PREDEFINED 8
+#define LUT_0_PREDEFINED_MIN 0
+#define LUT_0_PREDEFINED_MAX 7
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.colour
+
+#define DYNAMIC COLOUR_TABLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeColourEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeColourEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry);
+
+/* predefined entry 1 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 1
+#define LUT_DEFAULT_VALUES pdeColourEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE ColourLUT_free
+#define LUT_INQ_PREDEF ColourLUT_inq_predef
+#define LUT_INQ_ENTRIES ColourLUT_inq_entries
+*/
+#define LUT_COPY ColourLUT_copy
+#define LUT_INQ_INFO ColourLUT_inq_info
+#define LUT_INQ_IND ColourLUT_inq_ind
+#define LUT_INQ_ENTRY ColourLUT_inq_entry
+#define LUT_SET_ENTRIES ColourLUT_set_entries
+#define LUT_DEL_ENTRIES ColourLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS ColourLUT_inq_entry_address
+#define LUT_CREATE ColourLUT_create
+#define LUT_ENTRY_CHECK ColourLUT_entry_check
+#define LUT_COPY_PEX_MI ColourLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX ColourLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK ColourLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->colour, pb, pdev_entry->colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ pentry->entry.colourType = ((PEX_LUT_ENTRY_STR *)ps)->colourType;
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.colour), pentry->entry.colourType);
+
+ ps += colour_type_sizes[(int)pentry->entry.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+
+void
+ColourLUT_init_pde()
+{
+ /* black */
+ pdeColourEntry[0].colourType = PEXRgbFloatColour;
+ pdeColourEntry[0].colour.rgbFloat.red = 0.0;
+ pdeColourEntry[0].colour.rgbFloat.green = 0.0;
+ pdeColourEntry[0].colour.rgbFloat.blue = 0.0;
+ /* white */
+ pdeColourEntry[1].colourType = PEXRgbFloatColour;
+ pdeColourEntry[1].colour.rgbFloat.red = 1.0;
+ pdeColourEntry[1].colour.rgbFloat.green = 1.0;
+ pdeColourEntry[1].colour.rgbFloat.blue = 1.0;
+ /* red */
+ pdeColourEntry[2].colourType = PEXRgbFloatColour;
+ pdeColourEntry[2].colour.rgbFloat.red = 1.0;
+ pdeColourEntry[2].colour.rgbFloat.green = 0.0;
+ pdeColourEntry[2].colour.rgbFloat.blue = 0.0;
+ /* green */
+ pdeColourEntry[3].colourType = PEXRgbFloatColour;
+ pdeColourEntry[3].colour.rgbFloat.red = 0.0;
+ pdeColourEntry[3].colour.rgbFloat.green = 1.0;
+ pdeColourEntry[3].colour.rgbFloat.blue = 0.0;
+ /* blue */
+ pdeColourEntry[4].colourType = PEXRgbFloatColour;
+ pdeColourEntry[4].colour.rgbFloat.red = 0.0;
+ pdeColourEntry[4].colour.rgbFloat.green = 0.0;
+ pdeColourEntry[4].colour.rgbFloat.blue = 1.0;
+ /* yellow */
+ pdeColourEntry[5].colourType = PEXRgbFloatColour;
+ pdeColourEntry[5].colour.rgbFloat.red = 1.0;
+ pdeColourEntry[5].colour.rgbFloat.green = 1.0;
+ pdeColourEntry[5].colour.rgbFloat.blue = 0.0;
+ /* cyan */
+ pdeColourEntry[6].colourType = PEXRgbFloatColour;
+ pdeColourEntry[6].colour.rgbFloat.red = 0.0;
+ pdeColourEntry[6].colour.rgbFloat.green = 1.0;
+ pdeColourEntry[6].colour.rgbFloat.blue = 1.0;
+ /* magenta */
+ pdeColourEntry[7].colourType = PEXRgbFloatColour;
+ pdeColourEntry[7].colour.rgbFloat.red = 1.0;
+ pdeColourEntry[7].colour.rgbFloat.green = 0.0;
+ pdeColourEntry[7].colour.rgbFloat.blue = 1.0;
+}
+
+#include "miLUTProcs.ci"
+
+/* utility proc used to get highlight colour
+ * the highlight colour is the last entry in
+ * the table, i.e. the one with the highest index
+ */
+void
+inq_last_colour_entry( pLUT, pColour )
+ diLUTHandle pLUT;
+ ddColourSpecifier *pColour;
+{
+ miLUTHeader *pheader;
+ ddTableIndex high_index = 0;
+ ddColourSpecifier *high_entry = (ddColourSpecifier *)NULL;
+ miColourEntry *pEntry;
+ register int i;
+
+ if (pLUT)
+ {
+ pheader = MILUT_HEADER(pLUT);
+ /* since this supports sparse tables,
+ * we don't know which entry is the last one.
+ * so, we have to do a search. a linear search
+ * is done. this should be optimized if the table
+ * is very large.
+ */
+ for (i = 0, pEntry = pheader->plut.colour;
+ i < MILUT_ALLOC_ENTS(pheader); i++, pEntry++)
+ {
+ if (pEntry->entry_info.status != MILUT_UNDEFINED)
+ if (pEntry->entry_info.index > high_index)
+ {
+ high_index = pEntry->entry_info.index;
+ high_entry = &pEntry->entry;
+ }
+ }
+ }
+ if (high_entry)
+ *pColour = *high_entry;
+ else
+ {
+ /* hot pink */
+ pColour->colourType = PEXRgbFloatColour;
+ pColour->colour.rgbFloat.red = 1.0;
+ pColour->colour.rgbFloat.green = 0.41;
+ pColour->colour.rgbFloat.blue = 0.71;
+ }
+ return;
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miDCueLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miDCueLUT.c
new file mode 100644
index 000000000..4f9a00e81
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miDCueLUT.c
@@ -0,0 +1,232 @@
+/* $TOG: miDCueLUT.c /main/3 1998/02/10 12:44:18 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miDCueLUT.c,v 1.7 1998/10/04 09:34:46 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXDepthCueLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddDepthCueEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miDepthCueEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexDepthCueEntry
+
+#define LUT_REND_DYN_BIT PEXDynDepthCueTableContents
+
+#define LUT_START_INDEX 0
+#define LUT_DEFAULT_INDEX 0
+#define LUT_0_DEFINABLE_ENTRIES 6
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 0
+#define LUT_0_PREDEFINED_MAX 0
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.depthCue
+
+#define DYNAMIC DEPTH_CUE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeDepthCueEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeDepthCueEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeDepthCueEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE DepthCueLUT_free
+#define LUT_INQ_PREDEF DepthCueLUT_inq_predef
+#define LUT_INQ_ENTRIES DepthCueLUT_inq_entries
+*/
+#define LUT_COPY DepthCueLUT_copy
+#define LUT_INQ_INFO DepthCueLUT_inq_info
+#define LUT_INQ_IND DepthCueLUT_inq_ind
+#define LUT_INQ_ENTRY DepthCueLUT_inq_entry
+#define LUT_SET_ENTRIES DepthCueLUT_set_entries
+#define LUT_DEL_ENTRIES DepthCueLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS DepthCueLUT_inq_entry_address
+#define LUT_CREATE DepthCueLUT_create
+#define LUT_ENTRY_CHECK DepthCueLUT_entry_check
+#define LUT_COPY_PEX_MI DepthCueLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX DepthCueLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK DepthCueLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ DD_LUT_ENTRY_STR *pdev_entry;
+ ddPointer pb = *ppbuf;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->depthCueColour.colour,
+ pb, pdev_entry->depthCueColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->depthCueColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.depthCueColour.colour),
+ pentry->entry.depthCueColour.colourType);
+
+ ps += colour_type_sizes[(int)pentry->entry.depthCueColour.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* mode: Off or On */
+ if (((*ppPexEntry)->mode != PEXOff) && ((*ppPexEntry)->mode != PEXOn))
+ return(BadValue);
+ /* frontPlane: must be in NPC */
+ if (((*ppPexEntry)->frontPlane < 0.0) || ((*ppPexEntry)->frontPlane > 1.0))
+ return(BadValue);
+ /* backPlane: must be in NPC */
+ if (((*ppPexEntry)->backPlane < 0.0) || ((*ppPexEntry)->backPlane > 1.0))
+ return(BadValue);
+ /* frontScaling: must be in NPC */
+ if (((*ppPexEntry)->frontScaling < 0.0) || ((*ppPexEntry)->frontScaling > 1.0))
+ return(BadValue);
+ /* backScaling: must be in NPC */
+ if (((*ppPexEntry)->backScaling < 0.0) || ((*ppPexEntry)->backScaling > 1.0))
+ return(BadValue);
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->depthCueColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->depthCueColour.colourType];
+
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+
+void
+DepthCueLUT_init_pde()
+{
+ pdeDepthCueEntry[0].mode = PEXOff;
+ pdeDepthCueEntry[0].frontPlane = 1.0;
+ pdeDepthCueEntry[0].backPlane = 0.0;
+ pdeDepthCueEntry[0].frontScaling = 1.0;
+ pdeDepthCueEntry[0].backScaling = 0.5;
+ MILUT_INIT_COLOUR(pdeDepthCueEntry[0].depthCueColour);
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miEdgeLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miEdgeLUT.c
new file mode 100644
index 000000000..d3163a41c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miEdgeLUT.c
@@ -0,0 +1,263 @@
+/* $TOG: miEdgeLUT.c /main/3 1998/02/10 12:44:22 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miEdgeLUT.c,v 1.7 1998/10/04 09:34:47 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXEdgeBundleLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddEdgeBundleEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miEdgeBundleEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexEdgeBundleEntry
+
+#define LUT_REND_DYN_BIT PEXDynEdgeBundleContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 20
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.edge
+
+#define DYNAMIC EDGE_BUNDLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+static DD_LUT_ENTRY_STR pdeEdgeBundleEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeEdgeBundleEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->real_entry = *(pdeentry)
+
+
+/* predefined entry 0 is set to the default values */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeEdgeBundleEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ (pentry)->real_entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE EdgeBundleLUT_free
+#define LUT_INQ_PREDEF EdgeBundleLUT_inq_predef
+#define LUT_INQ_ENTRIES EdgeBundleLUT_inq_entries
+*/
+#define LUT_COPY EdgeBundleLUT_copy
+#define LUT_INQ_INFO EdgeBundleLUT_inq_info
+#define LUT_INQ_IND EdgeBundleLUT_inq_ind
+#define LUT_INQ_ENTRY EdgeBundleLUT_inq_entry
+#define LUT_SET_ENTRIES EdgeBundleLUT_set_entries
+#define LUT_DEL_ENTRIES EdgeBundleLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS EdgeBundleLUT_inq_entry_address
+#define LUT_CREATE EdgeBundleLUT_create
+#define LUT_ENTRY_CHECK EdgeBundleLUT_entry_check
+#define LUT_COPY_PEX_MI EdgeBundleLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX EdgeBundleLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK EdgeBundleLUT_mod_call_back
+#define LUT_REALIZE_ENTRY EdgeBundleLUT_realize_entry
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ if (valueType == PEXRealizedValue)
+ pdev_entry = &pentry->real_entry;
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->edgeColour.colour,
+ pb, pdev_entry->edgeColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->edgeColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.edgeColour.colour),
+ pentry->entry.edgeColour.colourType);
+
+ LUT_REALIZE_ENTRY( pheader, pentry );
+
+ ps += colour_type_sizes[(int)pentry->entry.edgeColour.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* edges: PEXOff or PEXOn */
+ if (((*ppPexEntry)->edges != PEXOff) && ((*ppPexEntry)->edges != PEXOn))
+ return(BadValue);
+
+ /* edgeType: any value OK. use edge type 1 if it's not supported */
+ /* edgeWidth: any value is OK, it is used as a scale */
+
+ /* colours only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->edgeColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->edgeColour.colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+/* realize entry */
+ddpex43rtn
+LUT_REALIZE_ENTRY( pheader, pEntry )
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pEntry;
+{
+ extern miEnumType miSurfaceEdgeTypeET[][SI_EDGE_NUM];
+
+ /* edges: PEXOff or PEXOn */
+ pEntry->real_entry.edges = pEntry->entry.edges;
+
+ /* edgeType: any value OK. use edge type 1 if it's not supported */
+ if ( (pEntry->entry.edgeType <
+ miSurfaceEdgeTypeET[pheader->drawType][0].index) ||
+ (pEntry->entry.edgeType >
+ miSurfaceEdgeTypeET[pheader->drawType][SI_EDGE_NUM - 1].index) )
+ pEntry->real_entry.edgeType = 1;
+ else
+ pEntry->real_entry.edgeType = pEntry->entry.edgeType;
+
+ /* edgeWidth: any value is OK, it is multiplied by the nomimal
+ * edge width and the nearest supported size is used
+ * The realized value is the scale for inquiry, not the size
+ */
+ pEntry->real_entry.edgeWidth = pEntry->entry.edgeWidth;
+
+ /* colourType: its an error if an unsupported colour type was
+ * specified. For supported colour types, should mapped colour
+ * be returned??
+ */
+ pEntry->real_entry.edgeColour = pEntry->entry.edgeColour;
+
+}
+
+void
+EdgeBundleLUT_init_pde()
+{
+ pdeEdgeBundleEntry[0].edges = PEXOff;
+ pdeEdgeBundleEntry[0].edgeType = PEXSurfaceEdgeSolid;
+ pdeEdgeBundleEntry[0].edgeWidth = 1.0;
+ MILUT_INIT_COLOUR(pdeEdgeBundleEntry[0].edgeColour);
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFont.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFont.c
new file mode 100644
index 000000000..b24eab108
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFont.c
@@ -0,0 +1,888 @@
+/* $TOG: miFont.c /main/8 1998/02/10 12:44:26 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miFont.c,v 3.5 1998/10/04 09:34:47 dawes Exp $ */
+
+#include "miFont.h"
+#include "miLUT.h"
+#include "miWks.h"
+#include "PEX.h"
+#include "PEXErr.h"
+#include "pexExtract.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+extern void CopyISOLatin1Lowered();
+extern ErrorCode LoadPEXFontFile();
+extern int pex_get_matching_names();
+
+extern diFontHandle defaultPEXFont;
+
+/* Level 4/3 Shared Resources */
+/* PEX Font Procedures */
+
+/* get_lowered_truncated_entry takes a directory entry, strips off the .phont
+ * suffix, and puts in all in lower case ISO Latin 1. If the entry doesn't
+ * have a .phont suffix, 0 is returned.
+ */
+int
+get_lowered_truncated_entry(before, after)
+char *before; /* in */
+char *after; /* out */
+{
+ char *suffix_ptr;
+
+ suffix_ptr = before + strlen(before) - strlen(".phont");
+ if (strncmp(suffix_ptr, ".phont", strlen(".phont")) != 0)
+ return 0;
+
+ CopyISOLatin1Lowered((unsigned char *)after, (unsigned char *)before,
+ strlen(before) - strlen(".phont"));
+
+ return 1;
+}
+
+/*++
+ |
+ | Function Name: OpenPEXFont
+ |
+ | Function Description:
+ | Handles the PEXOpenFont request.
+ |
+ --*/
+ddpex43rtn
+OpenPEXFont(strLen, pName, pFont)
+/* in */
+ ddULONG strLen; /* length of name */
+ ddUCHAR *pName; /* font name */
+ diFontHandle pFont; /* font handle - we fill in device_data */
+/* out */
+{
+ miFontHeader *font;
+ register int i;
+ Ch_stroke_data **ch_data;
+ ddpex43rtn err = Success;
+
+ font = (miFontHeader *)xalloc((unsigned long)(sizeof(miFontHeader)));
+ if (font == NULL) return (BadAlloc);
+ pFont->deviceData = (ddPointer)font;
+ font->lutRefCount = 0;
+ font->freeFlag = MI_FALSE;
+ font->properties = 0;
+ font->font_info.numProps = 0;
+ font->ch_data = 0;
+ font->num_ch = 0;
+ font->top = 0.0;
+ font->bottom = 0.0;
+ font->max_width = 0.0;
+
+ err = LoadPEXFontFile(strLen, pName, pFont);
+ if (err != Success) {
+ xfree(font);
+ return (err); }
+
+ /*
+ * Now, make a pass from the first glyph to the last glyph, seeing if
+ * all are defined.
+ */
+ font->font_info.allExist = 1;
+ ch_data = font->ch_data + font->font_info.firstGlyph;
+ for ( i = font->font_info.firstGlyph;
+ i < font->num_ch && font->font_info.allExist;
+ i++, ch_data++ )
+ if (*ch_data == NULL || (*ch_data)->strokes.numLists <= 0) {
+ font->font_info.allExist = 0;
+ break; }
+
+
+ /* For now, let the default glyph be an asterisk */
+ font->font_info.defaultGlyph = (CARD16)'*';
+
+ /* It's a stroke font */
+ font->font_info.strokeFont = 1;
+
+ return (Success);
+
+} /* OpenPEXFont */
+
+/*++
+ |
+ | Function Name: FreePEXFont
+ |
+ | Function Description:
+ | Deletes all storage used by the font.
+ |
+ --*/
+static void
+really_free_font(pFont)
+ diFontHandle pFont; /* font handle */
+{
+ miFontHeader *font = (miFontHeader *) pFont->deviceData;
+ register Ch_stroke_data **ch_data, *firstChar = 0;
+ int j;
+
+ if (font->properties)
+ xfree((char *) font->properties);
+
+ if (font->ch_data) {
+ for (j = 0, ch_data = font->ch_data; j < font->num_ch; j++, ch_data++) {
+ if (*ch_data != NULL) {
+ MI_FREELISTHEADER(&((*ch_data)->strokes));
+ if (!firstChar) firstChar = *ch_data; } }
+
+ xfree((char *) (firstChar));
+ xfree((char *) (font->ch_data));
+ }
+
+ xfree((char *) font);
+ xfree((char *) pFont);
+
+}
+
+
+ddpex43rtn
+FreePEXFont(pFont, Fid)
+/* in */
+ diFontHandle pFont; /* font handle */
+ ddResourceId Fid; /* font resource id */
+/* out */
+{
+ miFontHeader *font = (miFontHeader *) pFont->deviceData;
+
+ if (pFont == defaultPEXFont) return (Success);
+
+ font->freeFlag = MI_TRUE;
+ pFont->id = PEXAlreadyFreed;
+
+ if (font->lutRefCount == 0)
+ really_free_font(pFont);
+
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: QueryPEXFont
+ |
+ | Function Description:
+ | Handles the PEXQueryFont request.
+ |
+ | Input Description:
+ | diFontHandle pFont; font handle
+ |
+ | Output Description:
+ | ddBufferPtr pBuffer; buffer with fontinfo
+ |
+ --*/
+ddpex43rtn
+QueryPEXFont(pFont, pBuffer)
+ diFontHandle pFont; /* font handle */
+ ddBufferPtr pBuffer; /* font info */
+{
+ miFontHeader *font = (miFontHeader *)pFont->deviceData;
+ ddPointer pbuf;
+ ddULONG data_size;
+
+ data_size = sizeof(pexFontInfo) +
+ font->font_info.numProps * sizeof(pexFontProp);
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, data_size);
+ pbuf = pBuffer->pBuf;
+
+ /* copy actual font info into buffer */
+ memcpy( (char *)pbuf, (char *)&(font->font_info), sizeof(pexFontInfo));
+ pbuf += sizeof(pexFontInfo);
+
+ /* copy property info into buffer */
+ if (font->font_info.numProps > 0)
+ PACK_LISTOF_STRUCT( font->font_info.numProps, pexFontProp,
+ font->properties, pbuf);
+
+ pBuffer->dataSize = data_size;
+
+ return (Success);
+
+} /* QueryPEXFont */
+
+/*++
+ |
+ | Function Name: ListPEXFonts
+ |
+ | Function Description:
+ | Handles the PEXListFonts request.
+ |
+ --*/
+ddpex43rtn
+ListPEXFonts(patLen, pPattern, maxNames, pNumNames, pBuffer)
+/* in */
+ ddUSHORT patLen; /* number of chars in pattern */
+ ddUCHAR *pPattern; /* pattern */
+ ddUSHORT maxNames; /* maximum number of names to return */
+/* out */
+ ddULONG *pNumNames;/* number of names in reply */
+ ddBufferPtr pBuffer; /* list of names */
+{
+
+ ddPointer pbuf;
+ ddULONG total_space, n;
+ char **names; /* a list of strings */
+ CARD16 *valCARD16;
+ int i;
+
+ if (!pex_get_matching_names(patLen, pPattern, maxNames, &n, &names))
+ return (BadAlloc);
+
+ /* figure out how much space is needed by these strings */
+ total_space = 0;
+ for (i = 0; i < n; i++) {
+ total_space += 2 + strlen(names[i]) + PADDING(2 + strlen(names[i]));
+ }
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, total_space);
+
+ pbuf = pBuffer->pBuf;
+ for (i = 0; i < n; i++) {
+ valCARD16 = (CARD16 *)pbuf;
+ *valCARD16 = strlen(names[i]);
+ pbuf += sizeof(CARD16);
+ memcpy( (char *)pbuf, names[i], (int)(strlen(names[i])));
+ pbuf += strlen(names[i]) + PADDING(2 + strlen(names[i]));
+ xfree(names[i]);
+ }
+ xfree(names);
+
+ *pNumNames = n;
+ pBuffer->dataSize = total_space;
+ return (Success);
+}
+
+/*++
+ |
+ | Function Name: ListPEXFontsPlus
+ |
+ | Function Description:
+ | Handles the PEXListFontsWithInfo request.
+ |
+ --*/
+
+/* we don't ever expect to have more than this number of properties per font
+ but let's not create any bugs we don't have to, so this is just a
+ guestimate, not an enforced maximum
+*/
+#define EST_MAX_FONT_PROPS 10
+
+ddpex43rtn
+ListPEXFontsPlus(patLen, pPattern, maxNames, pNumNames, pBuffer)
+/* in */
+ ddUSHORT patLen; /* number of chars in pattern */
+ ddUCHAR *pPattern; /* pattern */
+ ddUSHORT maxNames; /* maximum number of names to return */
+/* out */
+ ddULONG *pNumNames;/* number of names in reply */
+ ddBufferPtr pBuffer; /* font names and info */
+{
+
+ ddPointer pBuf;
+ ddULONG guess_size = 0, n;
+ char **names; /* a list of strings */
+ int i, j, len;
+ ddpex43rtn err = Success;
+ ddFontResource ddFont;
+ miFontHeader fontData;
+ Ch_stroke_data **ch_data;
+
+ /* lookup names */
+ if (!pex_get_matching_names(patLen, pPattern, maxNames, &n, &names))
+ return (BadAlloc);
+
+ /* guess at a large number of bytes for the reply, and make sure
+ we have this many (can always realloc later) */
+ for (i=0; i<n; i++)
+ guess_size += (strlen(names[i]) + 4);
+ guess_size += (sizeof(CARD32) + (n * sizeof(pexFontInfo)));
+ guess_size += (n * EST_MAX_FONT_PROPS * sizeof(pexFontProp));
+ if (PU_BUF_TOO_SMALL(pBuffer, guess_size))
+ if (puBuffRealloc(pBuffer, guess_size) != Success) goto free_names;
+
+ /* write names into reply buffer */
+ pBuf = pBuffer->pBuf;
+ pBuffer->dataSize = 0;
+ for (i = 0; i < n; i++) {
+ len = strlen(names[i]);
+ PACK_CARD16(len, pBuf);
+ PACK_LISTOF_STRUCT(len, CARD8, names[i], pBuf);
+ SKIP_PADDING(pBuf, PADDING(sizeof(CARD16) + len));
+ pBuffer->dataSize += sizeof(CARD16) + len +
+ PADDING(sizeof(CARD16) + len);
+ }
+
+
+ /* read in the font info, write it into the reply buffer */
+ ddFont.deviceData = (ddPointer)&(fontData);
+ fontData.properties = 0;
+ PACK_CARD32(n, pBuf);
+ pBuffer->dataSize += sizeof(CARD32);
+ for (i = 0; i < n; i++) {
+
+ err = LoadPEXFontFile( (ddULONG)(strlen(names[i])),
+ (ddUCHAR *)(names[i]),
+ (diFontHandle)&ddFont);
+ if (err) goto free_names;
+
+ pBuffer->dataSize += sizeof(pexFontInfo)
+ + sizeof(pexFontProp) * fontData.font_info.numProps;
+ if (PU_BUF_TOO_SMALL(pBuffer, pBuffer->dataSize))
+ if (puBuffRealloc(pBuffer, pBuffer->dataSize) != Success)
+ goto free_names;
+
+ /*
+ * Now, make a pass from the first glyph to the last glyph, seeing if
+ * all are defined.
+ */
+ fontData.font_info.allExist = 1;
+ ch_data = fontData.ch_data + fontData.font_info.firstGlyph;
+ for (j = fontData.font_info.firstGlyph;
+ j < fontData.num_ch && fontData.font_info.allExist;
+ j++, ch_data++ )
+ if (*ch_data == NULL || (*ch_data)->strokes.numLists <= 0) {
+ fontData.font_info.allExist = 0;
+ break; }
+
+ /* For now, let the default glyph be an asterisk */
+ fontData.font_info.defaultGlyph = (CARD16)'*';
+
+ /* It's a stroke font */
+ fontData.font_info.strokeFont = 1;
+
+ PACK_STRUCT(pexFontInfo, &(fontData.font_info), pBuf);
+ if (fontData.font_info.numProps > 0) {
+ PACK_LISTOF_STRUCT( fontData.font_info.numProps, pexFontProp,
+ fontData.properties, pBuf);
+ xfree(fontData.properties);
+ fontData.properties = 0; }
+
+ if (fontData.ch_data) {
+ for ( j=0, ch_data = fontData.ch_data;
+ j< fontData.num_ch;
+ j++, ch_data++) {
+ if (*ch_data) {
+ MI_FREELISTHEADER(& ((*ch_data)->strokes));
+ xfree((char *)(*ch_data)); } }
+ xfree((char *) (fontData.ch_data)); }
+
+ xfree(names[i]);
+ }
+
+ xfree(names);
+
+ *pNumNames = n;
+ pBuffer->pBuf = pBuf;
+ return (Success);
+
+free_names:
+ for (i = 0; i < n; i++) xfree(names[i]);
+ xfree(names);
+ pBuffer->dataSize = 0;
+ if (err) return(err);
+ return(BadAlloc);
+} /* ListPEXFontsPlus */
+
+/*
+ * Given the extremes of all of the character sets used in composing
+ * an ISTRING, and given the extremes of the ISTRING itself, along
+ * with path, expansion and alignment, calculate the correct
+ * concatenation point and alignment point. The updated extreme values
+ * are returned.
+ */
+void
+micalc_cpt_and_align(meta_font, extent_xmin, extent_xmax,
+ extent_ymin, extent_ymax, path, exp, pAlignment, cpt, align)
+Meta_font *meta_font;
+float *extent_xmin, *extent_xmax;
+float *extent_ymin, *extent_ymax;
+ddUSHORT path;
+ddTextAlignmentData *pAlignment;
+ddFLOAT exp;
+register pexCoord2D *cpt;
+register pexCoord2D *align;
+{
+
+ register float xmin = *extent_xmin,
+ xmax = *extent_xmax,
+ ymin = *extent_ymin,
+ ymax = *extent_ymax;
+ pexCoord2D temp;
+
+ /* some of the necessary info may not be calculated yet */
+ switch (path) {
+ case PEXPathRight:
+ if (xmin < 0) {
+ temp.x = xmax;
+ xmax = xmin;
+ xmin = temp.x;
+ }
+ cpt->x = xmax;
+ ymin = meta_font->bottom;
+ ymax = meta_font->top;
+ break;
+
+ case PEXPathLeft:
+ if (xmax <= 0.0)
+ cpt->x = xmin;
+ else
+ cpt->x = xmax;
+ ymin = meta_font->bottom;
+ ymax = meta_font->top;
+ break;
+
+ case PEXPathUp:
+ if (ymin < 0.0) {
+ temp.y = ymax;
+ ymax = ymin + meta_font->bottom;
+ ymin = temp.y + meta_font->bottom;
+ } else {
+ ymin = meta_font->bottom;
+ ymax += meta_font->bottom;
+ }
+ cpt->y = ymax;
+ xmax = meta_font->width * 0.5 * exp;
+ xmin = - xmax;
+ break;
+
+ case PEXPathDown:
+ if (ymax > 0.0) {
+ temp.y = ymax;
+ ymax = ymin;
+ ymin = temp.y;
+ } else {
+ ymin += meta_font->top;
+ ymax = meta_font->top;
+ }
+ cpt->y = ymin;
+ xmax = meta_font->width * 0.5 * exp;
+ xmin = - xmax;
+ break;
+ }
+
+ /* now do the vertical stuff */
+ switch (path) {
+
+ case PEXPathRight :
+ case PEXPathLeft :
+
+ switch (pAlignment->vertical) {
+ case PEXValignNormal :
+ case PEXValignBase :
+ cpt->y = 0.0;
+ align->y = ymin - meta_font->bottom;
+ break;
+ case PEXValignBottom :
+ cpt->y = align->y = ymin;
+ break;
+ case PEXValignTop :
+ cpt->y = align->y = ymax;
+ break;
+ case PEXValignCap :
+ cpt->y = FONT_COORD_CAP;
+ align->y = ymax - (meta_font->top - FONT_COORD_CAP);
+ break;
+ case PEXValignHalf :
+ cpt->y = align->y = FONT_COORD_HALF;
+ break;
+ }
+
+ break;
+
+ case PEXPathUp :
+ case PEXPathDown :
+ switch (pAlignment->vertical) {
+
+ case PEXValignBase :
+ align->y = ymin - meta_font->bottom;
+ break;
+ case PEXValignBottom :
+ align->y = ymin;
+ break;
+ case PEXValignTop :
+ align->y = ymax;
+ break;
+ case PEXValignCap :
+ align->y = ymax - (meta_font->top - FONT_COORD_CAP);
+ break;
+ case PEXValignHalf :
+ align->y = FONT_COORD_HALF + 0.5*(ymin - meta_font->bottom);
+ break;
+
+ case PEXValignNormal :
+ if (path == PEXPathUp) {
+ /* for PathUp, NORMAL == BASE */
+ align->y = ymin - meta_font->bottom;
+ } else { /* path == PEXPathDown */
+ align->y = ymax;
+ }
+ break;
+ }
+
+ break;
+ }
+
+ /* now do the horizontal stuff */
+ switch (path) {
+
+ case PEXPathRight:
+
+ switch (pAlignment->horizontal) {
+ case PEXHalignNormal :
+ case PEXHalignLeft :
+ align->x = xmin;
+ break;
+ case PEXHalignCenter :
+ align->x = 0.5 * (xmin + xmax);
+ break;
+ case PEXHalignRight :
+ align->x = xmax;
+ break;
+ }
+ break;
+
+ case PEXPathLeft:
+
+ switch (pAlignment->horizontal) {
+ case PEXHalignLeft :
+ if (xmax <= 0.0)
+ align->x = xmin;
+ else
+ align->x = xmax + xmin;
+ break;
+
+ case PEXHalignCenter :
+ align->x = 0.5 * (xmin + xmax);
+ break;
+
+ case PEXHalignNormal :
+ case PEXHalignRight :
+ align->x = (xmax > 0.0 ? 0.0 : xmax);
+ break;
+ }
+ break;
+
+ case PEXPathUp:
+ case PEXPathDown:
+
+ switch (pAlignment->horizontal) {
+ case PEXHalignLeft :
+ align->x = cpt->x = xmin;
+ break;
+ case PEXHalignNormal :
+ case PEXHalignCenter :
+ align->x = cpt->x = 0.5 * (xmin + xmax);
+ break;
+ case PEXHalignRight :
+ align->x = cpt->x = xmax;
+ break;
+ }
+ break;
+
+ }
+
+ *extent_xmin = xmin;
+ *extent_xmax = xmax;
+ *extent_ymin = ymin;
+ *extent_ymax = ymax;
+}
+
+
+
+/*++
+ |
+ | Function Name: QueryPEXTextExtents
+ |
+ | Function Description:
+ | Handles the PEXQueryTextExtents request.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex43rtn
+QueryPEXTextExtents(resource, resourceType, fontIndex, path, expansion,
+ spacing, height, pAlignment, numStrings, pStrings, pBuffer)
+/* in */
+ ddPointer resource; /* what it is depends on next arg */
+ ddResourceType resourceType; /* renderer, wks, or lut */
+ ddUSHORT fontIndex; /* index into font table */
+ ddUSHORT path; /* text path */
+ ddFLOAT expansion; /* character expansion */
+ ddFLOAT spacing; /* character spacing */
+ ddFLOAT height; /* character height */
+ ddTextAlignmentData *pAlignment; /* text alignment */
+ ddULONG numStrings; /* num strings */
+ ddPointer pStrings; /* list of ISTRINGS */
+/* out */
+ ddBufferPtr pBuffer; /* extent info */
+{
+ diLUTHandle fontTable;
+ register ddPointer ptr;
+ pexMonoEncoding *mono_enc;
+ int i, fragnum, charnum, some_characters, signum;
+ CARD32 numFragments, charval;
+ diFontHandle font_handle;
+ miFontHeader *font;
+ pexExtentInfo *extent;
+ Ch_stroke_data *char_data;
+ ddFLOAT sp = spacing * FONT_COORD_HEIGHT;
+ Meta_font meta_font;
+ pexCoord2D cur, end, cpt, align;
+ float xmin, xmax, ymin, ymax;
+ float ht_scale = height / FONT_COORD_HEIGHT;
+ extern unsigned long PEXFontType;
+ miTextFontEntry *miFontTable;
+ ddTextFontEntry *fontEntry;
+ ddpex43rtn err;
+ ddUSHORT status;
+
+ switch (resourceType) {
+ case WORKSTATION_RESOURCE : {
+ miWksPtr pwks = (miWksPtr)(((diWKSHandle)resource)->deviceData);
+ fontTable = pwks->pRend->lut[PEXTextFontLUT];
+ break;
+
+ case LOOKUP_TABLE_RESOURCE :
+ fontTable = (diLUTHandle )resource;
+ if (fontTable->lutType != PEXTextFontLUT) return (BadMatch);
+ break;
+
+ case RENDERER_RESOURCE :
+ fontTable = ((ddRendererPtr )resource)->lut[PEXTextFontLUT];
+ break;
+
+ default: return(BadValue);
+ }
+
+ }
+
+
+ /* get ddTextFontEntry member */
+ err = InquireLUTEntryAddress( PEXTextFontLUT, fontTable, fontIndex,
+ &status, (ddPointer *)(&miFontTable));
+ if (err != Success) return(err);
+ fontEntry = &miFontTable->entry;
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, numStrings * sizeof(pexExtentInfo));
+ pBuffer->dataSize = numStrings * sizeof(pexExtentInfo);
+
+
+ /* signum is used later on to encapsulate addition vs. subtraction */
+ if (path == PEXPathRight || path == PEXPathUp)
+ signum = 1;
+ else
+ signum = -1;
+
+ ptr = pStrings;
+ extent = (pexExtentInfo *)pBuffer->pBuf;
+
+ /* for each ISTRING */
+ for (i = 0; i < numStrings; i++, extent++) {
+
+ meta_font.top = -1.0e20;
+ meta_font.bottom = 1.0e20;
+ meta_font.width = 1.0e-20;
+
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = 0.0;
+ cur.x = end.x = cur.y = end.y = 0.0;
+
+ some_characters = 0; /* make TRUE when a valid character is found */
+
+ numFragments = *(CARD32 *)ptr;
+ ptr += sizeof(CARD32);
+
+ /* for each MONO_ENCODING fragment within the ISTRING */
+ for (fragnum = 0; fragnum < numFragments; fragnum++) {
+
+ mono_enc = (pexMonoEncoding *)ptr;
+ ptr += sizeof(pexMonoEncoding);
+
+ if (mono_enc->characterSet < 1 ||
+ mono_enc->characterSet > fontEntry->numFonts)
+ mono_enc->characterSet = 1;
+
+ font_handle = fontEntry->fonts[mono_enc->characterSet - 1];
+
+ /* this is the font that this MONO_ENCODING would be rendered
+ * with, thus we use it to base our extents on */
+ font = (miFontHeader *)(font_handle->deviceData);
+
+ /* bump up ISTRINGS extremes if appropriate */
+ if (font->top > meta_font.top)
+ meta_font.top = font->top;
+ if (font->bottom < meta_font.bottom)
+ meta_font.bottom = font->bottom;
+ if (font->max_width > meta_font.width)
+ meta_font.width = font->max_width;
+
+ /* for each character within the MONO_ENCODING */
+ for (charnum = 0; charnum < mono_enc->numChars; charnum++) {
+
+ switch (mono_enc->characterSetWidth) {
+ case PEXCSByte :
+ charval = (CARD32)(*(CARD8 *)ptr);
+ ptr += sizeof(CARD8);
+ break;
+ case PEXCSShort :
+ charval = (CARD32)(*(CARD16 *)ptr);
+ ptr += sizeof(CARD16);
+ break;
+ case PEXCSLong :
+ charval = *(CARD32 *)ptr;
+ ptr += sizeof(CARD32);
+ break;
+ }
+
+ if ( (charval < font->font_info.firstGlyph)
+ || (charval > font->font_info.lastGlyph)
+ || !(font->ch_data[(int)charval])) /* undefined char */
+ if (font->font_info.defaultGlyph == 0 &&
+ font->font_info.firstGlyph > 0) /* no default */
+ /* no extent info is calculated for undefined indices
+ * in charsets where there is no default glyph */
+ continue;
+ else
+ charval = font->font_info.defaultGlyph;
+
+ some_characters = 1;
+ char_data = font->ch_data[(int)charval];
+
+ switch (path) {
+
+ case PEXPathRight :
+ case PEXPathLeft :
+ end.x = cur.x + signum * char_data->right * expansion;
+ if (cur.x > xmax) xmax = cur.x;
+ if (cur.x < xmin) xmin = cur.x;
+ if (end.x > xmax) xmax = end.x;
+ if (end.x < xmin) xmin = end.x;
+ cur.x = end.x + signum * sp;
+ break;
+
+ case PEXPathUp :
+ case PEXPathDown :
+ end.y = cur.y + signum * (meta_font.top -
+ meta_font.bottom);
+ if (cur.y > ymax) ymax = cur.y;
+ if (cur.y < ymin) ymin = cur.y;
+ if (end.y > ymax) ymax = end.y;
+ if (end.y < ymin) ymin = end.y;
+ cur.y = end.y + signum * sp;
+ break;
+
+ }
+ }
+
+ ptr += PADDING(mono_enc->numChars *
+ ((mono_enc->characterSetWidth == PEXCSByte)
+ ? sizeof(CARD8)
+ : ((mono_enc->characterSetWidth == PEXCSShort)
+ ? sizeof(CARD16)
+ : sizeof(CARD32))));
+
+
+ } /* for each MONO_ENCODING */
+
+ if (some_characters) {
+
+ micalc_cpt_and_align( &meta_font, &xmin, &xmax, &ymin, &ymax,
+ path, expansion, pAlignment, &cpt, &align);
+
+ } else {
+ /* no valid characters */
+ xmin = xmax = ymin = ymax = 0.0;
+ cpt.x = cpt.y = align.x = align.y = 0.0;
+ }
+
+ extent->lowerLeft.x = ht_scale * (xmin - align.x);
+ extent->lowerLeft.y = ht_scale * (ymin - align.y);
+ extent->upperRight.x = ht_scale * (xmax - align.x);
+ extent->upperRight.y = ht_scale * (ymax - align.y);
+ extent->concatpoint.x = ht_scale * (cpt.x - align.x);
+ extent->concatpoint.y = ht_scale * (cpt.y - align.y);
+
+ } /* for each ISTRING */
+
+ return (Success);
+} /* QueryPEXTextExtents */
+
+
+/*++
+ |
+ | Function Name: UpdateFontRefs
+ |
+ | Function Description:
+ | The font resource knows how many LUTs are referencing it. If
+ | that number drops to zero, and FreePEXFont has already been
+ | called, then we really release the storage used by the font.
+ |
+ | Note(s):
+ |
+ --*/
+ddpex43rtn
+UpdateFontRefs(pFont, pResource, action)
+/* in */
+ diFontHandle pFont; /* font handle */
+ diLUTHandle pResource;/* lut handle */
+ ddAction action; /* add or remove */
+/* out */
+{
+
+ miFontHeader *font = (miFontHeader *) pFont->deviceData;
+
+ if (action == ADD) font->lutRefCount++;
+ else font->lutRefCount--;
+
+ if ((font->freeFlag == MI_TRUE) && (font->lutRefCount == 0))
+ really_free_font (pFont);
+
+ return (Success);
+} /* UpdateFontRefs */
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFontLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFontLUT.c
new file mode 100644
index 000000000..33bb41b93
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miFontLUT.c
@@ -0,0 +1,228 @@
+/* $TOG: miFontLUT.c /main/3 1998/02/10 12:44:32 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miFontLUT.c,v 1.7 1998/10/04 09:34:48 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern diFontHandle defaultPEXFont;
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXTextFontLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddTextFontEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miTextFontEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexTextFontEntry
+
+#define LUT_REND_DYN_BIT PEXDynTextFontTableContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 2
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.font
+
+/* no DYNAMIC */
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeTextFontEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeTextFontEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry);
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeTextFontEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE TextFontLUT_free
+#define LUT_INQ_PREDEF TextFontLUT_inq_predef
+#define LUT_INQ_ENTRIES TextFontLUT_inq_entries
+*/
+#define LUT_COPY TextFontLUT_copy
+#define LUT_INQ_INFO TextFontLUT_inq_info
+#define LUT_INQ_IND TextFontLUT_inq_ind
+#define LUT_INQ_ENTRY TextFontLUT_inq_entry
+#define LUT_SET_ENTRIES TextFontLUT_set_entries
+#define LUT_DEL_ENTRIES TextFontLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS TextFontLUT_inq_entry_address
+#define LUT_CREATE TextFontLUT_create
+#define LUT_ENTRY_CHECK TextFontLUT_entry_check
+#define LUT_COPY_PEX_MI TextFontLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX TextFontLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK TextFontLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ mibcopy(pdev_entry->fonts, pb, pdev_entry->numFonts * sizeof(pexFont));
+
+ pb += pdev_entry->numFonts * sizeof(pexFont);
+
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+ diFontHandle *psfonts, *pdfonts;
+ register int j;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ for (psfonts = (diFontHandle *)ps, pdfonts = pentry->entry.fonts, j = 0;
+ j < pentry->entry.numFonts; j++, psfonts++, pdfonts++)
+ *pdfonts = *psfonts;
+ for (; j < MILUT_MAX_CS_PER_ENTRY; j++, pdfonts++)
+ *pdfonts = defaultPEXFont;
+
+ *ppsrc = (ddPointer)psfonts;
+
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* numFonts: imp. dep limitation */
+ if ((*ppPexEntry)->numFonts > MILUT_MAX_CS_PER_ENTRY)
+ return(BadValue);
+ /* dipex should have looked up font id's and made them handles
+ * and would have found any bad ids */
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ (*ppPexEntry)->numFonts * sizeof(pexFont);
+
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+
+void
+TextFontLUT_init_pde()
+{
+ register int i;
+
+ pdeTextFontEntry[0].numFonts = 1;
+ pdeTextFontEntry[0].fonts[0] = defaultPEXFont;
+ /* fill in the rest of this with this font, since we want 'undefined'
+ * character sets to default to the default font (0) in the font group. */
+ for (i = 1; i < MILUT_MAX_CS_PER_ENTRY; i++)
+ pdeTextFontEntry[0].fonts[i] = defaultPEXFont;
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miIntLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miIntLUT.c
new file mode 100644
index 000000000..37b267166
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miIntLUT.c
@@ -0,0 +1,435 @@
+/* $TOG: miIntLUT.c /main/3 1998/02/10 12:44:40 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miIntLUT.c,v 1.7 1998/10/04 09:34:49 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* useful definition when testing */
+typedef struct {
+ pexEnumTypeIndex interiorStyle;
+ INT16 interiorStyleIndex;
+ pexEnumTypeIndex reflectionModel;
+ pexEnumTypeIndex surfaceInterp;
+ pexEnumTypeIndex bfInteriorStyle;
+ INT16 bfInteriorStyleIndex;
+ pexEnumTypeIndex bfReflectionModel;
+ pexEnumTypeIndex bfSurfaceInterp;
+ pexSurfaceApprox surfaceApprox;
+ pexColourSpecifier surfaceColour;
+ pexIndexedColour index1;
+ pexReflectionAttr reflectionAttr;
+ pexIndexedColour index2;
+ pexColourSpecifier bfSurfaceColour;
+ pexIndexedColour index3;
+ pexReflectionAttr bfReflectionAttr;
+ pexIndexedColour index4;
+} bogus_pexInteriorBundleEntry;
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXInteriorBundleLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddInteriorBundleEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miInteriorBundleEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexInteriorBundleEntry
+
+#define LUT_REND_DYN_BIT PEXDynInteriorBundleContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 20
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.interior
+
+#define DYNAMIC INTERIOR_BUNDLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeInteriorBundleEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeInteriorBundleEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->real_entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeInteriorBundleEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ (pentry)->real_entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE InteriorBundleLUT_free
+#define LUT_INQ_PREDEF InteriorBundleLUT_inq_predef
+#define LUT_INQ_ENTRIES InteriorBundleLUT_inq_entries
+*/
+#define LUT_COPY InteriorBundleLUT_copy
+#define LUT_INQ_INFO InteriorBundleLUT_inq_info
+#define LUT_INQ_IND InteriorBundleLUT_inq_ind
+#define LUT_INQ_ENTRY InteriorBundleLUT_inq_entry
+#define LUT_SET_ENTRIES InteriorBundleLUT_set_entries
+#define LUT_DEL_ENTRIES InteriorBundleLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS InteriorBundleLUT_inq_entry_address
+#define LUT_CREATE InteriorBundleLUT_create
+#define LUT_ENTRY_CHECK InteriorBundleLUT_entry_check
+#define LUT_COPY_PEX_MI InteriorBundleLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX InteriorBundleLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK InteriorBundleLUT_mod_call_back
+#define LUT_REALIZE_ENTRY InteriorBundleLUT_realize_entry
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ if (valueType == PEXRealizedValue)
+ pdev_entry = &pentry->real_entry;
+ else
+ pdev_entry = &pentry->entry;
+
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+ pb += sizeof(PEX_LUT_ENTRY_STR);
+
+ /* surface colour */
+ mibcopy(&pdev_entry->surfaceColour, pb, sizeof(pexColourSpecifier));
+ pb += sizeof(pexColourSpecifier);
+ MILUT_COPY_COLOUR(&pdev_entry->surfaceColour.colour,
+ pb, pdev_entry->surfaceColour.colourType);
+ pb += colour_type_sizes[(int)pdev_entry->surfaceColour.colourType];
+
+ /* refl attrs */
+ mibcopy(&pdev_entry->reflectionAttr, pb, sizeof(pexReflectionAttr));
+ pb += sizeof(pexReflectionAttr);
+ MILUT_COPY_COLOUR(&pdev_entry->reflectionAttr.specularColour.colour,
+ pb, pdev_entry->reflectionAttr.specularColour.colourType);
+ pb += colour_type_sizes[(int)pdev_entry->reflectionAttr.specularColour.colourType];
+
+ /* bf surface colour */
+ mibcopy(&pdev_entry->bfSurfaceColour, pb, sizeof(pexColourSpecifier));
+ pb += sizeof(pexColourSpecifier);
+ MILUT_COPY_COLOUR(&pdev_entry->bfSurfaceColour.colour,
+ pb, pdev_entry->bfSurfaceColour.colourType);
+ pb += colour_type_sizes[(int)pdev_entry->bfSurfaceColour.colourType];
+
+ /* bf refl attrs */
+ mibcopy(&pdev_entry->bfReflectionAttr, pb, sizeof(pexReflectionAttr));
+ pb += sizeof(pexReflectionAttr);
+ MILUT_COPY_COLOUR(&pdev_entry->bfReflectionAttr.specularColour.colour,
+ pb, pdev_entry->bfReflectionAttr.specularColour.colourType);
+ pb += colour_type_sizes[(int)pdev_entry->bfReflectionAttr.specularColour.colourType];
+
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddSHORT colourType;
+ ddPointer psrc = *ppsrc;
+
+ mibcopy(psrc, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+ psrc += sizeof(PEX_LUT_ENTRY_STR);
+
+ pentry->entry.surfaceColour.colourType = colourType =
+ ((pexColourSpecifier *)psrc)->colourType;
+ psrc += sizeof(pexColourSpecifier);
+ MILUT_COPY_COLOUR(psrc, &(pentry->entry.surfaceColour.colour), colourType);
+ psrc += colour_type_sizes[(int)colourType];
+
+ mibcopy(psrc, &(pentry->entry.reflectionAttr), sizeof(pexReflectionAttr));
+ psrc += sizeof(pexReflectionAttr);
+
+ colourType = pentry->entry.reflectionAttr.specularColour.colourType;
+ MILUT_COPY_COLOUR(psrc, &(pentry->entry.reflectionAttr.specularColour.colour),
+ colourType);
+ psrc += colour_type_sizes[(int)colourType];
+
+ pentry->entry.bfSurfaceColour.colourType = colourType =
+ ((pexColourSpecifier *)psrc)->colourType;
+ psrc += sizeof(pexColourSpecifier);
+ MILUT_COPY_COLOUR(psrc, &(pentry->entry.bfSurfaceColour.colour), colourType);
+ psrc += colour_type_sizes[(int)colourType];
+
+ mibcopy(psrc, &(pentry->entry.bfReflectionAttr), sizeof(pexReflectionAttr));
+ psrc += sizeof(pexReflectionAttr);
+
+ colourType = pentry->entry.bfReflectionAttr.specularColour.colourType;
+ MILUT_COPY_COLOUR(psrc, &(pentry->entry.bfReflectionAttr.specularColour.colour),
+ colourType);
+ psrc += colour_type_sizes[(int)colourType];
+
+ LUT_REALIZE_ENTRY( pheader, pentry );
+
+ *ppsrc = psrc;
+
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer ps;
+ ddSHORT colourType;
+
+ /* interiorStyle: any value OK. use style 1 if it's not supported */
+ /* interiorStyleIndex: any value OK. this is used for patterns
+ * and hatches which aren't supported */
+ /* reflectionModel: any value OK. use method 1 if it's not supported */
+ /* surfaceInterp: any value OK. use method 1 if it's not supported */
+ /* same as above for bf values */
+
+ /* surfaceApprox: any value OK. use method 1 if it's not supported */
+ /* front and back reflection attrs: any values OK */
+
+ /* colours: only accept supported colour types */
+ ps = (ddPointer)(*ppPexEntry + 1);
+ colourType = ((pexColourSpecifier *)ps)->colourType;
+ if (MI_BADCOLOURTYPE(colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ ps += sizeof(pexColourSpecifier) + colour_type_sizes[(int)colourType];
+ colourType = ((pexReflectionAttr *)ps)->specularColour.colourType;
+ if (MI_BADCOLOURTYPE(colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ ps += sizeof(pexReflectionAttr) + colour_type_sizes[(int)colourType];
+ colourType = ((pexColourSpecifier *)ps)->colourType;
+ if (MI_BADCOLOURTYPE(colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ ps += sizeof(pexColourSpecifier) + colour_type_sizes[(int)colourType];
+ colourType = ((pexReflectionAttr *)ps)->specularColour.colourType;
+ if (MI_BADCOLOURTYPE(colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ ps += sizeof(pexReflectionAttr) + colour_type_sizes[(int)colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)ps;
+
+ return(Success);
+}
+
+/* realize entry */
+ddpex43rtn
+LUT_REALIZE_ENTRY( pheader, pEntry )
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pEntry;
+{
+ extern miEnumType miInteriorStyleET[][SI_INT_NUM];
+ extern miEnumType miReflectionModelET[][SI_REFLECT_NUM];
+ extern miEnumType miSurfaceInterpMethodET[][SI_SURF_INTERP_NUM];
+ extern miEnumType miSurfaceApproxMethodET[][SI_SURF_APPROX_NUM];
+
+ /* interiorStyle: any value OK. use interior style 1 if it's not supported */
+ if ( (pEntry->entry.interiorStyle <
+ miInteriorStyleET[pheader->drawType][0].index) ||
+ (pEntry->entry.interiorStyle >
+ miInteriorStyleET[pheader->drawType][SI_INT_NUM - 1].index) )
+ pEntry->real_entry.interiorStyle = 1;
+ else
+ pEntry->real_entry.interiorStyle = pEntry->entry.interiorStyle;
+
+ /* interiorStyleIndex: any value OK. it's only for patterns & hatches
+ * which are supported */
+ pEntry->real_entry.interiorStyleIndex = pEntry->entry.interiorStyleIndex;
+
+ /* reflectionModel: any value OK. use model 1 if it's not supported */
+ if ( (pEntry->entry.reflectionModel <
+ miReflectionModelET[pheader->drawType][0].index) ||
+ (pEntry->entry.reflectionModel >
+ miReflectionModelET[pheader->drawType][SI_REFLECT_NUM - 1].index) )
+ pEntry->real_entry.reflectionModel = 1;
+ else
+ pEntry->real_entry.reflectionModel = pEntry->entry.reflectionModel;
+
+ /* surfaceInterp: any value OK. use model 1 if it's not supported */
+ if ( (pEntry->entry.surfaceInterp <
+ miSurfaceInterpMethodET[pheader->drawType][0].index) ||
+ (pEntry->entry.surfaceInterp >
+ miSurfaceInterpMethodET[pheader->drawType][SI_SURF_INTERP_NUM - 1].index) )
+ pEntry->real_entry.surfaceInterp = 1;
+ else
+ pEntry->real_entry.surfaceInterp = pEntry->entry.surfaceInterp;
+
+ /* bfinteriorStyle: any value OK. use style 1 if it's not supported */
+ if ( (pEntry->entry.bfInteriorStyle <
+ miInteriorStyleET[pheader->drawType][0].index) ||
+ (pEntry->entry.bfInteriorStyle >
+ miInteriorStyleET[pheader->drawType][SI_INT_NUM - 1].index) )
+ pEntry->real_entry.bfInteriorStyle = 1;
+ else
+ pEntry->real_entry.bfInteriorStyle = pEntry->entry.bfInteriorStyle;
+
+ /* bfInteriorStyleIndex: any value OK. it's only for patterns & hatches
+ * which are supported */
+ pEntry->real_entry.bfInteriorStyleIndex = pEntry->entry.bfInteriorStyleIndex;
+
+ /* bfReflectionModel: any value OK. use model 1 if it's not supported */
+ if ( (pEntry->entry.bfReflectionModel <
+ miReflectionModelET[pheader->drawType][0].index) ||
+ (pEntry->entry.bfReflectionModel >
+ miReflectionModelET[pheader->drawType][SI_REFLECT_NUM - 1].index) )
+ pEntry->real_entry.bfReflectionModel = 1;
+ else
+ pEntry->real_entry.bfReflectionModel = pEntry->entry.bfReflectionModel;
+
+ /* bfSurfaceInterp: any value OK. use model 1 if it's not supported */
+ if ( (pEntry->entry.bfSurfaceInterp <
+ miSurfaceInterpMethodET[pheader->drawType][0].index) ||
+ (pEntry->entry.bfSurfaceInterp >
+ miSurfaceInterpMethodET[pheader->drawType][SI_SURF_INTERP_NUM - 1].index) )
+ pEntry->real_entry.bfSurfaceInterp = 1;
+ else
+ pEntry->real_entry.bfSurfaceInterp = pEntry->entry.bfSurfaceInterp;
+
+ /* surfaceApprox: any value OK. use model 1 if it's not supported */
+ if ( (pEntry->entry.surfaceApprox.approxMethod <
+ miSurfaceApproxMethodET[pheader->drawType][0].index) ||
+ (pEntry->entry.surfaceApprox.approxMethod >
+ miSurfaceApproxMethodET[pheader->drawType][SI_SURF_APPROX_NUM - 1].index) )
+ pEntry->real_entry.surfaceApprox.approxMethod = 1;
+ else
+ pEntry->real_entry.surfaceApprox.approxMethod =
+ pEntry->entry.surfaceApprox.approxMethod;
+
+ pEntry->real_entry.surfaceApprox.uTolerance = pEntry->entry.surfaceApprox.uTolerance;
+ pEntry->real_entry.surfaceApprox.vTolerance = pEntry->entry.surfaceApprox.vTolerance;
+
+ /* front and back reflection attrs: any values OK (includes colours) */
+ pEntry->real_entry.reflectionAttr = pEntry->entry.reflectionAttr;
+ pEntry->real_entry.bfReflectionAttr = pEntry->entry.bfReflectionAttr;
+
+ /* colourType: its an error if an unsupported colour type was
+ * specified. For supported colour types, should mapped colour
+ * be returned??
+ */
+ pEntry->real_entry.surfaceColour = pEntry->entry.surfaceColour;
+ pEntry->real_entry.bfSurfaceColour = pEntry->entry.bfSurfaceColour;
+
+}
+void
+InteriorBundleLUT_init_pde()
+{
+ pdeInteriorBundleEntry[0].interiorStyle = PEXInteriorStyleHollow;
+ pdeInteriorBundleEntry[0].interiorStyleIndex = 1;
+ pdeInteriorBundleEntry[0].reflectionModel = PEXReflectionNoShading;
+ pdeInteriorBundleEntry[0].surfaceInterp = PEXSurfaceInterpNone;
+ pdeInteriorBundleEntry[0].bfInteriorStyle = PEXInteriorStyleHollow;
+ pdeInteriorBundleEntry[0].bfInteriorStyleIndex = 1;
+ pdeInteriorBundleEntry[0].bfReflectionModel = PEXReflectionNoShading;
+ pdeInteriorBundleEntry[0].bfSurfaceInterp = PEXSurfaceInterpNone;
+ pdeInteriorBundleEntry[0].surfaceApprox.approxMethod = 1;
+ pdeInteriorBundleEntry[0].surfaceApprox.uTolerance = 1.0;
+ pdeInteriorBundleEntry[0].surfaceApprox.vTolerance = 1.0;
+ MILUT_INIT_COLOUR(pdeInteriorBundleEntry[0].surfaceColour);
+ pdeInteriorBundleEntry[0].bfSurfaceColour =
+ pdeInteriorBundleEntry[0].surfaceColour;
+ pdeInteriorBundleEntry[0].reflectionAttr.ambient = 1.0;
+ pdeInteriorBundleEntry[0].reflectionAttr.diffuse = 1.0;
+ pdeInteriorBundleEntry[0].reflectionAttr.specular = 1.0;
+ pdeInteriorBundleEntry[0].reflectionAttr.specularConc = 0.0;
+ pdeInteriorBundleEntry[0].reflectionAttr.transmission = 0.0;
+ MILUT_INIT_COLOUR(pdeInteriorBundleEntry[0].reflectionAttr.specularColour);
+ pdeInteriorBundleEntry[0].bfReflectionAttr =
+ pdeInteriorBundleEntry[0].reflectionAttr;
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUT.c
new file mode 100644
index 000000000..e6d17d0ca
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUT.c
@@ -0,0 +1,835 @@
+/* $TOG: miLUT.c /main/3 1998/02/10 12:44:46 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUT.c,v 1.9 1999/07/18 08:34:27 dawes Exp $ */
+
+#include "miLUT.h"
+#include "pexUtils.h"
+#include "PEX.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* General Lookup Table Procedures */
+
+/* A flag to know if predefined entries are initialized.
+ * Most of them can't be automatically initialized because
+ * they contain unions, so they are set dynamically
+ * The flag is initialized in ddpexInit()
+ */
+int predef_initialized;
+
+/* used by other LUT modules */
+unsigned colour_type_sizes[] = {
+ sizeof(ddIndexedColour),
+ sizeof(ddRgbFloatColour),
+ sizeof(ddCieColour),
+ sizeof(ddHsvColour),
+ sizeof(ddHlsColour),
+ sizeof(ddRgb8Colour),
+ sizeof(ddRgb16Colour)
+};
+
+static void InitializePDEs();
+
+static unsigned entry_size[] = {
+ 0, /* dummy so table type indexes into table */
+ sizeof(miLineBundleEntry), /* line bundle */
+ sizeof(miMarkerBundleEntry), /* marker bundle */
+ sizeof(miTextBundleEntry), /* text bundle */
+ sizeof(miInteriorBundleEntry),/* interior bundle */
+ sizeof(miEdgeBundleEntry), /* edge bundle */
+ sizeof(miPatternEntry), /* pattern table */
+ sizeof(miTextFontEntry), /* font table */
+ sizeof(miColourEntry), /* colour table */
+ sizeof(miViewEntry), /* view table */
+ sizeof(miLightEntry), /* light table */
+ sizeof(miDepthCueEntry), /* depth cue table */
+ sizeof(miColourApproxEntry), /* colour approx table */
+};
+
+/*++
+ |
+ | Function Name: CreateLUT
+ |
+ | Function Description:
+ | Handles the PEXCreateLookupTable request.
+ |
+ | Note(s):
+ dipex checks for bad id, drawable, table type
+ |
+ --*/
+
+/* create procs are called through this table instead of through
+ * ops table in lut header.
+ */
+extern ddpex43rtn LineBundleLUT_create(),
+ MarkerBundleLUT_create(),
+ TextBundleLUT_create(),
+ InteriorBundleLUT_create(),
+ EdgeBundleLUT_create(),
+ PatternLUT_create(),
+ TextFontLUT_create(),
+ ColourLUT_create(),
+ ViewLUT_create(),
+ LightLUT_create(),
+ DepthCueLUT_create(),
+ ColourApproxLUT_create();
+
+miOpsTableType createLUTtable[] = {
+ LineBundleLUT_create,
+ MarkerBundleLUT_create,
+ TextBundleLUT_create,
+ InteriorBundleLUT_create,
+ EdgeBundleLUT_create,
+ PatternLUT_create,
+ TextFontLUT_create,
+ ColourLUT_create,
+ ViewLUT_create,
+ LightLUT_create,
+ DepthCueLUT_create,
+ ColourApproxLUT_create,
+};
+
+ddpex43rtn
+CreateLUT(pDrawable, pLUT)
+/* in */
+ DrawablePtr pDrawable;/* pointer to example drawable */
+ diLUTHandle pLUT; /* lut handle */
+/* out */
+{
+ register miLUTHeader *pheader;
+ ddUSHORT LUTtype = pLUT->lutType;
+ ddpex43rtn err;
+
+#ifdef DDTEST
+ ErrorF( "\nCreateLUT %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ pLUT->deviceData = NULL;
+
+ if ((pheader = (miLUTHeader *) xalloc(sizeof(miLUTHeader))) == NULL)
+ return (BadAlloc);
+
+ /* the id and table type are already in the di resource structure */
+ pheader->freeFlag = MI_FALSE;
+
+ /* set drawable example and type which supports this drawable */
+ MI_SETDRAWEXAMPLE(pDrawable, &(pheader->drawExample));
+ MI_WHICHDRAW(pDrawable, pheader->drawType);
+
+ if (!(pheader->wksRefList = puCreateList(DD_WKS)))
+ {
+ xfree( pheader);
+ return (BadAlloc);
+ }
+
+ if (!(pheader->rendRefList = puCreateList(DD_RENDERER)))
+ {
+ puDeleteList(pheader->wksRefList);
+ xfree(pheader);
+ return (BadAlloc);
+ }
+
+ /*
+ * now create the predefined entries. for now,
+ * predefined entries don't depend on the drawable type. If they every
+ * do, make the pde vars a 2-d array - the first dimension based on
+ * drawable type and the second one the entries for that drawable type.
+ * (see InquireEnumTypeInfo for an example of this)
+ */
+ if (!predef_initialized)
+ {
+ InitializePDEs();
+ predef_initialized = 1;
+ }
+
+ err = Success;
+ err = createLUTtable[LUTtype-1](pLUT, pheader);
+ if (err != Success)
+ {
+ MILUT_DESTROY_HEADER(pheader);
+ }
+
+ return(err);
+
+} /* CreateLUT */
+
+
+/*++
+ |
+ | Function Name: FreeLUT
+ |
+ | Function Description:
+ | Frees all of the storage for the lookup table if no resource is using
+ | it, otherwise it sets the free flag in the structure. This is
+ | registered with the resource id and handle by diPEX with AddResource.
+ |
+ | Note(s):
+ dipex checks for bad id
+ |
+ --*/
+
+ddpex43rtn
+FreeLUT(pLUT, LUTid)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddResourceId LUTid; /* lookup table resource id */
+/* out */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+
+#ifdef DDTEST
+ ErrorF( "\nFreeLUT %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ pheader->freeFlag = MI_TRUE;
+ pLUT->id = PEXAlreadyFreed;
+ MILUT_CHECK_DESTROY(pLUT, pheader);
+
+ return (Success);
+} /* FreeLUT */
+
+/*++
+ |
+ | Function Name: CopyLUT
+ |
+ | Function Description:
+ | Handles the PEXCopyLookupTable request.
+ |
+ | Note(s):
+ dipex checks for bad ids
+ |
+ --*/
+
+#define COMPARE_DRAWABLE_EXAMPLES(Ex1, Ex2, Op) \
+ ((Ex1).type Op (Ex2).type) \
+&& ((Ex1).depth Op (Ex2).depth) \
+&& ((Ex1).rootDepth Op (Ex2).rootDepth)
+
+ddpex43rtn
+CopyLUT(pSrcLUT, pDestLUT)
+/* in */
+ diLUTHandle pSrcLUT; /* source lookup table */
+ diLUTHandle pDestLUT; /* destination lookup table */
+/* out */
+{
+ MILUT_DEFINE_HEADER(pSrcLUT, srcHeader);
+ MILUT_DEFINE_HEADER(pDestLUT, destHeader);
+
+#ifdef DDTEST
+ ErrorF( "\nCopyLUT src %d type %d\n", pSrcLUT->id, pSrcLUT->lutType);
+ ErrorF( "\nCopyLUT dest %d type %d\n", pDestLUT->id, pDestLUT->lutType);
+#endif
+
+ if (pSrcLUT->lutType != pDestLUT->lutType)
+ return (BadMatch);
+
+ /* compare the drawable examples. */
+/*
+ * Here's one way
+ *
+ * if (! (COMPARE_DRAWABLE_EXAMPLES(srcHeader->drawExample,
+ * destHeader->drawExample,==))
+ *
+ * (see the macro definition above; it compares most of the struct members)
+ * but the one below is more restrictive, I think (it probably means both
+ * drawables are on the same framebuffer) and is likely safe for now.
+ */
+ if (srcHeader->drawExample.rootVisual != destHeader->drawExample.rootVisual)
+ return (BadMatch);
+
+ return(srcHeader->ops[MILUT_REQUEST_OP(PEX_CopyLookupTable)]
+ (pSrcLUT, pDestLUT));
+} /* CopyLUT */
+
+/*++
+ |
+ | Function Name: InquireLUTInfo
+ |
+ | Function Description:
+ | Handles the PEXGetTableInfo request.
+ |
+ | Note(s):
+ dipex checks for bad drawable id and type
+ |
+ --*/
+extern ddpex43rtn LineBundleLUT_inq_info(),
+ MarkerBundleLUT_inq_info(),
+ TextBundleLUT_inq_info(),
+ InteriorBundleLUT_inq_info(),
+ EdgeBundleLUT_inq_info(),
+ PatternLUT_inq_info(),
+ TextFontLUT_inq_info(),
+ ColourLUT_inq_info(),
+ ViewLUT_inq_info(),
+ LightLUT_inq_info(),
+ DepthCueLUT_inq_info(),
+ ColourApproxLUT_inq_info();
+
+miOpsTableType inq_info_LUTtable[] = {
+ LineBundleLUT_inq_info,
+ MarkerBundleLUT_inq_info,
+ TextBundleLUT_inq_info,
+ InteriorBundleLUT_inq_info,
+ EdgeBundleLUT_inq_info,
+ PatternLUT_inq_info,
+ TextFontLUT_inq_info,
+ ColourLUT_inq_info,
+ ViewLUT_inq_info,
+ LightLUT_inq_info,
+ DepthCueLUT_inq_info,
+ ColourApproxLUT_inq_info,
+};
+
+
+ddpex43rtn
+InquireLUTInfo(pDrawable, LUTtype, pLUTinfo)
+/* in */
+ DrawablePtr pDrawable;/* pointer to example drawable */
+ ddUSHORT LUTtype; /* lookup table type */
+/* out */
+ ddTableInfo *pLUTinfo; /* table information */
+{
+
+#ifdef DDTEST
+ ErrorF( "\nInquireLUTInfo type %d\n", LUTtype);
+#endif
+
+ return (inq_info_LUTtable[LUTtype-1](pDrawable, pLUTinfo));
+} /* InquireLUTInfo */
+
+
+/*++
+ |
+ | Function Name: InquireLUTPredEntries
+ |
+ | Function Description:
+ | Handles the PEXGetPredefinedEntries request.
+ |
+ | Note(s):
+ dipex checks for bad drawable and type
+ |
+ --*/
+
+ddpex43rtn
+InquireLUTPredEntries(pDrawable, LUTtype, start, count, pNumEntries, pBuffer)
+/* in */
+ DrawablePtr pDrawable; /* pointer to example drawable */
+ ddUSHORT LUTtype; /* table type */
+ ddTableIndex start; /* start index */
+ ddUSHORT count; /* number of entries to return */ /* out */
+ ddULONG *pNumEntries; /* number of entries */
+ ddBufferPtr pBuffer; /* table entries */
+{
+ ddLUTResource lut;
+ ddpex43rtn err43;
+ unsigned long hdrSiz = pBuffer->pBuf - pBuffer->pHead;
+ unsigned long dataSiz = 0;
+ int reply_size = entry_size[LUTtype] * count;
+ int i;
+ ddUSHORT status;
+
+#ifdef DDTEST
+ ErrorF( "\nInquireLUTPredEntries type %d\n", LUTtype);
+#endif
+
+ *pNumEntries = 0;
+ pBuffer->dataSize = 0;
+
+ /*
+ * reply_size is an upper-bound on the size of the stuff that
+ * will actually be returned, so once we do this, InquireLUTEntry
+ * shouldn't have to reallocate the buffer
+ */
+ PU_CHECK_BUFFER_SIZE(pBuffer, reply_size);
+
+ /*
+ * CreateLUT and InquireLUTEntries have a lot of smarts about
+ * predefined entries and default entries, so use them.
+ */
+ lut.id = 0;
+ lut.lutType = LUTtype;
+ if ((err43 = CreateLUT(pDrawable, &lut)) != Success)
+ return (err43);
+
+ /* see if start and count are in range of predefined entries
+ * or if entry 0 is requested for table which doesn't use 0
+ */
+#if 0
+ if (( start < MILUT_PREMIN(MILUT_HEADER(&lut)) ) ||
+ ( (start + count - 1) > MILUT_PREMAX(MILUT_HEADER(&lut)) ) ||
+ ( !start && MILUT_START_INDEX(MILUT_HEADER(&lut)) ))
+ {
+ MILUT_DESTROY_HEADER((miLUTHeader *) lut.deviceData);
+ return(BadValue);
+ }
+#endif
+
+ for (i = 0; i < count; i++)
+ {
+ /* call get entry op instead of calling InquireLUTEntry */
+ err43 = MILUT_HEADER(&lut)->ops[MILUT_REQUEST_OP(PEX_GetTableEntry)]
+ (&lut, i + start, PEXSetValue, &status, pBuffer);
+
+ if (err43 != Success)
+ {
+ /* reset data buffer pointer */
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz;
+ pBuffer->dataSize = 0;
+ return (err43);
+ }
+
+ /*
+ * move data buffer pointer to put next entry after the one just
+ * gotten
+ */
+ dataSiz += pBuffer->dataSize;
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz + dataSiz;
+ }
+
+ /* reset data buffer pointer */
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz;
+ pBuffer->dataSize = dataSiz;
+ *pNumEntries = count;
+
+ MILUT_DESTROY_HEADER((miLUTHeader *) lut.deviceData);
+
+ return (Success);
+} /* InquireLUTPredEntries */
+
+
+/*++
+ |
+ | Function Name: InquireLUTIndices
+ |
+ | Function Description:
+ | Handles the PEXGetDefinedIndices request.
+ |
+ | Note(s):
+ dipex checks for bad lut
+ |
+ --*/
+
+ddpex43rtn
+InquireLUTIndices(pLUT, pNumIndices, pBuffer)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+/* out */
+ ddULONG *pNumIndices; /* number of indices in list */
+ ddBufferPtr pBuffer; /* list of table indices */
+{
+#ifdef DDTEST
+ ErrorF( "\nInquireLUTIndices %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ *pNumIndices = 0;
+ return(MILUT_HEADER(pLUT)->ops[MILUT_REQUEST_OP(PEX_GetDefinedIndices)]
+ (pLUT, pNumIndices, pBuffer));
+} /* InquireLUTIndices */
+
+
+
+/*++
+ |
+ | Function Name: InquireLUTEntry
+ |
+ | Function Description:
+ | Handles the PEXGetTableEntry request.
+ |
+ | Note(s):
+ dipex checks for bad lut
+ |
+ --*/
+
+ddpex43rtn
+InquireLUTEntry(pLUT, index, valueType, pStatus, pBuffer)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex index; /* index of entry to get */
+ ddUSHORT valueType; /* SET or REALIZED */
+/* out */
+ ddUSHORT *pStatus; /* entry status */
+ ddBufferPtr pBuffer; /* table entry */
+{
+#ifdef DDTEST
+ ErrorF( "\nInquireLUTEntry %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ *pStatus = PEXDefaultEntry;
+ pBuffer->dataSize = 0;
+
+ /* see if entry 0 is requested for table which doesn't use 0 */
+ if (!index && MILUT_START_INDEX(MILUT_HEADER(pLUT)))
+ return(BadValue);
+
+ if ((valueType != PEXRealizedValue) && (valueType != PEXSetValue))
+ return(BadValue);
+
+ return(MILUT_HEADER(pLUT)->ops[MILUT_REQUEST_OP(PEX_GetTableEntry)]
+ (pLUT, index, valueType, pStatus, pBuffer));
+} /* InquireLUTEntry */
+
+
+/*++
+ |
+ | Function Name: InquireLUTEntries
+ |
+ | Function Description:
+ | Handles the PEXGetTableEntries request.
+ |
+ | Note(s):
+ dipex checks for bad lut
+ |
+ --*/
+
+ddpex43rtn
+InquireLUTEntries(pLUT, start, count, valueType, pNumEntries, pBuffer)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex start; /* index of first entry to get */
+ ddUSHORT count; /* number of entries requested */
+ ddUSHORT valueType; /* SET or REALIZED */
+/* out */
+ ddULONG *pNumEntries; /* number of entries in list */
+ ddBufferPtr pBuffer; /* list of table entries */
+{
+ unsigned long hdrSiz = pBuffer->pBuf - pBuffer->pHead;
+ unsigned long dataSiz = 0;
+ int reply_size = entry_size[MILUT_TYPE(pLUT)] * count;
+ int i;
+ ddUSHORT status;
+ ddpex43rtn err;
+
+ /*
+ * reply_size is an upper-bound on the size of the stuff that
+ * will actually be returned, so once we do this, InquireLUTEntry
+ * shouldn't have to reallocate the buffer
+ */
+
+ *pNumEntries = 0;
+ PU_CHECK_BUFFER_SIZE(pBuffer, reply_size);
+
+ /* see if entry 0 is requested for table which doesn't use 0
+ * or if start + count is greater than 65535
+ */
+ if ((!start && MILUT_START_INDEX(MILUT_HEADER(pLUT))) ||
+ ((ddULONG)(start + count) > MILUT_MAX_INDEX))
+ return(BadValue);
+
+ if ((valueType != PEXRealizedValue) && (valueType != PEXSetValue))
+ return(BadValue);
+
+ for (i = 0; i < count; i++)
+ {
+ /* call get entry op instead of calling InquireLUTEntry */
+ err = MILUT_HEADER(pLUT)->ops[MILUT_REQUEST_OP(PEX_GetTableEntry)]
+ (pLUT, i + start, valueType, &status, pBuffer);
+
+ if (err != Success)
+ {
+ /* reset data buffer pointer */
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz;
+ pBuffer->dataSize = 0;
+ return (err);
+ }
+
+ /*
+ * move data buffer pointer to put next entry after the one just
+ * gotten
+ */
+ dataSiz += pBuffer->dataSize;
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz + dataSiz;
+ }
+
+ /* reset data buffer pointer */
+ pBuffer->pBuf = pBuffer->pHead + hdrSiz;
+ pBuffer->dataSize = dataSiz;
+ *pNumEntries = count;
+
+ return (Success);
+} /* InquireLUTEntries */
+
+
+/*++
+ |
+ | Function Name: SetLUTEntries
+ |
+ | Function Description:
+ | Handles the PEXSetTableEntries request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+SetLUTEntries(pLUT, start, numEntries, pEntries)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex start; /* index of first entry to set */
+ ddUSHORT numEntries; /* number of entries to set */
+ ddPointer pEntries; /* list of entries */
+{
+
+#ifdef DDTEST
+ ErrorF( "\nSetLUTEntries %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ /* see if entry 0 is requested for table which doesn't use 0
+ * or if start + count is greater than 65535
+ */
+ if ((!start && MILUT_START_INDEX(MILUT_HEADER(pLUT))) ||
+ ((ddULONG)(start + numEntries) > MILUT_MAX_INDEX))
+ return(BadValue);
+
+ return(MILUT_HEADER(pLUT)->ops[MILUT_REQUEST_OP(PEX_SetTableEntries)]
+ (pLUT, start, numEntries, pEntries));
+} /* SetLUTEntries */
+
+
+/*++
+ |
+ | Function Name: DeleteLUTEntries
+ |
+ | Function Description:
+ | Handles the PEXDeleteTableEntries request.
+ |
+ | Note(s):
+ |
+ --*/
+
+#define SETSTATUS( ptr, value ) \
+ for ( i=start; i<end; i++, (ptr)++ ) \
+ (ptr)->entry_info.status = (value)
+
+ddpex43rtn
+DeleteLUTEntries(pLUT, start, numEntries)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddUSHORT start; /* index of first entry to delete */
+ ddUSHORT numEntries; /* number of entries in range */
+/* out */
+{
+
+#ifdef DDTEST
+ ErrorF( "\nDeleteLUTEntries %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ /* see if start + count is greater than 65535
+ * or if entry 0 is requested for table which doesn't use 0
+ */
+ if (( (ddULONG)(numEntries + start) > MILUT_MAX_INDEX ) ||
+ ( !start && MILUT_START_INDEX(MILUT_HEADER(pLUT)) ))
+ return(BadValue);
+
+ return(MILUT_HEADER(pLUT)->ops[MILUT_REQUEST_OP(PEX_DeleteTableEntries)]
+ (pLUT, start, numEntries));
+} /* DeleteLUTEntries */
+
+
+/*++
+ |
+ | Function Name: UpdateLUTRefs
+ |
+ | Function Description:
+ | A utility procedure for updating the cross-reference lists in the
+ | lookup table. The lookup table has two lists, one for renderers and
+ | one for workstations. These lists tell which resources are using the
+ | table. Deletes the resource if it's been freed and is not referenced.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+UpdateLUTRefs(pLUT, pResource, which, action)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ diResourceHandle pResource;/* workstation or renderer handle */
+ ddResourceType which; /* workstation or renderer */
+ ddAction action; /* add or remove */
+/* out */
+{
+ register miLUTHeader *pheader = (miLUTHeader *) pLUT->deviceData;
+
+#ifdef DDTEST
+ ErrorF( "\nUpdateLUTRefs %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ switch (which)
+ {
+ case WORKSTATION_RESOURCE:
+ if (action == ADD)
+ {
+ if (puAddToList((ddPointer) &pResource, (ddULONG) 1, pheader->wksRefList) == MI_ALLOCERR)
+ return (BadAlloc);
+ } else
+ puRemoveFromList((ddPointer) &pResource, pheader->wksRefList);
+ break;
+
+ case RENDERER_RESOURCE:
+ if (action == ADD)
+ {
+ if (puAddToList((ddPointer) &pResource, (ddULONG) 1, pheader->rendRefList) == MI_ALLOCERR)
+ return (BadAlloc);
+ } else
+ puRemoveFromList((ddPointer) &pResource, pheader->rendRefList);
+ break;
+
+ default: /* better not get here */
+ return (BadValue);
+ break;
+ }
+
+ MILUT_CHECK_DESTROY(pLUT, pheader);
+ return (Success);
+} /* UpdateLUTRefs */
+
+/*++
+ |
+ | Function Name: MatchLUTDrawable
+ |
+ | Function Description:
+ | A utility procedure for comparing a drawable with the
+ drawable example of an LUT. Returns BadMatch if they
+ are not compatible.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+MatchLUTDrawable(pLUT, pDrawable)
+ diLUTHandle pLUT;
+ DrawablePtr pDrawable;
+{
+ register miLUTHeader *pheader = (miLUTHeader *) pLUT->deviceData;
+
+ if ( (pheader->drawExample.type == pDrawable->type) &&
+ (pheader->drawExample.depth == pDrawable->depth) &&
+ (pheader->drawExample.rootDepth == pDrawable->pScreen->rootDepth) &&
+ (pheader->drawExample.rootVisual == pDrawable->pScreen->rootVisual) )
+ return(Success);
+ else
+ return(BadMatch);
+}
+
+static void
+InitializePDEs()
+{
+extern void LineBundleLUT_init_pde();
+extern void MarkerBundleLUT_init_pde();
+extern void TextBundleLUT_init_pde();
+extern void InteriorBundleLUT_init_pde();
+extern void EdgeBundleLUT_init_pde();
+extern void PatternLUT_init_pde();
+extern void TextFontLUT_init_pde();
+extern void ColourLUT_init_pde();
+extern void ViewLUT_init_pde();
+extern void LightLUT_init_pde();
+extern void DepthCueLUT_init_pde();
+extern void ColourApproxLUT_init_pde();
+
+ LineBundleLUT_init_pde();
+ MarkerBundleLUT_init_pde();
+ TextBundleLUT_init_pde();
+ InteriorBundleLUT_init_pde();
+ EdgeBundleLUT_init_pde();
+ PatternLUT_init_pde();
+ TextFontLUT_init_pde();
+ ColourLUT_init_pde();
+ ViewLUT_init_pde();
+ LightLUT_init_pde();
+ DepthCueLUT_init_pde();
+ ColourApproxLUT_init_pde();
+}
+
+extern ddpex43rtn LineBundleLUT_inq_entry_address(),
+ MarkerBundleLUT_inq_entry_address(),
+ TextBundleLUT_inq_entry_address(),
+ InteriorBundleLUT_inq_entry_address(),
+ EdgeBundleLUT_inq_entry_address(),
+ PatternLUT_inq_entry_address(),
+ TextFontLUT_inq_entry_address(),
+ ColourLUT_inq_entry_address(),
+ ViewLUT_inq_entry_address(),
+ LightLUT_inq_entry_address(),
+ DepthCueLUT_inq_entry_address(),
+ ColourApproxLUT_inq_entry_address();
+
+miOpsTableType inq_entry_address_LUTtable[] = {
+ LineBundleLUT_inq_entry_address,
+ MarkerBundleLUT_inq_entry_address,
+ TextBundleLUT_inq_entry_address,
+ InteriorBundleLUT_inq_entry_address,
+ EdgeBundleLUT_inq_entry_address,
+ PatternLUT_inq_entry_address,
+ TextFontLUT_inq_entry_address,
+ ColourLUT_inq_entry_address,
+ ViewLUT_inq_entry_address,
+ LightLUT_inq_entry_address,
+ DepthCueLUT_inq_entry_address,
+ ColourApproxLUT_inq_entry_address,
+};
+
+ddpex43rtn
+InquireLUTEntryAddress(LUTtype, pLUT, index, pStatus, ppEntry)
+/* in */
+ ddUSHORT LUTtype; /* lookup table type */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex index; /* index of entry to get */
+/* out */
+ ddUSHORT *pStatus; /* entry status */
+ ddPointer *ppEntry; /* table entry */
+{
+#ifdef DDTEST
+ ErrorF( "\nInquireLUTEntryAddress %d type \n", LUTtype);
+#endif
+
+ return(inq_entry_address_LUTtable[LUTtype-1]
+ (LUTtype, pLUT, index, pStatus, ppEntry));
+} /* InquireLUTEntryAddress */
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUTProcs.ci b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUTProcs.ci
new file mode 100644
index 000000000..10672b6ac
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLUTProcs.ci
@@ -0,0 +1,658 @@
+/* $TOG: miLUTProcs.ci /main/6 1998/02/10 13:59:50 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+ of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifndef MILUT_PROCS_CI
+#define MILUT_PROCS_CI
+
+#include "pexUtils.h"
+
+/* this file is a template for defining the lut procedures */
+/* it uses a bunch of macros (blah) but allows easier porting */
+/* the following macros must be defined in the file which includes
+ * this one before this file is included:
+ * LUT_TYPE the table type
+ * LUT_TABLE_START pointer to the first entry in the table
+ * LUT_PDE_ENTRIES the beginning of the predefined entries table
+ * LUT_SET_PDE_ENTRY macro which sets an entry to a predefined
+ * value
+ * LUT_SET_DEFAULT_VALUES macro which sets an entry to the default
+ * values
+ * data structure names:
+ * DD_LUT_ENTRY_STR devPriv data structure def
+ * MI_LUT_ENTRY_STR table entry data structure def
+ * PEX_LUT_ENTRY_STR pex data structure def
+ * renderer dynamics changes bit:
+ * LUT_REND_DYN_BIT
+ * table info:
+ * LUT_START_INDEX
+ * LUT_DEFAULT_INDEX
+ * table info dependent on drawable type (SI only supports one type):
+ * LUT_0_DEFINABLE_ENTRIES
+ * LUT_0_NUM_PREDEFINED
+ * LUT_0_PREDEFINED_MIN
+ * LUT_0_PREDEFINED_MAX
+ *
+ * procedure definition flags:
+ * define the ones whose definitions you want to use from this file
+ * procedure definition names:
+ * define the names of the procedures to use for the lut
+ */
+
+extern ddpex4rtn miDealWithDynamics(); /* in level4/miDynamics.c */
+
+/* get pointer to first legal entry in the table */
+#define FIRST_ENTRY( pheader ) \
+ LUT_TABLE_START(pheader)
+
+#define SET_TABLE_INFO( drawType, pInfo ) \
+ switch(drawType) { \
+ case MI_DRAWABLE0: \
+ (pInfo)->definableEntries = \
+ LUT_0_DEFINABLE_ENTRIES; \
+ (pInfo)->numPredefined = \
+ LUT_0_NUM_PREDEFINED; \
+ (pInfo)->predefinedMin = \
+ LUT_0_PREDEFINED_MIN; \
+ (pInfo)->predefinedMax = \
+ LUT_0_PREDEFINED_MAX; \
+ break; }
+
+/* the following procedure definitions are useful for all SI lut types */
+/* replace them in the mi*LUT.c files if these are not appropriate */
+
+/* don't use special procs for these - use the general ones called
+ * directly by diPEX */
+
+#ifdef LUT_USE_FREE
+extern ddpex43rtn FreeLUT();
+#define LUT_FREE FreeLUT
+#endif /* LUT_USE_FREE */
+
+#ifdef LUT_USE_INQ_PREDEF
+extern ddpex43rtn InquireLUTPredEntries();
+#define LUT_INQ_PREDEF InquireLUTPredEntries
+#endif /* LUT_USE_INQ_PREDEF */
+
+#ifdef LUT_USE_INQ_ENTRIES
+extern ddpex43rtn InquireLUTEntries();
+#define LUT_INQ_ENTRIES InquireLUTEntries
+#endif /* LUT_USE_INQ_ENTRIES */
+
+/*
+ The default entry: uninitialized, non-static, this scratch
+ structure is kept around so that we can fill it with default
+ data and return its address from routines like those made
+ from LUT_INQ_ENTRY_ADDRESS
+ */
+static MI_LUT_ENTRY_STR def_entry;
+
+
+
+#ifdef LUT_USE_COPY
+ddpex43rtn
+LUT_COPY (pSrcLUT, pDestLUT)
+/* in */
+ diLUTHandle pSrcLUT; /* source lookup table */
+ diLUTHandle pDestLUT; /* destination lookup table */
+/* out */
+{
+ MILUT_DEFINE_HEADER(pSrcLUT, srcHeader);
+ MILUT_DEFINE_HEADER(pDestLUT, destHeader);
+ MI_LUT_ENTRY_STR *pentry;
+ ddpex43rtn err;
+ register int i;
+
+#ifdef DDTEST
+ ErrorF( "\ncopy src lut %d type %d\n", pSrcLUT->id, pSrcLUT->lutType);
+ ErrorF( "\ncopy dest lut %d type %d\n", pDestLUT->id, pDestLUT->lutType);
+#endif
+
+ /* set all entries to undefined */
+ pentry = LUT_TABLE_START(destHeader);
+ MILUT_SET_STATUS(pentry, MILUT_ALLOC_ENTS(destHeader), MILUT_UNDEFINED, MI_FALSE);
+
+ /* copy entries */
+ mibcopy(LUT_TABLE_START(srcHeader), LUT_TABLE_START(destHeader),
+ sizeof(MI_LUT_ENTRY_STR) * MILUT_ALLOC_ENTS(srcHeader));
+
+ MILUT_NUM_ENTS(destHeader) = MILUT_NUM_ENTS(srcHeader);
+
+ err = destHeader->ops[MILUT_REQUEST_OP(milut_mod_call_back)](pDestLUT,
+ MILUT_START_INDEX(destHeader), MILUT_DEF_ENTS(destHeader), MILUT_COPY_MOD);
+ /* check err here if your call back proc can return an error */
+
+ return (err);
+}
+#endif /* LUT_USE_COPY */
+
+#ifdef LUT_USE_INQ_INFO
+ddpex43rtn
+LUT_INQ_INFO (pDrawable, pLUTinfo)
+/* in */
+ DrawablePtr pDrawable;/* pointer to example drawable */
+/* out */
+ ddTableInfo *pLUTinfo; /* table information */
+{
+ ddSHORT drawtype;
+
+#ifdef DDTEST
+ ErrorF( "\ninquire info, table type %d \n", LUT_TYPE );
+#endif
+
+ MI_WHICHDRAW(pDrawable, drawtype);
+ SET_TABLE_INFO( drawtype, pLUTinfo );
+
+ return (Success);
+}
+#endif /* LUT_USE_INQ_INFO */
+
+#ifdef LUT_USE_INQ_IND
+ddpex43rtn
+LUT_INQ_IND (pLUT, pNumIndices, pBuffer)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+/* out */
+ ddULONG *pNumIndices; /* number of indices in list */
+ ddBufferPtr pBuffer; /* list of table indices */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+ register ddUSHORT macks; /* number of definable entries */
+ register ddTableIndex *pb;
+ MI_LUT_ENTRY_STR *pentry;
+
+#ifdef DDTEST
+ ErrorF( "\n inquire indices lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ PU_CHECK_BUFFER_SIZE(pBuffer,MILUT_NUM_ENTS(pheader) * sizeof(ddTableIndex));
+ *pNumIndices = MILUT_NUM_ENTS(pheader);
+ pBuffer->dataSize = *pNumIndices * sizeof(ddTableIndex);
+ pb = (ddTableIndex *)(pBuffer->pBuf);
+
+ pentry = FIRST_ENTRY(pheader);
+
+ for ( macks = MILUT_DEF_ENTS(pheader);
+ macks > 0; macks--, pentry++ )
+ if (pentry->entry_info.status != MILUT_UNDEFINED)
+ *pb++ = pentry->entry_info.index;
+
+ return (Success);
+}
+#endif /* LUT_USE_INQ_IND */
+
+#ifdef LUT_USE_INQ_ENTRY
+ddpex43rtn
+LUT_INQ_ENTRY (pLUT, index, valueType, pStatus, pBuffer)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex index; /* index of entry to get */
+ ddUSHORT valueType; /* SET or REALIZED */
+/* out */
+ ddUSHORT *pStatus; /* entry status */
+ ddBufferPtr pBuffer; /* table entry */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+ MI_LUT_ENTRY_STR *pentry, *plast;
+ ddPointer pb;
+
+#ifdef DDTEST
+ ErrorF( "\ninquire entry lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, sizeof(PEX_LUT_ENTRY_STR));
+
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+
+ MILUT_GET_ENTRY(index, pentry, plast);
+
+ if ((pentry == NULL) || (pentry->entry_info.status == MILUT_UNDEFINED))
+ {
+ *pStatus = PEXDefaultEntry;
+ pentry = FIRST_ENTRY(pheader);
+ MILUT_GET_ENTRY(MILUT_DEFAULT_INDEX(pheader), pentry, plast);
+ if (pentry == NULL)
+ {
+ /* default entry doesn't exist - get the default values */
+ LUT_SET_DEFAULT_VALUES(&def_entry);
+ pentry = &def_entry;
+ }
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ {
+ /* default entry is undefined - get default values */
+ LUT_SET_DEFAULT_VALUES(&def_entry);
+ pentry = &def_entry;
+ }
+ } else
+ *pStatus = PEXDefinedEntry;
+
+ pb = pBuffer->pBuf;
+
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_mi_to_pex)](pheader, valueType, pentry, &pb);
+
+ pBuffer->dataSize = pb - pBuffer->pBuf;
+
+ return (Success);
+}
+#endif /* LUT_USE_INQ_ENTRY */
+
+#ifdef LUT_USE_SET_ENTRIES
+ddpex43rtn
+LUT_SET_ENTRIES (pLUT, start, numEntries, pEntries)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex start; /* index of first entry to set */
+ ddUSHORT numEntries; /* number of entries to set */
+ ddPointer pEntries; /* list of entries */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+ MI_LUT_ENTRY_STR *pentry, *plast, *psave;
+ PEX_LUT_ENTRY_STR *psrc;
+ register int i;
+ int freecount1 = 0, freecount2;
+ ddpex43rtn err;
+ ddPointer ps;
+
+#ifdef DDTEST
+ ErrorF( "\nset entries lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ psrc = (PEX_LUT_ENTRY_STR *) pEntries;
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+
+ /* check for a place to put the entries and check them for errors */
+ /* this is set up to work for tables with contiguous index
+ * values most efficiently. it will work for sparse tables, too
+ */
+ for (i = start; i < (start + numEntries); i++)
+ {
+ /* starting at current pentry, see if entry 'i' is after it */
+ psave = pentry;
+ MILUT_GET_ENTRY(i, pentry, plast);
+
+ if (!pentry)
+ {
+ /* make sure the entry wasn't before pentry
+ * by starting at the beginning and looking until where
+ * pentry was (psave)
+ */
+ pentry = FIRST_ENTRY(pheader);
+ MILUT_GET_ENTRY(i, pentry, psave);
+ if (!pentry)
+ {
+ /* no entry defined with this index
+ * put one in by looking for the first
+ * undefined entry. this has no intelligence
+ * about it
+ */
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+ freecount2 = freecount1;
+ while ((pentry < plast) &&
+ ((pentry->entry_info.status != MILUT_UNDEFINED) || freecount2))
+ {
+ if (pentry->entry_info.status == MILUT_UNDEFINED)
+ freecount2--;
+ pentry++;
+ }
+ if (pentry == plast)
+ /* couldn't find a place for it */
+ return(BadAlloc);
+ else
+ /* keep count of free places found so far */
+ freecount1++;
+ }
+ }
+ /* check the entry and increment the source pointer */
+ if ((err = pheader->ops[MILUT_REQUEST_OP(milut_entry_check)](pheader, &psrc)) != Success)
+ return(err);
+ }
+
+ psrc = (PEX_LUT_ENTRY_STR *) pEntries;
+ for (i = start; i < (start + numEntries); i++)
+ {
+ /* starting at current pentry, see if entry 'i' is after it */
+ psave = pentry;
+ MILUT_GET_ENTRY(i, pentry, plast);
+
+ if (!pentry)
+ {
+ /* make sure the entry wasn't before pentry
+ * by starting at the beginning and looking until where
+ * pentry was (psave)
+ */
+ pentry = FIRST_ENTRY(pheader);
+ MILUT_GET_ENTRY(i, pentry, psave);
+ if (!pentry)
+ {
+ /* no entry defined with this index
+ * put one in by looking for the first
+ * undefined entry. this has no intelligence
+ * about it
+ */
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+ while ((pentry < plast) &&
+ (pentry->entry_info.status != MILUT_UNDEFINED))
+ pentry++;
+ if (pentry == plast)
+ /* this shouldn't happen since it was
+ * checked above, but just in case..
+ * this is where one of those ASSURE
+ * tests can be useful
+ */
+ return(BadAlloc);
+ }
+ }
+
+ if (pentry->entry_info.status == MILUT_UNDEFINED)
+ MILUT_NUM_ENTS(pheader)++;
+ pentry->entry_info.status = MILUT_DEFINED;
+ pentry->entry_info.index = i;
+
+ ps = (ddPointer)psrc;
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_pex_to_mi)](pheader, &ps, pentry);
+
+ psrc = (PEX_LUT_ENTRY_STR *)ps;
+ }
+
+ err = pheader->ops[MILUT_REQUEST_OP(milut_mod_call_back)](pLUT,
+ start, numEntries, MILUT_SET_MOD);
+
+ /* check err here if your call back proc can return an error */
+
+ return (err);
+}
+#endif /* LUT_USE_SET_ENTRIES */
+
+#ifdef LUT_USE_DEL_ENTRIES
+ddpex43rtn
+LUT_DEL_ENTRIES (pLUT, start, numEntries)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ ddUSHORT start; /* index of first entry to delete */
+ ddUSHORT numEntries; /* number of entries in range */
+/* out */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+ MI_LUT_ENTRY_STR *pentry, *plast, *psave;
+ ddpex43rtn err;
+
+#ifdef DDTEST
+ ErrorF( "\ndelete entries lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+
+ /* invoke the call back before deleting the entries and changing
+ start and numEntries
+ */
+ err = pheader->ops[MILUT_REQUEST_OP(milut_mod_call_back)](pLUT,
+ start, numEntries, MILUT_DEL_MOD);
+
+ /* loop through and set each entry to undefined
+ * this works most efficiently if the entries are stored
+ * in the lut contiguously since MILUT_GET_ENTRY starts
+ * where pentry points then searches forward colour_approxarly
+ */
+ for (; numEntries > 0; start++, numEntries--)
+ {
+ psave = pentry;
+ MILUT_GET_ENTRY(start, pentry, plast);
+
+ if (!pentry)
+ {
+ /* make sure the entry wasn't before pentry */
+ pentry = FIRST_ENTRY(pheader);
+ MILUT_GET_ENTRY(start, pentry, psave);
+ }
+
+ if (pentry)
+ {
+ if (pentry->entry_info.status != MILUT_UNDEFINED)
+ {
+ MILUT_NUM_ENTS(pheader)--;
+ pentry->entry_info.status = MILUT_UNDEFINED;
+ }
+ }
+ else
+ pentry = psave;
+ }
+
+ /* check err here if your call back proc can return an error */
+
+ return (err);
+}
+#endif /* LUT_USE_DEL_ENTRIES */
+
+#ifdef LUT_USE_INQ_ENTRY_ADDRESS
+ddpex43rtn
+LUT_INQ_ENTRY_ADDRESS (LUTtype, pLUT, index, pStatus, ppEntry)
+/* in */
+ ddUSHORT LUTtype; /* lookup table type use this if pLUT is NULL */
+ diLUTHandle pLUT; /* lut handle */
+ ddTableIndex index; /* index of entry to get */
+/* out */
+ ddUSHORT *pStatus; /* entry status */
+ ddPointer *ppEntry; /* table entry */
+{
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pentry, *plast;
+
+#ifdef DDTEST
+ ErrorF( "\ninquire entry address lut type %d\n", LUTtype);
+#endif
+
+ pentry = NULL;
+
+ if (!pLUT)
+ {
+ /* get the default values */
+ LUT_SET_DEFAULT_VALUES(&def_entry);
+ *ppEntry = (ddPointer)&def_entry;
+ return (Success);
+ }
+
+ pheader = MILUT_HEADER(pLUT);
+ pentry = FIRST_ENTRY(pheader);
+ plast = pentry + MILUT_DEF_ENTS(pheader);
+
+ MILUT_GET_ENTRY(index, pentry, plast);
+ if ((pentry == NULL) || (pentry->entry_info.status == MILUT_UNDEFINED))
+ {
+ /* get the default entry */
+ *pStatus = PEXDefaultEntry;
+ pentry = FIRST_ENTRY(pheader);
+ MILUT_GET_ENTRY(MILUT_DEFAULT_INDEX(pheader), pentry, plast);
+ if (pentry == NULL)
+ {
+ /* default entry doesn't exist - get the default values */
+ LUT_SET_DEFAULT_VALUES(&def_entry);
+ *ppEntry = (ddPointer)&def_entry;
+ }
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ {
+ /* default entry is undefined - get default values */
+ LUT_SET_DEFAULT_VALUES(&def_entry);
+ *ppEntry = (ddPointer)&def_entry;
+ }
+ else /* the default entry is good */
+ *ppEntry = (ddPointer)pentry;
+ } else /* the entry was found and is defined */
+ {
+ *pStatus = PEXDefinedEntry;
+ *ppEntry = (ddPointer)pentry;
+ }
+
+ return (Success);
+}
+#endif /* LUT_USE_INQ_ENTRY_ADDRESS */
+
+#ifdef LUT_USE_MOD_CALL_BACK
+ddpex43rtn
+LUT_MOD_CALL_BACK(pLUT, start, numEntries, mod)
+ diLUTHandle pLUT;
+ ddTableIndex start; /* index of first entry to set */
+ ddUSHORT numEntries; /* number of entries to set */
+ ddUSHORT mod; /* modification: copy, set, delete */
+{
+ MILUT_DEFINE_HEADER(pLUT, pheader);
+ register int i;
+ ddRendererPtr *pprend;
+ diWKSHandle *phandle;
+ miWksPtr pwks;
+ ddpex43rtn err;
+
+ /* set change flags in renderer so ValidateRenderer will
+ * know to update the ddContext with changes
+ * add to here and calls to hardware, etc. to realize
+ * modifications
+ */
+ pprend = (ddRendererPtr *)pheader->rendRefList->pList;
+ for (i=0; i<pheader->rendRefList->numObj; i++, pprend++)
+ (*pprend)->tablesChanges |= LUT_REND_DYN_BIT;
+
+ /* for view luts: this wks list only identifies the wks for
+ * which this is the current view. The wks is not included
+ * in the list of the requested view lut
+ */
+ if (pheader->wksRefList->numObj)
+ {
+ phandle = (diWKSHandle *)pheader->wksRefList->pList;
+ for (i=0; i<pheader->wksRefList->numObj; i++, phandle++)
+ {
+ pwks = (miWksPtr)((*phandle)->deviceData);
+ pwks->pRend->tablesChanges |= LUT_REND_DYN_BIT;
+ }
+ }
+
+ err = Success;
+
+#ifdef DYNAMIC
+ if (pheader->wksRefList->numObj)
+ err = miDealWithDynamics( DYNAMIC, pheader->wksRefList );
+#endif /* DYNAMIC */
+
+ return( err );
+}
+#endif /* LUT_USE_MOD_CALL_BACK */
+
+
+#ifdef LUT_USE_CREATE
+ddpex43rtn
+LUT_CREATE (pLUT, pheader)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ miLUTHeader *pheader; /* lut header */
+/* out */
+{
+ register int i;
+ MI_LUT_ENTRY_STR *pentry;
+ DD_LUT_ENTRY_STR *pdeentry;
+
+#ifdef DDTEST
+ ErrorF( "\ncreate lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+ MILUT_START_INDEX(pheader) = LUT_START_INDEX;
+ MILUT_DEFAULT_INDEX(pheader) = LUT_DEFAULT_INDEX;
+ MILUT_NUM_ENTS(pheader) = 0;
+ SET_TABLE_INFO( pheader->drawType, &(pheader->tableInfo) );
+
+ if (MILUT_ALLOC_ENTS(pheader) == 0)
+ {
+ LUT_TABLE_START(pheader) = NULL;
+ }
+ else if ( (LUT_TABLE_START(pheader) = (MI_LUT_ENTRY_STR *)
+ xalloc(MILUT_ALLOC_ENTS(pheader) * sizeof(MI_LUT_ENTRY_STR)) )
+ == NULL)
+ {
+ MILUT_DESTROY_HEADER(pheader);
+ return(BadAlloc);
+ }
+
+ pentry = LUT_TABLE_START(pheader);
+ MILUT_SET_STATUS(pentry, MILUT_ALLOC_ENTS(pheader), MILUT_UNDEFINED, MI_TRUE);
+
+ /* if there are predefined entries, put them in */
+ if (MILUT_PRENUM(pheader))
+ {
+ pentry = LUT_TABLE_START(pheader) + MILUT_PREMIN(pheader);
+ pdeentry = &(LUT_PDE_ENTRIES);
+
+ for (i=MILUT_PREMIN(pheader);
+ i<=MILUT_PREMAX(pheader); i++, pentry++, pdeentry++)
+ {
+ pentry->entry_info.status = MILUT_PREDEFINED;
+ pentry->entry_info.index = i;
+ LUT_SET_PDE_ENTRY(pentry, pdeentry);
+ pheader->numDefined++;
+ }
+ }
+
+ pheader->ops[MILUT_REQUEST_OP(PEX_CreateLookupTable)] = LUT_CREATE;
+ pheader->ops[MILUT_REQUEST_OP(PEX_CopyLookupTable)] = LUT_COPY;
+ pheader->ops[MILUT_REQUEST_OP(PEX_FreeLookupTable)] = LUT_FREE;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableInfo)] = LUT_INQ_INFO;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetPredefinedEntries)] = LUT_INQ_PREDEF;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetDefinedIndices)] = LUT_INQ_IND;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableEntry)] = LUT_INQ_ENTRY;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableEntries)] = LUT_INQ_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(PEX_SetTableEntries)] = LUT_SET_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(PEX_DeleteTableEntries)] = LUT_DEL_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(milut_InquireEntryAddress)] = LUT_INQ_ENTRY_ADDRESS;
+ pheader->ops[MILUT_REQUEST_OP(milut_entry_check)] = LUT_ENTRY_CHECK;
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_pex_to_mi)] = LUT_COPY_PEX_MI;
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_mi_to_pex)] = LUT_COPY_MI_PEX;
+ pheader->ops[MILUT_REQUEST_OP(milut_mod_call_back)] = LUT_MOD_CALL_BACK;
+
+ pLUT->deviceData = (ddPointer) pheader;
+ return (Success);
+}
+#endif /* LUT_USE_CREATE */
+
+#endif /* MILUT_PROCS_CI */
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLightLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLightLUT.c
new file mode 100644
index 000000000..aefec9e48
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLightLUT.c
@@ -0,0 +1,249 @@
+/* $TOG: miLightLUT.c /main/4 1998/02/10 12:44:53 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miLightLUT.c,v 1.7 1998/10/04 09:34:50 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXLightLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddLightEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miLightEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexLightEntry
+
+#define LUT_REND_DYN_BIT PEXDynLightTableContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 16
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.light
+
+#define DYNAMIC LIGHT_TABLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeLightEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeLightEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ if ((pentry)->entry.lightType == PEXLightWcsSpot) \
+ (pentry)->cosSpreadAngle = \
+ cos((double)(pentry)->entry.spreadAngle); \
+ else (pentry)->cosSpreadAngle = 0.0
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeLightEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES
+
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE LightLUT_free
+#define LUT_INQ_PREDEF LightLUT_inq_predef
+#define LUT_INQ_ENTRIES LightLUT_inq_entries
+*/
+#define LUT_COPY LightLUT_copy
+#define LUT_INQ_INFO LightLUT_inq_info
+#define LUT_INQ_IND LightLUT_inq_ind
+#define LUT_INQ_ENTRY LightLUT_inq_entry
+#define LUT_SET_ENTRIES LightLUT_set_entries
+#define LUT_DEL_ENTRIES LightLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS LightLUT_inq_entry_address
+#define LUT_CREATE LightLUT_create
+#define LUT_ENTRY_CHECK LightLUT_entry_check
+#define LUT_COPY_PEX_MI LightLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX LightLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK LightLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->lightColour.colour,
+ pb, pdev_entry->lightColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->lightColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.lightColour.colour),
+ pentry->entry.lightColour.colourType);
+
+ ps += colour_type_sizes[(int)pentry->entry.lightColour.colourType];
+ if (pentry->entry.lightType == PEXLightWcsSpot)
+ pentry->cosSpreadAngle = cos((double)pentry->entry.spreadAngle);
+ else pentry->cosSpreadAngle = 0.0;
+
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ extern miEnumType miLightTypeET[][SI_LIGHT_NUM];
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* lightType: only use supported lights */
+ if (((*ppPexEntry)->lightType < miLightTypeET[pheader->drawType][0].index) ||
+ ((*ppPexEntry)->lightType > miLightTypeET[pheader->drawType][SI_LIGHT_NUM - 1].index))
+ return(BadValue);
+ /* direction: any value OK. */
+ /* point: any value OK. */
+ /* concentration: any value OK. */
+ /* spreadAngle: must be in range [0,pi] */
+ if ((*ppPexEntry)->lightType == PEXLightWcsSpot)
+ if (((*ppPexEntry)->spreadAngle < 0.0) ||
+ ((*ppPexEntry)->spreadAngle > MI_PI))
+ return(BadValue);
+ /* attenuaton1: any value OK. */
+ /* attenuaton2: any value OK. */
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->lightColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) + colour_type_sizes[(int)(*ppPexEntry)->lightColour.colourType];
+
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+void
+LightLUT_init_pde()
+{
+ pdeLightEntry[0].lightType = PEXLightAmbient;
+ pdeLightEntry[0].direction.x = 0.0;
+ pdeLightEntry[0].direction.y = 0.0;
+ pdeLightEntry[0].direction.z = 0.0;
+ pdeLightEntry[0].point.x = 0.0;
+ pdeLightEntry[0].point.y = 0.0;
+ pdeLightEntry[0].point.z = 0.0;
+ pdeLightEntry[0].concentration = 0.0;
+ pdeLightEntry[0].spreadAngle = 0.0;
+ pdeLightEntry[0].attenuation1 = 0.0;
+ pdeLightEntry[0].attenuation2 = 0.0;
+ pdeLightEntry[0].lightColour.colourType = PEXRgbFloatColour;
+ pdeLightEntry[0].lightColour.colour.rgbFloat.red = 1.0;
+ pdeLightEntry[0].lightColour.colour.rgbFloat.green = 1.0;
+ pdeLightEntry[0].lightColour.colour.rgbFloat.blue = 1.0;
+}
+
+#include "miLUTProcs.ci"
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLineLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLineLUT.c
new file mode 100644
index 000000000..149c91e53
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miLineLUT.c
@@ -0,0 +1,280 @@
+/* $TOG: miLineLUT.c /main/3 1998/02/10 12:45:00 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miLineLUT.c,v 1.7 1998/10/04 09:34:50 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXLineBundleLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddLineBundleEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miLineBundleEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexLineBundleEntry
+
+#define LUT_REND_DYN_BIT PEXDynLineBundleContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 20
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.line
+
+#define DYNAMIC LINE_BUNDLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeLineBundleEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeLineBundleEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->real_entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeLineBundleEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ (pentry)->real_entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE LineBundleLUT_free
+#define LUT_INQ_PREDEF LineBundleLUT_inq_predef
+#define LUT_INQ_ENTRIES LineBundleLUT_inq_entries
+*/
+#define LUT_COPY LineBundleLUT_copy
+#define LUT_INQ_INFO LineBundleLUT_inq_info
+#define LUT_INQ_IND LineBundleLUT_inq_ind
+#define LUT_INQ_ENTRY LineBundleLUT_inq_entry
+#define LUT_SET_ENTRIES LineBundleLUT_set_entries
+#define LUT_DEL_ENTRIES LineBundleLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS LineBundleLUT_inq_entry_address
+#define LUT_CREATE LineBundleLUT_create
+#define LUT_ENTRY_CHECK LineBundleLUT_entry_check
+#define LUT_COPY_PEX_MI LineBundleLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX LineBundleLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK LineBundleLUT_mod_call_back
+#define LUT_REALIZE_ENTRY LineBundleLUT_realize_entry
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ if (valueType == PEXRealizedValue)
+ pdev_entry = &pentry->real_entry;
+ else
+ pdev_entry = &pentry->entry;
+
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->lineColour.colour,
+ pb, pdev_entry->lineColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->lineColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.lineColour.colour),
+ pentry->entry.lineColour.colourType);
+
+ LUT_REALIZE_ENTRY( pheader, pentry );
+
+ ps += colour_type_sizes[(int)pentry->entry.lineColour.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+ /* lineType: any value OK. use line type 1 if it's not supported */
+ /* polylineInterp: any value OK. use method 1 if it's not supported */
+ /* curveApprox: any value OK. use method 1 if it's not supported */
+ /* lineWidth: any value is OK, the nearest supported value is used */
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->lineColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->lineColour.colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+/* realize entry */
+ddpex43rtn
+LUT_REALIZE_ENTRY( pheader, pEntry )
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pEntry;
+{
+ extern miEnumType miLineTypeET[][SI_LINE_NUM];
+ extern miEnumType miPolylineInterpMethodET[][SI_LINE_INTERP_NUM];
+ extern miEnumType miCurveApproxMethodET[][SI_CURVE_APPROX_NUM];
+
+ /* lineType: any value OK. use line type 1 if it's not supported */
+ if ( (pEntry->entry.lineType <
+ miLineTypeET[pheader->drawType][0].index) ||
+ (pEntry->entry.lineType >
+ miLineTypeET[pheader->drawType][SI_LINE_NUM - 1].index) )
+ pEntry->real_entry.lineType = 1;
+ else
+ pEntry->real_entry.lineType = pEntry->entry.lineType;
+
+ /* polylineInterp: any value OK. use method 1 if it's not supported */
+ if ( (pEntry->entry.polylineInterp <
+ miPolylineInterpMethodET[pheader->drawType][0].index) ||
+ (pEntry->entry.polylineInterp >
+ miPolylineInterpMethodET[pheader->drawType][SI_LINE_INTERP_NUM - 1].index) )
+ pEntry->real_entry.polylineInterp = 1;
+ else
+ pEntry->real_entry.polylineInterp = pEntry->entry.polylineInterp;
+
+ /* curveApprox: any value OK. use method 1 if it's not supported */
+ if ( (pEntry->entry.curveApprox.approxMethod <
+ miCurveApproxMethodET[pheader->drawType][0].index) ||
+ (pEntry->entry.curveApprox.approxMethod >
+ miCurveApproxMethodET[pheader->drawType][SI_CURVE_APPROX_NUM - 1].index) )
+ pEntry->real_entry.curveApprox.approxMethod = 1;
+ else
+ pEntry->real_entry.curveApprox.approxMethod = pEntry->entry.curveApprox.approxMethod;
+ pEntry->real_entry.curveApprox.tolerance =
+ pEntry->entry.curveApprox.tolerance;
+
+ /* lineWidth: any value is OK, it is multiplied by the nomimal
+ * line width and the nearest supported size is used
+ * The realized value is the scale for inquiry, not the size.
+ */
+ pEntry->real_entry.lineWidth = pEntry->entry.lineWidth;
+
+ /* colourType: its an error if an unsupported colour type was
+ * specified. For supported colour types, should mapped colour
+ * be returned??
+ */
+ pEntry->real_entry.lineColour = pEntry->entry.lineColour;
+ return(Success);
+}
+
+void
+LineBundleLUT_init_pde()
+{
+ pdeLineBundleEntry[0].lineType = PEXLineTypeSolid;
+ pdeLineBundleEntry[0].polylineInterp = PEXPolylineInterpNone;
+ pdeLineBundleEntry[0].curveApprox.approxMethod = 1;
+ pdeLineBundleEntry[0].curveApprox.tolerance = 1.0;
+ pdeLineBundleEntry[0].lineWidth = 1.0;
+ MILUT_INIT_COLOUR(pdeLineBundleEntry[0].lineColour);
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMarkLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMarkLUT.c
new file mode 100644
index 000000000..d9ee160a0
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMarkLUT.c
@@ -0,0 +1,258 @@
+/* $TOG: miMarkLUT.c /main/3 1998/02/10 12:45:06 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miMarkLUT.c,v 1.7 1998/10/04 09:34:51 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXMarkerBundleLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddMarkerBundleEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miMarkerBundleEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexMarkerBundleEntry
+
+#define LUT_REND_DYN_BIT PEXDynMarkerBundleContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 20
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.marker
+
+#define DYNAMIC MARKER_BUNDLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeMarkerBundleEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeMarkerBundleEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->real_entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeMarkerBundleEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ (pentry)->real_entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE MarkerBundleLUT_free
+#define LUT_INQ_PREDEF MarkerBundleLUT_inq_predef
+#define LUT_INQ_ENTRIES MarkerBundleLUT_inq_entries
+*/
+#define LUT_COPY MarkerBundleLUT_copy
+#define LUT_INQ_INFO MarkerBundleLUT_inq_info
+#define LUT_INQ_IND MarkerBundleLUT_inq_ind
+#define LUT_INQ_ENTRY MarkerBundleLUT_inq_entry
+#define LUT_SET_ENTRIES MarkerBundleLUT_set_entries
+#define LUT_DEL_ENTRIES MarkerBundleLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS MarkerBundleLUT_inq_entry_address
+#define LUT_CREATE MarkerBundleLUT_create
+#define LUT_ENTRY_CHECK MarkerBundleLUT_entry_check
+#define LUT_COPY_PEX_MI MarkerBundleLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX MarkerBundleLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK MarkerBundleLUT_mod_call_back
+#define LUT_REALIZE_ENTRY MarkerBundleLUT_realize_entry
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ if (valueType == PEXRealizedValue)
+ pdev_entry = &pentry->real_entry;
+ else
+ pdev_entry = &pentry->entry;
+
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->markerColour.colour,
+ pb, pdev_entry->markerColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->markerColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.markerColour.colour),
+ pentry->entry.markerColour.colourType);
+
+ LUT_REALIZE_ENTRY( pheader, pentry );
+
+ ps += colour_type_sizes[(int)pentry->entry.markerColour.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+ /* markerType: any value OK. use marker type 3 if it's not supported */
+ /* markerScale: any value is OK, it is multiplied by the nominal
+ * marker size (see imp dep constants) and the supported size
+ * nearest to that is used
+ */
+
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->markerColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->markerColour.colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+/* realize entry */
+ddpex43rtn
+LUT_REALIZE_ENTRY( pheader, pEntry )
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pEntry;
+{
+ extern miEnumType miMarkerTypeET[][SI_MARKER_NUM];
+
+ /* markerType: any value OK. use marker type 3 if it's not supported */
+ if ( (pEntry->entry.markerType <
+ miMarkerTypeET[pheader->drawType][0].index) ||
+ (pEntry->entry.markerType >
+ miMarkerTypeET[pheader->drawType][SI_MARKER_NUM - 1].index) )
+ pEntry->real_entry.markerType = 3;
+ else
+ pEntry->real_entry.markerType = pEntry->entry.markerType;
+
+ /* markerScale: any value is OK, it is multiplied by the nomimal
+ * marker size and the nearest supported size is used
+ * The realized value is the scale for inquiry, not the size
+ */
+ pEntry->real_entry.markerScale = pEntry->entry.markerScale;
+
+ /* colourType: its an error if an unsupported colour type was
+ * specified. For supported colour types, should mapped colour
+ * be returned?? - but don't know which colour approx
+ * values to use. could use default.
+ */
+ pEntry->real_entry.markerColour = pEntry->entry.markerColour;
+ return(Success);
+}
+
+void
+MarkerBundleLUT_init_pde()
+{
+ pdeMarkerBundleEntry[0].markerType = PEXMarkerAsterisk;
+ pdeMarkerBundleEntry[0].markerScale = 1.0;
+ MILUT_INIT_COLOUR(pdeMarkerBundleEntry[0].markerColour);
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMisc.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMisc.c
new file mode 100644
index 000000000..40cb827c4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miMisc.c
@@ -0,0 +1,870 @@
+/* $TOG: miMisc.c /main/10 1998/02/10 12:45:11 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miMisc.c,v 1.7 1998/10/04 09:34:51 dawes Exp $ */
+
+#include "mipex.h"
+#include "miInfo.h"
+#include "pexUtils.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* pex device dependent initialization */
+ddpex43rtn
+ddpexInit()
+{
+ extern int predef_initialized; /* in miLUT.c */
+ extern ddBOOL pcflag; /* in miRender.c */
+ extern ddBOOL init_pick_flag; /* in miWks.c */
+
+ predef_initialized = 0;
+ pcflag = MI_FALSE;
+ init_pick_flag = MI_FALSE;
+
+ return (Success);
+}
+
+/* pex device dependent reset */
+/*
+ This function is called during server reset.
+ It should free any buffers and initialize any device-specific
+ data that must be done during server reset.
+
+ The PEX-ME allocates no buffers and so this function does
+ not much. It is provided as an aid to porting. It is
+ called from the dipex routine PEXResetProc
+*/
+void
+ddpexReset()
+{
+ /* YOUR CODE HERE */
+}
+
+/* define the imp dep info and enum type info */
+
+/* Theoretically, all of this info could depend on the drawable of the
+ * workstation, so put everything into arrays based on the drawable.
+ * There is an imp dep drawable type value defined in mi.h which is
+ * determined by the implementation based on the workstations drawable.
+ * The MI_MAXDRAWABLES is the number of imp dep defined drawable types
+ * used for PEX. In the SI, its value is 1.
+ */
+
+/* also, these values are all hard coded for the SI (using #defines
+ * in miInfo.h). You may want to
+ * inquire into a library that you are porting to for these values.
+ * To do this, replace the code in the procedures below to retrieve
+ * the value from your library instead of from the table.
+ */
+
+/* imp dep constants */
+
+/* These values are in two arrays that can be accessed by
+ * the PEXID constant value. One array has the values which are
+ * type CARD32. The other is for FLOAT values.
+ * SI_NUM_INT_IMPS and SI_NUM_FLOAT_IMPS specify how many values
+ * there are of each
+ */
+
+/* add one to number of ints because imps start at 1 */
+static ddULONG intImpDeps[MI_MAXDRAWABLES][SI_NUM_INT_IMPS + 1] = {
+ 0, /* dummy */
+ SI_DITHERING_SUPPORTED,
+ SI_MAX_EDGE_WIDTH,
+ SI_MAX_LINE_WIDTH,
+ SI_MAX_MARKER_SIZE,
+ SI_MAX_MODEL_CLIP_PLANES,
+ SI_MAX_NAME_SET_NAMES,
+ SI_MAX_NON_AMBIENT_LIGHTS,
+ SI_MAX_NURB_ORDER,
+ SI_MAX_TRIM_CURVE_ORDER,
+ SI_MIN_EDGE_WIDTH,
+ SI_MIN_LINE_WIDTH,
+ SI_MIN_MARKER_SIZE,
+ SI_NOM_EDGE_WIDTH,
+ SI_NOM_LINE_WIDTH,
+ SI_NOM_MARKER_SIZE,
+ SI_SUPP_EDGE_WIDTHS,
+ SI_SUPP_LINE_WIDTHS,
+ SI_SUPP_MARKER_SIZES,
+ SI_BEST_COLOUR_APPROX_VALUES,
+ SI_TRANSPARENCY_SUPPORTED,
+ SI_DOUBLE_BUFFERING_SUPPORTED,
+ SI_MAX_HITS_EVENT_SUPPORTED
+};
+
+#define FLOAT_INDEX(n) (n) - (SI_NUM_INT_IMPS + 1)
+
+static ddFLOAT floatImpDeps[MI_MAXDRAWABLES][SI_NUM_FLOAT_IMPS] = {
+ SI_CHROM_RED_U,
+ SI_CHROM_RED_V,
+ SI_LUM_RED,
+ SI_CHROM_GREEN_U,
+ SI_CHROM_GREEN_V,
+ SI_LUM_GREEN,
+ SI_CHROM_BLUE_U,
+ SI_CHROM_BLUE_V,
+ SI_LUM_BLUE,
+ SI_CHROM_WHITE_U,
+ SI_CHROM_WHITE_V,
+ SI_LUM_WHITE
+};
+
+/*++
+ |
+ | Function Name: InquireImpDepConstants
+ |
+ | Function Description:
+ | Handles the PEXGetImpDepConstants request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+InquireImpDepConstants(pDrawable, numNames, pNames, pBuffer)
+/* in */
+ DrawablePtr pDrawable;/* drawable */
+ ddULONG numNames; /* number of names */
+ ddUSHORT *pNames; /* list of names */
+/* out */
+ ddBufferPtr pBuffer; /* list of constants */
+
+{
+
+ register short i;
+ register ddULONG dsize;
+
+ register union
+ {
+ ddULONG *C32;
+ ddFLOAT *F32;
+ } pbuf;
+
+ register ddUSHORT *pname;
+ register int drawType;
+
+ pBuffer->dataSize = 0;
+
+ dsize = numNames * sizeof(ddULONG);
+ PU_CHECK_BUFFER_SIZE(pBuffer, dsize);
+
+ pBuffer->dataSize = dsize;
+ MI_WHICHDRAW(pDrawable, drawType);
+
+ /* process each inquiry request in the list */
+
+ for (i = 0, pname = pNames, pbuf.C32 = (ddULONG *) (pBuffer->pBuf);
+ i < numNames; i++, pname++, pbuf.C32++)
+ {
+
+ /*
+ * use a switch here for each constant type if you don't hard code
+ * the values (e.g. you want to call into a library to get the
+ * values)
+ */
+ if ((int) *pname < SI_NUM_INT_IMPS)
+ *pbuf.C32 = intImpDeps[drawType][(int) *pname];
+ else
+ *pbuf.F32 = floatImpDeps[drawType][(int)FLOAT_INDEX(*pname)];
+
+ } /* for (i=0, pname = pNames... */
+
+ return (Success);
+
+} /* InquireImpDepConstants */
+
+/* now enumerated type info */
+
+/* again, these can theoretically vary depending on the drawable type
+ * and arrays bases on the imp dep drawable type are used again
+ */
+
+/* some of these are accessed in other code to make sure that only valid
+ * enum types are used, so they are not declared static
+ * the defined constants used with these are in miInfo.h
+ * TODO: make proceures to check for valid ets to call instead of
+ * declaring these global
+ */
+
+miEnumType miMarkerTypeET[MI_MAXDRAWABLES][SI_MARKER_NUM] = {
+ {{1, SI_MARKER_1},
+ {2, SI_MARKER_2},
+ {3, SI_MARKER_3},
+ {4, SI_MARKER_4},
+ {5, SI_MARKER_5}}
+};
+
+miEnumType miATextStyleET[MI_MAXDRAWABLES][SI_ATEXT_NUM] = {
+ {{1, SI_ATEXT_1},
+ {2, SI_ATEXT_2}}
+};
+
+miEnumType miInteriorStyleET[MI_MAXDRAWABLES][SI_INT_NUM] = {
+ {{1, SI_INT_1},
+ {2, SI_INT_2},
+ {5, SI_INT_5}}
+};
+
+/* hatches are not supported but put in a dummy */
+miEnumType miHatchStyleET[MI_MAXDRAWABLES][SI_HATCH_NUM + 1] = {
+ {{0, ""}}
+};
+
+miEnumType miLineTypeET[MI_MAXDRAWABLES][SI_LINE_NUM] = {
+ {{1, SI_LINE_1},
+ {2, SI_LINE_2},
+ {3, SI_LINE_3},
+ {4, SI_LINE_4}}
+};
+
+miEnumType miSurfaceEdgeTypeET[MI_MAXDRAWABLES][SI_EDGE_NUM] = {
+ {{1, SI_EDGE_1},
+ {2, SI_EDGE_2},
+ {3, SI_EDGE_3},
+ {4, SI_EDGE_4}}
+};
+
+miEnumType miPickDeviceTypeET[MI_MAXDRAWABLES][SI_PICK_DEVICE_NUM] = {
+ {{1, SI_PICK_DEVICE_1},
+ {2, SI_PICK_DEVICE_2}}
+};
+
+miEnumType miPickOneMethodET[MI_MAXDRAWABLES][SI_PICK_ONE_NUM] = {
+ {{1, SI_PICK_ONE_LAST}}
+};
+
+miEnumType miPickAllMethodET[MI_MAXDRAWABLES][SI_PICK_ALL_NUM] = {
+ {{1, SI_PICK_ALL_ALL}}
+};
+
+miEnumType miPolylineInterpMethodET[MI_MAXDRAWABLES][SI_LINE_INTERP_NUM] = {
+ {{1, SI_LINE_INTERP_1}}
+};
+
+miEnumType miCurveApproxMethodET[MI_MAXDRAWABLES][SI_CURVE_APPROX_NUM] = {
+ {{1, SI_CURVE_APPROX_1},
+ {2, SI_CURVE_APPROX_2},
+ {3, SI_CURVE_APPROX_3},
+ {4, SI_CURVE_APPROX_4},
+ {6, SI_CURVE_APPROX_6},
+ {7, SI_CURVE_APPROX_7}}
+};
+
+miEnumType miReflectionModelET[MI_MAXDRAWABLES][SI_REFLECT_NUM] = {
+ {{1, SI_REFLECT_1},
+ {2, SI_REFLECT_2},
+ {3, SI_REFLECT_3},
+ {4, SI_REFLECT_4}}
+};
+
+miEnumType miSurfaceInterpMethodET[MI_MAXDRAWABLES][SI_SURF_INTERP_NUM] = {
+ {{1, SI_SURF_INTERP_1}}
+};
+
+miEnumType miSurfaceApproxMethodET[MI_MAXDRAWABLES][SI_SURF_APPROX_NUM] = {
+ {{1, SI_SURF_APPROX_1},
+ {2, SI_SURF_APPROX_2},
+ {3, SI_SURF_APPROX_3},
+ {4, SI_SURF_APPROX_4},
+ {6, SI_SURF_APPROX_6},
+ {7, SI_SURF_APPROX_7}}
+};
+
+miEnumType miTrimCurveApproxMethodET[MI_MAXDRAWABLES][SI_TRIM_CURVE_NUM] = {
+ {{1, SI_TRIM_CURVE_1},
+ {2, SI_TRIM_CURVE_2}}
+};
+
+miEnumType miModelClipOperatorET[MI_MAXDRAWABLES][SI_MODEL_CLIP_NUM] = {
+ {{1, SI_MODEL_CLIP_1},
+ {2, SI_MODEL_CLIP_2}}
+};
+
+miEnumType miLightTypeET[MI_MAXDRAWABLES][SI_LIGHT_NUM] = {
+ {{1, SI_LIGHT_1},
+ {2, SI_LIGHT_2},
+ {3, SI_LIGHT_3},
+ {4, SI_LIGHT_4}}
+};
+
+miEnumType miColourTypeET[MI_MAXDRAWABLES][SI_COLOUR_NUM] = {
+ {{0, SI_COLOUR_0},
+ {1, SI_COLOUR_1}}
+};
+
+miEnumType miFloatFormatET[MI_MAXDRAWABLES][SI_FLOAT_NUM] = {
+ {{1, SI_FLOAT_1},
+ {2, SI_FLOAT_2}}
+};
+
+miEnumType miHlhsrModeET[MI_MAXDRAWABLES][SI_HLHSR_NUM] = {
+ {{1, SI_HLHSR_1}}
+};
+
+miEnumType miPromptEchoTypeET[MI_MAXDRAWABLES][SI_PET_NUM] = {
+ {{1, SI_PET_1}}
+};
+
+miEnumType miDisplayUpdateModeET[MI_MAXDRAWABLES][SI_UPDATE_NUM] = {
+ {{1, SI_UPDATE_1},
+ {2, SI_UPDATE_2},
+ {3, SI_UPDATE_3},
+ {4, SI_UPDATE_4},
+ {5, SI_UPDATE_5}}
+};
+
+miEnumType miColourApproxTypeET[MI_MAXDRAWABLES][SI_CLR_APPROX_TYPE_NUM] = {
+ {{1, SI_CLR_APPROX_TYPE_1},
+ {2, SI_CLR_APPROX_TYPE_2}}
+};
+
+miEnumType miColourApproxModelET[MI_MAXDRAWABLES][SI_CLR_APPROX_MODEL_NUM] = {
+ {{1, SI_CLR_APPROX_MODEL_1}}
+};
+
+/* put in a dummy */
+miEnumType miGDPET[MI_MAXDRAWABLES][SI_GDP_NUM + 1] = {
+ {{0, ""}}
+};
+
+/* put in a dummy */
+miEnumType miGDP3ET[MI_MAXDRAWABLES][SI_GDP3_NUM + 1] = {
+ {{0, ""}}
+};
+
+/* put in a dummy */
+miEnumType miGSEET[MI_MAXDRAWABLES][SI_GSE_NUM + 1] = {
+ {{0, ""}}
+};
+
+miEnumType miEscapeET[MI_MAXDRAWABLES][SI_ESCAPE_NUM] = {
+ {{1, SI_ESCAPE_1}}
+};
+
+miEnumType miRenderingColourModelET[MI_MAXDRAWABLES][SI_REND_COLOUR_NUM] = {
+ {{1, SI_REND_COLOUR_1}}
+};
+
+miEnumType miParametricSurfaceCharsET[MI_MAXDRAWABLES][SI_P_SURF_CHAR_NUM] = {
+ {{1, SI_P_SURF_CHAR_1},
+ {2, SI_P_SURF_CHAR_2},
+ {3, SI_P_SURF_CHAR_3}}
+};
+
+/* useful macros for putting et info into buffer */
+#define PUT_BUF32(buf, value) \
+ *(buf).C32++ = (value);
+
+#define PUT_BUF16(buf, value) \
+ *(buf).C16++ = (value);
+
+#define PUT_BUF8(buf, value) \
+ *(buf).C8++ = (value);
+
+#define PADDING(n) ( (n)&3 ? (4 - ((n)&3)) : 0)
+
+/* be sure k is defined before using this */
+/* size is the size of the string
+ * extra is 2 if the case is PEXETBoth, it's 0 for PEXETMnemonic
+ * this macro is not used for PEXETIndex
+ */
+#define PUT_STR(buf, string, size, extra) \
+ { \
+ PUT_BUF16(buf, size); \
+ for (k=0; k < size; k++) \
+ PUT_BUF8(buf, string[k]); \
+ k = PADDING( size + 2 + extra ); \
+ while (k) { \
+ PUT_BUF8( buf, 0 ); \
+ k--; \
+ } }
+
+/* macro to count space needed for et info */
+#define COUNT_ET( num, pet ) \
+ count+=4; /* space for returned num value */ \
+ switch (itemMask) \
+ { \
+ case PEXETIndex: /* return index values only */ \
+ count += (num << 1); \
+ /* add pad if necessary */ \
+ if (num & 1) \
+ count+=2; \
+ break; \
+ \
+ case PEXETMnemonic: /* return mnemonics only */ \
+ for (j=0; j<num; j++, pet++) \
+ { \
+ /* add length of string */ \
+ count += 2; \
+ /* then number of chars in string */ \
+ count += strlen((pet)->name); \
+ /* then pads for string (and its length) */\
+ count += PADDING(strlen((pet)->name) + 2);\
+ } \
+ break; \
+ \
+ case PEXETBoth: /* return index and mnemonic */ \
+ for (j=0; j<num; j++, pet++) \
+ { \
+ /* add index */ \
+ count += 2; \
+ /* add length of string */ \
+ count += 2; \
+ /* then number of chars in string */ \
+ count += strlen((pet)->name); \
+ /* then pads for string */ \
+ count += PADDING( strlen((pet)->name) );\
+ } \
+ break; \
+ \
+ } /* switch (itemMask) */
+
+/* macro to put hard coded et info into buffer */
+#define GET_ET( num, pet ) \
+ /* always increment the list count and return the number of types */\
+ (*pNumLists)++; \
+ PUT_BUF32(pbuf, (num)); \
+ /* now put in the index and/or mnemonic */ \
+ switch (itemMask) \
+ { \
+ case PEXETIndex: /* return index values only */ \
+ for (j=0; j<(num); j++, pet++) \
+ PUT_BUF16(pbuf, (pet)->index); \
+ /* add pad if necessary */ \
+ if ((num) & 1) \
+ PUT_BUF16(pbuf, 0); \
+ break; \
+ \
+ case PEXETMnemonic: /* return mnemonics only */ \
+ for (j=0; j<(num); j++, pet++) \
+ { \
+ size = strlen( (pet)->name ); \
+ /* PUT_STR pads end of string */ \
+ PUT_STR(pbuf, (pet)->name, size, 0); \
+ } \
+ break; \
+ \
+ case PEXETBoth: /* return index and mnemonic */ \
+ for (j=0; j<(num); j++, pet++) \
+ { \
+ size = strlen( (pet)->name ); \
+ PUT_BUF16(pbuf, (pet)->index); \
+ /* PUT_STR pads end of string */ \
+ PUT_STR(pbuf, (pet)->name, size, 2); \
+ } \
+ break; \
+ \
+ } /* switch (itemMask) */
+
+#define DO_ET(num, pet) \
+ if ( counting ) \
+ { \
+ COUNT_ET( num, pet ); \
+ } \
+ else \
+ { \
+ GET_ET( num, pet ) \
+ }
+
+/*++
+ |
+ | Function Name: InquireEnumTypeInfo
+ |
+ | Function Description:
+ | Handles the PEXGetEnumTypeInfo request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+InquireEnumTypeInfo(pDrawable, itemMask, numEnumTypes, pEnumTypeList, pNumLists, pBuffer)
+/* in */
+ DrawablePtr pDrawable;
+ ddBitmask itemMask;
+ ddULONG numEnumTypes;
+ ddUSHORT *pEnumTypeList;
+/* out */
+ ddULONG *pNumLists;
+ ddBufferPtr pBuffer;
+{
+ register union
+ {
+ ddULONG *C32;
+ ddUSHORT *C16;
+ ddBYTE *C8;
+ } pbuf;
+
+ register int drawType;
+ register ddUSHORT *ptype;
+ register unsigned i,
+ j,
+ k;
+ ddUSHORT size;
+ short counting;
+ int count;
+ ddULONG num;
+ miEnumType *pet;
+
+ MI_WHICHDRAW(pDrawable, drawType);
+
+ *pNumLists = 0;
+ count = 0;
+ pBuffer->dataSize = 0;
+
+ /*
+ * loop twice. the first time, count buffer size needed second time,
+ * fill the buffer
+ */
+ for (counting = 1; counting >= 0; counting--)
+ {
+
+ /*
+ * be sure to put this here in case the buffer is realloc'd after the
+ * first time throught
+ */
+ pbuf.C32 = (ddULONG *) pBuffer->pBuf;
+ for (i = numEnumTypes, ptype = pEnumTypeList; i > 0; i--, ptype++)
+ {
+ /* process each enum request */
+
+ /*
+ * this is all hard coded (in miInfo.h) for the SI replace as
+ * needed if you don't want it hard coded
+ */
+ switch (*ptype)
+ {
+ case PEXETMarkerType:
+ num = SI_MARKER_NUM;
+ pet = &miMarkerTypeET[drawType][0];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETATextStyle:
+ num = SI_ATEXT_NUM;
+ pet = miATextStyleET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETInteriorStyle:
+ num = SI_INT_NUM;
+ pet = miInteriorStyleET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETHatchStyle:
+ num = SI_HATCH_NUM;
+ pet = miHatchStyleET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETLineType:
+ num = SI_LINE_NUM;
+ pet = miLineTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETSurfaceEdgeType:
+ num = SI_EDGE_NUM;
+ pet = miSurfaceEdgeTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETPickDeviceType:
+ num = SI_PICK_DEVICE_NUM;
+ pet = miPickDeviceTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETPolylineInterpMethod:
+ num = SI_LINE_INTERP_NUM;
+ pet = miPolylineInterpMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETCurveApproxMethod:
+ num = SI_CURVE_APPROX_NUM;
+ pet = miCurveApproxMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETReflectionModel:
+ num = SI_REFLECT_NUM;
+ pet = miReflectionModelET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETSurfaceInterpMethod:
+ num = SI_SURF_INTERP_NUM;
+ pet = miSurfaceInterpMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETSurfaceApproxMethod:
+ num = SI_SURF_APPROX_NUM;
+ pet = miSurfaceApproxMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETModelClipOperator:
+ num = SI_MODEL_CLIP_NUM;
+ pet = miModelClipOperatorET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETLightType:
+ num = SI_LIGHT_NUM;
+ pet = miLightTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETColourType:
+ num = SI_COLOUR_NUM;
+ pet = miColourTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETFloatFormat:
+ num = SI_FLOAT_NUM;
+ pet = miFloatFormatET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETHlhsrMode:
+ num = SI_HLHSR_NUM;
+ pet = miHlhsrModeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETPromptEchoType:
+ num = SI_PET_NUM;
+ pet = miPromptEchoTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETDisplayUpdateMode:
+ num = SI_UPDATE_NUM;
+ pet = miDisplayUpdateModeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETColourApproxType:
+
+ /*
+ * The colour approximation type is based on the depth of the
+ * drawable - > 8 bits implies indexed otherwise colorspace
+ */
+ num = SI_CLR_APPROX_TYPE_NUM;
+ pet = miColourApproxTypeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETColourApproxModel:
+ num = SI_CLR_APPROX_MODEL_NUM;
+ pet = miColourApproxModelET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETGDP:
+ num = SI_GDP_NUM;
+ pet = miGDPET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETGDP3:
+ num = SI_GDP3_NUM;
+ pet = miGDP3ET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETGSE:
+ num = SI_GSE_NUM;
+ pet = miGSEET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETTrimCurveApproxMethod:
+ num = SI_TRIM_CURVE_NUM;
+ pet = miTrimCurveApproxMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETRenderingColourModel:
+ num = SI_REND_COLOUR_NUM;
+ pet = miRenderingColourModelET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETParaSurfCharacteristics:
+ num = SI_P_SURF_CHAR_NUM;
+ pet = miParametricSurfaceCharsET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETEscape:
+ num = SI_ESCAPE_NUM;
+ pet = miEscapeET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETPickOneMethod:
+ num = SI_PICK_ONE_NUM;
+ pet = miPickOneMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ case PEXETPickAllMethod:
+ num = SI_PICK_ALL_NUM;
+ pet = miPickAllMethodET[drawType];
+ DO_ET(num, pet);
+ break;
+
+ } /* switch (*ptype) */
+
+ } /* for (i=0, ptype = pEnumTypeList) */
+
+ if (counting)
+ {
+ PU_CHECK_BUFFER_SIZE(pBuffer, count);
+ }
+ } /* for (counting >= 0) */
+
+ pBuffer->dataSize = count;
+ return (Success);
+} /* InquireEnumTypeInfo */
+
+/*************************************************************************
+ * macro for MatchRendererTargets.
+ */
+
+/* 30 is arbitrary constant */
+#define ADD_TRIPLET(d,t,v) { int diff; \
+ if ((pexBuffer->dataSize + sizeof(pexRendererTarget)) > \
+ pexBuffer->bufSize){\
+ diff = (unsigned long)p - (unsigned long)pexBuffer->pBuf; \
+ puBuffRealloc(pexBuffer,pexBuffer->bufSize + \
+ 30*sizeof(pexRendererTarget)); \
+ p = (pexRendererTarget *)(((unsigned long)pexBuffer->pBuf) +diff);\
+ } \
+ p->depth = (d); \
+ p->type = (t); \
+ p->visualID = (v); \
+ pexBuffer->dataSize += sizeof(pexRendererTarget); \
+ p++; nTargets++; \
+ if (nTargets >= maxTriplets) return (Success); \
+ }
+/*++
+ |
+ | Function Name: MatchRendererTargets
+ |
+ | Function Description:
+ | Handles Match Renderer Taregets Request.
+ | Given a visualID, depth & drawable type, tell whether PEX will
+ | render into it. Real life: PEX does not do all drawables.
+ |
+ | Note(s):
+ |
+ --*/
+
+
+ddpex43rtn
+MatchRendererTargets(pDraw, depth, drawType, visualID, maxTriplets, pexBuffer)
+ DrawablePtr pDraw;
+ int depth;
+ int drawType;
+ VisualID visualID;
+ int maxTriplets;
+ ddBuffer *pexBuffer;
+{
+ int i;
+ int nTargets = 0;
+
+ register ScreenPtr pScreen;
+ int idepth, ivisual;
+ DepthPtr pDepth;
+
+ pexRendererTarget *p = (pexRendererTarget *)pexBuffer->pBuf;
+
+/*
+ * Code originally lifted from CreateWindow (x11/server/dix/window.c)
+ */
+ pScreen = pDraw->pScreen;
+
+ for(idepth = 0; idepth < pScreen->numDepths; idepth++) {
+
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
+
+ /*
+ * if depth is wild carded, then we need to walk them all.
+ */
+ if ((depth == pDepth->depth) || (depth == 0)) {
+
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
+
+ /* if visual is a match or it's wildcarded then do it */
+ if ((visualID == pDepth->vids[ivisual]) || (visualID == 0)) {
+ /*
+ * Here is the moment of truth, this is just going to say
+ * that everything is available for PEX rendering. It is possible
+ * that vendors will want to create a global table that hangs
+ * around. That way they can be qualified in ddpexInit().
+ * If compiled with -DMULTIBUFFER it assumes that mutli buffers
+ * are fair game.
+ */
+ if ((drawType == PEXWindow) || (drawType == PEXDontCare))
+ ADD_TRIPLET(pDepth->depth, PEXWindow, pDepth->vids[ivisual] );
+ if ((drawType == PEXPixmap) || (drawType == PEXDontCare))
+ ADD_TRIPLET(pDepth->depth, PEXPixmap, pDepth->vids[ivisual] );
+#ifdef MULTIBUFFER
+ if ((drawType == PEXBuffer) || (drawType == PEXDontCare))
+ ADD_TRIPLET(pDepth->depth, PEXBuffer, pDepth->vids[ivisual] );
+#endif
+ }
+ }
+ }
+ }
+ return (Success);
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miNS.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miNS.c
new file mode 100644
index 000000000..fb745162e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miNS.c
@@ -0,0 +1,446 @@
+/* $TOG: miNS.c /main/4 1998/02/10 12:45:17 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miNS.c,v 1.8 1999/01/31 12:21:31 dawes Exp $ */
+
+#include "mipex.h"
+#include "miNS.h"
+#include "miWks.h"
+#include "PEXErr.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Name Set Procedures */
+
+/* DELETE_DD_NS is used to delete just the dd part of a resource */
+
+/* CHECK_DELETE is used to see if the resource has been freed and is
+ * no longer being used. If so, then the entire resource storage is
+ * freed, including the ddNSResource part
+ */
+
+#define DELETE_DD_NS( phead ) \
+ puDeleteList((phead)->wksRefList); \
+ puDeleteList((phead)->rendRefList); \
+ xfree(phead)
+
+#define CHECK_DELETE(pns,phead) \
+ if ( (phead)->freeFlag && !((phead)->refCount) && \
+ !((phead)->wksRefList->numObj) && !((phead)->rendRefList->numObj) ) \
+ { \
+ DELETE_DD_NS( phead ); \
+ xfree(pns); \
+ }
+static ddpex4rtn dynerr;
+extern ddpex4rtn miDealWithNSDynamics();
+
+/*++
+ |
+ | Function Name: CreateNameSet
+ |
+ | Function Description:
+ | Handles the PEXCreateNameSet request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+CreateNameSet(pNS)
+/* in */
+ diNSHandle pNS; /* name set handle */
+/* out */
+{
+ miNSHeader *pheader;
+
+#ifdef DDTEST
+ ErrorF( "\nCreateNameSet \n");
+#endif
+
+ pNS->deviceData = NULL;
+
+ if ((pheader = (miNSHeader *) xalloc(sizeof(miNSHeader))) == NULL)
+ {
+ pNS->deviceData = NULL;
+ return (BadAlloc);
+ }
+ if (!(pheader->wksRefList = puCreateList(DD_WKS)))
+ {
+ xfree(pheader);
+ return (BadAlloc);
+ }
+
+ if (!(pheader->rendRefList = puCreateList(DD_RENDERER)))
+ {
+ puDeleteList(pheader->wksRefList);
+ xfree(pheader);
+ return (BadAlloc);
+ }
+
+ pheader->nameCount = 0;
+ pheader->refCount = 0;
+ pheader->freeFlag = MI_FALSE;
+ MINS_EMPTY_NAMESET(pheader->names);
+
+ pNS->deviceData = (ddPointer) pheader;
+ return (Success);
+} /* CreateNameSet */
+
+
+static void
+mins_rend_changes(pNS, pheader)
+ diNSHandle pNS;
+ miNSHeader *pheader;
+{
+ register int i;
+ ddRendererPtr *pprend;
+
+ pprend = (ddRendererPtr *)pheader->rendRefList->pList;
+ for (i=0; i<pheader->rendRefList->numObj; i++, pprend++)
+ {
+ if ((pNS == (*pprend)->ns[DD_HIGH_INCL_NS]) ||
+ (pNS == (*pprend)->ns[DD_HIGH_EXCL_NS]))
+ (*pprend)->namesetsChanges |= PEXDynHighlightNamesetContents;
+ else
+ if ((pNS == (*pprend)->ns[DD_INVIS_INCL_NS]) ||
+ (pNS == (*pprend)->ns[DD_INVIS_EXCL_NS]))
+ (*pprend)->namesetsChanges |= PEXDynInvisibilityNamesetContents;
+ }
+}
+
+static void
+mins_wks_changes(pNS, pheader)
+ diNSHandle pNS;
+ miNSHeader *pheader;
+{
+ register int i;
+ diWKSHandle *phandle;
+ miWksPtr pwks;
+
+ if (pheader->wksRefList->numObj)
+ {
+ phandle = (diWKSHandle *)pheader->wksRefList->pList;
+ for (i=0; i<pheader->wksRefList->numObj; i++, phandle++)
+ {
+ pwks = (miWksPtr)((*phandle)->deviceData);
+ if ((pNS == pwks->pRend->ns[DD_HIGH_INCL_NS]) ||
+ (pNS == pwks->pRend->ns[DD_HIGH_EXCL_NS]))
+ pwks->pRend->namesetsChanges |= PEXDynHighlightNamesetContents;
+ else if ((pNS == pwks->pRend->ns[DD_INVIS_INCL_NS]) ||
+ (pNS == pwks->pRend->ns[DD_INVIS_EXCL_NS]))
+ pwks->pRend->namesetsChanges |= PEXDynInvisibilityNamesetContents;
+ }
+ }
+}
+
+/*++
+ |
+ | Function Name: CopyNameSet
+ |
+ | Function Description:
+ | Handles the PEXCopyNameSet request.
+ |
+ | Note(s):
+ both name set handles assumed to be valid
+ |
+ --*/
+
+ddpex43rtn
+CopyNameSet(pSrcNS, pDestNS)
+/* in */
+ diNSHandle pSrcNS; /* pointer to source name set */
+ diNSHandle pDestNS; /* pointer to destination name set */
+/* out */
+{
+ miNSHeader *psource = (miNSHeader *) pSrcNS->deviceData;
+ miNSHeader *pdest = (miNSHeader *) pDestNS->deviceData;
+
+#ifdef DDTEST
+ ErrorF( "\nCopyNameSet \n");
+#endif
+
+ MINS_COPY_NAMESET(psource->names, pdest->names);
+ pdest->nameCount = psource->nameCount;
+
+ mins_wks_changes(pDestNS, pdest);
+ mins_rend_changes(pDestNS, pdest);
+
+ dynerr = miDealWithNSDynamics(pDestNS);
+ return (Success);
+} /* CopyNameSet */
+
+/*++
+ |
+ | Function Name: FreeNameSet
+ |
+ | Function Description:
+ | Deletes all of the storage used by the name set if there are no resources
+ | using it, otherwise it sets the free flag in the name set. This function
+ | is registered with the resource id and handle by diPEX with AddResource.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+FreeNameSet(pNS, NSid)
+/* in */
+ diNSHandle pNS; /* name set handle */
+ ddResourceId NSid; /* name set resource id */
+/* out */
+{
+ miNSHeader *pheader = (miNSHeader *) pNS->deviceData;
+
+#ifdef DDTEST
+ ErrorF( "\nFreeNameSet \n");
+#endif
+
+ pheader->freeFlag = MI_TRUE;
+ pNS->id = PEXAlreadyFreed;
+ CHECK_DELETE(pNS, pheader);
+
+ return (Success);
+} /* FreeNameSet */
+
+/*++
+ |
+ | Function Name: InquireNameSet
+ |
+ | Function Description:
+ | Handles the PEXGetNameSet request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+InquireNameSet(pNS, pNumNames, pBuffer)
+/* in */
+ diNSHandle pNS; /* name set handle */
+/* out */
+ ddULONG *pNumNames;/* number of names in list */
+ ddBufferPtr pBuffer; /* list of names */
+{
+ register short i;
+ register ddULONG *pbuf;
+ miNSHeader *pheader = (miNSHeader *) pNS->deviceData;
+ ddULONG dsize;
+
+#ifdef DDTEST
+ ErrorF( "\nInquireNameSet \n");
+#endif
+
+ *pNumNames = 0;
+ dsize = pheader->nameCount * sizeof(ddULONG);
+
+ PU_CHECK_BUFFER_SIZE(pBuffer, dsize);
+
+ *pNumNames = pheader->nameCount;
+ pBuffer->dataSize = dsize;
+
+ if (!pheader->nameCount)
+ return(Success);
+
+ pbuf = (ddULONG *)pBuffer->pBuf;
+ for (i = MINS_MIN_NAME; i <= MINS_MAX_NAME; i++)
+ if ( MINS_IS_NAME_IN_SET(i, pheader->names) )
+ *pbuf++ = i;
+
+ return (Success);
+} /* InquireNameSet */
+
+/*++
+ |
+ | Function Name: ChangeNameSet
+ |
+ | Function Description:
+ | Handles the PEXChangeNameSet request.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+ChangeNameSet(pNS, action, numNames, pNames)
+/* in */
+ diNSHandle pNS; /* name set handle */
+ ddUSHORT action; /* (add/remove/replace) */
+ ddUSHORT numNames; /* number of names in list */
+ ddULONG *pNames; /* list of names */
+/* out */
+{
+ miNSHeader *pheader = (miNSHeader *) pNS->deviceData;
+ ddULONG *pn;
+
+#ifdef DDTEST
+ ErrorF( "\nChangeNameSet \n");
+#endif
+
+ switch (action)
+ {
+ case PEXNSReplace:
+
+#ifdef DDTEST
+ ErrorF( "\tREPLACE\n");
+#endif
+ pheader->nameCount = 0;
+ MINS_EMPTY_NAMESET(pheader->names);
+ /* continue to add */
+
+ case PEXNSAdd:
+
+#ifdef DDTEST
+ ErrorF( "\tADD\n");
+#endif
+
+ /* ignores any values that are out of range */
+ for (pn = pNames; numNames > 0; numNames--, pn++)
+ if ( MINS_VALID_NAME(*pn) &&
+ !MINS_IS_NAME_IN_SET(*pn, pheader->names) )
+ {
+ pheader->nameCount++;
+ MINS_ADD_TO_NAMESET(*pn, pheader->names);
+ }
+ break;
+
+ case PEXNSRemove:
+
+#ifdef DDTEST
+ ErrorF( "\tREMOVE\n");
+#endif
+
+ for (pn = pNames; numNames > 0; numNames--, pn++)
+ if ( MINS_VALID_NAME(*pn) &&
+ MINS_IS_NAME_IN_SET(*pn, pheader->names) )
+ {
+ pheader->nameCount--;
+ MINS_REMOVE_FROM_NAMESET(*pn, pheader->names);
+ }
+ break;
+
+ default:
+ /* better not get here */
+ return (BadValue);
+ break;
+ }
+
+ mins_wks_changes(pNS, pheader);
+ mins_rend_changes(pNS, pheader);
+
+ /* update the picture if necessary */
+ dynerr = miDealWithNSDynamics(pNS);
+ return (Success);
+} /* ChangeNameSet */
+
+/*++
+ |
+ | Function Name: UpdateNSRefs
+ |
+ | Function Description:
+ | Utility function to update a cross-reference list in the name set. Each
+ | name set has two lists, one for workstations and one for renderers. The
+ | lists are of handles of the resources which are using the name set.
+ |
+ | Note(s):
+ |
+ --*/
+
+ddpex43rtn
+UpdateNSRefs(pNS, pResource, which, action)
+/* in */
+ diNSHandle pNS; /* name set handle */
+ diResourceHandle pResource;/* workstation or renderer handle */
+ ddResourceType which; /* wks renderer or pick device */
+ ddAction action; /* add or remove */
+/* out */
+{
+ miNSHeader *pheader = (miNSHeader *) pNS->deviceData;
+
+#ifdef DDTEST
+ ErrorF( "\nUpdateNSRefs \n");
+#endif
+
+ switch (which)
+ {
+ case WORKSTATION_RESOURCE:
+ if (action == ADD)
+ {
+ if (puAddToList((ddPointer) & pResource, (ddULONG) 1,
+ pheader->wksRefList) == MI_ALLOCERR)
+ return (BadAlloc);
+ } else
+ puRemoveFromList((ddPointer) & pResource, pheader->wksRefList);
+ break;
+
+ case SEARCH_CONTEXT_RESOURCE:
+ case PICK_RESOURCE:
+ if (action == ADD)
+ pheader->refCount++;
+ else
+ if (pheader->refCount)
+ pheader->refCount--;
+ break;
+
+ case RENDERER_RESOURCE:
+
+ if (action == ADD)
+ {
+ if (puAddToList((ddPointer) & pResource, (ddULONG) 1,
+ pheader->rendRefList))
+ return (BadAlloc);
+ } else
+ puRemoveFromList((ddPointer) & pResource, pheader->rendRefList);
+
+ break;
+
+ default: /* better not get here */
+ return (BadValue);
+ break;
+ }
+ CHECK_DELETE(pNS, pheader);
+ return (Success);
+} /* UpdateNSRefs */
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miPattLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miPattLUT.c
new file mode 100644
index 000000000..ccf236de3
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miPattLUT.c
@@ -0,0 +1,433 @@
+/* $TOG: miPattLUT.c /main/5 1998/02/10 12:45:24 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miPattLUT.c,v 1.7 1998/10/04 09:34:52 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+/* pattern tables don't have to be implemented. define PEX_PATTERN_LUT
+ * here if they are
+ */
+/* PEX-SI officially doesn't implement pattern tables, but the
+ * API doesn't handle it correctly yet if they aren't implemented,
+ * so pretend that they are
+ */
+#define PEX_PATTERN_LUT
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXPatternLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddPatternEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miPatternEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexPatternEntry
+
+#define LUT_REND_DYN_BIT PEXDynPatternTableContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 0
+#define LUT_0_NUM_PREDEFINED 0
+#define LUT_0_PREDEFINED_MIN 0
+#define LUT_0_PREDEFINED_MAX 0
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.pattern
+
+#define DYNAMIC PATTERN_TABLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+
+#define PDE_NUMX 1
+#define PDE_NUMY 1
+
+#if LUT_0_NUM_PREDEFINED
+static DD_LUT_ENTRY_STR pdePatternEntry[LUT_0_NUM_PREDEFINED];
+static ddIndexedColour pdeColours[PDE_NUMX][PDE_NUMY] = {};
+#else /* use dummies so things compile */
+static DD_LUT_ENTRY_STR pdePatternEntry[1];
+static ddIndexedColour pdeColours[PDE_NUMX][PDE_NUMY] = {1};
+#endif /* LUT_0_NUM_PREDEFINED */
+
+#define LUT_PDE_ENTRIES pdePatternEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->entry.colours.indexed = (ddIndexedColour *)xalloc( \
+ (pentry)->entry.numx * (pentry)->entry.numy * sizeof(colour_type_sizes[(int)(pentry)->entry.colourType])); \
+ mibcopy((pdeentry)->colours.indexed, (pentry)->entry.colours.indexed, \
+ (pentry)->entry.numx * (pentry)->entry.numy * sizeof(colour_type_sizes[(int)(pentry)->entry.colourType]))
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdePatternEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry.numx = 0; \
+ (pentry)->entry.numy = 0
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+/* if pattern tables are implemented, use these procedures in
+ * miLUTProcs.h; the other procs are defined below.
+ * if pattern tables aren't implemented, then the create proc
+ * returns an error and so there won't be a pattern table
+ * (dipex will get bad XID for other requests on the table)
+ */
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+/* #define LUT_USE_COPY */
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+/* #define LUT_USE_CREATE */
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE PatternLUT_free
+#define LUT_INQ_PREDEF PatternLUT_inq_predef
+#define LUT_INQ_ENTRIES PatternLUT_inq_entries
+*/
+#define LUT_COPY PatternLUT_copy
+#define LUT_INQ_INFO PatternLUT_inq_info
+#define LUT_INQ_IND PatternLUT_inq_ind
+#define LUT_INQ_ENTRY PatternLUT_inq_entry
+#define LUT_SET_ENTRIES PatternLUT_set_entries
+#define LUT_DEL_ENTRIES PatternLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS PatternLUT_inq_entry_address
+#define LUT_CREATE PatternLUT_create
+#define LUT_ENTRY_CHECK PatternLUT_entry_check
+#define LUT_COPY_PEX_MI PatternLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX PatternLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK PatternLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ mibcopy(pdev_entry->colours.indexed, pb,
+ pdev_entry->numx * pdev_entry->numy * colour_type_sizes[(int)pdev_entry->colourType]);
+
+ pb += pdev_entry->numx * pdev_entry->numy * colour_type_sizes[(int)pdev_entry->colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+ ddULONG xy1, xy2;
+ ddSHORT colourType;
+
+ xy1 = pentry->entry.numx * pentry->entry.numy;
+ colourType = pentry->entry.colourType;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ xy2 = pentry->entry.numx * pentry->entry.numy;
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ if ((xy1 * colour_type_sizes[(int)colourType]) <
+ (xy2 * colour_type_sizes[(int)pentry->entry.colourType]))
+ {
+ pentry->entry.colours.indexed = (ddIndexedColour *)xrealloc(
+ pentry->entry.colours.indexed,
+ xy2 * colour_type_sizes[(int)pentry->entry.colourType]);
+ if (!pentry->entry.colours.indexed)
+ return(BadAlloc);
+ }
+
+ mibcopy(ps, pentry->entry.colours.indexed,
+ xy2 * colour_type_sizes[(int)pentry->entry.colourType]);
+
+ ps += xy2 * colour_type_sizes[(int)pentry->entry.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+ ddULONG xy;
+
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ xy = (*ppPexEntry)->numx * (*ppPexEntry)->numy;
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ xy * colour_type_sizes[(int)(*ppPexEntry)->colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+
+ return(Success);
+}
+
+void
+PatternLUT_init_pde()
+{
+#ifdef PEX_PATTERN_LUT
+#if LUT_0_NUM_PREDEFINED
+ pdePatternEntry[0].colourType = PEXIndexedColour;
+ pdePatternEntry[0].numx = PDE_NUMX;
+ pdePatternEntry[0].numy = PDE_NUMY;
+ pdePatternEntry[0].colours.indexed = &pdeColours[0][0];
+#endif /* LUT_0_NUM_PREDEFINED */
+#endif /* PEX_PATTERN_LUT */
+}
+
+#include "miLUTProcs.ci"
+
+ddpex43rtn
+LUT_COPY (pSrcLUT, pDestLUT)
+/* in */
+ diLUTHandle pSrcLUT; /* source lookup table */
+ diLUTHandle pDestLUT; /* destination lookup table */
+/* out */
+{
+ MILUT_DEFINE_HEADER(pSrcLUT, srcHeader);
+ MILUT_DEFINE_HEADER(pDestLUT, destHeader);
+ register int i;
+ MI_LUT_ENTRY_STR *pDestEntry;
+ MI_LUT_ENTRY_STR *pSrcEntry;
+ ddpex43rtn err;
+ ddIndexedColour *psaveColours;
+ ddULONG xy;
+ ddSHORT saveType;
+
+#ifdef DDTEST
+ ErrorF( "\ncopy src lut %d type %d\n", pSrcLUT->id, pSrcLUT->lutType);
+ ErrorF( "\ncopy dest lut %d type %d\n", pDestLUT->id, pDestLUT->lutType);
+#endif
+
+ /* set all entries to undefined */
+ pDestEntry = LUT_TABLE_START(destHeader);
+ MILUT_SET_STATUS(pDestEntry, MILUT_ALLOC_ENTS(destHeader), MILUT_UNDEFINED, MI_FALSE);
+
+ /* copy entries */
+ pDestEntry = LUT_TABLE_START(destHeader);
+ pSrcEntry = LUT_TABLE_START(srcHeader);
+
+ for (i = MILUT_START_INDEX(srcHeader); i < MILUT_ALLOC_ENTS(srcHeader); i++)
+ {
+ xy = pDestEntry->entry.numx * pDestEntry->entry.numy;
+ psaveColours = pDestEntry->entry.colours.indexed;
+ saveType = pDestEntry->entry.colourType;
+
+ mibcopy(pSrcEntry, pDestEntry, sizeof(miPatternEntry));
+
+ /* copy colours */
+ pDestEntry->entry.colours.indexed = psaveColours;
+ if ( (xy * colour_type_sizes[(int)saveType]) <
+ (pSrcEntry->entry.numx * pSrcEntry->entry.numy *
+ colour_type_sizes[(int)pSrcEntry->entry.colourType]) )
+ {
+ pDestEntry->entry.colours.indexed =
+ (ddIndexedColour *)xrealloc(pDestEntry->entry.colours.indexed,
+ (pSrcEntry->entry.numx * pSrcEntry->entry.numy *
+ colour_type_sizes[(int)pSrcEntry->entry.colourType]));
+ if (!pDestEntry->entry.colours.indexed)
+ return(BadAlloc);
+ }
+ mibcopy( pSrcEntry->entry.colours.indexed, pDestEntry->entry.colours.indexed,
+ (pSrcEntry->entry.numx * pSrcEntry->entry.numy *
+ colour_type_sizes[(int)pSrcEntry->entry.colourType]) );
+ pSrcEntry++;
+ pDestEntry++;
+ }
+
+ MILUT_NUM_ENTS(destHeader) = MILUT_NUM_ENTS(srcHeader);
+
+ err = Success;
+
+#ifdef DYNAMIC
+ if (destHeader->wksRefList->numObj)
+ err = miDealWithDynamics( DYNAMIC, destHeader->wksRefList );
+#endif /* DYNAMIC */
+
+ err = destHeader->ops[MILUT_REQUEST_OP(milut_mod_call_back)](pDestLUT,
+ MILUT_START_INDEX(destHeader), MILUT_DEF_ENTS(destHeader),
+ MILUT_COPY_MOD);
+ /* check err here if your call back proc can return an error */
+ if (err != Success) return(err);
+
+ return (err);
+}
+
+ddpex43rtn
+LUT_CREATE (pLUT, pheader)
+/* in */
+ diLUTHandle pLUT; /* lut handle */
+ miLUTHeader *pheader; /* lut header */
+/* out */
+{
+ register int i;
+ MI_LUT_ENTRY_STR *pentry;
+ DD_LUT_ENTRY_STR *pdeentry;
+
+#ifdef DDTEST
+ ErrorF( "\ncreate lut %d type %d\n", pLUT->id, pLUT->lutType);
+#endif
+
+#ifndef PEX_PATTERN_LUT
+ return(PEXERR(PEXLookupTableError));
+#else
+
+ MILUT_START_INDEX(pheader) = LUT_START_INDEX;
+ MILUT_DEFAULT_INDEX(pheader) = LUT_DEFAULT_INDEX;
+ MILUT_NUM_ENTS(pheader) = 0;
+ SET_TABLE_INFO( pheader->drawType, &(pheader->tableInfo) );
+
+ if (MILUT_ALLOC_ENTS(pheader) == 0)
+ {
+ LUT_TABLE_START(pheader) = NULL;
+ }
+ else if ((LUT_TABLE_START(pheader) = (MI_LUT_ENTRY_STR *)
+ xalloc(MILUT_ALLOC_ENTS(pheader) * sizeof(MI_LUT_ENTRY_STR)))
+ == NULL)
+ {
+ MILUT_DESTROY_HEADER(pheader);
+ return(BadAlloc);
+ }
+
+ pentry = LUT_TABLE_START(pheader);
+ MILUT_SET_STATUS(pentry, MILUT_ALLOC_ENTS(pheader), MILUT_UNDEFINED, MI_TRUE);
+
+ pentry = LUT_TABLE_START(pheader);
+ for (i=0; i<MILUT_ALLOC_ENTS(pheader); i++, pentry++)
+ {
+ pentry->entry.numx=0; pentry->entry.numy=0;
+ pentry->entry.colourType=0;
+ pentry->entry.colours.indexed = (ddIndexedColour *)NULL;
+ }
+
+ /* if there are predefined entries, put them in */
+ if (MILUT_PRENUM(pheader))
+ {
+ pentry = LUT_TABLE_START(pheader) + MILUT_PREMIN(pheader);
+ pdeentry = &(LUT_PDE_ENTRIES);
+
+ for (i=MILUT_PREMIN(pheader);
+ i<=MILUT_PREMAX(pheader); i++, pentry++, pdeentry++)
+ {
+ pentry->entry_info.status = MILUT_PREDEFINED;
+ pentry->entry_info.index = i;
+ pentry->entry = *pdeentry;
+ pentry->entry.colours.indexed = (ddIndexedColour *)xalloc(
+ pentry->entry.numx * pentry->entry.numy * sizeof(colour_type_sizes[(int)pentry->entry.colourType]));
+ mibcopy(pdeentry->colours.indexed, pentry->entry.colours.indexed,
+ pentry->entry.numx * pentry->entry.numy * sizeof(colour_type_sizes[(int)pentry->entry.colourType]));
+ pheader->numDefined++;
+ }
+ }
+
+ pheader->ops[MILUT_REQUEST_OP(PEX_CreateLookupTable)] = LUT_CREATE;
+ pheader->ops[MILUT_REQUEST_OP(PEX_CopyLookupTable)] = LUT_COPY;
+ pheader->ops[MILUT_REQUEST_OP(PEX_FreeLookupTable)] = LUT_FREE;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableInfo)] = LUT_INQ_INFO;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetPredefinedEntries)] = LUT_INQ_PREDEF;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetDefinedIndices)] = LUT_INQ_IND;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableEntry)] = LUT_INQ_ENTRY;
+ pheader->ops[MILUT_REQUEST_OP(PEX_GetTableEntries)] = LUT_INQ_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(PEX_SetTableEntries)] = LUT_SET_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(PEX_DeleteTableEntries)] = LUT_DEL_ENTRIES;
+ pheader->ops[MILUT_REQUEST_OP(milut_InquireEntryAddress)] = LUT_INQ_ENTRY_ADDRESS;
+ pheader->ops[MILUT_REQUEST_OP(milut_entry_check)] = LUT_ENTRY_CHECK;
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_pex_to_mi)] = LUT_COPY_PEX_MI;
+ pheader->ops[MILUT_REQUEST_OP(milut_copy_mi_to_pex)] = LUT_COPY_MI_PEX;
+
+ pLUT->deviceData = (ddPointer) pheader;
+ return (Success);
+#endif /* PEX_PATTERN_LUT */
+}
+
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miTextLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miTextLUT.c
new file mode 100644
index 000000000..0f0b0af19
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miTextLUT.c
@@ -0,0 +1,257 @@
+/* $TOG: miTextLUT.c /main/3 1998/02/10 12:45:30 kaleb $ */
+
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miTextLUT.c,v 1.7 1998/10/04 09:34:53 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXTextBundleLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddTextBundleEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miTextBundleEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexTextBundleEntry
+
+#define LUT_REND_DYN_BIT PEXDynTextBundleContents
+
+#define LUT_START_INDEX 1
+#define LUT_DEFAULT_INDEX 1
+#define LUT_0_DEFINABLE_ENTRIES 20
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 1
+#define LUT_0_PREDEFINED_MAX 1
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.text
+
+#define DYNAMIC TEXT_BUNDLE_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeTextBundleEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeTextBundleEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ (pentry)->real_entry = *(pdeentry)
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeTextBundleEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ (pentry)->real_entry = LUT_DEFAULT_VALUES
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE TextBundleLUT_free
+#define LUT_INQ_PREDEF TextBundleLUT_inq_predef
+#define LUT_INQ_ENTRIES TextBundleLUT_inq_entries
+*/
+#define LUT_COPY TextBundleLUT_copy
+#define LUT_INQ_INFO TextBundleLUT_inq_info
+#define LUT_INQ_IND TextBundleLUT_inq_ind
+#define LUT_INQ_ENTRY TextBundleLUT_inq_entry
+#define LUT_SET_ENTRIES TextBundleLUT_set_entries
+#define LUT_DEL_ENTRIES TextBundleLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS TextBundleLUT_inq_entry_address
+#define LUT_CREATE TextBundleLUT_create
+#define LUT_ENTRY_CHECK TextBundleLUT_entry_check
+#define LUT_COPY_PEX_MI TextBundleLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX TextBundleLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK TextBundleLUT_mod_call_back
+#define LUT_REALIZE_ENTRY TextBundleLUT_realize_entry
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ if (valueType == PEXRealizedValue)
+ pdev_entry = &pentry->real_entry;
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(&pdev_entry->textColour.colour,
+ pb, pdev_entry->textColour.colourType);
+
+ pb += colour_type_sizes[(int)pdev_entry->textColour.colourType];
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+
+ MILUT_COPY_COLOUR(ps, &(pentry->entry.textColour.colour),
+ pentry->entry.textColour.colourType);
+
+ LUT_REALIZE_ENTRY( pheader, pentry );
+
+ ps += colour_type_sizes[(int)pentry->entry.textColour.colourType];
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ ddPointer pe = (ddPointer)*ppPexEntry;
+
+ /* textFont: any value OK. this is an index into the font table */
+
+ /* textPrecision: must be String, Char, or Stroke */
+ if (((*ppPexEntry)->textPrecision != PEXStringPrecision) &&
+ ((*ppPexEntry)->textPrecision != PEXCharPrecision) &&
+ ((*ppPexEntry)->textPrecision != PEXStrokePrecision))
+ return(BadValue);
+
+ /* charExpansion: any value OK. use closest magnitude if it's not supported */
+ /* charSpacing: any value is OK */
+
+ /* colours: only accept supported colour types */
+ if (MI_BADCOLOURTYPE((*ppPexEntry)->textColour.colourType))
+ return(PEXERR(PEXColourTypeError));
+
+ pe += sizeof(PEX_LUT_ENTRY_STR) +
+ colour_type_sizes[(int)(*ppPexEntry)->textColour.colourType];
+ *ppPexEntry = (PEX_LUT_ENTRY_STR *)pe;
+ return(Success);
+}
+
+/* realize entry */
+ddpex43rtn
+LUT_REALIZE_ENTRY( pheader, pEntry )
+ miLUTHeader *pheader;
+ MI_LUT_ENTRY_STR *pEntry;
+{
+ /* textPrecision: realized value can only be determined at
+ * traversal time since it depends on the font used and on
+ * the string being rendered. it looks like it will probably
+ * only differ if a font group has X and PEX fonts in it.
+ * PEX-SI does not support X fonts in a font group, so this
+ * should be correct for PEX-SI.
+ */
+ /* charExpansion: use closest supported magnitude.
+ * will be based on imp dep values, but they aren't in
+ * spec yet, so just put magnitude for now.
+ * todo: define values even though they aren't returned by
+ * inqimpdepconstants yet.
+ */
+ pEntry->real_entry = pEntry->entry;
+ pEntry->real_entry.charExpansion = ABS(pEntry->entry.charExpansion);
+}
+
+void
+TextBundleLUT_init_pde()
+{
+ pdeTextBundleEntry[0].textFontIndex = 1;
+ pdeTextBundleEntry[0].textPrecision = PEXStringPrecision;
+ pdeTextBundleEntry[0].charExpansion = 1.0;
+ pdeTextBundleEntry[0].charSpacing = 0.0;
+ MILUT_INIT_COLOUR(pdeTextBundleEntry[0].textColour);
+}
+
+#include "miLUTProcs.ci"
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miUtils.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miUtils.c
new file mode 100644
index 000000000..ae716fd41
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miUtils.c
@@ -0,0 +1,624 @@
+/* $TOG: miUtils.c /main/6 1998/02/10 12:45:37 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miUtils.c,v 1.7 1998/10/04 09:34:53 dawes Exp $ */
+
+#include "mipex.h"
+#include "PEX.h"
+#include "PEXprotost.h"
+#include "ddpex3.h"
+#include "miRender.h"
+#include "miWks.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: miMatIdent
+ |
+ | Function Description:
+ | initializes 4x4 matrices to identity.
+ |
+ --*/
+
+void
+miMatIdent(m)
+ ddFLOAT m[4][4];
+{
+ int i, j;
+
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ m[i][j] = ((i==j) ? 1.0 : 0.0);
+ }
+ }
+}
+
+/*++
+ |
+ | Function Name: miMatCopy
+ |
+ | Function Description:
+ | copies 4x4 mat
+ |
+ --*/
+
+void
+miMatCopy(src, dest)
+ ddFLOAT src[4][4];
+ ddFLOAT dest[4][4];
+{
+ int i, j;
+
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ dest[i][j] = src[i][j];
+ }
+ }
+}
+
+/*++
+ |
+ | Function Name: miMatTranspose
+ |
+ | Function Description:
+ | transposes 4x4 matrices.
+ |
+ --*/
+
+void
+miMatTranspose(m)
+ ddFLOAT m[4][4];
+{
+ int i, j;
+ ddFLOAT t;
+
+ for (i=1; i<4; i++) {
+ for (j=0; j<i; j++) {
+ t = m[i][j];
+ m[i][j] = m[j][i];
+ m[j][i] = t;
+ }
+ }
+}
+
+/*++
+ |
+ | Function Name: miMatMult
+ |
+ | Function Description:
+ | implements m = b x a for 4x4 matrices.
+ |
+ | Note(s):
+ |
+ | NOTE the order of the multiply: BxA *NOT* AxB
+ |
+ --*/
+
+void
+miMatMult(m, a, b)
+ddFLOAT m[4][4];
+ddFLOAT a[4][4];
+ddFLOAT b[4][4];
+{
+ register int i,j,k;
+ register float *col_ptr;
+ register float *row_ptr;
+ register float *result;
+
+ if ((m != a) && (m != b))
+ {
+ result = &(m[0][0]);
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ *result = 0.0;
+ col_ptr = &(b[i][0]);
+ row_ptr = &(a[0][j]);
+ for (k = 0; k < 4; k++) {
+ *result += *row_ptr * *(col_ptr++);
+ row_ptr += 4;
+ }
+ result++;
+ }
+ }
+ } else {
+ float t[4][4];
+
+ result = &(t[0][0]);
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ *result = 0.0;
+ col_ptr = &(b[i][0]);
+ row_ptr = &(a[0][j]);
+ for (k = 0; k < 4; k++) {
+ *result += *row_ptr * *(col_ptr++);
+ row_ptr += 4;
+ }
+ result++;
+ }
+ }
+ memcpy( (char *)m, (char *)t, 16*sizeof(float));
+ }
+}
+
+/*++
+ |
+ | Function Name: miPrintVertList
+ |
+ | Function Description: print a formatted version of the
+ | miListHeader structure and its contents.
+ |
+ --*/
+
+void
+miPrintVertList(vinput)
+/* in */
+miListHeader *vinput;
+{
+ int i, j;
+ listofddPoint *pddlist;
+ int vert_count;
+ char *pt;
+ int point_size;
+
+ /*
+ * Print each list.
+ */
+ ErrorF(" Number of lists: %d, list data type: %d \n",
+ vinput->numLists, vinput->type);
+
+ DD_VertPointSize(vinput->type, point_size);
+
+ pddlist = vinput->ddList;
+ for (i = 0; i < vinput->numLists; i++) {
+
+ vert_count = pddlist->numPoints;
+ ErrorF(" num points, list %d: %d", i, vert_count);
+
+ /*
+ *
+ */
+ pt = (char *)pddlist->pts.p4Dpt;
+
+ for (j = 0; j < vert_count; j++) {
+
+ if (DD_IsVertFloat(vinput->type)) {
+
+ if (DD_IsVert2D(vinput->type))
+ ErrorF(" x %f, y %f \n",
+ ((ddCoord4D *)pt)->x,
+ ((ddCoord4D *)pt)->y );
+
+ else if (DD_IsVert3D(vinput->type))
+ ErrorF(" x %f, y %f, z %f \n",
+ ((ddCoord4D *)pt)->x,
+ ((ddCoord4D *)pt)->y,
+ ((ddCoord4D *)pt)->z );
+
+ else
+ ErrorF(" x %f, y %f, z %f \n",
+ ((ddCoord4D *)pt)->x,
+ ((ddCoord4D *)pt)->y,
+ ((ddCoord4D *)pt)->z,
+ ((ddCoord4D *)pt)->w );
+
+
+ } else {
+
+ if (DD_IsVert2D(vinput->type))
+ ErrorF(" x %d, y %d \n",
+ ((ddCoord3DS *)pt)->x,
+ ((ddCoord3DS *)pt)->y );
+
+ else if (DD_IsVert3D(vinput->type))
+ ErrorF(" x %d, y %d, z %d \n",
+ ((ddCoord3DS *)pt)->x,
+ ((ddCoord3DS *)pt)->y,
+ ((ddCoord3DS *)pt)->z );
+
+ }
+
+ pt += point_size;
+
+ }
+ /* Now, ski to next input list */
+ pddlist++;
+ }
+}
+
+/*++
+ |
+ | Function Name: miTransformVector
+ |
+ | Function Description: Transform a 3D point by the 3x3
+ | portion of a 4x4 matrix
+ | Added 4/8/91 by JSH.
+ |
+ --*/
+void
+miTransformVector (p3, matrix, xp3)
+/* in */
+ddVector3D *p3;
+ddFLOAT matrix[4][4];
+/* out */
+ddVector3D *xp3;
+{
+
+ xp3->x = matrix[0][0]*p3->x;
+ xp3->x += matrix[0][1]*p3->y;
+ xp3->x += matrix[0][2]*p3->z;
+
+ xp3->y = matrix[1][0]*p3->x;
+ xp3->y += matrix[1][1]*p3->y;
+ xp3->y += matrix[1][2]*p3->z;
+
+ xp3->z = matrix[2][0]*p3->x;
+ xp3->z += matrix[2][1]*p3->y;
+ xp3->z += matrix[2][2]*p3->z;
+
+}
+
+/*++
+ |
+ | Function Name: miTransformPoint
+ |
+ | Function Description: Transform a 4D point by a 4x4 matrix
+ |
+ --*/
+void
+miTransformPoint (p4, matrix, xp4)
+/* in */
+ddCoord4D *p4;
+ddFLOAT matrix[4][4];
+/* out */
+ddCoord4D *xp4;
+{
+
+ xp4->x = matrix[0][0]*p4->x;
+ xp4->x += matrix[0][1]*p4->y;
+ xp4->x += matrix[0][2]*p4->z;
+ xp4->x += matrix[0][3]*p4->w;
+
+ xp4->y = matrix[1][0]*p4->x;
+ xp4->y += matrix[1][1]*p4->y;
+ xp4->y += matrix[1][2]*p4->z;
+ xp4->y += matrix[1][3]*p4->w;
+
+ xp4->z = matrix[2][0]*p4->x;
+ xp4->z += matrix[2][1]*p4->y;
+ xp4->z += matrix[2][2]*p4->z;
+ xp4->z += matrix[2][3]*p4->w;
+
+ xp4->w = matrix[3][0]*p4->x;
+ xp4->w += matrix[3][1]*p4->y;
+ xp4->w += matrix[3][2]*p4->z;
+ xp4->w += matrix[3][3]*p4->w;
+}
+
+/*++
+ |
+ | Function Name: miMatInverse
+ |
+ | Function Description:
+ | miMatInverse - a fairly robust matrix inversion routine
+ | inverts a 4x4 matrix.
+ |
+ | TODO: If the matrix is singular, call a more robust routine (SVD)
+ | to find a solution. See Numerical Recipes in C
+ |
+ |
+ --*/
+
+void
+miMatInverse( a )
+ ddFLOAT a[4][4];
+{
+ short index[4][2], ipivot[4];
+ float pivot[4];
+ short row, colum;
+ float themax;
+ short i, j, k, l;
+
+ for (j = 0; j < 4; j++)
+ ipivot[j] = 0;
+
+ for (i = 0; i < 4; i++) { /* do matrix inversion */
+ themax = 0.0;
+ for (j = 0; j < 4; j++) { /* search for pivot element */
+ if (ipivot[j] == 1)
+ continue;
+ for (k = 0; k < 4; k++) {
+ if (ipivot[k] == 1)
+ continue;
+ /* what does this mean? is it another singular case?
+ if (ipivot[k] > 1)
+ TODO:
+ */
+ if (fabs(themax) < fabs(a[j][k])) {
+ row = j;
+ colum = k;
+ themax = a[j][k];
+ }
+ }
+ }
+ if (MI_NEAR_ZERO(themax)) {
+ /* input matrix is singular, return the an identity matrix */
+ MI_MAT_IDENTITY( a, 4 );
+ /* TODO: restore matix 'a' and call SVD routine */
+ return;
+ }
+ ipivot[colum] += 1;
+ if (row != colum) { /* interchange rows to put */
+ for (l = 0; l < 4; l++) {
+ themax = a[row][l];
+ a[row][l] = a[colum][l];
+ a[colum][l] = themax;
+ }
+ }
+ index[i][0] = row;
+ index[i][1] = colum;
+ pivot[i] = a[colum][colum];
+#ifndef NDEBUG
+ if ((pivot[i] < 1.0e-6) && (pivot[i] > -1.0e-6) ) {
+ /* input matrix is singular, return the an identity matrix */
+ MI_MAT_IDENTITY( a, 4 );
+ /* TODO: restore matix 'a' and call SVD routine */
+ }
+#endif
+ /* the following isn't needed if we have SVD routine */
+ if (MI_NEAR_ZERO(pivot[i])) {
+ pivot[i] = MI_ZERO_TOLERANCE;
+ }
+ a[colum][colum] = 1.0; /* divide pivot row by pivot element */
+ for (l = 0; l < 4; l++)
+ a[colum][l] /= pivot[i];
+ for (j = 0; j < 4; j++)
+ if (j != colum) {
+ themax = a[j][colum];
+ a[j][colum] = 0.0;
+ for (l = 0; l < 4; l++)
+ a[j][l] -= a[colum][l] * themax;
+ }
+ }
+
+ for (i = 0; i < 4; i++) { /* interchange columns */
+ l = 4 - 1 - i;
+ if (index[l][0] != index[l][1]) {
+ row = index[l][0];
+ colum = index[l][1];
+ for (k = 0; k < 4; k++) {
+ themax = a[k][row];
+ a[k][row] = a[k][colum];
+ a[k][colum] = themax;
+ }
+ }
+ }
+ /* determinant is
+
+ (row == column)?1:(-1) * pivot[0] * pivot[1] * pivot[2] * pivot[3]
+
+ if needed*/
+}
+
+/*++
+ |
+ | Function Name: miMatInverseTranspose
+ |
+ | Function Description:
+ | miMatInverseTranspose - compute the inverse transpose of a matrix.
+ |
+ --*/
+
+void
+miMatInverseTranspose( m )
+ ddFLOAT m[4][4];
+{
+ miMatInverse( m );
+ miMatTranspose( m );
+}
+
+/*++
+ |
+ | Function Name: LostXResource
+ |
+ | Function Description:
+ | General purpose procedure to inform ddpex when an X
+ | resource is deleted.
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+LostXResource( pPEXResource, PEXtype, Xtype )
+ diResourceHandle pPEXResource;
+ ddResourceType PEXtype;
+ ddXResourceType Xtype;
+{
+ /* the only case known to use this is when a drawable is
+ * deleted and a workstation is using the drawable
+ */
+ if ( (PEXtype == WORKSTATION_RESOURCE) && (Xtype == X_DRAWABLE_RESOURCE) )
+ {
+ register miWksPtr pwks = (miWksPtr)((diWKSHandle)pPEXResource)->deviceData;
+
+ pwks->pRend->pDrawable = NULL;
+ pwks->pRend->drawableId = PEXAlreadyFreed;
+ }
+ /* no else should ever happen */
+ return;
+}
+
+/*++
+ |
+ | Function Name: mi_set_filters
+ |
+ | Function Description:
+ | sets the filter flags in the ddcontext
+ |
+ | Note(s):
+ |
+ --*/
+
+void
+mi_set_filters(pRend, pddc, namesets)
+ ddRendererPtr pRend;
+ miDDContext *pddc;
+ ddBitmask namesets;
+{
+ ddUSHORT isempty;
+ ddUSHORT incl_match, excl_match;
+ ddUSHORT invert_incl_match, invert_excl_match;
+ ddNamePtr pnames;
+
+ /* TODO: look at bitmask to smartly change filter_flags
+ * instead of always reseting everything
+ */
+ pddc->Dynamic->filter_flags = 0;
+ MINS_IS_NAMESET_EMPTY(pddc->Dynamic->currentNames, isempty);
+
+ /* do search first */
+ if (pRend->render_mode == MI_REND_SEARCHING)
+ {
+ /* filters pass if they are empty, regardless of
+ * whether there are names in the current name set
+ */
+ pnames = pddc->Static.search.norm_inclusion;
+ MINS_IS_NAMESET_EMPTY( pnames, incl_match );
+
+ pnames = pddc->Static.search.norm_exclusion;
+ MINS_IS_NAMESET_EMPTY( pnames, excl_match );
+
+ if (incl_match && excl_match) {
+ /* norm list is empty, then all elements pass,
+ * so fake it to pass
+ */
+ incl_match = 1;
+ excl_match = 0;
+ } else {
+ /* norm list is not empty */
+ pnames = pddc->Static.search.norm_inclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, incl_match);
+ pnames = pddc->Static.search.norm_exclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, excl_match);
+ }
+
+ pnames = pddc->Static.search.invert_inclusion;
+ MINS_IS_NAMESET_EMPTY( pnames, invert_incl_match );
+
+ pnames = pddc->Static.search.invert_exclusion;
+ MINS_IS_NAMESET_EMPTY( pnames, invert_excl_match );
+
+ if (invert_incl_match && invert_excl_match) {
+ /* invert list is empty, then all elements rejected,
+ * so fake it to reject
+ */
+ invert_incl_match = 0;
+ invert_excl_match = 1;
+ } else {
+ /* invert list is not empty */
+ pnames = pddc->Static.search.invert_inclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, invert_incl_match);
+ pnames = pddc->Static.search.invert_exclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, invert_excl_match);
+ }
+ if ((incl_match && !excl_match) &&
+ !(invert_incl_match && !invert_excl_match))
+ MI_DDC_SET_DETECTABLE(pddc);
+ }
+
+ /* now, go on to other filters */
+ if (isempty)
+ /* current name set is empty. no filters pass */
+ return;
+
+ /* highlight */
+ if ( pRend->ns[DD_HIGH_INCL_NS] )
+ {
+ pnames = ((miNSHeader *)pRend->ns[DD_HIGH_INCL_NS]->deviceData)->names;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, incl_match);
+ if ( pRend->ns[DD_HIGH_EXCL_NS] )
+ {
+ pnames = ((miNSHeader *)pRend->ns[DD_HIGH_EXCL_NS]->deviceData)->names;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, excl_match);
+ }
+ else
+ excl_match = 0;
+ if (incl_match && !excl_match)
+ MI_DDC_SET_HIGHLIGHT(pddc);
+ }
+ /* else inclusion set is empty; filter does not pass */
+
+ /* invisibility */
+ if ( pRend->ns[DD_INVIS_INCL_NS] )
+ {
+ pnames = ((miNSHeader *)pRend->ns[DD_INVIS_INCL_NS]->deviceData)->names;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, incl_match);
+ if ( pRend->ns[DD_INVIS_EXCL_NS] )
+ {
+ pnames = ((miNSHeader *)pRend->ns[DD_INVIS_EXCL_NS]->deviceData)->names;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, excl_match);
+ }
+ else
+ excl_match = 0;
+ if (incl_match && !excl_match)
+ MI_DDC_SET_INVISIBLE(pddc);
+ }
+ /* else inclusion set is empty; filter does not pass */
+
+ if (pRend->render_mode == MI_REND_PICKING)
+ {
+ pnames = pddc->Static.pick.inclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, incl_match);
+ pnames = pddc->Static.pick.exclusion;
+ MINS_MATCH_NAMESETS(pnames, pddc->Dynamic->currentNames, excl_match);
+ if (incl_match && !excl_match)
+ MI_DDC_SET_DETECTABLE(pddc);
+ }
+
+ if (pRend->render_mode == MI_REND_DRAWING)
+ MI_DDC_SET_DETECTABLE(pddc);
+
+ return;
+}
diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/miViewLUT.c b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miViewLUT.c
new file mode 100644
index 000000000..3f5c13f89
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/miViewLUT.c
@@ -0,0 +1,258 @@
+/* $TOG: miViewLUT.c /main/3 1998/02/10 12:45:43 kaleb $ */
+/*
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/miViewLUT.c,v 1.7 1998/10/04 09:34:54 dawes Exp $ */
+
+#include "miLUT.h"
+#include "miWks.h"
+#include "miInfo.h"
+#include "PEXErr.h"
+#include "PEXprotost.h"
+#include "pexos.h"
+
+
+extern void miMatMult();
+
+/* Level 4 Shared Resources */
+/* Lookup Table Procedures */
+
+extern unsigned colour_type_sizes[]; /* in miLUT.c */
+
+/* definitions used by miLUTProcs.ci */
+#define LUT_TYPE PEXViewLUT
+
+/* devPriv data structure */
+#define DD_LUT_ENTRY_STR ddViewEntry
+/* table entry data structure */
+#define MI_LUT_ENTRY_STR miViewEntry
+/* pex data */
+#define PEX_LUT_ENTRY_STR pexViewEntry
+
+#define LUT_REND_DYN_BIT PEXDynViewTableContents
+
+#define LUT_START_INDEX 0
+#define LUT_DEFAULT_INDEX 0
+/* LUT_0_DEFINABLE_ENTRIES value is also defined in miWks.h */
+#define LUT_0_DEFINABLE_ENTRIES 6
+#define LUT_0_NUM_PREDEFINED 1
+#define LUT_0_PREDEFINED_MIN 0
+#define LUT_0_PREDEFINED_MAX 0
+
+#define LUT_TABLE_START(pheader) (pheader)->plut.view
+
+#define DYNAMIC VIEW_REP_DYNAMIC
+
+/* predefined entries table: change this to work with your devPriv data */
+static DD_LUT_ENTRY_STR pdeViewEntry[LUT_0_NUM_PREDEFINED];
+#define LUT_PDE_ENTRIES pdeViewEntry[0]
+#define LUT_SET_PDE_ENTRY(pentry, pdeentry) \
+ (pentry)->entry = *(pdeentry); \
+ miMatMult((pentry)->vom, (pentry)->entry.orientation, (pentry)->entry.mapping); \
+ (pentry)->inv_flag = MI_FALSE
+
+/* predefined entry 0 is set to the default values
+ * change the XXX_DEFAULT_YYY macros below to use something else
+ * if you don't want the default values defined in the pde table
+ */
+#define PDE_DEFAULT_ENTRY_NUM 0
+#define LUT_DEFAULT_VALUES pdeViewEntry[PDE_DEFAULT_ENTRY_NUM]
+#define LUT_SET_DEFAULT_VALUES(pentry) \
+ (pentry)->entry = LUT_DEFAULT_VALUES; \
+ miMatMult((pentry)->vom, (pentry)->entry.orientation, (pentry)->entry.mapping); \
+ (pentry)->inv_flag = MI_FALSE
+
+/* which procedure definitions in miLUTProcs.h to use and their names
+ * take out USE flags if you're defining those procs in here
+ * but leave the name definitions
+ */
+
+#define LUT_USE_FREE
+#define LUT_USE_INQ_PREDEF
+#define LUT_USE_INQ_ENTRIES
+#define LUT_USE_COPY
+#define LUT_USE_INQ_INFO
+#define LUT_USE_INQ_IND
+#define LUT_USE_INQ_ENTRY
+#define LUT_USE_SET_ENTRIES
+#define LUT_USE_DEL_ENTRIES
+#define LUT_USE_INQ_ENTRY_ADDRESS
+#define LUT_USE_CREATE
+#define LUT_USE_MOD_CALL_BACK
+
+/* these three are redefined in miLUTProcs.h
+#define LUT_FREE ViewLUT_free
+#define LUT_INQ_PREDEF ViewLUT_inq_predef
+#define LUT_INQ_ENTRIES ViewLUT_inq_entries
+*/
+#define LUT_COPY ViewLUT_copy
+#define LUT_INQ_INFO ViewLUT_inq_info
+#define LUT_INQ_IND ViewLUT_inq_ind
+#define LUT_INQ_ENTRY ViewLUT_inq_entry
+#define LUT_SET_ENTRIES ViewLUT_set_entries
+#define LUT_DEL_ENTRIES ViewLUT_del_entries
+#define LUT_INQ_ENTRY_ADDRESS ViewLUT_inq_entry_address
+#define LUT_CREATE ViewLUT_create
+#define LUT_ENTRY_CHECK ViewLUT_entry_check
+#define LUT_COPY_PEX_MI ViewLUT_copy_pex_to_mi
+#define LUT_COPY_MI_PEX ViewLUT_copy_mi_to_pex
+#define LUT_MOD_CALL_BACK ViewLUT_mod_call_back
+
+/* copy from an mi entry to a pex entry and increment ppbuf */
+ddpex43rtn
+LUT_COPY_MI_PEX ( pheader, valueType, pentry, ppbuf )
+ miLUTHeader *pheader;
+ ddUSHORT valueType;
+ MI_LUT_ENTRY_STR *pentry;
+ ddPointer *ppbuf;
+{
+ ddPointer pb = *ppbuf;
+ DD_LUT_ENTRY_STR *pdev_entry;
+
+ if (pentry == NULL)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else if (pentry->entry_info.status == MILUT_UNDEFINED)
+ pdev_entry = &(LUT_DEFAULT_VALUES);
+ else
+ pdev_entry = &pentry->entry;
+
+ mibcopy(pdev_entry, pb, sizeof(PEX_LUT_ENTRY_STR));
+
+ pb+= sizeof(PEX_LUT_ENTRY_STR);
+
+ *ppbuf = pb;
+ return(Success);
+}
+
+/* copy from a pex entry to an mi entry and increment ppsrc */
+ddpex43rtn
+LUT_COPY_PEX_MI ( pheader, ppsrc, pentry )
+ miLUTHeader *pheader;
+ ddPointer *ppsrc;
+ MI_LUT_ENTRY_STR *pentry;
+{
+ ddPointer ps = *ppsrc;
+
+ mibcopy(ps, &(pentry->entry), sizeof(PEX_LUT_ENTRY_STR));
+
+ miMatMult(pentry->vom, pentry->entry.orientation, pentry->entry.mapping);
+ pentry->inv_flag = MI_FALSE;
+
+ ps+= sizeof(PEX_LUT_ENTRY_STR);
+ *ppsrc = ps;
+ return(Success);
+}
+
+/* check for bad values and increment ppPexEntry */
+
+ddpex43rtn
+LUT_ENTRY_CHECK (pheader, ppPexEntry)
+ miLUTHeader *pheader;
+ PEX_LUT_ENTRY_STR **ppPexEntry;
+{
+ /* orientation, mapping, clipFlags: no error for these */
+ /* correct clipLimits: XMAX > XMIN, YMAX > YMIN, ZMAX >= ZMIN, plus in NPC */
+ if (((*ppPexEntry)->clipLimits.minval.x >= (*ppPexEntry)->clipLimits.maxval.x) ||
+ ((*ppPexEntry)->clipLimits.minval.y >= (*ppPexEntry)->clipLimits.maxval.y) ||
+ ((*ppPexEntry)->clipLimits.minval.z > (*ppPexEntry)->clipLimits.maxval.z) ||
+ ((*ppPexEntry)->clipLimits.minval.x < 0.0) ||
+ ((*ppPexEntry)->clipLimits.maxval.x > 1.0) ||
+ ((*ppPexEntry)->clipLimits.minval.y < 0.0) ||
+ ((*ppPexEntry)->clipLimits.maxval.y > 1.0) ||
+ ((*ppPexEntry)->clipLimits.minval.z < 0.0) ||
+ ((*ppPexEntry)->clipLimits.maxval.z > 1.0))
+ return(BadValue);
+
+ (*ppPexEntry)++;
+ return(Success);
+}
+
+void
+ViewLUT_init_pde()
+{
+ pdeViewEntry[0].clipFlags = (PEXClipXY | PEXClipBack | PEXClipFront);
+ pdeViewEntry[0].clipLimits.minval.x = 0.0;
+ pdeViewEntry[0].clipLimits.minval.y = 0.0;
+ pdeViewEntry[0].clipLimits.minval.z = 0.0;
+ pdeViewEntry[0].clipLimits.maxval.x = 1.0;
+ pdeViewEntry[0].clipLimits.maxval.y = 1.0;
+ pdeViewEntry[0].clipLimits.maxval.z = 1.0;
+
+ pdeViewEntry[0].orientation[0][0] = 1.0;
+ pdeViewEntry[0].orientation[0][1] = 0.0;
+ pdeViewEntry[0].orientation[0][2] = 0.0;
+ pdeViewEntry[0].orientation[0][3] = 0.0;
+ pdeViewEntry[0].orientation[1][0] = 0.0;
+ pdeViewEntry[0].orientation[1][1] = 1.0;
+ pdeViewEntry[0].orientation[1][2] = 0.0;
+ pdeViewEntry[0].orientation[1][3] = 0.0;
+ pdeViewEntry[0].orientation[2][0] = 0.0;
+ pdeViewEntry[0].orientation[2][1] = 0.0;
+ pdeViewEntry[0].orientation[2][2] = 1.0;
+ pdeViewEntry[0].orientation[2][3] = 0.0;
+ pdeViewEntry[0].orientation[3][0] = 0.0;
+ pdeViewEntry[0].orientation[3][1] = 0.0;
+ pdeViewEntry[0].orientation[3][2] = 0.0;
+ pdeViewEntry[0].orientation[3][3] = 1.0;
+
+ pdeViewEntry[0].mapping[0][0] = 1.0;
+ pdeViewEntry[0].mapping[0][1] = 0.0;
+ pdeViewEntry[0].mapping[0][2] = 0.0;
+ pdeViewEntry[0].mapping[0][3] = 0.0;
+ pdeViewEntry[0].mapping[1][0] = 0.0;
+ pdeViewEntry[0].mapping[1][1] = 1.0;
+ pdeViewEntry[0].mapping[1][2] = 0.0;
+ pdeViewEntry[0].mapping[1][3] = 0.0;
+ pdeViewEntry[0].mapping[2][0] = 0.0;
+ pdeViewEntry[0].mapping[2][1] = 0.0;
+ pdeViewEntry[0].mapping[2][2] = 1.0;
+ pdeViewEntry[0].mapping[2][3] = 0.0;
+ pdeViewEntry[0].mapping[3][0] = 0.0;
+ pdeViewEntry[0].mapping[3][1] = 0.0;
+ pdeViewEntry[0].mapping[3][2] = 0.0;
+ pdeViewEntry[0].mapping[3][3] = 1.0;
+}
+
+#include "miLUTProcs.ci"
+
+
diff --git a/xc/programs/Xserver/PEX5/dipex/Imakefile b/xc/programs/Xserver/PEX5/dipex/Imakefile
new file mode 100644
index 000000000..5d13bc2b4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/Imakefile
@@ -0,0 +1,16 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/12/02 10:19:00 lehors $
+XCOMM This is only used on NT where we do not know how to jump over this dir
+
+#ifdef Win32Architecture
+
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+ SUBDIRS = dispatch swap objects
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/Imakefile b/xc/programs/Xserver/PEX5/dipex/dispatch/Imakefile
new file mode 100644
index 000000000..d6ba88f2c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/Imakefile
@@ -0,0 +1,68 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/8 1996/09/28 16:54:48 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/dipex/dispatch/Imakefile,v 3.11 1999/04/17 09:08:18 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems,
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PexDipexCDebugFlags
+#define PexDipexCDebugFlags ServerCDebugFlags
+#endif
+
+RDR_STUBS = -DRENDER_CMDS
+ST_STUBS = -DSTORE_CMDS
+DIPEXDEFINES = PexDipexDefines
+
+ CDEBUGFLAGS = PexDipexCDebugFlags
+ DEFINES = $(DIPEXDEFINES)
+
+ LINTLIBS = ../../../dix/llib-ldix.ln \
+ ../../../os/llib-los.ln \
+ ../../ddpex/mi/level4/llib-ldp4.ln \
+ ../../ddpex/mi/shared/llib-ldps.ln \
+ ../swap/llib-ldsw.ln \
+ ../objects/llib-lobj.ln
+
+ PEXSRVINC = ../../include
+ INCLUDES = -I$(PEXSRVINC) -I$(XINCLUDESRC) -I$(SERVERSRC)/include
+
+
+SRCS = dipexParse.c dipexExt.c pexDump.c pexError.c dipexBuf.c pexUtils.c
+
+OBJS = dipexParse.o dipexExt.o pexDump.o pexError.o dipexBuf.o pexUtils.o
+
+PEX_DI_LIBNAME = libdidipex.a
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(didipex,$(OBJS))
+
+LintLibraryTarget(dsp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/dipexBuf.c b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexBuf.c
new file mode 100644
index 000000000..2d74b5cb9
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexBuf.c
@@ -0,0 +1,75 @@
+/* $TOG: dipexBuf.c /main/4 1998/02/10 12:34:37 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "ddpex.h"
+
+ddBuffer *pPEXBuffer;
+
+#define INIT_PEX_BUFFER_SIZE 1024
+
+ddBuffer *
+diInitPEXBuffer()
+{
+ ddBuffer *temp;
+ if (!(temp = (ddBuffer *)xalloc((unsigned long)(sizeof(ddBuffer)))))
+ return (0);
+ if (!(temp->pHead =(ddPointer)xalloc((unsigned long)(INIT_PEX_BUFFER_SIZE))))
+ {
+ xfree(temp);
+ return (0);
+ }
+ temp->bufSize = (ddULONG)INIT_PEX_BUFFER_SIZE;
+ temp->dataSize = 0;
+ temp->pBuf = temp->pHead;
+ return (temp);
+}
+
+
+void diFreePEXBuffer(buffer)
+ ddBuffer *buffer;
+{
+ xfree(buffer->pHead);
+ xfree(buffer);
+}
+
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/dipexExt.c b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexExt.c
new file mode 100644
index 000000000..4b9b78a6d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexExt.c
@@ -0,0 +1,323 @@
+/* $TOG: dipexExt.c /main/12 1998/02/10 12:34:41 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/dispatch/dipexExt.c,v 3.18 1998/12/20 11:57:23 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "PEXproto.h"
+#include "misc.h"
+#include "os.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+#define LOCAL_FLAG
+#define _DIPEXEXT_
+#include "dipex.h"
+#include "pexSwap.h"
+#undef _DIPEXEXT_
+#undef LOCAL_FLAG
+
+
+unsigned long add_pad_of[] = {0, 3, 2, 1};
+
+unsigned int ColourSpecSizes[] = {
+ sizeof(CARD32), /* PEXIndexedColour */
+ 3 * sizeof(PEXFLOAT), /* PEXRgbFloatColour */
+ 3 * sizeof(PEXFLOAT), /* PEXCieFloatColour */
+ 3 * sizeof(PEXFLOAT), /* PEXHsvFloatColour */
+ 3 * sizeof(PEXFLOAT), /* PEXHlsFloatColour */
+ sizeof(CARD32), /* PEXRgb8Colour */
+ 2 * sizeof(CARD32), /* PEXRgb16Colour */
+};
+
+extern ddpex43rtn ddpexInit();
+
+extern ddBuffer *pPEXBuffer;
+extern ddBuffer *diInitPEXBuffer();
+extern RequestFunction PEXRequest[];
+extern void SwapCARD32();
+extern void SwapCARD16();
+static int DeletePexClient();
+
+/*
+ ******************************************************************************
+ *
+ * Function: PexExtensionInit
+ *
+ ******************************************************************************
+ */
+void
+PexExtensionInit()
+{
+ ExtensionEntry *AddExtension();
+ ExtensionEntry *PextEntry = 0;
+ int ProcPEXDispatch();
+ void PEXResetProc();
+ extern int DeleteStructure(), FreeSearchContext(), FreeRenderer(),
+ FreePickMeasure(), dipexFreePhigsWks(), FreePipelineContext(),
+ FreeNameSet(), FreeLUT(), FreePEXFont(), FreeWksDrawable();
+ extern ddpex43rtn OpenPEXFont();
+ dipexFont *pPEXFont;
+
+ PEXStructType = CreateNewResourceType (DeleteStructure);
+ PEXSearchType = CreateNewResourceType (FreeSearchContext);
+ PEXRendType = CreateNewResourceType (FreeRenderer);
+ PEXPickType = CreateNewResourceType (FreePickMeasure);
+ PEXWksType = CreateNewResourceType (dipexFreePhigsWks);
+ PEXPipeType = CreateNewResourceType (FreePipelineContext);
+ PEXNameType = CreateNewResourceType (FreeNameSet);
+ PEXLutType = CreateNewResourceType (FreeLUT);
+ PEXFontType = CreateNewResourceType (FreePEXFont);
+ PEXContextType = CreateNewResourceType (DeletePexClient);
+
+ PEXClass = CreateNewResourceClass();
+ PEXWksDrawableType
+ = CreateNewResourceType (FreeWksDrawable);
+
+ if (!PEXStructType || !PEXSearchType || !PEXRendType || !PEXWksDrawableType
+ || !PEXWksType || !PEXPipeType || !PEXNameType || !PEXFontType
+ || !PEXLutType || !PEXPickType || !PEXClass || !PEXContextType ) {
+ ErrorF("PEXExtensionInit: Could not create PEX resource types\n");
+ return;
+ }
+
+ /*
+ Init buffer for varying-sized replies from ddpex
+ */
+ pPEXBuffer = diInitPEXBuffer();
+
+ if (!pPEXBuffer) {
+ ErrorF("PEXExtensionInit: failed to alloc buffer\n");
+ return; }
+
+ /*
+ * Init any device dependent stuff
+ */
+
+ if (ddpexInit()) {
+ ErrorF("PEXExtensionInit: Couldn't init ddPEX!\n");
+ /* this isn't needed for the SI since ddpexInit won't fail
+ in the SI but maybe some vendors versions might...
+ */
+ diFreePEXBuffer(pPEXBuffer);
+ return;
+ }
+
+ /*
+ * Open up the default font
+ */
+ pPEXFont=(dipexFont *)xalloc((unsigned long)(sizeof(dipexFont)));
+ if (!pPEXFont) {
+ ErrorF("PEXExtensionInit: Memory error--could not allocate default PEX font\n");
+ diFreePEXBuffer(pPEXBuffer);
+ return;
+ }
+
+ pPEXFont->refcnt = 1;
+ pPEXFont->ddFont.id = FakeClientID(0);
+
+ defaultPEXFont = &(pPEXFont->ddFont);
+
+ if ( OpenPEXFont( (ddULONG)(strlen(DEFAULT_PEX_FONT_NAME)),
+ (ddUCHAR *)(DEFAULT_PEX_FONT_NAME),
+ pPEXFont) != Success) {
+ char *errmsg;
+ char *static_message =
+ "PEXExtensionInit: Couldn't open default PEX font file ";
+
+ errmsg = (char *) xalloc(strlen(static_message) +
+ strlen(DEFAULT_PEX_FONT_NAME) +
+ 2 /* 1 byte for space between strings,
+ * 1 byte for null */
+ );
+ if (errmsg) {
+ sprintf(errmsg, "%s %s", static_message, DEFAULT_PEX_FONT_NAME);
+ ErrorF(errmsg);
+ xfree(errmsg);
+ }
+ ErrorF("\n");
+
+ xfree(pPEXFont);
+ defaultPEXFont = 0;
+ diFreePEXBuffer(pPEXBuffer);
+ return;
+ }
+
+ /*
+ * Note that fonts resources are stored with the type (dipexFont *),
+ * and they are referenced sometimes in the DD layer as diFontHandle
+ * (which is a pointer to a ddFontResource). Since the first part
+ * of the dipexFont structure consists of a ddFontResource, this
+ * works. Even though it is ugly, it's best not to start changing
+ * all of the font code at this time (right before a public release),
+ * and hopefully, it will get cleaned up for PEX 6.0.
+ */
+
+ if (!AddResource( pPEXFont->ddFont.id, PEXFontType,
+ (pointer)(pPEXFont))) {
+ ErrorF("PEXExtensionInit: Couldn't add default PEX font resource.\n");
+ xfree(pPEXFont);
+ defaultPEXFont = 0;
+ diFreePEXBuffer(pPEXBuffer);
+ return;
+ }
+
+ PextEntry = AddExtension( PEX_NAME_STRING, PEXNumberEvents, (PEXMaxError+1),
+ ProcPEXDispatch, ProcPEXDispatch,
+ PEXResetProc, StandardMinorOpcode);
+ if (!PextEntry) {
+ ErrorF("PEXExtensionInit: AddExtensions failed\n");
+ xfree(pPEXFont);
+ defaultPEXFont = 0;
+ diFreePEXBuffer(pPEXBuffer);
+ return;
+ }
+
+ PexReqCode = PextEntry->base;
+ PexErrorBase = PextEntry->errorBase;
+ PexEventBase = PextEntry->eventBase;
+ EventSwapVector[PexEventBase + PEXMaxHitsReached] =
+ SwapPEXMaxHitsReachedEvent;
+
+}
+
+
+/*
+ ******************************************************************************
+ *
+ * Function: InitPexClient
+ *
+ ******************************************************************************
+ */
+pexContext *
+InitPexClient(client)
+ClientPtr client;
+{
+ pexContext *cntxtPtr;
+ XID pexId;
+
+ /* Allocate space for the context table */
+ cntxtPtr = (pexContext *) xalloc( (unsigned long)(sizeof( pexContext )
+ + sizeof(pexSwap)) );
+ cntxtPtr->swap = (pexSwap *)(cntxtPtr+1); /* this is silly */
+
+ /* Create the resource id */
+ pexId = PEXID( client, PEXCONTEXTTABLE );
+
+ /* Add the connection context as a resource */
+ if (!AddResource (pexId, PEXContextType, (pointer)cntxtPtr)) {
+ unsigned short temp;
+ temp = MinorOpcodeOfRequest(client);
+ SendErrorToClient( client, (unsigned) PexReqCode,
+ (temp), (unsigned long)0, (int) (BadAlloc));
+ xfree((pointer)cntxtPtr);
+ return(0); }
+
+ /* setup the default proc vectors */
+ cntxtPtr->pexRequest = PEXRequest;
+ cntxtPtr->pexSwapReply = 0;
+ cntxtPtr->pexSwapRequestOC = 0;
+ cntxtPtr->pexSwapReplyOC = 0;
+ cntxtPtr->swap->ConvertCARD16 = SwapCARD16;
+ cntxtPtr->swap->ConvertCARD32 = SwapCARD32;
+ cntxtPtr->swap->ConvertFLOAT = 0;
+
+ /* save the client ptr */
+ cntxtPtr->client = client;
+
+ return( cntxtPtr );
+
+}
+
+/*
+ ******************************************************************************
+ *
+ * Function: static DeletePexClient
+ *
+ * On Entry: Client quitting, Pex resources need to be freed
+ *
+ * On Exit: Pex client resources freed.
+ *
+ * Notes:
+ *
+ ******************************************************************************
+ */
+
+static int DeletePexClient(value, pexId)
+pointer value;
+XID pexId;
+{
+ pexContext *cntxtPtr = (pexContext *)value;
+
+ /* Free space allocated for the client context */
+ if (cntxtPtr) xfree( (pointer)cntxtPtr );
+
+}
+
+
+void PEXResetProc()
+{
+ extern ddpex43rtn FreePEXFont();
+ extern void ddpexReset();
+ diFontHandle temp = defaultPEXFont;
+
+ defaultPEXFont = 0; /* force free */
+ FreeResource(temp->id, RT_NONE);
+
+ ddpexReset();
+ diFreePEXBuffer(pPEXBuffer);
+}
+
+
+ErrorCode
+PEXGenericResourceRequest (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexReq *strmPtr;
+{ }
+
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/dipexParse.c b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexParse.c
new file mode 100644
index 000000000..46affd05c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/dipexParse.c
@@ -0,0 +1,131 @@
+/* $TOG: dipexParse.c /main/3 1998/02/10 12:34:46 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "PEXproto.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "pexError.h"
+#include "pexSwap.h"
+
+
+extern RequestFunction set_tables[];
+extern pexContext * InitPexClient();
+
+/*++ pexErrorHandler
+ --*/
+
+ErrorCode
+pexErrorHandler(client, err)
+ ClientPtr client;
+ ErrorCode err;
+{
+ ErrorF( "PEX Error %d Detected. Continuing...\n", err);
+/*
+ * The following code is snitched from Dispatch
+ if (client->noClientException != Success)
+ CloseDownClient(client);
+ else
+ Oops(client, 0, err);
+*/
+/*
+ * used to do this
+ */
+ return(err);
+
+} /* end-pexErrorHandler() */
+
+
+/*++ ProcPEXDispatch
+ */
+
+ProcPEXDispatch( client )
+ClientPtr client;
+{
+ XID pexId;
+ pexContext *cntxtPtr;
+ CARD8 op;
+ ErrorCode err = Success;
+
+ REQUEST( xReq );
+
+ pexId = PEXID( client, PEXCONTEXTTABLE );
+ cntxtPtr = (pexContext *)LookupIDByType(pexId, PEXContextType);
+
+ if( !cntxtPtr ) {
+
+ if (!(cntxtPtr = InitPexClient(client))) return (BadAlloc);
+
+ }
+
+ op = ((pexReq *)stuff)->opcode;
+
+ if ((op >= PEX_GetExtensionInfo) && (op <= PEXMaxRequest)) {
+
+ if (!(err = set_tables[op](cntxtPtr, stuff))) {
+ cntxtPtr->current_req = (pexReq *)stuff;
+ err = cntxtPtr->pexRequest[ op ]( cntxtPtr, stuff ); }
+
+ } else {
+ err = BadRequest;
+ }
+
+ return( err );
+
+}
+
+
+/*++ PEXRequestUnused -- stub for unimplemented requests
+ --*/
+ErrorCode
+PEXRequestUnused(context)
+pexContext *context;
+{
+ErrorCode err = PEX_ERROR_CODE(BadRequest);
+return ( err );
+
+} /* end-PEXRequestUnused */
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/pexDump.c b/xc/programs/Xserver/PEX5/dipex/dispatch/pexDump.c
new file mode 100644
index 000000000..41b5a1078
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/pexDump.c
@@ -0,0 +1,186 @@
+/* $TOG: pexDump.c /main/4 1998/02/10 12:34:50 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*
+ * File: pexDump.c
+ *
+ * Module(s):
+ * PEXDumpScruc
+ * PEXDumpBlock
+ * Notes:
+ *
+ */
+
+/* some compilers don't like files that don't have any real code
+ * in them, as is the case with this file if DUMP_ON is not
+ * defined. The following static is to appease such compilers.
+ */
+static int foo;
+
+#ifdef DUMP_ON
+
+#include "X.h"
+#include "PEXproto.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "pexSwap.h"
+#include "dipex.h"
+
+#include "pexStruct.h"
+
+PEXDumpBlock( block )
+struct structureBlock *block;
+{
+int i;
+struct genericElement *cmd;
+char *curCmd;
+
+ ErrorF( "\n\nDump of block: %8.8x\n", block );
+ ErrorF( "prev, next: %8.8x %8.8x\n", block->prev, block->next );
+ ErrorF( "element size: %d next free: %d\n",
+ block->elementSize, block->nextFree );
+
+ curCmd = block->elements;
+
+ while( 1 )
+ {
+
+ cmd = ( struct genericElement * )curCmd;
+
+ switch( cmd->opcode )
+ {
+
+ case OP_POLYLINE3D:
+ {
+ struct elPolyline3D *pl;
+
+ pl = ( struct elPolyline3D * )cmd;
+
+ ErrorF( "Polyline vertex count = %d\n",
+ pl->count );
+ curCmd += sizeof( struct elPolyline3D ) +
+ ( pl->count - 1 ) * sizeof( struct point3d );
+
+ for( i = 0; i < pl->count; i++ )
+ {
+ ErrorF( "%d ( %f %f %f )\n",
+ i,
+ pl->points[i].x,
+ pl->points[i].y,
+ pl->points[i].z
+ );
+ }
+ ErrorF( "\n" );
+ }
+ break;
+
+ case 0:
+ {
+ struct elEndBlock *end;
+
+ end = ( struct elEndBlock * )cmd;
+ ErrorF( "End Block, next: %8.8x\n", end->next );
+
+ return;
+ }
+ break;
+
+ default:
+ ErrorF( "--WARNING unrecognized opcode found--\n" );
+ ErrorF( "--the rest of this block is assumed HOSED--\n" );
+ return;
+ break;
+
+ } /* switch( cmd->opcode ) */
+
+ } /* while( 1 ) */
+
+} /* function PEXDumpBlock */
+
+
+
+PEXDumpStructure( context, id )
+pexContext *context;
+int id;
+{
+struct phigsStructure *str;
+struct structureBlock *block;
+
+
+ str = PEXLookupStruc( context, id );
+ if( str == 0 )
+ {
+ ErrorF( "no structure with id: %d %8.8x\n", id, id );
+ return;
+ }
+
+ ErrorF( "dump of structure: %d %8.8x\n", id, id );
+ ErrorF( " at address: %8.8x\n", str );
+ ErrorF( " previous, next: %8.8x %8.8x\n",
+ str->prev, str->next);
+ ErrorF( " first, last block: %8.8x %8.8x\n",
+ str->firstBlock, str->lastBlock );
+ ErrorF( " edit block, element: %8.8x %8.8x\n",
+ str->editBlock, str->editElement );
+ ErrorF( " search block, element: %8.8x %8.8x \n",
+ str->searchBlock, str->searchElement );
+ ErrorF( " element count: %d\n", str->elementCount );
+ ErrorF( " curElement: %d\n", str->curElement );
+ ErrorF( " edit Mode: %d\n", str->editMode );
+
+
+ block = str->firstBlock;
+ while( block )
+ {
+ PEXDumpBlock( block );
+ block = block->next;
+ }
+
+}
+
+#endif /* DUMP_ON */
+
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/pexError.c b/xc/programs/Xserver/PEX5/dipex/dispatch/pexError.c
new file mode 100644
index 000000000..183a2a43f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/pexError.c
@@ -0,0 +1,53 @@
+/* $TOG: pexError.c /main/4 1998/02/10 12:34:54 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*++ PEXerror.c
+ --*/
+
+/* some compilers don't like files that don't have any real code
+ * in them. The following static is to appease such compilers.
+ */
+static int foo;
+
diff --git a/xc/programs/Xserver/PEX5/dipex/dispatch/pexUtils.c b/xc/programs/Xserver/PEX5/dipex/dispatch/pexUtils.c
new file mode 100644
index 000000000..2d991aede
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/dispatch/pexUtils.c
@@ -0,0 +1,776 @@
+/* $TOG: pexUtils.c /main/9 1998/02/10 12:34:58 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and The Open Group.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/dispatch/pexUtils.c,v 3.6 1998/10/04 09:34:59 dawes Exp $ */
+
+#include "ddpex.h"
+#include "pexUtils.h"
+#include "PEX.h"
+#include "misc.h"
+#include "pexos.h"
+
+
+/*++
+ |
+ | Function Name: puBufferRealloc
+ |
+ | Function Description:
+ | increses the size of the buffer provided by diPEX.
+ |
+ | Input Description:
+ ddBufferPtr pBuffer;
+ ddULONG minSize;
+ |
+ | Output Description:
+ ddBufferPtr pBuffer;
+ |
+ | Note(s):
+ | For now only does increase to min size given (in bytes). Maybe
+ | it should make buffer size multiple of 2?
+ |
+ --*/
+
+int
+puBuffRealloc(pBuffer, minSize)
+ ddBufferPtr pBuffer;
+ ddULONG minSize;
+{
+ ddPointer newbuf;
+ int hsiz = PU_BUF_HDR_SIZE(pBuffer);
+
+ minSize += hsiz;
+
+ if ((newbuf = (ddPointer) xrealloc( (pointer)(pBuffer->pHead),
+ (unsigned long)minSize))
+ == NULL)
+ {
+ pBuffer->dataSize = 0;
+ return (BadAlloc);
+ }
+ pBuffer->pHead = newbuf;
+ pBuffer->bufSize = minSize;
+ pBuffer->pBuf = (ddPointer) ((char *) pBuffer->pHead) + hsiz;
+ return (Success);
+}
+
+/****** STUFF FOR MANAGING LISTOFOBJ *************/
+/* listofObj is a generic structure defined in ddpex.h for storing
+ * a list of items in. The enum 'ddtype' specifies the possible items
+ * that a listofObj can hold. The following routines are used to manage the
+ * lists. These lists can be used by dipex, ddpex, or both. They are
+ * NOT intended to be completely opaque objects! dipex or ddpex can
+ * manipulate the lists themselves, without using any of these routines.
+ * The routines are provided as a convenience. However, since dipex does
+ * use them, they must be provided and must behave as expected.
+ * The lists are maintained as an array. The array is reallocated if it
+ * is not large enough. Array is used instead of a linked list because
+ * a list of items can be easily copied into the array as a chunk and
+ * the chunk can be easily traversed by incrementing a pointer to it.
+ * One time when the array may be a disadvantage over linked lists
+ * is if the array is not large enough and has to be realloced. Then
+ * the current contents are copied into the new array. It should be
+ * an efficient copy since the system realloc routined does this, however
+ * it is a copy. The size of the array is tunable (see object_array_sizes
+ * below) and may be adjusted for better performance.
+ * Also, when an item is removed, the end of the list
+ * is moved up one slot (copied) to fill in where the item is taken
+ * out. This should be evaluated to determine if it's effect on system
+ * performance is significant enough to change the method used.
+ * An alternative way to implement the lists would be to use a list of
+ * pointers to the items. This may or may not be better.
+ */
+
+/* the arrays are lists of the following elements
+ * this provides the size of on element
+ * this list is indexed by the list type
+ */
+static unsigned long obj_struct_sizes[] = {
+ sizeof(ddElementRef),
+ sizeof(ddHalfSpace),
+ sizeof(ddPickPath),
+ sizeof(ddRendererPtr),
+ sizeof(diWKSHandle),
+ sizeof(diNSHandle),
+ sizeof(diStructHandle),
+ sizeof(ddDeviceRect),
+ sizeof(ddULONG),
+ sizeof(ddUSHORT),
+ sizeof(ddPointer)
+};
+
+/* sizes of chunks that arrays in the lists are allocated and grow in
+ * are specified here
+ * separate sizes are defined for each obj type so allocations
+ * for the arrays can be tuned individually
+ * this list is indexed by the list type
+ */
+/* here is my philosophy for setting these sizes. This is based on my
+ * uneducated ideas of what the clients may do, not on any real
+ * evaluation of what happens.
+ * element ref: used for current path in the renderer. Could be a long
+ * list if the (client) structure network is large
+ * half space: for model clip volume. I'm not sure how this will be
+ * used, so I'll leave it kind of small - maybe the clients
+ * don't know how to use it either (boo, hiss, bad assumption)
+ * pick path: for the initial pick path. Could be large for large structure
+ * network
+ * renderer pointer: used by PC, LUT, NS for lists of renderers which
+ * reference them. I don't expect any one of these resources to be
+ * shared by many renderers, so this is very small.
+ * wks handle: used by LUT, NS, Structures for cross-reference list.
+ * Since structure networks could be large and a single structre
+ * may be indirectly posted to a workstation multiple times,
+ * this is largish.
+ * name set handle: I don't remember
+ * structure handle: used by other structures for ancestors and descendants
+ * lists (a.k.a. parents & children). Since this only keeps
+ * track one level above or below the structure, it probably won't
+ * get very large, but it will probably have several entries.
+ * device rect: for the clip list. I think this is used for window
+ * clipping (?), so it may get large.
+ * index: is used for list state in the pc. 10 lights is a lot
+ * list of list: used for doing list of pick path for PickAll
+ * You can adjust these any way you'd like. Maybe you want them all to be
+ * built in small chunks so not so much (possibly unused) memory is
+ * laying around and are willing to take the performance hit whenever
+ * the array needs to be reallocated.
+ */
+
+static unsigned long obj_array_sizes[] = {
+ 50, /* element ref */
+ 10, /* half space */
+ 50, /* pick path */
+ 5, /* renderer pointer */
+ 30, /* wks handle */
+ 10, /* name set handle */
+ 20, /* structure handle */
+ 30, /* device rect */
+ 10, /* name */
+ 10, /* index */
+ 50 /* list of list */
+};
+
+#define PU_CHECK_LIST( plist ) if (!plist) return( PU_BAD_LIST )
+
+/*
+ * XXX - calls FatalError if passed a pList which has had the objects
+ * allocated right after the header
+ */
+
+#define PU_GROW_LIST( plist, atleast ) \
+{ \
+ register int newmax; \
+ ddPointer pList; \
+ \
+ newmax = obj_array_sizes[(int)(plist->type)] + plist->maxObj; \
+ if (newmax < (atleast)) \
+ newmax = (atleast); \
+ if (plist->pList == (ddPointer) (plist + 1)) \
+ FatalError("PU_GROW_LIST passed a pList which has had the objects"\
+ "allocated right after the header"); \
+ pList = (ddPointer)xrealloc( (pointer)(plist->pList), \
+ (unsigned long)(newmax * obj_struct_sizes[(int)(plist->type)] )); \
+ if (!pList ) return( BadAlloc ); \
+ \
+ plist->maxObj = (ddLONG)newmax; \
+ plist->pList = pList; \
+}
+
+#define PU_ELREF_COMPARE( p1, p2 ) \
+ ( (p1)->structure == (p2)->structure ) && \
+ ( (p1)->offset == (p2)->offset )
+
+#define PU_SPACE_COMPARE( p1, p2 ) \
+ ( (p1)->point.x == (p2)->point.x ) && \
+ ( (p1)->point.y == (p2)->point.y ) && \
+ ( (p1)->point.z == (p2)->point.z ) && \
+ ( (p1)->vector.x == (p2)->vector.x ) && \
+ ( (p1)->vector.y == (p2)->vector.y ) && \
+ ( (p1)->vector.z == (p2)->vector.z )
+
+#define PU_PATH_COMPARE( p1, p2 ) \
+ ( (p1)->structure == (p2)->structure ) && \
+ ( (p1)->offset == (p2)->offset ) && \
+ ( (p1)->pickid == (p2)->pickid )
+
+#define PU_HANDLE_COMPARE( p1, p2 ) \
+ ( *(p1) == *(p2) )
+
+#define PU_RECT_COMPARE( p1, p2 ) \
+ ( (p1)->xmin == (p2)->xmin ) && \
+ ( (p1)->xmax == (p2)->xmax ) && \
+ ( (p1)->ymin == (p2)->ymin ) && \
+ ( (p1)->ymax == (p2)->ymax )
+
+#define PU_NAME_COMPARE( p1, p2 ) \
+ ( *(p1) == *(p2) )
+
+#define PU_INDEX_COMPARE( p1, p2 ) \
+ ( *(p1) == *(p2) )
+
+#define PU_LIST_COMPARE( p1, p2 ) \
+ ( *(p1) == *(p2) )
+
+/*
+ Returns the number of bytes needed to create a list of this type
+ */
+int
+puCountList( type, at_least_num )
+ddListType type;
+int at_least_num;
+{
+ return(sizeof(listofObj) + at_least_num * obj_struct_sizes[(int)type] );
+} /* puCountList */
+
+/*
+ Initializes fields in listofObj
+ */
+void
+puInitList( pList, type, maxEntries)
+listofObj *pList;
+ddListType type;
+ddULONG maxEntries;
+{
+ pList->type = type;
+ pList->numObj = 0;
+ pList->maxObj = maxEntries;
+ if (maxEntries == 0) pList->pList = 0;
+ else pList->pList = (ddPointer)(pList + 1); /* allocated in one chunk */
+
+}
+
+listofObj *
+puCreateList( type )
+ddListType type;
+{
+ listofObj *pList;
+
+ /* allocate in two chunks */
+ pList = (listofObj *)xalloc( sizeof(listofObj) );
+ if ( !pList ) return NULL;
+
+ pList->type = type;
+ pList->numObj = 0;
+ pList->maxObj = obj_array_sizes[(int)type];
+
+ if (!pList->maxObj)
+ pList->pList = (ddPointer) NULL;
+ else
+ pList->pList = (ddPointer) xalloc (pList->maxObj * obj_struct_sizes[(int)type]);
+
+ if (!pList->pList)
+ {
+ xfree (pList);
+ return NULL;
+ }
+
+ return( pList );
+} /* puCreateList */
+
+void
+puDeleteList( pList )
+listofObj *pList;
+{
+ if ( pList )
+ {
+ if (pList->pList && pList->pList != (ddPointer) (pList + 1))
+ xfree ((pointer) pList->pList);
+ xfree( (pointer)pList );
+ }
+ return;
+} /* puDeleteList */
+
+/* notice that this macro depends on i, plist, pi, and pl being defined */
+#define PU_COMPARE_LOOP( compare_macro ) \
+ for ( i=0; i<plist->numObj; i++, pl++ ) \
+ if ( compare_macro ) \
+ return( PU_TRUE )
+
+/* see if an item is in the list. return TRUE if it is, else return FALSE
+ */
+short
+puInList( pitem, plist )
+ ddPointer pitem;
+ listofObj *plist;
+{
+ register int i;
+
+ if (!plist) return( PU_FALSE );
+ if (!plist->numObj) return(PU_FALSE);
+
+ switch ( plist->type )
+ {
+ case DD_ELEMENT_REF:
+ {
+ ddElementRef *pi = (ddElementRef *)pitem;
+ ddElementRef *pl = (ddElementRef *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_ELREF_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_HALF_SPACE:
+ {
+ ddHalfSpace *pi = (ddHalfSpace *)pitem;
+ ddHalfSpace *pl = (ddHalfSpace *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_SPACE_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_PICK_PATH:
+ {
+ ddPickPath *pi = (ddPickPath *)pitem;
+ ddPickPath *pl = (ddPickPath *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_PATH_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_RENDERER:
+ case DD_WKS:
+ case DD_NS:
+ case DD_STRUCT:
+ {
+ ddPointer *pi = (ddPointer *)pitem;
+ ddPointer *pl = (ddPointer *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_HANDLE_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_DEVICE_RECT:
+ {
+ ddDeviceRect *pi = (ddDeviceRect *)pitem;
+ ddDeviceRect *pl = (ddDeviceRect *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_RECT_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_NAME:
+ {
+ ddULONG *pi = (ddULONG *)pitem;
+ ddULONG *pl = (ddULONG *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_NAME_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_INDEX:
+ {
+ ddUSHORT *pi = (ddUSHORT *)pitem;
+ ddUSHORT *pl = (ddUSHORT *)plist->pList;
+
+ PU_COMPARE_LOOP( PU_INDEX_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_LIST_OF_LIST:
+ {
+ listofObj **pi = (listofObj **)pitem;
+ listofObj **pl = (listofObj **)plist->pList;
+
+ PU_COMPARE_LOOP( PU_LIST_COMPARE( pi, pl ) );
+ }
+ break;
+
+ default:
+ return( PU_FALSE );
+ }
+
+ return( PU_FALSE );
+} /* puInList */
+
+/* add numItems items to the end of the list.
+ * duplicates the item if it's already in the list
+ * returns Success (0) if successful
+ * returns BadAlloc error if not
+ */
+short
+puAddToList( pitem, numItems, plist )
+ ddPointer pitem;
+ ddULONG numItems;
+ listofObj *plist;
+{
+ ddPointer pi2;
+
+ PU_CHECK_LIST( plist );
+
+ if ( !numItems )
+ return( Success );
+
+ /* macro returns error if can't allocate space */
+ if ( plist->numObj + numItems > plist->maxObj )
+ PU_GROW_LIST( plist, plist->numObj + numItems );
+
+ pi2 = &(plist->pList[ obj_struct_sizes[(int)(plist->type)] * plist->numObj ]);
+ /* JSH - assuming copy may overlap */
+ memmove( (char *)pi2, (char *)pitem, (int)(numItems * obj_struct_sizes[(int)(plist->type)]) );
+
+ plist->numObj += numItems;
+
+ return( Success );
+} /* puAddToList */
+
+/* notice that this macro depends on vars i, numObj, pi, and pl to be defined */
+#define PU_REMOVE_LOOP( compare_macro ) \
+ for ( i=0; i<numObj; i++, pl++ ) \
+ { \
+ if ( compare_macro ) \
+ { \
+ for ( ; i<numObj; i++, pl++ ) \
+ *pl = *(pl+1); \
+ \
+ /* put this here so it isn't \
+ * decremented if the item is \
+ * not in the list \
+ */ \
+ plist->numObj--; \
+ } \
+ }
+
+/* to remove the last element */
+#define PU_REMOVE_LAST_ELEMENT( plist ) \
+ (plist)->numObj--
+
+/* removes first occurence of pitem found in list */
+short
+puRemoveFromList( pitem, plist )
+ ddPointer pitem;
+ listofObj *plist;
+{
+ register unsigned long i;
+ register unsigned long numObj = plist->numObj;
+
+ PU_CHECK_LIST( plist );
+
+ if ( !numObj )
+ return( Success );
+
+ switch ( plist->type )
+ {
+ case DD_ELEMENT_REF:
+ {
+ ddElementRef *pi = (ddElementRef *)pitem;
+ ddElementRef *pl = (ddElementRef *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_ELREF_COMPARE( pi, pl ) );
+
+ }
+ break;
+
+ case DD_HALF_SPACE:
+ {
+ ddHalfSpace *pi = (ddHalfSpace *)pitem;
+ ddHalfSpace *pl = (ddHalfSpace *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_SPACE_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_PICK_PATH:
+ {
+ ddPickPath *pi = (ddPickPath *)pitem;
+ ddPickPath *pl = (ddPickPath *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_PATH_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_RENDERER:
+ case DD_WKS:
+ case DD_NS:
+ case DD_STRUCT:
+ {
+ ddPointer *pi = (ddPointer *)pitem;
+ ddPointer *pl = (ddPointer *)plist->pList;
+ PU_REMOVE_LOOP( PU_HANDLE_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_DEVICE_RECT:
+ {
+ ddDeviceRect *pi = (ddDeviceRect *)pitem;
+ ddDeviceRect *pl = (ddDeviceRect *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_RECT_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_NAME:
+ {
+ ddULONG *pi = (ddULONG *)pitem;
+ ddULONG *pl = (ddULONG *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_NAME_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_INDEX:
+ {
+ ddUSHORT *pi = (ddUSHORT *)pitem;
+ ddUSHORT *pl = (ddUSHORT *)plist->pList;
+
+ PU_REMOVE_LOOP( PU_INDEX_COMPARE( pi, pl ) );
+ }
+ break;
+
+ case DD_LIST_OF_LIST:
+ {
+ listofObj **pi = (listofObj **)pitem;
+ listofObj **pl = (listofObj **)plist->pList;
+
+ PU_REMOVE_LOOP( PU_LIST_COMPARE( pi, pl ) );
+
+ }
+ break;
+
+ default:
+ return( PU_BAD_LIST );
+ }
+
+ return( Success );
+} /* puRemoveFromList */
+
+/* this macro assumes that pldest has enough memory */
+/* JSH - assuming copy may overlap */
+#define PU_COPY_LIST_ELEMENTS( plsrc, pldest, bytes ) \
+ memmove( (char *)(pldest), (char *)(plsrc), (int)(bytes) )
+
+short
+puCopyList( psrc, pdest )
+ listofObj *psrc;
+ listofObj *pdest;
+{
+ /* both lists must exist */
+ if ( !psrc || !pdest )
+ return( PU_BAD_LIST );
+
+ /* and must be the same type */
+ if ( !(psrc->type == pdest->type) )
+ return( PU_BAD_LIST );
+
+ if ( !psrc->numObj )
+ {
+ pdest->numObj = 0;
+ return( Success );
+ }
+
+ if ( psrc->numObj > pdest->maxObj )
+ PU_GROW_LIST( pdest , psrc->numObj );
+
+ PU_COPY_LIST_ELEMENTS( psrc->pList, pdest->pList,
+ obj_struct_sizes[(int)(psrc->type)] * psrc->numObj );
+
+ pdest->numObj = psrc->numObj;
+
+ return( Success );
+} /* puCopyList */
+
+
+/* merges two lists into one list without duplicates */
+short
+puMergeLists( psrc1, psrc2, pdest )
+ listofObj *psrc1;
+ listofObj *psrc2;
+ listofObj *pdest;
+{
+ register int i,si;
+ ddPointer pi;
+ listofObj *ptemp;
+
+ if ((pdest==psrc1 && psrc1->numObj) ||
+ (pdest==psrc2 && psrc2->numObj))
+ {
+ ptemp = puCreateList( psrc1->type );
+ if (!ptemp)
+ return(BadAlloc);
+ }
+ else
+ ptemp = pdest;
+
+ /* all lists must exist */
+ if ( !psrc1 || !psrc2 || !ptemp )
+ return( PU_BAD_LIST );
+
+ /* and must be the same type */
+ if ( !((psrc1->type == psrc2->type) && (psrc2->type == ptemp->type)) )
+ return( PU_BAD_LIST );
+
+ /* just for kicks, let's make sure the destination list is empty */
+ ptemp->numObj = 0;
+
+ /* put the first list into the destination */
+ if ( psrc1->numObj )
+ {
+ pi = psrc1->pList;
+ si = obj_struct_sizes[(int)(psrc1->type)];
+ for ( i=0; i<psrc1->numObj; i++, pi+=si )
+ /* if the item is not already in the list , add it */
+ if ( !puInList( pi, ptemp ) )
+ if ( puAddToList( pi, (ddULONG)1, ptemp ) )
+ return( BadAlloc );
+ }
+
+ /* now for the second list */
+ if ( psrc2->numObj )
+ {
+ pi = psrc2->pList;
+ si = obj_struct_sizes[(int)(psrc2->type)];
+ for ( i=0; i<psrc2->numObj; i++, pi+=si )
+ /* if the item is not already in the list , add it */
+ if ( !puInList( pi, ptemp ) )
+ if ( puAddToList( pi, (ddULONG)1, ptemp ) )
+ return( BadAlloc );
+ }
+
+ if (ptemp != pdest)
+ {
+ if ( puCopyList( ptemp, pdest ) != Success )
+ return(BadAlloc);
+ puDeleteList( ptemp );
+ }
+ return( Success );
+} /* puMergeLists */
+
+#ifdef DDTEST
+short
+printlist( plist )
+ listofObj *plist;
+{
+ register int i;
+
+ PU_CHECK_LIST( plist );
+
+ ErrorF("\nLIST type: %d, size: %d, num: %d",
+ plist->type, plist->maxObj, plist->numObj );
+
+ switch ( plist->type )
+ {
+ case DD_ELEMENT_REF:
+ {
+ ddElementRef *pl=(ddElementRef *)plist->pList;
+
+ ErrorF(" ELEMENT REF\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("structure: %d offset: %d\n",
+ pl->structure, pl->offset );
+ }
+ break;
+
+ case DD_HALF_SPACE:
+ {
+ ddHalfSpace *pl=(ddHalfSpace *)plist->pList;
+
+ ErrorF(" HALF SPACE\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("point: %f %f %f vector: %f %f %f\n",
+ pl->point.x, pl->point.y, pl->point.z,
+ pl->vector.x, pl->vector.y, pl->vector.z);
+ }
+ break;
+
+ case DD_PICK_PATH:
+ {
+ ddPickPath *pl=(ddPickPath *)plist->pList;
+
+ ErrorF(" PICK PATH\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("structure: %d offset: %d pick id: %d\n",
+ pl->structure, pl->offset, pl->pickid );
+ }
+ break;
+
+ case DD_RENDERER:
+ case DD_WKS:
+ case DD_NS:
+ case DD_STRUCT:
+ {
+ ddPointer *pl=(ddPointer *)plist->pList;
+
+ ErrorF(" HANDLE\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("handle: %d \n", *pl);
+ }
+ break;
+
+ case DD_DEVICE_RECT:
+ {
+ ddDeviceRect *pl=(ddDeviceRect *)plist->pList;
+
+ ErrorF(" DEVICE RECT\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("xmin: %d xmax: %d ymin: %d ymax: %d\n",
+ pl->xmin, pl->xmax, pl->ymin, pl->ymax );
+ }
+ break;
+
+ case DD_NAME:
+ {
+ ddULONG *pl=(ddULONG *)plist->pList;
+
+ ErrorF(" NAME\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("name: %d \n", *pl);
+ }
+ break;
+
+ case DD_INDEX:
+ {
+ ddUSHORT *pl=(ddUSHORT *)plist->pList;
+
+ ErrorF(" INDEX\n");
+ for ( i=0; i<plist->numObj; i++, pl++ )
+ ErrorF("index: %d \n", *pl);
+ }
+ break;
+
+ default:
+ return( PU_BAD_LIST );
+ }
+} /* printlist */
+#endif
+
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/Imakefile b/xc/programs/Xserver/PEX5/dipex/objects/Imakefile
new file mode 100644
index 000000000..e94e8ce42
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/Imakefile
@@ -0,0 +1,71 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/13 1996/09/28 16:54:53 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/dipex/objects/Imakefile,v 3.14 1999/07/04 06:38:32 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PassCDebugFlags
+#define PassCDebugFlags
+#endif
+
+#ifndef PexDipexCDebugFlags
+#define PexDipexCDebugFlags ServerCDebugFlags
+#endif
+
+ CDEBUGFLAGS = PexDipexCDebugFlags
+ DEFINES = PexDipexDefines
+ LINTLIBS = ../../../dix/llib-ldix.ln \
+ ../../../os/llib-los.ln \
+ ../../ddpex/mi/level4/llib-ldp4.ln \
+ ../../ddpex/mi/shared/llib-ldps.ln
+
+
+ PEXSRVINC = ../../include
+ INCLUDES = -I. -I$(PEXSRVINC) -I$(XINCLUDESRC) -I$(SERVERSRC)/include
+
+
+SRCS = pexRndr.c pexFont.c pexLut.c pexNs.c pexStr.c \
+ pexPhigs.c pexInfo.c pexSc.c pexPick.c pexPc.c pexRndrPick.c
+XCOMM pexTM.c pexAccBuf.c
+
+OBJS = pexRndr.o pexFont.o pexLut.o pexNs.o pexStr.o \
+ pexPhigs.o pexInfo.o pexSc.o pexPick.o pexPc.o pexRndrPick.o
+XCOMM pexTM.o pexAccBuf.o
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(diobpex,$(OBJS))
+
+LintLibraryTarget(obj,$(SRCS))
+NormalLintTarget($(SRCS))
+
+#ifdef HPArchitecture
+SpecialCObjectRule(hpext, $(IRULESRC)/$(MACROFILE), $(EXT_DEFINES))
+#endif
+
+DependTarget()
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexAccBuf.c b/xc/programs/Xserver/PEX5/dipex/objects/pexAccBuf.c
new file mode 100644
index 000000000..caf52c27f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexAccBuf.c
@@ -0,0 +1,138 @@
+/* $TOG: pexAccBuf.c /main/2 1998/02/10 12:35:56 kaleb $ */
+/*
+
+Copyright 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+*/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pexLookup.h"
+
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+
+
+/*++ PEXAccumulateBuffer
+ --*/
+ErrorCode
+PEXAccumulateBuffer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexAccumulateBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+
+ err = AccumulateBuffer(prend->pDrawable, strmPtr->src_weight,
+ strmPtr->dst_weight);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXAccumulateBuffer() */
+
+/*++ PEXAllocAccumBuffer
+ --*/
+ErrorCode
+PEXAllocAccumBuffer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexAllocAccumBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+
+ err = AllocAccumBuffer(prend->pDrawable );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXAllocAccumBuffer() */
+
+/*++ PEXFreeAccumBuffer
+ --*/
+ErrorCode
+PEXFreeAccumBuffer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreeAccumBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+
+ err = FreeAccumBuffer(prend->pDrawable );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXFreeAccumBuffer() */
+
+/*++ PEXLoadAccumBuffer
+ --*/
+ErrorCode
+PEXLoadAccumBuffer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexLoadAccumBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+
+ err = LoadAccumBuffer(prend->pDrawable );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXLoadAccumBuffer() */
+
+/*++ PEXReturnAccumBuffer
+ --*/
+ErrorCode
+PEXReturnAccumBuffer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexReturnAccumBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+
+ err = ReturnAccumBuffer(prend->pDrawable, strmPtr->scale);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXReturnAccumBuffer() */
+
+/*++
+ *
+ * End of File
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexFont.c b/xc/programs/Xserver/PEX5/dipex/objects/pexFont.c
new file mode 100644
index 000000000..9831847e7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexFont.c
@@ -0,0 +1,297 @@
+/* $TOG: pexFont.c /main/9 1998/02/10 12:35:03 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexFont.c,v 3.7 1998/10/04 09:35:02 dawes Exp $ */
+
+
+/*++ pexFont.c
+ * PEXOpenFont
+ * PEXCloseFont
+ * PEXQueryFont
+ * PEXListFonts
+ * PEXListFontsWithInfo
+ * PEXQueryTextExtents
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "dipex.h"
+#include "pexLookup.h"
+#define NEED_OS_LIMITS
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+static dipexFont *FindPEXFontEntry();
+
+/*++ PEXOpenFont
+ *
+ * DESCRIPTION:
+ *
+ * This request loads the specified PEX font, if necessary, and associates
+ * identifier f_id with it. The font name should use the ISO Latin-1 encoding,
+ * and upper/lower case does not matter. PEXfonts are not associated with a
+ * particular screen, and can be used with any renderer or PHIGS workstation
+ * resources.
+ --*/
+ErrorCode
+PEXOpenFont (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexOpenFontReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode FreePEXFont ();
+ unsigned char fName[PATH_MAX];
+ dipexFont *dif;
+ extern void CopyISOLatin1Lowered();
+
+ /* oh, who cares if it's already been opened under this id */
+ if (!LegalNewID(strmPtr->font, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->font,cntxtPtr);
+
+ if (strmPtr->numBytes > PATH_MAX - 1)
+ PEX_ERR_EXIT(BadLength,0,cntxtPtr);
+
+ /* has this server already loaded this font */
+ CopyISOLatin1Lowered( fName, (unsigned char *)(strmPtr+1),
+ (int)(strmPtr->numBytes));
+
+ dif = FindPEXFontEntry(fName);
+
+ if (dif) {
+ if (dif->refcnt > 0) {
+ dif->refcnt += 1; }
+ } else {
+
+ dif = (dipexFont *) xalloc ((unsigned long)sizeof(dipexFont));
+ if (!dif) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ dif->ddFont.id = strmPtr->font;
+ dif->refcnt = 1;
+
+ err = OpenPEXFont( (ddULONG)(strmPtr->numBytes),
+ (ddUCHAR *)(strmPtr + 1), &(dif->ddFont));
+ if (err) {
+ xfree((pointer)dif);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ /*
+ * Note that fonts resources are stored with the type (dipexFont *),
+ * and they are referenced sometimes in the DD layer as diFontHandle
+ * (which is a pointer to a ddFontResource). Since the first part
+ * of the dipexFont structure consists of a ddFontResource, this
+ * works. Even though it is ugly, it's best not to start changing
+ * all of the font code at this time (right before a public release),
+ * and hopefully, it will get cleaned up for PEX 6.0.
+ */
+
+ ADDRESOURCE(strmPtr->font, PEXFontType, dif);
+
+ }
+
+ return(err);
+
+} /* end-PEXOpenFont() */
+
+static dipexFont *
+FindPEXFontEntry(fname)
+unsigned char *fname;
+{
+ return (0); /* stub */
+}
+
+/*++ PEXCloseFont
+ --*/
+ErrorCode
+PEXCloseFont (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCloseFontReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diFontHandle pf = 0;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXFontError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_PEXFONT(strmPtr->id, pf);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return(err);
+
+} /* end-PEXCloseFont() */
+
+/*++ PEXQueryFont
+ --*/
+ErrorCode
+PEXQueryFont( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexQueryFontReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diFontHandle pf = 0;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_PEXFONT(strmPtr->font, pf);
+
+ SETUP_INQ(pexQueryFontReply);
+
+ err = QueryPEXFont (pf, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexQueryFontReply);
+ reply->lengthFontInfo = pPEXBuffer->dataSize;
+ WritePEXBufferReply(pexQueryFontReply);
+ }
+ return( err );
+
+} /* end-PEXQueryFont() */
+
+/*++ PEXListFonts
+ --*/
+ErrorCode
+PEXListFonts( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexListFontsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numStrings;
+
+ SETUP_INQ(pexListFontsReply);
+
+ err = ListPEXFonts( strmPtr->numChars, (CARD8 *)(strmPtr+1),
+ strmPtr->maxNames, &numStrings, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexListFontsReply);
+ reply->numStrings = numStrings;
+ WritePEXBufferReply(pexListFontsReply);
+ }
+ return( err );
+
+} /* end-PEXListFonts() */
+
+/*++ PEXListFontsWithInfo
+ --*/
+ErrorCode
+PEXListFontsWithInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexListFontsWithInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numStrings;
+
+ SETUP_INQ(pexListFontsWithInfoReply);
+
+ err = ListPEXFontsPlus( strmPtr->numChars, (CARD8 *)(strmPtr+1),
+ strmPtr->maxNames, &numStrings, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexListFontsWithInfoReply);
+ reply->numStrings = numStrings;
+ WritePEXBufferReply(pexListFontsWithInfoReply);
+ }
+ return( err );
+
+} /* end-PEXListFontsWithInfo() */
+
+/*++ PEXQueryTextExtents
+ --*/
+ErrorCode
+PEXQueryTextExtents( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexQueryTextExtentsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBuffer *pPEXBuffer;
+ diResourceHandle ptr;
+ ddResourceType what;
+
+ if (! (ptr = (diResourceHandle) LookupIDByType (strmPtr->id, PEXLutType)))
+ if (! (ptr = (diResourceHandle) LookupIDByType (strmPtr->id, PEXWksType)))
+ if (! (ptr = (diResourceHandle) LookupIDByType (strmPtr->id, PEXRendType)))
+ PEX_ERR_EXIT(BadValue,strmPtr->id,cntxtPtr)
+ else what = RENDERER_RESOURCE;
+ else what = WORKSTATION_RESOURCE;
+ else {
+ what = LOOKUP_TABLE_RESOURCE;
+ if (((ddLUTResource *)ptr)->lutType != PEXTextFontLUT) {
+ PEX_ERR_EXIT(BadMatch,strmPtr->id,cntxtPtr);
+ }
+ }
+
+ SETUP_INQ(pexQueryTextExtentsReply);
+
+ err = QueryPEXTextExtents( ptr, what, strmPtr->fontGroupIndex,
+ strmPtr->textPath, strmPtr->charExpansion,
+ strmPtr->charSpacing, strmPtr->charHeight,
+ &(strmPtr->textAlignment), strmPtr->numStrings,
+ (ddPointer)(strmPtr + 1), pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexQueryTextExtentsReply);
+ WritePEXBufferReply(pexQueryTextExtentsReply);
+ }
+ return( err );
+
+} /* end-PEXQueryTextExtents() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexInfo.c b/xc/programs/Xserver/PEX5/dipex/objects/pexInfo.c
new file mode 100644
index 000000000..be7fae4de
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexInfo.c
@@ -0,0 +1,278 @@
+/* $TOG: pexInfo.c /main/7 1998/02/10 12:35:07 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexInfo.c,v 1.7 1998/10/04 09:35:02 dawes Exp $ */
+
+
+/*++ pexInfo.c
+ *
+ * Contents: PEXGetExtensionInfo
+ * PEXGetEnumeratedTypeInfo
+ * PEXGetImpDepConstants
+ * PEXMatchRendererTargets
+ * PEXEscape
+ * PEXEscapeWithReply
+ *
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pex_site.h"
+#include "PEX.h"
+#include "dipex.h"
+#include "pexError.h"
+#include "pexLookup.h"
+#include "pexExtract.h"
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+/*++ PEXGetExtensionInfo
+ *
+ * The client_protocol_major_version and the
+ * client_protocol_minor_version indicate what
+ * version of the protocol the client expects the
+ * server to implement.
+ --*/
+
+ErrorCode
+PEXGetExtensionInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetExtensionInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBuffer *pPEXBuffer;
+ pexGetExtensionInfoReply *reply =
+ (pexGetExtensionInfoReply *)pPEXBuffer->pHead;
+
+ reply->majorVersion = PEX_PROTO_MAJOR;
+ reply->minorVersion = PEX_PROTO_MINOR;
+ reply->release = PEX_RELEASE_NUMBER;
+ reply->lengthName = strlen(PEX_VENDOR);
+ reply->length = LWORDS(reply->lengthName);
+ reply->subsetInfo = PEX_SUBSET;
+ memcpy( (char *)(reply+1), PEX_VENDOR, (int)(reply->lengthName));
+
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof(pexGetExtensionInfoReply) + reply->lengthName,
+ reply);
+
+ return( err );
+
+} /* end-PEXGetExtensionInfo() */
+
+/*++ PEXGetEnumeratedTypeInfo
+ --*/
+
+ErrorCode
+PEXGetEnumeratedTypeInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetEnumeratedTypeInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr d;
+ extern ddBuffer *pPEXBuffer;
+ ddULONG numLists;
+
+ LU_DRAWABLE (strmPtr->drawable, d);
+
+ SETUP_INQ(pexGetEnumeratedTypeInfoReply);
+
+ err = InquireEnumTypeInfo( d, strmPtr->itemMask, strmPtr->numEnums,
+ (ddUSHORT *)(strmPtr+1), &numLists, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetEnumeratedTypeInfoReply);
+ reply->numLists = numLists;
+ WritePEXBufferReply(pexGetEnumeratedTypeInfoReply);
+ }
+ return( err );
+
+} /* end-PEXGetEnumeratedTypeInfo() */
+
+/*++ PEXGetImpDepConstants
+ --*/
+
+ErrorCode
+PEXGetImpDepConstants( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetImpDepConstantsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr d;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_DRAWABLE (strmPtr->drawable, d);
+
+ SETUP_INQ(pexGetImpDepConstantsReply);
+
+ err = InquireImpDepConstants( d, strmPtr->numNames,
+ (ddUSHORT *)(strmPtr+1), pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetImpDepConstantsReply);
+ WritePEXBufferReply(pexGetImpDepConstantsReply);
+ }
+ return( err );
+
+} /* end-PEXGetImpDepConstants() */
+
+ErrorCode
+PEXMatchRendererTargets( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexMatchRendererTargetsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr d;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_DRAWABLE (strmPtr->drawable, d);
+
+ /* no way to check visualID besides doing the work of Match */
+
+ SETUP_INQ(pexMatchRendererTargetsReply);
+
+ err = MatchRendererTargets(d, (int)strmPtr->depth, (int)strmPtr->type,
+ (VisualID)strmPtr->visualID,
+ (int)strmPtr->maxTriplets, pPEXBuffer );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexMatchRendererTargetsReply);
+ WritePEXBufferReply(pexMatchRendererTargetsReply);
+ }
+ return( err );
+
+} /* end-PEXMatchRendererTargets() */
+
+ErrorCode
+PEXQueryColorApprox( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexQueryColorApproxReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr d;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_DRAWABLE (strmPtr->drawable, d);
+
+ SETUP_INQ(pexQueryColorApproxReply);
+
+ /*
+ Call to query color approximation routine goes here
+ */
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexQueryColorApproxReply);
+ WritePEXBufferReply(pexQueryColorApproxReply);
+ }
+ return( err );
+
+} /* end-PEXQueryColorApprox() */
+
+
+ErrorCode
+PEXEscape( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEscapeReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ pexEscapeSetEchoColourData *ptr;
+ CARD8 *pcs;
+
+
+ /* Support the one Registered Escape, Set Echo Color */
+ switch (strmPtr->escapeID) {
+ case PEXEscapeSetEchoColour: {
+ ptr = (pexEscapeSetEchoColourData *)(strmPtr + 1);
+ pcs = (CARD8 *)(ptr+1);
+
+ LU_RENDERER(ptr->rdr, prend);
+ EXTRACT_COLOUR_SPECIFIER(prend->echoColour,pcs);
+ break;
+ }
+
+ default:
+ err = BadValue;
+ break;
+ }
+
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXEscape() */
+
+
+ErrorCode
+PEXEscapeWithReply( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEscapeWithReplyReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ /* Do nothing here, Escape with Reply is not implemented in SI
+ */
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXEscapeWithReply() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexLut.c b/xc/programs/Xserver/PEX5/dipex/objects/pexLut.c
new file mode 100644
index 000000000..c383df562
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexLut.c
@@ -0,0 +1,500 @@
+/* $TOG: pexLut.c /main/6 1998/02/10 12:35:11 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexLut.c,v 3.7 1999/01/31 12:21:31 dawes Exp $ */
+
+
+/*++
+ * PEXCreateLookupTable
+ * PEXCopyLookupTable
+ * PEXFreeLookupTable
+ * PEXGetTableInfo
+ * PEXGetPredefinedEntries
+ * PEXGetDefinedIndices
+ * PEXGetTableEntry
+ * PEXGetTableEntries
+ * PEXSetTableEntries
+ * PEXDeleteTableEntries
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pex_site.h"
+#include "pexLookup.h"
+#include "pexos.h"
+
+
+#define VALID_TABLETYPE(type) ((type > 0) && (type <= PEXMaxTableType))
+
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+
+/*++ PEXCreateLookupTable
+ --*/
+ErrorCode
+PEXCreateLookupTable (cntxtPtr, strmPtr)
+pexContext *cntxtPtr; /* context pointer */
+pexCreateLookupTableReq *strmPtr; /* stream pointer */
+{
+ ErrorCode freeLUT ();
+ ErrorCode err = Success;
+ DrawablePtr pdraw = 0;
+ diLUTHandle lutptr = 0;
+
+ if (!VALID_TABLETYPE(strmPtr->tableType))
+ PEX_ERR_EXIT(BadValue,strmPtr->tableType,cntxtPtr);
+
+ if (!LegalNewID(strmPtr->lut, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->lut,cntxtPtr);
+
+ LU_DRAWABLE(strmPtr->drawableExample, pdraw);
+
+ lutptr = (diLUTHandle) xalloc ((unsigned long)sizeof(ddLUTResource));
+ if (!lutptr) PEX_ERR_EXIT (BadAlloc,0,cntxtPtr);
+ lutptr->id = strmPtr->lut;
+ lutptr->lutType = strmPtr->tableType;
+
+ err = CreateLUT( pdraw, lutptr);
+ if (err) {
+ xfree((pointer)lutptr);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ ADDRESOURCE (strmPtr->lut, PEXLutType, lutptr);
+
+ return( err );
+
+} /* end-PEXCreateLookupTable() */
+
+/*++ PEXCopyLookupTable
+ --*/
+ErrorCode
+PEXCopyLookupTable (cntxtPtr, strmPtr)
+pexContext *cntxtPtr; /* Context Pointer */
+pexCopyLookupTableReq *strmPtr; /* Stream Pointer */
+{
+ diLUTHandle lsrc, ldest;
+ ErrorCode err = Success;
+
+ LU_TABLE(strmPtr->src, lsrc);
+ LU_TABLE(strmPtr->dst, ldest);
+
+ err = CopyLUT (lsrc, ldest);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return (err);
+
+} /* end-PEXCopyLookupTable() */
+
+/*++ PEXFreeLookupTable
+ --*/
+ErrorCode
+PEXFreeLookupTable (cntxtPtr, strmPtr)
+pexContext *cntxtPtr; /* Context Pointer */
+pexFreeLookupTableReq *strmPtr; /* Stream Pointer */
+{
+ ErrorCode err = Success;
+ diLUTHandle l = 0;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXLookupTableError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_TABLE(strmPtr->id, l);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreeLookupTable() */
+
+/*++ PEXGetTableInfoReq
+ --*/
+
+ErrorCode
+PEXGetTableInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetTableInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr pdraw;
+ extern ddBufferPtr pPEXBuffer;
+ pexGetTableInfoReply *reply = (pexGetTableInfoReply *)(pPEXBuffer->pHead);
+
+ if (!VALID_TABLETYPE(strmPtr->tableType))
+ PEX_ERR_EXIT(BadValue,strmPtr->tableType,cntxtPtr);
+
+ LU_DRAWABLE(strmPtr->drawableExample, pdraw);
+
+ SETUP_INQ(pexGetTableInfoReply);
+
+ err = InquireLUTInfo( pdraw, strmPtr->tableType,
+ (pexTableInfo *)&(reply->definableEntries));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = 0;
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof(pexGetTableInfoReply) + reply->length,
+ reply);
+ return( err );
+
+} /* end-PEXGetTableInfo() */
+
+/*++ PEXGetPredefinedEntries
+ --*/
+
+ErrorCode
+PEXGetPredefinedEntries( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetPredefinedEntriesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBufferPtr pPEXBuffer;
+ DrawablePtr pdraw = 0;
+ ddULONG numEntries = (ddULONG)(strmPtr->count);
+
+ if (!VALID_TABLETYPE(strmPtr->tableType))
+ PEX_ERR_EXIT(BadValue,strmPtr->tableType,cntxtPtr);
+
+ LU_DRAWABLE(strmPtr->drawableExample, pdraw);
+
+ SETUP_INQ(pexGetPredefinedEntriesReply);
+
+ err = InquireLUTPredEntries( pdraw, strmPtr->tableType,
+ strmPtr->start, strmPtr->count,
+ &numEntries, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetPredefinedEntriesReply);
+ reply->numEntries = numEntries;
+ WritePEXBufferReply(pexGetPredefinedEntriesReply);
+ }
+ return( err );
+
+} /* end-PEXGetPredefinedEntries() */
+
+/*++ PEXGetDefinedIndices
+ --*/
+
+ErrorCode
+PEXGetDefinedIndices( cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetDefinedIndicesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf;
+ extern ddBufferPtr pPEXBuffer;
+ ddULONG numIndices = 0;
+
+ LU_TABLE(strmPtr->id, pf);
+
+ SETUP_INQ(pexGetDefinedIndicesReply);
+
+ err = InquireLUTIndices( pf, &numIndices, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetDefinedIndicesReply);
+ reply->numIndices = numIndices;
+ WritePEXBufferReply(pexGetDefinedIndicesReply);
+ }
+ return( err );
+
+} /* end-PEXGetDefinedIndices() */
+
+/*++ PEXGetTableEntry
+ --*/
+
+ErrorCode
+PEXGetTableEntry( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetTableEntryReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf;
+ extern ddBufferPtr pPEXBuffer;
+ ddUSHORT status;
+
+ LU_TABLE(strmPtr->lut, pf);
+
+ SETUP_INQ(pexGetTableEntryReply);
+
+ err = InquireLUTEntry( pf, strmPtr->index, strmPtr->valueType,
+ &status, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /*
+ * If this is a font table, we have to convert font handles to font ids.
+ */
+
+ if (pf->lutType == PEXTextFontLUT) {
+ int i;
+ pexTextFontEntry *ptfe = (pexTextFontEntry *)(pPEXBuffer->pBuf);
+ pexFont *ptr = (pexFont *)(ptfe + 1);
+ for (i=0; i<ptfe->numFonts; i++, ptr++)
+ *ptr = ((diFontHandle) *ptr)->id;
+ }
+
+ {
+ SETUP_VAR_REPLY(pexGetTableEntryReply);
+ reply->status = status;
+ reply->tableType = pf->lutType;
+ WritePEXBufferReply(pexGetTableEntryReply);
+ }
+ return( err );
+
+} /* end-PEXGetTableEntry() */
+
+/*++ PEXGetTableEntries
+ --*/
+ErrorCode
+PEXGetTableEntries( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetTableEntriesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf;
+ ddULONG numEntries;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_TABLE(strmPtr->lut, pf);
+
+ SETUP_INQ(pexGetTableEntriesReply);
+
+ err = InquireLUTEntries( pf, strmPtr->start, strmPtr->count,
+ strmPtr->valueType, &numEntries, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /*
+ * If this is a font table, we have to convert font handles to font ids.
+ */
+
+ if (pf->lutType == PEXTextFontLUT) {
+ int i, j;
+ pexTextFontEntry *ptfe = (pexTextFontEntry *)(pPEXBuffer->pBuf);
+ for (i=0; i<strmPtr->count; i++) {
+ pexFont *ptr = (pexFont *)(ptfe + 1);
+ for (j=0; j<ptfe->numFonts; j++, ptr++)
+ *ptr = ((diFontHandle) *ptr)->id;
+ ptfe = (pexTextFontEntry *) ptr;
+ }
+ }
+
+ {
+ SETUP_VAR_REPLY(pexGetTableEntriesReply);
+ reply->tableType = pf->lutType;
+ reply->numEntries = numEntries;
+ WritePEXBufferReply(pexGetTableEntriesReply);
+ }
+ return( err );
+
+} /* end-PEXGetTableEntries() */
+
+/*++ PEXSetTableEntries
+ --*/
+
+ErrorCode
+PEXSetTableEntries( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetTableEntriesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf = 0;
+
+ LU_TABLE(strmPtr->lut, pf);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ /*
+ If this is a font table, lookup font id's and stuff pointers into
+ the that longword, so ddpex gets its handles instead of ids.
+ */
+ if (pf->lutType == PEXTextFontLUT) {
+ int i, j;
+ diFontHandle fh;
+ pexTextFontEntry *ptfe = (pexTextFontEntry *)(strmPtr + 1);
+ for (i=0; i<strmPtr->count; i++) {
+ pexFont *ptr = (pexFont *)(ptfe + 1);
+ for (j=0; j<ptfe->numFonts; j++, ptr++) {
+ LU_PEXFONT(*ptr, fh);
+ *ptr = (pexFont) fh;
+ }
+ ptfe = (pexTextFontEntry *) ptr;
+ }
+ }
+
+ err = SetLUTEntries( pf, strmPtr->start, strmPtr->count,
+ (ddPointer)(strmPtr + 1));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetTableEntries() */
+
+/*++ PEXDeleteTableEntries
+ --*/
+
+ErrorCode
+PEXDeleteTableEntries( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexDeleteTableEntriesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf;
+
+ LU_TABLE(strmPtr->lut, pf);
+ err = DeleteLUTEntries (pf, strmPtr->start, strmPtr->count);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXDeleteTableEntries() */
+
+/*++ PEXChangeTableValues
+ --*/
+ErrorCode
+PEXChangeTableValues (cntxtPtr, strmPtr)
+pexContext *cntxtPtr; /* context pointer */
+pexChangeTableValuesReq *strmPtr; /* stream pointer */
+{
+ ErrorCode err = Success;
+ diLUTHandle pf = 0;
+
+ LU_TABLE(strmPtr->lut, pf);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ /*
+ If this is a font table, lookup font id's and stuff pointers into
+ the that longword, so ddpex gets its handles instead of ids.
+ */
+ if ( (pf->lutType == PEXTextFontLUT) &&
+ (strmPtr->TableMask == PEXLUTVTextFontGroup) )
+ {
+ int i, j;
+ diFontHandle fh;
+ pexTextFontEntry *ptfe = (pexTextFontEntry *)(strmPtr + 1);
+ pexFont *ptr = (pexFont *)(ptfe + 1);
+ for (j=0; j<ptfe->numFonts; j++, ptr++) {
+ LU_PEXFONT(*ptr, fh);
+ *ptr = (pexFont) fh;
+ }
+ }
+
+ /* call to change table values routine goes here, this is a shell
+ for this routine but should contain all necessary information
+ to process the request
+
+ err = ChangeTableValues ( pf, strmPtr->length, strmPtr->index,
+ strmPtr->TableMask, (ddPointer)(strmPtr + 1));
+ */
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangeTableValues() */
+
+/*++ PEXGetTableValues
+ --*/
+ErrorCode
+PEXGetTableValues( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetTableValuesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diLUTHandle pf;
+ ddULONG numValues;
+ ddUSHORT status;
+ extern ddBuffer *pPEXBuffer;
+
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+ LU_TABLE(strmPtr->lut, pf);
+
+ SETUP_INQ(pexGetTableValuesReply);
+
+ /* Place holder for ddpex interface
+ err = GetLUTValues( pf, strmPtr->index, strmPtr->TableMask,
+ strmPtr->valueType, &numValues, &status, pPEXBuffer);
+ */
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /*
+ * If this is a font table, we have to convert font handles to font ids.
+ */
+
+ if ( (pf->lutType == PEXTextFontLUT) &&
+ (strmPtr->TableMask == PEXLUTVTextFontGroup) )
+ {
+ int i, j;
+ pexTextFontEntry *ptfe = (pexTextFontEntry *)(pPEXBuffer->pBuf);
+ pexFont *ptr = (pexFont *)(ptfe + 1);
+ for (j=0; j<ptfe->numFonts; j++, ptr++)
+ *ptr = ((diFontHandle) *ptr)->id;
+ }
+
+ {
+ SETUP_VAR_REPLY(pexGetTableValuesReply);
+ reply->tableType = pf->lutType;
+ reply->numValues = numValues;
+ reply->status = status;
+ WritePEXBufferReply(pexGetTableValuesReply);
+ }
+ return( err );
+
+} /* end-PEXGetTableValues() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexNs.c b/xc/programs/Xserver/PEX5/dipex/objects/pexNs.c
new file mode 100644
index 000000000..c79758f62
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexNs.c
@@ -0,0 +1,187 @@
+/* $TOG: pexNs.c /main/4 1998/02/10 12:35:15 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexNs.c,v 3.6 1999/01/31 12:21:32 dawes Exp $ */
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pexLookup.h"
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+
+/*++ PEXCreateNameSet
+ --*/
+ErrorCode
+PEXCreateNameSet (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateNameSetReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode FreeNameSet (), CreateNameSet ();
+ diNSHandle nsptr;
+
+ if (!LegalNewID(strmPtr->id, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->id,cntxtPtr);
+
+
+ nsptr = (diNSHandle) xalloc ((unsigned long)sizeof(ddNSResource));
+ if (!nsptr) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ nsptr->id = strmPtr->id;
+ err = CreateNameSet(nsptr);
+ if (err) xfree((pointer)nsptr);
+
+ ADDRESOURCE(strmPtr->id, PEXNameType, nsptr);
+
+ return( err );
+
+} /* end-PEXCreateNameSet() */
+
+/*++ PEXCopyNameSet
+ --*/
+ErrorCode
+PEXCopyNameSet (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyNameSetReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diNSHandle nsrc = 0, ndst = 0;
+
+ LU_NAMESET(strmPtr->src, nsrc);
+ LU_NAMESET(strmPtr->dst, ndst);
+
+ err = CopyNameSet (nsrc, ndst);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyNameSet() */
+
+/*++ PEXFreeNameSet
+ --*/
+ErrorCode
+PEXFreeNameSet (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreeNameSetReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diNSHandle pns = 0;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXNameSetError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_NAMESET(strmPtr->id, pns);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return(err);
+
+} /* end-PEXFreeNameSet() */
+
+/*++ PEXGetNameSet
+ --*/
+ErrorCode
+PEXGetNameSet( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetNameSetReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diNSHandle pns;
+ extern ddBufferPtr pPEXBuffer;
+ CARD32 numNames;
+
+ LU_NAMESET(strmPtr->id, pns);
+
+ SETUP_INQ(pexGetNameSetReply);
+
+ err = InquireNameSet (pns, &numNames, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetNameSetReply);
+ reply->numNames = numNames;
+ WritePEXBufferReply(pexGetNameSetReply);
+ }
+ return( err );
+
+} /* end-PEXGetNameSet() */
+
+/*++ PEXChangeNameSet
+ --*/
+ErrorCode
+PEXChangeNameSet( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangeNameSetReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diNSHandle pns = 0;
+
+ LU_NAMESET(strmPtr->ns, pns);
+
+ err = ChangeNameSet( pns, strmPtr->action,
+ (strmPtr->length - (sizeof(pexChangeNameSetReq)
+ / sizeof(pexNameSet))),
+ (ddULONG *)(strmPtr + 1));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangeNameSet() */
+/*++
+ *
+ * End of File
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexPc.c b/xc/programs/Xserver/PEX5/dipex/objects/pexPc.c
new file mode 100644
index 000000000..59e74b79d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexPc.c
@@ -0,0 +1,1514 @@
+/* $TOG: pexPc.c /main/11 1998/02/10 12:35:20 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexPc.c,v 3.5 1998/10/04 09:35:03 dawes Exp $ */
+
+
+/*++
+ * PEXCreatePipelineContext
+ * PEXCopyPipelineContext
+ * PEXFreePipelineContext
+ * PEXGetPipelineContext
+ * PEXChangePipelineContext
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "dipex.h"
+#include "ddpex.h"
+#include "pexLookup.h"
+#include "pexExtract.h"
+#include "pexUtils.h"
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+/* need to do this to return correct ASF_ENABLES bits per Encoding */
+#define ASF_ALL 0x3FFFFFFF
+
+#define CHK_PEX_BUF(SIZE,INCR,REPLY,TYPE,PTR) {\
+ (SIZE)+=(INCR); \
+ if (pPEXBuffer->bufSize < (SIZE)) { \
+ ErrorCode err = Success; \
+ int offset = (int)(((unsigned char *)(PTR)) - ((unsigned char *)(pPEXBuffer->pHead))); \
+ err = puBuffRealloc(pPEXBuffer,(ddULONG)(SIZE)); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); \
+ (REPLY) = (TYPE *)(pPEXBuffer->pHead); \
+ (PTR) = (unsigned char *)(pPEXBuffer->pHead + offset); } \
+}
+
+#define PADDING(n) ( (n)&3 ? (4 - ((n)&3)) : 0)
+
+ErrorCode
+UpdatePCRefs (pc, pr, action)
+ddPCStr *pc;
+ddRendererStr *pr;
+ddAction action;
+{
+ if (action == ADD) {
+ if (puAddToList((ddPointer) &pr, (unsigned long)1, pc->rendRefs)
+ == BadAlloc)
+ return (BadAlloc);
+ } else
+ puRemoveFromList((ddPointer) &pr, pc->rendRefs);
+
+ return(Success);
+}
+
+static ErrorCode
+UpdatePipelineContext (cntxtPtr, pca, itemMask, ptr)
+pexContext *cntxtPtr;
+ddPCAttr *pca;
+CARD32 itemMask[3];
+unsigned char *ptr;
+{
+ ErrorCode err = Success;
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerType) {
+ EXTRACT_INT16_FROM_4B (pca->markerType, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerScale) {
+ EXTRACT_FLOAT (pca->markerScale, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->markerColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerBundleIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->markerIndex, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextFont) {
+ EXTRACT_CARD16_FROM_4B (pca->textFont, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPrecision) {
+ EXTRACT_CARD16_FROM_4B (pca->textPrecision, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharExpansion) {
+ EXTRACT_FLOAT (pca->charExpansion, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharSpacing) {
+ EXTRACT_FLOAT (pca->charSpacing, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->textColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharHeight) {
+ EXTRACT_FLOAT (pca->charHeight, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharUpVector) {
+ EXTRACT_FLOAT (pca->charUp.x, ptr);
+ EXTRACT_FLOAT (pca->charUp.y, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPath) {
+ EXTRACT_CARD16_FROM_4B (pca->textPath, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextAlignment) {
+ EXTRACT_CARD16 (pca->textAlignment.vertical, ptr);
+ EXTRACT_CARD16 (pca->textAlignment.horizontal, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextHeight) {
+ EXTRACT_FLOAT (pca->atextHeight, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextUpVector) {
+ EXTRACT_FLOAT (pca->atextUp.x, ptr);
+ EXTRACT_FLOAT (pca->atextUp.y, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextPath) {
+ EXTRACT_CARD16_FROM_4B (pca->atextPath, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextAlignment) {
+ EXTRACT_CARD16 (pca->atextAlignment.vertical, ptr);
+ EXTRACT_CARD16 (pca->atextAlignment.horizontal, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextStyle) {
+ EXTRACT_INT16_FROM_4B (pca->atextStyle, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextBundleIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->textIndex, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineType) {
+ EXTRACT_INT16_FROM_4B (pca->lineType, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineWidth) {
+ EXTRACT_FLOAT (pca->lineWidth, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->lineColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCurveApproximation) {
+ EXTRACT_INT16_FROM_4B (pca->curveApprox.approxMethod, ptr);
+ EXTRACT_FLOAT (pca->curveApprox.tolerance, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPolylineInterp) {
+ EXTRACT_INT16_FROM_4B (pca->lineInterp,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineBundleIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->lineIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyle) {
+ EXTRACT_INT16_FROM_4B (pca->intStyle,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyleIndex) {
+ EXTRACT_INT16_FROM_4B (pca->intStyleIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->surfaceColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflAttr) {
+ EXTRACT_FLOAT (pca->reflAttr.ambient, ptr);
+ EXTRACT_FLOAT (pca->reflAttr.diffuse, ptr);
+ EXTRACT_FLOAT (pca->reflAttr.specular, ptr);
+ EXTRACT_FLOAT (pca->reflAttr.specularConc, ptr);
+ EXTRACT_FLOAT (pca->reflAttr.transmission, ptr);
+ EXTRACT_COLOUR_SPECIFIER (pca->reflAttr.specularColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflModel) {
+ EXTRACT_INT16_FROM_4B (pca->reflModel,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceInterp) {
+ EXTRACT_INT16_FROM_4B (pca->surfInterp,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyle) {
+ EXTRACT_INT16_FROM_4B (pca->bfIntStyle,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyleIndex) {
+ EXTRACT_INT16_FROM_4B (pca->bfIntStyleIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->bfSurfColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflAttr) {
+ EXTRACT_FLOAT (pca->bfReflAttr.ambient, ptr);
+ EXTRACT_FLOAT (pca->bfReflAttr.diffuse, ptr);
+ EXTRACT_FLOAT (pca->bfReflAttr.specular, ptr);
+ EXTRACT_FLOAT (pca->bfReflAttr.specularConc, ptr);
+ EXTRACT_FLOAT (pca->bfReflAttr.transmission, ptr);
+ EXTRACT_COLOUR_SPECIFIER (pca->bfReflAttr.specularColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflModel) {
+ EXTRACT_INT16_FROM_4B (pca->bfReflModel,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceInterp) {
+ EXTRACT_INT16_FROM_4B (pca->bfSurfInterp,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceApproximation) {
+ EXTRACT_INT16_FROM_4B (pca->surfApprox.approxMethod,ptr);
+ EXTRACT_FLOAT (pca->surfApprox.uTolerance, ptr);
+ EXTRACT_FLOAT (pca->surfApprox.vTolerance, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCullingMode) {
+ EXTRACT_CARD16_FROM_4B (pca->cullMode,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDistinguishFlag) {
+ EXTRACT_CARD8_FROM_4B (pca->distFlag,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternSize) {
+ EXTRACT_FLOAT (pca->patternSize.x, ptr);
+ EXTRACT_FLOAT (pca->patternSize.y, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefPt) {
+ EXTRACT_FLOAT (pca->patternRefPt.x, ptr);
+ EXTRACT_FLOAT (pca->patternRefPt.y, ptr);
+ EXTRACT_FLOAT (pca->patternRefPt.z, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec1) {
+ EXTRACT_FLOAT (pca->patternRefV1.x, ptr);
+ EXTRACT_FLOAT (pca->patternRefV1.y, ptr);
+ EXTRACT_FLOAT (pca->patternRefV1.z, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec2) {
+ EXTRACT_FLOAT (pca->patternRefV2.x, ptr);
+ EXTRACT_FLOAT (pca->patternRefV2.y, ptr);
+ EXTRACT_FLOAT (pca->patternRefV2.z, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorBundleIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->intIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeFlag) {
+ EXTRACT_CARD16_FROM_4B (pca->edges,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeType) {
+ EXTRACT_INT16_FROM_4B (pca->edgeType,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeWidth) {
+ EXTRACT_FLOAT (pca->edgeWidth,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeColour) {
+ EXTRACT_COLOUR_SPECIFIER (pca->edgeColour, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCEdgeBundleIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->edgeIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLocalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ EXTRACT_FLOAT(pca->localMat[i][j], ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCGlobalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ EXTRACT_FLOAT(pca->globalMat[i][j], ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClip) {
+ EXTRACT_CARD16_FROM_4B (pca->modelClip,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClipVolume) {
+ unsigned long i, numHalfSpaces;
+ EXTRACT_CARD32 ( numHalfSpaces, ptr);
+ PU_EMPTY_LIST(pca->modelClipVolume);
+ /* don't need to do this emptying the list and adding is sufficient
+ puDeleteList(pca->modelClipVolume);
+ pca->modelClipVolume = puCreateList(DD_HALF_SPACE);
+ if (!pca->modelClipVolume) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ */
+ puAddToList((ddPointer)ptr, numHalfSpaces, pca->modelClipVolume);
+ /* skip past list of Half Space */
+ for ( i = 0; i < numHalfSpaces; i++) {
+ SKIP_STRUCT(ptr, 1, ddCoord3D);
+ SKIP_STRUCT(ptr, 1, ddVector3D);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCViewIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->viewIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLightState) {
+ unsigned long i, numskip;
+ EXTRACT_CARD32(i,ptr);
+ PU_EMPTY_LIST(pca->lightState);
+ puAddToList((ddPointer)ptr,i,pca->lightState);
+ /* skip over CARD16 and pad if any */
+ numskip = (i + 1) / 2;
+ SKIP_PADDING( ptr, numskip * 4);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDepthCueIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->depthCueIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSetAsfValues) {
+ CARD32 asf_enables, asfs;
+ EXTRACT_CARD32 (asf_enables,ptr);
+ EXTRACT_CARD32 (asfs,ptr);
+ pca->asfs = (pca->asfs & ~asf_enables) | (asfs & asf_enables);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPickId) {
+ EXTRACT_CARD32 (pca->pickId,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCHlhsrIdentifier) {
+ EXTRACT_CARD32 (pca->hlhsrType,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCNameSet) {
+ pexNameSet ns;
+ EXTRACT_CARD32 (ns, ptr);
+ LU_NAMESET(ns, pca->pCurrentNS);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCColourApproxIndex) {
+ EXTRACT_CARD16_FROM_4B (pca->colourApproxIndex,ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCRenderingColourModel) {
+ EXTRACT_INT16_FROM_4B (pca->rdrColourModel, ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCParaSurfCharacteristics) {
+ EXTRACT_INT16 (pca->psc.type, ptr);
+ SKIP_PADDING(ptr,2);
+ switch (pca->psc.type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+ case PEXPSCIsoCurves: {
+ EXTRACT_CARD16(pca->psc.data.isoCurves.placementType, ptr);
+ SKIP_PADDING(ptr,2);
+ EXTRACT_CARD16(pca->psc.data.isoCurves.numUcurves, ptr);
+ EXTRACT_CARD16(pca->psc.data.isoCurves.numVcurves, ptr);
+ break;
+ }
+ case PEXPSCMcLevelCurves: {
+ EXTRACT_COORD3D((&(pca->psc.data.mcLevelCurves.origin)),ptr);
+ EXTRACT_COORD3D((&(pca->psc.data.mcLevelCurves.direction)),ptr);
+ EXTRACT_CARD16(pca->psc.data.mcLevelCurves.numberIntersections,ptr);
+ SKIP_PADDING(ptr,2);
+ pca->psc.data.mcLevelCurves.pPoints = (ddFLOAT *)
+ xalloc((unsigned long) (sizeof(ddFLOAT) *
+ pca->psc.data.mcLevelCurves.numberIntersections));
+ EXTRACT_STRUCT( pca->psc.data.mcLevelCurves.numberIntersections,
+ PEXFLOAT, pca->psc.data.mcLevelCurves.pPoints,
+ ptr);
+ break;
+ }
+
+ case PEXPSCWcLevelCurves: {
+ EXTRACT_COORD3D(&(pca->psc.data.wcLevelCurves.origin),ptr);
+ EXTRACT_COORD3D(&(pca->psc.data.wcLevelCurves.direction),ptr);
+ EXTRACT_CARD16(pca->psc.data.wcLevelCurves.numberIntersections,ptr);
+ SKIP_PADDING(ptr,2);
+ pca->psc.data.wcLevelCurves.pPoints = (ddFLOAT *)
+ xalloc((unsigned long) (sizeof(ddFLOAT) *
+ pca->psc.data.wcLevelCurves.numberIntersections));
+ EXTRACT_STRUCT( pca->psc.data.wcLevelCurves.numberIntersections,
+ PEXFLOAT, pca->psc.data.wcLevelCurves.pPoints,
+ ptr);
+ break;
+ }
+
+ }
+ }
+
+ return (Success);
+
+}
+
+
+static
+void CopyColourSpecifier (src, dst)
+ddColourSpecifier *src, *dst;
+{
+ dst->colourType = src->colourType;
+
+ switch (dst->colourType) {
+ case PEXIndexedColour: {
+ dst->colour.indexed.index = src->colour.indexed.index;
+ break;
+ }
+
+ case PEXRgbFloatColour: {
+ dst->colour.rgbFloat.red = src->colour.rgbFloat.red;
+ dst->colour.rgbFloat.green = src->colour.rgbFloat.green;
+ dst->colour.rgbFloat.blue = src->colour.rgbFloat.blue;
+ break;
+ }
+
+ case PEXCieFloatColour: {
+ dst->colour.cieFloat.x = src->colour.cieFloat.x;
+ dst->colour.cieFloat.y = src->colour.cieFloat.y;
+ dst->colour.cieFloat.z = src->colour.cieFloat.z;
+ break;
+ }
+
+ case PEXHsvFloatColour: {
+ dst->colour.hsvFloat.hue = src->colour.hsvFloat.hue;
+ dst->colour.hsvFloat.saturation
+ = src->colour.hsvFloat.saturation;
+ dst->colour.hsvFloat.value = src->colour.hsvFloat.value;
+ break;
+ }
+
+ case PEXHlsFloatColour: {
+ dst->colour.hlsFloat.hue = src->colour.hlsFloat.hue;
+ dst->colour.hlsFloat.lightness = src->colour.hlsFloat.lightness;
+ dst->colour.hlsFloat.saturation
+ = src->colour.hlsFloat.saturation;
+ break;
+ }
+
+ case PEXRgb8Colour: {
+ dst->colour.rgb8.red = src->colour.rgb8.red;
+ dst->colour.rgb8.green = src->colour.rgb8.green;
+ dst->colour.rgb8.blue = src->colour.rgb8.blue;
+ break;
+ }
+
+ case PEXRgb16Colour: {
+ dst->colour.rgb16.red = src->colour.rgb16.red;
+ dst->colour.rgb16.green = src->colour.rgb16.green;
+ dst->colour.rgb16.blue = src->colour.rgb16.blue;
+ break;
+ }
+ }
+}
+
+
+/*++ PEXCreatePipelineContext
+ --*/
+ErrorCode
+PEXCreatePipelineContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePipelineContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode freePipelineContext();
+ ddPCStr *pc;
+ extern void DefaultPC();
+
+ if (!LegalNewID(strmPtr->pc, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->pc,cntxtPtr);
+
+ pc = (ddPCStr *)xalloc((unsigned long)(sizeof(ddPCStr) + sizeof(ddPCAttr)));
+ if (!pc) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ pc->PCid = strmPtr->pc;
+ pc->rendRefs = puCreateList(DD_RENDERER);
+ if (!pc->rendRefs) {
+ xfree((pointer)pc);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+ pc->pPCAttr = (ddPCAttr *)(pc+1);
+ DefaultPC(pc->pPCAttr);
+ if (!pc->pPCAttr->modelClipVolume || !pc->pPCAttr->lightState) {
+ puDeleteList(pc->rendRefs);
+ xfree((pointer)pc);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+
+ err = UpdatePipelineContext( cntxtPtr, pc->pPCAttr, strmPtr->itemMask,
+ (unsigned char *)(strmPtr + 1));
+ if (err) {
+ puDeleteList(pc->rendRefs);
+ puDeleteList(pc->pPCAttr->modelClipVolume);
+ puDeleteList(pc->pPCAttr->lightState);
+ xfree((pointer)pc);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ ADDRESOURCE (strmPtr->pc, PEXPipeType, pc);
+ return (err);
+
+} /* end-PEXCreatePipelineContext() */
+
+/*++ PEXCopyPipelineContext
+ --*/
+ErrorCode
+PEXCopyPipelineContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyPipelineContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddPCStr *src, *dst;
+
+ LU_PIPELINECONTEXT(strmPtr->src, src);
+ LU_PIPELINECONTEXT(strmPtr->dst, dst);
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerType) {
+ dst->pPCAttr->markerType = src->pPCAttr->markerType;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerScale) {
+ dst->pPCAttr->markerScale = src->pPCAttr->markerScale;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerColour) {
+ CopyColourSpecifier( &(src->pPCAttr->markerColour),
+ &(dst->pPCAttr->markerColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerBundleIndex) {
+ dst->pPCAttr->markerIndex = src->pPCAttr->markerIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextFont) {
+ dst->pPCAttr->textFont = src->pPCAttr->textFont;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextPrecision) {
+ dst->pPCAttr->textPrecision = src->pPCAttr->textPrecision;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharExpansion) {
+ dst->pPCAttr->charExpansion = src->pPCAttr->charExpansion;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharSpacing) {
+ dst->pPCAttr->charSpacing = src->pPCAttr->charSpacing;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextColour) {
+ CopyColourSpecifier( &(src->pPCAttr->textColour),
+ &(dst->pPCAttr->textColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharHeight) {
+ dst->pPCAttr->charHeight = src->pPCAttr->charHeight;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharUpVector) {
+ dst->pPCAttr->charUp.x = src->pPCAttr->charUp.x;
+ dst->pPCAttr->charUp.y = src->pPCAttr->charUp.y;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextPath) {
+ dst->pPCAttr->textPath = src->pPCAttr->textPath;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextAlignment) {
+ dst->pPCAttr->textAlignment.vertical
+ = src->pPCAttr->textAlignment.vertical;
+ dst->pPCAttr->textAlignment.horizontal
+ = src->pPCAttr->textAlignment.horizontal;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextHeight) {
+ dst->pPCAttr->atextHeight = src->pPCAttr->atextHeight;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextUpVector) {
+ dst->pPCAttr->atextUp.x = src->pPCAttr->atextUp.x;
+ dst->pPCAttr->atextUp.y = src->pPCAttr->atextUp.y;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextPath) {
+ dst->pPCAttr->atextPath = src->pPCAttr->atextPath;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextAlignment) {
+ dst->pPCAttr->atextAlignment.vertical
+ = src->pPCAttr->atextAlignment.vertical;
+ dst->pPCAttr->atextAlignment.horizontal
+ = src->pPCAttr->atextAlignment.horizontal;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextStyle) {
+ dst->pPCAttr->atextStyle = src->pPCAttr->atextStyle;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextBundleIndex) {
+ dst->pPCAttr->textIndex = src->pPCAttr->textIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineType) {
+ dst->pPCAttr->lineType = src->pPCAttr->lineType;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineWidth) {
+ dst->pPCAttr->lineWidth = src->pPCAttr->lineWidth;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineColour) {
+ CopyColourSpecifier( &(src->pPCAttr->lineColour),
+ &(dst->pPCAttr->lineColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCurveApproximation) {
+ dst->pPCAttr->curveApprox.approxMethod
+ = src->pPCAttr->curveApprox.approxMethod;
+ dst->pPCAttr->curveApprox.tolerance
+ = src->pPCAttr->curveApprox.tolerance;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPolylineInterp) {
+ dst->pPCAttr->lineInterp = src->pPCAttr->lineInterp;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineBundleIndex) {
+ dst->pPCAttr->lineIndex = src->pPCAttr->lineIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorStyle) {
+ dst->pPCAttr->intStyle = src->pPCAttr->intStyle;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorStyleIndex) {
+ dst->pPCAttr->intStyleIndex = src->pPCAttr->intStyleIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceColour) {
+ CopyColourSpecifier( &(src->pPCAttr->surfaceColour),
+ &(dst->pPCAttr->surfaceColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceReflAttr) {
+ dst->pPCAttr->reflAttr.ambient = src->pPCAttr->reflAttr.ambient;
+ dst->pPCAttr->reflAttr.diffuse = src->pPCAttr->reflAttr.diffuse;
+ dst->pPCAttr->reflAttr.specular = src->pPCAttr->reflAttr.specular;
+ dst->pPCAttr->reflAttr.specularConc
+ = src->pPCAttr->reflAttr.specularConc;
+ dst->pPCAttr->reflAttr.transmission
+ = src->pPCAttr->reflAttr.transmission;
+ CopyColourSpecifier( &(src->pPCAttr->reflAttr.specularColour),
+ &(dst->pPCAttr->reflAttr.specularColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceReflModel) {
+ dst->pPCAttr->reflModel = src->pPCAttr->reflModel;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceInterp) {
+ dst->pPCAttr->surfInterp = src->pPCAttr->surfInterp;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfInteriorStyle) {
+ dst->pPCAttr->bfIntStyle = src->pPCAttr->bfIntStyle;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfInteriorStyleIndex) {
+ dst->pPCAttr->bfIntStyleIndex = src->pPCAttr->bfIntStyleIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceColour) {
+ CopyColourSpecifier( &(src->pPCAttr->bfSurfColour),
+ &(dst->pPCAttr->bfSurfColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceReflAttr) {
+ dst->pPCAttr->bfReflAttr.ambient = src->pPCAttr->bfReflAttr.ambient;
+ dst->pPCAttr->bfReflAttr.diffuse = src->pPCAttr->bfReflAttr.diffuse;
+ dst->pPCAttr->bfReflAttr.specular = src->pPCAttr->bfReflAttr.specular;
+ dst->pPCAttr->bfReflAttr.specularConc
+ = src->pPCAttr->bfReflAttr.specularConc;
+ dst->pPCAttr->bfReflAttr.transmission
+ = src->pPCAttr->bfReflAttr.transmission;
+ CopyColourSpecifier( &(src->pPCAttr->bfReflAttr.specularColour),
+ &(dst->pPCAttr->bfReflAttr.specularColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceReflModel) {
+ dst->pPCAttr->bfReflModel = src->pPCAttr->bfReflModel;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceInterp) {
+ dst->pPCAttr->bfSurfInterp = src->pPCAttr->bfSurfInterp;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceApproximation) {
+ dst->pPCAttr->surfApprox.approxMethod
+ = src->pPCAttr->surfApprox.approxMethod;
+ dst->pPCAttr->surfApprox.uTolerance
+ = src->pPCAttr->surfApprox.uTolerance;
+ dst->pPCAttr->surfApprox.vTolerance
+ = src->pPCAttr->surfApprox.vTolerance;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCullingMode) {
+ dst->pPCAttr->cullMode = src->pPCAttr->cullMode;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCDistinguishFlag) {
+ dst->pPCAttr->distFlag = src->pPCAttr->distFlag;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternSize) {
+ dst->pPCAttr->patternSize.x = src->pPCAttr->patternSize.x;
+ dst->pPCAttr->patternSize.y = src->pPCAttr->patternSize.y;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefPt) {
+ dst->pPCAttr->patternRefPt.x = src->pPCAttr->patternRefPt.x;
+ dst->pPCAttr->patternRefPt.y = src->pPCAttr->patternRefPt.y;
+ dst->pPCAttr->patternRefPt.z = src->pPCAttr->patternRefPt.z;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefVec1) {
+ dst->pPCAttr->patternRefV1.x = src->pPCAttr->patternRefV1.x;
+ dst->pPCAttr->patternRefV1.y = src->pPCAttr->patternRefV1.y;
+ dst->pPCAttr->patternRefV1.z = src->pPCAttr->patternRefV1.z;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefVec2) {
+ dst->pPCAttr->patternRefV2.x = src->pPCAttr->patternRefV2.x;
+ dst->pPCAttr->patternRefV2.y = src->pPCAttr->patternRefV2.y;
+ dst->pPCAttr->patternRefV2.z = src->pPCAttr->patternRefV2.z;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorBundleIndex) {
+ dst->pPCAttr->intIndex = src->pPCAttr->intIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeFlag) {
+ dst->pPCAttr->edges = src->pPCAttr->edges;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeType) {
+ dst->pPCAttr->edgeType = src->pPCAttr->edgeType;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeWidth) {
+ dst->pPCAttr->edgeWidth = src->pPCAttr->edgeWidth;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeColour) {
+ CopyColourSpecifier( &(src->pPCAttr->edgeColour),
+ &(dst->pPCAttr->edgeColour));
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCEdgeBundleIndex) {
+ dst->pPCAttr->edgeIndex = src->pPCAttr->edgeIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLocalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ dst->pPCAttr->localMat[i][j] = src->pPCAttr->localMat[i][j];
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCGlobalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ dst->pPCAttr->globalMat[i][j] = src->pPCAttr->globalMat[i][j];
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCModelClip) {
+ dst->pPCAttr->modelClip = src->pPCAttr->modelClip;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCModelClipVolume) {
+ PU_EMPTY_LIST(dst->pPCAttr->modelClipVolume);
+/* puDeleteList(dst->pPCAttr->modelClipVolume);
+ dst->pPCAttr->modelClipVolume = puCreateList(DD_HALF_SPACE);
+ if (!dst->pPCAttr->modelClipVolume) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+*/ puCopyList( src->pPCAttr->modelClipVolume,
+ dst->pPCAttr->modelClipVolume);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCViewIndex) {
+ dst->pPCAttr->viewIndex = src->pPCAttr->viewIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLightState) {
+/* dst->pPCAttr->lightState = src->pPCAttr->lightState;
+ puDeleteList(dst->pPCAttr->lightState);
+ dst->pPCAttr->lightState = puCreateList(DD_INDEX);
+ if (!dst->pPCAttr->lightState) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+*/ PU_EMPTY_LIST(dst->pPCAttr->lightState);
+ puCopyList( src->pPCAttr->lightState, dst->pPCAttr->lightState);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCDepthCueIndex) {
+ dst->pPCAttr->depthCueIndex = src->pPCAttr->depthCueIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSetAsfValues) {
+ dst->pPCAttr->asfs = src->pPCAttr->asfs;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPickId) {
+ dst->pPCAttr->pickId = src->pPCAttr->pickId;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCHlhsrIdentifier) {
+ dst->pPCAttr->hlhsrType = src->pPCAttr->hlhsrType;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCNameSet) {
+ dst->pPCAttr->pCurrentNS = src->pPCAttr->pCurrentNS;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCColourApproxIndex) {
+ dst->pPCAttr->colourApproxIndex = src->pPCAttr->colourApproxIndex;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCRenderingColourModel) {
+ dst->pPCAttr->rdrColourModel = src->pPCAttr->rdrColourModel;
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCParaSurfCharacteristics) {
+ dst->pPCAttr->psc = src->pPCAttr->psc;
+ }
+
+ return (Success);
+
+} /* end-PEXCopyPipelineContext() */
+
+ErrorCode
+FreePipelineContext (pc, id)
+ddPCStr *pc;
+pexPC id;
+{
+ ErrorCode err = Success;
+ extern ErrorCode UpdateRendRefs();
+ int i;
+ ddRendererStr *pr = (ddRendererStr *)(pc->rendRefs->pList);
+
+ if (!pc) return (Success);
+
+ for (i=0; i<pc->rendRefs->numObj; i++, pr++)
+ UpdateRendRefs( pr, pc->PCid, (unsigned long)PIPELINE_CONTEXT_RESOURCE,
+ (unsigned long)REMOVE);
+
+ puDeleteList(pc->rendRefs);
+ puDeleteList(pc->pPCAttr->modelClipVolume);
+ puDeleteList(pc->pPCAttr->lightState);
+ xfree((pointer)pc);
+
+ return (err);
+}
+
+/*++ PEXFreePipelineContext
+ --*/
+ErrorCode
+PEXFreePipelineContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreePipelineContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddPCStr *pc;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXPipelineContextError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_PIPELINECONTEXT(strmPtr->id, pc);
+
+ FreeResource (strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreePipelineContext() */
+
+/*++ PEXGetPipelineContext
+ --*/
+ErrorCode
+PEXGetPipelineContext( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetPipelineContextReq *strmPtr;
+{
+ /* NOTE: See the Protocol Encoding for exact details of the fields
+ returned by this command. The encoding requires CARD16 and INT16
+ to be sent in 4 byte fields (CARD32) for most fields of these
+ types, hence the use of PACK_CARD32 for these fields. - JSH
+ */
+
+ ErrorCode err = Success;
+ ddPCStr *pc;
+ ddPCAttr *pca;
+ extern ddBufferPtr pPEXBuffer;
+ pexGetPipelineContextReply *reply
+ = (pexGetPipelineContextReply *)(pPEXBuffer->pHead);
+ CARD8 *replyPtr = (CARD8 *)(reply);
+ int size = 0;
+ int sze = 0;
+
+ LU_PIPELINECONTEXT(strmPtr->pc, pc);
+
+ pca = pc->pPCAttr;
+
+ replyPtr += sizeof(pexGetPipelineContextReply);
+ CHK_PEX_BUF(size, sizeof(pexGetPipelineContextReply), reply,
+ pexGetPipelineContextReply, replyPtr);
+ SETUP_INQ(pexGetPipelineContextReply);
+ replyPtr = pPEXBuffer->pBuf;
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerType) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->markerType, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerScale) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->markerScale, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->markerColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->markerColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCMarkerBundleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->markerIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextFont) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->textFont, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextPrecision) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->textPrecision, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharExpansion) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->charExpansion, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharSpacing) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->charSpacing, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->textColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->textColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharHeight) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->charHeight, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCharUpVector) {
+ CHK_PEX_BUF(size, 2 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->charUp.x, replyPtr);
+ PACK_FLOAT ( pca->charUp.y, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextPath) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->textPath, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextAlignment) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD16 ( pca->textAlignment.vertical, replyPtr);
+ PACK_CARD16 ( pca->textAlignment.horizontal, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextHeight) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->atextHeight, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextUpVector) {
+ CHK_PEX_BUF(size, 2 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->atextUp.x, replyPtr);
+ PACK_FLOAT ( pca->atextUp.y, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextPath) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->atextPath, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextAlignment) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD16 ( pca->atextAlignment.vertical, replyPtr);
+ PACK_CARD16 ( pca->atextAlignment.horizontal, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCAtextStyle) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->atextStyle, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCTextBundleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->textIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineType) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->lineType, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineWidth) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->lineWidth, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->lineColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->lineColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCurveApproximation) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT) + sizeof(CARD32), reply,
+ pexGetPipelineContextReply, replyPtr);
+ PACK_CARD32 ( pca->curveApprox.approxMethod, replyPtr);
+ PACK_FLOAT ( pca->curveApprox.tolerance, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPolylineInterp) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->lineInterp, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLineBundleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->lineIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorStyle) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->intStyle, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorStyleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->intStyleIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->surfaceColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->surfaceColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceReflAttr) {
+ CHK_PEX_BUF(size, 5 * sizeof(PEXFLOAT) + sizeof(CARD32)
+ + SIZE_COLOURSPEC(pca->reflAttr.specularColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_FLOAT ( pca->reflAttr.ambient, replyPtr);
+ PACK_FLOAT ( pca->reflAttr.diffuse, replyPtr);
+ PACK_FLOAT ( pca->reflAttr.specular, replyPtr);
+ PACK_FLOAT ( pca->reflAttr.specularConc, replyPtr);
+ PACK_FLOAT ( pca->reflAttr.transmission, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->reflAttr.specularColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceReflModel) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->reflModel, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceInterp) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->surfInterp, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfInteriorStyle) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->bfIntStyle, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfInteriorStyleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->bfIntStyleIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->bfSurfColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->bfSurfColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceReflAttr) {
+ CHK_PEX_BUF(size, 5 * sizeof(PEXFLOAT) + sizeof(CARD32)
+ + SIZE_COLOURSPEC(pca->bfReflAttr.specularColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_FLOAT ( pca->bfReflAttr.ambient, replyPtr);
+ PACK_FLOAT ( pca->bfReflAttr.diffuse, replyPtr);
+ PACK_FLOAT ( pca->bfReflAttr.specular, replyPtr);
+ PACK_FLOAT ( pca->bfReflAttr.specularConc, replyPtr);
+ PACK_FLOAT ( pca->bfReflAttr.transmission, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->bfReflAttr.specularColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceReflModel) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->bfReflModel, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCBfSurfaceInterp) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->bfSurfInterp, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceApproximation) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + 2 * sizeof(PEXFLOAT), reply,
+ pexGetPipelineContextReply, replyPtr);
+ PACK_CARD32 ( pca->surfApprox.approxMethod, replyPtr);
+ PACK_FLOAT ( pca->surfApprox.uTolerance, replyPtr);
+ PACK_FLOAT ( pca->surfApprox.vTolerance, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCCullingMode) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->cullMode, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCDistinguishFlag) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->distFlag, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternSize) {
+ CHK_PEX_BUF(size, 2 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->patternSize.x, replyPtr);
+ PACK_FLOAT ( pca->patternSize.y, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefPt) {
+ CHK_PEX_BUF(size, 3 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->patternRefPt.x, replyPtr);
+ PACK_FLOAT ( pca->patternRefPt.y, replyPtr);
+ PACK_FLOAT ( pca->patternRefPt.z, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefVec1) {
+ CHK_PEX_BUF(size, 3 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->patternRefV1.x, replyPtr);
+ PACK_FLOAT ( pca->patternRefV1.y, replyPtr);
+ PACK_FLOAT ( pca->patternRefV1.z, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPatternRefVec2) {
+ CHK_PEX_BUF(size, 3 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->patternRefV2.x, replyPtr);
+ PACK_FLOAT ( pca->patternRefV2.y, replyPtr);
+ PACK_FLOAT ( pca->patternRefV2.z, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCInteriorBundleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->intIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeFlag) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->edges, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeType) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->edgeType, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeWidth) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_FLOAT ( pca->edgeWidth, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSurfaceEdgeColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32) + SIZE_COLOURSPEC(pca->edgeColour),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_COLOUR_SPECIFIER ( pca->edgeColour, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCEdgeBundleIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->edgeIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLocalTransform) {
+ int i, j;
+ CHK_PEX_BUF(size, 16 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ PACK_FLOAT( pca->localMat[i][j], replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCGlobalTransform) {
+ int i, j;
+ CHK_PEX_BUF(size, 16 * sizeof(PEXFLOAT), reply, pexGetPipelineContextReply,
+ replyPtr);
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ PACK_FLOAT( pca->globalMat[i][j], replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCModelClip) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->modelClip, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCModelClipVolume) {
+ int i;
+ pexHalfSpace *pphs = (pexHalfSpace *)(pca->modelClipVolume->pList);
+ CHK_PEX_BUF(size, sizeof(CARD32)+(pca->modelClipVolume->numObj * sizeof(pexHalfSpace)),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_CARD32 ( pca->modelClipVolume->numObj, replyPtr);
+ for (i=0; i<pca->modelClipVolume->numObj; i++, pphs++) {
+ PACK_COORD3D( &pphs->point, replyPtr);
+ PACK_VECTOR3D( &pphs->vector, replyPtr);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCViewIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->viewIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCLightState) {
+/* CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->lightState, replyPtr);
+*/ int i;
+ int sz = pca->lightState->numObj*sizeof(CARD16);
+ CARD16 *pLS = (CARD16 *)(pca->lightState->pList);
+ CHK_PEX_BUF(size,sizeof(CARD32)+sz+PADDING(sz),
+ reply, pexGetPipelineContextReply, replyPtr);
+ PACK_CARD32(pca->lightState->numObj, replyPtr);
+ for (i=0; i<pca->lightState->numObj; i++, pLS++) {
+ PACK_CARD16(*pLS, replyPtr);
+ }
+ if (pca->lightState->numObj % 2)
+ SKIP_PADDING(replyPtr,2);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCDepthCueIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->depthCueIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCSetAsfValues) {
+ CARD32 asf_enables;
+ CHK_PEX_BUF(size, 2*sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ asf_enables = ASF_ALL;
+ PACK_CARD32 ( asf_enables, replyPtr);
+ PACK_CARD32 ( pca->asfs, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCPickId) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->pickId, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCHlhsrIdentifier) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->hlhsrType, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCNameSet) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( GetId(pca->pCurrentNS), replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCColourApproxIndex) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->colourApproxIndex, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCRenderingColourModel) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_CARD32 ( pca->rdrColourModel, replyPtr);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPCParaSurfCharacteristics) {
+ switch (pca->psc.type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ sze = 0;
+ break;
+ case PEXPSCIsoCurves:
+ sze = 8;
+ break;
+ case PEXPSCMcLevelCurves:
+ sze = (6 * sizeof(PEXFLOAT)) + 4 +
+ (pca->psc.data.mcLevelCurves.numberIntersections *
+ sizeof(PEXFLOAT)) ;
+ break;
+ case PEXPSCWcLevelCurves:
+ sze = (6 * sizeof(PEXFLOAT)) + 4 +
+ (pca->psc.data.wcLevelCurves.numberIntersections *
+ sizeof(PEXFLOAT)) ;
+ break;
+ default:
+ sze = 0;
+ break;
+ }
+
+ CHK_PEX_BUF(size, sizeof(CARD32)+sze, reply, pexGetPipelineContextReply,
+ replyPtr);
+ PACK_INT16(pca->psc.type, replyPtr);
+ PACK_INT16(sze, replyPtr);
+ switch (pca->psc.type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+ case PEXPSCIsoCurves: {
+ PACK_CARD16(pca->psc.data.isoCurves.placementType, replyPtr);
+ SKIP_PADDING(replyPtr,2);
+ PACK_CARD16(pca->psc.data.isoCurves.numUcurves, replyPtr);
+ PACK_CARD16(pca->psc.data.isoCurves.numVcurves, replyPtr);
+ break;
+ }
+ case PEXPSCMcLevelCurves: {
+ PACK_COORD3D(&(pca->psc.data.mcLevelCurves.origin),replyPtr);
+ PACK_COORD3D(&(pca->psc.data.mcLevelCurves.direction),replyPtr);
+ PACK_CARD16(pca->psc.data.mcLevelCurves.numberIntersections,replyPtr);
+ SKIP_PADDING(replyPtr,2);
+ PACK_LISTOF_STRUCT(pca->psc.data.mcLevelCurves.numberIntersections,
+ PEXFLOAT, pca->psc.data.mcLevelCurves.pPoints,
+ replyPtr);
+ break;
+ }
+
+ case PEXPSCWcLevelCurves: {
+ PACK_COORD3D(&(pca->psc.data.wcLevelCurves.origin),replyPtr);
+ PACK_COORD3D(&(pca->psc.data.wcLevelCurves.direction),replyPtr);
+ PACK_CARD16(pca->psc.data.wcLevelCurves.numberIntersections,replyPtr);
+ SKIP_PADDING(replyPtr,2);
+ PACK_LISTOF_STRUCT(pca->psc.data.wcLevelCurves.numberIntersections,
+ PEXFLOAT, pca->psc.data.wcLevelCurves.pPoints,
+ replyPtr);
+ break;
+ }
+ }
+ }
+
+ pPEXBuffer->dataSize = (int)replyPtr - (int)(pPEXBuffer->pBuf);
+
+ reply->length = (unsigned long)LWORDS(pPEXBuffer->dataSize);
+ WritePEXBufferReply(pexGetPipelineContextReply);
+
+ return (err);
+
+} /* end-PEXGetPipelineContext() */
+
+/*++ PEXChangePipelineContext
+ --*/
+ErrorCode
+PEXChangePipelineContext( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangePipelineContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddPCStr *pc;
+
+ LU_PIPELINECONTEXT(strmPtr->pc, pc);
+
+ err = UpdatePipelineContext( cntxtPtr, pc->pPCAttr, strmPtr->itemMask,
+ (unsigned char *)(strmPtr + 1));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangePipelineContext() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexPhigs.c b/xc/programs/Xserver/PEX5/dipex/objects/pexPhigs.c
new file mode 100644
index 000000000..c8cbfd218
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexPhigs.c
@@ -0,0 +1,783 @@
+/* $TOG: pexPhigs.c /main/6 1998/02/10 12:35:27 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexPhigs.c,v 3.6 1999/01/31 12:21:32 dawes Exp $ */
+
+
+/*++
+ * PEXCreatePhigsWks
+ * dipexFreePhigsWks
+ * PEXFreePhigsWks
+ * PEXGetWksInfo
+ * PEXGetDynamics
+ * PEXGetViewRep
+ * PEXRedrawAllStructures
+ * PEXUpdateWorkstations
+ * PEXExecuteDeferredActions
+ * PEXSetViewPriority
+ * PEXSetDisplayUpdateMode
+ * PEXMapDCtoWC
+ * PEXSetViewRep
+ * PEXSetWksWindow
+ * PEXSetWksViewport
+ * PEXSetHlhsrMode
+ * PEXPostStructure
+ * PEXUnpostStructure
+ * PEXUnpostAllStructures
+ * PEXGetWksPostings
+ * PEXRedrawClipRegion
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "PEX.h"
+#include "pexError.h"
+#include "pex_site.h"
+#include "ddpex4.h"
+#include "pexLookup.h"
+#include "pexos.h"
+
+
+extern LUTAddWksXref();
+extern void LostXResource();
+
+static void RemoveWksFromDrawableList();
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+#define AddLut(lut_id, wks_lut_entry) \
+ if (! ((lut) = (diLUTHandle) LookupIDByType ((lut_id), PEXLutType)) ) { \
+ err = PEX_ERROR_CODE(PEXLookupTableError); \
+ xfree((pointer)pw);\
+ PEX_ERR_EXIT(err,(lut_id),cntxtPtr); }\
+ wks_lut_entry = lut;
+
+#define AddNs(ns_id, wks_ns_entry) \
+ if (! (ns = (diNSHandle) LookupIDByType ((ns_id), PEXNameType)) ) { \
+ err = PEX_ERROR_CODE(PEXNameSetError); \
+ xfree((pointer)pw);\
+ PEX_ERR_EXIT(err,(ns_id),cntxtPtr); } \
+ wks_ns_entry = ns;
+
+
+
+/*++ PEXCreatePhigsWks
+ *
+ --*/
+ErrorCode
+PEXCreatePhigsWks (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePhigsWksReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ dipexWksDrawable *wks_draw = 0;
+ dipexWksDrawableLink *plink = 0;
+ ddWksInit tables;
+ diLUTHandle lut = 0;
+ diNSHandle ns = 0;
+ DrawablePtr pdraw = 0;
+
+ if (!LegalNewID(strmPtr->wks, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->wks,cntxtPtr);
+
+ LU_DRAWABLE(strmPtr->drawable, pdraw);
+
+ pw = (dipexPhigsWks *) xalloc ((unsigned long)(sizeof(dipexPhigsWks)));
+ if (!pw) {
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+ pw->did = strmPtr->drawable;
+ pw->dd_data.id = strmPtr->wks;
+ pw->dd_data.deviceData = NULL;
+
+ tables.pDrawable = pdraw;
+ tables.drawableId = strmPtr->drawable;
+
+ /* Line Bundle Table */
+ AddLut (strmPtr->lineBundle, tables.pLineLUT);
+
+ /* Marker Bundle Table */
+ AddLut (strmPtr->markerBundle, tables.pMarkerLUT);
+
+ /* Text Bundle Table */
+ AddLut (strmPtr->textBundle, tables.pTextLUT);
+
+ /* Interior Bundle Table */
+ AddLut (strmPtr->interiorBundle, tables.pIntLUT);
+
+ /* Edge Bundle Table */
+ AddLut (strmPtr->edgeBundle, tables.pEdgeLUT);
+
+ /* Colour Bundle Table */
+ AddLut (strmPtr->colourTable, tables.pColourLUT);
+
+ /* Light Table */
+ AddLut (strmPtr->lightTable, tables.pLightLUT);
+
+ /* Colour Bundle Table */
+ /* Pattern Bundle Table */
+ AddLut (strmPtr->patternTable, tables.pPatternLUT);
+
+ /* Text Font Bundle Table */
+ AddLut (strmPtr->textFontTable, tables.pFontLUT);
+
+ /* Depth Cue Bundle Table */
+ AddLut (strmPtr->depthCueTable, tables.pDepthCueLUT);
+
+ /* Colour Approx Bundle Table */
+ AddLut (strmPtr->colourApproxTable, tables.pColourAppLUT);
+
+ /* Namesets */
+ AddNs ( strmPtr->highlightIncl, tables.pHighInclSet);
+ AddNs ( strmPtr->highlightExcl, tables.pHighExclSet);
+ AddNs ( strmPtr->invisIncl, tables.pInvisInclSet);
+ AddNs ( strmPtr->invisExcl, tables.pInvisExclSet);
+
+ /* Double buffering mode */
+ tables.bufferMode = strmPtr->bufferMode;
+
+ /* workstation-drawable cross-references */
+ if (!LegalNewID(strmPtr->drawable, cntxtPtr->client)) {
+
+ wks_draw =
+ (dipexWksDrawable *) xalloc ((unsigned long)(sizeof(dipexWksDrawable)
+ + sizeof(dipexWksDrawableLink)));
+ if (!wks_draw) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ wks_draw->id = strmPtr->drawable;
+ wks_draw->x_drawable = pdraw;
+ wks_draw->wks_list = (dipexWksDrawableLink *)(wks_draw +1);
+ wks_draw->wks_list->wks = pw;
+ wks_draw->wks_list->wksid = strmPtr->wks;
+ wks_draw->wks_list->next = 0;
+ if (!( AddResource( strmPtr->drawable, PEXWksDrawableType,
+ (pointer)wks_draw))) {
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr); }
+ } else {
+ plink = (dipexWksDrawableLink *)
+ xalloc ((unsigned long)(sizeof(dipexWksDrawableLink)));
+ if (!plink) {
+ xfree((pointer)pw);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr); }
+ plink->next = wks_draw->wks_list;
+ plink->wksid = strmPtr->wks;
+ wks_draw->wks_list = plink;
+ }
+
+
+ /* ddpex create */
+ err = CreatePhigsWks (&tables, &(pw->dd_data));
+ if (err) {
+ RemoveWksFromDrawableList(strmPtr->wks, wks_draw);
+ xfree((pointer)pw);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ };
+
+ ADDRESOURCE(strmPtr->wks, PEXWksType, pw);
+
+ return( err );
+
+} /* end-PEXCreatePhigsWks() */
+
+/*++ dipexFreePhigsWks
+ *
+ --*/
+
+static void
+RemoveWksFromDrawableList(wksid,drawlist)
+pexPhigsWks wksid;
+dipexWksDrawable *drawlist;
+{
+ dipexWksDrawableLink *plink = drawlist->wks_list, *prev = 0;
+
+ while (plink) {
+ if (plink->wksid == wksid) {
+ if (prev) {
+ prev->next = plink->next;
+ xfree((pointer)plink);
+ } else { drawlist->wks_list = plink->next; }
+ plink = 0;
+ } else {
+ prev = plink;
+ plink = plink->next;
+ }
+ }
+
+ if (! (drawlist->wks_list) ) {
+ /* don't do a free--weird side effects in FreeResource
+ will cause all types associated with this id to be freed */
+ drawlist->id = PEXAlreadyFreed;
+ }
+
+}
+/*++ dipexFreePhigsWks
+ *
+ --*/
+ErrorCode
+dipexFreePhigsWks (pw, id)
+dipexPhigsWks *pw;
+pexPhigsWks id;
+{
+ ErrorCode err = Success;
+ extern ddpex4rtn FreePhigsWks();
+ void RemoveWksFromDrawableList();
+ dipexWksDrawable *wks_draw = 0;
+
+ if ((wks_draw =
+ (dipexWksDrawable *) LookupIDByType(pw->did,PEXWksDrawableType))) {
+ RemoveWksFromDrawableList(id,wks_draw);
+ }
+
+ err = FreePhigsWks((diWKSHandle)pw,id);
+
+ return( err );
+
+} /* dipexFreePhigsWks() */
+
+/*++ PEXFreePhigsWks
+ --*/
+ErrorCode
+PEXFreePhigsWks (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreePhigsWksReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXPhigsWksError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_PHIGSWKS (strmPtr->id, pw);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreePhigsWks() */
+
+/*++ PEXGetWksInfo
+ --*/
+ErrorCode
+PEXGetWksInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetWksInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numValues;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ SETUP_INQ(pexGetWksInfoReply);
+
+ err = InquireWksInfo( (diWKSHandle)pw, strmPtr->itemMask, &numValues, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetWksInfoReply );
+ WritePEXBufferReply(pexGetWksInfoReply);
+ }
+ return( err );
+
+} /* end-PEXGetWksInfo() */
+
+/*++ PEXGetDynamics
+ --*/
+ErrorCode
+PEXGetDynamics( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetDynamicsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ DrawablePtr pdraw = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexGetDynamicsReply *reply = (pexGetDynamicsReply *)(pPEXBuffer->pHead);
+
+ LU_DRAWABLE(strmPtr->drawable, pdraw);
+ SETUP_INQ(pexGetDynamicsReply);
+
+ err = InquireWksDynamics (pdraw, (ddWksDynamics *)&(reply->viewRep));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = 0;
+ WritePEXReplyToClient(cntxtPtr, strmPtr, sizeof(pexGetDynamicsReply), reply);
+ return( err );
+
+} /* end-PEXGetDynamics() */
+
+/*++ PEXGetViewRep
+ --*/
+
+ErrorCode
+PEXGetViewRep( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetViewRepReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexGetViewRepReply *reply = (pexGetViewRepReply *)(pPEXBuffer->pHead);
+ pexViewRep *View1, *View2;
+ unsigned long size = 0;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ SETUP_INQ(pexGetViewRepReply);
+
+ if (pPEXBuffer->bufSize < size) {
+ err = puBuffRealloc(pPEXBuffer, size);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ reply = (pexGetViewRepReply *)(pPEXBuffer->pHead);
+ }
+
+ View1 = (pexViewRep *)(pPEXBuffer->pBuf);
+ View2 = View1 + 1;
+ err = InquireViewRep( (diWKSHandle)pw, strmPtr->index,
+ &(reply->viewUpdate), View1, View2);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ size = sizeof(pexViewRep);
+ reply->length = 2 * LWORDS(size);
+ size = (sizeof(CARD32) * reply->length) + sizeof(pexGetViewRepReply);
+ WritePEXReplyToClient (cntxtPtr, strmPtr, size, reply);
+ return( err );
+
+} /* end-PEXGetViewRep() */
+
+/*++ PEXRedrawAllStructures
+ --*/
+ErrorCode
+PEXRedrawAllStructures( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexRedrawAllStructuresReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->id, pw);
+
+ err = RedrawStructures ((diWKSHandle)pw);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXRedrawAllStructures() */
+
+/*++ PEXUpdateWorkstation
+ --*/
+ErrorCode
+PEXUpdateWorkstation (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexUpdateWorkstationReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->id, pw);
+
+ err = UpdateWks((diWKSHandle)pw);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXUpdateWorkstation() */
+
+/*++ PEXExecuteDeferredActions
+ --*/
+
+ErrorCode
+PEXExecuteDeferredActions( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexExecuteDeferredActionsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->id, pw);
+
+ err = ExecuteDeferred ((diWKSHandle)pw);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXExecuteDeferredActions() */
+
+/*++ PEXSetViewPriority
+ --*/
+ErrorCode
+PEXSetViewPriority( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetViewPriorityReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ err = SetViewPriority( (diWKSHandle)pw, strmPtr->index1, strmPtr->index2,
+ strmPtr->priority);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetViewPriority() */
+
+/*++ PEXSetDisplayUpdateMode
+ --*/
+ErrorCode
+PEXSetDisplayUpdateMode( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetDisplayUpdateModeReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ err = SetDisplayUpdateMode ((diWKSHandle)pw, strmPtr->displayUpdate);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetDisplayUpdateMode() */
+
+/*++ PEXMapDCtoWC
+ --*/
+ErrorCode
+PEXMapDCtoWC( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexMapDCtoWCReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexMapDCtoWCReply *reply;
+ unsigned long reply_size;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ SETUP_INQ(pexMapDCtoWCReply);
+
+ pPEXBuffer->dataSize = strmPtr->numCoords * sizeof(pexCoord3D);
+ reply_size = pPEXBuffer->dataSize + sizeof(pexMapDCtoWCReply);
+ if (pPEXBuffer->bufSize < reply_size)
+ if (err = puBuffRealloc(pPEXBuffer, reply_size)) return (err);
+
+ reply = (pexMapDCtoWCReply *)(pPEXBuffer->pHead);
+
+ err = MapDcWc( (diWKSHandle)pw, strmPtr->numCoords, (pexDeviceCoord *)(strmPtr+1),
+ &(reply->numCoords), (pexCoord3D *)(pPEXBuffer->pBuf),
+ &(reply->viewIndex));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = LWORDS(pPEXBuffer->dataSize);
+ WritePEXBufferReply(pexMapDCtoWCReply);
+ return (err);
+
+} /* end-PEXMapDCtoWC() */
+
+/*++ PEXMapWCtoDC
+ --*/
+ErrorCode
+PEXMapWCtoDC( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexMapWCtoDCReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexMapWCtoDCReply *reply;
+ unsigned long reply_size;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+
+ SETUP_INQ(pexMapWCtoDCReply);
+
+ pPEXBuffer->dataSize = strmPtr->numCoords * sizeof(pexDeviceCoord);
+ reply_size = pPEXBuffer->dataSize + sizeof(pexMapWCtoDCReply);
+ if (pPEXBuffer->bufSize < reply_size)
+ if (err = puBuffRealloc(pPEXBuffer, reply_size)) return (err);
+
+ reply = (pexMapWCtoDCReply *)(pPEXBuffer->pHead);
+
+ err = MapWcDc( (diWKSHandle)pw, strmPtr->numCoords,
+ (pexCoord3D *)(strmPtr + 1), strmPtr->index,
+ &(reply->numCoords), (pexDeviceCoord *)(pPEXBuffer->pBuf));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = LWORDS(pPEXBuffer->dataSize);
+ WritePEXBufferReply(pexMapWCtoDCReply);
+ return( err );
+
+} /* end-PEXMapWCtoDC() */
+
+/*++ PEXSetViewRep
+ --*/
+ErrorCode
+PEXSetViewRep (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetViewRepReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ err = SetViewRep ((diWKSHandle)pw, &(strmPtr->viewRep));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetViewRep() */
+
+/*++ PEXSetWksWindow
+ --*/
+
+ErrorCode
+PEXSetWksWindow( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetWksWindowReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ return (SetWksWindow((diWKSHandle)pw, &(strmPtr->npcSubvolume)));
+
+} /* end-PEXSetWksWindow() */
+
+/*++ PEXSetWksViewport
+ --*/
+
+ErrorCode
+PEXSetWksViewport( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetWksViewportReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS (strmPtr->wks, pw);
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ return(SetWksViewport ((diWKSHandle)pw, &(strmPtr->viewport)));
+
+} /* end-PEXSetWksViewport() */
+
+/*++ PEXSetHlhsrMode
+ --*/
+
+ErrorCode
+PEXSetHlhsrMode( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetHlhsrModeReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS( strmPtr->wks, pw);
+
+ return (SetHlhsrMode((diWKSHandle)pw, strmPtr->mode));
+
+} /* end-PEXSetHlhsrMode() */
+
+
+/*++ PEXSetWksBufferMode
+ --*/
+ErrorCode
+PEXSetWksBufferMode (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetWksBufferModeReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS( strmPtr->wks, pw);
+
+ return (SetBufferMode((diWKSHandle)pw, strmPtr->bufferMode));
+}
+
+
+/*++ PEXPostStructure
+ --*/
+ErrorCode
+PEXPostStructure (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexPostStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ diStructHandle pstr = 0;
+
+ LU_PHIGSWKS (strmPtr->wks, pw);
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ return (PostStructure ((diWKSHandle)pw, pstr, strmPtr->priority));
+
+} /* end-PEXPostStructure() */
+
+/*++ PEXUnpostStructure
+ --*/
+
+ErrorCode
+PEXUnpostStructure( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexUnpostStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ diStructHandle pstr = 0;
+
+ LU_PHIGSWKS (strmPtr->wks, pw);
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ return (UnpostStructure ((diWKSHandle)pw, pstr));
+
+} /* end-PEXUnpostStructure() */
+
+/*++ PEXUnpostAllStructures
+ --*/
+
+ErrorCode
+PEXUnpostAllStructures( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexUnpostAllStructuresReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS (strmPtr->id, pw);
+
+ return (UnpostAllStructures ((diWKSHandle)pw));
+
+} /* end-PEXUnpostAllStructures() */
+ErrorCode
+PEXGetWksPostings( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetWksPostingsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+
+ LU_STRUCTURE(strmPtr->id, pstr);
+
+ SETUP_INQ(pexGetWksPostingsReply);
+
+ err = InquireWksPostings (pstr, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetWksPostingsReply);
+ WritePEXBufferReply(pexGetWksPostingsReply);
+ }
+
+ return( err );
+
+} /* end-PEXGetWksPostings() */
+
+/*++ PEXRedrawClipRegion
+ --*/
+ErrorCode
+PEXRedrawClipRegion( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexRedrawClipRegionReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+
+ LU_PHIGSWKS (strmPtr->wks, pw);
+
+ return (RedrawClipRegion( (diWKSHandle)pw, strmPtr->numRects,
+ (ddDeviceRect *)(strmPtr+1)));
+}
+
+/*++ FreeWksDrawable
+ --*/
+#define LostDrawable(w) \
+ LostXResource((diResourceHandle)(w),WORKSTATION_RESOURCE,X_DRAWABLE_RESOURCE)
+
+FreeWksDrawable(ptr, id)
+dipexWksDrawable *ptr;
+Drawable id;
+{
+ dipexWksDrawableLink *plink = 0, *pnext = 0;
+
+ if (!ptr) return (Success);
+
+ if (ptr->id == PEXAlreadyFreed) {
+ xfree((pointer)ptr);
+ return(Success); }
+
+ if (ptr->id != id) {
+ ErrorF( "Corrupted wks-drawable list: %d %d", id, ptr->id); } else
+ if (ptr->wks_list) {
+ LostDrawable(ptr->wks_list->wks);
+
+ /* first link is allocated in the same chunk as the header */
+ plink = ptr->wks_list->next;
+ ptr->wks_list = 0;
+ while (plink) {
+ pnext = plink->next;
+ LostDrawable(plink->wks);
+ xfree((pointer)plink);
+ plink = pnext;
+ } }
+
+ xfree((pointer)ptr);
+
+ return (Success);
+}
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexPick.c b/xc/programs/Xserver/PEX5/dipex/objects/pexPick.c
new file mode 100644
index 000000000..a616ccdb9
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexPick.c
@@ -0,0 +1,284 @@
+/* $TOG: pexPick.c /main/4 1998/02/10 12:35:32 kaleb $ */
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexPick.c,v 3.6 1999/01/31 12:21:32 dawes Exp $ */
+
+
+/*++
+ * --- Workstation Picking ---
+ *
+ * PEXCreatePickMeasure
+ * PEXFreePickMeasure
+ * PEXGetPickDevice
+ * PEXChangePickDevice
+ * PEXGetPickMeasure
+ * PEXUpdatePickMeasure
+ *
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "dipex.h"
+#include "PEXprotost.h"
+#include "pex_site.h"
+#include "ddpex4.h"
+#include "pexLookup.h"
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+typedef struct {
+ pexElementRef *path;
+ pexNameSet inclusion;
+ pexNameSet exclusion;
+ long PET;
+ pexViewport viewport;
+ pexSwitch status;
+ pexSwitch order;
+ pexSwitch echo_switch;
+ unsigned char *record;
+} dipickdev;
+
+
+/*++ PEXCreatePickMeasure
+ --*/
+ErrorCode
+PEXCreatePickMeasure (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePickMeasureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode freePickMeasure();
+ diPMHandle pmh;
+ dipexPhigsWks *pw = 0;
+ extern ErrorCode FreePickMeasure();
+
+ pmh = (diPMHandle)LookupIDByType(strmPtr->pm, PEXPickType);
+ if (pmh) PEX_ERR_EXIT(BadIDChoice,strmPtr->pm,cntxtPtr);
+
+ pmh = (diPMHandle) xalloc ((unsigned long)sizeof(ddPMResource));
+ if (!pmh) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ LU_PHIGSWKS (strmPtr->wks, pw);
+
+ pmh->id = strmPtr->pm;
+ err = CreatePickMeasure ((diWKSHandle)pw, strmPtr->devType, pmh);
+ if (err){
+ xfree((pointer)pmh);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ ADDRESOURCE(strmPtr->pm, PEXPickType, pmh);
+
+ return( err );
+
+} /* end-PEXCreatePickMeasure() */
+
+/*++ PEXFreePickMeasure
+ --*/
+ErrorCode
+PEXFreePickMeasure (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreePickMeasureReq *strmPtr;
+{
+ diPMHandle pmh = 0;
+ ErrorCode err = Success;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXPickMeasureError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_PICKMEASURE (strmPtr->id, pmh);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreePickMeasure() */
+
+/*++ PEXGetPickDevice
+ --*/
+
+ErrorCode
+PEXGetPickDevice( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetPickDeviceReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ extern ddBufferPtr pPEXBuffer;
+ CARD32 numItems;
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ SETUP_INQ(pexGetPickDeviceReply);
+
+ err = InquirePickDevice((diWKSHandle)pw, strmPtr->devType, strmPtr->itemMask,
+ &numItems, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetPickDeviceReply);
+ WritePEXBufferReply(pexGetPickDeviceReply);
+ }
+ return( err );
+
+} /* end-PEXGetPickDevice() */
+
+/*++ PEXChangePickDevice
+ --*/
+
+ErrorCode
+PEXChangePickDevice( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangePickDeviceReq *strmPtr;
+{
+ ErrorCode err = Success;
+ dipexPhigsWks *pw = 0;
+ CARD32 *ptr = (CARD32 *)(strmPtr+1);
+
+ LU_PHIGSWKS(strmPtr->wks, pw);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ if (strmPtr->itemMask & PEXPDPickStatus) ptr++;
+
+ if (strmPtr->itemMask & PEXPDPickPath) {
+ pexPickElementRef *per;
+ diStructHandle sh, *psh;
+ CARD32 i, numRefs = *((CARD32 *)(ptr));
+ ptr++;
+ for (i=0, per = (pexPickElementRef *)ptr; i<numRefs; i++, per++) {
+ LU_STRUCTURE(per->sid,sh);
+ psh = (diStructHandle *)&(per->sid);
+ *psh = sh;
+ }
+ ptr = (CARD32 *)per;
+ }
+
+ if (strmPtr->itemMask & PEXPDPickPathOrder) ptr++;
+
+ if (strmPtr->itemMask & PEXPDPickIncl) {
+ diNSHandle temp;
+ LU_NAMESET(*ptr, temp);
+ *ptr = (CARD32)temp;
+ ptr++;
+ }
+
+ if (strmPtr->itemMask & PEXPDPickExcl) {
+ diNSHandle temp;
+ LU_NAMESET(*ptr, temp);
+ *ptr = (CARD32)temp;
+ }
+
+ err = ChangePickDevice( (diWKSHandle)pw, strmPtr->devType, strmPtr->itemMask,
+ (ddPointer)(strmPtr + 1));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangePickDevice() */
+
+/*++ PEXGetPickMeasure
+ --*/
+
+ErrorCode
+PEXGetPickMeasure( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetPickMeasureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diPMHandle pmh;
+ extern ddBufferPtr pPEXBuffer;
+ CARD32 numItems;
+
+ LU_PICKMEASURE (strmPtr->pm, pmh);
+
+ SETUP_INQ(pexGetPickMeasureReply);
+
+ err = InquirePickMeasure( pmh, strmPtr->itemMask,
+ &numItems, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetPickMeasureReply);
+ WritePEXBufferReply(pexGetPickMeasureReply);
+ }
+ return( err );
+
+} /* end-PEXGetPickMeasure() */
+
+/*++ PEXUpdatePickMeasure
+ --*/
+
+ErrorCode
+PEXUpdatePickMeasure( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexUpdatePickMeasureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diPMHandle pmh;
+
+ LU_PICKMEASURE (strmPtr->pm, pmh);
+
+ err = UpdatePickMeasure (pmh, strmPtr->numBytes, (ddPointer)(strmPtr + 1));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXUpdatePickMeasure() */
+
+
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexRndr.c b/xc/programs/Xserver/PEX5/dipex/objects/pexRndr.c
new file mode 100644
index 000000000..d5840c5cd
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexRndr.c
@@ -0,0 +1,1522 @@
+/* $TOG: pexRndr.c /main/30 1998/02/10 12:35:36 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexRndr.c,v 3.6 1998/10/04 09:35:07 dawes Exp $ */
+
+/*++
+ * PEXCreateRenderer
+ * PEXFreeRenderer
+ * PEXChangeRenderer
+ * PEXGetRendererAttributes
+ * PEXBeginRendering
+ * PEXEndRendering
+ * PEXClearRenderer
+ * PEXFlushRenderer
+ * PEXInitRenderer
+ * PEXBeginStructure
+ * PEXEndStructure
+ * PEXRenderElements
+ * PEXAccumulateState
+ * PEXRenderNetwork
+ * PEXRenderOutputCommands
+ * PEXCopyAlphaToPixmap
+ * PEXCopyPixmapToAlpha
+ * PEXCopyPCToPipelineState
+ * PEXCopyPipelineStateToPC
+ * PEXCopyZBufferToPixmap
+ * PEXCopyPixmapToZBuffer
+ * PEXGetZBuffer
+ * PEXPutZBuffer
+ * PEXInitMultiPass
+ * PEXNextPass
+ * PEXNextPassWithoutReply
+--*/
+
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+
+
+#include "X.h"
+#include "pexError.h"
+#include "ddpex3.h"
+#include "ddpex4.h"
+#include "pexLookup.h"
+#include "dipex.h"
+#include "pexExtract.h"
+#include "pexUtils.h"
+#include "pex_site.h"
+#include "scrnintstr.h"
+#include "pexos.h"
+
+
+#ifndef PEX_BUFFER_CHUNK
+#define PEX_BUFFER_CHUNK 1024
+#endif
+
+#define CHANGELUT(LUT_INDEX, REND_DYN_CHANGE_BIT) { \
+ diLUTHandle plut = 0; \
+ LU_TABLE((*((CARD32 *)ptr)), plut); \
+ SKIP_PADDING(ptr,sizeof(CARD32)); \
+ if (prend->lut[LUT_INDEX]) { \
+ err = UpdateLUTRefs( prend->lut[LUT_INDEX], \
+ (diResourceHandle)(prend),\
+ (ddResourceType)RENDERER_RESOURCE, \
+ (ddAction)REMOVE); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); } \
+ prend->lut[LUT_INDEX] = plut; \
+ err = UpdateLUTRefs( prend->lut[LUT_INDEX], \
+ (diResourceHandle)(prend), \
+ (ddResourceType)RENDERER_RESOURCE, \
+ (ddAction)ADD); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); \
+ prend->tablesChanges |= REND_DYN_CHANGE_BIT; \
+ }
+
+#define CHANGENS(NS_INDEX, REND_DYN_CHANGE_BIT) { \
+ diNSHandle pns = 0; \
+ LU_NAMESET(((pexNameSet)(*((CARD32 *)ptr))),pns); \
+ SKIP_PADDING(ptr,sizeof(CARD32)); \
+ if (prend->ns[(unsigned)(NS_INDEX)]) { \
+ err = UpdateNSRefs( prend->ns[(unsigned)(NS_INDEX)], \
+ (diResourceHandle)(prend), \
+ (ddResourceType)RENDERER_RESOURCE, \
+ (ddAction)REMOVE); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); } \
+ prend->ns[(unsigned)(NS_INDEX)] = pns; \
+ err = UpdateNSRefs( pns, (diResourceHandle)(prend), \
+ (ddResourceType)RENDERER_RESOURCE, \
+ (ddAction)ADD); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); \
+ prend->namesetsChanges |= REND_DYN_CHANGE_BIT; \
+ }
+
+
+#define CHK_PEX_BUF(SIZE,INCR,REPLY,TYPE,PTR) { \
+ (SIZE)+=(INCR); \
+ if (pPEXBuffer->bufSize < (SIZE)) { \
+ ErrorCode err = Success; \
+ int offset = (int)(((unsigned char *)(PTR)) - ((unsigned char *)(pPEXBuffer->pHead))); \
+ err = puBuffRealloc(pPEXBuffer,(ddULONG)(SIZE)); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); \
+ (REPLY) = (TYPE *)(pPEXBuffer->pHead); \
+ (PTR) = (unsigned char *)(pPEXBuffer->pHead + offset); } \
+ }
+
+
+
+#define CountOnes(mask, countReturn) \
+ { \
+ register unsigned long y; \
+ y = ((mask) >> 1) &033333333333; \
+ y = (mask) - y - ((y >>1) & 033333333333); \
+ countReturn = (((y + (y >> 3)) & 030707070707) % 077); \
+ }
+
+
+extern ErrorCode UpdatePCRefs();
+
+
+/*++ PEXCreateRenderer
+ --*/
+ErrorCode
+PEXCreateRenderer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode freeRenderer();
+ ddRendererStr *prend = 0;
+ CARD8 *ptr = (CARD8 *)(strmPtr+1);
+ XID fakepm, fakeStrID;
+ diStructHandle fakeStr;
+ ddPickPath fakeStrpp, sIDpp;
+
+
+ if (!LegalNewID(strmPtr->rdr, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->rdr,cntxtPtr);
+
+ prend = (ddRendererStr *) xalloc ((unsigned long)(sizeof(ddRendererStr)));
+ if (!prend) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ prend->rendId = strmPtr->rdr;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+ prend->drawExample.type = prend->pDrawable->type;
+ prend->drawExample.class = prend->pDrawable->class;
+ prend->drawExample.depth = prend->pDrawable->depth;
+ prend->drawExample.rootDepth = prend->pDrawable->pScreen->rootDepth;
+ prend->drawExample.rootVisual = prend->pDrawable->pScreen->rootVisual;
+
+ prend->state = PEXIdle;
+ /* renderer dynamics masks are set by ddPEX */
+ prend->tablesMask = 0;
+ prend->namesetsMask = 0;
+ prend->attrsMask = 0;
+ /* flags for ddPEX */
+ prend->tablesChanges = 0;
+ prend->namesetsChanges = 0;
+ prend->attrsChanges = 0;
+ /* executeOCs table is set by ddPEX */
+
+ /* Defaults for Lookup Tables and Name Sets */
+ prend->lut[PEXMarkerBundleLUT] = 0; prend->lut[PEXTextBundleLUT] = 0;
+ prend->lut[PEXLineBundleLUT] = 0; prend->lut[PEXInteriorBundleLUT] = 0;
+ prend->lut[PEXEdgeBundleLUT] = 0; prend->lut[PEXViewLUT] = 0;
+ prend->lut[PEXColourLUT] = 0; prend->lut[PEXDepthCueLUT] = 0;
+ prend->lut[PEXLightLUT] = 0; prend->lut[PEXColourApproxLUT] = 0;
+ prend->lut[PEXPatternLUT] = 0; prend->lut[PEXTextFontLUT] = 0;
+ prend->ns[(unsigned)DD_HIGH_INCL_NS] = 0;
+ prend->ns[(unsigned)DD_HIGH_EXCL_NS] = 0;
+ prend->ns[(unsigned)DD_INVIS_INCL_NS] = 0;
+ prend->ns[(unsigned)DD_INVIS_EXCL_NS] = 0;
+ prend->ns[(unsigned)DD_PICK_INCL_NS] = 0;
+ prend->ns[(unsigned)DD_PICK_EXCL_NS] = 0;
+
+ /* Create the Psuedo Pick Measure. Real values are filled
+ in with ChangePsuedoPickMeasure called by BeginPickXXX routines
+ */
+ fakepm = FakeClientID(cntxtPtr->client->index);
+ prend->pickstr.client = cntxtPtr->client;
+ prend->pickstr.pseudoPM = (diPMHandle) xalloc ((unsigned long)sizeof(ddPMResource));
+ if (!prend->pickstr.pseudoPM) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ (prend->pickstr.pseudoPM)->id = fakepm;
+ err = CreatePseudoPickMeasure (prend);
+ if (err){
+ xfree((pointer)(prend->pickstr.pseudoPM));
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+ /* the fakepm resource gets added at the end of this routine now */
+
+
+ /* create listoflist for doing Pick All */
+ prend->pickstr.list = puCreateList(DD_LIST_OF_LIST);
+ prend->immediateMode = TRUE;
+
+ /* create a phony structure to pack OCs into
+ for doing immediate mode renderer picking
+ */
+ fakeStr = (diStructHandle)xalloc((unsigned long)
+ sizeof(ddStructResource));
+ if (!fakeStr) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ fakeStr->id = -666;
+ err = CreateStructure(fakeStr);
+ if (err) {
+ xfree((pointer)(fakeStr));
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ /* Now create 2 ddPickPaths, one for the fakeStrlist and the other
+ for maintaining the correspondence between the user supplied
+ structure ID and the structure handle
+ */
+
+ fakeStrpp.structure = fakeStr;
+ fakeStrpp.offset = 0;
+ fakeStrpp.pickid = 0;
+ prend->pickstr.fakeStrlist = puCreateList(DD_PICK_PATH);
+ err = puAddToList((ddPointer) &fakeStrpp, (ddULONG) 1, prend->pickstr.fakeStrlist);
+ if (err != Success) return(err);
+
+ sIDpp.structure = fakeStr;
+ sIDpp.offset = 0;
+ sIDpp.pickid = 0;
+ prend->pickstr.sIDlist = puCreateList(DD_PICK_PATH);
+ err = puAddToList((ddPointer) &sIDpp, (ddULONG) 1, prend->pickstr.sIDlist);
+ if (err != Success) return(err);
+
+
+ if (strmPtr->itemMask & PEXRDPipelineContext) {
+ ddPCStr *ppc = 0;
+ LU_PIPELINECONTEXT((*((CARD32 *)ptr)), ppc);
+ prend->pPC = ppc;
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ err = UpdatePCRefs (ppc, prend, (ddAction)ADD);
+ if (err != Success) {
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(err,0,cntxtPtr); }
+ } else prend->pPC = 0;
+
+
+ prend->curPath = puCreateList(DD_ELEMENT_REF);
+ if (!(prend->curPath)) {
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+ if (strmPtr->itemMask & PEXRDCurrentPath) {
+ unsigned long npaths;
+
+ /* Protocol says ignore this so skip past it in the Request Stream */
+ npaths = *(CARD32 *)ptr;
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ SKIP_STRUCT(ptr, npaths, pexElementRef);
+ }
+
+ if (strmPtr->itemMask & PEXRDMarkerBundle)
+ CHANGELUT(PEXMarkerBundleLUT, PEXDynMarkerBundle);
+
+ if (strmPtr->itemMask & PEXRDTextBundle)
+ CHANGELUT(PEXTextBundleLUT, PEXDynTextBundle);
+
+ if (strmPtr->itemMask & PEXRDLineBundle)
+ CHANGELUT(PEXLineBundleLUT, PEXDynLineBundle);
+
+ if (strmPtr->itemMask & PEXRDInteriorBundle)
+ CHANGELUT(PEXInteriorBundleLUT, PEXDynInteriorBundle);
+
+ if (strmPtr->itemMask & PEXRDEdgeBundle)
+ CHANGELUT(PEXEdgeBundleLUT, PEXDynEdgeBundle);
+
+ if (strmPtr->itemMask & PEXRDViewTable)
+ CHANGELUT(PEXViewLUT, PEXDynViewTable);
+
+ if (strmPtr->itemMask & PEXRDColourTable)
+ CHANGELUT(PEXColourLUT, PEXDynColourTable);
+
+ if (strmPtr->itemMask & PEXRDDepthCueTable)
+ CHANGELUT(PEXDepthCueLUT, PEXDynDepthCueTable);
+
+ if (strmPtr->itemMask & PEXRDLightTable)
+ CHANGELUT(PEXLightLUT, PEXDynLightTable);
+
+ if (strmPtr->itemMask & PEXRDColourApproxTable)
+ CHANGELUT(PEXColourApproxLUT, PEXDynColourApproxTable);
+
+ if (strmPtr->itemMask & PEXRDPatternTable)
+ CHANGELUT(PEXPatternLUT, PEXDynPatternTable);
+
+ if (strmPtr->itemMask & PEXRDTextFontTable)
+ CHANGELUT(PEXTextFontLUT, PEXDynTextFontTable);
+
+ if (strmPtr->itemMask & PEXRDHighlightIncl)
+ CHANGENS(DD_HIGH_INCL_NS, PEXDynHighlightNameset);
+
+ if (strmPtr->itemMask & PEXRDHighlightExcl)
+ CHANGENS(DD_HIGH_EXCL_NS, PEXDynHighlightNameset);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityIncl)
+ CHANGENS(DD_INVIS_INCL_NS, PEXDynInvisibilityNameset);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityExcl)
+ CHANGENS(DD_INVIS_EXCL_NS, PEXDynInvisibilityNameset);
+
+ if (strmPtr->itemMask & PEXRDRendererState) {
+ /* Protocol says ignore this it's read-only */
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ }
+
+ if (strmPtr->itemMask & PEXRDHlhsrMode) {
+ EXTRACT_INT16_FROM_4B(prend->hlhsrMode,ptr);
+ } else prend->hlhsrMode = PEXHlhsrOff; /* default */
+
+ if (strmPtr->itemMask & PEXRDNpcSubvolume) {
+ EXTRACT_COORD3D(&(prend->npcSubvolume.minval),ptr);
+ EXTRACT_COORD3D(&(prend->npcSubvolume.maxval),ptr);
+ } else { /* defaults */
+ prend->npcSubvolume.minval.x = 0.0;
+ prend->npcSubvolume.minval.y = 0.0;
+ prend->npcSubvolume.minval.z = 0.0;
+ prend->npcSubvolume.maxval.x = 1.0;
+ prend->npcSubvolume.maxval.y = 1.0;
+ prend->npcSubvolume.maxval.z = 1.0;
+ };
+
+
+ if (strmPtr->itemMask & PEXRDViewport) {
+ EXTRACT_INT16(prend->viewport.minval.x,ptr);
+ EXTRACT_INT16(prend->viewport.minval.y,ptr);
+ EXTRACT_FLOAT(prend->viewport.minval.z,ptr);
+ EXTRACT_INT16(prend->viewport.maxval.x,ptr);
+ EXTRACT_INT16(prend->viewport.maxval.y,ptr);
+ EXTRACT_FLOAT(prend->viewport.maxval.z,ptr);
+ EXTRACT_CARD8(prend->viewport.useDrawable,ptr);
+ SKIP_PADDING(ptr,(sizeof(CARD8)+sizeof(CARD16)));
+ } else { /* default */
+ prend->viewport.useDrawable = 1;
+ prend->viewport.maxval.z = 1.0;
+ prend->viewport.minval.z = 0.0;
+ }
+
+
+ prend->clipList = puCreateList(DD_DEVICE_RECT);
+ if (!(prend->clipList)) {
+ puDeleteList(prend->curPath);
+ if (prend->pPC)
+ (void)UpdatePCRefs (prend->pPC, prend, (ddAction)(REMOVE));
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+ if (strmPtr->itemMask & PEXRDClipList) {
+ unsigned long nrects;
+ EXTRACT_CARD32(nrects,ptr);
+ puAddToList((ddPointer)ptr, nrects, prend->clipList);
+ SKIP_STRUCT(ptr, nrects, pexDeviceRect);
+ }; /* else prend->clipList = 0;*/ /* default */
+
+ if (strmPtr->itemMask & PEXRDPickInclusion) {
+ CHANGENS(DD_PICK_INCL_NS, PEXDynPickNameset);
+ }
+
+ if (strmPtr->itemMask & PEXRDPickExclusion) {
+ CHANGENS(DD_PICK_EXCL_NS, PEXDynPickNameset);
+ }
+
+
+ prend->pickStartPath = puCreateList(DD_PICK_PATH);
+ if (!(prend->pickStartPath)) {
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ }
+ if (strmPtr->itemMask & PEXRDPickStartPath) {
+ pexElementRef *per;
+ diStructHandle sh, *psh;
+ ddPickPath *ppath, *ppathStart;
+ CARD32 i, numpaths;
+ extern ddpex3rtn ValidatePickPath();
+
+ /* must convert list of Element Ref into Pick Path for internal
+ storage and use
+ */
+ EXTRACT_CARD32( numpaths, ptr);
+ ppathStart = (ddPickPath *)xalloc(numpaths * sizeof(ddPickPath));
+ ppath = ppathStart;
+
+ for (i=0, per = (pexElementRef *)ptr; i<numpaths; i++, per++,
+ ppath++) {
+ LU_STRUCTURE(per->structure,sh);
+ ppath->structure = sh;
+ ppath->offset = per->offset;
+ ppath->pickid = 0;
+ }
+
+ puAddToList((ddPointer)ppathStart, numpaths, prend->pickStartPath);
+ err = ValidatePickPath(prend->pickStartPath);
+ if (err != Success) PEX_ERR_EXIT(err,0,cntxtPtr);
+ ptr = (unsigned char *)per;
+ xfree((pointer)ppathStart);
+ }
+
+ if (strmPtr->itemMask & PEXRDBackgroundColour) {
+ EXTRACT_COLOUR_SPECIFIER(prend->backgroundColour,ptr);
+ }
+ else /* default */
+ {
+ prend->backgroundColour.colourType = PEXIndexedColour;
+ prend->backgroundColour.colour.indexed.index = 0;
+ }
+
+ if (strmPtr->itemMask & PEXRDClearI) {
+ EXTRACT_CARD8_FROM_4B(prend->clearI,ptr);
+ }
+ else /* default */
+ prend->clearI = xFalse;
+
+ if (strmPtr->itemMask & PEXRDClearZ) {
+ EXTRACT_CARD8_FROM_4B(prend->clearZ,ptr);
+ }
+ else /* default */
+ prend->clearZ = xTrue;
+
+ if (strmPtr->itemMask & PEXRDEchoMode) {
+ EXTRACT_CARD16_FROM_4B(prend->echoMode,ptr);
+ }
+ else /* default */
+ prend->echoMode = PEXNoEcho;
+
+ /* set the default echoColour */
+ prend->echoColour.colourType = PEXIndexedColour;
+ prend->echoColour.colour.indexed.index = 0;
+
+ err = InitRenderer(prend);
+ if (err) {
+ puDeleteList(prend->clipList);
+ puDeleteList(prend->curPath);
+ if (prend->pPC)
+ (void)UpdatePCRefs (prend->pPC, prend, (ddAction)(REMOVE));
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ };
+
+ ADDRESOURCE(strmPtr->rdr, PEXRendType, prend);
+ ADDRESOURCE(fakepm, PEXPickType, prend->pickstr.pseudoPM);
+ return( err );
+
+} /* end-PEXCreateRenderer() */
+
+/*++
+ freeRenderer
+ --*/
+ErrorCode
+FreeRenderer (prend, id)
+ddRendererStr *prend;
+pexRenderer id;
+{
+ ddPickPath *strpp;
+ ErrorCode err = Success;
+ CARD32 i;
+
+ if (prend) {
+ DeleteDDContext(prend->pDDContext);
+
+ puDeleteList(prend->clipList);
+ puDeleteList(prend->curPath);
+ puDeleteList(prend->pickStartPath);
+ puDeleteList(prend->pickstr.list);
+ strpp = (ddPickPath *)(prend->pickstr.fakeStrlist)->pList;
+ DeleteStructure(strpp[0].structure, (strpp[0].structure)->id );
+ puDeleteList(prend->pickstr.fakeStrlist);
+ puDeleteList(prend->pickstr.sIDlist);
+
+ if (prend->pPC) (void)UpdatePCRefs(prend->pPC,prend,(ddAction)REMOVE);
+ for (i = 1; i < PEXMaxTableType+1; i++ ) {
+ if (prend->lut[i]) {
+ err = UpdateLUTRefs( prend->lut[i],
+ (diResourceHandle)(prend),
+ (ddResourceType)RENDERER_RESOURCE,
+ (ddAction)REMOVE);
+ if (err) return(err);
+ }
+ }
+ for (i = 0; i != DD_MAX_FILTERS; i++ ) {
+ if (prend->ns[(unsigned)i]) {
+ err = UpdateNSRefs( prend->ns[(unsigned)i],
+ (diResourceHandle)(prend),
+ (ddResourceType)RENDERER_RESOURCE,
+ (ddAction)REMOVE);
+ if (err) return(err);
+ }
+ }
+
+ xfree((pointer)prend);
+ }
+
+ return( err );
+}
+
+/*++ PEXFreeRenderer
+ --*/
+
+ErrorCode
+PEXFreeRenderer (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreeRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXRendererError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_RENDERER(strmPtr->id, prend);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreeRenderer() */
+
+/*++ PEXChangeRenderer
+ --*/
+
+ErrorCode
+PEXChangeRenderer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangeRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ CARD8 *ptr = (CARD8 *)(strmPtr+1);
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ if (strmPtr->itemMask & PEXRDPipelineContext) {
+ ddPCStr *ppc = 0, *old_ppc = 0;
+ old_ppc = prend->pPC;
+ if (old_ppc) (void)UpdatePCRefs (old_ppc, prend, (ddAction)REMOVE);
+ LU_PIPELINECONTEXT((*((CARD32 *)ptr)), ppc);
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ err = UpdatePCRefs (ppc, prend, (ddAction)ADD);
+ if (err != Success) {
+ xfree((pointer)prend);
+ PEX_ERR_EXIT(err,0,cntxtPtr); }
+ prend->pPC = ppc;
+ };
+
+ if (strmPtr->itemMask & PEXRDCurrentPath) {
+ /* Protocol Spec says ignore this field it is read-only */
+ CARD32 i;
+ i = *(CARD32 *)ptr;
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ SKIP_STRUCT(ptr, i, pexElementRef);
+ }
+
+ if (strmPtr->itemMask & PEXRDMarkerBundle)
+ CHANGELUT(PEXMarkerBundleLUT, PEXDynMarkerBundle);
+
+ if (strmPtr->itemMask & PEXRDTextBundle)
+ CHANGELUT(PEXTextBundleLUT, PEXDynTextBundle);
+
+ if (strmPtr->itemMask & PEXRDLineBundle)
+ CHANGELUT(PEXLineBundleLUT, PEXDynLineBundle);
+
+ if (strmPtr->itemMask & PEXRDInteriorBundle)
+ CHANGELUT(PEXInteriorBundleLUT, PEXDynInteriorBundle);
+
+ if (strmPtr->itemMask & PEXRDEdgeBundle)
+ CHANGELUT(PEXEdgeBundleLUT, PEXDynEdgeBundle);
+
+ if (strmPtr->itemMask & PEXRDViewTable)
+ CHANGELUT(PEXViewLUT, PEXDynViewTable);
+
+ if (strmPtr->itemMask & PEXRDColourTable)
+ CHANGELUT(PEXColourLUT, PEXDynColourTable);
+
+ if (strmPtr->itemMask & PEXRDDepthCueTable)
+ CHANGELUT(PEXDepthCueLUT, PEXDynDepthCueTable);
+
+ if (strmPtr->itemMask & PEXRDLightTable)
+ CHANGELUT(PEXLightLUT, PEXDynLightTable);
+
+ if (strmPtr->itemMask & PEXRDColourApproxTable)
+ CHANGELUT(PEXColourApproxLUT, PEXDynColourApproxTable);
+
+ if (strmPtr->itemMask & PEXRDPatternTable)
+ CHANGELUT(PEXPatternLUT, PEXDynPatternTable);
+
+ if (strmPtr->itemMask & PEXRDTextFontTable)
+ CHANGELUT(PEXTextFontLUT, PEXDynTextFontTable);
+
+ if (strmPtr->itemMask & PEXRDHighlightIncl)
+ CHANGENS(DD_HIGH_INCL_NS, PEXDynHighlightNameset);
+
+ if (strmPtr->itemMask & PEXRDHighlightExcl)
+ CHANGENS(DD_HIGH_EXCL_NS, PEXDynHighlightNameset);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityIncl)
+ CHANGENS(DD_INVIS_INCL_NS, PEXDynInvisibilityNameset);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityExcl)
+ CHANGENS(DD_INVIS_EXCL_NS, PEXDynInvisibilityNameset);
+
+ if (strmPtr->itemMask & PEXRDRendererState) {
+ /* Spec says ignore this in Change Renderer */
+ SKIP_PADDING(ptr,sizeof(CARD32));
+ }
+
+ if (strmPtr->itemMask & PEXRDHlhsrMode) {
+ EXTRACT_INT16_FROM_4B(prend->hlhsrMode,ptr);
+ prend->attrsChanges |= PEXDynHlhsrMode;
+ }
+
+ if (strmPtr->itemMask & PEXRDNpcSubvolume) {
+ EXTRACT_COORD3D(&(prend->npcSubvolume.minval),ptr);
+ EXTRACT_COORD3D(&(prend->npcSubvolume.maxval),ptr);
+ prend->attrsChanges |= PEXDynNpcSubvolume;
+ }
+
+ if (strmPtr->itemMask & PEXRDViewport) {
+ EXTRACT_INT16(prend->viewport.minval.x,ptr);
+ EXTRACT_INT16(prend->viewport.minval.y,ptr);
+ EXTRACT_FLOAT(prend->viewport.minval.z,ptr);
+ EXTRACT_INT16(prend->viewport.maxval.x,ptr);
+ EXTRACT_INT16(prend->viewport.maxval.y,ptr);
+ EXTRACT_FLOAT(prend->viewport.maxval.z,ptr);
+ EXTRACT_CARD8(prend->viewport.useDrawable,ptr);
+ SKIP_PADDING(ptr,(sizeof(CARD8)+sizeof(CARD16)));
+ prend->attrsChanges |= PEXDynViewport;
+ };
+
+ if (strmPtr->itemMask & PEXRDClipList) {
+ unsigned long nrects;
+ EXTRACT_CARD32(nrects,ptr);
+ PU_EMPTY_LIST(prend->clipList);
+ puAddToList((ddPointer)ptr, nrects, prend->clipList);
+ prend->attrsChanges |= PEXDynClipList;
+ SKIP_STRUCT(ptr, nrects, pexDeviceRect);
+ }
+
+ if (strmPtr->itemMask & PEXRDPickInclusion) {
+ CHANGENS(DD_PICK_INCL_NS, PEXDynPickNameset);
+ }
+
+ if (strmPtr->itemMask & PEXRDPickExclusion) {
+ CHANGENS(DD_PICK_EXCL_NS, PEXDynPickNameset);
+ }
+
+ if (strmPtr->itemMask & PEXRDPickStartPath) {
+ pexElementRef *per;
+ diStructHandle sh, *psh;
+ ddPickPath *ppath, *ppathStart;
+ CARD32 i, numpaths;
+ extern ddpex3rtn ValidatePickPath();
+
+ /* must convert list of Element Ref into Pick Path for internal
+ storage and use
+ */
+ EXTRACT_CARD32( numpaths, ptr);
+ ppathStart = (ddPickPath *)xalloc(numpaths * sizeof(ddPickPath));
+ ppath = ppathStart;
+
+ for (i=0, per = (pexElementRef *)ptr; i<numpaths; i++, per++,
+ ppath++) {
+ LU_STRUCTURE(per->structure,sh);
+ ppath->structure = sh;
+ ppath->offset = per->offset;
+ ppath->pickid = 0;
+ }
+
+ PU_EMPTY_LIST(prend->pickStartPath);
+ puAddToList((ddPointer)ppathStart, numpaths, prend->pickStartPath);
+ err = ValidatePickPath(prend->pickStartPath);
+ if (err != Success) PEX_ERR_EXIT(err,0,cntxtPtr);
+ ptr = (unsigned char *)per;
+ xfree((pointer)ppathStart);
+ }
+
+
+ if (strmPtr->itemMask & PEXRDBackgroundColour) {
+ EXTRACT_COLOUR_SPECIFIER(prend->backgroundColour,ptr);
+ }
+
+ if (strmPtr->itemMask & PEXRDClearI) {
+ EXTRACT_CARD8_FROM_4B(prend->clearI,ptr);
+ }
+
+ if (strmPtr->itemMask & PEXRDClearZ) {
+ EXTRACT_CARD8_FROM_4B(prend->clearZ,ptr);
+ }
+
+ if (strmPtr->itemMask & PEXRDEchoMode) {
+ EXTRACT_CARD16_FROM_4B(prend->echoMode,ptr);
+ prend->attrsChanges |= PEXDynEchoMode;
+ }
+
+
+ return( err );
+
+} /* end-PEXChangeRenderer() */
+
+/*++ PEXGetRendererAttributes
+ --*/
+ErrorCode
+PEXGetRendererAttributes( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetRendererAttributesReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexGetRendererAttributesReply *reply
+ = (pexGetRendererAttributesReply *)(pPEXBuffer->pHead);
+ CARD8 *ptr = 0;
+ int size = 0;
+ CARD32 lwords_mask, num_lwords = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ SETUP_INQ(pexGetRendererAttributesReply);
+ ptr = (CARD8 *) (pPEXBuffer->pBuf);
+
+ lwords_mask = strmPtr->itemMask
+ & ~(PEXRDNpcSubvolume | PEXRDViewport | PEXRDClipList |
+ PEXRDBackgroundColour);
+ CountOnes(lwords_mask, num_lwords);
+ num_lwords += ((strmPtr->itemMask & PEXRDCurrentPath)
+ ? (prend->curPath->numObj * sizeof(pexElementRef) / 4) + 1
+ : 0);
+ num_lwords += ((strmPtr->itemMask & PEXRDPickStartPath)
+ ? (prend->pickStartPath->numObj * sizeof(pexElementRef) / 4)
+ + 1 : 0);
+ CHK_PEX_BUF(size, sizeof(pexGetRendererAttributesReply)
+ + num_lwords * sizeof(CARD32),
+ reply, pexGetRendererAttributesReply, ptr);
+
+ if (strmPtr->itemMask & PEXRDPipelineContext)
+ PACK_CARD32(((prend->pPC) ? prend->pPC->PCid : 0), ptr);
+
+ if (strmPtr->itemMask & PEXRDCurrentPath) {
+ pexStructure sid = 0;
+ unsigned long i;
+ ddElementRef *per = (ddElementRef *)(prend->curPath->pList);
+ PACK_CARD32( prend->curPath->numObj, ptr);
+ for (i=0; i<prend->curPath->numObj; i++, per++) {
+ /* Begin Structure uses the structure handle field to store the
+ ID so there is no need to look it up, just assign it
+ */
+ sid = (pexStructure) per->structure;
+ PACK_CARD32(sid, ptr);
+ PACK_CARD32(per->offset, ptr);
+ }
+ }
+
+ if (strmPtr->itemMask & PEXRDMarkerBundle)
+ PACK_CARD32( GetId(prend->lut[PEXMarkerBundleLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDTextBundle)
+ PACK_CARD32( GetId(prend->lut[PEXTextBundleLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDLineBundle)
+ PACK_CARD32( GetId(prend->lut[PEXLineBundleLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDInteriorBundle)
+ PACK_CARD32( GetId(prend->lut[PEXInteriorBundleLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDEdgeBundle)
+ PACK_CARD32( GetId(prend->lut[PEXEdgeBundleLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDViewTable)
+ PACK_CARD32( GetId(prend->lut[PEXViewLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDColourTable)
+ PACK_CARD32( GetId(prend->lut[PEXColourLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDDepthCueTable)
+ PACK_CARD32( GetId(prend->lut[PEXDepthCueLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDLightTable)
+ PACK_CARD32( GetId(prend->lut[PEXLightLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDColourApproxTable)
+ PACK_CARD32( GetId(prend->lut[PEXColourApproxLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDPatternTable)
+ PACK_CARD32( GetId(prend->lut[PEXPatternLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDTextFontTable)
+ PACK_CARD32( GetId(prend->lut[PEXTextFontLUT]), ptr);
+
+ if (strmPtr->itemMask & PEXRDHighlightIncl)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_HIGH_INCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDHighlightExcl)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_HIGH_EXCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityIncl)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_INVIS_INCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDInvisibilityExcl)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_INVIS_EXCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDRendererState) PACK_CARD32( prend->state, ptr);
+
+ if (strmPtr->itemMask & PEXRDHlhsrMode) PACK_CARD32( prend->hlhsrMode, ptr);
+
+ if (strmPtr->itemMask & PEXRDNpcSubvolume) {
+ CHK_PEX_BUF(size, sizeof(pexNpcSubvolume),
+ reply, pexGetRendererAttributesReply, ptr);
+ PACK_COORD3D(&(prend->npcSubvolume.minval), ptr);
+ PACK_COORD3D(&(prend->npcSubvolume.maxval), ptr);
+ }
+
+ if (strmPtr->itemMask & PEXRDViewport) {
+ CHK_PEX_BUF(size, sizeof(pexViewport),
+ reply, pexGetRendererAttributesReply, ptr);
+ PACK_INT16( prend->viewport.minval.x, ptr);
+ PACK_INT16( prend->viewport.minval.y, ptr);
+ PACK_FLOAT( prend->viewport.minval.z, ptr);
+ PACK_INT16( prend->viewport.maxval.x, ptr);
+ PACK_INT16( prend->viewport.maxval.y, ptr);
+ PACK_FLOAT( prend->viewport.maxval.z, ptr);
+ PACK_CARD8( prend->viewport.useDrawable, ptr);
+ SKIP_PADDING( ptr, (sizeof(CARD8)+sizeof(CARD16)));
+ }
+
+ if (strmPtr->itemMask & PEXRDClipList) {
+ int num_bytes = prend->clipList->numObj * sizeof(pexDeviceRect);
+ CHK_PEX_BUF(size, sizeof(CARD32) + num_bytes,
+ reply, pexGetRendererAttributesReply, ptr);
+ PACK_CARD32(prend->clipList->numObj, ptr);
+ memcpy( (char *)ptr, (char *)(prend->clipList->pList), num_bytes);
+ ptr += num_bytes;
+ }
+
+ if (strmPtr->itemMask & PEXRDPickInclusion)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_PICK_INCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDPickExclusion)
+ PACK_CARD32( GetId(prend->ns[(unsigned)DD_PICK_EXCL_NS]), ptr);
+
+ if (strmPtr->itemMask & PEXRDPickStartPath) {
+ /* StartPath is stored as a Pick Path even though the spec
+ and encoding define it as an Element Ref since the Renderer
+ Pikcing needs to use it as a Pick Path
+ */
+ pexStructure sid = 0;
+ unsigned long i;
+ ddPickPath *per = (ddPickPath *)(prend->pickStartPath->pList);
+ PACK_CARD32( prend->pickStartPath->numObj, ptr);
+ for (i=0; i<prend->pickStartPath->numObj; i++, per++) {
+ sid = GetId(per->structure);
+ PACK_CARD32(sid, ptr);
+ PACK_CARD32(per->offset, ptr);
+ }
+ }
+
+ if (strmPtr->itemMask & PEXRDBackgroundColour) {
+ CHK_PEX_BUF(size, sizeof(CARD32)
+ + SIZE_COLOURSPEC(prend->backgroundColour),
+ reply, pexGetRendererAttributesReply, ptr);
+ PACK_COLOUR_SPECIFIER(prend->backgroundColour,ptr);
+ }
+
+ if (strmPtr->itemMask & PEXRDClearI) PACK_CARD32( prend->clearI, ptr);
+
+ if (strmPtr->itemMask & PEXRDClearZ) PACK_CARD32( prend->clearZ, ptr);
+
+ if (strmPtr->itemMask & PEXRDEchoMode) PACK_CARD32( prend->echoMode, ptr);
+
+
+ reply->length = (unsigned long)(ptr) - (unsigned long)(pPEXBuffer->pBuf);
+ reply->length = LWORDS(reply->length);
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof(pexGetRendererAttributesReply)
+ + sizeof(CARD32) * reply->length,
+ reply);
+
+ return( err );
+
+} /* end-PEXGetRendererAttributes() */
+
+/*
+ * Thexe requests provide support for client-side traversal.
+ * PEX currently provides only rendering support for client-side
+ * traversal: no picking and searching in the server for
+ * client-side or mixed mode structures.
+ */
+
+/*++ PEXBeginRendering
+ --*/
+ErrorCode
+PEXBeginRendering( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexBeginRenderingReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ /* set drawableId = 0 : this helps protect us if we error-return
+ out of the lookup id, and then later try to RenderOC's on this
+ renderer with a bad drawable */
+ prend->drawableId = 0;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+
+ err = BeginRendering(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXBeginRendering() */
+
+/*++ PEXEndRendering
+ --*/
+ErrorCode
+PEXEndRendering( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEndRenderingReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = EndRendering(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXEndRendering() */
+
+/*++ PEXClearRenderer
+ --*/
+ErrorCode
+PEXClearRenderer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexClearRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = ClearRenderer(prend, strmPtr->clearControl);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXClearRenderer() */
+
+/*++ PEXFlushRenderer
+ --*/
+ErrorCode
+PEXFlushRenderer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexFlushRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = FlushRenderer(prend, strmPtr->flushFlag);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXFlushRenderer() */
+
+/*++ PEXInitRenderer
+ --*/
+ErrorCode
+PEXInitRenderer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexInitRendererReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = InitRenderer(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXInitRenderer() */
+
+/*++ PEXBeginStructure
+ --*/
+ErrorCode
+PEXBeginStructure( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexBeginStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = BeginStructure (prend, strmPtr->sid);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXBeginStructure() */
+
+/*++ PEXEndStructure
+ --*/
+ErrorCode
+PEXEndStructure( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEndStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->id, prend);
+
+ err = EndStructure (prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXEndStructure() */
+
+/*++ PEXRenderNetwork
+ --*/
+typedef struct {
+ pexRenderOutputCommandsReq header;
+ pexExecuteStructure data;
+} fakeRenderNetwork;
+
+static fakeRenderNetwork froc = {
+ 0, /* reqType */
+ PEX_RenderNetwork, /* opcode */
+ sizeof(fakeRenderNetwork), /* length */
+ SERVER_NATIVE_FP, /* fpFormat */
+ 0, /* unused */
+ 0, /* rdr */
+ 1, /* numCommands */
+ PEXOCExecuteStructure, /* elementType */
+ sizeof(pexExecuteStructure), /* length */
+ 0 /* id */
+};
+/*++ PEXRenderNetwork
+ --*/
+ErrorCode
+PEXRenderNetwork( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexRenderNetworkReq *strmPtr;
+{
+ ErrorCode err = PEXNYI;
+ ddRendererStr *prend = 0;
+ diStructHandle ps = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_STRUCTURE(strmPtr->sid, ps);
+
+ /* set drawableId = 0 : this helps protect us if we error-return
+ out of the lookup id, and then later try to RenderOC's on this
+ renderer with a bad drawable */
+ prend->drawableId = 0;
+
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+
+ err = BeginRendering(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ froc.header.reqType = strmPtr->reqType;
+ froc.header.rdr = strmPtr->rdr;
+ froc.data.id = strmPtr->sid;
+ err = PEXRenderOutputCommands(cntxtPtr, &(froc.header));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = EndRendering(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXRenderNetwork() */
+
+
+ErrorCode
+PEXRenderElements( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexRenderElementsReq *strmPtr;
+{
+ ErrorCode err = PEXNYI;
+ ddRendererStr *prend = 0;
+ diStructHandle ps = 0;
+ ddElementRange *range;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_STRUCTURE(strmPtr->sid, ps);
+
+ range = (ddElementRange *) &(strmPtr->range);
+
+ err = RenderElements(prend, ps, range );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXRenderElements() */
+
+
+ErrorCode
+PEXAccumulateState( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexAccumulateStateReq *strmPtr;
+{
+ ErrorCode err = PEXNYI;
+ ddRendererStr *prend = 0;
+ ddAccStStr *pAccSt = 0;
+ pexElementRef *per;
+ diStructHandle sh, *psh;
+ CARD32 i;
+ extern ddpex4rtn ValidateStructurePath();
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ pAccSt = (ddAccStStr *)xalloc((unsigned long)sizeof(ddAccStStr));
+ if (!pAccSt) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ pAccSt->numElRefs = strmPtr->numElRefs;
+ pAccSt->Path = 0;
+
+ per = (pexElementRef *)(strmPtr+1);
+ for (i = 0 ; i < strmPtr->numElRefs; i++, per++) {
+ LU_STRUCTURE(per->structure,sh);
+ psh = (diStructHandle *)&(per->structure);
+ *psh = sh;
+ }
+
+ pAccSt->Path = puCreateList(DD_ELEMENT_REF);
+ if (!(pAccSt->Path)) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ puAddToList((ddPointer)(strmPtr+1), pAccSt->numElRefs, pAccSt->Path);
+ err = ValidateStructurePath(pAccSt->Path);
+ if (err != Success) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = AccumulateState(prend, pAccSt );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /* clean up */
+ puDeleteList(pAccSt->Path);
+ xfree((pointer)pAccSt);
+
+ return( err );
+
+} /* end-PEXAccumulateState() */
+
+
+ErrorCode
+PEXGetRendererDynamics( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetRendererDynamicsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexGetRendererDynamicsReply *reply
+ = (pexGetRendererDynamicsReply *)pPEXBuffer->pHead;
+
+ LU_RENDERER(strmPtr->id, prend);
+
+ err = InquireRendererDynamics( prend, &(reply->tables),
+ &(reply->namesets), &(reply->attributes));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = 0;
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof(pexGetRendererDynamicsReply), reply);
+ return( err );
+
+} /* end-PEXRenderNetwork() */
+
+/*++ PEXRenderNetwork
+ --*/
+ErrorCode
+PEXRenderOutputCommands( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexRenderOutputCommandsReq *strmPtr;
+{
+ CARD32 *curOC;
+ pexElementInfo *pe;
+ CARD32 i;
+ ErrorCode err = Success;
+ pexOutputCommandError *pErr;
+ ddRendererStr *prend = 0;
+ pexStructure *ps;
+ diStructHandle ph;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ /*
+ Just in case, check the drawableId. It may have been freed
+ due to some race condition with client cleanup.
+ Since unlike phigs workstations resources, renderers don't
+ do implicit regeneration, we can just check here and we don't
+ have to do the complicated resource tracking like in pexPhigs.c
+ */
+ LU_DRAWABLE(prend->drawableId, prend->pDrawable);
+
+ for (i = 0, curOC = (CARD32 *)(strmPtr + 1); i < strmPtr->numCommands;
+ i++, curOC += pe->length ) {
+ pe = (pexElementInfo *)curOC;
+ if ((PEXOCAll < pe->elementType ) && (pe->elementType <= PEXMaxOC)) {
+ if (pe->elementType == PEXOCExecuteStructure) {
+ ps = &(((pexExecuteStructure *)(pe))->id);
+ LU_STRUCTURE(*ps, ph);
+ *ps = (pexStructure)(ph);
+ }
+ }
+ }
+
+ err = RenderOCs(prend, strmPtr->numCommands, (strmPtr+1));
+
+ /* this line is useless pErr never gets returned from anywhere
+ if (err) PEX_OC_ERROR(pErr, cntxtPtr);
+ */
+
+ return( err );
+
+} /* end-PEXRenderOutputCommands() */
+
+ErrorCode
+UpdateRendRefs ( pr, pc, type, flag)
+ddRendererStr *pr;
+pexPC pc;
+unsigned long type;
+unsigned long flag;
+{
+
+}
+
+/*++ PEXCopyAlphaToPixmap
+ --*/
+ErrorCode
+PEXCopyAlphaToPixmap( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyAlphaToPixmapReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->pixmap, prend->pDrawable);
+
+ err = CopyAlphaToPixmap(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyAlphaToPixmap() */
+
+/*++ PEXCopyPixmapToAlpha
+ --*/
+ErrorCode
+PEXCopyPixmapToAlpha( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyPixmapToAlphaReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->pixmap, prend->pDrawable);
+
+ err = CopyPixmapToAlpha(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyPixmapToAlpha() */
+
+/*++ PEXCopyZBufferToPixmap
+ --*/
+ErrorCode
+PEXCopyZBufferToPixmap( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyZBufferToPixmapReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->pixmap, prend->pDrawable);
+
+ err = CopyZBufferToPixmap(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyZBufferToPixmap() */
+
+/*++ PEXCopyPixmapToZBuffer
+ --*/
+ErrorCode
+PEXCopyPixmapToZBuffer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyPixmapToZBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->pixmap, prend->pDrawable);
+
+ err = CopyPixmapToZBuffer(prend, prend->pDrawable);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyPixmapToZBuffer() */
+
+/*++ PEXCopyPCToPipelineState
+ --*/
+ErrorCode
+PEXCopyPCToPipelineState( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyPCToPipelineStateReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ ddPCStr *ppc = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_PIPELINECONTEXT(strmPtr->pc, ppc);
+
+ err = CopyPCToPipelineState(prend, ppc, strmPtr->itemMask);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyPCToPipelineState() */
+
+/*++ PEXCopyPipelineStateToPC
+ --*/
+ErrorCode
+PEXCopyPipelineStateToPC( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyPipelineStateToPCReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ ddPCStr *ppc = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_PIPELINECONTEXT(strmPtr->pc, ppc);
+
+ err = CopyPipelineStateToPC(prend, ppc, strmPtr->itemMask);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyPipelineStateToPC() */
+
+/*++ PEXGetZBuffer
+ --*/
+ErrorCode
+PEXGetZBuffer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetZBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexSwitch undefinedValues = 0;
+ ddULONG numValues = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ SETUP_INQ(pexGetZBufferReply);
+
+ err = GetZBuffer(prend, strmPtr->x, strmPtr->y, strmPtr->width,
+strmPtr->height, strmPtr->normalizedValues, &numValues, &undefinedValues,
+pPEXBuffer);
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetZBufferReply);
+ reply->numValues = numValues;
+ reply->undefinedValues = undefinedValues;
+ WritePEXBufferReply(pexGetZBufferReply);
+ }
+
+ return( err );
+
+} /* end-PEXGetZBuffer() */
+
+/*++ PEXPutZBuffer
+ --*/
+ErrorCode
+PEXPutZBuffer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexPutZBufferReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ ddPointer *Zbuffer;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ CHECK_FP_FORMAT(strmPtr->fpFormat);
+
+ Zbuffer = (ddPointer *)(strmPtr + 1);
+
+ err = PutZBuffer(prend, strmPtr->x, strmPtr->y, strmPtr->width,
+strmPtr->height, strmPtr->normalizedValues, strmPtr->numValues, Zbuffer);
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXGetZBuffer() */
+
+/*++ PEXInitMultipass
+ --*/
+ErrorCode
+PEXInitMultipass( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexInitMultipassReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = InitMultipass(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXInitMultipass() */
+
+/*++ PEXNextPass
+ --*/
+ErrorCode
+PEXNextPass( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexNextPassReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBuffer *pPEXBuffer;
+ pexNextPassReply *reply = (pexNextPassReply *)(pPEXBuffer->pHead);
+ ddRendererStr *prend = 0;
+ ddLONG count = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ SETUP_INQ(pexNextPassReply);
+
+ err = NextPass(prend, strmPtr->multipass_control, &count);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ reply->length = 0;
+ reply->count = count;
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof(pexNextPassReply) + reply->length,
+ reply);
+ return( err );
+
+} /* end-PEXNextPass() */
+
+/*++ PEXNextPassWoutReply
+ --*/
+ErrorCode
+PEXNextPassWoutReply( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexNextPassReq *strmPtr;
+/* uses same structure as PEXNextPass*/
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ err = NextPassWoutReply(prend, strmPtr->multipass_control );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXNextPassWoutReply() */
+
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexRndrPick.c b/xc/programs/Xserver/PEX5/dipex/objects/pexRndrPick.c
new file mode 100644
index 000000000..506c6a4b7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexRndrPick.c
@@ -0,0 +1,307 @@
+/* $TOG: pexRndrPick.c /main/10 1998/02/10 12:35:43 kaleb $ */
+
+/************************************************************
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+******************************************************************/
+
+
+
+/*++
+ * --- Renderer Picking ---
+ * PEXBeginPickOne
+ * PEXEndPickOne
+ * PEXPickOne
+ * PEXBeginPickAll
+ * PEXEndPickAll
+ * PEXPickAll
+ --*/
+
+#include "X.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "pexError.h"
+#include "dipex.h"
+#include "PEXprotost.h"
+#include "pex_site.h"
+#include "ddpex3.h"
+#include "ddpex4.h"
+#include "pexLookup.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+/*++ Renderer Picking ++*/
+
+ErrorCode
+PEXBeginPickOne( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexBeginPickOneReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ pexPickRecord *pr = (pexPickRecord *)(strmPtr+1);
+ ddPickPath *sIDpp;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+ /* this is evil but necessary, use the pickid field of the
+ sIDlist to store the structure ID that corresponds to the
+ top level fake structure
+ */
+ sIDpp = (ddPickPath *)(prend->pickstr.sIDlist)->pList;
+ sIDpp->pickid = strmPtr->sid;
+
+ prend->pickstr.pick_method = strmPtr->method;
+ prend->pickstr.state = DD_PICK_ONE;
+ prend->pickstr.server = DD_CLIENT;
+
+ err = ChangePseudoPickMeasure (prend, pr);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /* This is set up to use this instead of defining a BeginPickOne */
+ err = BeginPicking(prend, prend->pickstr.pseudoPM);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+} /* end-PEXBeginPickOne() */
+
+ErrorCode
+PEXEndPickOne( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEndPickOneReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ extern ddBufferPtr pPEXBuffer;
+ pexEndPickOneReply *reply = (pexEndPickOneReply*)(pPEXBuffer->pHead);
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ if (prend->pickstr.state != DD_PICK_ONE)
+ PEX_ERR_EXIT(PEX_ERROR_CODE(PEXRendererStateError),0,cntxtPtr);
+
+ SETUP_INQ(pexEndPickOneReply);
+
+ err = EndPickOne(prend, pPEXBuffer, &(reply->numPickElRefs),
+ &(reply->pickStatus), &(reply->betterPick));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = EndPicking(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ reply->length = LWORDS(pPEXBuffer->dataSize);
+ WritePEXBufferReply(pexEndPickOneReply);
+
+ }
+ return( err );
+} /* end-PEXEndPickOne() */
+
+ErrorCode
+PEXPickOne( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexPickOneReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBufferPtr pPEXBuffer;
+ ddRendererStr *prend = 0;
+ pexPickRecord *pr = (pexPickRecord *)(strmPtr+1);
+ pexPickOneReply *reply = (pexPickOneReply*)(pPEXBuffer->pHead);
+
+ /* do stuff same as BeginPickOne */
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+ LU_STRUCTURE(strmPtr->sid, prend->pickstr.strHandle);
+
+ prend->pickstr.pick_method = strmPtr->method;
+ prend->pickstr.state = DD_PICK_ONE;
+ prend->pickstr.server = DD_SERVER;
+
+ err = ChangePseudoPickMeasure (prend, pr);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = BeginPicking(prend, prend->pickstr.pseudoPM);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /* now call PickOne which does set up and calls the traverser */
+ err = PickOne(prend);
+
+ /* now do stuff same as EndPickOne */
+ SETUP_INQ(pexPickOneReply);
+
+ err = EndPickOne(prend, pPEXBuffer, &(reply->numPickElRefs),
+ &(reply->pickStatus), &(reply->betterPick));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = EndPicking(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ reply->length = LWORDS(pPEXBuffer->dataSize);
+ WritePEXBufferReply(pexPickOneReply);
+ }
+ return( err );
+} /* end-PEXPickOne() */
+
+ErrorCode
+PEXBeginPickAll( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexBeginPickAllReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddRendererStr *prend = 0;
+ pexPickRecord *pr = (pexPickRecord *)(strmPtr+1);
+ ddPickPath *sIDpp;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+ /* this is evil but necessary, use the pickid field of the
+ sIDlist to store the structure ID that corresponds to the
+ top level fake structure
+ */
+ sIDpp = (ddPickPath *)(prend->pickstr.sIDlist)->pList;
+ sIDpp->pickid = strmPtr->sid;
+
+ prend->pickstr.pick_method = strmPtr->method;
+ prend->pickstr.state = DD_PICK_ALL;
+ prend->pickstr.server = DD_CLIENT;
+ prend->pickstr.send_event = strmPtr->sendEvent;
+ prend->pickstr.max_hits = strmPtr->pickMaxHits;
+ prend->pickstr.client = cntxtPtr->client;
+
+ err = ChangePseudoPickMeasure (prend, pr);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /* This is set up to use this instead of defining a BeginPickOne */
+ err = BeginPicking(prend, prend->pickstr.pseudoPM);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+} /* end-PEXBeginPickAll() */
+
+ErrorCode
+PEXEndPickAll( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexEndPickAllReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBufferPtr pPEXBuffer;
+ ddRendererStr *prend = 0;
+
+ LU_RENDERER(strmPtr->rdr, prend);
+
+ if (prend->pickstr.state != DD_PICK_ALL)
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ SETUP_INQ(pexEndPickAllReply);
+
+ err = EndPickAll(prend, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = EndPicking(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexEndPickAllReply);
+ WritePEXBufferReply(pexEndPickAllReply);
+ }
+ return( err );
+} /* end-PEXEndPickAll() */
+
+ErrorCode
+PEXPickAll( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexPickAllReq *strmPtr;
+{
+ ErrorCode err = Success;
+ extern ddBufferPtr pPEXBuffer;
+ ddRendererStr *prend = 0;
+ pexPickRecord *pr = (pexPickRecord *)(strmPtr+1);
+
+ /* do stuff same as BeginPickAll */
+ LU_RENDERER(strmPtr->rdr, prend);
+ LU_DRAWABLE(strmPtr->drawable, prend->pDrawable);
+ prend->drawableId = strmPtr->drawable;
+
+ prend->pickstr.pick_method = strmPtr->method;
+ prend->pickstr.state = DD_PICK_ALL;
+ prend->pickstr.server = DD_SERVER;
+ prend->pickstr.max_hits = strmPtr->pickMaxHits;
+
+ err = ChangePseudoPickMeasure (prend, pr);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = BeginPicking(prend, prend->pickstr.pseudoPM);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ /* now call PickAll which does set up and calls RenderElements */
+ err = PickAll(prend);
+
+ /* now do stuff same as EndPickOne */
+ SETUP_INQ(pexPickAllReply);
+
+ err = EndPickAll(prend, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ err = EndPicking(prend);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexPickAllReply);
+
+ WritePEXBufferReply(pexPickAllReply);
+ }
+ return( err );
+} /* end-PEXPickAll() */
+
+
+/**** Renderer Pick Events ****/
+
+ErrorCode
+PEXMaxHitsReachedNotify(client, rendId)
+ClientPtr client;
+ddULONG rendId;
+{
+ pexMaxHitsReachedEvent mhre;
+
+ mhre.type = PexEventBase + PEXMaxHitsReached;
+ mhre.sequenceNumber = client->sequence;
+ mhre.rdr = rendId;
+
+ WriteEventsToClient (client, 1, (xEvent *) &mhre);
+ return(client->noClientException);
+}
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexSc.c b/xc/programs/Xserver/PEX5/dipex/objects/pexSc.c
new file mode 100644
index 000000000..96fbf800f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexSc.c
@@ -0,0 +1,567 @@
+/* $TOG: pexSc.c /main/10 1998/02/10 12:35:47 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/PEX5/dipex/objects/pexSc.c,v 3.5 1998/10/04 09:35:08 dawes Exp $ */
+
+
+/*++
+ * PEXCreateSearchContext
+ * PEXCopySearchContext
+ * PEXFreeSearchContext
+ * PEXGetSearchContext
+ * PEXChangeSearchContext
+ * PEXSearchNetwork
+ --*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "dipex.h"
+#include "PEXproto.h"
+#include "pex_site.h"
+#include "ddpex4.h"
+#include "pexLookup.h"
+#include "pexUtils.h"
+#include "pexExtract.h"
+#include "pexos.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+#define SC_NS_LIMIT 20 /* arbitrary value */
+
+#define CHK_PEX_BUF(SIZE,INCR,REPLY,TYPE,PTR) {\
+ (SIZE)+=(INCR); \
+ if (pPEXBuffer->bufSize < (SIZE)) { \
+ ErrorCode err = Success; \
+ int offset = (int)(((unsigned char *)(PTR)) - ((unsigned char *)(pPEXBuffer->pHead))); \
+ err = puBuffRealloc(pPEXBuffer,(ddULONG)(SIZE)); \
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr); \
+ (REPLY) = (TYPE *)(pPEXBuffer->pHead); \
+ (PTR) = (unsigned char *)(pPEXBuffer->pHead + offset); } \
+}
+
+static ErrorCode
+AddToNSPair( incl, excl, pair )
+diNSHandle incl, excl;
+listofNSPair *pair;
+{
+ ddNSPair *ptr;
+ if (pair->numPairs >= pair->maxPairs) {
+ pair->maxPairs += SC_NS_LIMIT;
+ pair->pPairs = (ddNSPair *)xrealloc( (pointer)(pair->pPairs),
+ (unsigned long)(pair->maxPairs
+ * sizeof(ddNSPair)));
+ if (!pair->pPairs) return(BadAlloc);
+ }
+ ptr = pair->pPairs + (unsigned long)(pair->numPairs);
+ ptr->incl = incl; ptr->excl = excl;
+ pair->numPairs++;
+
+ return( Success );
+}
+
+
+/*
+ add things to a list which has number things in it and can
+ fill in up to end before needing to molt; shoe sizes come in quanta of incr
+
+ note arrays of pointers do not point to contiguous structures
+ */
+static ErrorCode
+diAddThingToArray( thing, array, number, end, incr)
+unsigned long thing;
+unsigned long **array;
+int *number;
+unsigned long *end;
+int incr;
+{
+ int i = *number;
+ unsigned long *ptr = *array;
+
+ /* check to see if it's in the array already */
+ if ( i ) {
+ for ( ; i>0; i--, ptr++ ) if (*ptr == thing)
+ return(BadIDChoice);
+ };
+
+ if ((!array) ||
+ ((int)(*array) + *number > (int)end)) { /* need more room in array */
+ unsigned long **bigger_array;
+ bigger_array =
+ (unsigned long **)xrealloc((pointer)array,
+ (unsigned long)(sizeof(unsigned long) *
+ ((int)end - (int)*array + incr)));
+ if (!bigger_array) return(BadAlloc);
+ end += incr;
+ *array = *bigger_array;
+ };
+
+ *ptr = thing;
+ *number++;
+ return( Success );
+}
+
+static ErrorCode
+diAddThingToList( thing, list, number, end, incr)
+unsigned long thing;
+unsigned long *list;
+int *number;
+unsigned long *end;
+int incr;
+{
+ int i = *number;
+ unsigned long *ptr = list;
+
+ /* check to see if it's in the list already */
+ if ( i ) {
+ for ( ; i>0; i--, ptr++ ) if (*ptr == thing)
+ return(BadIDChoice);
+ };
+
+ if ((!list) ||
+ ((int)(list) + *number > (int)end)) { /* need more room in list */
+ unsigned long *bigger_list;
+ bigger_list =
+ (unsigned long *)xrealloc((pointer)list,
+ (unsigned long)(sizeof(unsigned long) *
+ ((int)end - (int)list + incr)));
+ if (!bigger_list) return(BadAlloc);
+ end += incr;
+ list = bigger_list;
+ };
+
+ *ptr = thing;
+ *number++;
+ return( Success );
+}
+
+
+static ErrorCode
+UpdateSearchContext (cntxtPtr, psc, itemMask, ptr)
+pexContext *cntxtPtr;
+ddSCStr *psc;
+pexBitmask itemMask;
+unsigned char *ptr;
+{
+ ErrorCode err = Success;
+
+ if (itemMask & PEXSCPosition) {
+ EXTRACT_COORD3D (&(psc->position), ptr);
+ };
+
+ if (itemMask & PEXSCDistance) {
+ EXTRACT_FLOAT (psc->distance, ptr);
+ };
+
+ if (itemMask & PEXSCCeiling) {
+ EXTRACT_CARD16_FROM_4B (psc->ceiling, ptr);
+ }
+
+ if (itemMask & PEXSCModelClipFlag) {
+ EXTRACT_CARD8_FROM_4B (psc->modelClipFlag, ptr);
+ }
+
+ if (itemMask & PEXSCStartPath) {
+ pexElementRef *per;
+ diStructHandle sh, *psh;
+ CARD32 i, numRefs = 0;
+ extern ddpex4rtn ValidateStructurePath();
+
+ EXTRACT_CARD32 (numRefs, ptr);
+ for (i=0, per = (pexElementRef *)ptr; i<numRefs; i++, per++) {
+ LU_STRUCTURE(per->structure,sh);
+ psh = (diStructHandle *)&(per->structure);
+ *psh = sh;
+ }
+ if (psc->startPath) puDeleteList(psc->startPath);
+ psc->startPath = puCreateList(DD_ELEMENT_REF);
+ if (!(psc->startPath)) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ puAddToList((ddPointer)ptr, numRefs, psc->startPath);
+ err = ValidateStructurePath(psc->startPath);
+ if (err != Success) PEX_ERR_EXIT(err,0,cntxtPtr);
+ ptr = (unsigned char *)per;
+ };
+
+ if (itemMask & PEXSCNormalList) {
+ unsigned long i, len;
+ pexNameSetPair *pnsp=0;
+ diNSHandle pi, pe;
+ EXTRACT_CARD32 (len, ptr);
+ for (i=0, pnsp = (pexNameSetPair *)ptr; i<len; i++, pnsp++) {
+ LU_NAMESET (pnsp->incl, pi);
+ LU_NAMESET (pnsp->excl, pe);
+ err = AddToNSPair(pi, pe, &(psc->normal));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ };
+
+ ptr = (unsigned char *)pnsp;
+ };
+
+ if (itemMask & PEXSCInvertedList) {
+ unsigned long i, len;
+ pexNameSetPair *pnsp=0;
+ diNSHandle pi, pe;
+ EXTRACT_CARD32 (len, ptr);
+ for (i=0, pnsp = (pexNameSetPair *)ptr; i<len; i++, pnsp++) {
+ LU_NAMESET (pnsp->incl, pi);
+ LU_NAMESET (pnsp->excl, pe);
+ err = AddToNSPair(pi, pe, &(psc->inverted));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ };
+
+ ptr = (unsigned char *)pnsp;
+ };
+
+ return( err );
+}
+
+
+/*++ PEXCreateSearchContext
+ --*/
+ErrorCode
+PEXCreateSearchContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateSearchContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode freeSearchContext();
+ ddSCStr *psc;
+ unsigned char *ptr;
+
+ if (!LegalNewID(strmPtr->sc, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->sc,cntxtPtr);
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ psc = (ddSCStr *)xalloc((unsigned long)sizeof(ddSCStr));
+ if (!psc) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ psc->id = strmPtr->sc;
+ psc->normal.numPairs=0;
+ psc->normal.maxPairs=SC_NS_LIMIT;
+ psc->normal.pPairs =
+ (ddNSPair *)xalloc(psc->normal.maxPairs * sizeof(ddNSPair));
+ psc->inverted.numPairs=0;
+ psc->inverted.maxPairs=SC_NS_LIMIT;
+ psc->inverted.pPairs =
+ (ddNSPair *)xalloc(psc->inverted.maxPairs * sizeof(ddNSPair));
+
+ psc->position.x = psc->position.y = psc->position.z = 0.0;
+ psc->distance = 0.0;
+ psc->ceiling = 1;
+ psc->modelClipFlag = xFalse;
+
+ if (strmPtr->itemMask & PEXSCStartPath)
+ psc->startPath = 0; /* list will be created in UpdateSearchContext */
+ else
+ psc->startPath = puCreateList(DD_ELEMENT_REF);
+
+ ptr = (unsigned char *) (strmPtr + 1);
+
+
+ err = UpdateSearchContext(cntxtPtr, psc, strmPtr->itemMask, ptr);
+ if (err) {
+ puDeleteList(psc->startPath);
+ xfree((pointer)psc);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ ADDRESOURCE(strmPtr->sc, PEXSearchType, psc);
+ return( err );
+
+} /* end-PEXCreateSearchContext() */
+
+/*++ PEXCopySearchContext
+ --*/
+ErrorCode
+PEXCopySearchContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopySearchContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddSCStr *src, *dst;
+
+ LU_SEARCHCONTEXT (strmPtr->src, src);
+ LU_SEARCHCONTEXT (strmPtr->dst, dst);
+
+ if (strmPtr->itemMask & PEXSCPosition) dst->position = src->position;
+
+ if (strmPtr->itemMask & PEXSCDistance) dst->distance = src->distance;
+
+ if (strmPtr->itemMask & PEXSCCeiling) dst->ceiling = src->ceiling;
+
+ if (strmPtr->itemMask & PEXSCModelClipFlag)
+ dst->modelClipFlag = src->modelClipFlag;
+
+ if (strmPtr->itemMask & PEXSCStartPath) {
+ puDeleteList (dst->startPath);
+ dst->startPath = puCreateList(DD_ELEMENT_REF);
+ if (!dst->startPath->pList) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+ puCopyList(src->startPath, dst->startPath);
+ };
+
+
+ if (strmPtr->itemMask & PEXSCNormalList) {
+ xfree((pointer)(dst->normal.pPairs));
+ dst->normal.pPairs =
+ (ddNSPair *) xalloc( (unsigned long)(src->normal.maxPairs *
+ sizeof(ddNSPair)));
+ if (! dst->normal.pPairs) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ memcpy( (char *)(dst->normal.pPairs), (char *)(src->normal.pPairs),
+ (int)(src->normal.numPairs * sizeof(ddNSPair)));
+ dst->normal.numPairs = src->normal.numPairs;
+ dst->normal.maxPairs = src->normal.maxPairs;
+ }
+
+
+ if (strmPtr->itemMask & PEXSCInvertedList) {
+ xfree((pointer)dst->inverted.pPairs);
+ dst->inverted.pPairs =
+ (ddNSPair *)xalloc((unsigned long)(src->inverted.maxPairs*
+ sizeof(ddNSPair)));
+ if (! dst->inverted.pPairs) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ memcpy( (char *)(dst->inverted.pPairs), (char *)(src->inverted.pPairs),
+ (int)(src->inverted.numPairs * sizeof(ddNSPair)));
+ dst->inverted.numPairs = src->inverted.numPairs;
+ dst->inverted.maxPairs = src->inverted.maxPairs;
+ }
+
+ return( err );
+
+} /* end-PEXCopySearchContext() */
+
+ErrorCode
+FreeSearchContext (ptr, id)
+ddSCStr *ptr;
+pexSC id;
+{
+ if (ptr->inverted.pPairs) xfree ((pointer)(ptr->inverted.pPairs));
+ if (ptr->normal.pPairs) xfree ((pointer)(ptr->normal.pPairs));
+ puDeleteList(ptr->startPath);
+
+ xfree((pointer)ptr);
+
+ return( Success );
+}
+
+/*++ PEXFreeSearchContext
+ --*/
+ErrorCode
+PEXFreeSearchContext (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreeSearchContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddSCStr *psc;
+
+ if ((strmPtr == NULL) || (strmPtr->id == 0)) {
+ err = PEX_ERROR_CODE(PEXSearchContextError);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ LU_SEARCHCONTEXT (strmPtr->id, psc);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return( err );
+
+} /* end-PEXFreeSearchContext() */
+
+/*++ PEXGetSearchContext
+ --*/
+ErrorCode
+PEXGetSearchContext( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetSearchContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddSCStr *psc;
+ extern ddBuffer *pPEXBuffer;
+ unsigned char *ptr = 0;
+ pexGetSearchContextReply *reply
+ = (pexGetSearchContextReply *)(pPEXBuffer->pHead);
+ int size = 0;
+
+ LU_SEARCHCONTEXT (strmPtr->sc, psc);
+
+ CHK_PEX_BUF(size, sizeof(pexGetSearchContextReply), reply,
+ pexGetSearchContextReply, ptr);
+ SETUP_INQ(pexGetSearchContextReply);
+ ptr = pPEXBuffer->pBuf;
+
+ if (strmPtr->itemMask & PEXSCPosition) {
+ CHK_PEX_BUF(size, sizeof(pexCoord3D), reply, pexGetSearchContextReply,
+ ptr);
+ PACK_COORD3D (&(psc->position), ptr);
+ };
+
+ if (strmPtr->itemMask & PEXSCDistance) {
+ CHK_PEX_BUF(size, sizeof(PEXFLOAT), reply, pexGetSearchContextReply, ptr);
+ PACK_FLOAT (psc->distance, ptr);
+ };
+
+ if (strmPtr->itemMask & PEXSCCeiling) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetSearchContextReply, ptr);
+ PACK_CARD32 (psc->ceiling, ptr);
+ }
+
+ if (strmPtr->itemMask & PEXSCModelClipFlag) {
+ CHK_PEX_BUF(size, sizeof(CARD32), reply, pexGetSearchContextReply, ptr);
+ PACK_CARD32 (psc->modelClipFlag, ptr);
+ }
+
+ if (strmPtr->itemMask & PEXSCStartPath) {
+ pexStructure sid = 0;
+ unsigned long i;
+ ddElementRef *per = (ddElementRef *)(psc->startPath->pList);
+
+ CHK_PEX_BUF(size,
+ psc->startPath->numObj*sizeof(pexElementRef) +sizeof(CARD32),
+ reply, pexGetSearchContextReply,ptr);
+ PACK_CARD32(psc->startPath->numObj,ptr);
+ for (i=0; i<psc->startPath->numObj; i++, per++) {
+ sid = GetId(per->structure);
+ PACK_CARD32(sid, ptr);
+ PACK_CARD32(per->offset, ptr);
+ }
+ };
+
+ if (strmPtr->itemMask & PEXSCNormalList) {
+ int i;
+ ddNSPair *src;
+ pexNameSet *dst;
+ CHK_PEX_BUF(size, psc->normal.numPairs * 2 * sizeof(pexNameSet) + 4,
+ reply, pexGetSearchContextReply, ptr);
+ PACK_CARD32(psc->normal.numPairs, ptr);
+ for (i=0, src = psc->normal.pPairs, dst = (pexNameSet *)ptr;
+ i<psc->normal.numPairs; i++, src++) {
+ *dst++ = src->incl->id;
+ *dst++ = src->excl->id; }
+ ptr = (unsigned char *)dst;
+ };
+
+ if (strmPtr->itemMask & PEXSCInvertedList) {
+ int i;
+ ddNSPair *src;
+ pexNameSet *dst;
+ CHK_PEX_BUF(size, psc->inverted.numPairs * 2 * sizeof(pexNameSet) + 4,
+ reply, pexGetSearchContextReply, ptr);
+ PACK_CARD32(psc->inverted.numPairs, ptr);
+ for (i=0, src = psc->inverted.pPairs, dst = (pexNameSet *)ptr;
+ i<psc->inverted.numPairs; i++, src++) {
+ *dst++ = src->incl->id;
+ *dst++ = src->excl->id; }
+ ptr = (unsigned char *)dst;
+ };
+
+ reply->length = size - sizeof(pexGetSearchContextReply);
+ reply->length = LWORDS(reply->length);
+ WritePEXReplyToClient( cntxtPtr, strmPtr,
+ sizeof (pexGetSearchContextReply) + sizeof(CARD32) * reply->length,
+ reply);
+
+ return( err );
+
+} /* end-PEXGetSearchContext() */
+
+/*++ PEXChangeSearchContext
+ --*/
+ErrorCode
+PEXChangeSearchContext( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangeSearchContextReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddSCStr *psc;
+ unsigned char *ptr = (unsigned char *) (strmPtr + 1);
+
+ LU_SEARCHCONTEXT (strmPtr->sc, psc);
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ err = UpdateSearchContext(cntxtPtr, psc, strmPtr->itemMask, ptr);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangeSearchContext() */
+
+/*++ PEXSearchNetwork
+ --*/
+ErrorCode
+PEXSearchNetwork( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSearchNetworkReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ddSCStr *psc;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numItems;
+
+ LU_SEARCHCONTEXT (strmPtr->id, psc);
+
+ SETUP_INQ(pexSearchNetworkReply);
+
+ err = SearchNetwork (psc, &numItems, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexSearchNetworkReply);
+ reply->numItems = numItems;
+ WritePEXBufferReply(pexSearchNetworkReply);
+ }
+ return( err );
+
+} /* end-PEXSearchNetwork() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexStr.c b/xc/programs/Xserver/PEX5/dipex/objects/pexStr.c
new file mode 100644
index 000000000..d2612bfaf
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexStr.c
@@ -0,0 +1,587 @@
+/* $TOG: pexStr.c /main/6 1998/02/10 12:35:52 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*++
+ * PEXCreateStructure
+ * PEXCopyStructure
+ * PEXDestroyStructures
+ * PEXGetStructureInfo
+ * PEXSetStructurePermission
+ * PEXGetElementInfo
+ * PEXGetStructuresInNetwork
+ * PEXGetAncestors
+ * PEXGetDescendants
+ * PEXFetchElements
+ * PEXSetEditingMode
+ * PEXSetElementPointer
+ * PEXSetElementPointerAtLabel
+ * PEXSetElementPointerAtPickID
+ * PEXElementSearch
+ * PEXStoreElements
+ * PEXDeleteElements
+ * PEXDeleteElementsToLabel
+ * PEXDeleteBetweenLabels
+ * PEXCopyElements
+ * PEXChangeStructureReferences
+ --*/
+#include "X.h"
+#include "PEX.h"
+#include "pexError.h"
+#include "pex_site.h"
+#include "pexLookup.h"
+#include "ddpex4.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+/*++ PEXCreateStructure
+ --*/
+ErrorCode
+PEXCreateStructure (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode DeleteStructure ();
+ diStructHandle sh;
+
+ if (!LegalNewID(strmPtr->id, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->id,cntxtPtr);
+
+ sh = (diStructHandle)xalloc((unsigned long)sizeof(ddStructResource));
+ if (!sh) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ sh->id = strmPtr->id;
+ err = CreateStructure(sh);
+ if (err) {
+ xfree((pointer)sh);
+ PEX_ERR_EXIT(err,0,cntxtPtr);
+ }
+
+ ADDRESOURCE(strmPtr->id, PEXStructType, sh);
+ return( err );
+
+} /* end-PEXCreateStructure() */
+
+/*++ PEXCopyStructure
+ --*/
+ErrorCode
+PEXCopyStructure (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyStructureReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle sh1, sh2;
+
+ LU_STRUCTURE (strmPtr->src, sh1);
+ LU_STRUCTURE (strmPtr->dst, sh2);
+
+ err = CopyStructure (sh1, sh2);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyStructure() */
+
+/*++ PEXDeleteStructures
+ --*/
+PEXDestroyStructures (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDestroyStructuresReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle ps = 0;
+ int i;
+ pexStructure *pid;
+
+ for ( i = 0, pid = (pexStructure *)(strmPtr+1);
+ (i < strmPtr->numStructures) && (err == Success); i++, pid++) {
+ LU_STRUCTURE(*pid, ps);
+ FreeResource (*pid, RT_NONE);
+ }
+
+ return (err);
+
+} /* end-PEXDestroyStructures() */
+
+/*++ PEXGetStructureInfo
+ --*/
+ErrorCode
+PEXGetStructureInfo( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetStructureInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexGetStructureInfoReply *reply
+ = (pexGetStructureInfoReply *)(pPEXBuffer->pHead);
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = InquireStructureInfo( strmPtr->fpFormat, pstr,
+ (ddBitmask)(strmPtr->itemMask),
+ &(reply->editMode), &(reply->elementPtr),
+ &(reply->numElements), &(reply->lengthStructure),
+ &(reply->hasRefs));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = 0;
+ WritePEXReplyToClient( cntxtPtr, strmPtr,sizeof(pexGetStructureInfoReply),
+ reply);
+ return( err );
+
+} /* end-PEXGetStructureInfo() */
+
+/*++ PEXSetStructurePermission
+ --*/
+ErrorCode
+PEXSetStructurePermission( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetStructurePermissionReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = SetStructurePermission( pstr, strmPtr->permission );
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ return( err );
+
+} /* end-PEXSetStructurePermission() */
+
+/*++ PEXGetElementInfo
+ */
+ErrorCode
+PEXGetElementInfo (cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetElementInfoReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numInfo;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexGetElementInfoReply);
+
+ err = InquireElementInfo( pstr, (ddElementRange *)&(strmPtr->range),
+ &numInfo, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetElementInfoReply);
+ reply->numInfo = numInfo;
+ WritePEXBufferReply(pexGetElementInfoReply);
+ }
+ return( err );
+
+}/* end-PEXGetElementInfo */
+
+/*++ PEXGetStructuresInNetwork
+ --*/
+ErrorCode
+PEXGetStructuresInNetwork( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetStructuresInNetworkReq *strmPtr;
+{
+ ErrorCode err = PEXNOERR;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numStructures;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexGetStructuresInNetworkReply);
+
+ err = InquireStructureNetwork( pstr, strmPtr->which, &numStructures,
+ pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetStructuresInNetworkReply);
+ reply->numStructures = numStructures;
+ WritePEXBufferReply(pexGetStructuresInNetworkReply);
+ }
+ return( err );
+
+} /* end-PEXGetStructuresInNetwork() */
+
+/*++ PEXGetAncestors
+ --*/
+ErrorCode
+PEXGetAncestors( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetAncestorsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numPaths;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexGetAncestorsReply);
+
+ err = InquireAncestors( pstr, strmPtr->pathOrder, strmPtr->pathDepth,
+ &numPaths, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetAncestorsReply);
+ reply->numPaths = numPaths;
+ WritePEXBufferReply(pexGetAncestorsReply);
+ }
+ return( err );
+
+} /* end-PEXGetAncestors() */
+
+/*++ PEXGetDescendants
+ --*/
+ErrorCode
+PEXGetDescendants( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexGetDescendantsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numPaths;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexGetDescendantsReply);
+
+ err = InquireDescendants( pstr, strmPtr->pathOrder, strmPtr->pathDepth,
+ &numPaths, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexGetDescendantsReply);
+ reply->numPaths = numPaths;
+ WritePEXBufferReply(pexGetDescendantsReply);
+ }
+ return( err );
+
+} /* end-PEXGetDescendants() */
+
+/*++ PEXFetchElements
+ --*/
+ErrorCode
+PEXFetchElements( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexFetchElementsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ CARD32 numElements;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexFetchElementsReply);
+
+ err = InquireElements (pstr, &(strmPtr->range), &numElements, pPEXBuffer);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ {
+ SETUP_VAR_REPLY(pexFetchElementsReply);
+ reply->numElements = numElements;
+ WritePEXBufferReply(pexFetchElementsReply);
+ }
+ return( err );
+
+} /* end-PEXFetchElements */
+
+/*++ PEXSetEditingMode
+ --*/
+ErrorCode
+PEXSetEditingMode( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetEditingModeReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = SetEditMode (pstr, strmPtr->mode);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetEditingMode */
+
+/*++ PEXSetElementPointer
+ --*/
+ErrorCode
+PEXSetElementPointer( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetElementPointerReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = SetElementPointer (pstr, &(strmPtr->position));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetElementPointer() */
+
+/*++ PEXSetElementPointerAtLabel
+ --*/
+ErrorCode
+PEXSetElementPointerAtLabel( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetElementPointerAtLabelReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = SetElementPointerAtLabel (pstr, strmPtr->label, strmPtr->offset);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetElementPointerAtLabel() */
+
+/*++ PEXSetElementPointerAtPickID
+ --*/
+ErrorCode
+PEXSetElementPointerAtPickID( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexSetElementPointerAtPickIDReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = SetElementPointerAtPickID (pstr, strmPtr->pickId, strmPtr->offset);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXSetElementPointerAtLabel() */
+
+/*++ PEXElementSearch
+ --*/
+ErrorCode
+PEXElementSearch( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexElementSearchReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ extern ddBuffer *pPEXBuffer;
+ pexElementSearchReply *reply =
+ (pexElementSearchReply *)(pPEXBuffer->pHead);
+ CARD16 *pincl = (CARD16 *)(strmPtr + 1);
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ SETUP_INQ(pexElementSearchReply);
+
+ err = ElementSearch( pstr, &(strmPtr->position), strmPtr->direction,
+ strmPtr->numIncls, strmPtr->numExcls, pincl,
+ pincl + strmPtr->numIncls + (strmPtr->numIncls %2),
+ &(reply->status), &(reply->foundOffset));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+
+ reply->length = 0;
+ WritePEXReplyToClient(cntxtPtr,strmPtr,sizeof(pexElementSearchReply),reply);
+ return( err );
+
+} /* end-PEXElementSearch() */
+
+/*++ PEXStoreElements
+ --*/
+ErrorCode
+PEXStoreElements( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexStoreElementsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+ int i;
+ pexElementInfo *pe = 0;
+ CARD32 *curOC;
+ pexStructure *ps;
+ diStructHandle ph;
+ pexOutputCommandError *pErr;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ for (i = 0, curOC = (CARD32 *)(strmPtr + 1);
+ i < strmPtr->numCommands;
+ i++, curOC += pe->length ) {
+ pe = (pexElementInfo *)curOC;
+ if ((PEXOCAll < pe->elementType ) && (pe->elementType <= PEXMaxOC)) {
+ if (pe->elementType == PEXOCExecuteStructure) {
+ ps = &(((pexExecuteStructure *)(pe))->id);
+ LU_STRUCTURE(*ps, ph);
+ *ps = (pexStructure)(ph);
+ }
+ }
+ }
+
+ err = StoreElements( pstr,
+ strmPtr->numCommands,(ddElementInfo *)(strmPtr+1),
+ &pErr);
+
+ if (err == BadImplementation) PEX_ERR_EXIT(err,0,cntxtPtr)
+ else if (err) PEX_OC_ERROR(pErr, cntxtPtr);
+
+ return( err );
+
+} /* end-PEXStoreElements() */
+
+/*++ PEXDeleteElements
+ --*/
+ErrorCode
+PEXDeleteElements( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexDeleteElementsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = DeleteElements( pstr, &(strmPtr->range));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXDeleteElements */
+
+/*++ PEXDeleteElementsToLabel
+ --*/
+ErrorCode
+PEXDeleteElementsToLabel( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexDeleteElementsToLabelReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = DeleteToLabel (pstr, &(strmPtr->position), strmPtr->label);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXDeleteElementsToLabel() */
+
+/*++ PEXDeleteBetweenLabels
+ --*/
+ErrorCode
+PEXDeleteBetweenLabels( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexDeleteBetweenLabelsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pstr = 0;
+
+ LU_STRUCTURE(strmPtr->sid, pstr);
+
+ err = DeleteBetweenLabels (pstr, strmPtr->label1, strmPtr->label2);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXDeleteBetweenLabels() */
+
+/*++ PEXCopyElements
+ --*/
+
+ErrorCode
+PEXCopyElements( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexCopyElementsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle ps1, ps2;
+
+ LU_STRUCTURE (strmPtr->src, ps1);
+ LU_STRUCTURE (strmPtr->dst, ps2);
+
+ err = CopyElements (ps1, &(strmPtr->srcRange), ps2, &(strmPtr->dstPosition));
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXCopyElements() */
+
+/*++ Change Structure References
+ --*/
+ErrorCode
+PEXChangeStructureRefs( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+pexChangeStructureRefsReq *strmPtr;
+{
+ ErrorCode err = Success;
+ diStructHandle pold = 0, pnew = 0;
+
+ LU_STRUCTURE(strmPtr->old_id, pold);
+ LU_STRUCTURE(strmPtr->new_id, pnew);
+
+ err = ChangeStructureReferences (pold, pnew);
+ if (err) PEX_ERR_EXIT(err,0,cntxtPtr);
+ return( err );
+
+} /* end-PEXChangeStructureRefs() */
+/*++
+ *
+ * End of File
+ *
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/objects/pexTM.c b/xc/programs/Xserver/PEX5/dipex/objects/pexTM.c
new file mode 100644
index 000000000..9ac5fde12
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/objects/pexTM.c
@@ -0,0 +1,144 @@
+/* $TOG: pexTM.c /main/3 1998/02/10 12:36:01 kaleb $ */
+/*
+
+Copyright 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+*/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "pexError.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pexLookup.h"
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+
+
+/*++ PEXCreateColorMipMapTM
+ --*/
+ErrorCode
+PEXCreateColorMipMapTM (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateColorMipMapTMReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode FreeTM (), CreateColorMipMapTM ();
+ ddPointer Texel_Array;
+ ddTextureStr *ptext = 0;
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ if (!LegalNewID(strmPtr->TMid, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->TMid,cntxtPtr);
+
+ ptext = (ddTextureStr *) Xalloc ((unsigned long)(sizeof(ddTextureStr)));
+ if (!ptext) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ ptext->rendId = strmPtr->TMid;
+
+ Texel_Array = (ddPointer *)(strmPtr + 1);
+
+ err = CreateColorMipMapTM(strmPtr->TMid, strmPtr->TMDimension,
+ strmPtr->numLevels, strmPtr->texelType, Texel_Array, ptext);
+
+ if (err) Xfree((pointer)ptext);
+ ADDRESOURCE(strmPtr->TMid, PEXTextureType, ptext);
+
+ return( err );
+
+} /* end-PEXCreateColorMipMapTM() */
+
+
+/*++ PEXCreateColorMipMapTM
+ --*/
+ErrorCode
+PEXCreateColorMipMapfromRes (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateColorMipMapfromResReq *strmPtr;
+{
+ ErrorCode err = Success;
+ ErrorCode FreeTM (), CreateColorMipMapfromRes ();
+ ddPointer Texel_Array_Counts, resource_IDs;
+ ddTextureStr *ptext = 0;
+
+ CHECK_FP_FORMAT (strmPtr->fpFormat);
+
+ if (!LegalNewID(strmPtr->TMid, cntxtPtr->client))
+ PEX_ERR_EXIT(BadIDChoice,strmPtr->TMid,cntxtPtr);
+
+ ptext = (ddTextureStr *) Xalloc ((unsigned long)(sizeof(ddTextureStr)));
+ if (!ptext) PEX_ERR_EXIT(BadAlloc,0,cntxtPtr);
+
+ ptext->rendId = strmPtr->TMid;
+
+ Texel_Array_Counts = (ddPointer *)(strmPtr + 1);
+ if (strmPtr->TMDimension == TMDimension3D)
+ /* if dimension is 3D Texel_Array_Counts are each 8 bytes long
+ and there are numLevels of them */
+ resource_IDs = (ddPointer *)(strmPtr + (strmPtr->numLevels*8));
+ else
+ /* Texel_Array_Counts are each 4 bytes long, still numLevels of them */
+ resource_IDs = (ddPointer *)(strmPtr + (strmPtr->numLevels*4));
+
+ /* leave it to the ddpex layer to decipher the color and alpha
+ resource IDs lists after it processes the Texel_Array_Counts */
+ err = CreateColorMipMapfromRes(strmPtr->TMid, strmPtr->TMDimension,
+ strmPtr->numLevels, strmPtr->texelType, strmPtr->drawable,
+ Texel_Array_Counts, resource_IDs, ptext);
+
+ if (err) Xfree((pointer)ptext);
+ ADDRESOURCE(strmPtr->TMid, PEXTextureType, ptext);
+
+ return( err );
+
+} /* end-PEXCreateColorMipMapfromRes() */
+
+/*++ PEXFreeTM
+ --*/
+ErrorCode
+PEXFreeTM (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFreeTMReq *strmPtr;
+{
+ ErrorCode err = Success;
+
+ LU_NAMESET(strmPtr->id, pns);
+
+ FreeResource(strmPtr->id, RT_NONE);
+
+ return(err);
+
+} /* end-PEXFreeTM() */
+
+/*++
+ *
+ * End of File
+ --*/
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/ConvName.ci b/xc/programs/Xserver/PEX5/dipex/swap/ConvName.ci
new file mode 100644
index 000000000..90b7d2a39
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/ConvName.ci
@@ -0,0 +1,51 @@
+/* $TOG: ConvName.ci /main/3 1998/02/10 14:00:03 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "ConvName.h"
+#include SWAP_FILE
+
+#undef SWAP_FUNC_PREFIX
+#undef SWAP_FUNC_PEX_PFX
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/ConvName.h b/xc/programs/Xserver/PEX5/dipex/swap/ConvName.h
new file mode 100644
index 000000000..5eeaa727b
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/ConvName.h
@@ -0,0 +1,52 @@
+/* $TOG: ConvName.h /main/5 1998/02/10 12:36:05 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define SWAP_FUNC_PREFIX(nm) c##nm
+#define SWAP_FUNC_PEX_PFX(nm) cPEX##nm
+#else
+#define SWAP_FUNC_PREFIX(nm) c/**/nm
+#define SWAP_FUNC_PEX_PFX(nm) cPEX/**/nm
+#endif
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/Convert.c b/xc/programs/Xserver/PEX5/dipex/swap/Convert.c
new file mode 100644
index 000000000..732cc5e2c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/Convert.c
@@ -0,0 +1,133 @@
+/* $TOG: Convert.c /main/6 1998/02/10 12:36:09 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "pex_site.h"
+#include "dipex.h"
+
+
+extern void SwapIEEEToVax();
+extern void SwapVaxToIEEE();
+extern void ConvertIEEEToVax();
+extern void ConvertVaxToIEEE();
+
+unsigned char temp; /* only used for conversions */
+
+
+/* Byte swap a long */
+void
+SwapCARD32(i)
+CARD32 *i;
+{
+ CARD8 n;
+ CARD8 *x = (CARD8 *)i;
+
+ n = x[0];
+ x[0] = x[3];
+ x[3] = n;
+ n = x[1];
+ x[1] = x[2];
+ x[2] = n;
+
+ return;
+}
+
+/* Byte swap a short */
+void
+SwapCARD16(i)
+CARD16 *i;
+{
+ CARD8 n;
+ CARD8 *x = (CARD8 *)i;
+
+ n = x[0];
+ x[0] = x[1];
+ x[1] = n;
+
+ return;
+}
+
+
+/* Byte swap and convert a float */
+void
+SwapIEEEToVax(f)
+PEXFLOAT *f;
+{
+
+ SwapCARD32((CARD32 *) f);
+
+ ConvertIEEEToVax((PEXFLOAT *)(f));
+
+}
+
+
+void
+SwapVaxToIEEE(f)
+PEXFLOAT *f;
+{
+ SwapCARD32((CARD32 *) f);
+
+ ConvertVaxToIEEE((PEXFLOAT *)(f));
+
+}
+
+
+/* Byte swap a float */
+void
+SwapFLOAT (f)
+PEXFLOAT *f;
+{
+ CARD8 n;
+ CARD8 *x = (CARD8 *)f;
+
+ n = x[0];
+ x[0] = x[3];
+ x[3] = n;
+ n = x[1];
+ x[1] = x[2];
+ x[2] = n;
+
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/Imakefile b/xc/programs/Xserver/PEX5/dipex/swap/Imakefile
new file mode 100644
index 000000000..8a819d35c
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/Imakefile
@@ -0,0 +1,69 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/13 1996/09/28 16:55:03 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/dipex/swap/Imakefile,v 3.9 1999/04/17 09:08:19 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PassCDebugFlags
+#define PassCDebugFlags
+#endif
+
+#ifndef PexDipexCDebugFlags
+#define PexDipexCDebugFlags ServerCDebugFlags
+#endif
+
+ CDEBUGFLAGS = PexDipexCDebugFlags
+ DEFINES = PexDipexDefines
+
+ LINTLIBS = ../../../dix/llib-ldix.ln \
+ ../../../os/llib-los.ln \
+ ../objects/llib-lobj.ln
+
+ PEXSRVINC = ../../include
+ INCLUDES = -I. -I$(PEXSRVINC) -I$(XINCLUDESRC) -I$(SERVERSRC)/include
+
+
+SRCS = convUtil.c cOCprim.c uOCprim.c floatconv.c check.c \
+ OCattr.c OCcolour.c convReq.c uconvRep.c Convert.c \
+ OCTables.c ReqTables.c RepTables.c convEv.c
+
+OBJS = convUtil.o cOCprim.o uOCprim.o floatconv.o check.o \
+ OCattr.o OCcolour.o convReq.o uconvRep.o Convert.o \
+ OCTables.o ReqTables.o RepTables.o convEv.o
+
+
+PEX_SW_LIBNAME = libdiswapex.a
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(diswapex,$(OBJS))
+
+LintLibraryTarget(dsw,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCTables.c b/xc/programs/Xserver/PEX5/dipex/swap/OCTables.c
new file mode 100644
index 000000000..26449b9ee
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCTables.c
@@ -0,0 +1,64 @@
+/* $TOG: OCTables.c /main/3 1998/02/10 12:36:13 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ Contains Output Commands for PEX
+ */
+
+#include "X.h"
+#include "PEXproto.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "dipex.h"
+#include "pexSwap.h"
+
+#define LOCAL_FLAG extern
+
+/* Swap Convert Functions for OC's in Store Elements or Render OC */
+#include "cOCTables.ci"
+
+/* Unswap Unconvert Functions for OC's in replies (Fetch Elements) */
+#include "uOCTables.ci"
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCattr.c b/xc/programs/Xserver/PEX5/dipex/swap/OCattr.c
new file mode 100644
index 000000000..be4a8d6cd
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCattr.c
@@ -0,0 +1,768 @@
+/* $TOG: OCattr.c /main/8 1998/02/10 12:36:17 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "pexError.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "ddpex.h"
+#include "pexLookup.h"
+#include "convertStr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG
+#include "OCattr.h"
+
+/*****************************************************************
+ * Output Commands
+ *****************************************************************/
+
+/*
+ OC Conversion routines do not chain to another routine, so that these
+ conversions may also be used for FetchElements and StoreElements, as
+ well as RenderOC;
+ */
+
+ErrorCode
+SwapPEXMarkerType (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarkerType *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->markerType);
+
+}
+
+ErrorCode
+SwapPEXMarkerScale (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarkerScale *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->scale);
+
+}
+
+ErrorCode
+SwapPEXMarkerColourIndex (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarkerColourIndex *strmPtr;
+{
+ SWAP_TABLE_INDEX (strmPtr->index);
+
+}
+
+ErrorCode
+SwapPEXMarkerBundleIndex (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarkerBundleIndex *strmPtr;
+{
+ SWAP_TABLE_INDEX (strmPtr->index);
+
+}
+
+/*
+typedef pexMarkerColourIndex pexTextColourIndex;
+typedef pexMarkerColourIndex pexSurfaceEdgeColourIndex;
+typedef pexMarkerBundleIndex pexTextFontIndex;
+typedef pexMarkerBundleIndex pexTextBundleIndex;
+typedef pexMarkerBundleIndex pexLineBundleIndex;
+typedef pexMarkerBundleIndex pexInteriorStyleIndex;
+typedef pexMarkerBundleIndex pexBfInteriorStyleIndex;
+typedef pexMarkerBundleIndex pexInteriorBundleIndex;
+typedef pexMarkerBundleIndex pexEdgeBundleIndex;
+typedef pexMarkerBundleIndex pexViewIndex;
+typedef pexMarkerBundleIndex pexDepthCueIndex;
+*/
+
+ErrorCode
+SwapPEXAtextStyle (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAtextStyle *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->style);
+
+}
+
+ErrorCode
+SwapPEXTextPrecision (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexTextPrecision *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->precision);
+
+}
+
+ErrorCode
+SwapPEXCharExpansion (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCharExpansion *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->expansion);
+
+}
+
+ErrorCode
+SwapPEXCharSpacing (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCharSpacing *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->spacing);
+
+}
+
+ErrorCode
+SwapPEXCharHeight (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCharHeight *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->height);
+
+}
+
+/* typedef pexCharHeight pexAtextHeight;*/
+
+ErrorCode
+SwapPEXCharUpVector (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCharUpVector *strmPtr;
+{
+ SWAP_VECTOR2D (strmPtr->up);
+
+}
+
+/* typedef pexCharUpVector pexAtextUpVector; */
+
+ErrorCode
+SwapPEXTextPath (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexTextPath *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->path);
+
+}
+
+/* typedef pexTextPath pexAtextPath;*/
+
+ErrorCode
+SwapPEXTextAlignment (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexTextAlignment *strmPtr;
+{
+ SWAP_TEXT_ALIGN_DATA (strmPtr->alignment);
+
+}
+
+/* typedef pexTextAlignment pexAtextAlignment;*/
+
+ErrorCode
+SwapPEXLineType (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLineType *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->lineType);
+
+}
+
+ErrorCode
+SwapPEXLineWidth (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLineWidth *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->width);
+
+}
+
+ErrorCode
+SwapPEXLineColourIndex (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLineColourIndex *strmPtr;
+{
+ SWAP_TABLE_INDEX (strmPtr->index);
+
+}
+
+ErrorCode
+SwapPEXCurveApproximation (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCurveApproximation *strmPtr;
+{
+
+ SWAP_CURVE_APPROX (strmPtr->approx);
+
+}
+
+ErrorCode
+SwapPEXPolylineInterp (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolylineInterp *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->polylineInterp);
+
+}
+
+ErrorCode
+SwapPEXInteriorStyle (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexInteriorStyle *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->interiorStyle);
+
+}
+
+/* typedef pexInteriorStyle pexBfInteriorStyle;*/
+
+ErrorCode
+SwapPEXSurfaceColourIndex (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceColourIndex *strmPtr;
+{
+ SWAP_TABLE_INDEX (strmPtr->index);
+
+}
+
+/* typedef pexSurfaceColourIndex pexBfSurfaceColourIndex;*/
+/* typedef pexSurfaceColour pexBfSurfaceColour;*/
+
+ErrorCode
+SwapPEXSurfaceReflModel (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceReflModel *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->reflectionModel);
+
+}
+
+
+/* typedef pexSurfaceReflModel pexBfSurfaceReflModel;*/
+
+ErrorCode
+SwapPEXSurfaceInterp (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceInterp *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->surfaceInterp);
+
+}
+
+
+/* typedef pexSurfaceInterp pexBfSurfaceInterp;*/
+
+ErrorCode
+SwapPEXSurfaceApproximation (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceApproximation *strmPtr;
+{
+
+ SwapSurfaceApprox (swapPtr, &(strmPtr->approx));
+}
+
+ErrorCode
+SwapPEXCullingMode (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCullingMode *strmPtr;
+{
+ SWAP_CULL_MODE (strmPtr->cullMode);
+
+}
+
+ErrorCode
+SwapPEXDistinguishFlag (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexDistinguishFlag *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->distinguish);
+
+}
+
+ErrorCode
+SwapPEXPatternSize (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPatternSize *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->size);
+
+}
+
+ErrorCode
+SwapPEXPatternRefPt (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPatternRefPt *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->point);
+
+}
+
+ErrorCode
+SwapPEXPatternAttr (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPatternAttr *strmPtr;
+{
+ SWAP_COORD3D (strmPtr->refPt);
+ SWAP_VECTOR3D (strmPtr->vector1);
+ SWAP_VECTOR3D (strmPtr->vector2);
+
+}
+
+ErrorCode
+SwapPEXSurfaceEdgeFlag (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceEdgeFlag *strmPtr;
+{
+
+}
+
+ErrorCode
+SwapPEXSurfaceEdgeType (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceEdgeType *strmPtr;
+{
+ SWAP_ENUM_TYPE_INDEX (strmPtr->edgeType);
+
+}
+
+ErrorCode
+SwapPEXSurfaceEdgeWidth (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceEdgeWidth *strmPtr;
+{
+ SWAP_FLOAT (strmPtr->width);
+
+}
+
+ErrorCode
+SwapPEXSetAsfValues (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSetAsfValues *strmPtr;
+{
+ SWAP_ASF_ATTR (strmPtr->attribute);
+
+}
+
+ErrorCode
+SwapPEXLocalTransform (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLocalTransform *strmPtr;
+{
+ SWAP_COMPOSITION (strmPtr->compType);
+ SWAP_MATRIX (strmPtr->matrix);
+
+}
+
+ErrorCode
+SwapPEXLocalTransform2D (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLocalTransform2D *strmPtr;
+{
+ SWAP_COMPOSITION (strmPtr->compType);
+ SWAP_MATRIX_3X3 (strmPtr->matrix3X3);
+
+}
+
+ErrorCode
+SwapPEXGlobalTransform (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGlobalTransform *strmPtr;
+{
+ SWAP_MATRIX (strmPtr->matrix);
+
+}
+
+ErrorCode
+SwapPEXGlobalTransform2D (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGlobalTransform2D *strmPtr;
+{
+ SWAP_MATRIX_3X3 (strmPtr->matrix3X3);
+
+}
+
+ErrorCode
+SwapPEXModelClip (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexModelClip *strmPtr;
+{
+
+}
+
+ErrorCode
+SwapPEXRestoreModelClip (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexRestoreModelClip *strmPtr;
+{
+
+}
+
+
+ErrorCode
+SwapPEXPickId (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPickId *strmPtr;
+{
+ SWAP_CARD32 (strmPtr->pickId);
+
+}
+
+ErrorCode
+SwapPEXHlhsrIdentifier (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexHlhsrIdentifier *strmPtr;
+{
+ SWAP_CARD32 (strmPtr->hlhsrID);
+
+}
+
+
+ErrorCode
+SwapPEXExecuteStructure (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExecuteStructure *strmPtr;
+{
+ SWAP_STRUCTURE (strmPtr->id);
+
+}
+
+ErrorCode
+SwapPEXLabel (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLabel *strmPtr;
+{
+ SWAP_CARD32 (strmPtr->label);
+
+}
+
+ErrorCode
+SwapPEXApplicationData (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexApplicationData *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->numElements);
+
+}
+
+ ErrorCode
+SwapPEXGse (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGse *strmPtr;
+{
+ SWAP_CARD32 (strmPtr->id);
+ SWAP_CARD16 (strmPtr->numElements);
+
+}
+
+ErrorCode
+SwapPEXRenderingColourModel (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexRenderingColourModel *strmPtr;
+{
+ SWAP_INT16(strmPtr->model);
+}
+
+ErrorCode
+SwapPEXOCUnused (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexElementInfo *strmPtr;
+{
+}
+
+
+/*****************************************************************
+ * utilities *
+ *****************************************************************/
+
+unsigned char *
+SwapCoord4DList(swapPtr, ptr, num)
+pexSwap *swapPtr;
+pexCoord4D *ptr;
+CARD32 num;
+{
+ pexCoord4D *pc;
+ int i;
+ for (i=0, pc = (pexCoord4D *)ptr; i<num; i++, pc++)
+ SWAP_COORD4D ((*pc));
+ return (unsigned char *) pc;
+}
+
+unsigned char *
+SwapCoord3DList(swapPtr, ptr, num)
+pexSwap *swapPtr;
+pexCoord3D *ptr;
+CARD32 num;
+{
+ pexCoord3D *pc;
+ int i;
+ for (i=0, pc = ptr; i<num; i++, pc++)
+ SWAP_COORD3D ((*pc));
+ return (unsigned char *) pc;
+}
+
+unsigned char *
+SwapCoord2DList(swapPtr, ptr, num)
+pexSwap *swapPtr;
+pexCoord2D *ptr;
+CARD32 num;
+{
+ pexCoord2D *pc;
+ int i;
+ for (i=0, pc = (pexCoord2D *)ptr; i<num; i++, pc++)
+ SWAP_COORD2D ((*pc));
+ return (unsigned char *) pc;
+}
+
+unsigned char *
+SwapColour(swapPtr, pc, form)
+pexSwap *swapPtr;
+pexColour *pc;
+pexEnumTypeIndex form;
+{
+ unsigned char *ptr = (unsigned char *)pc;
+
+ switch (form) {
+
+ case PEXIndexedColour: { SWAP_INDEXED_COLOUR (pc->format.indexed);
+ ptr += sizeof(pexIndexedColour);
+ break; }
+
+ case PEXRgbFloatColour: {SWAP_RGB_FLOAT_COLOUR(pc->format.rgbFloat);
+ ptr += sizeof(pexRgbFloatColour);
+ break; }
+
+ case PEXCieFloatColour: {SWAP_CIE_COLOUR(pc->format.cieFloat);
+ ptr += sizeof(pexCieColour);
+ break; }
+
+ case PEXHsvFloatColour: {SWAP_HSV_COLOUR(pc->format.hsvFloat);
+ ptr += sizeof(pexHsvColour);
+ break; }
+
+ case PEXHlsFloatColour: {SWAP_HLS_COLOUR(pc->format.hlsFloat);
+ ptr += sizeof(pexHlsColour);
+ break; }
+
+ case PEXRgb16Colour: {SWAP_RGB16_COLOUR(pc->format.rgb16);
+ ptr += sizeof(pexRgb16Colour);
+ break; }
+ case PEXRgb8Colour: {ptr += sizeof(pexRgb8Colour);
+ break; }
+
+ }
+ return(ptr);
+}
+
+
+
+void
+SwapHalfSpace(swapPtr, ph)
+pexSwap *swapPtr;
+pexHalfSpace *ph;
+{
+ SWAP_COORD3D (ph->point);
+ SWAP_VECTOR3D (ph->vector);
+}
+
+void
+SwapHalfSpace2D(swapPtr, ph)
+pexSwap *swapPtr;
+pexHalfSpace2D *ph;
+{
+ SWAP_COORD2D (ph->point);
+ SWAP_VECTOR2D (ph->vector);
+}
+
+unsigned char *
+SwapOptData(swapPtr, po, vertexAttribs, colourType)
+pexSwap *swapPtr;
+unsigned char *po;
+pexBitmaskShort vertexAttribs;
+pexColourType colourType;
+{
+ if (vertexAttribs & PEXGAColour) {
+ switch (colourType) {
+
+ case PEXIndexedColour: {
+ pexIndexedColour *pc = (pexIndexedColour *)po;
+ SWAP_INDEXED_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXRgbFloatColour: {
+ pexRgbFloatColour *pc = (pexRgbFloatColour *)po;
+ SWAP_RGB_FLOAT_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXCieFloatColour: {
+ pexCieColour *pc = (pexCieColour *)po;
+ SWAP_CIE_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXHsvFloatColour: {
+ pexHsvColour *pc = (pexHsvColour *)po;
+ SWAP_HSV_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXHlsFloatColour: {
+ pexHlsColour *pc = (pexHlsColour *)po;
+ SWAP_HLS_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXRgb8Colour: {
+ pexRgb8Colour *pc = (pexRgb8Colour *)po;
+ po = (unsigned char *)(pc+1); break; }
+
+ case PEXRgb16Colour: {
+ pexRgb16Colour *pc = (pexRgb16Colour *)po;
+ SWAP_RGB16_COLOUR((*pc));
+ po = (unsigned char *)(pc+1); break; }
+
+ }
+ };
+
+ if (vertexAttribs & PEXGANormal) {
+ pexCoord3D *pn = (pexCoord3D *)po;
+ SWAP_VECTOR3D((*pn));
+ po = (unsigned char *)(pn+1);
+ };
+
+ if (vertexAttribs & PEXGAEdges) {
+ CARD16 *pe = (CARD16 *)po;
+ SWAP_CARD16((*pe));
+ po = (unsigned char *)(pe+2); /* padding too */
+ };
+
+ return (po);
+}
+
+
+unsigned char *
+SwapVertex(swapPtr, pv, vertexAttribs, colourType)
+pexSwap *swapPtr;
+pexVertex *pv;
+pexBitmaskShort vertexAttribs;
+pexColourType colourType;
+{
+ CARD8 *ptr;
+ SWAP_COORD3D ((pv->point));
+
+ ptr = SwapOptData( swapPtr, (unsigned char *)(pv+1), vertexAttribs,
+ colourType);
+ return (ptr);
+
+}
+
+void
+SwapTextAlignmentData(swapPtr, ptr)
+pexSwap *swapPtr;
+pexTextAlignmentData *ptr;
+{
+ SWAP_TEXT_V_ALIGNMENT (ptr->vertical);
+ SWAP_TEXT_H_ALIGNMENT (ptr->horizontal);
+}
+
+
+SwapIndexedColourList(swapPtr, ptr, num)
+pexSwap *swapPtr;
+pexIndexedColour *ptr;
+CARD32 num;
+{
+ int i;
+ for (i=0; i<(num); i++, ptr++){
+ SWAP_INDEXED_COLOUR((*ptr));
+ }
+}
+
+SwapRgbFloatColourList(swapPtr, ptr, num)
+pexSwap *swapPtr;
+pexRgbFloatColour *ptr;
+CARD32 num;
+{
+ int i;
+ pexRgbFloatColour *pc = ptr;
+ for (i=0; i<(num); i++, pc++){
+ SWAP_RGB_FLOAT_COLOUR((*pc));
+ }
+}
+
+
+void
+SwapSurfaceApprox(swapPtr, ptr)
+pexSwap *swapPtr;
+pexSurfaceApprox *ptr;
+{
+ SWAP_ENUM_TYPE_INDEX (ptr->approxMethod);
+ SWAP_FLOAT (ptr->uTolerance);
+ SWAP_FLOAT (ptr->vTolerance);
+}
+
+
+unsigned char *
+SwapTrimCurve(swapPtr, pTC)
+pexSwap *swapPtr;
+pexTrimCurve *pTC;
+{
+ int i;
+ pexCoord3D *pc;
+ PEXFLOAT *pf = 0;
+ unsigned char *ptr = 0;
+ SWAP_CARD16 (pTC->order);
+ SWAP_INT16 (pTC->approxMethod);
+ SWAP_FLOAT (pTC->tolerance);
+ SWAP_FLOAT (pTC->tMin);
+ SWAP_FLOAT (pTC->tMax);
+
+ /* curveType, numKnots and numCoord are swapped by the calling routines */
+
+ for (i=0, pf = (PEXFLOAT *)(pTC+1); i<pTC->numKnots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ ptr = (unsigned char *)pf;
+ if (pTC->type == PEXRational)
+ ptr = SwapCoord3DList(swapPtr, (pexCoord3D *)ptr, pTC->numCoord);
+ else
+ ptr = SwapCoord2DList(swapPtr, (pexCoord2D *)ptr, pTC->numCoord);
+
+ return ptr;
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCattr.h b/xc/programs/Xserver/PEX5/dipex/swap/OCattr.h
new file mode 100644
index 000000000..92f831a0f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCattr.h
@@ -0,0 +1,104 @@
+/* $TOG: OCattr.h /main/4 1998/02/10 12:36:22 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+LOCAL_FLAG ErrorCode
+ SwapPEXMarkerType (),
+ SwapPEXMarkerScale (),
+ SwapPEXMarkerColourIndex (),
+ SwapPEXMarkerBundleIndex (),
+ SwapPEXAtextStyle (),
+ SwapPEXTextPrecision (),
+ SwapPEXCharExpansion (),
+ SwapPEXCharSpacing (),
+ SwapPEXCharHeight (),
+ SwapPEXCharUpVector (),
+ SwapPEXTextPath (),
+ SwapPEXTextAlignment (),
+ SwapPEXLineType (),
+ SwapPEXLineWidth (),
+ SwapPEXLineColourIndex (),
+ SwapPEXCurveApproximation (),
+ SwapPEXPolylineInterp (),
+ SwapPEXInteriorStyle (),
+ SwapPEXSurfaceColourIndex (),
+ SwapPEXSurfaceReflModel (),
+ SwapPEXSurfaceInterp (),
+ SwapPEXSurfaceApproximation (),
+ SwapPEXCullingMode (),
+ SwapPEXDistinguishFlag (),
+ SwapPEXPatternSize (),
+ SwapPEXPatternRefPt (),
+ SwapPEXPatternAttr (),
+ SwapPEXSurfaceEdgeFlag (),
+ SwapPEXSurfaceEdgeType (),
+ SwapPEXSurfaceEdgeWidth (),
+ SwapPEXSetAsfValues (),
+ SwapPEXLocalTransform (),
+ SwapPEXLocalTransform2D (),
+ SwapPEXGlobalTransform (),
+ SwapPEXGlobalTransform2D (),
+ SwapPEXModelClip (),
+ SwapPEXRestoreModelClip (),
+ SwapPEXPickId (),
+ SwapPEXHlhsrIdentifier (),
+ SwapPEXExecuteStructure (),
+ SwapPEXLabel (),
+ SwapPEXApplicationData (),
+ SwapPEXGse (),
+ SwapPEXRenderingColourModel (),
+ SwapPEXOCUnused ();
+
+LOCAL_FLAG unsigned char * SwapCoord4DList ();
+LOCAL_FLAG unsigned char * SwapCoord3DList ();
+LOCAL_FLAG unsigned char * SwapCoord2DList ();
+LOCAL_FLAG unsigned char * SwapColour ();
+LOCAL_FLAG unsigned char * SwapOptData();
+LOCAL_FLAG unsigned char * SwapVertex();
+LOCAL_FLAG unsigned char * SwapTrimCurve();
+
+LOCAL_FLAG void
+ SwapSurfaceApprox(),
+ SwapHalfSpace (),
+ SwapHalfSpace2D ();
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.c b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.c
new file mode 100644
index 000000000..0c3207cff
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.c
@@ -0,0 +1,75 @@
+/* $TOG: OCcolour.c /main/3 1998/02/10 12:36:26 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ Swapping and float conversion routines.
+
+ Variations on a theme by CITI.
+ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "convertStr.h"
+
+/*
+ colour OCs for Requests
+ */
+#define SWAP_FILE "OCcolour.ci"
+#include "ConvName.ci"
+#undef SWAP_FILE
+
+/*
+ colour OCs for Replies
+ */
+#define SWAP_FILE "OCcolour.ci"
+#include "UconvName.ci"
+#undef SWAP_FILE
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.ci b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.ci
new file mode 100644
index 000000000..c8b31b976
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.ci
@@ -0,0 +1,74 @@
+/* $TOG: OCcolour.ci /main/4 1998/02/10 14:00:09 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG extern
+#include "OCprim.h"
+#undef LOCAL_FLAG
+#define LOCAL_FLAG
+#include "OCcolour.h"
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(MarkerColour) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarkerColour *strmPtr;
+{
+
+ SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr, &(strmPtr->colourSpec));
+}
+
+
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(SurfaceReflAttr) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSurfaceReflAttr *strmPtr;
+{
+
+ SWAP_FUNC_PREFIX(SwapReflectionAttr) (swapPtr, &(strmPtr->reflectionAttr));
+
+}
+
+/* typedef pexSurfaceReflAttr pexBfSurfaceReflAttr;*/
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.h b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.h
new file mode 100644
index 000000000..c4c9f71bc
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCcolour.h
@@ -0,0 +1,50 @@
+/* $TOG: OCcolour.h /main/3 1998/02/10 12:36:30 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+LOCAL_FLAG ErrorCode
+ SWAP_FUNC_PEX_PFX(MarkerColour) (),
+ SWAP_FUNC_PEX_PFX(SurfaceReflAttr) ();
+
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/OCprim.h b/xc/programs/Xserver/PEX5/dipex/swap/OCprim.h
new file mode 100644
index 000000000..0d1e5de41
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/OCprim.h
@@ -0,0 +1,83 @@
+/* $TOG: OCprim.h /main/5 1998/02/10 12:36:34 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapFacet) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapColourSpecifier) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapReflectionAttr) ();
+
+LOCAL_FLAG void
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) ();
+
+LOCAL_FLAG ErrorCode
+ SWAP_FUNC_PREFIX(PEXModelClipVolume) (),
+ SWAP_FUNC_PREFIX(PEXModelClipVolume2D) (),
+ SWAP_FUNC_PREFIX(PEXLightState) (),
+ SWAP_FUNC_PREFIX(PEXAddToNameSet) (),
+ SWAP_FUNC_PREFIX(PEXMarker) (),
+ SWAP_FUNC_PREFIX(PEXMarker2D) (),
+ SWAP_FUNC_PREFIX(PEXPolyline) (),
+ SWAP_FUNC_PREFIX(PEXPolyline2D) (),
+ SWAP_FUNC_PREFIX(PEXPolylineSet) (),
+ SWAP_FUNC_PREFIX(PEXNurbCurve) (),
+ SWAP_FUNC_PREFIX(PEXFillArea) (),
+ SWAP_FUNC_PREFIX(PEXFillArea2D) (),
+ SWAP_FUNC_PREFIX(PEXExtFillArea) (),
+ SWAP_FUNC_PREFIX(PEXFillAreaSet) (),
+ SWAP_FUNC_PREFIX(PEXFillAreaSet2D) (),
+ SWAP_FUNC_PREFIX(PEXExtFillAreaSet) (),
+ SWAP_FUNC_PREFIX(PEXTriangleStrip) (),
+ SWAP_FUNC_PREFIX(PEXQuadrilateralMesh) (),
+ SWAP_FUNC_PREFIX(PEXSOFAS) (),
+ SWAP_FUNC_PREFIX(PEXNurbSurface) (),
+ SWAP_FUNC_PREFIX(PEXCellArray) (),
+ SWAP_FUNC_PREFIX(PEXCellArray2D) (),
+ SWAP_FUNC_PREFIX(PEXExtCellArray) (),
+ SWAP_FUNC_PREFIX(PEXGdp) (),
+ SWAP_FUNC_PREFIX(PEXGdp2D) (),
+ SWAP_FUNC_PEX_PFX(Text) (),
+ SWAP_FUNC_PEX_PFX(Text2D) (),
+ SWAP_FUNC_PEX_PFX(AnnotationText) (),
+ SWAP_FUNC_PEX_PFX(AnnotationText2D) (),
+ SWAP_FUNC_PEX_PFX(ParaSurfCharacteristics) (),
+ SWAP_FUNC_PREFIX(PEXNoop) ();
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/RepTables.c b/xc/programs/Xserver/PEX5/dipex/swap/RepTables.c
new file mode 100644
index 000000000..d9615a5be
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/RepTables.c
@@ -0,0 +1,63 @@
+/* $TOG: RepTables.c /main/3 1998/02/10 12:36:40 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ Contains tables of Replies for PEX
+ */
+
+#include "X.h"
+#include "PEXproto.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "dipex.h"
+#include "pexSwap.h"
+
+#define LOCAL_FLAG extern
+
+/* Reply Swap Functions */
+#define SWAP_FILE "Replies.ci"
+#include "UconvName.ci"
+#undef SWAP_FILE
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/Replies.ci b/xc/programs/Xserver/PEX5/dipex/swap/Replies.ci
new file mode 100644
index 000000000..f0424e2a5
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/Replies.ci
@@ -0,0 +1,158 @@
+/* $TOG: Replies.ci /main/5 1998/02/10 14:00:14 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ Contains tables of replies for PEX
+ */
+
+#define LOCAL_FLAG extern
+#include "uconvRep.h"
+
+ReplyFunction SWAP_FUNC_PREFIX(PEXReply)[] = {
+/* 0 */ SWAP_FUNC_PREFIX(NoReply), /*RequestUnused*/
+/* 1 */ SWAP_FUNC_PREFIX(ConvertGetExtensionInfoReply),
+/* 2 */ SWAP_FUNC_PREFIX(ConvertGetEnumeratedTypeInfoReply),
+/* 3 */ SWAP_FUNC_PREFIX(ConvertGetImpDepConstantsReply),
+/* 4 */ SWAP_FUNC_PREFIX(NoReply), /*CreateLookupTable*/
+/* 5 */ SWAP_FUNC_PREFIX(NoReply), /*CopyLookupTable*/
+/* 6 */ SWAP_FUNC_PREFIX(NoReply), /*FreeLookupTable*/
+/* 7 */ SWAP_FUNC_PREFIX(ConvertGetTableInfoReply),
+/* 8 */ SWAP_FUNC_PREFIX(ConvertGetPredefinedEntriesReply),
+/* 9 */ SWAP_FUNC_PREFIX(ConvertGetDefinedIndicesReply),
+/* 10 */ SWAP_FUNC_PREFIX(ConvertGetTableEntryReply),
+/* 11 */ SWAP_FUNC_PREFIX(ConvertGetTableEntriesReply),
+/* 12 */ SWAP_FUNC_PREFIX(NoReply), /*SetTableEntries*/
+/* 13 */ SWAP_FUNC_PREFIX(NoReply), /*DeleteTableEntries*/
+/* 14 */ SWAP_FUNC_PREFIX(NoReply), /*CreatePipelineContext*/
+/* 15 */ SWAP_FUNC_PREFIX(NoReply), /*CopyPipelineContext*/
+/* 16 */ SWAP_FUNC_PREFIX(NoReply), /*FreePipelineContext*/
+/* 17 */ SWAP_FUNC_PREFIX(ConvertGetPipelineContextReply),
+/* 18 */ SWAP_FUNC_PREFIX(NoReply), /*ChangePipelineContext*/
+/* 19 */ SWAP_FUNC_PREFIX(NoReply), /*CreateRenderer*/
+/* 20 */ SWAP_FUNC_PREFIX(NoReply), /*FreeRenderer*/
+/* 21 */ SWAP_FUNC_PREFIX(NoReply), /*ChangeRenderer*/
+/* 22 */ SWAP_FUNC_PREFIX(ConvertGetRendererAttributesReply),
+/* 23 */ SWAP_FUNC_PREFIX(ConvertGetRendererDynamicsReply),
+/* 24 */ SWAP_FUNC_PREFIX(NoReply), /*BeginRendering*/
+/* 25 */ SWAP_FUNC_PREFIX(NoReply), /*EndRendering*/
+/* 26 */ SWAP_FUNC_PREFIX(NoReply), /*BeginStructure*/
+/* 27 */ SWAP_FUNC_PREFIX(NoReply), /*EndStructure*/
+/* 28 */ SWAP_FUNC_PREFIX(NoReply), /*RenderOutputCommands*/
+/* 29 */ SWAP_FUNC_PREFIX(NoReply), /*RenderNetwork*/
+/* 30 */ SWAP_FUNC_PREFIX(NoReply), /*CreateStructure*/
+/* 31 */ SWAP_FUNC_PREFIX(NoReply), /*CopyStructure*/
+/* 32 */ SWAP_FUNC_PREFIX(NoReply), /*DestroyStructures*/
+/* 33 */ SWAP_FUNC_PREFIX(ConvertGetStructureInfoReply),
+/* 34 */ SWAP_FUNC_PREFIX(ConvertGetElementInfoReply),
+/* 35 */ SWAP_FUNC_PREFIX(ConvertGetStructuresInNetworkReply),
+/* 36 */ SWAP_FUNC_PREFIX(ConvertGetAncestorsReply),
+/* 37 */ SWAP_FUNC_PREFIX(ConvertGetAncestorsReply),/*GetDescendants*/
+/* 38 */ SWAP_FUNC_PREFIX(ConvertFetchElementsReply),
+/* 39 */ SWAP_FUNC_PREFIX(NoReply), /*SetEditingMode*/
+/* 40 */ SWAP_FUNC_PREFIX(NoReply), /*SetElementPointer*/
+/* 41 */ SWAP_FUNC_PREFIX(NoReply), /*SetElementPointerAtLabel*/
+/* 42 */ SWAP_FUNC_PREFIX(ConvertElementSearchReply),
+/* 43 */ SWAP_FUNC_PREFIX(NoReply), /*StoreElements*/
+/* 44 */ SWAP_FUNC_PREFIX(NoReply), /*DeleteElements*/
+/* 45 */ SWAP_FUNC_PREFIX(NoReply), /*DeleteElementsToLabel*/
+/* 46 */ SWAP_FUNC_PREFIX(NoReply), /*DeleteElementsBetweenLabels*/
+/* 47 */ SWAP_FUNC_PREFIX(NoReply), /*CopyElements*/
+/* 48 */ SWAP_FUNC_PREFIX(NoReply), /*ChangeStructureRefs*/
+/* 49 */ SWAP_FUNC_PREFIX(NoReply), /*CreateNameSet*/
+/* 50 */ SWAP_FUNC_PREFIX(NoReply), /*CopyNameSet*/
+/* 51 */ SWAP_FUNC_PREFIX(NoReply), /*FreeNameSet*/
+/* 52 */ SWAP_FUNC_PREFIX(ConvertGetNameSetReply),
+/* 53 */ SWAP_FUNC_PREFIX(NoReply), /*ChangeNameSet*/
+/* 54 */ SWAP_FUNC_PREFIX(NoReply), /*CreateSearchContext*/
+/* 55 */ SWAP_FUNC_PREFIX(NoReply), /*CopySearchContext*/
+/* 56 */ SWAP_FUNC_PREFIX(NoReply), /*FreeSearchContext*/
+/* 57 */ SWAP_FUNC_PREFIX(ConvertGetSearchContextReply),
+/* 58 */ SWAP_FUNC_PREFIX(NoReply), /*ChangeSearchContext*/
+/* 59 */ SWAP_FUNC_PREFIX(ConvertSearchNetworkReply),
+/* 60 */ SWAP_FUNC_PREFIX(NoReply), /*CreatePhigsWks*/
+/* 61 */ SWAP_FUNC_PREFIX(NoReply), /*FreePhigsWks*/
+/* 62 */ SWAP_FUNC_PREFIX(ConvertGetWksInfoReply),
+/* 63 */ SWAP_FUNC_PREFIX(ConvertGetDynamicsReply),
+/* 64 */ SWAP_FUNC_PREFIX(ConvertGetViewRepReply),
+/* 65 */ SWAP_FUNC_PREFIX(NoReply), /*RedrawAllStructures*/
+/* 66 */ SWAP_FUNC_PREFIX(NoReply), /*UpdateWorkstation*/
+/* 67 */ SWAP_FUNC_PREFIX(NoReply), /*RedrawClipRegion*/
+/* 68 */ SWAP_FUNC_PREFIX(NoReply), /*ExecuteDeferredActions*/
+/* 69 */ SWAP_FUNC_PREFIX(NoReply), /*SetViewPriority*/
+/* 70 */ SWAP_FUNC_PREFIX(NoReply), /*SetDisplayUpdateMode*/
+/* 71 */ SWAP_FUNC_PREFIX(ConvertMapDCtoWCReply),
+/* 72 */ SWAP_FUNC_PREFIX(ConvertMapWCtoDCReply),
+/* 73 */ SWAP_FUNC_PREFIX(NoReply), /*SetViewRep*/
+/* 74 */ SWAP_FUNC_PREFIX(NoReply), /*SetWksWindow*/
+/* 75 */ SWAP_FUNC_PREFIX(NoReply), /*SetWksViewport*/
+/* 76 */ SWAP_FUNC_PREFIX(NoReply), /*SetHlhsrMode*/
+/* 77 */ SWAP_FUNC_PREFIX(NoReply), /*SetWksBufferMode*/
+/* 78 */ SWAP_FUNC_PREFIX(NoReply), /*PostStructure*/
+/* 79 */ SWAP_FUNC_PREFIX(NoReply), /*UnpostStructure*/
+/* 80 */ SWAP_FUNC_PREFIX(NoReply), /*UnpostAllStructures*/
+/* 81 */ SWAP_FUNC_PREFIX(ConvertGetWksPostingsReply),
+/* 82 */ SWAP_FUNC_PREFIX(ConvertGetPickDeviceReply),
+/* 83 */ SWAP_FUNC_PREFIX(NoReply), /*ChangePickDevice*/
+/* 84 */ SWAP_FUNC_PREFIX(NoReply), /*CreatePickMeasure*/
+/* 85 */ SWAP_FUNC_PREFIX(NoReply), /*FreePickMeasure*/
+/* 86 */ SWAP_FUNC_PREFIX(ConvertGetPickMeasureReply),
+/* 87 */ SWAP_FUNC_PREFIX(NoReply), /*UpdatePickMeasure*/
+/* 88 */ SWAP_FUNC_PREFIX(NoReply), /*OpenFont*/
+/* 89 */ SWAP_FUNC_PREFIX(NoReply), /*CloseFont*/
+/* 90 */ SWAP_FUNC_PREFIX(ConvertQueryFontReply),
+/* 91 */ SWAP_FUNC_PREFIX(ConvertListFontsReply),
+/* 92 */ SWAP_FUNC_PREFIX(ConvertListFontsWithInfoReply),
+/* 93 */ SWAP_FUNC_PREFIX(ConvertQueryTextExtentsReply),
+/* 94 */ SWAP_FUNC_PREFIX(ConvertMatchRendererTargetsReply),
+/* 95 */ SWAP_FUNC_PREFIX(NoReply), /*Escape*/
+/* 96 */ SWAP_FUNC_PREFIX(EscapeWithReplyReply), /*EscapeWithReply*/
+/* 97 */ SWAP_FUNC_PREFIX(NoReply), /*RenderElements*/
+/* 98 */ SWAP_FUNC_PREFIX(NoReply), /*AccumulateState*/
+/* 99 */ SWAP_FUNC_PREFIX(NoReply), /*BeginPickOne*/
+/* 100 */ SWAP_FUNC_PREFIX(ConvertEndPickOneReply),
+/* 101 */ SWAP_FUNC_PREFIX(ConvertPickOneReply),
+/* 102 */ SWAP_FUNC_PREFIX(NoReply), /*BeginPickAll*/
+/* 103 */ SWAP_FUNC_PREFIX(ConvertEndPickAllReply),
+/* 104 */ SWAP_FUNC_PREFIX(ConvertPickAllReply)
+};
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/ReqTables.c b/xc/programs/Xserver/PEX5/dipex/swap/ReqTables.c
new file mode 100644
index 000000000..299058256
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/ReqTables.c
@@ -0,0 +1,66 @@
+/* $TOG: ReqTables.c /main/3 1998/02/10 12:36:46 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ Contains tables of Requests for PEX
+ */
+
+#include "X.h"
+#include "PEXproto.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "dipex.h"
+#include "pexSwap.h"
+
+#define LOCAL_FLAG extern
+
+/* Not-swapped Requests */
+#include "Requests.h"
+
+/* Request Swap Functions */
+#define SWAP_FILE "Requests.ci"
+#include "ConvName.ci"
+#undef SWAP_FILE
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/Requests.ci b/xc/programs/Xserver/PEX5/dipex/swap/Requests.ci
new file mode 100644
index 000000000..377e68a9a
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/Requests.ci
@@ -0,0 +1,155 @@
+/* $TOG: Requests.ci /main/7 1998/02/10 14:00:21 kaleb $ */
+
+/******************************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include "convReq.h"
+
+RequestFunction SWAP_FUNC_PREFIX(PEXRequest)[] = {
+/* 0 */ SWAP_FUNC_PREFIX(PEXRequestUnused),
+/* 1 */ SWAP_FUNC_PREFIX(PEXGetExtensionInfo),
+/* 2 */ SWAP_FUNC_PREFIX(PEXGetEnumeratedTypeInfo),
+/* 3 */ SWAP_FUNC_PREFIX(PEXGetImpDepConstants),
+/* 4 */ SWAP_FUNC_PREFIX(PEXCreateLookupTable),
+/* 5 */ SWAP_FUNC_PREFIX(PEXCopyLookupTable),
+/* 6 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreeLookupTable*/
+/* 7 */ SWAP_FUNC_PREFIX(PEXGetTableInfo),
+/* 8 */ SWAP_FUNC_PREFIX(PEXGetPredefinedEntries),
+/* 9 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*GetDefinedIndices*/
+/* 10 */ SWAP_FUNC_PREFIX(PEXGetTableEntry),
+/* 11 */ SWAP_FUNC_PREFIX(PEXGetTableEntries),
+/* 12 */ SWAP_FUNC_PREFIX(PEXSetTableEntries),
+/* 13 */ SWAP_FUNC_PREFIX(PEXDeleteTableEntries),
+/* 14 */ SWAP_FUNC_PREFIX(PEXCreatePipelineContext),
+/* 15 */ SWAP_FUNC_PREFIX(PEXCopyPipelineContext),
+/* 16 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreePipelineContext*/
+/* 17 */ SWAP_FUNC_PREFIX(PEXGetPipelineContext),
+/* 18 */ SWAP_FUNC_PREFIX(PEXChangePipelineContext),
+/* 19 */ SWAP_FUNC_PREFIX(PEXCreateRenderer),
+/* 20 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreeRenderer*/
+/* 21 */ SWAP_FUNC_PREFIX(PEXChangeRenderer),
+/* 22 */ SWAP_FUNC_PREFIX(PEXGetRendererAttributes),
+/* 23 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*GetRendererDynamics*/
+/* 24 */ SWAP_FUNC_PREFIX(PEXBeginRendering),
+/* 25 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*EndRendering*/
+/* 26 */ SWAP_FUNC_PREFIX(PEXBeginStructure),
+/* 27 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*EndStructure*/
+/* 28 */ SWAP_FUNC_PREFIX(PEXRenderOutputCommands),
+/* 29 */ SWAP_FUNC_PREFIX(PEXRenderNetwork),
+/* 30 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*CreateStructure*/
+/* 31 */ SWAP_FUNC_PREFIX(PEXCopyStructure),
+/* 32 */ SWAP_FUNC_PREFIX(PEXDestroyStructures),
+/* 33 */ SWAP_FUNC_PREFIX(PEXGetStructureInfo),
+/* 34 */ SWAP_FUNC_PREFIX(PEXGetElementInfo),
+/* 35 */ SWAP_FUNC_PREFIX(PEXGetStructuresInNetwork),
+/* 36 */ SWAP_FUNC_PREFIX(PEXGetAncestors),
+/* 37 */ SWAP_FUNC_PREFIX(PEXGetAncestors), /*GetDescendants*/
+/* 38 */ SWAP_FUNC_PREFIX(PEXFetchElements),
+/* 39 */ SWAP_FUNC_PREFIX(PEXSetEditingMode),
+/* 40 */ SWAP_FUNC_PREFIX(PEXSetElementPointer),
+/* 41 */ SWAP_FUNC_PREFIX(PEXSetElementPointerAtLabel),
+/* 42 */ SWAP_FUNC_PREFIX(PEXElementSearch),
+/* 43 */ SWAP_FUNC_PREFIX(PEXStoreElements),
+/* 44 */ SWAP_FUNC_PREFIX(PEXDeleteElements),
+/* 45 */ SWAP_FUNC_PREFIX(PEXDeleteElementsToLabel),
+/* 46 */ SWAP_FUNC_PREFIX(PEXDeleteBetweenLabels),
+/* 47 */ SWAP_FUNC_PREFIX(PEXCopyElements),
+/* 48 */ SWAP_FUNC_PREFIX(PEXChangeStructureRefs),
+/* 49 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*CreateNameSet*/
+/* 50 */ SWAP_FUNC_PREFIX(PEXCopyNameSet),
+/* 51 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreeNameSet*/
+/* 52 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*GetNameSet*/
+/* 53 */ SWAP_FUNC_PREFIX(PEXChangeNameSet),
+/* 54 */ SWAP_FUNC_PREFIX(PEXCreateSearchContext),
+/* 55 */ SWAP_FUNC_PREFIX(PEXCopySearchContext),
+/* 56 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreeSearchContext*/
+/* 57 */ SWAP_FUNC_PREFIX(PEXGetSearchContext),
+/* 58 */ SWAP_FUNC_PREFIX(PEXChangeSearchContext),
+/* 59 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*SearchNetwork*/
+/* 60 */ SWAP_FUNC_PREFIX(PEXCreatePhigsWks),
+/* 61 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreePhigsWks*/
+/* 62 */ SWAP_FUNC_PREFIX(PEXGetWksInfo),
+/* 63 */ SWAP_FUNC_PREFIX(PEXGetDynamics),
+/* 64 */ SWAP_FUNC_PREFIX(PEXGetViewRep),
+/* 65 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*RedrawAllStructures*/
+/* 66 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*UpdateWorkstation*/
+/* 67 */ SWAP_FUNC_PREFIX(PEXRedrawClipRegion),
+/* 68 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*ExecuteDeferredActions*/
+/* 69 */ SWAP_FUNC_PREFIX(PEXSetViewPriority),
+/* 70 */ SWAP_FUNC_PREFIX(PEXSetDisplayUpdateMode),
+/* 71 */ SWAP_FUNC_PREFIX(PEXMapDCtoWC),
+/* 72 */ SWAP_FUNC_PREFIX(PEXMapWCtoDC),
+/* 73 */ SWAP_FUNC_PREFIX(PEXSetViewRep),
+/* 74 */ SWAP_FUNC_PREFIX(PEXSetWksWindow),
+/* 75 */ SWAP_FUNC_PREFIX(PEXSetWksViewport),
+/* 76 */ SWAP_FUNC_PREFIX(PEXSetHlhsrMode),
+/* 77 */ SWAP_FUNC_PREFIX(PEXSetWksBufferMode),
+/* 78 */ SWAP_FUNC_PREFIX(PEXPostStructure),
+/* 79 */ SWAP_FUNC_PREFIX(PEXUnpostStructure),
+/* 80 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*UnpostAllStructures*/
+/* 81 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*GetWksPostings*/
+/* 82 */ SWAP_FUNC_PREFIX(PEXGetPickDevice),
+/* 83 */ SWAP_FUNC_PREFIX(PEXChangePickDevice),
+/* 84 */ SWAP_FUNC_PREFIX(PEXCreatePickMeasure),
+/* 85 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*FreePickMeasure*/
+/* 86 */ SWAP_FUNC_PREFIX(PEXGetPickMeasure),
+/* 87 */ SWAP_FUNC_PREFIX(PEXUpdatePickMeasure),
+/* 88 */ SWAP_FUNC_PREFIX(PEXOpenFont),
+/* 89 */ SWAP_FUNC_PREFIX(PEXGenericResourceRequest), /*CloseFont*/
+/* 90 */ SWAP_FUNC_PREFIX(PEXQueryFont),
+/* 91 */ SWAP_FUNC_PREFIX(PEXListFonts),
+/* 92 */ SWAP_FUNC_PREFIX(PEXListFontsWithInfo),
+/* 93 */ SWAP_FUNC_PREFIX(PEXQueryTextExtents),
+/* 94 */ SWAP_FUNC_PREFIX(PEXMatchRendererTargets),
+/* 95 */ SWAP_FUNC_PREFIX(PEXEscape),
+/* 96 */ SWAP_FUNC_PREFIX(PEXEscapeWithReply),
+/* 97 */ SWAP_FUNC_PREFIX(PEXRenderElements),
+/* 98 */ SWAP_FUNC_PREFIX(PEXAccumulateState),
+/* 99 */ SWAP_FUNC_PREFIX(PEXBeginPickOne),
+/* 100 */ SWAP_FUNC_PREFIX(PEXEndPickOne),
+/* 101 */ SWAP_FUNC_PREFIX(PEXPickOne),
+/* 102 */ SWAP_FUNC_PREFIX(PEXBeginPickAll),
+/* 103 */ SWAP_FUNC_PREFIX(PEXEndPickAll),
+/* 104 */ SWAP_FUNC_PREFIX(PEXPickAll)
+};
+
+#undef SWAP_FUNC_PREFIX
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/Requests.h b/xc/programs/Xserver/PEX5/dipex/swap/Requests.h
new file mode 100644
index 000000000..88364863d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/Requests.h
@@ -0,0 +1,265 @@
+/* $TOG: Requests.h /main/5 1998/02/10 12:36:50 kaleb $ */
+
+/******************************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef SWAP_FUNC_PREFIX
+#undef SWAP_FUNC_PREFIX
+#endif
+#define SWAP_FUNC_PREFIX(nm) nm
+
+LOCAL_FLAG ErrorCode
+ SWAP_FUNC_PREFIX(PEXRequestUnused) (),
+ SWAP_FUNC_PREFIX(PEXGetExtensionInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetEnumeratedTypeInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetImpDepConstants) (),
+ SWAP_FUNC_PREFIX(PEXCreateLookupTable) (),
+ SWAP_FUNC_PREFIX(PEXCopyLookupTable) (),
+ SWAP_FUNC_PREFIX(PEXFreeLookupTable) (),
+ SWAP_FUNC_PREFIX(PEXGetTableInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetPredefinedEntries) (),
+ SWAP_FUNC_PREFIX(PEXGetDefinedIndices) (),
+ SWAP_FUNC_PREFIX(PEXGetTableEntry) (),
+ SWAP_FUNC_PREFIX(PEXGetTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXSetTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXDeleteTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXCreatePipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXCopyPipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXFreePipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXGetPipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXChangePipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXCreateRenderer) (),
+ SWAP_FUNC_PREFIX(PEXFreeRenderer) (),
+ SWAP_FUNC_PREFIX(PEXChangeRenderer) (),
+ SWAP_FUNC_PREFIX(PEXGetRendererAttributes) (),
+ SWAP_FUNC_PREFIX(PEXGetRendererDynamics) (),
+ SWAP_FUNC_PREFIX(PEXBeginRendering) (),
+ SWAP_FUNC_PREFIX(PEXEndRendering) (),
+ SWAP_FUNC_PREFIX(PEXBeginStructure) (),
+ SWAP_FUNC_PREFIX(PEXEndStructure) (),
+ SWAP_FUNC_PREFIX(PEXRenderOutputCommands) (),
+ SWAP_FUNC_PREFIX(PEXRenderNetwork) (),
+ SWAP_FUNC_PREFIX(PEXCreateStructure) (),
+ SWAP_FUNC_PREFIX(PEXCopyStructure) (),
+ SWAP_FUNC_PREFIX(PEXDestroyStructures) (),
+ SWAP_FUNC_PREFIX(PEXGetStructureInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetElementInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetStructuresInNetwork) (),
+ SWAP_FUNC_PREFIX(PEXGetAncestors) (),
+ SWAP_FUNC_PREFIX(PEXGetDescendants) (),
+ SWAP_FUNC_PREFIX(PEXFetchElements) (),
+ SWAP_FUNC_PREFIX(PEXSetEditingMode) (),
+ SWAP_FUNC_PREFIX(PEXSetElementPointer) (),
+ SWAP_FUNC_PREFIX(PEXSetElementPointerAtLabel) (),
+ SWAP_FUNC_PREFIX(PEXElementSearch) (),
+ SWAP_FUNC_PREFIX(PEXStoreElements) (),
+ SWAP_FUNC_PREFIX(PEXDeleteElements) (),
+ SWAP_FUNC_PREFIX(PEXDeleteElementsToLabel) (),
+ SWAP_FUNC_PREFIX(PEXDeleteBetweenLabels) (),
+ SWAP_FUNC_PREFIX(PEXCopyElements) (),
+ SWAP_FUNC_PREFIX(PEXChangeStructureRefs) (),
+ SWAP_FUNC_PREFIX(PEXCreateNameSet) (),
+ SWAP_FUNC_PREFIX(PEXCopyNameSet) (),
+ SWAP_FUNC_PREFIX(PEXFreeNameSet) (),
+ SWAP_FUNC_PREFIX(PEXGetNameSet) (),
+ SWAP_FUNC_PREFIX(PEXChangeNameSet) (),
+ SWAP_FUNC_PREFIX(PEXCreateSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXCopySearchContext) (),
+ SWAP_FUNC_PREFIX(PEXFreeSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXGetSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXChangeSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXSearchNetwork) (),
+ SWAP_FUNC_PREFIX(PEXCreatePhigsWks) (),
+ SWAP_FUNC_PREFIX(PEXFreePhigsWks) (),
+ SWAP_FUNC_PREFIX(PEXGetWksInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetDynamics) (),
+ SWAP_FUNC_PREFIX(PEXGetViewRep) (),
+ SWAP_FUNC_PREFIX(PEXRedrawAllStructures) (),
+ SWAP_FUNC_PREFIX(PEXUpdateWorkstation) (),
+ SWAP_FUNC_PREFIX(PEXRedrawClipRegion) (),
+ SWAP_FUNC_PREFIX(PEXExecuteDeferredActions) (),
+ SWAP_FUNC_PREFIX(PEXSetViewPriority) (),
+ SWAP_FUNC_PREFIX(PEXSetDisplayUpdateMode) (),
+ SWAP_FUNC_PREFIX(PEXMapDCtoWC) (),
+ SWAP_FUNC_PREFIX(PEXMapWCtoDC) (),
+ SWAP_FUNC_PREFIX(PEXSetViewRep) (),
+ SWAP_FUNC_PREFIX(PEXSetWksWindow) (),
+ SWAP_FUNC_PREFIX(PEXSetWksViewport) (),
+ SWAP_FUNC_PREFIX(PEXSetHlhsrMode) (),
+ SWAP_FUNC_PREFIX(PEXSetWksBufferMode) (),
+ SWAP_FUNC_PREFIX(PEXPostStructure) (),
+ SWAP_FUNC_PREFIX(PEXUnpostStructure) (),
+ SWAP_FUNC_PREFIX(PEXUnpostAllStructures) (),
+ SWAP_FUNC_PREFIX(PEXGetWksPostings) (),
+ SWAP_FUNC_PREFIX(PEXGetPickDevice) (),
+ SWAP_FUNC_PREFIX(PEXChangePickDevice) (),
+ SWAP_FUNC_PREFIX(PEXCreatePickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXFreePickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXGetPickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXUpdatePickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXOpenFont) (),
+ SWAP_FUNC_PREFIX(PEXCloseFont) (),
+ SWAP_FUNC_PREFIX(PEXQueryFont) (),
+ SWAP_FUNC_PREFIX(PEXListFonts) (),
+ SWAP_FUNC_PREFIX(PEXListFontsWithInfo) (),
+ SWAP_FUNC_PREFIX(PEXQueryTextExtents) (),
+ SWAP_FUNC_PREFIX(PEXMatchRendererTargets) (),
+ SWAP_FUNC_PREFIX(PEXEscape) (),
+ SWAP_FUNC_PREFIX(PEXEscapeWithReply) (),
+ SWAP_FUNC_PREFIX(PEXRenderElements) (),
+ SWAP_FUNC_PREFIX(PEXAccumulateState) (),
+ SWAP_FUNC_PREFIX(PEXBeginPickOne) (),
+ SWAP_FUNC_PREFIX(PEXEndPickOne) (),
+ SWAP_FUNC_PREFIX(PEXPickOne) (),
+ SWAP_FUNC_PREFIX(PEXBeginPickAll) (),
+ SWAP_FUNC_PREFIX(PEXEndPickAll) (),
+ SWAP_FUNC_PREFIX(PEXPickAll) ();
+
+RequestFunction SWAP_FUNC_PREFIX(PEXRequest)[] = {
+/* 0 */ SWAP_FUNC_PREFIX(PEXRequestUnused),
+/* 1 */ SWAP_FUNC_PREFIX(PEXGetExtensionInfo),
+/* 2 */ SWAP_FUNC_PREFIX(PEXGetEnumeratedTypeInfo),
+/* 3 */ SWAP_FUNC_PREFIX(PEXGetImpDepConstants),
+/* 4 */ SWAP_FUNC_PREFIX(PEXCreateLookupTable),
+/* 5 */ SWAP_FUNC_PREFIX(PEXCopyLookupTable),
+/* 6 */ SWAP_FUNC_PREFIX(PEXFreeLookupTable),
+/* 7 */ SWAP_FUNC_PREFIX(PEXGetTableInfo),
+/* 8 */ SWAP_FUNC_PREFIX(PEXGetPredefinedEntries),
+/* 9 */ SWAP_FUNC_PREFIX(PEXGetDefinedIndices),
+/* 10 */ SWAP_FUNC_PREFIX(PEXGetTableEntry),
+/* 11 */ SWAP_FUNC_PREFIX(PEXGetTableEntries),
+/* 12 */ SWAP_FUNC_PREFIX(PEXSetTableEntries),
+/* 13 */ SWAP_FUNC_PREFIX(PEXDeleteTableEntries),
+/* 14 */ SWAP_FUNC_PREFIX(PEXCreatePipelineContext),
+/* 15 */ SWAP_FUNC_PREFIX(PEXCopyPipelineContext),
+/* 16 */ SWAP_FUNC_PREFIX(PEXFreePipelineContext),
+/* 17 */ SWAP_FUNC_PREFIX(PEXGetPipelineContext),
+/* 18 */ SWAP_FUNC_PREFIX(PEXChangePipelineContext),
+/* 19 */ SWAP_FUNC_PREFIX(PEXCreateRenderer),
+/* 20 */ SWAP_FUNC_PREFIX(PEXFreeRenderer),
+/* 21 */ SWAP_FUNC_PREFIX(PEXChangeRenderer),
+/* 22 */ SWAP_FUNC_PREFIX(PEXGetRendererAttributes),
+/* 23 */ SWAP_FUNC_PREFIX(PEXGetRendererDynamics),
+/* 24 */ SWAP_FUNC_PREFIX(PEXBeginRendering),
+/* 25 */ SWAP_FUNC_PREFIX(PEXEndRendering),
+/* 26 */ SWAP_FUNC_PREFIX(PEXBeginStructure),
+/* 27 */ SWAP_FUNC_PREFIX(PEXEndStructure),
+/* 28 */ SWAP_FUNC_PREFIX(PEXRenderOutputCommands),
+/* 29 */ SWAP_FUNC_PREFIX(PEXRenderNetwork),
+/* 30 */ SWAP_FUNC_PREFIX(PEXCreateStructure),
+/* 31 */ SWAP_FUNC_PREFIX(PEXCopyStructure),
+/* 32 */ SWAP_FUNC_PREFIX(PEXDestroyStructures),
+/* 33 */ SWAP_FUNC_PREFIX(PEXGetStructureInfo),
+/* 34 */ SWAP_FUNC_PREFIX(PEXGetElementInfo),
+/* 35 */ SWAP_FUNC_PREFIX(PEXGetStructuresInNetwork),
+/* 36 */ SWAP_FUNC_PREFIX(PEXGetAncestors),
+/* 37 */ SWAP_FUNC_PREFIX(PEXGetDescendants),
+/* 38 */ SWAP_FUNC_PREFIX(PEXFetchElements),
+/* 39 */ SWAP_FUNC_PREFIX(PEXSetEditingMode),
+/* 40 */ SWAP_FUNC_PREFIX(PEXSetElementPointer),
+/* 41 */ SWAP_FUNC_PREFIX(PEXSetElementPointerAtLabel),
+/* 42 */ SWAP_FUNC_PREFIX(PEXElementSearch),
+/* 43 */ SWAP_FUNC_PREFIX(PEXStoreElements),
+/* 44 */ SWAP_FUNC_PREFIX(PEXDeleteElements),
+/* 45 */ SWAP_FUNC_PREFIX(PEXDeleteElementsToLabel),
+/* 46 */ SWAP_FUNC_PREFIX(PEXDeleteBetweenLabels),
+/* 47 */ SWAP_FUNC_PREFIX(PEXCopyElements),
+/* 48 */ SWAP_FUNC_PREFIX(PEXChangeStructureRefs),
+/* 49 */ SWAP_FUNC_PREFIX(PEXCreateNameSet),
+/* 50 */ SWAP_FUNC_PREFIX(PEXCopyNameSet),
+/* 51 */ SWAP_FUNC_PREFIX(PEXFreeNameSet),
+/* 52 */ SWAP_FUNC_PREFIX(PEXGetNameSet),
+/* 53 */ SWAP_FUNC_PREFIX(PEXChangeNameSet),
+/* 54 */ SWAP_FUNC_PREFIX(PEXCreateSearchContext),
+/* 55 */ SWAP_FUNC_PREFIX(PEXCopySearchContext),
+/* 56 */ SWAP_FUNC_PREFIX(PEXFreeSearchContext),
+/* 57 */ SWAP_FUNC_PREFIX(PEXGetSearchContext),
+/* 58 */ SWAP_FUNC_PREFIX(PEXChangeSearchContext),
+/* 59 */ SWAP_FUNC_PREFIX(PEXSearchNetwork),
+/* 60 */ SWAP_FUNC_PREFIX(PEXCreatePhigsWks),
+/* 61 */ SWAP_FUNC_PREFIX(PEXFreePhigsWks),
+/* 62 */ SWAP_FUNC_PREFIX(PEXGetWksInfo),
+/* 63 */ SWAP_FUNC_PREFIX(PEXGetDynamics),
+/* 64 */ SWAP_FUNC_PREFIX(PEXGetViewRep),
+/* 65 */ SWAP_FUNC_PREFIX(PEXRedrawAllStructures),
+/* 66 */ SWAP_FUNC_PREFIX(PEXUpdateWorkstation),
+/* 67 */ SWAP_FUNC_PREFIX(PEXRedrawClipRegion),
+/* 68 */ SWAP_FUNC_PREFIX(PEXExecuteDeferredActions),
+/* 69 */ SWAP_FUNC_PREFIX(PEXSetViewPriority),
+/* 70 */ SWAP_FUNC_PREFIX(PEXSetDisplayUpdateMode),
+/* 71 */ SWAP_FUNC_PREFIX(PEXMapDCtoWC),
+/* 72 */ SWAP_FUNC_PREFIX(PEXMapWCtoDC),
+/* 73 */ SWAP_FUNC_PREFIX(PEXSetViewRep),
+/* 74 */ SWAP_FUNC_PREFIX(PEXSetWksWindow),
+/* 75 */ SWAP_FUNC_PREFIX(PEXSetWksViewport),
+/* 76 */ SWAP_FUNC_PREFIX(PEXSetHlhsrMode),
+/* 77 */ SWAP_FUNC_PREFIX(PEXSetWksBufferMode),
+/* 78 */ SWAP_FUNC_PREFIX(PEXPostStructure),
+/* 79 */ SWAP_FUNC_PREFIX(PEXUnpostStructure),
+/* 80 */ SWAP_FUNC_PREFIX(PEXUnpostAllStructures),
+/* 81 */ SWAP_FUNC_PREFIX(PEXGetWksPostings),
+/* 82 */ SWAP_FUNC_PREFIX(PEXGetPickDevice),
+/* 83 */ SWAP_FUNC_PREFIX(PEXChangePickDevice),
+/* 84 */ SWAP_FUNC_PREFIX(PEXCreatePickMeasure),
+/* 85 */ SWAP_FUNC_PREFIX(PEXFreePickMeasure),
+/* 86 */ SWAP_FUNC_PREFIX(PEXGetPickMeasure),
+/* 87 */ SWAP_FUNC_PREFIX(PEXUpdatePickMeasure),
+/* 88 */ SWAP_FUNC_PREFIX(PEXOpenFont),
+/* 89 */ SWAP_FUNC_PREFIX(PEXCloseFont),
+/* 90 */ SWAP_FUNC_PREFIX(PEXQueryFont),
+/* 91 */ SWAP_FUNC_PREFIX(PEXListFonts),
+/* 92 */ SWAP_FUNC_PREFIX(PEXListFontsWithInfo),
+/* 93 */ SWAP_FUNC_PREFIX(PEXQueryTextExtents),
+/* 94 */ SWAP_FUNC_PREFIX(PEXMatchRendererTargets),
+/* 95 */ SWAP_FUNC_PREFIX(PEXEscape),
+/* 96 */ SWAP_FUNC_PREFIX(PEXEscapeWithReply),
+/* 97 */ SWAP_FUNC_PREFIX(PEXRenderElements),
+/* 98 */ SWAP_FUNC_PREFIX(PEXAccumulateState),
+/* 99 */ SWAP_FUNC_PREFIX(PEXBeginPickOne),
+/* 100 */ SWAP_FUNC_PREFIX(PEXEndPickOne),
+/* 101 */ SWAP_FUNC_PREFIX(PEXPickOne),
+/* 102 */ SWAP_FUNC_PREFIX(PEXBeginPickAll),
+/* 103 */ SWAP_FUNC_PREFIX(PEXEndPickAll),
+/* 104 */ SWAP_FUNC_PREFIX(PEXPickAll)
+};
+
+#undef SWAP_FUNC_PREFIX
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/SwapConv.h b/xc/programs/Xserver/PEX5/dipex/swap/SwapConv.h
new file mode 100644
index 000000000..5077ded84
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/SwapConv.h
@@ -0,0 +1,54 @@
+/* $TOG: SwapConv.h /main/4 1998/02/10 12:36:54 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef SWAPCONV_H
+#define SWAPCONV_H 1
+
+#define SWAPINT(A) if (swapPtr->ConvertCARD32) swapPtr->ConvertCARD32(&(A))
+
+#define SWAPSHORT(A) if (swapPtr->ConvertCARD16) swapPtr->ConvertCARD16(&(A))
+
+#define SWAPFLOAT(A) if (swapPtr->ConvertFLOAT) swapPtr->ConvertFLOAT(&(A))
+
+#endif /* SWAPCONV_H */
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/UconvName.ci b/xc/programs/Xserver/PEX5/dipex/swap/UconvName.ci
new file mode 100644
index 000000000..91c0dae83
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/UconvName.ci
@@ -0,0 +1,49 @@
+/* $TOG: UconvName.ci /main/3 1998/02/10 14:00:28 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "UconvName.h"
+#include SWAP_FILE
+
+#undef SWAP_FUNC_PREFIX
+#undef SWAP_FUNC_PEX_PFX
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/UconvName.h b/xc/programs/Xserver/PEX5/dipex/swap/UconvName.h
new file mode 100644
index 000000000..cd9081fc7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/UconvName.h
@@ -0,0 +1,51 @@
+/* $TOG: UconvName.h /main/5 1998/02/10 12:36:58 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define SWAP_FUNC_PREFIX(nm) u##nm
+#define SWAP_FUNC_PEX_PFX(nm) uPEX##nm
+#else
+#define SWAP_FUNC_PREFIX(nm) u/**/nm
+#define SWAP_FUNC_PEX_PFX(nm) uPEX/**/nm
+#endif
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/cOCTables.ci b/xc/programs/Xserver/PEX5/dipex/swap/cOCTables.ci
new file mode 100644
index 000000000..49681bc27
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/cOCTables.ci
@@ -0,0 +1,241 @@
+/* $TOG: cOCTables.ci /main/6 1998/02/10 13:59:58 kaleb $ */
+/* Automatically generated OC table
+ */
+/******************************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include "X.h"
+#include "PEX.h"
+#include "PEXprotost.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pexSwap.h"
+
+#if defined (__STDC__)
+#define SWAP_OC_PREFIX(t) cPEX##t
+#else
+#define SWAP_OC_PREFIX(t) cPEX/**/t
+#endif
+
+extern ErrorCode
+ SwapPEXOCUnused (),
+ SwapPEXMarkerType (),
+ SwapPEXMarkerScale (),
+ SwapPEXMarkerColourIndex (),
+ SWAP_OC_PREFIX(MarkerColour) (),
+ SwapPEXMarkerBundleIndex (),
+ SwapPEXTextPrecision (),
+ SwapPEXCharExpansion (),
+ SwapPEXCharSpacing (),
+ SwapPEXCharHeight (),
+ SwapPEXCharUpVector (),
+ SwapPEXTextPath (),
+ SwapPEXTextAlignment (),
+ SwapPEXAtextStyle (),
+ SwapPEXLineType (),
+ SwapPEXLineWidth (),
+ SwapPEXCurveApproximation (),
+ SwapPEXPolylineInterp (),
+ SwapPEXInteriorStyle (),
+ SWAP_OC_PREFIX(SurfaceReflAttr) (),
+ SwapPEXSurfaceReflModel (),
+ SwapPEXSurfaceInterp (),
+ SwapPEXSurfaceApproximation (),
+ SwapPEXCullingMode (),
+ SwapPEXDistinguishFlag (),
+ SwapPEXPatternSize (),
+ SwapPEXPatternRefPt (),
+ SwapPEXPatternAttr (),
+ SwapPEXSurfaceEdgeFlag (),
+ SwapPEXSurfaceEdgeType (),
+ SwapPEXSetAsfValues (),
+ SwapPEXLocalTransform (),
+ SwapPEXLocalTransform2D (),
+ SwapPEXGlobalTransform (),
+ SwapPEXGlobalTransform2D (),
+ SwapPEXModelClip (),
+ SWAP_OC_PREFIX(ModelClipVolume) (),
+ SWAP_OC_PREFIX(ModelClipVolume2D) (),
+ SwapPEXRestoreModelClip (),
+ SWAP_OC_PREFIX(LightState) (),
+ SwapPEXPickId (),
+ SwapPEXHlhsrIdentifier (),
+ SWAP_OC_PREFIX(ParaSurfCharacteristics) (),
+ SWAP_OC_PREFIX(AddToNameSet) (),
+ SwapPEXExecuteStructure (),
+ SwapPEXLabel (),
+ SwapPEXApplicationData (),
+ SwapPEXGse (),
+ SWAP_OC_PREFIX(Marker) (),
+ SWAP_OC_PREFIX(Marker2D) (),
+ SWAP_OC_PREFIX(Text) (),
+ SWAP_OC_PREFIX(Text2D) (),
+ SWAP_OC_PREFIX(AnnotationText) (),
+ SWAP_OC_PREFIX(AnnotationText2D) (),
+ SWAP_OC_PREFIX(Polyline) (),
+ SWAP_OC_PREFIX(Polyline2D) (),
+ SWAP_OC_PREFIX(PolylineSet) (),
+ SWAP_OC_PREFIX(NurbCurve) (),
+ SWAP_OC_PREFIX(FillArea) (),
+ SWAP_OC_PREFIX(FillArea2D) (),
+ SWAP_OC_PREFIX(ExtFillArea) (),
+ SWAP_OC_PREFIX(FillAreaSet) (),
+ SWAP_OC_PREFIX(FillAreaSet2D) (),
+ SWAP_OC_PREFIX(ExtFillAreaSet) (),
+ SWAP_OC_PREFIX(TriangleStrip) (),
+ SWAP_OC_PREFIX(QuadrilateralMesh) (),
+ SWAP_OC_PREFIX(SOFAS) (),
+ SWAP_OC_PREFIX(NurbSurface) (),
+ SWAP_OC_PREFIX(CellArray) (),
+ SWAP_OC_PREFIX(CellArray2D) (),
+ SWAP_OC_PREFIX(ExtCellArray) (),
+ SWAP_OC_PREFIX(Gdp) (),
+ SWAP_OC_PREFIX(Gdp2D) (),
+ SwapPEXRenderingColourModel();
+
+OCFunction SWAP_OC_PREFIX(OutputCmd) [] = {
+ SwapPEXOCUnused,
+ SwapPEXMarkerType,
+ SwapPEXMarkerScale,
+ SwapPEXMarkerColourIndex,
+ SWAP_OC_PREFIX(MarkerColour),
+ SwapPEXMarkerBundleIndex,
+ SwapPEXMarkerBundleIndex, /* TextFontIndex */
+ SwapPEXTextPrecision,
+ SwapPEXCharExpansion,
+ SwapPEXCharSpacing,
+ SwapPEXMarkerColourIndex, /* TextColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* TextColour */
+ SwapPEXCharHeight,
+ SwapPEXCharUpVector,
+ SwapPEXTextPath,
+ SwapPEXTextAlignment,
+ SwapPEXCharHeight, /* AtextHeight */
+ SwapPEXCharUpVector, /* AtextUpVector */
+ SwapPEXTextPath, /* AtextPath */
+ SwapPEXTextAlignment, /* AtextAlignment */
+ SwapPEXAtextStyle,
+ SwapPEXMarkerBundleIndex, /* TextBundleIndex */
+ SwapPEXLineType,
+ SwapPEXLineWidth,
+ SwapPEXMarkerColourIndex, /* LineColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* LineColour */
+ SwapPEXCurveApproximation,
+ SwapPEXPolylineInterp,
+ SwapPEXMarkerBundleIndex, /* LineBundleIndex */
+ SwapPEXInteriorStyle,
+ SwapPEXMarkerBundleIndex, /* InteriorStyleIndex */
+ SwapPEXMarkerColourIndex, /* SurfaceColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* SurfaceColour */
+ SWAP_OC_PREFIX(SurfaceReflAttr),
+ SwapPEXSurfaceReflModel,
+ SwapPEXSurfaceInterp,
+ SwapPEXInteriorStyle, /* BfInteriorStyle */
+ SwapPEXMarkerBundleIndex, /* BfInteriorStyleIndex */
+ SwapPEXMarkerColourIndex, /* BfSurfaceColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* BfSurfaceColour */
+ SWAP_OC_PREFIX(SurfaceReflAttr), /* BfSurfaceReflAttr */
+ SwapPEXSurfaceReflModel, /* BfSurfaceReflModel */
+ SwapPEXSurfaceInterp, /* BfSurfaceInterp */
+ SwapPEXSurfaceApproximation,
+ SwapPEXCullingMode,
+ SwapPEXDistinguishFlag,
+ SwapPEXPatternSize,
+ SwapPEXPatternRefPt,
+ SwapPEXPatternAttr,
+ SwapPEXMarkerBundleIndex, /* InteriorBundleIndex */
+ SwapPEXSurfaceEdgeFlag,
+ SwapPEXSurfaceEdgeType,
+ SwapPEXLineWidth, /* SurfaceEdgeWidth */
+ SwapPEXMarkerColourIndex, /* SurfaceEdgeColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* SurfaceEdgeColour */
+ SwapPEXMarkerBundleIndex, /* EdgeBundleIndex */
+ SwapPEXSetAsfValues,
+ SwapPEXLocalTransform,
+ SwapPEXLocalTransform2D,
+ SwapPEXGlobalTransform,
+ SwapPEXGlobalTransform2D,
+ SwapPEXModelClip,
+ SWAP_OC_PREFIX(ModelClipVolume),
+ SWAP_OC_PREFIX(ModelClipVolume2D),
+ SwapPEXRestoreModelClip,
+ SwapPEXMarkerBundleIndex, /* ViewIndex */
+ SWAP_OC_PREFIX(LightState),
+ SwapPEXMarkerBundleIndex, /* DepthCueIndex */
+ SwapPEXPickId,
+ SwapPEXHlhsrIdentifier,
+ SwapPEXMarkerBundleIndex, /* ColourApproxIndex */
+ SwapPEXRenderingColourModel, /* RenderingColourModel */
+ SWAP_OC_PREFIX(ParaSurfCharacteristics),
+ SWAP_OC_PREFIX(AddToNameSet),
+ SWAP_OC_PREFIX(AddToNameSet), /* RemoveFromNameSet */
+ SwapPEXExecuteStructure,
+ SwapPEXLabel,
+ SwapPEXApplicationData,
+ SwapPEXGse,
+ SWAP_OC_PREFIX(Marker),
+ SWAP_OC_PREFIX(Marker2D),
+ SWAP_OC_PREFIX(Text),
+ SWAP_OC_PREFIX(Text2D),
+ SWAP_OC_PREFIX(AnnotationText),
+ SWAP_OC_PREFIX(AnnotationText2D),
+ SWAP_OC_PREFIX(Polyline),
+ SWAP_OC_PREFIX(Polyline2D),
+ SWAP_OC_PREFIX(PolylineSet),
+ SWAP_OC_PREFIX(NurbCurve),
+ SWAP_OC_PREFIX(FillArea),
+ SWAP_OC_PREFIX(FillArea2D),
+ SWAP_OC_PREFIX(ExtFillArea),
+ SWAP_OC_PREFIX(FillAreaSet),
+ SWAP_OC_PREFIX(FillAreaSet2D),
+ SWAP_OC_PREFIX(ExtFillAreaSet),
+ SWAP_OC_PREFIX(TriangleStrip),
+ SWAP_OC_PREFIX(QuadrilateralMesh),
+ SWAP_OC_PREFIX(SOFAS),
+ SWAP_OC_PREFIX(NurbSurface),
+ SWAP_OC_PREFIX(CellArray),
+ SWAP_OC_PREFIX(CellArray2D),
+ SWAP_OC_PREFIX(ExtCellArray),
+ SWAP_OC_PREFIX(Gdp),
+ SWAP_OC_PREFIX(Gdp2D)
+};
+
+#undef SWAP_OC_PREFIX
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/cOCprim.c b/xc/programs/Xserver/PEX5/dipex/swap/cOCprim.c
new file mode 100644
index 000000000..88cf7cc86
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/cOCprim.c
@@ -0,0 +1,835 @@
+/* $TOG: cOCprim.c /main/11 1998/02/10 12:37:03 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*
+ Contains swap routines for certain OCs and utility routines.
+ The difference between this file and its companion uOCprim.c
+ are subtle, having to do with, for example, whether or not
+ you have to swap strmPtr->numPoints before or after you will
+ need to use it to know how many points to convert.
+ */
+
+/* All such packet interdependencies should be handled in these two
+ files: cOCprim.c and uOCprim.c
+ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "convertStr.h"
+
+#define LOCAL_FLAG extern
+#include "convUtil.h"
+#include "OCattr.h"
+#undef LOCAL_FLAG
+
+#include "ConvName.h"
+#define LOCAL_FLAG
+#include "OCprim.h"
+
+
+#ifndef PADDING
+#define PADDING(n) ( (n)%4 ? (4 - (n)%4) : 0)
+#endif
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapFacet) (swapPtr, facetMask, vertexMask, colourType, ptr)
+pexSwap *swapPtr;
+CARD16 facetMask;
+CARD16 vertexMask;
+pexEnumTypeIndex colourType;
+unsigned char *ptr;
+{
+ CARD32 numVerts;
+ CARD32 i;
+
+ ptr = SwapOptData (swapPtr, ptr, facetMask, colourType);
+
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ numVerts = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+
+ for (i=0; i<numVerts; i++)
+ ptr = SwapVertex (swapPtr, (pexVertex *)ptr, vertexMask, colourType);
+}
+
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr, pc)
+pexSwap *swapPtr;
+pexColourSpecifier *pc;
+{
+ unsigned char *ptr;
+
+ SWAP_CARD16 (pc->colourType);
+ ptr = (unsigned char *)(pc+1);
+ ptr = SwapColour (swapPtr, (pexColour *)ptr, pc->colourType);
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapReflectionAttr) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexReflectionAttr *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_FLOAT (p_data->ambient);
+ SWAP_FLOAT (p_data->diffuse);
+ SWAP_FLOAT (p_data->specular);
+ SWAP_FLOAT (p_data->specularConc);
+ SWAP_FLOAT (p_data->transmission);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->specularColour));
+
+ return (ptr);
+}
+
+void
+SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, pME, num)
+pexSwap *swapPtr;
+pexMonoEncoding *pME;
+CARD32 num;
+{
+ CARD16 i, j;
+ int bytes;
+
+ for (i=0; i<num; i++) {
+ SWAP_CARD16(pME->characterSet);
+ SWAP_CARD16(pME->numChars);
+
+ switch (pME->characterSetWidth) {
+ case PEXCSByte:
+ bytes = pME->numChars;
+ break;
+ case PEXCSShort: {
+ CARD16 *ptr = (CARD16 *)(pME+1);
+ for (j=0; j<pME->numChars; j++, ptr++) SWAP_CARD16((*ptr));
+ bytes = pME->numChars * sizeof(CARD16);
+ break;
+ }
+
+ case PEXCSLong: {
+ CARD32 *ptr = (CARD32 *)(pME+1);
+ for (j=0; j<pME->numChars; j++, ptr++) SWAP_CARD32((*ptr));
+ bytes = pME->numChars * sizeof(CARD32);
+ break;
+ }
+
+ }
+ pME = (pexMonoEncoding *) ((char *) (pME + 1) +
+ bytes + PADDING (bytes));
+
+ }
+
+}
+
+
+
+/* The rest are OC's */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXModelClipVolume) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexModelClipVolume *strmPtr;
+{
+ int i;
+ pexHalfSpace *ph;
+
+ SWAP_ENUM_TYPE_INDEX (strmPtr->modelClipOperator);
+ SWAP_CARD16 (strmPtr->numHalfSpaces);
+
+ for (i=0, ph=(pexHalfSpace *)(strmPtr+1); i<strmPtr->numHalfSpaces; i++,ph++)
+ SwapHalfSpace(swapPtr, ph);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXModelClipVolume2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexModelClipVolume2D *strmPtr;
+{
+ int i;
+ pexHalfSpace2D *ph;
+
+ SWAP_ENUM_TYPE_INDEX (strmPtr->modelClipOperator);
+ SWAP_CARD16 (strmPtr->numHalfSpaces);
+
+ for (i=0,ph=(pexHalfSpace2D *)(strmPtr+1);i<strmPtr->numHalfSpaces; i++,ph++)
+ SwapHalfSpace2D(swapPtr, ph);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXLightState) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLightState *strmPtr;
+{
+ int i, numE, numD;
+ CARD16 *light;
+
+ SWAP_CARD16 (strmPtr->numEnable);
+ SWAP_CARD16 (strmPtr->numDisable);
+
+ numE = strmPtr->numEnable;
+ numD = strmPtr->numDisable;
+
+ for (i=0, light = (CARD16 *)(strmPtr+1); i<numE; i++, light++)
+ SWAP_CARD16 ((*light));
+
+ /* skip pad if there */
+ if (numE & 0x1) light++;
+
+ for (i=0; i<numD; i++, light++)
+ SWAP_CARD16 ((*light));
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXAddToNameSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAddToNameSet *strmPtr;
+{
+ int i, num;
+ pexName *pn;
+
+
+ num = (int)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexAddToNameSet))
+ /sizeof(pexName));
+
+ for (i=0, pn=(pexName *)(strmPtr+1); i<num; i++, pn++)
+ SWAP_NAME ((*pn));
+
+}
+
+
+/* typedef pexAddToNameSet pexRemoveFromNameSet;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMarker) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarker *strmPtr;
+{
+ CARD32 num;
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexMarker))
+ /sizeof(pexCoord3D));
+
+ SwapCoord3DList(swapPtr, pc, num);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMarker2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarker2D *strmPtr;
+{
+ CARD32 num;
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexMarker2D))
+ /sizeof(pexCoord2D));
+
+ SwapCoord2DList(swapPtr, pc, num);
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolyline) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolyline *strmPtr;
+{
+ CARD32 num;
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexPolyline))
+ /sizeof(pexCoord3D));
+
+ SwapCoord3DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolyline2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolyline2D *strmPtr;
+{
+ CARD32 num;
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexPolyline2D))
+ /sizeof(pexCoord2D));
+
+ SwapCoord2DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolylineSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolylineSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexVertex *pv;
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numLists);
+
+ pj = (CARD32 *)(strmPtr+1);
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pv) {
+
+ SWAP_CARD32 ((*pj));
+ k = *pj++;
+ for (j=0, pv = (pexVertex *)pj; j<k; j++) {
+ pv = (pexVertex *) SwapVertex (swapPtr, pv, strmPtr->vertexAttribs, strmPtr->colourType);
+ }
+
+ }
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNurbCurve) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNurbCurve *strmPtr;
+{
+ int i;
+ PEXFLOAT *pf;
+
+ SWAP_CARD16 (strmPtr->curveOrder);
+ SWAP_COORD_TYPE (strmPtr->coordType);
+ SWAP_FLOAT (strmPtr->tmin);
+ SWAP_FLOAT (strmPtr->tmax);
+ SWAP_CARD32 (strmPtr->numKnots);
+ SWAP_CARD32 (strmPtr->numPoints);
+
+ for (i=0, pf=(PEXFLOAT *)(strmPtr+1); i<strmPtr->numKnots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ if (strmPtr->coordType == PEXRational)
+ SwapCoord4DList(swapPtr, (pexCoord4D *)pf, strmPtr->numPoints);
+ else
+ SwapCoord3DList(swapPtr, (pexCoord3D *)pf, strmPtr->numPoints);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillArea) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillArea *strmPtr;
+{
+ CARD32 num;
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexFillArea))
+ /sizeof(pexCoord3D));
+
+ SWAP_CARD16 (strmPtr->shape);
+
+ SwapCoord3DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillArea2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillArea2D *strmPtr;
+{
+ CARD32 num;
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexFillArea2D))
+ /sizeof(pexCoord2D));
+
+ SWAP_CARD16 (strmPtr->shape);
+
+ SwapCoord2DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtFillArea) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtFillArea *strmPtr;
+{
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+
+ SWAP_FUNC_PREFIX(SwapFacet)( swapPtr, strmPtr->facetAttribs,
+ strmPtr->vertexAttribs, strmPtr->colourType,
+ (CARD8 *)(strmPtr+1));
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillAreaSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillAreaSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexCoord3D *pc;
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_CARD32 (strmPtr->numLists);
+
+ pj = (CARD32 *)(strmPtr+1);
+
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pc ) {
+
+ SWAP_CARD32 ((*pj));
+ k = *pj++;
+ for (j=0, pc = (pexCoord3D *)pj; j<k; j++, pc++) {
+ SWAP_COORD3D ((*pc));
+ }
+ }
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillAreaSet2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillAreaSet2D *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexCoord2D *pc;
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_CARD32 (strmPtr->numLists);
+ pj = (CARD32 *)(strmPtr+1);
+
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pc ) {
+
+ SWAP_CARD32 ((*pj));
+ k = *pj++;
+ for (j=0, pc = (pexCoord2D *)pj; j<k; j++, pc++) {
+ SWAP_COORD2D ((*pc));
+ }
+ }
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtFillAreaSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtFillAreaSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexVertex *pv;
+ unsigned char *ptr = 0;
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numLists);
+
+ ptr = SwapOptData (swapPtr, (CARD8 *) (strmPtr+1),
+ strmPtr->facetAttribs, strmPtr->colourType);
+
+
+ for (i=0, pj = (CARD32 *)ptr; i<strmPtr->numLists; i++, pj = (CARD32 *)pv) {
+ SWAP_CARD32 ((*pj));
+ k = *pj++;
+ for (j=0, pv = (pexVertex *)pj; j<k; j++) {
+ pv = (pexVertex *) SwapVertex( swapPtr, pv, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+ }
+
+ }
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXTriangleStrip) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexTriangleStrip *strmPtr;
+{
+ CARD32 i;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numVertices);
+
+ for (i=0; i<(strmPtr->numVertices-2); i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->facetAttribs,
+ strmPtr->colourType);
+
+ for (i=0; i<strmPtr->numVertices; i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXQuadrilateralMesh) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexQuadrilateralMesh *strmPtr;
+{
+ int i;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->mPts);
+ SWAP_CARD16 (strmPtr->nPts);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+
+ for (i=0; i<((strmPtr->mPts -1) * (strmPtr->nPts -1)); i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->facetAttribs,
+ strmPtr->colourType);
+
+ for (i=0; i<(strmPtr->mPts * strmPtr->nPts); i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSOFAS) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSOFAS *strmPtr;
+{
+ CARD16 i, j, k;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+ CARD16 numListsofLists, numLists, numitems;
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->FAS_Attributes);
+ SWAP_CARD16 (strmPtr->vertexAttributes);
+ SWAP_CARD16 (strmPtr->edgeAttributes);
+ SWAP_CARD16 (strmPtr->numFAS);
+ SWAP_CARD16 (strmPtr->numVertices);
+ SWAP_CARD16 (strmPtr->numEdges);
+ SWAP_CARD16 (strmPtr->numContours);
+
+ for (i=0; i<strmPtr->numFAS; i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->FAS_Attributes,
+ strmPtr->colourType);
+
+ for (i=0; i<strmPtr->numVertices; i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr,
+ strmPtr->vertexAttributes, strmPtr->colourType);
+
+ ptr += ((int)(((strmPtr->numEdges * strmPtr->edgeAttributes) + 3) / 4)) * 4;
+
+
+ numListsofLists = strmPtr->numFAS;
+ for (i=0; i < numListsofLists; i++){
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ numLists = *(CARD16 *)ptr;
+ ptr += sizeof(CARD16);
+ for (j=0; j < numLists; j++) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ numitems = *(CARD16 *)ptr;
+ ptr += sizeof(CARD16);
+ for (k=0; k < numitems; k++) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+ }
+ }
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNurbSurface) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNurbSurface *strmPtr;
+{
+ CARD32 i, j, k;
+ PEXFLOAT *pf;
+ unsigned char *ptr;
+ CARD32 numPoints, numKnots;
+ CARD32 numSublists;
+ CARD16 curveType;
+ pexTrimCurve *pTC = 0;
+
+ SWAP_COORD_TYPE (strmPtr->type);
+ SWAP_CARD16 (strmPtr->uOrder);
+ SWAP_CARD16 (strmPtr->vOrder);
+ SWAP_CARD32 (strmPtr->numUknots);
+ SWAP_CARD32 (strmPtr->numVknots);
+ SWAP_CARD16 (strmPtr->mPts);
+ SWAP_CARD16 (strmPtr->nPts);
+ SWAP_CARD32 (strmPtr->numLists);
+
+ for (i=0, pf=(PEXFLOAT *)(strmPtr+1); i<strmPtr->numUknots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ for (i=0; i<strmPtr->numVknots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ ptr = (unsigned char *)pf;
+ if (strmPtr->type == PEXRational)
+ ptr = SwapCoord4DList( swapPtr, (pexCoord4D *)ptr,
+ (CARD32)(strmPtr->mPts*strmPtr->nPts));
+ else
+ ptr = SwapCoord3DList( swapPtr, (pexCoord3D *)ptr,
+ (CARD32)(strmPtr->mPts*strmPtr->nPts));
+
+ for (i=0; i<strmPtr->numLists; i++) {
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ numSublists = *((CARD32 *)ptr); /* num trim curves */
+ ptr+=4;
+ for (j=0; j<numSublists; j++) {
+ pTC = (pexTrimCurve *)ptr;
+ SWAP_CARD16(pTC->type);
+ SWAP_CARD32(pTC->numKnots);
+ SWAP_CARD32(pTC->numCoord);
+ ptr = SwapTrimCurve(swapPtr, pTC);
+ }
+ }
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCellArray) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCellArray *strmPtr;
+{
+ int i;
+ CARD16 *pc;
+
+ SWAP_COORD3D (strmPtr->point1);
+ SWAP_COORD3D (strmPtr->point2);
+ SWAP_COORD3D (strmPtr->point3);
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+
+ for (i=0, pc=(CARD16 *)(strmPtr+1); i<(strmPtr->dx * strmPtr->dy); i++, pc++)
+ SWAP_CARD16((*((CARD16 *)pc)));
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCellArray2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCellArray2D *strmPtr;
+{
+ int i;
+ CARD16 *pc;
+
+ SWAP_COORD2D (strmPtr->point1);
+ SWAP_COORD2D (strmPtr->point2);
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+
+ for (i=0, pc=(CARD16 *)(strmPtr+1); i<(strmPtr->dx * strmPtr->dy); i++, pc++)
+ SWAP_CARD16((*pc));
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtCellArray) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtCellArray *strmPtr;
+{
+ CARD32 i;
+ unsigned char *ptr;
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_COORD3D (strmPtr->point1);
+ SWAP_COORD3D (strmPtr->point2);
+ SWAP_COORD3D (strmPtr->point3);
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+
+ for ( i=0, ptr = (unsigned char *)(strmPtr+1);
+ i < strmPtr->dx * strmPtr->dy;
+ i++) {
+ ptr = SwapColour(swapPtr, (pexColour *)ptr, strmPtr->colourType);
+ }
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGdp) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGdp *strmPtr;
+{
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+ SWAP_CARD32 (strmPtr->gdpId);
+ SWAP_CARD32 (strmPtr->numPoints);
+ SWAP_CARD32 (strmPtr->numBytes);
+
+ SwapCoord3DList(swapPtr, pc, strmPtr->numPoints);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGdp2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGdp2D *strmPtr;
+{
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+ SWAP_CARD32 (strmPtr->gdpId);
+ SWAP_CARD32 (strmPtr->numPoints);
+ SWAP_CARD32 (strmPtr->numBytes);
+
+ SwapCoord2DList(swapPtr, pc, strmPtr->numPoints);
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(Text) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexText *strmPtr;
+{
+ SWAP_COORD3D (strmPtr->origin);
+ SWAP_VECTOR3D (strmPtr->vector1);
+ SWAP_VECTOR3D (strmPtr->vector2);
+ SWAP_CARD16 (strmPtr->numEncodings);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(Text2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexText2D *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->origin);
+ SWAP_CARD16 (strmPtr->numEncodings);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(AnnotationText) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAnnotationText *strmPtr;
+{
+ SWAP_COORD3D (strmPtr->origin);
+ SWAP_COORD3D (strmPtr->offset);
+ SWAP_CARD16 (strmPtr->numEncodings);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(AnnotationText2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAnnotationText2D *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->origin);
+ SWAP_COORD2D (strmPtr->offset);
+ SWAP_CARD16 (strmPtr->numEncodings);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(ParaSurfCharacteristics) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexParaSurfCharacteristics *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_INT16 (strmPtr->characteristics);
+
+ switch (strmPtr->characteristics) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+
+ case PEXPSCIsoCurves: {
+ pexPSC_IsoparametricCurves *ptr =
+ (pexPSC_IsoparametricCurves *)(strmPtr+1);
+ SWAP_CARD16(ptr->placementType);
+ SWAP_CARD16(ptr->numUcurves);
+ SWAP_CARD16(ptr->numVcurves);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves:
+ case PEXPSCWcLevelCurves: {
+ pexPSC_LevelCurves *ptr = (pexPSC_LevelCurves *)(strmPtr+1);
+ PEXFLOAT *pc = (PEXFLOAT *)(ptr+1);
+ CARD16 i;
+ SWAP_COORD3D (ptr->origin);
+ SWAP_VECTOR3D (ptr->direction);
+ SWAP_CARD16 (ptr->numberIntersections);
+ for (i=0; i<ptr->numberIntersections; i++, pc++) {
+ SWAP_FLOAT(*pc);
+ }
+ break;
+ }
+ }
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNoop) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNoop *strmPtr;
+{
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/check.c b/xc/programs/Xserver/PEX5/dipex/swap/check.c
new file mode 100644
index 000000000..5deb7973f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/check.c
@@ -0,0 +1,353 @@
+/* $TOG: check.c /main/7 1998/02/10 12:37:08 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+#include "Xproto.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "pexError.h"
+
+/*
+ Check floating point format for every request and set the
+ Request and OC tables appropriately.
+
+ Note that the code depends on the fact that every request
+ that is concerned with floating point format uses the 3rd short
+ as a floating point specifier;
+ */
+
+extern void SwapFLOAT();
+extern void SwapIEEEToVax();
+extern void SwapVaxToIEEE();
+extern void ConvertIEEEToVax();
+extern void ConvertVaxToIEEE();
+extern OCFunction cPEXOutputCmd[];
+extern OCFunction uPEXOutputCmd[];
+extern RequestFunction PEXRequest[];
+extern RequestFunction cPEXRequest[];
+extern ReplyFunction uPEXReply[];
+
+/* define some macros previously taken from swapmacros.h */
+/* byte swap AND COPY a short (given pointer) */
+#define SWAPSHORTC(x, y)\
+((char *) (y))[1] = ((char *) (x))[0];\
+((char *) (y))[0] = ((char *) (x))[1]
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ INT16 fpFormat B16;
+ CARD16 unused B16;
+} checkStdHeader;
+
+
+static PEXFLOAT
+NoFloatConv( f )
+PEXFLOAT f;
+{
+ return (f);
+}
+
+static ErrorCode
+NoFloat( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+checkStdHeader *strmPtr;
+{
+ if (cntxtPtr->client->swapped) {
+ cntxtPtr->pexRequest = cPEXRequest;
+ cntxtPtr->pexSwapRequestOC = cPEXOutputCmd;
+ cntxtPtr->pexSwapReply = uPEXReply;
+ cntxtPtr->pexSwapReplyOC = uPEXOutputCmd;
+ cntxtPtr->swap->ConvertFLOAT= 0;
+
+ } else {
+ cntxtPtr->pexRequest = PEXRequest;
+ cntxtPtr->pexSwapRequestOC = 0;
+ cntxtPtr->pexSwapReply = 0;
+ cntxtPtr->pexSwapReplyOC = 0;
+ cntxtPtr->swap->ConvertFLOAT= 0;
+ }
+ return(Success);
+}
+
+
+/* HACK ALERT ON */
+static INT16 lastfp[MAXCLIENTS];
+/* HACK ALERT OFF */
+
+static ErrorCode
+CheckFloat( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+checkStdHeader *strmPtr;
+{
+/* HACK ALERT ON */
+extern INT16 lastfp[MAXCLIENTS];
+/* HACK ALERT OFF */
+
+ pexEnumTypeIndex fp;
+
+ if (cntxtPtr->client->swapped) {
+ cntxtPtr->pexRequest = cPEXRequest;
+ cntxtPtr->pexSwapRequestOC = cPEXOutputCmd;
+ cntxtPtr->pexSwapReply = uPEXReply;
+ cntxtPtr->pexSwapReplyOC = uPEXOutputCmd;
+ SWAPSHORTC(&(strmPtr->fpFormat), &fp);
+
+ if ( fp == SERVER_NATIVE_FP ) {
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapFLOAT;
+
+ } else {
+ if (fp == PEXDEC_F_Floating)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapVaxToIEEE;
+ else if (fp == PEXIeee_754_32)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapIEEEToVax;
+ /* we don't do the other kinds yet */
+ else PEX_ERR_EXIT(PEXFloatingPointFormatError,fp,cntxtPtr);
+ }
+
+ } else {
+ if ( (fp = strmPtr->fpFormat) == SERVER_NATIVE_FP ) {
+ cntxtPtr->pexRequest = PEXRequest;
+ cntxtPtr->pexSwapRequestOC = 0;
+ cntxtPtr->pexSwapReply = 0;
+ cntxtPtr->pexSwapReplyOC = 0;
+ cntxtPtr->swap->ConvertFLOAT= 0;
+
+ } else {
+ cntxtPtr->pexRequest = cPEXRequest;
+ cntxtPtr->pexSwapRequestOC = cPEXOutputCmd;
+ cntxtPtr->pexSwapReply = uPEXReply;
+ cntxtPtr->pexSwapReplyOC = uPEXOutputCmd;
+ if (fp == PEXDEC_F_Floating)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)ConvertVaxToIEEE;
+ else if (fp == PEXIeee_754_32)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)ConvertIEEEToVax;
+ /* we don't do the other kinds yet */
+ else PEX_ERR_EXIT(PEXFloatingPointFormatError,fp,cntxtPtr);
+ }
+
+ };
+
+ /* HACK ALERT ON */
+ /* set the floating point format for use by HackFloat */
+ lastfp[cntxtPtr->client->index] = fp;
+ /* HACK ALERT OFF */
+
+ return(Success);
+}
+
+static ErrorCode
+HackFloat( cntxtPtr, strmPtr )
+pexContext *cntxtPtr;
+checkStdHeader *strmPtr;
+{
+extern INT16 lastfp[MAXCLIENTS];
+
+ pexEnumTypeIndex fp;
+
+ /* This Routine is a HACK to set the cntxtPtr up for any Requests
+ that need to SWAP Floats but don't have the fpFormat as part of
+ the request (ie PEXUpdatePickMeasure). Instead of getting the
+ fp type from the request it will retrieve it from a global array
+ which stores, on a per client basis the fpFormat of the last
+ request that had one.
+ */
+
+ fp = lastfp[cntxtPtr->client->index];
+ if (cntxtPtr->client->swapped) {
+ cntxtPtr->pexRequest = cPEXRequest;
+ cntxtPtr->pexSwapRequestOC = cPEXOutputCmd;
+ cntxtPtr->pexSwapReply = uPEXReply;
+ cntxtPtr->pexSwapReplyOC = uPEXOutputCmd;
+
+ if ( fp == SERVER_NATIVE_FP ) {
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapFLOAT;
+
+ } else {
+ if (fp == PEXDEC_F_Floating)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapVaxToIEEE;
+ else if (fp == PEXIeee_754_32)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)SwapIEEEToVax;
+ /* we don't do the other kinds yet */
+ else PEX_ERR_EXIT(PEXFloatingPointFormatError,fp,cntxtPtr);
+ }
+
+ } else {
+ if ( fp == SERVER_NATIVE_FP ) {
+ cntxtPtr->pexRequest = PEXRequest;
+ cntxtPtr->pexSwapRequestOC = 0;
+ cntxtPtr->pexSwapReply = 0;
+ cntxtPtr->pexSwapReplyOC = 0;
+ cntxtPtr->swap->ConvertFLOAT= 0;
+
+ } else {
+ cntxtPtr->pexRequest = cPEXRequest;
+ cntxtPtr->pexSwapRequestOC = cPEXOutputCmd;
+ cntxtPtr->pexSwapReply = uPEXReply;
+ cntxtPtr->pexSwapReplyOC = uPEXOutputCmd;
+ if (fp == PEXDEC_F_Floating)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)ConvertVaxToIEEE;
+ else if (fp == PEXIeee_754_32)
+ cntxtPtr->swap->ConvertFLOAT = (ConvFunction)ConvertIEEEToVax;
+ /* we don't do the other kinds yet */
+ else PEX_ERR_EXIT(PEXFloatingPointFormatError,fp,cntxtPtr);
+ }
+
+ };
+ return(Success);
+}
+
+RequestFunction set_tables[] = {
+/* 0 */ NoFloat, /* PEXRequestUnused */
+/* 1 */ NoFloat, /* PEXGetExtensionInfo */
+/* 2 */ NoFloat, /* PEXGetEnumeratedTypeInfo */
+/* 3 */ CheckFloat, /* PEXGetImpDepConstants */
+/* 4 */ NoFloat, /* PEXCreateLookupTable */
+/* 5 */ NoFloat, /* PEXCopyLookupTable */
+/* 6 */ NoFloat, /* PEXFreeLookupTable */
+/* 7 */ NoFloat, /* PEXGetTableInfo */
+/* 8 */ CheckFloat, /* PEXGetPredefinedEntries */
+/* 9 */ NoFloat, /* PEXGetDefinedIndices */
+/* 10 */ CheckFloat, /* PEXGetTableEntry */
+/* 11 */ CheckFloat, /* PEXGetTableEntries */
+/* 12 */ CheckFloat, /* PEXSetTableEntries */
+/* 13 */ NoFloat, /* PEXDeleteTableEntries */
+/* 14 */ CheckFloat, /* PEXCreatePipelineContext */
+/* 15 */ NoFloat, /* PEXCopyPipelineContext */
+/* 16 */ NoFloat, /* PEXFreePipelineContext */
+/* 17 */ CheckFloat, /* PEXGetPipelineContext */
+/* 18 */ CheckFloat, /* PEXChangePipelineContext */
+/* 19 */ CheckFloat, /* PEXCreateRenderer */
+/* 20 */ NoFloat, /* PEXFreeRenderer */
+/* 21 */ CheckFloat, /* PEXChangeRenderer */
+/* 22 */ CheckFloat, /* PEXGetRendererAttributes */
+/* 23 */ NoFloat, /* PEXGetRendererDynamics */
+/* 24 */ NoFloat, /* PEXBeginRendering */
+/* 25 */ NoFloat, /* PEXEndRendering */
+/* 26 */ NoFloat, /* PEXBeginStructure */
+/* 27 */ NoFloat, /* PEXEndStructure */
+/* 28 */ CheckFloat, /* PEXRenderOutputCommands */
+/* 29 */ NoFloat, /* PEXRenderNetwork */
+/* 30 */ NoFloat, /* PEXCreateStructure */
+/* 31 */ NoFloat, /* PEXCopyStructure */
+/* 32 */ NoFloat, /* PEXDestroyStructures */
+/* 33 */ CheckFloat, /* PEXGetStructureInfo */
+/* 34 */ CheckFloat, /* PEXGetElementInfo */
+/* 35 */ NoFloat, /* PEXGetStructuresInNetwork */
+/* 36 */ NoFloat, /* PEXGetAncestors */
+/* 37 */ NoFloat, /* PEXGetDescendants */
+/* 38 */ CheckFloat, /* PEXFetchElements */
+/* 39 */ NoFloat, /* PEXSetEditingMode */
+/* 40 */ NoFloat, /* PEXSetElementPointer */
+/* 41 */ NoFloat, /* PEXSetElementPointerAtLabel */
+/* 42 */ NoFloat, /* PEXElementSearch */
+/* 43 */ CheckFloat, /* PEXStoreElements */
+/* 44 */ NoFloat, /* PEXDeleteElements */
+/* 45 */ NoFloat, /* PEXDeleteElementsToLabel */
+/* 46 */ NoFloat, /* PEXDeleteBetweenLabels */
+/* 47 */ NoFloat, /* PEXCopyElements */
+/* 48 */ NoFloat, /* PEXChangeStructureRefs */
+/* 49 */ NoFloat, /* PEXCreateNameSet */
+/* 50 */ NoFloat, /* PEXCopyNameSet */
+/* 51 */ NoFloat, /* PEXFreeNameSet */
+/* 52 */ NoFloat, /* PEXGetNameSet */
+/* 53 */ NoFloat, /* PEXChangeNameSet */
+/* 54 */ CheckFloat, /* PEXCreateSearchContext */
+/* 55 */ NoFloat, /* PEXCopySearchContext */
+/* 56 */ NoFloat, /* PEXFreeSearchContext */
+/* 57 */ CheckFloat, /* PEXGetSearchContext */
+/* 58 */ CheckFloat, /* PEXChangeSearchContext */
+/* 59 */ NoFloat, /* PEXSearchNetwork */
+/* 60 */ NoFloat, /* PEXCreatePhigsWks */
+/* 61 */ NoFloat, /* PEXFreePhigsWks */
+/* 62 */ CheckFloat, /* PEXGetWksInfo */
+/* 63 */ NoFloat, /* PEXGetDynamics */
+/* 64 */ CheckFloat, /* PEXGetViewRep */
+/* 65 */ NoFloat, /* PEXRedrawAllStructures */
+/* 66 */ NoFloat, /* PEXUpdateWorkstation */
+/* 67 */ NoFloat, /* PEXRedrawClipRegion */
+/* 68 */ NoFloat, /* PEXExecuteDeferredActions */
+/* 69 */ NoFloat, /* PEXSetViewPriority */
+/* 70 */ NoFloat, /* PEXSetDisplayUpdateMode */
+/* 71 */ CheckFloat, /* PEXMapDCtoWC */
+/* 72 */ CheckFloat, /* PEXMapWCtoDC */
+/* 73 */ CheckFloat, /* PEXSetViewRep */
+/* 74 */ CheckFloat, /* PEXSetWksWindow */
+/* 75 */ CheckFloat, /* PEXSetWksViewport */
+/* 76 */ NoFloat, /* PEXSetHlhsrMode */
+/* 77 */ NoFloat, /* PEXSetWksBufferMode */
+/* 78 */ CheckFloat, /* PEXPostStructure */
+/* 79 */ NoFloat, /* PEXUnpostStructure */
+/* 80 */ NoFloat, /* PEXUnpostAllStructures */
+/* 81 */ NoFloat, /* PEXGetWksPostings */
+/* 82 */ CheckFloat, /* PEXGetPickDevice */
+/* 83 */ CheckFloat, /* PEXChangePickDevice */
+/* 84 */ NoFloat, /* PEXCreatePickMeasure */
+/* 85 */ NoFloat, /* PEXFreePickMeasure */
+/* 86 */ NoFloat, /* PEXGetPickMeasure */
+/* 87 */ HackFloat, /* PEXUpdatePickMeasure */
+/* 88 */ NoFloat, /* PEXOpenFont */
+/* 89 */ NoFloat, /* PEXCloseFont */
+/* 90 */ NoFloat, /* PEXQueryFont */
+/* 91 */ NoFloat, /* PEXListFonts */
+/* 92 */ NoFloat, /* PEXListFontsWithInfo */
+/* 93 */ CheckFloat, /* PEXQueryTextExtents */
+/* 94 */ NoFloat, /* PEXMatchRendererTargets */
+/* 95 */ NoFloat, /* PEXEscape */
+/* 96 */ NoFloat, /* PEXEscapeWithReply */
+/* 97 */ NoFloat, /* PEXRenderElements */
+/* 98 */ NoFloat, /* PEXAccumulateState */
+/* 99 */ CheckFloat, /* PEXBeginPickOne */
+/* 100 */ NoFloat, /* PEXEndPickOne */
+/* 101 */ CheckFloat, /* PEXPickOne */
+/* 102 */ CheckFloat, /* PEXBeginPickAll */
+/* 103 */ NoFloat, /* PEXEndPickAll */
+/* 104 */ CheckFloat /* PEXPickAll */
+};
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convEv.c b/xc/programs/Xserver/PEX5/dipex/swap/convEv.c
new file mode 100644
index 000000000..bc0cf810b
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convEv.c
@@ -0,0 +1,58 @@
+/* $TOG: convEv.c /main/3 1998/02/10 12:37:12 kaleb $ */
+
+/************************************************************
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "pexError.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "ddpex.h"
+#include "pexLookup.h"
+#include "convertStr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG extern
+
+
+/****************************************************************
+ * EVENTS *
+ ****************************************************************/
+
+
+
+void
+SwapPEXMaxHitsReachedEvent(from, to)
+pexMaxHitsReachedEvent *from, *to;
+{
+ to->type = from->type;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->rdr, to->rdr);
+}
+
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convReq.c b/xc/programs/Xserver/PEX5/dipex/swap/convReq.c
new file mode 100644
index 000000000..3667a6ee0
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convReq.c
@@ -0,0 +1,2549 @@
+/* $TOG: convReq.c /main/18 1998/02/10 12:37:16 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "pexError.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "ddpex.h"
+#include "pexLookup.h"
+#include "convertStr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG extern
+#include "convUtil.h"
+#include "ConvName.h"
+#include "OCprim.h"
+#include "OCcolour.h"
+#include "OCattr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG
+#include "convReq.h"
+
+extern RequestFunction PEXRequest[];
+
+#define PADDING(n) ( (n)&3 ? (4 - ((n)&3)) : 0)
+
+
+/****************************************************************
+ * REQUESTS *
+ ****************************************************************/
+
+#define CALL_REQUEST return(PEXRequest[strmPtr->opcode](cntxtPtr, strmPtr))
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGenericRequest) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ /* length in 4 bytes quantities */
+ /* of whole request, including this header */
+ CALL_REQUEST;
+}
+
+/*****************************************************************
+ * structures that follow request.
+ *****************************************************************/
+
+/* ResourceReq is used for any request which has a resource ID
+ (or Atom or Time) as its one and only argument. */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGenericResourceRequest) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexResourceReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD32 (strmPtr->id); /* a Structure, Renderer, Font, Pixmap, etc. */
+
+ CALL_REQUEST;
+}
+
+
+/*****************************************************************
+ * Specific Requests
+ *****************************************************************/
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetExtensionInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetExtensionInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD16 (strmPtr->clientProtocolMajor);
+ SWAP_CARD16 (strmPtr->clientProtocolMinor);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetEnumeratedTypeInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetEnumeratedTypeInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 i;
+ CARD16 *ptr = (CARD16 *)(strmPtr+1);
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_BITMASK (strmPtr->itemMask);
+ SWAP_CARD32 (strmPtr->numEnums);
+
+ for (i=0; i<strmPtr->numEnums; i++, ptr++)
+ SWAP_CARD16 ((*ptr));
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreateLookupTable) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateLookupTableReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_DRAWABLE (strmPtr->drawableExample);
+ SWAP_LOOKUP_TABLE (strmPtr->lut);
+ SWAP_TABLE_TYPE (strmPtr->tableType);
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopyLookupTable) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyLookupTableReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_LOOKUP_TABLE (strmPtr->src);
+ SWAP_LOOKUP_TABLE (strmPtr->dst);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreeLookupTableReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetTableInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetTableInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_DRAWABLE (strmPtr->drawableExample);
+ SWAP_TABLE_TYPE (strmPtr->tableType);
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetPredefinedEntries) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetPredefinedEntriesReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_DRAWABLE (strmPtr->drawableExample);
+ SWAP_TABLE_TYPE (strmPtr->tableType);
+ SWAP_TABLE_INDEX (strmPtr->start);
+ SWAP_CARD16 (strmPtr->count);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexGetDefinedIndicesReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetTableEntry) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetTableEntryReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD16 (strmPtr->valueType);
+ SWAP_LOOKUP_TABLE (strmPtr->lut);
+ SWAP_TABLE_INDEX (strmPtr->index);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetTableEntries) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetTableEntriesReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD16 (strmPtr->valueType);
+ SWAP_LOOKUP_TABLE (strmPtr->lut);
+ SWAP_TABLE_INDEX (strmPtr->start);
+ SWAP_CARD16 (strmPtr->count);
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetTableEntries) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetTableEntriesReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ ErrorCode err = Success;
+ pexTableType ttype;
+ diLUTHandle lut;
+ CARD32 num;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_LOOKUP_TABLE (strmPtr->lut);
+ SWAP_TABLE_INDEX (strmPtr->start);
+ SWAP_CARD16 (strmPtr->count);
+
+ LU_TABLE(strmPtr->lut, lut);
+ ttype = lut->lutType;
+ num = (CARD32)(strmPtr->count);
+
+ SWAP_FUNC_PREFIX(SwapTable) ( swapPtr, ttype, num,
+ (unsigned char *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXDeleteTableEntries) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDeleteTableEntriesReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_LOOKUP_TABLE (strmPtr->lut);
+ SWAP_TABLE_INDEX (strmPtr->start);
+ SWAP_CARD16 (strmPtr->count);
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreatePipelineContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePipelineContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PC (strmPtr->pc);
+ SWAP_CARD32 (strmPtr->itemMask[0]);
+ SWAP_CARD32 (strmPtr->itemMask[1]);
+
+ SWAP_FUNC_PREFIX(SwapPipelineContextAttr) ( swapPtr,
+ (CARD32 *)(strmPtr->itemMask),
+ (CARD8 *)(strmPtr + 1));
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopyPipelineContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyPipelineContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PC (strmPtr->src);
+ SWAP_PC (strmPtr->dst);
+ SWAP_CARD32 (strmPtr->itemMask[0]);
+ SWAP_CARD32 (strmPtr->itemMask[1]);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreePipelineContextReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetPipelineContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetPipelineContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PC (strmPtr->pc);
+ SWAP_CARD32 (strmPtr->itemMask[0]);
+ SWAP_CARD32 (strmPtr->itemMask[1]);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangePipelineContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangePipelineContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PC (strmPtr->pc);
+ SWAP_CARD32 (strmPtr->itemMask[0]);
+ SWAP_CARD32 (strmPtr->itemMask[1]);
+
+ SWAP_FUNC_PREFIX(SwapPipelineContextAttr) ( swapPtr,
+ (CARD32 *)(strmPtr->itemMask),
+ (CARD8 *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreateRenderer) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateRendererReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_BITMASK (strmPtr->itemMask);
+
+ SWAP_FUNC_PREFIX(SwapRendererAttributes) ( swapPtr, strmPtr->itemMask,
+ (CARD8 *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreeRendererReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangeRenderer) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangeRendererReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_BITMASK (strmPtr->itemMask);
+
+ SWAP_FUNC_PREFIX(SwapRendererAttributes) ( swapPtr, strmPtr->itemMask,
+ (CARD8 *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetRendererAttributes) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetRendererAttributesReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_BITMASK (strmPtr->itemMask);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexGetRendererDynamics; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXBeginRendering) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexBeginRenderingReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexEndRenderingReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXBeginStructure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexBeginStructureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_CARD32 (strmPtr->sid);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexEndStructureReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXRenderOutputCommands) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexRenderOutputCommandsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_CARD32 (strmPtr->numCommands);
+ SwapListOfOutputCommands (cntxtPtr, strmPtr->numCommands,
+ (CARD32 *) (strmPtr + 1));
+ CALL_REQUEST;
+}
+/* individual output commands may be found in the section "Output Commands" */
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXRenderElements) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexRenderElementsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SwapElementRange (swapPtr, &strmPtr->range);
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXAccumulateState) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexAccumulateStateReq *strmPtr;
+{
+ pexElementRef *pe;
+ CARD32 i;
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_CARD32 (strmPtr->numElRefs);
+
+ pe = (pexElementRef *)(strmPtr+1);
+ for (i = 0; i < strmPtr->numElRefs; i++, pe++)
+ SWAP_ELEMENT_REF (*pe);
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXRenderNetwork) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexRenderNetworkReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_STRUCTURE (strmPtr->sid);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexCreateStructureReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopyStructure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyStructureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->src);
+ SWAP_STRUCTURE (strmPtr->dst);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXDestroyStructures) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDestroyStructuresReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexStructure *ps;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD32 (strmPtr->numStructures);
+
+ for (i=0, ps=(pexStructure *)(strmPtr+1); i<strmPtr->numStructures; i++,ps++)
+ SWAP_STRUCTURE ((*ps));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetStructureInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetStructureInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD16 (strmPtr->itemMask);
+ SWAP_STRUCTURE (strmPtr->sid);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetElementInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetElementInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_STRUCTURE (strmPtr->sid);
+
+ SwapElementRange (swapPtr, &strmPtr->range);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetStructuresInNetwork) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetStructuresInNetworkReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD16 (strmPtr->which);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetAncestors) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetAncestorsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD16 (strmPtr->pathOrder);
+ SWAP_CARD32 (strmPtr->pathDepth);
+ CALL_REQUEST;
+}
+
+/* typedef pexGetAncestorsReq pexGetDescendantsReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFetchElements) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexFetchElementsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_STRUCTURE (strmPtr->sid);
+
+ SwapElementRange (swapPtr, &strmPtr->range);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetEditingMode) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetEditingModeReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD16 (strmPtr->mode);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetElementPointer) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetElementPointerReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_ELEMENT_POS (strmPtr->position);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetElementPointerAtLabel) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetElementPointerAtLabelReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD32 (strmPtr->label);
+ SWAP_INT32 (strmPtr->offset);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXElementSearch) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexElementSearchReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ CARD16 *pc;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_ELEMENT_POS (strmPtr->position);
+ SWAP_CARD32 (strmPtr->direction);
+ SWAP_CARD32 (strmPtr->numIncls);
+ SWAP_CARD32 (strmPtr->numExcls);
+
+ pc = (CARD16 *)(strmPtr+1);
+ for (i=0; i< strmPtr->numIncls; i++, pc++)
+ SWAP_CARD16((*pc));
+
+ /* skip pad if there */
+ if (strmPtr->numIncls & 0x1) pc++;
+
+ for (i=0; i< strmPtr->numExcls; i++, pc++)
+ SWAP_CARD16((*pc));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXStoreElements) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexStoreElementsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD32 (strmPtr->numCommands);
+ SwapListOfOutputCommands (cntxtPtr, strmPtr->numCommands,
+ (CARD32 *) (strmPtr + 1));
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXDeleteElements) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDeleteElementsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+
+ SwapElementRange (swapPtr, &strmPtr->range);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXDeleteElementsToLabel) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDeleteElementsToLabelReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_ELEMENT_POS (strmPtr->position);
+ SWAP_CARD32 (strmPtr->label);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXDeleteBetweenLabels) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexDeleteBetweenLabelsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_CARD32 (strmPtr->label1);
+ SWAP_CARD32 (strmPtr->label2);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopyElements) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyElementsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->src);
+
+ SwapElementRange (swapPtr, &strmPtr->srcRange);
+
+ SWAP_STRUCTURE (strmPtr->dst);
+ SWAP_ELEMENT_POS (strmPtr->dstPosition);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangeStructureRefs) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangeStructureRefsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_STRUCTURE (strmPtr->old_id);
+ SWAP_STRUCTURE (strmPtr->new_id);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexCreateNameSetReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopyNameSet) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopyNameSetReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_NAMESET (strmPtr->src);
+ SWAP_NAMESET (strmPtr->dst);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreeNameSetReq;*/
+
+/* typedef pexResourceReq pexGetNameSetReq; */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangeNameSet) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangeNameSetReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i, num;
+ pexName *pn;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_NAMESET (strmPtr->ns);
+ SWAP_CARD16 (strmPtr->action);
+
+ num = (int)(strmPtr->length - (sizeof(pexChangeNameSetReq)/sizeof(CARD32)));
+ for (i=0, pn=(pexName *)(strmPtr+1); i<num; i++, pn++)
+ SWAP_NAME ((*pn));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreateSearchContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreateSearchContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_SC (strmPtr->sc);
+ SWAP_BITMASK (strmPtr->itemMask);
+
+ SWAP_FUNC_PREFIX(SwapSearchContext) ( swapPtr, strmPtr->itemMask,
+ (unsigned char *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCopySearchContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCopySearchContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_SC (strmPtr->src);
+ SWAP_SC (strmPtr->dst);
+ SWAP_BITMASK (strmPtr->itemMask);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreeSearchContextReq;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetSearchContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetSearchContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_SC (strmPtr->sc);
+ SWAP_BITMASK (strmPtr->itemMask);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangeSearchContext) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangeSearchContextReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_SC (strmPtr->sc);
+ SWAP_BITMASK (strmPtr->itemMask);
+
+ SWAP_FUNC_PREFIX(SwapSearchContext) ( swapPtr, strmPtr->itemMask,
+ (unsigned char *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexSearchNetworkReq;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreatePhigsWks) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePhigsWksReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_LOOKUP_TABLE (strmPtr->markerBundle);
+ SWAP_LOOKUP_TABLE (strmPtr->textBundle);
+ SWAP_LOOKUP_TABLE (strmPtr->lineBundle);
+ SWAP_LOOKUP_TABLE (strmPtr->interiorBundle);
+ SWAP_LOOKUP_TABLE (strmPtr->edgeBundle);
+ SWAP_LOOKUP_TABLE (strmPtr->colourTable);
+ SWAP_LOOKUP_TABLE (strmPtr->depthCueTable);
+ SWAP_LOOKUP_TABLE (strmPtr->lightTable);
+ SWAP_LOOKUP_TABLE (strmPtr->colourApproxTable);
+ SWAP_LOOKUP_TABLE (strmPtr->patternTable);
+ SWAP_LOOKUP_TABLE (strmPtr->textFontTable);
+ SWAP_NAMESET (strmPtr->highlightIncl);
+ SWAP_NAMESET (strmPtr->highlightExcl);
+ SWAP_NAMESET (strmPtr->invisIncl);
+ SWAP_NAMESET (strmPtr->invisExcl);
+ SWAP_CARD16 (strmPtr->bufferMode);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreePhigsWksReq;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetWksInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetWksInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_BITMASK (strmPtr->itemMask[0]);
+ SWAP_BITMASK (strmPtr->itemMask[1]);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetDynamics) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetDynamicsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetViewRep) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetViewRepReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_TABLE_INDEX (strmPtr->index);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ CALL_REQUEST;
+}
+
+/*
+typedef pexResourceReq pexRedrawAllStructuresReq;
+
+typedef pexResourceReq pexUpdateWorkstationReq;
+*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXRedrawClipRegion) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexRedrawClipRegionReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_CARD32 (strmPtr->numRects);
+
+ SwapDeviceRects (swapPtr, strmPtr->numRects, (pexDeviceRect *)(strmPtr+1));
+ CALL_REQUEST;
+}
+
+/*
+typedef pexResourceReq pexExecuteDeferredActionsReq;
+*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetViewPriority) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetViewPriorityReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_TABLE_INDEX (strmPtr->index1);
+ SWAP_TABLE_INDEX (strmPtr->index2);
+ SWAP_CARD16 (strmPtr->priority);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetDisplayUpdateMode) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetDisplayUpdateModeReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->displayUpdate);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMapDCtoWC) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexMapDCtoWCReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexDeviceCoord *pc;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_CARD32 (strmPtr->numCoords);
+
+ for (i=0, pc=(pexDeviceCoord *)(strmPtr+1); i<strmPtr->numCoords; i++,pc++)
+ SWAP_DEVICE_COORD((*pc));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMapWCtoDC) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexMapWCtoDCReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexCoord3D *pc;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD16 (strmPtr->index);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_CARD32 (strmPtr->numCoords);
+
+ for ( i=0, pc=(pexCoord3D *)(strmPtr+1); i<strmPtr->numCoords; i++, pc++)
+ SWAP_COORD3D((*pc));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetViewRep) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetViewRepReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+
+ SwapViewRep (swapPtr, &strmPtr->viewRep);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetWksWindow) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetWksWindowReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SwapNpcSubvolume (swapPtr, &strmPtr->npcSubvolume);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetWksViewport) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetWksViewportReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+
+ SwapViewport (swapPtr, &strmPtr->viewport);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetHlhsrMode) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetHlhsrModeReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->mode);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSetWksBufferMode) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexSetWksBufferModeReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_CARD16 (strmPtr->bufferMode);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPostStructure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexPostStructureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_STRUCTURE (strmPtr->sid);
+ SWAP_FLOAT (strmPtr->priority);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXUnpostStructure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexUnpostStructureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_STRUCTURE (strmPtr->sid);
+ CALL_REQUEST;
+}
+
+/*
+typedef pexResourceReq pexUnpostAllStructuresReq;
+
+typedef pexResourceReq pexGetWksPostingsReq;
+*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetPickDevice) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetPickDeviceReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->devType);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_BITMASK (strmPtr->itemMask);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXChangePickDevice) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexChangePickDeviceReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->devType);
+ SWAP_BITMASK (strmPtr->itemMask);
+
+ SWAP_FUNC_PREFIX(SwapPickDevAttr) ( swapPtr, strmPtr->itemMask,
+ (unsigned char *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCreatePickMeasure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexCreatePickMeasureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PHIGS_WKS (strmPtr->wks);
+ SWAP_PICK_MEASURE (strmPtr->pm);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->devType);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexFreePickMeasureReq;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetPickMeasure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetPickMeasureReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PICK_MEASURE (strmPtr->pm);
+ SWAP_BITMASK (strmPtr->itemMask);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXUpdatePickMeasure) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexUpdatePickMeasureReq *strmPtr;
+{
+
+ extern void SwapFLOAT();
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_PICK_MEASURE (strmPtr->pm);
+ SWAP_CARD32 (strmPtr->numBytes);
+ /* SWAP the input data record for the registered devices */
+ if (strmPtr->numBytes == 8) {
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+
+ } else if (strmPtr->numBytes == 24) {
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ } else
+ return(BadLength);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXBeginPickOne) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexBeginPickOneReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->method);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_INT32 (strmPtr->sid);
+
+ SWAP_FUNC_PREFIX(SwapPickRecord) (swapPtr,
+ (pexPickRecord *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXEndPickOne) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexEndPickOneReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPickOne) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexPickOneReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->method);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_STRUCTURE (strmPtr->sid);
+
+ SWAP_FUNC_PREFIX(SwapPickRecord) (swapPtr,
+ (pexPickRecord *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXBeginPickAll) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexBeginPickAllReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->method);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_INT32 (strmPtr->sid);
+ SWAP_CARD32 (strmPtr->pickMaxHits);
+
+ SWAP_FUNC_PREFIX(SwapPickRecord) (swapPtr,
+ (pexPickRecord *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXEndPickAll) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexEndPickAllReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_RENDERER (strmPtr->rdr);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPickAll) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexPickAllReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->method);
+ SWAP_RENDERER (strmPtr->rdr);
+ SWAP_DRAWABLE (strmPtr->drawable);
+ SWAP_CARD32 (strmPtr->pickMaxHits);
+
+ SWAP_FUNC_PREFIX(SwapPickRecord) (swapPtr,
+ (pexPickRecord *)(strmPtr+1));
+
+ CALL_REQUEST;
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXOpenFont) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexOpenFontReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_FONT (strmPtr->font);
+ SWAP_CARD32 (strmPtr->numBytes);
+ CALL_REQUEST;
+}
+
+/* typedef pexResourceReq pexCloseFontReq;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXQueryFont) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexQueryFontReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_FONT (strmPtr->font);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXListFonts) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexListFontsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD16 (strmPtr->maxNames);
+ SWAP_CARD16 (strmPtr->numChars);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXListFontsWithInfo) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexListFontsWithInfoReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD16 (strmPtr->maxNames);
+ SWAP_CARD16 (strmPtr->numChars);
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXQueryTextExtents) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexQueryTextExtentsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ pexMonoEncoding *pEnc;
+ CARD32 *numEnc;
+ int bytes, i;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD16 (strmPtr->textPath);
+ SWAP_CARD16 (strmPtr->fontGroupIndex);
+ SWAP_CARD32 (strmPtr->id);
+ SWAP_FLOAT (strmPtr->charExpansion);
+ SWAP_FLOAT (strmPtr->charSpacing);
+ SWAP_FLOAT (strmPtr->charHeight);
+
+ SwapTextAlignmentData(swapPtr, &strmPtr->textAlignment);
+
+ SWAP_CARD32 (strmPtr->numStrings);
+
+ numEnc = (CARD32 *) (strmPtr + 1);
+
+ for (i = 0; i < strmPtr->numStrings; i++)
+ {
+ SWAP_CARD32 (*numEnc);
+
+ pEnc = (pexMonoEncoding *) (numEnc + 1);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, pEnc, *numEnc);
+
+ bytes = pEnc->numChars * ((pEnc->characterSetWidth == PEXCSByte) ?
+ sizeof(CARD8) : ((pEnc->characterSetWidth == PEXCSShort) ?
+ sizeof(CARD16) : sizeof(CARD32)));
+
+ numEnc = (CARD32 *) ((char *) (pEnc + 1) + bytes + PADDING (bytes));
+ }
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGetImpDepConstants) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexGetImpDepConstantsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD16 *ptr = (CARD16 *)(strmPtr+1);
+ CARD32 i;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_ENUM_TYPE_INDEX (strmPtr->fpFormat);
+ SWAP_CARD32 (strmPtr->drawable);
+ SWAP_CARD32 (strmPtr->numNames);
+
+ for (i=0; i<strmPtr->numNames; i++, ptr++)
+ SWAP_CARD16 ((*ptr));
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMatchRendererTargets) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexMatchRendererTargetsReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD32 (strmPtr->drawable);
+ SWAP_CARD16 (strmPtr->type);
+ SWAP_CARD32 (strmPtr->visualID);
+ SWAP_CARD32 (strmPtr->maxTriplets);
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXEscape) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexEscapeReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD32 (strmPtr->escapeID);
+
+ /* do MIT Registered Escapes */
+ switch (strmPtr->escapeID) {
+ case PEXEscapeSetEchoColour: {
+ pexEscapeSetEchoColourData *psec;
+
+ psec = (pexEscapeSetEchoColourData *)(strmPtr+1);
+ SWAP_ENUM_TYPE_INDEX (psec->fpFormat);
+ SWAP_CARD32 (psec->rdr);
+ SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)(psec+1));
+ break;
+ }
+ }
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXEscapeWithReply) (cntxtPtr, strmPtr)
+pexContext *cntxtPtr;
+pexEscapeWithReplyReq *strmPtr;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (strmPtr->length);
+ SWAP_CARD16 (strmPtr->escapeID);
+
+ /* do MIT Registered Escapes , none with Replies */
+ /*
+ switch (strmPtr->escapeID) {
+ }
+ */
+
+
+ CALL_REQUEST;
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(RequestUnused)()
+{
+
+}
+
+
+/****************************************************************
+ * utilities *
+ ****************************************************************/
+void
+SWAP_FUNC_PREFIX(SwapTable)(swapPtr, TType, num, where)
+pexSwap *swapPtr;
+pexTableType TType;
+CARD32 num;
+unsigned char *where;
+{
+ int i;
+ unsigned char *ptr = where;
+
+ switch (TType) {
+ case PEXLineBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapLineBundleEntry) (swapPtr,
+ (pexLineBundleEntry *)ptr);
+ break; }
+
+ case PEXMarkerBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) (swapPtr,
+ (pexMarkerBundleEntry *)ptr);
+ break; }
+
+ case PEXTextBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapTextBundleEntry) (swapPtr,
+ (pexTextBundleEntry *)ptr);
+ break; }
+
+ case PEXInteriorBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) (swapPtr,
+ (pexInteriorBundleEntry *)(ptr));
+ break; }
+
+ case PEXEdgeBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) (swapPtr,
+ (pexEdgeBundleEntry *)(ptr));
+ break; }
+
+ case PEXPatternLUT: {
+ pexPatternEntry *pe;
+ for (i=0; i<num; i++) {
+ pe = (pexPatternEntry *)ptr;
+ SWAP_CARD16 (pe->numx);
+ SWAP_CARD16 (pe->numy);
+ ptr = SWAP_FUNC_PREFIX(SwapPatternEntry) ( swapPtr, pe,
+ pe->numx, pe->numy);
+ };
+ break; }
+
+ case PEXTextFontLUT: {
+ for ( i=0; i<num; i++, ptr += sizeof(pexFont)) {
+ SWAP_FONT ((*(pexFont *)ptr));
+ }
+ break; }
+
+ case PEXColourLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ break; }
+
+ case PEXViewLUT: {
+ pexViewEntry *pv = (pexViewEntry *)ptr;
+ for ( i=0; i<num; i++, pv++)
+ SwapViewEntry (swapPtr, pv);
+ break; }
+
+ case PEXLightLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapLightEntry) (swapPtr,
+ (pexLightEntry *)(ptr));
+ break; }
+
+ case PEXDepthCueLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapDepthCueEntry) (swapPtr,
+ (pexDepthCueEntry *)(ptr));
+ break; }
+
+ case PEXColourApproxLUT: {
+ extern void SwapColourApproxEntry();
+ pexColourApproxEntry *pa = (pexColourApproxEntry *)ptr;
+ for ( i=0; i<num; i++, pa++)
+ SwapColourApproxEntry( swapPtr, pa);
+ break; }
+
+ }
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapSearchContext)(swapPtr, im, ptr)
+pexSwap *swapPtr;
+CARD32 im;
+unsigned char *ptr;
+{
+ unsigned char *sc_data = ptr;
+
+ if (im & PEXSCPosition) {
+ SWAP_COORD3D ((*((pexCoord3D *)sc_data)));
+ sc_data += sizeof(pexCoord3D);
+ };
+
+ if (im & PEXSCDistance) {
+ SWAP_FLOAT ((*((PEXFLOAT *)sc_data)));
+ sc_data += sizeof(PEXFLOAT);
+ };
+
+ /* next 2 are sent as CARD32 so swap them as if they are */
+ if (im & PEXSCCeiling) {
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof(CARD32);
+ }
+
+ if (im & PEXSCModelClipFlag) {
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof (CARD32);
+ }
+
+ if (im & PEXSCStartPath)
+ {
+ int len, i;
+ pexElementRef *pe;
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ len = *((CARD32 *) sc_data);
+ sc_data += sizeof(CARD32);
+ for (i=0, pe = (pexElementRef *) sc_data; i<len; i++, pe++)
+ {
+ SWAP_ELEMENT_REF (*pe);
+ }
+ sc_data = (unsigned char *) pe;
+ }
+
+ if (im & PEXSCNormalList)
+ {
+ int len, i;
+ CARD32 *ns;
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ len = *((CARD32 *) sc_data);
+ sc_data += sizeof (CARD32);
+ for (i=0, ns = (CARD32 *) sc_data; i < len; i++, ns += 2)
+ {
+ SWAP_NAMESET (ns[0]);
+ SWAP_NAMESET (ns[1]);
+ }
+ sc_data = (unsigned char *) ns;
+ }
+
+ if (im & PEXSCInvertedList)
+ {
+ int len, i;
+ CARD32 *ns;
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ len = *((CARD32 *) sc_data);
+ sc_data += sizeof (CARD32);
+ for (i=0, ns = (CARD32 *) sc_data; i < len; i++, ns += 2)
+ {
+ SWAP_NAMESET (ns[0]);
+ SWAP_NAMESET (ns[1]);
+ }
+ sc_data = (unsigned char *) ns;
+ }
+}
+
+CARD8 *
+SWAP_FUNC_PREFIX(SwapFontInfo) (swapPtr, pfi)
+pexSwap *swapPtr;
+pexFontInfo *pfi;
+{
+ CARD8 *ptr;
+ CARD32 i;
+ pexFontProp *pfp;
+
+ SWAP_CARD32 (pfi->firstGlyph);
+ SWAP_CARD32 (pfi->lastGlyph);
+ SWAP_CARD32 (pfi->defaultGlyph);
+ SWAP_CARD32 (pfi->numProps);
+
+ pfp = (pexFontProp *)(pfi+1);
+ for (i=0; i<pfi->numProps; i++)
+ pfp = (pexFontProp *)(SwapFontProp(swapPtr, pfp));
+
+ ptr = (CARD8 *)pfp;
+ return (ptr);
+}
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapLightEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexLightEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->lightType);
+ SWAP_VECTOR3D (p_data->direction);
+ SWAP_COORD3D (p_data->point);
+ SWAP_FLOAT (p_data->concentration);
+ SWAP_FLOAT (p_data->spreadAngle);
+ SWAP_FLOAT (p_data->attenuation1);
+ SWAP_FLOAT (p_data->attenuation2);
+
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->lightColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapLineBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexLineBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->lineType);
+ SWAP_ENUM_TYPE_INDEX (p_data->polylineInterp);
+ SWAP_FLOAT (p_data->lineWidth);
+ SWAP_CURVE_APPROX (p_data->curveApprox);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->lineColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexMarkerBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->markerType);
+ SWAP_FLOAT (p_data->markerScale);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->markerColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapTextBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexTextBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_CARD16 (p_data->textFontIndex);
+ SWAP_CARD16 (p_data->textPrecision);
+ SWAP_FLOAT (p_data->charExpansion);
+ SWAP_FLOAT (p_data->charSpacing);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->textColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexInteriorBundleEntry *p_data;
+{
+ unsigned char *po;
+ SWAP_ENUM_TYPE_INDEX (p_data->interiorStyle);
+ SWAP_INT16 (p_data->interiorStyleIndex);
+ SWAP_ENUM_TYPE_INDEX (p_data->reflectionModel);
+ SWAP_ENUM_TYPE_INDEX (p_data->surfaceInterp);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfInteriorStyle);
+ SWAP_INT16 (p_data->bfInteriorStyleIndex);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfReflectionModel);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfSurfaceInterp);
+
+ SwapSurfaceApprox (swapPtr, &(p_data->surfaceApprox));
+ po = (unsigned char *)(p_data+1);
+ po = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)po);
+ po = SWAP_FUNC_PREFIX(SwapReflectionAttr) ( swapPtr,
+ (pexReflectionAttr *)po);
+ po = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)po);
+ po = SWAP_FUNC_PREFIX(SwapReflectionAttr) ( swapPtr,
+ (pexReflectionAttr *)po);
+
+ return (po);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexEdgeBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->edgeType);
+ SWAP_FLOAT (p_data->edgeWidth);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->edgeColour));
+
+ return (ptr);
+}
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapDepthCueEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexDepthCueEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_FLOAT (p_data->frontPlane);
+ SWAP_FLOAT (p_data->backPlane);
+ SWAP_FLOAT (p_data->frontScaling);
+ SWAP_FLOAT (p_data->backScaling);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->depthCueColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapPatternEntry) (swapPtr, p_data, numx, numy)
+pexSwap *swapPtr;
+pexPatternEntry *p_data;
+CARD16 numx;
+CARD16 numy;
+{
+ int i, max_colours;
+ pexColour *pc = (pexColour *)(p_data + 1);
+
+ SWAP_COLOUR_TYPE (p_data->colourType);
+
+ max_colours = numx * numy;
+ for (i=0; i<max_colours; i++)
+ pc = (pexColour *) SwapColour (swapPtr, pc, p_data->colourType);
+
+
+ return ((unsigned char *)pc);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapPipelineContextAttr) (swapPtr, itemMask, p_data)
+pexSwap *swapPtr;
+CARD32 *itemMask;
+CARD8 *p_data;
+{
+ /* NOTE: See the Protocol Encoding for a desription of these fields
+ in places where CARD16 or INT16 are packed into a 4 byte field
+ (essentially a CARD32) for transmission these fields must be
+ byte swapped as a CARD32. - JSH
+ */
+
+ CARD8 *ptr = p_data;
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerScale) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextFont) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPrecision) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharExpansion) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharSpacing) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharHeight) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharUpVector) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextAlignment) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextHeight) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextUpVector) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextAlignment) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineWidth) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCurveApproximation) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPolylineInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflAttr) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflModel) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflAttr) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflModel) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceApproximation) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCullingMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDistinguishFlag) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternSize) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefPt) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec1) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec2) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeFlag) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeWidth) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCEdgeBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLocalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCGlobalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClip) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClipVolume) {
+ CARD32 i, numHalfSpace;
+ pexHalfSpace *ph;
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ numHalfSpace = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+ for (i=0, ph = (pexHalfSpace *)ptr; i<numHalfSpace; i++, ph++) {
+ SwapHalfSpace (swapPtr, ph);
+ }
+ ptr = (CARD8 *)ph;
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCViewIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLightState) {
+ CARD32 i, numLights;
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ numLights = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+ for (i=0; i<numLights; i++) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+ if (numLights%2) /* pad odd length list to CARD32 boundary */
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDepthCueIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSetAsfValues) {
+ SWAP_CARD32 ((*((CARD32 *)ptr))); /* enables BITMASK */
+ ptr += sizeof(CARD32);
+ SWAP_CARD32 ((*((CARD32 *)ptr))); /* asfs themselves */
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPickId) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCHlhsrIdentifier) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCNameSet) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCColourApproxIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCRenderingColourModel) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCParaSurfCharacteristics) {
+ INT16 type;
+ SWAP_INT16((*((INT16 *)ptr)));
+ type = *((INT16 *)ptr);
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ switch (type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep: break;
+
+ case PEXPSCIsoCurves: {
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves:
+ case PEXPSCWcLevelCurves: {
+ CARD16 i, num;
+ SWAP_COORD3D((*((pexCoord3D *)ptr)));
+ ptr += sizeof(pexCoord3D);
+ SWAP_VECTOR3D((*((pexVector3D *)ptr)));
+ ptr += sizeof(pexVector3D);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ num = *((CARD16 *)ptr);
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+ }
+ }
+
+ return (ptr);
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapPickDevAttr) (swapPtr, im, pdata)
+pexSwap *swapPtr;
+CARD32 im;
+unsigned char *pdata;
+{
+ unsigned char *ptr = pdata;
+ int len, i;
+
+ if (im & PEXPDPickStatus) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ len = (int)(*ptr);
+ ptr += sizeof(CARD32);
+ for (i=0; i<len; i++, ptr += sizeof(pexPickElementRef)) {
+ SWAP_PICK_ELEMENT_REF ((*((pexPickElementRef *)ptr)));
+ };
+ };
+
+ if (im & PEXPDPickPathOrder) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickIncl) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ };
+
+ if (im & PEXPDPickExcl) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ };
+
+ if (im & PEXPDPickDataRec) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ len = (int)(*ptr);
+ ptr += sizeof(CARD32);
+ ptr += len + PADDING(len); /* pad it out */
+ };
+
+ if (im & PEXPDPickPromptEchoType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickEchoVolume) {
+ SwapViewport(swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ }
+
+ if (im & PEXPDPickEchoSwitch) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ }
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapRendererAttributes) (swapPtr, im, p_data)
+pexSwap *swapPtr;
+CARD32 im;
+CARD8 *p_data;
+{
+ CARD8 *ptr = p_data;
+ CARD32 num, i;
+
+ if (im & PEXRDPipelineContext) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDCurrentPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ num = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++, ptr += sizeof(pexElementRef))
+ SWAP_ELEMENT_REF((*((pexElementRef *)ptr)));
+ }
+
+ if (im & PEXRDMarkerBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDTextBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDLineBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInteriorBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDEdgeBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDViewTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDColourTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDDepthCueTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDLightTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDColourApproxTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDPatternTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDTextFontTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHighlightIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHighlightExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInvisibilityIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInvisibilityExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* Swap this and HLHSR as CARD32 since they're in a 4 byte field in
+ the LISTofVALUE */
+
+ if (im & PEXRDRendererState) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHlhsrMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+
+ }
+
+ if (im & PEXRDNpcSubvolume) {
+ SwapNpcSubvolume (swapPtr, (pexNpcSubvolume *)ptr);
+ ptr += sizeof(pexNpcSubvolume);
+ }
+
+ if (im & PEXRDViewport) {
+ SwapViewport (swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ }
+
+ if (im & PEXRDClipList) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ num = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+ SwapDeviceRects (swapPtr, num, (pexDeviceRect *)ptr);
+ ptr += sizeof(pexDeviceRect) * num;
+ }
+
+ if (im & PEXRDPickInclusion) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ }
+
+ if (im & PEXRDPickExclusion) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ }
+
+ if (im & PEXRDPickStartPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ num = *((CARD32 *)ptr);
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++, ptr += sizeof(pexElementRef))
+ SWAP_ELEMENT_REF((*((pexElementRef *)ptr)));
+ }
+
+ if (im & PEXRDBackgroundColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ /* this is CARD8 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDClearI) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* this is CARD8 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDClearZ) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* this is CARD16 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDEchoMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+}
+
+void
+SWAP_FUNC_PREFIX(SwapPickRecord) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexPickRecord *p_data;
+{
+
+ SWAP_CARD16 (p_data->pickType);
+
+ switch(p_data->pickType) {
+ case PEXPickDeviceDC_HitBox: {
+ unsigned char *ptr = (unsigned char *)(p_data+1);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ break;
+ }
+ case PEXPickDeviceNPC_HitVolume: {
+ unsigned char *ptr = (unsigned char *)(p_data+1);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ break;
+ }
+ }
+}
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convReq.h b/xc/programs/Xserver/PEX5/dipex/swap/convReq.h
new file mode 100644
index 000000000..4fc2f83b3
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convReq.h
@@ -0,0 +1,153 @@
+/* $TOG: convReq.h /main/4 1998/02/10 12:37:23 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+LOCAL_FLAG ErrorCode
+ SWAP_FUNC_PREFIX(PEXRequestUnused)(),
+ SWAP_FUNC_PREFIX(PEXGenericRequest) (),
+ SWAP_FUNC_PREFIX(PEXGenericResourceRequest) (),
+ SWAP_FUNC_PREFIX(PEXGetExtensionInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetEnumeratedTypeInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetImpDepConstants) (),
+ SWAP_FUNC_PREFIX(PEXCreateLookupTable) (),
+ SWAP_FUNC_PREFIX(PEXCopyLookupTable) (),
+ SWAP_FUNC_PREFIX(PEXGetTableInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetPredefinedEntries) (),
+ SWAP_FUNC_PREFIX(PEXGetTableEntry) (),
+ SWAP_FUNC_PREFIX(PEXGetTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXSetTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXDeleteTableEntries) (),
+ SWAP_FUNC_PREFIX(PEXCreatePipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXCopyPipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXGetPipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXChangePipelineContext) (),
+ SWAP_FUNC_PREFIX(PEXCreateRenderer) (),
+ SWAP_FUNC_PREFIX(PEXChangeRenderer) (),
+ SWAP_FUNC_PREFIX(PEXGetRendererAttributes) (),
+ SWAP_FUNC_PREFIX(PEXBeginRendering) (),
+ SWAP_FUNC_PREFIX(PEXBeginStructure) (),
+ SWAP_FUNC_PREFIX(PEXRenderOutputCommands) (),
+ SWAP_FUNC_PREFIX(PEXRenderNetwork) (),
+ SWAP_FUNC_PREFIX(PEXCopyStructure) (),
+ SWAP_FUNC_PREFIX(PEXDestroyStructures) (),
+ SWAP_FUNC_PREFIX(PEXGetStructureInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetElementInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetStructuresInNetwork) (),
+ SWAP_FUNC_PREFIX(PEXGetAncestors) (),
+ SWAP_FUNC_PREFIX(PEXFetchElements) (),
+ SWAP_FUNC_PREFIX(PEXSetEditingMode) (),
+ SWAP_FUNC_PREFIX(PEXSetElementPointer) (),
+ SWAP_FUNC_PREFIX(PEXSetElementPointerAtLabel) (),
+ SWAP_FUNC_PREFIX(PEXElementSearch) (),
+ SWAP_FUNC_PREFIX(PEXStoreElements) (),
+ SWAP_FUNC_PREFIX(PEXDeleteElements) (),
+ SWAP_FUNC_PREFIX(PEXDeleteElementsToLabel) (),
+ SWAP_FUNC_PREFIX(PEXDeleteBetweenLabels) (),
+ SWAP_FUNC_PREFIX(PEXCopyElements) (),
+ SWAP_FUNC_PREFIX(PEXChangeStructureRefs) (),
+ SWAP_FUNC_PREFIX(PEXCopyNameSet) (),
+ SWAP_FUNC_PREFIX(PEXChangeNameSet) (),
+ SWAP_FUNC_PREFIX(PEXCreateSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXCopySearchContext) (),
+ SWAP_FUNC_PREFIX(PEXGetSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXChangeSearchContext) (),
+ SWAP_FUNC_PREFIX(PEXCreatePhigsWks) (),
+ SWAP_FUNC_PREFIX(PEXGetWksInfo) (),
+ SWAP_FUNC_PREFIX(PEXGetDynamics) (),
+ SWAP_FUNC_PREFIX(PEXGetViewRep) (),
+ SWAP_FUNC_PREFIX(PEXRedrawClipRegion) (),
+ SWAP_FUNC_PREFIX(PEXSetViewPriority) (),
+ SWAP_FUNC_PREFIX(PEXSetDisplayUpdateMode) (),
+ SWAP_FUNC_PREFIX(PEXMapDCtoWC) (),
+ SWAP_FUNC_PREFIX(PEXMapWCtoDC) (),
+ SWAP_FUNC_PREFIX(PEXSetViewRep) (),
+ SWAP_FUNC_PREFIX(PEXSetWksWindow) (),
+ SWAP_FUNC_PREFIX(PEXSetWksViewport) (),
+ SWAP_FUNC_PREFIX(PEXSetHlhsrMode) (),
+ SWAP_FUNC_PREFIX(PEXSetWksBufferMode) (),
+ SWAP_FUNC_PREFIX(PEXPostStructure) (),
+ SWAP_FUNC_PREFIX(PEXUnpostStructure) (),
+ SWAP_FUNC_PREFIX(PEXGetPickDevice) (),
+ SWAP_FUNC_PREFIX(PEXChangePickDevice) (),
+ SWAP_FUNC_PREFIX(PEXCreatePickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXGetPickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXUpdatePickMeasure) (),
+ SWAP_FUNC_PREFIX(PEXOpenFont) (),
+ SWAP_FUNC_PREFIX(PEXQueryFont) (),
+ SWAP_FUNC_PREFIX(PEXListFonts) (),
+ SWAP_FUNC_PREFIX(PEXListFontsWithInfo) (),
+ SWAP_FUNC_PREFIX(PEXQueryTextExtents) (),
+ SWAP_FUNC_PREFIX(PEXMatchRendererTargets) (),
+ SWAP_FUNC_PREFIX(PEXEscape) (),
+ SWAP_FUNC_PREFIX(PEXEscapeWithReply) (),
+ SWAP_FUNC_PREFIX(PEXRenderElements) (),
+ SWAP_FUNC_PREFIX(PEXAccumulateState) (),
+ SWAP_FUNC_PREFIX(PEXBeginPickOne) (),
+ SWAP_FUNC_PREFIX(PEXEndPickOne) (),
+ SWAP_FUNC_PREFIX(PEXPickOne) (),
+ SWAP_FUNC_PREFIX(PEXBeginPickAll) (),
+ SWAP_FUNC_PREFIX(PEXEndPickAll) (),
+ SWAP_FUNC_PREFIX(PEXPickAll) ();
+
+
+LOCAL_FLAG void
+ SWAP_FUNC_PREFIX(SwapTable)(),
+ SWAP_FUNC_PREFIX(SwapSearchContext)(),
+ SWAP_FUNC_PREFIX(SwapPickMeasAttr) (),
+ SWAP_FUNC_PREFIX(SwapPickDevAttr) (),
+ SWAP_FUNC_PREFIX(SwapPickRecord) (),
+ SWAP_FUNC_PREFIX(SwapRendererAttributes) ();
+
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapLightEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapLineBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapTextBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapDepthCueEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapPatternEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapPipelineContextAttr) ();
+
+LOCAL_FLAG CARD8 * SWAP_FUNC_PREFIX(SwapFontInfo) ();
+
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convUtil.c b/xc/programs/Xserver/PEX5/dipex/swap/convUtil.c
new file mode 100644
index 000000000..ddde0c241
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convUtil.c
@@ -0,0 +1,227 @@
+/* $TOG: convUtil.c /main/5 1998/02/10 12:37:28 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "convertStr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG
+#include "convUtil.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG extern
+#include "OCattr.h"
+#undef LOCAL_FLAG
+
+/*
+ Composite Conversions
+ */
+
+
+void
+SwapViewport(swapPtr, ptr)
+pexSwap *swapPtr;
+pexViewport *ptr;
+{
+ SWAP_DEVICE_COORD (ptr->minval);
+ SWAP_DEVICE_COORD (ptr->maxval);
+}
+
+void
+SwapViewEntry(swapPtr, ptr)
+pexSwap *swapPtr;
+pexViewEntry *ptr;
+{
+ SWAP_CARD16 (ptr->clipFlags);
+
+ SwapNpcSubvolume (swapPtr, &(ptr->clipLimits));
+
+ SWAP_MATRIX (ptr->orientation);
+ SWAP_MATRIX (ptr->mapping);
+}
+
+void
+SwapViewRep(swapPtr, ptr)
+pexSwap *swapPtr;
+pexViewRep *ptr;
+{
+ SWAP_TABLE_INDEX (ptr->index);
+ SwapViewEntry (swapPtr, &(ptr->view));
+}
+
+
+void
+SwapColourApproxEntry(swapPtr, ptr)
+pexSwap *swapPtr;
+pexColourApproxEntry *ptr;
+{
+ SWAP_INT16 (ptr->approxType);
+ SWAP_INT16 (ptr->approxModel);
+ SWAP_CARD16 (ptr->max1);
+ SWAP_CARD16 (ptr->max2);
+ SWAP_CARD16 (ptr->max3);
+ SWAP_CARD32 (ptr->mult1);
+ SWAP_CARD32 (ptr->mult2);
+ SWAP_CARD32 (ptr->mult3);
+ SWAP_FLOAT (ptr->weight1);
+ SWAP_FLOAT (ptr->weight2);
+ SWAP_FLOAT (ptr->weight3);
+ SWAP_CARD32 (ptr->basePixel);
+}
+
+
+void
+SwapDeviceRects(swapPtr, num, ptr)
+pexSwap *swapPtr;
+CARD32 num;
+pexDeviceRect *ptr;
+{
+ CARD32 i;
+ pexDeviceRect *pdr = ptr;
+ for (i=0; i<num; i++, pdr++){
+ SWAP_CARD16(pdr->xmin);
+ SWAP_CARD16(pdr->ymin);
+ SWAP_CARD16(pdr->xmax);
+ SWAP_CARD16(pdr->ymax);
+ }
+}
+
+void
+SwapExtentInfo (swapPtr, num, pe)
+pexSwap *swapPtr;
+CARD32 num;
+pexExtentInfo *pe;
+{
+ CARD32 i;
+ for (i=0; i<num; i++, pe++) {
+ SWAP_FLOAT (pe->lowerLeft.x);
+ SWAP_FLOAT (pe->lowerLeft.y);
+ SWAP_FLOAT (pe->upperRight.x);
+ SWAP_FLOAT (pe->upperRight.y);
+ SWAP_FLOAT (pe->concatpoint.x);
+ SWAP_FLOAT (pe->concatpoint.y);
+ }
+}
+
+
+unsigned char *
+SwapFontProp (swapPtr, pfp)
+pexSwap *swapPtr;
+pexFontProp *pfp;
+{
+ SWAP_CARD32 (pfp->name);
+ SWAP_CARD32 (pfp->value);
+ pfp++;
+
+ return (((unsigned char *)pfp));
+}
+
+
+void
+SwapElementRange(swapPtr, pe)
+pexSwap *swapPtr;
+pexElementRange *pe;
+{
+ SWAP_ELEMENT_POS (pe->position1);
+ SWAP_ELEMENT_POS (pe->position2);
+}
+
+
+void
+SwapLocaltransform3ddata(swapPtr, pg)
+pexSwap *swapPtr;
+pexLocalTransform3DData *pg;
+{
+ SWAP_CARD16 (pg->composition);
+ SWAP_MATRIX (pg->matrix);
+}
+
+void
+SwapLocalTransform2DData(swapPtr, pg)
+pexSwap *swapPtr;
+pexLocalTransform2DData *pg;
+{
+ SWAP_CARD16 (pg->composition);
+ SWAP_MATRIX_3X3 (pg->matrix);
+}
+
+
+void
+SwapNpcSubvolume(swapPtr, ps)
+pexSwap *swapPtr;
+pexNpcSubvolume *ps;
+{
+ SWAP_COORD3D (ps->minval);
+ SWAP_COORD3D (ps->maxval);
+}
+
+
+
+SwapListOfOutputCommands (cntxtPtr, num, oc)
+pexContext *cntxtPtr;
+CARD32 num;
+CARD32 *oc;
+{
+ pexElementInfo *pe;
+ int i;
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ for (i = 0; i < num; i++)
+ {
+ pe = (pexElementInfo *) oc;
+ SWAP_ELEMENT_INFO (*pe);
+ if (PEXOCAll < pe->elementType && pe->elementType <= PEXMaxOC)
+ cntxtPtr->pexSwapRequestOC[pe->elementType](cntxtPtr->swap,pe);
+ oc += pe->length;
+ }
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convUtil.h b/xc/programs/Xserver/PEX5/dipex/swap/convUtil.h
new file mode 100644
index 000000000..d4f757872
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convUtil.h
@@ -0,0 +1,65 @@
+/* $TOG: convUtil.h /main/3 1998/02/10 12:37:34 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+LOCAL_FLAG void
+ SwapElementRange(),
+ SwapElementRef(),
+ SwapEnumTypeDesc(),
+ SwapFormat(),
+ SwapLocalTransform3DData(),
+ SwapLocalTransform2DData(),
+ SwapNpcSubvolume(),
+ SwapTextAlignmentData(),
+ SwapViewport(),
+ SwapViewEntry(),
+ SwapViewRep(),
+ SwapFontEntry(),
+ SwapViewEntry(),
+ SwapRgbApproxEntry(),
+ Swapdevicerects(),
+ SwapExtentInfo(),
+ SwapIntensityApproxEntry();
+
+LOCAL_FLAG unsigned char *SwapFontProp();
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/convertStr.h b/xc/programs/Xserver/PEX5/dipex/swap/convertStr.h
new file mode 100644
index 000000000..616a66bc2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/convertStr.h
@@ -0,0 +1,196 @@
+/* $TOG: convertStr.h /main/5 1998/02/10 12:37:40 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef CONVERTSTR_H
+#define CONVERTSTR_H 1
+
+#include "SwapConv.h"
+
+extern unsigned char temp; /* only used for conversions */
+
+/*
+ Contains macros to convert pex data structures
+ */
+
+
+#define SWAP_CARD32(a) SWAPINT(a)
+
+#define SWAP_INT32(a) SWAPINT(a)
+
+#define SWAP_CARD16(a) SWAPSHORT(a)
+
+#define SWAP_INT16(a) SWAPSHORT(a)
+
+#define SWAP_FLOAT(a) SWAPFLOAT(a)
+
+#define SWAP_DRAWABLE(a) SWAP_CARD32(a)
+#define SWAP_ASF_ATTR(a) SWAP_CARD32(a)
+#define SWAP_BITMASK(a) SWAP_CARD32(a)
+#define SWAP_BITMASK_SHORT(a) SWAP_CARD16(a)
+#define SWAP_COLOUR_TYPE(a) SWAP_CARD16(a)
+#define SWAP_COORD_TYPE(a) SWAP_CARD16(a)
+#define SWAP_COMPOSITION(a) SWAP_CARD16(a)
+#define SWAP_CULL_MODE(a) SWAP_CARD16(a)
+#define SWAP_ENUM_TYPE_INDEX(a) SWAP_INT16(a)
+#define SWAP_LOOKUP_TABLE(a) SWAP_CARD32(a)
+#define SWAP_NAME(a) SWAP_CARD32(a)
+#define SWAP_NAMESET(a) SWAP_CARD32(a)
+#define SWAP_PC(a) SWAP_CARD32(a)
+#define SWAP_FONT(a) SWAP_CARD32(a)
+
+#define SWAP_MATRIX(m) {\
+ int i, j; \
+ for (i=0; i<4; i++) \
+ for (j=0; j<4; j++) \
+ SWAP_FLOAT((m)[i][j]); }
+
+#define SWAP_MATRIX_3X3(m) {\
+ int i, j; \
+ for (i=0; i<3; i++) \
+ for (j=0; j<3; j++) \
+ SWAP_FLOAT((m)[i][j]); }
+
+
+#define SWAP_PHIGS_WKS(a) SWAP_CARD32(a)
+#define SWAP_PICK_MEASURE(a) SWAP_CARD32(a)
+#define SWAP_RENDERER(a) SWAP_CARD32(a)
+#define SWAP_SC(a) SWAP_CARD32(a)
+#define SWAP_STRUCTURE(a) SWAP_CARD32(a)
+#define SWAP_TABLE_INDEX(a) SWAP_CARD16(a)
+#define SWAP_TABLE_TYPE(a) SWAP_CARD16(a)
+#define SWAP_TEXT_H_ALIGNMENT(a) SWAP_CARD16(a)
+#define SWAP_TEXT_V_ALIGNMENT(a) SWAP_CARD16(a)
+#define SWAP_TYPE_OR_TABLEINDEX(a) SWAP_CARD16(a)
+
+#define SWAP_STRING(S) SWAP_CARD16 ((S).length)
+
+#define SWAP_VECTOR2D(V) {\
+ SWAP_FLOAT ((V).x);\
+ SWAP_FLOAT ((V).y); }
+
+#define SWAP_VECTOR3D(V) {\
+ SWAP_FLOAT ((V).x);\
+ SWAP_FLOAT ((V).y);\
+ SWAP_FLOAT ((V).z);}
+
+#define SWAP_COORD2D(a) SWAP_VECTOR2D(a)
+#define SWAP_COORD3D(a) SWAP_VECTOR3D(a)
+
+#define SWAP_COORD4D(V) {\
+ SWAP_FLOAT ((V).x);\
+ SWAP_FLOAT ((V).y);\
+ SWAP_FLOAT ((V).z);\
+ SWAP_FLOAT ((V).w);}
+
+#define SWAP_RGB_FLOAT_COLOUR(C) {\
+ SWAP_FLOAT ((C).red);\
+ SWAP_FLOAT ((C).green);\
+ SWAP_FLOAT ((C).blue); }
+
+#define SWAP_HSV_COLOUR(C) {\
+ SWAP_FLOAT ((C).hue);\
+ SWAP_FLOAT ((C).saturation);\
+ SWAP_FLOAT ((C).value); }
+
+#define SWAP_HLS_COLOUR(C) {\
+ SWAP_FLOAT ((C).hue);\
+ SWAP_FLOAT ((C).lightness);\
+ SWAP_FLOAT ((C).saturation); }
+
+#define SWAP_CIE_COLOUR(a) SWAP_VECTOR3D(a)
+
+#define SWAP_RGB16_COLOUR(C) {\
+ SWAP_CARD16 ((C).red);\
+ SWAP_CARD16 ((C).green);\
+ SWAP_CARD16 ((C).blue); }
+
+
+#define SWAP_INDEXED_COLOUR(C) SWAP_TABLE_INDEX ((C).index)
+
+#define SWAP_CURVE_APPROX(S) {\
+ SWAP_ENUM_TYPE_INDEX ((S).approxMethod); \
+ SWAP_FLOAT ((S).tolerance); }
+
+#define SWAP_DEVICE_COORD(C) {\
+ SWAP_CARD16 ((C).x); \
+ SWAP_CARD16 ((C).y);\
+ SWAP_FLOAT ((C).z); }
+
+#define SWAP_ELEMENT_INFO(C) {\
+ SWAP_CARD16 ((C).elementType);\
+ SWAP_CARD16 ((C).length); }
+
+#define SWAP_ELEMENT_POS(C) {\
+ SWAP_CARD16 ((C).whence);\
+ SWAP_INT32 ((C).offset); }
+
+#define SWAP_ELEMENT_REF(C) {\
+ SWAP_STRUCTURE ((C).structure);\
+ SWAP_CARD32 ((C).offset); }
+
+#define SWAP_EDGEOPT(E) SWAP_CARD16 ((E).edge)
+
+#define SWAP_ENUM_TYPE_DESC(D) {\
+ SWAP_ENUM_TYPE_INDEX ((D).index); \
+ SWAP_STRING ((D).descriptor); }
+
+#define SWAP_TEXT_ALIGN_DATA(A) { \
+ SWAP_TEXT_H_ALIGNMENT((A).horizontal); \
+ SWAP_TEXT_V_ALIGNMENT((A).vertical); }
+
+#define SWAP_PICK_ELEMENT_REF(P) { \
+ SWAP_STRUCTURE ((P).sid); \
+ SWAP_CARD32 ((P).offset); \
+ SWAP_CARD32 ((P).pickid); }
+
+
+#define SWAP_STRUCT_INFO(S) { \
+ SWAP_STRUCTURE((S).sid); \
+ SWAP_FLOAT((S).priority);}
+
+#define SWAP_RENDERER_TARGET(S) { \
+ SWAP_CARD16((S).type); \
+ SWAP_CARD32((S).visualID); }
+
+#endif /* CONVERTSTR_H */
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/floatconv.c b/xc/programs/Xserver/PEX5/dipex/swap/floatconv.c
new file mode 100644
index 000000000..7c8be0f71
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/floatconv.c
@@ -0,0 +1,227 @@
+/* $TOG: floatconv.c /main/6 1998/02/10 12:37:46 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * floatconv.c - Code which converts between ieee and vax float types.
+ *
+ * Copyright 1988-1991
+ * Center for Information Technology Integration (CITI)
+ * Information Technology Division
+ * University of Michigan
+ * Ann Arbor, Michigan
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the names of
+ * CITI or THE UNIVERSITY OF MICHIGAN not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS." CITI AND THE UNIVERSITY OF
+ * MICHIGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL CITI OR THE UNIVERSITY OF MICHIGAN BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "floatconv.h"
+
+#define BITMASK(n) ((((unsigned long)1)<<n)-1)
+#define VAX_EXPONENT_BIAS 0x00000081
+#define IEEE_EXPONENT_BIAS 0x0000007f
+
+#define VAX_TO_IEEE_BIAS ((CARD32)-VAX_EXPONENT_BIAS + IEEE_EXPONENT_BIAS)
+#define IEEE_TO_VAX_BIAS ((CARD32)-IEEE_EXPONENT_BIAS + VAX_EXPONENT_BIAS)
+
+#define MAX_VAX_NEGATIVE 0xffffffff
+#define MIN_VAX_NEGATIVE 0x00008000
+#define MAX_VAX_POSITIVE 0xffff7fff
+#define MIN_VAX_POSITIVE 0x00000000
+#define VAX_SIGN_MASK 0xffff7fff
+
+#define MIN_IEEE_NEGATIVE 0x80000000
+#define MAX_IEEE_NEGATIVE 0xff800000
+#define MIN_IEEE_POSITIVE 0x00000000
+#define MAX_IEEE_POSITIVE 0x7f800000
+#define IEEE_SIGN_MASK 0x7fffffff
+
+/* stupid procedure. tests different machine's handling of the extreme cases
+ void PrintMaxMinTest()
+{
+ ErrorF("MAX_IEEE_POSITIVE %f\n",MAX_IEEE_POSITIVE);
+ ErrorF("MIN_IEEE_POSITIVE %f\n",MIN_IEEE_POSITIVE);
+ ErrorF("MAX_IEEE_NEGATIVE %f\n",MAX_IEEE_NEGATIVE);
+ ErrorF("MIN_IEEE_NEGATIVE %f\n",MIN_IEEE_NEGATIVE);
+ ErrorF("MAX_VAX_POSITIVE %f\n",MAX_VAX_POSITIVE);
+ ErrorF("MIN_VAX_POSITIVE %f\n",MIN_VAX_POSITIVE);
+ ErrorF("MAX_VAX_NEGATIVE %f\n",MAX_VAX_NEGATIVE);
+ ErrorF("MIN_VAX_NEGATIVE %f\n",MIN_VAX_NEGATIVE);
+};
+*/
+
+/*****************************************************************
+ * TAG( ConvertVaxToIEEE )
+ *
+ *
+ * Inputs:
+ * A floating point number in VAX format.
+ * Outputs:
+ * The floating point number in IEEE format.
+ * Assumptions:
+ * The number must not be 'out of the bounds' of the floating point
+ * format which it is being converted to. I have not yet figured a way
+ * to ensure that the server will not crash after converting some nasty
+ * floating point number. My guess, however, is that the problems would
+ * arise in the other routine more than in the vax to ieee routine.
+ *
+ * The routine handles the MAX and MIN cases. I found that the
+ * MIN_XXXX_NEGATIVE numbers cause floating point exceptions on
+ * the VAX and the RT. Thus -0.0 is never returned and +0.0 is returned
+ * instead.
+ *
+ * Algorithm:
+ * brute force BITMASKS and shifts.
+ */
+
+void
+ConvertVaxToIEEE(VaxnumR)
+ PEXFLOAT *VaxnumR;
+{
+ register CARD32 Vaxnum = *(CARD32 *)VaxnumR;
+ CARD32 *VaxnumP = (CARD32 *)VaxnumR;
+ CARD32 result;
+
+ if ((VAX_SIGN_MASK & Vaxnum)==MAX_VAX_POSITIVE)
+ {
+ *VaxnumP = MAX_IEEE_POSITIVE |
+ (((0x00008000)&Vaxnum) ? 0x80000000 : 0L);
+ return;
+ }
+
+ if ((VAX_SIGN_MASK & Vaxnum)==MIN_VAX_POSITIVE)
+ {
+ *VaxnumP = MIN_IEEE_POSITIVE;
+ return;
+ }
+
+ /*
+ * these bitfields should OR into mutually exclusive fields in
+ * result field.
+ */
+
+ result = ((((BITMASK(8)<<7) & Vaxnum)>>7)+VAX_TO_IEEE_BIAS)<<23;
+ result |= (((BITMASK(7) & Vaxnum)<<16) |
+ (((BITMASK(16)<<16) & Vaxnum)>>16));
+ result |= ( (0x00008000 & Vaxnum) ? 0x80000000 : 0L);
+ *VaxnumP = result;
+ return;
+}
+
+/*****************************************************************
+ * TAG( ConvertIEEEToVax )
+ *
+ * Function converts IEEE format floating point numbers to Vax floating
+ * point numbers.
+ *
+ * Inputs:
+ * A floating point number in IEEE format.
+ * Outputs:
+ * A floating point number in VAX format.
+ * Assumptions:
+ * The number must not be 'out of the bounds' of the floating point
+ * format which it is being converted to. I have not yet figured a way
+ * to ensure that the server will not crash after converting some nasty
+ * floating point number. My guess, however, is that the problems would
+ * arise in this routine more than the vax to ieee routine.
+ *
+ * The routine handles the MAX and MIN cases. I found that the
+ * MIN_XXXX_NEGATIVE numbers cause floating point exceptions on
+ * the VAX and the RT. Thus -0.0 is never returned and +0.0 is returned
+ * instead.
+ *
+ * Algorithm:
+ * brute force BITMASKS and shifts.
+ */
+
+void
+ConvertIEEEToVax(IEEEnumR)
+ PEXFLOAT *IEEEnumR;
+{
+ register CARD32 IEEEnum = *(CARD32 *)IEEEnumR;
+ CARD32 *IEEEnumP = (CARD32 *)IEEEnumR;
+ CARD32 result=0;
+
+ if ((IEEE_SIGN_MASK & IEEEnum)==MAX_IEEE_POSITIVE)
+ {
+ *IEEEnumP = MAX_VAX_POSITIVE |
+ (0x80000000&IEEEnum)>>16;
+ return;
+ };
+
+ if ((IEEE_SIGN_MASK & IEEEnum)==MIN_IEEE_POSITIVE)
+ {
+ *IEEEnumP = MIN_VAX_POSITIVE;
+ return;
+ };
+
+ /*
+ * these bitfields should OR into mutually exclusive fields in
+ * result field.
+ */
+
+ result = ((((BITMASK(8)<<23) & IEEEnum)>>23)+IEEE_TO_VAX_BIAS)<<7;
+ result |= ((BITMASK(7)<<16)&IEEEnum)>>16;
+ result |= (BITMASK(16)&IEEEnum)<<16;
+ result |= (0x80000000&IEEEnum)>>16;
+ *IEEEnumP = result;
+ return;
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/floatconv.h b/xc/programs/Xserver/PEX5/dipex/swap/floatconv.h
new file mode 100644
index 000000000..1b856b001
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/floatconv.h
@@ -0,0 +1,75 @@
+/* $TOG: floatconv.h /main/6 1998/02/12 14:15:06 kaleb $ */
+
+/*
+ * Copyright 1988-1991 by Sun Microsystems
+ */
+/*
+
+Copyright 1988-1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * floatconv.h - Functions and macros to convert between FloatTypes
+ *
+ * Copyright 1988
+ * Center for Information Technology Integration (CITI)
+ * Information Technology Division
+ * University of Michigan
+ * Ann Arbor, Michigan
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the names of
+ * CITI or THE UNIVERSITY OF MICHIGAN not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS." CITI AND THE UNIVERSITY OF
+ * MICHIGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL CITI OR THE UNIVERSITY OF MICHIGAN BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+#ifndef FLOAT_CON_H
+#define FLOAT_CON_H
+
+#include <X11/Xmd.h>
+#include "X.h"
+#include "Xproto.h"
+#include "dipex.h"
+
+#ifdef vax /* probably not good enough yet */
+#define MyFloatType DEC_F_Floating
+#else
+#define MyFloatType Ieee_754_32
+#endif
+
+extern void ConvertIEEEtoVax();
+extern void ConvertVaxToIEEE();
+
+#endif /* FLOAT_CON_H */
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/uOCTables.ci b/xc/programs/Xserver/PEX5/dipex/swap/uOCTables.ci
new file mode 100644
index 000000000..c33d4637a
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/uOCTables.ci
@@ -0,0 +1,241 @@
+/* $TOG: uOCTables.ci /main/5 1998/02/10 14:00:33 kaleb $ */
+/* Automatically generated OC table
+ */
+/******************************************************************
+
+Copyright 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include "X.h"
+#include "PEX.h"
+#include "PEXprotost.h"
+#include "PEXproto.h"
+#include "dipex.h"
+#include "pexSwap.h"
+
+#if defined (__STDC__)
+#define SWAP_OC_PREFIX(t) uPEX##t
+#else
+#define SWAP_OC_PREFIX(t) uPEX/**/t
+#endif
+
+extern ErrorCode
+ SwapPEXOCUnused (),
+ SwapPEXMarkerType (),
+ SwapPEXMarkerScale (),
+ SwapPEXMarkerColourIndex (),
+ SWAP_OC_PREFIX(MarkerColour) (),
+ SwapPEXMarkerBundleIndex (),
+ SwapPEXTextPrecision (),
+ SwapPEXCharExpansion (),
+ SwapPEXCharSpacing (),
+ SwapPEXCharHeight (),
+ SwapPEXCharUpVector (),
+ SwapPEXTextPath (),
+ SwapPEXTextAlignment (),
+ SwapPEXAtextStyle (),
+ SwapPEXLineType (),
+ SwapPEXLineWidth (),
+ SwapPEXCurveApproximation (),
+ SwapPEXPolylineInterp (),
+ SwapPEXInteriorStyle (),
+ SWAP_OC_PREFIX(SurfaceReflAttr) (),
+ SwapPEXSurfaceReflModel (),
+ SwapPEXSurfaceInterp (),
+ SwapPEXSurfaceApproximation (),
+ SwapPEXCullingMode (),
+ SwapPEXDistinguishFlag (),
+ SwapPEXPatternSize (),
+ SwapPEXPatternRefPt (),
+ SwapPEXPatternAttr (),
+ SwapPEXSurfaceEdgeFlag (),
+ SwapPEXSurfaceEdgeType (),
+ SwapPEXSetAsfValues (),
+ SwapPEXLocalTransform (),
+ SwapPEXLocalTransform2D (),
+ SwapPEXGlobalTransform (),
+ SwapPEXGlobalTransform2D (),
+ SwapPEXModelClip (),
+ SWAP_OC_PREFIX(ModelClipVolume) (),
+ SWAP_OC_PREFIX(ModelClipVolume2D) (),
+ SwapPEXRestoreModelClip (),
+ SWAP_OC_PREFIX(LightState) (),
+ SwapPEXPickId (),
+ SwapPEXHlhsrIdentifier (),
+ SWAP_OC_PREFIX(ParaSurfCharacteristics) (),
+ SWAP_OC_PREFIX(AddToNameSet) (),
+ SwapPEXExecuteStructure (),
+ SwapPEXLabel (),
+ SwapPEXApplicationData (),
+ SwapPEXGse (),
+ SWAP_OC_PREFIX(Marker) (),
+ SWAP_OC_PREFIX(Marker2D) (),
+ SWAP_OC_PREFIX(Text) (),
+ SWAP_OC_PREFIX(Text2D) (),
+ SWAP_OC_PREFIX(AnnotationText) (),
+ SWAP_OC_PREFIX(AnnotationText2D) (),
+ SWAP_OC_PREFIX(Polyline) (),
+ SWAP_OC_PREFIX(Polyline2D) (),
+ SWAP_OC_PREFIX(PolylineSet) (),
+ SWAP_OC_PREFIX(NurbCurve) (),
+ SWAP_OC_PREFIX(FillArea) (),
+ SWAP_OC_PREFIX(FillArea2D) (),
+ SWAP_OC_PREFIX(ExtFillArea) (),
+ SWAP_OC_PREFIX(FillAreaSet) (),
+ SWAP_OC_PREFIX(FillAreaSet2D) (),
+ SWAP_OC_PREFIX(ExtFillAreaSet) (),
+ SWAP_OC_PREFIX(TriangleStrip) (),
+ SWAP_OC_PREFIX(QuadrilateralMesh) (),
+ SWAP_OC_PREFIX(SOFAS) (),
+ SWAP_OC_PREFIX(NurbSurface) (),
+ SWAP_OC_PREFIX(CellArray) (),
+ SWAP_OC_PREFIX(CellArray2D) (),
+ SWAP_OC_PREFIX(ExtCellArray) (),
+ SWAP_OC_PREFIX(Gdp) (),
+ SWAP_OC_PREFIX(Gdp2D) (),
+ SwapPEXRenderingColourModel();
+
+OCFunction SWAP_OC_PREFIX(OutputCmd) [] = {
+ SwapPEXOCUnused,
+ SwapPEXMarkerType,
+ SwapPEXMarkerScale,
+ SwapPEXMarkerColourIndex,
+ SWAP_OC_PREFIX(MarkerColour),
+ SwapPEXMarkerBundleIndex,
+ SwapPEXMarkerBundleIndex, /* TextFontIndex */
+ SwapPEXTextPrecision,
+ SwapPEXCharExpansion,
+ SwapPEXCharSpacing,
+ SwapPEXMarkerColourIndex, /* TextColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* TextColour */
+ SwapPEXCharHeight,
+ SwapPEXCharUpVector,
+ SwapPEXTextPath,
+ SwapPEXTextAlignment,
+ SwapPEXCharHeight, /* AtextHeight */
+ SwapPEXCharUpVector, /* AtextUpVector */
+ SwapPEXTextPath, /* AtextPath */
+ SwapPEXTextAlignment, /* AtextAlignment */
+ SwapPEXAtextStyle,
+ SwapPEXMarkerBundleIndex, /* TextBundleIndex */
+ SwapPEXLineType,
+ SwapPEXLineWidth,
+ SwapPEXMarkerColourIndex, /* LineColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* LineColour */
+ SwapPEXCurveApproximation,
+ SwapPEXPolylineInterp,
+ SwapPEXMarkerBundleIndex, /* LineBundleIndex */
+ SwapPEXInteriorStyle,
+ SwapPEXMarkerBundleIndex, /* InteriorStyleIndex */
+ SwapPEXMarkerColourIndex, /* SurfaceColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* SurfaceColour */
+ SWAP_OC_PREFIX(SurfaceReflAttr),
+ SwapPEXSurfaceReflModel,
+ SwapPEXSurfaceInterp,
+ SwapPEXInteriorStyle, /* BfInteriorStyle */
+ SwapPEXMarkerBundleIndex, /* BfInteriorStyleIndex */
+ SwapPEXMarkerColourIndex, /* BfSurfaceColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* BfSurfaceColour */
+ SWAP_OC_PREFIX(SurfaceReflAttr), /* BfSurfaceReflAttr */
+ SwapPEXSurfaceReflModel, /* BfSurfaceReflModel */
+ SwapPEXSurfaceInterp, /* BfSurfaceInterp */
+ SwapPEXSurfaceApproximation,
+ SwapPEXCullingMode,
+ SwapPEXDistinguishFlag,
+ SwapPEXPatternSize,
+ SwapPEXPatternRefPt,
+ SwapPEXPatternAttr,
+ SwapPEXMarkerBundleIndex, /* InteriorBundleIndex */
+ SwapPEXSurfaceEdgeFlag,
+ SwapPEXSurfaceEdgeType,
+ SwapPEXLineWidth, /* SurfaceEdgeWidth */
+ SwapPEXMarkerColourIndex, /* SurfaceEdgeColourIndex */
+ SWAP_OC_PREFIX(MarkerColour), /* SurfaceEdgeColour */
+ SwapPEXMarkerBundleIndex, /* EdgeBundleIndex */
+ SwapPEXSetAsfValues,
+ SwapPEXLocalTransform,
+ SwapPEXLocalTransform2D,
+ SwapPEXGlobalTransform,
+ SwapPEXGlobalTransform2D,
+ SwapPEXModelClip,
+ SWAP_OC_PREFIX(ModelClipVolume),
+ SWAP_OC_PREFIX(ModelClipVolume2D),
+ SwapPEXRestoreModelClip,
+ SwapPEXMarkerBundleIndex, /* ViewIndex */
+ SWAP_OC_PREFIX(LightState),
+ SwapPEXMarkerBundleIndex, /* DepthCueIndex */
+ SwapPEXPickId,
+ SwapPEXHlhsrIdentifier,
+ SwapPEXMarkerBundleIndex, /* ColourApproxIndex */
+ SwapPEXRenderingColourModel, /* RenderingColourModel */
+ SWAP_OC_PREFIX(ParaSurfCharacteristics),
+ SWAP_OC_PREFIX(AddToNameSet),
+ SWAP_OC_PREFIX(AddToNameSet), /* RemoveFromNameSet */
+ SwapPEXExecuteStructure,
+ SwapPEXLabel,
+ SwapPEXApplicationData,
+ SwapPEXGse,
+ SWAP_OC_PREFIX(Marker),
+ SWAP_OC_PREFIX(Marker2D),
+ SWAP_OC_PREFIX(Text),
+ SWAP_OC_PREFIX(Text2D),
+ SWAP_OC_PREFIX(AnnotationText),
+ SWAP_OC_PREFIX(AnnotationText2D),
+ SWAP_OC_PREFIX(Polyline),
+ SWAP_OC_PREFIX(Polyline2D),
+ SWAP_OC_PREFIX(PolylineSet),
+ SWAP_OC_PREFIX(NurbCurve),
+ SWAP_OC_PREFIX(FillArea),
+ SWAP_OC_PREFIX(FillArea2D),
+ SWAP_OC_PREFIX(ExtFillArea),
+ SWAP_OC_PREFIX(FillAreaSet),
+ SWAP_OC_PREFIX(FillAreaSet2D),
+ SWAP_OC_PREFIX(ExtFillAreaSet),
+ SWAP_OC_PREFIX(TriangleStrip),
+ SWAP_OC_PREFIX(QuadrilateralMesh),
+ SWAP_OC_PREFIX(SOFAS),
+ SWAP_OC_PREFIX(NurbSurface),
+ SWAP_OC_PREFIX(CellArray),
+ SWAP_OC_PREFIX(CellArray2D),
+ SWAP_OC_PREFIX(ExtCellArray),
+ SWAP_OC_PREFIX(Gdp),
+ SWAP_OC_PREFIX(Gdp2D)
+};
+
+#undef SWAP_OC_PREFIX
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/uOCprim.c b/xc/programs/Xserver/PEX5/dipex/swap/uOCprim.c
new file mode 100644
index 000000000..2f527668b
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/uOCprim.c
@@ -0,0 +1,831 @@
+/* $TOG: uOCprim.c /main/11 1998/02/10 12:37:55 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*
+ Contains swap routines for certain OCs and utility routines.
+ The difference between this file and its companion cOCprim.c
+ are subtle, having to do with, for example, whether or not
+ you have to swap strmPtr->numPoints before or after you will
+ need to use it to know how many points to convert.
+ */
+
+/* All such packet interdependencies should be handled in these two
+ files: cOCprim.c and uOCprim.c
+ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "convertStr.h"
+
+#define LOCAL_FLAG extern
+#include "convUtil.h"
+#include "OCattr.h"
+#undef LOCAL_FLAG
+
+#include "UconvName.h"
+#define LOCAL_FLAG
+#include "OCprim.h"
+
+#ifndef PADDING
+#define PADDING(n) ( (n)%4 ? (4 - (n)%4) : 0)
+#endif
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapFacet) (swapPtr, facetMask, vertexMask, colourType, ptr)
+pexSwap *swapPtr;
+CARD16 facetMask;
+CARD16 vertexMask;
+pexEnumTypeIndex colourType;
+CARD8 *ptr;
+{
+ CARD32 numVerts;
+ CARD32 i;
+
+ ptr = SwapOptData (swapPtr, ptr, facetMask, colourType);
+
+ numVerts = *((CARD32 *)ptr);
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+
+ for (i=0; i<numVerts; i++)
+ ptr = SwapVertex (swapPtr, (pexVertex *)ptr, vertexMask, colourType);
+}
+
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr, pc)
+pexSwap *swapPtr;
+pexColourSpecifier *pc;
+{
+ unsigned char *ptr;
+
+ ptr = (unsigned char *)(pc+1);
+ ptr = SwapColour (swapPtr, (pexColour *)ptr, pc->colourType);
+ SWAP_CARD16 (pc->colourType);
+ return (ptr);
+}
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapReflectionAttr) (swapPtr, ptr)
+pexSwap *swapPtr;
+pexReflectionAttr *ptr;
+{
+ unsigned char *pret = (unsigned char *)ptr;
+
+ SWAP_FLOAT (ptr->ambient);
+ SWAP_FLOAT (ptr->diffuse);
+ SWAP_FLOAT (ptr->specular);
+ SWAP_FLOAT (ptr->specularConc);
+ SWAP_FLOAT (ptr->transmission);
+ pret = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr, &(ptr->specularColour));
+ return (pret);
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, pME, num)
+pexSwap *swapPtr;
+pexMonoEncoding *pME;
+CARD32 num;
+{
+ CARD16 i, j;
+ int bytes;
+
+ for (i=0; i<num; i++) {
+ SWAP_CARD16(pME->characterSet);
+ switch (pME->characterSetWidth) {
+ case PEXCSByte:
+ bytes = pME->numChars;
+ break;
+ case PEXCSShort: {
+ CARD16 *ptr = (CARD16 *)(pME+1);
+ for (j=0; j<pME->numChars; j++, ptr++) SWAP_CARD16((*ptr));
+ bytes = pME->numChars * sizeof(CARD16);
+ break;
+ }
+
+ case PEXCSLong: {
+ CARD32 *ptr = (CARD32 *)(pME+1);
+ for (j=0; j<pME->numChars; j++, ptr++) SWAP_CARD32((*ptr));
+ bytes = pME->numChars * sizeof(CARD32);
+ break;
+ }
+
+ }
+
+ SWAP_CARD16(pME->numChars);
+ pME = (pexMonoEncoding *) ((char *) (pME + 1) +
+ bytes + PADDING (bytes));
+
+ }
+
+}
+
+
+/* The rest are OC's */
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXModelClipVolume) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexModelClipVolume *strmPtr;
+{
+ int i;
+ pexHalfSpace *ph;
+
+ SWAP_ENUM_TYPE_INDEX (strmPtr->modelClipOperator);
+
+ for (i=0, ph=(pexHalfSpace *)(strmPtr+1); i<strmPtr->numHalfSpaces; i++,ph++)
+ SwapHalfSpace(swapPtr, ph);
+
+ SWAP_CARD16 (strmPtr->numHalfSpaces);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXModelClipVolume2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexModelClipVolume2D *strmPtr;
+{
+ int i;
+ pexHalfSpace2D *ph;
+
+ SWAP_ENUM_TYPE_INDEX (strmPtr->modelClipOperator);
+
+ for (i=0, ph=(pexHalfSpace2D *)(strmPtr+1); i<strmPtr->numHalfSpaces; i++,ph++)
+ SwapHalfSpace2D(swapPtr, ph);
+
+ SWAP_CARD16 (strmPtr->numHalfSpaces);
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXLightState) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexLightState *strmPtr;
+{
+ int i, numE, numD;
+ CARD16 *light;
+
+ numE = strmPtr->numEnable;
+ numD = strmPtr->numDisable;
+
+ SWAP_CARD16 (strmPtr->numEnable);
+ SWAP_CARD16 (strmPtr->numDisable);
+
+ for (i=0, light = (CARD16 *)(strmPtr+1); i<numE; i++, light++)
+ SWAP_CARD16 ((*light));
+
+ /* skip pad if there */
+ if (numE & 0x1) light++;
+
+ for (i=0; i<numD; i++, light++)
+ SWAP_CARD16 ((*light));
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXAddToNameSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAddToNameSet *strmPtr;
+{
+ int i, num;
+ pexName *pn;
+
+ num = (int)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexAddToNameSet))
+ /sizeof(pexName));
+
+ for (i=0, pn=(pexName *)(strmPtr+1); i<num; i++, pn++)
+ SWAP_NAME ((*pn));
+
+}
+
+
+/* typedef pexAddToNameSet pexRemoveFromNameSet;*/
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMarker) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarker *strmPtr;
+{
+ CARD32 num;
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexMarker))
+ /sizeof(pexCoord3D));
+
+ SwapCoord3DList(swapPtr, pc, num);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXMarker2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexMarker2D *strmPtr;
+{
+ CARD32 num;
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexMarker2D))
+ /sizeof(pexCoord2D));
+
+ SwapCoord2DList(swapPtr, pc, num);
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolyline) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolyline *strmPtr;
+{
+ CARD32 num;
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexPolyline))
+ /sizeof(pexCoord3D));
+
+ SwapCoord3DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolyline2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolyline2D *strmPtr;
+{
+ CARD32 num;
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexPolyline2D))
+ /sizeof(pexCoord2D));
+
+ SwapCoord2DList(swapPtr, pc, num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXPolylineSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexPolylineSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexVertex *pv;
+
+
+ pj = (CARD32 *)(strmPtr+1);
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pv) {
+
+ k = *pj;
+ SWAP_CARD32 ((*pj));
+ for (j=0, pv = (pexVertex *)(pj + 1); j<k; j++) {
+ pv = (pexVertex *) SwapVertex (swapPtr, pv, strmPtr->vertexAttribs, strmPtr->colourType);
+ }
+
+ }
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numLists);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNurbCurve) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNurbCurve *strmPtr;
+{
+ int i;
+ PEXFLOAT *pf;
+
+ SWAP_CARD16 (strmPtr->curveOrder);
+ SWAP_COORD_TYPE (strmPtr->coordType);
+ SWAP_FLOAT (strmPtr->tmin);
+ SWAP_FLOAT (strmPtr->tmax);
+
+ for (i=0, pf=(PEXFLOAT *)(strmPtr+1); i<strmPtr->numKnots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ if (strmPtr->coordType == PEXRational)
+ SwapCoord4DList(swapPtr, (pexCoord4D *)pf, strmPtr->numPoints);
+ else
+ SwapCoord3DList(swapPtr, (pexCoord3D *)pf, strmPtr->numPoints);
+
+ SWAP_CARD32 (strmPtr->numKnots);
+ SWAP_CARD32 (strmPtr->numPoints);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillArea) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillArea *strmPtr;
+{
+ CARD32 num;
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexFillArea))
+ /sizeof(pexCoord3D));
+
+ SWAP_CARD16 (strmPtr->shape);
+
+ SwapCoord3DList(swapPtr, (pexCoord3D *)(strmPtr+1), num);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillArea2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillArea2D *strmPtr;
+{
+ CARD32 num;
+
+ num = (CARD32)(((sizeof (CARD32) * strmPtr->head.length) - sizeof(pexFillArea2D))
+ /sizeof(pexCoord2D));
+
+ SWAP_CARD16 (strmPtr->shape);
+
+ SwapCoord2DList(swapPtr, (strmPtr+1), num);
+
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtFillArea) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtFillArea *strmPtr;
+{
+
+ SWAP_FUNC_PREFIX(SwapFacet)( swapPtr, strmPtr->facetAttribs,
+ strmPtr->vertexAttribs, strmPtr->colourType,
+ (CARD8 *)(strmPtr+1));
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ /* SINGLE Facet(facetAttribs, vertexAttribs, colourType) */
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillAreaSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillAreaSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexCoord3D *pc;
+
+ pj = (CARD32 *)(strmPtr+1);
+
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pc ) {
+
+ k = *pj;
+ SWAP_CARD32 ((*pj));
+ for (j=0, pc = (pexCoord3D *)(pj + 1); j<k; j++, pc++) {
+ SWAP_COORD3D ((*pc));
+ }
+ }
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_CARD32 (strmPtr->numLists);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXFillAreaSet2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexFillAreaSet2D *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexCoord2D *pc;
+
+ pj = (CARD32 *)(strmPtr+1);
+
+ for (i=0; i<strmPtr->numLists; i++, pj = (CARD32 *)pc ) {
+
+ k = *pj;
+ SWAP_CARD32 ((*pj));
+ for (j=0, pc = (pexCoord2D *)(pj + 1); j<k; j++, pc++) {
+ SWAP_COORD2D ((*pc));
+ }
+ }
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_CARD32 (strmPtr->numLists);
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtFillAreaSet) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtFillAreaSet *strmPtr;
+{
+ unsigned long i, j, k;
+ CARD32 *pj;
+ pexVertex *pv;
+ unsigned char *ptr = 0;
+
+ ptr = SwapOptData (swapPtr, (CARD8 *) (strmPtr+1),
+ strmPtr->facetAttribs, strmPtr->colourType);
+
+ for (i=0, pj = (CARD32 *)ptr; i<strmPtr->numLists; i++, pj = (CARD32 *)pv) {
+ k = *pj;
+ SWAP_CARD32 ((*pj));
+ for (j=0, pv = (pexVertex *)(pj + 1); j<k; j++) {
+ pv = (pexVertex *) SwapVertex( swapPtr, pv, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+ }
+
+ }
+
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numLists);
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXTriangleStrip) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexTriangleStrip *strmPtr;
+{
+ CARD32 i;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+
+
+ for (i=0; i<(strmPtr->numVertices-2); i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->facetAttribs,
+ strmPtr->colourType);
+
+ for (i=0; i<strmPtr->numVertices; i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+ SWAP_CARD32 (strmPtr->numVertices);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXQuadrilateralMesh) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexQuadrilateralMesh *strmPtr;
+{
+ int i;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+
+
+ for (i=0; i<((strmPtr->mPts -1) * (strmPtr->nPts -1)); i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->facetAttribs,
+ strmPtr->colourType);
+
+ for (i=0; i<(strmPtr->mPts * strmPtr->nPts); i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr, strmPtr->vertexAttribs,
+ strmPtr->colourType);
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->mPts);
+ SWAP_CARD16 (strmPtr->nPts);
+ SWAP_CARD16 (strmPtr->facetAttribs);
+ SWAP_CARD16 (strmPtr->vertexAttribs);
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXSOFAS) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexSOFAS *strmPtr;
+{
+ CARD16 i, j, k;
+ unsigned char *ptr = (unsigned char *)(strmPtr+1);
+ CARD16 numList, numSubList;
+
+ for (i=0; i<strmPtr->numFAS; i++)
+ ptr = SwapOptData( swapPtr, ptr, strmPtr->FAS_Attributes,
+ strmPtr->colourType);
+
+ for (i=0; i<strmPtr->numVertices; i++)
+ ptr = SwapVertex( swapPtr, (pexVertex *)ptr,
+ strmPtr->vertexAttributes, strmPtr->colourType);
+
+ ptr += ((int)(((strmPtr->numEdges * strmPtr->edgeAttributes) + 3) / 4)) * 4;
+
+ for (i=0; i < strmPtr->numFAS; i++){
+ numList = *((CARD16 *)ptr);
+ SWAP_CARD16((*ptr));
+ ptr += sizeof (CARD16);
+ for (j=0; j < numList; j++) {
+ numSubList = *((CARD16 *)ptr);
+ SWAP_CARD16((*ptr));
+ ptr += sizeof (CARD16);
+ for (k=0; k < numSubList; k++) {
+ SWAP_CARD16((*ptr));
+ ptr += sizeof (CARD16);
+ }
+ }
+ }
+ SWAP_CARD16 (strmPtr->shape);
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_CARD16 (strmPtr->FAS_Attributes);
+ SWAP_CARD16 (strmPtr->vertexAttributes);
+ SWAP_CARD16 (strmPtr->edgeAttributes);
+ SWAP_CARD16 (strmPtr->numFAS);
+ SWAP_CARD16 (strmPtr->numVertices);
+ SWAP_CARD16 (strmPtr->numEdges);
+ SWAP_CARD16 (strmPtr->numContours);
+
+}
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNurbSurface) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNurbSurface *strmPtr;
+{
+ CARD32 i, j, k;
+ PEXFLOAT *pf;
+ unsigned char *ptr;
+ CARD32 numPoints, numKnots;
+ CARD32 numSublists;
+ CARD16 curveType;
+ pexTrimCurve *pTC = 0;
+
+
+ for (i=0, pf=(PEXFLOAT *)(strmPtr+1); i<strmPtr->numUknots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ for (i=0; i<strmPtr->numVknots; i++, pf++)
+ SWAP_FLOAT((*pf));
+
+ ptr = (unsigned char *)pf;
+ if (strmPtr->type == PEXRational)
+ ptr = SwapCoord4DList( swapPtr, (pexCoord4D *)ptr,
+ (CARD32)(strmPtr->mPts*strmPtr->nPts));
+ else
+ ptr = SwapCoord3DList( swapPtr, (pexCoord3D *)ptr,
+ (CARD32)(strmPtr->mPts*strmPtr->nPts));
+
+ for (i=0; i<strmPtr->numLists; i++) {
+ numSublists = *((CARD32 *)ptr); /* num trim curves */
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr+=4;
+ for (j=0; j<numSublists; j++) {
+ pTC = (pexTrimCurve *)ptr;
+ ptr = SwapTrimCurve(swapPtr, pTC);
+ SWAP_CARD16(pTC->type);
+ SWAP_CARD32(pTC->numKnots);
+ SWAP_CARD32(pTC->numCoord);
+ }
+ }
+ SWAP_COORD_TYPE (strmPtr->type);
+ SWAP_CARD16 (strmPtr->uOrder);
+ SWAP_CARD16 (strmPtr->vOrder);
+ SWAP_CARD32 (strmPtr->numUknots);
+ SWAP_CARD32 (strmPtr->numVknots);
+ SWAP_CARD16 (strmPtr->mPts);
+ SWAP_CARD16 (strmPtr->nPts);
+ SWAP_CARD32 (strmPtr->numLists);
+}
+
+
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCellArray) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCellArray *strmPtr;
+{
+ int i;
+ CARD16 *pc;
+
+ SWAP_COORD3D (strmPtr->point1);
+ SWAP_COORD3D (strmPtr->point2);
+ SWAP_COORD3D (strmPtr->point3);
+
+ for (i=0, pc=(CARD16 *)(strmPtr+1); i<(strmPtr->dx * strmPtr->dy); i++, pc++)
+ SWAP_CARD16((*pc));
+
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXCellArray2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexCellArray2D *strmPtr;
+{
+ int i;
+ CARD16 *pc;
+
+ SWAP_COORD2D (strmPtr->point1);
+ SWAP_COORD2D (strmPtr->point2);
+
+ for (i=0, pc=(CARD16 *)(strmPtr+1); i<(strmPtr->dx * strmPtr->dy); i++, pc++)
+ SWAP_CARD16((*pc));
+
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXExtCellArray) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexExtCellArray *strmPtr;
+{
+ CARD32 i;
+ unsigned char *ptr;
+
+ for ( i=0, ptr = (unsigned char *)(strmPtr+1);
+ i < strmPtr->dx * strmPtr->dy;
+ i++) {
+ ptr = SwapColour(swapPtr, (pexColour *)ptr, strmPtr->colourType);
+ }
+
+ SWAP_COLOUR_TYPE (strmPtr->colourType);
+ SWAP_COORD3D (strmPtr->point1);
+ SWAP_COORD3D (strmPtr->point2);
+ SWAP_COORD3D (strmPtr->point3);
+ SWAP_CARD32 (strmPtr->dx);
+ SWAP_CARD32 (strmPtr->dy);
+
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGdp) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGdp *strmPtr;
+{
+ pexCoord3D *pc = (pexCoord3D *)(strmPtr+1);
+ SWAP_CARD32 (strmPtr->gdpId);
+ SWAP_CARD32 (strmPtr->numBytes);
+
+ SwapCoord3DList(swapPtr, pc, strmPtr->numPoints);
+
+ SWAP_CARD32 (strmPtr->numPoints);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXGdp2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexGdp2D *strmPtr;
+{
+ pexCoord2D *pc = (pexCoord2D *)(strmPtr+1);
+
+ SWAP_CARD32 (strmPtr->gdpId);
+ SWAP_CARD32 (strmPtr->numBytes);
+
+ SwapCoord2DList(swapPtr, pc, strmPtr->numPoints);
+
+ SWAP_CARD32 (strmPtr->numPoints);
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(Text) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexText *strmPtr;
+{
+ SWAP_COORD3D (strmPtr->origin);
+ SWAP_VECTOR3D (strmPtr->vector1);
+ SWAP_VECTOR3D (strmPtr->vector2);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+ SWAP_CARD16 (strmPtr->numEncodings);
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(Text2D) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexText2D *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->origin);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+ SWAP_CARD16 (strmPtr->numEncodings);
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(AnnotationText) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexAnnotationText *strmPtr;
+{
+ SWAP_COORD3D (strmPtr->origin);
+ SWAP_COORD3D (strmPtr->offset);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+ SWAP_CARD16 (strmPtr->numEncodings);
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(AnnotationText2D) (swapPtr, strmPtr)
+pexSwap * swapPtr;
+pexAnnotationText2D *strmPtr;
+{
+ SWAP_COORD2D (strmPtr->origin);
+ SWAP_COORD2D (strmPtr->offset);
+ SWAP_FUNC_PREFIX(SwapMonoEncoding) (swapPtr, (pexMonoEncoding *)(strmPtr+1),
+ (CARD32)(strmPtr->numEncodings));
+ SWAP_CARD16 (strmPtr->numEncodings);
+
+}
+
+ErrorCode
+SWAP_FUNC_PEX_PFX(ParaSurfCharacteristics) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexParaSurfCharacteristics *strmPtr;
+{
+ SWAP_CARD16 (strmPtr->length);
+
+ switch (strmPtr->characteristics) {
+ case PEXPSCNone:
+ case PEXPSCImpDep:
+ break;
+
+ case PEXPSCIsoCurves: {
+ pexPSC_IsoparametricCurves *ptr =
+ (pexPSC_IsoparametricCurves *)(strmPtr+1);
+ SWAP_CARD16(ptr->placementType);
+ SWAP_CARD16(ptr->numUcurves);
+ SWAP_CARD16(ptr->numVcurves);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves:
+ case PEXPSCWcLevelCurves: {
+ pexPSC_LevelCurves *ptr = (pexPSC_LevelCurves *)(strmPtr+1);
+ PEXFLOAT *pc = (PEXFLOAT *)(ptr+1);
+ CARD16 i;
+ SWAP_COORD3D (ptr->origin);
+ SWAP_VECTOR3D (ptr->direction);
+ for (i=0; i<ptr->numberIntersections; i++, pc++) {
+ SWAP_FLOAT(*pc);
+ }
+ SWAP_CARD16 (ptr->numberIntersections);
+ break;
+ }
+ }
+
+ SWAP_INT16 (strmPtr->characteristics);
+}
+
+ErrorCode
+SWAP_FUNC_PREFIX(PEXNoop) (swapPtr, strmPtr)
+pexSwap *swapPtr;
+pexNoop *strmPtr;
+{
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.c b/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.c
new file mode 100644
index 000000000..4c473882f
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.c
@@ -0,0 +1,2168 @@
+/* $TOG: uconvRep.c /main/16 1998/02/10 12:38:00 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*
+ Swapping and float conversion routines.
+
+ Variations on a theme by CITI.
+ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "dipex.h"
+#include "pexSwap.h"
+#include "pex_site.h"
+#include "convertStr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG extern
+#include "convUtil.h"
+#include "UconvName.h"
+#include "OCprim.h"
+#include "OCcolour.h"
+#include "OCattr.h"
+
+#undef LOCAL_FLAG
+#define LOCAL_FLAG
+#include "uconvRep.h"
+
+#define PADDING(n) ( (n)&3 ? (4 - ((n)&3)) : 0)
+
+/*************************************************************
+ Replies
+
+ *************************************************************/
+
+void
+SWAP_FUNC_PREFIX(ConvertGetExtensionInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetExtensionInfoReq *strmPtr;
+pexGetExtensionInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->majorVersion);
+ SWAP_CARD16 (reply->minorVersion);
+ SWAP_CARD32 (reply->release);
+ SWAP_CARD32 (reply->lengthName);
+ SWAP_CARD32 (reply->subsetInfo);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetEnumeratedTypeInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetEnumeratedTypeInfoReq *strmPtr;
+pexGetEnumeratedTypeInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i, j, pad;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* NOT 0 */
+
+ switch (strmPtr->itemMask) {
+
+ case PEXETIndex : {
+ CARD16 *ptr;
+ /* PEXETIndex =1 per define in PEX.h */
+ /* a LISTofLISTofINT16 */
+ int numints;
+ for (i=0, ptr = (CARD16 *)(reply+1); i < reply->numLists; i++) {
+ numints = *((CARD32 *)ptr);
+ pad = numints & 1;
+ SWAP_CARD32(*((CARD32 *)ptr));
+ ptr += 2;
+ for (j=0; j < numints; j++) {
+ SWAP_CARD16((*ptr));
+ ptr++;
+ }
+ ptr += pad;
+ }
+
+ break;
+ }
+
+ case PEXETMnemonic : {
+ CARD8 *ptr;
+ /* PEXETMnemonic =2 per define in PEX.h */
+ /* a LISTofLISTofSTRING */
+ int numstrings, numbytes;
+ for (i=0, ptr = (CARD8 *)(reply+1); i < reply->numLists; i++) {
+ numstrings = *((CARD32 *)ptr);
+ SWAP_CARD32(*((CARD32 *)ptr));
+ ptr += 4;
+ for (j=0; j < numstrings; j++) {
+ numbytes = *((CARD16 *)ptr);
+ SWAP_CARD16(*((CARD16 *)ptr));
+ ptr += 2 + numbytes + PADDING(2+numbytes);
+ }
+ }
+ break;
+ }
+
+ case PEXETBoth : {
+ CARD8 *ptr;
+ /* PEXETBOTH =3 per define in PEX.h */
+ /* a LISTofLISTofENUM_DESC */
+ int numenums, numbytes;
+ for (i=0, ptr = (CARD8 *)(reply+1); i < reply->numLists; i++) {
+ numenums = *((CARD32 *)ptr);
+ SWAP_CARD32(*((CARD32 *)ptr));
+ ptr += 4;
+ for (j=0; j < numenums; j++) {
+ SWAP_CARD16((*ptr));
+ ptr += 2;
+ numbytes = *((CARD16 *)ptr);
+ SWAP_CARD16(*((CARD16 *)ptr));
+ ptr += 2 + numbytes + PADDING(numbytes);
+ }
+ }
+ break;
+ }
+
+ default: { /* counts */
+
+ CARD16 *ptr;
+ /* swap the counts */
+ for (i=0, ptr = (CARD16 *)(reply+1); i < reply->numLists; i++) {
+ SWAP_CARD32(*((CARD32 *)ptr));
+ ptr += 2;
+ }
+ break;
+ }
+
+ }
+
+ SWAP_CARD32 (reply->numLists);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetTableInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetTableInfoReq *strmPtr;
+pexGetTableInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->definableEntries);
+ SWAP_CARD16 (reply->numPredefined);
+ SWAP_INT16 (reply->predefinedMin);
+ SWAP_INT16 (reply->predefinedMax);
+}
+
+
+void
+SWAP_FUNC_PREFIX(ConvertGetPredefinedEntriesReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetPredefinedEntriesReq *strmPtr;
+pexGetPredefinedEntriesReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapTable) ( swapPtr, strmPtr->tableType,
+ reply->numEntries,
+ (unsigned char *)(reply+1));
+
+ SWAP_CARD32 (reply->numEntries);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetDefinedIndicesReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetDefinedIndicesReq *strmPtr;
+pexGetDefinedIndicesReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ CARD16 *ind;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, ind=(CARD16 *)(reply+1); i < reply->numIndices; i++, ind++)
+ SWAP_CARD16((*ind));
+
+ SWAP_CARD32 (reply->numIndices);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetTableEntryReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetTableEntryReq *strmPtr;
+pexGetTableEntryReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->status);
+ SWAP_FUNC_PREFIX(SwapTable) ( swapPtr, reply->tableType, (CARD32)1,
+ (unsigned char *)(reply+1));
+
+ SWAP_CARD16 (reply->tableType);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetTableEntriesReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetTableEntriesReq *strmPtr;
+pexGetTableEntriesReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_FUNC_PREFIX(SwapTable) ( swapPtr, reply->tableType,
+ reply->numEntries,
+ (unsigned char *)(reply+1));
+ SWAP_CARD32 (reply->numEntries);
+ SWAP_CARD16 (reply->tableType);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetPipelineContextReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetPipelineContextReq *strmPtr;
+pexGetPipelineContextReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapPipelineContextAttr) ( swapPtr, (strmPtr->itemMask),
+ (CARD8 *)(reply+1));
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetRendererAttributesReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetRendererAttributesReq *strmPtr;
+pexGetRendererAttributesReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapRendererAttributes) ( swapPtr, strmPtr->itemMask,
+ (CARD8 *)(reply+1));
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetRendererDynamicsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetRendererDynamicsReq *strmPtr;
+pexGetRendererDynamicsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 *ptr = (CARD32 *)(reply+1);
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD32 ((*ptr)); ptr++; /* tables */
+ SWAP_CARD32 ((*ptr)); ptr++; /* namesets */
+ SWAP_CARD32 ((*ptr)); /* attributes */
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetStructureInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetStructureInfoReq *strmPtr;
+pexGetStructureInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->editMode);
+ SWAP_CARD32 (reply->elementPtr);
+ SWAP_CARD32 (reply->numElements);
+ SWAP_CARD32 (reply->lengthStructure);
+ SWAP_CARD16 (reply->hasRefs);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetElementInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetElementInfoReq *strmPtr;
+pexGetElementInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexElementInfo *pe;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, pe=(pexElementInfo *)(reply+1); i < reply->numInfo; i++, pe++)
+ SWAP_ELEMENT_INFO (*pe);
+
+ SWAP_CARD32 (reply->numInfo);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetStructuresInNetworkReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetStructuresInNetworkReq *strmPtr;
+pexGetStructuresInNetworkReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexStructure *ps;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, ps=(pexStructure *)(reply+1); i<reply->numStructures; i++, ps++)
+ SWAP_STRUCTURE ((*ps));
+
+ SWAP_CARD32 (reply->numStructures);
+
+}
+
+
+void
+SWAP_FUNC_PREFIX(ConvertGetAncestorsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetAncestorsReq *strmPtr;
+pexGetAncestorsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 i, j, num, *buf;
+ pexElementRef *pe;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, buf=(CARD32 *)(reply+1); i<reply->numPaths; i++) {
+ num = *buf;
+ SWAP_CARD32((*buf));
+ buf++;
+ for ( j=0, pe=(pexElementRef *)(buf); j<num; j++, pe++)
+ SWAP_ELEMENT_REF((*pe));
+ buf = (CARD32 *)pe;
+ }
+
+ SWAP_CARD32 (reply->numPaths);
+}
+
+/* typedef pexGetAncestorsReply pexGetDescendantsReply; */
+
+void
+SWAP_FUNC_PREFIX(ConvertElementSearchReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexElementSearchReq *strmPtr;
+pexElementSearchReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->status);
+ SWAP_CARD32 (reply->foundOffset);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertFetchElementsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexFetchElementsReq *strmPtr;
+pexFetchElementsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexElementInfo *pe;
+ CARD32 *curCmd;
+ int length;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for (i=0, curCmd = (CARD32 *)(reply+1);
+ i<reply->numElements;
+ i++, curCmd += length)
+ {
+ pe = (pexElementInfo *)curCmd;
+ /* this check must match the one done in mipex.h MI_IS_PEX_OC macro */
+ if ((PEXOCAll < pe->elementType) && (pe->elementType <= PEXMaxOC))
+ cntxtPtr->pexSwapReplyOC[ pe->elementType ] (swapPtr, pe);
+ length = pe->length;
+ SWAP_ELEMENT_INFO (*pe);
+ }
+
+ SWAP_CARD32 (reply->numElements);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetNameSetReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetNameSetReq *strmPtr;
+pexGetNameSetReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexName *pn;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, pn=(pexName *)(reply+1); i<reply->numNames; i++, pn++)
+ SWAP_NAME((*pn));
+
+ SWAP_CARD32 (reply->numNames);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetSearchContextReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetSearchContextReq *strmPtr;
+pexGetSearchContextReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapSearchContext)(swapPtr, strmPtr->itemMask,
+ (unsigned char *)(reply+1));
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertSearchNetworkReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexSearchNetworkReq *strmPtr;
+pexSearchNetworkReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexElementRef *pe;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, pe=(pexElementRef *)(reply+1); i<reply->numItems; i++, pe++)
+ SWAP_ELEMENT_REF((*pe));
+
+ SWAP_CARD32 (reply->numItems);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetWksInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetWksInfoReq *strmPtr;
+pexGetWksInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ unsigned char *ptr;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ ptr = (unsigned char *)(reply+1);
+
+ /* Read the Protocol Encoding, lots of non 4 byte fields here
+ that are shipped as 4 bytes (effectively CARD32) so they
+ are swapped as CARD32 - JSH
+ */
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWDisplayUpdate) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWVisualState) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWDisplaySurface) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWViewUpdate) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWDefinedViews) {
+ int len, i;
+ len = *(int *)ptr;
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr+=sizeof(CARD32);
+ for (i=0; i<len; i++, ptr += sizeof(CARD32)) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ }
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWWksUpdate){
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWReqNpcSubvolume) {
+ SwapNpcSubvolume(swapPtr, (pexNpcSubvolume *)ptr);
+ ptr += sizeof(pexNpcSubvolume);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWCurNpcSubvolume) {
+ SwapNpcSubvolume(swapPtr, (pexNpcSubvolume *)ptr);
+ ptr += sizeof(pexNpcSubvolume);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWReqWksViewport) {
+ SwapViewport(swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWCurWksViewport) {
+ SwapViewport(swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWHlhsrUpdate) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWReqHlhsrMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWCurHlhsrMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWDrawable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWMarkerBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWTextBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWLineBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWInteriorBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWEdgeBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWColourTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWDepthCueTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWLightTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWColourApproxTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWPatternTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWTextFontTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWHighlightIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWHighlightExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWInvisibilityIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWInvisibilityExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWPostedStructures) {
+ CARD32 len, i;
+ pexStructureInfo *ps;
+
+ len = *((CARD32 *)ptr);
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ ps = (pexStructureInfo *)ptr;
+ for (i=0; i<len; i++, ps++)
+ SWAP_STRUCT_INFO ((*ps));
+ ptr = (CARD8 *)ps;
+ };
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWNumPriorities) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWBufferUpdate) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWReqBufferMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(strmPtr->itemMask, PEXPWCurBufferMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetDynamicsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetDynamicsReq *strmPtr;
+pexGetDynamicsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* 0 */
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetViewRepReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetViewRepReq *strmPtr;
+pexGetViewRepReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ pexViewRep *pv;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->viewUpdate);
+
+ pv = (pexViewRep *)(reply+1);
+
+ SwapViewRep(swapPtr, pv); /* requested */
+ pv++;
+ SwapViewRep(swapPtr, pv); /* current */
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertMapDCtoWCReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexMapDCtoWCReq *strmPtr;
+pexMapDCtoWCReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexCoord3D *pc;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD16 (reply->viewIndex);
+
+ for ( i=0, pc=(pexCoord3D *)(reply+1); i<reply->numCoords; i++, pc++)
+ SWAP_COORD3D((*pc));
+
+ SWAP_CARD32 (reply->numCoords);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertMapWCtoDCReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexMapWCtoDCReq *strmPtr;
+pexMapWCtoDCReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i;
+ pexDeviceCoord *pc;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for (i=0, pc=(pexDeviceCoord *)(reply+1); i<reply->numCoords; i++,pc++)
+ SWAP_DEVICE_COORD((*pc));
+
+ SWAP_CARD32 (reply->numCoords);
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetWksPostingsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetWksPostingsReq *strmPtr;
+pexGetWksPostingsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ int i, num;
+ pexPhigsWks *pi;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+
+ num = (int)((reply->length)/sizeof(pexPhigsWks));
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for ( i=0, pi=(pexPhigsWks *)(reply+1); i<num; i++, pi++)
+ SWAP_PHIGS_WKS((*pi));
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetPickDeviceReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetPickDeviceReq *strmPtr;
+pexGetPickDeviceReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapPickDevAttr) ( swapPtr, strmPtr->itemMask,
+ (unsigned char *)(reply+1));
+
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetPickMeasureReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetPickMeasureReq *strmPtr;
+pexGetPickMeasureReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SWAP_FUNC_PREFIX(SwapPickMeasAttr) ( swapPtr, strmPtr->itemMask,
+ (unsigned char *)(reply + 1));
+
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertEndPickOneReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexEndPickOneReq *strmPtr;
+pexEndPickOneReply *reply;
+{
+ pexPickElementRef *p_data;
+ CARD32 i;
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length);
+ SWAP_CARD16 (reply->pickStatus);
+
+ p_data = (pexPickElementRef *)(reply+1);
+ for (i=0; i < reply->numPickElRefs; i++, p_data++)
+ SWAP_PICK_ELEMENT_REF((*p_data));
+
+ SWAP_CARD32 (reply->numPickElRefs);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertPickOneReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexPickOneReq *strmPtr;
+pexPickOneReply *reply;
+{
+ pexPickElementRef *p_data;
+ CARD32 i;
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length);
+ SWAP_CARD16 (reply->pickStatus);
+
+ p_data = (pexPickElementRef *)(reply+1);
+ for (i=0; i < reply->numPickElRefs; i++, p_data++)
+ SWAP_PICK_ELEMENT_REF((*p_data));
+
+ SWAP_CARD32 (reply->numPickElRefs);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertEndPickAllReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexEndPickAllReq *strmPtr;
+pexEndPickAllReply *reply;
+{
+ pexPickElementRef *p_data;
+ CARD32 i, j, num, *buf;
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length);
+ SWAP_CARD16 (reply->pickStatus);
+ SWAP_CARD16 (reply->morePicks);
+
+ /* JSH commented out because until the Pick Functionality is
+ actually written this will seg fault on a NULL pointer
+
+ for ( i=0, buf=(CARD32 *)(reply+1); i < reply->numPicked; i++) {
+ num = *buf;
+ SWAP_CARD32((*buf));
+ buf++;
+ for ( j=0, p_data = (pexPickElementRef *)(buf); j < num; j++, p_data++)
+ SWAP_PICK_ELEMENT_REF((*p_data));
+ buf = (CARD32 *)p_data;
+ }
+
+ */
+ SWAP_CARD32 (reply->numPicked);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertPickAllReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexPickAllReq *strmPtr;
+pexPickAllReply *reply;
+{
+ pexPickElementRef *p_data;
+ CARD32 i, j, num, *buf;
+
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length);
+ SWAP_CARD16 (reply->pickStatus);
+ SWAP_CARD16 (reply->morePicks);
+
+ /* JSH commented out because until the Pick Functionality is
+ actually written this will seg fault on a NULL pointer
+
+ for ( i=0, buf=(CARD32 *)(reply+1); i < reply->numPicked; i++) {
+ num = *buf;
+ SWAP_CARD32((*buf));
+ buf++;
+ for ( j=0, p_data = (pexPickElementRef *)(buf); j < num; j++, p_data++)
+ SWAP_PICK_ELEMENT_REF((*p_data));
+ buf = (CARD32 *)p_data;
+ }
+
+ */
+ SWAP_CARD32 (reply->numPicked);
+}
+
+
+void
+SWAP_FUNC_PREFIX(ConvertQueryFontReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexQueryFontReq *strmPtr;
+pexQueryFontReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD32 (reply->lengthFontInfo);
+
+ SWAP_FUNC_PREFIX(SwapFontInfo) (swapPtr, (pexFontInfo *)(reply+1));
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertListFontsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexListFontsReq *strmPtr;
+pexListFontsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_FUNC_PREFIX(SwapStringList) ( swapPtr, reply->numStrings,
+ (pexString *)(reply+1));
+
+ SWAP_CARD32 (reply->numStrings);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertListFontsWithInfoReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexListFontsWithInfoReq *strmPtr;
+pexListFontsWithInfoReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 numInfo;
+ CARD32 i;
+ CARD8 *ptr;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ ptr = SWAP_FUNC_PREFIX(SwapStringList) ( swapPtr, reply->numStrings,
+ (pexString *)(reply+1));
+
+ SWAP_CARD32 (reply->numStrings);
+
+ numInfo = *((CARD32 *)ptr);
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+
+ for (i=0; i<numInfo; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapFontInfo) (swapPtr, (pexFontInfo *)ptr);
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertQueryTextExtentsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexQueryTextExtentsReq *strmPtr;
+pexQueryTextExtentsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 numInfo;
+
+ numInfo = reply->length / 6;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ SwapExtentInfo (swapPtr, numInfo, (pexExtentInfo *) (reply + 1));
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertGetImpDepConstantsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexGetImpDepConstantsReq *strmPtr;
+pexGetImpDepConstantsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD16 *pnames = (CARD16 *)(strmPtr+1);
+ CARD32 i;
+ CARD32 *ptr = (CARD32 *)(reply+1);
+ PEXFLOAT *pf;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ for (i=0; i<strmPtr->numNames; i++, pnames++, ptr++) {
+ switch (*pnames) {
+ case PEXIDDitheringSupported:
+ case PEXIDMaxEdgeWidth:
+ case PEXIDMaxLineWidth:
+ case PEXIDMaxMarkerSize:
+ case PEXIDMaxModelClipPlanes:
+ case PEXIDMaxNameSetNames:
+ case PEXIDMaxNonAmbientLights:
+ case PEXIDMaxNURBOrder:
+ case PEXIDMaxTrimCurveOrder:
+ case PEXIDMinEdgeWidth:
+ case PEXIDMinLineWidth:
+ case PEXIDMinMarkerSize:
+ case PEXIDNominalEdgeWidth:
+ case PEXIDNominalLineWidth:
+ case PEXIDNominalMarkerSize:
+ case PEXIDNumSupportedEdgeWidths:
+ case PEXIDNumSupportedLineWidths:
+ case PEXIDNumSupportedMarkerSizes:
+ case PEXIDBestColourApproximation:
+ case PEXIDTransparencySupported:
+ SWAP_CARD32((*ptr));
+ break;
+ case PEXIDChromaticityRedU:
+ case PEXIDChromaticityRedV:
+ case PEXIDLuminanceRed:
+ case PEXIDChromaticityGreenU:
+ case PEXIDChromaticityGreenV:
+ case PEXIDLuminanceGreen:
+ case PEXIDChromaticityBlueU:
+ case PEXIDChromaticityBlueV:
+ case PEXIDLuminanceBlue:
+ case PEXIDChromaticityWhiteU:
+ case PEXIDChromaticityWhiteV:
+ case PEXIDLuminanceWhite:
+ pf = (PEXFLOAT *)ptr;
+ SWAP_FLOAT((*pf));
+ break;
+ }
+ }
+}
+
+void
+SWAP_FUNC_PREFIX(ConvertMatchRendererTargetsReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexMatchRendererTargetsReq *strmPtr;
+pexMatchRendererTargetsReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+ CARD32 i, numTargets;
+ pexRendererTarget *rd_data;
+
+ numTargets = reply->length / 2;
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+
+ rd_data = (pexRendererTarget *)(reply + 1);
+
+ for ( i = 0; i < numTargets; i++, rd_data++ )
+ SWAP_RENDERER_TARGET((*rd_data));
+
+}
+
+void
+SWAP_FUNC_PREFIX(EscapeWithReplyReply) (cntxtPtr, strmPtr, reply)
+pexContext *cntxtPtr;
+pexEscapeWithReplyReq *strmPtr;
+pexEscapeWithReplyReply *reply;
+{
+ pexSwap *swapPtr = cntxtPtr->swap;
+
+ SWAP_CARD16 (reply->sequenceNumber);
+ SWAP_CARD32 (reply->length); /* not 0 */
+ SWAP_CARD32 (reply->escapeID);
+
+ /* vendor specific stuff goes here */
+}
+
+void
+SWAP_FUNC_PREFIX(NoReply)()
+{
+
+ }
+
+
+/****************************************************************
+ * utilities *
+ ****************************************************************/
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapStringList) (swapPtr, numStrings, stringPtr)
+pexSwap *swapPtr;
+CARD32 numStrings;
+pexString *stringPtr;
+{
+ CARD32 i;
+ CARD16 j;
+ CARD8 *ptr = (CARD8 *)stringPtr;
+
+ for (i=0; i<numStrings; i++) {
+ SWAP_STRING ((*((pexString *)ptr)));
+ j = ((pexString *)ptr)->length;
+ ptr += j + j%2;
+ }
+ return (ptr);
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapTable)(swapPtr, TType, num, where)
+pexSwap *swapPtr;
+pexTableType TType;
+CARD32 num;
+unsigned char *where;
+{
+ int i;
+ unsigned char *ptr = where;
+ CARD32 numFontIDs;
+
+ switch (TType) {
+ case PEXLineBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapLineBundleEntry) (swapPtr,
+ (pexLineBundleEntry *)ptr);
+ break; }
+
+ case PEXMarkerBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) (swapPtr,
+ (pexMarkerBundleEntry *)ptr);
+ break; }
+
+ case PEXTextBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapTextBundleEntry) (swapPtr,
+ (pexTextBundleEntry *)ptr);
+ break; }
+
+ case PEXInteriorBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) (swapPtr,
+ (pexInteriorBundleEntry *)(ptr));
+ break; }
+
+ case PEXEdgeBundleLUT: {
+ for (i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) (swapPtr,
+ (pexEdgeBundleEntry *)(ptr));
+ break; }
+
+ case PEXPatternLUT: {
+ pexPatternEntry *pe;
+ for (i=0; i<num; i++) {
+ pe = (pexPatternEntry *)ptr;
+ ptr = SWAP_FUNC_PREFIX(SwapPatternEntry) ( swapPtr, pe,
+ pe->numx, pe->numy);
+ SWAP_CARD16 (pe->numx);
+ SWAP_CARD16 (pe->numy);
+ };
+ break; }
+
+ case PEXTextFontLUT: {
+ for (i=0; i<num; i++) {
+ numFontIDs = *(CARD32 *)ptr;
+ ptr += 4;
+ for ( i=0; i<numFontIDs; i++, ptr += sizeof(pexFont)) {
+ SWAP_FONT ((*(pexFont *)ptr));
+ }
+ }
+ break; }
+
+ case PEXColourLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ break; }
+
+ case PEXViewLUT: {
+ pexViewEntry *pv = (pexViewEntry *)ptr;
+ for ( i=0; i<num; i++, pv++)
+ SwapViewEntry (swapPtr, pv);
+ break; }
+
+ case PEXLightLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapLightEntry) (swapPtr,
+ (pexLightEntry *)(ptr));
+ break; }
+
+ case PEXDepthCueLUT: {
+ for ( i=0; i<num; i++)
+ ptr = SWAP_FUNC_PREFIX(SwapDepthCueEntry) (swapPtr,
+ (pexDepthCueEntry *)(ptr));
+ break; }
+
+ case PEXColourApproxLUT: {
+ extern void SwapColourApproxEntry();
+ pexColourApproxEntry *pa = (pexColourApproxEntry *)ptr;
+ for ( i=0; i<num; i++, pa++)
+ SwapColourApproxEntry( swapPtr, pa);
+ break; }
+
+ }
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapSearchContext)(swapPtr, im, ptr)
+pexSwap *swapPtr;
+CARD32 im;
+unsigned char *ptr;
+{
+ unsigned char *sc_data = ptr;
+
+ if (im & PEXSCPosition) {
+ SWAP_COORD3D ((*((pexCoord3D *)sc_data)));
+ sc_data += sizeof(pexCoord3D);
+ };
+
+ if (im & PEXSCDistance) {
+ SWAP_FLOAT ((*((PEXFLOAT *)sc_data)));
+ sc_data += sizeof(PEXFLOAT);
+ };
+
+ /* next 2 are sent as CARD32 so swap them as if they are */
+ if (im & PEXSCCeiling) {
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof(CARD32);
+ }
+
+ if (im & PEXSCModelClipFlag) {
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof (CARD32);
+ }
+
+ if (im & PEXSCStartPath) {
+ int len, i;
+ len = *((CARD32 *) sc_data);
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof(CARD32);
+ for (i=0; i<len; i++, sc_data += sizeof(pexElementRef)) {
+ SWAP_ELEMENT_REF ((*((pexElementRef *)sc_data)));
+ }
+ }
+
+ if (im & PEXSCNormalList) {
+ int len, i;
+ len = *((CARD32 *) sc_data);
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof(CARD32);
+ for (i=0; i<len*2; i++, sc_data += sizeof(CARD32)) {
+ SWAP_NAMESET ((*((CARD32 *)sc_data)));
+ }
+
+ }
+
+ if (im & PEXSCInvertedList) {
+ int len, i;
+ len = *((CARD32 *) sc_data);
+ SWAP_CARD32 ((*((CARD32 *)sc_data)));
+ sc_data += sizeof(CARD32);
+ for (i=0; i<len*2; i++, sc_data += sizeof(CARD32)) {
+ SWAP_NAME ((*((CARD32 *)sc_data)));
+ }
+
+ }
+
+}
+
+
+CARD8 *
+SWAP_FUNC_PREFIX(SwapFontInfo) (swapPtr, pfi)
+pexSwap *swapPtr;
+pexFontInfo *pfi;
+{
+ CARD8 *ptr;
+ CARD32 i;
+ pexFontProp *pfp;
+
+ SWAP_CARD32 (pfi->firstGlyph);
+ SWAP_CARD32 (pfi->lastGlyph);
+ SWAP_CARD32 (pfi->defaultGlyph);
+
+ pfp = (pexFontProp *)(pfi+1);
+ for (i=0; i<pfi->numProps; i++)
+ pfp = (pexFontProp *)(SwapFontProp(swapPtr, pfp));
+
+ SWAP_CARD32 (pfi->numProps);
+
+ ptr = (CARD8 *)pfp;
+ return (ptr);
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapPickMeasAttr) (swapPtr, im, p_data)
+pexSwap *swapPtr;
+CARD32 im;
+unsigned char *p_data;
+{
+ unsigned char *ptr = p_data;
+
+ if (im & PEXPMStatus) {
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXPMPath) {
+ CARD32 i;
+ CARD32 numRefs = *((CARD32 *)ptr);
+ pexPickElementRef *pp;
+
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0, pp = (pexPickElementRef *)ptr; i<numRefs; i++, pp++) {
+ SWAP_PICK_ELEMENT_REF((*pp));
+ }
+ }
+}
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapLightEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexLightEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->lightType);
+ SWAP_VECTOR3D (p_data->direction);
+ SWAP_COORD3D (p_data->point);
+ SWAP_FLOAT (p_data->concentration);
+ SWAP_FLOAT (p_data->spreadAngle);
+ SWAP_FLOAT (p_data->attenuation1);
+ SWAP_FLOAT (p_data->attenuation2);
+
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->lightColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapLineBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexLineBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->lineType);
+ SWAP_ENUM_TYPE_INDEX (p_data->polylineInterp);
+ SWAP_FLOAT (p_data->lineWidth);
+ SWAP_CURVE_APPROX (p_data->curveApprox);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->lineColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexMarkerBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->markerType);
+ SWAP_FLOAT (p_data->markerScale);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->markerColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapTextBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexTextBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_CARD16 (p_data->textFontIndex);
+ SWAP_CARD16 (p_data->textPrecision);
+ SWAP_FLOAT (p_data->charExpansion);
+ SWAP_FLOAT (p_data->charSpacing);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->textColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexInteriorBundleEntry *p_data;
+{
+ unsigned char *po;
+ SWAP_ENUM_TYPE_INDEX (p_data->interiorStyle);
+ SWAP_INT16 (p_data->interiorStyleIndex);
+ SWAP_ENUM_TYPE_INDEX (p_data->reflectionModel);
+ SWAP_ENUM_TYPE_INDEX (p_data->surfaceInterp);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfInteriorStyle);
+ SWAP_INT16 (p_data->bfInteriorStyleIndex);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfReflectionModel);
+ SWAP_ENUM_TYPE_INDEX (p_data->bfSurfaceInterp);
+
+ SwapSurfaceApprox (swapPtr, &(p_data->surfaceApprox));
+ po = (unsigned char *)(p_data+1);
+ po = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)po);
+ po = SWAP_FUNC_PREFIX(SwapReflectionAttr) ( swapPtr,
+ (pexReflectionAttr *)po);
+ po = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)po);
+ po = SWAP_FUNC_PREFIX(SwapReflectionAttr) ( swapPtr,
+ (pexReflectionAttr *)po);
+
+ return (po);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexEdgeBundleEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_ENUM_TYPE_INDEX (p_data->edgeType);
+ SWAP_FLOAT (p_data->edgeWidth);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier)(swapPtr, &(p_data->edgeColour));
+
+ return (ptr);
+}
+
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapDepthCueEntry) (swapPtr, p_data)
+pexSwap *swapPtr;
+pexDepthCueEntry *p_data;
+{
+ unsigned char *ptr = (unsigned char *)p_data;
+ SWAP_FLOAT (p_data->frontPlane);
+ SWAP_FLOAT (p_data->backPlane);
+ SWAP_FLOAT (p_data->frontScaling);
+ SWAP_FLOAT (p_data->backScaling);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) ( swapPtr,
+ &(p_data->depthCueColour));
+
+ return (ptr);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapPatternEntry) (swapPtr, p_data, numx, numy)
+pexSwap *swapPtr;
+pexPatternEntry *p_data;
+CARD16 numx;
+CARD16 numy;
+{
+ int i, max_colours;
+ pexColour *pc = (pexColour *)(p_data + 1);
+
+ max_colours = numx * numy;
+ for (i=0; i<max_colours; i++)
+ pc = (pexColour *) SwapColour (swapPtr, pc, p_data->colourType);
+
+ SWAP_COLOUR_TYPE (p_data->colourType);
+
+ return ((unsigned char *)pc);
+}
+
+unsigned char *
+SWAP_FUNC_PREFIX(SwapPipelineContextAttr) (swapPtr, itemMask, p_data)
+pexSwap *swapPtr;
+CARD32 *itemMask;
+CARD8 *p_data;
+{
+ /* NOTE: See the Protocol Encoding for a desription of these fields
+ in places where CARD16 or INT16 are packed into a 4 byte field
+ (essentially a CARD32) for transmission these fields must be
+ byte swapped as a CARD32. - JSH
+ */
+
+ CARD8 *ptr = p_data;
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerScale) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCMarkerBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextFont) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPrecision) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharExpansion) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharSpacing) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharHeight) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCharUpVector) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextAlignment) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextHeight) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextUpVector) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextPath) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextAlignment) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCAtextStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCTextBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineWidth) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCurveApproximation) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPolylineInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLineBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorStyleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflAttr) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceReflModel) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfInteriorStyleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflAttr) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceReflModel) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCBfSurfaceInterp) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceApproximation) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCCullingMode) {
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDistinguishFlag) {
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternSize) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefPt) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec1) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPatternRefVec2) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCInteriorBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeFlag) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeWidth) {
+ SWAP_FLOAT ((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSurfaceEdgeColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCEdgeBundleIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLocalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCGlobalTransform) {
+ int i, j;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClip) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCModelClipVolume) {
+ CARD32 i, numHalfSpace;
+ pexHalfSpace *ph;
+ numHalfSpace = *((CARD32 *)ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0, ph = (pexHalfSpace *)ptr; i<numHalfSpace; i++, ph++) {
+ SwapHalfSpace (swapPtr, ph);
+ }
+ ptr = (CARD8 *)ph;
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCViewIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCLightState) {
+ CARD32 i, numLights;
+ numLights = *((CARD32 *)ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0; i<numLights; i++) {
+ SWAP_CARD16 ((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ }
+ if (numLights%2) /* pad odd length list to CARD32 boundary */
+ ptr += sizeof(CARD16);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCDepthCueIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCSetAsfValues) {
+ SWAP_CARD32 ((*((CARD32 *)ptr))); /* enables BITMASK */
+ ptr += sizeof(CARD32);
+ SWAP_CARD32 ((*((CARD32 *)ptr))); /* asfs themselves */
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCPickId) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCHlhsrIdentifier) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCNameSet) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCColourApproxIndex) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCRenderingColourModel) {
+ SWAP_CARD32((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ CHECK_BITMASK_ARRAY(itemMask, PEXPCParaSurfCharacteristics) {
+ INT16 type;
+ type = *((INT16 *)ptr);
+ SWAP_INT16((*((INT16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ switch (type) {
+ case PEXPSCNone:
+ case PEXPSCImpDep: break;
+
+ case PEXPSCIsoCurves: {
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD16);
+ break;
+ }
+
+ case PEXPSCMcLevelCurves:
+ case PEXPSCWcLevelCurves: {
+ CARD16 i, num;
+ SWAP_COORD3D((*((pexCoord3D *)ptr)));
+ ptr += sizeof(pexCoord3D);
+ SWAP_VECTOR3D((*((pexVector3D *)ptr)));
+ ptr += sizeof(pexVector3D);
+ num = *((CARD16 *)ptr);
+ SWAP_CARD16((*((CARD16 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++) {
+ SWAP_FLOAT((*((PEXFLOAT *)ptr)));
+ ptr += sizeof(PEXFLOAT);
+ }
+ }
+ }
+ }
+
+
+ return (ptr);
+}
+
+void
+SWAP_FUNC_PREFIX(SwapPickDevAttr) (swapPtr, im, pdata)
+pexSwap *swapPtr;
+CARD32 im;
+unsigned char *pdata;
+{
+ unsigned char *ptr = pdata;
+ int len, i;
+
+ if (im & PEXPDPickStatus) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickPath) {
+ len = (int)(*ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0; i<len; i++, ptr += sizeof(pexPickElementRef)) {
+ SWAP_PICK_ELEMENT_REF ((*((pexPickElementRef *)ptr)));
+ };
+ };
+
+ if (im & PEXPDPickPathOrder) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickIncl) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ };
+
+ if (im & PEXPDPickExcl) {
+ SWAP_NAMESET ((*((pexNameSet *)ptr)));
+ ptr += sizeof(pexNameSet);
+ };
+
+ if (im & PEXPDPickDataRec) {
+ len = (int)(*ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ ptr += len + PADDING(len); /* pad it out */
+ };
+
+ if (im & PEXPDPickPromptEchoType) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ };
+
+ if (im & PEXPDPickEchoVolume) {
+ SwapViewport(swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ }
+
+ if (im & PEXPDPickEchoSwitch) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ }
+}
+
+
+void
+SWAP_FUNC_PREFIX(SwapRendererAttributes) (swapPtr, im, p_data)
+pexSwap *swapPtr;
+CARD32 im;
+CARD8 *p_data;
+{
+ CARD8 *ptr = p_data;
+ CARD32 num, i;
+
+ if (im & PEXRDPipelineContext) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDCurrentPath) {
+ num = *((CARD32 *)ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++, ptr += sizeof(pexElementRef))
+ SWAP_ELEMENT_REF((*((pexElementRef *)ptr)));
+ }
+
+ if (im & PEXRDMarkerBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDTextBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDLineBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInteriorBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDEdgeBundle) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDViewTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDColourTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDDepthCueTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDLightTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDColourApproxTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDPatternTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDTextFontTable) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHighlightIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHighlightExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInvisibilityIncl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDInvisibilityExcl) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* Swap this and HLHSR as CARD32 since they're in a 4 byte field in
+ the LISTofVALUE */
+
+ if (im & PEXRDRendererState) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDHlhsrMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+
+ }
+
+ if (im & PEXRDNpcSubvolume) {
+ SwapNpcSubvolume (swapPtr, (pexNpcSubvolume *)ptr);
+ ptr += sizeof(pexNpcSubvolume);
+ }
+
+ if (im & PEXRDViewport) {
+ SwapViewport (swapPtr, (pexViewport *)ptr);
+ ptr += sizeof(pexViewport);
+ }
+
+ if (im & PEXRDClipList) {
+ num = *((CARD32 *)ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ SwapDeviceRects (swapPtr, num, (pexDeviceRect *)ptr);
+ ptr += sizeof(pexDeviceRect) * num;
+ }
+
+ if (im & PEXRDPickInclusion) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDPickExclusion) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ if (im & PEXRDPickStartPath) {
+ num = *((CARD32 *)ptr);
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ for (i=0; i<num; i++, ptr += sizeof(pexElementRef))
+ SWAP_ELEMENT_REF((*((pexElementRef *)ptr)));
+ }
+
+ if (im & PEXRDBackgroundColour) {
+ ptr = SWAP_FUNC_PREFIX(SwapColourSpecifier) (swapPtr,
+ (pexColourSpecifier *)ptr);
+ }
+
+ /* this is CARD8 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDClearI) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* this is CARD8 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDClearZ) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+
+ /* this is CARD16 cast into a CARD32 so it must get swapped as CARD32 */
+ if (im & PEXRDEchoMode) {
+ SWAP_CARD32 ((*((CARD32 *)ptr)));
+ ptr += sizeof(CARD32);
+ }
+}
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.h b/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.h
new file mode 100644
index 000000000..be80c3f3e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/uconvRep.h
@@ -0,0 +1,107 @@
+/* $TOG: uconvRep.h /main/4 1998/02/10 12:38:08 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+LOCAL_FLAG void
+ SWAP_FUNC_PREFIX(ConvertGetExtensionInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetEnumeratedTypeInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetImpDepConstantsReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetTableInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetPredefinedEntriesReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetDefinedIndicesReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetTableEntryReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetTableEntriesReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetPipelineContextReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetRendererAttributesReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetRendererDynamicsReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetStructureInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetElementInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetStructuresInNetworkReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetAncestorsReply) (),
+ SWAP_FUNC_PREFIX(ConvertElementSearchReply) (),
+ SWAP_FUNC_PREFIX(ConvertFetchElementsReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetNameSetReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetSearchContextReply) (),
+ SWAP_FUNC_PREFIX(ConvertSearchNetworkReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetWksInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetDynamicsReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetViewRepReply) (),
+ SWAP_FUNC_PREFIX(ConvertMapDCtoWCReply) (),
+ SWAP_FUNC_PREFIX(ConvertMapWCtoDCReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetWksPostingsReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetPickDeviceReply) (),
+ SWAP_FUNC_PREFIX(ConvertGetPickMeasureReply) (),
+ SWAP_FUNC_PREFIX(ConvertQueryFontReply) (),
+ SWAP_FUNC_PREFIX(ConvertListFontsReply) (),
+ SWAP_FUNC_PREFIX(ConvertListFontsWithInfoReply) (),
+ SWAP_FUNC_PREFIX(ConvertQueryTextExtentsReply) (),
+ SWAP_FUNC_PREFIX(ConvertMatchRendererTargetsReply) (),
+ SWAP_FUNC_PREFIX(EscapeWithReplyReply) (),
+ SWAP_FUNC_PREFIX(ConvertEndPickOneReply) (),
+ SWAP_FUNC_PREFIX(ConvertPickOneReply) (),
+ SWAP_FUNC_PREFIX(ConvertEndPickAllReply) (),
+ SWAP_FUNC_PREFIX(ConvertPickAllReply) (),
+ SWAP_FUNC_PREFIX(NoReply)();
+
+
+LOCAL_FLAG void
+ SWAP_FUNC_PREFIX(SwapTable)(),
+ SWAP_FUNC_PREFIX(SwapSearchContext)(),
+ SWAP_FUNC_PREFIX(SwapPickMeasAttr) (),
+ SWAP_FUNC_PREFIX(SwapPickDevAttr) (),
+ SWAP_FUNC_PREFIX(SwapRendererAttributes) ();
+
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapStringList) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapLightEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapLineBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapMarkerBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapTextBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapInteriorBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapEdgeBundleEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapDepthCueEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapPatternEntry) ();
+LOCAL_FLAG unsigned char * SWAP_FUNC_PREFIX(SwapPipelineContextAttr) ();
+
+LOCAL_FLAG CARD8 * SWAP_FUNC_PREFIX(SwapFontInfo) ();
+
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/Imakefile b/xc/programs/Xserver/PEX5/dipex/swap/util/Imakefile
new file mode 100644
index 000000000..c4fa1ea84
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/Imakefile
@@ -0,0 +1,26 @@
+# $XConsortium: Imakefile /main/3 1996/09/28 16:55:13 rws $
+# This can be used directly as a Makefile, with make -f Imakefile
+
+PEXINCLUDE = ./../../../../../include/PEX
+
+all:: cOCTables.ci uOCTables.ci Requests.h Requests.ci
+
+cOCTables.ci:
+ echo "STUB_NAME " "cPEX" | cat > OCTables.temp
+ sed -n '/##/!p' OCReduce.sed > OCReduce.temp
+ awk -f OCTables.awk OCTables.temp $(PEXINCLUDE)/PEX.h | awk -f OCReduce.awk | sed -f OCReduce.temp > cOCTables.ci
+
+uOCTables.ci:
+ echo "STUB_NAME " "uPEX" | cat > OCTables.temp
+ sed -n '/##/!p' OCReduce.sed > OCReduce.temp
+ awk -f OCTables.awk OCTables.temp $(PEXINCLUDE)/PEX.h | awk -f OCReduce.awk | sed -f OCReduce.temp > uOCTables.ci
+
+Requests.h:
+ awk -f ReqTab.awk $(PEXINCLUDE)/PEX.h > Requests.h
+
+Requests.ci:
+ awk -f ReqSame.awk Requests.h > Requests.ci
+
+clean:
+ rm -f cOCTables.ci uOCTables.ci Requests.h Requests.ci
+ rm -f cOCTables.temp uOCTables.temp
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.awk b/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.awk
new file mode 100644
index 000000000..e2d6fbb80
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.awk
@@ -0,0 +1,150 @@
+##
+# $TOG: OCReduce.awk /main/3 1998/02/10 14:00:40 kaleb $
+##
+##
+## Copyright 1996, 1998 The Open Group
+##
+## All Rights Reserved.
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+## AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+##
+## Except as contained in this notice, the name of The Open Group shall not be
+## used in advertising or otherwise to promote the sale, use or other dealings
+## in this Software without prior written authorization from The Open Group.
+##
+###########################################################################
+## Copyright 1990, 1991 by Sun Microsystems, Inc.
+##
+## All Rights Reserved
+##
+## Permission to use, copy, modify, and distribute this software and its
+## documentation for any purpose and without fee is hereby granted,
+## provided that the above copyright notice appear in all copies and that
+## both that copyright notice and this permission notice appear in
+## supporting documentation, and that the names of Sun Microsystems
+## and The Open Group not be used in advertising or publicity
+## pertaining to distribution of the software without specific, written
+## prior permission.
+##
+## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+## SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+## SOFTWARE.
+##
+###########################################################################
+## Usage:
+## rm -f temp.dat
+## echo "STUB_NAME " <stub_name> | cat > temp.dat
+## awk -f OCTables.awk temp.dat <pex-include-path>/PEX.h | awk -f OCReduce.awk | sed -f OCReduce.sed > <output_file>
+##
+BEGIN { }
+ {
+ if ($1 ~ /ColourIndex/) {
+ if ($1 ~ /MarkerColourIndex/ ) { print $0 }
+ else if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXMarkerColourIndex,\t/* " name " */" }
+ else {
+ print "\tSwapPEXMarkerColourIndex\t/* " name " */" } } }
+ else if ($1 ~ /Index\)/) {
+ if ($1 ~ /MarkerBundleIndex/ ) { print $0 }
+ else if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXMarkerBundleIndex,\t/* " name " */" }
+ else {
+ print "\tSwapPEXMarkerBundleIndex\t/* " name " */" } } }
+ else if ($1 ~ /Colour/) {
+ if ($1 ~ /MarkerColour/ ) { print $0 }
+ else if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSWAP_OC_PREFIX(MarkerColour),\t/* " name " */" }
+ else {
+ print "\tSWAP_OC_PREFIX(MarkerColour)\t/* " name " */" } } }
+ else if ( $1 ~ /Bf/) {
+ if ($2 !~ /\(\)/) {
+ lh = index($1,"Bf")
+ rh = index($1,")")
+ name = substr($1,(lh+2),(rh-lh-2))
+ if (($1 ~ /Colour/) && ($1 !~ /Index/) || ($1 ~ /SurfaceReflAttr/)) {
+ if ($0 ~ /,/) {
+ print "\tSWAP_OC_PREFIX(" name "),\t/* Bf" name " */" }
+ else {
+ print "\tSWAP_OC_PREFIX(" name ")\t/* Bf" name " */" } }
+ else {
+ if ($0 ~ /,/) {
+ print "\tSwapPEX" name ",\t/* Bf" name " */" }
+ else {
+ print "\tSwapPEX" name "\t/* Bf" name " */" } } } }
+ else if ($1 ~ /Atext/) {
+ if ($1 ~ /Style/) { print $0 }
+ else if ($2 !~ /\(\)/) {
+ if (($1 ~ /AtextHeight/) || ($1 ~ /AtextUpVector/)) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+6),(rh-lh-6))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXChar" name ",\t/* Atext" name " */" }
+ else {
+ print "\tSwapPEXChar" name "\t/* Atext" name " */" } }
+ else {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+3),(rh-lh-3))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXT" name ",\t/* At" name " */" }
+ else {
+ print "\tSwapPEXT" name "\t/* At" name " */" } } } }
+ else if ($1 ~ /RemoveFromNameSet/) {
+ if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSWAP_OC_PREFIX(AddToNameSet),\t/* " name " */" }
+ else {
+ print "\tSWAP_OC_PREFIX(AddToNameSet0\t/* " name " */" } } }
+ else if ($1 ~ /SurfaceEdgeWidth/) {
+ if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXLineWidth,\t/* " name " */" }
+ else {
+ print "\tSwapPEXLineWidth\t/* " name " */" } } }
+ else if ($1 ~ /TCApproximation/) {
+ if ($2 !~ /\(\)/) {
+ lh = index($1,"(")
+ rh = index($1,")")
+ name = substr($1,(lh+1),(rh-lh-1))
+ if ($0 ~ /,/) {
+ print "\tSwapPEXCurveApproximation,\t/* " name " */" }
+ else {
+ print "\tSwapPEXCurveApproximation\t/* " name " */" } } }
+ else if ($1 ~ /\(All\)/) {
+ lh = index($0,"SWAP_OC_PREFIX(") - 1
+ rh = index($0,")") + 1
+ print substr($0,1,lh) "SwapPEXOCUnused" substr($0,rh,(length($0)+1-rh)) }
+ else print $0
+ }
+END { }
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.sed b/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.sed
new file mode 100644
index 000000000..aa3eb0220
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/OCReduce.sed
@@ -0,0 +1,94 @@
+##
+# $TOG: OCReduce.sed /main/3 1998/02/10 14:00:46 kaleb $
+##
+## Copyright 1996, 1998 The Open Group
+##
+## All Rights Reserved.
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+## AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+##
+## Except as contained in this notice, the name of The Open Group shall not be
+## used in advertising or otherwise to promote the sale, use or other dealings
+##
+###########################################################################
+## Copyright 1990, 1991 by Sun Microsystems, Inc.
+##
+## All Rights Reserved
+##
+## Permission to use, copy, modify, and distribute this software and its
+## documentation for any purpose and without fee is hereby granted,
+## provided that the above copyright notice appear in all copies and that
+## both that copyright notice and this permission notice appear in
+## supporting documentation, and that the names of Sun Microsystems
+## and The Open Group not be used in advertising or publicity
+## pertaining to distribution of the software without specific, written
+## prior permission.
+##
+## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+## SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+## SOFTWARE.
+##
+###########################################################################
+## Usage:
+## rm -f temp.dat
+## echo "STUB_NAME " <stub_name> | cat > temp.dat
+## awk -f OCTables.awk temp.dat <pex-include-path>/PEX.h | awk -f OCReduce.awk | sed -f OCReduce.sed > <output_file>
+##
+s/SWAP_OC_PREFIX(MarkerType)/SwapPEXMarkerType/g
+s/SWAP_OC_PREFIX(MarkerScale)/SwapPEXMarkerScale/g
+s/SWAP_OC_PREFIX(MarkerColourIndex)/SwapPEXMarkerColourIndex/g
+s/SWAP_OC_PREFIX(MarkerBundleIndex)/SwapPEXMarkerBundleIndex/g
+s/SWAP_OC_PREFIX(AtextStyle)/SwapPEXAtextStyle/g
+s/SWAP_OC_PREFIX(TextPrecision)/SwapPEXTextPrecision/g
+s/SWAP_OC_PREFIX(CharExpansion)/SwapPEXCharExpansion/g
+s/SWAP_OC_PREFIX(CharSpacing)/SwapPEXCharSpacing/g
+s/SWAP_OC_PREFIX(CharHeight)/SwapPEXCharHeight/g
+s/SWAP_OC_PREFIX(CharUpVector)/SwapPEXCharUpVector/g
+s/SWAP_OC_PREFIX(TextPath)/SwapPEXTextPath/g
+s/SWAP_OC_PREFIX(TextAlignment)/SwapPEXTextAlignment/g
+s/SWAP_OC_PREFIX(LineType)/SwapPEXLineType/g
+s/SWAP_OC_PREFIX(LineWidth)/SwapPEXLineWidth/g
+s/SWAP_OC_PREFIX(LineColourIndex)/SwapPEXLineColourIndex/g
+s/SWAP_OC_PREFIX(CurveApproximation)/SwapPEXCurveApproximation/g
+s/SWAP_OC_PREFIX(PolylineInterp)/SwapPEXPolylineInterp/g
+s/SWAP_OC_PREFIX(InteriorStyle)/SwapPEXInteriorStyle/g
+s/SWAP_OC_PREFIX(SurfaceColourIndex)/SwapPEXSurfaceColourIndex/g
+s/SWAP_OC_PREFIX(SurfaceReflModel)/SwapPEXSurfaceReflModel/g
+s/SWAP_OC_PREFIX(SurfaceInterp)/SwapPEXSurfaceInterp/g
+s/SWAP_OC_PREFIX(SurfaceApproximation)/SwapPEXSurfaceApproximation/g
+s/SWAP_OC_PREFIX(CullingMode)/SwapPEXCullingMode/g
+s/SWAP_OC_PREFIX(DistinguishFlag)/SwapPEXDistinguishFlag/g
+s/SWAP_OC_PREFIX(PatternSize)/SwapPEXPatternSize/g
+s/SWAP_OC_PREFIX(PatternRefPt)/SwapPEXPatternRefPt/g
+s/SWAP_OC_PREFIX(PatternAttr)/SwapPEXPatternAttr/g
+s/SWAP_OC_PREFIX(SurfaceEdgeFlag)/SwapPEXSurfaceEdgeFlag/g
+s/SWAP_OC_PREFIX(SurfaceEdgeType)/SwapPEXSurfaceEdgeType/g
+s/SWAP_OC_PREFIX(SurfaceEdgeWidth)/SwapPEXSurfaceEdgeWidth/g
+s/SWAP_OC_PREFIX(SetAsfValues)/SwapPEXSetAsfValues/g
+s/SWAP_OC_PREFIX(LocalTransform)/SwapPEXLocalTransform/g
+s/SWAP_OC_PREFIX(LocalTransform2D)/SwapPEXLocalTransform2D/g
+s/SWAP_OC_PREFIX(GlobalTransform)/SwapPEXGlobalTransform/g
+s/SWAP_OC_PREFIX(GlobalTransform2D)/SwapPEXGlobalTransform2D/g
+s/SWAP_OC_PREFIX(ModelClip)/SwapPEXModelClip/g
+s/SWAP_OC_PREFIX(RestoreModelClip)/SwapPEXRestoreModelClip/g
+s/SWAP_OC_PREFIX(LightState)/SwapPEXLightState/g
+s/SWAP_OC_PREFIX(PickId)/SwapPEXPickId/g
+s/SWAP_OC_PREFIX(HlhsrIdentifier)/SwapPEXHlhsrIdentifier/g
+s/SWAP_OC_PREFIX(ExecuteStructure)/SwapPEXExecuteStructure/g
+s/SWAP_OC_PREFIX(Label)/SwapPEXLabel/g
+s/SWAP_OC_PREFIX(ApplicationData)/SwapPEXApplicationData/g
+s/SWAP_OC_PREFIX(Gse)/SwapPEXGse/g
+s/SWAP_OC_PREFIX(RenderingColourModel)/SwapPEXRenderingColourModel/g
+s/SWAP_OC_PREFIX(OCUnused)/SwapPEXOCUnused/g
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/OCTables.awk b/xc/programs/Xserver/PEX5/dipex/swap/util/OCTables.awk
new file mode 100644
index 000000000..9e55b3a50
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/OCTables.awk
@@ -0,0 +1,113 @@
+# $TOG: OCTables.awk /main/3 1998/02/10 14:00:53 kaleb $
+##
+## Copyright 1996, 1998 The Open Group
+##
+## All Rights Reserved.
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+## AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+##
+## Except as contained in this notice, the name of The Open Group shall not be
+## used in advertising or otherwise to promote the sale, use or other dealings
+##
+###########################################################################
+## Copyright 1990, 1991 by Sun Microsystems, Inc.
+##
+## All Rights Reserved
+##
+## Permission to use, copy, modify, and distribute this software and its
+## documentation for any purpose and without fee is hereby granted,
+## provided that the above copyright notice appear in all copies and that
+## both that copyright notice and this permission notice appear in
+## supporting documentation, and that the names of Sun Microsystems
+## and The Open Group not be used in advertising or publicity
+## pertaining to distribution of the software without specific, written
+## prior permission.
+##
+## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+## SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+## SOFTWARE.
+##
+###########################################################################
+## Usage:
+## rm -f temp.dat
+## echo "STUB_NAME " <stub_name> | cat > temp.dat
+## awk -f OCTables.awk temp.dat <pex-include-path>/PEX.h > <output_file>
+##
+BEGIN { num=0; i=0;
+ print "/* Automatically generated OC table"
+ print " */"
+ print "/******************************************************************"
+ print "Copyright 1990, 1991 by Sun Microsystems, Inc. and The Open Group."
+ print ""
+ print " All Rights Reserved"
+ print ""
+ print "Permission to use, copy, modify, and distribute this software and its "
+ print "documentation for any purpose and without fee is hereby granted, "
+ print "provided that the above copyright notice appear in all copies and that"
+ print "both that copyright notice and this permission notice appear in "
+ print "supporting documentation, and that the names of Sun Microsystems "
+ print "and The Open Group not be used in advertising or publicity "
+ print "pertaining to distribution of the software without specific, written "
+ print "prior permission. "
+ print ""
+ print "SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, "
+ print "INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT "
+ print "SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL "
+ print "DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,"
+ print "WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,"
+ print "ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS"
+ print "SOFTWARE."
+ print ""
+ print "******************************************************************/"
+ print "#include \"X.h\""
+ print "#include \"PEX.h\""
+ print "#include \"PEXprotost.h\""
+ print "#include \"PEXproto.h\""
+ print "#include \"dipex.h\""
+ print "#include \"pexSwap.h\"\n" }
+##
+## Look only for lines starting with PEXOC (in PEX.h).
+## Name (minus PEXOC) is saved in array for printing at the end
+## (signalled by reaching "PEXMaxOC"). This allows us to do the
+## extern declarations and the table in one pass.
+##
+ $1 == "#define" {
+ if ($2 == "PEXMaxOC") {
+ print "extern ErrorCode"
+ for (i=0; i<(num-1); i++) {
+ print "\tSWAP_OC_PREFIX(" str[i] ") ()," }
+ print "\tSWAP_OC_PREFIX(" str[i] ") ();\n"
+ print "OCFunction SWAP_OC_PREFIX(OutputCmd) [] = {"
+ for (i=0; i<(num-1); i++) {
+ print "\tSWAP_OC_PREFIX(" str[i] ")," }
+ print "\tSWAP_OC_PREFIX(" str[i] ")"
+ print "};\n\n#undef SWAP_OC_PREFIX" }
+ else if (index($2,"PEXOC") == 1) {
+ str[num] = substr($2,6,(length($2)-5))
+ num++ }
+ }
+##
+## The next few lines are only for determining the name of the OC_PREFIX
+## from the temporary file just made up for this purpose.
+##
+$1 == "STUB_NAME" {
+ print "#if defined (__STDC__)"
+ print "#define SWAP_OC_PREFIX(t)\t" $2 "##t"
+ print "#else"
+ print "#define SWAP_OC_PREFIX(t)\t" $2 "/**/t"
+ print "#endif\n" }
+##
+##
+END { }
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/ReqSame.awk b/xc/programs/Xserver/PEX5/dipex/swap/util/ReqSame.awk
new file mode 100644
index 000000000..ac6d0dbc4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/ReqSame.awk
@@ -0,0 +1,113 @@
+# $TOG: ReqSame.awk /main/4 1998/02/10 14:00:59 kaleb $
+##
+## Copyright 1996, 1998 The Open Group
+##
+## All Rights Reserved.
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+## AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+##
+## Except as contained in this notice, the name of The Open Group shall not be
+## used in advertising or otherwise to promote the sale, use or other dealings
+##
+###########################################################################
+## Copyright 1990, 1991 by Sun Microsystems, Inc.
+##
+## All Rights Reserved
+##
+## Permission to use, copy, modify, and distribute this software and its
+## documentation for any purpose and without fee is hereby granted,
+## provided that the above copyright notice appear in all copies and that
+## both that copyright notice and this permission notice appear in
+## supporting documentation, and that the names of Sun Microsystems
+## and The Open Group not be used in advertising or publicity
+## pertaining to distribution of the software without specific, written
+## prior permission.
+##
+## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+## SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+## SOFTWARE.
+##
+###########################################################################
+## Finds names that use the same swapping routine and renames them.
+##
+## Usage:
+## awk -f ReqSame.awk Requests.h > Requests.ci
+##
+BEGIN {
+ num = 0; name = ""; lend = 0; oname = ""; rend = 0; D=0 }
+ $1$2 == "#ifdefSWAP_FUNC_PREFIX" {
+ D=1
+ print "#include \"convReq.h\"" }
+ D == 0 {
+ if ($4 ~ /SWAP_FUNC_PREFIX/) {
+ lend = index($0,"(PEX")
+ rend = index($0,")")
+ name = substr($0,(lend+4),(rend-lend-4))
+ oname = name
+ if (name == "FreeLookupTable") {
+ name = "GenericResourceRequest" }
+ else if (name == "GetDefinedIndices") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreePipelineContext") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreeRenderer") {
+ name = "GenericResourceRequest" }
+ else if (name == "EndRendering") {
+ name = "GenericResourceRequest" }
+ else if (name == "EndStructure") {
+ name = "GenericResourceRequest" }
+ else if (name == "CreateStructure") {
+ name = "GenericResourceRequest" }
+ else if (name == "GetRendererDynamics") {
+ name = "GenericResourceRequest" }
+ else if (name == "CreateNameSet") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreeNameSet") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreeSearchContext") {
+ name = "GenericResourceRequest" }
+ else if (name == "SearchNetwork") {
+ name = "GenericResourceRequest" }
+ else if (name == "GetNameSet") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreePhigsWks") {
+ name = "GenericResourceRequest" }
+ else if (name == "RedrawAllStructures") {
+ name = "GenericResourceRequest" }
+ else if (name == "UpdateWorkstation") {
+ name = "GenericResourceRequest" }
+ else if (name == "ExecuteDeferredActions") {
+ name = "GenericResourceRequest" }
+ else if (name == "UnpostAllStructures") {
+ name = "GenericResourceRequest" }
+ else if (name == "GetWksPostings") {
+ name = "GenericResourceRequest" }
+ else if (name == "FreePickMeasure") {
+ name = "GenericResourceRequest" }
+ else if (name == "CloseFont") {
+ name = "GenericResourceRequest"}
+ else if (name == "GetDescendants") {
+ name = "GetAncestors" }
+ else {
+ name = ""
+ }}
+ if (name == "") {
+ print $0 }
+ else {
+ print substr($0,1,lend) "PEX" name substr($0,rend,(length($0))) "\t/*" oname "*/" }
+ name = "" }
+
+ D == 1 { if ($0 ~ /;/) { D=0 } }
+END { }
diff --git a/xc/programs/Xserver/PEX5/dipex/swap/util/ReqTab.awk b/xc/programs/Xserver/PEX5/dipex/swap/util/ReqTab.awk
new file mode 100644
index 000000000..660b222e0
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/dipex/swap/util/ReqTab.awk
@@ -0,0 +1,97 @@
+# $TOG: ReqTab.awk /main/3 1998/02/10 14:01:05 kaleb $
+##
+## Copyright 1996, 1998 The Open Group
+##
+## All Rights Reserved.
+##
+## The above copyright notice and this permission notice shall be included in
+## all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+## OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+## AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+##
+## Except as contained in this notice, the name of The Open Group shall not be
+## used in advertising or otherwise to promote the sale, use or other dealings
+##
+###########################################################################
+## Copyright 1990, 1991 by Sun Microsystems, Inc.
+##
+## All Rights Reserved
+##
+## Permission to use, copy, modify, and distribute this software and its
+## documentation for any purpose and without fee is hereby granted,
+## provided that the above copyright notice appear in all copies and that
+## both that copyright notice and this permission notice appear in
+## supporting documentation, and that the names of Sun Microsystems
+## and The Open Group not be used in advertising or publicity
+## pertaining to distribution of the software without specific, written
+## prior permission.
+##
+## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+## SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+## SOFTWARE.
+##
+###########################################################################
+## Usage:
+## awk -f ReqTab.awk <pex-include-path>/PEX.h > <output_file>
+##
+BEGIN { num = 0; lend = 0;
+ print "/* Automatically generated Request table"
+ print " */"
+ print "/******************************************************************"
+ print "Copyright 1990, 1991 by Sun Microsystems, Inc. and The Open Group."
+ print ""
+ print " All Rights Reserved"
+ print ""
+ print "Permission to use, copy, modify, and distribute this software and its "
+ print "documentation for any purpose and without fee is hereby granted, "
+ print "provided that the above copyright notice appear in all copies and that"
+ print "both that copyright notice and this permission notice appear in "
+ print "supporting documentation, and that the names of Sun Microsystems "
+ print "and The Open Group not be used in advertising or publicity "
+ print "pertaining to distribution of the software without specific, written "
+ print "prior permission. "
+ print ""
+ print "SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, "
+ print "INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT "
+ print "SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL "
+ print "DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,"
+ print "WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,"
+ print "ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS"
+ print "SOFTWARE."
+ print ""
+ print "******************************************************************/"
+ print "#ifdef SWAP_FUNC_PREFIX"
+ print "#undef SWAP_FUNC_PREFIX"
+ print "#endif"
+ print "#define SWAP_FUNC_PREFIX(nm) nm"
+ }
+
+ $1 == "#define" {
+ lend = index($2,"PEX_")
+ if ((lend > 0) && ($2 != "PEX_H") && ($2 !~ /NAME/) && ($2 !~ /PROTO/) && ($2 !~ /BIT/) && ($2 !~ /MASK/)) {
+ names[num] = substr($2,(lend+4),(length($2)-4))
+ num++ } }
+END {
+ num--
+ print "\nLOCAL_FLAG ErrorCode"
+ print "\tSWAP_FUNC_PREFIX(PEXRequestUnused) (),"
+ for (i=0; i<num; i++) {
+ print "\tSWAP_FUNC_PREFIX(PEX" names[i] ") ()," }
+ print "\tSWAP_FUNC_PREFIX(PEX" names[num] ") ();\n"
+ print "RequestFunction SWAP_FUNC_PREFIX(PEXRequest)[] = {"
+ print "/* 0\t*/ SWAP_FUNC_PREFIX(PEXRequestUnused),"
+ for (i=0; i<num; i++) {
+ print "/* " (i+1) "\t*/ SWAP_FUNC_PREFIX(PEX" names[i] ")," }
+ print "/* " (num+1) "\t*/ SWAP_FUNC_PREFIX(PEX" names[num] ")"
+ print "};"
+ print "\n#undef SWAP_FUNC_PREFIX\n"
+}
diff --git a/xc/programs/Xserver/PEX5/include/PEX.h b/xc/programs/Xserver/PEX5/include/PEX.h
new file mode 100644
index 000000000..4fbd84654
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEX.h
@@ -0,0 +1,1127 @@
+/* $TOG: PEX.h /main/13 1998/02/10 12:33:17 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#ifndef PEX_H
+#define PEX_H
+
+#ifdef LOCAL_PEX_NAME
+#define PEX_NAME_STRING LOCAL_PEX_NAME
+#else
+#define PEX_NAME_STRING "X3D-PEX"
+#endif
+
+/* Matches revision 5.1C */
+
+#define PEX_PROTO_MAJOR 5 /* current protocol version */
+#define PEX_PROTO_MINOR 1 /* current minor version */
+
+/* Events */
+#define PEXMaxHitsReached 0
+#define PEXNumberEvents 1
+
+/* Subsets */
+#define PEXCompleteImplementation 0
+#define PEXImmediateModeOnly 1
+#define PEXPhigsWksOnly 2
+#define PEXStructureModeOnly 4
+
+/* Resources */
+#define PEXAlreadyFreed 1
+
+/* Asf Attributes */
+
+/* Masks for setting Asf's */
+#define PEXMarkerTypeAsf (1L<<0)
+#define PEXMarkerScaleAsf (1L<<1)
+#define PEXMarkerColourAsf (1L<<2)
+#define PEXTextFontIndexAsf (1L<<3)
+#define PEXTextPrecAsf (1L<<4)
+#define PEXCharExpansionAsf (1L<<5)
+#define PEXCharSpacingAsf (1L<<6)
+#define PEXTextColourAsf (1L<<7)
+#define PEXLineTypeAsf (1L<<8)
+#define PEXLineWidthAsf (1L<<9)
+#define PEXLineColourAsf (1L<<10)
+#define PEXCurveApproxAsf (1L<<11)
+#define PEXPolylineInterpAsf (1L<<12)
+#define PEXInteriorStyleAsf (1L<<13)
+#define PEXInteriorStyleIndexAsf (1L<<14)
+#define PEXSurfaceColourAsf (1L<<15)
+#define PEXSurfaceInterpAsf (1L<<16)
+#define PEXReflectionModelAsf (1L<<17)
+#define PEXReflectionAttrAsf (1L<<18)
+#define PEXBfInteriorStyleAsf (1L<<19)
+#define PEXBfInteriorStyleIndexAsf (1L<<20)
+#define PEXBfSurfaceColourAsf (1L<<21)
+#define PEXBfSurfaceInterpAsf (1L<<22)
+#define PEXBfReflectionModelAsf (1L<<23)
+#define PEXBfReflectionAttrAsf (1L<<24)
+#define PEXSurfaceApproxAsf (1L<<25)
+#define PEXSurfaceEdgesAsf (1L<<26)
+#define PEXSurfaceEdgeTypeAsf (1L<<27)
+#define PEXSurfaceEdgeWidthAsf (1L<<28)
+#define PEXSurfaceEdgeColourAsf (1L<<29)
+#define PEXMaxAsfShift 29
+
+/* Asf Values */
+#define PEXBundled 0
+#define PEXIndividual 1
+
+/* Composition */
+#define PEXPreConcatenate 0
+#define PEXPostConcatenate 1
+#define PEXReplace 2
+
+/* Cull mode */
+/* 0 None */
+#define PEXBackFaces 1
+#define PEXFrontFaces 2
+
+/* Curve Type and Surface Type */
+#define PEXRational 0
+#define PEXNonRational 1
+
+/* Edit Mode */
+#define PEXStructureInsert 0
+#define PEXStructureReplace 1
+
+/* Whence values */
+#define PEXBeginning 0
+#define PEXCurrent 1
+#define PEXEnd 2
+
+/* Match Draw Type */
+#define PEXDontCare 0
+#define PEXWindow 1
+#define PEXPixmap 2
+#define PEXBuffer 3
+
+/* Pick All State */
+#define PEXMoreHits 0
+#define PEXNoMoreHits 1
+#define PEXMayBeMoreHits 2
+
+/* PickOne Methods */
+#define PEXLast 1
+#define PEXClosestZ 2
+#define PEXVisibleAny 3
+#define PEXVisibleClosest 4
+
+/* PickAll Methods */
+#define PEXAllPicks 1
+#define PEXVisible 2
+
+/* Element Search */
+#define PEXNotFound 1
+#define PEXFound 2
+
+/* GetEnumeratedType return format */
+#define PEXETIndex 1
+#define PEXETMnemonic 2
+#define PEXETBoth 3
+
+/* Enum Types */
+#define PEXETMarkerType 1
+#define PEXETATextStyle 2
+#define PEXETInteriorStyle 3
+#define PEXETHatchStyle 4
+#define PEXETLineType 5
+#define PEXETSurfaceEdgeType 6
+#define PEXETPickDeviceType 7
+#define PEXETPolylineInterpMethod 8
+#define PEXETCurveApproxMethod 9
+#define PEXETReflectionModel 10
+#define PEXETSurfaceInterpMethod 11
+#define PEXETSurfaceApproxMethod 12
+#define PEXETModelClipOperator 13
+#define PEXETLightType 14
+#define PEXETColourType 15
+#define PEXETFloatFormat 16
+#define PEXETHlhsrMode 17
+#define PEXETPromptEchoType 18
+#define PEXETDisplayUpdateMode 19
+#define PEXETColourApproxType 20
+#define PEXETColourApproxModel 21
+#define PEXETGDP 22
+#define PEXETGDP3 23
+#define PEXETGSE 24
+#define PEXETTrimCurveApproxMethod 25
+#define PEXETRenderingColourModel 26
+#define PEXETParaSurfCharacteristics 27
+#define PEXETEscape 28
+#define PEXETPickOneMethod 29
+#define PEXETPickAllMethod 30
+
+/* Renderer State */
+#define PEXIdle 0
+#define PEXRendering 1
+#define PEXPicking 2
+
+/* Flags (e.g., Switches, Visibility, and Edges) */
+#define PEXOff 0
+#define PEXOn 1
+
+/* Shape hints */
+/* Complex, Nonconvex, Convex, are defined as 0, 1, 2 in X.h */
+#define PEXComplex 0
+#define PEXNonconvex 1
+#define PEXConvex 2
+#define PEXUnknownShape 3
+
+/* Contour hints */
+#define PEXDisjoint 0
+#define PEXNested 1
+#define PEXIntersecting 2
+#define PEXUnknownContour 3
+
+/* Table Type */
+#define PEXLineBundleLUT 1
+#define PEXMarkerBundleLUT 2
+#define PEXTextBundleLUT 3
+#define PEXInteriorBundleLUT 4
+#define PEXEdgeBundleLUT 5
+#define PEXPatternLUT 6
+#define PEXTextFontLUT 7
+#define PEXColourLUT 8
+#define PEXViewLUT 9
+#define PEXLightLUT 10
+#define PEXDepthCueLUT 11
+#define PEXColourApproxLUT 12
+#define PEXMaxTableType 12
+
+/* LUT BitMask Values */
+/* Color Table Values */
+#define PEXLUTVColor (1L<<0)
+
+/* Color Approximation Table Values */
+#define PEXLUTVColorApproxMethod (1L<<0)
+#define PEXLUTVColorModel (2L<<0)
+#define PEXLUTVMax1 (3L<<0)
+#define PEXLUTVMax2 (4L<<0)
+#define PEXLUTVMax3 (5L<<0)
+#define PEXLUTVDither (6L<<0)
+#define PEXLUTVMult1 (7L<<0)
+#define PEXLUTVMult2 (8L<<0)
+#define PEXLUTVMult3 (9L<<0)
+#define PEXLUTVWeight1 (10L<<0)
+#define PEXLUTVWeight2 (11L<<0)
+#define PEXLUTVWeight3 (12L<<0)
+#define PEXLUTVBasePixel (13L<<0)
+
+/* Data Mapping Table Values */
+#define PEXLUTVDataMapMethod (1L<<0)
+#define PEXLUTVSourceSelectors (2L<<0)
+
+/* Depth Cue Table Values */
+#define PEXLUTVDepthCueMode (1L<<0)
+#define PEXLUTVFrontReferencePlane (2L<<0)
+#define PEXLUTVBackReferencePlane (3L<<0)
+#define PEXLUTVFrontScalePlane (4L<<0)
+#define PEXLUTVBackScalePlane (5L<<0)
+#define PEXLUTVDepthCueColor (6L<<0)
+
+/* Edge Bundle Table Values */
+#define PEXLUTVSurfaceEdgeFlag (1L<<0)
+#define PEXLUTVSurfaceEdgeType (2L<<0)
+#define PEXLUTVSurfaceEdgeWidth (3L<<0)
+#define PEXLUTVSurfaceEdgeColor (4L<<0)
+
+/* Extent Size Table Values */
+#define PEXLUTVExtentSize (1L<<0)
+
+/* Highlight Table Values */
+#define PEXLUTVHighlightMethod (1L<<0)
+#define PEXLUTVHighlightColor (2L<<0)
+
+/* Interior Bundle Table Values */
+#define PEXLUTVInteriorStyle (1L<<0)
+#define PEXLUTVInteriorStyleIndex (2L<<0)
+#define PEXLUTVInteriorReflectionModel (3L<<0)
+#define PEXLUTVInteriorInterpMethod (4L<<0)
+#define PEXLUTVBFInteriorStyle (5L<<0)
+#define PEXLUTVBFInteriorStyleIndex (6L<<0)
+#define PEXLUTVBFReflectionModel (7L<<0)
+#define PEXLUTVBFInterpMethod (8L<<0)
+#define PEXLUTVSurfaceApprox (9L<<0)
+#define PEXLUTVSurfaceColor (10L<<0)
+#define PEXLUTVReflectionAttrs (11L<<0)
+#define PEXLUTVBFSurfaceColor (12L<<0)
+#define PEXLUTVBFReflectionAttrs (13L<<0)
+#define PEXLUTVPSurfChar (14L<<0)
+
+/* Light Table Values */
+#define PEXLUTVLightType (1L<<0)
+#define PEXLUTVLightDirection (2L<<0)
+#define PEXLUTVLightPosition (3L<<0)
+#define PEXLUTVLightConcentration (4L<<0)
+#define PEXLUTVLightSpreadAngle (5L<<0)
+#define PEXLUTVLightConstantAttenFactor (6L<<0)
+#define PEXLUTVLightLinearAttenFactor (7L<<0)
+#define PEXLUTVLightColor (8L<<0)
+#define PEXLUTVLightConcClampRegion (9L<<0)
+#define PEXLUTVLightQuadraticAttenFactor (10L<<0)
+
+/* Line Table Values */
+#define PEXLUTVLineType (1L<<0)
+#define PEXLUTVLineInterpMethod (2L<<0)
+#define PEXLUTVLineCurveApprox (3L<<0)
+#define PEXLUTVLineWidth (4L<<0)
+#define PEXLUTVLineColor (5L<<0)
+#define PEXLUTVLineCapStyle (6L<<0)
+#define PEXLUTVLineJoinStyle (7L<<0)
+
+/* Marker Bundle Table Values */
+#define PEXLUTVMarkerType (1L<<0)
+#define PEXLUTVMarkerScaleFactor (2L<<0)
+#define PEXLUTVMarkerColor (3L<<0)
+
+/* Marker Glyph Table Values */
+#define PEXLUTVMarkerGlyph (1L<<0)
+
+/* Pattern Table Values */
+#define PEXLUTVPatternData (1L<<0)
+
+/* Text Bundle Table Values */
+#define PEXLUTVTextFontIndex (1L<<0)
+#define PEXLUTVTextPrecision (2L<<0)
+#define PEXLUTVTextCharExpansion (3L<<0)
+#define PEXLUTVTextCharSpacing (4L<<0)
+#define PEXLUTVTextColor (5L<<0)
+
+/* Text Font Table Values */
+#define PEXLUTVTextFontGroup (1L<<0)
+
+/* Texture Mapping Table Values */
+#define PEXLUTVTMTextureMapID (1L<<0)
+#define PEXLUTVTMRenderingControl (2L<<0)
+#define PEXLUTVTMParamMethod (3L<<0)
+#define PEXLUTVTMFPDataIndex (4L<<0)
+#define PEXLUTVTMReflectionMatrix (5L<<0)
+#define PEXLUTVTMOrientationMatrix (6L<<0)
+#define PEXLUTVTMCompositionMethod (7L<<0)
+#define PEXLUTVTMChannelNumber (8L<<0)
+#define PEXLUTVTMEnvironmentColor (9L<<0)
+#define PEXLUTVTMBackgroundColor (10L<<0)
+#define PEXLUTVTMSampleMinMag (11L<<0)
+#define PEXLUTVTMBoundaryConditions (12L<<0)
+#define PEXLUTVTMClampingMethod (13L<<0)
+#define PEXLUTVTMClampColor (14L<<0)
+#define PEXLUTVTMSamplingHints (15L<<0)
+
+/* View Table Values */
+#define PEXLUTVViewClipFlags (1L<<0)
+#define PEXLUTVViewClipLimits (1L<<0)
+#define PEXLUTVViewOrientationMatrix (1L<<0)
+#define PEXLUTVViewMappingMatrix (1L<<0)
+#define PEXLUTVViewEyepoint (1L<<0)
+
+
+/* Status in GetTableEntry */
+#define PEXDefaultEntry 0
+#define PEXDefinedEntry 1
+
+/* ValueType in GetTableEntr{y|ies} */
+#define PEXSetValue 0
+#define PEXRealizedValue 1
+
+/* Constants for Path and Vertical and Horizontal alignment */
+#define PEXPathRight 0
+#define PEXPathLeft 1
+#define PEXPathUp 2
+#define PEXPathDown 3
+#define PEXValignNormal 0
+#define PEXValignTop 1
+#define PEXValignCap 2
+#define PEXValignHalf 3
+#define PEXValignBase 4
+#define PEXValignBottom 5
+#define PEXHalignNormal 0
+#define PEXHalignLeft 1
+#define PEXHalignCenter 2
+#define PEXHalignRight 3
+
+/* Text precision */
+#define PEXStringPrecision 0
+#define PEXCharPrecision 1
+#define PEXStrokePrecision 2
+
+/* Character Set Widths */
+#define PEXCSByte 0
+#define PEXCSShort 1
+#define PEXCSLong 2
+
+/* Update State */
+#define PEXNotPending 0
+#define PEXPending 1
+
+/* Visual State */
+#define PEXCorrect 0
+#define PEXDeferred 1
+#define PEXSimulated 2
+
+/* Display State */
+#define PEXEmpty 0
+#define PEXNotEmpty 1
+
+/* Buffer Mode */
+#define PEXSingleBuffered 0
+#define PEXDoubleBuffered 1
+
+/* Dynamic types */
+#define PEXIMM 0
+#define PEXIRG 1
+#define PEXCBS 2
+
+/* Geometric attributes (Vertex, Facet) */
+#define PEXGAColour 0x0001
+#define PEXGANormal 0x0002
+#define PEXGAEdges 0x0004
+
+/* Pick Status */
+#define PEXNoPick 0
+#define PEXOk 1
+#define PEXAborted 2
+
+/* Pick Echo Switch */
+#define PEXNoEcho 0
+#define PEXEcho 1
+#define PEXUnEcho 2
+
+/* Pick Path Order */
+#define PEXTopFirst 0
+#define PEXBottomFirst 1
+
+/* Items for GetStructureInfo */
+#define PEXElementPtr 0x0001
+#define PEXNumElements 0x0002
+#define PEXLengthStructure 0x0004
+#define PEXHasRefs 0x0008
+#define PEXEditMode 0x0010
+
+/* Flags for GetStructuresInNetwork */
+#define PEXAll 0
+#define PEXOrphans 1
+
+/* Path part for GetAncestors */
+#define PEXTopPart 0
+#define PEXBottomPart 1
+
+/* Direction for ElementSearch */
+#define PEXForward 0
+#define PEXBackward 1
+
+/* Nameset changes */
+#define PEXNSAdd 0
+#define PEXNSRemove 1
+#define PEXNSReplace 2
+
+/* Priorities */
+#define PEXHigher 0
+#define PEXLower 1
+
+/* Enumerated Type Descriptors */
+
+/* Marker Type */
+#define PEXMarkerDot 1
+#define PEXMarkerCross 2
+#define PEXMarkerAsterisk 3
+#define PEXMarkerCircle 4
+#define PEXMarkerX 5
+/* ATextStyle */
+#define PEXATextNotConnected 1
+#define PEXATextConnected 2
+/* InteriorStyle */
+#define PEXInteriorStyleHollow 1
+#define PEXInteriorStyleSolid 2
+#define PEXInteriorStylePattern 3
+#define PEXInteriorStyleHatch 4
+#define PEXInteriorStyleEmpty 5
+/* HatchStyle */
+/* LineType */
+#define PEXLineTypeSolid 1
+#define PEXLineTypeDashed 2
+#define PEXLineTypeDotted 3
+#define PEXLineTypeDashDot 4
+/* SurfaceEdgeType */
+#define PEXSurfaceEdgeSolid 1
+#define PEXSurfaceEdgeDashed 2
+#define PEXSurfaceEdgeDotted 3
+#define PEXSurfaceEdgeDashDot 4
+/* PickDeviceType */
+#define PEXPickDeviceDC_HitBox 1
+#define PEXPickDeviceNPC_HitVolume 2
+/* PolylineInterpMethod */
+#define PEXPolylineInterpNone 1
+#define PEXPolylineInterpColour 2
+/* Curve(and Surface)(and Trim Curve)ApproxMethods */
+#define PEXApproxImpDep 1
+#define PEXApproxConstantBetweenKnots 2
+#define PEXApproxWcsChordalSize 3
+#define PEXApproxNpcChordalSize 4
+#define PEXApproxDcChordalSize 5
+#define PEXCurveApproxWcsChordalDev 6
+#define PEXCurveApproxNpcChordalDev 7
+#define PEXCurveApproxDcChordalDev 8
+#define PEXSurfaceApproxWcsPlanarDev 6
+#define PEXSurfaceApproxNpcPlanarDev 7
+#define PEXSurfaceApproxDcPlanarDev 8
+#define PEXApproxWcsRelative 9
+#define PEXApproxNpcRelative 10
+#define PEXApproxDcRelative 11
+/* ReflectionModel */
+#define PEXReflectionNoShading 1
+#define PEXReflectionAmbient 2
+#define PEXReflectionDiffuse 3
+#define PEXReflectionSpecular 4
+/* SurfaceInterpMethod */
+#define PEXSurfaceInterpNone 1
+#define PEXSurfaceInterpColour 2
+#define PEXSurfaceInterpDotProduct 3
+#define PEXSurfaceInterpNormal 4
+/* ModelClipOperator */
+#define PEXModelClipReplace 1
+#define PEXModelClipIntersection 2
+/* LightType */
+#define PEXLightAmbient 1
+#define PEXLightWcsVector 2
+#define PEXLightWcsPoint 3
+#define PEXLightWcsSpot 4
+/* ColourType */
+#define PEXIndexedColour 0
+#define PEXRgbFloatColour 1
+#define PEXCieFloatColour 2
+#define PEXHsvFloatColour 3
+#define PEXHlsFloatColour 4
+#define PEXRgb8Colour 5
+#define PEXRgb16Colour 6
+#define PEXMaxColour 6
+/* FloatFormat */
+#define PEXIeee_754_32 1
+#define PEXDEC_F_Floating 2
+#define PEXIeee_754_64 3
+#define PEXDEC_D_Floating 4
+/* HlhsrMode */
+#define PEXHlhsrOff 1
+#define PEXHlhsrZBuffer 2
+#define PEXHlhsrPainters 3
+#define PEXHlhsrScanline 4
+#define PEXHlhsrHiddenLineOnly 5
+#define PEXHlhsrZBufferId 6
+/* PromptEchoType */
+#define PEXEchoPrimitive 1
+#define PEXEchoStructure 2
+#define PEXEchoNetwork 3
+/* DisplayUpdateMethod */
+#define PEXVisualizeEach 1
+#define PEXVisualizeEasy 2
+#define PEXVisualizeNone 3
+#define PEXSimulateSome 4
+#define PEXVisualizeWhenever 5
+/* ColourApproxType */
+#define PEXColourSpace 1
+#define PEXColourRange 2
+/* ColourApproxMethod */
+#define PEXColourApproxRGB 1
+#define PEXColourApproxCIE 2
+#define PEXColourApproxHSV 3
+#define PEXColourApproxHLS 4
+#define PEXColourApproxYIQ 5
+/* Escape */
+#define PEXEscapeSetEchoColour 1
+/* RenderingColourModel */
+#define PEXRdrColourModelImpDep 0
+#define PEXRdrColourModelRGB 1
+#define PEXRdrColourModelCIE 2
+#define PEXRdrColourModelHSV 3
+#define PEXRdrColourModelHLS 4
+/* ParametricSurfaceCharacteristics */
+#define PEXPSCNone 1
+#define PEXPSCImpDep 2
+#define PEXPSCIsoCurves 3
+#define PEXPSCMcLevelCurves 4
+#define PEXPSCWcLevelCurves 5
+/* Isoparametric Curves */
+#define PEXICUniformPlacement 0
+#define PEXICNonuniformPlacement 1
+
+/* Clipping */
+#define PEXClipXY 0x0001
+#define PEXClipBack 0x0002
+#define PEXClipFront 0x0004
+
+#define PEXClip 0
+#define PEXNoClip 1
+
+/* Implementation Dependent Constant Names */
+#define PEXIDDitheringSupported 1
+#define PEXIDMaxEdgeWidth 2
+#define PEXIDMaxLineWidth 3
+#define PEXIDMaxMarkerSize 4
+#define PEXIDMaxModelClipPlanes 5
+#define PEXIDMaxNameSetNames 6
+#define PEXIDMaxNonAmbientLights 7
+#define PEXIDMaxNURBOrder 8
+#define PEXIDMaxTrimCurveOrder 9
+#define PEXIDMinEdgeWidth 10
+#define PEXIDMinLineWidth 11
+#define PEXIDMinMarkerSize 12
+#define PEXIDNominalEdgeWidth 13
+#define PEXIDNominalLineWidth 14
+#define PEXIDNominalMarkerSize 15
+#define PEXIDNumSupportedEdgeWidths 16
+#define PEXIDNumSupportedLineWidths 17
+#define PEXIDNumSupportedMarkerSizes 18
+#define PEXIDBestColourApproximation 19
+#define PEXIDTransparencySupported 20
+#define PEXIDDoubleBufferingSupported 21
+#define PEXIDChromaticityRedU 22
+#define PEXIDChromaticityRedV 23
+#define PEXIDLuminanceRed 24
+#define PEXIDChromaticityGreenU 25
+#define PEXIDChromaticityGreenV 26
+#define PEXIDLuminanceGreen 27
+#define PEXIDChromaticityBlueU 28
+#define PEXIDChromaticityBlueV 29
+#define PEXIDLuminanceBlue 30
+#define PEXIDChromaticityWhiteU 31
+#define PEXIDChromaticityWhiteV 32
+#define PEXIDLuminanceWhite 33
+/* have to stick this here since others are not in order */
+#define PEXIDMaxHitsEventSupported 34
+
+/* Constants for IDRgbBestApproximation */
+#define PEXColourApproxAnyValues 0
+#define PEXColourApproxPowersOf2 1
+
+/** To convert a bit index to a mask number and a mask value, assuming
+ ** 32 bit wide words. For example, a bitIndex of 5 will return
+ ** maskNum == 0 and maskValue == (1 << 5) = 32, while a bitIndex of 39
+ ** will return maskNum == 1 and maskValue == (1 << 7) == 128
+ **/
+#define PEX_BITNUM_TO_BITMASK(bitIndex, maskNum, maskValue) \
+ maskNum = (bitIndex) / 32; \
+ maskValue = ((unsigned)1L << ((bitIndex) % 32));
+
+#define CHECK_BITMASK_ARRAY(mask,bitIndex) \
+ if (mask[((bitIndex)/32)] & ((unsigned)1L << ((bitIndex) % 32)))
+
+#define PEX_BITMASK(i) ((unsigned)1 << ((i) & 31))
+#define PEX_MASKIDX(i) ((i) >> 5)
+#define PEX_MASKWORD(buf, i) buf[PEX_MASKIDX(i)]
+#define PEX_BITSET(buf, i) PEX_MASKWORD(buf, i) |= PEX_BITMASK(i)
+#define PEX_BITCLEAR(buf, i) PEX_MASKWORD(buf, i) &= ~PEX_BITMASK(i)
+#define PEX_GETBIT(buf, i) (PEX_MASKWORD(buf, i) & PEX_BITMASK(i))
+
+#define PEXMSGetWksInfo 2
+#define PEXMSPipeline 3
+
+/* Pipeline Context */
+#define PEXPCMarkerType 0
+#define PEXPCMarkerScale 1
+#define PEXPCMarkerColour 2
+#define PEXPCMarkerBundleIndex 3
+#define PEXPCTextFont 4
+#define PEXPCTextPrecision 5
+#define PEXPCCharExpansion 6
+#define PEXPCCharSpacing 7
+#define PEXPCTextColour 8
+#define PEXPCCharHeight 9
+#define PEXPCCharUpVector 10
+#define PEXPCTextPath 11
+#define PEXPCTextAlignment 12
+#define PEXPCAtextHeight 13
+#define PEXPCAtextUpVector 14
+#define PEXPCAtextPath 15
+#define PEXPCAtextAlignment 16
+#define PEXPCAtextStyle 17
+#define PEXPCTextBundleIndex 18
+#define PEXPCLineType 19
+#define PEXPCLineWidth 20
+#define PEXPCLineColour 21
+#define PEXPCCurveApproximation 22
+#define PEXPCPolylineInterp 23
+#define PEXPCLineBundleIndex 24
+#define PEXPCInteriorStyle 25
+#define PEXPCInteriorStyleIndex 26
+#define PEXPCSurfaceColour 27
+#define PEXPCSurfaceReflAttr 28
+#define PEXPCSurfaceReflModel 29
+#define PEXPCSurfaceInterp 30
+#define PEXPCBfInteriorStyle 31
+
+#define PEXPCBfInteriorStyleIndex 32
+#define PEXPCBfSurfaceColour 33
+#define PEXPCBfSurfaceReflAttr 34
+#define PEXPCBfSurfaceReflModel 35
+#define PEXPCBfSurfaceInterp 36
+#define PEXPCSurfaceApproximation 37
+#define PEXPCCullingMode 38
+#define PEXPCDistinguishFlag 39
+#define PEXPCPatternSize 40
+#define PEXPCPatternRefPt 41
+#define PEXPCPatternRefVec1 42
+#define PEXPCPatternRefVec2 43
+#define PEXPCInteriorBundleIndex 44
+#define PEXPCSurfaceEdgeFlag 45
+#define PEXPCSurfaceEdgeType 46
+#define PEXPCSurfaceEdgeWidth 47
+#define PEXPCSurfaceEdgeColour 48
+#define PEXPCEdgeBundleIndex 49
+#define PEXPCLocalTransform 50
+#define PEXPCGlobalTransform 51
+#define PEXPCModelClip 52
+#define PEXPCModelClipVolume 53
+#define PEXPCViewIndex 54
+#define PEXPCLightState 55
+#define PEXPCDepthCueIndex 56
+#define PEXPCSetAsfValues 57
+#define PEXPCPickId 58
+#define PEXPCHlhsrIdentifier 59
+#define PEXPCNameSet 60
+#define PEXPCColourApproxIndex 61
+#define PEXPCRenderingColourModel 62
+#define PEXPCParaSurfCharacteristics 63
+#define PEXMaxPCIndex 63
+
+/* Renderer Bitmasks */
+#define PEXRDPipelineContext (1L<<0)
+#define PEXRDCurrentPath (1L<<1)
+#define PEXRDMarkerBundle (1L<<2)
+#define PEXRDTextBundle (1L<<3)
+#define PEXRDLineBundle (1L<<4)
+#define PEXRDInteriorBundle (1L<<5)
+#define PEXRDEdgeBundle (1L<<6)
+#define PEXRDViewTable (1L<<7)
+#define PEXRDColourTable (1L<<8)
+#define PEXRDDepthCueTable (1L<<9)
+#define PEXRDLightTable (1L<<10)
+#define PEXRDColourApproxTable (1L<<11)
+#define PEXRDPatternTable (1L<<12)
+#define PEXRDTextFontTable (1L<<13)
+#define PEXRDHighlightIncl (1L<<14)
+#define PEXRDHighlightExcl (1L<<15)
+#define PEXRDInvisibilityIncl (1L<<16)
+#define PEXRDInvisibilityExcl (1L<<17)
+#define PEXRDRendererState (1L<<18)
+#define PEXRDHlhsrMode (1L<<19)
+#define PEXRDNpcSubvolume (1L<<20)
+#define PEXRDViewport (1L<<21)
+#define PEXRDClipList (1L<<22)
+#define PEXRDPickInclusion (1L<<23)
+#define PEXRDPickExclusion (1L<<24)
+#define PEXRDPickStartPath (1L<<25)
+#define PEXRDBackgroundColour (1L<<26)
+#define PEXRDClearI (1L<<27)
+#define PEXRDClearZ (1L<<28)
+#define PEXRDEchoMode (1L<<29)
+#define PEXMaxRDShift 29
+
+/* Renderer Dynamics Bitmasks */
+/* tables */
+#define PEXDynMarkerBundle (1L<<0)
+#define PEXDynTextBundle (1L<<1)
+#define PEXDynLineBundle (1L<<2)
+#define PEXDynInteriorBundle (1L<<3)
+#define PEXDynEdgeBundle (1L<<4)
+#define PEXDynViewTable (1L<<5)
+#define PEXDynColourTable (1L<<6)
+#define PEXDynDepthCueTable (1L<<7)
+#define PEXDynLightTable (1L<<8)
+#define PEXDynColourApproxTable (1L<<9)
+#define PEXDynPatternTable (1L<<10)
+#define PEXDynTextFontTable (1L<<11)
+#define PEXDynMarkerBundleContents (1L<<16)
+#define PEXDynTextBundleContents (1L<<17)
+#define PEXDynLineBundleContents (1L<<18)
+#define PEXDynInteriorBundleContents (1L<<19)
+#define PEXDynEdgeBundleContents (1L<<20)
+#define PEXDynViewTableContents (1L<<21)
+#define PEXDynColourTableContents (1L<<22)
+#define PEXDynDepthCueTableContents (1L<<23)
+#define PEXDynLightTableContents (1L<<24)
+#define PEXDynColourApproxContents (1L<<25)
+#define PEXDynPatternTableContents (1L<<26)
+#define PEXDynTextFontTableContents (1L<<27)
+/* namesets */
+#define PEXDynHighlightNameset (1L<<0)
+#define PEXDynInvisibilityNameset (1L<<1)
+#define PEXDynPickNameset (1L<<2)
+#define PEXDynHighlightNamesetContents (1L<<16)
+#define PEXDynInvisibilityNamesetContents (1L<<17)
+#define PEXDynPickNamesetContents (1L<<18)
+/* attributes */
+#define PEXDynHlhsrMode (1L<<0)
+#define PEXDynNpcSubvolume (1L<<1)
+#define PEXDynViewport (1L<<2)
+#define PEXDynClipList (1L<<3)
+#define PEXDynEchoMode (1L<<4)
+
+#define PEXElementType (1L<<0)
+#define PEXElementSize (1L<<1)
+#define PEXElementData (1L<<2)
+
+/* Search Context Bitmasks */
+#define PEXSCPosition (1L<<0)
+#define PEXSCDistance (1L<<1)
+#define PEXSCCeiling (1L<<2)
+#define PEXSCModelClipFlag (1L<<3)
+#define PEXSCStartPath (1L<<4)
+#define PEXSCNormalList (1L<<5)
+#define PEXSCInvertedList (1L<<6)
+
+/* Phigs Workstation Attribute Bitmasks */
+#define PEXPWDisplayUpdate 0
+#define PEXPWVisualState 1
+#define PEXPWDisplaySurface 2
+#define PEXPWViewUpdate 3
+#define PEXPWDefinedViews 4
+#define PEXPWWksUpdate 5
+#define PEXPWReqNpcSubvolume 6
+#define PEXPWCurNpcSubvolume 7
+#define PEXPWReqWksViewport 8
+#define PEXPWCurWksViewport 9
+#define PEXPWHlhsrUpdate 10
+#define PEXPWReqHlhsrMode 11
+#define PEXPWCurHlhsrMode 12
+#define PEXPWDrawable 13
+#define PEXPWMarkerBundle 14
+#define PEXPWTextBundle 15
+#define PEXPWLineBundle 16
+#define PEXPWInteriorBundle 17
+#define PEXPWEdgeBundle 18
+#define PEXPWColourTable 19
+#define PEXPWDepthCueTable 20
+#define PEXPWLightTable 21
+#define PEXPWColourApproxTable 22
+#define PEXPWPatternTable 23
+#define PEXPWTextFontTable 24
+#define PEXPWHighlightIncl 25
+#define PEXPWHighlightExcl 26
+#define PEXPWInvisibilityIncl 27
+#define PEXPWInvisibilityExcl 28
+#define PEXPWPostedStructures 29
+#define PEXPWNumPriorities 30
+#define PEXPWBufferUpdate 31
+
+#define PEXPWReqBufferMode 32
+#define PEXPWCurBufferMode 33
+
+#define PEXMaxPWIndex 33
+
+/* Indices for GetDynamics */
+#define PEXPWDViewRep 0
+#define PEXPWDMarkerBundle 1
+#define PEXPWDTextBundle 2
+#define PEXPWDLineBundle 3
+#define PEXPWDInteriorBundle 4
+#define PEXPWDEdgeBundle 5
+#define PEXPWDColourTable 6
+#define PEXPWDPatternTable 7
+#define PEXPWDWksTransform 8
+#define PEXPWDHighlightFilter 9
+#define PEXPWDInvisibilityFilter 10
+#define PEXPWDHlhsrMode 11
+#define PEXPWDStructureModify 12
+#define PEXPWDPostStructure 13
+#define PEXPWDUnpostStructure 14
+#define PEXPWDDeleteStructure 15
+#define PEXPWDReferenceModify 16
+#define PEXPWDBufferModify 17
+#define PEXPWDLightTable 18
+#define PEXPWDDepthCueTable 19
+#define PEXPWDColourApproxTable 20
+
+/* Pick Device Bitmasks */
+#define PEXPDPickStatus (1L<<0)
+#define PEXPDPickPath (1L<<1)
+#define PEXPDPickPathOrder (1L<<2)
+#define PEXPDPickIncl (1L<<3)
+#define PEXPDPickExcl (1L<<4)
+#define PEXPDPickDataRec (1L<<5)
+#define PEXPDPickPromptEchoType (1L<<6)
+#define PEXPDPickEchoVolume (1L<<7)
+#define PEXPDPickEchoSwitch (1L<<8)
+
+/* Pick Measure Bitmasks */
+#define PEXPMStatus (1L<<0)
+#define PEXPMPath (1L<<1)
+
+/* Errors */
+#define PEXColourTypeError 0
+#define PEXRendererStateError 1
+#define PEXFloatingPointFormatError 2
+#define PEXLabelError 3
+#define PEXLookupTableError 4
+#define PEXNameSetError 5
+#define PEXPathError 6
+#define PEXFontError 7
+#define PEXPhigsWksError 8
+#define PEXPickMeasureError 9
+#define PEXPipelineContextError 10
+#define PEXRendererError 11
+#define PEXSearchContextError 12
+#define PEXStructureError 13
+#define PEXOutputCommandError 14
+#define PEXMaxError 14
+
+/* Requests */
+#define PEX_GetExtensionInfo 1
+#define PEX_GetEnumeratedTypeInfo 2
+#define PEX_GetImpDepConstants 3
+#define PEX_CreateLookupTable 4
+#define PEX_CopyLookupTable 5
+#define PEX_FreeLookupTable 6
+#define PEX_GetTableInfo 7
+#define PEX_GetPredefinedEntries 8
+#define PEX_GetDefinedIndices 9
+#define PEX_GetTableEntry 10
+#define PEX_GetTableEntries 11
+#define PEX_SetTableEntries 12
+#define PEX_DeleteTableEntries 13
+#define PEX_CreatePipelineContext 14
+#define PEX_CopyPipelineContext 15
+#define PEX_FreePipelineContext 16
+#define PEX_GetPipelineContext 17
+#define PEX_ChangePipelineContext 18
+#define PEX_CreateRenderer 19
+#define PEX_FreeRenderer 20
+#define PEX_ChangeRenderer 21
+#define PEX_GetRendererAttributes 22
+#define PEX_GetRendererDynamics 23
+#define PEX_BeginRendering 24
+#define PEX_EndRendering 25
+#define PEX_BeginStructure 26
+#define PEX_EndStructure 27
+#define PEX_RenderOutputCommands 28
+#define PEX_RenderNetwork 29
+#define PEX_CreateStructure 30
+#define PEX_CopyStructure 31
+#define PEX_DestroyStructures 32
+#define PEX_GetStructureInfo 33
+#define PEX_GetElementInfo 34
+#define PEX_GetStructuresInNetwork 35
+#define PEX_GetAncestors 36
+#define PEX_GetDescendants 37
+#define PEX_FetchElements 38
+#define PEX_SetEditingMode 39
+#define PEX_SetElementPointer 40
+#define PEX_SetElementPointerAtLabel 41
+#define PEX_ElementSearch 42
+#define PEX_StoreElements 43
+#define PEX_DeleteElements 44
+#define PEX_DeleteElementsToLabel 45
+#define PEX_DeleteBetweenLabels 46
+#define PEX_CopyElements 47
+#define PEX_ChangeStructureRefs 48
+#define PEX_CreateNameSet 49
+#define PEX_CopyNameSet 50
+#define PEX_FreeNameSet 51
+#define PEX_GetNameSet 52
+#define PEX_ChangeNameSet 53
+#define PEX_CreateSearchContext 54
+#define PEX_CopySearchContext 55
+#define PEX_FreeSearchContext 56
+#define PEX_GetSearchContext 57
+#define PEX_ChangeSearchContext 58
+#define PEX_SearchNetwork 59
+#define PEX_CreatePhigsWks 60
+#define PEX_FreePhigsWks 61
+#define PEX_GetWksInfo 62
+#define PEX_GetDynamics 63
+#define PEX_GetViewRep 64
+#define PEX_RedrawAllStructures 65
+#define PEX_UpdateWorkstation 66
+#define PEX_RedrawClipRegion 67
+#define PEX_ExecuteDeferredActions 68
+#define PEX_SetViewPriority 69
+#define PEX_SetDisplayUpdateMode 70
+#define PEX_MapDCtoWC 71
+#define PEX_MapWCtoDC 72
+#define PEX_SetViewRep 73
+#define PEX_SetWksWindow 74
+#define PEX_SetWksViewport 75
+#define PEX_SetHlhsrMode 76
+#define PEX_SetWksBufferMode 77
+#define PEX_PostStructure 78
+#define PEX_UnpostStructure 79
+#define PEX_UnpostAllStructures 80
+#define PEX_GetWksPostings 81
+#define PEX_GetPickDevice 82
+#define PEX_ChangePickDevice 83
+#define PEX_CreatePickMeasure 84
+#define PEX_FreePickMeasure 85
+#define PEX_GetPickMeasure 86
+#define PEX_UpdatePickMeasure 87
+#define PEX_OpenFont 88
+#define PEX_CloseFont 89
+#define PEX_QueryFont 90
+#define PEX_ListFonts 91
+#define PEX_ListFontsWithInfo 92
+#define PEX_QueryTextExtents 93
+#define PEX_MatchRendererTargets 94
+#define PEX_Escape 95
+#define PEX_EscapeWithReply 96
+#define PEX_RenderElements 97
+#define PEX_AccumulateState 98
+#define PEX_BeginPickOne 99
+#define PEX_EndPickOne 100
+#define PEX_PickOne 101
+#define PEX_BeginPickAll 102
+#define PEX_EndPickAll 103
+#define PEX_PickAll 104
+#define PEXMaxRequest 104
+
+/* Output Commands */
+#define PEXOCAll 0
+#define PEXOCMarkerType 1
+#define PEXOCMarkerScale 2
+#define PEXOCMarkerColourIndex 3
+#define PEXOCMarkerColour 4
+#define PEXOCMarkerBundleIndex 5
+#define PEXOCTextFontIndex 6
+#define PEXOCTextPrecision 7
+#define PEXOCCharExpansion 8
+#define PEXOCCharSpacing 9
+#define PEXOCTextColourIndex 10
+#define PEXOCTextColour 11
+#define PEXOCCharHeight 12
+#define PEXOCCharUpVector 13
+#define PEXOCTextPath 14
+#define PEXOCTextAlignment 15
+#define PEXOCAtextHeight 16
+#define PEXOCAtextUpVector 17
+#define PEXOCAtextPath 18
+#define PEXOCAtextAlignment 19
+#define PEXOCAtextStyle 20
+#define PEXOCTextBundleIndex 21
+#define PEXOCLineType 22
+#define PEXOCLineWidth 23
+#define PEXOCLineColourIndex 24
+#define PEXOCLineColour 25
+#define PEXOCCurveApproximation 26
+#define PEXOCPolylineInterp 27
+#define PEXOCLineBundleIndex 28
+#define PEXOCInteriorStyle 29
+#define PEXOCInteriorStyleIndex 30
+#define PEXOCSurfaceColourIndex 31
+#define PEXOCSurfaceColour 32
+#define PEXOCSurfaceReflAttr 33
+#define PEXOCSurfaceReflModel 34
+#define PEXOCSurfaceInterp 35
+#define PEXOCBfInteriorStyle 36
+#define PEXOCBfInteriorStyleIndex 37
+#define PEXOCBfSurfaceColourIndex 38
+#define PEXOCBfSurfaceColour 39
+#define PEXOCBfSurfaceReflAttr 40
+#define PEXOCBfSurfaceReflModel 41
+#define PEXOCBfSurfaceInterp 42
+#define PEXOCSurfaceApproximation 43
+#define PEXOCCullingMode 44
+#define PEXOCDistinguishFlag 45
+#define PEXOCPatternSize 46
+#define PEXOCPatternRefPt 47
+#define PEXOCPatternAttr 48
+#define PEXOCInteriorBundleIndex 49
+#define PEXOCSurfaceEdgeFlag 50
+#define PEXOCSurfaceEdgeType 51
+#define PEXOCSurfaceEdgeWidth 52
+#define PEXOCSurfaceEdgeColourIndex 53
+#define PEXOCSurfaceEdgeColour 54
+#define PEXOCEdgeBundleIndex 55
+#define PEXOCSetAsfValues 56
+#define PEXOCLocalTransform 57
+#define PEXOCLocalTransform2D 58
+#define PEXOCGlobalTransform 59
+#define PEXOCGlobalTransform2D 60
+#define PEXOCModelClip 61
+#define PEXOCModelClipVolume 62
+#define PEXOCModelClipVolume2D 63
+#define PEXOCRestoreModelClip 64
+#define PEXOCViewIndex 65
+#define PEXOCLightState 66
+#define PEXOCDepthCueIndex 67
+#define PEXOCPickId 68
+#define PEXOCHlhsrIdentifier 69
+#define PEXOCColourApproxIndex 70
+#define PEXOCRenderingColourModel 71
+#define PEXOCParaSurfCharacteristics 72
+#define PEXOCAddToNameSet 73
+#define PEXOCRemoveFromNameSet 74
+#define PEXOCExecuteStructure 75
+#define PEXOCLabel 76
+#define PEXOCApplicationData 77
+#define PEXOCGse 78
+#define PEXOCMarker 79
+#define PEXOCMarker2D 80
+#define PEXOCText 81
+#define PEXOCText2D 82
+#define PEXOCAnnotationText 83
+#define PEXOCAnnotationText2D 84
+#define PEXOCPolyline 85
+#define PEXOCPolyline2D 86
+#define PEXOCPolylineSet 87
+#define PEXOCNurbCurve 88
+#define PEXOCFillArea 89
+#define PEXOCFillArea2D 90
+#define PEXOCExtFillArea 91
+#define PEXOCFillAreaSet 92
+#define PEXOCFillAreaSet2D 93
+#define PEXOCExtFillAreaSet 94
+#define PEXOCTriangleStrip 95
+#define PEXOCQuadrilateralMesh 96
+#define PEXOCSOFAS 97
+#define PEXOCNurbSurface 98
+#define PEXOCCellArray 99
+#define PEXOCCellArray2D 100
+#define PEXOCExtCellArray 101
+#define PEXOCGdp 102
+#define PEXOCGdp2D 103
+#define PEXOCNoop 104
+#define PEXMaxOC 104
+
+#define PEXOCNil 0xffff
+
+#endif /* PEX.h */
+
diff --git a/xc/programs/Xserver/PEX5/include/PEXErr.h b/xc/programs/Xserver/PEX5/include/PEXErr.h
new file mode 100644
index 000000000..185ff36d1
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEXErr.h
@@ -0,0 +1,63 @@
+/* $TOG: PEXErr.h /main/3 1998/02/10 12:33:26 kaleb $ */
+
+/***********************************************************
+
+Copyright 1988,1989,1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1988,1989,1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#ifndef PEXERRS_H
+#define PEXERRS_H
+
+typedef int ErrorCode;
+
+#define PEXNOERR 0
+
+#ifndef Success
+#define Success PEXNOERR
+#endif /* Success */
+
+#ifndef PEXNYI
+#define PEXNYI BadImplementation
+#endif /* PEXNYI */
+
+#endif /* PEXERRS_H */
+
diff --git a/xc/programs/Xserver/PEX5/include/PEXfuncs.h b/xc/programs/Xserver/PEX5/include/PEXfuncs.h
new file mode 100644
index 000000000..1e1663c27
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEXfuncs.h
@@ -0,0 +1,141 @@
+/* $TOG: PEXfuncs.h /main/3 1998/02/10 12:33:31 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#ifndef PEX_FUNCS_H
+#define PEX_FUNCS_H
+
+/* PEX Function Declarations, in alphabetic order. */
+
+extern int PEXBeginRendering(); /* in file pex/pex_rend.c */
+extern int PEXBeginStructure(); /* in file pex/pex_rend.c */
+extern int PEXChangeNameSet(); /* in file pex/pex_ns.c */
+extern int PEXChangePickDevice(); /* in file pex/pex_pick.c */
+extern int PEXChangePipelineContext(); /* in file pex/pex_pipe.c */
+extern int PEXChangeRenderer(); /* in file pex/pex_rend.c */
+extern int PEXChangeSearchContext(); /* in file pex/pex_srch.c */
+extern int PEXChangeStructureRefs(); /* in file pex/pex_stru.c */
+extern int PEXCloseFont(); /* in file pex/pex_font.c */
+extern int PEXCopyElements(); /* in file pex/pex_stru.c */
+extern int PEXCopyLookupTable(); /* in file pex/pex_lut.c */
+extern int PEXCopyNameSet(); /* in file pex/pex_ns.c */
+extern int PEXCopyPipelineContext(); /* in file pex/pex_pipe.c */
+extern int PEXCopySearchContext(); /* in file pex/pex_srch.c */
+extern int PEXCopyStructure(); /* in file pex/pex_stru.c */
+extern int PEXCreateLookupTable(); /* in file pex/pex_lut.c */
+extern int PEXCreateNameSet(); /* in file pex/pex_ns.c */
+extern int PEXCreatePhigsWks(); /* in file pex/pex_ws.c */
+extern int PEXCreatePickMeasure(); /* in file pex/pex_pick.c */
+extern int PEXCreatePipelineContext(); /* in file pex/pex_pipe.c */
+extern int PEXCreateRenderer(); /* in file pex/pex_rend.c */
+extern int PEXCreateSearchContext(); /* in file pex/pex_srch.c */
+extern int PEXCreateStructure(); /* in file pex/pex_stru.c */
+extern int PEXDeleteBetweenLabels(); /* in file pex/pex_stru.c */
+extern int PEXDeleteElements(); /* in file pex/pex_stru.c */
+extern int PEXDeleteElementsToLabel(); /* in file pex/pex_stru.c */
+extern int PEXDeleteTableEntries(); /* in file pex/pex_lut.c */
+extern int PEXDestroyLookupTable(); /* in file pex/pex_lut.c */
+extern int PEXDestroyNameSet(); /* in file pex/pex_ns.c */
+extern int PEXDestroyPhigsWks(); /* in file pex/pex_ws.c */
+extern int PEXDestroyPickMeasure(); /* in file pex/pex_pick.c */
+extern int PEXDestroyPipelineContext(); /* in file pex/pex_pipe.c */
+extern int PEXDestroyRenderer(); /* in file pex/pex_rend.c */
+extern int PEXDestroySearchContext(); /* in file pex/pex_srch.c */
+extern int PEXDestroyStructures(); /* in file pex/pex_stru.c */
+extern int PEXElementSearch(); /* in file pex/pex_stru.c */
+extern int PEXEndRendering(); /* in file pex/pex_rend.c */
+extern int PEXEndStructure(); /* in file pex/pex_rend.c */
+extern int PEXExecuteDeferredActions(); /* in file pex/pex_ws.c */
+extern int PEXFetchElements(); /* in file pex/pex_stru.c */
+extern int PEXGetAncestors(); /* in file pex/pex_stru.c */
+extern int PEXGetDefinedIndices(); /* in file pex/pex_lut.c */
+extern int PEXGetDescendants(); /* in file pex/pex_stru.c */
+extern int PEXGetDynamics(); /* in file pex/pex_ws.c */
+extern int PEXGetElementInfo(); /* in file pex/pex_stru.c */
+extern int PEXGetEnumeratedTypeInfo(); /* in file pex/pex_info.c */
+extern int PEXGetExtensionInfo(); /* in file pex/pex_info.c */
+extern int PEXGetImpDepConstants(); /* in file pex/pex_info.c */
+extern int PEXGetNameSet(); /* in file pex/pex_ns.c */
+extern int PEXGetPickDevice(); /* in file pex/pex_pick.c */
+extern int PEXGetPickMeasure(); /* in file pex/pex_pick.c */
+extern int PEXGetPipelineContext(); /* in file pex/pex_pipe.c */
+extern int PEXGetPredefinedEntries(); /* in file pex/pex_lut.c */
+extern int PEXGetRendererAttributes(); /* in file pex/pex_rend.c */
+extern int PEXGetRendererDynamics(); /* in file pex/pex_rend.c */
+extern int PEXGetSearchContext(); /* in file pex/pex_srch.c */
+extern int PEXGetStructureInfo(); /* in file pex/pex_stru.c */
+extern int PEXGetStructuresInNetwork(); /* in file pex/pex_stru.c */
+extern int PEXGetTableEntries(); /* in file pex/pex_lut.c */
+extern int PEXGetTableEntry(); /* in file pex/pex_lut.c */
+extern int PEXGetTableInfo(); /* in file pex/pex_lut.c */
+extern int PEXGetViewRep(); /* in file pex/pex_ws.c */
+extern int PEXGetWksInfo(); /* in file pex/pex_ws.c */
+extern int PEXGetWksPostings(); /* in file pex/pex_ws.c */
+extern int PEXListFonts(); /* in file pex/pex_font.c */
+extern int PEXListFontsWithInfo(); /* in file pex/pex_font.c */
+extern int PEXMapDCtoWC(); /* in file pex/pex_ws.c */
+extern int PEXMapWCtoDC(); /* in file pex/pex_ws.c */
+extern int PEXOpenFont(); /* in file pex/pex_font.c */
+extern int PEXPostStructure(); /* in file pex/pex_ws.c */
+extern int PEXQueryFont(); /* in file pex/pex_font.c */
+extern int PEXQueryTextExtents(); /* in file pex/pex_font.c */
+extern int PEXRedrawAllStructures(); /* in file pex/pex_ws.c */
+extern int PEXRenderNetwork(); /* in file pex/pex_rend.c */
+extern int PEXRenderOutputCommands(); /* in file pex/pex_rend.c */
+extern int PEXSearchNetwork(); /* in file pex/pex_srch.c */
+extern int PEXSetDisplayUpdateMode(); /* in file pex/pex_ws.c */
+extern int PEXSetEditingMode(); /* in file pex/pex_stru.c */
+extern int PEXSetElementPointer(); /* in file pex/pex_stru.c */
+extern int PEXSetElementPointerAtLabel(); /* in file pex/pex_stru.c */
+extern int PEXSetHlhsrMode(); /* in file pex/pex_ws.c */
+extern int PEXSetTableEntries(); /* in file pex/pex_lut.c */
+extern int PEXSetViewPriority(); /* in file pex/pex_ws.c */
+extern int PEXSetViewRep(); /* in file pex/pex_ws.c */
+extern int PEXSetWksViewport(); /* in file pex/pex_ws.c */
+extern int PEXSetWksWindow(); /* in file pex/pex_ws.c */
+extern int PEXStoreElements(); /* in file pex/pex_stru.c */
+extern int PEXUnpostAllStructures(); /* in file pex/pex_ws.c */
+extern int PEXUnpostStructure(); /* in file pex/pex_ws.c */
+extern int PEXUpdatePickMeasure(); /* in file pex/pex_pick.c */
+extern int PEXUpdateWorkstation(); /* in file pex/pex_ws.c */
+
+#endif /* PEX_FUNCS_H */
diff --git a/xc/programs/Xserver/PEX5/include/PEXmacs.h b/xc/programs/Xserver/PEX5/include/PEXmacs.h
new file mode 100644
index 000000000..07ddab144
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEXmacs.h
@@ -0,0 +1,51 @@
+/* $TOG: PEXmacs.h /main/3 1998/02/10 12:33:35 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#ifndef PEX_MACS_H
+#define PEX_MACS_H
+
+/* Useful macros. */
+#define PEX_SUPPORTS_WS(si) \
+ ( !(si) || (si) & 0x2 )
+
+#endif /* PEX_MACS_H */
diff --git a/xc/programs/Xserver/PEX5/include/PEXproto.h b/xc/programs/Xserver/PEX5/include/PEXproto.h
new file mode 100644
index 000000000..99ee9760d
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEXproto.h
@@ -0,0 +1,2329 @@
+/* $TOG: PEXproto.h /main/9 1998/02/10 12:33:40 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* Definitions for the PEX used by server and c bindings */
+
+/*
+ * This packet-construction scheme makes the following assumptions:
+ *
+ * 1. The compiler is able to generate code which addresses one- and two-byte
+ * quantities. In the worst case, this would be done with bit-fields. If
+ * bit-fields are used it may be necessary to reorder the request fields in
+ * this file, depending on the order in which the machine assigns bit fields
+ * to machine words. There may also be a problem with sign extension, as K+R
+ * specify that bitfields are always unsigned.
+ *
+ * 2. 2- and 4-byte fields in packet structures must be ordered by hand such
+ * that they are naturally-aligned, so that no compiler will ever insert
+ * padding bytes.
+ *
+ * 3. All packets are hand-padded to a multiple of 4 bytes, for the same reason.
+ */
+
+#ifndef PEXPROTO_H
+#define PEXPROTO_H
+
+/* In the following typedefs, comments appear that say "LISTof Foo( numItems )",
+ * "CLIST of Foo()", and "SINGLE Foo()". These are used when the protocol
+ * specifies that a request or reply contains a variable length list of
+ * (possibly variable types of) objects.
+ *
+ * A LISTof list is one for which we have already been given the length.
+ * The items in the list are of type "Foo". The number of items in the list
+ * appears parenthetically after the type. ("numItems" in our example.)
+ * Any other information needed to parse the list is also passed in the
+ * parentheses. (E.g., "tableType" in a list of table entries.)
+ *
+ * A CLISTof list is the same, except that the first 4 bytes of the list
+ * indicate the number of items in the list. The length may need to be
+ * byte-swapped.
+ *
+ * A SINGLE item of an indeterminate length is indicated in the same
+ * manner. (E.g., a "SINGLE TableEntry()".) Any other information
+ * needed to parse the item is also passed in the parentheses.
+ * (E.g., "itemMask" in a set of pipeline context attributes.)
+ *
+ * If no information is given in the parentheses, then the size is
+ * implicit.
+ *
+ * Variable length padding is noted with a comment, with the number
+ * of bytes of padding required as calculated from the value in
+ * the parentheses. (number of bytes of padding = n?(3-((n-1)%4):0 , where
+ * n is the parenthetical value.)
+ */
+#include "PEXprotost.h"
+
+/* Matches revision 5.1C */
+
+/****************************************************************
+ * REPLIES *
+ ****************************************************************/
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+ CARD32 release B32;
+ CARD32 lengthName B32;
+ CARD32 subsetInfo B32;
+ BYTE pad[8];
+ /* LISTof CARD8 follows -- Don't swap */
+ /* pad */
+ } pexGetExtensionInfoReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* NOT 0; this is an extra-large reply*/
+ CARD32 numLists B32;
+ BYTE pad[20]; /* lists of lists begin afterwards */
+ /* LISTof CLISTof pexEnumTypeDesc( numLists ) */
+ /* pad */
+ } pexGetEnumeratedTypeInfoReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* LISTof VALUE() */
+ } pexGetImpDepConstantsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 escapeID B32;
+ CARD8 escape_specific[20];
+ /* more escape specific data, treat as */
+ /* LISTof CARD8( length ) */
+ } pexEscapeWithReplyReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BYTE pad[24];
+ /* LISTof RENDERER_TARGET( ) */
+ } pexMatchRendererTargetsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD16 unused B16;
+ CARD16 definableEntries B16;
+ CARD16 numPredefined B16;
+ CARD16 predefinedMin B16;
+ CARD16 predefinedMax B16;
+ BYTE pad[14];
+ } pexGetTableInfoReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 unused B32;
+ CARD32 numEntries B32;
+ BYTE pad[16];
+ /* LISTof TableEntry( numEntries, tableType ) */
+ } pexGetPredefinedEntriesReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numIndices B32;
+ BYTE pad[20];
+ /* LISTof pexTableIndex( numIndices ) */
+ /* pad( numIndices ) */
+ } pexGetDefinedIndicesReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD16 status B16;
+ CARD16 tableType B16;
+ BYTE pad[20];
+ /* SINGLE TableEntry( tableType ) */
+ } pexGetTableEntryReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD16 tableType B16;
+ CARD16 unused B16;
+ CARD32 numEntries B32;
+ BYTE pad[16];
+ /* LISTof TableEntry( numEntries, tableType ) */
+ } pexGetTableEntriesReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD16 status B16;
+ CARD16 tableType B16;
+ CARD32 numValues B32;
+ BYTE pad[16];
+ /* LISTof TableValues( numValues, tableType ) */
+ } pexGetTableValuesReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE PipelineContextAttributes( itemMask ) */
+ } pexGetPipelineContextReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE RendererAttributes( itemMask ) */
+ } pexGetRendererAttributesReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numValues B16;
+ pexSwitch undefinedValues;
+ BYTE pad[19];
+ /* Z buffer values go here */
+} pexGetZBufferReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ INT32 count B16;
+ BYTE pad[20];
+} pexNextPassReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ pexBitmask tables B32;
+ pexBitmask namesets B32;
+ pexBitmask attributes B32;
+ BYTE pad[12];
+} pexGetRendererDynamicsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD16 editMode B16;
+ CARD16 unused B16;
+ CARD32 elementPtr B32;
+ CARD32 numElements B32;
+ CARD32 lengthStructure B32;
+ CARD16 hasRefs B16;
+ BYTE pad[6];
+ } pexGetStructureInfoReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numInfo B32;
+ BYTE pad[20];
+ /* LISTof pexElementInfo( numInfo ) */
+ } pexGetElementInfoReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD8 unused[8];
+ CARD32 numStructures B32;
+ BYTE pad[12];
+ /* LISTof pexStructure( numStructures ) */
+ } pexGetStructuresInNetworkReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD8 unused[12];
+ CARD32 numPaths B32;
+ BYTE pad[8];
+ /* LISTof CLISTof pexElementRef( numPaths ) */
+ } pexGetAncestorsReply;
+
+typedef pexGetAncestorsReply pexGetDescendantsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numElements B32;
+ BYTE pad[20];
+ /* LISTof OutputCommand( numElements ) */
+ } pexFetchElementsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD16 status B16;
+ CARD16 unused B16;
+ CARD32 foundOffset B32;
+ BYTE pad[16];
+ } pexElementSearchReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numNames B32;
+ BYTE pad[20];
+ /* LISTof pexName( numNames ) */
+ } pexGetNameSetReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE SearchContextAttributes( itemMask ) */
+ } pexGetSearchContextReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 unused B32;
+ CARD32 numItems B32;
+ BYTE pad[16];
+ /* LISTof pexElementRef( numItems ) */
+ } pexSearchNetworkReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE WksInfo( itemMask ) */
+ } pexGetWksInfoReply;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ pexDynamicType viewRep;
+ pexDynamicType markerBundle;
+ pexDynamicType textBundle;
+ pexDynamicType lineBundle;
+ pexDynamicType interiorBundle;
+ pexDynamicType edgeBundle;
+ pexDynamicType colourTable;
+ pexDynamicType patternTable;
+ pexDynamicType wksTransform;
+ pexDynamicType highlightFilter;
+ pexDynamicType invisibilityFilter;
+ pexDynamicType HlhsrMode;
+ pexDynamicType structureModify;
+ pexDynamicType postStructure;
+ pexDynamicType unpostStructure;
+ pexDynamicType deleteStructure;
+ pexDynamicType referenceModify;
+ pexDynamicType bufferModify;
+ pexDynamicType lightTable;
+ pexDynamicType depthCueTable;
+ pexDynamicType colourApproxTable;
+ CARD8 pad[3];
+ } pexGetDynamicsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 4 + 76*fp/4 */
+ CARD16 viewUpdate B16; /* Pending, NotPending */
+ BYTE pad[22];
+ /* SINGLE pexViewRep() requested */
+ /* SINGLE pexViewRep() current */
+ } pexGetViewRepReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD16 viewIndex B16;
+ CARD16 unused B16;
+ CARD32 numCoords B32;
+ BYTE pad[16];
+ /* LISTof pexCoord3D( numCoords ) */
+ } pexMapDCtoWCReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 unused B32;
+ CARD32 numCoords B32;
+ BYTE pad[16];
+ /* LISTof pexDeviceCoord( numCoords ) */
+ } pexMapWCtoDCReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* LISTof pexPhigsWksID() */
+ } pexGetWksPostingsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE PickDeviceAttributes( itemMask ) */
+ } pexGetPickDeviceReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* SINGLE pexPickMeasureAttributes( itemMask ) */
+ } pexGetPickMeasureReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numPickElRefs B32;
+ pexEnumTypeIndex pickStatus B16;
+ CARD8 betterPick;
+ BYTE pad[17];
+ /* LISTof pexPickElementRef ( numPickElRefs ) */
+ } pexEndPickOneReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numPickElRefs B32;
+ pexEnumTypeIndex pickStatus B16;
+ CARD8 betterPick;
+ BYTE pad[17];
+ /* LISTof pexPickElementRef ( numPickElRefs ) */
+ } pexPickOneReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numPicked B32;
+ pexEnumTypeIndex pickStatus B16;
+ pexEnumTypeIndex morePicks B16;
+ BYTE pad[16];
+ /* LISTof CLISTof pexPickElementRef ( numPicked ) */
+ } pexEndPickAllReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numPicked B32;
+ pexEnumTypeIndex pickStatus B16;
+ pexEnumTypeIndex morePicks B16;
+ BYTE pad[16];
+ /* LISTof CLISTof pexPickElementRef ( numPicked ) */
+ } pexPickAllReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 lengthFontInfo B32;
+ CARD8 pad[20];
+ /* SINGLE pexFontInfo() */
+ } pexQueryFontReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numStrings B32;
+ BYTE pad[20];
+ /* LISTof pexString( numStrings ) */
+ } pexListFontsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD32 numStrings B32;
+ BYTE pad[20];
+ /* LISTof pexString( numStrings ) */
+ /* CLISTof pexFontInfo() */
+ } pexListFontsWithInfoReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ BYTE pad[24];
+ /* LISTof ExtentInfo() */
+ } pexQueryTextExtentsReply;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not 0 */
+ CARD8 approxSupported;
+ CARD8 exhaustiveApprox;
+ CARD8 unused[2];
+ CARD32 numColorApprox;
+ BYTE pad[16];
+ /* List of pexColourApproxEntry */
+} pexQueryColorApproxReply;
+
+/****************************************************************
+ * REQUESTS *
+ ****************************************************************/
+/* Request structure */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode; /* meaning depends on request type */
+ CARD16 length B16;
+ /* length in 4 bytes quantities */
+ /* of whole request, including this header */
+} pexReq;
+
+/*****************************************************************
+ * structures that follow request.
+ *****************************************************************/
+
+/* ResourceReq is used for any request which has a resource ID
+ ( or Atom or Time ) as its one and only argument. */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ CARD32 id B32; /* a Structure, Renderer, Font, LUT, etc. */
+ } pexResourceReq;
+
+
+/*****************************************************************
+ * Specific Requests
+ *****************************************************************/
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ CARD16 clientProtocolMajor B16;
+ CARD16 clientProtocolMinor B16;
+} pexGetExtensionInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ Drawable drawable B32;
+ pexBitmask itemMask B32;
+ CARD32 numEnums B32;
+ /* LISTof CARD16( numEnums ) */
+ /* pad( numEnums*2 ) */
+} pexGetEnumeratedTypeInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ Drawable drawable B32;
+ CARD32 numNames B32;
+ /* LISTof pexImpDepConstantNames ( numNames ) */
+ /* pad */
+} pexGetImpDepConstantsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ Drawable drawable B32;
+ CARD8 depth;
+ CARD8 unused;
+ CARD16 type B16;
+ CARD32 visualID B32;
+ CARD32 maxTriplets B32;
+} pexMatchRendererTargetsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 + n */
+ CARD32 escapeID B32;
+ /* 4n bytes of additional escape data to skip */
+} pexEscapeReq;
+
+typedef pexEscapeReq pexEscapeWithReplyReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ Drawable drawableExample B32;
+ pexLookupTable lut B32;
+ pexTableType tableType B16;
+ CARD16 unused B16;
+} pexCreateLookupTableReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexLookupTable src B32;
+ pexLookupTable dst B32;
+} pexCopyLookupTableReq;
+
+typedef pexResourceReq pexFreeLookupTableReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ Drawable drawableExample B32;
+ pexTableType tableType B16;
+ CARD16 unused B16;
+} pexGetTableInfoReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ Drawable drawableExample B32;
+ pexTableType tableType B16;
+ pexTableIndex start B16;
+ CARD16 count B16;
+ CARD16 pad B16;
+} pexGetPredefinedEntriesReq;
+
+typedef pexResourceReq pexGetDefinedIndicesReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 valueType B16;
+ pexLookupTable lut B32;
+ pexTableIndex index B16;
+ CARD16 pad B16;
+} pexGetTableEntryReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 valueType B16;
+ pexLookupTable lut B32;
+ pexTableIndex start B16;
+ CARD16 count B16;
+} pexGetTableEntriesReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexLookupTable lut B32;
+ pexTableIndex start B16;
+ CARD16 count B16;
+/* LISTof TableEntry( count ) */
+} pexSetTableEntriesReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ pexTableIndex index B16;
+ pexLookupTable lut B32;
+ pexBitmask TableMask; /* Lookup Table specific bitmask */
+ /* Lookup Table specific list of values */
+} pexChangeTableValuesReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 valueType B16;
+ pexLookupTable lut B32;
+ pexTableIndex index B16;
+ CARD16 unused;
+ pexBitmask TableMask; /* Lookup Table specific bitmask */
+} pexGetTableValuesReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexLookupTable lut B32;
+ pexTableIndex start B16;
+ CARD16 count B16;
+} pexDeleteTableEntriesReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPC pc B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+ /* SINGLE PipelineContextAttributes( itemMask ) */
+} pexCreatePipelineContextReq;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexPC src B32;
+ pexPC dst B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+} pexCopyPipelineContextReq;
+
+typedef pexResourceReq pexFreePipelineContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPC pc B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+} pexGetPipelineContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPC pc B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+ /* SINGLE PipelineContextAttributes( itemMask ) */
+} pexChangePipelineContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ pexBitmask itemMask B32;
+ /* SINGLE RendererAttributes( itemMask ) */
+} pexCreateRendererReq;
+
+typedef pexResourceReq pexFreeRendererReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexRenderer rdr B32;
+ pexBitmask itemMask B32;
+ /* SINGLE RendererAttributes( itemMask ) */
+} pexChangeRendererReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexRenderer rdr B32;
+ pexBitmask itemMask B32;
+} pexGetRendererAttributesReq;
+
+typedef pexResourceReq pexGetRendererDynamicsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+} pexBeginRenderingReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ pexSwitch flushFlag;
+ BYTE pad[3];
+} pexEndRenderingReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ pexBitmask clearControl B32;
+} pexClearRendererReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ pexSwitch flushFlag;
+ BYTE pad[3];
+} pexFlushRendererReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ pexRenderer rdr B32;
+} pexInitRendererReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ Drawable pixmap B32;
+} pexCopyAlphaToPixmapReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ Drawable pixmap B32;
+} pexCopyPixmapToAlphaReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ Drawable pixmap B32;
+} pexCopyZBufferToPixmapReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ Drawable pixmap B32;
+} pexCopyPixmapToZBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexRenderer rdr B32;
+ pexPC pc B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+} pexCopyPCToPipelineStateReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexRenderer rdr B32;
+ pexPC pc B32;
+ pexBitmask itemMask[3]; /* pexBitmask Array */
+} pexCopyPipelineStateToPCReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ pexSwitch normalizedValues;
+ CARD8 unused;
+ pexRenderer rdr B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+} pexGetZBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused;
+ CARD32 numValues B32;
+ pexRenderer rdr B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+ pexSwitch normalizedValues;
+ CARD8 more_unused[3];
+ /* Z buffer values go here */
+} pexPutZBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ pexRenderer rdr B32;
+} pexInitMultipassReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ pexRenderer rdr B32;
+ CARD16 multipass_control;
+ CARD16 unused;
+} pexNextPassReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexRenderer rdr B32;
+ pexStructure sid B32;
+} pexBeginStructureReq;
+
+typedef pexResourceReq pexEndStructureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexRenderer rdr B32;
+ CARD32 numCommands B32;
+ /* LISTof OutputCommand( numCommands ) */
+} pexRenderOutputCommandsReq;
+/* individual output commands may be found in the section "Output Commands" */
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 7 */
+ pexRenderer rdr B32;
+ pexStructure sid B32;
+ pexElementRange range;
+} pexRenderElementsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 + 2n */
+ pexRenderer rdr B32;
+ CARD32 numElRefs B32;
+ /* LISTof pexElementRef( numElRefs ) */
+} pexAccumulateStateReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ pexStructure sid B32;
+} pexRenderNetworkReq;
+
+typedef pexResourceReq pexCreateStructureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexStructure src B32;
+ pexStructure dst B32;
+} pexCopyStructureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ CARD32 numStructures B32;
+ /* LISTof pexStructure( numStructures ) */
+} pexDestroyStructuresReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 itemMask B16;
+ pexStructure sid B32;
+} pexGetStructureInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexStructure sid B32;
+ CARD16 permission B16;
+ CARD16 unused B16;
+} pexSetStructurePermissionReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 7 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexStructure sid B32;
+ pexElementRange range;
+} pexGetElementInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexStructure sid B32;
+ CARD16 which B16;
+ CARD16 pad B16;
+} pexGetStructuresInNetworkReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexStructure sid B32;
+ CARD16 pathOrder B16;
+ CARD16 unused B16;
+ CARD32 pathDepth B32;
+} pexGetAncestorsReq;
+
+typedef pexGetAncestorsReq pexGetDescendantsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 7 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexStructure sid B32;
+ pexElementRange range;
+} pexFetchElementsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexStructure sid B32;
+ CARD16 mode B16;
+ CARD16 pad B16;
+} pexSetEditingModeReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexStructure sid B32;
+ pexElementPos position;
+} pexSetElementPointerReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexStructure sid B32;
+ INT32 label B32;
+ INT32 offset B32;
+} pexSetElementPointerAtLabelReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexStructure sid B32;
+ INT32 pickId B32;
+ INT32 offset B32;
+} pexSetElementPointerAtPickIDReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexStructure sid B32;
+ pexElementPos position;
+ CARD32 direction B32;
+ CARD32 numIncls B32;
+ CARD32 numExcls B32;
+ /* LISTof CARD16( numIncls ) */
+ /* pad( numIncls*2 ) */
+ /* LISTof CARD16( numExcls ) */
+ /* pad( numExcls*2 ) */
+} pexElementSearchReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexStructure sid B32;
+ CARD32 numCommands B32;
+ /* LISTof OutputCommand( numCommands ) */
+} pexStoreElementsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 */
+ pexStructure sid B32;
+ pexElementRange range;
+} pexDeleteElementsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexStructure sid B32;
+ pexElementPos position;
+ INT32 label B32;
+} pexDeleteElementsToLabelReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexStructure sid B32;
+ INT32 label1 B32;
+ INT32 label2 B32;
+} pexDeleteBetweenLabelsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 9 */
+ pexStructure src B32;
+ pexElementRange srcRange;
+ pexStructure dst B32;
+ pexElementPos dstPosition;
+} pexCopyElementsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexStructure old_id B32;
+ pexStructure new_id B32;
+} pexChangeStructureRefsReq;
+
+typedef pexResourceReq pexCreateNameSetReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexNameSet src B32;
+ pexNameSet dst B32;
+} pexCopyNameSetReq;
+
+typedef pexResourceReq pexFreeNameSetReq;
+
+typedef pexResourceReq pexGetNameSetReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexNameSet ns B32;
+ CARD16 action B16;
+ CARD16 unused B16;
+ /* LISTof pexName() */
+} pexChangeNameSetReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexSC sc B32;
+ pexBitmask itemMask B32;
+ /* SINGLE SearchContextAttributes( itemMask ) */
+} pexCreateSearchContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexSC src B32;
+ pexSC dst B32;
+ pexBitmask itemMask B32;
+} pexCopySearchContextReq;
+
+typedef pexResourceReq pexFreeSearchContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexSC sc B32;
+ pexBitmask itemMask B32;
+} pexGetSearchContextReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexSC sc B32;
+ pexBitmask itemMask B32;
+ /* SINGLE SearchContextAttributes( itemMask ) */
+} pexChangeSearchContextReq;
+
+typedef pexResourceReq pexSearchNetworkReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 19 */
+ pexPhigsWks wks B32;
+ Drawable drawable B32;
+ pexLookupTable markerBundle B32;
+ pexLookupTable textBundle B32;
+ pexLookupTable lineBundle B32;
+ pexLookupTable interiorBundle B32;
+ pexLookupTable edgeBundle B32;
+ pexLookupTable colourTable B32;
+ pexLookupTable depthCueTable B32;
+ pexLookupTable lightTable B32;
+ pexLookupTable colourApproxTable B32;
+ pexLookupTable patternTable B32;
+ pexLookupTable textFontTable B32;
+ pexNameSet highlightIncl B32;
+ pexNameSet highlightExcl B32;
+ pexNameSet invisIncl B32;
+ pexNameSet invisExcl B32;
+ CARD16 bufferMode B16;
+ CARD16 pad B16;
+} pexCreatePhigsWksReq;
+
+typedef pexResourceReq pexFreePhigsWksReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexBitmask itemMask[2] B32;
+} pexGetWksInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ Drawable drawable B32;
+} pexGetDynamicsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexEnumTypeIndex fpFormat B16;
+ pexTableIndex index B16;
+ pexPhigsWks wks B32;
+} pexGetViewRepReq;
+
+typedef pexResourceReq pexRedrawAllStructuresReq;
+
+typedef pexResourceReq pexUpdateWorkstationReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexPhigsWks wks B32;
+ CARD32 numRects B32;
+ /* LISTof pexDeviceRect( numRects ) */
+} pexRedrawClipRegionReq;
+
+typedef pexResourceReq pexExecuteDeferredActionsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexPhigsWks wks B32;
+ pexTableIndex index1 B16;
+ pexTableIndex index2 B16;
+ CARD16 priority B16;
+ CARD16 pad B16;
+} pexSetViewPriorityReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexPhigsWks wks B32;
+ pexEnumTypeIndex displayUpdate B16;
+ CARD16 pad B16;
+} pexSetDisplayUpdateModeReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ CARD32 numCoords B32;
+ /* LISTof pexDeviceCoord( numCoords ) */
+} pexMapDCtoWCReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 index B16;
+ pexPhigsWks wks B32;
+ CARD32 numCoords B32;
+ /* LISTof pexCoord3D( numCoords ) */
+} pexMapWCtoDCReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 43 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexViewRep viewRep;
+} pexSetViewRepReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 9 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexNpcSubvolume npcSubvolume;
+} pexSetWksWindowReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 8 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexViewport viewport;
+} pexSetWksViewportReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexPhigsWks wks B32;
+ pexEnumTypeIndex mode B16;
+ CARD16 pad B16;
+} pexSetHlhsrModeReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexPhigsWks wks B32;
+ CARD16 bufferMode B16;
+ CARD16 pad B16;
+} pexSetWksBufferModeReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexStructure sid B32;
+ PEXFLOAT priority;
+} pexPostStructureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexPhigsWks wks B32;
+ pexStructure sid B32;
+} pexUnpostStructureReq;
+
+typedef pexResourceReq pexUnpostAllStructuresReq;
+
+typedef pexResourceReq pexGetWksPostingsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex devType B16;
+ pexPhigsWks wks B32;
+ pexBitmask itemMask B32;
+} pexGetPickDeviceReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused B16;
+ pexPhigsWks wks B32;
+ pexEnumTypeIndex devType B16;
+ CARD16 unused2 B16;
+ pexBitmask itemMask B32;
+ /* SINGLE PickDeviceAttributes( itemMask ) */
+} pexChangePickDeviceReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 4 */
+ pexPhigsWks wks B32;
+ pexPickMeasure pm;
+ pexEnumTypeIndex devType B16;
+ CARD16 pad B16;
+} pexCreatePickMeasureReq;
+
+typedef pexResourceReq pexFreePickMeasureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 3 */
+ pexPickMeasure pm B32;
+ pexBitmask itemMask B32;
+} pexGetPickMeasureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexPickMeasure pm B32;
+ CARD32 numBytes B32;
+ /* LISTof CARD8( numBytes ) */
+ /* pad( numBytes ) */
+} pexUpdatePickMeasureReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 + n */
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex method B16;
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ INT32 sid B32;
+ /* SINGLE PickRecord () */
+} pexBeginPickOneReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ pexRenderer rdr B32;
+} pexEndPickOneReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 + n */
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex method B16;
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ pexStructure sid B32;
+ /* SINGLE PickRecord () */
+} pexPickOneReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 7 + n */
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex method B16;
+ CARD8 sendEvent;
+ CARD8 unused[3];
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ INT32 sid B32;
+ CARD32 pickMaxHits B32;
+ /* SINGLE PickRecord () */
+} pexBeginPickAllReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 2 */
+ pexRenderer rdr B32;
+} pexEndPickAllReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 6 + n */
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex method B16;
+ pexRenderer rdr B32;
+ Drawable drawable B32;
+ CARD32 pickMaxHits B32;
+ /* SINGLE RendererPickRecord () */
+} pexPickAllReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexFont font B32;
+ CARD32 numBytes B32;
+ /* LISTof CARD8( numBytes ) -- don't swap */
+ /* pad( numBytes ) */
+} pexOpenFontReq;
+
+typedef pexResourceReq pexCloseFontReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexFont font B32;
+} pexQueryFontReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ CARD16 maxNames B16;
+ CARD16 numChars B16;
+ /* LISTof CARD8( numChars ) -- don't swap */
+ /* pad( numBytes ) */
+} pexListFontsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ CARD16 unused B16;
+ CARD16 maxNames B16;
+ CARD16 numChars B16;
+ CARD16 pad B16;
+ /* LISTof CARD8( numChars ) */
+ /* pad( numBytes ) */
+} pexListFontsWithInfoReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 textPath B16;
+ pexTableIndex fontGroupIndex B16;
+ CARD16 unused B16;
+ XID id B32; /* renderer, wks, or text font lut */
+ PEXFLOAT charExpansion;
+ PEXFLOAT charSpacing;
+ PEXFLOAT charHeight;
+ pexTextAlignmentData textAlignment;
+ CARD32 numStrings B32;
+ /* LISTof LISTof MONO_ENCODINGS() */
+ /* pad() */
+} pexQueryTextExtentsReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16; /* 5 */
+ pexEnumTypeIndex fpFormat B16;
+ CARD16 unused;
+ Drawable drawable B32;
+ pexColourApproxEntry ColourApprox;
+} pexQueryColorApproxReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex TMDimension B16;
+ CARD32 TMid B32;
+ CARD16 numLevels B16;
+ pexEnumTypeIndex texelType B16;
+ /* list of array of Texels goes here */
+} pexCreateColorMipMapTMReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex TMDimension B16;
+ CARD32 TMid B32;
+ CARD16 numLevels B16;
+ pexEnumTypeIndex texelType B16;
+ Drawable drawable B32;
+ CARD16 lumnanceSelector B16;
+ CARD16 alphaSelector B16;
+ /* list of texel array counts
+ list of color resource IDs
+ list of alpha resource IDs
+ */
+} pexCreateColorMipMapfromResReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex unused B16;
+ Drawable drawable B32;
+ PEXFLOAT src_weight;
+ PEXFLOAT dst_weight;
+} pexAccumulateBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ Drawable drawable B32;
+} pexAllocAccumBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ Drawable drawable B32;
+} pexFreeAccumBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ Drawable drawable B32;
+} pexLoadAccumBufferReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 opcode;
+ CARD16 length B16;
+ pexEnumTypeIndex fpFormat B16;
+ pexEnumTypeIndex unused B16;
+ Drawable drawable B32;
+ PEXFLOAT scale;
+} pexReturnAccumBufferReq;
+
+/*****************************************************************
+ * Output Commands
+ *****************************************************************/
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex markerType B16;
+ CARD16 pad B16;
+} pexMarkerType;
+
+typedef struct {
+ pexElementInfo head;
+ PEXFLOAT scale;
+} pexMarkerScale;
+
+typedef struct {
+ pexElementInfo head;
+ pexTableIndex index B16;
+ CARD16 pad B16;
+} pexMarkerBundleIndex;
+
+typedef pexMarkerBundleIndex pexMarkerColourIndex;
+typedef pexMarkerBundleIndex pexTextColourIndex;
+typedef pexMarkerBundleIndex pexLineColourIndex;
+typedef pexMarkerBundleIndex pexSurfaceColourIndex;
+typedef pexMarkerBundleIndex pexBfSurfaceColourIndex;
+typedef pexMarkerBundleIndex pexSurfaceEdgeColourIndex;
+
+typedef pexMarkerBundleIndex pexTextFontIndex;
+
+typedef struct {
+ pexElementInfo head;
+ pexColourSpecifier colourSpec;
+ /* SINGLE COLOUR() */
+} pexMarkerColour;
+
+typedef pexMarkerColour pexTextColour;
+typedef pexMarkerColour pexLineColour;
+typedef pexMarkerColour pexSurfaceColour;
+typedef pexMarkerColour pexBfSurfaceColour;
+typedef pexMarkerColour pexSurfaceEdgeColour;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex style B16;
+ CARD16 pad B16;
+} pexAtextStyle;
+
+typedef pexMarkerBundleIndex pexTextBundleIndex;
+typedef pexMarkerBundleIndex pexLineBundleIndex;
+typedef pexMarkerBundleIndex pexInteriorBundleIndex;
+typedef pexMarkerBundleIndex pexInteriorStyleIndex;
+typedef pexMarkerBundleIndex pexBfInteriorStyleIndex;
+typedef pexMarkerBundleIndex pexEdgeBundleIndex;
+typedef pexMarkerBundleIndex pexViewIndex;
+typedef pexMarkerBundleIndex pexDepthCueIndex;
+typedef pexMarkerBundleIndex pexColourApproxIndex;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 precision B16;
+ CARD16 pad B16;
+} pexTextPrecision;
+
+typedef struct {
+ pexElementInfo head;
+ PEXFLOAT expansion;
+} pexCharExpansion;
+
+typedef struct {
+ pexElementInfo head;
+ PEXFLOAT spacing;
+} pexCharSpacing;
+
+typedef struct {
+ pexElementInfo head;
+ PEXFLOAT height;
+} pexCharHeight;
+typedef pexCharHeight pexAtextHeight;
+
+typedef struct {
+ pexElementInfo head;
+ pexVector2D up;
+} pexCharUpVector;
+typedef pexCharUpVector pexAtextUpVector;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 path B16;
+ CARD16 pad B16;
+} pexTextPath;
+typedef pexTextPath pexAtextPath;
+
+typedef struct {
+ pexElementInfo head;
+ pexTextAlignmentData alignment;
+} pexTextAlignment;
+typedef pexTextAlignment pexAtextAlignment;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex lineType B16;
+ CARD16 pad B16;
+} pexLineType;
+
+typedef struct {
+ pexElementInfo head;
+ PEXFLOAT width;
+} pexLineWidth;
+typedef pexLineWidth pexSurfaceEdgeWidth;
+
+typedef struct {
+ pexElementInfo head;
+ pexCurveApprox approx;
+} pexCurveApproximation;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex polylineInterp B16;
+ CARD16 pad B16;
+} pexPolylineInterp;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex interiorStyle B16;
+ CARD16 pad B16;
+} pexInteriorStyle;
+typedef pexInteriorStyle pexBfInteriorStyle;
+
+typedef struct {
+ pexElementInfo head;
+ pexReflectionAttr reflectionAttr;
+} pexSurfaceReflAttr;
+typedef pexSurfaceReflAttr pexBfSurfaceReflAttr;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex reflectionModel B16;
+ CARD16 pad B16;
+} pexSurfaceReflModel;
+typedef pexSurfaceReflModel pexBfSurfaceReflModel;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex surfaceInterp B16;
+ CARD16 pad B16;
+} pexSurfaceInterp;
+typedef pexSurfaceInterp pexBfSurfaceInterp;
+
+typedef struct {
+ pexElementInfo head;
+ pexSurfaceApprox approx;
+} pexSurfaceApproximation;
+
+typedef struct {
+ pexElementInfo head;
+ pexCullMode cullMode B16;
+ CARD16 pad B16;
+} pexCullingMode;
+
+typedef struct {
+ pexElementInfo head;
+ pexSwitch distinguish;
+ BYTE pad[3];
+} pexDistinguishFlag;
+
+typedef struct {
+ pexElementInfo head;
+ pexVector2D size;
+} pexPatternSize;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord2D point;
+} pexPatternRefPt;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord3D refPt;
+ pexVector3D vector1;
+ pexVector3D vector2;
+} pexPatternAttr;
+
+typedef struct {
+ pexElementInfo head;
+ pexSwitch onoff;
+ BYTE pad[3];
+} pexSurfaceEdgeFlag;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex edgeType B16;
+ CARD16 pad B16;
+} pexSurfaceEdgeType;
+
+typedef struct {
+ pexElementInfo head;
+ pexAsfAttribute attribute B32;
+ pexAsfValue source;
+ BYTE pad[3];
+} pexSetAsfValues;
+
+typedef struct {
+ pexElementInfo head;
+ pexComposition compType;
+ CARD16 unused B16;
+ pexMatrix matrix;
+} pexLocalTransform;
+
+typedef struct {
+ pexElementInfo head;
+ pexComposition compType;
+ CARD16 unused B16;
+ pexMatrix3X3 matrix3X3;
+} pexLocalTransform2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexMatrix matrix;
+} pexGlobalTransform;
+
+typedef struct {
+ pexElementInfo head;
+ pexMatrix3X3 matrix3X3;
+} pexGlobalTransform2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexSwitch onoff;
+ BYTE pad[3];
+} pexModelClip;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex modelClipOperator B16;
+ CARD16 numHalfSpaces B16;
+ /* LISTof pexHalfSpace( numHalfSpaces ) */
+} pexModelClipVolume;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex modelClipOperator B16;
+ CARD16 numHalfSpaces B16;
+ /* LISTof pexHalfSpace2D( numHalfSpaces ) */
+} pexModelClipVolume2D;
+
+typedef struct {
+ pexElementInfo head;
+} pexRestoreModelClip;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 numEnable B16;
+ CARD16 numDisable B16;
+ /* LISTof pexTableIndex( numEnable ) */
+ /* pad( ( numEnable )*2 ) */
+ /* LISTof pexTableIndex( numDisable ) */
+ /* pad( ( numDisable )*2 ) */
+} pexLightState;
+
+typedef struct {
+ pexElementInfo head;
+ CARD32 pickId B32;
+} pexPickId;
+
+typedef struct {
+ pexElementInfo head;
+ CARD32 hlhsrID B32;
+} pexHlhsrIdentifier;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex model B16;
+ CARD16 pad B16;
+} pexRenderingColourModel;
+
+typedef struct {
+ pexElementInfo head;
+ pexEnumTypeIndex characteristics B16;
+ CARD16 length B16;
+ /* SINGLEof PARAMETRIC_SURFACE_CHARACTERISTICS */
+} pexParaSurfCharacteristics;
+
+typedef struct {
+ pexElementInfo head;
+ /* LISTof pexName() */
+} pexAddToNameSet;
+typedef pexAddToNameSet pexRemoveFromNameSet;
+
+typedef struct {
+ pexElementInfo head;
+ pexStructure id B32;
+} pexExecuteStructure;
+
+typedef struct {
+ pexElementInfo head;
+ INT32 label B32;
+} pexLabel;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 numElements B16;
+ CARD16 unused B16;
+ /* LISTof CARD8( numElements ) -- don't swap */
+ /* pad( numElements ) */
+} pexApplicationData;
+
+typedef struct {
+ pexElementInfo head;
+ CARD32 id B32;
+ CARD16 numElements B16;
+ CARD16 unused B16;
+ /* LISTof CARD8( numElements ) -- don't swap */
+ /* pad( numElements ) */
+} pexGse;
+
+typedef struct {
+ pexElementInfo head;
+ /* LISTof pexCoord3D() */
+} pexMarker;
+
+typedef struct {
+ pexElementInfo head;
+ /* LISTof pexCoord2D() */
+} pexMarker2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord3D origin;
+ pexVector3D vector1;
+ pexVector3D vector2;
+ CARD16 numEncodings B16;
+ CARD16 unused B16;
+ /* LISTof pexMonoEncoding( numEncodings ) */
+} pexText;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord2D origin;
+ CARD16 numEncodings B16;
+ CARD16 unused B16;
+ /* LISTof pexMonoEncoding( numEncodings ) */
+} pexText2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord3D origin;
+ pexCoord3D offset;
+ CARD16 numEncodings B16;
+ CARD16 unused B16;
+ /* LISTof pexMonoEncoding( numEncodings ) */
+} pexAnnotationText;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord2D origin;
+ pexCoord2D offset;
+ CARD16 numEncodings B16;
+ CARD16 unused B16;
+ /* LISTof pexMonoEncoding( numEncodings ) */
+} pexAnnotationText2D;
+
+typedef struct {
+ pexElementInfo head;
+ /* LISTof pexCoord3D() */
+} pexPolyline;
+
+typedef struct {
+ pexElementInfo head;
+ /* LISTof pexCoord2D() */
+} pexPolyline2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexColourType colourType B16;
+ pexBitmaskShort vertexAttribs B16;
+ CARD32 numLists B32;
+ /* LISTof CLISTof pexVertex( numLists, vertexAttribs, colourType ) */
+} pexPolylineSet;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 curveOrder B16;
+ pexCoordType coordType B16;
+ PEXFLOAT tmin;
+ PEXFLOAT tmax;
+ CARD32 numKnots B32;
+ CARD32 numPoints B32;
+ /* LISTof FLOAT( numKnots ) */
+ /* LISTof {pexCoord3D|pexCoord4D}( numPoints, coordType ) */
+} pexNurbCurve;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 pad;
+ /* LISTof pexCoord3D() */
+} pexFillArea;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 unused;
+ /* LISTof pexCoord2D() */
+} pexFillArea2D;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 unused;
+ pexColourType colourType B16;
+ pexBitmaskShort facetAttribs B16;
+ pexBitmaskShort vertexAttribs B16;
+ CARD16 unused2 B16;
+ /* SINGLE Facet( facetAttribs, vertexAttribs, colourType ) */
+} pexExtFillArea;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 contourHint;
+ CARD32 numLists B32;
+ /* LISTof CLISTof Coord3D( numLists ) */
+} pexFillAreaSet;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 contourHint;
+ CARD32 numLists B32;
+ /* LISTof CLISTof Coord2D( numLists ) */
+} pexFillAreaSet2D;
+
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexSwitch ignoreEdges;
+ CARD8 contourHint;
+ pexColourType colourType B16;
+ pexBitmaskShort facetAttribs B16;
+ pexBitmaskShort vertexAttribs B16;
+ CARD16 unused2 B16;
+ CARD32 numLists B32;
+ /* pexOptData( facetAttribs ) */
+ /* LISTof CLISTof pexVertex( numLists, vertexAttribs, colourType ) */
+} pexExtFillAreaSet;
+
+typedef struct {
+ pexElementInfo head;
+ pexColourType colourType B16;
+ pexBitmaskShort facetAttribs B16;
+ pexBitmaskShort vertexAttribs B16;
+ CARD16 unused B16;
+ CARD32 numVertices B32;
+ /* number of OptData is numVert - 2 */
+ /* LISTof pexOptData( facetAttribs, colourType ) */
+ /* LISTof pexVertex( numVertices, vertexAttribs, colourType ) */
+} pexTriangleStrip;
+
+typedef struct {
+ pexElementInfo head;
+ pexColourType colourType B16;
+ CARD16 mPts B16;
+ CARD16 nPts B16;
+ pexBitmaskShort facetAttribs B16;
+ pexBitmaskShort vertexAttribs B16;
+ CARD16 shape B16;
+ /* actually, there are (mPts-1)*(nPts-1) opt data entries */
+ /* LISTof pexOptData( facetAttribs, colourType ) */
+ /* LISTof pexVertex( mPts, nPts, vertexAttribs, colourType ) */
+} pexQuadrilateralMesh;
+
+typedef struct {
+ pexElementInfo head;
+ CARD16 shape B16;
+ pexColourType colourType B16;
+ CARD16 FAS_Attributes B16;
+ CARD16 vertexAttributes B16;
+ CARD16 edgeAttributes B16;
+ CARD8 contourHint;
+ pexSwitch contourCountsFlag;
+ CARD16 numFAS B16;
+ CARD16 numVertices B16;
+ CARD16 numEdges B16;
+ CARD16 numContours B16;
+ /* LISTof OPT_DATA( numFAS ) */
+ /* LISTof pexVertex( numVertices ) */
+ /* LISTof CARD8( numEdges ) */
+ /* pad( numEdges ) */
+ /* LISTof CLISTof CLISTof CARD16( numFAS, numContours, numEdges ) */
+ /* pad */
+} pexSOFAS;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoordType type B16;
+ CARD16 uOrder B16;
+ CARD16 vOrder B16;
+ CARD16 unused B16;
+ CARD32 numUknots B32;
+ CARD32 numVknots B32;
+ CARD16 mPts B16;
+ CARD16 nPts B16;
+ CARD32 numLists B32;
+ /* LISTof FLOAT( numUknots ) */
+ /* LISTof FLOAT( numVKnots ) */
+ /* LISTof {pexCoord3D|pexCoord4D}( mPts, nPts, surfaceType ) */
+ /* LISTof CLISTof pexTrimCurve( numLists ) */
+} pexNurbSurface;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord3D point1;
+ pexCoord3D point2;
+ pexCoord3D point3;
+ CARD32 dx B32;
+ CARD32 dy B32;
+ /* LISTof pexTableIndex( dx, dy ) */
+ /* pad( 2*dx*dy ) */
+} pexCellArray;
+
+typedef struct {
+ pexElementInfo head;
+ pexCoord2D point1;
+ pexCoord2D point2;
+ CARD32 dx B32;
+ CARD32 dy B32;
+ /* LISTof pexTableIndex( dx, dy ) */
+ /* pad( 2*dx*dy ) */
+} pexCellArray2D;
+
+typedef struct {
+ pexElementInfo head;
+ pexColourType colourType B16;
+ CARD16 unused B16;
+ pexCoord3D point1;
+ pexCoord3D point2;
+ pexCoord3D point3;
+ CARD32 dx B32;
+ CARD32 dy B32;
+ /* LISTof pexColourSpecifier( dx, dy ) */
+} pexExtCellArray;
+
+typedef struct {
+ pexElementInfo head;
+ INT32 gdpId B32;
+ CARD32 numPoints B32;
+ CARD32 numBytes B32;
+ /* LISTof pexCoord3D( numPoints ) */
+ /* LISTof CARD8( numBytes ) -- don't swap */
+ /* pad( numBytes ) */
+} pexGdp;
+
+typedef struct {
+ pexElementInfo head;
+ INT32 gdpId B32;
+ CARD32 numPoints B32;
+ CARD32 numBytes B32;
+ /* LISTof pexCoord2D( numPoints ) */
+ /* LISTof CARD8( numBytes ) -- don't swap */
+ /* pad( numBytes ) */
+} pexGdp2D;
+
+typedef struct {
+ pexElementInfo head;
+} pexNoop;
+
+/****************************************************************
+ * EVENTS *
+ ****************************************************************/
+/* Event structure */
+
+typedef struct {
+ BYTE type; /* X_Event */
+ CARD8 what; /* unused */
+ CARD16 sequenceNumber B16;
+ CARD32 rdr B32;
+ BYTE pad[24];
+} pexMaxHitsReachedEvent;
+
+#endif /* PEXPROTO_H */
+
diff --git a/xc/programs/Xserver/PEX5/include/PEXprotost.h b/xc/programs/Xserver/PEX5/include/PEXprotost.h
new file mode 100644
index 000000000..1bd279427
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/PEXprotost.h
@@ -0,0 +1,608 @@
+/* $TOG: PEXprotost.h /main/7 1998/02/10 12:33:45 kaleb $ */
+
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEXPROTOSTR_H
+#define PEXPROTOSTR_H
+
+/* Matches revision 5.1C */
+
+#include <X11/Xmd.h> /* defines things like CARD32 */
+
+
+/* This is FLOAT as defined and used by the Protocol Encoding */
+typedef float PEXFLOAT;
+
+
+typedef CARD32 pexAsfAttribute;
+typedef CARD8 pexAsfValue;
+typedef CARD32 pexBitmask;
+typedef CARD16 pexBitmaskShort;
+typedef CARD16 pexCoordType; /* rational, nonrational */
+typedef CARD16 pexComposition;
+typedef CARD16 pexCullMode;
+typedef BYTE pexDynamicType;
+typedef INT16 pexEnumTypeIndex;
+typedef XID pexLookupTable;
+typedef CARD32 pexName;
+typedef XID pexNameSet;
+typedef XID pexPC;
+typedef XID pexFont;
+typedef PEXFLOAT pexMatrix[4][4];
+typedef PEXFLOAT pexMatrix3X3[3][3];
+typedef XID pexPhigsWks;
+typedef XID pexPickMeasure;
+typedef XID pexRenderer;
+typedef XID pexSC;
+typedef XID pexStructure;
+typedef CARD8 pexSwitch;
+typedef CARD16 pexTableIndex;
+typedef CARD16 pexTableType; /* could be smaller if it ever helps */
+typedef CARD16 pexTextHAlignment;
+typedef CARD16 pexTextVAlignment;
+typedef CARD16 pexTypeOrTableIndex;
+typedef pexEnumTypeIndex pexColourType; /* ColourType */
+
+/* included in others */
+typedef struct {
+ CARD16 length B16;
+ /* list of CARD8 -- don't swap */
+} pexString;
+
+typedef struct {
+ pexStructure sid B32;
+ PEXFLOAT priority;
+} pexStructureInfo;
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+} pexVector2D;
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+ PEXFLOAT z;
+} pexVector3D;
+
+/* Coord structures */
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+} pexCoord2D;
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+ PEXFLOAT z;
+} pexCoord3D;
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+ PEXFLOAT z;
+ PEXFLOAT w;
+} pexCoord4D;
+
+
+/* Colour structures */
+typedef struct {
+ PEXFLOAT red;
+ PEXFLOAT green;
+ PEXFLOAT blue;
+} pexRgbFloatColour;
+
+typedef struct {
+ PEXFLOAT hue;
+ PEXFLOAT saturation;
+ PEXFLOAT value;
+} pexHsvColour;
+
+typedef struct {
+ PEXFLOAT hue;
+ PEXFLOAT lightness;
+ PEXFLOAT saturation;
+} pexHlsColour;
+
+typedef struct {
+ PEXFLOAT x;
+ PEXFLOAT y;
+ PEXFLOAT z;
+} pexCieColour;
+
+typedef struct {
+ CARD8 red;
+ CARD8 green;
+ CARD8 blue;
+ CARD8 pad;
+} pexRgb8Colour;
+
+typedef struct {
+ CARD16 red B16;
+ CARD16 green B16;
+ CARD16 blue B16;
+ CARD16 pad B16;
+} pexRgb16Colour;
+
+typedef struct {
+ pexTableIndex index B16;
+ CARD16 pad B16;
+} pexIndexedColour;
+
+typedef struct {
+ union {
+ pexIndexedColour indexed;
+ pexRgb8Colour rgb8;
+ pexRgb16Colour rgb16;
+ pexRgbFloatColour rgbFloat;
+ pexHsvColour hsvFloat;
+ pexHlsColour hlsFloat;
+ pexCieColour cieFloat;
+ } format;
+} pexColour;
+
+typedef struct {
+ PEXFLOAT first;
+ PEXFLOAT second;
+ PEXFLOAT third;
+} pexFloatColour;
+
+typedef struct {
+ pexColourType colourType B16; /* ColourType enumerated type */
+ CARD16 unused B16;
+ /* SINGLE COLOUR(colourType) */
+} pexColourSpecifier;
+
+
+typedef struct {
+ pexEnumTypeIndex approxMethod B16;
+ CARD16 unused B16;
+ PEXFLOAT tolerance;
+} pexCurveApprox;
+
+typedef struct {
+ INT16 x B16;
+ INT16 y B16;
+ PEXFLOAT z;
+} pexDeviceCoord;
+
+typedef struct {
+ INT16 x B16;
+ INT16 y B16;
+} pexDeviceCoord2D;
+
+typedef struct {
+ INT16 xmin B16;
+ INT16 ymin B16;
+ INT16 xmax B16;
+ INT16 ymax B16;
+} pexDeviceRect;
+
+typedef struct {
+ CARD16 elementType B16;
+ CARD16 length B16;
+} pexElementInfo;
+
+typedef struct {
+ CARD16 whence B16;
+ CARD16 unused B16;
+ INT32 offset B32;
+} pexElementPos;
+
+typedef struct {
+ pexElementPos position1;
+ pexElementPos position2;
+} pexElementRange;
+
+typedef struct {
+ pexStructure structure B32;
+ CARD32 offset B32;
+} pexElementRef;
+
+typedef struct {
+ pexCoord2D lowerLeft;
+ pexCoord2D upperRight;
+ pexCoord2D concatpoint;
+} pexExtentInfo;
+
+typedef struct {
+ pexEnumTypeIndex index B16;
+ pexString descriptor;
+} pexEnumTypeDesc;
+
+typedef struct {
+ pexCoord3D point;
+ pexVector3D vector;
+} pexHalfSpace;
+
+typedef struct {
+ pexNameSet incl;
+ pexNameSet excl;
+} pexNameSetPair;
+
+typedef struct {
+ pexCoord2D point;
+ pexVector2D vector;
+} pexHalfSpace2D;
+
+typedef struct {
+ CARD16 composition B16;
+ CARD16 unused B16;
+ pexMatrix matrix;
+} pexLocalTransform3DData;
+
+typedef struct {
+ CARD16 composition B16;
+ CARD16 unused B16;
+ pexMatrix3X3 matrix;
+} pexLocalTransform2DData;
+
+typedef struct {
+ pexCoord3D minval;
+ pexCoord3D maxval;
+} pexNpcSubvolume;
+
+/* an OPT_DATA structure cannot be defined because it has variable content
+ * and size. An union structure could be used to define a template for
+ * the data. However, since unions pad to a fixed amount of space and the
+ * protocol uses variable lengths, this is not appropriate for protocol
+ * data types. The most correct way of defining this data is to define
+ * one data structure for every possible combination of color, normal and
+ * edge data that could be given with a vertex or facet.
+ */
+
+typedef struct {
+ pexStructure sid B32;
+ CARD32 offset B32;
+ CARD32 pickid B32;
+} pexPickElementRef;
+
+/* pexPickPath is the old name of the above strucutre.
+ This is wrong, since the above is a Pick Element Ref
+ a Pick Path is a list of Pick Element Refs so naming
+ this structure pexPickPath was wrong, but it can't just
+ be changed without effecting lots of other code....... */
+
+typedef pexPickElementRef pexPickPath;
+
+typedef struct {
+ pexTextVAlignment vertical B16;
+ pexTextHAlignment horizontal B16;
+} pexTextAlignmentData;
+
+typedef struct {
+ pexSwitch visibility;
+ CARD8 unused;
+ CARD16 order B16;
+ pexCoordType type B16;
+ INT16 approxMethod B16;
+ PEXFLOAT tolerance;
+ PEXFLOAT tMin;
+ PEXFLOAT tMax;
+ CARD32 numKnots B32;
+ CARD32 numCoord B32;
+ /* LISTof FLOAT(numKnots) -- length = order + number of coords */
+ /* LISTof {pexCoord3D|pexCoord4D}(numCoord) */
+} pexTrimCurve;
+
+typedef struct {
+ CARD8 depth;
+ CARD8 unused;
+ CARD16 type B16;
+ CARD32 visualID B32;
+} pexRendererTarget;
+
+typedef struct {
+ pexEnumTypeIndex pickType B16;
+ CARD16 unused;
+ /* SINGLE HITBOX() */
+} pexPickRecord;
+
+typedef struct {
+ PEXFLOAT ambient;
+ PEXFLOAT diffuse;
+ PEXFLOAT specular;
+ PEXFLOAT specularConc;
+ PEXFLOAT transmission; /* 0.0 = opaque, 1.0 = transparent */
+ pexColourSpecifier specularColour;
+ /* SINGLE COLOUR() */
+} pexReflectionAttr;
+
+typedef struct {
+ pexEnumTypeIndex approxMethod B16;
+ CARD16 unused B16;
+ PEXFLOAT uTolerance;
+ PEXFLOAT vTolerance;
+} pexSurfaceApprox;
+
+
+typedef struct {
+ pexCoord3D point;
+ /* SINGLE OPT_DATA() */
+} pexVertex;
+
+
+typedef struct {
+ pexDeviceCoord minval;
+ pexDeviceCoord maxval;
+ pexSwitch useDrawable;
+ BYTE pad[3];
+} pexViewport;
+
+typedef struct {
+ CARD16 clipFlags B16;
+ CARD16 unused B16;
+ pexNpcSubvolume clipLimits;
+ pexMatrix orientation;
+ pexMatrix mapping;
+} pexViewEntry;
+
+typedef struct {
+ pexTableIndex index B16;
+ CARD16 unused B16;
+ pexViewEntry view;
+} pexViewRep;
+
+/*
+ * typedefs for lookup tables
+ */
+
+typedef struct {
+ CARD16 definableEntries B16;
+ CARD16 numPredefined B16;
+ CARD16 predefinedMin B16;
+ CARD16 predefinedMax B16;
+} pexTableInfo;
+
+typedef struct {
+ pexEnumTypeIndex lineType B16;
+ pexEnumTypeIndex polylineInterp B16;
+ pexCurveApprox curveApprox;
+ PEXFLOAT lineWidth;
+ pexColourSpecifier lineColour;
+ /* SINGLE COLOUR() */
+} pexLineBundleEntry;
+
+typedef struct {
+ pexEnumTypeIndex markerType B16;
+ INT16 unused B16;
+ PEXFLOAT markerScale;
+ pexColourSpecifier markerColour;
+ /* SINGLE COLOUR() */
+} pexMarkerBundleEntry;
+
+typedef struct {
+ CARD16 textFontIndex B16;
+ CARD16 textPrecision B16;
+ PEXFLOAT charExpansion;
+ PEXFLOAT charSpacing;
+ pexColourSpecifier textColour;
+ /* SINGLE COLOUR() */
+} pexTextBundleEntry;
+
+
+/*
+ Note that since an InteriorBundleEntry contains 4 embedded instances of
+ pexColourSpecifier, a variable-sized item, a data structure cannot be
+ defined for it.
+*/
+typedef struct {
+ pexEnumTypeIndex interiorStyle B16;
+ INT16 interiorStyleIndex B16;
+ pexEnumTypeIndex reflectionModel B16;
+ pexEnumTypeIndex surfaceInterp B16;
+ pexEnumTypeIndex bfInteriorStyle B16;
+ INT16 bfInteriorStyleIndex B16;
+ pexEnumTypeIndex bfReflectionModel B16;
+ pexEnumTypeIndex bfSurfaceInterp B16;
+ pexSurfaceApprox surfaceApprox;
+ /* SINGLE pexColourSpecifier surfaceColour */
+ /* SINGLE pexReflectionAttr reflectionAttr */
+ /* SINGLE pexColourSpecifier bfSurfaceColour */
+ /* SINGLE pexReflectionAttr bfReflectionAttr */
+} pexInteriorBundleEntry;
+
+typedef struct {
+ pexSwitch edges;
+ CARD8 unused;
+ pexEnumTypeIndex edgeType B16;
+ PEXFLOAT edgeWidth;
+ pexColourSpecifier edgeColour;
+ /* SINGLE COLOUR() */
+} pexEdgeBundleEntry;
+
+typedef struct {
+ pexColourType colourType B16;
+ CARD16 numx B16;
+ CARD16 numy B16;
+ CARD16 unused B16;
+ /* LISTof Colour(numx, numy) 2D array of colours */
+} pexPatternEntry;
+
+/* a pexColourEntry is just a pexColourSpecifier
+*/
+
+typedef struct {
+ CARD32 numFonts B32;
+ /* LISTof pexFont( numFonts ) */
+} pexTextFontEntry;
+
+/* a pexViewEntry is defined above */
+
+typedef struct {
+ pexEnumTypeIndex lightType B16;
+ INT16 unused B16;
+ pexVector3D direction;
+ pexCoord3D point;
+ PEXFLOAT concentration;
+ PEXFLOAT spreadAngle;
+ PEXFLOAT attenuation1;
+ PEXFLOAT attenuation2;
+ pexColourSpecifier lightColour;
+ /* SINGLE COLOUR() */
+} pexLightEntry;
+
+typedef struct {
+ pexSwitch mode;
+ CARD8 unused;
+ CARD16 unused2 B16;
+ PEXFLOAT frontPlane;
+ PEXFLOAT backPlane;
+ PEXFLOAT frontScaling;
+ PEXFLOAT backScaling;
+ pexColourSpecifier depthCueColour;
+ /* SINGLE COLOUR() */
+} pexDepthCueEntry;
+
+typedef struct {
+ INT16 approxType;
+ INT16 approxModel;
+ CARD16 max1 B16;
+ CARD16 max2 B16;
+ CARD16 max3 B16;
+ CARD8 dither;
+ CARD8 unused;
+ CARD32 mult1 B32;
+ CARD32 mult2 B32;
+ CARD32 mult3 B32;
+ PEXFLOAT weight1;
+ PEXFLOAT weight2;
+ PEXFLOAT weight3;
+ CARD32 basePixel B32;
+} pexColourApproxEntry;
+
+
+/* Font structures */
+
+typedef struct {
+ Atom name B32;
+ CARD32 value B32;
+} pexFontProp;
+
+typedef struct {
+ CARD32 firstGlyph B32;
+ CARD32 lastGlyph B32;
+ CARD32 defaultGlyph B32;
+ pexSwitch allExist;
+ pexSwitch strokeFont;
+ CARD16 unused B16;
+ CARD32 numProps B32;
+ /* LISTof pexFontProp(numProps) */
+} pexFontInfo;
+
+
+/* Text Structures */
+
+typedef struct {
+ INT16 characterSet B16;
+ CARD8 characterSetWidth;
+ CARD8 encodingState;
+ CARD16 unused B16;
+ CARD16 numChars;
+ /* LISTof CHARACTER( numChars ) */
+ /* pad */
+} pexMonoEncoding;
+
+/* CHARACTER is either a CARD8, a CARD16, or a CARD32 */
+
+
+/* Parametric Surface Characteristics types */
+
+/* type 1 None */
+
+/* type 2 Implementation Dependent */
+
+typedef struct {
+ CARD16 placementType B16;
+ CARD16 unused B16;
+ CARD16 numUcurves B16;
+ CARD16 numVcurves B16;
+} pexPSC_IsoparametricCurves; /* type 3 */
+
+typedef struct {
+ pexCoord3D origin;
+ pexVector3D direction;
+ CARD16 numberIntersections B16;
+ CARD16 pad B16;
+ /* LISTof PEXFLOAT( numberIntersections ) */
+} pexPSC_LevelCurves; /* type 4: MC
+ type 5: WC */
+
+/* Pick Device data records */
+
+typedef struct {
+ pexDeviceCoord2D position;
+ PEXFLOAT distance;
+} pexPD_DC_HitBox; /* pick device 1 */
+
+typedef pexNpcSubvolume pexPD_NPC_HitVolume; /* pick device 2 */
+
+
+/* Output Command errors */
+
+typedef struct {
+ CARD8 type; /* 0 */
+ CARD8 errorCode; /* 14 */
+ CARD16 sequenceNumber B16;
+ CARD32 resourceId B32; /* renderer or structure */
+ CARD16 minorCode B16;
+ CARD8 majorCode;
+ CARD8 unused;
+ CARD16 opcode B16; /* opcode of failed output command */
+ CARD16 numCommands B16; /* number successfully done before error */
+ BYTE pad[16];
+} pexOutputCommandError;
+
+
+/* Registered PEX Escapes */
+
+typedef struct {
+ INT16 fpFormat B16;
+ CARD8 unused[2];
+ CARD32 rdr B32; /* renderer ID */
+ /* SINGLE ColourSpecifier() */
+} pexEscapeSetEchoColourData;
+
+#endif /* PEXPROTOSTR_H */
diff --git a/xc/programs/Xserver/PEX5/include/ddpex.h b/xc/programs/Xserver/PEX5/include/ddpex.h
new file mode 100644
index 000000000..bf27937e4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/ddpex.h
@@ -0,0 +1,673 @@
+/* $TOG: ddpex.h /main/14 1998/02/10 12:33:50 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef DDPEX_H
+#define DDPEX_H
+
+#include "X.h"
+#include "PEX.h"
+#include "pixmapstr.h"
+#include "dix.h"
+#include "Xprotostr.h"
+
+/* Basic data types */
+/* Many of the typdefs in this file look like the protocol structures
+ * This is intentional. The protocol structures specify bit fields
+ * and the SI ddpex does not use bit fields. Therefore, ddpex uses its
+ * own data definitions, not the ones used by the protocol.
+ ****************************************************************************
+ * THE SIZE AND ALIGNMENT OF THESE STRUCTURES IS EXPECTED MATCH THE PROTOCOL
+ ****************************************************************************
+ * This is VERY important. Although ddpex does not use bit fields, it does
+ * assume that short ints are 16 bits, int/long ints are 32 bits. Pads and
+ * unused fields have been kept in the ddpex structures so that they match
+ * the protocol structures exactly, allowing type casting and fast copies
+ * between the structures.
+ * ddFLOAT is for server internal floating point representations
+ */
+
+typedef char ddCHAR;
+typedef short ddSHORT;
+typedef long ddLONG;
+typedef float ddFLOAT;
+
+typedef unsigned char ddUCHAR;
+typedef unsigned short ddUSHORT;
+typedef unsigned long ddULONG;
+
+typedef unsigned char *ddPointer;
+typedef unsigned char ddBYTE;
+typedef unsigned char ddBOOL;
+
+/* Let the default font that gets opened up be Monospaced Roman */
+#define DEFAULT_PEX_FONT_NAME "Roman_M"
+
+/* Resource structures passed between dipex and ddpex. Most of the resources
+ * data is kept in dd structures which are opaque to dipex. Info needed by
+ * dipex is kept visible to it in these structures
+ */
+typedef struct {
+ XID id;
+ ddPointer deviceData;
+} ddWKSResource;
+
+typedef struct {
+ XID id;
+ ddUSHORT lutType;
+ ddPointer deviceData;
+} ddLUTResource;
+
+typedef ddWKSResource ddStructResource;
+typedef ddWKSResource ddNSResource;
+typedef ddWKSResource ddFontResource;
+typedef ddWKSResource ddPMResource;
+
+#define GetNSId(HANDLE) HANDLE->id
+
+#define GetLUTId(HANDLE) HANDLE->id
+
+typedef ddWKSResource *diWKSHandle;
+typedef ddLUTResource *diLUTHandle;
+typedef ddStructResource *diStructHandle;
+typedef ddNSResource *diNSHandle;
+typedef ddFontResource *diFontHandle;
+typedef ddPMResource *diPMHandle;
+typedef ddPointer diResourceHandle;
+
+/* PEXprotost.h equivalents */
+
+typedef ddULONG ddBitmask;
+typedef ddUSHORT ddBitmaskShort;
+typedef ddSHORT ddEnumTypeIndex;
+typedef XID ddResourceId;
+typedef ddBYTE ddSwitch;
+typedef ddUSHORT ddTableIndex;
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+} ddVector2D;
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+ ddFLOAT z;
+} ddVector3D;
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+} ddCoord2D;
+
+typedef struct {
+ ddLONG x;
+ ddLONG y;
+} ddCoord2DL;
+
+typedef xPoint ddCoord2DS; /* must be the same type for compiler's sake */
+/* typedef struct { ddSHORT x; ddSHORT y; } ddCoord2DS; */
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+ ddFLOAT z;
+} ddCoord3D;
+
+typedef struct {
+ ddLONG x;
+ ddLONG y;
+ ddLONG z;
+} ddCoord3DL;
+
+typedef struct {
+ ddSHORT x;
+ ddSHORT y;
+ ddSHORT z;
+} ddCoord3DS;
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+ ddFLOAT z;
+ ddFLOAT w;
+} ddCoord4D;
+
+typedef struct {
+ ddSHORT x;
+ ddSHORT y;
+ ddFLOAT z;
+} ddDeviceCoord;
+
+typedef struct {
+ ddSHORT xmin;
+ ddSHORT ymin;
+ ddSHORT xmax;
+ ddSHORT ymax;
+} ddDeviceRect;
+
+typedef struct {
+ ddFLOAT xmin;
+ ddFLOAT ymin;
+ ddFLOAT zmin;
+ ddFLOAT wmin;
+ ddFLOAT xmax;
+ ddFLOAT ymax;
+ ddFLOAT zmax;
+ ddFLOAT wmax;
+} ddListBounds;
+
+typedef struct {
+ ddSHORT approxMethod;
+ ddUSHORT unused;
+ ddFLOAT tolerance;
+} ddCurveApprox;
+
+typedef struct {
+ ddSHORT approxMethod;
+ ddUSHORT unused;
+ ddFLOAT uTolerance;
+ ddFLOAT vTolerance;
+} ddSurfaceApprox;
+
+typedef struct {
+ ddUSHORT vertical;
+ ddUSHORT horizontal;
+} ddTextAlignmentData;
+
+typedef struct {
+ ddDeviceCoord minval;
+ ddDeviceCoord maxval;
+ ddUCHAR useDrawable;
+ ddBYTE pad[3];
+} ddViewport;
+
+typedef struct {
+ ddCoord2DS position;
+ ddFLOAT distance;
+} ddDC_HitBox;
+
+typedef struct {
+ ddCoord3D minval;
+ ddCoord3D maxval;
+} ddNpcSubvolume;
+
+typedef ddNpcSubvolume ddNPC_HitVolume;
+
+typedef struct {
+ ddUSHORT clipFlags;
+ ddUSHORT unused;
+ ddNpcSubvolume clipLimits;
+ ddFLOAT orientation[4][4];
+ ddFLOAT mapping[4][4];
+} ddViewEntry;
+
+typedef struct {
+ ddUSHORT definableEntries;
+ ddUSHORT numPredefined;
+ ddUSHORT predefinedMin;
+ ddUSHORT predefinedMax;
+} ddTableInfo;
+
+
+typedef struct {
+ diStructHandle structure; /* the structure id is replaced with */
+ ddULONG offset; /* the handle */
+} ddElementRef;
+
+typedef struct {
+ ddCoord4D orig_point; /* original PEX ref point */
+ ddCoord4D point;
+ ddVector3D orig_vector; /* original PEX ref vector*/
+ ddVector3D vector; /* normalized vector */
+ ddFLOAT dist; /* Hessian form distance func */
+} ddHalfSpace;
+
+typedef struct {
+ diStructHandle structure; /* the structure id is replaced with the */
+ ddULONG offset; /* handle by diPEX */
+ ddULONG pickid;
+} ddPickPath;
+
+typedef struct {
+ ddULONG sid;
+ ddULONG offset;
+ ddULONG pickid;
+} ddPickElementRef;
+
+typedef struct {
+ ddUSHORT pickType;
+ union {
+ ddDC_HitBox DC_HitBox;
+ ddNPC_HitVolume NPC_HitVolume;
+ } hit_box;
+} ddPickRecord;
+
+typedef struct {
+ ddUSHORT elementType;
+ ddUSHORT length;
+} ddElementInfo;
+
+/* Colour structures */
+typedef struct {
+ ddFLOAT red;
+ ddFLOAT green;
+ ddFLOAT blue;
+} ddRgbFloatColour;
+
+typedef struct {
+ ddFLOAT hue;
+ ddFLOAT saturation;
+ ddFLOAT value;
+} ddHsvColour;
+
+typedef struct {
+ ddFLOAT hue;
+ ddFLOAT lightness;
+ ddFLOAT saturation;
+} ddHlsColour;
+
+typedef struct {
+ ddFLOAT x;
+ ddFLOAT y;
+ ddFLOAT z;
+} ddCieColour;
+
+typedef struct {
+ ddUCHAR red;
+ ddUCHAR green;
+ ddUCHAR blue;
+ ddUCHAR pad;
+} ddRgb8Colour;
+
+typedef struct {
+ ddUSHORT red;
+ ddUSHORT green;
+ ddUSHORT blue;
+ ddUSHORT pad;
+} ddRgb16Colour;
+
+typedef struct {
+ ddUSHORT index;
+ ddUSHORT pad;
+} ddIndexedColour;
+
+typedef struct {
+ ddSHORT colourType;
+ ddSHORT unused;
+ union {
+ ddIndexedColour indexed;
+ ddRgb8Colour rgb8;
+ ddRgb16Colour rgb16;
+ ddRgbFloatColour rgbFloat;
+ ddCieColour cieFloat;
+ ddHlsColour hlsFloat;
+ ddHsvColour hsvFloat;
+ } colour;
+} ddColourSpecifier;
+
+typedef union {
+ ddRgb8Colour rgb8;
+ ddRgb16Colour rgb16;
+ ddRgbFloatColour rgbFloat;
+ ddCieColour cieFloat;
+ ddHlsColour hlsFloat;
+ ddHsvColour hsvFloat;
+} ddDirectColour;
+
+typedef struct {
+ ddFLOAT ambient;
+ ddFLOAT diffuse;
+ ddFLOAT specular;
+ ddFLOAT specularConc;
+ ddFLOAT transmission; /* 0.0 = opaque, 1.0 = transparent */
+ ddColourSpecifier specularColour;
+} ddReflectionAttr;
+
+/* end of PEXprotost.h equivalent structures */
+
+/* error return values */
+typedef int ddpex4rtn;
+typedef int ddpex43rtn;
+typedef int ddpex3rtn;
+typedef int ddpex2rtn;
+typedef int ddpex1rtn;
+
+/* ddBuffer is used to pass variable length data from ddpex to dipex
+ * there is a utility called miBuffRealloc which can be used by either
+ * dipex or ddpex to reallocate space in the buffer.
+ * The buffer itself is just an array of bytes. The beginning of the
+ * buffer is pointed to by pHead. ddpex copies the info into the
+ * buffer beginning at the location pointed to by pBuf. This allows
+ * dipex to control where in the buffer the data is located. dipex
+ * sets pBuf, pHead and bufSize before calling the ddpex procedure.
+ * ddpex copies data into the buffer starting at pBuf and puts the
+ * number of bytes of data copied into dataSize. ddpex does not change
+ * pHead, pBuf, or data Size (pBuf continues pointing to the beginning
+ * of the info ddpex copies to the buffer). ddpex MUST check that the
+ * buffer is large enough to hold the data (macro DD_BUF_TOO_SMALL is
+ * useful for this) and should call miBufRealloc to increase the buffer
+ * size if it's too small. pHead, pBuf and bufSize will be adjusted
+ * for the realloc correctly in that procedure.
+ */
+typedef struct {
+ ddULONG bufSize; /* number of total bytes in buffer */
+ ddULONG dataSize; /* number of bytes used by the new data */
+ ddPointer pBuf; /* pointer to buffer where new data starts */
+ ddPointer pHead; /* pointer to true head of buffer */
+} ddBuffer, *ddBufferPtr;
+
+/* lists of objects are needed in several places in the SI server. The following
+ * data structure are intended to be used for those lists. The enum type defines
+ * what the possible objects in a list are. listofObj defines the list itself.
+ * The list is an array of objects. Procedures for doing operations on these
+ * lists are provided in server/dipex/utilities. Declarations of the procedures and
+ * useful macros are defined in server/include/pexUtils.h.
+ * dipex and ddpex both use these lists. The lists are not intended
+ * to be opaque. dipex and ddpex can use them directly, although we've tried
+ * to use the macros and procedures as much as possible.
+ * More info is given with the procedures.
+ */
+typedef enum {
+ DD_ELEMENT_REF=0,
+ DD_HALF_SPACE=1,
+ DD_PICK_PATH=2,
+ DD_RENDERER=3,
+ DD_WKS=4,
+ DD_NS=5,
+ DD_STRUCT=6,
+ DD_DEVICE_RECT=7,
+ DD_NAME=8,
+ DD_INDEX=9,
+ DD_LIST_OF_LIST=10,
+ DD_NUM_TYPES=11
+} ddListType;
+
+typedef struct {
+ ddListType type;
+ ddLONG numObj;
+ ddLONG misc;
+ ddLONG maxObj;
+ ddPointer pList;
+ /* pList is an array of foos (see ddListType for possible foos)
+ * it is allocated as an array of footypes and reallocated as needed
+ * in multiples of a defined size.
+ * footypes and array sizes are stated explicitely in
+ * server/dipex/dispatch/pexUtils.c
+ * yes, this could be a union, but by using a generic char *,
+ * the list can be handled generically and not have to be
+ * specified differently for each type if it isn't necessary
+ */
+} listofObj;
+
+/* Pipeline Context and Renderer Resource structures: shared by dipex and ddpex */
+
+typedef struct {
+ ddUSHORT placementType;
+ ddUSHORT numUcurves;
+ ddUSHORT numVcurves;
+} ddPSC_IsoparametricCurves;
+
+typedef struct {
+ ddCoord3D origin;
+ ddVector3D direction;
+ ddUSHORT numberIntersections;
+ ddFLOAT *pPoints;
+} ddPSC_LevelCurves;
+
+typedef struct {
+ ddEnumTypeIndex type;
+ union {
+ char none;
+ char impDep;
+ ddPSC_IsoparametricCurves isoCurves;
+ ddPSC_LevelCurves mcLevelCurves;
+ ddPSC_LevelCurves wcLevelCurves;
+ } data;
+} ddPSurfaceChars;
+
+
+typedef struct {
+ ddEnumTypeIndex markerType;
+ ddFLOAT markerScale;
+ ddColourSpecifier markerColour;
+ ddUSHORT markerIndex;
+ ddUSHORT textFont;
+ ddUSHORT textPrecision;
+ ddFLOAT charExpansion;
+ ddFLOAT charSpacing;
+ ddColourSpecifier textColour;
+ ddFLOAT charHeight;
+ ddVector2D charUp;
+ ddUSHORT textPath;
+ ddTextAlignmentData textAlignment;
+ ddFLOAT atextHeight;
+ ddVector2D atextUp;
+ ddUSHORT atextPath;
+ ddTextAlignmentData atextAlignment;
+ ddEnumTypeIndex atextStyle;
+ ddUSHORT textIndex;
+ ddEnumTypeIndex lineType;
+ ddFLOAT lineWidth;
+ ddColourSpecifier lineColour;
+ ddCurveApprox curveApprox;
+ ddEnumTypeIndex lineInterp;
+ ddUSHORT lineIndex;
+ ddEnumTypeIndex intStyle;
+ ddSHORT intStyleIndex;
+ ddColourSpecifier surfaceColour;
+ ddReflectionAttr reflAttr;
+ ddEnumTypeIndex reflModel;
+ ddEnumTypeIndex surfInterp;
+ ddEnumTypeIndex bfIntStyle;
+ ddSHORT bfIntStyleIndex;
+ ddColourSpecifier bfSurfColour;
+ ddReflectionAttr bfReflAttr;
+ ddEnumTypeIndex bfReflModel;
+ ddEnumTypeIndex bfSurfInterp;
+ ddSurfaceApprox surfApprox;
+ ddUSHORT cullMode;
+ ddBOOL distFlag;
+ ddCoord2D patternSize;
+ ddCoord3D patternRefPt;
+ ddVector3D patternRefV1;
+ ddVector3D patternRefV2;
+ ddUSHORT intIndex;
+ ddUSHORT edges;
+ ddEnumTypeIndex edgeType;
+ ddFLOAT edgeWidth;
+ ddColourSpecifier edgeColour;
+ ddUSHORT edgeIndex;
+ ddFLOAT localMat[4][4];
+ ddFLOAT globalMat[4][4];
+ ddUSHORT modelClip;
+ listofObj *modelClipVolume;
+ ddUSHORT viewIndex;
+ listofObj *lightState;
+ ddUSHORT depthCueIndex;
+ ddUSHORT colourApproxIndex;
+ ddSHORT rdrColourModel;
+ ddPSurfaceChars psc;
+ ddULONG asfs;
+ ddULONG pickId;
+ ddULONG hlhsrType;
+ diNSHandle pCurrentNS; /* handle to name set */
+} ddPCAttr;
+
+typedef struct {
+ ddULONG PCid;
+ listofObj *rendRefs;
+ ddPCAttr *pPCAttr;
+} ddPCStr, *ddPCPtr;
+
+/* Output Command Procedure Vector used in renderer */
+/* The index of a procedure is the output command number */
+#define OCTABLE_LENGTH (PEXMaxOC+1)
+#define SEPROC_VECTOR_LENGTH (PEXMaxOC+1)
+
+typedef ddpex2rtn (*ocTableType)();
+
+typedef struct {
+ ddBYTE type; /* drawable type: pixmap, window, undrawable_window? */
+ ddBYTE class;
+ ddBYTE depth;
+ ddBYTE bitsPerPixel;
+ ddBYTE rootDepth;
+ ddULONG rootVisual;
+} ddDrawableInfo;
+
+typedef enum {
+ DD_HIGH_INCL_NS=0,
+ DD_HIGH_EXCL_NS=1,
+ DD_INVIS_INCL_NS=2,
+ DD_INVIS_EXCL_NS=3,
+ DD_PICK_INCL_NS=4,
+ DD_PICK_EXCL_NS=5,
+ DD_MAX_FILTERS=6
+} ddNSFilters;
+
+/* pick state for Renderer picking */
+#define DD_PICK_ONE 1
+#define DD_PICK_ALL 2
+#define DD_SERVER 1
+#define DD_CLIENT 2
+#define DD_NEITHER 3
+
+typedef struct {
+ ddUSHORT state; /* pick state one or all */
+ ddUSHORT server; /* client or server traversal */
+ ddSHORT pick_method;
+ ddBOOL send_event;
+ ddULONG max_hits;
+ ddULONG more_hits;
+ ClientPtr client; /* need to send the event */
+ diStructHandle strHandle; /* struct handle for PickOne */
+ diPMHandle pseudoPM; /* fake PM for Renderer Pick */
+ listofObj *list; /* list of list for pick all */
+ listofObj *fakeStrlist; /* list of fake struct handle for
+ picking */
+ listofObj *sIDlist; /* list of IDs, struct handles and
+ offsets for reverse mapping
+ BeginStructures when picking */
+} ddRdrPickStr, *ddRdrPickPtr; /* need to send the event */
+
+typedef struct {
+ ddULONG rendId; /* renderer id */
+ ddPCPtr pPC; /* pipeline context handle */
+ ddDrawableInfo drawExample; /* info from drawable example */
+ DrawablePtr pDrawable; /* rendering drawable */
+ ddULONG drawableId; /* id of rendering drawable */
+ listofObj *curPath; /* current path */
+ ddUSHORT state; /* renderer state */
+ diLUTHandle lut[PEXMaxTableType+1];/* lookup table handles */
+ diNSHandle ns[DD_MAX_FILTERS];/* name set handles */
+ ddSHORT hlhsrMode; /* you guessed it */
+ ddNpcSubvolume npcSubvolume;
+ ddViewport viewport;
+ listofObj *clipList; /* clip list */
+ /* Begin 5.1 additions */
+ /* pick_inclusion is in ns */
+ /* pick_exclusion is in ns */
+ listofObj *pickStartPath; /* pick start path */
+ ddColourSpecifier backgroundColour;
+ ddBOOL clearI;
+ ddBOOL clearZ;
+ ddUSHORT echoMode;
+ ddColourSpecifier echoColour;
+ /* End 5.1 additions */
+ ddBitmask tablesMask; /* renderer dynamics */
+ ddBitmask namesetsMask; /* renderer dynamics */
+ ddBitmask attrsMask; /* renderer dynamics */
+ ddBitmask tablesChanges; /* changed attributes */
+ ddBitmask namesetsChanges;/* changed attributes */
+ ddBitmask attrsChanges; /* changed attributes */
+ ocTableType executeOCs[OCTABLE_LENGTH];
+ ddBOOL immediateMode;
+ ddUSHORT render_mode;
+ ddPointer pDDContext; /* device dependent attribute context */
+ ddRdrPickStr pickstr;
+} ddRendererStr, *ddRendererPtr;
+
+typedef struct {
+ ddULONG numElRefs; /* number of element refs */
+ listofObj *Path; /* path */
+} ddAccStStr, *ddAccStPtr;
+
+/* render_mode values */
+#define MI_REND_DRAWING 0
+#define MI_REND_PICKING 1
+#define MI_REND_SEARCHING 2
+
+ /* enum type for specifying resources */
+typedef enum {
+ WORKSTATION_RESOURCE=0,
+ STRUCTURE_RESOURCE=1,
+ PARENT_STRUCTURE_RESOURCE=2,
+ CHILD_STRUCTURE_RESOURCE=3,
+ SEARCH_CONTEXT_RESOURCE=4,
+ PICK_RESOURCE=5,
+ LOOKUP_TABLE_RESOURCE=6,
+ NAME_SET_RESOURCE=7,
+ FONT_RESOURCE=8,
+ RENDERER_RESOURCE=9,
+ PIPELINE_CONTEXT_RESOURCE=10
+} ddResourceType;
+
+typedef enum {
+ ADD=0,
+ REMOVE=1
+} ddAction;
+
+typedef enum {
+ X_WINDOW_RESOURCE=0,
+ X_DRAWABLE_RESOURCE=1,
+ X_FONT_RESOURCE=2,
+ X_PIXMAP_RESOURCE=3,
+ X_CURSOR_RESOURCE=4,
+ X_COLORMAP_RESOURCE=5,
+ X_GCONTEXT_RESOURCE=6,
+ X_KEYSYM=7
+} ddXResourceType;
+
+#endif /* DDPEX_H */
diff --git a/xc/programs/Xserver/PEX5/include/ddpex3.h b/xc/programs/Xserver/PEX5/include/ddpex3.h
new file mode 100644
index 000000000..75be61185
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/ddpex3.h
@@ -0,0 +1,1096 @@
+/* $TOG: ddpex3.h /main/3 1998/02/10 12:33:55 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "ddpex.h"
+
+#ifndef DDPEX3_H
+#define DDPEX3_H
+
+/* just a reminder of what colours there are
+ IndexedColour
+ Rgb8Colour
+ Rgb16Colour
+ RgbFloatColour
+ HsvColour
+ HlsColour
+ CieColour
+*/
+
+/* First, some basic point type definitions */
+/* #define DDPT_FLOAT (0<<0) */
+#define DDPT_SHORT (1<<0)
+#define DDPT_2D (1<<1)
+#define DDPT_3D (2<<1)
+#define DDPT_4D (3<<1)
+#define DDPT_NORMAL (1<<3)
+#define DDPT_EDGE (1<<4)
+#define DDPT_COLOUR (7<<5)
+#define DDPT_INDEXEDCOLOUR (1<<5)
+#define DDPT_RGB8COLOUR (2<<5)
+#define DDPT_RGB16COLOUR (3<<5)
+#define DDPT_RGBFLOATCOLOUR (4<<5)
+#define DDPT_HSVCOLOUR (5<<5)
+#define DDPT_HLSCOLOUR (6<<5)
+#define DDPT_CIECOLOUR (7<<5)
+
+/*
+ * Now, some access macros
+ * It is strongly recommended that these macros be used instead
+ * of accessing the fields directly.
+ */
+#define DD_IsVertFloat(type) (!((type) & DDPT_SHORT))
+#define DD_IsVertShort(type) ((type) & DDPT_SHORT)
+#define DD_IsVert2D(type) (((type) & DDPT_4D) == DDPT_2D)
+#define DD_IsVert3D(type) (((type) & DDPT_4D) == DDPT_3D)
+#define DD_IsVert4D(type) (((type) & DDPT_4D) == DDPT_4D)
+#define DD_IsVertNormal(type) ((type) & DDPT_NORMAL)
+#define DD_IsVertEdge(type) ((type) & DDPT_EDGE)
+#define DD_IsVertColour(type) ((type) & DDPT_COLOUR)
+#define DD_IsVertIndexed(type) (((type) & DDPT_COLOUR) == DDPT_INDEXEDCOLOUR)
+#define DD_IsVertRGB8(type) (((type) & DDPT_COLOUR) == DDPT_RGB8COLOUR)
+#define DD_IsVertRGB16(type) (((type) & DDPT_COLOUR) == DDPT_RGB16COLOUR)
+#define DD_IsVertRGBFLOAT(type) (((type)&DDPT_COLOUR) == DDPT_RGBFLOATCOLOUR)
+#define DD_IsVertHSV(type) (((type) & DDPT_COLOUR) == DDPT_HSVCOLOUR)
+#define DD_IsVertHLS(type) (((type) & DDPT_COLOUR) == DDPT_HLSCOLOUR)
+#define DD_IsVertCIE(type) (((type) & DDPT_COLOUR) == DDPT_CIECOLOUR)
+
+#define DD_IsVertCoordsOnly(type) \
+ !((type & DDPT_COLOUR) || (type & DDPT_EDGE) || (type & DDPT_NORMAL))
+
+/*
+ * These macros are used to change a vertex type
+ */
+#define DD_SetVertFloat(type) ((type) &= ~DDPT_SHORT)
+#define DD_SetVertShort(type) ((type) |= DDPT_SHORT)
+#define DD_SetVert2D(type) ((type) = (((type) & ~DDPT_4D) | DDPT_2D))
+#define DD_SetVert3D(type) ((type) = (((type) & ~DDPT_4D) | DDPT_3D))
+#define DD_SetVert4D(type) ((type) = (((type) & ~DDPT_4D) | DDPT_4D))
+#define DD_SetVertNormal(type) ((type) |= DDPT_NORMAL)
+#define DD_SetVertEdge(type) ((type) |= DDPT_EDGE)
+#define DD_SetVertIndexed(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_INDEXEDCOLOUR))
+#define DD_SetVertRGB8(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGB8COLOUR))
+#define DD_SetVertRGB16(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGB16COLOUR))
+#define DD_SetVertRGBFLOAT(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_RGBFLOATCOLOUR))
+#define DD_SetVertHSV(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_HSVCOLOUR))
+#define DD_SetVertHLS(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_HLSCOLOUR))
+#define DD_SetVertCIE(type) ((type)=(((type) & ~DDPT_COLOUR) | DDPT_CIECOLOUR))
+
+#define DD_UnSetVertFloat(type) ((type) |= DDPT_SHORT)
+#define DD_UnSetVertShort(type) ((type) &= ~DDPT_SHORT)
+#define DD_UnSetVert2D(type) ((type) &= ~DDPT_4D)
+#define DD_UnSetVert3D(type) ((type) &= ~DDPT_4D)
+#define DD_UnSetVert4D(type) ((type) &= ~DDPT_4D)
+#define DD_UnSetVertCoord(type) ((type) &= ~(DDPT_4D | DDPT_SHORT))
+#define DD_UnSetVertNormal(type) ((type) &= ~DDPT_NORMAL)
+#define DD_UnSetVertEdge(type) ((type) &= ~DDPT_EDGE)
+#define DD_UnSetColour(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertIndexed(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertRGB8(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertRGB16(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertRGBFLOAT(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertHSV(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertHLS(type) ((type) &= ~DDPT_COLOUR)
+#define DD_UnSetVertCIE(type) ((type) &= ~DDPT_COLOUR)
+
+
+/*
+ * A macro to compute the point size - very usefull when
+ * walking through a list of points and one isn't concerned
+ * about the actual details of the point data
+ */
+#define DD_VertPointSize(type, size) \
+ { \
+ if (DD_IsVertFloat(type)) { \
+ if (DD_IsVert2D(type)) size = sizeof(ddCoord2D); \
+ else if (DD_IsVert3D(type)) size = sizeof(ddCoord3D); \
+ else size = sizeof(ddCoord4D); \
+ } else { \
+ if (DD_IsVert2D(type)) size = sizeof(ddCoord2DS); \
+ else size = sizeof(ddCoord3DS); \
+ } \
+ if (DD_IsVertNormal(type)) size += sizeof(ddVector3D); \
+ if (DD_IsVertColour(type)) { \
+ if (DD_IsVertIndexed(type)) size += sizeof(ddIndexedColour); \
+ else if (DD_IsVertRGB8(type)) size += sizeof(ddRgb8Colour); \
+ else if (DD_IsVertRGB16(type)) size += sizeof(ddRgb16Colour); \
+ else size += sizeof(ddRgbFloatColour); \
+ } \
+ if (DD_IsVertEdge(type)) size += sizeof(ddULONG); \
+ }
+/*
+ * The following macros find offets from the start
+ * of a structure in bytes to the desired vertex component.
+ * again, very usefull macros for routines that wish
+ * to access individual vertex components without necessarily
+ * knowing all the details of the vertex. Offset is set to -1
+ * if the component does not exist in the vertex.
+ */
+
+/*
+ * Note that the color is always the first component following
+ * the vertex data.
+ */
+#define DD_VertOffsetColor(type, offset) \
+ { \
+ if (!DD_IsVertColour((type))) (offset) = -1; \
+ else \
+ DD_VertPointSize(((type) & (DDPT_4D | DDPT_SHORT)),(offset));\
+ }
+
+/*
+ * Note that the edge flag is always the last component in
+ * a vertex. Thus the offset is the size of the point minus
+ * the size of the edge field (a ddULONG).
+ */
+#define DD_VertOffsetEdge(type, offset) \
+ { \
+ if (!DD_IsVertEdge((type))) (offset) = -1; \
+ else { \
+ DD_VertPointSize((type), (offset)); \
+ (offset) -= sizeof(ddULONG); \
+ } \
+ }
+
+/*
+ * This one is the most complex as the normal is last unless
+ * there is an edge in which case it preceeds the edge flag.
+ */
+#define DD_VertOffsetNormal(type, offset) \
+ { \
+ if (!DD_IsVertNormal((type))) (offset) = -1; \
+ else { \
+ DD_VertPointSize((type), (offset)); \
+ if (DD_IsVertEdge((type))) (offset) -= sizeof(ddULONG); \
+ (offset) -= sizeof(ddVector3D); \
+ } \
+ }
+
+/* Now create the point types */
+#define DD_2DS_POINT (DDPT_SHORT | DDPT_2D)
+#define DD_2D_POINT (DDPT_2D)
+#define DD_3DS_POINT (DDPT_SHORT | DDPT_3D)
+#define DD_3D_POINT (DDPT_3D)
+#define DD_INDEX_POINT (DDPT_3D | DDPT_INDEXEDCOLOUR)
+#define DD_INDEX_POINT4D (DDPT_4D | DDPT_INDEXEDCOLOUR)
+#define DD_RGB8_POINT (DDPT_3D | DDPT_RGB8COLOUR)
+#define DD_RGB8_POINT4D (DDPT_4D | DDPT_RGB8COLOUR)
+#define DD_RGB16_POINT (DDPT_3D | DDPT_RGB16COLOUR)
+#define DD_RGB16_POINT4D (DDPT_4D | DDPT_RGB16COLOUR)
+#define DD_RGBFLOAT_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_POINT (DDPT_3D | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_POINT4D (DDPT_4D | DDPT_RGBFLOATCOLOUR)
+#define DD_HSV_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_HSVCOLOUR)
+#define DD_HSV_POINT (DDPT_3D | DDPT_HSVCOLOUR)
+#define DD_HSV_POINT4D (DDPT_4D | DDPT_HSVCOLOUR)
+#define DD_HLS_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_HLSCOLOUR)
+#define DD_HLS_POINT (DDPT_3D | DDPT_HLSCOLOUR)
+#define DD_HLS_POINT4D (DDPT_4D | DDPT_HLSCOLOUR)
+#define DD_CIE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_CIECOLOUR)
+#define DD_CIE_POINT (DDPT_3D | DDPT_CIECOLOUR)
+#define DD_CIE_POINT4D (DDPT_4D | DDPT_CIECOLOUR)
+#define DD_NORM_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL)
+#define DD_NORM_POINT (DDPT_3D | DDPT_NORMAL)
+#define DD_NORM_POINT4D (DDPT_4D | DDPT_NORMAL)
+#define DD_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_EDGE)
+#define DD_EDGE_POINT (DDPT_3D | DDPT_EDGE)
+#define DD_EDGE_POINT4D (DDPT_4D | DDPT_EDGE)
+#define DD_INDEX_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_INDEXEDCOLOUR)
+#define DD_INDEX_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_INDEXEDCOLOUR)
+#define DD_RGB8_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_RGB8COLOUR)
+#define DD_RGB8_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_RGB8COLOUR)
+#define DD_RGB16_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_RGB16COLOUR)
+#define DD_RGB16_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_RGB16COLOUR)
+#define DD_RGBFLOAT_NORM_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_RGBFLOATCOLOUR)
+#define DD_HSV_NORM_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_HSVCOLOUR)
+#define DD_HSV_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_HSVCOLOUR)
+#define DD_HSV_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_HSVCOLOUR)
+#define DD_HLS_NORM_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_HLSCOLOUR)
+#define DD_HLS_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_HLSCOLOUR)
+#define DD_HLS_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_HLSCOLOUR)
+#define DD_CIE_NORM_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_CIECOLOUR)
+#define DD_CIE_NORM_POINT (DDPT_3D | DDPT_NORMAL | DDPT_CIECOLOUR)
+#define DD_CIE_NORM_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_CIECOLOUR)
+#define DD_INDEX_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
+#define DD_INDEX_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
+#define DD_RGB8_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_RGB8COLOUR)
+#define DD_RGB8_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_RGB8COLOUR)
+#define DD_RGB16_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_RGB16COLOUR)
+#define DD_RGB16_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_RGB16COLOUR)
+#define DD_RGBFLOAT_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_HSV_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HSV_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HSV_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HLS_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_HLS_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_HLS_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_CIE_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_CIE_EDGE_POINT (DDPT_3D | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_CIE_EDGE_POINT4D (DDPT_4D | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_NORM_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE )
+#define DD_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE )
+#define DD_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE )
+#define DD_INDEX_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
+#define DD_INDEX_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_INDEXEDCOLOUR)
+#define DD_RGB8_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB8COLOUR)
+#define DD_RGB8_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB8COLOUR)
+#define DD_RGB16_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB16COLOUR)
+#define DD_RGB16_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGB16COLOUR)
+#define DD_RGBFLOAT_NORM_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_RGBFLOAT_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_RGBFLOATCOLOUR)
+#define DD_HSV_NORM_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HSV_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HSV_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_HSVCOLOUR)
+#define DD_HLS_NORM_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_HLS_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_HLS_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_HLSCOLOUR)
+#define DD_CIE_NORM_EDGE_POINT2DS (DDPT_SHORT | DDPT_2D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_CIE_NORM_EDGE_POINT (DDPT_3D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_CIE_NORM_EDGE_POINT4D (DDPT_4D | DDPT_NORMAL | DDPT_EDGE | DDPT_CIECOLOUR)
+#define DD_HOMOGENOUS_POINT (DDPT_4D)
+
+typedef ddUSHORT ddPointType;
+
+/*
+ * The point types correspond to the point types in the PEX protocol
+ */
+typedef struct {
+ ddCoord3D pt;
+ ddIndexedColour colour;
+} ddIndexPoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb8Colour colour;
+} ddRgb8Point;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb16Colour colour;
+} ddRgb16Point;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddRgbFloatColour colour;
+} ddRgbFloatPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgbFloatColour colour;
+} ddRgbFloatPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHsvColour colour;
+} ddHsvPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHsvColour colour;
+} ddHsvPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHlsColour colour;
+} ddHlsPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHlsColour colour;
+} ddHlsPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddCieColour colour;
+} ddCiePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddCieColour colour;
+} ddCiePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddVector3D normal;
+} ddNormalPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddVector3D normal;
+} ddNormalPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddULONG edge;
+} ddEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddULONG edge;
+} ddEdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddIndexedColour colour;
+ ddVector3D normal;
+} ddIndexNormalPoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb8Colour colour;
+ ddVector3D normal;
+} ddRgb8NormalPoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb16Colour colour;
+ ddVector3D normal;
+} ddRgb16NormalPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+} ddRgbFloatNormalPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+} ddRgbFloatNormalPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+} ddHsvNormalPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+} ddHsvNormalPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+} ddHlsNormalPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+} ddHlsNormalPoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddCieColour colour;
+ ddVector3D normal;
+} ddCieNormalPoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddCieColour colour;
+ ddVector3D normal;
+} ddCieNormalPoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddIndexedColour colour;
+ ddULONG edge;
+} ddIndexEdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb8Colour colour;
+ ddULONG edge;
+} ddRgb8EdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb16Colour colour;
+ ddULONG edge;
+} ddRgb16EdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddRgbFloatColour colour;
+ ddULONG edge;
+} ddRgbFloatEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgbFloatColour colour;
+ ddULONG edge;
+} ddRgbFloatEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHsvColour colour;
+ ddULONG edge;
+} ddHsvEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHsvColour colour;
+ ddULONG edge;
+} ddHsvEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHlsColour colour;
+ ddULONG edge;
+} ddHlsEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHlsColour colour;
+ ddULONG edge;
+} ddHlsEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddCieColour colour;
+ ddULONG edge;
+} ddCieEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddCieColour colour;
+ ddULONG edge;
+} ddCieEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddVector3D normal;
+ ddULONG edge;
+} ddNormEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddVector3D normal;
+ ddULONG edge;
+} ddNormEdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddIndexedColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddIndexNormEdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb8Colour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgb8NormEdgePoint;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgb16Colour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgb16NormEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgbFloatNormEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgbFloatNormEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHsvNormEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHsvNormEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHlsNormEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHlsNormEdgePoint;
+
+typedef struct {
+ ddCoord2DS pt;
+ ddCieColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddCieNormEdgePoint2DS;
+
+typedef struct {
+ ddCoord3D pt;
+ ddCieColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddCieNormEdgePoint;
+
+/*
+ * The point types are internal point types only.
+ */
+
+typedef struct {
+ ddCoord4D pt;
+ ddIndexedColour colour;
+} ddIndexPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb8Colour colour;
+} ddRgb8Point4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb16Colour colour;
+} ddRgb16Point4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgbFloatColour colour;
+} ddRgbFloatPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHsvColour colour;
+} ddHsvPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHlsColour colour;
+} ddHlsPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddCieColour colour;
+} ddCiePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddVector3D normal;
+} ddNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddULONG edge;
+} ddEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddIndexedColour colour;
+ ddVector3D normal;
+} ddIndexNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb8Colour colour;
+ ddVector3D normal;
+} ddRgb8NormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb16Colour colour;
+ ddVector3D normal;
+} ddRgb16NormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+} ddRgbFloatNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+} ddHsvNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+} ddHlsNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddCieColour colour;
+ ddVector3D normal;
+} ddCieNormalPoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddIndexedColour colour;
+ ddULONG edge;
+} ddIndexEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb8Colour colour;
+ ddULONG edge;
+} ddRgb8EdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb16Colour colour;
+ ddULONG edge;
+} ddRgb16EdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgbFloatColour colour;
+ ddULONG edge;
+} ddRgbFloatEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHsvColour colour;
+ ddULONG edge;
+} ddHsvEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHlsColour colour;
+ ddULONG edge;
+} ddHlsEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddCieColour colour;
+ ddULONG edge;
+} ddCieEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddVector3D normal;
+ ddULONG edge;
+} ddNormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddIndexedColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddIndexNormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb8Colour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgb8NormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgb16Colour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgb16NormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddRgbFloatNormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHsvColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHsvNormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddHlsColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddHlsNormEdgePoint4D;
+
+typedef struct {
+ ddCoord4D pt;
+ ddCieColour colour;
+ ddVector3D normal;
+ ddULONG edge;
+} ddCieNormEdgePoint4D;
+
+typedef union {
+ ddCoord2D *p2Dpt;
+ ddCoord3D *p3Dpt;
+ ddCoord2DL *p2DLpt;
+ ddCoord3DL *p3DLpt;
+ ddCoord2DS *p2DSpt;
+ ddCoord3DS *p3DSpt;
+ ddIndexedColour *pIndexClr;
+ ddRgb8Colour *pRgb8Clr;
+ ddRgb16Colour *pRgb16Clr;
+ ddRgbFloatColour *pRgbFloatClr;
+ ddHsvColour *pHsvClr;
+ ddHlsColour *pHlsClr;
+ ddCieColour *pCieClr;
+ ddIndexPoint *pIndexpt;
+ ddRgb8Point *pRgb8pt;
+ ddRgb16Point *pRgb16pt;
+ ddRgbFloatPoint *pRgbFloatpt;
+ ddHsvPoint *pHsvpt;
+ ddHlsPoint *pHlspt;
+ ddCiePoint *pCiept;
+ ddVector3D *pNormal;
+ ddNormalPoint *pNpt;
+ ddULONG *pEdge;
+ ddEdgePoint *pEpt;
+ ddIndexNormalPoint *pIndexNpt;
+ ddRgb8NormalPoint *pRgb8Npt;
+ ddRgb16NormalPoint *pRgb16Npt;
+ ddRgbFloatNormalPoint *pRgbFloatNpt;
+ ddHsvNormalPoint *pHsvNpt;
+ ddHlsNormalPoint *pHlsNpt;
+ ddCieNormalPoint *pCieNpt;
+ ddIndexEdgePoint *pIndexEpt;
+ ddRgb8EdgePoint *pRgb8Ept;
+ ddRgb16EdgePoint *pRgb16Ept;
+ ddRgbFloatEdgePoint *pRgbFloatEpt;
+ ddHsvEdgePoint *pHsvEpt;
+ ddHlsEdgePoint *pHlsEpt;
+ ddCieEdgePoint *pCieEpt;
+ ddNormEdgePoint *pNEpt;
+ ddIndexNormEdgePoint *pIndexNEpt;
+ ddRgb8NormEdgePoint *pRgb8NEpt;
+ ddRgb16NormEdgePoint *pRgb16NEpt;
+ ddRgbFloatNormEdgePoint *pRgbFloatNEpt;
+ ddHsvNormEdgePoint *pHsvNEpt;
+ ddHlsNormEdgePoint *pHlsNEpt;
+ ddCieNormEdgePoint *pCieNEpt;
+ ddCoord4D *p4Dpt;
+ ddIndexPoint4D *pIndexpt4D;
+ ddRgb8Point4D *pRgb8pt4D;
+ ddRgb16Point4D *pRgb16pt4D;
+ ddRgbFloatPoint4D *pRgbFloatpt4D;
+ ddHsvPoint4D *pHsvpt4D;
+ ddHlsPoint4D *pHlspt4D;
+ ddCiePoint4D *pCiept4D;
+ ddNormalPoint4D *pNpt4D;
+ ddEdgePoint4D *pEpt4D;
+ ddIndexNormalPoint4D *pIndexNpt4D;
+ ddRgb8NormalPoint4D *pRgb8Npt4D;
+ ddRgb16NormalPoint4D *pRgb16Npt4D;
+ ddRgbFloatNormalPoint4D *pRgbFloatNpt4D;
+ ddHsvNormalPoint4D *pHsvNpt4D;
+ ddHlsNormalPoint4D *pHlsNpt4D;
+ ddCieNormalPoint4D *pCieNpt4D;
+ ddIndexEdgePoint4D *pIndexEpt4D;
+ ddRgb8EdgePoint4D *pRgb8Ept4D;
+ ddRgb16EdgePoint4D *pRgb16Ept4D;
+ ddRgbFloatEdgePoint4D *pRgbFloatEpt4D;
+ ddHsvEdgePoint4D *pHsvEpt4D;
+ ddHlsEdgePoint4D *pHlsEpt4D;
+ ddCieEdgePoint4D *pCieEpt4D;
+ ddNormEdgePoint4D *pNEpt4D;
+ ddIndexNormEdgePoint4D *pIndexNEpt4D;
+ ddRgb8NormEdgePoint4D *pRgb8NEpt4D;
+ ddRgb16NormEdgePoint4D *pRgb16NEpt4D;
+ ddRgbFloatNormEdgePoint4D *pRgbFloatNEpt4D;
+ ddHsvNormEdgePoint4D *pHsvNEpt4D;
+ ddHlsNormEdgePoint4D *pHlsNEpt4D;
+ ddCieNormEdgePoint4D *pCieNEpt4D;
+ char *ptr;
+} ddPointUnion;
+
+/*
+ * Last - create a point header data structure
+ *
+ * Note: any changes to this structure MUST also be
+ * made to the MarkerlistofddPoint structure below.
+ */
+typedef struct {
+ ddULONG numPoints; /* number of vertices in list */
+ ddULONG maxData; /* allocated data in bytes */
+ ddPointUnion pts; /* pointer to vertex data */
+} listofddPoint;
+
+/*
+ * Create a parallel structure to listofddPoint for
+ * pre-initializing Markers. Note that the listofddPoint
+ * structure and the MarkerlistofddPoint structure MUST always
+ * match with the exception of the union elememt.
+ */
+typedef struct {
+ ddULONG numPoints; /* number of vertices in list */
+ ddULONG maxData; /* allocated data in bytes */
+ ddCoord2D *pts;
+} MarkerlistofddPoint;
+
+typedef struct {
+ ddUSHORT order;
+ ddFLOAT uMin;
+ ddFLOAT uMax;
+ ddULONG numKnots;
+ ddFLOAT *pKnots;
+ listofddPoint points;
+} ddNurbCurve;
+
+typedef enum {
+ DD_FACET_NONE=0, /* no facet attributes */
+ DD_FACET_INDEX=1, /* facet colour */
+ DD_FACET_RGB8=2, /* facet colour */
+ DD_FACET_RGB16=3, /* facet colour */
+ DD_FACET_RGBFLOAT=4, /* facet colour */
+ DD_FACET_HSV=5, /* facet colour */
+ DD_FACET_HLS=6, /* facet colour */
+ DD_FACET_CIE=7, /* facet colour */
+ DD_FACET_NORM=8, /* facet normal */
+ DD_FACET_INDEX_NORM=9, /* facet colour & normal */
+ DD_FACET_RGB8_NORM=10, /* facet colour & normal */
+ DD_FACET_RGB16_NORM=11, /* facet colour & normal */
+ DD_FACET_RGBFLOAT_NORM=12, /* facet colour & normal */
+ DD_FACET_HSV_NORM=13, /* facet colour & normal */
+ DD_FACET_HLS_NORM=14, /* facet colour & normal */
+ DD_FACET_CIE_NORM=15 /* facet colour & normal */
+} ddFacetType;
+
+/*
+ * A useful macro to determine the size of a facet
+ *
+ */
+#define DDFacetSIZE(type, size) \
+ switch((type)){ \
+ case(DD_FACET_NONE): (size) = 0; \
+ break; \
+ case(DD_FACET_INDEX): (size) = sizeof(ddIndexedColour); \
+ break; \
+ case(DD_FACET_RGB8): (size) = sizeof(ddRgb8Colour); \
+ break; \
+ case(DD_FACET_RGB16): (size) = sizeof(ddRgb16Colour); \
+ break; \
+ case(DD_FACET_RGBFLOAT): (size) = sizeof(ddRgbFloatColour); \
+ break; \
+ case(DD_FACET_HSV): (size) = sizeof(ddHsvColour); \
+ break; \
+ case(DD_FACET_HLS): (size) = sizeof(ddHlsColour); \
+ break; \
+ case(DD_FACET_CIE): (size) = sizeof(ddCieColour); \
+ break; \
+ case(DD_FACET_NORM): (size) = sizeof(ddVector3D); \
+ break; \
+ case(DD_FACET_INDEX_NORM): (size) = sizeof(ddIndexNormal); \
+ break; \
+ case(DD_FACET_RGB8_NORM): (size) = sizeof(ddRgb8Normal); \
+ break; \
+ case(DD_FACET_RGB16_NORM): (size) = sizeof(ddRgb16Normal); \
+ break; \
+ case(DD_FACET_RGBFLOAT_NORM): (size) = sizeof(ddRgbFloatNormal);\
+ break; \
+ case(DD_FACET_HSV_NORM): (size) = sizeof(ddHsvNormal); \
+ break; \
+ case(DD_FACET_HLS_NORM): (size) = sizeof(ddHlsNormal); \
+ break; \
+ case(DD_FACET_CIE_NORM): (size) = sizeof(ddCieNormal); \
+ break; \
+ default: (size) = -1; \
+ }
+
+/*
+ * more facet macros for determining type.
+ */
+#define DD_IsFacetNormal(type) \
+((((int)type)>=((int)DD_FACET_NORM))&&(((int)type)<=((int)DD_FACET_CIE_NORM)))
+#define DD_IsFacetColour(type) \
+( ((type) != DD_FACET_NONE) && ((type) != DD_FACET_NORM) )
+
+typedef struct {
+ ddIndexedColour colour;
+ ddVector3D normal;
+} ddIndexNormal;
+
+typedef struct {
+ ddRgb8Colour colour;
+ ddVector3D normal;
+} ddRgb8Normal;
+
+typedef struct {
+ ddRgb16Colour colour;
+ ddVector3D normal;
+} ddRgb16Normal;
+
+typedef struct {
+ ddRgbFloatColour colour;
+ ddVector3D normal;
+} ddRgbFloatNormal;
+
+typedef struct {
+ ddHsvColour colour;
+ ddVector3D normal;
+} ddHsvNormal;
+
+typedef struct {
+ ddHlsColour colour;
+ ddVector3D normal;
+} ddHlsNormal;
+
+typedef struct {
+ ddCieColour colour;
+ ddVector3D normal;
+} ddCieNormal;
+
+typedef union {
+ ddPointer pNoFacet;
+ ddIndexedColour *pFacetIndex;
+ ddRgb8Colour *pFacetRgb8;
+ ddRgb16Colour *pFacetRgb16;
+ ddRgbFloatColour *pFacetRgbFloat;
+ ddHsvColour *pFacetHsv;
+ ddHlsColour *pFacetHls;
+ ddCieColour *pFacetCie;
+ ddVector3D *pFacetN;
+ ddIndexNormal *pFacetIndexN;
+ ddRgb8Normal *pFacetRgb8N;
+ ddRgb16Normal *pFacetRgb16N;
+ ddRgbFloatNormal *pFacetRgbFloatN;
+ ddHsvNormal *pFacetHsvN;
+ ddHlsNormal *pFacetHlsN;
+ ddCieNormal *pFacetCieN;
+} ddFacetUnion;
+
+typedef struct {
+ ddFacetType type;
+ ddULONG numFacets; /* number of facets in list */
+ ddULONG maxData; /* allocated data in bytes */
+ ddFacetUnion facets; /* Pointer to facet data */
+} listofddFacet;
+
+typedef enum {
+ DD_VERTEX=0,
+ DD_VERTEX_EDGE=1
+} ddVertIndexType;
+
+typedef struct {
+ ddUSHORT index;
+ ddULONG edge;
+} ddVertIndexEdge;
+
+typedef struct {
+ ddVertIndexType type;
+ ddULONG numIndex;
+ union {
+ ddUSHORT *pVertIndex;
+ ddVertIndexEdge *pVertIndexE;
+ } index;
+} listofddIndex;
+
+typedef struct {
+ ddUSHORT uOrder;
+ ddUSHORT vOrder;
+ ddFLOAT uMin;
+ ddFLOAT uMax;
+ ddFLOAT vMin;
+ ddFLOAT vMax;
+ ddFLOAT mpts;
+ ddFLOAT npts;
+ ddULONG numUKnots;
+ ddFLOAT *pUKnot;
+ ddULONG numVKnots;
+ ddFLOAT *pVKnot;
+ listofddPoint points;
+} ddNurbSurface;
+
+typedef struct {
+ ddBYTE visibility;
+ ddUSHORT order;
+ ddCurveApprox curveApprox;
+ ddFLOAT uMin;
+ ddFLOAT uMax;
+ ddULONG numKnots;
+ ddFLOAT *pKnots;
+ ddPointType pttype;
+ listofddPoint points;
+} ddTrimCurve;
+
+typedef struct {
+ ddULONG count;
+ ddTrimCurve *pTC;
+} listofTrimCurve;
+
+/* for cell arrays */
+typedef struct {
+ ddSHORT colourType;
+ union {
+ ddIndexedColour *pIndex;
+ ddRgb8Colour *pRgb8;
+ ddRgb16Colour *pRgb16;
+ ddRgbFloatColour *pRgbFloat;
+ ddHsvColour *pHsv;
+ ddHlsColour *pHls;
+ ddCieColour *pCie;
+ } colour;
+} listofColour;
+
+#endif /* DDPEX3_H */
diff --git a/xc/programs/Xserver/PEX5/include/ddpex4.h b/xc/programs/Xserver/PEX5/include/ddpex4.h
new file mode 100644
index 000000000..5d8cb2b44
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/ddpex4.h
@@ -0,0 +1,150 @@
+/* $TOG: ddpex4.h /main/3 1998/02/10 12:34:00 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Sun Microsystems,
+and The Open Group, not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "ddpex.h"
+
+#ifndef DDPEX4_H
+#define DDPEX4_H
+
+/* structures for ddPEX Level 4 Workstation Support */
+
+typedef struct {
+ DrawablePtr pDrawable;
+ Drawable drawableId;
+ diLUTHandle pMarkerLUT; /* handles to LUTs and NS */
+ diLUTHandle pTextLUT;
+ diLUTHandle pLineLUT;
+ diLUTHandle pIntLUT;
+ diLUTHandle pEdgeLUT;
+ diLUTHandle pColourLUT;
+ diLUTHandle pDepthCueLUT;
+ diLUTHandle pLightLUT;
+ diLUTHandle pColourAppLUT;
+ diLUTHandle pPatternLUT;
+ diLUTHandle pFontLUT;
+ diNSHandle pHighInclSet;
+ diNSHandle pHighExclSet;
+ diNSHandle pInvisInclSet;
+ diNSHandle pInvisExclSet;
+ ddEnumTypeIndex bufferMode;
+} ddWksInit;
+
+typedef struct {
+ ddBYTE viewRep;
+ ddBYTE markerBundle;
+ ddBYTE textBundle;
+ ddBYTE lineBundle;
+ ddBYTE interiorBundle;
+ ddBYTE edgeBundle;
+ ddBYTE colourTable;
+ ddBYTE patternTable;
+ ddBYTE wksTransform;
+ ddBYTE highlightFilter;
+ ddBYTE invisFilter;
+ ddBYTE hlhsrMode;
+ ddBYTE strModify;
+ ddBYTE postStr;
+ ddBYTE unpostStr;
+ ddBYTE deleteStr;
+ ddBYTE refModify;
+ ddBYTE bufferModify;
+ ddBYTE lightTable;
+ ddBYTE depthCueTable;
+ ddBYTE colourApproxTable;
+} ddWksDynamics;
+
+typedef struct {
+ diNSHandle incl;
+ diNSHandle excl;
+} ddNSPair;
+
+typedef struct {
+ ddULONG numPairs;
+ ddULONG maxPairs;
+ ddNSPair *pPairs;
+} listofNSPair;
+
+typedef struct {
+ ddULONG id;
+ ddUSHORT status;
+ ddCoord3D position; /* search reference position */
+ ddFLOAT distance; /* search distance */
+ ddUSHORT ceiling; /* search ceiling */
+ ddBOOL modelClipFlag; /* model clip flag */
+ listofObj *startPath; /* start path */
+ listofNSPair normal;
+ listofNSPair inverted;
+} ddSCStr;
+
+typedef struct {
+ ddTableIndex index;
+ ddUSHORT unused;
+ ddViewEntry view;
+} ddViewRep;
+
+typedef struct {
+ ddUSHORT whence;
+ ddUSHORT unused;
+ ddLONG offset;
+} ddElementPos;
+
+typedef struct {
+ ddElementPos position1;
+ ddElementPos position2;
+} ddElementRange;
+
+typedef struct {
+ ddSHORT x;
+ ddSHORT y;
+} ddDeviceCoord2D;
+
+typedef struct {
+ ddDeviceCoord2D position;
+ ddFLOAT distance;
+} ddPC_DC_HitBox;
+
+typedef ddNpcSubvolume ddPC_NPC_HitVolume;
+
+#endif /* DDPEX4_H */
diff --git a/xc/programs/Xserver/PEX5/include/dipex.h b/xc/programs/Xserver/PEX5/include/dipex.h
new file mode 100644
index 000000000..7b04973a4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/dipex.h
@@ -0,0 +1,220 @@
+/* $TOG: dipex.h /main/7 1998/02/10 12:34:04 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/* Pex server-private include file
+ */
+
+#ifndef DIPEX_H
+#define DIPEX_H 1
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include "PEX.h"
+#include "PEXproto.h"
+#include "PEXprotost.h"
+#include "pexSwap.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+#include "ddpex.h"
+#include "misc.h"
+#include "pixmap.h"
+
+
+#define PEXCONTEXTTABLE 1
+#define PEXID(client, type) ((((client)->index)<<CLIENTOFFSET) + \
+ (SERVER_BIT) + (type))
+
+#ifndef LOCAL_FLAG
+#define LOCAL_FLAG extern
+#endif
+
+LOCAL_FLAG ErrorCode PexReqCode;
+LOCAL_FLAG ErrorCode PexErrorBase;
+LOCAL_FLAG ErrorCode PexEventBase;
+
+/* resources */
+extern Bool AddResource();
+
+#define ADDRESOURCE(id,what,stuff) \
+ if (!(AddResource((id),(what),(pointer)(stuff)))) { \
+ PEX_ERR_EXIT(BadAlloc,0,cntxtPtr); \
+ }
+
+/* resource class */
+LOCAL_FLAG unsigned long PEXClass;
+
+/* resource types */
+LOCAL_FLAG unsigned long PEXContextType;
+LOCAL_FLAG unsigned long PEXLutType;
+LOCAL_FLAG unsigned long PEXPipeType;
+LOCAL_FLAG unsigned long PEXRendType;
+LOCAL_FLAG unsigned long PEXStructType;
+LOCAL_FLAG unsigned long PEXNameType;
+LOCAL_FLAG unsigned long PEXSearchType;
+LOCAL_FLAG unsigned long PEXWksType;
+LOCAL_FLAG unsigned long PEXPickType;
+LOCAL_FLAG unsigned long PEXFontType;
+
+/* additional type so that we get Drawable-destroy notification */
+LOCAL_FLAG unsigned long PEXWksDrawableType;
+
+/* default font */
+LOCAL_FLAG diFontHandle defaultPEXFont;
+
+
+typedef ErrorCode (*RequestFunction)();
+typedef void (*ReplyFunction)();
+
+/* OCFunction is typedef'd in pexSwap.h */
+
+/* This structure holds all client dependent information. */
+typedef struct {
+ ClientPtr client;
+ pexReq *current_req;
+ RequestFunction *pexRequest;
+ ReplyFunction *pexSwapReply; /* only non-0 if conversion needed */
+ OCFunction *pexSwapRequestOC; /* only non-0 if conversion needed */
+ OCFunction *pexSwapReplyOC; /* only non-0 if conversion needed */
+ pexSwap *swap;
+} pexContext;
+
+
+#define VALID_OC(n) \
+ if ((PEXOCAll >= (n) ) || ((n) > PEXMaxOC)) { \
+ err = BadValue; \
+ PEX_ERR_EXIT(err, (n), cntxtPtr); }
+
+
+#define OC_RANGE(ELTYPE) ((PEXOCAll < (ELTYPE) ) && ( PEXMaxOC >=(ELTYPE)))
+
+/* these arrays are in dipexExt.c */
+
+#ifndef _DIPEXEXT_
+LOCAL_FLAG unsigned long add_pad_of[];
+
+LOCAL_FLAG unsigned int ColourSpecSizes[];
+#endif
+
+
+#define PADDED(PB) (PB + add_pad_of[(PB & 3)]);
+#define LWORDS(PB) (((PB) + add_pad_of[((*((int *)&(PB))) & 3)])/4);
+
+#define WritePEXReplyToClient(CONTEXT, PEXREQUEST, DATA_SIZE, DATA) { \
+ int num_bytes = (int)(DATA_SIZE); \
+ (DATA)->type = X_Reply; \
+ (DATA)->sequenceNumber = (CONTEXT)->client->sequence; \
+ if ((CONTEXT)->pexSwapReply) \
+ (CONTEXT)->pexSwapReply[(CONTEXT)->current_req->opcode]\
+ ((CONTEXT), (PEXREQUEST), (DATA)); \
+ (void) WriteToClient ((CONTEXT)->client, num_bytes, (char *)(DATA)); }
+
+
+#define WritePEXBufferReply(TYPE) \
+ WritePEXReplyToClient( cntxtPtr, strmPtr, \
+ sizeof(TYPE) + *((int *)&(pPEXBuffer->dataSize)), \
+ reply)
+
+
+#define SETUP_INQ(TYPE) \
+ pPEXBuffer->pBuf = (unsigned char *)(pPEXBuffer->pHead+sizeof(TYPE)); \
+ pPEXBuffer->dataSize = 0
+
+
+#define SETUP_VAR_REPLY(TYPE) \
+ TYPE *reply = (TYPE *)(pPEXBuffer->pHead); \
+ reply->length = LWORDS(pPEXBuffer->dataSize)
+
+
+
+/* some dipex types */
+
+typedef struct {
+ ddWKSResource dd_data;
+ Drawable did;
+} dipexPhigsWks;
+
+
+/*
+ * NOTE: The following structure has it's fields layed out in an
+ * order dependent way. It is created in the DI as a dipexFont,
+ * and is sometime referenced in the DD as a ddFontResource.
+ */
+
+typedef struct {
+ ddFontResource ddFont;
+ long refcnt;
+} dipexFont;
+
+
+/*
+ Some data structures so that we can keep track of Drawables,
+ in case they get destroyed (about which destruction we want
+ notification).
+ */
+typedef struct _dipexWksDrawableLink {
+ pexPhigsWks wksid;
+ dipexPhigsWks *wks;
+ struct _dipexWksDrawableLink *next;
+} dipexWksDrawableLink;
+
+typedef struct {
+ Drawable id;
+ DrawablePtr x_drawable;
+ dipexWksDrawableLink *wks_list;
+} dipexWksDrawable;
+
+
+#define GetId(PTR) (((PTR)) ? (PTR)->id : 0)
+
+
+#undef LOCAL_FLAG
+
+#endif /* SERVER_PEX_H */
diff --git a/xc/programs/Xserver/PEX5/include/pexError.h b/xc/programs/Xserver/PEX5/include/pexError.h
new file mode 100644
index 000000000..2185c56c4
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexError.h
@@ -0,0 +1,68 @@
+/* $TOG: pexError.h /main/6 1998/02/10 12:34:08 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEX_ERROR_H
+#define PEX_ERROR_H
+
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "dipex.h"
+
+#define PEX_ERROR_CODE(error_code) ((error_code) + PexErrorBase)
+
+#define PEX_ERR_EXIT(error_code, problem, cntxt) { \
+ (cntxt)->client->errorValue = problem; \
+ return(error_code); }
+
+
+/* output command errors */
+
+#define PEX_OC_ERROR(ptr, cntxt) { \
+ (ptr)->type = X_Error; \
+ (ptr)->sequenceNumber = (cntxt)->client->sequence; \
+ (ptr)->majorCode = PexReqCode; \
+ (ptr)->minorCode = MinorOpcodeOfRequest((cntxt)->client); \
+ WriteEventsToClient((cntxt)->client, 1, (xEvent *)(ptr)); }
+
+#endif /* PEX_ERROR_H */
diff --git a/xc/programs/Xserver/PEX5/include/pexExtract.h b/xc/programs/Xserver/PEX5/include/pexExtract.h
new file mode 100644
index 000000000..ca228836e
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexExtract.h
@@ -0,0 +1,361 @@
+/* $TOG: pexExtract.h /main/10 1998/02/10 12:34:12 kaleb $ */
+
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEX_EXTRACT_H
+#define PEX_EXTRACT_H 1
+
+/** Note that these extract macros, when dealing with data items which
+ ** require more than a few bytes of storage (the only exceptions being
+ ** CARD8, CARD16, and CARD32), simply set the destination to point into
+ ** the packet from which the data is being "extracted". This is
+ ** legal since the data is in the correct format (PEX format) in
+ ** that packet. The pointer into the packet is then
+ ** incremented by the appropriate number of bytes.
+ **/
+
+#define REFER_COORD3D(dstPtr, srcPtr) { \
+ (dstPtr) = (ddCoord3D *)(srcPtr); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(pexCoord3D); }
+
+#define REFER_LISTOF_COORD3D(num, dstPtr, srcPtr) { \
+ (dstPtr) = (ddCoord3D *)(srcPtr); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + num * sizeof(pexCoord3D); }
+
+#define REFER_LISTOF_COORD2D(num, dstPtr, srcPtr) { \
+ (dstPtr) = (ddCoord2D *)(srcPtr); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + num * sizeof(pexCoord2D); }
+
+#define REFER_LISTOF_CARD16(num, dstPtr, srcPtr) { \
+ (dstPtr) = (CARD16 *)(srcPtr); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + num * sizeof(CARD16); }
+
+#define REFER_CARD8(dst, srcPtr) { \
+ (dst) = *((CARD8 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD8); }
+
+#define REFER_CARD16(dst, srcPtr) { \
+ (dst) = *((CARD16 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD16); }
+
+#define REFER_CARD32(dst, srcPtr) { \
+ (dst) = *((CARD32 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD32); }
+
+#define REFER_FLOAT(dst, srcPtr) { \
+ (dst) = *((PEXFLOAT *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(PEXFLOAT); }
+
+/** This is a very general macro which will set the destination pointer to
+ ** be whatever the src pointer is, typecast to the specified type. The
+ ** src pointer is then incremented by the size of the specified type
+ ** multiplied by a factor representing the number of such structures to
+ ** be skipped over.
+ **/
+
+#define REFER_STRUCT(num, data_type, dstPtr, srcPtr) { \
+ (dstPtr) = (data_type *)(srcPtr); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + num * sizeof(data_type); }
+
+
+/*
+ The next set of macros actually copy the data from a packet
+ into the destination data structure.
+*/
+
+#define EXTRACT_COORD3D(dstPtr, srcPtr) { \
+ (dstPtr)->x = ((pexCoord3D *)((srcPtr)))->x; \
+ (dstPtr)->y = ((pexCoord3D *)(srcPtr))->y; \
+ (dstPtr)->z = ((pexCoord3D *)(srcPtr))->z; \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(pexCoord3D); }
+
+#define EXTRACT_VECTOR3D(dstPtr, srcPtr) { \
+ (dstPtr)->x = ((pexVector3D *)((srcPtr)))->x; \
+ (dstPtr)->y = ((pexVector3D *)(srcPtr))->y; \
+ (dstPtr)->z = ((pexVector3D *)(srcPtr))->z; \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(pexVector3D); }
+
+#define EXTRACT_LISTOF_COORD3D(num, dstPtr, srcPtr) \
+ EXTRACT_STRUCT(num, ddCoord3D, dstPtr, srcPtr)
+
+#define EXTRACT_COORD2D(dstPtr, srcPtr) { \
+ (dstPtr)->x = ((pexCoord2D *)(srcPtr))->x; \
+ (dstPtr)->y = ((pexCoord2D *)(srcPtr))->y; \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(pexCoord2D); }
+
+#define EXTRACT_VECTOR2D(dstPtr, srcPtr) { \
+ (dstPtr)->x = ((pexVector2D *)(srcPtr))->x; \
+ (dstPtr)->y = ((pexVector2D *)(srcPtr))->y; \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(pexVector2D); }
+
+#define EXTRACT_LISTOF_COORD2D(num, dstPtr, srcPtr) \
+ EXTRACT_STRUCT(num, ddCoord2D, dstPtr, srcPtr)
+
+/* Takes a CARD8 from a 4 byte Protocol Field */
+#define EXTRACT_CARD8_FROM_4B(dst, srcPtr) { \
+ (dst) = (CARD8) (*((CARD32 *)(srcPtr))); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD32); }
+
+#define EXTRACT_CARD8(dst, srcPtr) { \
+ (dst) = *((CARD8 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD8); }
+
+/* Takes a CARD16 from a 4 byte Protocol Field */
+#define EXTRACT_CARD16_FROM_4B(dst, srcPtr) { \
+ (dst) = (CARD16) (*((CARD32 *)(srcPtr))); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD32); }
+
+/* Takes a INT16 from a 4 byte Protocol Field */
+#define EXTRACT_INT16_FROM_4B(dst, srcPtr) { \
+ (dst) = (INT16) (*((CARD32 *)(srcPtr))); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD32); }
+
+#define EXTRACT_CARD16(dst, srcPtr) { \
+ (dst) = *((CARD16 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD16); }
+
+#define EXTRACT_INT16(dst, srcPtr) { \
+ (dst) = *((INT16 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(INT16); }
+
+#define EXTRACT_CARD32(dst, srcPtr) { \
+ (dst) = *((CARD32 *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(CARD32); }
+
+#define EXTRACT_FLOAT(dst, srcPtr) { \
+ (dst) = *((PEXFLOAT *)(srcPtr)); \
+ (srcPtr) = ((CARD8 *) (srcPtr)) + sizeof(PEXFLOAT); }
+
+
+#define EXTRACT_COLOUR_SPECIFIER(dst, srcPtr) { \
+ EXTRACT_CARD16 ((dst).colourType, (srcPtr));\
+ SKIP_PADDING ((srcPtr), 2);\
+ switch ((dst).colourType) {\
+ case PEXIndexedColour: {\
+ EXTRACT_CARD16((dst).colour.indexed.index, (srcPtr));\
+ SKIP_PADDING((srcPtr),2);\
+ break;\
+ }\
+ case PEXRgbFloatColour: {\
+ EXTRACT_FLOAT((dst).colour.rgbFloat.red,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.rgbFloat.green,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.rgbFloat.blue,(srcPtr));\
+ break;\
+ }\
+ case PEXCieFloatColour: {\
+ EXTRACT_FLOAT((dst).colour.cieFloat.x,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.cieFloat.y,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.cieFloat.z,(srcPtr));\
+ break;\
+ }\
+ case PEXHsvFloatColour: {\
+ EXTRACT_FLOAT((dst).colour.hsvFloat.hue,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.hsvFloat.saturation,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.hsvFloat.value,(srcPtr));\
+ break;\
+ }\
+ case PEXHlsFloatColour: {\
+ EXTRACT_FLOAT((dst).colour.hlsFloat.hue,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.hlsFloat.lightness,(srcPtr));\
+ EXTRACT_FLOAT((dst).colour.hlsFloat.saturation,(srcPtr));\
+ break;\
+ }\
+ case PEXRgb8Colour: {\
+ EXTRACT_CARD8((dst).colour.rgb8.red,(srcPtr));\
+ EXTRACT_CARD8((dst).colour.rgb8.green,(srcPtr));\
+ EXTRACT_CARD8((dst).colour.rgb8.blue,(srcPtr));\
+ SKIP_PADDING((srcPtr),1);\
+ break;\
+ }\
+ case PEXRgb16Colour: {\
+ EXTRACT_CARD16((dst).colour.rgb16.red,(srcPtr));\
+ EXTRACT_CARD16((dst).colour.rgb16.green,(srcPtr));\
+ EXTRACT_CARD16((dst).colour.rgb16.blue,(srcPtr));\
+ SKIP_PADDING((srcPtr),2);\
+ break;\
+ }\
+ }}
+
+/* JSH - assuming copy may overlap */
+#define EXTRACT_STRUCT(num, data_type, dstPtr, srcPtr) {\
+ memmove( (char *)(dstPtr), (char *)(srcPtr), \
+ (int)(num * sizeof(data_type)));\
+ (srcPtr) = ((CARD8 *) (srcPtr)) + num * sizeof(data_type); }
+
+/*
+ The next set of macros actually copy the data from a structure
+ into the destination reply packet.
+*/
+
+#define PACK_COORD3D(srcPtr, dstPtr) { \
+ ((pexCoord3D *)(dstPtr))->x = (srcPtr)->x; \
+ ((pexCoord3D *)(dstPtr))->y = (srcPtr)->y; \
+ ((pexCoord3D *)(dstPtr))->z = (srcPtr)->z; \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(pexCoord3D); }
+
+#define PACK_LISTOF_COORD3D(NUM, SRC, DST) \
+ PACK_LISTOF_STRUCT(NUM, pexCoord3D, SRC, DST)
+
+#define PACK_COORD2D(srcPtr, dstPtr) { \
+ ((pexCoord2D *)(dstPtr))->x = (srcPtr)->x; \
+ ((pexCoord2D *)(dstPtr))->y = (srcPtr)->y; \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(pexCoord2D); }
+
+#define PACK_LISTOF_COORD2D(NUM, SRC, DST) \
+ PACK_LISTOF_STRUCT(NUM, pexCoord2D, SRC, DST)
+
+#define PACK_VECTOR3D(srcPtr, dstPtr) { \
+ ((pexVector3D *)(dstPtr))->x = (srcPtr)->x; \
+ ((pexVector3D *)(dstPtr))->y = (srcPtr)->y; \
+ ((pexVector3D *)(dstPtr))->z = (srcPtr)->z; \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(pexCoord3D); }
+
+#define PACK_VECTOR2D(srcPtr, dstPtr) { \
+ ((pexVector2D *)(dstPtr))->x = (srcPtr)->x; \
+ ((pexVector2D *)(dstPtr))->y = (srcPtr)->y; \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(pexCoord2D); }
+
+
+#define PACK_CARD8(src, dstPtr) {\
+ *((CARD8 *)(dstPtr)) = (CARD8)(src);\
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(CARD8); }
+
+#define PACK_CARD16(src, dstPtr) { \
+ *((CARD16 *)(dstPtr)) = (CARD16)(src); \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(CARD16); }
+
+#define PACK_INT16(src, dstPtr) { \
+ *((INT16 *)(dstPtr)) = (INT16)(src);\
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(INT16); }
+
+#define PACK_CARD32(src, dstPtr) { \
+ *((CARD32 *)(dstPtr)) = (CARD32)(src); \
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(CARD32); }
+
+#define PACK_FLOAT(src, dstPtr) {\
+ *((PEXFLOAT *)(dstPtr)) = (PEXFLOAT)(src);\
+ (dstPtr) = ((CARD8 *) (dstPtr)) + sizeof(PEXFLOAT); }
+
+
+#define PACK_COLOUR_SPECIFIER(src, dstPtr) {\
+ PACK_CARD16 ((src).colourType, (dstPtr));\
+ SKIP_PADDING ((dstPtr), 2);\
+ switch ((src).colourType) {\
+ case PEXIndexedColour: {\
+ PACK_CARD16((src).colour.indexed.index,(dstPtr));\
+ SKIP_PADDING((dstPtr),2);\
+ break;\
+ }\
+ case PEXRgbFloatColour: {\
+ PACK_FLOAT((src).colour.rgbFloat.red,(dstPtr));\
+ PACK_FLOAT((src).colour.rgbFloat.green,(dstPtr));\
+ PACK_FLOAT((src).colour.rgbFloat.blue,(dstPtr));\
+ break;\
+ }\
+ case PEXCieFloatColour: {\
+ PACK_FLOAT((src).colour.cieFloat.x,(dstPtr));\
+ PACK_FLOAT((src).colour.cieFloat.y,(dstPtr));\
+ PACK_FLOAT((src).colour.cieFloat.z,(dstPtr));\
+ break;\
+ }\
+ case PEXHsvFloatColour: {\
+ PACK_FLOAT((src).colour.hsvFloat.hue,(dstPtr));\
+ PACK_FLOAT((src).colour.hsvFloat.saturation,(dstPtr));\
+ PACK_FLOAT((src).colour.hsvFloat.value,(dstPtr));\
+ break;\
+ }\
+ case PEXHlsFloatColour: {\
+ PACK_FLOAT((src).colour.hlsFloat.hue,(dstPtr));\
+ PACK_FLOAT((src).colour.hlsFloat.lightness,(dstPtr));\
+ PACK_FLOAT((src).colour.hlsFloat.saturation,(dstPtr));\
+ break;\
+ }\
+ case PEXRgb8Colour: {\
+ PACK_CARD8((src).colour.rgb8.red,(dstPtr));\
+ PACK_CARD8((src).colour.rgb8.green,(dstPtr));\
+ PACK_CARD8((src).colour.rgb8.blue,(dstPtr));\
+ SKIP_PADDING((dstPtr),1);\
+ break;\
+ }\
+ case PEXRgb16Colour: {\
+ PACK_CARD16((src).colour.rgb16.red,(dstPtr));\
+ PACK_CARD16((src).colour.rgb16.green,(dstPtr));\
+ PACK_CARD16((src).colour.rgb16.blue,(dstPtr));\
+ SKIP_PADDING((dstPtr),2);\
+ break;\
+ }\
+ }}
+
+/* JSH - assuming copy may overlap */
+#define PACK_STRUCT(data_type,srcPtr,dstPtr) { \
+ memmove( (char *)(dstPtr), (char *)(srcPtr), \
+ sizeof(data_type)); \
+ SKIP_STRUCT(dstPtr, 1, data_type); }
+
+/* JSH - assuming copy may overlap */
+#define PACK_LISTOF_STRUCT(num,data_type,srcPtr,dstPtr){\
+ memmove( (char *)(dstPtr), (char *)(srcPtr), \
+ (int)(num * sizeof(data_type))); \
+ SKIP_STRUCT(dstPtr, num, data_type); }
+/*
+ Other useful macros
+ */
+
+#define SKIP_PADDING(skipPtr, bytesToSkip) \
+ (skipPtr) = ((CARD8 *) (skipPtr)) + bytesToSkip
+
+#define SKIP_STRUCT(skipPtr, num, data_type) \
+ (skipPtr) = (unsigned char *)(((data_type *)skipPtr) + (num))
+
+#define SIZE_COLOURSPEC(cs) ColourSpecSizes[cs.colourType]
+
+/*
+###define SIZE_COLOURSPEC(cs) \
+ (cs->colourType == PEXIndexedColour)?sizeof(CARD32):\
+ ((cs->colourType == PEXRgb8Colour)?sizeof(CARD32):\
+ ((cs->colourType == PEXRgb16Colour)?2*sizeof(CARD32):\
+ 3*sizeof(PEXFLOAT) ) )
+*/
+
+#endif /* PEX_EXTRACT_H */
diff --git a/xc/programs/Xserver/PEX5/include/pexLookup.h b/xc/programs/Xserver/PEX5/include/pexLookup.h
new file mode 100644
index 000000000..51705e130
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexLookup.h
@@ -0,0 +1,107 @@
+/* $TOG: pexLookup.h /main/3 1998/02/10 12:34:16 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEX_LOOKUP_H
+#define PEX_LOOKUP_H 1
+
+#include "resource.h"
+#include "dipex.h"
+
+/* PEX types */
+
+#define LU_PEXFONT(id, ptr) \
+ if (! ((ptr) = (diFontHandle) LookupIDByType ((id), PEXFontType)) ) { \
+ err = PEX_ERROR_CODE(PEXFontError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_TABLE(id, ptr) \
+ if (! ((ptr) = (diLUTHandle) LookupIDByType ((id), PEXLutType)) ) { \
+ err = PEX_ERROR_CODE(PEXLookupTableError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_NAMESET(id,ns_handle) \
+ if (! (ns_handle = (diNSHandle) LookupIDByType ((id), PEXNameType)) ) { \
+ err = PEX_ERROR_CODE(PEXNameSetError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_PHIGSWKS(id,ptr) \
+ if (! ((ptr) = (dipexPhigsWks *) LookupIDByType ((id), PEXWksType)) ) { \
+ err = PEX_ERROR_CODE(PEXPhigsWksError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_PICKMEASURE(id,ptr) \
+ if (! ((ptr) = (diPMHandle) LookupIDByType ((id), PEXPickType)) ) { \
+ err = PEX_ERROR_CODE(PEXPickMeasureError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_PIPELINECONTEXT(id,ptr) \
+ if (! ((ptr) = (ddPCStr *) LookupIDByType ((id), PEXPipeType)) ) { \
+ err = PEX_ERROR_CODE(PEXPipelineContextError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_RENDERER(id, ptr) \
+ if (! ((ptr) = (ddRendererStr *)LookupIDByType((id), PEXRendType)) ) { \
+ err = PEX_ERROR_CODE(PEXRendererError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_SEARCHCONTEXT(id,ptr) \
+ if (! ((ptr) = (ddSCStr *) LookupIDByType ((id), PEXSearchType)) ) { \
+ err = PEX_ERROR_CODE(PEXSearchContextError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+#define LU_STRUCTURE(id,ptr) \
+ if (! ((ptr) = (diStructHandle) LookupIDByType ((id), PEXStructType))) {\
+ err = PEX_ERROR_CODE(PEXStructureError); \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+
+/* Other useful types */
+
+#define LU_DRAWABLE(id,ptr) \
+ if (!((ptr) = (DrawablePtr) LookupIDByClass ((id), RC_DRAWABLE))) { \
+ err = BadDrawable; \
+ PEX_ERR_EXIT(err,(id),cntxtPtr); }
+
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/include/pexSwap.h b/xc/programs/Xserver/PEX5/include/pexSwap.h
new file mode 100644
index 000000000..5b1127b62
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexSwap.h
@@ -0,0 +1,74 @@
+/* $TOG: pexSwap.h /main/8 1998/02/10 12:34:21 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * Swapping information used by both the dipex portions of the
+ * server and by the archive sections of the api.
+ */
+
+#ifndef PEXSWAP_H
+#define PEXSWAP_H 1
+
+#include "PEXErr.h"
+
+typedef void (*ConvFunction)();
+typedef void (*SwapShortFunction)();
+typedef void (*SwapLongFunction)();
+typedef ErrorCode (*OCFunction)();
+
+typedef struct {
+ SwapShortFunction ConvertCARD16;
+ SwapLongFunction ConvertCARD32;
+ ConvFunction ConvertFLOAT;
+} pexSwap;
+
+extern void SwapCARD16();
+extern void SwapCARD32();
+extern void SwapFLOAT();
+extern void ConvertFLOAT();
+
+/* not sure if this is the right place for this */
+extern void SwapPEXMaxHitsReachedEvent();
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/include/pexUtils.h b/xc/programs/Xserver/PEX5/include/pexUtils.h
new file mode 100644
index 000000000..a4947bee7
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexUtils.h
@@ -0,0 +1,96 @@
+/* $TOG: pexUtils.h /main/3 1998/02/10 12:34:25 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEXUTILS_H
+#define PEXUTILS_H
+
+#include "ddpex.h"
+
+/* declarations for the utilities in pexUtils.c */
+extern listofObj *puCreateList();
+extern void puDeleteList();
+extern short puInList();
+extern short puAddToList();
+extern short puRemoveFromList();
+extern short puCopyList();
+extern short puMergeLists();
+extern int puBuffRealloc();
+extern void puInitList();
+extern int puCountList();
+
+/* useful macros to use with lists */
+#define PU_TRUE 1
+#define PU_FALSE 0
+
+#define PU_BAD_LIST -1 /* error returned by list utilities */
+
+#define PU_EMPTY_LIST( plist ) \
+ (plist)->numObj = 0
+
+#define PU_REMOVE_LAST_OBJ( plist ) \
+ if ( (plist)->numObj > 0 ) (plist)->numObj--
+
+/* useful macros to use with ddBuffer */
+#define PU_BUF_HDR_SIZE(pBuffer) \
+ (int) (((char *) pBuffer->pBuf) - ((char *) pBuffer->pHead))
+
+#define PU_BUF_TOO_SMALL(pBuffer,minSize) \
+ ((minSize) > ((pBuffer->bufSize) - PU_BUF_HDR_SIZE(pBuffer) + 1))
+
+#define PU_CHECK_BUFFER_SIZE( pBuffer, size ) \
+ if ( PU_BUF_TOO_SMALL((pBuffer), (size)) ) \
+ if (puBuffRealloc((pBuffer), (ddULONG)(size)) != Success ) \
+ { \
+ (pBuffer)->dataSize = 0; \
+ return( BadAlloc ); \
+ }
+
+/*
+ useful macro for ensuring that lists of shorts allocate full longwords
+ */
+#define MAKE_EVEN(_n) \
+ ( (_n)%2 ? (_n)+1 : (_n) )
+
+
+#endif /* PEXUTILS_H */
diff --git a/xc/programs/Xserver/PEX5/include/pex_site.h b/xc/programs/Xserver/PEX5/include/pex_site.h
new file mode 100644
index 000000000..592fff313
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pex_site.h
@@ -0,0 +1,82 @@
+/* $TOG: pex_site.h /main/3 1998/02/10 12:34:29 kaleb $ */
+
+/***********************************************************
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef PEX_SITE
+#define PEX_SITE 1
+
+
+/*
+ Server native formats
+ */
+#define LOCAL_PEX_NAME "X3D-PEX"
+#define PEX_VENDOR "X3D-PEX Sample Implementation"
+#define PEX_RELEASE_NUMBER 0
+#define PEX_SUBSET PEXCompleteImplementation
+
+#define SERVER_NATIVE_FP PEXIeee_754_32
+#define OTHER_FP PEXDEC_F_Floating
+#define SERVER_SUPPORTED_COLOURS PEXRgbFloatColour
+
+/*
+ Server supported formats
+ */
+#define CHECK_FP_FORMAT(FP) \
+ if ((FP != PEXIeee_754_32) && (FP != PEXDEC_F_Floating)) { \
+ err = PEX_ERROR_CODE(PEXFloatingPointFormatError); \
+ PEX_ERR_EXIT(err,0,cntxtPtr); }
+
+#define CHECK_COLOUR_FORMAT(C) \
+ if (C != SERVER_SUPPORTED_COLOURS) { \
+ err = PEX_ERROR_CODE(PEXDirectColourFormatError); \
+ PEX_ERR_EXIT(err,0,cntxtPtr); }
+
+
+/*
+ Font path
+ */
+#ifdef FONTDIR
+#define FONT_DIRECTORY FONTDIR/PEXfonts
+#endif
+
+#endif
diff --git a/xc/programs/Xserver/PEX5/include/pexos.h b/xc/programs/Xserver/PEX5/include/pexos.h
new file mode 100644
index 000000000..95680de58
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/include/pexos.h
@@ -0,0 +1,60 @@
+/* $XFree86: xc/programs/Xserver/PEX5/include/pexos.h,v 1.2 1999/01/31 12:21:33 dawes Exp $ */
+
+/*
+ * This file contains all external OS/ANSI header includes, prototypes and
+ * definitions.
+ */
+
+#ifndef _PEXOS_H_
+#define _PEXOS_H_
+
+#ifndef XFree86LOADER
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+
+#ifdef NEED_OS_LIMITS
+#ifndef X_NOT_POSIX
+#ifdef _POSIX_SOURCE
+#include <limits.h>
+#else
+#define _POSIX_SOURCE
+#include <limits.h>
+#undef _POSIX_SOURCE
+#endif
+#endif /* X_NOT_POSIX */
+#ifndef PATH_MAX
+#ifdef WIN32
+#define PATH_MAX 512
+#else
+#include <sys/param.h>
+#endif
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+#endif /* PATH_MAX */
+#endif /* NEED_OS_LIMITS */
+
+#ifdef NEED_GETENV
+
+#include <X11/Xos.h>
+#ifndef X_NOT_STDC_ENV
+#include <stdlib.h>
+#else
+extern char *getenv();
+#endif
+#endif /* NEED_GETENV */
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+#else
+#include "xf86_ansic.h"
+#endif
+
+#endif /* _PEXOS_H_ */
diff --git a/xc/programs/Xserver/PEX5/ospex/Imakefile b/xc/programs/Xserver/PEX5/ospex/Imakefile
new file mode 100644
index 000000000..55bda1ea2
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ospex/Imakefile
@@ -0,0 +1,81 @@
+XCOMM
+XCOMM $XConsortium: Imakefile /main/8 1996/09/28 16:55:19 rws $
+XCOMM $XFree86: xc/programs/Xserver/PEX5/ospex/Imakefile,v 3.13 1999/07/04 06:38:33 dawes Exp $
+XCOMM
+XCOMM
+XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium
+XCOMM
+XCOMM All Rights Reserved
+XCOMM
+XCOMM Permission to use, copy, modify, and distribute this software and its
+XCOMM documentation for any purpose and without fee is hereby granted,
+XCOMM provided that the above copyright notice appear in all copies and that
+XCOMM both that copyright notice and this permission notice appear in
+XCOMM supporting documentation, and that the names of Sun Microsystems
+XCOMM and the X Consortium not be used in advertising or publicity
+XCOMM pertaining to distribution of the software without specific, written
+XCOMM prior permission.
+XCOMM
+XCOMM SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+XCOMM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+XCOMM EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+XCOMM CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+XCOMM USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+XCOMM OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+XCOMM PERFORMANCE OF THIS SOFTWARE.
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PassCDebugFlags
+#define PassCDebugFlags
+#endif
+
+#ifndef PexDipexCDebugFlags
+#define PexDipexCDebugFlags ServerCDebugFlags
+#endif
+
+.SUFFIXES: .o .a
+
+RDR_STUBS = -DRENDER_CMDS
+ST_STUBS = -DSTORE_CMDS
+
+ CDEBUGFLAGS = PexDipexCDebugFlags
+ FONTDEFINES = -DPEX_DEFAULT_FONTPATH=\"$(FONTDIR)/PEX\"
+ DEFINES = ExtensionDefines PexDipexDefines $(FONTDEFINES)
+
+ LINTLIBS = ../../../../server/dix/llib-ldix.ln \
+ ../../../../server/os/4.2bsd/llib-los.ln \
+ ../ddpex/mi/level4/llib-ldp4.ln \
+ ../ddpex/mi/shared/llib-ldps.ln \
+ ../dipex/swap/llib-ldsw.ln \
+ ../dipex/objects/llib-lobj.ln
+
+ PEXSRVINC = ../include
+DDPEXINCLUDE = ../ddpex/mi/include
+ INCLUDES = -I. \
+ -I$(PEXSRVINC) \
+ -I$(XINCLUDESRC) \
+ -I$(SERVERSRC)/include \
+ -I$(DDPEXINCLUDE)
+
+
+SRCS = osPexFont.c
+
+OBJS = osPexFont.o
+
+PEX_OS_LIBNAME = libospex.a
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+
+NormalLibraryTarget(ospex,$(OBJS))
+
+SpecialCObjectRule(osPexFont,$(ICONFIGFILES),NullParameter)
+
+LintLibraryTarget(osp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/PEX5/ospex/osPexFont.c b/xc/programs/Xserver/PEX5/ospex/osPexFont.c
new file mode 100644
index 000000000..00fd08556
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/ospex/osPexFont.c
@@ -0,0 +1,692 @@
+/* $TOG: osPexFont.c /main/11 1998/02/10 12:34:33 kaleb $ */
+
+/*
+
+Copyright 1989, 1990, 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Sun Microsystems,
+not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/PEX5/ospex/osPexFont.c,v 3.15 1998/10/04 09:35:23 dawes Exp $ */
+
+#ifdef WIN32
+#define _WILLWINSOCK_
+#endif
+
+#include "mipex.h"
+#include "miFont.h"
+#include "PEXErr.h"
+#define XK_LATIN1
+#include "keysymdef.h"
+#define NEED_GETENV
+#define NEED_OS_LIMITS
+#include "pexos.h"
+
+#ifndef PEX_DEFAULT_FONTPATH
+#define PEX_DEFAULT_FONTPATH "/usr/lib/X11/fonts/PEX"
+#endif
+
+#ifndef WIN32
+
+#ifndef XFree86LOADER
+
+#ifndef X_NOT_POSIX
+#include <dirent.h>
+#else
+#ifdef SYSV
+#include <dirent.h>
+#else
+#ifdef USG
+#include <dirent.h>
+#else
+#include <sys/dir.h>
+#ifndef dirent
+#define dirent direct
+#endif
+#endif
+#endif
+#endif
+typedef struct dirent ENTRY;
+
+#ifndef FILENAME_MAX
+#ifdef MAXNAMLEN
+#define FILENAME_MAX MAXNAMLEN
+#else
+#define FILENAME_MAX 255
+#endif
+#endif
+
+#else /* XFree86LOADER */
+
+/* XXX This should be taken care of elsewhere */
+typedef struct _xf86dirent ENTRY;
+
+#endif /* XFree86LOADER */
+
+#define FileName(file) file->d_name
+
+#else /* WIN32 */
+
+#define BOOL wBOOL
+#define ATOM wATOM
+#include <windows.h>
+#undef BOOL
+#undef ATOM
+#define FileName(file) file.cFileName
+
+#endif /* WIN32 */
+
+extern void CopyISOLatin1Lowered();
+extern int get_lowered_truncated_entry();
+
+void ClosePEXFontFile();
+void SetPEXFontFilePtr();
+
+extern diFontHandle defaultPEXFont;
+
+/*
+ * Unless an environment variable named PEX_FONTPATH is set before the
+ * server is started up, PEX will look in the path defined in the
+ * PEX_DEFAULT_FONTPATH compiler constant defined in miFont.h for PEX fonts.
+ * If environment variable PEX_FONTPATH is defined, then this will
+ * be used as the path to the fonts .
+ */
+
+static char *
+pex_get_font_directory_path()
+{
+ static int already_determined = 0;
+ static char *font_dir_path = NULL;
+
+ if (!already_determined) {
+ if (getenv("PEX_FONTPATH")) {
+ font_dir_path =
+ (char *)xalloc((unsigned long)(1+strlen(getenv("PEX_FONTPATH"))));
+ strcpy(font_dir_path, getenv("PEX_FONTPATH"));
+ } else {
+#ifndef __EMX__
+ font_dir_path =
+ (char *)xalloc((unsigned long)(1+strlen(PEX_DEFAULT_FONTPATH)));
+ strcpy(font_dir_path, PEX_DEFAULT_FONTPATH);
+#else
+ char *p = (char*)__XOS2RedirRoot(PEX_DEFAULT_FONTPATH);
+ font_dir_path =
+ (char *)xalloc((unsigned long)(1+strlen(p)));
+ strcpy(font_dir_path, p);
+#endif
+ }
+ already_determined = 1;
+ }
+
+ return (font_dir_path);
+}
+
+
+/*
+ * The next two functions (pex_setup_wild_match() and pex_is_matching()) are
+ * stolen (and slightly modified) from MIT X11R4 fonts/mkfontdir/fontdir.c.
+ * pex_setup_wild_match() sets up some state about the pattern to match, which
+ * pex_is_matching() then uses.
+ */
+
+
+/* results of this function are used by pex_is_matching() */
+
+static void
+pex_setup_wild_match(pat, phead, ptail, plen)
+char *pat; /* in */
+int *phead, *ptail, *plen; /* out */
+{
+ register int head, tail;
+ register char c, *firstWild;
+
+ *plen = tail = strlen(pat);
+ for ( firstWild = pat;
+ ((c = *firstWild) && !((c == XK_asterisk) || (c == XK_question)));
+ firstWild++)
+ ;
+
+ head = firstWild - pat;
+
+ while ((c = pat[head]) && (c != XK_asterisk))
+ head++;
+ if (head < tail)
+ {
+ while (pat[tail-1] != XK_asterisk)
+ tail--;
+ }
+ *phead = head;
+ *ptail = tail;
+}
+
+/* returns value greater than 0 if successful. head, tail, and plen
+ * come from a previous call to pex_setup_wild_match
+ */
+static int
+pex_is_matching(string, pat, head, tail, plen)
+register char *string; /* in */
+register char *pat; /* in */
+int head, tail, plen; /* in */
+{
+ register int i, l;
+ int j, m, res;
+ register char cp, cs;
+
+ res = -1;
+ for (i = 0; i < head; i++)
+ {
+ cp = pat[i];
+ if (cp == XK_question)
+ {
+ if (!string[i])
+ return res;
+ res = 0;
+ }
+ else if (cp != string[i])
+ return res;
+ }
+ if (head == plen)
+ return (string[head] ? res : 1);
+ l = head;
+ while (++i < tail)
+ {
+ /* we just skipped an asterisk */
+ j = i;
+ m = l;
+ while ((cp = pat[i]) != XK_asterisk)
+ {
+ if (!(cs = string[l]))
+ return 0;
+ if ((cp != cs) && (cp != XK_question))
+ {
+ m++;
+ cp = pat[j];
+ if (cp == XK_asterisk)
+ {
+ if (!string[m])
+ return 0;
+ }
+ else
+ {
+ while ((cs = string[m]) != cp)
+ {
+ if (!cs)
+ return 0;
+ m++;
+ }
+ }
+ l = m;
+ i = j;
+ }
+ l++;
+ i++;
+ }
+ }
+ m = strlen(&string[l]);
+ j = plen - tail;
+ if (m < j)
+ return 0;
+ l = (l + m) - j;
+ while (cp = pat[i])
+ {
+ if ((cp != string[l]) && (cp != XK_question))
+ return 0;
+ l++;
+ i++;
+ }
+ return 1;
+}
+
+/*
+ * Caller is responsible for freeing contents of buffer and buffer when
+ * done with it.
+ */
+#define ABSOLUTE_MAX_NAMES 200
+
+int
+pex_get_matching_names(patLen, pPattern, maxNames, numNames, names)
+ddUSHORT patLen; /* in */
+ddUCHAR *pPattern; /* in */
+ddUSHORT maxNames; /* in */
+ddULONG *numNames; /* out - number of names found */
+char ***names; /* out - pointer to list of strings */
+{
+#ifdef WIN32
+ HANDLE fontdirh;
+ WIN32_FIND_DATA dir_entry;
+ char path[MAX_PATH];
+#else
+ DIR *fontdir;
+ ENTRY *dir_entry;
+#endif
+ char *pattern;
+ char entry[PATH_MAX+1];
+ int i, head, tail, len, total = 0;
+
+ if (!(pattern = (char *)xalloc((unsigned long)(1 + patLen))))
+ return 0;
+
+ CopyISOLatin1Lowered((unsigned char*)pattern, pPattern, patLen);
+
+ if (!(*names = (char **)xalloc((unsigned long)(ABSOLUTE_MAX_NAMES * sizeof(char *)))))
+ return 0;
+
+#ifdef WIN32
+ sprintf(path, "%s/*.*", pex_get_font_directory_path());
+ if ((fontdirh = FindFirstFile(path, &dir_entry)) == INVALID_HANDLE_VALUE) {
+ xfree(*names);
+ xfree(pattern);
+ return 0;
+ }
+#else
+ if (!(fontdir = opendir(pex_get_font_directory_path()))) {
+ xfree(*names);
+ xfree(pattern);
+ return 0;
+ }
+#endif
+
+ pex_setup_wild_match(pattern, &head, &tail, &len);
+
+#ifdef WIN32
+ do
+#else
+ while (total < maxNames && (dir_entry = readdir(fontdir)))
+#endif
+ {
+
+ if (!get_lowered_truncated_entry(FileName(dir_entry), entry))
+ continue;
+
+ if (pex_is_matching(entry, pattern, head, tail, len) > 0) {
+
+ if (!( (*names)[total] = (char *)xalloc((unsigned long)(1 + strlen(entry))))) {
+ for (i = 0; i < total; i++)
+ xfree((*names)[i]);
+ xfree(*names);
+ xfree(pattern);
+ return 0;
+ }
+
+ strcpy((*names)[total], entry);
+ total++;
+ }
+ }
+#ifdef WIN32
+ while (total < maxNames && FindNextFile(fontdirh, &dir_entry));
+#endif
+
+#ifdef WIN32
+ FindClose(fontdirh);
+#else
+ closedir(fontdir);
+#endif
+
+ *numNames = total;
+
+ return 1;
+}
+
+/*
+ * get_stroke(stroke, fp) extracts the definition of characters
+ * from the font file. It return -1 if anything goes wrong, 0 if
+ * everything is OK.
+ */
+
+static int
+get_stroke(stroke, fp)
+ Ch_stroke_data *stroke;
+ FILE *fp;
+{
+ listofddPoint *spath;
+ register int i;
+ unsigned long closed; /* placeholder, really unused */
+ register ddULONG npath;
+ register miListHeader *hdr = &(stroke->strokes);
+
+ stroke->n_vertices = 0;
+ npath = hdr->maxLists = hdr->numLists;
+ hdr->type = DD_2D_POINT;
+ hdr->ddList = spath = (listofddPoint *)
+ xalloc((unsigned long)(sizeof(listofddPoint) * npath));
+
+ if (spath == NULL)
+ return -1;
+
+ for (i = 0; i < npath; i++, spath++)
+ spath->pts.p2Dpt = NULL;
+
+ for (i = 0, spath = hdr->ddList; i < npath; i++, spath++) {
+
+ /* for each subpath of the character definition ... */
+
+ if (fread((char *) &spath->numPoints,
+ sizeof(spath->numPoints), 1, fp) != 1 ||
+ fread((char *) &closed, sizeof(closed), 1, fp) != 1)
+ return -1;
+
+ if (spath->numPoints <= 0)
+ continue;
+
+ spath->maxData = sizeof(ddCoord2D) * spath->numPoints;
+
+ if (!(spath->pts.p2Dpt = (ddCoord2D *) xalloc((unsigned long)(spath->maxData))))
+ return -1;
+
+ if (fread((char *)spath->pts.p2Dpt, sizeof(ddCoord2D),
+ spath->numPoints, fp) != spath->numPoints)
+ return -1;
+
+ stroke->n_vertices += spath->numPoints;
+ }
+ return 0;
+}
+
+
+
+/*
+ read in the pex font
+ */
+ErrorCode
+LoadPEXFontFile(length, fontname, pFont)
+ unsigned length;
+ char * fontname;
+ diFontHandle pFont;
+{
+ char fname[FILENAME_MAX+1];
+ FILE *fp;
+ Font_file_header header;
+ Property *properties = 0;
+ Dispatch *table = 0;
+ miFontHeader *font = (miFontHeader *)(pFont->deviceData);
+ int found_first, found_it = 0, err = Success, numChars, np;
+ char *name_to_match;
+ char lowered_entry[PATH_MAX+1];
+#ifdef WIN32
+ HANDLE fontdirh;
+ WIN32_FIND_DATA dir_entry;
+ char path[MAX_PATH];
+#else
+ DIR *fontdir;
+ ENTRY *dir_entry;
+#endif
+ register int i;
+ register Ch_stroke_data **ch_font, *ch_stroke = 0;
+ register Dispatch *tblptr = 0;
+ register Property *propptr = 0;
+ register pexFontProp *fpptr = 0;
+
+ if (!(name_to_match = (char *)xalloc((unsigned int)(1 + length))))
+ return (PEXERR(PEXFontError));
+
+ CopyISOLatin1Lowered((unsigned char *)name_to_match,
+ (unsigned char *)fontname, length);
+
+ /* open up the font directory and look for matching file names */
+#ifdef WIN32
+ sprintf(path, "%s/*.*", pex_get_font_directory_path());
+ if ((fontdirh = FindFirstFile(path, &dir_entry)) == INVALID_HANDLE_VALUE)
+ return (PEXERR(PEXFontError));
+#else
+ if (!(fontdir = opendir(pex_get_font_directory_path())))
+ return (PEXERR(PEXFontError));
+#endif
+
+#ifdef WIN32
+ do
+#else
+ while(!found_it && (dir_entry = readdir(fontdir)))
+#endif
+ {
+ /* strip off .phont and make all lower case */
+ if (!get_lowered_truncated_entry(FileName(dir_entry), lowered_entry))
+ continue;
+
+ /* does this match what got passed in? */
+ if (strcmp(lowered_entry, name_to_match) == 0)
+ found_it = 1;
+ }
+ xfree(name_to_match);
+#ifdef WIN32
+ while (!found_it && FindNextFile(fontdirh, &dir_entry) && !found_it);
+#endif
+
+ if (!found_it)
+ return (PEXERR(PEXFontError));
+
+ (void) strcpy(fname, pex_get_font_directory_path());
+ (void) strcat(fname, "/");
+ (void) strcat(fname, FileName(dir_entry));
+
+#ifdef WIN32
+ FindClose(fontdirh);
+#else
+ closedir(fontdir);
+#endif
+
+ if ((fp = fopen(fname, "r")) == NULL)
+ return (PEXERR(PEXFontError));
+
+ /*
+ * read in the file header. The file header has fields containing the
+ * num of characters in the font, the extreme values, and number of font
+ * properties defined, if any.
+ */
+
+ tblptr = 0;
+ if (fread((char *) &header, sizeof(header), 1, fp) != 1) {
+ (void) ClosePEXFontFile(fp);
+ return (PEXERR(PEXFontError)); }
+
+ /* Initialize font structure */
+ (void) strcpy(font->name, header.name);
+ font->font_type = FONT_POLYLINES;
+ font->top = header.top;
+ font->bottom = header.bottom;
+ font->num_ch = header.num_ch;
+ font->font_info.numProps = (CARD32)header.num_props;
+ font->max_width = header.max_width;
+
+ /* read in the font properties, if any, into font data area */
+ if (header.num_props > 0) {
+
+ (void) SetPEXFontFilePtr(fp, START_PROPS); /* Get to props position */
+ properties = (Property *) xalloc(header.num_props * sizeof(Property));
+ if (properties == NULL) {
+ (void) ClosePEXFontFile(fp);
+ return (BadAlloc); }
+
+ if (fread((char *) properties, sizeof(Property),
+ header.num_props, fp) != header.num_props) {
+ xfree((char *) properties);
+ (void) ClosePEXFontFile(fp);
+ return (PEXERR(PEXFontError)); }
+
+ /* Create space for font properties in the font data area */
+
+ font->properties =
+ (pexFontProp *) xalloc( (unsigned long)(header.num_props
+ * sizeof(pexFontProp)));
+ if (font->properties == NULL) {
+ xfree((char *) properties);
+ (void) ClosePEXFontFile(fp);
+ return (BadAlloc); }
+
+ np = header.num_props;
+ for ( i=0, propptr = properties, fpptr = font->properties;
+ i < np;
+ i++, propptr++, fpptr++) {
+
+ if (propptr->propname == NULL) {
+ (header.num_props)--;
+ continue; }
+
+ fpptr->name = MakeAtom( (char *)propptr->propname,
+ strlen(propptr->propname), 1);
+
+ if (propptr->propvalue != NULL)
+ fpptr->value = MakeAtom((char *)propptr->propvalue,
+ strlen(propptr->propvalue), 1);
+ else fpptr->value = 0;
+ }
+
+ /* free up local storage allocated for properties */
+ xfree((char *) properties);
+ }
+
+ /* position file pointer to dispatch data */
+ (void) SetPEXFontFilePtr(fp, (long) START_DISPATCH(header.num_props));
+
+ /*
+ * read in the distable font, use the offset to see if the
+ * character is defined or not. The strokes are defined in Phigs style.
+ * The "center" of the character is not the physical center. It is the
+ * center defined by the font designer. The actual center is half the
+ * "right" value.
+ */
+
+ table = (Dispatch *)xalloc((unsigned long)(sizeof(Dispatch) *font->num_ch));
+
+ if (table == NULL) {
+ (void) ClosePEXFontFile(fp);
+ return (BadAlloc); }
+
+ if (fread((char *) table, sizeof(Dispatch), font->num_ch, fp)
+ != font->num_ch) {
+ xfree((char *) table);
+ (void) ClosePEXFontFile(fp);
+ return (PEXERR(PEXFontError)); }
+
+ font->ch_data =
+ (Ch_stroke_data **) xalloc((unsigned long)(sizeof(Ch_stroke_data *) *
+ font->num_ch));
+ if (font->ch_data == NULL) {
+ xfree((char *) table);
+ (void) ClosePEXFontFile(fp);
+ return (BadAlloc); }
+
+ /* The next loop initializes all ch_data pointers to null; essential
+ for non-crashing during font clean-up in case of failed font file
+ read. Also count the number of non-blank chars.
+ */
+ for ( i = 0, ch_font = font->ch_data, tblptr = table, numChars = 0;
+ i < font->num_ch;
+ i++, ch_font++, tblptr++) {
+ *ch_font = NULL;
+ if (tblptr->offset != 0) numChars++; }
+
+ ch_stroke = (Ch_stroke_data *)xalloc((unsigned long)(numChars *
+ sizeof(Ch_stroke_data)));
+ if (!ch_stroke) {
+ err = BadAlloc;
+ goto disaster;
+ }
+
+ /* read in the char data (the font file format should be changed
+ so that the allocation can be done outside this loop--this
+ method is inefficient)
+ */
+ for ( i = 0, ch_font = font->ch_data, tblptr = table, found_first = 0;
+ i < font->num_ch;
+ i++, ch_font++, tblptr++) {
+ if (tblptr->offset != 0) {
+ (*ch_font) = ch_stroke++;
+ (*ch_font)->strokes.ddList = NULL;
+ (*ch_font)->center = table[i].center;
+ (*ch_font)->right = table[i].right;
+
+ (void) SetPEXFontFilePtr(fp, tblptr->offset);
+
+ /* read in the type, number of subpaths, and n_vertices fields */
+ if ( (fread(&((*ch_font)->type),
+ sizeof(Font_path_type), 1, fp) != 1)
+ || (fread(&((*ch_font)->strokes.numLists),
+ sizeof(ddULONG),1,fp) != 1)
+ || (fread(&((*ch_font)->n_vertices),
+ sizeof(ddULONG), 1, fp) != 1) )
+ {
+ err = PEXERR(PEXFontError);
+ goto disaster;
+ }
+
+ (*ch_font)->strokes.maxLists = (*ch_font)->strokes.numLists;
+ if ((*ch_font)->strokes.numLists > 0) {
+
+ if (get_stroke(*ch_font, fp)) {
+ err = BadAlloc;
+ goto disaster; }
+
+ if (!found_first) {
+ font->font_info.firstGlyph = i;
+ found_first = 1; }
+
+ font->font_info.lastGlyph = i; }
+ }
+ }
+
+ xfree((char *)table);
+
+ (void) ClosePEXFontFile(fp);
+
+ return (Success);
+
+disaster:
+ (void) ClosePEXFontFile(fp);
+ if (table) xfree(table);
+#if 0
+ if (pFont == defaultPEXFont) defaultPEXFont = 0; /* force free */
+#endif
+ FreePEXFont((diFontHandle) pFont, pFont->id);
+ return (err);
+
+}
+void
+ClosePEXFontFile(fp)
+ FILE *fp;
+{
+ fclose (fp);
+}
+
+void
+SetPEXFontFilePtr(fp,where)
+ FILE *fp;
+ long where;
+{
+ (void) fseek(fp, where, SEEK_SET); /* set pointer at "where" bytes
+ from the beginning of the file */
+}
diff --git a/xc/programs/Xserver/PEX5/pexmodule.c b/xc/programs/Xserver/PEX5/pexmodule.c
new file mode 100644
index 000000000..b87b93405
--- /dev/null
+++ b/xc/programs/Xserver/PEX5/pexmodule.c
@@ -0,0 +1,40 @@
+/* $XFree86: xc/programs/Xserver/PEX5/pexmodule.c,v 1.5 1999/01/26 05:53:47 dawes Exp $ */
+
+#include "xf86Module.h"
+#include "PEX.h"
+
+static MODULESETUPPROTO(pex5Setup);
+
+extern void PexExtensionInit(INITARGS);
+
+static ExtensionModule pex5Ext = {
+ PexExtensionInit,
+ PEX_NAME_STRING,
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "pex5",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+XF86ModuleData pex5ModuleData = { &VersRec, pex5Setup, NULL };
+
+static pointer
+pex5Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LoadExtension(&pex5Ext);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
diff --git a/xc/programs/Xserver/XFree86.def b/xc/programs/Xserver/XFree86.def
new file mode 100644
index 000000000..54d44c17f
--- /dev/null
+++ b/xc/programs/Xserver/XFree86.def
@@ -0,0 +1,5 @@
+NAME XFree86 NOTWINDOWCOMPAT
+DESCRIPTION "X11R6 XFree86 3.9N Xserver EMX09C"
+PROTMODE
+EXETYPE OS2
+
diff --git a/xc/programs/Xserver/XIE/Imakefile b/xc/programs/Xserver/XIE/Imakefile
new file mode 100644
index 000000000..b816f1dc4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/Imakefile
@@ -0,0 +1,69 @@
+XCOMM $XConsortium: Imakefile,v 1.3 93/11/07 10:56:36 rws Exp $
+XCOMM $XFree86: xc/programs/Xserver/XIE/Imakefile,v 3.16 1999/08/14 10:49:24 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+
+ SUBDIRS = dixie mixie
+MakeSubdirs($(SUBDIRS))
+
+#if DoLoadableServer
+MSRCS = xiemodule.c
+MOBJS = xiemodule.o
+
+DONES = \
+ dixie/export/DONE \
+ dixie/import/DONE \
+ dixie/process/DONE \
+ dixie/request/DONE \
+ mixie/control/DONE \
+ mixie/export/DONE \
+ mixie/fax/DONE \
+ mixie/import/DONE \
+ mixie/jpeg/DONE \
+ mixie/process/DONE
+
+SRCS = $(MSRCS)
+
+OBJS = \
+ dixie/export/?*.o \
+ dixie/import/?*.o \
+ dixie/process/?*.o \
+ dixie/request/?*.o \
+ mixie/control/?*.o \
+ mixie/export/?*.o \
+ mixie/fax/?*.o \
+ mixie/import/?*.o \
+ mixie/jpeg/?*.o \
+ mixie/process/?*.o \
+ $(MOBJS)
+
+INCLUDES = -Iinclude -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(EXTINCSRC)
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+#ifndef SCO325
+REQUIREDLIBS = -lm
+#endif
+
+ModuleObjectRule()
+DepLibraryModuleTarget(xie,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS))
+InstallLibraryModule(xie,$(MODULEDIR),extensions)
+ForceSubdirs($(SUBDIRS))
+
+DependTarget()
+
+#endif
+
+
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
+InstallDriverSDKLibraryModule(xie,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/xc/programs/Xserver/XIE/dixie/Imakefile b/xc/programs/Xserver/XIE/dixie/Imakefile
new file mode 100644
index 000000000..edb80d861
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/Imakefile
@@ -0,0 +1,31 @@
+XCOMM $XConsortium: Imakefile /main/6 1995/12/07 21:15:29 gildea $
+XCOMM $XFree86: xc/programs/Xserver/XIE/dixie/Imakefile,v 3.14 1999/04/29 09:13:37 dawes Exp $
+XCOMM build dixie archive
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SUBDIRS = request import process export
+OBJS = request/?*.o import/?*.o process/?*.o export/?*.o
+DONES = request/DONE import/DONE process/DONE export/DONE
+
+#define IHaveSubdirs
+
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+#if HasGnuMake || HasBsdMake
+$(DONES): $(SUBDIRS)
+#endif
+
+NormalDepLibraryTarget(dixie,$(SUBDIRS) $(DONES),$(OBJS))
+
+ForceSubdirs($(SUBDIRS))
+
+DependSubdirs($(SUBDIRS))
+
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
diff --git a/xc/programs/Xserver/XIE/dixie/export/Imakefile b/xc/programs/Xserver/XIE/dixie/export/Imakefile
new file mode 100644
index 000000000..ee98f587a
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/Imakefile
@@ -0,0 +1,32 @@
+XCOMM $XConsortium: Imakefile /main/6 1996/09/28 16:55:25 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/dixie/export/Imakefile,v 3.5 1998/07/25 08:05:06 dawes Exp $
+XCOMM build device independent export element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = eclut.c ecphoto.c edraw.c edrawp.c elut.c ephoto.c
+OBJS1 = eclut.o ecphoto.o edraw.o edrawp.o elut.o ephoto.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = echist.c ecroi.c eroi.c
+OBJS2 = echist.o ecroi.o eroi.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC)
+ LINTLIBS = ../export/llib-lexp.ln ../import/llib-limp.ln \
+ ../process/llib-lproc.ln ../request/llib-lreq.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(exp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/dixie/export/echist.c b/xc/programs/Xserver/XIE/dixie/export/echist.c
new file mode 100644
index 000000000..00e4028ad
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/echist.c
@@ -0,0 +1,198 @@
+/* $TOG: echist.c /main/4 1998/02/09 16:07:45 kaleb $ */
+/**** module echist.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ echist.c -- DIXIE routines for managing the ExportClientHistogram elem.
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/echist.c,v 3.3 1998/10/25 07:11:23 dawes Exp $ */
+
+#define _XIEC_ECHIST
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <error.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepECHistogram(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eHistogramVec = {
+ PrepECHistogram /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+-------------- routine: make an ExportClientHistogram element ------------
+------------------------------------------------------------------------*/
+peDefPtr MakeECHistogram(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportClientHistogram);
+ ELEMENT_SIZE_MATCH(xieFloExportClientHistogram);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ inputs = 1 + (stuff->domainPhototag ? 1 : 0);
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemExportClientHistogram, return(NULL));
+
+ ped->diVec = &eHistogramVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ ped->flags.getData = TRUE;
+ raw = (xieFloExportClientHistogram *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->notify = stuff->notify;
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportClientHistogram));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+ if(raw->domainPhototag)
+ inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+
+ return(ped);
+} /* end MakeECHistogram */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepECHistogram(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientHistogram *raw =
+ (xieFloExportClientHistogram *)ped->elemRaw;
+ inFloPtr ind, inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr outflo = &ped->outFlo;
+
+ /* check notify */
+ if(raw->notify != xieValDisable &&
+ raw->notify != xieValFirstData &&
+ raw->notify != xieValNewData)
+ ValueError(flo,ped,raw->notify, return(FALSE));
+
+ /* check out process domain */
+ if(raw->domainPhototag) {
+ outFloPtr dom;
+
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if((ind->bands = dom->bands) != 1 || IsntDomain(dom->format[0].class))
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ }
+
+ /* check and propagate src */
+ if (src->bands != 1 || IsntConstrained(src->format[0].class))
+ MatchError(flo,ped,return(FALSE));
+ inf->bands = 1;
+ inf->format[0] = src->format[0];
+
+ /* Don't really have an outflo */
+ outflo->bands = 1;
+ outflo->format[0] = inf->format[0];
+ outflo->format[0].class = STREAM;
+ ped->swapUnits[0] = sizeof(xieTypHistogramData);
+
+ return(TRUE);
+} /* end PrepECHistogram */
+
+/* end module echist.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/eclut.c b/xc/programs/Xserver/XIE/dixie/export/eclut.c
new file mode 100644
index 000000000..ef92f77f5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/eclut.c
@@ -0,0 +1,190 @@
+/* $TOG: eclut.c /main/5 1998/02/09 16:07:52 kaleb $ */
+/**** module eclut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ eclut.c -- DIXIE routines for managing the ExportClientLUT element
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/eclut.c,v 3.3 1998/10/25 07:11:23 dawes Exp $ */
+
+#define _XIEC_ECLUT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <lut.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepECLUT(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec eCLUTVec = {
+ PrepECLUT /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+--------------- routine: make an export client lut element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeECLUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloExportClientLUT);
+ ELEMENT_SIZE_MATCH(xieFloExportClientLUT);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemExportClientLUT, return(NULL)) ;
+
+ ped->diVec = &eCLUTVec;
+ ped->phototag = tag;
+ ped->flags.getData = TRUE;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportClientLUT *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->notify = stuff->notify;
+ raw->bandOrder = stuff->bandOrder;
+ cpswapl(stuff->start0, raw->start0);
+ cpswapl(stuff->start1, raw->start1);
+ cpswapl(stuff->start2, raw->start2);
+ cpswapl(stuff->length0, raw->length0);
+ cpswapl(stuff->length1, raw->length1);
+ cpswapl(stuff->length2, raw->length2);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportClientLUT));
+
+ /* assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeECLUT */
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepECLUT(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientLUT *raw = (xieFloExportClientLUT *)ped->elemRaw;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD32 *start = &(raw->start0);
+ CARD32 *length = &(raw->length0);
+ int b;
+
+ if(raw->notify != xieValDisable && /* check notify */
+ raw->notify != xieValFirstData &&
+ raw->notify != xieValNewData)
+ ValueError(flo,ped,raw->notify, return(FALSE));
+
+ if(raw->bandOrder != xieValLSFirst && /* check band-order */
+ raw->bandOrder != xieValMSFirst)
+ ValueError(flo,ped,raw->bandOrder, return(FALSE));
+
+ /* Validate and Propagate input attributes to our output */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; ++b) {
+ if (IsntLut(src->format[b].class))
+ FloSourceError(flo,raw->src,raw->elemType, return(FALSE));
+ if ( start[b] + length[b] > src->format[b].height )
+ MatchError(flo,ped, return(FALSE));
+
+ dst->format[b] = inf->format[b] = src->format[b];
+ ped->swapUnits[b] = LutPitch(dst->format[b].levels);
+ }
+ return(TRUE);
+} /* end PrepECLUT */
+
+
+/* end module eclut.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/ecphoto.c b/xc/programs/Xserver/XIE/dixie/export/ecphoto.c
new file mode 100644
index 000000000..6c6304c1b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/ecphoto.c
@@ -0,0 +1,698 @@
+/* $TOG: ecphoto.c /main/7 1998/02/09 16:07:57 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module ecphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ecphoto.c -- DIXIE routines for managing the ExportClientPhoto element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/ecphoto.c,v 3.4 1998/10/25 07:11:24 dawes Exp $ */
+
+#define _XIEC_ECPHOTO
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <technq.h>
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepECPhoto(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec eCPhotoVec = {
+ PrepECPhoto /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+--------------- routine: make an import client photo element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeECPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloExportClientPhoto);
+ ELEMENT_AT_LEAST_SIZE(xieFloExportClientPhoto);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(ePhotoDefRec))))
+ FloAllocError(flo,tag,xieElemExportClientPhoto, return(NULL)) ;
+
+ ped->diVec = &eCPhotoVec;
+ ped->phototag = tag;
+ ped->flags.getData = TRUE;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportClientPhoto *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->notify = stuff->notify;
+ cpswaps(stuff->encodeTechnique, raw->encodeTechnique);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportClientPhoto));
+
+ /* copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValEncode,raw->encodeTechnique))
+ || !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(ped));
+
+ /* assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeECPhoto */
+
+#undef sparms
+#define sparms ((xieTecEncodeUncompressedSingle *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeUncompressedSingle *)rParms)
+
+Bool CopyECPhotoUnSingle(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeG31D *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeG31D *)rParms)
+
+Bool CopyECPhotoG31D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeG32D *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeG32D *)rParms)
+
+Bool CopyECPhotoG32D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if( flo->reqClient->swapped ) {
+ rparms->radiometric = sparms->radiometric;
+ rparms->uncompressed = sparms->uncompressed;
+ rparms->alignEol = sparms->alignEol;
+ rparms->encodedOrder = sparms->encodedOrder;
+ cpswapl(sparms->kFactor, rparms->kFactor);
+ } else
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeG42D *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeG42D *)rParms)
+
+Bool CopyECPhotoG42D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeTIFF2 *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeTIFF2 *)rParms)
+
+Bool CopyECPhotoTIFF2(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeTIFFPackBits *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeTIFFPackBits *)rParms)
+
+Bool CopyECPhotoTIFFPackBits(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeUncompressedTriple *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeUncompressedTriple *)rParms)
+
+#if XIE_FULL
+Bool CopyECPhotoUnTriple(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeJPEGBaseline *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeJPEGBaseline *)rParms)
+
+Bool CopyECPhotoJPEGBaseline(TECHNQ_COPY_ARGS)
+{
+ eTecEncodeJPEGBaselineDefPtr pvt;
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ if( flo->reqClient->swapped ) {
+ register int n;
+ swaps(&rparms->lenQtable,n);
+ swaps(&rparms->lenACtable,n);
+ swaps(&rparms->lenDCtable,n);
+ }
+ if(rparms->lenQtable & 3 ||
+ rparms->lenACtable & 3 ||
+ rparms->lenDCtable & 3)
+ return(FALSE);
+
+ if(!(ped->techPvt=(pointer)XieMalloc(sizeof(eTecEncodeJPEGBaselineDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemExportClientPhoto, return(TRUE));
+
+ pvt = (eTecEncodeJPEGBaselineDefPtr)ped->techPvt;
+ pvt->q = (rparms->lenQtable
+ ? (CARD8 *)rparms + sizeof(xieTecEncodeJPEGBaseline)
+ : (CARD8 *) NULL);
+ pvt->a = (rparms->lenACtable
+ ? (CARD8 *)rparms + sizeof(xieTecEncodeJPEGBaseline)
+ + rparms->lenQtable
+ : (CARD8 *) NULL);
+ pvt->d = (rparms->lenDCtable
+ ? (CARD8 *)rparms + sizeof(xieTecEncodeJPEGBaseline)
+ + rparms->lenQtable + rparms->lenACtable
+ : (CARD8 *) NULL);
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecEncodeJPEGLossless *)sParms)
+#undef rparms
+#define rparms ((xieTecEncodeJPEGLossless *)rParms)
+
+#ifdef BEYOND_SI
+Bool CopyECPhotoJPEGLossless(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ memcpy((char *)rparms, (char *)sparms, tsize<<2);
+
+ if( flo->reqClient->swapped ) {
+ register int n;
+ swaps(&rparms->lenTable,n);
+ }
+ return(TRUE);
+}
+#endif /* BEYOND_SI */
+#endif
+
+#undef sparms
+#undef rparms
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepECPhoto(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientPhoto *raw = (xieFloExportClientPhoto *)ped->elemRaw;
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* Make sure notify value is valid
+ */
+ if(raw->notify != xieValDisable &&
+ raw->notify != xieValFirstData &&
+ raw->notify != xieValNewData)
+ ValueError(flo,ped,raw->notify, return(FALSE));
+
+ pvt->congress = FALSE;
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ if (IsntConstrained(src->format[b].class))
+ MatchError(flo, ped, return(FALSE));
+ dst->format[b] = inf->format[b] = src->format[b];
+ }
+ if(!(ped->techVec->prepfnc(flo, ped, &raw[1])))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(FALSE));
+
+ pvt->encodeNumber = raw->encodeTechnique;
+ pvt->encodeLen = raw->lenParams << 2;
+ pvt->encodeParms = (pointer)&raw[1];
+
+ if(ped->inFloLst[IMPORT].srcDef->flags.import) {
+ /*
+ * see if import data can leap-frog the import and export elements
+ */
+ if(BuildDecodeFromEncode(flo,ped) && CompareDecode(flo,ped)) {
+ inFloPtr import = &inf->srcDef->inFloLst[IMPORT];
+
+ inf->bands = import->bands;
+ for(b = 0; b < import->bands; ++b)
+ inf->format[b] = import->format[b];
+ pvt->congress = TRUE;
+ }
+ if(pvt->decodeParms)
+ pvt->decodeParms = (pointer)XieFree(pvt->decodeParms);
+ }
+ return(TRUE);
+} /* end PrepECPhoto */
+
+
+/*------------------------------------------------------------------------
+----- routines: verify technique parameters against element parameters ----
+-------------- and prepare for analysis and execution ----
+------------------------------------------------------------------------*/
+
+/* Prep routine for uncompressed single band data */
+Bool PrepECPhotoUnSingle(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeUncompressedSingle *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+ CARD32 padmod = tec->scanlinePad * 8;
+ CARD32 pitch = tec->pixelStride * dst->format[0].width;
+ BOOL aligned = !(tec->pixelStride & (tec->pixelStride-1)) ||
+ tec->pixelStride == 24;
+
+ if(tec->fillOrder != xieValLSFirst && /* check fill-order */
+ tec->fillOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelOrder != xieValLSFirst && /* check pixel-order */
+ tec->pixelOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelStride < dst->format[0].depth) /* check pixel-stride */
+ return(FALSE);
+ if(ALIGNMENT == xieValAlignable && /* scanline alignment */
+ !tec->scanlinePad && !aligned)
+ return(FALSE);
+ if(tec->scanlinePad & (tec->scanlinePad-1) || /* check scanline-pad */
+ tec->scanlinePad > 16)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+ dst->format[0].stride = tec->pixelStride;
+ dst->format[0].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+
+ return(TRUE);
+} /* PrepECPhotoUnSingle */
+
+Bool PrepECPhotoG31D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG31D *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoG31D */
+
+Bool PrepECPhotoG32D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG32D *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoG32D */
+
+Bool PrepECPhotoG42D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG42D *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoG42D */
+
+Bool PrepECPhotoTIFF2(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeTIFF2 *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoTIFF2 */
+
+Bool PrepECPhotoTIFFPackBits(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeTIFFPackBits *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ dst->format[0].interleaved = FALSE;
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+} /* PrepECPhotoTIFFPackBits */
+
+#if XIE_FULL
+/* Prep routine for uncompressed triple band data */
+Bool PrepECPhotoUnTriple(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeUncompressedTriple *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ if(tec->fillOrder != xieValLSFirst && /* check fill-order */
+ tec->fillOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelOrder != xieValLSFirst && /* check pixel-order */
+ tec->pixelOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->bandOrder != xieValLSFirst && /* check band-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+ if (tec->interleave == xieValBandByPixel && /* check inter-band dim */
+ (dst->format[0].width != dst->format[1].width ||
+ dst->format[1].width != dst->format[2].width ||
+ dst->format[0].height != dst->format[1].height ||
+ dst->format[1].height != dst->format[2].height))
+ return(FALSE);
+ if (tec->interleave == xieValBandByPixel) {
+ CARD32 padmod = tec->scanlinePad[0] * 8;
+ CARD32 pitch = tec->pixelStride[0] * dst->format[0].width;
+
+ if (tec->pixelStride[0] <
+ dst->format[0].depth + dst->format[1].depth + dst->format[2].depth ||
+ dst->format[0].depth > 16 ||
+ dst->format[1].depth > 16 ||
+ dst->format[2].depth > 16)
+ return(FALSE);
+ if(tec->scanlinePad[0] & (tec->scanlinePad[0]-1) || /*check scanln-pad*/
+ tec->scanlinePad[0] > 16)
+ return(FALSE);
+
+ dst->bands = 1;
+ dst->format[0].interleaved = TRUE;
+ dst->format[0].class = STREAM;
+ dst->format[0].stride = tec->pixelStride[0];
+ dst->format[0].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+ } else {
+ if(tec->pixelStride[0] < dst->format[0].depth || /* check pixel-stride */
+ tec->pixelStride[1] < dst->format[1].depth ||
+ tec->pixelStride[2] < dst->format[2].depth)
+ return(FALSE);
+ for (b = 0; b < 3; b++) {
+ CARD32 padmod = tec->scanlinePad[b] * 8;
+ CARD32 pitch = tec->pixelStride[b] * dst->format[b].width;
+
+ if(dst->format[b].depth > 16) /* check pixel-depth */
+ return(FALSE);
+ if(tec->scanlinePad[b] & (tec->scanlinePad[b]-1) || /*check scanln-pad*/
+ tec->scanlinePad[b] > 16)
+ return(FALSE);
+
+ dst->format[b].interleaved = FALSE;
+ dst->format[b].class = STREAM;
+ dst->format[b].stride = tec->pixelStride[b];
+ dst->format[b].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+ }
+ }
+
+ return(TRUE);
+} /* PrepECPhotoUnTriple */
+
+Bool PrepECPhotoJPEGBaseline(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGBaseline *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+
+ if (dst->bands == 1)
+ dst->format[0].interleaved = FALSE;
+ else {
+ if(tec->bandOrder != xieValLSFirst && /* check encoding-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+
+ dst->format[0].interleaved =
+ dst->format[1].interleaved =
+ dst->format[2].interleaved =
+ (tec->interleave == xieValBandByPixel);
+
+ if (tec->interleave == xieValBandByPixel)
+ dst->bands = 1;
+ else {
+ dst->format[1].class = STREAM;
+ dst->format[2].class = STREAM;
+ }
+ }
+
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoJPEGBaseline */
+
+#ifdef BEYOND_SI
+Bool PrepECPhotoJPEGLossless(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGLossless *tec)
+{
+ outFloPtr dst = &ped->outFlo;
+ CARD8 pred;
+
+ if ((pred = tec->predictor[0]) != xieValPredictorNone &&
+ pred != xieValPredictorA &&
+ pred != xieValPredictorB &&
+ pred != xieValPredictorC &&
+ pred != xieValPredictorABC &&
+ pred != xieValPredictorABC2 &&
+ pred != xieValPredictorBAC2 &&
+ pred != xieValPredictorAB2)
+ return(FALSE);
+
+ if (dst->bands == 1)
+ dst->format[0].interleaved = FALSE;
+ else {
+ if(tec->bandOrder != xieValLSFirst && /* check encoding-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+
+ if ((pred = tec->predictor[1]) != xieValPredictorNone &&
+ pred != xieValPredictorA &&
+ pred != xieValPredictorB &&
+ pred != xieValPredictorC &&
+ pred != xieValPredictorABC &&
+ pred != xieValPredictorABC2 &&
+ pred != xieValPredictorBAC2 &&
+ pred != xieValPredictorAB2)
+ return(FALSE);
+
+ if ((pred = tec->predictor[2]) != xieValPredictorNone &&
+ pred != xieValPredictorA &&
+ pred != xieValPredictorB &&
+ pred != xieValPredictorC &&
+ pred != xieValPredictorABC &&
+ pred != xieValPredictorABC2 &&
+ pred != xieValPredictorBAC2 &&
+ pred != xieValPredictorAB2)
+ return(FALSE);
+
+ dst->format[0].interleaved =
+ dst->format[1].interleaved =
+ dst->format[2].interleaved =
+ (tec->interleave == xieValBandByPixel);
+
+ if (tec->interleave == xieValBandByPixel)
+ dst->bands = 1;
+ else {
+ dst->format[1].class = STREAM;
+ dst->format[2].class = STREAM;
+ }
+ }
+
+ dst->format[0].class = STREAM;
+
+ return(TRUE);
+
+} /* PrepECPhotoJPEGLossless */
+#endif /* BEYOND_SI */
+#endif
+
+/* end module ecphoto.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/ecroi.c b/xc/programs/Xserver/XIE/dixie/export/ecroi.c
new file mode 100644
index 000000000..9dac44906
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/ecroi.c
@@ -0,0 +1,176 @@
+/* $TOG: ecroi.c /main/5 1998/02/09 16:08:02 kaleb $ */
+/**** module ecroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ecroi.c -- DIXIE routines for managing the ExportClientROI element
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/ecroi.c,v 3.3 1998/10/25 07:11:24 dawes Exp $ */
+
+#define _XIEC_ECROI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <roi.h>
+#include <error.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepECROI(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eROIVec = {
+ PrepECROI /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportClientROI element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeECROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportClientROI);
+ ELEMENT_AT_LEAST_SIZE(xieFloExportClientROI);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemExportClientROI, return(NULL));
+
+ ped->diVec = &eROIVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ ped->flags.getData = TRUE;
+ raw = (xieFloExportClientROI *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->notify = stuff->notify;
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportClientROI));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeECROI */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepECROI(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientROI *raw = (xieFloExportClientROI *)ped->elemRaw;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+
+ /* Make sure notify value is valid
+ */
+ if(raw->notify != xieValDisable &&
+ raw->notify != xieValFirstData &&
+ raw->notify != xieValNewData)
+ ValueError(flo,ped,raw->notify, return(FALSE));
+
+ /* Validate and Propagate input attributes to our output */
+ if (src->bands != 1 || src->format[0].class != RUN_LENGTH)
+ FloSourceError(flo,raw->src,raw->elemType, return(FALSE));
+
+ dst->bands = inf->bands = src->bands;
+ dst->format[0] = inf->format[0] = src->format[0];
+ ped->swapUnits[0] = sizeof(xieTypRectangle);
+
+ return(TRUE);
+} /* end PrepECROI */
+
+/* end module ecroi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/edraw.c b/xc/programs/Xserver/XIE/dixie/export/edraw.c
new file mode 100644
index 000000000..7b5663fa6
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/edraw.c
@@ -0,0 +1,259 @@
+/* $TOG: edraw.c /main/5 1998/02/09 16:08:10 kaleb $ */
+/**** module edraw.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ edraw.c -- DIXIE routines for managing the ExportDrawable element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/edraw.c,v 3.3 1998/10/25 07:11:24 dawes Exp $ */
+
+#define _XIEC_EDRAW
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * more X server includes.
+ */
+#include <pixmapstr.h>
+#include <gcstruct.h>
+#include <scrnintstr.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepEDraw(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eDrawVec = {
+ PrepEDraw /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportDrawable element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeEDraw(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inflo;
+ ELEMENT(xieFloExportDrawable);
+ ELEMENT_SIZE_MATCH(xieFloExportDrawable);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(eDrawDefRec))))
+ FloAllocError(flo,tag,xieElemExportDrawable, return(NULL));
+
+ ped->diVec = &eDrawVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportDrawable *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswaps(stuff->dstX, raw->dstX);
+ cpswaps(stuff->dstY, raw->dstY);
+ cpswapl(stuff->drawable, raw->drawable);
+ cpswapl(stuff->gc, raw->gc);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportDrawable));
+ /*
+ * assign phototags to inFlos
+ */
+ inflo = ped->inFloLst;
+ inflo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeEDraw */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepEDraw(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportDrawable *raw = (xieFloExportDrawable *) ped->elemRaw;
+ eDrawDefPtr pvt = (eDrawDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ formatPtr df = &dst->format[0];
+ CARD32 f, right_padm1;
+ /*
+ * check out drawable and gc
+ */
+ if(!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&(pvt->pDraw),&(pvt->pGC)))
+ return(FALSE);
+ /*
+ * check for: constrained, single-band, and levels matching drawable depth
+ */
+ if(IsntConstrained(src->format[0].class) ||
+ src->bands != 1 || pvt->pDraw->depth != src->format[0].depth)
+ MatchError(flo,ped, return(FALSE));
+ /*
+ * grab a copy of the input attributes and propagate them to our output
+ */
+ dst->bands = inf->bands = src->bands;
+ df[0] = inf->format[0] = src->format[0];
+
+ /* search for the stride and pitch requirements that match our depth
+ */
+ for(f = 0; (f < screenInfo.numPixmapFormats &&
+ df[0].depth != screenInfo.formats[f].depth); ++f);
+ if(f == screenInfo.numPixmapFormats)
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ right_padm1 = screenInfo.formats[f].scanlinePad - 1;
+ df[0].stride = screenInfo.formats[f].bitsPerPixel;
+ df[0].pitch = (df[0].width * df[0].stride + right_padm1) & ~right_padm1;
+
+ return(TRUE);
+} /* end PrepEDraw */
+
+/*------------------------------------------------------------------------
+--- callable version of GetGCAndDrawableAndValidate (from extension.h) ---
+--- made callable because the macro version returned standard X errors ---
+------------------------------------------------------------------------*/
+Bool DrawableAndGC(
+ floDefPtr flo,
+ peDefPtr ped,
+ Drawable draw_id,
+ GContext gc_id,
+ DrawablePtr *draw_ret,
+ GCPtr *gc_ret)
+{
+ register ClientPtr client = flo->runClient;
+ register DrawablePtr draw;
+ register GCPtr gc;
+
+ if(client->clientGone) AccessError(flo,ped, return(FALSE));
+
+ if((client->lastDrawableID != draw_id) ||
+ (client->lastGCID != gc_id)) {
+ if(client->lastDrawableID != draw_id)
+ draw = (DrawablePtr)LookupIDByClass(draw_id, RC_DRAWABLE);
+ else
+ draw = client->lastDrawable;
+ if(client->lastGCID != gc_id)
+ gc = (GCPtr)LookupIDByType(gc_id, RT_GC);
+ else
+ gc = client->lastGC;
+ if(draw && gc) {
+ if((draw->type == UNDRAWABLE_WINDOW) ||
+ (gc->depth != draw->depth) ||
+ (gc->pScreen != draw->pScreen))
+ MatchError(flo,ped, return(FALSE));
+
+ client->lastDrawable = draw;
+ client->lastDrawableID = draw_id;
+ client->lastGC = gc;
+ client->lastGCID = gc_id;
+ }
+ } else {
+ gc = client->lastGC;
+ draw = client->lastDrawable;
+ }
+ if(!draw) {
+ client->errorValue = draw_id;
+ DrawableError(flo,ped,draw_id, return(FALSE));
+ }
+ if(!gc) {
+ client->errorValue = gc_id;
+ GCError(flo,ped,gc_id, return(FALSE));
+ }
+ if(gc->serialNumber != draw->serialNumber)
+ ValidateGC(draw, gc);
+
+ *draw_ret = draw;
+ *gc_ret = gc;
+
+ return(TRUE);
+} /* end DrawableAndGC */
+
+/* end module edraw.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/edrawp.c b/xc/programs/Xserver/XIE/dixie/export/edrawp.c
new file mode 100644
index 000000000..93168c21f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/edrawp.c
@@ -0,0 +1,185 @@
+/* $TOG: edrawp.c /main/5 1998/02/09 16:08:06 kaleb $ */
+/**** module edrawp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ edrawp.c -- DIXIE routines for managing the ExportDrawablePlane element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/edrawp.c,v 3.3 1998/10/25 07:11:25 dawes Exp $ */
+
+#define _XIEC_EDRAWP
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * more X server includes.
+ */
+#include <pixmapstr.h>
+#include <gcstruct.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <error.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepEDrawPlane(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eDrawPlaneVec = {
+ PrepEDrawPlane /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+--------------- routine: make an ExportDrawablePlane element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeEDrawPlane(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportDrawablePlane);
+ ELEMENT_SIZE_MATCH(xieFloExportDrawablePlane);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2,
+ sizeof(eDrawPDefRec))))
+ FloAllocError(flo,tag,xieElemExportDrawablePlane, return(NULL));
+
+ ped->diVec = &eDrawPlaneVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportDrawablePlane *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswaps(stuff->dstX, raw->dstX);
+ cpswaps(stuff->dstY, raw->dstY);
+ cpswapl(stuff->drawable, raw->drawable);
+ cpswapl(stuff->gc, raw->gc);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportDrawablePlane));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeEDrawPlane */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepEDrawPlane(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportDrawablePlane *raw = (xieFloExportDrawablePlane *)ped->elemRaw;
+ eDrawPDefPtr pvt = (eDrawPDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ /*
+ * check out drawable and gc
+ */
+ if(!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&(pvt->pDraw),&(pvt->pGC)))
+ return(FALSE);
+ /*
+ * check for: constrained, single-band, bitonal image
+ */
+ if( (src->format[0].class != BIT_PIXEL) || (src->bands != 1))
+ MatchError(flo,ped, return(FALSE));
+ /*
+ * grab a copy of the input attributes and propagate them to our output
+ */
+ dst->bands = inf->bands = src->bands;
+ dst->format[0] = inf->format[0] = src->format[0];
+
+ return(TRUE);
+} /* end PrepEDrawplane */
+
+/* end module edrawp.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/elut.c b/xc/programs/Xserver/XIE/dixie/export/elut.c
new file mode 100644
index 000000000..1791c58fc
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/elut.c
@@ -0,0 +1,246 @@
+/* $TOG: elut.c /main/5 1998/02/09 16:08:15 kaleb $ */
+/**** module elut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ elut.c -- DIXIE routines for managing the ExportLUT element
+
+ Larry Hare -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/elut.c,v 3.3 1998/10/25 07:11:25 dawes Exp $ */
+
+#define _XIEC_ELUT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <lut.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepELUT(floDefPtr flo, peDefPtr ped);
+static Bool DebriefELUT(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eLUTVec = {
+ PrepELUT,
+ DebriefELUT
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportLUT element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeELUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportLUT);
+ ELEMENT_SIZE_MATCH(xieFloExportLUT);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(eLUTDefRec))))
+ FloAllocError(flo,tag,xieElemExportLUT, return(NULL));
+
+ ped->diVec = &eLUTVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportLUT *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ raw->merge = stuff->merge;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->lut, raw->lut);
+ cpswapl(stuff->start0, raw->start0);
+ cpswapl(stuff->start1, raw->start1);
+ cpswapl(stuff->start2, raw->start2);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportLUT));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeELUT */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepELUT(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportLUT *raw = (xieFloExportLUT *)ped->elemRaw;
+ eLUTDefPtr pvt = (eLUTDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD32 *start = &(raw->start0);
+ lutPtr lut;
+ CARD32 b, oops;
+
+ /* find the LUT resource and bind it to our flo */
+ if(!(lut = pvt->lut = (lutPtr) LookupIDByType(raw->lut, RT_LUT)))
+ LUTError(flo,ped,raw->lut, return(FALSE));
+
+ ++pvt->lut->refCnt;
+ if(!raw->merge && ((oops=start[0]) || (oops=start[1]) || (oops=start[2])))
+ ValueError(flo, ped, oops, return(FALSE));
+
+ /* Validate and Propagate input attributes to our output */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; ++b) {
+ if (IsntLut(src->format[b].class))
+ FloSourceError(flo,raw->src,raw->elemType, return(FALSE));
+ if (raw->merge) {
+ if ( (src->format[b].levels != lut->format[b].level) ||
+ (start[b] + src->format[b].height > lut->format[b].length) )
+ MatchError(flo, ped, return(FALSE));
+ }
+ dst->format[b] = inf->format[b] = src->format[b];
+ }
+ return(TRUE);
+} /* end PrepELUT */
+
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefELUT(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloExportLUT *raw = (xieFloExportLUT *)ped->elemRaw;
+ eLUTDefPtr pvt = (eLUTDefPtr) ped->elemPvt;
+ lutPtr lut;
+ CARD32 b;
+
+ if(!(pvt && (lut = pvt->lut))) return(FALSE);
+
+ if(ok && lut->refCnt > 1) {
+
+ if (raw->merge) {
+ CARD32 *start = &(raw->start0);
+ for(b = 0; b < lut->lutCnt; b++) {
+ int nbytes = LutPitch(lut->format[b].level);
+ memcpy(lut->strips[b].flink->data + start[b] * nbytes,
+ ped->outFlo.output[b].flink->data,
+ ped->outFlo.output[b].flink->length * nbytes);
+ } /* transient strips freed below */
+ } else {
+ /* free old LUT data */
+ for(b = 0; b < lut->lutCnt; b++)
+ FreeStrips(&lut->strips[b]);
+
+ /* stash our new attributes and data into the LUT */
+ lut->lutCnt = ped->outFlo.bands;
+ for(b = 0; b < lut->lutCnt; ++b) {
+ lut->format[b].bandOrder = ped->outFlo.format[b].width; /* hack */
+ lut->format[b].length = ped->outFlo.format[b].height; /* hack */
+ lut->format[b].level = ped->outFlo.format[b].levels;
+ DebriefStrips(&ped->outFlo.output[b],&lut->strips[b]);
+ }
+ }
+ }
+ /* free image data that's left over on our outFlo
+ */
+ for(b = 0; b < ped->outFlo.bands; b++)
+ FreeStrips(&ped->outFlo.output[b]);
+
+ /* unbind ourself from the LUT
+ */
+ if(lut->refCnt > 1)
+ --lut->refCnt;
+ else if(LookupIDByType(raw->lut, RT_LUT))
+ FreeResourceByType(lut->ID, RT_LUT, RT_NONE);
+ else
+ DeleteLUT(lut, lut->ID);
+
+ return(TRUE);
+} /* end DebriefELUT */
+
+/* end module elut.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/ephoto.c b/xc/programs/Xserver/XIE/dixie/export/ephoto.c
new file mode 100644
index 000000000..43f3956bb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/ephoto.c
@@ -0,0 +1,594 @@
+/* $TOG: ephoto.c /main/8 1998/02/09 16:08:20 kaleb $ */
+/**** module ephoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ephoto.c -- DIXIE routines for managing the ExportPhotomap element
+
+ Robert NC Shelley && Dean Verheiden -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/ephoto.c,v 3.4 1998/10/25 07:11:25 dawes Exp $ */
+
+#define _XIEC_EPHOTO
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * more X server includes.
+ */
+#include <servermd.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <flo.h>
+#include <photomap.h>
+#include <element.h>
+#include <technq.h>
+#include <tables.h> /* For Server Choice function */
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool CopyEPhotoServerChoice(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeServerChoice *sparms,
+ xieTecEncodeServerChoice *rparms,
+ CARD16 tsize);
+static Bool PrepEPhoto(floDefPtr flo, peDefPtr ped);
+static Bool DebriefEPhoto(floDefPtr flo, peDefPtr ped, Bool ok);
+
+extern pointer GetImportTechnique();
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec ePhotoVec = {
+ PrepEPhoto,
+ DebriefEPhoto
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportPhotomap element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeEPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportPhotomap);
+ ELEMENT_AT_LEAST_SIZE(xieFloExportPhotomap);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(ePhotoDefRec))))
+ FloAllocError(flo,tag,xieElemExportPhotomap, return(NULL));
+
+ ped->diVec = &ePhotoVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportPhotomap *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->photomap, raw->photomap);
+ cpswaps(stuff->encodeTechnique, raw->encodeTechnique);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportPhotomap));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ /*
+ * copy technique data (if any)
+ */
+ if (raw->encodeTechnique == xieValEncodeServerChoice) {
+ if (!CopyEPhotoServerChoice(flo, ped,
+ (xieTecEncodeServerChoice *) &stuff[1],
+ (xieTecEncodeServerChoice *) &raw[1],
+ raw->lenParams))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(ped));
+ } else if (!(ped->techVec = FindTechnique(xieValEncode,raw->encodeTechnique))
+ || !(ped->techVec->copyfnc(flo,ped,&stuff[1],&raw[1],raw->lenParams,0)))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(ped));
+
+ return(ped);
+} /* end MakeEPhoto */
+
+static Bool CopyEPhotoServerChoice(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeServerChoice *sparms,
+ xieTecEncodeServerChoice *rparms,
+ CARD16 tsize)
+{
+ if(tsize == 1)
+ rparms->preference = sparms->preference;
+
+ return(tsize <= 1);
+}
+
+/* All other technique-specific copy routines are defined in ecphoto.c */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepEPhoto(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportPhotomap *raw = (xieFloExportPhotomap *)ped->elemRaw;
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr dst = &ped->outFlo;
+ xieBoolProc scPrep;
+ CARD32 b;
+
+ /* find the photomap resource and bind it to our flo
+ */
+ if(!(pvt->map = (photomapPtr) LookupIDByType(raw->photomap, RT_PHOTOMAP)))
+ PhotomapError(flo,ped,raw->photomap, return(FALSE));
+ ++pvt->map->refCnt;
+
+ pvt->congress = FALSE;
+ if(raw->encodeTechnique == xieValEncodeServerChoice) {
+ if(!(scPrep = ((xieBoolProc (*)())
+ DDInterface[DDServerChoiceIndex]) (flo, ped)))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(FALSE));
+ } else {
+ /* grab a copy of the input attributes and propagate them to our output
+ */
+ outFloPtr src = &inf->srcDef->outFlo;
+ for(b = 0; b < src->bands; ++b) {
+ if(IsntCanonic(src->format[b].class))
+ MatchError(flo,ped, return(FALSE));
+ dst->format[b] = inf->format[b] = src->format[b];
+ dst->bands = inf->bands = src->bands;
+ /* dst->bands will be 1 if we encode TripleBand interleaved BandByPixel */
+ }
+ scPrep = (xieBoolProc)NULL;
+ }
+
+ /* do technique-specific preparations
+ */
+ if(scPrep) {
+ if (!(*scPrep)(flo,ped))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,
+ raw->lenParams, return(FALSE));
+ } else {
+ if(!(ped->techVec->prepfnc(flo, ped, &raw[1])))
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,raw->lenParams,
+ return(FALSE));
+
+ pvt->encodeNumber = raw->encodeTechnique;
+ pvt->encodeLen = raw->lenParams << 2;
+ pvt->encodeParms = (pointer)&raw[1];
+
+ if(!BuildDecodeFromEncode(flo,ped))
+ AllocError(flo,ped, return(FALSE));
+
+ /* see if import data can leap-frog the import and export elements
+ */
+ if(ped->inFloLst[IMPORT].srcDef->flags.import && CompareDecode(flo,ped)) {
+ inFloPtr import = &inf->srcDef->inFloLst[IMPORT];
+
+ /* copy smuggled data attributes to our inFlo */
+ inf->bands = import->bands;
+ for(b = 0; b < import->bands; ++b)
+ inf->format[b] = import->format[b];
+ pvt->congress = TRUE;
+ }
+ }
+ return(TRUE);
+} /* end PrepEPhoto */
+
+/* All technique-specific prep routines are defined in ecphoto.c */
+
+Bool BuildDecodeFromEncode(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ /* Based on the encode technique, build a correspoinding decode technique */
+ switch(pvt->encodeNumber) {
+ case xieValEncodeUncompressedSingle:
+ {
+ xieTecEncodeUncompressedSingle *etec =
+ (xieTecEncodeUncompressedSingle *)pvt->encodeParms;
+ xieTecDecodeUncompressedSingle *dtec;
+
+ if (!(dtec = (xieTecDecodeUncompressedSingle *)
+ XieMalloc(sizeof(xieTecDecodeUncompressedSingle))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeUncompressedSingle;
+ pvt->decodeLen = sizeof(xieTecDecodeUncompressedSingle);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->fillOrder = etec->fillOrder;
+ dtec->pixelOrder = etec->pixelOrder;
+ dtec->pixelStride = etec->pixelStride;
+ dtec->leftPad = 0;
+ dtec->scanlinePad = etec->scanlinePad;
+ }
+ break;
+ case xieValEncodeUncompressedTriple:
+ {
+ xieTecEncodeUncompressedTriple *etec =
+ (xieTecEncodeUncompressedTriple *)pvt->encodeParms;
+ xieTecDecodeUncompressedTriple *dtec;
+ int i;
+
+ if (!(dtec = (xieTecDecodeUncompressedTriple *)
+ XieMalloc(sizeof(xieTecDecodeUncompressedTriple))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeUncompressedTriple;
+ pvt->decodeLen = sizeof(xieTecDecodeUncompressedTriple);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->fillOrder = etec->fillOrder;
+ dtec->pixelOrder = etec->pixelOrder;
+ dtec->bandOrder = etec->bandOrder;
+ dtec->interleave = etec->interleave;
+ for (i = 0; i < 3; i++) {
+ dtec->leftPad[i] = 0;
+ dtec->pixelStride[i] = etec->pixelStride[i];
+ dtec->scanlinePad[i] = etec->scanlinePad[i];
+ }
+ }
+ break;
+ case xieValEncodeG31D:
+ {
+ xieTecEncodeG31D *etec = (xieTecEncodeG31D *)pvt->encodeParms;
+ xieTecDecodeG31D *dtec;
+
+ if (!(dtec = (xieTecDecodeG31D *)
+ XieMalloc(sizeof(xieTecDecodeG31D))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeG31D;
+ pvt->decodeLen = sizeof(xieTecDecodeG31D);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->normal = TRUE;
+ dtec->radiometric = etec->radiometric;
+ dtec->encodedOrder = etec->encodedOrder;
+ }
+ break;
+ case xieValEncodeG32D:
+ {
+ xieTecEncodeG32D *etec = (xieTecEncodeG32D *)pvt->encodeParms;
+ xieTecDecodeG32D *dtec;
+
+ if (!(dtec = (xieTecDecodeG32D *)
+ XieMalloc(sizeof(xieTecDecodeG32D))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeG32D;
+ pvt->decodeLen = sizeof(xieTecDecodeG32D);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->normal = TRUE;
+ dtec->radiometric = etec->radiometric;
+ dtec->encodedOrder = etec->encodedOrder;
+ }
+ break;
+ case xieValEncodeG42D:
+ {
+ xieTecEncodeG42D *etec = (xieTecEncodeG42D *)pvt->encodeParms;
+ xieTecDecodeG42D *dtec;
+
+ if (!(dtec = (xieTecDecodeG42D *)
+ XieMalloc(sizeof(xieTecDecodeG42D))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeG42D;
+ pvt->decodeLen = sizeof(xieTecDecodeG42D);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->normal = TRUE;
+ dtec->radiometric = etec->radiometric;
+ dtec->encodedOrder = etec->encodedOrder;
+ }
+ break;
+ case xieValEncodeJPEGBaseline:
+ {
+ xieTecEncodeJPEGBaseline *etec =
+ (xieTecEncodeJPEGBaseline *)pvt->encodeParms;
+ xieTecDecodeJPEGBaseline *dtec;
+
+ if (!(dtec = (xieTecDecodeJPEGBaseline *)
+ XieMalloc(sizeof(xieTecDecodeJPEGBaseline))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeJPEGBaseline;
+ pvt->decodeLen = sizeof(xieTecDecodeJPEGBaseline);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->interleave = etec->interleave;
+ dtec->upSample = etec->interleave == xieValBandByPixel;
+ dtec->bandOrder = etec->bandOrder;
+ }
+ break;
+ case xieValEncodeTIFF2:
+ {
+ xieTecEncodeTIFF2 *etec = (xieTecEncodeTIFF2 *)pvt->encodeParms;
+ xieTecDecodeTIFF2 *dtec;
+
+ if (!(dtec = (xieTecDecodeTIFF2 *)
+ XieMalloc(sizeof(xieTecDecodeTIFF2))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeTIFF2;
+ pvt->decodeLen = sizeof(xieTecDecodeTIFF2);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->normal = TRUE;
+ dtec->radiometric = etec->radiometric;
+ dtec->encodedOrder = etec->encodedOrder;
+ }
+ break;
+ case xieValEncodeTIFFPackBits:
+ {
+ xieTecEncodeTIFFPackBits *etec =
+ (xieTecEncodeTIFFPackBits *)pvt->encodeParms;
+ xieTecDecodeTIFFPackBits *dtec;
+
+ if (!(dtec = (xieTecDecodeTIFFPackBits *)
+ XieMalloc(sizeof(xieTecDecodeTIFFPackBits))))
+ AllocError(flo,ped, return(FALSE));
+ pvt->decodeNumber = xieValDecodeTIFFPackBits;
+ pvt->decodeLen = sizeof(xieTecDecodeTIFFPackBits);
+ pvt->decodeParms = (pointer)dtec;
+ dtec->normal = TRUE;
+ dtec->encodedOrder = etec->encodedOrder;
+ }
+ break;
+ case xieValEncodeJPEGLossless: /* not implemented in SI */
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ return(TRUE);
+}
+
+Bool CompareDecode(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ peDefPtr srcped = ped->inFloLst[IMPORT].srcDef;
+ CARD16 decodeNumber, decodeLen;
+ pointer decodeParms;
+
+ decodeParms = GetImportTechnique(srcped,&decodeNumber,&decodeLen);
+ if(decodeNumber != pvt->decodeNumber)
+ return(FALSE);
+
+ switch (decodeNumber) {
+ case xieValDecodeUncompressedSingle:
+ {
+ xieTecDecodeUncompressedSingle *itec =
+ (xieTecDecodeUncompressedSingle *)decodeParms;
+ xieTecDecodeUncompressedSingle *otec =
+ (xieTecDecodeUncompressedSingle *)pvt->decodeParms;
+
+ return (itec->fillOrder == otec->fillOrder &&
+ itec->pixelOrder == otec->pixelOrder &&
+ itec->pixelStride == otec->pixelStride &&
+ itec->leftPad == otec->leftPad &&
+ itec->pixelStride == otec->pixelStride &&
+ itec->scanlinePad == otec->scanlinePad);
+ }
+ break;
+ case xieValDecodeUncompressedTriple:
+ {
+ xieTecDecodeUncompressedTriple *itec =
+ (xieTecDecodeUncompressedTriple *)decodeParms;
+ xieTecDecodeUncompressedTriple *otec =
+ (xieTecDecodeUncompressedTriple *)pvt->decodeParms;
+
+ return (itec->fillOrder == otec->fillOrder &&
+ itec->pixelOrder == otec->pixelOrder &&
+ itec->interleave == otec->interleave &&
+ itec->bandOrder == otec->bandOrder &&
+ itec->leftPad[0] == otec->leftPad[0] &&
+ itec->leftPad[1] == otec->leftPad[1] &&
+ itec->leftPad[2] == otec->leftPad[2] &&
+ itec->pixelStride[0] == otec->pixelStride[0] &&
+ itec->pixelStride[1] == otec->pixelStride[1] &&
+ itec->pixelStride[2] == otec->pixelStride[2] &&
+ itec->scanlinePad[0] == otec->scanlinePad[0] &&
+ itec->scanlinePad[1] == otec->scanlinePad[1] &&
+ itec->scanlinePad[2] == otec->scanlinePad[2]);
+ }
+ break;
+ case xieValDecodeG31D:
+ case xieValDecodeG32D:
+ case xieValDecodeG42D:
+ case xieValDecodeTIFF2:
+ {
+ xieTecDecodeG31D *itec = (xieTecDecodeG31D *)decodeParms;
+ xieTecDecodeG31D *otec =
+ (xieTecDecodeG31D *)pvt->decodeParms;
+
+ return (itec->normal == otec->normal &&
+ itec->radiometric == otec->radiometric &&
+ itec->encodedOrder == otec->encodedOrder);
+ }
+ break;
+ case xieValDecodeJPEGBaseline:
+ case xieValDecodeJPEGLossless:
+ {
+ xieTecDecodeJPEGBaseline *itec =
+ (xieTecDecodeJPEGBaseline *)decodeParms;
+ xieTecDecodeJPEGBaseline *otec =
+ (xieTecDecodeJPEGBaseline *)pvt->decodeParms;
+
+ return (itec->interleave == otec->interleave &&
+ itec->bandOrder == otec->bandOrder &&
+ itec->upSample == otec->upSample);
+ }
+ break;
+ case xieValDecodeTIFFPackBits:
+ {
+ xieTecDecodeTIFFPackBits *itec =
+ (xieTecDecodeTIFFPackBits *)decodeParms;
+ xieTecDecodeTIFFPackBits *otec =
+ (xieTecDecodeTIFFPackBits *)pvt->decodeParms;
+
+ return (itec->normal == otec->normal &&
+ itec->encodedOrder == otec->encodedOrder);
+ }
+ break;
+ default:
+ return (FALSE);
+ }
+}
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefEPhoto(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloExportPhotomap *raw = (xieFloExportPhotomap *)ped->elemRaw;
+ ePhotoDefPtr pvt = (ePhotoDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ photomapPtr map;
+ CARD32 b;
+
+ if(!(pvt && (map = pvt->map))) return(FALSE);
+
+ if(ok && map->refCnt > 1) {
+
+ /* free old compression parameters and image data
+ */
+ if(map->tecParms)
+ map->tecParms = (pointer)XieFree(map->tecParms);
+
+ if(map->pvtParms)
+ map->pvtParms = (pointer)XieFree(map->pvtParms);
+
+ for(b = 0; b < map->bands; b++)
+ FreeStrips(&map->strips[b]);
+
+ /* stash our new attributes and data into the photomap
+ */
+ map->bands = ped->outFlo.bands;
+ map->dataType = (map->format[0].class & UNCONSTRAINED
+ ? xieValUnconstrained : xieValConstrained);
+ map->technique = pvt->decodeNumber;
+ map->lenParms = pvt->decodeLen;
+ map->tecParms = pvt->decodeParms;
+ map->pvtParms = pvt->pvtParms;
+ map->dataClass = src->bands == 3 ? xieValTripleBand : xieValSingleBand;
+ for(b = 0; b < map->bands; ++b) {
+ map->format[b] = ped->outFlo.format[b];
+ DebriefStrips(&ped->outFlo.output[b],&map->strips[b]);
+ }
+ pvt->decodeParms = NULL;
+
+ if (src->bands == 3 && map->bands == 1) {
+ /*
+ * save format for the other bands too, we'll need them when we decode
+ */
+ for(b = 1; b < src->bands; ++b)
+ map->format[b] = src->format[b];
+ }
+ }
+
+ /* if server choice, free space used to hold fabricated encode parameters */
+ if (pvt->serverChose && pvt->encodeParms)
+ XieFree(pvt->encodeParms);
+
+ /* Free decodeParms if something went afoul before hooking on to photomap */
+ if (pvt->decodeParms)
+ XieFree(pvt->decodeParms);
+
+ /* free image data that's left over on our outFlo
+ */
+ for(b = 0; b < ped->outFlo.bands; b++)
+ FreeStrips(&ped->outFlo.output[b]);
+
+ /*
+ unbind ourself from the photomap
+ */
+ if(map->refCnt > 1)
+ --map->refCnt;
+ else if(LookupIDByType(raw->photomap, RT_PHOTOMAP))
+ FreeResourceByType(map->ID, RT_PHOTOMAP, RT_NONE);
+ else
+ DeletePhotomap(map, map->ID);
+
+ return(TRUE);
+} /* end DebriefEPhoto */
+
+/* end module ephoto.c */
diff --git a/xc/programs/Xserver/XIE/dixie/export/eroi.c b/xc/programs/Xserver/XIE/dixie/export/eroi.c
new file mode 100644
index 000000000..2bfe17e56
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/export/eroi.c
@@ -0,0 +1,209 @@
+/* $TOG: eroi.c /main/5 1998/02/09 16:08:25 kaleb $ */
+/**** module eroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ eroi.c -- DIXIE routines for managing the ExportROI element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/export/eroi.c,v 3.3 1998/10/25 07:11:25 dawes Exp $ */
+
+#define _XIEC_EROI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_e.h>
+#include <XIEproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <roi.h>
+#include <element.h>
+#include <error.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepEROI(floDefPtr flo, peDefPtr ped);
+static Bool DebriefEROI(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec eROIVec =
+{
+ PrepEROI, /* prepare for analysis and execution */
+ DebriefEROI /* debrief */
+};
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportROI element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeEROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloExportROI);
+ ELEMENT_SIZE_MATCH(xieFloExportROI);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if (!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(eROIDefRec))))
+ FloAllocError(flo,tag,xieElemExportROI, return(NULL));
+
+ ped->diVec = &eROIVec;
+ ped->phototag = tag;
+ ped->flags.export = TRUE;
+ raw = (xieFloExportROI *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->roi, raw->roi);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloExportROI));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[0].srcTag = raw->src;
+ return ped;
+} /* end MakeEROI */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepEROI(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportROI *raw = (xieFloExportROI *)ped->elemRaw;
+ eROIDefPtr pvt = (eROIDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[0];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ roiPtr roi;
+
+ /* grab roi resource */
+ if(!(roi = (roiPtr)LookupIDByType(raw->roi, RT_ROI)))
+ ROIError(flo,ped,raw->roi,return(FALSE));
+
+ pvt->roi = roi;
+ roi->refCnt++;
+
+ if (src->bands != 1 || src->format[0].class != RUN_LENGTH)
+ FloSourceError(flo,raw->src,raw->elemType, return(FALSE));
+
+ dst->bands = inf->bands = src->bands;
+ dst->format[0].class = inf->format[0].class = src->format[0].class;
+
+ return TRUE;
+} /* end PrepEROI */
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefEROI(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloExportROI *raw = (xieFloExportROI *)ped->elemRaw;
+ eROIDefPtr pvt = (eROIDefPtr)ped->elemPvt;
+ roiPtr roi;
+
+ if(!(pvt && (roi = pvt->roi))) return(FALSE);
+
+ if (ok && roi->refCnt > 1) {
+ /*
+ * out with the old, in with the new
+ */
+ FreeStrips(&roi->strips);
+ DebriefStrips(&ped->outFlo.output[0],&roi->strips);
+ }
+ /* free roi data that's left over on our outFlo */
+ FreeStrips(&ped->outFlo.output[0]);
+
+ /* unbind ourself from the roi */
+ if(roi->refCnt > 1)
+ --roi->refCnt;
+ else if(LookupIDByType(raw->roi, RT_ROI))
+ FreeResourceByType(roi->ID, RT_ROI, RT_NONE);
+ else
+ DeleteROI(roi, roi->ID);
+
+ return TRUE;
+} /* end DebriefEROI */
+
+/* end module eroi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/Imakefile b/xc/programs/Xserver/XIE/dixie/import/Imakefile
new file mode 100644
index 000000000..b318d454e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/Imakefile
@@ -0,0 +1,32 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:55:32 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/dixie/import/Imakefile,v 3.5 1998/07/25 08:05:06 dawes Exp $
+XCOMM build device independent import element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = iclut.c icphoto.c idraw.c idrawp.c ilut.c iphoto.c
+OBJS1 = iclut.o icphoto.o idraw.o idrawp.o ilut.o iphoto.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = icroi.c iroi.c
+OBJS2 = icroi.o iroi.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC)
+ LINTLIBS = ../export/llib-lexp.ln ../import/llib-limp.ln \
+ ../process/llib-lproc.ln ../request/llib-lreq.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(imp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/dixie/import/iclut.c b/xc/programs/Xserver/XIE/dixie/import/iclut.c
new file mode 100644
index 000000000..79ce30973
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/iclut.c
@@ -0,0 +1,222 @@
+/* $TOG: iclut.c /main/6 1998/02/09 16:08:34 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module iclut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ iclut.c -- DIXIE routines for managing the ImportClientLUT element
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+ Ben Fahy -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/iclut.c,v 3.3 1998/10/25 07:11:27 dawes Exp $ */
+
+#define _XIEC_ICLUT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <lut.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepICLUT(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iCLUTVec = {
+ PrepICLUT /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+--------------- routine: make an import client lut element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeICLUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportClientLUT);
+ ELEMENT_SIZE_MATCH(xieFloImportClientLUT);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemImportClientLUT,return(NULL));
+
+ ped->diVec = &iCLUTVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ ped->flags.putData = TRUE;
+ raw = (xieFloImportClientLUT *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ raw->class = stuff->class;
+ raw->bandOrder = stuff->bandOrder;
+ cpswapl(stuff->length0, raw->length0);
+ cpswapl(stuff->length1, raw->length1);
+ cpswapl(stuff->length2, raw->length2);
+ cpswapl(stuff->levels0, raw->levels0);
+ cpswapl(stuff->levels1, raw->levels1);
+ cpswapl(stuff->levels2, raw->levels2);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportClientLUT));
+
+ return(ped);
+} /* end MakeICLUT */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepICLUT(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportClientLUT *raw = (xieFloImportClientLUT *)ped->elemRaw;
+ inFloPtr inflo = &ped->inFloLst[IMPORT];
+ int b;
+
+ /*
+ * check for data-class, length, and levels errors, and stash attributes
+ * since this is STREAM data, we only have to record the class and band
+ * numbers in the inflos.
+ */
+ if(raw->bandOrder != xieValLSFirst && raw->bandOrder != xieValMSFirst)
+ ValueError(flo,ped,raw->bandOrder, return(FALSE));
+
+ switch(raw->class) {
+ case xieValSingleBand :
+
+ if(!raw->length0)
+ ValueError(flo,ped,0, return(FALSE));
+ if(raw->levels0 < 2 || raw->levels0 > MAX_LEVELS(1))
+ MatchError(flo,ped, return(FALSE));
+ inflo->bands = 1;
+ break;
+#if XIE_FULL
+ case xieValTripleBand :
+ if(!raw->length0 || !raw->length1 || !raw->length2)
+ ValueError(flo,ped,0, return(FALSE));
+ if(raw->levels0 < 2 || raw->levels0 > MAX_LEVELS(3) ||
+ raw->levels1 < 2 || raw->levels1 > MAX_LEVELS(3) ||
+ raw->levels2 < 2 || raw->levels2 > MAX_LEVELS(3))
+ MatchError(flo,ped, return(FALSE));
+
+ inflo->bands = 3;
+ inflo->format[1].band = 1;
+ inflo->format[2].band = 2;
+ ped->outFlo.format[1] = inflo->format[1];
+ ped->outFlo.format[2] = inflo->format[2];
+ ped->outFlo.format[1].levels = raw->levels1;
+ ped->outFlo.format[2].levels = raw->levels2;
+ ped->outFlo.format[1].height = raw->length1;
+ ped->outFlo.format[2].height = raw->length2;
+ break;
+#endif
+ default :
+ ValueError(flo,ped,raw->class, return(FALSE));
+ }
+
+ inflo->format[0].band = 0;
+ ped->outFlo.format[0] = inflo->format[0];
+ ped->outFlo.format[0].levels = raw->levels0;
+ ped->outFlo.format[0].height = raw->length0;
+
+ for (b=0; b < inflo->bands; b++) {
+ formatPtr fmt = &(ped->outFlo.format[b]);
+
+ inflo->format[b].class = STREAM;
+ ped->swapUnits[b] = LutPitch(fmt->levels);
+
+ fmt->class = LUT_ARRAY;
+ fmt->interleaved = FALSE;
+ fmt->width = raw->bandOrder; /* see miclut.c, mppoint crazypixel */
+ fmt->depth = 8;
+ fmt->stride = 8;
+ fmt->pitch = 8 * fmt->height;
+ }
+
+ ped->outFlo.bands = inflo->bands;
+
+ return(TRUE);
+} /* end PrepICLUT */
+
+/* end module iclut.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/icphoto.c b/xc/programs/Xserver/XIE/dixie/import/icphoto.c
new file mode 100644
index 000000000..817d7e552
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/icphoto.c
@@ -0,0 +1,778 @@
+/* $TOG: icphoto.c /main/5 1998/02/09 16:08:38 kaleb $ */
+/**** module icphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ icphoto.c -- DIXIE routines for managing the ImportClientPhoto element
+
+ Robert NC Shelley, Dean Verheiden -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/icphoto.c,v 3.3 1998/10/25 07:11:27 dawes Exp $ */
+
+#define _XIEC_ICPHOTO
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepICPhoto(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec iCPhotoVec = {
+ PrepICPhoto /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+--------------- routine: make an import client photo element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeICPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportClientPhoto);
+ ELEMENT_AT_LEAST_SIZE(xieFloImportClientPhoto);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemImportClientPhoto, return(NULL)) ;
+
+ ped->diVec = &iCPhotoVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ ped->flags.putData = TRUE;
+ raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ raw->notify = stuff->notify;
+ raw->class = stuff->class;
+ cpswapl(stuff->width0, raw->width0);
+ cpswapl(stuff->width1, raw->width1);
+ cpswapl(stuff->width2, raw->width2);
+ cpswapl(stuff->height0, raw->height0);
+ cpswapl(stuff->height1, raw->height1);
+ cpswapl(stuff->height2, raw->height2);
+ cpswapl(stuff->levels0, raw->levels0);
+ cpswapl(stuff->levels1, raw->levels1);
+ cpswapl(stuff->levels2, raw->levels2);
+ cpswaps(stuff->decodeTechnique, raw->decodeTechnique);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportClientPhoto));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValDecode, raw->decodeTechnique)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValDecode,raw->decodeTechnique,raw->lenParams,
+ return(ped));
+
+ return(ped);
+} /* end MakeICPhoto */
+
+#undef rparms
+#define rparms ((xieTecDecodeUncompressedSingle *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeUncompressedSingle *)rParms)
+
+Bool CopyICPhotoUnSingle(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeUncompressedTriple *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeUncompressedTriple *)rParms)
+
+Bool CopyICPhotoUnTriple(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeG31D *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeG31D *)rParms)
+
+Bool CopyICPhotoG31D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeG32D *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeG32D *)rParms)
+
+Bool CopyICPhotoG32D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeG42D *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeG42D *)rParms)
+
+Bool CopyICPhotoG42D(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeJPEGBaseline *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeJPEGBaseline *)rParms)
+
+Bool CopyICPhotoJPEGBaseline(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#ifdef BEYOND_SI
+
+#undef rparms
+#define rparms ((xieTecDecodeJPEGLossless *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeJPEGLossless *)rParms)
+
+Bool CopyICPhotoJPEGLossless(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+#endif /* BEYOND_SI */
+
+#undef rparms
+#define rparms ((xieTecDecodeTIFF2 *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeTIFF2 *)rParms)
+
+Bool CopyICPhotoTIFF2(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+#undef rparms
+#define rparms ((xieTecDecodeTIFFPackBits *)sParms)
+#undef cparms
+#define cparms ((xieTecDecodeTIFFPackBits *)rParms)
+
+Bool CopyICPhotoTIFFPackBits(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ /* Nothing to swap for this technique */
+ memcpy((char *)cparms, (char *)rparms, tsize<<2);
+
+ return(TRUE);
+}
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepICPhoto(floDefPtr flo, peDefPtr ped)
+{
+ int i;
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ inFloPtr inflo = &ped->inFloLst[IMPORT];
+
+ /*
+ * check for data-class, dimension, and levels errors, and stash attributes
+ */
+ switch(raw->class) {
+ case xieValSingleBand :
+ if(!raw->width0 || !raw->height0 || !raw->levels0)
+ ValueError(flo,ped,0, return(FALSE));
+ if(raw->levels0 > MAX_LEVELS(1))
+ MatchError(flo,ped, return(FALSE));
+ inflo->bands = 1;
+ break;
+ case xieValTripleBand :
+ if(!raw->width0 || !raw->height0 || !raw->levels0 ||
+ !raw->width1 || !raw->height1 || !raw->levels1 ||
+ !raw->width2 || !raw->height2 || !raw->levels2)
+ ValueError(flo,ped,0, return(FALSE));
+ if(raw->levels0 > MAX_LEVELS(3) ||
+ raw->levels1 > MAX_LEVELS(3) ||
+ raw->levels2 > MAX_LEVELS(3))
+ MatchError(flo,ped, return(FALSE));
+ inflo->bands = 3;
+ inflo->format[1].band = 1;
+ inflo->format[1].width = raw->width1;
+ inflo->format[1].height = raw->height1;
+ inflo->format[1].levels = raw->levels1;
+ inflo->format[2].band = 2;
+ inflo->format[2].width = raw->width2;
+ inflo->format[2].height = raw->height2;
+ inflo->format[2].levels = raw->levels2;
+ break;
+ default :
+ ValueError(flo,ped,raw->class, return(FALSE));
+ }
+ inflo->format[0].band = 0;
+ inflo->format[0].width = raw->width0;
+ inflo->format[0].height = raw->height0;
+ inflo->format[0].levels = raw->levels0;
+
+ for(i = 0; i < inflo->bands; i++)
+ SetDepthFromLevels(inflo->format[i].levels, inflo->format[i].depth);
+
+ if(!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValDecode,raw->decodeTechnique,raw->lenParams,
+ return(FALSE));
+
+ return(TRUE);
+} /* end PrepICPhoto */
+
+
+/*------------------------------------------------------------------------
+----- routines: verify technique parameters against element parameters ----
+-------------- and prepare for analysis and execution ----
+------------------------------------------------------------------------*/
+
+/* Prep routine for uncompressed single band data */
+Bool PrepICPhotoUnSingle(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeUncompressedSingle *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ CARD32 padmod = tec->scanlinePad * 8;
+ CARD32 pitch = tec->pixelStride * raw->width0 + tec->leftPad;
+ BOOL aligned = !(tec->pixelStride & (tec->pixelStride-1)) ||
+ tec->pixelStride == 24;
+ int i;
+
+ if(tec->fillOrder != xieValLSFirst && /* check fill-order */
+ tec->fillOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelOrder != xieValLSFirst && /* check pixel-order */
+ tec->pixelOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelStride < inf->format[0].depth) /* check pixel-stride */
+ return(FALSE);
+ if((ALIGNMENT == xieValAlignable && !aligned) || /* alignment & left-pad */
+ (ALIGNMENT == xieValAlignable && aligned &&
+ (tec->leftPad % tec->pixelStride ||
+ tec->leftPad % 8)))
+ return(FALSE);
+ if(tec->scanlinePad & (tec->scanlinePad-1) || /* check scanline-pad */
+ tec->scanlinePad > 16)
+ return(FALSE);
+ if(raw->class != xieValSingleBand)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+ inf->format[0].stride = tec->pixelStride;
+ inf->format[0].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+} /* PrepICPhotoUnSingle */
+
+/* Prep routine for uncompressed triple band data */
+Bool PrepICPhotoUnTriple(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeUncompressedTriple *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->fillOrder != xieValLSFirst && /* check fill-order */
+ tec->fillOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->pixelOrder != xieValLSFirst && /* check pixel-order */
+ tec->pixelOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->bandOrder != xieValLSFirst && /* check band-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+ if (tec->interleave == xieValBandByPixel && /* check inter-band dim */
+ (inf->format[0].width != inf->format[1].width ||
+ inf->format[1].width != inf->format[2].width ||
+ inf->format[0].height != inf->format[1].height ||
+ inf->format[1].height != inf->format[2].height))
+ return(FALSE);
+ if(raw->class != xieValTripleBand)
+ return(FALSE);
+ if (tec->interleave == xieValBandByPlane) {
+ for (i = 0; i < 3; i++) {
+ CARD32 padmod = tec->scanlinePad[i] * 8;
+ CARD32 pitch = tec->pixelStride[i] * inf->format[i].width +
+ tec->leftPad[i];
+ BOOL aligned = !(tec->pixelStride[i] & (tec->pixelStride[i] - 1));
+
+ if(tec->pixelStride[i] < inf->format[i].depth) /* check pixel-stride */
+ return(FALSE);
+ if(inf->format[i].depth > MAX_DEPTH(3)) /* check pixel-depth */
+ return(FALSE);
+ if((ALIGNMENT == xieValAlignable && !aligned) || /* alignment & left-pad */
+ (ALIGNMENT == xieValAlignable && aligned &&
+ (tec->leftPad[i] % tec->pixelStride[i] ||
+ tec->leftPad[i] % 8)))
+ return(FALSE);
+ if(tec->scanlinePad[i] & (tec->scanlinePad[i] - 1) ||
+ tec->scanlinePad[i] > 16) /*check scanline-pad*/
+ return(FALSE);
+ inf->format[i].interleaved = FALSE;
+ inf->format[i].class = STREAM;
+ inf->format[i].stride = tec->pixelStride[i];
+ inf->format[i].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+ }
+ ped->outFlo.bands = inf->bands;
+ } else { /* xieValBandByPixel */
+ CARD32 padmod = tec->scanlinePad[0] * 8;
+ CARD32 pitch = tec->pixelStride[0] * inf->format[0].width +
+ tec->leftPad[0];
+ CARD32 tdepth = inf->format[0].depth + inf->format[1].depth +
+ inf->format[2].depth;
+ BOOL aligned = !(tec->pixelStride[0] & (tec->pixelStride[0] - 1)) ||
+ tec->pixelStride[0] == 24;
+
+ if(inf->format[0].depth > MAX_DEPTH(3) || /* check pixel-depth */
+ inf->format[1].depth > MAX_DEPTH(3) ||
+ inf->format[2].depth > MAX_DEPTH(3))
+ return(FALSE);
+ if(tec->pixelStride[0] < tdepth) /* check overall pixel-stride */
+ return(FALSE);
+ if((ALIGNMENT == xieValAlignable && !aligned) || /* alignment & left-pad */
+ (ALIGNMENT == xieValAlignable && aligned &&
+ (tec->leftPad[0] % tec->pixelStride[0] ||
+ tec->leftPad[0] % 8)))
+ return(FALSE);
+ if(tec->scanlinePad[0] & (tec->scanlinePad[0] - 1) ||
+ tec->scanlinePad[0] > 16) /*check scanline-pad*/
+ return(FALSE);
+
+ /* Now, go stomp on band zero values that should be changed */
+ inf->bands = 1;
+ inf->format[0].interleaved = TRUE;
+ inf->format[0].class = STREAM;
+ inf->format[0].stride = tec->pixelStride[0];
+ inf->format[0].pitch = pitch + (padmod ? Align(pitch,padmod) : 0);
+
+ /* Set up 3 outflows for the one interleaved inflo */
+ ped->outFlo.bands = 3;
+ }
+
+ /* Copy input to output, setting differing output parameters when necessary */
+ for (i = 0; i < ped->outFlo.bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ /* Fill in other format parameters based on the number of output levels */
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+} /* PrepICPhotoUnTriple */
+
+Bool PrepICPhotoG31D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG31D *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+ return(TRUE);
+
+} /* PrepICPhotoG31D */
+
+Bool PrepICPhotoG32D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG32D *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoG32D */
+
+Bool PrepICPhotoG42D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG42D *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoG42D */
+
+Bool PrepICPhotoJPEGBaseline(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeJPEGBaseline *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if (raw->class == xieValSingleBand)
+ inf->format[0].interleaved = FALSE;
+ else {
+ if(tec->bandOrder != xieValLSFirst && /* check encoding-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+
+ inf->format[0].interleaved =
+ inf->format[1].interleaved =
+ inf->format[2].interleaved =
+ (tec->interleave == xieValBandByPixel);
+ inf->format[1].class = STREAM;
+ inf->format[2].class = STREAM;
+ }
+
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ /*
+ * except if TripleBand Interleaved, we lied: there's only one
+ * band coming in. We copy the bogus inflos first just because
+ * we can assume they have been set up suitably by nice general
+ * purpose code above. :-)
+ */
+ if (raw->class == xieValTripleBand && tec->interleave == xieValBandByPixel)
+ inf->bands = 1;
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoJPEGBaseline */
+
+#ifdef BEYOND_SI
+Bool PrepICPhotoJPEGLossless(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeJPEGLossless *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if (raw->class == xieValSingleBand)
+ inf->format[0].interleaved = FALSE;
+ else {
+ if(tec->bandOrder != xieValLSFirst && /* check encoding-order */
+ tec->bandOrder != xieValMSFirst)
+ return(FALSE);
+
+ if(tec->interleave != xieValBandByPixel && /* check interleave */
+ tec->interleave != xieValBandByPlane)
+ return(FALSE);
+
+ inf->format[0].interleaved =
+ inf->format[1].interleaved =
+ inf->format[2].interleaved =
+ (tec->interleave == xieValBandByPixel);
+ inf->format[1].class = STREAM;
+ inf->format[2].class = STREAM;
+ }
+
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoJPEGLossless */
+#endif /* BEYOND_SI */
+
+Bool PrepICPhotoTIFF2(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeTIFF2 *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoTIFF2 */
+
+Bool PrepICPhotoTIFFPackBits(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeTIFFPackBits *tec)
+{
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ int i;
+
+ if(tec->encodedOrder != xieValLSFirst && /* check encoding-order */
+ tec->encodedOrder != xieValMSFirst)
+ return(FALSE);
+
+ inf->format[0].interleaved = FALSE;
+ inf->format[0].class = STREAM;
+
+ /*
+ * determine output attributes from input parameters
+ */
+ ped->outFlo.bands = inf->bands;
+ for (i = 0; i < inf->bands; i++) {
+ ped->outFlo.format[i] = inf->format[i];
+ ped->outFlo.format[i].interleaved = FALSE;
+ }
+
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo, ped, return(FALSE));
+
+ return(TRUE);
+
+} /* PrepICPhotoTIFFPackBits */
+
+/* end module icphoto.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/icroi.c b/xc/programs/Xserver/XIE/dixie/import/icroi.c
new file mode 100644
index 000000000..c9fe8f313
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/icroi.c
@@ -0,0 +1,153 @@
+/* $TOG: icroi.c /main/5 1998/02/09 16:08:43 kaleb $ */
+/**** module icroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ icroi.c -- DIXIE routines for managing the ImportClientROI element
+
+ Robert NC Shelley, Dean Verheiden -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/icroi.c,v 3.3 1998/10/25 07:11:28 dawes Exp $ */
+
+#define _XIEC_ICROI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepICROI(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec iCROIVec =
+{
+ PrepICROI /* prepare for analysis and execution */
+};
+
+/*------------------------------------------------------------------------
+--------------- routine: make an import client roi element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeICROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportClientROI);
+ ELEMENT_SIZE_MATCH(xieFloImportClientROI);
+
+ if (!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemImportClientROI, return(NULL)) ;
+
+ ped->diVec = &iCROIVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ ped->flags.putData = TRUE;
+ raw = (xieFloImportClientROI *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswapl(stuff->rectangles, raw->rectangles);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportClientROI));
+
+ return ped;
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepICROI(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr inflo = &ped->inFloLst[IMPORT];
+ outFloPtr outflo = &ped->outFlo;
+
+ inflo->bands = outflo->bands = 1;
+ inflo->format[0].class = STREAM;
+ outflo->format[0].class = RUN_LENGTH;
+ ped->swapUnits[0] = sizeof(xieTypRectangle);
+
+ return TRUE;
+} /* end PrepICROI */
+
+/* end module icroi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/idraw.c b/xc/programs/Xserver/XIE/dixie/import/idraw.c
new file mode 100644
index 000000000..efe0e742d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/idraw.c
@@ -0,0 +1,206 @@
+/* $TOG: idraw.c /main/5 1998/02/09 16:08:53 kaleb $ */
+/**** module idraw.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ idraw.c -- DIXIE routines for managing the ImportDrawable element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/idraw.c,v 3.3 1998/10/25 07:11:28 dawes Exp $ */
+
+#define _XIEC_IDRAW
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * more X server includes.
+ */
+#include <pixmapstr.h>
+#include <scrnintstr.h>
+#include <windowstr.h>
+#include <window.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepIDraw(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iDrawVec = {
+ PrepIDraw /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ImportDrawable element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeIDraw(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportDrawable);
+ ELEMENT_SIZE_MATCH(xieFloImportDrawable);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(iDrawDefRec))))
+ FloAllocError(flo,tag,xieElemImportDrawable, return(NULL));
+
+ ped->diVec = &iDrawVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ raw = (xieFloImportDrawable *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ raw->notify = stuff->notify;
+ cpswapl(stuff->drawable, raw->drawable);
+ cpswaps(stuff->srcX, raw->srcX);
+ cpswaps(stuff->srcY, raw->srcY);
+ cpswaps(stuff->width, raw->width);
+ cpswaps(stuff->height, raw->height);
+ cpswapl(stuff->fill, raw->fill);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportDrawable));
+
+ return(ped);
+} /* end MakeIDraw */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepIDraw(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportDrawable *raw = (xieFloImportDrawable *) ped->elemRaw;
+ iDrawDefPtr pvt = (iDrawDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr dst = &ped->outFlo;
+ formatPtr fmt = &inf->format[0];
+ DrawablePtr pd;
+ CARD32 f, padmask;
+
+ if(!(pd = pvt->pDraw = ((DrawablePtr)
+ LookupIDByClass(raw->drawable, RC_DRAWABLE))))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ if(!((pd->type == DRAWABLE_WINDOW && ((WindowPtr)pd)->realized) ||
+ pd->type == DRAWABLE_PIXMAP))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ if(raw->srcX < 0) {
+ ValueError(flo,ped,raw->srcX, return(FALSE));
+ } else if (raw->srcY < 0) {
+ ValueError(flo,ped,raw->srcY, return(FALSE));
+ } else if (raw->srcX + raw->width > pd->width) {
+ ValueError(flo,ped,raw->width, return(FALSE));
+ } else if (raw->srcY + raw->height > pd->height) {
+ ValueError(flo,ped,raw->height, return(FALSE));
+ }
+ /* find the screen format that matches this drawable and fill in the format
+ */
+ for(f = 0; f < screenInfo.numPixmapFormats
+ && pd->depth != screenInfo.formats[f].depth; ++f);
+ if(f == screenInfo.numPixmapFormats)
+ DrawableError(flo,ped,raw->drawable,return(FALSE));
+ padmask = screenInfo.formats[f].scanlinePad - 1;
+ fmt->interleaved = FALSE;
+ fmt->band = 0;
+ fmt->depth = pd->depth;
+ fmt->width = raw->width;
+ fmt->height = raw->height;
+ fmt->levels = 1<<pd->depth;
+ fmt->stride = screenInfo.formats[f].bitsPerPixel;
+ fmt->pitch = (fmt->stride * raw->width + padmask) & ~padmask;
+ /*
+ * set output attributes from input format (stride and pitch may differ)
+ */
+ dst->bands = inf->bands = 1;
+ dst->format[0] = inf->format[0];
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ return(TRUE);
+} /* end PrepIDraw */
+/* end module idraw.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/idrawp.c b/xc/programs/Xserver/XIE/dixie/import/idrawp.c
new file mode 100644
index 000000000..fa04024b7
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/idrawp.c
@@ -0,0 +1,211 @@
+/* $TOG: idrawp.c /main/5 1998/02/09 16:08:48 kaleb $ */
+/**** module idrawp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ idrawp.c -- DIXIE routines for managing the ImportDrawablePlane element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/idrawp.c,v 3.3 1998/10/25 07:11:28 dawes Exp $ */
+
+#define _XIEC_IDRAWP
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * more X server includes.
+ */
+#include <pixmapstr.h>
+#include <scrnintstr.h>
+#include <windowstr.h>
+#include <window.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepIDrawP(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iDrawPVec = {
+ PrepIDrawP /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ImportDrawablePlane element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeIDrawP(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportDrawablePlane);
+ ELEMENT_SIZE_MATCH(xieFloImportDrawablePlane);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(iDrawDefRec))))
+ FloAllocError(flo,tag,xieElemImportDrawablePlane, return(NULL));
+
+ ped->diVec = &iDrawPVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ raw = (xieFloImportDrawablePlane *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ raw->notify = stuff->notify;
+ cpswapl(stuff->drawable, raw->drawable);
+ cpswaps(stuff->srcX, raw->srcX);
+ cpswaps(stuff->srcY, raw->srcY);
+ cpswaps(stuff->width, raw->width);
+ cpswaps(stuff->height, raw->height);
+ cpswapl(stuff->fill, raw->fill);
+ cpswapl(stuff->bitPlane, raw->bitPlane);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportDrawablePlane));
+
+ return(ped);
+} /* end MakeIDrawP */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepIDrawP(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportDrawablePlane *raw = (xieFloImportDrawablePlane *) ped->elemRaw;
+ iDrawDefPtr pvt = (iDrawDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr dst = &ped->outFlo;
+ formatPtr fmt = &inf->format[0];
+ DrawablePtr pd;
+ CARD32 f, padmask;
+
+ if(!(pd = pvt->pDraw = ((DrawablePtr)
+ LookupIDByClass(raw->drawable, RC_DRAWABLE))))
+ DrawableError(flo,ped,raw->drawable,return(FALSE));
+
+ if(!((pd->type == DRAWABLE_WINDOW && ((WindowPtr)pd)->realized) ||
+ pd->type == DRAWABLE_PIXMAP))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ if(raw->srcX < 0) {
+ ValueError(flo,ped,raw->srcX, return(FALSE));
+ } else if (raw->srcY < 0) {
+ ValueError(flo,ped,raw->srcY, return(FALSE));
+ } else if (raw->srcX + raw->width > pd->width) {
+ ValueError(flo,ped,raw->width, return(FALSE));
+ } else if (raw->srcY + raw->height > pd->height) {
+ ValueError(flo,ped,raw->height, return(FALSE));
+ } else if(!raw->bitPlane || raw->bitPlane & (raw->bitPlane - 1) ||
+ raw->bitPlane >= (1<<pd->depth))
+ ValueError(flo,ped,raw->bitPlane, return(FALSE));
+
+ /* find the screen format that matches this drawable and fill in the format
+ */
+ for(f = 0; f < screenInfo.numPixmapFormats
+ && pd->depth != screenInfo.formats[f].depth; ++f);
+ if(f == screenInfo.numPixmapFormats)
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+ padmask = screenInfo.formats[f].scanlinePad - 1;
+ fmt->interleaved = FALSE;
+ fmt->band = 0;
+ fmt->depth = pd->depth;
+ fmt->width = raw->width;
+ fmt->height = raw->height;
+ fmt->levels = 1<<pd->depth;
+ fmt->stride = screenInfo.formats[f].bitsPerPixel;
+ fmt->pitch = (fmt->stride * raw->width + padmask) & ~padmask;
+ /*
+ * set output attributes from input format (stride and pitch may differ)
+ */
+ dst->bands = inf->bands = 1;
+ dst->format[0] = inf->format[0];
+ dst->format[0].levels = 2;
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ return(TRUE);
+} /* end PrepIDrawP */
+/* end module idrawp.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/ilut.c b/xc/programs/Xserver/XIE/dixie/import/ilut.c
new file mode 100644
index 000000000..ed260abd6
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/ilut.c
@@ -0,0 +1,205 @@
+/* $TOG: ilut.c /main/5 1998/02/09 16:08:57 kaleb $ */
+/**** module ilut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ilut.c -- DIXIE routines for managing the ImportLUT element
+
+ Larry Hare -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/ilut.c,v 3.3 1998/10/25 07:11:29 dawes Exp $ */
+
+#define _XIEC_ILUT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <lut.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepILUT(floDefPtr flo, peDefPtr ped);
+static Bool DebriefILUT(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iLUTVec = {
+ PrepILUT,
+ DebriefILUT
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an import lut element ---------------
+------------------------------------------------------------------------*/
+peDefPtr MakeILUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportLUT);
+ ELEMENT_SIZE_MATCH(xieFloImportLUT);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(iLUTDefRec))))
+ FloAllocError(flo,tag,xieElemImportLUT, return(NULL));
+
+ ped->diVec = &iLUTVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ raw = (xieFloImportLUT *)ped->elemRaw;
+
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswapl(stuff->lut, raw->lut);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportLUT));
+
+ return(ped);
+} /* end MakeILUT */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepILUT(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportLUT *raw = (xieFloImportLUT *)ped->elemRaw;
+ iLUTDefPtr pvt = (iLUTDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr dst = &ped->outFlo;
+ formatPtr dfp, ifp;
+ lutPtr lut;
+ CARD32 b, nbands;
+
+ /* find the LUT resource and bind it to our flo */
+ if( !(lut = (lutPtr) LookupIDByType(raw->lut, RT_LUT)) )
+ LUTError(flo,ped,raw->lut, return(FALSE));
+ ++lut->refCnt;
+ pvt->lut = lut;
+
+ if(!lut->lutCnt)
+ AccessError(flo,ped, return(FALSE));
+
+ nbands = lut->lutCnt;
+ if (nbands != 1 && nbands != 3)
+ ImplementationError(flo,ped,return(FALSE));
+
+ /* propagate LUT attributes to our output */
+ dst->bands = inf->bands = nbands;
+ for(b = 0, dfp = &(dst->format[0]), ifp = &(inf->format[0]);
+ b < nbands; b++, dfp++, ifp++) {
+ dfp->band = ifp->band = b;
+ dfp->class = ifp->class = LUT_ARRAY;
+ dfp->levels = ifp->levels = lut->format[b].level;
+ dfp->height = ifp->height = lut->format[b].length; /* ugly hack */
+ dfp->width = ifp->width = lut->format[b].bandOrder; /* ugly hack */
+ dfp->interleaved = ifp->interleaved = FALSE;
+ /* width = 1; depth=8?; stride=8; pitch = 8*height; */
+ }
+
+ return(TRUE);
+} /* end PrepILUT */
+
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefILUT(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloImportLUT *raw = (xieFloImportLUT *)ped->elemRaw;
+ iLUTDefPtr pvt = (iLUTDefPtr) ped->elemPvt;
+ lutPtr lut;
+
+ if(pvt && (lut = pvt->lut))
+ if(lut->refCnt > 1)
+ --lut->refCnt;
+ else if(LookupIDByType(raw->lut, RT_LUT))
+ FreeResourceByType(lut->ID, RT_LUT, RT_NONE);
+ else
+ DeleteLUT(lut, lut->ID);
+
+ return(TRUE);
+} /* end DebriefILUT */
+
+/* end module ilut.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/iphoto.c b/xc/programs/Xserver/XIE/dixie/import/iphoto.c
new file mode 100644
index 000000000..9102e6f95
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/iphoto.c
@@ -0,0 +1,249 @@
+/* $TOG: iphoto.c /main/6 1998/02/09 16:09:07 kaleb $ */
+/**** module iphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ iphoto.c -- DIXIE routines for managing the ImportPhotomap element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/iphoto.c,v 3.3 1998/10/25 07:11:29 dawes Exp $ */
+
+#define _XIEC_IPHOTO
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepIPhoto(floDefPtr flo, peDefPtr ped);
+static Bool DebriefIPhoto(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iPhotoVec = {
+ PrepIPhoto,
+ DebriefIPhoto
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an import photomap element ---------------
+------------------------------------------------------------------------*/
+peDefPtr MakeIPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloImportPhotomap);
+ ELEMENT_SIZE_MATCH(xieFloImportPhotomap);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(iPhotoDefRec))))
+ FloAllocError(flo,tag,xieElemImportPhotomap, return(NULL));
+
+ ped->diVec = &iPhotoVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ raw = (xieFloImportPhotomap *)ped->elemRaw;
+
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswapl(stuff->photomap, raw->photomap);
+ raw->notify = stuff->notify;
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportPhotomap));
+
+ return(ped);
+} /* end MakeIPhoto */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepIPhoto(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportPhotomap *raw = (xieFloImportPhotomap *)ped->elemRaw;
+ iPhotoDefPtr pvt = (iPhotoDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr dst = &ped->outFlo;
+ photomapPtr map;
+ CARD32 b;
+
+ /* find the photomap resource and bind it to our flo */
+ if( !(map = (photomapPtr) LookupIDByType(raw->photomap, RT_PHOTOMAP)) )
+ PhotomapError(flo,ped,raw->photomap, return(FALSE));
+ ++map->refCnt;
+
+ /* Load up a generic structure for importing photos from map and client */
+ pvt->map = map;
+
+ if(!map->bands)
+ AccessError(flo,ped, return(FALSE));
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ inf->bands = map->bands;
+
+ /* copy map formats to inflo format */
+ for(b = 0; b < inf->bands; b++)
+ inf->format[b] = map->format[b];
+
+ /* also copy them to the outflo format, handling interleave if necessary */
+ dst->bands = (map->dataClass == xieValTripleBand)? 3 :
+ (map->dataClass == xieValSingleBand)? 1 : 0;
+
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = map->format[b];
+ dst->format[b].interleaved = FALSE;
+ }
+ /* NOTE: the loop is over dst->bands, not map->bands. This is because
+ * dst->bands can be 3 when map->bands is 1. The in ephoto.c saves all
+ * the formats of the inflo in the photomap, so they are available now
+ * when we need them. interleaved is FALSE by definition because only
+ * ExportPhotomap elements can *produce* interleaved data.
+ */
+
+ if (!UpdateFormatfromLevels(ped))
+ ImplementationError(flo, ped, return(FALSE));
+
+ return(TRUE);
+} /* end PrepIPhoto */
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefIPhoto(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloImportPhotomap *raw = (xieFloImportPhotomap *)ped->elemRaw;
+ iPhotoDefPtr pvt = (iPhotoDefPtr) ped->elemPvt;
+ photomapPtr map;
+
+ if(pvt && (map = (photomapPtr)pvt->map))
+ if(map->refCnt > 1)
+ --map->refCnt;
+ else if(LookupIDByType(raw->photomap, RT_PHOTOMAP))
+ FreeResourceByType(map->ID, RT_PHOTOMAP, RT_NONE);
+ else
+ DeletePhotomap(map, map->ID);
+ pvt->map = (photomapPtr)NULL;
+
+ return(TRUE);
+} /* end DebriefIPhoto */
+
+/*------------------------------------------------------------------------
+------------------ routine: return import-private stuff -----------------
+------------------------------------------------------------------------*/
+photomapPtr GetImportPhotomap(peDefPtr ped)
+{
+ return(((iPhotoDefPtr)ped->elemPvt)->map);
+}
+
+pointer GetImportTechnique(peDefPtr ped, CARD16 *num_ret, CARD16 *len_ret)
+{
+ switch(ped->elemRaw->elemType) {
+ case xieElemImportPhotomap:
+ {
+ photomapPtr imap;
+
+ imap = GetImportPhotomap(ped);
+ *num_ret = imap->technique;
+ *len_ret = imap->lenParms;
+ return(imap->tecParms);
+ }
+ case xieElemImportClientPhoto:
+ {
+ xieFloImportClientPhoto *icp = (xieFloImportClientPhoto*)ped->elemRaw;
+ *num_ret = icp->decodeTechnique;
+ *len_ret = icp->lenParams << 2;
+ return((pointer)&icp[1]);
+ }
+ default:
+ *num_ret = 0;
+ *len_ret = 0;
+ return(NULL);
+ }
+} /* GetImportTechnique */
+
+/* end module iphoto.c */
diff --git a/xc/programs/Xserver/XIE/dixie/import/iroi.c b/xc/programs/Xserver/XIE/dixie/import/iroi.c
new file mode 100644
index 000000000..0a7452457
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/import/iroi.c
@@ -0,0 +1,194 @@
+/* $TOG: iroi.c /main/5 1998/02/09 16:09:12 kaleb $ */
+/**** module iroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ iroi.c -- DIXIE routines for managing the ImportROI element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/import/iroi.c,v 3.3 1998/10/25 07:11:29 dawes Exp $ */
+
+#define _XIEC_IROI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_i.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <flodata.h>
+#include <roi.h>
+#include <element.h>
+#include <error.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepIROI(floDefPtr flo, peDefPtr ped);
+static Bool DebriefIROI(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec iROIVec =
+{
+ PrepIROI, /* prepare for analysis and execution */
+ DebriefIROI /* debrief */
+};
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ImportROI element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeIROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloImportROI);
+ ELEMENT_SIZE_MATCH(xieFloImportROI);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, sizeof(iROIDefRec))))
+ FloAllocError(flo,tag,xieElemImportROI, return(NULL));
+
+ ped->diVec = &iROIVec;
+ ped->phototag = tag;
+ ped->flags.import = TRUE;
+ raw = (xieFloImportROI *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswapl(stuff->roi, raw->roi);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloImportROI));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+
+ return ped;
+} /* end MakeIROI */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepIROI(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportROI *raw = (xieFloImportROI *)ped->elemRaw;
+ iROIDefPtr pvt = (iROIDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr dst = &ped->outFlo;
+ roiPtr roi;
+
+ /* grab roi resource */
+ if (!(roi = (roiPtr)LookupIDByType(raw->roi, RT_ROI)))
+ ROIError(flo,ped,raw->roi,return(FALSE));
+
+ /* Make sure the roi has been populated */
+ if (ListEmpty(&roi->strips))
+ AccessError(flo,ped, return(FALSE));
+
+ roi->refCnt++;
+ pvt->roi = roi;
+
+ dst->bands = inf->bands = 1;
+ dst->format[0].class = inf->format[0].class = RUN_LENGTH;
+
+ return TRUE;
+} /* end PrepIROI */
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefIROI(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ xieFloImportROI *raw = (xieFloImportROI *)ped->elemRaw;
+ iROIDefPtr pvt = (iROIDefPtr)ped->elemPvt;
+ roiPtr roi;
+
+ if(pvt && (roi = pvt->roi))
+ if(pvt->roi->refCnt > 1)
+ --roi->refCnt;
+ else if(LookupIDByType(raw->roi, RT_ROI))
+ FreeResourceByType(pvt->roi->ID, RT_ROI, RT_NONE);
+ else
+ DeleteROI(roi, roi->ID);
+
+ return TRUE;
+} /* end DebriefIROI */
+
+/* end module iroi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/Imakefile b/xc/programs/Xserver/XIE/dixie/process/Imakefile
new file mode 100644
index 000000000..d1174931f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/Imakefile
@@ -0,0 +1,37 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:55:42 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/dixie/process/Imakefile,v 3.5 1998/07/25 08:05:07 dawes Exp $
+XCOMM build device independent processing element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = pgeom.c ppoint.c
+OBJS1 = pgeom.o ppoint.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = parith.c pbandc.c pbande.c pbands.c pblend.c pcfrgb.c pcfromi.c \
+ pcnst.c pcomp.c pconv.c pctoi.c pctrgb.c pdither.c phist.c \
+ plogic.c pmath.c ppaste.c puncnst.c
+
+OBJS2 = parith.o pbandc.o pbande.o pbands.o pblend.o pcfrgb.o pcfromi.o \
+ pcnst.o pcomp.o pconv.o pctoi.o pctrgb.o pdither.o phist.o \
+ plogic.o pmath.o ppaste.o puncnst.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC)
+ LINTLIBS = ../export/llib-lexp.ln ../import/llib-limp.ln \
+ ../process/llib-lproc.ln ../request/llib-lreq.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(proc,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/dixie/process/parith.c b/xc/programs/Xserver/XIE/dixie/process/parith.c
new file mode 100644
index 000000000..e416acb66
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/parith.c
@@ -0,0 +1,244 @@
+/* $TOG: parith.c /main/5 1998/02/09 16:09:23 kaleb $ */
+/**** module parith.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ parith.c -- DIXIE routines for managing the Arithmetic element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/parith.c,v 3.3 1998/10/25 07:11:31 dawes Exp $ */
+
+#define _XIEC_PARITH
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepArith(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pArithVec = {
+ PrepArith /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a arithmetic element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeArith(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pArithDefPtr pvt;
+ ELEMENT(xieFloArithmetic);
+ ELEMENT_SIZE_MATCH(xieFloArithmetic);
+ ELEMENT_NEEDS_1_INPUT(src1);
+ inputs = 1 + (stuff->src2 ? 1 : 0) + (stuff->domainPhototag ? 1 :0);
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2,
+ sizeof(pArithDefRec))))
+ FloAllocError(flo, tag, xieElemArithmetic, return(NULL));
+
+ ped->diVec = &pArithVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloArithmetic *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src1, raw->src1);
+ cpswaps(stuff->src2, raw->src2);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->operator = stuff->operator;
+ raw->bandMask = stuff->bandMask;
+ cpswapl(stuff->constant0, raw->constant0);
+ cpswapl(stuff->constant1, raw->constant1);
+ cpswapl(stuff->constant2, raw->constant2);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloArithmetic));
+
+ if(!raw->src2) {
+ /*
+ * convert constants
+ */
+ pvt = (pArithDefPtr)ped->elemPvt;
+ pvt->constant[0] = ConvertFromIEEE(raw->constant0);
+ pvt->constant[1] = ConvertFromIEEE(raw->constant1);
+ pvt->constant[2] = ConvertFromIEEE(raw->constant2);
+ }
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src1;
+ if(raw->src2) inFlo[SRCt2].srcTag = raw->src2;
+ if(raw->domainPhototag) inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+
+ return(ped);
+} /* end MakeArith */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepArith(floDefPtr flo, peDefPtr ped)
+{
+ xieFloArithmetic *raw = (xieFloArithmetic *)ped->elemRaw;
+ inFloPtr ind, in2, in1 = &ped->inFloLst[SRCt1];
+ outFloPtr dom, sr2, sr1 = &in1->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD8 bmask = raw->bandMask;
+ int b;
+
+ /* make sure input is not bitonal */
+ for (b = 0; b < sr1->bands; b++)
+ if (IsntCanonic(sr1->format[b].class) ||
+ ((bmask & (1<<b)) && sr1->format[b].class == BIT_PIXEL))
+ MatchError(flo,ped, return(FALSE));
+
+ /* check out our second source */
+ if(raw->src2) {
+ in2 = &ped->inFloLst[SRCt2];
+ sr2 = &in2->srcDef->outFlo;
+ if(sr1->bands != sr2->bands)
+ MatchError(flo,ped, return(FALSE));
+ for (b = 0; b < sr1->bands; b++) {
+ if ((bmask & (1<<b)) == 0) continue;
+ if (sr1->format[b].class != sr2->format[b].class ||
+ (IsConstrained(sr1->format[b].class) &&
+ sr1->format[b].levels != sr2->format[b].levels))
+ MatchError(flo,ped, return(FALSE));
+ }
+ in2->bands = sr2->bands;
+ } else
+ sr2 = NULL;
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if(IsntDomain(dom->format[0].class) ||
+ (ind->bands = dom->bands) != 1)
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ } else
+ dom = NULL;
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ dst->bands = in1->bands = sr1->bands;
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = in1->format[b] = sr1->format[b];
+ if(sr2)
+ in2->format[b] = sr2->format[b];
+ }
+
+ /* check out our operator */
+ switch(raw->operator) {
+ case xieValAdd:
+ case xieValMax:
+ case xieValMin:
+ case xieValSub:
+ case xieValSubRev:
+ break;
+ case xieValDiv:
+ case xieValDivRev:
+ case xieValGamma:
+ case xieValMul:
+ if(raw->src2)
+ SourceError(flo,ped, return(FALSE));
+ break;
+ default: OperatorError(flo,ped,raw->operator, return(FALSE));
+ }
+ return( TRUE );
+} /* end PrepArith */
+
+/* end module parith.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pbandc.c b/xc/programs/Xserver/XIE/dixie/process/pbandc.c
new file mode 100644
index 000000000..278517ba9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pbandc.c
@@ -0,0 +1,191 @@
+/* $TOG: pbandc.c /main/5 1998/02/09 16:09:27 kaleb $ */
+/**** module pbandc.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pbandc.c -- DIXIE routines for managing the band combine element
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pbandc.c,v 3.3 1998/10/25 07:11:31 dawes Exp $ */
+
+#define _XIEC_PBANDC
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepBandCom(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pBandComVec = {
+ PrepBandCom /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a blend element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeBandCom(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloBandCombine);
+ ELEMENT_SIZE_MATCH(xieFloBandCombine);
+ ELEMENT_NEEDS_3_INPUTS(src1,src2,src3);
+
+ if(!(ped = MakePEDef(3, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo, tag, xieElemBandCombine, return(NULL));
+
+ ped->diVec = &pBandComVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloBandCombine *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src1, raw->src1);
+ cpswaps(stuff->src2, raw->src2);
+ cpswaps(stuff->src3, raw->src3);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloBandCombine));
+
+ /* assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src1;
+ inFlo[SRCt2].srcTag = raw->src2;
+ inFlo[SRCt3].srcTag = raw->src3;
+
+ return(ped);
+} /* end MakeBandCom */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepBandCom(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr in1 = &ped->inFloLst[SRCt1];
+ inFloPtr in2 = &ped->inFloLst[SRCt2];
+ inFloPtr in3 = &ped->inFloLst[SRCt3];
+ inFloPtr inf = in1;
+ outFloPtr sr1 = &in1->srcDef->outFlo;
+ outFloPtr sr2 = &in2->srcDef->outFlo;
+ outFloPtr sr3 = &in3->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* All inputs must be single band */
+ if(sr1->bands != 1 || sr2->bands != 1 || sr3->bands != 1)
+ MatchError(flo,ped, return(FALSE));
+
+ /* All sources must be either constrained or unconstrained */
+ if(IsConstrained(sr1->format[0].class)) {
+ if(IsntConstrained(sr2->format[0].class) ||
+ IsntConstrained(sr3->format[0].class))
+ MatchError(flo,ped, return(FALSE));
+ } else {
+ if(sr1->format[0].class != UNCONSTRAINED ||
+ sr2->format[0].class != UNCONSTRAINED ||
+ sr3->format[0].class != UNCONSTRAINED)
+ MatchError(flo,ped, return(FALSE));
+ }
+ /* grab a copy of the input attributes and propagate them to our output */
+ in1->bands = in2->bands = in3->bands = 1;
+ dst->bands = xieValMaxBands;
+ for(b = 0; b < xieValMaxBands; ++inf, ++b) {
+ dst->format[b] = inf->format[0] = inf->srcDef->outFlo.format[0];
+ dst->format[b].band = b;
+ if(IsConstrained(dst->format[b].class) &&
+ dst->format[b].depth > MAX_DEPTH(xieValMaxBands))
+ MatchError(flo,ped, return(FALSE));
+ }
+ return( TRUE );
+} /* end PrepBandCom */
+
+/* end module pbandc.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pbande.c b/xc/programs/Xserver/XIE/dixie/process/pbande.c
new file mode 100644
index 000000000..47a03fe33
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pbande.c
@@ -0,0 +1,190 @@
+/* $TOG: pbande.c /main/5 1998/02/09 16:09:31 kaleb $ */
+/**** module pbande.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pbande.c -- DIXIE routines for managing the band combine element
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pbande.c,v 3.3 1998/10/25 07:11:31 dawes Exp $ */
+
+#define _XIEC_PBANDE
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepBandExt(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pBandExtVec = {
+ PrepBandExt /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a blend element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeBandExt(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ double *coef;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pBandExtDefPtr pvt;
+ ELEMENT(xieFloBandExtract);
+ ELEMENT_SIZE_MATCH(xieFloBandExtract);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(pBandExtDefRec))))
+ FloAllocError(flo, tag, xieElemBandExtract, return(NULL));
+
+ ped->diVec = &pBandExtVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloBandExtract *)ped->elemRaw;
+ pvt = (pBandExtDefPtr)ped->elemPvt;
+ coef = pvt->coef;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->levels, raw->levels);
+ pvt->bias = ConvertFromIEEE(lswapl(stuff->bias));
+ coef[0] = ConvertFromIEEE(lswapl(stuff->constant0));
+ coef[1] = ConvertFromIEEE(lswapl(stuff->constant1));
+ coef[2] = ConvertFromIEEE(lswapl(stuff->constant2));
+ } else {
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloBandExtract));
+ pvt->bias = ConvertFromIEEE(stuff->bias);
+ coef[0] = ConvertFromIEEE(stuff->constant0);
+ coef[1] = ConvertFromIEEE(stuff->constant1);
+ coef[2] = ConvertFromIEEE(stuff->constant2);
+ }
+ /* assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeBandExt */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepBandExt(floDefPtr flo, peDefPtr ped)
+{
+ xieFloBandExtract *raw = (xieFloBandExtract *)ped->elemRaw;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+
+ /* verify input attribute compatibility */
+ if(src->bands != 3 ||
+ IsntCanonic(src->format[0].class) ||
+ src->format[0].width != src->format[1].width ||
+ src->format[1].width != src->format[2].width ||
+ src->format[0].height != src->format[1].height ||
+ src->format[1].height != src->format[2].height)
+ MatchError(flo,ped, return(FALSE));
+
+ inf->bands = 3;
+ dst->bands = 1;
+ inf->format[0] = src->format[0];
+ inf->format[1] = src->format[1];
+ inf->format[2] = src->format[2];
+ dst->format[0] = src->format[0];
+ if(IsConstrained(src->format[0].class)) {
+ dst->format[0].levels = raw->levels;
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+ }
+ return TRUE;
+} /* end PrepBandExt */
+
+/* end module pbande.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pbands.c b/xc/programs/Xserver/XIE/dixie/process/pbands.c
new file mode 100644
index 000000000..a6d3d8d3f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pbands.c
@@ -0,0 +1,170 @@
+/* $TOG: pbands.c /main/4 1998/02/09 16:09:36 kaleb $ */
+/**** module pbands.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pbands.c -- DIXIE routines for managing the band select element
+
+ Robert NC Shelley -- AGE Logic, Inc. September 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pbands.c,v 3.3 1998/10/25 07:11:31 dawes Exp $ */
+
+#define _XIEC_PBANDS
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepBandSel(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pBandSelVec = {
+ PrepBandSel /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a blend element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeBandSel(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloBandSelect);
+ ELEMENT_SIZE_MATCH(xieFloBandSelect);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo, tag, xieElemBandSelect, return(NULL));
+
+ ped->diVec = &pBandSelVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloBandSelect *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->bandNumber = stuff->bandNumber;
+ } else {
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloBandSelect));
+ }
+ /* assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeBandSel */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepBandSel(floDefPtr flo, peDefPtr ped)
+{
+ xieFloBandSelect *raw = (xieFloBandSelect *)ped->elemRaw;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+
+ if(src->bands != 3 || IsntCanonic(src->format[0].class))
+ MatchError(flo,ped, return(FALSE));
+ if(raw->bandNumber >= xieValMaxBands)
+ ValueError(flo,ped,(CARD32)raw->bandNumber, return(FALSE));
+
+ inf->bands = 3;
+ dst->bands = 1;
+ inf->format[0] = src->format[0];
+ inf->format[1] = src->format[1];
+ inf->format[2] = src->format[2];
+ dst->format[0] = src->format[raw->bandNumber];
+ dst->format[0].band = 0;
+
+ return( TRUE );
+} /* end PrepBandSel */
+
+/* end module pbands.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pblend.c b/xc/programs/Xserver/XIE/dixie/process/pblend.c
new file mode 100644
index 000000000..281a12baa
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pblend.c
@@ -0,0 +1,254 @@
+/* $TOG: pblend.c /main/5 1998/02/09 16:09:40 kaleb $ */
+/**** module pblend.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pblend.c -- DIXIE routines for managing the Blend element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pblend.c,v 3.3 1998/10/25 07:11:32 dawes Exp $ */
+
+#define _XIEC_PBLEND
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepBlend(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pBlendVec = {
+ PrepBlend /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a blend element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeBlend(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs, index;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pBlendDefPtr pvt;
+ ELEMENT(xieFloBlend);
+ ELEMENT_SIZE_MATCH(xieFloBlend);
+ ELEMENT_NEEDS_1_INPUT(src1); /* Other input either src2 or constant */
+ inputs = 1 + (stuff->src2 ? 1 : 0)
+ + (stuff->alpha ? 1 : 0)
+ + (stuff->domainPhototag ? 1 : 0);
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2,
+ sizeof(pBlendDefRec))))
+ FloAllocError(flo, tag, xieElemBlend, return(NULL));
+
+ ped->diVec = &pBlendVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloBlend *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src1, raw->src1);
+ cpswaps(stuff->src2, raw->src2);
+ cpswaps(stuff->alpha, raw->alpha);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->bandMask = stuff->bandMask;
+ cpswapl(stuff->constant0, raw->constant0);
+ cpswapl(stuff->constant1, raw->constant1);
+ cpswapl(stuff->constant2, raw->constant2);
+ cpswapl(stuff->alphaConst, raw->alphaConst);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloBlend));
+
+ /*
+ * convert constants
+ */
+ pvt = (pBlendDefPtr)ped->elemPvt;
+ if(!raw->src2) {
+ pvt->constant[0] = ConvertFromIEEE(raw->constant0);
+ pvt->constant[1] = ConvertFromIEEE(raw->constant1);
+ pvt->constant[2] = ConvertFromIEEE(raw->constant2);
+ index = SRCt1;
+ } else
+ index = SRCt2;
+
+ pvt->alphaConst = ConvertFromIEEE(raw->alphaConst);
+ pvt->aindex = (raw->alpha) ? ++index : 0;
+ pvt->dindex = (raw->domainPhototag) ? ++index : 0;
+
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src1;
+ if(raw->src2) inFlo[SRCt2].srcTag = raw->src2;
+ if(raw->alpha) inFlo[pvt->aindex].srcTag = raw->alpha;
+ if(raw->domainPhototag) inFlo[pvt->dindex].srcTag = raw->domainPhototag;
+
+ return(ped);
+} /* end MakeBlend */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepBlend(floDefPtr flo, peDefPtr ped)
+{
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ pBlendDefPtr pvt = (pBlendDefPtr)ped->elemPvt;
+ inFloPtr ind, ina, in2, in1 = &ped->inFloLst[SRCt1];
+ outFloPtr dom, sra, sr2, sr1 = &in1->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int aindex = pvt->aindex, dindex = pvt->dindex, b;
+ CARD8 bmask = raw->bandMask;
+
+ if (( raw->alpha && pvt->alphaConst <= 0.0) ||
+ (!raw->alpha && (pvt->alphaConst < 0.0 || pvt->alphaConst > 1.0)))
+ ValueError(flo, ped, raw->alphaConst, return(FALSE));
+
+ for (b = 0; b < sr1->bands; b++)
+ if (IsntCanonic(sr1->format[b].class) ||
+ ((bmask & (1<<b)) && sr1->format[b].class == BIT_PIXEL))
+ MatchError(flo,ped,return(FALSE));
+
+ /* check out our second source */
+ if(raw->src2) {
+ in2 = &ped->inFloLst[SRCt2];
+ sr2 = &in2->srcDef->outFlo;
+ if(sr1->bands != sr2->bands)
+ MatchError(flo,ped, return(FALSE));
+ in2->bands = sr2->bands;
+ for (b = 0; b < sr1->bands; b++) {
+ if ((bmask & (1<<b)) == 0) continue;
+ if (sr1->format[b].class != sr2->format[b].class ||
+ (IsConstrained(sr1->format[b].class) &&
+ sr1->format[b].levels != sr2->format[b].levels))
+ MatchError(flo,ped, return(FALSE));
+ }
+ } else
+ sr2 = NULL;
+
+
+ /* check out our alpha plane */
+ if(aindex) {
+ ina = &ped->inFloLst[aindex];
+ sra = &ina->srcDef->outFlo;
+ ina->bands = sra->bands;
+ for (b = 0; b < sra->bands; b++) {
+ if (IsCanonic(sra->format[b].class))
+ ina->format[b] = sra->format[b];
+ else
+ MatchError(flo,ped, return(FALSE));
+ }
+ }
+
+ /* check out our process domain */
+ if(dindex) {
+ ind = &ped->inFloLst[dindex];
+ dom = &ind->srcDef->outFlo;
+ if((ind->bands = dom->bands) != 1 || IsntDomain(dom->format[0].class))
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ }
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ dst->bands = in1->bands = sr1->bands;
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = in1->format[b] = sr1->format[b];
+ if(sr2)
+ in2->format[b] = sr2->format[b];
+ }
+
+ return( TRUE );
+} /* end PrepBlend */
+
+/* end module pblend.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pcfrgb.c b/xc/programs/Xserver/XIE/dixie/process/pcfrgb.c
new file mode 100644
index 000000000..7a49cc5f9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pcfrgb.c
@@ -0,0 +1,396 @@
+/* $TOG: pcfrgb.c /main/5 1998/02/09 16:09:46 kaleb $ */
+/**** module pcfrgb.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pcfrgb.c -- DIXIE routines for managing the ConvertFromRGB element
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pcfrgb.c,v 3.4 1998/10/25 07:11:32 dawes Exp $ */
+
+#define _XIEC_PCFRGB
+
+/*
+ * Include files
+ */
+
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPConvertFromRGB(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec pConvertFromRGBVec = {
+ PrepPConvertFromRGB /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+------------------ routine: make a ConvertFromRBG element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConvertFromRGB(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloConvertFromRGB);
+ ELEMENT_AT_LEAST_SIZE(xieFloConvertFromRGB);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemConvertFromRGB, return(NULL)) ;
+
+ ped->diVec = &pConvertFromRGBVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConvertFromRGB *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswaps(stuff->convert, raw->convert);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConvertFromRGB));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValConvertFromRGB, raw->convert)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValConvertFromRGB,raw->convert,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+
+ return(ped);
+} /* end MakePConvertFromRGB */
+
+/*------------------------------------------------------------------------
+------ routine: copy routine for CIELab and CIEXYZ techniques -----------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecRGBToCIELab *)sParms)
+#undef rparms
+#define rparms ((xieTecRGBToCIELab *)rParms)
+
+Bool CopyPConvertFromRGBCIE(TECHNQ_COPY_ARGS)
+{
+ pTecRGBToCIEDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecRGBToCIEDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertFromRGB, return(TRUE));
+
+ pvt = (pTecRGBToCIEDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ swap_floats(&pvt->matrix[0], &sparms->matrix00, 9);
+ cpswaps(sparms->whiteAdjusted, pvt->whiteAdjusted);
+ cpswaps(sparms->lenParams, pvt->lenWhiteParams);
+ } else {
+ copy_floats(&pvt->matrix[0], &sparms->matrix00, 9);
+ pvt->whiteAdjusted = sparms->whiteAdjusted;
+ pvt->lenWhiteParams = sparms->lenParams;
+ }
+
+ if(!(pvt->whiteTec = FindTechnique(xieValWhiteAdjust, pvt->whiteAdjusted)) ||
+ !(TECH_WADJ_FUNC(pvt->whiteTec)(flo, ped, &sparms[1], pvt->whitePoint,
+ pvt->whiteTec, pvt->lenWhiteParams,
+ pvt->whiteAdjusted == xieValDefault)))
+ TechniqueError(flo,ped,xieValWhiteAdjust,pvt->whiteAdjusted,
+ pvt->lenWhiteParams, return(TRUE));
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------- routine: copy routine for YCbCr and YCC techniques ------------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecRGBToYCbCr *)sParms)
+#undef rparms
+#define rparms ((xieTecRGBToYCbCr *)rParms)
+
+Bool CopyPConvertFromRGBYCbCr(TECHNQ_COPY_ARGS)
+{
+ pTecRGBToYCbCrDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecRGBToYCbCrDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertFromRGB, return(TRUE));
+
+ pvt = (pTecRGBToYCbCrDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ cpswapl(sparms->levels0, pvt->levels0);
+ cpswapl(sparms->levels1, pvt->levels1);
+ cpswapl(sparms->levels2, pvt->levels2);
+ swap_floats(&pvt->red, &sparms->lumaRed, 3);
+ swap_floats(&pvt->bias0, &sparms->bias0, 3);
+ } else {
+ pvt->levels0 = sparms->levels0;
+ pvt->levels1 = sparms->levels1;
+ pvt->levels2 = sparms->levels2;
+ copy_floats(&pvt->red, &sparms->lumaRed, 3);
+ copy_floats(&pvt->bias0, &sparms->bias0, 3);
+ }
+
+ return (TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecRGBToYCC *)sParms)
+#undef rparms
+#define rparms ((xieTecRGBToYCC *)rParms)
+
+Bool CopyPConvertFromRGBYCC(TECHNQ_COPY_ARGS)
+{
+ pTecRGBToYCCDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecRGBToYCCDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertFromRGB, return(TRUE));
+
+ pvt = (pTecRGBToYCCDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ cpswapl(sparms->levels0, pvt->levels0);
+ cpswapl(sparms->levels1, pvt->levels1);
+ cpswapl(sparms->levels2, pvt->levels2);
+ swap_floats(&pvt->red, &sparms->lumaRed, 3);
+ pvt->scale = ConvertFromIEEE(lswapl(sparms->scale));
+ } else {
+ pvt->levels0 = sparms->levels0;
+ pvt->levels1 = sparms->levels1;
+ pvt->levels2 = sparms->levels2;
+ copy_floats(&pvt->red, &sparms->lumaRed, 3);
+ pvt->scale = ConvertFromIEEE(sparms->scale);
+ }
+
+ return (TRUE);
+}
+
+#undef sparms
+#undef rparms
+
+/*------------------------------------------------------------------------
+-- routine: prep routine for RGB to CIElab and CIEXYZ techniques ---------
+------------------------------------------------------------------------*/
+
+Bool PrepPConvertFromRGBCIE(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToCIELab *tec) /* same as xieTecRGBToCIEXYZ */
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pTecRGBToCIEDefPtr pvt = (pTecRGBToCIEDefPtr)ped->techPvt;
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ dst->format[b] = inf->format[b] = src->format[b];
+ /* Now, fix up everthing in the destination that will change */
+ /* For this element, src may have been CONSTRAINED */
+ dst->format[b].class = UNCONSTRAINED;
+ dst->format[b].depth = sz_RealPixel;
+ dst->format[b].levels = 0; /* Unconstrained */
+ dst->format[b].stride = sz_RealPixel;
+ dst->format[b].pitch = sz_RealPixel * dst->format[b].width;
+ }
+
+ return(pvt->whiteTec->prepfnc(flo,ped,pvt->whitePoint));
+}
+
+/*------------------------------------------------------------------------
+-- routine: prep routine for RGB to YCbCr and YCC techniques -------------
+------------------------------------------------------------------------*/
+Bool PrepPConvertFromRGBYCbCr(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToYCbCr *tec)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pTecRGBToYCbCrDefPtr pvt = (pTecRGBToYCbCrDefPtr)ped->techPvt;
+ CARD32 *levels = &(pvt->levels0);
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ dst->format[b] = inf->format[b] = src->format[b];
+ if (IsConstrained(dst->format[b].class))
+ dst->format[b].levels = *(levels+b);
+ }
+
+ if (IsConstrained(dst->format[0].class)) {
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo,ped, return(FALSE));
+ } /* else the structure copy was sufficient */
+
+ return(TRUE);
+}
+
+Bool PrepPConvertFromRGBYCC(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToYCC *tec)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pTecRGBToYCCDefPtr pvt = (pTecRGBToYCCDefPtr)ped->techPvt;
+ CARD32 *levels = &(pvt->levels0);
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ dst->format[b] = inf->format[b] = src->format[b];
+ if (IsConstrained(dst->format[b].class))
+ dst->format[b].levels = *(levels+b);
+ }
+
+ if (IsConstrained(dst->format[0].class)) {
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo,ped, return(FALSE));
+ } /* else the structure copy was sufficient */
+
+ if (pvt->scale < .001) { /* should be about 1.35 or 1.4 */
+ ValueError(flo, ped, tec->scale, return(FALSE));
+ }
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+
+static Bool PrepPConvertFromRGB(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ xieFloConvertFromRGB *raw = (xieFloConvertFromRGB *)ped->elemRaw;
+
+ /* Input must be triple band and dimensions must match */
+ if (IsntCanonic(src->format[0].class) ||
+ src->bands != 3 ||
+ src->format[0].width != src->format[1].width ||
+ src->format[1].width != src->format[2].width ||
+ src->format[0].height != src->format[1].height ||
+ src->format[1].height != src->format[2].height)
+ MatchError(flo,ped, return(FALSE));
+
+ /*
+ ** Technique Prep routine will complete the normal propagation of src
+ ** attributes, and setup of destination attributes.
+ */
+
+ if (!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValConvertFromRGB,raw->convert,
+ raw->lenParams, return(FALSE));
+
+ return (TRUE);
+}
+
+/* end module pcfrgb.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pcfromi.c b/xc/programs/Xserver/XIE/dixie/process/pcfromi.c
new file mode 100644
index 000000000..b62be2216
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pcfromi.c
@@ -0,0 +1,208 @@
+/* $TOG: pcfromi.c /main/5 1998/02/09 16:09:52 kaleb $ */
+/**** module pcfromi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pcfromi.c -- DIXIE routines for managing the ConvertFromIndex element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pcfromi.c,v 3.3 1998/10/25 07:11:32 dawes Exp $ */
+
+#define _XIEC_PCFROMI
+#define _XIEC_PCI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * more X server includes.
+ */
+#include <scrnintstr.h>
+#include <colormapst.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+
+/* routines internal to this module
+ */
+static Bool PrepConvertFromIndex(floDefPtr flo, peDefPtr ped);
+
+/* dixie entry points
+ */
+static diElemVecRec pCfromIVec = {
+ PrepConvertFromIndex
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ConvertFromIndex element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConvertFromIndex(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloConvertFromIndex);
+ ELEMENT_AT_LEAST_SIZE(xieFloConvertFromIndex);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped=MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(pCfromIDefRec))))
+ FloAllocError(flo,tag,xieElemConvertFromIndex, return(NULL));
+
+ ped->diVec = &pCfromIVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConvertFromIndex *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->class = stuff->class;
+ raw->precision = stuff->precision;
+ cpswapl(stuff->colormap, raw->colormap);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConvertFromIndex));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeConvertFromIndex */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepConvertFromIndex(floDefPtr flo, peDefPtr ped)
+{
+ xieFloConvertFromIndex *raw = (xieFloConvertFromIndex *)ped->elemRaw;
+ pCfromIDefPtr pvt = (pCfromIDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCt1];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD32 depth, levels, b;
+
+ /* check client parameters
+ */
+ if((raw->class != xieValSingleBand &&
+ raw->class != xieValTripleBand) ||
+ raw->precision < 1 || raw->precision > 16)
+ ValueError(flo,ped,raw->precision, return(FALSE));
+
+ /* grab attributes from colormap, visual, ...
+ */
+ if(!(pvt->cmap = (ColormapPtr) LookupIDByType(raw->colormap, RT_COLORMAP)))
+ ColormapError(flo,ped,raw->colormap, return(FALSE));
+ pvt->precShift = 16 - raw->precision;
+ pvt->class = pvt->cmap->class;
+ pvt->visual = pvt->cmap->pVisual;
+ pvt->pixMsk[0] = pvt->visual->redMask;
+ pvt->pixMsk[1] = pvt->visual->greenMask;
+ pvt->pixMsk[2] = pvt->visual->blueMask;
+ pvt->pixPos[0] = pvt->visual->offsetRed;
+ pvt->pixPos[1] = pvt->visual->offsetGreen;
+ pvt->pixPos[2] = pvt->visual->offsetBlue;
+ pvt->cells = pvt->visual->ColormapEntries;
+ levels = (pvt->class <= PseudoColor ? pvt->cells :
+ (pvt->pixMsk[0] | pvt->pixMsk[1] | pvt->pixMsk[2]) + 1);
+ SetDepthFromLevels(levels,depth);
+
+ if(IsntConstrained(src->format[0].class)
+ || src->bands > 1 || src->format[0].levels != 1<<depth)
+ MatchError(flo,ped, return(FALSE));
+
+ /* generate output attributes from input attributes and precision arg
+ */
+ dst->bands = (raw->class == xieValSingleBand) ? 1 : 3;
+ inf->bands = src->bands;
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = inf->format[0] = src->format[0];
+ dst->format[b].band = b;
+ dst->format[b].levels = (1<<raw->precision);
+ }
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped,return(FALSE));
+
+ return(TRUE);
+} /* end PrepConvertFromIndex */
+
+/* end module pcfromi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pcnst.c b/xc/programs/Xserver/XIE/dixie/process/pcnst.c
new file mode 100644
index 000000000..9df55d1e0
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pcnst.c
@@ -0,0 +1,307 @@
+/* $TOG: pcnst.c /main/6 1998/02/09 16:09:56 kaleb $ */
+/**** module pcnst.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pcnst..c -- DIXIE routines for managing the Constrain element
+
+ Dean Verheiden -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pcnst.c,v 3.4 1998/10/25 07:11:33 dawes Exp $ */
+
+#define _XIEC_PCNST
+
+/*
+ * Include files
+ */
+
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPConstrain(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec pConstrainVec = {
+ PrepPConstrain /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+-------------------- routine: make a constrain element ------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConstrain(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloConstrain);
+ ELEMENT_AT_LEAST_SIZE(xieFloConstrain);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemConstrain, return(NULL)) ;
+
+ ped->diVec = &pConstrainVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConstrain *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->levels0, raw->levels0);
+ cpswapl(stuff->levels1, raw->levels1);
+ cpswapl(stuff->levels2, raw->levels2);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ cpswaps(stuff->constrain, raw->constrain);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConstrain));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValConstrain, raw->constrain)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValConstrain,raw->constrain,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+
+ return(ped);
+} /* end MakePConstrain */
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for no param techniques -------------
+------------------------------------------------------------------------*/
+
+Bool CopyPConstrainStandard(TECHNQ_COPY_ARGS)
+{
+ return(tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for Clip-Scale technique ---------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecClipScale *)sParms)
+#undef rparms
+#define rparms ((xieTecClipScale *)rParms)
+
+Bool CopyPConstrainClipScale(TECHNQ_COPY_ARGS)
+{
+ pCnstDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pCnstDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConstrain, return(TRUE));
+
+ pvt = (pCnstDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ pvt->input_low[0] = ConvertFromIEEE(lswapl(sparms->inputLow0));
+ pvt->input_low[1] = ConvertFromIEEE(lswapl(sparms->inputLow1));
+ pvt->input_low[2] = ConvertFromIEEE(lswapl(sparms->inputLow2));
+ pvt->input_high[0] = ConvertFromIEEE(lswapl(sparms->inputHigh0));
+ pvt->input_high[1] = ConvertFromIEEE(lswapl(sparms->inputHigh1));
+ pvt->input_high[2] = ConvertFromIEEE(lswapl(sparms->inputHigh2));
+ cpswapl(sparms->outputLow0, pvt->output_low[0]);
+ cpswapl(sparms->outputLow1, pvt->output_low[1]);
+ cpswapl(sparms->outputLow2, pvt->output_low[2]);
+ cpswapl(sparms->outputHigh0, pvt->output_high[0]);
+ cpswapl(sparms->outputHigh1, pvt->output_high[1]);
+ cpswapl(sparms->outputHigh2, pvt->output_high[2]);
+ } else {
+ pvt->input_low[0] = ConvertFromIEEE(sparms->inputLow0);
+ pvt->input_low[1] = ConvertFromIEEE(sparms->inputLow1);
+ pvt->input_low[2] = ConvertFromIEEE(sparms->inputLow2);
+ pvt->input_high[0] = ConvertFromIEEE(sparms->inputHigh0);
+ pvt->input_high[1] = ConvertFromIEEE(sparms->inputHigh1);
+ pvt->input_high[2] = ConvertFromIEEE(sparms->inputHigh2);
+ pvt->output_low[0] = sparms->outputLow0;
+ pvt->output_low[1] = sparms->outputLow1;
+ pvt->output_low[2] = sparms->outputLow2;
+ pvt->output_high[0] = sparms->outputHigh0;
+ pvt->output_high[1] = sparms->outputHigh1;
+ pvt->output_high[2] = sparms->outputHigh2;
+ }
+
+ return (TRUE);
+}
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for no param techniques -------------
+------------------------------------------------------------------------*/
+Bool PrepPConstrainStandard(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Clip Scale technique ----------
+------------------------------------------------------------------------*/
+Bool PrepPConstrainClipScale(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecClipScale *raw,
+ xieTecClipScale *tec)
+{
+ pCnstDefPtr pvt = (pCnstDefPtr)ped->techPvt;
+
+ if (pvt->input_low[0] == pvt->input_high[0] ||
+ pvt->output_low[0] > ped->outFlo.format[0].levels - 1 ||
+ pvt->output_high[0] > ped->outFlo.format[0].levels - 1)
+ return(FALSE);
+ if (ped->outFlo.bands > 1) {
+ if ( pvt->input_low[1] == pvt->input_high[1] ||
+ pvt->output_low[1] > ped->outFlo.format[1].levels - 1 ||
+ pvt->output_high[1] > ped->outFlo.format[1].levels - 1 ||
+ pvt->input_low[2] == pvt->input_high[2] ||
+ pvt->output_low[2] > ped->outFlo.format[2].levels - 1 ||
+ pvt->output_high[2] > ped->outFlo.format[2].levels - 1)
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+
+static Bool PrepPConstrain(
+ floDefPtr flo,
+ peDefPtr ped)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ xieFloConstrain *raw = (xieFloConstrain *)ped->elemRaw;
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+
+ /* This should be impossible */
+ if (IsntCanonic(src->format[b].class))
+ ImplementationError(flo, ped, return(FALSE));
+
+ inf->format[b] = src->format[b];
+
+ /* Copy outFlo values that are unchanged by constrain */
+ dst->format[b].band = b;
+ dst->format[b].interleaved = src->format[b].interleaved;
+ dst->format[b].width = src->format[b].width;
+ dst->format[b].height = src->format[b].height;
+ }
+ /* Pull in levels information from the element description */
+ if ((dst->format[0].levels = raw->levels0) > MAX_LEVELS(src->bands))
+ ValueError(flo,ped,raw->levels0,return(FALSE));
+ if (dst->bands > 1) {
+ if ((dst->format[1].levels = raw->levels1) > MAX_LEVELS(src->bands))
+ ValueError(flo,ped,raw->levels1,return(FALSE));
+ if ((dst->format[2].levels = raw->levels2) > MAX_LEVELS(src->bands))
+ ValueError(flo,ped,raw->levels2,return(FALSE));
+ }
+ /* Set depth, class, stride, and pitch */
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ /* Take care of any technique parameters */
+ if (!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValConstrain,raw->constrain,raw->lenParams,
+ return(FALSE));
+ return (TRUE);
+}
+
+/* end module pcnst.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pcomp.c b/xc/programs/Xserver/XIE/dixie/process/pcomp.c
new file mode 100644
index 000000000..27f377041
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pcomp.c
@@ -0,0 +1,273 @@
+/* $TOG: pcomp.c /main/4 1998/02/09 16:10:00 kaleb $ */
+/**** module pcomp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pcomp.c -- DIXIE routines for managing the compare element
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pcomp.c,v 3.3 1998/10/25 07:11:33 dawes Exp $ */
+
+#define _XIEC_PCOMP
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepCompare(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pCompareVec = {
+ PrepCompare /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a arithmetic element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeCompare(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pCompareDefPtr pvt;
+ ELEMENT(xieFloCompare);
+ ELEMENT_SIZE_MATCH(xieFloCompare);
+ ELEMENT_NEEDS_1_INPUT(src1);
+ inputs = 1 + (stuff->src2 ? 1 : 0) + (stuff->domainPhototag ? 1 :0);
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2,
+ sizeof(pCompareDefRec))))
+ FloAllocError(flo, tag, xieElemCompare, return(NULL));
+
+ ped->diVec = &pCompareVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloCompare *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src1, raw->src1);
+ cpswaps(stuff->src2, raw->src2);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->operator = stuff->operator;
+ raw->combine = stuff->combine;
+ cpswapl(stuff->constant0, raw->constant0);
+ cpswapl(stuff->constant1, raw->constant1);
+ cpswapl(stuff->constant2, raw->constant2);
+ raw->bandMask = stuff->bandMask;
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloCompare));
+
+ if(!raw->src2) {
+ /*
+ * convert constants
+ */
+ pvt = (pCompareDefPtr)ped->elemPvt;
+ pvt->constant[0] = ConvertFromIEEE(raw->constant0);
+ pvt->constant[1] = ConvertFromIEEE(raw->constant1);
+ pvt->constant[2] = ConvertFromIEEE(raw->constant2);
+ }
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src1;
+ if(raw->src2) inFlo[SRCt2].srcTag = raw->src2;
+ if(raw->domainPhototag) inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+
+ return(ped);
+} /* end MakeCompare */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepCompare(floDefPtr flo, peDefPtr ped)
+{
+ xieFloCompare *raw = (xieFloCompare *)ped->elemRaw;
+ inFloPtr ind, in2, in1 = &ped->inFloLst[SRCt1];
+ outFloPtr dom, sr2, sr1 = &in1->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD8 mask, bandMask = raw->bandMask;
+ int b;
+
+ /* check out our second source */
+ if(raw->src2) {
+ in2 = &ped->inFloLst[SRCt2];
+ sr2 = &in2->srcDef->outFlo;
+ if(sr1->bands != sr2->bands)
+ MatchError(flo,ped, return(FALSE));
+ for (b = 0, mask = 1; b < sr1->bands; b++, mask <<= 1) {
+ if (sr1->bands == 3 && raw->combine && (!(mask & bandMask)))
+ continue;
+ if (IsntCanonic(sr1->format[b].class) ||
+ sr1->format[b].class != sr2->format[b].class ||
+ (IsConstrained(sr1->format[b].class) &&
+ sr1->format[b].levels != sr2->format[b].levels))
+ MatchError(flo,ped, return(FALSE));
+ }
+ in2->bands = sr2->bands;
+ } else
+ sr2 = NULL;
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if((ind->bands = dom->bands) != 1 || IsntDomain(dom->format[0].class))
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ } else
+ dom = NULL;
+
+ /* grab a copy of the input attributes and propagate them to our inputs */
+ in1->bands = sr1->bands;
+ for(b = 0; b < sr1->bands; b++) {
+ in1->format[b] = sr1->format[b];
+ if(sr2)
+ in2->format[b] = sr2->format[b];
+ }
+
+ /* Determine class of output */
+ if (sr1->bands > 1 && !raw->combine) {
+ if (~(~0<<sr1->bands) & ~raw->bandMask) /* mask must be for all bands */
+ MatchError(flo,ped, return(FALSE));
+ dst->bands = sr1->bands;
+ } else
+ dst->bands = 1;
+
+ /* In this case, all src bands must have the same dimension */
+ if (sr1->bands == 3 && raw->combine &&
+ (((bandMask & 3) == 3 &&
+ (sr1->format[0].width != sr1->format[1].width ||
+ sr1->format[0].height != sr1->format[1].height)) ||
+ ((bandMask & 5) == 5 &&
+ (sr1->format[0].width != sr1->format[2].width ||
+ sr1->format[0].height != sr1->format[2].height)) ||
+ ((bandMask & 6) == 6 &&
+ (sr1->format[1].width != sr1->format[2].width ||
+ sr1->format[1].height != sr1->format[2].height))))
+ MatchError(flo,ped, return(FALSE));
+
+ /* Check the operator */
+ if (raw->operator != xieValLT && raw->operator != xieValLE &&
+ raw->operator != xieValEQ && raw->operator != xieValNE &&
+ raw->operator != xieValGT && raw->operator != xieValGE)
+ OperatorError(flo,ped,raw->operator, return(FALSE));
+
+ /*
+ Second check necessary because of protocol . . . must distinguish
+ between FloMatch errors and FloOperator errors
+ */
+ if (dst->bands > 1 && raw->combine) {
+ if (raw->operator != xieValEQ && raw->operator != xieValNE)
+ MatchError(flo,ped, return(FALSE));
+ }
+
+ /* Set up destination parameters */
+ for(b = 0; b < dst->bands; b++) {
+ CARD32 bits = sr1->format[b].width;
+
+ dst->format[b].class = BIT_PIXEL;
+ dst->format[b].band = b;
+ dst->format[b].interleaved = FALSE;
+ dst->format[b].depth = 1;
+ dst->format[b].width = bits;
+ dst->format[b].height = sr1->format[b].height;
+ dst->format[b].levels = 2;
+ dst->format[b].stride = 1;
+ dst->format[b].pitch = bits + Align(bits,PITCH_MOD);
+ }
+ return( TRUE );
+} /* end PrepCompare */
+
+/* end module pcomp.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pconv.c b/xc/programs/Xserver/XIE/dixie/process/pconv.c
new file mode 100644
index 000000000..efed241b1
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pconv.c
@@ -0,0 +1,297 @@
+/* $TOG: pconv.c /main/6 1998/02/09 16:10:05 kaleb $ */
+/**** module pconv.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pconv.c -- DIXIE routines for managing the Convolution element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pconv.c,v 3.4 1998/10/25 07:11:33 dawes Exp $ */
+
+#define _XIEC_PCONV
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepConvolve(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pConvolveVec = {
+ PrepConvolve /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a convolution element --------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConvolve(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ConvFloat *pvt;
+ xieTypFloat *kptr;
+ int i, numke;
+ ELEMENT(xieFloConvolve);
+ ELEMENT_AT_LEAST_SIZE(xieFloConvolve);
+ ELEMENT_NEEDS_1_INPUT(src);
+ inputs = 1 + (stuff->domainPhototag ? 1 :0);
+
+
+ numke = stuff->kernelSize * stuff->kernelSize;
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2,
+ numke * sizeof(ConvFloat))))
+ FloAllocError(flo, tag, xieElemConvolve, return(NULL));
+
+ ped->diVec = &pConvolveVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConvolve *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->bandMask = stuff->bandMask;
+ raw->kernelSize = stuff->kernelSize;
+ cpswaps(stuff->convolve, raw->convolve);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConvolve));
+
+ /* Copy over and convert the kernel */
+ kptr = (xieTypFloat *)&stuff[1];
+ pvt = (ConvFloat *)ped->elemPvt;
+ if (flo->reqClient->swapped)
+ for (i = 0; i < numke; i++) {
+ /* can't use *pvt++ = ConvertFromIEEE(lswapl(*kptr++)); */
+ /* because lswapl is a macro, and overincrements kptr */
+ *pvt++ = ConvertFromIEEE(lswapl(*kptr));
+ ++kptr;
+ }
+ else
+ for (i = 0; i < numke; i++)
+ *pvt++ = ConvertFromIEEE(*kptr++);
+ /*
+ * Ensure that the kernel size is odd
+ */
+ if (!(stuff->kernelSize & 1))
+ ValueError(flo,ped,(CARD32)raw->kernelSize,return(ped));
+
+ /*
+ * copy technique data (if any)
+ * Note that we must skip past the convolution kernel to get there
+ */
+ if(!(ped->techVec = FindTechnique(xieValConvolve, raw->convolve)) ||
+ !(ped->techVec->copyfnc(flo, ped, (CARD8 *)&stuff[1] + numke * 4,
+ (CARD8 *)&raw[1] + numke * 4,
+ raw->lenParams,
+ raw->convolve == xieValDefault)))
+ TechniqueError(flo,ped,xieValConvolve,raw->convolve,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+ if(raw->domainPhototag) inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+
+ return(ped);
+} /* end MakeConv */
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for Constant technique ---------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecConvolveConstant *)sParms)
+#undef rparms
+#define rparms ((xieTecConvolveConstant *)rParms)
+
+Bool CopyConvolveConstant(TECHNQ_COPY_ARGS)
+{
+ pTecConvolveConstantDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if (!(ped->techPvt=(pointer )XieMalloc(sizeof(pTecConvolveConstantDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemConvolve, return(TRUE));
+
+ pvt = (pTecConvolveConstantDefPtr)ped->techPvt;
+
+ if (isDefault || !tsize) {
+ pvt->constant[0] = pvt->constant[1] = pvt->constant[2] = 0;
+ } else if( flo->reqClient->swapped ) {
+ pvt->constant[0] = ConvertFromIEEE(lswapl(sparms->constant0));
+ pvt->constant[1] = ConvertFromIEEE(lswapl(sparms->constant1));
+ pvt->constant[2] = ConvertFromIEEE(lswapl(sparms->constant2));
+ } else {
+ pvt->constant[0] = ConvertFromIEEE(sparms->constant0);
+ pvt->constant[1] = ConvertFromIEEE(sparms->constant1);
+ pvt->constant[2] = ConvertFromIEEE(sparms->constant2);
+ }
+
+ return (TRUE);
+}
+
+#ifdef BEYOND_SI
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for no param techniques -------------
+------------------------------------------------------------------------*/
+
+Bool CopyConvolveReplicate(TECHNQ_COPY_ARGS)
+{
+ return(tsize == 0);
+}
+#endif /* BEYOND_SI */
+
+#undef sparms
+#undef rparms
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepConvolve(floDefPtr flo, peDefPtr ped)
+{
+ xieFloConvolve *raw = (xieFloConvolve *)ped->elemRaw;
+ inFloPtr ind, in = &ped->inFloLst[SRCtag];
+ outFloPtr dom, src = &in->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if((ind->bands = dom->bands) != 1 || IsntDomain(dom->format[0].class))
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ } else
+ dom = NULL;
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ dst->bands = in->bands = src->bands;
+
+ for(b = 0; b < dst->bands; b++) {
+ if (IsntCanonic(src->format[b].class) ||
+ ((raw->bandMask & (1<<b)) && src->format[b].class == BIT_PIXEL))
+ MatchError(flo, ped, return(FALSE));
+ dst->format[b] = in->format[b] = src->format[b];
+ }
+
+ if(!(ped->techVec->prepfnc(flo, ped, raw, &raw[1] +
+ raw->kernelSize * raw->kernelSize * 4)))
+ TechniqueError(flo,ped,xieValConvolve,raw->convolve,raw->lenParams,
+ return(FALSE));
+
+ return( TRUE );
+} /* end PrepConvolve */
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for no param techniques -----------
+------------------------------------------------------------------------*/
+Bool PrepConvolveStandard(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+/* end module pconv.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pctoi.c b/xc/programs/Xserver/XIE/dixie/process/pctoi.c
new file mode 100644
index 000000000..8301e5167
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pctoi.c
@@ -0,0 +1,416 @@
+/* $TOG: pctoi.c /main/8 1998/02/09 16:10:09 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module pctoi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pctoi.c -- DIXIE routines for managing the ConvertToIndex element
+
+ Dean Verheiden && Robert NC Shelley -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pctoi.c,v 3.4 1998/10/25 07:11:34 dawes Exp $ */
+
+#define _XIEC_PCTOI
+#define _XIEC_PCI
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * more X server includes.
+ */
+#include <scrnintstr.h>
+#include <colormapst.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <colorlst.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+
+/* routines internal to this module
+ */
+static Bool PrepConvertToIndex(floDefPtr flo, peDefPtr ped);
+static Bool DebriefConvertToIndex(floDefPtr flo, peDefPtr ped, Bool ok);
+
+/* dixie entry points
+ */
+static diElemVecRec pCtoIVec = {
+ PrepConvertToIndex,
+ DebriefConvertToIndex
+ };
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make an ExportPhotomap element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConvertToIndex(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloConvertToIndex);
+ ELEMENT_AT_LEAST_SIZE(xieFloConvertToIndex);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1,(CARD32)stuff->elemLength<<2,sizeof(pCtoIDefRec))))
+ FloAllocError(flo,tag,xieElemConvertToIndex, return(NULL));
+
+ ped->diVec = &pCtoIVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConvertToIndex *)ped->elemRaw;
+ /*
+ * copy the standard client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->notify = stuff->notify;
+ cpswapl(stuff->colormap, raw->colormap);
+ cpswapl(stuff->colorList, raw->colorList);
+ cpswaps(stuff->colorAlloc, raw->colorAlloc);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConvertToIndex));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValColorAlloc,raw->colorAlloc)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams,
+ raw->colorAlloc == xieValDefault)))
+ TechniqueError(flo,ped,xieValColorAlloc,raw->colorAlloc,raw->lenParams,
+ return(ped));
+
+ return(ped);
+} /* end MakeConvertToIndex */
+
+/*------------------------------------------------------------------------
+----------------------- copy routines for techniques -------------------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecColorAllocAll *)sParms)
+#undef rparms
+#define rparms ((xieTecColorAllocAll *)rParms)
+
+Bool CopyCtoIAllocAll(TECHNQ_COPY_ARGS)
+{
+ pTecCtoIDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if(!(ped->techPvt=(pointer)XieMalloc(sizeof(pTecCtoIDefRec))))
+ FloAllocError(flo,ped->phototag,xieElemConvertToIndex, return(TRUE));
+
+ pvt = (pTecCtoIDefPtr)ped->techPvt;
+
+ pvt->defTech = isDefault;
+
+ if (isDefault)
+ pvt->fill = 0; /* Not really a good way to pick this so . . . */
+ else if( flo->reqClient->swapped ) {
+ cpswapl(sparms->fill, pvt->fill);
+ } else
+ pvt->fill = sparms->fill;
+
+ return(TRUE);
+}
+
+#ifdef BEYOND_SI
+
+#undef sparms
+#define sparms ((xieTecColorAllocMatch *)sParms)
+#undef rparms
+#define rparms ((xieTecColorAllocMatch *)rParms)
+
+Bool CopyCtoIAllocMatch(TECHNQ_COPY_ARGS)
+{
+ pConvertToIndexMatchDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if (!(ped->techPvt=(pointer )XieMalloc(sizeof(pTecConvertToIndexMatchDefRec))))
+ AllocError(flo,ped, return(TRUE));
+
+ pvt = (pConvertToIndexMatchDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ pvt->matchLimit = ConvertFromIEEE(lswapl(sparms->matchLimit));
+ pvt->grayLimit = ConvertFromIEEE(lswapl(sparms->grayLimit));
+ } else {
+ pvt->matchLimit = ConvertFromIEEE(sparms->matchLimit);
+ pvt->grayLimit = ConvertFromIEEE(sparms->grayLimit);
+ }
+ return(TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecColorAllocRequantize *)sParms)
+#undef rparms
+#define rparms ((xieTecColorAllocRequantize *)rParms)
+
+Bool CopyCtoIAllocRequantize(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if( flo->reqClient->swapped ){
+ cpswapl(sparms->maxCells, rparms->maxCells);
+ } else
+ rparms->maxCells = sparms->maxCells;
+
+ return(TRUE);
+}
+#endif /* BEYOND_SI */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepConvertToIndex(floDefPtr flo, peDefPtr ped)
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ pCtoIDefPtr pvt = (pCtoIDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCt1];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ formatPtr sf = &src->format[0];
+ formatPtr df = &dst->format[0];
+ CARD32 b;
+
+ /* must be constrained and inter-band dimensions must match
+ */
+ if(IsntConstrained(sf[0].class) ||
+ ((src->bands == 3) && (IsntConstrained(sf[1].class) ||
+ IsntConstrained(sf[2].class) ||
+ sf[0].width != sf[1].width ||
+ sf[1].width != sf[2].width ||
+ sf[0].height != sf[1].height ||
+ sf[1].height != sf[2].height)))
+ MatchError(flo,ped, return(FALSE));
+
+ /* determine our output attributes from the input (figure out levels later)
+ */
+ df[0] = sf[0];
+ dst->bands = 1;
+ inf->bands = src->bands;
+ for(b = 0; b < src->bands; ++b)
+ inf->format[b] = sf[b];
+
+ /* find the ColorList and Colormap resources
+ */
+ if(raw->colorList) {
+ if(!(pvt->list = LookupColorList(raw->colorList)))
+ ColorListError(flo,ped,raw->colorList, return(FALSE));
+ if(pvt->list->refCnt != 1)
+ AccessError(flo,ped, return(FALSE));
+ ++pvt->list->refCnt;
+ } else {
+ pvt->list = NULL;
+ }
+ if(!(pvt->cmap = (ColormapPtr) LookupIDByType(raw->colormap, RT_COLORMAP)))
+ ColormapError(flo,ped,raw->colormap, return(FALSE));
+
+ /* grab attributes from colormap, visual, ...
+ */
+ pvt->class = pvt->cmap->class;
+ pvt->visual = pvt->cmap->pVisual;
+ pvt->stride = pvt->visual->bitsPerRGBValue;
+ pvt->cells = pvt->visual->ColormapEntries;
+ pvt->mask[0] = pvt->visual->redMask;
+ pvt->mask[1] = pvt->visual->greenMask;
+ pvt->mask[2] = pvt->visual->blueMask;
+ pvt->shft[0] = pvt->visual->offsetRed;
+ pvt->shft[1] = pvt->visual->offsetGreen;
+ pvt->shft[2] = pvt->visual->offsetBlue;
+ pvt->dynamic = pvt->cmap->class & DynamicClass;
+ pvt->graySrc = src->bands == 1;
+ pvt->preFmt = pvt->doHist = FALSE;
+
+ switch(pvt->class) {
+ case DirectColor :
+ case TrueColor :
+ case StaticColor :
+ for(b = 0; b < 3; ++b)
+ pvt->levels[b] = pvt->mask[b] >> pvt->shft[b];
+
+ /* see if we have a full set of masks (by turning them into levels)
+ */
+ if(pvt->levels[0]++ & pvt->levels[1]++ & pvt->levels[2]++) {
+ /* see what limitations we have for grayscale images */
+ if(pvt->graySrc && !pvt->dynamic && (pvt->levels[0] != pvt->levels[1] ||
+ pvt->levels[1] != pvt->levels[2]))
+ MatchError(flo,ped, return(FALSE));
+
+ /* set output levels and depth based on colormap masks
+ */
+ df[0].levels = pvt->levels[0] * pvt->levels[1] * pvt->levels[2];
+ SetDepthFromLevels(df[0].levels, pvt->depth);
+ break;
+ } /* for StaticColor with no asks, we'll fall thru */
+ case PseudoColor :
+ pvt->levels[1] = pvt->levels[2] = 1;
+ case GrayScale :
+ case StaticGray :
+ /* set output levels and depth based on colormap size
+ */
+ SetDepthFromLevels(pvt->cells, pvt->depth);
+ df[0].levels = 1<<pvt->depth;
+ if((pvt->preFmt = !pvt->graySrc) && pvt->class <= GrayScale)
+ MatchError(flo,ped, return(FALSE));
+ }
+ /* set output stride and pitch to match the colormap depth
+ */
+ if(!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ /* go do technique-specific stuff
+ */
+ if(!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValColorAlloc,raw->colorAlloc,raw->lenParams,
+ return(FALSE));
+
+ /* init the colorlist resource
+ */
+ if(pvt->list) {
+ ResetColorList(pvt->list, pvt->list->mapPtr);
+ pvt->list->mapID = raw->colormap;
+ pvt->list->mapPtr = pvt->cmap;
+ pvt->list->client = flo->runClient;
+ }
+ return(TRUE);
+} /* end PrepConvertToIndex */
+
+/*------------------------------------------------------------------------
+------------------------ technique prep routines ------------------------
+------------------------------------------------------------------------*/
+Bool PrepCtoIAllocAll(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToIndex *raw,
+ xieTecColorAllocAll *tec)
+{
+ pCtoIDefPtr pvt = (pCtoIDefPtr) ped->elemPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ formatPtr fmt = &inf->format[0];
+
+ if(!(pvt->class & DynamicClass) || !pvt->list)
+ return(FALSE); /* AllocAll needs a dynamic colormap and a colorlist */
+
+ /* Check the depth of each band to make sure they're reasonable ... deep
+ * images have to have sparse histograms to avoid running out of colors
+ *
+ * XIE only supports up to 16 bits per band for "non-index" data,
+ * we will further limit RGB images to a total depth of 31.
+ */
+ if((inf->bands == 1 && fmt[0].depth > 16) ||
+ (inf->bands == 3 && (fmt[0].depth + fmt[1].depth + fmt[2].depth > 31)))
+ return(FALSE);
+
+ return(TRUE);
+} /* end PrepCtoIAllocAll */
+
+/*------------------------------------------------------------------------
+---------------------- routine: post execution cleanup -------------------
+------------------------------------------------------------------------*/
+static Bool DebriefConvertToIndex(floDefPtr flo, peDefPtr ped, Bool ok)
+{
+ pCtoIDefPtr pvt = (pCtoIDefPtr) ped->elemPvt;
+ colorListPtr lst;
+
+ if(pvt && (lst = pvt->list))
+ if(lst->refCnt > 1) {
+ if(!ok || !lst->cellCnt)
+ ResetColorList(lst, lst->mapPtr);
+ --lst->refCnt;
+ } else if(LookupIDByType(lst->ID, RT_COLORLIST)) {
+ FreeResourceByType(lst->ID, RT_COLORLIST, RT_NONE);
+ } else {
+ DeleteColorList(lst, lst->ID);
+ }
+ return(TRUE);
+} /* end DebriefConvertToIndex */
+
+/* end module pctoi.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pctrgb.c b/xc/programs/Xserver/XIE/dixie/process/pctrgb.c
new file mode 100644
index 000000000..a9f1b24bf
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pctrgb.c
@@ -0,0 +1,523 @@
+/* $TOG: pctrgb.c /main/5 1998/02/09 16:10:14 kaleb $ */
+/**** module pctrgb.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pctrgb.c -- DIXIE routines for managing the ConvertToRGB element
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pctrgb.c,v 3.4 1998/10/25 07:11:34 dawes Exp $ */
+
+#define _XIEC_PCTRGB
+
+/*
+ * Include files
+ */
+
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPConvertToRGB(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec pConvertToRGBVec = {
+ PrepPConvertToRGB /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+------------------ routine: make a ConvertToRBG element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeConvertToRGB(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloConvertToRGB);
+ ELEMENT_AT_LEAST_SIZE(xieFloConvertToRGB);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemConvertToRGB, return(NULL)) ;
+
+ ped->diVec = &pConvertToRGBVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloConvertToRGB *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswaps(stuff->convert, raw->convert);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloConvertToRGB));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValConvertToRGB, raw->convert)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValConvertToRGB,raw->convert,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakePConvertToRGB */
+
+/*------------------------------------------------------------------------
+------ routine: copy routine for CIELab and CIEXYZ techniques -----------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecCIELabToRGB *)sParms)
+#undef rparms
+#define rparms ((xieTecCIELabToRGB *)rParms)
+
+Bool CopyPConvertToRGBCIE(TECHNQ_COPY_ARGS)
+{
+ pTecCIEToRGBDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecCIEToRGBDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertToRGB, return(TRUE));
+
+ pvt = (pTecCIEToRGBDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ swap_floats(&pvt->matrix[0], &sparms->matrix00, 9);
+ cpswaps(sparms->whiteAdjusted, pvt->whiteAdjusted);
+ cpswaps(sparms->lenWhiteParams, pvt->lenWhiteParams);
+ cpswaps(sparms->gamutCompress, pvt->gamutCompress);
+ cpswaps(sparms->lenGamutParams, pvt->lenGamutParams);
+ } else {
+ copy_floats(&pvt->matrix[0], &sparms->matrix00, 9);
+ pvt->whiteAdjusted = sparms->whiteAdjusted;
+ pvt->lenWhiteParams = sparms->lenWhiteParams;
+ pvt->gamutCompress = sparms->gamutCompress;
+ pvt->lenGamutParams = sparms->lenGamutParams;
+ }
+
+ if(!(pvt->whiteTec = FindTechnique(xieValWhiteAdjust, pvt->whiteAdjusted)) ||
+ !(TECH_WADJ_FUNC(pvt->whiteTec)(flo, ped, &sparms[1], pvt->whitePoint,
+ pvt->whiteTec, pvt->lenWhiteParams,
+ pvt->whiteAdjusted == xieValDefault)))
+ TechniqueError(flo,ped,xieValWhiteAdjust,
+ pvt->whiteAdjusted,pvt->lenWhiteParams, return(TRUE));
+
+ if(!(pvt->gamutTec = FindTechnique(xieValGamut, pvt->gamutCompress)) ||
+ !(TECH_GAMU_FUNC(pvt->gamutTec)(pvt->lenGamutParams)))
+ TechniqueError(flo,ped,xieValGamut,
+ pvt->gamutCompress,pvt->lenGamutParams, return(TRUE));
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------- routine: copy routine for YCbCr and YCC techniques ------------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecYCbCrToRGB *)sParms)
+#undef rparms
+#define rparms ((xieTecYCbCrToRGB *)rParms)
+
+Bool CopyPConvertToRGBYCbCr(TECHNQ_COPY_ARGS)
+{
+ pTecYCbCrToRGBDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecYCbCrToRGBDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertToRGB, return(TRUE));
+
+ pvt = (pTecYCbCrToRGBDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ cpswapl(sparms->levels0, pvt->levels0);
+ cpswapl(sparms->levels1, pvt->levels1);
+ cpswapl(sparms->levels2, pvt->levels2);
+ swap_floats(&pvt->red, &sparms->lumaRed, 3);
+ swap_floats(&pvt->bias0, &sparms->bias0, 3);
+ cpswaps(sparms->gamutCompress, pvt->gamutCompress);
+ cpswaps(sparms->lenGamutParams, pvt->lenGamutParams);
+ } else {
+ pvt->levels0 = sparms->levels0;
+ pvt->levels1 = sparms->levels1;
+ pvt->levels2 = sparms->levels2;
+ copy_floats(&pvt->red, &sparms->lumaRed, 3);
+ copy_floats(&pvt->bias0, &sparms->bias0, 3);
+ pvt->gamutCompress = sparms->gamutCompress;
+ pvt->lenGamutParams = sparms->lenGamutParams;
+ }
+
+ if(!(pvt->gamutTec = FindTechnique(xieValGamut, pvt->gamutCompress)) ||
+ !(TECH_GAMU_FUNC(pvt->gamutTec)(pvt->lenGamutParams)))
+ TechniqueError(flo,ped,xieValGamut,
+ pvt->gamutCompress,pvt->lenGamutParams, return(TRUE));
+
+ return (TRUE);
+}
+
+#undef sparms
+#define sparms ((xieTecYCCToRGB *)sParms)
+#undef rparms
+#define rparms ((xieTecYCCToRGB *)rParms)
+
+Bool CopyPConvertToRGBYCC(TECHNQ_COPY_ARGS)
+{
+ pTecYCCToRGBDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt = (pointer )XieMalloc(sizeof(pTecYCCToRGBDefRec))))
+ FloAllocError(flo, ped->phototag,xieElemConvertToRGB, return(TRUE));
+
+ pvt = (pTecYCCToRGBDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ cpswapl(sparms->levels0, pvt->levels0);
+ cpswapl(sparms->levels1, pvt->levels1);
+ cpswapl(sparms->levels2, pvt->levels2);
+ swap_floats(&pvt->red, &sparms->lumaRed, 3);
+ pvt->scale = ConvertFromIEEE(lswapl(sparms->scale));
+ cpswaps(sparms->gamutCompress, pvt->gamutCompress);
+ cpswaps(sparms->lenGamutParams, pvt->lenGamutParams);
+ } else {
+ pvt->levels0 = sparms->levels0;
+ pvt->levels1 = sparms->levels1;
+ pvt->levels2 = sparms->levels2;
+ copy_floats(&pvt->red, &sparms->lumaRed, 3);
+ pvt->scale = ConvertFromIEEE(sparms->scale);
+ pvt->gamutCompress = sparms->gamutCompress;
+ pvt->lenGamutParams = sparms->lenGamutParams;
+ }
+
+ if(!(pvt->gamutTec = FindTechnique(xieValGamut, pvt->gamutCompress)) ||
+ !(TECH_GAMU_FUNC(pvt->gamutTec)(pvt->lenGamutParams)))
+ TechniqueError(flo,ped,xieValGamut,
+ pvt->gamutCompress,pvt->lenGamutParams, return(TRUE));
+
+ return (TRUE);
+}
+
+#undef sparms
+#undef rparms
+
+/*------------------------------------------------------------------------
+-- routine: copy routine for White Adjust None technique ----------
+------------------------------------------------------------------------*/
+Bool CopyPWhiteAdjustNone(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer sparms,
+ double *pvtf,
+ techVecPtr tv,
+ CARD16 tsize,
+ Bool isDefault)
+{
+ return (tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+-- routine: copy routine for White Adjust CIELabShift technique ----------
+------------------------------------------------------------------------*/
+Bool CopyPWhiteAdjustCIELabShift(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecWhiteAdjustCIELabShift *sparms,
+ double *pvtf,
+ techVecPtr tv,
+ CARD16 tsize,
+ Bool isDefault)
+{
+ VALIDATE_TECHNIQUE_SIZE(tv, tsize, isDefault);
+
+ if( flo->reqClient->swapped ) {
+ swap_floats(pvtf, &sparms->whitePoint0, 3);
+ } else {
+ copy_floats(pvtf, &sparms->whitePoint0, 3);
+ }
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+----------- routine: copy routine for Gamut techniques -------------------
+------------------------------------------------------------------------*/
+Bool CopyPGamut(CARD16 tsize)
+{
+ return (tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+-- routine: prep routine for RGB to CIElab and CIEXYZ techniques ---------
+------------------------------------------------------------------------*/
+Bool PrepPConvertToRGBCIE(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecCIELabToRGB *tec) /* same as xieTecCIEXYZToRGB */
+{
+ pTecCIEToRGBDefPtr pvt = (pTecCIEToRGBDefPtr)ped->techPvt;
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ if (IsConstrained(src->format[0].class))
+ return FALSE; /* must be floats */
+ /* Since we know its floats, structure copy sufficient */
+ dst->format[b] = inf->format[b] = src->format[b];
+ }
+
+ return(pvt->whiteTec->prepfnc(flo,ped,pvt->whitePoint));
+}
+
+/*------------------------------------------------------------------------
+-- routine: prep routine for RGB to YCbCr and YCC techniques -------------
+------------------------------------------------------------------------*/
+Bool PrepPConvertToRGBYCbCr(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecYCbCrToRGB *tec)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pTecYCbCrToRGBDefPtr pvt = (pTecYCbCrToRGBDefPtr)ped->techPvt;
+ CARD32 *levels = &(pvt->levels0);
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ dst->format[b] = inf->format[b] = src->format[b];
+ if (IsConstrained(dst->format[b].class))
+ dst->format[b].levels = *(levels+b);
+ }
+
+ /* Set depth, class, stride, and pitch */
+ if (IsConstrained(dst->format[0].class)) {
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo,ped, return(FALSE));
+ } /* else the structure copy was sufficient */
+
+ return(TRUE);
+}
+
+Bool PrepPConvertToRGBYCC(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecYCCToRGB *tec)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pTecYCCToRGBDefPtr pvt = (pTecYCCToRGBDefPtr)ped->techPvt;
+ CARD32 *levels = &(pvt->levels0);
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+ dst->format[b] = inf->format[b] = src->format[b];
+ if (IsConstrained(dst->format[b].class))
+ dst->format[b].levels = *(levels+b);
+ }
+
+ /* Set depth, class, stride, and pitch */
+ if (IsConstrained(dst->format[0].class)) {
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo,ped, return(FALSE));
+ } /* else the structure copy was sufficient */
+
+ if (pvt->scale < .001) { /* should be about 1.35 or 1.4 */
+ ValueError(flo, ped, tec->scale, return(FALSE));
+ }
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+------ routine: prep routine for White Adjust none technique -------------
+------------------------------------------------------------------------*/
+Bool PrepPWhiteAdjustNone(
+ floDefPtr flo,
+ peDefPtr ped,
+ double *pwp)
+{
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+-- routine: prep routine for White Adjust CIELabShift technique ----------
+------------------------------------------------------------------------*/
+Bool PrepPWhiteAdjustCIELabShift(
+ floDefPtr flo,
+ peDefPtr ped,
+ double *pwp)
+{
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+------------ routine: prep routine for gamut techniques ------------------
+------------------------------------------------------------------------*/
+Bool PrepPGamut(void)
+{
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+
+static Bool PrepPConvertToRGB(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ xieFloConvertToRGB *raw = (xieFloConvertToRGB *)ped->elemRaw;
+
+ /* Input must be triple band and dimensions must match */
+ if (IsntCanonic(src->format[0].class) ||
+ src->bands != 3 ||
+ src->format[0].width != src->format[1].width ||
+ src->format[1].width != src->format[2].width ||
+ src->format[0].height != src->format[1].height ||
+ src->format[1].height != src->format[2].height)
+ MatchError(flo,ped, return(FALSE));
+
+
+ /*
+ ** Technique Prep routine will complete the normal propagation of src
+ ** attributes, and setup of destination attributes.
+ */
+
+ if (!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValConvertToRGB,
+ raw->convert,raw->lenParams, return(FALSE));
+
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------------- utility routines for parameters -------------------
+------------------------------------------------------------------------*/
+
+void
+swap_floats(
+ double *doubles_out,
+ xieTypFloat *funny_floats_in,
+ int cnt)
+{
+ int m;
+ for (m = 0; m < cnt; m++)
+ doubles_out[m] = ConvertFromIEEE(lswapl(funny_floats_in[m]));
+}
+
+void
+copy_floats(
+ double *doubles_out,
+ xieTypFloat *funny_floats_in,
+ int cnt)
+{
+ int m;
+ for (m = 0; m < cnt; m++)
+ doubles_out[m] = ConvertFromIEEE(funny_floats_in[m]);
+}
+
+/* end module pctrgb.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pdither.c b/xc/programs/Xserver/XIE/dixie/process/pdither.c
new file mode 100644
index 000000000..cbd455cdc
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pdither.c
@@ -0,0 +1,272 @@
+/* $TOG: pdither.c /main/7 1998/02/09 16:10:19 kaleb $ */
+/**** module pdither.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pdither.c -- DIXIE routines for managing the Dither element
+
+ Larry Hare -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pdither.c,v 3.3 1998/10/25 07:11:34 dawes Exp $ */
+
+#define _XIEC_PDITHER
+
+/*
+ * Include files
+ */
+
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPDither(floDefPtr flo, peDefPtr ped);
+static Bool PrepPDitherStandard(floDefPtr flo, peDefPtr ped, pointer raw, pointer tec);
+
+/*
+ * dixie element entry points
+ */
+static diElemVecRec pDitherVec = {
+ PrepPDither /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+-------------------- routine: make a dither element ------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeDither(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ ELEMENT(xieFloDither);
+ ELEMENT_AT_LEAST_SIZE(xieFloDither);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemDither, return(NULL)) ;
+
+ ped->diVec = &pDitherVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloDither *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->bandMask = stuff->bandMask;
+ cpswapl(stuff->levels0, raw->levels0);
+ cpswapl(stuff->levels1, raw->levels1);
+ cpswapl(stuff->levels2, raw->levels2);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ cpswaps(stuff->dither, raw->dither);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloDither));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValDither, raw->dither)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams,
+ raw->dither == xieValDefault)))
+ TechniqueError(flo,ped,xieValDither,raw->dither,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototag to inFlo
+ */
+ ped->inFloLst[SRCtag].srcTag = raw->src;
+
+
+ return(ped);
+} /* end MakePDither */
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for no Error Diffusion technique --
+------------------------------------------------------------------------*/
+
+Bool CopyPDitherErrorDiffusion(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ return(tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for Ordered techniques ---------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecDitherOrdered *)sParms)
+#undef rparms
+#define rparms ((xieTecDitherOrdered *)rParms)
+
+Bool CopyPDitherOrdered(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if (tsize)
+ rparms->thresholdOrder = sparms->thresholdOrder;
+ else
+ rparms->thresholdOrder = 4;
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for no param techniques -------------
+------------------------------------------------------------------------*/
+static
+Bool PrepPDitherStandard(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Error Diffusion techniques ----
+------------------------------------------------------------------------*/
+Bool PrepPDitherErrorDiffusion(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloDither *raw,
+ pointer tec)
+{
+ return PrepPDitherStandard(flo, ped, (pointer) raw, tec);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Ordered technique -------------
+------------------------------------------------------------------------*/
+Bool PrepPDitherOrdered(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloDither *raw,
+ xieTecDitherOrdered *tec)
+{
+ return PrepPDitherStandard(flo, ped, (pointer) raw, (pointer) tec);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+
+static Bool PrepPDither(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ xieFloDither *raw = (xieFloDither *)ped->elemRaw;
+ CARD32 *levels = &(raw->levels0);
+ int b;
+
+ /* grab a copy of the src attributes and propagate them to our input */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < src->bands; b++) {
+
+ dst->format[b] = inf->format[b] = src->format[b];
+
+ if ((raw->bandMask & (1<<b)) == 0)
+ continue;
+
+ if (IsntConstrained(src->format[b].class) &&
+ src->format[b].class == BIT_PIXEL)
+ MatchError(flo, ped, return(FALSE));
+
+ if ((dst->format[b].levels = *(levels+b)) > src->format[b].levels)
+ ValueError(flo,ped,*(levels+b),return(FALSE));
+ }
+
+ /* Set depth, class, stride, and pitch */
+ if (UpdateFormatfromLevels(ped) == FALSE)
+ MatchError(flo,ped, return(FALSE));
+
+ /* Take care of any technique parameters */
+ if (!(ped->techVec->prepfnc(flo, ped, raw, &raw[1])))
+ TechniqueError(flo,ped,xieValDither,raw->dither,raw->lenParams,
+ return(FALSE));
+
+ return (TRUE);
+}
+
+/* end module pdither.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pgeom.c b/xc/programs/Xserver/XIE/dixie/process/pgeom.c
new file mode 100644
index 000000000..72304824b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pgeom.c
@@ -0,0 +1,379 @@
+/* $TOG: pgeom.c /main/6 1998/02/09 16:10:24 kaleb $ */
+/**** module pgeom.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pgeom.c -- DIXIE routines for managing the Geometry element
+
+ Ben Fahy -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pgeom.c,v 3.4 1998/10/25 07:11:34 dawes Exp $ */
+
+#define _XIEC_PGEOM
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepGeometry(
+ floDefPtr flo,
+ peDefPtr ped);
+static Bool CopyGeomNoParams(TECHNQ_COPY_ARGS);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pGeometryVec = {
+ PrepGeometry /* prepare for analysis and execution */
+ };
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a convolution element --------------
+------------------------------------------------------------------------*/
+peDefPtr MakeGeometry(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pGeomDefPtr pvt;
+ xieTypFloat *kptr;
+ int i;
+ ELEMENT(xieFloGeometry);
+ ELEMENT_AT_LEAST_SIZE(xieFloGeometry);
+ ELEMENT_NEEDS_1_INPUT(src);
+ inputs = 1;
+
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2,
+ sizeof(pGeomDefRec))))
+ FloAllocError(flo, tag, xieElemGeometry, return(NULL));
+
+ ped->diVec = &pGeometryVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloGeometry *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ raw->bandMask = stuff->bandMask;
+ cpswapl(stuff->width, raw->width);
+ cpswapl(stuff->height, raw->height);
+ cpswaps(stuff->sample, raw->sample);
+ cpswaps(stuff->lenParams, raw->lenParams);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloGeometry));
+
+ /* Copy over and convert the floating point stuff */
+ kptr = (xieTypFloat *)&stuff->a;
+ pvt = (pGeomDefPtr)ped->elemPvt;
+
+ if (flo->reqClient->swapped) {
+ for (i = 0; i < 6; ++kptr, ++i)
+ pvt->coeffs[i] = ConvertFromIEEE(lswapl(*kptr));
+ for (i = 0; i < xieValMaxBands; ++kptr, ++i)
+ pvt->constant[i] = ConvertFromIEEE(lswapl(*kptr));
+ } else {
+ for (i = 0; i < 6; i++)
+ pvt->coeffs[i] = ConvertFromIEEE(*kptr++);
+ for (i = 0; i < xieValMaxBands; i++)
+ pvt->constant[i] = ConvertFromIEEE(*kptr++);
+ }
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValGeometry, raw->sample)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams,
+ raw->sample == xieValDefault)))
+ TechniqueError(flo,ped,xieValGeometry,raw->sample,raw->lenParams,
+ return(ped));
+
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeGeometry */
+
+/*------------------------------------------------------------------------
+----------- routine: copy routine for NearestNeighbor technique ---------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecGeomNearestNeighbor *)sParms)
+#undef rparms
+#define rparms ((xieTecGeomNearestNeighbor *)rParms)
+
+Bool CopyGeomNearestNeighbor(TECHNQ_COPY_ARGS)
+{
+ pTecGeomNearestNeighborDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if (!(ped->techPvt = XieMalloc(sizeof(pTecGeomNearestNeighborDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemGeometry, return(TRUE));
+
+ pvt = (pTecGeomNearestNeighborDefPtr)ped->techPvt;
+
+ /*
+ * Nearest Neighbor can be called with no parameters
+ */
+ if (isDefault)
+ pvt->modify = xieValFavorUp;
+ else
+ pvt->modify = sparms->modify;
+
+ return (TRUE);
+}
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+------ routine: copy routine for bilinear interpolation technique --------
+------------------------------------------------------------------------*/
+Bool CopyGeomBilinearInterp(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ return( CopyGeomNoParams(flo, ped, sparms, rparms, tsize, isDefault) );
+}
+/*------------------------------------------------------------------------
+------ routine: copy routine for gaussian interpolation technique --------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecGeomGaussian *)sParms)
+#undef rparms
+#define rparms ((xieTecGeomGaussian *)rParms)
+
+Bool CopyGeomGaussian(TECHNQ_COPY_ARGS)
+{
+ pTecGeomGaussianDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ if (!(ped->techPvt=XieMalloc(sizeof(pTecGeomGaussianDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemGeometry, return(TRUE));
+
+ pvt = (pTecGeomGaussianDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ pvt->sigma = ConvertFromIEEE(lswapl(sparms->sigma));
+ pvt->normalize = ConvertFromIEEE(lswapl(sparms->normalize));
+ } else {
+ pvt->sigma = ConvertFromIEEE(sparms->sigma);
+ pvt->normalize = ConvertFromIEEE(sparms->normalize);
+ }
+ pvt->radius = sparms->radius;
+ pvt->simple = sparms->simple;
+
+ if (pvt->radius < 1)
+ return(FALSE);
+
+ if (pvt->sigma == 0.0)
+ return(FALSE); /* musn't divide by zero, deary */
+
+ if (pvt->normalize <= 0.0)
+ return(FALSE); /* don't want to bother clipping pixels < 0 */
+
+ return (TRUE);
+}
+#endif
+
+/*------------------------------------------------------------------------
+------ routine: copy routine for antialias technique --------
+------------------------------------------------------------------------*/
+
+Bool CopyGeomAntiAlias(TECHNQ_COPY_ARGS)
+{
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, isDefault);
+
+ return( CopyGeomNoParams(flo, ped, sparms, rparms, tsize, isDefault) );
+}
+
+/*------------------------------------------------------------------------
+------------ routine: copy routine for techniques with no params --------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#undef rparms
+
+static Bool CopyGeomNoParams(TECHNQ_COPY_ARGS)
+{
+ return(tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepGeometry(floDefPtr flo, peDefPtr ped)
+{
+ xieFloGeometry *raw = (xieFloGeometry *)ped->elemRaw;
+ inFloPtr in = &ped->inFloLst[SRCtag];
+ outFloPtr src = &in->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ pGeomDefPtr pvt = (pGeomDefPtr)ped->elemPvt;
+ CARD32 b, bits;
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ dst->bands = in->bands = src->bands;
+
+ for(b = 0; b < dst->bands; b++) {
+ if (IsntCanonic(src->format[b].class))
+ MatchError(flo, ped, return(FALSE));
+
+ dst->format[b] = in->format[b] = src->format[b];
+ pvt->do_band[b] = (dst->bands==1)? 1 : raw->bandMask & (1<<b);
+ if (pvt->do_band[b]) {
+ dst->format[b].width = raw->width;
+ dst->format[b].height = raw->height;
+ }
+ bits = dst->format[b].width * dst->format[b].stride;
+ dst->format[b].pitch = bits + Align(bits,PITCH_MOD);
+ }
+
+ if(!(ped->techVec->prepfnc(flo, ped, raw, &raw[1]))) {
+ TechniqueError(flo,ped,xieValGeometry,raw->sample,raw->lenParams,
+ return(FALSE));
+ }
+
+ return( TRUE );
+} /* end PrepGeometry */
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for nearest neighbor --------------
+------------------------------------------------------------------------*/
+Bool PrepGeomNearestNeighbor(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+---------- routine: prep routine for bilinear interpolation --------------
+------------------------------------------------------------------------*/
+Bool PrepGeomBilinearInterp(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+/*------------------------------------------------------------------------
+---------- routine: prep routine for gaussian ----------------------------
+------------------------------------------------------------------------*/
+Bool PrepGeomGaussian(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+#endif
+
+/*------------------------------------------------------------------------
+---------- routine: prep routine for antialias ---------------------------
+------------------------------------------------------------------------*/
+Bool PrepGeomAntiAlias(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec)
+{
+ return(TRUE);
+}
+
+/* end module pgeom.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/phist.c b/xc/programs/Xserver/XIE/dixie/process/phist.c
new file mode 100644
index 000000000..9605a4416
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/phist.c
@@ -0,0 +1,306 @@
+/* $TOG: phist.c /main/5 1998/02/09 16:10:28 kaleb $ */
+/**** module phist.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ phist.c -- DIXIE routines for managing the MatchHistogram element
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/phist.c,v 3.4 1998/10/25 07:11:35 dawes Exp $ */
+
+#define _XIEC_PHIST
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <technq.h>
+#include <difloat.h>
+#include <memory.h>
+
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepMatchHistogram(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pMatchHistogramVec =
+{
+ PrepMatchHistogram /* prepare for analysis and execution */
+};
+
+
+/*------------------------------------------------------------------------
+----------------- routine: make a match histogram element ----------------
+------------------------------------------------------------------------*/
+peDefPtr MakeMatchHistogram(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloMatchHistogram);
+ ELEMENT_AT_LEAST_SIZE(xieFloMatchHistogram);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ inputs = 1 + (stuff->domainPhototag ? 1 : 0);
+
+ if (!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo, tag, xieElemMatchHistogram, return(NULL));
+
+ ped->diVec = &pMatchHistogramVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloMatchHistogram *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ cpswaps(stuff->shape,raw->shape);
+ cpswaps(stuff->lenParams,raw->lenParams);
+ } else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloMatchHistogram));
+ /*
+ * copy technique data (if any)
+ */
+ if(!(ped->techVec = FindTechnique(xieValHistogram, raw->shape)) ||
+ !(ped->techVec->copyfnc(flo, ped, &stuff[1], &raw[1], raw->lenParams, 0)))
+ TechniqueError(flo,ped,xieValHistogram,raw->shape,raw->lenParams,
+ return(ped));
+
+
+ /* assign phototags to inFlos */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+ if(raw->domainPhototag)
+ inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+ return ped;
+} /* end MakeMatchHistogram */
+
+/*------------------------------------------------------------------------
+------------------- routine: copy routine for Flat technique ------------
+------------------------------------------------------------------------*/
+
+Bool CopyPHistogramFlat(TECHNQ_COPY_ARGS)
+{
+ return (tsize == 0);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: copy routine for Gaussian technique -----------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecHistogramGaussian *)sParms)
+#undef rparms
+#define rparms ((xieTecHistogramGaussian *)rParms)
+
+Bool CopyPHistogramGaussian(TECHNQ_COPY_ARGS)
+{
+ pTecHistogramGaussianDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt =
+ (pointer )XieMalloc(sizeof(pTecHistogramGaussianDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemMatchHistogram, return(TRUE));
+
+ pvt = (pTecHistogramGaussianDefPtr)ped->techPvt;
+
+ if( flo->reqClient->swapped ) {
+ pvt->mean = ConvertFromIEEE(lswapl(sparms->mean));
+ pvt->sigma = ConvertFromIEEE(lswapl(sparms->sigma));
+ } else {
+ pvt->mean = ConvertFromIEEE(sparms->mean);
+ pvt->sigma = ConvertFromIEEE(sparms->sigma);
+ }
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+-------------- routine: copy routine for Hyperbolic technique -----------
+------------------------------------------------------------------------*/
+
+#undef sparms
+#define sparms ((xieTecHistogramHyperbolic *)sParms)
+#undef rparms
+#define rparms ((xieTecHistogramHyperbolic *)rParms)
+
+Bool CopyPHistogramHyperbolic(TECHNQ_COPY_ARGS)
+{
+ pTecHistogramHyperbolicDefPtr pvt;
+
+ VALIDATE_TECHNIQUE_SIZE(ped->techVec, tsize, FALSE);
+
+ if (!(ped->techPvt =
+ (pointer )XieMalloc(sizeof(pTecHistogramHyperbolicDefRec))))
+ FloAllocError(flo, ped->phototag, xieElemMatchHistogram, return(TRUE));
+
+ pvt = (pTecHistogramHyperbolicDefPtr)ped->techPvt;
+
+ pvt->shapeFactor = sparms->shapeFactor;
+ if( flo->reqClient->swapped ) {
+ pvt->constant = ConvertFromIEEE(lswapl(sparms->constant));
+ } else {
+ pvt->constant = ConvertFromIEEE(sparms->constant);
+ }
+
+ return (TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Gaussian technique ------------
+------------------------------------------------------------------------*/
+Bool PrepPHistogramFlat(floDefPtr flo, peDefPtr ped)
+{
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Gaussian technique ------------
+------------------------------------------------------------------------*/
+Bool PrepPHistogramGaussian(floDefPtr flo, peDefPtr ped)
+{
+ if (((pTecHistogramGaussianDefPtr)ped->techPvt)->sigma <= 0)
+ return(FALSE);
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prep routine for Hyperbolic technique ----------
+------------------------------------------------------------------------*/
+Bool PrepPHistogramHyperbolic(floDefPtr flo, peDefPtr ped)
+{
+ double constant = ((pTecHistogramHyperbolicDefPtr)ped->techPvt)->constant;
+
+ if (constant >= -1 && constant <= 0)
+ return(FALSE);
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepMatchHistogram(floDefPtr flo, peDefPtr ped)
+{
+ xieFloMatchHistogram *raw = (xieFloMatchHistogram *)ped->elemRaw;
+ inFloPtr ind, in = &ped->inFloLst[SRCtag];
+ outFloPtr src = &in->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+
+ /* make sure source parameters are legal for MatchHistogram */
+ if (IsntConstrained(src->format[0].class) ||
+ src->format[0].class == BIT_PIXEL ||
+ src->bands != 1)
+ MatchError(flo,ped, return(FALSE));
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ outFloPtr dom;
+
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if((ind->bands = dom->bands) != 1 || IsntDomain(dom->format[0].class))
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ }
+
+ /* grab a copy of the input attributes and propagate them to output */
+ dst->bands = in->bands = src->bands;
+ dst->format[0] = in->format[0] = src->format[0];
+
+ /* Take care of any technique parameters */
+ if (!(ped->techVec->prepfnc(flo, ped)))
+ TechniqueError(flo,ped,xieValHistogram,raw->shape,raw->lenParams,
+ return(FALSE));
+
+ return (TRUE);
+} /* end PrepMatchHistogram */
+
+/* end module phist.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/plogic.c b/xc/programs/Xserver/XIE/dixie/process/plogic.c
new file mode 100644
index 000000000..0c339cfa2
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/plogic.c
@@ -0,0 +1,250 @@
+/* $TOG: plogic.c /main/5 1998/02/09 16:10:33 kaleb $ */
+/**** module plogic.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ plogic.c -- DIXIE routines for managing the Logical element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/plogic.c,v 3.3 1998/10/25 07:11:35 dawes Exp $ */
+
+#define _XIEC_PLOGIC
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepLogic(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pLogicVec =
+{
+ PrepLogic /* prepare for analysis and execution */
+};
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a logical element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeLogic(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pLogicDefPtr pvt;
+ ELEMENT(xieFloLogical);
+ ELEMENT_SIZE_MATCH(xieFloLogical);
+ ELEMENT_NEEDS_1_INPUT(src1);
+
+ inputs = 1 + (stuff->src2 ? 1 : 0) + (stuff->domainPhototag ? 1 :0);
+
+ if (!(ped =
+ MakePEDef(inputs, (CARD32)stuff->elemLength<<2, sizeof(pLogicDefRec))))
+ FloAllocError(flo, tag, xieElemLogical, return(NULL));
+
+ ped->diVec = &pLogicVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloLogical *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src1, raw->src1);
+ cpswaps(stuff->src2, raw->src2);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->operator = stuff->operator;
+ raw->bandMask = stuff->bandMask;
+ cpswapl(stuff->constant0, raw->constant0);
+ cpswapl(stuff->constant1, raw->constant1);
+ cpswapl(stuff->constant2, raw->constant2);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloLogical));
+
+ if(!raw->src2) {
+ /* convert constants */
+ pvt = (pLogicDefPtr)ped->elemPvt;
+ pvt->constant[0] = ConvertFromIEEE(raw->constant0);
+ pvt->constant[1] = ConvertFromIEEE(raw->constant1);
+ pvt->constant[2] = ConvertFromIEEE(raw->constant2);
+ }
+ /* assign phototags to inFlos */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src1;
+ if (raw->src2)
+ inFlo[SRCt2].srcTag = raw->src2;
+ if(raw->domainPhototag)
+ inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+
+ return ped;
+} /* end MakeLogic */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepLogic(floDefPtr flo, peDefPtr ped)
+{
+ xieFloLogical *raw = (xieFloLogical *)ped->elemRaw;
+ inFloPtr ind, in2, in1 = &ped->inFloLst[SRCt1];
+ outFloPtr dom, sr2, sr1 = &in1->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ CARD8 bmask = raw->bandMask;
+ int b;
+
+ if (IsntConstrained(sr1->format[0].class))
+ MatchError(flo,ped, return(FALSE));
+
+ /* Make sure levels are a power of 2 */
+ for (b = 0; b < sr1->bands; b++)
+ if ((bmask & (1<<b)) &&
+ (sr1->format[b].levels & (sr1->format[b].levels - 1)))
+ MatchError(flo,ped, return(FALSE));
+
+ /* check out our second source */
+ if(raw->src2) {
+ in2 = &ped->inFloLst[SRCt2];
+ sr2 = &in2->srcDef->outFlo;
+ if(sr1->bands != sr2->bands)
+ MatchError(flo,ped, return(FALSE));
+ in2->bands = sr2->bands;
+ for (b = 0; b < sr1->bands; b++) {
+ if ((bmask & (1<<b)) == 0) continue;
+ if (sr1->format[b].class != sr2->format[b].class ||
+ sr1->format[b].levels != sr2->format[b].levels)
+ MatchError(flo,ped, return(FALSE));
+ }
+ } else
+ sr2 = NULL;
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if(IsntDomain(dom->format[0].class) ||
+ (ind->bands = dom->bands) != 1)
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ } else
+ dom = NULL;
+
+ /* check out our operator */
+ switch(raw->operator) {
+ case GXclear: /* 0x0 0 */
+ case GXand: /* 0x1 src-1 AND src-2 */
+ case GXandReverse: /* 0x2 src-1 AND (NOT src-2) */
+ case GXcopy: /* 0x3 src-1 */
+ case GXandInverted: /* 0x4 (NOT src-1) AND src-2 */
+ case GXnoop: /* 0x5 src-2 */
+ case GXxor: /* 0x6 src-1 XOR src-2 */
+ case GXor: /* 0x7 src-1 OR src-2 */
+ case GXnor: /* 0x8 (NOT src-1) AND (NOT src-2) */
+ case GXequiv: /* 0x9 (NOT src-1) XOR src-2 */
+ case GXinvert: /* 0xa NOT src-2 */
+ case GXorInverted: /* 0xd (NOT src-1) OR src-2 */
+ case GXorReverse: /* 0xb src-1 OR (NOT src-2) */
+ case GXnand: /* 0xe (NOT src-1) OR (NOT src-2) */
+ case GXset: /* 0xf 1 */
+ case GXcopyInverted: /* 0xc NOT src-1 */
+ break;
+ default: OperatorError(flo,ped,raw->operator, return(FALSE));
+ }
+
+ /* grab a copy of the input attributes and propagate them to output */
+ dst->bands = in1->bands = sr1->bands;
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = in1->format[b] = sr1->format[b];
+ if(sr2)
+ in2->format[b] = sr2->format[b];
+ }
+ return TRUE;
+} /* end PrepLogic */
+
+/* end module plogic.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/pmath.c b/xc/programs/Xserver/XIE/dixie/process/pmath.c
new file mode 100644
index 000000000..44b0ef0b5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/pmath.c
@@ -0,0 +1,201 @@
+/* $TOG: pmath.c /main/4 1998/02/09 16:10:38 kaleb $ */
+/**** module pmath.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ pmath.c -- DIXIE routines for managing the Math element
+
+ Dean Verheiden -- AGE Logic, Inc. July 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/pmath.c,v 3.3 1998/10/25 07:11:35 dawes Exp $ */
+
+#define _XIEC_PMATH
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepMath(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pMathVec =
+{
+ PrepMath /* prepare for analysis and execution */
+};
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a math element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakeMath(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloMath);
+ ELEMENT_SIZE_MATCH(xieFloMath);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ inputs = 1 + (stuff->domainPhototag ? 1 :0);
+
+ if (!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo, tag, xieElemMath, return(NULL));
+
+ ped->diVec = &pMathVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloMath *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if (flo->reqClient->swapped)
+ {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->operator = stuff->operator;
+ raw->bandMask = stuff->bandMask;
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloMath));
+
+ /* assign phototags to inFlos */
+ inFlo = ped->inFloLst;
+ inFlo[SRCt1].srcTag = raw->src;
+ if(raw->domainPhototag)
+ inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+ return ped;
+} /* end MakeMath */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepMath(floDefPtr flo, peDefPtr ped)
+{
+ xieFloMath *raw = (xieFloMath *)ped->elemRaw;
+ inFloPtr ind, in = &ped->inFloLst[SRCt1];
+ outFloPtr src = &in->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* make sure input is not bitonal */
+ for (b = 0; b < src->bands; b++)
+ if (IsntCanonic(src->format[b].class) ||
+ ((raw->bandMask & (1<<b)) && src->format[b].class == BIT_PIXEL))
+ MatchError(flo,ped, return(FALSE));
+
+
+ /* check out our process domain */
+ if(raw->domainPhototag) {
+ outFloPtr dom;
+
+ ind = &ped->inFloLst[ped->inCnt-1];
+ dom = &ind->srcDef->outFlo;
+ if(IsntDomain(dom->format[0].class) ||
+ (ind->bands = dom->bands) != 1)
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ ind->format[0] = dom->format[0];
+ }
+
+ /* grab a copy of the input attributes and propagate them to output */
+ dst->bands = in->bands = src->bands;
+ for(b = 0; b < dst->bands; b++)
+ dst->format[b] = in->format[b] = src->format[b];
+
+ switch(raw->operator) {
+ case xieValExp: break;
+ case xieValLn: break;
+ case xieValLog2: break;
+ case xieValLog10: break;
+ case xieValSquare: break;
+ case xieValSqrt: break;
+ default: OperatorError(flo,ped,raw->operator,return(FALSE));
+ }
+ return (TRUE);
+} /* end PrepMath */
+
+/* end module pmath.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/ppaste.c b/xc/programs/Xserver/XIE/dixie/process/ppaste.c
new file mode 100644
index 000000000..43af9c9d5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/ppaste.c
@@ -0,0 +1,239 @@
+/* $TOG: ppaste.c /main/5 1998/02/09 16:10:44 kaleb $ */
+/**** module ppaste.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ppaste.c -- DIXIE routines for managing the PasteUp element
+
+ Dean Verheiden -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/ppaste.c,v 3.3 1998/10/25 07:11:36 dawes Exp $ */
+
+#define _XIEC_PPASTE
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <difloat.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPasteUp(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pPasteUpVec = {
+ PrepPasteUp /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a arithmetic element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakePasteUp(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int t;
+ CARD16 inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ pPasteUpDefPtr pvt;
+ xieTypTile *rp;
+ ELEMENT(xieFloPasteUp);
+ ELEMENT_AT_LEAST_SIZE(xieFloPasteUp);
+ ELEMENT_NEEDS_1_INPUT(numTiles);
+
+ if ( flo->reqClient->swapped ) {
+ cpswaps(stuff->numTiles, inputs);
+ } else
+ inputs = stuff->numTiles;
+
+ if(!(ped = MakePEDef((CARD32)inputs, (CARD32)stuff->elemLength<<2,
+ sizeof(pPasteUpDefRec))))
+ FloAllocError(flo, tag, xieElemPasteUp, return(NULL));
+
+ ped->diVec = &pPasteUpVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloPasteUp *)ped->elemRaw;
+ rp = (xieTypTile *) &(raw[1]);
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+
+ if( flo->reqClient->swapped ) {
+ xieTypTile *sp = (xieTypTile *) &(stuff[1]);
+
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ /* We already did this one */
+ raw->numTiles = inputs;
+ cpswapl(stuff->width, raw->width);
+ cpswapl(stuff->height, raw->height);
+ cpswapl(stuff->constant0, raw->constant0);
+ cpswapl(stuff->constant1, raw->constant1);
+ cpswapl(stuff->constant2, raw->constant2);
+ for (t = 0; t < inputs; t++) {
+ cpswaps(sp[t].src, rp[t].src);
+ cpswapl(sp[t].dstX, rp[t].dstX);
+ cpswapl(sp[t].dstY, rp[t].dstY);
+ }
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, (CARD32)stuff->elemLength<<2);
+
+ /*
+ * convert constants
+ */
+ pvt = (pPasteUpDefPtr)ped->elemPvt;
+ pvt->constant[0] = ConvertFromIEEE(raw->constant0);
+ pvt->constant[1] = ConvertFromIEEE(raw->constant1);
+ pvt->constant[2] = ConvertFromIEEE(raw->constant2);
+
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+
+ for (t = 0; t < inputs; t++)
+ inFlo[t].srcTag = rp[t].src;
+
+ return(ped);
+} /* end MakePasteUp */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepPasteUp(floDefPtr flo, peDefPtr ped)
+{
+ xieFloPasteUp *raw = (xieFloPasteUp *)ped->elemRaw;
+ inFloPtr in = &ped->inFloLst[0];
+ outFloPtr src = &in->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b, t;
+
+ /* Grab a copy of the input attributes and propagate them to our output.
+ * Use the first input as a template, all attributes must match except for
+ * width (and pitch) and height.
+ */
+
+ dst->bands = in->bands = src->bands;
+
+ if (raw->numTiles <= 0)
+ SourceError(flo,ped, return(FALSE));
+
+ for(b = 0; b < dst->bands; b++) {
+ CARD32 bits;
+ if (IsntCanonic(src->format[b].class))
+ MatchError(flo,ped,return(FALSE));
+ dst->format[b] = in->format[b] = src->format[b];
+ dst->format[b].width = bits = raw->width;
+ dst->format[b].height = raw->height;
+ bits *= dst->format[b].stride;
+ dst->format[b].pitch = bits + Align(bits,PITCH_MOD);
+ }
+
+ /* Compare the remaining tiles to ensure all attibutes that must match do */
+ for (t = 1; t < raw->numTiles; t++) {
+ in = &ped->inFloLst[t];
+ src = &in->srcDef->outFlo;
+
+ if (src->bands != dst->bands) {
+ MatchError(flo,ped,return(FALSE));
+ } else
+ in->bands = src->bands;
+
+ for(b = 0; b < dst->bands; b++) {
+ formatRec *df = &(dst->format[b]);
+ formatRec *srf = &(src->format[b]);
+ if ( srf->class != df->class ||
+ srf->depth != df->depth ||
+ srf->levels != df->levels ||
+ srf->stride != df->stride) {
+ MatchError(flo,ped,return(FALSE));
+ }
+ in->format[b] = src->format[b];
+ }
+ }
+
+ return( TRUE );
+} /* end PrepPasteUp */
+
+/* end module ppaste.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/ppoint.c b/xc/programs/Xserver/XIE/dixie/process/ppoint.c
new file mode 100644
index 000000000..0c584faa7
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/ppoint.c
@@ -0,0 +1,296 @@
+/* $TOG: ppoint.c /main/5 1998/02/09 16:10:51 kaleb $ */
+/**** module ppoint.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ ppoint.c -- DIXIE routines for managing the Point element
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+ Ben Fahy -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/ppoint.c,v 3.3 1998/10/25 07:11:36 dawes Exp $ */
+
+#define _XIEC_PPOINT
+#define _XIEC_POINT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+#include <error.h>
+
+extern peDefPtr MakePoint(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepPoint(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pPointVec = {
+ PrepPoint /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make a point element --------------------
+------------------------------------------------------------------------*/
+peDefPtr MakePoint(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ int inputs;
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloPoint);
+ ELEMENT_SIZE_MATCH(xieFloPoint);
+ ELEMENT_NEEDS_2_INPUTS(src,lut);
+ inputs = stuff->domainPhototag ? 3 : 2;
+
+ if(!(ped = MakePEDef(inputs, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo,tag,xieElemPoint, return(NULL)) ;
+
+ ped->diVec = &pPointVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloPoint *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ cpswaps(stuff->lut, raw->lut);
+ cpswapl(stuff->domainOffsetX, raw->domainOffsetX);
+ cpswapl(stuff->domainOffsetY, raw->domainOffsetY);
+ cpswaps(stuff->domainPhototag,raw->domainPhototag);
+ raw->bandMask = stuff->bandMask;
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloPoint));
+ /*
+ * assign phototags to inFlos
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+ inFlo[LUTtag].srcTag = raw->lut;
+ if(raw->domainPhototag)
+#if XIE_FULL
+ inFlo[ped->inCnt-1].srcTag = raw->domainPhototag;
+#else
+ DomainError(flo,ped,raw->domainPhototag, return(ped));
+#endif
+
+ return(ped);
+} /* end MakePoint */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepPoint(floDefPtr flo, peDefPtr ped)
+{
+ xieFloPoint *raw = (xieFloPoint *)ped->elemRaw;
+
+ inFloPtr indom,inlut= &ped->inFloLst[LUTtag],insrc = &ped->inFloLst[SRCtag];
+ outFloPtr outdom, outlut= &inlut->srcDef->outFlo,
+ outsrc= &insrc->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* propage band attributes */
+ insrc->bands = outsrc->bands;
+ inlut->bands = outlut->bands;
+
+ dst->bands = outlut->bands; /* see V4.12 spec, page 6-2 */
+
+ /* if process domain src and lut class must match */
+ if (raw->domainPhototag && insrc->bands != inlut->bands)
+ MatchError(flo,ped, return(FALSE));
+
+ /* check to make sure input image is constrained, and lut is a lut */
+ if(IsntConstrained(outsrc->format[0].class) ||
+ IsntLut(outlut->format[0].class) )
+ MatchError(flo,ped, return(FALSE));
+
+ /* propagate outflo format of src to our inflo for src */
+ for (b=0; b<outsrc->bands; ++b)
+ insrc->format[b] = outsrc->format[b];
+
+ /* propagate outflo format of lut to our inflo for lut */
+ for (b=0; b<inlut->bands; ++b)
+ inlut->format[b] = outlut->format[b];
+
+ /* do same with process domain, if it is specified */
+ if(raw->domainPhototag) {
+ indom = &ped->inFloLst[ped->inCnt-1];
+ outdom = &indom->srcDef->outFlo;
+ if(IsntDomain(outdom->format[0].class) ||
+ (indom->bands = outdom->bands) != 1)
+ DomainError(flo,ped,raw->domainPhototag, return(FALSE));
+ indom->format[0] = outdom->format[0];
+ } else
+ outdom = NULL;
+
+/*** Painful enumeration of cases ***/
+
+ if (outlut->bands == 1 && outsrc->bands == 3) {
+ int level_product;
+
+ /* Width and heights of all bands must match */
+ if (insrc->format[0].width != insrc->format[1].width ||
+ insrc->format[1].width != insrc->format[2].width ||
+ insrc->format[0].height != insrc->format[1].height ||
+ insrc->format[1].height != insrc->format[2].height)
+ MatchError(flo,ped, return(FALSE));
+
+ /* make tripleband src into CRAZY PIXELS! produce singleband */
+ if ((raw->bandMask !=7) || (outdom != NULL))
+ MatchError(flo,ped, return(FALSE)); /* see p7-25 of v4.12 spec */
+
+ /* check to make sure length of lut is sufficient */
+ level_product = insrc->format[0].levels *
+ insrc->format[1].levels *
+ insrc->format[2].levels;
+
+ if (inlut->format[0].height < level_product)
+ MatchError(flo,ped, return(FALSE));
+
+ dst->format[0] = insrc->format[0];
+ dst->format[0].levels = inlut->format[0].levels;
+ if (!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ }
+
+ else if (outlut->bands == 3 && outsrc->bands == 1) {
+ /* apply lut for each band to src */
+
+ /* this variation does not support Domains. */
+ if (outdom != NULL)
+ MatchError(flo,ped, return(FALSE));
+
+ /* destination format will be close to insrc, but not same */
+ for(b = 0; b < dst->bands; b++) {
+ dst->format[b] = insrc->format[0];
+ dst->format[b].band = b;
+ if ((raw->bandMask & (1<<b)) == 0) continue;
+ dst->format[b].levels = inlut->format[b].levels;
+ if (inlut->format[b].height < insrc->format[0].levels)
+ MatchError(flo,ped, return(FALSE));
+ }
+ if (!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ }
+
+ else if (outlut->bands == outsrc->bands &&
+ (outlut->bands == 3 || outlut->bands == 1) ) {
+
+ /* apply lut for each band to src of each band */
+
+ for(b = 0; b < dst->bands; b++) {
+
+ dst->format[b] = insrc->format[b];
+ if ((raw->bandMask & (1<<b)) == 0) continue;
+
+ dst->format[b].levels = inlut->format[b].levels;
+
+ /* check to make sure length of lut is sufficient */
+ if (inlut->format[b].height < insrc->format[b].levels)
+ MatchError(flo,ped, return(FALSE));
+
+ /* if domain is used, lut levels must be == src levels */
+ /* (or else we don't know what to do with pass-thru data */
+ if (outdom != NULL)
+ if (inlut->format[b].levels != insrc->format[b].levels)
+ MatchError(flo,ped, return(FALSE));
+ }
+ if (!UpdateFormatfromLevels(ped))
+ MatchError(flo,ped, return(FALSE));
+
+ }
+ else {
+ /* is this possible? */
+ ImplementationError(flo,ped,return(FALSE));
+ }
+
+ return(TRUE);
+} /* end PrepPoint */
+
+/* end module ppoint.c */
diff --git a/xc/programs/Xserver/XIE/dixie/process/puncnst.c b/xc/programs/Xserver/XIE/dixie/process/puncnst.c
new file mode 100644
index 000000000..73783224b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/process/puncnst.c
@@ -0,0 +1,174 @@
+/* $TOG: puncnst.c /main/5 1998/02/09 16:10:56 kaleb $ */
+/**** module puncnst.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ puncnst.c -- DIXIE routines for managing the Unconstrain element
+
+ Dean Verheiden -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/process/puncnst.c,v 3.3 1998/10/25 07:11:36 dawes Exp $ */
+
+#define _XIEC_PUNCNST
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+ /*
+ * XIE Includes
+ */
+#include <dixie_p.h>
+ /*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <element.h>
+
+/*
+ * routines internal to this module
+ */
+static Bool PrepUnconstrain(floDefPtr flo, peDefPtr ped);
+
+/*
+ * dixie entry points
+ */
+static diElemVecRec pUnconstrainVec = {
+ PrepUnconstrain /* prepare for analysis and execution */
+ };
+
+
+/*------------------------------------------------------------------------
+----------------------- routine: make an unconstrain element -------------
+------------------------------------------------------------------------*/
+peDefPtr MakeUnconstrain(floDefPtr flo, xieTypPhototag tag, xieFlo *pe)
+{
+ peDefPtr ped;
+ inFloPtr inFlo;
+ ELEMENT(xieFloUnconstrain);
+ ELEMENT_SIZE_MATCH(xieFloUnconstrain);
+ ELEMENT_NEEDS_1_INPUT(src);
+
+ if(!(ped = MakePEDef(1, (CARD32)stuff->elemLength<<2, 0)))
+ FloAllocError(flo, tag, xieElemUnconstrain, return(NULL));
+
+ ped->diVec = &pUnconstrainVec;
+ ped->phototag = tag;
+ ped->flags.process = TRUE;
+ raw = (xieFloUnconstrain *)ped->elemRaw;
+ /*
+ * copy the client element parameters (swap if necessary)
+ */
+ if( flo->reqClient->swapped ) {
+ raw->elemType = stuff->elemType;
+ raw->elemLength = stuff->elemLength;
+ cpswaps(stuff->src, raw->src);
+ }
+ else
+ memcpy((char *)raw, (char *)stuff, sizeof(xieFloUnconstrain));
+ /*
+ * assign phototags to the inFlo
+ */
+ inFlo = ped->inFloLst;
+ inFlo[SRCtag].srcTag = raw->src;
+
+ return(ped);
+} /* end MakeUnconstrain */
+
+
+/*------------------------------------------------------------------------
+---------------- routine: prepare for analysis and execution -------------
+------------------------------------------------------------------------*/
+static Bool PrepUnconstrain(floDefPtr flo, peDefPtr ped)
+{
+ inFloPtr inf = &ped->inFloLst[SRCtag];
+ outFloPtr src = &inf->srcDef->outFlo;
+ outFloPtr dst = &ped->outFlo;
+ int b;
+
+ /* grab a copy of the input attributes and propagate them to our output */
+ dst->bands = inf->bands = src->bands;
+ for(b = 0; b < dst->bands; b++) {
+ /* All band formats should be the same but check anyway */
+ if (IsntCanonic(src->format[b].class))
+ MatchError(flo, ped, return(FALSE));
+
+ /* First, copy everything over */
+ dst->format[b] = inf->format[b] = src->format[b];
+
+ /* Now, fix up everthing in the destination that will change */
+ dst->format[b].class = UNCONSTRAINED;
+ dst->format[b].depth = sz_RealPixel;
+ dst->format[b].levels = 0; /* Unconstrained */
+ dst->format[b].stride = sz_RealPixel;
+ dst->format[b].pitch = sz_RealPixel * dst->format[b].width;
+ }
+ return( TRUE );
+} /* end PrepUnconstrain */
+
+/* end module puncnst.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/Imakefile b/xc/programs/Xserver/XIE/dixie/request/Imakefile
new file mode 100644
index 000000000..d79d130dc
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/Imakefile
@@ -0,0 +1,38 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:55:47 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/dixie/request/Imakefile,v 3.7 1998/07/25 08:05:07 dawes Exp $
+XCOMM build device independent request objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = difloat.c error.c event.c flo.c lut.c memory.c \
+ photomap.c protoflo.c session.c tables.c technq.c
+OBJS1 = difloat.o error.o event.o flo.o lut.o memory.o \
+ photomap.o protoflo.o session.o tables.o technq.o
+
+#if BuildDIS
+DIS_DEFINES = -DXIE_DIS
+#else
+SRCS2 = colorlst.c roi.c
+OBJS2 = colorlst.o roi.o
+#endif
+
+DEFINES = $(DIS_DEFINES) $(MODULE_DEFINES)
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(EXTINCSRC)
+
+ LINTLIBS = ../export/llib-lexp.ln ../import/llib-limp.ln \
+ ../process/llib-lproc.ln ../request/llib-lreq.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(req,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/dixie/request/colorlst.c b/xc/programs/Xserver/XIE/dixie/request/colorlst.c
new file mode 100644
index 000000000..964c51a26
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/colorlst.c
@@ -0,0 +1,342 @@
+/* $TOG: colorlst.c /main/7 1998/02/09 16:11:00 kaleb $ */
+/**** module colorlst.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ colorlst.c -- DIXIE ColorList management
+
+ Robert NC Shelley -- AGE Logic, Inc. March, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/colorlst.c,v 3.3 1998/10/25 07:11:39 dawes Exp $ */
+
+#define _XIEC_COLORLST
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <extnsionst.h>
+#include <dixstruct.h>
+#include <colormapst.h>
+/*
+ * Module Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+#include <colorlst.h>
+#include <tables.h>
+
+/*
+ * routines referenced by other modules.
+ */
+int DeleteColorList();
+colorListPtr LookupColorList();
+void ResetColorList();
+
+
+/*------------------------------------------------------------------------
+------------------------ CreateColorList Procedures ----------------------
+------------------------------------------------------------------------*/
+int ProcCreateColorList(ClientPtr client)
+{
+ colorListPtr clst;
+ REQUEST(xieCreateColorListReq);
+ REQUEST_SIZE_MATCH(xieCreateColorListReq);
+ LEGAL_NEW_RESOURCE(stuff->colorList, client);
+
+ /*
+ * create a new ColorList
+ */
+ if( !(clst = (colorListPtr) XieMalloc(sizeof(colorListRec))) )
+ return(client->errorValue = stuff->colorList, BadAlloc);
+
+ clst->ID = stuff->colorList;
+ clst->refCnt = 1;
+ clst->cellPtr = NULL;
+
+ ResetColorList(clst, NULL);
+
+ return( AddResource(clst->ID, RT_COLORLIST, (colorListPtr)clst)
+ ? Success : (client->errorValue = stuff->colorList, BadAlloc) );
+} /* end ProcCreateColorList */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyColorList Procedures ---------------------
+------------------------------------------------------------------------*/
+int ProcDestroyColorList(ClientPtr client)
+{
+ colorListPtr clst;
+ REQUEST( xieDestroyColorListReq );
+ REQUEST_SIZE_MATCH( xieDestroyColorListReq );
+
+ if( !(clst = LookupColorList(stuff->colorList)) )
+ return( SendResourceError(client, xieErrNoColorList, stuff->colorList) );
+
+ /*
+ * Disassociate the ColorList from core X -- it calls DeleteColorList()
+ */
+ FreeResourceByType(stuff->colorList, RT_COLORLIST, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyColorList */
+
+
+/*------------------------------------------------------------------------
+-------------------------- PurgeColorList Procedures ---------------------
+------------------------------------------------------------------------*/
+int ProcPurgeColorList(ClientPtr client)
+{
+ colorListPtr clst;
+ REQUEST( xiePurgeColorListReq );
+ REQUEST_SIZE_MATCH( xiePurgeColorListReq );
+
+ if( !(clst = LookupColorList(stuff->colorList)) )
+ return( SendResourceError(client, xieErrNoColorList, stuff->colorList) );
+
+ /*
+ * Free the current list of colors
+ */
+ ResetColorList(clst, clst->mapPtr);
+
+ return(Success);
+} /* end ProcPurgeColorList */
+
+
+/*------------------------------------------------------------------------
+------------------------ QueryColorList Procedures -----------------------
+------------------------------------------------------------------------*/
+int ProcQueryColorList(ClientPtr client)
+{
+ xieQueryColorListReply rep;
+ colorListPtr clst;
+ REQUEST( xieQueryColorListReq );
+ REQUEST_SIZE_MATCH( xieQueryColorListReq );
+
+ if( !(clst = LookupColorList(stuff->colorList)) )
+ return( SendResourceError(client, xieErrNoColorList, stuff->colorList) );
+
+ /*
+ * Fill in the reply header
+ */
+ bzero((char *)&rep, sz_xieQueryColorListReply);
+ rep.type = X_Reply;
+ rep.sequenceNum = client->sequence;
+ rep.colormap = clst->mapID;
+ rep.length = clst->cellCnt;
+
+ if( client->swapped ) {
+ /*
+ * Swap the reply header fields
+ */
+ register int n;
+ swaps(&rep.sequenceNum,n);
+ swapl(&rep.colormap,n);
+ swapl(&rep.length,n);
+ }
+ WriteToClient(client, sz_xieQueryColorListReply, (char *)&rep);
+
+ if( clst->cellCnt )
+ /*
+ * Send the list of colors (swapped as necessary)
+ * Note: cellPtr is type Pixel, which unfortunately is type unsigned long
+ * and that means more work needed here if longs are 64-bits...
+ * (anyone care to donate an Alpha?)
+ */
+ if( client->swapped )
+ CopySwap32Write(client, clst->cellCnt << 2, clst->cellPtr);
+ else
+ WriteToClient(client, clst->cellCnt << 2, (char *)clst->cellPtr);
+
+ return(Success);
+} /* end ProcQueryColorList */
+
+
+/*------------------------------------------------------------------------
+----------------------- deleteFunc: DeleteColorList ----------------------
+------------------------------------------------------------------------*/
+int DeleteColorList(colorListPtr clst, xieTypColorList id)
+{
+ if( --clst->refCnt )
+ return(Success);
+
+ /* free any colors we're holding
+ */
+ ResetColorList(clst, !clst->mapID ? NULL
+ : (ColormapPtr) LookupIDByType(clst->mapID, RT_COLORMAP));
+
+ /* free the ColorList structure.
+ */
+ XieFree(clst);
+
+ return(Success);
+} /* end DeleteColorList */
+
+
+/*------------------------------------------------------------------------
+------------------------ routine: LookupColorList ------------------------
+------------------------------------------------------------------------*/
+colorListPtr LookupColorList(xieTypColorList id)
+{
+ colorListPtr clst;
+ ColormapPtr cmap;
+
+ clst = (colorListPtr) LookupIDByType(id, RT_COLORLIST);
+
+ if( clst && clst->mapID ) {
+ /*
+ * Lookup the associated Colormap.
+ */
+ cmap = (ColormapPtr) LookupIDByType(clst->mapID, RT_COLORMAP);
+
+ if( cmap != clst->mapPtr )
+ /*
+ * Forget about this Colormap and the list of colors
+ */
+ ResetColorList(clst, cmap);
+ }
+
+ return(clst);
+} /* end LookupColorList */
+
+
+/*------------------------------------------------------------------------
+-------------------------- routine: ResetColorList -----------------------
+------------------------------------------------------------------------*/
+void ResetColorList(colorListPtr clst, ColormapPtr cmap)
+{
+ if( clst->cellPtr ) {
+ if(cmap && !clst->client->clientGone) {
+ /*
+ * free our colors from the colormap
+ */
+ FreeColors(cmap, clst->client->index, clst->cellCnt, clst->cellPtr, 0);
+ }
+ XieFree(clst->cellPtr);
+ }
+
+ /* reset the ColorList to its create-time state
+ */
+ clst->mapID = 0;
+ clst->mapPtr = NULL;
+ clst->cellCnt = 0;
+ clst->cellPtr = NULL;
+ clst->client = NULL;
+} /* end ResetColorList */
+
+
+int SProcCreateColorList(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieCreateColorListReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieCreateColorListReq);
+ swapl(&stuff->colorList, n);
+ return (ProcCreateColorList(client));
+} /* end SProcCreateColorList */
+
+int SProcDestroyColorList(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieDestroyColorListReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieDestroyColorListReq );
+ swapl(&stuff->colorList, n);
+ return (ProcDestroyColorList(client));
+} /* end SProcDestroyColorList */
+
+int SProcPurgeColorList(ClientPtr client)
+{
+ register int n;
+ REQUEST( xiePurgeColorListReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xiePurgeColorListReq );
+ swapl(&stuff->colorList, n);
+ return (ProcPurgeColorList(client));
+} /* end SProcPurgeColorList */
+
+int SProcQueryColorList(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieQueryColorListReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieQueryColorListReq );
+ swapl(&stuff->colorList, n);
+ return (ProcQueryColorList(client));
+} /* end SProcQueryColorList */
+
+/* end module colorlst.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/difloat.c b/xc/programs/Xserver/XIE/dixie/request/difloat.c
new file mode 100644
index 000000000..93b1d224a
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/difloat.c
@@ -0,0 +1,105 @@
+/* $TOG: difloat.c /main/6 1998/02/09 16:11:05 kaleb $ */
+/**** module difloat.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ difloat.c - float converters
+
+ Ben Fahy -- AGE Logic, Inc. December 1992
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/difloat.c,v 1.6 1998/10/25 07:11:39 dawes Exp $ */
+
+#ifndef XIE_IEEE_IS_NATIVE
+#define _XIEC_DIFLOAT
+
+/*
+ * Include files
+ */
+ /*
+ * Core X Includes
+ */
+#include <Xproto.h>
+ /*
+ * Server XIE Includes
+ */
+#include <difloat.h>
+#include <misc.h>
+#include "macro.h"
+
+double ConvertIEEEtoNative(CARD32 ieee)
+{
+ double sign;
+ double exponent;
+ double fraction;
+
+ if(!(ieee & 0x7fffffff)) return(0.0);
+
+ sign = (ieee & ieeeFloatSignMask) == ieeeFloatSignMask ? -1.0 : 1.0;
+ exponent = (int)((ieee & ieeeFloatExpMask) >> ieeeFloatExpShift) - 127;
+ fraction = (double)(ieee & ieeeFloatMantissaMask) / (1 << ieeeMantissaSize);
+
+ return(sign * pow(2.0,exponent) * (1.0 + fraction));
+} /* end ConvertIEEEtoNative */
+#endif /* !XIE_IEEE_IS_NATIVE */
+
+/* end module difloat.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/error.c b/xc/programs/Xserver/XIE/dixie/request/error.c
new file mode 100644
index 000000000..cb823ffdb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/error.c
@@ -0,0 +1,299 @@
+/* $TOG: error.c /main/9 1998/02/09 16:11:09 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module error.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/error.c,v 3.3 1998/10/10 15:25:21 dawes Exp $ */
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <extnsionst.h>
+#include <dixstruct.h>
+#include <opaque.h>
+
+#include <corex.h>
+#include <macro.h>
+#include <flostr.h>
+
+/*
+ * routines referenced by other modules.
+ */
+
+
+/*------------------------------------------------------------------------
+-------------------------- Send Resource Error ---------------------------
+------------------------------------------------------------------------*/
+int
+SendResourceError(ClientPtr client, CARD8 code, XID id)
+{
+ xieResourceErr err;
+ REQUEST(xieReq);
+
+ if(client->clientGone) return(Success);
+
+ bzero((char *)&err, sz_xieResourceErr);
+ err.error = X_Error;
+ err.code = code + extEntry->errorBase;
+ err.sequenceNum = client->sequence;
+ err.resourceID = id;
+ err.minorOpcode = stuff->opcode;
+ err.majorOpcode = stuff->reqType;
+
+ if( client->swapped ) {
+ register int n;
+ swaps(&err.sequenceNum,n);
+ swapl(&err.resourceID,n);
+ swaps(&err.minorOpcode,n);
+ }
+ WriteToClient(client, sz_xieResourceErr, (char *)&err);
+ isItTimeToYield = TRUE;
+
+ return(Success);
+} /* end SendResourceError */
+
+/*------------------------------------------------------------------------
+----------------------------- Send FloID Error ---------------------------
+------------------------------------------------------------------------*/
+int
+SendFloIDError(ClientPtr client, XID spaceID, XID floID)
+{
+ xieFloIDErr err;
+ REQUEST(xieReq);
+
+ if(client->clientGone) return(Success);
+
+ bzero((char *)&err, sz_xieFloErr);
+ err.error = X_Error;
+ err.code = xieErrNoFlo + extEntry->errorBase;
+ err.sequenceNum = client->sequence;
+ err.floID = floID;
+ err.floErrorCode = xieErrNoFloID;
+ err.minorOpcode = stuff->opcode;
+ err.majorOpcode = stuff->reqType;
+ err.nameSpace = spaceID;
+
+ if( client->swapped ) {
+ register int n;
+ swaps(&err.sequenceNum, n);
+ swapl(&err.nameSpace, n);
+ swapl(&err.floID, n);
+ swaps(&err.minorOpcode,n);
+ }
+ WriteToClient(client, sz_xieFloErr, (char *)&err);
+ isItTimeToYield = TRUE;
+
+ return(Success);
+} /* end SendFloIDError */
+
+/*------------------------------------------------------------------------
+----------------------------- Send Flo Error -----------------------------
+------------------------------------------------------------------------*/
+int
+SendFloError(ClientPtr client, floDefPtr flo)
+{
+ int status = Success;
+ register int n;
+ xieFloErr err;
+ REQUEST(xieReq);
+
+ if(client->clientGone) return(Success);
+ /*
+ * Take care of the common part
+ */
+ err = flo->error;
+ err.error = X_Error;
+ err.code = xieErrNoFlo + extEntry->errorBase;
+ err.sequenceNum = client->sequence;
+ err.floID = flo->ID;
+ err.minorOpcode = stuff->opcode;
+ err.majorOpcode = stuff->reqType;
+ err.nameSpace = flo->spaceID;
+
+ if( client->swapped ) {
+ swaps(&err.sequenceNum, n);
+ swapl(&err.nameSpace, n);
+ swapl(&err.floID, n);
+ swaps(&err.phototag, n);
+ swaps(&err.type, n);
+ swaps(&err.minorOpcode,n);
+ }
+ /* take care of the unique parts
+ */
+ switch( ferrCode(flo) ) {
+ case xieErrNoFloAccess:
+ case xieErrNoFloAlloc:
+ case xieErrNoFloElement:
+ case xieErrNoFloImplementation:
+ case xieErrNoFloLength:
+ case xieErrNoFloMatch:
+ case xieErrNoFloOperator:
+ case xieErrNoFloSource:
+ break;
+ case xieErrNoFloColormap:
+ case xieErrNoFloColorList:
+ case xieErrNoFloDrawable:
+ case xieErrNoFloGC:
+ case xieErrNoFloLUT:
+ case xieErrNoFloPhotomap:
+ case xieErrNoFloROI:
+ if( client->swapped ) {
+ swapl(&((xieFloResourceErr *)(&err))->resourceID, n);
+ }
+ break;
+ case xieErrNoFloDomain:
+ if( client->swapped ) {
+ swaps(&((xieFloDomainErr *)(&err))->domainSrc, n);
+ }
+ break;
+ case xieErrNoFloTechnique:
+ if( client->swapped ) {
+ swaps(&((xieFloTechniqueErr *)(&err))->techniqueNumber, n);
+ swaps(&((xieFloTechniqueErr *)(&err))->lenTechParams, n);
+ }
+ break;
+ case xieErrNoFloValue:
+ if( client->swapped ) {
+ swapl(&((xieFloValueErr *)(&err))->badValue, n);
+ }
+ break;
+ default:
+ status = BadImplementation;
+ break;
+ }
+
+ if( status == Success ) {
+ WriteToClient(client, sz_xieFloErr, (char *)&err);
+ isItTimeToYield = TRUE;
+ }
+ return(status);
+} /* end SendFloError */
+
+
+/*------------------------------------------------------------------------
+-------------- Convenience routines for setting Flo Errors ---------------
+------------------------------------------------------------------------*/
+void
+FloError(floDefPtr flo, xieTypPhototag tag, CARD16 type, CARD8 code)
+{
+ ferrError(flo,tag,type,code);
+}
+
+void
+ErrGeneric(floDefPtr flo, peDefPtr ped, CARD8 code)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,code);
+}
+
+void
+ErrResource(floDefPtr flo, peDefPtr ped, CARD8 code, CARD32 id)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,code);
+ ((xieFloResourceErr *)(&flo->error))->resourceID = id;
+}
+
+void
+ErrDomain(floDefPtr flo, peDefPtr ped, xieTypPhototag domain)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,xieErrNoFloDomain);
+ ((xieFloDomainErr *)(&flo->error))->domainSrc = domain;
+}
+
+void
+ErrOperator(floDefPtr flo, peDefPtr ped, CARD8 operator)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,xieErrNoFloOperator);
+ ((xieFloOperatorErr *)(&flo->error))->operator = operator;
+}
+
+void
+ErrTechnique(floDefPtr flo, peDefPtr ped, CARD8 group, CARD16 tech,
+ CARD16 lenParams)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,xieErrNoFloTechnique);
+ ((xieFloTechniqueErr *)(&flo->error))->techniqueGroup = group;
+ ((xieFloTechniqueErr *)(&flo->error))->techniqueNumber = tech;
+ ((xieFloTechniqueErr *)(&flo->error))->lenTechParams = lenParams;
+}
+
+void
+ErrValue(floDefPtr flo, peDefPtr ped, CARD32 value)
+{
+ ferrError(flo,ped->phototag,ped->elemRaw->elemType,xieErrNoFloValue);
+ ((xieFloValueErr *)(&flo->error))->badValue = value;
+}
+
+/* end module error.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/event.c b/xc/programs/Xserver/XIE/dixie/request/event.c
new file mode 100644
index 000000000..3e5e84f56
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/event.c
@@ -0,0 +1,171 @@
+/* $TOG: event.c /main/6 1998/02/09 16:11:14 kaleb $ */
+/**** module event.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ event.c -- DIXIE routines for managing events
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/event.c,v 3.3 1998/10/25 07:11:39 dawes Exp $ */
+
+#define _XIEC_EVENT
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <extnsionst.h>
+#include <dixstruct.h>
+
+#include <corex.h>
+#include <macro.h>
+#include <flostr.h>
+
+/*------------------------------------------------------------------------
+----------------------------- Send Flo Event -----------------------------
+------------------------------------------------------------------------*/
+void SendFloEvent(floDefPtr flo)
+{
+ int status = Success;
+ register int n;
+ xieFloEvn evn;
+
+ if(flo->runClient->clientGone) return;
+ /*
+ * Take care of the common part
+ */
+ evn = flo->event;
+ evn.sequenceNum = flo->runClient->sequence;
+ evn.time = currentTime.milliseconds;
+ evn.instanceNameSpace = flo->spaceID;
+ evn.instanceFloID = flo->ID;
+
+ if( flo->runClient->swapped ) {
+ swaps(&evn.sequenceNum, n);
+ swapl(&evn.time, n);
+ swapl(&evn.instanceNameSpace, n);
+ swapl(&evn.instanceFloID, n);
+ /*
+ * Take care of the unique parts
+ */
+ switch( evn.event ) {
+ case xieEvnNoColorAlloc:
+ swaps(&evn.src, n);
+ swaps(&evn.type, n);
+ swapl(&((xieColorAllocEvn *)&evn)->colorList, n);
+ swaps(&((xieColorAllocEvn *)&evn)->colorAllocTechnique, n);
+ swapl(&((xieColorAllocEvn *)&evn)->data, n);
+ break;
+ case xieEvnNoDecodeNotify:
+ swaps(&evn.src, n);
+ swaps(&evn.type, n);
+ swaps(&((xieDecodeNotifyEvn *)&evn)->decodeTechnique, n);
+ swapl(&((xieDecodeNotifyEvn *)&evn)->width, n);
+ swapl(&((xieDecodeNotifyEvn *)&evn)->height, n);
+ break;
+ case xieEvnNoExportAvailable:
+ swaps(&evn.src, n);
+ swaps(&evn.type, n);
+ swapl(&((xieExportAvailableEvn *)&evn)->data0, n);
+ swapl(&((xieExportAvailableEvn *)&evn)->data1, n);
+ swapl(&((xieExportAvailableEvn *)&evn)->data2, n);
+ break;
+ case xieEvnNoImportObscured:
+ swaps(&evn.src, n);
+ swaps(&evn.type, n);
+ swapl(&((xieImportObscuredEvn *)&evn)->window, n);
+ swaps(&((xieImportObscuredEvn *)&evn)->x, n);
+ swaps(&((xieImportObscuredEvn *)&evn)->y, n);
+ swaps(&((xieImportObscuredEvn *)&evn)->width, n);
+ swaps(&((xieImportObscuredEvn *)&evn)->height, n);
+ break;
+ case xieEvnNoPhotofloDone:
+ break;
+ default:
+ status = BadImplementation;
+ break;
+ }
+ }
+ /* add in our event base */
+ evn.event += extEntry->eventBase;
+
+ if( status == Success )
+ WriteToClient(flo->runClient, sz_xieFloEvn, (char *)&evn);
+
+} /* end SendFloEvent */
+
+/* end module event.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/flo.c b/xc/programs/Xserver/XIE/dixie/request/flo.c
new file mode 100644
index 000000000..5e1009849
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/flo.c
@@ -0,0 +1,487 @@
+/* $TOG: flo.c /main/8 1998/02/09 16:11:19 kaleb $ */
+/**** module flo.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ flo.c -- DIXIE photoflo utility routines
+
+ Robert NC Shelley -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/flo.c,v 3.4 1998/10/25 07:11:40 dawes Exp $ */
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <corex.h>
+#include <error.h>
+#include <macro.h>
+#include <flostr.h>
+#include <tables.h>
+/*
+ * Module specific includes
+ */
+#include <memory.h>
+
+/*
+ * routines used internal to this module
+ */
+static void DAGonize(floDefPtr flo, peDefPtr ped);
+static Bool InputsOK(peDefPtr old, peDefPtr new);
+
+
+/*------------------------------------------------------------------------
+----------------------------- routine: MakeFlo ---------------------------
+------------------------------------------------------------------------*/
+floDefPtr MakeFlo(
+ ClientPtr client,
+ CARD16 peCnt,
+ xieFlo *peLst)
+{
+ xieTypPhototag tag;
+ xieFlo *pe;
+ peDefPtr ped, export = NULL;
+ floDefPtr flo;
+
+ if( !(flo = (floDefPtr) XieCalloc(sizeof(floDefRec) +
+ (peCnt+1) * sizeof(xieFlo *))) )
+ return(NULL);
+
+ flo->reqClient = client;
+ flo->peCnt = peCnt;
+ flo->peArray = (peDefPtr *) &flo[1];
+ flo->flags.modified = TRUE;
+ ListInit(&flo->defDAG);
+ ListInit(&flo->optDAG);
+
+ /* allocate photo element definition structures for each client element
+ */
+ for(pe = peLst, tag = 1; tag <= peCnt && !ferrCode(flo); tag++) {
+ if(client->swapped) {
+ register int n;
+ swaps(&pe->elemType, n);
+ swaps(&pe->elemLength, n);
+ }
+ /* if it's a valid element, Make it -- then hop to the next one
+ */
+ if( pe->elemType <= xieMaxElem ) {
+ flo->peArray[tag] = MakeElement(flo, tag, pe);
+ pe = (xieFlo *)((CARD32 *)pe + pe->elemLength);
+ } else
+ FloElementError(flo,tag,pe->elemType, return(flo));
+ }
+ /* analyze the DAG's topology and connect it all together
+ */
+ for(tag = 1; tag <= peCnt && !ferrCode(flo); tag++) {
+ ped = flo->peArray[tag];
+ if(!ped->flags.export) continue; /* skip to the next export element */
+ ped->clink = export; /* link it to previous exports */
+ export = ped;
+ /* link all elements together that contribute data towards this export */
+ DAGonize(flo,ped);
+ }
+ return(flo);
+} /* end MakeFlo */
+
+
+/*------------------------------------------------------------------------
+----------------------------- routine: EditFlo ---------------------------
+------------------------------------------------------------------------*/
+Bool EditFlo(
+ floDefPtr flo,
+ xieTypPhototag start,
+ xieTypPhototag end,
+ xieFlo *peLst)
+{
+ xieTypPhototag tag;
+ pointer ptr;
+ xieFlo *pe;
+ peDefPtr old, tmp;
+
+ for(pe = peLst, tag = start; !ferrCode(flo) && tag <= end; tag++) {
+ if(flo->reqClient->swapped) {
+ register int n;
+ swaps(&pe->elemType, n);
+ swaps(&pe->elemLength, n);
+ }
+ old = flo->peArray[tag];
+ if(pe->elemType != old->elemRaw->elemType)
+ FloElementError(flo,tag,pe->elemType, return(FALSE));
+
+ if( pe->elemType <= xieMaxElem ) {
+ /* make a temporary peDef to hold the new client parameters */
+ if ((tmp = MakeElement(flo, tag, pe)) != 0) {
+ if(InputsOK(old,tmp)) {
+ /* swap the new parameter pointers into the existing peDef */
+ SwapPtr(old->elemRaw,tmp->elemRaw,ptr);
+ SwapPtr(old->elemPvt,tmp->elemPvt,ptr);
+ SwapPtr(old->techPvt,tmp->techPvt,ptr);
+ SwapPtr(old->techVec,tmp->techVec,ptr);
+ old->flags.modified = TRUE;
+ /* free the tmp peDef which now holds the old parameters */
+ FreePEDef(tmp);
+ } else {
+ FreePEDef(tmp);
+ SourceError(flo,old, return(FALSE));
+ }
+ } else {
+ return(FALSE);
+ }
+ pe = (xieFlo *)((CARD32 *)pe + pe->elemLength);
+ } else
+ FloElementError(flo,tag,pe->elemType, return(FALSE));
+ }
+ return(flo->flags.modified = TRUE);
+} /* end EditFlo */
+
+
+/*------------------------------------------------------------------------
+----------------------------- routine: PrepFlo ---------------------------
+------------------------------------------------------------------------*/
+void PrepFlo(floDefPtr flo)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink)
+ /*
+ * call each element's Prep routine, which will:
+ * - lookup any resources needed by the element (e.g. Colormap, ROI, ...)
+ * - validate the element's parameter (and technique) values
+ * - validate the attributes of each source of data for the element
+ * - determine the element's output attributes
+ * - determine if anything was modified since a previous execution
+ */
+ if( !(*ped->diVec->prep)(flo, ped) )
+ break;
+} /* end PrepFlo */
+
+
+/*------------------------------------------------------------------------
+----------------------------- routine: FreeFlo ---------------------------
+------------------------------------------------------------------------*/
+floDefPtr FreeFlo(floDefPtr flo)
+{
+ peDefPtr ped;
+ xieTypPhototag tag;
+
+ while( !ListEmpty(&flo->optDAG) ) {
+ /* free peDefs from the optimized DAG */
+ RemoveMember(ped, flo->optDAG.flink);
+ FreePEDef(ped);
+ }
+ for(tag = 1; tag <= flo->peCnt; tag++) {
+ /* free the peDef and parameter block for each client element */
+ FreePEDef(flo->peArray[tag]);
+ }
+ /* finally, free the floDef itself */
+ XieFree(flo);
+
+ return(NULL);
+} /* end FreeFlo */
+
+
+/*------------------------------------------------------------------------
+---- routine: Alloc a peDef and DIXIE parameter storage for an element ---
+------------------------------------------------------------------------*/
+peDefPtr MakePEDef(
+ CARD32 inFloCnt,
+ CARD32 rawLen,
+ CARD32 pvtLen)
+{
+ int i, b;
+ inFloPtr inf;
+ peDefPtr ped = (peDefPtr) XieCalloc(sizeof(peDefRec) +
+ sizeof(inFloRec) * inFloCnt);
+ if( ped ) {
+ /* alloc some space for a copy of the client's element parameters */
+ if( !(ped->elemRaw = (xieFlo *) XieMalloc(rawLen)))
+ return(FreePEDef(ped));
+
+ /* alloc whatever private space this element needs for dixie info */
+ if(pvtLen)
+ if ((ped->elemPvt = (pointer)XieCalloc(pvtLen)) != 0)
+ *(CARD32 *)ped->elemPvt = pvtLen;
+ else
+ ped = FreePEDef(ped);
+ ped->flags.modified = TRUE;
+
+ /* init the outFlo */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ ListInit(&ped->outFlo.output[b]);
+ ped->outFlo.format[b].band = b;
+ }
+
+ /* init the in-line inFlo list */
+ inf = (inFloPtr) &ped[1];
+ ped->inFloLst = inf;
+ ped->inCnt = inFloCnt;
+ for(i = 0; i < inFloCnt; (inf++)->index = i++)
+ for(b = 0; b < xieValMaxBands; ++b)
+ inf->format[b].band = b;
+ }
+ return(ped);
+} /* end MakePEDef */
+
+
+/*------------------------------------------------------------------------
+---------------------------- routine: FreePEDef --------------------------
+------------------------------------------------------------------------*/
+peDefPtr FreePEDef(peDefPtr ped)
+{
+ int b;
+
+ if( ped ) {
+ /*
+ * empty the outFlo
+ */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ if(!ListEmpty(&ped->outFlo.output[b]))
+ FreeStrips(&ped->outFlo.output[b]);
+ }
+ /* free element parameter structures
+ */
+ if( ped->elemRaw ) XieFree(ped->elemRaw);
+ if( ped->elemPvt ) XieFree(ped->elemPvt);
+ if( ped->techPvt ) XieFree(ped->techPvt);
+
+ XieFree(ped);
+ }
+ return(NULL);
+} /* end FreePEDef */
+
+
+/*------------------------------------------------------------------------
+----------------------------- Send Client Data ---------------------------
+------------------------------------------------------------------------*/
+void SendClientData(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD8 *data,
+ CARD32 bytes,
+ CARD8 swapUnits,
+ CARD8 state)
+{
+ xieGetClientDataReply rep;
+
+ if(flo->reqClient->clientGone) return;
+
+ bzero((char *)&rep, sz_xieGetClientDataReply);
+ rep.newState = state;
+ rep.type = X_Reply;
+ rep.sequenceNum = flo->reqClient->sequence;
+ rep.length = (bytes + 3) >> 2;
+ rep.byteCount = bytes;
+
+ if( flo->reqClient->swapped ) {
+ register int n;
+ swaps(&rep.sequenceNum, n);
+ swapl(&rep.length, n);
+ swapl(&rep.byteCount, n);
+ }
+ WriteToClient(flo->reqClient, sz_xieGetClientDataReply, (char *)&rep);
+
+ if( bytes ) {
+ /* if the data needs to be swapped, do it now
+ */
+ if( flo->reqClient->swapped ) switch(swapUnits) {
+ case 0:
+ case 1:
+ break;
+ case 2:
+ SwapShorts((short*)data,bytes>>1);
+ break;
+ case 4:
+ case 8:
+ case 16:
+ SwapLongs((CARD32*)data,bytes>>2);
+ break;
+ }
+ WriteToClient(flo->reqClient, bytes, (char *)data);
+ }
+} /* end SendClientData */
+
+
+/*------------------------------------------------------------------------
+------- Based on levels, updata the passed in peDef's outFlo format-------
+------------------------------------------------------------------------*/
+Bool UpdateFormatfromLevels(peDefPtr ped)
+{
+ int i,bits;
+
+ for(i = 0; i < ped->outFlo.bands; i++) {
+ SetDepthFromLevels(ped->outFlo.format[i].levels,
+ ped->outFlo.format[i].depth);
+
+ if((bits = ped->outFlo.format[i].depth) > MAX_DEPTH(ped->outFlo.bands) ||
+ ped->outFlo.format[i].levels < 2)
+ return(FALSE);
+
+ else if(bits == 1) {
+ ped->outFlo.format[i].class = BIT_PIXEL;
+ ped->outFlo.format[i].stride = 1;
+ } else if(bits <= 8) {
+ ped->outFlo.format[i].class = BYTE_PIXEL;
+ ped->outFlo.format[i].stride = 8;
+ } else if(bits <= 16) {
+ ped->outFlo.format[i].class = PAIR_PIXEL;
+ ped->outFlo.format[i].stride = 16;
+ } else {
+ ped->outFlo.format[i].class = QUAD_PIXEL;
+ ped->outFlo.format[i].stride = 32;
+ }
+ bits = ped->outFlo.format[i].width * ped->outFlo.format[i].stride;
+ ped->outFlo.format[i].pitch = bits + Align(bits,PITCH_MOD);
+ }
+ return (TRUE);
+}
+
+
+/*------------------------------------------------------------------------*
+ * DAGonize recurses back through all the elements that contribute data *
+ * to the element passed to it. The recursion terminates when: *
+ * - an import element is found *
+ * - an element with fully connected inputs is found *
+ * - an error is encountered (phototag out of range, or loop detected) *
+ *------------------------------------------------------------------------*/
+static void DAGonize(floDefPtr flo, peDefPtr ped)
+{
+ int in, tag;
+ peDefPtr src;
+ inFloPtr inFlo;
+
+ if(ped->flink) return; /* this element has already been DAGonized */
+
+ /* connect all the inputs to this element */
+ for(ped->flags.loop = TRUE,in = 0; in < ped->inCnt && !ferrCode(flo); in++) {
+ inFlo = &ped->inFloLst[in];
+ if((tag = inFlo->srcTag) > flo->peCnt)
+ SourceError(flo,ped, break); /* input is outside the flo-graph! */
+
+ if(tag) { /* only connect specified (i.e. non-zero) inputs */
+ inFlo->ownDef = ped;
+ src = inFlo->srcDef = flo->peArray[tag];
+
+ if(src->flags.loop || src->flags.export)
+ SourceError(flo,ped, break); /* oops, we've stumbled over a loop */
+
+ /* insert this inFlo into the source element's outFlo list */
+ inFlo->outChain = src->outFlo.outChain;
+ src->outFlo.outChain = inFlo;
+
+ /* connect all the elements that contribute data towards this input */
+ DAGonize(flo,src);
+ }
+ }
+ if(!ferrCode(flo)) {
+ /* clear the loop-detector */
+ ped->flags.loop = FALSE;
+
+ if(ped->flags.import && !ListEmpty(&flo->defDAG)) {
+ /* find the end of the import list, then append this element */
+ for(src = flo->defDAG.flink; src->clink; src = src->clink);
+ src->clink = ped;
+ }
+ /* finally -- append this element onto the definition DAG */
+ InsertMember(ped, flo->defDAG.blink);
+ }
+} /* end DAGonize */
+
+
+/*------------------------------------------------------------------------
+-------------- compare input connections between two peDefs --------------
+------------------------------------------------------------------------*/
+static Bool InputsOK(peDefPtr old, peDefPtr new)
+{
+ inFloPtr oldin = old->inFloLst, newin = old->inFloLst;
+ int i;
+
+ if(old->inCnt != new->inCnt)
+ return(FALSE);
+
+ for(i = 0; i < old->inCnt; oldin++, newin++, i++)
+ if(oldin->srcTag != newin->srcTag)
+ return(FALSE);
+
+ return(TRUE);
+}
+
+/* end module flo.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/lut.c b/xc/programs/Xserver/XIE/dixie/request/lut.c
new file mode 100644
index 000000000..730c0bbfc
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/lut.c
@@ -0,0 +1,189 @@
+/* $TOG: lut.c /main/5 1998/02/09 16:11:28 kaleb $ */
+/**** module lut.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/lut.c,v 3.3 1998/10/25 07:11:40 dawes Exp $ */
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Module Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+#include <flodata.h>
+#include <lut.h>
+#include <tables.h>
+
+/*
+ * routines referenced by other modules.
+ */
+extern int DeleteLUT(lutPtr lut, xieTypLUT id);
+
+
+/*------------------------------------------------------------------------
+--------------------------- CreateLUT Procedures -------------------------
+------------------------------------------------------------------------*/
+int ProcCreateLUT(ClientPtr client)
+{
+ int b;
+ lutPtr lut;
+ REQUEST(xieCreateLUTReq);
+ REQUEST_SIZE_MATCH(xieCreateLUTReq);
+ LEGAL_NEW_RESOURCE(stuff->lut, client);
+
+ /* create a new lookup table
+ */
+ if( !(lut = (lutPtr) XieCalloc(sizeof(lutRec))) )
+ return(client->errorValue = stuff->lut, BadAlloc);
+
+ lut->ID = stuff->lut;
+ lut->refCnt = 1;
+ for(b = 0; b < xieValMaxBands; b++)
+ ListInit(&lut->strips[b]);
+
+ return( AddResource(lut->ID, RT_LUT, (lutPtr)lut)
+ ? Success : (client->errorValue = stuff->lut, BadAlloc) );
+} /* end ProcCreateLUT */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyLUT Procedures --------------------------
+------------------------------------------------------------------------*/
+int ProcDestroyLUT(ClientPtr client)
+{
+ lutPtr lut;
+ REQUEST( xieDestroyLUTReq );
+ REQUEST_SIZE_MATCH( xieDestroyLUTReq );
+
+ if( !(lut = (lutPtr)LookupIDByType(stuff->lut, RT_LUT)) )
+ return( SendResourceError(client, xieErrNoLUT, stuff->lut) );
+
+ /* Disassociate the LUT from core X -- it calls DeleteLUT()
+ */
+ FreeResourceByType(stuff->lut, RT_LUT, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyLUT */
+
+
+/*------------------------------------------------------------------------
+------------------------ deleteFunc: DeleteLUT ---------------------------
+------------------------------------------------------------------------*/
+int DeleteLUT(lutPtr lut, xieTypLUT id)
+{
+ int i;
+
+ if( --lut->refCnt )
+ return(Success);
+
+ /* Free any lookup table arrays
+ */
+ for(i = 0; i < lut->lutCnt; i++ )
+ FreeStrips(&lut->strips[i]);
+
+ /* Free the LUT structure.
+ */
+ XieFree(lut);
+
+ return(Success);
+} /* end DeleteLUT */
+
+
+int SProcCreateLUT(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieCreateLUTReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieCreateLUTReq);
+ swapl(&stuff->lut, n);
+ return (ProcCreateLUT(client));
+} /* end SProcCreateLUT */
+
+int SProcDestroyLUT(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieDestroyLUTReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieDestroyLUTReq );
+ swapl(&stuff->lut, n);
+ return (ProcDestroyLUT(client));
+} /* end SProcDestroyLUT */
+
+/* end module LUT.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/memory.c b/xc/programs/Xserver/XIE/dixie/request/memory.c
new file mode 100644
index 000000000..0584d7e4e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/memory.c
@@ -0,0 +1,125 @@
+/* $TOG: memory.c /main/7 1998/02/09 16:11:33 kaleb $ */
+/* Module memory.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ memory.c: Xie Memory Management Wrapper Routines
+
+ Dean Verheiden, AGE Logic, Inc., April 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/memory.c,v 3.5 1998/10/25 07:11:40 dawes Exp $ */
+
+#define _XIEC_MEMORY
+
+/*
+** Include files
+*/
+/*
+ * Core X Includes
+ */
+#include <X11/X.h>
+#include <X11/Xfuncs.h>
+
+#include "misc.h" /* for pointer */
+#include <memory.h> /* to assert declaration and definition match */
+#include "macro.h"
+
+
+int ALLOCS = 0; /* DEBUG */
+
+pointer XieMalloc(unsigned size)
+{
+ char *memptr = (char *)xalloc(size);
+
+ if(memptr)
+ ++ALLOCS; /* DEBUG */
+ return (pointer )(memptr);
+}
+
+
+pointer XieRealloc(pointer ptr, unsigned size)
+{
+ return (pointer )xrealloc(ptr,size);
+}
+
+pointer XieCalloc(unsigned size)
+{
+ char *memptr = (char *)xalloc(size);
+
+ if(memptr) {
+ ++ALLOCS; /* DEBUG */
+ bzero(memptr,size);
+ }
+ return (pointer )(memptr);
+}
+
+pointer XieFree(pointer ptr)
+{
+ if(ptr) {
+ --ALLOCS; /* DEBUG */
+ xfree(ptr);
+ }
+ return(0);
+}
+
+/* End of module memory.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/photomap.c b/xc/programs/Xserver/XIE/dixie/request/photomap.c
new file mode 100644
index 000000000..edf8404e5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/photomap.c
@@ -0,0 +1,292 @@
+/* $TOG: photomap.c /main/7 1998/02/09 16:11:38 kaleb $ */
+/**** module photomap.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+****************************************************************************
+
+ photomap.c: Routines to handle Photomap protocol requests
+
+ Dean Verheiden, Robert NC Shelley AGE Logic, Inc. April 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/photomap.c,v 3.3 1998/10/25 07:11:41 dawes Exp $ */
+
+#define _XIEC_PHOTOMAP
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Module Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+#include <photomap.h>
+#include <tables.h>
+
+
+/*
+ * Xie protocol proceedures called from the dispatcher
+ */
+int ProcCreatePhotomap();
+int ProcDestroyPhotomap();
+int ProcQueryPhotomap();
+int SProcCreatePhotomap();
+int SProcDestroyPhotomap();
+int SProcQueryPhotomap();
+
+/*
+ * routines referenced by other modules.
+ */
+int DeletePhotomap();
+
+
+/*------------------------------------------------------------------------
+------------------------ CreatePhotomap Procedures ----------------------
+------------------------------------------------------------------------*/
+int ProcCreatePhotomap(ClientPtr client)
+{
+ int b;
+ photomapPtr map;
+ REQUEST(xieCreatePhotomapReq);
+ REQUEST_SIZE_MATCH(xieCreatePhotomapReq);
+ LEGAL_NEW_RESOURCE(stuff->photomap, client);
+
+ /* create a new Photomap
+ */
+ if( !(map = (photomapPtr) XieCalloc(sizeof(photomapRec))) )
+ return(client->errorValue = stuff->photomap, BadAlloc);
+
+ map->ID = stuff->photomap;
+ map->refCnt = 1;
+ map->bands = 0;
+ for(b = 0; b < xieValMaxBands; b++)
+ ListInit(&map->strips[b]);
+
+ return( AddResource(map->ID, RT_PHOTOMAP, (photomapPtr)map)
+ ? Success : (client->errorValue = stuff->photomap, BadAlloc) );
+} /* end ProcCreatePhotomap */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyPhotomap Procedures ---------------------
+------------------------------------------------------------------------*/
+int ProcDestroyPhotomap(ClientPtr client)
+{
+ photomapPtr map;
+ REQUEST( xieDestroyPhotomapReq );
+ REQUEST_SIZE_MATCH( xieDestroyPhotomapReq );
+
+ if( !(map = (photomapPtr)LookupIDByType(stuff->photomap, RT_PHOTOMAP)) )
+ return( SendResourceError(client, xieErrNoPhotomap, stuff->photomap) );
+
+ /* Disassociate the Photomap from core X -- it calls DeletePhotomap()
+ */
+ FreeResourceByType(stuff->photomap, RT_PHOTOMAP, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyPhotomap */
+
+
+/*------------------------------------------------------------------------
+------------------------ QueryPhotomap Procedures -----------------------
+------------------------------------------------------------------------*/
+int ProcQueryPhotomap(ClientPtr client)
+{
+ xieQueryPhotomapReply rep;
+ photomapPtr map;
+ REQUEST( xieQueryPhotomapReq );
+ REQUEST_SIZE_MATCH( xieQueryPhotomapReq );
+
+ if( !(map = (photomapPtr)LookupIDByType(stuff->photomap, RT_PHOTOMAP)) )
+ return( SendResourceError(client, xieErrNoPhotomap, stuff->photomap) );
+
+ /* Fill in the reply header
+ */
+ bzero((char *)&rep, sz_xieQueryPhotomapReply);
+ rep.type = X_Reply;
+ rep.sequenceNum = client->sequence;
+ rep.length = sz_xieQueryPhotomapReply-32>>2;
+
+ if( map->bands ) {
+ rep.populated = TRUE;
+ rep.dataType = map->dataType;
+ rep.dataClass = map->dataClass;
+ rep.width0 = map->format[0].width;
+ rep.height0 = map->format[0].height;
+ rep.levels0 = map->format[0].levels;
+ rep.decodeTechnique = map->technique;
+ if( map->bands == xieValMaxBands ) {
+ rep.width1 = map->format[1].width;
+ rep.height1 = map->format[1].height;
+ rep.levels1 = map->format[1].levels;
+ rep.width2 = map->format[2].width;
+ rep.height2 = map->format[2].height;
+ rep.levels2 = map->format[2].levels;
+ }
+ } else {
+ rep.populated = FALSE;
+ }
+
+ if( client->swapped ) {
+ /*
+ * Swap the reply header fields
+ */
+ register int n;
+
+ swaps(&rep.sequenceNum,n);
+ swapl(&rep.length,n);
+ if (rep.populated) {
+ swaps(&rep.decodeTechnique,n);
+ swapl(&rep.width0,n);
+ swapl(&rep.height0,n);
+ swapl(&rep.levels0,n);
+ if (rep.dataClass == xieValTripleBand) {
+ swapl(&rep.width1,n);
+ swapl(&rep.height1,n);
+ swapl(&rep.levels1,n);
+ swapl(&rep.width2,n);
+ swapl(&rep.height2,n);
+ swapl(&rep.levels2,n);
+ }
+ }
+ }
+ WriteToClient(client, sz_xieQueryPhotomapReply, (char *)&rep);
+
+ return(Success);
+} /* end ProcQueryPhotomap */
+
+
+/*------------------------------------------------------------------------
+----------------------- deleteFunc: DeletePhotomap ----------------------
+------------------------------------------------------------------------*/
+int DeletePhotomap(
+ photomapPtr map,
+ xieTypPhotomap id)
+{
+ int i;
+
+ if( --map->refCnt )
+ return(Success);
+
+ /* free compression parameters and image data
+ */
+ if (map->tecParms)
+ map->tecParms = (pointer)XieFree(map->tecParms);
+ if (map->pvtParms)
+ map->pvtParms = (pointer)XieFree(map->pvtParms);
+ for(i = 0; i < map->bands; i++)
+ FreeStrips(&map->strips[i]);
+ /*
+ Free the Photomap structure.
+ */
+ XieFree(map);
+
+ return(Success);
+} /* end DeletePhotomap */
+
+int SProcCreatePhotomap(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieCreatePhotomapReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieCreatePhotomapReq);
+ swapl(&stuff->photomap, n);
+ return (ProcCreatePhotomap(client));
+} /* end SProcCreatePhotomap */
+
+int SProcDestroyPhotomap(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieDestroyPhotomapReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieDestroyPhotomapReq );
+ swapl(&stuff->photomap, n);
+ return (ProcDestroyPhotomap(client));
+} /* end SProcDestroyPhotomap */
+
+int SProcQueryPhotomap(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieQueryPhotomapReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieQueryPhotomapReq );
+ swapl(&stuff->photomap, n);
+ return (ProcQueryPhotomap(client));
+} /* end SProcQueryPhotomap */
+
+/* end module Photomap.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/protoflo.c b/xc/programs/Xserver/XIE/dixie/request/protoflo.c
new file mode 100644
index 000000000..7322e58c2
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/protoflo.c
@@ -0,0 +1,852 @@
+/* $TOG: protoflo.c /main/11 1998/02/09 16:11:44 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module protoflo.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ protoflo.c: photospace and photoflo request/reply procedures
+
+ Robert NC Shelley, Dean Verheiden -- AGE Logic, Inc., May 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/protoflo.c,v 3.3 1998/10/25 07:11:41 dawes Exp $ */
+
+
+#include <protoflo.h>
+
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+
+/*
+ * routines used internal to this module
+ */
+static floDefPtr LookupExecutable(CARD32 spaceID, CARD32 floID);
+static floDefPtr LookupImmediate(CARD32 spaceID, CARD32 floID, photospacePtr *spacePtr);
+static int RunFlo(ClientPtr client, floDefPtr flo);
+static int FloDone(floDefPtr flo);
+static void DeleteImmediate(floDefPtr flo);
+
+
+
+/*------------------------------------------------------------------------
+--------------------------- CreatePhotospace Procedure -------------------
+------------------------------------------------------------------------*/
+int ProcCreatePhotospace(ClientPtr client)
+{
+ photospacePtr space;
+ REQUEST(xieCreatePhotospaceReq);
+ REQUEST_SIZE_MATCH(xieCreatePhotospaceReq);
+ LEGAL_NEW_RESOURCE(stuff->nameSpace, client);
+
+ /*
+ * create a new lookup table
+ */
+ if(!(space = (photospacePtr) XieMalloc(sizeof(photospaceRec))))
+ return(client->errorValue = stuff->nameSpace, BadAlloc);
+
+ space->spaceID = stuff->nameSpace;
+ space->floCnt = 0;
+ ListInit(&space->floLst);
+
+ return( AddResource(space->spaceID, RT_PHOTOSPACE, space)
+ ? Success : (client->errorValue = stuff->nameSpace, BadAlloc) );
+} /* end ProcCreatePhotospace */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyPhotospace Procedure ---------------------
+------------------------------------------------------------------------*/
+int ProcDestroyPhotospace(ClientPtr client)
+{
+ photospacePtr space;
+ REQUEST( xieDestroyPhotospaceReq );
+ REQUEST_SIZE_MATCH( xieDestroyPhotospaceReq );
+
+ if(!(space = (photospacePtr)LookupIDByType(stuff->nameSpace,RT_PHOTOSPACE)))
+ return( SendResourceError(client, xieErrNoPhotospace, stuff->nameSpace) );
+
+ /*
+ * Disassociate the Photospace from core X -- it calls DeletePhotospace()
+ */
+ FreeResourceByType(stuff->nameSpace, RT_PHOTOSPACE, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyPhotospace */
+
+
+/*------------------------------------------------------------------------
+------------------------ ExecuteImmediate Procedure ----------------------
+------------------------------------------------------------------------*/
+int ProcExecuteImmediate(ClientPtr client)
+{
+ floDefPtr flo;
+ photospacePtr space;
+ REQUEST(xieExecuteImmediateReq);
+ REQUEST_AT_LEAST_SIZE(xieExecuteImmediateReq);
+
+ /* verify that the new flo-id is unique */
+ flo = LookupImmediate(stuff->nameSpace, stuff->floID, &space);
+ if( !space || flo )
+ return(SendFloIDError(client,stuff->nameSpace,stuff->floID));
+
+ /* create the flo structures and verify the DAG's topology */
+ if(!(flo = MakeFlo(client, stuff->numElements, (xieFlo *)&stuff[1])))
+ return(client->errorValue = stuff->floID, BadAlloc);
+
+ /* append the new flo to the photospace */
+ flo->space = space;
+ flo->spaceID = stuff->nameSpace;
+ flo->ID = stuff->floID;
+ flo->flags.notify = stuff->notify;
+ space->floCnt++;
+ InsertMember(flo,space->floLst.blink);
+
+ /* try to execute it */
+ return(RunFlo(client,flo));
+} /* end ProcExecuteImmediate */
+
+
+/*------------------------------------------------------------------------
+------------------------- CreatePhotoflo Procedure -----------------------
+------------------------------------------------------------------------*/
+int ProcCreatePhotoflo(ClientPtr client)
+{
+ floDefPtr flo;
+ REQUEST(xieCreatePhotofloReq);
+ REQUEST_AT_LEAST_SIZE(xieCreatePhotofloReq);
+ LEGAL_NEW_RESOURCE(stuff->floID, client);
+
+ /* create a new Photoflo
+ */
+ if( !(flo = MakeFlo(client, stuff->numElements, (xieFlo *)&stuff[1])) )
+ return(client->errorValue = stuff->floID, BadAlloc);
+ flo->ID = stuff->floID;
+
+ if( ferrCode(flo) ) {
+ SendFloError(client,flo);
+ DeletePhotoflo(flo, stuff->floID);
+ return(Success);
+ }
+ /* All is well, try to register the new flo
+ */
+ return( AddResource(stuff->floID, RT_PHOTOFLO, (floDefPtr)flo)
+ ? Success : (client->errorValue = stuff->floID, BadAlloc) );
+} /* end ProcCreatePhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyPhotoflo Procedure -----------------------
+------------------------------------------------------------------------*/
+int ProcDestroyPhotoflo(ClientPtr client)
+{
+ floDefPtr flo;
+ REQUEST( xieDestroyPhotofloReq );
+ REQUEST_SIZE_MATCH( xieDestroyPhotofloReq );
+
+ if( !(flo = (floDefPtr) LookupIDByType(stuff->floID, RT_PHOTOFLO)) )
+ return( SendResourceError(client, xieErrNoPhotoflo, stuff->floID) );
+
+ /* Disassociate the Photoflo from core X -- it calls DeletePhotoflo()
+ */
+ FreeResourceByType(stuff->floID, RT_PHOTOFLO, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyPhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------ ExecutePhotoflo Procedure -----------------------
+------------------------------------------------------------------------*/
+int ProcExecutePhotoflo(ClientPtr client)
+{
+ floDefPtr flo;
+ REQUEST( xieExecutePhotofloReq );
+ REQUEST_SIZE_MATCH( xieExecutePhotofloReq );
+
+ if( !(flo = (floDefPtr) LookupIDByType(stuff->floID, RT_PHOTOFLO)) )
+ return( SendResourceError(client, xieErrNoPhotoflo, stuff->floID) );
+
+ if( flo->flags.active )
+ FloAccessError(flo,0,0, return(SendFloError(client,flo)));
+ flo->flags.notify = stuff->notify;
+ ferrCode(flo) = 0;
+
+ /* try to execute it */
+ return(RunFlo(client,flo));
+} /* end ProcExecutePhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------- ModifyPhotoflo Procedure -----------------------
+------------------------------------------------------------------------*/
+int ProcModifyPhotoflo(ClientPtr client)
+{
+ floDefPtr flo;
+ xieTypPhototag end;
+ REQUEST( xieModifyPhotofloReq );
+ REQUEST_AT_LEAST_SIZE(xieModifyPhotofloReq);
+
+ if( !(flo = (floDefPtr) LookupIDByType(stuff->floID, RT_PHOTOFLO)) )
+ return( SendResourceError(client, xieErrNoPhotoflo, stuff->floID) );
+
+ if( flo->flags.active )
+ FloAccessError(flo,0,0, goto egress);
+
+ if(!stuff->start || stuff->start > flo->peCnt)
+ FloSourceError(flo,stuff->start,0, goto egress);
+
+ if((end = stuff->start + stuff->numElements - 1) > flo->peCnt)
+ FloElementError(flo,flo->peCnt,0, goto egress);
+
+ /* edit existing elements according to the list of elements we were given
+ */
+ EditFlo(flo, stuff->start, end, (xieFlo *)&stuff[1]);
+
+ egress:
+ return(ferrCode(flo) ? SendFloError(client,flo) : Success);
+} /* end ProcModifyPhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------ RedefinePhotoflo Procedure ----------------------
+------------------------------------------------------------------------*/
+int ProcRedefinePhotoflo(ClientPtr client)
+{
+ floDefPtr old, new;
+ REQUEST( xieRedefinePhotofloReq );
+ REQUEST_AT_LEAST_SIZE(xieRedefinePhotofloReq);
+
+ if( !(old = (floDefPtr) LookupIDByType(stuff->floID, RT_PHOTOFLO)) )
+ return( SendResourceError(client, xieErrNoPhotoflo, stuff->floID) );
+
+ if( old->flags.active )
+ FloAccessError(old,0,0, return(SendFloError(client,old)));
+
+ /* create a new Photoflo
+ */
+ if( !(new = MakeFlo(client, stuff->numElements, (xieFlo *)&stuff[1])) )
+ return(client->errorValue = stuff->floID, BadAlloc);
+ new->ID = stuff->floID;
+
+ if( ferrCode(new) ) {
+ SendFloError(client,new);
+ DeletePhotoflo(new, stuff->floID);
+ return(Success);
+ }
+ /* Disassociate the old flo from core X -- it calls DeletePhotoflo()
+ */
+ FreeResourceByType(stuff->floID, RT_PHOTOFLO, RT_NONE);
+
+ /* Then (re)register the new flo using the old flo's ID
+ */
+ return( AddResource(stuff->floID, RT_PHOTOFLO, (floDefPtr)new)
+ ? Success : (client->errorValue = stuff->floID, BadAlloc) );
+} /* end ProcRedefinePhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------------ Abort Procedure ---------------------------
+------------------------------------------------------------------------*/
+int ProcAbort(ClientPtr client)
+{
+ floDefPtr flo;
+ REQUEST( xieAbortReq );
+ REQUEST_SIZE_MATCH( xieAbortReq );
+
+ if ((flo = LookupExecutable(stuff->nameSpace, stuff->floID)) != 0)
+ if( flo->flags.active ) {
+ flo->reqClient = client;
+ flo->flags.aborted = TRUE;
+ ddShutdown(flo);
+ FloDone(flo);
+ }
+ return(Success);
+} /* end ProcAbort */
+
+
+/*------------------------------------------------------------------------
+------------------------------ Await Procedure ---------------------------
+------------------------------------------------------------------------*/
+int ProcAwait(ClientPtr client)
+{
+ ClientPtr *awaken;
+ floDefPtr flo;
+ REQUEST( xieAwaitReq );
+ REQUEST_SIZE_MATCH( xieAwaitReq );
+
+ if( (flo = LookupExecutable(stuff->nameSpace, stuff->floID))
+ && flo->flags.active ) {
+ if((awaken = (ClientPtr*)(flo->awakenCnt
+ ? XieRealloc( flo->awakenPtr,
+ (flo->awakenCnt+1)*sizeof(ClientPtr))
+ : XieMalloc(sizeof(ClientPtr)))) != 0) {
+ /*
+ * tell core X to ignore this client until the flo is done
+ */
+ awaken[flo->awakenCnt++] = client;
+ flo->awakenPtr = awaken;
+ IgnoreClient(client);
+ } else {
+ return(BadAlloc);
+ }
+ }
+ return(Success);
+} /* end ProcAwait */
+
+
+/*------------------------------------------------------------------------
+-------------------------- Get Client Data Procedure ---------------------
+------------------------------------------------------------------------*/
+int ProcGetClientData(ClientPtr client)
+{
+ floDefPtr flo;
+ peDefPtr ped;
+ REQUEST( xieGetClientDataReq );
+ REQUEST_SIZE_MATCH( xieGetClientDataReq );
+
+ /* find the flo and make sure it's active
+ */
+ if(!(flo = LookupExecutable(stuff->nameSpace, stuff->floID)))
+ return SendFloIDError(client, stuff->nameSpace, stuff->floID);
+ if(!flo->flags.active)
+ FloAccessError(flo,stuff->element,0, return(SendFloError(client,flo)));
+
+ /* verify that the specified element and band are OK
+ */
+ flo->reqClient = client;
+ ped = (stuff->element && stuff->element <= flo->peCnt
+ ? flo->peArray[stuff->element] : NULL);
+ if(!ped || !ped->flags.getData)
+ FloElementError(flo, stuff->element, ped ? ped->elemRaw->elemType : 0,
+ goto egress);
+ if(stuff->bandNumber >= ped->inFloLst[0].bands)
+ ValueError(flo,ped,stuff->bandNumber, goto egress);
+
+ /* grab some data and have it sent to the client
+ */
+ ddOutput(flo, ped, stuff->bandNumber, stuff->maxBytes, stuff->terminate);
+
+ egress:
+ return(ferrCode(flo) || !flo->flags.active ? FloDone(flo) : Success);
+} /* end ProcGetClientData */
+
+
+/*------------------------------------------------------------------------
+-------------------------- Put Client Data Procedure ---------------------
+------------------------------------------------------------------------*/
+int ProcPutClientData(ClientPtr client)
+{
+ floDefPtr flo;
+ peDefPtr ped;
+ REQUEST( xiePutClientDataReq );
+ REQUEST_AT_LEAST_SIZE(xiePutClientDataReq);
+
+ /* find the flo and make sure it's active
+ */
+ if( !(flo = LookupExecutable(stuff->nameSpace, stuff->floID)) )
+ return( SendFloIDError(client, stuff->nameSpace, stuff->floID) );
+ if( !flo->flags.active )
+ FloAccessError(flo,stuff->element,0, return(SendFloError(client,flo)));
+
+ /* verify that the target element and band are OK
+ */
+ flo->reqClient = client;
+ ped = stuff->element && stuff->element <= flo->peCnt
+ ? flo->peArray[stuff->element] : NULL;
+ if( !ped || !ped->flags.putData )
+ FloElementError(flo, stuff->element, ped ? ped->elemRaw->elemType : 0,
+ goto egress);
+ if( stuff->bandNumber >= ped->inFloLst[0].bands )
+ ValueError(flo,ped,stuff->bandNumber, goto egress);
+
+ /* check for partial aggregates and swap the data as required
+ */
+ switch(ped->swapUnits[stuff->bandNumber]) {
+ case 0:
+ case 1:
+ break;
+ case 2:
+ if(stuff->byteCount & 1)
+ ValueError(flo,ped,stuff->byteCount, goto egress);
+ if (client->swapped)
+ SwapShorts((short*)&stuff[1],stuff->byteCount>>1);
+ break;
+ case 4:
+ case 8:
+ case 16:
+ if(stuff->byteCount & (ped->swapUnits[stuff->bandNumber]-1))
+ ValueError(flo,ped,stuff->byteCount, goto egress);
+ if(client->swapped)
+ SwapLongs((CARD32*)&stuff[1],stuff->byteCount>>2);
+ break;
+ }
+ /* pass the byte-stream to the target element
+ */
+ if(stuff->byteCount || stuff->final)
+ ddInput(flo, ped, stuff->bandNumber,
+ (CARD8*)&stuff[1], stuff->byteCount, stuff->final);
+
+ egress:
+ return(ferrCode(flo) || !flo->flags.active ? FloDone(flo) : Success);
+} /* end ProcPutClientData */
+
+
+/*------------------------------------------------------------------------
+------------------------ QueryPhotoflo Procedure -------------------------
+------------------------------------------------------------------------*/
+int ProcQueryPhotoflo(ClientPtr client)
+{
+ CARD16 imCnt, exCnt;
+ CARD32 shorts;
+ floDefPtr flo;
+ xieTypPhototag *list;
+ xieQueryPhotofloReply rep;
+ REQUEST( xieQueryPhotofloReq );
+ REQUEST_SIZE_MATCH( xieQueryPhotofloReq );
+
+ bzero((char *)&rep, sz_xieQueryPhotofloReply);
+ rep.state = ((flo = LookupExecutable(stuff->nameSpace, stuff->floID))
+ ? (flo->flags.active ? xieValActive : xieValInactive)
+ : xieValNonexistent);
+
+ /* Ask ddxie about the status of client transport
+ */
+ if(!flo || !flo->flags.active)
+ imCnt = exCnt = 0;
+ else if(!ddQuery(flo,&list,&imCnt,&exCnt))
+ return(SendFloError(client,flo));
+
+ /* Fill in the reply header
+ */
+ shorts = ((imCnt + 1) & ~1) + ((exCnt + 1) & ~1);
+ rep.type = X_Reply;
+ rep.sequenceNum = client->sequence;
+ rep.length = shorts >> 1;
+ rep.expectedCount = imCnt;
+ rep.availableCount = exCnt;
+
+ if( client->swapped ) {
+ register int n;
+ swaps(&rep.sequenceNum,n);
+ swapl(&rep.length,n);
+ swaps(&rep.expectedCount,n);
+ swaps(&rep.availableCount,n);
+ }
+ WriteToClient(client, sz_xieQueryPhotofloReply, (char *)&rep);
+
+ if(shorts) {
+ /* Send the list of pending import/export(s) (swapped as necessary)
+ */
+ if( client->swapped )
+ SwapShorts((short *)list, shorts);
+ WriteToClient(client, shorts<<1, (char *)list);
+ XieFree(list);
+ }
+ return(Success);
+} /* end ProcQueryPhotoflo */
+
+
+/*------------------------------------------------------------------------
+----------------------- deleteFunc: DeletePhotospace ---------------------
+------------------------------------------------------------------------*/
+int DeletePhotospace(
+ photospacePtr space,
+ xieTypPhotospace id)
+{
+ /* abort and destroy all flos in the photospace
+ */
+ while( space->floCnt ) {
+ floDefPtr flo = space->floLst.flink;
+ /*
+ * abort it's execution, and then let it go away quietly (no error/events)
+ */
+ flo->reqClient = flo->runClient;
+ flo->flags.aborted = TRUE;
+ flo->flags.notify = FALSE;
+ ddShutdown(flo);
+ ferrCode(flo) = 0;
+ FloDone(flo);
+ }
+ /* Free the Photospace structure.
+ */
+ XieFree(space);
+
+ return(Success);
+} /* end DeletePhotospace */
+
+
+/*------------------------------------------------------------------------
+----------------------- deleteFunc: DeletePhotoflo -----------------------
+------------------------------------------------------------------------*/
+int DeletePhotoflo(
+ floDefPtr flo,
+ xieTypPhotoflo id)
+{
+ if(flo->flags.active) {
+ /*
+ * abort it's execution, and then let it go away quietly (no error/events)
+ */
+ flo->reqClient = flo->runClient;
+ flo->flags.aborted = TRUE;
+ flo->flags.notify = FALSE;
+ ddShutdown(flo);
+ ferrCode(flo) = 0;
+ FloDone(flo);
+ }
+ /* destroy any lingering ddxie structures
+ */
+ ddDestroy(flo);
+
+ /* free the dixie element structures
+ */
+ FreeFlo(flo);
+
+ return(Success);
+} /* end DeletePhotoflo */
+
+
+/*------------------------------------------------------------------------
+------------------------- routine: LookupExecutable ----------------------
+------------------------------------------------------------------------*/
+static floDefPtr LookupExecutable(CARD32 spaceID, CARD32 floID)
+{
+ floDefPtr flo;
+
+ if( spaceID )
+ flo = LookupImmediate(spaceID, floID, NULL);
+ else
+ flo = (floDefPtr) LookupIDByType(floID, RT_PHOTOFLO);
+
+ return(flo);
+} /* end LookupExecutable */
+
+
+/*------------------------------------------------------------------------
+------------------------ routine: LookupImmediate ------------------------
+------------------------------------------------------------------------*/
+static floDefPtr LookupImmediate(
+ CARD32 spaceID,
+ CARD32 floID,
+ photospacePtr *spacePtr)
+{
+ floDefPtr flo;
+ photospacePtr space = (photospacePtr) LookupIDByType(spaceID, RT_PHOTOSPACE);
+
+ if(spacePtr)
+ *spacePtr = space;
+ if(!space)
+ return(NULL);
+
+ /* search the photospace for the specified flo
+ */
+ for(flo = space->floLst.flink;
+ !ListEnd(flo,&space->floLst) && floID != flo->ID;
+ flo = flo->flink);
+
+ return( ListEnd(flo,&space->floLst) ? NULL : flo );
+} /* end LookupImmediate */
+
+
+/*------------------------------------------------------------------------
+----------- initiate, and possibly complete, photoflo execution ----------
+------------------------------------------------------------------------*/
+static int RunFlo(ClientPtr client, floDefPtr flo)
+{
+ flo->runClient = flo->reqClient = client;
+
+ /* validate parameters and propagate attributes between elements */
+ if( !ferrCode(flo) )
+ PrepFlo(flo);
+
+ /* choose the "best" set of handlers for this DAG (this also
+ * establishes all DDXIE entry points in the floDef and peDefs)
+ */
+ if(!ferrCode(flo) && flo->flags.modified)
+ DAGalyze(flo);
+
+ /* create all the new handlers that were chosen by DAGalyze */
+ if(!ferrCode(flo) && flo->flags.modified)
+ ddLink(flo);
+
+ /* begin (and maybe complete) execution */
+ if( ferrCode(flo) || !ddStartup(flo) )
+ FloDone(flo);
+
+ return(Success);
+} /* end RunFlo */
+
+
+/*------------------------------------------------------------------------
+-------- Handle Photoflo Done: send error and event, then clean up -------
+------------------------------------------------------------------------*/
+static int FloDone(floDefPtr flo)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+ Bool ok = !ferrCode(flo) && !flo->flags.aborted;
+
+ /* debrief import elements */
+ for(ped = lst->flink; ped && !ListEnd(ped,lst); ped = ped->clink)
+ if(ped->diVec->debrief)
+ ok &= (*ped->diVec->debrief)(flo,ped,ok);
+
+ /* debrief all other elements (e.g. export and ConvertToIndex) */
+ for(ped = lst->flink; ped && !ListEnd(ped,lst); ped = ped->flink)
+ if(!ped->flags.import && ped->diVec->debrief)
+ ok &= (*ped->diVec->debrief)(flo,ped,ok);
+
+ /* handle errors */
+ if(ferrCode(flo)) {
+ ddShutdown(flo);
+ SendFloError(flo->runClient,flo);
+ if(flo->reqClient != flo->runClient)
+ SendFloError(flo->reqClient,flo);
+ }
+ /* handle events */
+ if(flo->flags.notify) {
+ flo->event.event = xieEvnNoPhotofloDone;
+
+ if(ferrCode(flo))
+ ((xiePhotofloDoneEvn *)&flo->event)->outcome = xieValFloError;
+ else if(flo->flags.aborted)
+ ((xiePhotofloDoneEvn *)&flo->event)->outcome = xieValFloAbort;
+ else
+ ((xiePhotofloDoneEvn *)&flo->event)->outcome = xieValFloSuccess;
+
+ SendFloEvent(flo);
+ }
+ /* if this was an immediate flo, it's history */
+ if(flo->spaceID)
+ DeleteImmediate(flo);
+
+ return(Success);
+} /* end FloDone */
+
+
+/*------------------------------------------------------------------------
+------------------------- routine: DeleteImmediate -----------------------
+------------------------------------------------------------------------*/
+static void DeleteImmediate(floDefPtr flo)
+{
+ floDefPtr tmp;
+
+ /* destroy any lingering DDXIE structures
+ */
+ ddDestroy(flo);
+
+ /* remove the photoflo from the photospace and destroy it
+ */
+ flo->space->floCnt--;
+ RemoveMember(tmp, flo);
+ FreeFlo(tmp);
+} /* end DeleteImmediate */
+
+
+/*------------------------------------------------------------------------
+----------------------------- Swap procedures ----------------------------
+------------------------------------------------------------------------*/
+int SProcCreatePhotospace(ClientPtr client)
+{
+ register long n;
+ REQUEST(xieCreatePhotospaceReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieCreatePhotospaceReq);
+ swapl(&stuff->nameSpace, n);
+ return (ProcCreatePhotospace(client));
+} /* end SProcCreatePhotospace */
+
+int SProcDestroyPhotospace(ClientPtr client)
+{
+ register long n;
+ REQUEST( xieDestroyPhotospaceReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieDestroyPhotospaceReq );
+ swapl(&stuff->nameSpace, n);
+ return (ProcDestroyPhotospace(client));
+} /* end SProcDestroyPhotospace */
+
+int SProcExecuteImmediate(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieExecuteImmediateReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xieExecuteImmediateReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ swaps(&stuff->numElements, n);
+ return( ProcExecuteImmediate(client) );
+}
+
+int SProcCreatePhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieCreatePhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xieCreatePhotofloReq);
+ swapl(&stuff->floID, n);
+ swaps(&stuff->numElements, n);
+ return( ProcCreatePhotoflo(client) );
+}
+
+int SProcDestroyPhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieDestroyPhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieDestroyPhotofloReq);
+ swapl(&stuff->floID, n);
+ return( ProcDestroyPhotoflo(client) );
+}
+
+int SProcExecutePhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieExecutePhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieExecutePhotofloReq);
+ swapl(&stuff->floID, n);
+ return( ProcExecutePhotoflo(client) );
+}
+
+int SProcModifyPhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieModifyPhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xieModifyPhotofloReq);
+ swapl(&stuff->floID, n);
+ swaps(&stuff->start, n);
+ swaps(&stuff->numElements, n);
+ return( ProcModifyPhotoflo(client) );
+}
+
+int SProcRedefinePhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieRedefinePhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xieRedefinePhotofloReq);
+ swapl(&stuff->floID, n);
+ swaps(&stuff->numElements, n);
+ return( ProcRedefinePhotoflo(client) );
+}
+
+int SProcAbort(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieAbortReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieAbortReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ return( ProcAbort(client) );
+}
+
+int SProcAwait(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieAwaitReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieAwaitReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ return( ProcAwait(client) );
+}
+
+int SProcGetClientData(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieGetClientDataReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieGetClientDataReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ swapl(&stuff->maxBytes, n);
+ swaps(&stuff->element, n);
+ return( ProcGetClientData(client) );
+}
+
+int SProcPutClientData(ClientPtr client)
+{
+ register int n;
+ REQUEST(xiePutClientDataReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xiePutClientDataReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ swaps(&stuff->element, n);
+ swapl(&stuff->byteCount, n);
+ return( ProcPutClientData(client) );
+}
+
+int SProcQueryPhotoflo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieQueryPhotofloReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieQueryPhotofloReq);
+ swapl(&stuff->nameSpace, n);
+ swapl(&stuff->floID, n);
+ return( ProcQueryPhotoflo(client) );
+}
+
+/* end module protoflo.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/roi.c b/xc/programs/Xserver/XIE/dixie/request/roi.c
new file mode 100644
index 000000000..df2262538
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/roi.c
@@ -0,0 +1,185 @@
+/* $TOG: roi.c /main/5 1998/02/09 16:11:50 kaleb $ */
+/**** module roi.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ roi.c: Routines to manage region of interest protocol requests
+
+ Dean Verheiden, AGE Logic, Inc., April 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/roi.c,v 3.3 1998/10/25 07:11:41 dawes Exp $ */
+
+#define _XIEC_ROI
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Module Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+#include <roi.h>
+#include <tables.h>
+
+/*
+ * routines referenced by other modules.
+ */
+extern int DeleteROI(roiPtr roi, xieTypROI id);
+
+
+/*------------------------------------------------------------------------
+--------------------------- CreateROI Procedures -------------------------
+------------------------------------------------------------------------*/
+int ProcCreateROI(ClientPtr client)
+{
+ roiPtr roi;
+ REQUEST(xieCreateROIReq);
+ REQUEST_SIZE_MATCH(xieCreateROIReq);
+ LEGAL_NEW_RESOURCE(stuff->roi, client);
+
+ /* create a new lookup table
+ */
+ if( !(roi = (roiPtr) XieCalloc(sizeof(roiRec))) )
+ return(client->errorValue = stuff->roi, BadAlloc);
+
+ roi->ID = stuff->roi;
+ roi->refCnt = 1;
+ ListInit(&roi->strips);
+
+ return( AddResource(roi->ID, RT_ROI, (roiPtr)roi)
+ ? Success : (client->errorValue = stuff->roi, BadAlloc) );
+} /* end ProcCreateROI */
+
+
+/*------------------------------------------------------------------------
+------------------------ DestroyROI Procedures --------------------------
+------------------------------------------------------------------------*/
+int ProcDestroyROI(ClientPtr client)
+{
+ roiPtr roi;
+ REQUEST( xieDestroyROIReq );
+ REQUEST_SIZE_MATCH( xieDestroyROIReq );
+
+ if( !(roi = (roiPtr) LookupIDByType(stuff->roi, RT_ROI)) )
+ return( SendResourceError(client, xieErrNoROI, stuff->roi) );
+
+ /* Disassociate the ROI from core X -- it calls DeleteROI()
+ */
+ FreeResourceByType(stuff->roi, RT_ROI, RT_NONE);
+
+ return(Success);
+} /* end ProcDestroyROI */
+
+
+/*------------------------------------------------------------------------
+----------------------- deleteFunc: DeleteROI ---------------------------
+------------------------------------------------------------------------*/
+int DeleteROI(roiPtr roi, xieTypROI id)
+{
+ if( --roi->refCnt )
+ return(Success);
+
+ FreeStrips(&roi->strips);
+ XieFree(roi);
+
+ return(Success);
+} /* end DeleteROI */
+
+int SProcCreateROI(ClientPtr client)
+{
+ register int n;
+ REQUEST(xieCreateROIReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xieCreateROIReq);
+ swapl(&stuff->roi,n);
+ return (ProcCreateROI(client));
+} /* end SProcCreateROI */
+
+int SProcDestroyROI(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieDestroyROIReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieDestroyROIReq );
+ swapl(&stuff->roi,n);
+ return (ProcDestroyROI(client));
+} /* end SProcDestroyROI */
+
+/* end module ROI.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/session.c b/xc/programs/Xserver/XIE/dixie/request/session.c
new file mode 100644
index 000000000..b03f9e65b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/session.c
@@ -0,0 +1,343 @@
+/* $TOG: session.c /main/7 1998/02/09 16:11:54 kaleb $ */
+/**** session.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ session.c: Initialization code for the XIE server.
+
+ Dean Verheiden -- AGE Logic, Inc March, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/session.c,v 3.12 1999/01/31 12:21:34 dawes Exp $ */
+
+#define _XIEC_SESSION
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* Needed for just about anything */
+#include "Xproto.h" /* defines protocol-related stuff */
+#include "misc.h" /* includes os.h, which type FatalError */
+#include "dixstruct.h" /* this picks up ClientPtr definition */
+#include "extnsionst.h" /* defines things like ExtensionEntry */
+
+#include "XIE.h"
+#include "XIEproto.h" /* Xie protocol specification */
+#include <corex.h> /* core X interface routine definitions */
+#include <tables.h>
+#include <macro.h> /* server internal macros */
+
+#include <memory.h>
+#include <technq.h> /* extern def for technique_init */
+
+/* function declarations */
+extern int SProcQueryImageExtension(ClientPtr client);
+extern int ProcQueryImageExtension(ClientPtr client);
+
+static int XieDispatch(ClientPtr client),
+ SXieDispatch(ClientPtr client),
+ DeleteXieClient(pointer data, XID id);
+static void XieReset (ExtensionEntry *extEntry);
+static int DdxInit(void);
+
+#define REPORT_MEMORY_LEAKS
+#ifdef REPORT_MEMORY_LEAKS
+extern int ALLOCS;
+extern int STRIPS;
+extern int BYTES;
+#endif
+
+ExtensionEntry *extEntry;
+RESTYPE RC_XIE; /* XIE Resource Class */
+#if XIE_FULL
+RESTYPE RT_COLORLIST; /* ColorList resource type */
+#endif
+RESTYPE RT_LUT; /* Lookup table resource type */
+RESTYPE RT_PHOTOFLO; /* Photoflo resource type */
+RESTYPE RT_PHOTOMAP; /* Photomap resource type */
+RESTYPE RT_PHOTOSPACE; /* Photospace resource type */
+#if XIE_FULL
+RESTYPE RT_ROI; /* Region Of Interest type */
+#endif
+RESTYPE RT_XIE_CLIENT; /* XIE Type for Shutdown Notice */
+
+struct _client_table {
+ XID Shutdown_id;
+ int (**proc_table)(ClientPtr); /* Table of version specific procedures */
+ int (**sproc_table)(ClientPtr);
+ CARD16 minorVersion;
+ CARD16 pad;
+} client_table[MAXCLIENTS];
+
+void XieInit(void)
+{
+ ExtensionEntry *AddExtension();
+
+ /* Initialize XIE Resources */
+ RC_XIE = CreateNewResourceClass();
+#if XIE_FULL
+ RT_COLORLIST = RC_XIE | CreateNewResourceType((DeleteType)DeleteColorList);
+#endif
+ RT_LUT = RC_XIE | CreateNewResourceType((DeleteType)DeleteLUT);
+ RT_PHOTOFLO = RC_XIE | CreateNewResourceType((DeleteType)DeletePhotoflo);
+ RT_PHOTOMAP = RC_XIE | CreateNewResourceType((DeleteType)DeletePhotomap);
+ RT_PHOTOSPACE = RC_XIE | CreateNewResourceType((DeleteType)DeletePhotospace);
+#if XIE_FULL
+ RT_ROI = RC_XIE | CreateNewResourceType((DeleteType)DeleteROI);
+#endif
+ RT_XIE_CLIENT = RC_XIE | CreateNewResourceType((DeleteType)DeleteXieClient);
+
+
+ extEntry = AddExtension(xieExtName, /* extension name */
+ xieNumEvents, /* number of events */
+ xieNumErrors, /* number of errors */
+ XieDispatch, /* Xie's dispatcher */
+ SXieDispatch, /* Swapped dispatch */
+ XieReset, /* Reset XIE stuff */
+ StandardMinorOpcode /* choose opcode dynamically */
+ );
+
+ if (extEntry == NULL)
+ FatalError(" could not add Xie as an extension\n");
+
+ /* Initialize client table */
+ bzero((char *)client_table, sizeof(client_table));
+
+ if (!technique_init() || DdxInit() != Success)
+ FatalError(" could not add Xie as an extension\n");
+
+}
+
+/**********************************************************************/
+/* Register client with core X under a FakeClientID */
+static int RegisterXieClient(ClientPtr client, CARD16 minor)
+{
+ client_table[client->index].Shutdown_id = FakeClientID(client->index);
+ client_table[client->index].minorVersion = minor;
+
+ init_proc_tables(minor,
+ &(client_table[client->index].proc_table),
+ &(client_table[client->index].sproc_table));
+
+ /* Register the client with Core X for shutdown */
+ return (AddResource(client_table[client->index].Shutdown_id,
+ RT_XIE_CLIENT,
+ &(client_table[client->index])));
+}
+
+/**********************************************************************/
+/* dispatcher for XIE opcodes */
+static int XieDispatch (ClientPtr client)
+{
+ REQUEST(xieReq); /* make "stuff" point to client's request buffer */
+
+ /* QueryImageExtension establishes a communication version */
+ if (stuff->opcode == X_ieQueryImageExtension)
+ return (ProcQueryImageExtension(client));
+
+ /* First make sure that a communication version has been established */
+ if (client_table[client->index].Shutdown_id == 0 && /* Pick a favorite */
+ !RegisterXieClient(client, xieMinorVersion)) /* minor version */
+ return ( BadAlloc );
+ if (stuff->opcode > 0 && stuff->opcode <= xieNumProtoReq)
+ /* Index into version specific routines */
+ return (CallProc(client));
+ else
+ return ( BadRequest);
+}
+
+
+/**********************************************************************/
+/* dispatcher for swapped code */
+static int SXieDispatch (ClientPtr client)
+{
+ REQUEST(xieReq); /* make "stuff" point to client's request buffer */
+
+ /* QueryImageExtension establishes a communication version */
+ if (stuff->opcode == X_ieQueryImageExtension)
+ return (SProcQueryImageExtension(client));
+
+ /* First make sure that a communication version has been established */
+ if (client_table[client->index].Shutdown_id == 0 && /* Pick a favorite */
+ !RegisterXieClient(client, xieMinorVersion)) /* minor version */
+ return ( BadAlloc );
+ if (stuff->opcode > 0 && stuff->opcode <= xieNumProtoReq)
+ /* Index into version specific routines */
+ return (CallSProc(client));
+
+ else
+ return ( BadRequest);
+}
+
+/**********************************************************************/
+int ProcQueryImageExtension(ClientPtr client)
+{
+ xieQueryImageExtensionReply reply;
+ XID FakeClientID();
+ REQUEST(xieQueryImageExtensionReq);
+ REQUEST_SIZE_MATCH( xieQueryImageExtensionReq );
+
+ reply.type = X_Reply;
+ reply.sequenceNum = client->sequence;
+
+ reply.majorVersion = xieMajorVersion;
+
+ if (stuff->majorVersion != xieMajorVersion ||
+#if xieEarliestMinorVersion > 0
+ stuff->minorVersion < xieEarliestMinorVersion ||
+#endif
+ stuff->minorVersion > xieLatestMinorVersion)
+ reply.minorVersion = xieMinorVersion;
+ else
+ reply.minorVersion = stuff->minorVersion;
+
+ reply.length = sizeof(Preferred_levels)>>2;
+
+#if XIE_FULL
+ reply.serviceClass = xieValFull;
+#else
+ reply.serviceClass = xieValDIS;
+#endif
+ reply.alignment = ALIGNMENT;
+ reply.unconstrainedMantissa = UNCONSTRAINED_MANTISSA;
+ reply.unconstrainedMaxExp = UNCONSTRAINED_MAX_EXPONENT;
+ reply.unconstrainedMinExp = UNCONSTRAINED_MIN_EXPONENT;
+
+ /*
+ If this is the first QueryImageExtension for this client, register fake_id
+ with Core X to get a closedown notification later
+ */
+ if (client_table[client->index].Shutdown_id == 0)
+ if (!RegisterXieClient(client, reply.minorVersion))
+ return ( BadAlloc );
+
+ /*** Take care of swapping bytes if necessary ***/
+ if (client->swapped) {
+ register int n;
+
+ swaps(&reply.sequenceNum,n);
+ swapl(&reply.length,n);
+ swaps(&reply.majorVersion,n);
+ swaps(&reply.minorVersion,n);
+ swaps(&reply.unconstrainedMantissa,n);
+ swapl(&reply.unconstrainedMaxExp,n);
+ swapl(&reply.unconstrainedMinExp,n);
+ }
+ WriteToClient(client,sz_xieQueryImageExtensionReply,(char*)&reply);
+
+ /*
+ * Send the list of preferred levels (swapped as necessary)
+ */
+ if(reply.length)
+ if(client->swapped)
+ CopySwap32Write(client,sizeof(Preferred_levels),Preferred_levels);
+ else
+ WriteToClient(client,sizeof(Preferred_levels),(char*)Preferred_levels);
+
+ return(Success);
+}
+
+
+/**********************************************************************/
+int SProcQueryImageExtension(ClientPtr client)
+{
+ REQUEST(xieQueryImageExtensionReq);
+ register int n;
+ swaps(&stuff->length,n);
+ swaps(&stuff->majorVersion, n);
+ swaps(&stuff->minorVersion, n);
+ return( ProcQueryImageExtension(client) );
+}
+
+/************************************************************************/
+
+static int DdxInit(void)
+{
+ return Success;
+}
+
+/**********************************************************************/
+/* Clean up routine */
+static int DeleteXieClient(pointer data, XID id)
+{
+ bzero((char *)&(client_table[CLIENT_ID(id)]), sizeof(struct _client_table));
+ return 0;
+}
+
+/**********************************************************************/
+/* reset the XIE code, eg, on reboot */
+static void XieReset (ExtensionEntry *extEntry)
+{
+#ifdef REPORT_MEMORY_LEAKS
+
+ /* memory leak debug code
+ */
+ /* Initialize client table */
+ bzero((char *)client_table, sizeof(client_table));
+ if(ALLOCS) /* check on outstanding mallocs and callocs */
+ ErrorF("XieReset: %d allocs still outstanding.\n", ALLOCS);
+
+ if(STRIPS || BYTES) /* check on outstanding data manager allocs */
+ ErrorF("XieReset: %d strips with %d data bytes still outstanding.\n",
+ STRIPS, BYTES);
+#endif
+}
+
+/**** End of session.c ****/
diff --git a/xc/programs/Xserver/XIE/dixie/request/tables.c b/xc/programs/Xserver/XIE/dixie/request/tables.c
new file mode 100644
index 000000000..a5eb56cc8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/tables.c
@@ -0,0 +1,350 @@
+/* $TOG: tables.c /main/5 1998/02/09 16:11:59 kaleb $ */
+/**** tables.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ tables.c: XIE vector tables
+
+ Dean Verheiden, AGE Logic, Inc March 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/tables.c,v 3.4 1999/01/31 12:21:34 dawes Exp $ */
+
+#define _XIEC_TABLES
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* Needed for just about anything */
+#include "Xproto.h" /* defines protocol-related stuff */
+#include "misc.h" /* includes os.h, which type FatalError */
+#include "dixstruct.h" /* this picks up ClientPtr definition */
+
+#include "XIE.h"
+#include "XIEproto.h" /* Xie v4 protocol specification */
+#include <corex.h> /* interface to core X definitions */
+#include <error.h>
+#include <tables.h>
+#include <macro.h>
+
+
+/*------------------------------------------------------------------------
+------------------------ Procedure Not Implemented -----------------------
+------------------------------------------------------------------------*/
+static int ProcNotImplemented(ClientPtr client)
+{
+ return( BadRequest );
+} /* end ProcNotImplemented */
+
+
+/*------------------------------------------------------------------------
+---------------- Error stub for unsupported element types ----------------
+------------------------------------------------------------------------*/
+static peDefPtr ElementNotImplemented(
+ floDefPtr flo,
+ xieTypPhototag tag,
+ xieFlo *pe)
+{
+ FloElementError(flo,tag,pe->elemType, return(NULL));
+}
+
+/*------------------------------------------------------------------------
+---------------- Array of DD entry points called from DI ----------------
+------------------------------------------------------------------------*/
+/* Very rarely, a device independent routine needs to access device dependent
+ code. Interface through this array.
+*/
+xieVoidProc DDInterface[] = {
+ (xieVoidProc)DAGalyze,
+ (xieVoidProc)GetServerChoice
+};
+
+
+#if XIE_FULL
+static int (*ProcTable5_00[])(ClientPtr) = {
+/* 00 */ ProcNotImplemented, /* Illegal protocol request */
+/* 01 */ ProcNotImplemented, /* QueryImageExtension doesn't use the table */
+/* 02 */ ProcQueryTechniques,
+/* 03 */ ProcCreateColorList,
+/* 04 */ ProcDestroyColorList,
+/* 05 */ ProcPurgeColorList,
+/* 06 */ ProcQueryColorList,
+/* 07 */ ProcCreateLUT,
+/* 08 */ ProcDestroyLUT,
+/* 09 */ ProcCreatePhotomap,
+/* 10 */ ProcDestroyPhotomap,
+/* 11 */ ProcQueryPhotomap,
+/* 12 */ ProcCreateROI,
+/* 13 */ ProcDestroyROI,
+/* 14 */ ProcCreatePhotospace,
+/* 15 */ ProcDestroyPhotospace,
+/* 16 */ ProcExecuteImmediate,
+/* 17 */ ProcCreatePhotoflo,
+/* 18 */ ProcDestroyPhotoflo,
+/* 19 */ ProcExecutePhotoflo,
+/* 20 */ ProcModifyPhotoflo,
+/* 21 */ ProcRedefinePhotoflo,
+/* 22 */ ProcPutClientData,
+/* 23 */ ProcGetClientData,
+/* 24 */ ProcQueryPhotoflo,
+/* 25 */ ProcAwait,
+/* 26 */ ProcAbort
+ };
+
+static int (*SProcTable5_00[])(ClientPtr) = {
+/* 00 */ ProcNotImplemented, /* Illegal protocol request */
+/* 01 */ ProcNotImplemented, /* QueryImageExtension doesn't use the table */
+/* 02 */ SProcQueryTechniques,
+/* 03 */ SProcCreateColorList,
+/* 04 */ SProcDestroyColorList,
+/* 05 */ SProcPurgeColorList,
+/* 06 */ SProcQueryColorList,
+/* 07 */ SProcCreateLUT,
+/* 08 */ SProcDestroyLUT,
+/* 09 */ SProcCreatePhotomap,
+/* 10 */ SProcDestroyPhotomap,
+/* 11 */ SProcQueryPhotomap,
+/* 12 */ SProcCreateROI,
+/* 13 */ SProcDestroyROI,
+/* 14 */ SProcCreatePhotospace,
+/* 15 */ SProcDestroyPhotospace,
+/* 16 */ SProcExecuteImmediate,
+/* 17 */ SProcCreatePhotoflo,
+/* 18 */ SProcDestroyPhotoflo,
+/* 19 */ SProcExecutePhotoflo,
+/* 20 */ SProcModifyPhotoflo,
+/* 21 */ SProcRedefinePhotoflo,
+/* 22 */ SProcPutClientData,
+/* 23 */ SProcGetClientData,
+/* 24 */ SProcQueryPhotoflo,
+/* 25 */ SProcAwait,
+/* 26 */ SProcAbort
+ };
+
+peDefPtr (*MakeTable[])(
+ floDefPtr flo,
+ xieTypPhototag tag,
+ xieFlo *pe) = {
+/* 00 */ ElementNotImplemented,
+/* 01 */ MakeICLUT,
+/* 02 */ MakeICPhoto,
+/* 03 */ MakeICROI,
+/* 04 */ MakeIDraw,
+/* 05 */ MakeIDrawP,
+/* 06 */ MakeILUT,
+/* 07 */ MakeIPhoto,
+/* 08 */ MakeIROI,
+/* 09 */ MakeArith,
+/* 10 */ MakeBandCom,
+/* 11 */ MakeBandExt,
+/* 12 */ MakeBandSel,
+/* 13 */ MakeBlend,
+/* 14 */ MakeCompare,
+/* 15 */ MakeConstrain,
+/* 16 */ MakeConvertFromIndex,
+/* 17 */ MakeConvertFromRGB,
+/* 18 */ MakeConvertToIndex,
+/* 19 */ MakeConvertToRGB,
+/* 20 */ MakeConvolve,
+/* 21 */ MakeDither,
+/* 22 */ MakeGeometry,
+/* 23 */ MakeLogic,
+/* 24 */ MakeMatchHistogram,
+/* 25 */ MakeMath,
+/* 26 */ MakePasteUp,
+/* 27 */ MakePoint,
+/* 28 */ MakeUnconstrain,
+/* 29 */ MakeECHistogram,
+/* 30 */ MakeECLUT,
+/* 31 */ MakeECPhoto,
+/* 32 */ MakeECROI,
+/* 33 */ MakeEDraw,
+/* 34 */ MakeEDrawPlane,
+/* 35 */ MakeELUT,
+/* 36 */ MakeEPhoto,
+/* 37 */ MakeEROI
+ };
+
+#else /* XIEdis */
+
+static int (*ProcTable5_00[])() = {
+/* 00 */ ProcNotImplemented, /* Illegal protocol request */
+/* 01 */ ProcNotImplemented, /* QueryImageExtension doesn't use the table */
+/* 02 */ ProcQueryTechniques,
+/* 03 */ ProcNotImplemented, /* CreateColorList */
+/* 04 */ ProcNotImplemented, /* DestroyColorList */
+/* 05 */ ProcNotImplemented, /* PurgeColorList */
+/* 06 */ ProcNotImplemented, /* QueryColorList */
+/* 07 */ ProcCreateLUT,
+/* 08 */ ProcDestroyLUT,
+/* 09 */ ProcCreatePhotomap,
+/* 10 */ ProcDestroyPhotomap,
+/* 11 */ ProcQueryPhotomap,
+/* 12 */ ProcNotImplemented, /* CreateROI */
+/* 13 */ ProcNotImplemented, /* DestroyROI */
+/* 14 */ ProcCreatePhotospace,
+/* 15 */ ProcDestroyPhotospace,
+/* 16 */ ProcExecuteImmediate,
+/* 17 */ ProcCreatePhotoflo,
+/* 18 */ ProcDestroyPhotoflo,
+/* 19 */ ProcExecutePhotoflo,
+/* 20 */ ProcModifyPhotoflo,
+/* 21 */ ProcRedefinePhotoflo,
+/* 22 */ ProcPutClientData,
+/* 23 */ ProcGetClientData,
+/* 24 */ ProcQueryPhotoflo,
+/* 25 */ ProcAwait,
+/* 26 */ ProcAbort
+ };
+
+static int (*SProcTable5_00[])() = {
+/* 00 */ ProcNotImplemented, /* Illegal protocol request */
+/* 01 */ ProcNotImplemented, /* QueryImageExtension doesn't use the table */
+/* 02 */ SProcQueryTechniques,
+/* 03 */ ProcNotImplemented, /* CreateColorList */
+/* 04 */ ProcNotImplemented, /* DestroyColorList */
+/* 05 */ ProcNotImplemented, /* PurgeColorList */
+/* 06 */ ProcNotImplemented, /* QueryColorList */
+/* 07 */ SProcCreateLUT,
+/* 08 */ SProcDestroyLUT,
+/* 09 */ SProcCreatePhotomap,
+/* 10 */ SProcDestroyPhotomap,
+/* 11 */ SProcQueryPhotomap,
+/* 12 */ ProcNotImplemented, /* CreateROI */
+/* 13 */ ProcNotImplemented, /* DestroyROI */
+/* 14 */ SProcCreatePhotospace,
+/* 15 */ SProcDestroyPhotospace,
+/* 16 */ SProcExecuteImmediate,
+/* 17 */ SProcCreatePhotoflo,
+/* 18 */ SProcDestroyPhotoflo,
+/* 19 */ SProcExecutePhotoflo,
+/* 20 */ SProcModifyPhotoflo,
+/* 21 */ SProcRedefinePhotoflo,
+/* 22 */ SProcPutClientData,
+/* 23 */ SProcGetClientData,
+/* 24 */ SProcQueryPhotoflo,
+/* 25 */ SProcAwait,
+/* 26 */ SProcAbort
+ };
+
+peDefPtr (*MakeTable[])() = {
+/* 00 */ ElementNotImplemented,
+/* 01 */ MakeICLUT,
+/* 02 */ MakeICPhoto,
+/* 03 */ ElementNotImplemented, /* ICROI */
+/* 04 */ MakeIDraw,
+/* 05 */ MakeIDrawP,
+/* 06 */ MakeILUT,
+/* 07 */ MakeIPhoto,
+/* 08 */ ElementNotImplemented, /* IROI */
+/* 09 */ ElementNotImplemented, /* Arith */
+/* 10 */ ElementNotImplemented, /* BandCom */
+/* 11 */ ElementNotImplemented, /* BandExt */
+/* 12 */ ElementNotImplemented, /* BandSel */
+/* 13 */ ElementNotImplemented, /* Blend */
+/* 14 */ ElementNotImplemented, /* Compare */
+/* 15 */ ElementNotImplemented, /* Constrain */
+/* 16 */ ElementNotImplemented, /* ConvertFromIndex */
+/* 17 */ ElementNotImplemented, /* ConvertFromRGB */
+/* 18 */ ElementNotImplemented, /* ConvertToIndex */
+/* 19 */ ElementNotImplemented, /* ConvertToRGB */
+/* 20 */ ElementNotImplemented, /* Convolve */
+/* 21 */ ElementNotImplemented, /* Dither */
+/* 22 */ MakeGeometry,
+/* 23 */ ElementNotImplemented, /* Logic */
+/* 24 */ ElementNotImplemented, /* MatchHistogram */
+/* 25 */ ElementNotImplemented, /* Math */
+/* 26 */ ElementNotImplemented, /* PasteUp */
+/* 27 */ MakePoint,
+/* 28 */ ElementNotImplemented, /* Unconstrain */
+/* 29 */ ElementNotImplemented, /* ECHistogram */
+/* 30 */ MakeECLUT,
+/* 31 */ MakeECPhoto,
+/* 32 */ ElementNotImplemented, /* ECROI */
+/* 33 */ MakeEDraw,
+/* 34 */ MakeEDrawPlane,
+/* 35 */ MakeELUT,
+/* 36 */ MakeEPhoto,
+/* 37 */ ElementNotImplemented /* EROI */
+ };
+#endif
+
+/************************************************************************
+ Fill in the version specific tables for the selected minor protocol
+ version
+************************************************************************/
+void init_proc_tables(
+ CARD16 minorVersion,
+ int (**ptable[])(ClientPtr),
+ int (**sptable[])(ClientPtr))
+{
+ /* Kind of boring with only one version to work with */
+ switch (minorVersion) {
+ case 0:
+ *ptable = ProcTable5_00;
+ *sptable = SProcTable5_00;
+ break;
+ default:
+ *ptable = ProcTable5_00;
+ *sptable = SProcTable5_00;
+ }
+}
+
+/* end module tables.c */
diff --git a/xc/programs/Xserver/XIE/dixie/request/technq.c b/xc/programs/Xserver/XIE/dixie/request/technq.c
new file mode 100644
index 000000000..b534c2aa8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/dixie/request/technq.c
@@ -0,0 +1,356 @@
+/* $TOG: technq.c /main/7 1998/02/09 16:12:04 kaleb $ */
+/**** module technq.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+****************************************************************************
+ technq.c: Routines to handle technique protocol requests
+
+ Dean Verheiden AGE Logic, Inc. April 1993
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/dixie/request/technq.c,v 3.5 1998/10/25 07:11:42 dawes Exp $ */
+
+#define _XIEC_TECHNQ
+
+/*
+ A Note on Technique Etiquette:
+
+ To change technique defaults, or add new techniques or technique
+ groups, don't edit this file. Make the appropriate changes to the technq.h
+ file.
+
+ If the changes result in the creation of a new default technique or
+ allow a technique to use default parameters, it is also necessary that
+ the corresponding technique copy function be updated to supply default
+ parameters should they be required.
+*/
+
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+
+/*
+ * Element Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <memory.h>
+#include <technq.h>
+#include <tables.h>
+
+/*
+ * Used internally by this module
+ */
+static Bool send_reply(xieTypTechniqueGroup group, TechPtr tech, ClientPtr client);
+static Bool send_technique_replies(xieTypTechniqueGroup group, ClientPtr client);
+
+/*------------------------------------------------------------------------
+------------------------ QueryTechniques Procedures -----------------------
+------------------------------------------------------------------------*/
+int ProcQueryTechniques(ClientPtr client)
+{
+ xieQueryTechniquesReply rep;
+ REQUEST( xieQueryTechniquesReq );
+ REQUEST_SIZE_MATCH( xieQueryTechniquesReq );
+
+ /*
+ * Fill in the reply header
+ */
+ bzero((char *)&rep, sz_xieQueryTechniquesReply);
+ rep.type = X_Reply;
+ rep.sequenceNum = client->sequence;
+
+ /* First, figure out how big the ListofTechniqueRecs is going to be */
+ if (stuff->techniqueGroup == xieValDefault) {
+ rep.numTechniques = techTable.numDefaults;
+ rep.length = techTable.defaultSize;
+ } else if (stuff->techniqueGroup == xieValAll) {
+ rep.numTechniques = techTable.numTechniques;
+ rep.length = techTable.tableSize;
+ } else {
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++)
+ if (stuff->techniqueGroup == tg->group) {
+ rep.numTechniques = tg->numTechniques;
+ rep.length = tg->groupSize;
+ break;
+ }
+
+ if (g >= techTable.numGroups) /* Couldn't find the group */
+ return(BadValue);
+ }
+
+ if( client->swapped ) {
+ /*
+ * Swap the reply header fields
+ */
+ register int n;
+
+ swaps(&rep.sequenceNum,n);
+ swapl(&rep.length,n);
+ swaps(&rep.numTechniques,n);
+ }
+
+ WriteToClient(client, sz_xieQueryTechniquesReply, (char *)&rep);
+
+ send_technique_replies(stuff->techniqueGroup,client);
+
+ return(Success);
+} /* end ProcQueryTechniques */
+
+int SProcQueryTechniques(ClientPtr client)
+{
+ register int n;
+ REQUEST( xieQueryTechniquesReq );
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH( xieQueryTechniquesReq );
+ return (ProcQueryTechniques(client));
+} /* end SProcQueryTechniques */
+
+/*************************************************************************
+ Initialization Procedure: Fill in various technique fields
+*************************************************************************/
+
+Bool technique_init(void)
+{
+ CARD32 defaultSize = 0;
+ CARD32 tableSize = 0;
+ CARD32 numTechniques = 0;
+ CARD32 numDefaults = 0;
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++) {
+ TechPtr tp = tg->tech;
+ CARD16 defaultNumber = tg->defaultNumber;
+ Bool needDefault = (defaultNumber != NO_DEFAULT);
+ CARD32 groupSize = 0;
+ int t;
+
+ for (t = 0; t < tg->numTechniques; t++, tp++) {
+ tp->nameLength = strlen((char *)(tp->name));
+ tp->techSize = (sizeof(xieTypTechniqueRec) + tp->nameLength + 3)
+ >> 2;
+ groupSize += tp->techSize;
+ if (needDefault && defaultNumber == tp->techvec.number) {
+ tg->defaultIndex = t;
+ defaultSize += tp->techSize;
+ numDefaults++;
+ needDefault = FALSE;
+ }
+ }
+ if (needDefault) return (FALSE);
+ tg->groupSize = groupSize;
+ tableSize += groupSize;
+ numTechniques += tg->numTechniques;
+ }
+
+ techTable.numTechniques = numTechniques;
+ techTable.numDefaults = numDefaults;
+ techTable.tableSize = tableSize;
+ techTable.defaultSize = defaultSize;
+
+ return (TRUE);
+} /* end technique_init */
+
+/*************************************************************************
+ Send Technique Reply: send technique structures to client, one at a time,
+ swapping them first if necessary
+*************************************************************************/
+
+static Bool send_reply(
+ xieTypTechniqueGroup group,
+ TechPtr tech,
+ ClientPtr client)
+{
+ xieTypTechniqueRec rep;
+
+ rep.needsParam = !(tech->techvec.NoTech || tech->techvec.OptionalTech);
+ rep.group = group;
+ rep.number = (client->swapped) ? lswaps(tech->techvec.number) :
+ tech->techvec.number;
+ rep.speed = tech->speed;
+ rep.nameLength = tech->nameLength;
+
+ /* Send everything except the name */
+ WriteToClient(client, sz_xieTypTechniqueRec, (char *)&rep);
+ /* Send the name */
+ WriteToClient(client, tech->nameLength, (char *)tech->name);
+
+ return(TRUE);
+}
+
+static Bool send_technique_replies(
+ xieTypTechniqueGroup group,
+ ClientPtr client)
+{
+ if (group == xieValDefault) {
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++)
+ if (tg->defaultNumber != NO_DEFAULT)
+ send_reply(tg->group,&tg->tech[tg->defaultIndex],client);
+ return (TRUE);
+ } else if (group == xieValAll) {
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++) {
+ TechPtr tp = tg->tech;
+ int t = 0;
+
+ for (t = 0; t < tg->numTechniques; t++, tp++)
+ send_reply(tg->group,tp,client);
+ }
+ return (TRUE);
+ } else {
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++)
+ if (group == tg->group) {
+ TechPtr tp = tg->tech;
+ int t = 0;
+
+ for (t = 0; t < tg->numTechniques; t++, tp++)
+ send_reply(group,tp,client);
+
+ return(TRUE);
+ }
+ }
+
+ return(FALSE); /* Unrecognized group */
+} /* end return_technique_replies */
+
+/*************************************************************************
+FindTechnique: return group's technique entry point structure
+*************************************************************************/
+techVecPtr FindTechnique(
+ xieTypTechniqueGroup group,
+ CARD16 number)
+{
+ TechGroupPtr tg = techTable.techgroups;
+ int g;
+
+ for (g = 0; g < techTable.numGroups; g++, tg++)
+ if (group == tg->group) {
+ TechPtr tp = tg->tech;
+ int t = 0;
+
+ if (number == xieValDefault) {
+ if (tg->defaultNumber)
+ return (&tg->tech[tg->defaultIndex].techvec);
+ else
+ return((techVecPtr)NULL); /* No default for this group */
+ } else {
+ for (t = 0; t < tg->numTechniques; t++, tp++)
+ if (tp->techvec.number == number)
+ return (&tp->techvec);
+ }
+ }
+
+ return((techVecPtr)NULL); /* Unrecognized group */
+} /* end FindTechnique */
+
+/*************************************************************************
+NoParamCheck: Used as copyfnc for techniques that do not have parameters.
+ Checks to make sure that no parameters have been passed in.
+*************************************************************************/
+static Bool NoParamCheck(
+ floDefPtr flo,
+ pointer rparms,
+ pointer cparms,
+ CARD16 tsize)
+{
+ return(!tsize);
+} /* end NoParamCheck */
+
+/*************************************************************************
+NoTechYet: error stub for unimplemented technique routines
+*************************************************************************/
+static Bool NoTechYet(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer parm,
+ pointer tech)
+{
+ return(FALSE);
+} /* end NoTechYet */
+
+/* end module technq.c */
diff --git a/xc/programs/Xserver/XIE/include/colorlst.h b/xc/programs/Xserver/XIE/include/colorlst.h
new file mode 100644
index 000000000..755c21350
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/colorlst.h
@@ -0,0 +1,90 @@
+/* $TOG: colorlst.h /main/5 1998/02/10 10:27:12 kaleb $ */
+/**** colorlst.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ colorlst.h -- contains color list specific definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. March 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_COLORLST
+#define _XIEH_COLORLST
+
+/* colorlist structure definition
+ */
+typedef struct _colorlist {
+ xieTypColorList ID;
+ INT32 refCnt;
+ ClientPtr client;
+ Colormap mapID;
+ ColormapPtr mapPtr;
+ CARD32 cellCnt;
+ Pixel *cellPtr;
+} colorListRec, *colorListPtr;
+
+#ifndef _XIEC_COLORLST
+extern colorListPtr LookupColorList();
+extern void ResetColorList();
+#endif
+
+#endif /* end _XIEH_COLORLST */
diff --git a/xc/programs/Xserver/XIE/include/corex.h b/xc/programs/Xserver/XIE/include/corex.h
new file mode 100644
index 000000000..fddc63de9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/corex.h
@@ -0,0 +1,159 @@
+/* $TOG: corex.h /main/6 1998/02/10 10:27:18 kaleb $ */
+/**** module corex.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ corex.h - Xie server interface (for hooking to Core X)
+
+ Dean Verheiden -- AGE Logic, Inc. April, 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/corex.h,v 1.3 1998/10/25 12:47:53 dawes Exp $ */
+
+#ifndef _XIEH_COREX
+#define _XIEH_COREX
+
+#include <extnsionst.h>
+
+/* temporary hack:
+ *
+ * XIE is suppose to support single-band images up to the depth
+ * of the deepest drawable supported by the server -- but not less than 16.
+ * Triple-band data should never be more than 16 bits.
+ *
+ * Later releases will compute the correct value, but it will not exceed 24
+ * in the sample implementation. (eeeck, sounds like a global variable..)
+ */
+
+#define MAX_SINGLE 24
+#define MAX_TRIPLE 16
+#define MAX_DEPTH(nbands) (nbands > 1 ? MAX_TRIPLE : MAX_SINGLE)
+#define MAX_LEVELS(nbands) (nbands > 1 ? (1<<MAX_TRIPLE) : (1<<MAX_SINGLE))
+
+#define ALIGNMENT xieValArbitrary
+
+#ifdef LONG64
+#define PITCH_MOD 64 /* default scanline pitch */
+#else
+#define PITCH_MOD 32 /* default scanline pitch */
+#endif
+
+#if defined(_XIEC_SESSION)
+/*
+ * Define constants relating to unconstrained computation
+ * See QueryImageExtension for description
+ * Return values for Single Precision IEEE floats for now
+ */
+#define UNCONSTRAINED_MANTISSA 24
+#define UNCONSTRAINED_MAX_EXPONENT 128
+#define UNCONSTRAINED_MIN_EXPONENT -126
+
+CARD32 Preferred_levels[] =
+ {
+ 1<<1, /* Bit pixels */
+ 1<<8, /* Byte pixels */
+ 1<<16, /* Pair pixels */
+ 1<<24 /* Quad pixels */
+ };
+#endif
+
+/*
+ * Interface to Core X
+ */
+extern Bool AddResource(XID id, RESTYPE type, pointer value);
+extern void FreeResource(XID id, RESTYPE type);
+
+#ifndef _XIEC_SESSION
+extern ExtensionEntry *extEntry;
+
+extern RESTYPE RC_XIE; /* XIE Resource Class */
+#if XIE_FULL
+extern RESTYPE RT_COLORLIST; /* ColorList resource type */
+#endif
+extern RESTYPE RT_LUT; /* Lookup table resource type */
+extern RESTYPE RT_PHOTOFLO; /* Photoflo resource type */
+extern RESTYPE RT_PHOTOMAP; /* Photomap resource type */
+extern RESTYPE RT_PHOTOSPACE; /* Photospace resource type */
+#if XIE_FULL
+extern RESTYPE RT_ROI; /* Region Of Interest type */
+#endif
+extern RESTYPE RT_XIE_CLIENT; /* XIE Type for Shutdown Notice */
+#endif
+
+#if !defined(_XIEC_COLORLST) && (XIE_FULL)
+extern int DeleteColorList();
+#endif
+extern int DeleteLUT();
+#ifndef _XIEC_PHOTOMAP
+extern int DeletePhotomap();
+#endif
+#ifndef _XIEC_PROTOFLO
+extern int DeletePhotoflo();
+extern int DeletePhotospace();
+#endif
+#if !defined(_XIEC_ROI) && (XIE_FULL)
+extern int DeleteROI();
+#endif
+#ifndef _XIEC_SESSION
+extern int DeleteXieClient();
+#endif
+
+#endif /* end _XIEH_COREX */
diff --git a/xc/programs/Xserver/XIE/include/difloat.h b/xc/programs/Xserver/XIE/include/difloat.h
new file mode 100644
index 000000000..2e5db67df
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/difloat.h
@@ -0,0 +1,93 @@
+/* $TOG: difloat.h /main/5 1998/02/10 10:27:23 kaleb $ */
+/**** module difloat.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ difloat.h - float converters
+
+ Ben Fahy -- AGE Logic, Inc. December 1992
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/difloat.h,v 1.3 1998/10/25 12:47:53 dawes Exp $ */
+
+#ifndef _XIE_DIFLOAT
+#define _XIE_DIFLOAT
+
+#ifdef XIE_IEEE_IS_NATIVE
+
+#define ConvertFromIEEE(ieee) ((double)(*(float *)&(ieee)))
+
+#else
+
+double ConvertIEEEtoNative(CARD32 ieee);
+
+#define ConvertFromIEEE(ieee) ConvertIEEEtoNative(ieee)
+
+#define ieeeFloatSignMask 0x80000000
+#define ieeeFloatExpMask 0x7F800000
+#define ieeeFloatExpShift 23
+#define ieeeFloatMantissaMask 0x007FFFFF
+#define ieeeMantissaSize 23
+
+#endif
+
+#endif /* end _XIE_DIFLOAT */
diff --git a/xc/programs/Xserver/XIE/include/dixie_e.h b/xc/programs/Xserver/XIE/include/dixie_e.h
new file mode 100644
index 000000000..2c00eecf1
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/dixie_e.h
@@ -0,0 +1,80 @@
+/*
+ * $XFree86: xc/programs/Xserver/XIE/include/dixie_e.h,v 1.1 1998/10/25 07:11:45 dawes Exp $
+ */
+
+/************************************************************
+
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Interfaces of XIE/dixie/export
+ */
+
+#ifndef _XIEH_DIXIE_EXPORT
+#define _XIEH_DIXIE_EXPORT 1
+
+#include <X.h>
+#include <XIE.h>
+#include <XIEproto.h> /* declares xieFloEvn */
+#include <misc.h>
+#include <flostr.h>
+#include <dixstruct.h>
+
+/* echist.h */
+extern peDefPtr MakeECHistogram(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* eclut.c */
+extern peDefPtr MakeECLUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ecphoto.h */
+peDefPtr MakeECPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ecroi.c */
+extern peDefPtr MakeECROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* edraw.c */
+extern peDefPtr MakeEDraw(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+extern Bool DrawableAndGC(
+ floDefPtr flo,
+ peDefPtr ped,
+ Drawable draw_id,
+ GContext gc_id,
+ DrawablePtr *draw_ret,
+ GCPtr *gc_ret);
+
+/* edrawp.c */
+extern peDefPtr MakeEDrawPlane(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* elut.h */
+extern peDefPtr MakeELUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ephoto.h */
+extern peDefPtr MakeEPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+extern Bool BuildDecodeFromEncode(floDefPtr flo, peDefPtr ped);
+extern Bool CompareDecode(floDefPtr flo, peDefPtr ped);
+
+/* eroi.c */
+extern peDefPtr MakeEROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+#endif /* _XIEH_DIXIE_EXPORT */
diff --git a/xc/programs/Xserver/XIE/include/dixie_i.h b/xc/programs/Xserver/XIE/include/dixie_i.h
new file mode 100644
index 000000000..842829a4d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/dixie_i.h
@@ -0,0 +1,72 @@
+/*
+ * $XFree86: xc/programs/Xserver/XIE/include/dixie_i.h,v 1.1 1998/10/25 07:11:45 dawes Exp $
+ */
+
+/************************************************************
+
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Interfaces of XIE/dixie/import
+ */
+
+#ifndef _XIEH_DIXIE_IMPORT
+#define _XIEH_DIXIE_IMPORT 1
+
+#include <X.h>
+
+#include <XIE.h>
+#include <XIEproto.h> /* declares xieFloEvn */
+#include <misc.h>
+#include <flostr.h>
+#include <dixstruct.h>
+#include <photomap.h>
+
+/* iclut.h */
+extern peDefPtr MakeICLUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* icphoto.h */
+extern peDefPtr MakeICPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* icroi.h */
+extern peDefPtr MakeICROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* idraw.h */
+extern peDefPtr MakeIDraw(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* idrawp.h */
+extern peDefPtr MakeIDrawP(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ilut.h */
+extern peDefPtr MakeILUT(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* iphoto.h */
+extern peDefPtr MakeIPhoto(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+extern photomapPtr GetImportPhotomap(peDefPtr ped);
+extern pointer GetImportTechnique(peDefPtr ped, CARD16 *num_ret, CARD16 *len_ret);
+
+/* iroi.h */
+extern peDefPtr MakeIROI(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+#endif /* _XIEH_DIXIE_IMPORT */
diff --git a/xc/programs/Xserver/XIE/include/dixie_p.h b/xc/programs/Xserver/XIE/include/dixie_p.h
new file mode 100644
index 000000000..c56d93ae9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/dixie_p.h
@@ -0,0 +1,106 @@
+/*
+ * $XFree86: xc/programs/Xserver/XIE/include/dixie_p.h,v 1.1 1998/10/25 07:11:45 dawes Exp $
+ */
+
+/************************************************************
+
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Interfaces of XIE/dixie/process
+ */
+
+#ifndef _XIEH_DIXIE_PROCESS
+#define _XIEH_DIXIE_PROCESS 1
+
+#include <X.h>
+#include <XIE.h>
+#include <XIEproto.h> /* declares xieFloEvn */
+#include <misc.h>
+#include <flostr.h>
+#include <dixstruct.h>
+
+/* parith.c */
+extern peDefPtr MakeArith(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pbandc.c */
+extern peDefPtr MakeBandCom(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pbande.c */
+extern peDefPtr MakeBandExt(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pbands.c */
+extern peDefPtr MakeBandSel(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pblend.c */
+extern peDefPtr MakeBlend(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pcfrgb.c */
+extern peDefPtr MakeConvertFromRGB(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pcfromi.c */
+extern peDefPtr MakeConvertFromIndex(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pcnst.c */
+extern peDefPtr MakeConstrain(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pcomp.c */
+extern peDefPtr MakeCompare(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pconv.c */
+extern peDefPtr MakeConvolve(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pctoi.c */
+extern peDefPtr MakeConvertToIndex(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pctrgb.c */
+extern peDefPtr MakeConvertToRGB(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+extern void copy_floats(double *doubles_out, xieTypFloat *funny_floats_in, int cnt);
+extern void swap_floats(double *doubles_out, xieTypFloat *funny_floats_in, int cnt);
+
+/* pdither.c */
+extern peDefPtr MakeDither(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pgeom.c */
+extern peDefPtr MakeGeometry(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* phist.c */
+extern peDefPtr MakeMatchHistogram(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* plogic.c */
+extern peDefPtr MakeLogic(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* pmath.c */
+extern peDefPtr MakeMath(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ppaste.c */
+extern peDefPtr MakePasteUp(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* ppoint.c */
+extern peDefPtr MakePoint(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+/* puncst.c */
+extern peDefPtr MakeUnconstrain(floDefPtr flo, xieTypPhototag tag, xieFlo *pe);
+
+#endif /* _XIEH_DIXIE_PROCESS */
diff --git a/xc/programs/Xserver/XIE/include/element.h b/xc/programs/Xserver/XIE/include/element.h
new file mode 100644
index 000000000..2b18310b3
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/element.h
@@ -0,0 +1,471 @@
+/* $TOG: element.h /main/8 1998/02/10 10:27:27 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/* module element.h */
+/*****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ element.h -- device independent definitions for elements
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+
+
+#ifndef _XIEH_ELEMENT
+#define _XIEH_ELEMENT
+
+#include <flostr.h>
+
+/*
+ * Generic Definitions
+ */
+#define SRCtag 0 /* inFlo index for src of single input elements */
+#define SRCt1 0 /* inFlo index for src1 of multi-input elements */
+#define SRCt2 1 /* inFlo index for src2 of multi-input elements */
+#define SRCt3 2 /* inFlo index for src3 of multi-input elements */
+#define LUTtag 1 /* inFlo index for lut input of point element */
+ /* inFlo index for alpha stored in private structure*/
+ /* inFlo index for domain input is inFloCnt - 1 */
+
+#define IMPORT 0 /* inFlo index for "imported" data */
+
+
+#if defined(_XIEC_IDRAW) || defined(_XIEC_IDRAWP)
+/*
+ * dixie element-private data for the ImportDrawable and ImportDrawablePlane
+ * elements
+ */
+typedef struct _idrawdef {
+ CARD32 pvtBytes;
+ DrawablePtr pDraw;
+} iDrawDefRec, *iDrawDefPtr;
+#endif /* _XIEC_IDRAW || _XIEC_IDRAWP */
+
+#if defined(_XIEC_ILUT)
+/*
+ * dixie element-private data for the ImportLUT element
+ */
+typedef struct _ilutdef {
+ CARD32 pvtBytes;
+ lutPtr lut;
+} iLUTDefRec, *iLUTDefPtr;
+#endif /* _XIEC_ILUT */
+
+#if defined(_XIEC_IPHOTO)
+/*
+ * dixie element-private data for the ImportPhotomap element
+ */
+typedef struct _iphotodef {
+ CARD32 pvtBytes;
+ photomapPtr map;
+} iPhotoDefRec, *iPhotoDefPtr;
+#endif /* _XIEC_IPHOTO */
+
+#if defined(_XIEC_IROI)
+/*
+ * dixie element-private data for the ImportROI element
+ */
+typedef struct _iroidef {
+ CARD32 pvtBytes;
+ roiPtr roi;
+} iROIDefRec, *iROIDefPtr;
+#endif /* _XIEC_IROI */
+
+#if defined(_XIEC_PARITH)
+/*
+ * dixie element-private data for the Arithmetic element
+ */
+typedef struct _parith {
+ CARD32 pvtBytes;
+ double constant[xieValMaxBands];
+} pArithDefRec, *pArithDefPtr;
+#endif /* _XIEC_PARITH */
+
+#if defined(_XIEC_PBANDE)
+/*
+ * dixie element-private data for the band extract element
+ */
+typedef struct _pbandext {
+ CARD32 pvtBytes;
+ double coef[3];
+ double bias;
+} pBandExtDefRec, *pBandExtDefPtr;
+#endif /* _XIEC_PBANDE */
+
+#if defined(_XIEC_PBLEND)
+/*
+ * dixie element-private data for the Arithmetic element
+ */
+typedef struct _pblend {
+ CARD32 pvtBytes;
+ CARD16 aindex; /* if non zero, index of alpha plane */
+ CARD16 dindex; /* if non zero, index of proc domain */
+ double constant[xieValMaxBands];
+ double alphaConst;
+} pBlendDefRec, *pBlendDefPtr;
+#endif /* _XIEC_PBLEND */
+
+#if defined(_XIEC_PCFRGB)
+/*
+ * dixie element-private technique data for the ConvertFromRGB element
+ */
+typedef struct _ptecRBGtoCIELab_and_XYZdef {
+ double matrix[9];
+ double whitePoint[3]; /* Optional whitePoint correction*/
+ techVecPtr whiteTec;
+ xieTypWhiteAdjustTechnique whiteAdjusted;
+ CARD16 lenWhiteParams;/* Length for whitePoint params */
+} pTecRGBToCIEDefRec, *pTecRGBToCIEDefPtr;
+
+typedef struct _ptecRGBToYCbCr {
+ CARD32 levels0;
+ CARD32 levels1;
+ CARD32 levels2;
+ double red;
+ double green;
+ double blue;
+ double bias0;
+ double bias1;
+ double bias2;
+} pTecRGBToYCbCrDefRec, *pTecRGBToYCbCrDefPtr;
+
+typedef struct _ptecRGBToYCC {
+ CARD32 levels0;
+ CARD32 levels1;
+ CARD32 levels2;
+ double red;
+ double green;
+ double blue;
+ double scale;
+} pTecRGBToYCCDefRec, *pTecRGBToYCCDefPtr;
+
+#endif /* _XIEC_PCFRGB */
+
+#if defined(_XIEC_PCFROMI)
+/*
+ * dixie element-private data for the ConvertFromIndex element
+ */
+typedef struct _pcfromidef {
+ CARD32 pvtBytes;
+ ColormapPtr cmap;
+ VisualPtr visual;
+ CARD16 class;
+ CARD16 cells;
+ CARD32 pixMsk[3];
+ CARD8 pixPos[3];
+ CARD8 precShift;
+} pCfromIDefRec, *pCfromIDefPtr;
+#endif /* _XIEC_PCFROMI */
+
+#if defined(_XIEC_PCNST)
+/*
+ * dixie element-private data for the Constrain element
+ */
+typedef struct _pcnst {
+ double input_low[3];
+ double input_high[3];
+ CARD32 output_low[3];
+ CARD32 output_high[3];
+} pCnstDefRec, *pCnstDefPtr;
+#endif /* _XIEC_PCNST */
+
+#if defined(_XIEC_PCOMP)
+/*
+ * dixie element-private data for the Arithmetic element
+ */
+typedef struct _pcompare {
+ CARD32 pvtBytes;
+ double constant[xieValMaxBands];
+} pCompareDefRec, *pCompareDefPtr;
+#endif /* _XIEC_PCOMP */
+
+#if defined(_XIEC_PCONV)
+/*
+ * constant technique private data for the Convolve element
+ */
+#define ConvFloat float
+
+typedef struct _pconv {
+ ConvFloat constant[3];
+} pTecConvolveConstantDefRec, *pTecConvolveConstantDefPtr;
+#endif /* _XIEC_PCONV */
+
+#if defined(_XIEC_PCTOI)
+/*
+ * dixie element-private data for the ConvertToIndex element
+ */
+typedef struct _pctoidef {
+ CARD32 pvtBytes;
+ colorListPtr list;
+ ColormapPtr cmap;
+ VisualPtr visual;
+ CARD32 mask[3];
+ CARD16 cells;
+ CARD8 shft[3];
+ CARD8 class;
+ CARD8 depth;
+ CARD8 stride;
+ BOOL graySrc;
+ BOOL dynamic;
+ BOOL preFmt;
+ BOOL doHist;
+ CARD32 levels[3];
+} pCtoIDefRec, *pCtoIDefPtr;
+
+typedef struct _pTecConvertToIndexMatchdef {
+ CARD32 pvtBytes;
+ double matchLimit;
+ double grayLimit;
+} pTecConvertToIndexMatchDefRec, *pConvertToIndexMatchDefPtr;
+
+typedef struct _ptecctoi {
+ CARD32 fill;
+ BOOL defTech;
+} pTecCtoIDefRec, *pTecCtoIDefPtr;
+
+#endif /* _XIEC_PCTOI */
+
+#if defined(_XIEC_PCTRGB)
+/*
+ * dixie element-private technique data for the ConvertToRGB element
+ */
+typedef struct _ptecCIELab_and_XYZtoRGBdef {
+ double matrix[9];
+ double whitePoint[3]; /* Optional whitePoint correction*/
+ techVecPtr whiteTec;
+ xieTypWhiteAdjustTechnique whiteAdjusted;
+ CARD16 lenWhiteParams;/* Length for whitePoint params */
+ techVecPtr gamutTec;
+ xieTypGamutTechnique gamutCompress;
+ CARD16 lenGamutParams;/* Length for gamut params */
+} pTecCIEToRGBDefRec, *pTecCIEToRGBDefPtr;
+
+typedef struct _ptecYCCToRGB {
+ CARD32 levels0;
+ CARD32 levels1;
+ CARD32 levels2;
+ double red;
+ double green;
+ double blue;
+ double scale;
+ techVecPtr gamutTec;
+ xieTypGamutTechnique gamutCompress;
+ CARD16 lenGamutParams;/* Length for gamut params */
+} pTecYCCToRGBDefRec, *pTecYCCToRGBDefPtr;
+
+typedef struct _ptecYCbCrToRGB {
+ CARD32 levels0;
+ CARD32 levels1;
+ CARD32 levels2;
+ double red;
+ double green;
+ double blue;
+ double bias0;
+ double bias1;
+ double bias2;
+ techVecPtr gamutTec;
+ xieTypGamutTechnique gamutCompress;
+ CARD16 lenGamutParams;/* Length for gamut params */
+} pTecYCbCrToRGBDefRec, *pTecYCbCrToRGBDefPtr;
+
+#endif /* _XIEC_PCTRGB */
+
+
+#if defined(_XIEC_PGEOM)
+/*
+ * dixie element-private data for the Geoemtry element
+ */
+typedef struct _geom_elem {
+ double coeffs[6];
+ double constant[xieValMaxBands];
+ int do_band[3];
+} pGeomDefRec, *pGeomDefPtr;
+
+/*
+ * constant technique private data for the Geometry element
+ */
+typedef struct _geom_nn {
+ int modify;
+} pTecGeomNearestNeighborDefRec, *pTecGeomNearestNeighborDefPtr;
+
+typedef struct _geom_gauss {
+ double sigma;
+ double normalize;
+ int radius;
+ Bool simple;
+} pTecGeomGaussianDefRec, *pTecGeomGaussianDefPtr;
+
+#endif /* _XIEC_PGEOM */
+
+#if defined(_XIEC_PHIST)
+
+/*
+ * technique private structures
+ */
+
+typedef struct _pmhistgaussian {
+ double mean;
+ double sigma;
+} pTecHistogramGaussianDefRec, *pTecHistogramGaussianDefPtr;
+
+typedef struct _pmhisthyperbolic {
+ double constant;
+ Bool shapeFactor;
+} pTecHistogramHyperbolicDefRec, *pTecHistogramHyperbolicDefPtr;
+
+#endif /* _XIEC_PHIST */
+
+#if defined(_XIEC_PLOGIC)
+/*
+ * dixie element-private data for the Logical element
+ */
+typedef struct _plogic {
+ CARD32 pvtBytes;
+ double constant[xieValMaxBands];
+} pLogicDefRec, *pLogicDefPtr;
+#endif /* _XIEC_PLOGIC */
+
+#if defined(_XIEC_PPASTE)
+/*
+ * dixie element-private data for the Paste Up element
+ */
+#define PasteUpFloat float
+
+typedef struct _ppasteup {
+ CARD32 pvtBytes;
+ PasteUpFloat constant[xieValMaxBands];
+} pPasteUpDefRec, *pPasteUpDefPtr;
+#endif /* _XIEC_PPASTE */
+
+#if defined(_XIEC_ECPHOTO)
+/*
+ * JPEG Baseline technique private data for the export client photo element
+ */
+typedef struct _eEndcodeJPEGBaselinedef {
+ CARD32 pvtBytes;
+ CARD8 *q;
+ CARD8 *a;
+ CARD8 *d;
+} eTecEncodeJPEGBaselineDefRec, *eTecEncodeJPEGBaselineDefPtr;
+#endif /* _XIEC_ECPHOTO */
+
+#if defined(_XIEC_EDRAW)
+/*
+ * dixie element-private data for the ExportDrawable element
+ */
+typedef struct _edrawdef {
+ CARD32 pvtBytes;
+ DrawablePtr pDraw;
+ GCPtr pGC;
+} eDrawDefRec, *eDrawDefPtr;
+#endif /* _XIEC_EDRAW */
+
+#if defined(_XIEC_EDRAWP)
+/*
+ * dixie element-private data for the ExportDrawable element
+ */
+typedef struct _edrawpdef {
+ CARD32 pvtBytes;
+ DrawablePtr pDraw;
+ GCPtr pGC;
+} eDrawPDefRec, *eDrawPDefPtr;
+#endif /* _XIEC_EDRAWP */
+
+#if defined(_XIEC_ELUT)
+/*
+ * dixie element-private data for the ExportLUT element
+ */
+typedef struct _elutdef {
+ CARD32 pvtBytes;
+ lutPtr lut;
+} eLUTDefRec, *eLUTDefPtr;
+#endif /* _XIEC_ELUT */
+
+#if defined(_XIEC_EPHOTO) || defined(_XIEC_ECPHOTO) || defined(_XIEC_SCHOICE)
+/*
+ * dixie element-private data for the ExportPhotomap/ExportClientPhoto elements
+ */
+typedef struct _ephotodef {
+ CARD32 pvtBytes;
+ photomapPtr map;
+ BOOL serverChose; /* TRUE = server chose encode technique */
+ BOOL congress; /* make sure no work gets done */
+ CARD16 encodeNumber; /* encode technique number */
+ CARD16 encodeLen; /* length of encode parms */
+ pointer encodeParms; /* pointer to parms to be used for encode */
+ CARD16 decodeNumber; /* decode technique number */
+ CARD16 decodeLen; /* length of decode parms */
+ pointer decodeParms; /* pointer to parms to be used for decode */
+ pointer pvtParms;
+} ePhotoDefRec, *ePhotoDefPtr;
+#endif /* _XIEC_EPHOTO || _XIEC_ECPHOTO || _XIEC_SCHOICE */
+
+#if defined(_XIEC_EROI)
+/*
+ * dixie element-private data for the ExportROI element
+ */
+typedef struct _eroidef {
+ CARD32 pvtBytes;
+ roiPtr roi;
+} eROIDefRec, *eROIDefPtr;
+#endif /* _XIEC_EROI */
+
+#endif /* module _XIEH_ELEMENT */
diff --git a/xc/programs/Xserver/XIE/include/error.h b/xc/programs/Xserver/XIE/include/error.h
new file mode 100644
index 000000000..11785db02
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/error.h
@@ -0,0 +1,158 @@
+/* $TOG: error.h /main/5 1998/02/10 10:27:32 kaleb $ */
+/**** module error.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ error.h -- error specific definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/error.h,v 3.3 1998/10/05 13:22:23 dawes Exp $ */
+
+#ifndef _XIEH_ERROR
+#define _XIEH_ERROR
+
+#include <flo.h>
+#include <XIE.h>
+#include <XIEproto.h> /* declares xieFloEvn */
+#include <XIEprotost.h> /* declares xieTypPhototag */
+#include <flostr.h> /* declares floDefPtr */
+
+extern int SendFloError(ClientPtr client, floDefPtr flo);
+extern int SendFloIDError(ClientPtr client, XID spaceID, XID floID);
+extern int SendResourceError(ClientPtr client, CARD8 code, XID id);
+extern void ErrDomain(floDefPtr flo, peDefPtr ped, xieTypPhototag domain);
+extern void ErrGeneric(floDefPtr flo, peDefPtr ped, CARD8 code);
+extern void ErrOperator(floDefPtr flo, peDefPtr ped, CARD8 operator);
+extern void ErrResource(floDefPtr flo, peDefPtr ped, CARD8 code, CARD32 id);
+extern void ErrTechnique(floDefPtr flo, peDefPtr ped, CARD8 group, CARD16 tech, CARD16 lenParams);
+extern void ErrValue(floDefPtr flo, peDefPtr ped, CARD32 value);
+extern void FloError(floDefPtr flo, xieTypPhototag tag, CARD16 type, CARD8 code);
+
+/*
+ * Convenience macros for dealing with the floDef generic error packet
+ */
+#define ferrTag(flo) ((flo)->error.phototag)
+#define ferrType(flo) ((flo)->error.type)
+#define ferrCode(flo) ((flo)->error.floErrorCode)
+#define ferrError(flo,tag,type,code) \
+ (ferrTag(flo)=(tag),ferrType(flo)=(type),ferrCode(flo)=(code))
+
+/*
+ * convenience macros for general flo errors
+ */
+#define xieFloError(flo,tag,type,code) \
+ FloError(flo,(xieTypPhototag)tag,(CARD16)(long)type,(CARD8)code)
+
+#define FloAccessError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloAccess); xfer;}
+#define FloAllocError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloAlloc); xfer;}
+#define FloElementError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloElement); xfer;}
+#define FloImplementationError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloImplementation); xfer;}
+#define FloLengthError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloLength); xfer;}
+#define FloSourceError(flo,tag,type,xfer) \
+ {xieFloError(flo,tag,type,xieErrNoFloSource); xfer;}
+
+/*
+ * convenience macros for element-specific flo errors
+ */
+#define AccessError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloAccess); xfer;}
+#define AllocError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloAlloc); xfer;}
+#define ColorListError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloColorList,id); xfer;}
+#define ColormapError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloColormap,id); xfer;}
+#define DomainError(flo,ped,dom,xfer) \
+ {ErrDomain(flo,ped,dom); xfer;}
+#define DrawableError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloDrawable,id); xfer;}
+#define ElementError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloElement); xfer;}
+#define GCError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloGC,id); xfer;}
+#define ImplementationError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloImplementation); xfer;}
+#define LUTError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloLUT,id); xfer;}
+#define MatchError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloMatch); xfer;}
+#define OperatorError(flo,ped,op,xfer) \
+ {ErrOperator(flo,ped,(CARD8)op); xfer;}
+#define PhotomapError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloPhotomap,id); xfer;}
+#define ROIError(flo,ped,id,xfer) \
+ {ErrResource(flo,ped,(CARD8)xieErrNoFloROI,id); xfer;}
+#define SourceError(flo,ped,xfer) \
+ {ErrGeneric(flo,ped,(CARD8)xieErrNoFloSource); xfer;}
+#define TechniqueError(flo,ped,group,tech,len,xfer) \
+ {ErrTechnique(flo,ped,(CARD8)group,(CARD16)tech,(CARD16)len); \
+ xfer;}
+#define ValueError(flo,ped,value,xfer) \
+ {ErrValue(flo,ped,value); xfer;}
+
+#endif /* end _XIEH_ERROR */
diff --git a/xc/programs/Xserver/XIE/include/flo.h b/xc/programs/Xserver/XIE/include/flo.h
new file mode 100644
index 000000000..08e73bb97
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/flo.h
@@ -0,0 +1,115 @@
+/* $TOG: flo.h /main/5 1998/02/10 10:27:46 kaleb $ */
+/**** module flo.h ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ flo.h -- high level photoflo-specific definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/flo.h,v 1.3 1998/10/25 12:47:54 dawes Exp $ */
+
+#ifndef _XIEH_FLO
+#define _XIEH_FLO
+
+#include <XIEprotost.h>
+
+/* various structure pointers
+ */
+typedef struct _flotex *ddFloTexPtr;
+typedef struct _petex *ddPETexPtr;
+typedef struct _schedvec *ddSchedVecPtr;
+typedef struct _stripvec *ddStripVecPtr;
+
+typedef struct _photospace *photospacePtr;
+typedef struct _techvec *techVecPtr;
+
+/* various function type pointers
+ */
+typedef Bool (*xieBoolProc)();
+typedef CARD8 * (*xieDataProc)();
+typedef int (*xieIntProc)();
+typedef void (*xieVoidProc)();
+
+
+#ifndef _XIEC_FLO
+extern struct _flodef *MakeFlo(ClientPtr client, CARD16 peCnt, xieFlo *peLst);
+extern Bool EditFlo(struct _flodef * flo, xieTypPhototag start, xieTypPhototag end, xieFlo *peLst);
+extern void PrepFlo(struct _flodef * flo);
+extern struct _flodef *FreeFlo(struct _flodef * flo);
+extern struct _pedef *MakePEDef(CARD32 inFloCnt, CARD32 rawLen, CARD32 pvtLen);
+extern struct _pedef *FreePEDef(struct _pedef * ped);
+extern void SendClientData(
+ struct _flodef * flo,
+ struct _pedef * ped,
+ CARD8 *data,
+ CARD32 bytes,
+ CARD8 swapUnits,
+ CARD8 state);
+extern Bool UpdateFormatfromLevels(struct _pedef * ped);
+#endif
+
+#ifndef _XIEC_EVENT
+extern void SendFloEvent();
+#endif
+
+#endif /* end _XIEH_FLO */
diff --git a/xc/programs/Xserver/XIE/include/flodata.h b/xc/programs/Xserver/XIE/include/flodata.h
new file mode 100644
index 000000000..108790888
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/flodata.h
@@ -0,0 +1,165 @@
+/* $TOG: flodata.h /main/5 1998/02/10 10:27:37 kaleb $ */
+/**** module flodata.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ flodata.h - data formats
+
+ Dean Verheiden, Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+
+#ifndef _XIE_FLODATA
+#define _XIE_FLODATA
+
+#include <flo.h>
+
+/*
+ * Supported data format classes
+ */
+#define BIT_PIXEL 1 /* bitonal data */
+#define BYTE_PIXEL 2 /* up to 2^8 levels */
+#define PAIR_PIXEL 3 /* up to 2^16 levels */
+#define QUAD_PIXEL 4 /* up to 2^32 levels */
+#define UNCONSTRAINED 16 /* levels are undefined */
+#define LUT_ARRAY 32 /* non-canonic lut array */
+#define RUN_LENGTH 64 /* non-canonic run_length */
+#define STREAM 128 /* non-canonic generic stream */
+
+#define IsntLut(dfc) (dfc != LUT_ARRAY)
+#define IsntDomain(dfc) (dfc & ~(RUN_LENGTH | BIT_PIXEL))
+#define IsntCanonic(dfc) (dfc & (RUN_LENGTH | STREAM | LUT_ARRAY))
+#define IsntConstrained(dfc) \
+ (dfc & (UNCONSTRAINED | RUN_LENGTH | STREAM | LUT_ARRAY))
+
+#define IsLut(dfc) (dfc == LUT_ARRAY)
+#define IsDomain(dfc) (!IsntDomain(dfc))
+#define IsCanonic(dfc) (!IsntCanonic(dfc))
+#define IsConstrained(dfc) (!IsntConstrained(dfc))
+
+#define IndexClass(dfc) (dfc == UNCONSTRAINED ? 0 : dfc )
+
+#define ConstrainConst(fconst,levels) \
+ ( (fconst <= 0.) ? (CARD32) 0 : \
+ (fconst >= levels) ? (CARD32) (levels - 1) : \
+ (CARD32) (fconst + 0.5))
+
+/*
+ * Data types and sizes for supported format classes
+ */
+typedef CARD8 BitPixel;
+typedef CARD8 BytePixel;
+typedef CARD16 PairPixel;
+typedef CARD32 QuadPixel;
+typedef float RealPixel; /* type of Unconstrained data */
+
+#define sz_BitPixel 1
+#define sz_BytePixel 8
+#define sz_PairPixel 16
+#define sz_QuadPixel 32
+#define sz_RealPixel 32 /* size of Unconstrained data */
+
+typedef struct _format {
+ CARD8 class; /* format class {e.g. BIT_PIXEL, STREAM, ...} */
+ CARD8 band; /* band number {0,1,2} */
+ BOOL interleaved; /* true if pixels contain multiple bands */
+ CARD8 depth; /* minimum bits needed to contain levels */
+ CARD32 width; /* width in pixels */
+ CARD32 height; /* height in pixels */
+ CARD32 levels; /* quantization levels */
+ CARD32 stride; /* distance between adjacent pixels in bits */
+ CARD32 pitch; /* distance between adjacent scanlines in bits */
+} formatRec, *formatPtr;
+
+
+typedef struct _strip {
+ struct _strip *flink; /* link to next strip */
+ struct _strip *blink; /* link to previous strip */
+ struct _strip *parent;/* link to strip from which this one was cloned */
+ formatRec *format; /* pointer to format record that describes data */
+ CARD32 refCnt; /* reference count */
+ BOOL Xowner; /* if true, core X "owns" the data buffer */
+ BOOL canonic; /* if true, units are scanlines, otherwise bytes */
+ BOOL final; /* if true, this is the last strip for this band */
+ BOOL cache; /* if true, buffer can be cached (standard size) */
+ CARD32 start; /* first line/byte of overall data in this strip */
+ CARD32 end; /* last line/byte of overall data in this strip */
+ CARD32 length; /* lines/bytes of useable data in buffer */
+ CARD32 bitOff; /* bit offset to first data (usually zero) */
+ CARD32 bufSiz; /* size of the data buffer in bytes */
+ CARD8 *data; /* pointer to the data buffer */
+} stripRec, *stripPtr;
+
+/* generic header for managing circular doubly linked lists
+ */
+typedef struct _lst {
+ struct _lst *flink;
+ struct _lst *blink;
+} lstRec, *lstPtr;
+
+/* link-pair for managing a circular doubly linked list of strips
+ */
+typedef struct _striplst {
+ stripRec *flink;
+ stripRec *blink;
+} stripLstRec, *stripLstPtr;
+
+#endif /* end _XIE_FLODATA */
diff --git a/xc/programs/Xserver/XIE/include/flostr.h b/xc/programs/Xserver/XIE/include/flostr.h
new file mode 100644
index 000000000..80670d554
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/flostr.h
@@ -0,0 +1,220 @@
+/* $TOG: flostr.h /main/7 1998/02/10 10:27:41 kaleb $ */
+/**** module flostr.h ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ flostr.h -- DIXIE photoflo and element structure definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_FLOSTR
+#define _XIEH_FLOSTR
+
+#include <flodata.h>
+
+typedef CARD8 bandMsk; /* per-band bit mask (bit0 == band0,...)*/
+
+/* dixie photo element entry points
+ */
+typedef struct _dielemvec {
+ xieBoolProc prep; /* prepare for analysis and execution */
+ xieBoolProc debrief; /* post execution clean-up */
+} diElemVecRec, *diElemVecPtr;
+
+/* ddxie photo-element interface
+ */
+typedef struct _ddelemvec {
+ xieIntProc create;
+ xieIntProc initialize;
+ xieIntProc activate;
+ xieIntProc flush;
+ xieIntProc reset;
+ xieIntProc destroy;
+} ddElemVecRec, *ddElemVecPtr;
+
+/* ddxie photoflo manager entry points
+ */
+typedef struct _flovec {
+ xieIntProc link;
+ xieIntProc startup;
+ xieIntProc resume;
+ xieIntProc shutdown;
+ xieIntProc destroy;
+} floVecRec, *floVecPtr;
+
+/* ddxie client data manager entry points
+ */
+typedef struct _datavec {
+ xieIntProc input;
+ xieIntProc output;
+ xieIntProc query;
+} dataVecRec, *dataVecPtr;
+
+/* photo-element inFlo definition
+ */
+typedef struct _inflo {
+ CARD8 bands; /* number of bands this input will receive */
+ CARD8 index; /* inFlo index of this input */
+ xieTypPhototag srcTag; /* phototag of source element */
+ struct _pedef *srcDef; /* pointer to source element definition */
+ struct _pedef *ownDef; /* pointer to this element's definition */
+ struct _inflo *outChain; /* chain of inFlos sharing the same output */
+ formatRec format[xieValMaxBands]; /* data format per input band */
+} inFloRec, *inFloPtr;
+
+/* photo-element outFlo definition
+ */
+typedef struct _outflo {
+ inFloPtr outChain; /* chain of inFlos receiving output */
+ bandMsk active; /* bands that will supply client data */
+ bandMsk ready; /* bands that are holding client data */
+ CARD8 bands; /* number of output bands */
+ CARD8 pad;
+ stripLstRec output[xieValMaxBands];/* holding place for element's output */
+ formatRec format[xieValMaxBands];/* data format per output band */
+} outFloRec, *outFloPtr;
+
+/* photo-element definition structure
+ */
+typedef struct _pedef {
+ struct _pedef *flink; /* foreword link in DAG-ordered peDef list */
+ struct _pedef *blink; /* backword link in DAG-ordered peDef list */
+ struct _pedef *clink; /* next element of the same class */
+ struct _pedef *olink; /* link to optimized element */
+ xieFlo *elemRaw; /* raw (swapped) client element */
+ pointer elemPvt; /* dixie element-private info */
+ pointer techPvt; /* dixie technique-private info */
+ techVecPtr techVec; /* technique vectors */
+ ddPETexPtr peTex; /* DDXIE execution context */
+ inFloPtr inFloLst; /* pointer to in-line array of input info */
+ CARD16 inCnt; /* number of inputs (inc. LUT & domain) */
+ xieTypPhototag phototag; /* phototag of this element */
+ struct {
+ unsigned int import : 1; /* element performs import functions */
+ unsigned int process : 1; /* element performs processing */
+ unsigned int export : 1; /* element performs export functions */
+ unsigned int getData : 1; /* element allows GetClientData */
+ unsigned int putData : 1; /* element allows PutClientData */
+ unsigned int modified : 1; /* modified attributes or parameters */
+ unsigned int loop : 1; /* loop-detection flag */
+ unsigned int reserved : 1;
+ } flags;
+ CARD8 swapUnits[xieValMaxBands]; /* size of client data aggregates */
+ diElemVecPtr diVec; /* DIXIE entry point vector */
+ ddElemVecRec ddVec; /* DDXIE entry point vector (in-line) */
+ outFloRec outFlo; /* output attribute/connection info */
+#if 0
+ inFloRec inFlo[inCnt]; /* array of in-line input connection info */
+#endif
+} peDefRec, *peDefPtr;
+
+/* link-pair for managing a circular doubly linked list of peDefs
+ */
+typedef struct _pedlst {
+ peDefPtr flink;
+ peDefPtr blink;
+} pedLstRec, *pedLstPtr;
+
+/* photoflo definition structure
+ */
+typedef struct _flodef {
+ struct _flodef *flink; /* foreword link in nameSpace (immed only) */
+ struct _flodef *blink; /* backword link in nameSpace (immed only) */
+ ClientPtr runClient; /* client that is running the flo */
+ ClientPtr reqClient; /* client that is making current request */
+ ClientPtr *awakenPtr; /* list of clients Awaiting flo done */
+ CARD32 awakenCnt; /* number of clients Awaiting flo done */
+ CARD32 ID; /* instance-id within nameSpace */
+ CARD32 spaceID; /* photospace-id or 0 (serverIDspace) */
+ photospacePtr space; /* photospacePtr or NULL */
+ ddFloTexPtr floTex; /* DDXIE execution context info */
+ floVecPtr floVec; /* DDXIE photoflo management entry points */
+ dataVecPtr dataVec; /* DDXIE client data manager entry points */
+ ddSchedVecPtr schedVec; /* DDXIE scheduler entry points */
+ ddStripVecPtr stripVec; /* DDXIE strip manager entry points */
+ pedLstRec defDAG; /* DAG peList (flink=import, blink=export) */
+ pedLstRec optDAG; /* optimized DAG peList */
+ peDefPtr *peArray; /* pointer to in-line peDef pointer array */
+ CARD16 peCnt; /* number of elements in peArray */
+ struct {
+ unsigned int active : 1; /* execute requested (else inactive) */
+ unsigned int modified : 1; /* something changed since last execution */
+ unsigned int notify : 1; /* send an event upon flo completion */
+ unsigned int aborted : 1; /* the client aborted execution */
+ unsigned int reserved : 12;
+ } flags;
+ xieFloEvn event; /* generic event packet */
+ xieFloErr error; /* generic error packet */
+#if 0
+ peDefPtr peArray[peCnt];/* array of peDef pointers */
+#endif
+} floDefRec, *floDefPtr;
+
+/* link-pair for managing a circular doubly linked list of floDefs
+ */
+typedef struct _flolst {
+ floDefPtr flink;
+ floDefPtr blink;
+} floLstRec, *floLstPtr;
+
+#endif /* end _XIEH_FLOSTR */
diff --git a/xc/programs/Xserver/XIE/include/lut.h b/xc/programs/Xserver/XIE/include/lut.h
new file mode 100644
index 000000000..482ab5cd4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/lut.h
@@ -0,0 +1,105 @@
+/* $TOG: lut.h /main/5 1998/02/10 10:27:50 kaleb $ */
+/**** module lut.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ lut.h: contains lut specific definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_LUT
+#define _XIEH_LUT
+
+#include <flodata.h>
+
+/*
+ * LUT resource definition
+ */
+
+typedef struct _lutformat {
+ xieTypOrientation bandOrder; /* Lut order */
+ CARD8 pad[3];
+ CARD32 length; /* Input quantization levels */
+ CARD32 level; /* Output quantization levels */
+} lutFormatRec, *lutFormatPtr;
+
+typedef struct _lut {
+ xieTypLUT ID;
+ CARD16 refCnt;
+ CARD8 lutCnt;
+ lutFormatRec format[xieValMaxBands];
+ stripLstRec strips[xieValMaxBands]; /* lists of image strips */
+} lutRec, *lutPtr;
+
+/*
+ * Macros for working with Luts
+ * LutPitch(levels) - returns size of single lut array entry in bytes.
+ */
+
+#define LutPitch(Levels) \
+ (((Levels) == 0) ? 4 : \
+ (((Levels) > (1<<16)) ? 4 : \
+ (((Levels) > (1<<8)) ? 2 : 1)))
+
+#endif
+/* end _XIEH_LUT */
diff --git a/xc/programs/Xserver/XIE/include/macro.h b/xc/programs/Xserver/XIE/include/macro.h
new file mode 100644
index 000000000..89ba80d07
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/macro.h
@@ -0,0 +1,215 @@
+/* $TOG: macro.h /main/8 1998/02/10 10:27:54 kaleb $ */
+/**** module macro.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ macro.h -- XIE utility macros
+
+ Robert NC Shelley -- AGE Logic, Inc. March 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/macro.h,v 1.8 1998/10/25 07:11:46 dawes Exp $ */
+
+#ifndef _XIEH_MACRO
+#define _XIEH_MACRO
+
+#include <error.h>
+
+/* DDXIE photoflo management interface
+ */
+#define ddShutdown(flo) (flo->floVec ? (*flo->floVec->shutdown)(flo) : 0)
+#define ddDestroy(flo) (flo->floVec ? (*flo->floVec->destroy) (flo) : 0)
+#define ddLink(flo) (*flo->floVec->link)(flo)
+#define ddResume(flo) (*flo->floVec->resume)(flo)
+#define ddStartup(flo) (*flo->floVec->startup)(flo)
+
+/* DDXIE client data management interface
+ */
+#define ddInput(flo,ped,band,data,bytes,final) \
+ (*flo->dataVec->input)(flo,ped,band,data,bytes,final)
+#define ddOutput(flo,ped,band,maxLen,term) \
+ (*flo->dataVec->output)(flo,ped,band,maxLen,term)
+#define ddQuery(flo,lst,im,ex) (*flo->dataVec->query)(flo,lst,im,ex)
+
+/* List management macros
+ */
+#define ListInit(head) \
+ (((lstPtr)(head))->flink = (lstPtr)(head), \
+ ((lstPtr)(head))->blink = (lstPtr)(head))
+
+#define ListEnd(current,head) ((lstPtr)(current) == (lstPtr)(head))
+
+#define ListEmpty(head) (((lstPtr)(head))->flink == (lstPtr)(head))
+
+#define InsertMember(new,prev) \
+ {lstPtr ptr = (lstPtr)(prev); \
+ ((lstPtr)(new))->flink = ptr->flink; \
+ ((lstPtr)(new))->blink = ptr; ptr->flink = (lstPtr)(new); \
+ ((lstPtr)(new))->flink->blink = (lstPtr)(new);}
+
+#define RemoveMember(ptr,old) \
+ (ptr=old, \
+ ((lstPtr)(ptr))->blink->flink = ((lstPtr)(ptr))->flink, \
+ ((lstPtr)(ptr))->flink->blink = ((lstPtr)(ptr))->blink)
+
+
+/* return amount that should be added to 'len' to make it modulo 'pad'
+ */
+#define Align(len,pad) (((pad)-(len)%(pad))%(pad))
+
+
+/* swap a pair of pointers
+ */
+#define SwapPtr(p1,p2,pt) \
+ (*((pointer *)&(pt)) = (pointer )(p1), \
+ *((pointer *)&(p1)) = (pointer )(p2), \
+ *((pointer *)&(p2)) = (pointer )(pt))
+
+
+/* compute the minimum number of bits ('depth') required to represent 'levels'
+ */
+#define SetDepthFromLevels(levels,depth) \
+ if(levels > 2) { CARD32 _i = levels; \
+ for(depth = 0; (_i >>= 1); ++depth); \
+ if(((1 << depth) - 1) & levels) ++depth; } \
+ else depth = levels ? 1 : 32
+
+/* event convenience macros
+ */
+#define SendElementEvent(flo,ped,code) \
+ (flo->event.src = ped->phototag, \
+ flo->event.type = ped->elemRaw->elemType, \
+ flo->event.event = code, \
+ SendFloEvent(flo))
+#define SendColorAllocEvent(flo,ped,clst,tn,td) \
+ {((xieColorAllocEvn *)&flo->event)->colorList = clst; \
+ ((xieColorAllocEvn *)&flo->event)->colorAllocTechnique = tn; \
+ ((xieColorAllocEvn *)&flo->event)->data = td; \
+ SendElementEvent(flo,ped,xieEvnNoColorAlloc);}
+#define SendDecodeNotifyEvent(flo,ped,b,tn,dw,dh,abt) \
+ {((xieDecodeNotifyEvn *)&flo->event)->bandNumber = b; \
+ ((xieDecodeNotifyEvn *)&flo->event)->decodeTechnique = tn; \
+ ((xieDecodeNotifyEvn *)&flo->event)->width = dw; \
+ ((xieDecodeNotifyEvn *)&flo->event)->height = dh; \
+ ((xieDecodeNotifyEvn *)&flo->event)->aborted = abt; \
+ SendElementEvent(flo,ped,xieEvnNoDecodeNotify);}
+#define SendExportAvailableEvent(flo,ped,b,d0,d1,d2) \
+ {((xieExportAvailableEvn *)&flo->event)->bandNumber = b; \
+ ((xieExportAvailableEvn *)&flo->event)->data0 = d0; \
+ ((xieExportAvailableEvn *)&flo->event)->data1 = d1; \
+ ((xieExportAvailableEvn *)&flo->event)->data2 = d2; \
+ SendElementEvent(flo,ped,xieEvnNoExportAvailable);}
+#define SendImportObscuredEvent(flo,ped,win,ex,ey,ew,eh) \
+ {((xieImportObscuredEvn *)&flo->event)->window = win; \
+ ((xieImportObscuredEvn *)&flo->event)->x = ex; \
+ ((xieImportObscuredEvn *)&flo->event)->y = ey; \
+ ((xieImportObscuredEvn *)&flo->event)->width = ew; \
+ ((xieImportObscuredEvn *)&flo->event)->height = eh; \
+ SendElementEvent(flo,ped,xieEvnNoImportObscured);}
+
+
+#define ExecProc(client,opcode) \
+ ((client_table[client->index].proc_table[opcode])(client))
+#define ExecSProc(client,opcode) \
+ ((client_table[client->index].sproc_table[opcode])(client))
+
+#define CallProc(client) (ExecProc(client,stuff->opcode))
+#define CallSProc(client) (ExecSProc(client,stuff->opcode))
+
+#define MakeElement(flo,tag,pe) \
+ ((MakeTable[pe->elemType])(flo,tag,pe))
+
+#define ELEMENT(type) \
+ register type *raw, *stuff = (type *)pe
+
+#define ELEMENT_SIZE_MATCH(type) \
+ if(stuff->elemLength != sizeof(type)>>2) \
+ FloLengthError(flo,tag,stuff->elemType, return(NULL))
+
+#define ELEMENT_AT_LEAST_SIZE(type) \
+ if(stuff->elemLength < sizeof(type)>>2) \
+ FloLengthError(flo,tag,stuff->elemType, return(NULL))
+
+#define ELEMENT_NEEDS_1_INPUT(input) \
+ if(!(stuff->input)) \
+ FloSourceError(flo,tag,stuff->elemType, return(NULL))
+
+#define ELEMENT_NEEDS_2_INPUTS(input1,input2) \
+ if(!(stuff->input1) || !(stuff->input2)) \
+ FloSourceError(flo,tag,stuff->elemType, return(NULL))
+
+
+#define ELEMENT_NEEDS_3_INPUTS(input1,input2,input3) \
+ if(!(stuff->input1) || !(stuff->input2) || !(stuff->input3)) \
+ FloSourceError(flo,tag,stuff->elemType, return(NULL))
+
+/*
+ * if XIE is built as a module, it shouldn't call libc functions.
+ * The following macros should wrap all calls in XIE
+ */
+#ifndef XFree86LOADER
+#include <stdio.h>
+#include <math.h>
+#else
+#include "xf86_ansic.h"
+#endif
+
+#endif /* end _XIEH_MACRO */
diff --git a/xc/programs/Xserver/XIE/include/memory.h b/xc/programs/Xserver/XIE/include/memory.h
new file mode 100644
index 000000000..ee7544f8b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/memory.h
@@ -0,0 +1,82 @@
+/* $TOG: memory.h /main/6 1998/02/10 10:27:59 kaleb $ */
+/**** module memory.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ memory.h - XIE memory management definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/memory.h,v 1.3 1998/10/25 12:47:54 dawes Exp $ */
+
+#ifndef _XIEH_MEMORY
+#define _XIEH_MEMORY
+
+#include "misc.h" /* for pointer */
+
+extern pointer XieMalloc(unsigned size);
+extern pointer XieCalloc(unsigned size);
+extern pointer XieRealloc(pointer ptr, unsigned size);
+extern pointer XieFree(pointer ptr);
+
+#endif
+/* end _XIEH_MEMORY */
diff --git a/xc/programs/Xserver/XIE/include/photomap.h b/xc/programs/Xserver/XIE/include/photomap.h
new file mode 100644
index 000000000..ec3012913
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/photomap.h
@@ -0,0 +1,100 @@
+/* $TOG: photomap.h /main/6 1998/02/10 10:28:03 kaleb $ */
+/**** module photomap.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ photomap.h -- contains photomap definitions
+
+ Dean Verheiden, Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_PHOTOMAP
+#define _XIEH_PHOTOMAP
+
+#include <flodata.h>
+
+/*
+ * Definitions
+ */
+typedef struct _photomap *photomapPtr;
+
+typedef struct _photomap {
+ xieTypPhotomap ID;
+ CARD16 refCnt;
+ CARD16 technique; /* decode technique needed to decompress*/
+ CARD16 lenParms; /* length of technique params (in bytes)*/
+ CARD16 pad0;
+ pointer tecParms; /* technique-specific decode parameters */
+ pointer pvtParms; /* additional decode hints */
+ xieTypDataClass dataClass; /* {SingleBand,TripleBand} */
+ CARD8 bands; /* number of bands {0=unpopulated,1,3} */
+ /* Tripleband, interleaved has bands=1, */
+ /* so this parameter is *not* redundant */
+ xieTypDataType dataType; /* {Constrained,Unconstrined} */
+ CARD8 pad1;
+ formatRec format[xieValMaxBands]; /* format of data in strips */
+ stripLstRec strips[xieValMaxBands]; /* lists of image strips */
+} photomapRec;
+
+
+#endif
+/* end _XIEH_PHOTOMAP */
diff --git a/xc/programs/Xserver/XIE/include/photospc.h b/xc/programs/Xserver/XIE/include/photospc.h
new file mode 100644
index 000000000..156039f53
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/photospc.h
@@ -0,0 +1,82 @@
+/* $TOG: photospc.h /main/5 1998/02/10 10:28:07 kaleb $ */
+/**** module photospc.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ photospc.h: photospace definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_PHOTOSPC
+#define _XIEH_PHOTOSPC
+
+/*
+ * photospace definition
+ */
+typedef struct _photospace {
+ xieTypPhotospace spaceID;
+ CARD32 floCnt;
+ floLstRec floLst;
+} photospaceRec;
+
+#endif /* end _XIEH_PHOTOSPC */
diff --git a/xc/programs/Xserver/XIE/include/protoflo.h b/xc/programs/Xserver/XIE/include/protoflo.h
new file mode 100644
index 000000000..4559fc3cd
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/protoflo.h
@@ -0,0 +1,90 @@
+/*
+ * $XFree86: xc/programs/Xserver/XIE/include/protoflo.h,v 1.1 1998/10/25 07:11:47 dawes Exp $
+ */
+
+/************************************************************
+
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * dixie/request/protoflo.c
+ */
+
+#ifndef _XIE_PROTOFLO_H_
+#define _XIE_PROTOFLO_H_ 1
+
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <dixstruct.h>
+#include <flostr.h>
+#include <photospc.h>
+
+/*
+ * Xie protocol procedures called from the dispatcher
+ */
+extern int ProcAbort (ClientPtr client);
+extern int ProcAwait (ClientPtr client);
+extern int ProcCreatePhotoflo (ClientPtr client);
+extern int ProcCreatePhotospace (ClientPtr client);
+extern int ProcDestroyPhotoflo (ClientPtr client);
+extern int ProcDestroyPhotospace (ClientPtr client);
+extern int ProcExecuteImmediate (ClientPtr client);
+extern int ProcExecutePhotoflo (ClientPtr client);
+extern int ProcGetClientData (ClientPtr client);
+extern int ProcModifyPhotoflo (ClientPtr client);
+extern int ProcPutClientData (ClientPtr client);
+extern int ProcQueryPhotoflo (ClientPtr client);
+extern int ProcRedefinePhotoflo (ClientPtr client);
+extern int SProcAbort (ClientPtr client);
+extern int SProcAwait (ClientPtr client);
+extern int SProcCreatePhotoflo (ClientPtr client);
+extern int SProcCreatePhotospace (ClientPtr client);
+extern int SProcDestroyPhotoflo (ClientPtr client);
+extern int SProcDestroyPhotospace (ClientPtr client);
+extern int SProcExecuteImmediate (ClientPtr client);
+extern int SProcExecutePhotoflo (ClientPtr client);
+extern int SProcGetClientData (ClientPtr client);
+extern int SProcModifyPhotoflo (ClientPtr client);
+extern int SProcPutClientData (ClientPtr client);
+extern int SProcQueryPhotoflo (ClientPtr client);
+extern int SProcRedefinePhotoflo (ClientPtr client);
+
+/*
+ * routines referenced by other modules
+ */
+extern int DeletePhotoflo (floDefPtr flo, xieTypPhotoflo id);
+extern int DeletePhotospace (photospacePtr space, xieTypPhotospace id);
+
+#endif /* _XIE_PROTOFLO_H_ */
diff --git a/xc/programs/Xserver/XIE/include/roi.h b/xc/programs/Xserver/XIE/include/roi.h
new file mode 100644
index 000000000..2c8a099ec
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/roi.h
@@ -0,0 +1,84 @@
+/* $TOG: roi.h /main/5 1998/02/10 10:28:11 kaleb $ */
+/**** module roi.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ roi.h: contains region of interest specific definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_ROI
+#define _XIEH_ROI
+
+#include <flodata.h>
+
+/*
+ * ROI resource definitions
+ */
+typedef struct _roi {
+ xieTypROI ID;
+ CARD32 refCnt;
+ stripLstRec strips; /* run-length encoded list of rectangles */
+} roiRec, *roiPtr;
+
+#endif /* end _XIEH_ROI */
diff --git a/xc/programs/Xserver/XIE/include/tables.h b/xc/programs/Xserver/XIE/include/tables.h
new file mode 100644
index 000000000..af5843b88
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/tables.h
@@ -0,0 +1,135 @@
+/* $TOG: tables.h /main/5 1998/02/10 10:28:15 kaleb $ */
+/**** module tables.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ tables.h: entry points etc.
+
+ Dean Verheiden, Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/tables.h,v 1.3 1998/10/25 12:47:54 dawes Exp $ */
+
+#ifndef _XIEH_TABLES
+#define _XIEH_TABLES
+
+#include <flostr.h>
+#include <protoflo.h>
+
+#define DDAnalyzeIndex 0
+#define DDServerChoiceIndex 1
+
+#ifndef _XIEC_TABLES
+
+extern peDefPtr (*MakeTable[])();
+extern xieVoidProc DDInterface[];
+
+#endif /* _XIEC_TABLES */
+
+ /* dd entry points for di */
+
+extern int DAGalyze(floDefPtr);
+extern xieBoolProc GetServerChoice(floDefPtr, peDefPtr); /* FIXME: mixie */
+
+ /* lut.c */
+extern int ProcCreateLUT(ClientPtr);
+extern int ProcDestroyLUT(ClientPtr);
+extern int SProcCreateLUT(ClientPtr);
+extern int SProcDestroyLUT(ClientPtr);
+ /* photomap.c */
+extern int ProcCreatePhotomap(ClientPtr);
+extern int ProcDestroyPhotomap(ClientPtr);
+extern int ProcQueryPhotomap(ClientPtr);
+extern int SProcCreatePhotomap(ClientPtr);
+extern int SProcDestroyPhotomap(ClientPtr);
+extern int SProcQueryPhotomap(ClientPtr);
+ /* technq.c */
+extern int ProcQueryTechniques(ClientPtr);
+extern int SProcQueryTechniques(ClientPtr);
+
+#if XIE_FULL
+ /* colorlst.c */
+extern int ProcCreateColorList(ClientPtr);
+extern int ProcDestroyColorList(ClientPtr);
+extern int ProcPurgeColorList(ClientPtr);
+extern int ProcQueryColorList(ClientPtr);
+extern int SProcCreateColorList(ClientPtr);
+extern int SProcDestroyColorList(ClientPtr);
+extern int SProcPurgeColorList(ClientPtr);
+extern int SProcQueryColorList(ClientPtr);
+ /* roi.c */
+extern int ProcCreateROI(ClientPtr);
+extern int ProcDestroyROI(ClientPtr);
+extern int SProcCreateROI(ClientPtr);
+extern int SProcDestroyROI(ClientPtr);
+#endif
+
+/* elements */
+#include <dixie_i.h>
+#include <dixie_e.h>
+#include <dixie_p.h>
+
+extern void init_proc_tables(
+ CARD16 minorVersion,
+ int (**ptable[])(ClientPtr),
+ int (**sptable[])(ClientPtr));
+
+#endif /* _XIEH_TABLES */
diff --git a/xc/programs/Xserver/XIE/include/technq.h b/xc/programs/Xserver/XIE/include/technq.h
new file mode 100644
index 000000000..6481d7398
--- /dev/null
+++ b/xc/programs/Xserver/XIE/include/technq.h
@@ -0,0 +1,1410 @@
+/* $TOG: technq.h /main/5 1998/02/10 10:28:19 kaleb $ */
+/**** module technq.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*******************************************************************************
+
+ technq.h: contains technique definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/include/technq.h,v 1.3 1998/10/25 12:47:55 dawes Exp $ */
+
+#ifndef _XIEH_TECHNQ
+#define _XIEH_TECHNQ
+
+#include <flostr.h>
+
+#define TECHNQ_COPY_ARGS \
+ floDefPtr flo, \
+ peDefPtr ped, \
+ pointer sParms, \
+ pointer rParms, \
+ CARD16 tsize, \
+ Bool isDefault
+
+#define TECHNQ_WADJ_ARGS \
+ floDefPtr flo, \
+ peDefPtr ped, \
+ pointer sparms, \
+ double *pvtf, \
+ techVecPtr tv, \
+ CARD16 tsize, \
+ Bool isDefault
+
+typedef Bool (*techCopyFunc)(TECHNQ_COPY_ARGS); /* the normal case */
+typedef Bool (*techWadjFunc)(TECHNQ_WADJ_ARGS); /* ...an exception */
+typedef Bool (*techGamuFunc)(CARD16); /* ...an exception */
+
+#define TECH_WADJ_FUNC(func) ((techWadjFunc)(func->copyfnc))
+#define TECH_GAMU_FUNC(func) ((techGamuFunc)(func->copyfnc))
+
+/*
+ * dixie import client photo technique entry points
+ */
+extern Bool CopyICPhotoUnSingle(TECHNQ_COPY_ARGS);
+extern Bool CopyICPhotoG31D(TECHNQ_COPY_ARGS);
+extern Bool CopyICPhotoG32D(TECHNQ_COPY_ARGS);
+extern Bool CopyICPhotoG42D(TECHNQ_COPY_ARGS);
+extern Bool CopyICPhotoTIFF2(TECHNQ_COPY_ARGS);
+extern Bool CopyICPhotoTIFFPackBits(TECHNQ_COPY_ARGS);
+extern Bool PrepICPhotoUnSingle(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeUncompressedSingle *tec);
+extern Bool PrepICPhotoG31D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG31D *tec);
+extern Bool PrepICPhotoG32D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG32D *tec);
+extern Bool PrepICPhotoG42D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeG42D *tec);
+extern Bool PrepICPhotoTIFF2(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeTIFF2 *tec);
+extern Bool PrepICPhotoTIFFPackBits(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeTIFFPackBits *tec);
+#if XIE_FULL
+extern Bool CopyICPhotoUnTriple(TECHNQ_COPY_ARGS);
+extern Bool PrepICPhotoUnTriple(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeUncompressedTriple *tec);
+extern Bool CopyICPhotoJPEGBaseline(TECHNQ_COPY_ARGS);
+extern Bool PrepICPhotoJPEGBaseline(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeJPEGBaseline *tec);
+#ifdef BEYOND_SI
+extern Bool CopyICPhotoJPEGLossless(TECHNQ_COPY_ARGS);
+extern Bool PrepICPhotoJPEGLossless(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloImportClientPhoto *raw,
+ xieTecDecodeJPEGLossless *tec);
+#endif /* BEYOND_SI */
+#endif
+
+/*
+ * dixie constrain technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyPConstrainStandard(TECHNQ_COPY_ARGS);
+extern Bool CopyPConstrainClipScale(TECHNQ_COPY_ARGS);
+extern Bool PrepPConstrainStandard(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer raw,
+ pointer tec);
+extern Bool PrepPConstrainClipScale(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecClipScale *raw,
+ xieTecClipScale *tec);
+#endif
+
+/*
+ * dixie convolve technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyConvolveConstant(TECHNQ_COPY_ARGS);
+extern Bool PrepConvolveStandard(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer raw,
+ pointer tec);
+#ifdef BEYOND_SI
+extern Bool CopyConvolveReplicate(TECHNQ_COPY_ARGS);
+#endif /* BEYOND_SI */
+#endif
+
+/*
+ * dixie dither technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyPDitherErrorDiffusion(TECHNQ_COPY_ARGS);
+extern Bool PrepPDitherErrorDiffusion(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloDither *raw,
+ pointer tec);
+extern Bool CopyPDitherOrdered(TECHNQ_COPY_ARGS);
+extern Bool PrepPDitherOrdered(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloDither *raw,
+ xieTecDitherOrdered *tec);
+#endif
+
+/*
+ * dixie geometry technique entry points
+ */
+extern Bool CopyGeomNearestNeighbor(TECHNQ_COPY_ARGS);
+extern Bool PrepGeomNearestNeighbor(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec);
+extern Bool CopyGeomAntiAlias(TECHNQ_COPY_ARGS);
+extern Bool PrepGeomAntiAlias(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec);
+#if XIE_FULL
+extern Bool CopyGeomBilinearInterp(TECHNQ_COPY_ARGS);
+extern Bool PrepGeomBilinearInterp(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec);
+extern Bool CopyGeomGaussian(TECHNQ_COPY_ARGS);
+extern Bool PrepGeomGaussian(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloGeometry *raw,
+ pointer tec);
+#endif
+
+/*
+ * dixie match histogram technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyPHistogramFlat(TECHNQ_COPY_ARGS);
+extern Bool CopyPHistogramGaussian(TECHNQ_COPY_ARGS);
+extern Bool CopyPHistogramHyperbolic(TECHNQ_COPY_ARGS);
+extern Bool PrepPHistogramFlat(floDefPtr flo, peDefPtr ped);
+extern Bool PrepPHistogramGaussian(floDefPtr flo, peDefPtr ped);
+extern Bool PrepPHistogramHyperbolic(floDefPtr flo, peDefPtr ped);
+#endif
+
+/*
+ * dixie convert to index technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyCtoIAllocAll(TECHNQ_COPY_ARGS);
+extern Bool PrepCtoIAllocAll(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToIndex *raw,
+ xieTecColorAllocAll *tec);
+#ifdef BEYOND_SI
+extern Bool CopyCtoIAllocMatch(TECHNQ_COPY_ARGS);
+extern Bool CopyCtoIAllocRequantize(TECHNQ_COPY_ARGS);
+#endif /* BEYOND_SI */
+#endif
+
+/*
+ * dixie export client photo technique entry points
+ */
+extern Bool CopyECPhotoUnSingle(TECHNQ_COPY_ARGS);
+extern Bool CopyECPhotoG31D(TECHNQ_COPY_ARGS);
+extern Bool CopyECPhotoG32D(TECHNQ_COPY_ARGS);
+extern Bool CopyECPhotoG42D(TECHNQ_COPY_ARGS);
+extern Bool CopyECPhotoTIFF2(TECHNQ_COPY_ARGS);
+extern Bool CopyECPhotoTIFFPackBits(TECHNQ_COPY_ARGS);
+
+extern Bool PrepECPhotoUnSingle(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeUncompressedSingle *tec);
+extern Bool PrepECPhotoG31D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG31D *tec);
+extern Bool PrepECPhotoG32D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG32D *tec);
+extern Bool PrepECPhotoG42D(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeG42D *tec);
+extern Bool PrepECPhotoTIFF2(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeTIFF2 *tec);
+extern Bool PrepECPhotoTIFFPackBits(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeTIFFPackBits *tec);
+#if XIE_FULL
+extern Bool CopyECPhotoUnTriple(TECHNQ_COPY_ARGS);
+extern Bool PrepECPhotoUnTriple(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeUncompressedTriple *tec);
+extern Bool CopyECPhotoJPEGBaseline(TECHNQ_COPY_ARGS);
+extern Bool PrepECPhotoJPEGBaseline(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGBaseline *tec);
+#ifdef BEYOND_SI
+extern Bool CopyECPhotoJPEGLossless(TECHNQ_COPY_ARGS);
+extern Bool PrepECPhotoJPEGLossless(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGLossless *tec);
+#endif /* BEYOND_SI */
+#endif
+
+/*
+ * dixie convert to and from RBG technique entry points
+ */
+#if XIE_FULL
+extern Bool CopyPConvertFromRGBCIE(TECHNQ_COPY_ARGS);
+extern Bool CopyPConvertFromRGBYCC(TECHNQ_COPY_ARGS);
+extern Bool CopyPConvertFromRGBYCbCr(TECHNQ_COPY_ARGS);
+extern Bool CopyPConvertToRGBCIE(TECHNQ_COPY_ARGS);
+extern Bool CopyPConvertToRGBYCC(TECHNQ_COPY_ARGS);
+extern Bool CopyPConvertToRGBYCbCr(TECHNQ_COPY_ARGS);
+extern Bool CopyPWhiteAdjustNone(
+ floDefPtr flo,
+ peDefPtr ped,
+ pointer sparms,
+ double *pvtf,
+ techVecPtr tv,
+ CARD16 tsize,
+ Bool isDefault);
+extern Bool CopyPWhiteAdjustCIELabShift(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecWhiteAdjustCIELabShift *sparms,
+ double *pvtf,
+ techVecPtr tv,
+ CARD16 tsize,
+ Bool isDefault);
+extern Bool CopyPGamut(CARD16 tsize);
+
+extern Bool PrepPConvertFromRGBCIE(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToCIELab *tec);
+extern Bool PrepPConvertFromRGBYCC(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToYCC *tec);
+extern Bool PrepPConvertFromRGBYCbCr(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertFromRGB *raw,
+ xieTecRGBToYCbCr *tec);
+extern Bool PrepPConvertToRGBCIE(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecCIELabToRGB *tec);
+extern Bool PrepPConvertToRGBYCC(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecYCCToRGB *tec);
+extern Bool PrepPConvertToRGBYCbCr(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieFloConvertToRGB *raw,
+ xieTecYCbCrToRGB *tec);
+extern Bool PrepPWhiteAdjustNone(
+ floDefPtr flo,
+ peDefPtr ped,
+ double *pwp);
+extern Bool PrepPWhiteAdjustCIELabShift(
+ floDefPtr flo,
+ peDefPtr ped,
+ double *pwp);
+extern Bool PrepPGamut(void);
+#endif
+
+/* Global definitions for referencing techniques */
+
+typedef struct _techvec {
+ BOOL NoTech; /* If true, this technique has no parameters */
+ BOOL OptionalTech; /* If true, parameters are optional */
+ BOOL FixedTech; /* If true, parameter size is fixed */
+ BOOL pad;
+ CARD16 techSize; /* size of parameters (possibly optional) */
+ CARD16 number;
+ techCopyFunc copyfnc; /* function to copy parameter from client */
+ xieBoolProc prepfnc; /* function to prepare for activation */
+} techVecRec;
+
+/*
+ Standard macro to verify correct technique parameter sizes . . .
+ Should work for any technique that has been properly defined
+*/
+
+
+#define VALIDATE_TECHNIQUE_SIZE(tv, size, isDefault) \
+ if ((isDefault && size) || ((!isDefault && \
+ (tv->FixedTech && \
+ ((!tv->OptionalTech && tv->techSize != size) || \
+ (tv->OptionalTech && size && tv->techSize != size)))) || \
+ (!tv->FixedTech && \
+ ((!tv->OptionalTech && tv->techSize > size) || \
+ (tv->OptionalTech && size && tv->techSize > size))))) \
+ return(FALSE);
+
+
+/*
+ * Technique resource definition
+ */
+
+typedef struct _technique {
+ CARD8 speed;
+ CARD8 nameLength;
+ CARD16 techSize;
+ CARD8 *name;
+ techVecRec techvec;
+} TechRec, *TechPtr;
+
+typedef struct _techgroup {
+ xieTypTechniqueGroup group;
+ CARD16 numTechniques;
+ CARD16 defaultNumber;
+ CARD16 defaultIndex;
+ CARD32 groupSize; /* Size in words */
+ TechPtr tech;
+} TechGroupRec, *TechGroupPtr;
+
+typedef struct _techtable {
+ CARD16 numGroups; /* Number of tech groups */
+ CARD16 numDefaults; /* Number of default groups */
+ CARD16 numTechniques; /* Total number of techniques */
+ CARD16 pad;
+ CARD32 tableSize; /* All tech size (in words) */
+ CARD32 defaultSize; /* Default size (in words) */
+ TechGroupPtr techgroups;
+} TechTable;
+
+#if defined(_XIEC_TECHNQ)
+
+#define DEFAULT_SPEED 128
+
+#define NO_DEFAULT 0
+#define UNINITIALIZED 0
+
+#define TECH_HAS_NO_PARMS TRUE
+#define TECH_HAS_PARMS FALSE
+#define TECH_PARMS_OPTIONAL TRUE
+#define TECH_PARMS_REQUIRED FALSE
+#define TECH_FIXED_SIZE TRUE
+#define TECH_VARIABLE_SIZE FALSE
+
+/*
+ * Initialize nameLength to 0 and compute at runtime. Some compilers do not
+ * support the use of sizeof(static string) at compile time
+ */
+
+static Bool NoParamCheck(floDefPtr flo, pointer rparms, pointer cparms, CARD16 tsize);
+static Bool NoTechYet(floDefPtr flo, peDefPtr ped, pointer parm, pointer tech);
+
+#if XIE_FULL
+/* Array of techniques for coloralloc */
+TechRec Tcoloralloc[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ALLOC-ALL",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecColorAllocAll / 4,
+ xieValColorAllocAll,
+ CopyCtoIAllocAll,
+ PrepCtoIAllocAll
+ }
+ }
+#ifdef BEYOND_SI
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"MATCH",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecColorAllocMatch / 4,
+ xieValColorAllocMatch,
+ CopyCtoIAllocMatch,
+ NoTechYet
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"REQUANTIZE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecColorAllocRequantize / 4,
+ xieValColorAllocRequantize,
+ CopyCtoIAllocRequantize,
+ NoTechYet
+ }
+ }
+#endif /* BEYOND_SI */
+};
+#endif
+
+#if XIE_FULL
+/* Array of techniques for constrain */
+TechRec Tconstrain[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CLIP-SCALE",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecClipScale / 4,
+ xieValConstrainClipScale,
+ CopyPConstrainClipScale,
+ PrepPConstrainClipScale
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"HARD-CLIP",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecHardClip / 4,
+ xieValConstrainHardClip,
+ CopyPConstrainStandard,
+ PrepPConstrainStandard
+ }
+ }
+};
+#endif
+
+#if XIE_FULL
+/* Array of techniques for conversion from RGB to another colorspace */
+TechRec Tconvertfromrgb[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CIELAB",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecRGBToCIELab / 4,
+ xieValRGBToCIELab,
+ CopyPConvertFromRGBCIE,
+ PrepPConvertFromRGBCIE
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CIEXYZ",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecRGBToCIEXYZ / 4,
+ xieValRGBToCIEXYZ,
+ CopyPConvertFromRGBCIE,
+ PrepPConvertFromRGBCIE
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"YCbCr",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecRGBToYCbCr / 4,
+ xieValRGBToYCbCr,
+ CopyPConvertFromRGBYCbCr,
+ PrepPConvertFromRGBYCbCr
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"YCC",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecRGBToYCC / 4,
+ xieValRGBToYCC,
+ CopyPConvertFromRGBYCC,
+ PrepPConvertFromRGBYCC
+ }
+ }
+};
+#endif
+
+#if XIE_FULL
+/* Array of techniques for converting to RGB from another colorspace */
+TechRec Tconverttorgb[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CIELAB",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecCIELabToRGB / 4,
+ xieValCIELabToRGB,
+ CopyPConvertToRGBCIE,
+ PrepPConvertToRGBCIE
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CIEXYZ",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecCIEXYZToRGB / 4,
+ xieValCIEXYZToRGB,
+ CopyPConvertToRGBCIE,
+ PrepPConvertToRGBCIE
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"YCbCr",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecYCbCrToRGB / 4,
+ xieValYCbCrToRGB,
+ CopyPConvertToRGBYCbCr,
+ PrepPConvertToRGBYCbCr
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"YCC",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecYCCToRGB / 4,
+ xieValYCCToRGB,
+ CopyPConvertToRGBYCC,
+ PrepPConvertToRGBYCC
+ }
+ }
+};
+#endif
+
+#if XIE_FULL
+/* Array of techniques for convolve */
+TechRec Tconvolve[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CONSTANT",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_OPTIONAL,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecConvolveConstant / 4,
+ xieValConvolveConstant,
+ CopyConvolveConstant,
+ PrepConvolveStandard
+ }
+ }
+#ifdef BEYOND_SI
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"REPLICATE",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecConvolveReplicate / 4,
+ xieValConvolveReplicate,
+ CopyConvolveReplicate,
+ PrepConvolveStandard
+ }
+ }
+#endif /* BEYOND_SI */
+};
+#endif
+
+/* Array of techniques for decode */
+TechRec Tdecode[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"UNCOMPRESSED-SINGLE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeUncompressedSingle / 4,
+ xieValDecodeUncompressedSingle,
+ CopyICPhotoUnSingle,
+ PrepICPhotoUnSingle
+ }
+ }
+#if XIE_FULL
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"UNCOMPRESSED-TRIPLE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeUncompressedTriple / 4,
+ xieValDecodeUncompressedTriple,
+ CopyICPhotoUnTriple,
+ PrepICPhotoUnTriple
+ }
+ }
+#endif
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G31D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeG31D / 4,
+ xieValDecodeG31D,
+ CopyICPhotoG31D,
+ PrepICPhotoG31D
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G32D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeG32D / 4,
+ xieValDecodeG32D,
+ CopyICPhotoG32D,
+ PrepICPhotoG32D
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G42D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeG42D / 4,
+ xieValDecodeG42D,
+ CopyICPhotoG42D,
+ PrepICPhotoG42D
+ }
+ }
+#if XIE_FULL
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"JPEG-BASELINE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeJPEGBaseline / 4,
+ xieValDecodeJPEGBaseline,
+ CopyICPhotoJPEGBaseline,
+ PrepICPhotoJPEGBaseline
+ }
+ }
+#ifdef BEYOND_SI
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"JPEG-LOSSLESS",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeJPEGLossless / 4,
+ xieValDecodeJPEGLossless,
+ CopyICPhotoJPEGLossless,
+ PrepICPhotoJPEGLossless
+ }
+ }
+#endif /* BEYOND_SI */
+#endif
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"TIFF-2",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeTIFF2 / 4,
+ xieValDecodeTIFF2,
+ CopyICPhotoTIFF2,
+ PrepICPhotoTIFF2
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"TIFF-PACKBITS",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDecodeTIFFPackBits / 4,
+ xieValDecodeTIFFPackBits,
+ CopyICPhotoTIFFPackBits,
+ PrepICPhotoTIFFPackBits
+ }
+ }
+};
+
+#if XIE_FULL
+/* Array of techniques for dither */
+TechRec Tdither[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ERROR-DIFFUSION",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDitherErrorDiffusion / 4,
+ xieValDitherErrorDiffusion,
+ CopyPDitherErrorDiffusion,
+ PrepPDitherErrorDiffusion
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ORDERED",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_OPTIONAL,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecDitherOrdered / 4,
+ xieValDitherOrdered,
+ CopyPDitherOrdered,
+ PrepPDitherOrdered
+ }
+ }
+};
+#endif
+
+/* Array of techniques for encode */
+TechRec Tencode[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"UNCOMPRESSED-SINGLE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeUncompressedSingle / 4,
+ xieValEncodeUncompressedSingle,
+ CopyECPhotoUnSingle,
+ PrepECPhotoUnSingle
+ }
+ }
+#if XIE_FULL
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"UNCOMPRESSED-TRIPLE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeUncompressedTriple / 4,
+ xieValEncodeUncompressedTriple,
+ CopyECPhotoUnTriple,
+ PrepECPhotoUnTriple
+ }
+ }
+#endif
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G31D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeG31D / 4,
+ xieValEncodeG31D,
+ CopyECPhotoG31D,
+ PrepECPhotoG31D
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G32D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeG32D / 4,
+ xieValEncodeG32D,
+ CopyECPhotoG32D,
+ PrepECPhotoG32D
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CCITT-G42D",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeG42D / 4,
+ xieValEncodeG42D,
+ CopyECPhotoG42D,
+ PrepECPhotoG42D
+ }
+ }
+#if XIE_FULL
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"JPEG-BASELINE",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_VARIABLE_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeJPEGBaseline / 4,
+ xieValEncodeJPEGBaseline,
+ CopyECPhotoJPEGBaseline,
+ PrepECPhotoJPEGBaseline
+ }
+ }
+#ifdef BEYOND_SI
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"JPEG-LOSSLESS",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeJPEGLossless / 4,
+ xieValEncodeJPEGLossless,
+ CopyECPhotoJPEGLossless,
+ PrepECPhotoJPEGLossless
+ }
+ }
+#endif /* BEYOND_SI */
+#endif
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"TIFF-2",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeTIFF2 / 4,
+ xieValEncodeTIFF2,
+ CopyECPhotoTIFF2,
+ PrepECPhotoTIFF2
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"TIFF-PACKBITS",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecEncodeTIFFPackBits / 4,
+ xieValEncodeTIFFPackBits,
+ CopyECPhotoTIFFPackBits,
+ PrepECPhotoTIFFPackBits
+ }
+ }
+};
+
+#if XIE_FULL
+/* Array of techniques for gamut */
+TechRec Tgamut[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"NONE",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGamutNone / 4,
+ xieValGamutNone,
+ (techCopyFunc) CopyPGamut,
+ PrepPGamut
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CLIP-RGB",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGamutClipRGB / 4,
+ xieValGamutClipRGB,
+ (techCopyFunc) CopyPGamut,
+ PrepPGamut
+ }
+ }
+};
+#endif
+
+/* Array of techniques for geometry */
+TechRec Tgeometry[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ANTIALIAS",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomAntialias / 4,
+ xieValGeomAntialias,
+ CopyGeomAntiAlias,
+ PrepGeomAntiAlias
+ }
+ }
+#ifdef BEYOND_SI
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ANTIALIAS-BY-AREA",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomAntialiasByArea / 4,
+ xieValGeomAntialiasByArea,
+ NoParamCheck,
+ NoTechYet
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"ANTIALIAS-BY-LOWPASS",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomAntialiasByLowpass / 4,
+ xieValGeomAntialiasByLPF,
+ NoParamCheck,
+ NoTechYet
+ }
+ }
+#endif
+#if XIE_FULL
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"BILINEAR-INTERPOLATION",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomBilinearInterpolation / 4,
+ xieValGeomBilinearInterp,
+ CopyGeomBilinearInterp,
+ PrepGeomBilinearInterp
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"GAUSSIAN",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomGaussian / 4,
+ xieValGeomGaussian,
+ CopyGeomGaussian,
+ PrepGeomGaussian
+ }
+ }
+#endif
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"NEAREST-NEIGHBOR",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_OPTIONAL,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecGeomNearestNeighbor / 4,
+ xieValGeomNearestNeighbor,
+ CopyGeomNearestNeighbor,
+ PrepGeomNearestNeighbor
+ }
+ }
+};
+
+#if XIE_FULL
+/* Array of techniques for histogram */
+TechRec Thistogram[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"FLAT",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecHistogramFlat / 4,
+ xieValHistogramFlat,
+ CopyPHistogramFlat,
+ PrepPHistogramFlat
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"GAUSSIAN",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecHistogramGaussian / 4,
+ xieValHistogramGaussian,
+ CopyPHistogramGaussian,
+ PrepPHistogramGaussian
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"HYPERBOLIC",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecHistogramHyperbolic / 4,
+ xieValHistogramHyperbolic,
+ CopyPHistogramHyperbolic,
+ PrepPHistogramHyperbolic
+ }
+ }
+};
+#endif
+
+#if XIE_FULL
+/* Array of techniques for white adjust */
+TechRec Twhiteadjust[] = {
+ { DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"NONE",
+ {
+ TECH_HAS_NO_PARMS,
+ TECH_HAS_NO_PARMS,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecWhiteAdjustNone / 4,
+ xieValWhiteAdjustNone,
+ (techCopyFunc) CopyPWhiteAdjustNone,
+ PrepPWhiteAdjustNone
+ }
+ }
+ ,{ DEFAULT_SPEED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ (CARD8 *)"CIELAB-SHIFT",
+ {
+ TECH_HAS_PARMS,
+ TECH_PARMS_REQUIRED,
+ TECH_FIXED_SIZE,
+ UNINITIALIZED,
+ sz_xieTecWhiteAdjustCIELabShift / 4,
+ xieValWhiteAdjustCIELabShift,
+ (techCopyFunc) CopyPWhiteAdjustCIELabShift,
+ PrepPWhiteAdjustCIELabShift
+ }
+ }
+};
+#endif
+
+TechGroupRec techArray[] = {
+#if XIE_FULL
+ {
+ xieValColorAlloc,
+ sizeof(Tcoloralloc)/sizeof(TechRec),
+ xieValColorAllocAll,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tcoloralloc
+ }
+ ,{
+ xieValConstrain,
+ sizeof(Tconstrain)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tconstrain
+ }
+ ,{
+ xieValConvertFromRGB,
+ sizeof(Tconvertfromrgb)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tconvertfromrgb
+ }
+ ,{
+ xieValConvertToRGB,
+ sizeof(Tconverttorgb)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tconverttorgb
+ }
+ ,{
+ xieValConvolve,
+ sizeof(Tconvolve)/sizeof(TechRec),
+ xieValConvolveConstant,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tconvolve
+ },
+#endif
+ {
+ xieValDecode,
+ sizeof(Tdecode)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tdecode
+ }
+#if XIE_FULL
+ ,{
+ xieValDither,
+ sizeof(Tdither)/sizeof(TechRec),
+ xieValDitherErrorDiffusion,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tdither
+ }
+#endif
+ ,{
+ xieValEncode,
+ sizeof(Tencode)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tencode
+ }
+#if XIE_FULL
+ ,{
+ xieValGamut,
+ sizeof(Tgamut)/sizeof(TechRec),
+ xieValGamutNone,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tgamut
+ }
+#endif
+ ,{
+ xieValGeometry,
+ sizeof(Tgeometry)/sizeof(TechRec),
+ xieValGeomNearestNeighbor,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Tgeometry
+ }
+#if XIE_FULL
+ ,{
+ xieValHistogram,
+ sizeof(Thistogram)/sizeof(TechRec),
+ NO_DEFAULT,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Thistogram
+ }
+ ,{
+ xieValWhiteAdjust,
+ sizeof(Twhiteadjust)/sizeof(TechRec),
+ xieValWhiteAdjustNone,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ Twhiteadjust
+ }
+#endif
+};
+
+TechTable techTable = {
+ sizeof(techArray)/sizeof(TechGroupRec),
+ UNINITIALIZED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ UNINITIALIZED,
+ techArray
+};
+
+#endif /* if defined(_XIEC_TECHNQ) */
+
+extern Bool technique_init(void);
+extern techVecPtr FindTechnique(xieTypTechniqueGroup group, CARD16 number);
+
+#if 0
+extern Bool TechNeedsParams();
+extern CARD16 TechDefault();
+#endif
+
+#endif /* end _XIEH_TECHNQ */
diff --git a/xc/programs/Xserver/XIE/mixie/Imakefile b/xc/programs/Xserver/XIE/mixie/Imakefile
new file mode 100644
index 000000000..6e6cd3a56
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/Imakefile
@@ -0,0 +1,36 @@
+XCOMM $XConsortium: Imakefile /main/6 1995/12/07 21:15:34 gildea $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/Imakefile,v 3.15 1999/04/29 09:13:37 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#if BuildDIS
+SUBDIRS = control fax import process export
+OBJS = control/?*.o fax/?*.o import/?*.o process/?*.o export/?*.o
+DONES = control/DONE fax/DONE import/DONE process/DONE export/DONE
+#else
+SUBDIRS = control fax import jpeg process export
+OBJS = control/?*.o fax/?*.o import/?*.o jpeg/?*.o process/?*.o export/?*.o
+DONES = control/DONE fax/DONE import/DONE jpeg/DONE process/DONE export/DONE
+#endif
+
+#define IHaveSubdirs
+
+
+#if HasParallelMake
+MakeMutex($(SUBDIRS) $(OBJS) $(DONES))
+#endif
+
+#if HasGnuMake || HasBsdMake
+$(DONES): $(SUBDIRS)
+#endif
+
+NormalDepLibraryTarget(mixie,$(SUBDIRS) $(DONES),$(OBJS))
+
+ForceSubdirs($(SUBDIRS))
+
+DependSubdirs($(SUBDIRS))
+
+MakeLintLibSubdirs($(SUBDIRS))
+LintSubdirs($(SUBDIRS))
+
diff --git a/xc/programs/Xserver/XIE/mixie/control/Imakefile b/xc/programs/Xserver/XIE/mixie/control/Imakefile
new file mode 100644
index 000000000..f1bea6c42
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/Imakefile
@@ -0,0 +1,36 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:55:55 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/control/Imakefile,v 3.5 1998/07/25 08:05:09 dawes Exp $
+XCOMM build device dependent machine independent control objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+ SRCS = analyze.c \
+ domain.c \
+ floman.c \
+ sched.c \
+ strip.c
+
+ OBJS = analyze.o \
+ domain.o \
+ floman.o \
+ sched.o \
+ strip.o
+
+#if BuildDIS
+ DEFINES = -DXIE_DIS
+#endif
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(ctrl,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/control/analyze.c b/xc/programs/Xserver/XIE/mixie/control/analyze.c
new file mode 100644
index 000000000..a8879513c
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/analyze.c
@@ -0,0 +1,184 @@
+/* $TOG: analyze.c /main/5 1998/02/09 16:12:09 kaleb $ */
+/**** module analyze.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ analyze.c -- DDXIE prototype (simple minded) DAG analyzer
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/control/analyze.c,v 1.3 1998/10/06 10:35:15 dawes Exp $ */
+
+#define _XIEC_ANALYZE
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <flostr.h>
+#include <texstr.h>
+
+
+/*
+ * routines called from DIXIE
+ */
+int DAGalyze();
+
+
+/*------------------------------------------------------------------------
+----------------------- analyze (sort of) the DAG ------------------------
+------------------------------------------------------------------------*/
+int DAGalyze(flo)
+ floDefPtr flo;
+{
+ int ok = TRUE;
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+
+ /* establish our default flo manager
+ */
+ InitFloManager(flo);
+
+ /* choose element handlers
+ */
+ for(ped = lst->flink; ok && !ListEnd(ped,lst); ped = ped->flink)
+ switch(ped->elemRaw->elemType) {
+#if XIE_FULL
+ case xieElemImportClientLUT: ok = miAnalyzeICLUT(flo,ped); break;
+ case xieElemImportClientPhoto: ok = miAnalyzeICPhoto(flo,ped); break;
+ case xieElemImportClientROI: ok = miAnalyzeICROI(flo,ped); break;
+ case xieElemImportDrawable: ok = miAnalyzeIDraw(flo,ped); break;
+ case xieElemImportDrawablePlane:ok = miAnalyzeIDrawP(flo,ped); break;
+ case xieElemImportLUT: ok = miAnalyzeILUT(flo,ped); break;
+ case xieElemImportPhotomap: ok = miAnalyzeIPhoto(flo,ped); break;
+ case xieElemImportROI: ok = miAnalyzeIROI(flo,ped); break;
+ case xieElemArithmetic: ok = miAnalyzeArith(flo,ped); break;
+ case xieElemBandCombine: ok = miAnalyzeBandCom(flo,ped); break;
+ case xieElemBandExtract: ok = miAnalyzeBandExt(flo,ped); break;
+ case xieElemBandSelect: ok = miAnalyzeBandSel(flo,ped); break;
+ case xieElemBlend: ok = miAnalyzeBlend(flo,ped); break;
+ case xieElemCompare: ok = miAnalyzeCompare(flo,ped); break;
+ case xieElemConstrain: ok = miAnalyzeConstrain(flo,ped); break;
+ case xieElemConvertFromIndex: ok = miAnalyzeCvtFromInd(flo,ped); break;
+ case xieElemConvertFromRGB: ok = miAnalyzeFromRGB(flo,ped); break;
+ case xieElemConvertToIndex: ok = miAnalyzeCvtToInd(flo,ped); break;
+ case xieElemConvertToRGB: ok = miAnalyzeToRGB(flo,ped); break;
+ case xieElemConvolve: ok = miAnalyzeConvolve(flo,ped); break;
+ case xieElemDither: ok = miAnalyzeDither(flo,ped); break;
+ case xieElemGeometry: ok = miAnalyzeGeometry(flo,ped); break;
+ case xieElemLogical: ok = miAnalyzeLogic(flo,ped); break;
+ case xieElemMatchHistogram: ok = miAnalyzeMatchHist(flo,ped); break;
+ case xieElemMath: ok = miAnalyzeMath(flo,ped); break;
+ case xieElemPasteUp: ok = miAnalyzePasteUp(flo,ped); break;
+ case xieElemPoint: ok = miAnalyzePoint(flo,ped); break;
+ case xieElemUnconstrain: ok = miAnalyzeUnconstrain(flo,ped); break;
+ case xieElemExportClientHistogram:ok = miAnalyzeECHist(flo,ped); break;
+ case xieElemExportClientLUT: ok = miAnalyzeECLUT(flo,ped); break;
+ case xieElemExportClientPhoto: ok = miAnalyzeECPhoto(flo,ped); break;
+ case xieElemExportClientROI: ok = miAnalyzeECROI(flo,ped); break;
+ case xieElemExportDrawable: ok = miAnalyzeEDraw(flo,ped); break;
+ case xieElemExportDrawablePlane:ok = miAnalyzeEDrawP(flo,ped); break;
+ case xieElemExportLUT: ok = miAnalyzeELUT(flo,ped); break;
+ case xieElemExportPhotomap: ok = miAnalyzeEPhoto(flo,ped); break;
+ case xieElemExportROI: ok = miAnalyzeEROI(flo,ped); break;
+#else
+ case xieElemImportClientLUT: ok = miAnalyzeICLUT(flo,ped); break;
+ case xieElemImportClientPhoto: ok = miAnalyzeICPhoto(flo,ped); break;
+ case xieElemImportDrawable: ok = miAnalyzeIDraw(flo,ped); break;
+ case xieElemImportDrawablePlane:ok = miAnalyzeIDrawP(flo,ped); break;
+ case xieElemImportLUT: ok = miAnalyzeILUT(flo,ped); break;
+ case xieElemImportPhotomap: ok = miAnalyzeIPhoto(flo,ped); break;
+ case xieElemGeometry: ok = miAnalyzeGeometry(flo,ped); break;
+ case xieElemPoint: ok = miAnalyzePoint(flo,ped); break;
+ case xieElemExportClientLUT: ok = miAnalyzeECLUT(flo,ped); break;
+ case xieElemExportClientPhoto: ok = miAnalyzeECPhoto(flo,ped); break;
+ case xieElemExportDrawable: ok = miAnalyzeEDraw(flo,ped); break;
+ case xieElemExportDrawablePlane:ok = miAnalyzeEDrawP(flo,ped); break;
+ case xieElemExportLUT: ok = miAnalyzeELUT(flo,ped); break;
+ case xieElemExportPhotomap: ok = miAnalyzeEPhoto(flo,ped); break;
+#endif
+ default: ElementError(flo,ped, return(FALSE));
+ }
+ return(ok);
+} /* end DAGalyze */
+
+/* end module analyze.c */
diff --git a/xc/programs/Xserver/XIE/mixie/control/domain.c b/xc/programs/Xserver/XIE/mixie/control/domain.c
new file mode 100644
index 000000000..3e0f5a7eb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/domain.c
@@ -0,0 +1,497 @@
+/* $TOG: domain.c /main/6 1998/02/09 16:12:14 kaleb $ */
+/**** module domain.c ****/
+/******************************************************************************
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ domain.c -- DDXIE Process Domain routines for flo manager
+
+ Dean Verheiden -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/control/domain.c,v 1.3 1998/10/06 10:35:16 dawes Exp $ */
+
+#define _XIEC_DOMAIN
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+
+/*
+ * routines referenced by other DDXIE modules
+*/
+Bool InitProcDomain();
+void ResetProcDomain();
+
+static Bool NoDomainSyncDomain();
+static INT32 NoDomainGetRun();
+
+#if XIE_FULL
+static Bool RunLengthSyncDomain();
+static INT32 RunLengthGetRun();
+static Bool ControlPlaneSyncDomain();
+static INT32 ControlPlaneGetRun();
+#endif
+
+Bool InitProcDomain(flo,ped,dtag,offX,offY)
+floDefPtr flo;
+peDefPtr ped;
+xieTypPhototag dtag;
+INT32 offX,offY;
+{
+peTexPtr pet = ped->peTex;
+receptorPtr rcp = &pet->receptor[ped->inCnt-1];
+
+ if (!dtag) { /* No process domain */
+ pet->roiinit = NoDomainSyncDomain;
+ pet->roiget = NoDomainGetRun;
+
+ return TRUE;
+ }
+#if !XIE_FULL
+ else
+ ImplementationError(flo,ped, return(FALSE));
+#else
+ if (!InitReceptor(flo,ped,rcp,0,1,ALL_BANDS,NO_BANDS))
+ return FALSE;
+
+ pet->domXoff = offX;
+ pet->domYoff = offY;
+
+ if (rcp->band[0].format->class == RUN_LENGTH) {
+ pet->roiinit = RunLengthSyncDomain;
+ pet->roiget = RunLengthGetRun;
+ } else {
+ bandPtr rband = &rcp->band[0];
+ bandPtr band = &pet->emitter[0];
+ CARD32 b;
+
+ pet->roiinit = ControlPlaneSyncDomain;
+ pet->roiget = ControlPlaneGetRun;
+
+ /* See if there is some intersection between the ROI and image*/
+ for(b = 0; b < ped->outFlo.bands; b++, band++, rband++)
+ if ( pet->domXoff + (INT32)rband->format->width <= 0 ||
+ pet->domXoff >= (INT32)band->format->width ||
+ pet->domYoff + (INT32)rband->format->height <= 0 ||
+ pet->domYoff >= (INT32)band->format->height) {
+ SetBandThreshold(rband,~0);
+ IgnoreBand(rband);
+ band->allpass = TRUE; /* No regions any line */
+ }
+ }
+ return (TRUE);
+#endif
+}
+
+
+void ResetProcDomain(ped)
+peDefPtr ped;
+{
+peTexPtr pet = ped->peTex;
+bandPtr band = &pet->emitter[0];
+int b;
+
+ pet->roi = (pointer) NULL;
+ pet->roiinit = (Bool (*)()) NULL;
+ pet->roiget = (INT32 (*)()) NULL;
+ pet->domXoff = 0;
+ pet->domYoff = 0;
+
+ for(b = 0; b < ped->outFlo.bands; b++, band++) {
+ band->pcroi = (pointer)NULL;
+ band->xindex = 0;
+ band->xcount = 0;
+ band->ypass = FALSE;
+ band->inside = FALSE;
+ band->allpass = FALSE;
+ }
+}
+
+
+/* Called when elements do not have an optional process domain */
+static Bool NoDomainSyncDomain(flo,ped,bnd,purge)
+floDefPtr flo;
+peDefPtr ped;
+bandPtr bnd;
+Bool purge;
+{
+ bnd->xcount = 0;
+ return (TRUE);
+}
+
+static INT32 NoDomainGetRun(flo,pet,bnd)
+floDefPtr flo;
+peTexPtr pet;
+bandPtr bnd;
+{
+ if (bnd->xcount)
+ return(0);
+ else
+ return(bnd->xcount = (INT32)bnd->format->width);
+}
+
+#if XIE_FULL
+/* Initialize run length structures for desired line */
+static Bool RunLengthSyncDomain(flo,ped,bnd,purge)
+floDefPtr flo;
+peDefPtr ped;
+bandPtr bnd;
+Bool purge;
+{
+peTexPtr pet = ped->peTex;
+bandPtr rband = &pet->receptor[ped->inCnt-1].band[bnd->band];
+ROIPtr proi;
+linePtr lp;
+INT32 ytrans;
+
+ /* Grab table if necessary */
+ if (!pet->roi)
+ if (!(pet->roi = GetSrcBytes(flo,pet,rband,0,1,KEEP)))
+ return (FALSE);
+
+ proi = (ROIPtr)pet->roi;
+
+ /* Make sure that there is some intersection between the ROI and image*/
+ if (bnd->allpass ||
+ proi->x + pet->domXoff + proi->width <= 0 ||
+ proi->x + pet->domXoff >= (INT32)bnd->format->width ||
+ proi->y + pet->domYoff + proi->height <= 0 ||
+ proi->y + pet->domYoff >= (INT32)bnd->format->height) {
+ bnd->allpass = TRUE; /* No regions any line */
+ bnd->xcount = 0;
+ return (TRUE);
+ }
+
+ /* If no table or current y is past y desired, start at the beginning */
+ lp = (linePtr)bnd->pcroi;
+ ytrans = bnd->current - pet->domYoff;
+ if (!lp || lp->y > ytrans) {
+ lp = (linePtr)&proi[1];
+ if (lp->y > ytrans) { /* Make sure we are after first entry */
+ bnd->ypass = TRUE; /* No regions this line */
+ bnd->xcount = 0;
+ return (TRUE);
+ }
+ }
+
+ /*
+ step through structures until corresponding y is found or until
+ table is exhausted
+ */
+ while (lp < proi->lend && ytrans >= lp->y + lp->nline)
+ lp = (linePtr)RUNPTR(lp->nrun);
+
+ /* If some domains for this line, set up for processing */
+ if (!(bnd->ypass = lp >= proi->lend || ytrans < lp->y)) {
+ bnd->pcroi = (pointer)lp;
+ bnd->xcount = (proi->x + pet->domXoff) < 0 ?
+ proi->x + pet->domXoff : 0;
+ bnd->xindex = 0;
+ bnd->inside = lp->nrun && !RUNPTR(0)->dstart &&
+ proi->x + pet->domXoff <= 0;
+ } else {
+ bnd->xcount = 0;
+ if (lp >= proi->lend) /* Tidy up garbage pointer */
+ bnd->pcroi = (pointer)NULL;
+ }
+
+ return (TRUE);
+} /* SyncDomain */
+
+static INT32 RunLengthGetRun(flo,pet,bnd)
+floDefPtr flo;
+peTexPtr pet;
+bandPtr bnd;
+{
+ROIPtr proi = (ROIPtr)pet->roi;
+linePtr lp = (linePtr)bnd->pcroi;
+runPtr rp;
+INT32 width = (INT32)bnd->format->width;
+INT32 xcount = bnd->xcount;
+INT32 startx, nextx, length;
+CARD32 xindex, nrun;
+Bool inside;
+
+ /* Make sure that SyncDomain was called first */
+ if (!proi) ImplementationError(flo,pet->peDef,return(0));
+
+ /* See if there are any processing domains for the current line */
+ if (bnd->allpass || bnd->ypass || xcount >= width) {
+ if (xcount)
+ return(0); /* off edge of image */
+ else
+ return (-(bnd->xcount = width));
+ }
+
+ rp = RUNPTR(0);
+ nrun = lp->nrun;
+ inside = bnd->inside;
+ xindex = bnd->xindex;
+
+ /* Handle left clip */
+ if (xcount < 0) {
+ while (xindex < nrun &&
+ (!inside && xcount + rp[xindex].dstart < 0 ||
+ inside && xcount + rp[xindex].length < 0)) {
+ if (inside)
+ xcount += rp[xindex++].length;
+ else
+ xcount += rp[xindex].dstart;
+ inside = !inside;
+ }
+
+ /* This should have already been caught in init */
+ if (xindex >= nrun) { /* no intersection */
+ bnd->ypass = TRUE;
+ return (-(bnd->xcount = width));
+ }
+
+ startx = 0;
+ } else
+ startx = xcount;
+
+ /* Handle right clip */
+ if (xindex >= nrun ||
+ inside && xcount + rp[xindex].length > width ||
+ !inside && xcount + rp[xindex].dstart > width) {
+ bnd->ypass = TRUE;
+ nextx = width;
+ } else if (inside)
+ nextx = xcount + rp[xindex++].length;
+ else {
+ nextx = xcount + rp[xindex].dstart;
+ /* Handle case where first domain starts past start of image */
+ if (!xindex && proi->x + pet->domXoff > 0)
+ nextx += proi->x + pet->domXoff;
+ }
+
+ length = (inside) ? nextx - startx : startx - nextx;
+
+ /* toggle inside/outside */
+ bnd->inside = !inside;
+ bnd->xcount = nextx;
+ bnd->xindex = xindex;
+
+ return (length);
+} /* GetRun */
+
+/* Initialize control plane structures for desired line */
+static Bool ControlPlaneSyncDomain(flo,ped,bnd,purge)
+floDefPtr flo;
+peDefPtr ped;
+bandPtr bnd;
+Bool purge;
+{
+peTexPtr pet = ped->peTex;
+bandPtr rband;
+INT32 ytrans;
+
+ bnd->xcount = 0;
+
+ /* If init routine determined no intersection, pass line */
+ if (bnd->allpass)
+ return (TRUE);
+
+ rband = &pet->receptor[ped->inCnt-1].band[bnd->band];
+ ytrans = bnd->current - pet->domYoff;
+
+ if (ytrans < 0 || ytrans >= (INT32)rband->format->height) {
+ bnd->ypass = TRUE;
+ return (TRUE);
+ } else
+ bnd->ypass = FALSE;
+
+ /* Grab control plane line */
+ if (!(pet->roi = bnd->pcroi = GetSrc(flo,pet,rband,ytrans,purge))){
+ if (purge)
+ FreeData(flo,pet,rband,rband->current);
+ else
+ SetBandThreshold(rband,rband->available + 1);
+ return (FALSE);
+ }
+
+ if ( pet->domXoff > 0 ) {
+ bnd->inside = FALSE;
+ bnd->xindex = 0;
+ } else {
+ bnd->xindex = -pet->domXoff;
+ bnd->inside = LOG_tstbit((LogInt *)bnd->pcroi,bnd->xindex) != 0;
+ }
+
+ return (TRUE);
+}
+
+static INT32 countZeros(line,offset,iedge)
+LogInt *line;
+INT32 offset,iedge;
+{
+INT32 count = 0;
+CARD32 index = (CARD32)offset, edge = (CARD32)iedge;
+
+ while (index < edge && !LOG_tstbit(line,index)) {
+ count++;
+ index++;
+ }
+
+ return(count);
+}
+
+INT32 countOnes(line,offset,iedge)
+LogInt *line;
+INT32 offset,iedge;
+{
+INT32 count = 0;
+CARD32 index = (CARD32)offset, edge = (CARD32)iedge;
+
+ while (index < edge && LOG_tstbit(line,index)) {
+ count++;
+ index++;
+ }
+
+ return(count);
+}
+
+static INT32 ControlPlaneGetRun(flo,pet,bnd)
+floDefPtr flo;
+peTexPtr pet;
+bandPtr bnd;
+{
+peDefPtr ped = pet->peDef;
+bandPtr rband = &pet->receptor[ped->inCnt-1].band[bnd->band];
+INT32 xcount = bnd->xcount;
+INT32 width = (INT32)bnd->format->width;
+
+LogInt *cpl;
+Bool inside;
+INT32 xindex, dwidth, Xoff, length, edge;
+
+ /* See if there is every anything to do with this band */
+ if (bnd->allpass || bnd->ypass) {
+ if (xcount)
+ return(0);
+ else
+ return(-(bnd->xcount = width));
+ }
+
+ /* Make sure that there is something left to look at */
+ if (xcount >= width)
+ return (0);
+
+ /* defer sucking these out til necessary */
+ cpl = (LogInt *)bnd->pcroi;
+ inside = bnd->inside;
+ xindex = bnd->xindex;
+ dwidth = (INT32)rband->format->width;
+ Xoff = pet->domXoff;
+
+ /* Figure out the maximum bound to check */
+ edge = (Xoff + dwidth > width) ? width - Xoff : dwidth;
+
+ /* See if we are off the side of the control plane */
+ if (!xcount && pet->domXoff > 0) {
+ xcount = length = Xoff + (xindex = countZeros(cpl, 0, edge));
+ } else if (inside) {
+ xcount += (length = countOnes(cpl, xindex, edge));
+ xindex += length;
+ } else {
+ xcount += (length = countZeros(cpl, xindex, edge));
+ xindex += length;
+ /* If control plane ends before image, push to edge */
+ if (xindex >= edge && xcount < width) {
+ length += width - xcount;
+ xcount = width;
+ }
+ }
+
+ bnd->inside = !inside;
+ bnd->xcount = xcount;
+ bnd->xindex = xindex;
+
+ return ((inside) ? length : -length);
+}
+#endif
+
+/* end domain.c */
diff --git a/xc/programs/Xserver/XIE/mixie/control/floman.c b/xc/programs/Xserver/XIE/mixie/control/floman.c
new file mode 100644
index 000000000..3194e1249
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/floman.c
@@ -0,0 +1,525 @@
+/* $TOG: floman.c /main/7 1998/02/09 16:12:19 kaleb $ */
+/**** module floman.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ floman.c -- DDXIE photoflo manager
+
+ Robert NC Shelley -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/control/floman.c,v 3.3 1998/10/25 07:11:49 dawes Exp $ */
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/* routines used internal to this module
+ */
+static int flo_link(floDefPtr flo);
+static int flo_startup(floDefPtr flo);
+static int flo_resume(floDefPtr flo);
+static int flo_shutdown(floDefPtr flo);
+static int flo_destroy(floDefPtr flo);
+
+/* DIXIE to DDXIE photoflo management entry points
+ */
+static floVecRec floManagerVec = {
+ flo_link,
+ flo_startup,
+ flo_resume,
+ flo_shutdown,
+ flo_destroy
+ };
+
+/*------------------------------------------------------------------------
+------------------------ Initialize Photoflo Manager ---------------------
+------------------------------------------------------------------------*/
+int InitFloManager(floDefPtr flo)
+{
+ /* plug in the DDXIE photoflo management vector */
+ flo->floVec = &floManagerVec;
+
+ return(TRUE);
+} /* end InitFloManager */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+int MakePETex(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 extend,
+ Bool inSync,
+ Bool bandSync)
+{
+ peTexPtr pet;
+ inFloPtr inf;
+ receptorPtr rcp;
+ bandPtr bnd;
+ int b, i;
+
+ /* attach an execution context to the photo element definition */
+ if(!(pet = (peTexPtr) XieCalloc(sizeof(peTexRec) + (extend + 4) +
+ ped->inCnt * sizeof(receptorRec))))
+ AllocError(flo,ped, return(FALSE));
+
+ /* init the new peTex */
+ ped->peTex = pet;
+ pet->peDef = ped;
+ pet->inSync = inSync;
+ pet->bandSync = bandSync;
+ pet->outFlo = &ped->outFlo;
+ pet->receptor = (receptorPtr) &pet[1];
+ for(b = 0; b < xieValMaxBands; b++) {
+ bnd = &pet->emitter[b];
+ bnd->band = b;
+ bnd->format = &ped->outFlo.format[b];
+ ListInit(&bnd->stripLst);
+ }
+ /* init the new receptors */
+ for(i = 0; i < ped->inCnt; i++) {
+ inf = &ped->inFloLst[i];
+ rcp = &pet->receptor[i];
+ rcp->inFlo = inf;
+ for(b = 0; b < xieValMaxBands; b++) {
+ bnd = &rcp->band[b];
+ bnd->band = b;
+ bnd->isInput = TRUE;
+ bnd->receptor = rcp;
+ bnd->format = &rcp->inFlo->format[b];
+ ListInit(&bnd->stripLst);
+ }
+ }
+ if(extend) {
+ /* In case private structure has 'double', round up */
+ unsigned char *ptr = (pointer) &pet->receptor[ped->inCnt];
+ pet->private = (pointer)
+ (((unsigned long)ptr + sizeof(double)-1) & -sizeof(double));
+ }
+
+ return(TRUE);
+} /* end MakePETex */
+
+
+/*------------------------------------------------------------------------
+--------------------- prepare Receptors for execution --------------------
+------------------------------------------------------------------------*/
+Bool InitReceptors(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 mapSize,
+ CARD32 threshold)
+{
+ receptorPtr rcp = ped->peTex->receptor;
+ int i;
+
+ /* initialize each receptor (1 per inFlo) */
+ for(i = 0; i < ped->inCnt; ++rcp, ++i)
+ if(!InitReceptor(flo,ped,rcp,mapSize,threshold,(CARD8)~0,(CARD8)0))
+ return(FALSE);
+
+ return(TRUE);
+} /* end InitReceptors */
+
+
+/*------------------------------------------------------------------------
+--------------------- prepare Receptors for execution --------------------
+------------------------------------------------------------------------*/
+Bool InitReceptor(
+ floDefPtr flo,
+ peDefPtr ped,
+ receptorPtr rcp,
+ CARD32 mapSize,
+ CARD32 threshold,
+ unsigned process,
+ unsigned bypass)
+{
+ bandPtr bnd = rcp->band;
+ int b, bands = rcp->inFlo->bands;
+
+ /* bands to pass rather than process */
+ rcp->bypass = rcp->inFlo->index == SRCt1 ? bypass : NO_BANDS;
+
+ /* initialize each band */
+ for(b = 0; b < bands; ++bnd, ++b)
+ if(process & 1<<b)
+ if(!InitBand(flo, ped, bnd, mapSize, threshold, NO_INPLACE))
+ return(FALSE);
+
+ return(TRUE);
+} /* end InitReceptor */
+
+
+/*------------------------------------------------------------------------
+---------------------- prepare emitter for execution ---------------------
+------------------------------------------------------------------------*/
+Bool InitEmitter(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 mapSize,
+ INT32 inPlace)
+{
+ peTexPtr pet = ped->peTex;
+ int b;
+
+ /* initialize the outFlo and emitter */
+ ped->outFlo.active = NO_BANDS;
+ ped->outFlo.ready = NO_BANDS;
+
+ /* initialize each band */
+ for(b = 0; b < ped->outFlo.bands; b++) {
+ if(pet->receptor[SRCt1].bypass & 1<<b) continue;
+ if(!InitBand(flo, ped, &pet->emitter[b], mapSize, (CARD32) 0, inPlace))
+ return(FALSE);
+ }
+ return(TRUE);
+} /* end InitEmitter */
+
+
+/*------------------------------------------------------------------------
+------------- prepare a receptor or emitter band for execution -----------
+------------------------------------------------------------------------*/
+Bool InitBand(
+ floDefPtr flo,
+ peDefPtr ped,
+ bandPtr bnd,
+ CARD32 mapSize,
+ CARD32 threshold,
+ INT32 inPlace)
+{
+ bnd->threshold = threshold;
+ bnd->available = 0;
+ bnd->minGlobal = 0;
+ bnd->minLocal = 0;
+ bnd->current = 0;
+ bnd->maxLocal = 0;
+ bnd->maxGlobal = 0;
+ bnd->pitch = IsCanonic(bnd->format->class) ? bnd->format->pitch>>3 : 1;
+ bnd->strip = NULL;
+ bnd->data = NULL;
+ bnd->dataMap = NULL;
+ bnd->final = FALSE;
+ if((bnd->mapSize = mapSize) &&
+ !(bnd->dataMap = (CARD8**)XieMalloc(mapSize * sizeof(CARD8*))))
+ FloAllocError(flo,0,0, return(FALSE));
+
+ if(bnd->isInput) {
+ bnd->receptor->active |= 1<<bnd->band;
+ bnd->receptor->attend |= 1<<bnd->band;
+ bnd->inPlace = NULL;
+ if(bnd->band == 0 || !bnd->receptor->band[0].replicate) {
+ if(ped->flags.putData)
+ ++flo->floTex->imports;
+
+ if(!bnd->receptor->admit)
+ ++ped->peTex->admissionCnt;
+ bnd->receptor->admit |= 1<<bnd->band;
+
+ if(bnd->replicate) {
+ int b = 1;
+ /* replicate band zero's format (into the phantom bands
+ * that will be sharing its data) and initialize them too
+ */
+ do
+ if(bnd->replicate & 1<<b) {
+ *bnd[b].format = *bnd->format;
+ bnd[b].format->band = b;
+ InitBand(flo,ped,&bnd[b],NO_DATAMAP,threshold,NO_INPLACE);
+ }
+ while(++b < xieValMaxBands);
+ }
+ }
+ } else { /* IsEmitter */
+ bnd->inPlace = ((inPlace == NO_INPLACE)
+ ? NULL : &ped->peTex->receptor[inPlace].band[bnd->band]);
+ ped->peTex->emitting |= 1<<bnd->band;
+ if(ped->flags.getData) {
+ ped->outFlo.active |= 1<<bnd->band;
+ flo->floTex->exports++;
+ }
+ }
+ return(TRUE);
+} /* end InitBand */
+
+
+/*------------------------------------------------------------------------
+------------------- get rid of left over strips etc. ---------------------
+------------------------------------------------------------------------*/
+void ResetReceptors(peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp;
+ int b,i;
+
+ for(i = 0; i < ped->inCnt; i++) {
+ for(rcp = &pet->receptor[i], b = 0; b < xieValMaxBands; ++b) {
+ if(rcp->forward & 1<<b) {
+ FreeStrips(&ped->outFlo.output[b]);
+ }
+ rcp->forward = NO_BANDS;
+ ResetBand(&rcp->band[b]);
+ }
+ rcp->admit = NO_BANDS;
+ rcp->ready = NO_BANDS;
+ rcp->active = NO_BANDS;
+ rcp->attend = NO_BANDS;
+ rcp->bypass = NO_BANDS;
+ }
+} /* end ResetReceptors */
+
+
+/*------------------------------------------------------------------------
+------------------- get rid of left over strips etc. ---------------------
+------------------------------------------------------------------------*/
+void ResetEmitter(peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ int b;
+
+ pet->emitting = NO_BANDS;
+
+ for(b = 0; b < ped->outFlo.bands; ++b)
+ ResetBand(&pet->emitter[b]);
+} /* end ResetEmitter */
+
+
+/*------------------------------------------------------------------------
+------------------- get rid of left over strips etc. ---------------------
+------------------------------------------------------------------------*/
+void ResetBand(bandPtr bnd)
+{
+ bnd->replicate = NO_BANDS;
+
+ FreeStrips(&bnd->stripLst);
+
+ if(bnd->dataMap)
+ bnd->dataMap = (CARD8 **)XieFree(bnd->dataMap);
+} /* end ResetBand */
+
+
+/*------------------------------------------------------------------------
+-------------------------------- Link -----------------------------------
+------------------------------------------------------------------------*/
+static int flo_link(floDefPtr flo)
+{
+ peDefPtr ped;
+ ddElemVecRec vec;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+
+ /* create and initialize our photoflo's execution context */
+ if(!flo->floTex && !(flo->floTex = (floTexPtr) XieMalloc(sizeof(floTexRec))))
+ FloAllocError(flo,0,0, return(FALSE));
+
+ flo->floTex->yieldPtr = NULL;
+
+ /* create new element execution contexts for elements that have changed */
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink)
+ if(flo->flags.modified) { /* XXX should be ped->flags.modified */
+ if(ped->peTex) { /* fix this after beta release */
+ vec = ped->ddVec; /* shouldn't have to save vetors */
+ Destroy(flo,ped); /* destroy the old element context */
+ ped->ddVec = vec; /* shouldn't have to restore them*/
+ }
+ if(!Create(flo,ped))
+ return(FALSE);
+ }
+ return(TRUE);
+} /* end flo_link */
+
+
+/*------------------------------------------------------------------------
+-------------------------------- Startup -----------------------------------
+------------------------------------------------------------------------*/
+static int flo_startup(floDefPtr flo)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+ int status;
+
+ /* initialize our assistant managers */
+ InitScheduler(flo);
+ InitStripManager(flo);
+
+ flo->floTex->imports = flo->floTex->exports = 0;
+ flo->floTex->exitCnt = 0;
+
+ /* initialize all the elements */
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink) {
+ ped->peTex->admissionCnt = 0;
+ ped->peTex->schedCnt = 0;
+ ped->peTex->scheduled = 0;
+ if(Initialize(flo,ped))
+ ped->flags.modified = FALSE;
+ else
+ break;
+ }
+ flo->flags.active = TRUE;
+ flo->flags.aborted = FALSE;
+ flo->flags.modified = FALSE;
+
+ /* Call the scheduler -- there are no ImportClient elements the first time
+ */
+ if(ferrCode(flo)) {
+ flo_shutdown(flo);
+ status = FALSE;
+ } else {
+ status = Execute(flo, NULL);
+ }
+ return(status);
+} /* end flo_startup */
+
+
+/*------------------------------------------------------------------------
+-------------------------------- Resume -----------------------------------
+------------------------------------------------------------------------*/
+static int flo_resume(floDefPtr flo)
+{
+ /* not implemented in the SI */
+
+ FloImplementationError(flo,0,0, return(FALSE));
+} /* end flo_resume */
+
+
+/*------------------------------------------------------------------------
+------------------------------ Shutdown ----------------------------------
+------------------------------------------------------------------------*/
+static int flo_shutdown(floDefPtr flo)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+
+ if(flo->floTex) {
+ /* reset all the elements */
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink)
+ Reset(flo,ped);
+
+ /* empty the strip cache */
+ flo->floTex->stripSize = 0;
+ if(flo->floTex->stripHead.flink)
+ FreeStrips(&flo->floTex->stripHead);
+
+ if(flo->awakenPtr) {
+ /* awaken snoozing clients
+ */
+ while(flo->awakenCnt) {
+ ClientPtr client = flo->awakenPtr[--flo->awakenCnt];
+ if(!client->clientGone)
+ AttendClient(client);
+ }
+ flo->awakenPtr = (ClientPtr*)XieFree(flo->awakenPtr);
+ }
+ flo->flags.active = FALSE;
+ }
+ return(TRUE);
+} /* end flo_shutdown */
+
+
+/*------------------------------------------------------------------------
+-------------------------------- Destroy ---------------------------------
+------------------------------------------------------------------------*/
+static int flo_destroy(floDefPtr flo)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+
+ if(flo->floTex) {
+ /* destroy all the lingering element structures */
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink)
+ Destroy(flo,ped);
+
+ /* get rid of the floTex */
+ flo->floTex = (floTexPtr) XieFree(flo->floTex);
+ }
+ /* zap the DDXIE photoflo management vectors */
+ flo->floVec = NULL;
+ flo->schedVec = NULL;
+ flo->stripVec = NULL;
+
+ return(TRUE);
+} /* end flo_destroy */
+
+/* end module floman.c */
diff --git a/xc/programs/Xserver/XIE/mixie/control/sched.c b/xc/programs/Xserver/XIE/mixie/control/sched.c
new file mode 100644
index 000000000..a7d8a08c6
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/sched.c
@@ -0,0 +1,244 @@
+/* $TOG: sched.c /main/5 1998/02/09 16:12:28 kaleb $ */
+/**** module sched.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ sched.c -- DDXIE machine independent photoflo scheduler
+
+ Dean Verheiden, Robert NC Shelley -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/control/sched.c,v 1.4 1998/10/25 07:11:51 dawes Exp $ */
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <flostr.h>
+#include <element.h>
+#include <texstr.h>
+
+#define SCHED_BAIL_OUT 10000 /* number of nonproductive times around scheduler
+ * loop before bailing out -- bad element
+ */
+
+/*
+ * routines used internal to this module
+ */
+static Bool execute(floDefPtr flo, peTexPtr importer);
+static bandMsk runnable(floDefPtr flo, peTexPtr pet);
+
+/*
+ * DDXIE photoflo manager entry points
+ */
+static schedVecRec schedulerVec = {
+ execute,
+ runnable
+ };
+
+
+/*------------------------------------------------------------------------
+--------------------------- Initialize Scheduler -------------------------
+------------------------------------------------------------------------*/
+int InitScheduler(floDefPtr flo)
+{
+ /* plug in the DDXIE scheduler vector */
+ flo->schedVec = &schedulerVec;
+
+ /* init the scheduler ready-list */
+ ListInit(&flo->floTex->schedHead);
+
+ return(TRUE);
+} /* end InitScheduler */
+
+
+/*------------------------------------------------------------------------
+------------------------- Execute the photoflo ---------------------------
+------------------------------------------------------------------------*/
+static Bool execute(floDefPtr flo, peTexPtr importer)
+{
+ bandMsk ready;
+ peTexPtr pet;
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+ CARD32 sched_count = SCHED_BAIL_OUT;
+ CARD32 strip_count = flo->floTex->putCnt;
+
+ if(importer) {
+ /* Put the ImportClient element at the head of the ready-list */
+ InsertMember(importer,&flo->floTex->schedHead);
+ importer->scheduled = importer->receptor[IMPORT].ready;
+ }
+ do {
+ /* execute elements from the head of the ready-list until it's empty
+ * (calls to schedule from the data manager may prepend
+ * additional elements to the ready-list)
+ */
+ while(!ListEmpty(&flo->floTex->schedHead)) {
+ pet = flo->floTex->schedHead.flink;
+
+ if(Activate(flo,pet->peDef,pet) && (ready = runnable(flo,pet))) {
+ pet->scheduled = ready; /* remember which bands keep us alive */
+ } else {
+ /* element is no longer runnable, remove it and check for errors
+ */
+ RemoveMember(pet,pet);
+ pet->scheduled = 0;
+ if(ferrCode(flo))
+ return(flo->flags.active = FALSE);
+ }
+ if(strip_count != flo->floTex->putCnt) {
+ sched_count = SCHED_BAIL_OUT;
+ strip_count = flo->floTex->putCnt;
+ } else if( !--sched_count)
+ ImplementationError(flo,pet->peDef, return(FALSE));
+ }
+ /* Load all the elements onto the ready-list that can keep producing
+ * output without requiring any additional input (e.g. ImportResource
+ * elements).
+ */
+ for(ped = lst->flink; !ListEnd(ped,lst); ped = ped->flink)
+ if(ped->peTex->emitting && !ped->peTex->admissionCnt)
+ InsertMember(ped->peTex,&flo->floTex->schedHead);
+ /*
+ * keep on trucking if there's nothing expected from the client
+ */
+ } while(!flo->floTex->imports && !ListEmpty(&flo->floTex->schedHead));
+
+ /* if we still have stuff to do, count another round, otherwise shut it down
+ */
+ if(flo->floTex->imports || flo->floTex->exports)
+ ++flo->floTex->exitCnt;
+ else
+ ddShutdown(flo);
+
+ return(flo->flags.active);
+} /* end execute */
+
+
+/*------------------------------------------------------------------------
+----------------------- test element for runnability ---------------------
+------------------------------------------------------------------------*/
+static bandMsk runnable(floDefPtr flo, peTexPtr pet)
+{
+ receptorPtr rcp = pet->receptor, rend = &pet->receptor[pet->peDef->inCnt];
+ bandMsk R, r;
+
+ if(ferrCode(flo))
+ return(0);
+
+ if(pet->inSync)
+ if(pet->bandSync) {
+ /*
+ * inSync true, bandSync true: all attendable bands and inputs needed
+ */
+ for(R = ~0; rcp < rend && R; R &= r, ++rcp)
+ if((rcp->active & rcp->attend) != (r = rcp->ready & rcp->attend))
+ return(NO_BANDS);
+ return(R); /* return AND of attendable bands */
+ } else {
+ /*
+ * inSync true, bandSync false: any bands that match between all inputs
+ */
+ for(r = 0, R = ~0; rcp < rend; R &= r, ++rcp)
+ if(rcp->active & rcp->attend && !(r = rcp->ready & rcp->attend))
+ return(NO_BANDS);
+ return(R & r); /* return AND of attendable bands */
+ }
+ else
+ if(pet->bandSync) {
+ /*
+ * inSync false, bandSync true: all bands of any input must be ready
+ */
+ for(R = 0; rcp < rend; R |= r, ++rcp)
+ if((rcp->active & rcp->attend) != (r = rcp->ready & rcp->attend))
+ return(NO_BANDS);
+ return(R); /* return OR of attendable bands */
+ } else {
+ /*
+ * inSync false, bandSync false: any band from any input will do
+ */
+ for(R = 0; rcp < rend; R |= rcp->ready & rcp->attend, ++rcp);
+ return(R); /* return OR of attendable bands */
+ }
+} /* end runnable */
+
+/* end module sched.c */
diff --git a/xc/programs/Xserver/XIE/mixie/control/strip.c b/xc/programs/Xserver/XIE/mixie/control/strip.c
new file mode 100644
index 000000000..1910701df
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/control/strip.c
@@ -0,0 +1,1228 @@
+/* $TOG: strip.c /main/10 1998/02/09 16:12:32 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module strip.c ****/
+/*****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ strip.c -- DDXIE machine independent data flo manager
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/control/strip.c,v 3.5 1999/01/31 12:21:35 dawes Exp $ */
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <flostr.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/* routines exported to DIXIE via the photoflo management vector
+ */
+static int import_data(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD8 band,
+ CARD8 *data,
+ CARD32 len,
+ BOOL final);
+static int export_data(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD8 band,
+ CARD32 maxLen,
+ BOOL term);
+static int query_data(
+ floDefPtr flo,
+ xieTypPhototag **list,
+ CARD16 *pending,
+ CARD16 *available);
+
+/* routines exported to elements via the data manager's vector
+ */
+static CARD8 *make_bytes(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 contig,
+ Bool purge);
+static CARD8 *make_lines(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ Bool purge);
+static Bool map_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 map,
+ CARD32 unit,
+ CARD32 len,
+ Bool purge);
+static CARD8 *get_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 contig,
+ Bool purge);
+static Bool put_data(floDefPtr flo, peTexPtr pet, bandPtr dbnd);
+static void free_data(floDefPtr flo, peTexPtr pet, bandPtr dbnd);
+static Bool pass_strip(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripPtr strip);
+static Bool import_strips(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripLstPtr strips);
+static Bool alter_src(floDefPtr flo, peTexPtr pet, stripPtr strip);
+static void bypass_src(floDefPtr flo, peTexPtr pet, bandPtr dbnd);
+static void disable_src(floDefPtr flo, peTexPtr pet, bandPtr bnd, Bool purge);
+static void disable_dst(floDefPtr flo, peTexPtr pet, bandPtr dbnd);
+
+/* routines used internal to this module
+ */
+static stripPtr alter_data(floDefPtr flo, peTexPtr pet, bandPtr db);
+static stripPtr contig_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripPtr i_strip,
+ CARD32 contig);
+static stripPtr make_strip(
+ floDefPtr flo,
+ formatPtr fmt,
+ CARD32 start,
+ CARD32 units,
+ CARD32 bytes,
+ Bool allocData);
+static stripPtr clone_strip(floDefPtr flo, stripPtr in_strip);
+static bandMsk put_strip(floDefPtr flo, peTexPtr pet, stripPtr strip);
+static void forward_strip(floDefPtr flo, peTexPtr pet, stripPtr fwd);
+static stripPtr free_strip(floDefPtr flo, stripPtr strip);
+
+/* DDXIE client data manager entry points
+ */
+static dataVecRec dataManagerVec = {
+ (xieIntProc)import_data,
+ (xieIntProc)export_data,
+ (xieIntProc)query_data
+ };
+
+/* DDXIE photoflo manager entry points
+ */
+static stripVecRec stripManagerVec = {
+ make_bytes,
+ make_lines,
+ map_data,
+ get_data,
+ put_data,
+ free_data,
+ pass_strip,
+ import_strips,
+ alter_src,
+ bypass_src,
+ disable_src,
+ disable_dst
+ };
+
+INT32 STRIPS = 0; /* DEBUG */
+INT32 BYTES = 0; /* DEBUG */
+
+/*------------------------------------------------------------------------
+-------------------------- Initialize Data Manager -----------------------
+------------------------------------------------------------------------*/
+int InitStripManager(floDefPtr flo)
+{
+ /* plug in the DDXIE client data management vector */
+ flo->dataVec = &dataManagerVec;
+
+ /* plug in the strip manager vector */
+ flo->stripVec = &stripManagerVec;
+
+ /* init the strip cache */
+ ListInit(&flo->floTex->stripHead);
+
+ /* choose the best strip size for this flo (a constant value for now) */
+ flo->floTex->stripSize = STANDARD_STRIP_SIZE;
+
+ /* clear the count of strips passed */
+ flo->floTex->putCnt = 0;
+
+ return(TRUE);
+} /* end InitStripManager */
+
+
+/*------------------------------------------------------------------------
+----------- discard parent headers from a whole list of strips -----------
+----------- and copy data if multiple references are found -----------
+----------- then transfer them all to their final destination -----------
+------------------------------------------------------------------------*/
+int DebriefStrips(
+ stripLstPtr i_head,
+ stripLstPtr o_head)
+{
+ stripPtr child, parent;
+
+ /* NOTE: we might want to consider (re)allocing strip buffers to
+ * strip->length instead of leaving them an strip->bufSiz.
+ */
+ for(child = i_head->flink; !ListEnd(child,i_head); child = child->flink) {
+ while ((parent = child->parent) != 0)
+ if(parent->refCnt == 1) { /* discard a cloned header */
+ child->parent = parent->parent;
+ XieFree(parent);
+ --STRIPS; /*DEBUG*/
+ } else { /* copy multiply referenced data */
+ if(!(child->data = (CARD8*)XieMalloc(child->bufSiz)))
+ return(FALSE);
+ memcpy((char*)child->data, (char*)parent->data, (int)child->bufSiz);
+ child->parent = NULL; /* de-reference child from parent */
+ --parent->refCnt;
+ BYTES += child->bufSiz; /*DEBUG*/
+ }
+ child->format = NULL; /* kill per-strip format pointer */
+ }
+ /* transfer the entire list of input strips to the output
+ */
+ if(ListEmpty(i_head))
+ ListInit(o_head);
+ else {
+ i_head->flink->blink = (stripPtr)o_head;
+ i_head->blink->flink = (stripPtr)o_head;
+ *o_head = *i_head;
+ ListInit(i_head);
+ }
+ return(TRUE);
+} /* end DebriefStrips */
+
+
+/*------------------------------------------------------------------------
+------------------------- Free a whole list of strips --------------------
+------------------------------------------------------------------------*/
+void FreeStrips(stripLstPtr head)
+{
+ while( !ListEmpty(head) ) {
+ stripPtr strip;
+
+ RemoveMember(strip, head->flink);
+ free_strip(NULL, strip);
+ }
+} /* end FreeStrips */
+
+
+/*------------------------------------------------------------------------
+------------------------ Input from PutClientData ------------------------
+------------------------------------------------------------------------*/
+static int import_data(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD8 band,
+ CARD8 *data,
+ CARD32 len,
+ BOOL final)
+{
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = &pet->receptor[IMPORT];
+ bandPtr bnd = &rcp->band[band];
+ bandMsk msk = 1<<band;
+ stripPtr strip;
+
+ if(!((rcp->admit | rcp->bypass) & msk))
+ return(TRUE); /* drop unwanted data */
+
+ /* make a strip and fill it in the info from the client
+ * (the format info was supplied with the element and technique parameters)
+ */
+ if(!(strip = make_strip(flo,bnd->format,bnd->maxGlobal,len,len,FALSE)))
+ AllocError(flo,ped, return(FALSE));
+ strip->final = final;
+ strip->data = data;
+ strip->bufSiz = len;
+
+ if(rcp->bypass & msk) {
+ put_strip(flo,pet,strip); /* pass it downstream */
+ if(!strip->flink)
+ free_strip(flo,strip); /* nobody wanted it */
+ } else {
+ bnd->maxGlobal = strip->end + 1;
+ bnd->available += len;
+ rcp->ready |= msk;
+ InsertMember(strip,bnd->stripLst.blink);
+ if ((bnd->final = final) != 0) {
+ if(!(rcp->admit &= ~msk))
+ --pet->admissionCnt;
+ --flo->floTex->imports;
+ }
+ }
+ /* fire up the scheduler -- then we're outa here */
+ return( Execute(flo,pet) );
+} /* end import_data */
+
+
+/*------------------------------------------------------------------------
+-------------------------- Output for GetClientData ----------------------
+------------------------------------------------------------------------*/
+static int export_data(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD8 band,
+ CARD32 maxLen,
+ BOOL term)
+{
+ BOOL release = FALSE, final = FALSE;
+ stripLstPtr lst = &ped->outFlo.output[band];
+ stripPtr strip = NULL;
+ CARD32 bytes, want = maxLen;
+ CARD8 state, *data;
+
+ /* if this is multi-byte data, make sure we send/swap complete aggregates
+ */
+ if(ped->swapUnits[band] > 1)
+ want &= ~(ped->swapUnits[band]-1);
+
+ if ((bytes = ListEmpty(lst) ? 0 : min(lst->flink->length, want)) != 0) {
+ strip = lst->flink;
+ data = strip->data + (strip->bitOff>>3);
+ if(strip->length -= bytes) {
+ strip->start += bytes;
+ strip->bitOff += bytes<<3;
+ } else {
+ RemoveMember(strip, strip);
+ final = strip->final;
+ release = TRUE;
+ if(ListEmpty(lst))
+ ped->outFlo.ready &= ~(1<<band);
+ }
+ } else {
+ data = NULL;
+ }
+ if(final)
+ flo->floTex->exports--;
+ else if(term) {
+ /* shut down the output band prematurely */
+ ped->outFlo.ready &= ~(1<<band);
+ disable_dst(flo,ped->peTex,&ped->peTex->emitter[band]);
+ }
+ /* figure out our current state and send a reply to the client
+ */
+ state = ped->outFlo.ready & 1<<band ? xieValExportMore
+ : ped->outFlo.active & 1<<band ? xieValExportEmpty
+ : xieValExportDone;
+ SendClientData(flo,ped,data,bytes,ped->swapUnits[band],state);
+ if(release)
+ free_strip(flo,strip);
+
+ return(bytes ? Execute(flo,NULL) : TRUE);
+} /* end export_data */
+
+
+/*------------------------------------------------------------------------
+----------- Query flo elements involved in client data transport ---------
+------------------------------------------------------------------------*/
+static int query_data(
+ floDefPtr flo,
+ xieTypPhototag **list,
+ CARD16 *pending,
+ CARD16 *available)
+{
+ peDefPtr ped;
+ pedLstPtr lst = ListEmpty(&flo->optDAG) ? &flo->defDAG : &flo->optDAG;
+ CARD32 exdex;
+
+ *pending = *available = 0;
+ if(!(*list = (xieTypPhototag *)XieMalloc(flo->peCnt * sz_xieTypPhototag)))
+ FloAllocError(flo,0,0, return(FALSE));
+
+ /* find all the import elements that need client data */
+ for(ped = lst->flink; ped; ped = ped->clink)
+ if(ped->flags.putData && ped->peTex->admissionCnt)
+ *list[(*pending)++] = ped->phototag;
+
+ /* find all the export elements that have client data */
+ exdex = *pending + (*pending & 1);
+ for(ped = lst->blink; ped; ped = ped->clink)
+ if(ped->flags.getData && ped->outFlo.ready)
+ *list[exdex + (*available)++] = ped->phototag;
+
+ return(TRUE);
+} /* end query_data */
+
+
+/*------------------------------------------------------------------------
+---- make a strip containing the specified number of contiguous bytes ----
+------------------------------------------------------------------------*/
+static CARD8* make_bytes(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 contig,
+ Bool purge)
+{
+ stripPtr strip = bnd->stripLst.blink;
+ CARD32 limit, size, units;
+ Bool avail = (!ListEmpty(&bnd->stripLst) && bnd->current >= strip->start &&
+ bnd->current + contig <= strip->start + strip->bufSiz);
+
+ if(purge && !avail && put_data(flo,pet,bnd))
+ return(bnd->data = NULL); /* force element to suspend processing */
+
+ if(_is_global(bnd))
+ return(get_data(flo,pet,bnd,contig,FALSE)); /* "current" is available */
+
+ if(avail) {
+ /* extend the available space in our current strip
+ */
+ limit = bnd->current + contig;
+ bnd->available += limit - bnd->maxGlobal;
+ bnd->maxGlobal = limit;
+ strip->end = limit - 1;
+ strip->length = limit - strip->start;
+ } else {
+ /* time to make a fresh strip
+ */
+ units = bnd->current + contig - bnd->maxGlobal;
+ size = units + Align(units,flo->floTex->stripSize);
+ if(!(strip = make_strip(flo,bnd->format,bnd->maxGlobal,units,size,TRUE)))
+ AllocError(flo,pet->peDef, return(NULL));
+
+ bnd->available += strip->length;
+ bnd->maxGlobal = strip->end + 1;
+ InsertMember(strip,bnd->stripLst.blink);
+ }
+ /* update our bandRec with the results */
+ bnd->strip = strip;
+ bnd->minLocal = max(bnd->minGlobal,strip->start);
+ bnd->maxLocal = strip->end + 1;
+ return(bnd->data = _byte_ptr(bnd));
+} /* end make_bytes */
+
+
+/*------------------------------------------------------------------------
+--- Find or make a strip containing the unit specified by bnd->current ---
+------------------------------------------------------------------------*/
+static CARD8* make_lines(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ Bool purge)
+{
+ stripPtr strip = NULL;
+ formatPtr fmt;
+ CARD32 size, units;
+
+ if(purge && _release_ok(bnd) && put_data(flo,pet,bnd))
+ return(bnd->data = NULL); /* force element to suspend processing */
+
+ if(_is_global(bnd)) /* we already have it, just go find it */
+ return(get_data(flo,pet,bnd,(CARD32) 1,FALSE));
+
+ fmt = bnd->format;
+ if(bnd->current >= fmt->height)
+ return(NULL); /* trying to go beyond end of image */
+
+ while(bnd->current >= bnd->maxGlobal) {
+ /*
+ * re-use src if we're allowed to alter the data
+ */
+ if(!bnd->inPlace || !(strip = alter_data(flo,pet,bnd))) {
+ size = flo->floTex->stripSize;
+ units = size / bnd->pitch;
+ if(units == 0) { /* image bigger than standard strip */
+ units = 1;
+ size = bnd->pitch;
+ } else if(bnd->current + units > fmt->height) /* at end of image */
+ units = fmt->height - bnd->current;
+ strip = make_strip(flo,fmt,bnd->maxGlobal,units,size,TRUE);
+ }
+ if(!strip)
+ AllocError(flo,pet->peDef, return(NULL));
+ bnd->available += strip->length;
+ bnd->maxGlobal = strip->end + 1;
+ if(bnd->maxGlobal == fmt->height)
+ bnd->final = strip->final = TRUE;
+ InsertMember(strip,bnd->stripLst.blink);
+ }
+ /* update our bandRec with the results */
+ bnd->strip = strip;
+ bnd->minLocal = max(bnd->minGlobal,strip->start);
+ bnd->maxLocal = strip->end + 1;
+ return(bnd->data = _line_ptr(bnd));
+} /* end make_lines */
+
+
+/*------------------------------------------------------------------------
+-------------- load data map with pointers to specified data -------------
+------------------------------------------------------------------------*/
+static Bool map_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 map,
+ CARD32 unit,
+ CARD32 len,
+ Bool purge)
+{
+ CARD32 line, pitch;
+ CARD8 *next = (CARD8 *)NULL, *last = (CARD8 *)NULL;
+ CARD8 **ptr = bnd->dataMap + map;
+ stripPtr strip;
+
+ /* first map the last unit and then the first unit -- if we have to make
+ * strips, or if input strips aren't there, we may as well handle it now
+ */
+ if(len && map + len <= bnd->mapSize)
+ if(bnd->isInput) {
+ last = (CARD8*)GetSrc(flo,pet,bnd,unit+len-1,KEEP);
+ next = (CARD8*)GetSrc(flo,pet,bnd,unit,purge);
+ } else {
+ last = (CARD8*)GetDst(flo,pet,bnd,unit+len-1,KEEP);
+ next = (CARD8*)GetDst(flo,pet,bnd,unit,purge);
+ }
+ if(!next || !last)
+ return(FALSE); /* map too small or can't map first and last unit */
+
+ /* now walk through the strips and map all the lines (or bytes!)
+ */
+ strip = bnd->strip;
+ pitch = bnd->pitch;
+ line = unit;
+ while((*ptr++ = next) != last)
+ if(++line <= strip->end)
+ next += pitch;
+ else {
+ strip = strip->flink;
+ next = strip->data;
+ }
+ return(TRUE);
+} /* end map_data */
+
+
+/*------------------------------------------------------------------------
+------ Find the strip containing the unit specified by bnd->current ------
+------------------------------------------------------------------------*/
+static CARD8* get_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ CARD32 contig,
+ Bool purge)
+{
+ /* NOTE: get_data assumes that the caller has already verified that the
+ * beginning of the requested data is available in bnd->stripLst.
+ */
+ stripPtr strip = bnd->strip ? bnd->strip : bnd->stripLst.flink;
+
+ /* first get rid of extra baggage if we can
+ */
+ if(purge && _release_ok(bnd))
+ free_data(flo,pet,bnd);
+
+ strip = bnd->strip ? bnd->strip : bnd->stripLst.flink;
+ while(!ListEnd(strip,&bnd->stripLst))
+ if(bnd->current > strip->end)
+ strip = strip->flink; /* try the next strip */
+ else if(bnd->current < strip->start)
+ strip = strip->blink; /* try the previous strip */
+ else if(bnd->current+contig-1 <= strip->end ||
+ (strip = contig_data(flo,pet,bnd,strip,contig)))
+ break; /* we found or assembled it */
+ else
+ return(NULL); /* couldn't get enough bytes */
+
+ /* update our bandRec with the results
+ */
+ bnd->strip = strip;
+ bnd->minLocal = max(bnd->minGlobal,strip->start);
+ bnd->maxLocal = strip->end + 1;
+ bnd->data = _is_local_contig(bnd,contig) ? _line_ptr(bnd) : NULL;
+ return(bnd->data);
+} /* end get_data */
+
+
+/*------------------------------------------------------------------------
+------- move strip(s) onto awaiting receptor(s) or an export outFlo ------
+------------------------------------------------------------------------*/
+static Bool put_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd)
+{
+ bandMsk suspend = 0;
+ stripPtr strip;
+
+ /* transfer strips until we run out or reach the one we're working in
+ */
+ while(_release_ok(bnd)) {
+ RemoveMember(strip, bnd->stripLst.flink);
+ bnd->available -= strip->length;
+ bnd->minGlobal = strip->end + 1;
+
+ if(!(pet->emitting & 1<<bnd->band))
+ free_strip(flo,strip); /* output disabled */
+ else {
+ strip->flink = NULL;
+ suspend |= put_strip(flo,pet,strip); /* send it downstream */
+ if(!strip->flink)
+ free_strip(flo,strip); /* nobody wanted it! */
+ }
+ }
+ if(ListEmpty(&bnd->stripLst)) {
+ bnd->strip = NULL;
+ bnd->data = NULL;
+ if(bnd->final)
+ disable_dst(flo,pet,bnd);
+ }
+ return(suspend != 0);
+} /* end put_data */
+
+
+/*------------------------------------------------------------------------
+---------- free strip(s) from a receptor band or an emitter band ---------
+------------------------------------------------------------------------*/
+static void free_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd)
+{
+ bandMsk msk = 1<<bnd->band;
+
+ /* free strips until we run out or reach the one we're working in
+ */
+ while(_release_ok(bnd)) {
+ stripPtr strip;
+
+ RemoveMember(strip, bnd->stripLst.flink);
+ bnd->available -= strip->length - (bnd->minGlobal - strip->start);
+ bnd->minGlobal = strip->end + 1;
+ if(bnd->isInput && bnd->receptor->forward & msk)
+ forward_strip(flo,pet,strip);
+ else
+ free_strip(flo,strip);
+ }
+ /* a little bookkeeping to let the scheduler know where we're at
+ */
+ bnd->available -= bnd->current - bnd->minGlobal;
+ bnd->minGlobal = bnd->current;
+ if(bnd->isInput) {
+ CheckSrcReady(bnd,msk);
+ }
+ if(bnd->final && bnd->isInput && ListEmpty(&bnd->stripLst)) {
+ bnd->receptor->active &= ~msk;
+ bnd->receptor->attend &= ~msk;
+ }
+ if(!(bnd->data = _is_local(bnd) ? _line_ptr(bnd) : NULL))
+ bnd->strip = NULL;
+} /* end free_data */
+
+
+/*------------------------------------------------------------------------
+---- take list of strips passed in (most likely from a photomap), clone --
+---- the headers, and hang them on the input receptor to make the data --
+---- accessable by standard macros --
+------------------------------------------------------------------------*/
+static Bool import_strips(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripLstPtr strips)
+{
+ stripPtr strip = strips->flink, clone = NULL;
+ receptorPtr rcp = pet->receptor;
+ CARD8 msk = 1<<bnd->band;
+
+ for(strip = strips->flink; !ListEnd(strip,strips); strip = strip->flink) {
+
+ if(!(clone = clone_strip(flo, strip)))
+ AllocError(flo,pet->peDef, return(FALSE));
+
+ clone->format = bnd->format; /* this had better be right! */
+
+ bnd->available += clone->length;
+
+ InsertMember(clone,bnd->stripLst.blink);
+ }
+ bnd->final = clone->final;
+ bnd->maxGlobal = clone->end + 1;
+
+ if(!(rcp->admit &= ~msk))
+ --pet->admissionCnt;
+
+ return(TRUE);
+} /* end import_strips */
+
+
+/*------------------------------------------------------------------------
+--------- Clone a strip and pass it on to the element's recipients -------
+------------------------------------------------------------------------*/
+static Bool pass_strip(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripPtr strip)
+{
+ stripPtr clone;
+
+ if(!(pet->emitting & 1<<bnd->band))
+ return(TRUE); /* output disabled */
+
+ if(!(clone = clone_strip(flo, strip)))
+ AllocError(flo,pet->peDef, return(FALSE));
+
+ clone->format = bnd->format; /* this had better be right! */
+
+ put_strip(flo,pet,clone); /* give to downstream receptors */
+ if(!clone->flink)
+ free_strip(flo,clone); /* nobody wanted it */
+
+ if ((bnd->final = strip->final) != 0)
+ disable_dst(flo,pet,bnd);
+
+ return(TRUE);
+} /* end pass_strip */
+
+
+/*------------------------------------------------------------------------
+------------ see if it's ok to over write the data in a src strip --------
+------------------------------------------------------------------------*/
+static Bool alter_src(
+ floDefPtr flo,
+ peTexPtr pet,
+ stripPtr strip)
+{
+ stripPtr chk;
+
+ if(!strip->data || strip->Xowner)
+ return(FALSE);
+
+ /* make sure there are no other users of this strip's data
+ */
+ for(chk = strip; chk->parent && chk->refCnt == 1; chk = chk->parent);
+ return(chk->refCnt == 1);
+} /* end alter_src */
+
+
+/*------------------------------------------------------------------------
+--------- pass all remaining input for this band straight through --------
+------------------------------------------------------------------------*/
+static void bypass_src(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr sbnd)
+{
+ stripPtr strip;
+ bandPtr dbnd = &pet->emitter[sbnd->band];
+ CARD8 *src;
+ CARD8 *dst;
+
+ if(sbnd->receptor->active & 1<<sbnd->band) {
+ /*
+ * if there's lingering data, see that it gets to its destination
+ */
+ for(src = (CARD8*)GetCurrentSrc(flo,pet,sbnd),
+ dst = (CARD8*)GetCurrentDst(flo,pet,dbnd);
+ src && dst;
+ src = (CARD8*)GetNextSrc(flo,pet,sbnd,KEEP),
+ dst = (CARD8*)GetNextDst(flo,pet,dbnd,!src)) {
+ if(src != dst)
+ memcpy((char*)dst, (char*)src, (int)dbnd->pitch);
+ }
+ /* if there's a partial strip still here, adjust its length
+ */
+ if(!ListEmpty(&dbnd->stripLst)) {
+ strip = dbnd->stripLst.blink;
+ if(strip->start < dbnd->current) {
+ strip->end = dbnd->current - 1;
+ strip->length = dbnd->current - strip->start;
+ put_data(flo,pet,dbnd);
+ }
+ }
+ /* shut down the src band, or the dst band if we're all done
+ */
+ if(pet->emitting &= ~(1<<dbnd->band))
+ disable_src(flo,pet,sbnd,FLUSH);
+ else
+ disable_dst(flo,pet,dbnd);
+ }
+ /* if we're still accepting input, the remainder will bypass this element
+ */
+ sbnd->receptor->bypass |= 1<<sbnd->band;
+} /* end bypass_src */
+
+
+/*------------------------------------------------------------------------
+---------- disable src band and discard any remaining input data ---------
+------------------------------------------------------------------------*/
+static void disable_src(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ Bool purge)
+{
+ bandMsk msk = 1<<bnd->band;
+
+ if(bnd->receptor->admit & msk && pet->peDef->flags.putData)
+ --flo->floTex->imports; /* one less import client band */
+
+ if(bnd->receptor->admit && !(bnd->receptor->admit &= ~msk))
+ --pet->admissionCnt; /* one less receptor needing data */
+
+ bnd->final = TRUE;
+
+ if(purge)
+ FreeData(flo,pet,bnd,bnd->maxGlobal);
+} /* end disable_src */
+
+
+/*------------------------------------------------------------------------
+--- disable dst band -- also disables all src's if no dst bands remain ---
+------------------------------------------------------------------------*/
+static void disable_dst(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr dbnd)
+{
+ peDefPtr ped = pet->peDef;
+ receptorPtr rcp, rend = &pet->receptor[ped->inCnt];
+ bandMsk mask;
+ bandPtr sbnd;
+
+ /* if this is the last emitter band to turn off and this isn't an import
+ * client element, we'll step thru all the receptor bands and kill them too
+ */
+ if(!(pet->emitting &= ~(1<<dbnd->band)) && !ped->flags.putData)
+ for(rcp = pet->receptor; rcp < rend; ++rcp)
+ for(mask = 1, sbnd = rcp->band; rcp->active; mask <<= 1, ++sbnd)
+ if(rcp->active & mask)
+ disable_src(flo,pet,sbnd,TRUE);
+ if(ped->flags.getData) {
+ ped->outFlo.active &= ~(1<<dbnd->band);
+ if(!(ped->outFlo.ready & 1<<dbnd->band))
+ flo->floTex->exports--;
+ }
+} /* end disable_dst */
+/*------------------------------------------------------------------------
+- Get permission for an emitter to write into an existing receptor strip -
+------------------------------------------------------------------------*/
+static stripPtr alter_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr db)
+{
+ bandPtr sb = db->inPlace;
+ stripPtr chk, strip = sb->strip ? sb->strip : sb->stripLst.flink;
+
+ /* search through the source data for the corresponding line number
+ */
+ while(!ListEnd(strip,&sb->stripLst))
+ if(db->current > strip->end)
+ strip = strip->flink;
+ else if(db->current < strip->start)
+ strip = strip->blink;
+ else if(!strip->data || strip->Xowner)
+ break;
+ else {
+ /* make sure there are no other users of this strip's data
+ */
+ for(chk = strip; chk->parent && chk->refCnt == 1; chk = chk->parent);
+ if(chk->refCnt > 1)
+ break;
+ return(clone_strip(flo,strip)); /* return a clone of the src strip */
+ }
+ return(NULL);
+} /* end alter_data */
+
+
+/*------------------------------------------------------------------------
+---------- enter with a strip containing at least one byte of data ------
+---------- {if a new strip must be created (to hold at least ------
+---------- contig bytes), available data will be copied to it} ------
+---------- return with a strip containing "contig" contiguous bytes ------
+------------------------------------------------------------------------*/
+static stripPtr contig_data(
+ floDefPtr flo,
+ peTexPtr pet,
+ bandPtr bnd,
+ stripPtr i_strip,
+ CARD32 contig)
+{
+ stripPtr o_strip, n_strip;
+ CARD32 limit, start, skip, avail = i_strip->end - bnd->current + 1;
+
+ if(contig <= i_strip->bufSiz - i_strip->length + avail)
+ o_strip = i_strip;
+ else {
+ /* i_strip too small, make a new one and copy available data into it
+ */
+ if(!(o_strip = make_strip(flo, bnd->format, bnd->current, avail,
+ contig + Align(contig, flo->floTex->stripSize),
+ TRUE)))
+ AllocError(flo,pet->peDef, return(NULL));
+ InsertMember(o_strip,i_strip);
+ memcpy((char*)o_strip->data,
+ (char*)&i_strip->data[bnd->current-i_strip->start], (int)avail);
+ if(i_strip->length -= avail)
+ i_strip->end -= avail;
+ else {
+ RemoveMember(n_strip,i_strip);
+ o_strip->final = n_strip->final;
+ free_strip(flo, n_strip);
+ }
+ }
+ /* determine how far we can extend our o_strip
+ */
+ if(bnd->current + contig <= bnd->maxGlobal)
+ limit = bnd->current + contig; /* limit to data needed */
+ else
+ limit = bnd->maxGlobal; /* limit to data available */
+
+ /* if there are more strips beyond "o_strip", transfer the needed amount of
+ * data into our mega-strip (free any strips that we completely consume)
+ */
+ for(start = o_strip->end+1; start < limit; start += avail) {
+ n_strip = o_strip->flink;
+ skip = start - n_strip->start;
+ avail = min(n_strip->length - skip, limit - start);
+ memcpy((char*)&o_strip->data[o_strip->length],
+ (char*)&n_strip->data[skip], (int)avail);
+ o_strip->end += avail;
+ o_strip->length += avail;
+ if(avail+skip == n_strip->length) {
+ RemoveMember(n_strip, n_strip);
+ o_strip->final = n_strip->final;
+ free_strip(flo, n_strip);
+ }
+ }
+ if(!bnd->isInput) {
+ limit = bnd->current + contig;
+ bnd->available += limit - bnd->maxGlobal;
+ bnd->maxGlobal = limit;
+ o_strip->end = limit - 1;
+ o_strip->length = limit - o_strip->start;
+ }
+ return(o_strip);
+} /* end contig_data */
+
+
+/*------------------------------------------------------------------------
+---------------------------- Make a new strip ----------------------------
+------------------------------------------------------------------------*/
+static stripPtr make_strip(
+ floDefPtr flo,
+ formatPtr fmt,
+ CARD32 start,
+ CARD32 units,
+ CARD32 bytes,
+ Bool allocData)
+{
+ stripPtr strip;
+ stripLstPtr cache = &flo->floTex->stripHead;
+ Bool cachable = allocData && bytes == flo->floTex->stripSize;
+
+ if(!ListEmpty(cache) && (cachable || !cache->blink->data))
+ RemoveMember(strip, cachable ? cache->flink : cache->blink);
+ else if ((strip = (stripPtr) XieMalloc(sizeof(stripRec))) != 0) {
+ strip->data = NULL;
+ ++STRIPS; /*DEBUG*/
+ }
+ if(strip) {
+ strip->flink = NULL;
+ strip->parent = NULL;
+ strip->format = fmt;
+ strip->refCnt = 1;
+ strip->Xowner = !allocData;
+ strip->canonic = IsCanonic(fmt->class);
+ strip->final = FALSE;
+ strip->cache = cachable;
+ strip->start = start;
+ strip->end = start + units - 1;
+ strip->length = units;
+ strip->bitOff = 0;
+ strip->bufSiz = bytes;
+
+ if(allocData && bytes && !strip->data)
+ if ((strip->data = (CARD8 *) XieCalloc(bytes)) != 0) /* calloc to hush purify */
+ BYTES += bytes; /*DEBUG*/
+ else
+ strip = free_strip(NULL,strip);
+ }
+ return(strip);
+} /* end make_strip */
+
+
+/*------------------------------------------------------------------------
+---- Clone a new modifiable strip wrapper for existing read-only data ----
+------------------------------------------------------------------------*/
+static stripPtr clone_strip(floDefPtr flo, stripPtr in_strip)
+{
+ stripLstPtr cache = &flo->floTex->stripHead;
+ stripPtr out_strip;
+
+ if(ListEmpty(cache) || cache->blink->data) {
+ out_strip = (stripPtr) XieMalloc(sizeof(stripRec));
+ ++STRIPS; /*DEBUG*/
+ } else {
+ RemoveMember(out_strip, cache->blink);
+ }
+ if(out_strip) {
+ *out_strip = *in_strip;
+ out_strip->flink = NULL;
+ out_strip->parent = in_strip;
+ out_strip->refCnt = 1;
+ ++in_strip->refCnt;
+ }
+ return(out_strip);
+} /* end clone_strip */
+
+
+/*------------------------------------------------------------------------
+---------------- Put strip on each receptor fed by an element ------------
+------------------------------------------------------------------------*/
+static bandMsk put_strip(floDefPtr flo, peTexPtr pet, stripPtr strip)
+{
+ peTexPtr dst;
+ inFloPtr inf;
+ bandPtr bnd;
+ stripPtr clone;
+ receptorPtr rcp;
+ CARD8 band = strip->format->band;
+ bandMsk repmsk, mask = 1<<band, suspend = 0;
+
+ if(pet->peDef->flags.export) {
+ pet->outFlo->ready |= mask;
+ /*
+ * give to DIXIE via our outFlo; if we're not first in line, make a clone
+ */
+ if(!(clone = strip->flink ? clone_strip(flo,strip) : strip))
+ AllocError(flo,pet->peDef, return(suspend));
+ InsertMember(clone,pet->outFlo->output[band].blink);
+ ++flo->floTex->putCnt;
+ return(suspend);
+ }
+ /* hang this strip on the receptor of each of our interested recipients
+ */
+ for(inf = pet->outFlo->outChain; inf; inf = inf->outChain) {
+ if(inf->format[band].class != strip->format->class)
+ continue;
+ dst = inf->ownDef->peTex;
+ rcp = &dst->receptor[inf->index];
+ bnd = &rcp->band[band];
+
+ if(rcp->bypass & mask) {
+ suspend |= put_strip(flo,dst,strip); /* just passin' through */
+ continue;
+ } else if(!(rcp->admit & mask)) {
+ continue; /* data not wanted here */
+ }
+ if(strip->final && !(rcp->admit &= ~mask))
+ --dst->admissionCnt; /* all bands complete */
+ /*
+ * give the data to the intended receptor band
+ */
+ for(repmsk = mask; repmsk <= rcp->active; ++bnd, repmsk <<= 1) {
+ if(rcp->active & repmsk) {
+ bnd->final = strip->final;
+ bnd->maxGlobal = strip->end + 1;
+ bnd->available += strip->length;
+ Schedule(flo,dst,rcp,bnd,repmsk); /* schedule if runnable */
+ suspend |= dst->scheduled;
+ /*
+ * first recipient gets the original, all others get clones
+ */
+ if(!(clone = strip->flink ? clone_strip(flo,strip) : strip))
+ AllocError(flo,dst->peDef, break);
+ InsertMember(clone,bnd->stripLst.blink);
+ ++flo->floTex->putCnt;
+ }
+ /* see if we should replicate the data through the other bands
+ */
+ if(!rcp->band[0].replicate) break;
+ }
+ }
+ return(suspend);
+} /* end put_strip */
+
+
+/*------------------------------------------------------------------------
+------------ forward input data downstream (re-buffer if Xowner) --------
+------------ primarily used to pass compressed data to a photomap --------
+------------------------------------------------------------------------*/
+static void forward_strip(floDefPtr flo, peTexPtr pet, stripPtr fwd)
+{
+ if(!pet->peDef->flags.putData) {
+ /* non-client data -- just pass it along
+ */
+ fwd->flink = NULL;
+ put_strip(flo,pet,fwd); /* give to downstream receptors */
+ if(!fwd->flink)
+ free_strip(flo,fwd); /* hmm, nobody wanted it */
+ } else {
+ /* since this is client data we must copy it before passing it along
+ */
+ stripLstPtr lst = &pet->outFlo->output[fwd->format->band];
+ stripPtr tmp = ListEmpty(lst) ? NULL : lst->flink;
+ int maxlen = flo->floTex->stripSize, datlen;
+ int overlap = tmp ? tmp->end - fwd->start + 1 : 0;
+ int start = fwd->start + overlap;
+ int size = fwd->length - overlap;
+ CARD8 *data = &fwd->data[overlap];
+ Bool final = FALSE;
+
+ while(!final) {
+ if(ListEmpty(lst))
+ if ((tmp = make_strip(flo, fwd->format, start, 0, maxlen, TRUE)) != 0) {
+ InsertMember(tmp,lst->flink);
+ } else {
+ free_strip(flo,fwd);
+ AllocError(flo,pet->peDef, return);
+ }
+ if(size) {
+ datlen = min(size, tmp->bufSiz - tmp->length);
+ memcpy((char*)&tmp->data[tmp->length], (char*)data, (int)datlen);
+ tmp->length += datlen;
+ tmp->end += datlen;
+ data += datlen;
+ size -= datlen;
+ }
+ if((!size && fwd->final) || tmp->length == tmp->bufSiz) {
+ RemoveMember(tmp,lst->flink);
+ start = tmp->start + tmp->length;
+ tmp->final = final = fwd->final && !size;
+ tmp->canonic = fwd->canonic;
+ tmp->flink = NULL;
+ put_strip(flo,pet,tmp); /* give to downstream receptors */
+ if(!tmp->flink)
+ free_strip(flo,tmp);
+ }
+ if(!size) break;
+ }
+ free_strip(flo,fwd);
+ }
+} /* end forward_strip */
+
+
+/*------------------------------------------------------------------------
+----------------------------- Get rid of a strip -------------------------
+------------------------------------------------------------------------*/
+static stripPtr free_strip(floDefPtr flo, stripPtr strip)
+{
+ lstPtr cache;
+
+ if(strip && !--strip->refCnt) {
+ /* since this was the last reference we're going to nuke this strip,
+ * if this was a clone, free the parent and forget where the data was
+ */
+ if(strip->parent) {
+ free_strip(flo, strip->parent);
+ strip->data = NULL;
+ } else if(strip->data) {
+ /* if the data buffer belongs to coreX or is uncachable, nuke it */
+ if(strip->Xowner)
+ strip->data = NULL;
+ else if(!flo || !strip->cache) {
+ strip->data = (CARD8 *) XieFree(strip->data);
+ BYTES -= strip->bufSiz; /*DEBUG*/
+ }
+ }
+ if(flo) {
+ /* strips with standard data buffers are cached at the front
+ * strips without data buffers go at the back
+ */
+ strip->refCnt = 1;
+ strip->parent = NULL;
+ cache = (strip->data
+ ? (lstPtr)&flo->floTex->stripHead
+ : (lstPtr) flo->floTex->stripHead.blink);
+ InsertMember(strip,cache);
+ } else {
+ XieFree(strip);
+ --STRIPS; /*DEBUG*/
+ }
+ }
+ return(NULL);
+} /* end free_strip */
+
+/* end module strip.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/Imakefile b/xc/programs/Xserver/XIE/mixie/export/Imakefile
new file mode 100644
index 000000000..54a0a042a
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/Imakefile
@@ -0,0 +1,37 @@
+XCOMM $XConsortium: Imakefile /main/6 1996/09/28 16:56:01 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/export/Imakefile,v 3.5 1998/07/25 08:05:10 dawes Exp $
+XCOMM build device dependent machine independent export element objs
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = meclut.c mecphoto.c medraw.c medrawp.c \
+ mefax.c melut.c mephoto.c meuncomp.c schoice.c
+
+OBJS1 = meclut.o mecphoto.o medraw.o medrawp.o \
+ mefax.o melut.o mephoto.o meuncomp.o schoice.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = mechist.c mecroi.c meroi.c mejpeg.c
+OBJS2 = mechist.o mecroi.o meroi.o mejpeg.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions -I../jpeg
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(mexp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/export/mechist.c b/xc/programs/Xserver/XIE/mixie/export/mechist.c
new file mode 100644
index 000000000..76f820b2f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mechist.c
@@ -0,0 +1,366 @@
+/* $TOG: mechist.c /main/5 1998/02/09 16:12:42 kaleb $ */
+/**** module mechist.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mechist.c -- DDXIE export client histogram element
+
+ Larry Hare -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mechist.c,v 3.4 1998/10/25 07:11:52 dawes Exp $ */
+
+#define _XIEC_MECHIST
+#define _XIEC_ECHIST
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+/* routines used internal to this module
+ */
+static int CreateECHist(floDefPtr flo, peDefPtr ped);
+static int InitializeECHist(floDefPtr flo, peDefPtr ped);
+static int ActivateECHist(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetECHist(floDefPtr flo, peDefPtr ped);
+static int DestroyECHist(floDefPtr flo, peDefPtr ped);
+
+/* DDXIE ExportClientHist entry points
+ */
+static ddElemVecRec ECHistVec = {
+ CreateECHist,
+ InitializeECHist,
+ ActivateECHist,
+ (xieIntProc)NULL,
+ ResetECHist,
+ DestroyECHist
+ };
+
+/* declarations for private structures and actions procs ... */
+
+typedef struct {
+ pointer histdata;
+ CARD32 histsize;
+ void (*histproc) ();
+} miECHistRec, *miECHistPtr;
+
+extern void doHistQ(pointer svoid, CARD32 *hist, CARD32 clip, CARD32 x, CARD32 dx);
+extern void doHistP(pointer svoid, CARD32 *hist, CARD32 clip, CARD32 x, CARD32 dx);
+extern void doHistB(pointer svoid, CARD32 *hist, CARD32 clip, CARD32 x, CARD32 dx);
+extern void doHistb(pointer svoid, CARD32 *hist, CARD32 clip, CARD32 x, CARD32 dx);
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeECHist(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = ECHistVec;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateECHist(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+
+ /* always force syncing between inputs (is nop if only one input) */
+ return MakePETex(flo, ped, sizeof(miECHistRec), SYNC, NO_SYNC);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeECHist(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientHistogram *raw =
+ (xieFloExportClientHistogram *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ miECHistPtr pvt = (miECHistPtr)(pet->private);
+ bandPtr iband;
+ CARD32 nclip;
+
+ iband = &(pet->receptor[SRCtag].band[0]);
+
+ switch (iband->format->class) {
+ case QUAD_PIXEL: pvt->histproc = doHistQ;
+ break;
+ case PAIR_PIXEL: pvt->histproc = doHistP;
+ break;
+ case BYTE_PIXEL: pvt->histproc = doHistB;
+ break;
+ case BIT_PIXEL: pvt->histproc = doHistb;
+ break;
+ default: ImplementationError(flo, ped, return(FALSE));
+ }
+
+ SetDepthFromLevels(iband->format->levels, nclip);
+ pvt->histsize = nclip = 1 << nclip;
+
+ if (!(pvt->histdata = (pointer ) XieCalloc(nclip * sizeof(CARD32))))
+ AllocError(flo,ped,return(FALSE));
+
+ return InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,1,NO_BANDS) &&
+ InitProcDomain(flo, ped, raw->domainPhototag,
+ raw->domainOffsetX, raw->domainOffsetY) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateECHist(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientHistogram *raw =
+ (xieFloExportClientHistogram *)ped->elemRaw;
+ miECHistPtr pvt = (miECHistPtr)(pet->private);
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &rcp->band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ pointer src;
+
+ src = GetCurrentSrc(flo,pet,sbnd);
+ while(src && SyncDomain(flo,ped,sbnd,FLUSH)) {
+ INT32 x = 0, dx;
+ while ((dx = GetRun(flo,pet,sbnd)) != 0) {
+ if (dx > 0) {
+ (*(pvt->histproc)) (src,pvt->histdata,pvt->histsize,x,dx);
+ x += dx;
+ } else
+ x -= dx;
+ }
+ src = GetNextSrc(flo,pet,sbnd,FLUSH);
+ }
+ FreeData(flo,pet,sbnd,sbnd->current);
+
+ /* if finished with accumulation, send back to client */
+ if (!src && sbnd->final) {
+ CARD32 *hist;
+ CARD32 ilev, nlev = sbnd->format->levels;
+ CARD32 nhist = 0;
+ xieTypHistogramData *histpair;
+
+ /* Count populated cells */
+ for (ilev = 0, hist = (CARD32*)pvt->histdata; ilev < nlev; ilev++, hist++)
+ if (*hist)
+ nhist++;
+
+ if(nhist) {
+ if(!(histpair = (xieTypHistogramData*)GetDstBytes(flo,pet,dbnd,0,
+ nhist * sizeof(xieTypHistogramData),KEEP)))
+ return FALSE;
+
+ for (ilev = 0, hist = (CARD32*)pvt->histdata; ilev < nlev; ilev++, hist++)
+ if (*hist) {
+ histpair->count = *hist;
+ histpair->value = ilev;
+ histpair++;
+ }
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd, nhist * sizeof(xieTypHistogramData));
+ } else {
+ /* signal that there is no data to send
+ */
+ DisableDst(flo,pet,dbnd);
+ }
+ switch(raw->notify) {
+ case xieValFirstData: /* fall thru */
+ case xieValNewData: SendExportAvailableEvent(flo,ped,
+ 0, /* band */
+ nhist, /* count */
+ 0,0); /* unused */
+ default: break;
+ }
+ }
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetECHist(floDefPtr flo, peDefPtr ped)
+{
+ miECHistPtr pvt = (miECHistPtr) ped->peTex->private;
+
+ /* free any dynamic private data */
+ if (pvt->histdata)
+ pvt->histdata = (pointer ) XieFree(pvt->histdata);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyECHist(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+------------------------ action procs to do histogram --------------------
+------------------------------------------------------------------------*/
+
+void doHistQ(
+ pointer svoid,
+ CARD32 *hist,
+ CARD32 clip,
+ CARD32 x,
+ CARD32 dx)
+{
+ QuadPixel *src = (QuadPixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++;
+}
+
+void doHistP(
+ pointer svoid,
+ CARD32 *hist,
+ CARD32 clip,
+ CARD32 x,
+ CARD32 dx)
+{
+ PairPixel *src = (PairPixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++;
+}
+
+void doHistB(
+ pointer svoid,
+ CARD32 *hist,
+ CARD32 clip,
+ CARD32 x,
+ CARD32 dx)
+{
+ BytePixel *src = (BytePixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++; /* could pad to 256 .. */
+}
+
+void doHistb(
+ pointer svoid,
+ CARD32 *hist,
+ CARD32 clip,
+ CARD32 x,
+ CARD32 dx)
+{
+ LogInt *src = (LogInt *) svoid;
+ CARD32 cnt0 = 0, cnt1 = 0;
+
+ /* does anyone actually do bit histograms? :-) */
+ for ( ; dx > 0 ; dx--, x++)
+ if (LOG_tstbit(src,x))
+ cnt1++;
+ else
+ cnt0++;
+
+ hist[0] += cnt0;
+ hist[1] += cnt1;
+}
+
+/* end module mechist.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/meclut.c b/xc/programs/Xserver/XIE/mixie/export/meclut.c
new file mode 100644
index 000000000..06832c655
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/meclut.c
@@ -0,0 +1,229 @@
+/* $TOG: meclut.c /main/7 1998/02/09 16:12:47 kaleb $ */
+/**** module meclut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ meclut.c -- DDXIE export client LUT element
+
+ Larry Hare -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/meclut.c,v 3.4 1998/10/25 07:11:53 dawes Exp $ */
+
+#define _XIEC_MECLUT
+#define _XIEC_ECLUT
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <lut.h>
+#include <memory.h>
+
+
+/* routines used internal to this module
+ */
+static int CreateECLUT(floDefPtr flo, peDefPtr ped);
+static int InitializeECLUT(floDefPtr flo, peDefPtr ped);
+static int ActivateECLUT(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetECLUT(floDefPtr flo, peDefPtr ped);
+static int DestroyECLUT(floDefPtr flo, peDefPtr ped);
+
+/* DDXIE ExportClientLUT entry points
+ */
+static ddElemVecRec ECLUTVec = {
+ CreateECLUT,
+ InitializeECLUT,
+ ActivateECLUT,
+ (xieIntProc)NULL,
+ ResetECLUT,
+ DestroyECLUT
+ };
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeECLUT(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = ECLUTVec;
+
+ return(TRUE);
+} /* end miAnalyzeECLUT */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateECLUT(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC);
+} /* end CreateECLUT */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeECLUT(floDefPtr flo, peDefPtr ped)
+{
+ return InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeECLUT */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateECLUT(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientLUT *raw = (xieFloExportClientLUT *)ped->elemRaw;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp->inFlo->bands;
+ bandPtr dbnd, sbnd = &rcp->band[0];
+ CARD32 *start = &(raw->start0);
+ CARD32 *length = &(raw->length0);
+ CARD8 *src, *dst;
+ CARD32 b, pitch, nentry, dlen;
+ Bool swizzle;
+
+ swizzle = (bands == 3) && (raw->bandOrder != xieValLSFirst);
+
+ for(b = 0; b < bands; ++sbnd, ++b) {
+
+ if (!(src = (CARD8*)GetCurrentSrc(flo,pet,sbnd))) continue;
+
+ dbnd = &pet->emitter[swizzle ? xieValMaxBands - b - 1 : b];
+
+ nentry = length[b] ? length[b] : sbnd->format->height;
+ pitch = LutPitch(sbnd->format->levels);
+ dlen = nentry * pitch;
+
+ if (!(dst = (CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,dlen,KEEP)))
+ return FALSE;
+
+ if (start[b])
+ src += start[b] * pitch; /* Adjust via start[b] && length[b] */
+
+ memcpy(dst,src,dlen);
+
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+
+ switch(raw->notify) {
+ case xieValFirstData: /* fall thru */
+ case xieValNewData: SendExportAvailableEvent(flo,ped,b,nentry,0,0);
+ default: break;
+ }
+ }
+ return(TRUE);
+} /* end ActivateECLUT */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetECLUT(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetECLUT */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyECLUT(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyECLUT */
+
+/* end module meclut.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/mecphoto.c b/xc/programs/Xserver/XIE/mixie/export/mecphoto.c
new file mode 100644
index 000000000..9045b9e23
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mecphoto.c
@@ -0,0 +1,824 @@
+/* $TOG: mecphoto.c /main/10 1998/02/09 16:12:51 kaleb $ */
+/**** module mecphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mecphoto.c -- DDXIE export client photo element
+
+ Robert NC Shelley && Dean Verheiden -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mecphoto.c,v 3.4 1998/10/25 07:11:53 dawes Exp $ */
+#define _XIEC_MECPHOTO
+#define _XIEC_ECPHOTO
+#define _XIEC_EPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <meuncomp.h>
+#include <memory.h>
+
+/* routines referenced by other DDXIE modules
+ */
+extern int miAnalyzeECPhoto(floDefPtr flo, peDefPtr ped);
+
+/* routines used internal to this module
+ */
+static int CreateECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped);
+static int InitializeECPhotoStream(floDefPtr flo, peDefPtr ped);
+static int InitializeECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped);
+static int ActivateECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ActivateECPhotoStream(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetECPhoto(floDefPtr flo, peDefPtr ped);
+static int DestroyECPhotoUn(floDefPtr flo, peDefPtr ped);
+
+#if XIE_FULL
+static int CreateECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped);
+static int InitializeECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped);
+static int ActivateECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+#endif /* XIE_FULL */
+
+/*
+ * routines we need from somewhere else
+ */
+
+extern int InitializeECPhotoFAX();
+/* note: all the other Fax EC entry points are shared with EphotoFAX */
+
+extern int CreateEPhotoFAX();
+extern int ActivateEPhotoFAX();
+extern int ResetEPhotoFAX();
+extern int DestroyEPhotoFAX();
+
+extern int InitializeECPhotoJPEGBaseline();
+/* note: all the other EC entry points are shared with EphotoJPEGBaseline */
+
+extern int CreateEPhotoJPEGBaseline();
+extern int ActivateEPhotoJPEGBaseline();
+extern int ResetEPhotoJPEGBaseline();
+extern int DestroyEPhotoJPEGBaseline();
+
+/*
+ * DDXIE ExportClientPhoto entry points
+ */
+static ddElemVecRec ECPhotoUncomByPlaneVec = {
+ CreateECPhotoUncomByPlane,
+ InitializeECPhotoUncomByPlane,
+ ActivateECPhotoUncomByPlane,
+ (xieIntProc)NULL,
+ ResetECPhoto,
+ DestroyECPhotoUn
+ };
+
+static ddElemVecRec ECPhotoStreamVec = {
+ CreateECPhotoUncomByPlane,
+ InitializeECPhotoStream,
+ ActivateECPhotoStream,
+ (xieIntProc)NULL,
+ ResetECPhoto,
+ DestroyECPhotoUn
+ };
+
+static ddElemVecRec ECPhotoFAXVec = {
+ CreateEPhotoFAX,
+ InitializeECPhotoFAX, /* only this can't be shared */
+ ActivateEPhotoFAX,
+ (xieIntProc)NULL,
+ ResetEPhotoFAX,
+ DestroyEPhotoFAX
+ };
+
+#if XIE_FULL
+static ddElemVecRec ECPhotoUncomByPixelVec = {
+ CreateECPhotoUncomByPixel,
+ InitializeECPhotoUncomByPixel,
+ ActivateECPhotoUncomByPixel,
+ (xieIntProc)NULL,
+ ResetECPhoto,
+ DestroyECPhotoUn
+ };
+
+static ddElemVecRec ECPhotoJPEGBaselineVec = {
+ CreateEPhotoJPEGBaseline,
+ InitializeECPhotoJPEGBaseline, /* only this can't be shared */
+ ActivateEPhotoJPEGBaseline,
+ (xieIntProc)NULL,
+ ResetEPhotoJPEGBaseline,
+ DestroyEPhotoJPEGBaseline
+ };
+
+#endif /* XIE_FULL */
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeECPhoto(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ if(pvt->congress) {
+ ped->ddVec = ECPhotoStreamVec;
+ return(TRUE);
+ }
+ switch(pvt->encodeNumber) {
+ case xieValEncodeUncompressedSingle:
+ ped->ddVec = ECPhotoUncomByPlaneVec;
+ break;
+
+ case xieValEncodeG31D:
+ case xieValEncodeG32D:
+ case xieValEncodeG42D:
+ case xieValEncodeTIFF2:
+ case xieValEncodeTIFFPackBits:
+ ped->ddVec = ECPhotoFAXVec;
+ break;
+
+#if XIE_FULL
+ case xieValEncodeUncompressedTriple:
+ {
+ xieTecEncodeUncompressedTriple *tecParms =
+ (xieTecEncodeUncompressedTriple *)pvt->encodeParms;
+
+ switch(tecParms->interleave) {
+ case xieValBandByPlane:
+ ped->ddVec = ECPhotoUncomByPlaneVec;
+ break;
+
+ case xieValBandByPixel:
+ ped->ddVec = ECPhotoUncomByPixelVec;
+ break;
+ } /* end switch on interleave */
+ break;
+ }
+
+ case xieValEncodeJPEGBaseline:
+ {
+ /*** JPEG for SI can only handle 8 bit image depths ***/
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr src = &inf->srcDef->outFlo;
+ int b;
+ for (b=0; b< src->bands; ++b)
+ if (src->format[b].depth != 8) {
+ xieFloExportClientPhoto *raw =
+ (xieFloExportClientPhoto *)ped->elemRaw;
+
+ TechniqueError(flo,ped,xieValEncode,raw->encodeTechnique,
+ raw->lenParams,return(FALSE));
+ }
+ }
+ ped->ddVec = ECPhotoJPEGBaselineVec;
+ break;
+#endif /* XIE_FULL */
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ return(TRUE);
+} /* end meAnalyzeECPhoto */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, xieValMaxBands * sizeof(meUncompRec), NO_SYNC,
+ NO_SYNC));
+} /* end CreateECPhoto */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ formatPtr inf = ped->inFloLst[SRCtag].format;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ CARD32 nbands = ped->outFlo.bands, b, s;
+ xieTypOrientation pixelOrder, fillOrder;
+
+ if (nbands == 1) {
+ xieTecEncodeUncompressedSingle *tecParms =
+ (xieTecEncodeUncompressedSingle *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+
+ pixelOrder = tecParms->pixelOrder;
+ fillOrder = tecParms->fillOrder;
+ pvt[0].bandMap = 0;
+ } else {
+ xieTecEncodeUncompressedTriple *tecParms =
+ (xieTecEncodeUncompressedTriple *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+
+ pixelOrder = tecParms->pixelOrder;
+ fillOrder = tecParms->fillOrder;
+ if (tecParms->bandOrder == xieValLSFirst)
+ for(b = 0; b < xieValMaxBands; ++b)
+ pvt[b].bandMap = b;
+ else
+ for(s = 0, b = xieValMaxBands; b--; ++s)
+ pvt[s].bandMap = b;
+ }
+
+ for (b = 0; b < nbands; b++, pvt++, inf++) {
+ formatPtr outf = &ped->outFlo.format[pvt->bandMap];
+ CARD8 class = inf->class;
+ if (class == BIT_PIXEL) {
+ pvt->width = inf->width;
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ if (outf->stride != 1) {
+ pvt->action = (fillOrder == xieValMSFirst) ? btoIS: sbtoIS;
+ } else {
+ pvt->action = (fillOrder == xieValMSFirst) ? btoS : sbtoS;
+ }
+#else
+ if (outf->stride != 1) {
+ pvt->action = (fillOrder == xieValLSFirst) ? btoIS: sbtoIS;
+ } else {
+ pvt->action = (fillOrder == xieValLSFirst) ? btoS : sbtoS;
+ }
+#endif
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ } else if (class == BYTE_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 7)) {
+ if (outf->stride == 8)
+ pvt->action = BtoS;
+ else
+ pvt->action = BtoIS;
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = BtoLLUB;
+ else
+ pvt->action = BtoLMUB;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = BtoMLUB;
+ else
+ pvt->action = BtoMMUB;
+ }
+ pvt->bitOff = 0; /* Bit offset to first pixel on line */
+ pvt->leftOver = 0; /* Left over bits from last line */
+ pvt->depth = inf->depth;
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ }
+ } else if (class == PAIR_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 15)) {
+#if (IMAGE_BYTE_ORDER == LSBFirst)
+ if (outf->stride == 16)
+ pvt->action = (fillOrder == xieValLSFirst) ? PtoS : sPtoS;
+ else
+ pvt->action = (fillOrder == xieValLSFirst) ? PtoIS: sPtoIS;
+#else
+ if (outf->stride == 16)
+ pvt->action = (fillOrder == xieValMSFirst) ? PtoS : sPtoS;
+ else
+ pvt->action = (fillOrder == xieValMSFirst) ? PtoIS: sPtoIS;
+#endif
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = PtoLLUP;
+ else
+ pvt->action = PtoLMUP;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = PtoMLUP;
+ else
+ pvt->action = PtoMMUP;
+ }
+ pvt->bitOff = 0; /* Bit offset to first pixel on line */
+ pvt->leftOver = 0; /* Left over bits from last line */
+ pvt->depth = inf->depth;
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ }
+ } else if (class == QUAD_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 31)) {
+#if (IMAGE_BYTE_ORDER == LSBFirst)
+ if (outf->stride == 32)
+ pvt->action = (fillOrder == xieValLSFirst) ? QtoS : sQtoS;
+ else
+ pvt->action = (fillOrder == xieValLSFirst) ? QtoIS: sQtoIS;
+#else
+ if (outf->stride == 32)
+ pvt->action = (fillOrder == xieValMSFirst) ? QtoS : sQtoS;
+ else
+ pvt->action = (fillOrder == xieValMSFirst) ? QtoIS: sQtoIS;
+#endif
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = QtoLLUQ;
+ else
+ pvt->action = QtoLMUQ;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = QtoMLUQ;
+ else
+ pvt->action = QtoMMUQ;
+ }
+ }
+ } else
+ ImplementationError(flo,ped, return(FALSE));
+
+ }
+
+ pet->bandSync = NO_SYNC;
+
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeEPhotoUncomByPlane */
+
+
+static int InitializeECPhotoStream(floDefPtr flo, peDefPtr ped)
+{
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeECPhotoStream */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateECPhotoUncomByPlane(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientPhoto *raw = (xieFloExportClientPhoto*)ped->elemRaw;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp->inFlo->bands;
+ bandPtr sbnd = rcp->band,dbnd;
+ bandMsk ready = ped->outFlo.ready;
+ CARD32 b, d, olen, nlen, pitch;
+ pointer src, dst;
+
+ for(b = 0; b < bands; ++sbnd, ++dbnd, ++b, ++pvt) {
+ d = pvt->bandMap;
+ dbnd = &pet->emitter[d];
+ pitch = dbnd->format->pitch;
+ nlen = (pvt->bitOff + pitch + 7) >> 3;
+ src = GetCurrentSrc(flo,pet,sbnd);
+ dst = GetDstBytes(flo,pet,dbnd,dbnd->current,nlen,KEEP);
+
+ while(src && dst) {
+
+ (*pvt->action)(src,dst,pvt);
+
+ pvt->bitOff = (pvt->bitOff + pitch) & 7;
+ olen = pvt->bitOff ? nlen - 1 : nlen;
+ nlen = (pvt->bitOff + pitch + 7) >> 3;
+ src = GetNextSrc(flo,pet,sbnd,FLUSH);
+ dst = GetDstBytes(flo,pet,dbnd,dbnd->current+olen,nlen,KEEP);
+ }
+ FreeData(flo,pet,sbnd,sbnd->current);
+ if(!src && sbnd->final) {
+ if(pvt->bitOff) /* If we have any bits left, send them out now */
+ *(CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,1,KEEP)=pvt->leftOver;
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal); /* write the remaining data */
+ }
+
+ if(~ready & ped->outFlo.ready & 1<<d &&
+ (raw->notify == xieValNewData ||
+ (raw->notify == xieValFirstData && !ped->outFlo.output[d].flink->start)))
+ SendExportAvailableEvent(flo,ped,d,0,0,0);
+ }
+ return(TRUE);
+} /* end ActivateECPhotoUncomByPlane */
+
+
+static int ActivateECPhotoStream(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientPhoto *raw = (xieFloExportClientPhoto*)ped->elemRaw;
+ bandPtr sbnd = pet->receptor[SRCtag].band;
+ bandPtr dbnd = pet->emitter;
+ outFloPtr oflo = &ped->outFlo;
+ CARD32 nbands = oflo->bands;
+ bandMsk ready = oflo->ready;
+ CARD32 b;
+
+ for(b = 0; b < nbands; ++sbnd, ++dbnd, ++b) {
+ if(!(pet->scheduled & 1<<b)) continue;
+
+ /* pass input strips to the dixie holding area
+ */
+ while(GetCurrentSrc(flo,pet,sbnd)) {
+
+ if(!PassStrip(flo,pet,dbnd,sbnd->strip))
+ return(FALSE);
+
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ }
+ /* if it's appropriate, send an event
+ */
+ if(~ready & oflo->ready & 1<<b &&
+ (raw->notify == xieValNewData ||
+ (raw->notify == xieValFirstData && !oflo->output[b].flink->start)))
+ SendExportAvailableEvent(flo,ped,b,0,0,0);
+ }
+ return(TRUE);
+} /* end ActivateECPhotoStream */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetECPhoto(floDefPtr flo, peDefPtr ped)
+{
+ meUncompPtr pvt = (meUncompPtr)ped->peTex->private;
+ int i;
+
+ for(i = 0; i < xieValMaxBands; ++i)
+ if(pvt[i].buf) pvt[i].buf = (pointer) XieFree(pvt[i].buf);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetECPhoto */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyECPhotoUn(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyECPhotoUn */
+
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, xieValMaxBands * sizeof(meUncompRec), NO_SYNC,
+ SYNC));
+} /* end CreateECPhoto */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ formatPtr outf = pet->emitter[0].format;
+ xieTecEncodeUncompressedTriple *tec =
+ (xieTecEncodeUncompressedTriple *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+ bandPtr sbnd1,sbnd2,sbnd3;
+ CARD32 depth1,depth2,depth3,dstride,width;
+ int s, d;
+
+ pvt->unaligned = (tec->pixelStride[0] & 7) != 0;
+
+ if(tec->bandOrder == xieValLSFirst)
+ for(d = 0; d < xieValMaxBands; ++d)
+ pvt[d].bandMap = d;
+ else
+ for(s = 0, d = xieValMaxBands; d--; ++s)
+ pvt[s].bandMap = d;
+
+ sbnd1 = &pet->receptor[SRCtag].band[pvt[0].bandMap];
+ sbnd2 = &pet->receptor[SRCtag].band[pvt[1].bandMap];
+ sbnd3 = &pet->receptor[SRCtag].band[pvt[2].bandMap];
+ depth1 = sbnd1->format->depth;
+ depth2 = sbnd2->format->depth;
+ depth3 = sbnd3->format->depth;
+ width = sbnd1->format->width;
+ dstride = tec->pixelStride[0]>>3;
+
+ if (!pvt->unaligned) {
+ /* First, look for special cases */
+ if (depth1 == 16 && depth2 == 16 && depth3 == 16) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? PtoIS : sPtoIS;
+#else
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? sPtoIS : PtoIS;
+#endif
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = pa;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = s;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ }
+ } else if (depth1 == 8 && depth2 == 8 && depth3 == 8) {
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = BtoIS;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = s;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ }
+ } else if (depth1 == 4 && depth2 == 4 && depth3 == 4) {
+ if (tec->fillOrder == xieValMSFirst) {
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 4;
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0x0f;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 0;
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 1;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ pvt->shift = 4;
+ } else { /* xieValLSFirst */
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->clear_dst = FALSE;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 4;
+ pvt->action = BtoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 1;
+ pvt->mask = 0x0f;
+ pvt->clear_dst = FALSE;
+ pvt->shift = 0;
+ }
+ } else if (depth1 + depth2 + depth3 <= 8) {
+ CARD8 ones = 0xff,smask1,smask2,smask3,shift1,shift2,shift3;
+ if (tec->fillOrder == xieValMSFirst) {
+ smask1 = ~(ones>>depth1);
+ smask2 = ~(ones>>(depth1 + depth2) | smask1);
+ smask3 = ~(ones>>(depth1 + depth2 + depth3) | smask1 | smask2);
+ shift1 = 8 - depth1;
+ shift2 = 8 - (depth1 + depth2);
+ shift3 = 8 - (depth1 + depth2 + depth3);
+ } else { /* fillOrder == xieValLSFirst */
+ smask3 = ~(ones<<depth3);
+ smask2 = ~(ones<<(depth2 + depth3) | smask3);
+ smask1 = ~(ones<<(depth1 + depth2 + depth3) | smask2 | smask3);
+ shift3 = 0;
+ shift2 = depth3;
+ shift1 = depth2 + depth3;
+ }
+ pvt->action = (depth1 > 1) ? BtoISb : btoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask1;
+ pvt->clear_dst = TRUE;
+ (pvt++)->shift = shift1;
+ pvt->action = (depth2 > 1) ? BtoISb : btoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask2;
+ pvt->clear_dst = TRUE;
+ (pvt++)->shift = shift2;
+ pvt->action = (depth3 > 1) ? BtoISb : btoISb;
+ pvt->width = width;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask3;
+ pvt->clear_dst = TRUE;
+ pvt->shift = shift3;
+ } else
+ pvt->unaligned = TRUE;
+ }
+ pvt = (meUncompPtr)pet->private;
+ if ( pvt->unaligned ) {
+ pvt[0].pitch = outf->pitch;
+ pvt[0].width = sbnd1->format->width;
+ pvt[0].depth = depth1;
+ pvt[1].depth = depth2;
+ pvt[2].depth = depth3;
+ pvt->action = EncodeTripleFuncs[tec->pixelOrder == xieValLSFirst ? 0 : 1]
+ [tec->fillOrder == xieValLSFirst ? 0 : 1]
+ [depth1 <= 8 ? 0 : 1]
+ [depth2 <= 8 ? 0 : 1]
+ [depth3 <= 8 ? 0 : 1];
+ if((depth1 == 1 && !(pvt[0].buf = (pointer)XieMalloc(pvt[0].width+7))) ||
+ (depth2 == 1 && !(pvt[1].buf = (pointer)XieMalloc(pvt[1].width+7))) ||
+ (depth3 == 1 && !(pvt[2].buf = (pointer)XieMalloc(pvt[2].width+7))))
+ AllocError(flo,ped, return(FALSE));
+ }
+
+ pet->bandSync = SYNC;
+
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeECPhotoUnTriple */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateECPhotoUncomByPixel(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientPhoto *raw = (xieFloExportClientPhoto*)ped->elemRaw;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ bandPtr sb0 = &pet->receptor[SRCtag].band[pvt[0].bandMap];
+ bandPtr sb1 = &pet->receptor[SRCtag].band[pvt[1].bandMap];
+ bandPtr sb2 = &pet->receptor[SRCtag].band[pvt[2].bandMap];
+ bandPtr dbnd = &pet->emitter[0];
+ CARD32 pitch = dbnd->format->pitch;
+ bandMsk ready = ped->outFlo.ready;
+ pointer dst, sp0 = (pointer)NULL, sp1 = (pointer)NULL, sp2 = (pointer)NULL;
+
+ if (pvt->unaligned) {
+ CARD32 stride = dbnd->format->stride;
+ CARD32 width = dbnd->format->width;
+ CARD32 nextdlen = (pvt->bitOff + pitch + 7) >> 3, olddlen;
+ if((sp0 = GetCurrentSrc(flo,pet,sb0)) &&
+ (sp1 = GetCurrentSrc(flo,pet,sb1)) &&
+ (sp2 = GetCurrentSrc(flo,pet,sb2)) &&
+ (dst = GetDstBytes(flo,pet,dbnd,dbnd->current,nextdlen,KEEP)))
+ do {
+ if(pvt[0].buf) sp0 = bitexpand(sp0,pvt[0].buf,width,(char)0,(char)1);
+ if(pvt[1].buf) sp1 = bitexpand(sp1,pvt[1].buf,width,(char)0,(char)1);
+ if(pvt[2].buf) sp2 = bitexpand(sp2,pvt[2].buf,width,(char)0,(char)1);
+
+ (*pvt->action)(sp0,sp1,sp2,dst,stride,pvt);
+
+ sp0 = GetNextSrc(flo,pet,sb0,FLUSH);
+ sp1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ sp2 = GetNextSrc(flo,pet,sb2,FLUSH);
+ pvt->bitOff = (pvt->bitOff + pitch) & 7; /* Set next */
+ olddlen = (pvt->bitOff) ? nextdlen - 1 : nextdlen;
+ nextdlen = (pvt->bitOff + pitch + 7) >> 3;
+ dst = GetDstBytes(flo,pet,dbnd,dbnd->current+olddlen,
+ nextdlen,KEEP);
+ } while(dst && sp0 && sp1 && sp2);
+ } else {
+ CARD32 dlen = pitch >> 3; /* For nicely aligned data */
+ if((sp0 = GetCurrentSrc(flo,pet,sb0)) &&
+ (sp1 = GetCurrentSrc(flo,pet,sb1)) &&
+ (sp2 = GetCurrentSrc(flo,pet,sb2)) &&
+ (dst = GetDstBytes(flo,pet,dbnd,dbnd->current,dlen,KEEP)))
+ do {
+
+ if (pvt[0].clear_dst) bzero(dst,(int)dlen);
+
+ (*pvt[0].action)(sp0,dst,&pvt[0]);
+ (*pvt[1].action)(sp1,dst,&pvt[1]);
+ (*pvt[2].action)(sp2,dst,&pvt[2]);
+
+ sp0 = GetNextSrc(flo,pet,sb0,FLUSH);
+ sp1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ sp2 = GetNextSrc(flo,pet,sb2,FLUSH);
+ dst = GetDstBytes(flo,pet,dbnd,dbnd->current+dlen,dlen,KEEP);
+ } while(dst && sp0 && sp1 && sp2);
+ }
+
+ FreeData(flo,pet,sb0,sb0->current);
+ FreeData(flo,pet,sb1,sb1->current);
+ FreeData(flo,pet,sb2,sb2->current);
+ if(!sp0 && sb0->final && !sp1 && sb1->final && !sp2 && sb2->final) {
+ if (pvt->bitOff) /* If we have any bits left, send them out now */
+ *(CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,1,KEEP) = pvt->leftOver;
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal); /* write the remaining data */
+ }
+
+ if(~ready & ped->outFlo.ready & 1 &&
+ (raw->notify == xieValNewData ||
+ (raw->notify == xieValFirstData && !ped->outFlo.output[0].flink->start)))
+ SendExportAvailableEvent(flo,ped,0,0,0,0);
+
+ return(TRUE);
+} /* end ActivateECPhotoUncomByPixel */
+#endif
+
+/* end module mecphoto.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/mecroi.c b/xc/programs/Xserver/XIE/mixie/export/mecroi.c
new file mode 100644
index 000000000..e198e12f3
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mecroi.c
@@ -0,0 +1,245 @@
+/* $TOG: mecroi.c /main/6 1998/02/09 16:12:56 kaleb $ */
+/**** module mecroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mecroi.c -- DDXIE export client roi element
+
+ Larry Hare && Dean Verheiden -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mecroi.c,v 3.4 1998/10/25 07:11:53 dawes Exp $ */
+
+#define _XIEC_MECROI
+#define _XIEC_ECROI
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+/* routines referenced by other DDXIE modules
+ */
+extern int miAnalyzeECROI(floDefPtr flo, peDefPtr ped);
+
+/* routines used internal to this module
+ */
+static int CreateECROI(floDefPtr flo, peDefPtr ped);
+static int InitializeECROI(floDefPtr flo, peDefPtr ped);
+static int ActivateECROI(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetECROI(floDefPtr flo, peDefPtr ped);
+static int DestroyECROI(floDefPtr flo, peDefPtr ped);
+
+/* DDXIE ExportClientROI entry points
+ */
+static ddElemVecRec ECROIVec =
+{
+ CreateECROI,
+ InitializeECROI,
+ ActivateECROI,
+ (xieIntProc)NULL,
+ ResetECROI,
+ DestroyECROI
+};
+
+/* Local routines */
+static void ConvertToRect(ROIPtr proi, xieTypRectangle *prect);
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeECROI(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = ECROIVec;
+ return TRUE;
+} /* end miAnalyzeECROI */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateECROI(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the roi element definition */
+ return MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC);
+} /* end CreateECROI */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeECROI(floDefPtr flo, peDefPtr ped)
+{
+ return InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeECROI */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateECROI(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportClientROI *raw = (xieFloExportClientROI*)ped->elemRaw;
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &rcp->band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ CARD32 rectSize;
+ xieTypRectangle *prect;
+ ROIPtr proi;
+
+ if (!(proi = (ROIRec*)GetCurrentSrc(flo,pet,sbnd)))
+ return FALSE;
+
+ rectSize = sizeof(xieTypRectangle) * proi->nrects;
+
+ if (!(prect = (xieTypRectangle*)GetDstBytes(flo,pet,dbnd,0,rectSize,KEEP)))
+ return FALSE;
+
+ ConvertToRect(proi,prect);
+
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,rectSize);
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+
+ switch(raw->notify) {
+ case xieValFirstData: /* fall thru */
+ case xieValNewData: SendExportAvailableEvent(flo,ped,0,proi->nrects,0,0);
+ default: break;
+ }
+
+ return TRUE;
+} /* end ActivateECROI */
+
+static void ConvertToRect(ROIPtr proi, xieTypRectangle *prect)
+{
+ CARD32 nrects = 0;
+ linePtr lp;
+
+ /* Convert run lengths to xieTypRectangles */
+ lp = (linePtr)&proi[1];
+ while (lp < proi->lend) {
+ register runPtr rp = RUNPTR(0);
+ register CARD32 x = proi->x;
+ register CARD32 j = lp->nrun;
+
+ while (j--) {
+ x += rp->dstart;
+ prect[nrects].x = x;
+ prect[nrects].y = lp->y;
+ prect[nrects].width = rp->length;
+ prect[nrects++].height = lp->nline;
+ x += (rp++)->length;
+ }
+ lp = (linePtr)RUNPTR(lp->nrun);
+ }
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetECROI(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return TRUE;
+} /* end ResetECROI */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyECROI(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.flush = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return TRUE;
+} /* end DestroyECROI */
diff --git a/xc/programs/Xserver/XIE/mixie/export/medraw.c b/xc/programs/Xserver/XIE/mixie/export/medraw.c
new file mode 100644
index 000000000..a337c7963
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/medraw.c
@@ -0,0 +1,359 @@
+/* $TOG: medraw.c /main/7 1998/02/09 16:13:05 kaleb $ */
+/**** module medraw.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ medraw.c -- DDXIE prototype export drawable element
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/medraw.c,v 3.4 1998/10/25 07:11:54 dawes Exp $ */
+
+#define _XIEC_MEDRAW
+#define _XIEC_EDRAW
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+extern int miAnalyzeEDraw(floDefPtr flo, peDefPtr ped);
+
+/*
+ * routines used internal to this module
+ */
+static int CreateEDraw(floDefPtr flo, peDefPtr ped);
+static int InitializeEDraw(floDefPtr flo, peDefPtr ped);
+static int ActivateEDrawAlign(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ActivateEDrawStrip(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetEDraw(floDefPtr flo, peDefPtr ped);
+static int DestroyEDraw(floDefPtr flo, peDefPtr ped);
+
+static void adjustStride8to4(char *dst, char *src, CARD32 width);
+static void adjustStride32to24(char *dst, char *src, CARD32 width);
+
+extern Bool DrawableAndGC();
+
+/*
+ * DDXIE ExportDrawable entry points
+ */
+static ddElemVecRec EDrawVec = {
+ CreateEDraw,
+ InitializeEDraw,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetEDraw,
+ DestroyEDraw
+ };
+
+typedef struct _medraw {
+ xieVoidProc adjust;
+ char *buf;
+} meDrawRec, *meDrawPtr;
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeEDraw(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = EDrawVec;
+
+ return(TRUE);
+} /* end miAnalyzeEDraw */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateEDraw(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, sizeof(meDrawRec), NO_SYNC, NO_SYNC);
+} /* end CreateEDraw */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEDraw(floDefPtr flo, peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ meDrawPtr ddx = (meDrawPtr) pet->private;
+ formatPtr sf = &ped->inFloLst[SRCtag].format[0];
+ formatPtr df = &ped->outFlo.format[0];
+ Bool adj_stride = sf->stride != df->stride;
+ Bool adj_pitch = sf->pitch != df->pitch;
+
+ if(adj_stride || adj_pitch) {
+ ped->ddVec.activate = ActivateEDrawAlign;
+
+ if(adj_stride) {
+ if(!(ddx->buf = (char*) XieMalloc(df->pitch>>3)))
+ AllocError(flo,ped, return(FALSE));
+
+ if(sf->stride == 32 && df->stride == 24)
+ ddx->adjust = adjustStride32to24;
+
+ else if(sf->stride == 8 && df->stride == 4)
+ ddx->adjust = adjustStride8to4;
+
+ /* add more adjustment routines as required */
+ }
+ } else {
+ ped->ddVec.activate = ActivateEDrawStrip;
+ }
+ return(InitReceptors(flo,ped,NO_DATAMAP,1));
+} /* end InitializeEDraw */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateEDrawAlign(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportDrawable *raw = (xieFloExportDrawable *) ped->elemRaw;
+ eDrawDefPtr dix = (eDrawDefPtr) ped->elemPvt;
+ meDrawPtr ddx = (meDrawPtr) pet->private;
+ bandPtr bnd = &pet->receptor[SRCtag].band[0];
+ char *dst, *src = (char*)GetCurrentSrc(flo,pet,bnd);
+ CARD32 width = bnd->format->width;
+
+ if (!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&dix->pDraw,&dix->pGC))
+ return FALSE;
+
+ do {
+ if(ddx->adjust) {
+ dst = AlterSrc(flo,pet,bnd->strip) ? src : ddx->buf;
+ (*ddx->adjust)(dst, src, width);
+ } else
+ dst = src;
+
+ (*dix->pGC->ops->PutImage)(dix->pDraw, /* drawable */
+ dix->pGC, /* gc */
+ dix->pDraw->depth, /* depth */
+ raw->dstX, /* drawable-x */
+ raw->dstY + bnd->current, /* drawable-y */
+ width, 1, /* width, height */
+ bnd->strip->bitOff, /* padding? */
+ ZPixmap, /* data format */
+ dst /* data buffer */
+ );
+ } while ((src = (char*)GetNextSrc(flo,pet,bnd,KEEP)) != 0);
+
+ /* make sure the scheduler knows how much src we used */
+ FreeData(flo,pet,bnd,bnd->current);
+
+ return(TRUE);
+} /* end ActivateEDrawAlign */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateEDrawStrip(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportDrawable *raw = (xieFloExportDrawable *) ped->elemRaw;
+ eDrawDefPtr pvt = (eDrawDefPtr) ped->elemPvt;
+ bandPtr bnd = &pet->receptor[SRCtag].band[0];
+ char *src = (char*)GetCurrentSrc(flo,pet,bnd);
+
+ if(src) {
+ if (!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&pvt->pDraw,&pvt->pGC))
+ return FALSE;
+ do
+ (*pvt->pGC->ops->PutImage)(pvt->pDraw, /* drawable */
+ pvt->pGC, /* gc */
+ pvt->pDraw->depth, /* depth */
+ raw->dstX, /* drawable-x */
+ raw->dstY+bnd->minLocal, /* drawable-y */
+ bnd->format->width, /* width */
+ bnd->strip->length, /* height */
+ bnd->strip->bitOff, /* padding? */
+ ZPixmap, /* data format */
+ src /* data buffer */
+ );
+ while ((src = (char*)GetSrc(flo,pet,bnd,bnd->maxLocal,KEEP)) != 0);
+ }
+ /* make sure the scheduler knows how much src we used */
+ FreeData(flo,pet,bnd,bnd->current);
+
+ return(TRUE);
+} /* end ActivateEDrawStrip */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetEDraw(floDefPtr flo, peDefPtr ped)
+{
+ meDrawPtr ddx = (meDrawPtr) ped->peTex->private;
+
+ if(ddx->buf) ddx->buf = (char*)XieFree(ddx->buf);
+ ddx->adjust = (xieVoidProc)NULL;
+
+ ResetReceptors(ped);
+
+ return(TRUE);
+} /* end ResetEDraw */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyEDraw(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyEDraw */
+
+
+/*------------------------------------------------------------------------
+---------------------------- alignment routines --------------------------
+------------------------------------------------------------------------*/
+static void adjustStride32to24(char *dst, char *src, CARD32 width)
+{
+ register char *ip, *op;
+ CARD32 i;
+
+#if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER)
+ ip = src;
+ op = dst;
+ for(i = 0; i < width; ip += 2, ++i) {
+ *op++ = *ip++; *op++ = *ip++; *op++ = *ip;
+ }
+#else
+ /* we'll do the first 2 pixels by hand in case we're doing this in-place
+ */
+ char tmp = src[0];
+ dst[0] = src[2];
+ dst[2] = tmp;
+ if(width > 1) {
+ tmp = src[4];
+ dst[3] = src[6];
+ dst[4] = src[5];
+ dst[5] = tmp;
+ }
+ if(width > 2) {
+ ip = src + 8;
+ op = dst + 6;
+ for(i = 2; i < width; ip += 4, ++i) {
+ *op++ = ip[2]; *op++ = ip[1]; *op++ = *ip;
+ }
+ }
+#endif
+}
+
+static void adjustStride8to4(char *dst, char *src, CARD32 width)
+{
+ register char *ip = src, *op = dst;
+ CARD32 i;
+
+ for(i = 0; i < width; ip += 2, ++i) {
+#if (BITMAP_BIT_ORDER == LSBFirst)
+ *op++ = *ip | *(ip+1)<<8;
+#else
+ *op++ = *ip<<8 | *(ip+1);
+#endif
+ }
+}
+
+/* end module medraw.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/medrawp.c b/xc/programs/Xserver/XIE/mixie/export/medrawp.c
new file mode 100644
index 000000000..9db5d9a32
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/medrawp.c
@@ -0,0 +1,413 @@
+/* $TOG: medrawp.c /main/8 1998/02/09 16:13:00 kaleb $ */
+/**** module medrawp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ medrawp.c -- DDXIE prototype export drawable plane element
+
+ Robert NC Shelley && Larry Hare -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/medrawp.c,v 3.4 1998/10/25 07:11:54 dawes Exp $ */
+
+#define _XIEC_MEDRAWP
+#define _XIEC_EDRAWP
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <scrnintstr.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+extern Bool DrawableAndGC();
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+extern int miAnalyzeEDrawP(floDefPtr flo, peDefPtr ped);
+
+/*
+ * routines used internal to this module
+ */
+static int CreateEDrawP(floDefPtr flo, peDefPtr ped);
+static int InitializeEDrawP(floDefPtr flo, peDefPtr ped);
+static int ActivateEDrawP(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ActivateEDrawPTrans(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetEDrawP(floDefPtr flo, peDefPtr ped);
+static int DestroyEDrawP(floDefPtr flo, peDefPtr ped);
+
+/*
+ * DDXIE ExportDrawable entry points
+ */
+static ddElemVecRec EDrawPVec = {
+ CreateEDrawP,
+ InitializeEDrawP,
+ ActivateEDrawP,
+ (xieIntProc)NULL,
+ ResetEDrawP,
+ DestroyEDrawP
+ };
+
+typedef struct _medrawp {
+ BytePixel *buf;
+} meDrawPRec, *meDrawPPtr;
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeEDrawP(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = EDrawPVec;
+
+ return(TRUE);
+} /* end miAnalyzeEDrawP */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateEDrawP(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, sizeof(meDrawPRec), NO_SYNC, NO_SYNC);
+} /* end CreateEDrawP */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEDrawP(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportDrawablePlane *raw = (xieFloExportDrawablePlane *) ped->elemRaw;
+ eDrawPDefPtr dix = (eDrawPDefPtr) ped->elemPvt;
+
+ if (!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&dix->pDraw,&dix->pGC))
+ return FALSE;
+
+ if (dix->pGC->fillStyle == FillStippled)
+ ped->ddVec.activate = ActivateEDrawPTrans;
+ else /* normal case: FillSolid || FillTiled || FillOpaqueStippled */
+ ped->ddVec.activate = ActivateEDrawP;
+
+#if (BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER)
+ {
+ meDrawPPtr ddx = (meDrawPPtr) ped->peTex->private;
+ if(!(ddx->buf = ((BytePixel*)XieMalloc(max(ped->outFlo.format[0].pitch+7>>3,
+ flo->floTex->stripSize)))))
+ AllocError(flo,ped, return(FALSE));
+ }
+#endif
+
+ return InitReceptors(flo,ped,NO_DATAMAP,1);
+} /* end InitializeEDrawP */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateEDrawP(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportDrawablePlane *raw = (xieFloExportDrawablePlane *) ped->elemRaw;
+ eDrawPDefPtr dix = (eDrawPDefPtr) ped->elemPvt;
+ bandPtr bnd = &pet->receptor[SRCtag].band[0];
+ BytePixel *src = (BytePixel*)GetCurrentSrc(flo,pet,bnd);
+ CARD32 pixtype, depth;
+
+ if(src) {
+ if(!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&dix->pDraw,&dix->pGC))
+ return FALSE;
+ pixtype = (dix->pDraw->type == DRAWABLE_PIXMAP) ? XYPixmap : XYBitmap;
+ depth = (pixtype == XYBitmap) ? 1 : dix->pDraw->depth;
+
+ do {
+#if (BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER)
+ {
+ meDrawPPtr ddx = (meDrawPPtr) pet->private;
+ BytePixel *op, *dst;
+ int nb = bnd->pitch * bnd->strip->length;
+ dst = op = AlterSrc(flo,pet,bnd->strip) ? src : ddx->buf;
+
+ while (nb--)
+ *op++ = _ByteReverseTable[*src++];
+ src = dst;
+ }
+#endif
+ (*dix->pGC->ops->PutImage)(dix->pDraw, /* drawable */
+ dix->pGC, /* gc */
+ depth, /* depth */
+ raw->dstX, /* drawable-x */
+ raw->dstY+bnd->minLocal, /* drawable-y */
+ bnd->format->width, /* width */
+ bnd->strip->length, /* height */
+ bnd->strip->bitOff, /* padding? */
+ pixtype, /* data format */
+ (char*)src /* data buffer */
+ );
+ }
+ while ((src = (BytePixel*)GetSrc(flo,pet,bnd,bnd->maxLocal,KEEP)) != 0)
+ ;
+
+ /* make sure the scheduler knows how much src we used */
+ FreeData(flo,pet,bnd,bnd->current);
+ }
+ return(TRUE);
+} /* end ActivateEDrawP */
+
+static int ActivateEDrawPTrans(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ xieFloExportDrawablePlane *raw = (xieFloExportDrawablePlane *) ped->elemRaw;
+ eDrawPDefPtr dix = (eDrawPDefPtr) ped->elemPvt;
+ bandPtr bnd = &pet->receptor[SRCtag].band[0];
+ DrawablePtr draw;
+ GCPtr gc, scratch;
+ PixmapPtr bitmap;
+ BytePixel *src;
+ int oldstyle, newstyle = FillSolid;
+ XID gcvals[3];
+
+ src = (BytePixel*)GetSrc(flo,pet,bnd,bnd->minGlobal,FALSE);
+ if(src) {
+ if (!DrawableAndGC(flo,ped,raw->drawable,raw->gc,&dix->pDraw,&dix->pGC))
+ return FALSE;
+
+ draw = dix->pDraw;
+ gc = dix->pGC;
+
+ /*
+ ** We use PushPixels with a solid fill to move the one bits onto the
+ ** screen. Alternatives include:
+ ** a) treat the bitmap as a stipple, set it up in a GC, and do a
+ ** simple FillRect with FillStippled. This has all the same
+ ** problems, plus some more. Notably its more difficult to
+ ** use ChangeGC to transiently save/restore stipples, and to
+ ** compute the stipple offsets.
+ ** b) another alternative is to change the incoming bitonal
+ ** image to run length and do a FillSpans. This also requires
+ ** either a scratch GC or transiently using the incoming GC.
+ ** It saves the extra bitmap creation and PutImage, but might
+ ** become grotesque when a dithered image comes rolling thru.
+ */
+
+ /*
+ ** Core X does not seem to provide an official interface to create
+ ** a pixmap header, or even to replace the data pointer. We can't
+ ** simply memcpy our data to it either, it might be on a separate
+ ** cpu/memory system, or even upside down. So we just use PutImage
+ ** to prepare our data. Sigh. On most cpu's, just explicitly
+ ** create a pixmap header yourself and call PushPixels directly.
+ ** Another optimization would be to use more lines at once. One
+ ** model for all this is miglblt.c
+ **
+ ** Since we expect people may want to redo this routine, we have
+ ** left the pixmap and GC games local to this function rather than
+ ** spreading stuff out into private structures and initialize
+ ** and destroy routines. For instance, the bitmap and scratchGC
+ ** could be allocated once for the entire flow.
+ **
+ ** For now we do 64 lines of bits at a time. We might come up
+ ** with a better estimate based on actual scanline length. We
+ ** need a function to call though to make this unkludgey. Using
+ ** NLINES as 64 may be bad if we get a very wide image.
+ **
+ ** The current performance seems very bad, even doing a large
+ ** number of lines at a time. Haven't had time to investigate this.
+ */
+
+#define NLINES 64
+
+ if (!(scratch = GetScratchGC(1, draw->pScreen)))
+ AllocError(flo,ped,return(FALSE));
+
+
+ if (!(bitmap = (*draw->pScreen->CreatePixmap) (draw->pScreen,
+ bnd->format->width, NLINES, 1))) {
+ FreeScratchGC(scratch);
+ AllocError(flo,ped,return(FALSE));
+ }
+ gcvals[0] = 1;
+ gcvals[1] = 0;
+ ChangeGC(scratch, GCForeground|GCBackground, gcvals);
+
+ oldstyle = gc->fillStyle;
+ ChangeGC(gc, GCFillStyle, (XID *)&newstyle);
+
+ do {
+ int iy, ny;
+#if (BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER)
+ {
+ meDrawPPtr ddx = (meDrawPPtr) pet->private;
+ BytePixel *op, *dst;
+ int nb = bnd->pitch * bnd->strip->length;
+ dst = op = AlterSrc(flo,pet,bnd->strip) ? src : ddx->buf;
+
+ while (nb--)
+ *op++ = _ByteReverseTable[*src++];
+ src = dst;
+ }
+#endif
+ for (iy = 0 ; iy < bnd->strip->length; iy += ny) {
+ ny = bnd->strip->length - iy;
+ if (ny > NLINES)
+ ny = NLINES;
+ if ((scratch->serialNumber) != (bitmap->drawable.serialNumber))
+ ValidateGC((DrawablePtr)bitmap, scratch);
+ (*scratch->ops->PutImage) (
+ (DrawablePtr)bitmap, /* drawable bitmap */
+ scratch, /* gc */
+ 1, /* depth */
+ 0, /* drawable-x */
+ 0, /* drawable-y */
+ bnd->format->width, /* width */
+ ny, /* height */
+ bnd->strip->bitOff, /* padding? */
+ XYPixmap, /* data format */
+ (char*)src /* data buffer */
+ );
+ if ((gc->serialNumber) != (draw->serialNumber))
+ ValidateGC(draw, gc);
+ (*gc->ops->PushPixels) (
+ gc, /* gc */
+ bitmap, /* bitmap */
+ draw, /* drawable */
+ bnd->format->width, /* width */
+ ny, /* height */
+ raw->dstX+(gc->miTranslate?draw->x:0), /* dst X/Y */
+ raw->dstY+(gc->miTranslate?draw->y:0)+bnd->current+iy
+ );
+ src += bnd->pitch * ny; /* gack */
+ }
+ } while ((src = (BytePixel*)GetSrc(flo,pet,bnd,bnd->maxLocal,FALSE)) != 0);
+
+ /* make sure the scheduler knows how much src we used */
+ FreeData(flo,pet,bnd,bnd->current);
+
+ ChangeGC(gc, GCFillStyle, (XID *)&oldstyle);
+ ValidateGC(draw, gc);
+
+ (*draw->pScreen->DestroyPixmap) (bitmap);
+ FreeScratchGC(scratch);
+ }
+
+ return(TRUE);
+} /* end ActivateEDrawPTrans */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetEDrawP(floDefPtr flo, peDefPtr ped)
+{
+ meDrawPPtr ddx = (meDrawPPtr) ped->peTex->private;
+
+ if(ddx->buf) ddx->buf = (BytePixel*)XieFree(ddx->buf);
+
+ ResetReceptors(ped);
+
+ return(TRUE);
+} /* end ResetEDrawP */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyEDrawP(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyEDrawP */
+
+/* end module medrawp.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/mefax.c b/xc/programs/Xserver/XIE/mixie/export/mefax.c
new file mode 100644
index 000000000..bd7c80185
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mefax.c
@@ -0,0 +1,609 @@
+/* $TOG: mefax.c /main/8 1998/02/09 16:13:09 kaleb $ */
+/**** module mefax.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mefax.c -- DDXIE prototype export photomap coded with one of
+ many FAX techiques (g31d,g32d,g42d,tiff2,packbits)
+
+ Ben Fahy -- AGE Logic, Inc. Oct, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mefax.c,v 3.4 1998/10/25 07:11:54 dawes Exp $ */
+
+#define _XIEC_MEPHOTO
+#define _XIEC_EPHOTO
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <../include/fax.h> /* XXX - ugh! */
+#include <../fax/fencode.h> /* XXX - even ugh-ier! */
+#include <xiemd.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+extern int CreateEPhotoFAX(floDefPtr flo, peDefPtr ped);
+extern int InitializeEPhotoFAX(floDefPtr flo, peDefPtr ped);
+extern int ActivateEPhotoFAX(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+extern int ResetEPhotoFAX(floDefPtr flo, peDefPtr ped);
+extern int DestroyEPhotoFAX(floDefPtr flo, peDefPtr ped);
+extern int InitializeECPhotoFAX(floDefPtr flo, peDefPtr ped);
+
+/* ECPhoto Create routines are shared */
+/* ECPhoto Activate routines are shared */
+/* ECPhoto Reset routines are shared */
+/* ECPhoto Destroy routines are shared */
+
+/*
+ * Local Declarations
+ */
+
+
+typedef struct _fax_encode_pvt {
+ int (*encodptr)(); /* function used to encode the data */
+ FaxEncodeState state; /* holds all coding info for FAX dudes */
+ int notify; /* relevant for ECPhoto only */
+ int encoded_order; /* LSfirst or MSfirst */
+
+ xieTypEncodeTechnique encode_technique;
+ char *tech_params; /* scroll away technique information */
+
+ int height; /* image height, so we know when done */
+ int strip_req_newbytes;
+ /* when we GetDstBytes, how much */
+} faxPvtRec, *faxPvtPtr;
+
+#define MaybeSwapOutput() \
+ if (texpvt->encoded_order == xieValLSFirst) { \
+ register int size=dbnd->maxLocal-dbnd->minLocal; \
+ register unsigned char *ucp = dst; \
+ while (size--) \
+ { \
+ *ucp = _ByteReverseTable[*ucp]; \
+ ucp++; \
+ } \
+ }
+
+/*
+ * routines used internal to this module
+ */
+
+static int common_init(
+ floDefPtr flo,
+ peDefPtr ped,
+ char *tec,
+ CARD16 encodeTechnique);
+
+static int sub_fun(
+ floDefPtr flo,
+ peDefPtr ped,
+ peTexPtr pet,
+ faxPvtPtr texpvt,
+ FaxEncodeState *state,
+ bandPtr sbnd,
+ bandPtr dbnd);
+
+static void FreeFaxData(floDefPtr flo, peDefPtr ped);
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+int CreateEPhotoFAX(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, sizeof(faxPvtRec), NO_SYNC, NO_SYNC));
+} /* end CreateEPhotoFAX */
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeEPhotoFAX(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ return( common_init(flo,ped,pvt->encodeParms,pvt->encodeNumber) );
+}
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeECPhotoFAX(floDefPtr flo, peDefPtr ped)
+{
+ xieFloExportClientPhoto *raw = (xieFloExportClientPhoto *) ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ faxPvtPtr texpvt = (faxPvtPtr)pet->private;
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ if( !common_init(flo,ped,pvt->encodeParms,pvt->encodeNumber) )
+ return FALSE;
+
+ texpvt->notify = raw->notify;
+ return TRUE;
+}
+/*------------------------------------------------------------------------
+------- lots of stuff shared between ECPhoto and EPhoto. . . -------------
+------------------------------------------------------------------------*/
+static int common_init(
+ floDefPtr flo,
+ peDefPtr ped,
+ char *tec,
+ CARD16 encodeTechnique)
+{
+peTexPtr pet = ped->peTex;
+faxPvtPtr texpvt=(faxPvtPtr) pet->private;
+formatPtr inf = pet->receptor[0].band[0].format;
+FaxEncodeState *state = &texpvt->state;
+int pbytes,max_lines_in;
+
+/* every time we run, reset this */
+ bzero(texpvt,sizeof(faxPvtRec));
+
+/* now save away protocol technique info */
+ texpvt->encode_technique = encodeTechnique;
+ texpvt->tech_params = tec;
+
+/* we also need width */
+ state->width = inf->width;
+ texpvt->height = inf->height;
+
+/* do technique-dependent initialization */
+ switch(encodeTechnique) {
+ case xieValEncodeG31D:
+ {
+ G31DEncodePvt *epvt;
+ xieTecEncodeG31D *g31dtec = (xieTecEncodeG31D *)tec;
+
+ state->goal = ENCODE_FAX_GOAL_StartNewLine;
+ state->radiometric = g31dtec->radiometric;
+ texpvt->encoded_order = g31dtec->encodedOrder;
+
+ /* set up data private to this technique */
+ epvt = (G31DEncodePvt *) XieMalloc(sizeof(G31DEncodePvt));
+ bzero(epvt,sizeof(G31DEncodePvt));
+ epvt->counts = (int *) XieMalloc((state->width+1) * sizeof(int));
+ if (!epvt->counts) {
+ FreeFaxData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ epvt->align_eol = g31dtec->alignEol;
+ state->private = (pointer ) epvt;
+
+ texpvt->encodptr = encode_g31d;
+ }
+ break;
+ case xieValEncodeG32D:
+ {
+ G32DEncodePvt *epvt;
+ xieTecEncodeG32D *g32dtec = (xieTecEncodeG32D *)tec;
+
+ state->goal = ENCODE_FAX_GOAL_StartNewLine;
+ state->radiometric = g32dtec->radiometric;
+ texpvt->encoded_order = g32dtec->encodedOrder;
+
+ /* set up data private to this technique */
+ epvt = (G32DEncodePvt *) XieMalloc(sizeof(G32DEncodePvt));
+ bzero(epvt,sizeof(G32DEncodePvt));
+ epvt->counts = (int *) XieMalloc((state->width+1) * sizeof(int));
+ epvt->above = (int *) XieMalloc((state->width+1) * sizeof(int));
+ if (!epvt->counts || !epvt->above) {
+ FreeFaxData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ epvt->k = g32dtec->kFactor;
+ epvt->align_eol = g32dtec->alignEol;
+ epvt->uncompressed = g32dtec->uncompressed;
+ state->private = (pointer ) epvt;
+ }
+ texpvt->encodptr = encode_g32d;
+ break;
+ case xieValEncodeG42D:
+ {
+ G42DEncodePvt *epvt;
+ xieTecEncodeG42D *g42dtec = (xieTecEncodeG42D *)tec;
+
+ state->goal = ENCODE_FAX_GOAL_StartNewLine;
+ texpvt->encoded_order = g42dtec->encodedOrder;
+ state->radiometric = g42dtec->radiometric;
+
+ /* set up data private to this technique */
+ epvt = (G42DEncodePvt *) XieMalloc(sizeof(G42DEncodePvt));
+ bzero(epvt,sizeof(G42DEncodePvt));
+ epvt->counts = (int *) XieMalloc((state->width+1) * sizeof(int));
+ epvt->above = (int *) XieMalloc((state->width+1) * sizeof(int));
+ if (!epvt->counts || !epvt->above) {
+ FreeFaxData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ /* for G4, initialize imaginary line to "all white" */
+ epvt->counts[0] = state->width;
+ epvt->nvals = 1;
+
+ epvt->uncompressed = ((xieTecEncodeG42D *)tec)->uncompressed;
+ epvt->really_g4 = 1;
+ state->private = (pointer ) epvt;
+ }
+ texpvt->encodptr = encode_g32d;
+ break;
+ case xieValEncodeTIFF2:
+ {
+ Tiff2EncodePvt *epvt;
+ xieTecEncodeTIFF2 *tiff2tec = (xieTecEncodeTIFF2 *)tec;
+
+ state->goal = ENCODE_FAX_GOAL_StartNewLine;
+ state->radiometric = tiff2tec->radiometric;
+ texpvt->encoded_order = tiff2tec->encodedOrder;
+
+ /* set up data private to this technique */
+ epvt = (Tiff2EncodePvt *) XieMalloc(sizeof(Tiff2EncodePvt));
+ bzero(epvt,sizeof(Tiff2EncodePvt));
+ epvt->counts = (int *) XieMalloc((state->width+1) * sizeof(int));
+ if (!epvt->counts) {
+ FreeFaxData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ state->private = (pointer ) epvt;
+ }
+ texpvt->encodptr = encode_tiff2;
+ break;
+ case xieValEncodeTIFFPackBits:
+ {
+ PackBitsEncodePvt *epvt;
+ xieTecEncodeTIFFPackBits *tiffpbtec = (xieTecEncodeTIFFPackBits *)tec;
+
+ state->goal = ENCODE_FAX_GOAL_StartNewLine;
+ state->width = 8 * ((state->width + 7)/8);
+ /* packbits assumes lines are padded to an even byte */
+
+ texpvt->encoded_order = tiffpbtec->encodedOrder;
+
+ /* set up data private to this technique */
+ epvt = (PackBitsEncodePvt *) XieMalloc(sizeof(PackBitsEncodePvt));
+ bzero(epvt,sizeof(PackBitsEncodePvt));
+ epvt->values = (int *) XieMalloc((state->width) * sizeof(int));
+ epvt->counts = (int *) XieMalloc((state->width) * sizeof(int));
+ if (!epvt->counts || !epvt->values) {
+ FreeFaxData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ state->private = (pointer ) epvt;
+ }
+ texpvt->encodptr = encode_tiffpb;
+ break;
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+
+ /* size of first output strip */
+ texpvt->strip_req_newbytes = flo->floTex->stripSize;
+ state->strip_state = StripStateNew;
+
+/* calculate size of the input strip data map we will need */
+ pbytes = (inf->pitch + 7) >> 3;
+ max_lines_in = flo->floTex->stripSize / pbytes;
+
+ if (!max_lines_in)
+ max_lines_in = 1; /* in case a line was bigger than std stripsize */
+
+ return(InitReceptors(flo, ped, max_lines_in, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+
+} /* end common_init() */
+/*------------------------------------------------------------------------
+----------------------------- free some data ----------------------------
+------------------------------------------------------------------------*/
+static void FreeFaxData(floDefPtr flo, peDefPtr ped)
+{
+peTexPtr pet = ped->peTex;
+faxPvtPtr texpvt=(faxPvtPtr) pet->private;
+FaxEncodeState *state = &texpvt->state;
+
+ switch(texpvt->encode_technique) {
+ case xieValEncodeG31D:
+ {
+ G31DEncodePvt *epvt = (G31DEncodePvt *) state->private;
+ if (epvt) {
+ if (epvt->counts)
+ XieFree(epvt->counts);
+ XieFree(epvt);
+ }
+ }
+ break;
+ case xieValEncodeG32D:
+ case xieValEncodeG42D:
+ {
+ G32DEncodePvt *epvt = (G32DEncodePvt *) state->private;
+ if (epvt) {
+ if (epvt->counts) XieFree(epvt->counts);
+ if (epvt->above) XieFree(epvt->above);
+ XieFree(epvt);
+ }
+ }
+ break;
+ case xieValEncodeTIFF2:
+ {
+ Tiff2EncodePvt *epvt = (Tiff2EncodePvt *) state->private;
+ if (epvt) {
+ if (epvt->counts)
+ XieFree(epvt->counts);
+ XieFree(epvt);
+ }
+ }
+ break;
+ case xieValEncodeTIFFPackBits:
+ {
+ PackBitsEncodePvt *epvt = (PackBitsEncodePvt *) state->private;
+ if (epvt) {
+ if (epvt->counts) XieFree(epvt->counts);
+ if (epvt->values) XieFree(epvt->values);
+ XieFree(epvt);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+int ActivateEPhotoFAX(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &rcp->band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ faxPvtPtr texpvt=(faxPvtPtr) pet->private;
+ FaxEncodeState *state = &texpvt->state;
+ int was_ready, status;
+
+ if (texpvt->notify)
+ was_ready = ped->outFlo.ready & 1;
+
+ status = sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd);
+
+ if(texpvt->notify && ~was_ready & ped->outFlo.ready & 1 &&
+ (texpvt->notify==xieValNewData ||
+ (texpvt->notify==xieValFirstData && !ped->outFlo.output[0].flink->start)))
+ SendExportAvailableEvent(flo,ped,0,0,0,0);
+
+ return( status );
+}
+
+/*------------------------------------------------------------------------
+-------------------- *really* crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int sub_fun(
+ floDefPtr flo,
+ peDefPtr ped,
+ peTexPtr pet,
+ faxPvtPtr texpvt,
+ FaxEncodeState *state,
+ bandPtr sbnd,
+ bandPtr dbnd)
+{
+BytePixel *src,*dst;
+int lines_coded;
+int nl_mappable;
+
+/*** This program can exit the while(dst) loop because:
+
+ 1) no new dst is available. This would only be because the
+ scheduler wants to activate somebody else.
+
+ 2) We can't get (map) a new input strip. Maybe it's not available
+ because our data is coming from the client. We want to return
+ so we can get some.
+
+ 3) we finished encoding all requested lines.
+
+ 4) we notice an error.
+
+ Now, the scheduler will always keep calling us as long as
+ we either have input data or final isn't set. We only set
+ final when we have used all input data and flushed all
+ output data. So there is no way for us to exit without
+ coming back properly.
+***/
+
+ src = GetCurrentSrc(flo,pet,sbnd);
+
+ if (dbnd->final) {
+ /* be forgiving if extra data gets passed to us */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+ while ((dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,dbnd->current,
+ texpvt->strip_req_newbytes,KEEP)) != 0) {
+
+ if (!state->strip) {
+ state->strip = dst;
+ state->strip_size = dbnd->maxLocal - dbnd->current;
+ state->strip_state = StripStateNew;
+ }
+ nl_mappable = sbnd->maxLocal - sbnd->current;
+ if (nl_mappable + sbnd->current > texpvt->height)
+ nl_mappable = texpvt->height - sbnd->current;
+
+ if (!MapData(flo,pet,sbnd,0,sbnd->current,nl_mappable,FLUSH)) {
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ return(TRUE); /* need another input strip */
+ }
+
+ state->i_lines = (char **)sbnd->dataMap;
+ state->nl_tocode = nl_mappable;
+
+ lines_coded = (*(texpvt->encodptr))(state);
+ if (lines_coded < 0 || state->encoder_done > FAX_ENCODE_DONE_OK) {
+ /* coding error. But we should be able to *en*code anything! */
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ state->i_line += lines_coded;
+ sbnd->current = state->i_line;
+
+ if (state->i_line >= texpvt->height) {
+ /* We're all done! */
+
+ if (state->bits.bitpos) {
+ /* we need to make sure the stager gets flushed */
+ unsigned char *byteptr= state->bits.byteptr;
+
+ if (state->bits.endptr > byteptr) {
+ /* there is room in this strip for the stager */
+ *byteptr = state->stager >> 24;
+ }
+ else {
+ /* woe is us. Stager won't fit in current output strip */
+ MaybeSwapOutput();
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+ /* flush current strip */
+ /* ask for one more strip of length 1 */
+ dst = (BytePixel*)GetDstBytes(flo,pet,
+ dbnd,dbnd->current,1,KEEP);
+ *dst = state->stager >> 24;
+ }
+ state->bits.byteptr++;
+ }
+ /* however we got here, we now have one strip to flush,
+ which contains all the remaining encoded data.
+ */
+ TruncateStrip(dbnd,
+ dbnd->minLocal + state->bits.byteptr - state->strip);
+ SetBandFinal(dbnd);
+ MaybeSwapOutput();
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+
+ if (state->magic_needs) {
+ /* encoder needs a new output strip */
+ if (state->strip_state != StripStateDone)
+ ImplementationError(flo,ped, return(FALSE));
+
+ MaybeSwapOutput();
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+ /* I presume this will increment dbnd->current */
+
+ state->strip = 0;
+ continue;
+ }
+
+ } /* end of while (GetDstBytes) */
+
+ return(TRUE);
+} /* end ActivateEPhotoFAX */
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+int ResetEPhotoFAX(floDefPtr flo, peDefPtr ped)
+{
+ faxPvtPtr texpvt=(faxPvtPtr) ped->peTex->private;
+
+ if (texpvt) FreeFaxData(flo,ped);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetEPhotoFAX */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+int DestroyEPhotoFAX(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyEPhotoFAX */
+/* end module mefax.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/mejpeg.c b/xc/programs/Xserver/XIE/mixie/export/mejpeg.c
new file mode 100644
index 000000000..e16ce5f69
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mejpeg.c
@@ -0,0 +1,645 @@
+/* $TOG: mejpeg.c /main/6 1998/02/09 16:13:13 kaleb $ */
+/**** module mejpeg.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mejpeg.c -- DDXIE prototype export photomap coded ala JPEG element
+
+ Ben Fahy -- AGE Logic, Inc. Oct, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mejpeg.c,v 3.6 1999/01/31 12:21:35 dawes Exp $ */
+
+#define _XIEC_MEPHOTO
+#define _XIEC_EPHOTO
+#define _XIEC_ECPHOTO
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <jpeg.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+extern int CreateEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped);
+extern int InitializeEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped);
+extern int ActivateEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+extern int ResetEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped);
+extern int DestroyEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped);
+
+/* Create routines are shared */
+int InitializeECPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped);
+/* Activate routines are shared */
+/* Reset routines are shared */
+/* Destroy routines are shared */
+
+/*
+ * routines used internal to this module
+ */
+
+/*
+ * Local Declarations
+ */
+
+typedef struct _jpeg_encode_pvt {
+ int (*encodptr)(); /* function used to encode the data */
+
+ xieTypDataClass class; /* SingleBand or TripleBand */
+ int out_bands; /* should be 1 if interleaved */
+ int in_bands; /* should be 3 if TripleBand */
+ int colors_smushed; /* TripleBand BandByPixel */
+ int swizzle; /* true to reverse band order */
+ int notify; /* relevant for ECPhoto only */
+ /* the following are used by the JPEG private routines */
+ struct Compress_methods_struct c_methods;
+ struct External_methods_struct e_methods;
+
+ /* these things hold state. may need one for each band */
+ JpegEncodeState state[3];
+ struct Compress_info_struct cinfo[3];
+ unsigned char output_buffer[3][JPEG_BUF_SIZE];
+} jpegPvtRec, *jpegPvtPtr;
+
+static int sub_fun(
+ floDefPtr flo,
+ peDefPtr ped,
+ peTexPtr pet,
+ jpegPvtPtr texpvt,
+ JpegEncodeState *state,
+ bandPtr sbnd,
+ bandPtr dbnd,
+ bandPtr sbnd1,
+ bandPtr sbnd2);
+
+static int common_init(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGBaseline *tec,
+ CARD16 encodeTechnique);
+
+static int FlushJpegEncodeData(
+ bandPtr dbnd,
+ register unsigned char *dst,
+ JpegEncodeState *state);
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+int CreateEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, sizeof(jpegPvtRec), NO_SYNC, NO_SYNC));
+} /* end CreateEPhotoJPEGBaseline */
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ return( common_init(flo,ped,pvt->encodeParms,pvt->encodeNumber) );
+}
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeECPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ peTexPtr pet = ped->peTex;
+ jpegPvtPtr texpvt=(jpegPvtPtr) pet->private;
+
+ if(!common_init(flo,ped,pvt->encodeParms,pvt->encodeNumber)) {
+ if(ferrCode(flo))
+ return(FALSE);
+ else
+ TechniqueError(flo,ped,xieValEncode,
+ ((xieFloExportClientPhoto*)ped->elemRaw)->encodeTechnique,
+ ((xieFloExportClientPhoto*)ped->elemRaw)->lenParams,
+ return(FALSE));
+ }
+ texpvt->notify = ((xieFloExportClientPhoto *)ped->elemRaw)->notify;
+ return(TRUE);
+}
+/*------------------------------------------------------------------------
+------- lots of stuff shared between ECPhoto and EPhoto. . . -------------
+------------------------------------------------------------------------*/
+static int common_init(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTecEncodeJPEGBaseline *tec,
+ CARD16 encodeTechnique)
+{
+ peTexPtr pet = ped->peTex;
+ eTecEncodeJPEGBaselineDefPtr pedpvt=(eTecEncodeJPEGBaselineDefPtr)
+ ped->techPvt;
+ jpegPvtPtr texpvt=(jpegPvtPtr) pet->private;
+ int out_bands = ped->outFlo.bands; /* # of output bands */
+ int in_bands = ped->inFloLst[SRCtag].bands; /* # of input bands */
+ formatPtr inf = pet->receptor[0].band[0].format;
+ compress_info_ptr cinfo;
+ int pbytes,max_lines_in,b;
+
+ /* every time we run, reset this */
+ bzero(texpvt,sizeof(jpegPvtRec));
+
+ /* squirrel away # of bands and class output, class of input */
+ texpvt->in_bands = in_bands;
+ texpvt->out_bands = out_bands;
+ texpvt->class = (in_bands == 3)? xieValTripleBand : xieValSingleBand;
+ texpvt->colors_smushed = 0;
+
+ /* note: we assume dixie side has set up the in/out #bands properly */
+ if (in_bands == 1)
+ texpvt->encodptr = encode_jpeg_lossy_gray;
+ /* JPEG will be coding grayscale */
+
+ else {
+ /* if interleave is BandByPlane, do gray, one band at a time.
+ * otherwise, do color, three bands at a time.
+ */
+ if (in_bands == out_bands) { /* interleaving BandByPlane */
+ texpvt->encodptr = encode_jpeg_lossy_gray;
+ /* JPEG will code each band individually */
+ }
+ else { /* BandByPixel, do all 3 bands at once */
+ texpvt->encodptr = encode_jpeg_lossy_color;
+ texpvt->colors_smushed = 1;
+ /* JPEG will code all bands simultaneously */
+ }
+ }
+ ped->peTex->bandSync = in_bands != out_bands;
+ texpvt->swizzle = tec->bandOrder == xieValMSFirst;
+
+ /* now deal with stuff on per-band basis */
+ for (b=0; b < out_bands; ++b) {
+ JpegEncodeState *state = &(texpvt->state[b]);
+
+ state->width = inf->width;
+ state->height = inf->height;
+ state->n_bands = texpvt->colors_smushed ? 3 : 1;
+ /* this is how many bands the encoder looks at. If the image is */
+ /* TripleBand-BandByPixel, 3. If BandByPlane or SingleBand, 1 */
+
+ state->c_methods = &texpvt->c_methods;
+ state->e_methods = &texpvt->e_methods;
+
+ state->lenQtable = tec->lenQtable;
+ state->lenACtable = tec->lenACtable;
+ state->lenDCtable = tec->lenDCtable;
+ state->Qtable = pedpvt->q;
+ state->ACtable = pedpvt->a;
+ state->DCtable = pedpvt->d;
+
+ state->goal = JPEG_ENCODE_GOAL_Startup;
+ state->needs_input_strip = 1;
+
+ cinfo = state->cinfo = &texpvt->cinfo[b];
+ if(JC_INIT(cinfo,state->c_methods,state->e_methods) != 0)
+ return(FALSE);
+
+ cinfo->jpeg_buf_size = JPEG_BUF_SIZE;
+ cinfo->output_buffer = (char *) texpvt->output_buffer[b];
+ state->jpeg_output_buffer = texpvt->output_buffer[b];
+
+ /* size of first output strip */
+ state->strip_req_newbytes = flo->floTex->stripSize;
+
+ if(texpvt->colors_smushed) {
+ int j;
+ for(j = 0; j < xieValMaxBands; ++j) {
+ state->h_sample[j] = tec->horizontalSamples[j];
+ state->v_sample[j] = tec->verticalSamples[j];
+ }
+ }
+ }
+ /* calculate size of the input strip data map we will need */
+ pbytes = (inf->pitch + 7) >> 3;
+ max_lines_in = flo->floTex->stripSize / pbytes;
+
+ if (!max_lines_in)
+ max_lines_in = 1; /* in case a line was bigger than std stripsize */
+
+ return(InitReceptors(flo, ped, max_lines_in, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+
+} /* end common_init() */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+int ActivateEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &rcp->band[0]; /* "red" (or gray) input */
+ bandPtr sbnd1 = &rcp->band[1]; /* optional "green" */
+ bandPtr sbnd2 = &rcp->band[2]; /* optional "blue" */
+ bandPtr dbnd = &pet->emitter[0];
+ jpegPvtPtr texpvt=(jpegPvtPtr) pet->private;
+ int b, d, was_ready = 0, status;
+
+ /* if the class of the src is SingleBand, we call sub_fun for band 0 */
+ /* if the class of the src is TripleBand and the interleave is */
+ /* BandByPlane, we call sub_fun 3 times, once for each band */
+ /* if the class of the src is TripleBand, interleave BandByPixel, we */
+ /* call subfun once, supplying it all three source bands */
+
+ if (texpvt->class == xieValSingleBand) {
+ JpegEncodeState *state = &(texpvt->state[0]);
+
+ if (texpvt->notify) {
+ was_ready = ped->outFlo.ready;
+ }
+
+ status = sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,NULL,NULL);
+
+ if(texpvt->notify && ~was_ready & ped->outFlo.ready & 1 &&
+ (texpvt->notify == xieValNewData ||
+ (texpvt->notify == xieValFirstData &&
+ !ped->outFlo.output[0].flink->start)))
+ SendExportAvailableEvent(flo,ped,0,0,0,0);
+
+ return( status );
+ }
+
+ /* TripleBand */
+ if (texpvt->colors_smushed) { /* BandByPixel */
+ JpegEncodeState *state = &(texpvt->state[0]);
+
+ if (texpvt->notify) {
+ was_ready = ped->outFlo.ready & 1;
+ }
+ if(texpvt->swizzle)
+ status = sub_fun(flo,ped,pet,texpvt,state,sbnd2,dbnd,sbnd1,sbnd);
+ else
+ status = sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,sbnd1,sbnd2);
+
+ if(texpvt->notify && ~was_ready & ped->outFlo.ready & 1 &&
+ (texpvt->notify == xieValNewData ||
+ (texpvt->notify == xieValFirstData &&
+ !ped->outFlo.output[0].flink->start)))
+ SendExportAvailableEvent(flo,ped,0,0,0,0);
+
+ return( status );
+ }
+
+ /* TripleBand, BandByPlane */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ JpegEncodeState *state = &(texpvt->state[b]);
+ d = texpvt->swizzle ? xieValMaxBands - b - 1 : b;
+ sbnd = &rcp->band[b]; /* do each band independently */
+ dbnd = &pet->emitter[d];
+
+ if (texpvt->notify) {
+ was_ready = ped->outFlo.ready & 1<<d;
+ }
+
+ status = sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,NULL,NULL);
+
+ if(texpvt->notify && ~was_ready & ped->outFlo.ready & 1<<d &&
+ (texpvt->notify == xieValNewData ||
+ (texpvt->notify == xieValFirstData &&
+ !ped->outFlo.output[d].flink->start)))
+ SendExportAvailableEvent(flo,ped,d,0,0,0);
+
+ if (status == FALSE)
+ return( status );
+ }
+ return(TRUE);
+}
+/*------------------------------------------------------------------------
+-------------------- *really* crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int sub_fun(
+ floDefPtr flo,
+ peDefPtr ped,
+ peTexPtr pet,
+ jpegPvtPtr texpvt,
+ JpegEncodeState *state,
+ bandPtr sbnd,
+ bandPtr dbnd,
+ bandPtr sbnd1,
+ bandPtr sbnd2)
+{
+BytePixel *dst;
+int status;
+
+/*** This program can return due to the following reasons:
+
+ 1) we have provided all the data an input strip has to the
+ encoder, and we are not at the end of the image. In this
+ case we can expect to return when more data comes.
+
+ 2) We try to get another Destination strip, but GetDst
+ turns us down because the scheduler wants to activate
+ somebody else. Since we haven't set final yet, we
+ are ok.
+
+ 3) after encoding, we notice the state is Done and there
+ is no data left to flush. We set final and return.
+
+ 4) we finish flushing all of our data, and notice state
+ is Done. We set final and return.
+
+ 5) we notice an error.
+
+ Now, the scheduler will always keep calling us as long as
+ we either have input data or final isn't set. We only set
+ final when we have used all input data and flushed all
+ output data. So there is no way for us to exit without
+ coming back properly.
+***/
+
+ (void) GetCurrentSrc(flo,pet,sbnd);
+ if (dbnd->final) {
+ /* be forgiving if extra data gets passed to us */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+ while ((dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,dbnd->current,
+ state->strip_req_newbytes,FLUSH)) != 0) {
+ if (state->flush_output) {
+
+ status = FlushJpegEncodeData(dbnd,dst,state);
+ /* write as much as we can to output strip. This */
+ /* also updates state->i_line and state->nl_coded. */
+
+ if (status == JPEG_FLUSH_FlushedAll) {
+ state->strip_req_newbytes = dbnd->maxLocal - dbnd->current;
+ state->cinfo->bytes_in_buffer = 0;
+ if (state->goal == JPEG_ENCODE_GOAL_Done) {
+ /* we're done and nothing to flush, so let's wrap up */
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ if (sbnd1) {
+ FreeData(flo,pet,sbnd1,sbnd1->maxGlobal);
+ FreeData(flo,pet,sbnd2,sbnd2->maxGlobal);
+ }
+ return(TRUE);
+ }
+ continue;
+ /* go around loop again. Get another dst */
+ /* (if needed) and encode some more */
+ }
+ else if (status == JPEG_FLUSH_FlushedPart) {
+ /* go get another Destination strip */
+ state->strip_req_newbytes = flo->floTex->stripSize;
+ PutData(flo,pet,dbnd,dbnd->current);
+ continue;
+ }
+ else
+ ImplementationError(flo,ped, return(FALSE));
+
+ } /* end of if flush */
+ else {
+ state->nl_tocode = 0;
+ if (state->i_line < state->height) {
+
+ /* haven't reached the end of the image yet */
+ int nl_mappable = sbnd->maxLocal - sbnd->current;
+
+ if (sbnd->current != state->i_line)
+ OperatorError(flo,ped,123,return(FALSE)) ;
+
+ if (!MapData(flo,pet,sbnd,0,sbnd->current,nl_mappable,FLUSH)) {
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ if (sbnd1) {
+ FreeData(flo,pet,sbnd1,sbnd1->maxLocal);
+ FreeData(flo,pet,sbnd2,sbnd2->maxLocal);
+ }
+ return(TRUE); /* need another input strip */
+ }
+
+ state->i_lines[0] = (unsigned char **)sbnd->dataMap;
+ state->nl_tocode = sbnd->maxLocal - sbnd->current;
+
+ if (sbnd1) {
+
+ if (!MapData(flo,pet,sbnd1,0,sbnd1->current,nl_mappable,FLUSH)) {
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ FreeData(flo,pet,sbnd1,sbnd1->maxLocal);
+ FreeData(flo,pet,sbnd2,sbnd2->maxLocal);
+ return(TRUE); /* need another input strip */
+ }
+ state->i_lines[1] = (unsigned char **)sbnd1->dataMap;
+
+ if (!MapData(flo,pet,sbnd2,0,sbnd2->current,nl_mappable,FLUSH)) {
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ FreeData(flo,pet,sbnd1,sbnd1->maxLocal);
+ FreeData(flo,pet,sbnd2,sbnd2->maxLocal);
+ return(TRUE); /* need another input strip */
+ }
+ state->i_lines[2] = (unsigned char **)sbnd2->dataMap;
+ }
+ } /* end of if (state->i_line < state->height) */
+
+ if (state->cinfo->bytes_in_buffer) {
+ /* this should not be possible if the flushing code is working */
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ if ( (*(texpvt->encodptr))(state) < 0 )
+ ImplementationError(flo,ped, return(FALSE));
+ /* coding error. We should be able to encode anything! */
+
+ sbnd->current = state->i_line;
+ if (sbnd1)
+ sbnd1->current = sbnd2->current = state->i_line;
+
+ if (state->flush_output) {
+ /* encoder wants us to flush its buffer before we call */
+ /* it again. record position of where to start flushing */
+
+ state->jpeg_output_bpos = (unsigned char *)
+ state->cinfo->output_buffer;
+ continue;
+ }
+ if (state->goal == JPEG_ENCODE_GOAL_Done) {
+ /* we're done and nothing to flush, so let's wrap up */
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal);
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ if (sbnd1) {
+ FreeData(flo,pet,sbnd1,sbnd1->maxGlobal);
+ FreeData(flo,pet,sbnd2,sbnd2->maxGlobal);
+ }
+ return(TRUE);
+ }
+ if (!state->nl_tocode) {
+ /* we have no input left */
+ if (state->i_line < state->height) {
+ /* need another input strip */
+ FreeData(flo,pet,sbnd,sbnd->current);
+ if (sbnd1) {
+ FreeData(flo,pet,sbnd1,sbnd1->current);
+ FreeData(flo,pet,sbnd2,sbnd2->current);
+ }
+ return(TRUE);
+ }
+ else
+ state->goal = JPEG_ENCODE_GOAL_EndFrame;
+ }
+
+ } /* end of else !flush */
+
+ } /* end of while (GetDstBytes) */
+
+ return(TRUE);
+} /* end ActivateEPhotoJPEGBaseline */
+/*------------------------------------------------------------------------
+------------------- flush JPEG buffer to output strip -------------------
+------------------------------------------------------------------------*/
+static int FlushJpegEncodeData(
+ bandPtr dbnd,
+ register unsigned char *dst,
+ JpegEncodeState *state)
+{
+register unsigned char *jpeg_odata = state->jpeg_output_bpos;
+int bytes_left_in_strip;
+register int i,max_can_do;
+
+ bytes_left_in_strip = dbnd->maxLocal - dbnd->current;
+ /* dbnd->current is the offset from start of strip, */
+ /* so it represents the number of bytes used */
+ max_can_do = (bytes_left_in_strip > state->flush_output)?
+ state->flush_output : bytes_left_in_strip;
+
+ for (i=0; i<max_can_do; ++i)
+ *dst++ = *jpeg_odata++;
+
+ dbnd->current += max_can_do;
+ state->flush_output -= max_can_do;
+ state->jpeg_output_bpos += max_can_do;
+
+ if (state->flush_output)
+ return(JPEG_FLUSH_FlushedPart);
+ else
+ return(JPEG_FLUSH_FlushedAll);
+}
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+int ResetEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ /* get rid of the any data malloc'd by JPEG encoder
+ */
+ if(ped->peTex) {
+ jpegPvtPtr texpvt = (jpegPvtPtr) ped->peTex->private;
+ int b;
+
+ /* JPEG code has its own global free routine
+ */
+ for (b=0; b<texpvt->in_bands; ++b) {
+ if(texpvt->cinfo[b].emethods && texpvt->cinfo[b].emethods->c_free_all)
+ (*texpvt->cinfo[b].emethods->c_free_all)(& texpvt->cinfo[b]);
+ }
+ }
+ return(TRUE);
+} /* end ResetEPhotoJPEGBaseline */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+int DestroyEPhotoJPEGBaseline(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyEPhotoJPEGBaseline */
+/* end module mejpeg.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/melut.c b/xc/programs/Xserver/XIE/mixie/export/melut.c
new file mode 100644
index 000000000..bf32d682e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/melut.c
@@ -0,0 +1,215 @@
+/* $TOG: melut.c /main/6 1998/02/09 16:13:18 kaleb $ */
+/**** module melut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ melut.c -- DDXIE prototype export lut element
+
+ Larry Hare -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/melut.c,v 3.4 1998/10/25 07:11:55 dawes Exp $ */
+
+#define _XIEC_MELUT
+#define _XIEC_ELUT
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <lut.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/*
+ * routines used internal to this module
+ */
+static int CreateELUT(floDefPtr flo, peDefPtr ped);
+static int InitializeELUT(floDefPtr flo, peDefPtr ped);
+static int ActivateELUT(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetELUT(floDefPtr flo, peDefPtr ped);
+static int DestroyELUT(floDefPtr flo, peDefPtr ped);
+
+/*
+ * DDXIE ExportLUT entry points
+ */
+static ddElemVecRec ELUTVec = {
+ CreateELUT,
+ InitializeELUT,
+ ActivateELUT,
+ (xieIntProc)NULL,
+ ResetELUT,
+ DestroyELUT
+ };
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeELUT(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = ELUTVec;
+
+ return(TRUE);
+} /* end miAnalyzeELUT */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateELUT(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the lut element definition */
+ return(MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC));
+} /* end CreateELUT */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeELUT(floDefPtr flo, peDefPtr ped)
+{
+ return InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeELUT */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateELUT(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp->inFlo->bands;
+ bandPtr sbnd = &rcp->band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ CARD32 b;
+
+ for(b = 0; b < bands; ++sbnd, ++dbnd, ++b) {
+
+ /* get pointer to the initial src data (i.e. beginning of strip)
+ */
+ if(GetCurrentSrc(flo,pet,sbnd)) {
+
+ /* LUT only has 1 strip per band
+ */
+ if(!PassStrip(flo,pet,dbnd,sbnd->strip))
+ return(FALSE);
+
+ /* free the amount of src strip(s) we've used
+ */
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ }
+ }
+ return(TRUE);
+} /* end ActivateELUT */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetELUT(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetELUT */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyELUT(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyELUT */
+
+/* end module melut.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/mephoto.c b/xc/programs/Xserver/XIE/mixie/export/mephoto.c
new file mode 100644
index 000000000..5b7ec7141
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/mephoto.c
@@ -0,0 +1,775 @@
+/* $TOG: mephoto.c /main/8 1998/02/09 16:13:22 kaleb $ */
+/**** module mephoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mephoto.c -- DDXIE prototype export photomap element
+
+ Robert NC Shelley -- AGE Logic, Inc. June, 1993
+ Dean && Ben - various additions to handle different techniques
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/mephoto.c,v 3.4 1998/10/25 07:11:55 dawes Exp $ */
+
+#define _XIEC_MEPHOTO
+#define _XIEC_EPHOTO
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <meuncomp.h>
+#include <memory.h>
+
+/*
+ * routines used internal to this module
+ */
+static int CreateEPhotoUncom(floDefPtr flo, peDefPtr ped);
+static int InitializeEPhotoBypass(floDefPtr flo, peDefPtr ped);
+static int InitializeEPhotoUncomByPlane(floDefPtr flo, peDefPtr ped);
+static int ActivateEPhotoUncomByPlane(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetEPhoto(floDefPtr flo, peDefPtr ped);
+static int DestroyEPhoto(floDefPtr flo, peDefPtr ped);
+
+#if XIE_FULL
+static int InitializeEPhotoUncomByPixel(floDefPtr flo, peDefPtr ped);
+static int ActivateEPhotoUncomByPixel(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+#endif /* XIE_FULL */
+
+
+/*
+ * routines we need from somewhere else
+ */
+
+extern int CreateEPhotoJPEGBaseline();
+extern int InitializeEPhotoJPEGBaseline();
+extern int ActivateEPhotoJPEGBaseline();
+extern int ResetEPhotoJPEGBaseline();
+extern int DestroyEPhotoJPEGBaseline();
+
+extern int CreateEPhotoFAX();
+extern int InitializeEPhotoFAX();
+extern int ActivateEPhotoFAX();
+extern int ResetEPhotoFAX();
+extern int DestroyEPhotoFAX();
+
+/*
+ * DDXIE ExportPhotomap entry points
+ */
+static ddElemVecRec EPhotoBypassVec = {
+ CreateEPhotoUncom,
+ InitializeEPhotoBypass,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetEPhoto,
+ DestroyEPhoto
+ };
+
+static ddElemVecRec EPhotoUncomByPlaneVec = {
+ CreateEPhotoUncom,
+ InitializeEPhotoUncomByPlane,
+ ActivateEPhotoUncomByPlane,
+ (xieIntProc)NULL,
+ ResetEPhoto,
+ DestroyEPhoto
+ };
+
+static ddElemVecRec EPhotoFAXVec = {
+ CreateEPhotoFAX,
+ InitializeEPhotoFAX,
+ ActivateEPhotoFAX,
+ (xieIntProc)NULL,
+ ResetEPhotoFAX,
+ DestroyEPhotoFAX
+ };
+
+#if XIE_FULL
+static ddElemVecRec EPhotoUncomByPixelVec = {
+ CreateEPhotoUncom,
+ InitializeEPhotoUncomByPixel,
+ ActivateEPhotoUncomByPixel,
+ (xieIntProc)NULL,
+ ResetEPhoto,
+ DestroyEPhoto
+ };
+
+static ddElemVecRec EPhotoJPEGBaselineVec = {
+ CreateEPhotoJPEGBaseline,
+ InitializeEPhotoJPEGBaseline,
+ ActivateEPhotoJPEGBaseline,
+ (xieIntProc)NULL,
+ ResetEPhotoJPEGBaseline,
+ DestroyEPhotoJPEGBaseline
+ };
+#endif /* XIE_FULL */
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeEPhoto(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ if(pvt->congress) {
+ ped->ddVec = EPhotoBypassVec;
+ return(TRUE);
+ }
+ switch(pvt->encodeNumber) {
+
+ case xieValEncodeUncompressedSingle:
+ ped->ddVec = EPhotoUncomByPlaneVec;
+ break;
+
+ case xieValEncodeG31D:
+ case xieValEncodeG32D:
+ case xieValEncodeG42D:
+ case xieValEncodeTIFF2:
+ case xieValEncodeTIFFPackBits:
+ ped->ddVec = EPhotoFAXVec;
+ break;
+
+#if XIE_FULL
+ case xieValEncodeUncompressedTriple:
+ {
+ xieTecEncodeUncompressedTriple *tecParms =
+ (xieTecEncodeUncompressedTriple *)pvt->encodeParms;
+ if(tecParms->interleave == xieValBandByPlane)
+ ped->ddVec = EPhotoUncomByPlaneVec;
+ else
+ ped->ddVec = EPhotoUncomByPixelVec;
+ }
+ break;
+ case xieValEncodeJPEGBaseline:
+ { /*** JPEG for SI can only handle 8 bit image depths ***/
+ inFloPtr inf = &ped->inFloLst[IMPORT];
+ outFloPtr src = &inf->srcDef->outFlo;
+ int b;
+ for (b=0; b< src->bands; ++b)
+ if(src->format[b].depth != 8) {
+ xieFloExportPhotomap *raw = (xieFloExportPhotomap *)ped->elemRaw;
+
+ TechniqueError(flo, ped, xieValEncode,
+ raw->encodeTechnique, raw->lenParams, return(FALSE));
+ }
+ }
+ ped->ddVec = EPhotoJPEGBaselineVec;
+ break;
+ case xieValEncodeJPEGLossless:
+#endif /* XIE_FULL */
+ default: ImplementationError(flo,ped, return(FALSE));
+ }
+ return(TRUE);
+} /* end miAnalyzeEPhoto */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateEPhotoUncom(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, xieValMaxBands * sizeof(meUncompRec),
+ NO_SYNC, NO_SYNC));
+} /* end CreateEPhotoUncom */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEPhotoBypass(floDefPtr flo, peDefPtr ped)
+{
+ /* Allows data manager to bypass element entirely */
+ return(InitReceptor(flo, ped, ped->peTex->receptor,
+ NO_DATAMAP, 1, NO_BANDS, ALL_BANDS));
+} /* end InitializeEPhotoBypass */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEPhotoUncomByPlane(floDefPtr flo, peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ formatPtr inf = ped->inFloLst[SRCtag].format;
+ bandPtr sbnd = pet->receptor->band;
+ CARD32 nbands = ped->outFlo.bands, b, s;
+ xieTypOrientation pixelOrder, fillOrder;
+ Bool inited = FALSE;
+
+ if (nbands == 1) {
+ xieTecEncodeUncompressedSingle *tecParms =
+ (xieTecEncodeUncompressedSingle *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+ pixelOrder = tecParms->pixelOrder;
+ fillOrder = tecParms->fillOrder;
+ pvt[0].bandMap = 0;
+ } else {
+ xieTecEncodeUncompressedTriple *tecParms =
+ (xieTecEncodeUncompressedTriple *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+ pixelOrder = tecParms->pixelOrder;
+ fillOrder = tecParms->fillOrder;
+ if(tecParms->bandOrder == xieValLSFirst)
+ for(b = 0; b < xieValMaxBands; ++b)
+ pvt[b].bandMap = b;
+ else
+ for(s = 0, b = xieValMaxBands; b--; ++s)
+ pvt[s].bandMap = b;
+ }
+ for (b = 0; b < nbands; b++, pvt++, inf++, sbnd++) {
+ bandPtr dbnd = &pet->emitter[pvt->bandMap];
+ formatPtr outf = &ped->outFlo.format[pvt->bandMap];
+ CARD8 class = inf->class;
+ if (class == BIT_PIXEL) {
+ pvt->width = inf->width;
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ if (outf->stride != 1) {
+ pvt->action = (fillOrder == xieValMSFirst) ? btoIS: sbtoIS;
+ } else {
+ pvt->action = (fillOrder == xieValMSFirst) ?
+ (void (*)())NULL : sbtoS;
+ }
+#else
+ if (outf->stride != 1) {
+ pvt->action = (fillOrder == xieValLSFirst) ? btoIS: sbtoIS;
+ } else {
+ pvt->action = (fillOrder == xieValLSFirst) ?
+ (void (*)())NULL : sbtoS;
+ }
+#endif
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ } else if (class == BYTE_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 7)) {
+ if (outf->stride == 8)
+ pvt->action = BtoS;
+ else
+ pvt->action = BtoIS;
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = BtoLLUB;
+ else
+ pvt->action = BtoLMUB;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = BtoMLUB;
+ else
+ pvt->action = BtoMMUB;
+ }
+ pvt->bitOff = 0; /* Bit offset to first pixel on line */
+ pvt->leftOver = 0; /* Left over bits from last line */
+ pvt->depth = inf->depth;
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ }
+ } else if (class == PAIR_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 15)) {
+#if (IMAGE_BYTE_ORDER == LSBFirst)
+ if (outf->stride == 16)
+ pvt->action = (fillOrder == xieValLSFirst) ?
+ (void (*)())NULL : sPtoS;
+ else
+ pvt->action = (fillOrder == xieValLSFirst) ? PtoIS: sPtoIS;
+#else
+ if (outf->stride == 16)
+ pvt->action = (fillOrder == xieValMSFirst) ?
+ (void (*)())NULL : sPtoS;
+ else
+ pvt->action = (fillOrder == xieValMSFirst) ? PtoIS: sPtoIS;
+#endif
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = PtoLLUP;
+ else
+ pvt->action = PtoLMUP;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = PtoMLUP;
+ else
+ pvt->action = PtoMMUP;
+ }
+ pvt->bitOff = 0; /* Bit offset to first pixel on line */
+ pvt->leftOver = 0; /* Left over bits from last line */
+ pvt->depth = inf->depth;
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ }
+ } else if (class == QUAD_PIXEL) {
+ pvt->width = inf->width;
+ if (!(outf->stride & 31)) {
+#if (IMAGE_BYTE_ORDER == LSBFirst)
+ if (outf->stride == 32)
+ pvt->action = (fillOrder == xieValLSFirst) ?
+ (void (*)())NULL : sQtoS;
+ else
+ pvt->action = (fillOrder == xieValLSFirst) ? QtoIS: sQtoIS;
+#else
+ if (outf->stride == 32)
+ pvt->action = (fillOrder == xieValMSFirst) ?
+ (void (*)())NULL : sQtoS;
+ else
+ pvt->action = (fillOrder == xieValMSFirst) ? QtoIS: sQtoIS;
+#endif
+ pvt->Bstride = outf->stride >> 3;
+ pvt->dstoffset = 0;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ } else {
+ if (pixelOrder == xieValLSFirst) {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = QtoLLUQ;
+ else
+ pvt->action = QtoLMUQ;
+ } else {
+ if (fillOrder == xieValLSFirst)
+ pvt->action = QtoMLUQ;
+ else
+ pvt->action = QtoMMUQ;
+ }
+ }
+ } else
+ ImplementationError(flo,ped, return(FALSE));
+
+ if (pvt->action) {
+ pvt->bitOff = 0; /* Bit offset to first pixel on line */
+ pvt->leftOver = 0; /* Left over bits from last line */
+ pvt->width = inf->width;
+ pvt->depth = inf->depth;
+ pvt->stride = outf->stride;
+ pvt->pitch = outf->pitch;
+ if(!InitBand(flo,ped,sbnd,NO_DATAMAP,(CARD32)1,NO_INPLACE) ||
+ !InitBand(flo,ped,dbnd,NO_DATAMAP,(CARD32)0,NO_INPLACE))
+ return(FALSE);
+ inited = TRUE;
+ } else {
+ *outf = *inf; /* Pass data into photomap in native format */
+ sbnd->receptor->bypass |= 1<<b;
+ }
+ }
+ pet->bandSync = NO_SYNC;
+
+ return(inited ? TRUE :
+ /* Allows data manager to bypass element entirely */
+ InitReceptor(flo,ped,pet->receptor,NO_DATAMAP,1,NO_BANDS,ALL_BANDS));
+} /* end InitializeEPhotoUncomByPlane */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateEPhotoUncomByPlane(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp->inFlo->bands;
+ bandPtr sbnd = rcp->band, dbnd;
+ CARD32 b, olddlen, nextdlen, width, stride, pitch;
+ pointer src;
+ CARD8 *dst;
+
+ for(b = 0; b < bands; ++sbnd, ++b, ++pvt) {
+ dbnd = &pet->emitter[pvt->bandMap];
+ width = sbnd->format->width;
+ pitch = dbnd->format->pitch;
+ stride = dbnd->format->stride;
+ nextdlen = (pvt->bitOff + pitch + 7) >> 3;
+
+ if (!(pet->scheduled & 1<<b)) continue; /* This band is bypassed */
+
+ src = GetCurrentSrc(flo,pet,sbnd);
+ dst = (CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,nextdlen,KEEP);
+
+ while(!ferrCode(flo) && src && dst) {
+
+ (*pvt->action)(src,dst,pvt);
+
+ src = GetNextSrc(flo,pet,sbnd,FLUSH);
+ pvt->bitOff = (pvt->bitOff + pitch) & 7; /* Set next */
+ olddlen = (pvt->bitOff) ? nextdlen - 1: nextdlen;
+ nextdlen = (pvt->bitOff + pitch + 7) >> 3;
+ dst = (CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current+olddlen,
+ nextdlen,KEEP);
+ }
+ FreeData(flo,pet,sbnd,sbnd->current);
+
+ if(!src && sbnd->final) {
+ if (pvt->bitOff) /* If we have any bits left, send them out now */
+ *(CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,1,KEEP)=pvt->leftOver;
+
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal); /* write the remaining data */
+ }
+ }
+ return(TRUE);
+} /* end ActivateEPhotoUncomByPlane */
+
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEPhotoUncomByPixel(floDefPtr flo, peDefPtr ped)
+{
+ peTexPtr pet = ped->peTex;
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ xieTecEncodeUncompressedTriple *tec =
+ (xieTecEncodeUncompressedTriple *)
+ ((ePhotoDefPtr)ped->elemPvt)->encodeParms;
+ formatPtr outf = pet->emitter[0].format;
+ bandPtr sbnd1,sbnd2,sbnd3;
+ CARD32 depth1,depth2,depth3,dstride;
+ int s, d;
+
+ pvt->unaligned = (tec->pixelStride[0] & 7) != 0;
+
+ if(tec->bandOrder == xieValLSFirst)
+ for(d = 0; d < xieValMaxBands; ++d)
+ pvt[d].bandMap = d;
+ else
+ for(s = 0, d = xieValMaxBands; d--; ++s)
+ pvt[s].bandMap = d;
+
+ sbnd1 = &pet->receptor[SRCtag].band[pvt[0].bandMap];
+ sbnd2 = &pet->receptor[SRCtag].band[pvt[1].bandMap];
+ sbnd3 = &pet->receptor[SRCtag].band[pvt[2].bandMap];
+ depth1 = pvt[0].depth = sbnd1->format->depth;
+ depth2 = pvt[1].depth = sbnd2->format->depth;
+ depth3 = pvt[2].depth = sbnd3->format->depth;
+ dstride = tec->pixelStride[0]>>3;
+ pvt[0].width = pvt[1].width = pvt[2].width = sbnd1->format->width;
+
+ if (!pvt->unaligned) {
+ /* Look for special cases */
+ if (depth1 == 16 && depth2 == 16 && depth3 == 16) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? PtoIS : sPtoIS;
+#else
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? sPtoIS : PtoIS;
+#endif
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = pa;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = s;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ }
+ } else if (depth1 == 8 && depth2 == 8 && depth3 == 8) {
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = BtoIS;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = s;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ pvt->clear_dst = FALSE;
+ }
+ } else if (depth1 == 4 && depth2 == 4 && depth3 == 4) {
+ if (tec->fillOrder == xieValMSFirst) {
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 4;
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0x0f;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 0;
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 1;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ pvt->shift = 4;
+ } else { /* xieValLSFirst */
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->clear_dst = FALSE;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = 0xf0;
+ pvt->clear_dst = FALSE;
+ (pvt++)->shift = 4;
+ pvt->action = BtoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 1;
+ pvt->mask = 0x0f;
+ pvt->clear_dst = FALSE;
+ pvt->shift = 0;
+ }
+ } else if (depth1 + depth2 + depth3 <= 8) {
+ CARD8 ones = 0xff,smask1,smask2,smask3,shift1,shift2,shift3;
+ if (tec->fillOrder == xieValMSFirst) {
+ smask1 = ~(ones>>depth1);
+ smask2 = ~(ones>>(depth1 + depth2) | smask1);
+ smask3 = ~(ones>>(depth1 + depth2 + depth3) | smask1 | smask2);
+ shift1 = 8 - depth1;
+ shift2 = 8 - (depth1 + depth2);
+ shift3 = 8 - (depth1 + depth2 + depth3);
+ } else { /* fillOrder == xieValLSFirst */
+ smask3 = ~(ones<<depth3);
+ smask2 = ~(ones<<(depth2 + depth3) | smask3);
+ smask1 = ~(ones<<(depth1 + depth2 + depth3) | smask2 | smask3);
+ shift3 = 0;
+ shift2 = depth3;
+ shift1 = depth2 + depth3;
+ }
+ pvt->action = (depth1 > 1) ? BtoISb : btoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask1;
+ pvt->clear_dst = TRUE;
+ (pvt++)->shift = shift1;
+ pvt->action = (depth2 > 1) ? BtoISb : btoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask2;
+ pvt->clear_dst = TRUE;
+ (pvt++)->shift = shift2;
+ pvt->action = (depth3 > 1) ? BtoISb : btoISb;
+ pvt->Bstride = dstride;
+ pvt->dstoffset = 0;
+ pvt->mask = smask3;
+ pvt->clear_dst = TRUE;
+ pvt->shift = shift3;
+ } else
+ pvt->unaligned = TRUE;
+ }
+ pvt = (meUncompPtr)pet->private;
+ if (pvt->unaligned) {
+ /* No special cases, do it the hard way */
+ pvt[0].pitch = outf->pitch;
+ pvt->action = EncodeTripleFuncs[tec->pixelOrder == xieValLSFirst ? 0 : 1]
+ [tec->fillOrder == xieValLSFirst ? 0 : 1]
+ [depth1 <= 8 ? 0 : 1]
+ [depth2 <= 8 ? 0 : 1]
+ [depth3 <= 8 ? 0 : 1];
+ if((depth1 == 1 && !(pvt[0].buf = (pointer)XieMalloc(pvt[0].width+7))) ||
+ (depth2 == 1 && !(pvt[1].buf = (pointer)XieMalloc(pvt[1].width+7))) ||
+ (depth3 == 1 && !(pvt[2].buf = (pointer)XieMalloc(pvt[2].width+7))))
+ AllocError(flo,ped, return(FALSE));
+ }
+ pet->bandSync = SYNC;
+
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeEPhotoUncomByPixel */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateEPhotoUncomByPixel(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ meUncompPtr pvt = (meUncompPtr)pet->private;
+ bandPtr sb0 = &pet->receptor[SRCtag].band[pvt[0].bandMap];
+ bandPtr sb1 = &pet->receptor[SRCtag].band[pvt[1].bandMap];
+ bandPtr sb2 = &pet->receptor[SRCtag].band[pvt[2].bandMap];
+ bandPtr dbnd = &pet->emitter[0];
+ CARD32 pitch = dbnd->format->pitch;
+ pointer sp0 = (pointer )NULL, sp1 = (pointer )NULL, sp2 = (pointer )NULL;
+ CARD8 *dst;
+
+
+ if (pvt->unaligned) {
+ CARD32 stride = dbnd->format->stride;
+ CARD32 width = dbnd->format->width;
+ CARD32 nextdlen = (pvt->bitOff + pitch + 7) >> 3, olddlen;
+ if((sp0 = GetCurrentSrc(flo,pet,sb0)) &&
+ (sp1 = GetCurrentSrc(flo,pet,sb1)) &&
+ (sp2 = GetCurrentSrc(flo,pet,sb2)) &&
+ (dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,dbnd->current,
+ nextdlen,KEEP)))
+ do {
+ if(pvt[0].buf) sp0 = bitexpand(sp0,pvt[0].buf,width,(char)0,(char)1);
+ if(pvt[1].buf) sp1 = bitexpand(sp1,pvt[1].buf,width,(char)0,(char)1);
+ if(pvt[2].buf) sp2 = bitexpand(sp2,pvt[2].buf,width,(char)0,(char)1);
+
+ (*pvt->action)(sp0,sp1,sp2,dst,stride,pvt);
+
+ sp0 = GetNextSrc(flo,pet,sb0,FLUSH);
+ sp1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ sp2 = GetNextSrc(flo,pet,sb2,FLUSH);
+ pvt->bitOff = (pvt->bitOff + pitch) & 7; /* Set next */
+ olddlen = (pvt->bitOff) ? nextdlen - 1 : nextdlen;
+ nextdlen = (pvt->bitOff + pitch + 7) >> 3;
+ dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,
+ dbnd->current+olddlen,nextdlen,KEEP);
+ } while(dst && sp0 && sp1 && sp2);
+
+ } else {
+ CARD32 dlen = pitch >> 3; /* For nicely aligned data */
+ if((sp0 = GetCurrentSrc(flo,pet,sb0)) &&
+ (sp1 = GetCurrentSrc(flo,pet,sb1)) &&
+ (sp2 = GetCurrentSrc(flo,pet,sb2)) &&
+ (dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,dbnd->current,dlen,KEEP)))
+
+ do {
+
+ if (pvt[0].clear_dst) bzero(dst,(int)dlen);
+
+ (*pvt[0].action)(sp0,dst,&pvt[0]);
+ (*pvt[1].action)(sp1,dst,&pvt[1]);
+ (*pvt[2].action)(sp2,dst,&pvt[2]);
+
+ sp0 = GetNextSrc(flo,pet,sb0,FLUSH);
+ sp1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ sp2 = GetNextSrc(flo,pet,sb2,FLUSH);
+ dst = (BytePixel*)GetDstBytes(flo,pet,dbnd,dbnd->current+dlen,
+ dlen,KEEP);
+ } while(dst && sp0 && sp1 && sp2);
+ }
+
+ FreeData(flo,pet,sb0,sb0->current);
+ FreeData(flo,pet,sb1,sb1->current);
+ FreeData(flo,pet,sb2,sb2->current);
+
+ if(!sp0 && sb0->final && !sp1 && sb1->final && !sp2 && sb2->final) {
+ if (pvt->bitOff) /* If we have any bits left, send them out now */
+ *(CARD8*)GetDstBytes(flo,pet,dbnd,dbnd->current,1,KEEP) = pvt->leftOver;
+
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,dbnd->maxGlobal); /* write the remaining data */
+ }
+
+ return(TRUE);
+} /* end ActivateEPhotoUncomByPixel */
+#endif /* XIE_FULL */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetEPhoto(floDefPtr flo, peDefPtr ped)
+{
+ meUncompPtr pvt = (meUncompPtr)ped->peTex->private;
+ int i;
+
+ for(i = 0; i < xieValMaxBands; ++i)
+ if(pvt[i].buf) pvt[i].buf = (pointer) XieFree(pvt[i].buf);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetEPhoto */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyEPhoto(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyEPhoto */
+
+/* end module mephoto.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/meroi.c b/xc/programs/Xserver/XIE/mixie/export/meroi.c
new file mode 100644
index 000000000..6420e5e47
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/meroi.c
@@ -0,0 +1,181 @@
+/* $TOG: meroi.c /main/5 1998/02/09 16:13:27 kaleb $ */
+/**** module meroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ meroi.c -- DDXIE export roi element
+
+ Dean Verheiden -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/meroi.c,v 3.4 1998/10/25 07:11:56 dawes Exp $ */
+
+#define _XIEC_MEROI
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/*
+ * routines used internal to this module
+ */
+static int CreateEROI(floDefPtr flo, peDefPtr ped);
+static int InitializeEROI(floDefPtr flo, peDefPtr ped);
+static int ResetEROI(floDefPtr flo, peDefPtr ped);
+static int DestroyEROI(floDefPtr flo, peDefPtr ped);
+
+/*
+ * DDXIE ImportROI entry points
+ */
+static ddElemVecRec meROIVec =
+{
+ CreateEROI,
+ InitializeEROI,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetEROI,
+ DestroyEROI
+};
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeEROI(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = meROIVec;
+ return TRUE ;
+} /* end miAnalyzeEROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateEROI(floDefPtr flo, peDefPtr ped)
+{
+ /* attach an execution context to the roi element definition */
+ return MakePETex(flo,ped,NO_PRIVATE,NO_SYNC,NO_SYNC);
+} /* end CreateEROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeEROI(floDefPtr flo, peDefPtr ped)
+{
+ /* Allows data manager to bypass element entirely */
+ return(InitReceptor(flo, ped, ped->peTex->receptor, NO_DATAMAP, 1, NO_BANDS,
+ ALL_BANDS));
+
+} /* end InitializeEROI */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetEROI(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ return TRUE;
+} /* end ResetEROI */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyEROI(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+ return TRUE;
+} /* end DestroyEROI */
+
+/* end module meroi.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/meuncomp.c b/xc/programs/Xserver/XIE/mixie/export/meuncomp.c
new file mode 100644
index 000000000..55c3de917
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/meuncomp.c
@@ -0,0 +1,1348 @@
+/* $TOG: meuncomp.c /main/5 1998/02/09 16:13:32 kaleb $ */
+/**** module meuncomp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ meuncomp.c -- DDXIE routines for exporting uncompressed data
+
+ Dean Verheiden -- AGE Logic, Inc. October 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/meuncomp.c,v 1.4 1998/10/25 07:11:56 dawes Exp $ */
+
+#define _XIEC_MEUNCOMP
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <meuncomp.h>
+
+
+/***********************************************************************/
+/****************** Aligned data conversion routines *******************/
+/***********************************************************************/
+
+/* Band by Plane action routines */
+
+/* bits to stream */
+void btoS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+ memcpy((char *)dst,(char *)src, (int)(pvt->width + 7) >> 3);
+}
+
+/* swapped bits to stream */
+void sbtoS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+int i, count;
+
+ count = (pvt->width + 7) >> 3; /* Pack down to bits */
+
+ for (i = 0; i < count; i++) *dst++ = _ByteReverseTable[*src++];
+}
+
+/* bits to stream with pad */
+void btoIS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+CARD32 stride = pvt->stride;
+CARD32 width = pvt->width;
+CARD32 pitch = pvt->pitch;
+CARD32 j = pvt->bitOff;
+CARD32 i;
+
+ if (j) /* Don't bzero partial byte left from last scanline */
+ bzero(dst + 1, ((j + pitch + 7) >> 3) - 1);
+ else
+ bzero(dst, (pitch + 7) >> 3);
+
+ for (i = 0; i < width; i++, j += stride) {
+ if (LOGBYTE_tstbit(src,i) != 0) {
+ LOGBYTE_setbit(dst,j);
+ }
+ }
+}
+
+/* swapped bits to stream with pad */
+void sbtoIS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+CARD32 stride = pvt->stride;
+CARD32 width = pvt->width;
+CARD32 pitch = pvt->pitch;
+CARD32 j = pvt->bitOff;
+CARD32 i, s;
+
+ if (j) /* Don't bzero partial byte left from last scanline */
+ bzero(dst + 1, ((j + pitch + 7) >> 3) - 1);
+ else
+ bzero(dst, (pitch + 7) >> 3);
+
+ for (i = 0; i < width; i++, j += stride) {
+ s = j ^ 7; /* Larry swap */
+ if (LOGBYTE_tstbit(src,i) != 0) {
+ LOGBYTE_setbit(dst,s);
+ }
+ }
+}
+
+/* BytePixel to Stream, no offsets */
+void BtoS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+int width = pvt->width;
+
+ memcpy((char *)dst,(char *)src,width);
+}
+
+/* PairPixel to Stream, no swapping */
+void PtoS(PairPixel *src, PairPixel *dst, meUncompPtr pvt)
+{
+int width = pvt->width << 1;
+
+ memcpy((char *)dst,(char *)src,width);
+}
+
+/* PairPixel to Stream, with swapping */
+void sPtoS(PairPixel *src, PairPixel *dst, meUncompPtr pvt)
+{
+CARD32 i;
+
+ for (i = 0; i < pvt->width; i++) { cpswaps(src[i],dst[i]); }
+}
+
+/* QuadPixel to Stream, no swapping */
+void QtoS(QuadPixel *src, QuadPixel *dst, meUncompPtr pvt)
+{
+int width = pvt->width << 2;
+
+ memcpy((char *)dst,(char *)src,width);
+}
+
+/* QuadPixel to Stream, with swapping */
+void sQtoS(QuadPixel *src, QuadPixel *dst, meUncompPtr pvt)
+{
+CARD32 i;
+
+ for (i = 0; i < pvt->width; i++) { cpswapl(src[i],dst[i]); }
+}
+
+/* QuadPixel (unswapped) to padded Stream */
+void QtoIS(QuadPixel *src, QuadPixel *dst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD32 i;
+ for (i = 0; i < width; i++, dst += Bstride) *dst = *src++;
+}
+
+/* QuadPixel (swapped) to padded Stream */
+void sQtoIS(QuadPixel *src, QuadPixel *dst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD32 i;
+ for (i = 0; i < width; i++, dst += Bstride) { cpswapl(src[i], *dst); }
+}
+
+/* Triple Band Byte by Pixel Action routines */
+
+/* Bits to Interleaved stream bits */
+void btoISb(BytePixel *isrc, BytePixel *dst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD8 mask = pvt->mask;
+LogInt *src = (LogInt *)isrc;
+int i;
+
+ dst += pvt->dstoffset;
+ for (i = 0; i < width; i++, dst += Bstride)
+ if (LOG_tstbit(src,i) != 0)
+ *dst |= mask;
+}
+
+/* BytePixels to Interleaved Stream in bits */
+void BtoISb(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD8 mask = pvt->mask;
+CARD8 shift = pvt->shift;
+CARD32 i;
+
+ dst += pvt->dstoffset;
+ for (i = 0; i < width; i++, dst += Bstride)
+ *dst |= *src++ << shift & mask;
+}
+
+/* BytePixel to Interleaved Stream */
+void BtoIS(BytePixel *src, BytePixel *dst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD32 i;
+
+ dst += pvt->dstoffset;
+ for (i = 0; i < width; i++, dst += Bstride)
+ *dst = *src++;
+}
+
+/* PairPixel (unswapped) to Interleaved Stream */
+void PtoIS(PairPixel *src, PairPixel *idst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD8 *dst = ((CARD8 *)idst) + pvt->dstoffset;
+CARD32 i;
+ for (i = 0; i < width; i++, dst += Bstride)
+ *((PairPixel *)dst) = *src++;
+}
+
+/* PairPixel (swapped) to Interleaved Stream */
+void sPtoIS(PairPixel *src, PairPixel *idst, meUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 width = pvt->width;
+CARD8 *dst = ((CARD8 *)idst) + pvt->dstoffset;
+CARD32 i;
+ for (i = 0; i < width; i++, dst += Bstride) {
+ PairPixel sval = *src++;
+ *dst = (sval >> 8) | (sval << 8);
+ }
+}
+
+/***********************************************************************/
+/***************** Unaligned data conversion routines ******************/
+/***********************************************************************/
+
+/* Pack a line of byte pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+void BtoLLUB(src, dst, pvt)
+BytePixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+BytePixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 stride = pvt->stride;
+CARD16 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+
+ while (src < send) {
+ outb |= (CARD16)*src++ << bits;
+ bits += stride;
+ while (bits > 7) {
+ *dst++ = (CARD8)outb;
+ outb >>= 8;
+ bits -= 8;
+ }
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of byte pixels */
+/* Pixel Order = LSB, Fill Order = MSB */
+void BtoLMUB(src, dst, pvt)
+BytePixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+BytePixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 stride = pvt->stride;
+CARD32 depth = pvt->depth;
+CARD16 bits = pvt->bitOff;
+CARD16 outb = pvt->leftOver;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD8 sval = *src++;
+
+ if (bits + depth <= 8) { /* Pack into existing byte only */
+ outb |= sval << (8 - bits - depth);
+ if (bits + depth == 8) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits += depth;
+ } else { /* Split between bytes */
+ outb |= (CARD8)(sval << bits) >> bits;/* Chop off top bits*/
+ *dst++ = (CARD8)outb;
+ if (bits + depth <= 16) {
+ outb = (CARD8)(sval >> (8 - bits)) << (16 - depth - bits);
+ bits = bits + depth - 8; /* watch those signs */
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ }
+ }
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of byte pixels */
+/* Pixel Order = MSB, Fill Order = LSB */
+void BtoMLUB(src, dst, pvt)
+BytePixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+BytePixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD16 bits = pvt->bitOff;
+CARD16 outb = pvt->leftOver;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD8 sval = *src++;
+
+ if (bits + depth <= 8) { /* Pack into existing byte only */
+ outb |= sval << bits;
+ if (bits + depth == 8) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits += depth;
+ } else if (bits + depth <= 16) {
+ outb |= (CARD8)(sval >> (depth + bits - 8)) << bits;
+ *dst++ = (CARD8)outb;
+ outb = (CARD8)(sval << (16 - depth - bits)) >> (16 - depth - bits);
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 8;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+void BtoMMUB(src, dst, pvt)
+BytePixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+BytePixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD16 bits = pvt->bitOff;
+CARD16 outb = pvt->leftOver;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD8 sval = *src++;
+
+ if (bits + depth <= 8) { /* Pack into existing byte only */
+ outb |= sval << (8 - depth - bits);
+ if (bits + depth == 8) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits += depth;
+ } else if (bits + depth <= 16) {
+ outb |= sval >> (depth + bits - 8);
+ *dst++ = (CARD8)outb;
+ outb = sval << (16 - depth - bits);
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 8;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of pair pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+void PtoLLUP(src, dst, pvt)
+PairPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+PairPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+
+ while (src < send) {
+ outb |= *src++ << bits;
+ bits += stride;
+ while (bits > 7) {
+ *dst++ = (CARD8)outb;
+ outb >>= 8;
+ bits -= 8;
+ }
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of pair pixels */
+/* Pixel Order = LSB, Fill Order = MSB */
+void PtoLMUP(src, dst, pvt)
+PairPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+PairPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD16 sval = *src++;
+
+ if (bits + depth <= 16) {
+ outb |= (CARD16)(sval << (8 + bits)) >> (8 + bits);
+ *dst++ = (CARD8)outb;
+ outb = (CARD8)(sval >> (8 - bits)) << (16 - depth - bits);
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 8; /* watch those signs */
+ } else {
+ outb |= (CARD16)(sval << (8 + bits)) >> (8 + bits);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)((CARD16)(sval << bits) >> 8);
+ outb = (CARD8)(sval >> (16 - bits)) << (24 - depth - bits);
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16; /* watch those signs */
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of pair pixels */
+/* Pixel Order = MSB, Fill Order = LSB */
+void PtoMLUP(src, dst, pvt)
+PairPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+PairPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD16 sval = *src++;
+
+ if (bits + depth <= 16) {
+ outb |= (sval >> (depth + bits - 8)) << bits;
+ *dst++ = (CARD8)outb;
+ outb = (CARD16)(sval << (24 - depth - bits)) >> (24 - depth - bits);
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 8;
+ } else {
+ outb |= (sval >> (depth + bits - 8)) << bits;
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ outb = (CARD8)(sval << (24 - depth - bits)) >> (24 - depth - bits);
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+void PtoMMUP(src, dst, pvt)
+PairPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+PairPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD16 sval = *src++;
+
+ if (bits + depth <= 16) {
+ outb |= sval >> (depth + bits - 8);
+ *dst++ = (CARD8)outb;
+ outb = sval << (16 - depth - bits);
+ if (bits + depth == 16) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 8;
+ } else {
+ outb |= sval >> (depth + bits - 8);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ outb = sval << (24 - depth - bits);
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = (CARD8)outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of quad pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+void QtoLLUQ(src, dst, pvt)
+QuadPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+QuadPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 stride = pvt->stride;
+CARD32 outb0 = pvt->leftOver, outb1;
+CARD16 bits = pvt->bitOff;
+
+ while (src < send) {
+ if (bits) { /* Yuck, do a multi word shift */
+ outb1 = *src >> (32 - bits);
+ outb0 |= *src++ << bits;
+ } else {
+ outb1 = 0;
+ outb0 = *src++;
+ }
+ bits += stride;
+ while (bits > 7) {
+ *dst++ = (CARD8)outb0;
+ outb0 >>= 8;
+ if (bits > 32) {
+ outb0 |= outb1 << 24;
+ outb1 >>= 8;
+ }
+ bits -= 8;
+ }
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = (CARD8)outb0;
+ } else {
+ *dst = (CARD8)outb0;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of quad pixels */
+/* Pixel Order = LSB, Fill Order = MSB */
+void QtoLMUQ(src, dst, pvt)
+QuadPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+QuadPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 stride = pvt->stride;
+CARD32 depth = pvt->depth;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD32 sval = *src++;
+
+ if (bits + depth <= 24) {
+ outb |= (sval << (24 + bits)) >> (24 + bits);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (8 - bits));
+ outb = (CARD8)(sval >> (16 - bits)) << (24 - depth - bits);
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16; /* watch those signs */
+ } else {
+ outb |= (sval << (24 + bits)) >> (24 + bits);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (8 - bits));
+ *dst++ = (CARD8)(sval >> (16 - bits));
+ outb = (CARD8)(sval >> (24 - bits)) << (32 - depth - bits);
+ if (bits + depth == 32) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 24; /* watch those signs */
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = (CARD8)outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of quad pixels */
+/* Pixel Order = MSB, Fill Order = LSB */
+void QtoMLUQ(src, dst, pvt)
+QuadPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+QuadPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD32 sval = *src++;
+
+ if (bits + depth <= 24) {
+ outb |= (sval >> (depth + bits - 8)) << bits;
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ outb = (sval << (48 - depth - bits)) >> (48 - depth - bits);
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16;
+ } else {
+ outb |= (sval >> (depth + bits - 8)) << bits;
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ *dst++ = (CARD8)(sval >> (depth + bits - 24));
+ outb = (sval << (56 - depth - bits)) >> (56 - depth - bits);
+ if (bits + depth == 32) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 24;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a line of quad pixels */
+/* Pixel Order = MSB, Fill Order = MSB */
+void QtoMMUQ(src, dst, pvt)
+QuadPixel *src;
+CARD8 *dst;
+meUncompPtr pvt;
+{
+QuadPixel *send = &src[pvt->width];
+CARD32 pitch = pvt->pitch;
+CARD32 depth = pvt->depth;
+CARD32 stride = pvt->stride;
+CARD32 outb = pvt->leftOver;
+CARD16 bits = pvt->bitOff;
+CARD32 pad = stride - depth;
+
+ while (src < send) {
+ CARD32 sval = *src++;
+
+ if (bits + depth <= 24) {
+ outb |= sval >> (depth + bits - 8);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ outb = (sval << (48 - depth - bits)) >> 24;
+ if (bits + depth == 24) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 16;
+ } else {
+ outb |= sval >> (depth + bits - 8);
+ *dst++ = (CARD8)outb;
+ *dst++ = (CARD8)(sval >> (depth + bits - 16));
+ *dst++ = (CARD8)(sval >> (depth + bits - 24));
+ outb = (sval << (56 - depth - bits)) >> 24;
+ if (bits + depth == 32) {
+ *dst++ = (CARD8)outb;
+ outb = 0;
+ bits = 0;
+ } else
+ bits = bits + depth - 24;
+ }
+ if (bits + pad > 8) {
+ *dst++ = outb;
+ outb = 0;
+ bits = bits + pad - 8;
+ while (bits > 7) {
+ *dst++ = 0;
+ bits -= 8;
+ }
+ } else
+ bits += pad;
+ }
+
+
+ /* If something leftover, either write it out or save for packing */
+ if (bits) {
+ if (pitch & 7) {
+ pvt->leftOver = (CARD8)outb;
+ } else {
+ *dst = (CARD8)outb;
+ pvt->leftOver = 0;
+ }
+ } else
+ pvt->leftOver = 0;
+}
+
+/* Pack a triple band by pixel line of pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+
+#define ProtoLLTB(fname,itype0,itype1,itype2) \
+void fname( \
+ itype0 *src0, \
+ itype1 *src1, \
+ itype2 *src2, \
+ CARD8 *dst, \
+ CARD32 tristride, \
+ meUncompPtr pvt)
+
+#define ConvertToLLTB(fname,itype0,itype1,itype2) \
+extern ProtoLLTB(fname,itype0,itype1,itype2); \
+ProtoLLTB(fname,itype0,itype1,itype2) \
+{ \
+itype0 *send = &src0[pvt->width];/* All three bands are same width */ \
+CARD32 pitch = pvt->pitch; \
+CARD32 outb = pvt->leftOver; \
+CARD16 bits = pvt->bitOff; \
+CARD32 depth0 = pvt[0].depth; \
+CARD32 depth1 = pvt[1].depth; \
+CARD32 tripad = tristride - pvt[0].depth - pvt[1].depth; \
+ while (src0 < send) { \
+ outb |= (CARD32)*src0++ << bits; \
+ bits += depth0; \
+ while (bits > 7) { \
+ *dst++ = (CARD8)outb; \
+ outb >>= 8; \
+ bits -= 8; \
+ } \
+ outb |= (CARD32)*src1++ << bits; \
+ bits += depth1; \
+ while (bits > 7) { \
+ *dst++ = (CARD8)outb; \
+ outb >>= 8; \
+ bits -= 8; \
+ } \
+ outb |= (CARD32)*src2++ << bits; \
+ bits += tripad; \
+ while (bits > 7) { \
+ *dst++ = (CARD8)outb; \
+ outb >>= 8; \
+ bits -= 8; \
+ } \
+ } \
+ if (bits) { \
+ if (pitch & 7) { \
+ pvt->leftOver = outb; \
+ } else { \
+ *dst = (CARD8)outb; \
+ pvt->leftOver = 0; \
+ } \
+ } else \
+ pvt->leftOver = 0; \
+}
+
+/* Pack a triple band by pixel line of pixels */
+/* Pixel Order = LSB, Fill Order = MSB */
+/* Broken in two parts because some preprocessors cannot handle the full size*/
+#define ConvertToLMTB2() \
+ if (bits + tripad > 8) { \
+ *dst++ = outb; \
+ outb = 0; \
+ bits = bits + tripad - 8; \
+ while (bits > 7) { \
+ *dst++ = 0; \
+ bits -= 8; \
+ } \
+ } else \
+ bits += tripad; \
+ } \
+ if (bits) { \
+ if (pitch & 7) { \
+ pvt->leftOver = outb; \
+ } else { \
+ *dst = (CARD8)outb; \
+ pvt->leftOver = 0; \
+ } \
+ } else \
+ pvt->leftOver = 0;
+
+#define ProtoLMTB(fname,xietype0,xietype1,xietype2) \
+void fname( \
+ xietype0 *src0, \
+ xietype1 *src1, \
+ xietype2 *src2, \
+ CARD8 *dst, \
+ CARD32 tristride, \
+ meUncompPtr pvt)
+
+#define ConvertToLMTB(fname,xietype0,xietype1,xietype2) \
+extern ProtoLMTB(fname,xietype0,xietype1,xietype2); \
+ProtoLMTB(fname,xietype0,xietype1,xietype2) \
+{ \
+xietype0 *send = &src0[pvt->width];/* All three bands are same width */ \
+CARD32 pitch = pvt->pitch; \
+CARD32 outb = pvt->leftOver; \
+CARD16 bits = pvt->bitOff; \
+CARD32 tripad = tristride - pvt[0].depth - pvt[1].depth - pvt[2].depth;\
+CARD32 b; \
+ while (src0 < send) { \
+ CARD16 svals[3]; \
+ svals[0] = *src0++; svals[1] = *src1++; svals[2] = *src2++; \
+ for (b = 0; b < 3; b++) { \
+ CARD16 sval = svals[b]; \
+ CARD32 depth = pvt[b].depth; \
+ if (bits + depth <= 8) { /* Pack into existing byte only */\
+ outb |= sval << (8 - depth - bits); \
+ if (bits + depth == 8) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits += depth; \
+ } else if (bits + depth <= 16) { \
+ outb |= (CARD16)(sval << (8 + bits)) >> (8 + bits); \
+ *dst++ = (CARD8)outb; \
+ outb = (CARD8)(sval >> (8 - bits)) << (16 - depth - bits);\
+ if (bits + depth == 16) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 8; /* watch those signs */ \
+ } else { \
+ outb |= (CARD16)(sval << (8 + bits)) >> (8 + bits); \
+ *dst++ = (CARD8)outb; \
+ *dst++ = (CARD8)((CARD16)(sval << bits) >> 8); \
+ outb = (CARD8)(sval >> (16 - bits)) << (24 - depth - bits);\
+ if (bits + depth == 24) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 16; /* watch those signs */ \
+ } \
+ } \
+ ConvertToLMTB2() \
+}
+
+/* Pack a triple band by pixel line of pixels */
+/* Pixel Order = MSB, Fill Order = LSB */
+/* Broken in two parts because some preprocessors cannot handle the full size*/
+#define ConvertToMLTB2() \
+ if (bits + tripad > 8) { \
+ *dst++ = outb; \
+ outb = 0; \
+ bits = bits + tripad - 8; \
+ while (bits > 7) { \
+ *dst++ = 0; \
+ bits -= 8; \
+ } \
+ } else \
+ bits += tripad; \
+ } \
+ if (bits) { \
+ if (pitch & 7) { \
+ pvt->leftOver = outb; \
+ } else { \
+ *dst = (CARD8)outb; \
+ pvt->leftOver = 0; \
+ } \
+ } else \
+ pvt->leftOver = 0;
+
+#define ProtoMLTB(fname,itype0,itype1,itype2) \
+void fname( \
+ itype0 *src0, \
+ itype1 *src1, \
+ itype2 *src2, \
+ CARD8 *dst, \
+ CARD32 tristride, \
+ meUncompPtr pvt)
+
+#define ConvertToMLTB(fname,itype0,itype1,itype2) \
+extern ProtoMLTB(fname,itype0,itype1,itype2); \
+ProtoMLTB(fname,itype0,itype1,itype2) \
+{ \
+itype0 *send = &src0[pvt->width];/* All three bands are same width */ \
+CARD32 pitch = pvt->pitch; \
+CARD32 outb = pvt->leftOver; \
+CARD16 bits = pvt->bitOff; \
+CARD32 tripad = tristride - pvt[0].depth - pvt[1].depth - pvt[2].depth;\
+CARD32 b; \
+ while (src0 < send) { \
+ CARD16 svals[3]; \
+ svals[0] = *src0++; svals[1] = *src1++; svals[2] = *src2++; \
+ for (b = 0; b < 3; b++) { \
+ CARD16 sval = svals[b]; \
+ CARD32 depth = pvt[b].depth; \
+ if (bits + depth <= 8) { /* Pack into existing byte only */\
+ outb |= sval << bits; \
+ if (bits + depth == 8) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits += depth; \
+ } else if (bits + depth <= 16) { \
+ outb |= (sval >> (depth + bits - 8)) << bits; \
+ *dst++ = (CARD8)outb; \
+ outb = (CARD16)(sval << (24 - depth - bits)) >> (24 - depth - bits); \
+ if (bits + depth == 16) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 8; \
+ } else { \
+ outb |= (sval >> (depth + bits - 8)) << bits; \
+ *dst++ = (CARD8)outb; \
+ *dst++ = (CARD8)(sval >> (depth + bits - 16)); \
+ outb = (CARD8)(sval << (24 - depth - bits)) >> (24 - depth - bits);\
+ if (bits + depth == 24) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 16; \
+ } \
+ } \
+ ConvertToMLTB2() \
+}
+
+/* Pack a triple band by pixel line of pixels */
+/* Pixel Order = MSB, Fill Order = MSB */
+/* Broken in two parts because some preprocessors cannot handle the full size*/
+#define ConvertToMMTB2() \
+ if (bits + tripad > 8) { \
+ *dst++ = outb; \
+ outb = 0; \
+ bits = bits + tripad - 8; \
+ while (bits > 7) { \
+ *dst++ = 0; \
+ bits -= 8; \
+ } \
+ } else \
+ bits += tripad; \
+ } \
+ if (bits) { \
+ if (pitch & 7) { \
+ pvt->leftOver = (CARD8)outb; \
+ } else { \
+ *dst = (CARD8)outb; \
+ pvt->leftOver = 0; \
+ } \
+ } else \
+ pvt->leftOver = 0;
+
+#define ProtoMMTB(fname,itype0,itype1,itype2) \
+void fname( \
+ itype0 *src0, \
+ itype1 *src1, \
+ itype2 *src2, \
+ CARD8 *dst, \
+ CARD32 tristride, \
+ meUncompPtr pvt)
+
+#define ConvertToMMTB(fname,itype0,itype1,itype2) \
+extern ProtoMMTB(fname,itype0,itype1,itype2); \
+ProtoMMTB(fname,itype0,itype1,itype2) \
+{ \
+itype0 *send = &src0[pvt->width];/* All three bands are same width */ \
+CARD32 pitch = pvt->pitch; \
+CARD32 outb = pvt->leftOver; \
+CARD16 bits = pvt->bitOff; \
+CARD32 tripad = tristride - pvt[0].depth - pvt[1].depth - pvt[2].depth;\
+CARD32 b; \
+ while (src0 < send) { \
+ CARD16 svals[3]; \
+ svals[0] = *src0++; svals[1] = *src1++; svals[2] = *src2++; \
+ for (b = 0; b < 3; b++) { \
+ CARD16 sval = svals[b]; \
+ CARD32 depth; \
+ depth = pvt[b].depth; \
+ if (bits + depth <= 8) {/* Pack into existing byte only */ \
+ outb |= sval << (8 - depth - bits); \
+ if (bits + depth == 8) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits += depth; \
+ } else if (bits + depth <= 16) { \
+ outb |= sval >> (depth + bits - 8); \
+ *dst++ = (CARD8)outb; \
+ outb = sval << (16 - depth - bits); \
+ if (bits + depth == 16) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 8; \
+ } else { \
+ outb |= sval >> (depth + bits - 8); \
+ *dst++ = (CARD8)outb; \
+ *dst++ = (CARD8)(sval >> (depth + bits - 16)); \
+ outb = sval << (24 - depth - bits); \
+ if (bits + depth == 24) { \
+ *dst++ = (CARD8)outb; \
+ outb = 0; \
+ bits = 0; \
+ } else \
+ bits = bits + depth - 16; \
+ } \
+ } \
+ ConvertToMMTB2() \
+}
+
+
+ConvertToLLTB(BBBtoLLTB,BytePixel,BytePixel,BytePixel)
+ConvertToLMTB(BBBtoLMTB,BytePixel,BytePixel,BytePixel)
+ConvertToMLTB(BBBtoMLTB,BytePixel,BytePixel,BytePixel)
+ConvertToMMTB(BBBtoMMTB,BytePixel,BytePixel,BytePixel)
+
+ConvertToLLTB(BBPtoLLTB,BytePixel,BytePixel,PairPixel)
+ConvertToLMTB(BBPtoLMTB,BytePixel,BytePixel,PairPixel)
+ConvertToMLTB(BBPtoMLTB,BytePixel,BytePixel,PairPixel)
+ConvertToMMTB(BBPtoMMTB,BytePixel,BytePixel,PairPixel)
+
+ConvertToLLTB(BPBtoLLTB,BytePixel,PairPixel,BytePixel)
+ConvertToLMTB(BPBtoLMTB,BytePixel,PairPixel,BytePixel)
+ConvertToMLTB(BPBtoMLTB,BytePixel,PairPixel,BytePixel)
+ConvertToMMTB(BPBtoMMTB,BytePixel,PairPixel,BytePixel)
+
+ConvertToLLTB(BPPtoLLTB,BytePixel,PairPixel,PairPixel)
+ConvertToLMTB(BPPtoLMTB,BytePixel,PairPixel,PairPixel)
+ConvertToMLTB(BPPtoMLTB,BytePixel,PairPixel,PairPixel)
+ConvertToMMTB(BPPtoMMTB,BytePixel,PairPixel,PairPixel)
+
+ConvertToLLTB(PBBtoLLTB,PairPixel,BytePixel,BytePixel)
+ConvertToLMTB(PBBtoLMTB,PairPixel,BytePixel,BytePixel)
+ConvertToMLTB(PBBtoMLTB,PairPixel,BytePixel,BytePixel)
+ConvertToMMTB(PBBtoMMTB,PairPixel,BytePixel,BytePixel)
+
+ConvertToLLTB(PBPtoLLTB,PairPixel,BytePixel,PairPixel)
+ConvertToLMTB(PBPtoLMTB,PairPixel,BytePixel,PairPixel)
+ConvertToMLTB(PBPtoMLTB,PairPixel,BytePixel,PairPixel)
+ConvertToMMTB(PBPtoMMTB,PairPixel,BytePixel,PairPixel)
+
+ConvertToLLTB(PPBtoLLTB,PairPixel,PairPixel,BytePixel)
+ConvertToLMTB(PPBtoLMTB,PairPixel,PairPixel,BytePixel)
+ConvertToMLTB(PPBtoMLTB,PairPixel,PairPixel,BytePixel)
+ConvertToMMTB(PPBtoMMTB,PairPixel,PairPixel,BytePixel)
+
+ConvertToLLTB(PPPtoLLTB,PairPixel,PairPixel,PairPixel)
+ConvertToLMTB(PPPtoLMTB,PairPixel,PairPixel,PairPixel)
+ConvertToMLTB(PPPtoMLTB,PairPixel,PairPixel,PairPixel)
+ConvertToMMTB(PPPtoMMTB,PairPixel,PairPixel,PairPixel)
+
+void (*EncodeTripleFuncs[2][2][2][2][2])() =
+{ { { { { BBBtoLLTB, BBPtoLLTB }, { BPBtoLLTB, BPPtoLLTB } },
+ { { PBBtoLLTB, PBPtoLLTB }, { PPBtoLLTB, PPPtoLLTB } } },
+ { { { BBBtoLMTB, BBPtoLMTB }, { BPBtoLMTB, BPPtoLMTB } },
+ { { PBBtoLMTB, PBPtoLMTB }, { PPBtoLMTB, PPPtoLMTB } } } },
+ { { { { BBBtoMLTB, BBPtoMLTB }, { BPBtoMLTB, BPPtoMLTB } },
+ { { PBBtoMLTB, PBPtoMLTB }, { PPBtoMLTB, PPPtoMLTB } } },
+ { { { BBBtoMMTB, BBPtoMMTB }, { BPBtoMMTB, BPPtoMMTB } },
+ { { PBBtoMMTB, PBPtoMMTB }, { PPBtoMMTB, PPPtoMMTB } } } } };
+/* end module meuncomp.c */
diff --git a/xc/programs/Xserver/XIE/mixie/export/schoice.c b/xc/programs/Xserver/XIE/mixie/export/schoice.c
new file mode 100644
index 000000000..4ac0eaf07
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/export/schoice.c
@@ -0,0 +1,344 @@
+/* $TOG: schoice.c /main/5 1998/02/09 16:13:38 kaleb $ */
+/**** module schoice.c ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+****************************************************************************
+ schoice.c: Routines to handle server choice encoding
+
+ Dean Verheiden && Robert NC Shelley AGE Logic, Inc. Jan 1994
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/export/schoice.c,v 3.4 1998/10/25 07:11:56 dawes Exp $ */
+
+#define _XIEC_SCHOICE
+#define _XIEC_IPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#define NEED_EVENTS
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+
+/*
+ * Element Specific Includes
+ */
+#include <corex.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <xiemd.h>
+#include <memory.h>
+
+static Bool PrepSCCanonic(floDefPtr flo, peDefPtr ped);
+static Bool PrepSCSmuggle(floDefPtr flo, peDefPtr ped);
+static Bool PrepSCPackBits(floDefPtr flo, peDefPtr ped);
+static Bool PrepSCG42D(floDefPtr flo, peDefPtr ped);
+
+
+extern Bool BuildDecodeFromEncode();
+extern pointer GetImportTechnique();
+
+
+/* REFORMAT_UNCOMPRESSED (options for prefer space)
+ * TRUE = convert uncompressed import data to canonic form before saving
+ * FALSE = save uncompressed import data "as is"
+ *
+ * COMPRESS_BITONAL
+ * PrepSCPackBits
+ * PrepSCG42D
+ *
+ * DEFAULT_PREFERENCE
+ * xieValPreferSpace
+ * xieValPreferTime
+ */
+#define REFORMAT_UNCOMPRESSED TRUE
+#define COMPRESS_BITONAL PrepSCPackBits
+#define DEFAULT_PREFERENCE xieValPreferTime
+
+
+/*------------------------------------------------------------------------
+----------------------- choose an encode technique -----------------------
+------------------------------------------------------------------------*/
+xieBoolProc GetServerChoice(floDefPtr flo, peDefPtr eped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)eped->elemPvt;
+ xieFloExportPhotomap *raw = (xieFloExportPhotomap *)eped->elemRaw;
+ outFloPtr dst = &eped->outFlo;
+ inFloPtr inf = &eped->inFloLst[SRCtag];
+ peDefPtr iped = inf->srcDef;
+ Bool smuggle = FALSE;
+ formatPtr fmt;
+ xieBoolProc scPrep;
+ CARD8 b, bands, preference;
+ CARD16 tecNum, tecLen;
+ pointer import;
+
+ import = GetImportTechnique(iped,&tecNum,&tecLen);
+
+ if(raw->lenParams)
+ preference = ((xieTecEncodeServerChoice*)&raw[1])->preference;
+ else
+ preference = xieValPreferDefault;
+
+ switch(preference) {
+#if (DEFAULT_PREFERENCE == xieValPreferSpace)
+ case xieValPreferDefault:
+#endif
+ case xieValPreferSpace:
+ if(import) {
+ switch(tecNum) {
+#if REFORMAT_UNCOMPRESSED
+ case xieValDecodeUncompressedSingle:
+ if(iped->outFlo.format[0].levels == 2)
+ scPrep = COMPRESS_BITONAL;
+ else
+ scPrep = PrepSCCanonic;
+ break;
+
+ case xieValDecodeUncompressedTriple:
+ scPrep = PrepSCCanonic;
+ break;
+#else
+ case xieValDecodeUncompressedSingle:
+ case xieValDecodeUncompressedTriple:
+#endif
+ case xieValDecodeG31D:
+ case xieValDecodeG32D:
+ case xieValDecodeG42D:
+ case xieValDecodeJPEGBaseline:
+ case xieValDecodeTIFF2:
+ case xieValDecodeTIFFPackBits:
+ smuggle = TRUE; /* smuggle import encoding "as is" */
+ scPrep = PrepSCSmuggle;
+ break;
+ default:
+ return((xieBoolProc)NULL);
+ }
+ } else if(iped->outFlo.bands == 1 && iped->outFlo.format[0].levels == 2) {
+ scPrep = COMPRESS_BITONAL;
+ } else {
+ scPrep = PrepSCCanonic;
+ }
+ break;
+
+#if (DEFAULT_PREFERENCE == xieValPreferTime)
+ case xieValPreferDefault:
+#endif
+ case xieValPreferTime:
+ scPrep = PrepSCCanonic; /* keep uncompressed */
+ break;
+
+ default:
+ return((xieBoolProc)NULL);
+ }
+ /* grab a copy of the input attributes and propagate them to our output
+ */
+ fmt = smuggle ? iped->inFloLst[SRCtag].format : iped->outFlo.format;
+ bands = smuggle ? iped->inFloLst[SRCtag].bands : iped->outFlo.bands;
+
+ for(b = 0; b < bands; ++b) {
+ dst->format[b] = inf->format[b] = fmt[b];
+ }
+ dst->bands = inf->bands = bands;
+ pvt->serverChose = TRUE;
+
+ return(scPrep);
+}
+
+
+/*------------------------------------------------------------------------
+---------------------- server choice prep routines -----------------------
+------------------------------------------------------------------------*/
+static Bool PrepSCCanonic(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+
+ pvt->encodeNumber = xieValEncodeServerChoice;
+ pvt->encodeLen = 0;
+ pvt->congress = TRUE;
+
+ if(ped->inFloLst[SRCtag].bands == 1) {
+ xieTecDecodeUncompressedSingle *dtec;
+
+ if(!(dtec = ((xieTecDecodeUncompressedSingle *)
+ XieMalloc(sizeof(xieTecDecodeUncompressedSingle)))))
+ AllocError(flo,ped, return(FALSE));
+
+ pvt->decodeNumber = xieValDecodeUncompressedSingle;
+ pvt->decodeParms = (pointer)dtec;
+ pvt->decodeLen = sizeof(xieTecDecodeUncompressedSingle);
+#if (IMAGE_BYTE_ORDER == MSBFirst) /* Conform to server's "native" format */
+ dtec->fillOrder = xieValMSFirst;
+ dtec->pixelOrder = xieValMSFirst;
+#else
+ dtec->fillOrder = xieValLSFirst;
+ dtec->pixelOrder = xieValLSFirst;
+#endif
+ dtec->pixelStride = ped->outFlo.format[0].stride;
+ dtec->leftPad = 0;
+ dtec->scanlinePad = PITCH_MOD >> 3;
+ } else {
+ xieTecDecodeUncompressedTriple *dtec;
+ int i;
+
+ if(!(dtec = ((xieTecDecodeUncompressedTriple *)
+ XieMalloc(sizeof(xieTecDecodeUncompressedTriple)))))
+ AllocError(flo,ped, return(FALSE));
+
+ pvt->decodeNumber = xieValDecodeUncompressedTriple;
+ pvt->decodeParms = (pointer)dtec;
+ pvt->decodeLen = sizeof(xieTecDecodeUncompressedTriple);
+#if (IMAGE_BYTE_ORDER == MSBFirst) /* Conform to server's "native" format */
+ dtec->fillOrder = xieValMSFirst;
+ dtec->pixelOrder = xieValMSFirst;
+#else
+ dtec->fillOrder = xieValLSFirst;
+ dtec->pixelOrder = xieValLSFirst;
+#endif
+ dtec->bandOrder = xieValLSFirst;
+ dtec->interleave = xieValBandByPlane;
+ for(i = 0; i < 3; i++) {
+ dtec->leftPad[i] = 0;
+ dtec->pixelStride[i] = ped->outFlo.format[i].stride;
+ dtec->scanlinePad[i] = PITCH_MOD >> 3;
+ }
+ }
+ return(TRUE);
+} /* PrepSCCanonic */
+
+
+static Bool PrepSCSmuggle(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ peDefPtr iped = ped->inFloLst[SRCtag].srcDef;
+ pointer parms;
+
+ pvt->encodeNumber = xieValEncodeServerChoice;
+ pvt->encodeLen = 0;
+ pvt->congress = TRUE;
+
+ if(!(parms = GetImportTechnique(iped,&pvt->decodeNumber,&pvt->decodeLen)) ||
+ !(pvt->decodeParms = (pointer)XieMalloc(pvt->decodeLen)))
+ return(FALSE);
+
+ memcpy((char*)pvt->decodeParms, (char*)parms, (int)pvt->decodeLen);
+
+ return(TRUE);
+} /* PrepECSmuggle */
+
+
+static Bool PrepSCPackBits(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ formatPtr fmt = ped->outFlo.format;
+ xieTecEncodeTIFFPackBits *tp;
+
+ pvt->encodeNumber = xieValEncodeTIFFPackBits;
+ pvt->encodeLen = sizeof(xieTecEncodeTIFFPackBits);
+
+ if(!(tp = (xieTecEncodeTIFFPackBits*)XieMalloc(pvt->encodeLen)))
+ return(FALSE);
+
+ pvt->encodeParms = (pointer)tp;
+
+ tp->encodedOrder = xieValMSFirst;
+ fmt->interleaved = FALSE;
+ fmt->class = STREAM;
+
+ return(BuildDecodeFromEncode(flo,ped));
+} /* PrepSCPackBits */
+
+
+static Bool PrepSCG42D(floDefPtr flo, peDefPtr ped)
+{
+ ePhotoDefPtr pvt = (ePhotoDefPtr)ped->elemPvt;
+ formatPtr fmt = ped->outFlo.format;
+ xieTecEncodeG42D *tp;
+
+ pvt->encodeNumber = xieValEncodeG42D;
+ pvt->encodeLen = sizeof(xieTecEncodeG42D);
+
+ if(!(tp = (xieTecEncodeG42D*)XieMalloc(pvt->encodeLen)))
+ return(FALSE);
+
+ pvt->encodeParms = (pointer)tp;
+ tp->encodedOrder = xieValMSFirst;
+ tp->uncompressed = FALSE;
+ tp->radiometric = FALSE;
+ fmt->interleaved = FALSE;
+ fmt->class = STREAM;
+
+ return(BuildDecodeFromEncode(flo,ped));
+} /* PrepSCG42D */
+
+/* end module schoice.c */
diff --git a/xc/programs/Xserver/XIE/mixie/fax/Imakefile b/xc/programs/Xserver/XIE/mixie/fax/Imakefile
new file mode 100644
index 000000000..af586e3b9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/Imakefile
@@ -0,0 +1,48 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:56:07 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/fax/Imakefile,v 3.5 1998/07/25 08:05:10 dawes Exp $
+XCOMM build device dependent machine independent fax processing element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+ SRCS = dg31d.c \
+ dg32d.c \
+ dg4.c \
+ dtiff2.c \
+ dtiffpb.c \
+ eg31d.c \
+ eg32d.c \
+ etiff2.c \
+ etiffpb.c \
+ faxtabs.c \
+ zeroeven.c
+
+ OBJS = dg31d.o \
+ dg32d.o \
+ dg4.o \
+ dtiff2.o \
+ dtiffpb.o \
+ eg31d.o \
+ eg32d.o \
+ etiff2.o \
+ etiffpb.o \
+ faxtabs.o \
+ zeroeven.o
+
+#if BuildDIS
+ DEFINES = -DXIE_DIS
+#endif
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(fax,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/fax/bits.h b/xc/programs/Xserver/XIE/mixie/fax/bits.h
new file mode 100644
index 000000000..6cf72a708
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/bits.h
@@ -0,0 +1,461 @@
+/* $TOG: bits.h /main/7 1998/02/09 16:13:43 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module fax/bits.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/bits.h -- DDXIE G4 fax bitstream management macros
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+#include "gbits.h"
+
+/* ------------------------------------------------------------------- */
+/*
+ * get_white_run_length(next_goal)
+ * get_black_run_length(next_goal)
+ *
+ * These macros try to determine run lengths in horizonal mode.
+ * All possible bit combinations have been previously coded in
+ * a lookup table, so it's not a very big deal. The only real
+ * complication arises from the fact I may run out of strip data
+ * before finishing. In this case I want to save my length
+ * accumulator and read it back in again. If I have finished
+ * with this length, I want to move on to the next goal specified
+ * by 'next_goal'. Otherwise my goal remains to accumulate the
+ * current desired run length.
+ */
+
+#define get_white_run_length(next_goal) \
+ { \
+ register int code=0,nbits,makeup; \
+ rl = 0; \
+ while (1) { \
+ code = get_wcode(byteptr,bitpos,endptr); \
+ rl = _WhiteFaxTable[code].run_length; \
+ nbits = _WhiteFaxTable[code].n_bits; \
+ makeup = _WhiteFaxTable[code].makeup; \
+ if (rl == BAD_RUN_LENGTH) { \
+ length_acc = 0; \
+ if (!code) { \
+ /* could just be fill bits, try to recover */ \
+ goal = FAX_GOAL_RecoverZero; \
+ break; \
+ } \
+ else { \
+ goal = FAX_GOAL_FallOnSword; \
+ break; \
+ } \
+ } \
+ if (rl != EOL_RUN_LENGTH) \
+ length_acc += rl; \
+ if (!makeup) \
+ goal = next_goal; \
+ /* just in case adjust_bitstream returns for more data */ \
+ adjust_bitstream(nbits,byteptr,bitpos,endptr); \
+ if (!makeup) \
+ break; \
+ } \
+ }
+
+#define get_black_run_length(next_goal) \
+ { \
+ register int code=0,nbits,makeup; \
+ rl = 0; \
+ while (1) { \
+ code = get_bcode(byteptr,bitpos,endptr); \
+ rl = _BlackFaxTable[code].run_length; \
+ nbits = _BlackFaxTable[code].n_bits; \
+ makeup = _BlackFaxTable[code].makeup; \
+ if (rl == BAD_RUN_LENGTH) { \
+ length_acc = 0; \
+ if (!code) { \
+ /* could just be fill bits, will try to recover */ \
+ goal = FAX_GOAL_RecoverZero; \
+ break; \
+ } \
+ else { \
+ goal = FAX_GOAL_FallOnSword; \
+ break; \
+ } \
+ } \
+ if (rl != EOL_RUN_LENGTH) \
+ length_acc += rl; \
+ /* if this is an EOL of terminating code, go to next goal */\
+ if (!makeup) \
+ goal = next_goal; \
+ /* (set in case adjust_bitstream returns for more data) */\
+ adjust_bitstream(nbits,byteptr,bitpos,endptr); \
+ if (!makeup) \
+ break; \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * get_a0a1(next_goal)
+ * get_a1a2(next_goal)
+ *
+ * These macros try to determine run lengths in horizonal mode.
+ * They just leverage off of lower-level macros, so they're easy
+ */
+#define get_a0a1(next_goal) \
+ { \
+ if (a0_color == WHITE) \
+ get_white_run_length(next_goal) /* ; */ \
+ else \
+ get_black_run_length(next_goal); \
+ }
+#define get_a1a2(next_goal) \
+ { \
+ if (a0_color == WHITE) \
+ get_black_run_length(next_goal) /* ; */ \
+ else \
+ get_white_run_length(next_goal); \
+ }
+/* ------------------------------------------------------------------- */
+/*
+ * save_state_and_return(state);
+ * localize_state(state);
+ *
+ * These macros transfer state variables back and forth between
+ * the reentrant data structure 'state' and register variables.
+ * Hopefully neither will be called often, so we don't have to
+ * spend energy analyzing what is 'dirty' versus what hasn't been
+ * touched since the last save, etc.
+ *
+ * Strategy:
+ * brute force.
+ *
+ */
+#if defined(_G32D)
+#define save_state_and_return(state) \
+ { \
+ state->a0_color = a0_color; \
+ state->a0_pos = a0_pos; \
+ state->a0a1 = a0a1; \
+ state->bits.bitpos = bitpos; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->goal = goal; \
+ state->n_old_trans = n_old_trans; \
+ state->old_trans = old_trans; \
+ state->n_new_trans = n_new_trans; \
+ state->new_trans = new_trans; \
+ state->length_acc = length_acc; \
+ state->last_b1_idx = last_b1_idx; \
+ state->width = width; \
+ state->rl = rl; \
+ state->g32d_horiz = g32d_horiz; \
+ return(lines_found); \
+ }
+
+#define localize_state(state) \
+ a0_color = state->a0_color; \
+ a0_pos = state->a0_pos; \
+ a0a1 = state->a0a1; \
+ bitpos = state->bits.bitpos; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ goal = state->goal; \
+ n_old_trans = state->n_old_trans; \
+ old_trans = state->old_trans; \
+ n_new_trans = state->n_new_trans; \
+ new_trans = state->new_trans; \
+ length_acc = state->length_acc; \
+ last_b1_idx = state->last_b1_idx; \
+ width = state->width; \
+ rl = state->rl; \
+ g32d_horiz = state->g32d_horiz;
+#endif /* if defined(_G32D) */
+
+#if defined(_G31D) || defined(_G4)
+#define save_state_and_return(state) \
+ { \
+ state->a0_color = a0_color; \
+ state->a0_pos = a0_pos; \
+ state->a0a1 = a0a1; \
+ state->bits.bitpos = bitpos; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->goal = goal; \
+ state->n_old_trans = n_old_trans; \
+ state->old_trans = old_trans; \
+ state->n_new_trans = n_new_trans; \
+ state->new_trans = new_trans; \
+ state->length_acc = length_acc; \
+ state->last_b1_idx = last_b1_idx; \
+ state->width = width; \
+ state->rl = rl; \
+ return(lines_found); \
+ }
+
+#define localize_state(state) \
+ a0_color = state->a0_color; \
+ a0_pos = state->a0_pos; \
+ a0a1 = state->a0a1; \
+ bitpos = state->bits.bitpos; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ goal = state->goal; \
+ n_old_trans = state->n_old_trans; \
+ old_trans = state->old_trans; \
+ n_new_trans = state->n_new_trans; \
+ new_trans = state->new_trans; \
+ length_acc = state->length_acc; \
+ last_b1_idx = state->last_b1_idx; \
+ width = state->width; \
+ rl = state->rl;
+#endif /* defined(_G31D) */
+
+#if defined(_PBits)
+#define save_state_and_return(state) \
+ { \
+ state->a0_color = a0_color; \
+ state->a0_pos = a0_pos; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->goal = goal; \
+ state->length_acc = length_acc; \
+ state->width = width; \
+ state->rl = rl; \
+ return(lines_found); \
+ }
+
+#define localize_state(state) \
+ a0_color = state->a0_color; \
+ a0_pos = state->a0_pos; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ goal = state->goal; \
+ length_acc = state->length_acc; \
+ width = state->width; \
+ rl = state->rl;
+#endif /* defined(_Pbits) */
+
+/* ------------------------------------------------------------------- */
+/*
+ * reset_transitions();
+ *
+ * Macro to trade old and new transition buffers
+ *
+ * Strategy:
+ * Do the obvious
+ */
+#define reset_transitions() \
+ { \
+ register int *tmp = old_trans; \
+ old_trans = new_trans; \
+ new_trans = tmp; \
+ n_old_trans = n_new_trans; \
+ n_new_trans = 0; \
+ last_b1_idx = 0; \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * get_mode_and_length(mode,length,byteptr,bitpos,endptr);
+ *
+ * Macro to get next coding mode (vertical or horizontal or ...)
+ *
+ * Strategy: the modes are encoded with 8 bits or less except
+ * for EOL, which is 001 (12 bits). However, none of
+ * the other modes use 00, so there's no conflict.
+ *
+ * We have precomputed a lookup table that tells us for
+ * any sequence of 8 bits, what mode and length goes
+ * along with that sequence. So all we have to do is
+ * get the 8 bits and run them through the lookup table
+ * and we're done.
+ *
+ * Note: I'm trying to write this so a decent compiler will only
+ * do one load to get both mode and length. Hopefully, your
+ * compiler will fetch '*entry' all at once, then shift and
+ * mask to get components.
+ *
+ * Very old compilers may have troubles with the struct =
+ * construction. You'll have to change entry to *entry
+ * and the entry.mode to entry->mode, etc.
+ */
+
+#define get_mode_and_length(mode,length,byteptr,bitpos,endptr) \
+ { register unsigned char bits=get_byte(byteptr,bitpos,endptr); \
+ register TwoDTable entry; \
+ entry = _TwoDFaxTable[bits]; \
+ mode = entry.mode; \
+ length = entry.n_bits; \
+ }
+
+/* ------------------------------------------------------------------- */
+
+/*
+ * find_b1pos(a0_pos,a0_color,n_old_trans,old_trans);
+ *
+ * Macro to find pixel of opposite color of a0, to right of a0,
+ * on the previous line.
+ *
+ * Strategy: b1 is more or less monotonically increasing. The
+ * only possible exception is during vertical coding when
+ * a1 is left of b1 by 2 or 3:
+ *
+ * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ * b1' b1
+ * B B B B W W B B B B
+ * B B W B W B W
+ * a0 a1
+ *
+ * In the diagram above, b1 is the first changing element to the
+ * right of a0 which goes from white to black. a1 is three to the
+ * left of b1.
+ *
+ * When we set a0'=a1 and proceed decoding, since the new a0' is
+ * black, we want the first changing element to the right of a0'
+ * which goes from black to white. This is b1', as pictured. Note
+ * that b1' < b1! So the b1 sequence is not monotically increasing,
+ * though it is close.
+ *
+ * At most we have to back up one transition to get the right
+ * changing element for a0'. This is because b1 is W->B, while
+ * the transition before is B-W, the one before that W->B, and
+ * so on. The transition before b1 is a candidate for b1', but
+ * not the one before that (it's the wrong color). The third
+ * transition before b1 must be at a position <= a0'. But the
+ * definition of b1' requires that b1' be to the right of a0'.
+ * Therefore, only the transition immediately before b1 could
+ * possibly server as b1'.
+ *
+ * Moral: If the last b1 we found was index last_b1_idx, then
+ * we can start searching for b1' at last_b1_idx-1, with complete
+ * assurance that we'll find it. (if it exists :)
+ *
+ * One more thing: WHITE is defined as 0. BLACK is 1. The 1st
+ * transition (last_b1_idx=0) is W->B, the 2nd (last_b1_idx=1)
+ * is B->W, etc. So an even transition is black, and odd is white.
+ *
+ * BLACK WHITE
+ * | 0 | 1 | bit1 of transition idx
+ * ----------|-------|-------|
+ * a0 WHITE(0) | ok | bad |
+ * color BLACK(1) | bad | ok |
+ * ----------|-------|-------|
+ *
+ * We need a transition which is opposite in color to a0_color.
+ * From the table above, if a0_color ^ (idx & 1), the colors
+ * match and we need to choose the next transition to the right.
+ */
+#define find_b1pos(a0_pos,a0_color,n_old,old) \
+ { \
+ if (last_b1_idx > 0) \
+ --last_b1_idx; /* avoid gotcha from above evil case */ \
+ \
+ /* search for first changing element to right of a0_pos */ \
+ while (old[last_b1_idx] <= a0_pos) \
+ if (++last_b1_idx >= n_old) \
+ break; /* if out of transitions, give up */ \
+ \
+ /* check out color - if matching, use next transition */ \
+ if (a0_color ^ (last_b1_idx & 1)) \
+ ++last_b1_idx; \
+ \
+ if (last_b1_idx < n_old) \
+ b1_pos = old[last_b1_idx]; \
+ else { \
+ last_b1_idx = 0; \
+ b1_pos = -1; \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * find_b2pos(a0_pos,a0_color,n_old_trans,old_trans);
+ *
+ * Macro to find the end of a chunk of pixels in the previous line,
+ * which we passed by because they are uncorrelated with this line.
+ *
+ * Strategy: teeny tiny modification to find_b1pos.
+ *
+ */
+#define find_b2pos(a0_pos,a0_color,n_old,old) \
+ { \
+ if (last_b1_idx > 0) \
+ --last_b1_idx; /* avoid gotcha from above evil case */ \
+ \
+ /* search for first changing element to right of a0_pos */ \
+ while (old[last_b1_idx] <= a0_pos) \
+ if (++last_b1_idx >= (n_old-1)) /* CHANGE */ \
+ break; /* if out of transitions, give up */ \
+ \
+ /* check out color - if matching, use next transition */ \
+ if (a0_color ^ (last_b1_idx & 1)) \
+ ++last_b1_idx; \
+ \
+ if (last_b1_idx < n_old-1) /* CHANGE */ \
+ b2_pos = old[last_b1_idx+1]; /* CHANGE */ \
+ else { \
+ last_b1_idx = 0; \
+ b2_pos = -1; \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/**** module fax/bits.h ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/dg31d.c b/xc/programs/Xserver/XIE/mixie/fax/dg31d.c
new file mode 100644
index 000000000..380cce0e4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/dg31d.c
@@ -0,0 +1,388 @@
+/* $TOG: dg31d.c /main/6 1998/02/09 16:13:48 kaleb $ */
+/**** module fax/dg31d.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/dg31d.c -- DDXIE G31D fax decode technique/element
+
+ Ben Fahy -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+
+
+#define lenient_decoder
+
+
+/* the folling define causes extra stuff to be saved in state recorder */
+#define _G31D
+#include "fax.h"
+#include "faxint.h"
+#include "bits.h"
+
+#include <servermd.h> /* pick up the BITMAP_BIT_ORDER from Core X*/
+
+
+/**********************************************************************/
+int decode_g31d(state)
+FaxState *state;
+{
+register int bitpos;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int a0_color;
+register int a0_pos;
+register int a1_pos;
+register int goal;
+register int width;
+register int rl;
+
+int lines_found=0;
+int n_old_trans;
+int n_new_trans;
+int *old_trans;
+int *new_trans;
+int a0a1,a1a2;
+int length_acc=0;
+int last_b1_idx=0;
+int code,nbits;
+
+ if (state == (FaxState *)NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadStripper;
+ return(-1);
+ }
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size-4;
+ /* we will panic with four bytes to go */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+
+ localize_state(state);
+
+ if (state->magic_needs)
+ finish_magic(state->final);
+ /* a magic strip was waiting for 1st word of next strip */
+
+
+/*** Main Decoding Loop ***/
+ while(1) {
+
+ switch(goal) {
+ case FAX_GOAL_SkipPastAnyToEOL:
+ code = 0; /* get gnu compiler to shut up */
+ while (byteptr < endptr) {
+ /* look for EOL code */
+ code = get_wcode(byteptr,bitpos,endptr);
+ rl = _WhiteFaxTable[code].run_length;
+ if (rl == EOL_RUN_LENGTH)
+ break;
+ else
+ /* move bitstream one bit further and try again */
+ adjust_1bit(byteptr,bitpos,endptr);
+ }
+ if (byteptr >= endptr) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorSkipPast;
+ return(lines_found);
+ }
+ nbits = _WhiteFaxTable[code].n_bits;
+ goal = FAX_GOAL_StartNewLine;
+ adjust_bitstream(nbits,byteptr,bitpos,endptr);
+ break;
+
+ case FAX_GOAL_SeekFillAndEOL:
+ /* look for EOL code */
+ code = 0; /* get gnu compiler to shut up */
+ while (byteptr < endptr) {
+ /* look for EOL code */
+ code = get_wcode(byteptr,bitpos,endptr);
+ rl = _WhiteFaxTable[code].run_length;
+ if (rl == EOL_RUN_LENGTH)
+ break;
+ else if (code) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadFill;
+ return(lines_found);
+ }
+ else
+ /* move bitstream one bit further and try again */
+ adjust_1bit(byteptr,bitpos,endptr);
+ }
+ if (byteptr >= endptr) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadPtr;
+ return(-1);
+ }
+ nbits = _WhiteFaxTable[code].n_bits;
+ goal = FAX_GOAL_StartNewLine;
+ /* set goal before adjusting in case we run out of data */
+ adjust_bitstream(nbits,byteptr,bitpos,endptr);
+ break;
+
+ case FAX_GOAL_StartNewLine:
+
+ if (lines_found >= state->nl_sought)
+ save_state_and_return(state);
+
+ /* normal line initialization stuff */
+ a0_pos = -1;
+ a0_color = WHITE;
+ goal = FAX_GOAL_HandleHoriz;
+
+ reset_transitions();
+ break;
+
+ case FAX_GOAL_RecoverZero:
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+
+ case FAX_GOAL_HandleHoriz:
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA0A1;
+ /* in case I run out of data while getting a0-a1 distance */
+
+ case FAX_GOAL_AccumulateA0A1:
+ get_a0a1(FAX_GOAL_RecordA0A1);
+ /* If we have to return for data before getting the */
+ /* whole a0a1 distance, we want to return to the a0a1 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a0a1 distance, then */
+ /* we want to jump to state FAX_GOAL_RecordA0A1 when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_FallOnSword:
+ if (goal == FAX_GOAL_FallOnSword) {
+#if defined(lenient_decoder)
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ FlushLineData();
+ break;
+
+#else
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadCode;
+ return(lines_found);
+#endif
+ }
+
+ case FAX_GOAL_RecordA0A1:
+ a0a1 = length_acc;
+ if (a0a1 < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada0a1;
+ return(-1);
+ }
+ if (a0_pos < 0) {
+ /* at start of line, a0a1 is the number of white pixels, */
+ /* which is also the index on the line where white->black */
+ new_trans[n_new_trans++] = a1_pos = a0a1;
+ } else {
+ /* in middle of the line, a0a1 is run-length, so
+ * a1_pos = a0_pos + a0a1, a2_pos = a1_pos + a1a2
+ *
+ * 0 1 2 3 4 5 6 7 8 9 A B C D
+ * |w |w |w |b |b |b |b |b |w | | | | |
+ * a0 a1 a2
+ */
+ new_trans[n_new_trans++] = a1_pos = a0_pos + a0a1;
+ }
+ if (a1_pos >= width) {
+ if (a1_pos > width) {
+#if defined(lenient_decoder)
+ /* we went too far, but we'll be forgiving */
+ a1_pos = width;
+#else
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ return(-1);
+#endif
+ }
+ FlushLineData();
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+ }
+ if (new_trans[n_new_trans-1] < 0){
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadA0pos;
+ return(-1);
+ }
+
+
+ if (goal == FAX_GOAL_RecoverZero) {
+
+ /* it's possible we got here by reading a zero in get_a0a1, */
+ /* in which case 'goal' was set to FAX_GOAL_RecoverZero. We */
+ /* must assume that the zero is an EOL pre-padded with a */
+ /* variable number of zeros, which is legal according to */
+ /* the coding spec. So we will record the increment in */
+ /* line number and then attempt to recover. */
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ FlushLineData();
+ break;
+ /* break out of the switch, loop with the while */
+ }
+
+ if (rl == EOL_RUN_LENGTH) {
+ FlushLineData();
+ goal = FAX_GOAL_StartNewLine;
+ /* if we got a non-zero length, remember the transition */
+ /* in case the next line is coded in vertical mode */
+ if (a0a1)
+ new_trans[n_new_trans++] = a0a1;
+
+ /* notice we don't have to worry about a0_pos -
+ it will be reset when we start the new line
+ */
+ break;
+ /* break out of the switch, loop with the while */
+ }
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA1A2;
+ /* in case I run out of data while getting a1-a2 distance */
+
+ case FAX_GOAL_AccumulateA1A2:
+ get_a1a2(FAX_GOAL_FinishHoriz);
+ /* If we have to return for data before getting the */
+ /* whole a1a2 distance, we want to return to the a1a2 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a1a2 distance, then */
+ /* we want to jump to state FAX_GOAL_FinishHoriz when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_FinishHoriz:
+ a1a2 = length_acc;
+ /* XXX - I may regret not checking for a1a2 > 0 later... */
+ if (a1a2 < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada1a2;
+ return(-1);
+ }
+
+
+ new_trans[n_new_trans] = a0_pos = new_trans[n_new_trans-1]+a1a2;
+ ++n_new_trans;
+ if (a0_pos < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadA0pos;
+ return(-1);
+ }
+
+ /* it's possible we got here by reading a zero in get_a1a2, */
+ /* in which case 'goal' was set to FAX_GOAL_RecoverZero. We */
+ /* must assume that the zero is an EOL pre-padded with a */
+ /* variable number of zeros, which is legal according to */
+ /* the coding spec. So we will update the line count and */
+ /* then attempt to recover. */
+ if (goal == FAX_GOAL_FallOnSword) {
+#if defined(lenient_decoder)
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ FlushLineData();
+ break;
+
+#else
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadCode;
+ return(lines_found);
+#endif
+ }
+ if (goal == FAX_GOAL_RecoverZero ) {
+ /* assume we have hit the begining of an EOL */
+ /* goal = FAX_GOAL_SeekFillAndEOL; */
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ FlushLineData();
+ break;
+ }
+ if (rl == EOL_RUN_LENGTH) {
+ FlushLineData();
+ goal = FAX_GOAL_StartNewLine;
+ if (state->decoder_done)
+ save_state_and_return(state);
+ break;
+ }
+ if (a0_pos >= width) {
+ if (a0_pos > width) {
+#if defined(lenient_decoder)
+ /* we went too far, but we'll be forgiving */
+ a0_pos = width;
+#else
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ return(lines_found);
+#endif
+ }
+ FlushLineData();
+ if (state->decoder_done)
+ save_state_and_return(state);
+ /* goal = FAX_GOAL_SeekFillAndEOL; */
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+ }
+ else {
+ goal = FAX_GOAL_HandleHoriz;
+ }
+ break;
+
+
+ default:
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadGoal;
+ return(lines_found);
+ break;
+ } /* end of switch */
+ }
+/*** End, Main Decoding Loop ***/
+}
+/**** module fax/g31d.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/dg32d.c b/xc/programs/Xserver/XIE/mixie/fax/dg32d.c
new file mode 100644
index 000000000..67f69eaeb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/dg32d.c
@@ -0,0 +1,484 @@
+/* $TOG: dg32d.c /main/7 1998/02/09 16:13:52 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module fax/dg32d.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/dg32d.c -- DDXIE G32D fax decode technique/element
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+#define lenient_decoder
+
+/* the folling define causes extra stuff to be saved in state recorder */
+#define _G32D
+
+#include "fax.h"
+#include "faxint.h"
+#include "bits.h"
+
+#include <servermd.h> /* pick up the BITMAP_BIT_ORDER from Core X*/
+
+
+/**********************************************************************/
+int decode_g32d(state)
+FaxState *state;
+{
+register int bitpos;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int a0_color;
+register int a0_pos,a1_pos;
+register int goal;
+register int mode; /* could overload goal, but will resist */
+register int length;
+register int width;
+register int g32d_horiz;
+register int rl;
+
+int lines_found=0;
+int n_old_trans;
+int n_new_trans;
+int *old_trans;
+int *new_trans;
+int a0a1,a1a2;
+int length_acc=0;
+int last_b1_idx=0;
+int b1_pos,b2_pos;
+int code,nbits;
+
+ if (state == (FaxState *)NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ return(-1);
+ }
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size-4;
+ /* we will panic with four bytes to go */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+
+ localize_state(state);
+
+ if (state->magic_needs)
+ finish_magic(state->final);
+ /* a magic strip was waiting for 1st word of next strip */
+
+
+/*** Main Decoding Loop ***/
+ while(1) {
+ if (endptr < byteptr) {
+ return(-1);
+ }
+ switch(goal) {
+
+ case FAX_GOAL_SkipPastAnyToEOL:
+ code = 0; /* get Gnu cc to shut up. */
+ while (byteptr < endptr) {
+ /* look for EOL code */
+ code = get_wcode(byteptr,bitpos,endptr);
+ rl = _WhiteFaxTable[code].run_length;
+ if (rl == EOL_RUN_LENGTH)
+ break;
+#if defined(lenient_decoder)
+ else
+ /* move bitstream one bit further and try again */
+ adjust_1bit(byteptr,bitpos,endptr);
+#else
+ else if (!state->o_line && !lines_found) {
+ /* we'll be lenient starting out */
+ adjust_1bit(byteptr,bitpos,endptr);
+ }
+ else {
+ state->decoder_done = FAX_DECODE_DONE_ErrorSkipPast;
+ save_state_and_return(state);
+ }
+#endif
+ }
+ if (byteptr >= endptr) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorSkipPast;
+ save_state_and_return(state);
+ }
+ nbits = _WhiteFaxTable[code].n_bits;
+ goal = FAX_GOAL_SeekTagBit;
+ adjust_bitstream(nbits,byteptr,bitpos,endptr);
+ break;
+
+ case FAX_GOAL_SeekEOLandTag:
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+
+ case FAX_GOAL_SeekTagBit:
+ if (get_bit(byteptr,bitpos,endptr)) {
+ g32d_horiz = 1;
+ }
+ else {
+ g32d_horiz = 0;
+ }
+ goal = FAX_GOAL_AdjustTag;
+ /* have to set this goal in case adjusting throws us
+ back to the caller in order to get more data. */
+
+ adjust_1bit(byteptr,bitpos,endptr);
+ case FAX_GOAL_AdjustTag:
+
+
+ /*** ok, now start a new line ***/
+ goal = FAX_GOAL_StartNewLine;
+ break;
+
+ case FAX_GOAL_StartNewLine:
+
+ /* if we got all the data we want, write it out */
+ if (lines_found >= state->nl_sought)
+ save_state_and_return(state);
+
+ /* normal line initialization stuff */
+ a0_pos = -1;
+ a0_color = WHITE;
+ if (g32d_horiz)
+ goal = FAX_GOAL_HandleHoriz;
+ else
+ goal = FAX_GOAL_DetermineMode;
+
+ reset_transitions();
+ break;
+ case FAX_GOAL_DetermineMode:
+ get_mode_and_length(mode,length,byteptr,bitpos,endptr);
+ goal = mode;
+ /* our goal is now to handle whatever mode we're in! */
+
+ if (mode == FAX_MODE_Unknown) {
+ /* hopefully, we just hit the first 0 in an EOL */
+ goal = FAX_GOAL_SeekEOLandTag;
+ }
+ else
+ adjust_bitstream_8(length,byteptr,bitpos,endptr);
+ break;
+
+ case FAX_GOAL_RecoverZero:
+
+ /* have to set new goal in case adjusting throws us */
+ /* back to the caller (to get more data) */
+ goal = FAX_GOAL_AdjustedButStillRecovering;
+ adjust_bitstream(nbits,byteptr,bitpos,endptr);
+
+ case FAX_GOAL_AdjustedButStillRecovering:
+ {
+ int next_goal = FAX_GOAL_FoundOneEOL;
+
+ while (1) {
+ if (*byteptr) {
+ register int mask;
+ /* important assumption: we only get here if we have */
+ /* found at least twelve bits of zero leading up to */
+ /* the current bitposition. Therefore, there can't */
+ /* be any bits in the byte before the one we want */
+
+ mask = 1 << (7-bitpos);
+ while (bitpos < 8) {
+ if (mask & (*byteptr))
+ break;
+ mask >>= 1;
+ ++bitpos;
+ } /* can't really reach bitpos = 8 above */
+ goal = next_goal;
+ adjust_1bit(byteptr,bitpos,endptr);
+ break;
+ /* break out of while (1) */
+ }
+ else {
+ bitpos = 0;
+ if (++byteptr >= endptr)
+ do_magic(byteptr,bitpos,endptr);
+ /* loop around to search some more */
+ }
+ } /* end of while */
+
+ }
+ break;
+
+ case FAX_GOAL_FoundOneEOL:
+ /* found an EOL. If this is RTC, there will be five more EOL's */
+ /* on the way. If this is a normal EOL, next code will not */
+ /* be an EOL, and we should interpret the next bit as tag bit */
+
+
+ /* look for second EOL code */
+ code = get_wcode(byteptr,bitpos,endptr);
+ rl = _WhiteFaxTable[code].run_length;
+ if (rl != EOL_RUN_LENGTH) {
+ goal = FAX_GOAL_SeekTagBit;
+ break;
+ }
+
+ /* Got a second EOL code */
+ return(-1);
+ break;
+
+ case FAX_GOAL_HandleHoriz:
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA0A1;
+ /* in case I run out of data while getting a0-a1 distance */
+
+
+ case FAX_GOAL_AccumulateA0A1:
+ get_a0a1(FAX_GOAL_RecordA0A1);
+ /* If we have to return for data before getting the */
+ /* whole a0a1 distance, we want to return to the a0a1 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a0a1 distance, then */
+ /* we want to jump to state FAX_GOAL_RecordA0A1 when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_RecordA0A1:
+ a0a1 = length_acc;
+ if (a0_pos < 0) {
+ /* at start of line, a0a1 is the number of white pixels, */
+ /* which is also the index on the line where white->black */
+ new_trans[n_new_trans++] = a1_pos = a0a1;
+ } else {
+ /* in middle of the line, a0a1 is run-length, so
+ * a1_pos = a0_pos + a0a1, a2_pos = a1_pos + a1a2
+ *
+ * 0 1 2 3 4 5 6 7 8 9 A B C D
+ * |w |w |w |b |b |b |b |b |w | | | | |
+ * a0 a1 a2
+ */
+ new_trans[n_new_trans++] = a1_pos = a0_pos + a0a1;
+ }
+ if (a1_pos >= width) {
+ if (a1_pos > width) {
+#if defined(lenient_decoder)
+ /* we went too far, but we'll be forgiving */
+ a1_pos = width;
+#else /* not so lenient */
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ return(lines_found);
+#endif
+ }
+ FlushLineData();
+ goal = FAX_GOAL_SeekEOLandTag;
+ break;
+ }
+#if defined(lenient_decoder)
+ if (rl < 0) {
+ FlushLineData();
+ goal = FAX_GOAL_SeekTagBit;
+ /* if we got a non-zero length, remember the transition */
+ /* in case the next line is coded in vertical mode */
+ if (a0a1)
+ new_trans[n_new_trans++] = a0a1;
+
+ /* notice we don't have to worry about a0_pos -
+ it will be reset when we start the new line
+ */
+ break;
+ /* break out of the switch, loop with the while */
+ }
+#else /* not so lenient */
+ if (goal == FAX_GOAL_RecoverZero) {
+ /* it's possible we got here by reading a zero in get_a0a1, */
+ /* in which case 'goal' was set to FAX_GOAL_RecoverZero. We */
+ /* must assume that the zero is an EOL pre-padded with a */
+ /* variable number of zeros, which is legal according to */
+ /* the coding spec. So we will record the increment in */
+ /* line number and then attempt to recover. */
+ FlushLineData();
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+ } else if(rl == BAD_RUN_LENGTH) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada0a1;
+ return(lines_found);
+ }
+#endif
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA1A2;
+ /* in case I run out of data while getting a1-a2 distance */
+
+ case FAX_GOAL_AccumulateA1A2:
+ get_a1a2(FAX_GOAL_FinishHoriz);
+ /* If we have to return for data before getting the */
+ /* whole a1a2 distance, we want to return to the a1a2 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a1a2 distance, then */
+ /* we want to jump to state FAX_GOAL_FinishHoriz when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_FinishHoriz:
+ a1a2 = length_acc;
+ new_trans[n_new_trans] = a0_pos = new_trans[n_new_trans-1]+a1a2;
+ n_new_trans++;
+
+#if defined(lenient_decoder)
+ if (rl < 0) {
+ FlushLineData();
+ goal = FAX_GOAL_SeekTagBit;
+ break;
+ }
+#else /* not so lenient */
+ /* it's possible we got here by reading a zero in get_a1a2, */
+ /* in which case 'goal' was set to FAX_GOAL_RecoverZero. We */
+ /* must assume that the zero is an EOL pre-padded with a */
+ /* variable number of zeros, which is legal according to */
+ /* the coding spec. So we will update the line count and */
+ /* then attempt to recover. */
+ if (goal == FAX_GOAL_RecoverZero) {
+ /* assume we have hit the begining of an EOL */
+ FlushLineData();
+ goal = FAX_GOAL_SkipPastAnyToEOL;
+ break;
+ } else if(rl == BAD_RUN_LENGTH) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada1a2;
+ return(lines_found);
+ }
+#endif
+ if (a0_pos >= width) {
+ if (a0_pos > width) {
+#if defined(lenient_decoder)
+ /* we went too far, but we'll be forgiving */
+ a0_pos = width;
+#else
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ return(lines_found);
+#endif
+ }
+ FlushLineData();
+ goal = FAX_GOAL_SeekEOLandTag;
+ break;
+ } else if(a0_pos > 0) {
+ if (g32d_horiz)
+ goal = FAX_GOAL_HandleHoriz;
+ else
+ goal = FAX_GOAL_DetermineMode;
+ } else {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadA0pos;
+ return(lines_found);
+ }
+ break;
+
+ case FAX_MODE_Pass:
+ if (!n_old_trans) { /* line above all white */
+ return(-1);
+ }
+ find_b2pos(a0_pos,a0_color,n_old_trans,old_trans);
+
+ a0_pos = b2_pos;
+ if (a0_pos < 0 || a0_pos >= width) {
+ FlushLineData();
+ goal = FAX_GOAL_SeekEOLandTag;
+ break;
+ }
+ goal = FAX_GOAL_DetermineMode;
+ break;
+
+ case FAX_GOAL_HandleVertL3:
+ case FAX_GOAL_HandleVertL2:
+ case FAX_GOAL_HandleVertL1:
+ case FAX_GOAL_HandleVert0:
+ case FAX_GOAL_HandleVertR1:
+ case FAX_GOAL_HandleVertR2:
+ case FAX_GOAL_HandleVertR3:
+ if (n_old_trans) { /* line above not all white */
+ find_b1pos(a0_pos,a0_color,n_old_trans,old_trans);
+
+ if (b1_pos < 0) {
+ if (goal > FAX_GOAL_HandleVert0) {
+ return(-1); /* error! */
+ }
+ b1_pos = width;
+ }
+ } else {
+ /* line above was all white. Since b1 was first non-white */
+ /* b1 is imaginary transition off right edge. */
+ b1_pos = width;
+ }
+ /* ok, we are guaranteed that 0 <= b1_pos <= width */
+ /* set a0_pos = a1_pos, which is relative to b1_pos */
+ a0_pos = b1_pos + (goal-FAX_GOAL_HandleVert0);
+ a0_color = 1-a0_color;
+ new_trans[n_new_trans++] = a0_pos > 0 ? a0_pos : 0;
+ if (a0_pos < 0 || a0_pos >= width) {
+ FlushLineData();
+ goal = FAX_GOAL_SeekEOLandTag;
+ } else {
+ /* not at eol yet */
+ goal = FAX_GOAL_DetermineMode;
+ }
+ break;
+
+ default:
+ return(-1);
+ break;
+ } /* end of switch */
+ }
+/*** End, Main Decoding Loop ***/
+}
+/**** module fax/g32d.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/dg4.c b/xc/programs/Xserver/XIE/mixie/fax/dg4.c
new file mode 100644
index 000000000..43a24e2a8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/dg4.c
@@ -0,0 +1,283 @@
+/* $TOG: dg4.c /main/6 1998/02/09 16:13:57 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module fax/g4.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994,1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/g4.c -- DDXIE G4 fax decode technique/element
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+
+#define _G4
+#include "fax.h"
+#include "faxint.h"
+#include "bits.h"
+
+#include <servermd.h>
+ /* pick up the BITMAP_BIT_ORDER from Core X*/
+
+
+/**********************************************************************/
+int decode_g4(state)
+FaxState *state;
+{
+register int bitpos;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int a0_color;
+register int a0_pos;
+register int goal;
+register int mode; /* could overload goal, but will resist */
+register int length;
+register int width;
+
+int lines_found=0;
+int n_old_trans;
+int n_new_trans;
+int *old_trans;
+int *new_trans;
+int a0a1,a1a2;
+int length_acc=0;
+int last_b1_idx=0;
+int b1_pos,b2_pos;
+int rl;
+
+ if (state == (FaxState *)NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadStripper;
+ return(-1);
+ }
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size-4;
+ /* we will panic with four bytes to go */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+
+ localize_state(state);
+
+ if (state->magic_needs)
+ finish_magic(state->final);
+ /* a magic strip was waiting for 1st word of next strip */
+
+/*** Main Decoding Loop ***/
+ while(1) {
+ switch(goal) {
+ case FAX_GOAL_StartNewLine:
+
+ /* if any data produced by previous states, write it out */
+ if (lines_found >= state->nl_sought)
+ save_state_and_return(state);
+
+ /* normal line initialization stuff */
+ a0_pos = -1;
+ a0_color = WHITE;
+ goal = FAX_GOAL_DetermineMode;
+ reset_transitions();
+ break;
+ case FAX_GOAL_DetermineMode:
+ get_mode_and_length(mode,length,byteptr,bitpos,endptr);
+ goal = mode;
+ /* our goal is now to handle whatever mode we're in! */
+
+ if (mode != FAX_MODE_Unknown)
+ adjust_bitstream_8(length,byteptr,bitpos,endptr);
+ break;
+
+ case FAX_GOAL_HandleHoriz:
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA0A1;
+ /* in case I run out of data while getting a0-a1 distance */
+
+
+ case FAX_GOAL_AccumulateA0A1:
+ get_a0a1(FAX_GOAL_RecordA0A1);
+ /* If we have to return for data before getting the */
+ /* whole a0a1 distance, we want to return to the a0a1 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a0a1 distance, then */
+ /* we want to jump to state FAX_GOAL_RecordA0A1 when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_RecordA0A1:
+ a0a1 = length_acc;
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA1A2;
+ /* in case I run out of data while getting a1-a2 distance */
+
+ case FAX_GOAL_AccumulateA1A2:
+ get_a1a2(FAX_GOAL_FinishHoriz);
+ /* If we have to return for data before getting the */
+ /* whole a1a2 distance, we want to return to the a1a2 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a1a2 distance, then */
+ /* we want to jump to state FAX_GOAL_FinishHoriz when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_FinishHoriz:
+ a1a2 = length_acc;
+ if (a0_pos < 0) {
+ /* at start of line, a0a1 is the number of white pixels, */
+ /* which is also the index on the line where white->black */
+ new_trans[n_new_trans++] = a0a1;
+ new_trans[n_new_trans] = a0_pos = a0a1 + a1a2;
+ ++n_new_trans;
+ } else {
+ /* in middle of the line, a0a1 is run-length, so
+ * a1_pos = a0_pos + a0a1, a2_pos = a1_pos + a1a2
+ *
+ * 0 1 2 3 4 5 6 7 8 9 A B C D
+ * |w |w |w |b |b |b |b |b |w | | | | |
+ * a0 a1 a2
+ */
+ new_trans[n_new_trans++] = a0_pos + a0a1;
+ new_trans[n_new_trans] = a0_pos = a0_pos + a0a1 + a1a2;
+ ++n_new_trans;
+ }
+ if (a0_pos >= width) {
+ if (a0_pos > width) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ save_state_and_return(state);
+ }
+ goal = FAX_GOAL_StartNewLine;
+ FlushLineData();
+ break;
+ }
+ else
+ goal = FAX_GOAL_DetermineMode;
+ break;
+
+ case FAX_MODE_Pass:
+ if (!n_old_trans) { /* line above all white */
+ state->decoder_done = FAX_DECODE_DONE_ErrorPassAboveAllWhite;
+ save_state_and_return(state);
+ }
+ find_b2pos(a0_pos,a0_color,n_old_trans,old_trans);
+
+ a0_pos = b2_pos;
+ if (a0_pos < 0) {
+ FlushLineData();
+ goal = FAX_GOAL_StartNewLine;
+ break;
+ }
+ if (a0_pos >= width) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadA0pos;
+ save_state_and_return(state);
+ }
+ goal = FAX_GOAL_DetermineMode;
+ break;
+
+ case FAX_GOAL_HandleVertL3:
+ case FAX_GOAL_HandleVertL2:
+ case FAX_GOAL_HandleVertL1:
+ case FAX_GOAL_HandleVert0:
+ case FAX_GOAL_HandleVertR1:
+ case FAX_GOAL_HandleVertR2:
+ case FAX_GOAL_HandleVertR3:
+ if (n_old_trans) { /* line above not all white */
+ find_b1pos(a0_pos,a0_color,n_old_trans,old_trans);
+
+ if (b1_pos < 0) {
+ if (goal > FAX_GOAL_HandleVert0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadGoal;
+ save_state_and_return(state);
+ }
+ b1_pos = width;
+ }
+ } else {
+ /* line above was all white. Since b1 was first non-white */
+ /* b1 is imaginary transition off right edge. */
+ b1_pos = width;
+ }
+ /* ok, we are guaranteed that 0 <= b1_pos <= width */
+ /* set a0_pos = a1_pos, which is relative to b1_pos */
+ a0_pos = b1_pos + (goal-FAX_GOAL_HandleVert0);
+ a0_color = 1-a0_color;
+ new_trans[n_new_trans++] = a0_pos > 0 ? a0_pos : 0;
+ if (a0_pos >= width) {
+ FlushLineData();
+ goal = FAX_GOAL_StartNewLine;
+ }
+ else {
+ /* not at eol yet */
+ goal = FAX_GOAL_DetermineMode;
+ }
+ break;
+
+ default:
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadGoal;
+ save_state_and_return(state);
+ break;
+ } /* end of switch */
+ }
+/*** End, Main Decoding Loop ***/
+}
+/**** module fax/g4.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/dtiff2.c b/xc/programs/Xserver/XIE/mixie/fax/dtiff2.c
new file mode 100644
index 000000000..6ecfaa27e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/dtiff2.c
@@ -0,0 +1,281 @@
+/* $TOG: dtiff2.c /main/4 1998/02/09 16:14:02 kaleb $ */
+/**** module fax/dtiff2.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/dtiff2.c -- DDXIE TIFF2 fax decode technique/element
+
+ Ben Fahy -- AGE Logic, Inc. Sept, 1993
+
+*****************************************************************************/
+
+/* the folling define causes extra stuff to be saved in state recorder */
+#define _G31D
+#include "fax.h"
+#include "faxint.h"
+#include "bits.h"
+
+#include <servermd.h>
+ /* pick up the BITMAP_BIT_ORDER from Core X*/
+
+/**********************************************************************/
+int decode_tiff2(state)
+FaxState *state;
+{
+register int bitpos;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int a0_color;
+register int a0_pos;
+register int a1_pos;
+register int goal;
+register int width;
+register int rl;
+register int last_b1_idx = 0;
+
+int lines_found=0;
+int n_old_trans;
+int n_new_trans;
+int *old_trans;
+int *new_trans;
+int a0a1,a1a2;
+int length_acc=0;
+
+ if (state == (FaxState *)NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadStripper;
+ return(-1);
+ }
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size-4;
+ /* we will panic with four bytes to go */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+
+ localize_state(state);
+
+ if (state->magic_needs)
+ finish_magic(state->final);
+ /* a magic strip was waiting for 1st word of next strip */
+
+/*** Main Decoding Loop ***/
+ while(1) {
+ switch(goal) {
+
+ case FAX_GOAL_StartNewLine:
+
+ skip_bits_at_eol(byteptr,bitpos,endptr);
+
+ if (lines_found >= state->nl_sought)
+ save_state_and_return(state);
+
+ /* normal line initialization stuff */
+ a0_pos = -1;
+ a0_color = WHITE;
+ goal = FAX_GOAL_HandleHoriz;
+
+ reset_transitions();
+ break;
+
+ case FAX_GOAL_HandleHoriz:
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA0A1;
+ /* in case I run out of data while getting a0-a1 distance */
+
+ case FAX_GOAL_AccumulateA0A1:
+ get_a0a1(FAX_GOAL_RecordA0A1);
+ /* If we have to return for data before getting the */
+ /* whole a0a1 distance, we want to return to the a0a1 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a0a1 distance, then */
+ /* we want to jump to state FAX_GOAL_RecordA0A1 when */
+ /* we reenter the decoder. */
+
+ case FAX_GOAL_FallOnSword:
+ if (goal == FAX_GOAL_FallOnSword) {
+ /* received a yucky code */
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadCode;
+ save_state_and_return(state);
+ }
+
+ case FAX_GOAL_RecoverZero:
+ /* g31d can recover. tiff2, alas, cannot */
+ if (goal == FAX_GOAL_RecoverZero) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadZero;
+ save_state_and_return(state);
+ }
+
+ case FAX_GOAL_RecordA0A1:
+ a0a1 = length_acc;
+ if (a0a1 < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada0a1;
+ save_state_and_return(state);
+ }
+ if (a0_pos < 0) {
+ /* at start of line, a0a1 is the number of white pixels, */
+ /* which is also the index on the line where white->black */
+ new_trans[n_new_trans++] = a1_pos = a0a1;
+ } else {
+ /* in middle of the line, a0a1 is run-length, so
+ * a1_pos = a0_pos + a0a1, a2_pos = a1_pos + a1a2
+ *
+ * 0 1 2 3 4 5 6 7 8 9 A B C D
+ * |w |w |w |b |b |b |b |b |w | | | | |
+ * a0 a1 a2
+ */
+ new_trans[n_new_trans++] = a1_pos = a0_pos + a0a1;
+ }
+ if (a1_pos >= width) {
+ if (a1_pos > width) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ save_state_and_return(state);
+ }
+ FlushLineData();
+ goal = FAX_GOAL_StartNewLine;
+ break;
+ }
+ if (new_trans[n_new_trans-1] < 0){
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ save_state_and_return(state);
+ }
+
+ if (rl == EOL_RUN_LENGTH) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadEOL;
+ save_state_and_return(state);
+ break;
+ /* break out of the switch, loop with the while */
+ }
+ length_acc=0;
+ goal = FAX_GOAL_AccumulateA1A2;
+ /* in case I run out of data while getting a1-a2 distance */
+
+ case FAX_GOAL_AccumulateA1A2:
+ get_a1a2(FAX_GOAL_FinishHoriz);
+ /* If we have to return for data before getting the */
+ /* whole a1a2 distance, we want to return to the a1a2 */
+ /* accumulate state when we reenter the decoder. If */
+ /* adjusting the bitstream forces us to return after */
+ /* getting the last part of the a1a2 distance, then */
+ /* we want to jump to state FAX_GOAL_FinishHoriz when */
+ /* we reenter the decoder. */
+
+ /* handle various possible errors found by get_a1a2 */
+ if (goal == FAX_GOAL_FallOnSword) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadCode;
+ save_state_and_return(state);
+ }
+ if (goal == FAX_GOAL_RecoverZero ) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadZero;
+ save_state_and_return(state);
+ }
+ if (rl == EOL_RUN_LENGTH) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadEOL;
+ save_state_and_return(state);
+ break;
+ }
+
+ case FAX_GOAL_FinishHoriz:
+ a1a2 = length_acc;
+ /* XXX - I may regret not checking for a1a2 > 0 later... */
+ if (a1a2 < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBada1a2;
+ save_state_and_return(state);
+ }
+
+ new_trans[n_new_trans] = a0_pos = new_trans[n_new_trans-1]+a1a2;
+ ++n_new_trans;
+ if (a0_pos < 0) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadA0pos;
+ save_state_and_return(state);
+ }
+
+ if (a0_pos >= width) {
+ if (a0_pos > width) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ save_state_and_return(state);
+ }
+ FlushLineData();
+ if (state->decoder_done)
+ save_state_and_return(state);
+ goal = FAX_GOAL_StartNewLine;
+ break;
+ }
+ else
+ goal = FAX_GOAL_HandleHoriz;
+ break;
+
+
+ default:
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadGoal;
+ save_state_and_return(state);
+ break;
+ } /* end of switch */
+ }
+/*** End, Main Decoding Loop ***/
+}
+/**** module fax/dtiff2.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/dtiffpb.c b/xc/programs/Xserver/XIE/mixie/fax/dtiffpb.c
new file mode 100644
index 000000000..8d36f9648
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/dtiffpb.c
@@ -0,0 +1,288 @@
+/* $TOG: dtiffpb.c /main/5 1998/02/09 16:14:09 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module fax/tiffpb.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/tiffpb.c -- DDXIE TIFF Packbits decode technique/element
+
+ Packbits is output-type independent. The compression algorithm
+ just compresses a stream. The 'strip_size' parameter should be
+ how many bytes long the strip is...
+
+ Coding assumption: it is always valid to do val = *byteptr++;
+ But any code which does this is responsible for making sure
+ the next access will also be valid. Otherwise, we should
+ save state and return.
+
+ Ben Fahy -- AGE Logic, Inc. Sept, 1993
+
+*****************************************************************************/
+
+/* the folling define causes extra stuff to be saved in state recorder */
+#define _PBits
+
+#include "fax.h"
+#include "faxint.h"
+#include "bits.h"
+#include "xiemd.h"
+
+/* by decree of PackBits spec */
+
+/**********************************************************************/
+int decode_tiffpb(state)
+FaxState *state;
+{
+register int a0_color,a0_pos;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int goal;
+register int width,rnd_width;
+register int rl;
+
+register int lines_found=0;
+int length_acc=0;
+
+/*** output line stuff ***/
+register unsigned char *olp;
+register int i,a0_in_bytes;
+
+ if (state == (FaxState *)NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadStripper;
+ return(-1);
+ }
+
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of input strip */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+
+ }
+
+ if (state->magic_needs) {
+ if (state->strip_state == StripStateNew) {
+ state->strip_state = StripStateInUse;
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of input strip */
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+ else {
+ /* no new strip?? But... I *need* more data! */
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadMagic;
+ return(lines_found);
+ }
+ state->magic_needs = 0;
+ }
+
+ localize_state(state);
+ rnd_width = 8 * ((width+7)/8);
+
+ olp = (unsigned char *) state->o_lines[lines_found];
+
+/*** Main Decoding Loop ***/
+ while(1) {
+ switch(goal) {
+ case PB_GOAL_StartNewLine:
+ if (lines_found >= state->nl_sought) {
+ save_state_and_return(state);
+ }
+
+ a0_pos = 0;
+ olp = (unsigned char *) state->o_lines[lines_found];
+ goal = PB_GOAL_GetRunLength;
+ break;
+
+ case PB_GOAL_GetRunLength:
+
+/*** Basic Packbits algorithm:
+
+code = *((signed char *)byteptr++);
+
+if (0 <= code && code <= 127) ===> length = code + 1;
+
+if (-127 <= code && code < 0) ===> length = 1 - code;
+
+else ===> length = 0
+
+We can make things a little quicker (and avoid signed char compiler issues)
+if we simply look for whether the high bit is on or off, and then compute
+the result directly. Thus,
+
+if code && 0x80 => -128 <= code < 0
+
+ 0x80 + foo = -128 + foo
+
+ so length = 1 - code = 1 - (-128 + foo) = 129 - foo.
+
+ note foo=0 is code for runlength 0 (fill)
+
+The positive case is even easier.
+
+***/
+ if (byteptr >= endptr) {
+ state->magic_needs = 1;
+ state->strip_state = StripStateDone;
+ save_state_and_return(state);
+ }
+ if (*byteptr & 0x80) { /* -128 <= code < 0 */
+ register int foo = 0x7f & *byteptr;
+ if (foo) {
+ length_acc = 129 - foo ;
+ goal = PB_GOAL_GetRepeatByte;
+ }
+ else {
+ length_acc = 0; /* -128 => code = 0 */
+ }
+ }
+ else { /* 0 <= code <= 127 */
+ length_acc = 1 + *byteptr;
+ goal = PB_GOAL_GetLiteralBytes;
+ }
+ ++byteptr;
+
+ /* make sure all the pixels fit on this output line */
+ if (8*length_acc + a0_pos > rnd_width ) {
+ state->decoder_done = FAX_DECODE_DONE_ErrorPastWidth;
+ save_state_and_return(state);
+ }
+ break;
+
+ case PB_GOAL_GetLiteralBytes:
+ /* Important Note!! we are guaranteed that output line
+ has enough space to hold output pixels here. We checked
+ in the GetRunLength state. However, it is possible we
+ may run out of input bytes, in which case we may have
+ to save state and return.
+ */
+ a0_in_bytes = a0_pos / 8;
+ while (length_acc > 0) {
+ if (byteptr >= endptr) {
+ a0_pos = a0_in_bytes << 3;
+ state->magic_needs = 1;
+ state->strip_state = StripStateDone;
+ save_state_and_return(state);
+ }
+ a0_color = *byteptr++; length_acc--;
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ olp[a0_in_bytes++] = a0_color;
+#else
+ olp[a0_in_bytes++] = _ByteReverseTable[a0_color];
+#endif
+ }
+ a0_pos = a0_in_bytes << 3;
+
+ if (a0_pos >= width) {
+ ++lines_found;
+ goal = PB_GOAL_StartNewLine;
+ }
+ else
+ goal = PB_GOAL_GetRunLength;
+
+ break;
+
+ case PB_GOAL_GetRepeatByte:
+ if (byteptr >= endptr) {
+ state->magic_needs = 1;
+ state->strip_state = StripStateDone;
+ save_state_and_return(state);
+ }
+ a0_color = *byteptr++;
+
+ /* Important Note!! we are guaranteed that output line
+ has enough space to hold output pixels here. We checked
+ in the GetRunLength state
+ */
+
+ a0_in_bytes = a0_pos / 8;
+ for (i=0; i<length_acc; ++i)
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ olp[a0_in_bytes+i] = a0_color;
+#else
+ olp[a0_in_bytes+i] = _ByteReverseTable[a0_color];
+#endif
+
+ a0_pos += 8*length_acc;
+ if (a0_pos >= width) {
+ ++lines_found;
+ goal = PB_GOAL_StartNewLine;
+ }
+ else
+ goal = PB_GOAL_GetRunLength;
+
+ break;
+
+ default:
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadGoal;
+ save_state_and_return(state);
+ } /* end of switch */
+ } /* end of main decoding loop */
+}
+
+/**** module fax/tiffpb.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/eg31d.c b/xc/programs/Xserver/XIE/mixie/fax/eg31d.c
new file mode 100644
index 000000000..35cd1456f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/eg31d.c
@@ -0,0 +1,285 @@
+/* $TOG: eg31d.c /main/4 1998/02/09 16:14:15 kaleb $ */
+/**** module eg31d.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ eg31d.c -- DDXIE module for encoding g31d format
+
+ Ben Fahy, AGE Logic, Oct 1993
+
+ XXX - this module should be merged with etiff2.c - the only
+ difference is the way EOL's are coded.
+
+******************************************************************************/
+
+#include "fax.h"
+#define _G31D
+#include "fencode.h"
+#include "xiemd.h"
+#include "fetabs.h"
+
+/************************************************************************/
+encode_g31d(state)
+FaxEncodeState *state;
+{
+/* stuff exchanged with state variable */
+register int goal;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int bitpos;
+register int width;
+register int stager;
+int rl;
+register int a0_color;
+G31DEncodePvt *epvt;
+
+/* stuff exchanged with private state variable */
+register int index;
+register int nvals;
+register int *counts;
+register int nbits;
+int rlcode;
+int terminating;
+register int codelength;
+
+register int lines_coded=0;
+register int lines_to_code=0;
+
+int old_rl;
+
+ if (state == (FaxEncodeState *) NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first output strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->encoder_done = ENCODE_ERROR_StripStateNotNew;
+ return(-1);
+ }
+
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ state->strip_state = StripStateInUse;
+ }
+
+ /* or, reset bitstream for a new output strip */
+ if (state->magic_needs) {
+ if (state->strip_state == StripStateNew) {
+ state->strip_state = StripStateInUse;
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+ state->bits.started = 1;
+ }
+ else {
+ /* no new strip?? But... I *need* more data! */
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ return(-1);
+ }
+ state->magic_needs = 0;
+ }
+
+ localize_state(state);
+
+
+/*** Main Encoding Loop ***/
+ while (1) {
+
+ switch(goal) {
+
+ case ENCODE_FAX_GOAL_StartNewLine:
+ /* every new line need to write an EOL. Should call it BOL,huh? */
+
+ if (epvt->align_eol) {
+ /* advance bitpos to 4 + 8k, where k is an integer */
+ bitpos = 4 + 8*( (bitpos+3)>>3 );
+ }
+
+ stager |= (EOL_CODE << (16-bitpos));
+ bitpos += EOL_BIT_LENGTH;
+
+ goal = ENCODE_FAX_GOAL_FlushEOL;
+
+ case ENCODE_FAX_GOAL_FlushEOL:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+ if (bitpos >=8) {
+ /* go around and flush some more */
+ break;
+ }
+
+ goal = ENCODE_FAX_GOAL_EOLWritten;
+
+ if (lines_coded >= state->nl_tocode) {
+ /* We have read the whole input strip, need more data */
+ save_state_and_return(state);
+ }
+
+ case ENCODE_FAX_GOAL_EOLWritten:
+
+ /* every new line we need to compute its runlength data */
+ /* get the sequence of white and black run lengths */
+ nvals = encode_runs(
+ state->i_lines[lines_coded], /* input data */
+ width, /* # of bits */
+ counts, /* where to put lengths */
+ state->radiometric, /* if 1, white is 1 */
+ width
+ );
+ if (nvals < 0) {
+ state->encoder_done = ENCODE_ERROR_EncodeRunsFailure;
+ save_state_and_return(state);
+ }
+ a0_color = WHITE;
+ index = 0;
+
+ case ENCODE_FAX_GOAL_OutputNextRunLength:
+ rl = counts[index++];
+ old_rl = rl;
+
+ case ENCODE_FAX_GOAL_DeduceCode:
+ nbits = deduce_code(a0_color,&rl,&rlcode,&terminating);
+ /* should be a macro but for now, a function */
+
+ /* shift code over so it merges with stager contents */
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+ if (bitpos >=8) {
+ goal = ENCODE_FAX_GOAL_FlushStager;
+ break;
+ }
+ if (terminating) {
+ /* all done with this runlength */
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = ENCODE_FAX_GOAL_OutputNextRunLength;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* go around the loop again */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ old_rl = rl;
+ break;
+
+ case ENCODE_FAX_GOAL_FlushStager:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+
+ if (bitpos >= 8) {
+ /* go around the loop again, trying to flush more */
+ break;
+ }
+ /* if here, we have flushed stager to the point there is */
+ /* at most a partial byte of data left in it. */
+ if (terminating) {
+ /* all done with this runlength */
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = ENCODE_FAX_GOAL_OutputNextRunLength;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* not done with this runlength yet */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ break;
+
+ case ENCODE_FAX_GOAL_FinishLine:
+ ++lines_coded;
+ goal = ENCODE_FAX_GOAL_StartNewLine;
+ break;
+
+ default:
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ save_state_and_return(state);
+ break;
+
+ } /* end of switch(goal) in main decoding loop */
+
+ } /* end of main encoding loop */
+}
+/************************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/eg32d.c b/xc/programs/Xserver/XIE/mixie/fax/eg32d.c
new file mode 100644
index 000000000..8f18ae80c
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/eg32d.c
@@ -0,0 +1,666 @@
+/* $TOG: eg32d.c /main/4 1998/02/09 16:14:20 kaleb $ */
+/**** module eg32d.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ eg32d.c -- DDXIE module for encoding g32d format. Since
+ g42d is so similar, we also do that in
+ this module.
+
+ Ben Fahy, AGE Logic, Oct 1993
+
+******************************************************************************/
+
+#include "fax.h"
+#define _G32D
+#include "fencode.h"
+#include "xiemd.h"
+#include "fetabs.h"
+
+/************************************************************************/
+encode_g32d(state)
+FaxEncodeState *state;
+{
+/* stuff exchanged with state variable */
+register int goal,next_goal;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int bitpos;
+register int width;
+CARD32 stager;
+unsigned rl;
+register int a0_color,b1_color;
+register int a0_pos,a1_pos,a2_pos,b1_pos,b2_pos;
+register int length_acc;
+register int a0a1,a1a2;
+G32DEncodePvt *epvt;
+
+/* stuff exchanged with private state variable */
+register int index,aindex;
+register int save_index,save_aindex;
+register int nvals,avals;
+register int *counts;
+register int *above;
+register int nbits;
+int rlcode;
+int terminating;
+register int codelength;
+register int k,kcnt,save_b1pos,save_b1color;
+
+register int lines_coded=0;
+register int lines_to_code=0;
+register int a1b1,abs_a1b1;
+int old_rl;
+
+ if (state == (FaxEncodeState *) NULL) {
+ return(-1);
+ }
+
+ /* set up initial bitstream for the very first output strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->encoder_done = ENCODE_ERROR_StripStateNotNew;
+ return(-1);
+ }
+
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ state->strip_state = StripStateInUse;
+ }
+
+ /* or, reset bitstream for a new output strip */
+ if (state->magic_needs) {
+ if (state->strip_state == StripStateNew) {
+ state->strip_state = StripStateInUse;
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+ state->bits.started = 1;
+ }
+ else {
+ /* no new strip?? But... I *need* more data! */
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ return(0);
+ }
+ state->magic_needs = 0;
+ }
+
+ localize_state(state);
+ /* loads epvt and other variables */
+
+
+/*** Main Encoding Loop ***/
+ while (1) {
+
+ switch(goal) {
+
+ case ENCODE_FAX_GOAL_StartNewLine:
+ /* every new line need to write an EOL. Should call it BOL,huh? */
+
+ /* make old counts the new reference line */
+ {
+ int *foo;
+ foo = counts;
+ counts = above;
+ above = foo;
+ avals = nvals;
+ }
+
+ if (epvt->really_g4) {
+ /* G4 doesn't write the silly EOL's except at very end */
+ goal = ENCODE_FAX_GOAL_G4SneaksIn;
+ break;
+ }
+
+ if (epvt->align_eol) {
+ /* advance bitpos to 4 + 8k, where k is an integer */
+ bitpos = 4 + 8*( (bitpos+3)>>3 );
+ }
+
+ if (kcnt % k) {
+
+ /* need to encode in 2-D mode */
+ rlcode = EOL_2D_CODE;
+
+ stager |= (EOL_2D_CODE << (16-bitpos));
+ bitpos += EOL_2D_BIT_LENGTH;
+
+ }
+ else {
+ rlcode = EOL_1D_CODE;
+ stager |= (EOL_1D_CODE << (16-bitpos));
+ bitpos += EOL_1D_BIT_LENGTH;
+ }
+
+ goal = ENCODE_FAX_GOAL_FlushEOL;
+
+ case ENCODE_FAX_GOAL_FlushEOL:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+ if (bitpos >=8) {
+ /* go around and flush some more */
+ break;
+ }
+
+ goal = ENCODE_FAX_GOAL_EOLWritten;
+
+ case ENCODE_FAX_GOAL_G4SneaksIn:
+ if (lines_coded >= state->nl_tocode) {
+ /* We have read the whole input strip, need more data */
+ save_state_and_return(state);
+ }
+
+ case ENCODE_FAX_GOAL_EOLWritten:
+
+ /* every new line we need to compute its runlength data */
+ /* get the sequence of white and black run lengths */
+ nvals = encode_runs(
+ state->i_lines[lines_coded], /* input data */
+ width, /* # of bits */
+ counts, /* where to put lengths */
+ state->radiometric, /* if 1, white is 1 */
+ width
+ );
+ if (nvals < 0) {
+ state->encoder_done = ENCODE_ERROR_EncodeRunsFailure;
+ save_state_and_return(state);
+ }
+ a0_color = WHITE;
+ index = 0;
+ if (epvt->really_g4 || kcnt % k) {
+ aindex = 0;
+ a0_pos = -1;
+ b1_color = WHITE;
+ b1_pos = 0;
+ goal = ENCODE_FAX_GOAL_FindPositions;
+ length_acc = 0;
+ break;
+ }
+
+ case ENCODE_FAX_GOAL_OutputNextRunLength:
+ rl = counts[index++];
+ old_rl = rl;
+ next_goal = ENCODE_FAX_GOAL_OutputNextRunLength;
+ /* after we write code for this runlength, go to next */
+
+ case ENCODE_FAX_GOAL_DeduceCode:
+ nbits = deduce_code(a0_color,&rl,&rlcode,&terminating);
+ /* should be a macro but for now, a function */
+
+ /* shift code over so it merges with stager contents */
+
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+
+ if (bitpos >=8) {
+ goal = ENCODE_FAX_GOAL_FlushStager;
+ break;
+ }
+ if (terminating) {
+ /* all done with this runlength */
+ if (next_goal != ENCODE_FAX_GOAL_OutputNextRunLength) {
+ goal = next_goal;
+ break;
+ }
+
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = next_goal;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* go around the loop again */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ old_rl = rl;
+ break;
+
+ case ENCODE_FAX_GOAL_FlushStager:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+
+ if (bitpos >= 8) {
+ /* go around the loop again, trying to flush more */
+ break;
+ }
+ /* if here, we have flushed stager to the point there is */
+ /* at most a partial byte of data left in it. */
+ if (terminating) {
+ /* all done with this runlength */
+ if (next_goal != ENCODE_FAX_GOAL_OutputNextRunLength) {
+ goal = next_goal;
+ break;
+ }
+
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = next_goal;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* not done with this runlength yet */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ old_rl = rl;
+ break;
+
+ case ENCODE_FAX_GOAL_FinishLine:
+ ++lines_coded;
+ ++kcnt;
+ goal = ENCODE_FAX_GOAL_StartNewLine;
+ break;
+
+ case ENCODE_FAX_GOAL_FindPositions:
+ save_index = index;
+ save_aindex = aindex;
+ save_b1pos = b1_pos;
+ save_b1color = b1_color;
+ /* it's easier to just remember these than to back up */
+ if (index >= nvals) {
+ a1_pos = a2_pos = state->width;
+ ++index;
+ /* this is for the sake of vertical mode below */
+ }
+ else {
+ if (a0_pos < 0)
+ a1_pos = counts[index++];
+ else
+ a1_pos = a0_pos + (counts[index++] - length_acc);
+ /* note: we need to subtract length_acc in case
+ we hit one or more pass modes for this index,
+ in which case a0_pos was incremented part of
+ the distance between a0 and a1...
+ */
+ }
+
+ if (index >= nvals) {
+ a2_pos = state->width;
+ ++index;
+ /* this is just so we can subtract to get a1's index */
+ }
+ else
+ a2_pos = a1_pos + counts[index++];
+
+ /* now find b1, which is first changing element to right
+ of a0 of opposite color */
+
+ while (aindex < avals &&
+ (b1_color == a0_color || b1_pos <= a0_pos) ) {
+ b1_pos += above[aindex++];
+ b1_color = ~b1_color;
+ }
+ if (aindex >= avals) {
+
+ /* if no b1 found, set it just past normal image data */
+ /* now, the sum of all 'above[index]'s should be equal */
+ /* to the image width, so this gives us a check that */
+ /* the runlength algorithm is working */
+
+ if (b1_pos != width) {
+ state->encoder_done = ENCODE_ERROR_NoB1Found;
+ save_state_and_return(state);
+ }
+ b2_pos = width+1;
+ }
+ if (aindex >= avals) {
+ if (b1_pos == width)
+ b2_pos = state->width + 1;
+ else
+ b2_pos = state->width;
+ }
+ else
+ b2_pos = b1_pos + above[aindex];
+
+ if (b2_pos < a1_pos) {
+ goal = ENCODE_FAX_GOAL_PassMode;
+ break;
+ }
+ length_acc = 0;
+ /* we won't linger on this a0 anymore */
+
+ a1b1 = b1_pos-a1_pos;
+ abs_a1b1 = (a1b1 >=0)? a1b1 : -a1b1;
+ if (abs_a1b1 <= 3) {
+ goal = ENCODE_FAX_GOAL_VerticalMode;
+ }
+ else
+ goal = ENCODE_FAX_GOAL_HorizontalMode;
+ break;
+
+
+ case ENCODE_FAX_GOAL_PassMode:
+ /* pass mode is nice and simple. a0_pos = b2_pos */
+
+ rlcode = PASS_CODE;
+ nbits = PASS_CODE_BIT_LENGTH;
+
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+ /* before worrying about flushing, let's update positions */
+ if (a0_pos < 0)
+ length_acc = b2_pos;
+ else
+ length_acc += b2_pos - a0_pos;
+ /* don't count passed length twice */
+
+ a0_pos = b2_pos;
+ index = save_index;
+
+ b1_pos = b2_pos;
+ /* new b1_position will be old b2_position */
+ b1_color = ~b1_color;
+ ++aindex;
+
+ if (bitpos >=8)
+ goal = ENCODE_FAX_GOAL_Flush2DStager;
+ else {
+
+ if (a0_pos >= width) {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FindPositions;
+ }
+ }
+ break;
+
+ case ENCODE_FAX_GOAL_HorizontalMode:
+
+ rlcode = HORIZONTAL_CODE;
+ nbits = HORIZONTAL_CODE_LENGTH;
+
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+ if (bitpos < 8) {
+ goal = ENCODE_FAX_GOAL_FlushedHCode;
+ break;
+ }
+ goal = ENCODE_FAX_GOAL_FlushHCode;
+
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+
+ case ENCODE_FAX_GOAL_FlushHCode:
+
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+
+ if (bitpos >= 8) {
+ /* go around the loop again, trying to flush more */
+ break;
+ }
+ /* if here, we have flushed stager */
+
+ case ENCODE_FAX_GOAL_FlushedHCode:
+ a0a1 = a1_pos - a0_pos;
+ if (a0_pos == -1)
+ a0a1 -= 1;
+ a1a2 = a2_pos - a1_pos;
+ rl = old_rl = a0a1;
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ /* will loop through writing out the code for a0a1 */
+
+ next_goal = ENCODE_FAX_GOAL_DoneWithA0A1;
+ /* when done writing a0a1 codes, will go to DoneWithA0A1 */
+
+ /* before going on, let's set up for the next iteration */
+ a0_pos = a2_pos;
+ /* a0 skips to a2, index adjusted automatically */
+
+ b1_pos = save_b1pos;
+ b1_color = save_b1color;
+ /* it's too painful to figure out what b1 was */
+
+ aindex = save_aindex;
+ /* we don't know enough to advance b1 */
+ break;
+
+ case ENCODE_FAX_GOAL_DoneWithA0A1:
+ rl = old_rl = a1a2;
+ a0_color = ~a0_color;
+ /* here, "a0_color" represents color of next rl */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ /* will loop through writing out the code for a0a1 */
+ next_goal = ENCODE_FAX_GOAL_DoneWithA1A2;
+ /* when done writing a1a2 codes, will go to DoneWithA1A2 */
+ break;
+
+ case ENCODE_FAX_GOAL_DoneWithA1A2:
+ a0_color = ~a0_color;
+ /* restore "a0_color" to really meaning a0 color */
+ if (a0_pos >= width) {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FindPositions;
+ }
+ break;
+
+ case ENCODE_FAX_GOAL_VerticalMode:
+
+ DEDUCE_Vcode(a1b1,rlcode,nbits);
+
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+ /* before picking next state, set new a0_position and
+ point indexes into 'count' and 'above' to the right
+ place. saved indexes help a lot here.
+ */
+ a0a1 = a1_pos - a0_pos;
+ a0_pos = a1_pos;
+
+ if (a1b1 > 0) {
+ /* b1 is to the right of a1. It is possible that
+ when we set a0' = a1, b1' will be left of b1:
+
+ 0 1 2 3 4
+ b1' b1
+ O O 0 X 0
+ O X O X
+ a0 a1
+ a0'
+
+ In the example above, b1 for the original a0 at 1
+ is the X->O transition at 4. When a1 is coded, and
+ a1 becomes the new a0 (a0'), the O->X transition at
+ 3 is b1'. In other words, the progression of b1 is
+ *not* monotonic!! So we have to be careful...
+
+ The condition under which backup is necessary is
+ when b1 is 2 or 3 to the right of a1, and there
+ was a transition just before b1, right of a1. To
+ get the next position on a line, we always take
+
+ new_pos = old_pos + above[index++]
+
+ Therefore, the previous position was
+
+ old_pos = new_pos - above[index-1]
+
+ We need to back up if above[index-1] < a1b1.
+ If we incremented index twice to get to b2,
+ then we have to consider above[index-2]
+
+ */
+
+ /* things are simple if b1_pos was off the edge */
+ if (b1_pos >= width && avals>=2 && above[avals-1] < a1b1) {
+ /* if b1_pos was off the edge, above[avals-1] */
+ /* added to the previous b1 got us there. So */
+ /* we get old b1 by subtracting above[avals-1] */
+ b1_pos = width - above[avals-1];
+ aindex = avals-2;
+ b1_color = ~b1_color;
+ }
+ else if (aindex >= 1 && above[aindex-1] < a1b1) {
+ b1_pos = b1_pos - above[aindex-1];
+ /* note: we don't increment aindex after */
+ /* computing b2_pos = b1_pos + above[aindex], */
+ /* so above[aindex-1] is how we got b1_pos */
+ aindex = aindex-1;
+ /* index for element before the b1 */
+ b1_color = ~b1_color;
+ /* previous color */
+ }
+
+ }
+ else {
+ /* b1 is left of or over a1.
+
+ 0 1 2 3 4
+ b1
+ O O X 0
+ O X X X O X
+ a0 a1
+ a0'
+
+ Since the b1' for a0' must be to the right of a0'=a1,
+ b1' must be to the right of b1. However, if we set
+ our position to b2, we may go too far, so stay where
+ we are. Be coo'!
+ */
+
+ /* aindex was updated while seeking b2 */
+ }
+ a0_color = ~a0_color;
+ --index;
+ /* in code above, we made sure we always increment index */
+ /* after setting a2, even if a1 or a2 was off end of line */
+
+ if (bitpos >=8)
+ goal = ENCODE_FAX_GOAL_Flush2DStager;
+ else {
+ if (a0_pos >= width) {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FindPositions;
+ }
+ }
+ break;
+
+ case ENCODE_FAX_GOAL_Flush2DStager:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+
+ if (bitpos >= 8) {
+ /* go around the loop again, trying to flush more */
+ break;
+ }
+ /* if here, we have flushed stager to the point there is */
+ /* at most a partial byte of data left in it. */
+ if (a0_pos >= width) {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FindPositions;
+ }
+ break;
+
+ default:
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ save_state_and_return(state);
+
+ } /* end of switch(goal) in main decoding loop */
+
+ } /* end of main encoding loop */
+}
+/************************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/etiff2.c b/xc/programs/Xserver/XIE/mixie/fax/etiff2.c
new file mode 100644
index 000000000..039df3b35
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/etiff2.c
@@ -0,0 +1,403 @@
+/* $TOG: etiff2.c /main/4 1998/02/09 16:14:25 kaleb $ */
+/**** module etiff2.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ etiff2.c -- DDXIE module for encoding tiff2 format
+
+ Ben Fahy, AGE Logic, Sept 1993
+
+******************************************************************************/
+
+#include "fax.h"
+#define _TIFF2
+#include "fencode.h"
+#include "xiemd.h"
+#define FETABS_OWNER
+#include "fetabs.h"
+
+/************************************************************************/
+encode_tiff2(state)
+FaxEncodeState *state;
+{
+/* stuff exchanged with state variable */
+register int goal;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int bitpos;
+register int width;
+register int stager;
+int rl;
+register int a0_color;
+Tiff2EncodePvt *epvt;
+
+/* stuff exchanged with private state variable */
+register int index;
+register int nvals;
+register int *counts;
+register int nbits;
+int rlcode;
+int terminating;
+register int codelength;
+
+register int lines_coded=0;
+register int lines_to_code=0;
+int old_rl;
+
+ if (state == (FaxEncodeState *) NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first output strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->encoder_done = ENCODE_ERROR_StripStateNotNew;
+ return(-1);
+ }
+
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ state->strip_state = StripStateInUse;
+ }
+
+ /* or, reset bitstream for a new output strip */
+ if (state->magic_needs) {
+ if (state->strip_state == StripStateNew) {
+ state->strip_state = StripStateInUse;
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+ state->bits.started = 1;
+ }
+ else {
+ /* no new strip?? But... I *need* more data! */
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ return(-1);
+ }
+ state->magic_needs = 0;
+ }
+
+ localize_state(state);
+
+
+/*** Main Encoding Loop ***/
+ while (1) {
+
+ switch(goal) {
+
+ case ENCODE_FAX_GOAL_StartNewLine:
+ /* every new line we need to compute its runlength data */
+
+ if (lines_coded >= state->nl_tocode) {
+ /* We have read the whole input strip, need more data */
+ save_state_and_return(state);
+ }
+
+ /* get the sequence of white and black run lengths */
+ nvals = encode_runs(
+ state->i_lines[lines_coded], /* input data */
+ width, /* # of bits */
+ counts, /* where to put lengths */
+ state->radiometric, /* if 1, white is 1 */
+ width
+ );
+ if (nvals < 0) {
+ state->encoder_done = ENCODE_ERROR_EncodeRunsFailure;
+ save_state_and_return(state);
+ }
+ a0_color = WHITE;
+ index = 0;
+ a0_color = WHITE;
+
+ case ENCODE_FAX_GOAL_OutputNextRunLength:
+ rl = counts[index++];
+ old_rl = rl;
+
+ case ENCODE_FAX_GOAL_DeduceCode:
+ nbits = deduce_code(a0_color,&rl,&rlcode,&terminating);
+ /* should be a macro but for now, a function */
+
+ /* shift code over so it merges with stager contents */
+ stager |= (rlcode << (16-bitpos));
+ bitpos += nbits;
+
+ if (bitpos >=8) {
+ goal = ENCODE_FAX_GOAL_FlushStager;
+ break;
+ }
+ if (terminating) {
+ /* all done with this runlength */
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = ENCODE_FAX_GOAL_OutputNextRunLength;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* go around the loop again */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ old_rl = rl;
+ break;
+
+ case ENCODE_FAX_GOAL_FlushStager:
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* if here, we know it is safe to flush at least one byte */
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos -= 8;
+
+ if (bitpos >= 8) {
+ /* go around the loop again, trying to flush more */
+ break;
+ }
+ /* if here, we have flushed stager to the point there is */
+ /* at most a partial byte of data left in it. */
+ if (terminating) {
+ /* all done with this runlength */
+ if (index < nvals) {
+ a0_color = ~a0_color;
+ goal = ENCODE_FAX_GOAL_OutputNextRunLength;
+ break;
+ }
+ else {
+ goal = ENCODE_FAX_GOAL_FinishLine;
+ break;
+ }
+ }
+ /* not done with this runlength yet */
+ goal = ENCODE_FAX_GOAL_DeduceCode;
+ break;
+
+ case ENCODE_FAX_GOAL_FinishLine:
+ if (bitpos) {
+ /* have to flush stager */
+ if (byteptr >= endptr) {
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ /* make sure nothing bogus is happening */
+ if (bitpos > 8) {
+ state->encoder_done = ENCODE_ERROR_BadStager;
+ save_state_and_return(state);
+ }
+
+ *byteptr++ = (stager&0xff000000) >> 24;
+ stager <<= 8;
+ bitpos = 0;
+ }
+ ++lines_coded;
+ goal = ENCODE_FAX_GOAL_StartNewLine;
+ break;
+
+ default:
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ save_state_and_return(state);
+ break;
+
+ } /* end of switch(goal) in main decoding loop */
+
+ } /* end of main encoding loop */
+}
+/************************************************************************/
+int encode_runs(src,nbits,counts,white_is_one,width)
+LogInt *src;
+unsigned int *counts;
+register int nbits;
+register int white_is_one;
+register int width;
+{
+register unsigned int white_count=0,black_count=0;
+register int i,current_is_white=1;
+register int n_runs=0;
+register int total=0;
+
+register LogInt test_bit = LOGLEFT;
+ /* LOGLEFT = the logically left-most bit in a word in */
+ /* the server, we allways fill the logically left-most */
+ /* bit in a word first, the logically right-most last */
+
+/*** handle first bit differently than others ***/
+
+ if (white_is_one) {
+ for (i=0; i<nbits; ++i) {
+ if (!test_bit)
+ test_bit = LOGLEFT;
+
+ if (current_is_white) {
+ if (LOG_tstbit(src,i))
+ ++white_count;
+ else {
+ counts[n_runs++] = white_count;
+ total += white_count;
+ current_is_white = 0;
+ black_count = 1;
+ }
+ } /* end current_is_white */
+ else {
+ if (!LOG_tstbit(src,i))
+ ++black_count;
+ else {
+ counts[n_runs++] = black_count;
+ total += black_count;
+ current_is_white = 1;
+ white_count = 1;
+ }
+ } /* end current_is_not_white */
+
+ LOGRIGHT(test_bit);
+ /* go to the next-filled bit in the word */
+
+ } /* end for (i<nbits) */
+ } /* end if (white_is_one) */
+
+ else { /* white is zero */
+ for (i=0; i<nbits; ++i) {
+ if (!test_bit)
+ test_bit = LOGLEFT;
+
+ if (current_is_white) {
+ if (!LOG_tstbit(src,i))
+ ++white_count;
+ else {
+ counts[n_runs++] = white_count;
+ total += white_count;
+ current_is_white = 0;
+ black_count = 1;
+ }
+ } /* end current_is_white */
+ else {
+ if (LOG_tstbit(src,i))
+ ++black_count;
+ else {
+ counts[n_runs++] = black_count;
+ total += black_count;
+ current_is_white = 1;
+ white_count = 1;
+ }
+ } /* end current_is_not_white */
+
+ LOGRIGHT(test_bit);
+ /* go to the next-filled bit in the word */
+
+ } /* end for (i<nbits) */
+
+ } /* end else (!white_is_one) */
+
+ if (current_is_white && white_count) {
+ counts[n_runs++] = white_count;
+ total += white_count;
+ }
+ else if (!current_is_white && black_count) {
+ counts[n_runs++] = black_count;
+ total += black_count;
+ }
+ if (total != width)
+ return(-1);
+ else
+ return(n_runs);
+}
+/************************************************************************/
+int deduce_code(a0_color,rl,rlcode,terminating)
+int a0_color,*rl,*rlcode,*terminating;
+{
+int nbits;
+ShiftedCodes *table;
+
+ if (a0_color == WHITE)
+ table = ShiftedWhites;
+ else
+ table = ShiftedBlacks;
+
+ if (*rl < 0)
+ return(-1);
+
+ if (*rl <= 63) {
+ *terminating = 1;
+ *rlcode = table[*rl].code;
+ nbits = table[*rl].nbits;
+ *rl = 0;
+ }
+ else if (*rl <= 2560) {
+ *terminating = 0;
+ *rlcode = table[63 + (*rl >> 6)].code;
+ nbits = table[63 + (*rl >> 6)].nbits;
+ *rl %= 64;
+ }
+ else {
+ *terminating = 0;
+ *rlcode = table[63 + 2560/64].code;
+ nbits = table[63 + 2560/64].nbits;
+ *rl -= 2560;
+ }
+ return(nbits);
+}
+/************************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/etiffpb.c b/xc/programs/Xserver/XIE/mixie/fax/etiffpb.c
new file mode 100644
index 000000000..7b9cad7cd
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/etiffpb.c
@@ -0,0 +1,377 @@
+/* $TOG: etiffpb.c /main/5 1998/02/09 16:14:34 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module etiffpb.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994,1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ etiffpb.c -- DDXIE module for encoding TIFF PackBits format
+
+ Ben Fahy, AGE Logic, Sept 1993
+
+******************************************************************************/
+
+
+#include "fax.h"
+#define _PBits
+#include "fencode.h"
+#include "xiemd.h"
+
+/************************************************************************/
+encode_tiffpb(state)
+FaxEncodeState *state;
+{
+/* stuff exchanged with state variable */
+register int goal;
+register unsigned char *byteptr;
+register unsigned char *endptr;
+register int width;
+register int rl;
+PackBitsEncodePvt *epvt;
+
+/* stuff exchanged with private state variable */
+int index;
+int start;
+int nlits;
+int nvals;
+register int *counts;
+register int *values;
+
+
+register int lines_coded=0;
+register int lines_to_code=0;
+register int rlcode,lits_to_write;
+register int bytes_out;
+
+ if (state == (FaxEncodeState *) NULL)
+ return(-1);
+
+ /* set up initial bitstream for the very first output strip */
+ if (!state->bits.started) {
+ if (state->strip_state != StripStateNew) {
+ state->encoder_done = ENCODE_ERROR_StripStateNotNew;
+ return(-1);
+ }
+
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ state->strip_state = StripStateInUse;
+ }
+
+ /* or, reset bitstream for a new output strip */
+ if (state->magic_needs) {
+ if (state->strip_state == StripStateNew) {
+ state->strip_state = StripStateInUse;
+ state->bits.byteptr = (unsigned char *)state->strip;
+ state->bits.endptr = state->bits.byteptr + state->strip_size;
+ /* record end of output strip */
+ state->bits.bitpos = 0;
+ state->bits.started = 1;
+ }
+ else {
+ /* no new strip?? But... I *need* more data! */
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ return(-1);
+ }
+ state->magic_needs = 0;
+ }
+ localize_state(state);
+
+
+/*** Main Encoding Loop ***/
+ while (1) {
+
+ switch(goal) {
+
+ case ENCODE_PB_GOAL_StartNewLine:
+ /* every new line we need to compute its runlength data */
+
+ {
+ register unsigned char *ibptr=NULL;
+ register unsigned char *ebptr=NULL;
+ register int color0,color1, n_reps;
+
+ if (lines_coded >= state->nl_tocode) {
+ /* We have read the whole input strip, need more data */
+ save_state_and_return(state);
+ }
+
+ ibptr = (unsigned char *) state->i_lines[lines_coded];
+ ebptr = ibptr+(width+7)/8;
+
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ color0 = *ibptr++;
+#else
+ color0 = _ByteReverseTable[*ibptr++];
+#endif
+ n_reps = 1;
+ nvals = 0;
+ epvt->values[nvals] = color0;
+
+ while (ibptr < ebptr) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ color1 = *ibptr++;
+#else
+ color1 = _ByteReverseTable[*ibptr++];
+#endif
+ if (color1 == color0) ++n_reps;
+ else {
+ epvt->counts[nvals++] = n_reps;
+ color0 = color1;
+ n_reps = 1;
+ epvt->values[nvals] = color0;
+ }
+ }
+ epvt->counts[nvals++] = n_reps;
+ epvt->nvals = nvals;
+
+ }
+ /* now that we have an encoding of the line in runlengths,
+ we need to decide what we write out as R V, where R
+ is the runlength and V is the value, vs L V1 V2 ... VL
+ where Vi are individual values and L is the number of
+ literal values that follow. There isn't really any
+ advantage to coding runlengths of size 2 or less, so
+ we will only code as a runlength for runs of 3 or more.
+ */
+ index = 0; /* where we are in our list of runs and values */
+ start = 0; /* where we were when we started */
+ nlits = 0; /* number of literals we will concatenate */
+ goal = ENCODE_PB_GOAL_OutputNextRunLength;
+
+ case ENCODE_PB_GOAL_OutputNextRunLength:
+ /* starting from the current index, search for the first
+ runlength of three or more. Everything before then will
+ be encoded as a string of literals.
+ */
+
+ start = index;
+ while (index < nvals && (rl = counts[index]) < 3) {
+ nlits += rl;
+ ++index;
+ }
+
+ if (start != index) {
+ /* Note: we can never call FlushLiterals when start >= nvals,
+ because index <= nvals, and start < index if here */
+ goal = ENCODE_PB_GOAL_FlushLiterals;
+ }
+ else {
+ /* found a suitable runlength */
+ goal = ENCODE_PB_GOAL_FlushRunLength;
+ }
+ break;
+
+ case ENCODE_PB_GOAL_FlushRunLength:
+ if (!rl) {
+ state->encoder_done = ENCODE_ERROR_BadRunLength;
+ save_state_and_return(state);
+ }
+ /* Packbits represents runlengths as rl = 1 - rlcode, where */
+ /* rlcode is a negative number between -1 and -127. So we */
+ /* may have to break a number larger than 128 into multiple */
+ /* runlengths */
+ if (rl <= 128) {
+ rlcode = 1-rl; /* encode the runlength */
+ rl = 0;
+ }
+ else {
+ rlcode = -127; /* encode the maximum */
+ rl -= 128;
+ }
+ /* before writing, make sure we aren't off end of strip */
+ if ( byteptr >= endptr) {
+ goal = ENCODE_PB_GOAL_WriteCodeForRunLength;
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+
+ case ENCODE_PB_GOAL_WriteCodeForRunLength:
+ *byteptr++ = rlcode;
+
+ /* before writing, make sure we aren't off end of strip */
+ if ( byteptr >= endptr) {
+ goal = ENCODE_PB_GOAL_WriteValueForRunLength;
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+ case ENCODE_PB_GOAL_WriteValueForRunLength:
+ *byteptr++ = values[index];
+ if (!rl) {
+ if (++index >= nvals) { /* see if done with line */
+ ++lines_coded;
+ goal = ENCODE_PB_GOAL_StartNewLine;
+ }
+ else
+ goal = ENCODE_PB_GOAL_OutputNextRunLength;
+ }
+ else
+ goal = ENCODE_PB_GOAL_FlushRunLength;
+ break;
+ case ENCODE_PB_GOAL_FlushLiterals:
+ /* Packbits represents literal lengths as rl = 1 + rlcode, */
+ /* rlcode is a number between 0 and 127. So we have to break */
+ /* break numbers larger than 128 into multiple runlengths */
+ if (nlits <= 128) {
+ rlcode = nlits-1; /* encode the runlength */
+ nlits = 0;
+ }
+ else {
+ rlcode = 127; /* encode the maximum */
+ nlits -= 128;
+ }
+ rl = 1 + rlcode; /* need this for comparison later */
+ bytes_out = 0; /* ditto. bytes_out must be <= rl */
+
+ /* before writing, make sure we aren't off end of strip */
+ if ( byteptr >= endptr) {
+ goal = ENCODE_PB_GOAL_WriteNlits;
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+
+ case ENCODE_PB_GOAL_WriteNlits:
+ *byteptr++ = rlcode;
+ goal = ENCODE_PB_GOAL_WriteLiterals;
+ /* note that lits_to_write is always 1 or 2 */
+
+ case ENCODE_PB_GOAL_WriteLiterals:
+ /* this is actually a loop. 'start' gets incremented each */
+ /* time through until it is equal to 'index'. We never get */
+ /* to this point unless start < nvals, though */
+
+ lits_to_write = counts[start];
+ goal = ENCODE_PB_GOAL_WriteThisLiteral;
+
+ case ENCODE_PB_GOAL_WriteThisLiteral:
+ /* before writing, make sure we aren't off end of strip */
+ if ( byteptr >= endptr) {
+ goal = ENCODE_PB_GOAL_WriteTheLiteral;
+ state->strip_state = StripStateDone;
+ state->magic_needs = 1;
+ save_state_and_return(state);
+ }
+
+ case ENCODE_PB_GOAL_WriteTheLiteral:
+ *byteptr++ = values[start];
+ if (++bytes_out >= 128 && nlits) {
+ /* we have written the maximum amount we can */
+ /* write at a time, yet we know there are more */
+ /* to write out. */
+
+ goal = ENCODE_PB_GOAL_FlushLiterals;
+
+ /* If we need to write current value some more, */
+ /* change count so we don't write extra */
+
+ if (--lits_to_write)
+ counts[start] = lits_to_write;
+ else {
+ /* otherwise, advance position */
+ ++start;
+ }
+
+ /* note that we KNOW we have to write more literals */
+ /* so it is safe to increment 'start', which could */
+ /* only be equal to 'index' if we were done */
+
+ break;
+ }
+ else if (--lits_to_write) {
+ /* loop back and write this value again */
+ goal = ENCODE_PB_GOAL_WriteThisLiteral;
+ break;
+ }
+
+ /* If here, we are done with this literal */
+ if (++start < index) {
+ /* if other literals to write, loop back */
+ goal = ENCODE_PB_GOAL_WriteLiterals;
+ break;
+ }
+
+ /* ok, we wrote out all the literals */
+
+ if (index >= nvals) { /* see if done with line */
+ ++lines_coded;
+ goal = ENCODE_PB_GOAL_StartNewLine;
+ }
+ else
+ goal = ENCODE_PB_GOAL_OutputNextRunLength;
+ break;
+
+ default:
+ state->encoder_done = ENCODE_ERROR_BadMagic;
+ save_state_and_return(state);
+ break;
+
+ } /* end of switch(goal) in main decoding loop */
+
+ } /* end of main encoding loop */
+}
+/************************************************************************/
+
diff --git a/xc/programs/Xserver/XIE/mixie/fax/faxint.h b/xc/programs/Xserver/XIE/mixie/fax/faxint.h
new file mode 100644
index 000000000..9e3ff1dc9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/faxint.h
@@ -0,0 +1,91 @@
+/* $TOG: faxint.h /main/5 1998/02/09 16:14:46 kaleb $ */
+/**** module fax/faxint.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/faxint.h -- DDXIE internal fax definitions
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+/* this should correspond to what is in pretab.h, except for code entry */
+typedef struct _FaxTable {
+short run_length; /* run length for this code */
+char makeup; /* 1 if this code is makeup */
+unsigned char n_bits; /* how many bits this code used */
+} WhiteTable,BlackTable;
+
+typedef struct _TwoDTable {
+ char mode; /* what to do next */
+unsigned char n_bits; /* how many bits this code used */
+} TwoDTable;
+
+#ifdef FAX_TABLE_OWNER
+#include "faxtabs.h" /* initializes tables */
+#else
+extern unsigned char _ByteReverseTable[];
+extern BlackTable _BlackFaxTable[];
+extern WhiteTable _WhiteFaxTable[];
+extern TwoDTable _TwoDFaxTable[];
+#endif
+
+/**** module fax/faxint.h ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/faxtabs.c b/xc/programs/Xserver/XIE/mixie/fax/faxtabs.c
new file mode 100644
index 000000000..2cbf192f5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/faxtabs.c
@@ -0,0 +1,74 @@
+/* $TOG: faxtabs.c /main/6 1998/02/09 16:14:50 kaleb $ */
+/**** module fax/faxtabs.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/faxtabs.c -- DDXIE fax decode data
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+#include "fax.h"
+#define FAX_TABLE_OWNER
+#include "faxint.h"
+
+/**** module fax/faxtabs.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/faxtabs.h b/xc/programs/Xserver/XIE/mixie/fax/faxtabs.h
new file mode 100644
index 000000000..bf2dfc8f5
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/faxtabs.h
@@ -0,0 +1,12626 @@
+/* $TOG: faxtabs.h /main/5 1998/02/09 16:14:54 kaleb $ */
+/**** module fax/bits.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/bits.h -- DDXIE G4 fax bitstream management macros
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* faxtabs.h - generated by mktab */
+
+
+
+/* two D mode table */
+TwoDTable _TwoDFaxTable[]= {
+ /* 0 = 0 */ { 0, 8}, /* 0x00 => 0x00+(1)*/
+ /* 1 = 1 */ { 0, 0}, /* 0x00 => 0x00+(256)*/
+ /* 2 = 2 */ { 0, 7}, /* 0x01 => 0x02+(2)*/
+ /* 3 = 3 */ { 0, 7}, /* 0x01 => 0x02+(2)*/
+ /* 4 = 4 */ { 3, 7}, /* 0x02 => 0x04+(2)*/
+ /* 5 = 5 */ { 3, 7}, /* 0x02 => 0x04+(2)*/
+ /* 6 = 6 */ { 9, 7}, /* 0x03 => 0x06+(2)*/
+ /* 7 = 7 */ { 9, 7}, /* 0x03 => 0x06+(2)*/
+ /* 8 = 8 */ { 4, 6}, /* 0x02 => 0x08+(4)*/
+ /* 9 = 9 */ { 4, 6}, /* 0x02 => 0x08+(4)*/
+ /* 10 = a */ { 4, 6}, /* 0x02 => 0x08+(4)*/
+ /* 11 = b */ { 4, 6}, /* 0x02 => 0x08+(4)*/
+ /* 12 = c */ { 8, 6}, /* 0x03 => 0x0c+(4)*/
+ /* 13 = d */ { 8, 6}, /* 0x03 => 0x0c+(4)*/
+ /* 14 = e */ { 8, 6}, /* 0x03 => 0x0c+(4)*/
+ /* 15 = f */ { 8, 6}, /* 0x03 => 0x0c+(4)*/
+ /* 16 = 10 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 17 = 11 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 18 = 12 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 19 = 13 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 20 = 14 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 21 = 15 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 22 = 16 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 23 = 17 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 24 = 18 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 25 = 19 */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 26 = 1a */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 27 = 1b */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 28 = 1c */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 29 = 1d */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 30 = 1e */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 31 = 1f */ { 1, 4}, /* 0x01 => 0x10+(16)*/
+ /* 32 = 20 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 33 = 21 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 34 = 22 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 35 = 23 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 36 = 24 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 37 = 25 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 38 = 26 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 39 = 27 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 40 = 28 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 41 = 29 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 42 = 2a */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 43 = 2b */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 44 = 2c */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 45 = 2d */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 46 = 2e */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 47 = 2f */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 48 = 30 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 49 = 31 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 50 = 32 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 51 = 33 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 52 = 34 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 53 = 35 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 54 = 36 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 55 = 37 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 56 = 38 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 57 = 39 */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 58 = 3a */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 59 = 3b */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 60 = 3c */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 61 = 3d */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 62 = 3e */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 63 = 3f */ { 2, 3}, /* 0x01 => 0x20+(32)*/
+ /* 64 = 40 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 65 = 41 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 66 = 42 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 67 = 43 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 68 = 44 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 69 = 45 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 70 = 46 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 71 = 47 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 72 = 48 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 73 = 49 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 74 = 4a */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 75 = 4b */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 76 = 4c */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 77 = 4d */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 78 = 4e */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 79 = 4f */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 80 = 50 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 81 = 51 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 82 = 52 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 83 = 53 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 84 = 54 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 85 = 55 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 86 = 56 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 87 = 57 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 88 = 58 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 89 = 59 */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 90 = 5a */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 91 = 5b */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 92 = 5c */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 93 = 5d */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 94 = 5e */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 95 = 5f */ { 5, 3}, /* 0x02 => 0x40+(32)*/
+ /* 96 = 60 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 97 = 61 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 98 = 62 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 99 = 63 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 100 = 64 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 101 = 65 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 102 = 66 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 103 = 67 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 104 = 68 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 105 = 69 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 106 = 6a */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 107 = 6b */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 108 = 6c */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 109 = 6d */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 110 = 6e */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 111 = 6f */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 112 = 70 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 113 = 71 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 114 = 72 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 115 = 73 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 116 = 74 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 117 = 75 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 118 = 76 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 119 = 77 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 120 = 78 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 121 = 79 */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 122 = 7a */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 123 = 7b */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 124 = 7c */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 125 = 7d */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 126 = 7e */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 127 = 7f */ { 7, 3}, /* 0x03 => 0x60+(32)*/
+ /* 128 = 80 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 129 = 81 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 130 = 82 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 131 = 83 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 132 = 84 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 133 = 85 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 134 = 86 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 135 = 87 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 136 = 88 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 137 = 89 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 138 = 8a */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 139 = 8b */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 140 = 8c */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 141 = 8d */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 142 = 8e */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 143 = 8f */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 144 = 90 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 145 = 91 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 146 = 92 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 147 = 93 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 148 = 94 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 149 = 95 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 150 = 96 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 151 = 97 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 152 = 98 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 153 = 99 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 154 = 9a */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 155 = 9b */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 156 = 9c */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 157 = 9d */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 158 = 9e */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 159 = 9f */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 160 = a0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 161 = a1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 162 = a2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 163 = a3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 164 = a4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 165 = a5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 166 = a6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 167 = a7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 168 = a8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 169 = a9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 170 = aa */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 171 = ab */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 172 = ac */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 173 = ad */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 174 = ae */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 175 = af */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 176 = b0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 177 = b1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 178 = b2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 179 = b3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 180 = b4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 181 = b5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 182 = b6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 183 = b7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 184 = b8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 185 = b9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 186 = ba */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 187 = bb */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 188 = bc */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 189 = bd */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 190 = be */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 191 = bf */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 192 = c0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 193 = c1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 194 = c2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 195 = c3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 196 = c4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 197 = c5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 198 = c6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 199 = c7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 200 = c8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 201 = c9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 202 = ca */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 203 = cb */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 204 = cc */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 205 = cd */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 206 = ce */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 207 = cf */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 208 = d0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 209 = d1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 210 = d2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 211 = d3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 212 = d4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 213 = d5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 214 = d6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 215 = d7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 216 = d8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 217 = d9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 218 = da */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 219 = db */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 220 = dc */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 221 = dd */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 222 = de */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 223 = df */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 224 = e0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 225 = e1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 226 = e2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 227 = e3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 228 = e4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 229 = e5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 230 = e6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 231 = e7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 232 = e8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 233 = e9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 234 = ea */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 235 = eb */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 236 = ec */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 237 = ed */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 238 = ee */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 239 = ef */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 240 = f0 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 241 = f1 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 242 = f2 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 243 = f3 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 244 = f4 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 245 = f5 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 246 = f6 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 247 = f7 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 248 = f8 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 249 = f9 */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 250 = fa */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 251 = fb */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 252 = fc */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 253 = fd */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 254 = fe */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+ /* 255 = ff */ { 6, 1}, /* 0x01 => 0x80+(128)*/
+};
+/* white table */
+WhiteTable _WhiteFaxTable[] = {
+ /* 0 = 0 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 1 = 1 */ {-2, 0, 12}, /* 0x0001 => 0x0001+(1)*/
+ /* 2 = 2 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 3 = 3 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 4 = 4 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 5 = 5 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 6 = 6 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 7 = 7 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 8 = 8 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 9 = 9 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 10 = a */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 11 = b */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 12 = c */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 13 = d */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 14 = e */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 15 = f */ {-1, 0, 0}, /* 0x0000 => 0x0000+(4096)*/
+ /* 16 = 10 */ {1792, 1, 11}, /* 0x0008 => 0x0010+(2)*/
+ /* 17 = 11 */ {1792, 1, 11}, /* 0x0008 => 0x0010+(2)*/
+ /* 18 = 12 */ {1984, 1, 12}, /* 0x0012 => 0x0012+(1)*/
+ /* 19 = 13 */ {2048, 1, 12}, /* 0x0013 => 0x0013+(1)*/
+ /* 20 = 14 */ {2112, 1, 12}, /* 0x0014 => 0x0014+(1)*/
+ /* 21 = 15 */ {2176, 1, 12}, /* 0x0015 => 0x0015+(1)*/
+ /* 22 = 16 */ {2240, 1, 12}, /* 0x0016 => 0x0016+(1)*/
+ /* 23 = 17 */ {2304, 1, 12}, /* 0x0017 => 0x0017+(1)*/
+ /* 24 = 18 */ {1856, 1, 11}, /* 0x000c => 0x0018+(2)*/
+ /* 25 = 19 */ {1856, 1, 11}, /* 0x000c => 0x0018+(2)*/
+ /* 26 = 1a */ {1920, 1, 11}, /* 0x000d => 0x001a+(2)*/
+ /* 27 = 1b */ {1920, 1, 11}, /* 0x000d => 0x001a+(2)*/
+ /* 28 = 1c */ {2368, 1, 12}, /* 0x001c => 0x001c+(1)*/
+ /* 29 = 1d */ {2432, 1, 12}, /* 0x001d => 0x001d+(1)*/
+ /* 30 = 1e */ {2496, 1, 12}, /* 0x001e => 0x001e+(1)*/
+ /* 31 = 1f */ {2560, 1, 12}, /* 0x001f => 0x001f+(1)*/
+ /* 32 = 20 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 33 = 21 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 34 = 22 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 35 = 23 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 36 = 24 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 37 = 25 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 38 = 26 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 39 = 27 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 40 = 28 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 41 = 29 */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 42 = 2a */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 43 = 2b */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 44 = 2c */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 45 = 2d */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 46 = 2e */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 47 = 2f */ {29, 0, 8}, /* 0x0002 => 0x0020+(16)*/
+ /* 48 = 30 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 49 = 31 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 50 = 32 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 51 = 33 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 52 = 34 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 53 = 35 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 54 = 36 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 55 = 37 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 56 = 38 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 57 = 39 */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 58 = 3a */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 59 = 3b */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 60 = 3c */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 61 = 3d */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 62 = 3e */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 63 = 3f */ {30, 0, 8}, /* 0x0003 => 0x0030+(16)*/
+ /* 64 = 40 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 65 = 41 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 66 = 42 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 67 = 43 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 68 = 44 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 69 = 45 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 70 = 46 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 71 = 47 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 72 = 48 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 73 = 49 */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 74 = 4a */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 75 = 4b */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 76 = 4c */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 77 = 4d */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 78 = 4e */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 79 = 4f */ {45, 0, 8}, /* 0x0004 => 0x0040+(16)*/
+ /* 80 = 50 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 81 = 51 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 82 = 52 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 83 = 53 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 84 = 54 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 85 = 55 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 86 = 56 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 87 = 57 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 88 = 58 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 89 = 59 */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 90 = 5a */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 91 = 5b */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 92 = 5c */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 93 = 5d */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 94 = 5e */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 95 = 5f */ {46, 0, 8}, /* 0x0005 => 0x0050+(16)*/
+ /* 96 = 60 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 97 = 61 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 98 = 62 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 99 = 63 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 100 = 64 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 101 = 65 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 102 = 66 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 103 = 67 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 104 = 68 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 105 = 69 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 106 = 6a */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 107 = 6b */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 108 = 6c */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 109 = 6d */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 110 = 6e */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 111 = 6f */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 112 = 70 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 113 = 71 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 114 = 72 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 115 = 73 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 116 = 74 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 117 = 75 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 118 = 76 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 119 = 77 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 120 = 78 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 121 = 79 */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 122 = 7a */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 123 = 7b */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 124 = 7c */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 125 = 7d */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 126 = 7e */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 127 = 7f */ {22, 0, 7}, /* 0x0003 => 0x0060+(32)*/
+ /* 128 = 80 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 129 = 81 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 130 = 82 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 131 = 83 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 132 = 84 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 133 = 85 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 134 = 86 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 135 = 87 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 136 = 88 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 137 = 89 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 138 = 8a */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 139 = 8b */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 140 = 8c */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 141 = 8d */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 142 = 8e */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 143 = 8f */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 144 = 90 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 145 = 91 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 146 = 92 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 147 = 93 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 148 = 94 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 149 = 95 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 150 = 96 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 151 = 97 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 152 = 98 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 153 = 99 */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 154 = 9a */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 155 = 9b */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 156 = 9c */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 157 = 9d */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 158 = 9e */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 159 = 9f */ {23, 0, 7}, /* 0x0004 => 0x0080+(32)*/
+ /* 160 = a0 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 161 = a1 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 162 = a2 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 163 = a3 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 164 = a4 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 165 = a5 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 166 = a6 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 167 = a7 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 168 = a8 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 169 = a9 */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 170 = aa */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 171 = ab */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 172 = ac */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 173 = ad */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 174 = ae */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 175 = af */ {47, 0, 8}, /* 0x000a => 0x00a0+(16)*/
+ /* 176 = b0 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 177 = b1 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 178 = b2 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 179 = b3 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 180 = b4 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 181 = b5 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 182 = b6 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 183 = b7 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 184 = b8 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 185 = b9 */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 186 = ba */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 187 = bb */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 188 = bc */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 189 = bd */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 190 = be */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 191 = bf */ {48, 0, 8}, /* 0x000b => 0x00b0+(16)*/
+ /* 192 = c0 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 193 = c1 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 194 = c2 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 195 = c3 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 196 = c4 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 197 = c5 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 198 = c6 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 199 = c7 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 200 = c8 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 201 = c9 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 202 = ca */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 203 = cb */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 204 = cc */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 205 = cd */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 206 = ce */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 207 = cf */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 208 = d0 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 209 = d1 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 210 = d2 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 211 = d3 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 212 = d4 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 213 = d5 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 214 = d6 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 215 = d7 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 216 = d8 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 217 = d9 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 218 = da */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 219 = db */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 220 = dc */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 221 = dd */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 222 = de */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 223 = df */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 224 = e0 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 225 = e1 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 226 = e2 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 227 = e3 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 228 = e4 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 229 = e5 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 230 = e6 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 231 = e7 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 232 = e8 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 233 = e9 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 234 = ea */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 235 = eb */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 236 = ec */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 237 = ed */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 238 = ee */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 239 = ef */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 240 = f0 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 241 = f1 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 242 = f2 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 243 = f3 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 244 = f4 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 245 = f5 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 246 = f6 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 247 = f7 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 248 = f8 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 249 = f9 */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 250 = fa */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 251 = fb */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 252 = fc */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 253 = fd */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 254 = fe */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 255 = ff */ {13, 0, 6}, /* 0x0003 => 0x00c0+(64)*/
+ /* 256 = 100 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 257 = 101 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 258 = 102 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 259 = 103 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 260 = 104 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 261 = 105 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 262 = 106 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 263 = 107 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 264 = 108 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 265 = 109 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 266 = 10a */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 267 = 10b */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 268 = 10c */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 269 = 10d */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 270 = 10e */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 271 = 10f */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 272 = 110 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 273 = 111 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 274 = 112 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 275 = 113 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 276 = 114 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 277 = 115 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 278 = 116 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 279 = 117 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 280 = 118 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 281 = 119 */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 282 = 11a */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 283 = 11b */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 284 = 11c */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 285 = 11d */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 286 = 11e */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 287 = 11f */ {20, 0, 7}, /* 0x0008 => 0x0100+(32)*/
+ /* 288 = 120 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 289 = 121 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 290 = 122 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 291 = 123 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 292 = 124 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 293 = 125 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 294 = 126 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 295 = 127 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 296 = 128 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 297 = 129 */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 298 = 12a */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 299 = 12b */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 300 = 12c */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 301 = 12d */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 302 = 12e */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 303 = 12f */ {33, 0, 8}, /* 0x0012 => 0x0120+(16)*/
+ /* 304 = 130 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 305 = 131 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 306 = 132 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 307 = 133 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 308 = 134 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 309 = 135 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 310 = 136 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 311 = 137 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 312 = 138 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 313 = 139 */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 314 = 13a */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 315 = 13b */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 316 = 13c */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 317 = 13d */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 318 = 13e */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 319 = 13f */ {34, 0, 8}, /* 0x0013 => 0x0130+(16)*/
+ /* 320 = 140 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 321 = 141 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 322 = 142 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 323 = 143 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 324 = 144 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 325 = 145 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 326 = 146 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 327 = 147 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 328 = 148 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 329 = 149 */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 330 = 14a */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 331 = 14b */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 332 = 14c */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 333 = 14d */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 334 = 14e */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 335 = 14f */ {35, 0, 8}, /* 0x0014 => 0x0140+(16)*/
+ /* 336 = 150 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 337 = 151 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 338 = 152 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 339 = 153 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 340 = 154 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 341 = 155 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 342 = 156 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 343 = 157 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 344 = 158 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 345 = 159 */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 346 = 15a */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 347 = 15b */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 348 = 15c */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 349 = 15d */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 350 = 15e */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 351 = 15f */ {36, 0, 8}, /* 0x0015 => 0x0150+(16)*/
+ /* 352 = 160 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 353 = 161 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 354 = 162 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 355 = 163 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 356 = 164 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 357 = 165 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 358 = 166 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 359 = 167 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 360 = 168 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 361 = 169 */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 362 = 16a */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 363 = 16b */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 364 = 16c */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 365 = 16d */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 366 = 16e */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 367 = 16f */ {37, 0, 8}, /* 0x0016 => 0x0160+(16)*/
+ /* 368 = 170 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 369 = 171 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 370 = 172 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 371 = 173 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 372 = 174 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 373 = 175 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 374 = 176 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 375 = 177 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 376 = 178 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 377 = 179 */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 378 = 17a */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 379 = 17b */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 380 = 17c */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 381 = 17d */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 382 = 17e */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 383 = 17f */ {38, 0, 8}, /* 0x0017 => 0x0170+(16)*/
+ /* 384 = 180 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 385 = 181 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 386 = 182 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 387 = 183 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 388 = 184 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 389 = 185 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 390 = 186 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 391 = 187 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 392 = 188 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 393 = 189 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 394 = 18a */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 395 = 18b */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 396 = 18c */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 397 = 18d */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 398 = 18e */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 399 = 18f */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 400 = 190 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 401 = 191 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 402 = 192 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 403 = 193 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 404 = 194 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 405 = 195 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 406 = 196 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 407 = 197 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 408 = 198 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 409 = 199 */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 410 = 19a */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 411 = 19b */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 412 = 19c */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 413 = 19d */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 414 = 19e */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 415 = 19f */ {19, 0, 7}, /* 0x000c => 0x0180+(32)*/
+ /* 416 = 1a0 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 417 = 1a1 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 418 = 1a2 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 419 = 1a3 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 420 = 1a4 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 421 = 1a5 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 422 = 1a6 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 423 = 1a7 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 424 = 1a8 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 425 = 1a9 */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 426 = 1aa */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 427 = 1ab */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 428 = 1ac */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 429 = 1ad */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 430 = 1ae */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 431 = 1af */ {31, 0, 8}, /* 0x001a => 0x01a0+(16)*/
+ /* 432 = 1b0 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 433 = 1b1 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 434 = 1b2 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 435 = 1b3 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 436 = 1b4 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 437 = 1b5 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 438 = 1b6 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 439 = 1b7 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 440 = 1b8 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 441 = 1b9 */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 442 = 1ba */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 443 = 1bb */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 444 = 1bc */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 445 = 1bd */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 446 = 1be */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 447 = 1bf */ {32, 0, 8}, /* 0x001b => 0x01b0+(16)*/
+ /* 448 = 1c0 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 449 = 1c1 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 450 = 1c2 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 451 = 1c3 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 452 = 1c4 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 453 = 1c5 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 454 = 1c6 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 455 = 1c7 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 456 = 1c8 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 457 = 1c9 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 458 = 1ca */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 459 = 1cb */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 460 = 1cc */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 461 = 1cd */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 462 = 1ce */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 463 = 1cf */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 464 = 1d0 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 465 = 1d1 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 466 = 1d2 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 467 = 1d3 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 468 = 1d4 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 469 = 1d5 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 470 = 1d6 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 471 = 1d7 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 472 = 1d8 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 473 = 1d9 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 474 = 1da */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 475 = 1db */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 476 = 1dc */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 477 = 1dd */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 478 = 1de */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 479 = 1df */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 480 = 1e0 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 481 = 1e1 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 482 = 1e2 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 483 = 1e3 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 484 = 1e4 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 485 = 1e5 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 486 = 1e6 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 487 = 1e7 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 488 = 1e8 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 489 = 1e9 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 490 = 1ea */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 491 = 1eb */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 492 = 1ec */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 493 = 1ed */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 494 = 1ee */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 495 = 1ef */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 496 = 1f0 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 497 = 1f1 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 498 = 1f2 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 499 = 1f3 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 500 = 1f4 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 501 = 1f5 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 502 = 1f6 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 503 = 1f7 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 504 = 1f8 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 505 = 1f9 */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 506 = 1fa */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 507 = 1fb */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 508 = 1fc */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 509 = 1fd */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 510 = 1fe */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 511 = 1ff */ {1, 0, 6}, /* 0x0007 => 0x01c0+(64)*/
+ /* 512 = 200 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 513 = 201 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 514 = 202 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 515 = 203 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 516 = 204 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 517 = 205 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 518 = 206 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 519 = 207 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 520 = 208 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 521 = 209 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 522 = 20a */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 523 = 20b */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 524 = 20c */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 525 = 20d */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 526 = 20e */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 527 = 20f */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 528 = 210 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 529 = 211 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 530 = 212 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 531 = 213 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 532 = 214 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 533 = 215 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 534 = 216 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 535 = 217 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 536 = 218 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 537 = 219 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 538 = 21a */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 539 = 21b */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 540 = 21c */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 541 = 21d */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 542 = 21e */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 543 = 21f */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 544 = 220 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 545 = 221 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 546 = 222 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 547 = 223 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 548 = 224 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 549 = 225 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 550 = 226 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 551 = 227 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 552 = 228 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 553 = 229 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 554 = 22a */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 555 = 22b */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 556 = 22c */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 557 = 22d */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 558 = 22e */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 559 = 22f */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 560 = 230 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 561 = 231 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 562 = 232 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 563 = 233 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 564 = 234 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 565 = 235 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 566 = 236 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 567 = 237 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 568 = 238 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 569 = 239 */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 570 = 23a */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 571 = 23b */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 572 = 23c */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 573 = 23d */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 574 = 23e */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 575 = 23f */ {12, 0, 6}, /* 0x0008 => 0x0200+(64)*/
+ /* 576 = 240 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 577 = 241 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 578 = 242 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 579 = 243 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 580 = 244 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 581 = 245 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 582 = 246 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 583 = 247 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 584 = 248 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 585 = 249 */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 586 = 24a */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 587 = 24b */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 588 = 24c */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 589 = 24d */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 590 = 24e */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 591 = 24f */ {53, 0, 8}, /* 0x0024 => 0x0240+(16)*/
+ /* 592 = 250 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 593 = 251 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 594 = 252 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 595 = 253 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 596 = 254 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 597 = 255 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 598 = 256 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 599 = 257 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 600 = 258 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 601 = 259 */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 602 = 25a */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 603 = 25b */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 604 = 25c */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 605 = 25d */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 606 = 25e */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 607 = 25f */ {54, 0, 8}, /* 0x0025 => 0x0250+(16)*/
+ /* 608 = 260 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 609 = 261 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 610 = 262 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 611 = 263 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 612 = 264 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 613 = 265 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 614 = 266 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 615 = 267 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 616 = 268 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 617 = 269 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 618 = 26a */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 619 = 26b */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 620 = 26c */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 621 = 26d */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 622 = 26e */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 623 = 26f */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 624 = 270 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 625 = 271 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 626 = 272 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 627 = 273 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 628 = 274 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 629 = 275 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 630 = 276 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 631 = 277 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 632 = 278 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 633 = 279 */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 634 = 27a */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 635 = 27b */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 636 = 27c */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 637 = 27d */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 638 = 27e */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 639 = 27f */ {26, 0, 7}, /* 0x0013 => 0x0260+(32)*/
+ /* 640 = 280 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 641 = 281 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 642 = 282 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 643 = 283 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 644 = 284 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 645 = 285 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 646 = 286 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 647 = 287 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 648 = 288 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 649 = 289 */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 650 = 28a */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 651 = 28b */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 652 = 28c */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 653 = 28d */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 654 = 28e */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 655 = 28f */ {39, 0, 8}, /* 0x0028 => 0x0280+(16)*/
+ /* 656 = 290 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 657 = 291 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 658 = 292 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 659 = 293 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 660 = 294 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 661 = 295 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 662 = 296 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 663 = 297 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 664 = 298 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 665 = 299 */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 666 = 29a */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 667 = 29b */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 668 = 29c */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 669 = 29d */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 670 = 29e */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 671 = 29f */ {40, 0, 8}, /* 0x0029 => 0x0290+(16)*/
+ /* 672 = 2a0 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 673 = 2a1 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 674 = 2a2 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 675 = 2a3 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 676 = 2a4 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 677 = 2a5 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 678 = 2a6 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 679 = 2a7 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 680 = 2a8 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 681 = 2a9 */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 682 = 2aa */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 683 = 2ab */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 684 = 2ac */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 685 = 2ad */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 686 = 2ae */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 687 = 2af */ {41, 0, 8}, /* 0x002a => 0x02a0+(16)*/
+ /* 688 = 2b0 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 689 = 2b1 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 690 = 2b2 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 691 = 2b3 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 692 = 2b4 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 693 = 2b5 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 694 = 2b6 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 695 = 2b7 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 696 = 2b8 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 697 = 2b9 */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 698 = 2ba */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 699 = 2bb */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 700 = 2bc */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 701 = 2bd */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 702 = 2be */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 703 = 2bf */ {42, 0, 8}, /* 0x002b => 0x02b0+(16)*/
+ /* 704 = 2c0 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 705 = 2c1 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 706 = 2c2 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 707 = 2c3 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 708 = 2c4 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 709 = 2c5 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 710 = 2c6 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 711 = 2c7 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 712 = 2c8 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 713 = 2c9 */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 714 = 2ca */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 715 = 2cb */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 716 = 2cc */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 717 = 2cd */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 718 = 2ce */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 719 = 2cf */ {43, 0, 8}, /* 0x002c => 0x02c0+(16)*/
+ /* 720 = 2d0 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 721 = 2d1 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 722 = 2d2 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 723 = 2d3 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 724 = 2d4 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 725 = 2d5 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 726 = 2d6 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 727 = 2d7 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 728 = 2d8 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 729 = 2d9 */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 730 = 2da */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 731 = 2db */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 732 = 2dc */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 733 = 2dd */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 734 = 2de */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 735 = 2df */ {44, 0, 8}, /* 0x002d => 0x02d0+(16)*/
+ /* 736 = 2e0 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 737 = 2e1 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 738 = 2e2 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 739 = 2e3 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 740 = 2e4 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 741 = 2e5 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 742 = 2e6 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 743 = 2e7 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 744 = 2e8 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 745 = 2e9 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 746 = 2ea */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 747 = 2eb */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 748 = 2ec */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 749 = 2ed */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 750 = 2ee */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 751 = 2ef */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 752 = 2f0 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 753 = 2f1 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 754 = 2f2 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 755 = 2f3 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 756 = 2f4 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 757 = 2f5 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 758 = 2f6 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 759 = 2f7 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 760 = 2f8 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 761 = 2f9 */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 762 = 2fa */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 763 = 2fb */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 764 = 2fc */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 765 = 2fd */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 766 = 2fe */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 767 = 2ff */ {21, 0, 7}, /* 0x0017 => 0x02e0+(32)*/
+ /* 768 = 300 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 769 = 301 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 770 = 302 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 771 = 303 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 772 = 304 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 773 = 305 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 774 = 306 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 775 = 307 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 776 = 308 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 777 = 309 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 778 = 30a */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 779 = 30b */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 780 = 30c */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 781 = 30d */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 782 = 30e */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 783 = 30f */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 784 = 310 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 785 = 311 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 786 = 312 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 787 = 313 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 788 = 314 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 789 = 315 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 790 = 316 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 791 = 317 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 792 = 318 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 793 = 319 */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 794 = 31a */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 795 = 31b */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 796 = 31c */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 797 = 31d */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 798 = 31e */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 799 = 31f */ {28, 0, 7}, /* 0x0018 => 0x0300+(32)*/
+ /* 800 = 320 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 801 = 321 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 802 = 322 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 803 = 323 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 804 = 324 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 805 = 325 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 806 = 326 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 807 = 327 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 808 = 328 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 809 = 329 */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 810 = 32a */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 811 = 32b */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 812 = 32c */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 813 = 32d */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 814 = 32e */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 815 = 32f */ {61, 0, 8}, /* 0x0032 => 0x0320+(16)*/
+ /* 816 = 330 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 817 = 331 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 818 = 332 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 819 = 333 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 820 = 334 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 821 = 335 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 822 = 336 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 823 = 337 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 824 = 338 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 825 = 339 */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 826 = 33a */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 827 = 33b */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 828 = 33c */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 829 = 33d */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 830 = 33e */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 831 = 33f */ {62, 0, 8}, /* 0x0033 => 0x0330+(16)*/
+ /* 832 = 340 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 833 = 341 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 834 = 342 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 835 = 343 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 836 = 344 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 837 = 345 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 838 = 346 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 839 = 347 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 840 = 348 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 841 = 349 */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 842 = 34a */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 843 = 34b */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 844 = 34c */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 845 = 34d */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 846 = 34e */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 847 = 34f */ {63, 0, 8}, /* 0x0034 => 0x0340+(16)*/
+ /* 848 = 350 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 849 = 351 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 850 = 352 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 851 = 353 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 852 = 354 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 853 = 355 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 854 = 356 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 855 = 357 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 856 = 358 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 857 = 359 */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 858 = 35a */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 859 = 35b */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 860 = 35c */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 861 = 35d */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 862 = 35e */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 863 = 35f */ {0, 0, 8}, /* 0x0035 => 0x0350+(16)*/
+ /* 864 = 360 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 865 = 361 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 866 = 362 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 867 = 363 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 868 = 364 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 869 = 365 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 870 = 366 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 871 = 367 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 872 = 368 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 873 = 369 */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 874 = 36a */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 875 = 36b */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 876 = 36c */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 877 = 36d */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 878 = 36e */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 879 = 36f */ {320, 1, 8}, /* 0x0036 => 0x0360+(16)*/
+ /* 880 = 370 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 881 = 371 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 882 = 372 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 883 = 373 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 884 = 374 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 885 = 375 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 886 = 376 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 887 = 377 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 888 = 378 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 889 = 379 */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 890 = 37a */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 891 = 37b */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 892 = 37c */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 893 = 37d */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 894 = 37e */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 895 = 37f */ {384, 1, 8}, /* 0x0037 => 0x0370+(16)*/
+ /* 896 = 380 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 897 = 381 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 898 = 382 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 899 = 383 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 900 = 384 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 901 = 385 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 902 = 386 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 903 = 387 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 904 = 388 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 905 = 389 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 906 = 38a */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 907 = 38b */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 908 = 38c */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 909 = 38d */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 910 = 38e */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 911 = 38f */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 912 = 390 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 913 = 391 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 914 = 392 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 915 = 393 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 916 = 394 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 917 = 395 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 918 = 396 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 919 = 397 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 920 = 398 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 921 = 399 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 922 = 39a */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 923 = 39b */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 924 = 39c */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 925 = 39d */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 926 = 39e */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 927 = 39f */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 928 = 3a0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 929 = 3a1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 930 = 3a2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 931 = 3a3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 932 = 3a4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 933 = 3a5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 934 = 3a6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 935 = 3a7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 936 = 3a8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 937 = 3a9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 938 = 3aa */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 939 = 3ab */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 940 = 3ac */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 941 = 3ad */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 942 = 3ae */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 943 = 3af */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 944 = 3b0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 945 = 3b1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 946 = 3b2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 947 = 3b3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 948 = 3b4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 949 = 3b5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 950 = 3b6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 951 = 3b7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 952 = 3b8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 953 = 3b9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 954 = 3ba */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 955 = 3bb */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 956 = 3bc */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 957 = 3bd */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 958 = 3be */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 959 = 3bf */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 960 = 3c0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 961 = 3c1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 962 = 3c2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 963 = 3c3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 964 = 3c4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 965 = 3c5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 966 = 3c6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 967 = 3c7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 968 = 3c8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 969 = 3c9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 970 = 3ca */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 971 = 3cb */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 972 = 3cc */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 973 = 3cd */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 974 = 3ce */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 975 = 3cf */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 976 = 3d0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 977 = 3d1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 978 = 3d2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 979 = 3d3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 980 = 3d4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 981 = 3d5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 982 = 3d6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 983 = 3d7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 984 = 3d8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 985 = 3d9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 986 = 3da */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 987 = 3db */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 988 = 3dc */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 989 = 3dd */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 990 = 3de */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 991 = 3df */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 992 = 3e0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 993 = 3e1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 994 = 3e2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 995 = 3e3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 996 = 3e4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 997 = 3e5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 998 = 3e6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 999 = 3e7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1000 = 3e8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1001 = 3e9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1002 = 3ea */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1003 = 3eb */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1004 = 3ec */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1005 = 3ed */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1006 = 3ee */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1007 = 3ef */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1008 = 3f0 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1009 = 3f1 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1010 = 3f2 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1011 = 3f3 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1012 = 3f4 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1013 = 3f5 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1014 = 3f6 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1015 = 3f7 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1016 = 3f8 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1017 = 3f9 */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1018 = 3fa */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1019 = 3fb */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1020 = 3fc */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1021 = 3fd */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1022 = 3fe */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1023 = 3ff */ {10, 0, 5}, /* 0x0007 => 0x0380+(128)*/
+ /* 1024 = 400 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1025 = 401 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1026 = 402 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1027 = 403 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1028 = 404 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1029 = 405 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1030 = 406 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1031 = 407 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1032 = 408 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1033 = 409 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1034 = 40a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1035 = 40b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1036 = 40c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1037 = 40d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1038 = 40e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1039 = 40f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1040 = 410 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1041 = 411 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1042 = 412 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1043 = 413 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1044 = 414 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1045 = 415 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1046 = 416 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1047 = 417 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1048 = 418 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1049 = 419 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1050 = 41a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1051 = 41b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1052 = 41c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1053 = 41d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1054 = 41e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1055 = 41f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1056 = 420 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1057 = 421 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1058 = 422 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1059 = 423 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1060 = 424 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1061 = 425 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1062 = 426 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1063 = 427 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1064 = 428 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1065 = 429 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1066 = 42a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1067 = 42b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1068 = 42c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1069 = 42d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1070 = 42e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1071 = 42f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1072 = 430 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1073 = 431 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1074 = 432 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1075 = 433 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1076 = 434 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1077 = 435 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1078 = 436 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1079 = 437 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1080 = 438 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1081 = 439 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1082 = 43a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1083 = 43b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1084 = 43c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1085 = 43d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1086 = 43e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1087 = 43f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1088 = 440 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1089 = 441 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1090 = 442 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1091 = 443 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1092 = 444 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1093 = 445 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1094 = 446 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1095 = 447 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1096 = 448 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1097 = 449 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1098 = 44a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1099 = 44b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1100 = 44c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1101 = 44d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1102 = 44e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1103 = 44f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1104 = 450 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1105 = 451 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1106 = 452 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1107 = 453 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1108 = 454 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1109 = 455 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1110 = 456 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1111 = 457 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1112 = 458 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1113 = 459 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1114 = 45a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1115 = 45b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1116 = 45c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1117 = 45d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1118 = 45e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1119 = 45f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1120 = 460 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1121 = 461 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1122 = 462 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1123 = 463 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1124 = 464 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1125 = 465 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1126 = 466 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1127 = 467 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1128 = 468 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1129 = 469 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1130 = 46a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1131 = 46b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1132 = 46c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1133 = 46d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1134 = 46e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1135 = 46f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1136 = 470 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1137 = 471 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1138 = 472 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1139 = 473 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1140 = 474 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1141 = 475 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1142 = 476 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1143 = 477 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1144 = 478 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1145 = 479 */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1146 = 47a */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1147 = 47b */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1148 = 47c */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1149 = 47d */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1150 = 47e */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1151 = 47f */ {11, 0, 5}, /* 0x0008 => 0x0400+(128)*/
+ /* 1152 = 480 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1153 = 481 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1154 = 482 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1155 = 483 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1156 = 484 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1157 = 485 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1158 = 486 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1159 = 487 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1160 = 488 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1161 = 489 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1162 = 48a */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1163 = 48b */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1164 = 48c */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1165 = 48d */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1166 = 48e */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1167 = 48f */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1168 = 490 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1169 = 491 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1170 = 492 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1171 = 493 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1172 = 494 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1173 = 495 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1174 = 496 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1175 = 497 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1176 = 498 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1177 = 499 */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1178 = 49a */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1179 = 49b */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1180 = 49c */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1181 = 49d */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1182 = 49e */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1183 = 49f */ {27, 0, 7}, /* 0x0024 => 0x0480+(32)*/
+ /* 1184 = 4a0 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1185 = 4a1 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1186 = 4a2 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1187 = 4a3 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1188 = 4a4 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1189 = 4a5 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1190 = 4a6 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1191 = 4a7 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1192 = 4a8 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1193 = 4a9 */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1194 = 4aa */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1195 = 4ab */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1196 = 4ac */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1197 = 4ad */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1198 = 4ae */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1199 = 4af */ {59, 0, 8}, /* 0x004a => 0x04a0+(16)*/
+ /* 1200 = 4b0 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1201 = 4b1 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1202 = 4b2 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1203 = 4b3 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1204 = 4b4 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1205 = 4b5 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1206 = 4b6 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1207 = 4b7 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1208 = 4b8 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1209 = 4b9 */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1210 = 4ba */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1211 = 4bb */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1212 = 4bc */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1213 = 4bd */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1214 = 4be */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1215 = 4bf */ {60, 0, 8}, /* 0x004b => 0x04b0+(16)*/
+ /* 1216 = 4c0 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1217 = 4c1 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1218 = 4c2 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1219 = 4c3 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1220 = 4c4 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1221 = 4c5 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1222 = 4c6 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1223 = 4c7 */ {1472, 1, 9}, /* 0x0098 => 0x04c0+(8)*/
+ /* 1224 = 4c8 */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1225 = 4c9 */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1226 = 4ca */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1227 = 4cb */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1228 = 4cc */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1229 = 4cd */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1230 = 4ce */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1231 = 4cf */ {1536, 1, 9}, /* 0x0099 => 0x04c8+(8)*/
+ /* 1232 = 4d0 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1233 = 4d1 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1234 = 4d2 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1235 = 4d3 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1236 = 4d4 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1237 = 4d5 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1238 = 4d6 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1239 = 4d7 */ {1600, 1, 9}, /* 0x009a => 0x04d0+(8)*/
+ /* 1240 = 4d8 */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1241 = 4d9 */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1242 = 4da */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1243 = 4db */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1244 = 4dc */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1245 = 4dd */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1246 = 4de */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1247 = 4df */ {1728, 1, 9}, /* 0x009b => 0x04d8+(8)*/
+ /* 1248 = 4e0 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1249 = 4e1 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1250 = 4e2 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1251 = 4e3 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1252 = 4e4 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1253 = 4e5 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1254 = 4e6 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1255 = 4e7 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1256 = 4e8 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1257 = 4e9 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1258 = 4ea */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1259 = 4eb */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1260 = 4ec */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1261 = 4ed */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1262 = 4ee */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1263 = 4ef */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1264 = 4f0 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1265 = 4f1 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1266 = 4f2 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1267 = 4f3 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1268 = 4f4 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1269 = 4f5 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1270 = 4f6 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1271 = 4f7 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1272 = 4f8 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1273 = 4f9 */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1274 = 4fa */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1275 = 4fb */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1276 = 4fc */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1277 = 4fd */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1278 = 4fe */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1279 = 4ff */ {18, 0, 7}, /* 0x0027 => 0x04e0+(32)*/
+ /* 1280 = 500 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1281 = 501 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1282 = 502 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1283 = 503 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1284 = 504 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1285 = 505 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1286 = 506 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1287 = 507 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1288 = 508 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1289 = 509 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1290 = 50a */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1291 = 50b */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1292 = 50c */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1293 = 50d */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1294 = 50e */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1295 = 50f */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1296 = 510 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1297 = 511 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1298 = 512 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1299 = 513 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1300 = 514 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1301 = 515 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1302 = 516 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1303 = 517 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1304 = 518 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1305 = 519 */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1306 = 51a */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1307 = 51b */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1308 = 51c */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1309 = 51d */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1310 = 51e */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1311 = 51f */ {24, 0, 7}, /* 0x0028 => 0x0500+(32)*/
+ /* 1312 = 520 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1313 = 521 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1314 = 522 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1315 = 523 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1316 = 524 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1317 = 525 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1318 = 526 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1319 = 527 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1320 = 528 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1321 = 529 */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1322 = 52a */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1323 = 52b */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1324 = 52c */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1325 = 52d */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1326 = 52e */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1327 = 52f */ {49, 0, 8}, /* 0x0052 => 0x0520+(16)*/
+ /* 1328 = 530 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1329 = 531 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1330 = 532 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1331 = 533 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1332 = 534 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1333 = 535 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1334 = 536 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1335 = 537 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1336 = 538 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1337 = 539 */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1338 = 53a */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1339 = 53b */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1340 = 53c */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1341 = 53d */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1342 = 53e */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1343 = 53f */ {50, 0, 8}, /* 0x0053 => 0x0530+(16)*/
+ /* 1344 = 540 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1345 = 541 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1346 = 542 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1347 = 543 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1348 = 544 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1349 = 545 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1350 = 546 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1351 = 547 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1352 = 548 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1353 = 549 */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1354 = 54a */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1355 = 54b */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1356 = 54c */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1357 = 54d */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1358 = 54e */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1359 = 54f */ {51, 0, 8}, /* 0x0054 => 0x0540+(16)*/
+ /* 1360 = 550 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1361 = 551 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1362 = 552 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1363 = 553 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1364 = 554 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1365 = 555 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1366 = 556 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1367 = 557 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1368 = 558 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1369 = 559 */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1370 = 55a */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1371 = 55b */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1372 = 55c */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1373 = 55d */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1374 = 55e */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1375 = 55f */ {52, 0, 8}, /* 0x0055 => 0x0550+(16)*/
+ /* 1376 = 560 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1377 = 561 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1378 = 562 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1379 = 563 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1380 = 564 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1381 = 565 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1382 = 566 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1383 = 567 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1384 = 568 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1385 = 569 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1386 = 56a */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1387 = 56b */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1388 = 56c */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1389 = 56d */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1390 = 56e */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1391 = 56f */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1392 = 570 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1393 = 571 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1394 = 572 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1395 = 573 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1396 = 574 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1397 = 575 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1398 = 576 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1399 = 577 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1400 = 578 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1401 = 579 */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1402 = 57a */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1403 = 57b */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1404 = 57c */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1405 = 57d */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1406 = 57e */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1407 = 57f */ {25, 0, 7}, /* 0x002b => 0x0560+(32)*/
+ /* 1408 = 580 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1409 = 581 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1410 = 582 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1411 = 583 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1412 = 584 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1413 = 585 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1414 = 586 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1415 = 587 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1416 = 588 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1417 = 589 */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1418 = 58a */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1419 = 58b */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1420 = 58c */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1421 = 58d */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1422 = 58e */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1423 = 58f */ {55, 0, 8}, /* 0x0058 => 0x0580+(16)*/
+ /* 1424 = 590 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1425 = 591 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1426 = 592 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1427 = 593 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1428 = 594 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1429 = 595 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1430 = 596 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1431 = 597 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1432 = 598 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1433 = 599 */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1434 = 59a */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1435 = 59b */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1436 = 59c */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1437 = 59d */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1438 = 59e */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1439 = 59f */ {56, 0, 8}, /* 0x0059 => 0x0590+(16)*/
+ /* 1440 = 5a0 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1441 = 5a1 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1442 = 5a2 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1443 = 5a3 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1444 = 5a4 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1445 = 5a5 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1446 = 5a6 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1447 = 5a7 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1448 = 5a8 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1449 = 5a9 */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1450 = 5aa */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1451 = 5ab */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1452 = 5ac */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1453 = 5ad */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1454 = 5ae */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1455 = 5af */ {57, 0, 8}, /* 0x005a => 0x05a0+(16)*/
+ /* 1456 = 5b0 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1457 = 5b1 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1458 = 5b2 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1459 = 5b3 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1460 = 5b4 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1461 = 5b5 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1462 = 5b6 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1463 = 5b7 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1464 = 5b8 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1465 = 5b9 */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1466 = 5ba */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1467 = 5bb */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1468 = 5bc */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1469 = 5bd */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1470 = 5be */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1471 = 5bf */ {58, 0, 8}, /* 0x005b => 0x05b0+(16)*/
+ /* 1472 = 5c0 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1473 = 5c1 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1474 = 5c2 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1475 = 5c3 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1476 = 5c4 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1477 = 5c5 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1478 = 5c6 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1479 = 5c7 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1480 = 5c8 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1481 = 5c9 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1482 = 5ca */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1483 = 5cb */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1484 = 5cc */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1485 = 5cd */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1486 = 5ce */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1487 = 5cf */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1488 = 5d0 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1489 = 5d1 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1490 = 5d2 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1491 = 5d3 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1492 = 5d4 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1493 = 5d5 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1494 = 5d6 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1495 = 5d7 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1496 = 5d8 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1497 = 5d9 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1498 = 5da */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1499 = 5db */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1500 = 5dc */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1501 = 5dd */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1502 = 5de */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1503 = 5df */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1504 = 5e0 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1505 = 5e1 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1506 = 5e2 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1507 = 5e3 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1508 = 5e4 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1509 = 5e5 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1510 = 5e6 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1511 = 5e7 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1512 = 5e8 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1513 = 5e9 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1514 = 5ea */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1515 = 5eb */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1516 = 5ec */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1517 = 5ed */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1518 = 5ee */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1519 = 5ef */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1520 = 5f0 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1521 = 5f1 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1522 = 5f2 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1523 = 5f3 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1524 = 5f4 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1525 = 5f5 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1526 = 5f6 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1527 = 5f7 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1528 = 5f8 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1529 = 5f9 */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1530 = 5fa */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1531 = 5fb */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1532 = 5fc */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1533 = 5fd */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1534 = 5fe */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1535 = 5ff */ {192, 1, 6}, /* 0x0017 => 0x05c0+(64)*/
+ /* 1536 = 600 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1537 = 601 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1538 = 602 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1539 = 603 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1540 = 604 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1541 = 605 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1542 = 606 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1543 = 607 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1544 = 608 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1545 = 609 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1546 = 60a */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1547 = 60b */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1548 = 60c */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1549 = 60d */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1550 = 60e */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1551 = 60f */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1552 = 610 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1553 = 611 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1554 = 612 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1555 = 613 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1556 = 614 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1557 = 615 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1558 = 616 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1559 = 617 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1560 = 618 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1561 = 619 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1562 = 61a */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1563 = 61b */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1564 = 61c */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1565 = 61d */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1566 = 61e */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1567 = 61f */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1568 = 620 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1569 = 621 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1570 = 622 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1571 = 623 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1572 = 624 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1573 = 625 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1574 = 626 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1575 = 627 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1576 = 628 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1577 = 629 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1578 = 62a */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1579 = 62b */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1580 = 62c */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1581 = 62d */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1582 = 62e */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1583 = 62f */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1584 = 630 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1585 = 631 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1586 = 632 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1587 = 633 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1588 = 634 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1589 = 635 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1590 = 636 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1591 = 637 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1592 = 638 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1593 = 639 */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1594 = 63a */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1595 = 63b */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1596 = 63c */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1597 = 63d */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1598 = 63e */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1599 = 63f */ {1664, 1, 6}, /* 0x0018 => 0x0600+(64)*/
+ /* 1600 = 640 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1601 = 641 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1602 = 642 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1603 = 643 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1604 = 644 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1605 = 645 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1606 = 646 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1607 = 647 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1608 = 648 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1609 = 649 */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1610 = 64a */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1611 = 64b */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1612 = 64c */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1613 = 64d */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1614 = 64e */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1615 = 64f */ {448, 1, 8}, /* 0x0064 => 0x0640+(16)*/
+ /* 1616 = 650 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1617 = 651 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1618 = 652 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1619 = 653 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1620 = 654 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1621 = 655 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1622 = 656 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1623 = 657 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1624 = 658 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1625 = 659 */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1626 = 65a */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1627 = 65b */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1628 = 65c */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1629 = 65d */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1630 = 65e */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1631 = 65f */ {512, 1, 8}, /* 0x0065 => 0x0650+(16)*/
+ /* 1632 = 660 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1633 = 661 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1634 = 662 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1635 = 663 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1636 = 664 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1637 = 665 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1638 = 666 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1639 = 667 */ {704, 1, 9}, /* 0x00cc => 0x0660+(8)*/
+ /* 1640 = 668 */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1641 = 669 */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1642 = 66a */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1643 = 66b */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1644 = 66c */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1645 = 66d */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1646 = 66e */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1647 = 66f */ {768, 1, 9}, /* 0x00cd => 0x0668+(8)*/
+ /* 1648 = 670 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1649 = 671 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1650 = 672 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1651 = 673 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1652 = 674 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1653 = 675 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1654 = 676 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1655 = 677 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1656 = 678 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1657 = 679 */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1658 = 67a */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1659 = 67b */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1660 = 67c */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1661 = 67d */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1662 = 67e */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1663 = 67f */ {640, 1, 8}, /* 0x0067 => 0x0670+(16)*/
+ /* 1664 = 680 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1665 = 681 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1666 = 682 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1667 = 683 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1668 = 684 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1669 = 685 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1670 = 686 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1671 = 687 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1672 = 688 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1673 = 689 */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1674 = 68a */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1675 = 68b */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1676 = 68c */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1677 = 68d */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1678 = 68e */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1679 = 68f */ {576, 1, 8}, /* 0x0068 => 0x0680+(16)*/
+ /* 1680 = 690 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1681 = 691 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1682 = 692 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1683 = 693 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1684 = 694 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1685 = 695 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1686 = 696 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1687 = 697 */ {832, 1, 9}, /* 0x00d2 => 0x0690+(8)*/
+ /* 1688 = 698 */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1689 = 699 */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1690 = 69a */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1691 = 69b */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1692 = 69c */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1693 = 69d */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1694 = 69e */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1695 = 69f */ {896, 1, 9}, /* 0x00d3 => 0x0698+(8)*/
+ /* 1696 = 6a0 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1697 = 6a1 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1698 = 6a2 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1699 = 6a3 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1700 = 6a4 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1701 = 6a5 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1702 = 6a6 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1703 = 6a7 */ {960, 1, 9}, /* 0x00d4 => 0x06a0+(8)*/
+ /* 1704 = 6a8 */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1705 = 6a9 */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1706 = 6aa */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1707 = 6ab */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1708 = 6ac */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1709 = 6ad */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1710 = 6ae */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1711 = 6af */ {1024, 1, 9}, /* 0x00d5 => 0x06a8+(8)*/
+ /* 1712 = 6b0 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1713 = 6b1 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1714 = 6b2 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1715 = 6b3 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1716 = 6b4 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1717 = 6b5 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1718 = 6b6 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1719 = 6b7 */ {1088, 1, 9}, /* 0x00d6 => 0x06b0+(8)*/
+ /* 1720 = 6b8 */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1721 = 6b9 */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1722 = 6ba */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1723 = 6bb */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1724 = 6bc */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1725 = 6bd */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1726 = 6be */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1727 = 6bf */ {1152, 1, 9}, /* 0x00d7 => 0x06b8+(8)*/
+ /* 1728 = 6c0 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1729 = 6c1 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1730 = 6c2 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1731 = 6c3 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1732 = 6c4 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1733 = 6c5 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1734 = 6c6 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1735 = 6c7 */ {1216, 1, 9}, /* 0x00d8 => 0x06c0+(8)*/
+ /* 1736 = 6c8 */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1737 = 6c9 */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1738 = 6ca */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1739 = 6cb */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1740 = 6cc */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1741 = 6cd */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1742 = 6ce */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1743 = 6cf */ {1280, 1, 9}, /* 0x00d9 => 0x06c8+(8)*/
+ /* 1744 = 6d0 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1745 = 6d1 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1746 = 6d2 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1747 = 6d3 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1748 = 6d4 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1749 = 6d5 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1750 = 6d6 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1751 = 6d7 */ {1344, 1, 9}, /* 0x00da => 0x06d0+(8)*/
+ /* 1752 = 6d8 */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1753 = 6d9 */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1754 = 6da */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1755 = 6db */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1756 = 6dc */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1757 = 6dd */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1758 = 6de */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1759 = 6df */ {1408, 1, 9}, /* 0x00db => 0x06d8+(8)*/
+ /* 1760 = 6e0 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1761 = 6e1 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1762 = 6e2 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1763 = 6e3 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1764 = 6e4 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1765 = 6e5 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1766 = 6e6 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1767 = 6e7 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1768 = 6e8 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1769 = 6e9 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1770 = 6ea */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1771 = 6eb */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1772 = 6ec */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1773 = 6ed */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1774 = 6ee */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1775 = 6ef */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1776 = 6f0 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1777 = 6f1 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1778 = 6f2 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1779 = 6f3 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1780 = 6f4 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1781 = 6f5 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1782 = 6f6 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1783 = 6f7 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1784 = 6f8 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1785 = 6f9 */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1786 = 6fa */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1787 = 6fb */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1788 = 6fc */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1789 = 6fd */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1790 = 6fe */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1791 = 6ff */ {256, 1, 7}, /* 0x0037 => 0x06e0+(32)*/
+ /* 1792 = 700 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1793 = 701 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1794 = 702 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1795 = 703 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1796 = 704 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1797 = 705 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1798 = 706 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1799 = 707 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1800 = 708 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1801 = 709 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1802 = 70a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1803 = 70b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1804 = 70c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1805 = 70d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1806 = 70e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1807 = 70f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1808 = 710 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1809 = 711 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1810 = 712 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1811 = 713 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1812 = 714 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1813 = 715 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1814 = 716 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1815 = 717 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1816 = 718 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1817 = 719 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1818 = 71a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1819 = 71b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1820 = 71c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1821 = 71d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1822 = 71e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1823 = 71f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1824 = 720 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1825 = 721 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1826 = 722 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1827 = 723 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1828 = 724 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1829 = 725 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1830 = 726 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1831 = 727 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1832 = 728 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1833 = 729 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1834 = 72a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1835 = 72b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1836 = 72c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1837 = 72d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1838 = 72e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1839 = 72f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1840 = 730 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1841 = 731 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1842 = 732 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1843 = 733 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1844 = 734 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1845 = 735 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1846 = 736 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1847 = 737 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1848 = 738 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1849 = 739 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1850 = 73a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1851 = 73b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1852 = 73c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1853 = 73d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1854 = 73e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1855 = 73f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1856 = 740 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1857 = 741 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1858 = 742 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1859 = 743 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1860 = 744 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1861 = 745 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1862 = 746 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1863 = 747 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1864 = 748 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1865 = 749 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1866 = 74a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1867 = 74b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1868 = 74c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1869 = 74d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1870 = 74e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1871 = 74f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1872 = 750 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1873 = 751 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1874 = 752 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1875 = 753 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1876 = 754 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1877 = 755 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1878 = 756 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1879 = 757 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1880 = 758 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1881 = 759 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1882 = 75a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1883 = 75b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1884 = 75c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1885 = 75d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1886 = 75e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1887 = 75f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1888 = 760 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1889 = 761 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1890 = 762 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1891 = 763 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1892 = 764 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1893 = 765 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1894 = 766 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1895 = 767 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1896 = 768 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1897 = 769 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1898 = 76a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1899 = 76b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1900 = 76c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1901 = 76d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1902 = 76e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1903 = 76f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1904 = 770 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1905 = 771 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1906 = 772 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1907 = 773 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1908 = 774 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1909 = 775 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1910 = 776 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1911 = 777 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1912 = 778 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1913 = 779 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1914 = 77a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1915 = 77b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1916 = 77c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1917 = 77d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1918 = 77e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1919 = 77f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1920 = 780 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1921 = 781 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1922 = 782 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1923 = 783 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1924 = 784 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1925 = 785 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1926 = 786 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1927 = 787 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1928 = 788 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1929 = 789 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1930 = 78a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1931 = 78b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1932 = 78c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1933 = 78d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1934 = 78e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1935 = 78f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1936 = 790 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1937 = 791 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1938 = 792 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1939 = 793 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1940 = 794 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1941 = 795 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1942 = 796 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1943 = 797 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1944 = 798 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1945 = 799 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1946 = 79a */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1947 = 79b */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1948 = 79c */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1949 = 79d */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1950 = 79e */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1951 = 79f */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1952 = 7a0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1953 = 7a1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1954 = 7a2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1955 = 7a3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1956 = 7a4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1957 = 7a5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1958 = 7a6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1959 = 7a7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1960 = 7a8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1961 = 7a9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1962 = 7aa */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1963 = 7ab */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1964 = 7ac */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1965 = 7ad */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1966 = 7ae */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1967 = 7af */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1968 = 7b0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1969 = 7b1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1970 = 7b2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1971 = 7b3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1972 = 7b4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1973 = 7b5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1974 = 7b6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1975 = 7b7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1976 = 7b8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1977 = 7b9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1978 = 7ba */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1979 = 7bb */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1980 = 7bc */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1981 = 7bd */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1982 = 7be */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1983 = 7bf */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1984 = 7c0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1985 = 7c1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1986 = 7c2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1987 = 7c3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1988 = 7c4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1989 = 7c5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1990 = 7c6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1991 = 7c7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1992 = 7c8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1993 = 7c9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1994 = 7ca */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1995 = 7cb */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1996 = 7cc */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1997 = 7cd */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1998 = 7ce */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 1999 = 7cf */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2000 = 7d0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2001 = 7d1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2002 = 7d2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2003 = 7d3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2004 = 7d4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2005 = 7d5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2006 = 7d6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2007 = 7d7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2008 = 7d8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2009 = 7d9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2010 = 7da */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2011 = 7db */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2012 = 7dc */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2013 = 7dd */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2014 = 7de */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2015 = 7df */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2016 = 7e0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2017 = 7e1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2018 = 7e2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2019 = 7e3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2020 = 7e4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2021 = 7e5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2022 = 7e6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2023 = 7e7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2024 = 7e8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2025 = 7e9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2026 = 7ea */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2027 = 7eb */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2028 = 7ec */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2029 = 7ed */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2030 = 7ee */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2031 = 7ef */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2032 = 7f0 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2033 = 7f1 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2034 = 7f2 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2035 = 7f3 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2036 = 7f4 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2037 = 7f5 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2038 = 7f6 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2039 = 7f7 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2040 = 7f8 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2041 = 7f9 */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2042 = 7fa */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2043 = 7fb */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2044 = 7fc */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2045 = 7fd */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2046 = 7fe */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2047 = 7ff */ {2, 0, 4}, /* 0x0007 => 0x0700+(256)*/
+ /* 2048 = 800 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2049 = 801 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2050 = 802 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2051 = 803 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2052 = 804 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2053 = 805 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2054 = 806 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2055 = 807 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2056 = 808 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2057 = 809 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2058 = 80a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2059 = 80b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2060 = 80c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2061 = 80d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2062 = 80e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2063 = 80f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2064 = 810 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2065 = 811 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2066 = 812 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2067 = 813 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2068 = 814 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2069 = 815 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2070 = 816 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2071 = 817 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2072 = 818 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2073 = 819 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2074 = 81a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2075 = 81b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2076 = 81c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2077 = 81d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2078 = 81e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2079 = 81f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2080 = 820 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2081 = 821 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2082 = 822 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2083 = 823 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2084 = 824 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2085 = 825 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2086 = 826 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2087 = 827 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2088 = 828 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2089 = 829 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2090 = 82a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2091 = 82b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2092 = 82c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2093 = 82d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2094 = 82e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2095 = 82f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2096 = 830 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2097 = 831 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2098 = 832 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2099 = 833 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2100 = 834 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2101 = 835 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2102 = 836 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2103 = 837 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2104 = 838 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2105 = 839 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2106 = 83a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2107 = 83b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2108 = 83c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2109 = 83d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2110 = 83e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2111 = 83f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2112 = 840 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2113 = 841 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2114 = 842 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2115 = 843 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2116 = 844 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2117 = 845 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2118 = 846 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2119 = 847 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2120 = 848 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2121 = 849 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2122 = 84a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2123 = 84b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2124 = 84c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2125 = 84d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2126 = 84e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2127 = 84f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2128 = 850 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2129 = 851 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2130 = 852 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2131 = 853 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2132 = 854 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2133 = 855 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2134 = 856 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2135 = 857 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2136 = 858 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2137 = 859 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2138 = 85a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2139 = 85b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2140 = 85c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2141 = 85d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2142 = 85e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2143 = 85f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2144 = 860 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2145 = 861 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2146 = 862 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2147 = 863 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2148 = 864 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2149 = 865 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2150 = 866 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2151 = 867 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2152 = 868 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2153 = 869 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2154 = 86a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2155 = 86b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2156 = 86c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2157 = 86d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2158 = 86e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2159 = 86f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2160 = 870 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2161 = 871 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2162 = 872 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2163 = 873 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2164 = 874 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2165 = 875 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2166 = 876 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2167 = 877 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2168 = 878 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2169 = 879 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2170 = 87a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2171 = 87b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2172 = 87c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2173 = 87d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2174 = 87e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2175 = 87f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2176 = 880 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2177 = 881 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2178 = 882 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2179 = 883 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2180 = 884 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2181 = 885 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2182 = 886 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2183 = 887 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2184 = 888 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2185 = 889 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2186 = 88a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2187 = 88b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2188 = 88c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2189 = 88d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2190 = 88e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2191 = 88f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2192 = 890 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2193 = 891 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2194 = 892 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2195 = 893 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2196 = 894 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2197 = 895 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2198 = 896 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2199 = 897 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2200 = 898 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2201 = 899 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2202 = 89a */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2203 = 89b */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2204 = 89c */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2205 = 89d */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2206 = 89e */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2207 = 89f */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2208 = 8a0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2209 = 8a1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2210 = 8a2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2211 = 8a3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2212 = 8a4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2213 = 8a5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2214 = 8a6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2215 = 8a7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2216 = 8a8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2217 = 8a9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2218 = 8aa */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2219 = 8ab */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2220 = 8ac */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2221 = 8ad */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2222 = 8ae */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2223 = 8af */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2224 = 8b0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2225 = 8b1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2226 = 8b2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2227 = 8b3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2228 = 8b4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2229 = 8b5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2230 = 8b6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2231 = 8b7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2232 = 8b8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2233 = 8b9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2234 = 8ba */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2235 = 8bb */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2236 = 8bc */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2237 = 8bd */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2238 = 8be */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2239 = 8bf */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2240 = 8c0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2241 = 8c1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2242 = 8c2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2243 = 8c3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2244 = 8c4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2245 = 8c5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2246 = 8c6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2247 = 8c7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2248 = 8c8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2249 = 8c9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2250 = 8ca */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2251 = 8cb */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2252 = 8cc */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2253 = 8cd */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2254 = 8ce */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2255 = 8cf */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2256 = 8d0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2257 = 8d1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2258 = 8d2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2259 = 8d3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2260 = 8d4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2261 = 8d5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2262 = 8d6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2263 = 8d7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2264 = 8d8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2265 = 8d9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2266 = 8da */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2267 = 8db */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2268 = 8dc */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2269 = 8dd */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2270 = 8de */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2271 = 8df */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2272 = 8e0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2273 = 8e1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2274 = 8e2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2275 = 8e3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2276 = 8e4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2277 = 8e5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2278 = 8e6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2279 = 8e7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2280 = 8e8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2281 = 8e9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2282 = 8ea */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2283 = 8eb */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2284 = 8ec */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2285 = 8ed */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2286 = 8ee */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2287 = 8ef */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2288 = 8f0 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2289 = 8f1 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2290 = 8f2 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2291 = 8f3 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2292 = 8f4 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2293 = 8f5 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2294 = 8f6 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2295 = 8f7 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2296 = 8f8 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2297 = 8f9 */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2298 = 8fa */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2299 = 8fb */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2300 = 8fc */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2301 = 8fd */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2302 = 8fe */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2303 = 8ff */ {3, 0, 4}, /* 0x0008 => 0x0800+(256)*/
+ /* 2304 = 900 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2305 = 901 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2306 = 902 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2307 = 903 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2308 = 904 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2309 = 905 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2310 = 906 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2311 = 907 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2312 = 908 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2313 = 909 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2314 = 90a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2315 = 90b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2316 = 90c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2317 = 90d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2318 = 90e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2319 = 90f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2320 = 910 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2321 = 911 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2322 = 912 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2323 = 913 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2324 = 914 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2325 = 915 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2326 = 916 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2327 = 917 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2328 = 918 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2329 = 919 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2330 = 91a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2331 = 91b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2332 = 91c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2333 = 91d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2334 = 91e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2335 = 91f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2336 = 920 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2337 = 921 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2338 = 922 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2339 = 923 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2340 = 924 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2341 = 925 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2342 = 926 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2343 = 927 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2344 = 928 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2345 = 929 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2346 = 92a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2347 = 92b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2348 = 92c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2349 = 92d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2350 = 92e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2351 = 92f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2352 = 930 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2353 = 931 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2354 = 932 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2355 = 933 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2356 = 934 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2357 = 935 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2358 = 936 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2359 = 937 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2360 = 938 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2361 = 939 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2362 = 93a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2363 = 93b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2364 = 93c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2365 = 93d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2366 = 93e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2367 = 93f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2368 = 940 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2369 = 941 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2370 = 942 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2371 = 943 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2372 = 944 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2373 = 945 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2374 = 946 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2375 = 947 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2376 = 948 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2377 = 949 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2378 = 94a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2379 = 94b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2380 = 94c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2381 = 94d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2382 = 94e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2383 = 94f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2384 = 950 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2385 = 951 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2386 = 952 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2387 = 953 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2388 = 954 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2389 = 955 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2390 = 956 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2391 = 957 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2392 = 958 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2393 = 959 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2394 = 95a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2395 = 95b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2396 = 95c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2397 = 95d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2398 = 95e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2399 = 95f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2400 = 960 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2401 = 961 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2402 = 962 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2403 = 963 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2404 = 964 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2405 = 965 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2406 = 966 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2407 = 967 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2408 = 968 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2409 = 969 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2410 = 96a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2411 = 96b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2412 = 96c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2413 = 96d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2414 = 96e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2415 = 96f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2416 = 970 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2417 = 971 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2418 = 972 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2419 = 973 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2420 = 974 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2421 = 975 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2422 = 976 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2423 = 977 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2424 = 978 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2425 = 979 */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2426 = 97a */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2427 = 97b */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2428 = 97c */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2429 = 97d */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2430 = 97e */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2431 = 97f */ {128, 1, 5}, /* 0x0012 => 0x0900+(128)*/
+ /* 2432 = 980 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2433 = 981 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2434 = 982 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2435 = 983 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2436 = 984 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2437 = 985 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2438 = 986 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2439 = 987 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2440 = 988 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2441 = 989 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2442 = 98a */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2443 = 98b */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2444 = 98c */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2445 = 98d */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2446 = 98e */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2447 = 98f */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2448 = 990 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2449 = 991 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2450 = 992 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2451 = 993 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2452 = 994 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2453 = 995 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2454 = 996 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2455 = 997 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2456 = 998 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2457 = 999 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2458 = 99a */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2459 = 99b */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2460 = 99c */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2461 = 99d */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2462 = 99e */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2463 = 99f */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2464 = 9a0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2465 = 9a1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2466 = 9a2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2467 = 9a3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2468 = 9a4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2469 = 9a5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2470 = 9a6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2471 = 9a7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2472 = 9a8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2473 = 9a9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2474 = 9aa */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2475 = 9ab */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2476 = 9ac */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2477 = 9ad */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2478 = 9ae */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2479 = 9af */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2480 = 9b0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2481 = 9b1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2482 = 9b2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2483 = 9b3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2484 = 9b4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2485 = 9b5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2486 = 9b6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2487 = 9b7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2488 = 9b8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2489 = 9b9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2490 = 9ba */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2491 = 9bb */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2492 = 9bc */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2493 = 9bd */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2494 = 9be */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2495 = 9bf */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2496 = 9c0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2497 = 9c1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2498 = 9c2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2499 = 9c3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2500 = 9c4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2501 = 9c5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2502 = 9c6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2503 = 9c7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2504 = 9c8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2505 = 9c9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2506 = 9ca */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2507 = 9cb */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2508 = 9cc */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2509 = 9cd */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2510 = 9ce */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2511 = 9cf */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2512 = 9d0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2513 = 9d1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2514 = 9d2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2515 = 9d3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2516 = 9d4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2517 = 9d5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2518 = 9d6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2519 = 9d7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2520 = 9d8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2521 = 9d9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2522 = 9da */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2523 = 9db */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2524 = 9dc */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2525 = 9dd */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2526 = 9de */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2527 = 9df */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2528 = 9e0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2529 = 9e1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2530 = 9e2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2531 = 9e3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2532 = 9e4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2533 = 9e5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2534 = 9e6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2535 = 9e7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2536 = 9e8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2537 = 9e9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2538 = 9ea */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2539 = 9eb */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2540 = 9ec */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2541 = 9ed */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2542 = 9ee */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2543 = 9ef */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2544 = 9f0 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2545 = 9f1 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2546 = 9f2 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2547 = 9f3 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2548 = 9f4 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2549 = 9f5 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2550 = 9f6 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2551 = 9f7 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2552 = 9f8 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2553 = 9f9 */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2554 = 9fa */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2555 = 9fb */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2556 = 9fc */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2557 = 9fd */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2558 = 9fe */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2559 = 9ff */ {8, 0, 5}, /* 0x0013 => 0x0980+(128)*/
+ /* 2560 = a00 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2561 = a01 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2562 = a02 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2563 = a03 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2564 = a04 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2565 = a05 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2566 = a06 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2567 = a07 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2568 = a08 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2569 = a09 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2570 = a0a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2571 = a0b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2572 = a0c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2573 = a0d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2574 = a0e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2575 = a0f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2576 = a10 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2577 = a11 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2578 = a12 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2579 = a13 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2580 = a14 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2581 = a15 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2582 = a16 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2583 = a17 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2584 = a18 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2585 = a19 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2586 = a1a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2587 = a1b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2588 = a1c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2589 = a1d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2590 = a1e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2591 = a1f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2592 = a20 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2593 = a21 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2594 = a22 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2595 = a23 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2596 = a24 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2597 = a25 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2598 = a26 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2599 = a27 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2600 = a28 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2601 = a29 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2602 = a2a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2603 = a2b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2604 = a2c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2605 = a2d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2606 = a2e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2607 = a2f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2608 = a30 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2609 = a31 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2610 = a32 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2611 = a33 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2612 = a34 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2613 = a35 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2614 = a36 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2615 = a37 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2616 = a38 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2617 = a39 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2618 = a3a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2619 = a3b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2620 = a3c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2621 = a3d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2622 = a3e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2623 = a3f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2624 = a40 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2625 = a41 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2626 = a42 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2627 = a43 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2628 = a44 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2629 = a45 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2630 = a46 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2631 = a47 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2632 = a48 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2633 = a49 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2634 = a4a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2635 = a4b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2636 = a4c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2637 = a4d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2638 = a4e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2639 = a4f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2640 = a50 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2641 = a51 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2642 = a52 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2643 = a53 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2644 = a54 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2645 = a55 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2646 = a56 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2647 = a57 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2648 = a58 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2649 = a59 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2650 = a5a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2651 = a5b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2652 = a5c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2653 = a5d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2654 = a5e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2655 = a5f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2656 = a60 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2657 = a61 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2658 = a62 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2659 = a63 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2660 = a64 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2661 = a65 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2662 = a66 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2663 = a67 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2664 = a68 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2665 = a69 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2666 = a6a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2667 = a6b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2668 = a6c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2669 = a6d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2670 = a6e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2671 = a6f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2672 = a70 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2673 = a71 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2674 = a72 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2675 = a73 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2676 = a74 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2677 = a75 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2678 = a76 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2679 = a77 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2680 = a78 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2681 = a79 */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2682 = a7a */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2683 = a7b */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2684 = a7c */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2685 = a7d */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2686 = a7e */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2687 = a7f */ {9, 0, 5}, /* 0x0014 => 0x0a00+(128)*/
+ /* 2688 = a80 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2689 = a81 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2690 = a82 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2691 = a83 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2692 = a84 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2693 = a85 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2694 = a86 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2695 = a87 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2696 = a88 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2697 = a89 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2698 = a8a */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2699 = a8b */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2700 = a8c */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2701 = a8d */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2702 = a8e */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2703 = a8f */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2704 = a90 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2705 = a91 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2706 = a92 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2707 = a93 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2708 = a94 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2709 = a95 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2710 = a96 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2711 = a97 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2712 = a98 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2713 = a99 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2714 = a9a */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2715 = a9b */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2716 = a9c */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2717 = a9d */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2718 = a9e */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2719 = a9f */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2720 = aa0 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2721 = aa1 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2722 = aa2 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2723 = aa3 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2724 = aa4 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2725 = aa5 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2726 = aa6 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2727 = aa7 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2728 = aa8 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2729 = aa9 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2730 = aaa */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2731 = aab */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2732 = aac */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2733 = aad */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2734 = aae */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2735 = aaf */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2736 = ab0 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2737 = ab1 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2738 = ab2 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2739 = ab3 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2740 = ab4 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2741 = ab5 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2742 = ab6 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2743 = ab7 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2744 = ab8 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2745 = ab9 */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2746 = aba */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2747 = abb */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2748 = abc */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2749 = abd */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2750 = abe */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2751 = abf */ {16, 0, 6}, /* 0x002a => 0x0a80+(64)*/
+ /* 2752 = ac0 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2753 = ac1 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2754 = ac2 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2755 = ac3 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2756 = ac4 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2757 = ac5 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2758 = ac6 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2759 = ac7 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2760 = ac8 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2761 = ac9 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2762 = aca */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2763 = acb */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2764 = acc */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2765 = acd */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2766 = ace */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2767 = acf */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2768 = ad0 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2769 = ad1 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2770 = ad2 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2771 = ad3 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2772 = ad4 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2773 = ad5 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2774 = ad6 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2775 = ad7 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2776 = ad8 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2777 = ad9 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2778 = ada */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2779 = adb */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2780 = adc */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2781 = add */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2782 = ade */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2783 = adf */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2784 = ae0 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2785 = ae1 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2786 = ae2 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2787 = ae3 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2788 = ae4 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2789 = ae5 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2790 = ae6 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2791 = ae7 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2792 = ae8 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2793 = ae9 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2794 = aea */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2795 = aeb */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2796 = aec */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2797 = aed */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2798 = aee */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2799 = aef */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2800 = af0 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2801 = af1 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2802 = af2 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2803 = af3 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2804 = af4 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2805 = af5 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2806 = af6 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2807 = af7 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2808 = af8 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2809 = af9 */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2810 = afa */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2811 = afb */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2812 = afc */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2813 = afd */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2814 = afe */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2815 = aff */ {17, 0, 6}, /* 0x002b => 0x0ac0+(64)*/
+ /* 2816 = b00 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2817 = b01 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2818 = b02 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2819 = b03 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2820 = b04 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2821 = b05 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2822 = b06 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2823 = b07 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2824 = b08 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2825 = b09 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2826 = b0a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2827 = b0b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2828 = b0c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2829 = b0d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2830 = b0e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2831 = b0f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2832 = b10 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2833 = b11 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2834 = b12 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2835 = b13 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2836 = b14 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2837 = b15 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2838 = b16 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2839 = b17 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2840 = b18 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2841 = b19 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2842 = b1a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2843 = b1b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2844 = b1c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2845 = b1d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2846 = b1e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2847 = b1f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2848 = b20 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2849 = b21 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2850 = b22 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2851 = b23 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2852 = b24 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2853 = b25 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2854 = b26 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2855 = b27 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2856 = b28 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2857 = b29 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2858 = b2a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2859 = b2b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2860 = b2c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2861 = b2d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2862 = b2e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2863 = b2f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2864 = b30 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2865 = b31 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2866 = b32 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2867 = b33 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2868 = b34 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2869 = b35 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2870 = b36 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2871 = b37 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2872 = b38 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2873 = b39 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2874 = b3a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2875 = b3b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2876 = b3c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2877 = b3d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2878 = b3e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2879 = b3f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2880 = b40 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2881 = b41 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2882 = b42 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2883 = b43 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2884 = b44 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2885 = b45 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2886 = b46 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2887 = b47 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2888 = b48 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2889 = b49 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2890 = b4a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2891 = b4b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2892 = b4c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2893 = b4d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2894 = b4e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2895 = b4f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2896 = b50 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2897 = b51 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2898 = b52 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2899 = b53 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2900 = b54 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2901 = b55 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2902 = b56 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2903 = b57 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2904 = b58 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2905 = b59 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2906 = b5a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2907 = b5b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2908 = b5c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2909 = b5d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2910 = b5e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2911 = b5f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2912 = b60 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2913 = b61 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2914 = b62 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2915 = b63 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2916 = b64 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2917 = b65 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2918 = b66 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2919 = b67 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2920 = b68 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2921 = b69 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2922 = b6a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2923 = b6b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2924 = b6c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2925 = b6d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2926 = b6e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2927 = b6f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2928 = b70 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2929 = b71 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2930 = b72 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2931 = b73 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2932 = b74 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2933 = b75 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2934 = b76 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2935 = b77 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2936 = b78 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2937 = b79 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2938 = b7a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2939 = b7b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2940 = b7c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2941 = b7d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2942 = b7e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2943 = b7f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2944 = b80 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2945 = b81 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2946 = b82 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2947 = b83 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2948 = b84 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2949 = b85 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2950 = b86 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2951 = b87 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2952 = b88 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2953 = b89 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2954 = b8a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2955 = b8b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2956 = b8c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2957 = b8d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2958 = b8e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2959 = b8f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2960 = b90 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2961 = b91 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2962 = b92 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2963 = b93 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2964 = b94 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2965 = b95 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2966 = b96 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2967 = b97 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2968 = b98 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2969 = b99 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2970 = b9a */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2971 = b9b */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2972 = b9c */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2973 = b9d */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2974 = b9e */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2975 = b9f */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2976 = ba0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2977 = ba1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2978 = ba2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2979 = ba3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2980 = ba4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2981 = ba5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2982 = ba6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2983 = ba7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2984 = ba8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2985 = ba9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2986 = baa */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2987 = bab */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2988 = bac */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2989 = bad */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2990 = bae */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2991 = baf */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2992 = bb0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2993 = bb1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2994 = bb2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2995 = bb3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2996 = bb4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2997 = bb5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2998 = bb6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 2999 = bb7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3000 = bb8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3001 = bb9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3002 = bba */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3003 = bbb */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3004 = bbc */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3005 = bbd */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3006 = bbe */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3007 = bbf */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3008 = bc0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3009 = bc1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3010 = bc2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3011 = bc3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3012 = bc4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3013 = bc5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3014 = bc6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3015 = bc7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3016 = bc8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3017 = bc9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3018 = bca */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3019 = bcb */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3020 = bcc */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3021 = bcd */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3022 = bce */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3023 = bcf */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3024 = bd0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3025 = bd1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3026 = bd2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3027 = bd3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3028 = bd4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3029 = bd5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3030 = bd6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3031 = bd7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3032 = bd8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3033 = bd9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3034 = bda */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3035 = bdb */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3036 = bdc */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3037 = bdd */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3038 = bde */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3039 = bdf */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3040 = be0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3041 = be1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3042 = be2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3043 = be3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3044 = be4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3045 = be5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3046 = be6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3047 = be7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3048 = be8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3049 = be9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3050 = bea */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3051 = beb */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3052 = bec */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3053 = bed */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3054 = bee */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3055 = bef */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3056 = bf0 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3057 = bf1 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3058 = bf2 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3059 = bf3 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3060 = bf4 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3061 = bf5 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3062 = bf6 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3063 = bf7 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3064 = bf8 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3065 = bf9 */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3066 = bfa */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3067 = bfb */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3068 = bfc */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3069 = bfd */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3070 = bfe */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3071 = bff */ {4, 0, 4}, /* 0x000b => 0x0b00+(256)*/
+ /* 3072 = c00 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3073 = c01 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3074 = c02 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3075 = c03 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3076 = c04 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3077 = c05 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3078 = c06 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3079 = c07 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3080 = c08 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3081 = c09 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3082 = c0a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3083 = c0b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3084 = c0c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3085 = c0d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3086 = c0e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3087 = c0f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3088 = c10 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3089 = c11 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3090 = c12 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3091 = c13 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3092 = c14 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3093 = c15 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3094 = c16 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3095 = c17 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3096 = c18 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3097 = c19 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3098 = c1a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3099 = c1b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3100 = c1c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3101 = c1d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3102 = c1e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3103 = c1f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3104 = c20 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3105 = c21 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3106 = c22 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3107 = c23 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3108 = c24 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3109 = c25 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3110 = c26 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3111 = c27 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3112 = c28 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3113 = c29 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3114 = c2a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3115 = c2b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3116 = c2c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3117 = c2d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3118 = c2e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3119 = c2f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3120 = c30 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3121 = c31 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3122 = c32 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3123 = c33 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3124 = c34 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3125 = c35 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3126 = c36 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3127 = c37 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3128 = c38 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3129 = c39 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3130 = c3a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3131 = c3b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3132 = c3c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3133 = c3d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3134 = c3e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3135 = c3f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3136 = c40 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3137 = c41 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3138 = c42 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3139 = c43 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3140 = c44 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3141 = c45 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3142 = c46 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3143 = c47 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3144 = c48 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3145 = c49 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3146 = c4a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3147 = c4b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3148 = c4c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3149 = c4d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3150 = c4e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3151 = c4f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3152 = c50 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3153 = c51 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3154 = c52 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3155 = c53 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3156 = c54 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3157 = c55 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3158 = c56 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3159 = c57 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3160 = c58 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3161 = c59 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3162 = c5a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3163 = c5b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3164 = c5c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3165 = c5d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3166 = c5e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3167 = c5f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3168 = c60 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3169 = c61 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3170 = c62 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3171 = c63 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3172 = c64 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3173 = c65 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3174 = c66 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3175 = c67 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3176 = c68 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3177 = c69 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3178 = c6a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3179 = c6b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3180 = c6c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3181 = c6d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3182 = c6e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3183 = c6f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3184 = c70 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3185 = c71 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3186 = c72 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3187 = c73 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3188 = c74 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3189 = c75 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3190 = c76 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3191 = c77 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3192 = c78 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3193 = c79 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3194 = c7a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3195 = c7b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3196 = c7c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3197 = c7d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3198 = c7e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3199 = c7f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3200 = c80 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3201 = c81 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3202 = c82 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3203 = c83 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3204 = c84 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3205 = c85 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3206 = c86 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3207 = c87 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3208 = c88 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3209 = c89 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3210 = c8a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3211 = c8b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3212 = c8c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3213 = c8d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3214 = c8e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3215 = c8f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3216 = c90 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3217 = c91 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3218 = c92 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3219 = c93 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3220 = c94 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3221 = c95 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3222 = c96 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3223 = c97 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3224 = c98 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3225 = c99 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3226 = c9a */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3227 = c9b */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3228 = c9c */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3229 = c9d */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3230 = c9e */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3231 = c9f */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3232 = ca0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3233 = ca1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3234 = ca2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3235 = ca3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3236 = ca4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3237 = ca5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3238 = ca6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3239 = ca7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3240 = ca8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3241 = ca9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3242 = caa */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3243 = cab */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3244 = cac */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3245 = cad */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3246 = cae */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3247 = caf */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3248 = cb0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3249 = cb1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3250 = cb2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3251 = cb3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3252 = cb4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3253 = cb5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3254 = cb6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3255 = cb7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3256 = cb8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3257 = cb9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3258 = cba */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3259 = cbb */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3260 = cbc */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3261 = cbd */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3262 = cbe */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3263 = cbf */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3264 = cc0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3265 = cc1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3266 = cc2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3267 = cc3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3268 = cc4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3269 = cc5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3270 = cc6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3271 = cc7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3272 = cc8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3273 = cc9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3274 = cca */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3275 = ccb */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3276 = ccc */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3277 = ccd */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3278 = cce */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3279 = ccf */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3280 = cd0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3281 = cd1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3282 = cd2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3283 = cd3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3284 = cd4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3285 = cd5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3286 = cd6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3287 = cd7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3288 = cd8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3289 = cd9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3290 = cda */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3291 = cdb */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3292 = cdc */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3293 = cdd */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3294 = cde */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3295 = cdf */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3296 = ce0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3297 = ce1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3298 = ce2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3299 = ce3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3300 = ce4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3301 = ce5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3302 = ce6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3303 = ce7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3304 = ce8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3305 = ce9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3306 = cea */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3307 = ceb */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3308 = cec */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3309 = ced */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3310 = cee */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3311 = cef */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3312 = cf0 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3313 = cf1 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3314 = cf2 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3315 = cf3 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3316 = cf4 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3317 = cf5 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3318 = cf6 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3319 = cf7 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3320 = cf8 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3321 = cf9 */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3322 = cfa */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3323 = cfb */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3324 = cfc */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3325 = cfd */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3326 = cfe */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3327 = cff */ {5, 0, 4}, /* 0x000c => 0x0c00+(256)*/
+ /* 3328 = d00 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3329 = d01 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3330 = d02 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3331 = d03 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3332 = d04 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3333 = d05 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3334 = d06 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3335 = d07 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3336 = d08 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3337 = d09 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3338 = d0a */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3339 = d0b */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3340 = d0c */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3341 = d0d */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3342 = d0e */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3343 = d0f */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3344 = d10 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3345 = d11 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3346 = d12 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3347 = d13 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3348 = d14 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3349 = d15 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3350 = d16 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3351 = d17 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3352 = d18 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3353 = d19 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3354 = d1a */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3355 = d1b */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3356 = d1c */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3357 = d1d */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3358 = d1e */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3359 = d1f */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3360 = d20 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3361 = d21 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3362 = d22 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3363 = d23 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3364 = d24 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3365 = d25 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3366 = d26 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3367 = d27 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3368 = d28 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3369 = d29 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3370 = d2a */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3371 = d2b */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3372 = d2c */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3373 = d2d */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3374 = d2e */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3375 = d2f */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3376 = d30 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3377 = d31 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3378 = d32 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3379 = d33 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3380 = d34 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3381 = d35 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3382 = d36 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3383 = d37 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3384 = d38 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3385 = d39 */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3386 = d3a */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3387 = d3b */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3388 = d3c */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3389 = d3d */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3390 = d3e */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3391 = d3f */ {14, 0, 6}, /* 0x0034 => 0x0d00+(64)*/
+ /* 3392 = d40 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3393 = d41 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3394 = d42 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3395 = d43 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3396 = d44 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3397 = d45 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3398 = d46 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3399 = d47 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3400 = d48 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3401 = d49 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3402 = d4a */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3403 = d4b */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3404 = d4c */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3405 = d4d */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3406 = d4e */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3407 = d4f */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3408 = d50 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3409 = d51 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3410 = d52 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3411 = d53 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3412 = d54 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3413 = d55 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3414 = d56 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3415 = d57 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3416 = d58 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3417 = d59 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3418 = d5a */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3419 = d5b */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3420 = d5c */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3421 = d5d */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3422 = d5e */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3423 = d5f */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3424 = d60 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3425 = d61 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3426 = d62 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3427 = d63 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3428 = d64 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3429 = d65 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3430 = d66 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3431 = d67 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3432 = d68 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3433 = d69 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3434 = d6a */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3435 = d6b */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3436 = d6c */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3437 = d6d */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3438 = d6e */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3439 = d6f */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3440 = d70 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3441 = d71 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3442 = d72 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3443 = d73 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3444 = d74 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3445 = d75 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3446 = d76 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3447 = d77 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3448 = d78 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3449 = d79 */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3450 = d7a */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3451 = d7b */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3452 = d7c */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3453 = d7d */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3454 = d7e */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3455 = d7f */ {15, 0, 6}, /* 0x0035 => 0x0d40+(64)*/
+ /* 3456 = d80 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3457 = d81 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3458 = d82 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3459 = d83 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3460 = d84 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3461 = d85 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3462 = d86 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3463 = d87 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3464 = d88 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3465 = d89 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3466 = d8a */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3467 = d8b */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3468 = d8c */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3469 = d8d */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3470 = d8e */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3471 = d8f */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3472 = d90 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3473 = d91 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3474 = d92 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3475 = d93 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3476 = d94 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3477 = d95 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3478 = d96 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3479 = d97 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3480 = d98 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3481 = d99 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3482 = d9a */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3483 = d9b */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3484 = d9c */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3485 = d9d */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3486 = d9e */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3487 = d9f */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3488 = da0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3489 = da1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3490 = da2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3491 = da3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3492 = da4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3493 = da5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3494 = da6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3495 = da7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3496 = da8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3497 = da9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3498 = daa */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3499 = dab */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3500 = dac */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3501 = dad */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3502 = dae */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3503 = daf */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3504 = db0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3505 = db1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3506 = db2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3507 = db3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3508 = db4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3509 = db5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3510 = db6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3511 = db7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3512 = db8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3513 = db9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3514 = dba */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3515 = dbb */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3516 = dbc */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3517 = dbd */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3518 = dbe */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3519 = dbf */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3520 = dc0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3521 = dc1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3522 = dc2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3523 = dc3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3524 = dc4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3525 = dc5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3526 = dc6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3527 = dc7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3528 = dc8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3529 = dc9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3530 = dca */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3531 = dcb */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3532 = dcc */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3533 = dcd */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3534 = dce */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3535 = dcf */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3536 = dd0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3537 = dd1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3538 = dd2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3539 = dd3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3540 = dd4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3541 = dd5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3542 = dd6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3543 = dd7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3544 = dd8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3545 = dd9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3546 = dda */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3547 = ddb */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3548 = ddc */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3549 = ddd */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3550 = dde */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3551 = ddf */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3552 = de0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3553 = de1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3554 = de2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3555 = de3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3556 = de4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3557 = de5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3558 = de6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3559 = de7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3560 = de8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3561 = de9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3562 = dea */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3563 = deb */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3564 = dec */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3565 = ded */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3566 = dee */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3567 = def */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3568 = df0 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3569 = df1 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3570 = df2 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3571 = df3 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3572 = df4 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3573 = df5 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3574 = df6 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3575 = df7 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3576 = df8 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3577 = df9 */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3578 = dfa */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3579 = dfb */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3580 = dfc */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3581 = dfd */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3582 = dfe */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3583 = dff */ {64, 1, 5}, /* 0x001b => 0x0d80+(128)*/
+ /* 3584 = e00 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3585 = e01 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3586 = e02 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3587 = e03 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3588 = e04 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3589 = e05 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3590 = e06 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3591 = e07 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3592 = e08 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3593 = e09 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3594 = e0a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3595 = e0b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3596 = e0c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3597 = e0d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3598 = e0e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3599 = e0f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3600 = e10 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3601 = e11 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3602 = e12 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3603 = e13 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3604 = e14 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3605 = e15 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3606 = e16 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3607 = e17 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3608 = e18 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3609 = e19 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3610 = e1a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3611 = e1b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3612 = e1c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3613 = e1d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3614 = e1e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3615 = e1f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3616 = e20 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3617 = e21 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3618 = e22 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3619 = e23 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3620 = e24 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3621 = e25 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3622 = e26 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3623 = e27 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3624 = e28 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3625 = e29 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3626 = e2a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3627 = e2b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3628 = e2c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3629 = e2d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3630 = e2e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3631 = e2f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3632 = e30 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3633 = e31 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3634 = e32 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3635 = e33 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3636 = e34 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3637 = e35 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3638 = e36 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3639 = e37 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3640 = e38 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3641 = e39 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3642 = e3a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3643 = e3b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3644 = e3c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3645 = e3d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3646 = e3e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3647 = e3f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3648 = e40 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3649 = e41 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3650 = e42 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3651 = e43 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3652 = e44 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3653 = e45 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3654 = e46 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3655 = e47 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3656 = e48 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3657 = e49 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3658 = e4a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3659 = e4b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3660 = e4c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3661 = e4d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3662 = e4e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3663 = e4f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3664 = e50 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3665 = e51 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3666 = e52 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3667 = e53 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3668 = e54 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3669 = e55 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3670 = e56 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3671 = e57 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3672 = e58 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3673 = e59 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3674 = e5a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3675 = e5b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3676 = e5c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3677 = e5d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3678 = e5e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3679 = e5f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3680 = e60 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3681 = e61 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3682 = e62 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3683 = e63 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3684 = e64 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3685 = e65 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3686 = e66 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3687 = e67 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3688 = e68 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3689 = e69 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3690 = e6a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3691 = e6b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3692 = e6c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3693 = e6d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3694 = e6e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3695 = e6f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3696 = e70 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3697 = e71 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3698 = e72 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3699 = e73 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3700 = e74 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3701 = e75 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3702 = e76 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3703 = e77 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3704 = e78 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3705 = e79 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3706 = e7a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3707 = e7b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3708 = e7c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3709 = e7d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3710 = e7e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3711 = e7f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3712 = e80 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3713 = e81 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3714 = e82 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3715 = e83 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3716 = e84 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3717 = e85 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3718 = e86 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3719 = e87 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3720 = e88 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3721 = e89 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3722 = e8a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3723 = e8b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3724 = e8c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3725 = e8d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3726 = e8e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3727 = e8f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3728 = e90 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3729 = e91 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3730 = e92 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3731 = e93 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3732 = e94 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3733 = e95 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3734 = e96 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3735 = e97 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3736 = e98 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3737 = e99 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3738 = e9a */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3739 = e9b */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3740 = e9c */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3741 = e9d */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3742 = e9e */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3743 = e9f */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3744 = ea0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3745 = ea1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3746 = ea2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3747 = ea3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3748 = ea4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3749 = ea5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3750 = ea6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3751 = ea7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3752 = ea8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3753 = ea9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3754 = eaa */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3755 = eab */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3756 = eac */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3757 = ead */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3758 = eae */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3759 = eaf */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3760 = eb0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3761 = eb1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3762 = eb2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3763 = eb3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3764 = eb4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3765 = eb5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3766 = eb6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3767 = eb7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3768 = eb8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3769 = eb9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3770 = eba */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3771 = ebb */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3772 = ebc */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3773 = ebd */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3774 = ebe */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3775 = ebf */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3776 = ec0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3777 = ec1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3778 = ec2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3779 = ec3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3780 = ec4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3781 = ec5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3782 = ec6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3783 = ec7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3784 = ec8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3785 = ec9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3786 = eca */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3787 = ecb */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3788 = ecc */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3789 = ecd */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3790 = ece */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3791 = ecf */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3792 = ed0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3793 = ed1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3794 = ed2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3795 = ed3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3796 = ed4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3797 = ed5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3798 = ed6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3799 = ed7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3800 = ed8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3801 = ed9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3802 = eda */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3803 = edb */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3804 = edc */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3805 = edd */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3806 = ede */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3807 = edf */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3808 = ee0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3809 = ee1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3810 = ee2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3811 = ee3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3812 = ee4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3813 = ee5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3814 = ee6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3815 = ee7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3816 = ee8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3817 = ee9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3818 = eea */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3819 = eeb */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3820 = eec */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3821 = eed */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3822 = eee */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3823 = eef */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3824 = ef0 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3825 = ef1 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3826 = ef2 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3827 = ef3 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3828 = ef4 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3829 = ef5 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3830 = ef6 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3831 = ef7 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3832 = ef8 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3833 = ef9 */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3834 = efa */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3835 = efb */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3836 = efc */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3837 = efd */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3838 = efe */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3839 = eff */ {6, 0, 4}, /* 0x000e => 0x0e00+(256)*/
+ /* 3840 = f00 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3841 = f01 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3842 = f02 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3843 = f03 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3844 = f04 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3845 = f05 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3846 = f06 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3847 = f07 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3848 = f08 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3849 = f09 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3850 = f0a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3851 = f0b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3852 = f0c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3853 = f0d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3854 = f0e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3855 = f0f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3856 = f10 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3857 = f11 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3858 = f12 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3859 = f13 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3860 = f14 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3861 = f15 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3862 = f16 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3863 = f17 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3864 = f18 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3865 = f19 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3866 = f1a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3867 = f1b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3868 = f1c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3869 = f1d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3870 = f1e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3871 = f1f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3872 = f20 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3873 = f21 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3874 = f22 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3875 = f23 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3876 = f24 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3877 = f25 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3878 = f26 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3879 = f27 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3880 = f28 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3881 = f29 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3882 = f2a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3883 = f2b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3884 = f2c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3885 = f2d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3886 = f2e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3887 = f2f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3888 = f30 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3889 = f31 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3890 = f32 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3891 = f33 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3892 = f34 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3893 = f35 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3894 = f36 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3895 = f37 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3896 = f38 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3897 = f39 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3898 = f3a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3899 = f3b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3900 = f3c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3901 = f3d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3902 = f3e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3903 = f3f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3904 = f40 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3905 = f41 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3906 = f42 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3907 = f43 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3908 = f44 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3909 = f45 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3910 = f46 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3911 = f47 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3912 = f48 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3913 = f49 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3914 = f4a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3915 = f4b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3916 = f4c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3917 = f4d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3918 = f4e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3919 = f4f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3920 = f50 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3921 = f51 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3922 = f52 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3923 = f53 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3924 = f54 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3925 = f55 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3926 = f56 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3927 = f57 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3928 = f58 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3929 = f59 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3930 = f5a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3931 = f5b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3932 = f5c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3933 = f5d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3934 = f5e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3935 = f5f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3936 = f60 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3937 = f61 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3938 = f62 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3939 = f63 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3940 = f64 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3941 = f65 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3942 = f66 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3943 = f67 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3944 = f68 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3945 = f69 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3946 = f6a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3947 = f6b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3948 = f6c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3949 = f6d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3950 = f6e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3951 = f6f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3952 = f70 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3953 = f71 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3954 = f72 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3955 = f73 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3956 = f74 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3957 = f75 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3958 = f76 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3959 = f77 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3960 = f78 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3961 = f79 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3962 = f7a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3963 = f7b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3964 = f7c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3965 = f7d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3966 = f7e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3967 = f7f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3968 = f80 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3969 = f81 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3970 = f82 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3971 = f83 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3972 = f84 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3973 = f85 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3974 = f86 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3975 = f87 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3976 = f88 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3977 = f89 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3978 = f8a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3979 = f8b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3980 = f8c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3981 = f8d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3982 = f8e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3983 = f8f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3984 = f90 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3985 = f91 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3986 = f92 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3987 = f93 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3988 = f94 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3989 = f95 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3990 = f96 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3991 = f97 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3992 = f98 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3993 = f99 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3994 = f9a */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3995 = f9b */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3996 = f9c */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3997 = f9d */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3998 = f9e */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 3999 = f9f */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4000 = fa0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4001 = fa1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4002 = fa2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4003 = fa3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4004 = fa4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4005 = fa5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4006 = fa6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4007 = fa7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4008 = fa8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4009 = fa9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4010 = faa */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4011 = fab */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4012 = fac */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4013 = fad */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4014 = fae */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4015 = faf */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4016 = fb0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4017 = fb1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4018 = fb2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4019 = fb3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4020 = fb4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4021 = fb5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4022 = fb6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4023 = fb7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4024 = fb8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4025 = fb9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4026 = fba */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4027 = fbb */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4028 = fbc */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4029 = fbd */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4030 = fbe */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4031 = fbf */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4032 = fc0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4033 = fc1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4034 = fc2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4035 = fc3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4036 = fc4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4037 = fc5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4038 = fc6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4039 = fc7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4040 = fc8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4041 = fc9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4042 = fca */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4043 = fcb */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4044 = fcc */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4045 = fcd */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4046 = fce */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4047 = fcf */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4048 = fd0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4049 = fd1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4050 = fd2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4051 = fd3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4052 = fd4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4053 = fd5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4054 = fd6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4055 = fd7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4056 = fd8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4057 = fd9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4058 = fda */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4059 = fdb */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4060 = fdc */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4061 = fdd */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4062 = fde */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4063 = fdf */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4064 = fe0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4065 = fe1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4066 = fe2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4067 = fe3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4068 = fe4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4069 = fe5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4070 = fe6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4071 = fe7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4072 = fe8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4073 = fe9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4074 = fea */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4075 = feb */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4076 = fec */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4077 = fed */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4078 = fee */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4079 = fef */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4080 = ff0 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4081 = ff1 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4082 = ff2 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4083 = ff3 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4084 = ff4 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4085 = ff5 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4086 = ff6 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4087 = ff7 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4088 = ff8 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4089 = ff9 */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4090 = ffa */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4091 = ffb */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4092 = ffc */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4093 = ffd */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4094 = ffe */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+ /* 4095 = fff */ {7, 0, 4}, /* 0x000f => 0x0f00+(256)*/
+};
+
+/* black table */
+BlackTable _BlackFaxTable[] = {
+ /* 0 = 0 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 1 = 1 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 2 = 2 */ {-2, 0, 12}, /* 0x0001 => 0x0002+(2)*/
+ /* 3 = 3 */ {-2, 0, 12}, /* 0x0001 => 0x0002+(2)*/
+ /* 4 = 4 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 5 = 5 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 6 = 6 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 7 = 7 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 8 = 8 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 9 = 9 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 10 = a */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 11 = b */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 12 = c */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 13 = d */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 14 = e */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 15 = f */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 16 = 10 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 17 = 11 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 18 = 12 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 19 = 13 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 20 = 14 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 21 = 15 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 22 = 16 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 23 = 17 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 24 = 18 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 25 = 19 */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 26 = 1a */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 27 = 1b */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 28 = 1c */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 29 = 1d */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 30 = 1e */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 31 = 1f */ {-1, 0, 0}, /* 0x0000 => 0x0000+(8192)*/
+ /* 32 = 20 */ {1792, 1, 11}, /* 0x0008 => 0x0020+(4)*/
+ /* 33 = 21 */ {1792, 1, 11}, /* 0x0008 => 0x0020+(4)*/
+ /* 34 = 22 */ {1792, 1, 11}, /* 0x0008 => 0x0020+(4)*/
+ /* 35 = 23 */ {1792, 1, 11}, /* 0x0008 => 0x0020+(4)*/
+ /* 36 = 24 */ {1984, 1, 12}, /* 0x0012 => 0x0024+(2)*/
+ /* 37 = 25 */ {1984, 1, 12}, /* 0x0012 => 0x0024+(2)*/
+ /* 38 = 26 */ {2048, 1, 12}, /* 0x0013 => 0x0026+(2)*/
+ /* 39 = 27 */ {2048, 1, 12}, /* 0x0013 => 0x0026+(2)*/
+ /* 40 = 28 */ {2112, 1, 12}, /* 0x0014 => 0x0028+(2)*/
+ /* 41 = 29 */ {2112, 1, 12}, /* 0x0014 => 0x0028+(2)*/
+ /* 42 = 2a */ {2176, 1, 12}, /* 0x0015 => 0x002a+(2)*/
+ /* 43 = 2b */ {2176, 1, 12}, /* 0x0015 => 0x002a+(2)*/
+ /* 44 = 2c */ {2240, 1, 12}, /* 0x0016 => 0x002c+(2)*/
+ /* 45 = 2d */ {2240, 1, 12}, /* 0x0016 => 0x002c+(2)*/
+ /* 46 = 2e */ {2304, 1, 12}, /* 0x0017 => 0x002e+(2)*/
+ /* 47 = 2f */ {2304, 1, 12}, /* 0x0017 => 0x002e+(2)*/
+ /* 48 = 30 */ {1856, 1, 11}, /* 0x000c => 0x0030+(4)*/
+ /* 49 = 31 */ {1856, 1, 11}, /* 0x000c => 0x0030+(4)*/
+ /* 50 = 32 */ {1856, 1, 11}, /* 0x000c => 0x0030+(4)*/
+ /* 51 = 33 */ {1856, 1, 11}, /* 0x000c => 0x0030+(4)*/
+ /* 52 = 34 */ {1920, 1, 11}, /* 0x000d => 0x0034+(4)*/
+ /* 53 = 35 */ {1920, 1, 11}, /* 0x000d => 0x0034+(4)*/
+ /* 54 = 36 */ {1920, 1, 11}, /* 0x000d => 0x0034+(4)*/
+ /* 55 = 37 */ {1920, 1, 11}, /* 0x000d => 0x0034+(4)*/
+ /* 56 = 38 */ {2368, 1, 12}, /* 0x001c => 0x0038+(2)*/
+ /* 57 = 39 */ {2368, 1, 12}, /* 0x001c => 0x0038+(2)*/
+ /* 58 = 3a */ {2432, 1, 12}, /* 0x001d => 0x003a+(2)*/
+ /* 59 = 3b */ {2432, 1, 12}, /* 0x001d => 0x003a+(2)*/
+ /* 60 = 3c */ {2496, 1, 12}, /* 0x001e => 0x003c+(2)*/
+ /* 61 = 3d */ {2496, 1, 12}, /* 0x001e => 0x003c+(2)*/
+ /* 62 = 3e */ {2560, 1, 12}, /* 0x001f => 0x003e+(2)*/
+ /* 63 = 3f */ {2560, 1, 12}, /* 0x001f => 0x003e+(2)*/
+ /* 64 = 40 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 65 = 41 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 66 = 42 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 67 = 43 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 68 = 44 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 69 = 45 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 70 = 46 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 71 = 47 */ {18, 0, 10}, /* 0x0008 => 0x0040+(8)*/
+ /* 72 = 48 */ {52, 0, 12}, /* 0x0024 => 0x0048+(2)*/
+ /* 73 = 49 */ {52, 0, 12}, /* 0x0024 => 0x0048+(2)*/
+ /* 74 = 4a */ {640, 1, 13}, /* 0x004a => 0x004a+(1)*/
+ /* 75 = 4b */ {704, 1, 13}, /* 0x004b => 0x004b+(1)*/
+ /* 76 = 4c */ {768, 1, 13}, /* 0x004c => 0x004c+(1)*/
+ /* 77 = 4d */ {832, 1, 13}, /* 0x004d => 0x004d+(1)*/
+ /* 78 = 4e */ {55, 0, 12}, /* 0x0027 => 0x004e+(2)*/
+ /* 79 = 4f */ {55, 0, 12}, /* 0x0027 => 0x004e+(2)*/
+ /* 80 = 50 */ {56, 0, 12}, /* 0x0028 => 0x0050+(2)*/
+ /* 81 = 51 */ {56, 0, 12}, /* 0x0028 => 0x0050+(2)*/
+ /* 82 = 52 */ {1280, 1, 13}, /* 0x0052 => 0x0052+(1)*/
+ /* 83 = 53 */ {1344, 1, 13}, /* 0x0053 => 0x0053+(1)*/
+ /* 84 = 54 */ {1408, 1, 13}, /* 0x0054 => 0x0054+(1)*/
+ /* 85 = 55 */ {1472, 1, 13}, /* 0x0055 => 0x0055+(1)*/
+ /* 86 = 56 */ {59, 0, 12}, /* 0x002b => 0x0056+(2)*/
+ /* 87 = 57 */ {59, 0, 12}, /* 0x002b => 0x0056+(2)*/
+ /* 88 = 58 */ {60, 0, 12}, /* 0x002c => 0x0058+(2)*/
+ /* 89 = 59 */ {60, 0, 12}, /* 0x002c => 0x0058+(2)*/
+ /* 90 = 5a */ {1536, 1, 13}, /* 0x005a => 0x005a+(1)*/
+ /* 91 = 5b */ {1600, 1, 13}, /* 0x005b => 0x005b+(1)*/
+ /* 92 = 5c */ {24, 0, 11}, /* 0x0017 => 0x005c+(4)*/
+ /* 93 = 5d */ {24, 0, 11}, /* 0x0017 => 0x005c+(4)*/
+ /* 94 = 5e */ {24, 0, 11}, /* 0x0017 => 0x005c+(4)*/
+ /* 95 = 5f */ {24, 0, 11}, /* 0x0017 => 0x005c+(4)*/
+ /* 96 = 60 */ {25, 0, 11}, /* 0x0018 => 0x0060+(4)*/
+ /* 97 = 61 */ {25, 0, 11}, /* 0x0018 => 0x0060+(4)*/
+ /* 98 = 62 */ {25, 0, 11}, /* 0x0018 => 0x0060+(4)*/
+ /* 99 = 63 */ {25, 0, 11}, /* 0x0018 => 0x0060+(4)*/
+ /* 100 = 64 */ {1664, 1, 13}, /* 0x0064 => 0x0064+(1)*/
+ /* 101 = 65 */ {1728, 1, 13}, /* 0x0065 => 0x0065+(1)*/
+ /* 102 = 66 */ {320, 1, 12}, /* 0x0033 => 0x0066+(2)*/
+ /* 103 = 67 */ {320, 1, 12}, /* 0x0033 => 0x0066+(2)*/
+ /* 104 = 68 */ {384, 1, 12}, /* 0x0034 => 0x0068+(2)*/
+ /* 105 = 69 */ {384, 1, 12}, /* 0x0034 => 0x0068+(2)*/
+ /* 106 = 6a */ {448, 1, 12}, /* 0x0035 => 0x006a+(2)*/
+ /* 107 = 6b */ {448, 1, 12}, /* 0x0035 => 0x006a+(2)*/
+ /* 108 = 6c */ {512, 1, 13}, /* 0x006c => 0x006c+(1)*/
+ /* 109 = 6d */ {576, 1, 13}, /* 0x006d => 0x006d+(1)*/
+ /* 110 = 6e */ {53, 0, 12}, /* 0x0037 => 0x006e+(2)*/
+ /* 111 = 6f */ {53, 0, 12}, /* 0x0037 => 0x006e+(2)*/
+ /* 112 = 70 */ {54, 0, 12}, /* 0x0038 => 0x0070+(2)*/
+ /* 113 = 71 */ {54, 0, 12}, /* 0x0038 => 0x0070+(2)*/
+ /* 114 = 72 */ {896, 1, 13}, /* 0x0072 => 0x0072+(1)*/
+ /* 115 = 73 */ {960, 1, 13}, /* 0x0073 => 0x0073+(1)*/
+ /* 116 = 74 */ {1024, 1, 13}, /* 0x0074 => 0x0074+(1)*/
+ /* 117 = 75 */ {1088, 1, 13}, /* 0x0075 => 0x0075+(1)*/
+ /* 118 = 76 */ {1152, 1, 13}, /* 0x0076 => 0x0076+(1)*/
+ /* 119 = 77 */ {1216, 1, 13}, /* 0x0077 => 0x0077+(1)*/
+ /* 120 = 78 */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 121 = 79 */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 122 = 7a */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 123 = 7b */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 124 = 7c */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 125 = 7d */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 126 = 7e */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 127 = 7f */ {64, 1, 10}, /* 0x000f => 0x0078+(8)*/
+ /* 128 = 80 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 129 = 81 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 130 = 82 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 131 = 83 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 132 = 84 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 133 = 85 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 134 = 86 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 135 = 87 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 136 = 88 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 137 = 89 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 138 = 8a */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 139 = 8b */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 140 = 8c */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 141 = 8d */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 142 = 8e */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 143 = 8f */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 144 = 90 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 145 = 91 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 146 = 92 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 147 = 93 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 148 = 94 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 149 = 95 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 150 = 96 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 151 = 97 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 152 = 98 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 153 = 99 */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 154 = 9a */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 155 = 9b */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 156 = 9c */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 157 = 9d */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 158 = 9e */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 159 = 9f */ {13, 0, 8}, /* 0x0004 => 0x0080+(32)*/
+ /* 160 = a0 */ {23, 0, 11}, /* 0x0028 => 0x00a0+(4)*/
+ /* 161 = a1 */ {23, 0, 11}, /* 0x0028 => 0x00a0+(4)*/
+ /* 162 = a2 */ {23, 0, 11}, /* 0x0028 => 0x00a0+(4)*/
+ /* 163 = a3 */ {23, 0, 11}, /* 0x0028 => 0x00a0+(4)*/
+ /* 164 = a4 */ {50, 0, 12}, /* 0x0052 => 0x00a4+(2)*/
+ /* 165 = a5 */ {50, 0, 12}, /* 0x0052 => 0x00a4+(2)*/
+ /* 166 = a6 */ {51, 0, 12}, /* 0x0053 => 0x00a6+(2)*/
+ /* 167 = a7 */ {51, 0, 12}, /* 0x0053 => 0x00a6+(2)*/
+ /* 168 = a8 */ {44, 0, 12}, /* 0x0054 => 0x00a8+(2)*/
+ /* 169 = a9 */ {44, 0, 12}, /* 0x0054 => 0x00a8+(2)*/
+ /* 170 = aa */ {45, 0, 12}, /* 0x0055 => 0x00aa+(2)*/
+ /* 171 = ab */ {45, 0, 12}, /* 0x0055 => 0x00aa+(2)*/
+ /* 172 = ac */ {46, 0, 12}, /* 0x0056 => 0x00ac+(2)*/
+ /* 173 = ad */ {46, 0, 12}, /* 0x0056 => 0x00ac+(2)*/
+ /* 174 = ae */ {47, 0, 12}, /* 0x0057 => 0x00ae+(2)*/
+ /* 175 = af */ {47, 0, 12}, /* 0x0057 => 0x00ae+(2)*/
+ /* 176 = b0 */ {57, 0, 12}, /* 0x0058 => 0x00b0+(2)*/
+ /* 177 = b1 */ {57, 0, 12}, /* 0x0058 => 0x00b0+(2)*/
+ /* 178 = b2 */ {58, 0, 12}, /* 0x0059 => 0x00b2+(2)*/
+ /* 179 = b3 */ {58, 0, 12}, /* 0x0059 => 0x00b2+(2)*/
+ /* 180 = b4 */ {61, 0, 12}, /* 0x005a => 0x00b4+(2)*/
+ /* 181 = b5 */ {61, 0, 12}, /* 0x005a => 0x00b4+(2)*/
+ /* 182 = b6 */ {256, 1, 12}, /* 0x005b => 0x00b6+(2)*/
+ /* 183 = b7 */ {256, 1, 12}, /* 0x005b => 0x00b6+(2)*/
+ /* 184 = b8 */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 185 = b9 */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 186 = ba */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 187 = bb */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 188 = bc */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 189 = bd */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 190 = be */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 191 = bf */ {16, 0, 10}, /* 0x0017 => 0x00b8+(8)*/
+ /* 192 = c0 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 193 = c1 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 194 = c2 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 195 = c3 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 196 = c4 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 197 = c5 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 198 = c6 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 199 = c7 */ {17, 0, 10}, /* 0x0018 => 0x00c0+(8)*/
+ /* 200 = c8 */ {48, 0, 12}, /* 0x0064 => 0x00c8+(2)*/
+ /* 201 = c9 */ {48, 0, 12}, /* 0x0064 => 0x00c8+(2)*/
+ /* 202 = ca */ {49, 0, 12}, /* 0x0065 => 0x00ca+(2)*/
+ /* 203 = cb */ {49, 0, 12}, /* 0x0065 => 0x00ca+(2)*/
+ /* 204 = cc */ {62, 0, 12}, /* 0x0066 => 0x00cc+(2)*/
+ /* 205 = cd */ {62, 0, 12}, /* 0x0066 => 0x00cc+(2)*/
+ /* 206 = ce */ {63, 0, 12}, /* 0x0067 => 0x00ce+(2)*/
+ /* 207 = cf */ {63, 0, 12}, /* 0x0067 => 0x00ce+(2)*/
+ /* 208 = d0 */ {30, 0, 12}, /* 0x0068 => 0x00d0+(2)*/
+ /* 209 = d1 */ {30, 0, 12}, /* 0x0068 => 0x00d0+(2)*/
+ /* 210 = d2 */ {31, 0, 12}, /* 0x0069 => 0x00d2+(2)*/
+ /* 211 = d3 */ {31, 0, 12}, /* 0x0069 => 0x00d2+(2)*/
+ /* 212 = d4 */ {32, 0, 12}, /* 0x006a => 0x00d4+(2)*/
+ /* 213 = d5 */ {32, 0, 12}, /* 0x006a => 0x00d4+(2)*/
+ /* 214 = d6 */ {33, 0, 12}, /* 0x006b => 0x00d6+(2)*/
+ /* 215 = d7 */ {33, 0, 12}, /* 0x006b => 0x00d6+(2)*/
+ /* 216 = d8 */ {40, 0, 12}, /* 0x006c => 0x00d8+(2)*/
+ /* 217 = d9 */ {40, 0, 12}, /* 0x006c => 0x00d8+(2)*/
+ /* 218 = da */ {41, 0, 12}, /* 0x006d => 0x00da+(2)*/
+ /* 219 = db */ {41, 0, 12}, /* 0x006d => 0x00da+(2)*/
+ /* 220 = dc */ {22, 0, 11}, /* 0x0037 => 0x00dc+(4)*/
+ /* 221 = dd */ {22, 0, 11}, /* 0x0037 => 0x00dc+(4)*/
+ /* 222 = de */ {22, 0, 11}, /* 0x0037 => 0x00dc+(4)*/
+ /* 223 = df */ {22, 0, 11}, /* 0x0037 => 0x00dc+(4)*/
+ /* 224 = e0 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 225 = e1 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 226 = e2 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 227 = e3 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 228 = e4 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 229 = e5 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 230 = e6 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 231 = e7 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 232 = e8 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 233 = e9 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 234 = ea */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 235 = eb */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 236 = ec */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 237 = ed */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 238 = ee */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 239 = ef */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 240 = f0 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 241 = f1 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 242 = f2 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 243 = f3 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 244 = f4 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 245 = f5 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 246 = f6 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 247 = f7 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 248 = f8 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 249 = f9 */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 250 = fa */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 251 = fb */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 252 = fc */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 253 = fd */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 254 = fe */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 255 = ff */ {14, 0, 8}, /* 0x0007 => 0x00e0+(32)*/
+ /* 256 = 100 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 257 = 101 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 258 = 102 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 259 = 103 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 260 = 104 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 261 = 105 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 262 = 106 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 263 = 107 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 264 = 108 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 265 = 109 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 266 = 10a */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 267 = 10b */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 268 = 10c */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 269 = 10d */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 270 = 10e */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 271 = 10f */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 272 = 110 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 273 = 111 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 274 = 112 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 275 = 113 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 276 = 114 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 277 = 115 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 278 = 116 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 279 = 117 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 280 = 118 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 281 = 119 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 282 = 11a */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 283 = 11b */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 284 = 11c */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 285 = 11d */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 286 = 11e */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 287 = 11f */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 288 = 120 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 289 = 121 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 290 = 122 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 291 = 123 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 292 = 124 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 293 = 125 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 294 = 126 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 295 = 127 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 296 = 128 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 297 = 129 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 298 = 12a */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 299 = 12b */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 300 = 12c */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 301 = 12d */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 302 = 12e */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 303 = 12f */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 304 = 130 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 305 = 131 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 306 = 132 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 307 = 133 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 308 = 134 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 309 = 135 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 310 = 136 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 311 = 137 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 312 = 138 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 313 = 139 */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 314 = 13a */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 315 = 13b */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 316 = 13c */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 317 = 13d */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 318 = 13e */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 319 = 13f */ {10, 0, 7}, /* 0x0004 => 0x0100+(64)*/
+ /* 320 = 140 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 321 = 141 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 322 = 142 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 323 = 143 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 324 = 144 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 325 = 145 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 326 = 146 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 327 = 147 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 328 = 148 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 329 = 149 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 330 = 14a */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 331 = 14b */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 332 = 14c */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 333 = 14d */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 334 = 14e */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 335 = 14f */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 336 = 150 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 337 = 151 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 338 = 152 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 339 = 153 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 340 = 154 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 341 = 155 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 342 = 156 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 343 = 157 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 344 = 158 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 345 = 159 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 346 = 15a */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 347 = 15b */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 348 = 15c */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 349 = 15d */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 350 = 15e */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 351 = 15f */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 352 = 160 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 353 = 161 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 354 = 162 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 355 = 163 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 356 = 164 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 357 = 165 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 358 = 166 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 359 = 167 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 360 = 168 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 361 = 169 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 362 = 16a */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 363 = 16b */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 364 = 16c */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 365 = 16d */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 366 = 16e */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 367 = 16f */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 368 = 170 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 369 = 171 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 370 = 172 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 371 = 173 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 372 = 174 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 373 = 175 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 374 = 176 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 375 = 177 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 376 = 178 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 377 = 179 */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 378 = 17a */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 379 = 17b */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 380 = 17c */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 381 = 17d */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 382 = 17e */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 383 = 17f */ {11, 0, 7}, /* 0x0005 => 0x0140+(64)*/
+ /* 384 = 180 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 385 = 181 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 386 = 182 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 387 = 183 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 388 = 184 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 389 = 185 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 390 = 186 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 391 = 187 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 392 = 188 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 393 = 189 */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 394 = 18a */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 395 = 18b */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 396 = 18c */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 397 = 18d */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 398 = 18e */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 399 = 18f */ {15, 0, 9}, /* 0x0018 => 0x0180+(16)*/
+ /* 400 = 190 */ {128, 1, 12}, /* 0x00c8 => 0x0190+(2)*/
+ /* 401 = 191 */ {128, 1, 12}, /* 0x00c8 => 0x0190+(2)*/
+ /* 402 = 192 */ {192, 1, 12}, /* 0x00c9 => 0x0192+(2)*/
+ /* 403 = 193 */ {192, 1, 12}, /* 0x00c9 => 0x0192+(2)*/
+ /* 404 = 194 */ {26, 0, 12}, /* 0x00ca => 0x0194+(2)*/
+ /* 405 = 195 */ {26, 0, 12}, /* 0x00ca => 0x0194+(2)*/
+ /* 406 = 196 */ {27, 0, 12}, /* 0x00cb => 0x0196+(2)*/
+ /* 407 = 197 */ {27, 0, 12}, /* 0x00cb => 0x0196+(2)*/
+ /* 408 = 198 */ {28, 0, 12}, /* 0x00cc => 0x0198+(2)*/
+ /* 409 = 199 */ {28, 0, 12}, /* 0x00cc => 0x0198+(2)*/
+ /* 410 = 19a */ {29, 0, 12}, /* 0x00cd => 0x019a+(2)*/
+ /* 411 = 19b */ {29, 0, 12}, /* 0x00cd => 0x019a+(2)*/
+ /* 412 = 19c */ {19, 0, 11}, /* 0x0067 => 0x019c+(4)*/
+ /* 413 = 19d */ {19, 0, 11}, /* 0x0067 => 0x019c+(4)*/
+ /* 414 = 19e */ {19, 0, 11}, /* 0x0067 => 0x019c+(4)*/
+ /* 415 = 19f */ {19, 0, 11}, /* 0x0067 => 0x019c+(4)*/
+ /* 416 = 1a0 */ {20, 0, 11}, /* 0x0068 => 0x01a0+(4)*/
+ /* 417 = 1a1 */ {20, 0, 11}, /* 0x0068 => 0x01a0+(4)*/
+ /* 418 = 1a2 */ {20, 0, 11}, /* 0x0068 => 0x01a0+(4)*/
+ /* 419 = 1a3 */ {20, 0, 11}, /* 0x0068 => 0x01a0+(4)*/
+ /* 420 = 1a4 */ {34, 0, 12}, /* 0x00d2 => 0x01a4+(2)*/
+ /* 421 = 1a5 */ {34, 0, 12}, /* 0x00d2 => 0x01a4+(2)*/
+ /* 422 = 1a6 */ {35, 0, 12}, /* 0x00d3 => 0x01a6+(2)*/
+ /* 423 = 1a7 */ {35, 0, 12}, /* 0x00d3 => 0x01a6+(2)*/
+ /* 424 = 1a8 */ {36, 0, 12}, /* 0x00d4 => 0x01a8+(2)*/
+ /* 425 = 1a9 */ {36, 0, 12}, /* 0x00d4 => 0x01a8+(2)*/
+ /* 426 = 1aa */ {37, 0, 12}, /* 0x00d5 => 0x01aa+(2)*/
+ /* 427 = 1ab */ {37, 0, 12}, /* 0x00d5 => 0x01aa+(2)*/
+ /* 428 = 1ac */ {38, 0, 12}, /* 0x00d6 => 0x01ac+(2)*/
+ /* 429 = 1ad */ {38, 0, 12}, /* 0x00d6 => 0x01ac+(2)*/
+ /* 430 = 1ae */ {39, 0, 12}, /* 0x00d7 => 0x01ae+(2)*/
+ /* 431 = 1af */ {39, 0, 12}, /* 0x00d7 => 0x01ae+(2)*/
+ /* 432 = 1b0 */ {21, 0, 11}, /* 0x006c => 0x01b0+(4)*/
+ /* 433 = 1b1 */ {21, 0, 11}, /* 0x006c => 0x01b0+(4)*/
+ /* 434 = 1b2 */ {21, 0, 11}, /* 0x006c => 0x01b0+(4)*/
+ /* 435 = 1b3 */ {21, 0, 11}, /* 0x006c => 0x01b0+(4)*/
+ /* 436 = 1b4 */ {42, 0, 12}, /* 0x00da => 0x01b4+(2)*/
+ /* 437 = 1b5 */ {42, 0, 12}, /* 0x00da => 0x01b4+(2)*/
+ /* 438 = 1b6 */ {43, 0, 12}, /* 0x00db => 0x01b6+(2)*/
+ /* 439 = 1b7 */ {43, 0, 12}, /* 0x00db => 0x01b6+(2)*/
+ /* 440 = 1b8 */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 441 = 1b9 */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 442 = 1ba */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 443 = 1bb */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 444 = 1bc */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 445 = 1bd */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 446 = 1be */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 447 = 1bf */ {0, 0, 10}, /* 0x0037 => 0x01b8+(8)*/
+ /* 448 = 1c0 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 449 = 1c1 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 450 = 1c2 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 451 = 1c3 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 452 = 1c4 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 453 = 1c5 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 454 = 1c6 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 455 = 1c7 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 456 = 1c8 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 457 = 1c9 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 458 = 1ca */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 459 = 1cb */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 460 = 1cc */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 461 = 1cd */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 462 = 1ce */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 463 = 1cf */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 464 = 1d0 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 465 = 1d1 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 466 = 1d2 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 467 = 1d3 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 468 = 1d4 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 469 = 1d5 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 470 = 1d6 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 471 = 1d7 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 472 = 1d8 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 473 = 1d9 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 474 = 1da */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 475 = 1db */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 476 = 1dc */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 477 = 1dd */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 478 = 1de */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 479 = 1df */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 480 = 1e0 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 481 = 1e1 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 482 = 1e2 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 483 = 1e3 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 484 = 1e4 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 485 = 1e5 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 486 = 1e6 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 487 = 1e7 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 488 = 1e8 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 489 = 1e9 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 490 = 1ea */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 491 = 1eb */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 492 = 1ec */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 493 = 1ed */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 494 = 1ee */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 495 = 1ef */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 496 = 1f0 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 497 = 1f1 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 498 = 1f2 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 499 = 1f3 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 500 = 1f4 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 501 = 1f5 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 502 = 1f6 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 503 = 1f7 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 504 = 1f8 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 505 = 1f9 */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 506 = 1fa */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 507 = 1fb */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 508 = 1fc */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 509 = 1fd */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 510 = 1fe */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 511 = 1ff */ {12, 0, 7}, /* 0x0007 => 0x01c0+(64)*/
+ /* 512 = 200 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 513 = 201 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 514 = 202 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 515 = 203 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 516 = 204 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 517 = 205 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 518 = 206 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 519 = 207 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 520 = 208 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 521 = 209 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 522 = 20a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 523 = 20b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 524 = 20c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 525 = 20d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 526 = 20e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 527 = 20f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 528 = 210 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 529 = 211 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 530 = 212 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 531 = 213 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 532 = 214 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 533 = 215 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 534 = 216 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 535 = 217 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 536 = 218 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 537 = 219 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 538 = 21a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 539 = 21b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 540 = 21c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 541 = 21d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 542 = 21e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 543 = 21f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 544 = 220 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 545 = 221 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 546 = 222 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 547 = 223 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 548 = 224 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 549 = 225 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 550 = 226 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 551 = 227 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 552 = 228 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 553 = 229 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 554 = 22a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 555 = 22b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 556 = 22c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 557 = 22d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 558 = 22e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 559 = 22f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 560 = 230 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 561 = 231 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 562 = 232 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 563 = 233 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 564 = 234 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 565 = 235 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 566 = 236 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 567 = 237 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 568 = 238 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 569 = 239 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 570 = 23a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 571 = 23b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 572 = 23c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 573 = 23d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 574 = 23e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 575 = 23f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 576 = 240 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 577 = 241 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 578 = 242 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 579 = 243 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 580 = 244 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 581 = 245 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 582 = 246 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 583 = 247 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 584 = 248 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 585 = 249 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 586 = 24a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 587 = 24b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 588 = 24c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 589 = 24d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 590 = 24e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 591 = 24f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 592 = 250 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 593 = 251 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 594 = 252 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 595 = 253 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 596 = 254 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 597 = 255 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 598 = 256 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 599 = 257 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 600 = 258 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 601 = 259 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 602 = 25a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 603 = 25b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 604 = 25c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 605 = 25d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 606 = 25e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 607 = 25f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 608 = 260 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 609 = 261 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 610 = 262 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 611 = 263 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 612 = 264 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 613 = 265 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 614 = 266 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 615 = 267 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 616 = 268 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 617 = 269 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 618 = 26a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 619 = 26b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 620 = 26c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 621 = 26d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 622 = 26e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 623 = 26f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 624 = 270 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 625 = 271 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 626 = 272 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 627 = 273 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 628 = 274 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 629 = 275 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 630 = 276 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 631 = 277 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 632 = 278 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 633 = 279 */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 634 = 27a */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 635 = 27b */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 636 = 27c */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 637 = 27d */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 638 = 27e */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 639 = 27f */ {9, 0, 6}, /* 0x0004 => 0x0200+(128)*/
+ /* 640 = 280 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 641 = 281 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 642 = 282 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 643 = 283 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 644 = 284 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 645 = 285 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 646 = 286 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 647 = 287 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 648 = 288 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 649 = 289 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 650 = 28a */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 651 = 28b */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 652 = 28c */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 653 = 28d */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 654 = 28e */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 655 = 28f */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 656 = 290 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 657 = 291 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 658 = 292 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 659 = 293 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 660 = 294 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 661 = 295 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 662 = 296 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 663 = 297 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 664 = 298 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 665 = 299 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 666 = 29a */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 667 = 29b */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 668 = 29c */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 669 = 29d */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 670 = 29e */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 671 = 29f */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 672 = 2a0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 673 = 2a1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 674 = 2a2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 675 = 2a3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 676 = 2a4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 677 = 2a5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 678 = 2a6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 679 = 2a7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 680 = 2a8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 681 = 2a9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 682 = 2aa */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 683 = 2ab */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 684 = 2ac */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 685 = 2ad */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 686 = 2ae */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 687 = 2af */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 688 = 2b0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 689 = 2b1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 690 = 2b2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 691 = 2b3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 692 = 2b4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 693 = 2b5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 694 = 2b6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 695 = 2b7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 696 = 2b8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 697 = 2b9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 698 = 2ba */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 699 = 2bb */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 700 = 2bc */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 701 = 2bd */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 702 = 2be */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 703 = 2bf */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 704 = 2c0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 705 = 2c1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 706 = 2c2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 707 = 2c3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 708 = 2c4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 709 = 2c5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 710 = 2c6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 711 = 2c7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 712 = 2c8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 713 = 2c9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 714 = 2ca */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 715 = 2cb */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 716 = 2cc */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 717 = 2cd */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 718 = 2ce */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 719 = 2cf */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 720 = 2d0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 721 = 2d1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 722 = 2d2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 723 = 2d3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 724 = 2d4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 725 = 2d5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 726 = 2d6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 727 = 2d7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 728 = 2d8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 729 = 2d9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 730 = 2da */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 731 = 2db */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 732 = 2dc */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 733 = 2dd */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 734 = 2de */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 735 = 2df */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 736 = 2e0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 737 = 2e1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 738 = 2e2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 739 = 2e3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 740 = 2e4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 741 = 2e5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 742 = 2e6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 743 = 2e7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 744 = 2e8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 745 = 2e9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 746 = 2ea */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 747 = 2eb */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 748 = 2ec */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 749 = 2ed */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 750 = 2ee */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 751 = 2ef */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 752 = 2f0 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 753 = 2f1 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 754 = 2f2 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 755 = 2f3 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 756 = 2f4 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 757 = 2f5 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 758 = 2f6 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 759 = 2f7 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 760 = 2f8 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 761 = 2f9 */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 762 = 2fa */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 763 = 2fb */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 764 = 2fc */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 765 = 2fd */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 766 = 2fe */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 767 = 2ff */ {8, 0, 6}, /* 0x0005 => 0x0280+(128)*/
+ /* 768 = 300 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 769 = 301 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 770 = 302 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 771 = 303 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 772 = 304 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 773 = 305 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 774 = 306 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 775 = 307 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 776 = 308 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 777 = 309 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 778 = 30a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 779 = 30b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 780 = 30c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 781 = 30d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 782 = 30e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 783 = 30f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 784 = 310 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 785 = 311 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 786 = 312 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 787 = 313 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 788 = 314 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 789 = 315 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 790 = 316 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 791 = 317 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 792 = 318 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 793 = 319 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 794 = 31a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 795 = 31b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 796 = 31c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 797 = 31d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 798 = 31e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 799 = 31f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 800 = 320 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 801 = 321 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 802 = 322 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 803 = 323 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 804 = 324 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 805 = 325 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 806 = 326 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 807 = 327 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 808 = 328 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 809 = 329 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 810 = 32a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 811 = 32b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 812 = 32c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 813 = 32d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 814 = 32e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 815 = 32f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 816 = 330 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 817 = 331 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 818 = 332 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 819 = 333 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 820 = 334 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 821 = 335 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 822 = 336 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 823 = 337 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 824 = 338 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 825 = 339 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 826 = 33a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 827 = 33b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 828 = 33c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 829 = 33d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 830 = 33e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 831 = 33f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 832 = 340 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 833 = 341 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 834 = 342 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 835 = 343 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 836 = 344 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 837 = 345 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 838 = 346 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 839 = 347 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 840 = 348 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 841 = 349 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 842 = 34a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 843 = 34b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 844 = 34c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 845 = 34d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 846 = 34e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 847 = 34f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 848 = 350 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 849 = 351 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 850 = 352 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 851 = 353 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 852 = 354 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 853 = 355 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 854 = 356 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 855 = 357 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 856 = 358 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 857 = 359 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 858 = 35a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 859 = 35b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 860 = 35c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 861 = 35d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 862 = 35e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 863 = 35f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 864 = 360 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 865 = 361 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 866 = 362 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 867 = 363 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 868 = 364 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 869 = 365 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 870 = 366 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 871 = 367 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 872 = 368 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 873 = 369 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 874 = 36a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 875 = 36b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 876 = 36c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 877 = 36d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 878 = 36e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 879 = 36f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 880 = 370 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 881 = 371 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 882 = 372 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 883 = 373 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 884 = 374 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 885 = 375 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 886 = 376 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 887 = 377 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 888 = 378 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 889 = 379 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 890 = 37a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 891 = 37b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 892 = 37c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 893 = 37d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 894 = 37e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 895 = 37f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 896 = 380 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 897 = 381 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 898 = 382 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 899 = 383 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 900 = 384 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 901 = 385 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 902 = 386 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 903 = 387 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 904 = 388 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 905 = 389 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 906 = 38a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 907 = 38b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 908 = 38c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 909 = 38d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 910 = 38e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 911 = 38f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 912 = 390 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 913 = 391 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 914 = 392 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 915 = 393 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 916 = 394 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 917 = 395 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 918 = 396 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 919 = 397 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 920 = 398 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 921 = 399 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 922 = 39a */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 923 = 39b */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 924 = 39c */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 925 = 39d */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 926 = 39e */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 927 = 39f */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 928 = 3a0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 929 = 3a1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 930 = 3a2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 931 = 3a3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 932 = 3a4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 933 = 3a5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 934 = 3a6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 935 = 3a7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 936 = 3a8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 937 = 3a9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 938 = 3aa */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 939 = 3ab */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 940 = 3ac */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 941 = 3ad */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 942 = 3ae */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 943 = 3af */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 944 = 3b0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 945 = 3b1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 946 = 3b2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 947 = 3b3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 948 = 3b4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 949 = 3b5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 950 = 3b6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 951 = 3b7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 952 = 3b8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 953 = 3b9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 954 = 3ba */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 955 = 3bb */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 956 = 3bc */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 957 = 3bd */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 958 = 3be */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 959 = 3bf */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 960 = 3c0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 961 = 3c1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 962 = 3c2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 963 = 3c3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 964 = 3c4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 965 = 3c5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 966 = 3c6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 967 = 3c7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 968 = 3c8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 969 = 3c9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 970 = 3ca */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 971 = 3cb */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 972 = 3cc */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 973 = 3cd */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 974 = 3ce */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 975 = 3cf */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 976 = 3d0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 977 = 3d1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 978 = 3d2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 979 = 3d3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 980 = 3d4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 981 = 3d5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 982 = 3d6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 983 = 3d7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 984 = 3d8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 985 = 3d9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 986 = 3da */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 987 = 3db */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 988 = 3dc */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 989 = 3dd */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 990 = 3de */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 991 = 3df */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 992 = 3e0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 993 = 3e1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 994 = 3e2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 995 = 3e3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 996 = 3e4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 997 = 3e5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 998 = 3e6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 999 = 3e7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1000 = 3e8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1001 = 3e9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1002 = 3ea */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1003 = 3eb */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1004 = 3ec */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1005 = 3ed */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1006 = 3ee */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1007 = 3ef */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1008 = 3f0 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1009 = 3f1 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1010 = 3f2 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1011 = 3f3 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1012 = 3f4 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1013 = 3f5 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1014 = 3f6 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1015 = 3f7 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1016 = 3f8 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1017 = 3f9 */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1018 = 3fa */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1019 = 3fb */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1020 = 3fc */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1021 = 3fd */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1022 = 3fe */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1023 = 3ff */ {7, 0, 5}, /* 0x0003 => 0x0300+(256)*/
+ /* 1024 = 400 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1025 = 401 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1026 = 402 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1027 = 403 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1028 = 404 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1029 = 405 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1030 = 406 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1031 = 407 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1032 = 408 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1033 = 409 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1034 = 40a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1035 = 40b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1036 = 40c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1037 = 40d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1038 = 40e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1039 = 40f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1040 = 410 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1041 = 411 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1042 = 412 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1043 = 413 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1044 = 414 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1045 = 415 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1046 = 416 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1047 = 417 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1048 = 418 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1049 = 419 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1050 = 41a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1051 = 41b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1052 = 41c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1053 = 41d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1054 = 41e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1055 = 41f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1056 = 420 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1057 = 421 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1058 = 422 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1059 = 423 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1060 = 424 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1061 = 425 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1062 = 426 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1063 = 427 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1064 = 428 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1065 = 429 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1066 = 42a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1067 = 42b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1068 = 42c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1069 = 42d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1070 = 42e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1071 = 42f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1072 = 430 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1073 = 431 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1074 = 432 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1075 = 433 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1076 = 434 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1077 = 435 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1078 = 436 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1079 = 437 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1080 = 438 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1081 = 439 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1082 = 43a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1083 = 43b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1084 = 43c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1085 = 43d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1086 = 43e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1087 = 43f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1088 = 440 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1089 = 441 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1090 = 442 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1091 = 443 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1092 = 444 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1093 = 445 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1094 = 446 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1095 = 447 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1096 = 448 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1097 = 449 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1098 = 44a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1099 = 44b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1100 = 44c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1101 = 44d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1102 = 44e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1103 = 44f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1104 = 450 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1105 = 451 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1106 = 452 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1107 = 453 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1108 = 454 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1109 = 455 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1110 = 456 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1111 = 457 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1112 = 458 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1113 = 459 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1114 = 45a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1115 = 45b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1116 = 45c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1117 = 45d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1118 = 45e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1119 = 45f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1120 = 460 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1121 = 461 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1122 = 462 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1123 = 463 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1124 = 464 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1125 = 465 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1126 = 466 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1127 = 467 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1128 = 468 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1129 = 469 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1130 = 46a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1131 = 46b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1132 = 46c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1133 = 46d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1134 = 46e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1135 = 46f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1136 = 470 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1137 = 471 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1138 = 472 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1139 = 473 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1140 = 474 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1141 = 475 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1142 = 476 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1143 = 477 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1144 = 478 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1145 = 479 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1146 = 47a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1147 = 47b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1148 = 47c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1149 = 47d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1150 = 47e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1151 = 47f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1152 = 480 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1153 = 481 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1154 = 482 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1155 = 483 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1156 = 484 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1157 = 485 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1158 = 486 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1159 = 487 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1160 = 488 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1161 = 489 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1162 = 48a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1163 = 48b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1164 = 48c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1165 = 48d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1166 = 48e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1167 = 48f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1168 = 490 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1169 = 491 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1170 = 492 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1171 = 493 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1172 = 494 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1173 = 495 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1174 = 496 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1175 = 497 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1176 = 498 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1177 = 499 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1178 = 49a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1179 = 49b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1180 = 49c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1181 = 49d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1182 = 49e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1183 = 49f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1184 = 4a0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1185 = 4a1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1186 = 4a2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1187 = 4a3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1188 = 4a4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1189 = 4a5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1190 = 4a6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1191 = 4a7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1192 = 4a8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1193 = 4a9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1194 = 4aa */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1195 = 4ab */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1196 = 4ac */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1197 = 4ad */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1198 = 4ae */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1199 = 4af */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1200 = 4b0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1201 = 4b1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1202 = 4b2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1203 = 4b3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1204 = 4b4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1205 = 4b5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1206 = 4b6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1207 = 4b7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1208 = 4b8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1209 = 4b9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1210 = 4ba */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1211 = 4bb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1212 = 4bc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1213 = 4bd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1214 = 4be */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1215 = 4bf */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1216 = 4c0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1217 = 4c1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1218 = 4c2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1219 = 4c3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1220 = 4c4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1221 = 4c5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1222 = 4c6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1223 = 4c7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1224 = 4c8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1225 = 4c9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1226 = 4ca */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1227 = 4cb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1228 = 4cc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1229 = 4cd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1230 = 4ce */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1231 = 4cf */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1232 = 4d0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1233 = 4d1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1234 = 4d2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1235 = 4d3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1236 = 4d4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1237 = 4d5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1238 = 4d6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1239 = 4d7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1240 = 4d8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1241 = 4d9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1242 = 4da */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1243 = 4db */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1244 = 4dc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1245 = 4dd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1246 = 4de */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1247 = 4df */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1248 = 4e0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1249 = 4e1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1250 = 4e2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1251 = 4e3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1252 = 4e4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1253 = 4e5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1254 = 4e6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1255 = 4e7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1256 = 4e8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1257 = 4e9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1258 = 4ea */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1259 = 4eb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1260 = 4ec */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1261 = 4ed */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1262 = 4ee */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1263 = 4ef */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1264 = 4f0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1265 = 4f1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1266 = 4f2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1267 = 4f3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1268 = 4f4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1269 = 4f5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1270 = 4f6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1271 = 4f7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1272 = 4f8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1273 = 4f9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1274 = 4fa */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1275 = 4fb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1276 = 4fc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1277 = 4fd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1278 = 4fe */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1279 = 4ff */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1280 = 500 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1281 = 501 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1282 = 502 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1283 = 503 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1284 = 504 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1285 = 505 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1286 = 506 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1287 = 507 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1288 = 508 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1289 = 509 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1290 = 50a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1291 = 50b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1292 = 50c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1293 = 50d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1294 = 50e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1295 = 50f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1296 = 510 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1297 = 511 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1298 = 512 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1299 = 513 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1300 = 514 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1301 = 515 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1302 = 516 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1303 = 517 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1304 = 518 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1305 = 519 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1306 = 51a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1307 = 51b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1308 = 51c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1309 = 51d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1310 = 51e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1311 = 51f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1312 = 520 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1313 = 521 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1314 = 522 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1315 = 523 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1316 = 524 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1317 = 525 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1318 = 526 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1319 = 527 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1320 = 528 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1321 = 529 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1322 = 52a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1323 = 52b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1324 = 52c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1325 = 52d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1326 = 52e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1327 = 52f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1328 = 530 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1329 = 531 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1330 = 532 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1331 = 533 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1332 = 534 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1333 = 535 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1334 = 536 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1335 = 537 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1336 = 538 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1337 = 539 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1338 = 53a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1339 = 53b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1340 = 53c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1341 = 53d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1342 = 53e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1343 = 53f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1344 = 540 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1345 = 541 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1346 = 542 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1347 = 543 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1348 = 544 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1349 = 545 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1350 = 546 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1351 = 547 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1352 = 548 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1353 = 549 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1354 = 54a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1355 = 54b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1356 = 54c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1357 = 54d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1358 = 54e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1359 = 54f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1360 = 550 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1361 = 551 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1362 = 552 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1363 = 553 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1364 = 554 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1365 = 555 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1366 = 556 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1367 = 557 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1368 = 558 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1369 = 559 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1370 = 55a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1371 = 55b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1372 = 55c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1373 = 55d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1374 = 55e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1375 = 55f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1376 = 560 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1377 = 561 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1378 = 562 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1379 = 563 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1380 = 564 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1381 = 565 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1382 = 566 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1383 = 567 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1384 = 568 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1385 = 569 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1386 = 56a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1387 = 56b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1388 = 56c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1389 = 56d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1390 = 56e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1391 = 56f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1392 = 570 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1393 = 571 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1394 = 572 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1395 = 573 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1396 = 574 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1397 = 575 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1398 = 576 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1399 = 577 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1400 = 578 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1401 = 579 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1402 = 57a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1403 = 57b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1404 = 57c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1405 = 57d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1406 = 57e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1407 = 57f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1408 = 580 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1409 = 581 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1410 = 582 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1411 = 583 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1412 = 584 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1413 = 585 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1414 = 586 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1415 = 587 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1416 = 588 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1417 = 589 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1418 = 58a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1419 = 58b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1420 = 58c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1421 = 58d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1422 = 58e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1423 = 58f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1424 = 590 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1425 = 591 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1426 = 592 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1427 = 593 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1428 = 594 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1429 = 595 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1430 = 596 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1431 = 597 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1432 = 598 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1433 = 599 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1434 = 59a */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1435 = 59b */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1436 = 59c */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1437 = 59d */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1438 = 59e */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1439 = 59f */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1440 = 5a0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1441 = 5a1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1442 = 5a2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1443 = 5a3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1444 = 5a4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1445 = 5a5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1446 = 5a6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1447 = 5a7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1448 = 5a8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1449 = 5a9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1450 = 5aa */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1451 = 5ab */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1452 = 5ac */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1453 = 5ad */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1454 = 5ae */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1455 = 5af */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1456 = 5b0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1457 = 5b1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1458 = 5b2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1459 = 5b3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1460 = 5b4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1461 = 5b5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1462 = 5b6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1463 = 5b7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1464 = 5b8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1465 = 5b9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1466 = 5ba */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1467 = 5bb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1468 = 5bc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1469 = 5bd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1470 = 5be */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1471 = 5bf */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1472 = 5c0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1473 = 5c1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1474 = 5c2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1475 = 5c3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1476 = 5c4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1477 = 5c5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1478 = 5c6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1479 = 5c7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1480 = 5c8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1481 = 5c9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1482 = 5ca */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1483 = 5cb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1484 = 5cc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1485 = 5cd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1486 = 5ce */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1487 = 5cf */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1488 = 5d0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1489 = 5d1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1490 = 5d2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1491 = 5d3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1492 = 5d4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1493 = 5d5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1494 = 5d6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1495 = 5d7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1496 = 5d8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1497 = 5d9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1498 = 5da */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1499 = 5db */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1500 = 5dc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1501 = 5dd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1502 = 5de */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1503 = 5df */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1504 = 5e0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1505 = 5e1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1506 = 5e2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1507 = 5e3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1508 = 5e4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1509 = 5e5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1510 = 5e6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1511 = 5e7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1512 = 5e8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1513 = 5e9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1514 = 5ea */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1515 = 5eb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1516 = 5ec */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1517 = 5ed */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1518 = 5ee */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1519 = 5ef */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1520 = 5f0 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1521 = 5f1 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1522 = 5f2 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1523 = 5f3 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1524 = 5f4 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1525 = 5f5 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1526 = 5f6 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1527 = 5f7 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1528 = 5f8 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1529 = 5f9 */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1530 = 5fa */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1531 = 5fb */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1532 = 5fc */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1533 = 5fd */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1534 = 5fe */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1535 = 5ff */ {6, 0, 4}, /* 0x0002 => 0x0400+(512)*/
+ /* 1536 = 600 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1537 = 601 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1538 = 602 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1539 = 603 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1540 = 604 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1541 = 605 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1542 = 606 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1543 = 607 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1544 = 608 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1545 = 609 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1546 = 60a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1547 = 60b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1548 = 60c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1549 = 60d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1550 = 60e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1551 = 60f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1552 = 610 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1553 = 611 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1554 = 612 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1555 = 613 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1556 = 614 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1557 = 615 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1558 = 616 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1559 = 617 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1560 = 618 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1561 = 619 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1562 = 61a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1563 = 61b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1564 = 61c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1565 = 61d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1566 = 61e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1567 = 61f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1568 = 620 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1569 = 621 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1570 = 622 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1571 = 623 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1572 = 624 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1573 = 625 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1574 = 626 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1575 = 627 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1576 = 628 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1577 = 629 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1578 = 62a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1579 = 62b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1580 = 62c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1581 = 62d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1582 = 62e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1583 = 62f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1584 = 630 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1585 = 631 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1586 = 632 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1587 = 633 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1588 = 634 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1589 = 635 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1590 = 636 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1591 = 637 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1592 = 638 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1593 = 639 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1594 = 63a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1595 = 63b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1596 = 63c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1597 = 63d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1598 = 63e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1599 = 63f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1600 = 640 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1601 = 641 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1602 = 642 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1603 = 643 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1604 = 644 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1605 = 645 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1606 = 646 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1607 = 647 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1608 = 648 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1609 = 649 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1610 = 64a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1611 = 64b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1612 = 64c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1613 = 64d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1614 = 64e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1615 = 64f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1616 = 650 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1617 = 651 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1618 = 652 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1619 = 653 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1620 = 654 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1621 = 655 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1622 = 656 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1623 = 657 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1624 = 658 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1625 = 659 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1626 = 65a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1627 = 65b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1628 = 65c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1629 = 65d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1630 = 65e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1631 = 65f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1632 = 660 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1633 = 661 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1634 = 662 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1635 = 663 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1636 = 664 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1637 = 665 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1638 = 666 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1639 = 667 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1640 = 668 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1641 = 669 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1642 = 66a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1643 = 66b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1644 = 66c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1645 = 66d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1646 = 66e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1647 = 66f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1648 = 670 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1649 = 671 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1650 = 672 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1651 = 673 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1652 = 674 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1653 = 675 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1654 = 676 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1655 = 677 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1656 = 678 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1657 = 679 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1658 = 67a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1659 = 67b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1660 = 67c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1661 = 67d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1662 = 67e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1663 = 67f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1664 = 680 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1665 = 681 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1666 = 682 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1667 = 683 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1668 = 684 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1669 = 685 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1670 = 686 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1671 = 687 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1672 = 688 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1673 = 689 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1674 = 68a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1675 = 68b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1676 = 68c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1677 = 68d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1678 = 68e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1679 = 68f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1680 = 690 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1681 = 691 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1682 = 692 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1683 = 693 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1684 = 694 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1685 = 695 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1686 = 696 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1687 = 697 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1688 = 698 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1689 = 699 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1690 = 69a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1691 = 69b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1692 = 69c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1693 = 69d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1694 = 69e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1695 = 69f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1696 = 6a0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1697 = 6a1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1698 = 6a2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1699 = 6a3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1700 = 6a4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1701 = 6a5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1702 = 6a6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1703 = 6a7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1704 = 6a8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1705 = 6a9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1706 = 6aa */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1707 = 6ab */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1708 = 6ac */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1709 = 6ad */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1710 = 6ae */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1711 = 6af */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1712 = 6b0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1713 = 6b1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1714 = 6b2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1715 = 6b3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1716 = 6b4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1717 = 6b5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1718 = 6b6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1719 = 6b7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1720 = 6b8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1721 = 6b9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1722 = 6ba */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1723 = 6bb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1724 = 6bc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1725 = 6bd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1726 = 6be */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1727 = 6bf */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1728 = 6c0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1729 = 6c1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1730 = 6c2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1731 = 6c3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1732 = 6c4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1733 = 6c5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1734 = 6c6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1735 = 6c7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1736 = 6c8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1737 = 6c9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1738 = 6ca */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1739 = 6cb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1740 = 6cc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1741 = 6cd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1742 = 6ce */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1743 = 6cf */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1744 = 6d0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1745 = 6d1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1746 = 6d2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1747 = 6d3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1748 = 6d4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1749 = 6d5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1750 = 6d6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1751 = 6d7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1752 = 6d8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1753 = 6d9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1754 = 6da */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1755 = 6db */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1756 = 6dc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1757 = 6dd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1758 = 6de */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1759 = 6df */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1760 = 6e0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1761 = 6e1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1762 = 6e2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1763 = 6e3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1764 = 6e4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1765 = 6e5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1766 = 6e6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1767 = 6e7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1768 = 6e8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1769 = 6e9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1770 = 6ea */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1771 = 6eb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1772 = 6ec */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1773 = 6ed */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1774 = 6ee */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1775 = 6ef */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1776 = 6f0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1777 = 6f1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1778 = 6f2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1779 = 6f3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1780 = 6f4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1781 = 6f5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1782 = 6f6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1783 = 6f7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1784 = 6f8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1785 = 6f9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1786 = 6fa */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1787 = 6fb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1788 = 6fc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1789 = 6fd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1790 = 6fe */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1791 = 6ff */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1792 = 700 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1793 = 701 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1794 = 702 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1795 = 703 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1796 = 704 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1797 = 705 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1798 = 706 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1799 = 707 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1800 = 708 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1801 = 709 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1802 = 70a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1803 = 70b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1804 = 70c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1805 = 70d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1806 = 70e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1807 = 70f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1808 = 710 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1809 = 711 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1810 = 712 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1811 = 713 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1812 = 714 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1813 = 715 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1814 = 716 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1815 = 717 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1816 = 718 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1817 = 719 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1818 = 71a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1819 = 71b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1820 = 71c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1821 = 71d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1822 = 71e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1823 = 71f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1824 = 720 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1825 = 721 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1826 = 722 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1827 = 723 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1828 = 724 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1829 = 725 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1830 = 726 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1831 = 727 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1832 = 728 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1833 = 729 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1834 = 72a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1835 = 72b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1836 = 72c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1837 = 72d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1838 = 72e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1839 = 72f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1840 = 730 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1841 = 731 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1842 = 732 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1843 = 733 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1844 = 734 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1845 = 735 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1846 = 736 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1847 = 737 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1848 = 738 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1849 = 739 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1850 = 73a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1851 = 73b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1852 = 73c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1853 = 73d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1854 = 73e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1855 = 73f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1856 = 740 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1857 = 741 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1858 = 742 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1859 = 743 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1860 = 744 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1861 = 745 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1862 = 746 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1863 = 747 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1864 = 748 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1865 = 749 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1866 = 74a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1867 = 74b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1868 = 74c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1869 = 74d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1870 = 74e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1871 = 74f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1872 = 750 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1873 = 751 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1874 = 752 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1875 = 753 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1876 = 754 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1877 = 755 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1878 = 756 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1879 = 757 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1880 = 758 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1881 = 759 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1882 = 75a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1883 = 75b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1884 = 75c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1885 = 75d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1886 = 75e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1887 = 75f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1888 = 760 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1889 = 761 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1890 = 762 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1891 = 763 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1892 = 764 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1893 = 765 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1894 = 766 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1895 = 767 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1896 = 768 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1897 = 769 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1898 = 76a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1899 = 76b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1900 = 76c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1901 = 76d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1902 = 76e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1903 = 76f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1904 = 770 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1905 = 771 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1906 = 772 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1907 = 773 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1908 = 774 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1909 = 775 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1910 = 776 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1911 = 777 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1912 = 778 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1913 = 779 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1914 = 77a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1915 = 77b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1916 = 77c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1917 = 77d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1918 = 77e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1919 = 77f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1920 = 780 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1921 = 781 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1922 = 782 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1923 = 783 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1924 = 784 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1925 = 785 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1926 = 786 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1927 = 787 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1928 = 788 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1929 = 789 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1930 = 78a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1931 = 78b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1932 = 78c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1933 = 78d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1934 = 78e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1935 = 78f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1936 = 790 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1937 = 791 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1938 = 792 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1939 = 793 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1940 = 794 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1941 = 795 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1942 = 796 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1943 = 797 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1944 = 798 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1945 = 799 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1946 = 79a */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1947 = 79b */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1948 = 79c */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1949 = 79d */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1950 = 79e */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1951 = 79f */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1952 = 7a0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1953 = 7a1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1954 = 7a2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1955 = 7a3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1956 = 7a4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1957 = 7a5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1958 = 7a6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1959 = 7a7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1960 = 7a8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1961 = 7a9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1962 = 7aa */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1963 = 7ab */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1964 = 7ac */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1965 = 7ad */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1966 = 7ae */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1967 = 7af */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1968 = 7b0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1969 = 7b1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1970 = 7b2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1971 = 7b3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1972 = 7b4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1973 = 7b5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1974 = 7b6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1975 = 7b7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1976 = 7b8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1977 = 7b9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1978 = 7ba */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1979 = 7bb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1980 = 7bc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1981 = 7bd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1982 = 7be */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1983 = 7bf */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1984 = 7c0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1985 = 7c1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1986 = 7c2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1987 = 7c3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1988 = 7c4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1989 = 7c5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1990 = 7c6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1991 = 7c7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1992 = 7c8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1993 = 7c9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1994 = 7ca */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1995 = 7cb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1996 = 7cc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1997 = 7cd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1998 = 7ce */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 1999 = 7cf */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2000 = 7d0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2001 = 7d1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2002 = 7d2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2003 = 7d3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2004 = 7d4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2005 = 7d5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2006 = 7d6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2007 = 7d7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2008 = 7d8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2009 = 7d9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2010 = 7da */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2011 = 7db */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2012 = 7dc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2013 = 7dd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2014 = 7de */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2015 = 7df */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2016 = 7e0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2017 = 7e1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2018 = 7e2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2019 = 7e3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2020 = 7e4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2021 = 7e5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2022 = 7e6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2023 = 7e7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2024 = 7e8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2025 = 7e9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2026 = 7ea */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2027 = 7eb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2028 = 7ec */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2029 = 7ed */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2030 = 7ee */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2031 = 7ef */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2032 = 7f0 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2033 = 7f1 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2034 = 7f2 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2035 = 7f3 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2036 = 7f4 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2037 = 7f5 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2038 = 7f6 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2039 = 7f7 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2040 = 7f8 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2041 = 7f9 */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2042 = 7fa */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2043 = 7fb */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2044 = 7fc */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2045 = 7fd */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2046 = 7fe */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2047 = 7ff */ {5, 0, 4}, /* 0x0003 => 0x0600+(512)*/
+ /* 2048 = 800 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2049 = 801 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2050 = 802 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2051 = 803 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2052 = 804 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2053 = 805 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2054 = 806 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2055 = 807 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2056 = 808 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2057 = 809 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2058 = 80a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2059 = 80b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2060 = 80c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2061 = 80d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2062 = 80e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2063 = 80f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2064 = 810 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2065 = 811 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2066 = 812 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2067 = 813 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2068 = 814 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2069 = 815 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2070 = 816 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2071 = 817 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2072 = 818 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2073 = 819 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2074 = 81a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2075 = 81b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2076 = 81c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2077 = 81d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2078 = 81e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2079 = 81f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2080 = 820 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2081 = 821 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2082 = 822 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2083 = 823 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2084 = 824 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2085 = 825 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2086 = 826 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2087 = 827 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2088 = 828 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2089 = 829 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2090 = 82a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2091 = 82b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2092 = 82c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2093 = 82d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2094 = 82e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2095 = 82f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2096 = 830 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2097 = 831 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2098 = 832 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2099 = 833 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2100 = 834 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2101 = 835 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2102 = 836 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2103 = 837 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2104 = 838 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2105 = 839 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2106 = 83a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2107 = 83b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2108 = 83c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2109 = 83d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2110 = 83e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2111 = 83f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2112 = 840 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2113 = 841 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2114 = 842 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2115 = 843 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2116 = 844 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2117 = 845 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2118 = 846 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2119 = 847 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2120 = 848 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2121 = 849 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2122 = 84a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2123 = 84b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2124 = 84c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2125 = 84d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2126 = 84e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2127 = 84f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2128 = 850 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2129 = 851 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2130 = 852 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2131 = 853 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2132 = 854 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2133 = 855 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2134 = 856 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2135 = 857 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2136 = 858 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2137 = 859 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2138 = 85a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2139 = 85b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2140 = 85c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2141 = 85d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2142 = 85e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2143 = 85f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2144 = 860 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2145 = 861 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2146 = 862 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2147 = 863 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2148 = 864 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2149 = 865 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2150 = 866 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2151 = 867 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2152 = 868 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2153 = 869 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2154 = 86a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2155 = 86b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2156 = 86c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2157 = 86d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2158 = 86e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2159 = 86f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2160 = 870 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2161 = 871 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2162 = 872 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2163 = 873 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2164 = 874 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2165 = 875 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2166 = 876 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2167 = 877 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2168 = 878 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2169 = 879 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2170 = 87a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2171 = 87b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2172 = 87c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2173 = 87d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2174 = 87e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2175 = 87f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2176 = 880 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2177 = 881 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2178 = 882 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2179 = 883 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2180 = 884 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2181 = 885 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2182 = 886 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2183 = 887 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2184 = 888 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2185 = 889 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2186 = 88a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2187 = 88b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2188 = 88c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2189 = 88d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2190 = 88e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2191 = 88f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2192 = 890 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2193 = 891 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2194 = 892 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2195 = 893 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2196 = 894 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2197 = 895 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2198 = 896 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2199 = 897 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2200 = 898 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2201 = 899 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2202 = 89a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2203 = 89b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2204 = 89c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2205 = 89d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2206 = 89e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2207 = 89f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2208 = 8a0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2209 = 8a1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2210 = 8a2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2211 = 8a3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2212 = 8a4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2213 = 8a5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2214 = 8a6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2215 = 8a7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2216 = 8a8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2217 = 8a9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2218 = 8aa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2219 = 8ab */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2220 = 8ac */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2221 = 8ad */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2222 = 8ae */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2223 = 8af */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2224 = 8b0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2225 = 8b1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2226 = 8b2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2227 = 8b3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2228 = 8b4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2229 = 8b5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2230 = 8b6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2231 = 8b7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2232 = 8b8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2233 = 8b9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2234 = 8ba */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2235 = 8bb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2236 = 8bc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2237 = 8bd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2238 = 8be */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2239 = 8bf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2240 = 8c0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2241 = 8c1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2242 = 8c2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2243 = 8c3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2244 = 8c4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2245 = 8c5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2246 = 8c6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2247 = 8c7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2248 = 8c8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2249 = 8c9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2250 = 8ca */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2251 = 8cb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2252 = 8cc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2253 = 8cd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2254 = 8ce */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2255 = 8cf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2256 = 8d0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2257 = 8d1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2258 = 8d2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2259 = 8d3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2260 = 8d4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2261 = 8d5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2262 = 8d6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2263 = 8d7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2264 = 8d8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2265 = 8d9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2266 = 8da */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2267 = 8db */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2268 = 8dc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2269 = 8dd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2270 = 8de */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2271 = 8df */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2272 = 8e0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2273 = 8e1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2274 = 8e2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2275 = 8e3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2276 = 8e4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2277 = 8e5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2278 = 8e6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2279 = 8e7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2280 = 8e8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2281 = 8e9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2282 = 8ea */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2283 = 8eb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2284 = 8ec */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2285 = 8ed */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2286 = 8ee */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2287 = 8ef */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2288 = 8f0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2289 = 8f1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2290 = 8f2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2291 = 8f3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2292 = 8f4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2293 = 8f5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2294 = 8f6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2295 = 8f7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2296 = 8f8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2297 = 8f9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2298 = 8fa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2299 = 8fb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2300 = 8fc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2301 = 8fd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2302 = 8fe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2303 = 8ff */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2304 = 900 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2305 = 901 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2306 = 902 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2307 = 903 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2308 = 904 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2309 = 905 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2310 = 906 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2311 = 907 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2312 = 908 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2313 = 909 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2314 = 90a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2315 = 90b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2316 = 90c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2317 = 90d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2318 = 90e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2319 = 90f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2320 = 910 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2321 = 911 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2322 = 912 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2323 = 913 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2324 = 914 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2325 = 915 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2326 = 916 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2327 = 917 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2328 = 918 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2329 = 919 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2330 = 91a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2331 = 91b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2332 = 91c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2333 = 91d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2334 = 91e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2335 = 91f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2336 = 920 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2337 = 921 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2338 = 922 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2339 = 923 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2340 = 924 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2341 = 925 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2342 = 926 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2343 = 927 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2344 = 928 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2345 = 929 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2346 = 92a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2347 = 92b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2348 = 92c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2349 = 92d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2350 = 92e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2351 = 92f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2352 = 930 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2353 = 931 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2354 = 932 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2355 = 933 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2356 = 934 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2357 = 935 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2358 = 936 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2359 = 937 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2360 = 938 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2361 = 939 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2362 = 93a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2363 = 93b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2364 = 93c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2365 = 93d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2366 = 93e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2367 = 93f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2368 = 940 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2369 = 941 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2370 = 942 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2371 = 943 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2372 = 944 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2373 = 945 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2374 = 946 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2375 = 947 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2376 = 948 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2377 = 949 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2378 = 94a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2379 = 94b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2380 = 94c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2381 = 94d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2382 = 94e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2383 = 94f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2384 = 950 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2385 = 951 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2386 = 952 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2387 = 953 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2388 = 954 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2389 = 955 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2390 = 956 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2391 = 957 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2392 = 958 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2393 = 959 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2394 = 95a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2395 = 95b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2396 = 95c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2397 = 95d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2398 = 95e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2399 = 95f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2400 = 960 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2401 = 961 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2402 = 962 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2403 = 963 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2404 = 964 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2405 = 965 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2406 = 966 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2407 = 967 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2408 = 968 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2409 = 969 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2410 = 96a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2411 = 96b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2412 = 96c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2413 = 96d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2414 = 96e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2415 = 96f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2416 = 970 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2417 = 971 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2418 = 972 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2419 = 973 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2420 = 974 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2421 = 975 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2422 = 976 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2423 = 977 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2424 = 978 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2425 = 979 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2426 = 97a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2427 = 97b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2428 = 97c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2429 = 97d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2430 = 97e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2431 = 97f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2432 = 980 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2433 = 981 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2434 = 982 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2435 = 983 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2436 = 984 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2437 = 985 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2438 = 986 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2439 = 987 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2440 = 988 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2441 = 989 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2442 = 98a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2443 = 98b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2444 = 98c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2445 = 98d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2446 = 98e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2447 = 98f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2448 = 990 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2449 = 991 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2450 = 992 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2451 = 993 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2452 = 994 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2453 = 995 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2454 = 996 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2455 = 997 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2456 = 998 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2457 = 999 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2458 = 99a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2459 = 99b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2460 = 99c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2461 = 99d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2462 = 99e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2463 = 99f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2464 = 9a0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2465 = 9a1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2466 = 9a2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2467 = 9a3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2468 = 9a4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2469 = 9a5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2470 = 9a6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2471 = 9a7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2472 = 9a8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2473 = 9a9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2474 = 9aa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2475 = 9ab */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2476 = 9ac */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2477 = 9ad */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2478 = 9ae */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2479 = 9af */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2480 = 9b0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2481 = 9b1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2482 = 9b2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2483 = 9b3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2484 = 9b4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2485 = 9b5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2486 = 9b6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2487 = 9b7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2488 = 9b8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2489 = 9b9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2490 = 9ba */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2491 = 9bb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2492 = 9bc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2493 = 9bd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2494 = 9be */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2495 = 9bf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2496 = 9c0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2497 = 9c1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2498 = 9c2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2499 = 9c3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2500 = 9c4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2501 = 9c5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2502 = 9c6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2503 = 9c7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2504 = 9c8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2505 = 9c9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2506 = 9ca */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2507 = 9cb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2508 = 9cc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2509 = 9cd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2510 = 9ce */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2511 = 9cf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2512 = 9d0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2513 = 9d1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2514 = 9d2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2515 = 9d3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2516 = 9d4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2517 = 9d5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2518 = 9d6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2519 = 9d7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2520 = 9d8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2521 = 9d9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2522 = 9da */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2523 = 9db */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2524 = 9dc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2525 = 9dd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2526 = 9de */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2527 = 9df */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2528 = 9e0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2529 = 9e1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2530 = 9e2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2531 = 9e3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2532 = 9e4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2533 = 9e5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2534 = 9e6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2535 = 9e7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2536 = 9e8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2537 = 9e9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2538 = 9ea */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2539 = 9eb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2540 = 9ec */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2541 = 9ed */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2542 = 9ee */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2543 = 9ef */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2544 = 9f0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2545 = 9f1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2546 = 9f2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2547 = 9f3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2548 = 9f4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2549 = 9f5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2550 = 9f6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2551 = 9f7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2552 = 9f8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2553 = 9f9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2554 = 9fa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2555 = 9fb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2556 = 9fc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2557 = 9fd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2558 = 9fe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2559 = 9ff */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2560 = a00 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2561 = a01 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2562 = a02 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2563 = a03 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2564 = a04 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2565 = a05 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2566 = a06 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2567 = a07 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2568 = a08 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2569 = a09 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2570 = a0a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2571 = a0b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2572 = a0c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2573 = a0d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2574 = a0e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2575 = a0f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2576 = a10 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2577 = a11 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2578 = a12 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2579 = a13 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2580 = a14 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2581 = a15 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2582 = a16 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2583 = a17 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2584 = a18 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2585 = a19 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2586 = a1a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2587 = a1b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2588 = a1c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2589 = a1d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2590 = a1e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2591 = a1f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2592 = a20 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2593 = a21 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2594 = a22 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2595 = a23 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2596 = a24 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2597 = a25 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2598 = a26 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2599 = a27 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2600 = a28 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2601 = a29 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2602 = a2a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2603 = a2b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2604 = a2c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2605 = a2d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2606 = a2e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2607 = a2f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2608 = a30 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2609 = a31 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2610 = a32 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2611 = a33 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2612 = a34 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2613 = a35 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2614 = a36 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2615 = a37 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2616 = a38 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2617 = a39 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2618 = a3a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2619 = a3b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2620 = a3c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2621 = a3d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2622 = a3e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2623 = a3f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2624 = a40 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2625 = a41 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2626 = a42 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2627 = a43 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2628 = a44 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2629 = a45 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2630 = a46 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2631 = a47 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2632 = a48 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2633 = a49 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2634 = a4a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2635 = a4b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2636 = a4c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2637 = a4d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2638 = a4e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2639 = a4f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2640 = a50 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2641 = a51 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2642 = a52 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2643 = a53 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2644 = a54 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2645 = a55 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2646 = a56 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2647 = a57 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2648 = a58 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2649 = a59 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2650 = a5a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2651 = a5b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2652 = a5c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2653 = a5d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2654 = a5e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2655 = a5f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2656 = a60 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2657 = a61 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2658 = a62 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2659 = a63 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2660 = a64 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2661 = a65 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2662 = a66 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2663 = a67 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2664 = a68 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2665 = a69 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2666 = a6a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2667 = a6b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2668 = a6c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2669 = a6d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2670 = a6e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2671 = a6f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2672 = a70 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2673 = a71 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2674 = a72 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2675 = a73 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2676 = a74 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2677 = a75 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2678 = a76 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2679 = a77 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2680 = a78 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2681 = a79 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2682 = a7a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2683 = a7b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2684 = a7c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2685 = a7d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2686 = a7e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2687 = a7f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2688 = a80 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2689 = a81 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2690 = a82 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2691 = a83 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2692 = a84 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2693 = a85 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2694 = a86 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2695 = a87 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2696 = a88 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2697 = a89 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2698 = a8a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2699 = a8b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2700 = a8c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2701 = a8d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2702 = a8e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2703 = a8f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2704 = a90 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2705 = a91 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2706 = a92 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2707 = a93 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2708 = a94 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2709 = a95 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2710 = a96 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2711 = a97 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2712 = a98 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2713 = a99 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2714 = a9a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2715 = a9b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2716 = a9c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2717 = a9d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2718 = a9e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2719 = a9f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2720 = aa0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2721 = aa1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2722 = aa2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2723 = aa3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2724 = aa4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2725 = aa5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2726 = aa6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2727 = aa7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2728 = aa8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2729 = aa9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2730 = aaa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2731 = aab */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2732 = aac */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2733 = aad */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2734 = aae */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2735 = aaf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2736 = ab0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2737 = ab1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2738 = ab2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2739 = ab3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2740 = ab4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2741 = ab5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2742 = ab6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2743 = ab7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2744 = ab8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2745 = ab9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2746 = aba */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2747 = abb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2748 = abc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2749 = abd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2750 = abe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2751 = abf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2752 = ac0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2753 = ac1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2754 = ac2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2755 = ac3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2756 = ac4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2757 = ac5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2758 = ac6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2759 = ac7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2760 = ac8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2761 = ac9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2762 = aca */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2763 = acb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2764 = acc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2765 = acd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2766 = ace */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2767 = acf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2768 = ad0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2769 = ad1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2770 = ad2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2771 = ad3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2772 = ad4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2773 = ad5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2774 = ad6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2775 = ad7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2776 = ad8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2777 = ad9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2778 = ada */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2779 = adb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2780 = adc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2781 = add */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2782 = ade */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2783 = adf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2784 = ae0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2785 = ae1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2786 = ae2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2787 = ae3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2788 = ae4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2789 = ae5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2790 = ae6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2791 = ae7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2792 = ae8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2793 = ae9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2794 = aea */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2795 = aeb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2796 = aec */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2797 = aed */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2798 = aee */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2799 = aef */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2800 = af0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2801 = af1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2802 = af2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2803 = af3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2804 = af4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2805 = af5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2806 = af6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2807 = af7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2808 = af8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2809 = af9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2810 = afa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2811 = afb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2812 = afc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2813 = afd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2814 = afe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2815 = aff */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2816 = b00 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2817 = b01 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2818 = b02 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2819 = b03 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2820 = b04 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2821 = b05 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2822 = b06 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2823 = b07 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2824 = b08 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2825 = b09 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2826 = b0a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2827 = b0b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2828 = b0c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2829 = b0d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2830 = b0e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2831 = b0f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2832 = b10 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2833 = b11 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2834 = b12 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2835 = b13 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2836 = b14 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2837 = b15 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2838 = b16 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2839 = b17 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2840 = b18 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2841 = b19 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2842 = b1a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2843 = b1b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2844 = b1c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2845 = b1d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2846 = b1e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2847 = b1f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2848 = b20 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2849 = b21 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2850 = b22 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2851 = b23 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2852 = b24 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2853 = b25 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2854 = b26 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2855 = b27 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2856 = b28 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2857 = b29 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2858 = b2a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2859 = b2b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2860 = b2c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2861 = b2d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2862 = b2e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2863 = b2f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2864 = b30 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2865 = b31 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2866 = b32 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2867 = b33 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2868 = b34 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2869 = b35 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2870 = b36 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2871 = b37 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2872 = b38 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2873 = b39 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2874 = b3a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2875 = b3b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2876 = b3c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2877 = b3d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2878 = b3e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2879 = b3f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2880 = b40 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2881 = b41 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2882 = b42 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2883 = b43 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2884 = b44 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2885 = b45 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2886 = b46 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2887 = b47 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2888 = b48 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2889 = b49 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2890 = b4a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2891 = b4b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2892 = b4c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2893 = b4d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2894 = b4e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2895 = b4f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2896 = b50 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2897 = b51 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2898 = b52 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2899 = b53 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2900 = b54 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2901 = b55 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2902 = b56 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2903 = b57 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2904 = b58 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2905 = b59 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2906 = b5a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2907 = b5b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2908 = b5c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2909 = b5d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2910 = b5e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2911 = b5f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2912 = b60 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2913 = b61 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2914 = b62 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2915 = b63 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2916 = b64 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2917 = b65 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2918 = b66 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2919 = b67 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2920 = b68 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2921 = b69 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2922 = b6a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2923 = b6b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2924 = b6c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2925 = b6d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2926 = b6e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2927 = b6f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2928 = b70 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2929 = b71 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2930 = b72 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2931 = b73 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2932 = b74 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2933 = b75 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2934 = b76 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2935 = b77 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2936 = b78 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2937 = b79 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2938 = b7a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2939 = b7b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2940 = b7c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2941 = b7d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2942 = b7e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2943 = b7f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2944 = b80 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2945 = b81 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2946 = b82 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2947 = b83 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2948 = b84 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2949 = b85 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2950 = b86 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2951 = b87 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2952 = b88 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2953 = b89 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2954 = b8a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2955 = b8b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2956 = b8c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2957 = b8d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2958 = b8e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2959 = b8f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2960 = b90 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2961 = b91 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2962 = b92 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2963 = b93 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2964 = b94 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2965 = b95 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2966 = b96 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2967 = b97 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2968 = b98 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2969 = b99 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2970 = b9a */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2971 = b9b */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2972 = b9c */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2973 = b9d */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2974 = b9e */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2975 = b9f */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2976 = ba0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2977 = ba1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2978 = ba2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2979 = ba3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2980 = ba4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2981 = ba5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2982 = ba6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2983 = ba7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2984 = ba8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2985 = ba9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2986 = baa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2987 = bab */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2988 = bac */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2989 = bad */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2990 = bae */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2991 = baf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2992 = bb0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2993 = bb1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2994 = bb2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2995 = bb3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2996 = bb4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2997 = bb5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2998 = bb6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 2999 = bb7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3000 = bb8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3001 = bb9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3002 = bba */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3003 = bbb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3004 = bbc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3005 = bbd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3006 = bbe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3007 = bbf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3008 = bc0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3009 = bc1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3010 = bc2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3011 = bc3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3012 = bc4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3013 = bc5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3014 = bc6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3015 = bc7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3016 = bc8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3017 = bc9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3018 = bca */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3019 = bcb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3020 = bcc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3021 = bcd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3022 = bce */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3023 = bcf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3024 = bd0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3025 = bd1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3026 = bd2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3027 = bd3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3028 = bd4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3029 = bd5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3030 = bd6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3031 = bd7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3032 = bd8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3033 = bd9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3034 = bda */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3035 = bdb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3036 = bdc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3037 = bdd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3038 = bde */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3039 = bdf */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3040 = be0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3041 = be1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3042 = be2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3043 = be3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3044 = be4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3045 = be5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3046 = be6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3047 = be7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3048 = be8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3049 = be9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3050 = bea */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3051 = beb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3052 = bec */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3053 = bed */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3054 = bee */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3055 = bef */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3056 = bf0 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3057 = bf1 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3058 = bf2 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3059 = bf3 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3060 = bf4 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3061 = bf5 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3062 = bf6 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3063 = bf7 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3064 = bf8 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3065 = bf9 */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3066 = bfa */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3067 = bfb */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3068 = bfc */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3069 = bfd */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3070 = bfe */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3071 = bff */ {1, 0, 3}, /* 0x0002 => 0x0800+(1024)*/
+ /* 3072 = c00 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3073 = c01 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3074 = c02 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3075 = c03 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3076 = c04 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3077 = c05 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3078 = c06 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3079 = c07 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3080 = c08 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3081 = c09 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3082 = c0a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3083 = c0b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3084 = c0c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3085 = c0d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3086 = c0e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3087 = c0f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3088 = c10 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3089 = c11 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3090 = c12 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3091 = c13 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3092 = c14 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3093 = c15 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3094 = c16 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3095 = c17 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3096 = c18 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3097 = c19 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3098 = c1a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3099 = c1b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3100 = c1c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3101 = c1d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3102 = c1e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3103 = c1f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3104 = c20 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3105 = c21 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3106 = c22 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3107 = c23 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3108 = c24 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3109 = c25 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3110 = c26 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3111 = c27 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3112 = c28 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3113 = c29 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3114 = c2a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3115 = c2b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3116 = c2c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3117 = c2d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3118 = c2e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3119 = c2f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3120 = c30 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3121 = c31 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3122 = c32 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3123 = c33 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3124 = c34 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3125 = c35 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3126 = c36 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3127 = c37 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3128 = c38 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3129 = c39 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3130 = c3a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3131 = c3b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3132 = c3c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3133 = c3d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3134 = c3e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3135 = c3f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3136 = c40 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3137 = c41 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3138 = c42 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3139 = c43 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3140 = c44 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3141 = c45 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3142 = c46 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3143 = c47 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3144 = c48 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3145 = c49 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3146 = c4a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3147 = c4b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3148 = c4c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3149 = c4d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3150 = c4e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3151 = c4f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3152 = c50 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3153 = c51 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3154 = c52 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3155 = c53 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3156 = c54 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3157 = c55 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3158 = c56 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3159 = c57 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3160 = c58 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3161 = c59 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3162 = c5a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3163 = c5b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3164 = c5c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3165 = c5d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3166 = c5e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3167 = c5f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3168 = c60 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3169 = c61 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3170 = c62 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3171 = c63 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3172 = c64 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3173 = c65 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3174 = c66 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3175 = c67 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3176 = c68 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3177 = c69 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3178 = c6a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3179 = c6b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3180 = c6c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3181 = c6d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3182 = c6e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3183 = c6f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3184 = c70 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3185 = c71 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3186 = c72 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3187 = c73 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3188 = c74 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3189 = c75 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3190 = c76 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3191 = c77 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3192 = c78 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3193 = c79 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3194 = c7a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3195 = c7b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3196 = c7c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3197 = c7d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3198 = c7e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3199 = c7f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3200 = c80 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3201 = c81 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3202 = c82 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3203 = c83 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3204 = c84 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3205 = c85 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3206 = c86 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3207 = c87 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3208 = c88 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3209 = c89 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3210 = c8a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3211 = c8b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3212 = c8c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3213 = c8d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3214 = c8e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3215 = c8f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3216 = c90 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3217 = c91 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3218 = c92 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3219 = c93 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3220 = c94 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3221 = c95 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3222 = c96 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3223 = c97 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3224 = c98 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3225 = c99 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3226 = c9a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3227 = c9b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3228 = c9c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3229 = c9d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3230 = c9e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3231 = c9f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3232 = ca0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3233 = ca1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3234 = ca2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3235 = ca3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3236 = ca4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3237 = ca5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3238 = ca6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3239 = ca7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3240 = ca8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3241 = ca9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3242 = caa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3243 = cab */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3244 = cac */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3245 = cad */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3246 = cae */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3247 = caf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3248 = cb0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3249 = cb1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3250 = cb2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3251 = cb3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3252 = cb4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3253 = cb5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3254 = cb6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3255 = cb7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3256 = cb8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3257 = cb9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3258 = cba */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3259 = cbb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3260 = cbc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3261 = cbd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3262 = cbe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3263 = cbf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3264 = cc0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3265 = cc1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3266 = cc2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3267 = cc3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3268 = cc4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3269 = cc5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3270 = cc6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3271 = cc7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3272 = cc8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3273 = cc9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3274 = cca */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3275 = ccb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3276 = ccc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3277 = ccd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3278 = cce */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3279 = ccf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3280 = cd0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3281 = cd1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3282 = cd2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3283 = cd3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3284 = cd4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3285 = cd5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3286 = cd6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3287 = cd7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3288 = cd8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3289 = cd9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3290 = cda */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3291 = cdb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3292 = cdc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3293 = cdd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3294 = cde */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3295 = cdf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3296 = ce0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3297 = ce1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3298 = ce2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3299 = ce3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3300 = ce4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3301 = ce5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3302 = ce6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3303 = ce7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3304 = ce8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3305 = ce9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3306 = cea */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3307 = ceb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3308 = cec */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3309 = ced */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3310 = cee */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3311 = cef */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3312 = cf0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3313 = cf1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3314 = cf2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3315 = cf3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3316 = cf4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3317 = cf5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3318 = cf6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3319 = cf7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3320 = cf8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3321 = cf9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3322 = cfa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3323 = cfb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3324 = cfc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3325 = cfd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3326 = cfe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3327 = cff */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3328 = d00 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3329 = d01 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3330 = d02 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3331 = d03 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3332 = d04 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3333 = d05 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3334 = d06 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3335 = d07 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3336 = d08 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3337 = d09 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3338 = d0a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3339 = d0b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3340 = d0c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3341 = d0d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3342 = d0e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3343 = d0f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3344 = d10 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3345 = d11 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3346 = d12 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3347 = d13 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3348 = d14 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3349 = d15 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3350 = d16 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3351 = d17 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3352 = d18 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3353 = d19 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3354 = d1a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3355 = d1b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3356 = d1c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3357 = d1d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3358 = d1e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3359 = d1f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3360 = d20 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3361 = d21 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3362 = d22 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3363 = d23 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3364 = d24 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3365 = d25 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3366 = d26 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3367 = d27 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3368 = d28 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3369 = d29 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3370 = d2a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3371 = d2b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3372 = d2c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3373 = d2d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3374 = d2e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3375 = d2f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3376 = d30 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3377 = d31 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3378 = d32 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3379 = d33 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3380 = d34 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3381 = d35 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3382 = d36 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3383 = d37 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3384 = d38 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3385 = d39 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3386 = d3a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3387 = d3b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3388 = d3c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3389 = d3d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3390 = d3e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3391 = d3f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3392 = d40 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3393 = d41 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3394 = d42 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3395 = d43 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3396 = d44 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3397 = d45 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3398 = d46 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3399 = d47 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3400 = d48 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3401 = d49 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3402 = d4a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3403 = d4b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3404 = d4c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3405 = d4d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3406 = d4e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3407 = d4f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3408 = d50 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3409 = d51 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3410 = d52 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3411 = d53 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3412 = d54 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3413 = d55 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3414 = d56 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3415 = d57 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3416 = d58 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3417 = d59 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3418 = d5a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3419 = d5b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3420 = d5c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3421 = d5d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3422 = d5e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3423 = d5f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3424 = d60 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3425 = d61 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3426 = d62 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3427 = d63 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3428 = d64 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3429 = d65 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3430 = d66 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3431 = d67 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3432 = d68 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3433 = d69 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3434 = d6a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3435 = d6b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3436 = d6c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3437 = d6d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3438 = d6e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3439 = d6f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3440 = d70 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3441 = d71 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3442 = d72 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3443 = d73 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3444 = d74 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3445 = d75 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3446 = d76 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3447 = d77 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3448 = d78 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3449 = d79 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3450 = d7a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3451 = d7b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3452 = d7c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3453 = d7d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3454 = d7e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3455 = d7f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3456 = d80 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3457 = d81 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3458 = d82 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3459 = d83 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3460 = d84 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3461 = d85 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3462 = d86 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3463 = d87 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3464 = d88 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3465 = d89 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3466 = d8a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3467 = d8b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3468 = d8c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3469 = d8d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3470 = d8e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3471 = d8f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3472 = d90 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3473 = d91 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3474 = d92 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3475 = d93 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3476 = d94 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3477 = d95 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3478 = d96 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3479 = d97 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3480 = d98 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3481 = d99 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3482 = d9a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3483 = d9b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3484 = d9c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3485 = d9d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3486 = d9e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3487 = d9f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3488 = da0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3489 = da1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3490 = da2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3491 = da3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3492 = da4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3493 = da5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3494 = da6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3495 = da7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3496 = da8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3497 = da9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3498 = daa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3499 = dab */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3500 = dac */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3501 = dad */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3502 = dae */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3503 = daf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3504 = db0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3505 = db1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3506 = db2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3507 = db3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3508 = db4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3509 = db5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3510 = db6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3511 = db7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3512 = db8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3513 = db9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3514 = dba */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3515 = dbb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3516 = dbc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3517 = dbd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3518 = dbe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3519 = dbf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3520 = dc0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3521 = dc1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3522 = dc2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3523 = dc3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3524 = dc4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3525 = dc5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3526 = dc6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3527 = dc7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3528 = dc8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3529 = dc9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3530 = dca */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3531 = dcb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3532 = dcc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3533 = dcd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3534 = dce */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3535 = dcf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3536 = dd0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3537 = dd1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3538 = dd2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3539 = dd3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3540 = dd4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3541 = dd5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3542 = dd6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3543 = dd7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3544 = dd8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3545 = dd9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3546 = dda */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3547 = ddb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3548 = ddc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3549 = ddd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3550 = dde */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3551 = ddf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3552 = de0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3553 = de1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3554 = de2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3555 = de3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3556 = de4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3557 = de5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3558 = de6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3559 = de7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3560 = de8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3561 = de9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3562 = dea */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3563 = deb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3564 = dec */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3565 = ded */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3566 = dee */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3567 = def */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3568 = df0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3569 = df1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3570 = df2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3571 = df3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3572 = df4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3573 = df5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3574 = df6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3575 = df7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3576 = df8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3577 = df9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3578 = dfa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3579 = dfb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3580 = dfc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3581 = dfd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3582 = dfe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3583 = dff */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3584 = e00 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3585 = e01 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3586 = e02 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3587 = e03 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3588 = e04 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3589 = e05 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3590 = e06 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3591 = e07 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3592 = e08 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3593 = e09 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3594 = e0a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3595 = e0b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3596 = e0c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3597 = e0d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3598 = e0e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3599 = e0f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3600 = e10 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3601 = e11 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3602 = e12 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3603 = e13 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3604 = e14 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3605 = e15 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3606 = e16 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3607 = e17 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3608 = e18 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3609 = e19 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3610 = e1a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3611 = e1b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3612 = e1c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3613 = e1d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3614 = e1e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3615 = e1f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3616 = e20 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3617 = e21 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3618 = e22 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3619 = e23 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3620 = e24 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3621 = e25 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3622 = e26 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3623 = e27 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3624 = e28 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3625 = e29 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3626 = e2a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3627 = e2b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3628 = e2c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3629 = e2d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3630 = e2e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3631 = e2f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3632 = e30 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3633 = e31 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3634 = e32 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3635 = e33 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3636 = e34 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3637 = e35 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3638 = e36 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3639 = e37 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3640 = e38 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3641 = e39 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3642 = e3a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3643 = e3b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3644 = e3c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3645 = e3d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3646 = e3e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3647 = e3f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3648 = e40 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3649 = e41 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3650 = e42 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3651 = e43 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3652 = e44 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3653 = e45 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3654 = e46 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3655 = e47 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3656 = e48 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3657 = e49 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3658 = e4a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3659 = e4b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3660 = e4c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3661 = e4d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3662 = e4e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3663 = e4f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3664 = e50 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3665 = e51 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3666 = e52 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3667 = e53 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3668 = e54 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3669 = e55 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3670 = e56 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3671 = e57 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3672 = e58 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3673 = e59 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3674 = e5a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3675 = e5b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3676 = e5c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3677 = e5d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3678 = e5e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3679 = e5f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3680 = e60 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3681 = e61 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3682 = e62 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3683 = e63 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3684 = e64 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3685 = e65 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3686 = e66 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3687 = e67 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3688 = e68 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3689 = e69 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3690 = e6a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3691 = e6b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3692 = e6c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3693 = e6d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3694 = e6e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3695 = e6f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3696 = e70 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3697 = e71 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3698 = e72 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3699 = e73 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3700 = e74 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3701 = e75 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3702 = e76 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3703 = e77 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3704 = e78 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3705 = e79 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3706 = e7a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3707 = e7b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3708 = e7c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3709 = e7d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3710 = e7e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3711 = e7f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3712 = e80 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3713 = e81 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3714 = e82 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3715 = e83 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3716 = e84 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3717 = e85 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3718 = e86 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3719 = e87 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3720 = e88 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3721 = e89 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3722 = e8a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3723 = e8b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3724 = e8c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3725 = e8d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3726 = e8e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3727 = e8f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3728 = e90 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3729 = e91 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3730 = e92 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3731 = e93 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3732 = e94 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3733 = e95 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3734 = e96 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3735 = e97 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3736 = e98 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3737 = e99 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3738 = e9a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3739 = e9b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3740 = e9c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3741 = e9d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3742 = e9e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3743 = e9f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3744 = ea0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3745 = ea1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3746 = ea2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3747 = ea3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3748 = ea4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3749 = ea5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3750 = ea6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3751 = ea7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3752 = ea8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3753 = ea9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3754 = eaa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3755 = eab */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3756 = eac */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3757 = ead */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3758 = eae */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3759 = eaf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3760 = eb0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3761 = eb1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3762 = eb2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3763 = eb3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3764 = eb4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3765 = eb5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3766 = eb6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3767 = eb7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3768 = eb8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3769 = eb9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3770 = eba */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3771 = ebb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3772 = ebc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3773 = ebd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3774 = ebe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3775 = ebf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3776 = ec0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3777 = ec1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3778 = ec2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3779 = ec3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3780 = ec4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3781 = ec5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3782 = ec6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3783 = ec7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3784 = ec8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3785 = ec9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3786 = eca */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3787 = ecb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3788 = ecc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3789 = ecd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3790 = ece */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3791 = ecf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3792 = ed0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3793 = ed1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3794 = ed2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3795 = ed3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3796 = ed4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3797 = ed5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3798 = ed6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3799 = ed7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3800 = ed8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3801 = ed9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3802 = eda */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3803 = edb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3804 = edc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3805 = edd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3806 = ede */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3807 = edf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3808 = ee0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3809 = ee1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3810 = ee2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3811 = ee3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3812 = ee4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3813 = ee5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3814 = ee6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3815 = ee7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3816 = ee8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3817 = ee9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3818 = eea */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3819 = eeb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3820 = eec */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3821 = eed */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3822 = eee */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3823 = eef */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3824 = ef0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3825 = ef1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3826 = ef2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3827 = ef3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3828 = ef4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3829 = ef5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3830 = ef6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3831 = ef7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3832 = ef8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3833 = ef9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3834 = efa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3835 = efb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3836 = efc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3837 = efd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3838 = efe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3839 = eff */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3840 = f00 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3841 = f01 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3842 = f02 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3843 = f03 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3844 = f04 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3845 = f05 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3846 = f06 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3847 = f07 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3848 = f08 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3849 = f09 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3850 = f0a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3851 = f0b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3852 = f0c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3853 = f0d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3854 = f0e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3855 = f0f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3856 = f10 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3857 = f11 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3858 = f12 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3859 = f13 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3860 = f14 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3861 = f15 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3862 = f16 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3863 = f17 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3864 = f18 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3865 = f19 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3866 = f1a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3867 = f1b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3868 = f1c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3869 = f1d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3870 = f1e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3871 = f1f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3872 = f20 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3873 = f21 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3874 = f22 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3875 = f23 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3876 = f24 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3877 = f25 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3878 = f26 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3879 = f27 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3880 = f28 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3881 = f29 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3882 = f2a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3883 = f2b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3884 = f2c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3885 = f2d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3886 = f2e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3887 = f2f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3888 = f30 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3889 = f31 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3890 = f32 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3891 = f33 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3892 = f34 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3893 = f35 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3894 = f36 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3895 = f37 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3896 = f38 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3897 = f39 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3898 = f3a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3899 = f3b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3900 = f3c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3901 = f3d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3902 = f3e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3903 = f3f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3904 = f40 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3905 = f41 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3906 = f42 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3907 = f43 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3908 = f44 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3909 = f45 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3910 = f46 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3911 = f47 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3912 = f48 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3913 = f49 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3914 = f4a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3915 = f4b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3916 = f4c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3917 = f4d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3918 = f4e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3919 = f4f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3920 = f50 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3921 = f51 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3922 = f52 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3923 = f53 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3924 = f54 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3925 = f55 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3926 = f56 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3927 = f57 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3928 = f58 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3929 = f59 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3930 = f5a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3931 = f5b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3932 = f5c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3933 = f5d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3934 = f5e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3935 = f5f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3936 = f60 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3937 = f61 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3938 = f62 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3939 = f63 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3940 = f64 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3941 = f65 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3942 = f66 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3943 = f67 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3944 = f68 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3945 = f69 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3946 = f6a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3947 = f6b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3948 = f6c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3949 = f6d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3950 = f6e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3951 = f6f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3952 = f70 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3953 = f71 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3954 = f72 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3955 = f73 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3956 = f74 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3957 = f75 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3958 = f76 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3959 = f77 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3960 = f78 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3961 = f79 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3962 = f7a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3963 = f7b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3964 = f7c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3965 = f7d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3966 = f7e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3967 = f7f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3968 = f80 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3969 = f81 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3970 = f82 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3971 = f83 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3972 = f84 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3973 = f85 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3974 = f86 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3975 = f87 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3976 = f88 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3977 = f89 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3978 = f8a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3979 = f8b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3980 = f8c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3981 = f8d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3982 = f8e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3983 = f8f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3984 = f90 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3985 = f91 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3986 = f92 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3987 = f93 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3988 = f94 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3989 = f95 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3990 = f96 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3991 = f97 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3992 = f98 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3993 = f99 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3994 = f9a */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3995 = f9b */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3996 = f9c */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3997 = f9d */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3998 = f9e */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 3999 = f9f */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4000 = fa0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4001 = fa1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4002 = fa2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4003 = fa3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4004 = fa4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4005 = fa5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4006 = fa6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4007 = fa7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4008 = fa8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4009 = fa9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4010 = faa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4011 = fab */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4012 = fac */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4013 = fad */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4014 = fae */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4015 = faf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4016 = fb0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4017 = fb1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4018 = fb2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4019 = fb3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4020 = fb4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4021 = fb5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4022 = fb6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4023 = fb7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4024 = fb8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4025 = fb9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4026 = fba */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4027 = fbb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4028 = fbc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4029 = fbd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4030 = fbe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4031 = fbf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4032 = fc0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4033 = fc1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4034 = fc2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4035 = fc3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4036 = fc4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4037 = fc5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4038 = fc6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4039 = fc7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4040 = fc8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4041 = fc9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4042 = fca */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4043 = fcb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4044 = fcc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4045 = fcd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4046 = fce */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4047 = fcf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4048 = fd0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4049 = fd1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4050 = fd2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4051 = fd3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4052 = fd4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4053 = fd5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4054 = fd6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4055 = fd7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4056 = fd8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4057 = fd9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4058 = fda */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4059 = fdb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4060 = fdc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4061 = fdd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4062 = fde */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4063 = fdf */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4064 = fe0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4065 = fe1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4066 = fe2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4067 = fe3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4068 = fe4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4069 = fe5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4070 = fe6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4071 = fe7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4072 = fe8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4073 = fe9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4074 = fea */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4075 = feb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4076 = fec */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4077 = fed */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4078 = fee */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4079 = fef */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4080 = ff0 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4081 = ff1 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4082 = ff2 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4083 = ff3 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4084 = ff4 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4085 = ff5 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4086 = ff6 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4087 = ff7 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4088 = ff8 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4089 = ff9 */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4090 = ffa */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4091 = ffb */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4092 = ffc */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4093 = ffd */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4094 = ffe */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4095 = fff */ {4, 0, 3}, /* 0x0003 => 0x0c00+(1024)*/
+ /* 4096 = 1000 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4097 = 1001 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4098 = 1002 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4099 = 1003 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4100 = 1004 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4101 = 1005 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4102 = 1006 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4103 = 1007 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4104 = 1008 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4105 = 1009 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4106 = 100a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4107 = 100b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4108 = 100c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4109 = 100d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4110 = 100e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4111 = 100f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4112 = 1010 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4113 = 1011 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4114 = 1012 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4115 = 1013 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4116 = 1014 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4117 = 1015 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4118 = 1016 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4119 = 1017 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4120 = 1018 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4121 = 1019 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4122 = 101a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4123 = 101b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4124 = 101c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4125 = 101d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4126 = 101e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4127 = 101f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4128 = 1020 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4129 = 1021 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4130 = 1022 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4131 = 1023 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4132 = 1024 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4133 = 1025 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4134 = 1026 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4135 = 1027 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4136 = 1028 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4137 = 1029 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4138 = 102a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4139 = 102b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4140 = 102c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4141 = 102d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4142 = 102e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4143 = 102f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4144 = 1030 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4145 = 1031 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4146 = 1032 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4147 = 1033 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4148 = 1034 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4149 = 1035 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4150 = 1036 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4151 = 1037 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4152 = 1038 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4153 = 1039 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4154 = 103a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4155 = 103b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4156 = 103c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4157 = 103d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4158 = 103e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4159 = 103f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4160 = 1040 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4161 = 1041 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4162 = 1042 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4163 = 1043 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4164 = 1044 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4165 = 1045 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4166 = 1046 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4167 = 1047 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4168 = 1048 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4169 = 1049 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4170 = 104a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4171 = 104b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4172 = 104c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4173 = 104d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4174 = 104e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4175 = 104f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4176 = 1050 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4177 = 1051 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4178 = 1052 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4179 = 1053 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4180 = 1054 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4181 = 1055 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4182 = 1056 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4183 = 1057 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4184 = 1058 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4185 = 1059 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4186 = 105a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4187 = 105b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4188 = 105c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4189 = 105d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4190 = 105e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4191 = 105f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4192 = 1060 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4193 = 1061 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4194 = 1062 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4195 = 1063 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4196 = 1064 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4197 = 1065 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4198 = 1066 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4199 = 1067 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4200 = 1068 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4201 = 1069 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4202 = 106a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4203 = 106b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4204 = 106c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4205 = 106d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4206 = 106e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4207 = 106f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4208 = 1070 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4209 = 1071 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4210 = 1072 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4211 = 1073 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4212 = 1074 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4213 = 1075 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4214 = 1076 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4215 = 1077 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4216 = 1078 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4217 = 1079 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4218 = 107a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4219 = 107b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4220 = 107c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4221 = 107d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4222 = 107e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4223 = 107f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4224 = 1080 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4225 = 1081 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4226 = 1082 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4227 = 1083 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4228 = 1084 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4229 = 1085 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4230 = 1086 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4231 = 1087 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4232 = 1088 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4233 = 1089 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4234 = 108a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4235 = 108b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4236 = 108c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4237 = 108d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4238 = 108e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4239 = 108f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4240 = 1090 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4241 = 1091 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4242 = 1092 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4243 = 1093 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4244 = 1094 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4245 = 1095 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4246 = 1096 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4247 = 1097 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4248 = 1098 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4249 = 1099 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4250 = 109a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4251 = 109b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4252 = 109c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4253 = 109d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4254 = 109e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4255 = 109f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4256 = 10a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4257 = 10a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4258 = 10a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4259 = 10a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4260 = 10a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4261 = 10a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4262 = 10a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4263 = 10a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4264 = 10a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4265 = 10a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4266 = 10aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4267 = 10ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4268 = 10ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4269 = 10ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4270 = 10ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4271 = 10af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4272 = 10b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4273 = 10b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4274 = 10b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4275 = 10b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4276 = 10b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4277 = 10b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4278 = 10b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4279 = 10b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4280 = 10b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4281 = 10b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4282 = 10ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4283 = 10bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4284 = 10bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4285 = 10bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4286 = 10be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4287 = 10bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4288 = 10c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4289 = 10c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4290 = 10c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4291 = 10c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4292 = 10c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4293 = 10c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4294 = 10c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4295 = 10c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4296 = 10c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4297 = 10c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4298 = 10ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4299 = 10cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4300 = 10cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4301 = 10cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4302 = 10ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4303 = 10cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4304 = 10d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4305 = 10d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4306 = 10d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4307 = 10d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4308 = 10d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4309 = 10d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4310 = 10d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4311 = 10d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4312 = 10d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4313 = 10d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4314 = 10da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4315 = 10db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4316 = 10dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4317 = 10dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4318 = 10de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4319 = 10df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4320 = 10e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4321 = 10e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4322 = 10e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4323 = 10e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4324 = 10e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4325 = 10e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4326 = 10e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4327 = 10e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4328 = 10e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4329 = 10e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4330 = 10ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4331 = 10eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4332 = 10ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4333 = 10ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4334 = 10ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4335 = 10ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4336 = 10f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4337 = 10f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4338 = 10f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4339 = 10f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4340 = 10f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4341 = 10f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4342 = 10f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4343 = 10f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4344 = 10f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4345 = 10f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4346 = 10fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4347 = 10fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4348 = 10fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4349 = 10fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4350 = 10fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4351 = 10ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4352 = 1100 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4353 = 1101 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4354 = 1102 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4355 = 1103 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4356 = 1104 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4357 = 1105 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4358 = 1106 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4359 = 1107 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4360 = 1108 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4361 = 1109 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4362 = 110a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4363 = 110b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4364 = 110c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4365 = 110d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4366 = 110e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4367 = 110f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4368 = 1110 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4369 = 1111 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4370 = 1112 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4371 = 1113 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4372 = 1114 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4373 = 1115 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4374 = 1116 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4375 = 1117 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4376 = 1118 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4377 = 1119 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4378 = 111a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4379 = 111b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4380 = 111c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4381 = 111d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4382 = 111e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4383 = 111f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4384 = 1120 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4385 = 1121 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4386 = 1122 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4387 = 1123 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4388 = 1124 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4389 = 1125 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4390 = 1126 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4391 = 1127 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4392 = 1128 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4393 = 1129 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4394 = 112a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4395 = 112b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4396 = 112c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4397 = 112d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4398 = 112e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4399 = 112f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4400 = 1130 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4401 = 1131 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4402 = 1132 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4403 = 1133 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4404 = 1134 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4405 = 1135 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4406 = 1136 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4407 = 1137 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4408 = 1138 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4409 = 1139 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4410 = 113a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4411 = 113b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4412 = 113c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4413 = 113d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4414 = 113e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4415 = 113f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4416 = 1140 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4417 = 1141 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4418 = 1142 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4419 = 1143 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4420 = 1144 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4421 = 1145 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4422 = 1146 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4423 = 1147 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4424 = 1148 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4425 = 1149 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4426 = 114a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4427 = 114b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4428 = 114c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4429 = 114d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4430 = 114e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4431 = 114f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4432 = 1150 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4433 = 1151 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4434 = 1152 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4435 = 1153 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4436 = 1154 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4437 = 1155 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4438 = 1156 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4439 = 1157 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4440 = 1158 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4441 = 1159 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4442 = 115a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4443 = 115b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4444 = 115c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4445 = 115d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4446 = 115e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4447 = 115f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4448 = 1160 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4449 = 1161 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4450 = 1162 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4451 = 1163 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4452 = 1164 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4453 = 1165 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4454 = 1166 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4455 = 1167 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4456 = 1168 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4457 = 1169 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4458 = 116a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4459 = 116b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4460 = 116c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4461 = 116d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4462 = 116e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4463 = 116f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4464 = 1170 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4465 = 1171 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4466 = 1172 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4467 = 1173 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4468 = 1174 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4469 = 1175 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4470 = 1176 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4471 = 1177 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4472 = 1178 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4473 = 1179 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4474 = 117a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4475 = 117b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4476 = 117c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4477 = 117d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4478 = 117e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4479 = 117f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4480 = 1180 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4481 = 1181 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4482 = 1182 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4483 = 1183 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4484 = 1184 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4485 = 1185 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4486 = 1186 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4487 = 1187 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4488 = 1188 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4489 = 1189 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4490 = 118a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4491 = 118b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4492 = 118c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4493 = 118d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4494 = 118e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4495 = 118f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4496 = 1190 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4497 = 1191 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4498 = 1192 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4499 = 1193 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4500 = 1194 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4501 = 1195 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4502 = 1196 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4503 = 1197 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4504 = 1198 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4505 = 1199 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4506 = 119a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4507 = 119b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4508 = 119c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4509 = 119d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4510 = 119e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4511 = 119f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4512 = 11a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4513 = 11a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4514 = 11a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4515 = 11a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4516 = 11a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4517 = 11a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4518 = 11a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4519 = 11a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4520 = 11a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4521 = 11a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4522 = 11aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4523 = 11ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4524 = 11ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4525 = 11ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4526 = 11ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4527 = 11af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4528 = 11b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4529 = 11b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4530 = 11b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4531 = 11b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4532 = 11b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4533 = 11b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4534 = 11b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4535 = 11b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4536 = 11b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4537 = 11b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4538 = 11ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4539 = 11bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4540 = 11bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4541 = 11bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4542 = 11be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4543 = 11bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4544 = 11c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4545 = 11c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4546 = 11c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4547 = 11c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4548 = 11c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4549 = 11c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4550 = 11c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4551 = 11c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4552 = 11c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4553 = 11c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4554 = 11ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4555 = 11cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4556 = 11cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4557 = 11cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4558 = 11ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4559 = 11cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4560 = 11d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4561 = 11d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4562 = 11d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4563 = 11d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4564 = 11d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4565 = 11d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4566 = 11d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4567 = 11d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4568 = 11d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4569 = 11d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4570 = 11da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4571 = 11db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4572 = 11dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4573 = 11dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4574 = 11de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4575 = 11df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4576 = 11e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4577 = 11e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4578 = 11e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4579 = 11e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4580 = 11e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4581 = 11e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4582 = 11e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4583 = 11e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4584 = 11e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4585 = 11e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4586 = 11ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4587 = 11eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4588 = 11ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4589 = 11ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4590 = 11ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4591 = 11ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4592 = 11f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4593 = 11f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4594 = 11f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4595 = 11f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4596 = 11f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4597 = 11f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4598 = 11f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4599 = 11f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4600 = 11f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4601 = 11f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4602 = 11fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4603 = 11fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4604 = 11fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4605 = 11fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4606 = 11fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4607 = 11ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4608 = 1200 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4609 = 1201 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4610 = 1202 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4611 = 1203 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4612 = 1204 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4613 = 1205 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4614 = 1206 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4615 = 1207 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4616 = 1208 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4617 = 1209 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4618 = 120a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4619 = 120b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4620 = 120c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4621 = 120d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4622 = 120e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4623 = 120f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4624 = 1210 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4625 = 1211 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4626 = 1212 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4627 = 1213 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4628 = 1214 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4629 = 1215 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4630 = 1216 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4631 = 1217 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4632 = 1218 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4633 = 1219 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4634 = 121a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4635 = 121b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4636 = 121c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4637 = 121d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4638 = 121e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4639 = 121f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4640 = 1220 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4641 = 1221 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4642 = 1222 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4643 = 1223 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4644 = 1224 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4645 = 1225 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4646 = 1226 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4647 = 1227 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4648 = 1228 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4649 = 1229 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4650 = 122a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4651 = 122b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4652 = 122c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4653 = 122d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4654 = 122e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4655 = 122f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4656 = 1230 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4657 = 1231 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4658 = 1232 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4659 = 1233 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4660 = 1234 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4661 = 1235 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4662 = 1236 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4663 = 1237 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4664 = 1238 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4665 = 1239 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4666 = 123a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4667 = 123b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4668 = 123c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4669 = 123d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4670 = 123e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4671 = 123f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4672 = 1240 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4673 = 1241 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4674 = 1242 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4675 = 1243 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4676 = 1244 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4677 = 1245 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4678 = 1246 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4679 = 1247 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4680 = 1248 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4681 = 1249 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4682 = 124a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4683 = 124b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4684 = 124c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4685 = 124d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4686 = 124e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4687 = 124f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4688 = 1250 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4689 = 1251 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4690 = 1252 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4691 = 1253 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4692 = 1254 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4693 = 1255 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4694 = 1256 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4695 = 1257 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4696 = 1258 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4697 = 1259 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4698 = 125a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4699 = 125b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4700 = 125c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4701 = 125d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4702 = 125e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4703 = 125f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4704 = 1260 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4705 = 1261 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4706 = 1262 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4707 = 1263 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4708 = 1264 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4709 = 1265 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4710 = 1266 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4711 = 1267 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4712 = 1268 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4713 = 1269 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4714 = 126a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4715 = 126b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4716 = 126c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4717 = 126d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4718 = 126e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4719 = 126f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4720 = 1270 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4721 = 1271 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4722 = 1272 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4723 = 1273 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4724 = 1274 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4725 = 1275 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4726 = 1276 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4727 = 1277 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4728 = 1278 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4729 = 1279 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4730 = 127a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4731 = 127b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4732 = 127c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4733 = 127d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4734 = 127e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4735 = 127f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4736 = 1280 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4737 = 1281 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4738 = 1282 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4739 = 1283 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4740 = 1284 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4741 = 1285 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4742 = 1286 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4743 = 1287 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4744 = 1288 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4745 = 1289 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4746 = 128a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4747 = 128b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4748 = 128c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4749 = 128d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4750 = 128e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4751 = 128f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4752 = 1290 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4753 = 1291 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4754 = 1292 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4755 = 1293 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4756 = 1294 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4757 = 1295 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4758 = 1296 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4759 = 1297 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4760 = 1298 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4761 = 1299 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4762 = 129a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4763 = 129b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4764 = 129c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4765 = 129d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4766 = 129e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4767 = 129f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4768 = 12a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4769 = 12a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4770 = 12a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4771 = 12a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4772 = 12a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4773 = 12a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4774 = 12a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4775 = 12a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4776 = 12a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4777 = 12a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4778 = 12aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4779 = 12ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4780 = 12ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4781 = 12ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4782 = 12ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4783 = 12af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4784 = 12b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4785 = 12b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4786 = 12b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4787 = 12b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4788 = 12b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4789 = 12b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4790 = 12b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4791 = 12b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4792 = 12b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4793 = 12b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4794 = 12ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4795 = 12bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4796 = 12bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4797 = 12bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4798 = 12be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4799 = 12bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4800 = 12c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4801 = 12c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4802 = 12c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4803 = 12c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4804 = 12c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4805 = 12c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4806 = 12c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4807 = 12c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4808 = 12c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4809 = 12c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4810 = 12ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4811 = 12cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4812 = 12cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4813 = 12cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4814 = 12ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4815 = 12cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4816 = 12d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4817 = 12d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4818 = 12d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4819 = 12d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4820 = 12d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4821 = 12d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4822 = 12d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4823 = 12d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4824 = 12d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4825 = 12d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4826 = 12da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4827 = 12db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4828 = 12dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4829 = 12dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4830 = 12de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4831 = 12df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4832 = 12e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4833 = 12e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4834 = 12e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4835 = 12e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4836 = 12e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4837 = 12e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4838 = 12e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4839 = 12e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4840 = 12e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4841 = 12e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4842 = 12ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4843 = 12eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4844 = 12ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4845 = 12ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4846 = 12ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4847 = 12ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4848 = 12f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4849 = 12f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4850 = 12f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4851 = 12f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4852 = 12f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4853 = 12f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4854 = 12f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4855 = 12f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4856 = 12f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4857 = 12f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4858 = 12fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4859 = 12fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4860 = 12fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4861 = 12fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4862 = 12fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4863 = 12ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4864 = 1300 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4865 = 1301 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4866 = 1302 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4867 = 1303 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4868 = 1304 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4869 = 1305 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4870 = 1306 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4871 = 1307 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4872 = 1308 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4873 = 1309 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4874 = 130a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4875 = 130b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4876 = 130c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4877 = 130d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4878 = 130e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4879 = 130f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4880 = 1310 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4881 = 1311 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4882 = 1312 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4883 = 1313 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4884 = 1314 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4885 = 1315 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4886 = 1316 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4887 = 1317 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4888 = 1318 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4889 = 1319 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4890 = 131a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4891 = 131b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4892 = 131c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4893 = 131d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4894 = 131e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4895 = 131f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4896 = 1320 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4897 = 1321 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4898 = 1322 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4899 = 1323 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4900 = 1324 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4901 = 1325 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4902 = 1326 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4903 = 1327 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4904 = 1328 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4905 = 1329 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4906 = 132a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4907 = 132b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4908 = 132c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4909 = 132d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4910 = 132e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4911 = 132f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4912 = 1330 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4913 = 1331 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4914 = 1332 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4915 = 1333 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4916 = 1334 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4917 = 1335 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4918 = 1336 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4919 = 1337 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4920 = 1338 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4921 = 1339 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4922 = 133a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4923 = 133b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4924 = 133c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4925 = 133d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4926 = 133e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4927 = 133f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4928 = 1340 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4929 = 1341 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4930 = 1342 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4931 = 1343 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4932 = 1344 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4933 = 1345 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4934 = 1346 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4935 = 1347 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4936 = 1348 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4937 = 1349 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4938 = 134a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4939 = 134b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4940 = 134c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4941 = 134d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4942 = 134e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4943 = 134f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4944 = 1350 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4945 = 1351 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4946 = 1352 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4947 = 1353 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4948 = 1354 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4949 = 1355 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4950 = 1356 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4951 = 1357 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4952 = 1358 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4953 = 1359 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4954 = 135a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4955 = 135b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4956 = 135c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4957 = 135d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4958 = 135e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4959 = 135f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4960 = 1360 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4961 = 1361 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4962 = 1362 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4963 = 1363 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4964 = 1364 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4965 = 1365 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4966 = 1366 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4967 = 1367 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4968 = 1368 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4969 = 1369 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4970 = 136a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4971 = 136b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4972 = 136c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4973 = 136d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4974 = 136e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4975 = 136f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4976 = 1370 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4977 = 1371 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4978 = 1372 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4979 = 1373 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4980 = 1374 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4981 = 1375 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4982 = 1376 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4983 = 1377 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4984 = 1378 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4985 = 1379 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4986 = 137a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4987 = 137b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4988 = 137c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4989 = 137d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4990 = 137e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4991 = 137f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4992 = 1380 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4993 = 1381 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4994 = 1382 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4995 = 1383 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4996 = 1384 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4997 = 1385 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4998 = 1386 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 4999 = 1387 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5000 = 1388 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5001 = 1389 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5002 = 138a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5003 = 138b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5004 = 138c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5005 = 138d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5006 = 138e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5007 = 138f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5008 = 1390 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5009 = 1391 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5010 = 1392 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5011 = 1393 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5012 = 1394 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5013 = 1395 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5014 = 1396 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5015 = 1397 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5016 = 1398 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5017 = 1399 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5018 = 139a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5019 = 139b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5020 = 139c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5021 = 139d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5022 = 139e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5023 = 139f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5024 = 13a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5025 = 13a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5026 = 13a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5027 = 13a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5028 = 13a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5029 = 13a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5030 = 13a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5031 = 13a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5032 = 13a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5033 = 13a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5034 = 13aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5035 = 13ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5036 = 13ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5037 = 13ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5038 = 13ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5039 = 13af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5040 = 13b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5041 = 13b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5042 = 13b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5043 = 13b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5044 = 13b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5045 = 13b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5046 = 13b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5047 = 13b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5048 = 13b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5049 = 13b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5050 = 13ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5051 = 13bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5052 = 13bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5053 = 13bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5054 = 13be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5055 = 13bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5056 = 13c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5057 = 13c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5058 = 13c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5059 = 13c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5060 = 13c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5061 = 13c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5062 = 13c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5063 = 13c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5064 = 13c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5065 = 13c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5066 = 13ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5067 = 13cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5068 = 13cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5069 = 13cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5070 = 13ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5071 = 13cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5072 = 13d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5073 = 13d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5074 = 13d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5075 = 13d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5076 = 13d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5077 = 13d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5078 = 13d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5079 = 13d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5080 = 13d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5081 = 13d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5082 = 13da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5083 = 13db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5084 = 13dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5085 = 13dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5086 = 13de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5087 = 13df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5088 = 13e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5089 = 13e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5090 = 13e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5091 = 13e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5092 = 13e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5093 = 13e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5094 = 13e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5095 = 13e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5096 = 13e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5097 = 13e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5098 = 13ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5099 = 13eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5100 = 13ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5101 = 13ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5102 = 13ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5103 = 13ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5104 = 13f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5105 = 13f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5106 = 13f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5107 = 13f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5108 = 13f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5109 = 13f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5110 = 13f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5111 = 13f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5112 = 13f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5113 = 13f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5114 = 13fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5115 = 13fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5116 = 13fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5117 = 13fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5118 = 13fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5119 = 13ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5120 = 1400 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5121 = 1401 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5122 = 1402 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5123 = 1403 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5124 = 1404 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5125 = 1405 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5126 = 1406 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5127 = 1407 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5128 = 1408 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5129 = 1409 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5130 = 140a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5131 = 140b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5132 = 140c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5133 = 140d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5134 = 140e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5135 = 140f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5136 = 1410 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5137 = 1411 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5138 = 1412 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5139 = 1413 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5140 = 1414 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5141 = 1415 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5142 = 1416 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5143 = 1417 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5144 = 1418 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5145 = 1419 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5146 = 141a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5147 = 141b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5148 = 141c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5149 = 141d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5150 = 141e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5151 = 141f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5152 = 1420 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5153 = 1421 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5154 = 1422 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5155 = 1423 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5156 = 1424 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5157 = 1425 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5158 = 1426 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5159 = 1427 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5160 = 1428 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5161 = 1429 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5162 = 142a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5163 = 142b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5164 = 142c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5165 = 142d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5166 = 142e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5167 = 142f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5168 = 1430 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5169 = 1431 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5170 = 1432 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5171 = 1433 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5172 = 1434 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5173 = 1435 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5174 = 1436 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5175 = 1437 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5176 = 1438 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5177 = 1439 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5178 = 143a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5179 = 143b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5180 = 143c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5181 = 143d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5182 = 143e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5183 = 143f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5184 = 1440 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5185 = 1441 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5186 = 1442 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5187 = 1443 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5188 = 1444 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5189 = 1445 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5190 = 1446 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5191 = 1447 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5192 = 1448 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5193 = 1449 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5194 = 144a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5195 = 144b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5196 = 144c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5197 = 144d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5198 = 144e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5199 = 144f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5200 = 1450 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5201 = 1451 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5202 = 1452 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5203 = 1453 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5204 = 1454 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5205 = 1455 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5206 = 1456 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5207 = 1457 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5208 = 1458 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5209 = 1459 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5210 = 145a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5211 = 145b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5212 = 145c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5213 = 145d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5214 = 145e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5215 = 145f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5216 = 1460 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5217 = 1461 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5218 = 1462 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5219 = 1463 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5220 = 1464 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5221 = 1465 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5222 = 1466 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5223 = 1467 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5224 = 1468 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5225 = 1469 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5226 = 146a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5227 = 146b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5228 = 146c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5229 = 146d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5230 = 146e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5231 = 146f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5232 = 1470 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5233 = 1471 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5234 = 1472 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5235 = 1473 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5236 = 1474 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5237 = 1475 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5238 = 1476 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5239 = 1477 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5240 = 1478 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5241 = 1479 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5242 = 147a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5243 = 147b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5244 = 147c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5245 = 147d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5246 = 147e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5247 = 147f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5248 = 1480 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5249 = 1481 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5250 = 1482 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5251 = 1483 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5252 = 1484 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5253 = 1485 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5254 = 1486 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5255 = 1487 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5256 = 1488 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5257 = 1489 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5258 = 148a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5259 = 148b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5260 = 148c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5261 = 148d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5262 = 148e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5263 = 148f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5264 = 1490 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5265 = 1491 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5266 = 1492 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5267 = 1493 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5268 = 1494 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5269 = 1495 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5270 = 1496 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5271 = 1497 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5272 = 1498 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5273 = 1499 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5274 = 149a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5275 = 149b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5276 = 149c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5277 = 149d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5278 = 149e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5279 = 149f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5280 = 14a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5281 = 14a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5282 = 14a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5283 = 14a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5284 = 14a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5285 = 14a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5286 = 14a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5287 = 14a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5288 = 14a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5289 = 14a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5290 = 14aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5291 = 14ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5292 = 14ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5293 = 14ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5294 = 14ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5295 = 14af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5296 = 14b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5297 = 14b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5298 = 14b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5299 = 14b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5300 = 14b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5301 = 14b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5302 = 14b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5303 = 14b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5304 = 14b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5305 = 14b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5306 = 14ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5307 = 14bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5308 = 14bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5309 = 14bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5310 = 14be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5311 = 14bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5312 = 14c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5313 = 14c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5314 = 14c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5315 = 14c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5316 = 14c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5317 = 14c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5318 = 14c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5319 = 14c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5320 = 14c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5321 = 14c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5322 = 14ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5323 = 14cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5324 = 14cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5325 = 14cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5326 = 14ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5327 = 14cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5328 = 14d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5329 = 14d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5330 = 14d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5331 = 14d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5332 = 14d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5333 = 14d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5334 = 14d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5335 = 14d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5336 = 14d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5337 = 14d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5338 = 14da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5339 = 14db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5340 = 14dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5341 = 14dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5342 = 14de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5343 = 14df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5344 = 14e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5345 = 14e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5346 = 14e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5347 = 14e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5348 = 14e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5349 = 14e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5350 = 14e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5351 = 14e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5352 = 14e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5353 = 14e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5354 = 14ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5355 = 14eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5356 = 14ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5357 = 14ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5358 = 14ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5359 = 14ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5360 = 14f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5361 = 14f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5362 = 14f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5363 = 14f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5364 = 14f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5365 = 14f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5366 = 14f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5367 = 14f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5368 = 14f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5369 = 14f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5370 = 14fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5371 = 14fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5372 = 14fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5373 = 14fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5374 = 14fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5375 = 14ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5376 = 1500 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5377 = 1501 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5378 = 1502 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5379 = 1503 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5380 = 1504 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5381 = 1505 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5382 = 1506 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5383 = 1507 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5384 = 1508 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5385 = 1509 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5386 = 150a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5387 = 150b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5388 = 150c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5389 = 150d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5390 = 150e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5391 = 150f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5392 = 1510 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5393 = 1511 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5394 = 1512 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5395 = 1513 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5396 = 1514 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5397 = 1515 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5398 = 1516 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5399 = 1517 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5400 = 1518 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5401 = 1519 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5402 = 151a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5403 = 151b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5404 = 151c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5405 = 151d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5406 = 151e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5407 = 151f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5408 = 1520 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5409 = 1521 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5410 = 1522 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5411 = 1523 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5412 = 1524 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5413 = 1525 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5414 = 1526 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5415 = 1527 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5416 = 1528 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5417 = 1529 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5418 = 152a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5419 = 152b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5420 = 152c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5421 = 152d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5422 = 152e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5423 = 152f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5424 = 1530 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5425 = 1531 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5426 = 1532 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5427 = 1533 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5428 = 1534 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5429 = 1535 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5430 = 1536 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5431 = 1537 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5432 = 1538 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5433 = 1539 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5434 = 153a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5435 = 153b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5436 = 153c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5437 = 153d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5438 = 153e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5439 = 153f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5440 = 1540 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5441 = 1541 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5442 = 1542 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5443 = 1543 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5444 = 1544 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5445 = 1545 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5446 = 1546 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5447 = 1547 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5448 = 1548 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5449 = 1549 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5450 = 154a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5451 = 154b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5452 = 154c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5453 = 154d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5454 = 154e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5455 = 154f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5456 = 1550 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5457 = 1551 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5458 = 1552 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5459 = 1553 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5460 = 1554 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5461 = 1555 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5462 = 1556 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5463 = 1557 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5464 = 1558 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5465 = 1559 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5466 = 155a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5467 = 155b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5468 = 155c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5469 = 155d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5470 = 155e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5471 = 155f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5472 = 1560 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5473 = 1561 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5474 = 1562 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5475 = 1563 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5476 = 1564 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5477 = 1565 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5478 = 1566 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5479 = 1567 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5480 = 1568 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5481 = 1569 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5482 = 156a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5483 = 156b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5484 = 156c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5485 = 156d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5486 = 156e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5487 = 156f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5488 = 1570 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5489 = 1571 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5490 = 1572 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5491 = 1573 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5492 = 1574 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5493 = 1575 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5494 = 1576 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5495 = 1577 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5496 = 1578 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5497 = 1579 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5498 = 157a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5499 = 157b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5500 = 157c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5501 = 157d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5502 = 157e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5503 = 157f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5504 = 1580 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5505 = 1581 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5506 = 1582 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5507 = 1583 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5508 = 1584 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5509 = 1585 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5510 = 1586 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5511 = 1587 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5512 = 1588 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5513 = 1589 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5514 = 158a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5515 = 158b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5516 = 158c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5517 = 158d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5518 = 158e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5519 = 158f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5520 = 1590 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5521 = 1591 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5522 = 1592 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5523 = 1593 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5524 = 1594 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5525 = 1595 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5526 = 1596 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5527 = 1597 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5528 = 1598 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5529 = 1599 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5530 = 159a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5531 = 159b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5532 = 159c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5533 = 159d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5534 = 159e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5535 = 159f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5536 = 15a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5537 = 15a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5538 = 15a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5539 = 15a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5540 = 15a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5541 = 15a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5542 = 15a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5543 = 15a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5544 = 15a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5545 = 15a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5546 = 15aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5547 = 15ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5548 = 15ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5549 = 15ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5550 = 15ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5551 = 15af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5552 = 15b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5553 = 15b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5554 = 15b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5555 = 15b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5556 = 15b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5557 = 15b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5558 = 15b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5559 = 15b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5560 = 15b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5561 = 15b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5562 = 15ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5563 = 15bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5564 = 15bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5565 = 15bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5566 = 15be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5567 = 15bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5568 = 15c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5569 = 15c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5570 = 15c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5571 = 15c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5572 = 15c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5573 = 15c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5574 = 15c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5575 = 15c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5576 = 15c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5577 = 15c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5578 = 15ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5579 = 15cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5580 = 15cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5581 = 15cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5582 = 15ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5583 = 15cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5584 = 15d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5585 = 15d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5586 = 15d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5587 = 15d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5588 = 15d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5589 = 15d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5590 = 15d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5591 = 15d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5592 = 15d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5593 = 15d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5594 = 15da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5595 = 15db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5596 = 15dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5597 = 15dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5598 = 15de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5599 = 15df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5600 = 15e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5601 = 15e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5602 = 15e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5603 = 15e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5604 = 15e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5605 = 15e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5606 = 15e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5607 = 15e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5608 = 15e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5609 = 15e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5610 = 15ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5611 = 15eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5612 = 15ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5613 = 15ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5614 = 15ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5615 = 15ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5616 = 15f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5617 = 15f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5618 = 15f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5619 = 15f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5620 = 15f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5621 = 15f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5622 = 15f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5623 = 15f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5624 = 15f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5625 = 15f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5626 = 15fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5627 = 15fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5628 = 15fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5629 = 15fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5630 = 15fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5631 = 15ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5632 = 1600 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5633 = 1601 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5634 = 1602 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5635 = 1603 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5636 = 1604 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5637 = 1605 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5638 = 1606 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5639 = 1607 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5640 = 1608 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5641 = 1609 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5642 = 160a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5643 = 160b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5644 = 160c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5645 = 160d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5646 = 160e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5647 = 160f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5648 = 1610 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5649 = 1611 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5650 = 1612 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5651 = 1613 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5652 = 1614 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5653 = 1615 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5654 = 1616 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5655 = 1617 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5656 = 1618 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5657 = 1619 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5658 = 161a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5659 = 161b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5660 = 161c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5661 = 161d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5662 = 161e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5663 = 161f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5664 = 1620 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5665 = 1621 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5666 = 1622 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5667 = 1623 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5668 = 1624 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5669 = 1625 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5670 = 1626 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5671 = 1627 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5672 = 1628 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5673 = 1629 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5674 = 162a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5675 = 162b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5676 = 162c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5677 = 162d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5678 = 162e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5679 = 162f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5680 = 1630 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5681 = 1631 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5682 = 1632 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5683 = 1633 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5684 = 1634 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5685 = 1635 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5686 = 1636 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5687 = 1637 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5688 = 1638 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5689 = 1639 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5690 = 163a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5691 = 163b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5692 = 163c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5693 = 163d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5694 = 163e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5695 = 163f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5696 = 1640 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5697 = 1641 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5698 = 1642 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5699 = 1643 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5700 = 1644 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5701 = 1645 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5702 = 1646 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5703 = 1647 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5704 = 1648 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5705 = 1649 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5706 = 164a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5707 = 164b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5708 = 164c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5709 = 164d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5710 = 164e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5711 = 164f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5712 = 1650 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5713 = 1651 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5714 = 1652 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5715 = 1653 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5716 = 1654 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5717 = 1655 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5718 = 1656 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5719 = 1657 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5720 = 1658 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5721 = 1659 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5722 = 165a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5723 = 165b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5724 = 165c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5725 = 165d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5726 = 165e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5727 = 165f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5728 = 1660 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5729 = 1661 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5730 = 1662 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5731 = 1663 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5732 = 1664 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5733 = 1665 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5734 = 1666 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5735 = 1667 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5736 = 1668 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5737 = 1669 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5738 = 166a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5739 = 166b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5740 = 166c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5741 = 166d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5742 = 166e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5743 = 166f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5744 = 1670 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5745 = 1671 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5746 = 1672 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5747 = 1673 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5748 = 1674 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5749 = 1675 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5750 = 1676 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5751 = 1677 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5752 = 1678 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5753 = 1679 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5754 = 167a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5755 = 167b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5756 = 167c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5757 = 167d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5758 = 167e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5759 = 167f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5760 = 1680 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5761 = 1681 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5762 = 1682 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5763 = 1683 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5764 = 1684 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5765 = 1685 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5766 = 1686 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5767 = 1687 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5768 = 1688 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5769 = 1689 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5770 = 168a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5771 = 168b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5772 = 168c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5773 = 168d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5774 = 168e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5775 = 168f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5776 = 1690 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5777 = 1691 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5778 = 1692 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5779 = 1693 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5780 = 1694 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5781 = 1695 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5782 = 1696 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5783 = 1697 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5784 = 1698 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5785 = 1699 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5786 = 169a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5787 = 169b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5788 = 169c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5789 = 169d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5790 = 169e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5791 = 169f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5792 = 16a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5793 = 16a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5794 = 16a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5795 = 16a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5796 = 16a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5797 = 16a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5798 = 16a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5799 = 16a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5800 = 16a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5801 = 16a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5802 = 16aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5803 = 16ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5804 = 16ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5805 = 16ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5806 = 16ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5807 = 16af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5808 = 16b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5809 = 16b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5810 = 16b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5811 = 16b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5812 = 16b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5813 = 16b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5814 = 16b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5815 = 16b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5816 = 16b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5817 = 16b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5818 = 16ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5819 = 16bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5820 = 16bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5821 = 16bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5822 = 16be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5823 = 16bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5824 = 16c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5825 = 16c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5826 = 16c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5827 = 16c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5828 = 16c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5829 = 16c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5830 = 16c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5831 = 16c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5832 = 16c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5833 = 16c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5834 = 16ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5835 = 16cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5836 = 16cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5837 = 16cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5838 = 16ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5839 = 16cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5840 = 16d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5841 = 16d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5842 = 16d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5843 = 16d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5844 = 16d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5845 = 16d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5846 = 16d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5847 = 16d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5848 = 16d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5849 = 16d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5850 = 16da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5851 = 16db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5852 = 16dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5853 = 16dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5854 = 16de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5855 = 16df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5856 = 16e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5857 = 16e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5858 = 16e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5859 = 16e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5860 = 16e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5861 = 16e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5862 = 16e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5863 = 16e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5864 = 16e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5865 = 16e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5866 = 16ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5867 = 16eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5868 = 16ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5869 = 16ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5870 = 16ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5871 = 16ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5872 = 16f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5873 = 16f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5874 = 16f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5875 = 16f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5876 = 16f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5877 = 16f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5878 = 16f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5879 = 16f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5880 = 16f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5881 = 16f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5882 = 16fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5883 = 16fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5884 = 16fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5885 = 16fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5886 = 16fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5887 = 16ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5888 = 1700 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5889 = 1701 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5890 = 1702 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5891 = 1703 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5892 = 1704 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5893 = 1705 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5894 = 1706 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5895 = 1707 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5896 = 1708 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5897 = 1709 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5898 = 170a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5899 = 170b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5900 = 170c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5901 = 170d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5902 = 170e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5903 = 170f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5904 = 1710 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5905 = 1711 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5906 = 1712 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5907 = 1713 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5908 = 1714 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5909 = 1715 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5910 = 1716 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5911 = 1717 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5912 = 1718 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5913 = 1719 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5914 = 171a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5915 = 171b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5916 = 171c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5917 = 171d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5918 = 171e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5919 = 171f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5920 = 1720 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5921 = 1721 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5922 = 1722 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5923 = 1723 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5924 = 1724 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5925 = 1725 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5926 = 1726 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5927 = 1727 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5928 = 1728 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5929 = 1729 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5930 = 172a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5931 = 172b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5932 = 172c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5933 = 172d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5934 = 172e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5935 = 172f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5936 = 1730 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5937 = 1731 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5938 = 1732 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5939 = 1733 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5940 = 1734 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5941 = 1735 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5942 = 1736 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5943 = 1737 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5944 = 1738 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5945 = 1739 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5946 = 173a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5947 = 173b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5948 = 173c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5949 = 173d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5950 = 173e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5951 = 173f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5952 = 1740 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5953 = 1741 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5954 = 1742 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5955 = 1743 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5956 = 1744 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5957 = 1745 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5958 = 1746 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5959 = 1747 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5960 = 1748 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5961 = 1749 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5962 = 174a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5963 = 174b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5964 = 174c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5965 = 174d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5966 = 174e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5967 = 174f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5968 = 1750 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5969 = 1751 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5970 = 1752 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5971 = 1753 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5972 = 1754 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5973 = 1755 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5974 = 1756 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5975 = 1757 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5976 = 1758 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5977 = 1759 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5978 = 175a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5979 = 175b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5980 = 175c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5981 = 175d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5982 = 175e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5983 = 175f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5984 = 1760 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5985 = 1761 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5986 = 1762 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5987 = 1763 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5988 = 1764 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5989 = 1765 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5990 = 1766 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5991 = 1767 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5992 = 1768 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5993 = 1769 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5994 = 176a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5995 = 176b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5996 = 176c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5997 = 176d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5998 = 176e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 5999 = 176f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6000 = 1770 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6001 = 1771 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6002 = 1772 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6003 = 1773 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6004 = 1774 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6005 = 1775 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6006 = 1776 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6007 = 1777 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6008 = 1778 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6009 = 1779 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6010 = 177a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6011 = 177b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6012 = 177c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6013 = 177d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6014 = 177e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6015 = 177f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6016 = 1780 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6017 = 1781 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6018 = 1782 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6019 = 1783 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6020 = 1784 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6021 = 1785 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6022 = 1786 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6023 = 1787 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6024 = 1788 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6025 = 1789 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6026 = 178a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6027 = 178b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6028 = 178c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6029 = 178d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6030 = 178e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6031 = 178f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6032 = 1790 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6033 = 1791 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6034 = 1792 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6035 = 1793 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6036 = 1794 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6037 = 1795 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6038 = 1796 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6039 = 1797 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6040 = 1798 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6041 = 1799 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6042 = 179a */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6043 = 179b */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6044 = 179c */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6045 = 179d */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6046 = 179e */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6047 = 179f */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6048 = 17a0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6049 = 17a1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6050 = 17a2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6051 = 17a3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6052 = 17a4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6053 = 17a5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6054 = 17a6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6055 = 17a7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6056 = 17a8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6057 = 17a9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6058 = 17aa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6059 = 17ab */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6060 = 17ac */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6061 = 17ad */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6062 = 17ae */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6063 = 17af */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6064 = 17b0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6065 = 17b1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6066 = 17b2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6067 = 17b3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6068 = 17b4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6069 = 17b5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6070 = 17b6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6071 = 17b7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6072 = 17b8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6073 = 17b9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6074 = 17ba */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6075 = 17bb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6076 = 17bc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6077 = 17bd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6078 = 17be */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6079 = 17bf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6080 = 17c0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6081 = 17c1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6082 = 17c2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6083 = 17c3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6084 = 17c4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6085 = 17c5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6086 = 17c6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6087 = 17c7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6088 = 17c8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6089 = 17c9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6090 = 17ca */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6091 = 17cb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6092 = 17cc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6093 = 17cd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6094 = 17ce */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6095 = 17cf */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6096 = 17d0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6097 = 17d1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6098 = 17d2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6099 = 17d3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6100 = 17d4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6101 = 17d5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6102 = 17d6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6103 = 17d7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6104 = 17d8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6105 = 17d9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6106 = 17da */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6107 = 17db */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6108 = 17dc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6109 = 17dd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6110 = 17de */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6111 = 17df */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6112 = 17e0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6113 = 17e1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6114 = 17e2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6115 = 17e3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6116 = 17e4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6117 = 17e5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6118 = 17e6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6119 = 17e7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6120 = 17e8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6121 = 17e9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6122 = 17ea */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6123 = 17eb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6124 = 17ec */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6125 = 17ed */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6126 = 17ee */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6127 = 17ef */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6128 = 17f0 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6129 = 17f1 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6130 = 17f2 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6131 = 17f3 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6132 = 17f4 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6133 = 17f5 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6134 = 17f6 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6135 = 17f7 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6136 = 17f8 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6137 = 17f9 */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6138 = 17fa */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6139 = 17fb */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6140 = 17fc */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6141 = 17fd */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6142 = 17fe */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6143 = 17ff */ {3, 0, 2}, /* 0x0002 => 0x1000+(2048)*/
+ /* 6144 = 1800 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6145 = 1801 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6146 = 1802 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6147 = 1803 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6148 = 1804 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6149 = 1805 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6150 = 1806 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6151 = 1807 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6152 = 1808 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6153 = 1809 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6154 = 180a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6155 = 180b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6156 = 180c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6157 = 180d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6158 = 180e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6159 = 180f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6160 = 1810 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6161 = 1811 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6162 = 1812 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6163 = 1813 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6164 = 1814 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6165 = 1815 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6166 = 1816 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6167 = 1817 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6168 = 1818 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6169 = 1819 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6170 = 181a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6171 = 181b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6172 = 181c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6173 = 181d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6174 = 181e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6175 = 181f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6176 = 1820 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6177 = 1821 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6178 = 1822 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6179 = 1823 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6180 = 1824 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6181 = 1825 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6182 = 1826 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6183 = 1827 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6184 = 1828 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6185 = 1829 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6186 = 182a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6187 = 182b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6188 = 182c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6189 = 182d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6190 = 182e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6191 = 182f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6192 = 1830 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6193 = 1831 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6194 = 1832 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6195 = 1833 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6196 = 1834 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6197 = 1835 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6198 = 1836 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6199 = 1837 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6200 = 1838 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6201 = 1839 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6202 = 183a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6203 = 183b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6204 = 183c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6205 = 183d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6206 = 183e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6207 = 183f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6208 = 1840 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6209 = 1841 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6210 = 1842 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6211 = 1843 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6212 = 1844 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6213 = 1845 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6214 = 1846 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6215 = 1847 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6216 = 1848 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6217 = 1849 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6218 = 184a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6219 = 184b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6220 = 184c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6221 = 184d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6222 = 184e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6223 = 184f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6224 = 1850 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6225 = 1851 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6226 = 1852 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6227 = 1853 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6228 = 1854 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6229 = 1855 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6230 = 1856 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6231 = 1857 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6232 = 1858 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6233 = 1859 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6234 = 185a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6235 = 185b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6236 = 185c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6237 = 185d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6238 = 185e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6239 = 185f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6240 = 1860 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6241 = 1861 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6242 = 1862 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6243 = 1863 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6244 = 1864 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6245 = 1865 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6246 = 1866 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6247 = 1867 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6248 = 1868 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6249 = 1869 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6250 = 186a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6251 = 186b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6252 = 186c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6253 = 186d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6254 = 186e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6255 = 186f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6256 = 1870 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6257 = 1871 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6258 = 1872 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6259 = 1873 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6260 = 1874 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6261 = 1875 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6262 = 1876 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6263 = 1877 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6264 = 1878 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6265 = 1879 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6266 = 187a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6267 = 187b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6268 = 187c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6269 = 187d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6270 = 187e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6271 = 187f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6272 = 1880 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6273 = 1881 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6274 = 1882 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6275 = 1883 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6276 = 1884 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6277 = 1885 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6278 = 1886 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6279 = 1887 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6280 = 1888 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6281 = 1889 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6282 = 188a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6283 = 188b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6284 = 188c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6285 = 188d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6286 = 188e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6287 = 188f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6288 = 1890 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6289 = 1891 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6290 = 1892 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6291 = 1893 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6292 = 1894 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6293 = 1895 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6294 = 1896 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6295 = 1897 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6296 = 1898 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6297 = 1899 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6298 = 189a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6299 = 189b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6300 = 189c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6301 = 189d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6302 = 189e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6303 = 189f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6304 = 18a0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6305 = 18a1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6306 = 18a2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6307 = 18a3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6308 = 18a4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6309 = 18a5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6310 = 18a6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6311 = 18a7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6312 = 18a8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6313 = 18a9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6314 = 18aa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6315 = 18ab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6316 = 18ac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6317 = 18ad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6318 = 18ae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6319 = 18af */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6320 = 18b0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6321 = 18b1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6322 = 18b2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6323 = 18b3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6324 = 18b4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6325 = 18b5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6326 = 18b6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6327 = 18b7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6328 = 18b8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6329 = 18b9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6330 = 18ba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6331 = 18bb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6332 = 18bc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6333 = 18bd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6334 = 18be */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6335 = 18bf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6336 = 18c0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6337 = 18c1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6338 = 18c2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6339 = 18c3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6340 = 18c4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6341 = 18c5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6342 = 18c6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6343 = 18c7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6344 = 18c8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6345 = 18c9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6346 = 18ca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6347 = 18cb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6348 = 18cc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6349 = 18cd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6350 = 18ce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6351 = 18cf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6352 = 18d0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6353 = 18d1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6354 = 18d2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6355 = 18d3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6356 = 18d4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6357 = 18d5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6358 = 18d6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6359 = 18d7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6360 = 18d8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6361 = 18d9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6362 = 18da */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6363 = 18db */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6364 = 18dc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6365 = 18dd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6366 = 18de */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6367 = 18df */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6368 = 18e0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6369 = 18e1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6370 = 18e2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6371 = 18e3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6372 = 18e4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6373 = 18e5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6374 = 18e6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6375 = 18e7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6376 = 18e8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6377 = 18e9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6378 = 18ea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6379 = 18eb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6380 = 18ec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6381 = 18ed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6382 = 18ee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6383 = 18ef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6384 = 18f0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6385 = 18f1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6386 = 18f2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6387 = 18f3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6388 = 18f4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6389 = 18f5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6390 = 18f6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6391 = 18f7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6392 = 18f8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6393 = 18f9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6394 = 18fa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6395 = 18fb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6396 = 18fc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6397 = 18fd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6398 = 18fe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6399 = 18ff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6400 = 1900 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6401 = 1901 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6402 = 1902 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6403 = 1903 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6404 = 1904 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6405 = 1905 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6406 = 1906 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6407 = 1907 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6408 = 1908 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6409 = 1909 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6410 = 190a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6411 = 190b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6412 = 190c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6413 = 190d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6414 = 190e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6415 = 190f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6416 = 1910 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6417 = 1911 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6418 = 1912 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6419 = 1913 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6420 = 1914 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6421 = 1915 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6422 = 1916 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6423 = 1917 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6424 = 1918 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6425 = 1919 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6426 = 191a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6427 = 191b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6428 = 191c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6429 = 191d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6430 = 191e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6431 = 191f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6432 = 1920 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6433 = 1921 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6434 = 1922 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6435 = 1923 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6436 = 1924 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6437 = 1925 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6438 = 1926 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6439 = 1927 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6440 = 1928 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6441 = 1929 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6442 = 192a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6443 = 192b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6444 = 192c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6445 = 192d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6446 = 192e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6447 = 192f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6448 = 1930 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6449 = 1931 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6450 = 1932 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6451 = 1933 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6452 = 1934 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6453 = 1935 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6454 = 1936 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6455 = 1937 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6456 = 1938 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6457 = 1939 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6458 = 193a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6459 = 193b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6460 = 193c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6461 = 193d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6462 = 193e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6463 = 193f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6464 = 1940 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6465 = 1941 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6466 = 1942 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6467 = 1943 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6468 = 1944 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6469 = 1945 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6470 = 1946 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6471 = 1947 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6472 = 1948 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6473 = 1949 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6474 = 194a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6475 = 194b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6476 = 194c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6477 = 194d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6478 = 194e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6479 = 194f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6480 = 1950 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6481 = 1951 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6482 = 1952 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6483 = 1953 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6484 = 1954 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6485 = 1955 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6486 = 1956 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6487 = 1957 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6488 = 1958 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6489 = 1959 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6490 = 195a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6491 = 195b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6492 = 195c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6493 = 195d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6494 = 195e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6495 = 195f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6496 = 1960 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6497 = 1961 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6498 = 1962 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6499 = 1963 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6500 = 1964 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6501 = 1965 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6502 = 1966 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6503 = 1967 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6504 = 1968 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6505 = 1969 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6506 = 196a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6507 = 196b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6508 = 196c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6509 = 196d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6510 = 196e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6511 = 196f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6512 = 1970 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6513 = 1971 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6514 = 1972 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6515 = 1973 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6516 = 1974 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6517 = 1975 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6518 = 1976 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6519 = 1977 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6520 = 1978 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6521 = 1979 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6522 = 197a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6523 = 197b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6524 = 197c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6525 = 197d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6526 = 197e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6527 = 197f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6528 = 1980 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6529 = 1981 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6530 = 1982 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6531 = 1983 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6532 = 1984 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6533 = 1985 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6534 = 1986 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6535 = 1987 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6536 = 1988 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6537 = 1989 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6538 = 198a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6539 = 198b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6540 = 198c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6541 = 198d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6542 = 198e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6543 = 198f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6544 = 1990 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6545 = 1991 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6546 = 1992 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6547 = 1993 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6548 = 1994 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6549 = 1995 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6550 = 1996 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6551 = 1997 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6552 = 1998 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6553 = 1999 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6554 = 199a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6555 = 199b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6556 = 199c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6557 = 199d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6558 = 199e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6559 = 199f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6560 = 19a0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6561 = 19a1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6562 = 19a2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6563 = 19a3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6564 = 19a4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6565 = 19a5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6566 = 19a6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6567 = 19a7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6568 = 19a8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6569 = 19a9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6570 = 19aa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6571 = 19ab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6572 = 19ac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6573 = 19ad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6574 = 19ae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6575 = 19af */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6576 = 19b0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6577 = 19b1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6578 = 19b2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6579 = 19b3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6580 = 19b4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6581 = 19b5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6582 = 19b6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6583 = 19b7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6584 = 19b8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6585 = 19b9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6586 = 19ba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6587 = 19bb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6588 = 19bc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6589 = 19bd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6590 = 19be */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6591 = 19bf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6592 = 19c0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6593 = 19c1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6594 = 19c2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6595 = 19c3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6596 = 19c4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6597 = 19c5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6598 = 19c6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6599 = 19c7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6600 = 19c8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6601 = 19c9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6602 = 19ca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6603 = 19cb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6604 = 19cc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6605 = 19cd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6606 = 19ce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6607 = 19cf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6608 = 19d0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6609 = 19d1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6610 = 19d2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6611 = 19d3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6612 = 19d4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6613 = 19d5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6614 = 19d6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6615 = 19d7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6616 = 19d8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6617 = 19d9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6618 = 19da */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6619 = 19db */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6620 = 19dc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6621 = 19dd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6622 = 19de */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6623 = 19df */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6624 = 19e0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6625 = 19e1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6626 = 19e2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6627 = 19e3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6628 = 19e4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6629 = 19e5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6630 = 19e6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6631 = 19e7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6632 = 19e8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6633 = 19e9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6634 = 19ea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6635 = 19eb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6636 = 19ec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6637 = 19ed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6638 = 19ee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6639 = 19ef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6640 = 19f0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6641 = 19f1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6642 = 19f2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6643 = 19f3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6644 = 19f4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6645 = 19f5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6646 = 19f6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6647 = 19f7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6648 = 19f8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6649 = 19f9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6650 = 19fa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6651 = 19fb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6652 = 19fc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6653 = 19fd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6654 = 19fe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6655 = 19ff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6656 = 1a00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6657 = 1a01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6658 = 1a02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6659 = 1a03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6660 = 1a04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6661 = 1a05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6662 = 1a06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6663 = 1a07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6664 = 1a08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6665 = 1a09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6666 = 1a0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6667 = 1a0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6668 = 1a0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6669 = 1a0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6670 = 1a0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6671 = 1a0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6672 = 1a10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6673 = 1a11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6674 = 1a12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6675 = 1a13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6676 = 1a14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6677 = 1a15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6678 = 1a16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6679 = 1a17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6680 = 1a18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6681 = 1a19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6682 = 1a1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6683 = 1a1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6684 = 1a1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6685 = 1a1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6686 = 1a1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6687 = 1a1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6688 = 1a20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6689 = 1a21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6690 = 1a22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6691 = 1a23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6692 = 1a24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6693 = 1a25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6694 = 1a26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6695 = 1a27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6696 = 1a28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6697 = 1a29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6698 = 1a2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6699 = 1a2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6700 = 1a2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6701 = 1a2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6702 = 1a2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6703 = 1a2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6704 = 1a30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6705 = 1a31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6706 = 1a32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6707 = 1a33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6708 = 1a34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6709 = 1a35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6710 = 1a36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6711 = 1a37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6712 = 1a38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6713 = 1a39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6714 = 1a3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6715 = 1a3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6716 = 1a3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6717 = 1a3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6718 = 1a3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6719 = 1a3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6720 = 1a40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6721 = 1a41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6722 = 1a42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6723 = 1a43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6724 = 1a44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6725 = 1a45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6726 = 1a46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6727 = 1a47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6728 = 1a48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6729 = 1a49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6730 = 1a4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6731 = 1a4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6732 = 1a4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6733 = 1a4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6734 = 1a4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6735 = 1a4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6736 = 1a50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6737 = 1a51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6738 = 1a52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6739 = 1a53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6740 = 1a54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6741 = 1a55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6742 = 1a56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6743 = 1a57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6744 = 1a58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6745 = 1a59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6746 = 1a5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6747 = 1a5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6748 = 1a5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6749 = 1a5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6750 = 1a5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6751 = 1a5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6752 = 1a60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6753 = 1a61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6754 = 1a62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6755 = 1a63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6756 = 1a64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6757 = 1a65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6758 = 1a66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6759 = 1a67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6760 = 1a68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6761 = 1a69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6762 = 1a6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6763 = 1a6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6764 = 1a6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6765 = 1a6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6766 = 1a6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6767 = 1a6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6768 = 1a70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6769 = 1a71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6770 = 1a72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6771 = 1a73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6772 = 1a74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6773 = 1a75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6774 = 1a76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6775 = 1a77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6776 = 1a78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6777 = 1a79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6778 = 1a7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6779 = 1a7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6780 = 1a7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6781 = 1a7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6782 = 1a7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6783 = 1a7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6784 = 1a80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6785 = 1a81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6786 = 1a82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6787 = 1a83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6788 = 1a84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6789 = 1a85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6790 = 1a86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6791 = 1a87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6792 = 1a88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6793 = 1a89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6794 = 1a8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6795 = 1a8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6796 = 1a8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6797 = 1a8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6798 = 1a8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6799 = 1a8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6800 = 1a90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6801 = 1a91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6802 = 1a92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6803 = 1a93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6804 = 1a94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6805 = 1a95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6806 = 1a96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6807 = 1a97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6808 = 1a98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6809 = 1a99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6810 = 1a9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6811 = 1a9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6812 = 1a9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6813 = 1a9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6814 = 1a9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6815 = 1a9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6816 = 1aa0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6817 = 1aa1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6818 = 1aa2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6819 = 1aa3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6820 = 1aa4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6821 = 1aa5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6822 = 1aa6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6823 = 1aa7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6824 = 1aa8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6825 = 1aa9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6826 = 1aaa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6827 = 1aab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6828 = 1aac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6829 = 1aad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6830 = 1aae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6831 = 1aaf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6832 = 1ab0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6833 = 1ab1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6834 = 1ab2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6835 = 1ab3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6836 = 1ab4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6837 = 1ab5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6838 = 1ab6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6839 = 1ab7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6840 = 1ab8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6841 = 1ab9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6842 = 1aba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6843 = 1abb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6844 = 1abc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6845 = 1abd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6846 = 1abe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6847 = 1abf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6848 = 1ac0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6849 = 1ac1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6850 = 1ac2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6851 = 1ac3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6852 = 1ac4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6853 = 1ac5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6854 = 1ac6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6855 = 1ac7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6856 = 1ac8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6857 = 1ac9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6858 = 1aca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6859 = 1acb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6860 = 1acc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6861 = 1acd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6862 = 1ace */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6863 = 1acf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6864 = 1ad0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6865 = 1ad1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6866 = 1ad2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6867 = 1ad3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6868 = 1ad4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6869 = 1ad5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6870 = 1ad6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6871 = 1ad7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6872 = 1ad8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6873 = 1ad9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6874 = 1ada */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6875 = 1adb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6876 = 1adc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6877 = 1add */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6878 = 1ade */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6879 = 1adf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6880 = 1ae0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6881 = 1ae1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6882 = 1ae2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6883 = 1ae3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6884 = 1ae4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6885 = 1ae5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6886 = 1ae6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6887 = 1ae7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6888 = 1ae8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6889 = 1ae9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6890 = 1aea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6891 = 1aeb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6892 = 1aec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6893 = 1aed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6894 = 1aee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6895 = 1aef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6896 = 1af0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6897 = 1af1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6898 = 1af2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6899 = 1af3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6900 = 1af4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6901 = 1af5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6902 = 1af6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6903 = 1af7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6904 = 1af8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6905 = 1af9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6906 = 1afa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6907 = 1afb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6908 = 1afc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6909 = 1afd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6910 = 1afe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6911 = 1aff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6912 = 1b00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6913 = 1b01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6914 = 1b02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6915 = 1b03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6916 = 1b04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6917 = 1b05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6918 = 1b06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6919 = 1b07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6920 = 1b08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6921 = 1b09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6922 = 1b0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6923 = 1b0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6924 = 1b0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6925 = 1b0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6926 = 1b0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6927 = 1b0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6928 = 1b10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6929 = 1b11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6930 = 1b12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6931 = 1b13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6932 = 1b14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6933 = 1b15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6934 = 1b16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6935 = 1b17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6936 = 1b18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6937 = 1b19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6938 = 1b1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6939 = 1b1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6940 = 1b1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6941 = 1b1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6942 = 1b1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6943 = 1b1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6944 = 1b20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6945 = 1b21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6946 = 1b22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6947 = 1b23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6948 = 1b24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6949 = 1b25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6950 = 1b26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6951 = 1b27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6952 = 1b28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6953 = 1b29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6954 = 1b2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6955 = 1b2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6956 = 1b2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6957 = 1b2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6958 = 1b2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6959 = 1b2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6960 = 1b30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6961 = 1b31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6962 = 1b32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6963 = 1b33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6964 = 1b34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6965 = 1b35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6966 = 1b36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6967 = 1b37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6968 = 1b38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6969 = 1b39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6970 = 1b3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6971 = 1b3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6972 = 1b3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6973 = 1b3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6974 = 1b3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6975 = 1b3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6976 = 1b40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6977 = 1b41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6978 = 1b42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6979 = 1b43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6980 = 1b44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6981 = 1b45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6982 = 1b46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6983 = 1b47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6984 = 1b48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6985 = 1b49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6986 = 1b4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6987 = 1b4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6988 = 1b4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6989 = 1b4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6990 = 1b4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6991 = 1b4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6992 = 1b50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6993 = 1b51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6994 = 1b52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6995 = 1b53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6996 = 1b54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6997 = 1b55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6998 = 1b56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 6999 = 1b57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7000 = 1b58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7001 = 1b59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7002 = 1b5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7003 = 1b5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7004 = 1b5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7005 = 1b5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7006 = 1b5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7007 = 1b5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7008 = 1b60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7009 = 1b61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7010 = 1b62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7011 = 1b63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7012 = 1b64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7013 = 1b65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7014 = 1b66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7015 = 1b67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7016 = 1b68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7017 = 1b69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7018 = 1b6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7019 = 1b6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7020 = 1b6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7021 = 1b6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7022 = 1b6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7023 = 1b6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7024 = 1b70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7025 = 1b71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7026 = 1b72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7027 = 1b73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7028 = 1b74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7029 = 1b75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7030 = 1b76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7031 = 1b77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7032 = 1b78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7033 = 1b79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7034 = 1b7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7035 = 1b7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7036 = 1b7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7037 = 1b7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7038 = 1b7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7039 = 1b7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7040 = 1b80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7041 = 1b81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7042 = 1b82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7043 = 1b83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7044 = 1b84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7045 = 1b85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7046 = 1b86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7047 = 1b87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7048 = 1b88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7049 = 1b89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7050 = 1b8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7051 = 1b8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7052 = 1b8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7053 = 1b8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7054 = 1b8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7055 = 1b8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7056 = 1b90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7057 = 1b91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7058 = 1b92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7059 = 1b93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7060 = 1b94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7061 = 1b95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7062 = 1b96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7063 = 1b97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7064 = 1b98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7065 = 1b99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7066 = 1b9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7067 = 1b9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7068 = 1b9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7069 = 1b9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7070 = 1b9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7071 = 1b9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7072 = 1ba0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7073 = 1ba1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7074 = 1ba2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7075 = 1ba3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7076 = 1ba4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7077 = 1ba5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7078 = 1ba6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7079 = 1ba7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7080 = 1ba8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7081 = 1ba9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7082 = 1baa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7083 = 1bab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7084 = 1bac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7085 = 1bad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7086 = 1bae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7087 = 1baf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7088 = 1bb0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7089 = 1bb1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7090 = 1bb2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7091 = 1bb3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7092 = 1bb4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7093 = 1bb5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7094 = 1bb6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7095 = 1bb7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7096 = 1bb8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7097 = 1bb9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7098 = 1bba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7099 = 1bbb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7100 = 1bbc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7101 = 1bbd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7102 = 1bbe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7103 = 1bbf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7104 = 1bc0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7105 = 1bc1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7106 = 1bc2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7107 = 1bc3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7108 = 1bc4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7109 = 1bc5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7110 = 1bc6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7111 = 1bc7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7112 = 1bc8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7113 = 1bc9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7114 = 1bca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7115 = 1bcb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7116 = 1bcc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7117 = 1bcd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7118 = 1bce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7119 = 1bcf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7120 = 1bd0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7121 = 1bd1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7122 = 1bd2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7123 = 1bd3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7124 = 1bd4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7125 = 1bd5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7126 = 1bd6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7127 = 1bd7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7128 = 1bd8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7129 = 1bd9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7130 = 1bda */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7131 = 1bdb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7132 = 1bdc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7133 = 1bdd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7134 = 1bde */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7135 = 1bdf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7136 = 1be0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7137 = 1be1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7138 = 1be2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7139 = 1be3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7140 = 1be4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7141 = 1be5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7142 = 1be6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7143 = 1be7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7144 = 1be8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7145 = 1be9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7146 = 1bea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7147 = 1beb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7148 = 1bec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7149 = 1bed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7150 = 1bee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7151 = 1bef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7152 = 1bf0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7153 = 1bf1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7154 = 1bf2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7155 = 1bf3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7156 = 1bf4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7157 = 1bf5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7158 = 1bf6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7159 = 1bf7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7160 = 1bf8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7161 = 1bf9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7162 = 1bfa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7163 = 1bfb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7164 = 1bfc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7165 = 1bfd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7166 = 1bfe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7167 = 1bff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7168 = 1c00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7169 = 1c01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7170 = 1c02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7171 = 1c03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7172 = 1c04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7173 = 1c05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7174 = 1c06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7175 = 1c07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7176 = 1c08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7177 = 1c09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7178 = 1c0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7179 = 1c0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7180 = 1c0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7181 = 1c0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7182 = 1c0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7183 = 1c0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7184 = 1c10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7185 = 1c11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7186 = 1c12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7187 = 1c13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7188 = 1c14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7189 = 1c15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7190 = 1c16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7191 = 1c17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7192 = 1c18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7193 = 1c19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7194 = 1c1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7195 = 1c1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7196 = 1c1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7197 = 1c1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7198 = 1c1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7199 = 1c1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7200 = 1c20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7201 = 1c21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7202 = 1c22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7203 = 1c23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7204 = 1c24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7205 = 1c25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7206 = 1c26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7207 = 1c27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7208 = 1c28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7209 = 1c29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7210 = 1c2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7211 = 1c2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7212 = 1c2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7213 = 1c2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7214 = 1c2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7215 = 1c2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7216 = 1c30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7217 = 1c31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7218 = 1c32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7219 = 1c33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7220 = 1c34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7221 = 1c35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7222 = 1c36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7223 = 1c37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7224 = 1c38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7225 = 1c39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7226 = 1c3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7227 = 1c3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7228 = 1c3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7229 = 1c3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7230 = 1c3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7231 = 1c3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7232 = 1c40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7233 = 1c41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7234 = 1c42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7235 = 1c43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7236 = 1c44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7237 = 1c45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7238 = 1c46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7239 = 1c47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7240 = 1c48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7241 = 1c49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7242 = 1c4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7243 = 1c4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7244 = 1c4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7245 = 1c4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7246 = 1c4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7247 = 1c4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7248 = 1c50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7249 = 1c51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7250 = 1c52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7251 = 1c53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7252 = 1c54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7253 = 1c55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7254 = 1c56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7255 = 1c57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7256 = 1c58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7257 = 1c59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7258 = 1c5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7259 = 1c5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7260 = 1c5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7261 = 1c5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7262 = 1c5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7263 = 1c5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7264 = 1c60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7265 = 1c61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7266 = 1c62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7267 = 1c63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7268 = 1c64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7269 = 1c65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7270 = 1c66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7271 = 1c67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7272 = 1c68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7273 = 1c69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7274 = 1c6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7275 = 1c6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7276 = 1c6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7277 = 1c6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7278 = 1c6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7279 = 1c6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7280 = 1c70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7281 = 1c71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7282 = 1c72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7283 = 1c73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7284 = 1c74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7285 = 1c75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7286 = 1c76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7287 = 1c77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7288 = 1c78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7289 = 1c79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7290 = 1c7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7291 = 1c7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7292 = 1c7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7293 = 1c7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7294 = 1c7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7295 = 1c7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7296 = 1c80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7297 = 1c81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7298 = 1c82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7299 = 1c83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7300 = 1c84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7301 = 1c85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7302 = 1c86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7303 = 1c87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7304 = 1c88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7305 = 1c89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7306 = 1c8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7307 = 1c8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7308 = 1c8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7309 = 1c8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7310 = 1c8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7311 = 1c8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7312 = 1c90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7313 = 1c91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7314 = 1c92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7315 = 1c93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7316 = 1c94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7317 = 1c95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7318 = 1c96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7319 = 1c97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7320 = 1c98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7321 = 1c99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7322 = 1c9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7323 = 1c9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7324 = 1c9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7325 = 1c9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7326 = 1c9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7327 = 1c9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7328 = 1ca0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7329 = 1ca1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7330 = 1ca2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7331 = 1ca3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7332 = 1ca4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7333 = 1ca5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7334 = 1ca6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7335 = 1ca7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7336 = 1ca8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7337 = 1ca9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7338 = 1caa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7339 = 1cab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7340 = 1cac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7341 = 1cad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7342 = 1cae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7343 = 1caf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7344 = 1cb0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7345 = 1cb1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7346 = 1cb2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7347 = 1cb3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7348 = 1cb4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7349 = 1cb5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7350 = 1cb6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7351 = 1cb7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7352 = 1cb8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7353 = 1cb9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7354 = 1cba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7355 = 1cbb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7356 = 1cbc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7357 = 1cbd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7358 = 1cbe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7359 = 1cbf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7360 = 1cc0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7361 = 1cc1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7362 = 1cc2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7363 = 1cc3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7364 = 1cc4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7365 = 1cc5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7366 = 1cc6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7367 = 1cc7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7368 = 1cc8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7369 = 1cc9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7370 = 1cca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7371 = 1ccb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7372 = 1ccc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7373 = 1ccd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7374 = 1cce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7375 = 1ccf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7376 = 1cd0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7377 = 1cd1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7378 = 1cd2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7379 = 1cd3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7380 = 1cd4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7381 = 1cd5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7382 = 1cd6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7383 = 1cd7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7384 = 1cd8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7385 = 1cd9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7386 = 1cda */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7387 = 1cdb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7388 = 1cdc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7389 = 1cdd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7390 = 1cde */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7391 = 1cdf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7392 = 1ce0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7393 = 1ce1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7394 = 1ce2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7395 = 1ce3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7396 = 1ce4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7397 = 1ce5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7398 = 1ce6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7399 = 1ce7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7400 = 1ce8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7401 = 1ce9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7402 = 1cea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7403 = 1ceb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7404 = 1cec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7405 = 1ced */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7406 = 1cee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7407 = 1cef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7408 = 1cf0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7409 = 1cf1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7410 = 1cf2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7411 = 1cf3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7412 = 1cf4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7413 = 1cf5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7414 = 1cf6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7415 = 1cf7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7416 = 1cf8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7417 = 1cf9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7418 = 1cfa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7419 = 1cfb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7420 = 1cfc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7421 = 1cfd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7422 = 1cfe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7423 = 1cff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7424 = 1d00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7425 = 1d01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7426 = 1d02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7427 = 1d03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7428 = 1d04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7429 = 1d05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7430 = 1d06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7431 = 1d07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7432 = 1d08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7433 = 1d09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7434 = 1d0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7435 = 1d0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7436 = 1d0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7437 = 1d0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7438 = 1d0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7439 = 1d0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7440 = 1d10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7441 = 1d11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7442 = 1d12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7443 = 1d13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7444 = 1d14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7445 = 1d15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7446 = 1d16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7447 = 1d17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7448 = 1d18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7449 = 1d19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7450 = 1d1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7451 = 1d1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7452 = 1d1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7453 = 1d1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7454 = 1d1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7455 = 1d1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7456 = 1d20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7457 = 1d21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7458 = 1d22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7459 = 1d23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7460 = 1d24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7461 = 1d25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7462 = 1d26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7463 = 1d27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7464 = 1d28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7465 = 1d29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7466 = 1d2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7467 = 1d2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7468 = 1d2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7469 = 1d2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7470 = 1d2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7471 = 1d2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7472 = 1d30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7473 = 1d31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7474 = 1d32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7475 = 1d33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7476 = 1d34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7477 = 1d35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7478 = 1d36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7479 = 1d37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7480 = 1d38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7481 = 1d39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7482 = 1d3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7483 = 1d3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7484 = 1d3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7485 = 1d3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7486 = 1d3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7487 = 1d3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7488 = 1d40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7489 = 1d41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7490 = 1d42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7491 = 1d43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7492 = 1d44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7493 = 1d45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7494 = 1d46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7495 = 1d47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7496 = 1d48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7497 = 1d49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7498 = 1d4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7499 = 1d4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7500 = 1d4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7501 = 1d4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7502 = 1d4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7503 = 1d4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7504 = 1d50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7505 = 1d51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7506 = 1d52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7507 = 1d53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7508 = 1d54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7509 = 1d55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7510 = 1d56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7511 = 1d57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7512 = 1d58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7513 = 1d59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7514 = 1d5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7515 = 1d5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7516 = 1d5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7517 = 1d5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7518 = 1d5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7519 = 1d5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7520 = 1d60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7521 = 1d61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7522 = 1d62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7523 = 1d63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7524 = 1d64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7525 = 1d65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7526 = 1d66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7527 = 1d67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7528 = 1d68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7529 = 1d69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7530 = 1d6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7531 = 1d6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7532 = 1d6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7533 = 1d6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7534 = 1d6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7535 = 1d6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7536 = 1d70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7537 = 1d71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7538 = 1d72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7539 = 1d73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7540 = 1d74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7541 = 1d75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7542 = 1d76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7543 = 1d77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7544 = 1d78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7545 = 1d79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7546 = 1d7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7547 = 1d7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7548 = 1d7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7549 = 1d7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7550 = 1d7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7551 = 1d7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7552 = 1d80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7553 = 1d81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7554 = 1d82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7555 = 1d83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7556 = 1d84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7557 = 1d85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7558 = 1d86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7559 = 1d87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7560 = 1d88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7561 = 1d89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7562 = 1d8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7563 = 1d8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7564 = 1d8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7565 = 1d8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7566 = 1d8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7567 = 1d8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7568 = 1d90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7569 = 1d91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7570 = 1d92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7571 = 1d93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7572 = 1d94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7573 = 1d95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7574 = 1d96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7575 = 1d97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7576 = 1d98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7577 = 1d99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7578 = 1d9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7579 = 1d9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7580 = 1d9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7581 = 1d9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7582 = 1d9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7583 = 1d9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7584 = 1da0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7585 = 1da1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7586 = 1da2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7587 = 1da3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7588 = 1da4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7589 = 1da5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7590 = 1da6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7591 = 1da7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7592 = 1da8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7593 = 1da9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7594 = 1daa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7595 = 1dab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7596 = 1dac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7597 = 1dad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7598 = 1dae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7599 = 1daf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7600 = 1db0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7601 = 1db1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7602 = 1db2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7603 = 1db3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7604 = 1db4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7605 = 1db5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7606 = 1db6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7607 = 1db7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7608 = 1db8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7609 = 1db9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7610 = 1dba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7611 = 1dbb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7612 = 1dbc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7613 = 1dbd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7614 = 1dbe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7615 = 1dbf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7616 = 1dc0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7617 = 1dc1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7618 = 1dc2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7619 = 1dc3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7620 = 1dc4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7621 = 1dc5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7622 = 1dc6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7623 = 1dc7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7624 = 1dc8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7625 = 1dc9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7626 = 1dca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7627 = 1dcb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7628 = 1dcc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7629 = 1dcd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7630 = 1dce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7631 = 1dcf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7632 = 1dd0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7633 = 1dd1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7634 = 1dd2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7635 = 1dd3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7636 = 1dd4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7637 = 1dd5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7638 = 1dd6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7639 = 1dd7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7640 = 1dd8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7641 = 1dd9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7642 = 1dda */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7643 = 1ddb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7644 = 1ddc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7645 = 1ddd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7646 = 1dde */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7647 = 1ddf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7648 = 1de0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7649 = 1de1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7650 = 1de2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7651 = 1de3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7652 = 1de4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7653 = 1de5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7654 = 1de6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7655 = 1de7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7656 = 1de8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7657 = 1de9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7658 = 1dea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7659 = 1deb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7660 = 1dec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7661 = 1ded */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7662 = 1dee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7663 = 1def */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7664 = 1df0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7665 = 1df1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7666 = 1df2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7667 = 1df3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7668 = 1df4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7669 = 1df5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7670 = 1df6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7671 = 1df7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7672 = 1df8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7673 = 1df9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7674 = 1dfa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7675 = 1dfb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7676 = 1dfc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7677 = 1dfd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7678 = 1dfe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7679 = 1dff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7680 = 1e00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7681 = 1e01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7682 = 1e02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7683 = 1e03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7684 = 1e04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7685 = 1e05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7686 = 1e06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7687 = 1e07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7688 = 1e08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7689 = 1e09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7690 = 1e0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7691 = 1e0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7692 = 1e0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7693 = 1e0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7694 = 1e0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7695 = 1e0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7696 = 1e10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7697 = 1e11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7698 = 1e12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7699 = 1e13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7700 = 1e14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7701 = 1e15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7702 = 1e16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7703 = 1e17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7704 = 1e18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7705 = 1e19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7706 = 1e1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7707 = 1e1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7708 = 1e1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7709 = 1e1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7710 = 1e1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7711 = 1e1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7712 = 1e20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7713 = 1e21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7714 = 1e22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7715 = 1e23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7716 = 1e24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7717 = 1e25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7718 = 1e26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7719 = 1e27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7720 = 1e28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7721 = 1e29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7722 = 1e2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7723 = 1e2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7724 = 1e2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7725 = 1e2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7726 = 1e2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7727 = 1e2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7728 = 1e30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7729 = 1e31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7730 = 1e32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7731 = 1e33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7732 = 1e34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7733 = 1e35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7734 = 1e36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7735 = 1e37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7736 = 1e38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7737 = 1e39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7738 = 1e3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7739 = 1e3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7740 = 1e3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7741 = 1e3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7742 = 1e3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7743 = 1e3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7744 = 1e40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7745 = 1e41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7746 = 1e42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7747 = 1e43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7748 = 1e44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7749 = 1e45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7750 = 1e46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7751 = 1e47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7752 = 1e48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7753 = 1e49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7754 = 1e4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7755 = 1e4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7756 = 1e4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7757 = 1e4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7758 = 1e4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7759 = 1e4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7760 = 1e50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7761 = 1e51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7762 = 1e52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7763 = 1e53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7764 = 1e54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7765 = 1e55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7766 = 1e56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7767 = 1e57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7768 = 1e58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7769 = 1e59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7770 = 1e5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7771 = 1e5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7772 = 1e5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7773 = 1e5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7774 = 1e5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7775 = 1e5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7776 = 1e60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7777 = 1e61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7778 = 1e62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7779 = 1e63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7780 = 1e64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7781 = 1e65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7782 = 1e66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7783 = 1e67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7784 = 1e68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7785 = 1e69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7786 = 1e6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7787 = 1e6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7788 = 1e6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7789 = 1e6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7790 = 1e6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7791 = 1e6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7792 = 1e70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7793 = 1e71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7794 = 1e72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7795 = 1e73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7796 = 1e74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7797 = 1e75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7798 = 1e76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7799 = 1e77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7800 = 1e78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7801 = 1e79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7802 = 1e7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7803 = 1e7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7804 = 1e7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7805 = 1e7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7806 = 1e7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7807 = 1e7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7808 = 1e80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7809 = 1e81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7810 = 1e82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7811 = 1e83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7812 = 1e84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7813 = 1e85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7814 = 1e86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7815 = 1e87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7816 = 1e88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7817 = 1e89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7818 = 1e8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7819 = 1e8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7820 = 1e8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7821 = 1e8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7822 = 1e8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7823 = 1e8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7824 = 1e90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7825 = 1e91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7826 = 1e92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7827 = 1e93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7828 = 1e94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7829 = 1e95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7830 = 1e96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7831 = 1e97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7832 = 1e98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7833 = 1e99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7834 = 1e9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7835 = 1e9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7836 = 1e9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7837 = 1e9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7838 = 1e9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7839 = 1e9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7840 = 1ea0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7841 = 1ea1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7842 = 1ea2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7843 = 1ea3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7844 = 1ea4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7845 = 1ea5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7846 = 1ea6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7847 = 1ea7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7848 = 1ea8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7849 = 1ea9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7850 = 1eaa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7851 = 1eab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7852 = 1eac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7853 = 1ead */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7854 = 1eae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7855 = 1eaf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7856 = 1eb0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7857 = 1eb1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7858 = 1eb2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7859 = 1eb3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7860 = 1eb4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7861 = 1eb5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7862 = 1eb6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7863 = 1eb7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7864 = 1eb8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7865 = 1eb9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7866 = 1eba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7867 = 1ebb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7868 = 1ebc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7869 = 1ebd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7870 = 1ebe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7871 = 1ebf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7872 = 1ec0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7873 = 1ec1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7874 = 1ec2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7875 = 1ec3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7876 = 1ec4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7877 = 1ec5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7878 = 1ec6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7879 = 1ec7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7880 = 1ec8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7881 = 1ec9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7882 = 1eca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7883 = 1ecb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7884 = 1ecc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7885 = 1ecd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7886 = 1ece */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7887 = 1ecf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7888 = 1ed0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7889 = 1ed1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7890 = 1ed2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7891 = 1ed3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7892 = 1ed4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7893 = 1ed5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7894 = 1ed6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7895 = 1ed7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7896 = 1ed8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7897 = 1ed9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7898 = 1eda */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7899 = 1edb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7900 = 1edc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7901 = 1edd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7902 = 1ede */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7903 = 1edf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7904 = 1ee0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7905 = 1ee1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7906 = 1ee2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7907 = 1ee3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7908 = 1ee4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7909 = 1ee5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7910 = 1ee6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7911 = 1ee7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7912 = 1ee8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7913 = 1ee9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7914 = 1eea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7915 = 1eeb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7916 = 1eec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7917 = 1eed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7918 = 1eee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7919 = 1eef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7920 = 1ef0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7921 = 1ef1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7922 = 1ef2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7923 = 1ef3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7924 = 1ef4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7925 = 1ef5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7926 = 1ef6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7927 = 1ef7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7928 = 1ef8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7929 = 1ef9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7930 = 1efa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7931 = 1efb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7932 = 1efc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7933 = 1efd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7934 = 1efe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7935 = 1eff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7936 = 1f00 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7937 = 1f01 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7938 = 1f02 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7939 = 1f03 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7940 = 1f04 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7941 = 1f05 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7942 = 1f06 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7943 = 1f07 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7944 = 1f08 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7945 = 1f09 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7946 = 1f0a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7947 = 1f0b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7948 = 1f0c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7949 = 1f0d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7950 = 1f0e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7951 = 1f0f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7952 = 1f10 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7953 = 1f11 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7954 = 1f12 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7955 = 1f13 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7956 = 1f14 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7957 = 1f15 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7958 = 1f16 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7959 = 1f17 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7960 = 1f18 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7961 = 1f19 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7962 = 1f1a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7963 = 1f1b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7964 = 1f1c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7965 = 1f1d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7966 = 1f1e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7967 = 1f1f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7968 = 1f20 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7969 = 1f21 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7970 = 1f22 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7971 = 1f23 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7972 = 1f24 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7973 = 1f25 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7974 = 1f26 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7975 = 1f27 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7976 = 1f28 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7977 = 1f29 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7978 = 1f2a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7979 = 1f2b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7980 = 1f2c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7981 = 1f2d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7982 = 1f2e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7983 = 1f2f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7984 = 1f30 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7985 = 1f31 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7986 = 1f32 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7987 = 1f33 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7988 = 1f34 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7989 = 1f35 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7990 = 1f36 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7991 = 1f37 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7992 = 1f38 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7993 = 1f39 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7994 = 1f3a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7995 = 1f3b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7996 = 1f3c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7997 = 1f3d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7998 = 1f3e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 7999 = 1f3f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8000 = 1f40 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8001 = 1f41 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8002 = 1f42 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8003 = 1f43 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8004 = 1f44 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8005 = 1f45 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8006 = 1f46 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8007 = 1f47 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8008 = 1f48 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8009 = 1f49 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8010 = 1f4a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8011 = 1f4b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8012 = 1f4c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8013 = 1f4d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8014 = 1f4e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8015 = 1f4f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8016 = 1f50 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8017 = 1f51 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8018 = 1f52 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8019 = 1f53 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8020 = 1f54 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8021 = 1f55 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8022 = 1f56 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8023 = 1f57 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8024 = 1f58 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8025 = 1f59 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8026 = 1f5a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8027 = 1f5b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8028 = 1f5c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8029 = 1f5d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8030 = 1f5e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8031 = 1f5f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8032 = 1f60 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8033 = 1f61 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8034 = 1f62 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8035 = 1f63 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8036 = 1f64 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8037 = 1f65 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8038 = 1f66 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8039 = 1f67 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8040 = 1f68 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8041 = 1f69 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8042 = 1f6a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8043 = 1f6b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8044 = 1f6c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8045 = 1f6d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8046 = 1f6e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8047 = 1f6f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8048 = 1f70 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8049 = 1f71 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8050 = 1f72 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8051 = 1f73 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8052 = 1f74 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8053 = 1f75 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8054 = 1f76 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8055 = 1f77 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8056 = 1f78 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8057 = 1f79 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8058 = 1f7a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8059 = 1f7b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8060 = 1f7c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8061 = 1f7d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8062 = 1f7e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8063 = 1f7f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8064 = 1f80 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8065 = 1f81 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8066 = 1f82 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8067 = 1f83 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8068 = 1f84 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8069 = 1f85 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8070 = 1f86 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8071 = 1f87 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8072 = 1f88 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8073 = 1f89 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8074 = 1f8a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8075 = 1f8b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8076 = 1f8c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8077 = 1f8d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8078 = 1f8e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8079 = 1f8f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8080 = 1f90 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8081 = 1f91 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8082 = 1f92 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8083 = 1f93 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8084 = 1f94 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8085 = 1f95 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8086 = 1f96 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8087 = 1f97 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8088 = 1f98 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8089 = 1f99 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8090 = 1f9a */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8091 = 1f9b */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8092 = 1f9c */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8093 = 1f9d */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8094 = 1f9e */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8095 = 1f9f */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8096 = 1fa0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8097 = 1fa1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8098 = 1fa2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8099 = 1fa3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8100 = 1fa4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8101 = 1fa5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8102 = 1fa6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8103 = 1fa7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8104 = 1fa8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8105 = 1fa9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8106 = 1faa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8107 = 1fab */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8108 = 1fac */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8109 = 1fad */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8110 = 1fae */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8111 = 1faf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8112 = 1fb0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8113 = 1fb1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8114 = 1fb2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8115 = 1fb3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8116 = 1fb4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8117 = 1fb5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8118 = 1fb6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8119 = 1fb7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8120 = 1fb8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8121 = 1fb9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8122 = 1fba */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8123 = 1fbb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8124 = 1fbc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8125 = 1fbd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8126 = 1fbe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8127 = 1fbf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8128 = 1fc0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8129 = 1fc1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8130 = 1fc2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8131 = 1fc3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8132 = 1fc4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8133 = 1fc5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8134 = 1fc6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8135 = 1fc7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8136 = 1fc8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8137 = 1fc9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8138 = 1fca */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8139 = 1fcb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8140 = 1fcc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8141 = 1fcd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8142 = 1fce */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8143 = 1fcf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8144 = 1fd0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8145 = 1fd1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8146 = 1fd2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8147 = 1fd3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8148 = 1fd4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8149 = 1fd5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8150 = 1fd6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8151 = 1fd7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8152 = 1fd8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8153 = 1fd9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8154 = 1fda */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8155 = 1fdb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8156 = 1fdc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8157 = 1fdd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8158 = 1fde */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8159 = 1fdf */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8160 = 1fe0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8161 = 1fe1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8162 = 1fe2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8163 = 1fe3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8164 = 1fe4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8165 = 1fe5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8166 = 1fe6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8167 = 1fe7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8168 = 1fe8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8169 = 1fe9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8170 = 1fea */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8171 = 1feb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8172 = 1fec */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8173 = 1fed */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8174 = 1fee */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8175 = 1fef */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8176 = 1ff0 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8177 = 1ff1 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8178 = 1ff2 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8179 = 1ff3 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8180 = 1ff4 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8181 = 1ff5 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8182 = 1ff6 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8183 = 1ff7 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8184 = 1ff8 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8185 = 1ff9 */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8186 = 1ffa */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8187 = 1ffb */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8188 = 1ffc */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8189 = 1ffd */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8190 = 1ffe */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+ /* 8191 = 1fff */ {2, 0, 2}, /* 0x0003 => 0x1800+(2048)*/
+};
diff --git a/xc/programs/Xserver/XIE/mixie/fax/fencode.h b/xc/programs/Xserver/XIE/mixie/fax/fencode.h
new file mode 100644
index 000000000..6dbdf3c67
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/fencode.h
@@ -0,0 +1,367 @@
+/* $TOG: fencode.h /main/5 1998/02/09 16:16:04 kaleb $ */
+/**** module fencode.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ fencode.h -- DDXIE header module for FAX encoders
+
+ Ben Fahy, AGE Logic, Sept 1993
+
+******************************************************************************/
+
+#include "misc.h" /* for pointer */
+#include <Xmd.h> /* for CARD32 */
+
+/*** entry points */
+int encode_g4();
+int encode_g32d();
+int encode_g31d();
+int encode_tiffpb();
+int encode_tiff2();
+
+#define FAX_ENCODE_DONE_NOT 0
+#define FAX_ENCODE_DONE_OK 1
+#define ENCODE_ERROR_BadMagic 2
+#define ENCODE_ERROR_BadGoal 3
+#define ENCODE_ERROR_BadStager 4
+#define ENCODE_ERROR_BadRunLength 5
+#define ENCODE_ERROR_BadState 6
+#define ENCODE_ERROR_StripStateNotNew 7
+#define ENCODE_ERROR_NoB1Found 8
+#define ENCODE_ERROR_EncodeRunsFailure 9
+
+#define ENCODE_FAX_GOAL_StartNewLine 1
+#define ENCODE_FAX_GOAL_OutputNextRunLength 2
+#define ENCODE_FAX_GOAL_DeduceCode 3
+#define ENCODE_FAX_GOAL_FlushStager 4
+#define ENCODE_FAX_GOAL_FinishLine 5
+#define ENCODE_FAX_GOAL_FlushEOL 6
+#define ENCODE_FAX_GOAL_EOLWritten 7
+#define ENCODE_FAX_GOAL_FindPositions 8
+#define ENCODE_FAX_GOAL_PassMode 9
+#define ENCODE_FAX_GOAL_VerticalMode 10
+#define ENCODE_FAX_GOAL_HorizontalMode 11
+#define ENCODE_FAX_GOAL_Flush2DStager 12
+#define ENCODE_FAX_GOAL_DoneWithA0A1 13
+#define ENCODE_FAX_GOAL_DoneWithA1A2 14
+#define ENCODE_FAX_GOAL_FlushHCode 15
+#define ENCODE_FAX_GOAL_FlushedHCode 16
+#define ENCODE_FAX_GOAL_G4SneaksIn 17
+
+#define ENCODE_PB_GOAL_StartNewLine 1
+#define ENCODE_PB_GOAL_OutputNextRunLength 2
+#define ENCODE_PB_GOAL_FlushRunLength 3
+#define ENCODE_PB_GOAL_FlushLiterals 4
+#define ENCODE_PB_GOAL_WriteLiterals 5
+#define ENCODE_PB_GOAL_WriteCodeForRunLength 6
+#define ENCODE_PB_GOAL_WriteValueForRunLength 7
+#define ENCODE_PB_GOAL_WriteNlits 8
+#define ENCODE_PB_GOAL_WriteThisLiteral 9
+#define ENCODE_PB_GOAL_WriteTheLiteral 10
+
+typedef struct _fax_encode_state {
+ int final; /* if final = 1, all input data is available */
+ int encoder_done;/* if done = 1, all data sent has been encoded */
+
+ char **i_lines; /* pointers to beginning of input lines */
+ int i_line; /* absolute input line position */
+ int nl_tocode; /* how many lines we want encoded */
+
+ unsigned char *strip; /* latest available *output* strip */
+ int strip_size; /* size of that strips */
+ int strip_state; /* whether strip is new, being used, or done */
+ int use_magic; /* 1 means we are using magic strip */
+ int magic_needs; /* 1 means magic strip only have filled */
+ unsigned char magicStrip[8];
+ /* "pretend" strip for handling strip edges */
+ BitStream bits; /* definition of bitstream, current strip */
+
+ pointer private;/* private data, depends on encoding scheme */
+
+ int goal; /* our current goal */
+ int a0_pos; /* starting changing position on coding line */
+ int a1_pos; /* next changing position to right of a0_pos */
+ int a0a1; /* distance from a0 to a1 */
+ int b1_pos; /* first change above and right of a0, ~color */
+ int b2_pos; /* next change above and right of a0, ao_color */
+ int a0_color; /* color of a0, either WHITE or BLACK */
+ int n_old_trans; /* number of transitions, line above us */
+ int *old_trans; /* list of transitions on line above us */
+ int n_new_trans; /* number of transitions, current line (so far)*/
+ int *new_trans; /* list of transitions on current line */
+ int last_b1_idx; /* index of last saved transition we looked at */
+ int length_acc; /* accumulates run-lengths for a0a1 or a1a2 */
+ int width; /* width of image. So we know end of line */
+ int g32d_horiz; /* only relevant for g32d encoding */
+ int rl; /* needed if I get EOL in get_a0a1 or get_a1a2 */
+ CARD32 stager; /* place for bits to be merged into bytes */
+ int radiometric; /* if 1, then white is bright (1) */
+} FaxEncodeState;
+
+typedef struct _tiff2_epvt {
+ int *counts; /* runlengths for W/B runs */
+ int nvals; /* number of entries in tables */
+ int index; /* current position in tables */
+ int rlcode; /* code we need to write out */
+ int terminating; /* whether this is end or not */
+ int codelength; /* how many bits a code takes */
+ int align_eol; /* pad last byte in a line w/0 */
+
+} Tiff2EncodePvt,G31DEncodePvt;
+
+typedef struct _packbits_epvt {
+ int *values; /* array of byte values */
+ int *counts; /* runlengths for byte values */
+ int nvals; /* number of entries in tables */
+ int nlits; /* number of literals to write */
+ int index; /* current position in tables */
+ int start; /* start position in tables */
+ int lits_to_write; /* how many to write at one time*/
+ int rlcode; /* code we need to write out */
+ int bytes_out; /* sum of literals flushed */
+
+} PackBitsEncodePvt;
+
+typedef struct _g32d_epvt {
+ int *counts; /* runlengths for W/B runs */
+ int nvals; /* number of entries in tables */
+ int index; /* current position in tables */
+ int save_index; /* save for recovery of index */
+ int *above; /* runlengths for lines above */
+ int avals; /* number of values, above */
+ int aindex; /* current position in above */
+ int save_aindex; /* save for recover of aindex */
+ int rlcode; /* code we need to write out */
+ int terminating; /* whether this is end or not */
+ int codelength; /* how many bits a code takes */
+ int k; /* do 1-D every K lines */
+ int kcnt; /* count of what k we are on */
+ int next_goal; /* what to do after rl encode */
+ int a1a2; /* second distance in Hmode */
+ int a2_pos; /* next position to right of a1 */
+ int save_b1pos; /* makes it easier to back up */
+ int save_b1color; /* makes it easier to back up */
+ int b1_color; /* not a part of state */
+ int align_eol; /* pad last byte in a line w/0 */
+ int uncompressed; /* not that we should use it... */
+ int really_g4; /* if (1), skip EOL junk */
+
+} G32DEncodePvt,G42DEncodePvt;
+
+#if defined(_G32D)
+
+#define save_state_and_return(state) \
+ { \
+ state->private = (pointer) epvt; \
+ epvt->counts = counts; \
+ epvt->above = above; \
+ epvt->nvals = nvals; \
+ epvt->avals = avals; \
+ epvt->index = index; \
+ epvt->aindex = aindex; \
+ epvt->rlcode = rlcode; \
+ epvt->terminating = terminating; \
+ epvt->codelength = codelength; \
+ epvt->save_index = save_index; \
+ epvt->save_aindex = save_aindex; \
+ epvt->k = k; \
+ epvt->kcnt = kcnt; \
+ epvt->a1a2 = a1a2; \
+ epvt->save_b1pos = save_b1pos; \
+ epvt->save_b1color = save_b1color; \
+ epvt->next_goal = next_goal; \
+ epvt->b1_color = b1_color; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->bits.bitpos = bitpos; \
+ state->rl = rl; \
+ state->goal = goal; \
+ state->stager = stager; \
+ state->a0_color = a0_color; \
+ state->a0a1 = a0a1; \
+ state->a0_pos = a0_pos; \
+ state->a1_pos = a1_pos; \
+ epvt->a2_pos = a2_pos; \
+ state->b1_pos = b1_pos; \
+ state->length_acc = length_acc; \
+ return(lines_coded); \
+ }
+
+#define localize_state(state) \
+ epvt = (G32DEncodePvt *) state->private; \
+ counts = epvt->counts; \
+ nvals = epvt->nvals; \
+ index = epvt->index; \
+ above = epvt->above; \
+ avals = epvt->avals; \
+ aindex = epvt->aindex; \
+ rlcode = epvt->rlcode; \
+ terminating = epvt->terminating; \
+ codelength = epvt->codelength; \
+ save_index = epvt->save_index; \
+ save_aindex = epvt->save_aindex; \
+ k = epvt->k; \
+ kcnt = epvt->kcnt; \
+ a1a2 = epvt->a1a2; \
+ save_b1pos = epvt->save_b1pos; \
+ save_b1color = epvt->save_b1color; \
+ next_goal = epvt->next_goal; \
+ b1_color = epvt->b1_color; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ bitpos = state->bits.bitpos; \
+ goal = state->goal; \
+ stager = state->stager; \
+ width = state->width; \
+ lines_to_code = state->nl_tocode; \
+ a0_color = state->a0_color; \
+ a0a1 = state->a0a1; \
+ a0_pos = state->a0_pos; \
+ a1_pos = state->a1_pos; \
+ a2_pos = epvt->a2_pos; \
+ b1_pos = state->b1_pos; \
+ length_acc = state->length_acc; \
+ rl = state->rl;
+
+#endif /* defined(_G32D) */
+
+#if defined(_TIFF2) || defined(_G31D)
+
+#define save_state_and_return(state) \
+ { \
+ state->private = (pointer) epvt; \
+ epvt->counts = counts; \
+ epvt->nvals = nvals; \
+ epvt->index = index; \
+ epvt->rlcode = rlcode; \
+ epvt->terminating = terminating; \
+ epvt->codelength = codelength; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->bits.bitpos = bitpos; \
+ state->rl = rl; \
+ state->goal = goal; \
+ state->stager = stager; \
+ state->a0_color = a0_color; \
+ return(lines_coded); \
+ }
+
+#define localize_state(state) \
+ epvt = (Tiff2EncodePvt *) state->private; \
+ counts = epvt->counts; \
+ nvals = epvt->nvals; \
+ index = epvt->index; \
+ rlcode = epvt->rlcode; \
+ terminating = epvt->terminating; \
+ codelength = epvt->codelength; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ bitpos = state->bits.bitpos; \
+ goal = state->goal; \
+ stager = state->stager; \
+ width = state->width; \
+ lines_to_code = state->nl_tocode; \
+ a0_color = state->a0_color; \
+ rl = state->rl;
+
+#endif /* defined(_TIFF2) */
+
+#if defined(_PBits)
+
+
+#define save_state_and_return(state) \
+ { \
+ state->private = (pointer) epvt; \
+ epvt->index = index; \
+ epvt->start = start; \
+ epvt->nlits = nlits; \
+ epvt->nvals = nvals; \
+ epvt->counts = counts; \
+ epvt->values = values; \
+ epvt->lits_to_write = lits_to_write; \
+ epvt->bytes_out = bytes_out; \
+ epvt->rlcode = rlcode; \
+ state->bits.byteptr = byteptr; \
+ state->bits.endptr = endptr; \
+ state->rl = rl; \
+ state->goal = goal; \
+ return(lines_coded); \
+ }
+
+#define localize_state(state) \
+ epvt = (PackBitsEncodePvt *) state->private; \
+ index = epvt->index; \
+ start = epvt->start; \
+ nlits = epvt->nlits; \
+ nvals = epvt->nvals; \
+ counts = epvt->counts; \
+ values = epvt->values; \
+ lits_to_write = epvt->lits_to_write; \
+ bytes_out = epvt->bytes_out; \
+ rlcode = epvt->rlcode; \
+ byteptr = state->bits.byteptr; \
+ endptr = state->bits.endptr; \
+ goal = state->goal; \
+ width = state->width; \
+ lines_to_code = state->nl_tocode; \
+ rl = state->rl;
+
+#endif /* defined(_Pbits) */
diff --git a/xc/programs/Xserver/XIE/mixie/fax/fetabs.h b/xc/programs/Xserver/XIE/mixie/fax/fetabs.h
new file mode 100644
index 000000000..c9a2ca32f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/fetabs.h
@@ -0,0 +1,325 @@
+/* $TOG: fetabs.h /main/4 1998/02/09 16:16:09 kaleb $ */
+/**** module fetabs.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ fetabs.h -- header file holding fax encoding tables
+
+ Ben Fahy, AGE Logic, Sept 1993
+
+******************************************************************************/
+
+typedef struct _shifted_codes {
+ unsigned short code;
+ unsigned short nbits;
+} ShiftedCodes;
+
+#define EOL_CODE (0x001 << 4)
+#define EOL_BIT_LENGTH 12
+
+#define EOL_1D_CODE (0x0018)
+#define EOL_1D_BIT_LENGTH 13
+
+#define EOL_2D_CODE (0x0010)
+#define EOL_2D_BIT_LENGTH 13
+
+#define PASS_CODE (0x1 << 12)
+#define PASS_CODE_BIT_LENGTH 4
+
+#define HORIZONTAL_CODE (0x1 << 13)
+#define HORIZONTAL_CODE_LENGTH 3
+
+#define DEDUCE_Vcode(b1_minus_a1,rlcode,nmbits) \
+ { rlcode = VerticalCodes[3+b1_minus_a1].code; \
+ nmbits = VerticalCodes[3+b1_minus_a1].nbits; \
+ }
+
+
+#ifdef FETABS_OWNER
+ShiftedCodes VerticalCodes[] = {
+ (0x03 << 9), 7, /* a1 3 rite of b1 */
+ (0x03 <<10), 6, /* a1 2 rite of b1 */
+ (0x03 <<13), 3, /* a1 1 rite of b1 */
+ (0x01 <<15), 1, /* a1 0 left of b1 */
+ (0x02 <<13), 3, /* a1 1 left of b1 */
+ (0x02 <<10), 6, /* a1 2 left of b1 */
+ (0x02 << 9), 7, /* a1 3 left of b1 */
+};
+
+ShiftedCodes ShiftedWhites[] = {
+ (0x35 << 8), 8, /* run length of zero */
+ (0x07 <<10), 6, /* run length of 1 */
+ (0x07 <<12), 4, /* run length of 2 */
+ (0x08 <<12), 4, /* run length of 3 */
+ (0x0b <<12), 4, /* run length of 4 */
+ (0x0c <<12), 4, /* run length of 5 */
+ (0x0e <<12), 4, /* run length of 6 */
+ (0x0f <<12), 4, /* run length of 7 */
+ (0x13 <<11), 5, /* run length of 8 */
+ (0x14 <<11), 5, /* run length of 9 */
+ (0x07 <<11), 5, /* run length of 10 */
+ (0x08 <<11), 5, /* run length of 11 */
+ (0x08 <<10), 6, /* run length of 12 */
+ (0x03 <<10), 6, /* run length of 13 */
+ (0x34 <<10), 6, /* run length of 14 */
+ (0x35 <<10), 6, /* run length of 15 */
+ (0x2a <<10), 6, /* run length of 16 */
+ (0x2b <<10), 6, /* run length of 17 */
+ (0x27 << 9), 7, /* run length of 18 */
+ (0x0c << 9), 7, /* run length of 19 */
+ (0x08 << 9), 7, /* run length of 20 */
+ (0x17 << 9), 7, /* run length of 21 */
+ (0x03 << 9), 7, /* run length of 22 */
+ (0x04 << 9), 7, /* run length of 23 */
+ (0x28 << 9), 7, /* run length of 24 */
+ (0x2b << 9), 7, /* run length of 25 */
+ (0x13 << 9), 7, /* run length of 26 */
+ (0x24 << 9), 7, /* run length of 27 */
+ (0x18 << 9), 7, /* run length of 28 */
+ (0x02 << 8), 8, /* run length of 29 */
+ (0x03 << 8), 8, /* run length of 30 */
+ (0x1a << 8), 8, /* run length of 31 */
+ (0x1b << 8), 8, /* run length of 32 */
+ (0x12 << 8), 8, /* run length of 33 */
+ (0x13 << 8), 8, /* run length of 34 */
+ (0x14 << 8), 8, /* run length of 35 */
+ (0x15 << 8), 8, /* run length of 36 */
+ (0x16 << 8), 8, /* run length of 37 */
+ (0x17 << 8), 8, /* run length of 38 */
+ (0x28 << 8), 8, /* run length of 39 */
+ (0x29 << 8), 8, /* run length of 40 */
+ (0x2a << 8), 8, /* run length of 41 */
+ (0x2b << 8), 8, /* run length of 42 */
+ (0x2c << 8), 8, /* run length of 43 */
+ (0x2d << 8), 8, /* run length of 44 */
+ (0x04 << 8), 8, /* run length of 45 */
+ (0x05 << 8), 8, /* run length of 46 */
+ (0x0a << 8), 8, /* run length of 47 */
+ (0x0b << 8), 8, /* run length of 48 */
+ (0x52 << 8), 8, /* run length of 49 */
+ (0x53 << 8), 8, /* run length of 50 */
+ (0x54 << 8), 8, /* run length of 51 */
+ (0x55 << 8), 8, /* run length of 52 */
+ (0x24 << 8), 8, /* run length of 53 */
+ (0x25 << 8), 8, /* run length of 54 */
+ (0x58 << 8), 8, /* run length of 55 */
+ (0x59 << 8), 8, /* run length of 56 */
+ (0x5a << 8), 8, /* run length of 57 */
+ (0x5b << 8), 8, /* run length of 58 */
+ (0x4a << 8), 8, /* run length of 59 */
+ (0x4b << 8), 8, /* run length of 60 */
+ (0x32 << 8), 8, /* run length of 61 */
+ (0x33 << 8), 8, /* run length of 62 */
+ (0x34 << 8), 8, /* run length of 63 */
+ (0x1b << 11),5, /* run length of 64 */
+ (0x12 << 11),5, /* run length of 2*64 = 128 */
+ (0x17 << 10),6, /* run length of 3*64 = 192 */
+ (0x37 << 9), 7, /* run length of 4*64 = 256 */
+ (0x36 << 8), 8, /* run length of 5*64 = 320 */
+ (0x37 << 8), 8, /* run length of 6*64 = 384 */
+ (0x64 << 8), 8, /* run length of 7*64 = 448 */
+ (0x65 << 8), 8, /* run length of 8*64 = 512 */
+ (0x68 << 8), 8, /* run length of 9*64 = 576 */
+ (0x67 << 8), 8, /* run length of 10*64 = 640 */
+ (0x0cc<< 7), 9, /* run length of 11*64 = 704 */
+ (0x0cd<< 7), 9, /* run length of 12*64 = 768 */
+ (0x0d2<< 7), 9, /* run length of 13*64 = 832 */
+ (0x0d3<< 7), 9, /* run length of 14*64 = 896 */
+ (0x0d4<< 7), 9, /* run length of 15*64 = 960 */
+ (0x0d5<< 7), 9, /* run length of 16*64 = 1024 */
+ (0x0d6<< 7), 9, /* run length of 17*64 = 1088 */
+ (0x0d7<< 7), 9, /* run length of 18*64 = 1152 */
+ (0x0d8<< 7), 9, /* run length of 19*64 = 1216 */
+ (0x0d9<< 7), 9, /* run length of 20*64 = 1280 */
+ (0x0da<< 7), 9, /* run length of 21*64 = 1344 */
+ (0x0db<< 7), 9, /* run length of 22*64 = 1408 */
+ (0x098<< 7), 9, /* run length of 23*64 = 1472 */
+ (0x099<< 7), 9, /* run length of 24*64 = 1536 */
+ (0x09a<< 7), 9, /* run length of 25*64 = 1600 */
+ (0x18 <<10), 6, /* run length of 26*64 = 1664 */
+ (0x09b<< 7), 9, /* run length of 27*64 = 1728 */
+ (0x08 << 5), 11, /* run length of 28*64 = 1792 */
+ (0x0c << 5), 11, /* run length of 29*64 = 1856 */
+ (0x0d << 5), 11, /* run length of 30*64 = 1920 */
+ (0x12 << 4), 12, /* run length of 31*64 = 1984 */
+ (0x13 << 4), 12, /* run length of 32*64 = 2048 */
+ (0x14 << 4), 12, /* run length of 33*64 = 2112 */
+ (0x15 << 4), 12, /* run length of 34*64 = 2176 */
+ (0x16 << 4), 12, /* run length of 35*64 = 2240 */
+ (0x17 << 4), 12, /* run length of 36*64 = 2304 */
+ (0x1c << 4), 12, /* run length of 37*64 = 2368 */
+ (0x1d << 4), 12, /* run length of 38*64 = 2432 */
+ (0x1e << 4), 12, /* run length of 39*64 = 2496 */
+ (0x1f << 4), 12, /* run length of 40*64 = 2560 */
+};
+
+ShiftedCodes ShiftedBlacks[] = {
+ (0x37 << 6),10, /* run length of zero */
+ (0x2 <<13), 3, /* run length of 1 */
+ (0x3 <<14), 2, /* run length of 2 */
+ (0x2 <<14), 2, /* run length of 3 */
+ (0x03 <<13), 3, /* run length of 4 */
+ (0x03 <<12), 4, /* run length of 5 */
+ (0x02 <<12), 4, /* run length of 6 */
+ (0x03 <<11), 5, /* run length of 7 */
+ (0x05 <<10), 6, /* run length of 8 */
+ (0x04 <<10), 6, /* run length of 9 */
+ (0x04 << 9), 7, /* run length of 10 */
+ (0x05 << 9), 7, /* run length of 11 */
+ (0x07 << 9), 7, /* run length of 12 */
+ (0x04 << 8), 8, /* run length of 13 */
+ (0x07 << 8), 8, /* run length of 14 */
+ (0x18 << 7), 9, /* run length of 15 */
+ (0x17 << 6),10, /* run length of 16 */
+ (0x18 << 6),10, /* run length of 17 */
+ (0x08 << 6),10, /* run length of 18 */
+ (0x67 << 5),11, /* run length of 19 */
+ (0x68 << 5),11, /* run length of 20 */
+ (0x6c << 5),11, /* run length of 21 */
+ (0x37 << 5),11, /* run length of 22 */
+ (0x28 << 5),11, /* run length of 23 */
+ (0x17 << 5),11, /* run length of 24 */
+ (0x18 << 5),11, /* run length of 25 */
+ (0xca << 4),12, /* run length of 26 */
+ (0xcb << 4),12, /* run length of 27 */
+ (0xcc << 4),12, /* run length of 28 */
+ (0xcd << 4),12, /* run length of 29 */
+ (0x68 << 4),12, /* run length of 30 */
+ (0x69 << 4),12, /* run length of 31 */
+ (0x6a << 4),12, /* run length of 32 */
+ (0x6b << 4),12, /* run length of 33 */
+ (0xd2 << 4),12, /* run length of 34 */
+ (0xd3 << 4),12, /* run length of 35 */
+ (0xd4 << 4),12, /* run length of 36 */
+ (0xd5 << 4),12, /* run length of 37 */
+ (0xd6 << 4),12, /* run length of 38 */
+ (0xd7 << 4),12, /* run length of 39 */
+ (0x6c << 4),12, /* run length of 40 */
+ (0x6d << 4),12, /* run length of 41 */
+ (0xda << 4),12, /* run length of 42 */
+ (0xdb << 4),12, /* run length of 43 */
+ (0x54 << 4),12, /* run length of 44 */
+ (0x55 << 4),12, /* run length of 45 */
+ (0x56 << 4),12, /* run length of 46 */
+ (0x57 << 4),12, /* run length of 47 */
+ (0x64 << 4),12, /* run length of 48 */
+ (0x65 << 4),12, /* run length of 49 */
+ (0x52 << 4),12, /* run length of 50 */
+ (0x53 << 4),12, /* run length of 51 */
+ (0x24 << 4),12, /* run length of 52 */
+ (0x37 << 4),12, /* run length of 53 */
+ (0x38 << 4),12, /* run length of 54 */
+ (0x27 << 4),12, /* run length of 55 */
+ (0x28 << 4),12, /* run length of 56 */
+ (0x58 << 4),12, /* run length of 57 */
+ (0x59 << 4),12, /* run length of 58 */
+ (0x2b << 4),12, /* run length of 59 */
+ (0x2c << 4),12, /* run length of 60 */
+ (0x5a << 4),12, /* run length of 61 */
+ (0x66 << 4),12, /* run length of 62 */
+ (0x67 << 4),12, /* run length of 63 */
+ (0x0f << 6),10, /* run length of 64 */
+ (0xc8 << 4),12, /* run length of 2*64 = 128 */
+ (0xc9 << 4),12, /* run length of 3*64 = 192 */
+ (0x5b << 4),12, /* run length of 4*64 = 256 */
+ (0x33 << 4),12, /* run length of 5*64 = 320 */
+ (0x34 << 4),12, /* run length of 6*64 = 384 */
+ (0x35 << 4),12, /* run length of 7*64 = 448 */
+ (0x6c << 3),13, /* run length of 8*64 = 512 */
+ (0x6d << 3),13, /* run length of 9*64 = 576 */
+ (0x4a << 3),13, /* run length of 10*64 = 640 */
+ (0x4b << 3),13, /* run length of 11*64 = 704 */
+ (0x4c << 3),13, /* run length of 12*64 = 768 */
+ (0x4d << 3),13, /* run length of 13*64 = 832 */
+ (0x72 << 3),13, /* run length of 14*64 = 896 */
+ (0x73 << 3),13, /* run length of 15*64 = 960 */
+ (0x74 << 3),13, /* run length of 16*64 = 1024 */
+ (0x75 << 3),13, /* run length of 17*64 = 1088 */
+ (0x76 << 3),13, /* run length of 18*64 = 1152 */
+ (0x77 << 3),13, /* run length of 19*64 = 1216 */
+ (0x52 << 3),13, /* run length of 20*64 = 1280 */
+ (0x53 << 3),13, /* run length of 21*64 = 1344 */
+ (0x54 << 3),13, /* run length of 22*64 = 1408 */
+ (0x55 << 3),13, /* run length of 23*64 = 1472 */
+ (0x5a << 3),13, /* run length of 24*64 = 1536 */
+ (0x5b << 3),13, /* run length of 25*64 = 1600 */
+ (0x64 << 3),13, /* run length of 26*64 = 1664 */
+ (0x65 << 3),13, /* run length of 27*64 = 1728 */
+ (0x08 << 5), 11, /* run length of 28*64 = 1792 */
+ (0x0c << 5), 11, /* run length of 29*64 = 1856 */
+ (0x0d << 5), 11, /* run length of 30*64 = 1920 */
+ (0x12 << 4), 12, /* run length of 31*64 = 1984 */
+ (0x13 << 4), 12, /* run length of 32*64 = 2048 */
+ (0x14 << 4), 12, /* run length of 33*64 = 2112 */
+ (0x15 << 4), 12, /* run length of 34*64 = 2176 */
+ (0x16 << 4), 12, /* run length of 35*64 = 2240 */
+ (0x17 << 4), 12, /* run length of 36*64 = 2304 */
+ (0x1c << 4), 12, /* run length of 37*64 = 2368 */
+ (0x1d << 4), 12, /* run length of 38*64 = 2432 */
+ (0x1e << 4), 12, /* run length of 39*64 = 2496 */
+ (0x1f << 4), 12, /* run length of 40*64 = 2560 */
+};
+
+#else
+extern ShiftedCodes VerticalCodes[];
+extern ShiftedCodes ShiftedWhites[];
+extern ShiftedCodes ShiftedBlacks[];
+#endif
diff --git a/xc/programs/Xserver/XIE/mixie/fax/gbits.h b/xc/programs/Xserver/XIE/mixie/fax/gbits.h
new file mode 100644
index 000000000..f9b669cb4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/gbits.h
@@ -0,0 +1,461 @@
+/* $TOG: gbits.h /main/5 1998/02/09 16:16:13 kaleb $ */
+/**** module fax/gbits.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/gbits.h -- DDXIE fax decode bitstream - get macros
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+/*
+ * gbits.h - sub-include file of bits.h, the 'g' stands for "get"
+ * as in:
+ *
+ * bit = get_bit( byteptr,bitpos,endptr);
+ * byte = get_byte(byteptr,bitpos,endptr);
+ * code = get_wcode(byteptr,bitpos,endptr);
+ * code = get_bcode(byteptr,bitpos,endptr);
+ *
+ * but I am also including:
+ *
+ * adjust_bitstream_8(n,byteptr,bitpos,endptr);
+ * adjust_bitstream( n,byteptr,bitpos,endptr);
+ * adjust_1bit( byteptr,bitpos,endptr);
+ *
+*/
+
+/* ------------------------------------------------------------------- */
+/*
+ * do_magic(byteptr,bitpos,endptr);
+ *
+ * Macro to attempt to recover from an end-of-strip condition.
+ * It bridges the gap between current strip and the next by
+ * copying the last 4 bytes of current strip, together with the
+ * first four bytes of the next strip, into a 'magic strip',
+ * which consists of at 8 bytes. Since no FAX codes are longer
+ * than 13 bits in length, this implies that we have plenty of
+ * room in the magic strip to finish off decoding everything that
+ * was copied from the first strip. When we hit the second long
+ * word in the magic strip, we will trip the endptr condition for
+ * it and then restore the logical next strip, marking the first
+ * one as done.
+ *
+ * The nice thing about this method is that we don't have to do
+ * any copying of real-life strips. We just insert a pseudo-strip
+ * for a very brief amount of time, and the behavior is more or
+ * less hidden from routines outside this module.
+ *
+ */
+
+#define do_magic(byteptr,bitpos,endptr) \
+ { \
+ int o; \
+ if (state->use_magic) { \
+ /* already using magic strip, switch back to normal */ \
+ \
+ if (state->strip_state == StripStateNoMore) { \
+ /* we are out of data! return number of lines found */ \
+ state->decoder_done = 1; \
+ } \
+ else { \
+ /* switch over to next input strip */ \
+ o = byteptr - endptr; \
+ byteptr = (unsigned char *)state->strip + o; \
+ endptr = (unsigned char *)state->strip+state->strip_size-4;\
+ state->use_magic = 0; /* aw - the magic is gone :-( */ \
+ } \
+ } \
+ else { \
+ /* will switch over to using magic strip */ \
+ state->use_magic = 1; \
+ state->magicStrip[0] = *(endptr); \
+ state->magicStrip[1] = *(endptr+1); \
+ state->magicStrip[2] = *(endptr+2); \
+ state->magicStrip[3] = *(endptr+3); \
+ \
+ /* set byteptr in equivalent position in the magic strip */ \
+ o = byteptr - endptr; \
+ byteptr = o + (unsigned char *)&state->magicStrip[0]; \
+ endptr = (unsigned char *)&state->magicStrip[4]; \
+ /* will swap back after magicStrip[3] is done */ \
+ \
+ /* now signal to caller that we want a new strip */ \
+ state->magic_needs = 1; \
+ state->strip_state = StripStateDone; \
+ /* you can toss the old one */ \
+ \
+ save_state_and_return(state); \
+ } /* end of if already magic */ \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * finish_magic(final);
+ *
+ * This macro finishes the job of assembling the magic strip.
+ * It plugs in the first long word of the new strip in as the
+ * second long word of the magic strip.
+ *
+ * Note that when 'magic_needs' is set, the caller MUST NOT call
+ * the decoder again until that strip is available, unless final
+ * is 1 (no more strips coming).
+ */
+
+#define finish_magic(final) \
+ { \
+ if (state->strip_state == StripStateNew) { \
+ /* what a guy! he gave me a new strip. :-) */ \
+ state->magicStrip[4] = *(state->strip); \
+ state->magicStrip[5] = *(state->strip+1); \
+ state->magicStrip[6] = *(state->strip+2); \
+ state->magicStrip[7] = *(state->strip+3); \
+ state->strip_state = StripStateInUse; \
+ } \
+ else { \
+ /* no new strip?? Better have a good reason! */ \
+ if (final) { \
+ /* Out of data (good reason), set 2nd magic word to 0 */ \
+ state->magicStrip[4] = 0; \
+ state->magicStrip[5] = 0; \
+ state->magicStrip[6] = 0; \
+ state->magicStrip[7] = 0; \
+ } \
+ else { \
+ /* strips left, but I am DENIED?? Shocking! */ \
+ state->decoder_done = FAX_DECODE_DONE_ErrorBadMagic; \
+ return(lines_found); \
+ } \
+ } /* end of if (final) */ \
+ /* byteptr, bitpos, endptr should already be set up ok */ \
+ state->magic_needs = 0; \
+ } /* end of finish_magic(final) */
+
+/* ------------------------------------------------------------------- */
+/*
+ * skip_bits_at_eol(byteptr,bitpos,endptr);
+ *
+ * Macro to move bitstream position forward to the next even byte
+ * boundary, if necessary
+ *
+ */
+#define skip_bits_at_eol(byteptr,bitpos,endptr) \
+ { \
+ if (bitpos) { \
+ bitpos = 0; \
+ if (++byteptr >= endptr) \
+ do_magic(byteptr,bitpos,endptr); \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * adjust_bitstream_8(n,byteptr,bitpos,endptr);
+ *
+ * Macro to move bitstream position forward n bits, where n is
+ * known to be <= 8.
+ *
+ * Strategy:
+ * There are only two cases:
+ *
+ * bitpos+n < 8, => byteptr same, adjust bitpos
+ *
+ * bitpos+n >= 8, => bitpos = (bitpos+n)%8, ++byteptr,
+ * need to check endptr.
+ */
+
+#define adjust_bitstream_8(n,byteptr,bitpos,endptr) \
+ { register int tmp=n+bitpos; \
+ if (tmp < 8) \
+ bitpos=tmp ; /* staying in same byte */ \
+ else { /* moving to new byte */ \
+ bitpos=tmp%8; /* adjust bitpos */ \
+ if (++byteptr >= endptr) \
+ do_magic(byteptr,bitpos,endptr); \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * adjust_1bit(byteptr,bitpos,endptr);
+ *
+ * Macro to move bitstream position forward 1 bit
+ *
+ * Strategy:
+ * oh, poo! Just leverage adjust_bitstream_8( )
+ *
+ */
+
+#define adjust_1bit(byteptr,bitpos,endptr) \
+ adjust_bitstream_8(1,byteptr,bitpos,endptr)
+
+/* ------------------------------------------------------------------- */
+/*
+ * adjust_bitstream(n,byteptr,bitpos,endptr);
+ *
+ * Macro to move bitstream position forward n bits, where n is
+ * known to be <= 13.
+ *
+ * Strategy:
+ * We may need to adjust from 1 to 13 bits. It's easy
+ * to calculate the new bitpos - it's just (n+bitpos)%8.
+ * Similarly, the number of bytes to move over is given
+ * by (n+bitpos)/8.
+ *
+ */
+
+#define adjust_bitstream(n,byteptr,bitpos,endptr) \
+ { register int tmp=n+bitpos; \
+ if (tmp < 8) \
+ bitpos=tmp ; /* staying in same byte */ \
+ else { /* moving to new byte */ \
+ bitpos = tmp%8; \
+ byteptr += tmp/8; \
+ if (byteptr >= endptr) \
+ do_magic(byteptr,bitpos,endptr); \
+ } \
+ }
+
+/* ------------------------------------------------------------------- */
+/*
+ * bit = get_bit(byteptr,bitpos,endptr);
+ *
+ * Macro to get next coding bit (when searching for tag bit, g32d).
+ *
+ * Strategy:
+ * mask everything but current bitpos, where bitpos counts
+ * from msbit to lsbit (bitpos=0 means msbit)
+ *
+ * NOTE: we do *not* try to align the bit in any way. It is
+ * assumed that the whole masked byte will be inspected
+ * at once for non-zero status.
+ *
+ */
+#define get_bit(byteptr,bitpos,endptr) \
+ ( (*byteptr) & ((unsigned char) 0x080 >> bitpos) )
+
+ /* Notice endptr isn't actually used, it's just there for show */
+/* ------------------------------------------------------------------- */
+/*
+ * byte = get_byte(byteptr,bitpos,endptr);
+ *
+ * Macro to get next coding byte.
+ *
+ * IMPORTANT!! There is no check to make sure that byteptr+1
+ * actually point to valid data in the macro below. It
+ * is assumed this macro will never be called unless it
+ * has already been verified it is safe to do so.
+ *
+ * Strategy:
+ * If bitpos is 0, all data available in this byte, and
+ * it's trivial. So let's assume bitpos != 0, so that the
+ * 8 bits we want straddles two bytes, as below:
+ *
+ * bitpos = 3, counting from the left:
+ *
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X X Y Y Y
+ *
+ * We want to form an 8-bit byte out of bits XXXXXYYY as
+ * shown. By inspection, we need to shift the first byte to
+ * the left three bits, and add the second byte shifted to
+ * the right the complementary number of times. Thus:
+ */
+#define get_byte(byteptr,bitpos,endptr) \
+ ( bitpos? ( (*byteptr) << bitpos ) | \
+ ( (*(byteptr+1))>> (8-bitpos) ) : \
+ *byteptr \
+ )
+
+ /* Notice endptr isn't actually used, it's just there for show */
+
+#define get_pbyte(byteptr,endptr) \
+ ( *byteptr )
+
+
+/* ------------------------------------------------------------------- */
+/*
+ * code = get_wcode(byteptr,bitpos,endptr);
+ *
+ * Macro to get next white run length
+ *
+ * IMPORTANT!! There is no check to make sure that byteptr+1 or
+ * byteptr+2 actually point to valid data in the macro
+ * below. It is assumed this macro will never be called
+ * unless it has already been verified it is safe to do so.
+ *
+ * Strategy:
+ * For the white table we need 12 bits. If bitpos <=4,
+ * then the first byte will have at least four bits, so
+ * we only need two bytes. If bitpos >4, we need three
+ * bytes.
+ *
+ * bitpos = 4, starting from 0 counting from the left:
+ *
+ * 0 1 2 3 4
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X Y Y Y Y Y Y Y Y
+ *
+ * bitpos = 5, starting from 0 counting from the left:
+ *
+ * 0 1 2 3 4 5
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X Y Y Y Y Y Y Y Y Z
+ *
+ * Supose bitpos <=4. For example, suppose bitpos = 3,
+ * as is pictured below:
+ *
+ * 0 1 2 3 4
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X X Y Y Y Y Y Y Y
+ *
+ * We need to form a 12 bit word out of XXXXXYYYYYYY. By
+ * inspection it is easy to see that (4-bitpos) represents
+ * the number of bits "spilled" to the left of bitpos=4.
+ * The left-most bit needs to be shifted right to the bit4
+ * position, so the solution is to form a word from the
+ * first two bytes, shift right by (4-bitpos) and mask.
+ *
+ * For the case of bitpos=5 (above), (bitpos-4) bits have
+ * "spilled" into the third byte. We need to form a word
+ * out of the three consecutive bytes and right shift by
+ * the amount (8-spill) = 8 - (bitpos-4) = 12-bitpos, then
+ * mask.
+ */
+#define two_bytes \
+ ( (((unsigned int)*byteptr)<<8) | (*(byteptr+1)) )
+
+#define three_bytes \
+ ( (((unsigned int)*byteptr)<<16) | \
+ (((unsigned int)*(byteptr+1))<<8) | \
+ (*(byteptr+2)) )
+
+#define get_wcode(byteptr,bitpos,endptr) \
+ ( 0x0fff & \
+ ( bitpos>4? ( three_bytes >> (12-bitpos) ) \
+ : ( two_bytes >> ( 4-bitpos) ) \
+ ) \
+ )
+
+ /* Notice endptr isn't actually used, it's just there for show */
+
+/* ------------------------------------------------------------------- */
+/*
+ * code = get_bcode(byteptr,bitpos,endptr);
+ *
+ * Macro to get next black run length.
+ *
+ * IMPORTANT!! There is no check to make sure that byteptr+1 or
+ * byteptr+2 actually point to valid data in the macro
+ * below. It is assumed this macro will never be called
+ * unless it has already been verified it is safe to do so.
+ *
+ * Strategy:
+ * For the black table we need 13 bits. If bitpos <=3,
+ * then the first byte will have at least five bits, so
+ * we only need two bytes. If bitpos >=4, we need three
+ * bytes.
+ *
+ * bitpos = 3, starting from 0 counting from the left:
+ *
+ * 0 1 2 3
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X X Y Y Y Y Y Y Y Y
+ *
+ * bitpos = 4, starting from 0 counting from the left:
+ *
+ * 0 1 2 3 4
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X Y Y Y Y Y Y Y Y Z
+ *
+ * Supose bitpos <=3. For example, suppose bitpos = 2,
+ * as is pictured below:
+ *
+ * 0 1 2 3
+ * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ * X X X X X X Y Y Y Y Y Y Y
+ *
+ * We need to form a 13 bit word out of XXXXXXYYYYYYY. By
+ * inspection it is easy to see that (3-bitpos) represents
+ * the number of bits "spilled" to the left of bitpos=3.
+ * The left-most bit needs to be shifted right to the bit3
+ * position, so the solution is to form a word from the
+ * first two bytes, shift right by (3-bitpos) and mask.
+ *
+ * For the case of bitpos=4 (above), (bitpos-3) bits have
+ * "spilled" into the third byte. We need to form a word
+ * out of the three consecutive bytes and right shift by
+ * the amount (8-spill) = 8 - (bitpos-3) = 11-bitpos, then
+ * mask.
+ */
+
+#define get_bcode(byteptr,bitpos,endptr) \
+ ( 0x1fff & \
+ ( bitpos>3? ( three_bytes >> (11-bitpos) ) \
+ : ( two_bytes >> ( 3-bitpos) ) \
+ ) \
+ )
+
+ /* Notice endptr isn't actually used, it's just there for show */
+
+/* ------------------------------------------------------------------- */
+/**** module fax/gbits.h ****/
diff --git a/xc/programs/Xserver/XIE/mixie/fax/zeroeven.c b/xc/programs/Xserver/XIE/mixie/fax/zeroeven.c
new file mode 100644
index 000000000..8712118fb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/fax/zeroeven.c
@@ -0,0 +1,125 @@
+/* $TOG: zeroeven.c /main/6 1998/02/09 16:16:22 kaleb $ */
+/**** module fax/zeroeven.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ fax/zeroeven.c -- DDXIE fax utility
+
+ Ben && Larry -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+
+
+/*** zero_even.c - zero out even transitions.
+
+ The array wbtrans is arranged as a table of positions at which
+ the input changes from white to black, then black to white, then
+ white to black, and so on. We assume all output pixels have
+ already been set white. Therefore we only have to fill the
+ black ranges with zeros...
+
+ W->B B->W W->B B->W W->B B->W W->B B->W
+
+ 12 17 29 30 65 68 90 92
+
+ bit positions 12-16, 29, 65-67, and 90-91 in the above
+ example are black. It should be clear from the example
+ that the size of the run length is t[w]-t[b], where
+ w=b+1 and b is the index of a transition from white to
+ black. Note that if the line was only 92 pixels wide,
+ setting the imaginary pixel with index = image width
+ B->W still gives us the right answer.
+
+***/
+
+#include <xiemd.h>
+#include "macro.h"
+
+/**********************************************************************/
+
+void
+zero_even(cp,t,nt,w,white)
+register LogInt *cp;
+register int *t, nt,w,white;
+{
+unsigned int sbit,ebit;
+LogInt *sbyt, *ebyt, black;
+
+#define ONES ~((LogInt)0)
+
+ memset(cp, white ? 0xff: 0, (w+7)>>3);
+ black = white ? 0 : ONES;
+
+ for (nt = (nt>>1) - 1; nt >= 0; nt--) {
+ sbit = *t++;
+ ebit = *t++; /* if (!nt && (ebit > w)) ebit = w; */
+ sbyt = cp + (sbit >> LOGSHIFT); sbit &= LOGMASK;
+ ebyt = cp + (ebit >> LOGSHIFT); ebit &= LOGMASK;
+
+ if (sbyt < ebyt) {
+ if (sbit) *sbyt++ ^= BitRight(ONES,sbit);
+ while (sbyt < ebyt) *sbyt++ = black;
+ if (ebit) *sbyt ^= ~BitRight(ONES,ebit);
+ } else
+ *sbyt ^= BitRight(ONES,sbit) & ~(BitRight(ONES,ebit));
+ }
+}
+/**** module fax/zeroeven.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/import/Imakefile b/xc/programs/Xserver/XIE/mixie/import/Imakefile
new file mode 100644
index 000000000..1ce4545c8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/Imakefile
@@ -0,0 +1,37 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:56:13 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/import/Imakefile,v 3.5 1998/07/25 08:05:11 dawes Exp $
+XCOMM build device dependent machine independent import element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = mifax.c miclut.c micphoto.c midraw.c \
+ milut.c miphoto.c miuncomp.c
+
+OBJS1 = mifax.o miclut.o micphoto.o midraw.o \
+ milut.o miphoto.o miuncomp.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = microi.c miroi.c miregion.c mijpeg.c
+OBJS2 = microi.o miroi.o miregion.o mijpeg.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions -I../jpeg
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(mimp,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/import/miclut.c b/xc/programs/Xserver/XIE/mixie/import/miclut.c
new file mode 100644
index 000000000..e6ca69dbb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/miclut.c
@@ -0,0 +1,265 @@
+/* $TOG: miclut.c /main/7 1998/02/09 16:16:31 kaleb $ */
+/**** module miclut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miclut.c -- DDXIE prototype import client lut element
+
+ Ben Fahy -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/miclut.c,v 3.4 1998/10/25 07:11:58 dawes Exp $ */
+
+#define _XIEC_MICLUT
+#define _XIEC_ICLUT
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <lut.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+
+/*
+ * routines used internal to this module
+ */
+
+static int CreateICLUT(floDefPtr flo, peDefPtr ped);
+static int InitializeICLUT(floDefPtr flo, peDefPtr ped);
+static int ActivateICLUT(floDefPtr flo, peDefPtr ped, peTexPtr pet);
+static int ResetICLUT(floDefPtr flo, peDefPtr ped);
+static int DestroyICLUT(floDefPtr flo, peDefPtr ped);
+
+/*
+ * DDXIE ImportClientLUT entry points
+ */
+
+static ddElemVecRec ICLUTVec = {
+ CreateICLUT,
+ InitializeICLUT,
+ ActivateICLUT,
+ (xieIntProc)NULL,
+ ResetICLUT,
+ DestroyICLUT
+ };
+
+/*
+ * Local Declarations
+ */
+
+typedef struct _lutpvt {
+ int byteptr; /* current number of bytes received */
+ int bytelength; /* selects total size of array */
+ int striplength; /* actual strip size, round up to power of 2 */
+ int bytetype; /* selects array element size */
+ int bandnum; /* for interleave, to swizzle bands */
+} lutPvtRec, *lutPvtPtr;
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeICLUT(floDefPtr flo, peDefPtr ped)
+{
+ /* for now just copy our entry point vector into the peDef */
+ ped->ddVec = ICLUTVec;
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateICLUT(floDefPtr flo, peDefPtr ped)
+{
+ return MakePETex(flo,ped,xieValMaxBands * sizeof(lutPvtRec),NO_SYNC,NO_SYNC);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeICLUT(floDefPtr flo, peDefPtr ped)
+{
+ xieFloImportClientLUT *raw = (xieFloImportClientLUT *)ped->elemRaw;
+ lutPvtPtr ext = (lutPvtPtr) ped->peTex->private;
+ int band, nbands = ped->peTex->receptor[SRCtag].inFlo->bands;
+ CARD32 *lengths = &(raw->length0);
+ CARD32 *levels = &(raw->levels0);
+
+ for (band = 0; band < nbands; band++, ext++, lengths++, levels++) {
+ int deep;
+ ext->byteptr = 0;
+ ext->bytetype = LutPitch(*levels);
+ ext->bytelength = *lengths * ext->bytetype;
+ SetDepthFromLevels(ext->bytelength, deep);
+ ext->striplength = (1 << deep);
+ ext->bandnum = (raw->class == xieValSingleBand ||
+ raw->bandOrder == xieValLSFirst)
+ ? band : (xieValMaxBands - band - 1);
+ }
+ return InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateICLUT(floDefPtr flo, peDefPtr ped, peTexPtr pet)
+{
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ lutPvtPtr ext = (lutPvtPtr) pet->private;
+
+ for(band = 0; band < nbands; band++, ext++, iband++) {
+ bandPtr oband = &(pet->emitter[ext->bandnum]);
+ pointer ivoid, ovoid;
+ int ilen, icopy;
+
+ if(!(pet->scheduled & 1<<band)) continue;
+ if(!(ovoid = GetDstBytes(flo,pet,oband,0,ext->striplength,FALSE)))
+ return(FALSE);
+ /*
+ ** We have no guarantee to get all the output in one packet. In
+ ** fact we have no guarantee we will ever get all the output, or
+ ** that perhaps we might get too much. If we do get too much we
+ ** would like to notify the user but the protocol doesn't provide
+ ** something similar to a decodeNotify.
+ */
+ for(ilen = 0;
+ (ivoid = GetSrcBytes(flo,pet,iband,iband->current+ilen,1,FALSE)) != 0;) {
+ icopy = ilen = iband->strip->length;
+
+ if ((ext->byteptr + ilen) > ext->bytelength)
+ icopy = ext->bytelength - ext->byteptr;
+
+ if (icopy) {
+ memcpy( ((char *) ovoid) + ext->byteptr, (char *) ivoid, icopy);
+ ext->byteptr += icopy;
+ }
+ }
+ FreeData(flo, pet, iband, iband->maxLocal);
+
+ /* if final, process the data received */
+ if (iband->final) {
+ SetBandFinal(oband);
+ PutData(flo,pet,oband,ext->striplength);
+ }
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetICLUT(floDefPtr flo, peDefPtr ped)
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyICLUT(floDefPtr flo, peDefPtr ped)
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.flush = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+}
+
+/* end module miclut.c */
+
diff --git a/xc/programs/Xserver/XIE/mixie/import/micphoto.c b/xc/programs/Xserver/XIE/mixie/import/micphoto.c
new file mode 100644
index 000000000..70bcf2ab6
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/micphoto.c
@@ -0,0 +1,810 @@
+/* $TOG: micphoto.c /main/9 1998/02/09 16:16:35 kaleb $ */
+/**** module micphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ micphoto.c -- DDXIE import client photo element
+
+ Robert NC Shelley && Dean Verheiden -- AGE Logic, Inc. April, 1993
+
+ Fax stuff added by Ben Fahy
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/micphoto.c,v 3.3 1998/10/05 13:22:34 dawes Exp $ */
+
+#define _XIEC_MICPHOTO
+#define _XIEC_ICPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <miuncomp.h>
+#include <memory.h>
+
+/*
+ * Local Declarations.
+ */
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeICPhoto();
+bandMsk miImportCanonic();
+bandMsk miImportStream();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateICPhotoUn();
+static int InitializeICPhotoUncomByPlane();
+static int ActivateICPhotoUncomByPlane();
+static int ResetICPhoto();
+static int DestroyICPhotoUn();
+
+static int CreateICPhotoStream();
+static int InitializeICPhotoStream();
+static int ActivateICPhotoStream();
+
+#if XIE_FULL
+static int InitializeICPhotoUncomByPixel();
+static int ActivateICPhotoUncomByPixel();
+#endif
+
+
+/*
+ * routines we need from somewhere else
+ */
+extern int CreateICPhotoFax();
+extern int InitializeICPhotoFax();
+extern int ActivateICPhotoFax();
+extern int ResetICPhotoFax();
+extern int DestroyICPhotoFax();
+
+#if XIE_FULL
+extern int CreateIPhotoJpegBase();
+extern int InitializeICPhotoJpegBase();
+extern int ActivateIPhotoJpegBase();
+extern int ResetIPhotoJpegBase();
+extern int DestroyIPhotoJpegBase();
+
+#ifdef optional_non_SI
+static int CreateICPhotoJPEGLossless();
+static int InitializeICPhotoJPEGLossless();
+static int ActivateICPhotoJPEGLossless();
+static int DestroyICPhotoJPEGLossless();
+#endif
+#endif /* XIE_FULL */
+
+/*
+ * DDXIE ImportClientPhoto entry points
+ */
+static ddElemVecRec ICPhotoUncomByPlaneVec = {
+ CreateICPhotoUn,
+ InitializeICPhotoUncomByPlane,
+ ActivateICPhotoUncomByPlane,
+ (xieIntProc)NULL,
+ ResetICPhoto,
+ DestroyICPhotoUn
+ };
+
+static ddElemVecRec ICPhotoStreamVec = {
+ CreateICPhotoStream,
+ InitializeICPhotoStream,
+ ActivateICPhotoStream,
+ (xieIntProc)NULL,
+ ResetICPhoto,
+ DestroyICPhotoUn
+ };
+
+static ddElemVecRec ICPhotoFaxVec = {
+ CreateICPhotoFax,
+ InitializeICPhotoFax,
+ ActivateICPhotoFax,
+ (xieIntProc)NULL,
+ ResetICPhotoFax,
+ DestroyICPhotoFax
+ };
+
+#if XIE_FULL
+static ddElemVecRec ICPhotoUncomByPixelVec = {
+ CreateICPhotoUn,
+ InitializeICPhotoUncomByPixel,
+ ActivateICPhotoUncomByPixel,
+ (xieIntProc)NULL,
+ ResetICPhoto,
+ DestroyICPhotoUn
+ };
+
+static ddElemVecRec ICPhotoJpegBaseVec = {
+ CreateIPhotoJpegBase,
+ InitializeICPhotoJpegBase, /* only thing not shared with ImportPhotomap */
+ ActivateIPhotoJpegBase,
+ (xieIntProc)NULL,
+ ResetIPhotoJpegBase,
+ DestroyIPhotoJpegBase
+ };
+#endif /* XIE_FULL */
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeICPhoto(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+
+ if(!miImportCanonic(flo,ped)) {
+ ped->ddVec = ICPhotoStreamVec;
+ return(TRUE);
+ }
+ switch(raw->decodeTechnique) {
+ case xieValDecodeUncompressedSingle:
+ ped->ddVec = ICPhotoUncomByPlaneVec;
+ break;
+
+ case xieValDecodeG31D:
+ case xieValDecodeG32D:
+ case xieValDecodeG42D:
+ case xieValDecodeTIFF2:
+ case xieValDecodeTIFFPackBits:
+ ped->ddVec = ICPhotoFaxVec;
+ break;
+
+#if XIE_FULL
+ case xieValDecodeUncompressedTriple:
+
+ if(((xieTecDecodeUncompressedTriple*)&raw[1])
+ ->interleave == xieValBandByPlane)
+ ped->ddVec = ICPhotoUncomByPlaneVec;
+ else { /* xieValBandByPixel */
+ ped->ddVec = ICPhotoUncomByPixelVec;
+ break;
+ }
+ break;
+
+ case xieValDecodeJPEGBaseline:
+ ped->ddVec = ICPhotoJpegBaseVec;
+ break;
+#endif /* XIE_FULL */
+
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ return(TRUE);
+} /* end miAnalyzeICPhoto */
+
+
+/*------------------------------------------------------------------------
+-------- utility routines: see what kind data should be forwarded --------
+------------------------------------------------------------------------*/
+bandMsk miImportCanonic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ bandMsk mask = NO_BANDS, all = (1<<ped->outFlo.bands)-1;
+ inFloPtr inf;
+ int b;
+
+ /* find recipients that want canonic data
+ */
+ for(inf = ped->outFlo.outChain; inf && mask != all; inf = inf->outChain)
+ for(b = 0; b < inf->bands; ++b)
+ if(IsCanonic(inf->format[b].class))
+ mask |= 1<<b;
+
+ return(mask);
+}
+
+bandMsk miImportStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ bandMsk mask = NO_BANDS, all = (1<<ped->outFlo.bands)-1;
+ inFloPtr inf;
+ int b;
+
+ /* find recipients that want stream data
+ */
+ for(inf = ped->outFlo.outChain; inf && mask != all; inf = inf->outChain)
+ for(b = 0; b < inf->bands; ++b)
+ if(inf->format[b].class == STREAM)
+ mask |= 1<<b;
+
+ return(mask);
+}
+
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateICPhotoUn(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return( MakePETex(flo, ped, xieValMaxBands * sizeof(miUncompRec),
+ NO_SYNC, NO_SYNC) );
+} /* end CreateICPhotoUn */
+
+
+static int CreateICPhotoStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return( MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC) );
+} /* end CreateICPhotoStream */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeICPhotoUncomByPlane(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ CARD32 nbands = ped->outFlo.bands,b,s;
+ formatPtr inf = ped->inFloLst[IMPORT].format;
+ xieTypOrientation pixelOrder, fillOrder;
+ CARD8 *ppad;
+
+ if (nbands == 1) {
+ xieTecDecodeUncompressedSingle *tec = ((xieTecDecodeUncompressedSingle*)
+ &raw[1]);
+ pixelOrder = tec->pixelOrder;
+ fillOrder = tec->fillOrder;
+ pvt->bandMap = 0;
+ ppad = &tec->leftPad;
+ } else {
+ xieTecDecodeUncompressedTriple *tec = ((xieTecDecodeUncompressedTriple*)
+ &raw[1]);
+ pixelOrder = tec->pixelOrder;
+ fillOrder = tec->fillOrder;
+ ppad = tec->leftPad;
+ if (tec->bandOrder == xieValLSFirst)
+ for(b = 0; b < xieValMaxBands; ++b)
+ pvt[b].bandMap = b;
+ else
+ for(s = 0, b = xieValMaxBands; b--; ++s)
+ pvt[s].bandMap = b;
+ }
+
+ for (b = 0; b < nbands; b++, pvt++, ppad++, inf++) {
+ pvt->bitOff = pvt->leftPad = *ppad;
+ if (inf->depth == 1) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ if (pvt->leftPad & 7 || inf->stride != 1) {
+ pvt->action = (fillOrder == xieValMSFirst) ? CPextractstreambits:
+ CPextractswappedstreambits;
+ } else {
+ pvt->action = (fillOrder == xieValMSFirst) ? CPpass_bits :
+ CPreverse_bits;
+ }
+#else
+ if (pvt->leftPad & 7 || inf->stride != 1) {
+ pvt->action = (fillOrder == xieValLSFirst) ? CPextractstreambits:
+ CPextractswappedstreambits;
+ } else {
+ pvt->action = (fillOrder == xieValLSFirst) ? CPpass_bits :
+ CPreverse_bits;
+ }
+#endif
+ } else if (inf->depth <= 8) {
+ if (pvt->leftPad & 7 || inf->stride & 7) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUBtoB;
+ else
+ pvt->action = MLUBtoB;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUBtoB;
+ else
+ pvt->action = LLUBtoB;
+ }
+ } else {
+ /* They chose wisely */
+ pvt->action = CPpass_bytes;
+ }
+ } else if (inf->depth <= 16) {
+ if (pvt->leftPad & 15 || inf->stride & 15) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUPtoP;
+ else
+ pvt->action = MLUPtoP;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUPtoP;
+ else
+ pvt->action = LLUPtoP;
+ }
+ } else {
+ /* They chose wisely */
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ pvt->action = (fillOrder==xieValMSFirst) ? CPpass_pairs : CPswap_pairs;
+#else
+ pvt->action = (fillOrder==xieValLSFirst) ? CPpass_pairs : CPswap_pairs;
+#endif
+ }
+ } else if (inf->depth <= 24) {
+ if (pvt->leftPad & 31 || inf->stride & 31) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUQtoQ;
+ else
+ pvt->action = MLUQtoQ;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUQtoQ;
+ else
+ pvt->action = LLUQtoQ;
+ }
+ } else {
+ /* They chose wisely */
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ pvt->action = (fillOrder==xieValMSFirst) ? CPpass_quads : CPswap_quads;
+#else
+ pvt->action = (fillOrder==xieValLSFirst) ? CPpass_quads : CPswap_quads;
+#endif
+ }
+ } else {
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ }
+ pet->receptor->forward = miImportStream(flo,ped);
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeICPhotoUnSingle */
+
+
+static int InitializeICPhotoStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* tell the data manager to forward our input data to downstream elements
+ */
+ ped->peTex->receptor->forward = miImportStream(flo,ped);
+
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1));
+} /* end InitializeICPhotoStream */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateICPhotoUncomByPlane(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ CARD32 nbands = ped->inFloLst[IMPORT].bands;
+ bandPtr sbnd = pet->receptor[IMPORT].band, dbnd;
+ CARD32 oldslen, nextslen, b;
+ pointer src = (pointer)NULL, dst = (pointer)NULL;
+
+ for(b = 0; b < nbands; ++sbnd, ++b, pvt++) {
+ void (*action)() = pvt->action;
+
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ dbnd = &pet->emitter[pvt->bandMap];
+ if(pet->scheduled & 1<<b &&
+ (src = GetSrcBytes(flo,pet,sbnd,sbnd->current,nextslen,KEEP)) &&
+ (dst = GetCurrentDst(flo,pet,dbnd))) {
+ do {
+
+ (*action)(src, dst, sbnd->format->width, pvt->bitOff,
+ (CARD32)sbnd->format->depth,
+ sbnd->format->stride);
+
+ pvt->bitOff = pvt->bitOff + sbnd->format->pitch & 7; /* Set next */
+ oldslen = (pvt->bitOff) ? nextslen - 1 : nextslen;
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ src = GetSrcBytes(flo,pet,sbnd,sbnd->current+oldslen,nextslen,KEEP);
+ dst = GetNextDst(flo,pet,dbnd,FLUSH);
+ } while(src && dst);
+ }
+
+ if(!src && sbnd->final && dbnd->current < dbnd->format->height) {
+ /*
+ * the client lied about the image size!
+ */
+ if(raw->notify)
+ SendDecodeNotifyEvent(flo, ped, dbnd->band,
+ xieValDecodeUncompressedSingle,
+ dbnd->format->width, dbnd->current, TRUE);
+ /*
+ * If the client didn't send enough data, we could zero-fill the
+ * remaining lines. Since we sent the "aborted" status, we won't
+ * bother (the protocol offers both choices).
+ */
+ ValueError(flo,ped,dbnd->format->height, return(FALSE));
+ }
+ if (!src || dbnd->final) {
+ /* free whatever we've used so far and
+ * set the threshold to one byte more than whatever is left over
+ */
+ FreeData(flo, pet, sbnd, sbnd->final ? sbnd->maxGlobal : sbnd->current);
+ SetBandThreshold(sbnd, sbnd->available + 1);
+ }
+ }
+ return(TRUE);
+} /* end ActivateICPhotoUncomByPlane */
+
+
+static int ActivateICPhotoStream(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ CARD32 nbands = ped->inFloLst[IMPORT].bands;
+ bandPtr bnd = pet->receptor[IMPORT].band;
+ CARD32 b;
+
+ for(b = 0; b < nbands; ++bnd, ++b) {
+ if(GetSrcBytes(flo,pet,bnd,bnd->current,1,KEEP))
+ FreeData(flo,pet,bnd,bnd->maxGlobal);
+ }
+ return(TRUE);
+} /* end ActivateICPhotoStream */
+
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetICPhoto(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetICPhoto */
+
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyICPhotoUn(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyICPhotoUn */
+
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeICPhotoUncomByPixel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ bandPtr sbnd = &ped->peTex->receptor[IMPORT].band[0];
+ CARD32 sstride = sbnd->format->stride>>3;
+ xieTecDecodeUncompressedTriple *tec = ((xieTecDecodeUncompressedTriple*)
+ &raw[1]);
+ CARD8 leftPad = tec->leftPad[0]>>3;
+ CARD32 depth1, depth2, depth3;
+ int s, d;
+
+ pvt->unaligned = FALSE; /* Hope for the best */
+
+ if(tec->bandOrder == xieValLSFirst)
+ for(d = 0; d < xieValMaxBands; ++d)
+ pvt[d].bandMap = d;
+ else
+ for(s = 0, d = xieValMaxBands; d--; ++s)
+ pvt[s].bandMap = d;
+
+ depth1 = pet->emitter[pvt[0].bandMap].format->depth;
+ depth2 = pet->emitter[pvt[1].bandMap].format->depth;
+ depth3 = pet->emitter[pvt[2].bandMap].format->depth;
+
+ pvt->bitOff = pvt->leftPad = tec->leftPad[0];
+
+ /* See if data is nicely aligned */
+ if (!(tec->leftPad[0] & 7) && !(sbnd->format->stride & 7)) {
+ if (depth1 == 16 && depth2 == 16 && depth3 == 16) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? StoP : StosP;
+#else
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? StosP : StoP;
+#endif
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = pa;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = s + leftPad;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ }
+ } else if (depth1 == 8 && depth2 == 8 && depth3 == 8) {
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = StoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = s + leftPad;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ }
+ } else if (depth1 == 4 && depth2 == 4 && depth3 == 4) {
+ if (tec->fillOrder == xieValMSFirst) {
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0xf0;
+ (pvt++)->shift = 4;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = 1 + leftPad;
+ pvt->mask = 0xf0;
+ pvt->shift = 4;
+ } else { /* xieValLSFirst */
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0xf0;
+ (pvt++)->shift = 4;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = 1 + leftPad;
+ pvt->mask = 0x0f;
+ pvt->shift = 0;
+ }
+ } else if (depth1 + depth2 + depth3 <= 8) {
+ CARD8 ones = 0xff,smask1,smask2,smask3,shift1,shift2,shift3;
+ if (tec->fillOrder == xieValMSFirst) {
+ smask1 = ~(ones>>depth1);
+ smask2 = ~(ones>>(depth1 + depth2) | smask1);
+ smask3 = ~(ones>>(depth1 + depth2 + depth3) | smask1 | smask2);
+ shift1 = 8 - depth1;
+ shift2 = 8 - (depth1 + depth2);
+ shift3 = 8 - (depth1 + depth2 + depth3);
+ } else { /* fillOrder == xieValLSFirst */
+ smask3 = ~(ones<<depth3);
+ smask2 = ~(ones<<(depth2 + depth3) | smask3);
+ smask1 = ~(ones<<(depth1 + depth2 + depth3) | smask2 | smask3);
+ shift3 = 0;
+ shift2 = depth3;
+ shift1 = depth2 + depth3;
+ }
+ pvt->action = (depth1 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask1;
+ (pvt++)->shift = shift1;
+ pvt->action = (depth2 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask2;
+ (pvt++)->shift = shift2;
+ pvt->action = (depth3 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask3;
+ pvt->shift = shift3;
+ } else {
+ pvt->unaligned = TRUE;
+ }
+ } else {
+ pvt->unaligned = TRUE;
+ }
+
+ /* Wasn't nicely aligned, do it the hard way */
+ if (((miUncompPtr)pet->private)->unaligned) {
+ pvt->action =
+ ExtractTripleFuncs[(tec->pixelOrder == xieValLSFirst) ? 0 : 1]
+ [(tec->fillOrder == xieValLSFirst) ? 0 : 1]
+ [(depth1 <= 8) ? 0 : 1]
+ [(depth2 <= 8) ? 0 : 1]
+ [(depth3 <= 8) ? 0 : 1];
+ }
+ pet->receptor->forward = miImportStream(flo,ped);
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeICPhotoUnTriple */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateICPhotoUncomByPixel(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+ miUncompPtr pvt = (miUncompPtr) (pet->private);
+ bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+ bandPtr db0 = &pet->emitter[pvt[0].bandMap];
+ bandPtr db1 = &pet->emitter[pvt[1].bandMap];
+ bandPtr db2 = &pet->emitter[pvt[2].bandMap];
+ CARD32 width = db0->format->width;
+ pointer src = NULL, dp0 = NULL, dp1 = NULL, dp2 = NULL;
+
+ if (pvt->unaligned) {
+ CARD32 oldslen, nextslen;
+ void (*action)() = pvt->action;
+ CARD32 depth0 = db0->format->depth;
+ CARD32 depth1 = db1->format->depth;
+ CARD32 depth2 = db2->format->depth;
+ CARD32 stride = sbnd->format->stride;
+
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ if((src = GetSrcBytes(flo,pet,sbnd,sbnd->current,nextslen,KEEP))
+ && (dp0 = GetCurrentDst(flo,pet,db0)) &&
+ (dp1 = GetCurrentDst(flo,pet,db1)) &&
+ (dp2 = GetCurrentDst(flo,pet,db2)))
+ do {
+
+ (*action)(src,dp0,dp1,dp2,width,pvt->bitOff,depth0,depth1,depth2,
+ stride);
+
+ pvt->bitOff = pvt->bitOff + sbnd->format->pitch & 7; /* Set next */
+ oldslen = (pvt->bitOff) ? nextslen - 1 : nextslen;
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ src = GetSrcBytes(flo,pet,sbnd,sbnd->current+oldslen,nextslen,KEEP);
+ dp0 = GetNextDst(flo,pet,db0,FLUSH);
+ dp1 = GetNextDst(flo,pet,db1,FLUSH);
+ dp2 = GetNextDst(flo,pet,db2,FLUSH);
+ } while(src && dp0 && dp1 && dp2);
+ } else {
+ CARD32 slen = sbnd->format->pitch+7>>3;
+ if((src = GetSrcBytes(flo,pet,sbnd,sbnd->current,slen,KEEP)) &&
+ (dp0 = GetCurrentDst(flo,pet,db0)) &&
+ (dp1 = GetCurrentDst(flo,pet,db1)) &&
+ (dp2 = GetCurrentDst(flo,pet,db2)))
+ do {
+
+ (*pvt[0].action)(src,dp0,width,&pvt[0]);
+ (*pvt[1].action)(src,dp1,width,&pvt[1]);
+ (*pvt[2].action)(src,dp2,width,&pvt[2]);
+
+ src = GetSrcBytes(flo,pet,sbnd,sbnd->current+slen,slen,KEEP);
+ dp0 = GetNextDst(flo,pet,db0,FLUSH);
+ dp1 = GetNextDst(flo,pet,db1,FLUSH);
+ dp2 = GetNextDst(flo,pet,db2,FLUSH);
+ } while(src && dp0 && dp1 && dp2);
+ }
+ if(!src && sbnd->final && db0->current < db0->format->height) {
+ /*
+ * the client lied about the image size!
+ */
+ if(raw->notify)
+ SendDecodeNotifyEvent(flo, ped, 0, xieValDecodeUncompressedTriple,
+ db0->format->width, db0->current, TRUE);
+ /*
+ * If the client didn't send enough data, we could zero-fill the
+ * remaining lines. Since we sent the "aborted" status, we won't
+ * bother (the protocol offers both choices).
+ */
+ ValueError(flo,ped,db0->format->height, return(FALSE));
+ }
+ if (!src || db0->final && db1->final && db2->final) {
+ /* free whatever we've used so far and
+ * set the threshold to one byte more than whatever is left over
+ */
+ FreeData(flo, pet, sbnd, sbnd->final ? sbnd->maxGlobal : sbnd->current);
+ SetBandThreshold(sbnd, sbnd->available + 1);
+ }
+ return(TRUE);
+} /* end ActivateICPhotoUncomByPixel */
+#endif /* XIE_FULL */
+
+/* end module micphoto.c */
diff --git a/xc/programs/Xserver/XIE/mixie/import/microi.c b/xc/programs/Xserver/XIE/mixie/import/microi.c
new file mode 100644
index 000000000..0f4c45388
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/microi.c
@@ -0,0 +1,386 @@
+/* $TOG: microi.c /main/8 1998/02/09 16:16:40 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module microi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ microi.c -- DDXIE import client roi element
+
+ Dean Verheiden -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/microi.c,v 3.3 1998/10/05 13:22:35 dawes Exp $ */
+
+#define _XIEC_MICROI
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <microi.h>
+#include <texstr.h>
+#include <strip.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeICROI();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateICROI();
+static int InitializeICROI();
+static int ActivateICROI();
+static int ResetICROI();
+static int DestroyICROI();
+
+static void rectCvt();
+
+/*
+ * DDXIE ImportClientROI entry points
+ */
+static ddElemVecRec ICROIVec =
+{
+ CreateICROI,
+ InitializeICROI,
+ ActivateICROI,
+ (xieIntProc)NULL,
+ ResetICROI,
+ DestroyICROI
+};
+
+
+typedef struct _microidef {
+ XieRegionPtr roireg;
+ CARD32 currentRect; /* Current rectangle from input stream */
+} miCROIDefRec, *miCROIDefPtr;
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeICROI(flo,ped)
+floDefPtr flo;
+peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = ICROIVec;
+ return(TRUE);
+} /* end miAnalyzeICROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateICROI(flo,ped)
+floDefPtr flo;
+peDefPtr ped;
+{
+ /* attach an execution context to the roi element definition */
+ return MakePETex(flo,ped,sizeof(miCROIDefRec),NO_SYNC,NO_SYNC);
+} /* end CreateICROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeICROI(flo,ped)
+floDefPtr flo;
+peDefPtr ped;
+{
+ xieFloImportClientROI *raw = (xieFloImportClientROI *)ped->elemRaw;
+ miCROIDefPtr rp = (miCROIDefPtr)ped->peTex->private;
+ XieRegionPtr miXieRegionCreate();
+
+ /* init icroi private data */
+ if (!(rp->roireg = miXieRegionCreate((XieBoxRec *)NULL,
+ (int)raw->rectangles)))
+ AllocError(flo,ped, return(FALSE));
+
+ rp->currentRect = 0;
+ if (raw->rectangles > 1)
+ rp->roireg->data->numRects = raw->rectangles;
+
+ return InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeICROI */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateICROI(flo,ped,pet)
+floDefPtr flo;
+peDefPtr ped;
+peTexPtr pet;
+{
+ miCROIDefPtr rp = (miCROIDefPtr) pet->private;
+ bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ CARD32 maxRect = ((xieFloImportClientROI *)ped->elemRaw)->rectangles;
+ xieTypRectangle *irect = (xieTypRectangle*)GetSrcBytes(flo,pet,sbnd,
+ sbnd->current, sizeof(xieTypRectangle),KEEP);
+ XieBoxRec *rects, *br;
+ CARD32 yxbands, size;
+ ROIPtr roi;
+
+ if(dbnd->final) {
+ /* the client is being over generous, quietly discard the extra data */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+
+ /* Stuff rectangles into XieBoxRec struct
+ */
+ if (irect && maxRect == 1) {
+ rectCvt(irect,&rp->roireg->extents);
+ rp->currentRect++;
+ } else {
+ rects = (XieBoxRec *)&rp->roireg->data[1];
+ br = &rects[rp->currentRect];
+ while (irect && rp->currentRect < maxRect) {
+ rectCvt(irect,br++);
+ rp->currentRect++;
+ irect = (xieTypRectangle*)GetSrcBytes(flo,pet,sbnd,
+ sbnd->current + sizeof(xieTypRectangle),
+ sizeof(xieTypRectangle),KEEP);
+ }
+ }
+
+ /* Ran out of rectangles, see if all have arrived
+ */
+ if(!irect && sbnd->final || rp->currentRect >= maxRect) {
+ if(rp->currentRect < maxRect) {
+ /* the client lied about the number of rectangles! */
+ ValueError(flo,ped,maxRect,return(FALSE));
+ } else { /* All rectangles received, band them */
+ Bool Overlap;
+ if (!miXieRegionValidate(rp->roireg,&Overlap))
+ AllocError(flo,ped,return(FALSE)); /* Best guess */
+ }
+ SetBandThreshold(sbnd,1);
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ } else if (!irect) {
+ /* free whatever we've used so far and
+ * set the threshold to one byte more than whatever is left over
+ */
+ FreeData(flo,pet,sbnd,sbnd->current);
+ SetBandThreshold(sbnd,sbnd->available + 1);
+ return(TRUE);
+ }
+
+ /* At this point, all rectangles are here and everything appears to be OK
+ */
+ if (rp->roireg->data && rp->roireg->data->numRects) {
+ rects = (XieBoxRec *)&rp->roireg->data[1];
+ maxRect = rp->roireg->data->numRects;
+ } else { /* Only one box */
+ rects = &rp->roireg->extents;
+ maxRect = 1;
+ }
+
+ /* Step through rectangles and count up the total number of (y-x) bands
+ */
+ if (maxRect) {
+ CARD32 r = 1;
+ INT32 y = rects[0].y1;
+
+ yxbands = 1;
+ while (1) {
+ while (r < maxRect && y == rects[r].y1) r++;
+ if (r == maxRect) break;
+ y = rects[r].y1;
+ yxbands++;
+ }
+ } else {
+ yxbands = 0;
+ }
+
+ /* Allocate storage for run length table
+ */
+ size = sizeof(ROIRec)+sizeof(lineRec)*yxbands+sizeof(runRec)*maxRect;
+
+ if(!(roi = (ROIRec*)GetDstBytes(flo,pet,dbnd,0,size,FALSE)))
+ AllocError(flo,ped,return(FALSE));
+
+ roi->x = rp->roireg->extents.x1;
+ roi->y = rp->roireg->extents.y1;
+ roi->width = rp->roireg->extents.x2 - roi->x;
+ roi->height = rp->roireg->extents.y2 - roi->y;
+ roi->nrects = maxRect;
+ roi->lend = LEND(dbnd);
+
+ /* Fill in the run lengths
+ */
+ if (maxRect) {
+ CARD32 r = 1;
+ INT32 y = rects[0].y1;
+ linePtr lp = (linePtr)&roi[1];
+ runPtr rp = (runPtr)&lp[1];
+
+ lp->y = rects[0].y1;
+ lp->nline = rects[0].y2 - rects[0].y1;
+ lp->nrun = 1;
+ rp->dstart = rects[0].x1 - roi->x;
+ (rp++)->length = rects[0].x2 - rects[0].x1;
+
+ while (1) {
+ while (r < maxRect && y == rects[r].y1) {
+ rp->dstart = rects[r].x1 - rects[r-1].x2;
+ (rp++)->length = rects[r].x2 - rects[r].x1;
+ lp->nrun++;
+ r++;
+ }
+ if (r == maxRect) break;
+
+ lp = (linePtr)rp;
+ rp = (runPtr)&lp[1];
+ lp->y = rects[r].y1;
+ lp->nline = rects[r].y2 - rects[r].y1;
+ lp->nrun = 1;
+ rp->dstart = (CARD32)rects[r].x1 - (CARD32)roi->x;
+ (rp++)->length = rects[r].x2 - rects[r].x1;
+ y = rects[r++].y1;
+ }
+ }
+
+ SetBandFinal(dbnd);
+ PutData(flo,pet,dbnd,size);
+
+ return (TRUE);
+} /* end ActivateICROI */
+
+/*------------------------------------------------------------------------
+------------------------- rectangle to box converter ---------------------
+------------------------------------------------------------------------*/
+static void rectCvt(irect,br)
+xieTypRectangle *irect;
+XieBoxRec *br;
+{
+ br->x1 = irect->x;
+ br->y1 = irect->y;
+ br->x2 = br->x1 + irect->width;
+ br->y2 = br->y1 + irect->height;
+}
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetICROI(flo,ped)
+floDefPtr flo;
+peDefPtr ped;
+{
+ miCROIDefPtr rp = (miCROIDefPtr)ped->peTex->private;
+
+ if (rp && rp->roireg) {
+ miXieRegionDestroy(rp->roireg);
+ rp->roireg = (XieRegionPtr)NULL;
+ }
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+ return TRUE;
+} /* end ResetICROI */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyICROI(flo,ped)
+floDefPtr flo;
+peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return TRUE;
+} /* end DestroyICROI */
+
+/* end module microi.c */
diff --git a/xc/programs/Xserver/XIE/mixie/import/midraw.c b/xc/programs/Xserver/XIE/mixie/import/midraw.c
new file mode 100644
index 000000000..be34301c4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/midraw.c
@@ -0,0 +1,620 @@
+/* $TOG: midraw.c /main/10 1998/02/09 16:16:46 kaleb $ */
+/**** module midraw.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ midraw.c -- DDXIE prototype import drawable element
+
+ Larry Hare -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/midraw.c,v 3.3 1998/10/05 13:22:35 dawes Exp $ */
+
+#define _XIEC_IDRAW
+#define _XIEC_MIDRAW
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <scrnintstr.h>
+#include <pixmapstr.h>
+#include <regionstr.h>
+#include <gcstruct.h>
+#include <windowstr.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+DrawablePtr ValDrawable();
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeIDraw();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateIDraw();
+static int InitializeIDraw();
+static int ActivateIDrawStrip();
+static int ActivateIDrawAlign();
+static int ActivateIDrawP();
+static int ResetIDraw();
+static int DestroyIDraw();
+
+static void adjustStride4to8();
+static void adjustStride24to32();
+
+static Bool XIEGetImage();
+
+
+/*
+ * DDXIE ImportDrawable && ImportDrawablePlane entry points
+ */
+static ddElemVecRec miDrawVec = {
+ CreateIDraw,
+ InitializeIDraw,
+ ActivateIDrawStrip,
+ (xieIntProc)NULL,
+ ResetIDraw,
+ DestroyIDraw
+ };
+
+static ddElemVecRec miDrawPVec = {
+ CreateIDraw,
+ InitializeIDraw,
+ ActivateIDrawP,
+ (xieIntProc)NULL,
+ ResetIDraw,
+ DestroyIDraw
+ };
+
+typedef struct _midraw {
+ RegionPtr pExposed;
+ RegionRec Exposed;
+ xieVoidProc adjust;
+} miDrawRec, *miDrawPtr;
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeIDraw(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = miDrawVec;
+ return(TRUE);
+} /* end miAnalyzeIDraw */
+
+int miAnalyzeIDrawP(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = miDrawPVec;
+ return(TRUE);
+} /* end miAnalyzeIDrawP */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateIDraw(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, sizeof(miDrawRec), NO_SYNC, NO_SYNC);
+} /* end CreateIDraw */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeIDraw(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ iDrawDefPtr dix = (iDrawDefPtr) ped->elemPvt;
+ miDrawPtr ddx = (miDrawPtr) ped->peTex->private;
+ formatPtr sf = &ped->inFloLst[SRCtag].format[0];
+ formatPtr df = &ped->outFlo.format[0];
+ BOOL notify;
+
+ if(((xieFloImportDrawable*)ped->elemRaw)->elemType==xieElemImportDrawable) {
+ Bool adj_stride = sf->stride != df->stride;
+ Bool adj_pitch = sf->pitch != df->pitch;
+
+ if(adj_stride || adj_pitch) {
+ ped->ddVec.activate = ActivateIDrawAlign;
+
+ if(adj_stride) {
+ if(sf->stride == 24 && df->stride == 32)
+ ddx->adjust = adjustStride24to32;
+
+ else if(sf->stride == 4 && df->stride == 8)
+ ddx->adjust = adjustStride4to8;
+
+ /* add more adjustment routines as required */
+ }
+ } else {
+ ped->ddVec.activate = ActivateIDrawStrip;
+ }
+ notify = ((xieFloImportDrawable*)ped->elemRaw)->notify;
+ } else
+ notify = ((xieFloImportDrawablePlane*)ped->elemRaw)->notify;
+
+ if(notify && dix->pDraw->type != DRAWABLE_PIXMAP) {
+ ddx->pExposed = &ddx->Exposed;
+ (*dix->pDraw->pScreen->RegionInit) (ddx->pExposed, NullBox, 0);
+ }
+ /* note: ImportResource elements don't use their receptors */
+ return InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeIDraw */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateIDrawAlign(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportDrawable *raw = (xieFloImportDrawable *) ped->elemRaw;
+ miDrawPtr ddx = (miDrawPtr) pet->private;
+ bandPtr bnd = &pet->emitter[0];
+ DrawablePtr pDraw = ValDrawable(flo,ped,raw->drawable);
+ char *dst = (char*)GetCurrentDst(flo,pet,bnd);
+ CARD16 width = bnd->format->width;
+
+ if(!pDraw || !dst) return FALSE;
+
+ do {
+ if(!XIEGetImage(pDraw, /* drawable */
+ (CARD16) raw->srcX, /* drawable-x */
+ (CARD16)(raw->srcY+bnd->current), /* drawable-y */
+ (CARD16) width, (CARD16)1, /* width, height */
+ (CARD32)ZPixmap, /* data format */
+ (CARD32)~0, /* plane mask */
+ dst, /* data buffer */
+ raw->fill, /* augment */
+ ddx->pExposed /* accumulate */
+ ))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ if(ddx->adjust)
+ (*ddx->adjust)(dst, width);
+
+ } while(dst = (char*)GetNextDst(flo,pet,bnd,FLUSH));
+
+ return TRUE;
+} /* end ActivateIDrawAlign */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateIDrawStrip(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportDrawable *raw = (xieFloImportDrawable *) ped->elemRaw;
+ miDrawPtr ddx = (miDrawPtr) pet->private;
+ bandPtr bnd = &pet->emitter[0];
+ char *dst;
+ DrawablePtr pDraw;
+
+ if (!(pDraw = ValDrawable(flo,ped,raw->drawable)))
+ return FALSE;
+
+ if (!(dst = (char*)GetCurrentDst(flo,pet,bnd)))
+ return FALSE;
+
+ if(!XIEGetImage( pDraw, /* drawable */
+ (CARD16) raw->srcX, /* drawable-x */
+ (CARD16)(raw->srcY+bnd->minLocal), /* drawable-y */
+ (CARD16)(bnd->format->width), /* width */
+ (CARD16)(bnd->strip->length), /* height */
+ (CARD32)ZPixmap, /* data format */
+ (CARD32)~0, /* plane mask */
+ dst, /* data buffer */
+ raw->fill, /* augment */
+ ddx->pExposed /* accumulate */
+ ))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+ PutData(flo,pet,bnd,bnd->maxLocal);
+
+ return TRUE;
+} /* end ActivateIDrawStrip */
+
+static int ActivateIDrawP(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportDrawablePlane *raw = (xieFloImportDrawablePlane *) ped->elemRaw;
+ miDrawPtr ddx = (miDrawPtr) pet->private;
+ bandPtr bnd = &pet->emitter[0];
+ char *dst;
+ DrawablePtr pDraw;
+
+ if (!(pDraw = ValDrawable(flo,ped,raw->drawable)))
+ return FALSE;
+
+ if(!(dst = (char*)GetCurrentDst(flo,pet,bnd)))
+ return FALSE;
+
+ if(!XIEGetImage( pDraw, /* drawable */
+ (CARD16)(raw->srcX), /* drawable-x */
+ (CARD16)(raw->srcY+bnd->minLocal), /* drawable-y */
+ (CARD16)(bnd->format->width), /* width */
+ (CARD16)(bnd->strip->length), /* height */
+ (CARD32)XYPixmap, /* data format */
+ raw->bitPlane, /* plane mask */
+ dst, /* data buffer */
+ raw->fill, /* augment */
+ ddx->pExposed /* accumulate */
+ ))
+ DrawableError(flo,ped,raw->drawable, return(FALSE));
+
+#if (BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER)
+ {
+ int nb = bnd->pitch * bnd->strip->length;
+ while (nb--) *dst++ = (char)_ByteReverseTable[*dst];
+ }
+#endif
+
+ PutData(flo,pet,bnd,bnd->maxLocal);
+
+ return TRUE;
+} /* end ActivateIDrawP */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static void FlushExposeEvents(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloImportDrawablePlane *raw = (xieFloImportDrawablePlane *) ped->elemRaw;
+ miDrawPtr pvt = (miDrawPtr) ped->peTex->private;
+
+ if (pvt->pExposed) {
+ RegionPtr rp = pvt->pExposed;
+ DrawablePtr pDraw = ValDrawable(flo,ped,raw->drawable);
+ int numrects = REGION_NUM_RECTS(rp);
+
+ if (pDraw) {
+ if (numrects > 0 && !ferrCode(flo) && !flo->flags.aborted) {
+ BoxPtr rects = REGION_RECTS(rp);
+
+ /* if numrects is large, send 1 event for extents ?? */
+ for ( ; numrects > 0; numrects--, rects++) {
+ SendImportObscuredEvent(flo,ped,raw->drawable,
+ rects->x1,
+ rects->y1,
+ rects->x2 - rects->x1,
+ rects->y2 - rects->y1);
+ }
+ }
+ (*pDraw->pScreen->RegionUninit) (rp);
+ } /* else Memory Leak */
+ pvt->pExposed = NullRegion;
+ }
+} /* end FlushExposeEvents */
+
+
+static int ResetIDraw(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ FlushExposeEvents(flo,ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetIDraw */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyIDraw(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyIDraw */
+
+/*------------------------------------------------------------------------
+--- similar to GetGCAndDrawableAndValidate (from extension.h) ---
+--- made callable because the macro version returned standard X errors ---
+------------------------------------------------------------------------*/
+DrawablePtr ValDrawable(flo,ped,draw_id)
+ floDefPtr flo;
+ peDefPtr ped;
+ Drawable draw_id;
+{
+ register ClientPtr client = flo->runClient;
+ register DrawablePtr draw;
+
+ if (client->clientGone) return(NULL);
+
+ if (client->lastDrawableID != draw_id) {
+ draw = (DrawablePtr)LookupIDByClass(draw_id, RC_DRAWABLE);
+ if (draw->type == UNDRAWABLE_WINDOW)
+ MatchError(flo,ped, return(NULL));
+
+ client->lastDrawable = draw;
+ client->lastDrawableID = draw_id;
+ } else {
+ draw = client->lastDrawable;
+ }
+ if(!draw) {
+ client->errorValue = draw_id;
+ DrawableError(flo,ped,draw_id, return(NULL));
+ }
+ return draw;
+} /* end ValDrawable */
+
+
+/*
+** In order to support 'fill' and 'expose events' we must layer some
+** code on top of the normal screen GetImage procedure. Use the defined
+** backing store interface that aid's in copy expose processing, to try
+** to knowingly recover backing store. Keep track of remaining regions
+** which were not visible or in backing store. Always fill such leftover
+** regions, and queue them up for later expose event processing.
+*/
+
+static Bool
+XIEGetImage (pDrawable, sx, sy, w, h, format, pmask, pdst, fill, Exposed)
+ DrawablePtr pDrawable;
+ CARD16 sx, sy, w, h;
+ CARD32 format;
+ CARD32 pmask;
+ char *pdst;
+ CARD32 fill;
+ RegionPtr Exposed;
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ BoxRec bounds;
+ unsigned char depth;
+
+ if(pDrawable->type != DRAWABLE_PIXMAP && (sx + w > pDrawable->width ||
+ sy + h > pDrawable->height))
+ return(FALSE);
+
+ if(pDrawable->type != DRAWABLE_PIXMAP &&
+ ((WindowPtr)pDrawable)->visibility != VisibilityUnobscured) {
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+ WindowPtr pWin, pSrcWin;
+ RegionRec Remaining;
+ BoxPtr pBox;
+ int i;
+ int x, y;
+ xRectangle *pRect;
+ int numRects;
+
+ pWin = (WindowPtr) pDrawable;
+ pPixmap = 0;
+ depth = pDrawable->depth;
+ bounds.x1 = sx + pDrawable->x;
+ bounds.y1 = sy + pDrawable->y;
+ bounds.x2 = bounds.x1 + w;
+ bounds.y2 = bounds.y1 + h;
+ (*pScreen->RegionInit) (&Remaining, &bounds, 0);
+ if (!(pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth)))
+ goto punt;
+ if(!(pGC = GetScratchGC (depth, pScreen))) {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ goto punt;
+ }
+ if (pWin->viewable &&
+ (*pScreen->RectIn) (&Remaining, (*pScreen->RegionExtents)
+ (&pWin->borderSize)) != rgnOUT) {
+ XID subWindowMode = IncludeInferiors;
+ ChangeGC (pGC, GCSubwindowMode, &subWindowMode);
+ ValidateGC ((DrawablePtr)pPixmap, pGC);
+ pSrcWin = (WindowPtr) pDrawable;
+ x = sx;
+ y = sy;
+ if (pSrcWin->parent) {
+ x += pSrcWin->origin.x;
+ y += pSrcWin->origin.y;
+ pSrcWin = pSrcWin->parent;
+ }
+ (*pGC->ops->CopyArea) ((DrawablePtr)pSrcWin,
+ (DrawablePtr)pPixmap, pGC,
+ x, y, w, h,
+ 0, 0);
+ (*pScreen->Subtract) (&Remaining, &Remaining,
+ &((WindowPtr) pDrawable)->borderClip);
+ if (REGION_NUM_RECTS(&Remaining) == 0) goto done;
+ }
+ (*pScreen->TranslateRegion) (&Remaining, -pWin->drawable.x,
+ -pWin->drawable.y);
+
+ /* Copy in Backstore now */
+ if (pWin->backStorage) {
+ (*pWin->drawable.pScreen->ExposeCopy) (pWin,
+ (DrawablePtr)pPixmap,
+ pGC, &Remaining,
+ sx, sy,
+ 0, 0,
+ 0);
+
+ }
+
+ /* Fill in Remaining Area now */
+ ChangeGC (pGC, GCForeground, &fill);
+ ValidateGC ((DrawablePtr)pPixmap, pGC);
+ numRects = REGION_NUM_RECTS(&Remaining);
+ pBox = REGION_RECTS(&Remaining);
+ pRect = (xRectangle *)ALLOCATE_LOCAL(numRects * sizeof(xRectangle));
+ if (pRect) {
+ for (i = numRects; --i >= 0; pBox++, pRect++) {
+ pRect->x = pBox->x1 - sx;
+ pRect->y = pBox->y1 - sy;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ }
+ pRect -= numRects;
+ (*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC,
+ numRects, pRect);
+ DEALLOCATE_LOCAL (pRect);
+ }
+
+ /* Accumulate Exposures if requested */
+ if (REGION_NUM_RECTS(&Remaining) > 0) {
+ if (Exposed) {
+ (*pScreen->Union) (Exposed, Exposed, &Remaining);
+ }
+ }
+
+done:
+ (*pScreen->RegionUninit) (&Remaining);
+ (*pScreen->GetImage) ((DrawablePtr) pPixmap, 0, 0, w, h,
+ format, pmask, pdst);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ FreeScratchGC (pGC);
+ }
+ else
+ {
+punt: ;
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
+ format, pmask, pdst);
+ }
+ return(TRUE);
+}
+
+static void adjustStride24to32(buf,width)
+ char *buf;
+ CARD32 width;
+{
+ register BytePixel *ip = (BytePixel*)(&buf[3 * width]);
+ register QuadPixel *op = (QuadPixel*)(&buf[4 * width]);
+ int i;
+
+ for(i = width; i; --i)
+#if (IMAGE_BYTE_ORDER == LSBFirst && IMAGE_BYTE_ORDER == BITMAP_BIT_ORDER || IMAGE_BYTE_ORDER == MSBFirst && IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER)
+ { ip -= 3; *(--op) = (int)ip[2]<<16 | (int)ip[1]<<8 | (int)ip[0]; }
+#else
+ { ip -= 3; *(--op) = (int)ip[0]<<16 | (int)ip[1]<<8 | (int)ip[2]; }
+#endif
+}
+
+static void adjustStride4to8(buf,width)
+ char *buf;
+ CARD32 width;
+{
+ register BytePixel *ip = (BytePixel*)(&buf[1 * width]);
+ register BytePixel *op = (BytePixel*)(&buf[2 * width]);
+ int i;
+
+ for(i = width; i; --i)
+#if (IMAGE_BYTE_ORDER == LSBFirst && IMAGE_BYTE_ORDER == BITMAP_BIT_ORDER || IMAGE_BYTE_ORDER == MSBFirst && IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER)
+ { *(--op) = *(--ip) & (BytePixel)0x0f; *(--op) = *ip >> 4; }
+#else
+ { *(--op) = *(--ip) >> 4; *(--op) = *ip & (BytePixel)0x0f; }
+#endif
+}
+
+
+/* end module midraw.c */
diff --git a/xc/programs/Xserver/XIE/mixie/import/mifax.c b/xc/programs/Xserver/XIE/mixie/import/mifax.c
new file mode 100644
index 000000000..ca679701d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/mifax.c
@@ -0,0 +1,577 @@
+/* $TOG: mifax.c /main/10 1998/02/09 16:16:51 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mifax.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mifax.c -- DDXIE prototype import client photo and
+ import photomap element, portions specific
+ to FAX decompression
+
+ Ben Fahy -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/mifax.c,v 3.3 1998/10/05 13:22:35 dawes Exp $ */
+
+#define _XIEC_MICPHOTO
+#define _XIEC_ICPHOTO
+#define _XIEC_MIPHOTO
+#define _XIEC_IPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+#include <fax.h>
+/* XXX - this should be cleaned up. */
+#include "../fax/faxint.h"
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int CreateICPhotoFax();
+int InitializeICPhotoFax();
+int InitializeIPhotoFax();
+int ActivateICPhotoFax();
+int ResetICPhotoFax();
+int DestroyICPhotoFax();
+
+
+extern bandMsk miImportStream();
+
+/*
+ * Local Declarations
+ */
+
+static int common_init();
+
+
+#define LENIENCY_LIMIT 16
+
+#define MAX_STRIPS_INC 20
+typedef struct _faxpvt {
+ FaxState state;
+ int width,height; /* not strictly necessary, but handy */
+ int max_strips; /* how many we've allocated space for */
+ int n_strips; /* how many strips we've seen so far */
+ int next_byte; /* next input byte we are looking for */
+ int max_lines; /* maximum number of lines/output strip */
+ char **o_lines; /* array of pointers to output lines */
+ int (*decodptr)(); /* function used to decode the data */
+ xieTypOrientation encodedOrder;
+ int notify; /* (ICP) we might have to send an event */
+ int normal; /* if not, swap the output bit order */
+ photomapPtr map; /* (IP) just in case we need it */
+ unsigned char *buf; /* in case we have to bit reverse src */
+ int bufsize; /* buffer size has to vary with input */
+ /* strip size, alas and alak. :-( */
+ xieTypDecodeTechnique technique;
+} faxPvtRec, *faxPvtPtr;
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+int CreateICPhotoFax(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo,ped, sizeof(faxPvtRec), NO_SYNC, NO_SYNC);
+} /* end CreateICPhotoFax */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeIPhotoFax(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+peTexPtr pet = ped->peTex;
+faxPvtPtr texpvt=(faxPvtPtr) pet->private;
+bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+
+ if (!common_init(flo,ped,(pointer)map->tecParms,map->technique))
+ return(0);
+
+ texpvt->map = map; /* can be used as flag in Activate routine */
+
+ return(
+ ImportStrips(flo,pet,&pet->receptor[0].band[0],&map->strips[0])
+ );
+} /* end InitializeIPhotoFax */
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeICPhotoFax(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *) ped->elemRaw;
+peTexPtr pet = ped->peTex;
+faxPvtPtr texpvt = (faxPvtPtr) pet->private;
+
+ if( !common_init(flo,ped,(pointer) &raw[1],raw->decodeTechnique) )
+ return(0);
+
+ texpvt->notify = raw->notify;
+ return(1);
+} /* end InitializeICPhotoFax */
+/*------------------------------------------------------------------------
+------- lots of stuff shared between ICPhoto and IPhoto. . . -------------
+------------------------------------------------------------------------*/
+static int common_init(flo,ped,tec,technique)
+floDefPtr flo;
+peDefPtr ped;
+pointer tec; /* we won't know the type until later */
+xieTypDecodeTechnique technique;
+ /* (but we can get it from this :-) */
+{
+peTexPtr pet = ped->peTex;
+faxPvtPtr texpvt = (faxPvtPtr) pet->private;
+formatPtr inf = pet->receptor[IMPORT].band[0].format;
+int pbytes;
+
+/* Start over with clean structure */
+ bzero(texpvt,sizeof(faxPvtRec));
+
+
+/* Now start adding what we know */
+ texpvt->width = inf->width;
+ texpvt->height = inf->height;
+ texpvt->state.width = inf->width;
+ /* nice thing about using receptor format is that it doesn't matter */
+ /* whether you are importing from a client or a photomap */
+
+ switch(texpvt->technique = technique) {
+ case xieValDecodeG31D:
+ {
+ xieTecDecodeG31D *tecG31D=(xieTecDecodeG31D *) tec;
+ texpvt->decodptr = decode_g31d;
+ texpvt->encodedOrder = tecG31D->encodedOrder;
+ texpvt->state.goal = FAX_GOAL_SkipPastAnyToEOL;
+ texpvt->state.radiometric = tecG31D->radiometric;
+ texpvt->normal = tecG31D->normal;
+ }
+ break;
+ case xieValDecodeG32D:
+ {
+ xieTecDecodeG32D *tecG32D=(xieTecDecodeG32D *) tec;
+ texpvt->decodptr = decode_g32d;
+ texpvt->encodedOrder = tecG32D->encodedOrder;
+ texpvt->state.goal = FAX_GOAL_SeekEOLandTag;
+ texpvt->state.radiometric = tecG32D->radiometric;
+ texpvt->normal = tecG32D->normal;
+ }
+ break;
+ case xieValDecodeG42D:
+ {
+ xieTecDecodeG42D *tecG42D=(xieTecDecodeG42D *) tec;
+ texpvt->decodptr = decode_g4;
+ texpvt->encodedOrder = tecG42D->encodedOrder;
+ texpvt->state.goal = FAX_GOAL_StartNewLine;
+ texpvt->state.radiometric = tecG42D->radiometric;
+ texpvt->normal = tecG42D->normal;
+ }
+ break;
+ case xieValDecodeTIFF2:
+ {
+ xieTecDecodeTIFF2 *tecTIFF2=(xieTecDecodeTIFF2 *) tec;
+ texpvt->decodptr = decode_tiff2;
+ texpvt->encodedOrder = tecTIFF2->encodedOrder;
+ texpvt->state.goal = FAX_GOAL_StartNewLine;
+ texpvt->state.radiometric = tecTIFF2->radiometric;
+ texpvt->normal = tecTIFF2->normal;
+ }
+ break;
+ case xieValDecodeTIFFPackBits:
+ {
+ xieTecDecodeTIFFPackBits *tecTIFFPackBits=
+ (xieTecDecodeTIFFPackBits *)tec;
+ texpvt->decodptr = decode_tiffpb;
+ texpvt->encodedOrder = tecTIFFPackBits->encodedOrder;
+ texpvt->state.goal = PB_GOAL_StartNewLine;
+ texpvt->normal = tecTIFFPackBits->normal;
+ }
+ break;
+ }
+ texpvt->state.a0_color = WHITE;
+ texpvt->state.a0_pos = (-1);
+
+/* things that are zero don't really need to be initialized - consider
+ * these comments.
+ */
+ texpvt->state.magic_needs = 0;
+ texpvt->state.strip_state = StripStateNone;
+ texpvt->state.strip = 0;
+ texpvt->state.strip_size = 0;
+ texpvt->state.final = 0;
+ texpvt->state.o_line = 0;
+
+/*
+ * Things that do need to be initialized
+ */
+ texpvt->state.write_data = 1;
+ texpvt->max_strips = MAX_STRIPS_INC;
+
+
+/* the following must be freed explicitly */
+
+ texpvt->state.old_trans = (int *) XieMalloc(texpvt->width * sizeof(int));
+ if (!texpvt->state.old_trans) AllocError(flo,ped, return(FALSE));
+
+ texpvt->state.new_trans = (int *) XieMalloc(texpvt->width * sizeof(int));
+ if (!texpvt->state.new_trans) AllocError(flo,ped, return(FALSE));
+
+/*
+ * I suppose this will make Bob mad at me, but... how else do I
+ * figure out the output map size?
+ */
+
+ pbytes = (ped->outFlo.format[0].pitch + 7) >> 3;
+
+ texpvt->max_lines = flo->floTex->stripSize / pbytes;
+
+ if (!texpvt->max_lines)
+ texpvt->max_lines++;
+
+/* see if data manager should forward our input data to downstream elements */
+ pet->receptor[IMPORT].forward = miImportStream(flo,ped);
+
+/* set output emitter to map texpvt->max_lines lines of data */
+ return( InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, texpvt->max_lines, NO_INPLACE) );
+
+} /* end common_init() */
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+int ActivateICPhotoFax(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ faxPvtPtr texpvt = (faxPvtPtr) ped->peTex->private;
+ FaxState *state = &(texpvt->state);
+ BytePixel *src, *dst;
+ int lines_found;
+ Bool ok, aborted;
+ int (*decodptr)() = texpvt->decodptr;
+
+
+/*
+ * get current input and output strips
+ */
+ if (dbnd->final && dbnd->current >= dbnd->format->height) {
+ /* be forgiving if extra data gets passed to us */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+
+ /*
+ * Important! As long as there is source data available, we'd better
+ * deal with it, because it may be owned by Core X and will die if we
+ * let the scheduler go away. It's ok to exit with TRUE to let an
+ * output strip be written (we'll be called back). It is death to
+ * exit with FALSE unless we are absolutely sure we are done with all
+ * current input strips.
+ */
+
+ /*
+ * Note that state->strip holds the current src strip. We only get
+ * more bytes when we are done with a strip and need another one
+ * (or if we are just starting)
+ */
+ if (!state->strip) {
+ src = (BytePixel*)GetSrcBytes(flo,pet,sbnd,sbnd->current,1,KEEP);
+
+ state->strip_state = StripStateNew;
+ state->strip_size = sbnd->maxLocal - sbnd->minLocal;
+ state->final = sbnd->strip ? sbnd->strip->final : sbnd->final;
+
+ if (texpvt->encodedOrder == xieValMSFirst)
+ state->strip = src;
+ else {
+ /* to avoid rewriting a zillion macros, we arbitrarily pick MSFirst
+ as the encode/decode format. Byte Reversal of the small amount
+ of compressed data is almost always going to take trivial time.
+ The only nasty part is, the input strip cannot be corrupted so
+ we have to copy to a buffer, whose size may be variable since
+ this is stream data (not canonical).
+ */
+ register int i,size=state->strip_size;
+ register unsigned char *flipped;
+
+ if ( AlterSrc(flo,ped,sbnd->strip) )
+ flipped = src;
+ else {
+ /* make sure buffer is big enough to hold data */
+ if (!texpvt->buf) {
+ texpvt->buf = (unsigned char *) XieMalloc(size);
+ if (!texpvt->buf)
+ AllocError(flo,ped, return(FALSE));
+ }
+ else if (texpvt->bufsize < size) {
+ texpvt->buf = (unsigned char *) XieRealloc(texpvt->buf,size);
+ if (!texpvt->buf)
+ AllocError(flo,ped, return(FALSE));
+ }
+ texpvt->bufsize = size;
+ flipped = texpvt->buf;
+ }
+
+ for (i=0; i<size; ++i)
+ flipped[i] = _ByteReverseTable[*src++];
+
+ state->strip = flipped;
+ }
+ }
+ /*
+ * We have some data to decode, anything to write to?
+ */
+ while (dst = (BytePixel*)GetDst(flo,pet,dbnd,state->o_line,KEEP)) {
+
+
+ /*
+ * Now, as much as I'd like to use our nifty line-oriented macros,
+ * it would kill performance. So instead we ask the decoder to
+ * decode as much as remains in the output line as it can get.
+ * We ask the data manager to map all the lines of data in the
+ * current output strip to a convenient array.
+ */
+
+ state->nl_sought = dbnd->maxLocal - state->o_line;
+
+ ok = MapData(flo,pet,dbnd,0,dbnd->current,state->nl_sought,KEEP);
+ /* map desired lines into an array starting at 0 */
+ if (!ok)
+ ImplementationError(flo,ped, return(FALSE));
+
+ state->o_lines = (char **) dbnd->dataMap;
+
+ lines_found = (*decodptr)(state);
+ if (lines_found < 0) {
+ /* decoder hit unknown error. Pass error code to client */
+ ValueError(flo,ped,(state->o_line + (state->decoder_done << 16)),
+ return(FALSE));
+ } else {
+ if (!texpvt->normal) {
+ /* have to swap bit order on output */
+ int pbytes = (ped->outFlo.format[0].pitch + 7) >> 3;
+ register int i;
+ for (i=0; i<lines_found; ++i) {
+ register CARD8 *ucp = dbnd->dataMap[i];
+ register int size=pbytes;
+ while (size--)
+ {
+ *ucp = _ByteReverseTable[*ucp];
+ ucp++;
+ }
+ }
+ }
+ state->o_line += lines_found;
+ if (PutData(flo,pet,dbnd,state->o_line))
+ return(TRUE);
+ }
+ if (state->decoder_done) {
+ /* Decoders sometimes return errors near the end of an image.
+ Don't report an error if we got almost all the lines we wanted.
+ */
+ if (state->decoder_done > FAX_DECODE_DONE_OK) {
+ aborted = state->o_line + LENIENCY_LIMIT < texpvt->height;
+
+ if(texpvt->notify && (texpvt->height != state->o_line ||
+ texpvt->width != state->width)) {
+ SendDecodeNotifyEvent(flo, ped, 0, texpvt->technique,
+ state->width, state->o_line, aborted);
+ }
+ if (aborted) {
+ ValueError(flo, ped, (state->o_line + (state->decoder_done<<16)),
+ return(FALSE));
+ } else if(state->o_line < texpvt->height) {
+ int bytes = (ped->outFlo.format[0].pitch + 7) >> 3;
+
+ while(dst = ((BytePixel*)
+ GetDst(flo,pet,dbnd,state->o_line++,KEEP))) {
+ memset(dst, state->radiometric ? 0xff: 0, bytes);
+ PutData(flo,pet,dbnd,state->o_line);
+ }
+ break;
+ }
+ }
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ break;
+ }
+
+ if (state->magic_needs) {
+ /* decoder needs a new strip */
+ if (state->strip_state != StripStateDone) {
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+
+ texpvt->state.strip_state = StripStateNone;
+ texpvt->state.strip = 0;
+ texpvt->state.strip_size = 0;
+
+ if (!state->final)
+ break;
+ else
+ state->strip_state = StripStateNoMore;
+ /* need to live with what you've got */
+ }
+ } /* end of while(dst = ...) */
+ /*
+ * No more dst or need another src strip? three possible reasons:
+ *
+ * 1: we're done with output image. Just shut down and be happy
+ * 2: scheduler has noticed a downstream element can run. In this
+ * case, we should be a good guy and return TRUE so the scheduler
+ * gives us back control again later (without going back to Core
+ * X, which would cause our input strip to vanish).
+ * 3: we ran out of src.
+ */
+ if (!dst && dbnd->final) {
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ }
+ SetBandThreshold(sbnd, !dst ? 1 : sbnd->available + 1);
+
+ /*
+ * if here, we ran out of src. Scheduler will wake us up again
+ * when a PutClientData request comes along.
+ */
+ return TRUE;
+} /* end ActivateICPhotoFax */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+int ResetICPhotoFax(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ /* get rid of the peTex structures malloc'd by Initialize */
+ if(ped->peTex) {
+ faxPvtPtr texpvt = (faxPvtPtr) ped->peTex->private;
+
+ /* only have to nuke parts of private structure which were malloc'd */
+ if (texpvt->state.old_trans)
+ texpvt->state.old_trans = (int *)XieFree(texpvt->state.old_trans);
+ if (texpvt->state.new_trans)
+ texpvt->state.new_trans = (int *)XieFree(texpvt->state.new_trans);
+ if (texpvt->buf)
+ texpvt->buf = (unsigned char *)XieFree(texpvt->buf);
+ }
+ return(TRUE);
+} /* end ResetICPhotoFax */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+int DestroyICPhotoFax(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex) {
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+ }
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.flush = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyICPhoto */
+
+/* end module mifax.c */
diff --git a/xc/programs/Xserver/XIE/mixie/import/mijpeg.c b/xc/programs/Xserver/XIE/mixie/import/mijpeg.c
new file mode 100644
index 000000000..eeb917a03
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/mijpeg.c
@@ -0,0 +1,622 @@
+/* $TOG: mijpeg.c /main/5 1998/02/09 16:16:55 kaleb $ */
+/**** module mijpeg.c ****/
+/******************************************************************************
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mijpeg.c -- DDXIE import photomap element, portions
+ specific to JPEG decompression
+
+ Ben Fahy -- AGE Logic, Inc. Oct, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/mijpeg.c,v 3.5 1999/01/31 12:21:36 dawes Exp $ */
+
+#define _XIEC_MIPHOTO
+#define _XIEC_IPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+
+#ifndef XIE
+#define XIE
+#endif
+
+#include <error.h>
+#include <macro.h>
+#include <jpeg.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int CreateIPhotoJpegBase();
+int InitializeIPhotoJpegBase();
+int InitializeICPhotoJpegBase();
+int ActivateIPhotoJpegBase();
+int ResetIPhotoJpegBase();
+int DestroyIPhotoJpegBase();
+
+
+extern bandMsk miImportStream();
+
+/*
+ * Local Declarations
+ */
+
+static int common_init();
+static int sub_fun();
+typedef struct _jpeg_decode_pvt {
+
+ int (*decodptr)(); /* function used to decode the data */
+ int format_checked; /* have to wait until JPEG header read */
+
+ xieTypDataClass dataClass; /* SingleBand or TripleBand */
+ int colors_smushed; /* if color and interleave = False */
+ int in_bands; /* bands of input (from photomap) data */
+ int out_bands; /* bands of output data */
+ int swizzle; /* true if bandOrder is MSFirst */
+ int notify; /* in case the client wants an event */
+ photomapPtr map; /* for ImportPhotomap only */
+
+ xieTecDecodeJPEGBaseline *decodeParams; /* decoding parameters */
+
+ /* the following are used by JPEG private routines */
+ struct Decompress_methods_struct dc_methods;
+ struct External_methods_struct e_methods;
+
+ /* we potentially need one of the following per band */
+ JpegDecodeState state[3];
+ struct Decompress_info_struct cinfo[3];
+ char ibuffer[3][JPEG_BUF_SIZE + MIN_UNGET];
+
+} jpegPvtRec, *jpegPvtPtr;
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+int CreateIPhotoJpegBase(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo,ped, sizeof(jpegPvtRec), NO_SYNC, NO_SYNC);
+} /* end CreateIPhotoJpegBase */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeIPhotoJpegBase(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+ xieTecDecodeJPEGBaseline *tec = (xieTecDecodeJPEGBaseline *) map->tecParms;
+ xieFloImportPhotomap *raw = (xieFloImportPhotomap *)ped->elemRaw;
+ int in_bands = ped->inFloLst[SRCtag].bands; /* # of input bands */
+ peTexPtr pet = ped->peTex;
+ jpegPvtPtr texpvt = (jpegPvtPtr) pet->private;
+ bandPtr bnd = pet->receptor[IMPORT].band;
+
+ if(!common_init(flo,ped,map->dataClass,tec,raw->notify))
+ return(FALSE);
+
+ texpvt->map = map;
+ /* has to come after common_init, which bzeros texpvt */
+
+ return(ImportStrips(flo, pet, &bnd[0], &map->strips[0]) &&
+ (in_bands == 1 ? TRUE :
+ ImportStrips(flo, pet, &bnd[1], &map->strips[1]) &&
+ ImportStrips(flo, pet, &bnd[2], &map->strips[2])));
+} /* end InitializeIPhotoJpegBase */
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+int InitializeICPhotoJpegBase(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+xieFloImportClientPhoto *raw = (xieFloImportClientPhoto *)ped->elemRaw;
+xieTecDecodeJPEGBaseline *tec= (xieTecDecodeJPEGBaseline*)&raw[1];
+
+ return (common_init(flo,ped,raw->class,tec,raw->notify) );
+
+} /* end InitializeICPhotoJpegBase */
+/*------------------------------------------------------------------------
+----------------------- shared initialization code ----------------------
+------------------------------------------------------------------------*/
+static int common_init(flo,ped,class,tec,notify)
+ floDefPtr flo;
+ peDefPtr ped;
+ xieTypDataClass class;
+ xieTecDecodeJPEGBaseline *tec;
+ int notify;
+{
+ peTexPtr pet = ped->peTex;
+ jpegPvtPtr texpvt = (jpegPvtPtr) pet->private;
+ int pbytes;
+ int out_bands = ped->outFlo.bands; /* # of output bands */
+ int in_bands = ped->inFloLst[SRCtag].bands; /* # of input bands */
+ int lines_in_output_strip; /* max number of lines/output strip*/
+ int b;
+
+ /*** every time we rerun the element, have to reset it ***/
+
+ bzero(texpvt,sizeof(jpegPvtRec));
+ /* this does 99% of what we want */
+
+ /*** do generic stuff first ***/
+ texpvt->in_bands = in_bands;
+ texpvt->out_bands = out_bands;
+ texpvt->dataClass = class;
+ texpvt->decodeParams = tec;
+ texpvt->notify = notify;
+
+ if(in_bands != out_bands) { /* ie, if photo has 1 band, output 3 */
+ texpvt->colors_smushed = 1;
+ texpvt->decodptr = decode_jpeg_lossy_color;
+ } else { /* SingleBand or TripleBand-BandByPlane */
+ texpvt->colors_smushed = 0;
+ texpvt->decodptr = decode_jpeg_lossy_gray;
+ }
+ texpvt->swizzle = tec->bandOrder == xieValMSFirst;
+
+ /* Now for every input (photomap) band, we need to set up state stuff */
+ for (b=0; b < in_bands; ++b) {
+ JpegDecodeState *state = &(texpvt->state[b]);
+
+ state->goal = JPEG_DECODE_GOAL_Startup;
+ state->up_sample = tec->upSample;
+ state->dc_methods = &texpvt->dc_methods;
+ state->e_methods = &texpvt->e_methods;
+ state->cinfo = &texpvt->cinfo[b];
+ state->needs_input_strip = 1;
+ state->cinfo->input_buffer = texpvt->ibuffer[b];
+ }
+
+ /*** Note: the JPEG code allocates an additional buffer after the
+ header data is read. The size of the buffer depends on
+ the image dimenstions, so this needs to be deallocated
+ in the Reset entry point. The rest of the above is of
+ fixed size, and will disappear automatically at Destroy
+ ***/
+
+ /* Calculate how many lines fit in an output strip
+ */
+ pbytes = (ped->outFlo.format[0].pitch + 7) >> 3;
+ lines_in_output_strip = flo->floTex->stripSize / pbytes;
+
+ if (!lines_in_output_strip)
+ lines_in_output_strip++;
+
+ /* see if data manager should forward our input data to downstream elements
+ */
+ pet->receptor[IMPORT].forward = miImportStream(flo,ped);
+
+ /* set output emitter to allocate a map big enough to hold whole strip
+ */
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, lines_in_output_strip, NO_INPLACE));
+
+} /* end InitializeIPhotoJpegBase */
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+int ActivateIPhotoJpegBase(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ jpegPvtPtr texpvt = (jpegPvtPtr) ped->peTex->private;
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+ bandPtr dbnd = &pet->emitter[0];
+ bandPtr dbnd1 = &pet->emitter[1];
+ bandPtr dbnd2 = &pet->emitter[2];
+ int b;
+
+ /* dbnd and dst are used to deal with non-interleaved color data */
+ /* if the class of the src is SingleBand, we call sub_fun for band 0 */
+ /* if the class of the src is TripleBand and the interleave is */
+ /* BandByPlane, we call sub_fun 3 times, once for each band */
+ /* if the class of the src is TripleBand, interleave BandByPixel, we */
+ /* call subfun once: it will produce all three dst bands */
+
+ if (texpvt->dataClass == xieValSingleBand) {
+ JpegDecodeState *state = &(texpvt->state[0]);
+ return( sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,NULL,NULL) );
+ }
+
+ /* TripleBand */
+ if (texpvt->colors_smushed) { /* BandByPixel */
+ JpegDecodeState *state = &(texpvt->state[0]);
+ if(texpvt->swizzle)
+ return( sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd2,dbnd1,dbnd) );
+ else
+ return( sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,dbnd1,dbnd2) );
+ }
+
+ /* TripleBand, BandByPlane */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ JpegDecodeState *state = &(texpvt->state[b]);
+ sbnd = &rcp->band[b]; /* do each band independently */
+ dbnd = &pet->emitter[texpvt->swizzle ? xieValMaxBands - b - 1 : b];
+ if ( sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,NULL,NULL)==FALSE)
+ return(FALSE);
+ }
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+-------------------- *really* crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int sub_fun(flo,ped,pet,texpvt,state,sbnd,dbnd,dbnd1,dbnd2)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+ jpegPvtPtr texpvt;
+ JpegDecodeState *state;
+ bandPtr sbnd,dbnd,dbnd1,dbnd2;
+{
+BytePixel *src, *dst,*dst1,*dst2;
+int (*decodptr)() = texpvt->decodptr;
+
+/*
+ * get current input and output strips
+ */
+ if (dbnd->final && dbnd->current >= dbnd->format->height) {
+ /* be forgiving if extra data gets passed to us */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return(TRUE);
+ }
+
+ src=(BytePixel*)GetSrcBytes(flo,pet,sbnd,sbnd->current,sbnd->available,KEEP);
+
+ if ( state->needs_input_strip ) {
+ /* NOTE: state->needs_input_strip is ONLY set after checking */
+ /* to ensure that state->final != 1. In other words, we only */
+ /* arrive here when we are sure there will be source data */
+
+ /* we left because we needed more input. The other case */
+ /* would be if we left to allow downstream elements to run */
+
+ state->strip = src;
+ state->sptr = src;
+ state->strip_size = sbnd->maxLocal - sbnd->minLocal;
+
+ state->i_strip++; /* just for debugging */
+
+ state->final = sbnd->strip ? sbnd->strip->final : sbnd->final;
+ state->needs_input_strip = 0;
+ }
+
+ /*
+ * We have some data to decode, anything to write to?
+ */
+
+ while (dst = (BytePixel*)GetDst(flo,pet,dbnd,state->o_line,FLUSH)) {
+
+ /* if tripleband interleaved data, make sure other bands cool */
+ if (dbnd1)
+ if (!(dst1=(BytePixel*)GetDst(flo,pet,dbnd1,state->o_line,FLUSH)) ||
+ !(dst2=(BytePixel*)GetDst(flo,pet,dbnd2,state->o_line,FLUSH)) )
+ ImplementationError(flo,ped, return(FALSE));
+
+ /*
+ * If we reenter this loop after having decoded some data,
+ * it's important to check to see if we need to flush the
+ * decoder's output buffer. It's big trouble to call the
+ * decoder if its output buffer isn't flushed. nl_found
+ * indicates how many lines are left in the buffer
+ */
+
+ if (state->nl_found) {
+ JSAMPIMAGE jpeg_odata = state->cinfo->output_workspace;
+ register int ci,row;
+ int max_can_do;
+ int nl_mappable;
+ unsigned char **o_lines;
+
+ /* this is possibly the first time we can check to see */
+ /* if the data agrees with the output format */
+ /* we don't get to check the JPEG data format until the */
+ /* header has been read. The first time some output lines */
+ /* are produced, we make sure all is copasetic... er... ok */
+
+ if (!texpvt->format_checked) {
+
+ /* XXX - width, height must be same, all bands */
+ if ( dbnd->format->width != (int)state->cinfo->image_width )
+ ImplementationError(flo,ped, return(FALSE));
+
+ if ( dbnd->format->height != (int)state->cinfo->image_height )
+ ImplementationError(flo,ped, return(FALSE));
+
+ if ( texpvt->dataClass == xieValSingleBand &&
+ state->cinfo->num_components != 1 )
+ ImplementationError(flo,ped, return(FALSE));
+
+ /* due to !*(!(! interleave option, checking bands is harder */
+ if (
+ (texpvt->dataClass == xieValTripleBand &&
+ texpvt->colors_smushed &&
+ state->cinfo->num_components != 3) ||
+ (texpvt->dataClass == xieValTripleBand &&
+ !texpvt->colors_smushed &&
+ state->cinfo->num_components != 1) )
+ ImplementationError(flo,ped, return(FALSE));
+
+ texpvt->format_checked = 1;
+ }
+
+ /* Map current output strip to an array of lines, current->0 */
+ nl_mappable = dbnd->maxLocal - state->o_line;
+ if (!MapData(flo,pet,dbnd,0,dbnd->current,nl_mappable,KEEP))
+ ImplementationError(flo,ped, return(FALSE));
+
+ if (dbnd1) {
+ /* same for other two bands. Notice that we rely on */
+ /* all three bands being synchronous with each other */
+
+ if (!MapData(flo,pet,dbnd1,0,dbnd1->current,nl_mappable,KEEP))
+ ImplementationError(flo,ped, return(FALSE));
+ if (!MapData(flo,pet,dbnd2,0,dbnd2->current,nl_mappable,KEEP))
+ ImplementationError(flo,ped, return(FALSE));
+ }
+
+ /* limit flushing to as much as fits in a strip */
+ max_can_do = (nl_mappable < state->nl_found)?
+ nl_mappable : state->nl_found;
+
+
+ /* at this point, we have checked enough to make sure */
+ /* the following data copying stuff is appropriate */
+
+ o_lines = (unsigned char **) dbnd->dataMap;
+ for (row=0; row<max_can_do; ++row) {
+ register unsigned char *o_line = o_lines[row];
+ register JSAMPROW jptr = jpeg_odata[0][row+state->nl_flushed];
+ register npix = state->cinfo->image_width;
+ while (npix--)
+ *o_line++ = (unsigned char) *jptr++;
+ }
+
+ for (ci=1; ci < state->cinfo->num_components; ++ci) {
+ o_lines = (unsigned char **) ((ci==1)? dbnd1 : dbnd2)->dataMap;
+ for (row=0; row<max_can_do; ++row) {
+ register unsigned char *o_line = o_lines[row];
+ register JSAMPROW jptr = jpeg_odata[ci][row+state->nl_flushed];
+ register npix = state->cinfo->image_width;
+ while (npix--)
+ *o_line++ = (unsigned char) *jptr++;
+ }
+ }
+
+ state->o_line += max_can_do;
+ state->nl_found -= max_can_do;
+ state->nl_flushed += max_can_do;
+
+ dbnd->current = state->o_line;
+ if (dbnd1) {
+ dbnd1->current = state->o_line;
+ dbnd2->current = state->o_line;
+ }
+
+ /* if we are done with this output strip, deliver it */
+ if (state->o_line >= (int) dbnd->maxLocal) {
+ /* if PutData returns True, there is someone ready to
+ be scheduled downstream. We should return to yield
+ */
+ if (dbnd1) {
+ PutData(flo,pet,dbnd, (unsigned) state->o_line);
+ PutData(flo,pet,dbnd1,(unsigned) state->o_line);
+ PutData(flo,pet,dbnd2,(unsigned) state->o_line);
+ }
+ else
+ if (PutData(flo,pet,dbnd, (unsigned) state->o_line) )
+ return(TRUE);
+ }
+
+ if (state->nl_found) /* couldn't flush all of it */
+ continue; /* need another output strip */
+
+
+ /* if here, flushed everything */
+ if (state->goal != JPEG_DECODE_GOAL_Done)
+ continue; /* go around loop again. get */
+ /* more dst if necessary */
+
+ /* all done!! free up all the src data */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return TRUE;
+
+ } /* end of if (state->nl_found) */
+
+ else {
+ /* shouldn't call decoder if it wants something to */
+ /* decode but there is nothing available to decode! */
+ if (state->needs_input_strip)
+ ImplementationError(flo,ped, return(FALSE));
+
+ if ( (*decodptr)(state) < 0 ) {
+ /* if client wanted to be notified, give him the bad news */
+ if(texpvt->notify)
+ SendDecodeNotifyEvent(flo, ped, dbnd->band,
+ xieValDecodeJPEGBaseline,
+ dbnd->format->width, dbnd->current, TRUE);
+
+ /* have to send some error. We didn't get the right */
+ /* number of lines, so complain about the height */
+ ValueError(flo,ped,dbnd->format->height, return(FALSE));
+ }
+
+ if (state->needs_input_strip) {
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ return TRUE;
+ }
+
+ /* if we have more work to do or need to flush, carry on */
+ if (state->goal != JPEG_DECODE_GOAL_Done || state->nl_found)
+ continue;
+
+ /* all done!! free up all the src data */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return TRUE;
+
+ } /* end of else (!state->nl_found) */
+
+ } /* end of while(dst = ...) */
+
+ /*
+ * No more dst? Then either we are:
+ *
+ * 1: done with output image. Just shut down and be happy
+ * 2: scheduler has noticed a downstream element can run. In this
+ * case, we should be a good guy and return TRUE so the scheduler
+ * gives us back control again later (without going back to Core
+ * X, which would cause our input strip to vanish).
+ */
+ if (dbnd->final) {
+ /* all done!! free up all the src data */
+ FreeData(flo,pet,sbnd,sbnd->maxGlobal);
+ return TRUE;
+ }
+
+/*
+ * if here, we ran out of src. Scheduler will wake us up again
+ * when a PutClientData request comes along.
+ */
+ return TRUE; /* Hmmm. Well, I think I did my part ok... */
+} /* end ActivateIPhotoJpegBase */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+int ResetIPhotoJpegBase(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ /* get rid of the any data malloc'd by JPEG decoder */
+ if(ped->peTex) {
+ jpegPvtPtr texpvt = (jpegPvtPtr) ped->peTex->private;
+ int b;
+
+ /*** JPEG code has its own global free routine ***/
+ for (b=0; b<texpvt->in_bands; ++b) {
+ if (texpvt->cinfo[b].emethods)
+ (*texpvt->cinfo[b].emethods->d_free_all)(& texpvt->cinfo[b]);
+ }
+ }
+ return(TRUE);
+} /* end ResetIPhotoJpegBase */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+int DestroyIPhotoJpegBase(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.flush = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return TRUE;
+} /* end DestroyIPhotoJpegBase */
+
+/**** module mijpeg.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/import/milut.c b/xc/programs/Xserver/XIE/mixie/import/milut.c
new file mode 100644
index 000000000..a0f88a420
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/milut.c
@@ -0,0 +1,227 @@
+/* $TOG: milut.c /main/5 1998/02/09 16:17:00 kaleb $ */
+/**** module milut.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ milut.c -- DDXIE prototype import client lut element
+
+ Larry Hare -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/milut.c,v 3.3 1998/10/05 13:22:36 dawes Exp $ */
+
+#define _XIEC_ILUT
+#define _XIEC_MILUT
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <lut.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeILUT();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateILUT();
+static int InitializeILUT();
+static int ActivateILUT();
+static int ResetILUT();
+static int DestroyILUT();
+
+/*
+ * DDXIE ImportLUT entry points
+ */
+static ddElemVecRec miLUTVec = {
+ CreateILUT,
+ InitializeILUT,
+ ActivateILUT,
+ (xieIntProc)NULL,
+ ResetILUT,
+ DestroyILUT
+ };
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeILUT(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = miLUTVec;
+
+ return(TRUE);
+} /* end miAnalyzeILUT */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateILUT(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the import lut element definition */
+ return(MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC));
+} /* end CreateILUT */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeILUT(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* note: ImportResource elements don't use their receptors */
+ return(InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeILUT */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateILUT(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ lutPtr lut = ((iLUTDefPtr)ped->elemPvt)->lut;
+ bandPtr bnd = pet->emitter;
+ CARD32 b;
+
+ for(b = 0; b < lut->lutCnt; ++bnd, ++b)
+ if(!bnd->final) {
+
+ if(ListEmpty(&lut->strips[b]))
+ AccessError(flo,ped, return(FALSE));
+
+ if(!PassStrip(flo,pet,bnd,lut->strips[b].flink))
+ return(FALSE); /* alloc error */
+ }
+ return(TRUE);
+} /* end ActivateILUT */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetILUT(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetILUT */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyILUT(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.flush = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyILUT */
+
+/* end module milut.c */
+
diff --git a/xc/programs/Xserver/XIE/mixie/import/miphoto.c b/xc/programs/Xserver/XIE/mixie/import/miphoto.c
new file mode 100644
index 000000000..c76b31c98
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/miphoto.c
@@ -0,0 +1,854 @@
+/* $TOG: miphoto.c /main/8 1998/02/09 16:17:05 kaleb $ */
+/**** module miphoto.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miphoto.c -- DDXIE prototype import client photomap element
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/miphoto.c,v 3.3 1998/10/05 13:22:36 dawes Exp $ */
+
+#define _XIEC_MIPHOTO
+#define _XIEC_IPHOTO
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <photomap.h>
+#include <element.h>
+#include <texstr.h>
+#include <miuncomp.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeIPhoto();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateIPhotoUncom();
+static int InitializeIPhotoUncomByPlane();
+static int ActivateIPhotoUncomByPlane();
+static int ResetIPhoto();
+static int DestroyIPhoto();
+
+static int CreateIPhotoStream();
+static int InitializeIPhotoStream();
+static int ActivateIPhotoStream();
+static int ResetIPhotoStream();
+
+#if XIE_FULL
+static int InitializeIPhotoUncomByPixel();
+static int ActivateIPhotoUncomByPixel();
+#endif
+/*
+ * routines we need from somewhere else
+ */
+extern bandMsk miImportCanonic();
+extern bandMsk miImportStream();
+
+extern int CreateICPhotoFax();
+extern int InitializeIPhotoFax();
+extern int ActivateICPhotoFax();
+extern int ResetICPhotoFax();
+extern int DestroyICPhotoFax();
+
+#if XIE_FULL
+extern int CreateIPhotoJpegBase();
+extern int InitializeIPhotoJpegBase();
+extern int ActivateIPhotoJpegBase();
+extern int ResetIPhotoJpegBase();
+extern int DestroyIPhotoJpegBase();
+#endif
+
+/*
+ * DDXIE ImportPhotomap entry points
+ */
+static ddElemVecRec IPhotoUncomByPlaneVec = {
+ CreateIPhotoUncom,
+ InitializeIPhotoUncomByPlane,
+ ActivateIPhotoUncomByPlane,
+ (xieIntProc)NULL,
+ ResetIPhoto,
+ DestroyIPhoto
+ };
+
+static ddElemVecRec IPhotoStreamVec = {
+ CreateIPhotoStream,
+ InitializeIPhotoStream,
+ ActivateIPhotoStream,
+ (xieIntProc)NULL,
+ ResetIPhotoStream,
+ DestroyIPhoto
+ };
+
+static ddElemVecRec IPhotoFaxVec = {
+ CreateICPhotoFax, /* share this with ICphoto stuff */
+ InitializeIPhotoFax, /* note that only this is unshared */
+ ActivateICPhotoFax,
+ (xieIntProc)NULL,
+ ResetICPhotoFax,
+ DestroyICPhotoFax
+ };
+
+#if XIE_FULL
+static ddElemVecRec IPhotoUncomByPixelVec = {
+ CreateIPhotoUncom,
+ InitializeIPhotoUncomByPixel,
+ ActivateIPhotoUncomByPixel,
+ (xieIntProc)NULL,
+ ResetIPhoto,
+ DestroyIPhoto
+ };
+
+static ddElemVecRec IPhotoJPEGBaselineVec = {
+ CreateIPhotoJpegBase,
+ InitializeIPhotoJpegBase,
+ ActivateIPhotoJpegBase,
+ (xieIntProc)NULL,
+ ResetIPhotoJpegBase,
+ DestroyIPhotoJpegBase
+ };
+#endif /* XIE_FULL */
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeIPhoto(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+
+ if(!miImportCanonic(flo,ped)) {
+ ped->ddVec = IPhotoStreamVec;
+ return(TRUE);
+ }
+ switch(map->technique) {
+ case xieValDecodeUncompressedSingle:
+ ped->ddVec = IPhotoUncomByPlaneVec;
+ break;
+
+#if XIE_FULL
+ case xieValDecodeUncompressedTriple:
+ if(((xieTecDecodeUncompressedTriple *)
+ map->tecParms)->interleave == xieValBandByPlane)
+ ped->ddVec = IPhotoUncomByPlaneVec;
+ else
+ ped->ddVec = IPhotoUncomByPixelVec;
+
+ break;
+ case xieValDecodeJPEGBaseline:
+ ped->ddVec = IPhotoJPEGBaselineVec;
+ break;
+#endif /* XIE_FULL */
+ case xieValDecodeTIFFPackBits:
+ case xieValDecodeTIFF2:
+ case xieValDecodeG31D:
+ case xieValDecodeG32D:
+ case xieValDecodeG42D:
+ ped->ddVec = IPhotoFaxVec;
+ break;
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ return(TRUE);
+} /* end miAnalyzeIPhoto */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateIPhotoUncom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return(MakePETex(flo, ped, xieValMaxBands * sizeof(miUncompRec),
+ NO_SYNC, NO_SYNC) );
+} /* end CreateIPhotoUncom */
+
+
+static int CreateIPhotoStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return( MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC) );
+} /* end CreateIPhotoStream */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeIPhotoUncomByPlane(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+ peTexPtr pet = ped->peTex;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ CARD32 nbands = ped->outFlo.bands,b,s;
+ formatPtr inf = ped->inFloLst[IMPORT].format;
+ bandMsk import = NO_BANDS;
+ bandMsk reformat = miImportCanonic(flo,ped);
+ xieTypOrientation pixelOrder, fillOrder;
+ CARD8 *ppad;
+
+ if (nbands == 1) {
+ xieTecDecodeUncompressedSingle *tec = ((xieTecDecodeUncompressedSingle*)
+ map->tecParms);
+ pixelOrder = tec->pixelOrder;
+ fillOrder = tec->fillOrder;
+ pvt->bandMap = 0;
+ ppad = &tec->leftPad;
+ } else {
+#if XIE_FULL
+ xieTecDecodeUncompressedTriple *tec = ((xieTecDecodeUncompressedTriple*)
+ map->tecParms);
+ pixelOrder = tec->pixelOrder;
+ fillOrder = tec->fillOrder;
+ ppad = tec->leftPad;
+ if (tec->bandOrder == xieValLSFirst)
+ for(b = 0; b < xieValMaxBands; ++b)
+ pvt[b].bandMap = b;
+ else
+ for(s = 0, b = xieValMaxBands; b--; ++s)
+ pvt[s].bandMap = b;
+#else
+ ImplementationError(flo,ped, return(FALSE));
+#endif
+ }
+
+ for (b = 0; b < nbands; b++, pvt++, ppad++, inf++) {
+ pvt->next_strip = map->strips[b].flink;
+ if (IsCanonic(inf->class))/* If data was passed through then no decoding*/
+ continue;
+
+ import |= 1<<b;
+ if(reformat & 1<<b)
+ pvt->reformat = TRUE;
+ else
+ continue;
+
+ pvt->bitOff = pvt->leftPad = *ppad;
+ if(inf->depth == 1) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ if (pvt->leftPad & 7 || inf->stride != 1) {
+ pvt->action = (fillOrder == xieValMSFirst) ? CPextractstreambits:
+ CPextractswappedstreambits;
+ } else {
+ pvt->action = (fillOrder == xieValMSFirst) ? CPpass_bits :
+ CPreverse_bits;
+ }
+#else
+ if (pvt->leftPad & 7 || inf->stride != 1) {
+ pvt->action = (fillOrder == xieValLSFirst) ? CPextractstreambits:
+ CPextractswappedstreambits;
+ } else {
+ pvt->action = (fillOrder == xieValLSFirst) ? CPpass_bits :
+ CPreverse_bits;
+ }
+#endif
+ } else if (inf->depth <= 8) {
+ if (pvt->leftPad & 7 || inf->stride & 7) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUBtoB;
+ else
+ pvt->action = MLUBtoB;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUBtoB;
+ else
+ pvt->action = LLUBtoB;
+ }
+ } else {
+ /* They chose wisely */
+ pvt->action = CPpass_bytes;
+ }
+ } else if (inf->depth <= 16) {
+ if (pvt->leftPad & 15 || inf->stride & 15) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUPtoP;
+ else
+ pvt->action = MLUPtoP;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUPtoP;
+ else
+ pvt->action = LLUPtoP;
+ }
+ } else {
+ /* They chose wisely */
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ pvt->action = fillOrder == xieValMSFirst ? CPpass_pairs : CPswap_pairs;
+#else
+ pvt->action = fillOrder == xieValLSFirst ? CPpass_pairs : CPswap_pairs;
+#endif
+ }
+ } else if (inf->depth <= 24) {
+ if (pvt->leftPad & 31 || inf->stride & 31) {
+ /* They chose . . . poorly */
+ if (pixelOrder == xieValMSFirst) {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = MMUQtoQ;
+ else
+ pvt->action = MLUQtoQ;
+ } else {
+ if(fillOrder == xieValMSFirst)
+ pvt->action = LMUQtoQ;
+ else
+ pvt->action = LLUQtoQ;
+ }
+ } else {
+ /* They chose wisely */
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ pvt->action = fillOrder == xieValMSFirst ? CPpass_quads : CPswap_quads;
+#else
+ pvt->action = fillOrder == xieValLSFirst ? CPpass_quads : CPswap_quads;
+#endif
+ }
+ } else {
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ }
+ if(import) {
+ bandMsk smuggle = import & ~reformat; /* bands that will bypass emitter */
+ receptorPtr rcp = pet->receptor;
+
+ rcp->forward = miImportStream(flo,ped);
+
+ return( InitReceptor(flo, ped, rcp, NO_DATAMAP, 1, import, smuggle) &&
+ (!(import & 1) ||
+ ImportStrips(flo, pet,&rcp->band[0], &map->strips[0])) &&
+ (!(import & 2) ||
+ ImportStrips(flo, pet,&rcp->band[1], &map->strips[1])) &&
+ (!(import & 4) ||
+ ImportStrips(flo, pet,&rcp->band[2], &map->strips[2])) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+ } else {
+ return(InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+ }
+} /* end InitializeIPhotoUncomByPlane */
+
+
+static int InitializeIPhotoStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ int b, nbands = ped->inFloLst[IMPORT].bands;
+
+ /* tell data manager to forward our input data to downstream elements
+ */
+ rcp->forward = miImportStream(flo,ped);
+
+ if(!InitReceptor(flo, ped, rcp, NO_DATAMAP, 1, rcp->forward, ~rcp->forward))
+ return(FALSE);
+
+ for(b = 0; b < nbands; ++b)
+ if(!ImportStrips(flo, pet, &rcp->band[b], &map->strips[b]))
+ return(FALSE);
+
+ return(InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeIPhotoStream */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateIPhotoUncomByPlane(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+ xieFloImportPhotomap *raw = (xieFloImportPhotomap *)ped->elemRaw;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ formatPtr fmt = ped->inFloLst[IMPORT].format;
+ bandPtr bnd = &pet->emitter[0];
+ bandPtr sbnd = pet->receptor[SRCtag].band;
+ bandPtr dbnd;
+ CARD32 oldslen, final, nextslen, b;
+
+ for(b = 0; b < map->bands; b++, pvt++, fmt++, sbnd++, bnd++)
+ if(!bnd->final)
+ if(pet->receptor[SRCtag].active & 1<<b) {
+ void (*action)() = pvt->action;
+ pointer src, dst;
+
+ if(!pvt->reformat) {
+ FreeData(flo, pet, sbnd, sbnd->maxGlobal);
+ continue;
+ }
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ dbnd = &pet->emitter[pvt->bandMap];
+ if((src = GetSrcBytes(flo,pet,sbnd,sbnd->current,nextslen,KEEP))
+ && (dst = GetCurrentDst(flo,pet,dbnd)))
+
+ do {
+ (*action)(src, dst, sbnd->format->width,
+ (CARD32)pvt->bitOff,
+ (CARD32)sbnd->format->depth,
+ sbnd->format->stride);
+
+ pvt->bitOff = pvt->bitOff + sbnd->format->pitch & 7;
+ oldslen = (pvt->bitOff) ? nextslen - 1 : nextslen;
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ src = GetSrcBytes(flo,pet,sbnd,sbnd->current+oldslen,
+ nextslen,KEEP);
+ dst = GetNextDst(flo,pet,dbnd,FLUSH);
+ } while(src && dst);
+
+ final = sbnd->strip && sbnd->strip->final;
+ if(!src && final && dbnd->current < dbnd->format->height) {
+ /*
+ * the client lied about the image size!
+ */
+ if(raw->notify)
+ SendDecodeNotifyEvent(flo, ped, 0, map->technique,
+ dbnd->format->width, dbnd->current, TRUE);
+ /*
+ * If the client didn't send enough data, we could zero-fill the
+ * remaining lines. Since we sent the "aborted" status, we won't
+ * bother (the protocol offers both choices).
+ */
+ ValueError(flo,ped,dbnd->format->height, return(FALSE));
+ }
+ if(!src || dbnd->final) {
+ /* free whatever we've used so far
+ */
+ FreeData(flo, pet, sbnd, final ? sbnd->maxGlobal : sbnd->current);
+ }
+ } else {
+ stripPtr strip = pvt->next_strip;
+ pvt->next_strip = strip->flink;
+
+ if(ListEnd(strip,&map->strips[b]))
+ AccessError(flo,ped, return(FALSE));
+
+ /* pass a clone of the current strip to our recipients
+ */
+ if(!PassStrip(flo,pet,bnd,strip))
+ return(FALSE); /* alloc error */
+ }
+ return(TRUE);
+} /* end ActivateIPhotoUncomByPlane */
+
+
+static int ActivateIPhotoStream(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ CARD32 nbands = ped->inFloLst[IMPORT].bands;
+ bandPtr bnd = pet->receptor[IMPORT].band;
+ CARD32 b;
+
+ for(b = 0; b < nbands; ++bnd, ++b) {
+ if(GetSrcBytes(flo,pet,bnd,bnd->current,1,KEEP)) {
+ FreeData(flo,pet,bnd,bnd->maxLocal);
+ if(ListEmpty(&bnd->stripLst))
+ DisableDst(flo,pet,&pet->emitter[b]);
+ }
+ }
+ return(TRUE);
+} /* end ActivateIPhotoStream */
+
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetIPhoto(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ miUncompPtr pvt = (miUncompPtr)ped->peTex->private;
+ int i;
+
+ for(i = 0; i < xieValMaxBands; ++i)
+ if(pvt[i].buf) pvt[i].buf = (pointer) XieFree(pvt[i].buf);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetIPhoto */
+
+
+static int ResetIPhotoStream(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetIPhotoStream */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyIPhoto(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return(TRUE);
+} /* end DestroyIPhoto */
+
+
+#if XIE_FULL
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeIPhotoUncomByPixel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ photomapPtr map = ((iPhotoDefPtr)ped->elemPvt)->map;
+ xieTecDecodeUncompressedTriple *tec = ((xieTecDecodeUncompressedTriple *)
+ map->tecParms);
+ peTexPtr pet = ped->peTex;
+ miUncompPtr pvt = (miUncompPtr)pet->private;
+ bandPtr sbnd = &ped->peTex->receptor[IMPORT].band[0];
+ CARD32 sstride = sbnd->format->stride>>3;
+ CARD8 leftPad = tec->leftPad[0]>>3;
+ xieTypOrientation pixelOrder, fillOrder;
+ CARD32 depth0, depth1, depth2;
+ int s, d;
+
+ pvt->unaligned = FALSE; /* Hope for the best */
+
+ if(tec->bandOrder == xieValLSFirst)
+ for(d = 0; d < xieValMaxBands; ++d)
+ pvt[d].bandMap = d;
+ else
+ for(s = 0, d = xieValMaxBands; d--; ++s)
+ pvt[s].bandMap = d;
+
+ depth0 = pet->emitter[pvt[0].bandMap].format->depth;
+ depth1 = pet->emitter[pvt[1].bandMap].format->depth;
+ depth2 = pet->emitter[pvt[2].bandMap].format->depth;
+
+ pixelOrder = tec->pixelOrder;
+ fillOrder = tec->fillOrder;
+ pvt[0].next_strip = map->strips[0].flink;
+
+ pvt->bitOff = pvt->leftPad = tec->leftPad[0];
+
+ /* See if data is nicely aligned */
+ if (!(tec->leftPad[0] & 7) && !(sbnd->format->stride & 7)) {
+ if (depth0 == 16 && depth1 == 16 && depth2 == 16) {
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? StoP : StosP;
+#else
+ void (*pa)() = (tec->pixelOrder == xieValMSFirst) ? StosP : StoP;
+#endif
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = pa;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = s + leftPad;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ }
+ } else if (depth0 == 8 && depth1 == 8 && depth2 == 8) {
+ for(s = 0; s < xieValMaxBands; s++, pvt++) {
+ pvt->action = StoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = s + leftPad;
+ pvt->mask = 0; /* Unused */
+ pvt->shift = 0; /* Unused */
+ }
+ } else if (depth0 == 4 && depth1 == 4 && depth2 == 4) {
+ if (tec->fillOrder == xieValMSFirst) {
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0xf0;
+ (pvt++)->shift = 4;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = 1 + leftPad;
+ pvt->mask = 0xf0;
+ pvt->shift = 4;
+ } else { /* xieValLSFirst */
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0x0f;
+ (pvt++)->shift = 0;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = 0xf0;
+ (pvt++)->shift = 4;
+ pvt->action = SbtoB;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = 1 + leftPad;
+ pvt->mask = 0x0f;
+ pvt->shift = 0;
+ }
+ } else if (depth0 + depth1 + depth2 <= 8) {
+ CARD8 ones = 0xff,smask0,smask1,smask2,shift0,shift1,shift2;
+ if (tec->fillOrder == xieValMSFirst) {
+ smask0 = ~(ones>>depth0);
+ smask1 = ~(ones>>(depth0 + depth1) | smask0);
+ smask2 = ~(ones>>(depth0 + depth1 + depth2) | smask0 | smask1);
+ shift0 = 8 - depth0;
+ shift1 = 8 - (depth0 + depth1);
+ shift2 = 8 - (depth0 + depth1 + depth2);
+ } else { /* fillOrder == xieValLSFirst */
+ smask2 = ~(ones<<depth2);
+ smask1 = ~(ones<<(depth1 + depth2) | smask2);
+ smask0 = ~(ones<<(depth0 + depth1 + depth2) | smask1 | smask2);
+ shift2 = 0;
+ shift1 = depth2;
+ shift0 = depth1 + depth2;
+ }
+ pvt->action = (depth0 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask0;
+ (pvt++)->shift = shift0;
+ pvt->action = (depth1 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask1;
+ (pvt++)->shift = shift1;
+ pvt->action = (depth2 > 1) ? SbtoB : Sbtob;
+ pvt->Bstride = sstride;
+ pvt->srcoffset = leftPad;
+ pvt->mask = smask2;
+ pvt->shift = shift2;
+ } else {
+ pvt->unaligned = TRUE;
+ }
+ } else {
+ pvt->unaligned = TRUE;
+ }
+ pvt = (miUncompPtr)pet->private;
+ pvt->reformat = TRUE;
+
+ if(pvt->unaligned) {
+ /* since it's unaligned and somebody wants our data, do it the hard way */
+ CARD32 width = sbnd->format->width;
+ pvt->action = ExtractTripleFuncs[tec->pixelOrder == xieValLSFirst ? 0 : 1]
+ [tec->fillOrder == xieValLSFirst ? 0 : 1]
+ [depth0 <= 8 ? 0 : 1]
+ [depth1 <= 8 ? 0 : 1]
+ [depth2 <= 8 ? 0 : 1];
+ if(depth0 == 1 && !(pvt[0].buf = (pointer)XieMalloc(width+7)) ||
+ depth1 == 1 && !(pvt[1].buf = (pointer)XieMalloc(width+7)) ||
+ depth2 == 1 && !(pvt[2].buf = (pointer)XieMalloc(width+7)))
+ AllocError(flo,ped, return(FALSE));
+ }
+ /* see if data manager should forward our input data to downstream elements
+ */
+ pet->receptor->forward = miImportStream(flo,ped);
+
+ return(InitReceptor(flo,ped, pet->receptor,NO_DATAMAP,1,1,NO_BANDS) &&
+ ImportStrips(flo,pet,&pet->receptor[0].band[0],&map->strips[0]) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE));
+} /* end InitializeIPhotoUnTriple */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateIPhotoUncomByPixel(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloImportPhotomap *raw = (xieFloImportPhotomap *)ped->elemRaw;
+ miUncompPtr pvt = (miUncompPtr) (pet->private);
+ bandPtr sbnd = &pet->receptor[IMPORT].band[0];
+ bandPtr db0 = &pet->emitter[pvt[0].bandMap];
+ bandPtr db1 = &pet->emitter[pvt[1].bandMap];
+ bandPtr db2 = &pet->emitter[pvt[2].bandMap];
+ CARD32 final, width = db0->format->width;
+ pointer src, dp0, dp1, dp2;
+
+ if(pvt->unaligned) {
+ CARD32 oldslen, nextslen;
+ void (*action)() = pvt->action;
+ CARD32 depth0 = db0->format->depth;
+ CARD32 depth1 = db1->format->depth;
+ CARD32 depth2 = db2->format->depth;
+ CARD32 stride = sbnd->format->stride;
+
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ if((src = GetSrcBytes(flo,pet,sbnd,sbnd->current,nextslen,KEEP)) &&
+ (dp0 = GetCurrentDst(flo,pet,db0)) &&
+ (dp1 = GetCurrentDst(flo,pet,db1)) &&
+ (dp2 = GetCurrentDst(flo,pet,db2)))
+ do {
+
+ (*action)(src,
+ pvt[0].buf ? pvt[0].buf : dp0,
+ pvt[1].buf ? pvt[1].buf : dp1,
+ pvt[2].buf ? pvt[2].buf : dp2,
+ width, pvt->bitOff, depth0, depth1, depth2, stride);
+
+ if(pvt[0].buf) bitshrink(pvt[0].buf,dp0,width,(BytePixel)1);
+ if(pvt[1].buf) bitshrink(pvt[1].buf,dp1,width,(BytePixel)1);
+ if(pvt[2].buf) bitshrink(pvt[2].buf,dp2,width,(BytePixel)1);
+
+ pvt->bitOff = pvt->bitOff + sbnd->format->pitch & 7;
+ oldslen = pvt->bitOff ? nextslen - 1 : nextslen;
+ nextslen = pvt->bitOff + sbnd->format->pitch + 7 >> 3;
+ src = GetSrcBytes(flo,pet,sbnd,sbnd->current+oldslen,nextslen,KEEP);
+ dp0 = GetNextDst(flo,pet,db0,FLUSH);
+ dp1 = GetNextDst(flo,pet,db1,FLUSH);
+ dp2 = GetNextDst(flo,pet,db2,FLUSH);
+ } while(src && dp0 && dp1 && dp2);
+ } else {
+ CARD32 slen = sbnd->format->pitch+7>>3;
+ if((src = GetSrcBytes(flo,pet,sbnd,sbnd->current,slen,KEEP)) &&
+ (dp0 = GetCurrentDst(flo,pet,db0)) &&
+ (dp1 = GetCurrentDst(flo,pet,db1)) &&
+ (dp2 = GetCurrentDst(flo,pet,db2)))
+ do {
+
+ (*pvt[0].action)(src,dp0,width,&pvt[0]);
+ (*pvt[1].action)(src,dp1,width,&pvt[1]);
+ (*pvt[2].action)(src,dp2,width,&pvt[2]);
+
+ src =GetSrcBytes(flo,pet,sbnd,sbnd->current+slen,slen,KEEP);
+ dp0 = GetNextDst(flo,pet,db0,FLUSH);
+ dp1 = GetNextDst(flo,pet,db1,FLUSH);
+ dp2 = GetNextDst(flo,pet,db2,FLUSH);
+ } while(src && dp0 && dp1 && dp2);
+ }
+ final = sbnd->strip && sbnd->strip->final;
+ if(!src && final && db0->current < db0->format->height) {
+ /*
+ * the client lied about the image size!
+ */
+ if(raw->notify)
+ SendDecodeNotifyEvent(flo, ped, 0, xieValDecodeUncompressedTriple,
+ db0->format->width, db0->current, TRUE);
+ /*
+ * If the client didn't send enough data, we could zero-fill the
+ * remaining lines. Since we sent the "aborted" status, we won't
+ * bother (the protocol offers both choices).
+ */
+ ValueError(flo,ped,db0->format->height, return(FALSE));
+ }
+ if(!src || db0->final && db1->final && db2->final) {
+ /* free whatever we've used so far
+ */
+ FreeData(flo, pet, sbnd, final ? sbnd->maxGlobal : sbnd->current);
+ }
+ return(TRUE);
+} /* end ActivateIPhotoUncomByPixel */
+#endif /* XIE_FULL */
+
+/* end module miphoto.c */
diff --git a/xc/programs/Xserver/XIE/mixie/import/miregion.c b/xc/programs/Xserver/XIE/mixie/import/miregion.c
new file mode 100644
index 000000000..b906c5ba8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/miregion.c
@@ -0,0 +1,1088 @@
+/* $TOG: miregion.c /main/5 1998/02/09 16:17:10 kaleb $ */
+/**** module miregion.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miregion.c -- ddx/mi/miregion code converted over to XIE for rectangles
+ of interest. "Minimal" conversion made to support
+ rectangles defined by INT32s instead of shorts. Unused
+ routines from the general code have been removed.
+
+ Dean Verheiden -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/***********************************************************
+
+Copyright 1987, 1988, 1989 The Open Group
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1988, 1989 by
+Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/miregion.c,v 3.5 1999/01/31 12:21:36 dawes Exp $ */
+
+#define _XIEC_MIREGION
+
+#include <memory.h>
+
+#include "miscstruct.h"
+#include "regionstr.h"
+#include "Xprotostr.h"
+#include "gc.h"
+
+#include "microi.h"
+#include "macro.h"
+
+#if defined (__GNUC__) && !defined (NO_INLINES)
+#define INLINE __inline
+#else
+#define INLINE
+#endif
+
+/*
+ * hack until callers of these functions can deal with out-of-memory
+ */
+
+extern Bool Must_have_memory;
+
+#undef assert
+#define assert(expr)
+
+#define good(reg) assert(miXieValidRegion(reg))
+
+/*
+ * The functions in this file implement the Region abstraction used extensively
+ * throughout the X11 sample server. A Region is simply a set of disjoint
+ * (non-overlapping) rectangles, plus an "extent" rectangle which is the
+ * smallest single rectangle that contains all the non-overlapping rectangles.
+ *
+ * A Region is implemented as a "y-x-banded" array of rectangles. This array
+ * imposes two degrees of order. First, all rectangles are sorted by top side
+ * y coordinate first (y1), and then by left side x coordinate (x1).
+ *
+ * Furthermore, the rectangles are grouped into "bands". Each rectangle in a
+ * band has the same top y coordinate (y1), and each has the same bottom y
+ * coordinate (y2). Thus all rectangles in a band differ only in their left
+ * and right side (x1 and x2). Bands are implicit in the array of rectangles:
+ * there is no separate list of band start pointers.
+ *
+ * The y-x band representation does not minimize rectangles. In particular,
+ * if a rectangle vertically crosses a band (the rectangle has scanlines in
+ * the y1 to y2 area spanned by the band), then the rectangle may be broken
+ * down into two or more smaller rectangles stacked one atop the other.
+ *
+ * ----------- -----------
+ * | | | | band 0
+ * | | -------- ----------- --------
+ * | | | | in y-x banded | | | | band 1
+ * | | | | form is | | | |
+ * ----------- | | ----------- --------
+ * | | | | band 2
+ * -------- --------
+ *
+ * An added constraint on the rectangles is that they must cover as much
+ * horizontal area as possible: no two rectangles within a band are allowed
+ * to touch.
+ *
+ * Whenever possible, bands will be merged together to cover a greater vertical
+ * distance (and thus reduce the number of rectangles). Two bands can be merged
+ * only if the bottom of one touches the top of the other and they have
+ * rectangles in the same places (of the same width, of course).
+ *
+ * Adam de Boor wrote most of the original region code. Joel McCormack
+ * substantially modified or rewrote most of the core arithmetic routines,
+ * and added miXieRegionValidate in order to support several speed improvements
+ * to miXieValidateTree. Bob Scheifler changed the representation to be more
+ * compact when empty or a single rectangle, and did a bunch of gratuitous
+ * reformatting.
+ */
+
+#define xallocData(n) (XieRegDataPtr)XieMalloc(XIEREGION_SZOF(n))
+#define xfreeData(reg) if ((reg)->data && (reg)->data->size) XieFree((reg)->data)
+
+#define RECTALLOC(pReg,n) \
+if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
+ miXieRectAlloc(pReg, n)
+
+#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \
+{ \
+ pNextRect->x1 = nx1; \
+ pNextRect->y1 = ny1; \
+ pNextRect->x2 = nx2; \
+ pNextRect->y2 = ny2; \
+ pNextRect++; \
+}
+
+#define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \
+{ \
+ if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
+ { \
+ miXieRectAlloc(pReg, 1); \
+ pNextRect = XIEREGION_TOP(pReg); \
+ } \
+ ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \
+ pReg->data->numRects++; \
+ assert(pReg->data->numRects<=pReg->data->size); \
+}
+
+
+#define DOWNSIZE(reg,numRects) \
+if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
+{ \
+ XieRegDataPtr NewData; \
+ NewData = (XieRegDataPtr)XieRealloc((reg)->data, XIEREGION_SZOF(numRects)); \
+ if (NewData) \
+ { \
+ NewData->size = (numRects); \
+ (reg)->data = NewData; \
+ } \
+}
+
+static XieBoxRec EmptyBox = {0, 0, 0, 0};
+static XieRegDataRec EmptyData = {0, 0};
+
+/*****************************************************************
+ * XieRegionCreate(rect, size)
+ * This routine does a simple XieMalloc to make a structure of
+ * REGION of "size" number of rectangles.
+ *****************************************************************/
+
+XieRegionPtr
+miXieRegionCreate(rect, size)
+ XieBoxPtr rect;
+ int size;
+{
+ register XieRegionPtr pReg;
+
+ Must_have_memory = TRUE; /* XXX */
+ pReg = (XieRegionPtr)XieMalloc(sizeof(XieRegionRec));
+ Must_have_memory = FALSE; /* XXX */
+ if (rect)
+ {
+ pReg->extents = *rect;
+ pReg->data = (XieRegDataPtr)NULL;
+ }
+ else
+ {
+ pReg->extents = EmptyBox;
+ if ((size > 1) && (pReg->data = xallocData(size)))
+ {
+ pReg->data->size = size;
+ pReg->data->numRects = 0;
+ }
+ else
+ pReg->data = &EmptyData;
+ }
+ return(pReg);
+}
+
+void
+miXieRegionDestroy(pReg)
+ XieRegionPtr pReg;
+{
+ good(pReg);
+ xfreeData(pReg);
+ XieFree(pReg);
+}
+
+Bool
+miXieRectAlloc(pRgn, n)
+ register XieRegionPtr pRgn;
+ int n;
+{
+ Must_have_memory = TRUE; /* XXX */
+ if (!pRgn->data)
+ {
+ n++;
+ pRgn->data = xallocData(n);
+ pRgn->data->numRects = 1;
+ *XIEREGION_BOXPTR(pRgn) = pRgn->extents;
+ }
+ else if (!pRgn->data->size)
+ {
+ pRgn->data = xallocData(n);
+ pRgn->data->numRects = 0;
+ }
+ else
+ {
+ if (n == 1)
+ {
+ n = pRgn->data->numRects;
+ if (n > 500) /* XXX pick numbers out of a hat */
+ n = 250;
+ }
+ n += pRgn->data->numRects;
+ pRgn->data = (XieRegDataPtr)XieRealloc(pRgn->data, XIEREGION_SZOF(n));
+ }
+ Must_have_memory = FALSE; /* XXX */
+ pRgn->data->size = n;
+ return TRUE;
+}
+
+
+/*======================================================================
+ * Generic XieRegion Operator
+ *====================================================================*/
+
+/*-
+ *-----------------------------------------------------------------------
+ * miXieCoalesce --
+ * Attempt to merge the boxes in the current band with those in the
+ * previous one. We are guaranteed that the current band extends to
+ * the end of the rects array. Used only by miXieRegionOp.
+ *
+ * Results:
+ * The new index for the previous band.
+ *
+ * Side Effects:
+ * If coalescing takes place:
+ * - rectangles in the previous band will have their y2 fields
+ * altered.
+ * - pReg->data->numRects will be decreased.
+ *
+ *-----------------------------------------------------------------------
+ */
+INLINE static int
+miXieCoalesce (pReg, prevStart, curStart)
+ register XieRegionPtr pReg; /* Region to coalesce */
+ int prevStart; /* Index of start of previous band */
+ int curStart; /* Index of start of current band */
+{
+ register XieBoxPtr pPrevBox; /* Current box in previous band */
+ register XieBoxPtr pCurBox; /* Current box in current band */
+ register int numRects; /* Number rectangles in both bands */
+ register int y2; /* Bottom of current band */
+ /*
+ * Figure out how many rectangles are in the band.
+ */
+ numRects = curStart - prevStart;
+ assert(numRects == pReg->data->numRects - curStart);
+
+ if (!numRects) return curStart;
+
+ /*
+ * The bands may only be coalesced if the bottom of the previous
+ * matches the top scanline of the current.
+ */
+ pPrevBox = XIEREGION_BOX(pReg, prevStart);
+ pCurBox = XIEREGION_BOX(pReg, curStart);
+ if (pPrevBox->y2 != pCurBox->y1) return curStart;
+
+ /*
+ * Make sure the bands have boxes in the same places. This
+ * assumes that boxes have been added in such a way that they
+ * cover the most area possible. I.e. two boxes in a band must
+ * have some horizontal space between them.
+ */
+ y2 = pCurBox->y2;
+
+ do {
+ if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) {
+ return (curStart);
+ }
+ pPrevBox++;
+ pCurBox++;
+ numRects--;
+ } while (numRects);
+
+ /*
+ * The bands may be merged, so set the bottom y of each box
+ * in the previous band to the bottom y of the current band.
+ */
+ numRects = curStart - prevStart;
+ pReg->data->numRects -= numRects;
+ do {
+ pPrevBox--;
+ pPrevBox->y2 = y2;
+ numRects--;
+ } while (numRects);
+ return prevStart;
+}
+
+
+/* Quicky macro to avoid trivial reject procedure calls to miXieCoalesce */
+
+#define Coalesce(newReg, prevBand, curBand) \
+ if (curBand - prevBand == newReg->data->numRects - curBand) { \
+ prevBand = miXieCoalesce(newReg, prevBand, curBand); \
+ } else { \
+ prevBand = curBand; \
+ }
+
+/*-
+ *-----------------------------------------------------------------------
+ * miXieAppendNonO --
+ * Handle a non-overlapping band for the union and subtract operations.
+ * Just adds the (top/bottom-clipped) rectangles into the region.
+ * Doesn't have to check for subsumption or anything.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * pReg->data->numRects is incremented and the rectangles overwritten
+ * with the rectangles we're passed.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+INLINE static Bool
+miXieAppendNonO (pReg, r, rEnd, y1, y2)
+ register XieRegionPtr pReg;
+ register XieBoxPtr r;
+ XieBoxPtr rEnd;
+ register int y1;
+ register int y2;
+{
+ register XieBoxPtr pNextRect;
+ register int newRects;
+
+ newRects = rEnd - r;
+
+ assert(y1 < y2);
+ assert(newRects != 0);
+
+ /* Make sure we have enough space for all rectangles to be added */
+ RECTALLOC(pReg, newRects);
+ pNextRect = XIEREGION_TOP(pReg);
+ pReg->data->numRects += newRects;
+ do {
+ assert(r->x1 < r->x2);
+ ADDRECT(pNextRect, r->x1, y1, r->x2, y2);
+ r++;
+ } while (r != rEnd);
+
+ return TRUE;
+}
+
+#define FindBand(r, rBandEnd, rEnd, ry1) \
+{ \
+ ry1 = r->y1; \
+ rBandEnd = r+1; \
+ while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \
+ rBandEnd++; \
+ } \
+}
+
+#define AppendRegions(newReg, r, rEnd) \
+{ \
+ int newRects; \
+ if (newRects = rEnd - r) { \
+ RECTALLOC(newReg, newRects); \
+ memcpy((char *)XIEREGION_TOP(newReg), (char *)r, \
+ newRects * sizeof(XieBoxRec)); \
+ newReg->data->numRects += newRects; \
+ } \
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * miXieRegionOp --
+ * Apply an operation to two regions. Called by miXieUnion, miXieInverse,
+ * miXieSubtract, miXieIntersect.... Both regions MUST have at least one
+ * rectangle, and cannot be the same object.
+ *
+ * Results:
+ * TRUE if successful.
+ *
+ * Side Effects:
+ * The new region is overwritten.
+ * pOverlap set to TRUE if overlapFunc ever returns TRUE.
+ *
+ * Notes:
+ * The idea behind this function is to view the two regions as sets.
+ * Together they cover a rectangle of area that this function divides
+ * into horizontal bands where points are covered only by one region
+ * or by both. For the first case, the nonOverlapFunc is called with
+ * each the band and the band's upper and lower extents. For the
+ * second, the overlapFunc is called to process the entire band. It
+ * is responsible for clipping the rectangles in the band, though
+ * this function provides the boundaries.
+ * At the end of each band, the new region is coalesced, if possible,
+ * to reduce the number of rectangles in the region.
+ *
+ *-----------------------------------------------------------------------
+ */
+static Bool
+miXieRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
+ XieRegionPtr newReg; /* Place to store result */
+ XieRegionPtr reg1; /* First region in operation */
+ XieRegionPtr reg2; /* 2d region in operation */
+ Bool (*overlapFunc)(); /* Function to call for over-
+ * lapping bands */
+ Bool appendNon1; /* Append non-overlapping bands */
+ /* in region 1 ? */
+ Bool appendNon2; /* Append non-overlapping bands */
+ /* in region 2 ? */
+ Bool *pOverlap;
+{
+ register XieBoxPtr r1; /* Pointer into first region */
+ register XieBoxPtr r2; /* Pointer into 2d region */
+ XieBoxPtr r1End; /* End of 1st region */
+ XieBoxPtr r2End; /* End of 2d region */
+ INT32 ybot; /* Bottom of intersection */
+ INT32 ytop; /* Top of intersection */
+ XieRegDataPtr oldData; /* Old data for newReg */
+ int prevBand; /* Index of start of
+ * previous band in newReg */
+ int curBand; /* Index of start of current
+ * band in newReg */
+ register XieBoxPtr r1BandEnd; /* End of current band in r1 */
+ register XieBoxPtr r2BandEnd; /* End of current band in r2 */
+ INT32 top; /* Top of non-overlapping band */
+ INT32 bot; /* Bottom of non-overlapping band*/
+ register int r1y1; /* Temps for r1->y1 and r2->y1 */
+ register int r2y1;
+ int newSize;
+ int numRects;
+
+ /*
+ * Initialization:
+ * set r1, r2, r1End and r2End appropriately, save the rectangles
+ * of the destination region until the end in case it's one of
+ * the two source regions, then mark the "new" region empty, allocating
+ * another array of rectangles for it to use.
+ */
+
+ r1 = XIEREGION_RECTS(reg1);
+ newSize = XIEREGION_NUM_RECTS(reg1);
+ r1End = r1 + newSize;
+ numRects = XIEREGION_NUM_RECTS(reg2);
+ r2 = XIEREGION_RECTS(reg2);
+ r2End = r2 + numRects;
+ assert(r1 != r1End);
+ assert(r2 != r2End);
+
+ oldData = (XieRegDataPtr)NULL;
+ if (((newReg == reg1) && (newSize > 1)) ||
+ ((newReg == reg2) && (numRects > 1)))
+ {
+ oldData = newReg->data;
+ newReg->data = &EmptyData;
+ }
+ /* guess at new size */
+ if (numRects > newSize)
+ newSize = numRects;
+ newSize <<= 1;
+ if (!newReg->data)
+ newReg->data = &EmptyData;
+ else if (newReg->data->size)
+ newReg->data->numRects = 0;
+ if (newSize > newReg->data->size)
+ miXieRectAlloc(newReg, newSize);
+
+ /*
+ * Initialize ybot.
+ * In the upcoming loop, ybot and ytop serve different functions depending
+ * on whether the band being handled is an overlapping or non-overlapping
+ * band.
+ * In the case of a non-overlapping band (only one of the regions
+ * has points in the band), ybot is the bottom of the most recent
+ * intersection and thus clips the top of the rectangles in that band.
+ * ytop is the top of the next intersection between the two regions and
+ * serves to clip the bottom of the rectangles in the current band.
+ * For an overlapping band (where the two regions intersect), ytop clips
+ * the top of the rectangles of both regions and ybot clips the bottoms.
+ */
+
+ ybot = min(r1->y1, r2->y1);
+
+ /*
+ * prevBand serves to mark the start of the previous band so rectangles
+ * can be coalesced into larger rectangles. qv. miXieCoalesce, above.
+ * In the beginning, there is no previous band, so prevBand == curBand
+ * (curBand is set later on, of course, but the first band will always
+ * start at index 0). prevBand and curBand must be indices because of
+ * the possible expansion, and resultant moving, of the new region's
+ * array of rectangles.
+ */
+ prevBand = 0;
+
+ do {
+ /*
+ * This algorithm proceeds one source-band (as opposed to a
+ * destination band, which is determined by where the two regions
+ * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
+ * rectangle after the last one in the current band for their
+ * respective regions.
+ */
+ assert(r1 != r1End);
+ assert(r2 != r2End);
+
+ FindBand(r1, r1BandEnd, r1End, r1y1);
+ FindBand(r2, r2BandEnd, r2End, r2y1);
+
+ /*
+ * First handle the band that doesn't intersect, if any.
+ *
+ * Note that attention is restricted to one band in the
+ * non-intersecting region at once, so if a region has n
+ * bands between the current position and the next place it overlaps
+ * the other, this entire loop will be passed through n times.
+ */
+ if (r1y1 < r2y1) {
+ if (appendNon1) {
+ top = max(r1y1, ybot);
+ bot = min(r1->y2, r2y1);
+ if (top != bot) {
+ curBand = newReg->data->numRects;
+ miXieAppendNonO(newReg, r1, r1BandEnd, top, bot);
+ Coalesce(newReg, prevBand, curBand);
+ }
+ }
+ ytop = r2y1;
+ } else if (r2y1 < r1y1) {
+ if (appendNon2) {
+ top = max(r2y1, ybot);
+ bot = min(r2->y2, r1y1);
+ if (top != bot) {
+ curBand = newReg->data->numRects;
+ miXieAppendNonO(newReg, r2, r2BandEnd, top, bot);
+ Coalesce(newReg, prevBand, curBand);
+ }
+ }
+ ytop = r1y1;
+ } else {
+ ytop = r1y1;
+ }
+
+ /*
+ * Now see if we've hit an intersecting band. The two bands only
+ * intersect if ybot > ytop
+ */
+ ybot = min(r1->y2, r2->y2);
+ if (ybot > ytop) {
+ curBand = newReg->data->numRects;
+ (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
+ pOverlap);
+ Coalesce(newReg, prevBand, curBand);
+ }
+
+ /*
+ * If we've finished with a band (y2 == ybot) we skip forward
+ * in the region to the next band.
+ */
+ if (r1->y2 == ybot) r1 = r1BandEnd;
+ if (r2->y2 == ybot) r2 = r2BandEnd;
+
+ } while (r1 != r1End && r2 != r2End);
+
+ /*
+ * Deal with whichever region (if any) still has rectangles left.
+ *
+ * We only need to worry about banding and coalescing for the very first
+ * band left. After that, we can just group all remaining boxes,
+ * regardless of how many bands, into one final append to the list.
+ */
+
+ if ((r1 != r1End) && appendNon1) {
+ /* Do first nonOverlap1Func call, which may be able to coalesce */
+ FindBand(r1, r1BandEnd, r1End, r1y1);
+ curBand = newReg->data->numRects;
+ miXieAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
+ Coalesce(newReg, prevBand, curBand);
+ /* Just append the rest of the boxes */
+ AppendRegions(newReg, r1BandEnd, r1End);
+
+ } else if ((r2 != r2End) && appendNon2) {
+ /* Do first nonOverlap2Func call, which may be able to coalesce */
+ FindBand(r2, r2BandEnd, r2End, r2y1);
+ curBand = newReg->data->numRects;
+ miXieAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
+ Coalesce(newReg, prevBand, curBand);
+ /* Append rest of boxes */
+ AppendRegions(newReg, r2BandEnd, r2End);
+ }
+
+ if (oldData)
+ XieFree(oldData);
+
+ if (!(numRects = newReg->data->numRects))
+ {
+ xfreeData(newReg);
+ newReg->data = &EmptyData;
+ }
+ else if (numRects == 1)
+ {
+ newReg->extents = *XIEREGION_BOXPTR(newReg);
+ xfreeData(newReg);
+ newReg->data = (XieRegDataPtr)NULL;
+ }
+ else
+ {
+ DOWNSIZE(newReg, numRects);
+ }
+
+ return TRUE;
+}
+
+#define MERGERECT(r) \
+{ \
+ if (r->x1 <= x2) { \
+ /* Merge with current rectangle */ \
+ if (r->x1 < x2) *pOverlap = TRUE; \
+ if (x2 < r->x2) x2 = r->x2; \
+ } else { \
+ /* Add current rectangle, start new one */ \
+ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \
+ x1 = r->x1; \
+ x2 = r->x2; \
+ } \
+ r++; \
+}
+
+/*======================================================================
+ * XieRegion Union
+ *====================================================================*/
+
+/*-
+ *-----------------------------------------------------------------------
+ * miXieUnionO --
+ * Handle an overlapping band for the union operation. Picks the
+ * left-most rectangle each time and merges it into the region.
+ *
+ * Results:
+ * TRUE if successful.
+ *
+ * Side Effects:
+ * pReg is overwritten.
+ * pOverlap is set to TRUE if any boxes overlap.
+ *
+ *-----------------------------------------------------------------------
+ */
+static Bool
+miXieUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
+ register XieRegionPtr pReg;
+ register XieBoxPtr r1;
+ XieBoxPtr r1End;
+ register XieBoxPtr r2;
+ XieBoxPtr r2End;
+ INT32 y1;
+ INT32 y2;
+ Bool *pOverlap;
+{
+ register XieBoxPtr pNextRect;
+ register int x1; /* left and right side of current union */
+ register int x2;
+
+ assert (y1 < y2);
+ assert(r1 != r1End && r2 != r2End);
+
+ pNextRect = XIEREGION_TOP(pReg);
+
+ /* Start off current rectangle */
+ if (r1->x1 < r2->x1)
+ {
+ x1 = r1->x1;
+ x2 = r1->x2;
+ r1++;
+ }
+ else
+ {
+ x1 = r2->x1;
+ x2 = r2->x2;
+ r2++;
+ }
+ while (r1 != r1End && r2 != r2End)
+ {
+ if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2);
+ }
+
+ /* Finish off whoever (if any) is left */
+ if (r1 != r1End)
+ {
+ do
+ {
+ MERGERECT(r1);
+ } while (r1 != r1End);
+ }
+ else if (r2 != r2End)
+ {
+ do
+ {
+ MERGERECT(r2);
+ } while (r2 != r2End);
+ }
+
+ /* Add current rectangle */
+ NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
+
+ return TRUE;
+}
+
+#define ExchangeRects(a, b) \
+{ \
+ XieBoxRec t; \
+ t = rects[a]; \
+ rects[a] = rects[b]; \
+ rects[b] = t; \
+}
+
+static void
+QuickSortRects(rects, numRects)
+ register XieBoxRec rects[];
+ register int numRects;
+{
+ register int y1;
+ register int x1;
+ register int i, j;
+ register XieBoxPtr r;
+
+ /* Always called with numRects > 1 */
+
+ do
+ {
+ if (numRects == 2)
+ {
+ if (rects[0].y1 > rects[1].y1 ||
+ (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
+ ExchangeRects(0, 1);
+ return;
+ }
+
+ /* Choose partition element, stick in location 0 */
+ ExchangeRects(0, numRects >> 1);
+ y1 = rects[0].y1;
+ x1 = rects[0].x1;
+
+ /* Partition array */
+ i = 0;
+ j = numRects;
+ do
+ {
+ r = &(rects[i]);
+ do
+ {
+ r++;
+ i++;
+ } while (i != numRects &&
+ (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
+ r = &(rects[j]);
+ do
+ {
+ r--;
+ j--;
+ } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
+ if (i < j)
+ ExchangeRects(i, j);
+ } while (i < j);
+
+ /* Move partition element back to middle */
+ ExchangeRects(0, j);
+
+ /* Recurse */
+ if (numRects-j-1 > 1)
+ QuickSortRects(&rects[j+1], numRects-j-1);
+ numRects = j;
+ } while (numRects > 1);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * miXieRegionValidate --
+ *
+ * Take a ``region'' which is a non-y-x-banded random collection of
+ * rectangles, and compute a nice region which is the union of all the
+ * rectangles.
+ *
+ * Results:
+ * TRUE if successful.
+ *
+ * Side Effects:
+ * The passed-in ``region'' may be modified.
+ * pOverlap set to TRUE if any retangles overlapped, else FALSE;
+ *
+ * Strategy:
+ * Step 1. Sort the rectangles into ascending order with primary key y1
+ * and secondary key x1.
+ *
+ * Step 2. Split the rectangles into the minimum number of proper y-x
+ * banded regions. This may require horizontally merging
+ * rectangles, and vertically coalescing bands. With any luck,
+ * this step in an identity tranformation (ala the Box widget),
+ * or a coalescing into 1 box (ala Menus).
+ *
+ * Step 3. Merge the separate regions down to a single region by calling
+ * miXieUnion. Maximize the work each miXieUnion call does by using
+ * a binary merge.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+Bool
+miXieRegionValidate(badreg, pOverlap)
+ XieRegionPtr badreg;
+ Bool *pOverlap;
+{
+ /* Descriptor for regions under construction in Step 2. */
+ typedef struct {
+ XieRegionRec reg;
+ int prevBand;
+ int curBand;
+ } XieRegionInfo;
+
+ int numRects; /* Original numRects for badreg */
+ XieRegionInfo *ri; /* Array of current regions */
+ int numRI; /* Number of entries used in ri */
+ int sizeRI; /* Number of entries available in ri */
+ int i; /* Index into rects */
+ register int j; /* Index into ri */
+ register XieRegionInfo *rit; /* &ri[j] */
+ register XieRegionPtr reg; /* ri[j].reg */
+ register XieBoxPtr box; /* Current box in rects */
+ register XieBoxPtr riBox; /* Last box in ri[j].reg */
+ register XieRegionPtr hreg; /* ri[j_half].reg */
+
+ *pOverlap = FALSE;
+ if (!badreg->data)
+ {
+ good(badreg);
+ return TRUE;
+ }
+ numRects = badreg->data->numRects;
+ if (!numRects)
+ {
+ good(badreg);
+ return TRUE;
+ }
+ if (badreg->extents.x1 < badreg->extents.x2)
+ {
+ if ((numRects) == 1)
+ {
+ xfreeData(badreg);
+ badreg->data = (XieRegDataPtr) NULL;
+ }
+ else
+ {
+ DOWNSIZE(badreg, numRects);
+ }
+ good(badreg);
+ return TRUE;
+ }
+
+ /* Step 1: Sort the rects array into ascending (y1, x1) order */
+ QuickSortRects(XIEREGION_BOXPTR(badreg), numRects);
+
+ /* Step 2: Scatter the sorted array into the minimum number of regions */
+
+ /* Set up the first region to be the first rectangle in badreg */
+ /* Note that step 2 code will never overflow the ri[0].reg rects array */
+ Must_have_memory = TRUE; /* XXX */
+ ri = (XieRegionInfo *) XieMalloc(4 * sizeof(XieRegionInfo));
+ Must_have_memory = FALSE; /* XXX */
+ sizeRI = 4;
+ numRI = 1;
+ ri[0].prevBand = 0;
+ ri[0].curBand = 0;
+ ri[0].reg = *badreg;
+ box = XIEREGION_BOXPTR(&ri[0].reg);
+ ri[0].reg.extents = *box;
+ ri[0].reg.data->numRects = 1;
+
+ /* Now scatter rectangles into the minimum set of valid regions. If the
+ next rectangle to be added to a region would force an existing rectangle
+ in the region to be split up in order to maintain y-x banding, just
+ forget it. Try the next region. If it doesn't fit cleanly into any
+ region, make a new one. */
+
+ for (i = numRects; --i > 0;)
+ {
+ box++;
+ /* Look for a region to append box to */
+ for (j = numRI, rit = ri; --j >= 0; rit++)
+ {
+ reg = &rit->reg;
+ riBox = XIEREGION_END(reg);
+
+ if (box->y1 == riBox->y1 && box->y2 == riBox->y2)
+ {
+ /* box is in same band as riBox. Merge or append it */
+ if (box->x1 <= riBox->x2)
+ {
+ /* Merge it with riBox */
+ if (box->x1 < riBox->x2) *pOverlap = TRUE;
+ if (box->x2 > riBox->x2) riBox->x2 = box->x2;
+ }
+ else
+ {
+ RECTALLOC(reg, 1);
+ *XIEREGION_TOP(reg) = *box;
+ reg->data->numRects++;
+ }
+ goto NextRect; /* So sue me */
+ }
+ else if (box->y1 >= riBox->y2)
+ {
+ /* Put box into new band */
+ if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
+ if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
+ Coalesce(reg, rit->prevBand, rit->curBand);
+ rit->curBand = reg->data->numRects;
+ RECTALLOC(reg, 1);
+ *XIEREGION_TOP(reg) = *box;
+ reg->data->numRects++;
+ goto NextRect;
+ }
+ /* Well, this region was inappropriate. Try the next one. */
+ } /* for j */
+
+ /* Uh-oh. No regions were appropriate. Create a new one. */
+ if (sizeRI == numRI)
+ {
+ /* Oops, allocate space for new region information */
+ sizeRI <<= 1;
+ Must_have_memory = TRUE; /* XXX */
+ ri = (XieRegionInfo *) XieRealloc(ri, sizeRI * sizeof(XieRegionInfo));
+ Must_have_memory = FALSE; /* XXX */
+ rit = &ri[numRI];
+ }
+ numRI++;
+ rit->prevBand = 0;
+ rit->curBand = 0;
+ rit->reg.extents = *box;
+ rit->reg.data = (XieRegDataPtr)NULL;
+ miXieRectAlloc(&rit->reg, (i+numRI) / numRI); /* MUST force allocation */
+NextRect: ;
+ } /* for i */
+
+ /* Make a final pass over each region in order to Coalesce and set
+ extents.x2 and extents.y2 */
+
+ for (j = numRI, rit = ri; --j >= 0; rit++)
+ {
+ reg = &rit->reg;
+ riBox = XIEREGION_END(reg);
+ reg->extents.y2 = riBox->y2;
+ if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
+ Coalesce(reg, rit->prevBand, rit->curBand);
+ if (reg->data->numRects == 1) /* keep unions happy below */
+ {
+ xfreeData(reg);
+ reg->data = (XieRegDataPtr)NULL;
+ }
+ }
+
+ /* Step 3: Union all regions into a single region */
+ while (numRI > 1)
+ {
+ int half = numRI/2;
+ for (j = numRI & 1; j < (half + (numRI & 1)); j++)
+ {
+ reg = &ri[j].reg;
+ hreg = &ri[j+half].reg;
+ miXieRegionOp(reg, reg, hreg, miXieUnionO, TRUE, TRUE, pOverlap);
+ if (hreg->extents.x1 < reg->extents.x1)
+ reg->extents.x1 = hreg->extents.x1;
+ if (hreg->extents.y1 < reg->extents.y1)
+ reg->extents.y1 = hreg->extents.y1;
+ if (hreg->extents.x2 > reg->extents.x2)
+ reg->extents.x2 = hreg->extents.x2;
+ if (hreg->extents.y2 > reg->extents.y2)
+ reg->extents.y2 = hreg->extents.y2;
+ xfreeData(hreg);
+ }
+ numRI -= half;
+ }
+ *badreg = ri[0].reg;
+ XieFree(ri);
+ good(badreg);
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/XIE/mixie/import/miroi.c b/xc/programs/Xserver/XIE/mixie/import/miroi.c
new file mode 100644
index 000000000..d6432e94e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/miroi.c
@@ -0,0 +1,229 @@
+/* $TOG: miroi.c /main/6 1998/02/09 16:17:16 kaleb $ */
+/**** module miroi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miroi.c -- DDXIE prototype import client roi element
+
+ Robert NC Shelley -- AGE Logic, Inc. April, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/miroi.c,v 3.3 1998/10/05 13:22:37 dawes Exp $ */
+
+#define _XIEC_MIROI
+#define _XIEC_IROI
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <roi.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeIROI();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateIROI();
+static int InitializeIROI();
+static int ActivateIROI();
+static int ResetIROI();
+static int DestroyIROI();
+
+/*
+ * DDXIE ImportROI entry points
+ */
+static ddElemVecRec miROIVec = {
+ CreateIROI,
+ InitializeIROI,
+ ActivateIROI,
+ (xieIntProc)NULL,
+ ResetIROI,
+ DestroyIROI
+ };
+
+/*
+ * Private stuff. peTex extension for the ImportClientROI element.
+ */
+typedef struct _miroidef {
+ stripPtr next_strip;
+}
+miROIDefRec, *miROIDefPtr;
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeIROI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = miROIVec;
+ return TRUE ;
+} /* end miAnalyzeIROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateIROI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the roi element definition */
+ return MakePETex(flo,ped,sizeof(miROIDefRec),NO_SYNC,NO_SYNC);
+} /* end CreateIROI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeIROI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ roiPtr roi = ((iROIDefPtr)ped->elemPvt)->roi;
+ miROIDefPtr pvt = (miROIDefPtr)ped->peTex->private;
+
+ pvt->next_strip = roi->strips.flink;
+
+ return InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+} /* end InitializeIROI */
+
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateIROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ miROIDefPtr pvt = (miROIDefPtr)pet->private;
+ bandPtr bnd = &pet->emitter[0];
+
+ /* pass a clone of the current/only strip to our recipients */
+
+ if(!PassStrip(flo,pet,bnd,pvt->next_strip))
+ return FALSE; /* alloc error */
+
+ return TRUE;
+} /* end ActivateIROI */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetIROI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetEmitter(ped);
+ return TRUE;
+} /* end ResetIROI */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyIROI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+ return TRUE;
+} /* end DestroyIROI */
+
+/* end module miroi.c */
+
diff --git a/xc/programs/Xserver/XIE/mixie/import/miuncomp.c b/xc/programs/Xserver/XIE/mixie/import/miuncomp.c
new file mode 100644
index 000000000..777c57f54
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/import/miuncomp.c
@@ -0,0 +1,956 @@
+/* $TOG: miuncomp.c /main/5 1998/02/09 16:17:20 kaleb $ */
+/**** module miuncomp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miuncomp.c -- DDXIE routines for importing uncompressed data
+
+ Dean Verheiden -- AGE Logic, Inc. September 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/import/miuncomp.c,v 1.4 1998/10/25 07:11:58 dawes Exp $ */
+
+#define _XIEC_MIUNCOMP
+
+/*
+ * Include files
+ */
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <miuncomp.h>
+
+/***********************************************************************/
+/****************** Aligned data conversion routines *******************/
+/***********************************************************************/
+
+/* Single band action routines */
+
+void CPreverse_bits(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 i;
+ count = (count + 7) >> 3;/* Pack down to bits */
+
+ src += leftpad>>3;
+ for (i = 0; i < count; i++) *dst++ = _ByteReverseTable[*src++];
+}
+
+void CPpass_bits(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+ src += leftpad >> 3;
+ memcpy((char *)dst,(char *)src, (int)(count + 7) >> 3);
+}
+
+void CPextractstreambits(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 i,j;
+
+ bzero(dst, (count + 7) >> 3);
+
+ for (i = 0, j = leftpad; i < count; i++, j += stride) {
+ if (LOGBYTE_tstbit(src,j) != 0) {
+ LOGBYTE_setbit(dst,i);
+ }
+ }
+}
+
+void CPextractswappedstreambits(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 i,j,s;
+
+ bzero(dst, (count + 7) >> 3);
+
+ for (i = 0, j = leftpad; i < count; i++, j += stride) {
+ s = j ^ 7; /* Larry swap */
+ if (LOGBYTE_tstbit(src,s) != 0) {
+ LOGBYTE_setbit(dst,i);
+ }
+ }
+}
+
+
+void CPpass_bytes(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+ src += leftpad >> 3;
+ if (stride == 8)
+ memcpy((char *)dst, (char *)src, (int)count);
+ else {
+ CARD32 i;
+ CARD32 Bstride = stride >> 3;
+ for (i = 0; i < count; i++, src += Bstride)
+ *dst++ = *src;
+ }
+}
+
+void CPswap_pairs(
+ PairPixel *src,
+ PairPixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 i;
+ src += leftpad >> 4;
+ if (stride == 16) {
+ for (i = 0; i < count; i++) {
+ cpswaps(src[i],dst[i]);
+ }
+ } else {
+ int j;
+ CARD32 Bstride = stride >> 4;
+ for (i = 0, j = 0; i < count; i++, j += Bstride) {
+ cpswaps(src[j],dst[i]);
+ }
+ }
+}
+
+void CPpass_pairs(
+ PairPixel *src,
+ PairPixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+ src += leftpad >> 4;
+ if (stride == 16)
+ memcpy((char *)dst, (char *)src, (int)count << 1);
+ else {
+ CARD32 i,j;
+ CARD32 Bstride = stride >> 4;
+ for (i = 0, j = 0; i < count; i++, j += Bstride)
+ dst[i] = src[j];
+ }
+}
+
+void CPswap_quads(
+ QuadPixel *src,
+ QuadPixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 i;
+ src += leftpad >> 5;
+ if (stride == 32) {
+ for (i = 0; i < count; i++) {
+ cpswapl(src[i],dst[i]);
+ }
+ } else {
+ int j;
+ CARD32 Bstride = stride >> 5;
+ for (i = 0, j = 0; i < count; i++, j += Bstride) {
+ cpswapl(src[j],dst[i]);
+ }
+ }
+}
+
+void CPpass_quads(
+ QuadPixel *src,
+ QuadPixel *dst,
+ CARD32 count,
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+ src += leftpad >> 5;
+ if (stride == 32)
+ memcpy((char *)dst, (char *)src, (int)count << 2);
+ else {
+ CARD32 i,j;
+ CARD32 Bstride = stride >> 5;
+ for (i = 0, j = 0; i < count; i++, j += Bstride)
+ dst[i] = src[j];
+ }
+}
+
+#if XIE_FULL
+/* Triple Band Byte by Pixel Action routines */
+
+/* Stream bits to bits */
+void Sbtob(
+ BytePixel *src,
+ BytePixel *idst,
+ CARD32 count,
+ miUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD8 mask = pvt->mask;
+LogInt *dst = (LogInt *)idst;
+int i;
+
+ bzero(dst, (count + 7) >>3); /* zero out the output, only set ones */
+ src += pvt->srcoffset;
+ for (i = 0; i < count; i++, src += Bstride)
+ if ((*src & mask) != 0)
+ LOG_setbit(dst,i);
+}
+
+/* Stream in nibbles to BytePixels */
+void SbtoB(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ miUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD8 mask = pvt->mask;
+CARD8 shift = pvt->shift;
+CARD32 i;
+
+ src += pvt->srcoffset;
+ for (i = 0; i < count; i++, src += Bstride)
+ *dst++ = (*src & mask) >> shift;
+}
+
+/* Stream to BytePixel */
+void StoB(
+ BytePixel *src,
+ BytePixel *dst,
+ CARD32 count,
+ miUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD32 i;
+
+ src += pvt->srcoffset;
+ for (i = 0; i < count; i++, src += Bstride)
+ *dst++ = *src;
+}
+
+/* Stream to PairPixel (unswapped) */
+void StoP(
+ PairPixel *isrc,
+ PairPixel *dst,
+ CARD32 count,
+ miUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD8 *src = ((CARD8 *)isrc) + pvt->srcoffset;
+CARD32 i;
+ for (i = 0; i < count; i++, src += Bstride)
+ *dst++ = *(PairPixel *)src;
+}
+
+/* Stream to PairPixel (swapped) */
+void StosP(
+ PairPixel *isrc,
+ PairPixel *dst,
+ CARD32 count,
+ miUncompPtr pvt)
+{
+CARD32 Bstride = pvt->Bstride;
+CARD8 *src = ((CARD8 *)isrc) + pvt->srcoffset;
+CARD32 i;
+ for (i = 0; i < count; i++, src += Bstride) {
+ PairPixel sval = *(PairPixel *)src;
+ *dst++ = (sval >> 8) | (sval << 8);
+ }
+}
+
+#endif /* XIE_FULL */
+
+
+/***********************************************************************/
+/***************** Unaligned data conversion routines ******************/
+/***********************************************************************/
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = LSB, Fill Order = LSB */
+void LLUBtoB(
+ CARD8 *src, /* source byte stream */
+ BytePixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD8 bits, wval = 16 - depth, wval2 = 8 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 8)
+ *dst++ = *src >> bits | (CARD8)(*(src+1) << (wval - bits)) >> wval2;
+ else {
+ *dst++ = (CARD8)(*src << (wval2 - bits)) >> wval2;
+ }
+
+ if ((longbits += stride) > 7) {
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+ }
+}
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = LSB, Fill Order = MSB */
+void LMUBtoB(
+ CARD8 *src, /* source byte stream */
+ BytePixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD8 bits, wval = 16 - depth, wval2 = 8 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 8)
+ *dst++ = (CARD8)(*src << bits) >> bits |
+ (CARD8)(*(src + 1) >> (wval - bits)) << (8 - bits);
+ else
+ *dst++ = (CARD8)(*src << bits) >> wval2;
+
+ if ((longbits += stride) > 7) {
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+ }
+}
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = MSB, Fill Order = LSB */
+void MLUBtoB(
+ CARD8 *src, /* source byte stream */
+ BytePixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD8 bits, wval = 16 - depth, wval2 = 8 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 8)
+ *dst++ = (CARD8)(*src >> bits) << (depth + bits - 8) |
+ (CARD8)(*(src + 1) << (wval - bits)) >> (wval - bits);
+ else
+ *dst++ = (CARD8)(*src << (wval2 - bits)) >> wval2;
+
+ if ((longbits += stride) > 7) {
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+ }
+}
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = MSB, Fill Order = MSB */
+void MMUBtoB(
+ CARD8 *src, /* source byte stream */
+ BytePixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD8 bits, wval = 16 - depth, wval2 = 8 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 8)
+ *dst++ = (CARD8)(*src << bits) >> wval2 |
+ (CARD8)*(src + 1) >> (wval - bits);
+ else
+ *dst++ = (CARD8)(*src << bits) >> wval2;
+
+ if ((longbits += stride) > 7) {
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+ }
+}
+
+/* Convert a single plane of unaligned pair pixels to pair pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+void LLUPtoP(
+ CARD8 *src, /* source byte stream */
+ PairPixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD16 bits, wval1 = 32 - depth, wval2 = 24 - depth, wval3 = 16 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 16)
+ *dst++ = (CARD16)*src >> bits |
+ (CARD16)*(src + 1) << (8 - bits) |
+ (CARD16)((CARD16)*(src + 2) << (wval1 - bits)) >> wval3;
+ else
+ *dst++ = (CARD16)*src >> bits |
+ (CARD16)((CARD16)*(src + 1) << (wval2 - bits)) >> wval3;
+
+ longbits += stride;
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+}
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = LSB, Fill Order = MSB */
+void LMUPtoP(
+ CARD8 *src, /* source byte stream */
+ PairPixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD16 bits, wval2 = 24 - depth, wval3 = 16 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 16)
+ *dst++ = (CARD16)((CARD16)*src << (8 + bits)) >> (8 + bits) |
+ (CARD16)*(src + 1) << (8 - bits) |
+ (CARD16)((CARD16)*(src + 2) >> (wval2 - bits)) << (16 - bits);
+ else
+ *dst++ = (CARD16)((CARD16)*src << (8 + bits)) >> (8 + bits) |
+ (CARD16)((CARD16)*(src + 1) >> (wval3 - bits)) << (8 - bits);
+
+ longbits += stride;
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+}
+
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = MSB, Fill Order = LSB */
+void MLUPtoP(
+ CARD8 *src, /* source byte stream */
+ PairPixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD16 bits, wval1 = 32 - depth, wval2 = 24 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 16)
+ *dst++ = (CARD16)((CARD16)*src >> bits) << (depth + bits - 8) |
+ (CARD16)*(src + 1) << (depth + bits - 16) |
+ (CARD16)((CARD16)*(src + 2) << (wval1 - bits)) >>
+ (wval1 - bits);
+ else
+ *dst++ = (CARD16)((CARD16)*src >> bits) << (depth + bits - 8) |
+ (CARD16)((CARD16)*(src + 1) << (wval2 - bits))
+ >> (wval2 - bits);
+
+ longbits += stride;
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+}
+
+/* Convert a single plane of unaligned bytes to bytes */
+/* Pixel Order = MSB, Fill Order = MSB */
+void MMUPtoP(
+ CARD8 *src, /* source byte stream */
+ PairPixel *dst, /* destination byte stream */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, longbits;
+CARD16 bits, wval2 = 24 - depth, wval3 = 16 - depth;
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ longbits = leftpad & 7;
+ } else
+ longbits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ bits = longbits;
+ if (bits + depth > 16)
+ *dst++ = (CARD16)((CARD16)*src << (8 + bits)) >> (wval2 - bits) |
+ (CARD16)*(src + 1) << (depth + bits - 16) |
+ (CARD16)*(src + 2) >> (wval2 - bits);
+ else
+ *dst++ = (CARD16)((CARD16)*src << (8 + bits)) >> wval3 |
+ (CARD16)*(src + 1) >> (wval3 - bits);
+
+ longbits += stride;
+ src += longbits >> 3;
+ longbits &= 7;
+ }
+}
+
+
+/* Convert a single plane of unaligned quad pixels to quad pixels */
+/* Pixel Order = LSB, Fill Order = LSB */
+void LLUQtoQ(
+ CARD8 *src, /* source byte stream */
+ QuadPixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, bits, wval1 = 56 - depth, wval2 = 48 - depth, wval3 = 32 - depth;
+
+ /* Note: Maximum depth is 24 bits */
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ bits = leftpad & 7;
+ } else
+ bits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ if (bits + depth > 24)
+ *dst++ = (CARD32)*src >> bits |
+ (CARD32)*(src + 1) << (8 - bits) |
+ (CARD32)*(src + 2) << (16 - bits) |
+ ((CARD32)*(src + 3) << (wval1 - bits)) >> wval3;
+ else
+ *dst++ = (CARD32)*src >> bits |
+ (CARD32)*(src + 1) << (8 - bits) |
+ ((CARD32)*(src + 2) << (wval2 - bits)) >> wval3;
+
+ bits += stride;
+ src += bits >> 3;
+ bits &= 7;
+ }
+}
+
+/* Convert a single plane of unaligned quad pixels to quad pixels */
+/* Pixel Order = LSB, Fill Order = MSB */
+void LMUQtoQ(
+ CARD8 *src, /* source byte stream */
+ QuadPixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, bits, wval1 = 32 - depth, wval2 = 24 - depth;
+
+ /* Note: Maximum depth is 24 bits */
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ bits = leftpad & 7;
+ } else
+ bits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ if (bits + depth > 24)
+ *dst++ = ((CARD32)*src << (24 + bits)) >> (24 + bits) |
+ (CARD32)*(src + 1) << (8 - bits) |
+ (CARD32)*(src + 2) << (16 - bits) |
+ ((CARD32)*(src + 3) >> (wval1 - bits)) << (24 - bits);
+ else
+ *dst++ = ((CARD32)*src << (24 + bits)) >> (24 + bits) |
+ (CARD32)*(src + 1) << (8 - bits) |
+ ((CARD32)*(src + 2) >> (wval2 - bits)) << (16 - bits);
+
+ bits += stride;
+ src += bits >> 3;
+ bits &= 7;
+ }
+}
+
+/* Convert a single plane of unaligned quad pixels to quad pixels */
+/* Pixel Order = MSB, Fill Order = LSB */
+void MLUQtoQ(
+ CARD8 *src, /* source byte stream */
+ QuadPixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, bits, wval1 = 56 - depth, wval2 = 48 - depth;
+
+ /* Note: Maximum depth is 24 bits */
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ bits = leftpad & 7;
+ } else
+ bits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ if (bits + depth > 24)
+ *dst++ = ((CARD32)*src >> bits) << (depth + bits - 8) |
+ (CARD32)*(src + 1) << (depth + bits - 16) |
+ (CARD32)*(src + 2) << (depth + bits - 24) |
+ ((CARD32)*(src + 3) << (wval1 - bits)) >> (wval1 - bits);
+ else
+ *dst++ = ((CARD32)*src >> bits) << (depth + bits - 8) |
+ (CARD32)*(src + 1) << (depth + bits - 16) |
+ ((CARD32)*(src + 2) << (wval2 - bits)) >> (wval2 - bits);
+
+ bits += stride;
+ src += bits >> 3;
+ bits &= 7;
+ }
+}
+
+/* Convert a single plane of unaligned quad pixels to quad pixels */
+/* Pixel Order = MSB, Fill Order = MSB */
+void MMUQtoQ(
+ CARD8 *src, /* source byte stream */
+ QuadPixel *dst, /* destination line */
+ CARD32 numcmp, /* number of pixels on to be converted */
+ CARD32 leftpad, /* bit offset to start of first pixel */
+ CARD32 depth, /* number of bits per pixel */
+ CARD32 stride) /* number of bits needed for this band */
+{
+CARD32 p, bits, wval1 = 56 - depth, wval2 = 32 - depth;
+
+ /* Note: Maximum depth is 24 bits */
+
+ if (leftpad > 7) {
+ src += leftpad >> 3;
+ bits = leftpad & 7;
+ } else
+ bits = leftpad;
+
+ for (p = 0; p < numcmp; p++) {
+ if (bits + depth > 24)
+ *dst++ = ((CARD32)*src << (24 + bits) >> wval2) |
+ (CARD32)*(src + 1) << (depth + bits - 16) |
+ (CARD32)*(src + 2) << (depth + bits - 24) |
+ (CARD32)*(src + 3) >> (wval2 - bits);
+ else
+ *dst++ = ((CARD32)*src << (24 + bits) >> wval2) |
+ (CARD32)*(src + 1) << (depth + bits - 16) |
+ (CARD32)*(src + 2) >> (wval1 - bits);
+
+ bits += stride;
+ src += bits >> 3;
+ bits &= 7;
+ }
+}
+
+#if XIE_FULL
+/* Triple band by pixel single unaligned pixel extraction routines */
+
+#define getLLByte(src,bits,depth) \
+ (BytePixel)((bits + depth > 8) ? \
+ (*src >> bits | (CARD8)(*(src + 1) \
+ << (16 - depth - bits)) >> (8 - depth)) : \
+ ((CARD8)(*src << (8 - depth - bits)) >> (8 - depth)))
+
+#define getLMByte(src,bits,depth) \
+ (BytePixel)((bits + depth > 8) ? \
+ ((CARD8)(*src << bits) >> bits | \
+ (CARD8)(*(src + 1) >> (16 - depth - bits)) << (8 - bits)) : \
+ ((CARD8)(*src << bits) >> (8 - depth)))
+
+#define getMLByte(src,bits,depth) \
+ (BytePixel)((bits + depth > 8) ? \
+ ((CARD8)(*src >> bits) << (depth + bits - 8) | \
+ (CARD8)(*(src + 1) << (16 - depth - bits)) \
+ >> (16 - depth - bits)) : \
+ ((CARD8)(*src << (8 - depth - bits)) >> (8 - depth)))
+
+#define getMMByte(src,bits,depth) \
+ (BytePixel)((bits + depth > 8) ? \
+ ((CARD8)(*src << bits) >> (8 - depth) | \
+ (CARD8)*(src + 1) >> (16 - depth - bits)) : \
+ ((CARD8)(*src << bits) >> (8 - depth)))
+
+#define getLLPair(src,bits,depth) \
+ (PairPixel)((bits + depth > 16) ? \
+ ((CARD16)*src >> bits | \
+ (CARD16)*(src + 1) << (8 - bits) | \
+ (CARD16)((CARD16)*(src + 2) << (32 - depth - bits))\
+ >> (16 - depth)) : \
+ ((CARD16)*src >> bits | \
+ (CARD16)((CARD16)*(src + 1) \
+ << (24 - depth - bits)) >> (16 - depth)))
+
+#define getLMPair(src,bits,depth) \
+ (PairPixel)((bits + depth > 16) ? \
+ ((CARD16)((CARD16)*src << (8 + bits)) >> (8 + bits) | \
+ (CARD16)*(src + 1) << (8 - bits) | \
+ (CARD16)((CARD16)*(src + 2) >> (24 - depth - bits))\
+ << (16 - bits)) : \
+ ((CARD16)((CARD16)*src << (8 + bits)) >> (8 + bits) | \
+ (CARD16)((CARD16)*(src + 1) >> (16 - depth - bits))\
+ << (8 - bits)))
+
+#define getMLPair(src,bits,depth) \
+ (PairPixel)((bits + depth > 16) ? \
+ ((CARD16)((CARD16)*src >> bits) << (depth + bits - 8) | \
+ (CARD16)*(src + 1) << (depth + bits - 16) | \
+ (CARD16)((CARD16)*(src + 2) << \
+ (32 - depth - bits)) >> (32 - depth - bits)) : \
+ ((CARD16)((CARD16)*src >> bits) << (depth + bits - 8) | \
+ (CARD16)((CARD16)*(src + 1) << (24 - depth - bits))\
+ >> (24 - depth - bits)))
+
+#define getMMPair(src,bits,depth) \
+ (PairPixel)((bits + depth > 16) ? \
+ ((CARD16)((CARD16)*src << (8 + bits)) >> (16 - depth) | \
+ (CARD16)*(src + 1) << (depth + bits - 16) | \
+ (CARD16)*(src + 2) >> (24 - depth - bits)) : \
+ ((CARD16)((CARD16)*src << (8 + bits)) >> (16 - depth) | \
+ (CARD16)*(src + 1) >> (16 - depth - bits)))
+
+
+/* Convert a triple band by pixel line to three lines of BytePixels */
+#define ProtoThree(fname,dtype0,dtype1,dtype2) \
+void fname( \
+ CARD8 *src0, /* source byte stream */ \
+ dtype0 *dst0, /* destination line */ \
+ dtype1 *dst1, /* destination line */ \
+ dtype2 *dst2, /* destination line */ \
+ CARD32 numcmp, /* number of triple pixels on to be converted */ \
+ CARD32 leftpad, /* bit offset to start of first pixel */ \
+ CARD32 depth0, /* number of bits per pixel */ \
+ CARD32 depth1, /* number of bits per pixel */ \
+ CARD32 depth2, /* number of bits per pixel */ \
+ CARD32 stride /* number of bits between triples */ \
+ )
+
+#define ExtractThree(fname,dtype0,dtype1,dtype2,extract0,extract1,extract2) \
+extern ProtoThree(fname,dtype0,dtype1,dtype2); \
+ProtoThree(fname,dtype0,dtype1,dtype2) \
+{ \
+CARD32 p, bits; \
+ if (leftpad > 7) { \
+ src0 += (leftpad >> 3); \
+ bits = (leftpad & 7); \
+ } else \
+ bits = leftpad; \
+ for (p = 0; p < numcmp; p++) { \
+ CARD32 offset1 = (bits + depth0) & 7; \
+ CARD32 offset2 = (bits + depth0 + depth1) & 7; \
+ CARD8 *src1 = src0 + ((bits + depth0) >> 3); \
+ CARD8 *src2 = src0 + ((bits + depth0 + depth1) >> 3); \
+ *dst0++ = extract0(src0, bits, depth0); \
+ *dst1++ = extract1(src1, offset1, depth1); \
+ *dst2++ = extract2(src2, offset2, depth2); \
+ if ((bits += stride) > 7) { \
+ src0 += (bits >> 3); \
+ bits &= 7; \
+ } \
+ } \
+}
+
+ExtractThree(LLTBtoBBB,BytePixel,BytePixel,BytePixel,getLLByte,getLLByte,getLLByte)
+ExtractThree(LLTBtoBBP,BytePixel,BytePixel,PairPixel,getLLByte,getLLByte,getLLPair)
+ExtractThree(LLTBtoBPB,BytePixel,PairPixel,BytePixel,getLLByte,getLLPair,getLLByte)
+ExtractThree(LLTBtoBPP,BytePixel,PairPixel,PairPixel,getLLByte,getLLPair,getLLPair)
+
+ExtractThree(LLTBtoPBB,PairPixel,BytePixel,BytePixel,getLLPair,getLLByte,getLLByte)
+ExtractThree(LLTBtoPBP,PairPixel,BytePixel,PairPixel,getLLPair,getLLByte,getLLPair)
+ExtractThree(LLTBtoPPB,PairPixel,PairPixel,BytePixel,getLLPair,getLLPair,getLLByte)
+ExtractThree(LLTBtoPPP,PairPixel,PairPixel,PairPixel,getLLPair,getLLPair,getLLPair)
+
+ExtractThree(LMTBtoBBB,BytePixel,BytePixel,BytePixel,getLMByte,getLMByte,getLMByte)
+ExtractThree(LMTBtoBBP,BytePixel,BytePixel,PairPixel,getLMByte,getLMByte,getLMPair)
+ExtractThree(LMTBtoBPB,BytePixel,PairPixel,BytePixel,getLMByte,getLMPair,getLMByte)
+ExtractThree(LMTBtoBPP,BytePixel,PairPixel,PairPixel,getLMByte,getLMPair,getLMPair)
+
+ExtractThree(LMTBtoPBB,PairPixel,BytePixel,BytePixel,getLMPair,getLMByte,getLMByte)
+ExtractThree(LMTBtoPBP,PairPixel,BytePixel,PairPixel,getLMPair,getLMByte,getLMPair)
+ExtractThree(LMTBtoPPB,PairPixel,PairPixel,BytePixel,getLMPair,getLMPair,getLMByte)
+ExtractThree(LMTBtoPPP,PairPixel,PairPixel,PairPixel,getLMPair,getLMPair,getLMPair)
+
+ExtractThree(MLTBtoBBB,BytePixel,BytePixel,BytePixel,getMLByte,getMLByte,getMLByte)
+ExtractThree(MLTBtoBBP,BytePixel,BytePixel,PairPixel,getMLByte,getMLByte,getMLPair)
+ExtractThree(MLTBtoBPB,BytePixel,PairPixel,BytePixel,getMLByte,getMLPair,getMLByte)
+ExtractThree(MLTBtoBPP,BytePixel,PairPixel,PairPixel,getMLByte,getMLPair,getMLPair)
+
+ExtractThree(MLTBtoPBB,PairPixel,BytePixel,BytePixel,getMLPair,getMLByte,getMLByte)
+ExtractThree(MLTBtoPBP,PairPixel,BytePixel,PairPixel,getMLPair,getMLByte,getMLPair)
+ExtractThree(MLTBtoPPB,PairPixel,PairPixel,BytePixel,getMLPair,getMLPair,getMLByte)
+ExtractThree(MLTBtoPPP,PairPixel,PairPixel,PairPixel,getMLPair,getMLPair,getMLPair)
+
+ExtractThree(MMTBtoBBB,BytePixel,BytePixel,BytePixel,getMMByte,getMMByte,getMMByte)
+ExtractThree(MMTBtoBBP,BytePixel,BytePixel,PairPixel,getMMByte,getMMByte,getMMPair)
+ExtractThree(MMTBtoBPB,BytePixel,PairPixel,BytePixel,getMMByte,getMMPair,getMMByte)
+ExtractThree(MMTBtoBPP,BytePixel,PairPixel,PairPixel,getMMByte,getMMPair,getMMPair)
+
+ExtractThree(MMTBtoPBB,PairPixel,BytePixel,BytePixel,getMMPair,getMMByte,getMMByte)
+ExtractThree(MMTBtoPBP,PairPixel,BytePixel,PairPixel,getMMPair,getMMByte,getMMPair)
+ExtractThree(MMTBtoPPB,PairPixel,PairPixel,BytePixel,getMMPair,getMMPair,getMMByte)
+ExtractThree(MMTBtoPPP,PairPixel,PairPixel,PairPixel,getMMPair,getMMPair,getMMPair)
+
+void (*ExtractTripleFuncs[2][2][2][2][2])() =
+{ { { { { LLTBtoBBB, LLTBtoBBP }, { LLTBtoBPB, LLTBtoBPP } },
+ { { LLTBtoPBB, LLTBtoPBP }, { LLTBtoPPB, LLTBtoPPP } } },
+ { { { LMTBtoBBB, LMTBtoBBP }, { LMTBtoBPB, LMTBtoBPP } },
+ { { LMTBtoPBB, LMTBtoPBP }, { LMTBtoPPB, LMTBtoPPP } } } },
+ { { { { MLTBtoBBB, MLTBtoBBP }, { MLTBtoBPB, MLTBtoBPP } },
+ { { MLTBtoPBB, MLTBtoPBP }, { MLTBtoPPB, MLTBtoPPP } } },
+ { { { MMTBtoBBB, MMTBtoBBP }, { MMTBtoBPB, MMTBtoBPP } },
+ { { MMTBtoPBB, MMTBtoPBP }, { MMTBtoPPB, MMTBtoPPP } } } } };
+#endif /* XIE_FULL */
+
+/* end module miuncomp.c */
+
+
diff --git a/xc/programs/Xserver/XIE/mixie/include/domain.h b/xc/programs/Xserver/XIE/mixie/include/domain.h
new file mode 100644
index 000000000..d954e833c
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/domain.h
@@ -0,0 +1,117 @@
+/* $TOG: domain.h /main/5 1998/02/09 16:17:25 kaleb $ */
+/**** module domain.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ domain.h -- DDXIE MI Process Domain definitions
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/domain.h,v 1.3 1998/10/25 12:47:56 dawes Exp $ */
+
+
+#ifndef _XIEH_DOMAIN
+#define _XIEH_DOMAIN
+
+#if !defined(_XIEC_DOMAIN)
+
+#define SyncDomain (*pet->roiinit)
+#define GetRun (*pet->roiget)
+
+extern Bool InitProcDomain(
+ floDefPtr flo,
+ peDefPtr ped,
+ xieTypPhototag dtag,
+ INT32 offX,
+ INT32 offY);
+extern void ResetProcDomain(peDefPtr ped);
+
+#endif /* ! defined _XIEC_DOMAIN */
+
+/*
+ * Rectangles of Interest structure definitions
+ */
+
+#define RUNPTR(idx) (&((runPtr)&lp[1])[idx])
+#define LEND(rband) ((linePtr)&rband->strip->data[rband->strip->length])
+
+typedef struct _runRec {
+ CARD32 dstart; /* delta to start of run */
+ CARD32 length; /* length of run */
+} runRec, *runPtr;
+
+typedef struct _linerec {
+ INT32 y; /* starting y coodinate of this y-x band */
+ CARD32 nline; /* height of y-x band */
+ CARD32 nrun; /* number of runRecs for this y-x band */
+/* runRec run[nrun]; */
+} lineRec, *linePtr;
+
+typedef struct _ROIrec {
+ INT32 x, y; /* min x and y coordinates of bounding box */
+ CARD32 width; /* width of bounding box */
+ CARD32 height; /* height of bounding box */
+ CARD32 nrects; /* number of rectangles in this ROI */
+ linePtr lend; /* first address past end of ROI table */
+} ROIRec, *ROIPtr;
+
+#endif /* module _XIEH_DOMAIN */
diff --git a/xc/programs/Xserver/XIE/mixie/include/fax.h b/xc/programs/Xserver/XIE/mixie/include/fax.h
new file mode 100644
index 000000000..0c8b5bd9d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/fax.h
@@ -0,0 +1,222 @@
+/* $TOG: fax.h /main/6 1998/02/09 16:17:29 kaleb $ */
+/**** module fax.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ fax.h -- DDXIE common include file for new spiffy fax modules
+
+ Ben Fahy -- AGE Logic, Inc. May 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/fax.h,v 1.2 1998/10/05 13:22:39 dawes Exp $ */
+
+#ifndef XFree86LOADER
+#include <stdio.h>
+#else
+#ifndef NULL
+#define NULL 0
+#endif
+#endif
+
+/*** entry points */
+extern int decode_g4();
+extern int decode_g32d();
+extern int decode_g31d();
+extern int decode_tiff2();
+extern int decode_tiffpb();
+
+/* must match what is in pretab.h */
+#define FAX_MODE_Unknown 0
+#define FAX_MODE_Pass 1
+#define FAX_MODE_Horizontal 2
+#define FAX_MODE_Vertical_L3 3
+#define FAX_MODE_Vertical_L2 4
+#define FAX_MODE_Vertical_L1 5
+#define FAX_MODE_Vertical_C0 6
+#define FAX_MODE_Vertical_R1 7
+#define FAX_MODE_Vertical_R2 8
+#define FAX_MODE_Vertical_R3 9
+
+/* extension stuff is optional, so not part of SI ***/
+#define FAX_MODE_Extension_1D FAX_MODE_Unknown
+#define FAX_MODE_Extension_2D FAX_MODE_Unknown
+
+#define FAX_GOAL_StartNewLine 12
+#define FAX_GOAL_DetermineMode 13
+#define FAX_GOAL_HandleVertL3 FAX_MODE_Vertical_L3
+#define FAX_GOAL_HandleVertL2 FAX_MODE_Vertical_L2
+#define FAX_GOAL_HandleVertL1 FAX_MODE_Vertical_L1
+#define FAX_GOAL_HandleVert0 FAX_MODE_Vertical_C0
+#define FAX_GOAL_HandleVertR1 FAX_MODE_Vertical_R1
+#define FAX_GOAL_HandleVertR2 FAX_MODE_Vertical_R2
+#define FAX_GOAL_HandleVertR3 FAX_MODE_Vertical_R3
+#define FAX_GOAL_HandlePass FAX_MODE_Pass
+#define FAX_GOAL_HandleHoriz FAX_MODE_Horizontal
+#define FAX_GOAL_AccumulateA0A1 14
+#define FAX_GOAL_RecordA0A1 15
+#define FAX_GOAL_AccumulateA1A2 16
+#define FAX_GOAL_RecordA1A2 17
+#define FAX_GOAL_FinishHoriz 18
+#define FAX_GOAL_SeekEOLandTag 19
+#define FAX_GOAL_SeekTagBit 20
+#define FAX_GOAL_AdjustTag 21
+#define FAX_GOAL_RecoverZero 22
+#define FAX_GOAL_AdjustedButStillRecovering 23
+#define FAX_GOAL_FoundOneEOL 24
+#define FAX_GOAL_SkipPastAnyToEOL 25
+#define FAX_GOAL_SeekFillAndEOL 26
+#define FAX_GOAL_FallOnSword 27
+
+#define FAX_DECODE_DONE_NOT 0
+#define FAX_DECODE_DONE_OK 1
+#define FAX_DECODE_DONE_ErrorSkipPast 2
+#define FAX_DECODE_DONE_ErrorBadFill 3
+#define FAX_DECODE_DONE_ErrorBadGoal 4
+#define FAX_DECODE_DONE_ErrorBadMagic 5
+#define FAX_DECODE_DONE_ErrorBadStripper 6
+#define FAX_DECODE_DONE_ErrorPastWidth 7
+#define FAX_DECODE_DONE_ErrorBadCode 8
+#define FAX_DECODE_DONE_ErrorBadPtr 9
+#define FAX_DECODE_DONE_ErrorBadZero 10
+#define FAX_DECODE_DONE_ErrorBada0a1 11
+#define FAX_DECODE_DONE_ErrorBada1a2 12
+#define FAX_DECODE_DONE_ErrorBadEOL 13
+#define FAX_DECODE_DONE_ErrorBadA0pos 14
+#define FAX_DECODE_DONE_ErrorPassAboveAllWhite 15
+#define FAX_DECODE_DONE_ErrorMissingEOL 16
+
+
+#define PB_GOAL_StartNewLine 0
+#define PB_GOAL_GetRunLength 1
+#define PB_GOAL_GetLiteralBytes 2
+#define PB_GOAL_GetRepeatByte 3
+#define PB_GOAL_RepeatBytes 4
+
+typedef struct _bit_stream {
+ int started; /* 0 if requires initialization */
+ unsigned char *byteptr; /* address of current byte in strip */
+ unsigned char *endptr; /* 1 past last byte in strip */
+ int bitpos; /* address of bit in byte (left->r) */
+} BitStream;
+
+#define StripStateNone 0 /* no strip available yet */
+#define StripStateNew 1 /* offered to decoder for first time */
+#define StripStateInUse 2 /* decoder is using the strip */
+#define StripStateDone 3 /* decoder is done with the strip */
+#define StripStateNoMore 4 /* that's all, folks. */
+
+typedef struct _fax_state {
+ int final; /* if final = 1, all input data is available */
+ int decoder_done;/* if done = 1, all data sent has been decoded */
+ int write_data; /* distinguish between decode only */
+ unsigned char *strip; /* latest available strip */
+ int strip_size; /* size of that strips */
+ int strip_state; /* whether strip is new, being used, or done */
+ int use_magic; /* 1 means we are using magic strip */
+ int magic_needs; /* 1 means magic strip only have filled */
+ unsigned char magicStrip[8];
+ /* "pretend" strip for handling strip edges */
+ int o_line; /* absolute output line position */
+ int nl_sought; /* how many lines we want, this decode round */
+ char **o_lines; /* pointers to beginning of output lines */
+ BitStream bits; /* definition of bitstream, current strip */
+ int goal; /* our current goal */
+ int a0_pos; /* starting changing position on coding line */
+ int a1_pos; /* next changing position to right of a0_pos */
+ int a0a1; /* distance from a0 to a1 */
+ int b1_pos; /* first change above and right of a0, ~color */
+ int b2_pos; /* next change above and right of a0, ao_color */
+ int a0_color; /* color of a0, either WHITE or BLACK */
+ int n_old_trans; /* number of transitions, line above us */
+ int *old_trans; /* list of transitions on line above us */
+ int n_new_trans; /* number of transitions, current line (so far)*/
+ int *new_trans; /* list of transitions on current line */
+ int last_b1_idx; /* index of last saved transition we looked at */
+ int length_acc; /* accumulates run-lengths for a0a1 or a1a2 */
+ int width; /* width of image. So we know end of line */
+ int g32d_horiz; /* only relevant for g32d encoding */
+ int rl; /* needed if I get EOL in get_a0a1 or get_a1a2 */
+ int radiometric; /* if 1, then expand white as 1, else 0 */
+} FaxState;
+
+/* these definitions should agree with what is in pretab.h */
+#define BAD_RUN_LENGTH (-1)
+#define EOL_RUN_LENGTH (-2)
+#define WHITE ( 0)
+#define BLACK (~WHITE)
+#define MIN_BYTES_NEEDED 7
+ /* sorry, we can't handle strips of less than 7 bytes. :-( */
+ /* it wreaks havoc with our magic strips if we try to go lower */
+
+#define WriteLineData(olp,w) \
+ zero_even(olp,new_trans,n_new_trans,w,state->radiometric);
+
+#define FlushLineData() \
+ { \
+ WriteLineData((char *)state->o_lines[lines_found],width); \
+ ++lines_found; \
+ }
+/*
+ note: I'm declaring this with no functions, so the caller won't
+ be tempted to call with lines_found++, which wouldn't work
+*/
+
+/**** module fax.h ****/
diff --git a/xc/programs/Xserver/XIE/mixie/include/floman.h b/xc/programs/Xserver/XIE/mixie/include/floman.h
new file mode 100644
index 000000000..78885be95
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/floman.h
@@ -0,0 +1,80 @@
+/* $TOG: floman.h /main/5 1998/02/09 16:17:33 kaleb $ */
+/**** module floman.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ floman.h -- DDXIE photoflo manager definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. May 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_FLOMAN
+#define _XIEH_FLOMAN
+
+#define Create(flo,ped) (*ped->ddVec.create)(flo,ped)
+#define Initialize(flo,ped) (*ped->ddVec.initialize)(flo,ped)
+#define Activate(flo,ped,pet) (*ped->ddVec.activate)(flo,ped,pet)
+#define Flush(flo,ped) (*ped->ddVec.flush)(flo,ped)
+#define Reset(flo,ped) (ped->peTex ? (*ped->ddVec.reset)(flo,ped) : 0)
+#define Destroy(flo,ped) (ped->peTex ? (*ped->ddVec.destroy)(flo,ped) : 0)
+
+#endif /* end _XIEH_FLOMAN */
diff --git a/xc/programs/Xserver/XIE/mixie/include/jpeg.h b/xc/programs/Xserver/XIE/mixie/include/jpeg.h
new file mode 100644
index 000000000..4e7dbf383
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/jpeg.h
@@ -0,0 +1,87 @@
+/* $TOG: jpeg.h /main/4 1998/02/09 16:17:46 kaleb $ */
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ jpeg.h -- DDXIE common include file for jpeg interface code
+
+ Ben Fahy -- AGE Logic, Inc. Oct 1993
+
+******************************************************************************/
+
+
+#ifndef XIE
+#define XIE
+#endif
+#include <jinclude.h>
+
+JSAMPIMAGE alloc_sampimage();
+
+#define JPEG_BUFFER_BufferError (-1)
+#define JPEG_BUFFER_BufferFilled 0
+#define JPEG_BUFFER_NeedAnotherStrip 1
+#define JPEG_BUFFER_LastBuffer 2
+
+#define JPEG_FLUSH_Error (-1)
+#define JPEG_FLUSH_FlushedAll 1
+#define JPEG_FLUSH_FlushedPart 2
+
+#include "jpegd.h"
+#include "jpege.h"
diff --git a/xc/programs/Xserver/XIE/mixie/include/jpegd.h b/xc/programs/Xserver/XIE/mixie/include/jpegd.h
new file mode 100644
index 000000000..9b29fa9bf
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/jpegd.h
@@ -0,0 +1,151 @@
+/* $TOG: jpegd.h /main/4 1998/02/09 16:17:37 kaleb $ */
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ jpegd.h - common include file for jpeg decoders
+
+ Ben Fahy -- AGE Logic, Inc. Oct 1993
+
+******************************************************************************/
+
+#define JPEG_DECODE_GOAL_Startup 0
+#define JPEG_DECODE_GOAL_Done 1
+#define JPEG_DECODE_GOAL_ReadDataForInit 2
+#define JPEG_DECODE_GOAL_TryToInit 3
+#define JPEG_DECODE_GOAL_InitDone 4
+#define JPEG_DECODE_GOAL_ProcessData 5
+#define JPEG_DECODE_GOAL_ReadDataForProcess 6
+#define JPEG_DECODE_GOAL_WriteDataForProcess 7
+#define JPEG_DECODE_GOAL_EndOfInput 8
+#define JPEG_DECODE_GOAL_FlushData 9
+
+#define JPEG_DECODE_ERROR_BadGoal 1
+#define JPEG_DECODE_ERROR_DecoderIsFreakingOut 2
+#define JPEG_DECODE_ERROR_CouldNotStart 3
+#define JPEG_DECODE_ERROR_CouldNotInit 4
+#define JPEG_DECODE_ERROR_BadInitRetCode 5
+#define JPEG_DECODE_ERROR_BadOutputAlloc 6
+#define JPEG_DECODE_ERROR_DecodeError 7
+#define JPEG_DECODE_ERROR_NoMoreProcessData 8
+#define JPEG_DECODE_ERROR_ColorMismatch 9
+#define JPEG_DECODE_ERROR_WidthMismatch 10
+#define JPEG_DECODE_ERROR_HeightMismatch 11
+
+typedef struct _jpeg_decode_state {
+ int goal; /* what to do next */
+ int error_code; /* ooops */
+
+ int up_sample; /* allow up-sampling or leave as is? */
+ int color; /* color image or grayscale? */
+ int width,height; /* available elsewhere, but I'm lazy */
+
+ int o_line; /* absolute output line position */
+ int nl_flushed; /* how many lines we have flusehd */
+ int nl_found; /* how many lines we have, this round */
+ unsigned char **o_lines[3];
+ /* pointers to output lines, 3 bands */
+
+ decompress_info_ptr cinfo;
+ /* decoder's private state */
+ decompress_methods_ptr dc_methods;
+ external_methods_ptr e_methods;
+ /* decoder's private methods */
+
+ unsigned char *jpeg_input_buffer;
+ unsigned char *jpeg_output_buffer;
+ /* names self-explanatory? */
+
+ int strip_size; /* size of currently available strip */
+ unsigned char *strip; /* start of currently available strip */
+ unsigned char *sptr; /* position within the strip */
+ int needs_input_strip; /* need a new strip */
+ int i_strip; /* input strip #. nice for debugging */
+ int o_strip; /* output strip #. nice for debugging */
+ int final; /* this is the last strip */
+ int no_more_strips; /* flag saying you can't have any more */
+
+} JpegDecodeState;
+
+extern int decode_jpeg_lossless_color(
+#ifdef NEED_PROTOTYPES
+ JPegDecodeState * /* state */
+#endif
+);
+
+extern int decode_jpeg_lossy_color(
+#ifdef NEED_PROTOTYPES
+ JPegDecodetSate * /* state */
+#endif
+);
+
+extern int decode_jpeg_lossless_gray(
+#ifdef NEED_PROTOTYPES
+ JPegDecodeState * /* state */
+#endif
+);
+
+extern int decode_jpeg_lossy_gray(
+#ifdef NEED_PROTOTYPES
+ JPegDecodeState * /* state */
+#endif
+);
+
+
diff --git a/xc/programs/Xserver/XIE/mixie/include/jpege.h b/xc/programs/Xserver/XIE/mixie/include/jpege.h
new file mode 100644
index 000000000..044a86089
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/jpege.h
@@ -0,0 +1,169 @@
+/* $TOG: jpege.h /main/4 1998/02/09 16:17:41 kaleb $ */
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ jpege.h - common include file for jpeg encoder
+
+ Ben Fahy -- AGE Logic, Inc. Oct 1993
+
+******************************************************************************/
+
+
+#define JPEG_ENCODE_GOAL_Startup 0
+#define JPEG_ENCODE_GOAL_Done 1
+#define JPEG_ENCODE_GOAL_TryToBeginFrame 2
+#define JPEG_ENCODE_GOAL_WriteHdrData 3
+#define JPEG_ENCODE_GOAL_BeginFrameDone 4
+#define JPEG_ENCODE_GOAL_ProcessData 5
+#define JPEG_ENCODE_GOAL_ReadDataForProcess 6
+#define JPEG_ENCODE_GOAL_WriteDataForProcess 7
+#define JPEG_ENCODE_GOAL_EndOfInput 8
+#define JPEG_ENCODE_GOAL_FlushData 9
+#define JPEG_ENCODE_GOAL_EncodeRGB 10
+#define JPEG_ENCODE_GOAL_EncodeGray 11
+#define JPEG_ENCODE_GOAL_CheckStatus 12
+#define JPEG_ENCODE_GOAL_EndFrame 13
+
+#define JPEG_ENCODE_ERROR_BadGoal 1
+#define JPEG_ENCODE_ERROR_EncoderIsFreakingOut 2
+#define JPEG_ENCODE_ERROR_CouldNotStart 3
+#define JPEG_ENCODE_ERROR_CouldNotBeginFrame 4
+#define JPEG_ENCODE_ERROR_BadBeginFrameRetCode 5
+#define JPEG_ENCODE_ERROR_BadOutputAlloc 6
+#define JPEG_ENCODE_ERROR_EncodeError 7
+#define JPEG_ENCODE_ERROR_NoMoreProcessData 8
+#define JPEG_ENCODE_ERROR_ColorMismatch 9
+#define JPEG_ENCODE_ERROR_EndFrameError 10
+#define JPEG_ENCODE_ERROR_EndFrameFreakOut 11
+
+typedef struct _jpeg_encode_state {
+ int goal; /* what to do next */
+ int error_code; /* ooops */
+
+ int n_bands; /* color image or grayscale? */
+ int width,height; /* available elsewhere, but I'm lazy */
+
+ int flush_output; /* how many bytes left to flush */
+ int nl_coded; /* how many lines we have, this round */
+ int nl_tocode; /* how many lines we want, this round */
+ int i_line; /* absolute input line position */
+ unsigned char **i_lines[3];
+ /* pointers to input lines, 3 bands */
+
+ compress_info_ptr cinfo;
+ /* decoder's private state */
+ compress_methods_ptr c_methods;
+ external_methods_ptr e_methods;
+ /* decoder's private methods */
+
+ unsigned char *jpeg_input_buffer;
+ unsigned char *jpeg_output_buffer;
+ /* names self-explanatory? */
+ unsigned char *jpeg_output_bpos;
+ /* output buffer position during flush */
+
+ int strip_size; /* size of currently available strip */
+ unsigned char *strip; /* start of currently available strip */
+ unsigned char *sptr; /* position within the strip */
+ int needs_input_strip; /* need a new strip */
+ int i_strip; /* input strip #. nice for debugging */
+ int o_strip; /* output strip #. nice for debugging */
+ int final; /* this is the last strip */
+ int no_more_strips; /* flag saying you can't have any more */
+
+ int strip_req_newbytes;/* number of destination bytes we want */
+
+ short h_sample[3]; /* horizontal sample factors */
+ short v_sample[3]; /* vertical sample factors */
+
+ int lenQtable;
+ int lenACtable;
+ int lenDCtable;
+
+ unsigned char *Qtable;
+ unsigned char *ACtable;
+ unsigned char *DCtable;
+
+} JpegEncodeState;
+
+extern int encode_jpeg_lossless_color(
+#ifdef NEED_PROTOTYPES
+ JPegEncodeState * /* state */
+#endif
+);
+
+extern int encode_jpeg_lossy_color(
+#ifdef NEED_PROTOTYPES
+ JPegEncodeState * /* state */
+#endif
+);
+
+extern int encode_jpeg_lossless_gray(
+#ifdef NEED_PROTOTYPES
+ JPegEncodeState * /* state */
+#endif
+);
+
+extern int encode_jpeg_lossy_gray(
+#ifdef NEED_PROTOTYPES
+ JPegEncodeState * /* state */
+#endif
+);
diff --git a/xc/programs/Xserver/XIE/mixie/include/meuncomp.h b/xc/programs/Xserver/XIE/mixie/include/meuncomp.h
new file mode 100644
index 000000000..ca1966a28
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/meuncomp.h
@@ -0,0 +1,140 @@
+/* $TOG: meuncomp.h /main/5 1998/02/09 16:17:50 kaleb $ */
+/**** module miuncomp.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ meuncomp.c -- DDXIE includes for exporting uncompressed data
+
+ Dean Verheiden -- AGE Logic, Inc. October 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/meuncomp.h,v 1.3 1998/10/25 12:47:56 dawes Exp $ */
+
+typedef struct _meuncompdef {
+ void (*action)();
+ CARD32 Bstride;
+ CARD8 dstoffset; /* Number of bytes offset to this pixel's band */
+ CARD8 mask; /* For obtaining subbyte pixels */
+ CARD8 shift; /* Necessary shift after obtaining pixel */
+ CARD8 bandMap;
+ CARD8 clear_dst; /* Scanline pad (in bits) */
+ CARD8 bitOff; /* more that we can chew? */
+ CARD8 leftOver;
+ CARD8 depth;
+ CARD16 stride;
+ CARD8 unaligned;
+ CARD8 pad;
+ CARD32 width;
+ CARD32 pitch;
+ pointer buf;
+} meUncompRec, *meUncompPtr;
+
+#define MEUNCOMP_BP_ARGS BytePixel *src, BytePixel *dst, meUncompPtr pvt
+#define MEUNCOMP_PP_ARGS PairPixel *src, PairPixel *dst, meUncompPtr pvt
+#define MEUNCOMP_QP_ARGS QuadPixel *src, QuadPixel *dst, meUncompPtr pvt
+
+/* Action routines for encoding pixel planes */
+extern void btoS(MEUNCOMP_BP_ARGS);
+extern void sbtoS(MEUNCOMP_BP_ARGS);
+extern void btoIS(MEUNCOMP_BP_ARGS);
+extern void sbtoIS(MEUNCOMP_BP_ARGS);
+extern void BtoS(MEUNCOMP_BP_ARGS);
+extern void PtoS(MEUNCOMP_PP_ARGS);
+extern void sPtoS(MEUNCOMP_PP_ARGS);
+extern void QtoS(MEUNCOMP_QP_ARGS);
+extern void sQtoS(MEUNCOMP_QP_ARGS);
+extern void QtoIS(MEUNCOMP_QP_ARGS);
+extern void sQtoIS(MEUNCOMP_QP_ARGS);
+
+/* Action routines used by Triple band by pixel encoding */
+extern void BtoIS(MEUNCOMP_BP_ARGS);
+extern void PtoIS(MEUNCOMP_PP_ARGS);
+extern void sPtoIS(MEUNCOMP_PP_ARGS);
+extern void BtoISb(MEUNCOMP_BP_ARGS);
+extern void btoISb(MEUNCOMP_BP_ARGS);
+
+#define MEUNCOMP_UB_ARGS BytePixel *src, CARD8 *dst, meUncompPtr pvt
+#define MEUNCOMP_UP_ARGS PairPixel *src, CARD8 *dst, meUncompPtr pvt
+#define MEUNCOMP_UQ_ARGS QuadPixel *src, CARD8 *dst, meUncompPtr pvt
+
+/* Unaligned data packing routines */
+extern void BtoLLUB(MEUNCOMP_UB_ARGS);
+extern void BtoLMUB(MEUNCOMP_UB_ARGS);
+extern void BtoMLUB(MEUNCOMP_UB_ARGS);
+extern void BtoMMUB(MEUNCOMP_UB_ARGS);
+extern void PtoLLUP(MEUNCOMP_UP_ARGS);
+extern void PtoLMUP(MEUNCOMP_UP_ARGS);
+extern void PtoMLUP(MEUNCOMP_UP_ARGS);
+extern void PtoMMUP(MEUNCOMP_UP_ARGS);
+extern void QtoLLUQ(MEUNCOMP_UQ_ARGS);
+extern void QtoLMUQ(MEUNCOMP_UQ_ARGS);
+extern void QtoMLUQ(MEUNCOMP_UQ_ARGS);
+extern void QtoMMUQ(MEUNCOMP_UQ_ARGS);
+
+
+#ifndef _XIEC_MEUNCOMP
+
+#if XIE_FULL
+/* Array of pointers to actions routines for unaligned triple band by pixel */
+extern void (*EncodeTripleFuncs[2][2][2][2][2])();
+#endif
+
+#endif /* ifdef _XIEC_MEUNCOMP */
diff --git a/xc/programs/Xserver/XIE/mixie/include/microi.h b/xc/programs/Xserver/XIE/mixie/include/microi.h
new file mode 100644
index 000000000..42e2d1334
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/microi.h
@@ -0,0 +1,115 @@
+/* $TOG: microi.h /main/5 1998/02/09 16:17:54 kaleb $ */
+/**** module microi.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ microi.h -- DDXIE MI ImportClientROI definitions
+
+ Dean Verheiden -- AGE Logic, Inc. August 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_MICROI
+#define _XIEH_MICROI
+
+
+typedef struct _XieDDXPoint {
+ INT32 x, y;
+} XieDDXPointRec, *XieDDXPointPtr;
+
+typedef struct _XieBox {
+ INT32 x1, y1, x2, y2;
+} XieBoxRec, *XieBoxPtr;
+
+typedef struct _XieRegData {
+ long size;
+ long numRects;
+/* BoxRec rects[size]; in memory but not explicitly declared */
+} XieRegDataRec, *XieRegDataPtr;
+
+typedef struct _XieRegion {
+ XieBoxRec extents;
+ XieRegDataPtr data;
+} XieRegionRec, *XieRegionPtr;
+
+#ifdef _XIEC_MIREGION
+
+#define XieNullRegion ((XieRegionPtr)0)
+
+#define XIEREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
+#define XIEREGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
+#define XIEREGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
+#define XIEREGION_RECTS(reg) ((reg)->data ? (XieBoxPtr)((reg)->data + 1) \
+ : &(reg)->extents)
+#define XIEREGION_BOXPTR(reg) ((XieBoxPtr)((reg)->data + 1))
+#define XIEREGION_BOX(reg,i) (&XIEREGION_BOXPTR(reg)[i])
+#define XIEREGION_TOP(reg) XIEREGION_BOX(reg, (reg)->data->numRects)
+#define XIEREGION_END(reg) XIEREGION_BOX(reg, (reg)->data->numRects - 1)
+#define XIEREGION_SZOF(n) (sizeof(XieRegDataRec) + ((n) * sizeof(XieBoxRec)))
+
+#else /* defined _XIEC_MIREGION */
+
+extern XieRegionPtr miXieRegionCreate();
+extern Bool miXieRegionValidate();
+
+#endif
+
+#endif /* module _XIEH_MICROI */
diff --git a/xc/programs/Xserver/XIE/mixie/include/miphoto.h b/xc/programs/Xserver/XIE/mixie/include/miphoto.h
new file mode 100644
index 000000000..6725493c0
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/miphoto.h
@@ -0,0 +1,81 @@
+/* $TOG: miphoto.h /main/5 1998/02/09 16:17:58 kaleb $ */
+/**** module miphoto.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ miphoto.h -- DDXIE MI prototype ImportPhotomap definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_MIPHOTO
+#define _XIEH_MIPHOTO
+
+/*
+ * peTex extension for the ImportClientPhotomap element
+ */
+typedef struct _miphotodef {
+ stripPtr next_strip[xieValMaxBands];
+} miPhotoDefRec, *miPhotoDefPtr;
+
+#endif /* module _XIEH_MIPHOTO */
+
diff --git a/xc/programs/Xserver/XIE/mixie/include/miuncomp.h b/xc/programs/Xserver/XIE/mixie/include/miuncomp.h
new file mode 100644
index 000000000..bed22caa2
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/miuncomp.h
@@ -0,0 +1,236 @@
+/* $TOG: miuncomp.h /main/5 1998/02/09 16:18:02 kaleb $ */
+/**** module miuncomp.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ miuncomp.c -- DDXIE includes for importing uncompressed data
+
+ Dean Verheiden -- AGE Logic, Inc. September 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/miuncomp.h,v 1.3 1998/10/25 12:47:56 dawes Exp $ */
+
+#define MIUNCOMP_BP_ARGS \
+ BytePixel *src, \
+ BytePixel *dst, \
+ CARD32 count, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+typedef struct _miuncompdef {
+ stripPtr next_strip; /* used by import photomap only */
+ void (*action)(/*MIUNCOMP_BP_ARGS*/);
+ void (*tripleaction)(MIUNCOMP_BP_ARGS); /* (unknown params; not used?) */
+ CARD32 Bstride;
+ CARD8 srcoffset; /* Number of bytes offset to this pixel's band*/
+ CARD8 mask; /* For obtaining subbyte pixels */
+ CARD8 shift; /* Necessary shift after obtaining pixel */
+ CARD8 bandMap;
+ CARD8 leftPad; /* Scanline pad (in bits) */
+ CARD8 bitOff; /* more that we can chew? */
+ BOOL unaligned; /* Flag used by band-by-pixel decoding */
+ BOOL reformat; /* Flag used to request data re-formatting */
+ pointer buf;
+} miUncompRec, *miUncompPtr;
+
+#ifdef _XIEC_MIUNCOMP
+
+/* Bit reversal routine for single band uncompressed bitonal images */
+extern void CPreverse_bits(MIUNCOMP_BP_ARGS);
+extern void CPpass_bits(MIUNCOMP_BP_ARGS);
+extern void CPextractstreambits(MIUNCOMP_BP_ARGS);
+extern void CPextractswappedstreambits(MIUNCOMP_BP_ARGS);
+
+/* Byte copy routine for nicely aligned data */
+extern void CPpass_bytes(MIUNCOMP_BP_ARGS);
+
+#define MIUNCOMP_PP_ARGS \
+ PairPixel *src, \
+ PairPixel *dst, \
+ CARD32 count, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+/* Pairpixel copy routine for nicely aligned data */
+extern void CPpass_pairs(MIUNCOMP_PP_ARGS);
+extern void CPswap_pairs(MIUNCOMP_PP_ARGS);
+
+#define MIUNCOMP_QP_ARGS \
+ QuadPixel *src, \
+ QuadPixel *dst, \
+ CARD32 count, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+/* Quadpixel copy routine for nicely aligned data */
+extern void CPpass_quads(MIUNCOMP_QP_ARGS);
+extern void CPswap_quads(MIUNCOMP_QP_ARGS);
+
+#if XIE_FULL
+
+#define MIUNCOMP_SP_ARGS \
+ PairPixel *isrc, \
+ PairPixel *dst, \
+ CARD32 count, \
+ miUncompPtr pvt
+
+#define MIUNCOMP_SB_ARGS \
+ BytePixel *src, \
+ BytePixel *dst, \
+ CARD32 count, \
+ miUncompPtr pvt
+
+/* Action routines used by Triple band by pixel decoding */
+extern void StoB(MIUNCOMP_SB_ARGS);
+extern void StoP(MIUNCOMP_SP_ARGS);
+extern void StosP(MIUNCOMP_SP_ARGS);
+extern void SbtoB(MIUNCOMP_SB_ARGS);
+extern void Sbtob(MIUNCOMP_SB_ARGS);
+#endif /* XIE_FULL */
+
+#define MIUNCOMP_UB_ARGS \
+ CARD8 *src, \
+ BytePixel *dst, \
+ CARD32 numcmp, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+#define MIUNCOMP_UP_ARGS \
+ CARD8 *src, \
+ PairPixel *dst, \
+ CARD32 numcmp, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+#define MIUNCOMP_UQ_ARGS \
+ CARD8 *src, \
+ QuadPixel *dst, \
+ CARD32 numcmp, \
+ CARD32 leftpad, \
+ CARD32 depth, \
+ CARD32 stride
+
+/* Single band unaligned Stream to Pixel conversion routines */
+extern void LLUBtoB(MIUNCOMP_UB_ARGS);
+extern void LMUBtoB(MIUNCOMP_UB_ARGS);
+extern void MLUBtoB(MIUNCOMP_UB_ARGS);
+extern void MMUBtoB(MIUNCOMP_UB_ARGS);
+extern void LLUPtoP(MIUNCOMP_UP_ARGS);
+extern void LMUPtoP(MIUNCOMP_UP_ARGS);
+extern void MLUPtoP(MIUNCOMP_UP_ARGS);
+extern void MMUPtoP(MIUNCOMP_UP_ARGS);
+extern void LLUQtoQ(MIUNCOMP_UQ_ARGS);
+extern void LMUQtoQ(MIUNCOMP_UQ_ARGS);
+extern void MLUQtoQ(MIUNCOMP_UQ_ARGS);
+extern void MMUQtoQ(MIUNCOMP_UQ_ARGS);
+
+#else /* ifdef _XIEC_MIUNCOMP */
+
+/* Bit reversal routine for single band uncompressed bitonal images */
+extern void CPreverse_bits();
+extern void CPpass_bits();
+extern void CPextractstreambits();
+extern void CPextractswappedstreambits();
+
+/* Byte copy routine for nicely aligned data */
+extern void CPpass_bytes();
+
+/* Pairpixel copy routine for nicely aligned data */
+extern void CPpass_pairs();
+extern void CPswap_pairs();
+
+/* Quadpixel copy routine for nicely aligned data */
+extern void CPpass_quads();
+extern void CPswap_quads();
+
+#if XIE_FULL
+/* Action routines used by Triple band by pixel decoding */
+extern void StoB();
+extern void StoP();
+extern void StosP();
+extern void SbtoB();
+extern void Sbtob();
+
+/* Array of pointers to actions routines for unaligned triple band by pixel */
+extern void (*ExtractTripleFuncs[2][2][2][2][2])();
+
+#endif /* XIE_FULL */
+
+/* Single band unaligned Stream to Pixel conversion routines */
+extern void LLUBtoB();
+extern void LMUBtoB();
+extern void MLUBtoB();
+extern void MMUBtoB();
+extern void LLUPtoP();
+extern void LMUPtoP();
+extern void MLUPtoP();
+extern void MMUPtoP();
+extern void LLUQtoQ();
+extern void LMUQtoQ();
+extern void MLUQtoQ();
+extern void MMUQtoQ();
+
+#endif /* ifdef _XIEC_MIUNCOMP */
diff --git a/xc/programs/Xserver/XIE/mixie/include/mpgeom.h b/xc/programs/Xserver/XIE/mixie/include/mpgeom.h
new file mode 100644
index 000000000..194033aa4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/mpgeom.h
@@ -0,0 +1,122 @@
+/* $TOG: mpgeom.h /main/6 1998/02/09 16:18:07 kaleb $ */
+/**** module mpgeom.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ mpgeom.h -- DDXIE MI prototype Geometry definitions
+
+ Ben Fahy -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_MPGEOM
+#define _XIEH_MPGEOM
+
+/*
+ * peTex extension for the Geometry element
+ */
+typedef struct _mpgeombanddef {
+ int finished; /* done with this band */
+ int yOut; /* what output line we are on */
+ int out_of_bounds; /* if entire input image is missed */
+
+ double first_mlow, /* lowest input line mapped by first output */
+ first_mhigh; /* highest input line mapped by first output */
+ double last_mlow, /* lowest input line mapped by last output */
+ last_mhigh; /* highest input line mapped by last output */
+ double global_mlow, /* lowest input line mapped, overall */
+ global_mhigh; /* highest input line mapped, overall */
+
+ int first_ilow, /* rounded first_mlow */
+ first_ihigh; /* rounded first_mhigh */
+ int last_ilow, /* rounded last_mlow */
+ last_ihigh; /* rounded last_mlow */
+ int global_ilow, /* rounded global_mlow */
+ global_ihigh; /* rounded global_mlow */
+
+ /* useful data precalculated for scaling */
+ int *x_locs;
+ int x_start;
+ int x_end;
+ int int_constant; /* precalculated for Constrained data fill */
+ RealPixel flt_constant; /* precalculated for UnConstrained data fill */
+
+ /* required by general line filling routine */
+ int in_width;
+ int in_height;
+
+ /* keep track of what input lines we've come across */
+ int lo_src_available;
+ int hi_src_available;
+
+ void (*linefunc) ();
+ void (*fillfunc) ();
+ }
+ mpGeometryBandRec, *mpGeometryBandPtr;
+
+typedef struct _mpgeometrydef {
+ int input_line_increases_as_output_line_increases;
+ int input_map_size;
+ mpGeometryBandPtr bandInfo[xieValMaxBands];
+ }
+ mpGeometryDefRec, *mpGeometryDefPtr;
+
+#endif /* module _XIEH_MPGEOM */
diff --git a/xc/programs/Xserver/XIE/mixie/include/mppoint.h b/xc/programs/Xserver/XIE/mixie/include/mppoint.h
new file mode 100644
index 000000000..099cca751
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/mppoint.h
@@ -0,0 +1,81 @@
+/* $TOG: mppoint.h /main/5 1998/02/09 16:18:11 kaleb $ */
+/**** module mppoint.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ mppoint.h -- DDXIE MI prototype Point definitions
+
+ Ben Fahy -- AGE Logic, Inc. May 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_MPPOINT
+#define _XIEH_MPPOINT
+
+#include <lut.h>
+/*
+ * peTex extension for the Point element
+ */
+typedef struct _mppointdef {
+ lutPtr lut;
+} mpPointDefRec, *mpPointDefPtr;
+
+#endif /* module _XIEH_MPPOINT */
diff --git a/xc/programs/Xserver/XIE/mixie/include/sched.h b/xc/programs/Xserver/XIE/mixie/include/sched.h
new file mode 100644
index 000000000..5e858898d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/sched.h
@@ -0,0 +1,124 @@
+/* $TOG: sched.h /main/5 1998/02/09 16:18:15 kaleb $ */
+/**** module sched.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ sched.h -- DDXIE machine independent scheduler definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. May 1993
+
+******************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/sched.h,v 1.3 1998/10/25 12:47:57 dawes Exp $ */
+
+#ifndef _XIEH_SCHED
+#define _XIEH_SCHED
+
+/* scheduler interface
+ */
+struct _petex;
+typedef bandMsk (*xieBandProc)(floDefPtr flo, struct _petex *pet);
+typedef struct _schedvec {
+ xieBoolProc execute;
+ xieBandProc runnable;
+} schedVecRec;
+
+/* call scheduler to execute until out of data;
+ * returns Bool: true if flo still active
+ */
+#define Execute(flo,import_pet) \
+ (*flo->schedVec->execute)(flo,import_pet)
+
+/* detect execution suspension/resumption
+ * returns Bool: true if scheduler has exited to core X since last checked
+ * (useful for determining if fresh lookups are needed for core X resources)
+ */
+#define Resumed(flo,pet) \
+ (pet->schedCnt == flo->floTex->exitCnt ? FALSE \
+ : ((pet->schedCnt = flo->floTex->exitCnt), TRUE))
+
+/* toggle the band's ready bit if "available >= threshold" status has changed
+ * and return the updated ready mask;
+ * if the ready bit doesn't toggle, return NO_BANDS
+ */
+#define CheckSrcReady(bnd,bmsk) \
+ (bnd->receptor->ready & (bmsk) \
+ ? (bnd->available < bnd->threshold \
+ ? (bnd->receptor->ready &= ~(bmsk)) : NO_BANDS) \
+ : (bnd->available >= bnd->threshold \
+ ? (bnd->receptor->ready |= (bmsk)) : NO_BANDS))
+
+/* try to schedule the specified element based on new data arriving for:
+ * receptorPtr rcp, bandPtr bnd, and bandMsk bmsk
+ * nothing is returned, but pet->scheduled indicates which bands are runnable
+ */
+#define Schedule(flo,pet,rcp,bnd,bmsk) \
+ { bandMsk r = CheckSrcReady(bnd,bmsk) & rcp->attend; \
+ if(r && !pet->scheduled) { \
+ if(!pet->inSync) { \
+ if(!pet->bandSync || r == (rcp->active & rcp->attend)) {\
+ pet->scheduled |= r; \
+ InsertMember(pet, &flo->floTex->schedHead); \
+ } \
+ } else if((r = (*flo->schedVec->runnable)(flo,pet)) != 0) { \
+ pet->scheduled = r; \
+ InsertMember(pet,&flo->floTex->schedHead); \
+ } } }
+#endif /* end _XIEH_SCHED */
diff --git a/xc/programs/Xserver/XIE/mixie/include/strip.h b/xc/programs/Xserver/XIE/mixie/include/strip.h
new file mode 100644
index 000000000..884ebba42
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/strip.h
@@ -0,0 +1,330 @@
+/* $TOG: strip.h /main/6 1998/02/09 16:18:19 kaleb $ */
+/**** module strip.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ strip.h -- DDXIE machine independent data manager definitions
+
+ Robert NC Shelley -- AGE Logic, Inc. May 1993
+
+******************************************************************************/
+
+#ifndef _XIEH_STRIP
+#define _XIEH_STRIP
+
+#define STANDARD_STRIP_SIZE 8192 /* temporary hack */
+
+/* data management interface */
+typedef struct _stripvec {
+ xieDataProc make_bytes;
+ xieDataProc make_lines;
+ xieBoolProc map_data;
+ xieDataProc get_data;
+ xieBoolProc put_data;
+ xieVoidProc free_data;
+ xieBoolProc pass_strip;
+ xieBoolProc import_strips;
+ xieBoolProc alter_src;
+ xieVoidProc bypass_src;
+ xieVoidProc disable_src;
+ xieVoidProc disable_dst;
+} stripVecRec;
+
+/* per-band scanline/byte data management info
+ */
+typedef struct _band {
+ stripLstRec stripLst; /* strips available for processing */
+ stripPtr strip; /* strip of most recent access */
+ CARD8 *data; /* pointer to most recent line/byte access */
+ CARD32 minGlobal; /* lowest available line/byte in stripLst */
+ CARD32 minLocal; /* lowest available line/byte in strip */
+ CARD32 current; /* line/byte of most recent access */
+ CARD32 maxLocal; /* one beyond highest line/byte in strip */
+ CARD32 maxGlobal; /* one beyond highest line/byte in stripLst */
+ CARD32 pitch; /* number of bytes to start of next line */
+ CARD32 mapSize; /* size of dataMap */
+ CARD8 **dataMap; /* pointers for multi-line random access */
+ CARD32 threshold; /* line/bytes needed for execution */
+ CARD32 available; /* line/bytes available in stripLst */
+ bandMsk replicate; /* replicate data from band 0 to bands 1 & 2*/
+ CARD8 band; /* band number */
+ BOOL final; /* true when last line/byte is in stripLst */
+ BOOL isInput; /* band type: true = input, false = output */
+ struct _receptor *receptor; /* receptor if isInput, otherwise NULL */
+ formatPtr format; /* common format info for all strips */
+ struct _band *inPlace; /* what to clone to make in-place strips */
+ pointer pcroi; /* pointer to ROI entry for current line */
+ CARD32 xindex; /* index into pcroi ROI for current x pos */
+ INT32 xcount; /* current x location in output band */
+ BOOL ypass; /* True = no processing domain this line */
+ BOOL inside; /* indicates if inside or outside domain */
+ BOOL allpass; /* indicates no lines fall in ROI */
+ CARD8 pad;
+} bandRec, *bandPtr;
+
+/**************************************************************************
+ * Photoflo data manager convenience macros
+ *
+ * pointer GetCurrentSrc(flo,pet,bnd) single Src line/byte
+ * pointer GetCurrentDst(flo,pet,bnd) single Dst line/byte
+ * pointer GetNextSrc(flo,pet,bnd,purge) single Src line/byte
+ * pointer GetNextDst(flo,pet,bnd,purge) single Dst line/byte
+ * pointer GetSrc(flo,pet,bnd,unit,purge) single Src line/byte
+ * pointer GetDst(flo,pet,bnd,unit,purge) single Dst line/byte
+ * pointer GetSrcBytes(flo,pet,bnd,unit,len,purge) contiguous Src bytes
+ * pointer GetDstBytes(flo,pet,bnd,unit,len,purge) contiguous Dst bytes
+ * Bool MapData(flo,pet,bnd,map,unit,len,purge) map multi-lines/bytes
+ * Bool PutData(flo,pet,bnd,unit) put multi-lines/bytes
+ * void FreeData(flo,pet,bnd,unit) free multi-lines/bytes
+ * Bool PassStrip(flo,pet,bnd,strip) forward clone of strip
+ * Bool ImportStrips(flo,pet,bnd,strips) import Photomap strips
+ * Bool AlterSrc(flo,pet,strip) see if Src is mutable
+ * void BypassSrc(flo,pet,bnd) bypass element for bnd
+ * void DisableSrc(flo,pet,bnd,purge) disable input for bnd
+ * void DisableDst(flo,pet,bnd) signal no bnd output
+ *
+ * key to common arguments:
+ * flo floDefPtr
+ * pet peTexPtr
+ * bnd bandPtr
+ * unit line number within canonic image, or
+ * byte number within non-canonic data stream
+ * len number of units (lines or bytes)
+ * purge if the requested data is not in the current strip and purge is
+ * true, all data preceding the first line or byte in the current
+ * request is freed (receptor band) or forwarded (emitter band).
+ * NOTE: purge does not update scheduler info, so FreeData should be
+ * called for receptor bands prior to returning from the element.
+ *
+ * Additional macros:
+ * AttendBand(bnd) ------- scheduler will consider this band (default)
+ * IgnoreBand(bnd) ------- scheduler will ignore this band
+ * AttendReceptor(rcp) --- scheduler will consider this receptor (default)
+ * IgnoreReceptor(rcp) --- scheduler will ignore this receptor
+ * SetBandFinal(bnd) ----- set final "true" for band and current strip
+ * SetBandThreshold(bnd,value) -- set new threshold value
+ * TruncateStrip(bnd,value) ----- adjust end of strip to value
+ **************************************************************************/
+
+/* utility macros for strip manager internal use only
+ */
+#define _is_local(bnd) ((bnd)->minLocal <= (bnd)->current && \
+ (bnd)->current < (bnd)->maxLocal)
+#define _is_global(bnd) ((bnd)->minGlobal <= (bnd)->current && \
+ (bnd)->current < (bnd)->maxGlobal)
+#define _is_local_contig(bnd,len) ((bnd)->minLocal <= (bnd)->current && \
+ (bnd)->current+len <= (bnd)->maxLocal)
+#define _is_global_contig(bnd,len) ((bnd)->minGlobal <= (bnd)->current && \
+ (bnd)->current+len <= (bnd)->maxGlobal)
+#define _byte_ptr(bnd) \
+ (&(bnd)->strip->data[(bnd)->current - (bnd)->strip->start])
+#define _line_ptr(bnd) \
+ (&(bnd)->strip->data \
+ [(bnd)->pitch * ((bnd)->current - (bnd)->strip->start)])
+#define _release_ok(bnd) \
+ (!ListEmpty(&(bnd)->stripLst) && \
+ ((bnd)->current > (bnd)->stripLst.flink->end || !(bnd)->maxGlobal))
+
+/**************************************************************************
+ * public data management macros for handling strip/scanline/other data
+ */
+#define AttendBand(bnd) ((bnd)->receptor->attend |= \
+ (bnd)->receptor->active & 1<<(bnd)->band)
+#define AttendReceptor(rcp) (rcp->attend = rcp->active)
+#define IgnoreBand(bnd) ((bnd)->receptor->attend &= ~(1<<(bnd)->band))
+#define IgnoreReceptor(rcp) (rcp->attend = NO_BANDS)
+#define SetBandFinal(bnd) ((bnd)->strip \
+ ? ((bnd)->final = (bnd)->strip->final = TRUE) \
+ : ((bnd)->final = TRUE))
+#define SetBandThreshold(bnd,value) \
+ if( ((bnd)->threshold = value) > (bnd)->available) \
+ (bnd)->receptor->ready &= ~(1<<(bnd)->band); \
+ else (bnd)->receptor->ready |= 1<<(bnd)->band
+#define TruncateStrip(bnd,value) \
+ {(bnd)->current = (value); \
+ if((bnd)->strip && _is_local(bnd)) { \
+ int q = (bnd)->maxLocal - (value); \
+ (bnd)->strip->length -= q; (bnd)->strip->end -= q; \
+ (bnd)->available -= q + (bnd)->maxGlobal - (bnd)->maxLocal;\
+ (bnd)->maxGlobal = (bnd)->maxLocal = value; }}
+
+/* return the current line/byte pointer (NULL if not currently available)
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd;
+ */
+#define GetCurrentSrc(flo,pet,bnd) \
+ (pointer)((bnd)->data ? (bnd)->data \
+ : _is_global(bnd) \
+ ? (*flo->stripVec->get_data)(flo,pet,bnd,1,FALSE) \
+ : ((bnd)->data = NULL))
+#define GetCurrentDst(flo,pet,bnd) \
+ (pointer)((bnd)->data ? (bnd)->data \
+ : (*flo->stripVec->make_lines)(flo,pet,bnd,FALSE))
+
+/* return the next sequential line/byte pointer (NULL if not available)
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; Bool purge;
+ */
+#define GetNextSrc(flo,pet,bnd,purge) \
+ (pointer)(++(bnd)->current < (bnd)->maxLocal \
+ ? ((bnd)->data += (bnd)->pitch) \
+ : _is_global(bnd) \
+ ? (*flo->stripVec->get_data)(flo,pet,bnd,1,purge) \
+ : ((bnd)->data = NULL))
+#define GetNextDst(flo,pet,bnd,purge) \
+ (pointer)(++(bnd)->current < (bnd)->maxLocal \
+ ? ((bnd)->data += (bnd)->pitch) \
+ : (*flo->stripVec->make_lines)(flo,pet,bnd,purge))
+
+/* return the specified line/byte pointer (random access)
+ * (returns NULL if not available)
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; CARD32 unit; Bool purge;
+ */
+#define GetSrc(flo,pet,bnd,unit,purge) \
+ (pointer)((bnd)->current = unit, _is_local(bnd) \
+ ? ((bnd)->data = _line_ptr(bnd)) \
+ : _is_global(bnd) \
+ ? (*flo->stripVec->get_data)(flo,pet,bnd,1,purge) \
+ : ((bnd)->data = NULL))
+#define GetDst(flo,pet,bnd,unit,purge) \
+ (pointer)((bnd)->current = unit, _is_local(bnd) \
+ ? ((bnd)->data = _line_ptr(bnd)) \
+ : (*flo->stripVec->make_lines)(flo,pet,bnd,purge))
+
+/* return the specified byte pointer with len contiguous bytes available
+ * (returns NULL if not available)
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; CARD32 unit, len; Bool purge;
+ * len -- number of contiguous bytes required
+ */
+#define GetSrcBytes(flo,pet,bnd,unit,len,purge) \
+ (pointer)((bnd)->current = unit, _is_local_contig(bnd,len) \
+ ? ((bnd)->data = _byte_ptr(bnd)) : _is_global(bnd) \
+ ? (*flo->stripVec->get_data)(flo,pet,bnd,len,purge) \
+ : ((bnd)->data = NULL))
+#define GetDstBytes(flo,pet,bnd,unit,len,purge) \
+ (pointer)((bnd)->current = unit, _is_local_contig(bnd,len) \
+ ? ((bnd)->data = _byte_ptr(bnd)) \
+ : (*flo->stripVec->make_bytes)(flo,pet,bnd,len,purge))
+
+/* load the data map with pointers to a range of lines
+ * upon return, bnd info points to unit (the first line mapped)
+ * returns TRUE if all requested lines are available, otherwise FALSE
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd;
+ * CARD32 map, unit, len; Bool purge;
+ * map --- first dataMap index to use (normally 0),
+ * unit -- first line/byte number to map,
+ * len --- number of lines/bytes to map;
+ */
+#define MapData(flo,pet,bnd,map,unit,len,purge) \
+ (*flo->stripVec->map_data)(flo,pet,bnd,map,unit,len,purge)
+
+/* release lines/bytes to downstream recipients (up to but not including unit),
+ * bnd->data is updated if unit is in current strip (else it is NULLed)
+ * returns TRUE if the element should suspend itself
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; CARD32 unit;
+ */
+#define PutData(flo,pet,bnd,unit) \
+ ((bnd)->data = (bnd)->current == unit ? (bnd)->data \
+ : ((bnd)->current = unit, _is_local(bnd) ? _line_ptr(bnd) : NULL), \
+ _release_ok(bnd) ? (*flo->stripVec->put_data)(flo,pet,bnd) : FALSE)
+
+/* free lines/bytes (up to but not including unit)
+ * upon return, bnd info points to unit, if previously available
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; CARD32 unit;
+ */
+#define FreeData(flo,pet,bnd,unit) \
+ ((bnd)->current = unit, (*flo->stripVec->free_data)(flo,pet,bnd))
+
+/* import a list of strips from a Photomap
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; stripLstPtr strips;
+ */
+#define ImportStrips(flo,pet,bnd,strips) \
+ (*flo->stripVec->import_strips)(flo,pet,bnd,strips)
+
+/* clone a strip and pass it on to downstream elements
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; stripPtr strip;
+ */
+#define PassStrip(flo,pet,bnd,strip) \
+ (*flo->stripVec->pass_strip)(flo,pet,bnd,strip)
+
+/* check Src strip to see if its data can be over written
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; stripPtr strip;
+ */
+#define AlterSrc(flo,pet,strip) \
+ (*flo->stripVec->alter_src)(flo,pet,strip)
+
+/* flush data from bnd to downstream elements, then set bnd in bypass mode
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd;
+ */
+#define BypassSrc(flo,pet,bnd) \
+ (*flo->stripVec->bypass_src)(flo,pet,bnd)
+
+/* disable any further input from bnd, and discard data if purge is true
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd; Bool purge;
+ */
+#define DisableSrc(flo,pet,bnd,purge) \
+ (*flo->stripVec->disable_src)(flo,pet,bnd,purge)
+
+/* disable any further output from bnd (i.e. send final, but no data)
+ * floDefPtr flo; peTexPtr pet; bandPtr bnd;
+ */
+#define DisableDst(flo,pet,bnd) \
+ (*flo->stripVec->disable_dst)(flo,pet,bnd)
+
+#endif /* end _XIEH_STRIP */
diff --git a/xc/programs/Xserver/XIE/mixie/include/tex.h b/xc/programs/Xserver/XIE/mixie/include/tex.h
new file mode 100644
index 000000000..4a123edca
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/tex.h
@@ -0,0 +1,187 @@
+/* $TOG: tex.h /main/5 1998/02/09 16:18:29 kaleb $ */
+/**** module tex.h ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ tex.h -- generic device dependent photoflo definitions
+
+ Dean Verheiden -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/include/tex.h,v 1.3 1998/10/25 12:47:57 dawes Exp $ */
+
+#ifndef _XIEH_TEX
+#define _XIEH_TEX
+
+/* symbolic constants -- for flo manager initialization routines
+ */
+ /* Band mask constants for specifying all posible bands or no bands.
+ */
+#define ALL_BANDS ((bandMsk)~0)
+#define NO_BANDS ((bandMsk) 0)
+
+ /* Constant for specifying that in-place operations are not wanted
+ * (i.e. use new Dst buffers). The alternative is to specify a Src
+ * (e.g. SRCtag or SRCt1) whose buffer contents can be replaced with
+ * the result. When requesting a Dst line, the data manager will map
+ * the requested Dst line to the corresponding Src line (the Src and
+ * Dst canonic data types must match for this to work).
+ */
+#define NO_INPLACE ((INT32)-1)
+
+ /* Constant for specifying that no space needs to be allotted for a
+ * data manager DataMap (i.e. data will be accessed on a line by line
+ * basis). The alternative is to specify the maximum number of lines
+ * that will be needed in the DataMap (anywhere from a few lines to
+ * the full image).
+ */
+#define NO_DATAMAP ((CARD32) 0)
+
+ /* Constant for specifying that the element does not require any
+ * private parameter space. The alternative is to specify the number
+ * of bytes of private storage that will be needed for parameters etc.
+ * The private area is allocated as contiguous bytes beyond the peTex
+ * structure, and therefore should not be freed explicitly.
+ */
+#define NO_PRIVATE ((CARD32) 0)
+
+ /* Constants for specifying whether or not the data manager and
+ * scheduler should cooperate to keep inputs and/or bands in sync.
+ */
+#define SYNC ((Bool) 1)
+#define NO_SYNC ((Bool) 0)
+
+
+/* symbolic constants -- for data manager macros
+ */
+ /* The following pair of constants can be supplied for the "purge"
+ * argument in many of the data manager's strip access macros.
+ *
+ * KEEP specifies that all data currently owned by the Src or Dst
+ * should be retained (either the data will be needed again or there
+ * is no advantage in releasing the data as it is consumed).
+ *
+ * FLUSH specifies that all data that precedes the current unit (line
+ * or byte) can be dispensed with. Src data may be freed, whereas Dst
+ * data may be forwarded to downstream elements. FLUSH is a suggestion
+ * rather than a command. Whether or not the data is actually flushed
+ * depends on the crossing of strip boundaries. If one or more strips
+ * precede the strip containing the current unit, they will be flushed.
+ * If a downstream element becomes runnable as a result of forwarding
+ * a Dst strip, the data manager will signal to the calling element
+ * that it should defer to the downstream element(s).
+ */
+#define KEEP ((Bool) 0)
+#define FLUSH ((Bool) 1)
+
+
+#ifndef _XIEC_FLOMAN
+struct _band;
+struct _receptor;
+
+extern int InitFloManager(floDefPtr flo);
+extern int MakePETex(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 extend,
+ Bool inSync,
+ Bool bandSync);
+extern Bool InitReceptors(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 mapSize,
+ CARD32 threshold);
+extern Bool InitReceptor(
+ floDefPtr flo,
+ peDefPtr ped,
+ struct _receptor * rcp,
+ CARD32 mapSize,
+ CARD32 threshold,
+ unsigned process,
+ unsigned bypass);
+extern Bool InitEmitter(
+ floDefPtr flo,
+ peDefPtr ped,
+ CARD32 mapSize,
+ INT32 inPlace);
+extern Bool InitBand(
+ floDefPtr flo,
+ peDefPtr ped,
+ struct _band * bnd,
+ CARD32 mapSize,
+ CARD32 threshold,
+ INT32 inPlace);
+extern void ResetBand(struct _band * bnd);
+extern void ResetReceptors(peDefPtr ped);
+extern void ResetEmitter(peDefPtr ped);
+#endif
+
+#ifndef _XIEC_SCHED
+extern int InitScheduler(floDefPtr flo);
+#endif
+
+#ifndef _XIEC_STRIP
+extern int InitStripManager(floDefPtr flo);
+extern int DebriefStrips(stripLstPtr i_head, stripLstPtr o_head);
+extern void FreeStrips(stripLstPtr head);
+#endif
+
+#endif /* end _XIEH_TEX */
diff --git a/xc/programs/Xserver/XIE/mixie/include/texstr.h b/xc/programs/Xserver/XIE/mixie/include/texstr.h
new file mode 100644
index 000000000..48df621b9
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/texstr.h
@@ -0,0 +1,146 @@
+/* $TOG: texstr.h /main/7 1998/02/09 16:18:24 kaleb $ */
+/**** module texstr.h ****/
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ texstr.h -- DDXIE generic photoflo execution context structures
+
+ Dean Verheiden, Robert NC Shelley -- AGE Logic, Inc. April 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_TEXSTR
+#define _XIEH_TEXSTR
+
+#include <tex.h>
+#include <floman.h>
+#include <sched.h>
+#include <strip.h>
+
+#include <domain.h>
+
+/*
+ * link-pair for managing a circular doubly linked list of peTexRecs
+ */
+typedef struct _petlst {
+ struct _petex *flink;
+ struct _petex *blink;
+} petLstRec, *petLstPtr;
+
+/*
+ * photoflo execution context structure
+ */
+typedef struct _flotex {
+ CARD32 imports; /* number of bands receiving client data */
+ CARD32 exports; /* number of bands supplying client data */
+ CARD32 exitCnt; /* incremented each time scheduler exits */
+ petLstRec schedHead; /* list of scheduled elements */
+ stripLstRec stripHead; /* list of reusable strips */
+ CARD32 stripSize; /* size of standard cachable strips */
+ CARD32 putCnt; /* incremented each time a strip is "Put" */
+ pointer yieldPtr; /* yielding info ptr */
+} floTexRec, *floTexPtr;
+
+/*
+ * receptor data structure
+ */
+typedef struct _receptor {
+ /* set of per-band Boolean flags: */
+ bandMsk admit; /* bands that will admit more data */
+ bandMsk ready; /* bands with available >= threshold */
+ bandMsk active; /* bands that will produce more data */
+ bandMsk attend; /* bands to consider when scheduling */
+ bandMsk bypass; /* bands that bypass this element */
+ bandMsk forward; /* bands that forward input when freed*/
+ CARD8 pad[2];
+ inFloPtr inFlo; /* pointer to receptor's inFlo */
+ bandRec band[xieValMaxBands]; /* per-band input context */
+} receptorRec, *receptorPtr;
+
+/*
+ * photo element execution context structure
+ */
+typedef struct _petex {
+ struct _petex *flink; /* foreword link for scheduler list */
+ struct _petex *blink; /* backword link for scheduler list */
+ peDefPtr peDef; /* pointer to the DIXIE element def */
+ outFloPtr outFlo; /* pointer to element's outFlo */
+ receptorPtr receptor; /* pointer to in-line receptors */
+ pointer private; /* pointer to in-line private info */
+ CARD32 schedCnt; /* to detect that scheduler has resumed */
+ CARD32 admissionCnt; /* number of receptors expecting data */
+ BOOL inSync; /* true if inputs must be kept in sync */
+ BOOL bandSync; /* true if bands must be kept in sync */
+ bandMsk scheduled; /* bits set if element is on ready-list */
+ bandMsk emitting; /* mask of bands that are emitting data */
+ bandRec emitter[xieValMaxBands]; /* per-band output context */
+ pointer roi; /* pointer to run length/control plane */
+ Bool (*roiinit)(); /* process domain line setup function */
+ INT32 (*roiget)(); /* process domain run length function */
+ INT32 domXoff; /* processing domain x offset */
+ INT32 domYoff; /* processing domain y offset */
+#if 0
+ receptorRec receptor[inCnt]; /* array of in-line input receptors */
+ void private_info; /* in-line element-private data */
+#endif
+} peTexRec, *peTexPtr;
+
+#endif /* end _XIEH_TEXSTR */
diff --git a/xc/programs/Xserver/XIE/mixie/include/xiemd.h b/xc/programs/Xserver/XIE/mixie/include/xiemd.h
new file mode 100644
index 000000000..9d6eaf8bb
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/include/xiemd.h
@@ -0,0 +1,222 @@
+/* $TOG: xiemd.h /main/9 1998/02/09 16:18:34 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module xiemd.h ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+******************************************************************************
+
+ xiemd.h -- DDXIE MI prototype Machine Dependent definitions
+
+ Larry Hare -- AGE Logic, Inc. June 1993
+
+*****************************************************************************/
+
+#ifndef _XIEH_MD
+#define _XIEH_MD
+
+#include <X.h>
+#include <servermd.h>
+#include "misc.h" /* for pointer */
+#include <Xmd.h>
+
+#ifndef _XIEC_MPBITFUN
+extern unsigned char _ByteReverseTable[];
+#endif
+
+/*
+** Bit operations:
+**
+** DATATYPE DEPENDENT:
+** LogInt - Should be chosen as the largest efficient unsigned type which
+** supports C based logical operations, as well as loads and
+** stores. This will usually be 32 bit unsigned long, but
+** might conceivably be an 64 bit type on some newer machines.
+** If you change this, update LOGSHIFT.
+** LOGSHIFT - Log2 of LOGSIZE
+** LOGSIZE - Size of LogInt in bits. You should make sure your compiler
+** knows that this is really 32 and not (4<<3).
+** LOGMASK - Make sure your compiler thinks this is 31 and not ((4<<3)-1)
+**
+** ENDIAN DEPENDENT:
+** LOGLEFT - LeftMost bit (from screen perspective) in a LogInt.
+** LOGRIGHT - In place shift of a LogInt right 1 bit (in screen perspective)>
+**
+** LOGINDX,LOGBIT - Used by LOG_xxxbit macros for individual access to bits.
+** LOG_tstbit - test if a bit from memory is set.
+** LOG_chgbit - test if a bit in memory differs from a constant.
+** LOG_setbit,LOG_clrbit,LOG_xorbit - set, clr, or xor a bit in memory.
+**
+** Some pieces of bit related code have been written to use word loops
+** using LogInt Bits at a time. Some algorithms use LOG_xxxbit macros
+** to access individual bits.
+*/
+
+#ifdef LONG64
+typedef CARD64 LogInt;
+#define LOGSHIFT (6)
+#else
+typedef CARD32 LogInt;
+#define LOGSHIFT (5)
+#endif
+#define LOGSIZE (sizeof(LogInt)<<3)
+#define LOGMASK (LOGSIZE-1)
+
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+#define BitLeft(V,N) ((V) << (N))
+#define BitRight(V,N) ((V) >> (N))
+#else
+#define BitLeft(V,N) ((V) >> (N))
+#define BitRight(V,N) ((V) << (N))
+#endif /* endian type */
+
+#define LOGLEFT BitLeft(((LogInt)~0),LOGMASK)
+#define LOGRIGHT(M) (M=BitRight(M,1))
+#define LOGONES ~((LogInt)0)
+#define LOGZERO ((LogInt)0)
+
+#define LOGINDX(X) ((X)>>LOGSHIFT)
+#define LOGBIT(X) BitRight(LOGLEFT,(X) & LOGMASK)
+#define LOG_chgbit(P,N,C) (((P)[LOGINDX(N)] ^ C) & LOGBIT(N))
+#define LOG_tstbit(P,N) ((P)[LOGINDX(N)] & LOGBIT(N))
+#define LOG_clrbit(P,N) ((P)[LOGINDX(N)] &= ~LOGBIT(N))
+#define LOG_setbit(P,N) ((P)[LOGINDX(N)] |= LOGBIT(N))
+#define LOG_xorbit(P,N) ((P)[LOGINDX(N)] ^= LOGBIT(N))
+
+/* Special version for unsigned bytes used for byte streams that might not be
+ LogInt aligned
+*/
+typedef unsigned char LogByte;
+#define LOGBYTESHIFT (3)
+#define LOGBYTESIZE (sizeof(LogByte)<<3)
+#define LOGBYTEMASK (LOGBYTESIZE-1)
+
+#define LOGBYTELEFT (LogByte)BitLeft(((LogByte)~0),LOGBYTEMASK)
+#define LOGBYTERIGHT(M) (LogByte)(M=BitRight(M,1))
+#define LOGBYTEONES ~((LogByte)0)
+#define LOGBYTEZERO ((LogByte)0)
+
+#define LOGBYTEINDX(X) ((X)>>LOGBYTESHIFT)
+#define LOGBYTEBIT(X) BitRight(LOGBYTELEFT,(X) & LOGBYTEMASK)
+#define LOGBYTE_chgbit(P,N,C) (((P)[LOGBYTEINDX(N)] ^ C) & LOGBYTEBIT(N))
+#define LOGBYTE_tstbit(P,N) ((P)[LOGBYTEINDX(N)] & LOGBYTEBIT(N))
+#define LOGBYTE_clrbit(P,N) ((P)[LOGBYTEINDX(N)] &= ~LOGBYTEBIT(N))
+#define LOGBYTE_setbit(P,N) ((P)[LOGBYTEINDX(N)] |= LOGBYTEBIT(N))
+#define LOGBYTE_xorbit(P,N) ((P)[LOGBYTEINDX(N)] ^= LOGBYTEBIT(N))
+/*
+** Bit Fun. Fun with Bits. Functions for bits:
+**
+** bitexpand() - expand a bunch of bits to fg,bg bytes.
+*/
+
+pointer bitexpand();
+void bitshrink();
+void action_clear();
+void action_set();
+void action_invert();
+void zero_even();
+
+/*
+** Floating Point Considerations.
+**
+** The following definitions are used in individual modules. We might
+** want to regularaize all these in this one file, or even make these
+** into one tyepdef like ProcessFloat. The goal is so that the server
+** can consistently use floats instead of doubles on machines which
+** can do floats quicker than doubles:
+**
+** typedef float BlendFloat; (see mpblend.c)
+** typedef float ConstrainFloat; (see mpcnst.c)
+** typedef float DitherFloat; (see mpdither.c)
+** typedef float ConvolveFloat; (see element.h)
+** typedef float PasteUpFloat; (see element.h)
+**
+** Some functions are not yet written to this standard. For instance
+** geometry is susceptible to roundoff errors keeping track of scanline
+** threshold data maps.
+**
+** typedef RealPixel GeomFloat;
+*/
+
+/*
+** USE_FLOATS is used in mpcnst.c to enable the originaly easy to
+** program floating point ClipScale routines. The current integer
+** based routine no longer does a divide and is hence probably faster
+** on all rational machines. We may come up with other choices for
+** integer versus floating algorithms in the future. We would perhaps
+** like to select between them here.
+**
+** #define USE_FLOATS
+*/
+
+/*
+** SF_DITHER - use scaled fractions in floyd steinberg dither for byte
+** and pair pixels; quad pixel operations are still done with floats.
+** If you have software floating point, you will definitely want to turn
+** this code on. Machines with an fpu generally perform at least as good
+** with the floating point code.
+**
+** #define SF_DITHER
+*/
+
+#if defined(_AM29K) || defined(__i960__) || defined(_LR33020_) || defined(gsp)
+#define SF_DITHER
+#endif
+
+#endif /* module _XIEH_MD */
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/Imakefile b/xc/programs/Xserver/XIE/mixie/jpeg/Imakefile
new file mode 100644
index 000000000..61b5a0a3c
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/Imakefile
@@ -0,0 +1,68 @@
+XCOMM $XConsortium: Imakefile /main/8 1996/09/28 16:56:19 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/Imakefile,v 3.5 1998/07/25 08:05:11 dawes Exp $
+XCOMM build device dependent machine independent fax processing element objects
+
+#define IHaveModules
+#include <Server.tmpl>
+
+ SRCS = jcdeflts.c \
+ jcexpand.c \
+ jchuff.c \
+ jcmcu.c \
+ jcsample.c \
+ jcxie.c \
+ jcxief.c \
+ jdbuffer.c \
+ jddeflts.c \
+ jdhuff.c \
+ jdlossy.c \
+ jdmcu.c \
+ jdsample.c \
+ jdxie.c \
+ jdxief.c \
+ jelossy.c \
+ jfwddct.c \
+ jmemmgr.c \
+ jmemsys.c \
+ jrdjfif.c \
+ jrevdct.c \
+ jutils.c \
+ jwrjfif.c
+
+ OBJS = jcdeflts.o \
+ jcexpand.o \
+ jchuff.o \
+ jcmcu.o \
+ jcsample.o \
+ jcxie.o \
+ jcxief.o \
+ jdbuffer.o \
+ jddeflts.o \
+ jdhuff.o \
+ jdlossy.o \
+ jdmcu.o \
+ jdsample.o \
+ jdxie.o \
+ jdxief.o \
+ jelossy.o \
+ jfwddct.o \
+ jmemmgr.o \
+ jmemsys.o \
+ jrdjfif.o \
+ jrevdct.o \
+ jutils.o \
+ jwrjfif.o
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions -I../jpeg
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(jpeg,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/README b/xc/programs/Xserver/XIE/mixie/jpeg/README
new file mode 100644
index 000000000..1ab0d4d13
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/README
@@ -0,0 +1,402 @@
+/* $XConsortium: README,v 1.2 93/11/07 10:25:48 rws Exp $ */
+The Independent JPEG Group's JPEG software
+==========================================
+
+README for release 4 of 10-Dec-92
+=================================
+
+This distribution contains the fourth public release of the Independent JPEG
+Group's free JPEG software. You are welcome to redistribute this software and
+to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
+
+For installation instructions, see file SETUP.
+
+For usage instructions, see file USAGE (or the cjpeg.1 and djpeg.1 manual
+pages; but USAGE contains a "hints" section not found in the manual pages).
+Useful information can also be found in the JPEG FAQ (Frequently Asked
+Questions) article; see ARCHIVE LOCATIONS below to obtain the FAQ article.
+
+This software is still undergoing revision. Updated versions may be obtained
+by FTP or UUCP to UUNET and other archive sites; see ARCHIVE LOCATIONS below
+for details.
+
+Serious users of this software (particularly those incorporating it into
+larger programs) should contact jpeg-info@uunet.uu.net to be added to our
+electronic mailing list. Mailing list members are notified of updates and
+have a chance to participate in technical discussions, etc.
+
+This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz,
+Lee Crocker, Ge' Weijers, and other members of the Independent JPEG Group.
+
+
+DISCLAIMER
+==========
+
+THIS SOFTWARE IS NOT COMPLETE NOR FULLY DEBUGGED. It is not guaranteed to be
+useful for anything, nor to be compatible with subsequent releases, nor to be
+an accurate implementation of the JPEG standard. (See LEGAL ISSUES for even
+more disclaimers.)
+
+Despite that, we believe that this software is pretty good, and if you find
+any problems with it, we'd like to know about them. Please report problems
+by e-mail to jpeg-info@uunet.uu.net.
+
+
+WHAT'S HERE
+===========
+
+This distribution contains C software to implement JPEG image compression and
+decompression. JPEG (pronounced "jay-peg") is a standardized compression
+method for full-color and gray-scale images. JPEG is intended for compressing
+"real-world" scenes; cartoons and other non-realistic images are not its
+strong suit. JPEG is lossy, meaning that the output image is not necessarily
+identical to the input image. Hence you must not use JPEG if you have to have
+identical output bits. However, on typical images of real-world scenes, very
+good compression levels can be obtained with no visible change, and amazingly
+high compression levels are possible if you can tolerate a low-quality image.
+For more details, see the references, or just experiment with various
+compression settings.
+
+The software implements JPEG baseline and extended-sequential compression
+processes. Provision is made for supporting all variants of these processes,
+although some uncommon parameter settings aren't implemented yet. For legal
+reasons, we are not distributing code for the arithmetic-coding process; see
+LEGAL ISSUES. At present we have made no provision for supporting the
+progressive, hierarchical, or lossless processes defined in the standard.
+
+In order to support file conversion and viewing software, we have included
+considerable functionality beyond the bare JPEG coding/decoding capability;
+for example, the color quantization modules are not strictly part of JPEG
+decoding, but they are essential for output to colormapped file formats or
+colormapped displays. These extra functions can be compiled out if not
+required for a particular application.
+
+The emphasis in designing this software has been on achieving portability and
+flexibility, while also making it fast enough to be useful. In particular,
+the software is not intended to be read as a tutorial on JPEG. (See the
+REFERENCES section for introductory material.) While we hope that the entire
+package will someday be industrial-strength code, much remains to be done in
+performance tuning and in improving the capabilities of individual modules.
+
+
+This software can be used on several levels:
+
+* As canned software for JPEG compression and decompression. Just edit the
+ Makefile and configuration files as needed (see file SETUP), compile and go.
+ Members of the Independent JPEG Group will improve the out-of-the-box
+ functionality and speed as time goes on.
+
+* As the basis for other JPEG programs. For example, you could incorporate
+ the decompressor into a general image viewing package by replacing the
+ output module with write-to-screen functions. For an implementation on
+ specific hardware, you might want to replace some of the inner loops with
+ assembly code. For a non-command-line-driven system, you might want a
+ different user interface. (Members of the group will be producing Macintosh
+ and Amiga versions with more appropriate user interfaces, for example.)
+
+* As a toolkit for experimentation with JPEG and JPEG-like algorithms. Most
+ of the individual decisions you might want to mess with are packaged up into
+ separate modules. For example, the details of color-space conversion and
+ subsampling techniques are each localized in one compressor and one
+ decompressor module. You'd probably also want to extend the user interface
+ to give you more detailed control over the JPEG compression parameters.
+
+In particular, we welcome the use of this software as a component of commercial
+products; no royalty is required.
+
+
+ARCHIVE LOCATIONS
+=================
+
+The "official" archive site for this software is ftp.uu.net (Internet
+address 137.39.1.9 or 192.48.96.9). The most recent released version can
+always be found there in directory graphics/jpeg. This particular version
+will be archived as jpegsrc.v4.tar.Z. If you are on the Internet, you can
+retrieve files from UUNET by anonymous FTP. If you don't have FTP access,
+UUNET's archives are also available via UUCP; contact postmaster@uunet.uu.net
+for information on retrieving files that way.
+
+Numerous Internet sites maintain copies of the UUNET files; in particular,
+you can probably find a copy at any site that archives comp.sources.misc
+submissions. However, only ftp.uu.net is guaranteed to have the latest
+official version.
+
+You can also obtain this software from CompuServe, in the GRAPHSUPPORT forum
+(GO PICS), library 15; this version will be file jpsrc4.zip. Again,
+CompuServe is not guaranteed to have the very latest version.
+
+The JPEG FAQ (Frequently Asked Questions) article is a useful source of
+general information about JPEG. It is updated constantly and therefore
+is not included in this distribution. The FAQ is posted every two weeks
+to Usenet newsgroups comp.graphics, news.answers, and other groups. You
+can always obtain the latest version from the news.answers archive at
+rtfm.mit.edu (18.172.1.27). By FTP, fetch /pub/usenet/news.answers/jpeg-faq.
+If you don't have FTP, send e-mail to mail-server@rtfm.mit.edu with body
+"send usenet/news.answers/jpeg-faq".
+
+
+SUPPORTING SOFTWARE
+===================
+
+You will probably want Jef Poskanzer's PBMPLUS image software, which provides
+many useful operations on PPM-format image files. In particular, it can
+convert PPM images to and from a wide range of other formats. You can FTP
+this free software from export.lcs.mit.edu (contrib/pbmplus*.tar.Z) or
+ftp.ee.lbl.gov (pbmplus*.tar.Z). Unfortunately PBMPLUS is not nearly as
+portable as the JPEG software is; you are likely to have difficulty making it
+work on any non-Unix machine.
+
+If you are using X Windows you might want to use the xv or xloadimage viewers
+to save yourself the trouble of converting PPM to some other format. Both of
+these can be found in the contrib directory at export.lcs.mit.edu. Actually,
+xv version 2.00 and up incorporates our software and thus can read and write
+JPEG files directly. (NOTE: since xv internally reduces all images to 8
+bits/pixel, a JPEG file written by xv will not be very high quality; and xv
+cannot fully exploit a 24-bit display. These problems are expected to go away
+in the next xv release, planned for early 1993. In the meantime, use
+xloadimage for 24-bit displays.)
+
+For DOS machines, Lee Crocker's free Piclab program is a useful companion to
+the JPEG software. The latest version, currently 1.91, is available by FTP
+from SIMTEL20 and its various mirror sites, file <msdos.graphics>piclb191.zip.
+CompuServe also has it, in the same library as the JPEG software.
+
+
+SOFTWARE THAT'S NO HELP AT ALL
+==============================
+
+Handmade Software's shareware PC program GIF2JPG produces files that are
+totally incompatible with our programs. They use a proprietary format that is
+an amalgam of GIF and JPEG representations. However, you can force GIF2JPG
+to produce compatible files with its -j switch, and their decompression
+program JPG2GIF can read our files (at least ones produced with our default
+option settings).
+
+Some commercial JPEG implementations are also incompatible as of this writing,
+especially programs released before summer 1991. The root of the problem is
+that the ISO JPEG committee failed to specify a concrete file format. Some
+vendors "filled in the blanks" on their own, creating proprietary formats that
+no one else could read. (For example, none of the early commercial JPEG
+implementations for the Macintosh were able to exchange compressed files.)
+
+The file format we have adopted is called JFIF (see REFERENCES). This format
+has been agreed to by a number of major commercial JPEG vendors, and we expect
+that it will become the de facto standard. JFIF is a minimal representation;
+work is also going forward to incorporate JPEG compression into the TIFF 6.0
+standard, for use in "high end" applications that need to record a lot of
+additional data about an image. We intend to support TIFF 6.0 in the future.
+We hope that these two formats will be sufficient and that other, incompatible
+JPEG file formats will not proliferate.
+
+Indeed, part of the reason for developing and releasing this free software is
+to help force rapid convergence to de facto standards for JPEG file formats.
+SUPPORT STANDARD, NON-PROPRIETARY FORMATS: demand JFIF or TIFF 6.0!
+
+
+USING JPEG AS A SUBROUTINE IN A LARGER PROGRAM
+==============================================
+
+You can readily incorporate the JPEG compression and decompression routines in
+a larger program. The file example.c provides a skeleton of the interface
+routines you'll need for this purpose. Essentially, you replace jcmain.c (for
+compression) and/or jdmain.c (for decompression) with your own code. Note
+that the fewer JPEG options you allow the user to twiddle, the less code you
+need; all the default options are set up automatically. (Alternately, if you
+know a lot about JPEG or have a special application, you may want to twiddle
+the default options even more extensively than jcmain/jdmain do.)
+
+Most likely, you will want the uncompressed image to come from memory (for
+compression) or go to memory or the screen (for decompression). For this
+purpose you must provide image reading or writing routines that match the
+interface used by the image file I/O modules (jrdXXX or jwrXXX); again,
+example.c shows a skeleton of what is required. In this situation, you
+won't need any of the non-JPEG image file I/O modules used by cjpeg and djpeg.
+
+By default, any error detected inside the JPEG routines will cause a message
+to be printed on stderr, followed by exit(). You can override this behavior
+by supplying your own message-printing and/or error-exit routines; again,
+example.c shows how.
+
+We recommend you create libjpeg.a as shown in the Makefile, then link that
+with your surrounding program. (If your linker is at all reasonable, only the
+code you actually need will get loaded.) Include the files jconfig.h and
+jpegdata.h in C files that need to call the JPEG routines.
+
+CAUTION: some people have tried to compile JPEG and their surrounding code
+with different compilers, e.g., cc for JPEG and c++ or gcc for the rest. This
+is a Real Bad Move and you will deserve what happens to you if you try it.
+(Hint: the parameter structures can get laid out differently with no warning.)
+
+Read our "architecture" file for more info. If it seems to you that the
+software structure doesn't accommodate what you want to do, please contact
+the authors.
+
+Beginning with version 3, we will endeavor to hold the interface described by
+example.c constant, so that you can plug in updated versions of the JPEG code
+just by recompiling. However, we can't guarantee this, especially if you
+choose to twiddle any JPEG options not listed in example.c. Check the
+CHANGELOG when installing any new version, and compare example.c against the
+prior version. Recompile your calling software (don't just relink), as we may
+add or subtract fields in the parameter structures.
+
+
+REFERENCES
+==========
+
+We highly recommend reading one or more of these references before trying to
+understand the innards of any JPEG software.
+
+The best short technical introduction to the JPEG compression algorithm is
+ Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
+ Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
+(Adjacent articles in that issue discuss MPEG motion picture compression,
+applications of JPEG, and related topics.) If you don't have the CACM issue
+handy, a PostScript file containing a revised version of the article is
+available at ftp.uu.net, graphics/jpeg/wallace.ps.Z. The file (actually a
+preprint for an article to appear in IEEE Trans. Consumer Electronics) omits
+the sample images that appeared in CACM, but it includes corrections and some
+added material. Note: the Wallace article is copyright ACM and IEEE, and it
+may not be used for commercial purposes.
+
+A somewhat less technical, more leisurely introduction to JPEG can be found in
+"The Data Compression Book" by Mark Nelson, published by M&T Books (Redwood
+City, CA), 1991, ISBN 1-55851-216-0. This book provides good explanations and
+example C code for a multitude of compression methods including JPEG. It is
+an excellent source if you are comfortable reading C code but don't know much
+about data compression in general. The book's JPEG sample code is far from
+industrial-strength, but when you are ready to look at a full implementation,
+you've got one here...
+
+A new textbook about JPEG is "JPEG Still Image Data Compression Standard" by
+William B. Pennebaker and Joan L. Mitchell, published by Van Nostrand
+Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95. This book includes the
+complete text of the ISO JPEG standards (DIS 10918-1 and draft DIS 10918-2).
+This is by far the most complete exposition of JPEG in existence, and I highly
+recommend it. If you read the entire book, you will probably know more about
+JPEG than I do.
+
+The JPEG standard itself is not available electronically; you must order a
+paper copy through ISO. (Unless you are concerned about having a certified
+official copy, I recommend buying the Pennebaker and Mitchell book instead;
+it's much cheaper and includes a great deal of useful explanatory material.)
+In the US, copies of the standard may be ordered from ANSI Sales at (212)
+642-4900. It's not cheap: as of 1992, Part 1 is $95 and Part 2 is $47, plus
+7% shipping/handling. The standard is divided into two parts, Part 1 being
+the actual specification, while Part 2 covers compliance testing methods.
+As of early 1992, Part 1 has Draft International Standard status. It is
+titled "Digital Compression and Coding of Continuous-tone Still Images, Part
+1: Requirements and guidelines" and has document number ISO/IEC DIS 10918-1.
+Part 2 is still at Committee Draft status. It is titled "Digital Compression
+and Coding of Continuous-tone Still Images, Part 2: Compliance testing" and
+has document number ISO/IEC CD 10918-2. (NOTE: I'm told that the final
+version of Part 2 will differ considerably from the CD draft.)
+
+The JPEG standard does not specify all details of an interchangeable file
+format. For the omitted details we follow the "JFIF" conventions, revision
+1.02. A copy of the JFIF spec is available from:
+ Literature Department
+ C-Cube Microsystems, Inc.
+ 399A West Trimble Road
+ San Jose, CA 95131
+ (408) 944-6300
+A PostScript version of this document is available at ftp.uu.net, file
+graphics/jpeg/jfif.ps.Z. It can also be obtained by e-mail from the C-Cube
+mail server, netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg"
+to the server to obtain the JFIF document; send the message "help" if you have
+trouble.
+
+The TIFF 6.0 file format specification can be obtained by FTP from sgi.com
+(192.48.153.1), file graphics/tiff/TIFF6.ps.Z; or you can order a printed copy
+from Aldus Corp. at (206) 628-6593. It should be noted that the TIFF 6.0 spec
+of 3-June-92 has a number of serious problems in its JPEG features. A
+clarification note will probably be needed to ensure that TIFF JPEG files are
+compatible across different implementations. The IJG does not intend to
+support TIFF 6.0 until these problems are resolved.
+
+If you want to understand this implementation, start by reading the
+"architecture" documentation file. Please read "codingrules" if you want to
+contribute any code.
+
+
+LEGAL ISSUES
+============
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose. This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991, 1992, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+
+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
+sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
+ansi2knr.c is NOT covered by the above copyright and conditions, but instead
+by the usual distribution terms of the Free Software Foundation; principally,
+that you must include source code if you redistribute it. (See the file
+ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
+of any program generated from the JPEG code, this does not limit you more than
+the foregoing paragraphs do.
+
+
+It appears that the arithmetic coding option of the JPEG spec is covered by
+patents owned by IBM and AT&T, as well as a pending Japanese patent of
+Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining
+one or more licenses. For this reason, support for arithmetic coding has been
+removed from the free JPEG software. (Since arithmetic coding provides only a
+marginal gain over the unpatented Huffman mode, it is unlikely that very many
+implementors will support it. If you do obtain the necessary licenses,
+contact jpeg-info@uunet.uu.net for a copy of our arithmetic coding modules.)
+So far as we are aware, there are no patent restrictions on the remaining
+code.
+
+
+We are required to state that
+ "The Graphics Interchange Format(c) is the Copyright property of
+ CompuServe Incorporated. GIF(sm) is a Service Mark property of
+ CompuServe Incorporated."
+
+
+TO DO
+=====
+
+The next major release will probably be a significant rewrite to allow use of
+this code in conjunction with Sam Leffler's free TIFF library (assuming the
+bugs in the TIFF 6.0 specification get resolved).
+
+Many of the modules need fleshing out to provide more complete
+implementations, or to provide faster paths for common cases.
+Speeding things up is still high on our priority list.
+
+We'd appreciate it if people would compile and check out the code on as wide a
+variety of systems as possible, and report any portability problems
+encountered (with solutions, if possible). Checks of file compatibility with
+other JPEG implementations would also be of interest. Finally, we would
+appreciate code profiles showing where the most time is spent, especially on
+unusual systems.
+
+Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net.
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcdeflts.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcdeflts.c
new file mode 100644
index 000000000..cafa3b108
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcdeflts.c
@@ -0,0 +1,629 @@
+/* $TOG: jcdeflts.c /main/5 1998/02/09 16:18:43 kaleb $ */
+/* Module jcdeflts.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jcdeflts.c,v 1.3 1998/10/04 09:36:19 dawes Exp $ */
+/*
+ * jcdeflts.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains optional default-setting code for the JPEG compressor.
+ * User interfaces do not have to use this file, but those that don't use it
+ * must know a lot more about the innards of the JPEG code.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+#ifndef XIE_SUPPORTED
+/* Default do-nothing progress monitoring routine.
+ * This can be overridden by a user interface that wishes to
+ * provide progress monitoring; just set methods->progress_monitor
+ * after j_c_defaults is done. The routine will be called periodically
+ * during the compression process.
+ *
+ * During any one pass, loopcounter increases from 0 up to (not including)
+ * looplimit; the step size is not necessarily 1. Both the step size and
+ * the limit may differ between passes. The expected total number of passes
+ * is in cinfo->total_passes, and the number of passes already completed is
+ * in cinfo->completed_passes. Thus the fraction of work completed may be
+ * estimated as
+ * completed_passes + (loopcounter/looplimit)
+ * ------------------------------------------
+ * total_passes
+ * ignoring the fact that the passes may not be equal amounts of work.
+ */
+
+METHODDEF void
+progress_monitor (compress_info_ptr cinfo, long loopcounter, long looplimit)
+{
+ /* do nothing */
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Huffman table setup routines
+ */
+
+#ifdef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+add_huff_table (compress_info_ptr cinfo,
+ HUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
+#else
+add_huff_table (cinfo, htblptr, bits, val)
+ compress_info_ptr cinfo;
+ HUFF_TBL **htblptr;
+ const UINT8 *bits;
+ const UINT8 *val;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+add_huff_table (compress_info_ptr cinfo,
+ HUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
+#endif /* XIE_SUPPORTED */
+/* Define a Huffman table */
+{
+#ifdef XIE_SUPPORTED
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->c_alloc_small)
+ (cinfo, SIZEOF(HUFF_TBL));
+ if (*htblptr == NULL)
+ return(XIE_ERR);
+#else
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL));
+#endif /* XIE_SUPPORTED */
+
+ MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
+ MEMCOPY((*htblptr)->huffval, val, SIZEOF((*htblptr)->huffval));
+
+ /* Initialize sent_table FALSE so table will be written to JPEG file.
+ * In an application where we are writing non-interchange JPEG files,
+ * it might be desirable to save space by leaving default Huffman tables
+ * out of the file. To do that, just initialize sent_table = TRUE...
+ */
+
+ (*htblptr)->sent_table = FALSE;
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+std_huff_tables (compress_info_ptr cinfo)
+#else
+std_huff_tables (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+std_huff_tables (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
+/* IMPORTANT: these are only valid for 8-bit data precision! */
+{
+ static const UINT8 dc_luminance_bits[17] =
+ { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
+ static const UINT8 dc_luminance_val[] =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+
+ static const UINT8 dc_chrominance_bits[17] =
+ { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
+ static const UINT8 dc_chrominance_val[] =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+
+ static const UINT8 ac_luminance_bits[17] =
+ { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
+ static const UINT8 ac_luminance_val[] =
+ { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+ 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+ 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+ 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+ 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+ 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+ 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+ 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa };
+
+ static const UINT8 ac_chrominance_bits[17] =
+ { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
+ static const UINT8 ac_chrominance_val[] =
+ { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+ 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+ 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+ 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+ 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+ 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+ 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+ 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+ 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+ 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa };
+
+#ifdef XIE_SUPPORTED
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
+ dc_luminance_bits, dc_luminance_val))
+ return(XIE_ERR);
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
+ ac_luminance_bits, ac_luminance_val))
+ return(XIE_ERR);
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
+ dc_chrominance_bits, dc_chrominance_val))
+ return(XIE_ERR);
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
+ ac_chrominance_bits, ac_chrominance_val))
+ return(XIE_ERR);
+ return(0);
+#else
+ add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
+ dc_luminance_bits, dc_luminance_val);
+ add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
+ ac_luminance_bits, ac_luminance_val);
+ add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
+ dc_chrominance_bits, dc_chrominance_val);
+ add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
+ ac_chrominance_bits, ac_chrominance_val);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Quantization table setup routines
+ */
+
+#ifdef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+j_add_quant_table (compress_info_ptr cinfo, int which_tbl,
+ const QUANT_VAL *basic_table, int scale_factor,
+ boolean force_baseline)
+#else
+j_add_quant_table (cinfo, which_tbl, basic_table, scale_factor, force_baseline)
+ compress_info_ptr cinfo;
+ int which_tbl;
+ const QUANT_VAL *basic_table;
+ int scale_factor;
+ boolean force_baseline;
+#endif /* NeedFunctionPrototypes */
+#else
+GLOBAL void
+j_add_quant_table (compress_info_ptr cinfo, int which_tbl,
+ const QUANT_VAL *basic_table, int scale_factor,
+ boolean force_baseline)
+#endif /* XIE_SUPPORTED */
+/* Define a quantization table equal to the basic_table times
+ * a scale factor (given as a percentage).
+ * If force_baseline is TRUE, the computed quantization table entries
+ * are limited to 1..255 for JPEG baseline compatibility.
+ */
+{
+ QUANT_TBL_PTR * qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
+ int i;
+ long temp;
+
+#ifdef XIE_SUPPORTED
+ if (*qtblptr == NULL)
+ *qtblptr = (QUANT_TBL_PTR) (*cinfo->emethods->c_alloc_small)
+ (cinfo, SIZEOF(QUANT_TBL));
+ if (*qtblptr == NULL)
+ return(XIE_ERR);
+#else
+ if (*qtblptr == NULL)
+ *qtblptr = (QUANT_TBL_PTR) (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL));
+#endif /* XIE_SUPPORTED */
+
+ for (i = 0; i < DCTSIZE2; i++) {
+ temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
+ /* limit the values to the valid range */
+ if (temp <= 0L) temp = 1L;
+#ifdef EIGHT_BIT_SAMPLES
+ if (temp > 32767L) temp = 32767L; /* QUANT_VALs are 'short' */
+#else
+ if (temp > 65535L) temp = 65535L; /* QUANT_VALs are 'UINT16' */
+#endif
+ if (force_baseline && temp > 255L)
+ temp = 255L; /* limit to baseline range if requested */
+ (*qtblptr)[i] = (QUANT_VAL) temp;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+GLOBAL int
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+j_quality_scaling (int quality)
+#else
+j_quality_scaling (quality)
+ int quality;
+#endif /* NeedFunctionPrototypes */
+#else
+j_quality_scaling (int quality)
+#endif /* XIE_SUPPORTED */
+/* Convert a user-specified quality rating to a percentage scaling factor
+ * for an underlying quantization table, using our recommended scaling curve.
+ * The input 'quality' factor should be 0 (terrible) to 100 (very good).
+ */
+{
+ /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */
+ if (quality <= 0) quality = 1;
+ if (quality > 100) quality = 100;
+
+ /* The basic table is used as-is (scaling 100) for a quality of 50.
+ * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
+ * note that at Q=100 the scaling is 0, which will cause j_add_quant_table
+ * to make all the table entries 1 (hence, no quantization loss).
+ * Qualities 1..50 are converted to scaling percentage 5000/Q.
+ */
+ if (quality < 50)
+ quality = 5000 / quality;
+ else
+ quality = 200 - quality*2;
+
+ return quality;
+}
+
+
+#ifdef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline)
+#else
+j_set_quality (cinfo, quality, force_baseline)
+ compress_info_ptr cinfo;
+ int quality;
+ boolean force_baseline;
+#endif /* NeedFunctionPrototypes */
+#else
+GLOBAL void
+j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline)
+#endif /* XIE_SUPPORTED */
+/* Set or change the 'quality' (quantization) setting, using default tables.
+ * This is the standard quality-adjusting entry point for typical user
+ * interfaces; only those who want detailed control over quantization tables
+ * would use the preceding two routines directly.
+ */
+{
+ /* This is the sample quantization table given in the JPEG spec section K.1,
+ * but expressed in zigzag order (as are all of our quant. tables).
+ * The spec says that the values given produce "good" quality, and
+ * when divided by 2, "very good" quality. (These two settings are
+ * selected by quality=50 and quality=75 respectively.)
+ */
+ static const QUANT_VAL std_luminance_quant_tbl[DCTSIZE2] = {
+ 16, 11, 12, 14, 12, 10, 16, 14,
+ 13, 14, 18, 17, 16, 19, 24, 40,
+ 26, 24, 22, 22, 24, 49, 35, 37,
+ 29, 40, 58, 51, 61, 60, 57, 51,
+ 56, 55, 64, 72, 92, 78, 64, 68,
+ 87, 69, 55, 56, 80, 109, 81, 87,
+ 95, 98, 103, 104, 103, 62, 77, 113,
+ 121, 112, 100, 120, 92, 101, 103, 99
+ };
+ static const QUANT_VAL std_chrominance_quant_tbl[DCTSIZE2] = {
+ 17, 18, 18, 24, 21, 24, 47, 26,
+ 26, 47, 99, 66, 56, 66, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+ };
+
+ /* Convert user 0-100 rating to percentage scaling */
+ quality = j_quality_scaling(quality);
+
+ /* Set up two quantization tables using the specified quality scaling */
+#ifdef XIE_SUPPORTED
+ if (j_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
+ quality, force_baseline) == XIE_ERR)
+ return(XIE_ERR);
+ if(j_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
+ quality, force_baseline) == XIE_ERR)
+ return(XIE_ERR);
+
+ return(0);
+#else
+ j_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
+ quality, force_baseline);
+ j_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
+ quality, force_baseline);
+#endif /* XIE_SUPPORTED */
+}
+
+
+
+/* Default parameter setup for compression.
+ *
+ * User interfaces that don't choose to use this routine must do their
+ * own setup of all these parameters. Alternately, you can call this
+ * to establish defaults and then alter parameters selectively. This
+ * is the recommended approach since, if we add any new parameters,
+ * your code will still work (they'll be set to reasonable defaults).
+ *
+ * See above for the meaning of the 'quality' and 'force_baseline' parameters.
+ * Typically, the application's default quality setting will be passed to this
+ * routine. A later call on j_set_quality() can be used to change to a
+ * user-specified quality setting.
+ *
+ * This routine sets up for a color image; to output a grayscale image,
+ * do this first and call j_monochrome_default() afterwards.
+ * (The latter can be called within c_ui_method_selection, so the
+ * choice can depend on the input file header.)
+ * Note that if you want a JPEG colorspace other than GRAYSCALE or YCbCr,
+ * you should also change the component ID codes, and you should NOT emit
+ * a JFIF header (set write_JFIF_header = FALSE).
+ *
+ * CAUTION: if you want to compress multiple images per run, it's necessary
+ * to call j_c_defaults before *each* call to jpeg_compress, since subsidiary
+ * structures like the Huffman tables are automatically freed during cleanup.
+ */
+
+#ifdef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+j_c_defaults (compress_info_ptr cinfo, int quality, boolean force_baseline)
+#else
+j_c_defaults (cinfo, quality, force_baseline)
+ compress_info_ptr cinfo;
+ int quality;
+ boolean force_baseline;
+#endif /* NeedFunctionPrototypes */
+#else
+GLOBAL void
+j_c_defaults (compress_info_ptr cinfo, int quality, boolean force_baseline)
+#endif /* XIE_SUPPORTED */
+/* NB: the external methods must already be set up. */
+{
+ short i;
+ jpeg_component_info * compptr;
+
+ /* Initialize pointers as needed to mark stuff unallocated. */
+ cinfo->comp_info = NULL;
+ for (i = 0; i < NUM_QUANT_TBLS; i++)
+ cinfo->quant_tbl_ptrs[i] = NULL;
+ for (i = 0; i < NUM_HUFF_TBLS; i++) {
+ cinfo->dc_huff_tbl_ptrs[i] = NULL;
+ cinfo->ac_huff_tbl_ptrs[i] = NULL;
+ }
+
+ cinfo->data_precision = BITS_IN_JSAMPLE; /* default; can be overridden by input_init */
+ cinfo->density_unit = 0; /* Pixel size is unknown by default */
+ cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
+ cinfo->Y_density = 1;
+
+ cinfo->input_gamma = 1.0; /* no gamma correction by default */
+
+ /* Prepare three color components; first is luminance which is also usable */
+ /* for grayscale. The others are assumed to be UV or similar chrominance. */
+ cinfo->write_JFIF_header = TRUE;
+ cinfo->jpeg_color_space = CS_YCbCr;
+ cinfo->num_components = 3;
+#ifdef XIE_SUPPORTED
+ cinfo->comp_info = (jpeg_component_info *)
+ (*cinfo->emethods->c_alloc_small)
+ (cinfo, (4 * SIZEOF(jpeg_component_info)));
+ if (cinfo->comp_info == NULL)
+ return(XIE_ERR);
+#else
+ cinfo->comp_info = (jpeg_component_info *)
+ (*cinfo->emethods->alloc_small) (4 * SIZEOF(jpeg_component_info));
+#endif /* XIE_SUPPORTED */
+ /* Note: we allocate a 4-entry comp_info array so that user interface can
+ * easily change over to CMYK color space if desired.
+ */
+
+ compptr = &cinfo->comp_info[0];
+ compptr->component_index = 0;
+ compptr->component_id = 1; /* JFIF specifies IDs 1,2,3 */
+#ifdef XIE_SUPPORTED
+ compptr->h_samp_factor = cinfo->xie_h_samp_factor[0];
+ compptr->v_samp_factor = cinfo->xie_v_samp_factor[0];
+#else
+ compptr->h_samp_factor = 2; /* default to 2x2 subsamples of chrominance */
+ compptr->v_samp_factor = 2;
+#endif /* XIE_SUPPORTED */
+ compptr->quant_tbl_no = 0; /* use tables 0 for luminance */
+ compptr->dc_tbl_no = 0;
+ compptr->ac_tbl_no = 0;
+
+ compptr = &cinfo->comp_info[1];
+ compptr->component_index = 1;
+ compptr->component_id = 2;
+#ifdef XIE_SUPPORTED
+ compptr->h_samp_factor = cinfo->xie_h_samp_factor[1];
+ compptr->v_samp_factor = cinfo->xie_v_samp_factor[1];
+#else
+ compptr->h_samp_factor = 1;
+ compptr->v_samp_factor = 1;
+#endif /* XIE_SUPPORTED */
+ compptr->quant_tbl_no = 1; /* use tables 1 for chrominance */
+ compptr->dc_tbl_no = 1;
+ compptr->ac_tbl_no = 1;
+
+ compptr = &cinfo->comp_info[2];
+ compptr->component_index = 2;
+ compptr->component_id = 3;
+#ifdef XIE_SUPPORTED
+ compptr->h_samp_factor = cinfo->xie_h_samp_factor[2];
+ compptr->v_samp_factor = cinfo->xie_v_samp_factor[2];
+#else
+ compptr->h_samp_factor = 1;
+ compptr->v_samp_factor = 1;
+#endif /* XIE_SUPPORTED */
+ compptr->quant_tbl_no = 1; /* use tables 1 for chrominance */
+ compptr->dc_tbl_no = 1;
+ compptr->ac_tbl_no = 1;
+
+ /* Set up two quantization tables using the specified quality scaling */
+#ifdef XIE_SUPPORTED
+ if (j_set_quality(cinfo, quality, force_baseline) == XIE_ERR)
+ return(XIE_ERR);
+#else
+ j_set_quality(cinfo, quality, force_baseline);
+#endif /* XIE_SUPPORTED */
+
+ /* Set up two Huffman tables in case user interface wants Huffman coding */
+#ifdef XIE_SUPPORTED
+ if(std_huff_tables(cinfo) == XIE_ERR)
+ return(XIE_ERR);
+#else
+ std_huff_tables(cinfo);
+#endif /* XIE_SUPPORTED */
+
+ /* Initialize default arithmetic coding conditioning */
+ for (i = 0; i < NUM_ARITH_TBLS; i++) {
+ cinfo->arith_dc_L[i] = 0;
+ cinfo->arith_dc_U[i] = 1;
+ cinfo->arith_ac_K[i] = 5;
+ }
+
+ /* Use Huffman coding, not arithmetic coding, by default */
+ cinfo->arith_code = FALSE;
+
+ /* Color images are interleaved by default */
+ cinfo->interleave = TRUE;
+
+ /* By default, don't do extra passes to optimize entropy coding */
+ cinfo->optimize_coding = FALSE;
+
+ /* By default, use the simpler non-cosited sampling alignment */
+ cinfo->CCIR601_sampling = FALSE;
+
+ /* No input smoothing */
+ cinfo->smoothing_factor = 0;
+
+ /* No restart markers */
+ cinfo->restart_interval = 0;
+ cinfo->restart_in_rows = 0;
+
+#ifdef XIE_SUPPORTED
+ return(0);
+#else
+ /* Install default do-nothing progress monitoring method. */
+ cinfo->methods->progress_monitor = progress_monitor;
+#endif /* XIE_SUPPORTED */
+}
+
+
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+j_monochrome_default (compress_info_ptr cinfo)
+#else
+j_monochrome_default (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+j_monochrome_default (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Change the j_c_defaults() values to emit a monochrome JPEG file. */
+{
+ jpeg_component_info * compptr;
+
+ cinfo->jpeg_color_space = CS_GRAYSCALE;
+ cinfo->num_components = 1;
+ /* Set single component to 1x1 subsampling */
+ compptr = &cinfo->comp_info[0];
+ compptr->h_samp_factor = 1;
+ compptr->v_samp_factor = 1;
+}
+
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcexpand.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcexpand.c
new file mode 100644
index 000000000..afbbd9808
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcexpand.c
@@ -0,0 +1,170 @@
+/* $TOG: jcexpand.c /main/5 1998/02/09 16:18:49 kaleb $ */
+/* Module jcexpand.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jcexpand.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains image edge-expansion routines.
+ * These routines are invoked via the edge_expand method.
+ */
+
+#include "jinclude.h"
+
+
+/*
+ * Expand an image so that it is a multiple of the MCU dimensions.
+ * This is to be accomplished by duplicating the rightmost column
+ * and/or bottommost row of pixels. The image has not yet been
+ * downsampled, so all components have the same dimensions.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+edge_expand (compress_info_ptr cinfo,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPIMAGE image_data)
+#else
+edge_expand (cinfo, input_cols, input_rows, output_cols, output_rows, image_data)
+ compress_info_ptr cinfo;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPIMAGE image_data;
+#endif /* NeedFunctionPrototypes */
+#else
+edge_expand (compress_info_ptr cinfo,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPIMAGE image_data)
+#endif /* XIE_SUPPORTED */
+{
+ /* Expand horizontally */
+ if (input_cols < output_cols) {
+ register JSAMPROW ptr;
+ register JSAMPLE pixval;
+ register long count;
+ register int row;
+ short ci;
+ long numcols = output_cols - input_cols;
+
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ for (row = 0; row < input_rows; row++) {
+ ptr = image_data[ci][row] + (input_cols-1);
+ pixval = GETJSAMPLE(*ptr++);
+ for (count = numcols; count > 0; count--)
+ *ptr++ = pixval;
+ }
+ }
+ }
+
+ /* Expand vertically */
+ /* This happens only once at the bottom of the image, */
+ /* so it needn't be super-efficient */
+ if (input_rows < output_rows) {
+ register int row;
+ short ci;
+ JSAMPARRAY this_component;
+
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ this_component = image_data[ci];
+ for (row = input_rows; row < output_rows; row++) {
+ jcopy_sample_rows(this_component, input_rows-1, this_component, row,
+ 1, output_cols);
+ }
+ }
+ }
+}
+
+
+/*
+ * The method selection routine for edge expansion.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselexpand (compress_info_ptr cinfo)
+#else
+jselexpand (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselexpand (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* just one implementation for now */
+ cinfo->methods->edge_expand = edge_expand;
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jchuff.c b/xc/programs/Xserver/XIE/mixie/jpeg/jchuff.c
new file mode 100644
index 000000000..7e4df0594
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jchuff.c
@@ -0,0 +1,1026 @@
+/* $TOG: jchuff.c /main/5 1998/02/09 16:18:53 kaleb $ */
+/* Module jchuff.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jchuff.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy encoding routines.
+ * These routines are invoked via the methods entropy_encode,
+ * entropy_encode_init/term, and entropy_optimize.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+
+/* Static variables to avoid passing 'round extra parameters */
+
+static compress_info_ptr cinfo;
+
+static INT32 huff_put_buffer; /* current bit-accumulation buffer */
+static int huff_put_bits; /* # of bits now in it */
+
+#ifndef XIE_SUPPORTED
+static char * output_buffer; /* output buffer */
+static int bytes_in_buffer;
+#endif /* XIE_SUPPORTED */
+
+
+LOCAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fix_huff_tbl (HUFF_TBL * htbl)
+#else
+fix_huff_tbl (htbl)
+ HUFF_TBL * htbl;
+#endif /* NeedFunctionPrototypes */
+#else
+fix_huff_tbl (HUFF_TBL * htbl)
+#endif /* XIE_SUPPORTED */
+/* Compute derived values for a Huffman table */
+{
+ int p, i, l, lastp, si;
+ char huffsize[257];
+ UINT16 huffcode[257];
+ UINT16 code;
+
+ /* Figure C.1: make table of Huffman code length for each symbol */
+ /* Note that this is in code-length order. */
+
+ p = 0;
+ for (l = 1; l <= 16; l++) {
+ for (i = 1; i <= (int) htbl->bits[l]; i++)
+ huffsize[p++] = (char) l;
+ }
+ huffsize[p] = 0;
+ lastp = p;
+
+ /* Figure C.2: generate the codes themselves */
+ /* Note that this is in code-length order. */
+
+ code = 0;
+ si = huffsize[0];
+ p = 0;
+ while (huffsize[p]) {
+ while (((int) huffsize[p]) == si) {
+ huffcode[p++] = code;
+ code++;
+ }
+ code <<= 1;
+ si++;
+ }
+
+ /* Figure C.3: generate encoding tables */
+ /* These are code and size indexed by symbol value */
+
+ /* Set any codeless symbols to have code length 0;
+ * this allows emit_bits to detect any attempt to emit such symbols.
+ */
+ MEMZERO(htbl->ehufsi, SIZEOF(htbl->ehufsi));
+
+ for (p = 0; p < lastp; p++) {
+ htbl->ehufco[htbl->huffval[p]] = huffcode[p];
+ htbl->ehufsi[htbl->huffval[p]] = huffsize[p];
+ }
+
+ /* We don't bother to fill in the decoding tables mincode[], maxcode[], */
+ /* and valptr[], since they are not used for encoding. */
+}
+
+
+/* Outputting bytes to the file */
+
+#ifdef XIE_SUPPORTED
+LOCAL void
+#if NeedFunctionPrototypes
+flush_bytes (void)
+#else
+flush_bytes ()
+#endif /* NeedFunctionPrototypes */
+{
+}
+
+#define emit_byte(val) \
+ MAKESTMT( if (cinfo->bytes_in_buffer >= cinfo->jpeg_buf_size) \
+ return(-1); \
+ cinfo->output_buffer[cinfo->bytes_in_buffer++] = (char) (val); )
+
+#else
+LOCAL void
+flush_bytes (void)
+{
+ if (bytes_in_buffer)
+ (*cinfo->methods->entropy_output) (cinfo, output_buffer, bytes_in_buffer);
+ bytes_in_buffer = 0;
+}
+
+#define emit_byte(val) \
+ MAKESTMT( if (bytes_in_buffer >= JPEG_BUF_SIZE) \
+ flush_bytes(); \
+ output_buffer[bytes_in_buffer++] = (char) (val); )
+
+#endif /* XIE_SUPPORTED */
+
+/* Outputting bits to the file */
+
+/* Only the right 24 bits of huff_put_buffer are used; the valid bits are
+ * left-justified in this part. At most 16 bits can be passed to emit_bits
+ * in one call, and we never retain more than 7 bits in huff_put_buffer
+ * between calls, so 24 bits are sufficient.
+ */
+
+INLINE
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_bits (UINT16 code, int size)
+#else
+emit_bits (code, size)
+ UINT16 code;
+ int size;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_bits (UINT16 code, int size)
+#endif /* XIE_SUPPORTED */
+{
+ /* This routine is heavily used, so it's worth coding tightly. */
+ register INT32 put_buffer = code;
+#ifdef XIE_SUPPORTED
+ register int put_bits = cinfo->huff_put_bits;
+#else
+ register int put_bits = huff_put_bits;
+#endif /* XIE_SUPPORTED */
+
+ /* if size is 0, caller used an invalid Huffman table entry */
+ if (size == 0)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Missing Huffman code table entry");
+#endif /* XIE_SUPPORTED */
+
+ put_buffer &= (((INT32) 1) << size) - 1; /* Mask off any excess bits in code */
+
+ put_bits += size; /* new number of bits in buffer */
+
+ put_buffer <<= 24 - put_bits; /* align incoming bits */
+
+#ifdef XIE_SUPPORTED
+ put_buffer |= cinfo->huff_put_buffer; /* and merge with old buffer contents */
+#else
+ put_buffer |= huff_put_buffer; /* and merge with old buffer contents */
+#endif /* XIE_SUPPORTED */
+
+ while (put_bits >= 8) {
+ int c = (int) ((put_buffer >> 16) & 0xFF);
+
+ emit_byte(c);
+ if (c == 0xFF) { /* need to stuff a zero byte? */
+ emit_byte(0);
+ }
+ put_buffer <<= 8;
+ put_bits -= 8;
+ }
+
+#ifdef XIE_SUPPORTED
+ cinfo->huff_put_buffer = put_buffer; /* Update global variables */
+ cinfo->huff_put_bits = put_bits;
+ return(0);
+#else
+ huff_put_buffer = put_buffer; /* Update global variables */
+ huff_put_bits = put_bits;
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+flush_bits (void)
+#else
+flush_bits ()
+#endif /* NeedFunctionPrototypes */
+{
+ register int status;
+
+ /* fill any partial byte with ones */
+ if ((status = emit_bits((UINT16) 0x7F, 7)) < 0)
+ return(status);
+ cinfo->huff_put_buffer = 0; /* and reset bit-buffer to empty */
+ cinfo->huff_put_bits = 0;
+ return(0);
+}
+#else
+LOCAL void
+flush_bits (void)
+{
+ emit_bits((UINT16) 0x7F, 7); /* fill any partial byte with ones */
+ huff_put_buffer = 0; /* and reset bit-buffer to empty */
+ huff_put_bits = 0;
+}
+#endif /* XIE_SUPPORTED */
+
+
+
+/* Encode a single block's worth of coefficients */
+/* Note that the DC coefficient has already been converted to a difference */
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl)
+#else
+encode_one_block (block, dctbl, actbl)
+ JBLOCK block;
+ HUFF_TBL *dctbl;
+ HUFF_TBL *actbl;
+#endif /* NeedFunctionPrototypes */
+{
+ register int status;
+#else
+LOCAL void
+encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl)
+{
+#endif /* XIE_SUPPORTED */
+ register int temp, temp2;
+ register int nbits;
+ register int k, r, i;
+
+ /* Encode the DC coefficient difference per section F.1.2.1 */
+
+ temp = temp2 = block[0];
+
+ if (temp < 0) {
+ temp = -temp; /* temp is abs value of input */
+ /* For a negative input, want temp2 = bitwise complement of abs(input) */
+ /* This code assumes we are on a two's complement machine */
+ temp2--;
+ }
+
+ /* Find the number of bits needed for the magnitude of the coefficient */
+ nbits = 0;
+ while (temp) {
+ nbits++;
+ temp >>= 1;
+ }
+
+ /* Emit the Huffman-coded symbol for the number of bits */
+#ifdef XIE_SUPPORTED
+ if ((status = emit_bits(dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) < 0)
+ return(status);
+#else
+ emit_bits(dctbl->ehufco[nbits], dctbl->ehufsi[nbits]);
+#endif /* XIE_SUPPORTED */
+
+ /* Emit that number of bits of the value, if positive, */
+ /* or the complement of its magnitude, if negative. */
+ if (nbits) /* emit_bits rejects calls with size 0 */
+#ifdef XIE_SUPPORTED
+ {
+ if ((status = emit_bits((UINT16) temp2, nbits)) < 0)
+ return(status);
+ }
+#else
+ emit_bits((UINT16) temp2, nbits);
+#endif /* XIE_SUPPORTED */
+
+ /* Encode the AC coefficients per section F.1.2.2 */
+
+ r = 0; /* r = run length of zeros */
+
+ for (k = 1; k < DCTSIZE2; k++) {
+ if ((temp = block[k]) == 0) {
+ r++;
+ } else {
+ /* if run length > 15, must emit special run-length-16 codes (0xF0) */
+ while (r > 15) {
+#ifdef XIE_SUPPORTED
+ if ((status = emit_bits(actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) < 0)
+ return(status);
+#else
+ emit_bits(actbl->ehufco[0xF0], actbl->ehufsi[0xF0]);
+#endif /* XIE_SUPPORTED */
+ r -= 16;
+ }
+
+ temp2 = temp;
+ if (temp < 0) {
+ temp = -temp; /* temp is abs value of input */
+ /* This code assumes we are on a two's complement machine */
+ temp2--;
+ }
+
+ /* Find the number of bits needed for the magnitude of the coefficient */
+ nbits = 1; /* there must be at least one 1 bit */
+ while (temp >>= 1)
+ nbits++;
+
+ /* Emit Huffman symbol for run length / number of bits */
+ i = (r << 4) + nbits;
+#ifdef XIE_SUPPORTED
+ if ((status = emit_bits(actbl->ehufco[i], actbl->ehufsi[i])) < 0)
+ return(status);
+#else
+ emit_bits(actbl->ehufco[i], actbl->ehufsi[i]);
+#endif /* XIE_SUPPORTED */
+
+ /* Emit that number of bits of the value, if positive, */
+ /* or the complement of its magnitude, if negative. */
+#ifdef XIE_SUPPORTED
+ if ((status = emit_bits((UINT16) temp2, nbits)) < 0)
+ return(status);
+#else
+ emit_bits((UINT16) temp2, nbits);
+#endif /* XIE_SUPPORTED */
+
+ r = 0;
+ }
+ }
+
+ /* If the last coef(s) were zero, emit an end-of-block code */
+ if (r > 0)
+#ifdef XIE_SUPPORTED
+ {
+ if ((status = emit_bits(actbl->ehufco[0], actbl->ehufsi[0])) < 0)
+ return(status);
+ }
+ return(0);
+#else
+ emit_bits(actbl->ehufco[0], actbl->ehufsi[0]);
+#endif /* XIE_SUPPORTED */
+}
+
+
+
+/*
+ * Initialize for a Huffman-compressed scan.
+ * This is invoked after writing the SOS marker.
+ * The pipeline controller must establish the entropy_output method pointer
+ * before calling this routine.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+huff_init (compress_info_ptr xinfo)
+#else
+huff_init (xinfo)
+ compress_info_ptr xinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+huff_init (compress_info_ptr xinfo)
+#endif /* XIE_SUPPORTED */
+{
+ short ci;
+ jpeg_component_info * compptr;
+
+ /* Initialize static variables */
+ cinfo = xinfo;
+
+#ifdef XIE_SUPPORTED
+ cinfo->huff_put_buffer = 0;
+ cinfo->huff_put_bits = 0;
+ cinfo->bytes_in_buffer = 0;
+#else
+ huff_put_buffer = 0;
+ huff_put_bits = 0;
+
+ /* Initialize the output buffer */
+ output_buffer = (char *) (*cinfo->emethods->alloc_small)
+ ((size_t) JPEG_BUF_SIZE);
+ bytes_in_buffer = 0;
+#endif /* XIE_SUPPORTED */
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ /* Make sure requested tables are present */
+ if (cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no] == NULL ||
+ cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no] == NULL)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Use of undefined Huffman table");
+#endif /* XIE_SUPPORTED */
+ /* Compute derived values for Huffman tables */
+ /* We may do this more than once for same table, but it's not a big deal */
+ fix_huff_tbl(cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no]);
+ fix_huff_tbl(cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]);
+ /* Initialize DC predictions to 0 */
+ cinfo->last_dc_val[ci] = 0;
+ }
+
+ /* Initialize restart stuff */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+ cinfo->next_restart_num = 0;
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Emit a restart marker & resynchronize predictions.
+ */
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_restart (compress_info_ptr cinfo)
+#else
+emit_restart (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+#else
+LOCAL void
+emit_restart (compress_info_ptr cinfo)
+{
+#endif /* XIE_SUPPORTED */
+ short ci;
+
+#ifdef XIE_SUPPORTED
+ if ((status = flush_bits()) < 0)
+ return(status);
+#else
+ flush_bits();
+#endif /* XIE_SUPPORTED */
+
+ emit_byte(0xFF);
+ emit_byte(RST0 + cinfo->next_restart_num);
+
+ /* Re-initialize DC predictions to 0 */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = 0;
+
+ /* Update restart state */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+ cinfo->next_restart_num++;
+ cinfo->next_restart_num &= 7;
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Encode and output one MCU's worth of Huffman-compressed coefficients.
+ */
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+huff_encode (compress_info_ptr xinfo, JBLOCK *MCU_data)
+#else
+huff_encode (xinfo, MCU_data)
+ compress_info_ptr xinfo;
+ JBLOCK *MCU_data;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+#else
+METHODDEF void
+huff_encode (compress_info_ptr xinfo, JBLOCK *MCU_data)
+{
+#endif /* XIE_SUPPORTED */
+ short blkn, ci;
+ jpeg_component_info * compptr;
+ JCOEF temp;
+#ifdef XIE_SUPPORTED
+ JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ last_dc_val[ci] = cinfo->last_dc_val[ci];
+
+ /* Initialize static variables */
+ cinfo = xinfo;
+ huff_put_buffer = cinfo->huff_put_buffer;
+ huff_put_bits = cinfo->huff_put_bits;
+#endif /* XIE_SUPPORTED */
+
+ /* Account for restart interval, emit restart marker if needed */
+ if (cinfo->restart_interval) {
+ if (cinfo->restarts_to_go == 0)
+#ifdef XIE_SUPPORTED
+ if ((status = emit_restart(cinfo)) < 0) {
+ if (status != XIE_ERR) {
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = last_dc_val[ci];
+ cinfo->huff_put_buffer = huff_put_buffer;
+ cinfo->huff_put_bits = huff_put_bits;
+ }
+ return(status);
+ }
+#else
+ emit_restart(cinfo);
+#endif /* XIE_SUPPORTED */
+ cinfo->restarts_to_go--;
+ }
+
+ for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+ ci = cinfo->MCU_membership[blkn];
+ compptr = cinfo->cur_comp_info[ci];
+ /* Convert DC value to difference, update last_dc_val */
+ temp = MCU_data[blkn][0];
+ MCU_data[blkn][0] -= cinfo->last_dc_val[ci];
+ cinfo->last_dc_val[ci] = temp;
+#ifdef XIE_SUPPORTED
+ if ((status = encode_one_block(MCU_data[blkn],
+ cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no],
+ cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no])) < 0) {
+ /* Reset global variables for restart */
+ if (status != XIE_ERR) {
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = last_dc_val[ci];
+ cinfo->huff_put_buffer = huff_put_buffer;
+ cinfo->huff_put_bits = huff_put_bits;
+ }
+ return(status);
+ }
+#else
+ encode_one_block(MCU_data[blkn],
+ cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no],
+ cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]);
+#endif /* XIE_SUPPORTED */
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Finish up at the end of a Huffman-compressed scan.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+huff_term (compress_info_ptr xinfo)
+#else
+huff_term (xinfo)
+ compress_info_ptr xinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+#else
+METHODDEF void
+huff_term (compress_info_ptr xinfo)
+{
+#endif /* XIE_SUPPORTED */
+#ifdef XIE_SUPPORTED
+ /* Initialize static variables */
+ cinfo = xinfo;
+ /* Flush out the last data */
+ if ((status = flush_bits()) < 0)
+ return(status);
+#else
+ /* Flush out the last data */
+ flush_bits();
+#endif /* XIE_SUPPORTED */
+ flush_bytes();
+ /* Release the I/O buffer */
+#ifdef XIE_SUPPORTED
+ return(0);
+#else
+ (*cinfo->emethods->free_small) ((pointer ) output_buffer);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Huffman coding optimization.
+ *
+ * This actually is optimization, in the sense that we find the best possible
+ * Huffman table(s) for the given data. We first scan the supplied data and
+ * count the number of uses of each symbol that is to be Huffman-coded.
+ * (This process must agree with the code above.) Then we build an
+ * optimal Huffman coding tree for the observed counts.
+ */
+
+#ifndef XIE_SUPPORTED
+#ifdef ENTROPY_OPT_SUPPORTED
+
+
+/* These are static so htest_one_block can find 'em */
+static long * dc_count_ptrs[NUM_HUFF_TBLS];
+static long * ac_count_ptrs[NUM_HUFF_TBLS];
+
+
+LOCAL void
+gen_huff_coding (compress_info_ptr cinfo, HUFF_TBL *htbl, long freq[])
+/* Generate the optimal coding for the given counts */
+{
+#define MAX_CLEN 32 /* assumed maximum initial code length */
+ UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
+ short codesize[257]; /* codesize[k] = code length of symbol k */
+ short others[257]; /* next symbol in current branch of tree */
+ int c1, c2;
+ int p, i, j;
+ long v;
+
+ /* This algorithm is explained in section K.2 of the JPEG standard */
+
+ MEMZERO(bits, SIZEOF(bits));
+ MEMZERO(codesize, SIZEOF(codesize));
+ for (i = 0; i < 257; i++)
+ others[i] = -1; /* init links to empty */
+
+ freq[256] = 1; /* make sure there is a nonzero count */
+ /* including the pseudo-symbol 256 in the Huffman procedure guarantees
+ * that no real symbol is given code-value of all ones, because 256
+ * will be placed in the largest codeword category.
+ */
+
+ /* Huffman's basic algorithm to assign optimal code lengths to symbols */
+
+ for (;;) {
+ /* Find the smallest nonzero frequency, set c1 = its symbol */
+ /* In case of ties, take the larger symbol number */
+ c1 = -1;
+ v = 1000000000L;
+ for (i = 0; i <= 256; i++) {
+ if (freq[i] && freq[i] <= v) {
+ v = freq[i];
+ c1 = i;
+ }
+ }
+
+ /* Find the next smallest nonzero frequency, set c2 = its symbol */
+ /* In case of ties, take the larger symbol number */
+ c2 = -1;
+ v = 1000000000L;
+ for (i = 0; i <= 256; i++) {
+ if (freq[i] && freq[i] <= v && i != c1) {
+ v = freq[i];
+ c2 = i;
+ }
+ }
+
+ /* Done if we've merged everything into one frequency */
+ if (c2 < 0)
+ break;
+
+ /* Else merge the two counts/trees */
+ freq[c1] += freq[c2];
+ freq[c2] = 0;
+
+ /* Increment the codesize of everything in c1's tree branch */
+ codesize[c1]++;
+ while (others[c1] >= 0) {
+ c1 = others[c1];
+ codesize[c1]++;
+ }
+
+ others[c1] = c2; /* chain c2 onto c1's tree branch */
+
+ /* Increment the codesize of everything in c2's tree branch */
+ codesize[c2]++;
+ while (others[c2] >= 0) {
+ c2 = others[c2];
+ codesize[c2]++;
+ }
+ }
+
+ /* Now count the number of symbols of each code length */
+ for (i = 0; i <= 256; i++) {
+ if (codesize[i]) {
+ /* The JPEG standard seems to think that this can't happen, */
+ /* but I'm paranoid... */
+ if (codesize[i] > MAX_CLEN)
+ ERREXIT(cinfo->emethods, "Huffman code size table overflow");
+
+ bits[codesize[i]]++;
+ }
+ }
+
+ /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
+ * Huffman procedure assigned any such lengths, we must adjust the coding.
+ * Here is what the JPEG spec says about how this next bit works:
+ * Since symbols are paired for the longest Huffman code, the symbols are
+ * removed from this length category two at a time. The prefix for the pair
+ * (which is one bit shorter) is allocated to one of the pair; then,
+ * skipping the BITS entry for that prefix length, a code word from the next
+ * shortest nonzero BITS entry is converted into a prefix for two code words
+ * one bit longer.
+ */
+
+ for (i = MAX_CLEN; i > 16; i--) {
+ while (bits[i] > 0) {
+ j = i - 2; /* find length of new prefix to be used */
+ while (bits[j] == 0)
+ j--;
+
+ bits[i] -= 2; /* remove two symbols */
+ bits[i-1]++; /* one goes in this length */
+ bits[j+1] += 2; /* two new symbols in this length */
+ bits[j]--; /* symbol of this length is now a prefix */
+ }
+ }
+
+ /* Remove the count for the pseudo-symbol 256 from the largest codelength */
+ while (bits[i] == 0) /* find largest codelength still in use */
+ i--;
+ bits[i]--;
+
+ /* Return final symbol counts (only for lengths 0..16) */
+ MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
+
+ /* Return a list of the symbols sorted by code length */
+ /* It's not real clear to me why we don't need to consider the codelength
+ * changes made above, but the JPEG spec seems to think this works.
+ */
+ p = 0;
+ for (i = 1; i <= MAX_CLEN; i++) {
+ for (j = 0; j <= 255; j++) {
+ if (codesize[j] == i) {
+ htbl->huffval[p] = (UINT8) j;
+ p++;
+ }
+ }
+ }
+}
+
+
+/* Process a single block's worth of coefficients */
+/* Note that the DC coefficient has already been converted to a difference */
+
+LOCAL void
+htest_one_block (JBLOCK block, JCOEF block0,
+ long dc_counts[], long ac_counts[])
+{
+ register INT32 temp;
+ register int nbits;
+ register int k, r;
+
+ /* Encode the DC coefficient difference per section F.1.2.1 */
+
+ /* Find the number of bits needed for the magnitude of the coefficient */
+ temp = block0;
+ if (temp < 0) temp = -temp;
+
+ for (nbits = 0; temp; nbits++)
+ temp >>= 1;
+
+ /* Count the Huffman symbol for the number of bits */
+ dc_counts[nbits]++;
+
+ /* Encode the AC coefficients per section F.1.2.2 */
+
+ r = 0; /* r = run length of zeros */
+
+ for (k = 1; k < DCTSIZE2; k++) {
+ if ((temp = block[k]) == 0) {
+ r++;
+ } else {
+ /* if run length > 15, must emit special run-length-16 codes (0xF0) */
+ while (r > 15) {
+ ac_counts[0xF0]++;
+ r -= 16;
+ }
+
+ /* Find the number of bits needed for the magnitude of the coefficient */
+ if (temp < 0) temp = -temp;
+
+ for (nbits = 0; temp; nbits++)
+ temp >>= 1;
+
+ /* Count Huffman symbol for run length / number of bits */
+ ac_counts[(r << 4) + nbits]++;
+
+ r = 0;
+ }
+ }
+
+ /* If the last coef(s) were zero, emit an end-of-block code */
+ if (r > 0)
+ ac_counts[0]++;
+}
+
+
+
+/*
+ * Trial-encode one MCU's worth of Huffman-compressed coefficients.
+ */
+
+LOCAL void
+htest_encode (compress_info_ptr cinfo, JBLOCK *MCU_data)
+{
+ short blkn, ci;
+ jpeg_component_info * compptr;
+
+ /* Take care of restart intervals if needed */
+ if (cinfo->restart_interval) {
+ if (cinfo->restarts_to_go == 0) {
+ /* Re-initialize DC predictions to 0 */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = 0;
+ /* Update restart state */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+ }
+ cinfo->restarts_to_go--;
+ }
+
+ for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+ ci = cinfo->MCU_membership[blkn];
+ compptr = cinfo->cur_comp_info[ci];
+ /* NB: unlike the real entropy encoder, we may not change the input data */
+ htest_one_block(MCU_data[blkn],
+ (JCOEF) (MCU_data[blkn][0] - cinfo->last_dc_val[ci]),
+ dc_count_ptrs[compptr->dc_tbl_no],
+ ac_count_ptrs[compptr->ac_tbl_no]);
+ cinfo->last_dc_val[ci] = MCU_data[blkn][0];
+ }
+}
+
+
+
+/*
+ * Find the best coding parameters for a Huffman-coded scan.
+ * When called, the scan data has already been converted to a sequence of
+ * MCU groups of quantized coefficients, which are stored in a "big" array.
+ * The source_method knows how to iterate through that array.
+ * On return, the MCU data is unmodified, but the Huffman tables referenced
+ * by the scan components may have been altered.
+ */
+
+METHODDEF void
+huff_optimize (compress_info_ptr xinfo, MCU_output_caller_ptr source_method)
+/* Optimize Huffman-coding parameters (Huffman symbol table) */
+{
+ int i, tbl;
+ HUFF_TBL **htblptr;
+
+ /* Allocate and zero the count tables */
+ /* Note that gen_huff_coding expects 257 entries in each table! */
+
+ for (i = 0; i < NUM_HUFF_TBLS; i++) {
+ dc_count_ptrs[i] = NULL;
+ ac_count_ptrs[i] = NULL;
+ }
+
+ for (i = 0; i < cinfo->comps_in_scan; i++) {
+ /* Create DC table */
+ tbl = cinfo->cur_comp_info[i]->dc_tbl_no;
+ if (dc_count_ptrs[tbl] == NULL) {
+ dc_count_ptrs[tbl] = (long *) (*cinfo->emethods->alloc_small)
+ (257 * SIZEOF(long));
+ MEMZERO(dc_count_ptrs[tbl], 257 * SIZEOF(long));
+ }
+ /* Create AC table */
+ tbl = cinfo->cur_comp_info[i]->ac_tbl_no;
+ if (ac_count_ptrs[tbl] == NULL) {
+ ac_count_ptrs[tbl] = (long *) (*cinfo->emethods->alloc_small)
+ (257 * SIZEOF(long));
+ MEMZERO(ac_count_ptrs[tbl], 257 * SIZEOF(long));
+ }
+ }
+
+ /* Initialize DC predictions to 0 */
+ for (i = 0; i < cinfo->comps_in_scan; i++) {
+ cinfo->last_dc_val[i] = 0;
+ }
+ /* Initialize restart stuff */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+
+ /* Scan the MCU data, count symbol uses */
+ (*source_method) (cinfo, htest_encode);
+
+ /* Now generate optimal Huffman tables */
+ for (tbl = 0; tbl < NUM_HUFF_TBLS; tbl++) {
+ if (dc_count_ptrs[tbl] != NULL) {
+ htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL));
+ /* Set sent_table FALSE so updated table will be written to JPEG file. */
+ (*htblptr)->sent_table = FALSE;
+ /* Compute the optimal Huffman encoding */
+ gen_huff_coding(cinfo, *htblptr, dc_count_ptrs[tbl]);
+ /* Release the count table */
+ (*cinfo->emethods->free_small) ((pointer ) dc_count_ptrs[tbl]);
+ }
+ if (ac_count_ptrs[tbl] != NULL) {
+ htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL));
+ /* Set sent_table FALSE so updated table will be written to JPEG file. */
+ (*htblptr)->sent_table = FALSE;
+ /* Compute the optimal Huffman encoding */
+ gen_huff_coding(cinfo, *htblptr, ac_count_ptrs[tbl]);
+ /* Release the count table */
+ (*cinfo->emethods->free_small) ((pointer ) ac_count_ptrs[tbl]);
+ }
+ }
+}
+
+
+#endif /* ENTROPY_OPT_SUPPORTED */
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * The method selection routine for Huffman entropy encoding.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselchuffman (compress_info_ptr cinfo)
+#else
+jselchuffman (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselchuffman (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ if (! cinfo->arith_code) {
+ cinfo->methods->entropy_encode_init = huff_init;
+ cinfo->methods->entropy_encode = huff_encode;
+ cinfo->methods->entropy_encode_term = huff_term;
+#ifndef XIE_SUPPORTED
+#ifdef ENTROPY_OPT_SUPPORTED
+ cinfo->methods->entropy_optimize = huff_optimize;
+ /* The standard Huffman tables are only valid for 8-bit data precision.
+ * If the precision is higher, force optimization on so that usable
+ * tables will be computed. This test can be removed if default tables
+ * are supplied that are valid for the desired precision.
+ */
+ if (cinfo->data_precision > 8)
+ cinfo->optimize_coding = TRUE;
+ if (cinfo->optimize_coding)
+ cinfo->total_passes++; /* one pass needed for entropy optimization */
+#endif
+#endif /* XIE_SUPPORTED */
+ }
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcmcu.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcmcu.c
new file mode 100644
index 000000000..f69701860
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcmcu.c
@@ -0,0 +1,390 @@
+/* $TOG: jcmcu.c /main/5 1998/02/09 16:18:58 kaleb $ */
+/* Module jcmcu.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jcmcu.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains MCU extraction routines and quantization scaling.
+ * These routines are invoked via the extract_MCUs and
+ * extract_init/term methods.
+ */
+
+#include "jinclude.h"
+
+
+/*
+ * If this file is compiled with -DDCT_ERR_STATS, it will reverse-DCT each
+ * block and sum the total errors across the whole picture. This provides
+ * a convenient method of using real picture data to test the roundoff error
+ * of a DCT algorithm. DCT_ERR_STATS should *not* be defined for a production
+ * compression program, since compression is much slower with it defined.
+ * Also note that jrevdct.o must be linked into the compressor when this
+ * switch is defined.
+ */
+
+#ifndef XIE_SUPPORTED
+#ifdef DCT_ERR_STATS
+static int dcterrorsum; /* these hold the error statistics */
+static int dcterrormax;
+static int dctcoefcount; /* This will probably overflow on a 16-bit-int machine */
+#endif
+#endif /* XIE_SUPPORTED */
+
+
+/* ZAG[i] is the natural-order position of the i'th element of zigzag order. */
+
+static const short ZAG[DCTSIZE2] = {
+ 0, 1, 8, 16, 9, 2, 3, 10,
+ 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34,
+ 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36,
+ 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46,
+ 53, 60, 61, 54, 47, 55, 62, 63
+};
+
+
+LOCAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+extract_block (JSAMPARRAY input_data, int start_row, long start_col,
+ JBLOCK output_data, QUANT_TBL_PTR quanttbl)
+#else
+extract_block (input_data, start_row, start_col, output_data, quanttbl)
+ JSAMPARRAY input_data;
+ int start_row;
+ long start_col;
+ JBLOCK output_data;
+ QUANT_TBL_PTR quanttbl;
+#endif /* NeedFunctionPrototypes */
+#else
+extract_block (JSAMPARRAY input_data, int start_row, long start_col,
+ JBLOCK output_data, QUANT_TBL_PTR quanttbl)
+#endif /* XIE_SUPPORTED */
+/* Extract one 8x8 block from the specified location in the sample array; */
+/* perform forward DCT, quantization scaling, and zigzag reordering on it. */
+{
+ /* This routine is heavily used, so it's worth coding it tightly. */
+ DCTBLOCK block;
+#ifdef DCT_ERR_STATS
+ DCTBLOCK svblock; /* saves input data for comparison */
+#endif
+
+ { register JSAMPROW elemptr;
+ register DCTELEM *localblkptr = block;
+#if DCTSIZE != 8
+ register int elemc;
+#endif
+ register int elemr;
+
+ for (elemr = DCTSIZE; elemr > 0; elemr--) {
+ elemptr = input_data[start_row++] + start_col;
+#if DCTSIZE == 8 /* unroll the inner loop */
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+#else
+ for (elemc = DCTSIZE; elemc > 0; elemc--) {
+ *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
+ }
+#endif
+ }
+ }
+
+#ifdef DCT_ERR_STATS
+ MEMCOPY(svblock, block, SIZEOF(DCTBLOCK));
+#endif
+
+ j_fwd_dct(block);
+
+ { register JCOEF temp;
+ register short i;
+
+ for (i = 0; i < DCTSIZE2; i++) {
+ temp = (JCOEF) block[ZAG[i]];
+ /* divide by *quanttbl, ensuring proper rounding */
+ if (temp < 0) {
+ temp = -temp;
+ temp += *quanttbl>>1;
+ temp /= *quanttbl;
+ temp = -temp;
+ } else {
+ temp += *quanttbl>>1;
+ temp /= *quanttbl;
+ }
+ *output_data++ = temp;
+ quanttbl++;
+ }
+ }
+
+#ifdef DCT_ERR_STATS
+ j_rev_dct(block);
+
+ { register int diff;
+ register short i;
+
+ for (i = 0; i < DCTSIZE2; i++) {
+ diff = block[i] - svblock[i];
+ if (diff < 0) diff = -diff;
+ dcterrorsum += diff;
+ if (dcterrormax < diff) dcterrormax = diff;
+ }
+ dctcoefcount += DCTSIZE2;
+ }
+#endif
+}
+
+
+/*
+ * Extract samples in MCU order, process & hand off to output_method.
+ * The input is always exactly N MCU rows worth of data.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+extract_MCUs (compress_info_ptr cinfo,
+ JSAMPIMAGE image_data,
+ int num_mcu_rows,
+ MCU_output_method_ptr output_method)
+#else
+extract_MCUs (cinfo, image_data, num_mcu_rows, output_method)
+ compress_info_ptr cinfo;
+ JSAMPIMAGE image_data;
+ int num_mcu_rows;
+ MCU_output_method_ptr output_method;
+#endif /* NeedFunctionPrototypes */
+{
+ JBLOCK MCU_data[MAX_BLOCKS_IN_MCU];
+ int mcurow;
+ long mcuindex;
+ int startrow;
+ long startindex;
+ short blkn, ci, xpos, ypos;
+ jpeg_component_info * compptr;
+ QUANT_TBL_PTR quant_ptr;
+
+ if (cinfo->XIErestart == XIE_RMCU) {
+ startrow = cinfo->XIEmcurow;
+ startindex = cinfo->XIEmcuindex;
+ cinfo->XIErestart = XIE_RNUL;
+ } else {
+ startrow = 0;
+ startindex = 0;
+ }
+ for (mcurow = startrow; mcurow < num_mcu_rows; mcurow++) {
+ for (mcuindex = startindex; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Extract data from the image array, DCT it, and quantize it */
+ blkn = 0;
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ for (xpos = 0; xpos < compptr->MCU_width; xpos++) {
+ extract_block(image_data[ci],
+ (mcurow * compptr->MCU_height + ypos)*DCTSIZE,
+ (mcuindex * compptr->MCU_width + xpos)*DCTSIZE,
+ MCU_data[blkn], quant_ptr);
+ blkn++;
+ }
+ }
+ }
+ /* Send the MCU whereever the pipeline controller wants it to go */
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ if ((*output_method) (cinfo, MCU_data) < 0) {
+ cinfo->XIErestart = XIE_RMCU;
+ cinfo->XIEmcurow = mcurow;
+ cinfo->XIEmcuindex = mcuindex;
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ return(-1);
+ }
+ }
+ }
+ return(0);
+}
+#else
+METHODDEF void
+extract_MCUs (compress_info_ptr cinfo,
+ JSAMPIMAGE image_data,
+ int num_mcu_rows,
+ MCU_output_method_ptr output_method)
+{
+ JBLOCK MCU_data[MAX_BLOCKS_IN_MCU];
+ int mcurow;
+ long mcuindex;
+ short blkn, ci, xpos, ypos;
+ jpeg_component_info * compptr;
+ QUANT_TBL_PTR quant_ptr;
+
+ for (mcurow = 0; mcurow < num_mcu_rows; mcurow++) {
+ for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Extract data from the image array, DCT it, and quantize it */
+ blkn = 0;
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ for (xpos = 0; xpos < compptr->MCU_width; xpos++) {
+ extract_block(image_data[ci],
+ (mcurow * compptr->MCU_height + ypos)*DCTSIZE,
+ (mcuindex * compptr->MCU_width + xpos)*DCTSIZE,
+ MCU_data[blkn], quant_ptr);
+ blkn++;
+ }
+ }
+ }
+ /* Send the MCU whereever the pipeline controller wants it to go */
+ (*output_method) (cinfo, MCU_data);
+ }
+ }
+}
+#endif
+
+
+/*
+ * Initialize for processing a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+extract_init (compress_info_ptr cinfo)
+#else
+extract_init (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+extract_init (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+#ifdef DCT_ERR_STATS
+ dcterrorsum = dcterrormax = dctcoefcount = 0;
+#endif
+}
+
+
+/*
+ * Clean up after a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+extract_term (compress_info_ptr cinfo)
+#else
+extract_term (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+extract_term (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+#ifndef XIE_SUPPORTED
+#ifdef DCT_ERR_STATS
+ TRACEMS3(cinfo->emethods, 0, "DCT roundoff errors = %d/%d, max = %d",
+ dcterrorsum, dctcoefcount, dcterrormax);
+#endif
+#endif /* XIE_SUPPORTED */
+}
+
+
+
+/*
+ * The method selection routine for MCU extraction.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselcmcu (compress_info_ptr cinfo)
+#else
+jselcmcu (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselcmcu (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* just one implementation for now */
+ cinfo->methods->extract_init = extract_init;
+ cinfo->methods->extract_MCUs = extract_MCUs;
+ cinfo->methods->extract_term = extract_term;
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jconfig.h b/xc/programs/Xserver/XIE/mixie/jpeg/jconfig.h
new file mode 100644
index 000000000..c4378534e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jconfig.h
@@ -0,0 +1,476 @@
+/* $TOG: jconfig.h /main/5 1998/02/09 16:19:03 kaleb $ */
+/* Module jconfig.h */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., Ocober 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jconfig.h,v 1.3 1998/10/04 09:36:20 dawes Exp $ */
+
+/*
+ * jconfig.h
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains preprocessor declarations that help customize
+ * the JPEG software for a particular application, machine, or compiler.
+ * Edit these declarations as needed (or add -D flags to the Makefile).
+ */
+
+
+/*
+ * These symbols indicate the properties of your machine or compiler.
+ * The conditional definitions given may do the right thing already,
+ * but you'd best look them over closely, especially if your compiler
+ * does not handle full ANSI C. An ANSI-compliant C compiler should
+ * provide all the necessary features; __STDC__ is supposed to be
+ * predefined by such compilers.
+ */
+
+/*
+ * HAVE_STDC is tested below to see whether ANSI features are available.
+ * We avoid testing __STDC__ directly for arcane reasons of portability.
+ * (On some compilers, __STDC__ is only defined if a switch is given,
+ * but the switch also disables machine-specific features we need to get at.
+ * In that case, -DHAVE_STDC in the Makefile is a convenient solution.)
+ */
+
+#ifdef __STDC__ /* if compiler claims to be ANSI, believe it */
+#define HAVE_STDC
+#endif
+
+
+/* Does your compiler support function prototypes? */
+/* (If not, you also need to use ansi2knr, see SETUP) */
+
+#ifdef HAVE_STDC /* ANSI C compilers always have prototypes */
+#define PROTO
+#else
+#ifdef __cplusplus /* So do C++ compilers */
+#define PROTO
+#endif
+#endif
+
+/* Does your compiler support the declaration "unsigned char" ? */
+/* How about "unsigned short" ? */
+
+#ifdef HAVE_STDC /* ANSI C compilers must support both */
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
+#endif
+
+/* Define this if an ordinary "char" type is unsigned.
+ * If you're not sure, leaving it undefined will work at some cost in speed.
+ * If you defined HAVE_UNSIGNED_CHAR then it doesn't matter very much.
+ */
+
+/* #define CHAR_IS_UNSIGNED */
+
+/* Define this if your compiler implements ">>" on signed values as a logical
+ * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
+ * which is the normal and rational definition.
+ */
+
+/* #define RIGHT_SHIFT_IS_UNSIGNED */
+
+/* Define "void" as "char" if your compiler doesn't know about type void.
+ * NOTE: be sure to define void such that "void *" represents the most general
+ * pointer type, e.g., that returned by malloc().
+ */
+
+/* #define void char */
+
+/* Define const as empty if your compiler doesn't know the "const" keyword. */
+/* (Even if it does, defining const as empty won't break anything.) */
+
+#ifndef HAVE_STDC /* ANSI C and C++ compilers should know it. */
+#ifndef __cplusplus
+#define const
+#endif
+#endif
+
+/* For 80x86 machines, you need to define NEED_FAR_POINTERS,
+ * unless you are using a large-data memory model or 80386 flat-memory mode.
+ * On less brain-damaged CPUs this symbol must not be defined.
+ * (Defining this symbol causes large data structures to be referenced through
+ * "far" pointers and to be allocated with a special version of malloc.)
+ */
+
+#ifdef XIE_SUPPORTED
+#ifdef MSDOS
+#undef MSDOS
+#endif /* MSDOS */
+
+/* Make sure that HAVE_UNSIGNED_CHAR and HAVE_UNSIGNED_SHORT
+ * are defined when XIE_SUPPORTED is defined
+ */
+#ifndef HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_CHAR
+#endif /* HAVE_UNSIGNED_CHAR */
+#ifndef HAVE_UNSIGNED_SHORT
+#define HAVE_UNSIGNED_SHORT
+#endif /* HAVE_UNSIGNED_SHORT */
+#endif /* XIE_SUPPORTED */
+
+#ifdef MSDOS
+#define NEED_FAR_POINTERS
+#endif
+
+
+/* The next three symbols only affect the system-dependent user interface
+ * modules (jcmain.c, jdmain.c). You can ignore these if you are supplying
+ * your own user interface code.
+ */
+
+/* Define this if you want to name both input and output files on the command
+ * line, rather than using stdout and optionally stdin. You MUST do this if
+ * your system can't cope with binary I/O to stdin/stdout. See comments at
+ * head of jcmain.c or jdmain.c.
+ */
+
+#ifdef MSDOS /* two-file style is needed for PCs */
+#ifndef USE_SETMODE /* unless you have setmode() */
+#define TWO_FILE_COMMANDLINE
+#endif
+#endif
+#ifdef THINK_C /* it's needed for Macintosh too */
+#define TWO_FILE_COMMANDLINE
+#endif
+
+/* Define this if your system needs explicit cleanup of temporary files.
+ * This is crucial under MS-DOS, where the temporary "files" may be areas
+ * of extended memory; on most other systems it's not as important.
+ */
+
+#ifdef MSDOS
+#define NEED_SIGNAL_CATCHER
+#endif
+
+/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb").
+ * This is necessary on systems that distinguish text files from binary files,
+ * and is harmless on most systems that don't. If you have one of the rare
+ * systems that complains about the "b" spec, define this symbol.
+ */
+
+/* #define DONT_USE_B_MODE */
+
+
+/* If you're getting bored, that's the end of the symbols you HAVE to
+ * worry about. Go fix the makefile and compile.
+ */
+
+
+/* If your compiler supports inline functions, define INLINE
+ * as the inline keyword; otherwise define it as empty.
+ */
+
+#ifdef __GNUC__ /* for instance, GNU C knows about inline */
+#define INLINE __inline__
+#endif
+#ifndef INLINE /* default is to define it as empty */
+#define INLINE
+#endif
+
+/* On a few systems, type boolean and/or macros FALSE, TRUE may appear
+ * in standard header files. Or you may have conflicts with application-
+ * specific header files that you want to include together with these files.
+ * In that case you need only comment out these definitions.
+ */
+
+typedef int boolean;
+#undef FALSE /* in case these macros already exist */
+#undef TRUE
+#define FALSE 0 /* values of boolean */
+#define TRUE 1
+
+/* This defines the size of the I/O buffers for entropy compression
+ * and decompression; you could reduce it if memory is tight.
+ */
+
+#define JPEG_BUF_SIZE 4096 /* bytes */
+
+
+
+/* These symbols determine the JPEG functionality supported. */
+
+/*
+ * These defines indicate whether to include various optional functions.
+ * Undefining some of these symbols will produce a smaller but less capable
+ * program file. Note that you can leave certain source files out of the
+ * compilation/linking process if you've #undef'd the corresponding symbols.
+ * (You may HAVE to do that if your compiler doesn't like null source files.)
+ */
+
+#ifdef XIE_SUPPORTED
+/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
+
+/* Encoder capability options: */
+#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#undef C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? (NYI) */
+#undef ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
+#undef INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
+/* Decoder capability options: */
+#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#undef D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#undef BLOCK_SMOOTHING_SUPPORTED /* Block smoothing during decoding? */
+#undef QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
+#undef QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
+/* these defines indicate which JPEG file formats are allowed */
+#define JFIF_SUPPORTED /* JFIF or "raw JPEG" files */
+#undef JTIFF_SUPPORTED /* JPEG-in-TIFF (not yet implemented) */
+/* these defines indicate which image (non-JPEG) file formats are allowed */
+#undef GIF_SUPPORTED /* GIF image file format */
+/* #define RLE_SUPPORTED */ /* RLE image file format (by default, no) */
+#undef PPM_SUPPORTED /* PPM/PGM image file format */
+#undef TARGA_SUPPORTED /* Targa image file format */
+#undef TIFF_SUPPORTED /* TIFF image file format (not yet impl.) */
+
+/* more capability options later, no doubt */
+#else
+/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
+
+/* Encoder capability options: */
+#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#undef C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? (NYI) */
+#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
+#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
+/* Decoder capability options: */
+#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
+#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing during decoding? */
+#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
+#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
+/* these defines indicate which JPEG file formats are allowed */
+#define JFIF_SUPPORTED /* JFIF or "raw JPEG" files */
+#undef JTIFF_SUPPORTED /* JPEG-in-TIFF (not yet implemented) */
+/* these defines indicate which image (non-JPEG) file formats are allowed */
+#define GIF_SUPPORTED /* GIF image file format */
+/* #define RLE_SUPPORTED */ /* RLE image file format (by default, no) */
+#define PPM_SUPPORTED /* PPM/PGM image file format */
+#define TARGA_SUPPORTED /* Targa image file format */
+#undef TIFF_SUPPORTED /* TIFF image file format (not yet impl.) */
+
+/* more capability options later, no doubt */
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Define exactly one of these three symbols to indicate whether you want
+ * 8-bit, 12-bit, or 16-bit sample (pixel component) values. 8-bit is the
+ * default and is nearly always the right thing to use. You can use 12-bit if
+ * you need to support image formats with more than 8 bits of resolution in a
+ * color value. 16-bit should only be used for the lossless JPEG mode (not
+ * currently supported). Note that 12- and 16-bit values take up twice as
+ * much memory as 8-bit!
+ * Note: if you select 12- or 16-bit precision, it is dangerous to turn off
+ * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
+ * precision, so jchuff.c normally uses entropy optimization to compute
+ * usable tables for higher precision. If you don't want to do optimization,
+ * you'll have to supply different default Huffman tables.
+ */
+
+#define EIGHT_BIT_SAMPLES
+#undef TWELVE_BIT_SAMPLES
+#undef SIXTEEN_BIT_SAMPLES
+
+
+
+/*
+ * The remaining definitions don't need to be hand-edited in most cases.
+ * You may need to change these if you have a machine with unusual data
+ * types; for example, "char" not 8 bits, "short" not 16 bits,
+ * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
+ * but it had better be at least 16.
+ */
+
+/* First define the representation of a single pixel element value. */
+
+#ifdef EIGHT_BIT_SAMPLES
+/* JSAMPLE should be the smallest type that will hold the values 0..255.
+ * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
+ * If you have only signed chars, and you are more worried about speed than
+ * memory usage, it might be a win to make JSAMPLE be short.
+ */
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char JSAMPLE;
+#define GETJSAMPLE(value) (value)
+
+#else /* not HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+
+typedef char JSAMPLE;
+#define GETJSAMPLE(value) (value)
+
+#else /* not CHAR_IS_UNSIGNED */
+
+typedef char JSAMPLE;
+#define GETJSAMPLE(value) ((value) & 0xFF)
+
+#endif /* CHAR_IS_UNSIGNED */
+#endif /* HAVE_UNSIGNED_CHAR */
+
+#define BITS_IN_JSAMPLE 8
+#define MAXJSAMPLE 255
+#define CENTERJSAMPLE 128
+
+#endif /* EIGHT_BIT_SAMPLES */
+
+
+#ifdef TWELVE_BIT_SAMPLES
+/* JSAMPLE should be the smallest type that will hold the values 0..4095. */
+/* On nearly all machines "short" will do nicely. */
+
+typedef short JSAMPLE;
+#define GETJSAMPLE(value) (value)
+
+#define BITS_IN_JSAMPLE 12
+#define MAXJSAMPLE 4095
+#define CENTERJSAMPLE 2048
+
+#endif /* TWELVE_BIT_SAMPLES */
+
+
+#ifdef SIXTEEN_BIT_SAMPLES
+/* JSAMPLE should be the smallest type that will hold the values 0..65535. */
+
+#ifdef HAVE_UNSIGNED_SHORT
+
+typedef unsigned short JSAMPLE;
+#define GETJSAMPLE(value) (value)
+
+#else /* not HAVE_UNSIGNED_SHORT */
+
+/* If int is 32 bits this'll be horrendously inefficient storage-wise.
+ * But since we don't actually support 16-bit samples (ie lossless coding) yet,
+ * I'm not going to worry about making a smarter definition ...
+ */
+typedef unsigned int JSAMPLE;
+#define GETJSAMPLE(value) (value)
+
+#endif /* HAVE_UNSIGNED_SHORT */
+
+#define BITS_IN_JSAMPLE 16
+#define MAXJSAMPLE 65535
+#define CENTERJSAMPLE 32768
+
+#endif /* SIXTEEN_BIT_SAMPLES */
+
+
+/* Here we define the representation of a DCT frequency coefficient.
+ * This should be a signed 16-bit value; "short" is usually right.
+ * It's important that this be exactly 16 bits, no more and no less;
+ * more will cost you a BIG hit of memory, less will give wrong answers.
+ */
+
+typedef short JCOEF;
+
+
+/* The remaining typedefs are used for various table entries and so forth.
+ * They must be at least as wide as specified; but making them too big
+ * won't cost a huge amount of memory, so we don't provide special
+ * extraction code like we did for JSAMPLE. (In other words, these
+ * typedefs live at a different point on the speed/space tradeoff curve.)
+ */
+
+/* UINT8 must hold at least the values 0..255. */
+
+#ifdef HAVE_UNSIGNED_CHAR
+typedef unsigned char UINT8;
+#else /* not HAVE_UNSIGNED_CHAR */
+#ifdef CHAR_IS_UNSIGNED
+typedef char UINT8;
+#else /* not CHAR_IS_UNSIGNED */
+typedef short UINT8;
+#endif /* CHAR_IS_UNSIGNED */
+#endif /* HAVE_UNSIGNED_CHAR */
+
+/* UINT16 must hold at least the values 0..65535. */
+
+#ifdef HAVE_UNSIGNED_SHORT
+typedef unsigned short UINT16;
+#else /* not HAVE_UNSIGNED_SHORT */
+typedef unsigned int UINT16;
+#endif /* HAVE_UNSIGNED_SHORT */
+
+/* INT16 must hold at least the values -32768..32767. */
+
+#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
+typedef short INT16;
+#endif
+
+/* INT32 must hold signed 32-bit values; if your machine happens */
+/* to have 64-bit longs, you might want to change this. */
+
+#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
+#if defined(__alpha) || defined(__alpha__)
+typedef int INT32;
+#else
+typedef long INT32;
+#endif
+#endif
+
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcsample.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcsample.c
new file mode 100644
index 000000000..acc7d123d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcsample.c
@@ -0,0 +1,732 @@
+/* $TOG: jcsample.c /main/5 1998/02/09 16:19:08 kaleb $ */
+/* Module jcsample.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jcsample.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains downsampling routines.
+ * These routines are invoked via the downsample and
+ * downsample_init/term methods.
+ *
+ * An excellent reference for image resampling is
+ * Digital Image Warping, George Wolberg, 1990.
+ * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
+ *
+ * The downsampling algorithm used here is a simple average of the source
+ * pixels covered by the output pixel. The hi-falutin sampling literature
+ * refers to this as a "box filter". In general the characteristics of a box
+ * filter are not very good, but for the specific cases we normally use (1:1
+ * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
+ * nearly so bad. If you intend to use other sampling ratios, you'd be well
+ * advised to improve this code.
+ *
+ * A simple input-smoothing capability is provided. This is mainly intended
+ * for cleaning up color-dithered GIF input files (if you find it inadequate,
+ * we suggest using an external filtering program such as pnmconvol). When
+ * enabled, each input pixel P is replaced by a weighted sum of itself and its
+ * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF,
+ * where SF = (smoothing_factor / 1024).
+ * Currently, smoothing is only supported for 2h2v sampling factors.
+ */
+
+#include "jinclude.h"
+
+
+/*
+ * Initialize for downsampling a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+downsample_init (compress_info_ptr cinfo)
+#else
+downsample_init (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+downsample_init (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles arbitrary integral sampling ratios, without smoothing.
+ * Note that this version is not actually used for customary sampling ratios.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+int_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+int_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+int_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
+ long outcol, outcol_h; /* outcol_h == outcol*h_expand */
+ JSAMPROW inptr, outptr;
+ INT32 outvalue;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ if (output_rows != compptr->v_samp_factor ||
+ input_rows != cinfo->max_v_samp_factor ||
+ (output_cols % compptr->h_samp_factor) != 0 ||
+ (input_cols % cinfo->max_h_samp_factor) != 0 ||
+ input_cols*compptr->h_samp_factor != output_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus downsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
+ v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
+ numpix = h_expand * v_expand;
+ numpix2 = numpix/2;
+
+ inrow = 0;
+ for (outrow = 0; outrow < output_rows; outrow++) {
+ outptr = output_data[outrow];
+ for (outcol = 0, outcol_h = 0; outcol < output_cols;
+ outcol++, outcol_h += h_expand) {
+ outvalue = 0;
+ for (v = 0; v < v_expand; v++) {
+ inptr = input_data[inrow+v] + outcol_h;
+ for (h = 0; h < h_expand; h++) {
+ outvalue += (INT32) GETJSAMPLE(*inptr++);
+ }
+ }
+ *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
+ }
+ inrow += v_expand;
+ }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the common case of 2:1 horizontal and 1:1 vertical,
+ * without smoothing.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+h2v1_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+h2v1_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+h2v1_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ int outrow;
+ long outcol;
+ register JSAMPROW inptr, outptr;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ if (output_rows != compptr->v_samp_factor ||
+ input_rows != cinfo->max_v_samp_factor ||
+ (output_cols % compptr->h_samp_factor) != 0 ||
+ (input_cols % cinfo->max_h_samp_factor) != 0 ||
+ input_cols*compptr->h_samp_factor != output_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus downsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ for (outrow = 0; outrow < output_rows; outrow++) {
+ outptr = output_data[outrow];
+ inptr = input_data[outrow];
+ for (outcol = 0; outcol < output_cols; outcol++) {
+ *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
+ + 1) >> 1);
+ inptr += 2;
+ }
+ }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
+ * without smoothing.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+h2v2_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+h2v2_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+h2v2_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ int inrow, outrow;
+ long outcol;
+ register JSAMPROW inptr0, inptr1, outptr;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ if (output_rows != compptr->v_samp_factor ||
+ input_rows != cinfo->max_v_samp_factor ||
+ (output_cols % compptr->h_samp_factor) != 0 ||
+ (input_cols % cinfo->max_h_samp_factor) != 0 ||
+ input_cols*compptr->h_samp_factor != output_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus downsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ inrow = 0;
+ for (outrow = 0; outrow < output_rows; outrow++) {
+ outptr = output_data[outrow];
+ inptr0 = input_data[inrow];
+ inptr1 = input_data[inrow+1];
+ for (outcol = 0; outcol < output_cols; outcol++) {
+ *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
+ + 2) >> 2);
+ inptr0 += 2; inptr1 += 2;
+ }
+ inrow += 2;
+ }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the special case of a full-size component,
+ * without smoothing.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fullsize_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+fullsize_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+fullsize_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ if (input_cols != output_cols || input_rows != output_rows)
+ ERREXIT(cinfo->emethods, "Pipeline controller messed up");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols);
+}
+
+
+#ifdef INPUT_SMOOTHING_SUPPORTED
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
+ * with smoothing.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+h2v2_smooth_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+h2v2_smooth_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+h2v2_smooth_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ int inrow, outrow;
+ long colctr;
+ register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
+ INT32 membersum, neighsum, memberscale, neighscale;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ if (output_rows != compptr->v_samp_factor ||
+ input_rows != cinfo->max_v_samp_factor ||
+ (output_cols % compptr->h_samp_factor) != 0 ||
+ (input_cols % cinfo->max_h_samp_factor) != 0 ||
+ input_cols*compptr->h_samp_factor != output_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus downsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ /* We don't bother to form the individual "smoothed" input pixel values;
+ * we can directly compute the output which is the average of the four
+ * smoothed values. Each of the four member pixels contributes a fraction
+ * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
+ * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
+ * output. The four corner-adjacent neighbor pixels contribute a fraction
+ * SF to just one smoothed pixel, or SF/4 to the final output; while the
+ * eight edge-adjacent neighbors contribute SF to each of two smoothed
+ * pixels, or SF/2 overall. In order to use integer arithmetic, these
+ * factors are scaled by 2^16 = 65536.
+ * Also recall that SF = smoothing_factor / 1024.
+ */
+
+ memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
+ neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
+
+ inrow = 0;
+ for (outrow = 0; outrow < output_rows; outrow++) {
+ outptr = output_data[outrow];
+ inptr0 = input_data[inrow];
+ inptr1 = input_data[inrow+1];
+ if (inrow == 0)
+ above_ptr = above[input_rows-1];
+ else
+ above_ptr = input_data[inrow-1];
+ if (inrow >= input_rows-2)
+ below_ptr = below[0];
+ else
+ below_ptr = input_data[inrow+2];
+
+ /* Special case for first column: pretend column -1 is same as column 0 */
+ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+ neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+ GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+ GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
+ neighsum += neighsum;
+ neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
+ GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
+ membersum = membersum * memberscale + neighsum * neighscale;
+ *outptr++ = (JSAMPLE) ((membersum + 32768L) >> 16);
+ inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+
+ for (colctr = output_cols - 2; colctr > 0; colctr--) {
+ /* sum of pixels directly mapped to this output element */
+ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+ /* sum of edge-neighbor pixels */
+ neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+ GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+ GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
+ GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
+ /* The edge-neighbors count twice as much as corner-neighbors */
+ neighsum += neighsum;
+ /* Add in the corner-neighbors */
+ neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
+ GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
+ /* form final output scaled up by 2^16 */
+ membersum = membersum * memberscale + neighsum * neighscale;
+ /* round, descale and output it */
+ *outptr++ = (JSAMPLE) ((membersum + 32768L) >> 16);
+ inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
+ }
+
+ /* Special case for last column */
+ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
+ neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
+ GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
+ GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
+ GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
+ neighsum += neighsum;
+ neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
+ GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
+ membersum = membersum * memberscale + neighsum * neighscale;
+ *outptr = (JSAMPLE) ((membersum + 32768L) >> 16);
+
+ inrow += 2;
+ }
+}
+
+
+/*
+ * Downsample pixel values of a single component.
+ * This version handles the special case of a full-size component,
+ * with smoothing.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fullsize_smooth_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+fullsize_smooth_downsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ compress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+fullsize_smooth_downsample (compress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ int outrow;
+ long colctr;
+ register JSAMPROW inptr, above_ptr, below_ptr, outptr;
+ INT32 membersum, neighsum, memberscale, neighscale;
+ int colsum, lastcolsum, nextcolsum;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ if (input_cols != output_cols || input_rows != output_rows)
+ ERREXIT(cinfo->emethods, "Pipeline controller messed up");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ /* Each of the eight neighbor pixels contributes a fraction SF to the
+ * smoothed pixel, while the main pixel contributes (1-8*SF). In order
+ * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
+ * Also recall that SF = smoothing_factor / 1024.
+ */
+
+ memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
+ neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
+
+ for (outrow = 0; outrow < output_rows; outrow++) {
+ outptr = output_data[outrow];
+ inptr = input_data[outrow];
+ if (outrow == 0)
+ above_ptr = above[input_rows-1];
+ else
+ above_ptr = input_data[outrow-1];
+ if (outrow >= input_rows-1)
+ below_ptr = below[0];
+ else
+ below_ptr = input_data[outrow+1];
+
+ /* Special case for first column */
+ colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
+ GETJSAMPLE(*inptr);
+ membersum = GETJSAMPLE(*inptr++);
+ nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
+ GETJSAMPLE(*inptr);
+ neighsum = colsum + (colsum - membersum) + nextcolsum;
+ membersum = membersum * memberscale + neighsum * neighscale;
+ *outptr++ = (JSAMPLE) ((membersum + 32768L) >> 16);
+ lastcolsum = colsum; colsum = nextcolsum;
+
+ for (colctr = output_cols - 2; colctr > 0; colctr--) {
+ membersum = GETJSAMPLE(*inptr++);
+ above_ptr++; below_ptr++;
+ nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
+ GETJSAMPLE(*inptr);
+ neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
+ membersum = membersum * memberscale + neighsum * neighscale;
+ *outptr++ = (JSAMPLE) ((membersum + 32768L) >> 16);
+ lastcolsum = colsum; colsum = nextcolsum;
+ }
+
+ /* Special case for last column */
+ membersum = GETJSAMPLE(*inptr);
+ neighsum = lastcolsum + (colsum - membersum) + colsum;
+ membersum = membersum * memberscale + neighsum * neighscale;
+ *outptr = (JSAMPLE) ((membersum + 32768L) >> 16);
+
+ }
+}
+
+#endif /* INPUT_SMOOTHING_SUPPORTED */
+
+
+/*
+ * Clean up after a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+downsample_term (compress_info_ptr cinfo)
+#else
+downsample_term (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+downsample_term (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+
+
+
+/*
+ * The method selection routine for downsampling.
+ * Note that we must select a routine for each component.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jseldownsample (compress_info_ptr cinfo)
+#else
+jseldownsample (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jseldownsample (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ short ci;
+ jpeg_component_info * compptr;
+ boolean smoothok = TRUE;
+
+#ifndef XIE_SUPPORTED
+ if (cinfo->CCIR601_sampling)
+ ERREXIT(cinfo->emethods, "CCIR601 downsampling not implemented yet");
+#endif /* XIE_SUPPORTED */
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor == cinfo->max_v_samp_factor) {
+#ifdef INPUT_SMOOTHING_SUPPORTED
+ if (cinfo->smoothing_factor)
+ cinfo->methods->downsample[ci] = fullsize_smooth_downsample;
+ else
+#endif
+ cinfo->methods->downsample[ci] = fullsize_downsample;
+ } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor == cinfo->max_v_samp_factor) {
+ smoothok = FALSE;
+ cinfo->methods->downsample[ci] = h2v1_downsample;
+ } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
+#ifdef INPUT_SMOOTHING_SUPPORTED
+ if (cinfo->smoothing_factor)
+ cinfo->methods->downsample[ci] = h2v2_smooth_downsample;
+ else
+#endif
+ cinfo->methods->downsample[ci] = h2v2_downsample;
+ } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
+ (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
+ smoothok = FALSE;
+ cinfo->methods->downsample[ci] = int_downsample;
+ } else
+#ifdef XIE_SUPPORTED
+ {}
+#else
+ ERREXIT(cinfo->emethods, "Fractional downsampling not implemented yet");
+#endif /* XIE_SUPPORTED */
+ }
+
+#ifndef XIE_SUPPORTED
+#ifdef INPUT_SMOOTHING_SUPPORTED
+ if (cinfo->smoothing_factor && !smoothok)
+ TRACEMS(cinfo->emethods, 0,
+ "Smoothing not supported with nonstandard sampling ratios");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ cinfo->methods->downsample_init = downsample_init;
+ cinfo->methods->downsample_term = downsample_term;
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcxie.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcxie.c
new file mode 100644
index 000000000..90284c173
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcxie.c
@@ -0,0 +1,685 @@
+/* $TOG: jcxie.c /main/5 1998/02/09 16:19:18 kaleb $ */
+/* Module jcxie.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ jcxie.c: Xie JPEG Compression Interface Routines
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * Copyright (C) 1992, Thomas G. Lane.
+ * This file was derived in part from the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
+ * and coefficient-block arrays. This won't work on 80x86 because the arrays
+ * are FAR and we're assuming a small-pointer memory model. However, some
+ * DOS compilers provide far-pointer versions of memcpy() and memset() even
+ * in the small-model libraries. These will be used if USE_FMEM is defined.
+ * Otherwise, the routines below do it the hard way. (The performance cost
+ * is not all that great, because these routines aren't very heavily used.)
+ */
+
+#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
+#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
+#define FMEMZERO(target,size) MEMZERO(target,size)
+#else /* 80x86 case, define if we can */
+#ifdef USE_FMEM
+#define FMEMCOPY(dest,src,size) _fmemcpy((pointer*)(dest), (const pointer*)(src), (size_t)(size))
+#define FMEMZERO(target,size) _fmemset((pointer*)(target), 0, (size_t)(size))
+#endif
+#endif
+
+/*
+ * This routine gets control after the input file header has been read.
+ * It must determine what output JPEG file format is to be written,
+ * and make any other compression parameter changes that are desirable.
+ */
+
+METHODDEF void
+#if NeedFunctionPrototypes
+c_ui_method_selection (compress_info_ptr cinfo)
+#else
+c_ui_method_selection (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* If the input is gray scale, generate a monochrome JPEG file. */
+ if (cinfo->in_color_space == CS_GRAYSCALE)
+ j_monochrome_default(cinfo);
+ /* For now, always select JFIF output format. */
+ jselwjfif(cinfo);
+}
+
+METHODDEF void
+#if NeedFunctionPrototypes
+c_per_scan_method_selection (compress_info_ptr cinfo)
+#else
+c_per_scan_method_selection (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Central point for per-scan method selection */
+{
+ /* Edge expansion */
+ jselexpand(cinfo);
+ /* Downsampling of pixels */
+ jseldownsample(cinfo);
+ /* MCU extraction */
+ jselcmcu(cinfo);
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+c_initial_method_selection (compress_info_ptr cinfo)
+#else
+c_initial_method_selection (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Central point for initial method selection */
+{
+ /* Input image reading method selection is already done. */
+ /* So is output file header formatting (both are done by user interface). */
+
+ /* Entropy encoding: Huffman coding. */
+ cinfo->arith_code = FALSE; /* force Huffman mode */
+ jselchuffman(cinfo);
+
+ /* Overall control (that's me!) */
+ cinfo->methods->c_per_scan_method_selection = c_per_scan_method_selection;
+}
+
+LOCAL int
+#if NeedFunctionPrototypes
+initial_setup (compress_info_ptr cinfo)
+#else
+initial_setup (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Do computations that are needed before initial method selection */
+{
+ short ci;
+ jpeg_component_info *compptr;
+
+ /* Compute maximum sampling factors; check factor validity */
+ cinfo->max_h_samp_factor = 1;
+ cinfo->max_v_samp_factor = 1;
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = &cinfo->comp_info[ci];
+ if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
+ compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+ /* ERREXIT(cinfo->emethods, "Bogus sampling factors"); */
+ return(XIE_ERR);
+ cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
+ compptr->h_samp_factor);
+ cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
+ compptr->v_samp_factor);
+ }
+
+ /* Compute logical downsampled dimensions of components */
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = &cinfo->comp_info[ci];
+ compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor
+ + cinfo->max_h_samp_factor - 1)
+ / cinfo->max_h_samp_factor;
+ compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor
+ + cinfo->max_v_samp_factor - 1)
+ / cinfo->max_v_samp_factor;
+ }
+ return(0);
+}
+
+/*
+ * Utility routines: common code for pipeline controllers
+ */
+
+LOCAL int
+#if NeedFunctionPrototypes
+interleaved_scan_setup (compress_info_ptr cinfo)
+#else
+interleaved_scan_setup (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Compute all derived info for an interleaved (multi-component) scan */
+/* On entry, cinfo->comps_in_scan and cinfo->cur_comp_info[] are set up */
+{
+ short ci, mcublks;
+ jpeg_component_info *compptr;
+
+ if (cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
+ /* ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); */
+ return(XIE_ERR);
+
+ cinfo->MCUs_per_row = (cinfo->image_width
+ + cinfo->max_h_samp_factor*DCTSIZE - 1)
+ / (cinfo->max_h_samp_factor*DCTSIZE);
+
+ cinfo->MCU_rows_in_scan = (cinfo->image_height
+ + cinfo->max_v_samp_factor*DCTSIZE - 1)
+ / (cinfo->max_v_samp_factor*DCTSIZE);
+
+ cinfo->blocks_in_MCU = 0;
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ /* for interleaved scan, sampling factors give # of blocks per component */
+ compptr->MCU_width = compptr->h_samp_factor;
+ compptr->MCU_height = compptr->v_samp_factor;
+ compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
+ /* compute physical dimensions of component */
+ compptr->downsampled_width = jround_up(compptr->true_comp_width,
+ (long) (compptr->MCU_width*DCTSIZE));
+ compptr->downsampled_height = jround_up(compptr->true_comp_height,
+ (long) (compptr->MCU_height*DCTSIZE));
+ /* Sanity check */
+ if (compptr->downsampled_width !=
+ (cinfo->MCUs_per_row * (compptr->MCU_width*DCTSIZE)))
+ /* ERREXIT(cinfo->emethods, "I'm confused about the image width"); */
+ return(XIE_ERR);
+ /* Prepare array describing MCU composition */
+ mcublks = compptr->MCU_blocks;
+ if (cinfo->blocks_in_MCU + mcublks > MAX_BLOCKS_IN_MCU)
+ /* ERREXIT(cinfo->emethods, "Sampling factors too large for interleaved scan"); */
+ return(XIE_ERR);
+ while (mcublks-- > 0) {
+ cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
+ }
+ }
+
+ /* Convert restart specified in rows to actual MCU count. */
+ /* Note that count must fit in 16 bits, so we provide limiting. */
+ if (cinfo->restart_in_rows > 0) {
+ long nominal = cinfo->restart_in_rows * cinfo->MCUs_per_row;
+ cinfo->restart_interval = (UINT16) MIN(nominal, 65535L);
+ }
+
+ (*cinfo->methods->c_per_scan_method_selection) (cinfo);
+ return(0);
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+noninterleaved_scan_setup (compress_info_ptr cinfo)
+#else
+noninterleaved_scan_setup (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Compute all derived info for a noninterleaved (single-component) scan */
+/* On entry, cinfo->comps_in_scan = 1 and cinfo->cur_comp_info[0] is set up */
+{
+ jpeg_component_info *compptr = cinfo->cur_comp_info[0];
+
+ /* for noninterleaved scan, always one block per MCU */
+ compptr->MCU_width = 1;
+ compptr->MCU_height = 1;
+ compptr->MCU_blocks = 1;
+ /* compute physical dimensions of component */
+ compptr->downsampled_width = jround_up(compptr->true_comp_width,
+ (long) DCTSIZE);
+ compptr->downsampled_height = jround_up(compptr->true_comp_height,
+ (long) DCTSIZE);
+
+ cinfo->MCUs_per_row = compptr->downsampled_width / DCTSIZE;
+ cinfo->MCU_rows_in_scan = compptr->downsampled_height / DCTSIZE;
+
+ /* Prepare array describing MCU composition */
+ cinfo->blocks_in_MCU = 1;
+ cinfo->MCU_membership[0] = 0;
+
+ /* Convert restart specified in rows to actual MCU count. */
+ /* Note that count must fit in 16 bits, so we provide limiting. */
+ if (cinfo->restart_in_rows > 0) {
+ long nominal = cinfo->restart_in_rows * cinfo->MCUs_per_row;
+ cinfo->restart_interval = (UINT16) MIN(nominal, 65535L);
+ }
+
+ (*cinfo->methods->c_per_scan_method_selection) (cinfo);
+}
+
+
+LOCAL int
+#if NeedFunctionPrototypes
+alloc_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2],
+ long fullsize_width)
+#else
+alloc_sampling_buffer (cinfo, fullsize_data, fullsize_width)
+ compress_info_ptr cinfo;
+ JSAMPIMAGE fullsize_data[2];
+ long fullsize_width;
+#endif /* NeedFunctionPrototypes */
+/* Create a pre-downsampling data buffer having the desired structure */
+/* (see comments at head of file) */
+{
+ short ci, vs, i;
+
+ vs = cinfo->max_v_samp_factor; /* row group height */
+
+ /* Get top-level space for array pointers */
+ fullsize_data[0] = (JSAMPIMAGE) (*cinfo->emethods->c_alloc_small)
+ (cinfo, (cinfo->num_components * SIZEOF(JSAMPARRAY)));
+ if (fullsize_data[0] == NULL)
+ return(XIE_ERR);
+ fullsize_data[1] = (JSAMPIMAGE) (*cinfo->emethods->c_alloc_small)
+ (cinfo, (cinfo->num_components * SIZEOF(JSAMPARRAY)));
+ if (fullsize_data[1] == NULL)
+ return(XIE_ERR);
+
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ /* Allocate the real storage */
+ fullsize_data[0][ci] = (*cinfo->emethods->c_alloc_small_sarray)
+ (cinfo, fullsize_width,
+ (long) (vs * (DCTSIZE+2)));
+ if (fullsize_data[0][ci] == NULL)
+ return(XIE_ERR);
+ /* Create space for the scrambled-order pointers */
+ fullsize_data[1][ci] = (JSAMPARRAY) (*cinfo->emethods->c_alloc_small)
+ (cinfo, (vs * (DCTSIZE+2) * SIZEOF(JSAMPROW)));
+ if (fullsize_data[1][ci] == NULL)
+ return(XIE_ERR);
+ /* Duplicate the first DCTSIZE-2 row groups */
+ for (i = 0; i < vs * (DCTSIZE-2); i++) {
+ fullsize_data[1][ci][i] = fullsize_data[0][ci][i];
+ }
+ /* Copy the last four row groups in swapped order */
+ for (i = 0; i < vs * 2; i++) {
+ fullsize_data[1][ci][vs*DCTSIZE + i] = fullsize_data[0][ci][vs*(DCTSIZE-2) + i];
+ fullsize_data[1][ci][vs*(DCTSIZE-2) + i] = fullsize_data[0][ci][vs*DCTSIZE + i];
+ }
+ }
+ return(0);
+}
+
+
+LOCAL void
+#if NeedFunctionPrototypes
+downsample (compress_info_ptr cinfo,
+ JSAMPIMAGE fullsize_data, JSAMPIMAGE sampled_data,
+ long fullsize_width,
+ short above, short current, short below, short out)
+#else
+downsample (cinfo,
+ fullsize_data, sampled_data,
+ fullsize_width,
+ above, current, below, out)
+ compress_info_ptr cinfo;
+ JSAMPIMAGE fullsize_data;
+ JSAMPIMAGE sampled_data;
+ long fullsize_width;
+ short above;
+ short current;
+ short below;
+ short out;
+#endif /* NeedFunctionPrototypes */
+/* Do downsampling of a single row group (of each component). */
+/* above, current, below are indexes of row groups in fullsize_data; */
+/* out is the index of the target row group in sampled_data. */
+/* Special case: above, below can be -1 to indicate top, bottom of image. */
+{
+ jpeg_component_info *compptr;
+ JSAMPARRAY above_ptr, below_ptr;
+ JSAMPROW dummy[MAX_SAMP_FACTOR]; /* for downsample expansion at top/bottom */
+ short ci, vs, i;
+
+ vs = cinfo->max_v_samp_factor; /* row group height */
+
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = & cinfo->comp_info[ci];
+
+ if (above >= 0)
+ above_ptr = fullsize_data[ci] + above * vs;
+ else {
+ /* Top of image: make a dummy above-context with copies of 1st row */
+ /* We assume current=0 in this case */
+ for (i = 0; i < vs; i++)
+ dummy[i] = fullsize_data[ci][0];
+ above_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */
+ }
+
+ if (below >= 0)
+ below_ptr = fullsize_data[ci] + below * vs;
+ else {
+ /* Bot of image: make a dummy below-context with copies of last row */
+ for (i = 0; i < vs; i++)
+ dummy[i] = fullsize_data[ci][(current+1)*vs-1];
+ below_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */
+ }
+
+ (*cinfo->methods->downsample[ci])
+ (cinfo, (int) ci,
+ fullsize_width, (int) vs,
+ compptr->downsampled_width, (int) compptr->v_samp_factor,
+ above_ptr,
+ fullsize_data[ci] + current * vs,
+ below_ptr,
+ sampled_data[ci] + out * compptr->v_samp_factor);
+ }
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+jcXIE_init (compress_info_ptr cinfo)
+#else
+jcXIE_init (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+ short ci;
+
+/*
+ * Initialize cinfo with default switch settings.
+ */
+
+ /* (Re-)initialize the system-dependent error and memory managers. */
+ jcselmemmgr(cinfo, cinfo->emethods); /* memory allocation routines */
+ cinfo->methods->c_ui_method_selection = c_ui_method_selection;
+
+ /* Set up default JPEG parameters. */
+ /* Note that default -quality level here need not, and does not,
+ * match the default scaling for an explicit -qtables argument.
+ */
+
+ /* default quality level = 75 */
+ if (j_c_defaults(cinfo, 75, FALSE) == XIE_ERR)
+ return(XIE_ERR);
+
+ /* Init pass counts to 0 --- total_passes is adjusted in method selection */
+ cinfo->total_passes = 0;
+ cinfo->completed_passes = 0;
+ cinfo->data_precision = 8; /* always, even if 12-bit JSAMPLEs */
+
+ /* Give UI a chance to adjust compression parameters and select */
+ /* output file format based on results of input_init. */
+ (*cinfo->methods->c_ui_method_selection) (cinfo);
+
+ /* Now select methods for compression steps. */
+ if ((status = initial_setup(cinfo)) < 0)
+ return(status);
+ c_initial_method_selection(cinfo);
+
+ /* Prepare for single scan containing all components */
+ if (cinfo->num_components > MAX_COMPS_IN_SCAN)
+ /* ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); */
+ return(XIE_ERR);
+ cinfo->comps_in_scan = cinfo->num_components;
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
+ }
+ if (cinfo->comps_in_scan == 1) {
+ noninterleaved_scan_setup(cinfo);
+ /* Vk block rows constitute the same number of MCU rows */
+ cinfo->mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor;
+ } else {
+ if ((status = interleaved_scan_setup(cinfo)) < 0)
+ return(status);
+ /* in an interleaved scan, one MCU row contains Vk block rows */
+ cinfo->mcu_rows_per_loop = 1;
+ }
+ cinfo->total_passes++;
+
+ /* Compute dimensions of full-size pixel buffers */
+ /* Note these are the same whether interleaved or not. */
+ cinfo->rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE;
+ cinfo->fullsize_width = jround_up(cinfo->image_width,
+ (long) (cinfo->max_h_samp_factor * DCTSIZE));
+
+ /* Allocate working memory: */
+ /* fullsize_data is sample data before downsampling */
+ if (alloc_sampling_buffer(cinfo, cinfo->fullsize_data,
+ cinfo->fullsize_width) == XIE_ERR)
+ return(XIE_ERR);
+ /* sampled_data is sample data after downsampling */
+ cinfo->sampled_data = (JSAMPIMAGE) (*cinfo->emethods->c_alloc_small)
+ (cinfo, (cinfo->num_components * SIZEOF(JSAMPARRAY)));
+ if (cinfo->sampled_data == NULL)
+ return(XIE_ERR);
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ cinfo->sampled_data[ci] = (*cinfo->emethods->c_alloc_small_sarray)
+ (cinfo, cinfo->comp_info[ci].downsampled_width,
+ (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE));
+ if (cinfo->sampled_data[ci] == NULL)
+ return(XIE_ERR);
+ }
+
+ /* Do per-scan object init */
+
+ if ((status = ((*cinfo->methods->entropy_encode_init) (cinfo))) < 0)
+ return(status);
+ (*cinfo->methods->downsample_init) (cinfo);
+ (*cinfo->methods->extract_init) (cinfo);
+
+ cinfo->mcu_rows_output = 0;
+ cinfo->whichss = 0; /* arrange to start with fullsize_data[0] */
+ cinfo->cur_pixel_row = 0;
+ cinfo->first_pixel_row = TRUE;
+ return(0);
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+jcopy_pixel_rows (JSAMPARRAY input_array,
+ JSAMPIMAGE output_array, int dest_row,
+ int num_rows, long num_cols)
+#else
+jcopy_pixel_rows (input_array,
+ output_array, dest_row,
+ num_rows, num_cols)
+ JSAMPARRAY input_array;
+ JSAMPIMAGE output_array;
+ int dest_row;
+ int num_rows;
+ long num_cols;
+#endif /* NeedFunctionPrototypes */
+/* Copy some rows of samples from one place to another.
+ * num_rows rows are copied from input_array[source_row++]
+ * to output_array[dest_row++]; these areas should not overlap.
+ * The source and destination arrays must be at least as wide as num_cols.
+ */
+{
+ register JSAMPROW inptr, outptr;
+#ifdef FMEMCOPY
+ register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
+#else
+ register long count;
+#endif
+ register int row;
+
+ for (row = 0; row < num_rows; row++) {
+ inptr = input_array[row];
+ outptr = output_array[row][dest_row];
+#ifdef FMEMCOPY
+ FMEMCOPY(outptr, inptr, count);
+#else
+ for (count = 0; count < num_cols; count++)
+ outptr[count] = inptr[count]; /* needn't bother with GETJSAMPLE() here */
+#endif
+ }
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+jcXIE_get (compress_info_ptr cinfo,
+ int row_to_process, JSAMPARRAY pixel_row)
+#else
+jcXIE_get (cinfo, row_to_process, pixel_row)
+ compress_info_ptr cinfo;
+ int row_to_process;
+ JSAMPARRAY pixel_row;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+ short i;
+ short whichss;
+
+ whichss = cinfo->whichss;
+
+ if (cinfo->XIErestart == XIE_RNUL) {
+
+ /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */
+ /* Then we have exactly DCTSIZE row groups for downsampling. */
+
+ jcopy_pixel_rows (pixel_row,
+ cinfo->fullsize_data[whichss], cinfo->cur_pixel_row,
+ cinfo->num_components, cinfo->image_width);
+
+ if ((++(cinfo->cur_pixel_row)) < cinfo->rows_this_time)
+ return(0);
+
+ (*cinfo->methods->edge_expand) (cinfo,
+ cinfo->image_width, cinfo->rows_this_time,
+ cinfo->fullsize_width, cinfo->rows_in_mem,
+ cinfo->fullsize_data[whichss]);
+
+ }
+ /* Downsample the data (all components) */
+ /* First time through is a special case */
+
+ if (cinfo->first_pixel_row == FALSE) {
+ if (cinfo->XIErestart == XIE_RNUL) {
+ /* Downsample last row group of previous set */
+ downsample(cinfo, cinfo->fullsize_data[whichss], cinfo->sampled_data,
+ cinfo->fullsize_width, (short) DCTSIZE,
+ (short) (DCTSIZE+1), (short) 0, (short) (DCTSIZE-1));
+ }
+ /* and dump the previous set's downsampled data */
+ if ((status = (*cinfo->methods->extract_MCUs) (cinfo, cinfo->sampled_data,
+ cinfo->mcu_rows_per_loop,
+ cinfo->methods->entropy_encode)) < 0) {
+ return(status);
+ }
+ cinfo->mcu_rows_output += cinfo->mcu_rows_per_loop;
+ /* Downsample first row group of this set */
+ downsample(cinfo, cinfo->fullsize_data[whichss], cinfo->sampled_data,
+ cinfo->fullsize_width,
+ (short) (DCTSIZE+1), (short) 0, (short) 1, (short) 0);
+ } else {
+ /* Downsample first row group with dummy above-context */
+ downsample(cinfo, cinfo->fullsize_data[whichss], cinfo->sampled_data,
+ cinfo->fullsize_width,
+ (short) (-1), (short) 0, (short) 1, (short) 0);
+ cinfo->first_pixel_row = FALSE;
+ }
+ /* Downsample second through next-to-last row groups of this set */
+ for (i = 1; i <= DCTSIZE-2; i++) {
+ downsample(cinfo, cinfo->fullsize_data[whichss], cinfo->sampled_data,
+ cinfo->fullsize_width,
+ (short) (i-1), (short) i, (short) (i+1), (short) i);
+ }
+ cinfo->whichss ^= 1; /* switch to other fullsize_data buffer */
+ cinfo->cur_pixel_row = 0;
+ return(0);
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+jcXIE_term (compress_info_ptr cinfo)
+#else
+jcXIE_term (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+ short whichss;
+
+ if (cinfo->XIErestart == XIE_RNUL) {
+ whichss = cinfo->whichss ^ 1; /* switch back to other buffer */
+
+ /* Downsample the last row group with dummy below-context */
+ /* Note whichss points to last buffer side used */
+ downsample(cinfo, cinfo->fullsize_data[whichss], cinfo->sampled_data,
+ cinfo->fullsize_width, (short) (DCTSIZE-2), (short) (DCTSIZE-1),
+ (short) (-1), (short) (DCTSIZE-1));
+ }
+ /* Dump the remaining data (may be less than full height if uninterleaved) */
+ if ((status = (*cinfo->methods->extract_MCUs) (cinfo, cinfo->sampled_data,
+ (int) (cinfo->MCU_rows_in_scan - cinfo->mcu_rows_output),
+ cinfo->methods->entropy_encode)) < 0) {
+ return(status);
+ }
+ (*cinfo->methods->extract_term) (cinfo);
+ (*cinfo->methods->downsample_term) (cinfo);
+ (*cinfo->methods->entropy_encode_term) (cinfo);
+ cinfo->completed_passes++;
+ (*cinfo->emethods->c_free_all) (cinfo);
+ return(0);
+}
+
+GLOBAL void
+#if NeedFunctionPrototypes
+jselrXIE (compress_info_ptr cinfo)
+#else
+jselrXIE (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ cinfo->methods->input_init = jcXIE_init;
+ /* cinfo->methods->get_input_row is set by input_init */
+ cinfo->methods->input_term = jcXIE_term;
+}
+
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jcxief.c b/xc/programs/Xserver/XIE/mixie/jpeg/jcxief.c
new file mode 100644
index 000000000..f6b41b1b7
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jcxief.c
@@ -0,0 +1,487 @@
+/* $TOG: jcxief.c /main/5 1998/02/09 16:19:13 kaleb $ */
+/* Module jcxief.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ jcxief.c: Xie JPEG Compression Wrapper Routines
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+#include "jinclude.h"
+
+#ifdef THINK_C
+#include <console.h> /* command-line reader for Macintosh */
+#endif
+
+#if NeedFunctionPrototypes
+GLOBAL void
+jselrXIE (compress_info_ptr);
+GLOBAL void
+process_rgb_ycc_row (compress_info_ptr, JSAMPARRAY);
+GLOBAL int
+jcXIE_get (compress_info_ptr, int, JSAMPARRAY);
+GLOBAL void
+jcXIE_get_buffersize (compress_info_ptr);
+GLOBAL int
+j_add_quant_table (compress_info_ptr, int, const QUANT_VAL *, int, boolean);
+GLOBAL int
+add_huff_table (compress_info_ptr, HUFF_TBL **, const UINT8 *, const UINT8 *);
+#endif /* NeedFunctionPrototypes */
+
+/******************************************************************************/
+
+LOCAL int
+#if NeedFunctionPrototypes
+load_quant_tables (compress_info_ptr cinfo,
+ UINT8 * q_table, int nq_table, int scale_factor)
+#else
+load_quant_tables (cinfo, q_table, nq_table, scale_factor)
+ compress_info_ptr cinfo;
+ UINT8 * q_table;
+ int nq_table;
+ int scale_factor;
+#endif /* NeedFunctionPrototypes */
+/* Read a set of quantization tables pointed at by q_table.
+ * There may be one to NUM_QUANT_TBLS tables, each of 64 values.
+ * The tables are implicitly numbered 0, 1, etc.
+ */
+{
+ /* ZIG[i] is the zigzag-order position of the i'th element of a DCT block */
+ /* read in natural order (left to right, top to bottom). */
+ static const short ZIG[DCTSIZE2] = {
+ 0, 1, 5, 6, 14, 15, 27, 28,
+ 2, 4, 7, 13, 16, 26, 29, 42,
+ 3, 8, 12, 17, 25, 30, 41, 43,
+ 9, 11, 18, 24, 31, 40, 44, 53,
+ 10, 19, 23, 32, 39, 45, 52, 54,
+ 20, 22, 33, 38, 46, 51, 55, 60,
+ 21, 34, 37, 47, 50, 56, 59, 61,
+ 35, 36, 48, 49, 57, 58, 62, 63
+ };
+ int numtables;
+ int tblno, i;
+ QUANT_TBL table;
+
+ numtables = nq_table / 64;
+ if (numtables < 1 || numtables > NUM_QUANT_TBLS)
+ return(XIE_ERR);
+
+ for (tblno = 0; tblno < numtables; tblno++)
+ {
+ for (i = 0; i < DCTSIZE2; i++)
+ table[ZIG[i]] = *q_table++;
+ j_add_quant_table(cinfo, tblno, table, scale_factor, FALSE);
+ }
+ return(0);
+}
+
+LOCAL int
+#if NeedFunctionPrototypes
+load_ac_tables (compress_info_ptr cinfo,
+ UINT8 * ac_table, int nac_table)
+#else
+load_ac_tables (cinfo, ac_table, nac_table)
+ compress_info_ptr cinfo;
+ UINT8 * ac_table;
+ int nac_table;
+#endif /* NeedFunctionPrototypes */
+/* Read a set of AC Huffman tables pointed at by ac_table.
+ * There may be one or two tables.
+ */
+{
+ int i;
+ int count;
+ UINT8 bits[17];
+ UINT8 val[256];
+
+ bits[0] = 0;
+ /* luminance AC coefficients */
+ count = 0;
+ nac_table -= 16;
+ if (nac_table < 0) /* bad length */
+ return(XIE_ERR);
+ for(i = 1; i < 17; i++) {
+ bits[i] = *ac_table++;
+ count += bits[i];
+ }
+ nac_table -= count;
+ if (nac_table < 0 || 256 < count) /* bad length */
+ return(XIE_ERR);
+ for(i = 0; i < count; i++) {
+ val[i] = *ac_table++;
+ }
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], bits, val))
+ return(XIE_ERR);
+
+ /* chrominance AC coefficients */
+ count = 0;
+ nac_table -= 16;
+ if (nac_table < 0) /* bad length */
+ return(XIE_ERR);
+ for(i = 1; i < 17; i++) {
+ bits[i] = *ac_table++;
+ count += bits[i];
+ }
+ nac_table -= count;
+ if (nac_table < 0 || 256 < count) /* bad length */
+ return(XIE_ERR);
+ for(i = 0; i < count; i++) {
+ val[i] = *ac_table++;
+ }
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1], bits, val))
+ return(XIE_ERR);
+
+ return(0);
+}
+
+LOCAL int
+#if NeedFunctionPrototypes
+load_dc_tables (compress_info_ptr cinfo,
+ UINT8 * dc_table, int ndc_table)
+#else
+load_dc_tables (cinfo, dc_table, ndc_table)
+ compress_info_ptr cinfo;
+ UINT8 * dc_table;
+ int ndc_table;
+#endif /* NeedFunctionPrototypes */
+/* Read a set of DC Huffman tables pointed at by dc_table.
+ * There may be one or two tables.
+ */
+{
+ int i;
+ int count;
+ UINT8 bits[17];
+ UINT8 val[256];
+
+ bits[0] = 0;
+ /* luminance DC coefficients */
+ count = 0;
+ ndc_table -= 16;
+ if (ndc_table < 0) /* bad length */
+ return(XIE_ERR);
+ for(i = 1; i < 17; i++) {
+ bits[i] = *dc_table++;
+ count += bits[i];
+ }
+ ndc_table -= count;
+ if (ndc_table < 0 || 256 < count) /* bad length */
+ return(XIE_ERR);
+ for(i = 0; i < count; i++) {
+ val[i] = *dc_table++;
+ }
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], bits, val))
+ return(XIE_ERR);
+
+ /* chrominance DC coefficients */
+ count = 0;
+ ndc_table -= 16;
+ if (ndc_table < 0) /* bad length */
+ return(XIE_ERR);
+ for(i = 1; i < 17; i++) {
+ bits[i] = *dc_table++;
+ count += bits[i];
+ }
+ ndc_table -= count;
+ if (ndc_table < 0 || 256 < count) /* bad length */
+ return(XIE_ERR);
+ for(i = 0; i < count; i++) {
+ val[i] = *dc_table++;
+ }
+ if(XIE_ERR == add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1], bits, val))
+ return(XIE_ERR);
+
+ return(0);
+}
+
+/******************************************************************************/
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JC_INIT (compress_info_ptr cinfo,
+ compress_methods_ptr cmethods, external_methods_ptr emethods)
+#else
+JC_INIT (cinfo, cmethods, emethods)
+ compress_info_ptr cinfo;
+ compress_methods_ptr cmethods;
+ external_methods_ptr emethods;
+#endif /* NeedFunctionPrototypes */
+{
+ /* Set up links to method structures. */
+ cinfo->methods = cmethods;
+ cinfo->emethods = emethods;
+
+ /* Set restart to NULL */
+ cinfo->XIErestart = XIE_RNUL;
+
+ jselrXIE (cinfo);
+
+ return (XIE_NRML);
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JC_BEGINFRAME (compress_info_ptr cinfo,
+ long components, long width, long height,
+ UINT8 * q_table, int nq_table,
+ UINT8 * ac_table, int nac_table,
+ UINT8 * dc_table, int ndc_table,
+ short * h_sample, short * v_sample)
+#else
+JC_BEGINFRAME (cinfo, components, width, height,
+ q_table, nq_table, ac_table, nac_table, dc_table, ndc_table,
+ h_sample, v_sample)
+ compress_info_ptr cinfo;
+ long components;
+ long width;
+ long height;
+ UINT8 * q_table;
+ int nq_table;
+ UINT8 * ac_table;
+ int nac_table;
+ UINT8 * dc_table;
+ int ndc_table;
+ short * h_sample, * v_sample;
+#endif /* NeedFunctionPrototypes */
+{
+ short ci;
+ short hsample, vsample, total;
+ int status;
+ int scale_factor = 100;
+
+ if (cinfo->XIErestart == XIE_RNUL) {
+ cinfo->input_components = (short)components;
+ cinfo->image_width = width;
+ cinfo->image_height = height;
+ if (components == 1)
+ cinfo->in_color_space = CS_GRAYSCALE;
+ else
+ cinfo->in_color_space = CS_RGB;
+
+ if (1 < components) {
+ total = 0;
+ for(ci = 0; ci < components; ci++) {
+ hsample = h_sample[ci];
+ if (hsample <= 0 || MAX_SAMP_FACTOR < hsample)
+ return(XIE_ERR); /* bad sub-sampling factor */
+ vsample = v_sample[ci];
+ if (vsample <= 0 || MAX_SAMP_FACTOR < vsample)
+ return(XIE_ERR); /* bad sub-sampling factor */
+ total += (hsample*vsample);
+ if (MAX_BLOCKS_IN_MCU < total)
+ return(XIE_ERR); /* bad sub-sampling factor(s) */
+ cinfo->xie_h_samp_factor[ci] = hsample;
+ cinfo->xie_v_samp_factor[ci] = vsample;
+ }
+ }
+
+ if (((*cinfo->methods->input_init) (cinfo)) == XIE_ERR) /* jcXIE_init (cinfo); */
+ return(XIE_ERR);
+ }
+
+ if (0 < nq_table) {
+ if ((load_quant_tables (cinfo, q_table, nq_table, scale_factor)) == XIE_ERR)
+ return(XIE_ERR);
+ }
+
+ if (0 < nac_table) {
+ if ((load_ac_tables (cinfo, ac_table, nac_table)) == XIE_ERR)
+ return(XIE_ERR);
+ }
+
+ if (0 < ndc_table) {
+ if ((load_dc_tables (cinfo, dc_table, ndc_table)) == XIE_ERR)
+ return(XIE_ERR);
+ }
+
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RWFH)) {
+ if ((status = ((*cinfo->methods->write_file_header) (cinfo))) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RWFH; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RWSH)) {
+ if ((status = ((*cinfo->methods->write_scan_header) (cinfo))) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RWSH; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+
+ return (XIE_NRML);
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JC_ENDFRAME (compress_info_ptr cinfo)
+#else
+JC_ENDFRAME (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+
+ /* jcXIE_term (cinfo); */
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RMCU)) {
+ if ((status = ((*cinfo->methods->input_term) (cinfo))) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RMCU; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+
+ (*cinfo->methods->write_scan_trailer) (cinfo); /* does nothing */
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RWFT)) {
+ if (((*cinfo->methods->write_file_trailer) (cinfo)) == XIE_OUT) {
+ cinfo->XIErestart = XIE_RWFT; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+ return (XIE_NRML);
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JC_SCANLINE_RGB (compress_info_ptr cinfo,
+ int * scanline, JSAMPROW ptr0, JSAMPROW ptr1, JSAMPROW ptr2)
+#else
+JC_SCANLINE_RGB (cinfo, scanline, ptr0, ptr1, ptr2)
+ compress_info_ptr cinfo;
+ int * scanline;
+ JSAMPROW ptr0;
+ JSAMPROW ptr1;
+ JSAMPROW ptr2;
+#endif /* NeedFunctionPrototypes */
+{
+ JSAMPROW pixel_row[3];
+ int row, rows_this_time;
+ int status;
+
+ row = *scanline;
+ if (cinfo->XIErestart == XIE_RNUL) {
+ if (cinfo->cur_pixel_row <= 0) {
+ rows_this_time = (int) MIN((long) cinfo->rows_in_mem,
+ cinfo->image_height - row);
+ if (rows_this_time <= 0)
+ return (XIE_NRML);
+ cinfo->rows_this_time = rows_this_time;
+ }
+ pixel_row[0] = ptr0;
+ pixel_row[1] = ptr1;
+ pixel_row[2] = ptr2;
+ }
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RMCU)) {
+ if ((status = jcXIE_get (cinfo, row, pixel_row)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RMCU; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+
+ return (XIE_NRML);
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JC_SCANLINE_GRAY (compress_info_ptr cinfo, int * scanline, JSAMPROW ptr0)
+#else
+JC_SCANLINE_GRAY (cinfo, scanline, ptr0)
+ compress_info_ptr cinfo;
+ int * scanline;
+ JSAMPROW ptr0;
+#endif /* NeedFunctionPrototypes */
+{
+ JSAMPROW pixel_row[3];
+ int row, rows_this_time;
+ int status;
+
+ row = *scanline;
+ if (cinfo->XIErestart == XIE_RNUL) {
+ if (cinfo->cur_pixel_row <= 0) {
+ rows_this_time = (int) MIN((long) cinfo->rows_in_mem,
+ cinfo->image_height - row);
+ if (rows_this_time <= 0)
+ return (XIE_NRML);
+ cinfo->rows_this_time = rows_this_time;
+ }
+ pixel_row[0] = ptr0;
+ pixel_row[1] = 0;
+ pixel_row[2] = 0;
+ }
+ if ((cinfo->XIErestart == XIE_RNUL) || (cinfo->XIErestart == XIE_RMCU)) {
+ if ((status = jcXIE_get (cinfo, row, pixel_row)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RMCU; /* set restart status */
+ return(XIE_OUT);
+ }
+ }
+
+ return (XIE_NRML);
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdbuffer.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdbuffer.c
new file mode 100644
index 000000000..a2d1a07d4
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdbuffer.c
@@ -0,0 +1,146 @@
+/* $TOG: jdbuffer.c /main/6 1998/02/09 16:19:23 kaleb $ */
+/*** jdbuffer.c - transfer data from input strip to decode buffer */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Ben Fahy, AGE Logic, Oct 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+#include "jpeg.h"
+#include "macro.h"
+
+/************************************************************************/
+int fill_jpeg_decode_buffer(state)
+JpegDecodeState *state;
+{
+decompress_info_ptr cinfo=state->cinfo;
+unsigned char *start_of_rest_of_buffer;
+int bytes_to_fill,sbytes_done,sbytes_left;
+
+/*** It is an error to call fill_jpeg_decode_buffer after
+ we have found out there is no more strip data
+***/
+ if (state->no_more_strips)
+ return(JPEG_BUFFER_BufferError);
+
+#define START_OF_JPEG_INPUT_BUFFER (cinfo->input_buffer + MIN_UNGET)
+
+/*** Whenever we fill the JPEG decode buffer, we always start by
+ copying existing data to start of buffer. This way we know
+ we have a nice contiguous buffer of JPEG_BUF_SIZE bytes long
+***/
+ if (cinfo->bytes_in_buffer) {
+ memcpy(START_OF_JPEG_INPUT_BUFFER,
+ cinfo->next_input_byte,
+ cinfo->bytes_in_buffer);
+ }
+ cinfo->next_input_byte = START_OF_JPEG_INPUT_BUFFER;
+ /* tells decoder (s)he can start reading here */
+
+/*** Ok, now calculate how much fills the rest of the buffer, and
+ where to put it (assuming we can get the data from a strip)
+***/
+ start_of_rest_of_buffer = (unsigned char *)
+ cinfo->next_input_byte + cinfo->bytes_in_buffer;
+
+ bytes_to_fill = JPEG_BUF_SIZE - cinfo->bytes_in_buffer;
+ /* how much room is left in the buffer */
+
+/*** Is there enough data in the current strip to fill buffer? ***/
+ sbytes_done = state->sptr - state->strip;
+ sbytes_left = state->strip_size - sbytes_done;
+
+ if (sbytes_left >= bytes_to_fill) {
+ /* yes! */
+ memcpy(start_of_rest_of_buffer,state->sptr,bytes_to_fill);
+ state->sptr += bytes_to_fill;
+ cinfo->bytes_in_buffer += bytes_to_fill;
+
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ cinfo->XIEnext_input_byte = cinfo->next_input_byte;
+ /* save these in case we have to restart */
+
+ return(JPEG_BUFFER_BufferFilled);
+ }
+
+/*** Well, no. We will copy what we can. If this is the last
+ strip, we will set NoMoreStrips to signal the next state.
+ If there are more strips to come, we will return the
+ signal NeedAnotherStrip, so caller will go get another.
+***/
+ memcpy(start_of_rest_of_buffer,state->sptr,sbytes_left);
+ cinfo->bytes_in_buffer += sbytes_left;
+
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ cinfo->XIEnext_input_byte = cinfo->next_input_byte;
+ /* save these in case we have to restart */
+
+ if (state->final) {
+ state->no_more_strips = 1;
+ return(JPEG_BUFFER_LastBuffer);
+ }
+ else
+ return(JPEG_BUFFER_NeedAnotherStrip);
+}
+/************************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jddeflts.c b/xc/programs/Xserver/XIE/mixie/jpeg/jddeflts.c
new file mode 100644
index 000000000..1c3ccbc15
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jddeflts.c
@@ -0,0 +1,290 @@
+/* $TOG: jddeflts.c /main/6 1998/02/09 16:19:27 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/* Module jddeflts.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+
+****************************************************************************/
+
+/*
+ * jddeflts.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains optional default-setting code for the JPEG decompressor.
+ * User interfaces do not have to use this file, but those that don't use it
+ * must know more about the innards of the JPEG code.
+ */
+
+#include "jinclude.h"
+
+#ifndef XIE_SUPPORTED
+/* Default do-nothing progress monitoring routine.
+ * This can be overridden by a user interface that wishes to
+ * provide progress monitoring; just set methods->progress_monitor
+ * after j_d_defaults is done. The routine will be called periodically
+ * during the decompression process.
+ *
+ * During any one pass, loopcounter increases from 0 up to (not including)
+ * looplimit; the step size is not necessarily 1. Both the step size and
+ * the limit may differ between passes. The expected total number of passes
+ * is in cinfo->total_passes, and the number of passes already completed is
+ * in cinfo->completed_passes. Thus the fraction of work completed may be
+ * estimated as
+ * completed_passes + (loopcounter/looplimit)
+ * ------------------------------------------
+ * total_passes
+ * ignoring the fact that the passes may not be equal amounts of work.
+ *
+ * When decompressing, the total_passes figure is an estimate that may be
+ * on the high side; completed_passes will jump by more than one if some
+ * passes are skipped.
+ */
+
+METHODDEF void
+progress_monitor (decompress_info_ptr cinfo, long loopcounter, long looplimit)
+{
+ /* do nothing */
+}
+#endif /* XIE_SUPPORTED */
+
+/* Default comment-block processing routine.
+ * This can be overridden by an application that wishes to examine
+ * COM blocks found in the JPEG file. The default routine does nothing.
+ * CAUTION: the comment processing routine MUST call JGETC() exactly
+ * comment_length times to read the comment data, whether it intends
+ * to do anything with the data or not!
+ * Keep in mind that (a) there may be more than one COM block in a file;
+ * (b) there's no guarantee that what's in the block is ASCII data.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+process_comment (decompress_info_ptr cinfo, long comment_length)
+#else
+process_comment (cinfo, comment_length)
+ decompress_info_ptr cinfo;
+ long comment_length;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+process_comment (decompress_info_ptr cinfo, long comment_length)
+#endif /* XIE_SUPPORTED */
+{
+#ifdef XIE_SUPPORTED
+ int i;
+#endif /* XIE_SUPPORTED */
+
+ while (comment_length-- > 0) {
+#ifdef XIE_SUPPORTED
+ if ((i = JGETC(cinfo)) < 0)
+ return(-1);
+#else
+ (void) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifndef XIE_SUPPORTED
+/*
+ * Reload the input buffer after it's been emptied, and return the next byte.
+ * See the JGETC macro for calling conditions. Note in particular that
+ * read_jpeg_data may NOT return EOF. If no more data is available, it must
+ * exit via ERREXIT, or perhaps synthesize fake data (such as an RST marker).
+ * In the present implementation, we insert an EOI marker; this might not be
+ * appropriate for non-JFIF file formats, but it usually allows us to handle
+ * a truncated JFIF file.
+ *
+ * This routine can be overridden by the system-dependent user interface,
+ * in case the data source is not a stdio stream or some other special
+ * condition applies. Note, however, that this capability only applies for
+ * JFIF or similar serial-access JPEG file formats. The input file control
+ * module for a random-access format such as TIFF/JPEG would most likely
+ * override the read_jpeg_data method with its own routine.
+ */
+
+METHODDEF int
+read_jpeg_data (decompress_info_ptr cinfo)
+{
+ cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET;
+
+ cinfo->bytes_in_buffer = (int) JFREAD(cinfo->input_file,
+ cinfo->next_input_byte,
+ JPEG_BUF_SIZE);
+
+ if (cinfo->bytes_in_buffer <= 0) {
+ WARNMS(cinfo->emethods, "Premature EOF in JPEG file");
+ cinfo->next_input_byte[0] = (char) 0xFF;
+ cinfo->next_input_byte[1] = (char) 0xD9; /* EOI marker */
+ cinfo->bytes_in_buffer = 2;
+ }
+
+ return JGETC(cinfo);
+}
+#endif /* XIE_SUPPORTED */
+
+
+/* Default parameter setup for decompression.
+ *
+ * User interfaces that don't choose to use this routine must do their
+ * own setup of all these parameters. Alternately, you can call this
+ * to establish defaults and then alter parameters selectively. This
+ * is the recommended approach since, if we add any new parameters,
+ * your code will still work (they'll be set to reasonable defaults).
+ *
+ * standard_buffering should be TRUE to cause an input buffer to be allocated
+ * (the normal case); if FALSE, the user interface must provide a buffer.
+ * This option is most useful in the case that the buffer must not be freed
+ * at the end of an image. (For example, when reading a sequence of images
+ * from a single file, the remaining data in the buffer represents the
+ * start of the next image and mustn't be discarded.) To handle this,
+ * allocate the input buffer yourself at startup, WITHOUT using alloc_small
+ * (probably a direct call to malloc() instead). Then pass FALSE on each
+ * call to j_d_defaults to ensure the buffer state is not modified.
+ *
+ * If the source of the JPEG data is not a stdio stream, override the
+ * read_jpeg_data method with your own routine after calling j_d_defaults.
+ * You can still use the standard buffer if it's appropriate.
+ *
+ * CAUTION: if you want to decompress multiple images per run, it's necessary
+ * to call j_d_defaults before *each* call to jpeg_decompress, since subsidiary
+ * structures like the quantization tables are automatically freed during
+ * cleanup.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering)
+#else
+j_d_defaults (cinfo, standard_buffering)
+ decompress_info_ptr cinfo;
+ boolean standard_buffering;
+#endif /* NeedFunctionPrototypes */
+#else
+j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering)
+#endif /* XIE_SUPPORTED */
+/* NB: the external methods must already be set up. */
+{
+ short i;
+
+ /* Initialize pointers as needed to mark stuff unallocated. */
+ /* Outer application may fill in default tables for abbreviated files... */
+ cinfo->comp_info = NULL;
+ for (i = 0; i < NUM_QUANT_TBLS; i++)
+ cinfo->quant_tbl_ptrs[i] = NULL;
+ for (i = 0; i < NUM_HUFF_TBLS; i++) {
+ cinfo->dc_huff_tbl_ptrs[i] = NULL;
+ cinfo->ac_huff_tbl_ptrs[i] = NULL;
+ }
+ cinfo->colormap = NULL;
+
+ /* Default to RGB output */
+ /* UI can override by changing out_color_space */
+ cinfo->out_color_space = CS_RGB;
+ cinfo->jpeg_color_space = CS_UNKNOWN;
+ /* Setting any other value in jpeg_color_space overrides heuristics in */
+ /* jrdjfif.c. That might be useful when reading non-JFIF JPEG files, */
+ /* but ordinarily the UI shouldn't change it. */
+
+ /* Default to no gamma correction of output */
+ cinfo->output_gamma = 1.0;
+
+ /* Default to no color quantization */
+ cinfo->quantize_colors = FALSE;
+ /* but set reasonable default parameters for quantization, */
+ /* so that turning on quantize_colors is sufficient to do something useful */
+ cinfo->two_pass_quantize = TRUE;
+ cinfo->use_dithering = TRUE;
+ cinfo->desired_number_of_colors = 256;
+
+ /* Default to no smoothing */
+ cinfo->do_block_smoothing = FALSE;
+ cinfo->do_pixel_smoothing = FALSE;
+
+#ifndef XIE_SUPPORTED
+ /* Allocate memory for input buffer, unless outer application provides it. */
+ if (standard_buffering) {
+ cinfo->input_buffer = (char *) (*cinfo->emethods->alloc_small)
+ ((size_t) (JPEG_BUF_SIZE + MIN_UNGET));
+ cinfo->bytes_in_buffer = 0; /* initialize buffer to empty */
+ }
+
+ /* Install standard buffer-reloading method (outer code may override). */
+ cinfo->methods->read_jpeg_data = read_jpeg_data;
+
+ /* Install default do-nothing progress monitoring method. */
+ cinfo->methods->progress_monitor = progress_monitor;
+#endif /* XIE_SUPPORTED */
+
+ /* Install default comment-block processing method. */
+ cinfo->methods->process_comment = process_comment;
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdhuff.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdhuff.c
new file mode 100644
index 000000000..097fa9f2a
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdhuff.c
@@ -0,0 +1,694 @@
+/* $TOG: jdhuff.c /main/6 1998/02/09 16:19:31 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/* Module jdhuff.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+
+****************************************************************************/
+
+/*
+ * jdhuff.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains Huffman entropy decoding routines.
+ * These routines are invoked via the methods entropy_decode
+ * and entropy_decode_init/term.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+
+/* Static variables to avoid passing 'round extra parameters */
+
+static decompress_info_ptr dcinfo;
+
+static INT32 get_buffer; /* current bit-extraction buffer */
+static int bits_left; /* # of unused bits in it */
+#ifdef XIE_SUPPORTED
+static UINT16 restarts_to_go; /* MCUs left in this restart interval */
+static short next_restart_num; /* # of next RSTn marker (0..7) */
+#define XIE_EOB 0xffffffff /* Return value when input buffer is empty */
+#else
+static boolean printed_eod; /* flag to suppress multiple end-of-data msgs */
+#endif /* XIE_SUPPORTED */
+
+LOCAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fix_huff_tbl (HUFF_TBL * htbl)
+#else
+fix_huff_tbl (htbl)
+ HUFF_TBL * htbl;
+#endif /* NeedFunctionPrototypes */
+#else
+fix_huff_tbl (HUFF_TBL * htbl)
+#endif /* XIE_SUPPORTED */
+/* Compute derived values for a Huffman table */
+{
+ int p, i, l, si;
+ char huffsize[257];
+ UINT16 huffcode[257];
+ UINT16 code;
+
+ /* Figure C.1: make table of Huffman code length for each symbol */
+ /* Note that this is in code-length order. */
+
+ p = 0;
+ for (l = 1; l <= 16; l++) {
+ for (i = 1; i <= (int) htbl->bits[l]; i++)
+ huffsize[p++] = (char) l;
+ }
+ huffsize[p] = 0;
+
+ /* Figure C.2: generate the codes themselves */
+ /* Note that this is in code-length order. */
+
+ code = 0;
+ si = huffsize[0];
+ p = 0;
+ while (huffsize[p]) {
+ while (((int) huffsize[p]) == si) {
+ huffcode[p++] = code;
+ code++;
+ }
+ code <<= 1;
+ si++;
+ }
+
+ /* We don't bother to fill in the encoding tables ehufco[] and ehufsi[], */
+ /* since they are not used for decoding. */
+
+ /* Figure F.15: generate decoding tables */
+
+ p = 0;
+ for (l = 1; l <= 16; l++) {
+ if (htbl->bits[l]) {
+ htbl->valptr[l] = p; /* huffval[] index of 1st sym of code len l */
+ htbl->mincode[l] = huffcode[p]; /* minimum code of length l */
+ p += htbl->bits[l];
+ htbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
+ } else {
+ htbl->maxcode[l] = -1;
+ }
+ }
+ htbl->maxcode[17] = 0xFFFFFL; /* ensures huff_DECODE terminates */
+}
+
+
+/*
+ * Code for extracting the next N bits from the input stream.
+ * (N never exceeds 15 for JPEG data.)
+ * This needs to go as fast as possible!
+ *
+ * We read source bytes into get_buffer and dole out bits as needed.
+ * If get_buffer already contains enough bits, they are fetched in-line
+ * by the macros get_bits() and get_bit(). When there aren't enough bits,
+ * fill_bit_buffer is called; it will attempt to fill get_buffer to the
+ * "high water mark", then extract the desired number of bits. The idea,
+ * of course, is to minimize the function-call overhead cost of entering
+ * fill_bit_buffer.
+ * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width
+ * of get_buffer to be used. (On machines with wider words, an even larger
+ * buffer could be used.) However, on some machines 32-bit shifts are
+ * relatively slow and take time proportional to the number of places shifted.
+ * (This is true with most PC compilers, for instance.) In this case it may
+ * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the
+ * average shift distance at the cost of more calls to fill_bit_buffer.
+ */
+
+#ifdef SLOW_SHIFT_32
+#define MIN_GET_BITS 15 /* minimum allowable value */
+#else
+#define MIN_GET_BITS 25 /* max value for 32-bit get_buffer */
+#endif
+
+static const int bmask[16] = /* bmask[n] is mask for n rightmost bits */
+ { 0, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF,
+ 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF };
+
+
+LOCAL int
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fill_bit_buffer (int nbits)
+#else
+fill_bit_buffer (nbits)
+ int nbits;
+#endif /* NeedFunctionPrototypes */
+#else
+fill_bit_buffer (int nbits)
+#endif /* XIE_SUPPORTED */
+/* Load up the bit buffer and do get_bits(nbits) */
+{
+ /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
+ while (bits_left < MIN_GET_BITS) {
+ register int c = JGETC(dcinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(XIE_EOB);
+#endif /* XIE_SUPPORTED */
+
+ /* If it's 0xFF, check and discard stuffed zero byte */
+ if (c == 0xFF) {
+ int c2 = JGETC(dcinfo);
+#ifdef XIE_SUPPORTED
+ if (c2 < 0)
+ return(XIE_EOB);
+#endif /* XIE_SUPPORTED */
+ if (c2 != 0) {
+ /* Oops, it's actually a marker indicating end of compressed data. */
+ /* Better put it back for use later */
+ JUNGETC(c2,dcinfo);
+ JUNGETC(c,dcinfo);
+ /* There should be enough bits still left in the data segment; */
+ /* if so, just break out of the while loop. */
+ if (bits_left >= nbits)
+ break;
+ /* Uh-oh. Report corrupted data to user and stuff zeroes into
+ * the data stream, so we can produce some kind of image.
+ * Note that this will be repeated for each byte demanded for the
+ * rest of the segment; this is a bit slow but not unreasonably so.
+ * The main thing is to avoid getting a zillion warnings, hence:
+ */
+#ifndef XIE_SUPPORTED
+ if (! printed_eod) {
+ WARNMS(dcinfo->emethods, "Corrupt JPEG data: premature end of data segment");
+ printed_eod = TRUE;
+ }
+#endif /* XIE_SUPPORTED */
+ c = 0; /* insert a zero byte into bit buffer */
+ }
+ }
+
+ /* OK, load c into get_buffer */
+ get_buffer = (get_buffer << 8) | c;
+ bits_left += 8;
+ }
+
+ /* Having filled get_buffer, extract desired bits (this simplifies macros) */
+ bits_left -= nbits;
+ return ((int) (get_buffer >> bits_left)) & bmask[nbits];
+}
+
+
+/* Macros to make things go at some speed! */
+/* NB: parameter to get_bits should be simple variable, not expression */
+
+#define get_bits(nbits) \
+ (bits_left >= (nbits) ? \
+ ((int) (get_buffer >> (bits_left -= (nbits)))) & bmask[nbits] : \
+ fill_bit_buffer(nbits))
+
+#define get_bit() \
+ (bits_left ? \
+ ((int) (get_buffer >> (--bits_left))) & 1 : \
+ fill_bit_buffer(1))
+
+
+/* Figure F.16: extract next coded symbol from input stream */
+
+INLINE
+LOCAL int
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+huff_DECODE (HUFF_TBL * htbl)
+#else
+huff_DECODE (htbl)
+ HUFF_TBL * htbl;
+#endif /* NeedFunctionPrototypes */
+#else
+huff_DECODE (HUFF_TBL * htbl)
+#endif /* XIE_SUPPORTED */
+{
+ register int l;
+ register INT32 code;
+
+#ifdef XIE_SUPPORTED
+ register int j;
+
+ if ((code = get_bit()) == XIE_EOB)
+ return(XIE_EOB);
+ l = 1;
+ while (code > htbl->maxcode[l]) {
+ if ((j = get_bit()) == XIE_EOB)
+ return(XIE_EOB);
+ code = (code << 1) | j;
+ l++;
+ }
+#else
+ code = get_bit();
+ l = 1;
+ while (code > htbl->maxcode[l]) {
+ code = (code << 1) | get_bit();
+ l++;
+ }
+#endif /* XIE_SUPPORTED */
+
+ /* With garbage input we may reach the sentinel value l = 17. */
+
+ if (l > 16) {
+#ifndef XIE_SUPPORTED
+ WARNMS(dcinfo->emethods, "Corrupt JPEG data: bad Huffman code");
+#endif /* XIE_SUPPORTED */
+ return 0; /* fake a zero as the safest result */
+ }
+
+ return htbl->huffval[ htbl->valptr[l] + ((int) (code - htbl->mincode[l])) ];
+}
+
+
+/* Figure F.12: extend sign bit */
+
+#define huff_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
+
+static const int extend_test[16] = /* entry n is 2**(n-1) */
+ { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
+ 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
+
+static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
+ { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
+ ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
+ ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
+ ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+
+
+/*
+ * Initialize for a Huffman-compressed scan.
+ * This is invoked after reading the SOS marker.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+huff_decoder_init (decompress_info_ptr cinfo)
+#else
+huff_decoder_init (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+huff_decoder_init (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ short ci;
+ jpeg_component_info * compptr;
+
+ /* Initialize static variables */
+ dcinfo = cinfo;
+#ifdef XIE_SUPPORTED
+ bits_left = 0;
+ cinfo->XIEbits_left = bits_left;
+ get_buffer = 0;
+ cinfo->XIEget_buffer = get_buffer;
+ cinfo->printed_eod = FALSE;
+#else
+ bits_left = 0;
+ printed_eod = FALSE;
+#endif /* XIE_SUPPORTED */
+
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ /* Make sure requested tables are present */
+ if (cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no] == NULL ||
+ cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no] == NULL)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Use of undefined Huffman table");
+#endif /* XIE_SUPPORTED */
+ /* Compute derived values for Huffman tables */
+ /* We may do this more than once for same table, but it's not a big deal */
+ fix_huff_tbl(cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no]);
+ fix_huff_tbl(cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]);
+ /* Initialize DC predictions to 0 */
+ cinfo->last_dc_val[ci] = 0;
+ }
+
+ /* Initialize restart stuff */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+ cinfo->next_restart_num = 0;
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Check for a restart marker & resynchronize decoder.
+ */
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+process_restart (decompress_info_ptr cinfo)
+#else
+process_restart (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+process_restart (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ int c, nbytes;
+ short ci;
+
+ /* Throw away any unused bits remaining in bit buffer */
+ nbytes = bits_left / 8; /* count any full bytes loaded into buffer */
+ bits_left = 0;
+#ifdef XIE_SUPPORTED
+ cinfo->printed_eod = FALSE; /* next segment can get another warning */
+#else
+ printed_eod = FALSE; /* next segment can get another warning */
+#endif /* XIE_SUPPORTED */
+
+ /* Scan for next JPEG marker */
+ do {
+ do { /* skip any non-FF bytes */
+ nbytes++;
+ c = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(XIE_EOB);
+#endif /* XIE_SUPPORTED */
+ } while (c != 0xFF);
+ do { /* skip any duplicate FFs */
+ /* we don't increment nbytes here since extra FFs are legal */
+ c = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(XIE_EOB);
+#endif /* XIE_SUPPORTED */
+ } while (c == 0xFF);
+ } while (c == 0); /* repeat if it was a stuffed FF/00 */
+
+#ifndef XIE_SUPPORTED
+ if (nbytes != 1)
+ WARNMS2(cinfo->emethods,
+ "Corrupt JPEG data: %d extraneous bytes before marker 0x%02x",
+ nbytes-1, c);
+#endif /* XIE_SUPPORTED */
+
+ if (c != (RST0 + cinfo->next_restart_num)) {
+ /* Uh-oh, the restart markers have been messed up too. */
+ /* Let the file-format module try to figure out how to resync. */
+ (*cinfo->methods->resync_to_restart) (cinfo, c);
+#ifdef XIE_SUPPORTED
+ }
+#else
+ } else
+ TRACEMS1(cinfo->emethods, 2, "RST%d", cinfo->next_restart_num);
+#endif /* XIE_SUPPORTED */
+
+#ifndef XIE_SUPPORTED
+ /* Re-initialize DC predictions to 0 */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = 0;
+
+ /* Update restart state */
+ cinfo->restarts_to_go = cinfo->restart_interval;
+ cinfo->next_restart_num = (cinfo->next_restart_num + 1) & 7;
+#else
+ restarts_to_go = cinfo->restart_interval;
+ next_restart_num = (next_restart_num + 1) & 7;
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/* ZAG[i] is the natural-order position of the i'th element of zigzag order.
+ * If the incoming data is corrupted, huff_decode_mcu could attempt to
+ * reference values beyond the end of the array. To avoid a wild store,
+ * we put some extra zeroes after the real entries.
+ */
+
+static const short ZAG[DCTSIZE2+16] = {
+ 0, 1, 8, 16, 9, 2, 3, 10,
+ 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34,
+ 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36,
+ 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46,
+ 53, 60, 61, 54, 47, 55, 62, 63,
+ 0, 0, 0, 0, 0, 0, 0, 0, /* extra entries in case k>63 below */
+ 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+
+/*
+ * Decode and return one MCU's worth of Huffman-compressed coefficients.
+ * This routine also handles quantization descaling and zigzag reordering
+ * of coefficient values.
+ *
+ * The i'th block of the MCU is stored into the block pointed to by
+ * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER.
+ * (Wholesale zeroing is usually a little faster than retail...)
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+huff_decode_mcu (decompress_info_ptr cinfo, JBLOCKROW *MCU_data)
+#else
+huff_decode_mcu (cinfo, MCU_data)
+ decompress_info_ptr cinfo;
+ JBLOCKROW *MCU_data;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+huff_decode_mcu (decompress_info_ptr cinfo, JBLOCKROW *MCU_data)
+#endif /* XIE_SUPPORTED */
+{
+ register int s, k, r;
+ short blkn, ci;
+ register JBLOCKROW block;
+ register QUANT_TBL_PTR quanttbl;
+ HUFF_TBL *dctbl;
+ HUFF_TBL *actbl;
+ jpeg_component_info * compptr;
+
+#ifdef XIE_SUPPORTED
+ JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ last_dc_val[ci] = cinfo->last_dc_val[ci];
+
+ dcinfo = cinfo;
+ bits_left = cinfo->XIEbits_left;
+ get_buffer = cinfo->XIEget_buffer;
+ restarts_to_go = cinfo->restarts_to_go;
+ next_restart_num = cinfo->next_restart_num;
+#endif /* XIE_SUPPORTED */
+
+ /* Account for restart interval, process restart marker if needed */
+ if (cinfo->restart_interval) {
+ if (cinfo->restarts_to_go == 0)
+#ifdef XIE_SUPPORTED
+ {
+ s = process_restart(cinfo);
+ if (s == XIE_EOB)
+ return(XIE_EOB);
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ last_dc_val[ci] = 0;
+ }
+ restarts_to_go--;
+#else
+ process_restart(cinfo);
+ cinfo->restarts_to_go--;
+#endif /* XIE_SUPPORTED */
+ }
+
+ /* Outer loop handles each block in the MCU */
+
+ for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
+ block = MCU_data[blkn];
+ ci = cinfo->MCU_membership[blkn];
+ compptr = cinfo->cur_comp_info[ci];
+ quanttbl = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no];
+ actbl = cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no];
+ dctbl = cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no];
+
+ /* Decode a single block's worth of coefficients */
+
+ /* Section F.2.2.1: decode the DC coefficient difference */
+ s = huff_DECODE(dctbl);
+#ifdef XIE_SUPPORTED
+ if (s == XIE_EOB) {
+ return(XIE_EOB);
+ }
+#endif /* XIE_SUPPORTED */
+ if (s) {
+ r = get_bits(s);
+#ifdef XIE_SUPPORTED
+ if (r == XIE_EOB) {
+ return(XIE_EOB);
+ }
+#endif /* XIE_SUPPORTED */
+ s = huff_EXTEND(r, s);
+ }
+
+ /* Convert DC difference to actual value, update last_dc_val */
+#ifdef XIE_SUPPORTED
+ s += last_dc_val[ci];
+ last_dc_val[ci] = (JCOEF) s;
+#else
+ s += cinfo->last_dc_val[ci];
+ cinfo->last_dc_val[ci] = (JCOEF) s;
+#endif /* XIE_SUPPORTED */
+ /* Descale and output the DC coefficient (assumes ZAG[0] = 0) */
+ (*block)[0] = (JCOEF) (((JCOEF) s) * quanttbl[0]);
+
+ /* Section F.2.2.2: decode the AC coefficients */
+ /* Since zero values are skipped, output area must be zeroed beforehand */
+ for (k = 1; k < DCTSIZE2; k++) {
+ r = huff_DECODE(actbl);
+#ifdef XIE_SUPPORTED
+ if (r == XIE_EOB) {
+ return(XIE_EOB);
+ }
+#endif /* XIE_SUPPORTED */
+
+ s = r & 15;
+ r = r >> 4;
+
+ if (s) {
+ k += r;
+ r = get_bits(s);
+#ifdef XIE_SUPPORTED
+ if (r == XIE_EOB) {
+ return(XIE_EOB);
+ }
+#endif /* XIE_SUPPORTED */
+ s = huff_EXTEND(r, s);
+ /* Descale coefficient and output in natural (dezigzagged) order */
+ (*block)[ZAG[k]] = (JCOEF) (((JCOEF) s) * quanttbl[k]);
+ } else {
+ if (r != 15)
+ break;
+ k += 15;
+ }
+ }
+ }
+#ifdef XIE_SUPPORTED
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++)
+ cinfo->last_dc_val[ci] = last_dc_val[ci];
+ cinfo->XIEbits_left = bits_left;
+ cinfo->XIEget_buffer = get_buffer;
+ cinfo->restarts_to_go = restarts_to_go;
+ cinfo->next_restart_num = next_restart_num;
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Finish up at the end of a Huffman-compressed scan.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+huff_decoder_term (decompress_info_ptr cinfo)
+#else
+huff_decoder_term (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+huff_decoder_term (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* No work needed */
+}
+#endif /* XIE_SUPPORTED */
+
+/*
+ * The method selection routine for Huffman entropy decoding.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jseldhuffman (decompress_info_ptr cinfo)
+#else
+jseldhuffman (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jseldhuffman (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ if (! cinfo->arith_code) {
+ cinfo->methods->entropy_decode_init = huff_decoder_init;
+ cinfo->methods->entropy_decode = huff_decode_mcu;
+#ifndef XIE_SUPPORTED
+ cinfo->methods->entropy_decode_term = huff_decoder_term;
+#endif /* XIE_SUPPORTED */
+ }
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdlossy.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdlossy.c
new file mode 100644
index 000000000..3173e0681
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdlossy.c
@@ -0,0 +1,239 @@
+/* $TOG: jdlossy.c /main/5 1998/02/09 16:19:36 kaleb $ */
+/* Module jdlossy.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ jdlossy.c - decode JPEG images, Lossy method
+
+ this contain code for:
+
+ 1) JPEG Lossless, grayscale
+ 2) JPEG Lossless, color
+
+ Ben Fahy, AGE Logic, Oct 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+#include "jpeg.h"
+
+/**********************************************************************/
+decode_jpeg_lossy_gray(state)
+JpegDecodeState *state;
+{
+ return( decode_jpeg_lossy_color(state) );
+}
+/**********************************************************************/
+decode_jpeg_lossy_color(state)
+JpegDecodeState *state;
+{
+int status;
+
+/* our output buffer is guaranteed to be clean on entry. */
+/* (every time we write data below, we return to flush it) */
+ state->nl_found=0;
+ state->nl_flushed=0;
+
+ while(1) { /* loop forever (we're a state machine) */
+
+ switch( state->goal) {
+ case JPEG_DECODE_GOAL_Startup:
+ state->goal = JPEG_DECODE_GOAL_ReadDataForInit;
+
+ case JPEG_DECODE_GOAL_ReadDataForInit:
+ /* we start up by reading data into our buffer and calling INIT */
+ status = fill_jpeg_decode_buffer(state);
+ switch(status) {
+ case JPEG_BUFFER_LastBuffer:
+ break;
+
+ case JPEG_BUFFER_BufferFilled:
+ /* all is coolness */
+ break;
+
+ case JPEG_BUFFER_NeedAnotherStrip:
+ state->needs_input_strip = 1;
+ return(state->nl_found);
+ break;
+
+ case JPEG_BUFFER_BufferError:
+ default:
+ state->error_code = JPEG_DECODE_ERROR_CouldNotStart;
+ return(-1);
+ }
+
+ /* if here, we should have a nice full input buffer */
+
+ case JPEG_DECODE_GOAL_TryToInit:
+ status = JD_INIT(state->cinfo,
+ state->dc_methods,
+ state->e_methods,
+ state->up_sample);
+ if (status == XIE_ERR) {
+ state->error_code = JPEG_DECODE_ERROR_CouldNotInit;
+ return(-1);
+ }
+ if (status == XIE_NRML) {
+ state->goal = JPEG_DECODE_GOAL_InitDone;
+ break;
+ }
+ if (status == XIE_INP) {
+ state->goal = JPEG_DECODE_GOAL_ReadDataForInit;
+ break;
+ }
+ /* hey! we aren't supposed to be here */
+ state->error_code = JPEG_DECODE_ERROR_BadInitRetCode;
+ return(-1);
+ break;
+
+ case JPEG_DECODE_GOAL_InitDone:
+
+ /* now we know enough to allocate our output buffer */
+ state->cinfo->output_workspace =
+ alloc_sampimage(state->cinfo,
+ (int) state->cinfo->comps_in_scan,
+ (long) state->cinfo->rows_in_mem,
+ state->cinfo->image_width
+ );
+ if (state->cinfo->output_workspace == NULL) {
+ state->error_code = JPEG_DECODE_ERROR_BadOutputAlloc;
+ return(-1);
+ }
+ state->goal = JPEG_DECODE_GOAL_ProcessData;
+
+ case JPEG_DECODE_GOAL_ProcessData:
+ status = JD_PROCESS(state->cinfo);
+
+ if (status == XIE_INP) {
+ state->goal = JPEG_DECODE_GOAL_ReadDataForProcess;
+ break;
+ }
+ if (status == XIE_OUT) {
+ state->goal = JPEG_DECODE_GOAL_WriteDataForProcess;
+ break;
+ }
+ if (status == XIE_EOI) {
+ state->goal = JPEG_DECODE_GOAL_EndOfInput;
+ break;
+ }
+ if (status == XIE_NRML)
+ break;
+
+ if (status == XIE_ERR) {
+ state->error_code = JPEG_DECODE_ERROR_DecodeError;
+ return(-1);
+ }
+ else {
+ /* unexpected return status */
+ state->error_code = JPEG_DECODE_ERROR_DecoderIsFreakingOut;
+ return(-1);
+ }
+ break;
+
+ case JPEG_DECODE_GOAL_ReadDataForProcess:
+ status = fill_jpeg_decode_buffer(state);
+ switch(status) {
+ case JPEG_BUFFER_LastBuffer:
+ break;
+
+ case JPEG_BUFFER_BufferFilled:
+ /* all is coolness */
+ break;
+
+ case JPEG_BUFFER_NeedAnotherStrip:
+ state->needs_input_strip = 1;
+ return(state->nl_found);
+ break;
+
+ case JPEG_BUFFER_BufferError:
+ default:
+ state->error_code = JPEG_DECODE_ERROR_NoMoreProcessData;
+ return(-1);
+ }
+ state->goal = JPEG_DECODE_GOAL_ProcessData;
+ break;
+
+ case JPEG_DECODE_GOAL_EndOfInput:
+ state->goal = JPEG_DECODE_GOAL_Done;
+ state->nl_found = (state->cinfo->image_height -
+ state->cinfo->pixel_rows_output);
+ /* see jdXIE_get() if this seems *too* self-serving */
+
+ /* leave for good */
+ return(state->nl_found);
+ break;
+
+ case JPEG_DECODE_GOAL_WriteDataForProcess:
+ state->goal = JPEG_DECODE_GOAL_ProcessData;
+ state->cinfo->pixel_rows_output += state->cinfo->rows_in_mem;
+ state->nl_found = state->cinfo->rows_in_mem;
+ /* leave to flush data */
+ return(state->nl_found);
+ break;
+
+ default:
+ state->error_code = JPEG_DECODE_ERROR_BadGoal;
+ return(-1);
+ }
+ }
+}
+/**********************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdmcu.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdmcu.c
new file mode 100644
index 000000000..beabf2494
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdmcu.c
@@ -0,0 +1,428 @@
+/* $TOG: jdmcu.c /main/5 1998/02/09 16:19:40 kaleb $ */
+/* Module jdmcu.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jdmcu.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains MCU disassembly and IDCT control routines.
+ * These routines are invoked via the disassemble_MCU, reverse_DCT, and
+ * disassemble_init/term methods.
+ */
+
+#include "jinclude.h"
+
+
+/*
+ * Fetch one MCU row from entropy_decode, build coefficient array.
+ * This version is used for noninterleaved (single-component) scans.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+disassemble_noninterleaved_MCU (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data)
+#else
+disassemble_noninterleaved_MCU (cinfo, image_data)
+ decompress_info_ptr cinfo;
+ JBLOCKIMAGE image_data;
+#endif /* NeedFunctionPrototypes */
+{
+ long mcuindex;
+ long start;
+
+ /* this is pretty easy since there is one component and one block per MCU */
+
+ if (cinfo->XIErestart == XIE_RMCU) {
+ start = cinfo->XIEmcuindex;
+ cinfo->XIErestart = XIE_RNUL;
+ } else {
+ start = 0;
+ /* Pre-zero the target area to speed up entropy decoder */
+ /* (we assume wholesale zeroing is faster than retail) */
+ jzero_far((pointer) image_data[0][0],
+ (size_t) (cinfo->MCUs_per_row * SIZEOF(JBLOCK)));
+ }
+ for (mcuindex = start; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Point to the proper spot in the image array for this MCU */
+ cinfo->MCU_data[0] = image_data[0][0] + mcuindex;
+ /* Fetch the coefficient data */
+ /* Save the current input buffer position (for restart) */
+ cinfo->XIEnext_input_byte = cinfo->next_input_byte;
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ if (((*cinfo->methods->entropy_decode) (cinfo, cinfo->MCU_data)) < 0) {
+ cinfo->XIErestart = XIE_RMCU;
+ cinfo->XIEmcuindex = mcuindex;
+ cinfo->next_input_byte = cinfo->XIEnext_input_byte;
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ return(-1);
+ }
+ }
+ return(0);
+}
+#else
+METHODDEF void
+disassemble_noninterleaved_MCU (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data)
+{
+ JBLOCKROW MCU_data[1];
+ long mcuindex;
+
+ /* this is pretty easy since there is one component and one block per MCU */
+
+ /* Pre-zero the target area to speed up entropy decoder */
+ /* (we assume wholesale zeroing is faster than retail) */
+ jzero_far((pointer) image_data[0][0],
+ (size_t) (cinfo->MCUs_per_row * SIZEOF(JBLOCK)));
+
+ for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Point to the proper spot in the image array for this MCU */
+ MCU_data[0] = image_data[0][0] + mcuindex;
+ /* Fetch the coefficient data */
+ (*cinfo->methods->entropy_decode) (cinfo, MCU_data);
+ }
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Fetch one MCU row from entropy_decode, build coefficient array.
+ * This version is used for interleaved (multi-component) scans.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+disassemble_interleaved_MCU (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data)
+#else
+disassemble_interleaved_MCU (cinfo, image_data)
+ decompress_info_ptr cinfo;
+ JBLOCKIMAGE image_data;
+#endif /* NeedFunctionPrototypes */
+{
+ long mcuindex;
+ long start;
+ short blkn, ci, xpos, ypos;
+ jpeg_component_info * compptr;
+ JBLOCKROW image_ptr;
+
+ /* Pre-zero the target area to speed up entropy decoder */
+ /* (we assume wholesale zeroing is faster than retail) */
+ if (cinfo->XIErestart == XIE_RMCU) {
+ start = cinfo->XIEmcuindex;
+ cinfo->XIErestart = XIE_RNUL;
+ } else {
+ start = 0;
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ jzero_far((pointer) image_data[ci][ypos],
+ (size_t) (cinfo->MCUs_per_row * compptr->MCU_width * SIZEOF(JBLOCK)));
+ }
+ }
+ }
+
+ for (mcuindex = start; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Point to the proper spots in the image array for this MCU */
+ blkn = 0;
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ image_ptr = image_data[ci][ypos] + (mcuindex * compptr->MCU_width);
+ for (xpos = 0; xpos < compptr->MCU_width; xpos++) {
+ cinfo->MCU_data[blkn] = image_ptr;
+ image_ptr++;
+ blkn++;
+ }
+ }
+ }
+ /* Fetch the coefficient data */
+ /* Save the current input buffer position (for restart) */
+ cinfo->XIEnext_input_byte = cinfo->next_input_byte;
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ if (((*cinfo->methods->entropy_decode) (cinfo, cinfo->MCU_data)) < 0) {
+ cinfo->XIErestart = XIE_RMCU;
+ cinfo->XIEmcuindex = mcuindex;
+ cinfo->next_input_byte = cinfo->XIEnext_input_byte;
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ return(-1);
+ }
+ }
+ return(0);
+}
+#else
+METHODDEF void
+disassemble_interleaved_MCU (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data)
+{
+ JBLOCKROW MCU_data[MAX_BLOCKS_IN_MCU];
+ long mcuindex;
+ short blkn, ci, xpos, ypos;
+ jpeg_component_info * compptr;
+ JBLOCKROW image_ptr;
+
+ /* Pre-zero the target area to speed up entropy decoder */
+ /* (we assume wholesale zeroing is faster than retail) */
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ jzero_far((pointer) image_data[ci][ypos],
+ (size_t) (cinfo->MCUs_per_row * compptr->MCU_width * SIZEOF(JBLOCK)));
+ }
+ }
+
+ for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
+ /* Point to the proper spots in the image array for this MCU */
+ blkn = 0;
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
+ image_ptr = image_data[ci][ypos] + (mcuindex * compptr->MCU_width);
+ for (xpos = 0; xpos < compptr->MCU_width; xpos++) {
+ MCU_data[blkn] = image_ptr;
+ image_ptr++;
+ blkn++;
+ }
+ }
+ }
+ /* Fetch the coefficient data */
+ (*cinfo->methods->entropy_decode) (cinfo, MCU_data);
+ }
+}
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Perform inverse DCT on each block in an MCU row's worth of data;
+ * output the results into a sample array starting at row start_row.
+ * NB: start_row can only be nonzero when dealing with a single-component
+ * scan; otherwise we'd have to pass different offsets for different
+ * components, since the heights of interleaved MCU rows can vary.
+ * But the pipeline controller logic is such that this is not necessary.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+reverse_DCT (decompress_info_ptr cinfo,
+ JBLOCKIMAGE coeff_data, JSAMPIMAGE output_data, int start_row)
+#else
+reverse_DCT (cinfo, coeff_data, output_data, start_row)
+ decompress_info_ptr cinfo;
+ JBLOCKIMAGE coeff_data;
+ JSAMPIMAGE output_data;
+ int start_row;
+#endif /* NeedFunctionPrototypes */
+#else
+reverse_DCT (decompress_info_ptr cinfo,
+ JBLOCKIMAGE coeff_data, JSAMPIMAGE output_data, int start_row)
+#endif /* XIE_SUPPORTED */
+{
+ DCTBLOCK block;
+ JBLOCKROW browptr;
+ JSAMPARRAY srowptr;
+ long blocksperrow, bi;
+ short numrows, ri;
+ short ci;
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ /* calculate size of an MCU row in this component */
+ blocksperrow = cinfo->cur_comp_info[ci]->downsampled_width / DCTSIZE;
+ numrows = cinfo->cur_comp_info[ci]->MCU_height;
+ /* iterate through all blocks in MCU row */
+ for (ri = 0; ri < numrows; ri++) {
+ browptr = coeff_data[ci][ri];
+ srowptr = output_data[ci] + (ri * DCTSIZE + start_row);
+ for (bi = 0; bi < blocksperrow; bi++) {
+ /* copy the data into a local DCTBLOCK. This allows for change of
+ * representation (if DCTELEM != JCOEF). On 80x86 machines it also
+ * brings the data back from FAR storage to NEAR storage.
+ */
+ { register JCOEFPTR elemptr = browptr[bi];
+ register DCTELEM *localblkptr = block;
+ register int elem = DCTSIZE2;
+
+ while (--elem >= 0)
+ *localblkptr++ = (DCTELEM) *elemptr++;
+ }
+
+ j_rev_dct(block); /* perform inverse DCT */
+
+ /* Output the data into the sample array.
+ * Note change from signed to unsigned representation:
+ * DCT calculation works with values +-CENTERJSAMPLE,
+ * but sample arrays always hold 0..MAXJSAMPLE.
+ * We have to do range-limiting because of quantization errors in the
+ * DCT/IDCT phase. We use the sample_range_limit[] table to do this
+ * quickly; the CENTERJSAMPLE offset is folded into table indexing.
+ */
+ { register JSAMPROW elemptr;
+ register DCTELEM *localblkptr = block;
+ register JSAMPLE *range_limit = cinfo->sample_range_limit +
+ CENTERJSAMPLE;
+#if DCTSIZE != 8
+ register int elemc;
+#endif
+ register int elemr;
+
+ for (elemr = 0; elemr < DCTSIZE; elemr++) {
+ elemptr = srowptr[elemr] + (bi * DCTSIZE);
+#if DCTSIZE == 8 /* unroll the inner loop */
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+ *elemptr++ = range_limit[*localblkptr++];
+#else
+ for (elemc = DCTSIZE; elemc > 0; elemc--) {
+ *elemptr++ = range_limit[*localblkptr++];
+ }
+#endif
+ }
+ }
+ }
+ }
+ }
+}
+
+
+/*
+ * Initialize for processing a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+disassemble_init (decompress_info_ptr cinfo)
+#else
+disassemble_init (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+disassemble_init (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+
+
+/*
+ * Clean up after a scan.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+disassemble_term (decompress_info_ptr cinfo)
+#else
+disassemble_term (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+disassemble_term (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * The method selection routine for MCU disassembly.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jseldmcu (decompress_info_ptr cinfo)
+#else
+jseldmcu (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jseldmcu (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ if (cinfo->comps_in_scan == 1)
+ cinfo->methods->disassemble_MCU = disassemble_noninterleaved_MCU;
+ else
+ cinfo->methods->disassemble_MCU = disassemble_interleaved_MCU;
+ cinfo->methods->reverse_DCT = reverse_DCT;
+ cinfo->methods->disassemble_init = disassemble_init;
+#ifndef XIE_SUPPORTED
+ cinfo->methods->disassemble_term = disassemble_term;
+#endif /* XIE_SUPPORTED */
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdsample.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdsample.c
new file mode 100644
index 000000000..67ddfdf3f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdsample.c
@@ -0,0 +1,505 @@
+/* $TOG: jdsample.c /main/5 1998/02/09 16:19:45 kaleb $ */
+/* Module jdsample.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jdsample.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains upsampling routines.
+ * These routines are invoked via the upsample and
+ * upsample_init/term methods.
+ *
+ * An excellent reference for image resampling is
+ * Digital Image Warping, George Wolberg, 1990.
+ * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
+ */
+
+#include "jinclude.h"
+
+
+/*
+ * Initialize for upsampling a scan.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+upsample_init (decompress_info_ptr cinfo)
+#else
+upsample_init (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+upsample_init (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+
+
+/*
+ * Upsample pixel values of a single component.
+ * This version handles any integral sampling ratios.
+ *
+ * This is not used for typical JPEG files, so it need not be fast.
+ * Nor, for that matter, is it particularly accurate: the algorithm is
+ * simple replication of the input pixel onto the corresponding output
+ * pixels. The hi-falutin sampling literature refers to this as a
+ * "box filter". A box filter tends to introduce visible artifacts,
+ * so if you are actually going to use 3:1 or 4:1 sampling ratios
+ * you would be well advised to improve this code.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+int_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+int_upsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ decompress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+int_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ register JSAMPROW inptr, outptr;
+ register JSAMPLE invalue;
+ register short h_expand, h;
+ short v_expand, v;
+ int inrow, outrow;
+ register long incol;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ if (input_rows != compptr->v_samp_factor ||
+ output_rows != cinfo->max_v_samp_factor ||
+ (input_cols % compptr->h_samp_factor) != 0 ||
+ (output_cols % cinfo->max_h_samp_factor) != 0 ||
+ output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus upsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
+ v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
+
+ outrow = 0;
+ for (inrow = 0; inrow < input_rows; inrow++) {
+ for (v = 0; v < v_expand; v++) {
+ inptr = input_data[inrow];
+ outptr = output_data[outrow++];
+ for (incol = 0; incol < input_cols; incol++) {
+ invalue = GETJSAMPLE(*inptr++);
+ for (h = 0; h < h_expand; h++) {
+ *outptr++ = invalue;
+ }
+ }
+ }
+ }
+}
+
+
+/*
+ * Upsample pixel values of a single component.
+ * This version handles the common case of 2:1 horizontal and 1:1 vertical.
+ *
+ * The upsampling algorithm is linear interpolation between pixel centers,
+ * also known as a "triangle filter". This is a good compromise between
+ * speed and visual quality. The centers of the output pixels are 1/4 and 3/4
+ * of the way between input pixel centers.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+h2v1_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+h2v1_upsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ decompress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+h2v1_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ register JSAMPROW inptr, outptr;
+ register int invalue;
+ int inrow;
+ register long colctr;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ if (input_rows != compptr->v_samp_factor ||
+ output_rows != cinfo->max_v_samp_factor ||
+ (input_cols % compptr->h_samp_factor) != 0 ||
+ (output_cols % cinfo->max_h_samp_factor) != 0 ||
+ output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus upsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ for (inrow = 0; inrow < input_rows; inrow++) {
+ inptr = input_data[inrow];
+ outptr = output_data[inrow];
+ /* Special case for first column */
+ invalue = GETJSAMPLE(*inptr++);
+ *outptr++ = (JSAMPLE) invalue;
+ *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
+
+ for (colctr = input_cols - 2; colctr > 0; colctr--) {
+ /* General case: 3/4 * nearer pixel + 1/4 * further pixel */
+ invalue = GETJSAMPLE(*inptr++) * 3;
+ *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 2) >> 2);
+ *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
+ }
+
+ /* Special case for last column */
+ invalue = GETJSAMPLE(*inptr);
+ *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 2) >> 2);
+ *outptr++ = (JSAMPLE) invalue;
+ }
+}
+
+
+/*
+ * Upsample pixel values of a single component.
+ * This version handles the common case of 2:1 horizontal and 2:1 vertical.
+ *
+ * The upsampling algorithm is linear interpolation between pixel centers,
+ * also known as a "triangle filter". This is a good compromise between
+ * speed and visual quality. The centers of the output pixels are 1/4 and 3/4
+ * of the way between input pixel centers.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+h2v2_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+h2v2_upsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ decompress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+h2v2_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+ register JSAMPROW inptr0, inptr1, outptr;
+#ifdef EIGHT_BIT_SAMPLES
+ register int thiscolsum, lastcolsum, nextcolsum;
+#else
+ register INT32 thiscolsum, lastcolsum, nextcolsum;
+#endif
+ int inrow, outrow, v;
+ register long colctr;
+
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ jpeg_component_info * compptr = cinfo->cur_comp_info[which_component];
+ if (input_rows != compptr->v_samp_factor ||
+ output_rows != cinfo->max_v_samp_factor ||
+ (input_cols % compptr->h_samp_factor) != 0 ||
+ (output_cols % cinfo->max_h_samp_factor) != 0 ||
+ output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor)
+ ERREXIT(cinfo->emethods, "Bogus upsample parameters");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ outrow = 0;
+ for (inrow = 0; inrow < input_rows; inrow++) {
+ for (v = 0; v < 2; v++) {
+ /* inptr0 points to nearest input row, inptr1 points to next nearest */
+ inptr0 = input_data[inrow];
+ if (v == 0) { /* next nearest is row above */
+ if (inrow == 0)
+ inptr1 = above[input_rows-1];
+ else
+ inptr1 = input_data[inrow-1];
+ } else { /* next nearest is row below */
+ if (inrow == input_rows-1)
+ inptr1 = below[0];
+ else
+ inptr1 = input_data[inrow+1];
+ }
+ outptr = output_data[outrow++];
+
+ /* Special case for first column */
+ thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+ nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+ *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
+ *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 8) >> 4);
+ lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+
+ for (colctr = input_cols - 2; colctr > 0; colctr--) {
+ /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
+ /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
+ nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
+ *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
+ *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 8) >> 4);
+ lastcolsum = thiscolsum; thiscolsum = nextcolsum;
+ }
+
+ /* Special case for last column */
+ *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
+ *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
+ }
+ }
+}
+
+
+/*
+ * Upsample pixel values of a single component.
+ * This version handles the special case of a full-size component.
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+fullsize_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#else
+fullsize_upsample (cinfo, which_component,
+ input_cols, input_rows,
+ output_cols, output_rows,
+ above, input_data, below,
+ output_data)
+ decompress_info_ptr cinfo;
+ int which_component;
+ long input_cols;
+ int input_rows;
+ long output_cols;
+ int output_rows;
+ JSAMPARRAY above;
+ JSAMPARRAY input_data;
+ JSAMPARRAY below;
+ JSAMPARRAY output_data;
+#endif /* NeedFunctionPrototypes */
+#else
+fullsize_upsample (decompress_info_ptr cinfo, int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below,
+ JSAMPARRAY output_data)
+#endif /* XIE_SUPPORTED */
+{
+#ifndef XIE_SUPPORTED
+#ifdef DEBUG /* for debugging pipeline controller */
+ if (input_cols != output_cols || input_rows != output_rows)
+ ERREXIT(cinfo->emethods, "Pipeline controller messed up");
+#endif
+#endif /* XIE_SUPPORTED */
+
+ jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols);
+}
+
+
+
+/*
+ * Clean up after a scan.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+upsample_term (decompress_info_ptr cinfo)
+#else
+upsample_term (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+upsample_term (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work for now */
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * The method selection routine for upsampling.
+ * Note that we must select a routine for each component.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselupsample (decompress_info_ptr cinfo)
+#else
+jselupsample (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselupsample (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ short ci;
+ jpeg_component_info * compptr;
+
+#ifndef XIE_SUPPORTED
+ if (cinfo->CCIR601_sampling)
+ ERREXIT(cinfo->emethods, "CCIR601 upsampling not implemented yet");
+#endif /* XIE_SUPPORTED */
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor == cinfo->max_v_samp_factor)
+ cinfo->methods->upsample[ci] = fullsize_upsample;
+ else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor == cinfo->max_v_samp_factor)
+ cinfo->methods->upsample[ci] = h2v1_upsample;
+ else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
+ compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor)
+ cinfo->methods->upsample[ci] = h2v2_upsample;
+ else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
+ (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0)
+ cinfo->methods->upsample[ci] = int_upsample;
+ else
+#ifdef XIE_SUPPORTED
+ {}
+#else
+ ERREXIT(cinfo->emethods, "Fractional upsampling not implemented yet");
+#endif /* XIE_SUPPORTED */
+ }
+
+ cinfo->methods->upsample_init = upsample_init;
+#ifndef XIE_SUPPORTED
+ cinfo->methods->upsample_term = upsample_term;
+#endif /* XIE_SUPPORTED */
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdxie.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdxie.c
new file mode 100644
index 000000000..698973629
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdxie.c
@@ -0,0 +1,897 @@
+/* $TOG: jdxie.c /main/5 1998/02/09 16:19:54 kaleb $ */
+/* Module jdxie.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * Copyright (C) 1992, Thomas G. Lane.
+ * This file was derived in part from the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+METHODDEF void
+#if NeedFunctionPrototypes
+d_ui_method_selection (decompress_info_ptr cinfo)
+#else
+d_ui_method_selection (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* if grayscale or CMYK input, force similar output; */
+ /* else leave the output colorspace as set by options. */
+ if (cinfo->jpeg_color_space == CS_GRAYSCALE)
+ cinfo->out_color_space = CS_GRAYSCALE;
+ else if (cinfo->jpeg_color_space == CS_CMYK)
+ cinfo->out_color_space = CS_CMYK;
+}
+
+/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
+ * and coefficient-block arrays. This won't work on 80x86 because the arrays
+ * are FAR and we're assuming a small-pointer memory model. However, some
+ * DOS compilers provide far-pointer versions of memcpy() and memset() even
+ * in the small-model libraries. These will be used if USE_FMEM is defined.
+ * Otherwise, the routines below do it the hard way. (The performance cost
+ * is not all that great, because these routines aren't very heavily used.)
+ */
+
+#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
+#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
+#define FMEMZERO(target,size) MEMZERO(target,size)
+#else /* 80x86 case, define if we can */
+#ifdef USE_FMEM
+#define FMEMCOPY(dest,src,size) _fmemcpy((pointer*)(dest), (const pointer*)(src), (size_t)(size))
+#define FMEMZERO(target,size) _fmemset((pointer*)(target), 0, (size_t)(size))
+#endif
+#endif
+
+METHODDEF void
+#if NeedFunctionPrototypes
+d_per_scan_method_selection (decompress_info_ptr cinfo)
+#else
+d_per_scan_method_selection (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Central point for per-scan method selection */
+{
+ /* MCU disassembly */
+ jseldmcu(cinfo);
+ if (cinfo->XIE_upsample)
+ /* Upsampling of pixels */
+ jselupsample(cinfo);
+}
+
+
+LOCAL void
+#if NeedFunctionPrototypes
+d_initial_method_selection (decompress_info_ptr cinfo)
+#else
+d_initial_method_selection (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Central point for initial method selection (after reading file header) */
+{
+ /* JPEG file scanning method selection is already done. */
+ /* So is output file format selection (both are done by user interface). */
+
+ /* Entropy decoding: Huffman coding. */
+ jseldhuffman(cinfo);
+ cinfo->do_block_smoothing = FALSE;
+
+ /* Overall control (that's me!) */
+ cinfo->methods->d_per_scan_method_selection = d_per_scan_method_selection;
+}
+
+
+LOCAL int
+#if NeedFunctionPrototypes
+initial_setup (decompress_info_ptr cinfo)
+#else
+initial_setup (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Do computations that are needed before initial method selection */
+{
+ short ci;
+ jpeg_component_info *compptr;
+
+ /* Compute maximum sampling factors; check factor validity */
+ cinfo->max_h_samp_factor = 1;
+ cinfo->max_v_samp_factor = 1;
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = &cinfo->comp_info[ci];
+ if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
+ compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
+ /* ERREXIT(cinfo->emethods, "Bogus sampling factors"); */
+ return(XIE_ERR);
+ cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
+ compptr->h_samp_factor);
+ cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
+ compptr->v_samp_factor);
+ }
+
+ /* Compute logical downsampled dimensions of components */
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = &cinfo->comp_info[ci];
+ compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor
+ + cinfo->max_h_samp_factor - 1)
+ / cinfo->max_h_samp_factor;
+ compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor
+ + cinfo->max_v_samp_factor - 1)
+ / cinfo->max_v_samp_factor;
+ }
+ return(0);
+}
+
+
+/*
+ * About the data structures:
+ *
+ * The processing chunk size for upsampling is referred to in this file as
+ * a "row group": a row group is defined as Vk (v_samp_factor) sample rows of
+ * any component while downsampled, or Vmax (max_v_samp_factor) unsubsampled
+ * rows. In an interleaved scan each MCU row contains exactly DCTSIZE row
+ * groups of each component in the scan. In a noninterleaved scan an MCU row
+ * is one row of blocks, which might not be an integral number of row groups;
+ * therefore, we read in Vk MCU rows to obtain the same amount of data as we'd
+ * have in an interleaved scan.
+ * To provide context for the upsampling step, we have to retain the last
+ * two row groups of the previous MCU row while reading in the next MCU row
+ * (or set of Vk MCU rows). To do this without copying data about, we create
+ * a rather strange data structure. Exactly DCTSIZE+2 row groups of samples
+ * are allocated, but we create two different sets of pointers to this array.
+ * The second set swaps the last two pairs of row groups. By working
+ * alternately with the two sets of pointers, we can access the data in the
+ * desired order.
+ *
+ * Cross-block smoothing also needs context above and below the "current" row.
+ * Since this is an optional feature, I've implemented it in a way that is
+ * much simpler but requires more than the minimum amount of memory. We
+ * simply allocate three extra MCU rows worth of coefficient blocks and use
+ * them to "read ahead" one MCU row in the file. For a typical 1000-pixel-wide
+ * image with 2x2,1x1,1x1 sampling, each MCU row is about 50Kb; an 80x86
+ * machine may be unable to apply cross-block smoothing to wider images.
+ */
+
+
+/*
+ * Utility routines: common code for pipeline controller
+ */
+
+LOCAL int
+#if NeedFunctionPrototypes
+interleaved_scan_setup (decompress_info_ptr cinfo)
+#else
+interleaved_scan_setup (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Compute all derived info for an interleaved (multi-component) scan */
+/* On entry, cinfo->comps_in_scan and cinfo->cur_comp_info[] are set up */
+{
+ short ci, mcublks;
+ jpeg_component_info *compptr;
+
+ if (cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
+ /* ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); */
+ return(XIE_ERR);
+
+ cinfo->MCUs_per_row = (cinfo->image_width
+ + cinfo->max_h_samp_factor*DCTSIZE - 1)
+ / (cinfo->max_h_samp_factor*DCTSIZE);
+
+ cinfo->MCU_rows_in_scan = (cinfo->image_height
+ + cinfo->max_v_samp_factor*DCTSIZE - 1)
+ / (cinfo->max_v_samp_factor*DCTSIZE);
+
+ cinfo->blocks_in_MCU = 0;
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ /* for interleaved scan, sampling factors give # of blocks per component */
+ compptr->MCU_width = compptr->h_samp_factor;
+ compptr->MCU_height = compptr->v_samp_factor;
+ compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
+ /* compute physical dimensions of component */
+ compptr->downsampled_width = jround_up(compptr->true_comp_width,
+ (long) (compptr->MCU_width*DCTSIZE));
+ compptr->downsampled_height = jround_up(compptr->true_comp_height,
+ (long) (compptr->MCU_height*DCTSIZE));
+ /* Sanity check */
+ if (compptr->downsampled_width !=
+ (cinfo->MCUs_per_row * (compptr->MCU_width*DCTSIZE)))
+ /* ERREXIT(cinfo->emethods, "I'm confused about the image width"); */
+ return(XIE_ERR);
+ /* Prepare array describing MCU composition */
+ mcublks = compptr->MCU_blocks;
+ if (cinfo->blocks_in_MCU + mcublks > MAX_BLOCKS_IN_MCU)
+ /* ERREXIT(cinfo->emethods, "Sampling factors too large for interleaved scan"); */
+ return(XIE_ERR);
+ while (mcublks-- > 0) {
+ cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
+ }
+ }
+
+ (*cinfo->methods->d_per_scan_method_selection) (cinfo);
+ return(0);
+}
+
+
+LOCAL void
+#if NeedFunctionPrototypes
+noninterleaved_scan_setup (decompress_info_ptr cinfo)
+#else
+noninterleaved_scan_setup (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Compute all derived info for a noninterleaved (single-component) scan */
+/* On entry, cinfo->comps_in_scan = 1 and cinfo->cur_comp_info[0] is set up */
+{
+ jpeg_component_info *compptr = cinfo->cur_comp_info[0];
+
+ /* for noninterleaved scan, always one block per MCU */
+ compptr->MCU_width = 1;
+ compptr->MCU_height = 1;
+ compptr->MCU_blocks = 1;
+ /* compute physical dimensions of component */
+ compptr->downsampled_width = jround_up(compptr->true_comp_width,
+ (long) DCTSIZE);
+ compptr->downsampled_height = jround_up(compptr->true_comp_height,
+ (long) DCTSIZE);
+
+ cinfo->MCUs_per_row = compptr->downsampled_width / DCTSIZE;
+ cinfo->MCU_rows_in_scan = compptr->downsampled_height / DCTSIZE;
+
+ /* Prepare array describing MCU composition */
+ cinfo->blocks_in_MCU = 1;
+ cinfo->MCU_membership[0] = 0;
+
+ (*cinfo->methods->d_per_scan_method_selection) (cinfo);
+}
+
+GLOBAL JSAMPIMAGE
+#if NeedFunctionPrototypes
+alloc_sampimage (decompress_info_ptr cinfo,
+ int num_comps, long num_rows, long num_cols)
+#else
+alloc_sampimage (cinfo, num_comps, num_rows, num_cols)
+ decompress_info_ptr cinfo;
+ int num_comps;
+ long num_rows;
+ long num_cols;
+#endif /* NeedFunctionPrototypes */
+/* Allocate an in-memory sample image (all components same size) */
+{
+ JSAMPIMAGE image;
+ int ci;
+
+ image = (JSAMPIMAGE) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (num_comps * SIZEOF(JSAMPARRAY)));
+ if (image == (JSAMPIMAGE) NULL)
+ return((JSAMPIMAGE) NULL);
+ for (ci = 0; ci < num_comps; ci++) {
+ image[ci] = (*cinfo->emethods->d_alloc_small_sarray)
+ (cinfo, num_cols, num_rows);
+ if (image[ci] == NULL)
+ return((JSAMPIMAGE) NULL);
+ }
+ return image;
+}
+
+LOCAL JBLOCKIMAGE
+#if NeedFunctionPrototypes
+alloc_MCU_row (decompress_info_ptr cinfo)
+#else
+alloc_MCU_row (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Allocate one MCU row's worth of coefficient blocks */
+{
+ JBLOCKIMAGE image;
+ int ci;
+
+ image = (JBLOCKIMAGE) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (cinfo->comps_in_scan * SIZEOF(JBLOCKARRAY)));
+ if (image == (JBLOCKIMAGE) NULL)
+ return((JBLOCKIMAGE) NULL);
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ image[ci] = (*cinfo->emethods->d_alloc_small_barray)
+ (cinfo, cinfo->cur_comp_info[ci]->downsampled_width / DCTSIZE,
+ (long) cinfo->cur_comp_info[ci]->MCU_height);
+ if (image[ci] == NULL)
+ return((JBLOCKIMAGE) NULL);
+ }
+ return image;
+}
+
+LOCAL int
+#if NeedFunctionPrototypes
+alloc_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE sampled_data[2])
+#else
+alloc_sampling_buffer (cinfo, sampled_data)
+ decompress_info_ptr cinfo;
+ JSAMPIMAGE sampled_data[2];
+#endif /* NeedFunctionPrototypes */
+/* Create a downsampled-data buffer having the desired structure */
+/* (see comments at head of file) */
+{
+ short ci, vs, i;
+
+ /* Get top-level space for array pointers */
+ sampled_data[0] = (JSAMPIMAGE) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (cinfo->comps_in_scan * SIZEOF(JSAMPARRAY)));
+ if (cinfo->sampled_data[0] == (JSAMPIMAGE) NULL)
+ return(XIE_ERR);
+ sampled_data[1] = (JSAMPIMAGE) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (cinfo->comps_in_scan * SIZEOF(JSAMPARRAY)));
+ if (cinfo->sampled_data[1] == (JSAMPIMAGE) NULL)
+ return(XIE_ERR);
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ vs = cinfo->cur_comp_info[ci]->v_samp_factor; /* row group height */
+ /* Allocate the real storage */
+ sampled_data[0][ci] = (*cinfo->emethods->d_alloc_small_sarray)
+ (cinfo, cinfo->cur_comp_info[ci]->downsampled_width,
+ (long) (vs * (DCTSIZE+2)));
+ if (cinfo->sampled_data[0][ci] == NULL)
+ return(XIE_ERR);
+ /* Create space for the scrambled-order pointers */
+ sampled_data[1][ci] = (JSAMPARRAY) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (vs * (DCTSIZE+2) * SIZEOF(JSAMPROW)));
+ if (cinfo->sampled_data[1][ci] == (JSAMPARRAY) NULL)
+ return(XIE_ERR);
+ /* Duplicate the first DCTSIZE-2 row groups */
+ for (i = 0; i < vs * (DCTSIZE-2); i++) {
+ sampled_data[1][ci][i] = sampled_data[0][ci][i];
+ }
+ /* Copy the last four row groups in swapped order */
+ for (i = 0; i < vs * 2; i++) {
+ sampled_data[1][ci][vs*DCTSIZE + i] = sampled_data[0][ci][vs*(DCTSIZE-2) + i];
+ sampled_data[1][ci][vs*(DCTSIZE-2) + i] = sampled_data[0][ci][vs*DCTSIZE + i];
+ }
+ }
+ return(0);
+}
+
+/*
+ * Several decompression processes need to range-limit values to the range
+ * 0..MAXJSAMPLE; the input value may fall somewhat outside this range
+ * due to noise introduced by quantization, roundoff error, etc. These
+ * processes are inner loops and need to be as fast as possible. On most
+ * machines, particularly CPUs with pipelines or instruction prefetch,
+ * a (range-check-less) C table lookup
+ * x = sample_range_limit[x];
+ * is faster than explicit tests
+ * if (x < 0) x = 0;
+ * else if (x > MAXJSAMPLE) x = MAXJSAMPLE;
+ * These processes all use a common table prepared by the routine below.
+ *
+ * The table will work correctly for x within MAXJSAMPLE+1 of the legal
+ * range. This is a much wider range than is needed for most cases,
+ * but the wide range is handy for color quantization.
+ * Note that the table is allocated in near data space on PCs; it's small
+ * enough and used often enough to justify this.
+ */
+
+LOCAL int
+#if NeedFunctionPrototypes
+prepare_range_limit_table (decompress_info_ptr cinfo)
+#else
+prepare_range_limit_table (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Allocate and fill in the sample_range_limit table */
+{
+ JSAMPLE * table;
+ int i;
+
+ table = (JSAMPLE *) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (3 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)));
+ if (table == (JSAMPLE *) NULL)
+ return(XIE_ERR);
+ cinfo->sample_range_limit = table + (MAXJSAMPLE+1);
+ for (i = 0; i <= MAXJSAMPLE; i++) {
+ table[i] = 0; /* sample_range_limit[x] = 0 for x<0 */
+ table[i+(MAXJSAMPLE+1)] = (JSAMPLE) i; /* sample_range_limit[x] = x */
+ table[i+(MAXJSAMPLE+1)*2] = MAXJSAMPLE; /* x beyond MAXJSAMPLE */
+ }
+ return(0);
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+duplicate_row (JSAMPARRAY image_data,
+ long num_cols, int source_row, int num_rows)
+#else
+duplicate_row (image_data, num_cols, source_row, num_rows)
+ JSAMPARRAY image_data;
+ long num_cols;
+ int source_row;
+ int num_rows;
+#endif /* NeedFunctionPrototypes */
+/* Duplicate the source_row at source_row+1 .. source_row+num_rows */
+/* This happens only at the bottom of the image, */
+/* so it needn't be super-efficient */
+{
+ register int row;
+
+ for (row = 1; row <= num_rows; row++) {
+ jcopy_sample_rows(image_data, source_row, image_data, source_row + row,
+ 1, num_cols);
+ }
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+expand (decompress_info_ptr cinfo,
+ JSAMPIMAGE sampled_data, JSAMPIMAGE fullsize_data,
+ long fullsize_width,
+ short above, short current, short below, short out)
+#else
+expand (cinfo,
+ sampled_data, fullsize_data,
+ fullsize_width,
+ above, current, below, out)
+ decompress_info_ptr cinfo;
+ JSAMPIMAGE sampled_data;
+ JSAMPIMAGE fullsize_data;
+ long fullsize_width;
+ short above;
+ short current;
+ short below;
+ short out;
+#endif /* NeedFunctionPrototypes */
+/* Do upsampling expansion of a single row group (of each component). */
+/* above, current, below are indexes of row groups in sampled_data; */
+/* out is the index of the target row group in fullsize_data. */
+/* Special case: above, below can be -1 to indicate top, bottom of image. */
+{
+ jpeg_component_info *compptr;
+ JSAMPARRAY above_ptr, below_ptr;
+ JSAMPROW dummy[MAX_SAMP_FACTOR]; /* for downsample expansion at top/bottom */
+ short ci, vs, i;
+
+ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
+ compptr = cinfo->cur_comp_info[ci];
+ vs = compptr->v_samp_factor; /* row group height */
+
+ if (above >= 0)
+ above_ptr = sampled_data[ci] + above * vs;
+ else {
+ /* Top of image: make a dummy above-context with copies of 1st row */
+ /* We assume current=0 in this case */
+ for (i = 0; i < vs; i++)
+ dummy[i] = sampled_data[ci][0];
+ above_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */
+ }
+
+ if (below >= 0)
+ below_ptr = sampled_data[ci] + below * vs;
+ else {
+ /* Bot of image: make a dummy below-context with copies of last row */
+ for (i = 0; i < vs; i++)
+ dummy[i] = sampled_data[ci][(current+1)*vs-1];
+ below_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */
+ }
+
+ (*cinfo->methods->upsample[ci])
+ (cinfo, (int) ci,
+ compptr->downsampled_width, (int) vs,
+ fullsize_width, (int) cinfo->max_v_samp_factor,
+ above_ptr,
+ sampled_data[ci] + current * vs,
+ below_ptr,
+ fullsize_data[ci] + out * cinfo->max_v_samp_factor);
+ }
+}
+
+LOCAL void
+#if NeedFunctionPrototypes
+jdcopy_pixel_rows (decompress_info_ptr cinfo,
+ JSAMPIMAGE input_array, JSAMPIMAGE output_array)
+#else
+jdcopy_pixel_rows (cinfo,input_array, output_array)
+ decompress_info_ptr cinfo;
+ JSAMPIMAGE input_array;
+ JSAMPIMAGE output_array;
+#endif /* NeedFunctionPrototypes */
+/* Copy some rows of samples from one place to another.
+ * num_rows rows are copied from input_array[source_row++]
+ * to output_array[dest_row++]; these areas should not overlap.
+ * The source and destination arrays must be at least as wide as num_cols.
+ */
+{
+ register JSAMPROW inptr, outptr;
+#ifdef FMEMCOPY
+ register size_t count;
+#else
+ register long count;
+#endif
+ register int ci, row;
+ int num_components;
+ int num_rows;
+ long num_cols;
+
+ num_components = cinfo->num_components;
+ if (cinfo->XIE_upsample) {
+ num_rows = cinfo->rows_in_mem;
+ num_cols = cinfo->image_width;
+#ifdef FMEMCOPY
+ count = (size_t) (num_cols * SIZEOF(JSAMPLE));
+#endif
+ }
+
+ for (ci = 0; ci < num_components; ci++) {
+ if (!cinfo->XIE_upsample) {
+ num_rows = cinfo->comp_info[ci].h_samp_factor*DCTSIZE;
+ num_cols = cinfo->comp_info[ci].true_comp_width;
+#ifdef FMEMCOPY
+ count = (size_t) (num_cols * SIZEOF(JSAMPLE));
+#endif
+ }
+ for (row = 0; row < num_rows; row++) {
+ inptr = input_array[ci][row];
+ outptr = output_array[ci][row];
+#ifdef FMEMCOPY
+ FMEMCOPY(outptr, inptr, count);
+#else
+ for (count = 0; count < num_cols; count++)
+ outptr[count] = inptr[count]; /* needn't bother with GETJSAMPLE() here */
+#endif
+ }
+ }
+}
+
+GLOBAL int
+#if NeedFunctionPrototypes
+jdXIE_init (decompress_info_ptr cinfo)
+#else
+jdXIE_init (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int status;
+
+ if (cinfo->XIErestart == XIE_RNUL) {
+ /* Install, but don't yet enable signal catcher. */
+
+ /* Set up compression parameters */
+ /* Initialize cinfo with default switch settings */
+ /* (Re-)initialize the system-dependent error and memory managers. */
+ jdselmemmgr(cinfo, cinfo->emethods); /* memory allocation routines */
+ cinfo->methods->d_ui_method_selection = d_ui_method_selection;
+
+ /* Set up default JPEG parameters. */
+ j_d_defaults(cinfo, FALSE);
+
+ /* Set up to read a baseline-JPEG file. */
+ jselrjfif(cinfo);
+
+ /* Init pass counts to 0 --- total_passes is adjusted in method selection */
+ cinfo->total_passes = 0;
+ cinfo->completed_passes = 0;
+
+ cinfo->XIErestart = XIE_RNUL;
+ cinfo->XIEmcuindex = 0;
+ } /* if (cinfo->XIErestart != XIE_RNUL) */
+
+ /* Read the JPEG file header markers; everything up through the first SOS
+ * marker is read now. NOTE: the user interface must have initialized the
+ * read_file_header method pointer (eg, by calling jselrjfif or jselrtiff).
+ * The other file reading methods (read_scan_header etc.) were probably
+ * set at the same time, but could be set up by read_file_header itself.
+ */
+ if (cinfo->XIErestart != XIE_RRSH) {
+
+ /* need more data */
+ if ((status = ((*cinfo->methods->read_file_header)(cinfo))) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RRFH;
+ cinfo->next_input_byte = cinfo->XIEnext_input_byte;
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ return(XIE_INP);
+ } else {
+ cinfo->XIErestart = XIE_RNUL;
+ }
+ }
+ /* need more data */
+ if ((status = ((*cinfo->methods->read_scan_header)(cinfo))) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->XIErestart = XIE_RRSH;
+ cinfo->next_input_byte = cinfo->XIEnext_input_byte;
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ return(XIE_INP);
+ }
+ cinfo->XIErestart = XIE_RNUL;
+
+ /* Give UI a chance to adjust decompression parameters and select */
+ /* output file format based on info from file header. */
+ (*cinfo->methods->d_ui_method_selection) (cinfo);
+
+ /* Now select methods for decompression steps. */
+ if (initial_setup(cinfo) == XIE_ERR)
+ return(XIE_ERR);
+ d_initial_method_selection(cinfo);
+
+ /* Compute dimensions of full-size pixel buffers */
+ /* Note these are the same whether interleaved or not. */
+ cinfo->rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE;
+ cinfo->fullsize_width = jround_up(cinfo->image_width,
+ (long) (cinfo->max_h_samp_factor * DCTSIZE));
+
+ /* Prepare for single scan containing all components */
+ if (cinfo->comps_in_scan == 1) {
+ noninterleaved_scan_setup(cinfo);
+ /* Need to read Vk MCU rows to obtain Vk block rows */
+ cinfo->mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor;
+ } else {
+ if (interleaved_scan_setup(cinfo) == XIE_ERR)
+ return(XIE_ERR);
+ /* in an interleaved scan, one MCU row provides Vk block rows */
+ cinfo->mcu_rows_per_loop = 1;
+ }
+ cinfo->total_passes++;
+
+ /* Allocate working memory: */
+ /* coeff_data holds a single MCU row of coefficient blocks */
+ cinfo->coeff_data = alloc_MCU_row(cinfo);
+ if (cinfo->coeff_data == (JBLOCKIMAGE) NULL)
+ return(XIE_ERR);
+ /* sampled_data is sample data before upsampling */
+ if (alloc_sampling_buffer(cinfo, cinfo->sampled_data) == XIE_ERR)
+ return(XIE_ERR);
+ if (cinfo->XIE_upsample) {
+ /* fullsize_data is sample data after upsampling */
+ cinfo->fullsize_data = alloc_sampimage(cinfo, (int) cinfo->num_components,
+ (long) cinfo->rows_in_mem, cinfo->fullsize_width);
+ if (cinfo->fullsize_data == (JSAMPIMAGE) NULL)
+ return(XIE_ERR);
+ }
+ if (prepare_range_limit_table(cinfo) == XIE_ERR)
+ return(XIE_ERR);
+
+ /* Initialize to read scan data */
+
+ if (((*cinfo->methods->entropy_decode_init) (cinfo)) == XIE_ERR)
+ return(XIE_ERR);
+ if (cinfo->XIE_upsample)
+ (*cinfo->methods->upsample_init) (cinfo);
+ (*cinfo->methods->disassemble_init) (cinfo);
+
+ cinfo->pixel_rows_output = 0;
+ if (cinfo->XIE_upsample) {
+ cinfo->whichss = 1; /* arrange to start with sampled_data[0] */
+ } else {
+ cinfo->whichss = 0; /* arrange to start with sampled_data[0] */
+ }
+ cinfo->cur_mcu_row = 0;
+ cinfo->first_mcu_row = TRUE;
+ return(XIE_NRML);
+} /* jdXIE_init */
+
+
+GLOBAL int
+#if NeedFunctionPrototypes
+jdXIE_get (decompress_info_ptr cinfo)
+#else
+jdXIE_get (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int whichss;
+ int ri;
+ int start;
+ short i;
+
+ if (cinfo->cur_mcu_row < cinfo->MCU_rows_in_scan) {
+ if (cinfo->XIErestart == XIE_RNUL) {
+ start = 0;
+ if (cinfo->XIE_upsample) {
+ cinfo->whichss ^= 1; /* switch to other downsampled-data buffer */
+ }
+ } else {
+ start = cinfo->ri;
+ }
+
+ whichss = cinfo->whichss; /* localize variable */
+
+ /* Obtain v_samp_factor block rows of each component in the scan. */
+ /* This is a single MCU row if interleaved, multiple MCU rows if not. */
+ /* In the noninterleaved case there might be fewer than v_samp_factor */
+ /* block rows remaining; if so, pad with copies of the last pixel row */
+ /* so that upsampling doesn't have to treat it as a special case. */
+
+ for (ri = start; ri < cinfo->mcu_rows_per_loop; ri++) {
+ if ((cinfo->cur_mcu_row + ri) < cinfo->MCU_rows_in_scan) {
+ /* OK to actually read an MCU row. */
+ if (((*cinfo->methods->disassemble_MCU) (cinfo,
+ cinfo->coeff_data)) < 0) {
+ cinfo->ri = ri; /* save loop position */
+ return(XIE_INP); /* need more data */
+ }
+ (*cinfo->methods->reverse_DCT) (cinfo, cinfo->coeff_data,
+ cinfo->sampled_data[whichss],
+ ri * DCTSIZE);
+ } else {
+ /* Need to pad out with copies of the last downsampled row. */
+ /* This can only happen if there is just one component. */
+ duplicate_row(cinfo->sampled_data[whichss][0],
+ cinfo->cur_comp_info[0]->downsampled_width,
+ ri * DCTSIZE - 1, DCTSIZE);
+ }
+ }
+
+ if (cinfo->XIE_upsample) {
+ /* Upsample the data */
+ /* First time through is a special case */
+
+ if (cinfo->first_mcu_row) {
+ /* Expand first row group with dummy above-context */
+ expand(cinfo, cinfo->sampled_data[whichss],
+ cinfo->fullsize_data, cinfo->fullsize_width,
+ (short) (-1), (short) 0, (short) 1,
+ (short) 0);
+ } else {
+ /* Expand last row group of previous set */
+ expand(cinfo, cinfo->sampled_data[whichss],
+ cinfo->fullsize_data, cinfo->fullsize_width,
+ (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0,
+ (short) (DCTSIZE-1));
+ /* and dump the previous set's expanded data */
+ jdcopy_pixel_rows (cinfo, cinfo->fullsize_data, cinfo->output_workspace);
+ /* Expand first row group of this set */
+ expand(cinfo, cinfo->sampled_data[whichss],
+ cinfo->fullsize_data, cinfo->fullsize_width,
+ (short) (DCTSIZE+1), (short) 0, (short) 1,
+ (short) 0);
+ }
+
+ /* Expand second through next-to-last row groups of this set */
+ for (i = 1; i <= DCTSIZE-2; i++) {
+ expand(cinfo, cinfo->sampled_data[whichss],
+ cinfo->fullsize_data, cinfo->fullsize_width,
+ (short) (i-1), (short) i, (short) (i+1),
+ (short) i);
+ }
+
+ /* Return for all but last row group */
+ cinfo->cur_mcu_row += cinfo->mcu_rows_per_loop;
+ if (cinfo->first_mcu_row) {
+ cinfo->first_mcu_row = FALSE;
+ return(XIE_NRML); /* No errors, no output */
+ } else {
+ return(XIE_OUT); /* No errors, output */
+ }
+
+ } else {
+
+ /* Do not upsample the data: copy it directly into the output workspace */
+ jdcopy_pixel_rows (cinfo,
+ cinfo->sampled_data[whichss], cinfo->output_workspace);
+ cinfo->cur_mcu_row += cinfo->mcu_rows_per_loop;
+ if (cinfo->cur_mcu_row < cinfo->MCU_rows_in_scan) {
+ return(XIE_OUT); /* No errors, output */
+ } else {
+ return(XIE_EOI); /* No errors, output, end of input */
+ }
+ }
+ }
+
+ if (cinfo->XIE_upsample) {
+ /* Expand the last row group with dummy below-context */
+ /* Note whichss points to last buffer side used */
+ expand(cinfo, cinfo->sampled_data[cinfo->whichss],
+ cinfo->fullsize_data, cinfo->fullsize_width,
+ (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1),
+ (short) (DCTSIZE-1));
+ /* and dump the remaining data (may be less than full height) */
+ jdcopy_pixel_rows (cinfo, cinfo->fullsize_data, cinfo->output_workspace);
+ }
+ return(XIE_EOI); /* No errors, output, end of input */
+} /* jdXIE_get */
+
+#ifndef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+jdXIE_term (decompress_info_ptr cinfo)
+#else
+jdXIE_term (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* Clean up after the scan */
+ (*cinfo->methods->disassemble_term) (cinfo);
+ if (cinfo->XIE_upsample)
+ (*cinfo->methods->upsample_term) (cinfo);
+ (*cinfo->methods->entropy_decode_term) (cinfo);
+ (*cinfo->methods->read_scan_trailer) (cinfo);
+ cinfo->completed_passes++;
+
+ /* Finish output file, release working storage, etc */
+ (*cinfo->methods->output_term) (cinfo);
+ (*cinfo->methods->read_file_trailer) (cinfo);
+
+ (*cinfo->emethods->d_free_all) (cinfo);
+
+ return(XIE_NRML);
+} /* jdXIE_term */
+
+
+GLOBAL void
+#if NeedFunctionPrototypes
+jseldXIE (decompress_info_ptr cinfo)
+#else
+jseldXIE (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* NULL function */
+} /* jseldXIE */
+#endif /* XIE_SUPPORTED */
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jdxief.c b/xc/programs/Xserver/XIE/mixie/jpeg/jdxief.c
new file mode 100644
index 000000000..3c621be84
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jdxief.c
@@ -0,0 +1,157 @@
+/* $TOG: jdxief.c /main/5 1998/02/09 16:19:50 kaleb $ */
+/* Module jdxief.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+#include "jinclude.h"
+
+#if NeedFunctionPrototypes
+GLOBAL int jdXIE_init(decompress_info_ptr);
+GLOBAL int jdXIE_get(decompress_info_ptr);
+#ifndef XIE_SUPPORTED
+GLOBAL int jdXIE_term(decompress_info_ptr);
+GLOBAL void jseldXIE(decompress_info_ptr);
+#endif /* XIE_SUPPORTED */
+#endif /* NeedFunctionPrototypes */
+
+/**********************************************************************/
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JD_INIT(decompress_info_ptr cinfo,
+ decompress_methods_ptr dcmethods, external_methods_ptr emethods,
+ boolean upsample)
+#else
+JD_INIT(cinfo, dcmethods, emethods, upsample)
+ decompress_info_ptr cinfo;
+ decompress_methods_ptr dcmethods;
+ external_methods_ptr emethods;
+ boolean upsample;
+#endif /* NeedFunctionPrototypes */
+{
+ /* Set up links to method structures. */
+ cinfo->methods = dcmethods;
+ cinfo->emethods = emethods;
+
+ /* Set upsample flag */
+ cinfo->XIE_upsample = upsample;
+
+ /* Set restart to NULL */
+ cinfo->XIErestart = XIE_RNUL;
+
+ return(jdXIE_init(cinfo));
+}
+
+/**********************************************************************/
+
+#ifndef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+JD_BEGINFRAME(decompress_info_ptr cinfo)
+#else
+JD_BEGINFRAME(cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ (*cinfo->methods->output_init) (cinfo);
+
+ return(XIE_NRML);
+}
+#endif /* XIE_SUPPORTED */
+
+/**********************************************************************/
+
+GLOBAL int
+#if NeedFunctionPrototypes
+JD_PROCESS(decompress_info_ptr cinfo)
+#else
+JD_PROCESS(cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ return(jdXIE_get(cinfo));
+}
+
+/**********************************************************************/
+
+#ifndef XIE_SUPPORTED
+GLOBAL int
+#if NeedFunctionPrototypes
+JD_ENDFRAME(decompress_info_ptr cinfo)
+#else
+JD_ENDFRAME(cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+
+ jdXIE_term(cinfo);
+
+ return(XIE_NRML);
+}
+#endif /* XIE_SUPPORTED */
+
+/**********************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jelossy.c b/xc/programs/Xserver/XIE/mixie/jpeg/jelossy.c
new file mode 100644
index 000000000..48d24c82e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jelossy.c
@@ -0,0 +1,249 @@
+/* $TOG: jelossy.c /main/5 1998/02/09 16:19:59 kaleb $ */
+/* Module jelossy.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+
+ jelossy.c - encode JPEG images, Lossy method
+
+ this contain code for:
+
+ 1) JPEG Lossless, grayscale
+ 2) JPEG Lossless, color
+
+ Ben Fahy, AGE Logic, Oct 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+
+****************************************************************************/
+
+#include "jpeg.h"
+
+/**********************************************************************/
+encode_jpeg_lossy_gray(state)
+JpegEncodeState *state;
+{
+ return( encode_jpeg_lossy_color(state) );
+}
+/**********************************************************************/
+encode_jpeg_lossy_color(state)
+JpegEncodeState *state;
+{
+int status; /* some compilers may complain, but close examination
+ ** shows the useage of this variable 'status' to be correct.
+ */
+
+/* our output buffer is guaranteed to be clean on entry. */
+/* (every time we write data below, we return to flush it) */
+
+ state->flush_output = 0;
+ state->nl_coded = 0;
+
+ while(1) { /* loop forever (we're a state machine) */
+
+ switch( state->goal) {
+ case JPEG_ENCODE_GOAL_Startup:
+ state->goal = JPEG_ENCODE_GOAL_TryToBeginFrame;
+
+/*** Write out the beginning frame information ***/
+ case JPEG_ENCODE_GOAL_TryToBeginFrame:
+
+ state->cinfo->bytes_in_buffer = 0;
+ /* initialize buffer to empty */
+
+ status = JC_BEGINFRAME(state->cinfo,
+ state->n_bands,
+ state->width,
+ state->height,
+ state->Qtable,
+ state->lenQtable,
+ state->ACtable,
+ state->lenACtable,
+ state->DCtable,
+ state->lenDCtable,
+ state->h_sample,
+ state->v_sample);
+
+ if (status == XIE_ERR) {
+ state->error_code = JPEG_ENCODE_ERROR_CouldNotBeginFrame;
+ return(-1);
+ }
+ if (status == XIE_NRML) {
+ state->goal = JPEG_ENCODE_GOAL_BeginFrameDone;
+ break;
+ }
+ if (status == XIE_OUT) {
+ state->goal = JPEG_ENCODE_GOAL_WriteHdrData;
+ break;
+ }
+ /* hey! we aren't supposed to be here */
+ state->error_code = JPEG_ENCODE_ERROR_BadBeginFrameRetCode;
+ return(-1);
+ break;
+
+ case JPEG_ENCODE_GOAL_WriteHdrData:
+ return(-1);
+ break;
+
+ case JPEG_ENCODE_GOAL_BeginFrameDone:
+ state->goal = JPEG_ENCODE_GOAL_ProcessData;
+ state->needs_input_strip = 1;
+ state->flush_output = state->cinfo->bytes_in_buffer;
+ return(0);
+ break;
+
+ case JPEG_ENCODE_GOAL_ProcessData:
+ if (state->n_bands == 3)
+ state->goal = JPEG_ENCODE_GOAL_EncodeRGB;
+ else
+ state->goal = JPEG_ENCODE_GOAL_EncodeGray;
+ break;
+
+ case JPEG_ENCODE_GOAL_EncodeGray:
+ if (state->nl_tocode <= 0) {
+ state->flush_output = state->cinfo->bytes_in_buffer;
+ return(state->nl_coded);
+ }
+ status = JC_SCANLINE_GRAY(state->cinfo,
+ &state->i_line, /* global line # */
+ state->i_lines[0][state->nl_coded]); /* gray data line */
+
+ /* keep track of how many lines in strip we've given encoder */
+ state->nl_coded++;
+ state->i_line++;
+ state->nl_tocode--;
+ state->goal = JPEG_ENCODE_GOAL_CheckStatus;
+ break;
+
+ case JPEG_ENCODE_GOAL_EncodeRGB:
+ if (state->nl_tocode <= 0) {
+ state->flush_output = state->cinfo->bytes_in_buffer;
+ return(state->nl_coded);
+ }
+ status = JC_SCANLINE_RGB(state->cinfo,
+ &state->i_line, /* global line # */
+ state->i_lines[0][state->nl_coded], /* red data line */
+ state->i_lines[1][state->nl_coded], /* green data line */
+ state->i_lines[2][state->nl_coded]); /* blue data line */
+
+ /* keep track of how many lines in strip we've given encoder */
+ state->nl_coded++;
+ state->i_line++;
+ state->nl_tocode--;
+
+ case JPEG_ENCODE_GOAL_CheckStatus:
+ if (status == XIE_OUT) {
+ state->flush_output = state->cinfo->bytes_in_buffer;
+ return(state->nl_coded);
+ break;
+ }
+ if (status == XIE_NRML) {
+ state->goal = JPEG_ENCODE_GOAL_ProcessData;
+ if (state->flush_output = state->cinfo->bytes_in_buffer)
+ return(state->nl_coded);
+
+ break;
+ }
+
+ if (status == XIE_ERR) {
+ state->error_code = JPEG_ENCODE_ERROR_EncodeError;
+ return(-1);
+ }
+ else {
+ /* unexpected return status */
+ state->error_code = JPEG_ENCODE_ERROR_EncoderIsFreakingOut;
+ return(-1);
+ }
+ break;
+
+ case JPEG_ENCODE_GOAL_EndFrame:
+ status = JC_ENDFRAME(state->cinfo);
+
+ if (state->flush_output = state->cinfo->bytes_in_buffer) {
+ if (status == XIE_NRML)
+ state->goal = JPEG_ENCODE_GOAL_Done;
+
+ return(state->nl_coded);
+ }
+ else if (status == XIE_NRML) {
+ state->goal = JPEG_ENCODE_GOAL_Done;
+ state->flush_output = state->cinfo->bytes_in_buffer;
+ return(state->nl_coded);
+ }
+ else if (status == XIE_ERR) {
+ state->error_code = JPEG_ENCODE_ERROR_EndFrameError;
+ return(-1);
+ }
+ else {
+ /* unexpected return status */
+ state->error_code = JPEG_ENCODE_ERROR_EndFrameFreakOut;
+ return(-1);
+ }
+ break;
+
+ default:
+ state->error_code = JPEG_ENCODE_ERROR_BadGoal;
+ return(-1);
+ }
+ }
+}
+/**********************************************************************/
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jfwddct.c b/xc/programs/Xserver/XIE/mixie/jpeg/jfwddct.c
new file mode 100644
index 000000000..377c9e22f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jfwddct.c
@@ -0,0 +1,376 @@
+/* $TOG: jfwddct.c /main/5 1998/02/09 16:20:04 kaleb $ */
+/* Module jfwddct.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jfwddct.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the basic DCT (Discrete Cosine Transform)
+ * transformation subroutine.
+ *
+ * This implementation is based on an algorithm described in
+ * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
+ * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
+ * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
+ * The primary algorithm described there uses 11 multiplies and 29 adds.
+ * We use their alternate method with 12 multiplies and 32 adds.
+ * The advantage of this method is that no data path contains more than one
+ * multiplication; this allows a very simple and accurate implementation in
+ * scaled fixed-point arithmetic, with a minimal number of shifts.
+ */
+
+#include "jinclude.h"
+
+/*
+ * This routine is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+ Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
+ * on each column. Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * The poop on this scaling stuff is as follows:
+ *
+ * Each 1-D DCT step produces outputs which are a factor of sqrt(N)
+ * larger than the true DCT outputs. The final outputs are therefore
+ * a factor of N larger than desired; since N=8 this can be cured by
+ * a simple right shift at the end of the algorithm. The advantage of
+ * this arrangement is that we save two multiplications per 1-D DCT,
+ * because the y0 and y4 outputs need not be divided by sqrt(N).
+ *
+ * We have to do addition and subtraction of the integer inputs, which
+ * is no problem, and multiplication by fractional constants, which is
+ * a problem to do in integer arithmetic. We multiply all the constants
+ * by CONST_SCALE and convert them to integer constants (thus retaining
+ * CONST_BITS bits of precision in the constants). After doing a
+ * multiplication we have to divide the product by CONST_SCALE, with proper
+ * rounding, to produce the correct output. This division can be done
+ * cheaply as a right shift of CONST_BITS bits. We postpone shifting
+ * as long as possible so that partial sums can be added together with
+ * full fractional precision.
+ *
+ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
+ * they are represented to better-than-integral precision. These outputs
+ * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
+ * with the recommended scaling. (To scale up 12-bit sample data, an
+ * intermediate INT32 array would be needed.)
+ *
+ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
+ * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 25. Error analysis
+ * shows that the values given below are the most effective.
+ */
+
+#ifdef EIGHT_BIT_SAMPLES
+#define CONST_BITS 13
+#define PASS1_BITS 2
+#else
+#define CONST_BITS 13
+#define PASS1_BITS 0 /* lose a little precision to avoid overflow */
+#endif
+
+#define ONE ((INT32) 1)
+
+#define CONST_SCALE (ONE << CONST_BITS)
+
+/* Convert a positive real constant to an integer scaled by CONST_SCALE. */
+
+#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 13
+#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
+#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
+#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
+#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
+#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
+#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
+#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
+#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
+#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
+#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
+#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
+#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
+#else
+#define FIX_0_298631336 FIX(0.298631336)
+#define FIX_0_390180644 FIX(0.390180644)
+#define FIX_0_541196100 FIX(0.541196100)
+#define FIX_0_765366865 FIX(0.765366865)
+#define FIX_0_899976223 FIX(0.899976223)
+#define FIX_1_175875602 FIX(1.175875602)
+#define FIX_1_501321110 FIX(1.501321110)
+#define FIX_1_847759065 FIX(1.847759065)
+#define FIX_1_961570560 FIX(1.961570560)
+#define FIX_2_053119869 FIX(2.053119869)
+#define FIX_2_562915447 FIX(2.562915447)
+#define FIX_3_072711026 FIX(3.072711026)
+#endif
+
+
+/* Descale and correctly round an INT32 value that's scaled by N bits.
+ * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
+ * the fudge factor is correct for either sign of X.
+ */
+
+#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
+ * this provides a useful speedup on many machines.
+ * There is no way to specify a 16x16->32 multiply in portable C, but
+ * some C compilers will do the right thing if you provide the correct
+ * combination of casts.
+ * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#ifdef EIGHT_BIT_SAMPLES
+#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
+#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
+#endif
+#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
+#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
+#endif
+#endif
+
+#ifndef MULTIPLY /* default definition */
+#define MULTIPLY(var,const) ((var) * (const))
+#endif
+
+
+/*
+ * Perform the forward DCT on one block of samples.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+j_fwd_dct (DCTBLOCK data)
+#else
+j_fwd_dct (data)
+ DCTBLOCK data;
+#endif /* NeedFunctionPrototypes */
+#else
+j_fwd_dct (DCTBLOCK data)
+#endif /* XIE_SUPPORTED */
+{
+ INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+ INT32 tmp10, tmp11, tmp12, tmp13;
+ INT32 z1, z2, z3, z4, z5;
+ register DCTELEM *dataptr;
+ int rowctr;
+ SHIFT_TEMPS
+
+ /* Pass 1: process rows. */
+ /* Note results are scaled up by sqrt(8) compared to a true DCT; */
+ /* furthermore, we scale the results by 2**PASS1_BITS. */
+
+ dataptr = data;
+ for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ tmp0 = dataptr[0] + dataptr[7];
+ tmp7 = dataptr[0] - dataptr[7];
+ tmp1 = dataptr[1] + dataptr[6];
+ tmp6 = dataptr[1] - dataptr[6];
+ tmp2 = dataptr[2] + dataptr[5];
+ tmp5 = dataptr[2] - dataptr[5];
+ tmp3 = dataptr[3] + dataptr[4];
+ tmp4 = dataptr[3] - dataptr[4];
+
+ /* Even part per LL&M figure 1 --- note that published figure is faulty;
+ * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
+ */
+
+ tmp10 = tmp0 + tmp3;
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
+ dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
+
+ z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
+ dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+ CONST_BITS-PASS1_BITS);
+ dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
+ CONST_BITS-PASS1_BITS);
+
+ /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
+ * cK represents cos(K*pi/16).
+ * i0..i3 in the paper are tmp4..tmp7 here.
+ */
+
+ z1 = tmp4 + tmp7;
+ z2 = tmp5 + tmp6;
+ z3 = tmp4 + tmp6;
+ z4 = tmp5 + tmp7;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
+ z3 += z5;
+ z4 += z5;
+
+ dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
+ dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
+ dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
+ dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
+
+ dataptr += DCTSIZE; /* advance pointer to next row */
+ }
+
+ /* Pass 2: process columns. */
+ /* Note that we must descale the results by a factor of 8 == 2**3, */
+ /* and also undo the PASS1_BITS scaling. */
+
+ dataptr = data;
+ for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
+ tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
+ tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
+ tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
+ tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
+ tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
+ tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
+ tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
+
+ /* Even part per LL&M figure 1 --- note that published figure is faulty;
+ * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
+ */
+
+ tmp10 = tmp0 + tmp3;
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS+3);
+ dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS+3);
+
+ z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
+ dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
+ CONST_BITS+PASS1_BITS+3);
+
+ /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
+ * cK represents cos(K*pi/16).
+ * i0..i3 in the paper are tmp4..tmp7 here.
+ */
+
+ z1 = tmp4 + tmp7;
+ z2 = tmp5 + tmp6;
+ z3 = tmp4 + tmp6;
+ z4 = tmp5 + tmp7;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
+ z3 += z5;
+ z4 += z5;
+
+ dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
+ CONST_BITS+PASS1_BITS+3);
+
+ dataptr++; /* advance pointer to next column */
+ }
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jinclude.h b/xc/programs/Xserver/XIE/mixie/jpeg/jinclude.h
new file mode 100644
index 000000000..e833ffe27
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jinclude.h
@@ -0,0 +1,199 @@
+/* $TOG: jinclude.h /main/7 1998/02/09 16:20:08 kaleb $ */
+/* Module jinclude.h */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jinclude.h,v 1.5 1999/01/31 12:21:37 dawes Exp $ */
+
+/*
+ * jinclude.h
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This is the central file that's #include'd by all the JPEG .c files.
+ * Its purpose is to provide a single place to fix any problems with
+ * including the wrong system include files.
+ * You can edit these declarations if you use a system with nonstandard
+ * system include files.
+ */
+
+#ifndef NO_XIE
+
+#define _XIEC_MEMORY /* for XieMalloc and XieFree, used in jmemsys.c */
+#define XIE_SUPPORTED
+#ifndef XFree86LOADER
+#include <stdio.h>
+#else
+#include "xf86_ansic.h"
+#endif
+#include "misc.h" /* for pointer ;*/
+
+#ifndef X_NOT_STDC_ENV
+#define INCLUDES_ARE_ANSI
+#endif
+
+
+#undef SIZEOF /* in case you included X11/xmd.h */
+#define SIZEOF(object) ((size_t) sizeof(object))
+#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+
+#else
+
+/*
+ * Normally the __STDC__ macro can be taken as indicating that the system
+ * include files conform to the ANSI C standard. However, if you are running
+ * GCC on a machine with non-ANSI system include files, that is not the case.
+ * In that case change the following, or add -DNONANSI_INCLUDES to your CFLAGS.
+ */
+
+#ifdef __STDC__
+#ifndef NONANSI_INCLUDES
+#define INCLUDES_ARE_ANSI /* this is what's tested before including */
+#endif
+#endif
+
+/*
+ * <stdio.h> is included to get the FILE typedef and NULL macro.
+ * Note that the core portable-JPEG files do not actually do any I/O
+ * using the stdio library; only the user interface, error handler,
+ * and file reading/writing modules invoke any stdio functions.
+ * (Well, we did cheat a bit in jmemmgr.c, but only if MEM_STATS is defined.)
+ */
+
+#include <stdio.h>
+
+/*
+ * We need the size_t typedef, which defines the parameter type of malloc().
+ * In an ANSI-conforming implementation this is provided by <stdio.h>,
+ * but on non-ANSI systems it's more likely to be in <sys/types.h>.
+ * On some not-quite-ANSI systems you may find it in <stddef.h>.
+ */
+
+#ifndef INCLUDES_ARE_ANSI /* shouldn't need this if ANSI C */
+#include <sys/types.h>
+#endif
+#ifdef __SASC /* Amiga SAS C provides it in stddef.h. */
+#include <stddef.h>
+#endif
+
+/*
+ * In ANSI C, and indeed any rational implementation, size_t is also the
+ * type returned by sizeof(). However, it seems there are some irrational
+ * implementations out there, in which sizeof() returns an int even though
+ * size_t is defined as long or unsigned long. To ensure consistent results
+ * we always use this SIZEOF() macro in place of using sizeof() directly.
+ */
+
+#undef SIZEOF /* in case you included X11/xmd.h */
+#define SIZEOF(object) ((size_t) sizeof(object))
+
+/*
+ * fread() and fwrite() are always invoked through these macros.
+ * On some systems you may need to twiddle the argument casts.
+ * CAUTION: argument order is different from underlying functions!
+ */
+
+#define JFREAD(file,buf,sizeofbuf) \
+ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
+#define JFWRITE(file,buf,sizeofbuf) \
+ ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
+
+/*
+ * We need the memcpy() and strcmp() functions, plus memory zeroing.
+ * ANSI and System V implementations declare these in <string.h>.
+ * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
+ * Some systems may declare memset and memcpy in <memory.h>.
+ *
+ * NOTE: we assume the size parameters to these functions are of type size_t.
+ * Change the casts in these macros if not!
+ */
+
+#ifdef INCLUDES_ARE_ANSI
+#include <string.h>
+#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+#else /* not ANSI */
+#ifdef BSD
+#include <strings.h>
+#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
+#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
+#else /* not BSD, assume Sys V or compatible */
+#include <string.h>
+#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
+#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
+#endif /* BSD */
+#endif /* ANSI */
+
+#endif /* XIE */
+
+/* Now include the portable JPEG definition files. */
+
+#include "jconfig.h"
+
+#include "jpegdata.h"
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jmemmgr.c b/xc/programs/Xserver/XIE/mixie/jpeg/jmemmgr.c
new file mode 100644
index 000000000..e061fb50e
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jmemmgr.c
@@ -0,0 +1,1684 @@
+/* $TOG: jmemmgr.c /main/5 1998/02/09 16:20:13 kaleb $ */
+/* Module jmemmgr.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jmemmgr.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides the standard system-independent memory management
+ * routines. This code is usable across a wide variety of machines; most
+ * of the system dependencies have been isolated in a separate file.
+ * The major functions provided here are:
+ * * bookkeeping to allow all allocated memory to be freed upon exit;
+ * * policy decisions about how to divide available memory among the
+ * various large arrays;
+ * * control logic for swapping virtual arrays between main memory and
+ * backing storage.
+ * The separate system-dependent file provides the actual backing-storage
+ * access code, and it contains the policy decision about how much total
+ * main memory to use.
+ * This file is system-dependent in the sense that some of its functions
+ * are unnecessary in some systems. For example, if there is enough virtual
+ * memory so that backing storage will never be used, much of the big-array
+ * control logic could be removed. (Of course, if you have that much memory
+ * then you shouldn't care about a little bit of unused code...)
+ *
+ * These routines are invoked via the methods alloc_small, free_small,
+ * alloc_medium, free_medium, alloc_small_sarray, free_small_sarray,
+ * alloc_small_barray, free_small_barray, request_big_sarray,
+ * request_big_barray, alloc_big_arrays, access_big_sarray, access_big_barray,
+ * free_big_sarray, free_big_barray, and free_all.
+ */
+
+#define AM_MEMORY_MANAGER /* we define big_Xarray_control structs */
+
+#include "jinclude.h"
+#include "jmemsys.h" /* import the system-dependent declarations */
+
+#ifndef XIE_SUPPORTED
+#ifndef NO_GETENV
+#ifdef INCLUDES_ARE_ANSI
+#include <stdlib.h> /* to declare getenv() */
+#else
+extern char * getenv PP((const char * name));
+#endif
+#endif
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * On many systems it is not necessary to distinguish alloc_small from
+ * alloc_medium; the main case where they must be distinguished is when
+ * FAR pointers are distinct from regular pointers. However, you might
+ * want to keep them separate if you have different system-dependent logic
+ * for small and large memory requests (i.e., jget_small and jget_large
+ * do different things).
+ */
+
+#ifdef NEED_FAR_POINTERS
+#define NEED_ALLOC_MEDIUM /* flags alloc_medium really exists */
+#endif
+
+
+#ifndef XIE_SUPPORTED
+/*
+ * Many machines require storage alignment: longs must start on 4-byte
+ * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc()
+ * always returns pointers that are multiples of the worst-case alignment
+ * requirement, and we had better do so too. This means the headers that
+ * we tack onto allocated structures had better have length a multiple of
+ * the alignment requirement.
+ * There isn't any really portable way to determine the worst-case alignment
+ * requirement. In this code we assume that the alignment requirement is
+ * multiples of sizeof(align_type). Here we define align_type as double;
+ * with this definition, the code will run on all machines known to me.
+ * If your machine has lesser alignment needs, you can save a few bytes
+ * by making align_type smaller.
+ */
+
+typedef double align_type;
+
+
+/*
+ * Some important notes:
+ * The allocation routines provided here must never return NULL.
+ * They should exit to error_exit if unsuccessful.
+ *
+ * It's not a good idea to try to merge the sarray and barray routines,
+ * even though they are textually almost the same, because samples are
+ * usually stored as bytes while coefficients are shorts. Thus, in machines
+ * where byte pointers have a different representation from word pointers,
+ * the resulting machine code could not be the same.
+ */
+
+
+static external_methods_ptr methods; /* saved for access to error_exit */
+
+
+#ifdef MEM_STATS /* optional extra stuff for statistics */
+
+/* These macros are the assumed overhead per block for malloc().
+ * They don't have to be accurate, but the printed statistics will be
+ * off a little bit if they are not.
+ */
+#define MALLOC_OVERHEAD (SIZEOF(pointer )) /* overhead for jget_small() */
+#define MALLOC_FAR_OVERHEAD (SIZEOF(pointer)) /* for jget_large() */
+
+static long total_num_small = 0; /* total # of small objects alloced */
+static long total_bytes_small = 0; /* total bytes requested */
+static long cur_num_small = 0; /* # currently alloced */
+static long max_num_small = 0; /* max simultaneously alloced */
+
+#ifdef NEED_ALLOC_MEDIUM
+static long total_num_medium = 0; /* total # of medium objects alloced */
+static long total_bytes_medium = 0; /* total bytes requested */
+static long cur_num_medium = 0; /* # currently alloced */
+static long max_num_medium = 0; /* max simultaneously alloced */
+#endif
+
+static long total_num_sarray = 0; /* total # of sarray objects alloced */
+static long total_bytes_sarray = 0; /* total bytes requested */
+static long cur_num_sarray = 0; /* # currently alloced */
+static long max_num_sarray = 0; /* max simultaneously alloced */
+
+static long total_num_barray = 0; /* total # of barray objects alloced */
+static long total_bytes_barray = 0; /* total bytes requested */
+static long cur_num_barray = 0; /* # currently alloced */
+static long max_num_barray = 0; /* max simultaneously alloced */
+
+LOCAL void
+print_mem_stats (void)
+{
+ /* since this is only a debugging stub, we can cheat a little on the
+ * trace message mechanism... helpful 'cuz trace_message can't handle longs.
+ */
+ fprintf(stderr, "total_num_small = %ld\n", total_num_small);
+ fprintf(stderr, "total_bytes_small = %ld\n", total_bytes_small);
+ if (cur_num_small)
+ fprintf(stderr, "cur_num_small = %ld\n", cur_num_small);
+ fprintf(stderr, "max_num_small = %ld\n", max_num_small);
+
+#ifdef NEED_ALLOC_MEDIUM
+ fprintf(stderr, "total_num_medium = %ld\n", total_num_medium);
+ fprintf(stderr, "total_bytes_medium = %ld\n", total_bytes_medium);
+ if (cur_num_medium)
+ fprintf(stderr, "cur_num_medium = %ld\n", cur_num_medium);
+ fprintf(stderr, "max_num_medium = %ld\n", max_num_medium);
+#endif
+
+ fprintf(stderr, "total_num_sarray = %ld\n", total_num_sarray);
+ fprintf(stderr, "total_bytes_sarray = %ld\n", total_bytes_sarray);
+ if (cur_num_sarray)
+ fprintf(stderr, "cur_num_sarray = %ld\n", cur_num_sarray);
+ fprintf(stderr, "max_num_sarray = %ld\n", max_num_sarray);
+
+ fprintf(stderr, "total_num_barray = %ld\n", total_num_barray);
+ fprintf(stderr, "total_bytes_barray = %ld\n", total_bytes_barray);
+ if (cur_num_barray)
+ fprintf(stderr, "cur_num_barray = %ld\n", cur_num_barray);
+ fprintf(stderr, "max_num_barray = %ld\n", max_num_barray);
+}
+
+#endif /* MEM_STATS */
+
+
+LOCAL void
+out_of_memory (int which)
+/* Report an out-of-memory error and stop execution */
+/* If we compiled MEM_STATS support, report alloc requests before dying */
+{
+#ifdef MEM_STATS
+ if (methods->trace_level <= 0) /* don't do it if free_all() will */
+ print_mem_stats(); /* print optional memory usage statistics */
+#endif
+ ERREXIT1(methods, "Insufficient memory (case %d)", which);
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Management of "small" objects.
+ * These are all-in-memory, and are in near-heap space on an 80x86.
+ */
+
+
+#ifdef XIE_SUPPORTED
+METHODDEF pointer
+#if NeedFunctionPrototypes
+c_alloc_small (compress_info_ptr cinfo, size_t sizeofobject)
+#else
+c_alloc_small (cinfo, sizeofobject)
+ compress_info_ptr cinfo;
+ size_t sizeofobject;
+#endif /* NeedFunctionPrototypes */
+/* Allocate a "small" object */
+{
+ small_ptr result;
+
+ sizeofobject += SIZEOF(small_hdr); /* add space for header */
+
+ result = (small_ptr) jget_small(sizeofobject);
+ if (result == NULL)
+ return (pointer ) result;
+
+ result->next = cinfo->small_list;
+ cinfo->small_list = result;
+ result++; /* advance past header */
+
+ return (pointer ) result;
+}
+
+METHODDEF pointer
+#if NeedFunctionPrototypes
+d_alloc_small (decompress_info_ptr cinfo, size_t sizeofobject)
+#else
+d_alloc_small (cinfo, sizeofobject)
+ decompress_info_ptr cinfo;
+ size_t sizeofobject;
+#endif /* NeedFunctionPrototypes */
+/* Allocate a "small" object */
+{
+ small_ptr result;
+
+ sizeofobject += SIZEOF(small_hdr); /* add space for header */
+
+ result = (small_ptr) jget_small(sizeofobject);
+ if (result == NULL)
+ return (pointer ) result;
+
+ result->next = cinfo->small_list;
+ cinfo->small_list = result;
+ result++; /* advance past header */
+
+ return (pointer ) result;
+}
+
+#else
+typedef union small_struct * small_ptr;
+
+typedef union small_struct {
+ small_ptr next; /* next in list of allocated objects */
+ align_type dummy; /* ensures alignment of following storage */
+ } small_hdr;
+
+static small_ptr small_list; /* head of list */
+
+METHODDEF pointer
+alloc_small (size_t sizeofobject)
+/* Allocate a "small" object */
+{
+ small_ptr result;
+
+ sizeofobject += SIZEOF(small_hdr); /* add space for header */
+
+#ifdef MEM_STATS
+ total_num_small++;
+ total_bytes_small += sizeofobject + MALLOC_OVERHEAD;
+ cur_num_small++;
+ if (cur_num_small > max_num_small) max_num_small = cur_num_small;
+#endif
+
+ result = (small_ptr) jget_small(sizeofobject);
+ if (result == NULL)
+ out_of_memory(1);
+
+ result->next = small_list;
+ small_list = result;
+ result++; /* advance past header */
+
+ return (pointer ) result;
+}
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+c_free_small (compress_info_ptr cinfo, pointer ptr)
+#else
+c_free_small (cinfo, ptr)
+ compress_info_ptr cinfo;
+ pointer ptr;
+#endif /* NeedFunctionPrototypes */
+/* Free a "small" object */
+{
+ small_ptr hdr;
+ small_ptr * llink;
+
+ hdr = (small_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &cinfo->small_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ return(XIE_ERR);
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ jfree_small((pointer ) hdr);
+ return(0);
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+d_free_small (decompress_info_ptr cinfo, pointer ptr)
+#else
+d_free_small (cinfo, ptr)
+ decompress_info_ptr cinfo;
+ pointer ptr;
+#endif /* NeedFunctionPrototypes */
+/* Free a "small" object */
+{
+ small_ptr hdr;
+ small_ptr * llink;
+
+ hdr = (small_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &cinfo->small_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ return(XIE_ERR);
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ jfree_small((pointer ) hdr);
+ return(0);
+}
+#else
+METHODDEF void
+free_small (pointer ptr)
+/* Free a "small" object */
+{
+ small_ptr hdr;
+ small_ptr * llink;
+
+ hdr = (small_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &small_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_small request");
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ jfree_small((pointer ) hdr);
+
+#ifdef MEM_STATS
+ cur_num_small--;
+#endif
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Management of "medium-size" objects.
+ * These are just like small objects except they are in the FAR heap.
+ */
+
+#ifndef XIE_SUPPORTED
+#ifdef NEED_ALLOC_MEDIUM
+
+typedef union medium_struct FAR * medium_ptr;
+
+typedef union medium_struct {
+ medium_ptr next; /* next in list of allocated objects */
+ align_type dummy; /* ensures alignment of following storage */
+ } medium_hdr;
+
+static medium_ptr medium_list; /* head of list */
+
+
+METHODDEF pointer
+alloc_medium (size_t sizeofobject)
+/* Allocate a "medium-size" object */
+{
+ medium_ptr result;
+
+ sizeofobject += SIZEOF(medium_hdr); /* add space for header */
+
+#ifdef MEM_STATS
+ total_num_medium++;
+ total_bytes_medium += sizeofobject + MALLOC_FAR_OVERHEAD;
+ cur_num_medium++;
+ if (cur_num_medium > max_num_medium) max_num_medium = cur_num_medium;
+#endif
+
+ result = (medium_ptr) jget_large(sizeofobject);
+ if (result == NULL)
+ out_of_memory(2);
+
+ result->next = medium_list;
+ medium_list = result;
+ result++; /* advance past header */
+
+ return (pointer) result;
+}
+
+
+METHODDEF void
+free_medium (pointer ptr)
+/* Free a "medium-size" object */
+{
+ medium_ptr hdr;
+ medium_ptr FAR * llink;
+
+ hdr = (medium_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &medium_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_medium request");
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ jfree_large((pointer) hdr);
+
+#ifdef MEM_STATS
+ cur_num_medium--;
+#endif
+}
+
+#endif /* NEED_ALLOC_MEDIUM */
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Management of "small" (all-in-memory) 2-D sample arrays.
+ * The pointers are in near heap, the samples themselves in FAR heap.
+ * The header structure is adjacent to the row pointers.
+ * To minimize allocation overhead and to allow I/O of large contiguous
+ * blocks, we allocate the sample rows in groups of as many rows as possible
+ * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request.
+ * Note that the big-array control routines, later in this file, know about
+ * this chunking of rows ... and also how to get the rowsperchunk value!
+ */
+
+
+#ifdef XIE_SUPPORTED
+METHODDEF JSAMPARRAY
+#if NeedFunctionPrototypes
+c_alloc_small_sarray (compress_info_ptr cinfo,
+ long samplesperrow, long numrows)
+#else
+c_alloc_small_sarray (cinfo, samplesperrow, numrows)
+ compress_info_ptr cinfo;
+ long samplesperrow;
+ long numrows;
+#endif /* NeedFunctionPrototypes */
+/* Allocate a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ JSAMPARRAY result;
+ JSAMPROW workspace;
+ long rowsperchunk, currow, i;
+
+ /* Calculate max # of rows allowed in one allocation chunk */
+ rowsperchunk = MAX_ALLOC_CHUNK / (samplesperrow * SIZEOF(JSAMPLE));
+ if (rowsperchunk <= 0)
+ return (JSAMPARRAY) NULL;
+
+ /* Get space for header and row pointers; this is always "near" on 80x86 */
+ hdr = (small_sarray_ptr) c_alloc_small(cinfo,
+ (size_t) (numrows * SIZEOF(JSAMPROW) + SIZEOF(small_sarray_hdr)));
+
+ result = (JSAMPARRAY) (hdr+1); /* advance past header */
+
+ /* Insert into list now so free_all does right thing if I fail */
+ /* after allocating only some of the rows... */
+ hdr->next = cinfo->small_sarray_list;
+ hdr->numrows = 0;
+ hdr->rowsperchunk = rowsperchunk;
+ cinfo->small_sarray_list = hdr;
+
+ /* Get the rows themselves; on 80x86 these are "far" */
+ currow = 0;
+ while (currow < numrows) {
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
+ workspace = (JSAMPROW) jget_large((size_t) (rowsperchunk * samplesperrow
+ * SIZEOF(JSAMPLE)));
+ if (workspace == NULL)
+ return (JSAMPARRAY) workspace;
+ for (i = rowsperchunk; i > 0; i--) {
+ result[currow++] = workspace;
+ workspace += samplesperrow;
+ }
+ hdr->numrows = currow;
+ }
+
+ return result;
+}
+
+METHODDEF JSAMPARRAY
+#if NeedFunctionPrototypes
+d_alloc_small_sarray (decompress_info_ptr cinfo,
+ long samplesperrow, long numrows)
+#else
+d_alloc_small_sarray (cinfo, samplesperrow, numrows)
+ decompress_info_ptr cinfo;
+ long samplesperrow;
+ long numrows;
+#endif /* NeedFunctionPrototypes */
+/* Allocate a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ JSAMPARRAY result;
+ JSAMPROW workspace;
+ long rowsperchunk, currow, i;
+
+ /* Calculate max # of rows allowed in one allocation chunk */
+ rowsperchunk = MAX_ALLOC_CHUNK / (samplesperrow * SIZEOF(JSAMPLE));
+ if (rowsperchunk <= 0)
+ return (JSAMPARRAY) NULL;
+
+ /* Get space for header and row pointers; this is always "near" on 80x86 */
+ hdr = (small_sarray_ptr) d_alloc_small(cinfo,
+ (size_t) (numrows * SIZEOF(JSAMPROW) + SIZEOF(small_sarray_hdr)));
+
+ result = (JSAMPARRAY) (hdr+1); /* advance past header */
+
+ /* Insert into list now so free_all does right thing if I fail */
+ /* after allocating only some of the rows... */
+ hdr->next = cinfo->small_sarray_list;
+ hdr->numrows = 0;
+ hdr->rowsperchunk = rowsperchunk;
+ cinfo->small_sarray_list = hdr;
+
+ /* Get the rows themselves; on 80x86 these are "far" */
+ currow = 0;
+ while (currow < numrows) {
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
+ workspace = (JSAMPROW) jget_large((size_t) (rowsperchunk * samplesperrow
+ * SIZEOF(JSAMPLE)));
+ if (workspace == NULL)
+ return (JSAMPARRAY) workspace;
+ for (i = rowsperchunk; i > 0; i--) {
+ result[currow++] = workspace;
+ workspace += samplesperrow;
+ }
+ hdr->numrows = currow;
+ }
+
+ return result;
+}
+#else
+typedef struct small_sarray_struct * small_sarray_ptr;
+
+typedef struct small_sarray_struct {
+ small_sarray_ptr next; /* next in list of allocated sarrays */
+ long numrows; /* # of rows in this array */
+ long rowsperchunk; /* max # of rows per allocation chunk */
+ JSAMPROW dummy; /* ensures alignment of following storage */
+ } small_sarray_hdr;
+
+static small_sarray_ptr small_sarray_list; /* head of list */
+
+METHODDEF JSAMPARRAY
+alloc_small_sarray (long samplesperrow, long numrows)
+/* Allocate a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ JSAMPARRAY result;
+ JSAMPROW workspace;
+ long rowsperchunk, currow, i;
+
+#ifdef MEM_STATS
+ total_num_sarray++;
+ cur_num_sarray++;
+ if (cur_num_sarray > max_num_sarray) max_num_sarray = cur_num_sarray;
+#endif
+
+ /* Calculate max # of rows allowed in one allocation chunk */
+ rowsperchunk = MAX_ALLOC_CHUNK / (samplesperrow * SIZEOF(JSAMPLE));
+ if (rowsperchunk <= 0)
+ ERREXIT(methods, "Image too wide for this implementation");
+
+ /* Get space for header and row pointers; this is always "near" on 80x86 */
+ hdr = (small_sarray_ptr) alloc_small((size_t) (numrows * SIZEOF(JSAMPROW)
+ + SIZEOF(small_sarray_hdr)));
+
+ result = (JSAMPARRAY) (hdr+1); /* advance past header */
+
+ /* Insert into list now so free_all does right thing if I fail */
+ /* after allocating only some of the rows... */
+ hdr->next = small_sarray_list;
+ hdr->numrows = 0;
+ hdr->rowsperchunk = rowsperchunk;
+ small_sarray_list = hdr;
+
+ /* Get the rows themselves; on 80x86 these are "far" */
+ currow = 0;
+ while (currow < numrows) {
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
+#ifdef MEM_STATS
+ total_bytes_sarray += rowsperchunk * samplesperrow * SIZEOF(JSAMPLE)
+ + MALLOC_FAR_OVERHEAD;
+#endif
+ workspace = (JSAMPROW) jget_large((size_t) (rowsperchunk * samplesperrow
+ * SIZEOF(JSAMPLE)));
+ if (workspace == NULL)
+ out_of_memory(3);
+ for (i = rowsperchunk; i > 0; i--) {
+ result[currow++] = workspace;
+ workspace += samplesperrow;
+ }
+ hdr->numrows = currow;
+ }
+
+ return result;
+}
+#endif /* XIE_SUPPORTED */
+
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+c_free_small_sarray (compress_info_ptr cinfo, JSAMPARRAY ptr)
+#else
+c_free_small_sarray (cinfo, ptr)
+ compress_info_ptr cinfo;
+ JSAMPARRAY ptr;
+#endif /* NeedFunctionPrototypes */
+/* Free a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ small_sarray_ptr * llink;
+ long i;
+
+ hdr = (small_sarray_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &cinfo->small_sarray_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ return(XIE_ERR);
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ /* Free the rows themselves; on 80x86 these are "far" */
+ /* Note we only free the row-group headers! */
+ for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) {
+ jfree_large((pointer) ptr[i]);
+ }
+
+ /* Free header and row pointers */
+ return(c_free_small(cinfo, (pointer ) hdr));
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+d_free_small_sarray (decompress_info_ptr cinfo, JSAMPARRAY ptr)
+#else
+d_free_small_sarray (cinfo, ptr)
+ decompress_info_ptr cinfo;
+ JSAMPARRAY ptr;
+#endif /* NeedFunctionPrototypes */
+/* Free a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ small_sarray_ptr * llink;
+ long i;
+
+ hdr = (small_sarray_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &cinfo->small_sarray_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ return(XIE_ERR);
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ /* Free the rows themselves; on 80x86 these are "far" */
+ /* Note we only free the row-group headers! */
+ for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) {
+ jfree_large((pointer) ptr[i]);
+ }
+
+ /* Free header and row pointers */
+ return(d_free_small(cinfo, (pointer ) hdr));
+}
+
+#else
+METHODDEF void
+free_small_sarray (JSAMPARRAY ptr)
+/* Free a "small" (all-in-memory) 2-D sample array */
+{
+ small_sarray_ptr hdr;
+ small_sarray_ptr * llink;
+ long i;
+
+ hdr = (small_sarray_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &small_sarray_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_small_sarray request");
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ /* Free the rows themselves; on 80x86 these are "far" */
+ /* Note we only free the row-group headers! */
+ for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) {
+ jfree_large((pointer) ptr[i]);
+ }
+
+ /* Free header and row pointers */
+ free_small((pointer ) hdr);
+
+#ifdef MEM_STATS
+ cur_num_sarray--;
+#endif
+}
+
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Management of "small" (all-in-memory) 2-D coefficient-block arrays.
+ * This is essentially the same as the code for sample arrays, above.
+ */
+
+
+#ifdef XIE_SUPPORTED
+METHODDEF JBLOCKARRAY
+#if NeedFunctionPrototypes
+d_alloc_small_barray (decompress_info_ptr cinfo,
+ long blocksperrow, long numrows)
+#else
+d_alloc_small_barray (cinfo, blocksperrow, numrows)
+ decompress_info_ptr cinfo;
+ long blocksperrow;
+ long numrows;
+#endif /* NeedFunctionPrototypes */
+/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */
+{
+ small_barray_ptr hdr;
+ JBLOCKARRAY result;
+ JBLOCKROW workspace;
+ long rowsperchunk, currow, i;
+
+ /* Calculate max # of rows allowed in one allocation chunk */
+ rowsperchunk = MAX_ALLOC_CHUNK / (blocksperrow * SIZEOF(JBLOCK));
+ if (rowsperchunk <= 0)
+ return (JBLOCKARRAY) NULL;
+
+ /* Get space for header and row pointers; this is always "near" on 80x86 */
+ hdr = (small_barray_ptr) d_alloc_small(cinfo,
+ (size_t) (numrows * SIZEOF(JBLOCKROW) + SIZEOF(small_barray_hdr)));
+
+ result = (JBLOCKARRAY) (hdr+1); /* advance past header */
+
+ /* Insert into list now so free_all does right thing if I fail */
+ /* after allocating only some of the rows... */
+ hdr->next = cinfo->small_barray_list;
+ hdr->numrows = 0;
+ hdr->rowsperchunk = rowsperchunk;
+ cinfo->small_barray_list = hdr;
+
+ /* Get the rows themselves; on 80x86 these are "far" */
+ currow = 0;
+ while (currow < numrows) {
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
+ workspace = (JBLOCKROW) jget_large((size_t) (rowsperchunk * blocksperrow
+ * SIZEOF(JBLOCK)));
+ if (workspace == NULL)
+ return (JBLOCKARRAY) workspace;
+ for (i = rowsperchunk; i > 0; i--) {
+ result[currow++] = workspace;
+ workspace += blocksperrow;
+ }
+ hdr->numrows = currow;
+ }
+
+ return result;
+}
+
+#else
+typedef struct small_barray_struct * small_barray_ptr;
+
+typedef struct small_barray_struct {
+ small_barray_ptr next; /* next in list of allocated barrays */
+ long numrows; /* # of rows in this array */
+ long rowsperchunk; /* max # of rows per allocation chunk */
+ JBLOCKROW dummy; /* ensures alignment of following storage */
+ } small_barray_hdr;
+
+static small_barray_ptr small_barray_list; /* head of list */
+
+METHODDEF JBLOCKARRAY
+alloc_small_barray (long blocksperrow, long numrows)
+/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */
+{
+ small_barray_ptr hdr;
+ JBLOCKARRAY result;
+ JBLOCKROW workspace;
+ long rowsperchunk, currow, i;
+
+#ifdef MEM_STATS
+ total_num_barray++;
+ cur_num_barray++;
+ if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray;
+#endif
+
+ /* Calculate max # of rows allowed in one allocation chunk */
+ rowsperchunk = MAX_ALLOC_CHUNK / (blocksperrow * SIZEOF(JBLOCK));
+ if (rowsperchunk <= 0)
+ ERREXIT(methods, "Image too wide for this implementation");
+
+ /* Get space for header and row pointers; this is always "near" on 80x86 */
+ hdr = (small_barray_ptr) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW)
+ + SIZEOF(small_barray_hdr)));
+
+ result = (JBLOCKARRAY) (hdr+1); /* advance past header */
+
+ /* Insert into list now so free_all does right thing if I fail */
+ /* after allocating only some of the rows... */
+ hdr->next = small_barray_list;
+ hdr->numrows = 0;
+ hdr->rowsperchunk = rowsperchunk;
+ small_barray_list = hdr;
+
+ /* Get the rows themselves; on 80x86 these are "far" */
+ currow = 0;
+ while (currow < numrows) {
+ rowsperchunk = MIN(rowsperchunk, numrows - currow);
+#ifdef MEM_STATS
+ total_bytes_barray += rowsperchunk * blocksperrow * SIZEOF(JBLOCK)
+ + MALLOC_FAR_OVERHEAD;
+#endif
+ workspace = (JBLOCKROW) jget_large((size_t) (rowsperchunk * blocksperrow
+ * SIZEOF(JBLOCK)));
+ if (workspace == NULL)
+ out_of_memory(4);
+ for (i = rowsperchunk; i > 0; i--) {
+ result[currow++] = workspace;
+ workspace += blocksperrow;
+ }
+ hdr->numrows = currow;
+ }
+
+ return result;
+}
+
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+d_free_small_barray (decompress_info_ptr cinfo, JBLOCKARRAY ptr)
+#else
+d_free_small_barray (cinfo, ptr)
+ decompress_info_ptr cinfo;
+ JBLOCKARRAY ptr;
+#endif /* NeedFunctionPrototypes */
+/* Free a "small" (all-in-memory) 2-D coefficient-block array */
+{
+ small_barray_ptr hdr;
+ small_barray_ptr * llink;
+ long i;
+
+ hdr = (small_barray_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &cinfo->small_barray_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ return(XIE_ERR);
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ /* Free the rows themselves; on 80x86 these are "far" */
+ /* Note we only free the row-group headers! */
+ for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) {
+ jfree_large((pointer) ptr[i]);
+ }
+
+ /* Free header and row pointers */
+ return(d_free_small(cinfo, (pointer ) hdr));
+}
+
+#else
+METHODDEF void
+free_small_barray (JBLOCKARRAY ptr)
+/* Free a "small" (all-in-memory) 2-D coefficient-block array */
+{
+ small_barray_ptr hdr;
+ small_barray_ptr * llink;
+ long i;
+
+ hdr = (small_barray_ptr) ptr;
+ hdr--; /* point back to header */
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &small_barray_list;
+ while (*llink != hdr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_small_barray request");
+ llink = &( (*llink)->next );
+ }
+ *llink = hdr->next;
+
+ /* Free the rows themselves; on 80x86 these are "far" */
+ /* Note we only free the row-group headers! */
+ for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) {
+ jfree_large((pointer) ptr[i]);
+ }
+
+ /* Free header and row pointers */
+ free_small((pointer ) hdr);
+
+#ifdef MEM_STATS
+ cur_num_barray--;
+#endif
+}
+
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * About "big" array management:
+ *
+ * To allow machines with limited memory to handle large images,
+ * all processing in the JPEG system is done a few pixel or block rows
+ * at a time. The above "small" array routines are only used to allocate
+ * strip buffers (as wide as the image, but just a few rows high).
+ * In some cases multiple passes must be made over the data. In these
+ * cases the "big" array routines are used. The array is still accessed
+ * a strip at a time, but the memory manager must save the whole array
+ * for repeated accesses. The intended implementation is that there is
+ * a strip buffer in memory (as high as is possible given the desired memory
+ * limit), plus a backing file that holds the rest of the array.
+ *
+ * The request_big_array routines are told the total size of the image (in case
+ * it is useful to know the total file size that will be needed). They are
+ * also given the unit height, which is the number of rows that will be
+ * accessed at once; the in-memory buffer should be made a multiple of
+ * this height for best efficiency.
+ *
+ * The request routines create control blocks (and may open backing files),
+ * but they don't create the in-memory buffers. This is postponed until
+ * alloc_big_arrays is called. At that time the total amount of space needed
+ * is known (approximately, anyway), so free memory can be divided up fairly.
+ *
+ * The access_big_array routines are responsible for making a specific strip
+ * area accessible (after reading or writing the backing file, if necessary).
+ * Note that the access routines are told whether the caller intends to modify
+ * the accessed strip; during a read-only pass this saves having to rewrite
+ * data to disk.
+ *
+ * The typical access pattern is one top-to-bottom pass to write the data,
+ * followed by one or more read-only top-to-bottom passes. However, other
+ * access patterns may occur while reading. For example, translation of image
+ * formats that use bottom-to-top scan order will require bottom-to-top read
+ * passes. The memory manager need not support multiple write passes nor
+ * funny write orders (meaning that rearranging rows must be handled while
+ * reading data out of the big array, not while putting it in).
+ *
+ * In current usage, the access requests are always for nonoverlapping strips;
+ * that is, successive access start_row numbers always differ by exactly the
+ * unitheight. This allows fairly simple buffer dump/reload logic if the
+ * in-memory buffer is made a multiple of the unitheight. It would be
+ * possible to keep downsampled rather than fullsize data in the "big" arrays,
+ * thus reducing temp file size, if we supported overlapping strip access
+ * (access requests differing by less than the unitheight). At the moment
+ * I don't believe this is worth the extra complexity.
+ */
+
+
+
+/* The control blocks for virtual arrays.
+ * System-dependent info for the associated backing store is hidden inside
+ * the backing_store_info struct.
+ */
+
+#ifndef XIE_SUPPORTED
+struct big_sarray_control {
+ long rows_in_array; /* total virtual array height */
+ long samplesperrow; /* width of array (and of memory buffer) */
+ long unitheight; /* # of rows accessed by access_big_sarray() */
+ JSAMPARRAY mem_buffer; /* the in-memory buffer */
+ long rows_in_mem; /* height of memory buffer */
+ long rowsperchunk; /* allocation chunk size in mem_buffer */
+ long cur_start_row; /* first logical row # in the buffer */
+ boolean dirty; /* do current buffer contents need written? */
+ boolean b_s_open; /* is backing-store data valid? */
+ big_sarray_ptr next; /* link to next big sarray control block */
+ backing_store_info b_s_info; /* System-dependent control info */
+};
+
+static big_sarray_ptr big_sarray_list; /* head of list */
+
+struct big_barray_control {
+ long rows_in_array; /* total virtual array height */
+ long blocksperrow; /* width of array (and of memory buffer) */
+ long unitheight; /* # of rows accessed by access_big_barray() */
+ JBLOCKARRAY mem_buffer; /* the in-memory buffer */
+ long rows_in_mem; /* height of memory buffer */
+ long rowsperchunk; /* allocation chunk size in mem_buffer */
+ long cur_start_row; /* first logical row # in the buffer */
+ boolean dirty; /* do current buffer contents need written? */
+ boolean b_s_open; /* is backing-store data valid? */
+ big_barray_ptr next; /* link to next big barray control block */
+ backing_store_info b_s_info; /* System-dependent control info */
+};
+
+static big_barray_ptr big_barray_list; /* head of list */
+
+
+METHODDEF big_sarray_ptr
+request_big_sarray (long samplesperrow, long numrows, long unitheight)
+/* Request a "big" (virtual-memory) 2-D sample array */
+{
+ big_sarray_ptr result;
+
+ /* get control block */
+ result = (big_sarray_ptr) alloc_small(SIZEOF(struct big_sarray_control));
+
+ result->rows_in_array = numrows;
+ result->samplesperrow = samplesperrow;
+ result->unitheight = unitheight;
+ result->mem_buffer = NULL; /* marks array not yet realized */
+ result->b_s_open = FALSE; /* no associated backing-store object */
+ result->next = big_sarray_list; /* add to list of big arrays */
+ big_sarray_list = result;
+
+ return result;
+}
+
+
+METHODDEF big_barray_ptr
+request_big_barray (long blocksperrow, long numrows, long unitheight)
+/* Request a "big" (virtual-memory) 2-D coefficient-block array */
+{
+ big_barray_ptr result;
+
+ /* get control block */
+ result = (big_barray_ptr) alloc_small(SIZEOF(struct big_barray_control));
+
+ result->rows_in_array = numrows;
+ result->blocksperrow = blocksperrow;
+ result->unitheight = unitheight;
+ result->mem_buffer = NULL; /* marks array not yet realized */
+ result->b_s_open = FALSE; /* no associated backing-store object */
+ result->next = big_barray_list; /* add to list of big arrays */
+ big_barray_list = result;
+
+ return result;
+}
+
+
+METHODDEF void
+alloc_big_arrays (long extra_small_samples, long extra_small_blocks,
+ long extra_medium_space)
+/* Allocate the in-memory buffers for any unrealized "big" arrays */
+/* 'extra' values are upper bounds for total future small-array requests */
+/* and far-heap requests */
+{
+ long total_extra_space = extra_small_samples * SIZEOF(JSAMPLE)
+ + extra_small_blocks * SIZEOF(JBLOCK)
+ + extra_medium_space;
+ long space_per_unitheight, maximum_space, avail_mem;
+ long unitheights, max_unitheights;
+ big_sarray_ptr sptr;
+ big_barray_ptr bptr;
+
+ /* Compute the minimum space needed (unitheight rows in each buffer)
+ * and the maximum space needed (full image height in each buffer).
+ * These may be of use to the system-dependent jmem_available routine.
+ */
+ space_per_unitheight = 0;
+ maximum_space = total_extra_space;
+ for (sptr = big_sarray_list; sptr != NULL; sptr = sptr->next) {
+ if (sptr->mem_buffer == NULL) { /* if not realized yet */
+ space_per_unitheight += sptr->unitheight *
+ sptr->samplesperrow * SIZEOF(JSAMPLE);
+ maximum_space += sptr->rows_in_array *
+ sptr->samplesperrow * SIZEOF(JSAMPLE);
+ }
+ }
+ for (bptr = big_barray_list; bptr != NULL; bptr = bptr->next) {
+ if (bptr->mem_buffer == NULL) { /* if not realized yet */
+ space_per_unitheight += bptr->unitheight *
+ bptr->blocksperrow * SIZEOF(JBLOCK);
+ maximum_space += bptr->rows_in_array *
+ bptr->blocksperrow * SIZEOF(JBLOCK);
+ }
+ }
+
+ if (space_per_unitheight <= 0)
+ return; /* no unrealized arrays, no work */
+
+ /* Determine amount of memory to actually use; this is system-dependent. */
+ avail_mem = jmem_available(space_per_unitheight + total_extra_space,
+ maximum_space);
+
+ /* If the maximum space needed is available, make all the buffers full
+ * height; otherwise parcel it out with the same number of unitheights
+ * in each buffer.
+ */
+ if (avail_mem >= maximum_space)
+ max_unitheights = 1000000000L;
+ else {
+ max_unitheights = (avail_mem - total_extra_space) / space_per_unitheight;
+ /* If there doesn't seem to be enough space, try to get the minimum
+ * anyway. This allows a "stub" implementation of jmem_available().
+ */
+ if (max_unitheights <= 0)
+ max_unitheights = 1;
+ }
+
+ /* Allocate the in-memory buffers and initialize backing store as needed. */
+
+ for (sptr = big_sarray_list; sptr != NULL; sptr = sptr->next) {
+ if (sptr->mem_buffer == NULL) { /* if not realized yet */
+ unitheights = (sptr->rows_in_array + sptr->unitheight - 1L)
+ / sptr->unitheight;
+ if (unitheights <= max_unitheights) {
+ /* This buffer fits in memory */
+ sptr->rows_in_mem = sptr->rows_in_array;
+ } else {
+ /* It doesn't fit in memory, create backing store. */
+ sptr->rows_in_mem = max_unitheights * sptr->unitheight;
+ jopen_backing_store(& sptr->b_s_info,
+ (long) (sptr->rows_in_array *
+ sptr->samplesperrow * SIZEOF(JSAMPLE)));
+ sptr->b_s_open = TRUE;
+ }
+ sptr->mem_buffer = alloc_small_sarray(sptr->samplesperrow,
+ sptr->rows_in_mem);
+ /* Reach into the small_sarray header and get the rowsperchunk field.
+ * Yes, I know, this is horrible coding practice.
+ */
+ sptr->rowsperchunk =
+ ((small_sarray_ptr) sptr->mem_buffer)[-1].rowsperchunk;
+ sptr->cur_start_row = 0;
+ sptr->dirty = FALSE;
+ }
+ }
+
+ for (bptr = big_barray_list; bptr != NULL; bptr = bptr->next) {
+ if (bptr->mem_buffer == NULL) { /* if not realized yet */
+ unitheights = (bptr->rows_in_array + bptr->unitheight - 1L)
+ / bptr->unitheight;
+ if (unitheights <= max_unitheights) {
+ /* This buffer fits in memory */
+ bptr->rows_in_mem = bptr->rows_in_array;
+ } else {
+ /* It doesn't fit in memory, create backing store. */
+ bptr->rows_in_mem = max_unitheights * bptr->unitheight;
+ jopen_backing_store(& bptr->b_s_info,
+ (long) (bptr->rows_in_array *
+ bptr->blocksperrow * SIZEOF(JBLOCK)));
+ bptr->b_s_open = TRUE;
+ }
+ bptr->mem_buffer = alloc_small_barray(bptr->blocksperrow,
+ bptr->rows_in_mem);
+ /* Reach into the small_barray header and get the rowsperchunk field. */
+ bptr->rowsperchunk =
+ ((small_barray_ptr) bptr->mem_buffer)[-1].rowsperchunk;
+ bptr->cur_start_row = 0;
+ bptr->dirty = FALSE;
+ }
+ }
+}
+
+
+LOCAL void
+do_sarray_io (big_sarray_ptr ptr, boolean writing)
+/* Do backing store read or write of a "big" sample array */
+{
+ long bytesperrow, file_offset, byte_count, rows, i;
+
+ bytesperrow = ptr->samplesperrow * SIZEOF(JSAMPLE);
+ file_offset = ptr->cur_start_row * bytesperrow;
+ /* Loop to read or write each allocation chunk in mem_buffer */
+ for (i = 0; i < ptr->rows_in_mem; i += ptr->rowsperchunk) {
+ /* One chunk, but check for short chunk at end of buffer */
+ rows = MIN(ptr->rowsperchunk, ptr->rows_in_mem - i);
+ /* Transfer no more than fits in file */
+ rows = MIN(rows, ptr->rows_in_array - (ptr->cur_start_row + i));
+ if (rows <= 0) /* this chunk might be past end of file! */
+ break;
+ byte_count = rows * bytesperrow;
+ if (writing)
+ (*ptr->b_s_info.write_backing_store) (& ptr->b_s_info,
+ (pointer) ptr->mem_buffer[i],
+ file_offset, byte_count);
+ else
+ (*ptr->b_s_info.read_backing_store) (& ptr->b_s_info,
+ (pointer) ptr->mem_buffer[i],
+ file_offset, byte_count);
+ file_offset += byte_count;
+ }
+}
+
+
+LOCAL void
+do_barray_io (big_barray_ptr ptr, boolean writing)
+/* Do backing store read or write of a "big" coefficient-block array */
+{
+ long bytesperrow, file_offset, byte_count, rows, i;
+
+ bytesperrow = ptr->blocksperrow * SIZEOF(JBLOCK);
+ file_offset = ptr->cur_start_row * bytesperrow;
+ /* Loop to read or write each allocation chunk in mem_buffer */
+ for (i = 0; i < ptr->rows_in_mem; i += ptr->rowsperchunk) {
+ /* One chunk, but check for short chunk at end of buffer */
+ rows = MIN(ptr->rowsperchunk, ptr->rows_in_mem - i);
+ /* Transfer no more than fits in file */
+ rows = MIN(rows, ptr->rows_in_array - (ptr->cur_start_row + i));
+ if (rows <= 0) /* this chunk might be past end of file! */
+ break;
+ byte_count = rows * bytesperrow;
+ if (writing)
+ (*ptr->b_s_info.write_backing_store) (& ptr->b_s_info,
+ (pointer) ptr->mem_buffer[i],
+ file_offset, byte_count);
+ else
+ (*ptr->b_s_info.read_backing_store) (& ptr->b_s_info,
+ (pointer) ptr->mem_buffer[i],
+ file_offset, byte_count);
+ file_offset += byte_count;
+ }
+}
+
+
+METHODDEF JSAMPARRAY
+access_big_sarray (big_sarray_ptr ptr, long start_row, boolean writable)
+/* Access the part of a "big" sample array starting at start_row */
+/* and extending for ptr->unitheight rows. writable is true if */
+/* caller intends to modify the accessed area. */
+{
+ /* debugging check */
+ if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_array ||
+ ptr->mem_buffer == NULL)
+ ERREXIT(methods, "Bogus access_big_sarray request");
+
+ /* Make the desired part of the virtual array accessible */
+ if (start_row < ptr->cur_start_row ||
+ start_row+ptr->unitheight > ptr->cur_start_row+ptr->rows_in_mem) {
+ if (! ptr->b_s_open)
+ ERREXIT(methods, "Virtual array controller messed up");
+ /* Flush old buffer contents if necessary */
+ if (ptr->dirty) {
+ do_sarray_io(ptr, TRUE);
+ ptr->dirty = FALSE;
+ }
+ /* Decide what part of virtual array to access.
+ * Algorithm: if target address > current window, assume forward scan,
+ * load starting at target address. If target address < current window,
+ * assume backward scan, load so that target address is top of window.
+ * Note that when switching from forward write to forward read, will have
+ * start_row = 0, so the limiting case applies and we load from 0 anyway.
+ */
+ if (start_row > ptr->cur_start_row) {
+ ptr->cur_start_row = start_row;
+ } else {
+ ptr->cur_start_row = start_row + ptr->unitheight - ptr->rows_in_mem;
+ if (ptr->cur_start_row < 0)
+ ptr->cur_start_row = 0; /* don't fall off front end of file */
+ }
+ /* If reading, read in the selected part of the array.
+ * If we are writing, we need not pre-read the selected portion,
+ * since the access sequence constraints ensure it would be garbage.
+ */
+ if (! writable) {
+ do_sarray_io(ptr, FALSE);
+ }
+ }
+ /* Flag the buffer dirty if caller will write in it */
+ if (writable)
+ ptr->dirty = TRUE;
+ /* Return address of proper part of the buffer */
+ return ptr->mem_buffer + (start_row - ptr->cur_start_row);
+}
+
+
+METHODDEF JBLOCKARRAY
+access_big_barray (big_barray_ptr ptr, long start_row, boolean writable)
+/* Access the part of a "big" coefficient-block array starting at start_row */
+/* and extending for ptr->unitheight rows. writable is true if */
+/* caller intends to modify the accessed area. */
+{
+ /* debugging check */
+ if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_array ||
+ ptr->mem_buffer == NULL)
+ ERREXIT(methods, "Bogus access_big_barray request");
+
+ /* Make the desired part of the virtual array accessible */
+ if (start_row < ptr->cur_start_row ||
+ start_row+ptr->unitheight > ptr->cur_start_row+ptr->rows_in_mem) {
+ if (! ptr->b_s_open)
+ ERREXIT(methods, "Virtual array controller messed up");
+ /* Flush old buffer contents if necessary */
+ if (ptr->dirty) {
+ do_barray_io(ptr, TRUE);
+ ptr->dirty = FALSE;
+ }
+ /* Decide what part of virtual array to access.
+ * Algorithm: if target address > current window, assume forward scan,
+ * load starting at target address. If target address < current window,
+ * assume backward scan, load so that target address is top of window.
+ * Note that when switching from forward write to forward read, will have
+ * start_row = 0, so the limiting case applies and we load from 0 anyway.
+ */
+ if (start_row > ptr->cur_start_row) {
+ ptr->cur_start_row = start_row;
+ } else {
+ ptr->cur_start_row = start_row + ptr->unitheight - ptr->rows_in_mem;
+ if (ptr->cur_start_row < 0)
+ ptr->cur_start_row = 0; /* don't fall off front end of file */
+ }
+ /* If reading, read in the selected part of the array.
+ * If we are writing, we need not pre-read the selected portion,
+ * since the access sequence constraints ensure it would be garbage.
+ */
+ if (! writable) {
+ do_barray_io(ptr, FALSE);
+ }
+ }
+ /* Flag the buffer dirty if caller will write in it */
+ if (writable)
+ ptr->dirty = TRUE;
+ /* Return address of proper part of the buffer */
+ return ptr->mem_buffer + (start_row - ptr->cur_start_row);
+}
+
+
+METHODDEF void
+free_big_sarray (big_sarray_ptr ptr)
+/* Free a "big" (virtual-memory) 2-D sample array */
+{
+ big_sarray_ptr * llink;
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &big_sarray_list;
+ while (*llink != ptr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_big_sarray request");
+ llink = &( (*llink)->next );
+ }
+ *llink = ptr->next;
+
+ if (ptr->b_s_open) /* there may be no backing store */
+ (*ptr->b_s_info.close_backing_store) (& ptr->b_s_info);
+
+ if (ptr->mem_buffer != NULL) /* just in case never realized */
+ free_small_sarray(ptr->mem_buffer);
+
+ free_small((pointer ) ptr); /* free the control block too */
+}
+
+
+METHODDEF void
+free_big_barray (big_barray_ptr ptr)
+/* Free a "big" (virtual-memory) 2-D coefficient-block array */
+{
+ big_barray_ptr * llink;
+
+ /* Remove item from list -- linear search is fast enough */
+ llink = &big_barray_list;
+ while (*llink != ptr) {
+ if (*llink == NULL)
+ ERREXIT(methods, "Bogus free_big_barray request");
+ llink = &( (*llink)->next );
+ }
+ *llink = ptr->next;
+
+ if (ptr->b_s_open) /* there may be no backing store */
+ (*ptr->b_s_info.close_backing_store) (& ptr->b_s_info);
+
+ if (ptr->mem_buffer != NULL) /* just in case never realized */
+ free_small_barray(ptr->mem_buffer);
+
+ free_small((pointer ) ptr); /* free the control block too */
+}
+
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Cleanup: free anything that's been allocated since jselmemmgr().
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+c_free_all (compress_info_ptr cinfo)
+#else
+c_free_all (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* Free any open small arrays -- these may release small objects */
+ /* +1's are because we must pass a pointer to the data, not the header */
+ while (cinfo->small_sarray_list != NULL) {
+ if ((c_free_small_sarray(cinfo,
+ (JSAMPARRAY) (cinfo->small_sarray_list + 1))) < 0)
+ return(XIE_ERR);
+ }
+ /* Free any remaining small objects */
+ while (cinfo->small_list != NULL) {
+ if ((c_free_small(cinfo,
+ (pointer ) (cinfo->small_list + 1))) < 0)
+ return(XIE_ERR);
+ }
+
+ jmem_term(); /* system-dependent cleanup */
+ return(XIE_NRML);
+
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+d_free_all (decompress_info_ptr cinfo)
+#else
+d_free_all (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ /* Free any open small arrays -- these may release small objects */
+ /* +1's are because we must pass a pointer to the data, not the header */
+ while (cinfo->small_sarray_list != NULL) {
+ if ((d_free_small_sarray(cinfo,
+ (JSAMPARRAY) (cinfo->small_sarray_list + 1))) < 0)
+ return(XIE_ERR);
+ }
+ while (cinfo->small_barray_list != NULL) {
+ if ((d_free_small_barray(cinfo,
+ (JBLOCKARRAY) (cinfo->small_barray_list + 1))) < 0)
+ return(XIE_ERR);
+ }
+ /* Free any remaining small objects */
+ while (cinfo->small_list != NULL) {
+ if ((d_free_small(cinfo,
+ (pointer ) (cinfo->small_list + 1))) < 0)
+ return(XIE_ERR);
+ }
+
+ jmem_term(); /* system-dependent cleanup */
+ return(XIE_NRML);
+
+}
+
+#else
+METHODDEF void
+free_all (void)
+{
+ /* First free any open "big" arrays -- these may release small arrays */
+ while (big_sarray_list != NULL)
+ free_big_sarray(big_sarray_list);
+ while (big_barray_list != NULL)
+ free_big_barray(big_barray_list);
+ /* Free any open small arrays -- these may release small objects */
+ /* +1's are because we must pass a pointer to the data, not the header */
+ while (small_sarray_list != NULL)
+ free_small_sarray((JSAMPARRAY) (small_sarray_list + 1));
+ while (small_barray_list != NULL)
+ free_small_barray((JBLOCKARRAY) (small_barray_list + 1));
+ /* Free any remaining small objects */
+ while (small_list != NULL)
+ free_small((pointer ) (small_list + 1));
+#ifdef NEED_ALLOC_MEDIUM
+ while (medium_list != NULL)
+ free_medium((pointer) (medium_list + 1));
+#endif
+
+ jmem_term(); /* system-dependent cleanup */
+
+#ifdef MEM_STATS
+ if (methods->trace_level > 0)
+ print_mem_stats(); /* print optional memory usage statistics */
+#endif
+}
+
+#endif /* XIE_SUPPORTED */
+
+/*
+ * The method selection routine for virtual memory systems.
+ * The system-dependent setup routine should call this routine
+ * to install the necessary method pointers in the supplied struct.
+ */
+
+#ifdef XIE_SUPPORTED
+GLOBAL void
+#if NeedFunctionPrototypes
+jcselmemmgr (compress_info_ptr cinfo, external_methods_ptr emethods)
+#else
+jcselmemmgr (cinfo, emethods)
+ compress_info_ptr cinfo;
+ external_methods_ptr emethods;
+#endif /* NeedFunctionPrototypes */
+{
+
+ emethods->c_alloc_small = c_alloc_small;
+ emethods->c_free_small = c_free_small;
+ emethods->c_alloc_small_sarray = c_alloc_small_sarray;
+ emethods->c_free_small_sarray = c_free_small_sarray;
+ emethods->c_free_all = c_free_all;
+
+ /* Initialize list headers to empty */
+ cinfo->small_list = NULL;
+ cinfo->small_sarray_list = NULL;
+ cinfo->small_barray_list = NULL;
+
+ emethods->max_memory_to_use = 0;
+
+}
+
+GLOBAL void
+#if NeedFunctionPrototypes
+jdselmemmgr (decompress_info_ptr cinfo, external_methods_ptr emethods)
+#else
+jdselmemmgr (cinfo, emethods)
+ decompress_info_ptr cinfo;
+ external_methods_ptr emethods;
+#endif /* NeedFunctionPrototypes */
+{
+
+ emethods->d_alloc_small = d_alloc_small;
+ emethods->d_free_small = d_free_small;
+ emethods->d_alloc_small_sarray = d_alloc_small_sarray;
+ emethods->d_free_small_sarray = d_free_small_sarray;
+ emethods->d_alloc_small_barray = d_alloc_small_barray;
+ emethods->d_free_small_barray = d_free_small_barray;
+ emethods->d_free_all = d_free_all;
+
+ /* Initialize list headers to empty */
+ cinfo->small_list = NULL;
+ cinfo->small_sarray_list = NULL;
+ cinfo->small_barray_list = NULL;
+
+ emethods->max_memory_to_use = 0;
+
+}
+#else
+GLOBAL void
+jselmemmgr (external_methods_ptr emethods)
+{
+ methods = emethods; /* save struct addr for error exit access */
+
+ emethods->alloc_small = alloc_small;
+ emethods->free_small = free_small;
+#ifdef NEED_ALLOC_MEDIUM
+ emethods->alloc_medium = alloc_medium;
+ emethods->free_medium = free_medium;
+#else
+ emethods->alloc_medium = alloc_small;
+ emethods->free_medium = free_small;
+#endif
+ emethods->alloc_small_sarray = alloc_small_sarray;
+ emethods->free_small_sarray = free_small_sarray;
+ emethods->alloc_small_barray = alloc_small_barray;
+ emethods->free_small_barray = free_small_barray;
+ emethods->request_big_sarray = request_big_sarray;
+ emethods->request_big_barray = request_big_barray;
+ emethods->alloc_big_arrays = alloc_big_arrays;
+ emethods->access_big_sarray = access_big_sarray;
+ emethods->access_big_barray = access_big_barray;
+ emethods->free_big_sarray = free_big_sarray;
+ emethods->free_big_barray = free_big_barray;
+ emethods->free_all = free_all;
+
+ /* Initialize list headers to empty */
+ small_list = NULL;
+#ifdef NEED_ALLOC_MEDIUM
+ medium_list = NULL;
+#endif
+ small_sarray_list = NULL;
+ small_barray_list = NULL;
+ big_sarray_list = NULL;
+ big_barray_list = NULL;
+
+ jmem_init(emethods); /* system-dependent initialization */
+
+ /* Check for an environment variable JPEGMEM; if found, override the
+ * default max_memory setting from jmem_init. Note that a command line
+ * -m argument may again override this value.
+ * If your system doesn't support getenv(), define NO_GETENV to disable
+ * this feature.
+ */
+#ifndef NO_GETENV
+ { char * memenv;
+
+ if ((memenv = getenv("JPEGMEM")) != NULL) {
+ long lval;
+ char ch = 'x';
+
+ if (sscanf(memenv, "%ld%c", &lval, &ch) > 0) {
+ if (ch == 'm' || ch == 'M')
+ lval *= 1000L;
+ emethods->max_memory_to_use = lval * 1000L;
+ }
+ }
+ }
+#endif
+
+}
+#endif /* XIE_SUPPORTED */
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c b/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c
new file mode 100644
index 000000000..330acf228
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c
@@ -0,0 +1,229 @@
+/* $TOG: jmemsys.c /main/5 1998/02/09 16:20:19 kaleb $ */
+/* Module jmemsys.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.c,v 3.2 1998/10/04 09:36:23 dawes Exp $ */
+
+/*
+ * jmemnobs.c (jmemsys.c)
+ *
+ * Copyright (C) 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file provides a really simple implementation of the system-
+ * dependent portion of the JPEG memory manager. This implementation
+ * assumes that no backing-store files are needed: all required space
+ * can be obtained from malloc().
+ * This is very portable in the sense that it'll compile on almost anything,
+ * but you'd better have lots of main memory (or virtual memory) if you want
+ * to process big images.
+ * Note that the max_memory_to_use option is ignored by this implementation.
+ */
+
+#include "jinclude.h"
+#include "jmemsys.h"
+
+#ifdef _XIEC_MEMORY
+#include <memory.h>
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef free
+#undef free
+#endif
+#define malloc(size) XieMalloc(size)
+#define free(ptr) XieFree(ptr)
+#else
+#ifdef INCLUDES_ARE_ANSI
+#include <stdlib.h> /* to declare malloc(), free() */
+#else
+extern pointer malloc PP((size_t size));
+extern void free PP(pointer ptr));
+#endif
+#endif /* _XIEC_MEMORY */
+
+
+#ifndef XIE_SUPPORTED
+static external_methods_ptr methods; /* saved for access to error_exit */
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Memory allocation and freeing are controlled by the regular library
+ * routines malloc() and free().
+ */
+
+GLOBAL pointer
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jget_small (size_t sizeofobject)
+#else
+jget_small (sizeofobject)
+ size_t sizeofobject;
+#endif /* NeedFunctionPrototypes */
+#else
+jget_small (size_t sizeofobject)
+#endif /* XIE_SUPPORTED */
+{
+ return (pointer) malloc(sizeofobject);
+}
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jfree_small (pointer object)
+#else
+jfree_small (object)
+ pointer object;
+#endif /* NeedFunctionPrototypes */
+#else
+jfree_small (pointer object)
+#endif /* XIE_SUPPORTED */
+{
+ free(object);
+}
+
+/*
+ * We assume NEED_FAR_POINTERS is not defined and so the separate entry points
+ * jget_large, jfree_large are not needed.
+ */
+
+
+/*
+ * This routine computes the total memory space available for allocation.
+ * Here we always say, "we got all you want bud!"
+ */
+
+#ifndef XIE_SUPPORTED
+GLOBAL long
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jmem_available (long min_bytes_needed, long max_bytes_needed)
+#else
+jmem_available (min_bytes_needed, max_bytes_needed)
+ long min_bytes_needed;
+ long max_bytes_needed;
+#endif /* NeedFunctionPrototypes */
+#else
+jmem_available (long min_bytes_needed, long max_bytes_needed)
+#endif /* XIE_SUPPORTED */
+{
+ return max_bytes_needed;
+}
+
+
+/*
+ * Backing store (temporary file) management.
+ * This should never be called and we just error out.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
+#else
+jopen_backing_store (info, total_bytes_needed)
+ backing_store_ptr info;
+ long total_bytes_needed;
+#endif /* NeedFunctionPrototypes */
+#else
+jopen_backing_store (backing_store_ptr info, long total_bytes_needed)
+#endif /* XIE_SUPPORTED */
+{
+ ERREXIT(methods, "Backing store not supported");
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required. Keep in mind that jmem_term may be called more than
+ * once.
+ */
+
+#ifndef XIE_SUPPORTED
+GLOBAL void
+jmem_init (external_methods_ptr emethods)
+{
+ methods = emethods; /* save struct addr for error exit access */
+ emethods->max_memory_to_use = 0;
+}
+#endif /* XIE_SUPPORTED */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jmem_term (void)
+#else
+jmem_term ()
+#endif /* NeedFunctionPrototypes */
+#else
+jmem_term (void)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work */
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.h b/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.h
new file mode 100644
index 000000000..0c127bfee
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jmemsys.h
@@ -0,0 +1,198 @@
+/* $TOG: jmemsys.h /main/5 1998/02/09 16:20:23 kaleb $ */
+/* Module jmemsys.h */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jmemsys.h
+ *
+ * Copyright (C) 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This include file defines the interface between the system-independent
+ * and system-dependent portions of the JPEG memory manager. (The system-
+ * independent portion is jmemmgr.c; there are several different versions
+ * of the system-dependent portion, and of this file for that matter.)
+ *
+ * This is a "generic" skeleton that may need to be modified for particular
+ * systems. It should be usable as-is on the majority of non-MSDOS machines.
+ */
+
+
+/*
+ * These two functions are used to allocate and release small chunks of
+ * memory (typically the total amount requested through jget_small is
+ * no more than 20Kb or so). Behavior should be the same as for the
+ * standard library functions malloc and free; in particular, jget_small
+ * returns NULL on failure. On most systems, these ARE malloc and free.
+ * On an 80x86 machine using small-data memory model, these manage near heap.
+ */
+
+EXTERN pointer jget_small PP((size_t sizeofobject));
+EXTERN void jfree_small PP((pointer object));
+
+/*
+ * These two functions are used to allocate and release large chunks of
+ * memory (up to the total free space designated by jmem_available).
+ * The interface is the same as above, except that on an 80x86 machine,
+ * far pointers are used. On other systems these ARE the same as above.
+ */
+
+#ifdef NEED_FAR_POINTERS /* typically not needed except on 80x86 */
+EXTERN pointer jget_large PP((size_t sizeofobject));
+EXTERN void jfree_large PP((pointer object));
+#else
+#define jget_large(sizeofobject) jget_small(sizeofobject)
+#define jfree_large(object) jfree_small(object)
+#endif
+
+/*
+ * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
+ * be requested in a single call on jget_large (and jget_small for that
+ * matter, but that case should never come into play). This macro is needed
+ * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
+ * On machines with flat address spaces, any large constant may be used here.
+ */
+
+#define MAX_ALLOC_CHUNK 1000000000L
+
+/*
+ * This routine computes the total space available for allocation by
+ * jget_large. If more space than this is needed, backing store will be used.
+ * NOTE: any memory already allocated must not be counted.
+ *
+ * There is a minimum space requirement, corresponding to the minimum
+ * feasible buffer sizes; jmemmgr.c will request that much space even if
+ * jmem_available returns zero. The maximum space needed, enough to hold
+ * all working storage in memory, is also passed in case it is useful.
+ *
+ * It is OK for jmem_available to underestimate the space available (that'll
+ * just lead to more backing-store access than is really necessary).
+ * However, an overestimate will lead to failure. Hence it's wise to subtract
+ * a slop factor from the true available space, especially if jget_small space
+ * comes from the same pool. 5% should be enough.
+ *
+ * On machines with lots of virtual memory, any large constant may be returned.
+ * Conversely, zero may be returned to always use the minimum amount of memory.
+ */
+
+EXTERN long jmem_available PP((long min_bytes_needed, long max_bytes_needed));
+
+
+/*
+ * This structure holds whatever state is needed to access a single
+ * backing-store object. The read/write/close method pointers are called
+ * by jmemmgr.c to manipulate the backing-store object; all other fields
+ * are private to the system-dependent backing store routines.
+ */
+
+#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */
+
+typedef struct backing_store_struct * backing_store_ptr;
+
+typedef struct backing_store_struct {
+ /* Methods for reading/writing/closing this backing-store object */
+ METHOD(void, read_backing_store, (backing_store_ptr info,
+ pointer buffer_address,
+ long file_offset, long byte_count));
+ METHOD(void, write_backing_store, (backing_store_ptr info,
+ pointer buffer_address,
+ long file_offset, long byte_count));
+ METHOD(void, close_backing_store, (backing_store_ptr info));
+ /* Private fields for system-dependent backing-store management */
+ /* For a typical implementation with temp files, we might need: */
+#ifndef XIE_SUPPORTED
+ FILE * temp_file; /* stdio reference to temp file */
+#endif /* XIE_SUPPORTED */
+ char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
+ } backing_store_info;
+
+/*
+ * Initial opening of a backing-store object. This must fill in the
+ * read/write/close pointers in the object. The read/write routines
+ * may take an error exit if the specified maximum file size is exceeded.
+ * (If jmem_available always returns a large value, this routine can just
+ * take an error exit.)
+ */
+
+EXTERN void jopen_backing_store PP((backing_store_ptr info,
+ long total_bytes_needed));
+
+
+/*
+ * These routines take care of any system-dependent initialization and
+ * cleanup required. The system methods struct address should be saved
+ * by jmem_init in case an error exit must be taken. jmem_term may assume
+ * that all requested memory has been freed and that all opened backing-
+ * store objects have been closed.
+ * NB: jmem_term may be called more than once, and must behave reasonably
+ * if that happens.
+ */
+
+EXTERN void jmem_init PP((external_methods_ptr emethods));
+EXTERN void jmem_term PP((void));
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jpegdata.h b/xc/programs/Xserver/XIE/mixie/jpeg/jpegdata.h
new file mode 100644
index 000000000..3405000d8
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jpegdata.h
@@ -0,0 +1,1283 @@
+/* $TOG: jpegdata.h /main/6 1998/02/09 16:20:27 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/* Module jpegdata.h */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+
+****************************************************************************/
+
+/*
+ * jpegdata.h
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file defines shared data structures for the various JPEG modules.
+ */
+
+/*
+ * You might need to change some of the following declarations if you are
+ * using the JPEG software within a surrounding application program
+ * or porting it to an unusual system.
+ */
+
+
+/* If the source or destination of image data is not to be stdio streams,
+ * these types may need work. You can replace them with some kind of
+ * pointer or indicator that is useful to you, or just ignore 'em.
+ * Note that the user interface and the various jrdxxx/jwrxxx modules
+ * will also need work for non-stdio input/output.
+ */
+
+#ifndef XIE_SUPPORTED
+typedef FILE * JFILEREF; /* source or dest of JPEG-compressed data */
+
+typedef FILE * IFILEREF; /* source or dest of non-JPEG image data */
+#endif /* XIE_SUPPORTED */
+
+
+/* These defines are used in all function definitions and extern declarations.
+ * You could modify them if you need to change function linkage conventions,
+ * as is shown below for use with C++. Another application would be to make
+ * all functions global for use with code profilers that require it.
+ * NOTE: the C++ test does the right thing if you are reading this include
+ * file in a C++ application to link to JPEG code that's been compiled with a
+ * regular C compiler. I'm not sure it works if you try to compile the JPEG
+ * code with C++.
+ */
+
+#define METHODDEF static /* a function called through method pointers */
+#define LOCAL static /* a function used only in its module */
+#define GLOBAL /* a function referenced thru EXTERNs */
+#ifdef __cplusplus
+#define EXTERN extern "C" /* a reference to a GLOBAL function */
+#else
+#define EXTERN extern /* a reference to a GLOBAL function */
+#endif
+
+
+/* Here is the pseudo-keyword for declaring pointers that must be "far"
+ * on 80x86 machines. Most of the specialized coding for 80x86 is handled
+ * by just saying "FAR *" where such a pointer is needed. In a few places
+ * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
+ */
+
+#ifdef NEED_FAR_POINTERS
+#define FAR far
+#else
+#define FAR
+#endif
+
+
+
+/* The remaining declarations are not system-dependent, we hope. */
+
+
+/*
+ * NOTE: if you have an ancient, strict-K&R C compiler, it may choke on the
+ * similarly-named fields in Compress_info_struct and Decompress_info_struct.
+ * If this happens, you can get around it by rearranging the two structs so
+ * that the similarly-named fields appear first and in the same order in
+ * each struct. Since such compilers are now pretty rare, we haven't done
+ * this in the portable code, preferring to maintain a logical ordering.
+ */
+
+
+
+/* This macro is used to declare a "method", that is, a function pointer. */
+/* We want to supply prototype parameters if the compiler can cope. */
+/* Note that the arglist parameter must be parenthesized! */
+
+#ifdef PROTO
+#define METHOD(type,methodname,arglist) type (*methodname) arglist
+#else
+#define METHOD(type,methodname,arglist) type (*methodname) ()
+#endif
+
+/* Forward references to lists of method pointers */
+typedef struct External_methods_struct * external_methods_ptr;
+typedef struct Compress_methods_struct * compress_methods_ptr;
+typedef struct Decompress_methods_struct * decompress_methods_ptr;
+
+
+/* Data structures for images containing either samples or coefficients. */
+/* Note that the topmost (leftmost) index is always color component. */
+/* On 80x86 machines, the image arrays are too big for near pointers, */
+/* but the pointer arrays can fit in near memory. */
+
+typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */
+typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
+typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
+
+
+#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
+#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
+
+typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
+typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */
+typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */
+typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
+
+typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */
+
+
+/* The input and output data of the DCT transform subroutines are of
+ * the following type, which need not be the same as JCOEF.
+ * For example, on a machine with fast floating point, it might make sense
+ * to recode the DCT routines to use floating point; then DCTELEM would be
+ * 'float' or 'double'.
+ */
+
+typedef JCOEF DCTELEM;
+typedef DCTELEM DCTBLOCK[DCTSIZE2];
+
+
+/* Types for JPEG compression parameters and working tables. */
+
+
+typedef enum { /* defines known color spaces */
+ CS_UNKNOWN, /* error/unspecified */
+ CS_GRAYSCALE, /* monochrome (only 1 component) */
+ CS_RGB, /* red/green/blue */
+ CS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
+ CS_YIQ, /* Y/I/Q */
+ CS_CMYK /* C/M/Y/K */
+} COLOR_SPACE;
+
+
+typedef struct { /* Basic info about one component */
+ /* These values are fixed over the whole image */
+ /* For compression, they must be supplied by the user interface; */
+ /* for decompression, they are read from the SOF marker. */
+ short component_id; /* identifier for this component (0..255) */
+ short component_index; /* its index in SOF or cinfo->comp_info[] */
+ short h_samp_factor; /* horizontal sampling factor (1..4) */
+ short v_samp_factor; /* vertical sampling factor (1..4) */
+ short quant_tbl_no; /* quantization table selector (0..3) */
+ /* These values may vary between scans */
+ /* For compression, they must be supplied by the user interface; */
+ /* for decompression, they are read from the SOS marker. */
+ short dc_tbl_no; /* DC entropy table selector (0..3) */
+ short ac_tbl_no; /* AC entropy table selector (0..3) */
+ /* These values are computed during compression or decompression startup */
+ long true_comp_width; /* component's image width in samples */
+ long true_comp_height; /* component's image height in samples */
+ /* the above are the logical dimensions of the downsampled image */
+ /* These values are computed before starting a scan of the component */
+ short MCU_width; /* number of blocks per MCU, horizontally */
+ short MCU_height; /* number of blocks per MCU, vertically */
+ short MCU_blocks; /* MCU_width * MCU_height */
+ long downsampled_width; /* image width in samples, after expansion */
+ long downsampled_height; /* image height in samples, after expansion */
+ /* the above are the true_comp_xxx values rounded up to multiples of */
+ /* the MCU dimensions; these are the working dimensions of the array */
+ /* as it is passed through the DCT or IDCT step. NOTE: these values */
+ /* differ depending on whether the component is interleaved or not!! */
+} jpeg_component_info;
+
+
+/* DCT coefficient quantization tables.
+ * For 8-bit precision, 'INT16' should be good enough for quantization values;
+ * for more precision, we go for the full 16 bits. 'INT16' provides a useful
+ * speedup on many machines (multiplication & division of JCOEFs by
+ * quantization values is a significant chunk of the runtime).
+ * Note: the values in a QUANT_TBL are always given in zigzag order.
+ */
+#ifdef EIGHT_BIT_SAMPLES
+typedef INT16 QUANT_VAL; /* element of a quantization table */
+#else
+typedef UINT16 QUANT_VAL; /* element of a quantization table */
+#endif
+typedef QUANT_VAL QUANT_TBL[DCTSIZE2]; /* A quantization table */
+typedef QUANT_VAL * QUANT_TBL_PTR; /* pointer to same */
+
+
+typedef struct { /* A Huffman coding table */
+ /* These two fields directly represent the contents of a JPEG DHT marker */
+ UINT8 bits[17]; /* bits[k] = # of symbols with codes of */
+ /* length k bits; bits[0] is unused */
+ UINT8 huffval[256]; /* The symbols, in order of incr code length */
+ /* This field is used only during compression. It's initialized FALSE when
+ * the table is created, and set TRUE when it's been output to the file.
+ */
+ boolean sent_table; /* TRUE when table has been output */
+ /* The remaining fields are computed from the above to allow more efficient
+ * coding and decoding. These fields should be considered private to the
+ * Huffman compression & decompression modules.
+ */
+ /* encoding tables: */
+ UINT16 ehufco[256]; /* code for each symbol */
+ char ehufsi[256]; /* length of code for each symbol */
+ /* decoding tables: (element [0] of each array is unused) */
+ UINT16 mincode[17]; /* smallest code of length k */
+ INT32 maxcode[18]; /* largest code of length k (-1 if none) */
+ /* (maxcode[17] is a sentinel to ensure huff_DECODE terminates) */
+ short valptr[17]; /* huffval[] index of 1st symbol of length k */
+} HUFF_TBL;
+
+
+#define NUM_QUANT_TBLS 4 /* quantization tables are numbered 0..3 */
+#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
+#define NUM_ARITH_TBLS 16 /* arith-coding tables are numbered 0..15 */
+#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
+#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
+#define MAX_BLOCKS_IN_MCU 10 /* JPEG limit on # of blocks in an MCU */
+
+#ifdef XIE_SUPPORTED
+/* Types and Structures from jmemmgr.c */
+/* (used in Compress_info_struct and Decompress_info_struct */
+typedef double align_type;
+
+typedef union small_struct * small_ptr;
+
+typedef union small_struct {
+ small_ptr next; /* next in list of allocated objects */
+ align_type dummy; /* ensures alignment of following storage */
+ } small_hdr;
+
+typedef struct small_sarray_struct * small_sarray_ptr;
+
+typedef struct small_sarray_struct {
+ small_sarray_ptr next; /* next in list of allocated sarrays */
+ long numrows; /* # of rows in this array */
+ long rowsperchunk; /* max # of rows per allocation chunk */
+ JSAMPROW dummy; /* ensures alignment of following storage */
+ } small_sarray_hdr;
+
+typedef struct small_barray_struct * small_barray_ptr;
+
+typedef struct small_barray_struct {
+ small_barray_ptr next; /* next in list of allocated barrays */
+ long numrows; /* # of rows in this array */
+ long rowsperchunk; /* max # of rows per allocation chunk */
+ JBLOCKROW dummy; /* ensures alignment of following storage */
+ } small_barray_hdr;
+
+#endif /* XIE_SUPPORTED */
+
+
+/* Working data for compression */
+
+struct Compress_info_struct {
+/*
+ * All of these fields shall be established by the user interface before
+ * calling jpeg_compress, or by the input_init or c_ui_method_selection
+ * methods.
+ * Most parameters can be set to reasonable defaults by j_c_defaults.
+ * Note that the UI must supply the storage for the main methods struct,
+ * though it sets only a few of the methods there.
+ */
+ compress_methods_ptr methods; /* Points to list of methods to use */
+
+ external_methods_ptr emethods; /* Points to list of methods to use */
+
+#ifndef XIE_SUPPORTED
+ IFILEREF input_file; /* tells input routines where to read image */
+ JFILEREF output_file; /* tells output routines where to write JPEG */
+#endif /* XIE_SUPPORTED */
+
+ long image_width; /* input image width */
+ long image_height; /* input image height */
+ short input_components; /* # of color components in input image */
+
+ short data_precision; /* bits of precision in image data */
+
+ COLOR_SPACE in_color_space; /* colorspace of input file */
+ COLOR_SPACE jpeg_color_space; /* colorspace of JPEG file */
+
+ double input_gamma; /* image gamma of input file */
+
+ boolean write_JFIF_header; /* should a JFIF marker be written? */
+ /* These three values are not used by the JPEG code, only copied */
+ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
+ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
+ /* ratio is defined by X_density/Y_density even when density_unit=0. */
+ UINT8 density_unit; /* JFIF code for pixel size units */
+ UINT16 X_density; /* Horizontal pixel density */
+ UINT16 Y_density; /* Vertical pixel density */
+
+ short num_components; /* # of color components in JPEG image */
+ jpeg_component_info * comp_info;
+ /* comp_info[i] describes component that appears i'th in SOF */
+
+ QUANT_TBL_PTR quant_tbl_ptrs[NUM_QUANT_TBLS];
+ /* ptrs to coefficient quantization tables, or NULL if not defined */
+
+ HUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ HUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ /* ptrs to Huffman coding tables, or NULL if not defined */
+
+ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arithmetic-coding tables */
+ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arithmetic-coding tables */
+ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arithmetic-coding tables */
+
+ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
+ boolean interleave; /* TRUE=interleaved output, FALSE=not */
+ boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
+ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+ int smoothing_factor; /* 1..100, or 0 for no input smoothing */
+
+ /* The restart interval can be specified in absolute MCUs by setting
+ * restart_interval, or in MCU rows by setting restart_in_rows
+ * (in which case the correct restart_interval will be figured
+ * for each scan).
+ */
+ UINT16 restart_interval;/* MCUs per restart interval, or 0 for no restart */
+ int restart_in_rows; /* if > 0, MCU rows per restart interval */
+
+/*
+ * These fields are computed during jpeg_compress startup
+ */
+ short max_h_samp_factor; /* largest h_samp_factor */
+ short max_v_samp_factor; /* largest v_samp_factor */
+
+/*
+ * These fields may be useful for progress monitoring
+ */
+
+ int total_passes; /* number of passes expected */
+ int completed_passes; /* number of passes completed so far */
+
+/*
+ * These fields are valid during any one scan
+ */
+ short comps_in_scan; /* # of JPEG components output this time */
+ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+ /* *cur_comp_info[i] describes component that appears i'th in SOS */
+
+ long MCUs_per_row; /* # of MCUs across the image */
+ long MCU_rows_in_scan; /* # of MCU rows in the image */
+
+ short blocks_in_MCU; /* # of DCT blocks per MCU */
+ short MCU_membership[MAX_BLOCKS_IN_MCU];
+ /* MCU_membership[i] is index in cur_comp_info of component owning */
+ /* i'th block in an MCU */
+
+ /* these fields are private data for the entropy encoder */
+ JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */
+ JCOEF last_dc_diff[MAX_COMPS_IN_SCAN]; /* last DC diff for each comp */
+ UINT16 restarts_to_go; /* MCUs left in this restart interval */
+ short next_restart_num; /* # of next RSTn marker (0..7) */
+
+#ifdef XIE_SUPPORTED
+ long jpeg_buf_size; /* put is structure from global define */
+ short xie_h_samp_factor[MAX_COMPS_IN_SCAN]; /* for XIE interface */
+ short xie_v_samp_factor[MAX_COMPS_IN_SCAN]; /* for XIE interface */
+ /* The variables come from jcpipe.c - single_ccontroller */
+ int rows_in_mem; /* # of sample rows in full-size buffers */
+ long fullsize_width; /* # of samples per row in full-size buffers */
+ long cur_pixel_row; /* counts # of pixel rows processed */
+ long mcu_rows_output; /* # of MCU rows actually emitted */
+ int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */
+ /* Work buffer for pre-downsampling data (see comments at head of file) */
+ JSAMPIMAGE fullsize_data[2];
+ /* Work buffer for downsampled data */
+ JSAMPIMAGE sampled_data;
+ int rows_this_time;
+ short whichss;
+ boolean first_pixel_row;
+ /* from jchuff.c */
+ INT32 huff_put_buffer; /* current bit-accumulation buffer */
+ int huff_put_bits; /* # of bits now in it */
+ char * output_buffer; /* output buffer */
+ int bytes_in_buffer;
+ /* XIE - JPEG buffer */
+ int XIEwrloc;
+ int XIErestart;
+ int XIEmcurow;
+ long XIEmcuindex;
+ int XIEbytes_in_buffer;
+ /* from jmemmgr.c */
+ small_ptr small_list; /* head of list */
+ small_sarray_ptr small_sarray_list; /* head of list */
+ small_barray_ptr small_barray_list; /* head of list */
+#endif /* XIE_SUPPORTED */
+
+};
+
+typedef struct Compress_info_struct * compress_info_ptr;
+
+#ifdef XIE_SUPPORTED
+
+/* Types for XIE restart. */
+
+
+typedef enum { /* defines XIE restart locations */
+ XIE_RNUL, /* No restart */
+ XIE_RRFH, /* Restart at Read File Header */
+ XIE_RRSH, /* Restart at Read Scan Header */
+ XIE_RMCU, /* Restart at MCU */
+ XIE_RWRJ, /* Restart at write jfif */
+ XIE_RWFH, /* Restart at Write File Header */
+ XIE_RWSH, /* Restart at Write Scan Header */
+ XIE_RWFT /* Restart at Write File Trailer */
+ } XIE_RESTART;
+
+/* Types for XIE return. */
+
+typedef enum { /* defines XIE restart locations */
+ XIE_ERR = -999, /* Error return */
+ XIE_NRML = 0, /* Normal return */
+ XIE_INP = 1, /* Need input */
+ XIE_OUT = 2, /* Output ready */
+ XIE_EOI = 3 /* End of input */
+} XIE_RETURN;
+
+#endif
+
+
+/* Working data for decompression */
+
+struct Decompress_info_struct {
+/*
+ * These fields shall be established by the user interface before
+ * calling jpeg_decompress.
+ * Most parameters can be set to reasonable defaults by j_d_defaults.
+ * Note that the UI must supply the storage for the main methods struct,
+ * though it sets only a few of the methods there.
+ */
+ decompress_methods_ptr methods; /* Points to list of methods to use */
+
+ external_methods_ptr emethods; /* Points to list of methods to use */
+
+#ifndef XIE_SUPPORTED
+ JFILEREF input_file; /* tells input routines where to read JPEG */
+ IFILEREF output_file; /* tells output routines where to write image */
+#endif /* XIE_SUPPORTED */
+
+ /* these can be set at d_ui_method_selection time: */
+
+ COLOR_SPACE out_color_space; /* colorspace of output */
+
+ double output_gamma; /* image gamma wanted in output */
+
+ boolean quantize_colors; /* T if output is a colormapped format */
+ /* the following are ignored if not quantize_colors: */
+ boolean two_pass_quantize; /* use two-pass color quantization? */
+ boolean use_dithering; /* want color dithering? */
+ int desired_number_of_colors; /* max number of colors to use */
+
+ boolean do_block_smoothing; /* T = apply cross-block smoothing */
+ boolean do_pixel_smoothing; /* T = apply post-upsampling smoothing */
+
+/*
+ * These fields are used for efficient buffering of data between read_jpeg_data
+ * and the entropy decoding object. By using a shared buffer, we avoid copying
+ * data and eliminate the need for an "unget" operation at the end of a scan.
+ * The actual source of the data is known only to read_jpeg_data; see the
+ * JGETC macro, below.
+ * Note: the user interface is expected to allocate the input_buffer and
+ * initialize bytes_in_buffer to 0. Also, for JFIF/raw-JPEG input, the UI
+ * actually supplies the read_jpeg_data method. This is all handled by
+ * j_d_defaults in a typical implementation.
+ */
+ char * input_buffer; /* start of buffer (private to input code) */
+ char * next_input_byte; /* => next byte to read from buffer */
+ int bytes_in_buffer; /* # of bytes remaining in buffer */
+
+/*
+ * These fields are set by read_file_header or read_scan_header
+ */
+ long image_width; /* overall image width */
+ long image_height; /* overall image height */
+
+ short data_precision; /* bits of precision in image data */
+
+ COLOR_SPACE jpeg_color_space; /* colorspace of JPEG file */
+
+ /* These three values are not used by the JPEG code, merely copied */
+ /* from the JFIF APP0 marker (if any). */
+ UINT8 density_unit; /* JFIF code for pixel size units */
+ UINT16 X_density; /* Horizontal pixel density */
+ UINT16 Y_density; /* Vertical pixel density */
+
+ short num_components; /* # of color components in JPEG image */
+ jpeg_component_info * comp_info;
+ /* comp_info[i] describes component that appears i'th in SOF */
+
+ QUANT_TBL_PTR quant_tbl_ptrs[NUM_QUANT_TBLS];
+ /* ptrs to coefficient quantization tables, or NULL if not defined */
+
+ HUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ HUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
+ /* ptrs to Huffman coding tables, or NULL if not defined */
+
+ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
+ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
+ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
+
+ boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
+ boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+
+ UINT16 restart_interval;/* MCUs per restart interval, or 0 for no restart */
+
+/*
+ * These fields are computed during jpeg_decompress startup
+ */
+ short max_h_samp_factor; /* largest h_samp_factor */
+ short max_v_samp_factor; /* largest v_samp_factor */
+
+ short color_out_comps; /* # of color components output by color_convert */
+ /* (need not match num_components) */
+ short final_out_comps; /* # of color components sent to put_pixel_rows */
+ /* (1 when quantizing colors, else same as color_out_comps) */
+
+ JSAMPLE * sample_range_limit; /* table for fast range-limiting */
+
+/*
+ * When quantizing colors, the color quantizer leaves a pointer to the output
+ * colormap in these fields. The colormap is valid from the time put_color_map
+ * is called (must be before any put_pixel_rows calls) until shutdown (more
+ * specifically, until free_all is called to release memory).
+ */
+ int actual_number_of_colors; /* actual number of entries */
+ JSAMPARRAY colormap; /* NULL if not valid */
+ /* map has color_out_comps rows * actual_number_of_colors columns */
+
+/*
+ * These fields may be useful for progress monitoring
+ */
+ int total_passes; /* number of passes expected */
+ int completed_passes; /* number of passes completed so far */
+
+/*
+ * These fields are valid during any one scan
+ */
+ short comps_in_scan; /* # of JPEG components input this time */
+ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
+ /* *cur_comp_info[i] describes component that appears i'th in SOS */
+
+ long MCUs_per_row; /* # of MCUs across the image */
+ long MCU_rows_in_scan; /* # of MCU rows in the image */
+
+ short blocks_in_MCU; /* # of DCT blocks per MCU */
+ short MCU_membership[MAX_BLOCKS_IN_MCU];
+ /* MCU_membership[i] is index in cur_comp_info of component owning */
+ /* i'th block in an MCU */
+
+ /* these fields are private data for the entropy encoder */
+ JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */
+ JCOEF last_dc_diff[MAX_COMPS_IN_SCAN]; /* last DC diff for each comp */
+ UINT16 restarts_to_go; /* MCUs left in this restart interval */
+ short next_restart_num; /* # of next RSTn marker (0..7) */
+
+#ifdef XIE_SUPPORTED
+ boolean XIE_upsample; /* TRUE if upsampling is desired */
+ long jpeg_buf_size; /* put is structure from global define */
+ int rows_in_mem; /* # of sample rows in full-size buffers */
+ /* Work buffer for data being passed to output module. */
+ /* This has color_out_comps components if not quantizing, */
+ /* but only one component when quantizing. */
+ JSAMPIMAGE output_workspace;
+ long fullsize_width; /* # of samples per row in full-size buffers */
+ long pixel_rows_output; /* # of pixel rows actually emitted */
+ int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */
+ /* Work buffer for dequantized coefficients (IDCT input) */
+ JBLOCKIMAGE coeff_data;
+ /* Work buffer for cross-block smoothing input */
+#ifdef BLOCK_SMOOTHING_SUPPORTED
+ JBLOCKIMAGE bsmooth[3]; /* this is optional */
+ int whichb;
+#endif
+ /* Work buffer for downsampled image data (see comments at head of file) */
+ JSAMPIMAGE sampled_data[2];
+ /* Work buffer for upsampled data */
+ JSAMPIMAGE fullsize_data;
+ int whichss;
+ long cur_mcu_row; /* counts # of MCU rows processed */
+ int ri;
+ boolean first_mcu_row;
+ /* used in jdmcu and jrdjfif */
+ int XIErestart;
+ char * XIEnext_input_byte; /* => next byte to read from buffer */
+ int XIEbytes_in_buffer; /* # of bytes remaining in buffer */
+ /* used in jdmcu */
+ long XIEmcuindex;
+ JBLOCKROW MCU_data[MAX_BLOCKS_IN_MCU];
+ /* used in jdhuff */
+ INT32 XIEget_buffer; /* current bit-extraction buffer */
+ int XIEbits_left; /* # of unused bits in it */
+ boolean printed_eod; /* flag to suppress multiple end-of-data msgs */
+ /* from jmemmgr.c */
+ small_ptr small_list; /* head of list */
+ small_sarray_ptr small_sarray_list; /* head of list */
+ small_barray_ptr small_barray_list; /* head of list */
+#endif /* XIE_SUPPORTED */
+
+};
+
+typedef struct Decompress_info_struct * decompress_info_ptr;
+
+
+/* Macros for reading data from the decompression input buffer */
+
+#ifdef XIE_SUPPORTED
+#ifdef CHAR_IS_UNSIGNED
+#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \
+ -1 : (int) (*(cinfo)->next_input_byte++) )
+#else
+#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \
+ -1 : (int) (*(cinfo)->next_input_byte++) & 0xFF )
+#endif
+#else
+#ifdef CHAR_IS_UNSIGNED
+#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \
+ (*(cinfo)->methods->read_jpeg_data) (cinfo) : \
+ (int) (*(cinfo)->next_input_byte++) )
+#else
+#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \
+ (*(cinfo)->methods->read_jpeg_data) (cinfo) : \
+ (int) (*(cinfo)->next_input_byte++) & 0xFF )
+#endif
+#endif /* XIE_SUPPORTED */
+
+#define JUNGETC(ch,cinfo) ((cinfo)->bytes_in_buffer++, \
+ *(--((cinfo)->next_input_byte)) = (char) (ch))
+
+#define MIN_UNGET 4 /* may always do at least 4 JUNGETCs */
+
+
+/* A virtual image has a control block whose contents are private to the
+ * memory manager module (and may differ between managers). The rest of the
+ * code only refers to virtual images by these pointer types, and never
+ * dereferences the pointer.
+ */
+
+typedef struct big_sarray_control * big_sarray_ptr;
+typedef struct big_barray_control * big_barray_ptr;
+
+/* Although a real ANSI C compiler can deal perfectly well with pointers to
+ * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI
+ * and pseudo-ANSI compilers get confused. To keep one of these bozos happy,
+ * add -DINCOMPLETE_TYPES_BROKEN to CFLAGS in your Makefile. Then we will
+ * pseudo-define the structs as containing a single "dummy" field.
+ * The memory managers #define AM_MEMORY_MANAGER before including this file,
+ * so that they can make their own definitions of the structs.
+ */
+
+#ifdef INCOMPLETE_TYPES_BROKEN
+#ifndef AM_MEMORY_MANAGER
+struct big_sarray_control { long dummy; };
+struct big_barray_control { long dummy; };
+#endif
+#endif
+
+
+/* Method types that need typedefs */
+
+#ifdef XIE_SUPPORTED
+typedef METHOD(int, MCU_output_method_ptr, (compress_info_ptr cinfo,
+ JBLOCK *MCU_data));
+#else
+typedef METHOD(void, MCU_output_method_ptr, (compress_info_ptr cinfo,
+ JBLOCK *MCU_data));
+#endif /* XIE_SUPPORTED */
+typedef METHOD(void, MCU_output_caller_ptr, (compress_info_ptr cinfo,
+ MCU_output_method_ptr output_method));
+typedef METHOD(void, downsample_ptr, (compress_info_ptr cinfo,
+ int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above,
+ JSAMPARRAY input_data,
+ JSAMPARRAY below,
+ JSAMPARRAY output_data));
+typedef METHOD(void, upsample_ptr, (decompress_info_ptr cinfo,
+ int which_component,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPARRAY above,
+ JSAMPARRAY input_data,
+ JSAMPARRAY below,
+ JSAMPARRAY output_data));
+typedef METHOD(void, quantize_method_ptr, (decompress_info_ptr cinfo,
+ int num_rows,
+ JSAMPIMAGE input_data,
+ JSAMPARRAY output_workspace));
+typedef METHOD(void, quantize_caller_ptr, (decompress_info_ptr cinfo,
+ quantize_method_ptr quantize_method));
+
+
+/* These structs contain function pointers for the various JPEG methods. */
+
+/* Routines to be provided by the surrounding application, rather than the
+ * portable JPEG code proper. These are the same for compression and
+ * decompression.
+ */
+
+struct External_methods_struct {
+ /* User interface: error exit and trace message routines */
+ /* NOTE: the string msgtext parameters will eventually be replaced
+ * by an enumerated-type code so that non-English error messages
+ * can be substituted easily. This will not be done until all the
+ * code is in place, so that we know what messages are needed.
+ */
+ METHOD(void, error_exit, (const char *msgtext));
+ METHOD(void, trace_message, (const char *msgtext));
+
+ /* Working data for error/trace facility */
+ /* See macros below for the usage of these variables */
+ int trace_level; /* level of detail of tracing messages */
+ /* Use level 0 for important warning messages (nonfatal errors) */
+ /* Use levels 1, 2, 3 for successively more detailed trace options */
+
+ /* For recoverable corrupt-data errors, we emit a warning message and
+ * keep going. A surrounding application can check for bad data by
+ * seeing if num_warnings is nonzero at the end of processing.
+ */
+ long num_warnings; /* number of corrupt-data warnings */
+ int first_warning_level; /* trace level for first warning */
+ int more_warning_level; /* trace level for subsequent warnings */
+
+ int message_parm[8]; /* store numeric parms for messages here */
+
+ /* Memory management */
+ /* NB: alloc routines never return NULL. They exit to */
+ /* error_exit if not successful. */
+#ifdef XIE_SUPPORTED
+ METHOD(pointer, c_alloc_small, (compress_info_ptr cinfo,
+ size_t sizeofobject));
+ METHOD(int, c_free_small, (compress_info_ptr cinfo, pointer ptr));
+ METHOD(pointer, d_alloc_small, (decompress_info_ptr cinfo,
+ size_t sizeofobject));
+ METHOD(int, d_free_small, (decompress_info_ptr cinfo, pointer ptr));
+#else
+ METHOD(pointer, alloc_small, (size_t sizeofobject));
+ METHOD(void, free_small, (pointer ptr));
+#endif /* XIE_SUPPORTED */
+ METHOD(pointer, alloc_medium, (size_t sizeofobject));
+ METHOD(void, free_medium, (pointer ptr));
+#ifdef XIE_SUPPORTED
+ METHOD(JSAMPARRAY, c_alloc_small_sarray, (compress_info_ptr cinfo,
+ long samplesperrow, long numrows));
+ METHOD(int, c_free_small_sarray, (compress_info_ptr cinfo,
+ JSAMPARRAY ptr));
+ METHOD(JSAMPARRAY, d_alloc_small_sarray, (decompress_info_ptr cinfo,
+ long samplesperrow, long numrows));
+ METHOD(int, d_free_small_sarray, (decompress_info_ptr cinfo,
+ JSAMPARRAY ptr));
+#else
+ METHOD(JSAMPARRAY, alloc_small_sarray, (long samplesperrow,
+ long numrows));
+ METHOD(void, free_small_sarray, (JSAMPARRAY ptr));
+#endif /* XIE_SUPPORTED */
+#ifdef XIE_SUPPORTED
+ METHOD(JBLOCKARRAY, c_alloc_small_barray, (compress_info_ptr cinfo,
+ long blocksperrow, long numrows));
+ METHOD(int, c_free_small_barray, (compress_info_ptr cinfo,
+ JBLOCKARRAY ptr));
+ METHOD(JBLOCKARRAY, d_alloc_small_barray, (decompress_info_ptr cinfo,
+ long blocksperrow, long numrows));
+ METHOD(int, d_free_small_barray, (decompress_info_ptr cinfo,
+ JBLOCKARRAY ptr));
+#else
+ METHOD(JBLOCKARRAY, alloc_small_barray, (long blocksperrow,
+ long numrows));
+ METHOD(void, free_small_barray, (JBLOCKARRAY ptr));
+#endif /* XIE_SUPPORTED */
+ METHOD(big_sarray_ptr, request_big_sarray, (long samplesperrow,
+ long numrows,
+ long unitheight));
+ METHOD(big_barray_ptr, request_big_barray, (long blocksperrow,
+ long numrows,
+ long unitheight));
+ METHOD(void, alloc_big_arrays, (long extra_small_samples,
+ long extra_small_blocks,
+ long extra_medium_space));
+ METHOD(JSAMPARRAY, access_big_sarray, (big_sarray_ptr ptr,
+ long start_row,
+ boolean writable));
+ METHOD(JBLOCKARRAY, access_big_barray, (big_barray_ptr ptr,
+ long start_row,
+ boolean writable));
+ METHOD(void, free_big_sarray, (big_sarray_ptr ptr));
+ METHOD(void, free_big_barray, (big_barray_ptr ptr));
+#ifdef XIE_SUPPORTED
+ METHOD(int, c_free_all, (compress_info_ptr cinfo));
+ METHOD(int, d_free_all, (decompress_info_ptr cinfo));
+#else
+ METHOD(void, free_all, (void));
+#endif /* XIE_SUPPORTED */
+
+ long max_memory_to_use; /* maximum amount of memory to use */
+};
+
+/* Macros to simplify using the error and trace message stuff */
+/* The first parameter is generally cinfo->emethods */
+
+/* Fatal errors (print message and exit) */
+#ifndef XIE_SUPPORTED
+#define ERREXIT(emeth,msg) ((*(emeth)->error_exit) (msg))
+#define ERREXIT1(emeth,msg,p1) ((emeth)->message_parm[0] = (p1), \
+ (*(emeth)->error_exit) (msg))
+#define ERREXIT2(emeth,msg,p1,p2) ((emeth)->message_parm[0] = (p1), \
+ (emeth)->message_parm[1] = (p2), \
+ (*(emeth)->error_exit) (msg))
+#define ERREXIT3(emeth,msg,p1,p2,p3) ((emeth)->message_parm[0] = (p1), \
+ (emeth)->message_parm[1] = (p2), \
+ (emeth)->message_parm[2] = (p3), \
+ (*(emeth)->error_exit) (msg))
+#define ERREXIT4(emeth,msg,p1,p2,p3,p4) ((emeth)->message_parm[0] = (p1), \
+ (emeth)->message_parm[1] = (p2), \
+ (emeth)->message_parm[2] = (p3), \
+ (emeth)->message_parm[3] = (p4), \
+ (*(emeth)->error_exit) (msg))
+#endif /* XIE_SUPPORTED */
+
+#define MAKESTMT(stuff) do { stuff } while (0)
+
+#ifndef XIE_SUPPORTED
+/* Nonfatal errors (we'll keep going, but the data is probably corrupt) */
+/* Note that warning count is incremented as a side-effect! */
+#define WARNMS(emeth,msg) \
+ MAKESTMT( if ((emeth)->trace_level >= ((emeth)->num_warnings++ ? \
+ (emeth)->more_warning_level : (emeth)->first_warning_level)){ \
+ (*(emeth)->trace_message) (msg); } )
+#define WARNMS1(emeth,msg,p1) \
+ MAKESTMT( if ((emeth)->trace_level >= ((emeth)->num_warnings++ ? \
+ (emeth)->more_warning_level : (emeth)->first_warning_level)){ \
+ (emeth)->message_parm[0] = (p1); \
+ (*(emeth)->trace_message) (msg); } )
+#define WARNMS2(emeth,msg,p1,p2) \
+ MAKESTMT( if ((emeth)->trace_level >= ((emeth)->num_warnings++ ? \
+ (emeth)->more_warning_level : (emeth)->first_warning_level)){ \
+ (emeth)->message_parm[0] = (p1); \
+ (emeth)->message_parm[1] = (p2); \
+ (*(emeth)->trace_message) (msg); } )
+
+/* Informational/debugging messages */
+#define TRACEMS(emeth,lvl,msg) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ (*(emeth)->trace_message) (msg); } )
+#define TRACEMS1(emeth,lvl,msg,p1) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ (emeth)->message_parm[0] = (p1); \
+ (*(emeth)->trace_message) (msg); } )
+#define TRACEMS2(emeth,lvl,msg,p1,p2) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ (emeth)->message_parm[0] = (p1); \
+ (emeth)->message_parm[1] = (p2); \
+ (*(emeth)->trace_message) (msg); } )
+#define TRACEMS3(emeth,lvl,msg,p1,p2,p3) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ int * _mp = (emeth)->message_parm; \
+ *_mp++ = (p1); *_mp++ = (p2); *_mp = (p3); \
+ (*(emeth)->trace_message) (msg); } )
+#define TRACEMS4(emeth,lvl,msg,p1,p2,p3,p4) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ int * _mp = (emeth)->message_parm; \
+ *_mp++ = (p1); *_mp++ = (p2); *_mp++ = (p3); *_mp = (p4); \
+ (*(emeth)->trace_message) (msg); } )
+#define TRACEMS8(emeth,lvl,msg,p1,p2,p3,p4,p5,p6,p7,p8) \
+ MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \
+ int * _mp = (emeth)->message_parm; \
+ *_mp++ = (p1); *_mp++ = (p2); *_mp++ = (p3); *_mp++ = (p4); \
+ *_mp++ = (p5); *_mp++ = (p6); *_mp++ = (p7); *_mp = (p8); \
+ (*(emeth)->trace_message) (msg); } )
+#endif /* XIE_SUPPORTED */
+
+
+/* Methods used during JPEG compression. */
+
+struct Compress_methods_struct {
+ /* Hook for user interface to get control after input_init */
+ METHOD(void, c_ui_method_selection, (compress_info_ptr cinfo));
+ /* Hook for user interface to do progress monitoring */
+ METHOD(void, progress_monitor, (compress_info_ptr cinfo,
+ long loopcounter, long looplimit));
+ /* Input image reading & conversion to standard form */
+#ifdef XIE_SUPPORTED
+ METHOD(int, input_init, (compress_info_ptr cinfo));
+ METHOD(int, get_input_row, (compress_info_ptr cinfo,
+ JSAMPARRAY pixel_row));
+ METHOD(int, input_term, (compress_info_ptr cinfo));
+#else
+ METHOD(void, input_init, (compress_info_ptr cinfo));
+ METHOD(void, get_input_row, (compress_info_ptr cinfo,
+ JSAMPARRAY pixel_row));
+ METHOD(void, input_term, (compress_info_ptr cinfo));
+#endif /* XIE_SUPPORTED */
+ /* Color space and gamma conversion */
+ METHOD(void, colorin_init, (compress_info_ptr cinfo));
+ METHOD(void, get_sample_rows, (compress_info_ptr cinfo,
+ int rows_to_read,
+ JSAMPIMAGE image_data));
+ METHOD(void, colorin_term, (compress_info_ptr cinfo));
+ /* Expand picture data at edges */
+ METHOD(void, edge_expand, (compress_info_ptr cinfo,
+ long input_cols, int input_rows,
+ long output_cols, int output_rows,
+ JSAMPIMAGE image_data));
+ /* Downsample pixel values of a single component */
+ /* There can be a different downsample method for each component */
+ METHOD(void, downsample_init, (compress_info_ptr cinfo));
+ downsample_ptr downsample[MAX_COMPS_IN_SCAN];
+ METHOD(void, downsample_term, (compress_info_ptr cinfo));
+ /* Extract samples in MCU order, process & hand off to output_method */
+ /* The input is always exactly N MCU rows worth of data */
+ METHOD(void, extract_init, (compress_info_ptr cinfo));
+#ifdef XIE_SUPPORTED
+ METHOD(int, extract_MCUs, (compress_info_ptr cinfo,
+ JSAMPIMAGE image_data,
+ int num_mcu_rows,
+ MCU_output_method_ptr output_method));
+#else
+ METHOD(void, extract_MCUs, (compress_info_ptr cinfo,
+ JSAMPIMAGE image_data,
+ int num_mcu_rows,
+ MCU_output_method_ptr output_method));
+#endif /* XIE_SUPPORTED */
+ METHOD(void, extract_term, (compress_info_ptr cinfo));
+ /* Entropy encoding parameter optimization */
+ METHOD(void, entropy_optimize, (compress_info_ptr cinfo,
+ MCU_output_caller_ptr source_method));
+#ifdef XIE_SUPPORTED
+ /* Entropy encoding */
+ METHOD(int, entropy_encode_init, (compress_info_ptr cinfo));
+ METHOD(int, entropy_encode, (compress_info_ptr cinfo,
+ JBLOCK *MCU_data));
+ METHOD(int, entropy_encode_term, (compress_info_ptr cinfo));
+ /* JPEG file header construction */
+ METHOD(int, write_file_header, (compress_info_ptr cinfo));
+ METHOD(int, write_scan_header, (compress_info_ptr cinfo));
+ METHOD(void, write_jpeg_data, (compress_info_ptr cinfo,
+ char *dataptr,
+ int datacount));
+ METHOD(void, write_scan_trailer, (compress_info_ptr cinfo));
+ METHOD(int, write_file_trailer, (compress_info_ptr cinfo));
+#else
+ /* Entropy encoding */
+ METHOD(void, entropy_encode_init, (compress_info_ptr cinfo));
+ METHOD(void, entropy_encode, (compress_info_ptr cinfo,
+ JBLOCK *MCU_data));
+ METHOD(void, entropy_encode_term, (compress_info_ptr cinfo));
+ /* JPEG file header construction */
+ METHOD(void, write_file_header, (compress_info_ptr cinfo));
+ METHOD(void, write_scan_header, (compress_info_ptr cinfo));
+ METHOD(void, write_jpeg_data, (compress_info_ptr cinfo,
+ char *dataptr,
+ int datacount));
+ METHOD(void, write_scan_trailer, (compress_info_ptr cinfo));
+ METHOD(void, write_file_trailer, (compress_info_ptr cinfo));
+#endif /* XIE_SUPPORTED */
+ /* Pipeline control */
+ METHOD(void, c_pipeline_controller, (compress_info_ptr cinfo));
+ METHOD(void, entropy_output, (compress_info_ptr cinfo,
+ char *dataptr,
+ int datacount));
+ /* Overall control */
+ METHOD(void, c_per_scan_method_selection, (compress_info_ptr cinfo));
+};
+
+/* Methods used during JPEG decompression. */
+
+struct Decompress_methods_struct {
+ /* Hook for user interface to get control after reading file header */
+ METHOD(void, d_ui_method_selection, (decompress_info_ptr cinfo));
+ /* Hook for user interface to process comment blocks */
+#ifdef XIE_SUPPORTED
+ METHOD(int, process_comment, (decompress_info_ptr cinfo,
+ long comment_length));
+#else
+ METHOD(void, process_comment, (decompress_info_ptr cinfo,
+ long comment_length));
+#endif /* XIE_SUPPORTED */
+ /* Hook for user interface to do progress monitoring */
+ METHOD(void, progress_monitor, (decompress_info_ptr cinfo,
+ long loopcounter, long looplimit));
+ /* JPEG file scanning */
+#ifdef XIE_SUPPORTED
+ METHOD(int, read_file_header, (decompress_info_ptr cinfo));
+ METHOD(int, read_scan_header, (decompress_info_ptr cinfo));
+ METHOD(int, read_jpeg_data, (decompress_info_ptr cinfo));
+ METHOD(int, resync_to_restart, (decompress_info_ptr cinfo,
+ int marker));
+#else
+ METHOD(void, read_file_header, (decompress_info_ptr cinfo));
+ METHOD(boolean, read_scan_header, (decompress_info_ptr cinfo));
+ METHOD(int, read_jpeg_data, (decompress_info_ptr cinfo));
+ METHOD(void, resync_to_restart, (decompress_info_ptr cinfo,
+ int marker));
+#endif /* XIE_SUPPORTED */
+ METHOD(void, read_scan_trailer, (decompress_info_ptr cinfo));
+ METHOD(void, read_file_trailer, (decompress_info_ptr cinfo));
+ /* Entropy decoding */
+#ifdef XIE_SUPPORTED
+ METHOD(int, entropy_decode_init, (decompress_info_ptr cinfo));
+ METHOD(int, entropy_decode, (decompress_info_ptr cinfo,
+ JBLOCKROW *MCU_data));
+#else
+ METHOD(void, entropy_decode_init, (decompress_info_ptr cinfo));
+ METHOD(void, entropy_decode, (decompress_info_ptr cinfo,
+ JBLOCKROW *MCU_data));
+#endif /* XIE_SUPPORTED */
+ METHOD(void, entropy_decode_term, (decompress_info_ptr cinfo));
+ /* MCU disassembly: fetch MCUs from entropy_decode, build coef array */
+ /* The reverse_DCT step is in the same module for symmetry reasons */
+ METHOD(void, disassemble_init, (decompress_info_ptr cinfo));
+#ifdef XIE_SUPPORTED
+ METHOD(int, disassemble_MCU, (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data));
+#else
+ METHOD(void, disassemble_MCU, (decompress_info_ptr cinfo,
+ JBLOCKIMAGE image_data));
+#endif /* XIE_SUPPORTED */
+ METHOD(void, reverse_DCT, (decompress_info_ptr cinfo,
+ JBLOCKIMAGE coeff_data,
+ JSAMPIMAGE output_data, int start_row));
+ METHOD(void, disassemble_term, (decompress_info_ptr cinfo));
+ /* Cross-block smoothing */
+ METHOD(void, smooth_coefficients, (decompress_info_ptr cinfo,
+ jpeg_component_info *compptr,
+ JBLOCKROW above,
+ JBLOCKROW currow,
+ JBLOCKROW below,
+ JBLOCKROW output));
+ /* Upsample pixel values of a single component */
+ /* There can be a different upsample method for each component */
+ METHOD(void, upsample_init, (decompress_info_ptr cinfo));
+ upsample_ptr upsample[MAX_COMPS_IN_SCAN];
+ METHOD(void, upsample_term, (decompress_info_ptr cinfo));
+ /* Color space and gamma conversion */
+ METHOD(void, colorout_init, (decompress_info_ptr cinfo));
+ METHOD(void, color_convert, (decompress_info_ptr cinfo,
+ int num_rows, long num_cols,
+ JSAMPIMAGE input_data,
+ JSAMPIMAGE output_data));
+ METHOD(void, colorout_term, (decompress_info_ptr cinfo));
+ /* Color quantization */
+ METHOD(void, color_quant_init, (decompress_info_ptr cinfo));
+ METHOD(void, color_quantize, (decompress_info_ptr cinfo,
+ int num_rows,
+ JSAMPIMAGE input_data,
+ JSAMPARRAY output_data));
+ METHOD(void, color_quant_prescan, (decompress_info_ptr cinfo,
+ int num_rows,
+ JSAMPIMAGE image_data,
+ JSAMPARRAY workspace));
+ METHOD(void, color_quant_doit, (decompress_info_ptr cinfo,
+ quantize_caller_ptr source_method));
+ METHOD(void, color_quant_term, (decompress_info_ptr cinfo));
+ /* Output image writing */
+#ifdef XIE_SUPPORTED
+ METHOD(int, output_init, (decompress_info_ptr cinfo));
+ METHOD(void, put_color_map, (decompress_info_ptr cinfo,
+ int num_colors, JSAMPARRAY colormap));
+ METHOD(void, put_pixel_rows, (decompress_info_ptr cinfo,
+ int num_rows,
+ JSAMPIMAGE pixel_data));
+ METHOD(int, output_term, (decompress_info_ptr cinfo));
+#else
+ METHOD(void, output_init, (decompress_info_ptr cinfo));
+ METHOD(void, put_color_map, (decompress_info_ptr cinfo,
+ int num_colors, JSAMPARRAY colormap));
+ METHOD(void, put_pixel_rows, (decompress_info_ptr cinfo,
+ int num_rows,
+ JSAMPIMAGE pixel_data));
+ METHOD(void, output_term, (decompress_info_ptr cinfo));
+#endif /* XIE_SUPPORTED */
+ /* Pipeline control */
+ METHOD(void, d_pipeline_controller, (decompress_info_ptr cinfo));
+ /* Overall control */
+ METHOD(void, d_per_scan_method_selection, (decompress_info_ptr cinfo));
+};
+
+
+/* External declarations for routines that aren't called via method ptrs. */
+/* Note: use "j" as first char of names to minimize namespace pollution. */
+/* The PP macro hides prototype parameters from compilers that can't cope. */
+
+#ifdef PROTO
+#define PP(arglist) arglist
+#else
+#define PP(arglist) ()
+#endif
+
+
+/* main entry for compression */
+EXTERN void jpeg_compress PP((compress_info_ptr cinfo));
+
+/* default parameter setup for compression */
+#ifdef XIE_SUPPORTED
+EXTERN int j_c_defaults PP((compress_info_ptr cinfo, int quality,
+ boolean force_baseline));
+EXTERN void j_monochrome_default PP((compress_info_ptr cinfo));
+EXTERN int j_set_quality PP((compress_info_ptr cinfo, int quality,
+ boolean force_baseline));
+/* advanced compression parameter setup aids */
+EXTERN int j_add_quant_table PP((compress_info_ptr cinfo, int which_tbl,
+ const QUANT_VAL *basic_table,
+ int scale_factor, boolean force_baseline));
+#else
+EXTERN void j_c_defaults PP((compress_info_ptr cinfo, int quality,
+ boolean force_baseline));
+EXTERN void j_monochrome_default PP((compress_info_ptr cinfo));
+EXTERN void j_set_quality PP((compress_info_ptr cinfo, int quality,
+ boolean force_baseline));
+/* advanced compression parameter setup aids */
+EXTERN void j_add_quant_table PP((compress_info_ptr cinfo, int which_tbl,
+ const QUANT_VAL *basic_table,
+ int scale_factor, boolean force_baseline));
+#endif /* XIE_SUPPORTED */
+EXTERN int j_quality_scaling PP((int quality));
+
+/* main entry for decompression */
+EXTERN void jpeg_decompress PP((decompress_info_ptr cinfo));
+
+/* default parameter setup for decompression */
+EXTERN void j_d_defaults PP((decompress_info_ptr cinfo,
+ boolean standard_buffering));
+
+/* forward DCT */
+EXTERN void j_fwd_dct PP((DCTBLOCK data));
+/* inverse DCT */
+EXTERN void j_rev_dct PP((DCTBLOCK data));
+
+/* utility routines in jutils.c */
+EXTERN long jround_up PP((long a, long b));
+EXTERN void jcopy_sample_rows PP((JSAMPARRAY input_array, int source_row,
+ JSAMPARRAY output_array, int dest_row,
+ int num_rows, long num_cols));
+EXTERN void jcopy_block_row PP((JBLOCKROW input_row, JBLOCKROW output_row,
+ long num_blocks));
+EXTERN void jzero_far PP((pointer target, size_t bytestozero));
+
+/* method selection routines for compression modules */
+EXTERN void jselcpipeline PP((compress_info_ptr cinfo)); /* jcpipe.c */
+EXTERN void jselchuffman PP((compress_info_ptr cinfo)); /* jchuff.c */
+EXTERN void jselcarithmetic PP((compress_info_ptr cinfo)); /* jcarith.c */
+EXTERN void jselexpand PP((compress_info_ptr cinfo)); /* jcexpand.c */
+EXTERN void jseldownsample PP((compress_info_ptr cinfo)); /* jcsample.c */
+EXTERN void jselcmcu PP((compress_info_ptr cinfo)); /* jcmcu.c */
+EXTERN void jselccolor PP((compress_info_ptr cinfo)); /* jccolor.c */
+/* The user interface should call one of these to select input format: */
+EXTERN void jselrgif PP((compress_info_ptr cinfo)); /* jrdgif.c */
+EXTERN void jselrppm PP((compress_info_ptr cinfo)); /* jrdppm.c */
+EXTERN void jselrrle PP((compress_info_ptr cinfo)); /* jrdrle.c */
+EXTERN void jselrtarga PP((compress_info_ptr cinfo)); /* jrdtarga.c */
+/* and one of these to select output header format: */
+EXTERN void jselwjfif PP((compress_info_ptr cinfo)); /* jwrjfif.c */
+
+/* method selection routines for decompression modules */
+EXTERN void jseldpipeline PP((decompress_info_ptr cinfo)); /* jdpipe.c */
+EXTERN void jseldhuffman PP((decompress_info_ptr cinfo)); /* jdhuff.c */
+EXTERN void jseldarithmetic PP((decompress_info_ptr cinfo)); /* jdarith.c */
+EXTERN void jseldmcu PP((decompress_info_ptr cinfo)); /* jdmcu.c */
+EXTERN void jselbsmooth PP((decompress_info_ptr cinfo)); /* jbsmooth.c */
+EXTERN void jselupsample PP((decompress_info_ptr cinfo)); /* jdsample.c */
+EXTERN void jseldcolor PP((decompress_info_ptr cinfo)); /* jdcolor.c */
+EXTERN void jsel1quantize PP((decompress_info_ptr cinfo)); /* jquant1.c */
+EXTERN void jsel2quantize PP((decompress_info_ptr cinfo)); /* jquant2.c */
+/* The user interface should call one of these to select input format: */
+EXTERN void jselrjfif PP((decompress_info_ptr cinfo)); /* jrdjfif.c */
+/* and one of these to select output image format: */
+EXTERN void jselwgif PP((decompress_info_ptr cinfo)); /* jwrgif.c */
+EXTERN void jselwppm PP((decompress_info_ptr cinfo)); /* jwrppm.c */
+EXTERN void jselwrle PP((decompress_info_ptr cinfo)); /* jwrrle.c */
+EXTERN void jselwtarga PP((decompress_info_ptr cinfo)); /* jwrtarga.c */
+
+/* method selection routines for system-dependent modules */
+EXTERN void jselerror PP((external_methods_ptr emethods)); /* jerror.c */
+#ifdef XIE_SUPPORTED
+EXTERN void jcselmemmgr PP((compress_info_ptr cinfo,
+ external_methods_ptr emethods)); /* jmemmgr.c */
+EXTERN void jdselmemmgr PP((decompress_info_ptr cinfo,
+ external_methods_ptr emethods)); /* jmemmgr.c */
+#else
+EXTERN void jselmemmgr PP((external_methods_ptr emethods)); /* jmemmgr.c */
+#endif /* XIE_SUPPORTED */
+
+
+/* We assume that right shift corresponds to signed division by 2 with
+ * rounding towards minus infinity. This is correct for typical "arithmetic
+ * shift" instructions that shift in copies of the sign bit. But some
+ * C compilers implement >> with an unsigned shift. For these machines you
+ * must define RIGHT_SHIFT_IS_UNSIGNED.
+ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
+ * It is only applied with constant shift counts. SHIFT_TEMPS must be
+ * included in the variables of any routine using RIGHT_SHIFT.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define SHIFT_TEMPS INT32 shift_temp;
+#define RIGHT_SHIFT(x,shft) \
+ ((shift_temp = (x)) < 0 ? \
+ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
+ (shift_temp >> (shft)))
+#else
+#define SHIFT_TEMPS
+#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
+
+
+/* Miscellaneous useful macros */
+
+#undef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#undef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+
+#define RST0 0xD0 /* RST0 marker code */
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jrdjfif.c b/xc/programs/Xserver/XIE/mixie/jpeg/jrdjfif.c
new file mode 100644
index 000000000..6f50f7901
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jrdjfif.c
@@ -0,0 +1,1619 @@
+/* $TOG: jrdjfif.c /main/6 1998/02/09 16:20:33 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/* Module jrdjfif.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+
+****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/jpeg/jrdjfif.c,v 1.3 1998/10/04 09:36:23 dawes Exp $ */
+
+/*
+ * jrdjfif.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to decode standard JPEG file headers/markers.
+ * This code will handle "raw JPEG" and JFIF-convention JPEG files.
+ *
+ * You can also use this module to decode a raw-JPEG or JFIF-standard data
+ * stream that is embedded within a larger file. To do that, you must
+ * position the file to the JPEG SOI marker (0xFF/0xD8) that begins the
+ * data sequence to be decoded. If nothing better is possible, you can scan
+ * the file until you see the SOI marker, then use JUNGETC to push it back.
+ *
+ * This module relies on the JGETC macro and the read_jpeg_data method (which
+ * is provided by the user interface) to read from the JPEG data stream.
+ * Therefore, this module is not dependent on any particular assumption about
+ * the data source; it need not be a stdio stream at all. (This fact does
+ * NOT carry over to more complex JPEG file formats such as JPEG-in-TIFF;
+ * those format control modules may well need to assume stdio input.)
+ *
+ * These routines are invoked via the methods read_file_header,
+ * read_scan_header, read_jpeg_data, read_scan_trailer, and read_file_trailer.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+#ifdef JFIF_SUPPORTED
+
+#ifdef XIE_SUPPORTED
+#define M_EOB -1
+#define M_SOF0 0xc0
+#define M_SOF1 0xc1
+#define M_SOF2 0xc2
+#define M_SOF3 0xc3
+
+#define M_SOF5 0xc5
+#define M_SOF6 0xc6
+#define M_SOF7 0xc7
+
+#define M_JPG 0xc8
+#define M_SOF9 0xc9
+#define M_SOF10 0xca
+#define M_SOF11 0xcb
+
+#define M_SOF13 0xcd
+#define M_SOF14 0xce
+#define M_SOF15 0xcf
+
+#define M_DHT 0xc4
+
+#define M_DAC 0xcc
+
+#define M_RST0 0xd0
+#define M_RST1 0xd1
+#define M_RST2 0xd2
+#define M_RST3 0xd3
+#define M_RST4 0xd4
+#define M_RST5 0xd5
+#define M_RST6 0xd6
+#define M_RST7 0xd7
+
+#define M_SOI 0xd8
+#define M_EOI 0xd9
+#define M_SOS 0xda
+#define M_DQT 0xdb
+#define M_DNL 0xdc
+#define M_DRI 0xdd
+#define M_DHP 0xde
+#define M_EXP 0xdf
+
+#define M_APP0 0xe0
+#define M_APP15 0xef
+
+#define M_JPG0 0xf0
+#define M_JPG13 0xfd
+#define M_COM 0xfe
+
+#define M_TEM 0x01
+
+#define M_ERROR 0x100
+#else
+typedef enum { /* JPEG marker codes */
+ M_SOF0 = 0xc0,
+ M_SOF1 = 0xc1,
+ M_SOF2 = 0xc2,
+ M_SOF3 = 0xc3,
+
+ M_SOF5 = 0xc5,
+ M_SOF6 = 0xc6,
+ M_SOF7 = 0xc7,
+
+ M_JPG = 0xc8,
+ M_SOF9 = 0xc9,
+ M_SOF10 = 0xca,
+ M_SOF11 = 0xcb,
+
+ M_SOF13 = 0xcd,
+ M_SOF14 = 0xce,
+ M_SOF15 = 0xcf,
+
+ M_DHT = 0xc4,
+
+ M_DAC = 0xcc,
+
+ M_RST0 = 0xd0,
+ M_RST1 = 0xd1,
+ M_RST2 = 0xd2,
+ M_RST3 = 0xd3,
+ M_RST4 = 0xd4,
+ M_RST5 = 0xd5,
+ M_RST6 = 0xd6,
+ M_RST7 = 0xd7,
+
+ M_SOI = 0xd8,
+ M_EOI = 0xd9,
+ M_SOS = 0xda,
+ M_DQT = 0xdb,
+ M_DNL = 0xdc,
+ M_DRI = 0xdd,
+ M_DHP = 0xde,
+ M_EXP = 0xdf,
+
+ M_APP0 = 0xe0,
+ M_APP15 = 0xef,
+
+ M_JPG0 = 0xf0,
+ M_JPG13 = 0xfd,
+ M_COM = 0xfe,
+
+ M_TEM = 0x01,
+
+ M_ERROR = 0x100
+} JPEG_MARKER;
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Reload the input buffer after it's been emptied, and return the next byte.
+ * This is exported for direct use by the entropy decoder.
+ * See the JGETC macro for calling conditions. Note in particular that
+ * read_jpeg_data may NOT return EOF. If no more data is available, it must
+ * exit via ERREXIT, or perhaps synthesize fake data (such as an RST marker).
+ * For error recovery purposes, synthesizing an EOI marker is probably best.
+ *
+ * For this header control module, read_jpeg_data is supplied by the
+ * user interface. However, header formats that require random access
+ * to the input file would need to supply their own code. This code is
+ * left here to indicate what is required.
+ */
+
+#ifndef XIE_SUPPORTED
+#if NOTDEF /* not needed in this module */
+
+METHODDEF int
+read_jpeg_data (decompress_info_ptr cinfo)
+{
+ cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET;
+
+ cinfo->bytes_in_buffer = (int) JFREAD(cinfo->input_file,
+ cinfo->next_input_byte,
+ JPEG_BUF_SIZE);
+
+ if (cinfo->bytes_in_buffer <= 0) {
+ WARNMS(cinfo->emethods, "Premature EOF in JPEG file");
+ cinfo->next_input_byte[0] = (char) 0xFF;
+ cinfo->next_input_byte[1] = (char) M_EOI;
+ cinfo->bytes_in_buffer = 2;
+ }
+
+ return JGETC(cinfo);
+}
+
+#endif
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * Routines to parse JPEG markers & save away the useful info.
+ */
+
+
+LOCAL INT32
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+get_2bytes (decompress_info_ptr cinfo)
+#else
+get_2bytes (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+get_2bytes (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Get a 2-byte unsigned integer (e.g., a marker parameter length field) */
+{
+ INT32 a;
+#ifdef XIE_SUPPORTED
+ INT32 b;
+ if ((a = JGETC(cinfo)) < 0)
+ return(-1);
+ if ((b = JGETC(cinfo)) < 0)
+ return(-1);
+ return (a << 8) + b;
+#else
+ a = JGETC(cinfo);
+ return (a << 8) + JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+skip_variable (decompress_info_ptr cinfo, int code)
+#else
+skip_variable (cinfo, code)
+ decompress_info_ptr cinfo;
+ int code;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+skip_variable (decompress_info_ptr cinfo, int code)
+#endif /* XIE_SUPPORTED */
+/* Skip over an unknown or uninteresting variable-length marker */
+{
+ INT32 length;
+
+ length = get_2bytes(cinfo);
+#ifdef XIE_SUPPORTED
+ if (length < 0)
+ return(-1);
+#else
+ TRACEMS2(cinfo->emethods, 1,
+ "Skipping marker 0x%02x, length %u", code, (int) length);
+#endif /* XIE_SUPPORTED */
+
+ for (length -= 2; length > 0; length--)
+#ifdef XIE_SUPPORTED
+ if (JGETC(cinfo) < 0)
+ return(-1);
+#else
+ (void) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_dht (decompress_info_ptr cinfo)
+#else
+get_dht (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_dht (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a DHT marker */
+{
+ INT32 length;
+ UINT8 bits[17];
+ UINT8 huffval[256];
+ int i, index, count;
+ HUFF_TBL **htblptr;
+#ifdef XIE_SUPPORTED
+ int j;
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if ((length = get_2bytes(cinfo)) < 0)
+ return(-1);
+ length -= 2;
+#else
+ length = get_2bytes(cinfo)-2;
+#endif /* XIE_SUPPORTED */
+
+
+ while (length > 0) {
+ index = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (index < 0)
+ return(-1);
+#else
+ TRACEMS1(cinfo->emethods, 1, "Define Huffman Table 0x%02x", index);
+#endif /* XIE_SUPPORTED */
+
+ bits[0] = 0;
+ count = 0;
+ for (i = 1; i <= 16; i++) {
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ bits[i] = (UINT8) j;
+#else
+ bits[i] = (UINT8) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ count += bits[i];
+ }
+
+#ifndef XIE_SUPPORTED
+ TRACEMS8(cinfo->emethods, 2, " %3d %3d %3d %3d %3d %3d %3d %3d",
+ bits[1], bits[2], bits[3], bits[4],
+ bits[5], bits[6], bits[7], bits[8]);
+ TRACEMS8(cinfo->emethods, 2, " %3d %3d %3d %3d %3d %3d %3d %3d",
+ bits[9], bits[10], bits[11], bits[12],
+ bits[13], bits[14], bits[15], bits[16]);
+#endif /* XIE_SUPPORTED */
+
+ if (count > 256)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Bogus DHT counts");
+#endif /* XIE_SUPPORTED */
+
+ for (i = 0; i < count; i++) {
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ huffval[i] = (UINT8) j;
+#else
+ huffval[i] = (UINT8) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ }
+
+ length -= 1 + 16 + count;
+
+ if (index & 0x10) { /* AC table definition */
+ index -= 0x10;
+ htblptr = &cinfo->ac_huff_tbl_ptrs[index];
+ } else { /* DC table definition */
+ htblptr = &cinfo->dc_huff_tbl_ptrs[index];
+ }
+
+ if (index < 0 || index >= NUM_HUFF_TBLS)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Bogus DHT index %d", index);
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->d_alloc_small)
+ (cinfo, SIZEOF(HUFF_TBL));
+ if (*htblptr == (HUFF_TBL *) NULL)
+ return(XIE_ERR);
+#else
+ if (*htblptr == NULL)
+ *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL));
+#endif /* XIE_SUPPORTED */
+
+ MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
+ MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_dac (decompress_info_ptr cinfo)
+#else
+get_dac (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_dac (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a DAC marker */
+{
+ INT32 length;
+ int index, val;
+
+#ifdef XIE_SUPPORTED
+ if ((length = get_2bytes(cinfo)) < 0)
+ return(-1);
+ length -= 2;
+#else
+ length = get_2bytes(cinfo)-2;
+#endif /* XIE_SUPPORTED */
+
+ while (length > 0) {
+ index = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (index < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ val = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (val < 0)
+ return(-1);
+#else
+ TRACEMS2(cinfo->emethods, 1,
+ "Define Arithmetic Table 0x%02x: 0x%02x", index, val);
+#endif /* XIE_SUPPORTED */
+
+ if (index < 0 || index >= (2*NUM_ARITH_TBLS))
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Bogus DAC index %d", index);
+#endif /* XIE_SUPPORTED */
+
+ if (index >= NUM_ARITH_TBLS) { /* define AC table */
+ cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val;
+ } else { /* define DC table */
+ cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F);
+ cinfo->arith_dc_U[index] = (UINT8) (val >> 4);
+ if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Bogus DAC value 0x%x", val);
+#endif /* XIE_SUPPORTED */
+ }
+
+ length -= 2;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_dqt (decompress_info_ptr cinfo)
+#else
+get_dqt (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_dqt (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a DQT marker */
+{
+ INT32 length;
+ int n, i, prec;
+ UINT16 tmp;
+ QUANT_TBL_PTR quant_ptr;
+#ifdef XIE_SUPPORTED
+ int j;
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if ((length = get_2bytes(cinfo)) < 0)
+ return(-1);
+ length -= 2;
+#else
+ length = get_2bytes(cinfo)-2;
+#endif /* XIE_SUPPORTED */
+
+ while (length > 0) {
+ n = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (n < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ prec = n >> 4;
+ n &= 0x0F;
+
+#ifndef XIE_SUPPORTED
+ TRACEMS2(cinfo->emethods, 1,
+ "Define Quantization Table %d precision %d", n, prec);
+#endif /* XIE_SUPPORTED */
+
+ if (n >= NUM_QUANT_TBLS)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Bogus table number %d", n);
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if (cinfo->quant_tbl_ptrs[n] == NULL)
+ cinfo->quant_tbl_ptrs[n] = (QUANT_TBL_PTR)
+ (*cinfo->emethods->d_alloc_small) (cinfo, SIZEOF(QUANT_TBL));
+ if (cinfo->quant_tbl_ptrs[n] == (QUANT_TBL_PTR) NULL)
+ return(XIE_ERR);
+#else
+ if (cinfo->quant_tbl_ptrs[n] == NULL)
+ cinfo->quant_tbl_ptrs[n] = (QUANT_TBL_PTR)
+ (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL));
+#endif /* XIE_SUPPORTED */
+ quant_ptr = cinfo->quant_tbl_ptrs[n];
+
+ for (i = 0; i < DCTSIZE2; i++) {
+#ifdef XIE_SUPPORTED
+ j = JGETC(cinfo);
+ if (j < 0)
+ return(-1);
+ tmp = (UINT16) j;
+#else
+ tmp = JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ if (prec) {
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ tmp = (tmp<<8) + j;
+#else
+ tmp = (tmp<<8) + JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ }
+ quant_ptr[i] = tmp;
+ }
+
+#ifndef XIE_SUPPORTED
+ for (i = 0; i < DCTSIZE2; i += 8) {
+ TRACEMS8(cinfo->emethods, 2, " %4u %4u %4u %4u %4u %4u %4u %4u",
+ quant_ptr[i ], quant_ptr[i+1], quant_ptr[i+2], quant_ptr[i+3],
+ quant_ptr[i+4], quant_ptr[i+5], quant_ptr[i+6], quant_ptr[i+7]);
+ }
+#endif /* XIE_SUPPORTED */
+
+ length -= DCTSIZE2+1;
+ if (prec) length -= DCTSIZE2;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_dri (decompress_info_ptr cinfo)
+#else
+get_dri (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_dri (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a DRI marker */
+{
+#ifdef XIE_SUPPORTED
+ INT32 j;
+#endif /* XIE_SUPPORTED */
+ if (get_2bytes(cinfo) != 4)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Bogus length in DRI");
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if ((j = get_2bytes(cinfo)) < 0)
+ return(-1);
+ cinfo->restart_interval = (UINT16) j;
+
+ return(0);
+#else
+ cinfo->restart_interval = (UINT16) get_2bytes(cinfo);
+
+ TRACEMS1(cinfo->emethods, 1,
+ "Define Restart Interval %u", cinfo->restart_interval);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_app0 (decompress_info_ptr cinfo)
+#else
+get_app0 (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_app0 (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process an APP0 marker */
+{
+#define JFIF_LEN 14
+ INT32 length;
+ UINT8 b[JFIF_LEN];
+ int buffp;
+#ifdef XIE_SUPPORTED
+ int j;
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if ((length = get_2bytes(cinfo)) < 0)
+ return(-1);
+ length -= 2;
+#else
+ length = get_2bytes(cinfo)-2;
+#endif /* XIE_SUPPORTED */
+
+ /* See if a JFIF APP0 marker is present */
+
+ if (length >= JFIF_LEN) {
+ for (buffp = 0; buffp < JFIF_LEN; buffp++) {
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ b[buffp] = (UINT8) j;
+#else
+ b[buffp] = (UINT8) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ }
+ length -= JFIF_LEN;
+
+ if (b[0]==0x4A && b[1]==0x46 && b[2]==0x49 && b[3]==0x46 && b[4]==0) {
+ /* Found JFIF APP0 marker: check version */
+ /* Major version must be 1 */
+ if (b[5] != 1)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT2(cinfo->emethods, "Unsupported JFIF revision number %d.%02d",
+ b[5], b[6]);
+ /* Minor version should be 0..2, but try to process anyway if newer */
+ if (b[6] > 2)
+ TRACEMS2(cinfo->emethods, 1, "Warning: unknown JFIF revision number %d.%02d",
+ b[5], b[6]);
+#endif /* XIE_SUPPORTED */
+ /* Save info */
+ cinfo->density_unit = b[7];
+ cinfo->X_density = (b[8] << 8) + b[9];
+ cinfo->Y_density = (b[10] << 8) + b[11];
+ /* Assume colorspace is YCbCr, unless UI has overridden me */
+ if (cinfo->jpeg_color_space == CS_UNKNOWN)
+ cinfo->jpeg_color_space = CS_YCbCr;
+#ifndef XIE_SUPPORTED
+ TRACEMS3(cinfo->emethods, 1, "JFIF APP0 marker, density %dx%d %d",
+ cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
+ if (b[12] | b[13])
+ TRACEMS2(cinfo->emethods, 1, " with %d x %d thumbnail image",
+ b[12], b[13]);
+ if (length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3))
+ TRACEMS1(cinfo->emethods, 1,
+ "Warning: thumbnail image size does not match data length %u",
+ (int) length);
+#endif /* XIE_SUPPORTED */
+ } else {
+#ifndef XIE_SUPPORTED
+ TRACEMS1(cinfo->emethods, 1, "Unknown APP0 marker (not JFIF), length %u",
+ (int) length + JFIF_LEN);
+#endif /* XIE_SUPPORTED */
+ }
+ } else {
+#ifndef XIE_SUPPORTED
+ TRACEMS1(cinfo->emethods, 1, "Short APP0 marker, length %u", (int) length);
+#endif /* XIE_SUPPORTED */
+ }
+
+ while (length-- > 0) /* skip any remaining data */
+#ifdef XIE_SUPPORTED
+ if (JGETC(cinfo) < 0)
+ return(-1);
+#else
+ (void) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_com (decompress_info_ptr cinfo)
+#else
+get_com (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_com (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a COM marker */
+/* Actually we just pass this off to an application-supplied routine */
+{
+ INT32 length;
+
+#ifdef XIE_SUPPORTED
+ if ((length = get_2bytes(cinfo)) < 0)
+ return(-1);
+ length -= 2;
+#else
+ length = get_2bytes(cinfo) - 2;
+
+ TRACEMS1(cinfo->emethods, 1, "Comment, length %u", (int) length);
+#endif /* XIE_SUPPORTED */
+
+ (*cinfo->methods->process_comment) (cinfo, (long) length);
+
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_sof (decompress_info_ptr cinfo, int code)
+#else
+get_sof (cinfo, code)
+ decompress_info_ptr cinfo;
+ int code;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_sof (decompress_info_ptr cinfo, int code)
+#endif /* XIE_SUPPORTED */
+/* Process a SOFn marker */
+{
+ INT32 length;
+ short ci;
+ int c;
+ jpeg_component_info * compptr;
+#ifdef XIE_SUPPORTED
+ int j;
+ INT32 k;
+#endif /* XIE_SUPPORTED */
+
+ length = get_2bytes(cinfo);
+#ifdef XIE_SUPPORTED
+ if (length < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ cinfo->data_precision = j;
+ if ((k = get_2bytes(cinfo)) < 0)
+ return(-1);
+ cinfo->image_height = k;
+ if ((k = get_2bytes(cinfo)) < 0)
+ return(-1);
+ cinfo->image_width = k;
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ cinfo->num_components = j;
+#else
+ cinfo->data_precision = JGETC(cinfo);
+ cinfo->image_height = get_2bytes(cinfo);
+ cinfo->image_width = get_2bytes(cinfo);
+ cinfo->num_components = JGETC(cinfo);
+
+ TRACEMS4(cinfo->emethods, 1,
+ "Start Of Frame 0x%02x: width=%u, height=%u, components=%d",
+ code, (int) cinfo->image_width, (int) cinfo->image_height,
+ cinfo->num_components);
+#endif /* XIE_SUPPORTED */
+
+ /* We don't support files in which the image height is initially specified */
+ /* as 0 and is later redefined by DNL. As long as we have to check that, */
+ /* might as well have a general sanity check. */
+ if (cinfo->image_height <= 0 || cinfo->image_width <= 0
+ || cinfo->num_components <= 0)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Empty JPEG image (DNL not supported)");
+#endif /* XIE_SUPPORTED */
+
+#ifdef EIGHT_BIT_SAMPLES
+ if (cinfo->data_precision != 8)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Unsupported JPEG data precision");
+#endif /* XIE_SUPPORTED */
+#endif
+#ifdef TWELVE_BIT_SAMPLES
+ if (cinfo->data_precision != 12) /* this needs more thought?? */
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Unsupported JPEG data precision");
+#endif /* XIE_SUPPORTED */
+#endif
+#ifdef SIXTEEN_BIT_SAMPLES
+ if (cinfo->data_precision != 16) /* this needs more thought?? */
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Unsupported JPEG data precision");
+#endif /* XIE_SUPPORTED */
+#endif
+
+ if (length != (cinfo->num_components * 3 + 8))
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Bogus SOF length");
+#endif /* XIE_SUPPORTED */
+
+#ifdef XIE_SUPPORTED
+ cinfo->comp_info = (jpeg_component_info *) (*cinfo->emethods->d_alloc_small)
+ (cinfo, (cinfo->num_components * SIZEOF(jpeg_component_info)));
+ if (cinfo->comp_info == (jpeg_component_info *) NULL)
+ return(XIE_ERR);
+#else
+ cinfo->comp_info = (jpeg_component_info *) (*cinfo->emethods->alloc_small)
+ (cinfo->num_components * SIZEOF(jpeg_component_info));
+#endif /* XIE_SUPPORTED */
+
+ for (ci = 0; ci < cinfo->num_components; ci++) {
+ compptr = &cinfo->comp_info[ci];
+ compptr->component_index = ci;
+#ifdef XIE_SUPPORTED
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ compptr->component_id = j;
+ if ((c = JGETC(cinfo)) < 0)
+ return(-1);
+ compptr->h_samp_factor = (c >> 4) & 15;
+ compptr->v_samp_factor = (c ) & 15;
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ compptr->quant_tbl_no = j;
+#else
+ compptr->component_id = JGETC(cinfo);
+ c = JGETC(cinfo);
+ compptr->h_samp_factor = (c >> 4) & 15;
+ compptr->v_samp_factor = (c ) & 15;
+ compptr->quant_tbl_no = JGETC(cinfo);
+
+ TRACEMS4(cinfo->emethods, 1, " Component %d: %dhx%dv q=%d",
+ compptr->component_id, compptr->h_samp_factor,
+ compptr->v_samp_factor, compptr->quant_tbl_no);
+#endif /* XIE_SUPPORTED */
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+get_sos (decompress_info_ptr cinfo)
+#else
+get_sos (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+get_sos (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Process a SOS marker */
+{
+ INT32 length;
+ int i, ci, n, c, cc;
+ jpeg_component_info * compptr;
+
+ length = get_2bytes(cinfo);
+#ifdef XIE_SUPPORTED
+ if (length < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+
+ n = JGETC(cinfo); /* Number of components */
+#ifdef XIE_SUPPORTED
+ if (n < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ cinfo->comps_in_scan = n;
+ length -= 3;
+
+ if (length != (n * 2 + 3) || n < 1 || n > MAX_COMPS_IN_SCAN)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Bogus SOS length");
+
+ TRACEMS1(cinfo->emethods, 1, "Start Of Scan: %d components", n);
+#endif /* XIE_SUPPORTED */
+
+ for (i = 0; i < n; i++) {
+ cc = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (cc < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ c = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ length -= 2;
+
+ for (ci = 0; ci < cinfo->num_components; ci++)
+ if (cc == cinfo->comp_info[ci].component_id)
+ break;
+
+ if (ci >= cinfo->num_components)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT(cinfo->emethods, "Invalid component number in SOS");
+#endif /* XIE_SUPPORTED */
+
+ compptr = &cinfo->comp_info[ci];
+ cinfo->cur_comp_info[i] = compptr;
+ compptr->dc_tbl_no = (c >> 4) & 15;
+ compptr->ac_tbl_no = (c ) & 15;
+
+#ifndef XIE_SUPPORTED
+ TRACEMS3(cinfo->emethods, 1, " c%d: [dc=%d ac=%d]", cc,
+ compptr->dc_tbl_no, compptr->ac_tbl_no);
+#endif /* XIE_SUPPORTED */
+ }
+
+ while (length > 0) {
+#ifdef XIE_SUPPORTED
+ if (JGETC(cinfo) < 0)
+ return(-1);
+#else
+ (void) JGETC(cinfo);
+#endif /* XIE_SUPPORTED */
+ length--;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+LOCAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+get_soi (decompress_info_ptr cinfo)
+#else
+get_soi (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Process an SOI marker */
+{
+ int i;
+
+#else
+get_soi (decompress_info_ptr cinfo)
+/* Process an SOI marker */
+{
+ int i;
+
+ TRACEMS(cinfo->emethods, 1, "Start of Image");
+#endif /* XIE_SUPPORTED */
+
+ /* Reset all parameters that are defined to be reset by SOI */
+
+ for (i = 0; i < NUM_ARITH_TBLS; i++) {
+ cinfo->arith_dc_L[i] = 0;
+ cinfo->arith_dc_U[i] = 1;
+ cinfo->arith_ac_K[i] = 5;
+ }
+ cinfo->restart_interval = 0;
+
+ cinfo->density_unit = 0; /* set default JFIF APP0 values */
+ cinfo->X_density = 1;
+ cinfo->Y_density = 1;
+
+ cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling */
+}
+
+
+LOCAL int
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+next_marker (decompress_info_ptr cinfo)
+#else
+next_marker (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+next_marker (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Find the next JPEG marker */
+/* Note that the output might not be a valid marker code, */
+/* but it will never be 0 or FF */
+{
+ int c, nbytes;
+
+#ifdef XIE_SUPPORTED
+ /* Save the location of the next marker (for restart) */
+ cinfo->XIEnext_input_byte = cinfo->next_input_byte;
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+#endif /* XIE_SUPPORTED */
+ nbytes = 0;
+ do {
+ do { /* skip any non-FF bytes */
+ nbytes++;
+ c = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ } while (c != 0xFF);
+ do { /* skip any duplicate FFs */
+ /* we don't increment nbytes here since extra FFs are legal */
+ c = JGETC(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ } while (c == 0xFF);
+ } while (c == 0); /* repeat if it was a stuffed FF/00 */
+
+#ifndef XIE_SUPPORTED
+ if (nbytes != 1)
+ WARNMS2(cinfo->emethods,
+ "Corrupt JPEG data: %d extraneous bytes before marker 0x%02x",
+ nbytes-1, c);
+#endif /* XIE_SUPPORTED */
+
+ return c;
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+process_tables (decompress_info_ptr cinfo)
+#else
+process_tables (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Scan and process JPEG markers that can appear in any order */
+/* Return when an SOI, EOI, SOFn, or SOS is found */
+{
+ int status;
+#else
+LOCAL JPEG_MARKER
+process_tables (decompress_info_ptr cinfo)
+/* Scan and process JPEG markers that can appear in any order */
+/* Return when an SOI, EOI, SOFn, or SOS is found */
+{
+#endif /* XIE_SUPPORTED */
+ int c;
+
+ while (TRUE) {
+ c = next_marker(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+
+ switch (c) {
+ case M_SOF0:
+ case M_SOF1:
+ case M_SOF2:
+ case M_SOF3:
+ case M_SOF5:
+ case M_SOF6:
+ case M_SOF7:
+ case M_JPG:
+ case M_SOF9:
+ case M_SOF10:
+ case M_SOF11:
+ case M_SOF13:
+ case M_SOF14:
+ case M_SOF15:
+ case M_SOI:
+ case M_EOI:
+ case M_SOS:
+#ifdef XIE_SUPPORTED
+ return (c);
+#else
+ return ((JPEG_MARKER) c);
+#endif /* XIE_SUPPORTED */
+
+ case M_DHT:
+#ifdef XIE_SUPPORTED
+ if ((status = get_dht(cinfo)) < 0)
+ return(status);
+#else
+ get_dht(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_DAC:
+#ifdef XIE_SUPPORTED
+ if ((status = get_dac(cinfo)) < 0)
+ return(status);
+#else
+ get_dac(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_DQT:
+#ifdef XIE_SUPPORTED
+ if ((status = get_dqt(cinfo)) < 0)
+ return(status);
+#else
+ get_dqt(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_DRI:
+#ifdef XIE_SUPPORTED
+ if ((status = get_dri(cinfo)) < 0)
+ return(status);
+#else
+ get_dri(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_APP0:
+#ifdef XIE_SUPPORTED
+ if ((status = get_app0(cinfo)) < 0)
+ return(status);
+#else
+ get_app0(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_COM:
+#ifdef XIE_SUPPORTED
+ if ((status = get_com(cinfo)) < 0)
+ return(status);
+#else
+ get_com(cinfo);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ case M_RST0: /* these are all parameterless */
+ case M_RST1:
+ case M_RST2:
+ case M_RST3:
+ case M_RST4:
+ case M_RST5:
+ case M_RST6:
+ case M_RST7:
+ case M_TEM:
+#ifndef XIE_SUPPORTED
+ TRACEMS1(cinfo->emethods, 1, "Unexpected marker 0x%02x", c);
+#endif /* XIE_SUPPORTED */
+ break;
+
+ default: /* must be DNL, DHP, EXP, APPn, JPGn, COM, or RESn */
+#ifdef XIE_SUPPORTED
+ if (skip_variable(cinfo, c) < 0)
+ return(-1);
+#else
+ skip_variable(cinfo, c);
+#endif /* XIE_SUPPORTED */
+ break;
+ }
+ }
+}
+
+
+
+/*
+ * Initialize and read the file header (everything through the SOF marker).
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+read_file_header (decompress_info_ptr cinfo)
+#else
+read_file_header (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ int i, j;
+ int status;
+#else
+METHODDEF void
+read_file_header (decompress_info_ptr cinfo)
+{
+#endif /* XIE_SUPPORTED */
+ int c;
+
+ /* Demand an SOI marker at the start of the file --- otherwise it's
+ * probably not a JPEG file at all. If the user interface wants to support
+ * nonstandard headers in front of the SOI, it must skip over them itself
+ * before calling jpeg_decompress().
+ */
+#ifdef XIE_SUPPORTED
+ if (cinfo->XIErestart != XIE_RRFH) { /* don't read signature bytes on restart */
+ if ((i = JGETC(cinfo)) < 0)
+ return(-1);
+ if ((j = JGETC(cinfo)) < 0)
+ return(-1);
+ if (i != 0xFF || j != M_SOI)
+ return(XIE_ERR);
+
+ get_soi(cinfo); /* OK, process SOI */
+ }
+#else
+ if (JGETC(cinfo) != 0xFF || JGETC(cinfo) != M_SOI)
+ ERREXIT(cinfo->emethods, "Not a JPEG file");
+
+ get_soi(cinfo); /* OK, process SOI */
+#endif /* XIE_SUPPORTED */
+
+ /* Process markers until SOF */
+ c = process_tables(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(c);
+#endif /* XIE_SUPPORTED */
+
+ switch (c) {
+ case M_SOF0:
+ case M_SOF1:
+#ifdef XIE_SUPPORTED
+ if ((status = get_sof(cinfo, c)) < 0)
+ return(status);
+#else
+ get_sof(cinfo, c);
+#endif /* XIE_SUPPORTED */
+ cinfo->arith_code = FALSE;
+ break;
+
+ case M_SOF9:
+#ifdef XIE_SUPPORTED
+ if ((status = get_sof(cinfo, c)) < 0)
+ return(status);
+#else
+ get_sof(cinfo, c);
+#endif /* XIE_SUPPORTED */
+ cinfo->arith_code = TRUE;
+ break;
+
+ default:
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Unsupported SOF marker type 0x%02x", c);
+#endif /* XIE_SUPPORTED */
+ break;
+ }
+
+ /* Figure out what colorspace we have */
+ /* (too bad the JPEG committee didn't provide a real way to specify this) */
+
+ switch (cinfo->num_components) {
+ case 1:
+ cinfo->jpeg_color_space = CS_GRAYSCALE;
+ break;
+
+ case 3:
+ /* if we saw a JFIF marker, leave it set to YCbCr; */
+ /* also leave it alone if UI has provided a value */
+ if (cinfo->jpeg_color_space == CS_UNKNOWN) {
+ short cid0 = cinfo->comp_info[0].component_id;
+ short cid1 = cinfo->comp_info[1].component_id;
+ short cid2 = cinfo->comp_info[2].component_id;
+
+ if (cid0 == 1 && cid1 == 2 && cid2 == 3)
+ cinfo->jpeg_color_space = CS_YCbCr; /* assume it's JFIF w/out marker */
+ else if (cid0 == 1 && cid1 == 4 && cid2 == 5)
+ cinfo->jpeg_color_space = CS_YIQ; /* prototype's YIQ matrix */
+ else {
+#ifndef XIE_SUPPORTED
+ TRACEMS3(cinfo->emethods, 1,
+ "Unrecognized component IDs %d %d %d, assuming YCbCr",
+ cid0, cid1, cid2);
+#endif /* XIE_SUPPORTED */
+ cinfo->jpeg_color_space = CS_YCbCr;
+ }
+ }
+ break;
+
+ case 4:
+ cinfo->jpeg_color_space = CS_CMYK;
+ break;
+
+ default:
+ cinfo->jpeg_color_space = CS_UNKNOWN;
+ break;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Read the start of a scan (everything through the SOS marker).
+ * Return TRUE if find SOS, FALSE if find EOI.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+read_scan_header (decompress_info_ptr cinfo)
+#else
+read_scan_header (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF boolean
+read_scan_header (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ int c;
+
+ /* Process markers until SOS or EOI */
+ c = process_tables(cinfo);
+#ifdef XIE_SUPPORTED
+ if (c < 0)
+ return(c);
+#endif /* XIE_SUPPORTED */
+
+ switch (c) {
+ case M_SOS:
+#ifdef XIE_SUPPORTED
+ return(get_sos(cinfo)); /* 0, OK; -1, read error */
+#else
+ get_sos(cinfo);
+ return TRUE;
+#endif /* XIE_SUPPORTED */
+
+ case M_EOI:
+#ifndef XIE_SUPPORTED
+ TRACEMS(cinfo->emethods, 1, "End Of Image");
+#endif /* XIE_SUPPORTED */
+ return FALSE;
+
+ default:
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Unexpected marker 0x%02x", c);
+#endif /* XIE_SUPPORTED */
+ break;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#else
+ return FALSE; /* keeps lint happy */
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * The entropy decoder calls this routine if it finds a marker other than
+ * the restart marker it was expecting. (This code is *not* used unless
+ * a nonzero restart interval has been declared.) The passed parameter is
+ * the marker code actually found (might be anything, except 0 or FF).
+ * The desired restart marker is that indicated by cinfo->next_restart_num.
+ * This routine is supposed to apply whatever error recovery strategy seems
+ * appropriate in order to position the input stream to the next data segment.
+ * For some file formats (eg, TIFF) extra information such as tile boundary
+ * pointers may be available to help in this decision.
+ *
+ * This implementation is substantially constrained by wanting to treat the
+ * input as a data stream; this means we can't back up. (For instance, we
+ * generally can't fseek() if the input is a Unix pipe.) Therefore, we have
+ * only the following actions to work with:
+ * 1. Do nothing, let the entropy decoder resume at next byte of file.
+ * 2. Read forward until we find another marker, discarding intervening
+ * data. (In theory we could look ahead within the current bufferload,
+ * without having to discard data if we don't find the desired marker.
+ * This idea is not implemented here, in part because it makes behavior
+ * dependent on buffer size and chance buffer-boundary positions.)
+ * 3. Push back the passed marker (with JUNGETC). This will cause the
+ * entropy decoder to process an empty data segment, inserting dummy
+ * zeroes, and then re-read the marker we pushed back.
+ * #2 is appropriate if we think the desired marker lies ahead, while #3 is
+ * appropriate if the found marker is a future restart marker (indicating
+ * that we have missed the desired restart marker, probably because it got
+ * corrupted).
+
+ * We apply #2 or #3 if the found marker is a restart marker no more than
+ * two counts behind or ahead of the expected one. We also apply #2 if the
+ * found marker is not a legal JPEG marker code (it's certainly bogus data).
+ * If the found marker is a restart marker more than 2 counts away, we do #1
+ * (too much risk that the marker is erroneous; with luck we will be able to
+ * resync at some future point).
+ * For any valid non-restart JPEG marker, we apply #3. This keeps us from
+ * overrunning the end of a scan. An implementation limited to single-scan
+ * files might find it better to apply #2 for markers other than EOI, since
+ * any other marker would have to be bogus data in that case.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+resync_to_restart (decompress_info_ptr cinfo, int marker)
+#else
+resync_to_restart (cinfo, marker)
+ decompress_info_ptr cinfo;
+ int marker;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+resync_to_restart (decompress_info_ptr cinfo, int marker)
+#endif /* XIE_SUPPORTED */
+{
+ int desired = cinfo->next_restart_num;
+ int action = 1;
+
+ /* Always put up a warning. */
+#ifndef XIE_SUPPORTED
+ WARNMS2(cinfo->emethods,
+ "Corrupt JPEG data: found 0x%02x marker instead of RST%d",
+ marker, desired);
+#endif /* XIE_SUPPORTED */
+ /* Outer loop handles repeated decision after scanning forward. */
+ for (;;) {
+ if (marker < (int) M_SOF0)
+ action = 2; /* invalid marker */
+ else if (marker < (int) M_RST0 || marker > (int) M_RST7)
+ action = 3; /* valid non-restart marker */
+ else {
+ if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
+ marker == ((int) M_RST0 + ((desired+2) & 7)))
+ action = 3; /* one of the next two expected restarts */
+ else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
+ marker == ((int) M_RST0 + ((desired-2) & 7)))
+ action = 2; /* a prior restart, so advance */
+ else
+ action = 1; /* desired restart or too far away */
+ }
+#ifndef XIE_SUPPORTED
+ TRACEMS2(cinfo->emethods, 4,
+ "At marker 0x%02x, recovery action %d", marker, action);
+#endif /* XIE_SUPPORTED */
+ switch (action) {
+ case 1:
+ /* Let entropy decoder resume processing. */
+#ifdef XIE_SUPPORTED
+ return(0);
+#else
+ return;
+#endif /* XIE_SUPPORTED */
+ case 2:
+ /* Scan to the next marker, and repeat the decision loop. */
+ marker = next_marker(cinfo);
+#ifdef XIE_SUPPORTED
+ if (marker < 0)
+ return(-1);
+#endif /* XIE_SUPPORTED */
+ break;
+ case 3:
+ /* Put back this marker & return. */
+ /* Entropy decoder will be forced to process an empty segment. */
+ JUNGETC(marker, cinfo);
+ JUNGETC(0xFF, cinfo);
+#ifdef XIE_SUPPORTED
+ return(0);
+#else
+ return;
+#endif /* XIE_SUPPORTED */
+ }
+ }
+}
+
+
+/*
+ * Finish up after a compressed scan (series of read_jpeg_data calls);
+ * prepare for another read_scan_header call.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+read_scan_trailer (decompress_info_ptr cinfo)
+#else
+read_scan_trailer (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+read_scan_trailer (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work needed */
+}
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Finish up at the end of the file.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+read_file_trailer (decompress_info_ptr cinfo)
+#else
+read_file_trailer (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+read_file_trailer (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work needed */
+}
+#endif /* XIE_SUPPORTED */
+
+/*
+ * The method selection routine for standard JPEG header reading.
+ * Note that this must be called by the user interface before calling
+ * jpeg_decompress. When a non-JFIF file is to be decompressed (TIFF,
+ * perhaps), the user interface must discover the file type and call
+ * the appropriate method selection routine.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselrjfif (decompress_info_ptr cinfo)
+#else
+jselrjfif (cinfo)
+ decompress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselrjfif (decompress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ cinfo->methods->read_file_header = read_file_header;
+ cinfo->methods->read_scan_header = read_scan_header;
+ /* For JFIF/raw-JPEG format, the user interface supplies read_jpeg_data. */
+#ifndef XIE_SUPPORTED
+#if NOTDEF
+ cinfo->methods->read_jpeg_data = read_jpeg_data;
+#endif
+#endif /* XIE_SUPPORTED */
+ cinfo->methods->resync_to_restart = resync_to_restart;
+#ifndef XIE_SUPPORTED
+ cinfo->methods->read_scan_trailer = read_scan_trailer;
+ cinfo->methods->read_file_trailer = read_file_trailer;
+#endif /* XIE_SUPPORTED */
+}
+
+#endif /* JFIF_SUPPORTED */
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jrevdct.c b/xc/programs/Xserver/XIE/mixie/jpeg/jrevdct.c
new file mode 100644
index 000000000..a98c8da02
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jrevdct.c
@@ -0,0 +1,447 @@
+/* $TOG: jrevdct.c /main/5 1998/02/09 16:20:38 kaleb $ */
+/* Module jrevdct.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jrevdct.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains the basic inverse-DCT transformation subroutine.
+ *
+ * This implementation is based on an algorithm described in
+ * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
+ * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
+ * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
+ * The primary algorithm described there uses 11 multiplies and 29 adds.
+ * We use their alternate method with 12 multiplies and 32 adds.
+ * The advantage of this method is that no data path contains more than one
+ * multiplication; this allows a very simple and accurate implementation in
+ * scaled fixed-point arithmetic, with a minimal number of shifts.
+ */
+
+#include "jinclude.h"
+
+/*
+ * This routine is specialized to the case DCTSIZE = 8.
+ */
+
+#if DCTSIZE != 8
+ Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+#endif
+
+
+/*
+ * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
+ * on each column. Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * The poop on this scaling stuff is as follows:
+ *
+ * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
+ * larger than the true IDCT outputs. The final outputs are therefore
+ * a factor of N larger than desired; since N=8 this can be cured by
+ * a simple right shift at the end of the algorithm. The advantage of
+ * this arrangement is that we save two multiplications per 1-D IDCT,
+ * because the y0 and y4 inputs need not be divided by sqrt(N).
+ *
+ * We have to do addition and subtraction of the integer inputs, which
+ * is no problem, and multiplication by fractional constants, which is
+ * a problem to do in integer arithmetic. We multiply all the constants
+ * by CONST_SCALE and convert them to integer constants (thus retaining
+ * CONST_BITS bits of precision in the constants). After doing a
+ * multiplication we have to divide the product by CONST_SCALE, with proper
+ * rounding, to produce the correct output. This division can be done
+ * cheaply as a right shift of CONST_BITS bits. We postpone shifting
+ * as long as possible so that partial sums can be added together with
+ * full fractional precision.
+ *
+ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
+ * they are represented to better-than-integral precision. These outputs
+ * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
+ * with the recommended scaling. (To scale up 12-bit sample data further, an
+ * intermediate INT32 array would be needed.)
+ *
+ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
+ * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
+ * shows that the values given below are the most effective.
+ */
+
+#ifdef EIGHT_BIT_SAMPLES
+#define CONST_BITS 13
+#define PASS1_BITS 2
+#else
+#define CONST_BITS 13
+#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
+#endif
+
+#define ONE ((INT32) 1)
+
+#define CONST_SCALE (ONE << CONST_BITS)
+
+/* Convert a positive real constant to an integer scaled by CONST_SCALE. */
+
+#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
+
+/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
+ * causing a lot of useless floating-point operations at run time.
+ * To get around this we use the following pre-calculated constants.
+ * If you change CONST_BITS you may want to add appropriate values.
+ * (With a reasonable C compiler, you can just rely on the FIX() macro...)
+ */
+
+#if CONST_BITS == 13
+#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
+#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
+#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
+#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
+#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
+#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
+#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
+#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
+#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
+#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
+#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
+#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
+#else
+#define FIX_0_298631336 FIX(0.298631336)
+#define FIX_0_390180644 FIX(0.390180644)
+#define FIX_0_541196100 FIX(0.541196100)
+#define FIX_0_765366865 FIX(0.765366865)
+#define FIX_0_899976223 FIX(0.899976223)
+#define FIX_1_175875602 FIX(1.175875602)
+#define FIX_1_501321110 FIX(1.501321110)
+#define FIX_1_847759065 FIX(1.847759065)
+#define FIX_1_961570560 FIX(1.961570560)
+#define FIX_2_053119869 FIX(2.053119869)
+#define FIX_2_562915447 FIX(2.562915447)
+#define FIX_3_072711026 FIX(3.072711026)
+#endif
+
+
+/* Descale and correctly round an INT32 value that's scaled by N bits.
+ * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
+ * the fudge factor is correct for either sign of X.
+ */
+
+#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
+
+/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
+ * this provides a useful speedup on many machines.
+ * There is no way to specify a 16x16->32 multiply in portable C, but
+ * some C compilers will do the right thing if you provide the correct
+ * combination of casts.
+ * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#ifdef EIGHT_BIT_SAMPLES
+#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
+#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
+#endif
+#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
+#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
+#endif
+#endif
+
+#ifndef MULTIPLY /* default definition */
+#define MULTIPLY(var,const) ((var) * (const))
+#endif
+
+
+/*
+ * Perform the inverse DCT on one block of coefficients.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+j_rev_dct (DCTBLOCK data)
+#else
+j_rev_dct (data)
+ DCTBLOCK data;
+#endif /* NeedFunctionPrototypes */
+#else
+j_rev_dct (DCTBLOCK data)
+#endif /* XIE_SUPPORTED */
+{
+ INT32 tmp0, tmp1, tmp2, tmp3;
+ INT32 tmp10, tmp11, tmp12, tmp13;
+ INT32 z1, z2, z3, z4, z5;
+ register DCTELEM *dataptr;
+ int rowctr;
+ SHIFT_TEMPS
+
+ /* Pass 1: process rows. */
+ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
+ /* furthermore, we scale the results by 2**PASS1_BITS. */
+
+ dataptr = data;
+ for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ /* Due to quantization, we will usually find that many of the input
+ * coefficients are zero, especially the AC terms. We can exploit this
+ * by short-circuiting the IDCT calculation for any row in which all
+ * the AC terms are zero. In that case each output is equal to the
+ * DC coefficient (with scale factor as needed).
+ * With typical images and quantization tables, half or more of the
+ * row DCT calculations can be simplified this way.
+ */
+
+ if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
+ dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
+ /* AC terms all zero */
+ DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS);
+
+ dataptr[0] = dcval;
+ dataptr[1] = dcval;
+ dataptr[2] = dcval;
+ dataptr[3] = dcval;
+ dataptr[4] = dcval;
+ dataptr[5] = dcval;
+ dataptr[6] = dcval;
+ dataptr[7] = dcval;
+
+ dataptr += DCTSIZE; /* advance pointer to next row */
+ continue;
+ }
+
+ /* Even part: reverse the even part of the forward DCT. */
+ /* The rotator is sqrt(2)*c(-6). */
+
+ z2 = (INT32) dataptr[2];
+ z3 = (INT32) dataptr[6];
+
+ z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
+ tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+ tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+
+ tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS;
+ tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS;
+
+ tmp10 = tmp0 + tmp3;
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ /* Odd part per figure 8; the matrix is unitary and hence its
+ * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
+ */
+
+ tmp0 = (INT32) dataptr[7];
+ tmp1 = (INT32) dataptr[5];
+ tmp2 = (INT32) dataptr[3];
+ tmp3 = (INT32) dataptr[1];
+
+ z1 = tmp0 + tmp3;
+ z2 = tmp1 + tmp2;
+ z3 = tmp0 + tmp2;
+ z4 = tmp1 + tmp3;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+
+ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+
+ dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
+ dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
+ dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
+ dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
+ dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
+ dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
+ dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
+ dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
+
+ dataptr += DCTSIZE; /* advance pointer to next row */
+ }
+
+ /* Pass 2: process columns. */
+ /* Note that we must descale the results by a factor of 8 == 2**3, */
+ /* and also undo the PASS1_BITS scaling. */
+
+ dataptr = data;
+ for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ /* Columns of zeroes can be exploited in the same way as we did with rows.
+ * However, the row calculation has created many nonzero AC terms, so the
+ * simplification applies less often (typically 5% to 10% of the time).
+ * On machines with very fast multiplication, it's possible that the
+ * test takes more time than it's worth. In that case this section
+ * may be commented out.
+ */
+
+#ifndef NO_ZERO_COLUMN_TEST
+ if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
+ dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
+ dataptr[DCTSIZE*7]) == 0) {
+ /* AC terms all zero */
+ DCTELEM dcval = (DCTELEM) DESCALE((INT32) dataptr[0], PASS1_BITS+3);
+
+ dataptr[DCTSIZE*0] = dcval;
+ dataptr[DCTSIZE*1] = dcval;
+ dataptr[DCTSIZE*2] = dcval;
+ dataptr[DCTSIZE*3] = dcval;
+ dataptr[DCTSIZE*4] = dcval;
+ dataptr[DCTSIZE*5] = dcval;
+ dataptr[DCTSIZE*6] = dcval;
+ dataptr[DCTSIZE*7] = dcval;
+
+ dataptr++; /* advance pointer to next column */
+ continue;
+ }
+#endif
+
+ /* Even part: reverse the even part of the forward DCT. */
+ /* The rotator is sqrt(2)*c(-6). */
+
+ z2 = (INT32) dataptr[DCTSIZE*2];
+ z3 = (INT32) dataptr[DCTSIZE*6];
+
+ z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
+ tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
+ tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+
+ tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
+ tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
+
+ tmp10 = tmp0 + tmp3;
+ tmp13 = tmp0 - tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+
+ /* Odd part per figure 8; the matrix is unitary and hence its
+ * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
+ */
+
+ tmp0 = (INT32) dataptr[DCTSIZE*7];
+ tmp1 = (INT32) dataptr[DCTSIZE*5];
+ tmp2 = (INT32) dataptr[DCTSIZE*3];
+ tmp3 = (INT32) dataptr[DCTSIZE*1];
+
+ z1 = tmp0 + tmp3;
+ z2 = tmp1 + tmp2;
+ z3 = tmp0 + tmp2;
+ z4 = tmp1 + tmp3;
+ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
+ z3 += z5;
+ z4 += z5;
+
+ tmp0 += z1 + z3;
+ tmp1 += z2 + z4;
+ tmp2 += z2 + z3;
+ tmp3 += z1 + z4;
+
+ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
+
+ dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
+ CONST_BITS+PASS1_BITS+3);
+ dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
+ CONST_BITS+PASS1_BITS+3);
+
+ dataptr++; /* advance pointer to next column */
+ }
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jutils.c b/xc/programs/Xserver/XIE/mixie/jpeg/jutils.c
new file mode 100644
index 000000000..aa84d472a
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jutils.c
@@ -0,0 +1,234 @@
+/* $TOG: jutils.c /main/5 1998/02/09 16:20:43 kaleb $ */
+/* Module jutils.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jutils.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains miscellaneous utility routines needed for both
+ * compression and decompression.
+ * Note we prefix all global names with "j" to minimize conflicts with
+ * a surrounding application.
+ */
+
+#include "jinclude.h"
+#include "macro.h"
+
+
+GLOBAL long
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jround_up (long a, long b)
+#else
+jround_up (a, b)
+ long a;
+ long b;
+#endif /* NeedFunctionPrototypes */
+#else
+jround_up (long a, long b)
+#endif /* XIE_SUPPORTED */
+/* Compute a rounded up to next multiple of b; a >= 0, b > 0 */
+{
+ a += b-1;
+ return a - (a % b);
+}
+
+
+/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
+ * and coefficient-block arrays. This won't work on 80x86 because the arrays
+ * are FAR and we're assuming a small-pointer memory model. However, some
+ * DOS compilers provide far-pointer versions of memcpy() and memset() even
+ * in the small-model libraries. These will be used if USE_FMEM is defined.
+ * Otherwise, the routines below do it the hard way. (The performance cost
+ * is not all that great, because these routines aren't very heavily used.)
+ */
+
+#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
+#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
+#define FMEMZERO(target,size) MEMZERO(target,size)
+#else /* 80x86 case, define if we can */
+#ifdef USE_FMEM
+#define FMEMCOPY(dest,src,size) _fmemcpy((pointer)(dest), (const pointer)(src), (size_t)(size))
+#define FMEMZERO(target,size) _fmemset((pointer)(target), 0, (size_t)(size))
+#endif
+#endif
+
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
+ JSAMPARRAY output_array, int dest_row,
+ int num_rows, long num_cols)
+#else
+jcopy_sample_rows (input_array, source_row,
+ output_array, dest_row,
+ num_rows, num_cols)
+ JSAMPARRAY input_array;
+ int source_row;
+ JSAMPARRAY output_array;
+ int dest_row;
+ int num_rows;
+ long num_cols;
+#endif /* NeedFunctionPrototypes */
+#else
+jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
+ JSAMPARRAY output_array, int dest_row,
+ int num_rows, long num_cols)
+#endif /* XIE_SUPPORTED */
+/* Copy some rows of samples from one place to another.
+ * num_rows rows are copied from input_array[source_row++]
+ * to output_array[dest_row++]; these areas should not overlap.
+ * The source and destination arrays must be at least as wide as num_cols.
+ */
+{
+ register JSAMPROW inptr, outptr;
+#ifdef FMEMCOPY
+ register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
+#else
+ register long count;
+#endif
+ register int row;
+
+ input_array += source_row;
+ output_array += dest_row;
+
+ for (row = num_rows; row > 0; row--) {
+ inptr = *input_array++;
+ outptr = *output_array++;
+#ifdef FMEMCOPY
+ FMEMCOPY(outptr, inptr, count);
+#else
+ for (count = num_cols; count > 0; count--)
+ *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */
+#endif
+ }
+}
+
+
+#ifndef XIE_SUPPORTED
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, long num_blocks)
+#else
+jcopy_block_row (input_row, output_row, num_blocks)
+ JBLOCKROW input_row;
+ JBLOCKROW output_row;
+ long num_blocks;
+#endif /* NeedFunctionPrototypes */
+#else
+jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, long num_blocks)
+#endif /* XIE_SUPPORTED */
+/* Copy a row of coefficient blocks from one place to another. */
+{
+#ifdef FMEMCOPY
+ FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
+#else
+ register JCOEFPTR inptr, outptr;
+ register long count;
+
+ inptr = (JCOEFPTR) input_row;
+ outptr = (JCOEFPTR) output_row;
+ for (count = num_blocks * DCTSIZE2; count > 0; count--) {
+ *outptr++ = *inptr++;
+ }
+#endif
+}
+#endif /* XIE_SUPPORTED */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jzero_far (pointer target, size_t bytestozero)
+#else
+jzero_far (target, bytestozero)
+ pointer target;
+ size_t bytestozero;
+#endif /* NeedFunctionPrototypes */
+#else
+jzero_far (pointer target, size_t bytestozero)
+#endif /* XIE_SUPPORTED */
+/* Zero out a chunk of FAR memory. */
+/* This might be sample-array data, block-array data, or alloc_medium data. */
+{
+#ifdef FMEMZERO
+ FMEMZERO(target, bytestozero);
+#else
+ register char FAR * ptr = (char FAR *) target;
+ register size_t count;
+
+ for (count = bytestozero; count > 0; count--) {
+ *ptr++ = 0;
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/XIE/mixie/jpeg/jwrjfif.c b/xc/programs/Xserver/XIE/mixie/jpeg/jwrjfif.c
new file mode 100644
index 000000000..238457b76
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/jpeg/jwrjfif.c
@@ -0,0 +1,981 @@
+/* $TOG: jwrjfif.c /main/5 1998/02/09 16:20:48 kaleb $ */
+/* Module jwrjfif.c */
+
+/****************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ Gary Rogers, AGE Logic, Inc., October 1993
+ Gary Rogers, AGE Logic, Inc., January 1994
+
+****************************************************************************/
+
+/*
+ * jwrjfif.c
+ *
+ * Copyright (C) 1991, 1992, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains routines to write standard JPEG file headers/markers.
+ * The file format created is a raw JPEG data stream with (optionally) an
+ * APP0 marker per the JFIF spec. This will handle baseline and
+ * JFIF-convention JPEG files, although there is currently no provision
+ * for inserting a thumbnail image in the JFIF header.
+ *
+ * These routines may need modification for non-Unix environments or
+ * specialized applications. As they stand, they assume output to
+ * an ordinary stdio stream. However, the changes to write to something
+ * else are localized in the macros appearing just below.
+ *
+ * These routines are invoked via the methods write_file_header,
+ * write_scan_header, write_jpeg_data, write_scan_trailer, and
+ * write_file_trailer.
+ */
+
+#include "jinclude.h"
+
+#ifdef JFIF_SUPPORTED
+
+
+/*
+ * To output to something other than a stdio stream, you'd need to redefine
+ * these macros.
+ */
+
+/* Write a single byte */
+#ifdef XIE_SUPPORTED
+#define emit_byte(cinfo,x) \
+ MAKESTMT( if (cinfo->bytes_in_buffer >= cinfo->jpeg_buf_size) \
+ return(-1); \
+ cinfo->output_buffer[cinfo->bytes_in_buffer++] = (char) (x); )
+#else
+#define emit_byte(cinfo,x) putc((x), cinfo->output_file)
+#endif /* XIE_SUPPORTED */
+
+/* End of stdio-specific code. */
+
+
+typedef enum { /* JPEG marker codes */
+ M_SOF0 = 0xc0,
+ M_SOF1 = 0xc1,
+ M_SOF2 = 0xc2,
+ M_SOF3 = 0xc3,
+
+ M_SOF5 = 0xc5,
+ M_SOF6 = 0xc6,
+ M_SOF7 = 0xc7,
+
+ M_JPG = 0xc8,
+ M_SOF9 = 0xc9,
+ M_SOF10 = 0xca,
+ M_SOF11 = 0xcb,
+
+ M_SOF13 = 0xcd,
+ M_SOF14 = 0xce,
+ M_SOF15 = 0xcf,
+
+ M_DHT = 0xc4,
+
+ M_DAC = 0xcc,
+
+ M_RST0 = 0xd0,
+ M_RST1 = 0xd1,
+ M_RST2 = 0xd2,
+ M_RST3 = 0xd3,
+ M_RST4 = 0xd4,
+ M_RST5 = 0xd5,
+ M_RST6 = 0xd6,
+ M_RST7 = 0xd7,
+
+ M_SOI = 0xd8,
+ M_EOI = 0xd9,
+ M_SOS = 0xda,
+ M_DQT = 0xdb,
+ M_DNL = 0xdc,
+ M_DRI = 0xdd,
+ M_DHP = 0xde,
+ M_EXP = 0xdf,
+
+ M_APP0 = 0xe0,
+ M_APP15 = 0xef,
+
+ M_JPG0 = 0xf0,
+ M_JPG13 = 0xfd,
+ M_COM = 0xfe,
+
+ M_TEM = 0x01,
+
+ M_ERROR = 0x100
+} JPEG_MARKER;
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_marker (compress_info_ptr cinfo, JPEG_MARKER mark)
+#else
+emit_marker (cinfo, mark)
+ compress_info_ptr cinfo;
+ JPEG_MARKER mark;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_marker (compress_info_ptr cinfo, JPEG_MARKER mark)
+#endif /* XIE_SUPPORTED */
+/* Emit a marker code */
+{
+ emit_byte(cinfo, 0xFF);
+ emit_byte(cinfo, mark);
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_2bytes (compress_info_ptr cinfo, int value)
+#else
+emit_2bytes (cinfo, value)
+ compress_info_ptr cinfo;
+ int value;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_2bytes (compress_info_ptr cinfo, int value)
+#endif /* XIE_SUPPORTED */
+/* Emit a 2-byte integer; these are always MSB first in JPEG files */
+{
+ emit_byte(cinfo, (value >> 8) & 0xFF);
+ emit_byte(cinfo, value & 0xFF);
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_dqt (compress_info_ptr cinfo, int index)
+#else
+emit_dqt (cinfo, index)
+ compress_info_ptr cinfo;
+ int index;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_dqt (compress_info_ptr cinfo, int index)
+#endif /* XIE_SUPPORTED */
+/* Emit a DQT marker */
+/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
+{
+ QUANT_TBL_PTR data = cinfo->quant_tbl_ptrs[index];
+ int prec = 0;
+ int i;
+
+ for (i = 0; i < DCTSIZE2; i++) {
+ if (data[i] > 255)
+ prec = 1;
+ }
+
+#ifdef XIE_SUPPORTED
+ if (emit_marker(cinfo, M_DQT) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2) < 0)
+ return(-1);
+#else
+ emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
+
+ emit_marker(cinfo, M_DQT);
+#endif /* XIE_SUPPORTED */
+
+ emit_byte(cinfo, index + (prec<<4));
+
+ for (i = 0; i < DCTSIZE2; i++) {
+ if (prec)
+ emit_byte(cinfo, data[i] >> 8);
+ emit_byte(cinfo, data[i] & 0xFF);
+ }
+
+ return prec;
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_dht (compress_info_ptr cinfo, int index, boolean is_ac)
+#else
+emit_dht (cinfo, index, is_ac)
+ compress_info_ptr cinfo;
+ int index;
+ boolean is_ac;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_dht (compress_info_ptr cinfo, int index, boolean is_ac)
+#endif /* XIE_SUPPORTED */
+/* Emit a DHT marker */
+{
+ HUFF_TBL * htbl;
+ int length, i;
+
+ if (is_ac) {
+ htbl = cinfo->ac_huff_tbl_ptrs[index];
+ index += 0x10; /* output index has AC bit set */
+ } else {
+ htbl = cinfo->dc_huff_tbl_ptrs[index];
+ }
+
+ if (htbl == NULL)
+#ifdef XIE_SUPPORTED
+ return(XIE_ERR);
+#else
+ ERREXIT1(cinfo->emethods, "Huffman table 0x%02x was not defined", index);
+#endif /* XIE_SUPPORTED */
+
+ if (! htbl->sent_table) {
+#ifdef XIE_SUPPORTED
+ if (emit_marker(cinfo, M_DHT) < 0)
+ return(-1);
+#else
+ emit_marker(cinfo, M_DHT);
+#endif /* XIE_SUPPORTED */
+
+ length = 0;
+ for (i = 1; i <= 16; i++)
+ length += htbl->bits[i];
+
+#ifdef XIE_SUPPORTED
+ if (emit_2bytes(cinfo, length + 2 + 1 + 16) < 0)
+ return(-1);
+#else
+ emit_2bytes(cinfo, length + 2 + 1 + 16);
+#endif /* XIE_SUPPORTED */
+ emit_byte(cinfo, index);
+
+ for (i = 1; i <= 16; i++)
+ emit_byte(cinfo, htbl->bits[i]);
+
+ for (i = 0; i < length; i++)
+ emit_byte(cinfo, htbl->huffval[i]);
+
+ htbl->sent_table = TRUE;
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_dac (compress_info_ptr cinfo)
+#else
+emit_dac (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_dac (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Emit a DAC marker */
+/* Since the useful info is so small, we want to emit all the tables in */
+/* one DAC marker. Therefore this routine does its own scan of the table. */
+{
+ char dc_in_use[NUM_ARITH_TBLS];
+ char ac_in_use[NUM_ARITH_TBLS];
+ int length, i;
+
+ for (i = 0; i < NUM_ARITH_TBLS; i++)
+ dc_in_use[i] = ac_in_use[i] = 0;
+
+ for (i = 0; i < cinfo->num_components; i++) {
+ dc_in_use[cinfo->comp_info[i].dc_tbl_no] = 1;
+ ac_in_use[cinfo->comp_info[i].ac_tbl_no] = 1;
+ }
+
+ length = 0;
+ for (i = 0; i < NUM_ARITH_TBLS; i++)
+ length += dc_in_use[i] + ac_in_use[i];
+
+#ifdef XIE_SUPPORTED
+ if (emit_marker(cinfo, M_DAC) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, length*2 + 2) < 0)
+ return(-1);
+#else
+ emit_marker(cinfo, M_DAC);
+
+ emit_2bytes(cinfo, length*2 + 2);
+#endif /* XIE_SUPPORTED */
+
+ for (i = 0; i < NUM_ARITH_TBLS; i++) {
+ if (dc_in_use[i]) {
+ emit_byte(cinfo, i);
+ emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
+ }
+ if (ac_in_use[i]) {
+ emit_byte(cinfo, i + 0x10);
+ emit_byte(cinfo, cinfo->arith_ac_K[i]);
+ }
+ }
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_dri (compress_info_ptr cinfo)
+#else
+emit_dri (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+/* Emit a DRI marker */
+{
+ if (emit_marker(cinfo, M_DRI) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, 4) < 0) /* fixed length */
+ return(-1);
+
+ if (emit_2bytes(cinfo, (int) cinfo->restart_interval) < 0)
+ return(-1);
+
+ return(0);
+}
+#else
+LOCAL void
+emit_dri (compress_info_ptr cinfo)
+/* Emit a DRI marker */
+{
+ emit_marker(cinfo, M_DRI);
+
+ emit_2bytes(cinfo, 4); /* fixed length */
+
+ emit_2bytes(cinfo, (int) cinfo->restart_interval);
+}
+#endif /* XIE_SUPPORTED */
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_sof (compress_info_ptr cinfo, JPEG_MARKER code)
+#else
+emit_sof (cinfo, code)
+ compress_info_ptr cinfo;
+ JPEG_MARKER code;
+#endif /* NeedFunctionPrototypes */
+/* Emit a SOF marker */
+{
+ int i;
+
+ if (emit_marker(cinfo, code) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1) < 0)
+ return(-1); /* length */
+
+ if (cinfo->image_height > 65535L || cinfo->image_width > 65535L)
+ return(XIE_ERR);
+
+ emit_byte(cinfo, cinfo->data_precision);
+ if (emit_2bytes(cinfo, (int) cinfo->image_height) < 0)
+ return(-1);
+ if (emit_2bytes(cinfo, (int) cinfo->image_width) < 0)
+ return(-1);
+
+ emit_byte(cinfo, cinfo->num_components);
+
+ for (i = 0; i < cinfo->num_components; i++) {
+ emit_byte(cinfo, cinfo->comp_info[i].component_id);
+ emit_byte(cinfo, (cinfo->comp_info[i].h_samp_factor << 4)
+ + cinfo->comp_info[i].v_samp_factor);
+ emit_byte(cinfo, cinfo->comp_info[i].quant_tbl_no);
+ }
+ return(0);
+}
+#else
+LOCAL void
+emit_sof (compress_info_ptr cinfo, JPEG_MARKER code)
+/* Emit a SOF marker */
+{
+ int i;
+
+ emit_marker(cinfo, code);
+
+ emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
+
+ if (cinfo->image_height > 65535L || cinfo->image_width > 65535L)
+ ERREXIT(cinfo->emethods, "Maximum image dimension for JFIF is 65535 pixels");
+
+ emit_byte(cinfo, cinfo->data_precision);
+ emit_2bytes(cinfo, (int) cinfo->image_height);
+ emit_2bytes(cinfo, (int) cinfo->image_width);
+
+ emit_byte(cinfo, cinfo->num_components);
+
+ for (i = 0; i < cinfo->num_components; i++) {
+ emit_byte(cinfo, cinfo->comp_info[i].component_id);
+ emit_byte(cinfo, (cinfo->comp_info[i].h_samp_factor << 4)
+ + cinfo->comp_info[i].v_samp_factor);
+ emit_byte(cinfo, cinfo->comp_info[i].quant_tbl_no);
+ }
+}
+#endif /* XIE_SUPPORTED */
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_sos (compress_info_ptr cinfo)
+#else
+emit_sos (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_sos (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Emit a SOS marker */
+{
+ int i;
+
+#ifdef XIE_SUPPORTED
+ if (emit_marker(cinfo, M_SOS) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3) < 0)
+ return(-1); /* length */
+#else
+ emit_marker(cinfo, M_SOS);
+
+ emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
+#endif /* XIE_SUPPORTED */
+
+ emit_byte(cinfo, cinfo->comps_in_scan);
+
+ for (i = 0; i < cinfo->comps_in_scan; i++) {
+ emit_byte(cinfo, cinfo->cur_comp_info[i]->component_id);
+ emit_byte(cinfo, (cinfo->cur_comp_info[i]->dc_tbl_no << 4)
+ + cinfo->cur_comp_info[i]->ac_tbl_no);
+ }
+
+ emit_byte(cinfo, 0); /* Spectral selection start */
+ emit_byte(cinfo, DCTSIZE2-1); /* Spectral selection end */
+ emit_byte(cinfo, 0); /* Successive approximation */
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+#ifdef XIE_SUPPORTED
+LOCAL int
+#if NeedFunctionPrototypes
+emit_jfif_app0 (compress_info_ptr cinfo)
+#else
+emit_jfif_app0 (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+LOCAL void
+emit_jfif_app0 (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+/* Emit a JFIF-compliant APP0 marker */
+{
+ /*
+ * Length of APP0 block (2 bytes)
+ * Block ID (4 bytes - ASCII "JFIF")
+ * Zero byte (1 byte to terminate the ID string)
+ * Version Major, Minor (2 bytes - 0x01, 0x01)
+ * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
+ * Xdpu (2 bytes - dots per unit horizontal)
+ * Ydpu (2 bytes - dots per unit vertical)
+ * Thumbnail X size (1 byte)
+ * Thumbnail Y size (1 byte)
+ */
+
+#ifdef XIE_SUPPORTED
+ if (emit_marker(cinfo, M_APP0) < 0)
+ return(-1);
+
+ if (emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1) < 0)
+ return(-1); /* length */
+#else
+ emit_marker(cinfo, M_APP0);
+
+ emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
+#endif /* XIE_SUPPORTED */
+
+ emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
+ emit_byte(cinfo, 0x46);
+ emit_byte(cinfo, 0x49);
+ emit_byte(cinfo, 0x46);
+ emit_byte(cinfo, 0);
+ emit_byte(cinfo, 1); /* Major version */
+ emit_byte(cinfo, 1); /* Minor version */
+ emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
+#ifdef XIE_SUPPORTED
+ if (emit_2bytes(cinfo, (int) cinfo->X_density) < 0)
+ return(-1);
+ if (emit_2bytes(cinfo, (int) cinfo->Y_density) < 0)
+ return(-1);
+#else
+ emit_2bytes(cinfo, (int) cinfo->X_density);
+ emit_2bytes(cinfo, (int) cinfo->Y_density);
+#endif /* XIE_SUPPORTED */
+ emit_byte(cinfo, 0); /* No thumbnail image */
+ emit_byte(cinfo, 0);
+#ifdef XIE_SUPPORTED
+ return(0);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Write the file header.
+ */
+
+
+#ifdef XIE_SUPPORTED
+LOCAL boolean
+#if NeedFunctionPrototypes
+set_location(compress_info_ptr cinfo, int l)
+#else
+set_location(cinfo, l)
+ compress_info_ptr cinfo;
+ int l;
+#endif /* NeedFunctionPrototypes */
+{
+ if ((cinfo->XIErestart >= XIE_RWRJ) && (cinfo->XIEwrloc != l))
+ return(FALSE);
+
+ cinfo->XIEbytes_in_buffer = cinfo->bytes_in_buffer;
+ cinfo->XIErestart = XIE_RNUL;
+ cinfo->XIEwrloc = l;
+
+ return(TRUE);
+}
+
+METHODDEF int
+#if NeedFunctionPrototypes
+write_file_header (compress_info_ptr cinfo)
+#else
+write_file_header (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+write_file_header (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ char qt_in_use[NUM_QUANT_TBLS];
+ int i, prec;
+ boolean is_baseline;
+
+#ifdef XIE_SUPPORTED
+ int status;
+ int j;
+ if (set_location(cinfo, 1)) {
+ if (emit_marker(cinfo, M_SOI) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT); /* first the SOI */
+ }
+
+ if (cinfo->write_JFIF_header) { /* next an optional JFIF APP0 */
+ if (emit_jfif_app0(cinfo) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ }
+#else
+ emit_marker(cinfo, M_SOI); /* first the SOI */
+
+ if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
+ emit_jfif_app0(cinfo);
+#endif /* XIE_SUPPORTED */
+
+ /* Emit DQT for each quantization table. */
+ /* Note that doing it here means we can't adjust the QTs on-the-fly. */
+ /* If we did want to do that, we'd have a problem with checking precision */
+ /* for the is_baseline determination. */
+
+ for (i = 0; i < NUM_QUANT_TBLS; i++)
+ qt_in_use[i] = 0;
+
+ for (i = 0; i < cinfo->num_components; i++)
+ qt_in_use[cinfo->comp_info[i].quant_tbl_no] = 1;
+
+ prec = 0;
+#ifdef XIE_SUPPORTED
+ if (set_location(cinfo, 2)) {
+ for (i = 0; i < NUM_QUANT_TBLS; i++) {
+ if (qt_in_use[i])
+ {
+ if ((j = emit_dqt(cinfo, i)) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ prec += j;
+ }
+ }
+ }
+#else
+ for (i = 0; i < NUM_QUANT_TBLS; i++) {
+ prec += emit_dqt(cinfo, i);
+ }
+#endif /* XIE_SUPPORTED */
+ /* now prec is nonzero iff there are any 16-bit quant tables. */
+
+ /* Check for a non-baseline specification. */
+ /* Note we assume that Huffman table numbers won't be changed later. */
+ is_baseline = TRUE;
+ if (cinfo->arith_code || (cinfo->data_precision != 8))
+ is_baseline = FALSE;
+ for (i = 0; i < cinfo->num_components; i++) {
+ if (cinfo->comp_info[i].dc_tbl_no > 1 || cinfo->comp_info[i].ac_tbl_no > 1)
+ is_baseline = FALSE;
+ }
+ if (prec && is_baseline) {
+ is_baseline = FALSE;
+ /* If it's baseline except for quantizer size, warn the user */
+#ifndef XIE_SUPPORTED
+ TRACEMS(cinfo->emethods, 0,
+ "Caution: quantization tables are too coarse for baseline JPEG");
+#endif /* XIE_SUPPORTED */
+ }
+
+
+#ifdef XIE_SUPPORTED
+ if (set_location(cinfo, 3)) {
+ /* Emit the proper SOF marker */
+ if (cinfo->arith_code) {
+ if ((status = emit_sof(cinfo, M_SOF9)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT); /* SOF code for arithmetic coding */
+ }
+ } else if (is_baseline) {
+ if ((status = emit_sof(cinfo, M_SOF0)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT); /* SOF code for baseline implementation */
+ }
+ } else {
+ if ((status = emit_sof(cinfo, M_SOF1)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT); /* SOF code for non-baseline Huffman file */
+ }
+ }
+ }
+ return(0);
+#else
+ /* Emit the proper SOF marker */
+ if (cinfo->arith_code)
+ emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
+ else if (is_baseline)
+ emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
+ else
+ emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Write the start of a scan (everything through the SOS marker).
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+write_scan_header (compress_info_ptr cinfo)
+#else
+write_scan_header (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+METHODDEF void
+write_scan_header (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ int i;
+#ifdef XIE_SUPPORTED
+ int status;
+ int l = 0;
+#endif /* XIE_SUPPORTED */
+
+ if (cinfo->arith_code) {
+ /* Emit arith conditioning info. We will have some duplication
+ * if the file has multiple scans, but it's so small it's hardly
+ * worth worrying about.
+ */
+#ifdef XIE_SUPPORTED
+ if (set_location(cinfo, l++)) {
+ if (emit_dac(cinfo) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+#else
+ emit_dac(cinfo);
+#endif /* XIE_SUPPORTED */
+ } else {
+ /* Emit Huffman tables. Note that emit_dht takes care of
+ * suppressing duplicate tables.
+ */
+#ifdef XIE_SUPPORTED
+ for (i = 0; i < cinfo->comps_in_scan; i++) {
+ if (set_location(cinfo, l++)) {
+ if ((status =
+ emit_dht(cinfo, cinfo->cur_comp_info[i]->dc_tbl_no, FALSE)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ if (set_location(cinfo, l++)) {
+ if ((status =
+ emit_dht(cinfo, cinfo->cur_comp_info[i]->ac_tbl_no, TRUE)) < 0) {
+ if (status == XIE_ERR)
+ return(XIE_ERR);
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ }
+#else
+ for (i = 0; i < cinfo->comps_in_scan; i++) {
+ emit_dht(cinfo, cinfo->cur_comp_info[i]->dc_tbl_no, FALSE);
+ emit_dht(cinfo, cinfo->cur_comp_info[i]->ac_tbl_no, TRUE);
+ }
+#endif /* XIE_SUPPORTED */
+ }
+
+ /* Emit DRI if required --- note that DRI value could change for each scan.
+ * If it doesn't, a tiny amount of space is wasted in multiple-scan files.
+ * We assume DRI will never be nonzero for one scan and zero for a later one.
+ */
+#ifdef XIE_SUPPORTED
+ if (cinfo->restart_interval) {
+ if (set_location(cinfo, l++)) {
+ if (emit_dri(cinfo) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ }
+
+ if (set_location(cinfo, l)) {
+ if (emit_sos(cinfo) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ return(0);
+#else
+ if (cinfo->restart_interval)
+ emit_dri(cinfo);
+
+ emit_sos(cinfo);
+#endif /* XIE_SUPPORTED */
+}
+
+
+/*
+ * Write some bytes of compressed data within a scan.
+ */
+
+#ifndef XIE_SUPPORTED
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+write_jpeg_data (compress_info_ptr cinfo, char *dataptr, int datacount)
+#else
+write_jpeg_data (cinfo, dataptr, datacount)
+ compress_info_ptr cinfo;
+ char *dataptr;
+ int datacount;
+#endif /* NeedFunctionPrototypes */
+#else
+write_jpeg_data (compress_info_ptr cinfo, char *dataptr, int datacount)
+#endif /* XIE_SUPPORTED */
+{
+#ifndef XIE_SUPPORTED
+ size_t i;
+ /* Write some bytes from a (char *) buffer */
+ if ((i = JFWRITE(cinfo->output_file, dataptr, datacount))
+ != (size_t) (datacount))
+ ERREXIT(cinfo->emethods, "Output file write error");
+#endif /* XIE_SUPPORTED */
+}
+#endif /* XIE_SUPPORTED */
+
+/*
+ * Finish up after a compressed scan (series of write_jpeg_data calls).
+ */
+
+METHODDEF void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+write_scan_trailer (compress_info_ptr cinfo)
+#else
+write_scan_trailer (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+write_scan_trailer (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ /* no work needed in this format */
+}
+
+
+/*
+ * Finish up at the end of the file.
+ */
+
+#ifdef XIE_SUPPORTED
+METHODDEF int
+#if NeedFunctionPrototypes
+write_file_trailer (compress_info_ptr cinfo)
+#else
+write_file_trailer (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+{
+ if (set_location(cinfo, 1)) {
+ if (emit_marker(cinfo, M_EOI) < 0) {
+ cinfo->bytes_in_buffer = cinfo->XIEbytes_in_buffer;
+ cinfo->XIErestart = XIE_RWRJ;
+ return(XIE_OUT);
+ }
+ }
+ return(0);
+}
+#else
+METHODDEF void
+write_file_trailer (compress_info_ptr cinfo)
+{
+ int i;
+ emit_marker(cinfo, M_EOI);
+ /* Make sure we wrote the output file OK */
+ /* Clean up and verify successful output */
+ fflush(cinfo->output_file);
+ if ((i = ferror(cinfo->output_file)))
+ ERREXIT(cinfo->emethods, "Output file write error");
+}
+#endif /* XIE_SUPPORTED */
+
+
+/*
+ * The method selection routine for standard JPEG header writing.
+ * This should be called from c_ui_method_selection if appropriate.
+ */
+
+GLOBAL void
+#ifdef XIE_SUPPORTED
+#if NeedFunctionPrototypes
+jselwjfif (compress_info_ptr cinfo)
+#else
+jselwjfif (cinfo)
+ compress_info_ptr cinfo;
+#endif /* NeedFunctionPrototypes */
+#else
+jselwjfif (compress_info_ptr cinfo)
+#endif /* XIE_SUPPORTED */
+{
+ cinfo->methods->write_file_header = write_file_header;
+ cinfo->methods->write_scan_header = write_scan_header;
+#ifndef XIE_SUPPORTED
+ cinfo->methods->write_jpeg_data = write_jpeg_data;
+#endif
+ cinfo->methods->write_scan_trailer = write_scan_trailer;
+ cinfo->methods->write_file_trailer = write_file_trailer;
+}
+
+#endif /* JFIF_SUPPORTED */
diff --git a/xc/programs/Xserver/XIE/mixie/process/Imakefile b/xc/programs/Xserver/XIE/mixie/process/Imakefile
new file mode 100644
index 000000000..ed52bbe5d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/Imakefile
@@ -0,0 +1,38 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:56:25 rws $
+XCOMM $XFree86: xc/programs/Xserver/XIE/mixie/process/Imakefile,v 3.5 1998/07/25 08:05:13 dawes Exp $
+XCOMM build device dependent machine independent process element objs
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS1 = bitfun.c mpgeom.c mpgeomaa.c mpgeomnn.c mppoint.c
+OBJS1 = bitfun.o mpgeom.o mpgeomaa.o mpgeomnn.o mppoint.o
+
+#if BuildDIS
+DEFINES = -DXIE_DIS
+#else
+SRCS2 = mparith.c mpbandc.c mpbande.c mpbands.c mpblend.c mpcfromi.c \
+ mpcnst.c mpcomp.c mpconv.c mpctoi.c mpdither.c mphist.c \
+ mplogic.c mppaste.c mprgb.c mpuncnst.c
+OBJS2 = mparith.o mpbandc.o mpbande.o mpbands.o mpblend.o mpcfromi.o \
+ mpcnst.o mpcomp.o mpconv.o mpctoi.o mpdither.o mphist.o \
+ mplogic.o mppaste.o mprgb.o mpuncnst.o
+#endif
+
+ SRCS = $(SRCS1) $(SRCS2)
+
+ OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I../include -I../../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(XINCLUDESRC)/extensions
+ LINTLIBS = ../../dixie/export/llib-lexp.ln ../../dixie/import/llib-limp.ln \
+ ../../dixie/process/llib-lproc.ln ../../dixie/request/llib-lreq.ln \
+ ../control/llib-lctrl.ln ../export/llib-lmexp.ln ../fax/llib-lfax.ln \
+ ../import/llib-lmimp.ln ../jpeg/llib-ljpeg.ln ../process/llib-lmproc.ln
+
+ModuleObjectRule()
+
+SubdirLibraryRule($(OBJS))
+LintLibraryTarget(mproc,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/XIE/mixie/process/bitfun.c b/xc/programs/Xserver/XIE/mixie/process/bitfun.c
new file mode 100644
index 000000000..509f3c015
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/bitfun.c
@@ -0,0 +1,424 @@
+/* $TOG: bitfun.c /main/6 1998/02/09 16:20:58 kaleb $ */
+/**** module bitfun.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ bitfun.c -- DDXIE utilities for bits and other fun things.
+
+ Larry Hare -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/bitfun.c,v 1.3 1998/10/06 10:35:19 dawes Exp $ */
+
+#define _XIEC_MPBITFUN
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+
+#include "xiemd.h"
+
+/*---------------------------------------------------------------------------
+-------------------------------- bitexpand --------------------------------
+---------------------------------------------------------------------------*/
+
+/*
+** Following routine is used to expand a length of bit pixels to byte
+** pixels. Similar routines could be written for other pixels sizes
+** but currently we don't really support them (eg 4 bits) or doesnt
+** really speed them up (16 bits).
+**
+** You could also do this with any other bit expansion tricks you
+** have up your sleeve. For instance, you could look up 8 bits
+** at a time, and have a table of 256 long longs; or use your
+** favorite graphics accelerator, or ... bitfun.
+*/
+
+
+CARD32 xie8StippleMasks[16] = {
+0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
+0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
+0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
+0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff,
+};
+
+/* byte reversal table */
+unsigned char _ByteReverseTable[]= {
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+
+};
+
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+#define g4 (c = (inval>>26) & 0x3c, inval <<= 4, \
+ *((CARD32 *) ((int) &xie8StippleMasks[0] + c)) & val)
+#define g4r (c = (inval>>26) & 0x3c, inval <<= 4, \
+ ~(*((CARD32 *) ((int) &xie8StippleMasks[0] + c))) & val)
+#define g4b (c = (inval>>26) & 0x3c, inval <<= 4, \
+ c = *((CARD32 *) ((int) &xie8StippleMasks[0] + c)), \
+ (loval & ~c) | (hival & c))
+#else
+#define g4 (c = inval & 0xf, inval >>= 4, xie8StippleMasks[c] & val)
+#define g4r (c = inval & 0xf, inval >>= 4, ~xie8StippleMasks[c] & val)
+#define g4b (c = inval & 0xf, inval >>= 4, c = xie8StippleMasks[c], \
+ (loval & ~c) | (hival & c))
+#endif
+
+#define p4 *outp++
+
+pointer bitexpand(inp,outp,bw,olow,ohigh)
+ CARD32 *inp; /* these are actualy bits... */
+ CARD32 *outp; /* its actually bytes but ... */
+ int bw; /* number of bits to extract */
+ unsigned char olow; /* zero bit maps to this */
+ unsigned char ohigh; /* one bit maps to this */
+{
+ pointer dst = (pointer)outp;
+ int nw;
+ CARD32 inval, c;
+ if (olow == 0) {
+ CARD32 val = ohigh;
+ val = (val << 8) | val; val = (val << 16) | val;
+ for ( nw = bw >> 5; nw > 0; nw--) {
+ inval = *inp++;
+ p4 = g4; p4 = g4; p4 = g4; p4 = g4;
+ p4 = g4; p4 = g4; p4 = g4; p4 = g4;
+ }
+ if ((bw &= 31) > 0)
+ for (inval = *inp; bw > 0; bw -= 4)
+ p4 = g4;
+ } else if (ohigh == 0) {
+ CARD32 val = olow;
+ val = (val << 8) | val; val = (val << 16) | val;
+ for ( nw = bw >> 5; nw > 0; nw--) {
+ inval = *inp++;
+ p4 = g4r; p4 = g4r; p4 = g4r; p4 = g4r;
+ p4 = g4r; p4 = g4r; p4 = g4r; p4 = g4r;
+ }
+ if ((bw &= 31) > 0)
+ for (inval = *inp; bw > 0; bw -= 4)
+ p4 = g4r;
+ } else {
+ CARD32 loval = olow, hival = ohigh;
+ loval = (loval << 8) | loval; loval = (loval << 16) | loval;
+ hival = (hival << 8) | hival; hival = (hival << 16) | hival;
+ for ( nw = bw >> 5; nw > 0; nw--) {
+ inval = *inp++;
+ p4 = g4b; p4 = g4b; p4 = g4b; p4 = g4b;
+ p4 = g4b; p4 = g4b; p4 = g4b; p4 = g4b;
+ }
+ if ((bw &= 31) > 0)
+ for (inval = *inp; bw > 0; bw -= 4)
+ p4 = g4b;
+ }
+ /********
+ if (bw > 0)
+ for (M=LOGLEFT, inval = *inp++; bw; bw--, LOGRIGHT(M))
+ *outp++ = (inval & M) ? ohigh : olow ;
+ *********/
+ return(dst);
+}
+
+/* byte to bit converter
+ * everything less than "threshold" becomes a zero
+ */
+void
+bitshrink(src,dst,width,threshold)
+ unsigned char *src, *dst, threshold;
+ int width;
+{
+ BytePixel *i = src;
+ LogInt *o = (LogInt*)dst, M, v;
+ int bw;
+
+ for(bw = width; bw >= LOGSIZE; *o++ = v, bw -= LOGSIZE)
+ for(v = 0, M = LOGLEFT; M; LOGRIGHT(M)) if(*i++ >= threshold) v |= M;
+ if(bw > 0) {
+ for(v = 0, M = LOGLEFT; bw--; LOGRIGHT(M)) if(*i++ >= threshold) v |= M;
+ *o++ = v;
+ }
+}
+
+/*------------------------------------------------------------------------
+------------------ Bit manipulation in ROI section -----------------------
+------------------------------------------------------------------------*/
+
+/*
+** The following routines are used to turn a set of bits in a ROI extent
+** of a scanline to 0's, to 1's, or to invert them. 'ix' is the starting
+** bit number, and 'run' is the number of bits. The routines can be
+** applied to eg BytePixel arrays by scaling the coordinates appropriately.
+*/
+
+void
+action_clear(d, run, ix) /* turn off bits in region */
+ LogInt *d;
+ int run, ix;
+{
+ int sbit = ix & LOGMASK;
+
+ ix >>= LOGSHIFT; d += ix;
+ if ((sbit + run) >= LOGSIZE) {
+ if (sbit) {
+ *d &= ~(BitRight(LOGONES,sbit));
+ run -= (LOGSIZE - sbit); d++;
+ }
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--) {
+ *d++ = 0;
+ }
+ if (run &= LOGMASK) {
+ *d &= BitRight(LOGONES,run);
+ }
+ } else {
+ *d &= ~(BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)));
+ }
+}
+
+void
+action_set(d, run, ix) /* turn on bits in region */
+ LogInt *d;
+ int run, ix;
+{
+ int sbit = ix & LOGMASK;
+
+ ix >>= LOGSHIFT; d += ix;
+ if ((sbit + run) >= LOGSIZE) {
+ if (sbit) {
+ *d |= BitRight(LOGONES,sbit);
+ run -= (LOGSIZE - sbit); d++;
+ }
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--) {
+ *d++ = LOGONES;
+ }
+ if (run &= LOGMASK) {
+ *d |= ~BitRight(LOGONES,run);
+ }
+ } else {
+ *d |= (BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)));
+ }
+}
+
+void
+action_invert(d, run, ix) /* invert bits in region */
+ LogInt *d;
+ int run, ix;
+{
+ int sbit = ix & LOGMASK;
+
+ ix >>= LOGSHIFT; d += ix;
+ if ((sbit + run) >= LOGSIZE) {
+ if (sbit) {
+ *d ^= BitRight(LOGONES,sbit);
+ run -= (LOGSIZE - sbit); d++;
+ }
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--) {
+ *d++ ^= LOGONES;
+ }
+ if (run &= LOGMASK) {
+ *d ^= ~BitRight(LOGONES,run);
+ }
+ } else {
+ *d ^= (BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)));
+ }
+}
+
+/*------------------------------------------------------------------------
+------------------------ Pixel Copy in ROI section -----------------------
+------------------------------------------------------------------------*/
+/*
+** NOTE: Nominally used to copy src1 to destination in the passive
+** regions of a ROI. To implement this efficiently we have a variety
+** of issues and choices:
+** a) Simply call memcpy for the correct number of bytes.
+** b) Simply call passcopy_bit below for the correct # of bits.
+** d) For small number, do a while loop, else call memcpy or passocpy_bit.
+** NOTE: do not call if s == d, or if s overlaps d.
+*/
+
+/* (*(pvt->passive)) (dvoid, svoid, -run, ix); */
+
+void passcopy_byte(d,s,dx,x)
+ BytePixel *d, *s;
+ CARD32 dx, x;
+{
+ d += x;
+ s += x;
+ if (dx < 15) while (dx-- > 0) *d++ = *s++;
+ else memcpy (d, s, dx);
+}
+
+void passcopy_pair(d,s,dx,x)
+ PairPixel *d, *s;
+ CARD32 dx, x;
+{
+ d += x;
+ s += x;
+ if (dx < 12) while (dx-- > 0) *d++ = *s++;
+ else memcpy (d, s, dx << 1);
+}
+
+void passcopy_quad(d,s,dx,x)
+ QuadPixel *d, *s;
+ CARD32 dx, x;
+{
+ d += x;
+ s += x;
+ if (dx < 8) while (dx-- > 0) *d++ = *s++;
+ else memcpy (d, s, dx << 2);
+}
+
+void passcopy_real(d,s,dx,x)
+ RealPixel *d, *s;
+ CARD32 dx, x;
+{
+ d += x;
+ s += x;
+ if (dx < 8) while (dx-- > 0) *d++ = *s++;
+ else memcpy (d, s, dx << 2);
+}
+
+void
+passcopy_bit(d,s,dx,x)
+ LogInt *d, *s;
+ CARD32 dx, x;
+{
+ CARD32 sbit = x & LOGMASK;
+ LogInt M;
+
+ x >>= LOGSHIFT; s += x; d += x;
+
+ if ((sbit + dx) >= LOGSIZE) {
+ if (sbit) {
+ M = BitRight(LOGONES,sbit);
+ *d = (*d & ~M) | (*s & M);
+ dx -= (LOGSIZE - sbit); d++; s++;
+ }
+ for (sbit = dx >> LOGSHIFT; sbit > 0; sbit--) {
+ *d++ = *s++;
+ }
+ if (dx &= LOGMASK) {
+ M = ~BitRight(LOGONES,dx);
+ *d = (*d & ~M) | (*s & M);
+ }
+ } else {
+ M = (BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+dx)));
+ *d = (*d & ~M) | (*s & M);
+ }
+}
+
+void (*passive_copy[5])() = {
+ passcopy_real, passcopy_bit, passcopy_byte, passcopy_pair, passcopy_quad
+};
+
+/**** module bitfun.c ****/
diff --git a/xc/programs/Xserver/XIE/mixie/process/mparith.c b/xc/programs/Xserver/XIE/mixie/process/mparith.c
new file mode 100644
index 000000000..1e3aeafec
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mparith.c
@@ -0,0 +1,1181 @@
+/* $TOG: mparith.c /main/7 1998/02/09 16:21:07 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mparith.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mparith.c -- DDXIE arithmetic and math element
+
+ Larry Hare -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mparith.c,v 3.3 1998/10/05 13:22:40 dawes Exp $ */
+
+
+#define _XIEC_MPARITH
+#define _XIEC_PARITH
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+ /*
+ ** Most machines will work fine using the double precision versions
+ ** of the math functions. If they give you problems, or if you
+ ** want a bit more speed, then pick one of the following sets of
+ ** defines. Enjoy. While you are thinking about this you might
+ ** want to consider changing the cube root function in mprgb.c
+ ** with fpow(x,1./3.) or powf(x,1./3.). Another similar area is
+ ** in mpgeomaa.c for the gaussian technique.
+ */
+
+#if defined(USE_EXPF)
+ /*
+ ** The very newest ANSI-C libraries promote this style of floating
+ ** functions. Even if you have these available, you may need to
+ ** use special compiler options, and prototypes from math.h
+ */
+# define exp expf
+# define log logf
+# define pow powf
+# define sqrt sqrtf
+#endif
+
+#if defined(USE_FEXP)
+ /*
+ ** This is the more antique way to get floating math functions. But
+ ** you may have to use compiler options or otherwise stand on your
+ ** head to do this safely. Otherwise the argument may get promoted.
+ */
+# define exp fexp
+# define log flog
+# define pow fpow
+# define sqrt fsqrt
+#endif
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeArith();
+int miAnalyzeMath();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateArith();
+static int InitializeArith();
+static int ResetArith();
+static int DestroyArith();
+
+static int ActivateArithMROI();
+static int ActivateArithDROI();
+static int SetupArith();
+static void ClearArith(); /* and Math */
+
+static int CreateMath();
+static int InitializeMath();
+static int SetupMath();
+
+/*
+ * DDXIE Arithmetic and Math entry points
+ */
+static ddElemVecRec ArithVec = {
+ CreateArith,
+ InitializeArith,
+ (xieIntProc) NULL,
+ (xieIntProc) NULL,
+ ResetArith,
+ DestroyArith
+ };
+
+static ddElemVecRec MathVec = {
+ CreateMath,
+ InitializeMath,
+ ActivateArithMROI, /* yes, arith */
+ (xieIntProc) NULL,
+ ResetArith, /* yes, arith */
+ DestroyArith /* yes, arith */
+ };
+
+/*
+* Local Declarations.
+*/
+
+typedef struct _mparithdef {
+ void (*action) (); /* to do arithmetic */
+ void (*passive) (); /* to copy src1 in passive areas */
+ CARD32 *lutptr; /* in case we do a lookup */
+ CARD32 nlev; /* integer clipping */
+ CARD32 nclip; /* integer clipping */
+ CARD32 iconstant;
+ RealPixel fconstant;
+} mpArithPvtRec, *mpArithPvtPtr; /* also used for Math */
+
+/*
+** NOTE: What happens if element is run over and over with same
+** parameters. If we are using a LUT, should we try to keep it?
+** If KEEP_LUTS is enabled, then we build any required luts in
+** the Create routine and free them in Destroy. Otherwise we do
+** so in Initialize and Reset. This is more important on
+** operations like divide on non-fpu machines.
+*/
+
+#define KEEP_LUTS
+
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = ArithVec;
+ return TRUE;
+}
+
+int miAnalyzeMath(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = MathVec;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* always force syncing between inputs (is nop if only one input) */
+ if (!MakePETex(flo,ped,
+ xieValMaxBands * sizeof(mpArithPvtRec),
+ SYNC, /* InSync: */
+ NO_SYNC /* bandSync: */))
+ return FALSE;
+
+#if defined(KEEP_LUTS)
+ if (!SetupArith(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ return TRUE;
+
+}
+
+static int CreateMath(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* always force syncing between inputs (is nop if only one input) */
+ if (!MakePETex(flo,ped,
+ xieValMaxBands * sizeof(mpArithPvtRec),
+ SYNC, /* InSync: */
+ NO_SYNC /* bandSync: */))
+ return FALSE;
+
+#if defined(KEEP_LUTS)
+ if (!SetupMath(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ return TRUE;
+
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int InitializeArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloArithmetic *raw = (xieFloArithmetic *) ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ CARD8 msk = raw->bandMask;
+
+#if !defined(KEEP_LUTS)
+ if (!SetupArith(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ ped->ddVec.activate = raw->src2 ? ActivateArithDROI : ActivateArithMROI;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ rcp[ped->inCnt-1].band[0].replicate = msk;
+
+ InitReceptor(flo, ped, &rcp[SRCt1], NO_DATAMAP, 1, msk, ~msk);
+
+ if (raw->src2)
+ InitReceptor(flo, ped, &rcp[SRCt2], NO_DATAMAP, 1, msk, NO_BANDS);
+
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY);
+ InitEmitter(flo, ped, NO_DATAMAP, SRCt1);
+
+ return !ferrCode(flo);
+}
+
+static int InitializeMath(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloMath *raw = (xieFloMath *) ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ CARD8 msk = raw->bandMask;
+
+#if !defined(KEEP_LUTS)
+ if (!SetupMath(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+ if (raw->domainPhototag)
+ rcp[ped->inCnt-1].band[0].replicate = msk;
+ InitReceptor(flo, ped, &rcp[SRCt1], NO_DATAMAP, 1, msk, ~msk);
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY);
+ InitEmitter(flo, ped, NO_DATAMAP, SRCt1);
+
+ return !ferrCode(flo);
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+static int ActivateArithMROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpArithPvtPtr pvt = (mpArithPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, dband++) {
+ pointer svoid, dvoid;
+
+ if (!(pet->scheduled & 1<<band)) continue;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ while (!ferrCode(flo) && svoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ (*(pvt->action)) (dvoid, svoid, run, ix, pvt);
+ ix += run;
+ } else {
+ if (dvoid != svoid)
+ (*(pvt->passive)) (dvoid, svoid, -run, ix);
+ ix -= run;
+ }
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ FreeData(flo, pet, sband, sband->current);
+ }
+ return TRUE;
+}
+
+static int ActivateArithDROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpArithPvtPtr pvt = (mpArithPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, tband++, dband++) {
+ pointer svoid, tvoid, dvoid;
+ CARD32 w;
+
+ if (!(pet->scheduled & 1<<band)) continue;
+
+ w = sband->format->width;
+ if (w > tband->format->width) w = tband->format->width;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(tvoid = GetCurrentSrc(flo,pet,tband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ while (!ferrCode(flo) && svoid && tvoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ /* needs to clip to second source, yuck */
+ if ((ix + run) > w) {
+ if (ix < w)
+ (*(pvt->action)) (dvoid,svoid,tvoid, w-ix, ix, pvt);
+ if (dvoid != svoid) {
+ run = sband->format->width - w;
+ if (run > 0)
+ (*(pvt->passive)) (dvoid, svoid, run, w);
+ }
+ break;
+ }
+ (*(pvt->action)) (dvoid, svoid, tvoid, run, ix, pvt);
+ ix += run;
+ } else {
+ if (dvoid != svoid)
+ (*(pvt->passive)) (dvoid, svoid, -run, ix);
+ ix -= run;
+ }
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ tvoid = GetNextSrc(flo,pet,tband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ if(!svoid && sband->final) {
+ DisableSrc(flo,pet,tband,FLUSH);
+ } else if(!tvoid && tband->final) {
+ BypassSrc(flo,pet,sband);
+ } else {
+ /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sband,sband->current);
+ FreeData(flo,pet,tband,tband->current);
+ }
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+#if !defined(KEEP_LUTS)
+ ClearArith(flo,ped);
+#endif
+
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+#if defined(KEEP_LUTS)
+ ClearArith(flo,ped);
+#endif
+
+ /* get rid of the peTex structure and private structures */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+/* xieTypArithmeticOp
+**
+** #define xieValAdd 1
+** #define xieValSub 2
+** #define xieValSubRev 3
+** #define xieValMul 4
+** #define xieValDiv 5
+** #define xieValDivRev 6
+** #define xieValMin 7
+** #define xieValMax 8
+** #define xieValGamma 9
+**
+** xieTypMathOp
+**
+** #define xieValExp 1
+** #define xieValLn 2
+** #define xieValLog2 3
+** #define xieValLog10 4
+** #define xieValSquare 5
+** #define xieValSqrt 6
+*/
+
+#define NADA 0
+
+#define AADD D = S1 + S2; if (D >= nlev) D = nlev - 1;
+#define ASUB D = (S1 > S2) ? S1 - S2 : 0;
+#define ASUBREV D = (S2 > S1) ? S2 - S1 : 0;
+#define AMIN D = S1 < S2 ? S1 : S2;
+#define AMAX D = S1 > S2 ? S1 : S2;
+
+
+#define FADD D = S1 + S2;
+#define FSUB D = S1 - S2;
+#define FSUBREV D = S2 - S1;
+#define FMUL D = S1 * S2;
+#define FDIV D = S1 / S2;
+#define FDIVREV D = S1 ? S2 / S1 : S2;
+#define FMIN D = S1 < S2 ? S1 : S2;
+#define FMAX D = S1 > S2 ? S1 : S2;
+ /* beware float vs double */
+ /* consider using fpow() if available */
+#define FGAM D = pow(S1,S2);
+#define IFGAM D = (nlev - 1) * pow(S1/(nlev-1),S2);
+
+#define BADD D = S1 | S2;
+#define BSUB D = S1 & ~S2;
+#define BSUBREV D = S2 & ~S1;
+#define BMUL D = S1 & S2;
+#define BDIV D = S1;
+#define BDIVREV D = S2;
+#define BMIN D = S1 & S2; /* same as BMUL */
+#define BMAX D = S1 | S2; /* same as BADD */
+#define BGAM D = S1;
+
+
+/*------------------------------------------------------------------------
+--------------------- ROI operations work on subranges ------------------
+------------------------------------------------------------------------*/
+
+/* MROI: (*(pvt->action)) (dvoid, src1, run, ix, pvt); */
+/* DROI: (*(pvt->action)) (dvoid, src1, src2, run, ix, pvt); */
+
+#define MakeLutI(name1, expr) \
+static void name1(pvt) \
+ mpArithPvtPtr pvt; \
+{ \
+ CARD32 *lut = pvt->lutptr; \
+ CARD32 nlev = pvt->nlev; \
+ CARD32 nclip = pvt->nclip; \
+ CARD32 i; \
+ CARD32 D, S1, S2 = pvt->iconstant; \
+ for ( i = 0; i < nlev ; i++) { \
+ S1 = i; \
+ expr; \
+ lut[i] = D; \
+ } \
+ for ( ; i < nclip ; i++) { \
+ lut[i] = 0; \
+ } \
+}
+
+#define MakeLutF2(name1, expr) \
+static void name1(pvt) \
+ mpArithPvtPtr pvt; \
+{ \
+ CARD32 *lut = pvt->lutptr; \
+ CARD32 nlev = pvt->nlev; \
+ CARD32 nclip = pvt->nclip; \
+ RealPixel Half = (RealPixel) .5; \
+ RealPixel dlev = (RealPixel) nlev - Half; \
+ RealPixel D, S1, S2 = pvt->fconstant; \
+ CARD32 i; \
+ for ( i = 0; i < nlev ; i++) { \
+ S1 = i; \
+ expr; \
+ D += .5; \
+ if (D < 0.) D = 0; \
+ else if (D > dlev) D = dlev; \
+ lut[i] = D; \
+ } \
+ for ( ; i < nclip ; i++) { \
+ lut[i] = 0; \
+ } \
+}
+
+#define MakeLutF1(name1, expr) \
+static void name1(pvt) \
+ mpArithPvtPtr pvt; \
+{ \
+ CARD32 *lut = pvt->lutptr; \
+ CARD32 nlev = pvt->nlev; \
+ CARD32 nclip = pvt->nclip; \
+ RealPixel Half = (RealPixel) .5; \
+ RealPixel dlev = (RealPixel) nlev - Half; \
+ RealPixel D, S1; \
+ CARD32 i; \
+ for ( i = 0; i < nlev ; i++) { \
+ S1 = i; \
+ expr; \
+ D += .5; \
+ if (D < 0.) D = 0; \
+ else if (D > dlev) D = dlev; \
+ lut[i] = D; \
+ } \
+ for ( ; i < nclip ; i++) { \
+ lut[i] = 0; \
+ } \
+}
+
+#define MakeLook(name1, itype) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ itype *dst = ((itype *) dst1) + x; \
+ itype *src = ((itype *) src1) + x; \
+ CARD32 *lut = pvt->lutptr; \
+ CARD32 nmask = pvt->nclip - 1; \
+ for ( ; nx > 0 ; nx--) { \
+ *dst++ = lut[*src++ & nmask]; \
+ } \
+}
+
+MakeLutI(pr_a, AADD )
+MakeLutI(pr_s, ASUB )
+MakeLutI(pr_sr, ASUBREV )
+MakeLutI(pr_mn, AMIN )
+MakeLutI(pr_mx, AMAX )
+
+MakeLutF2(pr_m, FMUL )
+MakeLutF2(pr_d, FDIV )
+MakeLutF2(pr_dr, FDIVREV )
+MakeLutF2(pr_gm, IFGAM )
+
+static void (*prep_mono[xieValGamma])() = {
+pr_a, pr_s, pr_sr, pr_m, pr_d, pr_dr, pr_mn, pr_mx, pr_gm
+};
+
+MakeLook(lr_B, BytePixel)
+MakeLook(lr_P, PairPixel)
+MakeLook(lr_Q, QuadPixel)
+
+static void (*action_lut[5])() = {
+ NADA,
+ NADA,
+ lr_B,
+ lr_P,
+ lr_Q
+};
+
+
+
+/*
+** NOTE:
+** The MakePixI and MakePixF? macros may be used to synthesize monadic
+** action routines which can be used in place of look up table based
+** routines. They were actually tested at one point in time. The
+** invocations still remain below, and the routines can be plugged
+** into the action_monoROI[itype][operator] table below. As noted
+** elsewhere, these routines might be more appropriate for bigger
+** pixels to avoid lookup table explosion; or for machines without
+** a data cache, or a very small data cache. IN summary, which
+** of these routines should be used depends on:
+** a) existence of data cache?
+** b) size, organization, and fill method of data cache?
+** c) speed of floating operations
+*/
+
+#define MakePixI(name1, itype, expr) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ itype *dst = (itype *) dst1; \
+ itype *src = (itype *) src1; \
+ CARD32 nlev = pvt->nlev; \
+ CARD32 D, S1, S2 = (itype) pvt->iconstant; \
+ for ( ; nx > 0 ; nx--, x++) { \
+ S1 = src[x]; \
+ expr \
+ dst[x] = D; \
+ } \
+}
+
+#define MakePixF2(name1, itype, expr) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ itype *dst = (itype *) dst1; \
+ itype *src = (itype *) src1; \
+ RealPixel Half = (RealPixel) .5; \
+ RealPixel dlev = (RealPixel) pvt->nlev - Half; \
+ RealPixel D, S1, S2 = (itype) pvt->fconstant; \
+ for ( ; nx > 0 ; nx--, x++) { \
+ S1 = (RealPixel) src[x]; \
+ expr \
+ D += Half; \
+ if (D < 0.) D = 0; \
+ else if (D > dlev) D = dlev; \
+ dst[x] = (itype) D; \
+ } \
+}
+
+#define MakePixF1(name1, itype, expr) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ itype *dst = (itype *) dst1; \
+ itype *src = (itype *) src1; \
+ RealPixel Half = (RealPixel) .5; \
+ RealPixel dlev = (RealPixel) pvt->nlev - Half; \
+ RealPixel D, S1; \
+ for ( ; nx > 0 ; nx--, x++) { \
+ S1 = (RealPixel) src[x]; \
+ expr \
+ D += Half; \
+ if (D < 0.) D = 0; \
+ else if (D > dlev) D = dlev; \
+ dst[x] = (itype) D; \
+ } \
+}
+
+#define DakePix(name2, itype, expr) \
+static void name2(dst1,src1,src2,nx,x,pvt) \
+ pointer dst1, src1, src2; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ itype *dst = ((itype *) dst1) + x; \
+ itype *src = ((itype *) src1) + x; \
+ itype *trc = ((itype *) src2) + x; \
+ CARD32 nlev = pvt->nlev; \
+ CARD32 D, S1, S2; \
+ for ( ; nx > 0 ; nx--) { \
+ S1 = *src++; \
+ S2 = *trc++; \
+ expr \
+ *dst++ = D; \
+ } \
+}
+
+#define MakeFlt2(name1, expr) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ RealPixel *dst = ((RealPixel *) dst1) + x; \
+ RealPixel *src = ((RealPixel *) src1) + x; \
+ RealPixel D, S1, S2 = pvt->fconstant; \
+ for ( ; nx > 0 ; nx--) { \
+ S1 = *src++; \
+ expr \
+ *dst++ = D; \
+ } \
+}
+
+#define MakeFlt1(name1, expr) \
+static void name1(dst1,src1,nx,x,pvt) \
+ pointer dst1, src1; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ RealPixel *dst = ((RealPixel *) dst1) + x; \
+ RealPixel *src = ((RealPixel *) src1) + x; \
+ RealPixel D, S1; \
+ for ( ; nx > 0 ; nx--) { \
+ S1 = *src++; \
+ expr \
+ *dst++ = D; \
+ } \
+}
+
+#define DakeFlt(name2, expr) \
+static void name2(dst1,src1,src2,nx,x,pvt) \
+ pointer dst1, src1, src2; \
+ CARD32 nx, x; \
+ mpArithPvtPtr pvt; \
+{ \
+ RealPixel *dst = ((RealPixel *) dst1) + x; \
+ RealPixel *src = ((RealPixel *) src1) + x; \
+ RealPixel *trc = ((RealPixel *) src2) + x; \
+ RealPixel D, S1, S2; \
+ for ( ; nx > 0 ; nx--) { \
+ S1 = *src++; \
+ S2 = *trc++; \
+ expr \
+ *dst++ = D; \
+ } \
+}
+
+/* Bits no longer required by protocol */
+#define mr_b_a NADA
+#define mr_b_s NADA
+#define mr_b_sr NADA
+#define mr_b_m NADA
+#define mr_b_d NADA
+#define mr_b_dr NADA
+#define mr_b_mn NADA
+#define mr_b_mx NADA
+#define mr_b_gm NADA
+
+#define dr_b_a NADA
+#define dr_b_s NADA
+#define dr_b_sr NADA
+#define dr_b_mn NADA
+#define dr_b_mx NADA
+
+/* MakePixI (mr_B_a, BytePixel, AADD ) */
+/* MakePixI (mr_B_s, BytePixel, ASUB ) */
+/* MakePixI (mr_B_sr, BytePixel, ASUBREV ) */
+/* MakePixI (mr_B_mn, BytePixel, AMIN ) */
+/* MakePixI (mr_B_mx, BytePixel, AMAX ) */
+
+/* MakePixF2 (mr_B_m, BytePixel, FMUL ) */
+/* MakePixF2 (mr_B_d, BytePixel, FDIV ) */
+/* MakePixF2 (mr_B_dr, BytePixel, FDIVREV ) */
+/* MakePixF2 (mr_B_gm, BytePixel, IFGAM ) */
+
+ DakePix (dr_B_a, BytePixel, AADD )
+ DakePix (dr_B_s, BytePixel, ASUB )
+ DakePix (dr_B_sr, BytePixel, ASUBREV )
+ DakePix (dr_B_mn, BytePixel, AMIN )
+ DakePix (dr_B_mx, BytePixel, AMAX )
+
+/* MakePixI (mr_P_a, PairPixel, AADD ) */
+/* MakePixI (mr_P_s, PairPixel, ASUB ) */
+/* MakePixI (mr_P_sr, PairPixel, ASUBREV ) */
+/* MakePixI (mr_P_mn, PairPixel, AMIN ) */
+/* MakePixI (mr_P_mx, PairPixel, AMAX ) */
+
+/* MakePixF2 (mr_P_m, PairPixel, FMUL ) */
+/* MakePixF2 (mr_P_d, PairPixel, FDIV ) */
+/* MakePixF2 (mr_P_dr, PairPixel, FDIVREV ) */
+/* MakePixF2 (mr_P_gm, PairPixel, IFGAM ) */
+
+ DakePix (dr_P_a, PairPixel, AADD )
+ DakePix (dr_P_s, PairPixel, ASUB )
+ DakePix (dr_P_sr, PairPixel, ASUBREV )
+ DakePix (dr_P_mn, PairPixel, AMIN )
+ DakePix (dr_P_mx, PairPixel, AMAX )
+
+/* MakePixI (mr_Q_a, QuadPixel, AADD ) */
+/* MakePixI (mr_Q_s, QuadPixel, ASUB ) */
+/* MakePixI (mr_Q_sr, QuadPixel, ASUBREV ) */
+/* MakePixI (mr_Q_mn, QuadPixel, AMIN ) */
+/* MakePixI (mr_Q_mx, QuadPixel, AMAX ) */
+
+/* MakePixF2 (mr_Q_m, QuadPixel, FMUL ) */
+/* MakePixF2 (mr_Q_d, QuadPixel, FDIV ) */
+/* MakePixF2 (mr_Q_dr, QuadPixel, FDIVREV ) */
+/* MakePixF2 (mr_Q_gm, QuadPixel, IFGAM ) */
+
+ DakePix (dr_Q_a, QuadPixel, AADD )
+ DakePix (dr_Q_s, QuadPixel, ASUB )
+ DakePix (dr_Q_sr, QuadPixel, ASUBREV )
+ DakePix (dr_Q_mn, QuadPixel, AMIN )
+ DakePix (dr_Q_mx, QuadPixel, AMAX )
+
+MakeFlt2 (mr_R_a, FADD )
+MakeFlt2 (mr_R_s, FSUB )
+MakeFlt2 (mr_R_sr, FSUBREV )
+MakeFlt2 (mr_R_m, FMUL )
+MakeFlt2 (mr_R_d, FDIV )
+MakeFlt2 (mr_R_dr, FDIVREV )
+MakeFlt2 (mr_R_mn, FMIN )
+MakeFlt2 (mr_R_mx, FMAX )
+MakeFlt2 (mr_R_gm, FGAM )
+
+DakeFlt (dr_R_a, FADD )
+DakeFlt (dr_R_s, FSUB )
+DakeFlt (dr_R_sr, FSUBREV )
+DakeFlt (dr_R_mn, FMIN )
+DakeFlt (dr_R_mx, FMAX )
+
+/*
+ADD, SUB, SUBREV, MUL, DIV, DIVREV, MIN, MAX, GAMMA
+*/
+
+static void (*action_monoROI[5][xieValGamma])() = {
+mr_R_a, mr_R_s, mr_R_sr, mr_R_m, mr_R_d, mr_R_dr, mr_R_mn, mr_R_mx, mr_R_gm,
+mr_b_a, mr_b_s, mr_b_sr, mr_b_m, mr_b_d, mr_b_dr, mr_b_mn, mr_b_mx, mr_b_gm,
+NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA,
+NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA,
+NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA, NADA
+};
+
+static void (*action_dyadROI[5][xieValGamma])() = {
+dr_R_a, dr_R_s, dr_R_sr, NADA, NADA, NADA, dr_R_mn, dr_R_mx, NADA,
+dr_b_a, dr_b_s, dr_b_sr, NADA, NADA, NADA, dr_b_mn, dr_b_mx, NADA,
+dr_B_a, dr_B_s, dr_B_sr, NADA, NADA, NADA, dr_B_mn, dr_B_mx, NADA,
+dr_P_a, dr_P_s, dr_P_sr, NADA, NADA, NADA, dr_P_mn, dr_P_mx, NADA,
+dr_Q_a, dr_Q_s, dr_Q_sr, NADA, NADA, NADA, dr_Q_mn, dr_Q_mx, NADA
+};
+
+
+extern void (*passive_copy[5])();
+
+/*------------------------------------------------------------------------
+-------------------------- . . . Math Sandbox . . . ----------------------
+------------------------------------------------------------------------*/
+
+/*
+** Math NOTES:
+** #define xieValExp 1
+** #define xieValLn 2
+** #define xieValLog2 3
+** #define xieValLog10 4
+** #define xieValSquare 5
+** #define xieValSqrt 6
+**
+** log(==0) is -infinity with divide by zero exception. sigh.
+** log( <0) is quiet NaN with invalid operation exception, sigh.
+** sqrt(<0) might be error, 0., or -sqrt(-x) ???
+**
+** for log2(), it may be quicker to count bits for integer arguments :-)
+**
+** also, not all machines have a log2 and log10 in their math library
+** so we multiply log() by the magic values M_LOG2E and M_LOG10E.
+**
+** one can argue that taking logs and exponents and such of small
+** integers is a somewhat frenetic exercise. while it might make
+** sense to use square or squareroot as an image contrast enhancer,
+** it doesn't make sense when applied to small integers either.
+**
+** just for the heck of it, here are some values for small inputs:
+** i log2 logN log10 exp sqrt square
+** 0 -Inf -Inf -Inf 1 0 0
+** 1 0 0 0 2.718 1 1
+** 2 1 0.6931 0.301 7.389 1.414 4
+** 3 1.585 1.099 0.4771 20.09 1.732 9
+** 4 2 1.386 0.6021 54.6 2 16
+** 5 2.322 1.609 0.699 148.4 2.236 25
+**
+** also note that LN_MAXFLOAT (or LN_MAXDOUBLE) and MAXFLOAT are
+** typically defined in values.h, but including it conflicts with
+** misc.h on many machines. values.h isn't a very modern .h file
+** as standards go these days. help.....
+*/
+
+#ifndef M_LOG2E
+#define M_LOG2E 1.4426950408889634074
+#endif
+
+#ifndef M_LOG10E
+#define M_LOG10E 0.43429448190325182765
+#endif
+
+#ifndef LN_MAXFLOAT
+#define LN_MAXFLOAT 88.7228394
+#endif
+
+#ifndef MAXFLOAT
+#define MAXFLOAT ((float)3.40282346638528860e+38)
+#endif
+
+#define BANY D = S1;
+#define FEXP D = (S1 <= (LN_MAXFLOAT-2.) ? exp(S1) : MAXFLOAT);
+#define FLGN D = (S1 > 0. ? log(S1) : 0. );
+#define FLG2 D = (S1 > 0. ? log(S1) * M_LOG2E : 0. );
+#define FLG10 D = (S1 > 0. ? log(S1) * M_LOG10E : 0. );
+#define FSQR D = S1 * S1;
+#define FSQRT D = (S1 >= 0. ? sqrt(S1) : 0. );
+
+MakeLutF1(mpr_exp, FEXP )
+MakeLutF1(mpr_lgN, FLGN )
+MakeLutF1(mpr_lg2, FLG2 )
+MakeLutF1(mpr_lg10, FLG10)
+MakeLutF1(mpr_sqr, FSQR )
+MakeLutF1(mpr_sqrt, FSQRT)
+
+
+/* Bits no longer required by protocol */
+#define m_b_exp NADA
+#define m_b_lgN NADA
+#define m_b_lg2 NADA
+#define m_b_lg10 NADA
+#define m_b_sqr NADA
+#define m_b_sqrt NADA
+
+MakePixF1 (m_P_sqr, PairPixel, FSQR) /* ??? or use LUT */
+MakePixF1 (m_Q_sqr, QuadPixel, FSQR)
+
+MakeFlt1 (m_R_exp, FEXP )
+MakeFlt1 (m_R_lgN, FLGN )
+MakeFlt1 (m_R_lg2, FLG2 )
+MakeFlt1 (m_R_lg10, FLG10 )
+MakeFlt1 (m_R_sqr, FSQR )
+MakeFlt1 (m_R_sqrt, FSQRT )
+
+static void (*action_mathROI[5][xieValSqrt])() = {
+/* EXP, LOG, LOG2, LOG10, SQUARE, SQRT */
+m_R_exp, m_R_lgN, m_R_lg2, m_R_lg10, m_R_sqr, m_R_sqrt, /* floats */
+m_b_exp, m_b_lgN, m_b_lg2, m_b_lg10, m_b_sqr, m_b_sqrt, /* bits */
+NADA, NADA, NADA, NADA, NADA, NADA, /* bytes */
+NADA, NADA, NADA, NADA, m_P_sqr, NADA, /* pairs */
+NADA, NADA, NADA, NADA, m_Q_sqr, NADA /* quads */
+/* EXP, LOG, LOG2, LOG10, SQUARE, SQRT */
+};
+
+static void (*prep_math[xieValSqrt])() = {
+mpr_exp, mpr_lgN, mpr_lg2, mpr_lg10, mpr_sqr, mpr_sqrt
+};
+
+/*------------------------------------------------------------------------
+-------------------------- initialize element . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int SetupArith(flo,ped,modify)
+ floDefPtr flo;
+ peDefPtr ped;
+ int modify;
+{
+ xieFloArithmetic *raw = (xieFloArithmetic *) ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ pArithDefPtr epvt = (pArithDefPtr) ped->elemPvt;
+ mpArithPvtPtr pvt = (mpArithPvtPtr) pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 nbands = rcp[SRCt1].inFlo->bands;
+ bandPtr sband = &(rcp[SRCt1].band[0]);
+ bandPtr tband = &(rcp[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD32 band;
+
+ for (band=0; band<nbands; band++, pvt++, sband++, tband++, dband++) {
+ CARD32 iclass = IndexClass(sband->format->class);
+ void (*act)() = 0;
+
+ if ((raw->bandMask & (1<<band)) == 0)
+ continue;
+
+ if (!raw->src2) /* only used for mul, div, divrev, gamma */
+ pvt->fconstant = (RealPixel) epvt->constant[band];
+
+ switch(raw->operator) {
+ case xieValDiv: if (pvt->fconstant == 0.0) /* epsilon ?? */
+ pvt->fconstant = 1.0;
+ break;
+ }
+
+ if (IsConstrained(sband->format->class)) {
+ pvt->nlev = sband->format->levels;
+ if (!raw->src2) {
+ CARD32 deep;
+ SetDepthFromLevels(pvt->nlev,deep); pvt->nclip = 1 << deep;
+ /* only used for add, sub, subrev, min, max */
+ pvt->iconstant = ConstrainConst(epvt->constant[band],pvt->nlev);
+ }
+ }
+
+ /* Try to find a dyadic operator */
+ if (!act && raw->src2)
+ act = action_dyadROI[iclass][raw->operator-1];
+
+ /*
+ ** NOTE:
+ ** For larger pixels a look up table begins to be less
+ ** attractive since the malloc is larger, it takes longer
+ ** to compute, and the cache hit rate may go down. So
+ ** we may want to add more actual monodaic arithmetic
+ ** elements to the table (see MakePixel, it worked once
+ ** upon a time) and choose between an arithmetic and lookup
+ ** version based on number of levels.
+ */
+
+ /* Try to find a monadic operator */
+ if (!act && !raw->src2)
+ act = action_monoROI[iclass][raw->operator-1];
+
+ /* Or maybe a monadic look up table operator */
+ if (!act && !raw->src2) {
+ act = action_lut[iclass];
+ if (act) {
+ /* Allocate Lut and Fill it in */
+ if (!(pvt->lutptr = (CARD32 *)
+ XieMalloc(pvt->nclip * sizeof(CARD32))))
+ AllocError(flo,ped,return(FALSE));
+ (*prep_mono[raw->operator-1]) (pvt);
+ }
+ }
+
+ if (!act)
+ ImplementationError(flo,ped,return(FALSE));
+ pvt->action = act;
+ pvt->passive = passive_copy[iclass];
+ }
+ return TRUE;
+}
+
+static int SetupMath(flo,ped,modify)
+ floDefPtr flo;
+ peDefPtr ped;
+ int modify;
+{
+ xieFloMath *raw = (xieFloMath *) ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ mpArithPvtPtr pvt = (mpArithPvtPtr) pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 nbands = rcp[SRCt1].inFlo->bands;
+ bandPtr sband = &(rcp[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD32 band;
+
+ for (band=0; band<nbands; band++, pvt++, sband++, dband++) {
+ CARD32 iclass = IndexClass(sband->format->class);
+ void (*act)() = 0;
+
+ if ((raw->bandMask & (1<<band)) == 0)
+ continue;
+
+ if (IsConstrained(sband->format->class)) {
+ CARD32 deep;
+ pvt->nlev = sband->format->levels;
+ SetDepthFromLevels(pvt->nlev,deep); pvt->nclip = 1 << deep;
+ }
+
+ /*
+ ** NOTE:
+ ** For larger sized pixels, a lookup table my be counter
+ ** productive. In addition to the malloc space (eg 64k
+ ** words), and the low cache hit rate, the time to fill the
+ ** lookup table can become significant. Even for medium
+ ** sized pixels, some sort of hashed cache might be a
+ ** better solution. But I seriously doubt anyone will
+ ** use these operations on integer pixels very much ...
+ */
+
+ /* Try to find a monadic operator */
+ if (!act)
+ act = action_mathROI[iclass][raw->operator-1];
+
+ /* Or maybe a monadic look up table operator */
+ if (!act) {
+ act = action_lut[iclass];
+ if (act) {
+ /* Allocate Lut and Fill it in */
+ if (!(pvt->lutptr = (CARD32 *)
+ XieMalloc(pvt->nclip * sizeof(CARD32))))
+ AllocError(flo,ped,return(FALSE));
+ (*prep_math[raw->operator-1]) (pvt);
+ }
+ }
+ if (!act)
+ ImplementationError(flo,ped,return(FALSE));
+
+ pvt->action = act;
+ pvt->passive = passive_copy[iclass];
+ }
+ return TRUE;
+}
+
+static void ClearArith(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpArithPvtPtr pvt = (mpArithPvtPtr) (ped->peTex->private);
+ int band;
+
+ /* free any dynamic private data */
+ if (pvt)
+ for (band = 0 ; band < xieValMaxBands ; band++, pvt++)
+ if (pvt->lutptr)
+ pvt->lutptr = (CARD32 *) XieFree(pvt->lutptr);
+
+}
+
+/* end module mparith.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpbandc.c b/xc/programs/Xserver/XIE/mixie/process/mpbandc.c
new file mode 100644
index 000000000..ab8d7d455
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpbandc.c
@@ -0,0 +1,230 @@
+/* $TOG: mpbandc.c /main/6 1998/02/09 16:21:13 kaleb $ */
+/**** module mpbandc.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpbandc.c -- DDXIE BandCombine element
+
+ Robert NC Shelley -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpbandc.c,v 3.3 1998/10/05 13:22:41 dawes Exp $ */
+
+#define _XIEC_MPBANDC
+#define _XIEC_PBANDC
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeBandCom();
+
+/* routines used internal to this module
+ */
+static int CreateBandCom();
+static int InitializeBandCom();
+static int ActivateBandCom();
+static int ResetBandCom();
+static int DestroyBandCom();
+
+/* DDXIE BandCombine entry points
+ */
+static ddElemVecRec BandComVec = {
+ CreateBandCom,
+ InitializeBandCom,
+ ActivateBandCom,
+ (xieIntProc)NULL,
+ ResetBandCom,
+ DestroyBandCom
+ };
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeBandCom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = BandComVec;
+
+ return(TRUE);
+} /* end miAnalyzeBandCom */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateBandCom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC);
+} /* end CreateBandCom */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeBandCom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ return
+ InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE);
+} /* end InitializeBandCom */
+
+
+/*------------------------------------------------------------------------
+------------------------ crank some single input data --------------------
+------------------------------------------------------------------------*/
+static int ActivateBandCom(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd, dbnd = pet->emitter;
+ CARD32 b;
+
+ /* pass input from the 3 receptors to the corresponding output band
+ */
+ for(b = 0; b < xieValMaxBands; ++rcp, ++dbnd, ++b) {
+ sbnd = rcp->band;
+ if(!GetCurrentSrc(flo,pet,sbnd)) continue;
+
+ do {
+ /* pass a clone of the current src strip downstream
+ */
+ if(!PassStrip(flo,pet,dbnd,sbnd->strip))
+ return(FALSE);
+ } while(GetSrc(flo,pet,sbnd,sbnd->maxLocal,FLUSH));
+
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ }
+ return(TRUE);
+} /* end ActivateBandCom */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetBandCom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetBandCom */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyBandCom(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyBandCom */
+
+/* end module mpbandc.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpbande.c b/xc/programs/Xserver/XIE/mixie/process/mpbande.c
new file mode 100644
index 000000000..44b0d3a4f
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpbande.c
@@ -0,0 +1,548 @@
+/* $TOG: mpbande.c /main/6 1998/02/09 16:21:17 kaleb $ */
+/**** module mpbande.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpbande.c -- DDXIE BandExtract element
+
+ Robert NC Shelley -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpbande.c,v 3.3 1998/10/05 13:22:41 dawes Exp $ */
+
+#define _XIEC_MPBANDE
+#define _XIEC_PBANDE
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeBandExt();
+
+/* routines used internal to this module
+ */
+static int CreateBandExt();
+static int InitializeBandExt();
+static int ActivateBandExt();
+static int ResetBandExt();
+static int DestroyBandExt();
+
+/* DDXIE BandExtract entry points
+ */
+static ddElemVecRec BandExtVec = {
+ CreateBandExt,
+ InitializeBandExt,
+ ActivateBandExt,
+ (xieIntProc)NULL,
+ ResetBandExt,
+ DestroyBandExt
+ };
+
+/* Local Declarations.
+ */
+typedef float bndExtFlt;
+typedef int bndExtInt;
+#define BE_FBITS 6
+#define BE_IBITS 32-BE_FBITS
+#define BE_LIMIT (1<<BE_IBITS-1)
+
+typedef struct _mpbandext {
+ bndExtInt ibias;
+ bndExtFlt fbias;
+ bndExtFlt coef[xieValMaxBands];
+ bndExtInt *lut[xieValMaxBands];
+ bndExtInt *accumulator;
+ xieVoidProc accumulate[xieValMaxBands];
+ xieVoidProc extract;
+ xieVoidProc output;
+ bndExtInt bits[xieValMaxBands];
+ Bool clip;
+ Bool shift;
+} mpBandExtRec, *mpBandExtPtr;
+
+#define NADA (xieVoidProc)NULL
+
+/* "full service" extraction functions
+ */
+static void extBB(), extBP(), extPB(), extPP(), extQB(), extQP();
+static void extRR(), extB4();
+static void (*action_extract[4][3])() = {
+ NADA, NADA, NADA, /* out=b, in=b,B,P */
+ NADA, extBB, extBP, /* out=B, in=b,B,P */
+ NADA, extPB, extPP, /* out=P, in=b,B,P */
+ NADA, extQB, extQP, /* out=Q, in=b,B,P */
+};
+
+/* accumulator functions
+ */
+static void acc_b(), acc_B(), acc_P();
+static void (*action_accumulate[3])() = {
+ acc_b, acc_B, acc_P,
+};
+
+/* output functions
+ */
+static void out_b(), out_B(), out_P(), out_Q();
+static void (*action_output[4])() = {
+ out_b, out_B, out_P, out_Q,
+};
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeBandExt(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = BandExtVec;
+
+ return(TRUE);
+} /* end miAnalyzeBandExt */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateBandExt(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, sizeof(mpBandExtRec), NO_SYNC, SYNC);
+} /* end CreateBandExt */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeBandExt(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ formatPtr ift = &ped->inFloLst[SRCtag].format[0];
+ formatPtr oft = &ped->outFlo.format[0];
+ pBandExtDefPtr dix = (pBandExtDefPtr)ped->elemPvt;
+ mpBandExtPtr ddx = (mpBandExtPtr) pet->private;
+ bandMsk msk = 0;
+
+ if(IsntConstrained(ift->class)) {
+ /*
+ * the choice here is easy -- have to do floating calculation of each pixel
+ */
+ ddx->extract = extRR;
+ ddx->coef[0] = dix->coef[0];
+ ddx->coef[1] = dix->coef[1];
+ ddx->coef[2] = dix->coef[2];
+ ddx->fbias = dix->bias;
+ msk = ALL_BANDS;
+ } else {
+ int size, b, i, ic = ift->class, shift[xieValMaxBands];
+ Bool match = TRUE;
+ bndExtFlt val, lo = dix->bias, hi = dix->bias;
+
+ /* first we'll examine the numbers we have to work with...
+ */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ if((val = dix->coef[b]) < 0.0)
+ lo += val * (ift[b].levels-1);
+ else
+ hi += val * (ift[b].levels-1);
+ if(ift[b].levels <= 2 || (bndExtFlt)(i = val) != val || !i || i & i-1)
+ shift[b] = ift[b].levels < 2 || val == 0.0 ? -1 : 0;
+ else
+ SetDepthFromLevels((int)val,shift[b]); /* coef is a power of 2 */
+ match &= ic == ift[b].class;
+ }
+ if(val = hi >= BE_LIMIT ? hi : lo <= -BE_LIMIT ? lo : 0.0)
+ ValueError(flo,ped,(int)val, return(FALSE));
+
+ /* if all bands share a common data class, see if we have an extractor,
+ * else we'll have to accumulate input, then convert to the output class
+ */
+ if(match && (ddx->extract = action_extract[oft->class-1][ic-1]))
+ msk = ALL_BANDS;
+ else if(ddx->accumulator =
+ (bndExtInt*) XieMalloc(oft->width*sizeof(bndExtInt)))
+ ddx->output = action_output[oft->class-1];
+ else
+ AllocError(flo,ped, return(FALSE));
+
+ /* init the control parameters for the action routines
+ */
+ ddx->clip = lo < 0.0 || hi >= oft->levels;
+ ddx->shift = ddx->extract && shift[0] > 0 && shift[1] > 0 && shift[2] > 0;
+ ddx->ibias = dix->bias * (ddx->shift ? 1 : (1<<BE_FBITS));
+ if(ddx->shift && !ddx->clip && ddx->extract == extBB) {
+ ddx->extract = extB4; /* we can use the turbo multi-byte shifter */
+ ddx->ibias |= ddx->ibias << 8;
+ ddx->ibias |= ddx->ibias << 16;
+ }
+ for(b = 0; b < xieValMaxBands; ++b) {
+ if(!ddx->shift && ddx->extract || shift[b] == 0) {
+ /*
+ * build luts and assign accumulator functions
+ */
+ size = 1<<ift[b].depth;
+ ddx->bits[b] = size-1;
+ if(!(ddx->lut[b] = (bndExtInt*) XieMalloc(size * sizeof(bndExtInt))))
+ AllocError(flo,ped, return(FALSE));
+
+ for(i = 0; i < ift[b].levels; ++i)
+ ddx->lut[b][i] = dix->coef[b] * (i<<BE_FBITS);
+ while(i < size)
+ ddx->lut[b][i++] = 0;
+ } else if(shift[b] > 0) {
+ /*
+ * coef is an exact power of 2, so just use a left shift count
+ */
+ ddx->bits[b] = shift[b] + ((ddx->shift ? 0 : BE_FBITS) -
+ (dix->coef[b] == 1.0 ? 1 : 0));
+ }
+ if(!ddx->extract && shift[b] >= 0) {
+ /*
+ * assign accumulator function and add this band to the active mask
+ */
+ ddx->accumulate[b] = action_accumulate[ift[b].class-1];
+ msk |= 1<<b;
+ }
+ }
+ }
+ return(!msk ||
+ InitReceptor(flo,ped,&pet->receptor[SRCtag],NO_DATAMAP,1,msk,NO_BANDS)
+ && InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeBandExt */
+
+
+/*------------------------------------------------------------------------
+------------------------ crank some single input data --------------------
+------------------------------------------------------------------------*/
+static int ActivateBandExt(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpBandExtPtr ddx = (mpBandExtPtr) pet->private;
+ bandPtr ib = &pet->receptor[SRCtag].band[0];
+ bandPtr ob = &pet->emitter[0];
+ bndExtInt *acc = ddx->accumulator;
+ formatPtr oft = ob->format;
+ CARD32 b, i, width = oft->width;
+ CARD32 maxLev = oft->levels-1;
+ bandMsk ok, ready = pet->scheduled;
+ pointer o, i0 = NULL, i1 = NULL, i2 = NULL;
+
+ ok = NO_BANDS;
+ if(ready & 1 && (i0 = GetCurrentSrc(flo,pet,&ib[0]))) ok |= 1;
+ if(ready & 2 && (i1 = GetCurrentSrc(flo,pet,&ib[1]))) ok |= 2;
+ if(ready & 4 && (i2 = GetCurrentSrc(flo,pet,&ib[2]))) ok |= 4;
+ if((o = GetCurrentDst(flo,pet,ob)) && ok == ready)
+ do {
+ /* if we have a "full service" extractor, go for the whole enchalada
+ */
+ if( ddx->extract)
+ (*ddx->extract)(o, i0, i1, i2, width, maxLev, ddx);
+ else {
+ /* initialize accumulator with the bias value
+ */
+ if(ddx->ibias)
+ for(i = 0; i < width; acc[i++] = ddx->ibias);
+ else
+ bzero((char *)acc, width * sizeof(bndExtInt));
+
+ /* accumulate data from each active band, then convert to output class
+ */
+ if( ddx->accumulate[0])
+ (*ddx->accumulate[0])(acc, i0, width, ddx->bits[0], ddx->lut[0]);
+ if( ddx->accumulate[1])
+ (*ddx->accumulate[1])(acc, i1, width, ddx->bits[1], ddx->lut[1]);
+ if( ddx->accumulate[2])
+ (*ddx->accumulate[2])(acc, i2, width, ddx->bits[2], ddx->lut[2]);
+ (*ddx->output)(o, acc, width, maxLev, ddx->clip);
+ }
+ ok = NO_BANDS;
+ if(ready & 1 && (i0 = GetNextSrc(flo,pet,&ib[0],FLUSH))) ok |= 1;
+ if(ready & 2 && (i1 = GetNextSrc(flo,pet,&ib[1],FLUSH))) ok |= 2;
+ if(ready & 4 && (i2 = GetNextSrc(flo,pet,&ib[2],FLUSH))) ok |= 4;
+ } while((o = GetNextDst(flo,pet,ob,FLUSH)) && ok == ready);
+
+ /* free the input data we used
+ */
+ for(b = 0; b < xieValMaxBands; ++b)
+ if(ready & 1<<b)
+ FreeData(flo,pet,&ib[b],ib[b].current);
+
+ return(TRUE);
+} /* end ActivateBandExt */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetBandExt(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpBandExtPtr ddx = (mpBandExtPtr) ped->peTex->private;
+ CARD32 b = xieValMaxBands;
+
+ if(ddx->accumulator)
+ ddx->accumulator = (bndExtInt*)XieFree(ddx->accumulator);
+
+ while(b--) {
+ if(ddx->lut[b])
+ ddx->lut[b] = (bndExtInt*) XieFree(ddx->lut[b]);
+ ddx->accumulate[b] = (xieVoidProc)NULL;
+ }
+ ddx->extract = (xieVoidProc)NULL;
+ ddx->output = (xieVoidProc)NULL;
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetBandExt */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyBandExt(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyBandExt */
+
+/*------------------------------------------------------------------------
+--------- extract functions -- used when input data classes match --------
+------------------------------------------------------------------------*/
+static void extB4(O, I0, I1, I2, width, dummy, ddx)
+ pointer O, I0, I1, I2; CARD32 width, dummy; mpBandExtPtr ddx;
+{
+ QuadPixel *o = (QuadPixel*)O;
+ QuadPixel *i0 = (QuadPixel*)I0, *i1 = (QuadPixel*)I1, *i2 = (QuadPixel*)I2;
+ bndExtInt b0 = ddx->bits[0], b1 = ddx->bits[1], b2 = ddx->bits[2];
+ bndExtInt d = ddx->ibias;
+ int i, w = width+3>>2;
+
+ for(i = 0; i < w; ++i)
+ *o++ = (i0[i]<<b0)+(i1[i]<<b1)+(i2[i]<<b2)+d;
+}
+
+static void extRR(O, I0, I1, I2, width, dummy, ddx)
+ pointer O, I0, I1, I2; CARD32 width, dummy; mpBandExtPtr ddx;
+{
+ RealPixel *o = (RealPixel*)O,
+ *i0 = (RealPixel*)I0, *i1 = (RealPixel*)I1, *i2 = (RealPixel*)I2;
+ bndExtFlt c0 = ddx->coef[0], c1 = ddx->coef[1], c2 = ddx->coef[2],
+ d = ddx->fbias;
+ int i;
+ for(i = 0; i < width; ++i)
+ o[i] = i0[i] * c0 + i1[i] * c1 + i2[i] * c2 + d;
+}
+
+#define BAND_EXTRACT(name,otype,itype) \
+static void name(O, I0, I1, I2, width, maxLev, ddx) \
+ pointer O, I0, I1, I2; CARD32 width, maxLev; mpBandExtPtr ddx; \
+{ \
+ otype *o = (otype*)O; \
+ itype *i0 = (itype*)I0, *i1 = (itype*)I1, *i2 = (itype*)I2; \
+ bndExtInt b0 = ddx->bits[0], b1 = ddx->bits[1], b2 = ddx->bits[2]; \
+ bndExtInt d = ddx->ibias; \
+ int i; \
+ if(ddx->shift) { \
+ if(ddx->clip) \
+ for(i = 0; i < width; ++i) { \
+ int tmp = (i0[i]<<b0)+(i1[i]<<b1)+(i2[i]<<b2)+d; \
+ if( tmp < 0) *o++ = 0; \
+ else if(tmp > maxLev) *o++ = maxLev; \
+ else *o++ = tmp; \
+ } \
+ else \
+ for(i = 0; i < width; ++i) \
+ *o++ = (i0[i]<<b0)+(i1[i]<<b1)+(i2[i]<<b2)+d; \
+ } else { \
+ bndExtInt *L0 = ddx->lut[0], *L1 = ddx->lut[1], *L2 = ddx->lut[2]; \
+ if(ddx->clip) { \
+ bndExtInt limit = (maxLev+1)<<BE_FBITS; \
+ for(i = 0; i < width; ++i) { \
+ int tmp = L0[i0[i] & b0]+L1[i1[i] & b1]+L2[i2[i] & b2]+d; \
+ if( tmp < 0) *o++ = 0; \
+ else if(tmp >= limit) *o++ = maxLev; \
+ else *o++ = tmp>>BE_FBITS; \
+ } \
+ } else \
+ for(i = 0; i < width; ++i) \
+ *o++ = L0[i0[i] & b0]+L1[i1[i] & b1]+L2[i2[i] & b2]+d>>BE_FBITS;\
+ } \
+}
+BAND_EXTRACT(extBB,BytePixel,BytePixel)
+BAND_EXTRACT(extBP,BytePixel,PairPixel)
+BAND_EXTRACT(extPB,PairPixel,BytePixel)
+BAND_EXTRACT(extPP,PairPixel,PairPixel)
+BAND_EXTRACT(extQB,QuadPixel,BytePixel)
+BAND_EXTRACT(extQP,QuadPixel,PairPixel)
+
+/*------------------------------------------------------------------------
+---- accumulator functions (accumulate products from individual bands) ---
+------------------------------------------------------------------------*/
+static void acc_b(acc, SRC, width, dummy, lut)
+ bndExtInt *acc; pointer SRC; CARD32 width; bndExtInt dummy, *lut;
+{
+ LogInt *i = (LogInt *)SRC, ival, M;
+ bndExtInt *o = (bndExtInt*)acc, c = lut[1];
+ int bw = width;
+ int nw = bw >> LOGSHIFT;
+ while(nw--)
+ for(ival = *i++,M = LOGLEFT; M; ++o, LOGRIGHT(M)) if(ival & M) *o += c;
+ if(bw &= LOGMASK)
+ for(ival = *i, M = LOGLEFT; bw--; ++o, LOGRIGHT(M)) if(ival & M) *o += c;
+}
+
+#define BAND_ACCUMULATE(name,itype) \
+static void name(acc, SRC, width, bits, lut) \
+ bndExtInt *acc; pointer SRC; CARD32 width; bndExtInt bits, *lut; \
+{ \
+ itype *src = (itype*)SRC; \
+ int i = 0; \
+ if(lut) while(i < width) acc[i++] += lut[*src++ & bits]; \
+ else while(i < width) acc[i++] += *src++ << bits; \
+}
+BAND_ACCUMULATE(acc_B,BytePixel)
+BAND_ACCUMULATE(acc_P,PairPixel)
+
+/*------------------------------------------------------------------------
+---- output functions (convert accumulated data to output data class) ----
+------------------------------------------------------------------------*/
+static void out_b(DST, acc, width, dummy1, dummy2)
+ pointer DST; bndExtInt *acc; CARD32 width, dummy1; Bool dummy2;
+{
+ bndExtInt *i = acc;
+ LogInt *o = (LogInt*)DST, M, v;
+ int bw;
+ for(bw = width; bw >= LOGSIZE; *o++ = v, bw -= LOGSIZE)
+ for(v = 0, M = LOGLEFT; M; LOGRIGHT(M)) if(*i++ > 0) v |= M;
+ if(bw > 0) {
+ for(v = 0, M = LOGLEFT; bw--; LOGRIGHT(M)) if(*i++ > 0) v |= M;
+ *o++ = v;
+ }
+}
+
+#define BAND_OUTPUT(name,otype) \
+static void name(DST, acc, width, maxLev, clip) \
+ pointer DST; bndExtInt *acc; CARD32 width, maxLev; Bool clip; \
+{ \
+ otype *dst = (otype*)DST; \
+ bndExtInt limit = (maxLev+1)<<BE_FBITS; \
+ int tmp, i = 0; \
+ if(clip) \
+ while(i < width) \
+ if((tmp = acc[i++]) < 0) *dst++ = 0; \
+ else if(tmp >= limit) *dst++ = maxLev; \
+ else *dst++ = tmp >> BE_FBITS; \
+ else \
+ while(i < width) *dst++ = acc[i++] >> BE_FBITS; \
+}
+BAND_OUTPUT(out_B,BytePixel)
+BAND_OUTPUT(out_P,PairPixel)
+BAND_OUTPUT(out_Q,QuadPixel)
+
+/* end module mpbande.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpbands.c b/xc/programs/Xserver/XIE/mixie/process/mpbands.c
new file mode 100644
index 000000000..c62d3ab96
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpbands.c
@@ -0,0 +1,236 @@
+/* $TOG: mpbands.c /main/5 1998/02/09 16:21:21 kaleb $ */
+/**** module mpbands.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpbands.c -- DDXIE BandSelect element
+
+ Robert NC Shelley -- AGE Logic, Inc. September, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpbands.c,v 3.3 1998/10/05 13:22:41 dawes Exp $ */
+
+#define _XIEC_MPBANDS
+#define _XIEC_PBANDS
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeBandSel();
+
+/* routines used internal to this module
+ */
+static int CreateBandSel();
+static int InitializeBandSel();
+static int ActivateBandSel();
+static int ResetBandSel();
+static int DestroyBandSel();
+
+/* DDXIE BandSelect entry points
+ */
+static ddElemVecRec BandSelVec = {
+ CreateBandSel,
+ InitializeBandSel,
+ ActivateBandSel,
+ (xieIntProc)NULL,
+ ResetBandSel,
+ DestroyBandSel
+ };
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeBandSel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = BandSelVec;
+
+ return(TRUE);
+} /* end miAnalyzeBandSel */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateBandSel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+ return MakePETex(flo, ped, NO_PRIVATE, NO_SYNC, NO_SYNC);
+} /* end CreateBandSel */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeBandSel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloBandSelect *raw = (xieFloBandSelect *)ped->elemRaw;
+
+ if(raw->bandNumber)
+ return(InitReceptor(flo,ped,&ped->peTex->receptor[SRCtag],NO_DATAMAP,1,
+ (bandMsk)(1<<raw->bandNumber),NO_BANDS) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+ else
+ return(InitReceptor(flo,ped,&ped->peTex->receptor[SRCtag],NO_DATAMAP,1,
+ NO_BANDS,(bandMsk)1));
+} /* end InitializeBandSel */
+
+
+/*------------------------------------------------------------------------
+--------------------------- pass some input data -------------------------
+------------------------------------------------------------------------*/
+static int ActivateBandSel(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloBandSelect *raw = (xieFloBandSelect*)ped->elemRaw;
+ bandPtr sbnd = &pet->receptor->band[raw->bandNumber];
+ bandPtr dbnd = pet->emitter;
+
+ /* pass the chosen receptor band to our output band
+ */
+ if(GetCurrentSrc(flo,pet,sbnd)) {
+ do {
+ /* pass a clone of the current src strip downstream
+ */
+ if(!PassStrip(flo,pet,dbnd,sbnd->strip))
+ return(FALSE);
+ } while(GetSrc(flo,pet,sbnd,sbnd->maxLocal,FLUSH));
+
+ FreeData(flo,pet,sbnd,sbnd->maxLocal);
+ }
+ return(TRUE);
+} /* end ActivateBandSel */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetBandSel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloBandSelect *raw = (xieFloBandSelect *)ped->elemRaw;
+
+ if(raw->bandNumber) {
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+ }
+ return(TRUE);
+} /* end ResetBandSel */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyBandSel(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyBandSel */
+
+/* end module mpbands.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpblend.c b/xc/programs/Xserver/XIE/mixie/process/mpblend.c
new file mode 100644
index 000000000..4ac4aedfe
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpblend.c
@@ -0,0 +1,904 @@
+/* $TOG: mpblend.c /main/7 1998/02/09 16:21:26 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpblend.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpblend.c -- DDXIE Blend element
+
+ Dean Verheiden -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpblend.c,v 3.3 1998/10/05 13:22:41 dawes Exp $ */
+
+#define _XIEC_MPBLEND
+#define _XIEC_PBLEND
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <memory.h>
+
+
+typedef float BlendFloat;
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeBlend();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateBlend();
+static int ResetBlend();
+static int DestroyBlend();
+
+static int InitializeMonoBlend();
+static int InitializeDualBlend();
+static int InitializeMonoAlphaBlend();
+static int InitializeDualAlphaBlend();
+
+static int MonoBlend();
+static int DualBlend();
+static int MonoAlphaBlend();
+static int DualAlphaBlend();
+
+
+/*
+ * DDXIE Blend entry points
+ */
+static ddElemVecRec BlendVec = {
+ CreateBlend,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetBlend,
+ DestroyBlend
+ };
+
+/*
+ * Local Declarations.
+ */
+
+typedef struct _mpblenddef {
+ void (*action) ();
+} mpBlendPvtRec, *mpBlendPvtPtr;
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ pBlendDefPtr pvt = (pBlendDefPtr)ped->elemPvt;
+ CARD16 aindex = pvt->aindex;
+
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = BlendVec;
+ if (aindex) {
+ if (raw->src2) {
+ ped->ddVec.initialize = InitializeDualAlphaBlend;
+ ped->ddVec.activate = DualAlphaBlend;
+ } else {
+ ped->ddVec.initialize = InitializeMonoAlphaBlend;
+ ped->ddVec.activate = MonoAlphaBlend;
+ }
+ } else {
+ if (raw->src2) {
+ ped->ddVec.initialize = InitializeDualBlend;
+ ped->ddVec.activate = DualBlend;
+ } else {
+ ped->ddVec.initialize = InitializeMonoBlend;
+ ped->ddVec.activate = MonoBlend;
+ }
+ }
+
+ return(TRUE);
+} /* end miAnalyzeBlend */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpBlendPvtRec);
+
+ /* always force syncing between inputs (is nop if only one input) */
+ return MakePETex(flo, ped, auxsize, SYNC , NO_SYNC);
+} /* end CreateBlend */
+
+
+static void MonoR(), MonoQ(), MonoP(), MonoB();
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeMonoBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ CARD8 msk = raw->bandMask;
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ mpBlendPvtPtr pvt = (mpBlendPvtPtr) pet->private;
+ int band, nbands;
+ bandPtr iband;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ if (!(InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,msk,~msk) &&
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY) &&
+ InitEmitter(flo,ped,NO_DATAMAP,SRCt1)))
+ return (FALSE);
+
+ /* Figure out the appropriate action vector */
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ iband = &(pet->receptor[SRCtag].band[0]);
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ switch (iband->format->class) {
+ case UNCONSTRAINED: pvt->action = MonoR; break;
+ case QUAD_PIXEL: pvt->action = MonoQ; break;
+ case PAIR_PIXEL: pvt->action = MonoP; break;
+ case BYTE_PIXEL: pvt->action = MonoB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+
+ return( TRUE );
+} /* end InitializeMonoBlend */
+
+static void DualR(), DualQ(), DualP(), DualB();
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeDualBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ CARD8 msk = raw->bandMask;
+ receptorPtr rcp = pet->receptor;
+ mpBlendPvtPtr pvt = (mpBlendPvtPtr) pet->private;
+ int band, nbands;
+ bandPtr iband;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ if (!(InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,msk,~msk) &&
+ InitReceptor(flo,ped,&rcp[SRCt2],NO_DATAMAP,1,msk,NO_BANDS) &&
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY) &&
+ InitEmitter(flo,ped,0,SRCt1)))
+ return (FALSE);
+
+ /* Figure out the appropriate action vector */
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ iband = &(pet->receptor[SRCtag].band[0]);
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ switch (iband->format->class) {
+ case UNCONSTRAINED: pvt->action = DualR; break;
+ case QUAD_PIXEL: pvt->action = DualQ; break;
+ case PAIR_PIXEL: pvt->action = DualP; break;
+ case BYTE_PIXEL: pvt->action = DualB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+
+ return( TRUE );
+} /* end InitializeDualBlend */
+
+static void MonoAlphaRQ(), MonoAlphaQQ(), MonoAlphaPQ(), MonoAlphaBQ();
+static void MonoAlphaRP(), MonoAlphaQP(), MonoAlphaPP(), MonoAlphaBP();
+static void MonoAlphaRB(), MonoAlphaQB(), MonoAlphaPB(), MonoAlphaBB();
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeMonoAlphaBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ CARD8 msk = raw->bandMask;
+ receptorPtr rcp = pet->receptor;
+ CARD16 aindex = ((pBlendDefPtr)ped->elemPvt)->aindex;
+ bandPtr ab = &pet->receptor[aindex].band[0];
+ CARD8 nbands = pet->receptor[SRCtag].inFlo->bands;
+ CARD8 abands = pet->receptor[aindex].inFlo->bands;
+ mpBlendPvtPtr pvt = (mpBlendPvtPtr) pet->private;
+ int band;
+ bandPtr iband;
+
+ /* Replicate the alpha plane to all active bands */
+ if (nbands == 3 && abands == 1)
+ ab->replicate = msk;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ if (!(InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,msk,~msk) &&
+ InitReceptor(flo,ped,&rcp[aindex],NO_DATAMAP,1,1,NO_BANDS) &&
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY) &&
+ InitEmitter(flo,ped,0,SRCt1)))
+ return (FALSE);
+
+ /* Figure out the appropriate action vector based on src and alpha plane */
+ iband = &(pet->receptor[SRCtag].band[0]);
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ switch (iband->format->class) {
+ case UNCONSTRAINED:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = MonoAlphaRQ; break;
+ case PAIR_PIXEL: pvt->action = MonoAlphaRP; break;
+ case BYTE_PIXEL: pvt->action = MonoAlphaRB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case QUAD_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = MonoAlphaQQ; break;
+ case PAIR_PIXEL: pvt->action = MonoAlphaQP; break;
+ case BYTE_PIXEL: pvt->action = MonoAlphaQB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case PAIR_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = MonoAlphaPQ; break;
+ case PAIR_PIXEL: pvt->action = MonoAlphaPP; break;
+ case BYTE_PIXEL: pvt->action = MonoAlphaPB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case BYTE_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = MonoAlphaBQ; break;
+ case PAIR_PIXEL: pvt->action = MonoAlphaBP; break;
+ case BYTE_PIXEL: pvt->action = MonoAlphaBB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+
+ return( TRUE );
+} /* end InitializeMonoAlphaBlend */
+
+static void DualAlphaRQ(), DualAlphaQQ(), DualAlphaPQ(), DualAlphaBQ();
+static void DualAlphaRP(), DualAlphaQP(), DualAlphaPP(), DualAlphaBP();
+static void DualAlphaRB(), DualAlphaQB(), DualAlphaPB(), DualAlphaBB();
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeDualAlphaBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ xieFloBlend *raw = (xieFloBlend *)ped->elemRaw;
+ CARD8 msk = raw->bandMask;
+ receptorPtr rcp = pet->receptor;
+ CARD16 aindex = ((pBlendDefPtr)ped->elemPvt)->aindex;
+ bandPtr ab = &pet->receptor[aindex].band[0];
+ mpBlendPvtPtr pvt = (mpBlendPvtPtr) pet->private;
+ CARD8 nbands = pet->receptor[SRCtag].inFlo->bands;
+ CARD8 abands = pet->receptor[aindex].inFlo->bands;
+ int band;
+ bandPtr iband;
+
+ /* Replicate the alpha plane to all active bands */
+ if (nbands == 3 && abands == 1)
+ ab->replicate = msk;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ if (!(InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,msk,~msk) &&
+ InitReceptor(flo,ped,&rcp[SRCt2],NO_DATAMAP,1,msk,NO_BANDS) &&
+ InitReceptor(flo,ped,&rcp[aindex],NO_DATAMAP,1,1,NO_BANDS) &&
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY) &&
+ InitEmitter(flo,ped,0,SRCt1)))
+ return (FALSE);
+
+ /* Figure out the appropriate action vector based on src and alpha plane */
+ iband = &(pet->receptor[SRCtag].band[0]);
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ switch (iband->format->class) {
+ case UNCONSTRAINED:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = DualAlphaRQ; break;
+ case PAIR_PIXEL: pvt->action = DualAlphaRP; break;
+ case BYTE_PIXEL: pvt->action = DualAlphaRB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case QUAD_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = DualAlphaQQ; break;
+ case PAIR_PIXEL: pvt->action = DualAlphaQP; break;
+ case BYTE_PIXEL: pvt->action = DualAlphaQB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case PAIR_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = DualAlphaPQ; break;
+ case PAIR_PIXEL: pvt->action = DualAlphaPP; break;
+ case BYTE_PIXEL: pvt->action = DualAlphaPB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case BYTE_PIXEL:
+ switch (ab->format->class) {
+ case QUAD_PIXEL: pvt->action = DualAlphaBQ; break;
+ case PAIR_PIXEL: pvt->action = DualAlphaBP; break;
+ case BYTE_PIXEL: pvt->action = DualAlphaBB; break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped,
+ return(FALSE));
+ break;
+ }
+ break;
+ case BIT_PIXEL:
+ default: ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+
+ return( TRUE );
+} /* end InitializeDualAlphaBlend */
+
+/*------------------------------------------------------------------------
+------------------------ crank some single input data --------------------
+------------------------------------------------------------------------*/
+static int MonoBlend(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ pBlendDefPtr pvt = (pBlendDefPtr) ped->elemPvt;
+ BlendFloat aconst1 = pvt->alphaConst;
+ BlendFloat aconst2 = (BlendFloat)1.0 - aconst1;
+ double *sconst = pvt->constant;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp[SRCt1].inFlo->bands;
+ bandPtr sb1 = &rcp[SRCt1].band[0];
+ bandPtr bnd = &pet->emitter[0];
+ mpBlendPvtPtr mpvt = (mpBlendPvtPtr) pet->private;
+ pointer sr1, dst;
+ CARD32 b;
+
+ for(b = 0; b < bands; b++, sb1++, bnd++, sconst++, mpvt++) {
+ BlendFloat offset = *sconst * aconst1;
+
+ if (!(pet->scheduled & 1<<b)) continue;
+
+ /* get pointers to the initial src and dst scanlines */
+ sr1 = GetCurrentSrc(flo,pet,sb1);
+ dst = GetCurrentDst(flo,pet,bnd);
+
+ /* continue while all is well and we have pointers */
+ while(!ferrCode(flo) && sr1 && dst &&
+ SyncDomain(flo,ped,bnd,FLUSH)) {
+ INT32 run, currentx = 0;
+
+ if (sr1 != dst) memcpy (dst, sr1, bnd->pitch);
+
+ while (run = GetRun(flo,pet,bnd)) {
+ if (run > 0) {
+ (*(mpvt->action)) (currentx,run,sr1,dst,aconst2,offset);
+ currentx += run;
+ } else
+ currentx -= run;
+ }
+
+ /* get pointers to the next src and dst scanlines */
+ sr1 = GetNextSrc(flo,pet,sb1,TRUE);
+ dst = GetNextDst(flo,pet,bnd,TRUE);
+ }
+ /* make sure the scheduler knows how much src we used */
+ FreeData(flo,pet,sb1,sb1->current);
+ }
+ return(TRUE);
+} /* end MonoBlend */
+
+/*------------------------------------------------------------------------
+-- Case with two inputs: src1, src2, no alpha plane ---------------------
+------------------------------------------------------------------------*/
+static int DualBlend(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ BlendFloat aconst1 = ((pBlendDefPtr)ped->elemPvt)->alphaConst;
+ BlendFloat aconst2 = 1.0 - aconst1;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp[SRCt1].inFlo->bands;
+ bandPtr sb1 = &rcp[SRCt1].band[0];
+ bandPtr sb2 = &rcp[SRCt2].band[0];
+ bandPtr bnd = &pet->emitter[0];
+ mpBlendPvtPtr mpvt = (mpBlendPvtPtr) pet->private;
+ pointer sr1, sr2, dst;
+ CARD32 b, w;
+
+ for(b = 0; b < bands; b++,sb1++,sb2++,bnd++,mpvt++) {
+
+ if (!(pet->scheduled & 1<<b)) continue;
+
+ /* Figure out if any data from the first band passes through unchanged */
+ if(sb1->format->width > sb2->format->width)
+ w = sb2->format->width;
+ else
+ w = sb1->format->width;
+
+ /* get pointers to the initial src-1, src-2, and dst scanlines */
+ sr1 = GetCurrentSrc(flo,pet,sb1);
+ sr2 = GetCurrentSrc(flo,pet,sb2);
+ dst = GetCurrentDst(flo,pet,bnd);
+
+ /* continue while all is well and we have pointers */
+ while(!ferrCode(flo) && sr1 && sr2 && dst &&
+ SyncDomain(flo,ped,bnd,FLUSH)) {
+ INT32 run, currentx = 0;
+
+ if (sr1 != dst) memcpy (dst, sr1, bnd->pitch);
+
+ while ((run = GetRun(flo,pet,bnd)) && currentx < w) {
+ if (run > 0) {
+ if (currentx + run > w) /* Yuck, have to clip */
+ run = w - currentx;
+ (*(mpvt->action)) (currentx,run,sr1,sr2,dst,aconst1,aconst2);
+ currentx += run;
+ } else
+ currentx -= run;
+ }
+
+ /* get pointers to the next src-1, src-2, and dst scanlines */
+ sr1 = GetNextSrc(flo,pet,sb1,TRUE);
+ sr2 = GetNextSrc(flo,pet,sb2,TRUE);
+ dst = GetNextDst(flo,pet,bnd,TRUE);
+ }
+
+ /* If src2 < sr1, pass remaining lines through untouched */
+ if(!sr1 && sb1->final) /* when sr1 runs out, we're done */
+ DisableSrc(flo,pet,sb2,FLUSH);
+ else if(!sr2 && sb2->final) /* when sr2 runs out, pass-thru sr1 */
+ BypassSrc(flo,pet,sb1);
+ else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sb1,sb1->current);
+ FreeData(flo,pet,sb2,sb2->current);
+ }
+ }
+ return(TRUE);
+} /* end DualBlend */
+
+/*------------------------------------------------------------------------
+-- Case with two inputs: src1, alpha plane, no src2 ---------------------
+------------------------------------------------------------------------*/
+static int MonoAlphaBlend(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ pBlendDefPtr pvt = (pBlendDefPtr) ped->elemPvt;
+ BlendFloat invaconst = 1/pvt->alphaConst;
+ CARD16 aindex = pvt->aindex;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp[SRCt1].inFlo->bands;
+ bandPtr sb1 = &rcp[SRCt1].band[0];
+ bandPtr aband = &rcp[aindex].band[0];
+ bandPtr bnd = &pet->emitter[0];
+ double *sconst = pvt->constant;
+ mpBlendPvtPtr mpvt = (mpBlendPvtPtr) pet->private;
+ pointer sr1, alpha, dst;
+ CARD32 b, w;
+
+ for(b = 0; b < bands; b++,sb1++,bnd++,sconst++, mpvt++, aband++) {
+ BlendFloat scalefactor = *sconst * invaconst;
+
+ if (!(pet->scheduled & 1<<b)) continue;
+
+ /* Figure out if any data from the first band passes through unchanged */
+ if(sb1->format->width > aband->format->width)
+ w = aband->format->width;
+ else
+ w = sb1->format->width;
+
+ /* get pointers to the initial src-1, alpha, and dst scanlines */
+ sr1 = GetCurrentSrc(flo,pet,sb1);
+ alpha = GetCurrentSrc(flo,pet,aband);
+ dst = GetCurrentDst(flo,pet,bnd);
+
+ /* continue while all is well and we have pointers */
+ while(!ferrCode(flo) && sr1 && alpha && dst &&
+ SyncDomain(flo,ped,bnd,FLUSH)) {
+ INT32 run, currentx = 0;
+
+ if (sr1 != dst) memcpy (dst, sr1, bnd->pitch);
+
+ while ((run = GetRun(flo,pet,bnd)) && currentx < w ) {
+ if (run > 0) {
+ if (currentx + run > w ) /* Yuck, have to clip */
+ run = w - currentx;
+ (*(mpvt->action))(currentx,run,sr1,alpha,dst,invaconst,scalefactor);
+ currentx += run;
+ } else
+ currentx -= run;
+ }
+
+ /* get pointers to the next src-1 and dst scanlines */
+ sr1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ alpha = GetNextSrc(flo,pet,aband,FLUSH);
+ dst = GetNextDst(flo,pet,bnd,FLUSH);
+ }
+
+ /* If alpha < sr1, pass remaining lines through untouched */
+ if(!sr1 && sb1->final) { /* when sr1 runs out, we're done */
+ } else if(!alpha && aband->final) { /* when alpha runs out, pass-thru sr1*/
+ pet->inSync = FALSE; /* No need to sync anymore */
+ BypassSrc(flo,pet,sb1);
+ } else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sb1,sb1->current);
+ FreeData(flo,pet,aband,aband->current);
+ }
+ }
+
+ return(TRUE);
+} /* end MonoAlphaBlend */
+
+/*------------------------------------------------------------------------
+-- Case with three inputs: src1, src2, and alpha plane -------------------
+------------------------------------------------------------------------*/
+static int DualAlphaBlend(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ pBlendDefPtr pvt = (pBlendDefPtr)ped->elemPvt;
+ BlendFloat invaconst = 1.0/pvt->alphaConst;
+ CARD16 aindex = pvt->aindex;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp[SRCt1].inFlo->bands;
+ bandPtr sb1 = &rcp[SRCt1].band[0];
+ bandPtr sb2 = &rcp[SRCt2].band[0];
+ bandPtr aband = &rcp[aindex].band[0];
+ bandPtr bnd = &pet->emitter[0];
+ mpBlendPvtPtr mpvt = (mpBlendPvtPtr) pet->private;
+ pointer sr1, sr2, alpha, dst;
+ CARD32 b, w;
+
+ for(b = 0; b < bands; b++,sb1++,sb2++,bnd++,mpvt++,aband++) {
+
+ if (!(pet->scheduled & 1<<b)) continue;
+
+ /* Figure out if any data from the first band passes through unchanged */
+ /* Pass through if either sb2 or alpha runs out */
+ if(sb1->format->width > sb2->format->width ||
+ sb1->format->width > aband->format->width)
+ w = (aband->format->width < sb2->format->width) ?
+ aband->format->width : sb2->format->width;
+ else
+ w = sb1->format->width;
+
+ /* get pointers to the initial src-1, src-2, and dst scanlines */
+ sr1 = GetCurrentSrc(flo,pet,sb1);
+ sr2 = GetCurrentSrc(flo,pet,sb2);
+ alpha = GetCurrentSrc(flo,pet,aband);
+ dst = GetCurrentDst(flo,pet,bnd);
+
+ /* continue while all is well and we have pointers */
+ while(!ferrCode(flo) && sr1 && sr2 && alpha && dst &&
+ SyncDomain(flo,ped,bnd,FLUSH)) {
+ INT32 run, currentx = 0;
+
+ if (sr1 != dst) memcpy (dst, sr1, bnd->pitch);
+
+ while ((run = GetRun(flo,pet,bnd)) && currentx < w ) {
+ if (run > 0) {
+ if (currentx + run > w) /* Yuck, have to clip */
+ run = w - currentx;
+ (*(mpvt->action)) (currentx,run,sr1,sr2,alpha,dst,invaconst);
+ currentx += run;
+ } else
+ currentx -= run;
+ }
+
+ /* get pointers to the next src-1, src-2, and dst scanlines */
+ sr1 = GetNextSrc(flo,pet,sb1,FLUSH);
+ sr2 = GetNextSrc(flo,pet,sb2,FLUSH);
+ alpha = GetNextSrc(flo,pet,aband,FLUSH);
+ dst = GetNextDst(flo,pet,bnd,FLUSH);
+ }
+
+ /* If alpha < sr1, pass remaining lines through untouched */
+ if(!sr1 && sb1->final) { /* when sr1 runs out, we're done */
+ DisableSrc(flo,pet,sb2,FLUSH);
+ } else if( !sr2 && sb2->final || /* when other inputs out, pass sr1 */
+ !alpha && aband->final ) {
+ pet->inSync = FALSE; /* No need to sync anymore */
+ if (sr2) { /* flush any remain sr2 */
+ DisableSrc(flo,pet,sb2,FLUSH);
+ }
+ BypassSrc(flo,pet,sb1);
+ } else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sb1,sb1->current);
+ FreeData(flo,pet,sb2,sb2->current);
+ FreeData(flo,pet,aband,aband->current);
+ }
+ }
+
+ return(TRUE);
+} /* end DualAlphaBlend */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetBlend */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyBlend(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyBlend */
+
+/*------------------------------------------------------------------------
+------------------------MonoBlend action routines ----------------------
+------------------------------------------------------------------------*/
+
+#define DOMono(fname,stype) \
+static void fname(count,width,is,id,aconst2,offset) \
+INT32 count, width; \
+pointer is, id; \
+BlendFloat aconst2, offset; \
+{ \
+stype *sr1 = ((stype *)is) + count; \
+stype *dst = ((stype *)id) + count; \
+int i; \
+ for(i = 0; i < width; ++i) \
+ *dst++ = *sr1++ * aconst2 + offset; \
+}
+
+DOMono(MonoR,RealPixel)
+DOMono(MonoQ,QuadPixel)
+DOMono(MonoP,PairPixel)
+DOMono(MonoB,BytePixel)
+
+/*------------------------------------------------------------------------
+------------------------DualBlend action routines ----------------------
+------------------------------------------------------------------------*/
+#define DODual(fname,stype) \
+static void fname(count,width,is1,is2,id,aconst1,aconst2) \
+INT32 count,width; \
+pointer is1, is2, id; \
+BlendFloat aconst1, aconst2; \
+{ \
+stype *sr1 = ((stype *)is1) + count; \
+stype *sr2 = ((stype *)is2) + count; \
+stype *dst = ((stype *)id) + count; \
+int i; \
+ for(i = 0; i < width; ++i) \
+ *dst++ = *sr1++ * aconst2 + *sr2++ * aconst1; \
+}
+
+DODual(DualR,RealPixel)
+DODual(DualQ,QuadPixel)
+DODual(DualP,PairPixel)
+DODual(DualB,BytePixel)
+
+/*------------------------------------------------------------------------
+-------------------- MonoAlphaBlend action routines --------------------
+------------------------------------------------------------------------*/
+#define DOMonoAlpha(fname,stype,atype) \
+static void fname(count,width,is1,ia,id,iac,sf) \
+INT32 count, width; \
+pointer is1, ia, id; \
+BlendFloat iac, sf; \
+{ \
+stype *sr1 = ((stype *)is1) + count; \
+stype *dst = ((stype *)id) + count; \
+atype *alpha = ((atype *)ia) + count; \
+int i; \
+ for(i = 0; i < width; ++i) { \
+ register BlendFloat ralpha = *alpha++; \
+ *dst++ = *sr1++ * ((BlendFloat)1.0 - ralpha * iac) + \
+ ralpha * sf; \
+ } \
+}
+
+DOMonoAlpha(MonoAlphaRQ,RealPixel,QuadPixel)
+DOMonoAlpha(MonoAlphaRP,RealPixel,PairPixel)
+DOMonoAlpha(MonoAlphaRB,RealPixel,BytePixel)
+DOMonoAlpha(MonoAlphaQQ,QuadPixel,QuadPixel)
+DOMonoAlpha(MonoAlphaQP,QuadPixel,PairPixel)
+DOMonoAlpha(MonoAlphaQB,QuadPixel,BytePixel)
+DOMonoAlpha(MonoAlphaPQ,PairPixel,QuadPixel)
+DOMonoAlpha(MonoAlphaPP,PairPixel,PairPixel)
+DOMonoAlpha(MonoAlphaPB,PairPixel,BytePixel)
+DOMonoAlpha(MonoAlphaBQ,BytePixel,QuadPixel)
+DOMonoAlpha(MonoAlphaBP,BytePixel,PairPixel)
+DOMonoAlpha(MonoAlphaBB,BytePixel,BytePixel)
+
+/*------------------------------------------------------------------------
+-------------------- DualAlphaBlend action routines --------------------
+------------------------------------------------------------------------*/
+#define DODualAlpha(fname,stype,atype) \
+static void fname(count,width,is1,is2,ia,id,iac) \
+CARD32 count,width; \
+pointer is1, is2, ia, id; \
+BlendFloat iac; \
+{ \
+stype *sr1 = ((stype *)is1) + count; \
+stype *sr2 = ((stype *)is2) + count; \
+atype *alpha = ((atype *)ia) + count; \
+stype *dst = ((stype *)id) + count; \
+int i; \
+ for(i = 0; i < width; ++i) { \
+ register BlendFloat ascale = *alpha++ * iac; \
+ *dst++ = *sr1++ * ((BlendFloat)1.0 - ascale) + \
+ *sr2++ * ascale; \
+ } \
+}
+
+DODualAlpha(DualAlphaRQ,RealPixel,QuadPixel)
+DODualAlpha(DualAlphaRP,RealPixel,PairPixel)
+DODualAlpha(DualAlphaRB,RealPixel,BytePixel)
+DODualAlpha(DualAlphaQQ,QuadPixel,QuadPixel)
+DODualAlpha(DualAlphaQP,QuadPixel,PairPixel)
+DODualAlpha(DualAlphaQB,QuadPixel,BytePixel)
+DODualAlpha(DualAlphaPQ,PairPixel,QuadPixel)
+DODualAlpha(DualAlphaPP,PairPixel,PairPixel)
+DODualAlpha(DualAlphaPB,PairPixel,BytePixel)
+DODualAlpha(DualAlphaBQ,BytePixel,QuadPixel)
+DODualAlpha(DualAlphaBP,BytePixel,PairPixel)
+DODualAlpha(DualAlphaBB,BytePixel,BytePixel)
+/* end module mpblend.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpcfromi.c b/xc/programs/Xserver/XIE/mixie/process/mpcfromi.c
new file mode 100644
index 000000000..eafb04e80
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpcfromi.c
@@ -0,0 +1,475 @@
+/* $TOG: mpcfromi.c /main/6 1998/02/09 16:21:31 kaleb $ */
+/**** module mpcfromi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpcfromi.c -- DDXIE ConvertFromIndex element
+
+ Robert NC Shelley -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpcfromi.c,v 3.3 1998/10/05 13:22:42 dawes Exp $ */
+
+#define _XIEC_MPCFROMI
+#define _XIEC_PCFROMI
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <scrnintstr.h>
+#include <colormapst.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <colorlst.h>
+#include <element.h>
+#include <xiemd.h>
+#include <texstr.h>
+#include <memory.h>
+
+extern int QueryColors(); /* in ...server/dix/colormap.c */
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeCvtFromInd();
+
+/* routines used internal to this module
+ */
+static int CreateCfromI();
+static int InitCfromI();
+static int DoSingleCfromI();
+static int DoTripleCfromI();
+static int ResetCfromI();
+static int DestroyCfromI();
+
+
+/* DDXIE ConvertFromIndex entry points
+ */
+static ddElemVecRec mpCfromIVec = {
+ CreateCfromI,
+ InitCfromI,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetCfromI,
+ DestroyCfromI
+ };
+
+
+/* Local Declarations.
+ */
+typedef struct _mpcfromi {
+ pCfromIDefPtr dix;
+ xieIntProc action;
+ bandPtr iband;
+ bandPtr oband;
+ Pixel *pixLst;
+ xrgb *rgbLst;
+ CARD32 width;
+ pointer ibuf;
+ pointer obuf[xieValMaxBands];
+} mpCfromIRec, *mpCfromIPtr;
+
+/* action routines
+ */
+#define CfromI_1bb CfromI_1BB
+#define CfromI_1bB CfromI_1BB
+#define CfromI_1bP CfromI_1BP
+#define CfromI_1Bb CfromI_1BB
+#define CfromI_1Pb CfromI_1PB
+#define CfromI_1Qb CfromI_1QB
+#define CfromI_3bb CfromI_3BB
+#define CfromI_3bB CfromI_3BB
+#define CfromI_3bP CfromI_3BP
+#define CfromI_3Bb CfromI_3BB
+#define CfromI_3Pb CfromI_3PB
+#define CfromI_3Qb CfromI_3QB
+static int CfromI_1BB(), CfromI_1BP(), CfromI_3BB(), CfromI_3BP();
+static int CfromI_1PB(), CfromI_1PP(), CfromI_3PB(), CfromI_3PP();
+static int CfromI_1QB(), CfromI_1QP(), CfromI_3QB(), CfromI_3QP();
+
+static int (*action_CfromI[2][3][4])() = {
+ CfromI_1bb, CfromI_1Bb, CfromI_1Pb, CfromI_1Qb, /* single, o=1, i=1..4 */
+ CfromI_1bB, CfromI_1BB, CfromI_1PB, CfromI_1QB, /* single, o=2, i=1..4 */
+ CfromI_1bP, CfromI_1BP, CfromI_1PP, CfromI_1QP, /* single, o=3, i=1..4 */
+ CfromI_3bb, CfromI_3Bb, CfromI_3Pb, CfromI_3Qb, /* triple, o=1, i=1..4 */
+ CfromI_3bB, CfromI_3BB, CfromI_3PB, CfromI_3QB, /* triple, o=2, i=1..4 */
+ CfromI_3bP, CfromI_3BP, CfromI_3PP, CfromI_3QP, /* triple, o=3, i=1..4 */
+};
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeCvtFromInd(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* stash the entry point vector with the appropriate activate routine
+ */
+ ped->ddVec = mpCfromIVec;
+
+ return(TRUE);
+} /* end miAnalyzeCvtFromInd */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateCfromI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ return(MakePETex(flo, ped, sizeof(mpCfromIRec), NO_SYNC, NO_SYNC));
+} /* end CreateCfromI */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitCfromI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloConvertFromIndex *raw = (xieFloConvertFromIndex *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ formatPtr ift = &ped->inFloLst[SRCtag].format[0];
+ formatPtr oft = &ped->outFlo.format[0];
+ pCfromIDefPtr dix = (pCfromIDefPtr) ped->elemPvt;
+ mpCfromIPtr ddx = (mpCfromIPtr)pet->private;
+ CARD32 i, pseudo = !dix->pixMsk[0];
+ CARD32 cells, odx = ped->outFlo.bands == 1 ? 0 : 1;
+ CARD8 oc = oft->class, ic = ift->class;
+ Pixel *p;
+ xrgb *rgb;
+
+ /* set up action parameters
+ */
+ ddx->dix = dix;
+ ddx->width = oft->width;
+ ddx->iband = &pet->receptor[SRCtag].band[0];
+ ddx->oband = &pet->emitter[0];
+ ddx->action = action_CfromI[odx][oc-1][ift->class-1];
+ if(!ddx->action) ImplementationError(flo,ped, return(FALSE));
+ ped->ddVec.activate = !odx ? DoSingleCfromI : DoTripleCfromI;
+
+ if(ic == BIT_PIXEL && !(ddx->ibuf = (BytePixel*)XieMalloc(ddx->width+7)))
+ AllocError(flo,ped, return(FALSE));
+
+ if(oc == BIT_PIXEL)
+ if( odx && (!(ddx->obuf[0] = (BytePixel*)XieMalloc(ddx->width+7)) ||
+ !(ddx->obuf[1] = (BytePixel*)XieMalloc(ddx->width+7)) ||
+ !(ddx->obuf[2] = (BytePixel*)XieMalloc(ddx->width+7))) ||
+ !odx && !(ddx->obuf[0] = (BytePixel*)XieMalloc(ddx->width+7)))
+ AllocError(flo,ped, return(FALSE));
+
+ /* snapshot the current contents of the colormap
+ */
+ SetDepthFromLevels(dix->cells,i); cells = 1<<i;
+ if(!(ddx->pixLst = (Pixel*) XieMalloc(cells * sizeof(Pixel))) ||
+ !(ddx->rgbLst = (xrgb *) XieMalloc(cells * sizeof(xrgb))))
+ AllocError(flo,ped, return(FALSE));
+ for(p = ddx->pixLst, i = 0; i < cells; ++i)
+ *p++ = pseudo ? i : (i << dix->pixPos[0] & dix->pixMsk[0] |
+ i << dix->pixPos[1] & dix->pixMsk[1] |
+ i << dix->pixPos[2] & dix->pixMsk[2]);
+ if(QueryColors(dix->cmap,cells,ddx->pixLst,ddx->rgbLst))
+ ColormapError(flo,ped,raw->colormap, return(FALSE)); /* XXX hmmm? */
+
+ /* adjust the RGB values according to the client's precision requirements
+ */
+ for(rgb = ddx->rgbLst, i = 0; i < cells; ++rgb, ++i) {
+ rgb->red >>= dix->precShift;
+ rgb->green >>= dix->precShift;
+ rgb->blue >>= dix->precShift;
+ }
+
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitCfromI */
+
+
+/*------------------------------------------------------------------------
+------------------------- crank some input data --------------------------
+------------------------------------------------------------------------*/
+static int DoSingleCfromI(flo,ped,pet) /* one band out */
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpCfromIPtr ddx = (mpCfromIPtr) pet->private;
+ bandPtr iband = ddx->iband;
+ bandPtr oband = ddx->oband;
+ CARD32 width = iband->format->width;
+ pointer src, dst;
+
+ if((src = GetCurrentSrc(flo,pet,iband)) &&
+ (dst = GetCurrentDst(flo,pet,oband)))
+ do {
+ if(ddx->ibuf) src = bitexpand(src,ddx->ibuf,width,(char)1,(char)0);
+
+ (*ddx->action)(ddx, src, ddx->obuf[0] ? ddx->obuf[0] : dst);
+
+ if(ddx->obuf[0]) bitshrink(ddx->obuf[0],dst,width,(char)1);
+
+ src = GetNextSrc(flo,pet,iband,FLUSH);
+ dst = GetNextDst(flo,pet,oband,FLUSH);
+ } while(src && dst);
+
+ FreeData(flo,pet,iband,iband->current);
+
+ return(TRUE);
+} /* end DoSingleCfromI */
+
+static int DoTripleCfromI(flo,ped,pet) /* three bands out */
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpCfromIPtr ddx = (mpCfromIPtr) pet->private;
+ bandPtr iband = ddx->iband;
+ bandPtr oband = ddx->oband;
+ CARD32 width = iband->format->width;
+ pointer src, dstR, dstG, dstB;
+
+ src = GetCurrentSrc(flo,pet,iband);
+ dstR = GetCurrentDst(flo,pet,oband); oband++;
+ dstG = GetCurrentDst(flo,pet,oband); oband++;
+ dstB = GetCurrentDst(flo,pet,oband); oband -=2;
+
+ while(src && dstR && dstG && dstB) {
+
+ if(ddx->ibuf) src = bitexpand(src,ddx->ibuf,width,(char)1,(char)0);
+
+ (*ddx->action)(ddx, src,
+ ddx->obuf[0] ? ddx->obuf[0] : dstR,
+ ddx->obuf[1] ? ddx->obuf[1] : dstG,
+ ddx->obuf[2] ? ddx->obuf[2] : dstB);
+
+ if(ddx->obuf[0]) bitshrink(ddx->obuf[0],dstR,width,(char)1);
+ if(ddx->obuf[1]) bitshrink(ddx->obuf[1],dstG,width,(char)1);
+ if(ddx->obuf[2]) bitshrink(ddx->obuf[2],dstB,width,(char)1);
+
+ src = GetNextSrc(flo,pet,iband,FLUSH);
+ dstR = GetNextDst(flo,pet,oband,FLUSH); oband++;
+ dstG = GetNextDst(flo,pet,oband,FLUSH); oband++;
+ dstB = GetNextDst(flo,pet,oband,FLUSH); oband -=2;
+ }
+ FreeData(flo,pet,iband,iband->current);
+
+ return(TRUE);
+} /* end DoTripleCfromI */
+
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetCfromI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpCfromIPtr ddx = (mpCfromIPtr) ped->peTex->private;
+
+ if(ddx->pixLst ) ddx->pixLst = (Pixel*) XieFree(ddx->pixLst );
+ if(ddx->rgbLst ) ddx->rgbLst = (xrgb *) XieFree(ddx->rgbLst );
+ if(ddx->ibuf ) ddx->ibuf = (pointer ) XieFree(ddx->ibuf );
+ if(ddx->obuf[0]) ddx->obuf[0] = (pointer ) XieFree(ddx->obuf[0]);
+ if(ddx->obuf[1]) ddx->obuf[1] = (pointer ) XieFree(ddx->obuf[1]);
+ if(ddx->obuf[2]) ddx->obuf[2] = (pointer ) XieFree(ddx->obuf[2]);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetCfromI */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyCfromI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyCfromI */
+
+/* Single band output action routines:
+ */
+
+#define DO_SINGLE_CFROMI(fn_do,itype,otype) \
+static int fn_do(ddx,SRC,DST) \
+ mpCfromIPtr ddx; pointer SRC; pointer DST; \
+{ \
+ itype *s = (itype *)SRC; \
+ otype *d = (otype *)DST; \
+ xrgb *x = ddx->rgbLst; \
+ int w = ddx->width; \
+ switch(ddx->dix->class) { \
+ case StaticGray: \
+ case GrayScale: \
+ case StaticColor: \
+ case PseudoColor: \
+ while(w--) *d++ = x[*s++].red; \
+ break; \
+ case TrueColor: \
+ case DirectColor: \
+ { int rm = ddx->dix->pixMsk[0], rs = ddx->dix->pixPos[0]; \
+ while(w--) *d++ = x[(*s++ & rm) >> rs].red; \
+ } \
+ } \
+}
+/* bit versions - nyi */
+/* CfromI_1bb,BitPixel, BitPixel */
+/* CfromI_1bB,BitPixel, BytePixel */
+/* CfromI_1bP,BitPixel, PairPixel */
+/* CfromI_1Bb,BytePixel,BitPixel */
+DO_SINGLE_CFROMI(CfromI_1BB,BytePixel,BytePixel)
+DO_SINGLE_CFROMI(CfromI_1BP,BytePixel,PairPixel)
+/* CfromI_1Pb,PairPixel,BitPixel */
+DO_SINGLE_CFROMI(CfromI_1PB,PairPixel,BytePixel)
+DO_SINGLE_CFROMI(CfromI_1PP,PairPixel,PairPixel)
+/* CfromI_1Qb,QuadPixel,BitPixel */
+DO_SINGLE_CFROMI(CfromI_1QB,QuadPixel,BytePixel)
+DO_SINGLE_CFROMI(CfromI_1QP,QuadPixel,PairPixel)
+
+
+/* Triple band output action routines:
+ */
+
+#define DO_TRIPLE_CFROMI(fn_do,itype,otype) \
+static int fn_do(ddx,SRC,DSTR,DSTG,DSTB) \
+ mpCfromIPtr ddx; pointer SRC, DSTR, DSTG, DSTB; \
+{ \
+ itype *s = (itype *)SRC; \
+ otype *r = (otype *)DSTR; \
+ otype *g = (otype *)DSTG; \
+ otype *b = (otype *)DSTB; \
+ xrgb *x = ddx->rgbLst; \
+ int w = ddx->width; \
+ switch(ddx->dix->class) { \
+ case StaticGray: \
+ case GrayScale: \
+ while(w--) *r++ = *g++ = *b++ = x[*s++].red; \
+ break; \
+ case StaticColor: \
+ case PseudoColor: \
+ while(w--) { \
+ xrgb *p = x + *s++; \
+ *r++ = p->red; *g++ = p->green; *b++ = p->blue; \
+ } \
+ break; \
+ case TrueColor: \
+ case DirectColor: \
+ { int rm = ddx->dix->pixMsk[0], rs = ddx->dix->pixPos[0]; \
+ int gm = ddx->dix->pixMsk[1], gs = ddx->dix->pixPos[1]; \
+ int bm = ddx->dix->pixMsk[2], bs = ddx->dix->pixPos[2]; \
+ while(w--) { \
+ Pixel p = *s++; \
+ *r++ = x[(p & rm) >> rs].red; \
+ *g++ = x[(p & gm) >> gs].green; \
+ *b++ = x[(p & bm) >> bs].blue; \
+ } \
+ } \
+ } \
+}
+/* bit versions - nyi */
+/* CfromI_3bb,BitPixel, BitPixel */
+/* CfromI_3bB,BitPixel, BytePixel */
+/* CfromI_3bP,BitPixel, PairPixel */
+/* CfromI_3Bb,BytePixel,BitPixel */
+DO_TRIPLE_CFROMI(CfromI_3BB,BytePixel,BytePixel)
+DO_TRIPLE_CFROMI(CfromI_3BP,BytePixel,PairPixel)
+/* CfromI_3Pb,PairPixel,BitPixel */
+DO_TRIPLE_CFROMI(CfromI_3PB,PairPixel,BytePixel)
+DO_TRIPLE_CFROMI(CfromI_3PP,PairPixel,PairPixel)
+ /* CfromI_3Qb,QuadPixel,BitPixel */
+DO_TRIPLE_CFROMI(CfromI_3QB,QuadPixel,BytePixel)
+DO_TRIPLE_CFROMI(CfromI_3QP,QuadPixel,PairPixel)
+
+/* end module mpcfromi.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpcnst.c b/xc/programs/Xserver/XIE/mixie/process/mpcnst.c
new file mode 100644
index 000000000..b19ecd204
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpcnst.c
@@ -0,0 +1,1033 @@
+/* $TOG: mpcnst.c /main/7 1998/02/09 16:21:36 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpcnst.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpcnst.c -- DDXIE constrain element
+
+ Dean Verheiden && Larry Hare -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpcnst.c,v 3.3 1998/10/05 13:22:42 dawes Exp $ */
+
+
+#define _XIEC_MPCNST
+#define _XIEC_PCNST
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeConstrain();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateConstrain();
+static int InitializeConstrain();
+static int ActivateConstrain();
+static int ResetConstrain();
+static int DestroyConstrain();
+
+/*
+ * DDXIE ImportClientPhoto entry points
+ */
+static ddElemVecRec ConstrainVec = {
+ CreateConstrain,
+ InitializeConstrain,
+ ActivateConstrain,
+ (xieBoolProc)NULL,
+ ResetConstrain,
+ DestroyConstrain
+ };
+
+
+/*------------------------------------------------------------------------
+------------------------ Local declares and defines --------------------
+------------------------------------------------------------------------*/
+
+typedef struct _mpconstraindef {
+ void (*action) ();
+ pointer lut;
+ double pad[7];
+} mpCnstPvtRec, *mpCnstPvtPtr;
+
+
+static void (*hc_nop())();
+static void (*HCp_Rb())(), (*HCp_bb())(), (*HCp_Bb())(),
+ (*HCp_Pb())(), (*HCp_Qb())();
+static void (*HCp_RB())(), (*HCp_bB())(), (*HCp_BB())(),
+ (*HCp_PB())(), (*HCp_QB())();
+static void (*HCp_RP())(), (*HCp_bP())(), (*HCp_BP())(),
+ (*HCp_PP())(), (*HCp_QP())();
+static void (*HCp_RQ())(), (*HCp_bQ())(), (*HCp_BQ())(),
+ (*HCp_PQ())(), (*HCp_QQ())();
+
+static void (*(*prep_hc[5][5])())() = {
+ hc_nop, hc_nop, hc_nop, hc_nop, hc_nop, /* [out=0][inp=0...4] */
+ HCp_Rb, HCp_bb, HCp_Bb, HCp_Pb, HCp_Qb, /* [out=1][inp=0...4] */
+ HCp_RB, HCp_bB, HCp_BB, HCp_PB, HCp_QB, /* [out=2][inp=0...4] */
+ HCp_RP, HCp_bP, HCp_BP, HCp_PP, HCp_QP, /* [out=3][inp=0...4] */
+ HCp_RQ, HCp_bQ, HCp_BQ, HCp_PQ, HCp_QQ, /* [out=4][inp=0...4] */
+};
+
+static void (*cs_nop())();
+static void (*CSp_Rb())(), (*CSp_bb())(), (*CSp_Bb())(),
+ (*CSp_Pb())(), (*CSp_Qb())();
+static void (*CSp_RB())(), (*CSp_bB())(), (*CSp_BB())(),
+ (*CSp_PB())(), (*CSp_QB())();
+static void (*CSp_RP())(), (*CSp_bP())(), (*CSp_BP())(),
+ (*CSp_PP())(), (*CSp_QP())();
+static void (*CSp_RQ())(), (*CSp_bQ())(), (*CSp_BQ())(),
+ (*CSp_PQ())(), (*CSp_QQ())();
+
+static void (*(*prep_cs[5][5])())() = {
+ cs_nop, cs_nop, cs_nop, cs_nop, cs_nop, /* [0][0...4] */
+ CSp_Rb, CSp_bb, CSp_Bb, CSp_Pb, CSp_Qb, /* [1][0...4] */
+ CSp_RB, CSp_bB, CSp_BB, CSp_PB, CSp_QB, /* [2][0...4] */
+ CSp_RP, CSp_bP, CSp_BP, CSp_PP, CSp_QP, /* [3][0...4] */
+ CSp_RQ, CSp_bQ, CSp_BQ, CSp_PQ, CSp_QQ, /* [4][0...4] */
+};
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeConstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+ ped->ddVec = ConstrainVec;
+
+ /* based on the technique, fill in the appropriate entry point vector */
+
+ switch(((xieFloConstrain *)ped->elemRaw)->constrain) {
+ case xieValConstrainClipScale:
+ case xieValConstrainHardClip:
+ break;
+ default:
+ ImplementationError(flo,ped, return(FALSE));
+ }
+
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateConstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpCnstPvtRec);
+
+ return MakePETex(flo,ped,auxsize,NO_SYNC,NO_SYNC);
+}
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int InitializeConstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ pCnstDefPtr techpvt = (pCnstDefPtr)ped->techPvt;
+ mpCnstPvtPtr pvt = (mpCnstPvtPtr) pet->private;
+ bandPtr oband;
+ bandPtr iband;
+ int band, nbands, status;
+
+ status = InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ iband = &(pet->receptor[SRCtag].band[0]);
+ oband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+
+ int oo = IndexClass(oband->format->class);
+ int ii = IndexClass(iband->format->class);
+
+ switch(((xieFloConstrain *)ped->elemRaw)->constrain) {
+
+ case xieValConstrainClipScale:
+ pvt->action =
+ ((*(prep_cs[oo][ii])) (iband, oband, pvt, techpvt, band));
+ break;
+ case xieValConstrainHardClip:
+ pvt->action =
+ ((*(prep_hc[oo][ii])) (iband, oband, pvt, techpvt, band));
+ break;
+ }
+ }
+ return status;
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateConstrain(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpCnstPvtPtr pvt = (mpCnstPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+ register int bw = iband->format->width;
+ pointer ivoid, ovoid;
+
+ if (!(ivoid = GetCurrentSrc(flo,pet,iband)))
+ continue;
+
+ if (!pvt->action) {
+ do { /* pass a clone of the current src strip downstream */
+ if(!PassStrip(flo,pet,oband,iband->strip))
+ return(FALSE);
+ ivoid = GetSrc(flo,pet,iband,iband->maxLocal,TRUE);
+ } while (!ferrCode(flo) && ivoid) ;
+ FreeData(flo, pet, iband, iband->current);
+ continue;
+ }
+
+ if (!(ovoid = GetCurrentDst(flo,pet,oband)))
+ continue;
+
+ do {
+ (*(pvt->action)) (ivoid, ovoid, pvt, bw);
+ ivoid = GetNextSrc(flo,pet,iband,TRUE);
+ ovoid = GetNextDst(flo,pet,oband,TRUE);
+ } while (!ferrCode(flo) && ivoid && ovoid) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ }
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetConstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpCnstPvtPtr pvt = (mpCnstPvtPtr) ped->peTex->private;
+ int band;
+
+ /* free any dynamic private data */
+ for (band = 0 ; band < xieValMaxBands ; band++, pvt++)
+ if (pvt->lut)
+ pvt->lut = (pointer) XieFree(pvt->lut);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyConstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ This guy must be nuts -------------------------
+------------------------------------------------------------------------*/
+
+/*----------------------------- HardClip --------------------------------*/
+
+/*
+** DO_HCb - consume bits, produce bits.
+** DO_HCc - consume bits, produce otype.
+** DO_HCcx - consume bits, produce otype (using bitexpand).
+** DO_HCp - consume itype, produce bits..
+** DO_HCfp - consume floats, produce bits.
+** DO_HClt - consume itype, produce otype (itype < otype).
+** DO_HCeq - consume itype, produce otype (itype == otype).
+** DO_HCgt - consume itype, produce otype (itype > otype)
+** DO_HCf - consume floats, produce otype.
+*/
+
+static void constrain_nop(INP,OUTP,pvt,bw)
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw;
+{
+ return;
+}
+static void (*hc_nop(iband,oband,pvt,techpvt,band))()
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band;
+{
+ return constrain_nop;
+}
+static void (*cs_nop(iband,oband,pvt,techpvt,band))()
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band;
+{
+ return constrain_nop;
+}
+
+static void clearbitline(INP,OUTP,pvt,bw)
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw;
+{
+ action_clear(OUTP, bw, 0);
+}
+
+static void setbitline(INP,OUTP,pvt,bw)
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw;
+{
+ action_set(OUTP, bw, 0);
+}
+
+static void copybitline(INP,OUTP,pvt,bw)
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw;
+{
+ passcopy_bit(OUTP, INP, bw, 0);
+}
+
+static void invertbitline(INP,OUTP,pvt,bw)
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw;
+{
+ passcopy_bit (OUTP, INP, bw, 0);
+ action_invert(OUTP, bw, 0);
+}
+
+#define LEVELSM1(T) *((T *) &(pvt->pad[0]))
+
+#define DO_HCb(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (iband->format->levels == 1) \
+ return clearbitline; \
+ if (oband->format->levels == 1) \
+ return clearbitline; \
+ return copybitline; \
+}
+
+#define DO_HCc(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ LogInt inval, M, *inp = (LogInt *) INP; \
+ otype *outp = (otype *) OUTP; \
+ for ( ; bw >= LOGSIZE ; bw -= LOGSIZE) \
+ for (M=LOGLEFT, inval = *inp++; M; LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? (otype) 1 : (otype) 0; \
+ if (bw > 0) \
+ for (M=LOGLEFT, inval = *inp++; bw; bw--, LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? (otype) 1 : (otype) 0; \
+} \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ bzero((char *)OUTP, bw * sizeof(otype)); \
+ /* action_clear(OUTP, (bw * sizeof(otype)) << 3, 0); */ \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (iband->format->levels == 1) \
+ return fn_do_b; \
+ return fn_do_a; \
+}
+
+#define DO_HCcx(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ bitexpand(INP, OUTP, bw, 0, 1); \
+} \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ bzero((char *)OUTP, bw * sizeof(otype)); \
+ /* action_clear(OUTP, (bw * sizeof(otype)) << 3, 0); */ \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (iband->format->levels == 1) \
+ return fn_do_b; \
+ return fn_do; \
+}
+
+#define DO_HCp(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ LogInt outval, M, *outp = (LogInt *) OUTP; \
+ for ( ; bw >= LOGSIZE ; *outp++ = outval, bw -= LOGSIZE) \
+ for (M=LOGLEFT, outval = 0; M; LOGRIGHT(M)) \
+ if (*inp++) \
+ outval |= M; \
+ if (bw > 0) { \
+ for (M=LOGLEFT, outval = 0; bw; bw--, LOGRIGHT(M)) \
+ if (*inp++) \
+ outval |= M; \
+ *outp = outval; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (oband->format->levels == 1) \
+ return clearbitline; \
+ return fn_do_a; \
+}
+
+#define DO_HCfp(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ LogInt outval, M, *outp = (LogInt *) OUTP; \
+ for ( ; bw >= LOGSIZE ; *outp++ = outval, bw -= LOGSIZE) \
+ for (M=LOGLEFT, outval = 0; M; LOGRIGHT(M)) \
+ if (*inp++ >= (itype) 1.0) \
+ outval |= M; \
+ if (bw > 0) { \
+ for (M=LOGLEFT, outval = 0; bw; bw--, LOGRIGHT(M)) \
+ if (*inp++ >= (itype) 1.0) \
+ outval |= M; \
+ *outp = outval; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (oband->format->levels == 1) \
+ return clearbitline; \
+ return fn_do_a; \
+}
+
+#define DO_HClt(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ otype *outp = (otype *) OUTP; \
+ while (bw-- > 0 ) { \
+ *outp++ = (otype) *inp++; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ return fn_do_b; \
+}
+
+#define DO_HCeq(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ otype *outp = (otype *) OUTP; \
+ itype inval, lm1 = LEVELSM1(itype); \
+ while (bw-- > 0 ) { \
+ if ((inval = *inp++) > lm1) inval = lm1; \
+ *outp++ = (otype) inval; \
+ } \
+} \
+/* fn_do_b was memcpy, now done at higher level with PassStrip */ \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ itype ilm1 = (itype)( (iband->format->levels) \
+ ? iband->format->levels - 1 : ~0); \
+ itype olm1 = (itype)( (oband->format->levels) \
+ ? oband->format->levels - 1 : ~0); \
+ if (ilm1 < olm1) { \
+ /*special hint to PassStrip */ \
+ return (void (*) ()) 0; \
+ } \
+ LEVELSM1(itype) = (itype) olm1; \
+ return fn_do_a; \
+}
+
+#define DO_HCgt(fn_prep,fn_do_a, fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ otype *outp = (otype *) OUTP; \
+ itype inval, lm1 = LEVELSM1(itype); \
+ while (bw-- > 0 ) { \
+ if ((inval = *inp++) > lm1) inval = lm1; \
+ *outp++ = (otype) inval; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ otype olm1 = (otype)( (oband->format->levels) \
+ ? oband->format->levels - 1 : ~0); \
+ LEVELSM1(itype) = (itype) olm1; \
+ return fn_do_a; \
+}
+
+
+#define DO_HCf(fn_prep,fn_do_a,fn_do_b,itype,otype) \
+static void \
+fn_do_a(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ otype *outp = (otype *) OUTP; \
+ itype inval, olm1 = *((itype *) &(pvt->pad[0])); \
+ while (bw-- > 0 ) { \
+ if ((inval = *inp++) > olm1) inval = olm1; \
+ else if (inval < 0) inval = (itype) 0; \
+ *outp++ = (otype) inval; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ otype olm1 = (otype)( (oband->format->levels) \
+ ? oband->format->levels - 1 : ~0); \
+ *((itype *) &(pvt->pad[0])) = olm1; \
+ return fn_do_a; \
+}
+
+DO_HCb (HCp_bb, HCa_bb, HCb_bb, BitPixel, BitPixel)
+DO_HCp (HCp_Bb, HCa_Bb, HCb_Bb, BytePixel, BitPixel)
+DO_HCp (HCp_Pb, HCa_Pb, HCb_Pb, PairPixel, BitPixel)
+DO_HCp (HCp_Qb, HCa_Qb, HCb_Qb, QuadPixel, BitPixel)
+DO_HCfp (HCp_Rb, HCa_Rb, HCb_Rb, RealPixel, BitPixel)
+
+DO_HCcx (HCp_bB, HCa_bB, HCb_bB, BitPixel, BytePixel)
+DO_HCeq (HCp_BB, HCa_BB, HCb_BB, BytePixel, BytePixel)
+DO_HCgt (HCp_PB, HCa_PB, HCb_PB, PairPixel, BytePixel)
+DO_HCgt (HCp_QB, HCa_QB, HCb_QB, QuadPixel, BytePixel)
+DO_HCf (HCp_RB, HCa_RB, HCb_RB, RealPixel, BytePixel)
+
+DO_HCc (HCp_bP, HCa_bP, HCb_bP, BitPixel, PairPixel)
+DO_HClt (HCp_BP, HCa_BP, HCb_BP, BytePixel, PairPixel)
+DO_HCeq (HCp_PP, HCa_PP, HCb_PP, PairPixel, PairPixel)
+DO_HCgt (HCp_QP, HCa_QP, HCb_QP, QuadPixel, PairPixel)
+DO_HCf (HCp_RP, HCa_RP, HCb_RP, RealPixel, PairPixel)
+
+DO_HCc (HCp_bQ, HCa_bQ, HCb_bQ, BitPixel, QuadPixel)
+DO_HClt (HCp_BQ, HCa_BQ, HCb_BQ, BytePixel, QuadPixel)
+DO_HClt (HCp_PQ, HCa_PQ, HCb_PQ, PairPixel, QuadPixel)
+DO_HCeq (HCp_QQ, HCa_QQ, HCb_QQ, QuadPixel, QuadPixel)
+DO_HCf (HCp_RQ, HCa_RQ, HCb_RQ, RealPixel, QuadPixel)
+
+#undef LEVELSM1
+
+/*----------------------------- ClipScale --------------------------------*/
+
+typedef float ConstrainFloat;
+#define HALF ((ConstrainFloat) 0.5)
+
+#define LBOUND(T) *((T *) &(pvt->pad[0]))
+#define UBOUND(T) *((T *) &(pvt->pad[1]))
+#define OLOW(T) *((T *) &(pvt->pad[2]))
+#define OHIGH(T) *((T *) &(pvt->pad[3]))
+#define FLT_SF *((ConstrainFloat *) &(pvt->pad[4]))
+#define FLT_OFF *((ConstrainFloat *) &(pvt->pad[5]))
+#define INT_SF *((INT32 *) &(pvt->pad[4]))
+#define INT_OFF *((INT32 *) &(pvt->pad[5]))
+
+static void
+cs_scale_equation(pvt,techpvt,band)
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band;
+{
+ QuadPixel olow = techpvt->output_low[band];
+ ConstrainFloat ilow = techpvt->input_low[band];
+ ConstrainFloat sf = (techpvt->output_high[band] - olow) /
+ (techpvt->input_high[band] - ilow);
+ FLT_SF = sf;
+ FLT_OFF = (ConstrainFloat) olow - sf * ilow;
+}
+
+static void
+cs_fix_bits(pvt,techpvt,band)
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band;
+{
+ ConstrainFloat ilow = techpvt->input_low[band];
+ ConstrainFloat ihigh = techpvt->input_high[band];
+ QuadPixel olow = techpvt->output_low[band];
+ QuadPixel ohigh = techpvt->output_high[band];
+ /* Prep guarantees ilow != ihigh, but what if ilow > ihigh */
+ if (ilow == 0.0 && ihigh == 1.0) {
+ OLOW(QuadPixel) = olow;
+ OHIGH(QuadPixel) = ohigh;
+ return;
+ } else if (ilow == 1.0 && ihigh == 0.0) {
+ OLOW(QuadPixel) = ohigh;
+ OHIGH(QuadPixel) = olow;
+ return;
+ }
+ cs_scale_equation(pvt,techpvt,band);
+ if (ilow < ihigh) {
+ if (0.0 <= ilow) OLOW(QuadPixel) = olow;
+ else if (0.0 >= ihigh) OLOW(QuadPixel) = ohigh;
+ else OLOW(QuadPixel) = FLT_SF * 0. + FLT_OFF + HALF;
+ if (1.0 <= ilow) OHIGH(QuadPixel) = olow;
+ else if (1.0 >= ihigh) OHIGH(QuadPixel) = ohigh;
+ else OHIGH(QuadPixel) = FLT_SF * 1. + FLT_OFF + HALF;
+ } else {
+ if (0.0 >= ilow) OLOW(QuadPixel) = olow;
+ else if (0.0 <= ihigh) OLOW(QuadPixel) = ohigh;
+ else OLOW(QuadPixel) = FLT_SF * 0. + FLT_OFF + HALF;
+ if (1.0 >= ilow) OHIGH(QuadPixel) = olow;
+ else if (1.0 <= ihigh) OHIGH(QuadPixel) = ohigh;
+ else OHIGH(QuadPixel) = FLT_SF * 1. + FLT_OFF + HALF;
+ }
+}
+
+#define DO_CSb(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ if (iband->format->levels == 1 || oband->format->levels == 1) \
+ return clearbitline; \
+ cs_fix_bits(pvt,techpvt,band); \
+ return (OLOW(QuadPixel) == OHIGH(QuadPixel)) \
+ ? ((OLOW(QuadPixel) == 0) ? clearbitline: setbitline) \
+ : ((OLOW(QuadPixel) == 0) ? copybitline: invertbitline); \
+}
+
+
+#define DO_CSc(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ LogInt inval, M, *inp = (LogInt *) INP; \
+ otype *outp = (otype *) OUTP; \
+ otype olow = OLOW(otype), ohigh = OHIGH(otype); \
+ for ( ; bw >= LOGSIZE ; bw -= LOGSIZE) \
+ for (M=LOGLEFT, inval = *inp++; M; LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? ohigh : olow ; \
+ if (bw > 0) \
+ for (M=LOGLEFT, inval = *inp++; bw; bw--, LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? ohigh : olow ; \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ cs_fix_bits(pvt,techpvt,band); \
+ OLOW(otype) = OLOW(QuadPixel); \
+ OHIGH(otype) = OHIGH(QuadPixel); \
+ return fn_do; \
+}
+
+#define DO_CScx(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ otype olow = OLOW(otype), ohigh = OHIGH(otype); \
+ bitexpand(INP, OUTP, bw, olow, ohigh); \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ cs_fix_bits(pvt,techpvt,band); \
+ OLOW(otype) = OLOW(QuadPixel); \
+ OHIGH(otype) = OHIGH(QuadPixel); \
+ return fn_do; \
+}
+
+#define DO_CSp(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ LogInt outval, M, *outp = (LogInt *) OUTP; \
+ itype imedian = UBOUND(itype); \
+ for ( ; bw >= LOGSIZE ; *outp++ = outval, bw -= LOGSIZE) \
+ for (M=LOGLEFT, outval = 0; M; LOGRIGHT(M)) \
+ if (*inp++ > imedian) \
+ outval |= M; \
+ if (bw > 0) { \
+ for (M=LOGLEFT, outval = 0; bw; bw--, LOGRIGHT(M)) \
+ if (*inp++ > imedian) \
+ outval |= M; \
+ *outp = outval; \
+ } \
+} \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ LogInt outval, M, *outp = (LogInt *) OUTP; \
+ itype imedian = UBOUND(itype); \
+ for ( ; bw >= LOGSIZE ; *outp++ = outval, bw -= LOGSIZE) \
+ for (M=LOGLEFT, outval = 0; M; LOGRIGHT(M)) \
+ if (*inp++ <= imedian) \
+ outval |= M; \
+ if (bw > 0) { \
+ for (M=LOGLEFT, outval = 0; bw; bw--, LOGRIGHT(M)) \
+ if (*inp++ <= imedian) \
+ outval |= M; \
+ *outp = outval; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ otype olow = techpvt->output_low[band]; \
+ otype ohigh = techpvt->output_high[band]; \
+ if (olow == ohigh) \
+ return (olow == 0) ? clearbitline : setbitline; \
+ UBOUND(itype) = HALF * \
+ (techpvt->input_low[band] + techpvt->input_high[band]); \
+ return (techpvt->input_low[band] < techpvt->input_high[band]) \
+ ? fn_do : fn_do_b; \
+}
+
+#define DO_CS(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ itype inv, lbound = LBOUND(itype), ubound = UBOUND(itype); \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ ConstrainFloat sf = FLT_SF, offset = FLT_OFF; \
+ while (bw-- > 0) { \
+ inv = *inp++; \
+ out = olow; \
+ if (inv >= ubound) \
+ out = ohigh; \
+ else if (inv > lbound) \
+ out = (otype)(sf * inv + offset); \
+ *outp++ = out; \
+ } \
+} \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ itype inv, lbound = LBOUND(itype), ubound = UBOUND(itype); \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ ConstrainFloat sf = FLT_SF, offset = FLT_OFF; \
+ while (bw-- > 0) { \
+ inv = *inp++; \
+ out = ohigh; \
+ if (inv >= lbound) \
+ out = olow; \
+ else if (inv > ubound) \
+ out = (otype)(sf * inv + offset); \
+ *outp++ = out; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ OLOW(otype) = techpvt->output_low[band]; \
+ OHIGH(otype) = techpvt->output_high[band]; \
+ LBOUND(itype) = (itype) (techpvt->input_low[band] + HALF); \
+ UBOUND(itype) = (itype) (techpvt->input_high[band] + HALF); \
+ cs_scale_equation(pvt,techpvt,band); \
+ FLT_OFF += HALF; \
+ return (FLT_SF >= 0.0) ? fn_do : fn_do_b; \
+}
+
+#if defined(USE_FLOATS)
+#define DO_CSi(fn_prep,fn_do,fn_do_b,itype,otype,shift) \
+ DO_CS(fn_prep,fn_do,fn_do_b,itype,otype)
+#else
+/* XXX need LUT based approach for small sizes */
+#define DO_CSi_part1(fna,itype,otype,shift) \
+static void \
+fna(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ INT32 lbound = (INT32) LBOUND(itype); \
+ INT32 ubound = (INT32) UBOUND(itype); \
+ INT32 int_sf = INT_SF, int_off = INT_OFF; \
+ CARD32 inv; \
+ while (bw > 0) { \
+ inv = *inp++; \
+ out = ohigh; \
+ bw--; \
+ if (inv < ubound) { \
+ out = (otype)((int_sf * inv + int_off)>>shift); \
+ if (inv <= lbound) \
+ out = olow; \
+ } \
+ *outp++ = out; \
+ } \
+}
+#define DO_CSi_part2(fnb,itype,otype,shift) \
+static void \
+fnb(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ INT32 lbound = (INT32) LBOUND(itype); \
+ INT32 ubound = (INT32) UBOUND(itype); \
+ INT32 int_sf = INT_SF, int_off = INT_OFF; \
+ CARD32 inv; \
+ while (bw > 0) { \
+ inv = *inp++; \
+ out = olow; \
+ bw--; \
+ if (inv < lbound) { \
+ out = (otype)((int_sf * inv + int_off)>>shift); \
+ if (inv <= ubound) \
+ out = ohigh; \
+ } \
+ *outp++ = out; \
+ } \
+}
+/* some compilers gag on long macros. somehow this helps */
+#define DO_CSi(fn_prep,fn_do,fn_do_b,itype,otype,shift) \
+DO_CSi_part1(fn_do,itype,otype,shift) \
+DO_CSi_part2(fn_do_b,itype,otype,shift) \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ CARD32 olow, ohigh; INT32 int_sf, int_off; \
+ olow = techpvt->output_low[band]; \
+ ohigh = techpvt->output_high[band]; \
+ LBOUND(itype) = (itype) (techpvt->input_low[band] + HALF); \
+ UBOUND(itype) = (itype) (techpvt->input_high[band] + HALF); \
+ OLOW(otype) = olow = techpvt->output_low[band]; \
+ OHIGH(otype) = ohigh = techpvt->output_high[band]; \
+ olow <<= shift; \
+ ohigh <<= shift; \
+ INT_SF = int_sf = (ohigh - olow) / \
+ (techpvt->input_high[band] - techpvt->input_low[band]); \
+ INT_OFF = int_off = (1<<(shift-1)) + olow - \
+ int_sf * (INT32) techpvt->input_low[band]; \
+ INT_SF = int_sf; \
+ INT_OFF = int_off; \
+ return (int_sf >= 0) ? fn_do : fn_do_b; \
+}
+#endif
+
+#define DO_CSf(fn_prep,fn_do,fn_do_b,itype,otype) \
+static void \
+fn_do(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ itype inv, lbound = LBOUND(itype), ubound = UBOUND(itype); \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ ConstrainFloat sf = FLT_SF, offset = FLT_OFF; \
+ while (bw-- > 0) { \
+ inv = *inp++; \
+ out = olow; \
+ if (inv >= ubound) \
+ out = ohigh; \
+ else if (inv > lbound) \
+ out = (otype)(sf * inv + offset); \
+ *outp++ = out; \
+ } \
+} \
+static void \
+fn_do_b(INP,OUTP,pvt,bw) \
+ pointer INP; pointer OUTP; mpCnstPvtPtr pvt; int bw; \
+{ \
+ itype *inp = (itype *) INP; otype *outp = (otype *) OUTP; \
+ itype inv, lbound = LBOUND(itype), ubound = UBOUND(itype); \
+ otype out, olow = OLOW(otype), ohigh = OHIGH(otype); \
+ ConstrainFloat sf = FLT_SF, offset = FLT_OFF; \
+ while (bw-- > 0) { \
+ inv = *inp++; \
+ out = ohigh; \
+ if (inv >= lbound) \
+ out = olow; \
+ else if (inv > ubound) \
+ out = (otype)(sf * inv + offset); \
+ *outp++ = out; \
+ } \
+} \
+static void \
+(*fn_prep (iband,oband,pvt,techpvt,band))() \
+ bandPtr iband, oband; \
+ mpCnstPvtPtr pvt; pCnstDefPtr techpvt; int band; \
+{ \
+ OLOW(otype) = techpvt->output_low[band]; \
+ OHIGH(otype) = techpvt->output_high[band]; \
+ LBOUND(itype) = (itype) techpvt->input_low[band]; \
+ UBOUND(itype) = (itype) techpvt->input_high[band]; \
+ cs_scale_equation(pvt,techpvt,band); \
+ return (FLT_SF >= 0.0) ? fn_do : fn_do_b; \
+}
+
+DO_CSb (CSp_bb, CSa_bb, CSb_bb, BitPixel, BitPixel)
+DO_CSp (CSp_Bb, CSa_Bb, CSb_Bb, BytePixel, BitPixel)
+DO_CSp (CSp_Pb, CSa_Pb, CSb_Pb, PairPixel, BitPixel)
+DO_CSp (CSp_Qb, CSa_Qb, CSb_Qb, QuadPixel, BitPixel)
+DO_CSp (CSp_Rb, CSa_Rb, CSb_Rb, RealPixel, BitPixel)
+
+DO_CScx (CSp_bB, CSa_bB, CSb_bB, BitPixel, BytePixel)
+DO_CSi (CSp_BB, CSa_BB, CSb_BB, BytePixel, BytePixel, 22)
+DO_CSi (CSp_PB, CSa_PB, CSb_PB, PairPixel, BytePixel, 22)
+DO_CSi (CSp_QB, CSa_QB, CSb_QB, QuadPixel, BytePixel, 22)
+DO_CSf (CSp_RB, CSa_RB, CSb_RB, RealPixel, BytePixel)
+
+DO_CSc (CSp_bP, CSa_bP, CSb_bP, BitPixel, PairPixel)
+DO_CSi (CSp_BP, CSa_BP, CSb_BP, BytePixel, PairPixel, 14)
+DO_CSi (CSp_PP, CSa_PP, CSb_PP, PairPixel, PairPixel, 14)
+DO_CSi (CSp_QP, CSa_QP, CSb_QP, QuadPixel, PairPixel, 14)
+DO_CSf (CSp_RP, CSa_RP, CSb_RP, RealPixel, PairPixel)
+
+DO_CSc (CSp_bQ, CSa_bQ, CSb_bQ, BitPixel, QuadPixel)
+DO_CSi (CSp_BQ, CSa_BQ, CSb_BQ, BytePixel, QuadPixel, 6)
+DO_CSi (CSp_PQ, CSa_PQ, CSb_PQ, PairPixel, QuadPixel, 6)
+DO_CSi (CSp_QQ, CSa_QQ, CSb_QQ, QuadPixel, QuadPixel, 6)
+DO_CSf (CSp_RQ, CSa_RQ, CSb_RQ, RealPixel, QuadPixel)
+
+#undef LBOUND
+#undef HBOUND
+#undef OLOW
+#undef OHIGH
+#undef FLT_SF
+#undef FLT_OFF
+#undef INT_SF
+#undef INT_OFF
+
+/* end module mpcnst.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpcomp.c b/xc/programs/Xserver/XIE/mixie/process/mpcomp.c
new file mode 100644
index 000000000..1efc0dabf
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpcomp.c
@@ -0,0 +1,1222 @@
+/* $TOG: mpcomp.c /main/5 1998/02/09 16:21:43 kaleb $ */
+/**** module mpcomp.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpcomp.c -- DDXIE compare element
+
+ Larry Hare -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpcomp.c,v 3.3 1998/10/05 13:22:43 dawes Exp $ */
+
+
+#define _XIEC_MPCOMP
+#define _XIEC_PCOMP
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeCompare();
+
+/*
+** Turn on NON_ROI to get non ROI based versions. They don't really go
+** faster and cost about 20Kbytes of object code space.
+*/
+
+/*
+ * routines used internal to this module
+ */
+static int CreateCompare();
+static int InitializeCompare();
+static int ResetCompare();
+static int DestroyCompare();
+
+#if defined(NON_ROI)
+static int ActivateCompareM();
+static int ActivateCompareD();
+#endif
+static int ActivateCompareMROI();
+static int ActivateCompareDROI();
+static int ActivateCompareTripleM();
+static int ActivateCompareTripleD();
+
+/*
+ * DDXIE Compare entry points
+ */
+static ddElemVecRec CompareVec = {
+ CreateCompare,
+ InitializeCompare,
+ ActivateCompareMROI,
+ (xieBoolProc)NULL,
+ ResetCompare,
+ DestroyCompare
+ };
+
+/*
+* Local Declarations.
+*/
+
+typedef struct _mpcomparedef {
+ CARD32 iconst; /* first, in case of .asm code */
+ RealPixel fconst; /* second, in case of .asm code */
+ void (*action) ();
+ CARD32 width;
+ BOOL final;
+#if defined(NON_ROI)
+ void (*action2) ();
+ CARD32 endrun;
+ CARD32 endix;
+#endif
+} mpComparePvtRec, *mpComparePvtPtr;
+
+/*
+** NOTE: Might change constants to use dyads with prefilled constant strip
+** to conserve code space at some small execution time expense.
+** NOTE: The ROI variants use three loops, the first to get in sync with
+** 32 bits, and the last to finish up partial words. A more space
+** efficient version would have one loop which would check for M
+** wrapping in which case the old word would be written.
+** It also requires loads of intermediate destination words which
+** will be completely overwritten.
+** NOTE: Might do NE/GT/GE as a second pass inversion of EQ/LE/LT to
+** save even more space at cost of another time penalty. This
+** inversion would have to be applied to active ROI entries only.
+** NOTE: On some machine architectures, it may be possible to write
+** assembly or asm() code which does a compare and then extracts
+** some 1 bit from a condition code register. This would reduce
+** the multiplication of code by 6 (or 3). Heck you could even
+** generate assembly code yourself automagically ...
+** NOTE: Triple Compare assumes all src1 bands same height/width.
+** NOTE: Triple Compare assumes all src2 bands same height/width.
+** NOTE: Triple Compare with band_mask of 0 sets output to 1 (for
+** equal) or 0 (for not equal) or 0 (outside ROI). This sortof
+** makes sense since all the selected bands were equal :-)
+*/
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeCompare(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = CompareVec;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateCompare(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* always force syncing between inputs (is nop if only one input) */
+ return MakePETex(flo,ped,
+ xieValMaxBands * sizeof(mpComparePvtRec),
+ SYNC, /* InSync: Make sure ROI exists first */
+ NO_SYNC /* bandSync: see InitializeCompare */
+ );
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+#if defined(NON_ROI)
+static int ActivateCompareM(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, dband++) {
+ CARD32 npix = pvt->width;
+ LogInt *svoid, *dvoid;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ do {
+ /* NOTE: could pass in replicated constant strip here */
+ (*(pvt->action)) (dvoid, svoid, pvt, npix);
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ } while (!ferrCode(flo) && svoid && dvoid) ;
+
+ FreeData(flo, pet, sband, sband->current);
+ }
+ return TRUE;
+}
+#endif /* NON_ROI */
+
+#if defined(NON_ROI)
+static int ActivateCompareD(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, tband++, dband++) {
+ LogInt *svoid, *tvoid, *dvoid;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(tvoid = GetCurrentSrc(flo,pet,tband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband)) ) {
+ if (sband->final && tband->final) {
+ /* Generate constant fill of 0 for remainder of image */
+ while ((dband->current < dband->format->height) &&
+ (dvoid = GetCurrentDst(flo,pet,dband))) {
+ action_clear(dvoid,dband->format->pitch,0);
+ if (PutData(flo,pet,dband,dband->current+1))
+ break;
+ }
+ }
+ continue;
+ }
+
+ do {
+ (*(pvt->action)) (dvoid, svoid, tvoid, pvt->endix);
+ if (pvt->action2)
+ (*(pvt->action2)) (dvoid, pvt->endrun, pvt->endix);
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ tvoid = GetNextSrc(flo,pet,tband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ } while (!ferrCode(flo) && svoid && tvoid && dvoid) ;
+
+ if(!svoid && sband->final) { /* when sr1 runs out, kill sr2 too */
+ DisableSrc(flo,pet,tband,FLUSH);
+ pvt->final = TRUE; /* generate constant fill on future activates */
+ } else if(!tvoid && tband->final) {/* when sr2 runs out, clear rest */
+ DisableSrc(flo,pet,sband,FLUSH);
+ pvt->final = TRUE; /* generate constant fill on future activates */
+ } else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sband,sband->current);
+ FreeData(flo,pet,tband,tband->current);
+ }
+ }
+ return TRUE;
+}
+#endif /* NON_ROI */
+
+static int ActivateCompareMROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, dband++) {
+ pointer svoid, dvoid;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ while (!ferrCode(flo) && svoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ /* bzero better for messy control planes */
+ /* bzero((char *)dvoid, dband->pitch); */
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ /* NOTE: could pass in replicated constant strip here */
+ (*(pvt->action)) (dvoid, svoid, pvt, run, ix);
+ ix += run;
+ } else {
+ /* action_clear better for non ROI or simple ROIs */
+ action_clear(dvoid, -run, ix);
+ ix -= run;
+ }
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ FreeData(flo, pet, sband, sband->current);
+ }
+ return TRUE;
+}
+
+static int ActivateCompareDROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, tband++, dband++) {
+ pointer svoid, tvoid, dvoid;
+ CARD32 w = pvt->width;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(tvoid = GetCurrentSrc(flo,pet,tband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) {
+ if (sband->final && tband->final) {
+ /* Generate constant fill of 0 for remainder of image */
+ while ((dband->current < dband->format->height) &&
+ (dvoid = GetCurrentDst(flo,pet,dband))) {
+ action_clear(dvoid,dband->format->pitch,0);
+ if (PutData(flo,pet,dband,dband->current+1))
+ break;
+ }
+ }
+ continue;
+ }
+
+ while (!ferrCode(flo) && svoid && tvoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ /* bzero better for messy control planes */
+ /* bzero((char *)dvoid, dband->pitch); */
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ /* needs to clip to second source, yuck */
+ if ((ix + run) > w) {
+ if (ix < w) {
+ (*(pvt->action)) (dvoid, svoid, tvoid, w - ix, ix);
+ ix = w;
+ }
+ action_clear(dvoid, dband->format->width - ix, ix);
+ break;
+ }
+ (*(pvt->action)) (dvoid, svoid, tvoid, run, ix);
+ ix += run;
+ } else {
+ /* action_clear better for non ROI or simple ROIs */
+ action_clear(dvoid, -run, ix);
+ ix -= run;
+ }
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ tvoid = GetNextSrc(flo,pet,tband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ if(!svoid && sband->final) {
+ /* when sr1 runs out, kill sr2 too. should be done */
+ DisableSrc(flo,pet,tband,FLUSH);
+ pvt->final = TRUE;
+ } else if(!tvoid && tband->final) {
+ /* when sr2 runs out, kill off sr1 also, and clear remaining dest */
+ DisableSrc(flo,pet,sband,FLUSH);
+ pvt->final = TRUE;
+ } else {
+ /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sband,sband->current);
+ FreeData(flo,pet,tband,tband->current);
+ }
+ }
+ return TRUE;
+}
+
+static int ActivateCompareTripleM(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD8 msk = ((xieFloCompare *) ped->elemRaw)->bandMask;
+ BOOL equal = ((xieFloCompare *) ped->elemRaw)->operator == xieValEQ;
+ register pointer s0 = (pointer ) 1;
+ register pointer s1 = (pointer ) 1;
+ register pointer s2 = (pointer ) 1;
+ register pointer dvoid;
+
+ if ((msk & 1) && !(s0 = GetCurrentSrc(flo,pet,sband)))
+ goto done; sband++;
+ if ((msk & 2) && !(s1 = GetCurrentSrc(flo,pet,sband)))
+ goto done; sband++;
+ if ((msk & 4) && !(s2 = GetCurrentSrc(flo,pet,sband)))
+ goto done; sband -= 2;
+ if(!(dvoid = GetCurrentDst(flo,pet,dband)))
+ goto done;
+
+ /*
+ ** An alternative algorithm might use while(GetRun) loop to
+ ** set or clear the destination bits in the line; and then
+ ** use SIMPLER action routines which scanned the entire line
+ ** and only operate on 1 pixels; optionally followed by
+ ** a while(GetRun) to invert the active bits for NE.
+ */
+ pvt += 2;
+ while (!ferrCode(flo) && s0 && s1 && s2 && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ register INT32 run, ix = 0;
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ action_set(dvoid, run, ix);
+ pvt -= 2; if (msk & 1)
+ (*pvt->action) (dvoid, s0, pvt, run, ix);
+ pvt++; if (msk & 2)
+ (*pvt->action) (dvoid, s1, pvt, run, ix);
+ pvt++; if (msk & 4)
+ (*pvt->action) (dvoid, s2, pvt, run, ix);
+ if (!equal)
+ action_invert(dvoid, run, ix);
+ ix += run;
+ } else {
+ action_clear(dvoid, -run, ix);
+ ix -= run;
+ }
+ }
+
+ if (msk & 1) s0 = GetNextSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 2) s1 = GetNextSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 4) s2 = GetNextSrc(flo,pet,sband,FLUSH); sband -= 2;
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ if (msk & 1) FreeData(flo,pet,sband,sband->current); sband++;
+ if (msk & 2) FreeData(flo,pet,sband,sband->current); sband++;
+ if (msk & 4) FreeData(flo,pet,sband,sband->current); sband -= 2;
+done:
+ return TRUE;
+}
+
+static int ActivateCompareTripleD(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD8 msk = ((xieFloCompare *) ped->elemRaw)->bandMask;
+ BOOL equal = ((xieFloCompare *) ped->elemRaw)->operator == xieValEQ;
+ CARD32 w = pvt->width;
+ register pointer s0 = (pointer ) 1;
+ register pointer s1 = (pointer ) 1;
+ register pointer s2 = (pointer ) 1;
+ register pointer t0 = (pointer ) 1;
+ register pointer t1 = (pointer ) 1;
+ register pointer t2 = (pointer ) 1;
+ register pointer dvoid;
+
+ if (pvt->final) { /* generate constant fill */
+ /* Generate constant fill of 0 for remainder of image */
+ while ((dband->current < dband->format->height) &&
+ (dvoid = GetCurrentDst(flo,pet,dband))) {
+ action_clear(dvoid,dband->format->pitch,0);
+ if (PutData(flo,pet,dband,dband->current+1))
+ break;
+ }
+ return TRUE;
+ }
+
+ if (msk & 1) s0 = GetCurrentSrc(flo,pet,sband); sband++;
+ if (msk & 2) s1 = GetCurrentSrc(flo,pet,sband); sband++;
+ if (msk & 4) s2 = GetCurrentSrc(flo,pet,sband); sband -= 2;
+ if (msk & 1) t0 = GetCurrentSrc(flo,pet,tband); tband++;
+ if (msk & 2) t1 = GetCurrentSrc(flo,pet,tband); tband++;
+ if (msk & 4) t2 = GetCurrentSrc(flo,pet,tband); tband -= 2;
+
+ dvoid = GetCurrentDst(flo,pet,dband);
+
+ while (!ferrCode(flo) && s0 && s1 && s2 && t0 && t1 && t2 && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ register INT32 run, ix = 0, extra;
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ extra = 0;
+ if ((ix+run) > w) { /* tband < sband */
+ if (ix >= w) { /* already off the end of src2 */
+ action_clear(dvoid, dband->format->width - ix, ix);
+ break;
+ }
+ extra = ix + run - w;
+ action_clear(dvoid, extra, w);
+ run = w - ix;
+ }
+ action_set(dvoid, run, ix);
+ if (msk & 1) (*((pvt+0)->action)) (dvoid, s0, t0, run, ix);
+ if (msk & 2) (*((pvt+1)->action)) (dvoid, s1, t1, run, ix);
+ if (msk & 4) (*((pvt+2)->action)) (dvoid, s2, t2, run, ix);
+ if (!equal) action_invert(dvoid, run, ix);
+ ix += run + extra;
+ } else {
+ action_clear(dvoid, -run, ix);
+ ix -= run;
+ }
+ }
+
+ if (msk & 1) s0 = GetNextSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 2) s1 = GetNextSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 4) s2 = GetNextSrc(flo,pet,sband,FLUSH); sband -= 2;
+ if (msk & 1) t0 = GetNextSrc(flo,pet,tband,FLUSH); tband++;
+ if (msk & 2) t1 = GetNextSrc(flo,pet,tband,FLUSH); tband++;
+ if (msk & 4) t2 = GetNextSrc(flo,pet,tband,FLUSH); tband -= 2;
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ if (msk & 1) FreeData(flo,pet,sband,sband->current); sband++;
+ if (msk & 2) FreeData(flo,pet,sband,sband->current); sband++;
+ if (msk & 4) FreeData(flo,pet,sband,sband->current); sband -= 2;
+ if (msk & 1) FreeData(flo,pet,tband,tband->current); tband++;
+ if (msk & 2) FreeData(flo,pet,tband,tband->current); tband++;
+ if (msk & 4) FreeData(flo,pet,tband,tband->current); tband -= 2;
+
+ /* if dband is final, then we are done. make sure src2 disabled */
+ if (dband->current >= dband->format->height) {
+ if (msk & 1) DisableSrc(flo,pet,tband,FLUSH); tband++;
+ if (msk & 2) DisableSrc(flo,pet,tband,FLUSH); tband++;
+ if (msk & 4) DisableSrc(flo,pet,tband,FLUSH); tband -= 2;
+ return TRUE;
+ }
+
+ /* if src2 finished early, then disable src1 and generate 0 fill */
+ if (dband->current >= tband->format->height) {
+ /* only need to check one band since in theory all the same */
+ if (msk & 1) DisableSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 2) DisableSrc(flo,pet,sband,FLUSH); sband++;
+ if (msk & 4) DisableSrc(flo,pet,sband,FLUSH); sband -= 2;
+ pvt->final = TRUE;
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetCompare(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyCompare(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+#if defined(NON_ROI)
+/* M: (*(pvt->action)) (dvoid, svoid, pvt, bw); */
+/* D: (*(pvt->action)) (dvoid, svoid, tvoid, bw); */
+
+#define MakeBit(name1, name2, op) \
+static void name1(dst,src1,pvt,nx) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ CARD32 nx; \
+{ \
+ LogInt *src = (LogInt *) src1; \
+ LogInt S1, S2 = (pvt->iconst ? LOGONES : LOGZERO); \
+ for (nx = (nx + LOGMASK) >> LOGSHIFT; nx > 0; nx--) { \
+ S1 = *src++; \
+ *dst++ = op; \
+ } \
+} \
+static void name2(dst,src1,src2,nx) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ CARD32 nx; \
+{ \
+ LogInt S1, *src = (LogInt *) src1; \
+ LogInt S2, *trc = (LogInt *) src2; \
+ for (nx = (nx + LOGMASK) >> LOGSHIFT; nx > 0; nx--) { \
+ S1 = *src++; \
+ S2 = *trc++; \
+ *dst++ = op; \
+ } \
+}
+
+#define MakePix(name1, name2, itype, cnst_name, op) \
+static void name1(dst,src1,pvt,nx) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ CARD32 nx; \
+{ \
+ itype *src = (itype *) src1; \
+ itype con = (itype) pvt->cnst_name; \
+ LogInt M, value; \
+ for ( ; nx >= LOGSIZE; nx -= LOGSIZE, *dst++ = value) \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ op con) \
+ value |= M; \
+ if (nx > 0) { \
+ for (value = 0, M=LOGLEFT; nx; nx--, LOGRIGHT(M)) \
+ if (*src++ op con) \
+ value |= M; \
+ *dst = value; \
+ } \
+} \
+static void name2(dst,src1,src2,nx) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ CARD32 nx; \
+{ \
+ itype *src = (itype *) src1; \
+ itype *trc = (itype *) src2; \
+ LogInt M, value; \
+ for ( ; nx >= LOGSIZE; nx -= LOGSIZE, *dst++ = value) \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ op *trc++) \
+ value |= M; \
+ if (nx > 0) { \
+ for (value = 0, M=LOGLEFT; nx; nx--, LOGRIGHT(M)) \
+ if (*src++ op *trc++) \
+ value |= M; \
+ *dst = value; \
+ } \
+}
+
+MakeBit (m_bit_lt, d_bit_lt, (S2 & ~S1) )
+MakeBit (m_bit_le, d_bit_le, (S2 | ~S1) )
+MakeBit (m_bit_eq, d_bit_eq, (S1 ^ ~S2) )
+MakeBit (m_bit_ne, d_bit_ne, (S1 ^ S2) )
+MakeBit (m_bit_gt, d_bit_gt, (S1 & ~S2) )
+MakeBit (m_bit_ge, d_bit_ge, (S1 | ~S2) )
+
+MakePix (m_byte_lt, d_byte_lt, BytePixel, iconst, < )
+MakePix (m_byte_le, d_byte_le, BytePixel, iconst, <= )
+MakePix (m_byte_eq, d_byte_eq, BytePixel, iconst, == )
+MakePix (m_byte_ne, d_byte_ne, BytePixel, iconst, != )
+MakePix (m_byte_gt, d_byte_gt, BytePixel, iconst, > )
+MakePix (m_byte_ge, d_byte_ge, BytePixel, iconst, >= )
+
+MakePix (m_pair_lt, d_pair_lt, PairPixel, iconst, < )
+MakePix (m_pair_le, d_pair_le, PairPixel, iconst, <= )
+MakePix (m_pair_eq, d_pair_eq, PairPixel, iconst, == )
+MakePix (m_pair_ne, d_pair_ne, PairPixel, iconst, != )
+MakePix (m_pair_gt, d_pair_gt, PairPixel, iconst, > )
+MakePix (m_pair_ge, d_pair_ge, PairPixel, iconst, >= )
+
+MakePix (m_quad_lt, d_quad_lt, QuadPixel, iconst, < )
+MakePix (m_quad_le, d_quad_le, QuadPixel, iconst, <= )
+MakePix (m_quad_eq, d_quad_eq, QuadPixel, iconst, == )
+MakePix (m_quad_ne, d_quad_ne, QuadPixel, iconst, != )
+MakePix (m_quad_ge, d_quad_ge, QuadPixel, iconst, >= )
+MakePix (m_quad_gt, d_quad_gt, QuadPixel, iconst, > )
+
+MakePix (m_real_lt, d_real_lt, RealPixel, fconst, < )
+MakePix (m_real_le, d_real_le, RealPixel, fconst, <= )
+MakePix (m_real_eq, d_real_eq, RealPixel, fconst, == )
+MakePix (m_real_ne, d_real_ne, RealPixel, fconst, != )
+MakePix (m_real_gt, d_real_gt, RealPixel, fconst, > )
+MakePix (m_real_ge, d_real_ge, RealPixel, fconst, >= )
+
+static void (*action_mono[5][6])() = {
+ m_real_lt, m_real_le, m_real_eq, m_real_ne, m_real_gt, m_real_ge,
+ m_bit_lt, m_bit_le, m_bit_eq, m_bit_ne, m_bit_gt, m_bit_ge,
+ m_byte_lt, m_byte_le, m_byte_eq, m_byte_ne, m_byte_gt, m_byte_ge,
+ m_pair_lt, m_pair_le, m_pair_eq, m_pair_ne, m_pair_gt, m_pair_ge,
+ m_quad_lt, m_quad_le, m_quad_eq, m_quad_ne, m_quad_gt, m_quad_ge
+};
+static void (*action_dyad[5][6])() = {
+ d_real_lt, d_real_le, d_real_eq, d_real_ne, d_real_gt, d_real_ge,
+ d_bit_lt, d_bit_le, d_bit_eq, d_bit_ne, d_bit_gt, d_bit_ge,
+ d_byte_lt, d_byte_le, d_byte_eq, d_byte_ne, d_byte_gt, d_byte_ge,
+ d_pair_lt, d_pair_le, d_pair_eq, d_pair_ne, d_pair_gt, d_pair_ge,
+ d_quad_lt, d_quad_le, d_quad_eq, d_quad_ne, d_quad_gt, d_quad_ge
+};
+#endif
+
+/*------------------------------------------------------------------------
+--------------------- ROI operations work on subranges ------------------
+------------------------------------------------------------------------*/
+
+/* MROI: (*(pvt->action)) (dvoid, src1, pvt, run, ix); */
+/* DROI: (*(pvt->action)) (dvoid, src1, src2, run, ix); */
+
+/* Currently ROI code pre-zeroes the line and then we OR into it.
+** If we want to use this for the nonROI code as well, it might be
+** more efficient to instead use a passive routine (when run < 0) to
+** clear out the idle bits.
+*/
+
+#define RakeBit(name1, name2, op) \
+static void name1(dst,src1,pvt,dx,x) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ INT32 dx, x; \
+{ \
+ CARD32 M, D, px = LOGINDX(x); \
+ LogInt S1, *src = ((LogInt *) src1) + px; \
+ LogInt S2 = (pvt->iconst ? LOGONES : LOGZERO); \
+ dst += px; \
+ px = x & LOGMASK; \
+ if ((px + dx) >= LOGSIZE) { \
+ if (px) { \
+ S1 = *src++; \
+ D = *dst; \
+ M = BitRight(LOGONES,px); \
+ dx -= (LOGSIZE - px); \
+ *dst++ = D | (M & op); \
+ } \
+ for (px = dx >> LOGSHIFT; px > 0; px--) { \
+ S1 = *src++; \
+ *dst++ = op; \
+ } \
+ if (dx &= LOGMASK) { \
+ S1 = *src; \
+ D = *dst; \
+ M = ~BitRight(LOGONES,dx); \
+ *dst = D | (M & op); \
+ } \
+ } else { \
+ S1 = *src; \
+ D = *dst; \
+ M = BitRight(LOGONES,px) & ~(BitRight(LOGONES,px+dx)); \
+ *dst = D | (M & op); \
+ } \
+} \
+static void name2(dst,src1,src2,dx,x) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ INT32 dx, x; \
+{ \
+ CARD32 M, D, px = LOGINDX(x); \
+ LogInt S1, *src = ((LogInt *) src1) + px; \
+ LogInt S2, *trc = ((LogInt *) src2) + px; \
+ dst += px; \
+ px = x & LOGMASK; \
+ if ((px + dx) >= LOGSIZE) { \
+ if (px) { \
+ S1 = *src++; S2 = *trc++; \
+ D = *dst; \
+ M = BitRight(LOGONES,px); \
+ dx -= (LOGSIZE - px); \
+ *dst++ = D | (M & op); \
+ } \
+ for (px = dx >> LOGSHIFT; px > 0; px--) { \
+ S1 = *src++; S2 = *trc++; \
+ *dst++ = op; \
+ } \
+ if (dx &= LOGMASK) { \
+ S1 = *src; S2 = *trc; \
+ D = *dst; \
+ M = ~BitRight(LOGONES,dx); \
+ *dst = D | (M & op); \
+ } \
+ } else { \
+ S1 = *src; S2 = *trc; \
+ D = *dst; \
+ M = BitRight(LOGONES,px) & ~(BitRight(LOGONES,px+dx)); \
+ *dst = D | (M & op); \
+ } \
+}
+
+#define RakePix(name1, name2, itype, cnst_name, op) \
+static void name1(dst,src1,pvt,dx,x) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ INT32 dx, x; \
+{ \
+ itype *src = ((itype *) src1) + x; \
+ itype con = (itype) pvt->cnst_name; \
+ LogInt M, value; \
+ dst += LOGINDX(x); \
+ if (x & LOGMASK) { \
+ for (value = *dst, M=LOGBIT(x); dx && M; dx--, LOGRIGHT(M)) \
+ if (*src++ op con) \
+ value |= M; \
+ else \
+ value &= ~M; \
+ *dst++ = value; \
+ } \
+ for ( ; dx >= LOGSIZE; dx -= LOGSIZE, *dst++ = value) \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ op con) \
+ value |= M; \
+ if (dx > 0) { \
+ for (value = 0, M=LOGLEFT; dx; dx--, LOGRIGHT(M)) \
+ if (*src++ op con) \
+ value |= M; \
+ *dst = value; \
+ } \
+} \
+static void name2(dst,src1,src2,dx,x) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ INT32 dx, x; \
+{ \
+ itype *src = ((itype *) src1) + x; \
+ itype *trc = ((itype *) src2) + x; \
+ LogInt M, value; \
+ dst += LOGINDX(x); \
+ if (x & LOGMASK) { \
+ for (value = *dst, M=LOGBIT(x); dx && M; dx--, LOGRIGHT(M)) \
+ if (*src++ op *trc++) \
+ value |= M; \
+ else \
+ value &= ~M; \
+ *dst++ = value; \
+ } \
+ for ( ; dx >= LOGSIZE; dx -= LOGSIZE, *dst++ = value) \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ op *trc++) \
+ value |= M; \
+ if (dx > 0) { \
+ for (value = 0, M=LOGLEFT; dx; dx--, LOGRIGHT(M)) \
+ if (*src++ op *trc++) \
+ value |= M; \
+ *dst = value; \
+ } \
+}
+
+/*
+** Consider the following paradigm. It adds a taken branch to
+** each loop, but reduces the amount of total code. This mechanism
+** also relies on the preclearing of the full destination while
+** the above mechanism could be adapted to apply boundary masks,
+** to work more efficiently with nonROI data.
+**
+** for (value = 0, M = x & LOGMASK ; dx ; dx--) {
+** if (*src++ op *trc++) value |= M;
+** if (LOGRIGHT(M)) { *dst++ |= value; value = 0; }
+** }
+*/
+
+RakeBit (rm_bit_lt, rd_bit_lt, (S2 & ~S1) )
+RakeBit (rm_bit_le, rd_bit_le, (S2 | ~S1) )
+RakeBit (rm_bit_eq, rd_bit_eq, (S1 ^ ~S2) )
+RakeBit (rm_bit_ne, rd_bit_ne, (S1 ^ S2) )
+RakeBit (rm_bit_gt, rd_bit_gt, (S1 & ~S2) )
+RakeBit (rm_bit_ge, rd_bit_ge, (S1 | ~S2) )
+
+RakePix (rm_byte_lt, rd_byte_lt, BytePixel, iconst, < )
+RakePix (rm_byte_le, rd_byte_le, BytePixel, iconst, <= )
+RakePix (rm_byte_eq, rd_byte_eq, BytePixel, iconst, == )
+RakePix (rm_byte_ne, rd_byte_ne, BytePixel, iconst, != )
+RakePix (rm_byte_gt, rd_byte_gt, BytePixel, iconst, > )
+RakePix (rm_byte_ge, rd_byte_ge, BytePixel, iconst, >= )
+
+RakePix (rm_pair_lt, rd_pair_lt, PairPixel, iconst, < )
+RakePix (rm_pair_le, rd_pair_le, PairPixel, iconst, <= )
+RakePix (rm_pair_eq, rd_pair_eq, PairPixel, iconst, == )
+RakePix (rm_pair_ne, rd_pair_ne, PairPixel, iconst, != )
+RakePix (rm_pair_gt, rd_pair_gt, PairPixel, iconst, > )
+RakePix (rm_pair_ge, rd_pair_ge, PairPixel, iconst, >= )
+
+RakePix (rm_quad_lt, rd_quad_lt, QuadPixel, iconst, < )
+RakePix (rm_quad_le, rd_quad_le, QuadPixel, iconst, <= )
+RakePix (rm_quad_eq, rd_quad_eq, QuadPixel, iconst, == )
+RakePix (rm_quad_ne, rd_quad_ne, QuadPixel, iconst, != )
+RakePix (rm_quad_ge, rd_quad_ge, QuadPixel, iconst, >= )
+RakePix (rm_quad_gt, rd_quad_gt, QuadPixel, iconst, > )
+
+RakePix (rm_real_lt, rd_real_lt, RealPixel, fconst, < )
+RakePix (rm_real_le, rd_real_le, RealPixel, fconst, <= )
+RakePix (rm_real_eq, rd_real_eq, RealPixel, fconst, == )
+RakePix (rm_real_ne, rd_real_ne, RealPixel, fconst, != )
+RakePix (rm_real_gt, rd_real_gt, RealPixel, fconst, > )
+RakePix (rm_real_ge, rd_real_ge, RealPixel, fconst, >= )
+
+static void (*action_monoROI[5][6])() = {
+ rm_real_lt, rm_real_le, rm_real_eq, rm_real_ne, rm_real_gt, rm_real_ge,
+ rm_bit_lt, rm_bit_le, rm_bit_eq, rm_bit_ne, rm_bit_gt, rm_bit_ge,
+ rm_byte_lt, rm_byte_le, rm_byte_eq, rm_byte_ne, rm_byte_gt, rm_byte_ge,
+ rm_pair_lt, rm_pair_le, rm_pair_eq, rm_pair_ne, rm_pair_gt, rm_pair_ge,
+ rm_quad_lt, rm_quad_le, rm_quad_eq, rm_quad_ne, rm_quad_gt, rm_quad_ge
+};
+static void (*action_dyadROI[5][6])() = {
+ rd_real_lt, rd_real_le, rd_real_eq, rd_real_ne, rd_real_gt, rd_real_ge,
+ rd_bit_lt, rd_bit_le, rd_bit_eq, rd_bit_ne, rd_bit_gt, rd_bit_ge,
+ rd_byte_lt, rd_byte_le, rd_byte_eq, rd_byte_ne, rd_byte_gt, rd_byte_ge,
+ rd_pair_lt, rd_pair_le, rd_pair_eq, rd_pair_ne, rd_pair_gt, rd_pair_ge,
+ rd_quad_lt, rd_quad_le, rd_quad_eq, rd_quad_ne, rd_quad_gt, rd_quad_ge
+};
+
+/*------------------------------------------------------------------------
+---------------- Triple Band Operations (with/without ROI) --------------
+------------------------------------------------------------------------*/
+
+/* mono: (*(pvt->action)) (dvoid, src1, pvt, run, ix); */
+/* dyad: (*(pvt->action)) (dvoid, src1, src2, run, ix); */
+
+#define tb_name1_body() \
+ CARD32 M, D, px = LOGINDX(x); \
+ LogInt S1, *src = ((LogInt *) src1) + px; \
+ LogInt S2 = (pvt->iconst ? LOGONES : LOGZERO); \
+ dst += px; \
+ px = x & LOGMASK; \
+ if ((px + dx) >= LOGSIZE) { \
+ if (px) { \
+ S1 = *src++; \
+ D = *dst; \
+ M = BitRight(LOGONES,px); \
+ dx -= (LOGSIZE - px); \
+ *dst++ = D & ~(M & (S1 ^ S2)); \
+ } \
+ for (px = dx >> LOGSHIFT; px > 0; px--) { \
+ S1 = *src++; \
+ D = *dst; \
+ /* turn off (&~) unequal (^) bits */ \
+ *dst++ = D & ~(S1 ^ S2); \
+ } \
+ if (dx &= LOGMASK) { \
+ S1 = *src; \
+ D = *dst; \
+ M = ~BitRight(LOGONES,dx); \
+ *dst = D & ~(M & (S1 ^ S2)); \
+ } \
+ } else { \
+ S1 = *src; \
+ D = *dst; \
+ M = BitRight(LOGONES,px) & ~(BitRight(LOGONES,px+dx)); \
+ *dst = D & ~(M & (S1 ^ S2)); \
+ }
+/* end of tb_name1_body */
+
+#define tb_name2_body() \
+ CARD32 M, D, px = LOGINDX(x); \
+ LogInt S1, *src = ((LogInt *) src1) + px; \
+ LogInt S2, *trc = ((LogInt *) src2) + px; \
+ dst += px; \
+ px = x & LOGMASK; \
+ if ((px + dx) >= LOGSIZE) { \
+ if (px) { \
+ S1 = *src++; S2 = *trc++; \
+ D = *dst; \
+ M = BitRight(LOGONES,px); \
+ dx -= (LOGSIZE - px); \
+ *dst++ = D & ~(M & (S1 ^ S2)); \
+ } \
+ for (px = dx >> LOGSHIFT; px > 0; px--) { \
+ S1 = *src++; S2 = *trc++; \
+ D = *dst; \
+ *dst++ = D & ~(S1 ^ S2); \
+ } \
+ if (dx &= LOGMASK) { \
+ S1 = *src; S2 = *trc; \
+ D = *dst; \
+ M = ~BitRight(LOGONES,dx); \
+ *dst = D & ~(M & (S1 ^ S2)); \
+ } \
+ } else { \
+ S1 = *src; S2 = *trc; \
+ D = *dst; \
+ M = BitRight(LOGONES,px) & ~(BitRight(LOGONES,px+dx)); \
+ *dst = D & ~(M & (S1 ^ S2)); \
+ }
+/* end of tb_name2_body */
+
+#define TakeBit(name1, name2) \
+static void name1(dst,src1,pvt,dx,x) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ INT32 dx, x; \
+{ \
+tb_name1_body() \
+} \
+static void name2(dst,src1,src2,dx,x) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ INT32 dx, x; \
+{ \
+tb_name2_body() \
+}
+
+#define TakePix(name1, name2, itype, cnst_name) \
+static void name1(dst,src1,pvt,dx,x) \
+ LogInt *dst; \
+ pointer src1; \
+ mpComparePvtPtr pvt; \
+ INT32 dx, x; \
+{ \
+ itype *src = ((itype *) src1) + x; \
+ itype con = (itype) pvt->cnst_name; \
+ LogInt M, value; \
+ dst += LOGINDX(x); \
+ if (x & LOGMASK) { \
+ for (value = 0, M=LOGBIT(x); dx && M; dx--, LOGRIGHT(M)) \
+ if (*src++ != con) \
+ value |= M; \
+ *dst++ &= ~value; \
+ } \
+ for ( ; dx >= LOGSIZE; dx -= LOGSIZE, dst++) { \
+ /* if (!*dst) { src += LOGSIZE; } else */ \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ != con) \
+ value |= M; \
+ *dst &= ~value; \
+ } \
+ if (dx > 0) { \
+ for (value = 0, M=LOGLEFT; dx; dx--, LOGRIGHT(M)) \
+ if (*src++ != con) \
+ value |= M; \
+ *dst &= ~value; \
+ } \
+} \
+static void name2(dst,src1,src2,dx,x) \
+ LogInt *dst; \
+ pointer src1, src2; \
+ INT32 dx, x; \
+{ \
+ itype *src = ((itype *) src1) + x; \
+ itype *trc = ((itype *) src2) + x; \
+ LogInt M, value; \
+ dst += LOGINDX(x); \
+ if (x & LOGMASK) { \
+ for (value = 0, M=LOGBIT(x); dx && M; dx--, LOGRIGHT(M)) \
+ if (*src++ != *trc++) \
+ value |= M; \
+ *dst++ &= ~value; \
+ } \
+ for ( ; dx >= LOGSIZE; dx -= LOGSIZE, dst++) { \
+ /* if (!*dst) { src += LOGSIZE; trc += LOGSIZE; } else */ \
+ for (value = 0, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ if (*src++ != *trc++) \
+ value |= M; \
+ *dst &= ~value; \
+ } \
+ if (dx > 0) { \
+ for (value = 0, M=LOGLEFT; dx; dx--, LOGRIGHT(M)) \
+ if (*src++ != *trc++) \
+ value |= M; \
+ *dst++ &= ~value; \
+ } \
+}
+
+TakeBit (tm_bit, td_bit)
+TakePix (tm_byte, td_byte, BytePixel, iconst)
+TakePix (tm_pair, td_pair, PairPixel, iconst)
+TakePix (tm_quad, td_quad, QuadPixel, iconst)
+TakePix (tm_real, td_real, RealPixel, fconst)
+
+static void (*action_mtrip[5])() =
+ { tm_real, tm_bit, tm_byte, tm_pair, tm_quad };
+
+static void (*action_dtrip[5])() =
+ { td_real, td_bit, td_byte, td_pair, td_quad };
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int InitializeCompare(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ xieFloCompare *raw = (xieFloCompare *) ped->elemRaw;
+ pCompareDefPtr epvt = (pCompareDefPtr) ped->elemPvt;
+ mpComparePvtPtr pvt = (mpComparePvtPtr) pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 nbands = rcp[SRCt1].inFlo->bands;
+ bandPtr sband = &(rcp[SRCt1].band[0]);
+ bandPtr tband = &(rcp[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD8 msk = raw->bandMask;
+ BOOL hasROI = raw->domainPhototag != 0;
+ BOOL doingtriple = raw->combine && (nbands == 3);
+ CARD32 band;
+
+ if (doingtriple) {
+ if (raw->src2)
+ ped->ddVec.activate = ActivateCompareTripleD;
+ else
+ ped->ddVec.activate = ActivateCompareTripleM;
+#if defined(NON_ROI)
+ } else if (!hasROI) {
+ if (raw->src2)
+ ped->ddVec.activate = ActivateCompareD;
+ else
+ ped->ddVec.activate = ActivateCompareM;
+#endif
+ } else {
+ if (raw->src2)
+ ped->ddVec.activate = ActivateCompareDROI;
+ else
+ ped->ddVec.activate = ActivateCompareMROI;
+ }
+ for (band=0; band<nbands; band++, pvt++, sband++, tband++, dband++) {
+ CARD32 iclass = IndexClass(sband->format->class);
+ pvt->width = sband->format->width;
+ pvt->final = FALSE;
+ if (raw->src2 && (pvt->width > tband->format->width))
+ pvt->width = tband->format->width;
+ if (doingtriple) {
+ if (raw->src2)
+ pvt->action = action_dtrip[iclass];
+ else
+ pvt->action = action_mtrip[iclass];
+#if defined(NON_ROI)
+ } else if (!hasROI) {
+ if (raw->src2) {
+ pvt->action = action_dyad[iclass][raw->operator-1];
+ pvt->action2 = (void (*)()) NULL;
+ pvt->endix = dband->format->width; /* pixels to do */
+ if (dband->format->width > tband->format->width) {
+ pvt->action2 = action_clear;
+ pvt->endix = tband->format->width; /* pixels to do */
+ pvt->endrun = dband->format->width -
+ tband->format->width; /* pixels to pad */
+ }
+ } else
+ pvt->action = action_mono[iclass][raw->operator-1];
+#endif
+ } else { /* ROI */
+ if (raw->src2)
+ pvt->action = action_dyadROI[iclass][raw->operator-1];
+ else
+ pvt->action = action_monoROI[iclass][raw->operator-1];
+ }
+ if (!raw->src2) {
+ double dub = epvt->constant[band];
+ pvt->fconst = dub;
+ pvt->iconst = ConstrainConst(dub, sband->format->levels);
+ }
+ }
+
+ /* If processing domain, allow replication */
+ if (hasROI && !doingtriple)
+ rcp[ped->inCnt-1].band[0].replicate = msk;
+
+ InitReceptor(flo, ped, &rcp[SRCt1], NO_DATAMAP, 1, msk, NO_BANDS);
+
+ if (raw->src2)
+ InitReceptor(flo, ped, &rcp[SRCt2], NO_DATAMAP, 1, msk, NO_BANDS);
+
+#if defined(NON_ROI)
+ if (hasROI || doingtriple)
+#endif
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY);
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE);
+
+ pet->bandSync = doingtriple ? SYNC : NO_SYNC;
+
+ return !ferrCode(flo);
+}
+
+
+/* end module mpcomp.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpconv.c b/xc/programs/Xserver/XIE/mixie/process/mpconv.c
new file mode 100644
index 000000000..06906c3e7
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpconv.c
@@ -0,0 +1,477 @@
+/* $TOG: mpconv.c /main/7 1998/02/09 16:21:49 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpconv.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpconv.c -- DDXIE convolve element
+
+ Dean Verheiden && Robert NC Shelley -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpconv.c,v 3.3 1998/10/05 13:22:43 dawes Exp $ */
+
+
+#define _XIEC_MPCONV
+#define _XIEC_PCONV
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <flostr.h>
+#include <texstr.h>
+#include <technq.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeConvolve();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateConvolveConstant();
+static int InitializeConvolveConstant();
+static int ActivateConvolveConstant();
+static int ResetConvolveConstant();
+static int DestroyConvolve();
+
+/*
+ * DDXIE Convolve entry points
+ */
+static ddElemVecRec ConvolveConstantVec = {
+ CreateConvolveConstant,
+ InitializeConvolveConstant,
+ ActivateConvolveConstant,
+ (xieIntProc)NULL,
+ ResetConvolveConstant,
+ DestroyConvolve
+ };
+
+typedef struct _mpconvconst {
+ pointer carray; /* stores constant convolution lines */
+ ConvFloat *sums; /* stores constant * kernel vals */
+ void (*action)(); /* band specific action function */
+ ConvFloat minClip; /* constrained data min clip value */
+ ConvFloat maxClip; /* constrained data max clip value */
+} mpConvConstRec, *mpConvConstPtr;
+
+static void RealConvolveConstant();
+static void QuadConvolveConstant();
+static void PairConvolveConstant();
+static void ByteConvolveConstant();
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeConvolve(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* based on the technique, fill in the appropriate entry point vector
+ */
+ switch(ped->techVec->number) {
+ case xieValConvolveConstant:
+ ped->ddVec = ConvolveConstantVec;
+ break;
+
+ case xieValConvolveReplicate:
+ default:
+ return (FALSE); /* Not implemented in the SI */
+ }
+ return(TRUE);
+} /* end miAnalyzeConvolve */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateConvolveConstant(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* Allocate space for an array of pointers to constant convolution lines */
+ return(MakePETex(flo,
+ ped,
+ sizeof(mpConvConstRec) * ped->inFloLst[SRCtag].bands,
+ SYNC,
+ NO_SYNC));
+} /* end CreateConvolve */
+
+
+#define GenConst(itype) \
+ CARD32 iwidth = bnd->format->width; \
+ itype *cline; \
+ register itype cconst = (itype)*tconst; \
+ register CARD32 i; \
+ if (!(cline = (itype *)XieMalloc(sizeof(itype) * iwidth))) \
+ AllocError(flo,ped,return(FALSE)); \
+ cpvt->carray = (pointer)cline; \
+ for (i = 0; i < iwidth; i++) *cline++ = cconst; \
+ for (i = 0; i < ks2; i++) bnd->dataMap[i] = (CARD8 *)cpvt->carray;
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeConvolveConstant(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloConvolve *raw = (xieFloConvolve *)ped->elemRaw;
+ CARD8 msk = raw->bandMask;
+ INT32 ksize = raw->kernelSize;
+ ConvFloat *tconst = (ConvFloat *)ped->techPvt;
+ ConvFloat *kernel = (ConvFloat *)ped->elemPvt;
+ peTexPtr pet = ped->peTex;
+ mpConvConstPtr cpvt = (mpConvConstPtr)pet->private;
+ receptorPtr rcp = pet->receptor;
+ INT32 b, ks2 = ksize>>1;
+ bandPtr bnd;
+
+ /* If processing domain, allow replication */
+ if (raw->domainPhototag)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ if(!(InitReceptor(flo, ped, &rcp[SRCtag], ksize, ks2+1, msk, ~msk) &&
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY) &&
+ InitEmitter(flo,ped,SRCtag,NO_INPLACE)))
+ return(FALSE);
+
+ /* Create constants for each band */
+ for(b = 0; b < ped->inFloLst[SRCtag].bands; b++, cpvt++, tconst++) {
+ int i, j;
+ ConvFloat *sums;
+
+ if ((msk & (1<<b)) == 0) continue;
+
+ /* Precompute constants for columns falling outside of image */
+ if (!(cpvt->sums = sums =
+ (ConvFloat *)XieMalloc(sizeof(ConvFloat) * ksize)))
+ AllocError(flo,ped,return(FALSE));
+
+ for (i = 0; i < ksize; i++) {
+ sums[i] = 0;
+ if (i == ks2) continue; /* Don't need a middle */
+ for (j = 0; j < ksize; j++)
+ sums[i] += kernel[j * ksize + i] * *tconst;
+ }
+ /* Accumulate totals for multiple columns */
+ for (i = ks2 - 2; i > -1; i--)
+ sums[i] += sums[i+1];
+ for (i = ks2 + 2; i < ksize; i++)
+ sums[i] += sums[i-1];
+
+ bnd = &pet->receptor[SRCtag].band[b];
+ switch (bnd->format->class) {
+ case UNCONSTRAINED:
+ {
+ GenConst(RealPixel);
+ cpvt->action = RealConvolveConstant;
+ cpvt->minClip = 0; /* Unsued for RealPixels */
+ cpvt->maxClip = 0; /* Unused for RealPixels */
+ }
+ break;
+ case QUAD_PIXEL:
+ {
+ GenConst(QuadPixel);
+ cpvt->action = QuadConvolveConstant;
+ cpvt->minClip = 0;
+ cpvt->maxClip = (ConvFloat)bnd->format->levels - 1;
+ }
+ break;
+ case PAIR_PIXEL:
+ {
+ GenConst(PairPixel);
+ cpvt->action = PairConvolveConstant;
+ cpvt->minClip = 0;
+ cpvt->maxClip = (ConvFloat)bnd->format->levels - 1;
+ }
+ break;
+ case BYTE_PIXEL:
+ {
+ GenConst(BytePixel);
+ cpvt->action = ByteConvolveConstant;
+ cpvt->minClip = 0;
+ cpvt->maxClip = (ConvFloat)bnd->format->levels - 1;
+ }
+ break;
+ case BIT_PIXEL: /* SILLY_BITONAL, not supported */
+ default:
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+} /* end InitializeConvolveConstant */
+
+#define ConvConstAction_Body(dtype) \
+ /* Handle the left edge */ \
+ endx = (k2 <= currX + run) ? k2 : currX + run; \
+ for(i = currX; i < endx; i++, currX++, run--){ \
+ ConvFloat count = 0.0; \
+ for(j = 0 ; j < ks; j++) \
+ for(k = -i; k <= k2; k++) \
+ count += br[j][i+k] * kernel[j * ks + k + k2]; \
+ if (*tconst) \
+ count += cpvt->sums[i]; /* Sum of left side pad */ \
+ ClipIt; \
+ *dst++ = (dtype) count; \
+ } \
+ if (run <= 0) return; \
+ /* Handle the middle */ \
+ endx = (w <= currX + run) ? w : currX + run; \
+ for(i = (k2 < currX) ? currX : k2; i < endx; i++,currX++,run--) { \
+ ConvFloat count = 0.0; \
+ for(j = 0 ; j < ks; j++) \
+ for(k = -k2; k <= k2; k++) \
+ count += br[j][i+k] * kernel[j * ks + k + k2]; \
+ ClipIt; \
+ *dst++ = (dtype) count; \
+ } \
+ if (run <= 0) return; \
+ /* Handle the right edge */ \
+ endx = (width <= currX + run) ? width : currX + run; \
+ for(i = currX; i < endx; i++,currX++,run--) { \
+ ConvFloat count = 0.0; \
+ for(j = 0 ; j < ks; j++) \
+ for(k = -k2; k < width - i; k++) \
+ count += br[j][i+k] * kernel[j * ks + k + k2]; \
+ if (*tconst) \
+ count += cpvt->sums[ks - (width - i)]; \
+ ClipIt; \
+ *dst++ = (dtype) count; \
+ } \
+
+#define ConvConstAction(name,dtype) \
+static void name(cpvt,kernel,tconst,run,currX,br,dst,ks,width) \
+mpConvConstPtr cpvt; \
+ConvFloat *kernel, *tconst; \
+INT32 run, currX, ks; \
+dtype *dst, **br; \
+CARD32 width; \
+{ \
+ ConvFloat minClip = cpvt->minClip; \
+ ConvFloat maxClip = cpvt->maxClip; \
+ INT32 k2 = ks/2; \
+ INT32 w = width - k2; \
+ INT32 endx; \
+ int i,j,k; \
+ /* Adjust destination to current location */ \
+ dst += currX; \
+ /* Outside of region, pass these pixels */ \
+ if (run < 0) { \
+ memcpy(dst, &br[k2][currX], -run * sizeof(dtype)); \
+ return; \
+ } \
+ ConvConstAction_Body(dtype); \
+}
+
+
+/* Macro for clipping of constrained data */
+#define ClipIt \
+if (count < minClip) \
+ count = minClip; \
+else if (count > maxClip) \
+ count = maxClip;
+
+ConvConstAction(ByteConvolveConstant,BytePixel)
+ConvConstAction(PairConvolveConstant,PairPixel)
+ConvConstAction(QuadConvolveConstant,QuadPixel)
+#undef ClipIt
+#define ClipIt
+ConvConstAction(RealConvolveConstant,RealPixel)
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateConvolveConstant(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloConvolve *raw = (xieFloConvolve *)ped->elemRaw;
+ mpConvConstPtr cpvt = (mpConvConstPtr)pet->private;
+ bandPtr iband = &pet->receptor[SRCtag].band[0];
+ bandPtr oband = &pet->emitter[0];
+ ConvFloat *tconst = (ConvFloat *)ped->techPvt;
+ ConvFloat *kernel = (ConvFloat *)ped->elemPvt;
+ INT32 ks = raw->kernelSize;
+ INT32 k2 = ks/2;
+ CARD8 bmask = raw->bandMask;
+ int b;
+
+ for(b = 0; b < ped->inFloLst[SRCtag].bands; b++, cpvt++, tconst++, iband++,
+ oband++)
+ if(bmask & 1<<b && pet->scheduled & 1<<b) {
+
+ CARD32 end = iband->format->height - 1 - k2;
+ CARD32 width = oband->format->width;
+ CARD32 sline = iband->current;
+ CARD32 dline = oband->current;
+ CARD32 len = ks;
+ CARD32 map = 0;
+ pointer *br = (pointer *)iband->dataMap;
+ pointer dst;
+ Bool ok;
+
+ while(!ferrCode(flo)) {
+ INT32 run, currX = 0;
+
+ /* do special handling at top and bottom of image */
+ if(dline <= k2) {
+ len = iband->threshold;
+ map = ks - len;
+ sline = 0;
+ if(dline < k2)
+ SetBandThreshold(iband, len + 1);
+ }
+ if(dline > end) {
+ len = iband->threshold - 1;
+ br[len] = (pointer)cpvt->carray;
+ SetBandThreshold(iband, len);
+ }
+
+ ok = MapData(flo,pet,iband,map,sline++,len,TRUE);
+ dst = GetDst(flo,pet,oband,dline++,TRUE);
+
+ if(!ok || !dst || !SyncDomain(flo,ped,oband,FLUSH)) break;
+
+ while (run = GetRun(flo,pet,oband)) {
+ (*cpvt->action)(cpvt,kernel,tconst,run,currX,br,dst,ks,width);
+ currX += (run > 0) ? run : -run;
+ }
+ }
+ FreeData(flo, pet, iband, len ? iband->current : iband->maxGlobal);
+ }
+ return(TRUE);
+} /* end ActivateConvolveConstant */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetConvolveConstant(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpConvConstPtr cpvt = (mpConvConstPtr)ped->peTex->private;
+ int b;
+
+ for(b = 0; b < ped->inFloLst[SRCtag].bands; b++, cpvt++) {
+ if (cpvt->carray) cpvt->carray = (pointer) XieFree(cpvt->carray);
+ if (cpvt->sums) cpvt->sums = (ConvFloat *) XieFree(cpvt->sums);
+ cpvt->action = (void (*)())NULL;
+ cpvt->minClip = 0;
+ cpvt->maxClip = 0;
+ }
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetConvolveConstant */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyConvolve(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyConvolve */
+
+/* end module mpconv.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpctoi.c b/xc/programs/Xserver/XIE/mixie/process/mpctoi.c
new file mode 100644
index 000000000..55761a1c1
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpctoi.c
@@ -0,0 +1,1061 @@
+/* $TOG: mpctoi.c /main/9 1998/02/09 16:21:54 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpctoi.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpctoi.c -- DDXIE ConvertToIndex element
+
+ Robert NC Shelley -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpctoi.c,v 3.3 1998/10/05 13:22:43 dawes Exp $ */
+
+#define _XIEC_MPCTOI
+#define _XIEC_PCTOI
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+#include <scrnintstr.h>
+#include <colormapst.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <colorlst.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <technq.h>
+#include <memory.h>
+
+
+extern int AllocColor(); /* in . . . server/dix/colormap.c */
+
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeCvtToInd();
+
+/* routines used internal to this module
+ */
+static int CreateCtoIAll();
+static int InitializeCtoIAll();
+static int DoGrayCtoIAll();
+static int DoRGB1CtoIAll();
+static int DoRGB3CtoIAll();
+static int DoRGB3CtoIAll();
+static int ResetCtoIAll();
+static int DestroyCtoI();
+
+static int allocDirect();
+static int allocGray1();
+static int allocGray3();
+static int allocRGB1();
+static int allocRGB3();
+static pointer cvt();
+
+
+/* DDXIE ConvertToIndex entry points
+ */
+static ddElemVecRec mpCtoIAllVec = {
+ CreateCtoIAll,
+ InitializeCtoIAll,
+ (xieIntProc)NULL,
+ (xieIntProc)NULL,
+ ResetCtoIAll,
+ DestroyCtoI
+ };
+
+
+/* Local Declarations.
+ */
+#define HASH_POINT 14 /* use hash table if sum of depth exceeds this */
+
+#define HR 19 /* prime hash multipliers (sum also prime) */
+#define HG 23
+#define HB 17
+
+#define NADA (xieVoidProc)NULL
+
+typedef struct _ctihash {
+ CARD32 rgbVal;
+ Pixel pixdex;
+} ctiHashRec, *ctiHashPtr;
+
+
+typedef struct _mpctiall {
+ xieVoidProc action; /* scanline action routine */
+ xieVoidProc action2; /* pass 2 scanline action routine */
+ ColormapPtr cmap; /* colormap-id */
+ int cmapFull; /* == Success until allocs fail */
+ int clindex; /* index of client doing allocs */
+ int (*alloc)(); /* color allocation routine */
+ Pixel *pixLst; /* list of alloc'd pixels */
+ CARD32 pixCnt; /* count of alloc'd pixels (total)*/
+ CARD32 allocMatch; /* count of alloc'd/matched pixels*/
+ CARD32 shareMatch; /* count of shared/matched pixels */
+ CARD32 width; /* image width */
+ CARD32 fill; /* value to use if alloc fails */
+ BOOL hashing; /* true if using hash table */
+ CARD8 trim[xieValMaxBands]; /* # LS bits to trim from pixels */
+ CARD32 mask[xieValMaxBands]; /* mask for keeping useful bits */
+ CARD32 shft[xieValMaxBands]; /* crazy-pixel shift counts */
+ float coef[xieValMaxBands]; /* scale pixel up to 16 bits */
+ CARD32 tmpLen[xieValMaxBands]; /* length of tmpLsts... */
+ pointer tmpLst[xieValMaxBands]; /* lists where we remember stuff */
+ Bool tmpSet; /* initialize tmpLsts to 0 or ~0 */
+ pointer auxbuf[xieValMaxBands]; /* format-class conversion buffers*/
+ CARD8 iclass[xieValMaxBands]; /* input format classes */
+ CARD8 cclass; /* conversion format class */
+} ctiAllRec, *ctiAllPtr;
+
+
+/*****************************************************************************
+ *
+ * Convert to Index alloc-All action routines:
+ * CtoIall_bmctio
+ * |||||`-- output format class (b=bit, B=byte, P=pair, Q=quad)
+ * ||||`--- input format class (b=bit, B=byte, P=pair, Q=quad)
+ * |||`---- L:lookup, H:hash, U:usage map
+ * ||`----- class colormap: d=dynamic, s=static
+ * |`------ 1 or 3 map colormap (blank if it supports both)
+ * `------- 1 or 3 band image
+ */
+static void CtoIall_1_dLBB(), CtoIall_1_dLBP(), CtoIall_1_dLBQ();
+static void CtoIall_1_dLPB(), CtoIall_1_dLPP(), CtoIall_1_dLPQ();
+static void CtoIall_31dLBB(), CtoIall_31dLBP();
+static void CtoIall_31dLPB(), CtoIall_31dLPP();
+static void CtoIall_31dHBB(), CtoIall_31dHBP();
+static void CtoIall_31dHPB(), CtoIall_31dHPP();
+
+static void CtoIall_33dUB_(), CtoIall_33dUP_();
+
+static void CtoIall_33dLBB(), CtoIall_33dLBP(), CtoIall_33dLBQ();
+static void CtoIall_33dLPB(), CtoIall_33dLPP(), CtoIall_33dLPQ();
+
+/* input bits are promoted to bytes, so they share the same action routines
+ */
+#define CtoIall_1_dLbB CtoIall_1_dLBB
+#define CtoIall_1_dLbP CtoIall_1_dLBP
+#define CtoIall_1_dLbQ CtoIall_1_dLBQ
+#define CtoIall_31dLbB CtoIall_31dLBB
+#define CtoIall_31dLbP CtoIall_31dLBP
+#define CtoIall_31dHbB CtoIall_31dHBB
+#define CtoIall_31dHbP CtoIall_31dHBP
+#define CtoIall_33dUb_ CtoIall_33dUB_
+#define CtoIall_33dLbB CtoIall_33dLBB
+#define CtoIall_33dLbP CtoIall_33dLBP
+#define CtoIall_33dLbQ CtoIall_33dLBQ
+
+
+/* single band image, single or triple dynamic colormap, linear lookup tables
+ */
+static void (*gray_action[4][3])() = {
+ NADA, NADA, NADA, /* out=b, in=b..P */
+ CtoIall_1_dLbB, CtoIall_1_dLBB, CtoIall_1_dLPB, /* out=B, in=b..P */
+ CtoIall_1_dLbP, CtoIall_1_dLBP, CtoIall_1_dLPP, /* out=P, in=b..P */
+ CtoIall_1_dLbQ, CtoIall_1_dLBQ, CtoIall_1_dLPQ, /* out=Q, in=b..P */
+};
+
+/* triple band image, single dynamic colormap, linear or hash tables
+ */
+static void (*rgb1_action[2][4][3])() = {
+ NADA, NADA, NADA, /* lut, out=b, in=b..P */
+ CtoIall_31dLbB, CtoIall_31dLBB, CtoIall_31dLPB, /* lut, out=B, in=b..P */
+ CtoIall_31dLbP, CtoIall_31dLBP, CtoIall_31dLPP, /* lut, out=P, in=b..P */
+ NADA, NADA, NADA, /* lut, out=Q, in=b..P */
+ NADA, NADA, NADA, /* hash, out=b, in=b..P */
+ CtoIall_31dHbB, CtoIall_31dHBB, CtoIall_31dHPB, /* hash, out=B, in=b..P */
+ CtoIall_31dHbP, CtoIall_31dHBP, CtoIall_31dHPP, /* hash, out=P, in=b..P */
+ NADA, NADA, NADA, /* hash, out=Q, in=b..P */
+};
+
+/* triple band image, triple dynamic colormap, map usage (Boolean histogram)
+ */
+static void (*rgb3_action_usage[3])() = {
+ CtoIall_33dUb_, CtoIall_33dUB_, CtoIall_33dUP_, /* usage map out, in=b..P */
+};
+
+/* triple band image, triple dynamic colormap, linear lookup tables
+ */
+static void (*rgb3_action_remap[4][3])() = {
+ NADA, NADA, NADA, /* out=b, in=b..P */
+ CtoIall_33dLbB, CtoIall_33dLBB, CtoIall_33dLPB, /* out=B, in=b..P */
+ CtoIall_33dLbP, CtoIall_33dLBP, CtoIall_33dLPP, /* out=P, in=b..P */
+ CtoIall_33dLbQ, CtoIall_33dLBQ, CtoIall_33dLPQ, /* out=Q, in=b..P */
+};
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeCvtToInd(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+
+ /* stash the appropriate entry point vector in the peDef
+ */
+ switch(ped->techVec->number) {
+ case xieValColorAllocAll: ped->ddVec = mpCtoIAllVec; break;
+ case xieValColorAllocMatch:
+ case xieValColorAllocRequantize:
+ default: TechniqueError(flo, ped, xieValColorAlloc,
+ raw->colorAlloc, raw->lenParams, return(FALSE));
+ }
+ return(TRUE);
+} /* end miAnalyzeCvtToInd */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateCtoIAll(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ pCtoIDefPtr dix = (pCtoIDefPtr) ped->elemPvt;
+ Bool band_sync = !dix->graySrc || dix->class != DirectColor;
+
+ return(MakePETex(flo, ped, sizeof(ctiAllRec), NO_SYNC, band_sync));
+} /* end CreateCtoIAll */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeCtoIAll(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ xieTecColorAllocAll *tec = (xieTecColorAllocAll *) &raw[1];
+ pTecCtoIDefPtr pvt = (pTecCtoIDefPtr) ped->techPvt;
+ peTexPtr pet = ped->peTex;
+ formatPtr ift = &ped->inFloLst[SRCtag].format[0];
+ formatPtr oft = &ped->outFlo.format[0];
+ pCtoIDefPtr dix = (pCtoIDefPtr) ped->elemPvt;
+ ctiAllPtr ddx = (ctiAllPtr) pet->private;
+ CARD8 depth, bands = dix->graySrc ? 1 : 3;
+ CARD32 ic = BYTE_PIXEL, oc = oft->class;
+ CARD32 b, size;
+
+ /* init generic color allocation params
+ */
+ ddx->cmap = dix->cmap;
+ ddx->clindex = dix->list->client->index;
+ ddx->fill = pvt->fill;
+ ddx->width = oft->width;
+ ddx->cmapFull = 0;
+ ddx->pixCnt = 0;
+ ddx->allocMatch = 0;
+ ddx->shareMatch = 0;
+ if(!(ddx->pixLst = (Pixel*) XieCalloc((dix->cells + 1) * sizeof(Pixel))))
+ AllocError(flo,ped, return(FALSE));
+
+ /* examine input data format-classes
+ */
+ for(b = 0; b < bands; ++b) {
+ ddx->iclass[b] = ift[b].class;
+ ic = max(ddx->iclass[b],ic);
+ }
+ ddx->cclass = ic;
+ size = (ic == BYTE_PIXEL ? sz_BytePixel : sz_PairPixel) >> 3;
+
+ /* init format-class and pixel to RGB cell conversion parameters
+ */
+ for(b = 0; b < bands; ++b) {
+ if(ift[b].class != ic &&
+ !(ddx->auxbuf[b] = (pointer) XieMalloc((ift->width+7)*size)))
+ AllocError(flo,ped, return(FALSE));
+
+ ddx->trim[b] = ift[b].depth > dix->stride ? ift[b].depth - dix->stride : 0;
+ ddx->mask[b] = (1 << ift[b].depth - ddx->trim[b]) - 1;
+ ddx->coef[b] = 65535.0 / ((ift[b].levels >> ddx->trim[b]) - 1);
+ }
+ /* init stuff specific to the image class and visual class
+ */
+ if(dix->graySrc) {
+ /*
+ * grayscale image, visual class doesn't matter
+ */
+ ddx->tmpSet = TRUE;
+ ddx->tmpLen[0] = (ddx->mask[0] + 1) * sizeof(Pixel);
+ ddx->action = gray_action[oc-1][ic-1];
+ ddx->alloc = (pvt->defTech ? dix->class <= PseudoColor
+ ? allocGray1 : allocGray3 : AllocColor);
+ if(ddx->alloc == allocGray3)
+ ddx->pixLst[dix->cells] = ~0;
+ ped->ddVec.activate = DoGrayCtoIAll;
+
+ } else if(dix->class <= PseudoColor) {
+ /*
+ * RGB image, visual class has a single channel colormap
+ */
+ for(depth = 0, b = 0; b < xieValMaxBands; ++b) {
+ SetDepthFromLevels(ddx->mask[b]+1,size);
+ ddx->shft[b] = depth;
+ depth += size;
+ }
+ /* if we have too many levels, we'll have to use a hash table
+ */
+ if(ddx->hashing = depth > HASH_POINT) {
+ ddx->tmpLen[0] = (HR+HG+HB) * (dix->cells + 1) * sizeof(ctiHashRec);
+ ddx->tmpSet = FALSE;
+ } else {
+ ddx->tmpLen[0] = (1<<depth) * sizeof(Pixel);
+ ddx->tmpSet = TRUE;
+ }
+ bands = 1; /* only 1 colormap band */
+ ddx->action = rgb1_action[ddx->hashing ? 1 : 0][oc-1][ic-1];
+ ddx->alloc = pvt->defTech ? allocRGB1 : AllocColor;
+ ped->ddVec.activate = DoRGB1CtoIAll;
+
+ } else {
+ /*
+ * RGB image, visual class has a three channel colormap
+ */
+ for(b = 0; b < bands; ++b) {
+ SetDepthFromLevels(ddx->mask[b]+1,depth);
+ ddx->tmpLen[b] = (1<<depth) * sizeof(Pixel);
+ }
+ ddx->tmpSet = FALSE;
+ ddx->action = rgb3_action_usage[ic-1];
+ ddx->action2 = rgb3_action_remap[oc-1][ic-1];
+ ddx->alloc = pvt->defTech ? allocRGB3 : AllocColor;
+ ped->ddVec.activate = DoRGB3CtoIAll;
+ }
+ if(!ddx->action) ImplementationError(flo,ped, return(FALSE));
+
+ /* alloc/init whatever temporary storage we need
+ */
+ for(b = 0; b < bands; ++b) {
+ if(!(ddx->tmpLst[b] = (pointer ) XieMalloc(ddx->tmpLen[b])))
+ AllocError(flo,ped, return(FALSE));
+ memset((char*)ddx->tmpLst[b],(char)(ddx->tmpSet ? ~0 : 0),ddx->tmpLen[b]);
+ }
+ return(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE));
+} /* end InitializeCtoIAll */
+
+
+/*------------------------------------------------------------------------
+------------------------- crank some input data --------------------------
+------------------------------------------------------------------------*/
+static int DoGrayCtoIAll(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ ctiAllPtr ddx = (ctiAllPtr) pet->private;
+ bandPtr iband = &pet->receptor[SRCtag].band[0];
+ bandPtr oband = &pet->emitter[0];
+ pointer ivoid, ovoid;
+
+ if(Resumed(flo,pet) &&
+ (flo->runClient->clientGone ||
+ ddx->cmap != (ColormapPtr) LookupIDByType(raw->colormap, RT_COLORMAP)))
+ ColormapError(flo,ped,raw->colormap, return(FALSE));
+
+ if((ivoid = GetCurrentSrc(flo,pet,iband)) &&
+ (ovoid = GetCurrentDst(flo,pet,oband)))
+ do {
+ if(ddx->auxbuf[0]) ivoid = cvt(ivoid, ddx, (CARD8)0);
+
+ (*ddx->action)(ddx, ovoid, ivoid);
+
+ ivoid = GetNextSrc(flo,pet,iband,FLUSH);
+ ovoid = GetNextDst(flo,pet,oband,FLUSH);
+ } while(ivoid && ovoid);
+
+ FreeData(flo,pet,iband,iband->current);
+
+ return(TRUE);
+} /* end DoGrayCtoIAll */
+
+
+/*------------------------------------------------------------------------
+------------------------- crank some input data --------------------------
+------------------------------------------------------------------------*/
+static int DoRGB1CtoIAll(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ ctiAllPtr ddx = (ctiAllPtr) pet->private;
+ bandPtr iband = &pet->receptor[SRCtag].band[0];
+ bandPtr oband = &pet->emitter[0];
+ pointer ovoid, ivoid0, ivoid1, ivoid2;
+
+ if(Resumed(flo,pet) &&
+ (flo->runClient->clientGone ||
+ ddx->cmap != (ColormapPtr) LookupIDByType(raw->colormap, RT_COLORMAP)))
+ ColormapError(flo,ped,raw->colormap, return(FALSE));
+
+ ovoid = GetCurrentDst(flo,pet,oband);
+ ivoid0 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid1 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid2 = GetCurrentSrc(flo,pet,iband); iband -= 2;
+
+ while(ovoid && ivoid0 && ivoid1 && ivoid2) {
+
+ if(ddx->auxbuf[0]) ivoid0 = cvt(ivoid0, ddx, (CARD8)0);
+ if(ddx->auxbuf[1]) ivoid1 = cvt(ivoid1, ddx, (CARD8)1);
+ if(ddx->auxbuf[2]) ivoid2 = cvt(ivoid2, ddx, (CARD8)2);
+
+ (*ddx->action)(ddx, ovoid, ivoid0, ivoid1, ivoid2);
+
+ ovoid = GetNextDst(flo,pet,oband,FLUSH);
+ ivoid0 = GetNextSrc(flo,pet,iband,FLUSH); iband++;
+ ivoid1 = GetNextSrc(flo,pet,iband,FLUSH); iband++;
+ ivoid2 = GetNextSrc(flo,pet,iband,FLUSH); iband -= 2;
+ }
+ FreeData(flo,pet,iband,iband->current); iband++;
+ FreeData(flo,pet,iband,iband->current); iband++;
+ FreeData(flo,pet,iband,iband->current);
+
+ return(TRUE);
+} /* end DoRGB1CtoIAll */
+
+
+/*------------------------------------------------------------------------
+------------------------- crank some input data --------------------------
+------------------------------------------------------------------------*/
+static int DoRGB3CtoIAll(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ bandPtr iband = &pet->receptor[SRCtag].band[0];
+ ctiAllPtr ddx = (ctiAllPtr) pet->private;
+
+ if(ddx->action) {
+ BOOL final = TRUE;
+ pointer ivoid;
+ int b;
+
+ /* PASS 1: generate per-band usage maps of the colors needed
+ */
+ for(b = 0; b < xieValMaxBands; b++, iband++) {
+ for(ivoid = GetCurrentSrc(flo,pet,iband); ivoid;
+ ivoid = GetNextSrc(flo,pet,iband,KEEP)) {
+
+ if(ddx->auxbuf[b]) ivoid = cvt(ivoid, ddx, (CARD8)b);
+
+ (*ddx->action)(ddx, ivoid, b);
+ }
+ /* if we're done with the band, go back to the first scanline, otherwise
+ * increase the threshold to keep the scheduler out of our hair
+ */
+ if(iband->final)
+ iband->current = 0;
+ else {
+ final = FALSE;
+ SetBandThreshold(iband, iband->current + 1);
+ }
+ }
+ /* now that we know what we need, it's time to allocate colors.
+ * we'll continue with PASS 2 when we return from the scheduler
+ */
+ if(final) {
+ ddx->action = (xieVoidProc)NULL;
+ return(allocDirect(flo,ped,pet,ddx));
+ }
+ } else {
+ bandPtr oband = &pet->emitter[0];
+ pointer ovoid, ivoid0, ivoid1, ivoid2;
+
+ /* PASS 2: map src pixesl to allocated colors
+ */
+ ivoid0 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid1 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid2 = GetCurrentSrc(flo,pet,iband); iband -= 2;
+ ovoid = GetCurrentDst(flo,pet,oband);
+
+ while(ovoid && ivoid0 && ivoid1 && ivoid2) {
+
+ if(ddx->auxbuf[0]) ivoid0 = cvt(ivoid0, ddx, (CARD8)0);
+ if(ddx->auxbuf[1]) ivoid1 = cvt(ivoid1, ddx, (CARD8)1);
+ if(ddx->auxbuf[2]) ivoid2 = cvt(ivoid2, ddx, (CARD8)2);
+
+ (*ddx->action2)(ddx, ovoid, ivoid0, ivoid1, ivoid2);
+
+ ivoid0 = GetNextSrc(flo,pet,iband,FLUSH); iband++;
+ ivoid1 = GetNextSrc(flo,pet,iband,FLUSH); iband++;
+ ivoid2 = GetNextSrc(flo,pet,iband,FLUSH); iband -= 2;
+ ovoid = GetNextDst(flo,pet,oband,FLUSH);
+ }
+ FreeData(flo,pet,iband,iband->current); iband++;
+ FreeData(flo,pet,iband,iband->current); iband++;
+ FreeData(flo,pet,iband,iband->current);
+ }
+ return(TRUE);
+} /* end DoRGB3CtoIAll */
+
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetCtoIAll(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ pCtoIDefPtr dix = (pCtoIDefPtr) ped->elemPvt;
+ ctiAllPtr ddx = (ctiAllPtr) ped->peTex->private;
+ colorListPtr lst = dix->list;
+ CARD32 b, i, j;
+ /*
+ * if we've got pixels, they might need to be transfered into the ColorList
+ */
+ if((lst->cellPtr = ddx->pixLst) && (lst->cellCnt = ddx->pixCnt)) {
+
+ if(dix->class <= PseudoColor) {
+ for(i = j = 0; i < ddx->pixCnt; ++j)
+ if(lst->cellPtr[j])
+ lst->cellPtr[i++] = (Pixel)j;
+
+ } else if(dix->graySrc && ddx->alloc == AllocColor) {
+ Pixel p, *ppix = (Pixel*) ddx->tmpLst[0];
+
+ for(i = 0; i < ddx->pixCnt; ++ppix)
+ if((long int)(p = *ppix) >= 0)
+ lst->cellPtr[i++] = p;
+
+ } /* else pixels are already in place */
+ }
+ if(raw->notify && !ferrCode(flo) && !flo->flags.aborted &&
+ (ddx->cmapFull || ddx->allocMatch || ddx->shareMatch))
+ SendColorAllocEvent(flo, ped, lst->mapID, raw->colorAlloc,
+ ddx->pixCnt - ddx->allocMatch + (ddx->cmapFull
+ ? 0 : ddx->shareMatch + ddx->allocMatch << 16));
+
+ for(b = 0; b < xieValMaxBands; ++b) {
+ if(ddx->tmpLst[b]) ddx->tmpLst[b] = (pointer ) XieFree(ddx->tmpLst[b]);
+ if(ddx->auxbuf[b]) ddx->auxbuf[b] = (pointer ) XieFree(ddx->auxbuf[b]);
+ }
+ ddx->pixLst = NULL;
+ ddx->pixCnt = 0;
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetCtoIAll */
+
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyCtoI(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyCtoI */
+
+
+/*------------------------------------------------------------------------
+------------- allocate DirectColors based on usage map -------------------
+------------------------------------------------------------------------*/
+static int allocDirect(flo,ped,pet,ddx)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+ ctiAllPtr ddx;
+{
+ xieFloConvertToIndex *raw = (xieFloConvertToIndex *)ped->elemRaw;
+ pCtoIDefPtr dix = (pCtoIDefPtr) ped->elemPvt;
+ formatPtr fmt = &ped->inFloLst[SRCtag].format[0];
+ unsigned short value[xieValMaxBands];
+ int b, next[xieValMaxBands];
+ Bool final, done[xieValMaxBands];
+ Pixel *pix, *used[xieValMaxBands];
+
+ if(Resumed(flo,pet) &&
+ (flo->runClient->clientGone ||
+ ddx->cmap != (ColormapPtr)LookupIDByType(raw->colormap,RT_COLORMAP)))
+ ColormapError(flo,ped,raw->colormap, return(FALSE));
+
+ /* find the first color needed in each usage map
+ */
+ for(b = 0; b < xieValMaxBands; ++b) {
+ done[b] = FALSE;
+ next[b] = 0;
+ used[b] = (Pixel*)ddx->tmpLst[b];
+ while(!(used[b][next[b]])) ++next[b];
+ }
+ do {
+ /* plant the current round of RGB values
+ */
+ for(b = 0; b < xieValMaxBands; ++b)
+ if(!done[b])
+ value[b] = next[b] * ddx->coef[b];
+
+ /* alloc a triplet of color cells
+ */
+ pix = &ddx->pixLst[ddx->pixCnt];
+
+ if( ddx->cmapFull ||
+ (ddx->cmapFull = (*ddx->alloc)(ddx->cmap,&value[0],&value[1],&value[2],
+ pix,ddx->clindex,ddx)))
+ *pix = ddx->fill;
+ else
+ ddx->cmapFull = ++ddx->pixCnt > dix->cells;
+
+ /* save the result and find the next color needed in each usage map
+ */
+ for(final = TRUE, b = 0; b < xieValMaxBands; ++b)
+ if(!done[b]) {
+ used[b][next[b]] = *pix & dix->mask[b];
+ while(!(done[b] = ++next[b] >= fmt[b].levels >> ddx->trim[b]) &&
+ !(used[b][next[b]]));
+ final &= done[b];
+ }
+ } while(!final);
+
+ return(TRUE);
+}
+
+/*------------------------------------------------------------------------
+------------- allocate closest match for Default Technique ---------------
+------------------------------------------------------------------------*/
+static int allocGray1(cmap, red, grn, blu, pix, client, ddx)
+ ColormapPtr cmap;
+ CARD16 *red, *grn, *blu;
+ Pixel *pix;
+ int client;
+ ctiAllPtr ddx;
+{
+ int status;
+
+ if(status = AllocColor(cmap, red, grn, blu, pix, client)) {
+ xColorItem rgb;
+
+ rgb.pixel = 0;
+ rgb.red = rgb.green = rgb.blue = *red;
+ FakeAllocColor(cmap, &rgb);
+
+ if(!ddx->pixLst[(*pix = rgb.pixel)]++) {
+ xrgb match;
+
+ QueryColors(cmap,1,&rgb.pixel,&match);
+ FakeFreeColor(cmap, rgb.pixel);
+ *red = match.red;
+ *grn = match.green;
+ *blu = match.blue;
+ if(status = AllocColor(cmap, red, grn, blu, pix, client))
+ ddx->pixLst[rgb.pixel] = 0;
+ else
+ ddx->allocMatch++;
+ } else {
+ FakeFreeColor(cmap, rgb.pixel);
+ ++ddx->shareMatch;
+ --ddx->pixCnt;
+ status = 0;
+ }
+ } else {
+ ++ddx->pixLst[*pix];
+ }
+ return(status);
+}
+
+static int allocGray3(cmap, red, grn, blu, pix, client, ddx)
+ ColormapPtr cmap;
+ CARD16 *red, *grn, *blu;
+ Pixel *pix;
+ int client;
+ ctiAllPtr ddx;
+{
+ int status;
+
+ if(ddx->pixLst[ddx->pixCnt]) return(BadAlloc);
+
+ if(status = AllocColor(cmap, red, grn, blu, pix, client)) {
+ xColorItem rgb;
+ xrgb match;
+
+ rgb.pixel = 0;
+ rgb.red = rgb.green = rgb.blue = *red;
+ FakeAllocColor(cmap, &rgb);
+
+ QueryColors(cmap,1,&rgb.pixel,&match);
+ FakeFreeColor(cmap, rgb.pixel);
+ *pix = rgb.pixel;
+ *red = match.red;
+ *grn = match.green;
+ *blu = match.blue;
+ if(!(status = AllocColor(cmap, red, grn, blu, pix, client)))
+ ddx->allocMatch++;
+ }
+ ddx->pixLst[ddx->pixCnt] = *pix;
+ return(status);
+}
+
+static int allocRGB1(cmap, red, grn, blu, pix, client, ddx)
+ ColormapPtr cmap;
+ CARD16 *red, *grn, *blu;
+ Pixel *pix;
+ int client;
+ ctiAllPtr ddx;
+{
+ int status;
+
+ if(status = AllocColor(cmap, red, grn, blu, pix, client)) {
+ xColorItem rgb;
+
+ rgb.pixel = 0;
+ rgb.red = *red;
+ rgb.green = *grn;
+ rgb.blue = *blu;
+ FakeAllocColor(cmap, &rgb);
+
+ if(!ddx->pixLst[(*pix = rgb.pixel)]++) {
+ xrgb match;
+
+ QueryColors(cmap,1,&rgb.pixel,&match);
+ FakeFreeColor(cmap, rgb.pixel);
+ *red = match.red;
+ *grn = match.green;
+ *blu = match.blue;
+ if(status = AllocColor(cmap, red, grn, blu, pix, client))
+ ddx->pixLst[rgb.pixel] = 0;
+ else
+ ddx->allocMatch++;
+ } else {
+ if(!ddx->hashing ||
+ *ddx->tmpLen > ddx->shareMatch * sizeof(ctiHashRec) << 1) {
+ ++ddx->shareMatch;
+ --ddx->pixCnt;
+ status = 0;
+ }
+ FakeFreeColor(cmap, rgb.pixel);
+ }
+ } else {
+ ++ddx->pixLst[*pix];
+ }
+ return(status);
+}
+
+static int allocRGB3(cmap, red, grn, blu, pix, client, ddx)
+ ColormapPtr cmap;
+ CARD16 *red, *grn, *blu;
+ Pixel *pix;
+ int client;
+ ctiAllPtr ddx;
+{
+ int status;
+
+ if(status = AllocColor(cmap, red, grn, blu, pix, client)) {
+ xColorItem rgb;
+ xrgb match;
+
+ rgb.pixel = 0;
+ rgb.red = *red;
+ rgb.green = *grn;
+ rgb.blue = *blu;
+ FakeAllocColor(cmap, &rgb);
+
+ QueryColors(cmap,1,&rgb.pixel,&match);
+ FakeFreeColor(cmap, rgb.pixel);
+ *pix = rgb.pixel;
+ *red = match.red;
+ *grn = match.green;
+ *blu = match.blue;
+ if(!(status = AllocColor(cmap, red, grn, blu, pix, client)))
+ ddx->allocMatch++;
+ }
+ return(status);
+}
+
+/*------------------------------------------------------------------------
+------------- convert bits to bytes or pairs, or bytes to pairs ----------
+------------------------------------------------------------------------*/
+static pointer cvt(src, ddx, band)
+ pointer src;
+ ctiAllPtr ddx;
+ CARD8 band;
+{
+ if(ddx->iclass[band] == BIT_PIXEL) {
+ if(ddx->cclass == BYTE_PIXEL) {
+ bitexpand(src,ddx->auxbuf[band],ddx->width,(BytePixel)0,(BytePixel)1);
+
+ } else /* BIT_PIXEL --> PAIR_PIXEL */ {
+ LogInt *i = (LogInt *) src, ival, M;
+ PairPixel *o = (PairPixel *) ddx->auxbuf[band];
+ int bw = ddx->width, nw = bw >> LOGSHIFT;
+
+ while(nw--)
+ for(ival = *i++, M = LOGLEFT; M; LOGRIGHT(M))
+ *o++ = (ival & M) ? (PairPixel) 1 : (PairPixel) 0;
+ if(bw &= LOGMASK)
+ for(ival = *i, M = LOGLEFT; bw--; LOGRIGHT(M))
+ *o++ = (ival & M) ? (PairPixel) 1 : (PairPixel) 0;
+ }
+ } else /* BYTE_PIXEL --> PAIR_PIXEL */ {
+ CARD32 i, width = ddx->width;
+ BytePixel *ip = (BytePixel*)src;
+ PairPixel *op = (PairPixel*)ddx->auxbuf[band];
+
+ for(i = 0; i < width; *op++ = *ip++, ++i);
+ }
+ return(ddx->auxbuf[band]);
+}
+
+/*------------------------------------------------------------------------
+-- action routines: single band image, single or triple dynamic colormap -
+------------------------------------------------------------------------*/
+#define DO_GRAY_CtoI_ALL(fn_do,itype,otype) \
+static void fn_do(ddx, DST, SRC) \
+ ctiAllPtr ddx; pointer DST,SRC; \
+{ \
+ itype *src = (itype *)SRC; \
+ otype *dst = (otype *)DST; \
+ Pixel px, *pp, *lst = (Pixel *)ddx->tmpLst[0]; \
+ CARD32 w, val, mask = ddx->mask[0], trim = ddx->trim[0]; \
+ CARD16 r, g, b; \
+ for(w = ddx->width; w--; *dst++ = px) { \
+ if((long int)(px = *(pp = &lst[(val = *src++ >> trim & mask)])) < 0) { \
+ if(!ddx->cmapFull) { \
+ r = g = b = (unsigned short)((float)val * ddx->coef[0]); \
+ if(!(ddx->cmapFull = (*ddx->alloc)(ddx->cmap,&r,&g,&b,pp, \
+ ddx->clindex,ddx))) { \
+ ++ddx->pixCnt; \
+ px = *pp; \
+ continue; \
+ } \
+ } \
+ px = ddx->fill; \
+ } \
+ } \
+}
+DO_GRAY_CtoI_ALL(CtoIall_1_dLBB, BytePixel, BytePixel)
+DO_GRAY_CtoI_ALL(CtoIall_1_dLBP, BytePixel, PairPixel)
+DO_GRAY_CtoI_ALL(CtoIall_1_dLBQ, BytePixel, QuadPixel)
+DO_GRAY_CtoI_ALL(CtoIall_1_dLPB, PairPixel, BytePixel)
+DO_GRAY_CtoI_ALL(CtoIall_1_dLPP, PairPixel, PairPixel)
+DO_GRAY_CtoI_ALL(CtoIall_1_dLPQ, PairPixel, QuadPixel)
+
+
+/*------------------------------------------------------------------------
+--- triple band, single dynamic colormap, sum of depths <= HASH_POINT ----
+------------------------------------------------------------------------*/
+#define DO_RGB31L_CtoI_ALL(fn_do,itype,otype) \
+static void fn_do(ddx, DST, SRCR, SRCG, SRCB) \
+ ctiAllPtr ddx; pointer DST,SRCR,SRCG,SRCB; \
+{ \
+ itype *srcR = (itype*)SRCR, *srcG = (itype*)SRCG, *srcB = (itype*)SRCB; \
+ otype *dst = (otype*)DST; \
+ CARD32 Rmask = ddx->mask[0], Rtrim = ddx->trim[0]; \
+ CARD32 Gmask = ddx->mask[1], Gtrim = ddx->trim[1]; \
+ CARD32 Bmask = ddx->mask[2], Btrim = ddx->trim[2]; \
+ CARD32 Gshft = ddx->shft[1], Bshft = ddx->shft[2]; \
+ Pixel px, *pp, *lst = (Pixel*)ddx->tmpLst[0]; \
+ CARD32 rv, gv, bv, w; \
+ CARD16 r, g, b; \
+ for(w = ddx->width; w--; *dst++ = px) { \
+ rv = *srcR++ >> Rtrim & Rmask; \
+ gv = *srcG++ >> Gtrim & Gmask; \
+ bv = *srcB++ >> Btrim & Bmask; \
+ if((long int)(px = *(pp = &lst[rv | gv<<Gshft | bv<<Bshft])) < 0) { \
+ if(!ddx->cmapFull) { \
+ r = (unsigned short)((float)rv * ddx->coef[0]); \
+ g = (unsigned short)((float)gv * ddx->coef[1]); \
+ b = (unsigned short)((float)bv * ddx->coef[2]); \
+ if(!(ddx->cmapFull = (*ddx->alloc)(ddx->cmap,&r,&g,&b,pp, \
+ ddx->clindex,ddx))) { \
+ ++ddx->pixCnt; \
+ px = *pp; \
+ continue; \
+ } \
+ } \
+ px = ddx->fill; \
+ } \
+ } \
+}
+DO_RGB31L_CtoI_ALL(CtoIall_31dLBB,BytePixel,BytePixel)
+DO_RGB31L_CtoI_ALL(CtoIall_31dLBP,BytePixel,PairPixel)
+DO_RGB31L_CtoI_ALL(CtoIall_31dLPB,PairPixel,BytePixel)
+DO_RGB31L_CtoI_ALL(CtoIall_31dLPP,PairPixel,PairPixel)
+
+
+/*------------------------------------------------------------------------
+--- triple band, single dynamic colormap, sum of depths > HASH_POINT -----
+------------------------------------------------------------------------*/
+#define DO_RGB31H_CtoI_ALL(fn_do,itype,otype) \
+static void fn_do(ddx, DST, SRCR, SRCG, SRCB) \
+ ctiAllPtr ddx; pointer DST,SRCR,SRCG,SRCB; \
+{ \
+ itype *srcR = (itype*)SRCR, *srcG = (itype*)SRCG, *srcB = (itype*)SRCB; \
+ otype *dst = (otype*)DST; \
+ CARD32 Rmask = ddx->mask[0], Rtrim = ddx->trim[0]; \
+ CARD32 Gmask = ddx->mask[1], Gtrim = ddx->trim[1]; \
+ CARD32 Bmask = ddx->mask[2], Btrim = ddx->trim[2]; \
+ CARD32 width = ddx->width; \
+ ctiHashPtr hash, list = (ctiHashPtr)ddx->tmpLst[0]; \
+ CARD16 r, g, b; \
+ union{ CARD32 rgbGlob; CARD8 rgbVals[4]; } rgb; \
+ rgb.rgbVals[3] = 1; \
+ while(width--) { \
+ hash = &list[HR * (rgb.rgbVals[0] = *srcR++ >> Rtrim & Rmask) + \
+ HG * (rgb.rgbVals[1] = *srcG++ >> Gtrim & Gmask) + \
+ HB * (rgb.rgbVals[2] = *srcB++ >> Btrim & Bmask)]; \
+ while(hash->rgbVal && hash->rgbVal != rgb.rgbGlob) ++hash; \
+ if(hash->rgbVal) { *dst++ = hash->pixdex; continue; } \
+ if(!ddx->cmapFull) { \
+ r = (unsigned short)((float)rgb.rgbVals[0] * ddx->coef[0]); \
+ g = (unsigned short)((float)rgb.rgbVals[1] * ddx->coef[1]); \
+ b = (unsigned short)((float)rgb.rgbVals[2] * ddx->coef[2]); \
+ if(!(ddx->cmapFull = (*ddx->alloc)(ddx->cmap,&r,&g,&b,&hash->pixdex, \
+ ddx->clindex,ddx))) { \
+ ++ddx->pixCnt; \
+ *dst++ = hash->pixdex; \
+ hash->rgbVal = rgb.rgbGlob; \
+ continue; \
+ } \
+ } \
+ *dst++ = ddx->fill; \
+ } \
+}
+DO_RGB31H_CtoI_ALL(CtoIall_31dHBB,BytePixel,BytePixel)
+DO_RGB31H_CtoI_ALL(CtoIall_31dHBP,BytePixel,PairPixel)
+DO_RGB31H_CtoI_ALL(CtoIall_31dHPB,PairPixel,BytePixel)
+DO_RGB31H_CtoI_ALL(CtoIall_31dHPP,PairPixel,PairPixel)
+
+
+/*------------------------------------------------------------------------
+------------- action routines for triple band, triple colormap -----------
+------------- U? routines generate usage maps of src pixels -----------
+------------- L? routines re-map src pixels thru lookup tables -----------
+------------------------------------------------------------------------*/
+#define DO_RGB33U_CtoI_ALL(fn_do,itype) \
+static void fn_do(ddx, SRC, band) \
+ ctiAllPtr ddx; pointer SRC; CARD8 band; \
+{ \
+ itype *src = (itype *)SRC; \
+ CARD32 mask = ddx->mask[band]; \
+ CARD32 trim = ddx->trim[band]; \
+ Pixel *used = (Pixel*)ddx->tmpLst[band]; \
+ CARD32 w = ddx->width; \
+ while(w--) used[*src++ >> trim & mask] = TRUE; \
+}
+DO_RGB33U_CtoI_ALL(CtoIall_33dUB_, BytePixel)
+DO_RGB33U_CtoI_ALL(CtoIall_33dUP_, PairPixel)
+
+
+#define DO_RGB33L_CtoI_ALL(fn_do,itype,otype) \
+static void fn_do(ddx, DST, SRCR, SRCG, SRCB) \
+ ctiAllPtr ddx; pointer DST,SRCR,SRCG,SRCB; \
+{ \
+ itype *srcR = (itype *)SRCR; \
+ itype *srcG = (itype *)SRCG; \
+ itype *srcB = (itype *)SRCB; \
+ otype *dst = (otype *)DST; \
+ CARD32 Rmask = ddx->mask[0], Rtrim = ddx->trim[0]; \
+ CARD32 Gmask = ddx->mask[1], Gtrim = ddx->trim[1]; \
+ CARD32 Bmask = ddx->mask[2], Btrim = ddx->trim[2]; \
+ Pixel *Rlut = (Pixel*)ddx->tmpLst[0]; \
+ Pixel *Glut = (Pixel*)ddx->tmpLst[1]; \
+ Pixel *Blut = (Pixel*)ddx->tmpLst[2]; \
+ CARD32 w = ddx->width; \
+ while(w--) *dst++ = (Rlut[*srcR++ >> Rtrim & Rmask] | \
+ Glut[*srcG++ >> Gtrim & Gmask] | \
+ Blut[*srcB++ >> Btrim & Bmask]); \
+}
+DO_RGB33L_CtoI_ALL(CtoIall_33dLBB, BytePixel, BytePixel)
+DO_RGB33L_CtoI_ALL(CtoIall_33dLBP, BytePixel, PairPixel)
+DO_RGB33L_CtoI_ALL(CtoIall_33dLBQ, BytePixel, QuadPixel)
+DO_RGB33L_CtoI_ALL(CtoIall_33dLPB, PairPixel, BytePixel)
+DO_RGB33L_CtoI_ALL(CtoIall_33dLPP, PairPixel, PairPixel)
+DO_RGB33L_CtoI_ALL(CtoIall_33dLPQ, PairPixel, QuadPixel)
+
+/* end module mpctoi.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpdither.c b/xc/programs/Xserver/XIE/mixie/process/mpdither.c
new file mode 100644
index 000000000..e3a174d16
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpdither.c
@@ -0,0 +1,914 @@
+/* $TOG: mpdither.c /main/7 1998/02/09 16:21:59 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpdither.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpdither.c -- DDXIE dither element
+
+ Larry Hare -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpdither.c,v 3.3 1998/10/05 13:22:44 dawes Exp $ */
+
+
+#define _XIEC_MPDITHER
+#define _XIEC_PDITHER
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <technq.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeDither();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateDitherErrorDiffusion(), CreateDitherOrdered();
+static int InitializeDitherErrorDiffusion(), InitializeDitherOrdered();
+static int ActivateDitherErrorDiffusion(), ActivateDitherOrdered();
+static int ResetDitherErrorDiffusion(), ResetDitherOrdered();
+static int DestroyDither();
+
+
+typedef float DitherFloat; /* see xiemd.h */
+
+ /* Diffusion Dither Locals */
+typedef struct _mpditherEDdef {
+ void (*action) ();
+ DitherFloat *previous;
+ DitherFloat *current;
+ DitherFloat range;
+ DitherFloat range1over;
+ DitherFloat round;
+ INT32 width;
+#if defined(SF_DITHER)
+ CARD32 shift;
+ INT32 irange;
+ INT32 iround;
+#endif
+} mpDitherEDDefRec, *mpDitherEDDefPtr;
+
+static void EdDitherQb(), EdDitherPb(), EdDitherBb(), EdDitherbb();
+static void EdDitherQB(), EdDitherPB(), EdDitherBB();
+static void EdDitherQP(), EdDitherPP();
+static void EdDitherQQ();
+
+ /* Ordered Dither Locals */
+typedef struct _mpditherOrddef {
+ void (*action) ();
+ CARD32 *matrix;
+ CARD32 ncol;
+ CARD32 nrow;
+ CARD32 shift;
+ CARD32 mult;
+ CARD32 width;
+} mpDitherOrdDefRec, *mpDitherOrdDefPtr;
+
+static Bool SetupOrderMatrix();
+
+static void OrdDitherQb(), OrdDitherPb(), OrdDitherBb();
+static void OrdDitherQB(), OrdDitherPB(), OrdDitherBB();
+static void OrdDitherQP(), OrdDitherPP();
+static void OrdDitherQQ();
+
+
+
+/*
+ * DDXIE Dither entry points
+ */
+/* static Testing Hack. See mpcnst.c */
+ddElemVecRec DitherErrorDiffusion = {
+ CreateDitherErrorDiffusion,
+ InitializeDitherErrorDiffusion,
+ ActivateDitherErrorDiffusion,
+ (xieIntProc)NULL,
+ ResetDitherErrorDiffusion,
+ DestroyDither
+};
+
+static ddElemVecRec DitherOrdered = {
+ CreateDitherOrdered,
+ InitializeDitherOrdered,
+ ActivateDitherOrdered,
+ (xieIntProc)NULL,
+ ResetDitherOrdered,
+ DestroyDither
+};
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeDither(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+ switch(ped->techVec->number) {
+ case xieValDitherErrorDiffusion:
+ ped->ddVec = DitherErrorDiffusion;
+ break;
+ case xieValDitherOrdered:
+ ped->ddVec = DitherOrdered;
+ break;
+ }
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateDitherErrorDiffusion(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpDitherEDDefRec);
+
+ return MakePETex(flo,ped,auxsize,NO_SYNC,NO_SYNC);
+}
+
+static int CreateDitherOrdered(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpDitherOrdDefRec);
+
+ return MakePETex(flo,ped,auxsize,NO_SYNC,NO_SYNC);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeDitherErrorDiffusion(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ mpDitherEDDefPtr pvt = (mpDitherEDDefPtr) (pet->private);
+ bandMsk bmask = ((xieFloDither *) (ped->elemRaw))->bandMask;
+ bandPtr oband;
+ bandPtr iband;
+ int band, nbands;
+ void (*action) () = (void (*)()) 0;
+
+ oband = &(pet->emitter[0]);
+ iband = &(pet->receptor[SRCtag].band[0]);
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ for (band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+
+ if ((bmask & (1<<band)) == 0) continue;
+
+ switch (oband->format->class) {
+ case QUAD_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = EdDitherQQ; break;
+ default: break;
+ }
+ break;
+ case PAIR_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = EdDitherQP; break;
+ case PAIR_PIXEL: action = EdDitherPP; break;
+ default: break;
+ }
+ break;
+ case BYTE_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = EdDitherQB; break;
+ case PAIR_PIXEL: action = EdDitherPB; break;
+ case BYTE_PIXEL: action = EdDitherBB; break;
+ default: break;
+ }
+ break;
+ case BIT_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = EdDitherQb; break;
+ case PAIR_PIXEL: action = EdDitherPb; break;
+ case BYTE_PIXEL: action = EdDitherBb; break;
+ case BIT_PIXEL: action = EdDitherbb; break;
+ default: break;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!action)
+ ImplementationError(flo, ped, return(FALSE));
+
+ pvt->action = action;
+ pvt->width = iband->format->width;
+ pvt->range = (iband->format->levels-1.0)/(oband->format->levels-1.0);
+ pvt->round = pvt->range/((DitherFloat)2.0);
+ pvt->range1over = ((DitherFloat) 1.0) / pvt->range;
+
+ if(pvt->range == 1.0) {
+ bmask &= ~(1<<band);
+ continue;
+ }
+#if defined(SF_DITHER)
+ pvt->shift = (iband->format->class == PAIR_PIXEL ? 11 : 19);
+ pvt->irange = pvt->range * (1<<pvt->shift);
+ pvt->iround = pvt->round * (1<<pvt->shift);
+#endif
+
+ if (ped->techVec->number == xieValDitherErrorDiffusion) {
+ /* Use XieCalloc to force DitherFloat's to 0.0 */
+ int auxsize = (pvt->width + 2) * sizeof(DitherFloat);
+ if((!(pvt->previous = (DitherFloat *) XieCalloc(auxsize))) ||
+ (!(pvt->current = (DitherFloat *) XieCalloc(auxsize))))
+ AllocError(flo, ped, return(FALSE));
+ }
+ }
+ return
+ InitReceptor(flo,ped,&pet->receptor[SRCtag],NO_DATAMAP,1,bmask,~bmask)
+ && InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+
+}
+
+static int InitializeDitherOrdered(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ mpDitherOrdDefPtr pvt = (mpDitherOrdDefPtr) pet->private;
+ xieFloDither *elem = (xieFloDither *) (ped->elemRaw);
+ CARD8 thresh = ((xieTecDitherOrdered *) (&elem[1]))->thresholdOrder;
+ bandMsk bmask = elem->bandMask;
+ bandPtr oband;
+ bandPtr iband;
+ int band, nbands;
+ void (*action) () = (void(*)()) 0;
+
+ oband = &(pet->emitter[0]);
+ iband = &(pet->receptor[SRCtag].band[0]);
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ for (band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+
+ if ((bmask & (1<<band)) == 0) continue;
+
+ switch (oband->format->class) {
+ case QUAD_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = OrdDitherQQ; break;
+ default: break;
+ }
+ break;
+ case PAIR_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = OrdDitherQP; break;
+ case PAIR_PIXEL: action = OrdDitherPP; break;
+ default: break;
+ }
+ break;
+ case BYTE_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = OrdDitherQB; break;
+ case PAIR_PIXEL: action = OrdDitherPB; break;
+ case BYTE_PIXEL: action = OrdDitherBB; break;
+ default: break;
+ }
+ break;
+ case BIT_PIXEL:
+ switch (iband->format->class) {
+ case QUAD_PIXEL: action = OrdDitherQb; break;
+ case PAIR_PIXEL: action = OrdDitherPb; break;
+ case BYTE_PIXEL: action = OrdDitherBb; break;
+ default: break;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!action)
+ ImplementationError(flo, ped, return(FALSE));
+
+ pvt->action = action;
+ pvt->width = iband->format->width;
+
+ switch (iband->format->class) {
+ case QUAD_PIXEL: pvt->shift=6; break;
+ case PAIR_PIXEL: pvt->shift=14; break;
+ case BYTE_PIXEL: pvt->shift=22; break;
+ }
+ pvt->mult = ((1<<pvt->shift) * (oband->format->levels-1.0)) /
+ (iband->format->levels-1.0);
+
+ if(pvt->mult == (1<<pvt->shift)) {
+ bmask &= ~(1<<band);
+ continue;
+ }
+
+ (void) SetupOrderMatrix(pvt, (CARD32) thresh);
+
+ if (!pvt->matrix)
+ AllocError(flo, ped, return(FALSE));
+ }
+ return
+ InitReceptor(flo,ped,&pet->receptor[SRCtag],NO_DATAMAP,1,bmask,~bmask)
+ && InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE);
+
+}
+
+
+static CARD8 ddmtrx1[] = { 1, 0, 1, 0,
+ 0, 1, 0, 1,
+ 1, 0, 1, 0,
+ 0, 1, 0, 1
+ };
+
+static CARD8 ddmtrx2[] = { 1, 2, 1, 2,
+ 3, 0, 3, 0,
+ 1, 2, 1, 2,
+ 3, 0, 3, 0
+ };
+
+static CARD8 ddmtrx3[] = { 1, 6, 0, 7,
+ 5, 3, 4, 2,
+ 0, 7, 1, 6,
+ 4, 2, 5, 3
+ };
+
+static CARD8 ddmtrx4[] = { 1, 15, 2, 12,
+ 9, 5, 10, 6,
+ 3, 13, 0, 14,
+ 11, 7, 8, 4
+ };
+
+static CARD8 ddmtrx5[] = { 1, 28, 6, 26, 0, 29, 7, 27,
+ 17, 9, 22, 14, 16, 8, 23, 15,
+ 5, 25, 3, 30, 4, 24, 2, 31,
+ 21, 13, 19, 11, 20, 12, 18, 10,
+ };
+
+static CARD8 ddmtrx6[] = { 1, 59, 15, 55, 2, 56, 12, 52,
+ 33, 17, 47, 31, 34, 18, 44, 28,
+ 9, 49, 5, 63, 10, 50, 6, 60,
+ 41, 25, 37, 21, 42, 26, 38, 22,
+ 3, 57, 13, 53, 0, 58, 14, 54,
+ 35, 19, 45, 29, 32, 16, 46, 30,
+ 11, 51, 7, 61, 8, 48, 4, 62,
+ 43, 27, 39, 23, 40, 24, 36, 20
+ };
+
+static CARD8 ddmtrx7[] = {
+ 1, 116, 28, 108, 6, 114, 26, 106, 0, 117, 29, 109, 7, 115, 27, 107,
+ 65, 33, 92, 60, 70, 38, 90, 58, 64, 32, 93, 61, 71, 39, 91, 59,
+ 17, 97, 9, 124, 22, 102, 14, 122, 16, 96, 8, 125, 23, 103, 15, 123,
+ 81, 49, 73, 41, 86, 54, 78, 46, 80, 48, 72, 40, 87, 55, 79, 47,
+ 5, 113, 25, 105, 3, 118, 30, 110, 4, 112, 24, 104, 2, 119, 31, 111,
+ 69, 37, 89, 57, 67, 35, 94, 62, 68, 36, 88, 56, 66, 34, 95, 63,
+ 21, 101, 13, 121, 19, 99, 11, 126, 20, 100, 12, 120, 18, 98, 10, 127,
+ 85, 53, 77, 45, 83, 51, 75, 43, 84, 52, 76, 44, 82, 50, 74, 42,
+};
+
+static CARD8 ddmtrx8[] = {
+ 1, 235, 49, 219, 15, 231, 55, 215, 2, 232, 56, 216, 12, 228, 52, 212,
+129, 65, 187, 123, 143, 79, 183, 119, 130, 66, 184, 120, 140, 76, 180, 116,
+ 33, 193, 17, 251, 47, 207, 31, 247, 34, 194, 18, 248, 44, 204, 28, 244,
+161, 97, 145, 81, 175, 111, 159, 95, 162, 98, 146, 82, 172, 108, 156, 92,
+ 9, 225, 49, 209, 5, 239, 63, 223, 10, 226, 50, 210, 6, 236, 60, 220,
+137, 73, 177, 113, 133, 69, 191, 127, 138, 74, 178, 114, 134, 70, 188, 124,
+ 41, 201, 25, 241, 37, 197, 21, 255, 42, 202, 26, 242, 38, 198, 22, 252,
+169, 105, 153, 89, 165, 101, 149, 85, 170, 106, 154, 90, 166, 102, 150, 86,
+ 3, 233, 57, 217, 13, 229, 53, 213, 0, 234, 58, 218, 14, 230, 54, 214,
+131, 67, 185, 121, 141, 77, 181, 117, 128, 64, 186, 122, 142, 78, 182, 118,
+ 35, 195, 19, 249, 45, 205, 29, 245, 32, 192, 16, 250, 46, 206, 30, 246,
+163, 99, 147, 83, 173, 109, 157, 93, 160, 96, 144, 80, 174, 110, 158, 94,
+ 11, 227, 51, 211, 7, 237, 61, 221, 8, 224, 48, 208, 4, 238, 62, 222,
+139, 75, 179, 115, 135, 71, 189, 127, 136, 72, 176, 112, 132, 68, 190, 126,
+ 43, 203, 27, 243, 39, 199, 23, 253, 40, 200, 24, 240, 36, 196, 20, 254,
+171, 107, 155, 91, 167, 103, 151, 87, 168, 104, 152, 88, 164, 100, 148, 84
+};
+
+
+
+static Bool
+SetupOrderMatrix(pvt, threshold)
+ mpDitherOrdDefPtr pvt;
+ CARD32 threshold;
+{
+ CARD32 shift = 1 << pvt->shift;
+ CARD32 *mtrx;
+ CARD8 *srcmtrx;
+ CARD32 nr, nc, nt;
+ INT32 m;
+
+ switch(threshold) {
+ case 1: srcmtrx = ddmtrx1; nr = 4; nc = 4; nt = 2; break;
+ case 2: srcmtrx = ddmtrx2; nr = 4; nc = 4; nt = 4; break;
+ case 3: srcmtrx = ddmtrx3; nr = 4; nc = 4; nt = 8; break;
+ case 4: srcmtrx = ddmtrx4; nr = 4; nc = 4; nt = 16; break;
+ case 5: srcmtrx = ddmtrx5; nr = 4; nc = 8; nt = 32; break;
+ case 6: srcmtrx = ddmtrx6; nr = 8; nc = 8; nt = 64; break;
+ case 7: srcmtrx = ddmtrx7; nr = 8; nc =16; nt = 128; break;
+ default:
+ case 8: srcmtrx = ddmtrx8; nr =16; nc =16; nt = 256; break;
+ }
+
+ if (!(mtrx = (CARD32 *)XieMalloc(nr * nc * sizeof(CARD32))))
+ return FALSE;
+
+ for (m = nr * nc -1; m >= 0 ; m--)
+ mtrx[m] = ((CARD32)srcmtrx[m] * shift + (shift>>1)) / nt;
+
+ /*
+ ** This would be a good place to spin the matrix to avoid
+ ** aligning the dither pattern on triple band images.
+ */
+
+ pvt->ncol = nc;
+ pvt->nrow = nr;
+ pvt->matrix = mtrx;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+
+static int ActivateDitherErrorDiffusion(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpDitherEDDefPtr pvt = (mpDitherEDDefPtr) pet->private;
+ bandPtr oband = &(pet->emitter[0]);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+ register pointer inp, outp;
+
+ if (!(inp = GetCurrentSrc(flo,pet,iband)) ||
+ !(outp = GetCurrentDst(flo,pet,oband))) continue;
+
+ do {
+ (*(pvt->action)) (inp, outp, pvt);
+
+ { /* Swap error buffers */
+ DitherFloat *curr = pvt->current;
+ curr = pvt->current;
+ pvt->current = pvt->previous;
+ pvt->previous = curr;
+ }
+ inp = GetNextSrc(flo,pet,iband,FLUSH);
+ outp = GetNextDst(flo,pet,oband,FLUSH);
+
+ } while (inp && outp) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+static int ActivateDitherOrdered(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpDitherOrdDefPtr pvt = (mpDitherOrdDefPtr) pet->private;
+ bandPtr oband = &(pet->emitter[0]);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+ register pointer inp, outp;
+
+ if (!(inp = GetCurrentSrc(flo,pet,iband)) ||
+ !(outp = GetCurrentDst(flo,pet,oband))) continue;
+
+ do {
+ (*(pvt->action)) (inp, outp, pvt, oband->current);
+
+ inp = GetNextSrc(flo,pet,iband,FLUSH);
+ outp = GetNextDst(flo,pet,oband,FLUSH);
+
+ } while (inp && outp) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetDitherErrorDiffusion(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpDitherEDDefPtr pvt = (mpDitherEDDefPtr) ped->peTex->private;
+ int band;
+
+ /* free any dynamic private data */
+ for (band = 0 ; band < xieValMaxBands ; band++, pvt++) {
+ pvt->width = 0;
+ pvt->action = 0;
+ if (pvt->previous)
+ pvt->previous = (DitherFloat *) XieFree(pvt->previous);
+ if (pvt->current)
+ pvt->current = (DitherFloat *) XieFree(pvt->current);
+ }
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+static int ResetDitherOrdered(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpDitherOrdDefPtr pvt = (mpDitherOrdDefPtr) ped->peTex->private;
+ int band;
+
+ /* free any dynamic private data */
+ for (band = 0 ; band < xieValMaxBands ; band++, pvt++) {
+ pvt->width = 0;
+ pvt->action = 0;
+ if (pvt->matrix)
+ pvt->matrix = (CARD32 *) XieFree(pvt->matrix);
+ }
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyDither(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------------- Macro Mania ------------------------------
+------------------------------------------------------------------------*/
+
+/*
+** The only legal bit to bit dither is 2 levels to 1 level.
+*/
+
+static void EdDitherbb(inp,outp,pvt)
+ pointer inp; pointer outp; mpDitherEDDefPtr pvt;
+{
+ bzero((char *)outp, (pvt->width+7)>>3);
+}
+
+/*
+** Quads, Pairs, and Bytes can be dithered to bits. Since this code is
+** so slow anyway, don't get too excited about optimizing the bit output.
+*/
+
+#define MakeEdBit(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt) \
+ pointer INP; pointer OUTP; mpDitherEDDefPtr pvt; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register LogInt *outp = (LogInt *) OUTP; \
+ register unsigned int actual; \
+ register DitherFloat range = pvt->range; \
+ register DitherFloat round = pvt->round; \
+ register DitherFloat *prev = pvt->previous; \
+ register DitherFloat *curr = pvt->current; \
+ register DitherFloat range1over = pvt->range1over; \
+ register DitherFloat current = *curr, desire; \
+ register int ix, bw = pvt->width; \
+ bzero((char *)outp, (bw+7)>>3); \
+ for (ix = 0; ix < bw; ix++) { \
+ desire = inp[ix] + ((DitherFloat) .4375 * current) + \
+ ((DitherFloat) .0625 * *(prev+0)) + \
+ ((DitherFloat) .3125 * *(prev+1)) + \
+ ((DitherFloat) .1875 * *(prev+2)) ; \
+ prev++; \
+ actual = (desire+round)*range1over; \
+ if (actual) { \
+ LOG_setbit(outp,ix); \
+ *++curr = current = desire - actual*range; \
+ } else \
+ *++curr = current = desire; \
+ } \
+}
+
+#if defined(SF_DITHER)
+#define MakeEdBitI(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt) \
+ pointer INP; pointer OUTP; mpDitherEDDefPtr pvt; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register LogInt *outp = (LogInt *) OUTP; \
+ register unsigned int actual; \
+ register CARD32 shift = pvt->shift; \
+ register INT32 range = pvt->irange; \
+ register INT32 round = pvt->iround; \
+ register INT32 *prev = (INT32 *) pvt->previous; \
+ register INT32 *curr = (INT32 *) pvt->current; \
+ register INT32 current = *curr, desire; \
+ register int ix, bw = pvt->width; \
+ bzero((char *)outp, (bw+7)>>3); \
+ for (ix = 0; ix < bw; ix++) { \
+ desire = (((CARD32) inp[ix]) << shift) + \
+ ((( current * 7) + \
+ (*(prev+0) ) + \
+ (*(prev+1) * 5) + \
+ (*(prev+2) * 3) ) >> 4) ; \
+ prev++; \
+ actual = (desire+round)/range; \
+ if (actual) { \
+ LOG_setbit(outp,ix); \
+ *++curr = current = desire - actual*range; \
+ } else \
+ *++curr = current = desire; \
+ } \
+}
+#endif
+
+/*
+** All the other multitudes of combinations.
+*/
+
+#define MakeEdPix(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt) \
+ pointer INP; pointer OUTP; mpDitherEDDefPtr pvt; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register otype *outp = (otype *) OUTP, actual; \
+ register DitherFloat range = pvt->range; \
+ register DitherFloat round = pvt->round; \
+ register DitherFloat *prev = pvt->previous; \
+ register DitherFloat *curr = pvt->current; \
+ register DitherFloat current = *curr, desire; \
+ register DitherFloat range1over = pvt->range1over; \
+ register int ix, bw = pvt->width; \
+ for (ix = 0; ix < bw; ix++) { \
+ desire = inp[ix] + ((DitherFloat) .4375 * current) + \
+ ((DitherFloat) .0625 * *(prev+0)) + \
+ ((DitherFloat) .3125 * *(prev+1)) + \
+ ((DitherFloat) .1875 * *(prev+2)) ; \
+ prev++; \
+ *outp++ = actual = (desire+round)*range1over; \
+ *++curr = current = (desire - actual*range); \
+ } \
+}
+
+#if defined(SF_DITHER)
+ /* NOTE: has <<, /, then * which means many cycles.
+ ** A better design would use a *, >>, *. The last * might
+ ** be a <<, and the first * on mips would pipeline with the
+ ** *(prev+N) calculations. This should double or triple the
+ ** speed for many of these architectures.
+ */
+#define MakeEdPixI(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt) \
+ pointer INP; pointer OUTP; mpDitherEDDefPtr pvt; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register otype *outp = (otype *) OUTP; \
+ register CARD32 actual; \
+ register CARD32 shift = pvt->shift; \
+ /* ?? replace divide by range with multiply and >> ?? */ \
+ register INT32 range = pvt->irange; \
+ register INT32 round = pvt->iround; \
+ register INT32 *prev = (INT32 *) pvt->previous; \
+ register INT32 *curr = (INT32 *) pvt->current; \
+ register INT32 current = *curr, desire; \
+ register int ix, bw = pvt->width; \
+ for (ix = 0; ix < bw; ix++) { \
+ desire = (((CARD32)inp[ix]) << shift) + \
+ (((current * 7) + \
+ (*(prev+0) ) + \
+ (*(prev+1) * 5) + \
+ (*(prev+2) * 3) ) >> 4) ; \
+ prev++; \
+ *outp++ = actual = (desire+round)/range; \
+ *++curr = current = desire - actual * range; \
+ } \
+}
+#endif
+
+#if defined(SF_DITHER)
+
+MakeEdBit (EdDitherQb,QuadPixel,BitPixel)
+MakeEdBitI (EdDitherPb,PairPixel,BitPixel)
+MakeEdBitI (EdDitherBb,BytePixel,BitPixel)
+MakeEdPix (EdDitherQB,QuadPixel,BytePixel)
+MakeEdPixI (EdDitherPB,PairPixel,BytePixel)
+MakeEdPixI (EdDitherBB,BytePixel,BytePixel)
+MakeEdPix (EdDitherQP,QuadPixel,PairPixel)
+MakeEdPixI (EdDitherPP,PairPixel,PairPixel)
+MakeEdPix (EdDitherQQ,QuadPixel,QuadPixel)
+
+#else
+MakeEdBit (EdDitherQb,QuadPixel,BitPixel)
+MakeEdBit (EdDitherPb,PairPixel,BitPixel)
+MakeEdBit (EdDitherBb,BytePixel,BitPixel)
+
+MakeEdPix (EdDitherQB,QuadPixel,BytePixel)
+MakeEdPix (EdDitherPB,PairPixel,BytePixel)
+MakeEdPix (EdDitherBB,BytePixel,BytePixel)
+
+MakeEdPix (EdDitherQP,QuadPixel,PairPixel)
+MakeEdPix (EdDitherPP,PairPixel,PairPixel)
+
+MakeEdPix (EdDitherQQ,QuadPixel,QuadPixel)
+
+#endif
+
+/*------------------------------------------------------------------------
+------------------------------- Macro Mania ------------------------------
+------------------------------------------------------------------------*/
+
+
+#define MakeOrdBit(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt,ycur) \
+ pointer INP; pointer OUTP; mpDitherOrdDefPtr pvt; int ycur; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register LogInt *outp = (LogInt *) OUTP; \
+ register CARD32 mult = pvt->mult; \
+ register CARD32 shift = pvt->shift; \
+ register CARD32 ncol = pvt->ncol; \
+ register CARD32 *mtrx; \
+ register CARD32 jcol, nw; \
+ register LogInt outval, M; \
+ register int bw = pvt->width; \
+ CARD32 nrow = pvt->nrow; \
+ mtrx = pvt->matrix + ((ycur & (nrow-1)) * ncol); \
+ jcol = ((ncol > nrow) && (ycur & nrow)) ? nrow : 0; \
+ for (ncol--, nw = (bw >> LOGSHIFT); nw > 0; nw--) { \
+ for (M=LOGLEFT, outval = 0; M ; LOGRIGHT(M)) { \
+ register CARD32 value1, value2; \
+ value1 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ value2 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ if (value1) outval |= M; \
+ value1 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ LOGRIGHT(M); if (value2) outval |= M; \
+ value2 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ LOGRIGHT(M); if (value1) outval |= M; \
+ jcol &= ncol; \
+ LOGRIGHT(M); if (value2) outval |= M; \
+ } \
+ *outp++ = outval; \
+ } \
+ if ((nw = (bw & LOGMASK))) { \
+ for (M=LOGLEFT, outval = 0; nw ; nw--, LOGRIGHT(M)) { \
+ if ((mtrx[jcol++] + *inp++ * mult) >> shift) \
+ outval |= M; \
+ jcol &= ncol; \
+ } \
+ *outp = outval; \
+ } \
+}
+
+#define MakeOrdPix(fn_name,itype,otype) \
+static void fn_name(INP,OUTP,pvt,ycur) \
+ pointer INP; pointer OUTP; mpDitherOrdDefPtr pvt; int ycur; \
+{ \
+ register itype *inp = (itype *) INP; \
+ register otype *outp = (otype *) OUTP; \
+ register CARD32 mult = pvt->mult; \
+ register CARD32 shift = pvt->shift; \
+ register CARD32 ncol = pvt->ncol; \
+ register CARD32 *mtrx; \
+ register CARD32 jcol; \
+ register int bw = pvt->width; \
+ CARD32 nrow = pvt->nrow; \
+ mtrx = pvt->matrix + ((ycur & (nrow-1)) * ncol); \
+ jcol = ((ncol > nrow) && (ycur & nrow)) ? nrow : 0; \
+ for (ncol--, bw-- ; bw > 0; bw -= 4) { \
+ /* unroll four times is all we can do safely */ \
+ register CARD32 value1, value2; \
+ value1 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ value2 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ *outp++ = value1; \
+ value1 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ *outp++ = value2; \
+ value2 = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+ *outp++ = value1; \
+ jcol &= ncol; \
+ *outp++ = value2; \
+ } \
+ for ( ; bw >= 0; bw--) \
+ *outp++ = (*inp++ * mult + mtrx[jcol++]) >> shift; \
+}
+
+MakeOrdBit (OrdDitherQb,QuadPixel,BitPixel)
+MakeOrdBit (OrdDitherPb,PairPixel,BitPixel)
+MakeOrdBit (OrdDitherBb,BytePixel,BitPixel)
+
+MakeOrdPix (OrdDitherQB,QuadPixel,BytePixel)
+MakeOrdPix (OrdDitherPB,PairPixel,BytePixel)
+MakeOrdPix (OrdDitherBB,BytePixel,BytePixel)
+
+MakeOrdPix (OrdDitherQP,QuadPixel,PairPixel)
+MakeOrdPix (OrdDitherPP,PairPixel,PairPixel)
+
+MakeOrdPix (OrdDitherQQ,QuadPixel,QuadPixel)
+
+/* end module mpdither.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpgeom.c b/xc/programs/Xserver/XIE/mixie/process/mpgeom.c
new file mode 100644
index 000000000..8d34099c1
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpgeom.c
@@ -0,0 +1,143 @@
+/* $TOG: mpgeom.c /main/5 1998/02/09 16:22:16 kaleb $ */
+/**** module mpgeom.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpgeom.c -- DDXIE geometry element
+
+ Ben Fahy -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpgeom.c,v 1.3 1998/10/06 10:35:19 dawes Exp $ */
+
+
+#define _XIEC_MPGEOM
+#define _XIEC_PGEOM
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <mpgeom.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeGeometry();
+
+/*
+ * routines which we reference from other DDXIE modules
+ */
+extern int miAnalyzeGeomAA();
+#if XIE_FULL
+extern int miAnalyzeGeomBi();
+#endif
+extern int miAnalyzeGeomNN();
+
+static xieIntProc miAnalyzeGeomVecs[] = {
+ miAnalyzeGeomAA,
+#if XIE_FULL
+ miAnalyzeGeomBi,
+#endif
+ miAnalyzeGeomNN,
+ (xieIntProc) NULL
+};
+#define n_vecs (sizeof(miAnalyzeGeomVecs)/sizeof(xieIntProc) - 1)
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeGeometry(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int i;
+
+ for (i=0; i<n_vecs; ++i)
+ if (miAnalyzeGeomVecs[i](flo,ped) == TRUE)
+ return(TRUE);
+
+ return(FALSE);
+} /* end miAnalyzeGeometry */
+/* end module mpgeom.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpgeomaa.c b/xc/programs/Xserver/XIE/mixie/process/mpgeomaa.c
new file mode 100644
index 000000000..0476a0610
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpgeomaa.c
@@ -0,0 +1,1432 @@
+/* $TOG: mpgeomaa.c /main/9 1998/02/09 16:22:04 kaleb $ */
+/**** module mpgeomaa.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpgeomaa.c -- DDXIE element for handling antialias
+ geometry technique
+
+ Ben Fahy && Larry Hare -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpgeomaa.c,v 3.4 1998/10/05 13:22:44 dawes Exp $ */
+
+
+#define _XIEC_MPGEOM
+#define _XIEC_PGEOM
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <mpgeom.h>
+#include <technq.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeGeomAA();
+
+/*
+ * routines used internal to this module, technique dependent
+ */
+
+/* antialias by lowpass using boxcar filter*/
+static int CreateGeomAA();
+static int InitializeGeomAA();
+static int ActivateGeomAA();
+static int ResetGeomAA();
+static int DestroyGeomAA();
+
+
+/*
+ * DDXIE Geometry entry points
+ */
+static ddElemVecRec AntiAliasVec = {
+ CreateGeomAA,
+ InitializeGeomAA,
+ ActivateGeomAA,
+ (xieIntProc)NULL,
+ ResetGeomAA,
+ DestroyGeomAA
+ };
+
+static void AASL_R(), AASL_b(), AASL_B(), AASL_P(), AASL_Q(); /* AA scale */
+static void AAGL_R(), AAGL_b(), AAGL_B(), AAGL_P(), AAGL_Q(); /* AA general */
+static void XXFL_R(), XXFL_b(), XXFL_B(), XXFL_P(), XXFL_Q(); /* fill */
+static void (*aa_scl_lines[5])() = { AASL_R, AASL_b, AASL_B, AASL_P, AASL_Q };
+static void (*aa_gen_lines[5])() = { AAGL_R, AAGL_b, AAGL_B, AAGL_P, AAGL_Q };
+static void (*fill_lines[5])() = { XXFL_R, XXFL_b, XXFL_B, XXFL_P, XXFL_Q };
+
+#if XIE_FULL
+static void GAGL_R(), GAGL_B(), GAGL_P(), GAGL_Q(); /* GA general */
+static void (*ga_scl_lines[5])() = { GAGL_R, AASL_b, GAGL_B, GAGL_P, GAGL_Q };
+static void (*ga_gen_lines[5])() = { GAGL_R, AAGL_b, GAGL_B, GAGL_P, GAGL_Q };
+#endif
+
+typedef struct _bounding_rect {
+ double xmin,xmax,ymin,ymax;
+} brect;
+
+#define FLG_A_NOT_ZERO 0x01
+#define FLG_B_NOT_ZERO 0x02
+#define FLG_C_NOT_ZERO 0x04
+#define FLG_D_NOT_ZERO 0x08
+#define FLG_BACKWARDS 0x10
+#define FLG_SKIP_BAND 0x20
+
+typedef struct _mpaabanddef {
+ CARD32 flags; /* see FLG_xxx above */
+ int yOut; /* what output line we are on */
+
+ int first_ilow, /* rounded first_mlow */
+ first_ihigh; /* rounded first_mhigh */
+
+ double first_mlow, /* lowest input line mapped by first output */
+ first_mhigh; /* highest input line mapped by first output */
+
+ brect left_br; /* bounding rectangle, left side */
+
+ int *ixmin; /* useful data precalculated for scaling */
+ int *ixmax;
+
+ int level_clip; /* in case we need to clip our pixel */
+ int int_constant; /* precalculated for Constrained data fill */
+ RealPixel flt_constant; /* precalculated for UnConstrained data fill */
+
+ int in_width; /* source image size */
+ int in_height;
+
+ int lo_src_avail; /* lines we think are available */
+ int hi_src_avail;
+
+ void (*linefunc) (); /* action routines based on pixel size */
+ void (*fillfunc) ();
+ }
+mpAABandRec, *mpAABandPtr;
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ switch(ped->techVec->number) {
+ case xieValGeomAntialias:
+ case xieValGeomGaussian: /* safe, but slow and sometimes ugly */
+ ped->ddVec = AntiAliasVec;
+ break;
+ default:
+ return(FALSE);
+ }
+ return(TRUE);
+} /* end miAnalyzeGeomAA */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = sizeof(mpAABandRec) * xieValMaxBands;
+
+ return(MakePETex(flo, ped, auxsize, NO_SYNC, NO_SYNC));
+
+} /* end CreateGeomAA */
+/*------------------------------------------------------------------------
+---------------------------- free private data . . . ---------------------
+------------------------------------------------------------------------*/
+static int FreeBandData(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpAABandPtr pvtband = (mpAABandPtr) (ped->peTex->private);
+ int band, nbands = ped->inFloLst[SRCtag].bands;
+
+ for (band = 0 ; band < nbands ; band++, pvtband++) {
+ if (pvtband->flags & FLG_SKIP_BAND)
+ continue;
+ if (pvtband->ixmin != NULL)
+ pvtband->ixmin = (int *) XieFree(pvtband->ixmin);
+
+ }
+}
+/*------------------------------------------------------------------------
+--------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ xieFloGeometry *raw = (xieFloGeometry *)ped->elemRaw;
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt;
+ mpAABandPtr pvtband = (mpAABandPtr) (pet->private);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ int nbands = ped->inFloLst[SRCtag].bands;
+#if XIE_FULL
+ BOOL gaussian = (ped->techVec->number == xieValGeomGaussian);
+#endif
+ int band;
+ /*
+ * access coordinates for y_in = c * x_out + d * y_out + ty
+ */
+ double a = pedpvt->coeffs[0];
+ double b = pedpvt->coeffs[1];
+ double c = pedpvt->coeffs[2];
+ double d = pedpvt->coeffs[3];
+ double tx = pedpvt->coeffs[4];
+ double ty = pedpvt->coeffs[5];
+ int width = raw->width;
+ int threshold;
+ double xmin,xmax,ymin,ymax,tot_ymin,tot_ymax;
+ CARD32 dataclass;
+ CARD32 band_flags;
+
+/*
+ * Initialize parameters for tracking input lines, etc.
+ */
+ band_flags = 0;
+
+ if (a != 0.0) band_flags |= FLG_A_NOT_ZERO;
+ if (b != 0.0) band_flags |= FLG_B_NOT_ZERO;
+ if (c != 0.0) band_flags |= FLG_C_NOT_ZERO;
+ if (d != 0.0) band_flags |= FLG_D_NOT_ZERO;
+ if (d < 0.0) band_flags |= FLG_BACKWARDS;
+
+ for (band = 0 ; band < nbands; band++, iband++, oband++, pvtband++) {
+
+ if (pedpvt->do_band[band]) {
+
+ pvtband->flags = band_flags;
+ pvtband->yOut = 0; /* what output line we are on */
+
+ dataclass =oband->format->class;
+ if (IsConstrained(dataclass))
+ pvtband->int_constant = ConstrainConst(pedpvt->constant[band],
+ iband->format->levels);
+ else
+ pvtband->flt_constant = (RealPixel) pedpvt->constant[band];
+
+ pvtband->fillfunc = fill_lines[IndexClass(dataclass)];
+#if XIE_FULL
+ pvtband->linefunc = gaussian
+ ? ga_gen_lines[IndexClass(dataclass)]
+ : aa_gen_lines[IndexClass(dataclass)];
+#else
+ pvtband->linefunc = aa_gen_lines[IndexClass(dataclass)];
+#endif
+
+ pvtband->level_clip = oband->format->levels;
+ pvtband->in_width = iband->format->width;
+ pvtband->in_height = iband->format->height;
+
+ /*
+ * THE BASIC IDEA -
+ *
+ * We consider each output pixel as describing an *area* of width 1
+ * and height 1. Pixel (xo,yo) thus refers to the locus of points:
+ *
+ * LocusOut(xo,yo) = { (x,y) | xo <= x < xo+1, yo <= y < yo + 1 }
+ *
+ * When we map this area back to the input image, each corner maps
+ * according to:
+ *
+ * x_in = a * x_out + b * y_out + tx,
+ * y_in = c * x_out + b * y_out + ty.
+ *
+ * Now let P(xo,yo) be described as the point at relative position
+ * (p,q) from (xo,yo) in LocusOut(xo,yo). In other words,
+ *
+ * P(xo,yo) = (xo+p, yo+q)
+ *
+ * Let M(p,q;xo,yo) be the mapping in input space of P(xo,yo). Then
+ * the x coordinate of M(p,q;xo+1,yo) is:
+ *
+ * XCoord[ M(p,q:xo+1,yo) ] = a * (x_o+1+p) + b*yo + tx
+ * = a * (x_o+p) + b*yo + tx + a*p
+ * so
+ *
+ * XCoord[ M(p,q:xo+1,yo) ] = XCoord[ M(p,q;xo,yo) ] + a*p
+ *
+ * similarly,
+ *
+ * YCoord[ M(p,q:xo,yo+1) ] = YCoord[ M(p,q;xo,yo) ] + c*q
+ *
+ * also,
+ *
+ * XCoord[ M(p+1,q:xo,yo) ] = XCoord[ M(p,q;xo,yo) ] + a*p
+ * YCoord[ M(p+1,q:xo,yo) ] = XCoord[ M(p,q;xo,yo) ] + c*p
+ * XCoord[ M(p,q+1:xo,yo) ] = YCoord[ M(p,q;xo,yo) ] + b*q
+ * YCoord[ M(p,q+1:xo,yo) ] = YCoord[ M(p,q;xo,yo) ] + d*q
+ *
+ * We will use these results to derive a computationally simple
+ * antialiasing algorithm.
+ *
+ * Suppose we are scaling an image down by a factor of four in
+ * the X direction:
+ *
+ * | | | |**| | | | | | | | | | | | | | | |
+ * | | | |**| | | | |**|**|**|**|**|**|**|**|**|**| |
+ * | | | |**| | | | | | | | | | | | | | | |
+ *
+ * | | | ******** | ******** | *****
+ *
+ * If we nearest neighbor sample the input image where the
+ * output pixels map to input locations, the horizontal line
+ * at the right will show up in the output image, but the vertical
+ * line at left will be completely missed.
+ *
+ * The idea of this algorithm is to take the average of all pixels
+ * which are included in the *region* mapped by the output *area*,
+ * as opposed to looking at discrete pixels only. So we consider
+ * a pixel as representing an output locus
+ *
+ * LocusOut(xo,yo) = { (x,y) | xo <= x < xo+1, yo <= y < yo + 1 }
+ *
+ * and the input locus will have corner points:
+ *
+ * ( XCoord[ M(0,0:xo,yo) ],YCoord[ M(0,0:xo,yo) ] )
+ * ( XCoord[ M(1,0:xo,yo) ],YCoord[ M(1,0:xo,yo) ] )
+ * ( XCoord[ M(0,1:xo,yo) ],YCoord[ M(0,1:xo,yo) ] )
+ * ( XCoord[ M(1,1:xo,yo) ],YCoord[ M(1,1:xo,yo) ] )
+ *
+ * If xi(xo) = XCoord[ M(0,0;xo,yo) ]
+ * and yi(yo) = YCoord[ M(0,0;xo,yo) ],
+ *
+ * Then we can rewrite these using the relations above as:
+ *
+ * ( xi(xo), yi(yo) ),
+ * ( xi(xo)+a, yi(yo)+c ),
+ * ( xi(xo)+b, yi(yo)+d),
+ * ( xi(xo)+a+b, yi(yo)+c+d ).
+ *
+ * We have very little guarantee on what shape this collection
+ * of points will assume, without agreeing to look for special
+ * cases of (a,b,c,d). However, we do know that whatever the
+ * locus looks like, there is a "bounding rectangle":
+ *
+ * BRect: { (xmin,ymin; xmax,ymax) }
+ *
+ * such that xmin is the greatest lower bound of all x in the input locus,
+ * such that ymin is the greatest lower bound of all y in the input locus,
+ * such that xmax is the least upper bound of all x in the input locus, &
+ * such that ymax is the least upper bound of all y in the input locus.
+ *
+ * Furthermore, this bounding rectangle has the very nice property
+ * of "shift invariance," ie,
+ *
+ * If { (xmin,ymin; xmax,ymax) } is the bounding rectangle for (xo,yo),
+ *
+ * Then { (xmin+a*m+b*n,ymin+c*m+d*n; xmax+a*m+b*n,ymax+c*m+d*n) }
+ * is the bounding rect for (xo+m,yo+n).
+ *
+ * Proof. Let Yo be the ymax coordinate of the bounding rectangle for
+ * (xo,yo). Let ILo be the input locus of (xo,yo). Let Yo' be the ymax
+ * coordinate of (xo+m,yo+n), and ILo' be the input locus of (xo+m,yo+n).
+ * We claim Yo' = Yo + c*m+d*n.
+ *
+ * By definition, Yo >= y for all y in ILo, and Yo' >= y for all y in ILo'.
+ * Suppose Yo' < Yo + c*m+d*n. Then Yo~ = (Yo' - c*m - d*n) is less than
+ * Yo. If Yo~ >= y for all y in ILo, then this contradicts Yo being a
+ * least upper bound. Therefore there must be some offset (r,s) such
+ * that Yrs = YCoord[ M(r,s;xo,yo) ] is > Yo~. But by the translation
+ * rules above, YCoord[ M(r,s; xo+m,yo+n) ] = Yrs + c*m + d*n. Call
+ * this point Yrs'. Then:
+ *
+ * Yrs' = Yrs + c*m + d*n > Yo~ + c*m + d*n = Yo'
+ *
+ * which violates the assumption that Yo' is the least upper bound for
+ * ILo'. Thus, Yo' >= Yo + c*m + d*n. It is easy to show that Yo'
+ * greater than Yo + c*m + d*n also leads to a contradiction. Therefore
+ * we have Yo' identically equal to Yo + c*m + d*n, and the other
+ * coordinates (xmin,xmax,ymin) follow by similar reasoning.
+ *
+ * ----------------------------------------------------------------------
+ *
+ * WHY THIS IS USEFUL:
+ *
+ * We compute the bounding rectangle for the first pixel on the first
+ * output line. Then it is easy to compute the bounding rectangle for
+ * all other points in the output image. In particular, we can compute
+ * ymin,ymax values for any line in the output image. We don't bother
+ * decoding any output line until all of the required input image lines
+ * are available.
+ *
+ * Once we have the data, we call a line function that does the real
+ * work. The line function simply marches through the bounding rect
+ * of each pixel in the output line, adds up the input image numbers,
+ * and divides by the number of discrete pixels in the bounding rect.
+ * The next bounding rect in the line is easily calculated by the
+ * shift-invariance relation. Clipping of the bounding rect is used
+ * to avoid integrating nonsense values. An output pixel is filled
+ * with the constant value only if the *entire* bounding rectangle
+ * is off-image.
+ *
+ */
+
+/*** Calculate bounding rectangle of first pixel, ylimits of first line ***/
+
+ xmin = xmax = tx;
+ ymin = ymax = tot_ymin = tot_ymax = ty;
+
+#if XIE_FULL
+ if (gaussian) {
+ pTecGeomGaussianDefPtr tkpvt = (pTecGeomGaussianDefPtr)ped->techPvt;
+
+ if (tkpvt->radius < 1) tkpvt->radius = 2;
+
+ /* conservatively pick a bounding box for datamgr calculations */
+ xmin -= ((double) tkpvt->radius + 1.00001);
+ xmax += ((double) tkpvt->radius + 1.99999);
+ ymin -= ((double) tkpvt->radius + 1.00001);
+ ymax += ((double) tkpvt->radius + 1.99999);
+ tot_ymin = ymin + (c < 0.0 ? (width * c) : 0.0);
+ tot_ymax = ymax + (c > 0.0 ? (width * c) : 0.0);
+ } else
+#endif
+ {
+ if (a < 0) xmin += a;
+ else xmax += a;
+ if (b < 0) xmin += b;
+ else xmax += b;
+
+ if (c < 0) { ymin += c; tot_ymin += (width * c); }
+ else { ymax += c; tot_ymax += (width * c); }
+ if (d < 0) { ymin += d; tot_ymin += d; }
+ else { ymax += d; tot_ymax += d; }
+ }
+
+ pvtband->left_br.xmin = xmin;
+ pvtband->left_br.ymin = ymin;
+ pvtband->left_br.xmax = xmax;
+ pvtband->left_br.ymax = ymax;
+
+ pvtband->first_mlow = tot_ymin;
+ pvtband->first_mhigh = tot_ymax;
+
+ pvtband->first_ilow = pvtband->first_mlow;
+ pvtband->first_ihigh = pvtband->first_mhigh;
+
+/*** Check for some special cases ***/
+ if ((band_flags & (FLG_C_NOT_ZERO | FLG_B_NOT_ZERO)) == 0) {
+ int i, maxpixl = pvtband->in_width - 1;
+
+#if XIE_FULL
+ pvtband->linefunc = gaussian
+ ? ga_scl_lines[IndexClass(dataclass)]
+ : aa_scl_lines[IndexClass(dataclass)];
+#else
+ pvtband->linefunc = aa_scl_lines[IndexClass(dataclass)];
+#endif
+
+ if (!(pvtband->ixmin = (int *) XieMalloc(width * 2*sizeof(int)))) {
+ FreeBandData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ pvtband->ixmax = pvtband->ixmin + width;
+ /* Valid X coord domain will remain same for entire image */
+ for ( i=0; i<width; ++i) {
+ register int ixmin,ixmax;
+
+ ixmin = xmin;
+ ixmax = xmax;
+ xmin += a;
+ xmax += a;
+
+ if (ixmin < 0) ixmin = 0;
+ if (ixmax > maxpixl) ixmax = maxpixl;
+ if (ixmax > ixmin) ixmax--;
+
+ pvtband->ixmin[i] = ixmin;
+ pvtband->ixmax[i] = ixmax;
+ }
+ }
+
+ /* set threshold so we get all needed src lines */
+ /* if we need line 256, must ask for 257! */
+ threshold = pvtband->first_ihigh + 1;
+
+ /* make sure we get something */
+ if (threshold < 1)
+ threshold = 1;
+
+ /* but don't ask for stuff we can't ever get! */
+ if (threshold > iband->format->height)
+ threshold = iband->format->height;
+
+ if(!InitBand(flo, ped, iband, iband->format->height,
+ threshold, NO_INPLACE))
+ return(FALSE);
+ } else {
+ pvtband->flags = FLG_SKIP_BAND;
+ BypassSrc(flo,pet,iband);
+ }
+ }
+ return(raw->bandMask ? InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE) : TRUE);
+} /* end InitializeGeomAA */
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ pGeomDefPtr pedpvt = (pGeomDefPtr) ped->elemPvt;
+ mpAABandPtr pvtband = (mpAABandPtr) pet->private;
+ bandPtr oband = &(pet->emitter[0]);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+ int width = oband->format->width; /* consider use of pvtband */
+ double d = pedpvt->coeffs[3];
+ register pointer outp;
+
+ for(band = 0; band < nbands; band++, iband++, oband++, pvtband++) {
+
+ if (pvtband->flags & FLG_SKIP_BAND)
+ continue;
+
+ if ((pet->scheduled & (1 << band)) == 0)
+ continue;
+
+ if (pvtband->flags & FLG_BACKWARDS) {
+
+ /* we're going backwards, which is actually *simpler*,
+ * because we don't get ANY data until we have ALL data.
+ * Thus, first time through, just map everything we have.
+ */
+ if (!pvtband->yOut) {
+ if (!MapData(flo,pet,iband,0,0,iband->maxGlobal,KEEP))
+ ImplementationError(flo,ped, return(FALSE));
+ pvtband->lo_src_avail = 0;
+ pvtband->hi_src_avail = iband->maxGlobal-1;
+ }
+
+ outp = GetCurrentDst(flo,pet,oband);
+ while (outp) {
+
+ if ((pvtband->first_ihigh < 0) ||
+ (pvtband->first_ilow > pvtband->in_height))
+
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ else
+ (*pvtband->linefunc)(outp,iband->dataMap,width,ped,pvtband);
+
+ /* now compute highest input line for next oline */
+ pvtband->first_mlow += d;
+ pvtband->first_mhigh += d;
+ pvtband->first_ilow = (int) pvtband->first_mlow ;
+ pvtband->first_ihigh = (int) pvtband->first_mhigh;
+ pvtband->yOut++;
+ outp = GetNextDst(flo,pet,oband,TRUE);
+ }
+ if (oband->final)
+ DisableSrc(flo,pet,iband,FLUSH);
+
+ } else {
+
+ while (!ferrCode(flo)) {
+ int map_lo; /* lowest line mapped by output line */
+ int map_hi; /* highest line mapped by output line */
+ int last_src_line = pvtband->in_height - 1;
+ int threshold;
+
+ /* access current output line */
+ outp = GetDst(flo,pet,oband,pvtband->yOut,FLUSH);
+ if (!outp) {
+ if (oband->final)
+ DisableSrc(flo, pet, iband, FLUSH);
+ else if (iband->current != 0)
+ FreeData(flo, pet, iband, iband->current);
+ goto breakout;
+ }
+
+ map_lo = pvtband->first_ilow;
+ if (map_lo < 0)
+ map_lo = 0;
+
+ map_hi = pvtband->first_ihigh;
+ if (map_hi > last_src_line)
+ map_hi = last_src_line;
+
+ if (map_hi < 0 || map_lo > last_src_line)
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ else {
+ if(!MapData(flo,pet,iband,map_lo,map_lo,(map_hi-map_lo+1),KEEP))
+ break;
+ pvtband->lo_src_avail = 0;
+ pvtband->hi_src_avail = iband->maxGlobal-1;
+
+ if (map_lo != iband->current)
+ ImplementationError(flo,ped, return(FALSE));
+
+ /*** Compute output pixels for this line ***/
+ (*pvtband->linefunc)(outp,iband->dataMap,width,ped,pvtband);
+ }
+
+ /* increment to next line. */
+
+ pvtband->first_mlow += d;
+ pvtband->first_mhigh += d;
+
+ /* have to be careful about -0.5 rounding to 0, not -1 */
+ if (pvtband->first_ilow < 0) {
+ pvtband->first_ilow = (pvtband->first_mlow < 0)
+ ? -1
+ : (int)pvtband->first_mlow;
+ pvtband->first_ihigh = (pvtband->first_mhigh < 0)
+ ? -1
+ : (int)pvtband->first_mhigh;
+ } else {
+ /* if ilow was positive before, needn't check for negative */
+ pvtband->first_ilow = (int)pvtband->first_mlow;
+ pvtband->first_ihigh = (int)pvtband->first_mhigh;
+ }
+
+ ++pvtband->yOut;
+ if (pvtband->first_ilow > last_src_line) {
+ /* rest of output image is off the input image */
+ /* we will exit after filling output strip */
+ while(outp=GetDst(flo,pet,oband,pvtband->yOut,FLUSH)) {
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ pvtband->yOut++;
+ }
+ if (oband->final) /* out of destination lines */
+ DisableSrc(flo, pet, iband, FLUSH);
+ else
+ goto breakout;
+ /* Be nice and let downstream element eat our data */
+ /* notice we don't free input data, because then the */
+ /* silly scheduler would turn us off */
+ }
+
+ map_hi = pvtband->first_ihigh;
+ if (map_hi > last_src_line)
+ map_hi = last_src_line;
+
+ threshold = map_hi - iband->current + 1;
+
+ /* make sure we get something */
+ if (threshold <= 1)
+ threshold = 1;
+
+ /* but don't ask for stuff we can't ever get! */
+ if (threshold > pvtband->in_height)
+ threshold = pvtband->in_height;
+
+ SetBandThreshold(iband, threshold);
+ if (map_hi >= (int) iband->maxGlobal) {
+ /* we need to let someone else generate more data */
+ break;
+ }
+ }
+ /* want to make sure we GetSrc at least once before Freeing */
+ if (iband->current)
+ FreeData(flo, pet, iband, iband->current);
+ } /* end of backwards/forwards */
+breakout: ;
+ } /* end of band loop */
+ return(TRUE);
+} /* end ActivateGeometry */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ FreeBandData(flo,ped);
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetGeomAA */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyGeomAA(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyGeomAA */
+
+/**********************************************************************/
+/* fill routines */
+static void XXFL_b (OUTP,width,pvtband)
+ register pointer OUTP;
+ register int width;
+ mpAABandPtr pvtband;
+{
+ register LogInt constant = (LogInt) pvtband->int_constant;
+ register LogInt *outp = (LogInt *) OUTP;
+ register int i;
+
+ if (constant) constant = ~0;
+ /*
+ ** NOTE: Following code assume filling entire line. Which is
+ ** currently true. In the future we may need to abide by
+ ** bit boundaries. Conversely code for bytes and pairs below
+ ** could be sped up by doing something similar. perhaps we need
+ ** an action_constant(outp,run,ix,constant) routine similar to
+ ** action_set().
+ */
+ width = (width + 31) >> 5;
+ for (i=0; i < width; ++i) *outp++ = constant;
+}
+
+#define DO_FL(funcname, iotype, CONST) \
+static void funcname (OUTP,width,pvtband) \
+ register pointer OUTP; \
+ register int width; \
+ mpAABandPtr pvtband; \
+{ \
+ register iotype constant = (iotype) pvtband->CONST; \
+ register iotype *outp = (iotype *) OUTP; \
+ \
+ for ( ; width > 0; width--) *outp++ = constant; \
+}
+
+DO_FL (XXFL_R, RealPixel, flt_constant)
+DO_FL (XXFL_B, BytePixel, int_constant)
+DO_FL (XXFL_P, PairPixel, int_constant)
+DO_FL (XXFL_Q, QuadPixel, int_constant)
+
+/**********************************************************************/
+/* (x,y) separable routines (eg, scale, mirror_x, mirror_y) */
+/**********************************************************************/
+/*
+ * NOTE - see caveat for GL_b for why the user shouldn't really be
+ * asking for antialias in the first place...
+ */
+static void AASL_b (OUTP,srcimg,width,ped,pvtband)
+ register pointer OUTP, *srcimg;
+ register int width;
+ peDefPtr ped;
+ mpAABandPtr pvtband;
+{
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt;
+ double d = pedpvt->coeffs[3];
+
+ /* These variables describe the limits of the bounding rectangle */
+
+ /* since x and y separable, x limits are precalculated once */
+ register int *ixminptr=pvtband->ixmin;
+ register int *ixmaxptr=pvtband->ixmax;
+ register int ixmin,ixmax;
+
+ /* since x and y separable, y limits will be set once this line */
+ register int iymin,iymax;
+
+ /* some variables which describe available input data (for clipping) */
+ register int minline = pvtband->lo_src_avail;
+ register int maxline = pvtband->hi_src_avail;
+
+
+ /* cast of constant, output and input pointers to correct type */
+ register LogInt *outp = (LogInt *) OUTP;
+ register LogInt *ptrIn;
+ register LogInt constant;
+ register LogInt value,outval,M;
+ register int nfound;
+
+ constant = pvtband->int_constant ? ~(LogInt) 0 : 0;
+
+ /* round bounding rectangle limits to ints */
+ iymin=pvtband->left_br.ymin;
+ iymax=pvtband->left_br.ymax;
+
+ /* clip to available src data */
+ if (iymin < minline) iymin = 0;
+ if (iymax > maxline) iymax = maxline;
+ if (iymax > iymin) iymax--;
+
+ /* M is a number that encodes the "active" bit */
+ M=LOGLEFT;
+
+ /* val accumulates the output bits */
+#define kludge_based
+#ifdef kludge_based
+ outval = 0;
+#else
+ outval = constant;
+#endif
+
+ /* loop through all the output pixels on this line */
+ while ( width-- > 0 ) {
+ register int ix,iy;
+
+ /* make use of precalculated X limits */
+ ixmin = *ixminptr++;
+ ixmax = *ixmaxptr++;
+
+ nfound = 0;
+ value = 0;
+ for (iy=iymin; iy<=iymax; ++iy) {
+ ptrIn = (LogInt *) srcimg[iy];
+
+ for (ix=ixmin; ix<=ixmax; ++ix) {
+ ++nfound;
+#ifdef kludge_based
+ if (LOG_tstbit(ptrIn,ix)) {
+ ++value;
+#else
+ if (!LOG_tstbit(ptrIn,ix)) {
+ /* set this pixel black */
+ outval &= ~M;
+ goto next;
+#endif
+ }
+ }
+ } /* end of iy loop */
+
+/* See GL_b() for an explanation of the kludge below */
+
+#ifdef kludge_based
+#define kludge 8/7
+ /* note: 4/3 relies on C evaluating left to right */
+
+ if (!nfound)
+ outval |= (constant&M); /* set to background */
+ else if (value*kludge >= nfound)
+ outval |= M;
+#else
+
+ if (!nfound)
+ outval &= (constant&M); /* set to background */
+ else
+ outval |= M; /* set bit on */
+next:
+
+#endif
+ /* shift our active bit over one */
+ LOGRIGHT(M);
+
+ /* if we hit the end of a word, output what we have */
+ if (!M) {
+ *outp++ = outval; /* record output data */
+ M=LOGLEFT; /* reset active bit */
+ outval = 0; /* reset accumulator */
+ }
+
+ } /* end of line loop */
+
+ /* if we didn't write all the pixels out, do so now */
+ if (M != LOGLEFT) *outp = outval;
+
+ /* before leaving, update bounding rect for next line */
+ pvtband->left_br.ymin += d;
+ pvtband->left_br.ymax += d;
+}
+
+/* NOTE: too bad paper is white is 255, otherwise you can often avoid the
+** divide by "if (value) value /= nfound;"
+*/
+#define aalinsep_func(funcname, iotype, valtype, CONST) \
+ \
+ /* round bounding rectangle limits to ints */ \
+ iymin = pvtband->left_br.ymin; \
+ iymax = pvtband->left_br.ymax; \
+ \
+ /* clip to available src data */ \
+ if (iymin < minline) iymin = 0; \
+ if (iymax > maxline) iymax = maxline; \
+ if (iymax > iymin) iymax--; \
+ \
+ /* loop through all the output pixels on this line */ \
+ for ( i=0; i<width; ++i) { \
+ /* loop variables */ \
+ register int ix,iy; \
+ \
+ nfound = 0; \
+ value = 0; \
+ /* ixmin = pvtband->ixmin[i]; */ \
+ /* ixmax = pvtband->ixmax[i]; */ \
+ ixmin = *ixminptr++; \
+ ixmax = *ixmaxptr++; \
+ \
+ for (iy=iymin; iy<=iymax; ++iy) { \
+ ptrIn = ixmin + (iotype *) srcimg[iy]; \
+ for (ix=ixmin; ix<=ixmax; ++ix) { \
+ value += *ptrIn++; \
+ ++nfound; \
+ } \
+ } /* end of iy loop */ \
+ \
+ if (nfound) \
+ value /= nfound; \
+ else \
+ value = constant; \
+ \
+ *outp++ = value; \
+ \
+ } /* end of for loop */ \
+ \
+ /* before leaving, update bounding rect for next line */ \
+ pvtband->left_br.ymin += d; \
+ pvtband->left_br.ymax += d; \
+
+#define DO_AASL(funcname, iotype, valtype, CONST) \
+static void \
+funcname (OUTP,srcimg,width,ped,pvtband) \
+ register pointer OUTP; \
+ register pointer *srcimg; \
+ register int width; \
+ peDefPtr ped; \
+ mpAABandPtr pvtband; \
+{ \
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt; \
+ \
+ /* Mapping coefficients */ \
+ double d = pedpvt->coeffs[3]; \
+ \
+ /* These variables describe the limits of the bounding rectangle */ \
+ register int *ixminptr = pvtband->ixmin; \
+ register int *ixmaxptr = pvtband->ixmax; \
+ register int ixmin,iymin,ixmax,iymax; \
+ \
+ /* variables which describe available input data (for clipping) */ \
+ register int minline = pvtband->lo_src_avail; \
+ register int maxline = pvtband->hi_src_avail; \
+ \
+ /* cast of constant, output and input pointers to correct type */ \
+ register iotype constant = (iotype) pvtband->CONST; \
+ register iotype *outp = (iotype *) OUTP; \
+ register iotype *ptrIn; \
+ \
+ register valtype value; \
+ register int i,nfound; \
+ \
+ aalinsep_func(funcname, iotype, valtype, CONST) \
+}
+
+DO_AASL (AASL_R, RealPixel, RealPixel, flt_constant)
+DO_AASL (AASL_B, BytePixel, QuadPixel, int_constant)
+DO_AASL (AASL_P, PairPixel, QuadPixel, int_constant)
+DO_AASL (AASL_Q, QuadPixel, QuadPixel, int_constant)
+
+
+/**********************************************************************/
+/* general routines (should be able to handle any valid map) */
+
+/* CAVEAT - antialias doesn't really make much sense for bit-bit,
+ * because you can't represent any intermediate values. This means
+ * you can choose between line dropouts (bad) or making your image
+ * overly bold (also bad). The algorithm here assumes that if you
+ * were worried about being too bold, you would use the default
+ * sampling technique (eg, nearest neighbor). So it attempts to
+ * eliminate line dropouts at the expense of decreasing fine
+ * image detail.
+ */
+
+static void
+AAGL_b (OUTP,srcimg,width,ped,pvtband)
+ register pointer OUTP, *srcimg;
+ register int width;
+ peDefPtr ped;
+ mpAABandPtr pvtband;
+{
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt;
+
+ /* Mapping coefficients */
+ double a = pedpvt->coeffs[0];
+ double b = pedpvt->coeffs[1];
+ double c = pedpvt->coeffs[2];
+ double d = pedpvt->coeffs[3];
+
+ /* These variables describe the limits of the bounding rectangle */
+ double xmin = pvtband->left_br.xmin;
+ double ymin = pvtband->left_br.ymin;
+ double xmax = pvtband->left_br.xmax;
+ double ymax = pvtband->left_br.ymax;
+ register int ixmin,iymin,ixmax,iymax;
+
+ /* loop variables for roaming through the bounding rectangle */
+ register int ix,iy;
+
+ /* some variables which describe available input data (for clipping) */
+ register int maxpixl = pvtband->in_width - 1;
+ register int minline = pvtband->lo_src_avail;
+ register int maxline = pvtband->hi_src_avail;
+ CARD32 flags = pvtband->flags;
+
+ /* cast of constant, output and input pointers to correct type */
+ register LogInt *outp = (LogInt *) OUTP;
+ register LogInt *ptrIn;
+ register LogInt constant;
+ register LogInt value,outval,M;
+ register int nfound;
+
+ constant = pvtband->int_constant ? ~(LogInt) 0 : 0;
+
+ /* round bounding rectangle limits to ints */
+ ixmin = xmin;
+ iymin = ymin;
+ ixmax = xmax;
+ iymax = ymax;
+
+ /* clip to available src data */
+ if (ixmin < 0) ixmin = 0;
+ if (iymin < minline) iymin = 0;
+ if (ixmax > maxpixl) ixmax = maxpixl;
+ if (iymax > maxline) iymax = maxline;
+
+ /* M is a number that encodes the "active" bit */
+ M=LOGLEFT;
+
+ /* val accumulates the output bits */
+#define kludge_based_not
+#ifdef kludge_based
+ outval = 0;
+#else
+ outval = constant;
+#endif
+
+ /* loop through all the output pixels on this line */
+ while ( width > 0 ) {
+
+ xmin += a;
+ xmax += a;
+ nfound = 0;
+ value = 0;
+ for (iy=iymin; iy<=iymax; ++iy) {
+ ptrIn = (LogInt *) srcimg[iy];
+
+ for (ix=ixmin; ix<=ixmax; ++ix) {
+ ++nfound;
+#ifdef kludge_based
+ if (LOG_tstbit(ptrIn,ix)) {
+ ++value;
+ }
+#else
+ if (!LOG_tstbit(ptrIn,ix)) {
+ /* set this pixel black */
+ outval &= ~M;
+ goto next;
+ }
+#endif
+ }
+ } /* end of iy loop */
+
+/* on the kludge below: antialias is weird when you are going from
+ 1 bit to 1 bit. A straight generalization of the n-bit algorithm
+ would have us find the average value in the bounding rect, and
+ then round to 0 or 1. This corresponds to kludge = 2. However,
+ it may be desirable to choose black if a much smaller number of
+ pixels in the bounding rect are off. For example, we may want to
+ have black output if less than 3 out of every four pixels in the
+ input bounding rect are on. (value <= 3/4 nfound) which would
+ correspond to value *4/3 < nfound.
+
+ The problem with choosing anything other than 2 is that we are
+ treating black and white asymmetrically: the algorithm will
+ perform well for black lines on a white background, and poorly
+ for white pixels on a black background. Granted, one could use
+ Point or Constrain to flip, but.... ugh.
+
+ Note that if the bounding rectangle is completely off the input
+ image, then we should set 'val' to the background value (constant).
+*/
+
+#ifdef kludge_based
+#define kludge 8/7
+ /* note: 4/3 relies on C evaluating left to right */
+
+ if (!nfound)
+ outval |= (constant&M); /* set to background */
+ else if (value*kludge >= nfound)
+ outval |= M;
+#else
+
+ if (!nfound)
+ outval &= (constant&M); /* set to background */
+ else
+ outval |= M; /* set bit on */
+next:
+
+#endif
+ /* shift our active bit over one */
+ LOGRIGHT(M);
+
+ /* if we hit the end of a word, output what we have */
+ if (!M) {
+ *outp++ = outval; /* record output data */
+ M=LOGLEFT; /* reset active bit */
+ outval = 0; /* reset accumulator */
+ }
+
+ /* prepare geometry stuff for next loop */
+ width--;
+ ixmin = xmin;
+ ixmax = xmax;
+ if (flags & FLG_C_NOT_ZERO) {
+ ymin += c;
+ ymax += c;
+ iymin = ymin;
+ iymax = ymax;
+ if (iymin < minline) iymin = minline;
+ if (iymax >= maxline) iymax = maxline;
+ if (iymax > iymin) iymax--;
+ }
+ if (ixmin < 0) ixmin = 0;
+ if (ixmax >= maxpixl) ixmax = maxpixl;
+ if (ixmax > ixmin) ixmax--;
+ } /* end of line loop */
+
+ /* if we didn't write all the pixels out, do so now */
+ if (M != LOGLEFT) *outp = outval;
+
+ /* before leaving, update bounding rect for next line */
+ if (flags & FLG_B_NOT_ZERO) {
+ pvtband->left_br.xmin += b;
+ pvtband->left_br.xmax += b;
+ }
+ if (flags & FLG_D_NOT_ZERO) {
+ pvtband->left_br.ymin += d;
+ pvtband->left_br.ymax += d;
+ }
+}
+
+/* NOTE: too bad paper is white is 255, otherwise you can often avoid the
+** divide by "if (value) value /= nfound;"
+*/
+#define inscrutable_compiler(funcname, iotype, valtype, CONST) \
+ /* round bounding rectangle limits to ints */ \
+ ixmin = xmin; \
+ iymin = ymin; \
+ ixmax = xmax; \
+ iymax = ymax; \
+ \
+ /* clip to available src data */ \
+ if (ixmin < 0) ixmin = 0; \
+ if (iymin < minline) iymin = 0; \
+ if (ixmax > maxpixl) ixmax = maxpixl; \
+ if (iymax > maxline) iymax = maxline; \
+ \
+ /* loop through all the output pixels on this line */ \
+ while ( width > 0 ) { \
+ \
+ xmin += a; \
+ xmax += a; \
+ nfound = 0; \
+ value = 0; \
+ for (iy=iymin; iy<=iymax; ++iy) { \
+ ptrIn = (iotype *) srcimg[iy]; \
+ for (ix=ixmin; ix<=ixmax; ++ix) { \
+ value += ptrIn[ix]; \
+ ++nfound; \
+ } \
+ } /* end of iy loop */ \
+ \
+ if (nfound) \
+ value /= nfound; \
+ else \
+ value = constant; \
+ \
+ /* prepare for next loop */ \
+ width--; \
+ ixmin = xmin; \
+ ixmax = xmax; \
+ if (flags & FLG_C_NOT_ZERO) { \
+ ymin += c; \
+ ymax += c; \
+ iymin = ymin; \
+ iymax = ymax; \
+ if (iymin < minline) iymin = minline; \
+ if (iymax >= maxline) iymax = maxline; \
+ if (iymax > iymin) iymax--; \
+ } \
+ if (ixmin < 0) ixmin = 0; \
+ if (ixmax >= maxpixl) ixmax = maxpixl; \
+ if (ixmax > ixmin) ixmax--; \
+ *outp++ = value; \
+ }/* end of line loop */ \
+ \
+ /* before leaving, update bounding rect for next line */ \
+ if (flags & FLG_B_NOT_ZERO) { \
+ pvtband->left_br.xmin += b; \
+ pvtband->left_br.xmax += b; \
+ } \
+ if (flags & FLG_D_NOT_ZERO) { \
+ pvtband->left_br.ymin += d; \
+ pvtband->left_br.ymax += d; \
+ }
+
+#define DO_AAGL(funcname, iotype, valtype, CONST) \
+static void \
+funcname (OUTP,srcimg,width,ped,pvtband) \
+ register pointer OUTP; \
+ register pointer *srcimg; \
+ register int width; \
+ peDefPtr ped; \
+ mpAABandPtr pvtband; \
+{ \
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt; \
+ \
+ /* Mapping coefficients */ \
+ double a = pedpvt->coeffs[0]; \
+ double b = pedpvt->coeffs[1]; \
+ double c = pedpvt->coeffs[2]; \
+ double d = pedpvt->coeffs[3]; \
+ CARD32 flags = pvtband->flags; \
+ \
+ /* These variables describe the limits of the bounding rectangle */ \
+ double xmin = pvtband->left_br.xmin; \
+ double ymin = pvtband->left_br.ymin; \
+ double xmax = pvtband->left_br.xmax; \
+ double ymax = pvtband->left_br.ymax; \
+ register int ixmin,iymin,ixmax,iymax; \
+ \
+ /* loop variables for roaming through the bounding rectangle */ \
+ register int ix,iy; \
+ \
+ /* variables which describe available input data (for clipping) */ \
+ register int maxpixl = pvtband->in_width - 1; \
+ register int minline = pvtband->lo_src_avail; \
+ register int maxline = pvtband->hi_src_avail; \
+ \
+ /* cast of constant, output and input pointers to correct type */ \
+ register iotype constant = (iotype) pvtband->CONST; \
+ register iotype *outp = (iotype *) OUTP; \
+ register iotype *ptrIn; \
+ \
+ register valtype value; \
+ register int nfound; \
+ \
+ inscrutable_compiler(funcname, iotype, valtype, CONST) \
+}
+
+DO_AAGL (AAGL_R, RealPixel, RealPixel, flt_constant)
+DO_AAGL (AAGL_B, BytePixel, QuadPixel, int_constant)
+DO_AAGL (AAGL_P, PairPixel, QuadPixel, int_constant)
+DO_AAGL (AAGL_Q, QuadPixel, QuadPixel, int_constant)
+
+#if XIE_FULL
+/************************************************************************/
+/* Gaussian Routines */
+/************************************************************************/
+/* NOTES:
+** this is so slow, we don't try to do a special scale routine.
+** should use #include <math.h>?
+** should consider using float (e.g. fexp()) but tends to be machine specific.
+** should generate pow(2,K) as (1 << floor(k)) + table[fraction(K)].
+** (pow(2,K) is half the speed of exp() which defeats the purpose).
+** issue of whether to pick points within a radius? or to use a constant
+** ...size box of size 2 * radius ?
+
+ (((uv2 = ((ix-xcen)*(ix-xcen)+(iy-ycen)*(iy-ycen))) <= rad2 ) \
+ ? ((double)(P)) * (simple \
+ ? pow(2.0, sigma * uv2) \
+ : exp(sigma * uv2)) \
+ : 0.0 )
+*/
+
+#if !defined(exp) && !defined(pow)
+extern double exp(), pow();
+#endif
+
+
+#define gauss_loop(funcname, iotype, valtype, CONST) \
+ \
+ /* loop through all the output pixels on this line */ \
+ while ( width-- > 0 ) { \
+ \
+ iymin = ycen - (radius-1); \
+ iymax = iymin + (radius+radius-1); \
+ if (iymin < minline) iymin = minline; \
+ if (iymax >= maxline) iymax = maxline; \
+ \
+ ixmin = xcen - (radius - 1); \
+ ixmax = ixmin + (radius + radius - 1); \
+ if (ixmin < 0) ixmin = 0; \
+ if (ixmax >= maxpixl) ixmax = maxpixl; \
+ \
+ nfound = 0; \
+ value = 0.; \
+ for (iy = iymin; iy <= iymax; ++iy) { \
+ ptrIn = (iotype *) srcimg[iy]; \
+ for (ix = ixmin; ix <= ixmax; ++ix) { \
+ uv2 = ((ix-xcen)*(ix-xcen)+(iy-ycen)*(iy-ycen)); \
+ value += ((double)(ptrIn[ix])) * (simple \
+ ? pow(2.0, sigma * uv2) \
+ : exp(sigma * uv2)); \
+ ++nfound; \
+ } \
+ } /* end of iy loop */ \
+ \
+ if (nfound) { \
+ value *= tkpvt->normalize; /* xxx clip */ \
+ *outp++ = value < levels ? value : levels; \
+ } else \
+ *outp++ = constant; \
+ \
+ xcen += a; \
+ ycen += c; \
+ }/* end of line loop */ \
+ \
+ /* before leaving, update bounding rect for next line */ \
+ if (flags & FLG_B_NOT_ZERO) { \
+ pvtband->left_br.xmin += b; \
+ pvtband->left_br.xmax += b; \
+ } \
+ if (flags & FLG_D_NOT_ZERO) { \
+ pvtband->left_br.ymin += d; \
+ pvtband->left_br.ymax += d; \
+ }
+
+#define DO_GAGL(funcname, iotype, valtype, CONST) \
+static void \
+funcname (OUTP,srcimg,width,ped,pvtband) \
+ register pointer OUTP; \
+ register pointer *srcimg; \
+ register int width; \
+ peDefPtr ped; \
+ mpAABandPtr pvtband; \
+{ \
+ pGeomDefPtr pedpvt = (pGeomDefPtr)ped->elemPvt; \
+ \
+ /* Mapping coefficients */ \
+ double a = pedpvt->coeffs[0]; \
+ double b = pedpvt->coeffs[1]; \
+ double c = pedpvt->coeffs[2]; \
+ double d = pedpvt->coeffs[3]; \
+ CARD32 flags = pvtband->flags; \
+ \
+ register double xcen = pvtband->yOut * b + pedpvt->coeffs[4]; \
+ register double ycen = pvtband->yOut * d + pedpvt->coeffs[5]; \
+ register int ixmin,iymin,ixmax,iymax; \
+ \
+ /* loop variables for roaming through the bounding rectangle */ \
+ register int ix,iy; \
+ \
+ /* variables which describe available input data (for clipping) */ \
+ register int maxpixl = pvtband->in_width - 1; \
+ register int minline = pvtband->lo_src_avail; \
+ register int maxline = pvtband->hi_src_avail; \
+ \
+ /* cast of constant, output and input pointers to correct type */ \
+ register iotype constant = (iotype) pvtband->CONST; \
+ register iotype *outp = (iotype *) OUTP; \
+ register iotype *ptrIn; \
+ \
+ register double value, levels = pvtband->level_clip - 1; \
+ register int nfound; \
+ pTecGeomGaussianDefPtr tkpvt = (pTecGeomGaussianDefPtr)ped->techPvt;\
+ int simple = tkpvt->simple; \
+ int radius = tkpvt->radius; \
+ double sigma = (simple ? -1.0 : -0.5) / \
+ (tkpvt->sigma * tkpvt->sigma); \
+ register double uv2; \
+ \
+ gauss_loop(funcname, iotype, valtype, CONST) \
+}
+
+DO_GAGL (GAGL_R, RealPixel, RealPixel, flt_constant)
+DO_GAGL (GAGL_B, BytePixel, QuadPixel, int_constant)
+DO_GAGL (GAGL_P, PairPixel, QuadPixel, int_constant)
+DO_GAGL (GAGL_Q, QuadPixel, QuadPixel, int_constant)
+#endif
+
+/**********************************************************************/
+/* end module mpgeomaa.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpgeomnn.c b/xc/programs/Xserver/XIE/mixie/process/mpgeomnn.c
new file mode 100644
index 000000000..f53110702
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpgeomnn.c
@@ -0,0 +1,1121 @@
+/* $TOG: mpgeomnn.c /main/9 1998/02/09 16:22:10 kaleb $ */
+/* AGE Logic - Oct 15 1995 - Larry Hare */
+/**** module mpgeomnn.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpgeomnn.c -- DDXIE geometry element for handling nearest
+ neighbor technique
+
+ Ben Fahy && Larry Hare -- AGE Logic, Inc. June, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpgeomnn.c,v 3.3 1998/10/05 13:22:45 dawes Exp $ */
+
+
+#define _XIEC_MPGEOM
+#define _XIEC_PGEOM
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+/* #include <mpgeom.h> */
+#include <technq.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeGeomNN();
+
+/*
+ * routines used internal to this module, technique dependent
+ */
+
+static int CreateGeomNN();
+static int InitializeGeomNN();
+static int ActivateGeomNN();
+static int ResetGeomNN();
+static int DestroyGeomNN();
+
+/*
+ * DDXIE Geometry entry points
+ */
+static ddElemVecRec NearestNeighborVec = {
+ CreateGeomNN,
+ InitializeGeomNN,
+ ActivateGeomNN,
+ (xieIntProc)NULL,
+ ResetGeomNN,
+ DestroyGeomNN
+ };
+
+/*
+ * private
+ */
+#define PIX0 ((double)(0.0000))
+
+typedef struct _mpgeombanddef {
+
+ double first_mlow, /* lowest input line mapped by first output */
+ first_mhigh; /* highest input line mapped by first output */
+ int first_ilow, /* rounded first_mlow */
+ first_ihigh; /* rounded first_mhigh */
+
+ double *s_locs; /* useful data precalculated for scaling */
+ int *x_locs; /* useful data precalculated for scaling */
+ int x_start;
+ int x_end;
+ int int_constant; /* precalculated for Constrained data fill */
+ RealPixel flt_constant; /* precalculated for UnConstrained data fill */
+
+ int yOut; /* what output line we are on */
+ int out_width; /* output image size */
+ int out_height; /* ... not used */
+ int in_width; /* input image size */
+ int in_height;
+
+ int lo_src_available; /* which input lines we've come across */
+ int hi_src_available;
+
+ void (*linefunc) ();
+ void (*fillfunc) ();
+} mpGeometryBandRec, *mpGeometryBandPtr;
+
+typedef struct _mpgeometrydef {
+ int upside_down;
+ mpGeometryBandPtr bandInfo[xieValMaxBands];
+} mpGeometryDefRec, *mpGeometryDefPtr;
+
+static void FL_R(), FL_b(), FL_B(), FL_P(), FL_Q();
+static void (*fill_lines[5])() = {FL_R, FL_b, FL_B, FL_P, FL_Q,};
+
+static void SL_R(), SL_b(), SL_B(), SL_P(), SL_Q();
+static void GL_R(), GL_b(), GL_B(), GL_P(), GL_Q();
+static void (*scale_lines[5])() = {SL_R, SL_b, SL_B, SL_P, SL_Q,};
+static void (*ggen_lines[5])() = {GL_R, GL_b, GL_B, GL_P, GL_Q,};
+
+#if XIE_FULL
+static void BiSL_R(), BiSL_b(), BiSL_B(), BiSL_P(), BiSL_Q();
+static void BiGL_R(), BiGL_b(), BiGL_B(), BiGL_P(), BiGL_Q();
+static void (*biscale_lines[5])() = {BiSL_R, BiSL_b, BiSL_B, BiSL_P, BiSL_Q,};
+static void (*bigen_lines[5])() = {BiGL_R, BiGL_b, BiGL_B, BiGL_P, BiGL_Q,};
+#endif
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+#if XIE_FULL
+int miAnalyzeGeomBi(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ switch(ped->techVec->number) {
+ case xieValGeomBilinearInterp:
+ ped->ddVec = NearestNeighborVec; /* Yes */
+ break;
+ default:
+ return(FALSE);
+ }
+ return(TRUE);
+} /* end miAnalyzeGeomBi */
+#endif
+
+int miAnalyzeGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ switch(ped->techVec->number) {
+ case xieValGeomNearestNeighbor:
+ ped->ddVec = NearestNeighborVec;
+ break;
+ default:
+ return(FALSE);
+ }
+ return(TRUE);
+} /* end miAnalyzeGeomNN */
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* allocate space for private data */
+ return(MakePETex(flo, ped, sizeof(mpGeometryDefRec), NO_SYNC, NO_SYNC));
+} /* end CreateGeomNN */
+
+/*------------------------------------------------------------------------
+---------------------------- free private data . . . ---------------------
+------------------------------------------------------------------------*/
+static int FreeBandData(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpGeometryDefPtr pvt = (mpGeometryDefPtr) (ped->peTex->private);
+ int band, nbands = ped->inFloLst[SRCtag].bands;
+
+/*
+ * Look for private data to free
+ */
+ for (band = 0 ; band < nbands ; band++) {
+ mpGeometryBandPtr pvtband = pvt->bandInfo[band];
+ if (pvtband) {
+ if (pvtband->x_locs)
+ XieFree(pvtband->x_locs);
+ if (pvtband->s_locs)
+ XieFree(pvtband->s_locs);
+ pvt->bandInfo[band] = (mpGeometryBandPtr) XieFree(pvtband);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+--------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ mpGeometryDefPtr pvt = (mpGeometryDefPtr) (pet->private);
+ xieFloGeometry *raw = (xieFloGeometry *) (ped->elemRaw);
+ pGeomDefPtr pedpvt = (pGeomDefPtr) (ped->elemPvt);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ int band, nbands = ped->inFloLst[SRCtag].bands;
+ mpGeometryBandPtr pvtband;
+#if XIE_FULL
+ BOOL bilinear = (ped->techVec->number ==
+ xieValGeomBilinearInterp);
+#endif
+ /*
+ * x_in = a * x_out + b * y_out + tx
+ * y_in = c * x_out + d * y_out + ty
+ */
+ double a = pedpvt->coeffs[0];
+ double b = pedpvt->coeffs[1];
+ double c = pedpvt->coeffs[2];
+ double d = pedpvt->coeffs[3];
+ double tx = pedpvt->coeffs[4];
+ double ty = pedpvt->coeffs[5];
+ int threshold;
+
+/*
+ * Initialize parameters for tracking input lines, etc.
+ */
+ pvt->upside_down = (d < 0.0);
+
+ for (band = 0 ; band < nbands ; band++, iband++, oband++) {
+ if (pedpvt->do_band[band]) {
+ CARD32 dataclass = pet->emitter[band].format->class;
+
+ pvt->bandInfo[band] = pvtband =
+ (mpGeometryBandPtr) XieCalloc(sizeof(mpGeometryBandRec));
+ if (!pvtband) {
+ FreeBandData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+ if (IsConstrained(dataclass))
+ pvtband->int_constant = ConstrainConst(pedpvt->constant[band],
+ pet->emitter[band].format->levels);
+ else
+ pvtband->flt_constant = (RealPixel) pedpvt->constant[band];
+
+ pvtband->fillfunc =
+ fill_lines[IndexClass(dataclass)];
+#if XIE_FULL
+ pvtband->linefunc = bilinear
+ ? bigen_lines[IndexClass(dataclass)]
+ : ggen_lines[IndexClass(dataclass)];
+#else
+ pvtband->linefunc = ggen_lines[IndexClass(dataclass)];
+#endif
+ pvtband->out_width = oband->format->width;
+ pvtband->in_width = iband->format->width;
+ pvtband->in_height = iband->format->height;
+
+ if (c == 0 && b == 0 ) {
+ int in_width = pvtband->in_width;
+ int width = pvtband->out_width;
+ int x, in_x_coord;
+ double in_x;
+
+ /* For Scaling, can precalculate a lot */
+
+ if (a == 1 && d == 1) {
+ /* just Cropping, no real resampling to be done */
+ }
+#if XIE_FULL
+ pvtband->linefunc = bilinear
+ ? biscale_lines[IndexClass(dataclass)]
+ : scale_lines[IndexClass(dataclass)];
+#else
+ pvtband->linefunc = scale_lines[IndexClass(dataclass)];
+#endif
+ if (!(pvtband->x_locs = (int *) XieMalloc(width * sizeof(int)))) {
+ FreeBandData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+#if XIE_FULL
+ if (bilinear && !(pvtband->s_locs = (double *)
+ XieMalloc(width * sizeof(double)))) {
+ FreeBandData(flo,ped);
+ AllocError(flo, ped, return(FALSE));
+ }
+#endif
+ /* coordinate of line is x_in = a * x_out + tx */
+ /* however, we will map pixel centers to centers, */
+ /* so we plug in output pixel location x_out+0.5 */
+ /* for output_pixel x_out. Happily, finding the */
+ /* nearest pixel centered on the computed input */
+ /* location is then found simply by truncating */
+
+ /* initialize to nonsense values */
+ pvtband->x_start = width;
+ pvtband->x_end = -1;
+
+ in_x = a*PIX0 + tx; /* location of center */
+
+ for (x=0; x<width; ++x) {
+ in_x_coord = in_x; /* closest input pixel */
+ if (in_x_coord >= 0 && in_x_coord < in_width) {
+ /* this pixel is useful */
+ pvtband->x_end = x;
+ if (pvtband->x_start >= width)
+ pvtband->x_start = x;
+ pvtband->x_locs[x] = in_x_coord;
+#if XIE_FULL
+ if (bilinear)
+ pvtband->s_locs[x] = in_x - in_x_coord;
+#endif
+ } else
+ pvtband->x_locs[x] = -1; /* ignore this */
+ in_x += a; /* next center location */
+ }
+ }
+
+ /*
+ * we need to compute the initial input line
+ * number ranges for the entire output image and the first output line.
+ * Just for fun, we will also compute the range for the last output line.
+ * How these limits are computed, of course, may depend on techniqu;
+ */
+
+ /*
+ * For nearest neighbor, we consider lines to have both width and height.
+ * Thus, if an image is of area w x h, we picture the image as being:
+ *
+ * x=0 w-1 w
+ * y=0 ________________________________
+ * | | | | | ... | | |
+ * y=1 ---------------------------------
+ *
+ *
+ * y=h-1 ________________________________
+ * | | | | | ... | | |
+ * y=h ---------------------------------
+ *
+ * The first pixel on the first output line is therefore (.5,.5) and
+ * the last pixel on the last output line is (w-.5,w-.5), etc. We
+ * compute the input line ranges by seeing where the four corners map,
+ * and selecting the coordinates of the pixel whose *center* maps most
+ * closely.
+ *
+ */
+
+ /*
+ * first line of output image
+ */
+ {
+ double left_map,right_map;
+ left_map = c * PIX0 + d * PIX0 + ty;
+ right_map = c * ((pvtband->out_width-1) + PIX0) + d * PIX0 + ty;
+ pvtband->first_mlow = (left_map <= right_map)? left_map : right_map;
+ pvtband->first_mhigh = (left_map >= right_map)? left_map : right_map;
+ }
+
+ /*
+ * coordinates with center closest are just truncated doubles
+ */
+ pvtband->first_ilow = pvtband->first_mlow;
+ pvtband->first_ihigh = pvtband->first_mhigh;
+
+
+ /* set threshold so we get all needed src lines */
+ /* ...if we need line 256, must ask for 257! */
+ threshold = pvtband->first_ihigh + 1;
+#if XIE_FULL
+ if (bilinear) threshold++;
+#endif
+ /* make sure we get something */
+ if (threshold < 1)
+ threshold = 1;
+
+ /* but don't ask for stuff we can't ever get! */
+ if (threshold > pvtband->in_height)
+ threshold = pvtband->in_height;
+
+ if(!InitBand(flo,ped,iband,pvtband->in_height,threshold,NO_INPLACE))
+ return(FALSE);
+ } else {
+ /* we're suppose to pass this band thru unscathed */
+ BypassSrc(flo,pet,iband);
+ }
+ }
+ return(raw->bandMask ? InitEmitter(flo,ped,NO_DATAMAP,NO_INPLACE) : TRUE);
+} /* end InitializeGeomNN */
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ pGeomDefPtr pedpvt = (pGeomDefPtr) (ped->elemPvt);
+ mpGeometryDefPtr pvt = (mpGeometryDefPtr) (ped->peTex->private);
+ bandPtr oband = &(pet->emitter[0]);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+ register pointer outp;
+#if XIE_FULL
+ BOOL bilinear = (ped->techVec->number == xieValGeomBilinearInterp);
+#endif
+
+ for(band = 0; band < nbands; band++, iband++, oband++) {
+
+ mpGeometryBandPtr pvtband = pvt->bandInfo[band];
+ int width;
+
+ if (!pvtband || ((pet->scheduled & (1 << band)) == 0) )
+ continue;
+
+ width = pvtband->out_width;
+ if (pvt->upside_down) {
+
+ /* we're going backwards, which is actually *simpler*,
+ * because we don't get ANY data until we have ALL data.
+ * Thus, first time through, just map everything we have.
+ */
+ if (!pvtband->yOut) {
+ if (!MapData(flo,pet,iband,0,0,iband->maxGlobal,KEEP)) {
+ ImplementationError(flo,ped, return(FALSE));
+ }
+ pvtband->lo_src_available = 0;
+ pvtband->hi_src_available = iband->maxGlobal-1;
+ }
+
+ outp = GetCurrentDst(flo,pet,oband);
+ while (outp) {
+ int lo_in,hi_in;
+
+ /* get range of src lines for this output line */
+ lo_in = pvtband->first_ilow;
+ hi_in = pvtband->first_ihigh;
+
+ /* rest of output image is off input image */
+ if ( (hi_in < 0) || (lo_in > pvtband->hi_src_available) )
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ else
+ /* Compute output pixels for this line */
+#if XIE_FULL
+ (*pvtband->linefunc)(outp,iband->dataMap,width,
+ bilinear ? lo_in : hi_in, pedpvt, pvtband);
+#else
+ (*pvtband->linefunc)(outp,iband->dataMap,width,
+ hi_in, pedpvt, pvtband);
+#endif
+ pvtband->first_mlow += pedpvt->coeffs[3];
+ pvtband->first_mhigh += pedpvt->coeffs[3];
+ pvtband->first_ilow = (int) pvtband->first_mlow ;
+ pvtband->first_ihigh = (int) pvtband->first_mhigh;
+ pvtband->yOut++;
+ outp = GetNextDst(flo,pet,oband,TRUE);
+ }
+ if (oband->final)
+ DisableSrc(flo,pet,iband,FLUSH);
+
+ } else {
+ /*
+ ** nice normal image progression. This means that I know when
+ ** I am done with an input line for the current output line, I
+ ** can purge it, because it won't be needed for subsequent
+ ** output lines.
+ */
+
+ while (!ferrCode(flo)) {
+ int map_lo; /* lowest line mapped by output line */
+ int map_hi; /* highest line mapped by output line */
+ int last_src_line = pvtband->in_height - 1;
+ int threshold;
+
+ /* access current output line */
+ if (!(outp = GetDst(flo,pet,oband,pvtband->yOut,FLUSH))) {
+ if (oband->final)
+ DisableSrc(flo, pet, iband, FLUSH);
+ else if (iband->current != 0)
+ FreeData(flo, pet, iband, iband->current);
+ goto breakout;
+ }
+
+ map_lo = pvtband->first_ilow;
+ if (map_lo < 0)
+ map_lo = 0;
+
+ map_hi = pvtband->first_ihigh;
+#if XIE_FULL
+ if (bilinear) map_hi++;
+#endif
+ if (map_hi > last_src_line)
+ map_hi = last_src_line;
+
+ if (map_hi < 0 || map_lo > last_src_line)
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ else {
+
+ threshold = map_hi - map_lo + 1;
+ if(!MapData(flo,pet,iband,map_lo,map_lo,threshold,KEEP))
+ break;
+
+ if (map_lo != iband->current)
+ ImplementationError(flo,ped, return(FALSE));
+
+ pvtband->lo_src_available = 0;
+ pvtband->hi_src_available = iband->maxGlobal-1;
+
+ (*pvtband->linefunc)(outp,iband->dataMap,
+ width,map_lo,pedpvt,pvtband);
+
+ }
+
+ pvtband->first_mlow += pedpvt->coeffs[3];
+ pvtband->first_mhigh += pedpvt->coeffs[3];
+
+ /* have to be careful about -0.5 rounding to 0, not -1 */
+ if (pvtband->first_ilow < 0) {
+
+ pvtband->first_ilow = (pvtband->first_mlow < 0)
+ ? -1
+ : (int)pvtband->first_mlow;
+
+ pvtband->first_ihigh = (pvtband->first_mhigh < 0)
+ ? -1
+ : (int)pvtband->first_mhigh;
+ } else {
+ /* if ilow was positive before, needn't check for negative */
+ pvtband->first_ilow = (int)pvtband->first_mlow;
+ pvtband->first_ihigh = (int)pvtband->first_mhigh;
+ }
+
+ ++pvtband->yOut;
+
+ if (pvtband->first_ilow > last_src_line) {
+ /* rest of output image is off the input image */
+ /* we will exit after filling output strip */
+ while(outp=GetDst(flo,pet,oband,pvtband->yOut,FLUSH)) {
+ (*pvtband->fillfunc)(outp,width,pvtband);
+ pvtband->yOut++;
+ }
+ if (oband->final)
+ DisableSrc(flo, pet, iband, FLUSH);
+ else
+ goto breakout;
+ }
+
+ map_hi = pvtband->first_ihigh;
+#if XIE_FULL
+ if (bilinear) map_hi++;
+#endif
+ if (map_hi > last_src_line)
+ map_hi = last_src_line;
+
+ threshold = map_hi - iband->current + 1;
+
+ /* make sure we get something */
+ if (threshold <= 1)
+ threshold = 1;
+
+ /* but don't ask for stuff we can't ever get! */
+ if (threshold > pvtband->in_height)
+ threshold = pvtband->in_height;
+
+ SetBandThreshold(iband, threshold);
+ if (map_hi >= (int) iband->maxGlobal) {
+ /* we need to let someone else generate more data */
+ break;
+ }
+ } /* end of while no flo err */
+ /* want to make sure we GetSrc at least once before Freeing */
+ if (iband->current)
+ FreeData(flo, pet, iband, iband->current);
+breakout:
+ ;
+ } /* end of else on normal order */
+ } /* end of band loop */
+ return(TRUE);
+} /* end ActivateGeometry */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ FreeBandData(flo,ped);
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return(TRUE);
+} /* end ResetGeomNN */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyGeomNN(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.flush = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyGeomNN */
+
+/**********************************************************************
+**************************** Fill Routines **************************
+**********************************************************************/
+
+static void FL_b (OUTP,width,pvtband)
+ pointer OUTP;
+ int width;
+ mpGeometryBandPtr pvtband;
+{
+ if (pvtband->int_constant)
+ action_set(OUTP, width, 0);
+ else
+ action_clear(OUTP, width, 0);
+}
+
+#define DO_FL(funcname, iotype, CONST) \
+static void funcname (OUTP,width,pvtband) \
+pointer OUTP; \
+register int width; \
+mpGeometryBandPtr pvtband; \
+{ \
+register iotype constant = (iotype) pvtband->CONST; \
+register iotype *outp = (iotype *) OUTP; \
+ \
+ for ( ; width > 0; width--) *outp++ = constant; \
+}
+
+DO_FL (FL_R, RealPixel, flt_constant)
+DO_FL (FL_B, BytePixel, int_constant)
+DO_FL (FL_P, PairPixel, int_constant)
+DO_FL (FL_Q, QuadPixel, int_constant)
+
+/**********************************************************************
+********************** Neareast Neighbor - Separable ****************
+**********************************************************************/
+
+/* (x,y) separable routines (eg, scale, mirror_x, mirror_y) */
+
+static void SL_b (OUTP,srcimg,width,sline,pedpvt,pvtband)
+ pointer OUTP, *srcimg;
+ register int width;
+ int sline;
+ pGeomDefPtr pedpvt;
+ mpGeometryBandPtr pvtband;
+{
+ register int xbeg = pvtband->x_start;
+ register int xend = pvtband->x_end;
+ register int *x_locs = pvtband->x_locs;
+ register LogInt *src = (LogInt *) (srcimg[sline]);
+ register LogInt *outp = (LogInt *) OUTP;
+ register LogInt outval, M, fill;
+ register int i= 0, w;
+
+ fill = (pvtband->int_constant ? ~(LogInt)0 : 0);
+
+ for (w = xbeg >> LOGSHIFT; w > 0; w--, i+=LOGSIZE) *outp++ = fill;
+
+ if (xbeg & LOGMASK) {
+ outval = BitLeft(fill,LOGSIZE-i);
+ for (i = xbeg, M=LOGBIT(i) ; M && i <= xend ; LOGRIGHT(M), i++)
+ if (LOG_tstbit(src,x_locs[i]))
+ outval |= M;
+ if (i > xend) {
+ if (fill) outval |= ~BitLeft(fill,LOGSIZE-i);
+ i = (i+LOGMASK) & ~LOGMASK;
+ }
+ *outp++ = outval;
+ }
+
+ if ( i <= xend) {
+ w = (xend - i + 1) >> LOGSHIFT;
+ for ( ; w > 0; w--, *outp++ = outval)
+ for (outval = 0, M=LOGLEFT ; M ; LOGRIGHT(M), i++)
+ if (LOG_tstbit(src,x_locs[i]))
+ outval |= M;
+
+ for (outval = 0, M=LOGLEFT; i <= xend; LOGRIGHT(M), i++)
+ if (LOG_tstbit(src,x_locs[i]))
+ outval |= M;
+
+ if (i & LOGMASK) {
+ if (fill) outval |= ~BitLeft(fill,LOGSIZE-i);
+ i = (i+LOGMASK) & ~LOGMASK;
+ *outp++ = outval;
+ }
+ }
+ for ( ; i < width; i += LOGSIZE) *outp++ = fill;
+}
+
+#define DO_SL(funcname, iotype, CONST) \
+static void funcname (OUTP,srcimg,width,sline,pedpvt,pvtband) \
+register pointer OUTP; \
+register pointer *srcimg; \
+register int width,sline; \
+pGeomDefPtr pedpvt; \
+mpGeometryBandPtr pvtband; \
+{ \
+register int xbeg = pvtband->x_start; \
+register int xend = pvtband->x_end; \
+register int *x_locs = pvtband->x_locs; \
+register iotype constant = (iotype) pvtband->CONST; \
+register iotype *src = (iotype *) (srcimg[sline]); \
+register iotype *outp = (iotype *) OUTP; \
+register int i; \
+ for (i=0; i < xbeg; ++i) *outp++ = constant; \
+ for ( ; i <= xend; ++i) *outp++ = src[x_locs[i]]; \
+ for ( ; i < width; ++i) *outp++ = constant; \
+}
+
+DO_SL (SL_R, RealPixel, flt_constant)
+DO_SL (SL_B, BytePixel, int_constant)
+DO_SL (SL_P, PairPixel, int_constant)
+DO_SL (SL_Q, QuadPixel, int_constant)
+
+/**********************************************************************
+************************* Bilinear - Seperable **********************
+**********************************************************************/
+#if XIE_FULL
+
+/* note - could use BiGL_b since this is a silly anyway */
+
+static void BiSL_b (OUTP,srcimg,width,sline,pedpvt,pvtband)
+pointer OUTP;
+pointer *srcimg;
+register int width;
+int sline;
+pGeomDefPtr pedpvt;
+mpGeometryBandPtr pvtband;
+{
+register double s, t, st, result;
+register int isrcpix;
+register int *x_locs = pvtband->x_locs;
+register double *s_locs = pvtband->s_locs;
+register LogInt constant, val, M, *ptrIn, *ptrJn;
+register LogInt *outp = (LogInt *) OUTP;
+register int srcwidth = pvtband->in_width - 1;
+
+ if ( (sline >= pvtband->hi_src_available) ||
+ (sline < pvtband->lo_src_available) ) {
+ FL_b(outp, width, pvtband);
+ return;
+ }
+
+ t = pvtband->first_mlow; t -= ((int)t);
+ M=LOGLEFT; val = 0;
+ constant = pvtband->int_constant;
+ ptrIn = (LogInt *) srcimg[sline];
+ ptrJn = (LogInt *) srcimg[sline+1];
+ while ( width > 0 ) {
+ isrcpix = *x_locs++;
+ s = *s_locs++;
+ if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) {
+ st = s * t;
+ result = 0.;
+ if (LOG_tstbit(ptrIn,isrcpix)) result =
+ ((double)1. - s - t + st);
+ if (LOG_tstbit(ptrIn,isrcpix+1)) result += (s - st);
+ if (LOG_tstbit(ptrJn,isrcpix)) result += (t - st);
+ if (LOG_tstbit(ptrJn,isrcpix+1)) result += st;
+ if (result > 0.5) val |= M;
+ } else if (constant) val |= M;
+ width--;
+ LOGRIGHT(M); if (!M) { *outp++ = val; M=LOGLEFT; val = 0; }
+ }
+ if (M != LOGLEFT) *outp = val;
+}
+
+#define BI_SL(funcname, iotype, CONST, ROUND) \
+static void funcname (OUTP,srcimg,width,sline,pedpvt,pvtband) \
+pointer OUTP; \
+pointer *srcimg; \
+register int width; \
+int sline; \
+pGeomDefPtr pedpvt; \
+mpGeometryBandPtr pvtband; \
+{ \
+register int *x_locs = pvtband->x_locs; \
+register double *s_locs = pvtband->s_locs; \
+register iotype constant = (iotype) pvtband->CONST; \
+register iotype *outp = (iotype *) OUTP; \
+register iotype *src = (iotype *) (srcimg[sline]); \
+register iotype *trc; \
+register int i, j, in_width = pvtband->in_width - 1; \
+register double s, t, st; \
+register iotype val; \
+ \
+ t = pvtband->first_mlow; t -= ((int)t); \
+ if (sline >= pvtband->hi_src_available) \
+ trc = src; /* or fill line with constant */ \
+ else \
+ trc = (iotype *) (srcimg[sline+1]); \
+ for (i = 0; i < width; i++) { \
+ j = x_locs[i]; \
+ s = s_locs[i]; \
+ val = constant; \
+ if (j >= 0 && j < in_width) { \
+ st = s * t; \
+ val = src[j] * ((float)1. - s - t + st) + \
+ src[j+1] * (s - st) + \
+ trc[j] * (t - st) + \
+ trc[j+1] * (st) + ROUND; \
+ } \
+ *outp++ = val; \
+ } \
+}
+
+BI_SL (BiSL_R, RealPixel, flt_constant, (float)0.0)
+BI_SL (BiSL_B, BytePixel, int_constant, (float)0.5)
+BI_SL (BiSL_P, PairPixel, int_constant, (float)0.5)
+BI_SL (BiSL_Q, QuadPixel, int_constant, (float)0.5)
+#endif
+
+/**********************************************************************
+********************** Neareast Neighbor - General ******************
+**********************************************************************/
+
+/* NOTE: for GL routines, would be better to keep running srcpix,
+** and srcline variables outside of scan line routine.
+*/
+
+static void GL_b (OUTP,srcimg,width,sline,pedpvt,pvtband)
+pointer OUTP;
+pointer *srcimg;
+register int width;
+int sline;
+pGeomDefPtr pedpvt;
+mpGeometryBandPtr pvtband;
+{
+register double a = pedpvt->coeffs[0];
+register double c = pedpvt->coeffs[2];
+register double srcpix = a * PIX0 +
+ pedpvt->coeffs[1] * (pvtband->yOut + PIX0) +
+ pedpvt->coeffs[4];
+register double srcline = c * PIX0 +
+ pedpvt->coeffs[3] * (pvtband->yOut + PIX0) +
+ pedpvt->coeffs[5];
+register int isrcline,isrcpix;
+register LogInt constant, val, M, *ptrIn;
+register LogInt *outp = (LogInt *) OUTP;
+register int srcwidth = pvtband->in_width;
+register int minline = pvtband->lo_src_available;
+register int maxline = pvtband->hi_src_available;
+
+
+ constant = pvtband->int_constant ? ~(LogInt) 0 : 0;
+ /* could pull out inner if (constant) */
+ M=LOGLEFT; val = constant;
+ while ( width > 0 ) {
+ /* in our coordinate system, truncate does a round */
+ isrcline = srcline;
+ isrcpix = srcpix;
+ /* prepare for next loop */
+ width--;
+ srcline += c;
+ srcpix += a;
+ /* if (isrcline,isrcpix) not in src image, fill w/val*/
+ if ( (isrcline >= minline) && (isrcline <= maxline) ) {
+ ptrIn = (LogInt *) srcimg[isrcline];
+ if ( (isrcpix >= 0) && (isrcpix < srcwidth) && ptrIn )
+ if (LOG_chgbit(ptrIn,isrcpix,constant))
+ val ^= M;
+ }
+ LOGRIGHT(M); if (!M) { *outp++ = val; M=LOGLEFT; val = constant; }
+ }
+ if (M != LOGLEFT) *outp = val;
+}
+
+
+#define DO_GL(funcname, iotype, CONST) \
+static void funcname (OUTP,srcimg,width,sline,pedpvt,pvtband) \
+pointer OUTP; \
+pointer *srcimg; \
+register int width; \
+int sline; \
+pGeomDefPtr pedpvt; \
+mpGeometryBandPtr pvtband; \
+{ \
+register double a = pedpvt->coeffs[0]; \
+register double c = pedpvt->coeffs[2]; \
+register double srcpix = a * PIX0 + \
+ pedpvt->coeffs[1] * (pvtband->yOut + PIX0) + \
+ pedpvt->coeffs[4]; \
+register double srcline = c * PIX0 + \
+ pedpvt->coeffs[3] * (pvtband->yOut + PIX0) + \
+ pedpvt->coeffs[5]; \
+register int isrcline,isrcpix; \
+register iotype constant = (iotype) pvtband->CONST; \
+register iotype *outp = (iotype *) OUTP; \
+register iotype *ptrIn; \
+register iotype val; \
+/* some variables which describe available input data (for clipping) */ \
+register int srcwidth = pvtband->in_width; \
+register int minline = pvtband->lo_src_available; \
+register int maxline = pvtband->hi_src_available; \
+ \
+ while ( width > 0 ) { \
+ isrcline = srcline; \
+ isrcpix = srcpix; \
+ width--; \
+ srcline += c; \
+ srcpix += a; \
+ val = constant; \
+ if ( (isrcline >= minline) && (isrcline <= maxline) ) { \
+ ptrIn = (iotype *) srcimg[isrcline]; \
+ if ( (isrcpix >= 0) && \
+ (isrcpix < srcwidth) && \
+ ptrIn ) \
+ val = ptrIn[isrcpix]; \
+ } \
+ *outp++ = val; \
+ } \
+}
+
+DO_GL (GL_R, RealPixel, flt_constant)
+DO_GL (GL_B, BytePixel, int_constant)
+DO_GL (GL_P, PairPixel, int_constant)
+DO_GL (GL_Q, QuadPixel, int_constant)
+
+/**********************************************************************
+************************* Bilinear - General ************************
+**********************************************************************/
+#if XIE_FULL
+
+static void BiGL_b (OUTP,srcimg,width,sline,pedpvt,pvtband)
+pointer OUTP;
+pointer *srcimg;
+register int width;
+int sline;
+pGeomDefPtr pedpvt;
+mpGeometryBandPtr pvtband;
+{
+register float s, t, st, result;
+register double a = pedpvt->coeffs[0];
+register double c = pedpvt->coeffs[2];
+register double srcpix = a * PIX0 +
+ pedpvt->coeffs[1] * (pvtband->yOut + PIX0) +
+ pedpvt->coeffs[4];
+register double srcline = c * PIX0 +
+ pedpvt->coeffs[3] * (pvtband->yOut + PIX0) +
+ pedpvt->coeffs[5];
+register int isrcline,isrcpix;
+register LogInt constant, val, M, *ptrIn, *ptrJn;
+register LogInt *outp = (LogInt *) OUTP;
+register int srcwidth = pvtband->in_width - 1;
+register int minline = pvtband->lo_src_available;
+register int maxline = pvtband->hi_src_available;
+
+ constant = pvtband->int_constant;
+ M=LOGLEFT; val = 0;
+ while ( width > 0 ) {
+ isrcline = srcline;
+ isrcpix = srcpix;
+ if ( (isrcline >= minline) && (isrcline < maxline) ) {
+ s = srcpix - isrcpix;
+ t = srcline - isrcline;
+ ptrIn = (LogInt *) srcimg[isrcline];
+ ptrJn = (LogInt *) srcimg[isrcline+1];
+ if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) {
+ st = s * t;
+ result = 0.;
+ if (LOG_tstbit(ptrIn,isrcpix)) result =
+ ((float)1. - s - t + st);
+ if (LOG_tstbit(ptrIn,isrcpix+1)) result += (s - st);
+ if (LOG_tstbit(ptrJn,isrcpix)) result += (t - st);
+ if (LOG_tstbit(ptrJn,isrcpix+1)) result += st;
+ if (result > (float) 0.5) val |= M;
+ } else if (constant) val |= M;
+ } else if (constant) val |= M;
+ LOGRIGHT(M); if (!M) { *outp++ = val; M=LOGLEFT; val = 0; }
+ width--;
+ srcline += c;
+ srcpix += a;
+ }
+ if (M != LOGLEFT) *outp = val;
+}
+
+#define BI_GL(funcname, iotype, CONST, ROUND) \
+static void funcname (OUTP,srcimg,width,sline,pedpvt,pvtband) \
+pointer OUTP; \
+pointer *srcimg; \
+register int width; \
+int sline; \
+pGeomDefPtr pedpvt; \
+mpGeometryBandPtr pvtband; \
+{ \
+register float s, t, st; \
+register double a = pedpvt->coeffs[0]; \
+register double c = pedpvt->coeffs[2]; \
+register double srcpix = a * PIX0 + \
+ pedpvt->coeffs[1] * (pvtband->yOut + PIX0) + \
+ pedpvt->coeffs[4]; \
+register double srcline = c * PIX0 + \
+ pedpvt->coeffs[3] * (pvtband->yOut + PIX0) + \
+ pedpvt->coeffs[5]; \
+register int isrcline,isrcpix; \
+register iotype constant = (iotype) pvtband->CONST; \
+register iotype *outp = (iotype *) OUTP; \
+register iotype *ptrIn, *ptrJn; \
+register iotype val; \
+/* some variables which describe available input data (for clipping) */ \
+register int srcwidth = pvtband->in_width - 1; \
+register int minline = pvtband->lo_src_available; \
+register int maxline = pvtband->hi_src_available; \
+ \
+ /* in our coordinate system, truncate does a round */ \
+ while ( width > 0 ) { \
+ isrcline = srcline; \
+ isrcpix = srcpix; /* no fpu?, move down in 'if' */ \
+ val = constant; \
+ if ( (isrcline >= minline) && (isrcline < maxline) ) { \
+ s = srcpix - isrcpix; \
+ ptrIn = (iotype *) srcimg[isrcline]; \
+ t = srcline - isrcline; \
+ ptrJn = (iotype *) srcimg[isrcline+1]; \
+ st = s * t; \
+ if ( (isrcpix >= 0) && (isrcpix < srcwidth) ) \
+ val = \
+ ptrIn[isrcpix] * ((float)1. - s - t + st) + \
+ ptrIn[isrcpix+1] * (s - st) + \
+ ptrJn[isrcpix] * (t - st) + \
+ ptrJn[isrcpix+1] * (st) + ROUND; \
+ } \
+ /* prepare for next loop */ \
+ width--; \
+ srcline += c; \
+ srcpix += a; \
+ *outp++ = val; \
+ } \
+}
+
+BI_GL (BiGL_R, RealPixel, flt_constant, (float)0.0)
+BI_GL (BiGL_B, BytePixel, int_constant, (float)0.5)
+BI_GL (BiGL_P, PairPixel, int_constant, (float)0.5)
+BI_GL (BiGL_Q, QuadPixel, int_constant, (float)0.5)
+#endif
+/**********************************************************************/
+
+/* end module mpgeomnn.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mphist.c b/xc/programs/Xserver/XIE/mixie/process/mphist.c
new file mode 100644
index 000000000..bd5324c7d
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mphist.c
@@ -0,0 +1,563 @@
+/* $TOG: mphist.c /main/5 1998/02/09 16:22:20 kaleb $ */
+/**** module mphist.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mphist.c -- DDXIE match histogram element
+
+ Larry Hare -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mphist.c,v 3.3 1998/10/05 13:22:45 dawes Exp $ */
+
+#define _XIEC_MPHIST
+#define _XIEC_PHIST
+
+/*
+ * Include files
+ */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/* routines referenced by other DDXIE modules
+ */
+int miAnalyzeMatchHist();
+
+/* routines used internal to this module
+ */
+static int CreateMatchHist();
+static int InitializeMatchHist();
+static int ActivateMatchHist();
+static int ResetMatchHist();
+static int DestroyMatchHist();
+
+/* DDXIE Match Histogram entry points
+ */
+static ddElemVecRec MatchHistVec = {
+ CreateMatchHist,
+ InitializeMatchHist,
+ ActivateMatchHist,
+ (xieIntProc)NULL,
+ ResetMatchHist,
+ DestroyMatchHist
+ };
+
+/* declarations for private structures and actions procs ... */
+
+typedef RealPixel MatchFloat;
+
+static void match_hist(), flat_pdf(), gauss_pdf(), hyper_pdf();
+
+typedef struct {
+ CARD32 histphase;
+ CARD32 histsize;
+ CARD32 *histdata;
+ void (*histproc) ();
+ void (*lutproc) ();
+} miMatchHistRec, *miMatchHistPtr;
+
+static void doHistQ(), doHistP(), doHistB();
+static void doLutQ(), doLutP(), doLutB();
+
+
+/*------------------------------------------------------------------------
+------------------- see if we can handle this element --------------------
+------------------------------------------------------------------------*/
+int miAnalyzeMatchHist(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = MatchHistVec;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateMatchHist(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* attach an execution context to the photo element definition */
+
+ /* always force syncing between inputs (is nop if only one input) */
+ return MakePETex(flo, ped, sizeof(miMatchHistRec), SYNC, NO_SYNC);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeMatchHist(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ receptorPtr rcp = pet->receptor;
+ bandPtr iband;
+ CARD32 nclip;
+ xieFloMatchHistogram *raw = (xieFloMatchHistogram *)ped->elemRaw;
+ miMatchHistPtr pvt = (miMatchHistPtr)(pet->private);
+
+ iband = &(pet->receptor[SRCtag].band[0]);
+
+ SetDepthFromLevels(iband->format->levels,nclip); nclip = 1 << nclip;
+
+ switch (iband->format->class) {
+ case QUAD_PIXEL: pvt->histproc = doHistQ;
+ pvt->lutproc = doLutQ;
+ break;
+ case PAIR_PIXEL: pvt->histproc = doHistP;
+ pvt->lutproc = doLutP;
+ break;
+ case BYTE_PIXEL: pvt->histproc = doHistB;
+ pvt->lutproc = doLutB;
+ break;
+ default: ImplementationError(flo, ped, return(FALSE));
+ }
+
+ pvt->histphase = 1;
+ pvt->histsize = nclip;
+ if (!(pvt->histdata = (CARD32 *) XieCalloc(nclip * sizeof(CARD32))))
+ AllocError(flo,ped,return(FALSE));
+
+ return InitReceptor(flo,ped,&rcp[SRCt1],NO_DATAMAP,1,1,NO_BANDS) &&
+ InitProcDomain(flo, ped, raw->domainPhototag,
+ raw->domainOffsetX, raw->domainOffsetY) &&
+ InitEmitter(flo,ped,NO_DATAMAP,SRCt1);
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+static int ActivateMatchHist(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ xieFloMatchHistogram *raw = (xieFloMatchHistogram *)ped->elemRaw;
+ miMatchHistPtr pvt = (miMatchHistPtr)(pet->private);
+ receptorPtr rcp = pet->receptor;
+ bandPtr sbnd = &rcp->band[0];
+ bandPtr dbnd = &pet->emitter[0];
+
+
+ if (pvt->histphase == 1) {
+ pointer src;
+
+ src = GetCurrentSrc(flo,pet,sbnd);
+ while(!ferrCode(flo) && src && SyncDomain(flo,ped,sbnd,KEEP)) {
+ INT32 x = 0, dx;
+ while (dx = GetRun(flo,pet,sbnd)) {
+ if (dx > 0) {
+ (*(pvt->histproc)) (src,pvt->histdata,pvt->histsize,x,dx);
+ x += dx; /* nhist += dx; */
+ } else
+ x -= dx;
+ }
+ src = GetNextSrc(flo,pet,sbnd,KEEP);
+ }
+
+ /* Is it time to switch to phase2 */
+ if (src || !sbnd->final) {
+ /*
+ Since we are keeping data for the second pass, we need to
+ keep incrementing the threshold so that we won't get activated
+ until new data is available.
+ */
+ SetBandThreshold(sbnd, sbnd->current + 1);
+ return (TRUE);
+ }
+ pvt->histphase = 2;
+ }
+
+ /* finished with accumulation, figure out desired LUT */
+ if (pvt->histphase == 2) {
+
+ CARD32 nlev = sbnd->format->levels;
+ CARD32 nclip = pvt->histsize;
+ MatchFloat *pdfdata, pdftemp[256];
+
+
+ /*
+ ** NOTE: Could try to maintain for longer periods of time,
+ ** OR could try to put on stack for small sizes.
+ */
+ if (nclip <= 256)
+ pdfdata = &pdftemp[0];
+ else if (!(pdfdata = (MatchFloat *)
+ XieMalloc(nclip*sizeof(MatchFloat))))
+ AllocError(flo,ped,return(FALSE));
+
+ /* generate LUT based on match curve type */
+ switch (raw->shape) {
+ case xieValHistogramFlat:
+ flat_pdf(NULL, pdfdata, nlev);
+ break;
+ case xieValHistogramGaussian:
+ gauss_pdf((pTecHistogramGaussianDefPtr)ped->techPvt,
+ pdfdata, nlev);
+ break;
+ case xieValHistogramHyperbolic:
+ hyper_pdf((pTecHistogramHyperbolicDefPtr)ped->techPvt,
+ pdfdata, nlev);
+ break;
+ default:
+ if (nclip > 256) (void) XieFree(pdfdata);
+ ImplementationError(flo, ped, return(FALSE));
+ }
+
+ /* match the histogram and the new shape */
+ match_hist(pvt->histdata, pdfdata, nlev);
+
+ if (nclip > 256) (void) XieFree(pdfdata);
+
+
+ if (nclip > nlev) {
+ /* zero tail entries, then mask instead of compare input pixels */
+ bzero(pvt->histdata + nlev, (nclip - nlev) * sizeof(CARD32));
+ }
+
+ /* Reset src to start from scratch.
+ ** The domain automatically resyncs in the SyncDomain call.
+ */
+ (void) GetSrc(flo,pet,sbnd,0,KEEP);
+ pvt->histphase = 3;
+ }
+ /* now processing to create actual outputs */
+ if (pvt->histphase == 3) {
+ pointer src, dst;
+
+ src = GetCurrentSrc(flo,pet,sbnd);
+ dst = GetCurrentDst(flo,pet,dbnd);
+ while(!ferrCode(flo) && src && dst && SyncDomain(flo,ped,dbnd,FLUSH)) {
+ INT32 x = 0, dx;
+ if (src != dst) memcpy (dst, src, dbnd->pitch);
+ while (dx = GetRun(flo,pet,dbnd)) {
+ if (dx > 0) {
+ (*(pvt->lutproc)) (dst,pvt->histdata,pvt->histsize,x,dx);
+ x += dx; /* nhist += dx; */
+ } else
+ x -= dx;
+ }
+ src = GetNextSrc(flo,pet,sbnd,FLUSH);
+ dst = GetNextDst(flo,pet,dbnd,FLUSH);
+ }
+ FreeData(flo,pet,sbnd,sbnd->current);
+
+ /* when dbnd->final goes true, we are done */
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetMatchHist(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ miMatchHistPtr pvt = (miMatchHistPtr)(ped->peTex->private);
+ if (pvt && pvt->histdata)
+ pvt->histdata = (CARD32 *) XieFree(pvt->histdata);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyMatchHist(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc) NULL;
+ ped->ddVec.initialize = (xieIntProc) NULL;
+ ped->ddVec.activate = (xieIntProc) NULL;
+ ped->ddVec.reset = (xieIntProc) NULL;
+ ped->ddVec.destroy = (xieIntProc) NULL;
+
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+------------------------ action procs to do histogram --------------------
+------------------------------------------------------------------------*/
+
+/*
+** NOTE: Consider revamping Export Client Histogram to not use
+** 'pvt' structure so that more sharing of code (and thus potential
+** future optimizations) is possible.
+*/
+
+static void
+doHistQ(svoid,hist,clip,x,dx)
+ pointer svoid;
+ CARD32 *hist, clip, x, dx;
+{
+ QuadPixel *src = (QuadPixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++;
+}
+
+static void
+doHistP(svoid,hist,clip,x,dx)
+ pointer svoid;
+ CARD32 *hist, clip, x, dx;
+{
+ PairPixel *src = (PairPixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++;
+}
+
+static void
+doHistB(svoid,hist,clip,x,dx)
+ pointer svoid;
+ CARD32 *hist, clip, x, dx;
+{
+ BytePixel *src = (BytePixel *) svoid;
+
+ for ( src += x, clip -= 1; dx > 0 ; dx--)
+ hist[*src++ & clip]++;
+}
+
+
+
+/*------------------------------------------------------------------------
+------------------------ action procs to process lut --------------------
+------------------------------------------------------------------------*/
+
+static void
+doLutQ(dvoid,lut,clip,x,dx)
+ pointer dvoid;
+ CARD32 *lut, clip, x, dx;
+{
+ QuadPixel *dst = (QuadPixel *) dvoid;
+
+ for ( dst += x, clip -= 1; dx > 0 ; dx--, dst++)
+ *dst = lut[*dst & clip];
+}
+
+static void
+doLutP(dvoid,lut,clip,x,dx)
+ pointer dvoid;
+ CARD32 *lut, clip, x, dx;
+{
+ PairPixel *dst = (PairPixel *) dvoid;
+
+ for ( dst += x, clip -= 1; dx > 0 ; dx--, dst++)
+ *dst = lut[*dst & clip];
+}
+
+static void
+doLutB(dvoid,lut,clip,x,dx)
+ pointer dvoid;
+ CARD32 *lut, clip, x, dx;
+{
+ BytePixel *dst = (BytePixel *) dvoid;
+
+ for ( dst += x, clip -= 1; dx > 0 ; dx--, dst++)
+ *dst = lut[*dst & clip];
+}
+
+
+/*------------------------------------------------------------------------
+-------------------------- process matching curves -----------------------
+------------------------------------------------------------------------*/
+
+
+static void
+match_hist(hptr, pdf, nlev)
+ CARD32 *hptr;
+ MatchFloat *pdf;
+ CARD32 nlev;
+{
+ double sum, sf;
+ MatchFloat match, closest, delta;
+ CARD32 ilev, jlev, plev, hsum;
+
+ /* sum up the probability curve distribution */
+ for (sum=0., ilev = 0; ilev < nlev; ilev++)
+ sum += pdf[ilev];
+
+ /* normalize and accumulate the pdf */
+ sf = 1.0 / (sum ? sum : 1.0);
+ for (sum=0., ilev = 0; ilev < nlev; ilev++) {
+ sum += pdf[ilev];
+ pdf[ilev] = sum * sf;
+ }
+
+ /* count up the histogram entries */
+ for (hsum=0, ilev = 0; ilev < nlev ; ilev++) {
+ hsum += hptr[ilev];
+ }
+
+ /* match the histogram and the new shape */
+ sf = 1.0 / (double) (hsum ? hsum : 1.0);
+ for (ilev=0, plev=0, hsum=0; ilev < nlev ; ilev++) {
+ hsum += hptr[ilev];
+ match = (MatchFloat) hsum * sf; /* normalize, accumulate */
+
+ /* search forwards to find closest match */
+ for (jlev = plev, closest = 99.0 ; jlev < nlev ; jlev++) {
+
+ delta = match - pdf[jlev];
+ if (delta < 0.) delta = -delta;
+
+ if (delta == 0.) {jlev++; break; }
+ else if (delta < closest) closest = delta;
+ else if (delta > closest) break;
+ }
+ hptr[ilev] = plev = jlev - 1;
+ }
+}
+
+static void
+flat_pdf(raw, pdf, nlev)
+ pTecHistogramGaussianDefPtr raw;
+ MatchFloat *pdf;
+ CARD32 nlev;
+{
+ CARD32 ilev;
+ double sf = 1.0 / (double) nlev;
+
+ for (ilev = 0; ilev < nlev; ilev++)
+ *pdf++ = sf;
+}
+
+static void
+gauss_pdf(raw, pdf, nlev)
+ pTecHistogramGaussianDefPtr raw;
+ MatchFloat *pdf;
+ CARD32 nlev;
+{
+ CARD32 ilev;
+ double mean, sigma, a, b, xx;
+
+ mean = raw->mean;
+ sigma = raw->sigma;
+
+ a = 1.0 / sqrt ( 2.0 * M_PI ); /* .39894228 ..... */
+ b = 2.0 * sigma * sigma;
+
+ for (ilev = 0; ilev < nlev; ilev++) {
+ xx = (double) ilev - mean;
+ pdf[ilev] = a * exp( - (xx * xx) / b);
+ }
+}
+
+static void
+hyper_pdf(raw, pdf, nlev)
+ pTecHistogramHyperbolicDefPtr raw;
+ MatchFloat *pdf;
+ CARD32 nlev;
+{
+ CARD32 ilev;
+ BOOL sf;
+ double cnst, lg;
+
+
+ sf = raw->shapeFactor;
+ cnst = raw->constant;
+ lg = log(1.0 + 1.0 / cnst);
+
+ for (ilev = 0; ilev < nlev; ilev++)
+ pdf[ilev] = 1.0 / (((double)(sf ? nlev-1-ilev : ilev) + cnst) * lg);
+}
+
+/* end module mphist.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mplogic.c b/xc/programs/Xserver/XIE/mixie/process/mplogic.c
new file mode 100644
index 000000000..39e826a93
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mplogic.c
@@ -0,0 +1,810 @@
+/* $TOG: mplogic.c /main/9 1998/02/09 16:22:25 kaleb $ */
+/**** module mplogic.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mplogic.c -- DDXIE logic element
+
+ Larry Hare -- AGE Logic, Inc. July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mplogic.c,v 3.3 1998/10/05 13:22:46 dawes Exp $ */
+
+
+#define _XIEC_MPLOGIC
+#define _XIEC_PLOGIC
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeLogic();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateLogic();
+static int InitializeLogic();
+static int ResetLogic();
+static int DestroyLogic();
+
+static int ActivateLogicM();
+static int ActivateLogicD();
+static int ActivateLogicMROI();
+static int ActivateLogicDROI();
+
+/*
+ * DDXIE Logic entry points
+ */
+static ddElemVecRec LogicVec = {
+ CreateLogic,
+ InitializeLogic,
+ ActivateLogicM,
+ (xieIntProc)NULL,
+ ResetLogic,
+ DestroyLogic
+ };
+
+/*
+ * Local Declarations.
+ */
+
+typedef struct _mplogicdef {
+ void (*action) ();
+ void (*action2) ();
+ CARD32 cnst;
+ CARD32 endrun;
+ CARD32 endix;
+} mpLogicPvtRec, *mpLogicPvtPtr;
+
+#define SHIFT_FROM_LEVELS(shift,levels) \
+{ CARD32 _lev = levels; \
+ shift = _lev <= 256 ? (_lev <= 2 ? 0 : 3 ) : (_lev <=65536 ? 4 : 5); \
+}
+
+static CARD32 rep_cnst();
+
+/*
+** NOTE: might change over to use mergerops (see mfb/mergerop.h)
+** NOTE: might change constant operations to use dyads with prefilled
+** constant strip; this would slow them down, but would
+** conserve code space.
+*/
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeLogic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = LogicVec;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateLogic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* always force syncing between inputs (is nop if only one input) */
+ return MakePETex(flo,ped,
+ xieValMaxBands * sizeof(mpLogicPvtRec),
+ SYNC, /* InSync: Make sure ROI exists first */
+ NO_SYNC /* bandSync: see CreateLogic */
+ );
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+static int ActivateLogicM(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpLogicPvtPtr pvt = (mpLogicPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, dband++) {
+ int pitch = sband->format->pitch; /* bits */
+ LogInt *svoid, *dvoid;
+
+ if (!(svoid = (LogInt*)GetCurrentSrc(flo,pet,sband)) ||
+ !(dvoid = (LogInt*)GetCurrentDst(flo,pet,dband))) continue;
+
+ do {
+ (*(pvt->action)) (dvoid, svoid, pvt->cnst, pitch);
+ svoid = (LogInt*)GetNextSrc(flo,pet,sband,FLUSH);
+ dvoid = (LogInt*)GetNextDst(flo,pet,dband,FLUSH);
+ } while (!ferrCode(flo) && svoid && dvoid) ;
+
+ FreeData(flo, pet, sband, sband->current);
+ }
+ return TRUE;
+}
+
+static int ActivateLogicD(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpLogicPvtPtr pvt = (mpLogicPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, tband++, dband++) {
+ LogInt *svoid, *tvoid, *dvoid;
+
+ if (!(svoid = (LogInt*)GetCurrentSrc(flo,pet,sband)) ||
+ !(tvoid = (LogInt*)GetCurrentSrc(flo,pet,tband)) ||
+ !(dvoid = (LogInt*)GetCurrentDst(flo,pet,dband)) ) continue;
+
+ do {
+ /* This is the code that might rather utilize INPLACE */
+ (*(pvt->action)) (dvoid, svoid, tvoid, pvt->endix);
+ if (pvt->action2)
+ (*(pvt->action2)) (dvoid, svoid, pvt->endrun, pvt->endix);
+ svoid = (LogInt*)GetNextSrc(flo,pet,sband,FLUSH);
+ tvoid = (LogInt*)GetNextSrc(flo,pet,tband,FLUSH);
+ dvoid = (LogInt*)GetNextDst(flo,pet,dband,FLUSH);
+ } while (!ferrCode(flo) && svoid && tvoid && dvoid) ;
+
+ if(!svoid && sband->final) /* when sr1 runs out, kill sr2 too */
+ DisableSrc(flo,pet,tband,FLUSH);
+ else if(!tvoid && tband->final) /* when sr2 runs out, pass-thru sr1 */
+ BypassSrc(flo,pet,sband);
+ else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sband,sband->current);
+ FreeData(flo,pet,tband,tband->current);
+ }
+ }
+ return TRUE;
+}
+
+static int ActivateLogicMROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpLogicPvtPtr pvt = (mpLogicPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, dband++) {
+ pointer svoid, dvoid;
+ CARD32 shift;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ SHIFT_FROM_LEVELS(shift, dband->format->levels)
+
+ while (!ferrCode(flo) && svoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ if (svoid != dvoid) memcpy(dvoid, svoid, dband->pitch);
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ (*(pvt->action)) (dvoid, pvt->cnst,
+ run << shift, ix << shift);
+ ix += run;
+ } else
+ ix -= run;
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ FreeData(flo, pet, sband, sband->current);
+ }
+ return TRUE;
+}
+
+static int ActivateLogicDROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpLogicPvtPtr pvt = (mpLogicPvtPtr) pet->private;
+ int band, nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr tband = &(pet->receptor[SRCt2].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, sband++, tband++, dband++) {
+ pointer svoid, tvoid, dvoid;
+ CARD32 shift, w;
+
+ w = sband->format->width;
+ if (w > tband->format->width) w = tband->format->width;
+
+ if (!(svoid = GetCurrentSrc(flo,pet,sband)) ||
+ !(tvoid = GetCurrentSrc(flo,pet,tband)) ||
+ !(dvoid = GetCurrentDst(flo,pet,dband))) continue;
+
+ SHIFT_FROM_LEVELS(shift, dband->format->levels)
+
+ while (!ferrCode(flo) && svoid && tvoid && dvoid &&
+ SyncDomain(flo,ped,dband,FLUSH)) {
+ INT32 run, ix = 0;
+
+ if (svoid != dvoid) memcpy(dvoid, svoid, dband->pitch);
+
+ while (run = GetRun(flo,pet,dband)) {
+ if (run > 0) {
+ /* needs to clip to second source, yuck */
+ if ((ix + run) > w) {
+ if (ix < w) (*(pvt->action)) (dvoid, tvoid,
+ (w-ix) << shift, ix << shift);
+ break;
+ }
+ (*(pvt->action)) (dvoid, tvoid, run << shift, ix << shift);
+ ix += run;
+ } else
+ ix -= run;
+ }
+ svoid = GetNextSrc(flo,pet,sband,FLUSH);
+ tvoid = GetNextSrc(flo,pet,tband,FLUSH);
+ dvoid = GetNextDst(flo,pet,dband,FLUSH);
+ }
+
+ if(!svoid && sband->final) /* when sr1 runs out, kill sr2 too */
+ DisableSrc(flo,pet,tband,FLUSH);
+ else if(!tvoid && tband->final) /* when sr2 runs out, pass-thru sr1 */
+ BypassSrc(flo,pet,sband);
+ else { /* both inputs still active, keep the scheduler up to date */
+ FreeData(flo,pet,sband,sband->current);
+ FreeData(flo,pet,tband,tband->current);
+ }
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetLogic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyLogic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+/* NOTE: would be nice to use mfb/mergerop.h. beware though. the roles
+** of dst, and source are somewhat reversed. This will be almost
+** necessary if we choose to support mismatched levels, and should make
+** it simpler to make fine tuned assembly or C code.
+*/
+
+/* M: (*(pvt->action)) (dvoid, svoid, pvt->cnst, bw); */
+/* D: (*(pvt->action)) (dvoid, svoid, tvoid, bw); */
+
+#define MakeM1(name, op) \
+static void name(d,src1,con,bits) \
+ LogInt *d, *src1, con; \
+ CARD32 bits; \
+{ \
+ CARD32 w = (bits + LOGSIZE - 1) / LOGSIZE; \
+ while (w >= 4) { *d++ = op; *d++ = op; \
+ *d++ = op; *d++ = op; w -= 4; } \
+ switch (w) { \
+ case 3: *d++ = op; \
+ case 2: *d++ = op; \
+ case 1: *d = op; \
+ default: break; \
+ } \
+}
+
+#define MakeM2(name, rev, op) \
+static void name(d,src1,con,bits) \
+ LogInt *d, *src1, con; \
+ CARD32 bits; \
+{ \
+ CARD32 w = (bits + LOGSIZE - 1) / LOGSIZE; \
+ LogInt A, B, C, D; \
+ while (w >= 4) { \
+ A = *src1++; B = *src1++; C = *src1++; D = *src1++; \
+ *d++ = (rev A) op; *d++ = (rev B) op; \
+ *d++ = (rev C) op; *d++ = (rev D) op; w -= 4; \
+ } \
+ switch (w) { \
+ case 3: A = *src1++; *d++ = (rev A) op; \
+ case 2: A = *src1++; *d++ = (rev A) op; \
+ case 1: A = *src1; *d = (rev A) op; \
+ default: break; \
+ } \
+}
+
+#define MakeD1(dname, mname) \
+static void dname(d,src1,src2,bits) \
+ LogInt *d, *src1, *src2; \
+ CARD32 bits; \
+{ \
+ mname (d, src2, 0, bits); \
+}
+
+#define MakeD2(name, rev, op) \
+static void name(d,src1,src2,bits) \
+ LogInt *d, *src1, *src2; \
+ CARD32 bits; \
+{ \
+ CARD32 w = (bits + LOGSIZE - 1) / LOGSIZE; \
+ LogInt A, B, C, D, E, F, G, H; \
+ while (w >= 4) { \
+ A = src1[0]; B = src1[1]; C = src1[2]; D = src1[3]; src1 += 4; \
+ E = src2[0]; F = src2[1]; G = src2[2]; H = src2[3]; src2 += 4; \
+ d[0] = (rev A) op E; d[1] = (rev B) op F; \
+ d[2] = (rev C) op G; d[3] = (rev D) op H; w -= 4; d += 4; \
+ } \
+ switch (w) { \
+ case 3: A = *src1++; E = *src2++; *d++ = (rev A) op E; \
+ case 2: A = *src1++; E = *src2++; *d++ = (rev A) op E; \
+ case 1: A = *src1; E = *src2++; *d = (rev A) op E; \
+ default: break; \
+ } \
+}
+
+#define NaDa
+
+MakeM1 (mono_clear, (LogInt) 0)
+MakeM2 (mono_and, NaDa, & con)
+MakeM2 (mono_andrev, ~, & con)
+MakeM1 (mono_copy, con)
+MakeM2 (mono_andinv, NaDa, & ~con)
+MakeM2 (mono_noop, NaDa, NaDa)
+MakeM2 (mono_xor, NaDa, ^ con)
+MakeM2 (mono_or, NaDa, | con)
+MakeM2 (mono_nor, ~, & ~con)
+MakeM2 (mono_equiv, NaDa, ^ ~con)
+MakeM2 (mono_invert, ~, NaDa)
+MakeM2 (mono_orrev, ~, | con)
+MakeM1 (mono_copyinv, ~con)
+MakeM2 (mono_orinv, NaDa, | ~con)
+MakeM2 (mono_nand, ~, | ~con)
+MakeM1 (mono_set, ~(LogInt) 0)
+
+#define dyad_clear mono_clear
+MakeD2 (dyad_and, NaDa, & )
+MakeD2 (dyad_andrev, ~, & )
+MakeD1 (dyad_copy, mono_noop)
+MakeD2 (dyad_andinv, NaDa, & ~)
+#define dyad_noop mono_noop
+MakeD2 (dyad_xor, NaDa, ^ )
+MakeD2 (dyad_or, NaDa, | )
+MakeD2 (dyad_nor, ~, & ~)
+MakeD2 (dyad_equiv, NaDa, ^ ~)
+#define dyad_invert mono_invert
+MakeD2 (dyad_orrev, ~, | )
+MakeD1 (dyad_copyinv, mono_invert)
+MakeD2 (dyad_orinv, NaDa, | ~)
+MakeD2 (dyad_nand, ~, | ~)
+#define dyad_set mono_set
+
+static void (*action_mono[16])() = {
+ mono_clear, mono_and, mono_andrev, mono_copy,
+ mono_andinv, mono_noop, mono_xor, mono_or,
+ mono_nor, mono_equiv, mono_invert, mono_orrev,
+ mono_copyinv, mono_orinv, mono_nand, mono_set
+};
+static void (*action_dyad[16])() = {
+ dyad_clear, dyad_and, dyad_andrev, dyad_copy,
+ dyad_andinv, dyad_noop, dyad_xor, dyad_or,
+ dyad_nor, dyad_equiv, dyad_invert, dyad_orrev,
+ dyad_copyinv, dyad_orinv, dyad_nand, dyad_set
+};
+
+/*------------------------------------------------------------------------
+--------------------- ROI operations work on subranges ------------------
+------------------------------------------------------------------------*/
+
+/* MROI: (*(pvt->action)) (dvoid, pvt->cnst, run, ix); */
+/* DROI: (*(pvt->action)) (dvoid, src2, run, ix); */
+
+#define MakeROIM1(name, op) \
+static void name(d,con,run,ix) \
+ LogInt *d, con; \
+ CARD32 run, ix; \
+{ \
+ LogInt D, M; \
+ CARD32 sbit = ix & LOGMASK; \
+ d += (ix >>= LOGSHIFT); \
+ if (sbit + run >= LOGSIZE) { \
+ if (sbit) { \
+ M = BitRight(LOGONES,sbit); run -= (LOGSIZE - sbit); \
+ D = *d; *d = (D & ~M) | (op & M); d++; \
+ } \
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--, d++ ) { \
+ *d = op; \
+ } \
+ if (run &= LOGMASK) { \
+ M = ~BitRight(LOGONES,run); \
+ D = *d; *d = (D & ~M) | (op & M); \
+ } \
+ } else { \
+ M = BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)); \
+ D = *d; *d = (D & ~M) | (op & M); \
+ } \
+}
+
+#define MakeROIM2(name, rev, op) \
+static void name(d,con,run,ix) \
+ LogInt *d, con; \
+ CARD32 run, ix; \
+{ \
+ LogInt D, M; \
+ CARD32 sbit = ix & LOGMASK; \
+ d += (ix >>= LOGSHIFT); \
+ if (sbit + run >= LOGSIZE) { \
+ if (sbit) { \
+ M = BitRight(LOGONES,sbit); run -= (LOGSIZE - sbit); \
+ D = *d; *d = (D & ~M) | (((rev D) op) & M); d++; \
+ } \
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--, d++ ) { \
+ *d = (rev *d) op; \
+ } \
+ if (run &= LOGMASK) { \
+ M = ~BitRight(LOGONES,run); \
+ D = *d; *d = (D & ~M) | (((rev D) op) & M); \
+ } \
+ } else { \
+ M = BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)); \
+ D = *d; *d = (D & ~M) | (((rev D) op) & M); d++; \
+ } \
+}
+
+#define MakeROIM3(name) \
+static void name(d,con,run,ix) \
+ LogInt *d, con; \
+ CARD32 run, ix; \
+{ \
+ return; /* NoOp */ \
+}
+
+#define MakeROID1(name, op) \
+static void name(d,src2,run,ix) \
+ LogInt *d, *src2; \
+ CARD32 run, ix; \
+{ \
+ LogInt D, M; \
+ CARD32 sbit = ix & LOGMASK; \
+ ix >>= LOGSHIFT; d += ix; src2 += ix; \
+ if (sbit + run >= LOGSIZE) { \
+ if (sbit) { \
+ M = BitRight(LOGONES,sbit); run -= (LOGSIZE - sbit); \
+ D = *d; *d = (D & ~M) | ((op *src2++) & M); d++; \
+ } \
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--, d++, src2++ ) { \
+ *d = op *src2; \
+ } \
+ if (run &= LOGMASK) { \
+ M = ~BitRight(LOGONES,run); \
+ D = *d; *d = (D & ~M) | ((op *src2) & M); \
+ } \
+ } else { \
+ M = BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)); \
+ D = *d; *d = (D & ~M) | ((op *src2) & M); \
+ } \
+}
+
+#define MakeROID2(name, rev, op) \
+static void name(d,src2,run,ix) \
+ LogInt *d, *src2; \
+ CARD32 run, ix; \
+{ \
+ LogInt D, M; \
+ CARD32 sbit = ix & LOGMASK; \
+ ix >>= LOGSHIFT; d += ix; src2 += ix; \
+ if (sbit + run >= LOGSIZE) { \
+ if (sbit) { \
+ M = BitRight(LOGONES,sbit); run -= (LOGSIZE - sbit); \
+ D = *d; *d = (D & ~M) | (((rev D) op *src2++) & M); d++; \
+ } \
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--, d++, src2++ ) { \
+ *d = (rev *d) op *src2; \
+ } \
+ if (run &= LOGMASK) { \
+ M = ~BitRight(LOGONES,run); \
+ D = *d; *d = (D & ~M) | (((rev D) op *src2) & M); \
+ } \
+ } else { \
+ M = BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run)); \
+ D = *d; *d = (D & ~M) | (((rev D) op *src2) & M); \
+ } \
+}
+
+MakeROIM1 (mroi_clear, (LogInt) 0)
+MakeROIM2 (mroi_and, NaDa, & con)
+MakeROIM2 (mroi_andrev, ~, & con)
+MakeROIM1 (mroi_copy, con)
+MakeROIM2 (mroi_andinv, NaDa, & ~con)
+MakeROIM3 (mroi_noop )
+MakeROIM2 (mroi_xor, NaDa, ^ con)
+MakeROIM2 (mroi_or, NaDa, | con)
+MakeROIM2 (mroi_nor, ~, & ~con)
+MakeROIM2 (mroi_equiv, NaDa, ^ ~con)
+MakeROIM2 (mroi_invert, ~, NaDa)
+MakeROIM2 (mroi_orrev, ~, | con)
+MakeROIM1 (mroi_copyinv, ~con)
+MakeROIM2 (mroi_orinv, NaDa, | ~con)
+MakeROIM2 (mroi_nand, ~, | ~con)
+MakeROIM1 (mroi_set, ~(LogInt) 0)
+
+#define droi_clear mroi_clear
+MakeROID2 (droi_and, NaDa, & )
+MakeROID2 (droi_andrev, ~, & )
+MakeROID1 (droi_copy, NaDa)
+MakeROID2 (droi_andinv, NaDa, & ~)
+#define droi_noop mroi_noop
+MakeROID2 (droi_xor, NaDa, ^ )
+MakeROID2 (droi_or, NaDa, | )
+MakeROID2 (droi_nor, ~, & ~)
+MakeROID2 (droi_equiv, NaDa, ^ ~)
+#define droi_invert mroi_invert
+MakeROID2 (droi_orrev, ~, | )
+MakeROID1 (droi_copyinv, ~)
+MakeROID2 (droi_orinv, NaDa, | ~)
+MakeROID2 (droi_nand, ~, | ~)
+#define droi_set mroi_set
+
+static void (*action_monoROI[16])() = {
+ mroi_clear, mroi_and, mroi_andrev, mroi_copy,
+ mroi_andinv, mroi_noop, mroi_xor, mroi_or,
+ mroi_nor, mroi_equiv, mroi_invert, mroi_orrev,
+ mroi_copyinv, mroi_orinv, mroi_nand, mroi_set
+};
+static void (*action_dyadROI[16])() = {
+ droi_clear, droi_and, droi_andrev, droi_copy,
+ droi_andinv, droi_noop, droi_xor, droi_or,
+ droi_nor, droi_equiv, droi_invert, droi_orrev,
+ droi_copyinv, droi_orinv, droi_nand, droi_set
+};
+
+/*------------------------------------------------------------------------
+---------------------------- some other goodies -------------------------
+------------------------------------------------------------------------*/
+
+static void action_tail(d, src, run, ix)
+ LogInt *d, *src;
+ CARD32 run, ix;
+{
+ LogInt D, M;
+ CARD32 sbit = ix & LOGMASK;
+ ix >>= LOGSHIFT; d += ix; src += ix;
+ if (sbit + run >= LOGSIZE) {
+ if (sbit) {
+ M = BitRight(LOGONES,sbit); run -= (LOGSIZE - sbit);
+ D = *d; *d = (D & ~M) | (*src++ & M); d++;
+ }
+ for (sbit = run >> LOGSHIFT; sbit > 0; sbit--) {
+ *d++ = *src++;
+ }
+ if (run &= LOGMASK) { /* may be unnecessary due to padding */
+ M = ~BitRight(LOGONES,run);
+ D = *d; *d = (D & ~M) | (*src & M);
+ }
+ } else {
+ M = BitRight(LOGONES,sbit) & ~(BitRight(LOGONES,sbit+run));
+ D = *d; *d = (D & ~M) | (*src & M);
+ }
+}
+
+static CARD32
+rep_cnst(levels, dconst)
+ CARD32 levels;
+ double dconst;
+{
+
+ CARD32 con = ConstrainConst(dconst,levels);
+
+ if (levels <= 0x100) {
+ if ( levels > 2) {
+ con &= 0xff; con |= con << 8; return con | (con << 16);
+ }
+ if (levels == 2) {
+ return con & 1 ? ~0 : 0;
+ }
+ return 0;
+ } else if (levels < 0x10000) {
+ con &= 0xffff; return con | (con << 16);
+ }
+ return con & 0xffffff;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int InitializeLogic(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ xieFloLogical *raw = (xieFloLogical *) ped->elemRaw;
+ pLogicDefPtr epvt = (pLogicDefPtr) ped->elemPvt;
+ mpLogicPvtPtr pvt = (mpLogicPvtPtr) pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 nbands = pet->receptor[SRCt1].inFlo->bands;
+ bandPtr dband = &(pet->emitter[0]);
+ CARD8 msk = raw->bandMask;
+ BOOL hasROI = raw->domainPhototag != 0;
+ CARD32 band;
+ void (*act)();
+
+ if (hasROI) {
+ if (raw->src2) {
+ ped->ddVec.activate = ActivateLogicDROI;
+ act = action_dyadROI[raw->operator];
+ } else {
+ ped->ddVec.activate = ActivateLogicMROI;
+ act = action_monoROI[raw->operator];
+ }
+ } else { /* no ROI */
+ if (raw->src2) {
+ ped->ddVec.activate = ActivateLogicD;
+ act = action_dyad[raw->operator];
+ } else {
+ ped->ddVec.activate = ActivateLogicM;
+ act = action_mono[raw->operator];
+ }
+ }
+
+ for (band=0; band<nbands; band++, pvt++, dband++) {
+ pvt->action = act;
+ if (!raw->src2) {
+ pvt->cnst = rep_cnst(dband->format->levels, epvt->constant[band]);
+ } else if (!hasROI) {
+ /* gack, an alternative is to use INPLACE for SRCt1 */
+ bandPtr tband = &(pet->receptor[SRCt2].band[band]);
+ if (dband->format->pitch <= tband->format->pitch) {
+ pvt->action2 = (void (*)()) NULL;
+ pvt->endix = dband->format->pitch; /* bits */
+ } else {
+ pvt->action2 = action_tail;
+ pvt->endix = tband->format->pitch;
+ pvt->endrun = dband->format->pitch - pvt->endix;
+ }
+ }
+ }
+
+ /* If processing domain, allow replication */
+ if (hasROI)
+ pet->receptor[ped->inCnt-1].band[0].replicate = msk;
+
+ InitReceptor(flo, ped, &rcp[SRCt1], NO_DATAMAP, 1, msk, ~msk);
+ if (msk && raw->src2)
+ InitReceptor(flo, ped, &rcp[SRCt2], NO_DATAMAP, 1, msk, NO_BANDS);
+ if (hasROI)
+ InitProcDomain(flo, ped, raw->domainPhototag, raw->domainOffsetX,
+ raw->domainOffsetY);
+ if (msk)
+ InitEmitter(flo, ped, NO_DATAMAP, hasROI ? SRCt1 : NO_INPLACE);
+
+ return !ferrCode(flo);
+}
+
+
+/* end module mplogic.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mppaste.c b/xc/programs/Xserver/XIE/mixie/process/mppaste.c
new file mode 100644
index 000000000..cf8eeb5c3
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mppaste.c
@@ -0,0 +1,553 @@
+/* $TOG: mppaste.c /main/7 1998/02/09 16:22:30 kaleb $ */
+/**** module mppaste.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mppaste.c -- DDXIE paste up element
+
+ Dean Verheiden, Larry Hare && Robert NC Shelley -- AGE Logic, Inc.
+ July, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mppaste.c,v 3.3 1998/10/05 13:22:46 dawes Exp $ */
+
+#define _XIEC_MPPASTE
+#define _XIEC_PPASTE
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzePasteUp();
+
+/*
+ * routines used internal to this module
+ */
+static int CreatePasteUp();
+static int InitializePasteUp();
+static int ActivatePasteUp();
+static int ResetPasteUp();
+static int DestroyPasteUp();
+
+/* Fill functions */
+static void FillReal();
+static void FillQuad();
+static void FillPair();
+static void FillByte();
+static void FillBit();
+
+/* Action functions */
+static void PasteReal();
+static void PasteQuad();
+static void PastePair();
+static void PasteByte();
+static void PasteBit();
+
+/*
+ * DDXIE Paste Up entry points
+ */
+static ddElemVecRec PasteUpVec = {
+ CreatePasteUp,
+ InitializePasteUp,
+ ActivatePasteUp,
+ (xieIntProc)NULL,
+ ResetPasteUp,
+ DestroyPasteUp
+ };
+
+/*
+ * Local Declarations.
+ */
+
+typedef struct _pasterect {
+ Bool active; /* indicates this src is not finished yet */
+ INT32 sxoff; /* src x offset */
+ INT32 dxoff; /* dst x offset */
+ INT32 dyoff; /* dst y offset */
+ CARD32 width; /* clipped width of src on output window */
+ CARD32 height; /* clipped height of src on output window */
+ CARD32 receptorIndex;
+} PasteRectRec, *PasteRectPtr;
+
+typedef struct _mppasteupdef {
+ void (*fill)();
+ void (*action)();
+ INT32 nextline;
+ CARD32 iconstant;
+ CARD32 numRects; /* Number of interesting src for this band */
+ PasteRectPtr rects;
+} mpPasteUpPvtRec, *mpPasteUpPvtPtr;
+
+
+/*------------------------------------------------------------------------
+----------------------------- Analyze ------------------------------------
+------------------------------------------------------------------------*/
+int miAnalyzePasteUp(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* for now just stash our entry point vector in the peDef */
+ ped->ddVec = PasteUpVec;
+
+ return(TRUE);
+} /* end miAnalyzePasteUp */
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreatePasteUp(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpPasteUpPvtRec);
+
+ /* Force syncing between sources, but not bands */
+ return (MakePETex(flo, ped, auxsize, SYNC, NO_SYNC) );
+} /* end CreatePasteUp */
+
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializePasteUp(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloPasteUp *raw = (xieFloPasteUp *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ CARD32 nbands = pet->receptor[SRCt1].inFlo->bands;
+ PasteUpFloat *fconst = ((pPasteUpDefPtr)ped->elemPvt)->constant;
+ mpPasteUpPvtPtr pvt;
+ xieTypTile *tp;
+ bandPtr iband, oband;
+ CARD32 b, t;
+
+ if (!(InitReceptors(flo, ped, NO_DATAMAP, 1) &&
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE)))
+ return (FALSE);
+
+ /* Figure out the appropriate action vector */
+ /* Use first source for the band types since they all must be the same */
+ iband = &(pet->receptor[SRCt1].band[0]);
+ pvt = (mpPasteUpPvtPtr)pet->private;
+ for(b = 0; b < nbands; b++, pvt++, iband++, fconst++) {
+
+ /* Zero out "interesting" rectangle counters */
+ pvt->numRects = 0;
+ pvt->nextline = pet->emitter[b].format->height - 1;
+
+ /* Clip fill for constrained data */
+ if (IsConstrained(iband->format->class))
+ pvt->iconstant = ConstrainConst(*fconst,iband->format->levels);
+
+ switch (iband->format->class) {
+ case UNCONSTRAINED:
+ pvt->fill = FillReal;
+ pvt->action = PasteReal;
+ break;
+ case QUAD_PIXEL:
+ pvt->fill = FillQuad;
+ pvt->action = PasteQuad;
+ break;
+ case PAIR_PIXEL:
+ pvt->fill = FillPair;
+ pvt->action = PastePair;
+ break;
+ case BYTE_PIXEL:
+ pvt->fill = FillByte;
+ pvt->action = PasteByte;
+ break;
+ case BIT_PIXEL:
+ pvt->fill = FillBit;
+ pvt->action = PasteBit;
+ break;
+ default:
+ ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+
+ /* Disable completely clipped srcs, determine minimum y of non clipped src */
+ tp = (xieTypTile *)&(raw[1]);
+ for (t = 0; t < raw->numTiles; t++, tp++) {
+ iband = &(pet->receptor[t].band[0]);
+ oband = &pet->emitter[0];
+ pvt = (mpPasteUpPvtPtr)pet->private;
+ for(b = 0; b < nbands; b++, iband++, oband++, pvt++) {
+ INT32 dst_width = oband->format->width;
+ INT32 dst_height = oband->format->height;
+ if ((tp->dstY + (INT32)iband->format->height) <= 0 ||
+ (tp->dstX + (INT32)iband->format->width) <= 0 ||
+ (tp->dstX >= dst_width) ||
+ (tp->dstY >= dst_height))
+ DisableSrc(flo,pet,iband,FLUSH);
+ else {
+ pvt->numRects++;
+ if (tp->dstY < pvt->nextline)
+ pvt->nextline = (tp->dstY > 0) ? tp->dstY : 0;
+ }
+ }
+ }
+
+ /* Allocate space for srcs that are not completely clipped */
+ pvt = (mpPasteUpPvtPtr)pet->private;
+ for (b = 0; b < nbands; b++, pvt++)
+ if (pvt->numRects) {
+ pvt->rects =
+ (PasteRectPtr)XieMalloc(pvt->numRects * sizeof(PasteRectRec));
+ pvt->numRects = 0; /* Will be used as list is built */
+ } else
+ pvt->rects = (PasteRectPtr)NULL;
+
+ /*
+ Build list for each band containing srcs that are displayed, adjust
+ thresholds for srcs without minimum y
+ */
+ tp = (xieTypTile *)&(raw[1]);
+ for (t = 0; t < raw->numTiles; t++, tp++) {
+ CARD8 amask = 1, active = pet->receptor[t].active;
+ iband = &(pet->receptor[t].band[0]);
+ oband = &pet->emitter[0];
+ pvt = (mpPasteUpPvtPtr)pet->private;
+ for(b = 0; b < nbands; b++, iband++, oband++, amask <<= 1, pvt++) {
+ if (active & amask) {
+ INT32 dst_width = oband->format->width;
+ INT32 dst_height = oband->format->height;
+ PasteRectPtr pr = &(pvt->rects[pvt->numRects++]); /* Yuck */
+
+ pr->active = TRUE;
+ pr->receptorIndex = t;
+ if (tp->dstX >= 0) { /* clip left */
+ pr->sxoff = 0;
+ pr->dxoff = tp->dstX;
+ pr->width = iband->format->width;
+ } else {
+ pr->sxoff = -tp->dstX;
+ pr->dxoff = 0;
+ pr->width = iband->format->width - pr->sxoff;
+ }
+ if (pr->dxoff + pr->width > dst_width) /* clip right */
+ pr->width = dst_width - pr->dxoff;
+
+ if (tp->dstY >= 0) { /* clip top */
+ pr->dyoff = tp->dstY;
+ pr->height = iband->format->height;
+ } else {
+ pr->dyoff = 0;
+ pr->height = iband->format->height - (-tp->dstY);
+ }
+ if (pr->dyoff + pr->height > dst_height)/* clip bottom */
+ pr->height = dst_height - pr->dyoff;
+
+ /* Adjust thresholds if necessary */
+ if (tp->dstY != pvt->nextline) {
+ if (tp->dstY > pvt->nextline)
+ IgnoreBand(iband);
+ else
+ SetBandThreshold(iband,-tp->dstY+1);
+ }
+ }
+ }
+ }
+
+ return( TRUE );
+} /* end InitializePasteUp */
+
+/*------------------------------------------------------------------------
+------------------------ crank some single input data --------------------
+------------------------------------------------------------------------*/
+static int ActivatePasteUp(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ pPasteUpDefPtr pvt = (pPasteUpDefPtr) ped->elemPvt;
+ PasteUpFloat *fconst = pvt->constant;
+ receptorPtr rcp = pet->receptor;
+ CARD32 bands = rcp[SRCt1].inFlo->bands;
+ bandPtr dbnd = &pet->emitter[0];
+ mpPasteUpPvtPtr mpvt = (mpPasteUpPvtPtr) pet->private;
+ pointer src, dst;
+ PasteRectPtr tp;
+ CARD32 t, b;
+
+ for(b = 0; b < bands; b++, dbnd++, mpvt++, fconst++) {
+ INT32 dst_width = dbnd->format->width;
+
+ /* Get pointer for dst scanline, Fill with constant */
+ if (!(dst = GetCurrentDst(flo,pet,dbnd)))
+ break;
+
+ (*(mpvt->fill)) (dst,*fconst,mpvt->iconstant,dst_width);
+
+ /* Skip any constant lines */
+ if (dbnd->current < mpvt->nextline) {
+ while (dbnd->current < mpvt->nextline) {
+ if (dst = GetNextDst(flo,pet,dbnd,KEEP)) {
+ (*(mpvt->fill)) (dst,*fconst,mpvt->iconstant,dst_width);
+ } else {
+ PutData(flo,pet,dbnd,dbnd->current);
+ return TRUE;
+ }
+ }
+ }
+
+ mpvt->nextline = dbnd->format->height;
+ tp = mpvt->rects;
+ for (t = 0; t < mpvt->numRects; t++, tp++){
+ bandPtr sbnd = &rcp[tp->receptorIndex].band[b];
+ INT32 tdy = tp->dyoff;
+ INT32 tdend = tdy + tp->height;
+
+ if (!tp->active) continue;
+
+ /* see if this src has a line for the destination */
+ if ((INT32)dbnd->current >= tdy && (INT32)dbnd->current < tdend) {
+
+ if (sbnd->threshold > 1) {
+ src = GetSrc(flo,pet,sbnd,sbnd->threshold - 1,KEEP);
+ SetBandThreshold(sbnd,1);
+ } else
+ src = GetCurrentSrc(flo,pet,sbnd);
+ if (!src) /* all tiles for this line should be ready */
+ ImplementationError(flo, ped, return(FALSE));
+
+ (*(mpvt->action)) (src, tp->sxoff, dst, tp->dxoff, tp->width);
+
+ FreeData(flo,pet,sbnd,sbnd->current+1);
+ if ((dbnd->current + 1) < tdend)
+ mpvt->nextline = dbnd->current + 1;
+ else
+ tp->active = FALSE;
+ } else if (tdy == (dbnd->current + 1)) {
+ /* Tile missed on this line but will be needed for next line */
+ AttendBand(sbnd);
+ mpvt->nextline = dbnd->current + 1;
+ } else if (tdy < mpvt->nextline) {
+ mpvt->nextline = tdy;
+ }
+ }
+
+ if (mpvt->nextline < dbnd->format->height) {
+ /* ... still more tiles to copy */
+ (void) GetNextDst(flo,pet,dbnd,FLUSH);
+ if (mpvt->nextline != dbnd->current) {
+ /* ... find the Next bunch of tiles */
+ tp = mpvt->rects;
+ for (t = 0; t < mpvt->numRects; t++, tp++)
+ if (tp->active && tp->dyoff == mpvt->nextline) {
+ AttendBand(&rcp[tp->receptorIndex].band[b]);
+ }
+ }
+ } else {
+ /* ... fill in remaining destination with constant */
+ while((dst = GetNextDst(flo,pet,dbnd,KEEP)))
+ (*(mpvt->fill)) (dst,*fconst,mpvt->iconstant,dst_width);
+ PutData(flo,pet,dbnd,dbnd->current);
+ }
+
+ }
+ return(TRUE);
+} /* end ActivatePasteUp */
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetPasteUp(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ mpPasteUpPvtPtr pvt = (mpPasteUpPvtPtr)pet->private;
+ CARD32 nbands = pet->receptor[SRCt1].inFlo->bands;
+ CARD32 b;
+
+ /* Free any lists that were malloced */
+ for (b = 0; b < nbands; b++, pvt++)
+ if (pvt->rects)
+ pvt->rects = (PasteRectPtr)XieFree(pvt->rects);
+
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+
+
+ return(TRUE);
+} /* end ResetPasteUp */
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyPasteUp(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.flush = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return(TRUE);
+} /* end DestroyPasteUp */
+
+/*------------------------------------------------------------------------
+--------------------------PasteUp fill routines ------------------------
+------------------------------------------------------------------------*/
+static void FillReal(dst,ffill,ifill,width)
+ RealPixel *dst;
+ PasteUpFloat ffill;
+ CARD32 ifill,width;
+{
+ while (width-- > 0) *dst++ = ffill;
+}
+
+#define PasteFill(fname,stype) \
+static void fname(din,ffill,ifill,width) \
+pointer din; \
+PasteUpFloat ffill; \
+CARD32 ifill,width; \
+{ \
+stype *dst = (stype *)din, fill = (stype)ifill; \
+ while (width-- > 0) *dst++ = fill; \
+}
+
+PasteFill(FillQuad,QuadPixel)
+PasteFill(FillPair,PairPixel)
+PasteFill(FillByte,BytePixel)
+
+
+static void FillBit(dst,ffill,ifill,width)
+ BitPixel *dst;
+ PasteUpFloat ffill;
+ CARD32 ifill,width;
+{
+ memset((char *)dst, (ifill ? ~0 : 0), (width+7)>>3);
+}
+
+/*------------------------------------------------------------------------
+--------------------------PasteUp action routines ----------------------
+------------------------------------------------------------------------*/
+
+#define PasteAction(fname,stype) \
+static void fname(sin,s_off,din,d_off,width) \
+CARD32 width, s_off, d_off; \
+pointer sin, din; \
+{ \
+stype *src = (stype *)sin, *dst = (stype *)din; \
+ src += s_off; \
+ dst += d_off; \
+ while (width-- > 0) *dst++ = *src++; \
+}
+
+PasteAction(PasteReal,RealPixel)
+PasteAction(PasteQuad,QuadPixel)
+PasteAction(PastePair,PairPixel)
+PasteAction(PasteByte,BytePixel)
+
+static void PasteBit(sin,s_off,din,d_off,width)
+ CARD32 width, s_off, d_off;
+ pointer sin, din;
+{
+ LogInt * src = (LogInt *) sin;
+ LogInt * dst = (LogInt *) din;
+ for ( ; width-- > 0 ; s_off++, d_off++ ) {
+ if (LOG_tstbit(src,s_off))
+ LOG_setbit(dst,d_off);
+ else
+ LOG_clrbit(dst,d_off);
+ }
+}
+
+/* end module mppaste.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mppoint.c b/xc/programs/Xserver/XIE/mixie/process/mppoint.c
new file mode 100644
index 000000000..55b6822ea
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mppoint.c
@@ -0,0 +1,1033 @@
+/* $TOG: mppoint.c /main/6 1998/02/09 16:22:35 kaleb $ */
+/**** module mppoint.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mppoint.c -- DDXIE point element
+
+ Larry Hare -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mppoint.c,v 3.3 1998/10/05 13:22:46 dawes Exp $ */
+
+
+#define _XIEC_MPPOINT
+#define _XIEC_PPOINT
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzePoint();
+
+/*
+ * routines used internal to this module
+ */
+static int CreatePoint();
+static int InitializePoint();
+static int ActivatePoint();
+static int ResetPoint();
+static int DestroyPoint();
+
+#if XIE_FULL
+static int ActivatePointExplode();
+static int ActivatePointExplodeMsk();
+static int ActivatePointCombine();
+static int ActivatePointROI();
+
+#define LUT_EXPLODE
+#endif
+
+/*
+ * DDXIE Point entry points
+ */
+static ddElemVecRec PointVec = {
+ CreatePoint,
+ InitializePoint,
+ ActivatePoint,
+ (xieIntProc) NULL,
+ ResetPoint,
+ DestroyPoint
+ };
+
+/*
+* Local Declarations.
+*/
+typedef struct _mppointdef {
+ void (*action) ();
+#if XIE_FULL
+ /* below here for crazy pixels only */
+ pointer (*convert) ();
+ pointer buffer;
+ CARD32 constant;
+ CARD8 shiftok;
+ CARD8 shiftamt;
+ CARD32 mask; /* for all 3 bands */
+ CARD32 width; /* for all 3 bands */
+ void (*merge) (); /* for all 3 bands */
+ void (*store) (); /* for all 3 bands */
+#endif
+} mpPointPvtRec, *mpPointPvtPtr;
+
+static void P11_bb0(), P11_bb1();
+static void P11_bb(), P11_Bb(), P11_Pb(), P11_Qb();
+static void P11_bB(), P11_BB(), P11_PB(), P11_QB();
+static void P11_bP(), P11_BP(), P11_PP(), P11_QP();
+static void P11_bQ(), P11_BQ(), P11_PQ(), P11_QQ();
+
+static void (*action_pnt11[4][4])() = {
+ P11_bb, P11_Bb, P11_Pb, P11_Qb, /* [out=1][inp=1...4] */
+ P11_bB, P11_BB, P11_PB, P11_QB, /* [out=2][inp=1...4] */
+ P11_bP, P11_BP, P11_PP, P11_QP, /* [out=3][inp=1...4] */
+ P11_bQ, P11_BQ, P11_PQ, P11_QQ, /* [out=4][inp=1...4] */
+};
+
+#if XIE_FULL
+static void Proi11_bb0();
+static void Proi11_bb(), Proi11_BB(), Proi11_PP(), Proi11_QQ();
+
+static void (*action_pntroi11[4])() = {
+ Proi11_bb, Proi11_BB, Proi11_PP, Proi11_QQ /* [out==inp=1...4] */
+};
+
+static void crazy_horse();
+
+static void CPM_B3BB(), CPS_B3BB(), CPA_B3BB();
+
+static void CPMRG_B(), CPMRG_P(), CPMRG_Q();
+
+static void (*action_merge[3])() = { /* [intclass - 2] */
+ CPMRG_B, CPMRG_P, CPMRG_Q /* [byte,pair,quad] */
+};
+
+static pointer CPCNV_bB(), CPCNV_BB();
+static pointer CPCNV_bP(), CPCNV_BP(), CPCNV_PP();
+static pointer CPCNV_bQ(), CPCNV_BQ(), CPCNV_PQ();
+
+static pointer (*action_convert[3][3])() = { /* [intclass-2][ii-1] */
+ CPCNV_bB, CPCNV_BB, 0, /* [out=Byte] [inp=bits,byte,pair] */
+ CPCNV_bP, CPCNV_BP, CPCNV_PP, /* [out=Pair] [inp=bits,byte,pair] */
+ CPCNV_bQ, CPCNV_BQ, CPCNV_PQ /* [out=Quad] [inp=bits,byte,pair] */
+};
+#endif
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzePoint(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = PointVec;
+ return TRUE;
+}
+
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreatePoint(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ return MakePETex(flo,ped,
+ xieValMaxBands * sizeof(mpPointPvtRec),
+ SYNC, /* InSync: Make sure Lut exists first */
+ NO_SYNC /* bandSync: see InitializePoint */
+ );
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializePoint(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ xieFloPoint *raw = (xieFloPoint *)ped->elemRaw;
+ peTexPtr pet = ped->peTex;
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ receptorPtr rcp = pet->receptor;
+ CARD32 nbands = pet->receptor[SRCtag].inFlo->bands;
+ CARD32 lbands = pet->receptor[LUTtag].inFlo->bands;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ CARD8 msk = raw->bandMask;
+ BOOL bandsync = FALSE;
+ CARD8 passmsk, lutmask;
+ CARD32 band;
+
+#if XIE_FULL
+ if (nbands == 3 && lbands == 1) {
+ int oo = oband->format->class;
+ int ii = iband->format->class;
+ int intclass;
+ CARD32 c0, c1, c2, ctotal;
+ CARD32 iimin = ii, iimax = ii;
+
+ pvt->width = iband->format->width;
+
+ c1 = (iband+1)->format->class;
+ if (c1 > iimax) iimax = c1; else if (c1 < iimin) iimin = c1;
+ c2 = (iband+2)->format->class;
+ if (c2 > iimax) iimax = c2; else if (c2 < iimin) iimin = c2;
+
+ /* Create CRAZY pixels by multiply/accumulate */
+ if (pet->receptor[LUTtag].band[0].format->width == xieValLSFirst) {
+ (pvt+0)->constant = c0 = 1;
+ (pvt+1)->constant = c1 = (iband+0)->format->levels;
+ (pvt+2)->constant = c2 = (iband+0)->format->levels *
+ (iband+1)->format->levels;
+ ctotal = c2 * (iband+2)->format->levels;
+ } else { /* swizzle band-order MSFirst */
+ (pvt+2)->constant = c2 = 1;
+ (pvt+1)->constant = c1 = (iband+2)->format->levels;
+ (pvt+0)->constant = c0 = (iband+2)->format->levels *
+ (iband+1)->format->levels;
+ ctotal = c0 * (iband+0)->format->levels;
+ }
+
+ if ((c0 & (c0-1)) == 0) {
+ (pvt+0)->shiftamt = ffs(c0) - 1;
+ (pvt+0)->shiftok = 1;
+ } else (pvt+0)->shiftok = 0;
+ if ((c1 & (c1-1)) == 0) {
+ (pvt+1)->shiftamt = ffs(c1) - 1;
+ (pvt+1)->shiftok = 1;
+ } else (pvt+1)->shiftok = 0;
+ if ((c2 & (c2-1)) == 0) {
+ (pvt+2)->shiftamt = ffs(c2) - 1;
+ (pvt+2)->shiftok = 1;
+ } else (pvt+2)->shiftok = 0;
+
+ if (ctotal <= 2) /* Could happen if levels were 1/1/2. pretty silly */
+ ctotal = 4;
+
+ SetDepthFromLevels(ctotal,c2);
+ pvt->mask = (1<<c2) - 1;
+
+ intclass = (ctotal <= 256) ? BYTE_PIXEL :
+ (ctotal <= 65536) ? PAIR_PIXEL : QUAD_PIXEL;
+
+ if (iimin == BYTE_PIXEL && iimax == BYTE_PIXEL &&
+ intclass == BYTE_PIXEL && oo == BYTE_PIXEL ) {
+
+ /* BYTE/BYTE/BYTE --> BYTE -> BYTE */
+ pvt->action = ((pvt+0)->shiftok &&
+ (pvt+1)->shiftok &&
+ (pvt+2)->shiftok) ? CPS_B3BB : CPM_B3BB;
+ } else {
+ /* Do it the hard way */
+ pvt->action = crazy_horse;
+ if (intclass == BYTE_PIXEL && oo == BYTE_PIXEL) {
+ pvt->merge = CPA_B3BB;
+ pvt->store = 0;
+ } else {
+ pvt->merge = action_merge[intclass-2];
+ pvt->store = (oband->format->levels == 1)
+ ? P11_bb0
+ : action_pnt11[oo-1][intclass-1];
+ }
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ ii = iband->format->class;
+ pvt->width = iband->format->width;
+ /* might allocate extra space and use lut instead of multiply */
+ pvt->convert = action_convert[intclass-2][ii-1];
+ if (!(pvt->buffer = (pointer)
+ XieMalloc(pvt->width << (intclass - BYTE_PIXEL))))
+ AllocError(flo,ped,return(FALSE));
+ }
+ }
+
+ /* protocol requires msk == ALL_BANDS */
+ msk = ALL_BANDS; passmsk = NO_BANDS, lutmask = 1; bandsync = TRUE;
+ ped->ddVec.activate = ActivatePointCombine;
+
+ } else if (nbands == 1 && lbands == 3) {
+
+ for(band = 0; band < lbands; band++, pvt++, oband++) {
+ int oo = oband->format->class;
+ int ii = iband->format->class;
+
+ if (oband->format->levels == 1)
+ pvt->action = P11_bb0;
+ else if ((iband->format->levels == 1) && (oo == BIT_PIXEL))
+ pvt->action = P11_bb1;
+ else
+ pvt->action = action_pnt11[oo-1][ii-1];
+ }
+#if defined(LUT_EXPLODE)
+ if ((msk & 7) == 7) {
+ /* Only works when all 3 bands selected */
+ msk = 1; passmsk = NO_BANDS; lutmask = ALL_BANDS; bandsync = TRUE;
+ ped->ddVec.activate = ActivatePointExplode;
+ } else
+#endif
+ {
+ /* must actually activate these bands instead of using passmsk */
+ ped->ddVec.activate = ActivatePointExplodeMsk;
+ lutmask = msk; msk = 1; passmsk = NO_BANDS; bandsync = FALSE;
+ rcp[SRCtag].band[0].replicate = ~msk;
+ }
+
+ } else if (nbands == lbands) {
+ /* Standard Case. Map each band thru its own LUT */
+
+ if (raw->domainPhototag) {
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+ int oo = oband->format->class;
+
+ pvt->action = (oband->format->levels == 1)
+ ? Proi11_bb0
+ : action_pntroi11[oo-1];
+ }
+ passmsk = ~msk; lutmask = msk;
+ rcp[ped->inCnt-1].band[0].replicate = msk;
+ ped->ddVec.activate = ActivatePointROI;
+ } else {
+#endif
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++) {
+ int oo = oband->format->class;
+ int ii = iband->format->class;
+
+ if (oband->format->levels == 1)
+ pvt->action = P11_bb0;
+ else if ((iband->format->levels == 1) && (oo == BIT_PIXEL))
+ pvt->action = P11_bb1;
+ else
+ pvt->action = action_pnt11[oo-1][ii-1];
+ }
+ passmsk = ~msk; lutmask = msk;
+ ped->ddVec.activate = ActivatePoint;
+#if XIE_FULL
+ }
+ } else
+ ImplementationError(flo,ped, return(FALSE));
+#endif
+ pet->bandSync = bandsync;
+ return(InitReceptor(flo,ped,&rcp[SRCtag],NO_DATAMAP,1,msk,passmsk) &&
+ InitReceptor(flo,ped,&rcp[LUTtag],NO_DATAMAP,1,lutmask,NO_BANDS) &&
+ (!raw->domainPhototag ||
+ InitProcDomain(flo, ped, raw->domainPhototag,
+ raw->domainOffsetX, raw->domainOffsetY)) &&
+ InitEmitter(flo, ped, NO_DATAMAP,
+ (raw->domainPhototag ? SRCtag : NO_INPLACE)));
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+/*------------------ (1 Band, 3 LUTS) --> (3 Bands) -------------------*/
+
+#if XIE_FULL
+#if defined(LUT_EXPLODE)
+/*
+** NOTE:
+** This code was used in the SI alpha drop and works fine. However
+** using our new band replication feature, we can replicate the
+** image band and use the 3x3 mapping code. On the three machines
+** I compared the execution times on, the results were within a few
+** percent; but this code was faster. If you want to save a bit
+** of code space, turn off the define LUT_EXPLODE.
+*/
+
+static int ActivatePointExplode(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr lband = &(pet->receptor[LUTtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ pointer lvoid0, lvoid1, lvoid2;
+ pointer ovoid0, ovoid1, ovoid2;
+ pointer ivoid;
+ int bw = iband->format->width;
+
+ /* asking for 1 should fetch entire lut strip */
+ lvoid0 = GetSrcBytes(flo,pet,lband,0,1,FALSE); lband++;
+ lvoid1 = GetSrcBytes(flo,pet,lband,0,1,FALSE); lband++;
+ lvoid2 = GetSrcBytes(flo,pet,lband,0,1,FALSE);
+
+ if (!lvoid0 || !lvoid1 || !lvoid2)
+ ImplementationError(flo,ped, return(FALSE));
+
+ ivoid = GetCurrentSrc(flo,pet,iband);
+ ovoid0 = GetCurrentDst(flo,pet,oband); oband++;
+ ovoid1 = GetCurrentDst(flo,pet,oband); oband++;
+ ovoid2 = GetCurrentDst(flo,pet,oband); oband -= 2;
+ while (!ferrCode(flo) && ivoid && ovoid0 && ovoid1 && ovoid2) {
+
+ (*((pvt+0)->action)) (ivoid, ovoid0, lvoid0, bw);
+ (*((pvt+1)->action)) (ivoid, ovoid1, lvoid1, bw);
+ (*((pvt+2)->action)) (ivoid, ovoid2, lvoid2, bw);
+
+ ivoid = GetNextSrc(flo,pet,iband,TRUE);
+ ovoid0 = GetNextDst(flo,pet,oband,TRUE); oband++;
+ ovoid1 = GetNextDst(flo,pet,oband,TRUE); oband++;
+ ovoid2 = GetNextDst(flo,pet,oband,TRUE); oband -= 2;
+ }
+ FreeData(flo, pet, iband, iband->current);
+ if (iband->final) {
+ FreeData(flo, pet, lband ,lband->current); lband--;
+ FreeData(flo, pet, lband ,lband->current); lband--;
+ FreeData(flo, pet, lband ,lband->current);
+ }
+ return TRUE;
+}
+#endif
+
+static int ActivatePointExplodeMsk(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ xieFloPoint *raw = (xieFloPoint *)ped->elemRaw;
+ int band, nbands = pet->receptor[LUTtag].inFlo->bands;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr lband = &(pet->receptor[LUTtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ CARD8 msk = raw->bandMask;
+ pointer lvoid;
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++, lband++) {
+ register int bw = iband->format->width;
+ pointer ivoid, ovoid;
+
+ if ((msk & (1<<band)) == 0) {
+ /* Pass source band similar to BandSelect code */
+ if(GetCurrentSrc(flo,pet,iband)) {
+ do {
+ if(!PassStrip(flo,pet,oband,iband->strip))
+ return(FALSE);
+ } while(GetSrc(flo,pet,iband,iband->maxLocal,FLUSH));
+ FreeData(flo,pet,iband,iband->maxLocal);
+ }
+ continue;
+ }
+
+ /* Or process similar to ordinary Point code. */
+ if (!(lvoid = GetSrcBytes(flo,pet,lband,0,1,FALSE)) ||
+ !(ivoid = GetCurrentSrc(flo,pet,iband)) ||
+ !(ovoid = GetCurrentDst(flo,pet,oband))) continue;
+
+ do {
+ (*(pvt->action)) (ivoid, ovoid, lvoid, bw);
+ ivoid = GetNextSrc(flo,pet,iband,TRUE);
+ ovoid = GetNextDst(flo,pet,oband,TRUE);
+ } while (!ferrCode(flo) && ivoid && ovoid) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ if (iband->final)
+ FreeData(flo, pet, lband, lband->current);
+ }
+ return TRUE;
+}
+
+/*------------------ (3 Band, 1 LUTS) --> (1 Bands) -------------------*/
+
+static int ActivatePointCombine(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr lband = &(pet->receptor[LUTtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ pointer ivoid0, ivoid1, ivoid2, lvoid, ovoid;
+
+ /* asking for 1 should fetch entire lut strip */
+ if (!(lvoid = GetSrcBytes(flo,pet,lband,0,1,FALSE)))
+ return FALSE;
+
+ ovoid = GetCurrentDst(flo,pet,oband);
+ ivoid0 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid1 = GetCurrentSrc(flo,pet,iband); iband++;
+ ivoid2 = GetCurrentSrc(flo,pet,iband); iband -= 2;
+
+ while (!ferrCode(flo) && ovoid && ivoid0 && ivoid1 && ivoid2) {
+
+ (*(pvt->action)) (ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt);
+
+ ovoid = GetNextDst(flo,pet,oband,TRUE);
+ ivoid0 = GetNextSrc(flo,pet,iband,TRUE); iband++;
+ ivoid1 = GetNextSrc(flo,pet,iband,TRUE); iband++;
+ ivoid2 = GetNextSrc(flo,pet,iband,TRUE); iband -= 2;
+ }
+
+ FreeData(flo, pet, iband, iband->current); iband++;
+ FreeData(flo, pet, iband, iband->current); iband++;
+ FreeData(flo, pet, iband, iband->current);
+
+ if (iband->final)
+ FreeData(flo, pet, lband, lband->current);
+
+ return TRUE;
+}
+
+/*------------------ (3 Band, 3 LUTS, ROI) --> (3 Bands) -------------------*/
+/*------------------ (1 Band, 1 LUTS, ROI) --> (1 Bands) -------------------*/
+
+static int ActivatePointROI(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ int band, nbands = pet->receptor[LUTtag].inFlo->bands; /* ??? */
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr lband = &(pet->receptor[LUTtag].band[0]);
+ bandPtr rband = &(pet->receptor[ped->inCnt-1].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ pointer lvoid;
+
+ for(band=0; band < nbands; band++,pvt++,iband++,oband++,lband++,rband++) {
+ pointer ivoid, ovoid;
+
+ /* 1 should fetch entire lut strip */
+ if (!(lvoid = GetSrcBytes(flo,pet,lband,0,1,FALSE)) ||
+ !(ivoid = GetCurrentSrc(flo,pet,iband)) ||
+ !(ovoid = GetCurrentDst(flo,pet,oband))) continue;
+
+ while (!ferrCode(flo) && ivoid && ovoid &&
+ SyncDomain(flo,ped,oband,FLUSH)) {
+ INT32 run, currentx = 0;
+
+ if(ivoid != ovoid) memcpy(ovoid, ivoid, oband->pitch);
+
+ while (run = GetRun(flo,pet,oband)) {
+ if (run > 0) {
+ (*(pvt->action)) (ovoid, lvoid, run, currentx);
+ currentx += run;
+ } else
+ currentx -= run;
+ }
+
+ ivoid = GetNextSrc(flo,pet,iband,TRUE);
+ ovoid = GetNextDst(flo,pet,oband,TRUE);
+ }
+
+ FreeData(flo, pet, iband, iband->current);
+ if (iband->final)
+ FreeData(flo, pet, lband, lband->current);
+ }
+ return TRUE;
+}
+#endif
+
+/*------------------ (3 Band, 3 LUTS) --> (3 Bands) -------------------*/
+/*------------------ (1 Band, 1 LUTS) --> (1 Bands) -------------------*/
+
+static int ActivatePoint(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpPointPvtPtr pvt = (mpPointPvtPtr) pet->private;
+ int band, nbands = pet->receptor[LUTtag].inFlo->bands;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr lband = &(pet->receptor[LUTtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ pointer lvoid;
+
+ for(band = 0; band < nbands; band++, pvt++, iband++, oband++, lband++) {
+ register int bw = iband->format->width;
+ pointer ivoid, ovoid;
+
+ /* 1 should fetch entire lut strip */
+ if (!(lvoid = GetSrcBytes(flo,pet,lband,0,1,FALSE)) ||
+ !(ivoid = GetCurrentSrc(flo,pet,iband)) ||
+ !(ovoid = GetCurrentDst(flo,pet,oband))) continue;
+
+ do {
+ (*(pvt->action)) (ivoid, ovoid, lvoid, bw);
+ ivoid = GetNextSrc(flo,pet,iband,TRUE);
+ ovoid = GetNextDst(flo,pet,oband,TRUE);
+ } while (!ferrCode(flo) && ivoid && ovoid) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ if (iband->final)
+ FreeData(flo, pet, lband, lband->current);
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetPoint(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+#if XIE_FULL
+ mpPointPvtPtr pvt = (mpPointPvtPtr) (ped->peTex->private);
+ int band;
+
+ /* free any dynamic private data */
+ if (pvt)
+ for (band = 0 ; band < xieValMaxBands ; band++, pvt++)
+ if (pvt->buffer)
+ pvt->buffer = (pointer) XieFree(pvt->buffer);
+#endif
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyPoint(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* get rid of the peTex structure */
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+/*
+** bitonal ---> LUT ---> bitonal (only 4 possibilities)
+*/
+
+static void
+P11_bb(INP,OUTP,LUTP,bw)
+ pointer INP; pointer OUTP; pointer LUTP; int bw;
+{
+ unsigned char *lutp = (unsigned char *) LUTP;
+
+ if (*lutp++ == 0) {
+ if (*lutp == 0)
+ action_clear (OUTP, bw, 0);
+ else
+ passcopy_bit (OUTP, INP, bw, 0);
+ } else if (*lutp == 0) {
+ passcopy_bit (OUTP, INP, bw, 0);
+ action_invert (OUTP, bw, 0);
+ } else
+ action_set (OUTP, bw, 0);
+}
+
+/*
+** bitonal ---> LUT ---> bitonal (input is single level)
+*/
+
+static void
+P11_bb1(INP,OUTP,LUTP,bw)
+ pointer INP; pointer OUTP; pointer LUTP; int bw;
+{
+ CARD8 *lutp = (CARD8 *) LUTP;
+
+ if (*lutp) action_set(OUTP, bw, 0);
+ else action_clear(OUTP, bw, 0);
+}
+
+/*
+** anything ---> LUT ---> bitonal (output is single level)
+*/
+
+static void
+P11_bb0(INP,OUTP,LUTP,bw)
+ pointer INP; pointer OUTP; pointer LUTP; int bw;
+{
+ action_clear(OUTP, bw, 0);
+}
+
+/*
+** DO_P11b - single band, single lut, bit to bit
+** DO_P11c - single band, single lut, consume bits
+** DO_P11x - single band, single lut, consume bits (to bytes only)
+** DO_P11p - single band, single lut, produce bits
+** DO_P11 - single band, single lut, non-bit versions
+*/
+
+#define DO_P11b(fd_do,itype,otype) /* see P11_bb, P11_bb1, P11_bb0 above */
+
+#define DO_P11c(fn_do,itype,otype) \
+static void \
+fn_do(INP,OUTP,LUTP,bw) \
+ pointer INP; pointer OUTP; pointer LUTP; int bw; \
+{ \
+ LogInt *inp = (LogInt *) INP; \
+ otype *outp = (otype *) OUTP; \
+ otype *lutp = (otype *) LUTP; \
+ otype loval = lutp[0], hival = lutp[1]; \
+ LogInt M, inval; \
+ for ( ; bw >= LOGSIZE ; bw -= LOGSIZE) \
+ for (M=LOGLEFT, inval = *inp++; M; LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? hival : loval; \
+ if (bw > 0) \
+ for (M=LOGLEFT, inval = *inp++; bw; bw--, LOGRIGHT(M)) \
+ *outp++ = (inval & M) ? hival : loval; \
+}
+#define DO_P11p(fn_do,itype,otype) \
+static void \
+fn_do(INP,OUTP,LUTP,bw) \
+ pointer INP; pointer OUTP; pointer LUTP; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ LogInt *outp = (LogInt *) OUTP, M, outval; \
+ unsigned char *lutp = (unsigned char *) LUTP; \
+ for ( ; bw >= LOGSIZE ; *outp++ = outval, bw -= LOGSIZE) \
+ for (M=LOGLEFT, outval = 0; M; LOGRIGHT(M)) \
+ if (lutp[*inp++]) \
+ outval |= M; \
+ if (bw > 0) { \
+ for (M=LOGLEFT, outval = 0; bw; bw--, LOGRIGHT(M)) \
+ if (lutp[*inp++]) \
+ outval |= M; \
+ *outp++ = outval; \
+ } \
+}
+
+#define DO_P11x(fn_do,itype,otype) \
+static void \
+fn_do(INP,OUTP,LUTP,bw) \
+ pointer INP; pointer OUTP; pointer LUTP; int bw; \
+{ \
+ otype *lutp = (otype *) LUTP; \
+ bitexpand(INP,OUTP,bw, lutp[0], lutp[1]); \
+}
+
+#define DO_P11(fn_do,itype,otype) \
+static void \
+fn_do(INP,OUTP,LUTP,bw) \
+ pointer INP; pointer OUTP; pointer LUTP; int bw; \
+{ \
+ itype *inp = (itype *) INP; \
+ otype *outp = (otype *) OUTP; \
+ otype *lutp = (otype *) LUTP; \
+ while (bw-- > 0) *outp++ = lutp[*inp++]; \
+}
+
+/*
+** DO_P11b - bit to bit
+** DO_P11c - consume bits
+** DO_P11x - consume bits (faster bit eXpander for bytes only)
+** DO_P11p - produce bits
+** DO_P11 - non-bit versions
+*/
+
+DO_P11b (P11_bb, BitPixel, BitPixel)
+DO_P11p (P11_Bb, BytePixel, BitPixel)
+DO_P11p (P11_Pb, PairPixel, BitPixel)
+DO_P11p (P11_Qb, QuadPixel, BitPixel)
+
+DO_P11x (P11_bB, BitPixel, BytePixel)
+DO_P11 (P11_BB, BytePixel, BytePixel)
+DO_P11 (P11_PB, PairPixel, BytePixel)
+DO_P11 (P11_QB, QuadPixel, BytePixel)
+
+DO_P11c (P11_bP, BitPixel, PairPixel)
+DO_P11 (P11_BP, BytePixel, PairPixel)
+DO_P11 (P11_PP, PairPixel, PairPixel)
+DO_P11 (P11_QP, QuadPixel, PairPixel)
+
+DO_P11c (P11_bQ, BitPixel, QuadPixel)
+DO_P11 (P11_BQ, BytePixel, QuadPixel)
+DO_P11 (P11_PQ, PairPixel, QuadPixel)
+DO_P11 (P11_QQ, QuadPixel, QuadPixel)
+
+/*------------------------------------------------------------------------
+--------------------- ROI operations work on subranges ------------------
+------------------------------------------------------------------------*/
+#if XIE_FULL
+/*
+** The Proi11_XX routines only map within a single type. By making new
+** routines here, instead of using the P11_XX routines above, it
+** may be easier to optimize the more important P11_XX routines by
+** virtue of starting on nicely aligned boundaries.
+*/
+
+static void
+Proi11_bb0(INP,LUTP,run,ix)
+ pointer INP; pointer LUTP; int run; int ix;
+{
+ action_clear (INP, run, ix);
+}
+
+static void
+Proi11_bb(INP,LUTP,run,ix)
+ pointer INP; pointer LUTP; int run; int ix;
+{
+ CARD8 *lutp = (CARD8 *) LUTP;
+
+ if (*lutp++ == 0) {
+ if (*lutp == 0) action_clear (INP, run, ix);
+ } else if (*lutp == 0) action_invert (INP, run, ix);
+ else action_set (INP, run, ix);
+}
+
+#define ROI_P11(fn_do,iotype) \
+static void \
+fn_do(INP,LUTP,run,ix) \
+ pointer INP; pointer LUTP; INT32 run; INT32 ix; \
+{ \
+ iotype *inp = ((iotype *) INP) + ix; \
+ iotype *lutp = (iotype *) LUTP; \
+ while (run-- > 0) { *inp = lutp[*inp]; inp++; } \
+}
+
+ROI_P11 (Proi11_BB, BytePixel)
+ROI_P11 (Proi11_PP, PairPixel)
+ROI_P11 (Proi11_QQ, QuadPixel)
+#endif
+
+/*------------------------------------------------------------------------
+--------------------- Crazy Pixels Action Routines ---------------------
+------------------------------------------------------------------------*/
+#if XIE_FULL
+/*
+** The Activate routine will nominally call this routine to do all
+** the necessary moderation per scanline. However in the typical
+** case of going from a triple byte to a single byte image, one of the
+** CPM_B3BB or CPS_B3BB routines will get called instead.
+*/
+
+static void
+crazy_horse(ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt)
+ pointer ivoid0, ivoid1, ivoid2, lvoid, ovoid;
+ mpPointPvtPtr pvt;
+{
+ ivoid0 = (*(pvt->convert)) (ivoid0, pvt); pvt++;
+ ivoid1 = (*(pvt->convert)) (ivoid1, pvt); pvt++;
+ ivoid2 = (*(pvt->convert)) (ivoid2, pvt); pvt -= 2;
+ if (pvt->store) {
+ (*(pvt->merge)) (ivoid0, ivoid1, ivoid2, lvoid, pvt->buffer, pvt);
+ (*(pvt->store)) (pvt->buffer, ovoid, lvoid, pvt->width);
+ } else
+ (*(pvt->merge)) (ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt);
+}
+
+/*
+** Some cpu's are not to good at multiplies, so we need two versions.
+*/
+
+#define MakeCrazyPix(name, itype, otype, OP, field) \
+static void \
+name(ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt) \
+ pointer ivoid0, ivoid1, ivoid2, lvoid, ovoid; \
+ mpPointPvtPtr pvt; \
+{ \
+ itype *i0 = (itype *) ivoid0; \
+ itype *i1 = (itype *) ivoid1; \
+ itype *i2 = (itype *) ivoid2; \
+ otype *l = (otype *) lvoid; \
+ otype *o = (otype *) ovoid; \
+ CARD32 c0 = (pvt+0)->field; \
+ CARD32 c1 = (pvt+1)->field; \
+ CARD32 c2 = (pvt+2)->field; \
+ CARD32 msk = pvt->mask; \
+ CARD32 bw = pvt->width; \
+ CARD32 j; \
+ for (j = 0; j < bw; j++) \
+ *o++ = l[((i0[j] OP c0) + (i1[j] OP c1) + (i2[j] OP c2)) & msk];\
+}
+
+#define MakeCrazyMergeLut(name, itype, otype) \
+static void \
+name(ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt) \
+ pointer ivoid0, ivoid1, ivoid2, lvoid, ovoid; \
+ mpPointPvtPtr pvt; \
+{ \
+ itype *i0 = (itype *) ivoid0; \
+ itype *i1 = (itype *) ivoid1; \
+ itype *i2 = (itype *) ivoid2; \
+ otype *l = (otype *) lvoid; \
+ otype *o = (otype *) ovoid; \
+ CARD32 msk = pvt->mask; \
+ CARD32 bw = pvt->width; \
+ CARD32 j; \
+ for (j = 0; j < bw; j++) \
+ *o++ = l[(i0[j] + i1[j] + i2[j]) & msk]; \
+}
+
+#define MakeCrazyMerge(name, iotype) \
+static void \
+name(ivoid0, ivoid1, ivoid2, lvoid, ovoid, pvt) \
+ pointer ivoid0, ivoid1, ivoid2, lvoid, ovoid; \
+ mpPointPvtPtr pvt; \
+{ \
+ iotype *i0 = (iotype *) ivoid0; \
+ iotype *i1 = (iotype *) ivoid1; \
+ iotype *i2 = (iotype *) ivoid2; \
+ iotype *op = (iotype *) ovoid; \
+ CARD32 msk = pvt->mask; \
+ CARD32 bw = pvt->width; \
+ CARD32 j; \
+ for (j = 0; j < bw; j++) \
+ op[j] = (i0[j] + i1[j] + i2[j]) & msk; \
+}
+
+#define MakeCrazyConvert(name, itype, otype) \
+static pointer \
+name(ivoid,pvt) \
+ pointer ivoid; \
+ mpPointPvtPtr pvt; \
+{ \
+ itype *i = (itype *) ivoid; \
+ otype *o = (otype *) pvt->buffer; \
+ CARD32 c = pvt->constant; \
+ CARD32 bw = pvt->width; \
+ if ( (sizeof(itype) == sizeof(otype)) && (c == 1)) \
+ return ivoid; \
+ if (pvt->shiftok) \
+ for (c = pvt->shiftamt ; bw > 0; bw--) *o++ = *i++ << c; \
+ else \
+ for ( ; bw > 0; bw--) *o++ = *i++ * c; \
+ return pvt->buffer; \
+}
+
+static pointer
+CPCNV_bB(ivoid,pvt)
+ pointer ivoid;
+ mpPointPvtPtr pvt;
+{
+ bitexpand(ivoid, pvt->buffer, pvt->width, 0, pvt->constant);
+ return pvt->buffer;
+}
+
+#define MakeCrazyConvertBit(name, otype) \
+static pointer \
+name(ivoid,pvt) \
+ pointer ivoid; \
+ mpPointPvtPtr pvt; \
+{ \
+ LogInt *i = (LogInt *) ivoid, ival, M; \
+ otype *o = (otype *) pvt->buffer; \
+ CARD32 c = pvt->constant; \
+ int bw = pvt->width; \
+ int nw = bw >> LOGSHIFT; \
+ for ( ; nw > 0; nw--) \
+ for (ival = *i++, M=LOGLEFT; M ; LOGRIGHT(M)) \
+ *o++ = (ival & M) ? c : 0; \
+ if ((bw &= LOGMASK)) \
+ for (ival = *i, M=LOGLEFT; bw > 0 ; bw--, LOGRIGHT(M)) \
+ *o++ = (ival & M) ? c : 0; \
+ return pvt->buffer; \
+}
+
+
+MakeCrazyPix (CPM_B3BB, BytePixel, BytePixel, *, constant)
+MakeCrazyPix (CPS_B3BB, BytePixel, BytePixel, <<, shiftamt)
+MakeCrazyMergeLut (CPA_B3BB, BytePixel, BytePixel )
+MakeCrazyMerge (CPMRG_B, BytePixel)
+MakeCrazyMerge (CPMRG_P, PairPixel)
+MakeCrazyMerge (CPMRG_Q, QuadPixel)
+
+
+MakeCrazyConvert (CPCNV_BB, BytePixel, BytePixel)
+MakeCrazyConvert (CPCNV_BP, BytePixel, PairPixel)
+MakeCrazyConvert (CPCNV_BQ, BytePixel, QuadPixel)
+MakeCrazyConvert (CPCNV_PP, PairPixel, PairPixel)
+MakeCrazyConvert (CPCNV_PQ, PairPixel, QuadPixel)
+MakeCrazyConvertBit (CPCNV_bP, PairPixel)
+MakeCrazyConvertBit (CPCNV_bQ, QuadPixel)
+#endif
+
+/* end module mppoint.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mprgb.c b/xc/programs/Xserver/XIE/mixie/process/mprgb.c
new file mode 100644
index 000000000..6d864eccc
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mprgb.c
@@ -0,0 +1,1341 @@
+/* $TOG: mprgb.c /main/7 1998/02/09 16:22:40 kaleb $ */
+/**** module mprgb.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mprgb.c -- DDXIE Convert To/From RGB elements
+
+ Larry Hare -- AGE Logic, Inc. August, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mprgb.c,v 3.3 1998/10/05 13:22:47 dawes Exp $ */
+
+
+#define _XIEC_MPRGB
+#define _XIEC_PCFRGB
+#define _XIEC_PCTRGB
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <technq.h>
+#include <xiemd.h>
+#include <memory.h>
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeToRGB();
+int miAnalyzeFromRGB();
+
+/*
+ * routines used internal to this module
+ */
+
+static int CreateToRGB();
+static int InitializeToRGB();
+static int SetupToRGB();
+
+static int CreateFromRGB();
+static int InitializeFromRGB();
+static int SetupFromRGB();
+
+static int ResetRGB();
+static int DestroyRGB();
+static void ClearRGB();
+static void CheckRGB();
+
+static int ActivateRGB();
+
+/*
+ * DDXIE Convert To/From RGB element entry points.
+ */
+static ddElemVecRec ToRGBVec = {
+ CreateToRGB,
+ InitializeToRGB,
+ ActivateRGB,
+ (xieIntProc) NULL,
+ ResetRGB,
+ DestroyRGB
+ };
+
+static ddElemVecRec FromRGBVec = {
+ CreateFromRGB,
+ InitializeFromRGB,
+ ActivateRGB,
+ (xieIntProc) NULL,
+ ResetRGB,
+ DestroyRGB
+ };
+
+/*
+** Local Declarations.
+** NOTE: use #define EARLY_SETUP to do setup at create time
+** NOTE: uses RGBFloat's for matrix multiply.
+*/
+
+#define EARLY_SETUP
+typedef RealPixel RGBFloat;
+
+typedef struct _mprgbdef {
+ void (*action) (); /* every one needs these */
+ void (*post) (); /* clipping, or CIELab, for floats */
+ CARD32 iclip[3]; /* clip values for integers */
+ pointer (*cvt_in[3])(); /* !0 if need to expand input */
+ pointer (*cvt_out[3])(); /* !0 if need to compress output */
+ pointer aux_buf[3]; /* used for cvt_in/cvt_out */
+ RGBFloat matrix[12];
+ INT32 imatrix[12];
+} mpRGBPvtRec, *mpRGBPvtPtr;
+
+/*
+** NOTES on BASIC ALGORITHM:
+** 1) All transforms center on a matrix. Either a passed in XYZMAT
+** or one synthesized from Luma values.
+** 2) White Point adjustments, if specified are applied to this matrix.
+** 3) Bias (YCbCr) or Implicit Biasing and Scaling (YCC) are applied.
+** (Float to Float stops here, matmul is done as floats)
+** 4) If inputs are integers, a scale is applied to reduce input
+** input numbers to range 0.0 to 1.0.
+** (Int to Float stops here, matmul is done as floats)
+** 5) If outputs are integers, a scale is applied to expand values
+** back to output range. For tripleband with all 256 levels
+** for inputs and outputs, this cancels step 4. But allows
+** for mapping say an (8,8,4) image to say (16,4,4). This
+** final matrix is turned into a scaled fraction integer matrix.
+** (Int to Int stops here, matmul is done as scaled fractions)
+*/
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeToRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = ToRGBVec;
+ return TRUE;
+}
+
+int miAnalyzeFromRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = FromRGBVec;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int
+CreateToRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ if (!MakePETex(flo,ped,sizeof(mpRGBPvtRec), NO_SYNC, SYNC))
+ return FALSE;
+
+#if defined(EARLY_SETUP)
+ if (!SetupToRGB(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+static int
+CreateFromRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ /* always force syncing between inputs (is nop if only one input) */
+ if (!MakePETex(flo,ped,sizeof(mpRGBPvtRec), NO_SYNC, SYNC))
+ return FALSE;
+
+#if defined(EARLY_SETUP)
+ if (!SetupFromRGB(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int
+InitializeToRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+#if !defined(EARLY_SETUP)
+ if (!SetupToRGB(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ InitReceptors(flo, ped, NO_DATAMAP, 1);
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE);
+
+ return !ferrCode(flo);
+}
+
+static int
+InitializeFromRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+#if !defined(EARLY_SETUP)
+ if (!SetupFromRGB(flo, ped, 0 /* modify ?? */))
+ return FALSE;
+#endif
+
+ InitReceptors(flo, ped, NO_DATAMAP, 1);
+ InitEmitter(flo, ped, NO_DATAMAP, NO_INPLACE);
+
+ return !ferrCode(flo);
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+static int
+ActivateRGB(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpRGBPvtPtr pvt = (mpRGBPvtPtr) pet->private;
+ bandPtr sband = &(pet->receptor[SRCt1].band[0]);
+ bandPtr dband = &(pet->emitter[0]);
+ CARD32 npix = sband->format->width;
+ pointer svoid[3], dvoid[3], stvoid[3], dtvoid[3];
+ CARD32 b;
+ BOOL stop;
+
+ for (b = 0; b < 3; b++, sband++, dband++) {
+ if (!(svoid[b] = GetCurrentSrc(flo,pet,sband)))
+ return TRUE;
+ if (!(dvoid[b] = GetCurrentDst(flo,pet,dband)))
+ return TRUE;
+ stvoid[b] = pvt->cvt_in[b]
+ ? (*pvt->cvt_in[b]) (pvt->aux_buf[b], svoid[b], pvt, npix)
+ : svoid[b] ;
+ dtvoid[b] = pvt->cvt_out[b] ? pvt->aux_buf[b] : dvoid[b];
+ } sband -= 3; dband -= 3;
+
+ do {
+
+ (*(pvt->action)) (dtvoid, stvoid, pvt, npix);
+
+ if (pvt->post) (*(pvt->post)) (dtvoid, npix);
+
+ for (b = 0, stop = FALSE; b < 3; b++, sband++, dband++) {
+ if (pvt->cvt_out[b])
+ (*pvt->cvt_out[b]) (dvoid[b], dtvoid[b], pvt, npix);
+ stop |= !(svoid[b] = GetNextSrc(flo,pet,sband,FLUSH));
+ stop |= !(dvoid[b] = GetNextDst(flo,pet,dband,FLUSH));
+ if (!stop) {
+ dtvoid[b] = pvt->cvt_out[b] ? dtvoid[b] : dvoid[b];
+ stvoid[b] = pvt->cvt_in[b]
+ ? (*pvt->cvt_in[b]) (stvoid[b], svoid[b], pvt, npix)
+ : svoid[b] ;
+ }
+ } sband -= 3; dband -= 3;
+
+ } while (!ferrCode(flo) && !stop) ;
+
+ for (b = 0; b < 3; b++, sband++) {
+ FreeData(flo, pet, sband, sband->current);
+ } sband -= 3;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int
+ResetRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+#if !defined(EARLY_SETUP)
+ ClearRGB(flo, ped);
+#endif
+
+ ResetReceptors(ped);
+ ResetProcDomain(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int
+DestroyRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+
+#if defined(EARLY_SETUP)
+ ClearRGB(flo, ped);
+#endif
+
+ /* get rid of the peTex structure and private structures */
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ Action Utility Routines -----------------------
+------------------------------------------------------------------------*/
+
+/*
+ * Used for CIELab conversions.
+ *
+ * NOTE: Investigate use of stock cbrt() function in libc.
+ * NOTE: Borrowed from lib/X/XcmsMath.h
+ * NOTE: Copyright 1990 The Open Group
+ *
+ * NOTE: Investigate use of stock cbrt() function in libc.
+ * NOTE: Used better choice of seed values with emphasis on
+ * range of 0 to 1, and other smallish numbers.
+ */
+
+#if !defined(XCMS_CUBEROOT)
+#define XCMS_CUBEROOT _cmsCubeRoot
+
+/* Newton's Method: x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */
+/* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */
+#ifndef DBL_EPSILON
+#define DBL_EPSILON 1e-6
+#endif
+
+double
+_cmsCubeRoot(a)
+ double a;
+{
+ register double abs_a, cur_guess, delta;
+ if (a == 0.)
+ return 0.;
+
+ /* convert to positive to speed loop tests */
+ abs_a = a < 0. ? -a : a;
+
+ /* arbitrary first guess */
+ cur_guess = abs_a < 1. ? 0.5 + .500 * abs_a :
+ abs_a < 1000. ? 1.0 + .125 * abs_a :
+ 10.0 + .0125 * abs_a ;
+ do {
+ delta = (cur_guess - abs_a/(cur_guess*cur_guess))/3.;
+ cur_guess -= delta;
+ if (delta < 0.) delta = -delta;
+ } while (delta >= cur_guess*DBL_EPSILON);
+
+ return a > 0. ? cur_guess : -cur_guess;
+}
+#endif
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+/* (*(pvt->cvt_out)) (dvoid, svoid, pvt, npix); */
+/* (*(pvt->cvt_in)) (dvoid, svoid, pvt, npix); */
+/* (*(pvt->action)) (dvoid, svoid, pvt, npix); */
+/* (*(pvt->post)) (dvoid, npix); */
+
+static pointer
+cvt_bit_to_pair(dvoid,svoid,pvt,npix)
+ pointer dvoid, svoid;
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ LogInt *bitp = (LogInt *) svoid, ival, M;
+ PairPixel *pairp = (PairPixel *) dvoid;
+ int nw = npix >> LOGSHIFT;
+ for ( ; nw > 0; nw--)
+ for (ival = *bitp++, M=LOGLEFT; M ; LOGRIGHT(M))
+ *pairp++ = (ival & M) ? (PairPixel) 1 : (PairPixel) 0;
+ if ((npix &= LOGMASK))
+ for (ival = *bitp, M=LOGLEFT; npix > 0 ; npix--, LOGRIGHT(M))
+ *pairp++ = (ival & M) ? (PairPixel) 1 : (PairPixel) 0;
+ return dvoid;
+}
+
+static pointer
+cvt_byte_to_pair(dvoid,svoid,pvt,npix)
+ pointer dvoid, svoid;
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ BytePixel *bytep = (BytePixel *) svoid;
+ PairPixel *pairp = (PairPixel *) dvoid;
+ for ( ; npix > 0; npix--)
+ *pairp++ = *bytep++;
+ return dvoid;
+}
+
+static pointer
+cvt_pair_to_byte(dvoid,svoid,pvt,npix)
+ pointer dvoid, svoid;
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ PairPixel *pairp = (PairPixel *) svoid;
+ BytePixel *bytep = (BytePixel *) dvoid;
+ for ( ; npix > 0; npix--)
+ *bytep++ = *pairp++; /* already hard-clipped!! */
+ return dvoid;
+}
+
+static pointer
+cvt_pair_to_bit(dvoid,svoid,pvt,npix)
+ pointer dvoid, svoid;
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ PairPixel *pairp = (PairPixel *) svoid;
+ LogInt *bitp = (LogInt *) dvoid, bitval, M;
+ for ( ; npix >= LOGSIZE; *bitp++ = bitval, npix -= LOGSIZE)
+ for (M=LOGLEFT, bitval = 0; M; LOGRIGHT(M))
+ if (*pairp++)
+ bitval |= M;
+ if (npix > 0) {
+ for (M=LOGLEFT, bitval = 0; npix > 0; npix--, LOGRIGHT(M))
+ if (*pairp++)
+ bitval |= M;
+ *bitp = bitval;
+ }
+ return dvoid;
+}
+
+static void
+act_mmRR(dvoid, svoid, pvt, npix)
+ RealPixel *svoid[3], *dvoid[3];
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ RGBFloat *mtrx = &(pvt->matrix[0]);
+ RGBFloat r, g, b;
+ CARD32 i;
+
+ /*
+ ** dvector = matrix * svector
+ */
+ for (i = 0; i < npix; i++) {
+ r = svoid[0][i];
+ g = svoid[1][i];
+ b = svoid[2][i];
+ dvoid[0][i] = mtrx[0] * r + mtrx[1] * g + mtrx[2] * b;
+ dvoid[1][i] = mtrx[3] * r + mtrx[4] * g + mtrx[5] * b;
+ dvoid[2][i] = mtrx[6] * r + mtrx[7] * g + mtrx[8] * b;
+ }
+}
+
+#define MakeIntFltMatMul(name, itype) \
+static void \
+name(dvoid, svoid, pvt, npix) \
+ itype *svoid[3]; \
+ RealPixel *dvoid[3]; \
+ mpRGBPvtPtr pvt; \
+ CARD32 npix; \
+{ \
+ RealPixel *mtrx = &(pvt->matrix[0]); \
+ RealPixel r, g, b, rr, gg, bb; \
+ CARD32 i; \
+ \
+ for (i = 0; i < npix; i++) { \
+ r = (RealPixel) svoid[0][i]; \
+ g = (RealPixel) svoid[1][i]; \
+ b = (RealPixel) svoid[2][i]; \
+ rr = mtrx[0] * r + mtrx[1] * g + mtrx[2] * b; \
+ gg = mtrx[3] * r + mtrx[4] * g + mtrx[5] * b; \
+ bb = mtrx[6] * r + mtrx[7] * g + mtrx[8] * b; \
+ dvoid[0][i] = rr; \
+ dvoid[1][i] = gg; \
+ dvoid[2][i] = bb; \
+ } \
+}
+
+MakeIntFltMatMul(act_mmBR, BytePixel)
+MakeIntFltMatMul(act_mmPR, PairPixel)
+
+#define MakeIntIntMatMul(name, iotype, shift) \
+static void \
+name(dvoid, svoid, pvt, npix) \
+ iotype *svoid[3], *dvoid[3]; \
+ mpRGBPvtPtr pvt; \
+ CARD32 npix; \
+{ \
+ INT32 *mtrx = &(pvt->imatrix[0]); \
+ INT32 r, g, b, rr, gg, bb; \
+ CARD32 iclip0 = pvt->iclip[0]; \
+ CARD32 iclip1 = pvt->iclip[1]; \
+ CARD32 iclip2 = pvt->iclip[2]; \
+ INT32 bias0 = mtrx[9] + (1 << (shift-1)); \
+ INT32 bias1 = mtrx[10] + (1 << (shift-1)); \
+ INT32 bias2 = mtrx[11] + (1 << (shift-1)); \
+ CARD32 i; \
+ \
+ for (i = 0; i < npix; i++) { \
+ r = svoid[0][i]; \
+ g = svoid[1][i]; \
+ b = svoid[2][i]; \
+ rr = mtrx[0] * r + mtrx[1] * g + mtrx[2] * b + bias0; \
+ gg = mtrx[3] * r + mtrx[4] * g + mtrx[5] * b + bias1; \
+ bb = mtrx[6] * r + mtrx[7] * g + mtrx[8] * b + bias2; \
+ if (rr < 0) rr = 0; \
+ if (gg < 0) gg = 0; \
+ if (bb < 0) bb = 0; \
+ if ((rr >>= shift) > iclip0) rr = iclip0; \
+ if ((gg >>= shift) > iclip1) gg = iclip1; \
+ if ((bb >>= shift) > iclip2) bb = iclip2; \
+ dvoid[0][i] = rr; \
+ dvoid[1][i] = gg; \
+ dvoid[2][i] = bb; \
+ } \
+}
+
+#define SF_BYTESHIFT 20
+#define SF_PAIRSHIFT 12
+MakeIntIntMatMul(act_mmBB, BytePixel, SF_BYTESHIFT)
+MakeIntIntMatMul(act_mmPP, PairPixel, SF_PAIRSHIFT)
+
+
+static void
+act_postClipR(dvoid, npix)
+ RealPixel *dvoid[3];
+{
+ RGBFloat *fp, f, zero = (RGBFloat) 0.0, one = (RGBFloat) 1.0;
+ CARD32 ipix, band;
+
+ for (band = 0; band < 3; band++) {
+ fp = dvoid[band];
+ for (ipix = npix; ipix > 0; ipix--, fp++) {
+ f = *fp;
+ if ( f < zero) *fp = zero;
+ if ( f > one) *fp = one;
+ }
+ }
+}
+
+static void
+act_postCIELab(dvoid, npix)
+ RealPixel *dvoid[3];
+{
+ RGBFloat *xp, *yp, *zp, x3, y3, z3;
+ CARD32 ipix;
+
+ xp = dvoid[0];
+ yp = dvoid[1];
+ zp = dvoid[2];
+ for (ipix = npix; ipix > 0; ipix--) {
+
+ /* XXX, if numbers are small, do some more work */
+ x3 = XCMS_CUBEROOT((double)*xp);
+ y3 = XCMS_CUBEROOT((double)*yp);
+ z3 = XCMS_CUBEROOT((double)*zp);
+
+ *xp++ = 116.0 * y3 - 16.0; /* L* */
+ *yp++ = 500.0 * (x3 - y3); /* a* */
+ *zp++ = 200.0 * (y3 - z3); /* b* */
+ }
+}
+
+static void
+act_preCIELab(dvoid, svoid, pvt, npix)
+ RealPixel *svoid[3], *dvoid[3];
+ mpRGBPvtPtr pvt;
+ CARD32 npix;
+{
+ RGBFloat *Lp, *ap, *bp, *xp, *yp, *zp, L, a, b;
+ CARD32 ipix;
+
+ /* must be careful not to smash the source */
+ Lp = svoid[0]; ap = svoid[1]; bp = svoid[2];
+ xp = dvoid[0]; yp = dvoid[1]; zp = dvoid[2];
+
+ for (ipix = npix; ipix > 0; ipix--) {
+
+ /* XXX, if numbers are small, do some more work */
+ L = (*Lp++ + 16.0) * (1.0 / 116.0);
+ a = L + (*ap++ * 0.002);
+ b = L - (*bp++ * 0.005);
+
+ *yp++ = (L * L * L); /* Y = ... */
+ *xp++ = (a * a * a); /* X = ... */
+ *zp++ = (b * b * b); /* Z = ... */
+ }
+ act_mmRR(dvoid, dvoid, pvt, npix);
+}
+
+/*------------------------------------------------------------------------
+-------------------- utility routines for initialization ----------------
+------------------------------------------------------------------------*/
+
+/* Scale entire matrix by single scale factor */
+
+static void
+scale_mtrx(mtx,imtx,iscl)
+ RGBFloat *mtx;
+ INT32 *imtx;
+ CARD32 iscl;
+{
+ RGBFloat fscl = iscl;
+ int i;
+
+ for (i = 0; i < 12; i++)
+ *imtx++ = *mtx++ * fscl;
+}
+
+/* Scale each row of matrix by respective factors */
+
+void
+scale_rows(mtrx,scale1,scale2,scale3)
+ RGBFloat *mtrx;
+ double scale1, scale2, scale3;
+{
+ int b;
+ for (b = 0; b < 3; b++) *mtrx++ *= scale1;
+ for (b = 0; b < 3; b++) *mtrx++ *= scale2;
+ for (b = 0; b < 3; b++) *mtrx++ *= scale3;
+}
+
+/* Scale each column of matrix by respective factors */
+
+void
+scale_columns(mtrx,scale1,scale2,scale3)
+ RGBFloat *mtrx;
+ double scale1, scale2, scale3;
+{
+ int b;
+ for (b = 0; b < 3; b++) {
+ *mtrx++ *= scale1;
+ *mtrx++ *= scale2;
+ *mtrx++ *= scale3;
+ }
+}
+
+/*
+** Our matrix routines for integers use a BIAS like so:
+** YCC = MATRIX * RGB - BIAS
+** But when we are going back to RGB we would have liked to do:
+** RGB = MATRIX * (YCC - BIAS)
+** So we multiply do transitive property of matrix arithmetic
+** to get a new BIAS' (BIAS' = -MATRIX * BIAS) such that:
+** RGB = MATRIX * YCC - MATRIX * BIAS = MATRIX * YCC - BIAS'
+*/
+static void
+flip_bias(mtx)
+ RGBFloat *mtx;
+{
+ RGBFloat mtx9, mtx10, mtx11;
+ mtx9 = -(mtx[0] * mtx[9] + mtx[1] * mtx[10] + mtx[2] * mtx[11]);
+ mtx10 = -(mtx[3] * mtx[9] + mtx[4] * mtx[10] + mtx[5] * mtx[11]);
+ mtx11 = -(mtx[6] * mtx[9] + mtx[7] * mtx[10] + mtx[8] * mtx[11]);
+
+ mtx[9] = mtx9;
+ mtx[10] = mtx10;
+ mtx[11] = mtx11;
+}
+
+
+
+/* Seed matrix for CIEXYZ and CIELab */
+
+static void
+copymatrix(pvt,input)
+ mpRGBPvtPtr pvt;
+ double *input;
+{
+ RGBFloat *mtrx = pvt->matrix;
+ int i;
+
+ for (i = 0; i < 9; i++)
+ *mtrx++ = *input++;
+
+ for (; i < 12; i++)
+ *mtrx++ = 0.0; /* bias */
+}
+
+static void
+copywhiteLABFromRGB(pvt,tec,vec)
+ mpRGBPvtPtr pvt;
+ xieTypWhiteAdjustTechnique tec;
+ double *vec;
+{
+ RGBFloat *mtrx = pvt->matrix;
+ double a, b, c;
+
+ switch (tec) {
+ case xieValWhiteAdjustCIELabShift: a = vec[0];
+ b = vec[1];
+ c = vec[2];
+ break;
+
+ case xieValWhiteAdjustDefault:
+ case xieValWhiteAdjustNone: /* calculate from pvt->matrix */
+ a = mtrx[0] + mtrx[1] + mtrx[2];
+ b = mtrx[3] + mtrx[4] + mtrx[5];
+ c = mtrx[6] + mtrx[7] + mtrx[8];
+ break;
+
+ default: return;
+ }
+
+ if (a < .0001) return;
+ if (b < .0001) return;
+ if (c < .0001) return;
+ scale_rows (mtrx, 1.0 / a, 1.0 / b, 1.0 / c);
+ return;
+}
+
+static void
+copywhiteLABToRGB(pvt,tec,vec)
+ mpRGBPvtPtr pvt;
+ xieTypWhiteAdjustTechnique tec;
+ double *vec;
+{
+ RGBFloat *mtrx = pvt->matrix;
+ double a, b, c;
+ switch (tec) {
+ case xieValWhiteAdjustCIELabShift: a = vec[0];
+ b = vec[1];
+ c = vec[2];
+ break;
+
+ case xieValWhiteAdjustDefault:
+ case xieValWhiteAdjustNone:
+ { /* White Point comes from XYZ Matrix. Must invert it first */
+ RGBFloat *m = mtrx - 1; /* number matrix from 1 to 9 */
+ double determinant = m[1] * (m[5]*m[9] - m[6]*m[8]) -
+ m[2] * (m[4]*m[9] - m[6]*m[7]) +
+ m[3] * (m[4]*m[8] - m[5]*m[7]);
+ a = (m[5]*m[9]-m[6]*m[8]); /* inv[00] */
+ a += -(m[2]*m[9]-m[3]*m[8]); /* inv[01] */
+ a += (m[2]*m[6]-m[3]*m[5]); /* inv[02] */
+ b = -(m[4]*m[9]-m[6]*m[7]); /* inv[10] */
+ b += (m[1]*m[9]-m[3]*m[7]); /* inv[11] */
+ b += -(m[1]*m[6]-m[3]*m[4]); /* inv[12] */
+ c = (m[4]*m[8]-m[5]*m[7]); /* inv[20] */
+ c += -(m[1]*m[8]-m[2]*m[7]); /* inv[21] */
+ c += (m[1]*m[5]-m[2]*m[4]); /* inv[22] */
+
+ a /= (determinant ? determinant : 1.0);
+ b /= (determinant ? determinant : 1.0);
+ c /= (determinant ? determinant : 1.0);
+ }
+ break;
+
+ default: return;
+ }
+ scale_columns (pvt->matrix, a, b, c);
+ return;
+}
+
+static void
+copywhiteXYZFromRGB(pvt,tec,vec)
+ mpRGBPvtPtr pvt;
+ xieTypWhiteAdjustTechnique tec;
+ double *vec;
+{
+ switch (tec) {
+ case xieValWhiteAdjustCIELabShift: break;
+ case xieValWhiteAdjustDefault: return;
+ case xieValWhiteAdjustNone: return;
+ default: return;
+ }
+ if (vec[0] < .0001) return;
+ if (vec[1] < .0001) return;
+ if (vec[2] < .0001) return;
+
+ scale_rows (pvt->matrix, 1.0 / vec[0], 1.0 / vec[1], 1.0 / vec[2]);
+}
+
+static void
+copywhiteXYZToRGB(pvt,tec,vec)
+ mpRGBPvtPtr pvt;
+ xieTypWhiteAdjustTechnique tec;
+ double *vec;
+{
+ switch (tec) {
+ case xieValWhiteAdjustCIELabShift: break;
+ case xieValWhiteAdjustDefault: return;
+ case xieValWhiteAdjustNone: return;
+ default: return;
+ }
+ scale_columns (pvt->matrix, vec[0], vec[1], vec[2]);
+}
+
+static void
+copygamut(pvt,tec)
+ mpRGBPvtPtr pvt;
+ xieTypGamutTechnique tec;
+{
+ if (tec == xieValGamutClipRGB)
+ pvt->post = act_postClipR;
+}
+
+static void
+copybiasYCbCr(pvt,bias0,bias1,bias2)
+ mpRGBPvtPtr pvt;
+ double bias0, bias1, bias2;
+{
+ pvt->matrix[9] = bias0;
+ pvt->matrix[10] = bias1;
+ pvt->matrix[11] = bias2;
+}
+
+static void
+copylumaYCbCrfromRGB(pvt,LumaRed,LumaGreen,LumaBlue)
+ mpRGBPvtPtr pvt;
+ double LumaRed,LumaGreen,LumaBlue;
+{
+ RGBFloat *mtrx = pvt->matrix;
+
+ if (LumaRed < .01) LumaRed = .01;
+ if (LumaGreen < .01) LumaGreen = .01;
+ if (LumaBlue < .01) LumaBlue = .01;
+ if (LumaRed > .99) LumaRed = .99;
+ if (LumaGreen > .99) LumaGreen = .99;
+ if (LumaBlue > .99) LumaBlue = .99;
+
+ /*
+ ** FROM TIFF 6.0
+ **
+ ** Y = (LumaRed*R + LumaGreen * G + LumaBlue * B)
+ ** Cb = (B - Y) / (2 - 2*LumaBlue)
+ ** Cr = (R - Y) / (2 - 2*LumaRed)
+ **
+ ** Cb = .5 * (B - (Lr*R + Lg*G + Lb*B)) / (1 - Lb)
+ ** Cb = .5B/(1-Lb) - .5(Lr*R + Lg*G + Lb*B)) / (1-Lb)
+ ** Cb = .5B/(1-Lb) - .5 Lr*R/(1-Lb) -.5 Lg*G/(1-Lb) -.5 Lb*B/(1-Lb)
+ ** Cb = .5B(1-Lb)/(1-Lb) -.5 Lr*R/(1-Lb) -.5 Lg*G/(1-Lb)
+ ** Cb = .5B -.5 Lr*R/(1-Lb) -.5 Lg*G/(1-Lb)
+ */
+ mtrx[0] = LumaRed;
+ mtrx[1] = LumaGreen;
+ mtrx[2] = LumaBlue;
+ mtrx[3] = -0.5 * LumaRed / (1.0 - LumaBlue);
+ mtrx[4] = -0.5 * LumaGreen / (1.0 - LumaBlue);
+ mtrx[5] = 0.5;
+ mtrx[6] = 0.5;
+ mtrx[7] = -0.5 * LumaGreen / (1.0 - LumaRed);
+ mtrx[8] = -0.5 * LumaBlue / (1.0 - LumaRed);
+
+ mtrx[9] = mtrx[10] = mtrx[11] = 0.0; /* bias */
+}
+
+static void
+copylumaYCbCrtoRGB(pvt,LumaRed,LumaGreen,LumaBlue)
+ mpRGBPvtPtr pvt;
+ double LumaRed,LumaGreen,LumaBlue;
+{
+ RGBFloat *mtrx = pvt->matrix;
+
+ /* should/could check that LumaRed + LumaGreen + LumaBlue approx == 1.0 */
+
+ if (LumaGreen < .01) LumaGreen = .01;
+ if (LumaGreen > .99) LumaGreen = .99;
+
+ /*
+ ** FROM TIFF 6.0
+ **
+ ** R = Cr * (2 - 2 * LumaRed) + Y
+ ** G = (Y - LumaBlue * B - LumaRed * R) / LumaGreen
+ ** B = Cb * (2 - 2 * LumaBlue) + Y
+ **
+ ** G = (Y - Lb*(Cb*(2-2*Lb) + Y) - Lr*(Cr*(2-2*Lr) + Y) ) / Lg
+ ** G = (Y - Lb*Cb*(2-2*Lb) - Lb*Y - Lr*Cr*(2-2*Lr) - Lr*Y ) / Lg
+ ** G = ((1 - Lb - Lr)*Y - 2*Lb*(1-Lb)*Cb - 2*Lr*(1-Lr)*Cr ) / Lg
+ **
+ ** R = 1 * Y + 0 * Cb + (2 - 2 * LumaRed) * Cr
+ ** G = 1 * Y + ...
+ ** B = 1 * Y + (2 - 2 * LumaBlue) * Cb + 0 * Cr
+ **
+ ** note: mtrx[3] == 1.0 when LR+LG+LB==1.0
+ */
+ mtrx[0] = 1.0;
+ mtrx[1] = 0.0;
+ mtrx[2] = 2.0 - 2.0 * LumaRed;
+
+ mtrx[3] = (1.0 - LumaRed - LumaBlue) / LumaGreen;
+ mtrx[4] = -2.0 * LumaBlue * (1.0 - LumaBlue) / LumaGreen;
+ mtrx[5] = -2.0 * LumaRed * (1.0 - LumaRed ) / LumaGreen;
+
+ mtrx[6] = 1.0;
+ mtrx[7] = 2.0 - 2.0 * LumaBlue;
+ mtrx[8] = 0.0;
+
+ mtrx[9] = mtrx[10] = mtrx[11] = 0.0; /* bias */
+
+}
+
+static void
+copylumaYCCfromRGB(pvt,LumaRed,LumaGreen,LumaBlue,Scale,oband)
+ mpRGBPvtPtr pvt;
+ double LumaRed,LumaGreen,LumaBlue,Scale;
+ bandPtr oband;
+{
+ RGBFloat *mtrx = pvt->matrix;
+
+ if (LumaGreen < .01) LumaGreen = .01;
+
+ /*
+ ** See "A Planning Guide For Developers" from KODAK PhotoCD Products.
+ ** Typical CCIR601.1 values of (.299, .587, .114) are used for
+ ** (LumaRed,LumaGreen,LumaBlue).
+ **
+ ** Y = ( LumaRed*R + LumaGreen * G + LumaBlue * B)
+ ** C1 = ( -LumaRed*R - LumaGreen * G + (1-LumaBlue) * B)
+ ** C2 = ((1-LumaRed)*R - LumaGreen * G + -LumaBlue * B)
+ **
+ ** From the same paper we are treated with the following equations
+ ** for packing 8bit pixels:
+ **
+ ** PACK: UMPACK
+ ** Y' = 255/1.402 * Y Y = 1.3584 * Y'
+ ** C1' = 111.40 * C1 + 156 C1 = 2.2179 * (C1' - 156)
+ ** C2' = 135.64 * C2 + 137 C2 = 1.8215 * (C2' - 137)
+ **
+ ** Extrapolating a bit we can see that this is:
+ **
+ ** Y' = 255/1.402 * Y
+ ** C1' = 255/2.289 * C1 + (.612 * 255) <2.289 = 1.402 * 1.6327 >
+ ** C2' = 255/1.879 * C2 + (.537 * 255) <1.879 = 1.402 * 1.3409 >
+ **
+ ** Y = 1.3584 * Y'
+ ** C1 = 1.3584 * 1.6327 * (C1' - (.612*255))
+ ** C2 = 1.3584 * 1.3409 * (C2' - (.537*255))
+ **
+ ** So we are left with a choice between the magic 1.402 and 1.3584
+ ** values. Hey, better idea. Its now an XIE protocol parameter
+ ** called "scale".
+ **
+ ** In future versions, its possible we will want to accept the 1.3584
+ ** number as a technique parameter in addition to the Luma.
+ */
+ mtrx[0] = LumaRed;
+ mtrx[1] = LumaGreen;
+ mtrx[2] = LumaBlue;
+ mtrx[3] = -LumaRed;
+ mtrx[4] = -LumaGreen;
+ mtrx[5] = 1.0 - LumaBlue;
+ mtrx[6] = 1.0 - LumaRed;
+ mtrx[7] = -LumaGreen;
+ mtrx[8] = -LumaBlue;
+
+ if (IsConstrained(oband->format->class)) {
+
+ /* Scale each row of matrix by compression factors */
+ scale_rows (mtrx, 1.0 / (Scale ),
+ 1.0 / (Scale * 1.6327),
+ 1.0 / (Scale * 1.3409));
+
+ /* Bias expressed as fraction of pixel range */
+ mtrx[9] = 0.0;
+ mtrx[10] = 0.612 * (RGBFloat) ((oband+1)->format->levels-1);
+ mtrx[11] = 0.5373 * (RGBFloat) ((oband+2)->format->levels-1);
+ }
+}
+
+static void
+copylumaYCCtoRGB(pvt,LumaRed,LumaGreen,LumaBlue,Scale,iband)
+ mpRGBPvtPtr pvt;
+ double LumaRed,LumaGreen,LumaBlue,Scale;
+ bandPtr iband;
+{
+ RGBFloat *mtrx = pvt->matrix;
+
+ if (LumaGreen < .01) LumaGreen = .01;
+
+ /*
+ ** See "A Planning Guide For Developers" from KODAK PhotoCD Products.
+ ** Typical values of (.299, .587, .114) are used for (LR,LG,LB).
+ **
+ ** R = 1 * Y + 0 * C1 + 1 * C2
+ ** G = 1 * Y - .194 * C1 - .509 * C2
+ ** B = 1 * Y + 1 * C1 + 0 * C2
+ **
+ ** By inverting the matrix symbolically we can deduce that the
+ ** constants .194 and .509 are not arbitrary:
+ **
+ ** R = 1 * Y + 0 * C1 + 1 * C2
+ ** G = 1 * Y - LB/LG * C1 - LR/LG * C2
+ ** B = 1 * Y + 1 * C1 + 0 * C2
+ **
+ ** Note: mtrx[3] == 1.0 when LR+LG+LB==1.0
+ */
+ mtrx[0] = 1.0;
+ mtrx[1] = 0.0;
+ mtrx[2] = 1.0;
+
+ mtrx[3] = (1.0 - LumaRed - LumaBlue) / LumaGreen;
+ mtrx[4] = - LumaBlue/LumaGreen;
+ mtrx[5] = - LumaRed/LumaGreen;
+
+ mtrx[6] = 1.0;
+ mtrx[7] = 1.0;
+ mtrx[8] = 0.0;
+
+ if (IsConstrained(iband->format->class)) {
+
+ /* Scale each column of matrix by compression factors */
+ scale_columns (mtrx, Scale, (Scale * 1.6327), (Scale * 1.3409));
+
+ /* Bias expressed as fraction of pixel range */
+ mtrx[9] = 0.0;
+ mtrx[10] = 0.612 * (RGBFloat) ((iband+1)->format->levels-1);
+ mtrx[11] = 0.5373 * (RGBFloat) ((iband+2)->format->levels-1);
+ }
+
+}
+
+/*------------------------------------------------------------------------
+-------------------------- initialize element . . . ----------------------
+------------------------------------------------------------------------*/
+
+static int
+SetupToRGB(flo,ped,modify)
+ floDefPtr flo;
+ peDefPtr ped;
+ int modify;
+{
+ peTexPtr pet = ped->peTex;
+ mpRGBPvtPtr pvt = (mpRGBPvtPtr) pet->private;
+ pTecCIEToRGBDefPtr pCIE = (pTecCIEToRGBDefPtr) ped->techPvt;
+ pTecYCCToRGBDefPtr pYCC = (pTecYCCToRGBDefPtr) ped->techPvt;
+ pTecYCbCrToRGBDefPtr pYCb = (pTecYCbCrToRGBDefPtr) ped->techPvt;
+
+ pvt->action = act_mmRR;
+ pvt->post = 0;
+
+ switch(ped->techVec->number) {
+ case xieValCIELabToRGB:
+ /* if whiteAdjusted, or calculate from inverted matrix */
+ copymatrix(pvt, pCIE->matrix);
+ copywhiteLABToRGB (pvt, pCIE->whiteAdjusted, pCIE->whitePoint);
+ copygamut (pvt, pCIE->gamutCompress);
+ pvt->action = act_preCIELab; /* calls act_mmRR */
+ break;
+ case xieValCIEXYZToRGB:
+ copymatrix(pvt, pCIE->matrix);
+ copywhiteXYZToRGB (pvt, pCIE->whiteAdjusted, pCIE->whitePoint);
+ copygamut (pvt, pCIE->gamutCompress);
+ break;
+ case xieValYCbCrToRGB:
+ copylumaYCbCrtoRGB(pvt, pYCb->red, pYCb->green, pYCb->blue);
+ copybiasYCbCr(pvt, pYCb->bias0, pYCb->bias1, pYCb->bias2);
+ copygamut(pvt, pYCb->gamutCompress);
+ break;
+ case xieValYCCToRGB:
+ copylumaYCCtoRGB(pvt, pYCC->red, pYCC->green, pYCC->blue,
+ pYCC->scale, &(pet->receptor[SRCtag].band[0]));
+ copygamut (pvt, pYCC->gamutCompress);
+ break;
+ }
+
+ CheckRGB(flo,ped,FALSE);
+
+ return TRUE;
+}
+
+static int
+SetupFromRGB(flo,ped,modify)
+ floDefPtr flo;
+ peDefPtr ped;
+ int modify;
+{
+ peTexPtr pet = ped->peTex;
+ mpRGBPvtPtr pvt = (mpRGBPvtPtr) pet->private;
+ pTecRGBToCIEDefPtr pCIE = (pTecRGBToCIEDefPtr) ped->techPvt;
+ pTecRGBToYCCDefPtr pYCC = (pTecRGBToYCCDefPtr) ped->techPvt;
+ pTecRGBToYCbCrDefPtr pYCb = (pTecRGBToYCbCrDefPtr) ped->techPvt;
+
+ pvt->action = act_mmRR;
+ pvt->post = (void (*)()) 0;
+
+ switch(ped->techVec->number) {
+ case xieValRGBToCIELab:
+ copymatrix(pvt, pCIE->matrix);
+ copywhiteLABFromRGB(pvt, pCIE->whiteAdjusted,
+ pCIE->whitePoint);
+ pvt->post = act_postCIELab;
+ break;
+ case xieValRGBToCIEXYZ:
+ copymatrix(pvt, pCIE->matrix);
+ copywhiteXYZFromRGB(pvt, pCIE->whiteAdjusted,
+ pCIE->whitePoint);
+ break;
+ case xieValRGBToYCbCr:
+ copylumaYCbCrfromRGB(pvt, pYCb->red, pYCb->green, pYCb->blue);
+ copybiasYCbCr(pvt, pYCb->bias0, pYCb->bias1, pYCb->bias2);
+ break;
+ case xieValRGBToYCC:
+ copylumaYCCfromRGB(pvt, pYCC->red, pYCC->green, pYCC->blue,
+ pYCC->scale, &(pet->emitter[0]));
+ break;
+ }
+
+ CheckRGB(flo,ped,TRUE);
+
+ return TRUE;
+}
+
+static void
+CheckRGB(flo,ped,fromrgb)
+ floDefPtr flo;
+ peDefPtr ped;
+ Bool fromrgb;
+{
+ peTexPtr pet = ped->peTex;
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ bandPtr oband = &(pet->emitter[0]);
+ CARD32 nbands = pet->receptor[SRCtag].inFlo->bands;
+ mpRGBPvtPtr pvt = (mpRGBPvtPtr) pet->private;
+
+ CARD32 c, cmin, cmax, l, lmin, lmax;
+ CARD32 band;
+
+ pvt->cvt_in[0] = pvt->cvt_in[1] = pvt->cvt_in[2] = (pointer (*)()) 0;
+ pvt->cvt_out[0] = pvt->cvt_out[1] = pvt->cvt_out[2] = (pointer (*)()) 0;
+ pvt->aux_buf[0] = pvt->aux_buf[1] = pvt->aux_buf[2] = (pointer) 0;
+
+ if (IsntConstrained(iband->format->class)) {
+ /* Already set up to activate floating routine */
+ return;
+ }
+
+ cmin = PAIR_PIXEL; cmax = BIT_PIXEL;
+ lmin = (1<<24); lmax = 1;
+
+ for (band = 0; band < nbands; band++, iband++, oband++) {
+
+ c = iband->format->class;
+ if (c < cmin) cmin = c;
+ if (c > cmax) cmax = c;
+
+ l = iband->format->levels;
+ if (l < lmin) lmin = l;
+ if (l > lmax) lmax = l;
+
+ if (IsntConstrained(oband->format->class))
+ continue;
+
+ c = oband->format->class;
+ if (c < cmin) cmin = c;
+ if (c > cmax) cmax = c;
+
+ l = oband->format->levels;
+ if (l < lmin) lmin = l;
+ if (l > lmax) lmax = l;
+
+ } iband -= 3; oband -= 3;
+
+
+ /* Scale each column of matrix to scale from input levels to 0 ... 1 */
+ scale_columns (pvt->matrix,
+ (double) (1.0 / ((iband+0)->format->levels - 1)),
+ (double) (1.0 / ((iband+1)->format->levels - 1)),
+ (double) (1.0 / ((iband+2)->format->levels - 1)));
+
+ if (IsntConstrained(oband->format->class)) {
+
+ /* Only RGBtoCIEXYZ and RGBtoCIELab will Unconstrain the data */
+
+ if (lmin > (1<<1) && lmax <= (1<<8)) { /* ALL Bytes */
+ pvt->action = act_mmBR;
+ return;
+ }
+
+ pvt->action = act_mmPR;
+ if (lmin > (1<<8)) /* ALL Pairs */
+ return;
+
+ for (band = 0; band < nbands; band++, iband++) { /* SOME Pairs */
+ int levels = iband->format->levels;
+ if (levels <= (1<<8)) {
+ pvt->cvt_in[band] = levels < (1<<1)
+ ? cvt_bit_to_pair
+ : cvt_byte_to_pair;
+ pvt->aux_buf[band] = (pointer)
+ XieMalloc( iband->format->width * sizeof(PairPixel));
+ if (!pvt->aux_buf[band])
+ AllocError(flo,ped,return);
+ }
+ } iband -= 3;
+ return;
+ }
+
+ /* If we got to here, we will implicitly HardClip the outputs */
+ pvt->post = (void (*)()) 0;
+
+ pvt->iclip[0] = (oband+0)->format->levels - 1;
+ pvt->iclip[1] = (oband+1)->format->levels - 1;
+ pvt->iclip[2] = (oband+2)->format->levels - 1;
+
+ /* Scale each row of matrix to map output from 0...1 to 0...nlev-1 */
+ scale_rows (pvt->matrix, (double) ((oband+0)->format->levels - 1),
+ (double) ((oband+1)->format->levels - 1),
+ (double) ((oband+2)->format->levels - 1));
+
+ /* Adjust bias for integer YCbCr and YCC */
+ if (!fromrgb) switch (ped->techVec->number) {
+ case xieValRGBToYCC: /* fall thru */
+ case xieValRGBToYCbCr: flip_bias(pvt->matrix);
+ break;
+ default: break;
+ }
+
+ if (lmin > (1<<1) && lmax <= (1<<8)) { /* ALL Bytes */
+ pvt->action = act_mmBB;
+ scale_mtrx(pvt->matrix,pvt->imatrix,(1<<SF_BYTESHIFT));
+ return;
+ }
+
+ /*
+ ** If they are not all bytes, we will process as pairs. But we may
+ ** need to convert some sources to pair pixels, and some outputs
+ ** may need to be converted back to bits or bytes.
+ */
+
+ pvt->action = act_mmPP;
+ scale_mtrx(pvt->matrix,pvt->imatrix,(1<<SF_PAIRSHIFT));
+
+ if (lmin > (1<<8)) /* ALL Pairs */
+ return;
+
+ for (band = 0; band < nbands; band++, iband++, oband++) {
+ int levels;
+ levels = iband->format->levels;
+ pvt->cvt_in[band] = levels <= (1<<1) ? cvt_bit_to_pair :
+ levels <= (1<<8) ? cvt_byte_to_pair :
+ (pointer (*)()) 0;
+ levels = oband->format->levels;
+ pvt->cvt_out[band] = levels <= (1<<1) ? cvt_pair_to_bit :
+ levels <= (1<<8) ? cvt_pair_to_byte :
+ (pointer (*)()) 0;
+ if ( pvt->cvt_in[band] || pvt->cvt_out[band]) {
+ pvt->aux_buf[band] = (pointer)
+ XieMalloc( iband->format->width * sizeof(PairPixel));
+ if (!pvt->aux_buf[band])
+ AllocError(flo,ped,return);
+ }
+ } iband -= 3; oband -= 3;
+ return;
+}
+
+static void
+ClearRGB(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ mpRGBPvtPtr pvt = (mpRGBPvtPtr) ped->peTex->private;
+
+ if (!pvt)
+ return;
+
+ pvt->cvt_in[0] = pvt->cvt_in[1] = pvt->cvt_in[2] = (pointer (*)()) 0;
+ pvt->cvt_out[0] = pvt->cvt_out[1] = pvt->cvt_out[2] = (pointer (*)()) 0;
+
+ if (pvt->aux_buf[0]) pvt->aux_buf[0] = (pointer) XieFree(pvt->aux_buf[0]);
+ if (pvt->aux_buf[1]) pvt->aux_buf[1] = (pointer) XieFree(pvt->aux_buf[1]);
+ if (pvt->aux_buf[2]) pvt->aux_buf[2] = (pointer) XieFree(pvt->aux_buf[2]);
+}
+
+/* end module mprgb.c */
diff --git a/xc/programs/Xserver/XIE/mixie/process/mpuncnst.c b/xc/programs/Xserver/XIE/mixie/process/mpuncnst.c
new file mode 100644
index 000000000..909f1ca09
--- /dev/null
+++ b/xc/programs/Xserver/XIE/mixie/process/mpuncnst.c
@@ -0,0 +1,310 @@
+/* $TOG: mpuncnst.c /main/6 1998/02/09 16:22:46 kaleb $ */
+/**** module mpuncnst.c ****/
+/******************************************************************************
+
+Copyright 1993, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+ NOTICE
+
+This software is being provided by AGE Logic, Inc. under the
+following license. By obtaining, using and/or copying this software,
+you agree that you have read, understood, and will comply with these
+terms and conditions:
+
+ Permission to use, copy, modify, distribute and sell this
+ software and its documentation for any purpose and without
+ fee or royalty and to grant others any or all rights granted
+ herein is hereby granted, provided that you agree to comply
+ with the following copyright notice and statements, including
+ the disclaimer, and that the same appears on all copies and
+ derivative works of the software and documentation you make.
+
+ "Copyright 1993, 1994 by AGE Logic, Inc."
+
+ THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO
+ REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of
+ example, but not limitation, AGE LOGIC MAKE NO
+ REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT
+ INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC
+ SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO
+ EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT,
+ INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS
+ OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR
+ ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR
+ BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES
+ HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+ The name of AGE Logic, Inc. may not be used in
+ advertising or publicity pertaining to this software without
+ specific, written prior permission from AGE Logic.
+
+ Title to this software shall at all times remain with AGE
+ Logic, Inc.
+*****************************************************************************
+
+ mpuncnst.c -- DDXIE Unconstrain element
+
+ Dean Verheiden && Larry Hare -- AGE Logic, Inc. May, 1993
+
+*****************************************************************************/
+/* $XFree86: xc/programs/Xserver/XIE/mixie/process/mpuncnst.c,v 3.3 1998/10/05 13:22:47 dawes Exp $ */
+
+
+#define _XIEC_MPUNCNST
+#define _XIEC_PUNCNST
+
+/*
+ * Include files
+ */
+
+/*
+ * Core X Includes
+ */
+#include <X.h>
+#include <Xproto.h>
+/*
+ * XIE Includes
+ */
+#include <XIE.h>
+#include <XIEproto.h>
+/*
+ * more X server includes.
+ */
+#include <misc.h>
+#include <dixstruct.h>
+/*
+ * Server XIE Includes
+ */
+#include <error.h>
+#include <macro.h>
+#include <element.h>
+#include <texstr.h>
+#include <xiemd.h>
+#include <memory.h>
+
+
+/*
+ * routines referenced by other DDXIE modules
+ */
+int miAnalyzeUnconstrain();
+
+/*
+ * routines used internal to this module
+ */
+static int CreateUnconstrain();
+static int InitializeUnconstrain();
+static int ActivateUnconstrain();
+static int ResetUnconstrain();
+static int DestroyUnconstrain();
+
+/*
+ * DDXIE Unconstrain entry points
+ */
+static ddElemVecRec UnconstrainVec = {
+ CreateUnconstrain,
+ InitializeUnconstrain,
+ ActivateUnconstrain,
+ (xieIntProc)NULL,
+ ResetUnconstrain,
+ DestroyUnconstrain
+};
+
+/*
+ * Local Declarations.
+ */
+
+typedef struct _mpuncnstndef {
+ void (*action) ();
+} mpUncnstPvtRec, *mpUncnstPvtPtr;
+
+static void CastQuad(), CastPair(), CastByte(), CastBit(), CastNothing();
+
+/*------------------------------------------------------------------------
+------------------------ fill in the vector ---------------------------
+------------------------------------------------------------------------*/
+int miAnalyzeUnconstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ped->ddVec = UnconstrainVec;
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+---------------------------- create peTex . . . --------------------------
+------------------------------------------------------------------------*/
+static int CreateUnconstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ int auxsize = xieValMaxBands * sizeof(mpUncnstPvtRec);
+
+ return MakePETex(flo,ped,auxsize,NO_SYNC,NO_SYNC);
+}
+
+/*------------------------------------------------------------------------
+---------------------------- initialize peTex . . . ----------------------
+------------------------------------------------------------------------*/
+static int InitializeUnconstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ peTexPtr pet = ped->peTex;
+ mpUncnstPvtPtr pvt = (mpUncnstPvtPtr) pet->private;
+ bandPtr iband;
+ int band, nbands, status;
+
+ /* ped->flags.modified = FALSE; */
+
+ status = InitReceptors(flo,ped,NO_DATAMAP,1) &&
+ InitEmitter(flo,ped,NO_DATAMAP,-1);
+
+ nbands = pet->receptor[SRCtag].inFlo->bands;
+ iband = &(pet->receptor[SRCtag].band[0]);
+
+ for(band = 0; band < nbands; band++, pvt++, iband++) {
+ switch (iband->format->class) {
+ case QUAD_PIXEL: pvt->action = CastQuad; break;
+ case PAIR_PIXEL: pvt->action = CastPair; break;
+ case BYTE_PIXEL: pvt->action = CastByte; break;
+ case BIT_PIXEL: pvt->action = (iband->format->levels == 1)
+ ? CastNothing : CastBit;
+ break;
+ default: ImplementationError(flo, ped, return(FALSE));
+ break;
+ }
+ }
+ return status;
+}
+
+/*------------------------------------------------------------------------
+----------------------------- crank some data ----------------------------
+------------------------------------------------------------------------*/
+
+
+static int ActivateUnconstrain(flo,ped,pet)
+ floDefPtr flo;
+ peDefPtr ped;
+ peTexPtr pet;
+{
+ mpUncnstPvtPtr pvt = (mpUncnstPvtPtr) pet->private;
+ bandPtr oband = &(pet->emitter[0]);
+ bandPtr iband = &(pet->receptor[SRCtag].band[0]);
+ int band, nbands = pet->receptor[SRCtag].inFlo->bands;
+
+ for(band = 0; band < nbands; band++, iband++, oband++, pvt++) {
+ register int bw = iband->format->width;
+ register RealPixel *outp;
+ register pointer voidp;
+
+ if (!(voidp = GetCurrentSrc(flo,pet,iband)) ||
+ !(outp = (RealPixel*)GetCurrentDst(flo,pet,oband))) continue;
+
+ do {
+
+ (*(pvt->action)) (voidp, outp, bw);
+
+ voidp = GetNextSrc(flo,pet,iband,TRUE);
+ outp = (RealPixel*)GetNextDst(flo,pet,oband,TRUE);
+
+ } while (!ferrCode(flo) && voidp && outp) ;
+
+ FreeData(flo, pet, iband, iband->current);
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------ get rid of run-time stuff -----------------------
+------------------------------------------------------------------------*/
+static int ResetUnconstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ ResetReceptors(ped);
+ ResetEmitter(ped);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+-------------------------- get rid of this element -----------------------
+------------------------------------------------------------------------*/
+static int DestroyUnconstrain(flo,ped)
+ floDefPtr flo;
+ peDefPtr ped;
+{
+ if(ped->peTex)
+ ped->peTex = (peTexPtr) XieFree(ped->peTex);
+
+ /* zap this element's entry point vector */
+ ped->ddVec.create = (xieIntProc)NULL;
+ ped->ddVec.initialize = (xieIntProc)NULL;
+ ped->ddVec.activate = (xieIntProc)NULL;
+ ped->ddVec.reset = (xieIntProc)NULL;
+ ped->ddVec.destroy = (xieIntProc)NULL;
+
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+--------------------- Lotsa Little Action Routines ---------------------
+------------------------------------------------------------------------*/
+
+#define MakeCast(fn_name,itype) \
+static void fn_name(voidp,outp,bw) \
+ pointer voidp; RealPixel *outp; int bw; \
+{ \
+ register itype *inp = (itype *) voidp; \
+ register int ix; \
+ for (ix = 0; ix < bw; ix++) \
+ *outp++ = (RealPixel) *inp++; \
+}
+
+MakeCast (CastQuad,QuadPixel)
+MakeCast (CastPair,PairPixel)
+MakeCast (CastByte,BytePixel)
+
+static void CastBit(voidp,outp,bw)
+ pointer voidp; RealPixel *outp; int bw;
+{
+ register LogInt *inp = (LogInt *) voidp;
+ register RealPixel One = (RealPixel) 1.0;
+ register RealPixel Zero = (RealPixel) 0.0;
+ register LogInt M, inval;
+ for ( ; bw >= LOGSIZE ; bw -= 32)
+ for (M=LOGLEFT, inval = *inp++; M; LOGRIGHT(M))
+ *outp++ = (inval & M) ? One : Zero;
+ if (bw)
+ for (M=LOGLEFT, inval = *inp++; bw; bw--, LOGRIGHT(M))
+ *outp++ = (inval & M) ? One : Zero;
+}
+
+static void CastNothing(voidp,outp,bw)
+ pointer voidp; RealPixel *outp; int bw;
+{
+ register RealPixel Zero = (RealPixel) 0.0;
+ register int ix;
+ for (ix = 0; ix < bw; ix++)
+ outp[ix] = Zero;
+}
+
+/* end module mpuncnst.c */
diff --git a/xc/programs/Xserver/XIE/xiemodule.c b/xc/programs/Xserver/XIE/xiemodule.c
new file mode 100644
index 000000000..b9220cf0b
--- /dev/null
+++ b/xc/programs/Xserver/XIE/xiemodule.c
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/XIE/xiemodule.c,v 1.6 1999/01/26 05:53:47 dawes Exp $ */
+
+#include "xf86Module.h"
+#include "XIE.h"
+
+static MODULESETUPPROTO(xieSetup);
+
+extern void XieInit(INITARGS);
+
+ExtensionModule XieExt =
+{
+ XieInit,
+ xieExtName,
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "xie",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+XF86ModuleData xieModuleData = { &VersRec, xieSetup, NULL };
+
+static pointer
+xieSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LoadExtension(&XieExt);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
+
diff --git a/xc/programs/Xserver/Xext/EVI.c b/xc/programs/Xserver/Xext/EVI.c
new file mode 100644
index 000000000..473d9a776
--- /dev/null
+++ b/xc/programs/Xserver/Xext/EVI.c
@@ -0,0 +1,179 @@
+/* $TOG: EVI.c /main/3 1998/01/23 15:19:47 kaleb $ */
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+#include "X.h"
+#include "Xproto.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "dix.h"
+#define _XEVI_SERVER_
+#include "XEVIstr.h"
+#include "EVIstruct.h"
+static unsigned char XEVIReqCode = 0;
+static EviPrivPtr eviPriv;
+static int
+ProcEVIQueryVersion(ClientPtr client)
+{
+ REQUEST(xEVIQueryVersionReq);
+ xEVIQueryVersionReply rep;
+ register int n;
+ REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XEVI_MAJOR_VERSION;
+ rep.minorVersion = XEVI_MAJOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+#define swapEviInfo(eviInfo, l) \
+{ \
+ int l1 = l; \
+ xExtendedVisualInfo *eviInfo1 = eviInfo; \
+ while (l1-- > 0) { \
+ swapl(&eviInfo1->core_visual_id, n); \
+ swapl(&eviInfo1->transparency_value, n); \
+ swaps(&eviInfo1->num_colormap_conflicts, n); \
+ eviInfo1++; \
+ } \
+}
+#define swapVisual(visual, l) \
+{ \
+ int l1 = l; \
+ VisualID32 *visual1 = visual; \
+ while (l1-- > 0) { \
+ swapl(visual1, n); \
+ visual1++; \
+ } \
+}
+static int
+ProcEVIGetVisualInfo(ClientPtr client)
+{
+ REQUEST(xEVIGetVisualInfoReq);
+ xEVIGetVisualInfoReply rep;
+ int n, n_conflict, n_info, sz_info, sz_conflict;
+ VisualID32 *conflict;
+ xExtendedVisualInfo *eviInfo;
+ int status;
+ REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
+ status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
+ &eviInfo, &n_info, &conflict, &n_conflict);
+ if (status != Success)
+ return status;
+ sz_info = n_info * sz_xExtendedVisualInfo;
+ sz_conflict = n_conflict * sz_VisualID32;
+ rep.type = X_Reply;
+ rep.n_info = n_info;
+ rep.n_conflicts = n_conflict;
+ rep.sequenceNumber = client->sequence;
+ rep.length = (sz_info + sz_conflict) >> 2;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.n_info, n);
+ swapl(&rep.n_conflicts, n);
+ swapEviInfo(eviInfo, n_info);
+ swapVisual(conflict, n_conflict);
+ }
+ WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
+ WriteToClient(client, sz_info, (char *)eviInfo);
+ WriteToClient(client, sz_conflict, (char *)conflict);
+ eviPriv->freeVisualInfo(eviInfo, conflict);
+ return (client->noClientException);
+}
+static int
+ProcEVIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_EVIQueryVersion:
+ return ProcEVIQueryVersion (client);
+ case X_EVIGetVisualInfo:
+ return ProcEVIGetVisualInfo (client);
+ default:
+ return BadRequest;
+ }
+}
+static int
+SProcEVIQueryVersion(client)
+ClientPtr client;
+{
+ REQUEST(xEVIQueryVersionReq);
+ int n;
+ swaps(&stuff->length, n);
+ return ProcEVIQueryVersion(client);
+}
+static int
+SProcEVIGetVisualInfo(ClientPtr client)
+{
+ register int n;
+ REQUEST(xEVIGetVisualInfoReq);
+ swaps(&stuff->length, n);
+ return ProcEVIGetVisualInfo(client);
+}
+static int
+SProcEVIDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_EVIQueryVersion:
+ return SProcEVIQueryVersion (client);
+ case X_EVIGetVisualInfo:
+ return SProcEVIGetVisualInfo (client);
+ default:
+ return BadRequest;
+ }
+}
+/*ARGSUSED*/
+static void
+EVIResetProc(ExtensionEntry *extEntry)
+{
+ eviDDXReset();
+}
+/****************
+ * XEVIExtensionInit
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ ****************/
+void
+EVIExtensionInit(void)
+{
+ ExtensionEntry *extEntry, *AddExtension();
+ if (extEntry = AddExtension(EVINAME, 0, 0,
+ ProcEVIDispatch,
+ SProcEVIDispatch,
+ EVIResetProc, StandardMinorOpcode))
+ {
+ XEVIReqCode = (unsigned char)extEntry->base;
+ eviPriv = eviDDXInit();
+ }
+}
diff --git a/xc/programs/Xserver/Xext/EVIstruct.h b/xc/programs/Xserver/Xext/EVIstruct.h
new file mode 100644
index 000000000..4cb3402f9
--- /dev/null
+++ b/xc/programs/Xserver/Xext/EVIstruct.h
@@ -0,0 +1,53 @@
+/* $TOG: EVIstruct.h /main/1 1997/11/24 16:48:35 kaleb $ */
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+#ifndef EVI_STRUCT_H
+#define EVI_STRUCT_H
+/*
+ ******************************************************************************
+ ** Per-ddx data
+ ******************************************************************************
+ */
+typedef int (*GetVisualInfoProc)(
+#if NeedNestedPrototypes
+ VisualID32*,
+ int,
+ xExtendedVisualInfo**,
+ int*,
+ VisualID32**,
+ int*
+#endif
+);
+typedef void (*FreeVisualInfoProc)(
+#if NeedNestedPrototypes
+ xExtendedVisualInfo*,
+ VisualID32*
+#endif
+);
+typedef struct _EviPrivRec {
+ GetVisualInfoProc getVisualInfo;
+ FreeVisualInfoProc freeVisualInfo;
+} EviPrivRec, *EviPrivPtr;
+extern EviPrivPtr eviDDXInit();
+extern void eviDDXReset();
+#endif /* EVI_STRUCT_H */
diff --git a/xc/programs/Xserver/Xext/Imakefile b/xc/programs/Xserver/Xext/Imakefile
new file mode 100644
index 000000000..99e21c8e4
--- /dev/null
+++ b/xc/programs/Xserver/Xext/Imakefile
@@ -0,0 +1,135 @@
+XCOMM $TOG: Imakefile /main/63 1997/11/24 16:48:40 kaleb $
+XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.28 1999/08/14 10:49:25 dawes Exp $
+
+#include <Server.tmpl>
+
+#if DoLoadableServer
+#define IHaveSubdirs
+SUBDIRS = extmod
+#endif
+
+#if BuildEVI
+#ifdef SGIArchitectureNotTog
+ EVISRCS = EVI.c sgiEVI.c
+ EVIOBJS = EVI.o sgiEVI.o
+#else
+ EVISRCS = EVI.c sampleEVI.c
+ EVIOBJS = EVI.o sampleEVI.o
+#endif
+#endif
+#if HasShm
+ SHMSRCS = shm.c
+ SHMOBJS = shm.o
+#endif
+
+#if BuildMultibuffer
+ MULTIBUFSRC = mbuf.c
+ MULTIBUFOBJ = mbuf.o
+#endif
+
+#if BuildScreenSaverExt
+ SCRNSAVSRC = saver.c
+ SCRNSAVOBJ = saver.o
+#endif
+
+#if BuildXF86VidModeExt
+ VIDMODESRCS = xf86vmode.c
+ VIDMODEOBJS = xf86vmode.o
+#endif
+
+#if BuildXF86MiscExt
+XF86MISCSRCS = xf86misc.c
+XF86MISCOBJS = xf86misc.o
+#endif
+
+#if BuildXF86DGA
+ XF86DGASRCS = xf86dga.c xf86dga2.c
+ XF86DGAOBJS = xf86dga.o xf86dga2.o
+#endif
+
+#if BuildXvExt
+ XVSRCS = xvmain.c xvdisp.c
+ XVOBJS = xvmain.o xvdisp.o
+#endif
+
+#if BuildXantiExt
+ XANTISRCS = anti.c
+ XANTIOBJS = anti.o
+#endif
+
+
+#if BuildAppgroup
+ APPGROUPSRCS = appgroup.c
+ APPGROUPOBJS = appgroup.o
+#endif
+#if BuildXCSecurity
+ SECURITYSRCS = security.c
+ SECURITYOBJS = security.o
+ SERVERCONFIGDIR = ServerConfigDir
+ POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\"
+#endif
+#if BuildCup
+ CUPSRCS = cup.c
+ CUPOBJS = cup.o
+#endif
+#if BuildXinerama
+ PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c
+ PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o
+ PNRXINCLUDES = -I$(FONTINCSRC) -I../mi
+#endif
+#if BuildDPMS
+ DPMSSRCS = dpms.c
+ DPMSOBJS = dpms.o
+#endif
+
+ SRCS = shape.c $(SHMSRCS) $(MULTIBUFSRC) \
+ mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \
+ bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
+ $(XF86MISCSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \
+ $(APPGROUPSRCS) xprint.c $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \
+ $(EVISRCS) $(XVSRCS) $(XANTISRCS)
+
+ OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \
+ mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \
+ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \
+ $(XF86MISCOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \
+ $(APPGROUPOBJS) xprint.o $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \
+ $(EVIOBJS) $(XVOBJS) $(XANTIOBJS)
+
+ SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) xprint.o \
+ xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS)
+
+XF86INCLUDES = -I$(XF86COMSRC)
+ INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
+ $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC)
+ LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
+
+NormalLibraryObjectRule()
+
+NormalLibraryTarget(ext,$(OBJS))
+LintLibraryTarget(ext,$(SRCS))
+NormalLintTarget($(SRCS))
+
+#if DoLoadableServer
+NormalLibraryTarget(exts,$(SOBJS))
+#endif
+
+#if BuildXCSecurity
+SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
+#endif
+
+LinkVarDirectory(xserver,.,xserver,.)
+
+#if BuildXCSecurity && InstallSecurityConfig
+InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR))
+#endif
+
+DependTarget()
+
+#if DoLoadableServer
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+#endif
+
+InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/xc/programs/Xserver/Xext/SecurityPolicy b/xc/programs/Xserver/Xext/SecurityPolicy
new file mode 100644
index 000000000..be6736a6f
--- /dev/null
+++ b/xc/programs/Xserver/Xext/SecurityPolicy
@@ -0,0 +1,88 @@
+version-1
+
+# $XConsortium: SecurityPolicy /main/3 1996/12/20 20:27:48 swick $
+
+# The site policy fields are interpreted by the XC-QUERY-SECURITY-1
+# authorization protocol. The values are arbitrary and site-specific.
+# Refer to the Security Extension Specification for the usage of the policies.
+#sitepolicy A
+#sitepolicy B
+#sitepolicy C
+
+# Property access rules:
+# property <property> <window> <permissions>
+# <window> ::= any | root | <propertyselector>
+# <propertyselector> ::= <property> | <property>=<value>
+# <permissions> :== [ <operation> | <action> | <space> ]*
+# <operation> :== r | w | d
+# r read
+# w write
+# d delete
+# <action> :== a | i | e
+# a allow
+# i ignore
+# e error
+
+# Allow reading of application resources, but not writing.
+property RESOURCE_MANAGER root ar iw
+property SCREEN_RESOURCES root ar iw
+
+# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
+# and allowing access may give away too much information.
+property CUT_BUFFER0 root irw
+property CUT_BUFFER1 root irw
+property CUT_BUFFER2 root irw
+property CUT_BUFFER3 root irw
+property CUT_BUFFER4 root irw
+property CUT_BUFFER5 root irw
+property CUT_BUFFER6 root irw
+property CUT_BUFFER7 root irw
+
+# If you are using Motif, you probably want these.
+property _MOTIF_DEFAULT_BINDINGS root ar iw
+property _MOTIF_DRAG_WINDOW root ar iw
+property _MOTIF_DRAG_TARGETS any ar iw
+property _MOTIF_DRAG_ATOMS any ar iw
+property _MOTIF_DRAG_ATOM_PAIRS any ar iw
+
+# If you are running CDE you also need these
+property _MOTIF_WM_INFO root arw
+property TT_SESSION root irw
+property WM_ICON_SIZE root irw
+property "SDT Pixel Set" any irw
+
+# The next two rules let xwininfo -tree work when untrusted.
+property WM_NAME any ar
+
+# Allow read of WM_CLASS, but only for windows with WM_NAME.
+# This might be more restrictive than necessary, but demonstrates
+# the <required property> facility, and is also an attempt to
+# say "top level windows only."
+property WM_CLASS WM_NAME ar
+
+# These next three let xlsclients work untrusted. Think carefully
+# before including these; giving away the client machine name and command
+# may be exposing too much.
+property WM_STATE WM_NAME ar
+property WM_CLIENT_MACHINE WM_NAME ar
+property WM_COMMAND WM_NAME ar
+
+# To let untrusted clients use the standard colormaps created by
+# xstdcmap, include these lines.
+property RGB_DEFAULT_MAP root ar
+property RGB_BEST_MAP root ar
+property RGB_RED_MAP root ar
+property RGB_GREEN_MAP root ar
+property RGB_BLUE_MAP root ar
+property RGB_GRAY_MAP root ar
+
+# To let untrusted clients use the color management database created
+# by xcmsdb, include these lines.
+property XDCCC_LINEAR_RGB_CORRECTION root ar
+property XDCCC_LINEAR_RGB_MATRICES root ar
+property XDCCC_GRAY_SCREENWHITEPOINT root ar
+property XDCCC_GRAY_CORRECTION root ar
+
+# To let untrusted clients use the overlay visuals that many vendors
+# support, include this line.
+property SERVER_OVERLAY_VISUALS root ar
diff --git a/xc/programs/Xserver/Xext/anti.c b/xc/programs/Xserver/Xext/anti.c
new file mode 100644
index 000000000..5348f340f
--- /dev/null
+++ b/xc/programs/Xserver/Xext/anti.c
@@ -0,0 +1,1403 @@
+
+/*
+ Copyright (c) 1998 by The XFree86 Project Inc.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+*/
+/*
+
+Parts of this file derived from code carrying the following Copyright:
+
+Copyright (c) 1986 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/anti.c,v 1.4 1999/06/06 08:48:37 dawes Exp $ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+#include "dixfontstr.h"
+#include "resource.h"
+#include "fontstruct.h"
+#include "extnsionst.h"
+#include "swapreq.h"
+#include "closestr.h"
+#include "XAntiproto.h"
+#include "anti.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <string.h>
+#endif
+
+static Bool XAntiCreateGC(GCPtr);
+
+static void XAntiValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void XAntiChangeGC(GCPtr, unsigned long);
+static void XAntiCopyGC(GCPtr, unsigned long, GCPtr);
+static void XAntiDestroyGC(GCPtr);
+static void XAntiChangeClip(GCPtr, int, pointer, int);
+static void XAntiDestroyClip(GCPtr);
+static void XAntiCopyClip(GCPtr, GCPtr);
+
+
+GCFuncs XAntiGCFuncs = {
+ XAntiValidateGC, XAntiChangeGC, XAntiCopyGC, XAntiDestroyGC,
+ XAntiChangeClip, XAntiDestroyClip, XAntiCopyClip
+};
+
+
+int ProcXAntiDispatch (ClientPtr);
+int SProcXAntiDispatch (ClientPtr);
+
+static Bool DrawAntiPolyText(PTclosurePtr);
+static Bool DrawAntiImageText(ITclosurePtr);
+
+int XAntiScreenIndex = -1;
+int XAntiGCIndex = -1;
+int XAntiReqCode;
+
+
+#define XANTI_GC_FUNC_PROLOGUE(pGC)\
+ AntiGCPtr pGCPriv = (AntiGCPtr) (pGC)->devPrivates[XAntiGCIndex].ptr;\
+ (pGC)->funcs = pGCPriv->wrapFuncs;
+
+#define XANTI_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &XAntiGCFuncs;
+
+static DISPATCH_PROC(ProcAntiQueryExtension);
+static DISPATCH_PROC(ProcAntiSetInterpolationPixels);
+static DISPATCH_PROC(ProcAntiInterpolateColors);
+static DISPATCH_PROC(ProcAntiPolyText);
+static DISPATCH_PROC(ProcAntiImageText8);
+static DISPATCH_PROC(ProcAntiImageText16);
+static DISPATCH_PROC(SProcAntiQueryExtension);
+static DISPATCH_PROC(SProcAntiSetInterpolationPixels);
+static DISPATCH_PROC(SProcAntiInterpolateColors);
+static DISPATCH_PROC(SProcAntiPolyText);
+static DISPATCH_PROC(SProcAntiImageText8);
+static DISPATCH_PROC(SProcAntiImageText16);
+
+
+static int
+AntiImageText(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nChars,
+ unsigned char *data,
+ int xorg,
+ int yorg,
+ int reqType,
+ XID did
+);
+
+static int
+AntiPolyText(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ unsigned char *pElt,
+ unsigned char *endReq,
+ int xorg,
+ int yorg,
+ int reqType,
+ XID did
+);
+
+
+
+
+int
+ProcXAntiDispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case XAnti_QueryExtension:
+ return ProcAntiQueryExtension(client);
+ case XAnti_InterpolateColors:
+ return ProcAntiInterpolateColors(client);
+ case XAnti_SetInterpolationPixels:
+ return ProcAntiSetInterpolationPixels(client);
+ case XAnti_PolyText8:
+ case XAnti_PolyText16:
+ return ProcAntiPolyText(client);
+ case XAnti_ImageText8:
+ return ProcAntiImageText8(client);
+ case XAnti_ImageText16:
+ return ProcAntiImageText16(client);
+ default:
+ return BadRequest;
+ }
+}
+
+
+int
+SProcXAntiDispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case XAnti_QueryExtension:
+ return SProcAntiQueryExtension(client);
+ case XAnti_InterpolateColors:
+ return SProcAntiInterpolateColors(client);
+ case XAnti_SetInterpolationPixels:
+ return SProcAntiSetInterpolationPixels(client);
+ case XAnti_PolyText8:
+ case XAnti_PolyText16:
+ return SProcAntiPolyText(client);
+ case XAnti_ImageText8:
+ return SProcAntiImageText8(client);
+ case XAnti_ImageText16:
+ return SProcAntiImageText16(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+XAntiResetProc (ExtensionEntry *extEntry)
+{
+ AntiScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+ int i;
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ pScreenPriv =
+ (AntiScreenPtr) pScreen->devPrivates[XAntiScreenIndex].ptr;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ xfree((pointer) pScreenPriv);
+ pScreen->devPrivates[XAntiScreenIndex].ptr = (pointer)NULL;
+ }
+}
+
+
+static void
+XAntiUndoDamage(
+ int i /* screens which we already set up */
+){
+ AntiScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+ int j;
+ for(j = 0; j < i; i++) {
+ /* unwrap the screen */
+ pScreen = screenInfo.screens[j];
+ pScreenPriv =
+ (AntiScreenPtr) pScreen->devPrivates[XAntiScreenIndex].ptr;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ /* free the private */
+ xfree((pointer) pScreenPriv);
+ pScreen->devPrivates[XAntiScreenIndex].ptr = (pointer)NULL;
+ }
+ ErrorF("Antialiased font extension initialization failed!\n");
+}
+
+
+static void
+XAntiCopyGCPrivate(GCPtr old, GCPtr new)
+{
+ AntiGCPtr gcPrivNew = XANTI_GET_GC_PRIVATE(new);
+ AntiGCPtr gcPrivOld = XANTI_GET_GC_PRIVATE(old);
+ if(gcPrivOld->NumPixels) {
+ int size = gcPrivOld->NumPixels * sizeof(unsigned long);
+ gcPrivNew->Pixels = xalloc(size);
+ if(gcPrivNew->Pixels) {
+ gcPrivNew->NumPixels = gcPrivOld->NumPixels;
+ memcpy(gcPrivNew->Pixels, gcPrivOld->Pixels, size);
+ }
+ }
+}
+
+void
+XAntiExtensionInit(void)
+{
+ ScreenPtr pScreen;
+ AntiScreenPtr pScreenPriv;
+ ExtensionEntry *extEntry;
+ int i;
+
+ if((XAntiScreenIndex = AllocateScreenPrivateIndex()) < 0) return;
+ if((XAntiGCIndex = AllocateGCPrivateIndex()) < 0) return;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+
+ if (!AllocateGCPrivate(pScreen, XAntiGCIndex, sizeof(AntiGCRec))) {
+ XAntiUndoDamage(i);
+ return;
+ }
+
+ if (!(pScreenPriv = (AntiScreenPtr)xalloc(sizeof(AntiScreenRec)))) {
+ XAntiUndoDamage(i);
+ return;
+ }
+
+ pScreen->devPrivates[XAntiScreenIndex].ptr = (pointer)pScreenPriv;
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = XAntiCreateGC;
+
+ pScreenPriv->PolyTextFunc = DrawAntiPolyText;
+ pScreenPriv->ImageTextFunc = DrawAntiImageText;
+ }
+
+ extEntry = AddExtension(XAntiName, 0 /*events*/, 0 /*errors*/,
+ ProcXAntiDispatch, SProcXAntiDispatch,
+ XAntiResetProc, StandardMinorOpcode);
+
+ if(!extEntry)
+ XAntiUndoDamage(screenInfo.numScreens);
+ else
+ XAntiReqCode = extEntry->base;
+}
+
+
+/* Screen functions */
+
+
+static Bool
+XAntiCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ Bool ret;
+ AntiGCPtr pGCPriv = (AntiGCPtr)(pGC->devPrivates[XAntiGCIndex].ptr);
+ AntiScreenPtr pScreenPriv =
+ (AntiScreenPtr) pScreen->devPrivates[XAntiScreenIndex].ptr;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ pGCPriv->NumPixels = 0;
+ pGCPriv->Pixels = NULL;
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGCPriv->clientData = FALSE;
+ pGC->funcs = &XAntiGCFuncs;
+ }
+
+ pScreen->CreateGC = XAntiCreateGC;
+
+ return ret;
+}
+
+/* GC Funcs */
+
+static void
+XAntiValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ XANTI_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
+ XANTI_GC_FUNC_EPILOGUE (pGC);
+}
+
+/* It's a shame that we have to wrap all the GCFuncs just to free
+ the extra colors. Alternatively you could have a static array
+ in the GC private, but it would have to be large enough to
+ accomodate any number of levels that would be used with it and
+ you'd have all the GCs unnecessarily large, particularly in the
+ case where someone wanted to be using 256 interpolation levels. */
+
+static void
+XAntiDestroyGC(GCPtr pGC)
+{
+ XANTI_GC_FUNC_PROLOGUE (pGC);
+
+ if(pGCPriv->Pixels)
+ xfree(pGCPriv->Pixels);
+
+ (*pGC->funcs->DestroyGC)(pGC);
+ XANTI_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAntiChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ XANTI_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ XANTI_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAntiCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ XANTI_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ XANTI_GC_FUNC_EPILOGUE (pGCDst);
+}
+static void
+XAntiChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ XANTI_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ XANTI_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAntiCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ XANTI_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ XANTI_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XAntiDestroyClip(GCPtr pGC)
+{
+ XANTI_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ XANTI_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+/********/
+
+
+
+
+static int
+ProcAntiQueryExtension(ClientPtr client)
+{
+ xAntiQueryExtensionReply rep;
+ REQUEST(xAntiQueryExtensionReq);
+ REQUEST_SIZE_MATCH(xAntiQueryExtensionReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.version = XAntiVersion;
+ rep.revision = XAntiRevision;
+
+ if(client->swapped) {
+ register char n;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.version, n);
+ swaps(&rep.revision, n);
+ }
+
+ WriteToClient(client, sz_xAntiQueryExtensionReply, (char*) &rep);
+
+ return(client->noClientException);
+}
+
+
+static int
+ProcAntiPolyText(ClientPtr client)
+{
+ int err;
+ REQUEST(xAntiPolyTextReq);
+ DrawablePtr pDraw;
+ GCPtr pGC;
+
+ REQUEST_AT_LEAST_SIZE(xAntiPolyTextReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = AntiPolyText(client,
+ pDraw,
+ pGC,
+ (unsigned char *)&stuff[1],
+ ((unsigned char *) stuff) + (client->req_len << 2),
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ return(client->noClientException);
+ else
+ return err;
+}
+
+
+static int
+ProcAntiImageText8(ClientPtr client)
+{
+ int err;
+ DrawablePtr pDraw;
+ GCPtr pGC;
+
+ REQUEST(xAntiImageTextReq);
+
+ REQUEST_FIXED_SIZE(xAntiImageTextReq, stuff->nChars);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = AntiImageText(client,
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ return(client->noClientException);
+ else
+ return err;
+}
+
+static int
+ProcAntiImageText16(ClientPtr client)
+{
+ int err;
+ DrawablePtr pDraw;
+ GCPtr pGC;
+
+ REQUEST(xAntiImageTextReq);
+
+ REQUEST_FIXED_SIZE(xAntiImageTextReq, stuff->nChars << 1);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = AntiImageText(client,
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ return(client->noClientException);
+ else
+ return err;
+}
+
+
+static int
+ProcAntiSetInterpolationPixels(ClientPtr client)
+{
+ CARD32 *newPix;
+ AntiGCPtr gcPriv;
+ GCPtr pGC;
+ int i;
+
+ REQUEST(xAntiSetInterpolationPixelsReq);
+
+ REQUEST_FIXED_SIZE(xAntiSetInterpolationPixelsReq, stuff->number << 2);
+
+ if((stuff->number + 1) & stuff->number)
+ return BadValue;
+
+ if((stuff->number < 0) || (stuff->number > 255))
+ return BadValue;
+
+ SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);
+ gcPriv = XANTI_GET_GC_PRIVATE(pGC);
+
+ if(stuff->number != gcPriv->NumPixels) {
+ unsigned long *pixels = NULL;
+
+ if(stuff->number) {
+ pixels = (unsigned long*)xalloc(
+ stuff->number * sizeof(unsigned long));
+ if(!pixels)
+ return BadAlloc;
+ }
+
+ if(gcPriv->Pixels)
+ xfree(gcPriv->Pixels);
+
+ gcPriv->Pixels = pixels;
+ gcPriv->NumPixels = stuff->number;
+ }
+
+ newPix = (CARD32*)&stuff[1];
+
+ for(i = 0; i < stuff->number; i++)
+ gcPriv->Pixels[i] = newPix[i];
+
+ gcPriv->clientData = TRUE;
+ return(client->noClientException);
+}
+
+
+static void
+FindInterpolationColors(
+ ColormapPtr pmap,
+ int number,
+ xColorItem *colors,
+ unsigned long fg,
+ unsigned long bg
+){
+ double red, green, blue, dr, dg, db;
+ xColorItem color;
+ Pixel pix[2];
+ xrgb rgb[2];
+ int i;
+
+ pix[0] = fg;
+ pix[1] = bg;
+ QueryColors(pmap, 2, pix, rgb);
+
+ red = (double)rgb[0].red;
+ green = (double)rgb[0].green;
+ blue = (double)rgb[0].blue;
+
+ dr = ((double)rgb[1].red - red)/(double)(number + 1);
+ dg = ((double)rgb[1].green - green)/(double)(number + 1);
+ db = ((double)rgb[1].blue - blue)/(double)(number + 1);
+
+ for(i = 0; i < number; i++) {
+ red += dr;
+ green += dg;
+ blue += db;
+
+ colors[i].red = color.red = (unsigned short)(red + 0.5);
+ colors[i].green = color.green = (unsigned short)(green + 0.5);
+ colors[i].blue = color.blue = (unsigned short)(blue + 0.5);
+ colors[i].flags = color.flags = DoRed | DoGreen | DoBlue;
+
+ FakeAllocColor(pmap, &color); /* just to get the pixel */
+
+ colors[i].pixel = color.pixel;
+
+ FakeFreeColor(pmap, color.pixel);
+ }
+}
+
+static int
+ProcAntiInterpolateColors(ClientPtr client)
+{
+ xAntiInterpolateColorsReply rep;
+ xColorItem *colors;
+ ColormapPtr pmap;
+ GCPtr pGC;
+
+ REQUEST(xAntiInterpolateColorsReq);
+ REQUEST_SIZE_MATCH(xAntiInterpolateColorsReq);
+
+ if((stuff->number <= 0) || (stuff->number > 254)) return BadValue;
+
+ SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);
+
+ pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->colormap,
+ RT_COLORMAP, SecurityReadAccess);
+
+ if(!pmap) return BadColor;
+
+ colors = (xColorItem*)ALLOCATE_LOCAL(stuff->number * sizeof(xColorItem));
+
+ FindInterpolationColors(pmap, stuff->number, colors,
+ pGC->fgPixel, pGC->bgPixel);
+
+ rep.type = X_Reply;
+ rep.length = (stuff->number * sizeof(xColorItem)) >> 2;
+ rep.sequenceNumber = client->sequence;
+
+
+ if(client->swapped) {
+ register char n;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+
+ WriteToClient(client, sz_xAntiInterpolateColorsReply, (char*) &rep);
+
+ if(client->swapped) {
+ register char n;
+ int i;
+
+ for(i = 0; i < stuff->number; i++) {
+ swapl(&colors[i].pixel, n);
+ swaps(&colors[i].red, n);
+ swaps(&colors[i].green, n);
+ swaps(&colors[i].blue, n);
+ }
+ }
+
+ WriteToClient(client, stuff->number*sizeof(xColorItem), (char*)colors);
+
+ DEALLOCATE_LOCAL(colors);
+
+ return(client->noClientException);
+}
+
+
+/******* Image text **********/
+
+
+#define TextEltHeader 2
+#define FontShiftSize 5
+static XID clearGC[] = { CT_NONE };
+#define clearGCmask (GCClipMask)
+
+
+static Bool
+DrawAntiImageText(ITclosurePtr c) {
+ unsigned long n;
+ CharInfoPtr charPtr[255]; /* encoding only has 1 byte for count */
+ FontEncoding fontEncoding = Linear8Bit;
+ AntiGCPtr gcPriv = XANTI_GET_GC_PRIVATE(c->pGC);
+ GetAntiGlyphsFuncPtr *getGlyphs = XANTI_GET_FONT_PRIVATE(c->pGC->font);
+
+ if(!getGlyphs) return FALSE;
+
+ if(!gcPriv->NumPixels) {
+ if(gcPriv->clientData) return FALSE;
+
+ /* otherwise, we generate some reasonable colors if appropriate */
+ return FALSE;
+ }
+
+ if(c->itemSize == 2)
+ fontEncoding = (FONTLASTROW(c->pGC->font) == 0) ? Linear16Bit : TwoD16Bit;
+
+ if(Success != (*getGlyphs)(c->pGC->font, (unsigned long)(c->nChars),
+ (unsigned char *)(c->data), fontEncoding, &n, charPtr,
+ gcPriv->NumPixels + 1))
+ return FALSE;
+
+ if(n) {
+ int i, j;
+ XID oldFG = c->pGC->fgPixel;
+ int Pitch[255];
+ CharInfoRec *charData;
+
+ (*c->pGC->ops->ImageGlyphBlt)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ n, charPtr, FONTGLYPHS(c->pGC->font));
+
+ if(!(charData = (CharInfoPtr)ALLOCATE_LOCAL(n * sizeof(CharInfoRec))))
+ return FALSE;
+
+ /* we need a modifiable copy of the CharInfoRecs */
+ for(i = 0; i < n; i++) {
+ memcpy(&charData[i], charPtr[i], sizeof(CharInfoRec));
+ Pitch[i] = GLYPHWIDTHBYTESPADDED(charPtr[i]) *
+ GLYPHHEIGHTPIXELS(charPtr[i]);
+ }
+
+ for(i = 0; i < gcPriv->NumPixels; i++) {
+ for(j = 0; j < n; j++)
+ charData[j].bits += Pitch[j];
+ ChangeGC(c->pGC, GCForeground, (XID*)&(gcPriv->Pixels[i]));
+ ValidateGC(c->pDraw, c->pGC);
+ (*c->pGC->ops->PolyGlyphBlt)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ n, &charData, FONTGLYPHS(c->pGC->font));
+ }
+
+ ChangeGC(c->pGC, GCForeground, &oldFG);
+ ValidateGC(c->pDraw, c->pGC);
+ DEALLOCATE_LOCAL(charData);
+ }
+
+ return TRUE;
+}
+
+
+static int
+doAntiImageText(
+ ClientPtr client,
+ ITclosurePtr c
+){
+ int err = Success, lgerr; /* err is in X error, not font error, space */
+ FontPathElementPtr fpe;
+
+ if (client->clientGone)
+ {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
+ }
+
+ /* Make sure our drawable hasn't disappeared while we slept. */
+ if (c->slept &&
+ c->pDraw &&
+ c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
+ RC_DRAWABLE, SecurityWriteAccess))
+ {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
+ }
+
+ lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
+ if (lgerr == Suspended)
+ {
+ if (!c->slept) {
+ GCPtr pGC, oldGC;
+ unsigned char *data;
+ ITclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to
+ save some state. Similar problem to that handled
+ in doAntiPolyText, but much simpler because the
+ request structure is much simpler. */
+
+ new_closure = (ITclosurePtr) xalloc(sizeof(ITclosureRec));
+ if (!new_closure)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+ c = new_closure;
+
+ data = (unsigned char *)xalloc(c->nChars * c->itemSize);
+ if (!data)
+ {
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(data, c->data, c->nChars * c->itemSize);
+ c->data = data;
+
+ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
+ if (!pGC)
+ {
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
+ GCForeground | GCBackground | GCFillStyle |
+ GCTile | GCStipple | GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) != Success)
+ {
+ FreeScratchGC(pGC);
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+
+ oldGC = c->pGC;
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ /* We need to make sure that our scratch GC has
+ the correct private data */
+ XAntiCopyGCPrivate(oldGC, c->pGC);
+
+
+ c->slept = TRUE;
+ ClientSleep(client, (ClientSleepProcPtr)doAntiImageText,
+ (pointer) c);
+ }
+ return TRUE;
+ }
+ else if (lgerr != Successful)
+ {
+ err = FontToXError(lgerr);
+ goto bail;
+ }
+ if (c->pDraw) {
+ AntiScreenPtr pScreenPriv = XANTI_GET_SCREEN_PRIVATE(c->pDraw);
+
+ if(!(*pScreenPriv->ImageTextFunc)(c)) {
+ (* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, c->data);
+ }
+ }
+
+bail:
+
+ if (err != Success && c->client != serverClient) {
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (c->slept)
+ {
+ AntiGCPtr gcPriv = XANTI_GET_GC_PRIVATE(c->pGC);
+ ClientWakeup(c->client);
+ ChangeGC(c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font)0);
+ c->pGC->font = NullFont;
+
+ /* We need to make sure we free any private data */
+ if(gcPriv->Pixels) xfree(gcPriv->Pixels);
+
+ FreeScratchGC(c->pGC);
+ xfree(c->data);
+ xfree(c);
+ }
+ return TRUE;
+}
+
+
+static int
+AntiImageText(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nChars,
+ unsigned char *data,
+ int xorg,
+ int yorg,
+ int reqType,
+ XID did
+){
+ ITclosureRec local_closure;
+
+ local_closure.client = client;
+ local_closure.pDraw = pDraw;
+ local_closure.pGC = pGC;
+ local_closure.nChars = nChars;
+ local_closure.data = data;
+ local_closure.xorg = xorg;
+ local_closure.yorg = yorg;
+ if ((local_closure.reqType = reqType) == XAnti_ImageText8) {
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
+ local_closure.itemSize = 1;
+ } else {
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
+ local_closure.itemSize = 2;
+ }
+ local_closure.did = did;
+ local_closure.slept = FALSE;
+
+ (void) doAntiImageText(client, &local_closure);
+ return Success;
+}
+
+
+/******** Poly Text **********/
+
+
+static Bool
+DrawAntiPolyText(PTclosurePtr c)
+{
+ unsigned long n;
+ int w = 0;
+ CharInfoPtr charPtr[255];
+ FontEncoding fontEncoding = Linear8Bit;
+ AntiGCPtr gcPriv = XANTI_GET_GC_PRIVATE(c->pGC);
+ GetAntiGlyphsFuncPtr *getGlyphs = XANTI_GET_FONT_PRIVATE(c->pGC->font);
+
+
+ if(!gcPriv->NumPixels || !getGlyphs) return FALSE;
+
+ if(c->itemSize == 2) {
+ fontEncoding = (FONTLASTROW(c->pGC->font) == 0) ? Linear16Bit : TwoD16Bit;
+ }
+
+
+ if(Success != (*getGlyphs)(c->pGC->font, (unsigned long)(*c->pElt),
+ (unsigned char *)(c->pElt + TextEltHeader),
+ fontEncoding, &n, charPtr, gcPriv->NumPixels + 1))
+ return FALSE;
+
+ if(n) {
+ int i, j;
+ XID oldFG = c->pGC->fgPixel;
+ int Pitch[255];
+ CharInfoRec *charData;
+
+ (*c->pGC->ops->PolyGlyphBlt)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ n, charPtr, FONTGLYPHS(c->pGC->font));
+
+ if(!(charData = (CharInfoPtr)ALLOCATE_LOCAL(n * sizeof(CharInfoRec))))
+ return FALSE;
+
+ /* we need a modifiable copy of the CharInfoRecs */
+ for(i = 0; i < n; i++) {
+ memcpy(&charData[i], charPtr[i], sizeof(CharInfoRec));
+ Pitch[i] = GLYPHWIDTHBYTESPADDED(charPtr[i]) *
+ GLYPHHEIGHTPIXELS(charPtr[i]);
+ w += charPtr[i]->metrics.characterWidth;
+ }
+
+ for(i = 0; i < gcPriv->NumPixels; i++) {
+ for(j = 0; j < n; j++)
+ charData[j].bits += Pitch[j];
+ ChangeGC(c->pGC, GCForeground, (XID*)&(gcPriv->Pixels[i]));
+ ValidateGC(c->pDraw, c->pGC);
+ (*c->pGC->ops->PolyGlyphBlt)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ n, &charData, FONTGLYPHS(c->pGC->font));
+ }
+
+ ChangeGC(c->pGC, GCForeground, &oldFG);
+ ValidateGC(c->pDraw, c->pGC);
+ DEALLOCATE_LOCAL(charData);
+ }
+
+ c->xorg += w;
+
+ return TRUE;
+}
+
+
+static int
+doAntiPolyText(
+ ClientPtr client,
+ PTclosurePtr c
+){
+ register FontPtr pFont = c->pGC->font, oldpFont;
+ Font fid, oldfid;
+ int err = Success, lgerr; /* err is in X error, not font error, space */
+ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state;
+ FontPathElementPtr fpe;
+ GCPtr origGC;
+
+ if (client->clientGone)
+ {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+
+ if (c->slept)
+ {
+ /* Client has died, but we cannot bail out right now. We
+ need to clean up after the work we did when going to
+ sleep. Setting the drawable pointer to 0 makes this
+ happen without any attempts to render or perform other
+ unnecessary activities. */
+ c->pDraw = (DrawablePtr)0;
+ }
+ else
+ {
+ err = Success;
+ goto bail;
+ }
+ }
+
+ /* Make sure our drawable hasn't disappeared while we slept. */
+ if (c->slept &&
+ c->pDraw &&
+ c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
+ RC_DRAWABLE, SecurityWriteAccess))
+ {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client and avoid further
+ rendering while we clean up after ourself. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ c->pDraw = (DrawablePtr)0;
+ }
+ client_state = c->slept ? SLEEPING : NEVER_SLEPT;
+
+ while (c->endReq - c->pElt > TextEltHeader)
+ {
+ if (*c->pElt == FontChange)
+ {
+ if (c->endReq - c->pElt < FontShiftSize)
+ {
+ err = BadLength;
+ goto bail;
+ }
+
+ oldpFont = pFont;
+ oldfid = fid;
+
+ fid = ((Font)*(c->pElt+4)) /* big-endian */
+ | ((Font)*(c->pElt+3)) << 8
+ | ((Font)*(c->pElt+2)) << 16
+ | ((Font)*(c->pElt+1)) << 24;
+ pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT,
+ SecurityReadAccess);
+ if (!pFont)
+ {
+ client->errorValue = fid;
+ err = BadFont;
+ /* restore pFont and fid for step 4 (described below) */
+ pFont = oldpFont;
+ fid = oldfid;
+
+ /* If we're in START_SLEEP mode, the following step
+ shortens the request... in the unlikely event that
+ the fid somehow becomes valid before we come through
+ again to actually execute the polytext, which would
+ then mess up our refcounting scheme badly. */
+ c->err = err;
+ c->endReq = c->pElt;
+
+ goto bail;
+ }
+
+ /* Step 3 (described below) on our new font */
+ if (client_state == START_SLEEP)
+ pFont->refcnt++;
+ else
+ {
+ if (pFont != c->pGC->font && c->pDraw)
+ {
+ ChangeGC( c->pGC, GCFont, &fid);
+ ValidateGC(c->pDraw, c->pGC);
+ if (c->reqType == XAnti_PolyText8)
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
+ else
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
+ }
+
+ /* Undo the refcnt++ we performed when going to sleep */
+ if (client_state == SLEEPING)
+ (void)CloseFont(c->pGC->font, (Font)0);
+ }
+ c->pElt += FontShiftSize;
+ }
+ else /* print a string */
+ {
+ unsigned char *pNextElt;
+ pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize;
+ if ( pNextElt > c->endReq)
+ {
+ err = BadLength;
+ goto bail;
+ }
+ if (client_state == START_SLEEP)
+ {
+ c->pElt = pNextElt;
+ continue;
+ }
+ if (c->pDraw)
+ {
+ lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize,
+ c->pElt + TextEltHeader);
+ }
+ else lgerr = Successful;
+
+ if (lgerr == Suspended)
+ {
+ if (!c->slept) {
+ int len;
+ GCPtr pGC;
+ PTclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to do a few things
+ to ensure successful and atomic-appearing execution of the
+ remainder of the request. First, copy the remainder of the
+ request into a safe malloc'd area. Second, create a scratch GC
+ to use for the remainder of the request. Third, mark all fonts
+ referenced in the remainder of the request to prevent their
+ deallocation. Fourth, make the original GC look like the
+ request has completed... set its font to the final font value
+ from this request. These GC manipulations are for the unlikely
+ (but possible) event that some other client is using the GC.
+ Steps 3 and 4 are performed by running this procedure through
+ the remainder of the request in a special no-render mode
+ indicated by client_state = START_SLEEP. */
+
+ /* Step 1 */
+ /* Allocate a malloc'd closure structure to replace
+ the local one we were passed */
+ new_closure = (PTclosurePtr) xalloc(sizeof(PTclosureRec));
+ if (!new_closure)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+ c = new_closure;
+
+ len = c->endReq - c->pElt;
+ c->data = (unsigned char *)xalloc(len);
+ if (!c->data)
+ {
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(c->data, c->pElt, len);
+ c->pElt = c->data;
+ c->endReq = c->pElt + len;
+
+ /* Step 2 */
+
+ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
+ if (!pGC)
+ {
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(c->pGC, pGC, GCFunction |
+ GCPlaneMask | GCForeground |
+ GCBackground | GCFillStyle |
+ GCTile | GCStipple |
+ GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) !=
+ Success)
+ {
+ FreeScratchGC(pGC);
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ origGC = c->pGC;
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ /* We need to make sure that our scratch GC has
+ the correct private data */
+ XAntiCopyGCPrivate(origGC, c->pGC);
+
+ c->slept = TRUE;
+ ClientSleep(client,
+ (ClientSleepProcPtr)doAntiPolyText,
+ (pointer) c);
+
+ /* Set up to perform steps 3 and 4 */
+ client_state = START_SLEEP;
+ continue; /* on to steps 3 and 4 */
+ }
+ return TRUE;
+ }
+ else if (lgerr != Successful)
+ {
+ err = FontToXError(lgerr);
+ goto bail;
+ }
+ if (c->pDraw) {
+ AntiScreenPtr pScreenPriv = XANTI_GET_SCREEN_PRIVATE(c->pDraw);
+ XID newVals[2];
+ XID oldVals[2];
+ int mask = 0;
+
+ if(c->pGC->alu != GXcopy) {
+ newVals[0] = GXcopy;
+ oldVals[0] = c->pGC->alu;
+ mask |= GCFunction;
+ }
+
+ if(c->pGC->fillStyle != FillSolid) {
+ newVals[1] = FillSolid;
+ oldVals[1] = c->pGC->fillStyle;
+ mask |= GCFillStyle;
+ if(!(mask & GCFunction)) {
+ newVals[0] = newVals[1];
+ oldVals[0] = oldVals[1];
+ }
+ }
+
+ if(mask) {
+ ChangeGC(c->pGC, mask, newVals);
+ ValidateGC(c->pDraw, c->pGC);
+ }
+
+ c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
+ if(!(*pScreenPriv->PolyTextFunc)(c)) {
+ c->xorg = (* c->polyText)(c->pDraw, c->pGC,
+ c->xorg, c->yorg,
+ *c->pElt, c->pElt + TextEltHeader);
+ }
+
+ if(mask) {
+ ChangeGC(c->pGC, mask, oldVals);
+ ValidateGC(c->pDraw, c->pGC);
+ }
+
+ }
+ c->pElt = pNextElt;
+ }
+ }
+
+bail:
+
+ if (client_state == START_SLEEP)
+ {
+ /* Step 4 */
+ if (pFont != origGC->font)
+ {
+ ChangeGC(origGC, GCFont, &fid);
+ ValidateGC(c->pDraw, origGC);
+ }
+
+ /* restore pElt pointer for execution of remainder of the request */
+ c->pElt = c->data;
+ return TRUE;
+ }
+
+ if (c->err != Success) err = c->err;
+ if (err != Success && c->client != serverClient) {
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (c->slept)
+ {
+ AntiGCPtr gcPriv = XANTI_GET_GC_PRIVATE(c->pGC);
+ ClientWakeup(c->client);
+ ChangeGC(c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font)0);
+ c->pGC->font = NullFont;
+
+ /* We need to make sure we free any private data */
+ if(gcPriv->Pixels) xfree(gcPriv->Pixels);
+
+ FreeScratchGC(c->pGC);
+ xfree(c->data);
+ xfree(c);
+ }
+ return TRUE;
+}
+
+static int
+AntiPolyText(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ unsigned char *pElt,
+ unsigned char *endReq,
+ int xorg,
+ int yorg,
+ int reqType,
+ XID did
+){
+ PTclosureRec local_closure;
+
+ local_closure.pElt = pElt;
+ local_closure.endReq = endReq;
+ local_closure.client = client;
+ local_closure.pDraw = pDraw;
+ local_closure.xorg = xorg;
+ local_closure.yorg = yorg;
+ if ((local_closure.reqType = reqType) == XAnti_PolyText8) {
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
+ local_closure.itemSize = 1;
+ } else {
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
+ local_closure.itemSize = 2;
+ }
+ local_closure.pGC = pGC;
+ local_closure.did = did;
+ local_closure.err = Success;
+ local_closure.slept = FALSE;
+
+ (void) doAntiPolyText(client, &local_closure);
+ return Success;
+}
+
+
+#undef TextEltHeader
+#undef FontShiftSize
+
+
+/**** swaps ****/
+
+
+static int
+SProcAntiQueryExtension(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiQueryExtensionReq);
+ swaps(&stuff->length, n);
+ return ProcAntiQueryExtension(client);
+}
+
+static int
+SProcAntiSetInterpolationPixels(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiSetInterpolationPixelsReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->gc, n);
+ swapl(&stuff->number, n);
+ if(stuff->number)
+ SwapLongs((CARD32*)(stuff + 1), stuff->number);
+ return ProcAntiSetInterpolationPixels(client);
+}
+
+static int
+SProcAntiInterpolateColors(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiInterpolateColorsReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->gc, n);
+ swapl(&stuff->colormap, n);
+ swapl(&stuff->number, n);
+ return ProcAntiInterpolateColors(client);
+}
+
+static int
+SProcAntiPolyText(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiPolyTextReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return ProcAntiPolyText(client);
+}
+
+static int
+SProcAntiImageText8(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiImageText8Req);
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return ProcAntiImageText8(client);
+}
+
+static int
+SProcAntiImageText16(ClientPtr client)
+{
+ register char n;
+ REQUEST(xAntiImageText16Req);
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return ProcAntiImageText16(client);
+}
+
diff --git a/xc/programs/Xserver/Xext/anti.h b/xc/programs/Xserver/Xext/anti.h
new file mode 100644
index 000000000..07b4d9fe0
--- /dev/null
+++ b/xc/programs/Xserver/Xext/anti.h
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/Xext/anti.h,v 1.2 1999/06/06 08:48:37 dawes Exp $ */
+
+#ifndef _ANTI_H
+#define _ANTI_H
+
+typedef struct {
+ CreateGCProcPtr CreateGC;
+ Bool (*PolyTextFunc)(PTclosurePtr);
+ Bool (*ImageTextFunc)(ITclosurePtr);
+} AntiScreenRec, *AntiScreenPtr;
+
+typedef struct {
+ int NumPixels;
+ unsigned long *Pixels;
+ GCFuncs *wrapFuncs;
+ Bool clientData;
+ unsigned long fg;
+ unsigned long bg;
+} AntiGCRec, *AntiGCPtr;
+
+extern int XAntiGCIndex;
+extern int XAntiScreenIndex;
+
+void XAntiExtensionInit(void);
+
+typedef int (*GetAntiGlyphsFuncPtr)(FontPtr, unsigned long, unsigned char*,
+ FontEncoding, unsigned long*, CharInfoPtr*, int);
+
+#define XANTI_GET_GC_PRIVATE(gc) \
+ (AntiGCPtr)((gc)->devPrivates[XAntiGCIndex].ptr)
+#define XANTI_GET_SCREEN_PRIVATE(draw) \
+ (AntiScreenPtr)((draw)->pScreen->devPrivates[XAntiScreenIndex].ptr)
+#if 1
+#define XANTI_GET_FONT_PRIVATE(font) 0 /* for now */
+#else
+#define XANTI_GET_FONT_PRIVATE(font) \
+ (antiAliasingPrivateIndex == -1) ? 0 : \
+ (GetAntiGlyphsFuncPtr)(font->devPrivates[antiAliasingPrivateIndex])
+#endif
+
+#endif /* _ANTI_H */
+
diff --git a/xc/programs/Xserver/Xext/appgroup.c b/xc/programs/Xserver/Xext/appgroup.c
new file mode 100644
index 000000000..0677682e2
--- /dev/null
+++ b/xc/programs/Xserver/Xext/appgroup.c
@@ -0,0 +1,799 @@
+/*
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+/* $TOG: appgroup.c /main/21 1998/02/09 15:23:40 kaleb $ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "colormapst.h"
+#include "servermd.h"
+#define _XAG_SERVER_
+#include "Xagstr.h"
+#define _SECURITY_SERVER
+#include "security.h"
+#include "Xfuncproto.h"
+
+#define XSERV_t
+#include <X11/Xtrans.h>
+#include "../os/osdep.h"
+
+#include <stdio.h>
+
+typedef struct _AppGroupRec {
+ struct _AppGroupRec* next;
+ XID appgroupId;
+ ClientPtr* clients;
+ int nclients;
+ ClientPtr leader;
+ Bool single_screen;
+ Window default_root;
+ VisualID root_visual;
+ Colormap default_colormap;
+ Pixel black_pixel;
+ Pixel white_pixel;
+ xConnSetupPrefix connSetupPrefix;
+ char* ConnectionInfo;
+} AppGroupRec, *AppGroupPtr;
+
+static int ProcXagDispatch (), SProcXagDispatch ();
+static void XagResetProc ();
+
+static unsigned char XagReqCode = 0;
+static int XagErrorBase;
+static int XagCallbackRefCount = 0;
+
+static RESTYPE RT_APPGROUP;
+static AppGroupPtr appGrpList = NULL;
+
+extern WindowPtr* WindowTable;
+extern xConnSetupPrefix connSetupPrefix;
+extern char* ConnectionInfo;
+
+static
+int XagAppGroupFree (what, id)
+ pointer what;
+ XID id; /* unused */
+{
+ int i;
+ AppGroupPtr pAppGrp = (AppGroupPtr) what;
+
+ if (pAppGrp->leader)
+ for (i = 0; i < pAppGrp->nclients; i++) {
+ pAppGrp->clients[i]->appgroup = NULL;
+ CloseDownClient (pAppGrp->clients[i]);
+ }
+
+ if (pAppGrp == appGrpList)
+ appGrpList = appGrpList->next;
+ else {
+ AppGroupPtr tpAppGrp;
+ for (tpAppGrp = appGrpList;
+ tpAppGrp->next != NULL;
+ tpAppGrp = tpAppGrp->next) {
+ if (tpAppGrp->next == pAppGrp) {
+ tpAppGrp->next = tpAppGrp->next->next;
+ break;
+ }
+ }
+ }
+ (void) xfree (pAppGrp->clients);
+ (void) xfree (pAppGrp->ConnectionInfo);
+ (void) xfree (what);
+ return Success;
+}
+
+/* static */
+void XagClientStateChange (pcbl, nulldata, calldata)
+ CallbackListPtr* pcbl;
+ pointer nulldata;
+ pointer calldata;
+{
+ SecurityAuthorizationPtr pAuth;
+ NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
+ ClientPtr pClient = pci->client;
+ AppGroupPtr pAppGrp;
+ XID authId;
+
+ if (!pClient->appgroup) {
+ switch (pClient->clientState) {
+
+ case ClientStateAuthenticating:
+ case ClientStateRunning:
+ case ClientStateCheckingSecurity:
+ return;
+
+ case ClientStateInitial:
+ case ClientStateCheckedSecurity:
+ /*
+ * If the client is connecting via a firewall proxy (which
+ * uses XC-QUERY-SECURITY-1, then the authId is available
+ * during ClientStateCheckedSecurity, otherwise it's
+ * available during ClientStateInitial.
+ *
+ * Don't get it from pClient because can't guarantee the order
+ * of the callbacks and the security extension might not have
+ * plugged it in yet.
+ */
+ authId = AuthorizationIDOfClient(pClient);
+ break;
+
+ case ClientStateGone:
+ case ClientStateRetained:
+ /*
+ * Don't get if from AuthorizationIDOfClient because can't
+ * guarantee the order of the callbacks and the security
+ * extension may have torn down the client's private data
+ */
+ authId = pClient->authId;
+ break;
+ }
+
+ if (authId == None)
+ return;
+
+ pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient,
+ authId, SecurityAuthorizationResType, SecurityReadAccess);
+
+ if (pAuth == NULL)
+ return;
+
+ for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
+ if (pAppGrp->appgroupId == pAuth->group) break;
+ } else {
+ pAppGrp = pClient->appgroup;
+ }
+
+ if (!pAppGrp)
+ return;
+
+ switch (pClient->clientState) {
+ case ClientStateAuthenticating:
+ case ClientStateRunning:
+ case ClientStateCheckingSecurity:
+ break;
+
+ case ClientStateInitial:
+ case ClientStateCheckedSecurity:
+ /* see the comment above about Initial vs. CheckedSecurity */
+ {
+ /* if this client already in AppGroup, don't add it again */
+ int i;
+ for (i = 0; i < pAppGrp->nclients; i++)
+ if (pClient == pAppGrp->clients[i]) return;
+ }
+ pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
+ ++pAppGrp->nclients * sizeof (ClientPtr));
+ pAppGrp->clients[pAppGrp->nclients - 1] = pClient;
+ pClient->appgroup = pAppGrp;
+ break;
+
+ case ClientStateGone:
+ case ClientStateRetained: /* client disconnected, dump it */
+ {
+ int i;
+ for (i = 0; i < pAppGrp->nclients; i++)
+ if (pAppGrp->clients[i] == pClient) {
+ pAppGrp->clients[i] = NULL;
+ break;
+ }
+ for (i = 0; i < pAppGrp->nclients; i++)
+ if (pAppGrp->clients[i] == NULL && i + 1 < pAppGrp->nclients)
+ pAppGrp->clients[i] = pAppGrp->clients[i + 1];
+ pAppGrp->nclients--;
+ }
+ pClient->appgroup = NULL; /* redundant, pClient will be freed */
+ break;
+ }
+}
+
+void
+XagExtensionInit ()
+{
+ ExtensionEntry* extEntry;
+
+ if (extEntry = AddExtension (XAGNAME,
+ 0,
+ XagNumberErrors,
+ ProcXagDispatch,
+ SProcXagDispatch,
+ XagResetProc,
+ StandardMinorOpcode)) {
+ XagReqCode = (unsigned char)extEntry->base;
+ XagErrorBase = extEntry->errorBase;
+ RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
+ }
+}
+
+/*ARGSUSED*/
+static
+void XagResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+ DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
+ XagCallbackRefCount = 0;
+ while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0);
+}
+
+static
+int ProcXagQueryVersion (client)
+ register ClientPtr client;
+{
+ REQUEST (xXagQueryVersionReq);
+ xXagQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xXagQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequence_number = client->sequence;
+ rep.server_major_version = XAG_MAJOR_VERSION;
+ rep.server_minor_version = XAG_MINOR_VERSION;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ swaps (&rep.server_major_version, n);
+ swaps (&rep.server_minor_version, n);
+ }
+ WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static
+void ProcessAttr (pAppGrp, client, attrib_mask, attribs)
+ AppGroupPtr pAppGrp;
+ ClientPtr client;
+ unsigned int attrib_mask;
+ CARD32* attribs;
+{
+ int i;
+
+ for (i = XagNsingleScreen; i <= XagNappGroupLeader; i++) {
+ switch (attrib_mask & (1 << i)) {
+ case XagSingleScreenMask:
+ pAppGrp->single_screen = *attribs;
+ break;
+ case XagDefaultRootMask:
+ pAppGrp->default_root = *attribs;
+ break;
+ case XagRootVisualMask:
+ pAppGrp->root_visual = *attribs;
+ break;
+ case XagDefaultColormapMask:
+ pAppGrp->default_colormap = *attribs;
+ break;
+ case XagBlackPixelMask:
+ pAppGrp->black_pixel = *attribs;
+ break;
+ case XagWhitePixelMask:
+ pAppGrp->white_pixel = *attribs;
+ break;
+ case XagAppGroupLeaderMask:
+ pAppGrp->leader = client;
+ break;
+ default: continue;
+ }
+ attribs++;
+ }
+}
+
+static
+void CreateConnectionInfo (pAppGrp)
+ AppGroupPtr pAppGrp;
+{
+ extern int connBlockScreenStart;
+ xConnSetup *setup = (xConnSetup*) ConnectionInfo;
+ xWindowRoot* rootp;
+ xWindowRoot* roots[MAXSCREENS];
+ unsigned int rootlens[MAXSCREENS];
+ xDepth* depth;
+ int olen;
+ int snum, i;
+
+ rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
+ for (snum = 0; snum < screenInfo.numScreens; snum++) {
+
+ rootlens[snum] = sizeof (xWindowRoot);
+ roots[snum] = rootp;
+
+ depth = (xDepth*) (rootp + 1);
+ for (i = 0; i < rootp->nDepths; i++) {
+ rootlens[snum] += sizeof (xDepth) +
+ depth->nVisuals * sizeof (xVisualType);
+ depth = (xDepth *)(((char*)(depth + 1)) +
+ depth->nVisuals * sizeof (xVisualType));
+ }
+ rootp = (xWindowRoot*) depth;
+ }
+ snum = 0;
+ if (pAppGrp->default_root) {
+ for (; snum < screenInfo.numVideoScreens; snum++) {
+ if (roots[snum]->windowId == pAppGrp->default_root)
+ break;
+ }
+ }
+ olen = connBlockScreenStart + rootlens[snum];
+ for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
+ olen += rootlens[i];
+ pAppGrp->ConnectionInfo = (char*) xalloc (olen);
+ if (!pAppGrp->ConnectionInfo)
+ return;
+ memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
+ ((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
+ 1 + screenInfo.numScreens - screenInfo.numVideoScreens;
+ memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
+ (void*) roots[snum], rootlens[snum]);
+ rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
+ if (pAppGrp->default_colormap) {
+ rootp->defaultColormap = pAppGrp->default_colormap;
+ rootp->whitePixel = pAppGrp->white_pixel;
+ rootp->blackPixel = pAppGrp->black_pixel;
+ }
+ if (pAppGrp->root_visual)
+ rootp->rootVisualID = pAppGrp->root_visual;
+ rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
+ for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
+ memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
+ rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
+ }
+ pAppGrp->connSetupPrefix = connSetupPrefix;
+ pAppGrp->connSetupPrefix.length = olen >> 2;
+}
+
+static
+AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
+ ClientPtr client;
+ XID appgroupId;
+ unsigned int attrib_mask;
+ CARD32* attribs;
+{
+ AppGroupPtr pAppGrp;
+ int i;
+
+ pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
+ if (pAppGrp) {
+ pAppGrp->next = appGrpList;
+ appGrpList = pAppGrp;
+ pAppGrp->appgroupId = appgroupId;
+ pAppGrp->clients = (ClientPtr*) xalloc (0);
+ pAppGrp->nclients = 0;
+ pAppGrp->leader = NULL;
+ pAppGrp->default_root = 0;
+ pAppGrp->root_visual = 0;
+ pAppGrp->default_colormap = 0;
+ pAppGrp->black_pixel = -1;
+ pAppGrp->white_pixel = -1;
+ pAppGrp->ConnectionInfo = NULL;
+ ProcessAttr (pAppGrp, client, attrib_mask, attribs);
+ }
+ return pAppGrp;
+}
+
+static
+int AttrValidate (client, attrib_mask, pAppGrp)
+ ClientPtr client;
+ int attrib_mask;
+ AppGroupPtr pAppGrp;
+{
+ WindowPtr pWin;
+ int idepth, ivids, found;
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ ColormapPtr pColormap;
+
+ pWin = LookupWindow (pAppGrp->default_root, client);
+ /* XXX check that pWin is not NULL */
+ pScreen = pWin->drawable.pScreen;
+ if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
+ return BadWindow;
+ pDepth = pScreen->allowedDepths;
+ if (pAppGrp->root_visual) {
+ found = FALSE;
+ for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
+ for (ivids = 0; ivids < pDepth->numVids; ivids++) {
+ if (pAppGrp->root_visual == pDepth->vids[ivids]) {
+ found = TRUE;
+ break;
+ }
+ }
+ }
+ if (!found)
+ return BadMatch;
+ }
+ if (pAppGrp->default_colormap) {
+
+ pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);
+ /* XXX check that pColormap is not NULL */
+ if (pColormap->pScreen != pScreen)
+ return BadColor;
+ if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
+ return BadMatch;
+ }
+ return client->noClientException;
+}
+
+/* static */
+int ProcXagCreate (client)
+ register ClientPtr client;
+{
+ REQUEST (xXagCreateReq);
+ AppGroupPtr pAppGrp;
+ int ret;
+
+ REQUEST_AT_LEAST_SIZE (xXagCreateReq);
+
+ LEGAL_NEW_RESOURCE (stuff->app_group, client);
+ pAppGrp = CreateAppGroup (client, stuff->app_group,
+ stuff->attrib_mask, (CARD32*) &stuff[1]);
+ if (!pAppGrp)
+ return BadAlloc;
+ ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
+ if (ret != Success) {
+ XagAppGroupFree ((pointer)pAppGrp, (XID)0);
+ return ret;
+ }
+ if (pAppGrp->single_screen) {
+ CreateConnectionInfo (pAppGrp);
+ if (!pAppGrp->ConnectionInfo)
+ return BadAlloc;
+ }
+ if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
+ return BadAlloc;
+ if (XagCallbackRefCount++ == 0)
+ (void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
+ return client->noClientException;
+}
+
+/* static */
+int ProcXagDestroy (client)
+ register ClientPtr client;
+{
+ AppGroupPtr pAppGrp;
+ REQUEST (xXagDestroyReq);
+
+ REQUEST_SIZE_MATCH (xXagDestroyReq);
+ pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
+ (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
+ if (!pAppGrp) return XagBadAppGroup;
+ FreeResource ((XID)stuff->app_group, RT_NONE);
+ if (--XagCallbackRefCount == 0)
+ (void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
+ return client->noClientException;
+}
+
+static
+int ProcXagGetAttr (client)
+ register ClientPtr client;
+{
+ AppGroupPtr pAppGrp;
+ REQUEST (xXagGetAttrReq);
+ xXagGetAttrReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH (xXagGetAttrReq);
+ pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
+ (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
+ if (!pAppGrp) return XagBadAppGroup;
+ rep.default_root = pAppGrp->default_root;
+ rep.root_visual = pAppGrp->root_visual;
+ rep.default_colormap = pAppGrp->default_colormap;
+ rep.single_screen = pAppGrp->single_screen;
+ rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ swapl (&rep.default_root, n);
+ swapl (&rep.root_visual, n);
+ swapl (&rep.default_colormap, n);
+ }
+ WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static
+int ProcXagQuery (client)
+ register ClientPtr client;
+{
+ ClientPtr pClient;
+ AppGroupPtr pAppGrp;
+ REQUEST (xXagQueryReq);
+ int n;
+
+ REQUEST_SIZE_MATCH (xXagQueryReq);
+ pClient = LookupClient (stuff->resource, client);
+ for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
+ for (n = 0; n < pAppGrp->nclients; n++)
+ if (pAppGrp->clients[n] == pClient) {
+ xXagQueryReply rep;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequence_number = client->sequence;
+ rep.app_group = pAppGrp->appgroupId;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ swapl (&rep.app_group, n);
+ }
+ WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
+ return client->noClientException;
+ }
+
+ return BadMatch;
+}
+
+static
+int ProcXagCreateAssoc (client)
+ register ClientPtr client;
+{
+ REQUEST (xXagCreateAssocReq);
+
+ REQUEST_SIZE_MATCH (xXagCreateAssocReq);
+#ifdef WIN32
+ if (stuff->window_type != XagWindowTypeWin32)
+#else
+ if (stuff->window_type != XagWindowTypeX11)
+#endif
+ return BadMatch;
+#ifdef WIN32 /* and Mac, etc */
+ if (!LocalClient (client))
+ return BadAccess;
+#endif
+
+/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
+
+ return client->noClientException;
+}
+
+static
+int ProcXagDestroyAssoc (client)
+ register ClientPtr client;
+{
+ REQUEST (xXagDestroyAssocReq);
+
+ REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
+/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
+ return client->noClientException;
+}
+
+static
+int ProcXagDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST (xReq);
+ switch (stuff->data)
+ {
+ case X_XagQueryVersion:
+ return ProcXagQueryVersion (client);
+ case X_XagCreate:
+ return ProcXagCreate (client);
+ case X_XagDestroy:
+ return ProcXagDestroy (client);
+ case X_XagGetAttr:
+ return ProcXagGetAttr (client);
+ case X_XagQuery:
+ return ProcXagQuery (client);
+ case X_XagCreateAssoc:
+ return ProcXagCreateAssoc (client);
+ case X_XagDestroyAssoc:
+ return ProcXagDestroyAssoc (client);
+ default:
+ return BadRequest;
+ }
+}
+
+static
+int SProcXagQueryVersion (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXagQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXagQueryVersion(client);
+}
+
+static
+int SProcXagCreate (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagCreateReq);
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE (xXagCreateReq);
+ swapl (&stuff->app_group, n);
+ swapl (&stuff->attrib_mask, n);
+ SwapRestL (stuff);
+ return ProcXagCreate (client);
+}
+
+static
+int SProcXagDestroy (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagDestroyReq);
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xXagDestroyReq);
+ swapl (&stuff->app_group, n);
+ return ProcXagDestroy (client);
+}
+
+static
+int SProcXagGetAttr (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagGetAttrReq);
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xXagGetAttrReq);
+ swapl (&stuff->app_group, n);
+ return ProcXagGetAttr (client);
+}
+
+static
+int SProcXagQuery (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagQueryReq);
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xXagQueryReq);
+ swapl (&stuff->resource, n);
+ return ProcXagQuery (client);
+}
+
+static
+int SProcXagCreateAssoc (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagCreateAssocReq);
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xXagCreateAssocReq);
+ swapl (&stuff->window, n);
+ swapl (&stuff->window_type, n);
+ swaps (&stuff->system_window_len, n);
+ return ProcXagCreateAssoc (client);
+}
+
+static
+int SProcXagDestroyAssoc (client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST (xXagDestroyAssocReq);
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
+ swapl (&stuff->window, n);
+ return ProcXagDestroyAssoc (client);
+}
+
+static
+int SProcXagDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XagQueryVersion:
+ return SProcXagQueryVersion (client);
+ case X_XagCreate:
+ return SProcXagCreate (client);
+ case X_XagDestroy:
+ return SProcXagDestroy (client);
+ case X_XagGetAttr:
+ return SProcXagGetAttr (client);
+ case X_XagQuery:
+ return SProcXagQuery (client);
+ case X_XagCreateAssoc:
+ return SProcXagCreateAssoc (client);
+ case X_XagDestroyAssoc:
+ return SProcXagDestroyAssoc (client);
+ default:
+ return BadRequest;
+ }
+}
+
+Colormap XagDefaultColormap (client)
+ ClientPtr client;
+{
+ return (client->appgroup ? client->appgroup->default_colormap : None);
+}
+
+VisualID XagRootVisual (client)
+ ClientPtr client;
+{
+ return (client->appgroup ? client->appgroup->root_visual : 0);
+}
+
+ClientPtr XagLeader (client)
+ ClientPtr client;
+{
+ return (client->appgroup ? client->appgroup->leader : NULL);
+}
+
+/*
+ * Return whether the Map request event should be sent to the appgroup leader.
+ * We don't want to send it to the leader when the window is on a different
+ * screen, e.g. a print screen.
+ */
+Bool XagIsControlledRoot (client, pParent)
+ ClientPtr client;
+ WindowPtr pParent;
+{
+ if (client->appgroup) {
+ if (client->appgroup->single_screen &&
+ pParent->drawable.id == client->appgroup->default_root)
+ return TRUE;
+ else if (!pParent->parent)
+ return TRUE;
+ else
+ return FALSE;
+ }
+ return FALSE;
+}
+
+void XagConnectionInfo (client, conn_prefix, conn_info, num_screen)
+ ClientPtr client;
+ xConnSetupPrefix** conn_prefix;
+ char** conn_info;
+ int* num_screen;
+{
+ if (client->appgroup && client->appgroup->ConnectionInfo) {
+ *conn_prefix = &client->appgroup->connSetupPrefix;
+ *conn_info = client->appgroup->ConnectionInfo;
+ *num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
+ }
+}
+
+XID XagId (client)
+ ClientPtr client;
+{
+ return (client->appgroup ? client->appgroup->appgroupId : 0);
+}
+
+void XagGetDeltaInfo (client, buf)
+ ClientPtr client;
+ CARD32* buf;
+{
+ *buf++ = (CARD32) client->appgroup->default_root;
+ *buf++ = (CARD32) client->appgroup->root_visual;
+ *buf++ = (CARD32) client->appgroup->default_colormap;
+ *buf++ = (CARD32) client->appgroup->black_pixel;
+ *buf = (CARD32) client->appgroup->white_pixel;
+}
+
+void XagCallClientStateChange (client)
+ ClientPtr client;
+{
+ if (appGrpList) {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
+ }
+}
diff --git a/xc/programs/Xserver/Xext/bigreq.c b/xc/programs/Xserver/Xext/bigreq.c
new file mode 100644
index 000000000..9753a3f6f
--- /dev/null
+++ b/xc/programs/Xserver/Xext/bigreq.c
@@ -0,0 +1,90 @@
+/* $TOG: bigreq.c /main/6 1998/02/09 15:23:47 kaleb $ */
+/*
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.3 1998/10/04 09:36:44 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "bigreqstr.h"
+
+static unsigned char XBigReqCode;
+
+static void BigReqResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcBigReqDispatch);
+
+void
+BigReqExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
+ ProcBigReqDispatch, ProcBigReqDispatch,
+ BigReqResetProc, StandardMinorOpcode)) != 0)
+ XBigReqCode = (unsigned char)extEntry->base;
+ DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
+}
+
+/*ARGSUSED*/
+static void
+BigReqResetProc (extEntry)
+ ExtensionEntry *extEntry;
+{
+}
+
+static int
+ProcBigReqDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xBigReqEnableReq);
+ xBigReqEnableReply rep;
+ register int n;
+
+ if (client->swapped) {
+ swaps(&stuff->length, n);
+ }
+ if (stuff->brReqType != X_BigReqEnable)
+ return BadRequest;
+ REQUEST_SIZE_MATCH(xBigReqEnableReq);
+ client->big_requests = TRUE;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.max_request_size = MAX_BIG_REQUEST_SIZE;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.max_request_size, n);
+ }
+ WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
+ return(client->noClientException);
+}
diff --git a/xc/programs/Xserver/Xext/cup.c b/xc/programs/Xserver/Xext/cup.c
new file mode 100644
index 000000000..2211ad259
--- /dev/null
+++ b/xc/programs/Xserver/Xext/cup.c
@@ -0,0 +1,341 @@
+/* $TOG: cup.c /main/3 1998/02/09 15:23:52 kaleb $ */
+/*
+
+Copyright 1997, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/cup.c,v 1.5 1998/12/06 13:30:39 dawes Exp $ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XCUP_SERVER_
+#include "Xcupstr.h"
+#include "Xfuncproto.h"
+
+#ifndef EXTMODULE
+#include "../os/osdep.h"
+#else
+#include "xf86_ansic.h"
+#endif
+
+static int ProcDispatch (), SProcDispatch ();
+static void ResetProc ();
+
+static unsigned char ReqCode = 0;
+static int ErrorBase;
+
+#if defined(WIN32) || defined(TESTWIN32)
+#define HAVE_SPECIAL_DESKTOP_COLORS
+#endif
+
+static xColorItem citems[] = {
+#ifndef HAVE_SPECIAL_DESKTOP_COLORS
+#define CUP_BLACK_PIXEL 0
+#define CUP_WHITE_PIXEL 1
+ /* pix red green blue */
+ { 0, 0, 0, 0, 0, 0 },
+ { 1, 0xffff, 0xffff, 0xffff, 0, 0 }
+#else
+#ifndef WIN32
+ /*
+ This approximates the MS-Windows desktop colormap for testing
+ purposes but has black and white pixels in the typical Unix
+ locations, which should be switched if necessary if your system
+ has blackPixel and whitePixel swapped. No entries are provided
+ for colormap entries 254 and 255 because AllocColor/FindColor
+ will reuse entries zero and one.
+ */
+ { 0, 0, 0, 0, 0, 0 },
+ { 1, 0xffff, 0xffff, 0xffff, 0, 0 },
+ { 2, 0x8000, 0, 0, 0, 0 },
+ { 3, 0, 0x8000, 0, 0, 0 },
+ { 4, 0x8000, 0x8000, 0, 0, 0 },
+ { 5, 0, 0, 0x8000, 0, 0 },
+ { 6, 0x8000, 0, 0x8000, 0, 0 },
+ { 7, 0, 0x8000, 0x8000, 0, 0 },
+ { 8, 0xc000, 0xc000, 0xc000, 0, 0 },
+ { 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
+ { 246, 0xa000, 0xa000, 0xa000, 0, 0 },
+ { 247, 0x8000, 0x8000, 0x8000, 0, 0 },
+ { 248, 0xffff, 0, 0, 0, 0 },
+ { 249, 0, 0xffff, 0, 0, 0 },
+ { 250, 0xffff, 0xffff, 0, 0, 0 },
+ { 251, 0, 0, 0xffff, 0, 0 },
+ { 252, 0xffff, 0, 0xffff, 0, 0 },
+ { 253, 0, 0xffff, 0xffff, 0, 0 }
+#else
+ /*
+ this is the MS-Windows desktop, adjusted for X's 16-bit color
+ specifications.
+ */
+ { 0, 0, 0, 0, 0, 0 },
+ { 1, 0x8000, 0, 0, 0, 0 },
+ { 2, 0, 0x8000, 0, 0, 0 },
+ { 3, 0x8000, 0x8000, 0, 0, 0 },
+ { 4, 0, 0, 0x8000, 0, 0 },
+ { 5, 0x8000, 0, 0x8000, 0, 0 },
+ { 6, 0, 0x8000, 0x8000, 0, 0 },
+ { 7, 0xc000, 0xc000, 0xc000, 0, 0 },
+ { 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
+ { 9, 0xa600, 0xca00, 0xf000, 0, 0 },
+ { 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
+ { 247, 0xa000, 0xa000, 0xa400, 0, 0 },
+ { 248, 0x8000, 0x8000, 0x8000, 0, 0 },
+ { 249, 0xff00, 0, 0, 0, 0 },
+ { 250, 0, 0xff00, 0, 0, 0 },
+ { 251, 0xff00, 0xff00, 0, 0, 0 },
+ { 252, 0, 0, 0xff00, 0, 0 },
+ { 253, 0xff00, 0, 0xff00, 0, 0 },
+ { 254, 0, 0xff00, 0xff00, 0, 0 },
+ { 255, 0xff00, 0xff00, 0xff00, 0, 0 }
+#endif
+#endif
+};
+#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
+
+void
+XcupExtensionInit ()
+{
+ ExtensionEntry* extEntry;
+
+ if (extEntry = AddExtension (XCUPNAME,
+ 0,
+ XcupNumberErrors,
+ ProcDispatch,
+ SProcDispatch,
+ ResetProc,
+ StandardMinorOpcode)) {
+ ReqCode = (unsigned char)extEntry->base;
+ ErrorBase = extEntry->errorBase;
+ }
+
+ /* PC servers initialize the desktop colors (citems) here! */
+}
+
+/*ARGSUSED*/
+static
+void ResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+}
+
+static
+int ProcQueryVersion (client)
+ register ClientPtr client;
+{
+ REQUEST (xXcupQueryVersionReq);
+ xXcupQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequence_number = client->sequence;
+ rep.server_major_version = XCUP_MAJOR_VERSION;
+ rep.server_minor_version = XCUP_MINOR_VERSION;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ swaps (&rep.server_major_version, n);
+ swaps (&rep.server_minor_version, n);
+ }
+ WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static
+int ProcGetReservedColormapEntries (client)
+ register ClientPtr client;
+{
+ REQUEST (xXcupGetReservedColormapEntriesReq);
+ xXcupGetReservedColormapEntriesReply rep;
+ xColorItem* cptr;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
+
+#ifndef HAVE_SPECIAL_DESKTOP_COLORS
+ citems[CUP_BLACK_PIXEL].pixel =
+ screenInfo.screens[stuff->screen]->blackPixel;
+ citems[CUP_WHITE_PIXEL].pixel =
+ screenInfo.screens[stuff->screen]->whitePixel;
+#endif
+
+ rep.type = X_Reply;
+ rep.sequence_number = client->sequence;
+ rep.length = NUM_DESKTOP_COLORS * 3;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ }
+ WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
+ for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
+ if (client->swapped) SwapColorItem (cptr);
+ WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
+ }
+ return client->noClientException;
+}
+
+static
+int ProcStoreColors (client)
+ register ClientPtr client;
+{
+ REQUEST (xXcupStoreColorsReq);
+ ColormapPtr pcmp;
+
+ REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
+ pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+
+ if (pcmp) {
+ int ncolors, n;
+ xXcupStoreColorsReply rep;
+ xColorItem* cptr;
+ Pixel pixel;
+
+ if (!(pcmp->class & DynamicClass))
+ return BadMatch;
+
+ ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
+ if (ncolors % SIZEOF(xColorItem))
+ return BadLength;
+
+ ncolors /= SIZEOF (xColorItem);
+
+
+ for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
+ Pixel pixel = cptr->pixel;
+
+ if (AllocColor (pcmp,
+ &cptr->red, &cptr->green, &cptr->blue,
+ &pixel, client->index) == Success) {
+ cptr->pixel = pixel;
+ cptr->flags = 0x08;
+ } else
+ cptr->flags = 0;
+ cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
+ }
+
+ rep.type = X_Reply;
+ rep.sequence_number = client->sequence;
+ rep.length = ncolors * 3;
+ if (client->swapped) {
+ swaps (&rep.sequence_number, n);
+ swapl (&rep.length, n);
+ }
+ WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
+ for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
+ if (client->swapped) SwapColorItem (cptr);
+ WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
+ cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
+ }
+ return client->noClientException;
+ } else {
+ client->errorValue = stuff->cmap;
+ return BadColor;
+ }
+}
+
+static
+int ProcDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST (xReq);
+ switch (stuff->data)
+ {
+ case X_XcupQueryVersion:
+ return ProcQueryVersion (client);
+ case X_XcupGetReservedColormapEntries:
+ return ProcGetReservedColormapEntries (client);
+ case X_XcupStoreColors:
+ return ProcStoreColors (client);
+ default:
+ return BadRequest;
+ }
+}
+
+static
+int SProcQueryVersion (client)
+ register ClientPtr client;
+{
+ register int n;
+
+ REQUEST(xXcupQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcQueryVersion(client);
+}
+
+static
+int SProcGetReservedColormapEntries (client)
+ ClientPtr client;
+{
+ register int n;
+
+ REQUEST (xXcupGetReservedColormapEntriesReq);
+ swaps (&stuff->length, n);
+ swapl (&stuff->screen, n);
+ REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
+ return ProcGetReservedColormapEntries (client);
+}
+
+static
+int SProcStoreColors (client)
+ ClientPtr client;
+{
+ register int n;
+ int count;
+ xColorItem* pItem;
+
+ REQUEST (xXcupStoreColorsReq);
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
+ swapl(&stuff->cmap, n);
+ pItem = (xColorItem*) &stuff[1];
+ for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
+ SwapColorItem(pItem++);
+ return ProcStoreColors (client);
+}
+
+static
+int SProcDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XcupQueryVersion:
+ return SProcQueryVersion (client);
+ case X_XcupGetReservedColormapEntries:
+ return SProcGetReservedColormapEntries (client);
+ case X_XcupStoreColors:
+ return SProcStoreColors (client);
+ default:
+ return BadRequest;
+ }
+}
+
+
diff --git a/xc/programs/Xserver/Xext/dgaproc.h b/xc/programs/Xserver/Xext/dgaproc.h
new file mode 100644
index 000000000..453aedc27
--- /dev/null
+++ b/xc/programs/Xserver/Xext/dgaproc.h
@@ -0,0 +1,135 @@
+/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.18 1999/08/22 05:57:24 dawes Exp $ */
+
+#ifndef __DGAPROC_H
+#define __DGAPROC_H
+
+
+#define DGA_CONCURRENT_ACCESS 0x00000001
+#define DGA_FILL_RECT 0x00000002
+#define DGA_BLIT_RECT 0x00000004
+#define DGA_BLIT_RECT_TRANS 0x00000008
+#define DGA_PIXMAP_AVAILABLE 0x00000010
+
+#define DGA_INTERLACED 0x00010000
+#define DGA_DOUBLESCAN 0x00020000
+
+#define DGA_FLIP_IMMEDIATE 0x00000001
+#define DGA_FLIP_RETRACE 0x00000002
+
+#define DGA_COMPLETED 0x00000000
+#define DGA_PENDING 0x00000001
+
+#define DGA_NEED_ROOT 0x00000001
+
+typedef struct {
+ int num; /* A unique identifier for the mode (num > 0) */
+ char *name; /* name of mode given in the XF86Config */
+ int VSync_num;
+ int VSync_den;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset;
+ int reserved1;
+ int reserved2;
+} XDGAModeRec, *XDGAModePtr;
+
+
+void XFree86DGAExtensionInit(void);
+
+/* DDX interface */
+
+int
+DGASetMode(
+ int index,
+ int num,
+ XDGAModePtr mode,
+ PixmapPtr *pPix
+);
+
+void
+DGASelectInput(
+ int index,
+ ClientPtr client,
+ long mask
+);
+
+Bool DGAAvailable(int index);
+Bool DGAActive(int index);
+void DGAShutdown(void);
+void DGAInstallCmap(ColormapPtr cmap);
+int DGAGetViewportStatus(int index);
+int DGASync(int index);
+
+int
+DGAFillRect(
+ int index,
+ int x, int y, int w, int h,
+ unsigned long color
+);
+
+int
+DGABlitRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+);
+
+int
+DGABlitTransRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+);
+
+int
+DGASetViewport(
+ int index,
+ int x, int y,
+ int mode
+);
+
+int DGAGetModes(int index);
+int DGAGetOldDGAMode(int index);
+
+int DGAGetModeInfo(int index, XDGAModePtr mode, int num);
+
+Bool DGAVTSwitch(void);
+Bool DGAStealMouseEvent(int index, xEvent *e, int dx, int dy);
+Bool DGAStealKeyEvent(int index, xEvent *e);
+
+Bool DGAOpenFramebuffer(int index, char **name, unsigned char **mem,
+ int *size, int *offset, int *flags);
+void DGACloseFramebuffer(int index);
+Bool DGAChangePixmapMode(int index, int *x, int *y, int mode);
+int DGACreateColormap(int index, ClientPtr client, int id, int mode,
+ int alloc);
+
+extern unsigned char DGAReqCode;
+extern int DGAErrorBase;
+extern int DGAEventBase;
+extern int *XDGAEventBase;
+
+
+
+#endif /* __DGAPROC_H */
diff --git a/xc/programs/Xserver/Xext/dpms.c b/xc/programs/Xserver/Xext/dpms.c
new file mode 100644
index 000000000..3f9d2b370
--- /dev/null
+++ b/xc/programs/Xserver/Xext/dpms.c
@@ -0,0 +1,432 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+/*
+ * HISTORY
+ *
+ * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
+ */
+
+/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.6 1999/03/07 11:40:25 dawes Exp $ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "opaque.h"
+#define DPMS_SERVER
+#include "dpms.h"
+#include "dpmsstr.h"
+#include "dpmsproc.h"
+
+static unsigned char DPMSCode;
+static DISPATCH_PROC(ProcDPMSDispatch);
+static DISPATCH_PROC(SProcDPMSDispatch);
+static DISPATCH_PROC(ProcDPMSGetVersion);
+static DISPATCH_PROC(SProcDPMSGetVersion);
+static DISPATCH_PROC(ProcDPMSGetTimeouts);
+static DISPATCH_PROC(SProcDPMSGetTimeouts);
+static DISPATCH_PROC(ProcDPMSSetTimeouts);
+static DISPATCH_PROC(SProcDPMSSetTimeouts);
+static DISPATCH_PROC(ProcDPMSEnable);
+static DISPATCH_PROC(SProcDPMSEnable);
+static DISPATCH_PROC(ProcDPMSDisable);
+static DISPATCH_PROC(SProcDPMSDisable);
+static DISPATCH_PROC(ProcDPMSForceLevel);
+static DISPATCH_PROC(SProcDPMSForceLevel);
+static DISPATCH_PROC(ProcDPMSInfo);
+static DISPATCH_PROC(SProcDPMSInfo);
+static DISPATCH_PROC(ProcDPMSCapable);
+static DISPATCH_PROC(SProcDPMSCapable);
+static void DPMSResetProc(ExtensionEntry* extEntry);
+
+void
+DPMSExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
+ ProcDPMSDispatch, SProcDPMSDispatch,
+ DPMSResetProc, StandardMinorOpcode)))
+ DPMSCode = (unsigned char)extEntry->base;
+ return;
+}
+
+/*ARGSUSED*/
+static void
+DPMSResetProc (extEntry)
+ ExtensionEntry *extEntry;
+{
+}
+
+static int
+ProcDPMSGetVersion(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSGetVersionReq);
+ xDPMSGetVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = DPMSMajorVersion;
+ rep.minorVersion = DPMSMinorVersion;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSCapable(register ClientPtr client)
+{
+ REQUEST(xDPMSCapableReq);
+ xDPMSCapableReply rep;
+
+ REQUEST_SIZE_MATCH(xDPMSCapableReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.capable = DPMSCapableFlag;
+
+ WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSGetTimeouts(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSGetTimeoutsReq);
+ xDPMSGetTimeoutsReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
+ rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
+ rep.off = DPMSOffTime / MILLI_PER_SECOND;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.standby, n);
+ swaps(&rep.suspend, n);
+ swaps(&rep.off, n);
+ }
+ WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSSetTimeouts(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSSetTimeoutsReq);
+
+ REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
+
+ if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
+ {
+ client->errorValue = stuff->off;
+ return BadValue;
+ }
+ if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
+ {
+ client->errorValue = stuff->suspend;
+ return BadValue;
+ }
+
+ DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
+ DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
+ DPMSOffTime = stuff->off * MILLI_PER_SECOND;
+
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSEnable(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSEnableReq);
+
+ REQUEST_SIZE_MATCH(xDPMSEnableReq);
+
+ if (DPMSCapableFlag)
+ DPMSEnabled = TRUE;
+
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSDisable(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSDisableReq);
+
+ REQUEST_SIZE_MATCH(xDPMSDisableReq);
+
+ DPMSSet(DPMSModeOn);
+
+ DPMSEnabled = FALSE;
+
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSForceLevel(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSForceLevelReq);
+
+ REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
+
+ if (!DPMSEnabled)
+ return BadMatch;
+
+ if (stuff->level == DPMSModeOn) {
+ lastDeviceEventTime.milliseconds =
+ GetTimeInMillis();
+ } else if (stuff->level == DPMSModeStandby) {
+ lastDeviceEventTime.milliseconds =
+ GetTimeInMillis() - DPMSStandbyTime;
+ } else if (stuff->level == DPMSModeSuspend) {
+ lastDeviceEventTime.milliseconds =
+ GetTimeInMillis() - DPMSSuspendTime;
+ } else if (stuff->level == DPMSModeOff) {
+ lastDeviceEventTime.milliseconds =
+ GetTimeInMillis() - DPMSOffTime;
+ } else {
+ client->errorValue = stuff->level;
+ return BadValue;
+ }
+
+ DPMSSet(stuff->level);
+
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSInfo(register ClientPtr client)
+{
+ REQUEST(xDPMSInfoReq);
+ xDPMSInfoReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xDPMSInfoReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.power_level = DPMSPowerLevel;
+ rep.state = DPMSEnabled;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.power_level, n);
+ }
+ WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcDPMSDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_DPMSGetVersion:
+ return ProcDPMSGetVersion(client);
+ case X_DPMSCapable:
+ return ProcDPMSCapable(client);
+ case X_DPMSGetTimeouts:
+ return ProcDPMSGetTimeouts(client);
+ case X_DPMSSetTimeouts:
+ return ProcDPMSSetTimeouts(client);
+ case X_DPMSEnable:
+ return ProcDPMSEnable(client);
+ case X_DPMSDisable:
+ return ProcDPMSDisable(client);
+ case X_DPMSForceLevel:
+ return ProcDPMSForceLevel(client);
+ case X_DPMSInfo:
+ return ProcDPMSInfo(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcDPMSGetVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xDPMSGetVersionReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
+ swaps(&stuff->majorVersion, n);
+ swaps(&stuff->minorVersion, n);
+ return ProcDPMSGetVersion(client);
+}
+
+static int
+SProcDPMSCapable(register ClientPtr client)
+{
+ REQUEST(xDPMSCapableReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSCapableReq);
+
+ return ProcDPMSCapable(client);
+}
+
+static int
+SProcDPMSGetTimeouts(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSGetTimeoutsReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
+
+ return ProcDPMSGetTimeouts(client);
+}
+
+static int
+SProcDPMSSetTimeouts(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSSetTimeoutsReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
+
+ swaps(&stuff->standby, n);
+ swaps(&stuff->suspend, n);
+ swaps(&stuff->off, n);
+ return ProcDPMSSetTimeouts(client);
+}
+
+static int
+SProcDPMSEnable(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSEnableReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSEnableReq);
+
+ return ProcDPMSEnable(client);
+}
+
+static int
+SProcDPMSDisable(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSDisableReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSDisableReq);
+
+ return ProcDPMSDisable(client);
+}
+
+static int
+SProcDPMSForceLevel(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSForceLevelReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
+
+ swaps(&stuff->level, n);
+
+ return ProcDPMSForceLevel(client);
+}
+
+static int
+SProcDPMSInfo(client)
+ register ClientPtr client;
+{
+ REQUEST(xDPMSInfoReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDPMSInfoReq);
+
+ return ProcDPMSInfo(client);
+}
+
+static int
+SProcDPMSDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_DPMSGetVersion:
+ return SProcDPMSGetVersion(client);
+ case X_DPMSCapable:
+ return SProcDPMSCapable(client);
+ case X_DPMSGetTimeouts:
+ return SProcDPMSGetTimeouts(client);
+ case X_DPMSSetTimeouts:
+ return SProcDPMSSetTimeouts(client);
+ case X_DPMSEnable:
+ return SProcDPMSEnable(client);
+ case X_DPMSDisable:
+ return SProcDPMSDisable(client);
+ case X_DPMSForceLevel:
+ return SProcDPMSForceLevel(client);
+ case X_DPMSInfo:
+ return SProcDPMSInfo(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/dpmsproc.h b/xc/programs/Xserver/Xext/dpmsproc.h
new file mode 100644
index 000000000..f35aa15b4
--- /dev/null
+++ b/xc/programs/Xserver/Xext/dpmsproc.h
@@ -0,0 +1,11 @@
+/* $XFree86: xc/programs/Xserver/Xext/dpmsproc.h,v 1.2 1998/07/25 08:48:37 dawes Exp $ */
+
+/* Prototypes for functions that the DDX must provide */
+
+#ifndef _DPMSPROC_H_
+#define _DPMSPROC_H_
+
+void DPMSSet(CARD16 level);
+Bool DPMSSupported(void);
+
+#endif
diff --git a/xc/programs/Xserver/Xext/dpmsstubs.c b/xc/programs/Xserver/Xext/dpmsstubs.c
new file mode 100644
index 000000000..83c5ff12c
--- /dev/null
+++ b/xc/programs/Xserver/Xext/dpmsstubs.c
@@ -0,0 +1,48 @@
+/* $TOG: dpmsstubs.c /main/3 1997/11/14 11:08:23 kaleb $ */
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+typedef int Bool;
+
+#define FALSE 0
+
+Bool DPMSSupported()
+{
+ return FALSE;
+}
+
+int DPSMGet(level)
+ int *level;
+{
+ return -1;
+}
+
+void DPMSSet(level)
+{
+
+}
diff --git a/xc/programs/Xserver/Xext/extmod/Imakefile b/xc/programs/Xserver/Xext/extmod/Imakefile
new file mode 100644
index 000000000..e66d4123d
--- /dev/null
+++ b/xc/programs/Xserver/Xext/extmod/Imakefile
@@ -0,0 +1,108 @@
+XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.15 1999/08/14 10:49:25 dawes Exp $
+XCOMM This directory is only entered if DoLoadableServer is set
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#if BuildMultibuffer
+ MULTIBUFSRC = mbuf.c
+ MULTIBUFOBJ = mbuf.o
+LinkSourceFile(mbuf.c,..)
+#endif
+
+#if BuildScreenSaverExt
+ SCRNSAVSRC = saver.c
+ SCRNSAVOBJ = saver.o
+LinkSourceFile(saver.c,..)
+#endif
+
+#if BuildXF86VidModeExt
+ VIDMODESRCS = xf86vmode.c
+ VIDMODEOBJS = xf86vmode.o
+LinkSourceFile(xf86vmode.c,..)
+#endif
+
+#if BuildXF86MiscExt
+ XF86MISCSRCS = xf86misc.c
+ XF86MISCOBJS = xf86misc.o
+LinkSourceFile(xf86misc.c,..)
+#endif
+
+#if BuildXF86DGA
+ XF86DGASRCS = xf86dga.c xf86dga2.c
+ XF86DGAOBJS = xf86dga.o xf86dga2.o
+LinkSourceFile(xf86dga.c,..)
+LinkSourceFile(xf86dga2.c,..)
+#endif
+
+#if BuildDPMS
+ DPMSSRCS = dpms.c
+ DPMSOBJS = dpms.o
+LinkSourceFile(dpms.c,..)
+#endif
+
+#if BuildXvExt
+ XVSRCS = xvmain.c xvdisp.c xvmod.c
+ XVOBJS = xvmain.o xvdisp.o xvmod.o
+LinkSourceFile(xvmain.c,..)
+LinkSourceFile(xvdisp.c,..)
+LinkSourceFile(xvmod.c,..)
+#endif
+
+#if BuildXantiExt
+ XANTISRCS = anti.c
+ XANTIOBJS = anti.o
+LinkSourceFile(anti.c,..)
+#endif
+
+#if BuildEVI
+ EVISRCS = EVI.c sampleEVI.c
+ EVIOBJS = EVI.o sampleEVI.o
+LinkSourceFile(EVI.c,..)
+LinkSourceFile(sampleEVI.c,..)
+#endif
+
+#if BuildCup
+ CUPSRCS = cup.c
+ CUPOBJS = cup.o
+LinkSourceFile(cup.c,..)
+#endif
+
+ MODINITSRCS = modinit.c
+ MODINITOBJS = modinit.o
+
+ SRCS = shape.c $(MULTIBUFSRC) \
+ mitmisc.c \
+ bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \
+ $(XF86MISCSRCS) $(XF86DGASRCS) \
+ $(CUPSRCS) $(DPMSSRCS) \
+ $(EVISRCS) $(XVSRCS) $(XANTISRCS) $(MODINITSRCS)
+
+ MOBJS = $(MODINITOBJS) shape.o $(MULTIBUFOBJ) mitmisc.o \
+ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o \
+ $(VIDMODEOBJS) $(XF86MISCOBJS) $(XF86DGAOBJS) \
+ $(CUPOBJS) $(DPMSOBJS) $(EVIOBJS) $(XVOBJS) $(XANTIOBJS)
+
+ DEFINES = -DEXTMODULE
+
+XF86INCLUDES = -I$(XF86COMSRC)
+ INCLUDES = -I.. -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
+ $(XF86INCLUDES) -I$(FONTINCSRC)
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln
+
+LinkSourceFile(shape.c,..)
+LinkSourceFile(mitmisc.c,..)
+LinkSourceFile(bigreq.c,..)
+LinkSourceFile(sync.c,..)
+LinkSourceFile(xcmisc.c,..)
+
+ModuleObjectRule()
+SpecialCObjectRule(modinit,$(ICONFIGFILES),$(EXT_DEFINES))
+LibraryModuleTarget(extmod,$(MOBJS))
+NormalLintTarget($(SRCS))
+
+InstallLibraryModule(extmod,$(MODULEDIR),extensions)
+
+DependTarget()
+
+InstallDriverSDKLibraryModule(extmod,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/xc/programs/Xserver/Xext/extmod/modinit.c b/xc/programs/Xserver/Xext/extmod/modinit.c
new file mode 100644
index 000000000..7badeb737
--- /dev/null
+++ b/xc/programs/Xserver/Xext/extmod/modinit.c
@@ -0,0 +1,321 @@
+/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.c,v 1.11 1999/05/09 10:51:49 dawes Exp $ */
+
+/*
+ *
+ * Copyright (c) 1997 Matthieu Herrb
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Matthieu Herrb not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Matthieu Herrb makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+
+#include "xf86Module.h"
+#include "xf86Opt.h"
+
+#include "Xproto.h"
+
+static MODULESETUPPROTO(extmodSetup);
+
+extern Bool noTestExtensions;
+
+#ifdef SHAPE
+extern void ShapeExtensionInit(INITARGS);
+#define _SHAPE_SERVER_ /* don't want Xlib structures */
+#include "shapestr.h"
+#endif
+
+#ifdef MULTIBUFFER
+extern void MultibufferExtensionInit(INITARGS);
+#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
+#include "multibufst.h"
+#endif
+
+#ifdef MITMISC
+extern void MITMiscExtensionInit(INITARGS);
+#define _MITMISC_SERVER_
+#include "mitmiscstr.h"
+#endif
+
+#ifdef XTEST
+extern void XTestExtensionInit(INITARGS);
+#define _XTEST_SERVER_
+#include "XTest.h"
+#include "xteststr.h"
+#endif
+
+#ifdef BIGREQS
+extern void BigReqExtensionInit(INITARGS);
+#include "bigreqstr.h"
+#endif
+
+#ifdef XSYNC
+extern void SyncExtensionInit(INITARGS);
+#define _SYNC_SERVER
+#include "sync.h"
+#include "syncstr.h"
+#endif
+
+#ifdef SCREENSAVER
+extern void ScreenSaverExtensionInit (INITARGS);
+#include "saver.h"
+#endif
+
+#ifdef XCMISC
+extern void XCMiscExtensionInit(INITARGS);
+#include "xcmiscstr.h"
+#endif
+
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+#define _XF86VIDMODE_SERVER_
+#include "xf86vmstr.h"
+#endif
+
+#ifdef XF86MISC
+extern void XFree86MiscExtensionInit(INITARGS);
+#define _XF86MISC_SERVER_
+#define _XF86MISC_SAVER_COMPAT_
+#include "xf86mscstr.h"
+#endif
+
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+extern void XFree86DGARegister(INITARGS);
+#define _XF86DGA_SERVER_
+#include "xf86dgastr.h"
+#endif
+
+#ifdef DPMSExtension
+extern void DPMSExtensionInit(INITARGS);
+#include "dpmsstr.h"
+#endif
+
+#ifdef XANTI
+extern void XAntiExtensionInit(INITARGS);
+#include "XAntiproto.h"
+#endif
+
+#ifdef TOGCUP
+extern void XcupExtensionInit(INITARGS);
+#define _XCUP_SERVER_
+#include "Xcupstr.h"
+#endif
+
+#ifdef EVI
+extern void EVIExtensionInit(INITARGS);
+#define _XEVI_SERVER_
+#include "XEVIstr.h"
+#endif
+
+#ifdef XV
+extern void XvExtensionInit(INITARGS);
+extern void XvRegister(INITARGS);
+#include "Xv.h"
+#endif
+
+/*
+ * Array describing extensions to be initialized
+ */
+ExtensionModule extensionModules[] = {
+#ifdef SHAPE
+ {
+ ShapeExtensionInit,
+ SHAPENAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef MULTIBUFFER
+ {
+ MultibufferExtensionInit,
+ MULTIBUFFER_PROTOCOL_NAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef MITMISC
+ {
+ MITMiscExtensionInit,
+ MITMISCNAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef notyet
+ {
+ XTestExtensionInit,
+ XTestExtensionName,
+ &noTestExtensions,
+ NULL
+ },
+#endif
+#ifdef BIGREQS
+ {
+ BigReqExtensionInit,
+ XBigReqExtensionName,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XSYNC
+ {
+ SyncExtensionInit,
+ SYNC_NAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef SCREENSAVER
+ {
+ ScreenSaverExtensionInit,
+ ScreenSaverName,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XCMISC
+ {
+ XCMiscExtensionInit,
+ XCMiscExtensionName,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XF86VIDMODE
+ {
+ XFree86VidModeExtensionInit,
+ XF86VIDMODENAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XF86MISC
+ {
+ XFree86MiscExtensionInit,
+ XF86MISCNAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XFreeXDGA
+ {
+ XFree86DGAExtensionInit,
+ XF86DGANAME,
+ NULL,
+ XFree86DGARegister
+ },
+#endif
+#ifdef DPMSExtension
+ {
+ DPMSExtensionInit,
+ DPMSExtensionName,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef TOGCUP
+ {
+ XcupExtensionInit,
+ XCUPNAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef EVI
+ {
+ EVIExtensionInit,
+ EVINAME,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XV
+ {
+ XvExtensionInit,
+ XvName,
+ NULL,
+ XvRegister
+ },
+#endif
+#ifdef XANTI
+ {
+ XAntiExtensionInit,
+ XAntiName,
+ NULL,
+ NULL
+ },
+#endif
+ { /* DON'T delete this entry ! */
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ }
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "extmod",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+/*
+ * Data for the loader
+ */
+XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
+
+static pointer
+extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ int i;
+
+ /* XXX the option stuff here is largely a sample/test case */
+
+ for (i = 0; extensionModules[i].name != NULL; i++) {
+ if (opts) {
+ char *s;
+ s = (char *)xalloc(strlen(extensionModules[i].name) + 5);
+ if (s) {
+ pointer o;
+ strcpy(s, "omit");
+ strcat(s, extensionModules[i].name);
+ o = xf86FindOption(opts, s);
+ xfree(s);
+ if (o) {
+ xf86MarkOptionUsed(o);
+ continue;
+ }
+ }
+ }
+ LoadExtension(&extensionModules[i]);
+ }
+ /* Need a non-NULL return */
+ return (pointer)1;
+}
+
+#endif /* XFree86LOADER */
diff --git a/xc/programs/Xserver/Xext/mbuf.c b/xc/programs/Xserver/Xext/mbuf.c
new file mode 100644
index 000000000..d89820965
--- /dev/null
+++ b/xc/programs/Xserver/Xext/mbuf.c
@@ -0,0 +1,2085 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.7 1999/02/19 21:26:54 hohndel Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: mbuf.c /main/27 1998/02/26 12:04:55 barstow $ */
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "window.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
+#include "multibufst.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#endif
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(MINIX) && !defined(Lynx)
+#include <sys/time.h>
+#endif
+#endif
+
+/* given an OtherClientPtr obj, get the ClientPtr */
+#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
+
+/* given a MultibufferPtr b, get the ClientPtr */
+#define bClient(b) (clients[CLIENT_ID(b->pPixmap->drawable.id)])
+
+#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
+
+#ifdef PANORAMIX
+extern int PanoramiXNumScreens;
+extern Bool noPanoramiXExtension;
+extern PanoramiXWindow *PanoramiXWinRoot;
+extern PanoramiXPmap *PanoramiXPmapRoot;
+extern PanoramiXData *panoramiXdataPtr;
+#endif
+
+static unsigned char MultibufferReqCode;
+static int MultibufferEventBase;
+static int MultibufferErrorBase;
+int MultibufferScreenIndex = -1;
+int MultibufferWindowIndex = -1;
+
+static void PerformDisplayRequest (
+#if NeedFunctionPrototypes
+ MultibuffersPtr * /* ppMultibuffers */,
+ MultibufferPtr * /* pMultibuffer */,
+ int /* nbuf */
+#endif
+ );
+static Bool QueueDisplayRequest (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ TimeStamp /* activateTime */
+#endif
+ );
+
+static void BumpTimeStamp (
+#if NeedFunctionPrototypes
+ TimeStamp * /* ts */,
+ CARD32 /* inc */
+#endif
+ );
+
+static void AliasMultibuffer (
+#if NeedFunctionPrototypes
+ MultibuffersPtr /* pMultibuffers */,
+ int /* i */
+#endif
+ );
+static void RecalculateMultibufferOtherEvents (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */
+#endif
+ );
+static int EventSelectForMultibuffer(
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ ClientPtr /* client */,
+ Mask /* mask */
+#endif
+ );
+
+/*
+ * The Pixmap associated with a buffer can be found as a resource
+ * with this type
+ */
+RESTYPE MultibufferDrawableResType;
+static int MultibufferDrawableDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+/*
+ * The per-buffer data can be found as a resource with this type.
+ * the resource id of the per-buffer data is the same as the resource
+ * id of the pixmap
+ */
+static RESTYPE MultibufferResType;
+static int MultibufferDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
+/*
+ * The per-window data can be found as a resource with this type,
+ * using the window resource id
+ */
+static RESTYPE MultibuffersResType;
+static int MultibuffersDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
+/*
+ * Clients other than the buffer creator attach event masks in
+ * OtherClient structures; each has a resource of this type.
+ */
+static RESTYPE OtherClientResType;
+static int OtherClientDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
+/****************
+ * MultibufferExtensionInit
+ *
+ * Called from InitExtensions in main()
+ *
+ ****************/
+
+extern DISPATCH_PROC(ProcGetBufferAttributes);
+
+static DISPATCH_PROC(ProcClearImageBufferArea);
+static DISPATCH_PROC(ProcCreateImageBuffers);
+static DISPATCH_PROC(ProcDestroyImageBuffers);
+static DISPATCH_PROC(ProcDisplayImageBuffers);
+static DISPATCH_PROC(ProcGetBufferInfo);
+static DISPATCH_PROC(ProcGetBufferVersion);
+static DISPATCH_PROC(ProcGetMBufferAttributes);
+static DISPATCH_PROC(ProcMultibufferDispatch);
+static DISPATCH_PROC(ProcSetBufferAttributes);
+static DISPATCH_PROC(ProcSetMBufferAttributes);
+static DISPATCH_PROC(SProcClearImageBufferArea);
+static DISPATCH_PROC(SProcCreateImageBuffers);
+static DISPATCH_PROC(SProcDestroyImageBuffers);
+static DISPATCH_PROC(SProcDisplayImageBuffers);
+static DISPATCH_PROC(SProcGetBufferAttributes);
+static DISPATCH_PROC(SProcGetBufferInfo);
+static DISPATCH_PROC(SProcGetBufferVersion);
+static DISPATCH_PROC(SProcGetMBufferAttributes);
+static DISPATCH_PROC(SProcMultibufferDispatch);
+static DISPATCH_PROC(SProcSetBufferAttributes);
+static DISPATCH_PROC(SProcSetMBufferAttributes);
+
+static void MultibufferResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SClobberNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufClobberNotifyEvent * /* from */,
+ xMbufClobberNotifyEvent * /* to */
+# endif
+ );
+static void SUpdateNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufUpdateNotifyEvent * /* from */,
+ xMbufUpdateNotifyEvent * /* to */
+#endif
+ );
+static Bool MultibufferPositionWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* x */,
+ int /* y */
+#endif
+ );
+
+static void SetupBackgroundPainter (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ GCPtr /* pGC */
+#endif
+ );
+
+static int DeliverEventsToMultibuffer (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ xEvent * /* pEvents */,
+ int /* count */,
+ Mask /* filter */
+#endif
+ );
+
+void
+MultibufferExtensionInit()
+{
+ ExtensionEntry *extEntry;
+ int i, j;
+ ScreenPtr pScreen;
+ MultibufferScreenPtr pMultibufferScreen;
+
+ /*
+ * allocate private pointers in windows and screens. Allocating
+ * window privates may seem like an unnecessary expense, but every
+ * PositionWindow call must check to see if the window is
+ * multi-buffered; a resource lookup is too expensive.
+ */
+ MultibufferScreenIndex = AllocateScreenPrivateIndex ();
+ if (MultibufferScreenIndex < 0)
+ return;
+ MultibufferWindowIndex = AllocateWindowPrivateIndex ();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) ||
+ !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
+ {
+ for (j = 0; j < i; j++)
+ xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr);
+ return;
+ }
+ pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen;
+ /*
+ * wrap PositionWindow to resize the pixmap when the window
+ * changes size
+ */
+ pMultibufferScreen->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = MultibufferPositionWindow;
+ }
+ /*
+ * create the resource types
+ */
+ MultibufferDrawableResType =
+ CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE;
+ MultibufferResType = CreateNewResourceType(MultibufferDelete);
+ MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
+ OtherClientResType = CreateNewResourceType(OtherClientDelete);
+ if (MultibufferDrawableResType && MultibufferResType &&
+ MultibuffersResType && OtherClientResType &&
+ (extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
+ MultibufferNumberEvents,
+ MultibufferNumberErrors,
+ ProcMultibufferDispatch, SProcMultibufferDispatch,
+ MultibufferResetProc, StandardMinorOpcode)))
+ {
+ MultibufferReqCode = (unsigned char)extEntry->base;
+ MultibufferEventBase = extEntry->eventBase;
+ MultibufferErrorBase = extEntry->errorBase;
+ EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
+ EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+MultibufferResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+ int i;
+ ScreenPtr pScreen;
+ MultibufferScreenPtr pMultibufferScreen;
+
+ if (MultibufferScreenIndex < 0)
+ return;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ if (pScreen->devPrivates[MultibufferScreenIndex].ptr)
+ {
+ pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
+ pScreen->PositionWindow = pMultibufferScreen->PositionWindow;
+ xfree (pMultibufferScreen);
+ }
+ }
+}
+
+static int
+ProcGetBufferVersion (client)
+ register ClientPtr client;
+{
+ xMbufGetBufferVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = MULTIBUFFER_MAJOR_VERSION;
+ rep.minorVersion = MULTIBUFFER_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof (xMbufGetBufferVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static void
+SetupBackgroundPainter (pWin, pGC)
+ WindowPtr pWin;
+ GCPtr pGC;
+{
+ pointer gcvalues[4];
+ int ts_x_origin, ts_y_origin;
+ PixUnion background;
+ int backgroundState;
+ Mask gcmask;
+
+ /*
+ * First take care of any ParentRelative stuff by altering the
+ * tile/stipple origin to match the coordinates of the upper-left
+ * corner of the first ancestor without a ParentRelative background.
+ * This coordinate is, of course, negative.
+ */
+
+ ts_x_origin = ts_y_origin = 0;
+ while (pWin->backgroundState == ParentRelative) {
+ ts_x_origin -= pWin->origin.x;
+ ts_y_origin -= pWin->origin.y;
+ pWin = pWin->parent;
+ }
+ backgroundState = pWin->backgroundState;
+ background = pWin->background;
+
+ switch (backgroundState)
+ {
+ case BackgroundPixel:
+ gcvalues[0] = (pointer) background.pixel;
+ gcvalues[1] = (pointer) FillSolid;
+ gcmask = GCForeground|GCFillStyle;
+ break;
+
+ case BackgroundPixmap:
+ gcvalues[0] = (pointer) FillTiled;
+ gcvalues[1] = (pointer) background.pixmap;
+ gcvalues[2] = (pointer)(long) ts_x_origin;
+ gcvalues[3] = (pointer)(long) ts_y_origin;
+ gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
+ break;
+
+ default:
+ gcvalues[0] = (pointer) GXnoop;
+ gcmask = GCFunction;
+ }
+ DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
+}
+
+int
+CreateImageBuffers (pWin, nbuf, ids, action, hint)
+ WindowPtr pWin;
+ int nbuf;
+ XID *ids;
+ int action;
+ int hint;
+{
+ MultibuffersPtr pMultibuffers;
+ MultibufferPtr pMultibuffer;
+ ScreenPtr pScreen;
+ int width, height, depth;
+ int i;
+ GCPtr pClearGC = NULL;
+ xRectangle clearRect;
+
+ DestroyImageBuffers(pWin);
+ pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) +
+ nbuf * sizeof (MultibufferRec));
+ if (!pMultibuffers)
+ return BadAlloc;
+ pMultibuffers->pWindow = pWin;
+ pMultibuffers->buffers = (MultibufferPtr) (pMultibuffers + 1);
+ pMultibuffers->refcnt = pMultibuffers->numMultibuffer = 0;
+ if (!AddResource (pWin->drawable.id, MultibuffersResType, (pointer) pMultibuffers))
+ return BadAlloc;
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+ depth = pWin->drawable.depth;
+ pScreen = pWin->drawable.pScreen;
+
+ if (pWin->backgroundState != None)
+ {
+ pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
+ SetupBackgroundPainter (pWin, pClearGC);
+ clearRect.x = clearRect.y = 0;
+ clearRect.width = width;
+ clearRect.height = height;
+ }
+
+ for (i = 0; i < nbuf; i++)
+ {
+ pMultibuffer = &pMultibuffers->buffers[i];
+ pMultibuffer->eventMask = 0L;
+ pMultibuffer->otherEventMask = 0L;
+ pMultibuffer->otherClients = (OtherClientsPtr) NULL;
+ pMultibuffer->number = i;
+ pMultibuffer->side = MultibufferSideMono;
+ pMultibuffer->clobber = MultibufferUnclobbered;
+ pMultibuffer->pMultibuffers = pMultibuffers;
+ if (!AddResource (ids[i], MultibufferResType, (pointer) pMultibuffer))
+ break;
+ pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth);
+ if (!pMultibuffer->pPixmap)
+ break;
+ if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap))
+ {
+ FreeResource (ids[i], MultibufferResType);
+ (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
+ break;
+ }
+ pMultibuffer->pPixmap->drawable.id = ids[i];
+
+ if (i > 0 && pClearGC)
+ {
+ ValidateGC((DrawablePtr)pMultibuffer->pPixmap, pClearGC);
+ (*pClearGC->ops->PolyFillRect)((DrawablePtr)pMultibuffer->pPixmap,
+ pClearGC, 1, &clearRect);
+ }
+ }
+ pMultibuffers->numMultibuffer = i;
+ pMultibuffers->refcnt = i;
+ pMultibuffers->displayedMultibuffer = -1;
+ if (i > 0)
+ AliasMultibuffer (pMultibuffers, 0);
+ pMultibuffers->updateAction = action;
+ pMultibuffers->updateHint = hint;
+ pMultibuffers->windowMode = MultibufferModeMono;
+ pMultibuffers->lastUpdate.months = 0;
+ pMultibuffers->lastUpdate.milliseconds = 0;
+ pMultibuffers->width = width;
+ pMultibuffers->height = height;
+ pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers;
+ if (pClearGC) FreeScratchGC(pClearGC);
+ return Success;
+}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXCreateImageBuffers (client)
+ register ClientPtr client;
+{
+ REQUEST(xMbufCreateImageBuffersReq);
+
+ register int result;
+ int i, j, k, len;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *next;
+ PanoramiXWindow *pPanoramiXids;
+ PanoramiXWindow *pPanoramiXPrev_ids;
+ PanoramiXPmap *local;
+ PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
+ CARD32 *value, *orig_ids;
+ XID *ids;
+ XID ID;
+ DrawablePtr pDrawable;
+
+ REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
+ ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
+ orig_ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
+ if (!ids)
+ return BadAlloc;
+ memcpy((char *)orig_ids, (char *) &stuff[1], len * sizeof(XID));
+ value = (CARD32 *)&stuff[1];
+ /* New resources are pixmaps */
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ for (i = 0; i < len; i++) {
+ ids[i] = (XID)orig_ids[i];
+ /* These will be MultibufferDrawableResType & MultibufferResType */
+ pPanoramiXPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
+ if (!pPanoramiXPmap) {
+ local = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
+ for (k = 0; k <= PanoramiXNumScreens - 1; k++) {
+ ID = k ? FakeClientID(client->index) : ids[i];
+ local->info[k].id = ID;
+ }
+ local->FreeMe = FALSE;
+ PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
+ pPanoramiXPmap->next = local;
+ value[i] = local->info[j].id;
+ }else
+ value[i] = pPanoramiXPmap->info[j].id;
+ }
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = ProcCreateImageBuffers (client);
+ noPanoramiXExtension = FALSE;
+ BREAK_IF(result != Success);
+ }
+ if (result != Success) {
+ if (ids)
+ Xfree(ids);
+ if (orig_ids)
+ Xfree(orig_ids);
+ if (local)
+ Xfree(local);
+ }
+ return (result);
+}
+#endif
+
+#ifdef PANORAMIX
+int
+#else
+static int
+#endif
+ProcCreateImageBuffers (client)
+ register ClientPtr client;
+{
+ REQUEST(xMbufCreateImageBuffersReq);
+ xMbufCreateImageBuffersReply rep;
+ register int n;
+ WindowPtr pWin;
+ XID *ids;
+ int len, nbuf;
+ int i;
+ int err;
+
+ REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
+ len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
+ if (len == 0)
+ return BadLength;
+ if (!(pWin = LookupWindow (stuff->window, client)))
+ return BadWindow;
+ if (pWin->drawable.class == InputOnly)
+ return BadMatch;
+ switch (stuff->updateAction)
+ {
+ case MultibufferUpdateActionUndefined:
+ case MultibufferUpdateActionBackground:
+ case MultibufferUpdateActionUntouched:
+ case MultibufferUpdateActionCopied:
+ break;
+ default:
+ client->errorValue = stuff->updateAction;
+ return BadValue;
+ }
+ switch (stuff->updateHint)
+ {
+ case MultibufferUpdateHintFrequent:
+ case MultibufferUpdateHintIntermittent:
+ case MultibufferUpdateHintStatic:
+ break;
+ default:
+ client->errorValue = stuff->updateHint;
+ return BadValue;
+ }
+ nbuf = len;
+ ids = (XID *) &stuff[1];
+ for (i = 0; i < nbuf; i++)
+ {
+ LEGAL_NEW_RESOURCE(ids[i], client);
+ }
+ err = CreateImageBuffers (pWin, nbuf, ids,
+ stuff->updateAction, stuff->updateHint);
+ if (err != Success)
+ return err;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer;
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.numberBuffer, n);
+ }
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcDisplayImageBuffers (client)
+ register ClientPtr client;
+{
+ REQUEST(xMbufDisplayImageBuffersReq);
+ MultibufferPtr *pMultibuffer;
+ MultibuffersPtr *ppMultibuffers;
+ int nbuf;
+ XID *ids;
+ int i, j;
+ CARD32 minDelay;
+ TimeStamp activateTime, bufferTime;
+
+#ifdef PANORAMIX
+ WindowPtr pWndw;
+ PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
+ MultibufferPtr *pScrn0Multibuffer;
+ MultibuffersPtr *ppScrn0Multibuffers;
+ int k;
+ int panoramiX_buf = 0;
+ Bool FoundScreen;
+
+#endif
+
+ REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
+ nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
+ if (!nbuf)
+ return Success;
+ minDelay = stuff->minDelay;
+ ids = (XID *) &stuff[1];
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ {
+ int maxbuf = 0;
+ maxbuf = nbuf * PanoramiXNumScreens;
+ ppScrn0Multibuffers = (MultibuffersPtr *) xalloc(maxbuf * sizeof (MultibuffersPtr));
+ pScrn0Multibuffer = (MultibufferPtr *) xalloc (maxbuf * sizeof(MultibufferPtr));
+ if (!ppScrn0Multibuffers || !pScrn0Multibuffer)
+ {
+ if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
+ xfree (ppScrn0Multibuffers);
+ xfree (pScrn0Multibuffer);
+ client->errorValue = 0;
+ return BadAlloc;
+ }
+ }
+#endif
+ ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
+ pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
+ if (!ppMultibuffers || !pMultibuffer)
+ {
+ if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers);
+ if (pMultibuffer) DEALLOCATE_LOCAL(pMultibuffer);
+ client->errorValue = 0;
+ return BadAlloc;
+ }
+ activateTime.months = 0;
+ activateTime.milliseconds = 0;
+ for (i = 0; i < nbuf; i++)
+ {
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ pPanoramiXPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
+ if (!pPanoramiXPmap){
+ if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
+ xfree (ppMultibuffers);
+ xfree (pMultibuffer);
+ client->errorValue = ids[i];
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ }
+ FoundScreen = FALSE;
+ pScrn0Multibuffer[panoramiX_buf] = (MultibufferPtr)
+ LookupIDByType (ids[i], MultibufferResType);
+ ppScrn0Multibuffers[i] = pScrn0Multibuffer[i]->pMultibuffers;
+ pWndw = ppScrn0Multibuffers[i]->pWindow;
+ for (k = 0; (k < PanoramiXNumScreens && !FoundScreen); k++) {
+ pMultibuffer[panoramiX_buf] = (MultibufferPtr)
+ LookupIDByType (pPanoramiXPmap->info[k].id, MultibufferResType);
+ if (!pMultibuffer[i])
+ {
+ if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
+ xfree (ppMultibuffers);
+ xfree (pMultibuffer);
+ client->errorValue = ids[i];
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ }
+ ppMultibuffers[panoramiX_buf] = pMultibuffer[panoramiX_buf]->pMultibuffers;
+ /* Figure out where the buffer resides, which screens */
+ if ( ((pWndw->drawable.x < 0) &&
+ (pWndw->drawable.x + pWndw->drawable.width < 0))
+ || ( (pWndw->drawable.x >
+ panoramiXdataPtr[k].x + panoramiXdataPtr[k].width) &&
+ (pWndw->drawable.x + pWndw->drawable.width >
+ panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)))
+ /* its not on screen - k -, try next screen */
+ continue;
+ if ( ((pWndw->drawable.y < 0) &&
+ (pWndw->drawable.y + pWndw->drawable.height < 0))
+ || ( (pWndw->drawable.y >
+ panoramiXdataPtr[k].y + panoramiXdataPtr[k].height) &&
+ (pWndw->drawable.y + pWndw->drawable.height >
+ panoramiXdataPtr[k].y + panoramiXdataPtr[k].height)))
+ /* its not on screen - k -, try next screen */
+ continue;
+
+ /* The window resides on screen k, which means we need to
+ keep the buffer information for this screen */
+ panoramiX_buf++;
+
+ /* Is it only on this screen, or does it enter onto another
+ screen */
+ if ( ((pWndw->drawable.x + pWndw->drawable.width) <=
+ (panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)) &&
+ ((pWndw->drawable.y + pWndw->drawable.height) <=
+ (panoramiXdataPtr[k].y +
+ panoramiXdataPtr[k].height )) )
+ FoundScreen = TRUE;
+ } /* for each screen k */
+ for (j = 0; j < i; j++)
+ {
+ if (ppScrn0Multibuffers[i] == ppScrn0Multibuffers[j])
+ {
+ if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
+ DEALLOCATE_LOCAL(ppScrn0Multibuffers);
+ DEALLOCATE_LOCAL(pScrn0Multibuffer);
+ DEALLOCATE_LOCAL(ppMultibuffers);
+ DEALLOCATE_LOCAL(pMultibuffer);
+ client->errorValue = ids[i];
+ return BadMatch;
+ }
+ }
+ bufferTime = ppScrn0Multibuffers[i]->lastUpdate;
+ }else {
+#endif
+ pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
+MultibufferResType);
+ if (!pMultibuffer[i])
+ {
+ DEALLOCATE_LOCAL(ppMultibuffers);
+ DEALLOCATE_LOCAL(pMultibuffer);
+ client->errorValue = ids[i];
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ }
+ ppMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
+ for (j = 0; j < i; j++)
+ {
+ if (ppMultibuffers[i] == ppMultibuffers[j])
+ {
+ DEALLOCATE_LOCAL(ppMultibuffers);
+ DEALLOCATE_LOCAL(pMultibuffer);
+ client->errorValue = ids[i];
+ return BadMatch;
+ }
+ }
+ bufferTime = ppMultibuffers[i]->lastUpdate;
+#ifdef PANORAMIX
+ }
+#endif
+ BumpTimeStamp (&bufferTime, minDelay);
+ if (CompareTimeStamps (bufferTime, activateTime) == LATER)
+ activateTime = bufferTime;
+ }
+ UpdateCurrentTime ();
+ if (CompareTimeStamps (activateTime, currentTime) == LATER &&
+ QueueDisplayRequest (client, activateTime))
+ {
+ ;
+ }
+ else
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension){
+ PerformDisplayRequest (ppMultibuffers, pMultibuffer, panoramiX_buf);
+ }else
+#endif
+ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension){
+ DEALLOCATE_LOCAL(ppScrn0Multibuffers);
+ DEALLOCATE_LOCAL(pScrn0Multibuffer);
+ }
+#endif
+
+ DEALLOCATE_LOCAL(ppMultibuffers);
+ DEALLOCATE_LOCAL(pMultibuffer);
+ return Success;
+}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXDestroyImageBuffers (client)
+ ClientPtr client;
+{
+ REQUEST (xMbufDestroyImageBuffersReq);
+ WindowPtr pWin;
+
+ register int result;
+ int j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = ProcDestroyImageBuffers (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+
+#ifdef PANORAMIX
+int
+#else
+static int
+#endif
+ProcDestroyImageBuffers (client)
+ register ClientPtr client;
+{
+ REQUEST (xMbufDestroyImageBuffersReq);
+ WindowPtr pWin;
+
+ REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
+ if (!(pWin = LookupWindow (stuff->window, client)))
+ return BadWindow;
+ DestroyImageBuffers (pWin);
+ return Success;
+}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXSetMBufferAttributes (client)
+ ClientPtr client;
+{
+ REQUEST (xMbufSetMBufferAttributesReq);
+ WindowPtr pWin;
+
+ register int result;
+ int j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST_SIZE_MATCH (xMbufSetMBufferAttributesReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = ProcSetMBufferAttributes (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+#ifdef PANORAMIX
+int
+#else
+static int
+#endif
+ProcSetMBufferAttributes (client)
+ register ClientPtr client;
+{
+ REQUEST (xMbufSetMBufferAttributesReq);
+ WindowPtr pWin;
+ MultibuffersPtr pMultibuffers;
+ int len;
+ Mask vmask;
+ Mask index2;
+ CARD32 updateHint;
+ XID *vlist;
+
+ REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
+ if (!pMultibuffers)
+ return BadMatch;
+ len = stuff->length - (sizeof (xMbufSetMBufferAttributesReq) >> 2);
+ vmask = stuff->valueMask;
+ if (len != Ones (vmask))
+ return BadLength;
+ vlist = (XID *) &stuff[1];
+ while (vmask)
+ {
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
+ {
+ case MultibufferWindowUpdateHint:
+ updateHint = (CARD32) *vlist;
+ switch (updateHint)
+ {
+ case MultibufferUpdateHintFrequent:
+ case MultibufferUpdateHintIntermittent:
+ case MultibufferUpdateHintStatic:
+ pMultibuffers->updateHint = updateHint;
+ break;
+ default:
+ client->errorValue = updateHint;
+ return BadValue;
+ }
+ vlist++;
+ break;
+ default:
+ client->errorValue = stuff->valueMask;
+ return BadValue;
+ }
+ }
+ return Success;
+}
+
+static int
+ProcGetMBufferAttributes (client)
+ ClientPtr client;
+{
+ REQUEST (xMbufGetMBufferAttributesReq);
+ WindowPtr pWin;
+ MultibuffersPtr pMultibuffers;
+ XID *ids;
+ xMbufGetMBufferAttributesReply rep;
+ int i, n;
+
+ REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
+ if (!pMultibuffers)
+ return BadAccess;
+ ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID));
+ if (!ids)
+ return BadAlloc;
+ for (i = 0; i < pMultibuffers->numMultibuffer; i++)
+ ids[i] = pMultibuffers->buffers[i].pPixmap->drawable.id;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = pMultibuffers->numMultibuffer;
+ rep.displayedBuffer = pMultibuffers->displayedMultibuffer;
+ rep.updateAction = pMultibuffers->updateAction;
+ rep.updateHint = pMultibuffers->updateHint;
+ rep.windowMode = pMultibuffers->windowMode;
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.displayedBuffer, n);
+ SwapLongs (ids, pMultibuffers->numMultibuffer);
+ }
+ WriteToClient (client, sizeof(xMbufGetMBufferAttributesReply),
+ (char *)&rep);
+ WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
+ (char *)ids);
+ DEALLOCATE_LOCAL((pointer) ids);
+ return client->noClientException;
+}
+
+static int
+ProcSetBufferAttributes (client)
+ register ClientPtr client;
+{
+ REQUEST(xMbufSetBufferAttributesReq);
+ MultibufferPtr pMultibuffer;
+ int len;
+ Mask vmask, index2;
+ XID *vlist;
+ Mask eventMask;
+ int result;
+
+ REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq);
+ pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
+ if (!pMultibuffer)
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ len = stuff->length - (sizeof (xMbufSetBufferAttributesReq) >> 2);
+ vmask = stuff->valueMask;
+ if (len != Ones (vmask))
+ return BadLength;
+ vlist = (XID *) &stuff[1];
+ while (vmask)
+ {
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
+ {
+ case MultibufferBufferEventMask:
+ eventMask = (Mask) *vlist;
+ vlist++;
+ result = EventSelectForMultibuffer (pMultibuffer, client, eventMask);
+ if (result != Success)
+ return result;
+ break;
+ default:
+ client->errorValue = stuff->valueMask;
+ return BadValue;
+ }
+ }
+ return Success;
+}
+
+int
+ProcGetBufferAttributes (client)
+ register ClientPtr client;
+{
+ REQUEST(xMbufGetBufferAttributesReq);
+ MultibufferPtr pMultibuffer;
+ xMbufGetBufferAttributesReply rep;
+ OtherClientsPtr other;
+ int n;
+
+ REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq);
+ pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
+ if (!pMultibuffer)
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.window = pMultibuffer->pMultibuffers->pWindow->drawable.id;
+ if (bClient (pMultibuffer) == client)
+ rep.eventMask = pMultibuffer->eventMask;
+ else
+ {
+ rep.eventMask = (Mask) 0L;
+ for (other = pMultibuffer->otherClients; other; other = other->next)
+ if (SameClient (other, client))
+ {
+ rep.eventMask = other->mask;
+ break;
+ }
+ }
+ rep.bufferIndex = pMultibuffer->number;
+ rep.side = pMultibuffer->side;
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.window, n);
+ swapl(&rep.eventMask, n);
+ swaps(&rep.bufferIndex, n);
+ }
+ WriteToClient(client, sizeof (xMbufGetBufferAttributesReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcGetBufferInfo (client)
+ register ClientPtr client;
+{
+ REQUEST (xMbufGetBufferInfoReq);
+ DrawablePtr pDrawable;
+ xMbufGetBufferInfoReply rep;
+ ScreenPtr pScreen;
+ int i, j, k;
+ int n;
+ xMbufBufferInfo *pInfo;
+ int nInfo;
+ DepthPtr pDepth;
+
+ pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client);
+ if (!pDrawable)
+ return BadDrawable;
+ pScreen = pDrawable->pScreen;
+ nInfo = 0;
+ for (i = 0; i < pScreen->numDepths; i++)
+ {
+ pDepth = &pScreen->allowedDepths[i];
+ nInfo += pDepth->numVids;
+ }
+ pInfo = (xMbufBufferInfo *)
+ ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo));
+ if (!pInfo)
+ return BadAlloc;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = nInfo * (sizeof (xMbufBufferInfo) >> 2);
+ rep.normalInfo = nInfo;
+ rep.stereoInfo = 0;
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.normalInfo, n);
+ swaps(&rep.stereoInfo, n);
+ }
+
+ k = 0;
+ for (i = 0; i < pScreen->numDepths; i++)
+ {
+ pDepth = &pScreen->allowedDepths[i];
+ for (j = 0; j < pDepth->numVids; j++)
+ {
+ pInfo[k].visualID = pDepth->vids[j];
+ pInfo[k].maxBuffers = 0;
+ pInfo[k].depth = pDepth->depth;
+ if (client->swapped)
+ {
+ swapl (&pInfo[k].visualID, n);
+ swaps (&pInfo[k].maxBuffers, n);
+ }
+ k++;
+ }
+ }
+ WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep);
+ WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo);
+ DEALLOCATE_LOCAL ((pointer) pInfo);
+ return client->noClientException;
+}
+
+static int
+ProcClearImageBufferArea (client)
+ register ClientPtr client;
+{
+ REQUEST (xMbufClearImageBufferAreaReq);
+ MultibufferPtr pMultibuffer;
+ WindowPtr pWin;
+ xRectangle clearRect;
+ int width, height;
+ DrawablePtr pDrawable;
+ ScreenPtr pScreen;
+
+ REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
+ pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType);
+ if (!pMultibuffer)
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
+ {
+ client->errorValue = stuff->exposures;
+ return(BadValue);
+ }
+ pWin = pMultibuffer->pMultibuffers->pWindow;
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+ pScreen = pWin->drawable.pScreen;
+
+ clearRect.x = stuff->x;
+ clearRect.y = stuff->y;
+ clearRect.width = stuff->width ? stuff->width : width;
+ clearRect.height = stuff->height ? stuff->height : height;
+
+ if (pWin->backgroundState != None)
+ {
+ GCPtr pClearGC;
+ pClearGC = GetScratchGC (pWin->drawable.depth, pScreen);
+ SetupBackgroundPainter (pWin, pClearGC);
+
+ if (pMultibuffer->number == pMultibuffer->pMultibuffers->displayedMultibuffer)
+ pDrawable = (DrawablePtr)pWin;
+ else
+ pDrawable = (DrawablePtr)pMultibuffer->pPixmap;
+
+ ValidateGC(pDrawable, pClearGC);
+ (*pClearGC->ops->PolyFillRect) (pDrawable, pClearGC, 1, &clearRect);
+ FreeScratchGC(pClearGC);
+ }
+
+ if (stuff->exposures)
+ {
+ RegionRec region;
+ BoxRec box;
+ box.x1 = clearRect.x;
+ box.y1 = clearRect.y;
+ box.x2 = clearRect.x + clearRect.width;
+ box.y2 = clearRect.y + clearRect.height;
+ REGION_INIT(pScreen, &region, &box, 1);
+ MultibufferExpose(pMultibuffer, &region);
+ REGION_UNINIT(pScreen, &region);
+ }
+ return Success;
+}
+
+static int
+ProcMultibufferDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_MbufGetBufferVersion:
+ return ProcGetBufferVersion (client);
+ case X_MbufCreateImageBuffers:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXCreateImageBuffers (client);
+ else
+ return ProcCreateImageBuffers (client);
+#else
+ return ProcCreateImageBuffers (client);
+#endif
+ case X_MbufDisplayImageBuffers:
+ return ProcDisplayImageBuffers (client);
+ case X_MbufDestroyImageBuffers:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXDestroyImageBuffers (client);
+ else
+ return ProcDestroyImageBuffers (client);
+#else
+ return ProcDestroyImageBuffers (client);
+#endif
+ case X_MbufSetMBufferAttributes:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXSetMBufferAttributes (client);
+ else
+ return ProcSetMBufferAttributes (client);
+#else
+ return ProcSetMBufferAttributes (client);
+#endif
+ case X_MbufGetMBufferAttributes:
+ return ProcGetMBufferAttributes (client);
+ case X_MbufSetBufferAttributes:
+ return ProcSetBufferAttributes (client);
+ case X_MbufGetBufferAttributes:
+ return ProcGetBufferAttributes (client);
+ case X_MbufGetBufferInfo:
+ return ProcGetBufferInfo (client);
+ case X_MbufClearImageBufferArea:
+ return ProcClearImageBufferArea (client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcGetBufferVersion (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufGetBufferVersionReq);
+
+ swaps (&stuff->length, n);
+ return ProcGetBufferVersion (client);
+}
+
+static int
+SProcCreateImageBuffers (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufCreateImageBuffersReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
+ swapl (&stuff->window, n);
+ SwapRestL(stuff);
+ return ProcCreateImageBuffers (client);
+}
+
+static int
+SProcDisplayImageBuffers (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufDisplayImageBuffersReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
+ swaps (&stuff->minDelay, n);
+ swaps (&stuff->maxDelay, n);
+ SwapRestL(stuff);
+ return ProcDisplayImageBuffers (client);
+}
+
+static int
+SProcDestroyImageBuffers (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufDestroyImageBuffersReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
+ swapl (&stuff->window, n);
+ return ProcDestroyImageBuffers (client);
+}
+
+static int
+SProcSetMBufferAttributes (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufSetMBufferAttributesReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xMbufSetMBufferAttributesReq);
+ swapl (&stuff->window, n);
+ swapl (&stuff->valueMask, n);
+ SwapRestL(stuff);
+ return ProcSetMBufferAttributes (client);
+}
+
+static int
+SProcGetMBufferAttributes (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufGetMBufferAttributesReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xMbufGetMBufferAttributesReq);
+ swapl (&stuff->window, n);
+ return ProcGetMBufferAttributes (client);
+}
+
+static int
+SProcSetBufferAttributes (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufSetBufferAttributesReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xMbufSetBufferAttributesReq);
+ swapl (&stuff->buffer, n);
+ swapl (&stuff->valueMask, n);
+ SwapRestL(stuff);
+ return ProcSetBufferAttributes (client);
+}
+
+static int
+SProcGetBufferAttributes (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufGetBufferAttributesReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xMbufGetBufferAttributesReq);
+ swapl (&stuff->buffer, n);
+ return ProcGetBufferAttributes (client);
+}
+
+static int
+SProcGetBufferInfo (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xMbufGetBufferInfoReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xMbufGetBufferInfoReq);
+ swapl (&stuff->drawable, n);
+ return ProcGetBufferInfo (client);
+}
+
+static int
+SProcClearImageBufferArea(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xMbufClearImageBufferAreaReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq);
+ swapl(&stuff->buffer, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ return ProcClearImageBufferArea(client);
+}
+
+static int
+SProcMultibufferDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_MbufGetBufferVersion:
+ return SProcGetBufferVersion (client);
+ case X_MbufCreateImageBuffers:
+ return SProcCreateImageBuffers (client);
+ case X_MbufDisplayImageBuffers:
+ return SProcDisplayImageBuffers (client);
+ case X_MbufDestroyImageBuffers:
+ return SProcDestroyImageBuffers (client);
+ case X_MbufSetMBufferAttributes:
+ return SProcSetMBufferAttributes (client);
+ case X_MbufGetMBufferAttributes:
+ return SProcGetMBufferAttributes (client);
+ case X_MbufSetBufferAttributes:
+ return SProcSetBufferAttributes (client);
+ case X_MbufGetBufferAttributes:
+ return SProcGetBufferAttributes (client);
+ case X_MbufGetBufferInfo:
+ return SProcGetBufferInfo (client);
+ case X_MbufClearImageBufferArea:
+ return SProcClearImageBufferArea (client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SUpdateNotifyEvent (from, to)
+ xMbufUpdateNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->buffer, to->buffer);
+ cpswapl (from->timeStamp, to->timeStamp);
+}
+
+static void
+SClobberNotifyEvent (from, to)
+ xMbufClobberNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->buffer, to->buffer);
+ to->state = from->state;
+}
+
+static void
+PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
+ MultibufferPtr *pMultibuffer;
+ MultibuffersPtr *ppMultibuffers;
+ int nbuf;
+{
+ GCPtr pGC;
+ PixmapPtr pPrevPixmap, pNewPixmap;
+ xRectangle clearRect;
+ WindowPtr pWin;
+ RegionPtr pExposed;
+ int i;
+ MultibufferPtr pPrevMultibuffer;
+ XID graphicsExpose;
+
+ UpdateCurrentTime ();
+ for (i = 0; i < nbuf; i++)
+ {
+ pWin = ppMultibuffers[i]->pWindow;
+ pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
+ pPrevMultibuffer =
+ &ppMultibuffers[i]->buffers[ppMultibuffers[i]->displayedMultibuffer];
+ pPrevPixmap = pPrevMultibuffer->pPixmap;
+ pNewPixmap = pMultibuffer[i]->pPixmap;
+ switch (ppMultibuffers[i]->updateAction)
+ {
+ case MultibufferUpdateActionUndefined:
+ break;
+ case MultibufferUpdateActionBackground:
+ SetupBackgroundPainter (pWin, pGC);
+ ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = pPrevPixmap->drawable.width;
+ clearRect.height = pPrevPixmap->drawable.height;
+ (*pGC->ops->PolyFillRect) ((DrawablePtr)pPrevPixmap, pGC,
+ 1, &clearRect);
+ break;
+ case MultibufferUpdateActionUntouched:
+ /* copy the window to the pixmap that represents the
+ * currently displayed buffer
+ */
+ if (pPrevMultibuffer->eventMask & ExposureMask)
+ {
+ graphicsExpose = TRUE;
+ DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
+ }
+ ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
+ pExposed = (*pGC->ops->CopyArea)
+ ((DrawablePtr) pWin,
+ (DrawablePtr) pPrevPixmap,
+ pGC,
+ 0, 0,
+ pWin->drawable.width, pWin->drawable.height,
+ 0, 0);
+
+ /* if we couldn't copy the whole window to the buffer,
+ * send expose events (if any client wants them)
+ */
+ if (pPrevMultibuffer->eventMask & ExposureMask)
+ { /* some client wants expose events */
+ if (pExposed)
+ {
+ RegionPtr pWinSize;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ pWinSize = CreateUnclippedWinSize (pWin);
+ /* pExposed is window-relative, but at this point
+ * pWinSize is screen-relative. Make pWinSize be
+ * window-relative so that region ops involving
+ * pExposed and pWinSize behave sensibly.
+ */
+ REGION_TRANSLATE(pScreen, pWinSize,
+ -pWin->drawable.x,
+ -pWin->drawable.y);
+ REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
+ REGION_DESTROY(pScreen, pWinSize);
+ MultibufferExpose (pPrevMultibuffer, pExposed);
+ REGION_DESTROY(pScreen, pExposed);
+ }
+ graphicsExpose = FALSE;
+ DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
+ }
+ break; /* end case MultibufferUpdateActionUntouched */
+
+ case MultibufferUpdateActionCopied:
+ ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
+ (DrawablePtr)pPrevPixmap, pGC,
+ 0, 0,
+ pWin->drawable.width, pWin->drawable.height,
+ 0, 0);
+ break;
+ } /* end switch on update action */
+
+ /* display the new buffer */
+ ValidateGC ((DrawablePtr)pWin, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC,
+ 0, 0,
+ pWin->drawable.width, pWin->drawable.height,
+ 0, 0);
+ ppMultibuffers[i]->lastUpdate = currentTime;
+ MultibufferUpdate (pMultibuffer[i],
+ ppMultibuffers[i]->lastUpdate.milliseconds);
+ AliasMultibuffer (ppMultibuffers[i],
+ pMultibuffer[i] - ppMultibuffers[i]->buffers);
+ FreeScratchGC (pGC);
+ }
+}
+
+DrawablePtr
+GetBufferPointer (pWin, i)
+ WindowPtr pWin;
+ int i;
+{
+ MultibuffersPtr pMultibuffers;
+
+ if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
+ return NULL;
+ return (DrawablePtr) pMultibuffers->buffers[i].pPixmap;
+}
+
+int
+DisplayImageBuffers (ids, nbuf)
+ XID *ids;
+ int nbuf;
+{
+ MultibufferPtr *pMultibuffer;
+ MultibuffersPtr *pMultibuffers;
+ int i, j;
+
+ pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer +
+ nbuf * sizeof *pMultibuffers);
+ if (!pMultibuffer)
+ return BadAlloc;
+ pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf);
+ for (i = 0; i < nbuf; i++)
+ {
+ pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType);
+ if (!pMultibuffer[i])
+ {
+ DEALLOCATE_LOCAL (pMultibuffer);
+ return MultibufferErrorBase + MultibufferBadBuffer;
+ }
+ pMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
+ for (j = 0; j < i; j++)
+ if (pMultibuffers[i] == pMultibuffers[j])
+ {
+ DEALLOCATE_LOCAL (pMultibuffer);
+ return BadMatch;
+ }
+ }
+ PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf);
+ DEALLOCATE_LOCAL (pMultibuffer);
+ return Success;
+}
+
+
+static Bool
+QueueDisplayRequest (client, activateTime)
+ ClientPtr client;
+ TimeStamp activateTime;
+{
+ /* see xtest.c:ProcXTestFakeInput for code similar to this */
+
+ if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
+ {
+ return FALSE;
+ }
+ /* swap the request back so we can simply re-execute it */
+ if (client->swapped)
+ {
+ register int n;
+ REQUEST (xMbufDisplayImageBuffersReq);
+
+ SwapRestL(stuff);
+ swaps (&stuff->length, n);
+ swaps (&stuff->minDelay, n);
+ swaps (&stuff->maxDelay, n);
+ }
+ ResetCurrentRequest (client);
+ client->sequence--;
+ return TRUE;
+}
+
+
+/*
+ * Deliver events to a buffer
+ */
+
+static int
+DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
+ MultibufferPtr pMultibuffer;
+ xEvent *pEvents;
+ int count;
+ Mask filter;
+{
+ int deliveries = 0, nondeliveries = 0;
+ int attempt;
+ OtherClients *other;
+
+ /* if nobody wants the event, we're done */
+ if (!((pMultibuffer->otherEventMask|pMultibuffer->eventMask) & filter))
+ return 0;
+
+ /* maybe send event to owner */
+ if ((attempt = TryClientEvents(
+ bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
+ {
+ if (attempt > 0)
+ deliveries++;
+ else
+ nondeliveries--;
+ }
+
+ /* maybe send event to other clients */
+ for (other = pMultibuffer->otherClients; other; other=other->next)
+ {
+ if ((attempt = TryClientEvents(
+ rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
+ {
+ if (attempt > 0)
+ deliveries++;
+ else
+ nondeliveries--;
+ }
+ }
+ if (deliveries)
+ return deliveries;
+ return nondeliveries;
+}
+
+/*
+ * Send Expose events to interested clients
+ */
+
+void
+MultibufferExpose (pMultibuffer, pRegion)
+ MultibufferPtr pMultibuffer;
+ RegionPtr pRegion;
+{
+ if (pRegion && !REGION_NIL(pRegion))
+ {
+ xEvent *pEvent;
+ PixmapPtr pPixmap;
+ register xEvent *pe;
+ register BoxPtr pBox;
+ register int i;
+ int numRects;
+
+ pPixmap = pMultibuffer->pPixmap;
+ REGION_TRANSLATE(pPixmap->drawable.pScreen, pRegion,
+ -pPixmap->drawable.x, -pPixmap->drawable.y);
+ /* XXX MultibufferExpose "knows" the region representation */
+ numRects = REGION_NUM_RECTS(pRegion);
+ pBox = REGION_RECTS(pRegion);
+
+ pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent));
+ if (pEvent) {
+ pe = pEvent;
+
+ for (i=1; i<=numRects; i++, pe++, pBox++)
+ {
+ pe->u.u.type = Expose;
+ pe->u.expose.window = pPixmap->drawable.id;
+ pe->u.expose.x = pBox->x1;
+ pe->u.expose.y = pBox->y1;
+ pe->u.expose.width = pBox->x2 - pBox->x1;
+ pe->u.expose.height = pBox->y2 - pBox->y1;
+ pe->u.expose.count = (numRects - i);
+ }
+ (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
+ ExposureMask);
+ DEALLOCATE_LOCAL(pEvent);
+ }
+ }
+}
+
+/* send UpdateNotify event */
+void
+MultibufferUpdate (pMultibuffer, time2)
+ MultibufferPtr pMultibuffer;
+ CARD32 time2;
+{
+ xMbufUpdateNotifyEvent event;
+
+ event.type = MultibufferEventBase + MultibufferUpdateNotify;
+ event.buffer = pMultibuffer->pPixmap->drawable.id;
+ event.timeStamp = time2;
+ (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
+ 1, (Mask)MultibufferUpdateNotifyMask);
+}
+
+/*
+ * The sample implementation will never generate MultibufferClobberNotify
+ * events
+ */
+
+void
+MultibufferClobber (pMultibuffer)
+ MultibufferPtr pMultibuffer;
+{
+ xMbufClobberNotifyEvent event;
+
+ event.type = MultibufferEventBase + MultibufferClobberNotify;
+ event.buffer = pMultibuffer->pPixmap->drawable.id;
+ event.state = pMultibuffer->clobber;
+ (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
+ 1, (Mask)MultibufferClobberNotifyMask);
+}
+
+/*
+ * make the resource id for buffer i refer to the window
+ * drawable instead of the pixmap;
+ */
+
+static void
+AliasMultibuffer (pMultibuffers, i)
+ MultibuffersPtr pMultibuffers;
+ int i;
+{
+ MultibufferPtr pMultibuffer;
+
+ if (i == pMultibuffers->displayedMultibuffer)
+ return;
+ /*
+ * remove the old association
+ */
+ if (pMultibuffers->displayedMultibuffer >= 0)
+ {
+ pMultibuffer = &pMultibuffers->buffers[pMultibuffers->displayedMultibuffer];
+ ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
+ MultibufferDrawableResType,
+ (pointer) pMultibuffer->pPixmap);
+ }
+ /*
+ * make the new association
+ */
+ pMultibuffer = &pMultibuffers->buffers[i];
+ ChangeResourceValue (pMultibuffer->pPixmap->drawable.id,
+ MultibufferDrawableResType,
+ (pointer) pMultibuffers->pWindow);
+ pMultibuffers->displayedMultibuffer = i;
+}
+
+/*
+ * free everything associated with multibuffering for this
+ * window
+ */
+
+void
+DestroyImageBuffers (pWin)
+ WindowPtr pWin;
+{
+ FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE);
+ /* Zero out the window's pointer to the buffers so they won't be reused */
+ pWin->devPrivates[MultibufferWindowIndex].ptr = NULL;
+}
+
+/*
+ * resize the buffers when the window is resized
+ */
+
+static Bool
+MultibufferPositionWindow (pWin, x, y)
+ WindowPtr pWin;
+ int x, y;
+{
+ ScreenPtr pScreen;
+ MultibufferScreenPtr pMultibufferScreen;
+ MultibuffersPtr pMultibuffers;
+ MultibufferPtr pMultibuffer;
+ int width, height;
+ int i;
+ int dx, dy, dw, dh;
+ int sourcex, sourcey;
+ int destx, desty;
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+ int savewidth, saveheight;
+ xRectangle clearRect;
+ Bool clear;
+
+ pScreen = pWin->drawable.pScreen;
+ pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr;
+ (*pMultibufferScreen->PositionWindow) (pWin, x, y);
+
+ /* if this window is not multibuffered, we're done */
+ if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr))
+ return TRUE;
+
+ /* if new size is same as old, we're done */
+ if (pMultibuffers->width == pWin->drawable.width &&
+ pMultibuffers->height == pWin->drawable.height)
+ return TRUE;
+
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+ dx = pWin->drawable.x - pMultibuffers->x;
+ dy = pWin->drawable.x - pMultibuffers->y;
+ dw = width - pMultibuffers->width;
+ dh = height - pMultibuffers->height;
+ GravityTranslate (0, 0, -dx, -dy, dw, dh,
+ pWin->bitGravity, &destx, &desty);
+
+ /* if the window grew, remember to paint the window background,
+ * and maybe send expose events, for the new areas of the buffers
+ */
+ clear = pMultibuffers->width < width || pMultibuffers->height < height ||
+ pWin->bitGravity == ForgetGravity;
+
+ sourcex = 0;
+ sourcey = 0;
+ savewidth = pMultibuffers->width;
+ saveheight = pMultibuffers->height;
+ /* clip rectangle to source and destination */
+ if (destx < 0)
+ {
+ savewidth += destx;
+ sourcex -= destx;
+ destx = 0;
+ }
+ if (destx + savewidth > width)
+ savewidth = width - destx;
+ if (desty < 0)
+ {
+ saveheight += desty;
+ sourcey -= desty;
+ desty = 0;
+ }
+ if (desty + saveheight > height)
+ saveheight = height - desty;
+
+ pMultibuffers->width = width;
+ pMultibuffers->height = height;
+ pMultibuffers->x = pWin->drawable.x;
+ pMultibuffers->y = pWin->drawable.y;
+
+ pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+ if (clear)
+ {
+ SetupBackgroundPainter (pWin, pGC);
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = width;
+ clearRect.height = height;
+ }
+ for (i = 0; i < pMultibuffers->numMultibuffer; i++)
+ {
+ pMultibuffer = &pMultibuffers->buffers[i];
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pWin->drawable.depth);
+ if (!pPixmap)
+ {
+ DestroyImageBuffers (pWin);
+ break;
+ }
+ ValidateGC ((DrawablePtr)pPixmap, pGC);
+ /*
+ * I suppose this could avoid quite a bit of work if
+ * it computed the minimal area required.
+ */
+ if (clear)
+ (*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC, 1, &clearRect);
+ if (pWin->bitGravity != ForgetGravity)
+ {
+ (*pGC->ops->CopyArea) ((DrawablePtr)pMultibuffer->pPixmap,
+ (DrawablePtr)pPixmap, pGC,
+ sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
+ }
+ pPixmap->drawable.id = pMultibuffer->pPixmap->drawable.id;
+ (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap);
+ pMultibuffer->pPixmap = pPixmap;
+ if (i != pMultibuffers->displayedMultibuffer)
+ {
+ ChangeResourceValue (pPixmap->drawable.id,
+ MultibufferDrawableResType,
+ (pointer) pPixmap);
+ }
+ }
+ FreeScratchGC (pGC);
+ return TRUE;
+}
+
+/* Resource delete func for MultibufferDrawableResType */
+/*ARGSUSED*/
+static int
+MultibufferDrawableDelete (value, id)
+ pointer value;
+ XID id;
+{
+ DrawablePtr pDrawable = (DrawablePtr)value;
+ WindowPtr pWin;
+ MultibuffersPtr pMultibuffers;
+ PixmapPtr pPixmap;
+
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ pWin = (WindowPtr) pDrawable;
+ pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr;
+ pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap;
+ }
+ else
+ {
+ pPixmap = (PixmapPtr) pDrawable;
+ }
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
+ return Success;
+}
+
+/* Resource delete func for MultibufferResType */
+/*ARGSUSED*/
+static int
+MultibufferDelete (value, id)
+ pointer value;
+ XID id;
+{
+ MultibufferPtr pMultibuffer = (MultibufferPtr)value;
+ MultibuffersPtr pMultibuffers;
+
+ pMultibuffers = pMultibuffer->pMultibuffers;
+ if (--pMultibuffers->refcnt == 0)
+ {
+ FreeResourceByType (pMultibuffers->pWindow->drawable.id,
+ MultibuffersResType, TRUE);
+ xfree (pMultibuffers);
+ }
+ return Success;
+}
+
+/* Resource delete func for MultibuffersResType */
+/*ARGSUSED*/
+static int
+MultibuffersDelete (value, id)
+ pointer value;
+ XID id;
+{
+ MultibuffersPtr pMultibuffers = (MultibuffersPtr)value;
+ int i;
+
+ if (pMultibuffers->refcnt == pMultibuffers->numMultibuffer)
+ {
+ for (i = pMultibuffers->numMultibuffer; --i >= 0; )
+ FreeResource (pMultibuffers->buffers[i].pPixmap->drawable.id, 0);
+ }
+ return Success;
+}
+
+/* Resource delete func for OtherClientResType */
+static int
+OtherClientDelete (value, id)
+ pointer value;
+ XID id;
+{
+ MultibufferPtr pMultibuffer = (MultibufferPtr)value;
+ register OtherClientsPtr other, prev;
+
+ prev = 0;
+ for (other = pMultibuffer->otherClients; other; other = other->next)
+ {
+ if (other->resource == id)
+ {
+ if (prev)
+ prev->next = other->next;
+ else
+ pMultibuffer->otherClients = other->next;
+ xfree (other);
+ RecalculateMultibufferOtherEvents (pMultibuffer);
+ break;
+ }
+ prev = other;
+ }
+ return Success;
+}
+
+static int
+EventSelectForMultibuffer (pMultibuffer, client, mask)
+ MultibufferPtr pMultibuffer;
+ ClientPtr client;
+ Mask mask;
+{
+ OtherClientsPtr other;
+
+ if (mask & ~ValidEventMasks)
+ {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ if (bClient (pMultibuffer) == client)
+ {
+ pMultibuffer->eventMask = mask;
+ }
+ else /* some other client besides the creator wants events */
+ {
+ for (other = pMultibuffer->otherClients; other; other = other->next)
+ {
+ if (SameClient (other, client))
+ {
+ if (mask == 0)
+ {
+ FreeResource (other->resource, RT_NONE);
+ break;
+ }
+ other->mask = mask;
+ break;
+ }
+ }
+ if (!other)
+ { /* new client that never selected events on this buffer before */
+ other = (OtherClients *) xalloc (sizeof (OtherClients));
+ if (!other)
+ return BadAlloc;
+ other->mask = mask;
+ other->resource = FakeClientID (client->index);
+ if (!AddResource (other->resource, OtherClientResType, (pointer) pMultibuffer))
+ {
+ xfree (other);
+ return BadAlloc;
+ }
+ other->next = pMultibuffer->otherClients;
+ pMultibuffer->otherClients = other;
+ }
+ RecalculateMultibufferOtherEvents (pMultibuffer);
+ }
+ return (client->noClientException);
+}
+
+/* or together all the otherClients event masks */
+static void
+RecalculateMultibufferOtherEvents (pMultibuffer)
+ MultibufferPtr pMultibuffer;
+{
+ Mask otherEventMask;
+ OtherClients *other;
+
+ otherEventMask = 0L;
+ for (other = pMultibuffer->otherClients; other; other = other->next)
+ otherEventMask |= other->mask;
+ pMultibuffer->otherEventMask = otherEventMask;
+}
+
+/* add milliseconds to a timestamp, handling overflow */
+static void
+BumpTimeStamp (ts, inc)
+TimeStamp *ts;
+CARD32 inc;
+{
+ CARD32 newms;
+
+ newms = ts->milliseconds + inc;
+ if (newms < ts->milliseconds)
+ ts->months++;
+ ts->milliseconds = newms;
+}
diff --git a/xc/programs/Xserver/Xext/mbufbf.c b/xc/programs/Xserver/Xext/mbufbf.c
new file mode 100644
index 000000000..35a150c2d
--- /dev/null
+++ b/xc/programs/Xserver/Xext/mbufbf.c
@@ -0,0 +1,1051 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.1 1998/10/04 09:36:45 dawes Exp $ */
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/* $TOG: mbufbf.c /main/6 1998/02/09 15:24:17 kaleb $ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "inputstr.h"
+#include "validate.h"
+#ifndef MINIX
+#include <sys/time.h>
+#endif
+
+#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
+#define _MULTIBUF_BUFFER_
+#include "multibufst.h"
+
+/*
+Support for doublebuffer hardare
+
+This code is designed to support doublebuffer hardware where the
+displayed buffer is selected on a per-pixel basis by an additional bit
+plane, called the select plane. It could probably be easily modified
+to work with systems that use window-id planes.
+
+This is done by creating a new drawable type, DRAWABLE_BUFFER. The
+type has the same exact layout as a window drawable. Your code should
+treat a DRAWABLE_BUFFER the same as it would tread a DRAWABLE_WINDOW
+when handling the gc drawing functions. In addition, PaintWindowBackground,
+CopyWindow, and all of the gc drawing functions to be able to draw into both
+framebuffers. Which framebuffer to draw into is selected by the contents of
+ pWin->devPrivates[frameWindowPrivateIndex].
+The content of the devPrivate is either from frameBuffer[0] or
+frameBuffer[1], depending on which buffer is being drawn into. When
+ pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[0],
+the functions should draw into the front framebuffer. When
+ pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[1],
+the functions should draw into the back framebuffer.
+
+In addition, you need to provide a function that allows you to copy
+bits between the buffers (optional since CopyArea can be used) and a
+function that draws into the select plane. Then, you need to register
+your functions and other information, by calling:
+
+void
+RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
+ CopyBufferBitsFunc, DrawSelectPlaneFunc)
+ int nInfo;
+ xMbufBufferInfo *pInfo;
+ DevUnion *frameBuffer;
+ DevUnion selectPlane;
+
+"pInfo" is an array indicating which visuals and depths that double
+buffering is supported on. "nInfo" is the length of the array.
+
+"frameBuffer" is array of length 2. The contents of the array element
+is ddx-specific. The content of frameBuffer[0] should, when placed in
+the window private, indicate that framebuffer 0 should be drawn into.
+The contents of frameBuffer[1], when placed into the window private,
+should indicate that framebuffer 1 should be drawn into.
+
+"selectPlane" is ddx-specific. It should contain information
+neccessary for your displayProc to access the select plane.
+It is passed to DrawSelectPlaneFunc.
+
+"CopyBufferBitsFunc" is a ddx-specific function that copies from one
+buffer of a multibuffered window to another buffer. If the CopyBufferBitsFunc
+is NULL, a default function will be used that calls pScreen->CopyArea.
+
+ void CopyBufferBitsFunc(pMBWindow, srcBufferNum, dstBufferNum)
+ mbufWindowPtr pMBWindow;
+ int srcBufferNum, dstBufferNum;
+
+"DrawSelectPlaneFunc" is a ddx-specific function that fills the
+regions "prgn" of select plane with the value "bufferNum". If
+selectPlane is a DrawablePtr (such as a PixmapPtr), you can pass
+NULL for DrawSelectPlaneFunc, a default function will be used that
+calls FillRectangle on the selectPlane.
+
+ void DrawSelectPlaneFunc(pScreen, selectPlane, prgn, bufferNum)
+ ScreenPtr pScreen;
+ DevUnion selectPlane;
+ RegionPtr prgn;
+ long bufferNum;
+
+...
+...
+...
+
+*/
+
+#define MAX_BUFFERS 2 /* Only supports 2 buffers */
+#define FRONT_BUFFER 0
+#define BACK_BUFFER 1
+
+
+/* Buffer drawables have the same structure as window drawables */
+typedef WindowRec BufferRec;
+typedef WindowPtr BufferPtr;
+
+
+/*
+ * Call RegisterHdwrBuffer for every screen that has doublebuffer hardware.
+ */
+
+static int bufNumInfo[MAXSCREENS];
+static xMbufBufferInfo *bufInfo[MAXSCREENS];
+static DevUnion *bufFrameBuffer[MAXSCREENS];
+static DevUnion bufselectPlane[MAXSCREENS];
+static void (* bufCopyBufferBitsFunc[MAXSCREENS])();
+static void (* bufDrawSelectPlaneFunc[MAXSCREENS])();
+
+static Bool bufMultibufferInit();
+
+
+void
+RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane,
+ CopyBufferBitsFunc, DrawSelectPlaneFunc)
+ ScreenPtr pScreen;
+ int nInfo;
+ xMbufBufferInfo *pInfo;
+ DevUnion *frameBuffer;
+ DevUnion selectPlane;
+ void (* CopyBufferBitsFunc)();
+ void (* DrawSelectPlaneFunc)();
+{
+ bufNumInfo[pScreen->myNum] = nInfo;
+ bufInfo[pScreen->myNum] = pInfo;
+ bufFrameBuffer[pScreen->myNum] = frameBuffer;
+ bufselectPlane[pScreen->myNum] = selectPlane;
+
+ bufCopyBufferBitsFunc[pScreen->myNum] = CopyBufferBitsFunc;
+ bufDrawSelectPlaneFunc[pScreen->myNum] = DrawSelectPlaneFunc;
+
+ /* Register ourselves with device-independent multibuffers code */
+ RegisterMultibufferInit(pScreen, bufMultibufferInit);
+}
+
+
+/*
+ * Called by Multibuffer extension initialization.
+ * Initializes mbufScreenRec and its devPrivate.
+ */
+
+static Bool NoopDDA_True() { return TRUE; }
+static Bool bufPositionWindow();
+static int bufCreateImageBuffers();
+static void bufDestroyImageBuffers();
+static void bufDisplayImageBuffers();
+static void bufClearImageBufferArea();
+static void bufDestroyBuffer();
+static void bufCopyBufferBits();
+static void bufDrawSelectPlane();
+static void bufWrapScreenFuncs();
+static void bufResetProc();
+
+static void bufPostValidateTree();
+static void bufClipNotify();
+static void bufWindowExposures();
+static Bool bufChangeWindowAttributes();
+static void bufClearToBackground();
+static void bufCopyWindow();
+
+extern WindowPtr *WindowTable;
+
+static Bool
+bufMultibufferInit(pScreen, pMBScreen)
+ ScreenPtr pScreen;
+ mbufScreenPtr pMBScreen;
+{
+ mbufBufferPrivPtr pMBPriv;
+ BoxRec box;
+
+ /* Multibuffer info */
+ pMBScreen->nInfo = bufNumInfo[pScreen->myNum];
+ pMBScreen->pInfo = bufInfo[pScreen->myNum];
+
+ /* Hooks */
+ pMBScreen->CreateImageBuffers = bufCreateImageBuffers;
+ pMBScreen->DestroyImageBuffers = bufDestroyImageBuffers;
+ pMBScreen->DisplayImageBuffers = bufDisplayImageBuffers;
+ pMBScreen->ClearImageBufferArea = bufClearImageBufferArea;
+ pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
+ pMBScreen->ChangeBufferAttributes = NoopDDA_True;
+ pMBScreen->DeleteBufferDrawable = bufDestroyBuffer;
+ pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs;
+ pMBScreen->ResetProc = bufResetProc;
+ /* Create devPrivate part */
+ pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv);
+ if (!pMBPriv)
+ return (FALSE);
+
+ pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
+ pMBPriv->frameBuffer = bufFrameBuffer[pScreen->myNum];
+ pMBPriv->selectPlane = bufselectPlane[pScreen->myNum];
+
+ /*
+ * Initializing the subtractRgn to the screen area will ensure that
+ * the selectPlane will get cleared on the first PostValidateTree.
+ */
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+
+ pMBPriv->rgnChanged = TRUE;
+ REGION_INIT(pScreen, &pMBPriv->backBuffer, &box, 1);
+ REGION_INIT(pScreen, &pMBPriv->subtractRgn, &box, 1);
+ REGION_INIT(pScreen, &pMBPriv->unionRgn, NullBox, 0);
+
+ /* Misc functions */
+ pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum];
+ pMBPriv->DrawSelectPlane = bufDrawSelectPlaneFunc[pScreen->myNum];
+
+ if (!pMBPriv->CopyBufferBits)
+ pMBPriv->CopyBufferBits = bufCopyBufferBits;
+
+ if (!pMBPriv->DrawSelectPlane)
+ pMBPriv->DrawSelectPlane = bufDrawSelectPlane;
+
+ /* screen functions */
+ pMBPriv->funcsWrapped = 0;
+ pMBPriv->inClearToBackground = FALSE;
+ pMBPriv->WindowExposures = NULL;
+ pMBPriv->CopyWindow = NULL;
+ pMBPriv->ClearToBackground = NULL;
+ pMBPriv->ClipNotify = NULL;
+ pMBPriv->ChangeWindowAttributes = NULL;
+
+ /* Start out wrapped to clear select plane */
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
+ return TRUE;
+}
+
+static void
+UpdateBufferFromWindow(pBuffer, pWin)
+ BufferPtr pBuffer;
+ WindowPtr pWin;
+{
+ pBuffer->drawable.x = pWin->drawable.x;
+ pBuffer->drawable.y = pWin->drawable.y;
+ pBuffer->drawable.width = pWin->drawable.width;
+ pBuffer->drawable.height = pWin->drawable.height;
+
+ pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ /* Update for PaintWindowBackground */
+ pBuffer->parent = pWin->parent;
+
+ /*
+ * Make the borderClip the same as the clipList so
+ * NotClippedByChildren comes out with just clipList.
+ */
+
+ pBuffer->clipList = pWin->clipList;
+ pBuffer->borderClip = pWin->clipList;
+ pBuffer->winSize = pWin->winSize;
+ pBuffer->borderSize = pWin->borderSize;
+
+ pBuffer->origin = pWin->origin;
+}
+
+static BufferPtr
+bufCreateBuffer(pScreen, pWin, bufferNum)
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ int bufferNum;
+{
+ mbufBufferPrivPtr pMBPriv;
+ DevUnion *devPrivates;
+ BufferPtr pBuffer;
+ int i;
+
+ pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ pBuffer = AllocateWindow(pWin->drawable.pScreen);
+ if (!pBuffer)
+ return (NULL);
+
+ /* XXX- Until we know what is needed, copy everything. */
+ devPrivates = pBuffer->devPrivates;
+ *pBuffer = *pWin;
+ pBuffer->devPrivates = devPrivates;
+
+ pBuffer->drawable.type = DRAWABLE_BUFFER;
+ pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pBuffer->nextSib = NULL;
+ pBuffer->prevSib = NULL;
+ pBuffer->firstChild = NULL;
+ pBuffer->lastChild = NULL;
+
+ /* XXX - Worry about backingstore later */
+ pBuffer->backStorage = NULL;
+ pBuffer->backingStore = NotUseful;
+
+ /* XXX - Need to call pScreen->CreateWindow for tile/stipples
+ * or should I just copy the devPrivates?
+ */
+
+ for (i=0; i < pScreen->WindowPrivateLen; i++)
+ pBuffer->devPrivates[i] = pWin->devPrivates[i];
+
+ pBuffer->devPrivates[frameWindowPrivateIndex] =
+ pMBPriv->frameBuffer[bufferNum];
+
+ return pBuffer;
+}
+
+static void
+bufDestroyBuffer(pDrawable)
+ DrawablePtr pDrawable;
+{
+ xfree(pDrawable);
+}
+
+/*ARGSUSED*/
+static int
+bufCreateImageBuffers (pWin, nbuf, ids, action, hint)
+ WindowPtr pWin;
+ int nbuf;
+ XID *ids;
+ int action;
+ int hint;
+{
+ ScreenPtr pScreen;
+ mbufScreenPtr pMBScreen;
+ mbufWindowPtr pMBWindow;
+ mbufBufferPtr pMBBuffer;
+ int i;
+
+ pScreen = pWin->drawable.pScreen;
+ pMBScreen = MB_SCREEN_PRIV(pScreen);
+ pMBWindow = MB_WINDOW_PRIV(pWin);
+
+ pMBWindow->devPrivate.ptr = (pointer) REGION_CREATE(pScreen, 0,0);
+ if (!pMBWindow->devPrivate.ptr)
+ return(0);
+ REGION_COPY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr,
+ &pWin->clipList);
+
+ for (i = 0; i < nbuf; i++)
+ {
+ pMBBuffer = pMBWindow->buffers + i;
+ pMBBuffer->pDrawable = (DrawablePtr) bufCreateBuffer(pScreen,pWin,i);
+
+ if (!pMBBuffer->pDrawable)
+ break;
+
+ if (!AddResource (ids[i], MultibufferDrawableResType,
+ (pointer) pMBBuffer->pDrawable))
+ {
+ bufDestroyBuffer((BufferPtr) pMBBuffer->pDrawable);
+ break;
+ }
+ pMBBuffer->pDrawable->id = ids[i];
+
+ /*
+ * If window is already mapped, generate exposures and
+ * clear the area of the newly buffers.
+ */
+
+ if ((pWin->realized) && (i != pMBWindow->displayedMultibuffer))
+ (* pMBScreen->ClearImageBufferArea)(pMBBuffer, 0,0, 0,0, TRUE);
+ }
+
+ return i;
+}
+
+static void
+bufDestroyImageBuffers(pWin)
+ WindowPtr pWin;
+{
+ ScreenPtr pScreen;
+ mbufWindowPtr pMBWindow;
+
+ pScreen = pWin->drawable.pScreen;
+
+ if (pMBWindow = MB_WINDOW_PRIV(pWin))
+ {
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ /*
+ * if the backbuffer is currently being displayed, move the bits
+ * to the frontbuffer and display it instead.
+ */
+
+ if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER))
+ {
+ (* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER);
+ REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer,
+ &pMBPriv->backBuffer, &pWin->clipList);
+ (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
+ &pWin->clipList, FRONT_BUFFER);
+ }
+
+ /* Switch window rendering to front buffer */
+ pWin->devPrivates[frameWindowPrivateIndex] =
+ pMBPriv->frameBuffer[FRONT_BUFFER];
+
+ REGION_DESTROY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr);
+ pMBWindow->devPrivate.ptr = NULL;
+ }
+}
+
+/*
+ * Can be replaced by pScreen->ClearToBackground if pBuffer->eventMask
+ * and wOtherEventsMasks(pBuffer) were setup.
+ */
+
+static void
+bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures)
+ mbufBufferPtr pMBBuffer;
+ short x,y;
+ unsigned short w,h;
+ Bool generateExposures;
+{
+ BoxRec box;
+ RegionRec reg;
+ RegionPtr pBSReg = NullRegion;
+ ScreenPtr pScreen;
+ BoxPtr extents;
+ int x1, y1, x2, y2;
+ BufferPtr pBuffer;
+
+ pBuffer = (BufferPtr) pMBBuffer->pDrawable;
+ /* compute everything using ints to avoid overflow */
+
+ x1 = pBuffer->drawable.x + x;
+ y1 = pBuffer->drawable.y + y;
+ if (w)
+ x2 = x1 + (int) w;
+ else
+ x2 = x1 + (int) pBuffer->drawable.width - (int) x;
+ if (h)
+ y2 = y1 + h;
+ else
+ y2 = y1 + (int) pBuffer->drawable.height - (int) y;
+
+ extents = &pBuffer->clipList.extents;
+
+ /* clip the resulting rectangle to the window clipList extents. This
+ * makes sure that the result will fit in a box, given that the
+ * screen is < 32768 on a side.
+ */
+
+ if (x1 < extents->x1)
+ x1 = extents->x1;
+ if (x2 > extents->x2)
+ x2 = extents->x2;
+ if (y1 < extents->y1)
+ y1 = extents->y1;
+ if (y2 > extents->y2)
+ y2 = extents->y2;
+
+ if (x2 <= x1 || y2 <= y1)
+ {
+ x2 = x1 = 0;
+ y2 = y1 = 0;
+ }
+
+ box.x1 = x1;
+ box.x2 = x2;
+ box.y1 = y1;
+ box.y2 = y2;
+
+ pScreen = pBuffer->drawable.pScreen;
+ REGION_INIT(pScreen, &reg, &box, 1);
+ if (pBuffer->backStorage)
+ {
+ /*
+ * If the window has backing-store on, call through the
+ * ClearToBackground vector to handle the special semantics
+ * (i.e. things backing store is to be cleared out and
+ * an Expose event is to be generated for those areas in backing
+ * store if generateExposures is TRUE).
+ */
+ pBSReg = (* pScreen->ClearBackingStore)(pBuffer, x, y, w, h,
+ generateExposures);
+ }
+
+ REGION_INTERSECT(pScreen, &reg, &reg, &pBuffer->clipList);
+ if (pBuffer->backgroundState != None)
+ (*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
+ if (generateExposures)
+ MultibufferExpose(pMBBuffer, &reg);
+#ifdef _notdef
+ /* XXBS - This is the original miClearToBackground code.
+ * WindowExposures needs to be called (or the functionality emulated)
+ * in order for backingStore to work, but first, pBuffer->eventMask
+ * and wOtherEventsMasks(pBuffer) need to be setup correctly.
+ */
+
+ if (generateExposures)
+ (*pScreen->WindowExposures)(pBuffer, &reg, pBSReg);
+ else if (pBuffer->backgroundState != None)
+ (*pScreen->PaintWindowBackground)(pBuffer, &reg, PW_BACKGROUND);
+#endif
+ REGION_UNINIT(pScreen, &reg);
+ if (pBSReg)
+ REGION_DESTROY(pScreen, pBSReg);
+}
+
+static void
+bufWrapScreenFuncs(pScreen)
+ ScreenPtr pScreen;
+{
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree);
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClipNotify, bufClipNotify);
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,WindowExposures,bufWindowExposures);
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,ChangeWindowAttributes, bufChangeWindowAttributes);
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClearToBackground,bufClearToBackground);
+ WRAP_SCREEN_FUNC(pScreen,pMBPriv,CopyWindow,bufCopyWindow);
+}
+
+static void
+bufResetProc(pScreen)
+ ScreenPtr pScreen;
+{
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ /*
+ * frameBuffer, selectPlane, and pInfo should be freed by
+ * whoever called RegisterDoubleBufferHardware
+ */
+
+ REGION_UNINIT(pScreen, &pMBPriv->backBuffer);
+ REGION_UNINIT(pScreen, &pMBPriv->subtractRgn);
+ REGION_UNINIT(pScreen, &pMBPriv->unionRgn);
+ xfree(pMBPriv);
+}
+
+/*---------------------------------------------------------------------------*/
+
+/*
+ * Used if CopyBufferBitsFunc is not provided when registering.
+ * This should work for everybody since CopyArea needs to support
+ * copying between buffers anyway.
+ */
+
+static void
+bufCopyBufferBits(pMBWindow, srcBufferNum, dstBufferNum)
+ mbufWindowPtr pMBWindow;
+ int srcBufferNum, dstBufferNum;
+{
+ DrawablePtr pSrcBuffer, pDstBuffer;
+ GCPtr pGC;
+
+ pSrcBuffer = pMBWindow->buffers[srcBufferNum].pDrawable;
+ pDstBuffer = pMBWindow->buffers[dstBufferNum].pDrawable;
+
+ pGC = GetScratchGC (pDstBuffer->depth, pDstBuffer->pScreen);
+ if (!pGC)
+ return;
+
+ ValidateGC (pDstBuffer, pGC);
+ (* pGC->ops->CopyArea) (pSrcBuffer, pDstBuffer, pGC,
+ 0,0, pDstBuffer->width, pDstBuffer->height, 0,0);
+ FreeScratchGC (pGC);
+}
+
+/*
+ * Used if DrawSelectPlanFunc is not provided for when registering.
+ * However, it only works if selectPlane.ptr is a drawable. Also
+ * assumes that painting with color 0 selects the front buffer,
+ * while color 1 selects the back buffer.
+ */
+
+static void
+bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
+ ScreenPtr pScreen;
+ DevUnion selectPlane;
+ RegionPtr prgn;
+ long bufferNum;
+{
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ register int i;
+ register BoxPtr pbox;
+ register xRectangle *prect;
+ int numRects;
+ XID value;
+
+ if (REGION_NUM_RECTS(prgn) == 0)
+ return;
+
+ pDrawable = (DrawablePtr) selectPlane.ptr;
+ pGC = GetScratchGC (pDrawable->depth, pScreen);
+ if (!pGC)
+ return;
+
+ prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
+ sizeof(xRectangle));
+ if (!prect)
+ {
+ FreeScratchGC(pGC);
+ return;
+ }
+
+ value = (XID) bufferNum;
+ DoChangeGC(pGC, GCForeground, &value, 0);
+ ValidateGC(pDrawable, pGC);
+
+ numRects = REGION_NUM_RECTS(prgn);
+ pbox = REGION_RECTS(prgn);
+ for (i= numRects; --i >= 0; pbox++, prect++)
+ {
+ prect->x = pbox->x1;
+ prect->y = pbox->y1;
+ prect->width = pbox->x2 - pbox->x1;
+ prect->height = pbox->y2 - pbox->y1;
+ }
+ prect -= numRects;
+ (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
+
+ DEALLOCATE_LOCAL(prect);
+ FreeScratchGC (pGC);
+}
+
+
+static void
+bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
+ ScreenPtr pScreen;
+ mbufBufferPtr *ppMBBuffer;
+ mbufWindowPtr *ppMBWindow;
+ int nbuf;
+{
+ WindowPtr pWin;
+ BufferPtr pPrevBuffer, pNewBuffer;
+ int i, number;
+ mbufBufferPrivPtr pMBPriv;
+ mbufBufferPtr pPrevMBBuffer;
+
+ pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ for (i = 0; i < nbuf; i++)
+ {
+ number = ppMBBuffer[i]->number; /* 0=frontbuffer, 1=backbuffer */
+ pWin = ppMBWindow[i]->pWindow;
+ pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
+
+ pPrevBuffer = (BufferPtr) pPrevMBBuffer->pDrawable;
+ pNewBuffer = (BufferPtr) ppMBBuffer[i]->pDrawable;
+
+ if (pPrevBuffer != pNewBuffer)
+ {
+ RegionPtr backBuffer = &pMBPriv->backBuffer;
+
+ /*
+ * Update the select plane and the backBuffer region.
+ */
+
+ (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
+ &pWin->clipList, number);
+
+ if (number == BACK_BUFFER)
+ REGION_UNION(pScreen, backBuffer, backBuffer,
+ &pWin->clipList);
+ else
+ REGION_SUBTRACT(pScreen, backBuffer, backBuffer,
+ &pWin->clipList);
+
+ /* Switch which framebuffer the window draws into */
+ pWin->devPrivates[frameWindowPrivateIndex] =
+ pMBPriv->frameBuffer[number];
+ }
+
+ switch (ppMBWindow[i]->updateAction)
+ {
+ case MultibufferUpdateActionUndefined:
+ break;
+ case MultibufferUpdateActionBackground:
+ (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
+ (pPrevMBBuffer, 0,0, 0,0, FALSE);
+ break;
+ case MultibufferUpdateActionUntouched:
+ break;
+ case MultibufferUpdateActionCopied:
+ if (pPrevBuffer != pNewBuffer)
+ {
+ (* pMBPriv->CopyBufferBits) (ppMBWindow[i],
+ ppMBBuffer[i]->number, pPrevMBBuffer->number);
+ }
+ break;
+ }
+ }
+}
+
+/* Updates the backBuffer region and paints the selectPlane. */
+
+static void
+bufPostValidateTree(pParent, pChild, kind)
+ WindowPtr pParent, pChild;
+ VTKind kind;
+{
+ ScreenPtr pScreen;
+ mbufBufferPrivPtr pMBPriv;
+
+ if (pParent)
+ pScreen = pParent->drawable.pScreen;
+ else if (pChild)
+ pScreen = pChild->drawable.pScreen;
+ else
+ return; /* Hopeless */
+
+ pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
+ if (pScreen->PostValidateTree)
+ (* pScreen->PostValidateTree)(pParent, pChild, kind);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree);
+
+ /* Does backBuffer need to change? */
+ if (pMBPriv->rgnChanged)
+ {
+ RegionRec exposed;
+ RegionPtr pSubtractRgn, pUnionRgn;
+ Bool overlap;
+
+ pMBPriv->rgnChanged = FALSE;
+
+ pSubtractRgn = &pMBPriv->subtractRgn;
+ pUnionRgn = &pMBPriv->unionRgn;
+ REGION_VALIDATE(pScreen, pSubtractRgn, &overlap);
+#ifdef DEBUG
+ if (overlap)
+ FatalError("bufPostValidateTree: subtractRgn overlaps");
+#endif
+ REGION_VALIDATE(pScreen, pUnionRgn, &overlap);
+#ifdef DEBUG
+ if (overlap)
+ FatalError("bufPostValidateTree: unionRgn overlaps");
+#endif
+
+ /* Update backBuffer: subtract must come before union */
+ REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
+ pSubtractRgn);
+ REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer,
+ pUnionRgn);
+
+ /* Paint gained and lost backbuffer areas in select plane */
+ REGION_INIT(pScreen, &exposed, NullBox, 0);
+ REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn);
+ (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
+ &exposed, FRONT_BUFFER);
+
+ REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn);
+ (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane,
+ &exposed, BACK_BUFFER);
+
+ REGION_UNINIT(pScreen, &exposed);
+ REGION_EMPTY(pScreen, pSubtractRgn);
+ REGION_EMPTY(pScreen, pUnionRgn);
+ }
+}
+
+/* XXX - Knows region internals. */
+
+static Bool
+RegionsEqual(reg1, reg2)
+ RegionPtr reg1;
+ RegionPtr reg2;
+{
+ int i;
+ BoxPtr rects1, rects2;
+
+ if (reg1->extents.x1 != reg2->extents.x1) return FALSE;
+ if (reg1->extents.x2 != reg2->extents.x2) return FALSE;
+ if (reg1->extents.y1 != reg2->extents.y1) return FALSE;
+ if (reg1->extents.y2 != reg2->extents.y2) return FALSE;
+ if (REGION_NUM_RECTS(reg1) != REGION_NUM_RECTS(reg2)) return FALSE;
+
+ rects1 = REGION_RECTS(reg1);
+ rects2 = REGION_RECTS(reg2);
+ for (i = 0; i != REGION_NUM_RECTS(reg1); i++) {
+ if (rects1[i].x1 != rects2[i].x1) return FALSE;
+ if (rects1[i].x2 != rects2[i].x2) return FALSE;
+ if (rects1[i].y1 != rects2[i].y1) return FALSE;
+ if (rects1[i].y2 != rects2[i].y2) return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * If the window is multibuffered and displaying the backbuffer,
+ * add the old clipList to the subtractRgn and add the new clipList
+ * to the unionRgn. PostValidateTree will use subtractRgn and unionRgn
+ * to update the backBuffer region and the selectPlane.
+ *
+ * Copy changes to the window structure into the buffers.
+ * Send ClobberNotify events.
+ */
+
+static void
+bufClipNotify(pWin, dx,dy)
+ WindowPtr pWin;
+ int dx,dy;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+ mbufWindowPtr pMBWindow;
+ int i;
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
+ if (pScreen->ClipNotify)
+ (* pScreen->ClipNotify)(pWin, dx,dy);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify);
+
+ if (pMBWindow = MB_WINDOW_PRIV(pWin))
+ {
+ RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr;
+
+ if (! RegionsEqual(pOldClipList, &pWin->clipList))
+ {
+ if (pMBWindow->displayedMultibuffer == BACK_BUFFER)
+ {
+ pMBPriv->rgnChanged = TRUE;
+ REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList);
+ REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList);
+ }
+
+ REGION_COPY(pScreen, pOldClipList,&pWin->clipList);
+ }
+
+ /* Update buffer x,y,w,h, and clipList */
+ for (i=0; i<pMBWindow->numMultibuffer; i++)
+ {
+ mbufBufferPtr pMBBuffer = pMBWindow->buffers + i;
+ if (pMBBuffer->clobber != pWin->visibility)
+ {
+ pMBBuffer->clobber = pWin->visibility;
+ MultibufferClobber(pMBBuffer);
+ }
+ UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin);
+ }
+ }
+}
+
+/*
+ * Updates buffer's background fields when the window's changes.
+ * This is necessary because pScreen->PaintWindowBackground
+ * is used to paint the buffer.
+ *
+ * XXBS - Backingstore state will have be tracked too if it is supported.
+ */
+
+static Bool
+bufChangeWindowAttributes(pWin, mask)
+ WindowPtr pWin;
+ unsigned long mask;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+ mbufWindowPtr pMBWindow;
+ Bool ret;
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
+ ret = (* pScreen->ChangeWindowAttributes)(pWin, mask);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes);
+
+ if (pMBWindow = MB_WINDOW_PRIV(pWin))
+ {
+ if (mask & (CWBackPixmap | CWBackPixel))
+ {
+ BufferPtr pBuffer;
+ int i;
+
+ for (i=0; i<pMBWindow->displayedMultibuffer; i++)
+ {
+ pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable;
+ pBuffer->backgroundState = pWin->backgroundState;
+ pBuffer->background = pWin->background;
+ }
+ }
+ }
+ return ret;
+}
+
+/*
+ * Send exposures and clear the background for a buffer whenever
+ * its corresponding window is exposed, except when called by
+ * ClearToBackground.
+ */
+
+static void
+bufWindowExposures(pWin, prgn, other_exposed)
+ WindowPtr pWin;
+ register RegionPtr prgn, other_exposed;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin);
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+ RegionRec tmp_rgn;
+ int i;
+ Bool handleBuffers;
+
+ handleBuffers = (!pMBPriv->inClearToBackground) &&
+ (pWin->drawable.type == DRAWABLE_WINDOW) &&
+ pMBWindow && (prgn && !REGION_NIL(prgn));
+
+ /* miWindowExposures munges prgn and other_exposed. */
+ if (handleBuffers)
+ {
+ REGION_INIT(pScreen, &tmp_rgn, NullBox, 0);
+ REGION_COPY(pScreen, &tmp_rgn,prgn);
+ }
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
+ (* pScreen->WindowExposures) (pWin, prgn, other_exposed);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures);
+
+ if (!handleBuffers)
+ return;
+
+ /*
+ * Send expose events to all clients. Paint the exposed region for all
+ * buffers except the displayed buffer since it is handled when the
+ * window is painted.
+ *
+ * XXBS - Will have to be re-written to handle BackingStore on buffers.
+ */
+
+ for (i=0; i<pMBWindow->numMultibuffer; i++)
+ {
+ mbufBufferPtr pMBBuffer;
+ BufferPtr pBuffer;
+
+ pMBBuffer = pMBWindow->buffers + i;
+ pBuffer = (BufferPtr) pMBBuffer->pDrawable;
+
+ if (i != pMBWindow->displayedMultibuffer)
+ (* pScreen->PaintWindowBackground)(pBuffer,&tmp_rgn,PW_BACKGROUND);
+ if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask)
+ MultibufferExpose(pMBBuffer, &tmp_rgn);
+ }
+
+ REGION_UNINIT(pScreen, &tmp_rgn);
+}
+
+/*
+ * Set ``inClearToBackground'' so that WindowExposures does not attempt
+ * to send expose events or clear the background on the buffers.
+ */
+
+static void
+bufClearToBackground(pWin, x,y,w,h, sendExpose)
+ WindowPtr pWin;
+ int x,y, w,h;
+ Bool sendExpose;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+
+ pMBPriv->inClearToBackground = TRUE;
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
+ (* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground);
+
+ pMBPriv->inClearToBackground = FALSE;
+}
+
+/*
+ * Move bits in both buffers. It does this by calling pScreen->CopyWindow
+ * twice, once with the root window's devPrivate[frameWindowPrivateIndex]
+ * pointing to the frontbuffer pixmap and once with it pointed to the
+ * backbuffer pixmap. It does this if there are *any* existing multibuffered
+ * window... a possible optimization is to copy the backbuffer only if this
+ * window or its inferiors are multibuffered. May be faster, maybe not.
+ *
+ * XXX - Only works if your CopyWindow checks the root window's devPrivate
+ * to see which buffer to draw into. Works for cfbPaintWindow.
+ */
+
+/*ARGSUSED*/
+static void
+bufCopyWindow(pWin, ptOldOrg, prgnSrc)
+ WindowPtr pWin;
+ DDXPointRec ptOldOrg;
+ RegionPtr prgnSrc;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen);
+ WindowPtr pwinroot;
+ DevUnion save;
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
+
+ pwinroot = WindowTable[pScreen->myNum];
+ save = pwinroot->devPrivates[frameWindowPrivateIndex];
+
+ /*
+ * Copy front buffer
+ */
+
+ pwinroot->devPrivates[frameWindowPrivateIndex] =
+ pMBPriv->frameBuffer[FRONT_BUFFER];
+ (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+
+ /*
+ * Copy back buffer
+ */
+
+ /* CopyWindow translates prgnSrc... translate it back for 2nd call. */
+ REGION_TRANSLATE(pScreen, prgnSrc,
+ ptOldOrg.x - pWin->drawable.x,
+ ptOldOrg.y - pWin->drawable.y);
+ pwinroot->devPrivates[frameWindowPrivateIndex] =
+ pMBPriv->frameBuffer[BACK_BUFFER];
+ (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+
+ pwinroot->devPrivates[frameWindowPrivateIndex] = save;
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow);
+}
diff --git a/xc/programs/Xserver/Xext/mbufpx.c b/xc/programs/Xserver/Xext/mbufpx.c
new file mode 100644
index 000000000..37516b94e
--- /dev/null
+++ b/xc/programs/Xserver/Xext/mbufpx.c
@@ -0,0 +1,645 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.1 1998/10/04 09:36:46 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: mbufpx.c /main/6 1998/02/09 15:24:22 kaleb $ */
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "inputstr.h"
+#ifndef MINIX
+#include <sys/time.h>
+#endif
+
+#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
+#define _MULTIBUF_PIXMAP_
+#include "multibufst.h"
+
+
+static Bool NoopDDA_True() { return TRUE; }
+
+static Bool pixPositionWindow();
+static int pixCreateImageBuffers();
+static void pixDisplayImageBuffers();
+static void pixClearImageBufferArea();
+static void pixDeleteBufferDrawable();
+static void pixWrapScreenFuncs();
+static void pixResetProc();
+
+Bool
+pixMultibufferInit(pScreen, pMBScreen)
+ ScreenPtr pScreen;
+ mbufScreenPtr pMBScreen;
+{
+ int i, j, k;
+ xMbufBufferInfo *pInfo;
+ int nInfo;
+ DepthPtr pDepth;
+ mbufPixmapPrivPtr pMBPriv;
+
+ pMBScreen->CreateImageBuffers = pixCreateImageBuffers;
+ pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA;
+ pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers;
+ pMBScreen->ClearImageBufferArea = pixClearImageBufferArea;
+ pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
+ pMBScreen->ChangeBufferAttributes = NoopDDA_True;
+ pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable;
+ pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs;
+ pMBScreen->ResetProc = pixResetProc;
+
+ /* Support every depth and visual combination that the screen does */
+
+ nInfo = 0;
+ for (i = 0; i < pScreen->numDepths; i++)
+ {
+ pDepth = &pScreen->allowedDepths[i];
+ nInfo += pDepth->numVids;
+ }
+
+ pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo));
+ if (!pInfo)
+ return FALSE;
+
+ k = 0;
+ for (i = 0; i < pScreen->numDepths; i++)
+ {
+ pDepth = &pScreen->allowedDepths[i];
+ for (j = 0; j < pDepth->numVids; j++)
+ {
+ pInfo[k].visualID = pDepth->vids[j];
+ pInfo[k].maxBuffers = 0;
+ pInfo[k].depth = pDepth->depth;
+ k++;
+ }
+ }
+
+ pMBScreen->nInfo = nInfo;
+ pMBScreen->pInfo = pInfo;
+
+ /*
+ * Setup the devPrivate to mbufScreenRec
+ */
+
+ pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv));
+ if (!pMBPriv)
+ {
+ xfree(pInfo);
+ return (FALSE);
+ }
+ pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
+ pMBPriv->PositionWindow = NULL;
+ pMBPriv->funcsWrapped = 0;
+
+ return TRUE;
+}
+
+/*ARGSUSED*/
+static int
+pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
+ WindowPtr pWin;
+ int nbuf;
+ XID *ids;
+ int action;
+ int hint;
+{
+ mbufWindowPtr pMBWindow;
+ mbufBufferPtr pMBBuffer;
+ ScreenPtr pScreen;
+ int width, height, depth;
+ int i;
+
+ pMBWindow = MB_WINDOW_PRIV(pWin);
+
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+ depth = pWin->drawable.depth;
+ pScreen = pWin->drawable.pScreen;
+
+ for (i = 0; i < nbuf; i++)
+ {
+ pMBBuffer = &pMBWindow->buffers[i];
+ pMBBuffer->pDrawable = (DrawablePtr)
+ (*pScreen->CreatePixmap) (pScreen, width, height, depth);
+ if (!pMBBuffer->pDrawable)
+ break;
+
+ if (!AddResource (ids[i], MultibufferDrawableResType,
+ (pointer) pMBBuffer->pDrawable))
+ {
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
+ break;
+ }
+ pMBBuffer->pDrawable->id = ids[i];
+
+ /*
+ * In the description of the CreateImageBuffers request:
+ * "If the window is mapped, or if these image buffers have
+ * backing store, their contents will be tiled with the window
+ * background, and zero or more expose events will be generated
+ * for each of these buffers."
+ */
+
+ (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
+ (pMBBuffer, 0,0, 0,0, TRUE);
+ }
+
+ return i;
+}
+
+/*
+ * set up the gc to clear the pixmaps;
+ */
+static Bool
+SetupBackgroundPainter (pWin, pGC)
+ WindowPtr pWin;
+ GCPtr pGC;
+{
+ XID gcvalues[4];
+ int ts_x_origin, ts_y_origin;
+ PixUnion background;
+ int backgroundState;
+ Mask gcmask;
+
+ /*
+ * First take care of any ParentRelative stuff by altering the
+ * tile/stipple origin to match the coordinates of the upper-left
+ * corner of the first ancestor without a ParentRelative background.
+ * This coordinate is, of course, negative.
+ */
+
+ ts_x_origin = ts_y_origin = 0;
+ while (pWin->backgroundState == ParentRelative) {
+ ts_x_origin -= pWin->origin.x;
+ ts_y_origin -= pWin->origin.y;
+ pWin = pWin->parent;
+ }
+ backgroundState = pWin->backgroundState;
+ background = pWin->background;
+
+ switch (backgroundState)
+ {
+ case BackgroundPixel:
+ gcvalues[0] = (XID) background.pixel;
+ gcvalues[1] = FillSolid;
+ gcmask = GCForeground|GCFillStyle;
+ break;
+
+ case BackgroundPixmap:
+ gcvalues[0] = FillTiled;
+ gcvalues[1] = (XID) background.pixmap;
+ gcvalues[2] = ts_x_origin;
+ gcvalues[3] = ts_y_origin;
+ gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
+ break;
+
+ default:
+ return FALSE;
+ }
+ DoChangeGC(pGC, gcmask, gcvalues, TRUE);
+ return TRUE;
+}
+
+static void
+MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects)
+ WindowPtr pWin;
+ DrawablePtr pDrawable;
+ int nrects;
+ xRectangle *pRects;
+{
+ GCPtr pGC;
+
+ pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
+ if (SetupBackgroundPainter(pWin, pGC))
+ {
+ ValidateGC(pDrawable, pGC);
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects);
+ }
+ FreeScratchGC(pGC);
+}
+
+static void
+MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
+ WindowPtr pWin;
+ DrawablePtr pDrawable;
+ RegionPtr pRegion;
+{
+ xRectangle *pRects;
+ int nrects = REGION_NUM_RECTS(pRegion);
+ BoxPtr pbox = REGION_RECTS(pRegion);
+
+ pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+ if (pRects)
+ {
+ int i;
+ for (i = 0; i < nrects; i++)
+ {
+ pRects[i].x = pbox->x1;
+ pRects[i].y = pbox->y1;
+ pRects[i].width = pbox->x2 - pbox->x1;
+ pRects[i].height = pbox->y2 - pbox->y1;
+ }
+ MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
+ DEALLOCATE_LOCAL(pRects);
+ }
+}
+
+static void
+pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
+ mbufBufferPtr *ppMBBuffer;
+ mbufWindowPtr *ppMBWindow;
+ int nbuf;
+{
+ GCPtr pGC = NULL;
+ PixmapPtr pPrevPixmap, pNewPixmap;
+ WindowPtr pWin;
+ RegionPtr pExposed;
+ int i;
+ mbufBufferPtr pPrevMBBuffer;
+ XID bool;
+ xRectangle r;
+
+ UpdateCurrentTime ();
+ for (i = 0; i < nbuf; i++)
+ {
+ pWin = ppMBWindow[i]->pWindow;
+
+ /* Time to get a different scratch GC? */
+
+ if (!pGC
+ || pGC->depth != pWin->drawable.depth
+ || pGC->pScreen != pWin->drawable.pScreen)
+ {
+ if (pGC) FreeScratchGC(pGC);
+ pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
+ }
+ pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
+ pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable;
+ pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable;
+
+ if (pPrevPixmap == pNewPixmap)
+ {
+ /* "If a specified buffer is already displayed, any delays and
+ * update action will still be performed for that buffer."
+ *
+ * We special-case this because applications do occasionally
+ * request a redundant DisplayImageBuffers, and we can save
+ * strokes by recognizing that the only update action that will
+ * change the buffer contents in this case is Background.
+ */
+ if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground)
+ {
+ r.x = r.y = 0;
+ r.width = pWin->drawable.width;
+ r.height = pWin->drawable.height;
+ MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin,
+ 1, &r);
+ }
+ }
+ else /* different buffer is being displayed */
+ {
+ /* perform update action */
+
+ switch (ppMBWindow[i]->updateAction)
+ {
+ case MultibufferUpdateActionUndefined:
+ break;
+
+ case MultibufferUpdateActionBackground:
+
+ r.x = r.y = 0;
+ r.width = pPrevPixmap->drawable.width;
+ r.height = pPrevPixmap->drawable.height;
+ MultibufferPaintBackgroundRectangles(pWin,
+ (DrawablePtr)pPrevPixmap,
+ 1, &r);
+ break;
+
+ case MultibufferUpdateActionUntouched:
+
+ /* copy the window to the pixmap that represents the
+ * currently displayed buffer
+ */
+
+ if (pPrevMBBuffer->eventMask & ExposureMask)
+ {
+ bool = TRUE;
+ DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
+ }
+ ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
+ pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin,
+ (DrawablePtr) pPrevPixmap,
+ pGC,
+ 0, 0,
+ pWin->drawable.width,
+ pWin->drawable.height,
+ 0, 0);
+
+ /* if we couldn't copy the whole window to the buffer,
+ * send expose events (if any client wants them)
+ */
+
+ if (pPrevMBBuffer->eventMask & ExposureMask)
+ { /* some client wants expose events */
+ if (pExposed)
+ {
+ RegionPtr pWinSize;
+ extern RegionPtr CreateUnclippedWinSize();
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ pWinSize = CreateUnclippedWinSize (pWin);
+ /*
+ * pExposed is window-relative, but at this point
+ * pWinSize is screen-relative. Make pWinSize be
+ * window-relative so that region ops involving
+ * pExposed and pWinSize behave sensibly.
+ */
+ REGION_TRANSLATE(pScreen, pWinSize,
+ -pWin->drawable.x,
+ -pWin->drawable.y);
+ REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
+ REGION_DESTROY(pScreen, pWinSize);
+ MultibufferExpose (pPrevMBBuffer, pExposed);
+ REGION_DESTROY(pScreen, pExposed);
+ }
+ bool = FALSE;
+ DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
+ } /* end some client wants expose events */
+
+ break; /* end case MultibufferUpdateActionUntouched */
+
+ case MultibufferUpdateActionCopied:
+
+ ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
+ (DrawablePtr)pPrevPixmap, pGC,
+ 0, 0, pWin->drawable.width,
+ pWin->drawable.height, 0, 0);
+ break;
+
+ } /* end switch on update action */
+
+ /* display the new buffer */
+
+ ValidateGC ((DrawablePtr)pWin, pGC);
+ (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin,
+ pGC, 0, 0,
+ pWin->drawable.width, pWin->drawable.height,
+ 0, 0);
+ }
+
+ ppMBWindow[i]->lastUpdate = currentTime;
+ }
+
+ if (pGC) FreeScratchGC (pGC);
+ return;
+}
+
+/*
+ * resize the buffers when the window is resized
+ */
+
+static Bool
+pixPositionWindow (pWin, x, y)
+ WindowPtr pWin;
+ int x, y;
+{
+ ScreenPtr pScreen;
+ mbufPixmapPrivPtr pMBPriv;
+ mbufWindowPtr pMBWindow;
+ mbufBufferPtr pMBBuffer;
+ int width, height;
+ int i;
+ int dx, dy, dw, dh;
+ int sourcex, sourcey;
+ int destx, desty;
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+ int savewidth, saveheight;
+ Bool clear;
+ RegionRec exposedRegion;
+ Bool ret;
+
+ pScreen = pWin->drawable.pScreen;
+ pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
+
+ UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
+ ret = (* pScreen->PositionWindow) (pWin, x, y);
+ REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
+
+ if (!(pMBWindow = MB_WINDOW_PRIV(pWin)))
+ return ret;
+
+ /* if new size is same as old, we're done */
+
+ if (pMBWindow->width == pWin->drawable.width &&
+ pMBWindow->height == pWin->drawable.height)
+ return ret;
+
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+ dx = pWin->drawable.x - pMBWindow->x;
+ dy = pWin->drawable.x - pMBWindow->y;
+ dw = width - pMBWindow->width;
+ dh = height - pMBWindow->height;
+ GravityTranslate (0, 0, -dx, -dy, dw, dh,
+ pWin->bitGravity, &destx, &desty);
+
+ /* if the window grew, remember to paint the window background,
+ * and maybe send expose events, for the new areas of the buffers
+ */
+
+ clear = pMBWindow->width < width || pMBWindow->height < height ||
+ pWin->bitGravity == ForgetGravity;
+
+ sourcex = 0;
+ sourcey = 0;
+ savewidth = pMBWindow->width;
+ saveheight = pMBWindow->height;
+ /* clip rectangle to source and destination */
+ if (destx < 0)
+ {
+ savewidth += destx;
+ sourcex -= destx;
+ destx = 0;
+ }
+ if (destx + savewidth > width)
+ savewidth = width - destx;
+ if (desty < 0)
+ {
+ saveheight += desty;
+ sourcey -= desty;
+ desty = 0;
+ }
+ if (desty + saveheight > height)
+ saveheight = height - desty;
+
+ pMBWindow->width = width;
+ pMBWindow->height = height;
+ pMBWindow->x = pWin->drawable.x;
+ pMBWindow->y = pWin->drawable.y;
+
+ if (clear)
+ {
+ BoxRec box;
+
+ box.x1 = box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ REGION_INIT(pScreen, &exposedRegion, &box, 1);
+ if (pWin->bitGravity != ForgetGravity)
+ {
+ RegionRec preservedRegion;
+ box.x1 = destx;
+ box.y1 = desty;
+ box.x2 = destx + savewidth;
+ box.y2 = desty + saveheight;
+ REGION_INIT(pScreen, &preservedRegion, &box, 1);
+ REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion);
+ REGION_UNINIT(pScreen, &preservedRegion);
+ }
+
+ } /* end if (clear) */
+
+ pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+
+ /* create buffers with new window size */
+
+ for (i = 0; i < pMBWindow->numMultibuffer; i++)
+ {
+ pMBBuffer = &pMBWindow->buffers[i];
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth);
+ if (!pPixmap)
+ {
+ (* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
+ break;
+ }
+ if (clear)
+ {
+ MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion);
+ MultibufferExpose(pMBBuffer, &exposedRegion);
+ }
+ if (pWin->bitGravity != ForgetGravity)
+ {
+ ValidateGC ((DrawablePtr)pPixmap, pGC);
+ (*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap,
+ pGC,
+ sourcex, sourcey, savewidth, saveheight,
+ destx, desty);
+ }
+ pPixmap->drawable.id = pMBBuffer->pDrawable->id;
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
+ pMBBuffer->pDrawable = (DrawablePtr) pPixmap;
+ if (i != pMBWindow->displayedMultibuffer)
+ {
+ ChangeResourceValue (pPixmap->drawable.id,
+ MultibufferDrawableResType,
+ (pointer) pPixmap);
+ }
+ }
+ FreeScratchGC (pGC);
+ if (clear)
+ REGION_UNINIT(pScreen, &exposedRegion);
+ return TRUE;
+}
+
+static void
+pixWrapScreenFuncs(pScreen)
+ ScreenPtr pScreen;
+{
+ mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
+ WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow);
+}
+
+static void
+pixResetProc(pScreen)
+ ScreenPtr pScreen;
+{
+ mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen);
+ mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
+
+ xfree(pMBScreen->pInfo);
+ xfree(pMBPriv);
+}
+
+static void
+pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures)
+ mbufBufferPtr pMBBuffer;
+ short x, y;
+ unsigned short width, height;
+ Bool exposures;
+{
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ BoxRec box;
+ RegionRec region;
+ int w_width, w_height;
+ DrawablePtr pDrawable;
+
+ pWin = pMBBuffer->pMBWindow->pWindow;
+ pScreen = pWin->drawable.pScreen;
+
+ w_width = pWin->drawable.width;
+ w_height = pWin->drawable.height;
+
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = width ? (box.x1 + width) : w_width;
+ box.y2 = height ? (box.y1 + height) : w_height;
+
+ if (box.x1 < 0) box.x1 = 0;
+ if (box.y1 < 0) box.y1 = 0;
+ if (box.x2 > w_width) box.x2 = w_width;
+ if (box.y2 > w_height) box.y2 = w_height;
+
+ REGION_INIT(pScreen, &region, &box, 1);
+
+ if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer)
+ pDrawable = (DrawablePtr) pWin;
+ else
+ pDrawable = pMBBuffer->pDrawable;
+
+ MultibufferPaintBackgroundRegion(pWin, pDrawable, &region);
+
+ if (exposures)
+ MultibufferExpose(pMBBuffer, &region);
+
+ REGION_UNINIT(pScreen, &region);
+}
+
+static void
+pixDeleteBufferDrawable(pDrawable)
+ DrawablePtr pDrawable;
+{
+ (* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable);
+}
diff --git a/xc/programs/Xserver/Xext/mitmisc.c b/xc/programs/Xserver/Xext/mitmisc.c
new file mode 100644
index 000000000..462c1c16f
--- /dev/null
+++ b/xc/programs/Xserver/Xext/mitmisc.c
@@ -0,0 +1,161 @@
+/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.2 1998/10/04 09:36:46 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+/* $TOG: mitmisc.c /main/6 1998/02/09 15:24:34 kaleb $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#define _MITMISC_SERVER_
+#include "mitmiscstr.h"
+
+extern Bool permitOldBugs;
+
+static unsigned char MITReqCode;
+
+static void MITResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcMITDispatch);
+static DISPATCH_PROC(ProcMITGetBugMode);
+static DISPATCH_PROC(ProcMITSetBugMode);
+static DISPATCH_PROC(SProcMITDispatch);
+static DISPATCH_PROC(SProcMITGetBugMode);
+static DISPATCH_PROC(SProcMITSetBugMode);
+
+void
+MITMiscExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
+ ProcMITDispatch, SProcMITDispatch,
+ MITResetProc, StandardMinorOpcode)) != 0)
+ MITReqCode = (unsigned char)extEntry->base;
+}
+
+/*ARGSUSED*/
+static void
+MITResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+}
+
+static int
+ProcMITSetBugMode(client)
+ register ClientPtr client;
+{
+ REQUEST(xMITSetBugModeReq);
+
+ REQUEST_SIZE_MATCH(xMITSetBugModeReq);
+ if ((stuff->onOff != xTrue) && (stuff->onOff != xFalse))
+ {
+ client->errorValue = stuff->onOff;
+ return BadValue;
+ }
+ permitOldBugs = stuff->onOff;
+ return(client->noClientException);
+}
+
+static int
+ProcMITGetBugMode(client)
+ register ClientPtr client;
+{
+ xMITGetBugModeReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xMITGetBugModeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.onOff = permitOldBugs;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcMITDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_MITSetBugMode:
+ return ProcMITSetBugMode(client);
+ case X_MITGetBugMode:
+ return ProcMITGetBugMode(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcMITSetBugMode(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xMITSetBugModeReq);
+
+ swaps(&stuff->length, n);
+ return ProcMITSetBugMode(client);
+}
+
+static int
+SProcMITGetBugMode(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xMITGetBugModeReq);
+
+ swaps(&stuff->length, n);
+ return ProcMITGetBugMode(client);
+}
+
+static int
+SProcMITDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_MITSetBugMode:
+ return SProcMITSetBugMode(client);
+ case X_MITGetBugMode:
+ return SProcMITGetBugMode(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/panoramiX.c b/xc/programs/Xserver/Xext/panoramiX.c
new file mode 100644
index 000000000..9b7a211d6
--- /dev/null
+++ b/xc/programs/Xserver/Xext/panoramiX.c
@@ -0,0 +1,1080 @@
+/* $TOG: panoramiX.c /main/5 1998/02/27 12:22:22 barstow $ */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.8 1999/07/04 06:38:33 dawes Exp $ */
+
+#define NEED_REPLIES
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "cursor.h"
+#include "cursorstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "gc.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#if 0
+#include <sys/workstation.h>
+#include <X11/Xserver/ws.h>
+#endif
+#include "panoramiX.h"
+#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
+
+static unsigned char PanoramiXReqCode = 0;
+/*
+ * PanoramiX data declarations
+ */
+
+int PanoramiXPixWidth;
+int PanoramiXPixHeight;
+int PanoramiXNumScreens;
+
+PanoramiXData *panoramiXdataPtr;
+PanoramiXWindow *PanoramiXWinRoot;
+PanoramiXGC *PanoramiXGCRoot;
+PanoramiXCmap *PanoramiXCmapRoot;
+PanoramiXPmap *PanoramiXPmapRoot;
+
+/*
+ * Free list flags added as pre-test before running through list to free ids
+ */
+Bool PanoramiXWinRootFreeable = FALSE;
+Bool PanoramiXGCRootFreeable = FALSE;
+Bool PanoramiXCmapRootFreeable = FALSE;
+Bool PanoramiXPmapRootFreeable = FALSE;
+
+PanoramiXEdge panoramiXEdgePtr[MAXSCREENS];
+RegionRec PanoramiXScreenRegion[MAXSCREENS];
+
+int PanoramiXNumDepths;
+DepthPtr PanoramiXDepths;
+int PanoramiXNumVisuals;
+VisualPtr PanoramiXVisuals;
+/* We support at most 256 visuals */
+XID PanoramiXVisualTable[256][MAXSCREENS];
+
+
+int (* SavedProcVector[256]) ();
+ScreenInfo *GlobalScrInfo;
+
+static int panoramiXGeneration;
+static int ProcPanoramiXDispatch();
+/*
+ * Function prototypes
+ */
+
+static void locate_neighbors(int);
+static void PanoramiXResetProc(ExtensionEntry*);
+
+/*
+ * External references for data variables
+ */
+
+extern int SProcPanoramiXDispatch();
+extern WindowPtr *WindowTable;
+#if 0
+extern ScreenArgsRec screenArgs[MAXSCREENS];
+#endif
+extern int defaultBackingStore;
+extern char *ConnectionInfo;
+extern int connBlockScreenStart;
+extern int (* ProcVector[256]) ();
+extern xConnSetupPrefix connSetupPrefix;
+
+/*
+ * Server dispatcher function replacements
+ */
+
+int PanoramiXCreateWindow(), PanoramiXChangeWindowAttributes();
+int PanoramiXDestroyWindow(), PanoramiXDestroySubwindows();
+int PanoramiXChangeSaveSet(), PanoramiXReparentWindow();
+int PanoramiXMapWindow(), PanoramiXMapSubwindows();
+int PanoramiXUnmapWindow(), PanoramiXUnmapSubwindows();
+int PanoramiXConfigureWindow(), PanoramiXCirculateWindow();
+int PanoramiXGetGeometry(), PanoramiXChangeProperty();
+int PanoramiXDeleteProperty(), PanoramiXSendEvent();
+int PanoramiXCreatePixmap(), PanoramiXFreePixmap();
+int PanoramiXCreateGC(), PanoramiXChangeGC();
+int PanoramiXCopyGC();
+int PanoramiXSetDashes(), PanoramiXSetClipRectangles();
+int PanoramiXFreeGC(), PanoramiXClearToBackground();
+int PanoramiXCopyArea(), PanoramiXCopyPlane();
+int PanoramiXPolyPoint(), PanoramiXPolyLine();
+int PanoramiXPolySegment(), PanoramiXPolyRectangle();
+int PanoramiXPolyArc(), PanoramiXFillPoly();
+int PanoramiXPolyFillArc(), PanoramiXPolyFillRectangle();
+int PanoramiXPutImage(), PanoramiXGetImage();
+int PanoramiXPolyText8(), PanoramiXPolyText16();
+int PanoramiXImageText8(), PanoramiXImageText16();
+int PanoramiXCreateColormap(), PanoramiXFreeColormap();
+int PanoramiXInstallColormap(), PanoramiXUninstallColormap();
+int PanoramiXAllocColor(), PanoramiXAllocNamedColor();
+int PanoramiXAllocColorCells();
+int PanoramiXFreeColors(), PanoramiXStoreColors();
+
+static int PanoramiXGCIndex = -1;
+static int PanoramiXScreenIndex = -1;
+
+typedef struct {
+ DDXPointRec clipOrg;
+ DDXPointRec patOrg;
+ GCFuncs *wrapFuncs;
+} PanoramiXGCRec, *PanoramiXGCPtr;
+
+typedef struct {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+} PanoramiXScreenRec, *PanoramiXScreenPtr;
+
+static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void XineramaChangeGC(GCPtr, unsigned long);
+static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
+static void XineramaDestroyGC(GCPtr);
+static void XineramaChangeClip(GCPtr, int, pointer, int);
+static void XineramaDestroyClip(GCPtr);
+static void XineramaCopyClip(GCPtr, GCPtr);
+
+GCFuncs XineramaGCFuncs = {
+ XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
+ XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
+};
+
+#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
+ PanoramiXGCPtr pGCPriv = \
+ (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\
+ (pGC)->funcs = pGCPriv->wrapFuncs;
+
+#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &XineramaGCFuncs;
+
+
+static Bool
+XineramaCloseScreen (int i, ScreenPtr pScreen)
+{
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ xfree ((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+XineramaCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+ Bool ret;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ PanoramiXGCPtr pGCPriv =
+ (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr;
+
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGC->funcs = &XineramaGCFuncs;
+
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ }
+ pScreen->CreateGC = XineramaCreateGC;
+
+ return ret;
+}
+
+static void
+XineramaValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) {
+ /* the root window */
+ int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x;
+ int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y;
+ int new_val;
+
+ new_val = pGCPriv->clipOrg.x - x_off;
+ if(pGC->clipOrg.x != new_val) {
+ pGC->clipOrg.x = new_val;
+ changes |= GCClipXOrigin;
+ }
+ new_val = pGCPriv->clipOrg.y - y_off;
+ if(pGC->clipOrg.y != new_val) {
+ pGC->clipOrg.y = new_val;
+ changes |= GCClipYOrigin;
+ }
+ new_val = pGCPriv->patOrg.x - x_off;
+ if(pGC->patOrg.x != new_val) {
+ pGC->patOrg.x = new_val;
+ changes |= GCTileStipXOrigin;
+ }
+ new_val = pGCPriv->patOrg.y - y_off;
+ if(pGC->patOrg.y != new_val) {
+ pGC->patOrg.y = new_val;
+ changes |= GCTileStipYOrigin;
+ }
+ } else {
+ if(pGC->clipOrg.x != pGCPriv->clipOrg.x) {
+ pGC->clipOrg.x = pGCPriv->clipOrg.x;
+ changes |= GCClipXOrigin;
+ }
+ if(pGC->clipOrg.y != pGCPriv->clipOrg.y) {
+ pGC->clipOrg.y = pGCPriv->clipOrg.y;
+ changes |= GCClipYOrigin;
+ }
+ if(pGC->patOrg.x != pGCPriv->patOrg.x) {
+ pGC->patOrg.x = pGCPriv->patOrg.x;
+ changes |= GCTileStipXOrigin;
+ }
+ if(pGC->patOrg.y != pGCPriv->patOrg.y) {
+ pGC->patOrg.y = pGCPriv->patOrg.y;
+ changes |= GCTileStipYOrigin;
+ }
+ }
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaDestroyGC(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if(mask & GCTileStipXOrigin)
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ if(mask & GCTileStipYOrigin)
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ if(mask & GCClipXOrigin)
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ if(mask & GCClipYOrigin)
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ Xinerama_GC_FUNC_EPILOGUE (pGCDst);
+}
+static void
+XineramaChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ Xinerama_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XineramaDestroyClip(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+
+/*
+ * PanoramiXExtensionInit():
+ * Called from InitExtensions in main().
+ * Register PanoramiXeen Extension
+ * Initialize global variables.
+ */
+
+void PanoramiXExtensionInit(int argc, char *argv[])
+{
+ int i, PhyScrNum;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry, *AddExtension();
+ PanoramiXData *panoramiXtempPtr;
+ ScreenPtr pScreen;
+ PanoramiXScreenPtr pScreenPriv;
+
+ if (noPanoramiXExtension)
+ return;
+
+ GlobalScrInfo = &screenInfo; /* For debug visibility */
+ PanoramiXNumScreens = screenInfo.numScreens;
+ if (PanoramiXNumScreens == 1) { /* Only 1 screen */
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ while (panoramiXGeneration != serverGeneration) {
+ extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
+ ProcPanoramiXDispatch,
+ SProcPanoramiXDispatch, PanoramiXResetProc,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n");
+ break;
+ }
+ PanoramiXReqCode = (unsigned char)extEntry->base;
+
+ /*
+ * First make sure all the basic allocations succeed. If not,
+ * run in non-PanoramiXeen mode.
+ */
+
+ panoramiXdataPtr = (PanoramiXData *) Xcalloc(PanoramiXNumScreens * sizeof(PanoramiXData));
+ PanoramiXWinRoot = (PanoramiXWindow *) Xcalloc(sizeof(PanoramiXWindow));
+ PanoramiXGCRoot = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
+ PanoramiXCmapRoot = (PanoramiXCmap *) Xcalloc(sizeof(PanoramiXCmap));
+ PanoramiXPmapRoot = (PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
+ BREAK_IF(!(panoramiXdataPtr && PanoramiXWinRoot && PanoramiXGCRoot &&
+ PanoramiXCmapRoot && PanoramiXPmapRoot));
+
+ BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
+ BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0);
+
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex,
+ sizeof(PanoramiXGCRec))) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
+ pScreen->devPrivates[PanoramiXScreenIndex].ptr =
+ (pointer)pScreenPriv;
+ if(!pScreenPriv) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+
+ pScreen->CreateGC = XineramaCreateGC;
+ pScreen->CloseScreen = XineramaCloseScreen;
+ }
+
+ panoramiXGeneration = serverGeneration;
+ success = TRUE;
+ }
+
+ if (!success) {
+ noPanoramiXExtension = TRUE;
+ ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME);
+ return;
+ }
+
+ /* Set up a default configuration base on horizontal ordering */
+ for (i = PanoramiXNumScreens -1; i >= 0 ; i--) {
+ panoramiXdataPtr[i].above = panoramiXdataPtr[i].below = -1;
+ panoramiXdataPtr[i].left = panoramiXdataPtr[i].right = -1;
+ panoramiXEdgePtr[i].no_edges = TRUE;
+ }
+ for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
+ panoramiXdataPtr[i].left = i - 1;
+ panoramiXdataPtr[i].right = i + 1;
+ }
+ panoramiXdataPtr[PanoramiXNumScreens - 1].right = -1;
+
+ /*
+ * Position the screens relative to each other based on
+ * command line options.
+ */
+
+#if 0
+ for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
+ if (wsRemapPhysToLogScreens)
+ i = wsPhysToLogScreens[PhyScrNum];
+ else
+ i = PhyScrNum;
+ if (i < 0)
+ continue;
+ panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
+ panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
+ if (screenArgs[i].flags & ARG_EDGE_L) {
+ ArgScrNum = screenArgs[PhyScrNum].edge_left;
+ if (ArgScrNum < 0)
+ j = -1;
+ else {
+ if (wsRemapPhysToLogScreens)
+ j = wsPhysToLogScreens[ArgScrNum];
+ else
+ j = ArgScrNum;
+ }
+ panoramiXdataPtr[i].left = j;
+ panoramiXEdgePtr[i].no_edges = FALSE;
+ if ( j >= 0)
+ panoramiXdataPtr[j].right = i;
+ else {
+ if ( i >= 1 )
+ panoramiXdataPtr[i - 1].right = -1;
+ }
+ }
+ if (screenArgs[i].flags & ARG_EDGE_R) {
+ ArgScrNum = screenArgs[PhyScrNum].edge_right;
+ if (ArgScrNum < 0)
+ j = -1;
+ else {
+ if (wsRemapPhysToLogScreens)
+ j = wsPhysToLogScreens[ArgScrNum];
+ else
+ j = ArgScrNum;
+ }
+ panoramiXdataPtr[i].right = j;
+ panoramiXEdgePtr[i].no_edges = FALSE;
+ if ( j >= 0)
+ panoramiXdataPtr[j].left = i;
+ }
+ if (screenArgs[i].flags & ARG_EDGE_T) {
+ ArgScrNum = screenArgs[PhyScrNum].edge_top;
+ if (ArgScrNum < 0)
+ j = -1;
+ else {
+ if (wsRemapPhysToLogScreens)
+ j = wsPhysToLogScreens[ArgScrNum];
+ else
+ j = ArgScrNum;
+ }
+ panoramiXdataPtr[i].above = j;
+ panoramiXEdgePtr[i].no_edges = FALSE;
+ if ( j >= 0)
+ panoramiXdataPtr[j].below = i;
+ }
+ if (screenArgs[i].flags & ARG_EDGE_B) {
+ ArgScrNum = screenArgs[PhyScrNum].edge_bottom;
+ if (ArgScrNum < 0)
+ j = -1;
+ else {
+ if (wsRemapPhysToLogScreens)
+ j = wsPhysToLogScreens[ArgScrNum];
+ else
+ j = ArgScrNum;
+ }
+ panoramiXdataPtr[i].below = j;
+ panoramiXEdgePtr[i].no_edges = FALSE;
+ if ( j >= 0)
+ panoramiXdataPtr[j].above = i;
+ }
+ }
+#else
+ for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
+ i = PhyScrNum;
+ if (i < 0)
+ continue;
+ panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
+ panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
+ }
+#endif
+
+ /*
+ * Find the upper-left screen and then locate all the others
+ */
+ panoramiXtempPtr = panoramiXdataPtr;
+ for (i = PanoramiXNumScreens; i; i--, panoramiXtempPtr++)
+ if (panoramiXtempPtr->above == -1 && panoramiXtempPtr->left == -1)
+ break;
+ locate_neighbors(PanoramiXNumScreens - i);
+
+ /*
+ * Put our processes into the ProcVector
+ */
+
+ for (i = 256; i--; )
+ SavedProcVector[i] = ProcVector[i];
+
+ ProcVector[X_CreateWindow] = PanoramiXCreateWindow;
+ ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes;
+ ProcVector[X_DestroyWindow] = PanoramiXDestroyWindow;
+ ProcVector[X_DestroySubwindows] = PanoramiXDestroySubwindows;
+ ProcVector[X_ChangeSaveSet] = PanoramiXChangeSaveSet;
+ ProcVector[X_ReparentWindow] = PanoramiXReparentWindow;
+ ProcVector[X_MapWindow] = PanoramiXMapWindow;
+ ProcVector[X_MapSubwindows] = PanoramiXMapSubwindows;
+ ProcVector[X_UnmapWindow] = PanoramiXUnmapWindow;
+ ProcVector[X_UnmapSubwindows] = PanoramiXUnmapSubwindows;
+ ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow;
+ ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow;
+ ProcVector[X_GetGeometry] = PanoramiXGetGeometry;
+ ProcVector[X_ChangeProperty] = PanoramiXChangeProperty;
+ ProcVector[X_DeleteProperty] = PanoramiXDeleteProperty;
+ ProcVector[X_SendEvent] = PanoramiXSendEvent;
+ ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap;
+ ProcVector[X_FreePixmap] = PanoramiXFreePixmap;
+ ProcVector[X_CreateGC] = PanoramiXCreateGC;
+ ProcVector[X_ChangeGC] = PanoramiXChangeGC;
+ ProcVector[X_CopyGC] = PanoramiXCopyGC;
+ ProcVector[X_SetDashes] = PanoramiXSetDashes;
+ ProcVector[X_SetClipRectangles] = PanoramiXSetClipRectangles;
+ ProcVector[X_FreeGC] = PanoramiXFreeGC;
+ ProcVector[X_ClearArea] = PanoramiXClearToBackground;
+ ProcVector[X_CopyArea] = PanoramiXCopyArea;;
+ ProcVector[X_CopyPlane] = PanoramiXCopyPlane;;
+ ProcVector[X_PolyPoint] = PanoramiXPolyPoint;
+ ProcVector[X_PolyLine] = PanoramiXPolyLine;
+ ProcVector[X_PolySegment] = PanoramiXPolySegment;
+ ProcVector[X_PolyRectangle] = PanoramiXPolyRectangle;
+ ProcVector[X_PolyArc] = PanoramiXPolyArc;
+ ProcVector[X_FillPoly] = PanoramiXFillPoly;
+ ProcVector[X_PolyFillRectangle] = PanoramiXPolyFillRectangle;
+ ProcVector[X_PolyFillArc] = PanoramiXPolyFillArc;
+ ProcVector[X_PutImage] = PanoramiXPutImage;
+ ProcVector[X_GetImage] = PanoramiXGetImage;
+ ProcVector[X_PolyText8] = PanoramiXPolyText8;
+ ProcVector[X_PolyText16] = PanoramiXPolyText16;
+ ProcVector[X_ImageText8] = PanoramiXImageText8;
+ ProcVector[X_ImageText16] = PanoramiXImageText16;
+ ProcVector[X_CreateColormap] = PanoramiXCreateColormap;
+ ProcVector[X_FreeColormap] = PanoramiXFreeColormap;
+ ProcVector[X_InstallColormap] = PanoramiXInstallColormap;
+ ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap;
+ ProcVector[X_AllocColor] = PanoramiXAllocColor;
+ ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor;
+ ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells;
+ ProcVector[X_FreeColors] = PanoramiXFreeColors;
+ ProcVector[X_StoreColors] = PanoramiXStoreColors;
+
+ return;
+}
+extern
+Bool PanoramiXCreateConnectionBlock(void)
+{
+ int i, j, length;
+ Bool disableBackingStore = FALSE;
+ Bool disableSaveUnders = FALSE;
+ int old_width, old_height;
+ int width_mult, height_mult;
+ xWindowRoot *root;
+ xConnSetup *setup;
+ xVisualType *visual;
+ xDepth *depth;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
+
+ /*
+ * Do normal CreateConnectionBlock but faking it for only one screen
+ */
+
+ if(!PanoramiXNumDepths) {
+ ErrorF("PanoramiX error: Incompatible screens. No common visuals\n");
+ return FALSE;
+ }
+
+ for(i = 1; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
+ ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n");
+ return FALSE;
+ }
+ if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
+ disableBackingStore = TRUE;
+ if(pScreen->saveUnderSupport != screenInfo.screens[0]->saveUnderSupport)
+ disableSaveUnders = TRUE;
+ }
+
+ if(disableBackingStore || disableSaveUnders) {
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(disableBackingStore)
+ pScreen->backingStoreSupport = NotUseful;
+ if(disableSaveUnders)
+ pScreen->saveUnderSupport = NotUseful;
+ }
+ }
+
+ i = screenInfo.numScreens;
+ screenInfo.numScreens = 1;
+ if (!CreateConnectionBlock()) {
+ screenInfo.numScreens = i;
+ return FALSE;
+ }
+
+ screenInfo.numScreens = i;
+
+ setup = (xConnSetup *) ConnectionInfo;
+ root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
+ length = connBlockScreenStart + sizeof(xWindowRoot);
+
+ /* overwrite the connection block */
+ root->nDepths = PanoramiXNumDepths;
+
+ for (i = 0; i < PanoramiXNumDepths; i++) {
+ depth = (xDepth *) (ConnectionInfo + length);
+ depth->depth = PanoramiXDepths[i].depth;
+ depth->nVisuals = PanoramiXDepths[i].numVids;
+ length += sizeof(xDepth);
+ visual = (xVisualType *)(ConnectionInfo + length);
+
+ for (j = 0; j < depth->nVisuals; j++, visual++) {
+ visual->visualID = PanoramiXDepths[i].vids[j];
+
+ for (pVisual = PanoramiXVisuals;
+ pVisual->vid != visual->visualID;
+ pVisual++)
+ ;
+
+ visual->class = pVisual->class;
+ visual->bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual->colormapEntries = pVisual->ColormapEntries;
+ visual->redMask = pVisual->redMask;
+ visual->greenMask = pVisual->greenMask;
+ visual->blueMask = pVisual->blueMask;
+ }
+
+ length += (depth->nVisuals * sizeof(xVisualType));
+ }
+
+ connSetupPrefix.length = length >> 2;
+
+ xfree(PanoramiXVisuals);
+ for (i = 0; i < PanoramiXNumDepths; i++)
+ xfree(PanoramiXDepths[i].vids);
+ xfree(PanoramiXDepths);
+
+ /*
+ * OK, change some dimensions so it looks as if it were one big screen
+ */
+
+ old_width = root->pixWidth;
+ old_height = root->pixHeight;
+ for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
+ if (panoramiXdataPtr[i].right == -1 )
+ root->pixWidth = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
+ if (panoramiXdataPtr[i].below == -1)
+ root->pixHeight = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
+ }
+ PanoramiXPixWidth = root->pixWidth;
+ PanoramiXPixHeight = root->pixHeight;
+ width_mult = root->pixWidth / old_width;
+ height_mult = root->pixHeight / old_height;
+ root->mmWidth *= width_mult;
+ root->mmHeight *= height_mult;
+ return TRUE;
+}
+
+extern
+Bool PanoramiXCreateScreenRegion(WindowPtr pWin)
+{
+ ScreenPtr pScreen;
+ BoxRec box;
+ int i;
+ Bool ret;
+
+ pScreen = pWin->drawable.pScreen;
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ box.x1 = 0 - panoramiXdataPtr[i].x;
+ box.x2 = box.x1 + PanoramiXPixWidth;
+ box.y1 = 0 - panoramiXdataPtr[i].y;
+ box.y2 = box.y1 + PanoramiXPixHeight;
+ REGION_INIT(pScreen, &PanoramiXScreenRegion[i], &box, 1);
+ ret = REGION_NOTEMPTY(pScreen, &PanoramiXScreenRegion[i]);
+ if (!ret)
+ return ret;
+ }
+ return ret;
+}
+
+extern
+void PanoramiXDestroyScreenRegion(WindowPtr pWin)
+{
+ ScreenPtr pScreen;
+ int i;
+
+ pScreen = pWin->drawable.pScreen;
+ for (i = 0; i < PanoramiXNumScreens; i++)
+ REGION_DESTROY(pScreen, &PanoramiXScreenRegion[i]);
+}
+
+/*
+ * Assign the Root window and colormap ID's in the PanoramiXScreen Root
+ * linked lists. Note: WindowTable gets setup in dix_main by
+ * InitRootWindow, and GlobalScrInfo is screenInfo which gets setup
+ * by InitOutput.
+ */
+extern
+void PanoramiXConsolidate(void)
+{
+ int i, j, k, l;
+ VisualPtr pVisual, pVisual2;
+ ScreenPtr pScreen, pScreen2;
+
+ /* initialize the visual table */
+ for (i = 0; i < 256; i++) {
+ for (j = 0; j < MAXSCREENS - 1; j++)
+ PanoramiXVisualTable[i][j] = 0;
+ }
+
+ pScreen = screenInfo.screens[0];
+ pVisual = pScreen->visuals;
+
+ PanoramiXNumDepths = 0;
+ PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
+ PanoramiXNumVisuals = 0;
+ PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
+
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ PanoramiXVisualTable[pVisual->vid][0] = pVisual->vid;
+
+ /* check if the visual exists on all screens */
+ for (j = 1; j < PanoramiXNumScreens; j++) {
+ pScreen2 = screenInfo.screens[j];
+ pVisual2 = pScreen2->visuals;
+
+ for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) {
+ if ((pVisual->class == pVisual2->class) &&
+ (pVisual->ColormapEntries == pVisual2->ColormapEntries) &&
+ (pVisual->nplanes == pVisual2->nplanes) &&
+ (pVisual->redMask == pVisual2->redMask) &&
+ (pVisual->greenMask == pVisual2->greenMask) &&
+ (pVisual->blueMask == pVisual2->blueMask) &&
+ (pVisual->offsetRed == pVisual2->offsetRed) &&
+ (pVisual->offsetGreen == pVisual2->offsetGreen) &&
+ (pVisual->offsetBlue == pVisual2->offsetBlue))
+ {
+ Bool AlreadyUsed = FALSE;
+ for (l = 0; l < 256; l++) {
+ if (pVisual2->vid == PanoramiXVisualTable[l][j]) {
+ AlreadyUsed = TRUE;
+ break;
+ }
+ }
+ if (!AlreadyUsed) {
+ PanoramiXVisualTable[pVisual->vid][j] = pVisual2->vid;
+ break;
+ }
+ }
+ }
+ }
+
+ /* if it doesn't exist on all screens we can't use it */
+ for (j = 0; j < PanoramiXNumScreens; j++) {
+ if (!PanoramiXVisualTable[pVisual->vid][j]) {
+ PanoramiXVisualTable[pVisual->vid][0] = 0;
+ break;
+ }
+ }
+
+ /* if it does, make sure it's in the list of supported depths and visuals */
+ if(PanoramiXVisualTable[pVisual->vid][0]) {
+ Bool GotIt = FALSE;
+
+ PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid;
+ PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class;
+ PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue;
+ PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries;
+ PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes;
+ PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue;
+ PanoramiXNumVisuals++;
+
+ for (j = 0; j < PanoramiXNumDepths; j++) {
+ if (PanoramiXDepths[j].depth == pVisual->nplanes) {
+ PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid;
+ PanoramiXDepths[j].numVids++;
+ GotIt = TRUE;
+ break;
+ }
+ }
+
+ if (!GotIt) {
+ PanoramiXDepths[PanoramiXNumDepths].depth = pVisual->nplanes;
+ PanoramiXDepths[PanoramiXNumDepths].numVids = 1;
+ PanoramiXDepths[PanoramiXNumDepths].vids = xalloc(sizeof(VisualID) * 256);
+ PanoramiXDepths[PanoramiXNumDepths].vids[0] = pVisual->vid;
+ PanoramiXNumDepths++;
+ }
+ }
+ }
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ PanoramiXWinRoot->info[i].id = WindowTable[i]->drawable.id;
+ PanoramiXCmapRoot->info[i].id = (screenInfo.screens[i])->defColormap;
+ }
+}
+
+/* Since locate_neighbors is recursive, a quick simple example
+ is in order.This mostly so you can see what the initial values are.
+
+ Given 3 screens:
+ upperleft screen[0]
+ panoramiXdataPtr[0].x = 0
+ panoramiXdataPtr[0].y = 0
+ panoramiXdataPtr[0].width = 640
+ panoramiXdataPtr[0].height = 480
+ panoramiXdataPtr[0].below = -1
+ panoramiXdataPtr[0].right = 1
+ panoramiXdataPtr[0].above = -1
+ panoramiXdataPtr[0].left = -1
+ middle screen[1]
+ panoramiXdataPtr[1].x = 0
+ panoramiXdataPtr[1].y = 0
+ panoramiXdataPtr[1].width = 640
+ panoramiXdataPtr[1].height = 480
+ panoramiXdataPtr[1].below = -1
+ panoramiXdataPtr[1].right = 2
+ panoramiXdataPtr[1].above = -1
+ panoramiXdataPtr[1].left = 0
+ last right screen[2]
+ panoramiXdataPtr[2].x = 0
+ panoramiXdataPtr[2].y = 0
+ panoramiXdataPtr[2].width = 640
+ panoramiXdataPtr[2].height = 480
+ panoramiXdataPtr[2].below = -1
+ panoramiXdataPtr[2].right = -1
+ panoramiXdataPtr[2].above = -1
+ panoramiXdataPtr[2].left = 1
+
+ Calling locate_neighbors(0) results in:
+ panoramiXdataPtr[0].x = 0
+ panoramiXdataPtr[0].y = 0
+ panoramiXdataPtr[1].x = 640
+ panoramiXdataPtr[1].y = 0
+ panoramiXdataPtr[2].x = 1280
+ panoramiXdataPtr[2].y = 0
+*/
+
+static void locate_neighbors(int i)
+{
+ int j;
+
+ j = panoramiXdataPtr[i].right;
+ if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
+ panoramiXdataPtr[j].x = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
+ panoramiXdataPtr[j].y = panoramiXdataPtr[i].y;
+ locate_neighbors(j);
+ }
+ j = panoramiXdataPtr[i].below;
+ if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
+ panoramiXdataPtr[j].y = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
+ panoramiXdataPtr[j].x = panoramiXdataPtr[i].x;
+ locate_neighbors(j);
+ }
+}
+
+
+
+/*
+ * PanoramiXResetProc()
+ * Exit, deallocating as needed.
+ */
+
+static void PanoramiXResetProc(ExtensionEntry* extEntry)
+{
+ int i;
+ PanoramiXList *pPanoramiXList;
+ PanoramiXList *tempList;
+
+ for (pPanoramiXList = PanoramiXPmapRoot; pPanoramiXList; pPanoramiXList = tempList){
+ tempList = pPanoramiXList->next;
+ Xfree(pPanoramiXList);
+ }
+ for (pPanoramiXList = PanoramiXCmapRoot; pPanoramiXList; pPanoramiXList = tempList){
+ tempList = pPanoramiXList->next;
+ Xfree(pPanoramiXList);
+ }
+ for (pPanoramiXList = PanoramiXGCRoot; pPanoramiXList; pPanoramiXList = tempList) {
+ tempList = pPanoramiXList->next;
+ Xfree(pPanoramiXList);
+ }
+ for (pPanoramiXList = PanoramiXWinRoot; pPanoramiXList; pPanoramiXList = tempList) {
+ tempList = pPanoramiXList->next;
+ Xfree(pPanoramiXList);
+ }
+ screenInfo.numScreens = PanoramiXNumScreens;
+ for (i = 256; i--; )
+ ProcVector[i] = SavedProcVector[i];
+ Xfree(panoramiXdataPtr);
+
+}
+
+
+int
+ProcPanoramiXQueryVersion (ClientPtr client)
+{
+ REQUEST(xPanoramiXQueryVersionReq);
+ xPanoramiXQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = PANORAMIX_MAJOR_VERSION;
+ rep.minorVersion = PANORAMIX_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+int
+ProcPanoramiXGetState(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetStateReq);
+ WindowPtr pWin;
+ xPanoramiXGetStateReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPanoramiXExtension;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (&rep.state, n);
+ }
+ WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
+ return client->noClientException;
+
+}
+
+int
+ProcPanoramiXGetScreenCount(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenCountReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenCountReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.ScreenCount = PanoramiXNumScreens;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (&rep.ScreenCount, n);
+ }
+ WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), (char *) &rep);
+ return client->noClientException;
+}
+
+int
+ProcPanoramiXGetScreenSize(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ /* screen dimensions */
+ rep.width = panoramiXdataPtr[stuff->screen].width;
+ rep.height = panoramiXdataPtr[stuff->screen].height;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (rep.width, n);
+ swaps (rep.height, n);
+ }
+ WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
+ return client->noClientException;
+}
+
+
+void PrintList(PanoramiXList *head)
+{
+ int i = 0;
+
+ for (; head; i++, head = head->next)
+ fprintf(stderr, "%2d next = 0x%010lx, id[0] = 0x%08x, id[1] = 0x%08x\n",
+ i, head->next, head->info[0].id, head->info[1].id);
+}
+static int
+ProcPanoramiXDispatch (ClientPtr client)
+{ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_PanoramiXQueryVersion:
+ return ProcPanoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcPanoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcPanoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcPanoramiXGetScreenSize(client);
+ }
+ return BadRequest;
+}
diff --git a/xc/programs/Xserver/Xext/panoramiXSwap.c b/xc/programs/Xserver/Xext/panoramiXSwap.c
new file mode 100644
index 000000000..0ccb67993
--- /dev/null
+++ b/xc/programs/Xserver/Xext/panoramiXSwap.c
@@ -0,0 +1,154 @@
+/* $TOG: panoramiXSwap.c /main/1 1997/10/29 13:26:35 kaleb $ */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.5 1999/07/18 08:34:27 dawes Exp $ */
+
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "cursor.h"
+#include "cursorstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "gc.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#if 0
+#include <sys/workstation.h>
+#include <X11/Xserver/ws.h>
+#endif
+#include "panoramiX.h"
+#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
+
+
+/*
+ * External references for data variables
+ */
+
+extern WindowPtr *WindowTable;
+extern int defaultBackingStore;
+extern char *ConnectionInfo;
+extern int connBlockScreenStart;
+extern int (* ProcVector[256]) ();
+
+#if NeedFunctionPrototypes
+#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
+#else
+#define PROC_EXTERN(pfunc) extern int pfunc()
+#endif
+
+PROC_EXTERN(ProcPanoramiXQueryVersion);
+PROC_EXTERN(ProcPanoramiXGetState);
+PROC_EXTERN(ProcPanoramiXGetScreenCount);
+PROC_EXTERN(PropPanoramiXGetScreenSize);
+
+static int
+#if NeedFunctionPrototypes
+SProcPanoramiXQueryVersion (ClientPtr client)
+#else
+SProcPanoramiXQueryVersion (client)
+ register ClientPtr client;
+#endif
+{
+ register int n;
+ REQUEST(xPanoramiXQueryVersionReq);
+
+ swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return ProcPanoramiXQueryVersion(client);
+}
+
+static int
+#if NeedFunctionPrototypes
+SProcPanoramiXGetState(ClientPtr client)
+#else
+SProcPanoramiXGetState(client)
+ register ClientPtr client;
+#endif
+{
+ REQUEST(xPanoramiXGetStateReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+
+}
+
+static int
+#if NeedFunctionPrototypes
+SProcPanoramiXGetScreenCount(ClientPtr client)
+#else
+SProcPanoramixGetScreenCount(client)
+ register ClientPtr client;
+#endif
+{
+ REQUEST(xPanoramiXGetScreenCountReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return ProcPanoramiXGetScreenCount(client);
+}
+
+static int
+#if NeedFunctionPrototypes
+SProcPanoramiXGetScreenSize(ClientPtr client)
+#else
+SProcPanoramiXGetScreenSize(client)
+ register ClientPtr client;
+#endif
+{
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ WindowPtr pWin;
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return ProcPanoramiXGetScreenSize(client);
+}
+
+int
+#if NeedFunctionPrototypes
+SProcPanoramiXDispatch (ClientPtr client)
+#else
+SProcPanoramiXDispatch (client)
+ ClientPtr client;
+#endif
+{ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_PanoramiXQueryVersion:
+ return SProcPanoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcPanoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPanoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPanoramiXGetScreenSize(client);
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/panoramiXprocs.c b/xc/programs/Xserver/Xext/panoramiXprocs.c
new file mode 100644
index 000000000..6c7d5c86a
--- /dev/null
+++ b/xc/programs/Xserver/Xext/panoramiXprocs.c
@@ -0,0 +1,2602 @@
+/* $TOG: panoramiXprocs.c /main/9 1998/03/17 06:51:10 kaleb $ */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.13 1999/06/27 14:07:40 dawes Exp $ */
+
+#include <stdio.h>
+#include "X.h"
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "windowstr.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "opaque.h"
+#include "inputstr.h"
+#include "migc.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+
+extern ScreenInfo *GlobalScrInfo;
+extern int (* SavedProcVector[256])();
+extern void (* ReplySwapVector[256])();
+extern WindowPtr *WindowTable;
+extern char *ConnectionInfo;
+extern int connBlockScreenStart;
+extern XID PanoramiXVisualTable[256][MAXSCREENS];
+
+
+extern XID clientErrorValue;
+
+extern void Swap32Write();
+
+extern int connBlockScreenStart;
+
+extern int (* InitialVector[3]) ();
+extern int (* ProcVector[256]) ();
+extern int (* SwappedProcVector[256]) ();
+extern void (* EventSwapVector[128]) ();
+extern void (* ReplySwapVector[256]) ();
+extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(),
+WriteSConnectionInfo();
+extern void WriteSConnSetupPrefix();
+extern char *ClientAuthorized();
+extern Bool InsertFakeRequest();
+static void KillAllClients();
+static void DeleteClientFromAnySelections();
+extern void ProcessWorkQueue();
+
+extern char isItTimeToYield;
+
+/* Various of the DIX function interfaces were not designed to allow
+ * the client->errorValue to be set on BadValue and other errors.
+ * Rather than changing interfaces and breaking untold code we introduce
+ * a new global that dispatch can use.
+ */
+extern XID clientErrorValue; /* XXX this is a kludge */
+
+
+#define SAME_SCREENS(a, b) (\
+ (a.pScreen == b.pScreen))
+
+
+
+extern int Ones();
+
+int PanoramiXCreateWindow(register ClientPtr client)
+{
+ register WindowPtr pParent;
+ REQUEST(xCreateWindowReq);
+ int result, j = 0;
+ unsigned len;
+ Window winID;
+ Window parID;
+ PanoramiXWindow *localWin;
+ PanoramiXWindow *parentWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXCmap *pPanoramiXCmap = NULL;
+ PanoramiXPmap *pBackgndPmap = NULL;
+ PanoramiXPmap *pBorderPmap = NULL;
+ VisualID orig_visual;
+ XID orig_wid;
+ int orig_x, orig_y;
+ register Mask orig_mask;
+ int cmap_offset = 0;
+ int pback_offset = 0;
+ int pbord_offset = 0;
+
+
+ REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
+
+ len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
+ IF_RETURN((Ones((Mask)stuff->mask) != len), BadLength);
+ orig_mask = stuff->mask;
+ PANORAMIXFIND_ID(parentWin, stuff->parent);
+ if (parentWin) {
+ localWin = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
+ IF_RETURN(!localWin, BadAlloc);
+ } else {
+ return BadWindow;
+ }
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBackPixmap)) {
+ XID pmapID;
+
+ pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
+ pmapID = *((CARD32 *) &stuff[1] + pback_offset);
+ if (pmapID) {
+ pBackgndPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ }
+ }
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBorderPixmap)) {
+ XID pmapID;
+
+ pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
+ pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (pmapID) {
+ pBorderPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ }
+ }
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWColormap)) {
+ Colormap cmapID;
+
+ cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
+ cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
+ if (cmapID) {
+ pPanoramiXCmap = PanoramiXCmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ }
+ }
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ orig_wid = stuff->wid;
+ orig_visual = stuff->visual;
+ for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
+ winID = j ? FakeClientID(client->index) : orig_wid;
+ localWin->info[j].id = winID;
+ }
+ localWin->FreeMe = FALSE;
+ localWin->visibility = VisibilityNotViewable;
+ localWin->VisibilitySent = FALSE;
+ PANORAMIXFIND_LAST(pPanoramiXWin, PanoramiXWinRoot);
+ pPanoramiXWin->next = localWin;
+
+ if (stuff->class == InputOnly) {
+ /* Kludge. DEC forgot about InputOnly windows */
+ stuff->visual = orig_visual = 0;
+ }
+
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ if (parentWin == PanoramiXWinRoot) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ stuff->wid = localWin->info[j].id;
+ parID = (XID)(parentWin->info[j].id);
+ pParent = (WindowPtr)SecurityLookupWindow(parID, client,SecurityReadAccess);
+ IF_RETURN((!pParent),BadWindow);
+ stuff->parent = parID;
+ if ( orig_visual != CopyFromParent )
+ stuff->visual = PanoramiXVisualTable[orig_visual][j];
+ if (pBackgndPmap)
+ *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
+ if (pBorderPmap)
+ *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
+ if (pPanoramiXCmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
+ stuff->mask = orig_mask;
+ result = (*SavedProcVector[X_CreateWindow])(client);
+ BREAK_IF(result != Success);
+ }
+ if (result != Success) {
+ pPanoramiXWin->next = NULL;
+ if (localWin)
+ Xfree(localWin);
+ }
+ return (result);
+}
+
+
+
+int PanoramiXChangeWindowAttributes(register ClientPtr client)
+{
+ register WindowPtr pWin;
+ REQUEST(xChangeWindowAttributesReq);
+ register int result;
+ int len;
+ int j;
+ Window winID;
+ Mask orig_valueMask;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+ PanoramiXCmap *pPanoramiXCmap = NULL;
+ PanoramiXPmap *pBackgndPmap = NULL;
+ PanoramiXPmap *pBorderPmap = NULL;
+ int cmap_offset = 0;
+ int pback_offset = 0;
+ int pbord_offset = 0;
+
+ REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
+ len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
+ IF_RETURN((len != Ones((Mask) stuff->valueMask)), BadLength);
+ orig_valueMask = stuff->valueMask;
+ winID = stuff->window;
+ for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->window);
+ pPanoramiXWin = pPanoramiXWin->next)
+ pPanoramiXWinback = pPanoramiXWin;
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, winID);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBackPixmap)) {
+ XID pmapID;
+
+ pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1));
+ pmapID = *((CARD32 *) &stuff[1] + pback_offset);
+ if (pmapID) {
+ pBackgndPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ }
+ }
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBorderPixmap)) {
+ XID pmapID;
+
+ pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1));
+ pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (pmapID) {
+ pBorderPmap = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ }
+ }
+ if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWColormap )) {
+ Colormap cmapID;
+
+ cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1));
+ cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
+ if (cmapID) {
+ pPanoramiXCmap = PanoramiXCmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ }
+ }
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ stuff->valueMask = orig_valueMask;
+ if (pBackgndPmap)
+ *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
+ if (pBorderPmap)
+ *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
+ if (pPanoramiXCmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
+ result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
+ BREAK_IF(result != Success);
+ }
+ if ((result == Success) && pPanoramiXWinback &&
+ pPanoramiXWin && pPanoramiXWin->FreeMe) {
+ pPanoramiXWinback->next = pPanoramiXWin->next;
+ Xfree(pPanoramiXWin);
+ }
+ return (result);
+}
+
+
+int PanoramiXDestroyWindow(ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j, result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
+ pPanoramiXWin = pPanoramiXWin->next)
+ pPanoramiXWinback = pPanoramiXWin;
+ IF_RETURN(!pPanoramiXWin,BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->id = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_DestroyWindow])(client);
+ BREAK_IF(result != Success);
+ }
+ if ((result == Success) && pPanoramiXWinback &&
+ pPanoramiXWin && pPanoramiXWin->FreeMe) {
+ pPanoramiXWinback->next = pPanoramiXWin->next;
+ Xfree(pPanoramiXWin);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXDestroySubwindows(ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j,result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
+ pPanoramiXWin = pPanoramiXWin->next)
+ pPanoramiXWinback = pPanoramiXWin;
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->id = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_DestroySubwindows])(client);
+ }
+ if ((result == Success) && pPanoramiXWinback &&
+ pPanoramiXWin && pPanoramiXWin->FreeMe) {
+ pPanoramiXWinback->next = pPanoramiXWin->next;
+ Xfree(pPanoramiXWin);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXChangeSaveSet(ClientPtr client)
+{
+ REQUEST(xChangeSaveSetReq);
+ int j, result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST_SIZE_MATCH(xChangeSaveSetReq);
+ if (!stuff->window)
+ result = (* SavedProcVector[X_ChangeSaveSet])(client);
+ else {
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_ChangeSaveSet])(client);
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXReparentWindow(register ClientPtr client)
+{
+ REQUEST(xReparentWindowReq);
+ register int result;
+ int j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXPar = PanoramiXWinRoot;
+ int x = stuff->x;
+ int y = stuff->y;
+
+ REQUEST_SIZE_MATCH(xReparentWindowReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ PANORAMIXFIND_ID(pPanoramiXPar, stuff->parent);
+ IF_RETURN(!pPanoramiXPar, BadWindow);
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXPar), j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ stuff->parent = pPanoramiXPar->info[j].id;
+ if(pPanoramiXPar == PanoramiXWinRoot) {
+ stuff->x = x - panoramiXdataPtr[j].x;
+ stuff->y = y - panoramiXdataPtr[j].y;
+ }
+ result = (*SavedProcVector[X_ReparentWindow])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXMapWindow(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j,result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register WindowPtr pWin, pChild;
+ Window winID;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ /* initialize visibility */
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+SecurityReadAccess);
+ IF_RETURN(!pWin, BadWindow);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ PanoramiXMapped = TRUE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
+ {
+ winID = pPanoramiXWin->info[j].id;
+ pWin = (WindowPtr) SecurityLookupWindow(winID,
+client,SecurityReadAccess);
+ IF_RETURN((!pWin), BadWindow);
+ stuff->id = winID;
+ result = (*SavedProcVector[X_MapWindow])(client);
+ }
+ /* clean up */
+ PanoramiXMapped = FALSE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+ return (result);
+}
+
+
+int PanoramiXMapSubwindows(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j,result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register WindowPtr pWin, pChild;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ /* initialize visibility values */
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ IF_RETURN(!pWin, BadWindow);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ PanoramiXMapped = TRUE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
+ {
+ stuff->id = pPanoramiXWin->info[j].id;
+ result = (*SavedProcVector[X_MapSubwindows])(client);
+ }
+ /* clean up */
+ PanoramiXMapped = FALSE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXUnmapWindow(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j, result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register WindowPtr pWin, pChild;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ /* initialize visibility values */
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ IF_RETURN(!pWin, BadWindow);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ PanoramiXMapped = TRUE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
+ {
+ stuff->id = pPanoramiXWin->info[j].id;
+ result = (*SavedProcVector[X_UnmapWindow])(client);
+ }
+
+ /* clean up */
+ PanoramiXMapped = FALSE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+ PANORAMIX_FREE(client);
+ return (client->noClientException);
+}
+
+
+int PanoramiXUnmapSubwindows(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int j, result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register WindowPtr pWin, pChild;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ /* initialize visibility values */
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
+client,SecurityReadAccess);
+ IF_RETURN(!pWin, BadWindow);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ PanoramiXMapped = TRUE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
+ {
+ stuff->id = pPanoramiXWin->info[j].id;
+ result = (*SavedProcVector[X_UnmapSubwindows])(client);
+ }
+
+ /* clean up */
+ PanoramiXMapped = FALSE;
+ PanoramiXVisibilityNotifySent = FALSE;
+ pPanoramiXWin->VisibilitySent = FALSE;
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->id, client,SecurityReadAccess);
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
+ if (pPanoramiXWin)
+ pPanoramiXWin->VisibilitySent = FALSE;
+ }
+ PANORAMIX_FREE(client);
+ return (client->noClientException);
+}
+
+
+int PanoramiXConfigureWindow(register ClientPtr client)
+{
+ register WindowPtr pWin;
+ REQUEST(xConfigureWindowReq);
+ register int result;
+ unsigned len, i, things;
+ register Mask orig_mask;
+ int j, sib_position;
+ Window winID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXSib = NULL;
+ int x_off = 0, y_off = 0;
+ XID *pStuff;
+ XID *origStuff, *modStuff;
+ Mask local_mask;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
+ len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
+ things = Ones((Mask)stuff->mask);
+ IF_RETURN((things != len), BadLength);
+ orig_mask = stuff->mask;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ if (!pPanoramiXWin) {
+ client->errorValue = stuff->window;
+ return (BadWindow);
+ }
+ if (things > 0) {
+ pStuff = (XID *) ALLOCATE_LOCAL(things * sizeof(XID));
+ memcpy((char *) pStuff, (char *) &stuff[1], things * sizeof(XID));
+ local_mask = (CWSibling | CWX | CWY) & ((Mask) stuff->mask);
+ if (local_mask & CWSibling) {
+ sib_position = Ones((Mask) stuff->mask & (CWSibling - 1));
+ pPanoramiXSib = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXSib, *(pStuff + sib_position));
+ }
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ winID = pPanoramiXWin->info[j].id;
+ pWin = (WindowPtr)SecurityLookupWindow(winID, client,SecurityReadAccess);
+ if (!pWin) {
+ client->errorValue = pPanoramiXWin->info[0].id;
+ return (BadWindow);
+ }
+ stuff->window = winID;
+ if (pWin->parent
+ && (pWin->parent->drawable.id == PanoramiXWinRoot->info[j].id)) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modStuff = (XID *) &stuff[1];
+ origStuff = pStuff;
+ i = things;
+ if (local_mask & CWX) {
+ *modStuff++ = *origStuff++ - x_off;
+ i--;
+ }
+ if (local_mask & CWY) {
+ *modStuff++ = *origStuff++ - y_off;
+ i--;
+ }
+ for ( ; i; i--)
+ *modStuff++ = *origStuff++;
+ if (pPanoramiXSib)
+ *((XID *) &stuff[1] + sib_position) = pPanoramiXSib->info[j].id;
+ stuff->mask = orig_mask;
+ result = (*SavedProcVector[X_ConfigureWindow])(client);
+ }
+ DEALLOCATE_LOCAL(pStuff);
+ PANORAMIX_FREE(client);
+ return (result);
+ } else
+ return (client->noClientException);
+}
+
+
+int PanoramiXCirculateWindow(register ClientPtr client)
+{
+ REQUEST(xCirculateWindowReq);
+ int j,result;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+
+ REQUEST_SIZE_MATCH(xCirculateWindowReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = (*SavedProcVector[X_CirculateWindow])(client);
+ }
+ return (result);
+}
+
+
+int PanoramiXGetGeometry(register ClientPtr client)
+{
+ xGetGeometryReply rep;
+ register DrawablePtr pDraw;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ VERIFY_GEOMETRABLE (pDraw, stuff->id, client);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep.depth = pDraw->depth;
+
+ if (stuff->id == PanoramiXWinRoot->info[0].id) {
+ xWindowRoot *root = (xWindowRoot *)
+ (ConnectionInfo + connBlockScreenStart);
+
+ rep.width = root->pixWidth;
+ rep.height = root->pixHeight;
+ } else {
+ rep.width = pDraw->width;
+ rep.height = pDraw->height;
+ }
+
+ /* XXX - Because the pixmap-implementation of the multibuffer extension
+ * may have the buffer-id's drawable resource value be a pointer
+ * to the buffer's window instead of the buffer itself
+ * (this happens if the buffer is the displayed buffer),
+ * we also have to check that the id matches before we can
+ * truly say that it is a DRAWABLE_WINDOW.
+ */
+
+ if ((pDraw->type == UNDRAWABLE_WINDOW) ||
+ ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) {
+ register WindowPtr pWin = (WindowPtr)pDraw;
+ rep.x = pWin->origin.x - wBorderWidth (pWin);
+ rep.y = pWin->origin.y - wBorderWidth (pWin);
+ rep.borderWidth = pWin->borderWidth;
+ } else { /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */
+ rep.x = rep.y = rep.borderWidth = 0;
+ }
+ WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
+ return (client->noClientException);
+}
+
+
+int PanoramiXChangeProperty(ClientPtr client)
+{
+ int result, j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ REQUEST(xChangePropertyReq);
+
+
+ REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_ChangeProperty])(client);
+ if (result != Success) {
+ stuff->window = pPanoramiXWin->info[0].id;
+ break;
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXDeleteProperty(ClientPtr client)
+{
+ int result, j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ REQUEST(xDeletePropertyReq);
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xDeletePropertyReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->window = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_DeleteProperty])(client);
+ BREAK_IF(result != Success);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXSendEvent(ClientPtr client)
+{
+ int result, j;
+ BYTE orig_type;
+ Mask orig_eventMask;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ REQUEST(xSendEventReq);
+
+ REQUEST_SIZE_MATCH(xSendEventReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->destination);
+ orig_type = stuff->event.u.u.type;
+ orig_eventMask = stuff->eventMask;
+ if (!pPanoramiXWin) {
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_SendEvent])(client);
+ noPanoramiXExtension = FALSE;
+ }
+ else {
+ noPanoramiXExtension = FALSE;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->destination = pPanoramiXWin->info[j].id;
+ stuff->eventMask = orig_eventMask;
+ stuff->event.u.u.type = orig_type;
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_SendEvent])(client);
+ noPanoramiXExtension = FALSE;
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXCreatePixmap(register ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ REQUEST(xCreatePixmapReq);
+ int result, j;
+ Pixmap pmapID;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXPmap *pPanoramiXPmap;
+ PanoramiXPmap *localPmap;
+ XID orig_pid;
+
+
+ REQUEST_SIZE_MATCH(xCreatePixmapReq);
+ client->errorValue = stuff->pid;
+
+ localPmap =(PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
+ IF_RETURN(!localPmap, BadAlloc);
+
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
+RC_DRAWABLE,
+ SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+
+ pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+
+ orig_pid = stuff->pid;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXPmap, j) {
+ pmapID = j ? FakeClientID(client->index) : orig_pid;
+ localPmap->info[j].id = pmapID;
+ }
+ localPmap->FreeMe = FALSE;
+ PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
+ pPanoramiXPmap->next = localPmap;
+
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->pid = localPmap->info[j].id;
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ result = (* SavedProcVector[X_CreatePixmap])(client);
+ BREAK_IF(result != Success);
+ }
+ if (result != Success) {
+ pPanoramiXPmap->next = NULL;
+ if (localPmap)
+ Xfree(localPmap);
+ }
+ return (result);
+}
+
+
+int PanoramiXFreePixmap(ClientPtr client)
+{
+ int result, j;
+ PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
+ PanoramiXPmap *pPanoramiXPmapback = NULL;
+ REQUEST(xResourceReq);
+
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ for (; pPanoramiXPmap && (pPanoramiXPmap->info[0].id != stuff->id);
+ pPanoramiXPmap = pPanoramiXPmap->next)
+ pPanoramiXPmapback = pPanoramiXPmap;
+ if (!pPanoramiXPmap)
+ result = (* SavedProcVector[X_FreePixmap])(client);
+ else {
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->id = pPanoramiXPmap->info[j].id;
+ result = (* SavedProcVector[X_FreePixmap])(client);
+ }
+ if ((result == Success) && pPanoramiXPmapback &&
+ pPanoramiXPmap && pPanoramiXPmap->FreeMe ) {
+ pPanoramiXPmapback->next = pPanoramiXPmap->next;
+ Xfree(pPanoramiXPmap);
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXCreateGC(register ClientPtr client)
+{
+ int result, j;
+ DrawablePtr pDraw;
+ unsigned len;
+ REQUEST(xCreateGCReq);
+ GContext GCID;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *localGC;
+ PanoramiXGC *pPanoramiXGC;
+ PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
+ PanoramiXPmap *pPanoramiXClip = NULL;
+ int tile_offset, stip_offset, clip_offset;
+ XID orig_GC;
+
+ REQUEST_AT_LEAST_SIZE(xCreateGCReq);
+ client->errorValue = stuff->gc;
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
+RC_DRAWABLE,
+ SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+
+ len = client->req_len - (sizeof(xCreateGCReq) >> 2);
+ IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
+ localGC = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
+ IF_RETURN(!localGC, BadAlloc);
+ orig_GC = stuff->gc;
+ if ((Mask)stuff->mask & GCTile) {
+ XID tileID;
+
+ tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
+ tileID = *((CARD32 *) &stuff[1] + tile_offset);
+ if (tileID) {
+ pPanoramiXTile = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ }
+ }
+ if ((Mask)stuff->mask & GCStipple) {
+ XID stipID;
+
+ stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
+ stipID = *((CARD32 *) &stuff[1] + stip_offset);
+ if (stipID) {
+ pPanoramiXStip = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ }
+ }
+ if ((Mask)stuff->mask & GCClipMask) {
+ XID clipID;
+
+ clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
+ clipID = *((CARD32 *) &stuff[1] + clip_offset);
+ if (clipID) {
+ pPanoramiXClip = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ }
+ }
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
+ GCID = j ? FakeClientID(client->index) : orig_GC;
+ localGC->info[j].id = GCID;
+ }
+ localGC->FreeMe = FALSE;
+ PANORAMIXFIND_LAST(pPanoramiXGC, PanoramiXGCRoot);
+ pPanoramiXGC->next = localGC;
+
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->gc = localGC->info[j].id;
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ if (pPanoramiXTile)
+ *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
+ if (pPanoramiXStip)
+ *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
+ if (pPanoramiXClip)
+ *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
+ result = (* SavedProcVector[X_CreateGC])(client);
+ BREAK_IF(result != Success);
+ }
+ if (result != Success) {
+ pPanoramiXGC->next = NULL;
+ Xfree(localGC);
+ }
+ return (result);
+}
+
+int PanoramiXChangeGC(ClientPtr client)
+{
+ GC *pGC;
+ REQUEST(xChangeGCReq);
+ int result, j;
+ unsigned len;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
+ PanoramiXPmap *pPanoramiXClip = NULL;
+ int tile_offset, stip_offset, clip_offset;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_AT_LEAST_SIZE(xChangeGCReq);
+ VERIFY_GC(pGC, stuff->gc, client);
+ len = client->req_len - (sizeof(xChangeGCReq) >> 2);
+ IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ if ((Mask)stuff->mask & GCTile) {
+ XID tileID;
+
+ tile_offset = Ones((Mask)stuff->mask & (GCTile -1) );
+ tileID = *((CARD32 *) &stuff[1] + tile_offset);
+ if (tileID) {
+ pPanoramiXTile = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ }
+ }
+ if ((Mask)stuff->mask & GCStipple) {
+ XID stipID;
+
+ stip_offset = Ones((Mask)stuff->mask & (GCStipple -1 ));
+ stipID = *((CARD32 *) &stuff[1] + stip_offset);
+ if (stipID) {
+ pPanoramiXStip = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ }
+ }
+ if ((Mask)stuff->mask & GCClipMask) {
+ XID clipID;
+
+ clip_offset = Ones((Mask)stuff->mask & (GCClipMask -1));
+ clipID = *((CARD32 *) &stuff[1] + clip_offset);
+ if (clipID) {
+ pPanoramiXClip = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ }
+ }
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXTile)
+ *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
+ if (pPanoramiXStip)
+ *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
+ if (pPanoramiXClip)
+ *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
+ result = (* SavedProcVector[X_ChangeGC])(client);
+ BREAK_IF(result != Success);
+ }
+ if (pPanoramiXTile || pPanoramiXStip || pPanoramiXClip)
+ {
+ PANORAMIX_FREE(client);
+ }
+ return (result);
+}
+
+
+int PanoramiXCopyGC(ClientPtr client)
+{
+ int j, result;
+ PanoramiXGC *pPanoramiXGCSrc = PanoramiXGCRoot;
+ PanoramiXGC *pPanoramiXGCDst = PanoramiXGCRoot;
+ REQUEST(xCopyGCReq);
+
+ REQUEST_SIZE_MATCH(xCopyGCReq);
+ PANORAMIXFIND_ID(pPanoramiXGCSrc, stuff->srcGC);
+ IF_RETURN(!pPanoramiXGCSrc, BadGC);
+ PANORAMIXFIND_ID(pPanoramiXGCDst, stuff->dstGC);
+ IF_RETURN(!pPanoramiXGCDst, BadGC);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGCDst, j) {
+ stuff->srcGC = pPanoramiXGCSrc->info[j].id;
+ stuff->dstGC = pPanoramiXGCDst->info[j].id;
+ result = (* SavedProcVector[X_CopyGC])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXSetDashes(ClientPtr client)
+{
+ GC *pGC;
+ REQUEST(xSetDashesReq);
+ int result, j;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+
+ REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
+ VERIFY_GC(pGC, stuff->gc, client);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_SetDashes])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXSetClipRectangles(register ClientPtr client)
+{
+ int result;
+ REQUEST(xSetClipRectanglesReq);
+ int j;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+
+ REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_SetClipRectangles])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXFreeGC(ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int result, j;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ PanoramiXGC *pPanoramiXGCback = NULL;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ for (; pPanoramiXGC && (pPanoramiXGC->info[0].id != stuff->id);
+ pPanoramiXGC = pPanoramiXGC->next)
+ pPanoramiXGCback = pPanoramiXGC;
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
+ stuff->id = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_FreeGC])(client);
+ BREAK_IF(result != Success);
+ }
+ if ((result == Success) && pPanoramiXGCback &&
+ pPanoramiXGC && pPanoramiXGC->FreeMe) {
+ pPanoramiXGCback->next = pPanoramiXGC->next;
+ if (pPanoramiXGC)
+ Xfree(pPanoramiXGC);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXClearToBackground(register ClientPtr client)
+{
+ REQUEST(xClearAreaReq);
+ register WindowPtr pWin;
+ int result, j;
+ Window winID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int orig_x, orig_y;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xClearAreaReq);
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ winID = pPanoramiXWin->info[j].id;
+ pWin = (WindowPtr) SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!pWin) {
+ client->errorValue = pPanoramiXWin->info[0].id;
+ return (BadWindow);
+ }
+ stuff->window = winID;
+ if (pWin->drawable.id == PanoramiXWinRoot->info[j].id) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = (*SavedProcVector[X_ClearArea])(client);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+/*
+ CopyArea and CopyPlane are not correct yet. We still need to
+ take care of the case where src and dst are windows on different
+ screens. DEC's original code tried to do this but segfaults
+ during xtest. I will rewrite it eventually but for now it has
+ been removed. There are also problems with expose events.
+ At the moment, each screen sends an event for its part. These
+ should be combined and sent as one event.
+*/
+
+int PanoramiXCopyArea(ClientPtr client)
+{
+ int j, result;
+ DrawablePtr pSrc, pDst;
+ GContext GCID;
+ GC *pGC;
+ PanoramiXWindow *pPanoramiXSrcRoot;
+ PanoramiXWindow *pPanoramiXDstRoot;
+ PanoramiXWindow *pPanoramiXSrc;
+ PanoramiXWindow *pPanoramiXDst;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ REQUEST(xCopyAreaReq);
+ int srcx = stuff->srcX, srcy = stuff->srcY;
+ int dstx = stuff->dstX, dsty = stuff->dstY;
+
+ REQUEST_SIZE_MATCH(xCopyAreaReq);
+
+ VERIFY_DRAWABLE(pDst, stuff->dstDrawable, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
+ if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ } else
+ pSrc = pDst;
+
+ pPanoramiXSrcRoot = (pSrc->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXDstRoot = (pDst->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXSrc = pPanoramiXSrcRoot;
+ pPanoramiXDst = pPanoramiXDstRoot;
+ PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
+ IF_RETURN(!pPanoramiXSrc, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
+ IF_RETURN(!pPanoramiXDst, BadDrawable);
+ GCID = stuff->gc;
+ PANORAMIXFIND_ID(pPanoramiXGC, GCID);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+
+ FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
+ stuff->dstDrawable = pPanoramiXDst->info[j].id;
+ stuff->srcDrawable = pPanoramiXSrc->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXSrc == pPanoramiXSrcRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ }
+ if (pPanoramiXDst == pPanoramiXDstRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ }
+
+ result = (* SavedProcVector[X_CopyArea])(client);
+
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXCopyPlane(ClientPtr client)
+{
+ int j, result;
+ DrawablePtr pSrc, pDst;
+ GContext GCID;
+ GC *pGC;
+ PanoramiXWindow *pPanoramiXSrcRoot;
+ PanoramiXWindow *pPanoramiXDstRoot;
+ PanoramiXWindow *pPanoramiXSrc;
+ PanoramiXWindow *pPanoramiXDst;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ REQUEST(xCopyPlaneReq);
+ int srcx = stuff->srcX, srcy = stuff->srcY;
+ int dstx = stuff->dstX, dsty = stuff->dstY;
+
+ REQUEST_SIZE_MATCH(xCopyPlaneReq);
+
+ VERIFY_DRAWABLE(pDst, stuff->dstDrawable, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
+ if (pDst->pScreen != pSrc->pScreen) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ } else {
+ pSrc = pDst;
+ }
+
+ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ (stuff->bitPlane > (1L << (pSrc->depth - 1))))
+ {
+ client->errorValue = stuff->bitPlane;
+ return(BadValue);
+ }
+
+ pPanoramiXSrcRoot = (pSrc->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXDstRoot = (pDst->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXSrc = pPanoramiXSrcRoot;
+ pPanoramiXDst = pPanoramiXDstRoot;
+ PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
+ IF_RETURN(!pPanoramiXSrc, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
+ IF_RETURN(!pPanoramiXDst, BadDrawable);
+ GCID = stuff->gc;
+ PANORAMIXFIND_ID(pPanoramiXGC, GCID);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+
+ FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
+ stuff->dstDrawable = pPanoramiXDst->info[j].id;
+ stuff->srcDrawable = pPanoramiXSrc->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXSrc == pPanoramiXSrcRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ }
+ if (pPanoramiXDst == pPanoramiXDstRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ }
+ result = (* SavedProcVector[X_CopyPlane])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXPolyPoint(ClientPtr client)
+{
+ int result, npoint, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xPoint *origPts;
+ xPoint *origPtr, *modPtr;
+ REQUEST(xPolyPointReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyPointReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
+ RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
+ if (npoint > 0) {
+ origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+ memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xPoint *) &stuff[1];
+ origPtr = origPts;
+ for (i = npoint; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr++->y = origPtr++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyPoint])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origPts);
+ return (result);
+ }else
+ return (client->noClientException);
+
+}
+
+
+int PanoramiXPolyLine(ClientPtr client)
+{
+ int result, npoint, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xPoint *origPts;
+ xPoint *origPtr, *modPtr;
+ REQUEST(xPolyLineReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyLineReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
+RC_DRAWABLE,
+ SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
+ /* In the case of Multibuffering, we need to make sure the drawable
+ isn't really a pixmap associated to a drawable */
+ if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
+ pPanoramiXWin = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ }
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
+ if (npoint > 0){
+ origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+ memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xPoint *) &stuff[1];
+ origPtr = origPts;
+ for (i = npoint; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr++->y = origPtr++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyLine])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origPts);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXPolySegment(ClientPtr client)
+{
+ int result, nsegs, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xSegment *origSegs;
+ xSegment *origPtr, *modPtr;
+ REQUEST(xPolySegmentReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ /* In the case of Multibuffering, we need to make sure the drawable
+ isn't really a pixmap associated to a drawable */
+ if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
+ pPanoramiXWin = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ }
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
+ IF_RETURN((nsegs & 4), BadLength);
+ nsegs >>= 3;
+ if (nsegs > 0) {
+ origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
+ memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xSegment *) &stuff[1];
+ origPtr = origSegs;
+ for (i = nsegs; i; i--) {
+ modPtr->x1 = origPtr->x1 - x_off;
+ modPtr->y1 = origPtr->y1 - y_off;
+ modPtr->x2 = origPtr->x2 - x_off;
+ modPtr++->y2 = origPtr++->y2 - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolySegment])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origSegs);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXPolyRectangle(ClientPtr client)
+{
+ int result, nrects, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xRectangle *origRecs;
+ xRectangle *origPtr, *modPtr;
+ REQUEST(xPolyRectangleReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
+ IF_RETURN((nrects & 4), BadLength);
+ nrects >>= 3;
+ if (nrects > 0){
+ origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+ memcpy((char *) origRecs, (char *) &stuff[1], nrects * sizeof(xRectangle));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xRectangle *) &stuff[1];
+ origPtr = origRecs;
+ for (i = nrects; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr->y = origPtr->y - y_off;
+ modPtr->width = origPtr->width;
+ modPtr++->height = origPtr++->height;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyRectangle])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origRecs);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXPolyArc(ClientPtr client)
+{
+ int result, narcs, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xArc *origArcs;
+ xArc *origPtr, *modPtr;
+ REQUEST(xPolyArcReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyArcReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
+ IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ narcs /= sizeof(xArc);
+ if (narcs > 0){
+ origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xArc *) &stuff[1];
+ origPtr = origArcs;
+ for (i = narcs; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr++->y = origPtr++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyArc])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXFillPoly(ClientPtr client)
+{
+ int result, count, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ DDXPointPtr locPts;
+ DDXPointPtr origPts, modPts;
+ REQUEST(xFillPolyReq);
+
+ REQUEST_AT_LEAST_SIZE(xFillPolyReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
+ if (count > 0){
+ locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
+ memcpy((char *) locPts, (char *) &stuff[1], count * sizeof(DDXPointRec));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPts = (DDXPointPtr) &stuff[1];
+ origPts = locPts;
+ for (i = count; i; i--) {
+ modPts->x = origPts->x - x_off;
+ modPts++->y = origPts++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_FillPoly])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(locPts);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXPolyFillRectangle(ClientPtr client)
+{
+ int result, things, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xRectangle *origThings;
+ xRectangle *origPtr, *modPtr;
+ REQUEST(xPolyFillRectangleReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
+ IF_RETURN((things & 4), BadLength);
+ things >>= 3;
+ if (things > 0){
+ origThings = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
+ memcpy((char *) origThings, (char *)&stuff[1], things * sizeof(xRectangle));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xRectangle *) &stuff[1];
+ origPtr = origThings;
+ for (i = things; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr++->y = origPtr++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyFillRectangle])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origThings);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+int PanoramiXPolyFillArc(ClientPtr client)
+{
+ int result, arcs, i, j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr locDraw;
+ int x_off = 0, y_off = 0;
+ xArc *origArcs;
+ xArc *origPtr, *modPtr;
+ REQUEST(xPolyFillArcReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!locDraw, BadDrawable);
+ pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ arcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
+ IF_RETURN((arcs % sizeof(xArc)), BadLength);
+ arcs /= sizeof(xArc);
+ if (arcs > 0) {
+ origArcs = (xArc *) ALLOCATE_LOCAL(arcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *)&stuff[1], arcs * sizeof(xArc));
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ if (pPanoramiXWin == PanoramiXWinRoot) {
+ x_off = panoramiXdataPtr[j].x;
+ y_off = panoramiXdataPtr[j].y;
+ }
+ modPtr = (xArc *) &stuff[1];
+ origPtr = origArcs;
+ for (i = arcs; i; i--) {
+ modPtr->x = origPtr->x - x_off;
+ modPtr++->y = origPtr++->y - y_off;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PolyFillArc])(client);
+ BREAK_IF(result != Success);
+ }
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ }else
+ return (client->noClientException);
+}
+
+
+/* 64-bit server notes: the protocol restricts padding of images to
+ * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
+ * to use internally. Removes need for internal alignment checking.
+ * All of the PutImage functions could be changed individually, but
+ * as currently written, they call other routines which require things
+ * to be 64-bit padded on scanlines, so we changed things here.
+ * If an image would be padded differently for 64- versus 32-, then
+ * copy each scanline to a 64-bit padded scanline.
+ * Also, we need to make sure that the image is aligned on a 64-bit
+ * boundary, even if the scanlines are padded to our satisfaction.
+ */
+
+int PanoramiXPutImage(register ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ int j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ int orig_x, orig_y;
+ int result;
+
+
+ REQUEST(xPutImageReq);
+
+ REQUEST_AT_LEAST_SIZE(xPutImageReq);
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin,BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->dstX;
+ orig_y = stuff->dstY;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->dstX = orig_x - panoramiXdataPtr[j].x;
+ stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ }
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ result = (* SavedProcVector[X_PutImage])(client);
+ }
+ return(result);
+}
+
+
+typedef struct _SrcParts{
+ int x1, y1, x2, y2, width, ByteWidth;
+ char *buf;
+} SrcPartsRec;
+
+
+int PanoramiXGetImage(register ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ int nlines, linesPerBuf;
+ register int height, linesDone;
+ long widthBytesLine, length;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ long widthBytesLineProto, lengthProto;
+ char *tmpImage;
+#endif
+ Mask plane;
+ char *pBuf;
+ xGetImageReply xgi;
+ int j, k, ScrNum;
+ DrawablePtr locDraw;
+ SrcPartsRec srcParts;
+ BoxRec SrcBox;
+ char *BufPtr, *PartPtr;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST(xGetImageReq);
+
+ height = stuff->height;
+ REQUEST_SIZE_MATCH(xGetImageReq);
+ if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
+ client->errorValue = stuff->format;
+ return(BadValue);
+ }
+ VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+ ScrNum = 0;
+ if (stuff->drawable == PanoramiXWinRoot->info[0].id) {
+ for (j = 0; j <= (PanoramiXNumScreens - 1); j++) {
+ ScrNum = j;
+ VERIFY_DRAWABLE(pDraw, pPanoramiXWin->info[ScrNum].id, client);
+ if (stuff->x < panoramiXdataPtr[ScrNum].x &&
+ stuff->y < panoramiXdataPtr[ScrNum].y )
+ break;
+ }
+ }
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ if (!((WindowPtr) pDraw)->realized /* Check for viewable */
+ || pDraw->x + stuff->x < 0 /* Check for on screen */
+ || pDraw->x + stuff->x + (int)stuff->width > PanoramiXPixWidth
+ || pDraw->y + stuff->y < 0
+ || pDraw->y + stuff->y + height > PanoramiXPixHeight
+ || stuff->x < - wBorderWidth((WindowPtr)pDraw) /* Inside border */
+ || stuff->x + (int)stuff->width >
+ wBorderWidth((WindowPtr)pDraw) + (int) pDraw->width
+ + panoramiXdataPtr[ScrNum].x
+ || stuff->y < -wBorderWidth((WindowPtr)pDraw)
+ || stuff->y + height >
+ wBorderWidth ((WindowPtr)pDraw) + (int) pDraw->height
+ + panoramiXdataPtr[ScrNum].y)
+ return(BadMatch);
+ VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+ xgi.visual = wVisual (((WindowPtr) pDraw));
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ } else {
+ if (stuff->x < 0 || stuff->x + (int)stuff->width > pDraw->width
+ || stuff->y < 0 || stuff->y + height > pDraw->height)
+ return(BadMatch);
+ xgi.visual = None;
+ }
+ xgi.type = X_Reply;
+ xgi.sequenceNumber = client->sequence;
+ xgi.depth = pDraw->depth;
+ if (stuff->format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
+ length = widthBytesLine * height;
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
+ lengthProto = widthBytesLineProto * height;
+#endif
+ } else {
+ widthBytesLine = BitmapBytePad(stuff->width);
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = widthBytesLine * height *
+ Ones(stuff->planeMask & (plane | (plane - 1)));
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLineProto = BitmapBytePadProto(stuff->width);
+ lengthProto = widthBytesLineProto * height *
+ Ones(stuff->planeMask & (plane | (plane - 1)));
+#endif
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ xgi.length = (lengthProto + 3) >> 2;
+#else
+ xgi.length = (length + 3) >> 2;
+#endif
+
+ if (widthBytesLine == 0 || height == 0) {
+ linesPerBuf = 0;
+ } else if (widthBytesLine >= IMAGE_BUFSIZE) {
+ linesPerBuf = 1;
+ } else {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height) {
+
+ /*
+ * Have to make sure intermediate buffers don't need padding
+ */
+
+ while ((linesPerBuf > 1)
+ && (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))) {
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
+ while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)) {
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ IF_RETURN((!(pBuf = (char *) ALLOCATE_LOCAL(length))), BadAlloc);
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /*
+ * Check for protocol/server padding differences
+ */
+
+ if (widthBytesLine != widthBytesLineProto)
+ if (!(tmpImage = (char *) ALLOCATE_LOCAL(length))) {
+ DEALLOCATE_LOCAL(pBuf);
+ return (BadAlloc);
+ }
+#endif
+
+ WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
+
+ if (linesPerBuf == 0) {
+
+ /*
+ * Nothing to do
+ */
+
+ } else if (stuff->format == ZPixmap) {
+ linesDone = 0;
+ while (height - linesDone > 0) {
+ nlines = min(linesPerBuf, height - linesDone);
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ int Bpp = BitsPerPixel(pDraw->depth) >> 3;
+
+ SrcBox.x1 = pDraw->x + stuff->x;
+ SrcBox.y1 = pDraw->y + stuff->y + linesDone;
+ SrcBox.x2 = SrcBox.x1 + stuff->width;
+ SrcBox.y2 = SrcBox.y1 + nlines;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+
+ /*
+ * If it isn't even on this screen, just continue.
+ */
+
+ if ((SrcBox.x1 >= panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)
+ || (SrcBox.x2 <= panoramiXdataPtr[j].x)
+ || (SrcBox.y1 >= panoramiXdataPtr[j].y+panoramiXdataPtr[j].height)
+ || (SrcBox.y2 <= panoramiXdataPtr[j].y))
+ continue;
+
+ srcParts.x1 = max(SrcBox.x1 - panoramiXdataPtr[j].x, 0);
+ srcParts.x2 = min(SrcBox.x2 - panoramiXdataPtr[j].x,
+ panoramiXdataPtr[j].width);
+ srcParts.y1 = max(SrcBox.y1 - panoramiXdataPtr[j].y, 0);
+ srcParts.y2 = min(SrcBox.y2 - panoramiXdataPtr[j].y,
+ panoramiXdataPtr[j].height);
+ srcParts.width = srcParts.x2 - srcParts.x1;
+
+ srcParts.ByteWidth = PixmapBytePad(srcParts.width,pDraw->depth);
+ srcParts.buf = (char *) Xalloc(nlines * srcParts.ByteWidth);
+ locDraw = (DrawablePtr) SecurityLookupIDByClass(client,
+ pPanoramiXWin->info[j].id,
+ RC_DRAWABLE,
+ SecurityReadAccess);
+ (*pDraw->pScreen->GetImage)(locDraw,
+ srcParts.x1 - locDraw->x,
+ srcParts.y1 - locDraw->y,
+ srcParts.width,
+ srcParts.y2 - srcParts.y1,
+ stuff->format,
+ (unsigned long)stuff->planeMask,
+ srcParts.buf);
+
+ BufPtr = pBuf
+ + (Bpp * (srcParts.x1 - stuff->x - (pDraw->x - panoramiXdataPtr[j].x)))
+ + widthBytesLine * (srcParts.y1 - stuff->y
+ - (pDraw->y + linesDone - panoramiXdataPtr[j].y));
+ PartPtr = srcParts.buf;
+
+ for (k = (srcParts.y2 - srcParts.y1); k; k--) {
+ memmove(BufPtr, PartPtr, srcParts.width * Bpp);
+ BufPtr += widthBytesLine;
+ PartPtr += srcParts.ByteWidth;
+ }
+ Xfree(srcParts.buf);
+ }
+ } else {
+ (*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y + linesDone,
+ stuff->width, nlines, stuff->format,
+ (unsigned long)stuff->planeMask, pBuf);
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /*
+ * For 64-bit server, convert image to pad to 32 bits
+ */
+
+ if ( widthBytesLine != widthBytesLineProto ) {
+ register char * bufPtr, * protoPtr;
+ register int i;
+
+ bzero(tmpImage,length);
+
+ for (i = 0, bufPtr = pBuf, protoPtr = tmpImage; i < nlines;
+ bufPtr += widthBytesLine, protoPtr += widthBytesLineProto,
+ i++)
+ memmove(protoPtr,bufPtr,widthBytesLineProto);
+
+ /*
+ * Note this is NOT a call to WriteSwappedDataToClient,
+ * as we do NOT byte swap
+ */
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLineProto), tmpImage);
+ } else
+#endif
+ {
+
+ /*
+ * Note this is NOT a call to WriteSwappedDataToClient,
+ * as we do NOT byte swap
+ */
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine), pBuf);
+ }
+ linesDone += nlines;
+ }
+ } else { /* XYPixmap */
+ for (; plane; plane >>= 1) {
+ if (stuff->planeMask & plane) {
+ linesDone = 0;
+ while (height - linesDone > 0) {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ stuff->x,
+ stuff->y + linesDone,
+ stuff->width,
+ nlines,
+ stuff->format,
+ (unsigned long)plane,
+ pBuf);
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /*
+ * For 64-bit server, convert image to pad to 32 bits
+ */
+
+ if (widthBytesLine != widthBytesLineProto) {
+ register char * bufPtr, * protoPtr;
+ register int i;
+
+ bzero(tmpImage, length);
+
+ for (i = 0,bufPtr = pBuf,protoPtr =tmpImage; i < nlines;
+ bufPtr += widthBytesLine,
+ protoPtr += widthBytesLineProto,
+ i++)
+ memmove(protoPtr, bufPtr, widthBytesLineProto);
+
+ /*
+ * Note: NOT a call to WriteSwappedDataToClient,
+ * as we do NOT byte swap
+ */
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLineProto), tmpImage);
+ } else
+#endif
+ {
+
+ /*
+ * Note: NOT a call to WriteSwappedDataToClient,
+ * as we do NOT byte swap
+ */
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine), pBuf);
+ }
+ linesDone += nlines;
+ }
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(pBuf);
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if (widthBytesLine != widthBytesLineProto)
+ DEALLOCATE_LOCAL(tmpImage);
+#endif
+ return (client->noClientException);
+}
+
+
+int
+PanoramiXPolyText8(register ClientPtr client)
+{
+ int result, j;
+
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr pDraw;
+ int orig_x, orig_y;
+ REQUEST(xPolyTextReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ /* In the case of Multibuffering, we need to make sure the drawable
+ isn't really a pixmap associated to a drawable */
+ if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
+ pPanoramiXWin = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ }
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ stuff->x = orig_x;
+ stuff->y = orig_y;
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (*SavedProcVector[X_PolyText8])(client);
+ noPanoramiXExtension = FALSE;
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+int
+PanoramiXPolyText16(register ClientPtr client)
+{
+ int result, j;
+
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr pDraw;
+ int orig_x, orig_y;
+ REQUEST(xPolyTextReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ /* In the case of Multibuffering, we need to make sure the drawable
+ isn't really a pixmap associated to a drawable */
+ if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
+ pPanoramiXWin = PanoramiXPmapRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ }
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ stuff->x = orig_x;
+ stuff->y = orig_y;
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (*SavedProcVector[X_PolyText16])(client);
+ noPanoramiXExtension = FALSE;
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+
+int PanoramiXImageText8(ClientPtr client)
+{
+ int result, j;
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr pDraw;
+ int orig_x, orig_y;
+ REQUEST(xImageTextReq);
+
+ REQUEST_AT_LEAST_SIZE(xImageTextReq);
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = (*SavedProcVector[X_ImageText8])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXImageText16(ClientPtr client)
+{
+ int result, j;
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ DrawablePtr pDraw;
+ int orig_x, orig_y;
+ REQUEST(xImageTextReq);
+
+ REQUEST_AT_LEAST_SIZE(xImageTextReq);
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin, BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->x;
+ orig_y = stuff->y;
+ FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->x = orig_x - panoramiXdataPtr[j].x;
+ stuff->y = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = (*SavedProcVector[X_ImageText16])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXCreateColormap(register ClientPtr client)
+{
+ Colormap mid;
+ register WindowPtr pWin;
+ ScreenPtr pScreen;
+
+ REQUEST(xCreateColormapReq);
+
+ int result;
+ int j = 0;
+ VisualID orig_visual;
+ Colormap cmapID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXCmap *localCmap;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+
+ REQUEST_SIZE_MATCH(xCreateColormapReq);
+
+ mid = stuff->mid;
+ orig_visual = stuff->visual;
+ j = 0;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
+ if (pPanoramiXWin) {
+ localCmap = (PanoramiXCmap *)Xcalloc(sizeof(PanoramiXCmap));
+ IF_RETURN(!localCmap, BadAlloc);
+ } else {
+ return BadWindow;
+ }
+ for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
+ cmapID = j ? FakeClientID(client->index) : mid;
+ localCmap->info[j].id = cmapID;
+ }
+ localCmap->FreeMe = FALSE;
+ PANORAMIXFIND_LAST(pPanoramiXCmap, PanoramiXCmapRoot);
+ pPanoramiXCmap->next = localCmap;
+
+ /* Use Screen 0 to get the matching Visual ID */
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityReadAccess);
+
+ if (!pWin)
+ return(BadWindow);
+ pScreen = pWin->drawable.pScreen;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ stuff->mid = localCmap->info[j].id;
+ stuff->window = pPanoramiXWin->info[j].id;
+ if ( orig_visual != CopyFromParent )
+ stuff->visual = PanoramiXVisualTable[orig_visual][j];
+ result = (* SavedProcVector[X_CreateColormap])(client);
+ BREAK_IF(result != Success);
+ }
+ if (result != Success) {
+ pPanoramiXCmap->next = NULL ;
+ if (localCmap)
+ Xfree(localCmap);
+ }
+ return (result);
+}
+
+
+int PanoramiXFreeColormap(ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ PanoramiXCmap *pPanoramiXCmapback = NULL;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+
+ for (; pPanoramiXCmap && (pPanoramiXCmap->info[0].id != stuff->id);
+ pPanoramiXCmap = pPanoramiXCmap->next)
+ pPanoramiXCmapback = pPanoramiXCmap;
+ IF_RETURN(!pPanoramiXCmap, BadColor);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->id = pPanoramiXCmap->info[j].id;
+ result = (* SavedProcVector[X_FreeColormap])(client);
+ BREAK_IF(result != Success);
+ }
+ if ((result == Success) && pPanoramiXCmapback &&
+ pPanoramiXCmap && pPanoramiXCmap->FreeMe) {
+ pPanoramiXCmapback->next = pPanoramiXCmap->next;
+ Xfree(pPanoramiXCmap);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXInstallColormap(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
+ IF_RETURN(!pPanoramiXCmap, BadColor);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->id = pPanoramiXCmap->info[j].id;
+ result = (* SavedProcVector[X_InstallColormap])(client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXUninstallColormap(register ClientPtr client)
+{
+ REQUEST(xResourceReq);
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
+ IF_RETURN(!pPanoramiXCmap, BadColor);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->id = pPanoramiXCmap->info[j].id;
+ result = (* SavedProcVector[X_UninstallColormap])(client);
+ BREAK_IF(result != Success);
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXAllocColor(ClientPtr client)
+{
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ REQUEST(xAllocColorReq);
+
+ REQUEST_SIZE_MATCH(xAllocColorReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
+ if (!pPanoramiXCmap){
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_AllocColor])(client);
+ noPanoramiXExtension = FALSE;
+ }else {
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->cmap = pPanoramiXCmap->info[j].id;
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_AllocColor])(client);
+ noPanoramiXExtension = FALSE;
+ BREAK_IF(result != Success);
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXAllocNamedColor(ClientPtr client)
+{
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ REQUEST(xAllocNamedColorReq);
+
+ REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
+ IF_RETURN(!pPanoramiXCmap, BadColor);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->cmap = pPanoramiXCmap->info[j].id;
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_AllocNamedColor])(client);
+ noPanoramiXExtension = FALSE;
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+
+
+int PanoramiXAllocColorCells(ClientPtr client)
+{
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ REQUEST(xAllocColorCellsReq);
+
+ REQUEST_SIZE_MATCH(xAllocColorCellsReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
+ if (!pPanoramiXCmap) {
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_AllocColorCells])(client);
+ noPanoramiXExtension = FALSE;
+ }else {
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->cmap = pPanoramiXCmap->info[j].id;
+ if (!j)
+ noPanoramiXExtension = TRUE;
+ result = (* SavedProcVector[X_AllocColorCells])(client);
+ noPanoramiXExtension = FALSE;
+ /* Because id's are eventually searched for in
+ some client list, we don't check for success
+ on fake id's last id will be real, we really
+ only care about results related to real id's
+ BREAK_IF(result != Success);
+ */
+ }
+ }
+ return (result);
+}
+
+
+int PanoramiXFreeColors(register ClientPtr client)
+{
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ REQUEST(xFreeColorsReq);
+
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+
+ REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
+ IF_RETURN(!pPanoramiXCmap, BadColor);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->cmap = pPanoramiXCmap->info[j].id;
+ result = (* SavedProcVector[X_FreeColors])(client);
+ /* Because id's are eventually searched for in
+ some client list, we don't check for success
+ on fake id's last id will be real, we really
+ only care about results related to real id's */
+ }
+ PANORAMIX_FREE(client);
+ return (result);
+}
+
+
+int PanoramiXStoreColors(ClientPtr client)
+{
+ int result, j;
+ PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ REQUEST(xStoreColorsReq);
+
+ REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
+ PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
+ if (!pPanoramiXCmap)
+ result = (* SavedProcVector[X_StoreColors])(client);
+ else {
+ FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
+ stuff->cmap = pPanoramiXCmap->info[j].id;
+ result = (* SavedProcVector[X_StoreColors])(client);
+ BREAK_IF(result != Success);
+ }
+ }
+ return (result);
+}
diff --git a/xc/programs/Xserver/Xext/panoramiXstubs.c b/xc/programs/Xserver/Xext/panoramiXstubs.c
new file mode 100644
index 000000000..6974da17a
--- /dev/null
+++ b/xc/programs/Xserver/Xext/panoramiXstubs.c
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXstubs.c,v 3.6 1999/06/27 16:56:07 dawes Exp $ */
+/*
+ * HISTORY
+ * Log
+ * Revision 1.1.2.3 1996/05/21 18:18:34 Madeline_Asmus
+ * Add new dummy panoramiX routines for symbol resolution
+ * [1996/05/21 15:24:11 Madeline_Asmus]
+ *
+ * Revision 1.1.2.2 1995/12/06 19:55:26 Madeline_Asmus
+ * Build in stubs for PanoramiX for symbol resolution
+ * [1995/12/06 19:28:14 Madeline_Asmus]
+ *
+ * EndLog
+ */
+/* $TOG: panoramiXstubs.c /main/3 1997/10/30 16:04:17 kaleb $ */
+
+typedef int Bool;
+
+void *panoramiXdataPtr = 0;
+
+void PanoramiXConsolidate()
+{
+ /* Not supported with Xnest */
+}
+
+Bool PanoramiXCreateConnectionBlock()
+{
+ /* Not supported with Xnest */
+ return 0;
+}
+
+void* PanoramiXWinRoot = 0;
+
+void* PanoramiXGCRoot = 0;
+
+void* PanoramiXCmapRoot = 0;
+
+void* PanoramiXPmapRoot = 0;
+
+int PanoramiXNumScreens = 0;
+
+void PanoramiXExtensionInit()
+{
+ /* Not supported with Xnest */
+}
+
+Bool PanoramiXCreateScreenRegion()
+{
+ /* Not supported with Xnest */
+ return 0;
+}
+
+void* PanoramiXScreenRegion = 0;
+
+Bool PanoramiXWinRootFreeable = 0;
+Bool PanoramiXGCRootFreeable = 0;
+Bool PanoramiXCmapRootFreeable = 0;
+Bool PanoramiXPmapRootFreeable = 0;
+
diff --git a/xc/programs/Xserver/Xext/sampleEVI.c b/xc/programs/Xserver/Xext/sampleEVI.c
new file mode 100644
index 000000000..9b11ffcdd
--- /dev/null
+++ b/xc/programs/Xserver/Xext/sampleEVI.c
@@ -0,0 +1,97 @@
+/* $TOG: sampleEVI.c /main/2 1997/11/24 17:03:42 kaleb $ */
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+********************************************************/
+#include "X.h"
+#include "Xproto.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "dix.h"
+#define _XEVI_SERVER_
+#include "XEVIstr.h"
+#include "EVIstruct.h"
+#include "scrnintstr.h"
+static int sampleGetVisualInfo(
+ VisualID32 *visual,
+ int n_visual,
+ xExtendedVisualInfo **evi_rn,
+ int *n_info_rn,
+ VisualID32 **conflict_rn,
+ int *n_conflict_rn)
+{
+ int max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
+ VisualID32 *temp_conflict;
+ xExtendedVisualInfo *evi;
+ int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
+ register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
+ *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
+ if (!*evi_rn)
+ return BadAlloc;
+ for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
+ if (screenInfo.screens[scrI]->numVisuals > max_visuals)
+ max_visuals = screenInfo.screens[scrI]->numVisuals;
+ }
+ max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
+ temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
+ if (!temp_conflict) {
+ xfree(*evi_rn);
+ return BadAlloc;
+ }
+ for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
+ for (visualI = 0; visualI < n_visual; visualI++) {
+ evi[sz_evi].core_visual_id = visual[visualI];
+ evi[sz_evi].screen = scrI;
+ evi[sz_evi].level = 0;
+ evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
+ evi[sz_evi].transparency_value = 0;
+ evi[sz_evi].min_hw_colormaps = 1;
+ evi[sz_evi].max_hw_colormaps = 1;
+ evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
+ for (conflictI = 0; conflictI < n_conflict; conflictI++)
+ temp_conflict[sz_conflict++] = visual[visualI];
+ sz_evi++;
+ }
+ }
+ *conflict_rn = temp_conflict;
+ *n_conflict_rn = sz_conflict;
+ *n_info_rn = sz_evi;
+ return Success;
+}
+static void sampleFreeVisualInfo(
+ xExtendedVisualInfo *evi,
+ VisualID32 *conflict)
+{
+ if (evi)
+ xfree(evi);
+ if (conflict)
+ xfree(conflict);
+}
+EviPrivPtr eviDDXInit()
+{
+ static EviPrivRec eviPriv;
+ eviPriv.getVisualInfo = sampleGetVisualInfo;
+ eviPriv.freeVisualInfo = sampleFreeVisualInfo;
+ return &eviPriv;
+}
+void eviDDXReset()
+{
+}
diff --git a/xc/programs/Xserver/Xext/saver.c b/xc/programs/Xserver/Xext/saver.c
new file mode 100644
index 000000000..0539cd700
--- /dev/null
+++ b/xc/programs/Xserver/Xext/saver.c
@@ -0,0 +1,1324 @@
+/*
+ * $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $
+ * $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.2 1996/06/10 09:11:17 dawes Exp $
+ *
+Copyright (c) 1992 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "saverproto.h"
+#include "gcstruct.h"
+#include "cursorstr.h"
+#include "colormapst.h"
+
+static unsigned char ScreenSaverReqCode = 0;
+static int ScreenSaverEventBase = 0;
+
+extern DISPATCH_PROC(ProcScreenSaverQueryInfo);
+static DISPATCH_PROC(ProcScreenSaverDispatch);
+static DISPATCH_PROC(ProcScreenSaverQueryVersion);
+static DISPATCH_PROC(ProcScreenSaverSelectInput);
+static DISPATCH_PROC(ProcScreenSaverSetAttributes);
+static DISPATCH_PROC(ProcScreenSaverUnsetAttributes);
+static DISPATCH_PROC(SProcScreenSaverDispatch);
+static DISPATCH_PROC(SProcScreenSaverQueryInfo);
+static DISPATCH_PROC(SProcScreenSaverQueryVersion);
+static DISPATCH_PROC(SProcScreenSaverSelectInput);
+static DISPATCH_PROC(SProcScreenSaverSetAttributes);
+static DISPATCH_PROC(SProcScreenSaverUnsetAttributes);
+
+static Bool ScreenSaverHandle (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ int /* xstate */,
+ Bool /* force */
+#endif
+ );
+
+static Bool
+CreateSaverWindow (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+ );
+
+static Bool
+DestroySaverWindow (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+ );
+
+static void
+UninstallSaverColormap (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+ );
+
+static void
+CheckScreenPrivate (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+ );
+
+static void SScreenSaverNotifyEvent (
+#if NeedFunctionPrototypes
+ xScreenSaverNotifyEvent * /* from */,
+ xScreenSaverNotifyEvent * /* to */
+#endif
+ );
+
+static void ScreenSaverResetProc (
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+
+extern WindowPtr *WindowTable;
+
+/*
+ * each screen has a list of clients requesting
+ * ScreenSaverNotify events. Each client has a resource
+ * for each screen it selects ScreenSaverNotify input for,
+ * this resource is used to delete the ScreenSaverNotifyRec
+ * entry from the per-screen queue.
+ */
+
+static RESTYPE EventType; /* resource type for event masks */
+
+typedef struct _ScreenSaverEvent *ScreenSaverEventPtr;
+
+typedef struct _ScreenSaverEvent {
+ ScreenSaverEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
+} ScreenSaverEventRec;
+
+static int ScreenSaverFreeEvents(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+
+static Bool setEventMask (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ ClientPtr /* client */,
+ unsigned long /* mask */
+#endif
+);
+
+static unsigned long getEventMask (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ ClientPtr /* client */
+#endif
+);
+
+/*
+ * when a client sets the screen saver attributes, a resource is
+ * kept to be freed when the client exits
+ */
+
+static RESTYPE AttrType; /* resource type for attributes */
+
+typedef struct _ScreenSaverAttr {
+ ScreenPtr screen;
+ ClientPtr client;
+ XID resource;
+ short x, y;
+ unsigned short width, height, borderWidth;
+ unsigned char class;
+ unsigned char depth;
+ VisualID visual;
+ CursorPtr pCursor;
+ PixmapPtr pBackgroundPixmap;
+ PixmapPtr pBorderPixmap;
+ Colormap colormap;
+ unsigned long mask; /* no pixmaps or cursors */
+ unsigned long *values;
+} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
+
+static int ScreenSaverFreeAttr (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+
+static void FreeAttrs (
+#if NeedFunctionPrototypes
+ ScreenSaverAttrPtr /* pAttr */
+#endif
+);
+
+static void FreeScreenAttr (
+#if NeedFunctionPrototypes
+ ScreenSaverAttrPtr /* pAttr */
+#endif
+);
+
+static void
+SendScreenSaverNotify (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ int /* state */,
+ Bool /* forced */
+#endif
+);
+
+typedef struct _ScreenSaverScreenPrivate {
+ ScreenSaverEventPtr events;
+ ScreenSaverAttrPtr attr;
+ Bool hasWindow;
+ Colormap installedMap;
+} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
+
+static ScreenSaverScreenPrivatePtr
+MakeScreenPrivate (
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+ );
+
+static int ScreenPrivateIndex;
+
+#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
+#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
+#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
+
+#define New(t) ((t *) xalloc (sizeof (t)))
+
+/****************
+ * ScreenSaverExtensionInit
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ ****************/
+
+void
+ScreenSaverExtensionInit()
+{
+ ExtensionEntry *extEntry;
+ int i;
+ ScreenPtr pScreen;
+
+ AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
+ EventType = CreateNewResourceType(ScreenSaverFreeEvents);
+ ScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ SetScreenPrivate (pScreen, NULL);
+ }
+ if (AttrType && EventType && ScreenPrivateIndex != -1 &&
+ (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
+ ProcScreenSaverDispatch, SProcScreenSaverDispatch,
+ ScreenSaverResetProc, StandardMinorOpcode)))
+ {
+ ScreenSaverReqCode = (unsigned char)extEntry->base;
+ ScreenSaverEventBase = extEntry->eventBase;
+ EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+ScreenSaverResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+}
+
+static void
+CheckScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (!pPriv)
+ return;
+ if (!pPriv->attr && !pPriv->events &&
+ !pPriv->hasWindow && pPriv->installedMap == None)
+ {
+ xfree (pPriv);
+ SetScreenPrivate (pScreen, NULL);
+ savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
+ }
+}
+
+static ScreenSaverScreenPrivatePtr
+MakeScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (pPriv)
+ return pPriv;
+ pPriv = New (ScreenSaverScreenPrivateRec);
+ if (!pPriv)
+ return 0;
+ pPriv->events = 0;
+ pPriv->attr = 0;
+ pPriv->hasWindow = FALSE;
+ pPriv->installedMap = None;
+ SetScreenPrivate (pScreen, pPriv);
+ savedScreenInfo[pScreen->myNum].ExternalScreenSaver = ScreenSaverHandle;
+ return pPriv;
+}
+
+static unsigned long
+getEventMask (pScreen, client)
+ ScreenPtr pScreen;
+ ClientPtr client;
+{
+ SetupScreen(pScreen);
+ ScreenSaverEventPtr pEv;
+
+ if (!pPriv)
+ return 0;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ if (pEv->client == client)
+ return pEv->mask;
+ return 0;
+}
+
+static Bool
+setEventMask (pScreen, client, mask)
+ ScreenPtr pScreen;
+ ClientPtr client;
+ unsigned long mask;
+{
+ SetupScreen(pScreen);
+ ScreenSaverEventPtr pEv, *pPrev;
+
+ if (getEventMask (pScreen, client) == mask)
+ return TRUE;
+ if (!pPriv)
+ {
+ pPriv = MakeScreenPrivate (pScreen);
+ if (!pPriv)
+ return FALSE;
+ }
+ for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
+ if (pEv->client == client)
+ break;
+ if (mask == 0)
+ {
+ FreeResource (pEv->resource, EventType);
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ }
+ else
+ {
+ if (!pEv)
+ {
+ pEv = New (ScreenSaverEventRec);
+ if (!pEv)
+ {
+ CheckScreenPrivate (pScreen);
+ return FALSE;
+ }
+ *pPrev = pEv;
+ pEv->next = NULL;
+ pEv->client = client;
+ pEv->screen = pScreen;
+ pEv->resource = FakeClientID (client->index);
+ if (!AddResource (pEv->resource, EventType, (pointer) pEv))
+ return FALSE;
+ }
+ pEv->mask = mask;
+ }
+ return TRUE;
+}
+
+static void
+FreeAttrs (pAttr)
+ ScreenSaverAttrPtr pAttr;
+{
+ PixmapPtr pPixmap;
+ CursorPtr pCursor;
+
+ if ((pPixmap = pAttr->pBackgroundPixmap) != 0)
+ (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ if ((pPixmap = pAttr->pBorderPixmap) != 0)
+ (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+ if ((pCursor = pAttr->pCursor) != 0)
+ FreeCursor (pCursor, (Cursor) 0);
+}
+
+static void
+FreeScreenAttr (pAttr)
+ ScreenSaverAttrPtr pAttr;
+{
+ FreeAttrs (pAttr);
+ xfree (pAttr->values);
+ xfree (pAttr);
+}
+
+static int
+ScreenSaverFreeEvents (value, id)
+ pointer value;
+ XID id;
+{
+ ScreenSaverEventPtr pOld = (ScreenSaverEventPtr)value;
+ ScreenPtr pScreen = pOld->screen;
+ SetupScreen (pScreen);
+ ScreenSaverEventPtr pEv, *pPrev;
+
+ if (!pPriv)
+ return TRUE;
+ for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
+ if (pEv == pOld)
+ break;
+ if (!pEv)
+ return TRUE;
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ return TRUE;
+}
+
+static int
+ScreenSaverFreeAttr (value, id)
+ pointer value;
+ XID id;
+{
+ ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr)value;
+ ScreenPtr pScreen = pOldAttr->screen;
+ SetupScreen (pScreen);
+
+ if (!pPriv)
+ return TRUE;
+ if (pPriv->attr != pOldAttr)
+ return TRUE;
+ FreeScreenAttr (pOldAttr);
+ pPriv->attr = NULL;
+ if (pPriv->hasWindow)
+ {
+ SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive);
+ }
+ CheckScreenPrivate (pScreen);
+ return TRUE;
+}
+
+static void
+SendScreenSaverNotify (pScreen, state, forced)
+ ScreenPtr pScreen;
+ int state;
+ Bool forced;
+{
+ ScreenSaverScreenPrivatePtr pPriv;
+ ScreenSaverEventPtr pEv;
+ unsigned long mask;
+ xScreenSaverNotifyEvent ev;
+ ClientPtr client;
+ int kind;
+ ScreenSaverStuffPtr pSaver;
+
+ UpdateCurrentTimeIf ();
+ mask = ScreenSaverNotifyMask;
+ if (state == ScreenSaverCycle)
+ mask = ScreenSaverCycleMask;
+ pScreen = screenInfo.screens[pScreen->myNum];
+ pPriv = GetScreenPrivate(pScreen);
+ if (!pPriv)
+ return;
+ pSaver = &savedScreenInfo[pScreen->myNum];
+ if (pPriv->attr)
+ kind = ScreenSaverExternal;
+ else if (ScreenSaverBlanking != DontPreferBlanking)
+ kind = ScreenSaverBlanked;
+ else
+ kind = ScreenSaverInternal;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ {
+ client = pEv->client;
+ if (client->clientGone)
+ continue;
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = ScreenSaverNotify + ScreenSaverEventBase;
+ ev.state = state;
+ ev.sequenceNumber = client->sequence;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = WindowTable[pScreen->myNum]->drawable.id;
+ ev.window = savedScreenInfo[pScreen->myNum].wid;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient (client, 1, (xEvent *) &ev);
+ }
+}
+
+static void
+SScreenSaverNotifyEvent (from, to)
+ xScreenSaverNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ to->state = from->state;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->timestamp, to->timestamp);
+ cpswapl (from->root, to->root);
+ cpswapl (from->window, to->window);
+ to->kind = from->kind;
+ to->forced = from->forced;
+}
+
+static void
+UninstallSaverColormap (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen(pScreen);
+ ColormapPtr pCmap;
+
+ if (pPriv && pPriv->installedMap != None)
+ {
+ pCmap = (ColormapPtr) LookupIDByType (pPriv->installedMap, RT_COLORMAP);
+ if (pCmap)
+ (*pCmap->pScreen->UninstallColormap) (pCmap);
+ pPriv->installedMap = None;
+ CheckScreenPrivate (pScreen);
+ }
+}
+
+static Bool
+CreateSaverWindow (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+ ScreenSaverStuffPtr pSaver;
+ ScreenSaverAttrPtr pAttr;
+ WindowPtr pWin;
+ int result;
+ unsigned long mask;
+ extern int GrabInProgress;
+ Colormap *installedMaps;
+ int numInstalled;
+ int i;
+ Colormap wantMap;
+ ColormapPtr pCmap;
+
+ pSaver = &savedScreenInfo[pScreen->myNum];
+ if (pSaver->pWindow)
+ {
+ pSaver->pWindow = NullWindow;
+ FreeResource (pSaver->wid, RT_NONE);
+ if (pPriv)
+ {
+ UninstallSaverColormap (pScreen);
+ pPriv->hasWindow = FALSE;
+ CheckScreenPrivate (pScreen);
+ }
+ }
+
+ if (!pPriv || !(pAttr = pPriv->attr))
+ return FALSE;
+
+ pPriv->installedMap = None;
+
+ if (GrabInProgress && GrabInProgress != pAttr->client->index)
+ return FALSE;
+
+ pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum],
+ pAttr->x, pAttr->y, pAttr->width, pAttr->height,
+ pAttr->borderWidth, pAttr->class,
+ pAttr->mask, (XID *)pAttr->values,
+ pAttr->depth, serverClient, pAttr->visual,
+ &result);
+ if (!pWin)
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
+ return FALSE;
+
+ mask = 0;
+ if (pAttr->pBackgroundPixmap)
+ {
+ pWin->backgroundState = BackgroundPixmap;
+ pWin->background.pixmap = pAttr->pBackgroundPixmap;
+ pAttr->pBackgroundPixmap->refcnt++;
+ mask |= CWBackPixmap;
+ }
+ if (pAttr->pBorderPixmap)
+ {
+ pWin->borderIsPixel = FALSE;
+ pWin->border.pixmap = pAttr->pBorderPixmap;
+ pAttr->pBorderPixmap->refcnt++;
+ mask |= CWBorderPixmap;
+ }
+ if (pAttr->pCursor)
+ {
+ if (!pWin->optional)
+ if (!MakeWindowOptional (pWin))
+ {
+ FreeResource (pWin->drawable.id, RT_NONE);
+ return FALSE;
+ }
+ if (pWin->optional->cursor)
+ FreeCursor (pWin->optional->cursor, (Cursor)0);
+ pWin->optional->cursor = pAttr->pCursor;
+ pAttr->pCursor->refcnt++;
+ pWin->cursorIsNone = FALSE;
+ CheckWindowOptionalNeed (pWin);
+ mask |= CWCursor;
+ }
+ if (mask)
+ (*pScreen->ChangeWindowAttributes) (pWin, mask);
+
+ if (pAttr->colormap != None)
+ (void) ChangeWindowAttributes (pWin, CWColormap, &pAttr->colormap,
+ serverClient);
+
+ MapWindow (pWin, serverClient);
+
+ pPriv->hasWindow = TRUE;
+ pSaver->pWindow = pWin;
+
+ /* check and install our own colormap if it isn't installed now */
+ wantMap = wColormap (pWin);
+ if (wantMap == None)
+ return TRUE;
+ installedMaps = (Colormap *) ALLOCATE_LOCAL (pScreen->maxInstalledCmaps *
+ sizeof (Colormap));
+ numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
+ (pScreen, installedMaps);
+ for (i = 0; i < numInstalled; i++)
+ if (installedMaps[i] == wantMap)
+ break;
+
+ DEALLOCATE_LOCAL ((char *) installedMaps);
+
+ if (i < numInstalled)
+ return TRUE;
+
+ pCmap = (ColormapPtr) LookupIDByType (wantMap, RT_COLORMAP);
+ if (!pCmap)
+ return TRUE;
+
+ pPriv->installedMap = wantMap;
+
+ (*pCmap->pScreen->InstallColormap) (pCmap);
+
+ return TRUE;
+}
+
+static Bool
+DestroySaverWindow (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen(pScreen);
+ ScreenSaverStuffPtr pSaver;
+
+ if (!pPriv || !pPriv->hasWindow)
+ return FALSE;
+
+ pSaver = &savedScreenInfo[pScreen->myNum];
+ if (pSaver->pWindow)
+ {
+ pSaver->pWindow = NullWindow;
+ FreeResource (pSaver->wid, RT_NONE);
+ }
+ pPriv->hasWindow = FALSE;
+ CheckScreenPrivate (pScreen);
+ UninstallSaverColormap (pScreen);
+ return TRUE;
+}
+
+static Bool
+ScreenSaverHandle (pScreen, xstate, force)
+ ScreenPtr pScreen;
+ int xstate;
+ Bool force;
+{
+ int state;
+ Bool ret = FALSE;
+ ScreenSaverScreenPrivatePtr pPriv;
+
+ switch (xstate)
+ {
+ case SCREEN_SAVER_ON:
+ state = ScreenSaverOn;
+ ret = CreateSaverWindow (pScreen);
+ break;
+ case SCREEN_SAVER_OFF:
+ state = ScreenSaverOff;
+ ret = DestroySaverWindow (pScreen);
+ break;
+ case SCREEN_SAVER_CYCLE:
+ state = ScreenSaverCycle;
+ pPriv = GetScreenPrivate (pScreen);
+ if (pPriv && pPriv->hasWindow)
+ ret = TRUE;
+
+ }
+ SendScreenSaverNotify (pScreen, state, force);
+ return ret;
+}
+
+static int
+ProcScreenSaverQueryVersion (client)
+ register ClientPtr client;
+{
+ xScreenSaverQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = ScreenSaverMajorVersion;
+ rep.minorVersion = ScreenSaverMinorVersion;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+int
+ProcScreenSaverQueryInfo (client)
+ register ClientPtr client;
+{
+ REQUEST(xScreenSaverQueryInfoReq);
+ xScreenSaverQueryInfoReply rep;
+ register int n;
+ ScreenSaverStuffPtr pSaver;
+ DrawablePtr pDraw;
+ CARD32 lastInput;
+ ScreenSaverScreenPrivatePtr pPriv;
+
+ REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
+ pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
+ if (!pDraw)
+ return BadDrawable;
+
+ pSaver = &savedScreenInfo[pDraw->pScreen->myNum];
+ pPriv = GetScreenPrivate (pDraw->pScreen);
+
+ UpdateCurrentTime ();
+ lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.window = pSaver->wid;
+ if (screenIsSaved != SCREEN_SAVER_OFF)
+ {
+ rep.state = ScreenSaverOn;
+ if (ScreenSaverTime)
+ rep.tilOrSince = lastInput - ScreenSaverTime;
+ else
+ rep.tilOrSince = 0;
+ }
+ else
+ {
+ if (ScreenSaverTime)
+ {
+ rep.state = ScreenSaverOff;
+ if (ScreenSaverTime < lastInput)
+ rep.tilOrSince = 0;
+ else
+ rep.tilOrSince = ScreenSaverTime - lastInput;
+ }
+ else
+ {
+ rep.state = ScreenSaverDisabled;
+ rep.tilOrSince = 0;
+ }
+ }
+ rep.idle = lastInput;
+ rep.eventMask = getEventMask (pDraw->pScreen, client);
+ if (pPriv && pPriv->attr)
+ rep.kind = ScreenSaverExternal;
+ else if (ScreenSaverBlanking != DontPreferBlanking)
+ rep.kind = ScreenSaverBlanked;
+ else
+ rep.kind = ScreenSaverInternal;
+ if (client->swapped)
+ {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.window, n);
+ swapl (&rep.tilOrSince, n);
+ swapl (&rep.idle, n);
+ swapl (&rep.eventMask, n);
+ }
+ WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcScreenSaverSelectInput (client)
+ register ClientPtr client;
+{
+ REQUEST(xScreenSaverSelectInputReq);
+ DrawablePtr pDraw;
+
+ REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
+ pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
+ if (!pDraw)
+ return BadDrawable;
+ if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
+ return BadAlloc;
+ return Success;
+}
+
+static int
+ProcScreenSaverSetAttributes (client)
+ register ClientPtr client;
+{
+ REQUEST(xScreenSaverSetAttributesReq);
+ DrawablePtr pDraw;
+ WindowPtr pParent;
+ ScreenPtr pScreen;
+ ScreenSaverScreenPrivatePtr pPriv = 0;
+ ScreenSaverAttrPtr pAttr = 0;
+ int ret;
+ int len;
+ int class, bw, depth;
+ unsigned long visual;
+ int idepth, ivisual;
+ Bool fOK;
+ DepthPtr pDepth;
+ WindowOptPtr ancwopt;
+ unsigned long *pVlist;
+ unsigned long *values = 0;
+ int valuei;
+ unsigned long tmask, imask;
+ unsigned long val;
+ Pixmap pixID;
+ PixmapPtr pPixmap;
+ Cursor cursorID;
+ CursorPtr pCursor;
+ Colormap cmap;
+ ColormapPtr pCmap;
+
+ REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
+ pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
+ if (!pDraw)
+ return BadDrawable;
+ pScreen = pDraw->pScreen;
+ pParent = WindowTable[pScreen->myNum];
+
+ len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ switch (class = stuff->c_class)
+ {
+ case CopyFromParent:
+ case InputOnly:
+ case InputOutput:
+ break;
+ default:
+ client->errorValue = class;
+ return BadValue;
+ }
+ bw = stuff->borderWidth;
+ depth = stuff->depth;
+ visual = stuff->visualID;
+
+ /* copied directly from CreateWindow */
+
+ if (class == CopyFromParent)
+ class = pParent->drawable.class;
+
+ if ((class != InputOutput) && (class != InputOnly))
+ {
+ client->errorValue = class;
+ return BadValue;
+ }
+
+ if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
+ return BadMatch;
+
+ if ((class == InputOnly) && ((bw != 0) || (depth != 0)))
+ return BadMatch;
+
+ if ((class == InputOutput) && (depth == 0))
+ depth = pParent->drawable.depth;
+ ancwopt = pParent->optional;
+ if (!ancwopt)
+ ancwopt = FindWindowWithOptional(pParent)->optional;
+ if (visual == CopyFromParent)
+ visual = ancwopt->visual;
+
+ /* Find out if the depth and visual are acceptable for this Screen */
+ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
+ {
+ fOK = FALSE;
+ for(idepth = 0; idepth < pScreen->numDepths; idepth++)
+ {
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
+ if ((depth == pDepth->depth) || (depth == 0))
+ {
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
+ {
+ if (visual == pDepth->vids[ivisual])
+ {
+ fOK = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (fOK == FALSE)
+ return BadMatch;
+ }
+
+ if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
+ (class != InputOnly) &&
+ (depth != pParent->drawable.depth))
+ {
+ return BadMatch;
+ }
+
+ if (((stuff->mask & CWColormap) == 0) &&
+ (class != InputOnly) &&
+ ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
+ {
+ return BadMatch;
+ }
+
+ /* end of errors from CreateWindow */
+
+ pPriv = GetScreenPrivate (pScreen);
+ if (pPriv && pPriv->attr)
+ {
+ if (pPriv->attr->client != client)
+ return BadAccess;
+ }
+ if (!pPriv)
+ {
+ pPriv = MakeScreenPrivate (pScreen);
+ if (!pPriv)
+ return FALSE;
+ }
+ pAttr = New (ScreenSaverAttrRec);
+ if (!pAttr)
+ {
+ ret = BadAlloc;
+ goto bail;
+ }
+ /* over allocate for override redirect */
+ values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long));
+ if (!values)
+ {
+ ret = BadAlloc;
+ goto bail;
+ }
+ valuei = 0;
+ pAttr->screen = pScreen;
+ pAttr->client = client;
+ pAttr->x = stuff->x;
+ pAttr->y = stuff->y;
+ pAttr->width = stuff->width;
+ pAttr->height = stuff->height;
+ pAttr->borderWidth = stuff->borderWidth;
+ pAttr->class = stuff->c_class;
+ pAttr->depth = depth;
+ pAttr->visual = visual;
+ pAttr->colormap = None;
+ pAttr->pCursor = NullCursor;
+ pAttr->pBackgroundPixmap = NullPixmap;
+ pAttr->pBorderPixmap = NullPixmap;
+ pAttr->values = values;
+ /*
+ * go through the mask, checking the values,
+ * looking up pixmaps and cursors and hold a reference
+ * to them.
+ */
+ pAttr->mask = tmask = stuff->mask | CWOverrideRedirect;
+ pVlist = (unsigned long *) (stuff + 1);
+ while (tmask) {
+ imask = lowbit (tmask);
+ tmask &= ~imask;
+ switch (imask)
+ {
+ case CWBackPixmap:
+ pixID = (Pixmap )*pVlist;
+ if (pixID == None)
+ {
+ *values++ = None;
+ }
+ else if (pixID == ParentRelative)
+ {
+ if (depth != pParent->drawable.depth)
+ {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ *values++ = ParentRelative;
+ }
+ else
+ {
+ pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP);
+ if (pPixmap != (PixmapPtr) NULL)
+ {
+ if ((pPixmap->drawable.depth != depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ pAttr->pBackgroundPixmap = pPixmap;
+ pPixmap->refcnt++;
+ pAttr->mask &= ~CWBackPixmap;
+ }
+ else
+ {
+ ret = BadPixmap;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBackPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWBorderPixmap:
+ pixID = (Pixmap ) *pVlist;
+ if (pixID == CopyFromParent)
+ {
+ if (depth != pParent->drawable.depth)
+ {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ *values++ = CopyFromParent;
+ }
+ else
+ {
+ pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP);
+ if (pPixmap)
+ {
+ if ((pPixmap->drawable.depth != depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ pAttr->pBorderPixmap = pPixmap;
+ pPixmap->refcnt++;
+ pAttr->mask &= ~CWBorderPixmap;
+ }
+ else
+ {
+ ret = BadPixmap;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBorderPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWBitGravity:
+ val = (CARD8 )*pVlist;
+ if (val > StaticGravity)
+ {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWWinGravity:
+ val = (CARD8 )*pVlist;
+ if (val > StaticGravity)
+ {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWBackingStore:
+ val = (CARD8 )*pVlist;
+ if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
+ {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWBackingPlanes:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWBackingPixel:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWSaveUnder:
+ val = (BOOL) *pVlist;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ *values++ = val;
+ break;
+ case CWEventMask:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWDontPropagate:
+ *values++ = (CARD32) *pVlist;
+ break;
+ case CWOverrideRedirect:
+ if (!(stuff->mask & CWOverrideRedirect))
+ pVlist--;
+ else
+ {
+ val = (BOOL ) *pVlist;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ ret = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ }
+ *values++ = xTrue;
+ break;
+ case CWColormap:
+ cmap = (Colormap) *pVlist;
+ pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP);
+ if (!pCmap)
+ {
+ ret = BadColor;
+ client->errorValue = cmap;
+ goto PatchUp;
+ }
+ if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen)
+ {
+ ret = BadMatch;
+ goto PatchUp;
+ }
+ pAttr->colormap = cmap;
+ pAttr->mask &= ~CWColormap;
+ break;
+ case CWCursor:
+ cursorID = (Cursor ) *pVlist;
+ if ( cursorID == None)
+ {
+ *values++ = None;
+ }
+ else
+ {
+ pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR);
+ if (!pCursor)
+ {
+ ret = BadCursor;
+ client->errorValue = cursorID;
+ goto PatchUp;
+ }
+ pCursor->refcnt++;
+ pAttr->pCursor = pCursor;
+ pAttr->mask &= ~CWCursor;
+ }
+ break;
+ default:
+ ret = BadValue;
+ client->errorValue = stuff->mask;
+ goto PatchUp;
+ }
+ pVlist++;
+ }
+ if (pPriv->attr)
+ FreeScreenAttr (pPriv->attr);
+ pPriv->attr = pAttr;
+ pAttr->resource = FakeClientID (client->index);
+ if (!AddResource (pAttr->resource, AttrType, (pointer) pAttr))
+ return BadAlloc;
+ return Success;
+PatchUp:
+ FreeAttrs (pAttr);
+bail:
+ CheckScreenPrivate (pScreen);
+ xfree (pAttr);
+ xfree (values);
+ return ret;
+}
+
+static int
+ProcScreenSaverUnsetAttributes (client)
+ register ClientPtr client;
+{
+ REQUEST(xScreenSaverSetAttributesReq);
+ DrawablePtr pDraw;
+ ScreenSaverScreenPrivatePtr pPriv;
+
+ REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
+ pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
+ if (!pDraw)
+ return BadDrawable;
+ pPriv = GetScreenPrivate (pDraw->pScreen);
+ if (pPriv && pPriv->attr && pPriv->attr->client == client)
+ {
+ FreeScreenAttr (pPriv->attr);
+ pPriv->attr = NULL;
+ CheckScreenPrivate (pDraw->pScreen);
+ }
+ return Success;
+}
+
+static DISPATCH_PROC((*NormalVector[])) = {
+ ProcScreenSaverQueryVersion,
+ ProcScreenSaverQueryInfo,
+ ProcScreenSaverSelectInput,
+ ProcScreenSaverSetAttributes,
+ ProcScreenSaverUnsetAttributes,
+};
+
+#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
+
+static int
+ProcScreenSaverDispatch (client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ if (stuff->data < NUM_REQUESTS)
+ return (*NormalVector[stuff->data])(client);
+ return BadRequest;
+}
+
+static int
+SProcScreenSaverQueryVersion (client)
+ ClientPtr client;
+{
+ REQUEST(xScreenSaverQueryVersionReq);
+ int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
+ return ProcScreenSaverQueryVersion (client);
+}
+
+static int
+SProcScreenSaverQueryInfo (client)
+ ClientPtr client;
+{
+ REQUEST(xScreenSaverQueryInfoReq);
+ int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
+ swapl (&stuff->drawable, n);
+ return ProcScreenSaverQueryInfo (client);
+}
+
+static int
+SProcScreenSaverSelectInput (client)
+ ClientPtr client;
+{
+ REQUEST(xScreenSaverSelectInputReq);
+ int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
+ swapl (&stuff->drawable, n);
+ swapl (&stuff->eventMask, n);
+ return ProcScreenSaverSelectInput (client);
+}
+
+static int
+SProcScreenSaverSetAttributes (client)
+ ClientPtr client;
+{
+ REQUEST(xScreenSaverSetAttributesReq);
+ int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
+ swapl (&stuff->drawable, n);
+ swaps (&stuff->x, n);
+ swaps (&stuff->y, n);
+ swaps (&stuff->width, n);
+ swaps (&stuff->height, n);
+ swaps (&stuff->borderWidth, n);
+ swapl (&stuff->visualID, n);
+ swapl (&stuff->mask, n);
+ SwapRestL(stuff);
+ return ProcScreenSaverSetAttributes (client);
+}
+
+static int
+SProcScreenSaverUnsetAttributes (client)
+ ClientPtr client;
+{
+ REQUEST(xScreenSaverUnsetAttributesReq);
+ int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
+ swapl (&stuff->drawable, n);
+ return ProcScreenSaverUnsetAttributes (client);
+}
+
+static DISPATCH_PROC((*SwappedVector[])) = {
+ SProcScreenSaverQueryVersion,
+ SProcScreenSaverQueryInfo,
+ SProcScreenSaverSelectInput,
+ SProcScreenSaverSetAttributes,
+ SProcScreenSaverUnsetAttributes,
+};
+
+static int
+SProcScreenSaverDispatch (client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ if (stuff->data < NUM_REQUESTS)
+ return (*SwappedVector[stuff->data])(client);
+ return BadRequest;
+}
diff --git a/xc/programs/Xserver/Xext/security.c b/xc/programs/Xserver/Xext/security.c
new file mode 100644
index 000000000..a5cf7b66a
--- /dev/null
+++ b/xc/programs/Xserver/Xext/security.c
@@ -0,0 +1,1999 @@
+/* $TOG: security.c /main/15 1998/02/09 15:25:09 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.4 1998/10/04 09:36:47 dawes Exp $ */
+
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "gcstruct.h"
+#include "colormapst.h"
+#include "propertyst.h"
+#define _SECURITY_SERVER
+#include "securstr.h"
+#include <assert.h>
+#include <stdarg.h>
+#ifdef LBX
+#define _XLBX_SERVER_
+#include "XLbx.h"
+extern unsigned char LbxReqCode;
+#endif
+#ifdef XAPPGROUP
+#include "Xagsrv.h"
+#endif
+#include <stdio.h> /* for file reading operations */
+#include "Xatom.h" /* for XA_STRING */
+
+#ifndef DEFAULTPOLICYFILE
+# define DEFAULTPOLICYFILE NULL
+#endif
+#ifdef WIN32
+#include <X11/Xos.h>
+#undef index
+#endif
+
+static int SecurityErrorBase; /* first Security error number */
+static int SecurityEventBase; /* first Security event number */
+
+CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */
+
+RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
+
+static RESTYPE RTEventClient;
+
+/* Proc vectors for untrusted clients, swapped and unswapped versions.
+ * These are the same as the normal proc vectors except that extensions
+ * that haven't declared themselves secure will have ProcBadRequest plugged
+ * in for their major opcode dispatcher. This prevents untrusted clients
+ * from guessing extension major opcodes and using the extension even though
+ * the extension can't be listed or queried.
+ */
+int (*UntrustedProcVector[256])(
+#if NeedNestedPrototypes
+ ClientPtr /*client*/
+#endif
+);
+int (*SwappedUntrustedProcVector[256])(
+#if NeedNestedPrototypes
+ ClientPtr /*client*/
+#endif
+);
+
+extern int ProcBadRequest();
+
+
+/* SecurityAudit
+ *
+ * Arguments:
+ * format is the formatting string to be used to interpret the
+ * remaining arguments.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Writes the message to the log file if security logging is on.
+ */
+
+void
+SecurityAudit(char *format, ...)
+{
+ va_list args;
+
+ if (auditTrailLevel < SECURITY_AUDIT_LEVEL)
+ return;
+ AuditPrefix(format);
+ va_start(args, format);
+ VErrorF(format, args);
+ va_end(args);
+} /* SecurityAudit */
+
+#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
+
+/* SecurityDeleteAuthorization
+ *
+ * Arguments:
+ * value is the authorization to delete.
+ * id is its resource ID.
+ *
+ * Returns: Success.
+ *
+ * Side Effects:
+ * Frees everything associated with the authorization.
+ */
+
+static int
+SecurityDeleteAuthorization(value, id)
+ pointer value;
+ XID id;
+{
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
+ unsigned short name_len, data_len;
+ char *name, *data;
+ int status;
+ int i;
+ OtherClientsPtr pEventClient;
+
+ /* Remove the auth using the os layer auth manager */
+
+ status = AuthorizationFromID(pAuth->id, &name_len, &name,
+ &data_len, &data);
+ assert(status);
+ status = RemoveAuthorization(name_len, name, data_len, data);
+ assert(status);
+
+ /* free the auth timer if there is one */
+
+ if (pAuth->timer) TimerFree(pAuth->timer);
+
+ /* send revoke events */
+
+ while (pEventClient = pAuth->eventClients)
+ {
+ /* send revocation event event */
+ ClientPtr client = rClient(pEventClient);
+
+ if (!client->clientGone)
+ {
+ xSecurityAuthorizationRevokedEvent are;
+ are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
+ are.sequenceNumber = client->sequence;
+ are.authId = pAuth->id;
+ WriteEventsToClient(client, 1, (xEvent *)&are);
+ }
+ FreeResource(pEventClient->resource, RT_NONE);
+ }
+
+ /* kill all clients using this auth */
+
+ for (i = 1; i<currentMaxClients; i++)
+ {
+ if (clients[i] && (clients[i]->authId == pAuth->id))
+ CloseDownClient(clients[i]);
+ }
+
+ SecurityAudit("revoked authorization ID %d\n", pAuth->id);
+ xfree(pAuth);
+ return Success;
+
+} /* SecurityDeleteAuthorization */
+
+
+/* resource delete function for RTEventClient */
+static int
+SecurityDeleteAuthorizationEventClient(value, id)
+ pointer value;
+ XID id;
+{
+ OtherClientsPtr pEventClient, prev = NULL;
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
+
+ for (pEventClient = pAuth->eventClients;
+ pEventClient;
+ pEventClient = pEventClient->next)
+ {
+ if (pEventClient->resource == id)
+ {
+ if (prev)
+ prev->next = pEventClient->next;
+ else
+ pAuth->eventClients = pEventClient->next;
+ xfree(pEventClient);
+ return(Success);
+ }
+ prev = pEventClient;
+ }
+ /*NOTREACHED*/
+ return -1; /* make compiler happy */
+} /* SecurityDeleteAuthorizationEventClient */
+
+
+/* SecurityComputeAuthorizationTimeout
+ *
+ * Arguments:
+ * pAuth is the authorization for which we are computing the timeout
+ * seconds is the number of seconds we want to wait
+ *
+ * Returns:
+ * the number of milliseconds that the auth timer should be set to
+ *
+ * Side Effects:
+ * Sets pAuth->secondsRemaining to any "overflow" amount of time
+ * that didn't fit in 32 bits worth of milliseconds
+ */
+
+static CARD32
+SecurityComputeAuthorizationTimeout(pAuth, seconds)
+ SecurityAuthorizationPtr pAuth;
+ unsigned int seconds;
+{
+ /* maxSecs is the number of full seconds that can be expressed in
+ * 32 bits worth of milliseconds
+ */
+ CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND;
+
+ if (seconds > maxSecs)
+ { /* only come here if we want to wait more than 49 days */
+ pAuth->secondsRemaining = seconds - maxSecs;
+ return maxSecs * MILLI_PER_SECOND;
+ }
+ else
+ { /* by far the common case */
+ pAuth->secondsRemaining = 0;
+ return seconds * MILLI_PER_SECOND;
+ }
+} /* SecurityStartAuthorizationTimer */
+
+/* SecurityAuthorizationExpired
+ *
+ * This function is passed as an argument to TimerSet and gets called from
+ * the timer manager in the os layer when its time is up.
+ *
+ * Arguments:
+ * timer is the timer for this authorization.
+ * time is the current time.
+ * pval is the authorization whose time is up.
+ *
+ * Returns:
+ * A new time delay in milliseconds if the timer should wait some
+ * more, else zero.
+ *
+ * Side Effects:
+ * Frees the authorization resource if the timeout period is really
+ * over, otherwise recomputes pAuth->secondsRemaining.
+ */
+
+static CARD32
+SecurityAuthorizationExpired(timer, time, pval)
+ OsTimerPtr timer;
+ CARD32 time;
+ pointer pval;
+{
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval;
+
+ assert(pAuth->timer == timer);
+
+ if (pAuth->secondsRemaining)
+ {
+ return SecurityComputeAuthorizationTimeout(pAuth,
+ pAuth->secondsRemaining);
+ }
+ else
+ {
+ FreeResource(pAuth->id, RT_NONE);
+ return 0;
+ }
+} /* SecurityAuthorizationExpired */
+
+/* SecurityStartAuthorizationTimer
+ *
+ * Arguments:
+ * pAuth is the authorization whose timer should be started.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * A timer is started, set to expire after the timeout period for
+ * this authorization. When it expires, the function
+ * SecurityAuthorizationExpired will be called.
+ */
+
+static void
+SecurityStartAuthorizationTimer(pAuth)
+ SecurityAuthorizationPtr pAuth;
+{
+ pAuth->timer = TimerSet(pAuth->timer, 0,
+ SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
+ SecurityAuthorizationExpired, pAuth);
+} /* SecurityStartAuthorizationTimer */
+
+
+/* Proc functions all take a client argument, execute the request in
+ * client->requestBuffer, and return a protocol error status.
+ */
+
+static int
+ProcSecurityQueryVersion(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityQueryVersionReq);
+ xSecurityQueryVersionReply rep;
+
+ /* paranoia: this "can't happen" because this extension is hidden
+ * from untrusted clients, but just in case...
+ */
+ if (client->trustLevel != XSecurityClientTrusted)
+ return BadRequest;
+
+ REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.majorVersion = SECURITY_MAJOR_VERSION;
+ rep.minorVersion = SECURITY_MINOR_VERSION;
+ if(client->swapped)
+ {
+ register char n;
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
+ (char *)&rep);
+ return (client->noClientException);
+} /* ProcSecurityQueryVersion */
+
+
+static int
+SecurityEventSelectForAuthorization(pAuth, client, mask)
+ SecurityAuthorizationPtr pAuth;
+ ClientPtr client;
+ Mask mask;
+{
+ OtherClients *pEventClient;
+
+ for (pEventClient = pAuth->eventClients;
+ pEventClient;
+ pEventClient = pEventClient->next)
+ {
+ if (SameClient(pEventClient, client))
+ {
+ if (mask == 0)
+ FreeResource(pEventClient->resource, RT_NONE);
+ else
+ pEventClient->mask = mask;
+ return Success;
+ }
+ }
+
+ pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
+ if (!pEventClient)
+ return BadAlloc;
+ pEventClient->mask = mask;
+ pEventClient->resource = FakeClientID(client->index);
+ pEventClient->next = pAuth->eventClients;
+ if (!AddResource(pEventClient->resource, RTEventClient,
+ (pointer)pAuth))
+ {
+ xfree(pEventClient);
+ return BadAlloc;
+ }
+ pAuth->eventClients = pEventClient;
+
+ return Success;
+} /* SecurityEventSelectForAuthorization */
+
+
+static int
+ProcSecurityGenerateAuthorization(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityGenerateAuthorizationReq);
+ int len; /* request length in CARD32s*/
+ Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
+ SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
+ int err; /* error to return from this function */
+ int status; /* return value from os functions */
+ XID authId; /* authorization ID assigned by os layer */
+ xSecurityGenerateAuthorizationReply rep; /* reply struct */
+ unsigned int trustLevel; /* trust level of new auth */
+ XID group; /* group of new auth */
+ CARD32 timeout; /* timeout of new auth */
+ CARD32 *values; /* list of supplied attributes */
+ char *protoname; /* auth proto name sent in request */
+ char *protodata; /* auth proto data sent in request */
+ unsigned int authdata_len; /* # bytes of generated auth data */
+ char *pAuthdata; /* generated auth data */
+ Mask eventMask; /* what events on this auth does client want */
+
+ /* paranoia: this "can't happen" because this extension is hidden
+ * from untrusted clients, but just in case...
+ */
+ if (client->trustLevel != XSecurityClientTrusted)
+ return BadRequest;
+
+ /* check request length */
+
+ REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
+ len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2;
+ len += (stuff->nbytesAuthProto + (unsigned)3) >> 2;
+ len += (stuff->nbytesAuthData + (unsigned)3) >> 2;
+ values = ((CARD32 *)stuff) + len;
+ len += Ones(stuff->valueMask);
+ if (client->req_len != len)
+ return BadLength;
+
+ /* check valuemask */
+ if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
+ {
+ client->errorValue = stuff->valueMask;
+ return BadValue;
+ }
+
+ /* check timeout */
+ timeout = 60;
+ if (stuff->valueMask & XSecurityTimeout)
+ {
+ timeout = *values++;
+ }
+
+ /* check trustLevel */
+ trustLevel = XSecurityClientUntrusted;
+ if (stuff->valueMask & XSecurityTrustLevel)
+ {
+ trustLevel = *values++;
+ if (trustLevel != XSecurityClientTrusted &&
+ trustLevel != XSecurityClientUntrusted)
+ {
+ client->errorValue = trustLevel;
+ return BadValue;
+ }
+ }
+
+ /* check group */
+ group = None;
+ if (stuff->valueMask & XSecurityGroup)
+ {
+ group = *values++;
+ if (SecurityValidateGroupCallback)
+ {
+ SecurityValidateGroupInfoRec vgi;
+ vgi.group = group;
+ vgi.valid = FALSE;
+ CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi);
+
+ /* if nobody said they recognized it, it's an error */
+
+ if (!vgi.valid)
+ {
+ client->errorValue = group;
+ return BadValue;
+ }
+ }
+ }
+
+ /* check event mask */
+ eventMask = 0;
+ if (stuff->valueMask & XSecurityEventMask)
+ {
+ eventMask = *values++;
+ if (eventMask & ~XSecurityAllEventMasks)
+ {
+ client->errorValue = eventMask;
+ return BadValue;
+ }
+ }
+
+ protoname = (char *)&stuff[1];
+ protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2);
+
+ /* call os layer to generate the authorization */
+
+ authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
+ stuff->nbytesAuthData, protodata,
+ &authdata_len, &pAuthdata);
+ if ((XID) ~0L == authId)
+ {
+ err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
+ goto bailout;
+ }
+
+ /* now that we've added the auth, remember to remove it if we have to
+ * abort the request for some reason (like allocation failure)
+ */
+ removeAuth = TRUE;
+
+ /* associate additional information with this auth ID */
+
+ pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
+ if (!pAuth)
+ {
+ err = BadAlloc;
+ goto bailout;
+ }
+
+ /* fill in the auth fields */
+
+ pAuth->id = authId;
+ pAuth->timeout = timeout;
+ pAuth->group = group;
+ pAuth->trustLevel = trustLevel;
+ pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */
+ pAuth->secondsRemaining = 0;
+ pAuth->timer = NULL;
+ pAuth->eventClients = NULL;
+
+ /* handle event selection */
+ if (eventMask)
+ {
+ err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
+ if (err != Success)
+ goto bailout;
+ }
+
+ if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
+ {
+ err = BadAlloc;
+ goto bailout;
+ }
+
+ /* start the timer ticking */
+
+ if (pAuth->timeout != 0)
+ SecurityStartAuthorizationTimer(pAuth);
+
+ /* tell client the auth id and data */
+
+ rep.type = X_Reply;
+ rep.length = (authdata_len + 3) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.authId = authId;
+ rep.dataLength = authdata_len;
+
+ if (client->swapped)
+ {
+ register char n;
+ swapl(&rep.length, n);
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.authId, n);
+ swaps(&rep.dataLength, n);
+ }
+
+ WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
+ (char *)&rep);
+ WriteToClient(client, authdata_len, pAuthdata);
+
+ SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
+ client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
+ pAuth->group, eventMask);
+
+ /* the request succeeded; don't call RemoveAuthorization or free pAuth */
+
+ removeAuth = FALSE;
+ pAuth = NULL;
+ err = client->noClientException;
+
+bailout:
+ if (removeAuth)
+ RemoveAuthorization(stuff->nbytesAuthProto, protoname,
+ authdata_len, pAuthdata);
+ if (pAuth) xfree(pAuth);
+ return err;
+
+} /* ProcSecurityGenerateAuthorization */
+
+static int
+ProcSecurityRevokeAuthorization(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityRevokeAuthorizationReq);
+ SecurityAuthorizationPtr pAuth;
+
+ /* paranoia: this "can't happen" because this extension is hidden
+ * from untrusted clients, but just in case...
+ */
+ if (client->trustLevel != XSecurityClientTrusted)
+ return BadRequest;
+
+ REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
+
+ pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
+ stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess);
+ if (!pAuth)
+ return SecurityErrorBase + XSecurityBadAuthorization;
+
+ FreeResource(stuff->authId, RT_NONE);
+ return Success;
+} /* ProcSecurityRevokeAuthorization */
+
+
+static int
+ProcSecurityDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_SecurityQueryVersion:
+ return ProcSecurityQueryVersion(client);
+ case X_SecurityGenerateAuthorization:
+ return ProcSecurityGenerateAuthorization(client);
+ case X_SecurityRevokeAuthorization:
+ return ProcSecurityRevokeAuthorization(client);
+ default:
+ return BadRequest;
+ }
+} /* ProcSecurityDispatch */
+
+static int
+SProcSecurityQueryVersion(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityQueryVersionReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
+ swaps(&stuff->majorVersion, n);
+ swaps(&stuff->minorVersion,n);
+ return ProcSecurityQueryVersion(client);
+} /* SProcSecurityQueryVersion */
+
+
+static int
+SProcSecurityGenerateAuthorization(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityGenerateAuthorizationReq);
+ register char n;
+ CARD32 *values;
+ unsigned long nvalues;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
+ swaps(&stuff->nbytesAuthProto, n);
+ swaps(&stuff->nbytesAuthData, n);
+ swapl(&stuff->valueMask, n);
+ values = (CARD32 *)(&stuff[1]) +
+ ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
+ ((stuff->nbytesAuthData + (unsigned)3) >> 2);
+ nvalues = (((CARD32 *)stuff) + stuff->length) - values;
+ SwapLongs(values, nvalues);
+ return ProcSecurityGenerateAuthorization(client);
+} /* SProcSecurityGenerateAuthorization */
+
+
+static int
+SProcSecurityRevokeAuthorization(client)
+ ClientPtr client;
+{
+ REQUEST(xSecurityRevokeAuthorizationReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
+ swapl(&stuff->authId, n);
+ return ProcSecurityRevokeAuthorization(client);
+} /* SProcSecurityRevokeAuthorization */
+
+
+static int
+SProcSecurityDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_SecurityQueryVersion:
+ return SProcSecurityQueryVersion(client);
+ case X_SecurityGenerateAuthorization:
+ return SProcSecurityGenerateAuthorization(client);
+ case X_SecurityRevokeAuthorization:
+ return SProcSecurityRevokeAuthorization(client);
+ default:
+ return BadRequest;
+ }
+} /* SProcSecurityDispatch */
+
+static void
+SwapSecurityAuthorizationRevokedEvent(from, to)
+ xSecurityAuthorizationRevokedEvent *from, *to;
+{
+ to->type = from->type;
+ to->detail = from->detail;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->authId, to->authId);
+}
+
+/* SecurityDetermineEventPropogationLimits
+ *
+ * This is a helper function for SecurityCheckDeviceAccess.
+ *
+ * Arguments:
+ * dev is the device for which the starting and stopping windows for
+ * event propogation should be determined.
+ * The values pointed to by ppWin and ppStopWin are not used.
+ *
+ * Returns:
+ * ppWin is filled in with a pointer to the window at which event
+ * propogation for the given device should start given the current
+ * state of the server (pointer position, window layout, etc.)
+ * ppStopWin is filled in with the window at which event propogation
+ * should stop; events should not go to ppStopWin.
+ *
+ * Side Effects: none.
+ */
+
+static void
+SecurityDetermineEventPropogationLimits(dev, ppWin, ppStopWin)
+ DeviceIntPtr dev;
+ WindowPtr *ppWin;
+ WindowPtr *ppStopWin;
+{
+ WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin;
+
+ if (pFocusWin == NoneWin)
+ { /* no focus -- events don't go anywhere */
+ *ppWin = *ppStopWin = NULL;
+ return;
+ }
+
+ if (pFocusWin == PointerRootWin)
+ { /* focus follows the pointer */
+ *ppWin = GetSpriteWindow();
+ *ppStopWin = NULL; /* propogate all the way to the root */
+ }
+ else
+ { /* a real window is set for the focus */
+ WindowPtr pSpriteWin = GetSpriteWindow();
+ *ppStopWin = pFocusWin->parent; /* don't go past the focus window */
+
+ /* if the pointer is in a subwindow of the focus window, start
+ * at that subwindow, else start at the focus window itself
+ */
+ if (IsParent(pFocusWin, pSpriteWin))
+ *ppWin = pSpriteWin;
+ else *ppWin = pFocusWin;
+ }
+} /* SecurityDetermineEventPropogationLimits */
+
+
+/* SecurityCheckDeviceAccess
+ *
+ * Arguments:
+ * client is the client attempting to access a device.
+ * dev is the device being accessed.
+ * fromRequest is TRUE if the device access is a direct result of
+ * the client executing some request and FALSE if it is a
+ * result of the server trying to send an event (e.g. KeymapNotify)
+ * to the client.
+ * Returns:
+ * TRUE if the device access should be allowed, else FALSE.
+ *
+ * Side Effects:
+ * An audit message is generated if access is denied.
+ */
+
+Bool
+SecurityCheckDeviceAccess(client, dev, fromRequest)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ Bool fromRequest;
+{
+ WindowPtr pWin, pStopWin;
+ Bool untrusted_got_event;
+ Bool found_event_window;
+ Mask eventmask;
+ int reqtype;
+
+ /* trusted clients always allowed to do anything */
+ if (client->trustLevel == XSecurityClientTrusted)
+ return TRUE;
+
+ /* device security other than keyboard is not implemented yet */
+ if (dev != inputInfo.keyboard)
+ return TRUE;
+
+ /* some untrusted client wants access */
+
+ if (fromRequest)
+ {
+ reqtype = ((xReq *)client->requestBuffer)->reqType;
+ switch (reqtype)
+ {
+ /* never allow these */
+ case X_ChangeKeyboardMapping:
+ case X_ChangeKeyboardControl:
+ case X_SetModifierMapping:
+ SecurityAudit("client %d attempted request %d\n",
+ client->index, reqtype);
+ return FALSE;
+ default:
+ break;
+ }
+ }
+
+ untrusted_got_event = FALSE;
+ found_event_window = FALSE;
+
+ if (dev->grab)
+ {
+ untrusted_got_event =
+ ((rClient(dev->grab))->trustLevel != XSecurityClientTrusted);
+ }
+ else
+ {
+ SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin);
+
+ eventmask = KeyPressMask | KeyReleaseMask;
+ while ( (pWin != pStopWin) && !found_event_window)
+ {
+ OtherClients *other;
+
+ if (pWin->eventMask & eventmask)
+ {
+ found_event_window = TRUE;
+ client = wClient(pWin);
+ if (client->trustLevel != XSecurityClientTrusted)
+ {
+ untrusted_got_event = TRUE;
+ }
+ }
+ if (wOtherEventMasks(pWin) & eventmask)
+ {
+ found_event_window = TRUE;
+ for (other = wOtherClients(pWin); other; other = other->next)
+ {
+ if (other->mask & eventmask)
+ {
+ client = rClient(other);
+ if (client->trustLevel != XSecurityClientTrusted)
+ {
+ untrusted_got_event = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (wDontPropagateMask(pWin) & eventmask)
+ break;
+ pWin = pWin->parent;
+ } /* while propogating the event */
+ }
+
+ /* allow access by untrusted clients only if an event would have gone
+ * to an untrusted client
+ */
+
+ if (!untrusted_got_event)
+ {
+ char *devname = dev->name;
+ if (!devname) devname = "unnamed";
+ if (fromRequest)
+ SecurityAudit("client %d attempted request %d device %d (%s)\n",
+ client->index, reqtype, dev->id, devname);
+ else
+ SecurityAudit("client %d attempted to access device %d (%s)\n",
+ client->index, dev->id, devname);
+ }
+ return untrusted_got_event;
+} /* SecurityCheckDeviceAccess */
+
+
+
+/* SecurityAuditResourceIDAccess
+ *
+ * Arguments:
+ * client is the client doing the resource access.
+ * id is the resource id.
+ *
+ * Returns: NULL
+ *
+ * Side Effects:
+ * An audit message is generated with details of the denied
+ * resource access.
+ */
+
+static pointer
+SecurityAuditResourceIDAccess(client, id)
+ ClientPtr client;
+ XID id;
+{
+ int cid = CLIENT_ID(id);
+ int reqtype = ((xReq *)client->requestBuffer)->reqType;
+ switch (reqtype)
+ {
+ case X_ChangeProperty:
+ case X_DeleteProperty:
+ case X_GetProperty:
+ {
+ xChangePropertyReq *req =
+ (xChangePropertyReq *)client->requestBuffer;
+ int propertyatom = req->property;
+ char *propertyname = NameForAtom(propertyatom);
+
+ SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n",
+ client->index, reqtype, id, propertyname, cid);
+ break;
+ }
+ default:
+ {
+ SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n",
+ client->index, reqtype, id, cid);
+ break;
+ }
+ }
+ return NULL;
+} /* SecurityAuditResourceIDAccess */
+
+
+/* SecurityCheckResourceIDAccess
+ *
+ * This function gets plugged into client->CheckAccess and is called from
+ * SecurityLookupIDByType/Class to determine if the client can access the
+ * resource.
+ *
+ * Arguments:
+ * client is the client doing the resource access.
+ * id is the resource id.
+ * rtype is its type or class.
+ * access_mode represents the intended use of the resource; see
+ * resource.h.
+ * rval is a pointer to the resource structure for this resource.
+ *
+ * Returns:
+ * If access is granted, the value of rval that was passed in, else NULL.
+ *
+ * Side Effects:
+ * Disallowed resource accesses are audited.
+ */
+
+static pointer
+SecurityCheckResourceIDAccess(client, id, rtype, access_mode, rval)
+ ClientPtr client;
+ XID id;
+ RESTYPE rtype;
+ Mask access_mode;
+ pointer rval;
+{
+ int cid = CLIENT_ID(id);
+ int reqtype = ((xReq *)client->requestBuffer)->reqType;
+
+ if (SecurityUnknownAccess == access_mode)
+ return rval; /* for compatibility, we have to allow access */
+
+ switch (reqtype)
+ { /* these are always allowed */
+ case X_QueryTree:
+ case X_TranslateCoords:
+ case X_GetGeometry:
+ /* property access is controlled in SecurityCheckPropertyAccess */
+ case X_GetProperty:
+ case X_ChangeProperty:
+ case X_DeleteProperty:
+ case X_RotateProperties:
+ case X_ListProperties:
+ return rval;
+ default:
+ break;
+ }
+
+ if (cid != 0)
+ { /* not a server-owned resource */
+ /*
+ * The following 'if' restricts clients to only access resources at
+ * the same trustLevel. Since there are currently only two trust levels,
+ * and trusted clients never call this function, this degenerates into
+ * saying that untrusted clients can only access resources of other
+ * untrusted clients. One way to add the notion of groups would be to
+ * allow values other than Trusted (0) and Untrusted (1) for this field.
+ * Clients at the same trust level would be able to use each other's
+ * resources, but not those of clients at other trust levels. I haven't
+ * tried it, but this probably mostly works already. The obvious
+ * competing alternative for grouping clients for security purposes is to
+ * use app groups. dpw
+ */
+ if (client->trustLevel == clients[cid]->trustLevel
+#ifdef XAPPGROUP
+ || (RT_COLORMAP == rtype &&
+ XagDefaultColormap (client) == (Colormap) id)
+#endif
+ )
+ return rval;
+ else
+ return SecurityAuditResourceIDAccess(client, id);
+ }
+ else /* server-owned resource - probably a default colormap or root window */
+ {
+ if (RT_WINDOW == rtype || RC_DRAWABLE == rtype)
+ {
+ switch (reqtype)
+ { /* the following operations are allowed on root windows */
+ case X_CreatePixmap:
+ case X_CreateGC:
+ case X_CreateWindow:
+ case X_CreateColormap:
+ case X_ListProperties:
+ case X_GrabPointer:
+ case X_UngrabButton:
+ case X_QueryBestSize:
+ case X_GetWindowAttributes:
+ break;
+ case X_SendEvent:
+ { /* see if it is an event specified by the ICCCM */
+ xSendEventReq *req = (xSendEventReq *)
+ (client->requestBuffer);
+ if (req->propagate == xTrue
+ ||
+ (req->eventMask != ColormapChangeMask &&
+ req->eventMask != StructureNotifyMask &&
+ req->eventMask !=
+ (SubstructureRedirectMask|SubstructureNotifyMask)
+ )
+ ||
+ (req->event.u.u.type != UnmapNotify &&
+ req->event.u.u.type != ConfigureRequest &&
+ req->event.u.u.type != ClientMessage
+ )
+ )
+ { /* not an ICCCM event */
+ return SecurityAuditResourceIDAccess(client, id);
+ }
+ break;
+ } /* case X_SendEvent on root */
+
+ case X_ChangeWindowAttributes:
+ { /* Allow selection of PropertyNotify and StructureNotify
+ * events on the root.
+ */
+ xChangeWindowAttributesReq *req =
+ (xChangeWindowAttributesReq *)(client->requestBuffer);
+ if (req->valueMask == CWEventMask)
+ {
+ CARD32 value = *((CARD32 *)(req + 1));
+ if ( (value &
+ ~(PropertyChangeMask|StructureNotifyMask)) == 0)
+ break;
+ }
+ return SecurityAuditResourceIDAccess(client, id);
+ } /* case X_ChangeWindowAttributes on root */
+
+ default:
+ {
+#ifdef LBX
+ /* XXX really need per extension dispatching */
+ if (reqtype == LbxReqCode) {
+ switch (((xReq *)client->requestBuffer)->data) {
+ case X_LbxGetProperty:
+ case X_LbxChangeProperty:
+ return rval;
+ default:
+ break;
+ }
+ }
+#endif
+ /* others not allowed */
+ return SecurityAuditResourceIDAccess(client, id);
+ }
+ }
+ } /* end server-owned window or drawable */
+ else if (SecurityAuthorizationResType == rtype)
+ {
+ SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval;
+ if (pAuth->trustLevel != client->trustLevel)
+ return SecurityAuditResourceIDAccess(client, id);
+ }
+ else if (RT_COLORMAP != rtype)
+ { /* don't allow anything else besides colormaps */
+ return SecurityAuditResourceIDAccess(client, id);
+ }
+ }
+ return rval;
+} /* SecurityCheckResourceIDAccess */
+
+
+/* SecurityClientStateCallback
+ *
+ * Arguments:
+ * pcbl is &ClientStateCallback.
+ * nullata is NULL.
+ * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
+ * which contains information about client state changes.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ *
+ * If a new client is connecting, its authorization ID is copied to
+ * client->authID. If this is a generated authorization, its reference
+ * count is bumped, its timer is cancelled if it was running, and its
+ * trustlevel is copied to client->trustLevel.
+ *
+ * If a client is disconnecting and the client was using a generated
+ * authorization, the authorization's reference count is decremented, and
+ * if it is now zero, the timer for this authorization is started.
+ */
+
+static void
+SecurityClientStateCallback(pcbl, nulldata, calldata)
+ CallbackListPtr *pcbl;
+ pointer nulldata;
+ pointer calldata;
+{
+ NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
+ ClientPtr client = pci->client;
+
+ switch (client->clientState)
+ {
+ case ClientStateRunning:
+ {
+ XID authId = AuthorizationIDOfClient(client);
+ SecurityAuthorizationPtr pAuth;
+
+ client->authId = authId;
+ pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
+ SecurityAuthorizationResType);
+ if (pAuth)
+ { /* it is a generated authorization */
+ pAuth->refcnt++;
+ if (pAuth->refcnt == 1)
+ {
+ if (pAuth->timer) TimerCancel(pAuth->timer);
+ }
+ client->trustLevel = pAuth->trustLevel;
+ if (client->trustLevel != XSecurityClientTrusted)
+ {
+ client->CheckAccess = SecurityCheckResourceIDAccess;
+ client->requestVector = client->swapped ?
+ SwappedUntrustedProcVector : UntrustedProcVector;
+ }
+ }
+ break;
+ }
+ case ClientStateGone:
+ case ClientStateRetained: /* client disconnected */
+ {
+ XID authId = client->authId;
+ SecurityAuthorizationPtr pAuth;
+
+ pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
+ SecurityAuthorizationResType);
+ if (pAuth)
+ { /* it is a generated authorization */
+ pAuth->refcnt--;
+ if (pAuth->refcnt == 0)
+ {
+ SecurityStartAuthorizationTimer(pAuth);
+ }
+ }
+ break;
+ }
+ default: break;
+ }
+} /* SecurityClientStateCallback */
+
+#ifdef LBX
+Bool
+SecuritySameLevel(client, authId)
+ ClientPtr client;
+ XID authId;
+{
+ SecurityAuthorizationPtr pAuth;
+
+ pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
+ SecurityAuthorizationResType);
+ if (pAuth)
+ return client->trustLevel == pAuth->trustLevel;
+ return client->trustLevel == XSecurityClientTrusted;
+}
+#endif
+
+/* SecurityCensorImage
+ *
+ * Called after pScreen->GetImage to prevent pieces or trusted windows from
+ * being returned in image data from an untrusted window.
+ *
+ * Arguments:
+ * client is the client doing the GetImage.
+ * pVisibleRegion is the visible region of the window.
+ * widthBytesLine is the width in bytes of one horizontal line in pBuf.
+ * pDraw is the source window.
+ * x, y, w, h is the rectangle of image data from pDraw in pBuf.
+ * format is the format of the image data in pBuf: ZPixmap or XYPixmap.
+ * pBuf is the image data.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Any part of the rectangle (x, y, w, h) that is outside the visible
+ * region of the window will be destroyed (overwritten) in pBuf.
+ */
+void
+SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
+ format, pBuf)
+ ClientPtr client;
+ RegionPtr pVisibleRegion;
+ long widthBytesLine;
+ DrawablePtr pDraw;
+ int x, y, w, h;
+ unsigned int format;
+ char * pBuf;
+{
+ RegionRec imageRegion; /* region representing x,y,w,h */
+ RegionRec censorRegion; /* region to obliterate */
+ BoxRec imageBox;
+ int nRects;
+
+ imageBox.x1 = x;
+ imageBox.y1 = y;
+ imageBox.x2 = x + w;
+ imageBox.y2 = y + h;
+ REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
+ REGION_INIT(pScreen, &censorRegion, NullBox, 0);
+
+ /* censorRegion = imageRegion - visibleRegion */
+ REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
+ nRects = REGION_NUM_RECTS(&censorRegion);
+ if (nRects > 0)
+ { /* we have something to censor */
+ GCPtr pScratchGC = NULL;
+ PixmapPtr pPix = NULL;
+ xRectangle *pRects = NULL;
+ Bool failed = FALSE;
+ int depth = 1;
+ int bitsPerPixel = 1;
+ int i;
+ BoxPtr pBox;
+
+ /* convert region to list-of-rectangles for PolyFillRect */
+
+ pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
+ if (!pRects)
+ {
+ failed = TRUE;
+ goto failSafe;
+ }
+ for (pBox = REGION_RECTS(&censorRegion), i = 0;
+ i < nRects;
+ i++, pBox++)
+ {
+ pRects[i].x = pBox->x1;
+ pRects[i].y = pBox->y1 - imageBox.y1;
+ pRects[i].width = pBox->x2 - pBox->x1;
+ pRects[i].height = pBox->y2 - pBox->y1;
+ }
+
+ /* use pBuf as a fake pixmap */
+
+ if (format == ZPixmap)
+ {
+ depth = pDraw->depth;
+ bitsPerPixel = pDraw->bitsPerPixel;
+ }
+
+ pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
+ depth, bitsPerPixel,
+ widthBytesLine, (pointer)pBuf);
+ if (!pPix)
+ {
+ failed = TRUE;
+ goto failSafe;
+ }
+
+ pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
+ if (!pScratchGC)
+ {
+ failed = TRUE;
+ goto failSafe;
+ }
+
+ ValidateGC(&pPix->drawable, pScratchGC);
+ (* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
+ pScratchGC, nRects, pRects);
+
+ failSafe:
+ if (failed)
+ {
+ /* Censoring was not completed above. To be safe, wipe out
+ * all the image data so that nothing trusted gets out.
+ */
+ bzero(pBuf, (int)(widthBytesLine * h));
+ }
+ if (pRects) DEALLOCATE_LOCAL(pRects);
+ if (pScratchGC) FreeScratchGC(pScratchGC);
+ if (pPix) FreeScratchPixmapHeader(pPix);
+ }
+ REGION_UNINIT(pScreen, &imageRegion);
+ REGION_UNINIT(pScreen, &censorRegion);
+} /* SecurityCensorImage */
+
+/**********************************************************************/
+
+typedef struct _PropertyAccessRec {
+ ATOM name;
+ ATOM mustHaveProperty;
+ char *mustHaveValue;
+ char windowRestriction;
+#define SecurityAnyWindow 0
+#define SecurityRootWindow 1
+#define SecurityWindowWithProperty 2
+ char readAction;
+ char writeAction;
+ char destroyAction;
+ struct _PropertyAccessRec *next;
+} PropertyAccessRec, *PropertyAccessPtr;
+
+static PropertyAccessPtr PropertyAccessList = NULL;
+static char SecurityDefaultAction = SecurityErrorOperation;
+static char *SecurityPolicyFile = DEFAULTPOLICYFILE;
+static ATOM SecurityMaxPropertyName = 0;
+
+static char *SecurityKeywords[] = {
+#define SecurityKeywordComment 0
+ "#",
+#define SecurityKeywordProperty 1
+ "property",
+#define SecurityKeywordSitePolicy 2
+ "sitepolicy",
+#define SecurityKeywordRoot 3
+ "root",
+#define SecurityKeywordAny 4
+ "any"
+};
+
+#define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *))
+
+#undef PROPDEBUG
+/*#define PROPDEBUG 1*/
+
+static void
+SecurityFreePropertyAccessList()
+{
+ while (PropertyAccessList)
+ {
+ PropertyAccessPtr freeit = PropertyAccessList;
+ PropertyAccessList = PropertyAccessList->next;
+ xfree(freeit);
+ }
+} /* SecurityFreePropertyAccessList */
+
+#ifndef __EMX__
+#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
+#else
+#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
+#endif
+
+static char *
+SecuritySkipWhitespace(p)
+ char *p;
+{
+ while (SecurityIsWhitespace(*p))
+ p++;
+ return p;
+} /* SecuritySkipWhitespace */
+
+
+static char *
+SecurityParseString(rest)
+ char **rest;
+{
+ char *startOfString;
+ char *s = *rest;
+ char endChar = 0;
+
+ s = SecuritySkipWhitespace(s);
+
+ if (*s == '"' || *s == '\'')
+ {
+ endChar = *s++;
+ startOfString = s;
+ while (*s && (*s != endChar))
+ s++;
+ }
+ else
+ {
+ startOfString = s;
+ while (*s && !SecurityIsWhitespace(*s))
+ s++;
+ }
+ if (*s)
+ {
+ *s = '\0';
+ *rest = s + 1;
+ return startOfString;
+ }
+ else
+ {
+ *rest = s;
+ return (endChar) ? NULL : startOfString;
+ }
+} /* SecurityParseString */
+
+
+static int
+SecurityParseKeyword(p)
+ char **p;
+{
+ int i;
+ char *s = *p;
+ s = SecuritySkipWhitespace(s);
+ for (i = 0; i < NUMKEYWORDS; i++)
+ {
+ int len = strlen(SecurityKeywords[i]);
+ if (strncmp(s, SecurityKeywords[i], len) == 0)
+ {
+ *p = s + len;
+ return (i);
+ }
+ }
+ *p = s;
+ return -1;
+} /* SecurityParseKeyword */
+
+
+static Bool
+SecurityParsePropertyAccessRule(p)
+ char *p;
+{
+ char *propname;
+ char c;
+ char action = SecurityDefaultAction;
+ char readAction, writeAction, destroyAction;
+ PropertyAccessPtr pacl, prev, cur;
+ ATOM atom;
+ char *mustHaveProperty = NULL;
+ char *mustHaveValue = NULL;
+ Bool invalid;
+ char windowRestriction;
+ int size;
+ int keyword;
+
+ /* get property name */
+ propname = SecurityParseString(&p);
+ if (!propname || (strlen(propname) == 0))
+ return FALSE;
+
+ /* get window on which property must reside for rule to apply */
+
+ keyword = SecurityParseKeyword(&p);
+ if (keyword == SecurityKeywordRoot)
+ windowRestriction = SecurityRootWindow;
+ else if (keyword == SecurityKeywordAny)
+ windowRestriction = SecurityAnyWindow;
+ else /* not root or any, must be a property name */
+ {
+ mustHaveProperty = SecurityParseString(&p);
+ if (!mustHaveProperty || (strlen(mustHaveProperty) == 0))
+ return FALSE;
+ windowRestriction = SecurityWindowWithProperty;
+ p = SecuritySkipWhitespace(p);
+ if (*p == '=')
+ { /* property value is specified too */
+ p++; /* skip over '=' */
+ mustHaveValue = SecurityParseString(&p);
+ if (!mustHaveValue)
+ return FALSE;
+ }
+ }
+
+ /* get operations and actions */
+
+ invalid = FALSE;
+ readAction = writeAction = destroyAction = SecurityDefaultAction;
+ while ( (c = *p++) && !invalid)
+ {
+ switch (c)
+ {
+ case 'i': action = SecurityIgnoreOperation; break;
+ case 'a': action = SecurityAllowOperation; break;
+ case 'e': action = SecurityErrorOperation; break;
+
+ case 'r': readAction = action; break;
+ case 'w': writeAction = action; break;
+ case 'd': destroyAction = action; break;
+
+ default :
+ if (!SecurityIsWhitespace(c))
+ invalid = TRUE;
+ break;
+ }
+ }
+ if (invalid)
+ return FALSE;
+
+ /* We've successfully collected all the information needed for this
+ * property access rule. Now record it in a PropertyAccessRec.
+ */
+ size = sizeof(PropertyAccessRec);
+
+ /* If there is a property value string, allocate space for it
+ * right after the PropertyAccessRec.
+ */
+ if (mustHaveValue)
+ size += strlen(mustHaveValue) + 1;
+ pacl = (PropertyAccessPtr)Xalloc(size);
+ if (!pacl)
+ return FALSE;
+
+ pacl->name = MakeAtom(propname, strlen(propname), TRUE);
+ if (pacl->name == BAD_RESOURCE)
+ {
+ Xfree(pacl);
+ return FALSE;
+ }
+ if (mustHaveProperty)
+ {
+ pacl->mustHaveProperty = MakeAtom(mustHaveProperty,
+ strlen(mustHaveProperty), TRUE);
+ if (pacl->mustHaveProperty == BAD_RESOURCE)
+ {
+ Xfree(pacl);
+ return FALSE;
+ }
+ }
+ else
+ pacl->mustHaveProperty = 0;
+
+ if (mustHaveValue)
+ {
+ pacl->mustHaveValue = (char *)(pacl + 1);
+ strcpy(pacl->mustHaveValue, mustHaveValue);
+ }
+ else
+ pacl->mustHaveValue = NULL;
+
+ SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name);
+
+ pacl->windowRestriction = windowRestriction;
+ pacl->readAction = readAction;
+ pacl->writeAction = writeAction;
+ pacl->destroyAction = destroyAction;
+
+ /* link the new rule into the list of rules in order of increasing
+ * property name (atom) value to make searching easier
+ */
+
+ for (prev = NULL, cur = PropertyAccessList;
+ cur && cur->name <= pacl->name;
+ prev = cur, cur = cur->next)
+ ;
+ if (!prev)
+ {
+ pacl->next = cur;
+ PropertyAccessList = pacl;
+ }
+ else
+ {
+ prev->next = pacl;
+ pacl->next = cur;
+ }
+ return TRUE;
+} /* SecurityParsePropertyAccessRule */
+
+static char **SecurityPolicyStrings = NULL;
+static int nSecurityPolicyStrings = 0;
+
+static Bool
+SecurityParseSitePolicy(p)
+ char *p;
+{
+ char *policyStr = SecurityParseString(&p);
+ char *copyPolicyStr;
+ char **newStrings;
+
+ if (!policyStr)
+ return FALSE;
+
+ copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1);
+ if (!copyPolicyStr)
+ return TRUE;
+ strcpy(copyPolicyStr, policyStr);
+ newStrings = (char **)Xrealloc(SecurityPolicyStrings,
+ sizeof (char *) * (nSecurityPolicyStrings + 1));
+ if (!newStrings)
+ {
+ Xfree(copyPolicyStr);
+ return TRUE;
+ }
+
+ SecurityPolicyStrings = newStrings;
+ SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr;
+
+ return TRUE;
+
+} /* SecurityParseSitePolicy */
+
+
+char **
+SecurityGetSitePolicyStrings(n)
+ int *n;
+{
+ *n = nSecurityPolicyStrings;
+ return SecurityPolicyStrings;
+} /* SecurityGetSitePolicyStrings */
+
+static void
+SecurityFreeSitePolicyStrings()
+{
+ if (SecurityPolicyStrings)
+ {
+ assert(nSecurityPolicyStrings);
+ while (nSecurityPolicyStrings--)
+ {
+ Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]);
+ }
+ Xfree(SecurityPolicyStrings);
+ SecurityPolicyStrings = NULL;
+ nSecurityPolicyStrings = 0;
+ }
+} /* SecurityFreeSitePolicyStrings */
+
+
+static void
+SecurityLoadPropertyAccessList()
+{
+ FILE *f;
+ int lineNumber = 0;
+
+ SecurityMaxPropertyName = 0;
+
+ if (!SecurityPolicyFile)
+ return;
+
+#ifndef __EMX__
+ f = fopen(SecurityPolicyFile, "r");
+#else
+ f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
+#endif
+ if (!f)
+ {
+ ErrorF("error opening security policy file %s\n",
+ SecurityPolicyFile);
+ return;
+ }
+
+ while (!feof(f))
+ {
+ char buf[200];
+ Bool validLine;
+ char *p;
+
+ if (!(p = fgets(buf, sizeof(buf), f)))
+ break;
+ lineNumber++;
+
+ /* if first line, check version number */
+ if (lineNumber == 1)
+ {
+ char *v = SecurityParseString(&p);
+ if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0)
+ {
+ ErrorF("%s: invalid security policy file version, ignoring file\n",
+ SecurityPolicyFile);
+ break;
+ }
+ validLine = TRUE;
+ }
+ else
+ {
+ switch (SecurityParseKeyword(&p))
+ {
+ case SecurityKeywordComment:
+ validLine = TRUE;
+ break;
+
+ case SecurityKeywordProperty:
+ validLine = SecurityParsePropertyAccessRule(p);
+ break;
+
+ case SecurityKeywordSitePolicy:
+ validLine = SecurityParseSitePolicy(p);
+ break;
+
+ default:
+ validLine = (*p == '\0'); /* blank lines OK, others not */
+ break;
+ }
+ }
+
+ if (!validLine)
+ ErrorF("Line %d of %s invalid, ignoring\n",
+ lineNumber, SecurityPolicyFile);
+ } /* end while more input */
+
+#ifdef PROPDEBUG
+ {
+ PropertyAccessPtr pacl;
+ char *op = "aie";
+ for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
+ {
+ ErrorF("property %s ", NameForAtom(pacl->name));
+ switch (pacl->windowRestriction)
+ {
+ case SecurityAnyWindow: ErrorF("any "); break;
+ case SecurityRootWindow: ErrorF("root "); break;
+ case SecurityWindowWithProperty:
+ {
+ ErrorF("%s ", NameForAtom(pacl->mustHaveProperty));
+ if (pacl->mustHaveValue)
+ ErrorF(" = \"%s\" ", pacl->mustHaveValue);
+
+ }
+ break;
+ }
+ ErrorF("%cr %cw %cd\n", op[pacl->readAction],
+ op[pacl->writeAction], op[pacl->destroyAction]);
+ }
+ }
+#endif /* PROPDEBUG */
+
+ fclose(f);
+} /* SecurityLoadPropertyAccessList */
+
+
+static Bool
+SecurityMatchString(ws, cs)
+ char *ws;
+ char *cs;
+{
+ while (*ws && *cs)
+ {
+ if (*ws == '*')
+ {
+ Bool match = FALSE;
+ ws++;
+ while (!(match = SecurityMatchString(ws, cs)) && *cs)
+ {
+ cs++;
+ }
+ return match;
+ }
+ else if (*ws == *cs)
+ {
+ ws++;
+ cs++;
+ }
+ else break;
+ }
+ return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') )
+ && (*cs == '\0') );
+} /* SecurityMatchString */
+
+#ifdef PROPDEBUG
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+
+char
+SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
+ ClientPtr client;
+ WindowPtr pWin;
+ ATOM propertyName;
+ Mask access_mode;
+{
+ PropertyAccessPtr pacl;
+ char action = SecurityDefaultAction;
+
+ /* if client trusted or window untrusted, allow operation */
+
+ if ( (client->trustLevel == XSecurityClientTrusted) ||
+ (wClient(pWin)->trustLevel != XSecurityClientTrusted) )
+ return SecurityAllowOperation;
+
+#ifdef PROPDEBUG
+ /* For testing, it's more convenient if the property rules file gets
+ * reloaded whenever it changes, so we can rapidly try things without
+ * having to reset the server.
+ */
+ {
+ struct stat buf;
+ static time_t lastmod = 0;
+ int ret = stat(SecurityPolicyFile , &buf);
+ if ( (ret == 0) && (buf.st_mtime > lastmod) )
+ {
+ ErrorF("reloading property rules\n");
+ SecurityFreePropertyAccessList();
+ SecurityLoadPropertyAccessList();
+ lastmod = buf.st_mtime;
+ }
+ }
+#endif
+
+ /* If the property atom is bigger than any atoms on the list,
+ * we know we won't find it, so don't even bother looking.
+ */
+ if (propertyName <= SecurityMaxPropertyName)
+ {
+ /* untrusted client operating on trusted window; see if it's allowed */
+
+ for (pacl = PropertyAccessList; pacl; pacl = pacl->next)
+ {
+ if (pacl->name < propertyName)
+ continue;
+ if (pacl->name > propertyName)
+ break;
+
+ /* pacl->name == propertyName, so see if it applies to this window */
+
+ switch (pacl->windowRestriction)
+ {
+ case SecurityAnyWindow: /* always applies */
+ break;
+
+ case SecurityRootWindow:
+ {
+ /* if not a root window, this rule doesn't apply */
+ if (pWin->parent)
+ continue;
+ }
+ break;
+
+ case SecurityWindowWithProperty:
+ {
+ PropertyPtr pProp = wUserProps (pWin);
+ Bool match = FALSE;
+ char *p;
+ char *pEndData;
+
+ while (pProp)
+ {
+ if (pProp->propertyName == pacl->mustHaveProperty)
+ break;
+ pProp = pProp->next;
+ }
+ if (!pProp)
+ continue;
+ if (!pacl->mustHaveValue)
+ break;
+ if (pProp->type != XA_STRING || pProp->format != 8)
+ continue;
+
+ p = pProp->data;
+ pEndData = ((char *)pProp->data) + pProp->size;
+ while (!match && p < pEndData)
+ {
+ if (SecurityMatchString(pacl->mustHaveValue, p))
+ match = TRUE;
+ else
+ { /* skip to the next string */
+ while (*p++ && p < pEndData)
+ ;
+ }
+ }
+ if (!match)
+ continue;
+ }
+ break; /* end case SecurityWindowWithProperty */
+ } /* end switch on windowRestriction */
+
+ /* If we get here, the property access rule pacl applies.
+ * If pacl doesn't apply, something above should have
+ * executed a continue, which will skip the follwing code.
+ */
+ action = SecurityAllowOperation;
+ if (access_mode & SecurityReadAccess)
+ action = max(action, pacl->readAction);
+ if (access_mode & SecurityWriteAccess)
+ action = max(action, pacl->writeAction);
+ if (access_mode & SecurityDestroyAccess)
+ action = max(action, pacl->destroyAction);
+ break;
+ } /* end for each pacl */
+ } /* end if propertyName <= SecurityMaxPropertyName */
+
+ if (SecurityAllowOperation != action)
+ { /* audit the access violation */
+ int cid = CLIENT_ID(pWin->drawable.id);
+ int reqtype = ((xReq *)client->requestBuffer)->reqType;
+ char *actionstr = (SecurityIgnoreOperation == action) ?
+ "ignored" : "error";
+ SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n",
+ client->index, reqtype, pWin->drawable.id,
+ NameForAtom(propertyName), propertyName, cid, actionstr);
+ }
+ return action;
+} /* SecurityCheckPropertyAccess */
+
+
+/* SecurityResetProc
+ *
+ * Arguments:
+ * extEntry is the extension information for the security extension.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Performs any cleanup needed by Security at server shutdown time.
+ */
+
+static void
+SecurityResetProc(extEntry)
+ ExtensionEntry *extEntry;
+{
+ SecurityFreePropertyAccessList();
+ SecurityFreeSitePolicyStrings();
+} /* SecurityResetProc */
+
+
+int
+XSecurityOptions(argc, argv, i)
+ int argc;
+ char **argv;
+ int i;
+{
+ if (strcmp(argv[i], "-sp") == 0)
+ {
+ if (i < argc)
+ SecurityPolicyFile = argv[++i];
+ return (i + 1);
+ }
+ return (i);
+} /* XSecurityOptions */
+
+
+
+/* SecurityExtensionInit
+ *
+ * Arguments: none.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Enables the Security extension if possible.
+ */
+
+void
+SecurityExtensionInit()
+{
+ ExtensionEntry *extEntry;
+ int i;
+
+ SecurityAuthorizationResType =
+ CreateNewResourceType(SecurityDeleteAuthorization);
+
+ RTEventClient = CreateNewResourceType(
+ SecurityDeleteAuthorizationEventClient);
+
+ if (!SecurityAuthorizationResType || !RTEventClient)
+ return;
+
+ RTEventClient |= RC_NEVERRETAIN;
+
+ if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL))
+ return;
+
+ extEntry = AddExtension(SECURITY_EXTENSION_NAME,
+ XSecurityNumberEvents, XSecurityNumberErrors,
+ ProcSecurityDispatch, SProcSecurityDispatch,
+ SecurityResetProc, StandardMinorOpcode);
+
+ SecurityErrorBase = extEntry->errorBase;
+ SecurityEventBase = extEntry->eventBase;
+
+ EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
+ SwapSecurityAuthorizationRevokedEvent;
+
+ /* initialize untrusted proc vectors */
+
+ for (i = 0; i < 128; i++)
+ {
+ UntrustedProcVector[i] = ProcVector[i];
+ SwappedUntrustedProcVector[i] = SwappedProcVector[i];
+ }
+
+ /* make sure insecure extensions are not allowed */
+
+ for (i = 128; i < 256; i++)
+ {
+ if (!UntrustedProcVector[i])
+ {
+ UntrustedProcVector[i] = ProcBadRequest;
+ SwappedUntrustedProcVector[i] = ProcBadRequest;
+ }
+ }
+
+ SecurityLoadPropertyAccessList();
+
+} /* SecurityExtensionInit */
diff --git a/xc/programs/Xserver/Xext/shape.c b/xc/programs/Xserver/Xext/shape.c
new file mode 100644
index 000000000..e250a85fc
--- /dev/null
+++ b/xc/programs/Xserver/Xext/shape.c
@@ -0,0 +1,1255 @@
+/* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.9 1999/05/30 03:03:24 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: shape.c /main/39 1998/02/09 15:25:16 kaleb $ */
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#define _SHAPE_SERVER_ /* don't want Xlib structures */
+#include "shapestr.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+typedef RegionPtr (*CreateDftPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
+
+static int ShapeFreeClient(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static int ShapeFreeEvents(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static void SendShapeNotify(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* which */
+#endif
+ );
+static void ShapeResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShapeNotifyEvent(
+#if NeedFunctionPrototypes
+ xShapeNotifyEvent * /* from */,
+ xShapeNotifyEvent * /* to */
+#endif
+ );
+static int
+RegionOperate (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ WindowPtr /* pWin */,
+ int /* kind */,
+ RegionPtr * /* destRgnp */,
+ RegionPtr /* srcRgn */,
+ int /* op */,
+ int /* xoff */,
+ int /* yoff */,
+ CreateDftPtr /* create */
+#endif
+ );
+
+#if NeedFunctionPrototypes
+#define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */)
+#else
+#define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */)
+#endif
+
+static CREATE_PROC(CreateBoundingShape);
+static CREATE_PROC(CreateClipShape);
+
+#undef CREATE_PROC
+
+static DISPATCH_PROC(ProcShapeCombine);
+static DISPATCH_PROC(ProcShapeDispatch);
+static DISPATCH_PROC(ProcShapeGetRectangles);
+static DISPATCH_PROC(ProcShapeInputSelected);
+static DISPATCH_PROC(ProcShapeMask);
+static DISPATCH_PROC(ProcShapeOffset);
+static DISPATCH_PROC(ProcShapeQueryExtents);
+static DISPATCH_PROC(ProcShapeQueryVersion);
+static DISPATCH_PROC(ProcShapeRectangles);
+static DISPATCH_PROC(ProcShapeSelectInput);
+static DISPATCH_PROC(SProcShapeCombine);
+static DISPATCH_PROC(SProcShapeDispatch);
+static DISPATCH_PROC(SProcShapeGetRectangles);
+static DISPATCH_PROC(SProcShapeInputSelected);
+static DISPATCH_PROC(SProcShapeMask);
+static DISPATCH_PROC(SProcShapeOffset);
+static DISPATCH_PROC(SProcShapeQueryExtents);
+static DISPATCH_PROC(SProcShapeQueryVersion);
+static DISPATCH_PROC(SProcShapeRectangles);
+static DISPATCH_PROC(SProcShapeSelectInput);
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#endif
+
+static unsigned char ShapeReqCode = 0;
+static int ShapeEventBase = 0;
+static RESTYPE ClientType, EventType; /* resource types for event masks */
+
+#ifdef PANORAMIX
+extern int PanoramiXNumScreens;
+extern Bool noPanoramiXExtension;
+extern PanoramiXWindow *PanoramiXWinRoot;
+extern PanoramiXPmap *PanoramiXPmapRoot;
+#endif
+/*
+ * each window has a list of clients requesting
+ * ShapeNotify events. Each client has a resource
+ * for each window it selects ShapeNotify input for,
+ * this resource is used to delete the ShapeNotifyRec
+ * entry from the per-window queue.
+ */
+
+typedef struct _ShapeEvent *ShapeEventPtr;
+
+typedef struct _ShapeEvent {
+ ShapeEventPtr next;
+ ClientPtr client;
+ WindowPtr window;
+ XID clientResource;
+} ShapeEventRec;
+
+/****************
+ * ShapeExtensionInit
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ ****************/
+
+void
+ShapeExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ ClientType = CreateNewResourceType(ShapeFreeClient);
+ EventType = CreateNewResourceType(ShapeFreeEvents);
+ if (ClientType && EventType &&
+ (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
+ ProcShapeDispatch, SProcShapeDispatch,
+ ShapeResetProc, StandardMinorOpcode)))
+ {
+ ShapeReqCode = (unsigned char)extEntry->base;
+ ShapeEventBase = extEntry->eventBase;
+ EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+ShapeResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+}
+
+static int
+RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
+ ClientPtr client;
+ WindowPtr pWin;
+ int kind;
+ RegionPtr *destRgnp, srcRgn;
+ int op;
+ int xoff, yoff;
+ CreateDftPtr create; /* creates a reasonable *destRgnp */
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (srcRgn && (xoff || yoff))
+ REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff);
+ if (!pWin->parent)
+ {
+ if (srcRgn)
+ REGION_DESTROY(pScreen, srcRgn);
+ return Success;
+ }
+ switch (op) {
+ case ShapeSet:
+ if (*destRgnp)
+ REGION_DESTROY(pScreen, *destRgnp);
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ break;
+ case ShapeUnion:
+ if (*destRgnp)
+ REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeIntersect:
+ if (*destRgnp)
+ REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ else {
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ }
+ break;
+ case ShapeSubtract:
+ if (!*destRgnp)
+ *destRgnp = (*create)(pWin);
+ REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeInvert:
+ if (!*destRgnp)
+ *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
+ else
+ REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp);
+ break;
+ default:
+ client->errorValue = op;
+ return BadValue;
+ }
+ if (srcRgn)
+ REGION_DESTROY(pScreen, srcRgn);
+ (*pScreen->SetShape) (pWin);
+ SendShapeNotify (pWin, kind);
+ return Success;
+}
+
+static RegionPtr
+CreateBoundingShape (pWin)
+ WindowPtr pWin;
+{
+ BoxRec extents;
+
+ extents.x1 = -wBorderWidth (pWin);
+ extents.y1 = -wBorderWidth (pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+}
+
+static RegionPtr
+CreateClipShape (pWin)
+ WindowPtr pWin;
+{
+ BoxRec extents;
+
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
+ return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+}
+
+static int
+ProcShapeQueryVersion (client)
+ register ClientPtr client;
+{
+ xShapeQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SHAPE_MAJOR_VERSION;
+ rep.minorVersion = SHAPE_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+/*****************
+ * ProcShapeRectangles
+ *
+ *****************/
+
+static int
+ProcShapeRectangles (client)
+ register ClientPtr client;
+{
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ REQUEST(xShapeRectanglesReq);
+ xRectangle *prects;
+ int nrects, ctype;
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
+ int destBounding;
+
+ REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ UpdateCurrentTime();
+ pWin = LookupWindow (stuff->dest, client);
+ if (!pWin)
+ return BadWindow;
+ switch (stuff->destKind) {
+ case ShapeBounding:
+ destBounding = 1;
+ createDefault = CreateBoundingShape;
+ break;
+ case ShapeClip:
+ destBounding = 0;
+ createDefault = CreateClipShape;
+ break;
+ default:
+ client->errorValue = stuff->destKind;
+ return BadValue;
+ }
+ if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
+ (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
+ {
+ client->errorValue = stuff->ordering;
+ return BadValue;
+ }
+ pScreen = pWin->drawable.pScreen;
+ nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
+ if (nrects & 4)
+ return BadLength;
+ nrects >>= 3;
+ prects = (xRectangle *) &stuff[1];
+ ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
+ if (ctype < 0)
+ return BadMatch;
+ srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype);
+
+ if (!pWin->optional)
+ MakeWindowOptional (pWin);
+ if (destBounding)
+ destRgn = &pWin->optional->boundingShape;
+ else
+ destRgn = &pWin->optional->clipShape;
+
+ return RegionOperate (client, pWin, (int)stuff->destKind,
+ destRgn, srcRgn, (int)stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
+}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeRectangles (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeRectanglesReq);
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int j, result;
+
+ REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->dest = pPanoramiXWin->info[j].id;
+ result = ProcShapeRectangles (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+
+
+/**************
+ * ProcShapeMask
+ **************/
+
+
+static int
+ProcShapeMask (client)
+ register ClientPtr client;
+{
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ REQUEST(xShapeMaskReq);
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ PixmapPtr pPixmap;
+ CreateDftPtr createDefault;
+ int destBounding;
+
+ REQUEST_SIZE_MATCH (xShapeMaskReq);
+ UpdateCurrentTime();
+ pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess);
+ if (!pWin)
+ return BadWindow;
+ switch (stuff->destKind) {
+ case ShapeBounding:
+ destBounding = 1;
+ createDefault = CreateBoundingShape;
+ break;
+ case ShapeClip:
+ destBounding = 0;
+ createDefault = CreateClipShape;
+ break;
+ default:
+ client->errorValue = stuff->destKind;
+ return BadValue;
+ }
+ pScreen = pWin->drawable.pScreen;
+ if (stuff->src == None)
+ srcRgn = 0;
+ else {
+ pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src,
+ RT_PIXMAP, SecurityReadAccess);
+ if (!pPixmap)
+ return BadPixmap;
+ if (pPixmap->drawable.pScreen != pScreen ||
+ pPixmap->drawable.depth != 1)
+ return BadMatch;
+ srcRgn = BITMAP_TO_REGION(pScreen, pPixmap);
+ if (!srcRgn)
+ return BadAlloc;
+ }
+
+ if (!pWin->optional)
+ MakeWindowOptional (pWin);
+ if (destBounding)
+ destRgn = &pWin->optional->boundingShape;
+ else
+ destRgn = &pWin->optional->clipShape;
+
+ return RegionOperate (client, pWin, (int)stuff->destKind,
+ destRgn, srcRgn, (int)stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
+}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeMask (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeMaskReq);
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXPmap *pPmap = PanoramiXPmapRoot;
+ int j, result;
+
+ REQUEST_SIZE_MATCH (xShapeMaskReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ PANORAMIXFIND_ID(pPmap, stuff->src);
+ IF_RETURN(!pPmap, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->dest = pPanoramiXWin->info[j].id;
+ stuff->src = pPmap->info[j].id;
+ result = ProcShapeMask (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+
+
+/************
+ * ProcShapeCombine
+ ************/
+
+static int
+ProcShapeCombine (client)
+ register ClientPtr client;
+{
+ WindowPtr pSrcWin, pDestWin;
+ ScreenPtr pScreen;
+ REQUEST(xShapeCombineReq);
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
+ CreateDftPtr createSrc;
+ RegionPtr tmp;
+ int destBounding;
+
+ REQUEST_SIZE_MATCH (xShapeCombineReq);
+ UpdateCurrentTime();
+ pDestWin = LookupWindow (stuff->dest, client);
+ if (!pDestWin)
+ return BadWindow;
+ if (!pDestWin->optional)
+ MakeWindowOptional (pDestWin);
+ switch (stuff->destKind) {
+ case ShapeBounding:
+ destBounding = 1;
+ createDefault = CreateBoundingShape;
+ break;
+ case ShapeClip:
+ destBounding = 0;
+ createDefault = CreateClipShape;
+ break;
+ default:
+ client->errorValue = stuff->destKind;
+ return BadValue;
+ }
+ pScreen = pDestWin->drawable.pScreen;
+
+ pSrcWin = LookupWindow (stuff->src, client);
+ if (!pSrcWin)
+ return BadWindow;
+ switch (stuff->srcKind) {
+ case ShapeBounding:
+ srcRgn = wBoundingShape (pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
+ case ShapeClip:
+ srcRgn = wClipShape (pSrcWin);
+ createSrc = CreateClipShape;
+ break;
+ default:
+ client->errorValue = stuff->srcKind;
+ return BadValue;
+ }
+ if (pSrcWin->drawable.pScreen != pScreen)
+ {
+ return BadMatch;
+ }
+
+ if (srcRgn) {
+ tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
+ REGION_COPY(pScreen, tmp, srcRgn);
+ srcRgn = tmp;
+ } else
+ srcRgn = (*createSrc) (pSrcWin);
+
+ if (!pDestWin->optional)
+ MakeWindowOptional (pDestWin);
+ if (destBounding)
+ destRgn = &pDestWin->optional->boundingShape;
+ else
+ destRgn = &pDestWin->optional->clipShape;
+
+ return RegionOperate (client, pDestWin, (int)stuff->destKind,
+ destRgn, srcRgn, (int)stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
+}
+
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeCombine (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeCombineReq);
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ PanoramiXWindow *pPanoramiXWin2 = PanoramiXWinRoot;
+ int j, result;
+
+ REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ PANORAMIXFIND_ID(pPanoramiXWin2, stuff->src);
+ IF_RETURN(!pPanoramiXWin2, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->dest = pPanoramiXWin->info[j].id;
+ stuff->src = pPanoramiXWin2->info[j].id;
+ result = ProcShapeCombine (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+
+/*************
+ * ProcShapeOffset
+ *************/
+
+static int
+ProcShapeOffset (client)
+ register ClientPtr client;
+{
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ REQUEST(xShapeOffsetReq);
+ RegionPtr srcRgn;
+
+ REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ UpdateCurrentTime();
+ pWin = LookupWindow (stuff->dest, client);
+ if (!pWin)
+ return BadWindow;
+ switch (stuff->destKind) {
+ case ShapeBounding:
+ srcRgn = wBoundingShape (pWin);
+ break;
+ case ShapeClip:
+ srcRgn = wClipShape(pWin);
+ break;
+ default:
+ client->errorValue = stuff->destKind;
+ return BadValue;
+ }
+ pScreen = pWin->drawable.pScreen;
+ if (srcRgn)
+ {
+ REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
+ (*pScreen->SetShape) (pWin);
+ }
+ SendShapeNotify (pWin, (int)stuff->destKind);
+ return Success;
+}
+
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeOffset (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeOffsetReq);
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int j, result;
+
+ REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
+ PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
+ IF_RETURN(!pPanoramiXWin, BadRequest);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
+ stuff->dest = pPanoramiXWin->info[j].id;
+ result = ProcShapeOffset (client);
+ BREAK_IF(result != Success);
+ }
+ return (result);
+}
+#endif
+
+
+static int
+ProcShapeQueryExtents (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeQueryExtentsReq);
+ WindowPtr pWin;
+ xShapeQueryExtentsReply rep;
+ BoxRec extents, *pExtents;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.boundingShaped = (wBoundingShape(pWin) != 0);
+ rep.clipShaped = (wClipShape(pWin) != 0);
+ if (wBoundingShape(pWin)) {
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin));
+ extents = *pExtents;
+ } else {
+ extents.x1 = -wBorderWidth (pWin);
+ extents.y1 = -wBorderWidth (pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ }
+ rep.xBoundingShape = extents.x1;
+ rep.yBoundingShape = extents.y1;
+ rep.widthBoundingShape = extents.x2 - extents.x1;
+ rep.heightBoundingShape = extents.y2 - extents.y1;
+ if (wClipShape(pWin)) {
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin));
+ extents = *pExtents;
+ } else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
+ }
+ rep.xClipShape = extents.x1;
+ rep.yClipShape = extents.y1;
+ rep.widthClipShape = extents.x2 - extents.x1;
+ rep.heightClipShape = extents.y2 - extents.y1;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.xBoundingShape, n);
+ swaps(&rep.yBoundingShape, n);
+ swaps(&rep.widthBoundingShape, n);
+ swaps(&rep.heightBoundingShape, n);
+ swaps(&rep.xClipShape, n);
+ swaps(&rep.yClipShape, n);
+ swaps(&rep.widthClipShape, n);
+ swaps(&rep.heightClipShape, n);
+ }
+ WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+/*ARGSUSED*/
+static int
+ShapeFreeClient (data, id)
+ pointer data;
+ XID id;
+{
+ ShapeEventPtr pShapeEvent;
+ WindowPtr pWin;
+ ShapeEventPtr *pHead, pCur, pPrev;
+
+ pShapeEvent = (ShapeEventPtr) data;
+ pWin = pShapeEvent->window;
+ pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType);
+ if (pHead) {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next)
+ pPrev = pCur;
+ if (pCur)
+ {
+ if (pPrev)
+ pPrev->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ }
+ }
+ xfree ((pointer) pShapeEvent);
+ return 1;
+}
+
+/*ARGSUSED*/
+static int
+ShapeFreeEvents (data, id)
+ pointer data;
+ XID id;
+{
+ ShapeEventPtr *pHead, pCur, pNext;
+
+ pHead = (ShapeEventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource (pCur->clientResource, ClientType);
+ xfree ((pointer) pCur);
+ }
+ xfree ((pointer) pHead);
+ return 1;
+}
+
+static int
+ProcShapeSelectInput (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeSelectInputReq);
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
+ XID clientResource;
+
+ REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess);
+ if (!pWin)
+ return BadWindow;
+ pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
+ pWin->drawable.id, EventType, SecurityWriteAccess);
+ switch (stuff->enable) {
+ case xTrue:
+ if (pHead) {
+
+ /* check for existing entry. */
+ for (pShapeEvent = *pHead;
+ pShapeEvent;
+ pShapeEvent = pShapeEvent->next)
+ {
+ if (pShapeEvent->client == client)
+ return Success;
+ }
+ }
+
+ /* build the entry */
+ pNewShapeEvent = (ShapeEventPtr)
+ xalloc (sizeof (ShapeEventRec));
+ if (!pNewShapeEvent)
+ return BadAlloc;
+ pNewShapeEvent->next = 0;
+ pNewShapeEvent->client = client;
+ pNewShapeEvent->window = pWin;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID (client->index);
+ pNewShapeEvent->clientResource = clientResource;
+ if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead)
+ {
+ pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr));
+ if (!pHead ||
+ !AddResource (pWin->drawable.id, EventType, (pointer)pHead))
+ {
+ FreeResource (clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewShapeEvent->next = *pHead;
+ *pHead = pNewShapeEvent;
+ break;
+ case xFalse:
+ /* delete the interest */
+ if (pHead) {
+ pNewShapeEvent = 0;
+ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client)
+ break;
+ pNewShapeEvent = pShapeEvent;
+ }
+ if (pShapeEvent) {
+ FreeResource (pShapeEvent->clientResource, ClientType);
+ if (pNewShapeEvent)
+ pNewShapeEvent->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ xfree (pShapeEvent);
+ }
+ }
+ break;
+ default:
+ client->errorValue = stuff->enable;
+ return BadValue;
+ }
+ return Success;
+}
+
+/*
+ * deliver the event
+ */
+
+static void
+SendShapeNotify (pWin, which)
+ WindowPtr pWin;
+ int which;
+{
+ ShapeEventPtr *pHead, pShapeEvent;
+ ClientPtr client;
+ xShapeNotifyEvent se;
+ BoxRec extents;
+ RegionPtr region;
+ BYTE shaped;
+
+ pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType);
+ if (!pHead)
+ return;
+ if (which == ShapeBounding) {
+ region = wBoundingShape(pWin);
+ if (region) {
+ extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ shaped = xTrue;
+ } else {
+ extents.x1 = -wBorderWidth (pWin);
+ extents.y1 = -wBorderWidth (pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ shaped = xFalse;
+ }
+ } else {
+ region = wClipShape(pWin);
+ if (region) {
+ extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ shaped = xTrue;
+ } else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
+ shaped = xFalse;
+ }
+ }
+ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ client = pShapeEvent->client;
+ if (client == serverClient || client->clientGone)
+ continue;
+ se.type = ShapeNotify + ShapeEventBase;
+ se.kind = which;
+ se.window = pWin->drawable.id;
+ se.sequenceNumber = client->sequence;
+ se.x = extents.x1;
+ se.y = extents.y1;
+ se.width = extents.x2 - extents.x1;
+ se.height = extents.y2 - extents.y1;
+ se.time = currentTime.milliseconds;
+ se.shaped = shaped;
+ WriteEventsToClient (client, 1, (xEvent *) &se);
+ }
+}
+
+static int
+ProcShapeInputSelected (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeInputSelectedReq);
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, *pHead;
+ int enabled;
+ xShapeInputSelectedReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
+ pWin->drawable.id, EventType, SecurityReadAccess);
+ enabled = xFalse;
+ if (pHead) {
+ for (pShapeEvent = *pHead;
+ pShapeEvent;
+ pShapeEvent = pShapeEvent->next)
+ {
+ if (pShapeEvent->client == client) {
+ enabled = xTrue;
+ break;
+ }
+ }
+ }
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.enabled = enabled;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ }
+ WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
+ return (client->noClientException);
+}
+
+static int
+ProcShapeGetRectangles (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeGetRectanglesReq);
+ WindowPtr pWin;
+ xShapeGetRectanglesReply rep;
+ xRectangle *rects;
+ int nrects, i;
+ RegionPtr region;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
+ pWin = LookupWindow (stuff->window, client);
+ if (!pWin)
+ return BadWindow;
+ switch (stuff->kind) {
+ case ShapeBounding:
+ region = wBoundingShape(pWin);
+ break;
+ case ShapeClip:
+ region = wClipShape(pWin);
+ break;
+ default:
+ client->errorValue = stuff->kind;
+ return BadValue;
+ }
+ if (!region) {
+ nrects = 1;
+ rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle));
+ if (!rects)
+ return BadAlloc;
+ switch (stuff->kind) {
+ case ShapeBounding:
+ rects->x = - (int) wBorderWidth (pWin);
+ rects->y = - (int) wBorderWidth (pWin);
+ rects->width = pWin->drawable.width + wBorderWidth (pWin);
+ rects->height = pWin->drawable.height + wBorderWidth (pWin);
+ break;
+ case ShapeClip:
+ rects->x = 0;
+ rects->y = 0;
+ rects->width = pWin->drawable.width;
+ rects->height = pWin->drawable.height;
+ break;
+ }
+ } else {
+ BoxPtr box;
+ nrects = REGION_NUM_RECTS(region);
+ box = REGION_RECTS(region);
+ rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle));
+ if (!rects && nrects)
+ return BadAlloc;
+ for (i = 0; i < nrects; i++, box++) {
+ rects[i].x = box->x1;
+ rects[i].y = box->y1;
+ rects[i].width = box->x2 - box->x1;
+ rects[i].height = box->y2 - box->y1;
+ }
+ }
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = (nrects * sizeof (xRectangle)) >> 2;
+ rep.ordering = YXBanded;
+ rep.nrects = nrects;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.nrects, n);
+ SwapShorts ((short *)rects, (unsigned long)nrects * 4);
+ }
+ WriteToClient (client, sizeof (rep), (char *) &rep);
+ WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
+ DEALLOCATE_LOCAL (rects);
+ return client->noClientException;
+}
+
+static int
+ProcShapeDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_ShapeQueryVersion:
+ return ProcShapeQueryVersion (client);
+ case X_ShapeRectangles:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShapeRectangles (client);
+ else
+ return ProcShapeRectangles (client);
+#else
+ return ProcShapeRectangles (client);
+#endif
+ case X_ShapeMask:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShapeMask (client);
+ else
+ return ProcShapeMask (client);
+#else
+ return ProcShapeMask (client);
+#endif
+ case X_ShapeCombine:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShapeCombine (client);
+ else
+ return ProcShapeCombine (client);
+#else
+ return ProcShapeCombine (client);
+#endif
+ case X_ShapeOffset:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShapeOffset (client);
+ else
+ return ProcShapeOffset (client);
+#else
+ return ProcShapeOffset (client);
+#endif
+ case X_ShapeQueryExtents:
+ return ProcShapeQueryExtents (client);
+ case X_ShapeSelectInput:
+ return ProcShapeSelectInput (client);
+ case X_ShapeInputSelected:
+ return ProcShapeInputSelected (client);
+ case X_ShapeGetRectangles:
+ return ProcShapeGetRectangles (client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SShapeNotifyEvent(from, to)
+ xShapeNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswapl (from->window, to->window);
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswaps (from->x, to->x);
+ cpswaps (from->y, to->y);
+ cpswaps (from->width, to->width);
+ cpswaps (from->height, to->height);
+ cpswapl (from->time, to->time);
+ to->shaped = from->shaped;
+}
+
+static int
+SProcShapeQueryVersion (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xShapeQueryVersionReq);
+
+ swaps (&stuff->length, n);
+ return ProcShapeQueryVersion (client);
+}
+
+static int
+SProcShapeRectangles (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeRectanglesReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ swapl (&stuff->dest, n);
+ swaps (&stuff->xOff, n);
+ swaps (&stuff->yOff, n);
+ SwapRestS(stuff);
+ return ProcShapeRectangles (client);
+}
+
+static int
+SProcShapeMask (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeMaskReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeMaskReq);
+ swapl (&stuff->dest, n);
+ swaps (&stuff->xOff, n);
+ swaps (&stuff->yOff, n);
+ swapl (&stuff->src, n);
+ return ProcShapeMask (client);
+}
+
+static int
+SProcShapeCombine (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeCombineReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeCombineReq);
+ swapl (&stuff->dest, n);
+ swaps (&stuff->xOff, n);
+ swaps (&stuff->yOff, n);
+ swapl (&stuff->src, n);
+ return ProcShapeCombine (client);
+}
+
+static int
+SProcShapeOffset (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeOffsetReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ swapl (&stuff->dest, n);
+ swaps (&stuff->xOff, n);
+ swaps (&stuff->yOff, n);
+ return ProcShapeOffset (client);
+}
+
+static int
+SProcShapeQueryExtents (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeQueryExtentsReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ swapl (&stuff->window, n);
+ return ProcShapeQueryExtents (client);
+}
+
+static int
+SProcShapeSelectInput (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST (xShapeSelectInputReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ swapl (&stuff->window, n);
+ return ProcShapeSelectInput (client);
+}
+
+static int
+SProcShapeInputSelected (client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST (xShapeInputSelectedReq);
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ swapl (&stuff->window, n);
+ return ProcShapeInputSelected (client);
+}
+
+static int
+SProcShapeGetRectangles (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeGetRectanglesReq);
+ register char n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
+ swapl (&stuff->window, n);
+ return ProcShapeGetRectangles (client);
+}
+
+static int
+SProcShapeDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data) {
+ case X_ShapeQueryVersion:
+ return SProcShapeQueryVersion (client);
+ case X_ShapeRectangles:
+ return SProcShapeRectangles (client);
+ case X_ShapeMask:
+ return SProcShapeMask (client);
+ case X_ShapeCombine:
+ return SProcShapeCombine (client);
+ case X_ShapeOffset:
+ return SProcShapeOffset (client);
+ case X_ShapeQueryExtents:
+ return SProcShapeQueryExtents (client);
+ case X_ShapeSelectInput:
+ return SProcShapeSelectInput (client);
+ case X_ShapeInputSelected:
+ return SProcShapeInputSelected (client);
+ case X_ShapeGetRectangles:
+ return SProcShapeGetRectangles (client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/shm.c b/xc/programs/Xserver/Xext/shm.c
new file mode 100644
index 000000000..113c3008c
--- /dev/null
+++ b/xc/programs/Xserver/Xext/shm.c
@@ -0,0 +1,1156 @@
+/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.16 1999/06/20 08:41:26 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+/* $TOG: shm.c /main/27 1998/02/09 15:25:23 kaleb $ */
+
+#include <sys/types.h>
+#ifndef Lynx
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#else
+#include <ipc.h>
+#include <shm.h>
+#endif
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "extnsionst.h"
+#include "servermd.h"
+#define _XSHM_SERVER_
+#include "shmstr.h"
+#include "Xfuncproto.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+extern int PanoramiXNumScreens;
+extern Bool noPanoramiXExtension;
+extern PanoramiXWindow *PanoramiXWinRoot;
+extern PanoramiXPmap *PanoramiXPmapRoot;
+extern PanoramiXGC *PanoramiXGCRoot;
+extern PanoramiXData *panoramiXdataPtr;
+#endif
+
+typedef struct _ShmDesc {
+ struct _ShmDesc *next;
+ int shmid;
+ int refcnt;
+ char *addr;
+ Bool writable;
+ unsigned long size;
+} ShmDescRec, *ShmDescPtr;
+
+static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
+static int ShmDetachSegment(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* shmseg */
+#endif
+ );
+static void ShmResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShmCompletionEvent(
+#if NeedFunctionPrototypes
+ xShmCompletionEvent * /* from */,
+ xShmCompletionEvent * /* to */
+#endif
+ );
+
+static DISPATCH_PROC(ProcShmAttach);
+static DISPATCH_PROC(ProcShmCreatePixmap);
+static DISPATCH_PROC(ProcShmDetach);
+static DISPATCH_PROC(ProcShmDispatch);
+static DISPATCH_PROC(ProcShmGetImage);
+static DISPATCH_PROC(ProcShmGetImage);
+static DISPATCH_PROC(ProcShmGetImage);
+static DISPATCH_PROC(ProcShmPutImage);
+static DISPATCH_PROC(ProcShmQueryVersion);
+static DISPATCH_PROC(SProcShmAttach);
+static DISPATCH_PROC(SProcShmCreatePixmap);
+static DISPATCH_PROC(SProcShmDetach);
+static DISPATCH_PROC(SProcShmDispatch);
+static DISPATCH_PROC(SProcShmGetImage);
+static DISPATCH_PROC(SProcShmPutImage);
+static DISPATCH_PROC(SProcShmQueryVersion);
+
+static unsigned char ShmReqCode;
+static int ShmCompletionCode;
+static int BadShmSegCode;
+RESTYPE ShmSegType, ShmPixType;
+static ShmDescPtr Shmsegs;
+static Bool sharedPixmaps;
+static int pixmapFormat;
+static int shmPixFormat[MAXSCREENS];
+static ShmFuncsPtr shmFuncs[MAXSCREENS];
+static ShmFuncs miFuncs = {NULL, miShmPutImage};
+static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
+
+#define VERIFY_SHMSEG(shmseg,shmdesc,client) \
+{ \
+ shmdesc = (ShmDescPtr)LookupIDByType(shmseg, ShmSegType); \
+ if (!shmdesc) \
+ { \
+ client->errorValue = shmseg; \
+ return BadShmSegCode; \
+ } \
+}
+
+#define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
+{ \
+ VERIFY_SHMSEG(shmseg, shmdesc, client); \
+ if ((offset & 3) || (offset > shmdesc->size)) \
+ { \
+ client->errorValue = offset; \
+ return BadValue; \
+ } \
+ if (needwrite && !shmdesc->writable) \
+ return BadAccess; \
+}
+
+#define VERIFY_SHMSIZE(shmdesc,offset,len,client) \
+{ \
+ if ((offset + len) > shmdesc->size) \
+ { \
+ return BadAccess; \
+ } \
+}
+
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#include <sys/signal.h>
+
+static Bool badSysCall = FALSE;
+
+static void
+SigSysHandler(signo)
+int signo;
+{
+ badSysCall = TRUE;
+}
+
+static Bool CheckForShmSyscall()
+{
+ void (*oldHandler)();
+ int shmid = -1;
+
+ /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
+ oldHandler = signal(SIGSYS, SigSysHandler);
+
+ badSysCall = FALSE;
+ shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
+ /* Clean up */
+ if (shmid != -1)
+ {
+ shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
+ }
+ signal(SIGSYS, oldHandler);
+ return(!badSysCall);
+}
+#endif
+
+void
+ShmExtensionInit()
+{
+ ExtensionEntry *extEntry;
+ int i;
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ if (!CheckForShmSyscall())
+ {
+ ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
+ return;
+ }
+#endif
+
+ sharedPixmaps = xFalse;
+ pixmapFormat = 0;
+#ifndef INTERNAL_VS_EXTERNAL_PADDING
+#ifdef PANORAMIX
+ if(noPanoramiXExtension)
+#endif
+ {
+ sharedPixmaps = xTrue;
+ pixmapFormat = shmPixFormat[0];
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ if (!shmFuncs[i])
+ shmFuncs[i] = &miFuncs;
+ if (!shmFuncs[i]->CreatePixmap)
+ sharedPixmaps = xFalse;
+ if (shmPixFormat[i] && (shmPixFormat[i] != pixmapFormat))
+ {
+ sharedPixmaps = xFalse;
+ pixmapFormat = 0;
+ }
+ }
+ if (!pixmapFormat)
+ pixmapFormat = ZPixmap;
+ }
+#endif
+ ShmSegType = CreateNewResourceType(ShmDetachSegment);
+ ShmPixType = CreateNewResourceType(ShmDetachSegment);
+ if (ShmSegType && ShmPixType &&
+ (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
+ ProcShmDispatch, SProcShmDispatch,
+ ShmResetProc, StandardMinorOpcode)))
+ {
+ ShmReqCode = (unsigned char)extEntry->base;
+ ShmCompletionCode = extEntry->eventBase;
+ BadShmSegCode = extEntry->errorBase;
+ EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+ShmResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+ int i;
+
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ shmFuncs[i] = (ShmFuncsPtr)NULL;
+ shmPixFormat[i] = 0;
+ }
+}
+
+void
+ShmRegisterFuncs(pScreen, funcs)
+ ScreenPtr pScreen;
+ ShmFuncsPtr funcs;
+{
+ shmFuncs[pScreen->myNum] = funcs;
+}
+
+void
+ShmSetPixmapFormat(pScreen, format)
+ ScreenPtr pScreen;
+ int format;
+{
+ shmPixFormat[pScreen->myNum] = format;
+}
+
+void
+ShmRegisterFbFuncs(pScreen)
+ ScreenPtr pScreen;
+{
+ shmFuncs[pScreen->myNum] = &fbFuncs;
+}
+
+static int
+ProcShmQueryVersion(client)
+ register ClientPtr client;
+{
+ xShmQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xShmQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.sharedPixmaps = sharedPixmaps;
+ rep.pixmapFormat = pixmapFormat;
+ rep.majorVersion = SHM_MAJOR_VERSION;
+ rep.minorVersion = SHM_MINOR_VERSION;
+ rep.uid = geteuid();
+ rep.gid = getegid();
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ swaps(&rep.uid, n);
+ swaps(&rep.gid, n);
+ }
+ WriteToClient(client, sizeof(xShmQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcShmAttach(client)
+ register ClientPtr client;
+{
+ struct shmid_ds buf;
+ ShmDescPtr shmdesc;
+ REQUEST(xShmAttachReq);
+
+ REQUEST_SIZE_MATCH(xShmAttachReq);
+ LEGAL_NEW_RESOURCE(stuff->shmseg, client);
+ if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
+ {
+ client->errorValue = stuff->readOnly;
+ return(BadValue);
+ }
+ for (shmdesc = Shmsegs;
+ shmdesc && (shmdesc->shmid != stuff->shmid);
+ shmdesc = shmdesc->next)
+ ;
+ if (shmdesc)
+ {
+ if (!stuff->readOnly && !shmdesc->writable)
+ return BadAccess;
+ shmdesc->refcnt++;
+ }
+ else
+ {
+ shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec));
+ if (!shmdesc)
+ return BadAlloc;
+ shmdesc->addr = shmat(stuff->shmid, 0,
+ stuff->readOnly ? SHM_RDONLY : 0);
+ if ((shmdesc->addr == ((char *)-1)) ||
+ shmctl(stuff->shmid, IPC_STAT, &buf))
+ {
+ xfree(shmdesc);
+ return BadAccess;
+ }
+ shmdesc->shmid = stuff->shmid;
+ shmdesc->refcnt = 1;
+ shmdesc->writable = !stuff->readOnly;
+ shmdesc->size = buf.shm_segsz;
+ shmdesc->next = Shmsegs;
+ Shmsegs = shmdesc;
+ }
+ if (!AddResource(stuff->shmseg, ShmSegType, (pointer)shmdesc))
+ return BadAlloc;
+ return(client->noClientException);
+}
+
+/*ARGSUSED*/
+static int
+ShmDetachSegment(value, shmseg)
+ pointer value; /* must conform to DeleteType */
+ XID shmseg;
+{
+ ShmDescPtr shmdesc = (ShmDescPtr)value;
+ ShmDescPtr *prev;
+
+ if (--shmdesc->refcnt)
+ return TRUE;
+ shmdt(shmdesc->addr);
+ for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
+ ;
+ *prev = shmdesc->next;
+ xfree(shmdesc);
+ return Success;
+}
+
+static int
+ProcShmDetach(client)
+ register ClientPtr client;
+{
+ ShmDescPtr shmdesc;
+ REQUEST(xShmDetachReq);
+
+ REQUEST_SIZE_MATCH(xShmDetachReq);
+ VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
+ FreeResource(stuff->shmseg, RT_NONE);
+ return(client->noClientException);
+}
+
+static void
+miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
+ DrawablePtr dst;
+ GCPtr pGC;
+ int depth, w, h, sx, sy, sw, sh, dx, dy;
+ unsigned int format;
+ char *data;
+{
+ PixmapPtr pmap;
+ GCPtr putGC;
+
+ putGC = GetScratchGC(depth, dst->pScreen);
+ if (!putGC)
+ return;
+ pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth);
+ if (!pmap)
+ {
+ FreeScratchGC(putGC);
+ return;
+ }
+ ValidateGC((DrawablePtr)pmap, putGC);
+ (*putGC->ops->PutImage)((DrawablePtr)pmap, putGC, depth, -sx, -sy, w, h, 0,
+ (format == XYPixmap) ? XYPixmap : ZPixmap, data);
+ FreeScratchGC(putGC);
+ if (format == XYBitmap)
+ (void)(*pGC->ops->CopyPlane)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
+ dx, dy, 1L);
+ else
+ (void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
+ dx, dy);
+ (*pmap->drawable.pScreen->DestroyPixmap)(pmap);
+}
+
+static void
+fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
+ DrawablePtr dst;
+ GCPtr pGC;
+ int depth, w, h, sx, sy, sw, sh, dx, dy;
+ unsigned int format;
+ char *data;
+{
+ if ((format == ZPixmap) || (depth == 1))
+ {
+ PixmapPtr pPixmap;
+
+ pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
+ BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
+ if (!pPixmap)
+ return;
+ if (format == XYBitmap)
+ (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC,
+ sx, sy, sw, sh, dx, dy, 1L);
+ else
+ (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC,
+ sx, sy, sw, sh, dx, dy);
+ FreeScratchPixmapHeader(pPixmap);
+ }
+ else
+ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
+ data);
+}
+
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShmPutImage(register ClientPtr client)
+{
+ GC *pGC;
+ DrawablePtr pDraw;
+ int j;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXRoot;
+ PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ int orig_x, orig_y;
+ int result;
+ Bool sendEvent;
+
+ REQUEST(xShmPutImageReq);
+ REQUEST_SIZE_MATCH(xShmPutImageReq);
+
+ pDraw = (DrawablePtr) SecurityLookupIDByClass(
+ client, stuff->drawable, RC_DRAWABLE, SecurityReadAccess);
+ IF_RETURN(!pDraw, BadDrawable);
+ pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
+ ? PanoramiXPmapRoot : PanoramiXWinRoot;
+ pPanoramiXWin = pPanoramiXRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
+ IF_RETURN(!pPanoramiXWin,BadDrawable);
+ PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
+ IF_RETURN(!pPanoramiXGC, BadGC);
+ orig_x = stuff->dstX;
+ orig_y = stuff->dstY;
+ sendEvent = stuff->sendEvent;
+ stuff->sendEvent = 0;
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
+ if(!j) stuff->sendEvent = sendEvent;
+ stuff->drawable = pPanoramiXWin->info[j].id;
+ stuff->gc = pPanoramiXGC->info[j].id;
+ if (pPanoramiXWin == pPanoramiXRoot) {
+ stuff->dstX = orig_x - panoramiXdataPtr[j].x;
+ stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = ProcShmPutImage(client);
+ BREAK_IF(result != client->noClientException);
+ }
+ return(result);
+}
+#endif
+
+#ifdef PANORAMIX
+static
+#endif
+int
+ProcShmPutImage(client)
+ register ClientPtr client;
+{
+ register GCPtr pGC;
+ register DrawablePtr pDraw;
+ long length;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ long lengthProto;
+ char *tmpImage;
+ int tmpAlloced = 0;
+#endif
+ ShmDescPtr shmdesc;
+ REQUEST(xShmPutImageReq);
+
+ REQUEST_SIZE_MATCH(xShmPutImageReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
+ if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
+ return BadValue;
+ if (stuff->format == XYBitmap)
+ {
+ if (stuff->depth != 1)
+ return BadMatch;
+ length = PixmapBytePad(stuff->totalWidth, 1);
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
+#endif
+ }
+ else if (stuff->format == XYPixmap)
+ {
+ if (pDraw->depth != stuff->depth)
+ return BadMatch;
+ length = PixmapBytePad(stuff->totalWidth, 1);
+ length *= stuff->depth;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
+ lengthProto *= stuff->depth;
+#endif
+ }
+ else if (stuff->format == ZPixmap)
+ {
+ if (pDraw->depth != stuff->depth)
+ return BadMatch;
+ length = PixmapBytePad(stuff->totalWidth, stuff->depth);
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth);
+#endif
+ }
+ else
+ {
+ client->errorValue = stuff->format;
+ return BadValue;
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight,
+ client);
+#else
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
+ client);
+#endif
+ if (stuff->srcX > stuff->totalWidth)
+ {
+ client->errorValue = stuff->srcX;
+ return BadValue;
+ }
+ if (stuff->srcY > stuff->totalHeight)
+ {
+ client->errorValue = stuff->srcY;
+ return BadValue;
+ }
+ if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth)
+ {
+ client->errorValue = stuff->srcWidth;
+ return BadValue;
+ }
+ if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight)
+ {
+ client->errorValue = stuff->srcHeight;
+ return BadValue;
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* handle 64 bit case where protocol may pad to 32 and we want 64
+ * In this case, length is what the server wants and lengthProto is
+ * what the protocol thinks it is. If the the two are different,
+ * copy the protocol version (i.e. the memory shared between the
+ * server and the client) to a version with a scanline pad of 64.
+ */
+ if (length != lengthProto)
+ {
+ register int i;
+ char * stuffptr, /* pointer into protocol data */
+ * tmpptr; /* new location to copy to */
+
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
+ return (BadAlloc);
+ tmpAlloced = 1;
+
+ bzero(tmpImage,length*stuff->totalHeight);
+
+ if (stuff->format == XYPixmap)
+ {
+ int lineBytes = PixmapBytePad(stuff->totalWidth, 1);
+ int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1);
+ int depth = stuff->depth;
+
+ stuffptr = shmdesc->addr + stuff->offset ;
+ tmpptr = tmpImage;
+ for (i = 0; i < stuff->totalHeight*stuff->depth;
+ stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
+ memmove(tmpptr,stuffptr,lineBytesProto);
+ }
+ else
+ {
+ for (i = 0,
+ stuffptr = shmdesc->addr + stuff->offset,
+ tmpptr=tmpImage;
+ i < stuff->totalHeight;
+ stuffptr += lengthProto,tmpptr += length, i++)
+ memmove(tmpptr,stuffptr,lengthProto);
+ }
+ }
+ /* handle 64-bit case where stuff is not 64-bit aligned
+ */
+ else if ((unsigned long)(shmdesc->addr+stuff->offset) &
+ (sizeof(long)-1))
+ {
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
+ return (BadAlloc);
+ tmpAlloced = 1;
+ memmove(tmpImage,(char *)(shmdesc->addr+stuff->offset),
+ length*stuff->totalHeight);
+ }
+ else
+ tmpImage = (char *)(shmdesc->addr+stuff->offset);
+#endif
+
+ if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
+ ((stuff->format != ZPixmap) &&
+ (stuff->srcX < screenInfo.bitmapScanlinePad) &&
+ ((stuff->format == XYBitmap) ||
+ ((stuff->srcY == 0) &&
+ (stuff->srcHeight == stuff->totalHeight))))) &&
+ ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth))
+ (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth,
+ stuff->dstX, stuff->dstY,
+ stuff->totalWidth, stuff->srcHeight,
+ stuff->srcX, stuff->format,
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ tmpImage +
+#else
+ shmdesc->addr + stuff->offset +
+#endif
+ (stuff->srcY * length));
+ else
+ (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
+ pDraw, pGC, stuff->depth, stuff->format,
+ stuff->totalWidth, stuff->totalHeight,
+ stuff->srcX, stuff->srcY,
+ stuff->srcWidth, stuff->srcHeight,
+ stuff->dstX, stuff->dstY,
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ tmpImage);
+
+#else
+ shmdesc->addr + stuff->offset);
+#endif
+
+ if (stuff->sendEvent)
+ {
+ xShmCompletionEvent ev;
+
+ ev.type = ShmCompletionCode;
+ ev.drawable = stuff->drawable;
+ ev.sequenceNumber = client->sequence;
+ ev.minorEvent = X_ShmPutImage;
+ ev.majorEvent = ShmReqCode;
+ ev.shmseg = stuff->shmseg;
+ ev.offset = stuff->offset;
+ WriteEventsToClient(client, 1, (xEvent *) &ev);
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if (tmpAlloced)
+ DEALLOCATE_LOCAL(tmpImage);
+#endif
+
+ return (client->noClientException);
+}
+
+
+
+static int
+ProcShmGetImage(client)
+ register ClientPtr client;
+{
+ register DrawablePtr pDraw;
+ long lenPer, length;
+ Mask plane;
+ xShmGetImageReply xgi;
+ ShmDescPtr shmdesc;
+ int n;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ long widthBytesLine,widthBytesLineProto;
+ long lenPerProto,lengthProto;
+ char *tmpImage;
+ int tmpAlloced = 0;
+#endif
+
+ REQUEST(xShmGetImageReq);
+
+ REQUEST_SIZE_MATCH(xShmGetImageReq);
+ if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
+ {
+ client->errorValue = stuff->format;
+ return(BadValue);
+ }
+ VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ if( /* check for being viewable */
+ !((WindowPtr) pDraw)->realized ||
+ /* check for being on screen */
+ pDraw->x + stuff->x < 0 ||
+ pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width ||
+ pDraw->y + stuff->y < 0 ||
+ pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height ||
+ /* check for being inside of border */
+ stuff->x < - wBorderWidth((WindowPtr)pDraw) ||
+ stuff->x + (int)stuff->width >
+ wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ stuff->y < -wBorderWidth((WindowPtr)pDraw) ||
+ stuff->y + (int)stuff->height >
+ wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
+ )
+ return(BadMatch);
+ xgi.visual = wVisual(((WindowPtr)pDraw));
+ }
+ else
+ {
+ if (stuff->x < 0 ||
+ stuff->x+(int)stuff->width > pDraw->width ||
+ stuff->y < 0 ||
+ stuff->y+(int)stuff->height > pDraw->height
+ )
+ return(BadMatch);
+ xgi.visual = None;
+ }
+ xgi.type = X_Reply;
+ xgi.length = 0;
+ xgi.sequenceNumber = client->sequence;
+ xgi.depth = pDraw->depth;
+ if(stuff->format == ZPixmap)
+ {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
+ length = widthBytesLine * stuff->height;
+ widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
+ lengthProto = widthBytesLineProto * stuff->height;
+#else
+ length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
+#endif
+ }
+ else
+ {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLine = PixmapBytePad(stuff->width, 1);
+ lenPer = widthBytesLine * stuff->height;
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
+
+ widthBytesLineProto = PixmapBytePadProto(stuff->width, 1);
+ lenPerProto = widthBytesLineProto * stuff->height;
+ lengthProto = lenPerProto * Ones(stuff->planeMask &
+ (plane | (plane - 1)));
+#else
+ lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
+#endif
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client);
+ xgi.size = lengthProto;
+#else
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
+ xgi.size = length;
+#endif
+
+ if (length == 0)
+ {
+ /* nothing to do */
+ }
+ else if (stuff->format == ZPixmap)
+ {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* check for protocol/server padding differences.
+ */
+ if ((widthBytesLine != widthBytesLineProto) ||
+ ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1)))
+ {
+ /* temp stuff for 64 bit alignment stuff */
+ register char * bufPtr, * protoPtr;
+ register int i;
+
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
+ return (BadAlloc);
+ tmpAlloced = 1;
+
+ (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, stuff->planeMask,
+ tmpImage);
+
+ /* for 64-bit server, convert image to pad to 32 bits
+ */
+ bzero(shmdesc->addr + stuff->offset,lengthProto);
+
+ for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset;
+ i < stuff->height;
+ bufPtr += widthBytesLine,protoPtr += widthBytesLineProto,
+ i++)
+ memmove(protoPtr,bufPtr,widthBytesLineProto);
+ }
+ else
+ {
+ (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, stuff->planeMask,
+ shmdesc->addr + stuff->offset);
+ }
+#else
+ (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, stuff->planeMask,
+ shmdesc->addr + stuff->offset);
+#endif
+ }
+ else
+ {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* check for protocol/server padding differences.
+ */
+ if ((widthBytesLine != widthBytesLineProto) ||
+ ((unsigned long)shmdesc->addr + stuff->offset &
+ (sizeof(long)-1)))
+ {
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
+ return (BadAlloc);
+ tmpAlloced = 1;
+ }
+#endif
+
+ length = stuff->offset;
+ for (; plane; plane >>= 1)
+ {
+ if (stuff->planeMask & plane)
+ {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if ((widthBytesLine != widthBytesLineProto) ||
+ ((unsigned long)shmdesc->addr + stuff->offset &
+ (sizeof(long)-1)))
+ {
+ /* get image for each plane.
+ */
+ (*pDraw->pScreen->GetImage)(pDraw,
+ stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, plane,
+ tmpImage);
+
+ /* for 64-bit server, convert image to pad to 32 bits */
+ bzero(shmdesc->addr+length, widthBytesLine);
+ memmove(shmdesc->addr+length, tmpImage, widthBytesLineProto);
+ /* increment length */
+ length += lenPerProto;
+ }
+ else /* no diff between protocol and server */
+ {
+ (*pDraw->pScreen->GetImage)(pDraw,
+ stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, plane,
+ shmdesc->addr + length);
+ length += lenPer;
+ }
+#else
+ (*pDraw->pScreen->GetImage)(pDraw,
+ stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ stuff->format, plane,
+ shmdesc->addr + length);
+ length += lenPer;
+#endif
+ }
+ }
+ }
+
+ if (client->swapped) {
+ swaps(&xgi.sequenceNumber, n);
+ swapl(&xgi.length, n);
+ swapl(&xgi.visual, n);
+ swapl(&xgi.size, n);
+ }
+ WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if (tmpAlloced)
+ DEALLOCATE_LOCAL(tmpImage);
+#endif
+
+ return(client->noClientException);
+}
+
+static PixmapPtr
+fbShmCreatePixmap (pScreen, width, height, depth, addr)
+ ScreenPtr pScreen;
+ int width;
+ int height;
+ int depth;
+ char *addr;
+{
+ register PixmapPtr pPixmap;
+
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth);
+ if (!pPixmap)
+ return NullPixmap;
+
+ if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
+ BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
+ (*pScreen->DestroyPixmap)(pPixmap);
+ return NullPixmap;
+ }
+ return pPixmap;
+}
+
+static int
+ProcShmCreatePixmap(client)
+ register ClientPtr client;
+{
+ PixmapPtr pMap;
+ register DrawablePtr pDraw;
+ DepthPtr pDepth;
+ register int i;
+ ShmDescPtr shmdesc;
+ REQUEST(xShmCreatePixmapReq);
+
+ REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
+ client->errorValue = stuff->pid;
+ if (!sharedPixmaps)
+ return BadImplementation;
+ LEGAL_NEW_RESOURCE(stuff->pid, client);
+ VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ if (stuff->depth != 1)
+ {
+ pDepth = pDraw->pScreen->allowedDepths;
+ for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
+ return BadValue;
+ }
+CreatePmap:
+ VERIFY_SHMSIZE(shmdesc, stuff->offset,
+ PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
+ client);
+ pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)(
+ pDraw->pScreen, stuff->width,
+ stuff->height, stuff->depth,
+ shmdesc->addr + stuff->offset);
+ if (pMap)
+ {
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = stuff->pid;
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
+ {
+ shmdesc->refcnt++;
+ if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc))
+ return(client->noClientException);
+ FreeResource(stuff->pid, RT_NONE);
+ }
+ }
+ return (BadAlloc);
+}
+
+static int
+ProcShmDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_ShmQueryVersion:
+ return ProcShmQueryVersion(client);
+ case X_ShmAttach:
+ return ProcShmAttach(client);
+ case X_ShmDetach:
+ return ProcShmDetach(client);
+ case X_ShmPutImage:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmPutImage(client);
+#endif
+ return ProcShmPutImage(client);
+ case X_ShmGetImage:
+ return ProcShmGetImage(client);
+ case X_ShmCreatePixmap:
+ return ProcShmCreatePixmap(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SShmCompletionEvent(from, to)
+ xShmCompletionEvent *from, *to;
+{
+ to->type = from->type;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->drawable, to->drawable);
+ cpswaps(from->minorEvent, to->minorEvent);
+ to->majorEvent = from->majorEvent;
+ cpswapl(from->shmseg, to->shmseg);
+ cpswapl(from->offset, to->offset);
+}
+
+static int
+SProcShmQueryVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmQueryVersionReq);
+
+ swaps(&stuff->length, n);
+ return ProcShmQueryVersion(client);
+}
+
+static int
+SProcShmAttach(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmAttachReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShmAttachReq);
+ swapl(&stuff->shmseg, n);
+ swapl(&stuff->shmid, n);
+ return ProcShmAttach(client);
+}
+
+static int
+SProcShmDetach(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmDetachReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShmDetachReq);
+ swapl(&stuff->shmseg, n);
+ return ProcShmDetach(client);
+}
+
+static int
+SProcShmPutImage(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmPutImageReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShmPutImageReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->totalWidth, n);
+ swaps(&stuff->totalHeight, n);
+ swaps(&stuff->srcX, n);
+ swaps(&stuff->srcY, n);
+ swaps(&stuff->srcWidth, n);
+ swaps(&stuff->srcHeight, n);
+ swaps(&stuff->dstX, n);
+ swaps(&stuff->dstY, n);
+ swapl(&stuff->shmseg, n);
+ swapl(&stuff->offset, n);
+ return ProcShmPutImage(client);
+}
+
+static int
+SProcShmGetImage(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmGetImageReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShmGetImageReq);
+ swapl(&stuff->drawable, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swapl(&stuff->planeMask, n);
+ swapl(&stuff->shmseg, n);
+ swapl(&stuff->offset, n);
+ return ProcShmGetImage(client);
+}
+
+static int
+SProcShmCreatePixmap(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xShmCreatePixmapReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
+ swapl(&stuff->drawable, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swapl(&stuff->shmseg, n);
+ swapl(&stuff->offset, n);
+ return ProcShmCreatePixmap(client);
+}
+
+static int
+SProcShmDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_ShmQueryVersion:
+ return SProcShmQueryVersion(client);
+ case X_ShmAttach:
+ return SProcShmAttach(client);
+ case X_ShmDetach:
+ return SProcShmDetach(client);
+ case X_ShmPutImage:
+ return SProcShmPutImage(client);
+ case X_ShmGetImage:
+ return SProcShmGetImage(client);
+ case X_ShmCreatePixmap:
+ return SProcShmCreatePixmap(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/sleepuntil.c b/xc/programs/Xserver/Xext/sleepuntil.c
new file mode 100644
index 000000000..1c1b1fb79
--- /dev/null
+++ b/xc/programs/Xserver/Xext/sleepuntil.c
@@ -0,0 +1,238 @@
+/*
+ * $TOG: sleepuntil.c /main/6 1998/02/09 15:25:28 kaleb $
+ *
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.1 1998/10/04 09:36:49 dawes Exp $ */
+
+/* dixsleep.c - implement millisecond timeouts for X clients */
+
+#include "X.h"
+#include "Xmd.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+typedef struct _Sertafied {
+ struct _Sertafied *next;
+ TimeStamp revive;
+ ClientPtr pClient;
+ XID id;
+ void (*notifyFunc)(
+#if NeedNestedPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+ );
+
+ pointer closure;
+} SertafiedRec, *SertafiedPtr;
+
+static SertafiedPtr pPending;
+static RESTYPE SertafiedResType;
+static Bool BlockHandlerRegistered;
+static int SertafiedGeneration;
+
+static void ClientAwaken(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+);
+static int SertafiedDelete(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+static void SertafiedBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ OSTimePtr /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+static void SertafiedWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ int /* i */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+int
+ClientSleepUntil (client, revive, notifyFunc, closure)
+ ClientPtr client;
+ TimeStamp *revive;
+ void (*notifyFunc)();
+ pointer closure;
+{
+ SertafiedPtr pRequest, pReq, pPrev;
+
+ if (SertafiedGeneration != serverGeneration)
+ {
+ SertafiedResType = CreateNewResourceType (SertafiedDelete);
+ if (!SertafiedResType)
+ return FALSE;
+ SertafiedGeneration = serverGeneration;
+ BlockHandlerRegistered = FALSE;
+ }
+ pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec));
+ if (!pRequest)
+ return FALSE;
+ pRequest->pClient = client;
+ pRequest->revive = *revive;
+ pRequest->id = FakeClientID (client->index);
+ pRequest->closure = closure;
+ if (!BlockHandlerRegistered)
+ {
+ if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
+ SertafiedWakeupHandler,
+ (pointer) 0))
+ {
+ xfree (pRequest);
+ return FALSE;
+ }
+ BlockHandlerRegistered = TRUE;
+ }
+ pRequest->notifyFunc = 0;
+ if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
+ return FALSE;
+ if (!notifyFunc)
+ notifyFunc = ClientAwaken;
+ pRequest->notifyFunc = notifyFunc;
+ /* Insert into time-ordered queue, with earliest activation time coming first. */
+ pPrev = 0;
+ for (pReq = pPending; pReq; pReq = pReq->next)
+ {
+ if (CompareTimeStamps (pReq->revive, *revive) == LATER)
+ break;
+ pPrev = pReq;
+ }
+ if (pPrev)
+ pPrev->next = pRequest;
+ else
+ pPending = pRequest;
+ pRequest->next = pReq;
+ IgnoreClient (client);
+ return TRUE;
+}
+
+static void
+ClientAwaken (client, closure)
+ ClientPtr client;
+ pointer closure;
+{
+ if (!client->clientGone)
+ AttendClient (client);
+}
+
+
+static int
+SertafiedDelete (value, id)
+ pointer value;
+ XID id;
+{
+ SertafiedPtr pRequest = (SertafiedPtr)value;
+ SertafiedPtr pReq, pPrev;
+
+ pPrev = 0;
+ for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
+ if (pReq == pRequest)
+ {
+ if (pPrev)
+ pPrev->next = pReq->next;
+ else
+ pPending = pReq->next;
+ break;
+ }
+ if (pRequest->notifyFunc)
+ (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
+ xfree (pRequest);
+ return TRUE;
+}
+
+static void
+SertafiedBlockHandler (data, wt, LastSelectMask)
+ pointer data; /* unused */
+ OSTimePtr wt; /* wait time */
+ pointer LastSelectMask;
+{
+ SertafiedPtr pReq, pNext;
+ unsigned long newdelay, olddelay;
+ TimeStamp now;
+
+ if (!pPending)
+ return;
+ now.milliseconds = GetTimeInMillis ();
+ now.months = currentTime.months;
+ if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
+ now.months++;
+ for (pReq = pPending; pReq; pReq = pNext)
+ {
+ pNext = pReq->next;
+ if (CompareTimeStamps (pReq->revive, now) == LATER)
+ break;
+ FreeResource (pReq->id, RT_NONE);
+
+ /* AttendClient() may have been called via the resource delete
+ * function so a client may have input to be processed and so
+ * set delay to 0 to prevent blocking in WaitForSomething().
+ */
+ AdjustWaitForDelay (wt, 0);
+ }
+ pReq = pPending;
+ if (!pReq)
+ return;
+ newdelay = pReq->revive.milliseconds - now.milliseconds;
+ AdjustWaitForDelay (wt, newdelay);
+}
+
+static void
+SertafiedWakeupHandler (data, i, LastSelectMask)
+ pointer data;
+ int i;
+ pointer LastSelectMask;
+{
+ SertafiedPtr pReq, pNext;
+ TimeStamp now;
+
+ now.milliseconds = GetTimeInMillis ();
+ now.months = currentTime.months;
+ if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
+ now.months++;
+ for (pReq = pPending; pReq; pReq = pNext)
+ {
+ pNext = pReq->next;
+ if (CompareTimeStamps (pReq->revive, now) == LATER)
+ break;
+ FreeResource (pReq->id, RT_NONE);
+ }
+ if (!pPending)
+ {
+ RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
+ SertafiedWakeupHandler,
+ (pointer) 0);
+ BlockHandlerRegistered = FALSE;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/sync.c b/xc/programs/Xserver/Xext/sync.c
new file mode 100644
index 000000000..f1a100499
--- /dev/null
+++ b/xc/programs/Xserver/Xext/sync.c
@@ -0,0 +1,2556 @@
+/* $TOG: sync.c /main/14 1998/02/09 15:25:33 kaleb $ */
+/*
+
+Copyright 1991, 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1991, 1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission. Digital and Olivetti
+make no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.7 1999/03/06 13:12:22 dawes Exp $ */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "Xmd.h"
+#include "misc.h"
+#include "os.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#define _SYNC_SERVER
+#include "sync.h"
+#include "syncstr.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(MINIX) && !defined(Lynx)
+#include <sys/time.h>
+#endif
+#endif
+
+/*
+ * Local Global Variables
+ */
+static int SyncReqCode;
+static int SyncEventBase;
+static int SyncErrorBase;
+static RESTYPE RTCounter = 0;
+static RESTYPE RTAwait;
+static RESTYPE RTAlarm;
+static RESTYPE RTAlarmClient;
+static int SyncNumSystemCounters = 0;
+static SyncCounter **SysCounterList = NULL;
+
+#define IsSystemCounter(pCounter) \
+ (pCounter && (pCounter->client == NULL))
+
+/* these are all the alarm attributes that pertain to the alarm's trigger */
+#define XSyncCAAllTrigger \
+ (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
+
+static int
+FreeAlarm(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAlarmClient(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAwait(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static void
+ServertimeBracketValues(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pbracket_less */,
+ CARD64 * /* pbracket_greater */
+#endif
+);
+
+static void
+ServertimeQueryValue(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pValue_return */
+#endif
+);
+
+static void
+ServertimeWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ int /* rc */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncInitTrigger(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncTrigger * /* pTrigger */,
+ XSyncCounter /* counter */,
+ Mask /* changes */
+#endif
+);
+
+static void
+SAlarmNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncAlarmNotifyEvent * /* from */,
+ xSyncAlarmNotifyEvent * /* to */
+#endif
+);
+
+static void
+SCounterNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncCounterNotifyEvent * /* from */,
+ xSyncCounterNotifyEvent * /* to */
+#endif
+);
+
+static void
+ServertimeBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ struct timeval ** /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncAddTriggerToCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+extern void
+SyncAlarmCounterDestroyed(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAlarmTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAwaitTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static int
+SyncChangeAlarmAttributes(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAlarm * /* pAlarm */,
+ Mask /* mask */,
+ CARD32 * /* values */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static SyncCounter *
+SyncCreateCounter(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ XSyncCounter /* id */,
+ CARD64 /* initialvalue */
+#endif
+);
+
+static void SyncComputeBracketValues(
+#if NeedFunctionPrototypes
+ SyncCounter * /* pCounter */,
+ Bool /* startOver */
+#endif
+);
+
+static void
+SyncDeleteTriggerFromCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static Bool
+SyncEventSelectForAlarm(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */,
+ ClientPtr /* client */,
+ Bool /* wantevents */
+#endif
+);
+
+static void
+SyncInitServerTime(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+static void
+SyncResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static void
+SyncSendAlarmNotifyEvents(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */
+#endif
+);
+
+static void
+SyncSendCounterNotifyEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAwait ** /* ppAwait */,
+ int /* num_events */
+#endif
+);
+
+static DISPATCH_PROC(ProcSyncAwait);
+static DISPATCH_PROC(ProcSyncChangeAlarm);
+static DISPATCH_PROC(ProcSyncChangeCounter);
+static DISPATCH_PROC(ProcSyncCreateAlarm);
+static DISPATCH_PROC(ProcSyncCreateCounter);
+static DISPATCH_PROC(ProcSyncDestroyAlarm);
+static DISPATCH_PROC(ProcSyncDestroyCounter);
+static DISPATCH_PROC(ProcSyncDispatch);
+static DISPATCH_PROC(ProcSyncGetPriority);
+static DISPATCH_PROC(ProcSyncInitialize);
+static DISPATCH_PROC(ProcSyncListSystemCounters);
+static DISPATCH_PROC(ProcSyncListSystemCounters);
+static DISPATCH_PROC(ProcSyncQueryAlarm);
+static DISPATCH_PROC(ProcSyncQueryCounter);
+static DISPATCH_PROC(ProcSyncSetCounter);
+static DISPATCH_PROC(ProcSyncSetPriority);
+static DISPATCH_PROC(SProcSyncAwait);
+static DISPATCH_PROC(SProcSyncChangeAlarm);
+static DISPATCH_PROC(SProcSyncChangeCounter);
+static DISPATCH_PROC(SProcSyncCreateAlarm);
+static DISPATCH_PROC(SProcSyncCreateCounter);
+static DISPATCH_PROC(SProcSyncDestroyAlarm);
+static DISPATCH_PROC(SProcSyncDestroyCounter);
+static DISPATCH_PROC(SProcSyncDispatch);
+static DISPATCH_PROC(SProcSyncDispatch);
+static DISPATCH_PROC(SProcSyncGetPriority);
+static DISPATCH_PROC(SProcSyncInitialize);
+static DISPATCH_PROC(SProcSyncListSystemCounters);
+static DISPATCH_PROC(SProcSyncQueryAlarm);
+static DISPATCH_PROC(SProcSyncQueryCounter);
+static DISPATCH_PROC(SProcSyncSetCounter);
+static DISPATCH_PROC(SProcSyncSetPriority);
+
+/* Each counter maintains a simple linked list of triggers that are
+ * interested in the counter. The two functions below are used to
+ * delete and add triggers on this list.
+ */
+static void
+SyncDeleteTriggerFromCounter(pTrigger)
+ SyncTrigger *pTrigger;
+{
+ SyncTriggerList *pCur, *pPrev = NULL;
+
+ /* pCounter needs to be stored in pTrigger before calling here. */
+
+ if (!pTrigger->pCounter)
+ return;
+
+ for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next)
+ {
+ if (pCur->pTrigger == pTrigger)
+ {
+ if (pPrev)
+ pPrev->next = pCur->next;
+ else
+ pTrigger->pCounter->pTriglist = pCur->next;
+ xfree(pCur);
+ break;
+ }
+ }
+
+ if (IsSystemCounter(pTrigger->pCounter))
+ SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE);
+}
+
+
+static int
+SyncAddTriggerToCounter(pTrigger)
+ SyncTrigger *pTrigger;
+{
+ SyncTriggerList *pCur;
+
+ if (!pTrigger->pCounter)
+ return Success;
+
+ /* don't do anything if it's already there */
+ for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next)
+ {
+ if (pCur->pTrigger == pTrigger)
+ return Success;
+ }
+
+ if (!(pCur = (SyncTriggerList *)xalloc(sizeof(SyncTriggerList))))
+ return BadAlloc;
+
+ pCur->pTrigger = pTrigger;
+ pCur->next = pTrigger->pCounter->pTriglist;
+ pTrigger->pCounter->pTriglist = pCur;
+
+ if (IsSystemCounter(pTrigger->pCounter))
+ SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE);
+
+ return Success;
+}
+
+
+/* Below are four possible functions that can be plugged into
+ * pTrigger->CheckTrigger, corresponding to the four possible
+ * test-types. These functions are called after the counter's
+ * value changes but are also passed the old counter value
+ * so they can inspect both the old and new values.
+ * (PositiveTransition and NegativeTransition need to see both
+ * pieces of information.) These functions return the truth value
+ * of the trigger.
+ *
+ * All of them include the condition pTrigger->pCounter == NULL.
+ * This is because the spec says that a trigger with a counter value
+ * of None is always TRUE.
+ */
+
+static Bool
+SyncCheckTriggerPositiveComparison(pTrigger, oldval)
+ SyncTrigger *pTrigger;
+ CARD64 oldval;
+{
+ return (pTrigger->pCounter == NULL ||
+ XSyncValueGreaterOrEqual(pTrigger->pCounter->value,
+ pTrigger->test_value));
+}
+
+static Bool
+SyncCheckTriggerNegativeComparison(pTrigger, oldval)
+ SyncTrigger *pTrigger;
+ CARD64 oldval;
+{
+ return (pTrigger->pCounter == NULL ||
+ XSyncValueLessOrEqual(pTrigger->pCounter->value,
+ pTrigger->test_value));
+}
+
+static Bool
+SyncCheckTriggerPositiveTransition(pTrigger, oldval)
+ SyncTrigger *pTrigger;
+ CARD64 oldval;
+{
+ return (pTrigger->pCounter == NULL ||
+ (XSyncValueLessThan(oldval, pTrigger->test_value) &&
+ XSyncValueGreaterOrEqual(pTrigger->pCounter->value,
+ pTrigger->test_value)));
+}
+
+static Bool
+SyncCheckTriggerNegativeTransition(pTrigger, oldval)
+ SyncTrigger *pTrigger;
+ CARD64 oldval;
+{
+ return (pTrigger->pCounter == NULL ||
+ (XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
+ XSyncValueLessOrEqual(pTrigger->pCounter->value,
+ pTrigger->test_value)));
+}
+
+
+
+static int
+SyncInitTrigger(client, pTrigger, counter, changes)
+ ClientPtr client; /* so we can set errorValue */
+ SyncTrigger *pTrigger;
+ XSyncCounter counter;
+ Mask changes;
+{
+ SyncCounter *pCounter = pTrigger->pCounter;
+ int status;
+ Bool newcounter = FALSE;
+
+ if (changes & XSyncCACounter)
+ {
+ if (counter == None)
+ pCounter = NULL;
+ else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType(
+ client, counter, RTCounter, SecurityReadAccess)))
+ {
+ client->errorValue = counter;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+ if (pCounter != pTrigger->pCounter)
+ { /* new counter for trigger */
+ SyncDeleteTriggerFromCounter(pTrigger);
+ pTrigger->pCounter = pCounter;
+ newcounter = TRUE;
+ }
+ }
+
+ /* if system counter, ask it what the current value is */
+
+ if (IsSystemCounter(pCounter))
+ {
+ (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ &pCounter->value);
+ }
+
+ if (changes & XSyncCAValueType)
+ {
+ if (pTrigger->value_type != XSyncRelative &&
+ pTrigger->value_type != XSyncAbsolute)
+ {
+ client->errorValue = pTrigger->value_type;
+ return BadValue;
+ }
+ }
+
+ if (changes & XSyncCATestType)
+ {
+ if (pTrigger->test_type != XSyncPositiveTransition &&
+ pTrigger->test_type != XSyncNegativeTransition &&
+ pTrigger->test_type != XSyncPositiveComparison &&
+ pTrigger->test_type != XSyncNegativeComparison)
+ {
+ client->errorValue = pTrigger->test_type;
+ return BadValue;
+ }
+ /* select appropriate CheckTrigger function */
+
+ switch (pTrigger->test_type)
+ {
+ case XSyncPositiveTransition:
+ pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition;
+ break;
+ case XSyncNegativeTransition:
+ pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition;
+ break;
+ case XSyncPositiveComparison:
+ pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison;
+ break;
+ case XSyncNegativeComparison:
+ pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison;
+ break;
+ }
+ }
+
+ if (changes & (XSyncCAValueType | XSyncCAValue))
+ {
+ if (pTrigger->value_type == XSyncAbsolute)
+ pTrigger->test_value = pTrigger->wait_value;
+ else /* relative */
+ {
+ Bool overflow;
+ if (pCounter == NULL)
+ return BadMatch;
+
+ XSyncValueAdd(&pTrigger->test_value, pCounter->value,
+ pTrigger->wait_value, &overflow);
+ if (overflow)
+ {
+ client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
+ return BadValue;
+ }
+ }
+ }
+
+ /* we wait until we're sure there are no errors before registering
+ * a new counter on a trigger
+ */
+ if (newcounter)
+ {
+ if ((status = SyncAddTriggerToCounter(pTrigger)) != Success)
+ return status;
+ }
+ else if (IsSystemCounter(pCounter))
+ {
+ SyncComputeBracketValues(pCounter, /*startOver*/ TRUE);
+ }
+
+ return Success;
+}
+
+/* AlarmNotify events happen in response to actions taken on an Alarm or
+ * the counter used by the alarm. AlarmNotify may be sent to multiple
+ * clients. The alarm maintains a list of clients interested in events.
+ */
+static void
+SyncSendAlarmNotifyEvents(pAlarm)
+ SyncAlarm *pAlarm;
+{
+ SyncAlarmClientList *pcl;
+ xSyncAlarmNotifyEvent ane;
+ SyncTrigger *pTrigger = &pAlarm->trigger;
+
+ UpdateCurrentTime();
+
+ ane.type = SyncEventBase + XSyncAlarmNotify;
+ ane.kind = XSyncAlarmNotify;
+ ane.sequenceNumber = pAlarm->client->sequence;
+ ane.alarm = pAlarm->alarm_id;
+ if (pTrigger->pCounter)
+ {
+ ane.counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value);
+ ane.counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value);
+ }
+ else
+ { /* XXX what else can we do if there's no counter? */
+ ane.counter_value_hi = ane.counter_value_lo = 0;
+ }
+
+ ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value);
+ ane.alarm_value_lo = XSyncValueLow32(pTrigger->test_value);
+ ane.time = currentTime.milliseconds;
+ ane.state = pAlarm->state;
+
+ /* send to owner */
+ if (pAlarm->events && !pAlarm->client->clientGone)
+ WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
+
+ /* send to other interested clients */
+ for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next)
+ {
+ if (!pAlarm->client->clientGone)
+ {
+ ane.sequenceNumber = pcl->client->sequence;
+ WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
+ }
+ }
+}
+
+
+/* CounterNotify events only occur in response to an Await. The events
+ * go only to the Awaiting client.
+ */
+static void
+SyncSendCounterNotifyEvents(client, ppAwait, num_events)
+ ClientPtr client;
+ SyncAwait **ppAwait;
+ int num_events;
+{
+ xSyncCounterNotifyEvent *pEvents, *pev;
+ int i;
+
+ if (client->clientGone)
+ return;
+ pev = pEvents = (xSyncCounterNotifyEvent *)
+ ALLOCATE_LOCAL(num_events * sizeof(xSyncCounterNotifyEvent));
+ if (!pEvents)
+ return;
+ UpdateCurrentTime();
+ for (i = 0; i < num_events; i++, ppAwait++, pev++)
+ {
+ SyncTrigger *pTrigger = &(*ppAwait)->trigger;
+ pev->type = SyncEventBase + XSyncCounterNotify;
+ pev->kind = XSyncCounterNotify;
+ pev->sequenceNumber = client->sequence;
+ pev->counter = pTrigger->pCounter->id;
+ pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+ pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
+ pev->counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value);
+ pev->counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value);
+ pev->time = currentTime.milliseconds;
+ pev->count = num_events - i - 1; /* events remaining */
+ pev->destroyed = pTrigger->pCounter->beingDestroyed;
+ }
+ /* swapping will be taken care of by this */
+ WriteEventsToClient(client, num_events, (xEvent *)pEvents);
+ DEALLOCATE_LOCAL(pEvents);
+}
+
+
+/* This function is called when an alarm's counter is destroyed.
+ * It is plugged into pTrigger->CounterDestroyed (for alarm triggers).
+ */
+void
+SyncAlarmCounterDestroyed(pTrigger)
+ SyncTrigger *pTrigger;
+{
+ SyncAlarm *pAlarm = (SyncAlarm *)pTrigger;
+
+ pAlarm->state = XSyncAlarmInactive;
+ SyncSendAlarmNotifyEvents(pAlarm);
+ pTrigger->pCounter = NULL;
+}
+
+
+/* This function is called when an alarm "goes off."
+ * It is plugged into pTrigger->TriggerFired (for alarm triggers).
+ */
+static void
+SyncAlarmTriggerFired(pTrigger)
+ SyncTrigger *pTrigger;
+{
+ SyncAlarm *pAlarm = (SyncAlarm *)pTrigger;
+ CARD64 new_test_value;
+
+ /* no need to check alarm unless it's active */
+ if (pAlarm->state != XSyncAlarmActive)
+ return;
+
+ /* " if the counter value is None, or if the delta is 0 and
+ * the test-type is PositiveComparison or NegativeComparison,
+ * no change is made to value (test-value) and the alarm
+ * state is changed to Inactive before the event is generated."
+ */
+ if (pAlarm->trigger.pCounter == NULL
+ || (XSyncValueIsZero(pAlarm->delta)
+ && (pAlarm->trigger.test_type == XSyncPositiveComparison
+ || pAlarm->trigger.test_type == XSyncNegativeComparison)))
+ pAlarm->state = XSyncAlarmInactive;
+
+ new_test_value = pAlarm->trigger.test_value;
+
+ if (pAlarm->state == XSyncAlarmActive)
+ {
+ Bool overflow;
+ CARD64 oldvalue;
+ SyncTrigger *paTrigger = &pAlarm->trigger;
+
+ /* "The alarm is updated by repeatedly adding delta to the
+ * value of the trigger and re-initializing it until it
+ * becomes FALSE."
+ */
+ oldvalue = paTrigger->test_value;
+
+ /* XXX really should do something smarter here */
+
+ do
+ {
+ XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
+ pAlarm->delta, &overflow);
+ } while (!overflow &&
+ (*paTrigger->CheckTrigger)(paTrigger,
+ paTrigger->pCounter->value));
+
+ new_test_value = paTrigger->test_value;
+ paTrigger->test_value = oldvalue;
+
+ /* "If this update would cause value to fall outside the range
+ * for an INT64...no change is made to value (test-value) and
+ * the alarm state is changed to Inactive before the event is
+ * generated."
+ */
+ if (overflow)
+ {
+ new_test_value = oldvalue;
+ pAlarm->state = XSyncAlarmInactive;
+ }
+ }
+ /* The AlarmNotify event has to have the "new state of the alarm"
+ * which we can't be sure of until this point. However, it has
+ * to have the "old" trigger test value. That's the reason for
+ * all the newvalue/oldvalue shuffling above. After we send the
+ * events, give the trigger its new test value.
+ */
+ SyncSendAlarmNotifyEvents(pAlarm);
+ pTrigger->test_value = new_test_value;
+}
+
+
+/* This function is called when an Await unblocks, either as a result
+ * of the trigger firing OR the counter being destroyed.
+ * It goes into pTrigger->TriggerFired AND pTrigger->CounterDestroyed
+ * (for Await triggers).
+ */
+static void
+SyncAwaitTriggerFired(pTrigger)
+ SyncTrigger *pTrigger;
+{
+ SyncAwait *pAwait = (SyncAwait *)pTrigger;
+ int numwaits;
+ SyncAwaitUnion *pAwaitUnion;
+ SyncAwait **ppAwait;
+ int num_events = 0;
+
+ pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
+ numwaits = pAwaitUnion->header.num_waitconditions;
+ ppAwait = (SyncAwait **)ALLOCATE_LOCAL(numwaits * sizeof(SyncAwait *));
+ if (!ppAwait)
+ goto bail;
+
+ pAwait = &(pAwaitUnion+1)->await;
+
+ /* "When a client is unblocked, all the CounterNotify events for
+ * the Await request are generated contiguously. If count is 0
+ * there are no more events to follow for this request. If
+ * count is n, there are at least n more events to follow."
+ *
+ * Thus, it is best to find all the counters for which events
+ * need to be sent first, so that an accurate count field can
+ * be stored in the events.
+ */
+ for ( ; numwaits; numwaits--, pAwait++)
+ {
+ CARD64 diff;
+ Bool overflow, diffgreater, diffequal;
+
+ /* "A CounterNotify event with the destroyed flag set to TRUE is
+ * always generated if the counter for one of the triggers is
+ * destroyed."
+ */
+ if (pAwait->trigger.pCounter->beingDestroyed)
+ {
+ ppAwait[num_events++] = pAwait;
+ continue;
+ }
+
+ /* "The difference between the counter and the test value is
+ * calculated by subtracting the test value from the value of
+ * the counter."
+ */
+ XSyncValueSubtract(&diff, pAwait->trigger.pCounter->value,
+ pAwait->trigger.test_value, &overflow);
+
+ /* "If the difference lies outside the range for an INT64, an
+ * event is not generated."
+ */
+ if (overflow)
+ continue;
+ diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold);
+ diffequal = XSyncValueEqual(diff, pAwait->event_threshold);
+
+ /* "If the test-type is PositiveTransition or
+ * PositiveComparison, a CounterNotify event is generated if
+ * the difference is at least event-threshold. If the test-type
+ * is NegativeTransition or NegativeComparison, a CounterNotify
+ * event is generated if the difference is at most
+ * event-threshold."
+ */
+
+ if ( ((pAwait->trigger.test_type == XSyncPositiveComparison ||
+ pAwait->trigger.test_type == XSyncPositiveTransition)
+ && (diffgreater || diffequal))
+ ||
+ ((pAwait->trigger.test_type == XSyncNegativeComparison ||
+ pAwait->trigger.test_type == XSyncNegativeTransition)
+ && (!diffgreater) /* less or equal */
+ )
+ )
+ {
+ ppAwait[num_events++] = pAwait;
+ }
+ }
+ if (num_events)
+ SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
+ num_events);
+ DEALLOCATE_LOCAL(ppAwait);
+
+bail:
+ /* unblock the client */
+ AttendClient(pAwaitUnion->header.client);
+ /* delete the await */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+}
+
+
+/* This function should always be used to change a counter's value so that
+ * any triggers depending on the counter will be checked.
+ */
+void
+SyncChangeCounter(pCounter, newval)
+ SyncCounter *pCounter;
+ CARD64 newval;
+{
+ SyncTriggerList *ptl, *pnext;
+ CARD64 oldval;
+
+ oldval = pCounter->value;
+ pCounter->value = newval;
+
+ /* run through triggers to see if any become true */
+ for (ptl = pCounter->pTriglist; ptl; ptl = pnext)
+ {
+ pnext = ptl->next;
+ if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, oldval))
+ (*ptl->pTrigger->TriggerFired)(ptl->pTrigger);
+ }
+
+ if (IsSystemCounter(pCounter))
+ {
+ SyncComputeBracketValues(pCounter, /* startOver */ FALSE);
+ }
+}
+
+
+/* loosely based on dix/events.c/EventSelectForWindow */
+static Bool
+SyncEventSelectForAlarm(pAlarm, client, wantevents)
+ SyncAlarm *pAlarm;
+ ClientPtr client;
+ Bool wantevents;
+{
+ SyncAlarmClientList *pClients;
+
+ if (client == pAlarm->client) /* alarm owner */
+ {
+ pAlarm->events = wantevents;
+ return Success;
+ }
+
+ /* see if the client is already on the list (has events selected) */
+
+ for (pClients = pAlarm->pEventClients; pClients;
+ pClients = pClients->next)
+ {
+ if (pClients->client == client)
+ {
+ /* client's presence on the list indicates desire for
+ * events. If the client doesn't want events, remove it
+ * from the list. If the client does want events, do
+ * nothing, since it's already got them.
+ */
+ if (!wantevents)
+ {
+ FreeResource(pClients->delete_id, RT_NONE);
+ }
+ return Success;
+ }
+ }
+
+ /* if we get here, this client does not currently have
+ * events selected on the alarm
+ */
+
+ if (!wantevents)
+ /* client doesn't want events, and we just discovered that it
+ * doesn't have them, so there's nothing to do.
+ */
+ return Success;
+
+ /* add new client to pAlarm->pEventClients */
+
+ pClients = (SyncAlarmClientList *) xalloc(sizeof(SyncAlarmClientList));
+ if (!pClients)
+ return BadAlloc;
+
+ /* register it as a resource so it will be cleaned up
+ * if the client dies
+ */
+
+ pClients->delete_id = FakeClientID(client->index);
+ if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
+ {
+ xfree(pClients);
+ return BadAlloc;
+ }
+
+ /* link it into list after we know all the allocations succeed */
+
+ pClients->next = pAlarm->pEventClients;
+ pAlarm->pEventClients = pClients;
+ pClients->client = client;
+ return Success;
+}
+
+/*
+ * ** SyncChangeAlarmAttributes ** This is used by CreateAlarm and ChangeAlarm
+ */
+static int
+SyncChangeAlarmAttributes(client, pAlarm, mask, values)
+ ClientPtr client;
+ SyncAlarm *pAlarm;
+ Mask mask;
+ CARD32 *values;
+{
+ int status;
+ XSyncCounter counter;
+ Mask origmask = mask;
+
+ counter = pAlarm->trigger.pCounter ? pAlarm->trigger.pCounter->id : None;
+
+ while (mask)
+ {
+ int index2 = lowbit(mask);
+ mask &= ~index2;
+ switch (index2)
+ {
+ case XSyncCACounter:
+ mask &= ~XSyncCACounter;
+ /* sanity check in SyncInitTrigger */
+ counter = *values++;
+ break;
+
+ case XSyncCAValueType:
+ mask &= ~XSyncCAValueType;
+ /* sanity check in SyncInitTrigger */
+ pAlarm->trigger.value_type = *values++;
+ break;
+
+ case XSyncCAValue:
+ mask &= ~XSyncCAValue;
+ XSyncIntsToValue(&pAlarm->trigger.wait_value, values[1], values[0]);
+ values += 2;
+ break;
+
+ case XSyncCATestType:
+ mask &= ~XSyncCATestType;
+ /* sanity check in SyncInitTrigger */
+ pAlarm->trigger.test_type = *values++;
+ break;
+
+ case XSyncCADelta:
+ mask &= ~XSyncCADelta;
+ XSyncIntsToValue(&pAlarm->delta, values[1], values[0]);
+ values += 2;
+ break;
+
+ case XSyncCAEvents:
+ mask &= ~XSyncCAEvents;
+ if ((*values != xTrue) && (*values != xFalse))
+ {
+ client->errorValue = *values;
+ return BadValue;
+ }
+ status = SyncEventSelectForAlarm(pAlarm, client,
+ (Bool)(*values++));
+ if (status != Success)
+ return status;
+ break;
+
+ default:
+ client->errorValue = mask;
+ return BadValue;
+ }
+ }
+
+ /* "If the test-type is PositiveComparison or PositiveTransition
+ * and delta is less than zero, or if the test-type is
+ * NegativeComparison or NegativeTransition and delta is
+ * greater than zero, a Match error is generated."
+ */
+ if (origmask & (XSyncCADelta|XSyncCATestType))
+ {
+ CARD64 zero;
+ XSyncIntToValue(&zero, 0);
+ if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
+ (pAlarm->trigger.test_type == XSyncPositiveTransition))
+ && XSyncValueLessThan(pAlarm->delta, zero))
+ ||
+ (((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
+ (pAlarm->trigger.test_type == XSyncNegativeTransition))
+ && XSyncValueGreaterThan(pAlarm->delta, zero))
+ )
+ {
+ return BadMatch;
+ }
+ }
+
+ /* postpone this until now, when we're sure nothing else can go wrong */
+ if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter,
+ origmask & XSyncCAAllTrigger)) != Success)
+ return status;
+
+ /* XXX spec does not really say to do this - needs clarification */
+ pAlarm->state = XSyncAlarmActive;
+ return Success;
+}
+
+
+static SyncCounter *
+SyncCreateCounter(client, id, initialvalue)
+ ClientPtr client;
+ XSyncCounter id;
+ CARD64 initialvalue;
+{
+ SyncCounter *pCounter;
+
+ if (!(pCounter = (SyncCounter *) xalloc(sizeof(SyncCounter))))
+ return (SyncCounter *)NULL;
+
+ if (!AddResource(id, RTCounter, (pointer) pCounter))
+ {
+ xfree((pointer) pCounter);
+ return (SyncCounter *)NULL;
+ }
+
+ pCounter->client = client;
+ pCounter->id = id;
+ pCounter->value = initialvalue;
+ pCounter->pTriglist = NULL;
+ pCounter->beingDestroyed = FALSE;
+ pCounter->pSysCounterInfo = NULL;
+ return pCounter;
+}
+
+static int FreeCounter(
+#if NeedFunctionPrototypes
+ pointer /*env*/,
+ XID /*id*/
+#endif
+);
+
+/*
+ * ***** System Counter utilities
+ */
+
+pointer
+SyncCreateSystemCounter(name, initial, resolution, counterType,
+ QueryValue, BracketValues)
+ char *name;
+ CARD64 initial;
+ CARD64 resolution;
+ SyncCounterType counterType;
+ void (*QueryValue) ();
+ void (*BracketValues) ();
+{
+ SyncCounter *pCounter;
+
+ SysCounterList = (SyncCounter **)xrealloc(SysCounterList,
+ (SyncNumSystemCounters+1)*sizeof(SyncCounter *));
+ if (!SysCounterList)
+ return (pointer)NULL;
+
+ /* this function may be called before SYNC has been initialized, so we
+ * have to make sure RTCounter is created.
+ */
+ if (RTCounter == 0)
+ {
+ RTCounter = CreateNewResourceType(FreeCounter);
+ if (RTCounter == 0)
+ {
+ return (pointer)NULL;
+ }
+ }
+
+ pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial);
+
+ if (pCounter)
+ {
+ SysCounterInfo *psci;
+
+ psci = (SysCounterInfo *)xalloc(sizeof(SysCounterInfo));
+ if (!psci)
+ {
+ FreeResource(pCounter->id, RT_NONE);
+ return (pointer) pCounter;
+ }
+ pCounter->pSysCounterInfo = psci;
+ psci->name = name;
+ psci->resolution = resolution;
+ psci->counterType = counterType;
+ psci->QueryValue = QueryValue;
+ psci->BracketValues = BracketValues;
+ XSyncMaxValue(&psci->bracket_greater);
+ XSyncMinValue(&psci->bracket_less);
+ SysCounterList[SyncNumSystemCounters++] = pCounter;
+ }
+ return (pointer) pCounter;
+}
+
+void
+SyncDestroySystemCounter(pSysCounter)
+ pointer pSysCounter;
+{
+ SyncCounter *pCounter = (SyncCounter *)pSysCounter;
+ FreeResource(pCounter->id, RT_NONE);
+}
+
+static void
+SyncComputeBracketValues(pCounter, startOver)
+ SyncCounter *pCounter;
+ Bool startOver;
+{
+ SyncTriggerList *pCur;
+ SyncTrigger *pTrigger;
+ SysCounterInfo *psci = pCounter->pSysCounterInfo;
+ CARD64 *pnewgtval = NULL;
+ CARD64 *pnewltval = NULL;
+ SyncCounterType ct;
+
+ if (!pCounter)
+ return;
+
+ ct = pCounter->pSysCounterInfo->counterType;
+ if (ct == XSyncCounterNeverChanges)
+ return;
+
+ if (startOver)
+ {
+ XSyncMaxValue(&psci->bracket_greater);
+ XSyncMinValue(&psci->bracket_less);
+ }
+
+ for (pCur = pCounter->pTriglist; pCur; pCur = pCur->next)
+ {
+ pTrigger = pCur->pTrigger;
+
+ if (pTrigger->test_type == XSyncPositiveComparison &&
+ ct != XSyncCounterNeverIncreases)
+ {
+ if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueLessThan(pTrigger->test_value,
+ psci->bracket_greater))
+ {
+ psci->bracket_greater = pTrigger->test_value;
+ pnewgtval = &psci->bracket_greater;
+ }
+ }
+ else if (pTrigger->test_type == XSyncNegativeComparison &&
+ ct != XSyncCounterNeverDecreases)
+ {
+ if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
+ XSyncValueGreaterThan(pTrigger->test_value,
+ psci->bracket_less))
+ {
+ psci->bracket_less = pTrigger->test_value;
+ pnewltval = &psci->bracket_less;
+ }
+ }
+ else if ( (pTrigger->test_type == XSyncPositiveTransition &&
+ ct != XSyncCounterNeverIncreases)
+ ||
+ (pTrigger->test_type == XSyncNegativeTransition &&
+ ct != XSyncCounterNeverDecreases)
+ )
+ {
+ if (XSyncValueLessThan(pCounter->value, pTrigger->test_value))
+ {
+ if (XSyncValueLessThan(pTrigger->test_value,
+ psci->bracket_greater))
+ {
+ psci->bracket_greater = pTrigger->test_value;
+ pnewgtval = &psci->bracket_greater;
+ }
+ else
+ if (XSyncValueGreaterThan(pTrigger->test_value,
+ psci->bracket_less))
+ {
+ psci->bracket_less = pTrigger->test_value;
+ pnewltval = &psci->bracket_less;
+ }
+ }
+ }
+ } /* end for each trigger */
+
+ if (pnewgtval || pnewltval)
+ {
+ (*psci->BracketValues)((pointer)pCounter, pnewltval, pnewgtval);
+ }
+}
+
+/*
+ * ***** Resource delete functions
+ */
+
+/* ARGSUSED */
+static int
+FreeAlarm(addr, id)
+ pointer addr;
+ XID id;
+{
+ SyncAlarm *pAlarm = (SyncAlarm *) addr;
+
+ pAlarm->state = XSyncAlarmDestroyed;
+
+ SyncSendAlarmNotifyEvents(pAlarm);
+
+ /* delete event selections */
+
+ while (pAlarm->pEventClients)
+ FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
+
+ SyncDeleteTriggerFromCounter(&pAlarm->trigger);
+
+ xfree(pAlarm);
+ return Success;
+}
+
+
+/*
+ * ** Cleanup after the destruction of a Counter
+ */
+/* ARGSUSED */
+static int
+FreeCounter(env, id)
+ pointer env;
+ XID id;
+{
+ SyncCounter *pCounter = (SyncCounter *) env;
+ SyncTriggerList *ptl, *pnext;
+
+ pCounter->beingDestroyed = TRUE;
+ /* tell all the counter's triggers that the counter has been destroyed */
+ for (ptl = pCounter->pTriglist; ptl; ptl = pnext)
+ {
+ (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
+ pnext = ptl->next;
+ xfree(ptl); /* destroy the trigger list as we go */
+ }
+ if (IsSystemCounter(pCounter))
+ {
+ int i, found = 0;
+
+ xfree(pCounter->pSysCounterInfo);
+
+ /* find the counter in the list of system counters and remove it */
+
+ if (SysCounterList)
+ {
+ for (i = 0; i < SyncNumSystemCounters; i++)
+ {
+ if (SysCounterList[i] == pCounter)
+ {
+ found = i;
+ break;
+ }
+ }
+ if (found < (SyncNumSystemCounters-1))
+ {
+ for (i = found; i < SyncNumSystemCounters-1; i++)
+ {
+ SysCounterList[i] = SysCounterList[i+1];
+ }
+ }
+ }
+ SyncNumSystemCounters--;
+ }
+ xfree(pCounter);
+ return Success;
+}
+
+/*
+ * ** Cleanup after Await
+ */
+/* ARGSUSED */
+static int
+FreeAwait(addr, id)
+ pointer addr;
+ XID id;
+{
+ SyncAwaitUnion *pAwaitUnion = (SyncAwaitUnion *) addr;
+ SyncAwait *pAwait;
+ int numwaits;
+
+ pAwait = &(pAwaitUnion+1)->await; /* first await on list */
+
+ /* remove triggers from counters */
+
+ for (numwaits = pAwaitUnion->header.num_waitconditions; numwaits;
+ numwaits--, pAwait++)
+ {
+ /* If the counter is being destroyed, FreeCounter will delete
+ * the trigger list itself, so don't do it here.
+ */
+ SyncCounter *pCounter = pAwait->trigger.pCounter;
+ if (pCounter && !pCounter->beingDestroyed)
+ SyncDeleteTriggerFromCounter(&pAwait->trigger);
+ }
+ xfree(pAwaitUnion);
+ return Success;
+}
+
+/* loosely based on dix/events.c/OtherClientGone */
+static int
+FreeAlarmClient(value, id)
+ pointer value; /* must conform to DeleteType */
+ XID id;
+{
+ SyncAlarm *pAlarm = (SyncAlarm *)value;
+ SyncAlarmClientList *pCur, *pPrev;
+
+ for (pPrev = NULL, pCur = pAlarm->pEventClients;
+ pCur;
+ pPrev = pCur, pCur = pCur->next)
+ {
+ if (pCur->delete_id == id)
+ {
+ if (pPrev)
+ pPrev->next = pCur->next;
+ else
+ pAlarm->pEventClients = pCur->next;
+ xfree(pCur);
+ return(Success);
+ }
+ }
+ FatalError("alarm client not on event list");
+ /*NOTREACHED*/
+}
+
+
+/*
+ * ***** Proc functions
+ */
+
+
+/*
+ * ** Initialize the extension
+ */
+static int
+ProcSyncInitialize(client)
+ ClientPtr client;
+{
+ xSyncInitializeReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xSyncInitializeReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SYNC_MAJOR_VERSION;
+ rep.minorVersion = SYNC_MINOR_VERSION;
+ rep.length = 0;
+
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ }
+ WriteToClient(client, sizeof(rep), (char *) &rep);
+ return (client->noClientException);
+}
+
+/*
+ * ** Get list of system counters available through the extension
+ */
+static int
+ProcSyncListSystemCounters(client)
+ ClientPtr client;
+{
+ xSyncListSystemCountersReply rep;
+ int i, len;
+ xSyncSystemCounter *list, *walklist;
+
+ REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.nCounters = SyncNumSystemCounters;
+
+ for (i = len = 0; i < SyncNumSystemCounters; i++)
+ {
+ char *name = SysCounterList[i]->pSysCounterInfo->name;
+ /* pad to 4 byte boundary */
+ len += (sz_xSyncSystemCounter + strlen(name) + 3) & ~3;
+ }
+
+ if (len)
+ {
+ walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len);
+ if (!list)
+ return BadAlloc;
+ }
+
+ rep.length = len >> 2;
+
+ if (client->swapped)
+ {
+ register char n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.nCounters, n);
+ }
+
+ for (i = 0; i < SyncNumSystemCounters; i++)
+ {
+ int namelen;
+ char *pname_in_reply;
+ SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo;
+
+ walklist->counter = SysCounterList[i]->id;
+ walklist->resolution_hi = XSyncValueHigh32(psci->resolution);
+ walklist->resolution_lo = XSyncValueLow32(psci->resolution);
+ namelen = strlen(psci->name);
+ walklist->name_length = namelen;
+
+ if (client->swapped)
+ {
+ register char n;
+ swapl(&walklist->counter, n);
+ swapl(&walklist->resolution_hi, n);
+ swapl(&walklist->resolution_lo, n);
+ swaps(&walklist->name_length, n);
+ }
+
+ pname_in_reply = ((char *)walklist) + sz_xSyncSystemCounter;
+ strncpy(pname_in_reply, psci->name, namelen);
+ walklist = (xSyncSystemCounter *) (((char *)walklist) +
+ ((sz_xSyncSystemCounter + namelen + 3) & ~3));
+ }
+
+ WriteToClient(client, sizeof(rep), (char *) &rep);
+ if (len)
+ {
+ WriteToClient(client, len, (char *) list);
+ DEALLOCATE_LOCAL(list);
+ }
+
+ return (client->noClientException);
+}
+
+/*
+ * ** Set client Priority
+ */
+static int
+ProcSyncSetPriority(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncSetPriorityReq);
+ ClientPtr priorityclient;
+
+ REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
+
+ if (stuff->id == None)
+ priorityclient = client;
+ else if (!(priorityclient = LookupClient(stuff->id, client)))
+ {
+ client->errorValue = stuff->id;
+ return BadMatch;
+ }
+
+ if (priorityclient->priority != stuff->priority)
+ {
+ priorityclient->priority = stuff->priority;
+
+ /* The following will force the server back into WaitForSomething
+ * so that the change in this client's priority is immediately
+ * reflected.
+ */
+ isItTimeToYield = TRUE;
+ dispatchException |= DE_PRIORITYCHANGE;
+ }
+ return Success;
+}
+
+/*
+ * ** Get client Priority
+ */
+static int
+ProcSyncGetPriority(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncGetPriorityReq);
+ xSyncGetPriorityReply rep;
+ ClientPtr priorityclient;
+
+ REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
+
+ if (stuff->id == None)
+ priorityclient = client;
+ else if (!(priorityclient = LookupClient(stuff->id, client)))
+ {
+ client->errorValue = stuff->id;
+ return BadMatch;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.priority = priorityclient->priority;
+
+ if (client->swapped)
+ {
+ register char n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.priority, n);
+ }
+
+ WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep);
+
+ return (client->noClientException);
+}
+
+/*
+ * ** Create a new counter
+ */
+static int
+ProcSyncCreateCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncCreateCounterReq);
+ CARD64 initial;
+
+ REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
+
+ LEGAL_NEW_RESOURCE(stuff->cid, client);
+
+ XSyncIntsToValue(&initial, stuff->initial_value_lo, stuff->initial_value_hi);
+ if (!SyncCreateCounter(client, stuff->cid, initial))
+ return BadAlloc;
+
+ return (client->noClientException);
+}
+
+/*
+ * ** Set Counter value
+ */
+static int
+ProcSyncSetCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncSetCounterReq);
+ SyncCounter *pCounter;
+ CARD64 newvalue;
+
+ pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid,
+ RTCounter, SecurityWriteAccess);
+ if (pCounter == NULL)
+ {
+ client->errorValue = stuff->cid;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+
+ if (IsSystemCounter(pCounter))
+ {
+ client->errorValue = stuff->cid;
+ return BadAccess;
+ }
+
+ XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi);
+ SyncChangeCounter(pCounter, newvalue);
+ return Success;
+}
+
+/*
+ * ** Change Counter value
+ */
+static int
+ProcSyncChangeCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncChangeCounterReq);
+ SyncCounter *pCounter;
+ CARD64 newvalue;
+ Bool overflow;
+
+ REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
+
+ pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid,
+ RTCounter, SecurityWriteAccess);
+ if (pCounter == NULL)
+ {
+ client->errorValue = stuff->cid;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+
+ if (IsSystemCounter(pCounter))
+ {
+ client->errorValue = stuff->cid;
+ return BadAccess;
+ }
+
+ XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi);
+ XSyncValueAdd(&newvalue, pCounter->value, newvalue, &overflow);
+ if (overflow)
+ {
+ /* XXX 64 bit value can't fit in 32 bits; do the best we can */
+ client->errorValue = stuff->value_hi;
+ return BadValue;
+ }
+ SyncChangeCounter(pCounter, newvalue);
+ return Success;
+}
+
+/*
+ * ** Destroy a counter
+ */
+static int
+ProcSyncDestroyCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncDestroyCounterReq);
+ SyncCounter *pCounter;
+
+ REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
+
+ pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
+ RTCounter, SecurityDestroyAccess);
+ if (pCounter == NULL)
+ {
+ client->errorValue = stuff->counter;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+ if (IsSystemCounter(pCounter))
+ {
+ client->errorValue = stuff->counter;
+ return BadAccess;
+ }
+ FreeResource(pCounter->id, RT_NONE);
+ return Success;
+}
+
+
+/*
+ * ** Await
+ */
+static int
+ProcSyncAwait(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncAwaitReq);
+ int len, items;
+ int i;
+ xSyncWaitCondition *pProtocolWaitConds;
+ SyncAwaitUnion *pAwaitUnion;
+ SyncAwait *pAwait;
+ int status;
+
+ REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
+
+ len = client->req_len << 2;
+ len -= sz_xSyncAwaitReq;
+ items = len / sz_xSyncWaitCondition;
+
+ if (items * sz_xSyncWaitCondition != len)
+ {
+ return BadLength;
+ }
+ if (items == 0)
+ {
+ client->errorValue = items; /* XXX protocol change */
+ return BadValue;
+ }
+
+ pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1];
+
+ /* all the memory for the entire await list is allocated
+ * here in one chunk
+ */
+ pAwaitUnion = (SyncAwaitUnion *)xalloc((items+1) * sizeof(SyncAwaitUnion));
+ if (!pAwaitUnion)
+ return BadAlloc;
+
+ /* first item is the header, remainder are real wait conditions */
+
+ pAwaitUnion->header.delete_id = FakeClientID(client->index);
+ if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
+ {
+ xfree(pAwaitUnion);
+ return BadAlloc;
+ }
+
+ /* don't need to do any more memory allocation for this request! */
+
+ pAwaitUnion->header.client = client;
+ pAwaitUnion->header.num_waitconditions = 0;
+
+ pAwait = &(pAwaitUnion+1)->await; /* skip over header */
+ for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++)
+ {
+ if (pProtocolWaitConds->counter == None) /* XXX protocol change */
+ {
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on counters
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ client->errorValue = pProtocolWaitConds->counter;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+
+ /* sanity checks are in SyncInitTrigger */
+ pAwait->trigger.pCounter = NULL;
+ pAwait->trigger.value_type = pProtocolWaitConds->value_type;
+ XSyncIntsToValue(&pAwait->trigger.wait_value,
+ pProtocolWaitConds->wait_value_lo,
+ pProtocolWaitConds->wait_value_hi);
+ pAwait->trigger.test_type = pProtocolWaitConds->test_type;
+
+ status = SyncInitTrigger(client, &pAwait->trigger,
+ pProtocolWaitConds->counter, XSyncCAAllTrigger);
+ if (status != Success)
+ {
+ /* this should take care of removing any triggers created by
+ * this request that have already been registered on counters
+ */
+ FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+ return status;
+ }
+ /* this is not a mistake -- same function works for both cases */
+ pAwait->trigger.TriggerFired = SyncAwaitTriggerFired;
+ pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired;
+ XSyncIntsToValue(&pAwait->event_threshold,
+ pProtocolWaitConds->event_threshold_lo,
+ pProtocolWaitConds->event_threshold_hi);
+ pAwait->pHeader = &pAwaitUnion->header;
+ pAwaitUnion->header.num_waitconditions++;
+ }
+
+ IgnoreClient(client);
+
+ /* see if any of the triggers are already true */
+
+ pAwait = &(pAwaitUnion+1)->await; /* skip over header */
+ for (i = 0; i < items; i++, pAwait++)
+ {
+ /* don't have to worry about NULL counters because the request
+ * errors before we get here out if they occur
+ */
+ if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger,
+ pAwait->trigger.pCounter->value))
+ {
+ (*pAwait->trigger.TriggerFired)(&pAwait->trigger);
+ break; /* once is enough */
+ }
+ }
+ return Success;
+}
+
+
+/*
+ * ** Query a counter
+ */
+static int
+ProcSyncQueryCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncQueryCounterReq);
+ xSyncQueryCounterReply rep;
+ SyncCounter *pCounter;
+
+ REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
+
+ pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter,
+ RTCounter, SecurityReadAccess);
+ if (pCounter == NULL)
+ {
+ client->errorValue = stuff->counter;
+ return SyncErrorBase + XSyncBadCounter;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ /* if system counter, ask it what the current value is */
+
+ if (IsSystemCounter(pCounter))
+ {
+ (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+ &pCounter->value);
+ }
+
+ rep.value_hi = XSyncValueHigh32(pCounter->value);
+ rep.value_lo = XSyncValueLow32(pCounter->value);
+ if (client->swapped)
+ {
+ register char n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.value_hi, n);
+ swapl(&rep.value_lo, n);
+ }
+ WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep);
+ return (client->noClientException);
+}
+
+
+/*
+ * ** Create Alarm
+ */
+static int
+ProcSyncCreateAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncCreateAlarmReq);
+ SyncAlarm *pAlarm;
+ int status;
+ unsigned long len, vmask;
+ SyncTrigger *pTrigger;
+
+ REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
+
+ LEGAL_NEW_RESOURCE(stuff->id, client);
+
+ vmask = stuff->valueMask;
+ len = client->req_len - (sizeof(xSyncCreateAlarmReq) >> 2);
+ /* the "extra" call to Ones accounts for the presence of 64 bit values */
+ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
+ return BadLength;
+
+ if (!(pAlarm = (SyncAlarm *) xalloc(sizeof(SyncAlarm))))
+ {
+ return BadAlloc;
+ }
+
+ /* set up defaults */
+
+ pTrigger = &pAlarm->trigger;
+ pTrigger->pCounter = NULL;
+ pTrigger->value_type = XSyncAbsolute;
+ XSyncIntToValue(&pTrigger->wait_value, 0L);
+ pTrigger->test_type = XSyncPositiveComparison;
+ pTrigger->TriggerFired = SyncAlarmTriggerFired;
+ pTrigger->CounterDestroyed = SyncAlarmCounterDestroyed;
+ status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger);
+ if (status != Success)
+ {
+ xfree(pAlarm);
+ return status;
+ }
+
+ pAlarm->client = client;
+ pAlarm->alarm_id = stuff->id;
+ XSyncIntToValue(&pAlarm->delta, 1L);
+ pAlarm->events = TRUE;
+ pAlarm->state = XSyncAlarmInactive;
+ pAlarm->pEventClients = NULL;
+ status = SyncChangeAlarmAttributes(client, pAlarm, vmask,
+ (CARD32 *)&stuff[1]);
+ if (status != Success)
+ {
+ xfree(pAlarm);
+ return status;
+ }
+
+ if (!AddResource(stuff->id, RTAlarm, pAlarm))
+ {
+ xfree(pAlarm);
+ return BadAlloc;
+ }
+
+ /* see if alarm already triggered. NULL counter will not trigger
+ * in CreateAlarm and sets alarm state to Inactive.
+ */
+
+ if (!pTrigger->pCounter)
+ {
+ pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */
+ }
+ else if ((*pTrigger->CheckTrigger)(pTrigger, pTrigger->pCounter->value))
+ {
+ (*pTrigger->TriggerFired)(pTrigger);
+ }
+
+ return Success;
+}
+
+/*
+ * ** Change Alarm
+ */
+static int
+ProcSyncChangeAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncChangeAlarmReq);
+ SyncAlarm *pAlarm;
+ long vmask;
+ int len, status;
+
+ REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
+
+ if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
+ RTAlarm, SecurityWriteAccess)))
+ {
+ client->errorValue = stuff->alarm;
+ return SyncErrorBase + XSyncBadAlarm;
+ }
+
+ vmask = stuff->valueMask;
+ len = client->req_len - (sizeof(xSyncChangeAlarmReq) >> 2);
+ /* the "extra" call to Ones accounts for the presence of 64 bit values */
+ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
+ return BadLength;
+
+ if ((status = SyncChangeAlarmAttributes(client, pAlarm, vmask,
+ (CARD32 *)&stuff[1])) != Success)
+ return status;
+
+ /* see if alarm already triggered. NULL counter WILL trigger
+ * in ChangeAlarm.
+ */
+
+ if (!pAlarm->trigger.pCounter ||
+ (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger,
+ pAlarm->trigger.pCounter->value))
+ {
+ (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger);
+ }
+ return Success;
+}
+
+static int
+ProcSyncQueryAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncQueryAlarmReq);
+ SyncAlarm *pAlarm;
+ xSyncQueryAlarmReply rep;
+ SyncTrigger *pTrigger;
+
+ REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
+
+ pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
+ RTAlarm, SecurityReadAccess);
+ if (!pAlarm)
+ {
+ client->errorValue = stuff->alarm;
+ return (SyncErrorBase + XSyncBadAlarm);
+ }
+
+ rep.type = X_Reply;
+ rep.length = (sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)) >> 2;
+ rep.sequenceNumber = client->sequence;
+
+ pTrigger = &pAlarm->trigger;
+ rep.counter = (pTrigger->pCounter) ? pTrigger->pCounter->id : None;
+
+#if 0 /* XXX unclear what to do, depends on whether relative value-types
+ * are "consumed" immediately and are considered absolute from then
+ * on.
+ */
+ rep.value_type = pTrigger->value_type;
+ rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
+ rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
+#else
+ rep.value_type = XSyncAbsolute;
+ rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
+ rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+#endif
+
+ rep.test_type = pTrigger->test_type;
+ rep.delta_hi = XSyncValueHigh32(pAlarm->delta);
+ rep.delta_lo = XSyncValueLow32(pAlarm->delta);
+ rep.events = pAlarm->events;
+ rep.state = pAlarm->state;
+
+ if (client->swapped)
+ {
+ register char n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.counter, n);
+ swapl(&rep.wait_value_hi, n);
+ swapl(&rep.wait_value_lo, n);
+ swapl(&rep.test_type, n);
+ swapl(&rep.delta_hi, n);
+ swapl(&rep.delta_lo, n);
+ }
+
+ WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcSyncDestroyAlarm(client)
+ ClientPtr client;
+{
+ SyncAlarm *pAlarm;
+ REQUEST(xSyncDestroyAlarmReq);
+
+ REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
+
+ if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm,
+ RTAlarm, SecurityDestroyAccess)))
+ {
+ client->errorValue = stuff->alarm;
+ return SyncErrorBase + XSyncBadAlarm;
+ }
+
+ FreeResource(stuff->alarm, RT_NONE);
+ return (client->noClientException);
+}
+
+/*
+ * ** Given an extension request, call the appropriate request procedure
+ */
+static int
+ProcSyncDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+
+ case X_SyncInitialize:
+ return ProcSyncInitialize(client);
+ case X_SyncListSystemCounters:
+ return ProcSyncListSystemCounters(client);
+ case X_SyncCreateCounter:
+ return ProcSyncCreateCounter(client);
+ case X_SyncSetCounter:
+ return ProcSyncSetCounter(client);
+ case X_SyncChangeCounter:
+ return ProcSyncChangeCounter(client);
+ case X_SyncQueryCounter:
+ return ProcSyncQueryCounter(client);
+ case X_SyncDestroyCounter:
+ return ProcSyncDestroyCounter(client);
+ case X_SyncAwait:
+ return ProcSyncAwait(client);
+ case X_SyncCreateAlarm:
+ return ProcSyncCreateAlarm(client);
+ case X_SyncChangeAlarm:
+ return ProcSyncChangeAlarm(client);
+ case X_SyncQueryAlarm:
+ return ProcSyncQueryAlarm(client);
+ case X_SyncDestroyAlarm:
+ return ProcSyncDestroyAlarm(client);
+ case X_SyncSetPriority:
+ return ProcSyncSetPriority(client);
+ case X_SyncGetPriority:
+ return ProcSyncGetPriority(client);
+ default:
+ return BadRequest;
+ }
+}
+
+/*
+ * Boring Swapping stuff ...
+ */
+
+static int
+SProcSyncInitialize(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncInitializeReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncInitializeReq);
+
+ return ProcSyncInitialize(client);
+}
+
+static int
+SProcSyncListSystemCounters(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncListSystemCountersReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncListSystemCountersReq);
+
+ return ProcSyncListSystemCounters(client);
+}
+
+static int
+SProcSyncCreateCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncCreateCounterReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncCreateCounterReq);
+ swapl(&stuff->cid, n);
+ swapl(&stuff->initial_value_lo, n);
+ swapl(&stuff->initial_value_hi, n);
+
+ return ProcSyncCreateCounter(client);
+}
+
+static int
+SProcSyncSetCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncSetCounterReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncSetCounterReq);
+ swapl(&stuff->cid, n);
+ swapl(&stuff->value_lo, n);
+ swapl(&stuff->value_hi, n);
+
+ return ProcSyncSetCounter(client);
+}
+
+static int
+SProcSyncChangeCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncChangeCounterReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncChangeCounterReq);
+ swapl(&stuff->cid, n);
+ swapl(&stuff->value_lo, n);
+ swapl(&stuff->value_hi, n);
+
+ return ProcSyncChangeCounter(client);
+}
+
+static int
+SProcSyncQueryCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncQueryCounterReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncQueryCounterReq);
+ swapl(&stuff->counter, n);
+
+ return ProcSyncQueryCounter(client);
+}
+
+static int
+SProcSyncDestroyCounter(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncDestroyCounterReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncDestroyCounterReq);
+ swapl(&stuff->counter, n);
+
+ return ProcSyncDestroyCounter(client);
+}
+
+static int
+SProcSyncAwait(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncAwaitReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
+ SwapRestL(stuff);
+
+ return ProcSyncAwait(client);
+}
+
+
+static int
+SProcSyncCreateAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncCreateAlarmReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
+ swapl(&stuff->id, n);
+ swapl(&stuff->valueMask, n);
+ SwapRestL(stuff);
+
+ return ProcSyncCreateAlarm(client);
+}
+
+static int
+SProcSyncChangeAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncChangeAlarmReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
+ swapl(&stuff->alarm, n);
+ swapl(&stuff->valueMask, n);
+ SwapRestL(stuff);
+ return ProcSyncChangeAlarm(client);
+}
+
+static int
+SProcSyncQueryAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncQueryAlarmReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncQueryAlarmReq);
+ swapl(&stuff->alarm, n);
+
+ return ProcSyncQueryAlarm(client);
+}
+
+static int
+SProcSyncDestroyAlarm(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncDestroyAlarmReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq);
+ swapl(&stuff->alarm, n);
+
+ return ProcSyncDestroyAlarm(client);
+}
+
+static int
+SProcSyncSetPriority(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncSetPriorityReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncSetPriorityReq);
+ swapl(&stuff->id, n);
+ swapl(&stuff->priority, n);
+
+ return ProcSyncSetPriority(client);
+}
+
+static int
+SProcSyncGetPriority(client)
+ ClientPtr client;
+{
+ REQUEST(xSyncGetPriorityReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH (xSyncGetPriorityReq);
+ swapl(&stuff->id, n);
+
+ return ProcSyncGetPriority(client);
+}
+
+
+static int
+SProcSyncDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_SyncInitialize:
+ return SProcSyncInitialize(client);
+ case X_SyncListSystemCounters:
+ return SProcSyncListSystemCounters(client);
+ case X_SyncCreateCounter:
+ return SProcSyncCreateCounter(client);
+ case X_SyncSetCounter:
+ return SProcSyncSetCounter(client);
+ case X_SyncChangeCounter:
+ return SProcSyncChangeCounter(client);
+ case X_SyncQueryCounter:
+ return SProcSyncQueryCounter(client);
+ case X_SyncDestroyCounter:
+ return SProcSyncDestroyCounter(client);
+ case X_SyncAwait:
+ return SProcSyncAwait(client);
+ case X_SyncCreateAlarm:
+ return SProcSyncCreateAlarm(client);
+ case X_SyncChangeAlarm:
+ return SProcSyncChangeAlarm(client);
+ case X_SyncQueryAlarm:
+ return SProcSyncQueryAlarm(client);
+ case X_SyncDestroyAlarm:
+ return SProcSyncDestroyAlarm(client);
+ case X_SyncSetPriority:
+ return SProcSyncSetPriority(client);
+ case X_SyncGetPriority:
+ return SProcSyncGetPriority(client);
+ default:
+ return BadRequest;
+ }
+}
+
+/*
+ * Event Swapping
+ */
+
+static void
+SCounterNotifyEvent(from, to)
+ xSyncCounterNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->counter, to->counter);
+ cpswapl(from->wait_value_lo, to->wait_value_lo);
+ cpswapl(from->wait_value_hi, to->wait_value_hi);
+ cpswapl(from->counter_value_lo, to->counter_value_lo);
+ cpswapl(from->counter_value_hi, to->counter_value_hi);
+ cpswapl(from->time, to->time);
+ cpswaps(from->count, to->count);
+ to->destroyed = from->destroyed;
+}
+
+
+static void
+SAlarmNotifyEvent(from, to)
+ xSyncAlarmNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->alarm, to->alarm);
+ cpswapl(from->counter_value_lo, to->counter_value_lo);
+ cpswapl(from->counter_value_hi, to->counter_value_hi);
+ cpswapl(from->alarm_value_lo, to->alarm_value_lo);
+ cpswapl(from->alarm_value_hi, to->alarm_value_hi);
+ cpswapl(from->time, to->time);
+ to->state = from->state;
+}
+
+/*
+ * ** Close everything down. ** This is fairly simple for now.
+ */
+/* ARGSUSED */
+static void
+SyncResetProc(extEntry)
+ ExtensionEntry *extEntry;
+{
+ xfree(SysCounterList);
+ SysCounterList = NULL;
+ RTCounter = 0;
+}
+
+
+/*
+ * ** Initialise the extension.
+ */
+void
+SyncExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if (RTCounter == 0)
+ {
+ RTCounter = CreateNewResourceType(FreeCounter);
+ }
+ RTAlarm = CreateNewResourceType(FreeAlarm);
+ RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN;
+ RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN;
+
+ if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 ||
+ RTAlarmClient == 0 ||
+ (extEntry = AddExtension(SYNC_NAME,
+ XSyncNumberEvents, XSyncNumberErrors,
+ ProcSyncDispatch, SProcSyncDispatch,
+ SyncResetProc,
+ StandardMinorOpcode)) == NULL)
+ {
+ ErrorF("Sync Extension %d.%d failed to Initialise\n",
+ SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
+ return;
+ }
+
+ SyncReqCode = extEntry->base;
+ SyncEventBase = extEntry->eventBase;
+ SyncErrorBase = extEntry->errorBase;
+ EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
+
+ /*
+ * Although SERVERTIME is implemented by the OS layer, we initialise it
+ * here because doing it in OsInit() is too early. The resource database
+ * is not initialised when OsInit() is called. This is just about OK
+ * because there is always a servertime counter.
+ */
+ SyncInitServerTime();
+
+#ifdef DEBUG
+ fprintf(stderr, "Sync Extension %d.%d\n",
+ SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
+#endif
+}
+
+
+/*
+ * ***** SERVERTIME implementation - should go in its own file in OS directory?
+ */
+
+
+
+static pointer ServertimeCounter;
+static XSyncValue Now;
+static XSyncValue *pnext_time;
+
+#define GetTime()\
+{\
+ unsigned long millis = GetTimeInMillis();\
+ unsigned long maxis = XSyncValueHigh32(Now);\
+ if (millis < XSyncValueLow32(Now)) maxis++;\
+ XSyncIntsToValue(&Now, millis, maxis);\
+}
+
+/*
+*** Server Block Handler
+*** code inspired by multibuffer extension
+ */
+/*ARGSUSED*/
+static void ServertimeBlockHandler(env, wt, LastSelectMask)
+pointer env;
+struct timeval **wt;
+pointer LastSelectMask;
+{
+ XSyncValue delay;
+ unsigned long timeout;
+
+ if (pnext_time)
+ {
+ GetTime();
+
+ if (XSyncValueGreaterOrEqual(Now, *pnext_time))
+ {
+ timeout = 0;
+ }
+ else
+ {
+ Bool overflow;
+ XSyncValueSubtract(&delay, *pnext_time, Now, &overflow);
+ timeout = XSyncValueLow32(delay);
+ }
+ AdjustWaitForDelay(wt, timeout); /* os/utils.c */
+ }
+}
+
+/*
+*** Wakeup Handler
+ */
+/*ARGSUSED*/
+static void ServertimeWakeupHandler(env, rc, LastSelectMask)
+pointer env;
+int rc;
+pointer LastSelectMask;
+{
+ if (pnext_time)
+ {
+ GetTime();
+
+ if (XSyncValueGreaterOrEqual(Now, *pnext_time))
+ {
+ SyncChangeCounter(ServertimeCounter, Now);
+ }
+ }
+}
+
+static void
+ServertimeQueryValue(pCounter, pValue_return)
+ pointer pCounter;
+ CARD64 *pValue_return;
+{
+ GetTime();
+ *pValue_return = Now;
+}
+
+static void
+ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater)
+ pointer pCounter;
+ CARD64 *pbracket_less;
+ CARD64 *pbracket_greater;
+{
+ if (!pnext_time && pbracket_greater)
+ {
+ RegisterBlockAndWakeupHandlers(ServertimeBlockHandler,
+ ServertimeWakeupHandler,
+ NULL);
+ }
+ else if (pnext_time && !pbracket_greater)
+ {
+ RemoveBlockAndWakeupHandlers(ServertimeBlockHandler,
+ ServertimeWakeupHandler,
+ NULL);
+ }
+ pnext_time = pbracket_greater;
+}
+
+static void
+SyncInitServerTime()
+{
+ CARD64 resolution;
+
+ XSyncIntsToValue(&Now, GetTimeInMillis(), 0);
+ XSyncIntToValue(&resolution, 4);
+ ServertimeCounter = SyncCreateSystemCounter("SERVERTIME", Now, resolution,
+ XSyncCounterNeverDecreases,
+ ServertimeQueryValue, ServertimeBracketValues);
+ pnext_time = NULL;
+}
diff --git a/xc/programs/Xserver/Xext/vidmodeproc.h b/xc/programs/Xserver/Xext/vidmodeproc.h
new file mode 100644
index 000000000..e307871b6
--- /dev/null
+++ b/xc/programs/Xserver/Xext/vidmodeproc.h
@@ -0,0 +1,65 @@
+/* $XFree86: xc/programs/Xserver/Xext/vidmodeproc.h,v 1.2 1999/03/14 11:17:50 dawes Exp $ */
+
+/* Prototypes for DGA functions that the DDX must provide */
+
+#ifndef _VIDMODEPROC_H_
+#define _VIDMODEPROC_H_
+
+
+typedef enum {
+ VIDMODE_H_DISPLAY,
+ VIDMODE_H_SYNCSTART,
+ VIDMODE_H_SYNCEND,
+ VIDMODE_H_TOTAL,
+ VIDMODE_H_SKEW,
+ VIDMODE_V_DISPLAY,
+ VIDMODE_V_SYNCSTART,
+ VIDMODE_V_SYNCEND,
+ VIDMODE_V_TOTAL,
+ VIDMODE_FLAGS,
+ VIDMODE_CLOCK
+} VidModeSelectMode;
+
+typedef enum {
+ VIDMODE_MON_VENDOR,
+ VIDMODE_MON_MODEL,
+ VIDMODE_MON_NHSYNC,
+ VIDMODE_MON_NVREFRESH,
+ VIDMODE_MON_HSYNC_LO,
+ VIDMODE_MON_HSYNC_HI,
+ VIDMODE_MON_VREFRESH_LO,
+ VIDMODE_MON_VREFRESH_HI
+} VidModeSelectMonitor;
+
+
+void XFree86VidModeExtensionInit(void);
+
+Bool VidModeAvailable(int scrnIndex);
+Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
+Bool VidModeZoomViewport(int scrnIndex, int zoom);
+Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
+Bool VidModeSetViewPort(int scrnIndex, int x, int y);
+Bool VidModeSwitchMode(int scrnIndex, pointer mode);
+Bool VidModeLockZoom(int scrnIndex, Bool lock);
+Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
+Bool VidModeCheckModeClock(int scrnIndex, pointer mode, int dotClock);
+int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
+Bool VidModeGetClocks(int scrnIndex, int *Clocks);
+ModeStatus VidModeCheckModeForMonitor(int scrnIndex, pointer mode);
+ModeStatus VidModeCheckModeForDriver(int scrnIndex, pointer mode);
+void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
+Bool VidModeAddModeline(int scrnIndex, pointer mode);
+int VidModeGetDotClock(int scrnIndex, int Clock);
+int VidModeGetNumOfModes(int scrnIndex);
+Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
+Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
+pointer VidModeCreateMode(void);
+void VidModeCopyMode(pointer modefrom, pointer modeto);
+int VidModeGetModeValue(pointer mode, int valtyp);
+void VidModeSetModeValue(pointer mode, int valtyp, int val);
+int VidModeGetMonitorValue(pointer monitor, int valtyp, int indx);
+
+#endif
diff --git a/xc/programs/Xserver/Xext/xcmisc.c b/xc/programs/Xserver/Xext/xcmisc.c
new file mode 100644
index 000000000..9cb5f1c2e
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xcmisc.c
@@ -0,0 +1,228 @@
+/* $TOG: xcmisc.c /main/6 1998/02/09 15:25:40 kaleb $ */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.3 1998/10/04 09:36:50 dawes Exp $ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "swaprep.h"
+#include "xcmiscstr.h"
+
+static unsigned char XCMiscCode;
+
+static void XCMiscResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcXCMiscDispatch);
+static DISPATCH_PROC(ProcXCMiscGetVersion);
+static DISPATCH_PROC(ProcXCMiscGetXIDList);
+static DISPATCH_PROC(ProcXCMiscGetXIDRange);
+static DISPATCH_PROC(SProcXCMiscDispatch);
+static DISPATCH_PROC(SProcXCMiscGetVersion);
+static DISPATCH_PROC(SProcXCMiscGetXIDList);
+static DISPATCH_PROC(SProcXCMiscGetXIDRange);
+
+void
+XCMiscExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
+ ProcXCMiscDispatch, SProcXCMiscDispatch,
+ XCMiscResetProc, StandardMinorOpcode)) != 0)
+ XCMiscCode = (unsigned char)extEntry->base;
+ DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
+}
+
+/*ARGSUSED*/
+static void
+XCMiscResetProc (extEntry)
+ ExtensionEntry *extEntry;
+{
+}
+
+static int
+ProcXCMiscGetVersion(client)
+ register ClientPtr client;
+{
+ xXCMiscGetVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XCMiscMajorVersion;
+ rep.minorVersion = XCMiscMinorVersion;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcXCMiscGetXIDRange(client)
+ register ClientPtr client;
+{
+ xXCMiscGetXIDRangeReply rep;
+ register int n;
+ XID min_id, max_id;
+
+ REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
+ GetXIDRange(client->index, FALSE, &min_id, &max_id);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.start_id = min_id;
+ rep.count = max_id - min_id + 1;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.start_id, n);
+ swapl(&rep.count, n);
+ }
+ WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcXCMiscGetXIDList(client)
+ register ClientPtr client;
+{
+ REQUEST(xXCMiscGetXIDListReq);
+ xXCMiscGetXIDListReply rep;
+ register int n;
+ XID *pids;
+ unsigned int count;
+
+ REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
+
+ pids = (XID *)ALLOCATE_LOCAL(stuff->count * sizeof(XID));
+ if (!pids)
+ {
+ return BadAlloc;
+ }
+ count = GetXIDList(client, stuff->count, pids);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = count;
+ rep.count = count;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.count, n);
+ }
+ WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
+ if (count)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, count * sizeof(XID), pids);
+ }
+ DEALLOCATE_LOCAL(pids);
+ return(client->noClientException);
+}
+
+static int
+ProcXCMiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XCMiscGetVersion:
+ return ProcXCMiscGetVersion(client);
+ case X_XCMiscGetXIDRange:
+ return ProcXCMiscGetXIDRange(client);
+ case X_XCMiscGetXIDList:
+ return ProcXCMiscGetXIDList(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcXCMiscGetVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXCMiscGetVersionReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
+ swaps(&stuff->majorVersion, n);
+ swaps(&stuff->minorVersion, n);
+ return ProcXCMiscGetVersion(client);
+}
+
+static int
+SProcXCMiscGetXIDRange(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xReq);
+
+ swaps(&stuff->length, n);
+ return ProcXCMiscGetXIDRange(client);
+}
+
+static int
+SProcXCMiscGetXIDList(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXCMiscGetXIDListReq);
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->count, n);
+ return ProcXCMiscGetXIDList(client);
+}
+
+static int
+SProcXCMiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XCMiscGetVersion:
+ return SProcXCMiscGetVersion(client);
+ case X_XCMiscGetXIDRange:
+ return SProcXCMiscGetXIDRange(client);
+ case X_XCMiscGetXIDList:
+ return SProcXCMiscGetXIDList(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/xf86dga.c b/xc/programs/Xserver/Xext/xf86dga.c
new file mode 100644
index 000000000..aa61e850a
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xf86dga.c
@@ -0,0 +1,289 @@
+/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.19 1999/08/01 07:56:59 dawes Exp $ */
+
+/*
+
+Copyright (c) 1995 Jon Tombs
+Copyright (c) 1995, 1996, 1999 XFree86 Inc
+
+*/
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DGA_SERVER_
+#include "xf86dga.h"
+#include "xf86dgastr.h"
+#include "swaprep.h"
+#include "dgaproc.h"
+
+
+static DISPATCH_PROC(ProcXF86DGADirectVideo);
+static DISPATCH_PROC(ProcXF86DGAGetVidPage);
+static DISPATCH_PROC(ProcXF86DGAGetVideoLL);
+static DISPATCH_PROC(ProcXF86DGAGetViewPortSize);
+static DISPATCH_PROC(ProcXF86DGASetVidPage);
+static DISPATCH_PROC(ProcXF86DGASetViewPort);
+static DISPATCH_PROC(ProcXF86DGAInstallColormap);
+static DISPATCH_PROC(ProcXF86DGAQueryDirectVideo);
+static DISPATCH_PROC(ProcXF86DGAViewPortChanged);
+
+
+static int
+ProcXF86DGAGetVideoLL(ClientPtr client)
+{
+ REQUEST(xXF86DGAGetVideoLLReq);
+ xXF86DGAGetVideoLLReply rep;
+ XDGAModeRec mode;
+ int num, offset, flags;
+ char *name;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if(!DGAAvailable(stuff->screen))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ /* get the parameters for the mode that best matches */
+ DGAGetModeInfo(stuff->screen, &mode, num);
+
+ if(!DGAOpenFramebuffer(stuff->screen, &name,
+ (unsigned char**)(&rep.offset),
+ (int*)(&rep.bank_size), &offset, &flags))
+ return BadAlloc;
+
+ rep.offset += mode.offset;
+ rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
+ rep.ram_size = rep.bank_size >> 10;
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGADirectVideo(ClientPtr client)
+{
+ int num;
+ PixmapPtr pix;
+ XDGAModeRec mode;
+ REQUEST(xXF86DGADirectVideoReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if (stuff->enable & XF86DGADirectGraphics) {
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+ } else
+ num = 0;
+
+ if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
+ return (DGAErrorBase + XF86DGAScreenNotActive);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAGetViewPortSize(ClientPtr client)
+{
+ int num;
+ XDGAModeRec mode;
+ REQUEST(xXF86DGAGetViewPortSizeReq);
+ xXF86DGAGetViewPortSizeReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ DGAGetModeInfo(stuff->screen, &mode, num);
+
+ rep.width = mode.viewportWidth;
+ rep.height = mode.viewportHeight;
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGASetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86DGASetViewPortReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
+
+ if (!DGAActive(stuff->screen))
+ return (DGAErrorBase + XF86DGADirectNotActivated);
+
+ if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
+ != Success)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAGetVidPage(ClientPtr client)
+{
+ REQUEST(xXF86DGAGetVidPageReq);
+ xXF86DGAGetVidPageReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.vpage = 0; /* silently fail */
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86DGASetVidPage(ClientPtr client)
+{
+ REQUEST(xXF86DGASetVidPageReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
+
+ /* silently fail */
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86DGAInstallColormap(ClientPtr client)
+{
+ ColormapPtr pcmp;
+ REQUEST(xXF86DGAInstallColormapReq);
+
+ REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
+
+ if (!DGAActive(stuff->screen))
+ return (DGAErrorBase + XF86DGADirectNotActivated);
+
+ pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP);
+ if (pcmp) {
+ DGAInstallCmap(pcmp);
+ return (client->noClientException);
+ } else {
+ client->errorValue = stuff->id;
+ return (BadColor);
+ }
+}
+
+static int
+ProcXF86DGAQueryDirectVideo(ClientPtr client)
+{
+ REQUEST(xXF86DGAQueryDirectVideoReq);
+ xXF86DGAQueryDirectVideoReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.flags = 0;
+
+ if (DGAAvailable(stuff->screen))
+ rep.flags = XF86DGADirectPresent;
+
+ WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAViewPortChanged(ClientPtr client)
+{
+ REQUEST(xXF86DGAViewPortChangedReq);
+ xXF86DGAViewPortChangedReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
+
+ if (!DGAActive(stuff->screen))
+ return (DGAErrorBase + XF86DGADirectNotActivated);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.result = 1;
+
+ WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+int
+ProcXF86DGADispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_XF86DGAGetVideoLL:
+ return ProcXF86DGAGetVideoLL(client);
+ case X_XF86DGADirectVideo:
+ return ProcXF86DGADirectVideo(client);
+ case X_XF86DGAGetViewPortSize:
+ return ProcXF86DGAGetViewPortSize(client);
+ case X_XF86DGASetViewPort:
+ return ProcXF86DGASetViewPort(client);
+ case X_XF86DGAGetVidPage:
+ return ProcXF86DGAGetVidPage(client);
+ case X_XF86DGASetVidPage:
+ return ProcXF86DGASetVidPage(client);
+ case X_XF86DGAInstallColormap:
+ return ProcXF86DGAInstallColormap(client);
+ case X_XF86DGAQueryDirectVideo:
+ return ProcXF86DGAQueryDirectVideo(client);
+ case X_XF86DGAViewPortChanged:
+ return ProcXF86DGAViewPortChanged(client);
+ default:
+ return BadRequest;
+ }
+}
+
diff --git a/xc/programs/Xserver/Xext/xf86dga2.c b/xc/programs/Xserver/Xext/xf86dga2.c
new file mode 100644
index 000000000..90088f263
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xf86dga2.c
@@ -0,0 +1,725 @@
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+*/
+/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.13 1999/08/22 05:57:24 dawes Exp $ */
+
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DGA_SERVER_
+#include "xf86dga.h"
+#include "xf86dgastr.h"
+#include "swaprep.h"
+#include "dgaproc.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <string.h>
+#endif
+
+
+static DISPATCH_PROC(ProcXDGADispatch);
+static DISPATCH_PROC(SProcXDGADispatch);
+static DISPATCH_PROC(ProcXDGAQueryVersion);
+static DISPATCH_PROC(ProcXDGAQueryModes);
+static DISPATCH_PROC(ProcXDGASetMode);
+static DISPATCH_PROC(ProcXDGAOpenFramebuffer);
+static DISPATCH_PROC(ProcXDGACloseFramebuffer);
+static DISPATCH_PROC(ProcXDGASetViewport);
+static DISPATCH_PROC(ProcXDGAInstallColormap);
+static DISPATCH_PROC(ProcXDGASelectInput);
+static DISPATCH_PROC(ProcXDGAFillRectangle);
+static DISPATCH_PROC(ProcXDGACopyArea);
+static DISPATCH_PROC(ProcXDGACopyTransparentArea);
+static DISPATCH_PROC(ProcXDGAGetViewportStatus);
+static DISPATCH_PROC(ProcXDGASync);
+static DISPATCH_PROC(ProcXDGASetClientVersion);
+static DISPATCH_PROC(ProcXDGAChangePixmapMode);
+static DISPATCH_PROC(ProcXDGACreateColormap);
+
+
+extern DISPATCH_PROC(ProcXF86DGADispatch);
+
+
+static void XDGAResetProc(ExtensionEntry *extEntry);
+
+static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
+
+static ClientPtr DGAClients[MAXSCREENS];
+
+unsigned char DGAReqCode = 0;
+int DGAErrorBase;
+int DGAEventBase;
+
+static int DGAGeneration = 0;
+static int DGAClientPrivateIndex;
+static int DGACallbackRefCount = 0;
+
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} DGAPrivRec, *DGAPrivPtr;
+
+#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr)
+
+void
+XFree86DGAExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+ if ((extEntry = AddExtension(XF86DGANAME,
+ XF86DGANumberEvents,
+ XF86DGANumberErrors,
+ ProcXDGADispatch,
+ SProcXDGADispatch,
+ XDGAResetProc,
+ StandardMinorOpcode))) {
+ int i;
+
+ for(i = 0; i < MAXSCREENS; i++)
+ DGAClients[i] = NULL;
+
+ DGAReqCode = (unsigned char)extEntry->base;
+ DGAErrorBase = extEntry->errorBase;
+ DGAEventBase = extEntry->eventBase;
+ }
+
+ /*
+ * Allocate a client private index to hold the client's version
+ * information.
+ */
+ if (DGAGeneration != serverGeneration) {
+ DGAClientPrivateIndex = AllocateClientPrivateIndex();
+ /*
+ * Allocate 0 length, and use the private to hold a pointer to
+ * our DGAPrivRec.
+ */
+ if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) {
+ ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n");
+ return;
+ }
+ DGAGeneration = serverGeneration;
+ }
+}
+
+
+
+static void
+XDGAResetProc (ExtensionEntry *extEntry)
+{
+ DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ DGACallbackRefCount = 0;
+}
+
+
+static int
+ProcXDGAQueryVersion(ClientPtr client)
+{
+ xXDGAQueryVersionReply rep;
+
+ REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XDGA_MAJOR_VERSION;
+ rep.minorVersion = XDGA_MINOR_VERSION;
+
+ WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAOpenFramebuffer(ClientPtr client)
+{
+ REQUEST(xXDGAOpenFramebufferReq);
+ xXDGAOpenFramebufferReply rep;
+ char *deviceName;
+ int nameSize;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
+ (unsigned char**)(&rep.mem1),
+ (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
+ {
+ return BadAlloc;
+ }
+
+ nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
+ rep.length = (nameSize + 3) >> 2;
+
+ WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
+ if(rep.length)
+ WriteToClient(client, nameSize, deviceName);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACloseFramebuffer(ClientPtr client)
+{
+ REQUEST(xXDGACloseFramebufferReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
+
+ DGACloseFramebuffer(stuff->screen);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAQueryModes(ClientPtr client)
+{
+ int i, num, size;
+ REQUEST(xXDGAQueryModesReq);
+ xXDGAQueryModesReply rep;
+ xXDGAModeInfo info;
+ XDGAModePtr mode;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.number = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if(!(num = DGAGetModes(stuff->screen))) {
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
+ return (client->noClientException);
+ }
+
+ if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec))))
+ return BadAlloc;
+
+ for(i = 0; i < num; i++)
+ DGAGetModeInfo(stuff->screen, mode + i, i + 1);
+
+ size = num * sz_xXDGAModeInfo;
+ for(i = 0; i < num; i++)
+ size += (strlen(mode[i].name) + 4) & ~3L; /* plus NULL */
+
+ rep.number = num;
+ rep.length = size >> 2;
+
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
+
+ for(i = 0; i < num; i++) {
+ size = strlen(mode[i].name) + 1;
+
+ info.byte_order = mode[i].byteOrder;
+ info.depth = mode[i].depth;
+ info.num = mode[i].num;
+ info.bpp = mode[i].bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode[i].VSync_num;
+ info.vsync_den = mode[i].VSync_den;
+ info.flags = mode[i].flags;
+ info.image_width = mode[i].imageWidth;
+ info.image_height = mode[i].imageHeight;
+ info.pixmap_width = mode[i].pixmapWidth;
+ info.pixmap_height = mode[i].pixmapHeight;
+ info.bytes_per_scanline = mode[i].bytesPerScanline;
+ info.red_mask = mode[i].red_mask;
+ info.green_mask = mode[i].green_mask;
+ info.blue_mask = mode[i].blue_mask;
+ info.visual_class = mode[i].visualClass;
+ info.viewport_width = mode[i].viewportWidth;
+ info.viewport_height = mode[i].viewportHeight;
+ info.viewport_xstep = mode[i].xViewportStep;
+ info.viewport_ystep = mode[i].yViewportStep;
+ info.viewport_xmax = mode[i].maxViewportX;
+ info.viewport_ymax = mode[i].maxViewportY;
+ info.viewport_flags = mode[i].viewportFlags;
+ info.reserved1 = mode[i].reserved1;
+ info.reserved2 = mode[i].reserved2;
+
+ WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, size, mode[i].name);
+ }
+
+ xfree(mode);
+
+ return (client->noClientException);
+}
+
+
+static void
+DGAClientStateChange (
+ CallbackListPtr* pcbl,
+ pointer nulldata,
+ pointer calldata
+){
+ NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
+ ClientPtr client = NULL;
+ int i;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ if(DGAClients[i] == pci->client) {
+ client = pci->client;
+ break;
+ }
+ }
+
+ if(client &&
+ ((client->clientState == ClientStateGone) ||
+ (client->clientState == ClientStateRetained))) {
+ XDGAModeRec mode;
+ PixmapPtr pPix;
+
+ DGAClients[i] = NULL;
+ DGASelectInput(i, NULL, 0);
+ DGASetMode(i, 0, &mode, &pPix);
+
+ if(--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+}
+
+static int
+ProcXDGASetMode(ClientPtr client)
+{
+ REQUEST(xXDGASetModeReq);
+ xXDGASetModeReply rep;
+ XDGAModeRec mode;
+ xXDGAModeInfo info;
+ PixmapPtr pPix;
+ int size;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXDGASetModeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.offset = 0;
+ rep.flags = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if(DGAClients[stuff->screen] &&
+ (DGAClients[stuff->screen] != client))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if(!stuff->mode) {
+ if(DGAClients[stuff->screen]) {
+ if(--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+ DGAClients[stuff->screen] = NULL;
+ DGASelectInput(stuff->screen, NULL, 0);
+ DGASetMode(stuff->screen, 0, &mode, &pPix);
+ WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
+ return (client->noClientException);
+ }
+
+ if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
+ return BadValue;
+
+ if(!DGAClients[stuff->screen]) {
+ if(DGACallbackRefCount++ == 0)
+ AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGAClients[stuff->screen] = client;
+
+ if(pPix) {
+ if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
+ pPix->drawable.id = (int)stuff->pid;
+ rep.flags = DGA_PIXMAP_AVAILABLE;
+ }
+ }
+
+ size = strlen(mode.name) + 1;
+
+ info.byte_order = mode.byteOrder;
+ info.depth = mode.depth;
+ info.num = mode.num;
+ info.bpp = mode.bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode.VSync_num;
+ info.vsync_den = mode.VSync_den;
+ info.flags = mode.flags;
+ info.image_width = mode.imageWidth;
+ info.image_height = mode.imageHeight;
+ info.pixmap_width = mode.pixmapWidth;
+ info.pixmap_height = mode.pixmapHeight;
+ info.bytes_per_scanline = mode.bytesPerScanline;
+ info.red_mask = mode.red_mask;
+ info.green_mask = mode.green_mask;
+ info.blue_mask = mode.blue_mask;
+ info.visual_class = mode.visualClass;
+ info.viewport_width = mode.viewportWidth;
+ info.viewport_height = mode.viewportHeight;
+ info.viewport_xstep = mode.xViewportStep;
+ info.viewport_ystep = mode.yViewportStep;
+ info.viewport_xmax = mode.maxViewportX;
+ info.viewport_ymax = mode.maxViewportY;
+ info.viewport_flags = mode.viewportFlags;
+ info.reserved1 = mode.reserved1;
+ info.reserved2 = mode.reserved2;
+
+ rep.length = (sz_xXDGAModeInfo + info.name_size) >> 2;
+
+ WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
+ WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, size, mode.name);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASetViewport(ClientPtr client)
+{
+ REQUEST(xXDGASetViewportReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASetViewportReq);
+
+ DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAInstallColormap(ClientPtr client)
+{
+ ColormapPtr cmap;
+ REQUEST(xXDGAInstallColormapReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
+
+ cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP);
+ if (cmap) {
+ DGAInstallCmap(cmap);
+ return (client->noClientException);
+ } else {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGASelectInput(ClientPtr client)
+{
+ REQUEST(xXDGASelectInputReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASelectInputReq);
+
+ if(DGAClients[stuff->screen] == client)
+ DGASelectInput(stuff->screen, client, stuff->mask);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAFillRectangle(ClientPtr client)
+{
+ REQUEST(xXDGAFillRectangleReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
+
+ if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
+ stuff->width, stuff->height, stuff->color))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGACopyArea(ClientPtr client)
+{
+ REQUEST(xXDGACopyAreaReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
+
+ if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx, stuff->dsty))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACopyTransparentArea(ClientPtr client)
+{
+ REQUEST(xXDGACopyTransparentAreaReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
+
+ if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAGetViewportStatus(ClientPtr client)
+{
+ REQUEST(xXDGAGetViewportStatusReq);
+ xXDGAGetViewportStatusReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rep.status = DGAGetViewportStatus(stuff->screen);
+
+ WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASync(ClientPtr client)
+{
+ REQUEST(xXDGASyncReq);
+ xXDGASyncReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASyncReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ DGASync(stuff->screen);
+
+ WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASetClientVersion(ClientPtr client)
+{
+ REQUEST(xXDGASetClientVersionReq);
+
+ DGAPrivPtr pPriv;
+
+ REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
+ if ((pPriv = DGAPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(DGAPrivRec));
+ /* XXX Need to look into freeing this */
+ if (!pPriv)
+ return BadAlloc;
+ DGAPRIV(client) = pPriv;
+ }
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAChangePixmapMode(ClientPtr client)
+{
+ REQUEST(xXDGAChangePixmapModeReq);
+ xXDGAChangePixmapModeReply rep;
+ int x, y;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ x = stuff->x;
+ y = stuff->y;
+
+ if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
+ return BadMatch;
+
+ rep.x = x;
+ rep.y = y;
+ WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACreateColormap(ClientPtr client)
+{
+ REQUEST(xXDGACreateColormapReq);
+ int result;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
+
+ if(!stuff->mode)
+ return BadValue;
+
+ result = DGACreateColormap(stuff->screen, client, stuff->id,
+ stuff->mode, stuff->alloc);
+ if(result != Success)
+ return result;
+
+ return (client->noClientException);
+}
+
+
+static int
+SProcXDGADispatch (ClientPtr client)
+{
+ return DGAErrorBase + XF86DGAClientNotLocal;
+}
+
+static int
+ProcXDGADispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ if (!LocalClient(client))
+ return DGAErrorBase + XF86DGAClientNotLocal;
+
+ /* divert old protocol */
+#if 1
+ if( (stuff->data <= X_XF86DGAViewPortChanged) &&
+ (stuff->data >= X_XF86DGAGetVideoLL))
+ return ProcXF86DGADispatch(client);
+#endif
+
+ switch (stuff->data){
+ case X_XDGAQueryVersion:
+ return ProcXDGAQueryVersion(client);
+ case X_XDGAQueryModes:
+ return ProcXDGAQueryModes(client);
+ case X_XDGASetMode:
+ return ProcXDGASetMode(client);
+ case X_XDGAOpenFramebuffer:
+ return ProcXDGAOpenFramebuffer(client);
+ case X_XDGACloseFramebuffer:
+ return ProcXDGACloseFramebuffer(client);
+ case X_XDGASetViewport:
+ return ProcXDGASetViewport(client);
+ case X_XDGAInstallColormap:
+ return ProcXDGAInstallColormap(client);
+ case X_XDGASelectInput:
+ return ProcXDGASelectInput(client);
+ case X_XDGAFillRectangle:
+ return ProcXDGAFillRectangle(client);
+ case X_XDGACopyArea:
+ return ProcXDGACopyArea(client);
+ case X_XDGACopyTransparentArea:
+ return ProcXDGACopyTransparentArea(client);
+ case X_XDGAGetViewportStatus:
+ return ProcXDGAGetViewportStatus(client);
+ case X_XDGASync:
+ return ProcXDGASync(client);
+ case X_XDGASetClientVersion:
+ return ProcXDGASetClientVersion(client);
+ case X_XDGAChangePixmapMode:
+ return ProcXDGAChangePixmapMode(client);
+ case X_XDGACreateColormap:
+ return ProcXDGACreateColormap(client);
+ default:
+ return BadRequest;
+ }
+}
+
+#ifdef EXTMODULE
+void
+XFree86DGARegister()
+{
+ XDGAEventBase = &DGAEventBase;
+}
+#endif
diff --git a/xc/programs/Xserver/Xext/xf86misc.c b/xc/programs/Xserver/Xext/xf86misc.c
new file mode 100644
index 000000000..c4ae12103
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xf86misc.c
@@ -0,0 +1,542 @@
+/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.31 1999/07/10 12:17:15 dawes Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 The XFree86 Project, Inc
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "scrnintstr.h"
+#include "inputstr.h"
+#include "servermd.h"
+#define _XF86MISC_SERVER_
+#undef _XF86MISC_SAVER_COMPAT_
+#include "xf86mscstr.h"
+#include "swaprep.h"
+#include "xf86.h"
+#include "Xfuncproto.h"
+#include "xf86miscproc.h"
+
+#include <X11/Xtrans.h>
+#include "../os/osdep.h"
+#include <X11/Xauth.h>
+#ifndef USL
+#ifndef ESIX
+#ifndef Lynx
+#include <sys/socket.h>
+#else
+#include <socket.h>
+#endif
+#else
+#include <lan/socket.h>
+#endif
+#endif /* USL */
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+static int miscErrorBase;
+
+static void XF86MiscResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry* /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcXF86MiscDispatch);
+static DISPATCH_PROC(ProcXF86MiscQueryVersion);
+static DISPATCH_PROC(ProcXF86MiscGetKbdSettings);
+static DISPATCH_PROC(ProcXF86MiscGetMouseSettings);
+static DISPATCH_PROC(ProcXF86MiscSetKbdSettings);
+static DISPATCH_PROC(ProcXF86MiscSetMouseSettings);
+#ifdef _XF86MISC_SAVER_COMPAT_
+static DISPATCH_PROC(ProcXF86MiscGetSaver);
+static DISPATCH_PROC(ProcXF86MiscSetSaver);
+#endif
+static DISPATCH_PROC(SProcXF86MiscDispatch);
+static DISPATCH_PROC(SProcXF86MiscQueryVersion);
+static DISPATCH_PROC(SProcXF86MiscGetKbdSettings);
+static DISPATCH_PROC(SProcXF86MiscGetMouseSettings);
+static DISPATCH_PROC(SProcXF86MiscSetKbdSettings);
+static DISPATCH_PROC(SProcXF86MiscSetMouseSettings);
+#ifdef _XF86MISC_SAVER_COMPAT_
+static DISPATCH_PROC(SProcXF86MiscGetSaver);
+static DISPATCH_PROC(SProcXF86MiscSetSaver);
+#endif
+
+static unsigned char XF86MiscReqCode = 0;
+
+#define DEBUG
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+#define MISCERR(x) (miscErrorBase + x)
+
+void
+XFree86MiscExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+ DEBUG_P("XFree86MiscExtensionInit");
+
+ if (!xf86GetModInDevEnabled())
+ return;
+
+ if (
+ (extEntry = AddExtension(XF86MISCNAME,
+ XF86MiscNumberEvents,
+ XF86MiscNumberErrors,
+ ProcXF86MiscDispatch,
+ SProcXF86MiscDispatch,
+ XF86MiscResetProc,
+ StandardMinorOpcode))) {
+ XF86MiscReqCode = (unsigned char)extEntry->base;
+ miscErrorBase = extEntry->errorBase;
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86MiscResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+}
+
+static int
+ProcXF86MiscQueryVersion(client)
+ register ClientPtr client;
+{
+ xXF86MiscQueryVersionReply rep;
+ register int n;
+
+ DEBUG_P("XF86MiscQueryVersion");
+
+ REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86MISC_MAJOR_VERSION;
+ rep.minorVersion = XF86MISC_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+#ifdef _XF86MISC_SAVER_COMPAT_
+/* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */
+
+/*
+ * This will go away, but remains for now for compatibility with older
+ * clients.
+ */
+static int
+ProcXF86MiscSetSaver(client)
+ register ClientPtr client;
+{
+ REQUEST(xXF86MiscSetSaverReq);
+ ScrnInfoPtr vptr;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
+
+ if (stuff->suspendTime < 0)
+ return BadValue;
+ if (stuff->offTime < 0)
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+/*
+ * This will go away, but remains for now for compatibility with older
+ * clients.
+ */
+static int
+ProcXF86MiscGetSaver(client)
+ register ClientPtr client;
+{
+ REQUEST(xXF86MiscGetSaverReq);
+ xXF86MiscGetSaverReply rep;
+ register int n;
+ ScrnInfoPtr vptr;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.suspendTime = 0;
+ rep.offTime = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.suspendTime, n);
+ swapl(&rep.offTime, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+#endif /* _XF86MISC_SAVER_COMPAT_ */
+
+static int
+ProcXF86MiscGetMouseSettings(client)
+ register ClientPtr client;
+{
+ xXF86MiscGetMouseSettingsReply rep;
+ char *devname;
+ pointer mouse;
+ register int n;
+
+ DEBUG_P("XF86MiscGetMouseSettings");
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+
+ if (!MiscExtGetMouseSettings(&mouse, &devname))
+ return BadValue;
+
+ rep.mousetype = MiscExtGetMouseValue(mouse, MISC_MSE_PROTO);
+ rep.baudrate = MiscExtGetMouseValue(mouse, MISC_MSE_BAUDRATE);
+ rep.samplerate = MiscExtGetMouseValue(mouse, MISC_MSE_SAMPLERATE);
+ rep.resolution = MiscExtGetMouseValue(mouse, MISC_MSE_RESOLUTION);
+ rep.buttons = MiscExtGetMouseValue(mouse, MISC_MSE_BUTTONS);
+ rep.emulate3buttons = MiscExtGetMouseValue(mouse, MISC_MSE_EM3BUTTONS);
+ rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
+ rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
+ rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
+ rep.devnamelen = (devname? strlen(devname): 0);
+ rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
+ sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.mousetype, n);
+ swapl(&rep.baudrate, n);
+ swapl(&rep.samplerate, n);
+ swapl(&rep.resolution, n);
+ swapl(&rep.buttons, n);
+ swapl(&rep.emulate3buttons, n);
+ swapl(&rep.emulate3timeout, n);
+ swapl(&rep.chordmiddle, n);
+ swapl(&rep.flags, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
+ if (rep.devnamelen)
+ WriteToClient(client, rep.devnamelen, devname);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscGetKbdSettings(client)
+ register ClientPtr client;
+{
+ xXF86MiscGetKbdSettingsReply rep;
+ pointer kbd;
+ register int n;
+
+ DEBUG_P("XF86MiscGetKbdSettings");
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!MiscExtGetKbdSettings(&kbd))
+ return BadValue;
+
+ rep.kbdtype = MiscExtGetKbdValue(kbd, MISC_KBD_TYPE);
+ rep.rate = MiscExtGetKbdValue(kbd, MISC_KBD_RATE);
+ rep.delay = MiscExtGetKbdValue(kbd, MISC_KBD_DELAY);
+ rep.servnumlock = MiscExtGetKbdValue(kbd, MISC_KBD_SERVNUMLOCK);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.kbdtype, n);
+ swapl(&rep.rate, n);
+ swapl(&rep.delay, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetMouseSettings(client)
+ register ClientPtr client;
+{
+ MiscExtReturn ret;
+ pointer mouse;
+ REQUEST(xXF86MiscSetMouseSettingsReq);
+
+ DEBUG_P("XF86MiscSetMouseSettings");
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq);
+
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
+ stuff->mousetype, stuff->baudrate,
+ stuff->samplerate, stuff->chordmiddle);
+ ErrorF(" em3but: %d em3tim: %d res: %d flags: %d\n",
+ stuff->emulate3buttons, stuff->emulate3timeout,
+ stuff->resolution, stuff->flags);
+ }
+
+ if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0)
+ return BadAlloc;
+
+ MiscExtSetMouseValue(mouse, MISC_MSE_PROTO, stuff->mousetype);
+ MiscExtSetMouseValue(mouse, MISC_MSE_BAUDRATE, stuff->baudrate);
+ MiscExtSetMouseValue(mouse, MISC_MSE_SAMPLERATE, stuff->samplerate);
+ MiscExtSetMouseValue(mouse, MISC_MSE_RESOLUTION, stuff->resolution);
+ MiscExtSetMouseValue(mouse, MISC_MSE_BUTTONS, stuff->buttons);
+ MiscExtSetMouseValue(mouse, MISC_MSE_EM3BUTTONS, stuff->emulate3buttons);
+ MiscExtSetMouseValue(mouse, MISC_MSE_EM3TIMEOUT, stuff->emulate3timeout);
+ MiscExtSetMouseValue(mouse, MISC_MSE_CHORDMIDDLE, stuff->chordmiddle);
+ MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags);
+
+ switch ((ret = MiscExtApply(mouse, MISC_POINTER))) {
+ case MISC_RET_SUCCESS: break;
+ case MISC_RET_BADVAL: return BadValue;
+ case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol);
+ case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate);
+ case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags);
+ case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
+ default:
+ ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret);
+ return BadImplementation;
+ }
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("SetMouseSettings - Succeeded\n");
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetKbdSettings(client)
+ register ClientPtr client;
+{
+ MiscExtReturn ret;
+ pointer kbd;
+ REQUEST(xXF86MiscSetKbdSettingsReq);
+
+ DEBUG_P("XF86MiscSetKbdSettings");
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
+ stuff->kbdtype, stuff->rate,
+ stuff->delay, stuff->servnumlock);
+
+ if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
+ return BadAlloc;
+
+ MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, stuff->kbdtype);
+ MiscExtSetKbdValue(kbd, MISC_KBD_RATE, stuff->rate);
+ MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, stuff->delay);
+ MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, stuff->servnumlock);
+
+ switch ((ret = MiscExtApply(kbd, MISC_KEYBOARD))) {
+ case MISC_RET_SUCCESS: break;
+ case MISC_RET_BADVAL: return BadValue;
+ case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
+ default:
+ ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret);
+ return BadImplementation;
+ }
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("SetKbdSettings - Succeeded\n");
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86MiscQueryVersion:
+ return ProcXF86MiscQueryVersion(client);
+#ifdef _XF86MISC_SAVER_COMPAT_
+ case X_XF86MiscGetSaver:
+ return ProcXF86MiscGetSaver(client);
+ case X_XF86MiscSetSaver:
+ return ProcXF86MiscSetSaver(client);
+#endif
+ case X_XF86MiscGetMouseSettings:
+ return ProcXF86MiscGetMouseSettings(client);
+ case X_XF86MiscGetKbdSettings:
+ return ProcXF86MiscGetKbdSettings(client);
+ default:
+ if (!xf86GetModInDevEnabled())
+ return miscErrorBase + XF86MiscModInDevDisabled;
+ if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86MiscSetMouseSettings:
+ return ProcXF86MiscSetMouseSettings(client);
+ case X_XF86MiscSetKbdSettings:
+ return ProcXF86MiscSetKbdSettings(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return miscErrorBase + XF86MiscModInDevClientNotLocal;
+ }
+}
+
+static int
+SProcXF86MiscQueryVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86MiscQueryVersion(client);
+}
+
+#ifdef _XF86MISC_SAVER_COMPAT_
+static int
+SProcXF86MiscGetSaver(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetSaverReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86MiscGetSaver(client);
+}
+
+static int
+SProcXF86MiscSetSaver(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetSaverReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->suspendTime, n);
+ swapl(&stuff->offTime, n);
+ return ProcXF86MiscSetSaver(client);
+}
+#endif /* _XF86MISC_SAVER_COMPAT_ */
+
+static int
+SProcXF86MiscGetMouseSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetMouseSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
+ return ProcXF86MiscGetMouseSettings(client);
+}
+
+static int
+SProcXF86MiscGetKbdSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetKbdSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
+ return ProcXF86MiscGetKbdSettings(client);
+}
+
+static int
+SProcXF86MiscSetMouseSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetMouseSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq);
+ swapl(&stuff->mousetype, n);
+ swapl(&stuff->baudrate, n);
+ swapl(&stuff->samplerate, n);
+ swapl(&stuff->resolution, n);
+ swapl(&stuff->buttons, n);
+ swapl(&stuff->emulate3timeout, n);
+ swapl(&stuff->flags, n);
+ return ProcXF86MiscSetMouseSettings(client);
+}
+
+static int
+SProcXF86MiscSetKbdSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetKbdSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
+ swapl(&stuff->kbdtype, n);
+ swapl(&stuff->rate, n);
+ swapl(&stuff->delay, n);
+ return ProcXF86MiscSetKbdSettings(client);
+}
+
+static int
+SProcXF86MiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86MiscQueryVersion:
+ return SProcXF86MiscQueryVersion(client);
+#ifdef _XF86MISC_SAVER_COMPAT_
+ case X_XF86MiscGetSaver:
+ return SProcXF86MiscGetSaver(client);
+ case X_XF86MiscSetSaver:
+ return SProcXF86MiscSetSaver(client);
+#endif
+ case X_XF86MiscGetMouseSettings:
+ return SProcXF86MiscGetMouseSettings(client);
+ case X_XF86MiscGetKbdSettings:
+ return SProcXF86MiscGetKbdSettings(client);
+ default:
+ if (!xf86GetModInDevEnabled())
+ return miscErrorBase + XF86MiscModInDevDisabled;
+ if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86MiscSetMouseSettings:
+ return SProcXF86MiscSetMouseSettings(client);
+ case X_XF86MiscSetKbdSettings:
+ return SProcXF86MiscSetKbdSettings(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return miscErrorBase + XF86MiscModInDevClientNotLocal;
+ }
+}
+
diff --git a/xc/programs/Xserver/Xext/xf86miscproc.h b/xc/programs/Xserver/Xext/xf86miscproc.h
new file mode 100644
index 000000000..7e7f5af0e
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xf86miscproc.h
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/Xext/xf86miscproc.h,v 1.1 1999/07/10 12:17:15 dawes Exp $ */
+
+/* Prototypes for Pointer/Keyboard functions that the DDX must provide */
+
+#ifndef _XF86MISCPROC_H_
+#define _XF86MISCPROC_H_
+
+typedef enum {
+ MISC_MSE_PROTO,
+ MISC_MSE_BAUDRATE,
+ MISC_MSE_SAMPLERATE,
+ MISC_MSE_RESOLUTION,
+ MISC_MSE_BUTTONS,
+ MISC_MSE_EM3BUTTONS,
+ MISC_MSE_EM3TIMEOUT,
+ MISC_MSE_CHORDMIDDLE,
+ MISC_MSE_FLAGS
+} MiscExtMseValType;
+
+typedef enum {
+ MISC_KBD_TYPE,
+ MISC_KBD_RATE,
+ MISC_KBD_DELAY,
+ MISC_KBD_SERVNUMLOCK
+} MiscExtKbdValType;
+
+typedef enum {
+ MISC_RET_SUCCESS,
+ MISC_RET_BADVAL,
+ MISC_RET_BADMSEPROTO,
+ MISC_RET_BADBAUDRATE,
+ MISC_RET_BADFLAGS,
+ MISC_RET_BADCOMBO,
+ MISC_RET_BADKBDTYPE
+} MiscExtReturn;
+
+typedef enum {
+ MISC_POINTER,
+ MISC_KEYBOARD
+} MiscExtStructType;
+
+#define MISC_MSEFLAG_CLEARDTR 1
+#define MISC_MSEFLAG_CLEARRTS 2
+#define MISC_MSEFLAG_REOPEN 128
+
+void XFree86MiscExtensionInit(void);
+
+Bool MiscExtGetMouseSettings(pointer *mouse, char **devname);
+int MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype);
+Bool MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value);
+Bool MiscExtGetKbdSettings(pointer *kbd);
+int MiscExtGetKbdValue(pointer kbd, MiscExtKbdValType valtype);
+Bool MiscExtSetKbdValue(pointer kbd, MiscExtKbdValType valtype, int value);
+pointer MiscExtCreateStruct(MiscExtStructType mse_or_kbd);
+void MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd);
+MiscExtReturn MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd);
+
+#endif
+
diff --git a/xc/programs/Xserver/Xext/xf86vmode.c b/xc/programs/Xserver/Xext/xf86vmode.c
new file mode 100644
index 000000000..76f766c6f
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xf86vmode.c
@@ -0,0 +1,1937 @@
+/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.48 1999/08/28 09:00:42 dawes Exp $ */
+
+/*
+
+Copyright 1995 Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
+OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Kaleb S. KEITHLEY
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+*/
+/* $TOG: xf86vmode.c /main/27 1998/02/09 15:25:44 kaleb $ */
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86VIDMODE_SERVER_
+#include "xf86vmstr.h"
+#include "swaprep.h"
+#include "xf86.h"
+#include "vidmodeproc.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+static int VidModeErrorBase;
+static int VidModeGeneration = 0;
+static int VidModeClientPrivateIndex;
+
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} VidModePrivRec, *VidModePrivPtr;
+
+#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
+
+static void XF86VidModeResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry* /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcXF86VidModeDispatch);
+static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(ProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(ProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(ProcXF86VidModeModModeLine);
+static DISPATCH_PROC(ProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(ProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(ProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(ProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(ProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(ProcXF86VidModeSetGamma);
+static DISPATCH_PROC(ProcXF86VidModeGetGamma);
+static DISPATCH_PROC(ProcXF86VidModeSetClientVersion);
+static DISPATCH_PROC(SProcXF86VidModeDispatch);
+static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(SProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(SProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(SProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(SProcXF86VidModeModModeLine);
+static DISPATCH_PROC(SProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(SProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(SProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(SProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(SProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(SProcXF86VidModeSetGamma);
+static DISPATCH_PROC(SProcXF86VidModeGetGamma);
+static DISPATCH_PROC(SProcXF86VidModeSetClientVersion);
+
+static unsigned char XF86VidModeReqCode = 0;
+
+
+/* The XF86VIDMODE_EVENTS code is far from complete */
+
+#ifdef XF86VIDMODE_EVENTS
+static int XF86VidModeEventBase = 0;
+
+static void SXF86VidModeNotifyEvent();
+ xXF86VidModeNotifyEvent * /* from */,
+ xXF86VidModeNotifyEvent * /* to */
+);
+
+extern WindowPtr *WindowTable;
+
+static RESTYPE EventType; /* resource type for event masks */
+
+typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
+
+typedef struct _XF86VidModeEvent {
+ XF86VidModeEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
+} XF86VidModeEventRec;
+
+static int XF86VidModeFreeEvents();
+
+typedef struct _XF86VidModeScreenPrivate {
+ XF86VidModeEventPtr events;
+ Bool hasWindow;
+} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
+
+static int ScreenPrivateIndex;
+
+#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
+#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
+#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
+
+#define New(t) (xalloc (sizeof (t)))
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+void
+XFree86VidModeExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+ ScreenPtr pScreen;
+ int i;
+ Bool enabled = FALSE;
+
+ DEBUG_P("XFree86VidModeExtensionInit");
+
+#ifdef XF86VIDMODE_EVENTS
+ EventType = CreateNewResourceType(XF86VidModeFreeEvents);
+ ScreenPrivateIndex = AllocateScreenPrivateIndex ();
+#endif
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (VidModeExtensionInit(pScreen))
+ enabled = TRUE;
+#ifdef XF86VIDMODE_EVENTS
+ SetScreenPrivate (pScreen, NULL);
+#endif
+ }
+ /* This means that the DDX doesn't want the vidmode extension enabled */
+ if (!enabled)
+ return;
+
+ /*
+ * Allocate a client private index to hold the client's version
+ * information.
+ */
+ if (VidModeGeneration != serverGeneration) {
+ VidModeClientPrivateIndex = AllocateClientPrivateIndex();
+ /*
+ * Allocate 0 length, and use the private to hold a pointer to our
+ * VidModePrivRec.
+ */
+ if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
+ ErrorF("XFree86VidModeExtensionInit: "
+ "AllocateClientPrivate failed\n");
+ return;
+ }
+ VidModeGeneration = serverGeneration;
+ }
+
+ if (
+#ifdef XF86VIDMODE_EVENTS
+ EventType && ScreenPrivateIndex != -1 &&
+#endif
+ (extEntry = AddExtension(XF86VIDMODENAME,
+ XF86VidModeNumberEvents,
+ XF86VidModeNumberErrors,
+ ProcXF86VidModeDispatch,
+ SProcXF86VidModeDispatch,
+ XF86VidModeResetProc,
+ StandardMinorOpcode))) {
+ XF86VidModeReqCode = (unsigned char)extEntry->base;
+ VidModeErrorBase = extEntry->errorBase;
+#ifdef XF86VIDMODE_EVENTS
+ XF86VidModeEventBase = extEntry->eventBase;
+ EventSwapVector[XF86VidModeEventBase] = SXF86VidModeNotifyEvent;
+#endif
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86VidModeResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+}
+
+static int
+ClientMajorVersion(ClientPtr client)
+{
+ VidModePrivPtr pPriv;
+
+ pPriv = VMPRIV(client);
+ if (!pPriv)
+ return 0;
+ else
+ return pPriv->major;
+}
+
+#ifdef XF86VIDMODE_EVENTS
+static void
+CheckScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (!pPriv)
+ return;
+ if (!pPriv->events && !pPriv->hasWindow) {
+ xfree (pPriv);
+ SetScreenPrivate (pScreen, NULL);
+ }
+}
+
+static XF86VidModeScreenPrivatePtr
+MakeScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (pPriv)
+ return pPriv;
+ pPriv = New (XF86VidModeScreenPrivateRec);
+ if (!pPriv)
+ return 0;
+ pPriv->events = 0;
+ pPriv->hasWindow = FALSE;
+ SetScreenPrivate (pScreen, pPriv);
+ return pPriv;
+}
+
+static unsigned long
+getEventMask (ScreenPtr pScreen, ClientPtr client)
+{
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv;
+
+ if (!pPriv)
+ return 0;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ if (pEv->client == client)
+ return pEv->mask;
+ return 0;
+}
+
+static Bool
+setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
+{
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
+
+ if (getEventMask (pScreen, client) == mask)
+ return TRUE;
+ if (!pPriv) {
+ pPriv = MakeScreenPrivate (pScreen);
+ if (!pPriv)
+ return FALSE;
+ }
+ for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv->client == client)
+ break;
+ if (mask == 0) {
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ } else {
+ if (!pEv) {
+ pEv = New (ScreenSaverEventRec);
+ if (!pEv) {
+ CheckScreenPrivate (pScreen);
+ return FALSE;
+ }
+ *pPrev = pEv;
+ pEv->next = NULL;
+ pEv->client = client;
+ pEv->screen = pScreen;
+ pEv->resource = FakeClientID (client->index);
+ }
+ pEv->mask = mask;
+ }
+ return TRUE;
+}
+
+static int
+XF86VidModeFreeEvents(pointer value, XID id)
+{
+ XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
+ ScreenPtr pScreen = pOld->screen;
+ SetupScreen (pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
+
+ if (!pPriv)
+ return TRUE;
+ for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv == pOld)
+ break;
+ if (!pEv)
+ return TRUE;
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ return TRUE;
+}
+
+static void
+SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
+{
+ XF86VidModeScreenPrivatePtr pPriv;
+ XF86VidModeEventPtr pEv;
+ unsigned long mask;
+ xXF86VidModeNotifyEvent ev;
+ ClientPtr client;
+ int kind;
+
+ UpdateCurrentTimeIf ();
+ mask = XF86VidModeNotifyMask;
+ pScreen = screenInfo.screens[pScreen->myNum];
+ pPriv = GetScreenPrivate(pScreen);
+ if (!pPriv)
+ return;
+ kind = XF86VidModeModeChange;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ {
+ client = pEv->client;
+ if (client->clientGone)
+ continue;
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = XF86VidModeNotify + XF86VidModeEventBase;
+ ev.state = state;
+ ev.sequenceNumber = client->sequence;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = WindowTable[pScreen->myNum]->drawable.id;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient (client, 1, (xEvent *) &ev);
+ }
+}
+
+static void
+SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
+ xXF86VidModeNotifyEvent *to)
+{
+ to->type = from->type;
+ to->state = from->state;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->timestamp, to->timestamp);
+ cpswapl (from->root, to->root);
+ to->kind = from->kind;
+ to->forced = from->forced;
+}
+#endif
+
+static int
+ProcXF86VidModeQueryVersion(ClientPtr client)
+{
+ xXF86VidModeQueryVersionReply rep;
+ register int n;
+
+ DEBUG_P("XF86VidModeQueryVersion");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
+ rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetModeLineReq);
+ xXF86VidModeGetModeLineReply rep;
+ xXF86OldVidModeGetModeLineReply oldrep;
+ pointer mode;
+ register int n;
+ int dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeGetModeline");
+
+ ver = ClientMajorVersion(client);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ rep.type = X_Reply;
+ if (ver < 2) {
+ rep.length = (SIZEOF(xXF86OldVidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ } else {
+ rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ }
+ rep.sequenceNumber = client->sequence;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ rep.dotclock = dotClock;
+ rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("GetModeLine - scrn: %d clock: %d\n",
+ stuff->screen, rep.dotclock);
+ ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ rep.hdisplay, rep.hsyncstart,
+ rep.hsyncend, rep.htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ rep.vdisplay, rep.vsyncstart, rep.vsyncend,
+ rep.vtotal, rep.flags);
+ }
+
+ /*
+ * Older servers sometimes had server privates that the VidMode
+ * extention made available. So to be compatiable pretend that
+ * there are no server privates to pass to the client
+ */
+ rep.privsize = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.dotclock, n);
+ swaps(&rep.hdisplay, n);
+ swaps(&rep.hsyncstart, n);
+ swaps(&rep.hsyncend, n);
+ swaps(&rep.htotal, n);
+ swaps(&rep.hskew, n);
+ swaps(&rep.vdisplay, n);
+ swaps(&rep.vsyncstart, n);
+ swaps(&rep.vsyncend, n);
+ swaps(&rep.vtotal, n);
+ swapl(&rep.flags, n);
+ swapl(&rep.privsize, n);
+ }
+ if (ver < 2) {
+ oldrep.type = rep.type;
+ oldrep.sequenceNumber = rep.sequenceNumber;
+ oldrep.length = rep.length;
+ oldrep.dotclock = rep.dotclock;
+ oldrep.hdisplay = rep.hdisplay;
+ oldrep.hsyncstart = rep.hsyncstart;
+ oldrep.hsyncend = rep.hsyncend;
+ oldrep.htotal = rep.htotal;
+ oldrep.vdisplay = rep.vdisplay;
+ oldrep.vsyncstart = rep.vsyncstart;
+ oldrep.vsyncend = rep.vsyncend;
+ oldrep.vtotal = rep.vtotal;
+ oldrep.flags = rep.flags;
+ oldrep.privsize = rep.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
+ (char *)&oldrep);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
+ (char *)&rep);
+ }
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetAllModeLinesReq);
+ xXF86VidModeGetAllModeLinesReply rep;
+ xXF86VidModeModeInfo mdinf;
+ xXF86OldVidModeModeInfo oldmdinf;
+ pointer mode;
+ int modecount, dotClock;
+ register int n;
+ int ver;
+
+ DEBUG_P("XF86VidModeGetAllModelines");
+
+ ver = ClientMajorVersion(client);
+
+ modecount = VidModeGetNumOfModes(stuff->screen);
+ if (modecount < 1)
+ return (VidModeErrorBase + XF86VidModeExtensionDisabled);
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ rep.type = X_Reply;
+ rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+ SIZEOF(xGenericReply);
+ if (ver < 2)
+ rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+ else
+ rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+ rep.length >>= 2;
+ rep.sequenceNumber = client->sequence;
+ rep.modecount = modecount;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.modecount, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
+
+ do {
+ mdinf.dotclock = dotClock;
+ mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+ mdinf.privsize = 0;
+ if (client->swapped) {
+ swapl(&mdinf.dotclock, n);
+ swaps(&mdinf.hdisplay, n);
+ swaps(&mdinf.hsyncstart, n);
+ swaps(&mdinf.hsyncend, n);
+ swaps(&mdinf.htotal, n);
+ swaps(&mdinf.hskew, n);
+ swaps(&mdinf.vdisplay, n);
+ swaps(&mdinf.vsyncstart, n);
+ swaps(&mdinf.vsyncend, n);
+ swaps(&mdinf.vtotal, n);
+ swapl(&mdinf.flags, n);
+ swapl(&mdinf.privsize, n);
+ }
+ if (ver < 2) {
+ oldmdinf.dotclock = mdinf.dotclock;
+ oldmdinf.hdisplay = mdinf.hdisplay;
+ oldmdinf.hsyncstart = mdinf.hsyncstart;
+ oldmdinf.hsyncend = mdinf.hsyncend;
+ oldmdinf.htotal = mdinf.htotal;
+ oldmdinf.vdisplay = mdinf.vdisplay;
+ oldmdinf.vsyncstart = mdinf.vsyncstart;
+ oldmdinf.vsyncend = mdinf.vsyncend;
+ oldmdinf.vtotal = mdinf.vtotal;
+ oldmdinf.flags = mdinf.flags;
+ oldmdinf.privsize = mdinf.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
+ (char *)&oldmdinf);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
+ }
+
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return (client->noClientException);
+}
+
+#define MODEMATCH(mode,stuff) \
+ (VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
+ && VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
+ && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
+
+static int
+ProcXF86VidModeAddModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeAddModeLineReq);
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ xXF86VidModeAddModeLineReq newstuff;
+ pointer mode;
+ int len;
+ int dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeAddModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ stuff->after_dotclock = oldstuff->after_dotclock;
+ stuff->after_hdisplay = oldstuff->after_hdisplay;
+ stuff->after_hsyncstart = oldstuff->after_hsyncstart;
+ stuff->after_hsyncend = oldstuff->after_hsyncend;
+ stuff->after_htotal = oldstuff->after_htotal;
+ stuff->after_hskew = 0;
+ stuff->after_vdisplay = oldstuff->after_vdisplay;
+ stuff->after_vsyncstart = oldstuff->after_vsyncstart;
+ stuff->after_vsyncend = oldstuff->after_vsyncend;
+ stuff->after_vtotal = oldstuff->after_vtotal;
+ stuff->after_flags = oldstuff->after_flags;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("AddModeLine - scrn: %d clock: %d\n",
+ stuff->screen, stuff->dotclock);
+ ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ ErrorF(" after - scrn: %d clock: %d\n",
+ stuff->screen, stuff->after_dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->after_hdisplay, stuff->after_hsyncstart,
+ stuff->after_hsyncend, stuff->after_htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->after_vdisplay, stuff->after_vsyncstart,
+ stuff->after_vsyncend, stuff->after_vtotal, stuff->after_flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeAddModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ return BadValue;
+
+ if (stuff->after_hsyncstart < stuff->after_hdisplay ||
+ stuff->after_hsyncend < stuff->after_hsyncstart ||
+ stuff->after_htotal < stuff->after_hsyncend ||
+ stuff->after_vsyncstart < stuff->after_vdisplay ||
+ stuff->after_vsyncend < stuff->after_vsyncstart ||
+ stuff->after_vtotal < stuff->after_vsyncend)
+ return BadValue;
+
+ if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
+ Bool found = FALSE;
+ if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
+ do {
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
+ == dotClock) && MODEMATCH(mode, stuff)) {
+ found = TRUE;
+ break;
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ }
+ if (!found)
+ return BadValue;
+ }
+
+
+ mode = VidModeCreateMode();
+ if (mode == NULL)
+ return BadValue;
+
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("AddModeLine - Privates in request have been ignored\n");
+
+ if (!VidModeCheckModeClock(stuff->screen, mode, stuff->dotclock)) {
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadClock;
+ }
+
+ /* Check that the mode is consistent with the monitor specs */
+ switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ /* Check that the driver is happy with the mode */
+ if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ VidModeSetCrtcForMode(stuff->screen, mode);
+
+ VidModeAddModeline(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("AddModeLine - Succeeded\n");
+ return client->noClientException;
+}
+
+static int
+ProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ xXF86VidModeDeleteModeLineReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeDeleteModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("DeleteModeLine - scrn: %d clock: %d\n",
+ stuff->screen, stuff->dotclock, stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeDeleteModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize) {
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("req_len = %d, sizeof(Req) = %d, privsize = %d, len = %d, length = %d\n",
+ client->req_len, sizeof(xXF86VidModeDeleteModeLineReq)>>2, stuff->privsize, len, stuff->length);
+ }
+ return BadLength;
+ }
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff))
+ return BadValue;
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+ VidModeDeleteModeline(stuff->screen, mode);
+ if (xf86GetVerbosity())
+ ErrorF("DeleteModeLine - Succeeded\n");
+ return(client->noClientException);
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return BadValue;
+}
+
+static int
+ProcXF86VidModeModModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeModModeLineReq);
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ xXF86VidModeModModeLineReq newstuff;
+ pointer mode, modetmp;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeModModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2 ) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->screen, stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeModModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("ModModeLine - Privates in request have been ignored\n");
+
+ /* Check that the mode is consistent with the monitor specs */
+ switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ /* Check that the driver is happy with the mode */
+ if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ VidModeSetCrtcForMode(stuff->screen, mode);
+ VidModeSwitchMode(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("ModModeLine - Succeeded\n");
+ return(client->noClientException);
+}
+
+static int
+ProcXF86VidModeValidateModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ xXF86VidModeValidateModeLineReq newstuff;
+ xXF86VidModeValidateModeLineReply rep;
+ pointer mode, modetmp;
+ int len, status, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeValidateModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("ValidateModeLine - scrn: %d clock: %d\n",
+ stuff->screen, stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ len = client->req_len -
+ (sizeof(xXF86OldVidModeValidateModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ status = MODE_OK;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ {
+ status = MODE_BAD;
+ goto status_reply;
+ }
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+ if (stuff->privsize)
+ ErrorF("ValidateModeLine - Privates in request have been ignored\n");
+
+ if (!VidModeCheckModeClock(stuff->screen, modetmp, stuff->dotclock)) {
+ status = MODE_BAD;
+ goto status_reply;
+ }
+
+ /* Check that the mode is consistent with the monitor specs */
+ if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
+ goto status_reply;
+
+ /* Check that the driver is happy with the mode */
+ status = VidModeCheckModeForDriver(stuff->screen, modetmp);
+
+status_reply:
+ rep.type = X_Reply;
+ rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply)
+ - SIZEOF(xGenericReply)) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.status = status;
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
+ if (xf86GetVerbosity() > 1)
+ ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
+ return(client->noClientException);
+}
+
+static int
+ProcXF86VidModeSwitchMode(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSwitchModeReq);
+
+ DEBUG_P("XF86VidModeSwitchMode");
+
+ VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSwitchToMode(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSwitchToModeReq);
+ xXF86OldVidModeSwitchToModeReq *oldstuff =
+ (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
+ xXF86VidModeSwitchToModeReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeSwitchToMode");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("SwitchToMode - scrn: %d clock: %d\n",
+ stuff->screen, stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeSwitchToModeReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
+ && MODEMATCH(mode, stuff))
+ return (client->noClientException);
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > 1) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+
+ if (!VidModeSwitchMode(stuff->screen, mode))
+ return BadValue;
+
+ if (xf86GetVerbosity() > 1)
+ ErrorF("SwitchToMode - Succeeded\n");
+ return(client->noClientException);
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return BadValue;
+}
+
+static int
+ProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
+ REQUEST(xXF86VidModeLockModeSwitchReq);
+
+ REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
+
+ DEBUG_P("XF86VidModeLockModeSwitch");
+
+ if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
+ return VidModeErrorBase + XF86VidModeZoomLocked;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetMonitor(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetMonitorReq);
+ xXF86VidModeGetMonitorReply rep;
+ register int n;
+ CARD32 *hsyncdata, *vsyncdata;
+ int i, nHsync, nVrefresh;
+ pointer monitor;
+
+ DEBUG_P("XF86VidModeGetMonitor");
+
+ if (!VidModeGetMonitor(stuff->screen, &monitor))
+ return BadValue;
+
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+
+ nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0);
+ nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0);
+
+ rep.type = X_Reply;
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)))
+ rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VENDOR, 0)));
+ else
+ rep.vendorLength = 0;
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)))
+ rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_MODEL, 0)));
+ else
+ rep.modelLength = 0;
+ rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
+ (nHsync + nVrefresh) * sizeof(CARD32) +
+ ((rep.vendorLength + 3) & ~3) +
+ ((rep.modelLength + 3) & ~3)) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.nhsync = nHsync;
+ rep.nvsync = nVrefresh;
+ hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32));
+ if (!hsyncdata) {
+ return BadAlloc;
+ }
+
+ vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32));
+ if (!vsyncdata) {
+ DEALLOCATE_LOCAL(hsyncdata);
+ return BadAlloc;
+ }
+
+ for (i = 0; i < nHsync; i++) {
+ hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_LO, i)) |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_HI, i)) << 16;
+ }
+ for (i = 0; i < nVrefresh; i++) {
+ vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_LO, i)) |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_HI, i)) << 16;
+ }
+
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
+ hsyncdata);
+ WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
+ vsyncdata);
+ if (rep.vendorLength)
+ WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)));
+ if (rep.modelLength)
+ WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)));
+
+ DEALLOCATE_LOCAL(hsyncdata);
+ DEALLOCATE_LOCAL(vsyncdata);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetViewPortReq);
+ xXF86VidModeGetViewPortReply rep;
+ int x, y, n;
+
+ DEBUG_P("XF86VidModeGetViewPort");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ VidModeGetViewPort(stuff->screen, &x, &y);
+ rep.x = x;
+ rep.y = y;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.x, n);
+ swapl(&rep.y, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetViewPortReq);
+
+ DEBUG_P("XF86VidModeSetViewPort");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+
+ if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ xXF86VidModeGetDotClocksReply rep;
+ register int n;
+ int numClocks;
+ CARD32 dotclock;
+ int *Clocks = NULL;
+ Bool ClockProg;
+
+ DEBUG_P("XF86VidModeGetDotClocks");
+
+ numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ rep.type = X_Reply;
+ rep.length = (SIZEOF(xXF86VidModeGetDotClocksReply)
+ - SIZEOF(xGenericReply) + numClocks) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.clocks = numClocks;
+ rep.maxclocks = MAXCLOCKS;
+ rep.flags = 0;
+
+ if (!ClockProg) {
+ Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int));
+ if (!Clocks)
+ return BadValue;
+ if (!VidModeGetClocks(stuff->screen, Clocks)) {
+ DEALLOCATE_LOCAL(Clocks);
+ return BadValue;
+ }
+ }
+
+ if (ClockProg) {
+ rep.flags |= CLKFLAG_PROGRAMABLE;
+ }
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.clocks, n);
+ swapl(&rep.maxclocks, n);
+ swapl(&rep.flags, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
+ if (!ClockProg) {
+ for (n = 0; n < numClocks; n++) {
+ dotclock = *Clocks++;
+ if (client->swapped) {
+ WriteSwappedDataToClient(client, 4, (char *)&dotclock);
+ } else {
+ WriteToClient(client, 4, (char *)&dotclock);
+ }
+ }
+ }
+
+ DEALLOCATE_LOCAL(Clocks);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetGammaReq);
+
+ DEBUG_P("XF86VidModeSetGamma");
+
+ if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
+ ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetGammaReq);
+ xXF86VidModeGetGammaReply rep;
+ register int n;
+ float red, green, blue;
+
+ DEBUG_P("XF86VidModeGetGamma");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
+ return BadValue;
+ rep.red = (CARD32)(red * 10000.);
+ rep.green = (CARD32)(green * 10000.);
+ rep.blue = (CARD32)(blue * 10000.);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.red, n);
+ swapl(&rep.green, n);
+ swapl(&rep.blue, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetClientVersionReq);
+
+ VidModePrivPtr pPriv;
+
+ DEBUG_P("XF86VidModeSetClientVersion");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+
+ if ((pPriv = VMPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(VidModePrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ VMPRIV(client) = pPriv;
+ }
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86VidModeQueryVersion:
+ return ProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:
+ return ProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetAllModeLines:
+ return ProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeGetMonitor:
+ return ProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeValidateModeLine:
+ return ProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetViewPort:
+ return ProcXF86VidModeGetViewPort(client);
+ default:
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return ProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:
+ return ProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:
+ return ProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:
+ return ProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:
+ return ProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:
+ return ProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:
+ return ProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeGetDotClocks:
+ return ProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetGamma:
+ return ProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeGetGamma:
+ return ProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeSetClientVersion:
+ return ProcXF86VidModeSetClientVersion(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
+ }
+}
+
+static int
+SProcXF86VidModeQueryVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86VidModeQueryVersion(client);
+}
+
+static int
+SProcXF86VidModeGetModeLine(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetModeLineReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetModeLine(client);
+}
+
+static int
+SProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetAllModeLinesReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetAllModeLines(client);
+}
+
+static int
+SProcXF86VidModeAddModeLine(ClientPtr client)
+{
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeAddModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeAddModeLine(client);
+}
+
+static int
+SProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeDeleteModeLine(client);
+}
+
+static int
+SProcXF86VidModeModModeLine(ClientPtr client)
+{
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeModModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeModModeLine(client);
+}
+
+static int
+SProcXF86VidModeValidateModeLine(ClientPtr client)
+{
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeValidateModeLine(client);
+}
+
+static int
+SProcXF86VidModeSwitchMode(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSwitchModeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
+ swaps(&stuff->screen, n);
+ swaps(&stuff->zoom, n);
+ return ProcXF86VidModeSwitchMode(client);
+}
+
+static int
+SProcXF86VidModeSwitchToMode(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSwitchToModeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeSwitchToMode(client);
+}
+
+static int
+SProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeLockModeSwitchReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
+ swaps(&stuff->screen, n);
+ swaps(&stuff->lock, n);
+ return ProcXF86VidModeLockModeSwitch(client);
+}
+
+static int
+SProcXF86VidModeGetMonitor(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetMonitorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetMonitor(client);
+}
+
+static int
+SProcXF86VidModeGetViewPort(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetViewPortReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetViewPort(client);
+}
+
+static int
+SProcXF86VidModeSetViewPort(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetViewPortReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->x, n);
+ swapl(&stuff->y, n);
+ return ProcXF86VidModeSetViewPort(client);
+}
+
+static int
+SProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetDotClocks(client);
+}
+
+static int
+SProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->major, n);
+ swaps(&stuff->minor, n);
+ return ProcXF86VidModeSetClientVersion(client);
+}
+
+static int
+SProcXF86VidModeSetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->red, n);
+ swapl(&stuff->green, n);
+ swapl(&stuff->blue, n);
+ return ProcXF86VidModeSetGamma(client);
+}
+
+static int
+SProcXF86VidModeGetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGamma(client);
+}
+
+static int
+SProcXF86VidModeDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86VidModeQueryVersion:
+ return SProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:
+ return SProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetAllModeLines:
+ return SProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeGetMonitor:
+ return SProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetViewPort:
+ return SProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeValidateModeLine:
+ return SProcXF86VidModeValidateModeLine(client);
+ default:
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return SProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:
+ return SProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:
+ return SProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:
+ return SProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:
+ return SProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:
+ return SProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:
+ return SProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeGetDotClocks:
+ return SProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetGamma:
+ return SProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeGetGamma:
+ return SProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeSetClientVersion:
+ return SProcXF86VidModeSetClientVersion(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/xprint.c b/xc/programs/Xserver/Xext/xprint.c
new file mode 100644
index 000000000..bc4017894
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xprint.c
@@ -0,0 +1,2874 @@
+/* $XConsortium: xprint.c /main/5 1996/12/30 18:39:20 kaleb $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: xprint.c
+** *
+** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company
+** *
+** * Copyright 1989 by The Massachusetts Institute of Technology
+** *
+** * Permission to use, copy, modify, and distribute this
+** * software and its documentation for any purpose and without
+** * fee is hereby granted, provided that the above copyright
+** * notice appear in all copies and that both that copyright
+** * notice and this permission notice appear in supporting
+** * documentation, and that the name of MIT not be used in
+** * advertising or publicity pertaining to distribution of the
+** * software without specific prior written permission.
+** * M.I.T. makes no representation about the suitability of
+** * this software for any purpose. It is provided "as is"
+** * without any express or implied warranty.
+** *
+** * MIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+** * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+** * NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MIT BE LI-
+** * ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+** * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+** * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+** * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+** * THE USE OR PERFORMANCE OF THIS SOFTWARE.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xprint.c,v 1.6 1998/12/20 11:57:24 dawes Exp $ */
+
+#include "X.h"
+#include "Xos.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#undef NEED_EVENTS
+#include "misc.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "Xatom.h"
+#define _XP_PRINT_SERVER_
+#include "Print.h"
+#include "Printstr.h"
+#undef _XP_PRINT_SERVER_
+#include "../Xprint/DiPrint.h"
+
+extern WindowPtr *WindowTable; /* declared in dix:globals.c */
+
+extern WindowPtr XpDiValidatePrinter();
+extern char *XpDiGetDriverName();
+extern char *XpGetAttributes();
+extern char *XpGetOneAttribute();
+extern int XpRehashPrinterList();
+extern void XpSetFontResFunc();
+
+static void XpResetProc();
+
+static int ProcXpDispatch();
+static int ProcXpSwappedDispatch();
+
+static int ProcXpQueryVersion();
+static int ProcXpGetPrinterList();
+static int ProcXpCreateContext();
+static int ProcXpSetContext();
+static int ProcXpGetContext();
+static int ProcXpDestroyContext();
+static int ProcXpGetContextScreen();
+static int ProcXpStartJob();
+static int ProcXpEndJob();
+static int ProcXpStartDoc();
+static int ProcXpEndDoc();
+static int ProcXpStartPage();
+static int ProcXpEndPage();
+static int ProcXpSelectInput();
+static int ProcXpInputSelected();
+static int ProcXpPutDocumentData();
+static int ProcXpGetDocumentData();
+static int ProcXpGetAttributes();
+static int ProcXpGetOneAttribute();
+static int ProcXpSetAttributes();
+static int ProcXpRehashPrinterList();
+static int ProcXpQueryScreens();
+static int ProcXpGetPageDimensions();
+static int ProcXpSetImageResolution();
+static int ProcXpGetImageResolution();
+
+static void SwapXpNotifyEvent();
+static void SwapXpAttributeEvent();
+
+static int SProcXpGetPrinterList();
+static int SProcXpCreateContext();
+static int SProcXpSetContext();
+static int SProcXpGetContext();
+static int SProcXpDestroyContext();
+static int SProcXpGetContextScreen();
+static int SProcXpStartJob();
+static int SProcXpEndJob();
+static int SProcXpStartDoc();
+static int SProcXpEndDoc();
+static int SProcXpStartPage();
+static int SProcXpEndPage();
+static int SProcXpSelectInput();
+static int SProcXpInputSelected();
+static int SProcXpPutDocumentData();
+static int SProcXpGetDocumentData();
+static int SProcXpGetAttributes();
+static int SProcXpGetOneAttribute();
+static int SProcXpSetAttributes();
+static int SProcXpRehashPrinterList();
+static int SProcXpGetPageDimensions();
+static int SProcXpSetImageResolution();
+static int SProcXpGetImageResolution();
+
+static void SendXpNotify();
+static void SendAttributeNotify();
+static int XpFreeClient();
+static int XpFreeContext();
+static int XpFreePage();
+static int XpFreeEvents();
+static Bool XpCloseScreen();
+static CARD32 GetAllEventMasks();
+static struct _XpEvent *AddEventRec();
+static void DeleteEventRec();
+static struct _XpEvent *FindEventRec();
+static struct _XpClient *CreateXpClient();
+static void FreeXpClient();
+static void InitContextPrivates();
+static void ResetContextPrivates();
+static struct _XpClient *FindClient();
+static struct _XpClient *AcquireClient();
+
+typedef struct _driver {
+ struct _driver *next;
+ char *name;
+ int (* CreateContext)();
+} XpDriverRec, *XpDriverPtr;
+
+typedef struct _xpScreen {
+ Bool (* CloseScreen)();
+ struct _driver *drivers;
+} XpScreenRec, *XpScreenPtr;
+
+/*
+ * Each context has a list of XpClients indicating which clients have
+ * associated this context with their connection.
+ * Each such client has a RTclient resource allocated for it,
+ * and this per-client
+ * resource is used to delete the XpClientRec if/when the client closes
+ * its connection.
+ * The list of XpClients is also walked if/when the context is destroyed
+ * so that the ContextPtr can be removed from the client's devPrivates.
+ */
+typedef struct _XpClient {
+ struct _XpClient *pNext;
+ ClientPtr client;
+ XpContextPtr context;
+ CARD32 eventMask;
+ XID contextClientID; /* unneeded sanity check? */
+} XpClientRec, *XpClientPtr;
+
+/*
+ * Each StartPage request specifies a window which forms the top level
+ * window of the page. One of the following structs is created as a
+ * RTpage resource with the same ID as the window itself. This enables
+ * us to clean up when/if the window is destroyed, and to prevent the
+ * same window from being simultaneously referenced in multiple contexts.
+ * The page resource is created at the first StartPage on a given window,
+ * and is only destroyed when/if the window is destroyed. When the
+ * EndPage is recieved (or an EndDoc or EndJob) the context field is
+ * set to NULL, but the resource remains alive.
+ */
+typedef struct _XpPage {
+ XpContextPtr context;
+} XpPageRec, *XpPagePtr;
+
+typedef struct _XpStPageRec {
+ XpContextPtr pContext;
+ Bool slept;
+ XpPagePtr pPage;
+ WindowPtr pWin;
+} XpStPageRec, *XpStPagePtr;
+
+typedef struct _XpStDocRec {
+ XpContextPtr pContext;
+ Bool slept;
+ CARD8 type;
+} XpStDocRec, *XpStDocPtr;
+
+#define QUADPAD(x) ((((x)+3)>>2)<<2)
+
+/*
+ * Possible bit-mask values in the "state" field of a XpContextRec.
+ */
+#define JOB_STARTED (1 << 0)
+#define DOC_RAW_STARTED (1 << 1)
+#define DOC_COOKED_STARTED (1 << 2)
+#define PAGE_STARTED (1 << 3)
+#define GET_DOC_DATA_STARTED (1 << 4)
+#define JOB_GET_DATA (1 << 5)
+
+static XpScreenPtr XpScreens[MAXSCREENS];
+static unsigned char XpReqCode;
+static int XpEventBase;
+static int XpErrorBase;
+static int XpGeneration = 0;
+static int XpWindowPrivateIndex;
+static int XpClientPrivateIndex;
+
+/* Variables for the context private machinery.
+ * These must be initialized at compile time because
+ * main() calls InitOutput before InitExtensions, and the
+ * output drivers are likely to call AllocateContextPrivate.
+ * These variables are reset at CloseScreen time. CloseScreen
+ * is used because it occurs after FreeAllResources, and before
+ * the next InitOutput cycle.
+ */
+static int contextPrivateCount = 0;
+static int contextPrivateLen = 0;
+static unsigned *contextPrivateSizes = (unsigned *)NULL;
+static unsigned totalContextSize = sizeof(XpContextRec);
+
+/*
+ * There are three types of resources involved. One is the resource associated
+ * with the context itself, with an ID specified by a printing client. The
+ * next is a resource created by us on the client's behalf (and unknown to
+ * the client) when a client inits or sets a context which allows us to
+ * track each client's interest in events
+ * on a particular context, and also allows us to clean up this interest
+ * record when/if the client's connection is closed. Finally, there is
+ * a resource created for each window that's specified in a StartPage. This
+ * resource carries the same ID as the window itself, and enables us to
+ * easily prevent the same window being referenced in multiple contexts
+ * simultaneously, and enables us to clean up if the window is destroyed
+ * before the EndPage.
+ */
+static RESTYPE RTclient, RTcontext, RTpage;
+
+/*
+ * allEvents is the OR of all the legal event mask bits.
+ */
+static CARD32 allEvents = XPPrintMask | XPAttributeMask;
+
+
+/*******************************************************************************
+ *
+ * ExtensionInit, Driver Init functions, QueryVersion, and Dispatch procs
+ *
+ ******************************************************************************/
+
+/*
+ * XpExtensionInit
+ *
+ * Called from InitExtensions in main() usually through miinitextension
+ *
+ */
+
+void
+XpExtensionInit()
+{
+ ExtensionEntry *extEntry, *AddExtension();
+ int i;
+
+ RTclient = CreateNewResourceType(XpFreeClient);
+ RTcontext = CreateNewResourceType(XpFreeContext);
+ RTpage = CreateNewResourceType(XpFreePage);
+ if (RTclient && RTcontext && RTpage &&
+ (extEntry = AddExtension(XP_PRINTNAME, XP_EVENTS, XP_ERRORS,
+ ProcXpDispatch, ProcXpSwappedDispatch,
+ XpResetProc, StandardMinorOpcode)))
+ {
+ XpReqCode = (unsigned char)extEntry->base;
+ XpEventBase = extEntry->eventBase;
+ XpErrorBase = extEntry->errorBase;
+ EventSwapVector[XpEventBase] = SwapXpNotifyEvent;
+ EventSwapVector[XpEventBase+1] = SwapXpAttributeEvent;
+ }
+
+ if(XpGeneration != serverGeneration)
+ {
+ XpClientPrivateIndex = AllocateClientPrivateIndex();
+ /*
+ * We allocate 0 length & simply stuff a pointer to the
+ * ContextRec in the DevUnion.
+ */
+ if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE)
+ {
+ /* we can't alloc a client private, should we bail??? XXX */
+ }
+ XpGeneration = serverGeneration;
+ }
+
+ for(i = 0; i < MAXSCREENS; i++)
+ {
+ /*
+ * If a screen has registered with our extension, then we
+ * wrap the screen's CloseScreen function to allow us to
+ * reset our ContextPrivate stuff. Note that this
+ * requires a printing DDX to call XpRegisterInitFunc
+ * _before_ this extension is initialized - i.e. at screen init
+ * time, _not_ at root window creation time.
+ */
+ if(XpScreens[i] != (XpScreenPtr)NULL)
+ {
+ XpScreens[i]->CloseScreen = screenInfo.screens[i]->CloseScreen;
+ screenInfo.screens[i]->CloseScreen = XpCloseScreen;
+ }
+ }
+ DeclareExtensionSecurity(XP_PRINTNAME, TRUE);
+}
+
+static void
+XpResetProc(extEntry)
+ ExtensionEntry extEntry;
+{
+ int i;
+
+ /*
+ * We can't free up the XpScreens recs here, because extensions are
+ * closed before screens, and our CloseScreen function uses the XpScreens
+ * recs.
+ for(i = 0; i < MAXSCREENS; i++)
+ {
+ if(XpScreens[i] != (XpScreenPtr)NULL)
+ Xfree(XpScreens[i]);
+ XpScreens[i] = (XpScreenPtr)NULL;
+ }
+ */
+}
+
+static Bool
+XpCloseScreen(index, pScreen)
+ int index;
+ ScreenPtr pScreen;
+{
+ Bool (* CloseScreen)();
+
+ CloseScreen = XpScreens[index]->CloseScreen;
+ if(XpScreens[index] != (XpScreenPtr)NULL)
+ {
+ XpDriverPtr pDriv, nextDriv;
+
+ pDriv = XpScreens[index]->drivers;
+ while(pDriv != (XpDriverPtr)NULL)
+ {
+ nextDriv = pDriv->next;
+ Xfree(pDriv);
+ pDriv = nextDriv;
+ }
+ Xfree(XpScreens[index]);
+ }
+ XpScreens[index] = (XpScreenPtr)NULL;
+
+ /*
+ * It's wasteful to call ResetContextPrivates() at every CloseScreen,
+ * but it's the best we know how to do for now. We do this because we
+ * have to wait until after all resources have been freed (so we know
+ * how to free the ContextRecs), and before the next InitOutput cycle.
+ * See dix/main.c for the order of initialization and reset.
+ */
+ ResetContextPrivates();
+ return (*CloseScreen)(index, pScreen);
+}
+
+static void
+FreeScreenEntry(pScreenEntry)
+ XpScreenPtr pScreenEntry;
+{
+ XpDriverPtr pDriver;
+
+ pDriver = pScreenEntry->drivers;
+ while(pDriver != (XpDriverPtr)NULL)
+ {
+ XpDriverPtr tmp;
+
+ tmp = pDriver->next;
+ xfree(pDriver);
+ pDriver = tmp;
+ }
+ xfree(pScreenEntry);
+}
+
+/*
+ * XpRegisterInitFunc tells the print extension which screens
+ * are printers as opposed to displays, and what drivers are
+ * supported on each screen. This eliminates the need of
+ * allocating print-related private structures on windows on _all_ screens.
+ * It also hands the extension a pointer to the routine to be called
+ * whenever a context gets created for a particular driver on this screen.
+ */
+void
+XpRegisterInitFunc(pScreen, driverName, initContext)
+ ScreenPtr pScreen;
+ char *driverName;
+ int (*initContext)();
+{
+ XpDriverPtr pDriver;
+
+ if(XpScreens[pScreen->myNum] == (XpScreenPtr)NULL)
+ {
+ if((XpScreens[pScreen->myNum] =
+ (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == (XpScreenPtr)NULL)
+ return;
+ XpScreens[pScreen->myNum]->CloseScreen = (Bool(*)())NULL;
+ XpScreens[pScreen->myNum]->drivers = (XpDriverPtr)NULL;
+ }
+
+ if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) ==
+ (XpDriverPtr)NULL)
+ return;
+ pDriver->next = XpScreens[pScreen->myNum]->drivers;
+ pDriver->name = driverName;
+ pDriver->CreateContext = initContext;
+ XpScreens[pScreen->myNum]->drivers = pDriver;
+}
+
+static int
+ProcXpDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+ switch(stuff->data)
+ {
+ case X_PrintQueryVersion:
+ return ProcXpQueryVersion(client);
+ case X_PrintGetPrinterList:
+ return ProcXpGetPrinterList(client);
+ case X_PrintCreateContext:
+ return ProcXpCreateContext(client);
+ case X_PrintSetContext:
+ return ProcXpSetContext(client);
+ case X_PrintGetContext:
+ return ProcXpGetContext(client);
+ case X_PrintDestroyContext:
+ return ProcXpDestroyContext(client);
+ case X_PrintGetContextScreen:
+ return ProcXpGetContextScreen(client);
+ case X_PrintStartJob:
+ return ProcXpStartJob(client);
+ case X_PrintEndJob:
+ return ProcXpEndJob(client);
+ case X_PrintStartDoc:
+ return ProcXpStartDoc(client);
+ case X_PrintEndDoc:
+ return ProcXpEndDoc(client);
+ case X_PrintStartPage:
+ return ProcXpStartPage(client);
+ case X_PrintEndPage:
+ return ProcXpEndPage(client);
+ case X_PrintSelectInput:
+ return ProcXpSelectInput(client);
+ case X_PrintInputSelected:
+ return ProcXpInputSelected(client);
+ case X_PrintPutDocumentData:
+ return ProcXpPutDocumentData(client);
+ case X_PrintGetDocumentData:
+ return ProcXpGetDocumentData(client);
+ case X_PrintSetAttributes:
+ return ProcXpSetAttributes(client);
+ case X_PrintGetAttributes:
+ return ProcXpGetAttributes(client);
+ case X_PrintGetOneAttribute:
+ return ProcXpGetOneAttribute(client);
+ case X_PrintRehashPrinterList:
+ return ProcXpRehashPrinterList(client);
+ case X_PrintQueryScreens:
+ return ProcXpQueryScreens(client);
+ case X_PrintGetPageDimensions:
+ return ProcXpGetPageDimensions(client);
+ case X_PrintSetImageResolution:
+ return ProcXpSetImageResolution(client);
+ case X_PrintGetImageResolution:
+ return ProcXpGetImageResolution(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+ProcXpSwappedDispatch(client)
+ ClientPtr client;
+{
+ int temp;
+ REQUEST(xReq);
+
+ switch(stuff->data)
+ {
+ case X_PrintQueryVersion:
+ swaps(&stuff->length, temp);
+ return ProcXpQueryVersion(client);
+ case X_PrintGetPrinterList:
+ return SProcXpGetPrinterList(client);
+ case X_PrintCreateContext:
+ return SProcXpCreateContext(client);
+ case X_PrintSetContext:
+ return SProcXpSetContext(client);
+ case X_PrintGetContext:
+ return SProcXpGetContext(client);
+ case X_PrintDestroyContext:
+ return SProcXpDestroyContext(client);
+ case X_PrintGetContextScreen:
+ return SProcXpGetContextScreen(client);
+ case X_PrintStartJob:
+ return SProcXpStartJob(client);
+ case X_PrintEndJob:
+ return SProcXpEndJob(client);
+ case X_PrintStartDoc:
+ return SProcXpStartDoc(client);
+ case X_PrintEndDoc:
+ return SProcXpEndDoc(client);
+ case X_PrintStartPage:
+ return SProcXpStartPage(client);
+ case X_PrintEndPage:
+ return SProcXpEndPage(client);
+ case X_PrintSelectInput:
+ return SProcXpSelectInput(client);
+ case X_PrintInputSelected:
+ return SProcXpInputSelected(client);
+ case X_PrintPutDocumentData:
+ return SProcXpPutDocumentData(client);
+ case X_PrintGetDocumentData:
+ return SProcXpGetDocumentData(client);
+ case X_PrintSetAttributes:
+ return SProcXpSetAttributes(client);
+ case X_PrintGetAttributes:
+ return SProcXpGetAttributes(client);
+ case X_PrintGetOneAttribute:
+ return SProcXpGetOneAttribute(client);
+ case X_PrintRehashPrinterList:
+ return SProcXpRehashPrinterList(client);
+ case X_PrintQueryScreens:
+ swaps(&stuff->length, temp);
+ return ProcXpQueryScreens(client);
+ case X_PrintGetPageDimensions:
+ return SProcXpGetPageDimensions(client);
+ case X_PrintSetImageResolution:
+ return SProcXpSetImageResolution(client);
+ case X_PrintGetImageResolution:
+ return SProcXpGetImageResolution(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+ProcXpQueryVersion(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintQueryVersionReq);
+ xPrintQueryVersionReply rep;
+ register int n;
+ long l;
+
+ REQUEST_SIZE_MATCH(xPrintQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XP_MAJOR_VERSION;
+ rep.minorVersion = XP_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sz_xPrintQueryVersionReply, (char *)&rep);
+ return client->noClientException;
+}
+
+/*******************************************************************************
+ *
+ * GetPrinterList : Return a list of all printers associated with this
+ * server. Calls XpDiGetPrinterList, which is defined in
+ * the device-independent code in Xserver/Xprint.
+ *
+ ******************************************************************************/
+
+static int
+ProcXpGetPrinterList(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetPrinterListReq);
+ int totalSize, numEntries;
+ XpDiListEntry **pList, *pEntry;
+ xPrintGetPrinterListReply *rep;
+ int n, i, totalBytes;
+ long l;
+ char *curByte;
+
+ REQUEST_AT_LEAST_SIZE(xPrintGetPrinterListReq);
+
+ totalSize = ((sz_xPrintGetPrinterListReq) >> 2) +
+ ((stuff->printerNameLen + 3) >> 2) +
+ ((stuff->localeLen + 3) >> 2);
+ if(totalSize != client->req_len)
+ return BadLength;
+
+ pList = XpDiGetPrinterList(stuff->printerNameLen, (char *)(stuff + 1),
+ stuff->localeLen, (char *)((stuff + 1) +
+ QUADPAD(stuff->printerNameLen)));
+
+ for(numEntries = 0, totalBytes = sz_xPrintGetPrinterListReply;
+ pList[numEntries] != (XpDiListEntry *)NULL;
+ numEntries++)
+ {
+ totalBytes += 2 * sizeof(CARD32);
+ totalBytes += QUADPAD(strlen(pList[numEntries]->name));
+ totalBytes += QUADPAD(strlen(pList[numEntries]->description));
+ }
+
+ if((rep = (xPrintGetPrinterListReply *)xalloc(totalBytes)) ==
+ (xPrintGetPrinterListReply *)NULL)
+ return BadAlloc;
+
+ rep->type = X_Reply;
+ rep->length = (totalBytes - sz_xPrintGetPrinterListReply) >> 2;
+ rep->sequenceNumber = client->sequence;
+ rep->listCount = numEntries;
+ if (client->swapped) {
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, l);
+ swapl(&rep->listCount, l);
+ }
+
+ for(i = 0, curByte = (char *)(rep + 1); i < numEntries; i++)
+ {
+ CARD32 *pCrd;
+ int len;
+
+ pCrd = (CARD32 *)curByte;
+ len = strlen(pList[i]->name);
+ *pCrd = len;
+ if (client->swapped)
+ swapl((long *)curByte, l);
+ curByte += sizeof(CARD32);
+ strncpy(curByte, pList[i]->name, len);
+ curByte += QUADPAD(len);
+
+ pCrd = (CARD32 *)curByte;
+ len = strlen(pList[i]->description);
+ *pCrd = len;
+ if (client->swapped)
+ swapl((long *)curByte, l);
+ curByte += sizeof(CARD32);
+ strncpy(curByte, pList[i]->description, len);
+ curByte += QUADPAD(len);
+ }
+
+ XpDiFreePrinterList(pList);
+
+ WriteToClient(client, totalBytes, (char *)rep);
+ xfree(rep);
+ return client->noClientException;
+}
+
+/*******************************************************************************
+ *
+ * QueryScreens: Returns the list of screens which are associated with
+ * print drivers.
+ *
+ ******************************************************************************/
+
+static int
+ProcXpQueryScreens(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintQueryScreensReq);
+ int i, numPrintScreens, totalSize;
+ WINDOW *pWinId;
+ xPrintQueryScreensReply *rep;
+ long l;
+
+ REQUEST_SIZE_MATCH(xPrintQueryScreensReq);
+
+ rep = (xPrintQueryScreensReply *)xalloc(sz_xPrintQueryScreensReply);
+ pWinId = (WINDOW *)(rep + 1);
+
+ for(i = 0, numPrintScreens = 0, totalSize = sz_xPrintQueryScreensReply;
+ i < MAXSCREENS; i++)
+ {
+ /*
+ * If a screen has registered with our extension, then it's
+ * a printer screen.
+ */
+ if(XpScreens[i] != (XpScreenPtr)NULL)
+ {
+ numPrintScreens++;
+ totalSize += sizeof(WINDOW);
+ rep = (xPrintQueryScreensReply *)xrealloc(rep, totalSize);
+ *pWinId = WindowTable[i]->drawable.id;
+ if (client->swapped)
+ swapl((long *)pWinId, l);
+ pWinId++;
+ }
+ }
+
+ rep->type = X_Reply;
+ rep->sequenceNumber = client->sequence;
+ rep->length = (totalSize - sz_xPrintQueryScreensReply) >> 2;
+ rep->listCount = numPrintScreens;
+ if (client->swapped)
+ {
+ int n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, l);
+ swapl(&rep->listCount, l);
+ }
+
+ WriteToClient(client, totalSize, (char *)rep);
+ xfree(rep);
+ return client->noClientException;
+}
+
+static int
+ProcXpGetPageDimensions(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetPageDimensionsReq);
+ CARD16 width, height;
+ xRectangle rect;
+ xPrintGetPageDimensionsReply rep;
+ XpContextPtr pContext;
+ int result;
+
+ REQUEST_SIZE_MATCH(xPrintGetPageDimensionsReq);
+
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(pContext->funcs.GetMediumDimensions != (int (*)())NULL)
+ result = pContext->funcs.GetMediumDimensions(pContext, &width, &height);
+ else
+ return BadImplementation;
+
+ if(pContext->funcs.GetReproducibleArea != (int (*)())NULL)
+ result = pContext->funcs.GetReproducibleArea(pContext, &rect);
+ else
+ return BadImplementation;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.width = width;
+ rep.height = height;
+ rep.rx = rect.x;
+ rep.ry = rect.y;
+ rep.rwidth = rect.width;
+ rep.rheight = rect.height;
+
+ if(client->swapped)
+ {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swaps(&rep.width, n);
+ swaps(&rep.height, n);
+ swaps(&rep.rx, n);
+ swaps(&rep.ry, n);
+ swaps(&rep.rwidth, n);
+ swaps(&rep.rheight, n);
+ }
+
+ WriteToClient(client, sz_xPrintGetPageDimensionsReply, (char *)&rep);
+ return client->noClientException;
+}
+
+static int
+ProcXpSetImageResolution(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintSetImageResolutionReq);
+ xPrintSetImageResolutionReply rep;
+ XpContextPtr pContext;
+ Bool status;
+ int result;
+
+ REQUEST_SIZE_MATCH(xPrintSetImageResolutionReq);
+
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityWriteAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ rep.prevRes = pContext->imageRes;
+ if(pContext->funcs.SetImageResolution != (int (*)())NULL)
+ result = pContext->funcs.SetImageResolution(pContext,
+ (int)stuff->imageRes,
+ &status);
+ else
+ status = FALSE;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+
+ if(client->swapped)
+ {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swaps(&rep.prevRes, n);
+ }
+
+ WriteToClient(client, sz_xPrintSetImageResolutionReply, (char *)&rep);
+ return client->noClientException;
+}
+
+static int
+ProcXpGetImageResolution(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetImageResolutionReq);
+ xPrintGetImageResolutionReply rep;
+ XpContextPtr pContext;
+ Bool status;
+ int result;
+
+ REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq);
+
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.imageRes = pContext->imageRes;
+
+ if(client->swapped)
+ {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swaps(&rep.imageRes, n);
+ }
+
+ WriteToClient(client, sz_xPrintGetImageResolutionReply, (char *)&rep);
+ return client->noClientException;
+}
+
+/*******************************************************************************
+ *
+ * RehashPrinterList : Cause the server's list of printers to be rebuilt.
+ * This allows new printers to be added, or old ones
+ * deleted without needing to restart the server.
+ *
+ ******************************************************************************/
+
+static int
+ProcXpRehashPrinterList(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintRehashPrinterListReq);
+
+ REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq);
+
+ return XpRehashPrinterList();
+}
+
+/******************************************************************************
+ *
+ * Context functions: Init, Set, Destroy, FreeContext
+ * AllocateContextPrivateIndex, AllocateContextPrivate
+ * and supporting functions.
+ *
+ * Init creates a context, creates a XpClientRec for the calling
+ * client, and stores the contextPtr in the client's devPrivates.
+ *
+ * Set creates a XpClientRec for the calling client, and stores the
+ * contextPtr in the client's devPrivates unless the context is None.
+ * If the context is None, then the client's connection association
+ * with any context is removed.
+ *
+ * Destroy frees any and all XpClientRecs associated with the context,
+ * frees the context itself, and removes the contextPtr from any
+ * relevant client devPrivates.
+ *
+ * FreeContext is called by FreeResource to free up a context.
+ *
+ ******************************************************************************/
+
+/*
+ * CreateContext creates and initializes the memory for the context itself.
+ * The driver's CreateContext function
+ * is then called.
+ */
+static int
+ProcXpCreateContext(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintCreateContextReq);
+ XpScreenPtr pPrintScreen;
+ WindowPtr pRoot;
+ char *printerName, *driverName;
+ XpContextPtr pContext;
+ XpClientPtr pNewPrintClient;
+ int result = Success;
+ XpDriverPtr pDriver;
+
+ REQUEST_AT_LEAST_SIZE(xPrintCreateContextReq);
+
+ LEGAL_NEW_RESOURCE(stuff->contextID, client);
+
+ /*
+ * Check to see if the printer name is valid.
+ */
+ if((pRoot = XpDiValidatePrinter(stuff + 1, stuff->printerNameLen)) ==
+ (WindowPtr)NULL)
+ return BadMatch;
+
+ pPrintScreen = XpScreens[pRoot->drawable.pScreen->myNum];
+
+ /*
+ * Allocate and add the context resource.
+ */
+ if((pContext = (XpContextPtr) xalloc(totalContextSize)) ==
+ (XpContextPtr) NULL)
+ return BadAlloc;
+
+ InitContextPrivates(pContext);
+
+ if(AddResource(stuff->contextID, RTcontext, (pointer) pContext)
+ != TRUE)
+ {
+ xfree(pContext);
+ return BadAlloc;
+ }
+
+ pContext->contextID = stuff->contextID;
+ pContext->clientHead = (XpClientPtr)NULL;
+ pContext->screenNum = pRoot->drawable.pScreen->myNum;
+ pContext->state = 0;
+ pContext->clientSlept = (ClientPtr)NULL;
+ pContext->imageRes = 0;
+
+ pContext->funcs.DestroyContext = (int (*)())NULL;
+ pContext->funcs.StartJob = (int (*)())NULL;
+ pContext->funcs.EndJob = (int (*)())NULL;
+ pContext->funcs.StartDoc = (int (*)())NULL;
+ pContext->funcs.EndDoc = (int (*)())NULL;
+ pContext->funcs.StartPage = (int (*)())NULL;
+ pContext->funcs.EndPage = (int (*)())NULL;
+ pContext->funcs.PutDocumentData = (int (*)())NULL;
+ pContext->funcs.GetDocumentData = (int (*)())NULL;
+ pContext->funcs.GetAttributes = (char * (*)())NULL;
+ pContext->funcs.GetOneAttribute = (char * (*)())NULL;
+ pContext->funcs.SetAttributes = (int (*)())NULL;
+ pContext->funcs.AugmentAttributes = (int (*)())NULL;
+ pContext->funcs.GetMediumDimensions = (int (*)())NULL;
+ pContext->funcs.GetReproducibleArea = (int (*)())NULL;
+ pContext->funcs.SetImageResolution = (int (*)())NULL;
+
+ if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) ==
+ (char *)NULL)
+ {
+ /* Freeing the context also causes the XpClients to be freed. */
+ FreeResource(stuff->contextID, RT_NONE);
+ return BadAlloc;
+ }
+ strncpy(pContext->printerName, (char *)(stuff + 1), stuff->printerNameLen);
+ pContext->printerName[stuff->printerNameLen] = (char)'\0';
+
+ driverName = XpDiGetDriverName(pRoot->drawable.pScreen->myNum,
+ pContext->printerName);
+
+ for(pDriver = pPrintScreen->drivers;
+ pDriver != (XpDriverPtr)NULL;
+ pDriver = pDriver->next)
+ {
+ if(!strcmp(driverName, pDriver->name))
+ {
+ if(pDriver->CreateContext != (Bool (*)())NULL)
+ pDriver->CreateContext(pContext);
+ else
+ return BadImplementation;
+ break;
+ }
+ }
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+/*
+ * SetContext creates the calling client's contextClient resource,
+ * and stashes the contextID in the client's devPrivate.
+ */
+static int
+ProcXpSetContext(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintSetContextReq);
+
+ XpContextPtr pContext;
+ XpClientPtr pPrintClient;
+ int result = Success;
+
+ REQUEST_AT_LEAST_SIZE(xPrintSetContextReq);
+
+ if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) !=
+ (pointer)NULL)
+ {
+ /*
+ * Erase this client's knowledge of its old context, if any.
+ */
+ if((pPrintClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
+ {
+ XpUnsetFontResFunc(client);
+
+ if(pPrintClient->eventMask == 0)
+ FreeXpClient(pPrintClient, TRUE);
+ }
+
+ client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL;
+ }
+ if(stuff->printContext == None)
+ return Success;
+
+ /*
+ * Check to see that the supplied XID is really a valid print context
+ * in this server.
+ */
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityWriteAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
+ return BadAlloc;
+
+ client->devPrivates[XpClientPrivateIndex].ptr = pContext;
+
+ XpSetFontResFunc(client);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+XpContextPtr
+XpGetPrintContext(client)
+ ClientPtr client;
+{
+ return (client->devPrivates[XpClientPrivateIndex].ptr);
+}
+
+static int
+ProcXpGetContext(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetContextReq);
+ xPrintGetContextReply rep;
+
+ XpContextPtr pContext;
+ XpClientPtr pNewPrintClient;
+ int result = Success;
+ register int n;
+ register long l;
+
+ REQUEST_SIZE_MATCH(xPrintGetContextReq);
+
+ if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) ==
+ (pointer)NULL)
+ rep.printContext = None;
+ else
+ rep.printContext = pContext->contextID;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swapl(&rep.printContext, l);
+ }
+ WriteToClient(client, sz_xPrintGetContextReply, (char *)&rep);
+ return client->noClientException;
+}
+
+
+/*
+ * DestroyContext frees the context associated with the calling client.
+ * It operates by freeing the context resource ID, thus causing XpFreeContext
+ * to be called.
+ */
+static int
+ProcXpDestroyContext(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintDestroyContextReq);
+
+ XpContextPtr pContext;
+ XpClientPtr pXpClient;
+ ClientPtr curClient;
+
+ REQUEST_SIZE_MATCH(xPrintDestroyContextReq);
+
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityDestroyAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ XpUnsetFontResFunc(client);
+
+ FreeResource(pContext->contextID, RT_NONE);
+
+ return Success;
+}
+
+static int
+ProcXpGetContextScreen(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetContextScreenReq);
+ xPrintGetContextScreenReply rep;
+ XpContextPtr pContext;
+ int n;
+ long l;
+
+ if((pContext =(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadContext;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.rootWindow = WindowTable[pContext->screenNum]->drawable.id;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swapl(&rep.rootWindow, l);
+ }
+
+ WriteToClient(client, sz_xPrintGetContextScreenReply, (char *)&rep);
+ return client->noClientException;
+}
+
+/*
+ * XpFreeContext is the routine called by dix:FreeResource when a context
+ * resource ID is freed.
+ * It checks to see if there's a partial job pending on the context, and
+ * if so it calls the appropriate End procs with the cancel flag set.
+ * It calls the driver's DestroyContext routine to allow the driver to clean
+ * up any context-related memory or state.
+ * It calls FreeXpClient to free all the
+ * associated XpClientRecs and to set all the client->devPrivates to NULL.
+ * It frees the printer name string, and frees the context
+ * itself.
+ */
+static int
+XpFreeContext(data, id)
+ pointer data;
+ XID id;
+{
+ XpContextPtr pContext = (XpContextPtr)data;
+
+ /* Clean up any pending job on this context */
+ if(pContext->state != 0)
+ {
+ if(pContext->state & PAGE_STARTED)
+ {
+ WindowPtr pWin = (WindowPtr )LookupIDByType(
+ pContext->pageWin, RT_WINDOW);
+ XpPagePtr pPage = (XpPagePtr)LookupIDByType(
+ pContext->pageWin, RTpage);
+
+ pContext->funcs.EndPage(pContext, pWin, TRUE);
+ SendXpNotify(pContext, XPEndPageNotify, TRUE);
+ pContext->state &= ~PAGE_STARTED;
+ if(pPage)
+ pPage->context = (XpContextPtr)NULL;
+ }
+ if((pContext->state & DOC_RAW_STARTED) ||
+ (pContext->state & DOC_COOKED_STARTED))
+ {
+ pContext->funcs.EndDoc(pContext, TRUE);
+ SendXpNotify(pContext, XPEndDocNotify, TRUE);
+ pContext->state &= ~DOC_RAW_STARTED;
+ pContext->state &= ~DOC_COOKED_STARTED;
+ }
+ if(pContext->funcs.EndJob != (int (*)())NULL)
+ {
+ pContext->funcs.EndJob(pContext, TRUE);
+ SendXpNotify(pContext, XPEndJobNotify, TRUE);
+ pContext->state &= ~JOB_STARTED;
+ pContext->state &= ~GET_DOC_DATA_STARTED;
+ }
+ }
+
+ /*
+ * Tell the driver we're destroying the context
+ * This allows the driver to free and ContextPrivate data
+ */
+ if(pContext->funcs.DestroyContext != (int (*)())NULL)
+ pContext->funcs.DestroyContext(pContext);
+
+ /* Free up all the XpClientRecs */
+ while(pContext->clientHead != (XpClientPtr)NULL)
+ {
+ FreeXpClient(pContext->clientHead, TRUE);
+ }
+
+ xfree(pContext->printerName);
+ xfree(pContext);
+ return Success; /* ??? */
+}
+
+/*
+ * XpFreeClient is the routine called by dix:FreeResource when a RTclient
+ * is freed. It simply calls the FreeXpClient routine to do the work.
+ */
+static int
+XpFreeClient(data, id)
+ pointer data;
+ XID id;
+{
+ FreeXpClient((XpClientPtr)data, FALSE);
+}
+
+/*
+ * FreeXpClient
+ * frees the ClientRec passed in, and sets the client->devPrivates to NULL
+ * if the client->devPrivates points to the same context as the XpClient.
+ * Called from XpFreeContext(from FreeResource), and
+ * XpFreeClient. The boolean freeResource specifies whether or not to call
+ * FreeResource for the XpClientRec's XID. We should free it except if we're
+ * called from XpFreeClient (which is itself called from FreeResource for the
+ * XpClientRec's XID).
+ */
+static void
+FreeXpClient(pXpClient, freeResource)
+ XpClientPtr pXpClient;
+ Bool freeResource;
+{
+ XpClientPtr pCurrent, pPrev;
+ XpContextPtr pContext = pXpClient->context;
+
+ /*
+ * If we're freeing the clientRec associated with the context tied
+ * to the client's devPrivates, then we need to clear the devPrivates.
+ */
+ if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr ==
+ pXpClient->context)
+ {
+ pXpClient->client->devPrivates[XpClientPrivateIndex].ptr =
+ (pointer)NULL;
+ }
+
+ for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead;
+ pCurrent != (XpClientPtr)NULL;
+ pCurrent = pCurrent->pNext)
+ {
+ if(pCurrent == pXpClient)
+ {
+ if(freeResource == TRUE)
+ FreeResource (pCurrent->contextClientID, RTclient);
+
+ if (pPrev != (XpClientPtr)NULL)
+ pPrev->pNext = pCurrent->pNext;
+ else
+ pContext->clientHead = pCurrent->pNext;
+
+ xfree (pCurrent);
+ break;
+ }
+ pPrev = pCurrent;
+ }
+}
+
+/*
+ * CreateXpClient takes a ClientPtr and returns a pointer to a
+ * XpClientRec which it allocates. It also initializes the Rec,
+ * including adding a resource on behalf of the client to enable the
+ * freeing of the Rec when the client's connection is closed.
+ */
+static XpClientPtr
+CreateXpClient(client)
+ ClientPtr client;
+{
+ XpClientPtr pNewPrintClient;
+ XID clientResource;
+
+ if((pNewPrintClient = (XpClientPtr)xalloc(sizeof(XpClientRec))) ==
+ (XpClientPtr)NULL)
+ return (XpClientPtr)NULL;
+
+ clientResource = FakeClientID(client->index);
+ if(!AddResource(clientResource, RTclient, (pointer)pNewPrintClient))
+ {
+ xfree (pNewPrintClient);
+ return (XpClientPtr)NULL;
+ }
+
+ pNewPrintClient->pNext = (XpClientPtr)NULL;
+ pNewPrintClient->client = client;
+ pNewPrintClient->context = (XpContextPtr)NULL;
+ pNewPrintClient->eventMask = 0;
+ pNewPrintClient->contextClientID = clientResource;
+
+ return pNewPrintClient;
+}
+
+/*
+ * XpFreePage is the routine called by dix:FreeResource to free the page
+ * resource built with the same ID as a page window. It checks to see
+ * if we're in the middle of a page, and if so calls the driver's EndPage
+ * function with 'cancel' set TRUE. It frees the memory associated with
+ * the page resource.
+ */
+static int
+XpFreePage(data, id)
+ pointer data;
+ XID id;
+{
+ XpPagePtr page = (XpPagePtr)data;
+ int result = Success;
+ WindowPtr pWin = (WindowPtr )LookupIDByType(id, RT_WINDOW);
+
+ /* Check to see if the window's being deleted in the middle of a page */
+ if(page->context != (XpContextPtr)NULL &&
+ page->context->state & PAGE_STARTED)
+ {
+ XpScreenPtr pPrintScreen = XpScreens[page->context->screenNum];
+ if(page->context->funcs.EndPage != (int (*)())NULL)
+ result = page->context->funcs.EndPage(page->context, pWin, TRUE);
+ SendXpNotify(page->context, XPEndPageNotify, (int)TRUE);
+ page->context->pageWin = 0; /* None, NULL??? XXX */
+ }
+
+ xfree(page);
+ return result;
+}
+
+/*
+ * ContextPrivate machinery.
+ * Context privates are intended for use by the drivers, allowing the
+ * drivers to maintain context-specific data. The driver should free
+ * the associated data at DestroyContext time.
+ */
+
+static void
+InitContextPrivates(context)
+ XpContextPtr context;
+{
+ register char *ptr;
+ DevUnion *ppriv;
+ register unsigned *sizes;
+ register unsigned size;
+ register int i;
+
+ if (totalContextSize == sizeof(XpContextRec))
+ ppriv = (DevUnion *)NULL;
+ else
+ ppriv = (DevUnion *)(context + 1);
+
+ context->devPrivates = ppriv;
+ sizes = contextPrivateSizes;
+ ptr = (char *)(ppriv + contextPrivateLen);
+ for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ( (size = *sizes) )
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+}
+
+static void
+ResetContextPrivates()
+{
+ contextPrivateCount = 0;
+ contextPrivateLen = 0;
+ xfree(contextPrivateSizes);
+ contextPrivateSizes = (unsigned *)NULL;
+ totalContextSize = sizeof(XpContextRec);
+
+}
+
+int
+XpAllocateContextPrivateIndex()
+{
+ return contextPrivateCount++;
+}
+
+Bool
+XpAllocateContextPrivate(index, amount)
+ int index;
+ unsigned amount;
+{
+ unsigned oldamount;
+
+ if (index >= contextPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(contextPrivateSizes,
+ (index + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (contextPrivateLen <= index)
+ {
+ nsizes[contextPrivateLen++] = 0;
+ totalContextSize += sizeof(DevUnion);
+ }
+ contextPrivateSizes = nsizes;
+ }
+ oldamount = contextPrivateSizes[index];
+ if (amount > oldamount)
+ {
+ contextPrivateSizes[index] = amount;
+ totalContextSize += (amount - oldamount);
+ }
+ return TRUE;
+}
+
+static XpClientPtr
+AcquireClient(pContext, client)
+ XpContextPtr pContext;
+ ClientPtr client;
+{
+ XpClientPtr pXpClient;
+
+ if((pXpClient = FindClient(pContext, client)) != (XpClientPtr)NULL)
+ return pXpClient;
+
+ if((pXpClient = CreateXpClient(client)) == (XpClientPtr)NULL)
+ return (XpClientPtr)NULL;
+
+ pXpClient->context = pContext;
+ pXpClient->pNext = pContext->clientHead;
+ pContext->clientHead = pXpClient;
+
+ return pXpClient;
+}
+
+static XpClientPtr
+FindClient(pContext, client)
+ XpContextPtr pContext;
+ ClientPtr client;
+{
+ XpClientPtr pXpClient;
+
+ for(pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL;
+ pXpClient = pXpClient->pNext)
+ {
+ if(pXpClient->client == client) return pXpClient;
+ }
+ return (XpClientPtr)NULL;
+}
+
+
+/******************************************************************************
+ *
+ * Start/End Functions: StartJob, EndJob, StartDoc, EndDoc, StartPage, EndPage
+ *
+ ******************************************************************************/
+
+static int
+ProcXpStartJob(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintStartJobReq);
+ XpContextPtr pContext;
+ int result = Success;
+ XpScreenPtr pPrintScreen;
+
+ REQUEST_SIZE_MATCH(xPrintStartJobReq);
+
+ /* Check to see that a context has been established by this client. */
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadContext;
+
+ if(pContext->state != 0)
+ return XpErrorBase+XPBadSequence;
+
+ if(stuff->saveData != XPSpool && stuff->saveData != XPGetData)
+ {
+ client->errorValue = stuff->saveData;
+ return BadValue;
+ }
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+ if(pContext->funcs.StartJob != (int (*)())NULL)
+ result = pContext->funcs.StartJob(pContext,
+ (stuff->saveData == XPGetData)? TRUE:FALSE);
+ else
+ return BadImplementation;
+
+ pContext->state = JOB_STARTED;
+ if(stuff->saveData == XPGetData)
+ pContext->state |= JOB_GET_DATA;
+
+ SendXpNotify(pContext, XPStartJobNotify, FALSE);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static int
+ProcXpEndJob(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintEndJobReq);
+ XpScreenPtr pPrintScreen;
+ WindowPtr pWin;
+ int result = Success;
+ XpContextPtr pContext;
+
+ REQUEST_SIZE_MATCH(xPrintEndJobReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+
+ if(!(pContext->state & JOB_STARTED))
+ return XpErrorBase+XPBadSequence;
+
+ /* Check for missing EndDoc */
+ if((pContext->state & DOC_RAW_STARTED) ||
+ (pContext->state & DOC_COOKED_STARTED))
+ {
+ if(pContext->state & PAGE_STARTED)
+ {
+ WindowPtr pWin = (WindowPtr )LookupIDByType(
+ pContext->pageWin, RT_WINDOW);
+ XpPagePtr pPage = (XpPagePtr)LookupIDByType(
+ pContext->pageWin, RTpage);
+
+ if(stuff->cancel != TRUE)
+ return XpErrorBase+XPBadSequence;
+
+ if(pContext->funcs.EndPage != (int (*)())NULL)
+ result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ else
+ return BadImplementation;
+
+ SendXpNotify(pContext, XPEndPageNotify, TRUE);
+
+ pContext->state &= ~PAGE_STARTED;
+
+ if(pPage)
+ pPage->context = (XpContextPtr)NULL;
+
+ if(result != Success) return result;
+ }
+
+ if(pContext->funcs.EndDoc != (int (*)())NULL)
+ result = pContext->funcs.EndDoc(pContext, stuff->cancel);
+ else
+ return BadImplementation;
+
+ SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
+ }
+
+ if(pContext->funcs.EndJob != (int (*)())NULL)
+ result = pContext->funcs.EndJob(pContext, stuff->cancel);
+ else
+ return BadImplementation;
+
+ pContext->state = 0;
+
+ SendXpNotify(pContext, XPEndJobNotify, stuff->cancel);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static Bool
+DoStartDoc(client, c)
+ ClientPtr client;
+ XpStDocPtr c;
+{
+ XpScreenPtr pPrintScreen;
+ int result = Success;
+ XpContextPtr pContext = c->pContext;
+
+ if(c->pContext->state & JOB_GET_DATA &&
+ !(c->pContext->state & GET_DOC_DATA_STARTED))
+ {
+ if(!c->slept)
+ {
+ c->slept = TRUE;
+ ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c);
+ c->pContext->clientSlept = client;
+ }
+ return TRUE;
+ }
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+
+ if(pContext->funcs.StartDoc != (int (*)())NULL)
+ result = pContext->funcs.StartDoc(pContext, c->type);
+ else
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadImplementation);
+ return TRUE;
+ }
+
+ if(c->type == XPDocNormal)
+ pContext->state |= DOC_COOKED_STARTED;
+ else
+ pContext->state |= DOC_RAW_STARTED;
+
+ SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
+
+ xfree(c);
+ return TRUE;
+}
+
+static int
+ProcXpStartDoc(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintStartDocReq);
+ XpScreenPtr pPrintScreen;
+ int result = Success;
+ XpContextPtr pContext;
+ XpStDocPtr c;
+
+ REQUEST_SIZE_MATCH(xPrintStartDocReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ if(!(pContext->state & JOB_STARTED) ||
+ pContext->state & DOC_RAW_STARTED ||
+ pContext->state & DOC_COOKED_STARTED)
+ return XpErrorBase+XPBadSequence;
+
+ if(stuff->type != XPDocNormal && stuff->type != XPDocRaw)
+ {
+ client->errorValue = stuff->type;
+ return BadValue;
+ }
+
+ c = (XpStDocPtr)xalloc(sizeof(XpStDocRec));
+ c->pContext = pContext;
+ c->type = stuff->type;
+ c->slept = FALSE;
+ (void)DoStartDoc(client, c);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static int
+ProcXpEndDoc(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintEndDocReq);
+ XpScreenPtr pPrintScreen;
+ XpContextPtr pContext;
+ int result = Success;
+
+ REQUEST_SIZE_MATCH(xPrintEndDocReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+
+ if(!(pContext->state & DOC_RAW_STARTED) &&
+ !(pContext->state & DOC_COOKED_STARTED))
+ return XpErrorBase+XPBadSequence;
+
+ if(pContext->state & PAGE_STARTED)
+ {
+ if(stuff->cancel == TRUE)
+ {
+ WindowPtr pWin = (WindowPtr )LookupIDByType(
+ pContext->pageWin, RT_WINDOW);
+ XpPagePtr pPage = (XpPagePtr)LookupIDByType(
+ pContext->pageWin, RTpage);
+
+ if(pContext->funcs.EndPage != (int (*)())NULL)
+ result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ else
+ return BadImplementation;
+
+ SendXpNotify(pContext, XPEndPageNotify, TRUE);
+
+ if(pPage)
+ pPage->context = (XpContextPtr)NULL;
+ }
+ else
+ return XpErrorBase+XPBadSequence;
+ if(result != Success)
+ return result;
+ }
+
+ if(pContext->funcs.EndDoc != (int (*)())NULL)
+ result = pContext->funcs.EndDoc(pContext, stuff->cancel);
+ else
+ return BadImplementation;
+
+ pContext->state &= ~DOC_RAW_STARTED;
+ pContext->state &= ~DOC_COOKED_STARTED;
+
+ SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static Bool
+DoStartPage(client, c)
+ ClientPtr client;
+ XpStPagePtr c;
+{
+ XpScreenPtr pPrintScreen;
+ WindowPtr pWin = c->pWin;
+ int result = Success;
+ XpContextPtr pContext = c->pContext;
+ XpPagePtr pPage;
+
+ if(c->pContext->state & JOB_GET_DATA &&
+ !(c->pContext->state & GET_DOC_DATA_STARTED))
+ {
+ if(!c->slept)
+ {
+ c->slept = TRUE;
+ ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c);
+ c->pContext->clientSlept = client;
+ }
+ return TRUE;
+ }
+
+ if(!(pContext->state & DOC_COOKED_STARTED))
+ {
+ /* Implied StartDoc if it was omitted */
+ if(pContext->funcs.StartDoc != (int (*)())NULL)
+ result = pContext->funcs.StartDoc(pContext, XPDocNormal);
+ else
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadImplementation);
+ return TRUE;
+ }
+
+ if(result != Success)
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, result);
+ return TRUE;
+ }
+
+ pContext->state |= DOC_COOKED_STARTED;
+ SendXpNotify(pContext, XPStartDocNotify, (int)FALSE);
+ }
+
+ /* ensure the window's not already being used as a page */
+ if((pPage = (XpPagePtr)LookupIDByType(c->pWin->drawable.id, RTpage)) !=
+ (XpPagePtr)NULL)
+ {
+ if(pPage->context != (XpContextPtr)NULL)
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadWindow);
+ return TRUE;
+ }
+ }
+ else
+ {
+ if((pPage = (XpPagePtr)xalloc(sizeof(XpPageRec))) == (XpPagePtr)NULL)
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadAlloc);
+ return TRUE;
+ }
+ if(AddResource(c->pWin->drawable.id, RTpage, pPage) == FALSE)
+ {
+ xfree(pPage);
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadAlloc);
+ return TRUE;
+ }
+ }
+
+ pPage->context = pContext;
+ pContext->pageWin = c->pWin->drawable.id;
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+
+
+ if(pContext->funcs.StartPage != (int (*)())NULL)
+ result = pContext->funcs.StartPage(pContext, pWin);
+ else
+ {
+ SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0,
+ BadImplementation);
+ return TRUE;
+ }
+
+ pContext->state |= PAGE_STARTED;
+
+ (void)MapWindow(pWin, client);
+
+ SendXpNotify(pContext, XPStartPageNotify, (int)FALSE);
+
+ return TRUE;
+}
+
+static int
+ProcXpStartPage(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintStartPageReq);
+ XpScreenPtr pPrintScreen;
+ WindowPtr pWin;
+ int result = Success;
+ XpContextPtr pContext;
+ XpPagePtr pPage;
+ XpStPagePtr c;
+
+ REQUEST_SIZE_MATCH(xPrintStartPageReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ if(!(pContext->state & JOB_STARTED))
+ return XpErrorBase+XPBadSequence;
+
+ /* can't have pages in a raw documented */
+ if(pContext->state & DOC_RAW_STARTED)
+ return XpErrorBase+XPBadSequence;
+
+ if(pContext->state & PAGE_STARTED)
+ return XpErrorBase+XPBadSequence;
+
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum)
+ return BadWindow;
+
+ if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL)
+ return BadAlloc;
+ c->pContext = pContext;
+ c->slept = FALSE;
+ c->pWin = pWin;
+
+ (void)DoStartPage(client, c);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static int
+ProcXpEndPage(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintEndPageReq);
+ XpScreenPtr pPrintScreen;
+ int result = Success;
+ XpContextPtr pContext;
+ XpPagePtr page;
+ WindowPtr pWin;
+
+ REQUEST_SIZE_MATCH(xPrintEndPageReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ if(!(pContext->state & PAGE_STARTED))
+ return XpErrorBase+XPBadSequence;
+
+ pPrintScreen = XpScreens[pContext->screenNum];
+ pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW);
+
+ /* Call the ddx's EndPage proc. */
+ if(pContext->funcs.EndPage != (int (*)())NULL)
+ result = pContext->funcs.EndPage(pContext, pWin, stuff->cancel);
+ else
+ return BadImplementation;
+
+ if((page = (XpPagePtr)LookupIDByType(pContext->pageWin, RTpage)) !=
+ (XpPagePtr)NULL)
+ page->context = (XpContextPtr)NULL;
+
+ pContext->state &= ~PAGE_STARTED;
+ pContext->pageWin = 0; /* None, NULL??? XXX */
+
+ (void)UnmapWindow(pWin, FALSE);
+
+ SendXpNotify(pContext, XPEndPageNotify, stuff->cancel);
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+/*******************************************************************************
+ *
+ * Document Data Functions: PutDocumentData, GetDocumentData
+ *
+ ******************************************************************************/
+
+static int
+ProcXpPutDocumentData(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintPutDocumentDataReq);
+ XpContextPtr pContext;
+ DrawablePtr pDraw;
+ int result = Success;
+ int len, totalSize;
+ char *pData, *pDoc_fmt, *pOptions;
+
+ REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
+
+ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
+ == (XpContextPtr)NULL)
+ return XpErrorBase+XPBadSequence;
+
+ if(!(pContext->state & DOC_RAW_STARTED) &&
+ !(pContext->state & DOC_COOKED_STARTED))
+ return XpErrorBase+XPBadSequence;
+
+ if (stuff->drawable) {
+ if (pContext->state & DOC_RAW_STARTED)
+ return BadDrawable;
+ pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client);
+ if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum)
+ return BadDrawable;
+ } else {
+ if (pContext->state & DOC_COOKED_STARTED)
+ return BadDrawable;
+ pDraw = NULL;
+ }
+
+ pData = (char *)(&stuff[1]);
+
+ totalSize = (stuff->len_data + 3) >> 2;
+ pDoc_fmt = pData + (totalSize << 2);
+
+ totalSize += (stuff->len_fmt + 3) >> 2;
+ pOptions = pData + (totalSize << 2);
+
+ totalSize += (stuff->len_options + 3) >> 2;
+ if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len)
+ return BadLength;
+
+ if(pContext->funcs.PutDocumentData != (int (*)())NULL)
+ {
+ result = (*pContext->funcs.PutDocumentData)(pContext, pDraw,
+ pData, stuff->len_data,
+ pDoc_fmt, stuff->len_fmt,
+ pOptions, stuff->len_options,
+ client);
+ }
+ else
+ return BadImplementation;
+
+ if (client->noClientException != Success)
+ return client->noClientException;
+ else
+ return result;
+}
+
+static int
+ProcXpGetDocumentData(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetDocumentDataReq);
+ xPrintGetDocumentDataReply rep;
+ XpScreenPtr pPrintScreen;
+ XpContextPtr pContext;
+ int result = Success;
+
+ REQUEST_SIZE_MATCH(xPrintGetDocumentDataReq);
+
+ if((pContext = (XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityWriteAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(pContext->funcs.GetDocumentData == (int (*)())NULL)
+ return BadImplementation;
+
+ if(!(pContext->state & JOB_GET_DATA) ||
+ pContext->state & GET_DOC_DATA_STARTED)
+ return XpErrorBase+XPBadSequence;
+
+ if(stuff->maxBufferSize <= 0)
+ {
+ client->errorValue = stuff->maxBufferSize;
+ return BadValue; /* gotta have a positive buffer size */
+ }
+
+ result = (*pContext->funcs.GetDocumentData)(pContext, client,
+ stuff->maxBufferSize);
+ if(result != Success)
+ {
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.dataLen = 0;
+ rep.statusCode = 1;
+ rep.finishedFlag = TRUE;
+ if (client->swapped) {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.statusCode, l); /* XXX Why are these longs??? */
+ swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */
+ }
+ (void)WriteToClient(client,sz_xPrintGetDocumentDataReply,(char *)&rep);
+ }
+ else
+ pContext->state |= GET_DOC_DATA_STARTED;
+
+ if(pContext->clientSlept != (ClientPtr)NULL)
+ {
+ ClientSignal(pContext->clientSlept);
+ ClientWakeup(pContext->clientSlept);
+ pContext->clientSlept = (ClientPtr)NULL;
+ }
+
+ return result;
+}
+
+/*******************************************************************************
+ *
+ * Attribute requests: GetAttributes, SetAttributes, GetOneAttribute
+ *
+ ******************************************************************************/
+
+static int
+ProcXpGetAttributes(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetAttributesReq);
+ XpContextPtr pContext;
+ char *attrs;
+ xPrintGetAttributesReply *pRep;
+ int totalSize, n;
+ unsigned long l;
+
+ REQUEST_SIZE_MATCH(xPrintGetAttributesReq);
+
+ if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
+ {
+ client->errorValue = stuff->type;
+ return BadValue;
+ }
+
+ if(stuff->type != XPServerAttr)
+ {
+ if((pContext = (XpContextPtr)SecurityLookupIDByType(
+ client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(pContext->funcs.GetAttributes == (char *(*)())NULL)
+ return BadImplementation;
+ if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) ==
+ (char *)NULL)
+ return BadAlloc;
+ }
+ else
+ {
+ if((attrs = XpGetAttributes((XpContextPtr)NULL, XPServerAttr)) ==
+ (char *)NULL)
+ return BadAlloc;
+ }
+
+ totalSize = sz_xPrintGetAttributesReply + QUADPAD(strlen(attrs));
+ if((pRep = (xPrintGetAttributesReply *)malloc(totalSize)) ==
+ (xPrintGetAttributesReply *)NULL)
+ return BadAlloc;
+
+ pRep->type = X_Reply;
+ pRep->length = (totalSize - sz_xPrintGetAttributesReply) >> 2;
+ pRep->sequenceNumber = client->sequence;
+ pRep->stringLen = strlen(attrs);
+
+ if (client->swapped) {
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, l);
+ swapl(&pRep->stringLen, l);
+ }
+
+ strncpy((char*)(pRep + 1), attrs, strlen(attrs));
+ xfree(attrs);
+
+ WriteToClient(client, totalSize, (char *)pRep);
+
+ xfree(pRep);
+
+ return client->noClientException;
+}
+
+static int
+ProcXpSetAttributes(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintSetAttributesReq);
+ int result = Success;
+ XpContextPtr pContext;
+ char *attr;
+
+ REQUEST_AT_LEAST_SIZE(xPrintSetAttributesReq);
+
+ if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
+ {
+ client->errorValue = stuff->type;
+ return BadValue;
+ }
+
+ /*
+ * Disallow changing of read-only attribute pools
+ */
+ if(stuff->type == XPPrinterAttr || stuff->type == XPServerAttr)
+ return BadMatch;
+
+ if((pContext = (XpContextPtr)SecurityLookupIDByType(
+ client,
+ stuff->printContext,
+ RTcontext,
+ SecurityWriteAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(pContext->funcs.SetAttributes == (int (*)())NULL)
+ return BadImplementation;
+
+ /*
+ * Check for attributes being set after their relevant phase
+ * has already begun (e.g. Job attributes set after StartJob).
+ */
+ if((pContext->state & JOB_STARTED) && stuff->type == XPJobAttr)
+ return XpErrorBase+XPBadSequence;
+ if(((pContext->state & DOC_RAW_STARTED) ||
+ (pContext->state & DOC_COOKED_STARTED)) && stuff->type == XPDocAttr)
+ return XpErrorBase+XPBadSequence;
+ if((pContext->state & PAGE_STARTED) && stuff->type == XPPageAttr)
+ return XpErrorBase+XPBadSequence;
+
+ if((attr = (char *)malloc(stuff->stringLen + 1)) == (char *)NULL)
+ return BadAlloc;
+
+ strncpy(attr, (char *)(stuff + 1), stuff->stringLen);
+ attr[stuff->stringLen] = (char)'\0';
+
+ if(stuff->rule == XPAttrReplace)
+ (*pContext->funcs.SetAttributes)(pContext, stuff->type, attr);
+ else if(stuff->rule == XPAttrMerge)
+ (*pContext->funcs.AugmentAttributes)(pContext, stuff->type, attr);
+ else
+ {
+ client->errorValue = stuff->rule;
+ result = BadValue;
+ }
+
+ xfree(attr);
+
+ SendAttributeNotify(pContext, stuff->type);
+
+ return result;
+}
+
+static int
+ProcXpGetOneAttribute(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintGetOneAttributeReq);
+ XpContextPtr pContext;
+ char *value, *attrName;
+ xPrintGetOneAttributeReply *pRep;
+ int totalSize, n;
+ unsigned long l;
+
+ REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq);
+
+ totalSize = ((sz_xPrintGetOneAttributeReq) >> 2) +
+ ((stuff->nameLen + 3) >> 2);
+ if(totalSize != client->req_len)
+ return BadLength;
+
+ if(stuff->type < XPJobAttr || stuff->type > XPServerAttr)
+ {
+ client->errorValue = stuff->type;
+ return BadValue;
+ }
+
+ if((attrName = (char *)malloc(stuff->nameLen + 1)) == (char *)NULL)
+ return BadAlloc;
+ strncpy(attrName, (char *)(stuff+1), stuff->nameLen);
+ attrName[stuff->nameLen] = (char)'\0';
+
+ if(stuff->type != XPServerAttr)
+ {
+ if((pContext = (XpContextPtr)SecurityLookupIDByType(
+ client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(pContext->funcs.GetOneAttribute == (char *(*)())NULL)
+ return BadImplementation;
+ if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type,
+ attrName)) == (char *)NULL)
+ return BadAlloc;
+ }
+ else
+ {
+ if((value = XpGetOneAttribute((XpContextPtr)NULL, XPServerAttr,
+ attrName)) == (char *)NULL)
+ return BadAlloc;
+ }
+
+ free(attrName);
+
+ totalSize = sz_xPrintGetOneAttributeReply + QUADPAD(strlen(value));
+ if((pRep = (xPrintGetOneAttributeReply *)malloc(totalSize)) ==
+ (xPrintGetOneAttributeReply *)NULL)
+ return BadAlloc;
+
+ pRep->type = X_Reply;
+ pRep->length = (totalSize - sz_xPrintGetOneAttributeReply) >> 2;
+ pRep->sequenceNumber = client->sequence;
+ pRep->valueLen = strlen(value);
+
+ if (client->swapped) {
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, l);
+ swapl(&pRep->valueLen, l);
+ }
+
+ strncpy((char*)(pRep + 1), value, strlen(value));
+
+ WriteToClient(client, totalSize, (char *)pRep);
+
+ xfree(pRep);
+
+ return client->noClientException;
+}
+
+/*******************************************************************************
+ *
+ * Print Event requests: SelectInput InputSelected, SendXpNotify
+ *
+ ******************************************************************************/
+
+
+static int
+ProcXpSelectInput(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintSelectInputReq);
+ int result = Success;
+ XpContextPtr pContext;
+ XpClientPtr pPrintClient;
+
+ REQUEST_SIZE_MATCH(xPrintSelectInputReq);
+
+ /*
+ * Check to see that the supplied XID is really a valid print context
+ * in this server.
+ */
+ if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityWriteAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ if(stuff->eventMask & ~allEvents)
+ {
+ client->errorValue = stuff->eventMask;
+ return BadValue; /* bogus event mask bits */
+ }
+
+ if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
+ return BadAlloc;
+
+ pPrintClient->eventMask = stuff->eventMask;
+
+ return result;
+}
+
+static int
+ProcXpInputSelected(client)
+ ClientPtr client;
+{
+ REQUEST(xPrintInputSelectedReq);
+ xPrintInputSelectedReply rep;
+ register int n;
+ long l, allMask;
+ WindowPtr pWin;
+ XpClientPtr pXpClient;
+ XpContextPtr pContext;
+
+ REQUEST_SIZE_MATCH(xPrintInputSelectedReq);
+
+ if((pContext=(XpContextPtr)SecurityLookupIDByType(client,
+ stuff->printContext,
+ RTcontext,
+ SecurityReadAccess))
+ == (XpContextPtr)NULL)
+ {
+ client->errorValue = stuff->printContext;
+ return XpErrorBase+XPBadContext;
+ }
+
+ pXpClient = FindClient(pContext, client);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.eventMask = (pXpClient != (XpClientPtr)NULL)? pXpClient->eventMask : 0;
+ rep.allEventsMask = GetAllEventMasks(pContext);
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swapl(&rep.eventMask, l);
+ swapl(&rep.allEventsMask, l);
+ }
+
+ WriteToClient(client, sz_xPrintInputSelectedReply, (char *)&rep);
+ return client->noClientException;
+}
+
+static void
+SendAttributeNotify(pContext, which)
+ XpContextPtr pContext;
+ int which;
+{
+ XpClientPtr pXpClient;
+ xPrintAttributeEvent ae;
+ ClientPtr client;
+
+ pXpClient = pContext->clientHead;
+ if(pXpClient == (XpClientPtr)NULL)
+ return; /* Nobody's interested in the events (or this context). */
+
+ for (pXpClient = pContext->clientHead;
+ pXpClient != (XpClientPtr)NULL;
+ pXpClient = pXpClient->pNext)
+ {
+ client = pXpClient->client;
+ if (client == serverClient || client->clientGone ||
+ !(pXpClient->eventMask & XPAttributeMask))
+ continue;
+ ae.type = XPAttributeNotify + XpEventBase;
+ ae.detail = which;
+ ae.printContext = pContext->contextID;
+ ae.sequenceNumber = client->sequence;
+ WriteEventsToClient (client, 1, (xEvent *) &ae);
+ }
+}
+static void
+SendXpNotify(pContext, which, val)
+ XpContextPtr pContext;
+ int which;
+ int val;
+{
+ XpClientPtr pXpClient;
+ xPrintPrintEvent pe;
+ ClientPtr client;
+
+ pXpClient = pContext->clientHead;
+ if(pXpClient == (XpClientPtr)NULL)
+ return; /* Nobody's interested in the events (or this context). */
+
+ for (pXpClient = pContext->clientHead;
+ pXpClient != (XpClientPtr)NULL;
+ pXpClient = pXpClient->pNext)
+ {
+ client = pXpClient->client;
+ if (client == serverClient || client->clientGone ||
+ !(pXpClient->eventMask & XPPrintMask))
+ continue;
+ pe.type = XPPrintNotify + XpEventBase;
+ pe.detail = which;
+ pe.printContext = pContext->contextID;
+ pe.cancel = (Bool)val;
+ pe.sequenceNumber = client->sequence;
+ WriteEventsToClient (client, 1, (xEvent *) &pe);
+ }
+}
+
+static CARD32
+GetAllEventMasks(pContext)
+ XpContextPtr pContext;
+{
+ XpClientPtr pPrintClient;
+ CARD32 totalMask = (CARD32)0;
+
+ for (pPrintClient = pContext->clientHead;
+ pPrintClient != (XpClientPtr)NULL;
+ pPrintClient = pPrintClient->pNext)
+ {
+ totalMask |= pPrintClient->eventMask;
+ }
+ return totalMask;
+}
+
+/*
+ * XpContextOfClient - returns the XpContextPtr to the context
+ * associated with the specified client, or NULL if the client
+ * does not currently have a context set.
+ */
+XpContextPtr
+XpContextOfClient(client)
+ ClientPtr client;
+{
+ XpContextPtr pContext;
+
+ return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
+}
+
+
+/*******************************************************************************
+ *
+ * Swap-request functions
+ *
+ ******************************************************************************/
+
+static int
+SProcXpCreateContext(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintCreateContextReq);
+
+ swaps(&stuff->length, i);
+ swapl(&stuff->contextID, n);
+ swapl(&stuff->printerNameLen, n);
+ swapl(&stuff->localeLen, n);
+ return ProcXpCreateContext(client);
+}
+
+static int
+SProcXpGetPrinterList(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintGetPrinterListReq);
+
+ swaps(&stuff->length, i);
+ swapl(&stuff->printerNameLen, n);
+ swapl(&stuff->localeLen, n);
+ return ProcXpGetPrinterList(client);
+}
+
+static int
+SProcXpRehashPrinterList(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintRehashPrinterListReq);
+ swaps(&stuff->length, i);
+ return ProcXpRehashPrinterList(client);
+}
+
+static int
+SProcXpSetContext(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintSetContextReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, i);
+ return ProcXpSetContext(client);
+}
+
+static int
+SProcXpGetContext(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintGetContextReq);
+ swaps(&stuff->length, i);
+ return ProcXpGetContext(client);
+}
+
+static int
+SProcXpDestroyContext(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintDestroyContextReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpDestroyContext(client);
+}
+
+static int
+SProcXpGetContextScreen(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintGetContextScreenReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpGetContextScreen(client);
+}
+
+static int
+SProcXpInputSelected(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintInputSelectedReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpInputSelected(client);
+}
+
+static int
+SProcXpStartJob(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintStartJobReq);
+ swaps(&stuff->length, i);
+ return ProcXpStartJob(client);
+}
+
+static int
+SProcXpEndJob(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintEndJobReq);
+ swaps(&stuff->length, i);
+ return ProcXpEndJob(client);
+}
+
+static int
+SProcXpStartDoc(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintStartDocReq);
+ swaps(&stuff->length, i);
+ return ProcXpStartDoc(client);
+}
+
+static int
+SProcXpEndDoc(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintEndDocReq);
+ swaps(&stuff->length, i);
+ return ProcXpEndDoc(client);
+}
+
+static int
+SProcXpStartPage(client)
+ ClientPtr client;
+{
+ int i;
+ long n;
+
+ REQUEST(xPrintStartPageReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->window, n);
+ return ProcXpStartPage(client);
+}
+
+static int
+SProcXpEndPage(client)
+ ClientPtr client;
+{
+ int i;
+
+ REQUEST(xPrintEndPageReq);
+ swaps(&stuff->length, i);
+ return ProcXpEndPage(client);
+}
+
+static int
+SProcXpPutDocumentData(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintPutDocumentDataReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->len_data, n);
+ swaps(&stuff->len_fmt, i);
+ swaps(&stuff->len_options, i);
+ return ProcXpPutDocumentData(client);
+}
+
+static int
+SProcXpGetDocumentData(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintGetDocumentDataReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ swapl(&stuff->maxBufferSize, n);
+ return ProcXpGetDocumentData(client);
+}
+
+static int
+SProcXpGetAttributes(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintGetAttributesReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpGetAttributes(client);
+}
+
+static int
+SProcXpSetAttributes(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintSetAttributesReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ swapl(&stuff->stringLen, n);
+ return ProcXpSetAttributes(client);
+}
+
+static int
+SProcXpGetOneAttribute(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintGetOneAttributeReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ swapl(&stuff->nameLen, n);
+ return ProcXpGetOneAttribute(client);
+}
+
+static int
+SProcXpSelectInput(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintSelectInputReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->eventMask, n);
+ swapl(&stuff->printContext, n);
+ return ProcXpSelectInput(client);
+}
+static int
+SProcXpGetPageDimensions(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintGetPageDimensionsReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpGetPageDimensions(client);
+}
+static int
+SProcXpSetImageResolution(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintSetImageResolutionReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ swaps(&stuff->imageRes, i);
+ return ProcXpSetImageResolution(client);
+}
+static int
+SProcXpGetImageResolution(client)
+ ClientPtr client;
+{
+ long n;
+ int i;
+
+ REQUEST(xPrintGetImageResolutionReq);
+ swaps(&stuff->length, i);
+ swapl(&stuff->printContext, n);
+ return ProcXpGetImageResolution(client);
+}
+
+static void
+SwapXpNotifyEvent(src, dst)
+ xPrintPrintEvent *src, *dst;
+{
+ /*
+ * Swap the sequence number and context fields.
+ */
+ cpswaps(src->sequenceNumber, dst->sequenceNumber);
+ cpswapl(src->printContext, dst->printContext);
+
+ /*
+ * Copy the byte-long fields.
+ */
+ dst->type = src->type;
+ dst->detail = src->detail;
+ dst->cancel = src->cancel;
+}
+
+static void
+SwapXpAttributeEvent(src, dst)
+ xPrintAttributeEvent *src, *dst;
+{
+ /*
+ * Swap the sequence number and context fields.
+ */
+ cpswaps(src->sequenceNumber, dst->sequenceNumber);
+ cpswapl(src->printContext, dst->printContext);
+
+ /*
+ * Copy the byte-long fields.
+ */
+ dst->type = src->type;
+ dst->detail = src->detail;
+}
diff --git a/xc/programs/Xserver/Xext/xtest.c b/xc/programs/Xserver/Xext/xtest.c
new file mode 100644
index 000000000..379b18c49
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xtest.c
@@ -0,0 +1,552 @@
+/* $TOG: xtest.c /main/23 1998/02/09 15:26:12 kaleb $ */
+/*
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.3 1999/01/31 12:21:39 dawes Exp $ */
+
+#include "X.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "dixevents.h"
+#define _XTEST_SERVER_
+#include "XTest.h"
+#include "xteststr.h"
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#define EXTENSION_EVENT_BASE 64
+#include "extinit.h" /* LookupDeviceIntRec */
+#endif /* XINPUT */
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+static unsigned char XTestReqCode;
+
+#ifdef XINPUT
+extern int DeviceValuator;
+#endif /* XINPUT */
+
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+static int XTestSwapFakeInput(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ xReq * /* req */
+#endif
+);
+
+static DISPATCH_PROC(ProcXTestCompareCursor);
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(ProcXTestFakeInput);
+static DISPATCH_PROC(ProcXTestGetVersion);
+static DISPATCH_PROC(ProcXTestGrabControl);
+static DISPATCH_PROC(SProcXTestCompareCursor);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestFakeInput);
+static DISPATCH_PROC(SProcXTestGetVersion);
+static DISPATCH_PROC(SProcXTestGrabControl);
+
+void
+XTestExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
+ ProcXTestDispatch, SProcXTestDispatch,
+ XTestResetProc, StandardMinorOpcode)) != 0)
+ XTestReqCode = (unsigned char)extEntry->base;
+}
+
+/*ARGSUSED*/
+static void
+XTestResetProc (extEntry)
+ExtensionEntry *extEntry;
+{
+}
+
+static int
+ProcXTestGetVersion(client)
+ register ClientPtr client;
+{
+ xXTestGetVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXTestGetVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XTestMajorVersion;
+ rep.minorVersion = XTestMinorVersion;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcXTestCompareCursor(client)
+ register ClientPtr client;
+{
+ REQUEST(xXTestCompareCursorReq);
+ xXTestCompareCursorReply rep;
+ WindowPtr pWin;
+ CursorPtr pCursor;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
+ pWin = (WindowPtr)LookupWindow(stuff->window, client);
+ if (!pWin)
+ return(BadWindow);
+ if (stuff->cursor == None)
+ pCursor = NullCursor;
+ else if (stuff->cursor == XTestCurrentCursor)
+ pCursor = GetSpriteCursor();
+ else {
+ pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR);
+ if (!pCursor)
+ {
+ client->errorValue = stuff->cursor;
+ return (BadCursor);
+ }
+ }
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.same = (wCursor(pWin) == pCursor);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ }
+ WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
+ return(client->noClientException);
+}
+
+static int
+ProcXTestFakeInput(client)
+ register ClientPtr client;
+{
+ REQUEST(xXTestFakeInputReq);
+ int nev;
+ int n;
+ xEvent *ev;
+ DeviceIntPtr dev;
+ WindowPtr root;
+ int type;
+#ifdef XINPUT
+ Bool extension = FALSE;
+ deviceValuator *dv;
+ int base;
+ int *values;
+#endif /* XINPUT */
+
+ nev = (stuff->length << 2) - sizeof(xReq);
+ if ((nev % sizeof(xEvent)) || !nev)
+ return BadLength;
+ nev /= sizeof(xEvent);
+ UpdateCurrentTime();
+ ev = (xEvent *)&((xReq *)stuff)[1];
+ type = ev->u.u.type & 0177;
+#ifdef XINPUT
+ if (type >= EXTENSION_EVENT_BASE)
+ {
+ type -= DeviceValuator;
+ switch (type) {
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ case XI_DeviceMotionNotify:
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ break;
+ default:
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ if (nev == 1 && type == XI_DeviceMotionNotify)
+ return BadLength;
+ if (type == XI_DeviceMotionNotify)
+ base = ((deviceValuator *)(ev+1))->first_valuator;
+ else
+ base = 0;
+ for (n = 1; n < nev; n++)
+ {
+ dv = (deviceValuator *)(ev + n);
+ if (dv->type != DeviceValuator)
+ {
+ client->errorValue = dv->type;
+ return BadValue;
+ }
+ if (dv->first_valuator != base)
+ {
+ client->errorValue = dv->first_valuator;
+ return BadValue;
+ }
+ if (!dv->num_valuators || dv->num_valuators > 6)
+ {
+ client->errorValue = dv->num_valuators;
+ return BadValue;
+ }
+ base += dv->num_valuators;
+ }
+ type = type - XI_DeviceKeyPress + KeyPress;
+ extension = TRUE;
+ }
+ else
+#endif /* XINPUT */
+ {
+ if (nev != 1)
+ return BadLength;
+ switch (type)
+ {
+ case KeyPress:
+ case KeyRelease:
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ break;
+ default:
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ }
+ if (ev->u.keyButtonPointer.time)
+ {
+ TimeStamp activateTime;
+ CARD32 ms;
+
+ activateTime = currentTime;
+ ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
+ if (ms < activateTime.milliseconds)
+ activateTime.months++;
+ activateTime.milliseconds = ms;
+ ev->u.keyButtonPointer.time = 0;
+
+ /* see mbuf.c:QueueDisplayRequest for code similar to this */
+
+ if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
+ {
+ return BadAlloc;
+ }
+ /* swap the request back so we can simply re-execute it */
+ if (client->swapped)
+ {
+ (void) XTestSwapFakeInput(client, (xReq *)stuff);
+ swaps(&stuff->length, n);
+ }
+ ResetCurrentRequest (client);
+ client->sequence--;
+ return Success;
+ }
+#ifdef XINPUT
+ if (extension)
+ {
+ dev = LookupDeviceIntRec(stuff->deviceid & 0177);
+ if (!dev)
+ {
+ client->errorValue = stuff->deviceid & 0177;
+ return BadValue;
+ }
+ if (nev > 1)
+ {
+ dv = (deviceValuator *)(ev + 1);
+ if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes)
+ {
+ client->errorValue = dv->first_valuator;
+ return BadValue;
+ }
+ if (dv->first_valuator + dv->num_valuators >
+ dev->valuator->numAxes)
+ {
+ client->errorValue = dv->num_valuators;
+ return BadValue;
+ }
+ }
+ }
+#endif /* XINPUT */
+ switch (type)
+ {
+ case KeyPress:
+ case KeyRelease:
+#ifdef XINPUT
+ if (!extension)
+#endif /* XINPUT */
+ dev = (DeviceIntPtr)LookupKeyboardDevice();
+ if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
+ ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
+ {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
+ break;
+ case MotionNotify:
+#ifdef XINPUT
+ if (extension)
+ {
+ if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue)
+ {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
+ if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute)
+ {
+ values = dev->valuator->axisVal + dv->first_valuator;
+ for (n = 1; n < nev; n++)
+ {
+ dv = (deviceValuator *)(ev + n);
+ switch (dv->num_valuators)
+ {
+ case 6:
+ dv->valuator5 += values[5];
+ case 5:
+ dv->valuator4 += values[4];
+ case 4:
+ dv->valuator3 += values[3];
+ case 3:
+ dv->valuator2 += values[2];
+ case 2:
+ dv->valuator1 += values[1];
+ case 1:
+ dv->valuator0 += values[0];
+ }
+ values += 6;
+ }
+ }
+ break;
+ }
+#endif /* XINPUT */
+ dev = (DeviceIntPtr)LookupPointerDevice();
+ if (ev->u.keyButtonPointer.root == None)
+ root = GetCurrentRootWindow();
+ else
+ {
+ root = LookupWindow(ev->u.keyButtonPointer.root, client);
+ if (!root)
+ return BadWindow;
+ if (root->parent)
+ {
+ client->errorValue = ev->u.keyButtonPointer.root;
+ return BadValue;
+ }
+ }
+ if (ev->u.u.detail == xTrue)
+ {
+ int x, y;
+ GetSpritePosition(&x, &y);
+ ev->u.keyButtonPointer.rootX += x;
+ ev->u.keyButtonPointer.rootY += y;
+ }
+ else if (ev->u.u.detail != xFalse)
+ {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
+ if (ev->u.keyButtonPointer.rootX < 0)
+ ev->u.keyButtonPointer.rootX = 0;
+ else if (ev->u.keyButtonPointer.rootX >= root->drawable.width)
+ ev->u.keyButtonPointer.rootX = root->drawable.width - 1;
+ if (ev->u.keyButtonPointer.rootY < 0)
+ ev->u.keyButtonPointer.rootY = 0;
+ else if (ev->u.keyButtonPointer.rootY >= root->drawable.height)
+ ev->u.keyButtonPointer.rootY = root->drawable.height - 1;
+ if (root != GetCurrentRootWindow())
+ {
+ NewCurrentScreen(root->drawable.pScreen,
+ ev->u.keyButtonPointer.rootX,
+ ev->u.keyButtonPointer.rootY);
+ return client->noClientException;
+ }
+ (*root->drawable.pScreen->SetCursorPosition)
+ (root->drawable.pScreen,
+ ev->u.keyButtonPointer.rootX,
+ ev->u.keyButtonPointer.rootY, FALSE);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+#ifdef XINPUT
+ if (!extension)
+#endif /* XINPUT */
+ dev = (DeviceIntPtr)LookupPointerDevice();
+ if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
+ {
+ client->errorValue = ev->u.u.detail;
+ return BadValue;
+ }
+ break;
+ }
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ ev->u.keyButtonPointer.time = currentTime.milliseconds;
+ (*dev->public.processInputProc)(ev, dev, nev);
+ return client->noClientException;
+}
+
+static int
+ProcXTestGrabControl(client)
+ register ClientPtr client;
+{
+ REQUEST(xXTestGrabControlReq);
+
+ REQUEST_SIZE_MATCH(xXTestGrabControlReq);
+ if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
+ {
+ client->errorValue = stuff->impervious;
+ return(BadValue);
+ }
+ if (stuff->impervious)
+ MakeClientGrabImpervious(client);
+ else
+ MakeClientGrabPervious(client);
+ return(client->noClientException);
+}
+
+static int
+ProcXTestDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XTestGetVersion:
+ return ProcXTestGetVersion(client);
+ case X_XTestCompareCursor:
+ return ProcXTestCompareCursor(client);
+ case X_XTestFakeInput:
+ return ProcXTestFakeInput(client);
+ case X_XTestGrabControl:
+ return ProcXTestGrabControl(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcXTestGetVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXTestGetVersionReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXTestGetVersionReq);
+ swaps(&stuff->minorVersion, n);
+ return ProcXTestGetVersion(client);
+}
+
+static int
+SProcXTestCompareCursor(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXTestCompareCursorReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->cursor, n);
+ return ProcXTestCompareCursor(client);
+}
+
+static int
+XTestSwapFakeInput(client, req)
+ register ClientPtr client;
+ xReq *req;
+{
+ register int nev;
+ register xEvent *ev;
+ xEvent sev;
+ EventSwapPtr proc;
+
+ nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
+ for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
+ {
+ /* Swap event */
+ proc = EventSwapVector[ev->u.u.type & 0177];
+ /* no swapping proc; invalid event type? */
+ if (!proc || proc == NotImplemented) {
+ client->errorValue = ev->u.u.type;
+ return BadValue;
+ }
+ (*proc)(ev, &sev);
+ *ev = sev;
+ }
+ return Success;
+}
+
+static int
+SProcXTestFakeInput(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xReq);
+
+ swaps(&stuff->length, n);
+ n = XTestSwapFakeInput(client, stuff);
+ if (n != Success)
+ return n;
+ return ProcXTestFakeInput(client);
+}
+
+static int
+SProcXTestGrabControl(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXTestGrabControlReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXTestGrabControlReq);
+ return ProcXTestGrabControl(client);
+}
+
+static int
+SProcXTestDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XTestGetVersion:
+ return SProcXTestGetVersion(client);
+ case X_XTestCompareCursor:
+ return SProcXTestCompareCursor(client);
+ case X_XTestFakeInput:
+ return SProcXTestFakeInput(client);
+ case X_XTestGrabControl:
+ return SProcXTestGrabControl(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xc/programs/Xserver/Xext/xtest1.frags b/xc/programs/Xserver/Xext/xtest1.frags
new file mode 100644
index 000000000..bdf7943b7
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xtest1.frags
@@ -0,0 +1,90 @@
+There are several code fragments that need to be placed in the device
+dependent part of the server. These are described below. These code
+fragments are device and implementation dependent.
+
+This code fragment should go in your ddx InitInput() routine:
+
+#ifdef XTESTEXT1
+extern KeyCode xtest_command_key;
+#endif
+
+#ifdef XTESTEXT1
+ xtest_command_key = <whatever-is-a-good-keycode-for-your-keyboard>;
+#endif
+
+This code fragment should go at the front of the file that handles
+keyboards:
+
+#ifdef XTESTEXT1
+/*
+ * defined in xtestext1di.c
+ */
+extern int on_steal_input;
+extern Bool XTestStealKeyData();
+#endif XTESTEXT1
+
+This code fragment should go in the function that parses input from the
+keyboard or pointer after you know what input action has occurred, but before
+you have told the server about it. If conditionalizes the actual function
+call to pass the information on:
+
+#ifdef XTESTEXT1
+ if (!on_steal_input ||
+ XTestStealKeyData(code, direction, dev_type, x, y))
+#endif /* XTESTEXT1 */
+ handle_device_event(...);
+
+This code fragment should go in the function that handles mouse motion after
+you have figured out how much the mouse has moved:
+
+#ifdef XTESTEXT1
+ if (on_steal_input)
+ XTestStealMotionData(dx, dy, dev, x, y);
+#endif XTESTEXT1
+
+
+This code fragment should go at the front of the os-specific code where
+you wait (by doing a select on the socket in our implementation) for
+something to happen:
+
+#ifdef XTESTEXT1
+extern int playback_on;
+void XTestComputeWaitTime();
+#endif XTESTEXT1
+
+These code fragments should go in the os-specific code on both sides of
+where you wait (by doing a select on the socket in our implementation)
+for something to happen:
+
+#ifdef XTESTEXT1
+ if (playback_on)
+ XTestComputeWaitTime(wt = &waittime);
+#endif XTESTEXT1
+ ... code to do select ...
+ WakeupHandler(i, LastSelectMask);
+#ifdef XTESTEXT1
+ if (playback_on)
+ i = XTestProcessInputAction(i, &waittime);
+#endif XTESTEXT1
+
+
+You also need to implement the following routines (documentation
+is needed; for now, see server/ddx/hp/hp/x_hil.c):
+
+void
+XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
+ int dev_type;
+ int keycode;
+ int keystate;
+ int mousex;
+ int mousey;
+
+void
+XTestGetPointerPos(fmousex, fmousey)
+ short *fmousex, *fmousey;
+
+void
+XTestJumpPointer(jx, jy, dev_type)
+ int jx;
+ int jy;
+ int dev_type;
diff --git a/xc/programs/Xserver/Xext/xtest1dd.c b/xc/programs/Xserver/Xext/xtest1dd.c
new file mode 100644
index 000000000..3a0961aa5
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xtest1dd.c
@@ -0,0 +1,1648 @@
+/* $TOG: xtest1dd.c /main/15 1998/02/09 15:25:58 kaleb $ */
+/*
+ * File: xtest1dd.c
+ *
+ * This file contains the device dependent parts of the input
+ * synthesis extension.
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.2 1999/03/14 03:21:30 dawes Exp $ */
+
+/***************************************************************
+ * include files
+ ***************************************************************/
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+
+#include <stdio.h>
+#include "Xos.h"
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#define XTestSERVER_SIDE
+#include "xtestext1.h"
+
+#include "xtest1dd.h"
+
+/***************************************************************
+ * defines
+ ***************************************************************/
+
+/*
+ * the size of the fake input action array
+ */
+#define ACTION_ARRAY_SIZE 100
+
+/***************************************************************
+ * externals
+ ***************************************************************/
+
+/*
+ * Holds the xTestInputAction event type code.
+ * This is defined in xtestext1di.c.
+ */
+extern int XTestInputActionType;
+/*
+ * Holds the xTestFakeAck event type code.
+ * This is defined in xtestext1di.c.
+ */
+extern int XTestFakeAckType;
+/*
+ * used in the WriteReplyToClient macro
+ */
+extern int exclusive_steal;
+
+/***************************************************************
+ * variables
+ ***************************************************************/
+
+/*
+ * array to hold fake input actions
+ */
+struct {
+ /*
+ * holds the action type, one of: XTestDELAY_ACTION,
+ * XTestKEY_ACTION, XTestMOTION_ACTION, XTestJUMP_ACTION
+ */
+ CARD8 type;
+ /*
+ * holds the device type, in the range 0 to 15
+ */
+ CARD8 device;
+ /*
+ * for XTestKEY_ACTION type, holds the keycode
+ */
+ CARD8 keycode;
+ /*
+ * for XTestKEY_ACTION type, holds the key up/down state
+ */
+ CARD8 keystate;
+ /*
+ * for XTestMOTION_ACTION and XTestJUMP_ACTION types,
+ * holds the x and y coordinates to move the mouse to
+ */
+ int x;
+ int y;
+ /*
+ * holds the time to delay (in milliseconds) before performing
+ * the action
+ */
+ CARD32 delay_time;
+}action_array[ACTION_ARRAY_SIZE];
+
+/*
+ * write index for input action array
+ */
+static int write_index = 0;
+/*
+ * read index for input action array
+ */
+static int read_index = 0;
+/*
+ * this is where the input actions are accumulated until they are sent
+ * to a client (in a wire event)
+ */
+static xTestInputActionEvent input_action_packet;
+/*
+ * holds the index (in bytes) into the input actions buffer in the
+ * current input action event
+ */
+static int packet_index;
+/*
+ * set to 1 when the input action event is full and needs to be sent to the
+ * client
+ */
+static int input_action_event_full = 0;
+/*
+ * logical x position of the mouse during input action gathering
+ */
+short xtest_mousex;
+/*
+ * logical y position of the mouse during input action gathering
+ */
+short xtest_mousey;
+/*
+ * logical x position of the mouse during input action playback
+ */
+static short mx;
+/*
+ * logical y position of the mouse during input action playback
+ */
+static short my;
+/*
+ * logical x position of the mouse while we are reading fake input actions
+ * from the client and putting them into the fake input action array
+ */
+static short pmousex;
+/*
+ * logical y position of the mouse while we are reading fake input actions
+ * from the client and putting them into the fake input action array
+ */
+static short pmousey;
+/*
+ * The playback_on flag is set to 1 while there are input actions in the
+ * input action array. It is set to 0 when the server has received all of
+ * the user actions.
+ */
+int playback_on = 0;
+/*
+ * identity of the client using XTestGetInput to get user input actions
+ */
+ClientPtr current_xtest_client;
+/*
+ * if 1 send multiple input actions per XTestInputAction event;
+ * if 0 send one input action per XTestInputAction event
+ */
+static char packed_mode;
+/*
+ * identity of the client using the XTestFakeInput function to send some
+ * fake input actions to the server
+ */
+ClientPtr playback_client = NULL;
+/*
+ * Set to 1 when the XTestFAKE_ACK_REQUEST flag is set in a XTestFakeInput
+ * request. Set back to 0 when all of the input actions have been sent
+ * to the server.
+ */
+static int acknowledge = 0;
+/*
+ * The server's idea of the current time is saved in these variables when
+ * a XTestFakeInput request is received. It is restored when all fake input
+ * actions are sent to the server or when the playback client disconnects.
+ */
+static int saved_sec;
+static int saved_usec;
+/*
+ * Set to 1 when there is a valid time in saved_sec and saved_usec.
+ */
+static int time_saved = 0;
+/*
+ * holds the extension's notion of what the current time is while it is
+ * sending input actions to a client
+ */
+static struct timeval current_time;
+/*
+ * holds the time when the extension should place the next fake input action
+ * into the server's normal events queue
+ */
+static struct timeval play_time;
+/*
+ * set to 1 when play_time is first set, cleared to 0 when the
+ * client using the extension disconnects, or when XTestReset is called
+ */
+static char play_clock = 0;
+/*
+ * holds the amount of time left until the next input action from the
+ * input action array can be sent to the server
+ */
+static struct timeval rtime;
+/*
+ * Set to 1 after the extension is done waiting for the correct time delay
+ * for an input action to be sent to the server. Remains a 1 until the time
+ * delay for the next input action is computed. Then set to 0 if the
+ * extension has to wait for the correct time delay.
+ */
+static int go_for_next = 1;
+/*
+ * needed to restore waitime if playback is to be aborted
+ */
+static struct timeval *restorewait;
+/*
+ * tmon special command key
+ *
+ * To use the test monitor program (called tmon) efficiently, it is
+ * desirable to have the extension be able to recognize a special "trigger"
+ * key. If the extension did not do this, tmon would have to have the
+ * extension send all keyboard user input actions exclusively to tmon,
+ * only to have tmon send them right back if they were not the command key.
+ *
+ * If the extension can recognize the command key, then tmon can let the
+ * extension handle keyboard user input actions normally until the command
+ * key is pressed (and released), and only then have the extension start
+ * sending keyboard user input actions exclusively to tmon.
+ *
+ * Any key on the keyboard can be used for this command key. It is most
+ * convenient if it is a low-frequency key. If you want to generate a
+ * normal occurrance of this key to a client, just hit it twice. Tmon
+ * will recognize the first occurrance of the key, take control of the input
+ * actions, and wait for certain keys. If it sees another occurrance of the
+ * command key, it will send one occurrance of the command key to the
+ * extension, and go back to waiting.
+ *
+ * set and also referenced in device layer
+ * XXX there should be a way to set this through the protocol
+ */
+KeyCode xtest_command_key = 0;
+
+/***************************************************************
+ * function declarations
+ ***************************************************************/
+
+static void parse_key_fake(
+#if NeedFunctionPrototypes
+ XTestKeyInfo * /* fkey */
+#endif
+ );
+static void parse_motion_fake(
+#if NeedFunctionPrototypes
+ XTestMotionInfo * /* fmotion */
+#endif
+ );
+static void parse_jump_fake(
+#if NeedFunctionPrototypes
+ XTestJumpInfo * /* fjump */
+#endif
+ );
+static void parse_delay_fake(
+#if NeedFunctionPrototypes
+ XTestDelayInfo * /* tevent */
+#endif
+ );
+static void send_ack(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+static void start_play_clock(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static void compute_action_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
+static int find_residual_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
+
+static CARD16 check_time_event(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static CARD32 current_ms(
+#if NeedFunctionPrototypes
+ struct timeval * /* otime */
+#endif
+ );
+static int there_is_room(
+#if NeedFunctionPrototypes
+ int /* actsize */
+#endif
+ );
+
+/******************************************************************************
+ *
+ * stop_stealing_input
+ *
+ * Stop stealing input actions.
+ */
+void
+stop_stealing_input()
+{
+/*
+ * put any code that you might need to stop stealing input actions here
+ */
+ if (packet_index != 0)
+ {
+ /*
+ * if there is a partially full input action event waiting
+ * when this function is called, send it to the client
+ */
+ flush_input_actions();
+ }
+}
+
+/******************************************************************************
+ *
+ * steal_input
+ *
+ * Start stealing input actions and sending them to the passed-in client.
+ */
+void
+steal_input(client, mode)
+/*
+ * which client is to receive the input action events
+ */
+ClientPtr client;
+/*
+ * what input action packing mode to use. one of 0, XTestPACKED_MOTION,
+ * or XTestPACKED_ACTIONS; optionally 'or'ed with XTestEXCLUSIVE,
+ */
+CARD32 mode;
+{
+ if (packet_index != 0)
+ {
+ /*
+ * if there is a partially full input action event waiting
+ * when this function is called, send it to the client
+ */
+ flush_input_actions();
+ }
+ else
+ {
+ /*
+ * otherwise, set up a new input action event
+ */
+ input_action_packet.type = XTestInputActionType;
+ packet_index = 0;
+ }
+ /*
+ * set up the new input action packing mode
+ */
+ packed_mode = mode & ~(XTestEXCLUSIVE);
+ /*
+ * keep track of where the mouse is
+ */
+ XTestGetPointerPos(&xtest_mousex, &xtest_mousey);
+ /*
+ * keep track of which client is getting input actions
+ */
+ current_xtest_client = client;
+ /*
+ * find out what time it is
+ */
+ X_GETTIMEOFDAY(&current_time);
+ /*
+ * jump to the initial position of the mouse, using a device type of 0.
+ */
+ XTestStealJumpData(xtest_mousex, xtest_mousey, 0);
+}
+
+/******************************************************************************
+ *
+ * flush_input_actions
+ *
+ * Write the input actions event to the current requesting client
+ * and re-initialize the input action event.
+ */
+void
+flush_input_actions()
+{
+ /*
+ * pointer to the input action event
+ */
+ char *rep;
+ /*
+ * loop index
+ */
+ int i;
+
+ if (packet_index == 0)
+ {
+ /*
+ * empty input actions event
+ */
+ return;
+ }
+ else if (packet_index < XTestACTIONS_SIZE)
+ {
+ /*
+ * fill to the end of the input actions event with 0's
+ */
+ for (i = packet_index; i <XTestACTIONS_SIZE; i++)
+ {
+ input_action_packet.actions[i] = 0;
+ }
+ }
+ rep = (char *) (&input_action_packet);
+
+ /*
+ * set the serial number of the input action event
+ */
+ input_action_packet.sequenceNumber = current_xtest_client->sequence;
+ /*
+ * send the input action event to the client
+ */
+ WriteEventsToClient(current_xtest_client, 1, (xEvent *) rep);
+ /*
+ * re-initialize the input action event
+ */
+ input_action_event_full = 0;
+ input_action_packet.type = XTestInputActionType;
+ packet_index = 0;
+}
+
+/******************************************************************************
+ *
+ * XTestStealJumpData
+ *
+ * Create one or more input actions and put them in the input action
+ * event. The input actions will be an (maybe) XTestDELAY_ACTION
+ * and an XTestJUMP_ACTION.
+ */
+void
+XTestStealJumpData(jx, jy, dev_type)
+/*
+ * the x and y coordinates to jump to
+ */
+int jx;
+int jy;
+/*
+ * which device caused the jump
+ */
+int dev_type;
+{
+ XTestJumpInfo *jmp_ptr;
+ /*
+ * time delta (in ms) from previous event
+ */
+ CARD16 tchar;
+
+ /*
+ * Get the time delta from the previous event. If needed,
+ * the check_time_event routine will put an XTestDELAY_ACTION
+ * type action in the input action event.
+ */
+ tchar = check_time_event();
+ if (!there_is_room(sizeof(XTestJumpInfo)))
+ {
+ /*
+ * If there isn't room in the input action event for
+ * an XTestJUMP_ACTION, then send that event to the
+ * client and start filling an empty one.
+ */
+ flush_input_actions();
+ }
+ /*
+ * update the logical mouse position
+ */
+ xtest_mousex = jx;
+ xtest_mousey = jy;
+ /*
+ * point jmp_ptr to the correct place in the input action event
+ */
+ jmp_ptr = (XTestJumpInfo *)
+ &(input_action_packet.actions[packet_index]);
+ /*
+ * compute the input action header
+ */
+ jmp_ptr->header = (XTestPackDeviceID(dev_type) | XTestJUMP_ACTION);
+ /*
+ * set the x and y coordinates to jump to in the input action
+ */
+ jmp_ptr->jumpx = jx;
+ jmp_ptr->jumpy = jy;
+ /*
+ * set the delay time in the input action
+ */
+ jmp_ptr->delay_time = tchar;
+ /*
+ * increment the packet index by the size of the input action
+ */
+ packet_index = packet_index + sizeof(XTestJumpInfo);
+ if (packed_mode == 0)
+ {
+ /*
+ * if input actions are not packed, send the input
+ * action event to the client
+ */
+ flush_input_actions();
+ }
+}
+
+/******************************************************************************
+ *
+ * current_ms
+ *
+ * Returns the number of milliseconds from the passed-in time to the
+ * current time, and then updates the passed-in time to the current time.
+ */
+static CARD32
+current_ms(otime)
+struct timeval *otime;
+{
+ struct timeval tval;
+ unsigned long the_ms;
+ unsigned long sec;
+ unsigned long usec;
+
+ /*
+ * get the current time
+ */
+ X_GETTIMEOFDAY(&tval);
+ if (tval.tv_usec < otime->tv_usec)
+ {
+ /*
+ * borrow a second's worth of microseconds if needed
+ */
+ usec = tval.tv_usec - otime->tv_usec + 1000000;
+ sec = tval.tv_sec - 1 - otime->tv_sec;
+ }
+ else
+ {
+ usec = tval.tv_usec - otime->tv_usec;
+ sec = tval.tv_sec - otime->tv_sec;
+ }
+ /*
+ * update the passed-in time to the new time
+ */
+ *otime = tval;
+ /*
+ * compute the number of milliseconds contained in
+ * 'sec' seconds and 'usec' microseconds
+ */
+ the_ms = (sec * 1000000L + usec) / 1000L;
+ return (the_ms);
+}
+
+/******************************************************************************
+ *
+ * check_time_event
+ *
+ * If time delta is > XTestSHORT_DELAY_TIME then insert a time event
+ * and return 0; else return the delay time.
+ */
+static CARD16
+check_time_event()
+{
+ CARD32 tstamp;
+ CARD16 tchar;
+ XTestDelayInfo *tptr;
+
+ /*
+ * get the number of milliseconds between input actions
+ */
+ tstamp = current_ms(&current_time);
+ /*
+ * if the number of milliseconds is too large to fit in a CARD16,
+ * then add a XTestDELAY_ACTION to the input action event.
+ */
+ if (tstamp > XTestSHORT_DELAY_TIME)
+ {
+ /*
+ * If there isn't room in the input action event for
+ * an XTestDELAY_ACTION, then send that event to the
+ * client and start filling an empty one.
+ */
+ if (!there_is_room(sizeof(XTestDelayInfo)))
+ {
+ flush_input_actions();
+ }
+ /*
+ * point tptr to the correct place in the input action event
+ */
+ tptr = (XTestDelayInfo *)
+ (&(input_action_packet.actions[packet_index]));
+ /*
+ * compute the input action header
+ */
+ tptr->header = XTestPackDeviceID(XTestDELAY_DEVICE_ID) |
+ XTestDELAY_ACTION;
+ /*
+ * set the delay time in the input action
+ */
+ tptr->delay_time = tstamp;
+ /*
+ * increment the packet index by the size of the input action
+ */
+ packet_index = packet_index + (sizeof(XTestDelayInfo));
+ if (packed_mode != XTestPACKED_ACTIONS)
+ {
+ /*
+ * if input actions are not packed, send the input
+ * action event to the client
+ */
+ flush_input_actions();
+ }
+ /*
+ * set the returned delay time to 0
+ */
+ tchar = 0;
+ }
+ else
+ {
+ /*
+ * set the returned delay time to the computed delay time
+ */
+ tchar = tstamp;
+ }
+ return(tchar);
+}
+
+/******************************************************************************
+ *
+ * there_is_room
+ *
+ * Checks if there is room in the input_action_packet for an input action
+ * of the size actsize bytes. Returns 1 if there is space, 0 otherwise.
+ *
+ */
+static int
+there_is_room(actsize)
+/*
+ * the number of bytes of space needed
+ */
+int actsize;
+{
+ if ((packet_index + actsize) > XTestACTIONS_SIZE)
+ {
+ input_action_event_full = 1;
+ return(0);
+ }
+ else
+ {
+ return(1);
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestStealMotionData
+ *
+ * Put motion information from the locator into an input action.
+ *
+ * called from x_hil.c
+ */
+void
+XTestStealMotionData(dx, dy, dev_type, mx, my)
+/*
+ * the x and y delta motion of the locator
+ */
+int dx;
+int dy;
+/*
+ * which locator did the moving
+ */
+int dev_type;
+/*
+ * the x and y position of the locator before the delta motion
+ */
+int mx;
+int my;
+{
+ /*
+ * pointer to a XTestMOTION_ACTION input action
+ */
+ XTestMotionInfo *fm;
+ /*
+ * time delta from previous event
+ */
+ CARD16 tchar;
+
+ /*
+ * if the current position of the locator is not the same as
+ * the logical position, then update the logical position
+ */
+ if ((mx != xtest_mousex) || (my != xtest_mousey))
+ {
+ XTestStealJumpData(mx, my, dev_type);
+ }
+ /*
+ * if the delta motion is outside the range that can
+ * be held in a motion input action, use a jump input action
+ */
+ if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
+ (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
+ {
+ XTestStealJumpData((xtest_mousex + dx),
+ (xtest_mousey + dy), dev_type);
+ }
+ else
+ {
+ /*
+ * compute the new logical position of the mouse
+ */
+ xtest_mousex += dx;
+ xtest_mousey += dy;
+ /*
+ * Get the time delta from the previous event. If needed,
+ * the check_time_event routine will put an XTestDELAY_ACTION
+ * type action in the input action event.
+ */
+ tchar = check_time_event();
+ /*
+ * If there isn't room in the input action event for
+ * an XTestDELAY_ACTION, then send that event to the
+ * client and start filling an empty one.
+ */
+ if (!there_is_room(sizeof(XTestMotionInfo)))
+ {
+ flush_input_actions();
+ /*
+ * point fm to the correct place in the input action event
+ */
+ }
+ fm = (XTestMotionInfo *)
+ &(input_action_packet.actions[packet_index]);
+ /*
+ * compute the input action header
+ */
+ fm->header = XTestMOTION_ACTION;
+ if (dx < 0)
+ {
+ fm->header |= XTestX_NEGATIVE;
+ dx = abs(dx);
+ }
+ if (dy < 0)
+ {
+ fm->header |= XTestY_NEGATIVE;
+ dy = abs(dy);
+ }
+ fm->header |= XTestPackDeviceID(dev_type);
+ /*
+ * compute the motion data byte
+ */
+ fm->motion_data = XTestPackYMotionValue(dy);
+ fm->motion_data |= XTestPackXMotionValue(dx);
+ /*
+ * set the delay time in the input action
+ */
+ fm->delay_time = tchar;
+ /*
+ * increment the packet index by the size of the input action
+ */
+ packet_index = packet_index + sizeof(XTestMotionInfo);
+ if (packed_mode == 0)
+ {
+ /*
+ * if input actions are not packed, send the input
+ * action event to the client
+ */
+ flush_input_actions();
+ }
+
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestStealKeyData
+ *
+ * Place this key data in the input_action_packet.
+ *
+ */
+Bool
+XTestStealKeyData(keycode, keystate, dev_type, locx, locy)
+/*
+ * which key/button moved
+ */
+unsigned keycode;
+/*
+ * whether the key/button was pressed or released
+ */
+int keystate;
+/*
+ * which device caused the input action
+ */
+int dev_type;
+/*
+ * the x and y coordinates of the locator when the action happenned
+ */
+int locx;
+int locy;
+{
+ /*
+ * pointer to key/button motion input action
+ */
+ XTestKeyInfo *kp;
+ /*
+ * time delta from previous event
+ */
+ CARD16 tchar;
+ char keytrans;
+
+ /*
+ * update the logical position of the locator if the physical position
+ * of the locator is not the same as the logical position.
+ */
+ if ((locx != xtest_mousex) || (locy != xtest_mousey))
+ {
+ XTestStealJumpData(locx, locy, dev_type);
+ }
+ /*
+ * Get the time delta from the previous event. If needed,
+ * the check_time_event routine will put an XTestDELAY_ACTION
+ * type action in the input action event.
+ */
+ tchar = check_time_event();
+ if (!there_is_room(sizeof(XTestKeyInfo)))
+ {
+ /*
+ * If there isn't room in the input action event for
+ * an XTestDELAY_ACTION, then send that event to the
+ * client and start filling an empty one.
+ */
+ flush_input_actions();
+ }
+ /*
+ * point kp to the correct place in the input action event
+ */
+ kp = (XTestKeyInfo *)
+ (&(input_action_packet.actions[packet_index]));
+ /*
+ * compute the input action header
+ */
+ kp->header = XTestPackDeviceID(dev_type);
+ if ((keystate == KeyRelease) || (keystate == ButtonRelease))
+ {
+ keytrans = XTestKEY_UP;
+ }
+ else if ((keystate == KeyPress) || (keystate == ButtonPress))
+ {
+ keytrans = XTestKEY_DOWN;
+ }
+ else
+ {
+ printf("%s: invalid key/button state %d.\n",
+ XTestEXTENSION_NAME,
+ keystate);
+ }
+ kp->header = kp->header | keytrans | XTestKEY_ACTION;
+ /*
+ * set the keycode in the input action
+ */
+ kp->keycode = keycode;
+ /*
+ * set the delay time in the input action
+ */
+ kp->delay_time = tchar;
+ /*
+ * increment the packet index by the size of the input action
+ */
+ packet_index = packet_index + sizeof(XTestKeyInfo);
+ /*
+ * if the command key has been released or input actions are not
+ * packed, send the input action event to the client
+ */
+ if(((keycode == xtest_command_key) && (keystate == KeyRelease)) ||
+ (packed_mode != XTestPACKED_ACTIONS))
+ {
+ flush_input_actions();
+ }
+ /* return TRUE if the event should be passed on to DIX */
+ if (exclusive_steal)
+ return ((keystate == KeyRelease) &&
+ (keycode == xtest_command_key));
+ else
+ return ((keystate != KeyRelease) ||
+ (keycode != xtest_command_key));
+}
+
+/******************************************************************************
+ *
+ * parse_fake_input
+ *
+ * Parsing routine for a XTestFakeInput request. It will take a request
+ * and parse its contents into the input action array. Eventually the
+ * XTestProcessInputAction routine will be called to take input actions
+ * from the input action array and send them to the server to be handled.
+ */
+void
+parse_fake_input(client, req)
+/*
+ * which client did the XTestFakeInput request
+ */
+ClientPtr client;
+/*
+ * a pointer to the xTestFakeInputReq structure sent by the client
+ */
+char *req;
+{
+ /*
+ * if set to 1, done processing input actions from the request
+ */
+ int done = 0;
+ /*
+ * type of input action
+ */
+ CARD8 action_type;
+ /*
+ * device type
+ */
+ CARD8 dev_type;
+ /*
+ * pointer to an xTestFakeInputReq structure
+ */
+ xTestFakeInputReq *request;
+ /*
+ * holds the index into the action list in the request
+ */
+ int parse_index;
+
+ /*
+ * get a correct-type pointer to the client-supplied request data
+ */
+ request = (xTestFakeInputReq *) req;
+ /*
+ * save the acknowledge requested state for use in
+ * XTestProcessInputAction
+ */
+ acknowledge = request->ack;
+ /*
+ * set up an index into the action list in the request
+ */
+ parse_index = 0;
+ if (write_index >= ACTION_ARRAY_SIZE)
+ {
+ /*
+ * if the input action array is full, don't add any more
+ */
+ done = 1;
+ }
+ while (!done)
+ {
+ /*
+ * get the type of input action in the list
+ */
+ action_type = (request->action_list[parse_index])
+ & XTestACTION_TYPE_MASK;
+ /*
+ * get the type of device in the list
+ */
+ dev_type = XTestUnpackDeviceID(request->action_list[parse_index]);
+ /*
+ * process the input action appropriately
+ */
+ switch (action_type)
+ {
+ case XTestKEY_ACTION:
+ parse_key_fake((XTestKeyInfo *)
+ &(request->action_list[parse_index]));
+ parse_index = parse_index + sizeof(XTestKeyInfo);
+ break;
+ case XTestMOTION_ACTION:
+ parse_motion_fake((XTestMotionInfo *)
+ &(request->action_list[parse_index]));
+ parse_index = parse_index + sizeof(XTestMotionInfo);
+ break;
+ case XTestJUMP_ACTION:
+ parse_jump_fake((XTestJumpInfo *)
+ &(request->action_list[parse_index]));
+ parse_index = parse_index + sizeof(XTestJumpInfo);
+ break;
+ case XTestDELAY_ACTION:
+ if (dev_type == XTestDELAY_DEVICE_ID)
+ {
+ parse_delay_fake((XTestDelayInfo *)
+ &(request->action_list[parse_index]));
+ parse_index = parse_index +
+ sizeof(XTestDelayInfo);
+ }
+ else
+ {
+ /*
+ * An invalid input action header byte has
+ * been detected, so there are no more
+ * input actions in this request.
+ * The intended invalid action header byte
+ * for this case should have a value of 0.
+ */
+ done = 1;
+ }
+ break;
+ }
+ if (parse_index >= XTestMAX_ACTION_LIST_SIZE)
+ {
+ /*
+ * entire XTestFakeInput request has been processed
+ */
+ done = 1;
+ }
+ if (write_index >= ACTION_ARRAY_SIZE)
+ {
+ /*
+ * no room in the input actions array
+ */
+ done = 1;
+ }
+ }
+ if (write_index > read_index)
+ {
+ /*
+ * there are fake input actions in the input action array
+ * to be given to the server
+ */
+ playback_on = 1;
+ playback_client = client;
+ }
+}
+
+/******************************************************************************
+ *
+ * parse_key_fake
+ *
+ * Called from parse_fake_input.
+ *
+ * Copy the fake key input action from its packed form into the array of
+ * pending input events.
+ */
+static void
+parse_key_fake(fkey)
+XTestKeyInfo *fkey;
+{
+ action_array[write_index].type = XTestKEY_ACTION;
+ action_array[write_index].device = XTestUnpackDeviceID(fkey->header);
+ action_array[write_index].keycode = fkey->keycode;
+ action_array[write_index].keystate = fkey->header & XTestKEY_STATE_MASK;
+ action_array[write_index].delay_time = fkey->delay_time;
+ write_index++;
+}
+
+/******************************************************************************
+ *
+ * parse_motion_fake
+ *
+ * Called from parse_fake_input.
+ *
+ * Copy the fake motion input action from its packed form into the array of
+ * pending input events.
+ */
+static void
+parse_motion_fake(fmotion)
+XTestMotionInfo *fmotion;
+{
+ int dx;
+ int dy;
+
+ dx = (XTestUnpackXMotionValue(fmotion->motion_data));
+ dy = (XTestUnpackYMotionValue(fmotion->motion_data));
+ if (((fmotion->header) & XTestX_SIGN_BIT_MASK) == XTestX_NEGATIVE)
+ {
+ pmousex -= dx;
+ }
+ else
+ {
+ pmousex += dx;
+ }
+ if (((fmotion->header) & XTestY_SIGN_BIT_MASK) == XTestY_NEGATIVE)
+ {
+ pmousey -= dy;
+ }
+ else
+ {
+ pmousey += dy;
+ }
+ action_array[write_index].type = XTestJUMP_ACTION;
+ action_array[write_index].device = XTestUnpackDeviceID(fmotion->header);
+ action_array[write_index].x = pmousex;
+ action_array[write_index].y = pmousey;
+ action_array[write_index].delay_time = fmotion->delay_time;
+ write_index++;
+}
+
+/******************************************************************************
+ *
+ * parse_jump_fake
+ *
+ * Called from parse_fake_input.
+ *
+ * Copy the fake jump input action from its packed form into the array of
+ * pending input events.
+ */
+static void
+parse_jump_fake(fjump)
+XTestJumpInfo *fjump;
+{
+ pmousex = fjump->jumpx;
+ pmousey = fjump->jumpy;
+ action_array[write_index].type = XTestJUMP_ACTION;
+ action_array[write_index].device = XTestUnpackDeviceID(fjump->header);
+ action_array[write_index].x = pmousex;
+ action_array[write_index].y = pmousey;
+ action_array[write_index].delay_time = fjump->delay_time;
+ write_index++;
+}
+
+/******************************************************************************
+ *
+ * parse_delay_fake
+ *
+ * Called from parse_fake_input.
+ *
+ * Copy the fake delay input action from its packed form into the array of
+ * pending input events.
+ */
+static void
+parse_delay_fake(tevent)
+XTestDelayInfo *tevent;
+{
+ action_array[write_index].type = XTestDELAY_ACTION;
+ action_array[write_index].delay_time = tevent->delay_time;
+ write_index++;
+}
+
+/******************************************************************************
+ *
+ * XTestComputeWaitTime
+ *
+ * Compute the amount of time the server should wait before sending the
+ * next monitor event in playback mode.
+ */
+void
+XTestComputeWaitTime(waittime)
+struct timeval *waittime;
+{
+ /*
+ * The playback_on flag is set to 1 in parse_fake_input. It is set to
+ * 0 in XTestProcessInputAction if the server has replayed all input
+ * actions.
+ */
+ if (playback_on)
+ {
+ if (!play_clock)
+ {
+ /*
+ * if the playback clock has never been set,
+ * then do it now
+ */
+ start_play_clock();
+ }
+ /*
+ * We need to save the waittime the first time through. This
+ * is a value the server uses, and we have to restore it when
+ * all of the input actions are processed by the server.
+ */
+ if (!time_saved)
+ {
+ saved_sec = waittime->tv_sec;
+ saved_usec = waittime->tv_usec;
+ time_saved = 1;
+ }
+ if (go_for_next)
+ {
+ /*
+ * if we just processed an input action, figure out
+ * how long to wait for the next input action
+ */
+ compute_action_time(&rtime);
+ }
+ else
+ {
+ /*
+ * else just find out how much more time to wait
+ * on the current input action
+ */
+ (void)find_residual_time(&rtime);
+ }
+ waittime->tv_sec = rtime.tv_sec;
+ waittime->tv_usec = rtime.tv_usec;
+ }
+}
+
+/******************************************************************************
+ *
+ * XTestProcessInputAction
+ *
+ * If there are any input actions in the input action array,
+ * then take one out and process it.
+ *
+ */
+int
+XTestProcessInputAction(readable, waittime)
+/*
+ * This is the value that a 'select' function returned just before this
+ * routine was called. If the select timed out, this value will be 0.
+ *
+ * This extension modifies the select call's timeout value to cause the
+ * select to time out when the next input action is ready to given to
+ * the server. This routine is called immediately after the select, to
+ * give it a chance to process an input action. If we have an input action
+ * to process and the only reason that the select returned was because it
+ * timed out, then we change the select value to 1 and return 1 instead of 0.
+ */
+int readable;
+/*
+ * this is the timeout value that the select was called with
+ */
+struct timeval *waittime;
+{
+int mousex, mousey;
+ /*
+ * if playback_on is 0, then the input action array is empty
+ */
+ if (playback_on)
+ {
+ restorewait = waittime;
+ /*
+ * figure out if we need to wait for the next input action
+ */
+ if (find_residual_time(&rtime) > 0)
+ {
+ /*
+ * still have to wait before processing the current
+ * input action
+ */
+ go_for_next = 0;
+ }
+ else
+ {
+ /*
+ * don't have to wait any longer before processing
+ * the current input action
+ */
+ go_for_next = 1;
+ }
+ /*
+ * if we have an input action to process and the only reason
+ * that the select returned was because it timed out, then we
+ * change the select value to 1 and return 1 instead of 0
+ */
+ if (readable == 0)
+ {
+ readable++;
+ }
+ /*
+ * if we don't need to wait, then get an input action from
+ * the input action array and process it
+ */
+ if (go_for_next)
+ {
+ /*
+ * There are three possible types of input actions in
+ * the input action array (motion input actions are
+ * converted to jump input actions before being put
+ * into the input action array). Delay input actions
+ * are processed by the compute_action_time function
+ * which is called from XTestComputeWaitTime. The
+ * other two types of input actions are processed here.
+ */
+ if (action_array[read_index].type == XTestJUMP_ACTION)
+ {
+ XTestJumpPointer(
+ action_array[read_index].x,
+ action_array[read_index].y,
+ action_array[read_index].device);
+ mx = action_array[read_index].x;
+ my = action_array[read_index].y;
+ }
+ if (action_array[read_index].type == XTestKEY_ACTION)
+ {
+ GetSpritePosition(&mousex, &mousey);
+ XTestGenerateEvent(
+ action_array[read_index].device,
+ action_array[read_index].keycode,
+ action_array[read_index].keystate,
+ mousex,
+ mousey);
+ }
+ read_index++;
+ /*
+ * if all input actions are processed, then restore
+ * the server state
+ */
+ if (read_index >= write_index)
+ {
+ waittime->tv_sec = saved_sec;
+ waittime->tv_usec = saved_usec;
+ time_saved = 0;
+ playback_on = 0;
+ if (acknowledge)
+ {
+ /*
+ * if the playback client is waiting
+ * for an xTestFakeAck event, send
+ * it to him
+ */
+ send_ack(playback_client);
+ acknowledge = 0;
+ }
+ write_index = 0;
+ read_index = 0;
+ playback_client = (ClientPtr) NULL;
+ play_clock = 0;
+ }
+ }
+ }
+ return(readable);
+}
+
+/******************************************************************************
+ *
+ * send_ack
+ *
+ * send an xTestFakeAck event to the client
+ */
+static void
+send_ack(client)
+ClientPtr client;
+{
+ xTestFakeAckEvent rep;
+
+ /*
+ * set the serial number of the xTestFakeAck event
+ */
+ rep.sequenceNumber = client->sequence;
+ rep.type = XTestFakeAckType;
+ WriteEventsToClient(client, 1, (xEvent *) &rep);
+}
+
+/******************************************************************************
+ *
+ * start_play_clock
+ *
+ * start the clock for play back.
+ */
+static void
+start_play_clock()
+{
+ X_GETTIMEOFDAY(&play_time);
+ /*
+ * flag that play_time is valid
+ */
+ play_clock = 1;
+}
+
+/******************************************************************************
+ *
+ * compute_action_time
+ *
+ * Set the play clock to the time when the next input action should be put
+ * into the server's input queue. Fill the rtime structure with values
+ * for the delta until the time for the next input action.
+ */
+static void
+compute_action_time(rtime)
+struct timeval *rtime;
+{
+ /*
+ * holds the delay time in milliseconds
+ */
+ unsigned long dtime;
+ /*
+ * holds the number of microseconds in the sum of the dtime value
+ * and the play_time value
+ */
+ unsigned long tot_usec;
+ /*
+ * holds the number of seconds and microseconds in the
+ * dtime value
+ */
+ unsigned long sec;
+ unsigned long usec;
+ /*
+ * holds the current time
+ */
+ struct timeval btime;
+
+ /*
+ * Put the time from the current input action in dtime
+ */
+ dtime = action_array[read_index].delay_time;
+ /*
+ * If the current input action is a delay input action,
+ * add in the time from the following input action.
+ */
+ if ((action_array[read_index].type == XTestDELAY_ACTION) &&
+ ((read_index + 1) < write_index))
+ {
+ read_index++;
+ dtime = dtime + action_array[read_index].delay_time;
+ }
+ /*
+ * compute the number of seconds and microseconds in the
+ * dtime value
+ */
+ sec = dtime / 1000;
+ usec = (dtime % 1000) * 1000;
+ /*
+ * get the current time in btime
+ */
+ X_GETTIMEOFDAY(&btime);
+ /*
+ * compute the number of microseconds in the sum of the dtime value
+ * and the current usec value
+ */
+ tot_usec = btime.tv_usec + usec;
+ /*
+ * if it is greater than one second's worth, adjust the seconds
+ */
+ if (tot_usec >= 1000000)
+ {
+ tot_usec -= 1000000;
+ sec++;
+ }
+ play_time.tv_usec = tot_usec;
+ play_time.tv_sec = btime.tv_sec + sec;
+ /*
+ * put the time until the next input action in rtime
+ */
+ rtime->tv_sec = sec;
+ rtime->tv_usec = usec;
+}
+
+/******************************************************************************
+ *
+ * find_residual_time
+ *
+ * Find the time interval from the current time to the value in play_time.
+ * This is the time to wait till putting the next input action into the
+ * server's input queue. If the time is already up, reset play_time to
+ * the current time.
+ */
+static int
+find_residual_time(the_residual)
+struct timeval *the_residual;
+{
+ /*
+ * if > 0, there is time to wait. If < 0, then don't wait
+ */
+ int wait = 1;
+ /*
+ * holds the current time
+ */
+ struct timeval btime;
+ /*
+ * holds the current time in seconds and microseconds
+ */
+ unsigned long bsec;
+ unsigned long busec;
+ /*
+ * holds the playback time in seconds and microseconds
+ */
+ unsigned long psec;
+ unsigned long pusec;
+
+ /*
+ * get the current time in btime
+ */
+ X_GETTIMEOFDAY(&btime);
+ /*
+ * get the current time in seconds and microseconds
+ */
+ bsec = btime.tv_sec;
+ busec = btime.tv_usec;
+ /*
+ * get the playback time in seconds and microseconds
+ */
+ psec = play_time.tv_sec;
+ pusec = play_time.tv_usec;
+ /*
+ * if the current time is already later than the playback time,
+ * we don't need to wait
+ */
+ if (bsec > psec)
+ {
+ wait = -1;
+ }
+ else
+ {
+ if (bsec == psec)
+ {
+ /*
+ * if the current and playback times have the same
+ * second value, then compare the microsecond values
+ */
+ if ( busec >= pusec)
+ {
+ /*
+ * if the current time is already later than
+ * the playback time, we don't need to wait
+ */
+ wait = -1;
+ }
+ else
+ {
+ the_residual->tv_usec = pusec - busec;
+ the_residual->tv_sec = 0;
+ }
+ }
+ else
+ {
+ if (busec > pusec)
+ {
+ /*
+ * 'borrow' a second's worth of microseconds
+ * from the seconds left to wait
+ */
+ the_residual->tv_usec = 1000000 - busec + pusec;
+ psec--;
+ the_residual->tv_sec = psec - bsec;
+ }
+ else
+ {
+ the_residual->tv_sec = psec - bsec;
+ the_residual->tv_usec = pusec - busec;
+ }
+ }
+ }
+ if (wait < 0)
+ {
+ /*
+ * if don't need to wait, set the playback time
+ * to the current time
+ */
+ X_GETTIMEOFDAY(&play_time);
+ /*
+ * set the time to wait to 0
+ */
+ the_residual->tv_sec = 0;
+ the_residual->tv_usec = 0;
+ }
+ return(wait);
+}
+
+/******************************************************************************
+ *
+ * abort_play_back
+ */
+void
+abort_play_back()
+{
+ /*
+ * If we were playing back input actions at the time of the abort,
+ * restore the original wait time for the select in the main wait
+ * loop of the server
+ */
+ if (playback_on)
+ {
+ restorewait->tv_sec = saved_sec;
+ restorewait->tv_usec = saved_usec;
+ }
+ /*
+ * make the input action array empty
+ */
+ read_index = 0;
+ write_index = 0;
+ /*
+ * we are no longer playing back anything
+ */
+ playback_on = 0;
+ play_clock = 0;
+ go_for_next = 1;
+ /*
+ * there is no valid wait time saved any more
+ */
+ time_saved = 0;
+ /*
+ * there are no valid clients using this extension
+ */
+ playback_client = (ClientPtr) NULL;
+ current_xtest_client = (ClientPtr) NULL;
+}
+
+/******************************************************************************
+ *
+ * return_input_array_size
+ *
+ * Return the number of input actions in the input action array.
+ */
+void
+return_input_array_size(client)
+/*
+ * which client to send the reply to
+ */
+ClientPtr client;
+{
+ xTestQueryInputSizeReply rep;
+
+ rep.type = X_Reply;
+ /*
+ * set the serial number of the reply
+ */
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.size_return = ACTION_ARRAY_SIZE;
+ WriteReplyToClient(client,
+ sizeof(xTestQueryInputSizeReply),
+ (pointer) &rep);
+}
diff --git a/xc/programs/Xserver/Xext/xtest1dd.h b/xc/programs/Xserver/Xext/xtest1dd.h
new file mode 100644
index 000000000..17d891fdc
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xtest1dd.h
@@ -0,0 +1,126 @@
+/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.h,v 3.1 1999/03/14 03:21:30 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef XTEST1DD_H
+#define XTEST1DD_H 1
+
+extern short xtest_mousex;
+extern short xtest_mousey;
+extern int playback_on;
+extern ClientPtr current_xtest_client;
+extern ClientPtr playback_client;
+extern KeyCode xtest_command_key;
+
+extern void stop_stealing_input(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void
+steal_input(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ CARD32 /* mode */
+#endif
+);
+
+extern void
+flush_input_actions(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void
+XTestStealJumpData(
+#if NeedFunctionPrototypes
+ int /* jx */,
+ int /* jy */,
+ int /* dev_type */
+#endif
+);
+
+extern void
+XTestStealMotionData(
+#if NeedFunctionPrototypes
+ int /* dx */,
+ int /* dy */,
+ int /* dev_type */,
+ int /* mx */,
+ int /* my */
+#endif
+);
+
+extern Bool
+XTestStealKeyData(
+#if NeedFunctionPrototypes
+ unsigned /* keycode */,
+ int /* keystate */,
+ int /* dev_type */,
+ int /* locx */,
+ int /* locy */
+#endif
+);
+
+extern void
+parse_fake_input(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ char * /* req */
+#endif
+);
+
+extern void
+XTestComputeWaitTime(
+#if NeedFunctionPrototypes
+ struct timeval * /* waittime */
+#endif
+);
+
+extern int
+XTestProcessInputAction(
+#if NeedFunctionPrototypes
+ int /* readable */,
+ struct timeval * /* waittime */
+#endif
+);
+
+extern void
+abort_play_back(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void
+return_input_array_size(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+);
+
+#endif /* XTEST1DD_H */
diff --git a/xc/programs/Xserver/Xext/xtest1di.c b/xc/programs/Xserver/Xext/xtest1di.c
new file mode 100644
index 000000000..f5f359239
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xtest1di.c
@@ -0,0 +1,969 @@
+/* $TOG: xtest1di.c /main/14 1998/02/09 15:26:04 kaleb $ */
+/*
+ * File: xtest1di.c
+ *
+ * This file contains the device independent parts of the input
+ * synthesis extension.
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.1 1998/10/04 09:36:54 dawes Exp $ */
+
+/*****************************************************************************
+ * include files
+ ****************************************************************************/
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "gcstruct.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "opaque.h"
+#define XTestSERVER_SIDE
+#include "xtestext1.h"
+
+#include "xtest1dd.h"
+
+/*****************************************************************************
+ * defines
+ ****************************************************************************/
+
+/*****************************************************************************
+ * externals
+ ****************************************************************************/
+
+/*
+ * id of client using XTestGetInput
+ *
+ * defined in xtest1dd.c
+ */
+extern ClientPtr current_xtest_client;
+/*
+ * id of client using XTestFakeInput
+ *
+ * defined in xtest1dd.c
+ */
+extern ClientPtr playback_client;
+
+/*****************************************************************************
+ * variables
+ ****************************************************************************/
+
+/*
+ * Holds the request type code for this extension. The request type code
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial value given below will be added to the base request
+ * code that is aquired when this extension is installed.
+ */
+static int XTestReqCode = 0;
+/*
+ * Holds the two event type codes for this extension. The event type codes
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial values given below will be added to the base event
+ * code that is aquired when this extension is installed.
+ */
+int XTestInputActionType = 0;
+int XTestFakeAckType = 1;
+/*
+ * true => monitor stealing input
+ */
+int on_steal_input = FALSE;
+/*
+ * true => monitor alone getting input
+ */
+int exclusive_steal = FALSE;
+/*
+ * holds the resource type assigned to this extension
+ */
+static RESTYPE XTestType;
+/*
+ * holds the resource ID for the client currently using XTestGetInput
+ */
+static XID current_client_id;
+
+/*****************************************************************************
+ * function declarations
+ ****************************************************************************/
+
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(ProcTestFakeInput);
+static DISPATCH_PROC(SProcTestFakeInput);
+static DISPATCH_PROC(ProcTestGetInput);
+static DISPATCH_PROC(SProcTestGetInput);
+static DISPATCH_PROC(ProcTestStopInput);
+static DISPATCH_PROC(SProcTestStopInput);
+static DISPATCH_PROC(ProcTestReset);
+static DISPATCH_PROC(SProcTestReset);
+static DISPATCH_PROC(ProcTestQueryInputSize);
+static DISPATCH_PROC(SProcTestQueryInputSize);
+
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* unused */
+#endif
+ );
+static void SReplyXTestDispatch(
+#if NeedFunctionPrototypes
+ ClientPtr /* client_ptr */,
+ int /* size */,
+ char * /* reply_ptr */
+#endif
+ );
+static void SEventXTestDispatch(
+#if NeedFunctionPrototypes
+ xEvent * /* from */,
+ xEvent * /* to */
+#endif
+ );
+
+static int XTestCurrentClientGone(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
+/*****************************************************************************
+ *
+ * XTestExtension1Init
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ * XTestExtension1Init has no events or errors
+ * (other than the core errors).
+ */
+void
+XTestExtension1Init()
+{
+ /*
+ * holds the pointer to the extension entry structure
+ */
+ ExtensionEntry *extEntry;
+
+ extEntry = AddExtension(XTestEXTENSION_NAME,
+ XTestEVENT_COUNT,
+ 0,
+ ProcXTestDispatch,
+ SProcXTestDispatch,
+ XTestResetProc,
+ StandardMinorOpcode);
+ if (extEntry)
+ {
+ /*
+ * remember the request code assigned to this extension
+ */
+ XTestReqCode = extEntry->base;
+ /*
+ * make an atom saying that this extension is present
+ */
+ (void) MakeAtom(XTestEXTENSION_NAME,
+ strlen(XTestEXTENSION_NAME),
+ TRUE);
+ /*
+ * remember the event codes assigned to this extension
+ */
+ XTestInputActionType += extEntry->eventBase;
+ XTestFakeAckType += extEntry->eventBase;
+ /*
+ * install the routine to handle byte-swapping the replies
+ * for this extension in the ReplySwapVector table
+ */
+ ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
+ /*
+ * install the routine to handle byte-swapping the events
+ * for this extension in the EventSwapVector table
+ */
+ EventSwapVector[XTestInputActionType] = SEventXTestDispatch;
+ EventSwapVector[XTestFakeAckType] = SEventXTestDispatch;
+ /*
+ * get the resource type for this extension
+ */
+ XTestType = CreateNewResourceType(XTestCurrentClientGone);
+ if (XTestType == 0)
+ {
+ FatalError("XTestExtension1Init: CreateNewResourceType failed\n");
+ }
+ }
+ else
+ {
+ FatalError("XTestExtension1Init: AddExtensions failed\n");
+ }
+}
+
+/*****************************************************************************
+ *
+ * ProcXTestDispatch
+ *
+ *
+ */
+static int
+ProcXTestDispatch(client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ if (stuff->data == X_TestFakeInput)
+ {
+ return(ProcTestFakeInput(client));
+ }
+ else if (stuff->data == X_TestGetInput)
+ {
+ return(ProcTestGetInput(client));
+ }
+ else if (stuff->data == X_TestStopInput)
+ {
+ return(ProcTestStopInput(client));
+ }
+ else if (stuff->data == X_TestReset)
+ {
+ return(ProcTestReset(client));
+ }
+ else if (stuff->data == X_TestQueryInputSize)
+ {
+ return(ProcTestQueryInputSize(client));
+ }
+ else
+ {
+ SendErrorToClient(client,
+ XTestReqCode,
+ stuff->data,
+ None,
+ BadRequest);
+ return(BadRequest);
+ }
+}
+
+/*****************************************************************************
+ *
+ * SProcXTestDispatch
+ *
+ *
+ */
+static int
+SProcXTestDispatch(client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ if (stuff->data == X_TestFakeInput)
+ {
+ return(SProcTestFakeInput(client));
+ }
+ else if (stuff->data == X_TestGetInput)
+ {
+ return(SProcTestGetInput(client));
+ }
+ else if (stuff->data == X_TestStopInput)
+ {
+ return(SProcTestStopInput(client));
+ }
+ else if (stuff->data == X_TestReset)
+ {
+ return(SProcTestReset(client));
+ }
+ else if (stuff->data == X_TestQueryInputSize)
+ {
+ return(SProcTestQueryInputSize(client));
+ }
+ else
+ {
+ SendErrorToClient(client,
+ XTestReqCode,
+ stuff->data,
+ None,
+ BadRequest);
+ return(BadRequest);
+ }
+}
+
+/*****************************************************************************
+ *
+ * SProcTestFakeInput
+ *
+ *
+ */
+static int
+SProcTestFakeInput(client)
+ register ClientPtr client;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+ /*
+ * index counter
+ */
+ int i;
+ /*
+ * pointer to the next input action in the request
+ */
+ CARD8 *input_action_ptr;
+ /*
+ * holds the type of the next input action in the request
+ */
+ int input_action_type;
+
+ REQUEST(xTestFakeInputReq);
+ /*
+ * byte-swap the fields in the request
+ */
+ swaps(&stuff->length, n);
+ swapl(&stuff->ack, n);
+ /*
+ * have to parse and then byte-swap the input action list here
+ */
+ for (i = 0; i < XTestMAX_ACTION_LIST_SIZE;)
+ {
+ /*
+ * point to the next input action in the request
+ */
+ input_action_ptr = &(((xTestFakeInputReq *) stuff)->action_list[i]);
+ /*
+ * figure out what type of input action it is
+ */
+ input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK;
+ /*
+ * byte-swap the input action according to it's type
+ */
+ switch (input_action_type)
+ {
+ case XTestKEY_ACTION:
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestKeyInfo);
+ break;
+ case XTestMOTION_ACTION:
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestMotionInfo);
+ break;
+ case XTestJUMP_ACTION:
+ /*
+ * byte-swap the jumpx field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
+ /*
+ * byte-swap the jumpy field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestJumpInfo);
+ break;
+ default:
+ /*
+ * if this is a delay input action, then byte-swap it,
+ * otherwise we have reached the end of the input
+ * actions in this request
+ */
+ if (XTestUnpackDeviceID(*input_action_ptr) ==
+ XTestDELAY_DEVICE_ID)
+ {
+ /*
+ * byte-swap the delay_time field
+ */
+ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestDelayInfo);
+ }
+ else
+ {
+ /*
+ * if the input action header byte is 0 or
+ * ill-formed, then there are no more input
+ * actions in this request
+ */
+ i = XTestMAX_ACTION_LIST_SIZE;
+ }
+ break;
+ }
+ }
+ return(ProcTestFakeInput(client));
+}
+
+/*****************************************************************************
+ *
+ * SProcTestGetInput
+ *
+ *
+ */
+static int
+SProcTestGetInput(client)
+ register ClientPtr client;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+
+ REQUEST(xTestGetInputReq);
+ /*
+ * byte-swap the fields in the request
+ */
+ swaps(&stuff->length, n);
+ swapl(&stuff->mode, n);
+ return(ProcTestGetInput(client));
+}
+
+/*****************************************************************************
+ *
+ * SProcTestStopInput
+ *
+ *
+ */
+static int
+SProcTestStopInput(client)
+ register ClientPtr client;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+
+ REQUEST(xTestStopInputReq);
+ /*
+ * byte-swap the length field in the request
+ */
+ swaps(&stuff->length, n);
+ return(ProcTestStopInput(client));
+}
+
+/*****************************************************************************
+ *
+ * SProcTestReset
+ *
+ *
+ */
+static int
+SProcTestReset(client)
+ register ClientPtr client;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+
+ REQUEST(xTestResetReq);
+ /*
+ * byte-swap the length field in the request
+ */
+ swaps(&stuff->length, n);
+ return(ProcTestReset(client));
+}
+
+/*****************************************************************************
+ *
+ * SProcTestQueryInputSize
+ *
+ *
+ */
+static int
+SProcTestQueryInputSize(client)
+ register ClientPtr client;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+
+ REQUEST(xTestQueryInputSizeReq);
+ /*
+ * byte-swap the length field in the request
+ */
+ swaps(&stuff->length, n);
+ return(ProcTestQueryInputSize(client));
+}
+
+/*****************************************************************************
+ *
+ * ProcTestFakeInput
+ *
+ *
+ */
+static int
+ProcTestFakeInput(client)
+ register ClientPtr client;
+{
+ REQUEST(xTestFakeInputReq);
+ REQUEST_SIZE_MATCH(xTestFakeInputReq);
+
+ if (playback_client == NULL)
+ {
+ playback_client = client;
+ current_client_id = FakeClientID(client->index);
+ AddResource(current_client_id,
+ XTestType,
+ 0);
+ MakeClientGrabImpervious(client);
+ }
+ if (playback_client == client)
+ {
+ /*
+ * This extension does not need to clean up any
+ * server state when a client using this function
+ * "goes away". The server will just process any
+ * input actions that have already been sent to it,
+ * and will then reset its association with a client.
+ */
+ parse_fake_input(client, (char *)stuff);
+ return(Success);
+ }
+ else
+ {
+ /*
+ * this is a request by another client to send fake
+ * input while the server is still being used
+ */
+ SendErrorToClient(client,
+ XTestReqCode,
+ X_TestFakeInput,
+ None,
+ BadAccess);
+ return(BadAccess);
+ }
+}
+
+/*****************************************************************************
+ *
+ * ProcTestGetInput
+ *
+ *
+ */
+static int
+ProcTestGetInput(client)
+ register ClientPtr client;
+{
+ REQUEST(xTestGetInputReq);
+ REQUEST_SIZE_MATCH(xTestGetInputReq);
+ if (on_steal_input)
+ {
+ /*
+ * this is a request by another client to get fake input
+ * while the server is still sending input to the first client
+ */
+ SendErrorToClient(client,
+ XTestReqCode,
+ X_TestGetInput,
+ None,
+ BadAccess);
+ return(BadAccess);
+ }
+ else
+ {
+ /*
+ * Set up a resource associated with the client using this
+ * function so that this extension gets called when the
+ * client "goes away". This allows this extension to
+ * clean up the server state.
+ */
+ current_client_id = FakeClientID(client->index);
+ AddResource(current_client_id,
+ XTestType,
+ 0);
+ /*
+ * indicate that a client is stealing input
+ */
+ on_steal_input = TRUE;
+ if ((stuff->mode & XTestEXCLUSIVE) == 0)
+ {
+ exclusive_steal = FALSE;
+ }
+ else
+ {
+ exclusive_steal = TRUE;
+ }
+ steal_input(client, stuff->mode);
+ return(Success);
+ }
+}
+
+/*****************************************************************************
+ *
+ * ProcTestStopInput
+ *
+ *
+ */
+static int
+ProcTestStopInput(client)
+ register ClientPtr client;
+{
+ REQUEST_SIZE_MATCH(xTestStopInputReq);
+ if (on_steal_input && (current_xtest_client == client))
+ {
+ on_steal_input = FALSE;
+ exclusive_steal = FALSE;
+ stop_stealing_input();
+ /*
+ * remove the resource associated with this client
+ */
+ FreeResource(current_client_id, RT_NONE);
+ return(Success);
+ }
+ else
+ {
+ /*
+ * this is a request to stop fake input when fake input has
+ * never been started or from a client that hasn't started
+ * fake input
+ */
+ SendErrorToClient(client,
+ XTestReqCode,
+ X_TestStopInput,
+ None,
+ BadAccess);
+ return(BadAccess);
+ }
+}
+
+/*****************************************************************************
+ *
+ * ProcTestReset
+ *
+ *
+ */
+static int
+ProcTestReset(client)
+ register ClientPtr client;
+{
+ REQUEST_SIZE_MATCH(xTestResetReq);
+ on_steal_input = FALSE;
+ exclusive_steal = FALSE;
+ /*
+ * defined in xtest1dd.c
+ */
+ stop_stealing_input();
+ /*
+ * defined in xtest1dd.c
+ */
+ abort_play_back();
+ return(Success);
+}
+
+/*****************************************************************************
+ *
+ * ProcTestQueryInputSize
+ *
+ *
+ */
+static int
+ProcTestQueryInputSize(client)
+ register ClientPtr client;
+{
+ REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
+ /*
+ * defined in xtest1dd.c
+ */
+ return_input_array_size(client);
+ return(Success);
+}
+
+/*****************************************************************************
+ *
+ * XTestResetProc
+ *
+ * This function is called by the server when the server has no clients
+ * connected to it. It must put eveything back the way it was before
+ * this extension was installed.
+ */
+/*ARGSUSED*/
+static void
+XTestResetProc(unused)
+ ExtensionEntry * unused;
+{
+ /*
+ * remove the routine to handle byte-swapping the replies
+ * for this extension in the ReplySwapVector table
+ */
+ ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
+ /*
+ * remove the routine to handle byte-swapping the events
+ * for this extension in the EventSwapVector table
+ */
+ EventSwapVector[XTestInputActionType] = NotImplemented;
+ EventSwapVector[XTestFakeAckType] = NotImplemented;
+ /*
+ * reset the variables initialized just once at load time
+ */
+ XTestReqCode = 0;
+ XTestInputActionType = 0;
+ XTestFakeAckType = 1;
+ on_steal_input = FALSE;
+ exclusive_steal = FALSE;
+ playback_client = 0; /* Don't really need this but it looks nice */
+}
+
+/*****************************************************************************
+ *
+ * PXTestCurrentClientGone
+ *
+ * This routine is called when a client that has asked for input actions
+ * to be sent to it "goes away". This routine must clean up the
+ * server state.
+ */
+/*ARGSUSED*/
+static int
+XTestCurrentClientGone(value, id)
+ pointer value;
+ XID id;
+{
+ /*
+ * defined in xtest1dd.c
+ */
+ on_steal_input = FALSE;
+ exclusive_steal = FALSE;
+ /*
+ * defined in xtestdd.c
+ */
+ playback_client = 0;
+ abort_play_back();
+ return TRUE;
+}
+
+/*****************************************************************************
+ *
+ * SReplyXTestDispatch
+ *
+ * Swap any replies defined in this extension.
+ */
+static void
+SReplyXTestDispatch(client_ptr, size, reply_ptr)
+ ClientPtr client_ptr;
+ int size;
+ char *reply_ptr;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+ /*
+ * pointer to xTestQueryInputSizeReply
+ */
+ xTestQueryInputSizeReply *rep_ptr;
+
+ /*
+ * there is only one reply in this extension, so byte-swap it
+ */
+ rep_ptr = (xTestQueryInputSizeReply *) reply_ptr;
+ swaps(&(rep_ptr->sequenceNumber), n);
+ swapl(&(rep_ptr->length), n);
+ swapl(&(rep_ptr->size_return), n);
+ /*
+ * now write the swapped reply to the client
+ */
+ WriteToClient(client_ptr, size, reply_ptr);
+}
+
+/*****************************************************************************
+ *
+ * SEventXTestDispatch
+ *
+ * Swap any events defined in this extension.
+ */
+static void
+SEventXTestDispatch(from, to)
+ xEvent *from;
+ xEvent *to;
+{
+ /*
+ * used in the swaps and swapl macros for temporary storage space
+ */
+ register char n;
+ /*
+ * index counter
+ */
+ int i;
+ /*
+ * pointer to the next input action in the event
+ */
+ CARD8 *input_action_ptr;
+ /*
+ * holds the type of the next input action in the event
+ */
+ int input_action_type;
+
+
+ /*
+ * copy the type information from the "from" event to the "to" event
+ */
+ ((xTestInputActionEvent *) to)->type =
+ ((xTestInputActionEvent *) from)->type;
+ /*
+ * copy the sequence number information from the "from" event to the
+ * "to" event
+ */
+ ((xTestInputActionEvent *) to)->sequenceNumber =
+ ((xTestInputActionEvent *) from)->sequenceNumber;
+ /*
+ * byte-swap the sequence number in the "to" event
+ */
+ swaps(&(((xTestInputActionEvent *) to)->sequenceNumber), n);
+ /*
+ * If the event is an xTestInputActionEvent, then it needs more
+ * processing. Otherwise, it is an xTestFakeAckEvent, which
+ * has no other information in it.
+ */
+ if ((((xTestInputActionEvent *) to)->type & 0x7f) ==
+ XTestInputActionType)
+ {
+ /*
+ * copy the input actions from the "from" event
+ * to the "to" event
+ */
+ for (i = 0; i < XTestACTIONS_SIZE; i++)
+ {
+ ((xTestInputActionEvent *) to)->actions[i] =
+ ((xTestInputActionEvent *) from)->actions[i];
+ }
+ /*
+ * byte-swap the input actions in the "to" event
+ */
+ for (i = 0; i < XTestACTIONS_SIZE; i++)
+ {
+ /*
+ * point to the next input action in the event
+ */
+ input_action_ptr = &(((xTestInputActionEvent *) to)->actions[i]);
+ /*
+ * figure out what type of input action it is
+ */
+ input_action_type = (*input_action_ptr) &
+ XTestACTION_TYPE_MASK;
+ /*
+ * byte-swap the input action according to it's type
+ */
+ switch (input_action_type)
+ {
+ case XTestKEY_ACTION:
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestKeyInfo);
+ break;
+ case XTestMOTION_ACTION:
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestMotionInfo);
+ break;
+ case XTestJUMP_ACTION:
+ /*
+ * byte-swap the jumpx field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
+ /*
+ * byte-swap the jumpy field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
+ /*
+ * byte-swap the delay_time field
+ */
+ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestJumpInfo);
+ break;
+ default:
+ /*
+ * if this is a delay input action, then
+ * byte-swap it, otherwise we have reached the
+ * end of the input actions in this event
+ */
+ if (XTestUnpackDeviceID(*input_action_ptr) ==
+ XTestDELAY_DEVICE_ID)
+ {
+ /*
+ * byte-swap the delay_time field
+ */
+ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
+ /*
+ * advance to the next input action
+ */
+ i += sizeof(XTestDelayInfo);
+ }
+ else
+ {
+ /*
+ * if the input action header byte is 0
+ * or ill-formed, then there are no
+ * more input actions in this event
+ */
+ i = XTestACTIONS_SIZE;
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/xc/programs/Xserver/Xext/xvdisp.c b/xc/programs/Xserver/Xext/xvdisp.c
new file mode 100644
index 000000000..4e6185826
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xvdisp.c
@@ -0,0 +1,1314 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.5 1999/05/23 06:33:37 dawes Exp $ */
+
+/*
+** File:
+**
+** xvdisp.c --- Xv server extension dispatch module.
+**
+** Author:
+**
+** David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+** 11.06.91 Carver
+** - changed SetPortControl to SetPortAttribute
+** - changed GetPortControl to GetPortAttribute
+** - changed QueryBestSize
+**
+** 15.05.91 Carver
+** - version 2.0 upgrade
+**
+** 24.01.91 Carver
+** - version 1.4 upgrade
+**
+*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+
+#include "Xv.h"
+#include "Xvproto.h"
+#include "xvdix.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+/* INTERNAL */
+
+static int ProcXvQueryExtension(ClientPtr);
+static int ProcXvQueryAdaptors(ClientPtr);
+static int ProcXvQueryEncodings(ClientPtr);
+static int ProcXvPutVideo(ClientPtr);
+static int ProcXvPutStill(ClientPtr);
+static int ProcXvGetVideo(ClientPtr);
+static int ProcXvGetStill(ClientPtr);
+static int ProcXvGrabPort(ClientPtr);
+static int ProcXvUngrabPort(ClientPtr);
+static int ProcXvSelectVideoNotify(ClientPtr);
+static int ProcXvSelectPortNotify(ClientPtr);
+static int ProcXvStopVideo(ClientPtr);
+static int ProcXvSetPortAttribute(ClientPtr);
+static int ProcXvGetPortAttribute(ClientPtr);
+static int ProcXvQueryBestSize(ClientPtr);
+static int ProcXvQueryPortAttributes(ClientPtr);
+
+static int SProcXvQueryExtension(ClientPtr);
+static int SProcXvQueryAdaptors(ClientPtr);
+static int SProcXvQueryEncodings(ClientPtr);
+static int SProcXvPutVideo(ClientPtr);
+static int SProcXvPutStill(ClientPtr);
+static int SProcXvGetVideo(ClientPtr);
+static int SProcXvGetStill(ClientPtr);
+static int SProcXvGrabPort(ClientPtr);
+static int SProcXvUngrabPort(ClientPtr);
+static int SProcXvSelectVideoNotify(ClientPtr);
+static int SProcXvSelectPortNotify(ClientPtr);
+static int SProcXvStopVideo(ClientPtr);
+static int SProcXvSetPortAttribute(ClientPtr);
+static int SProcXvGetPortAttribute(ClientPtr);
+static int SProcXvQueryBestSize(ClientPtr);
+static int SProcXvQueryPortAttributes(ClientPtr);
+
+static int SWriteQueryAdaptorsReply(ClientPtr, xvQueryAdaptorsReply *);
+static int SWriteQueryExtensionReply(ClientPtr, xvQueryExtensionReply *);
+static int SWriteQueryEncodingsReply(ClientPtr, xvQueryEncodingsReply *);
+static int SWriteAdaptorInfo(ClientPtr, xvAdaptorInfo *);
+static int SWriteEncodingInfo(ClientPtr, xvEncodingInfo *);
+static int SWriteFormat(ClientPtr, xvFormat *);
+static int SWriteAttributeInfo(ClientPtr, xvAttributeInfo *);
+static int SWriteGrabPortReply(ClientPtr, xvGrabPortReply *);
+static int SWriteGetPortAttributeReply(ClientPtr, xvGetPortAttributeReply *);
+static int SWriteQueryBestSizeReply(ClientPtr, xvQueryBestSizeReply *);
+static int SWriteQueryPortAttributesReply(ClientPtr, xvQueryPortAttributesReply *);
+
+#define _WriteQueryAdaptorsReply(_c,_d) \
+ if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \
+ else WriteToClient(_c, sz_xvQueryAdaptorsReply, (char*)_d)
+
+#define _WriteQueryExtensionReply(_c,_d) \
+ if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \
+ else WriteToClient(_c, sz_xvQueryExtensionReply, (char*)_d)
+
+#define _WriteQueryEncodingsReply(_c,_d) \
+ if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \
+ else WriteToClient(_c, sz_xvQueryEncodingsReply, (char*)_d)
+
+#define _WriteAdaptorInfo(_c,_d) \
+ if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \
+ else WriteToClient(_c, sz_xvAdaptorInfo, (char*)_d)
+
+#define _WriteAttributeInfo(_c,_d) \
+ if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \
+ else WriteToClient(_c, sz_xvAttributeInfo, (char*)_d)
+
+#define _WriteEncodingInfo(_c,_d) \
+ if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \
+ else WriteToClient(_c, sz_xvEncodingInfo, (char*)_d)
+
+#define _WriteFormat(_c,_d) \
+ if ((_c)->swapped) SWriteFormat(_c, _d); \
+ else WriteToClient(_c, sz_xvFormat, (char*)_d)
+
+#define _WriteGrabPortReply(_c,_d) \
+ if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \
+ else WriteToClient(_c, sz_xvGrabPortReply, (char*)_d)
+
+#define _WriteGetPortAttributeReply(_c,_d) \
+ if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \
+ else WriteToClient(_c, sz_xvGetPortAttributeReply, (char*)_d)
+
+#define _WriteQueryBestSizeReply(_c,_d) \
+ if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \
+ else WriteToClient(_c, sz_xvQueryBestSizeReply,(char*) _d)
+
+#define _WriteQueryPortAttributesReply(_c,_d) \
+ if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \
+ else WriteToClient(_c, sz_xvQueryPortAttributesReply,(char*) _d)
+
+#define _AllocatePort(_i,_p) \
+ ((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
+
+/*
+** ProcXvDispatch
+**
+**
+**
+*/
+
+int
+ProcXvDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ UpdateCurrentTime();
+
+ switch (stuff->data)
+ {
+ case xv_QueryExtension: return(ProcXvQueryExtension(client));
+ case xv_QueryAdaptors: return(ProcXvQueryAdaptors(client));
+ case xv_QueryEncodings: return(ProcXvQueryEncodings(client));
+ case xv_PutVideo: return(ProcXvPutVideo(client));
+ case xv_PutStill: return(ProcXvPutStill(client));
+ case xv_GetVideo: return(ProcXvGetVideo(client));
+ case xv_GetStill: return(ProcXvGetStill(client));
+ case xv_GrabPort: return(ProcXvGrabPort(client));
+ case xv_UngrabPort: return(ProcXvUngrabPort(client));
+ case xv_SelectVideoNotify: return(ProcXvSelectVideoNotify(client));
+ case xv_SelectPortNotify: return(ProcXvSelectPortNotify(client));
+ case xv_StopVideo: return(ProcXvStopVideo(client));
+ case xv_SetPortAttribute: return(ProcXvSetPortAttribute(client));
+ case xv_GetPortAttribute: return(ProcXvGetPortAttribute(client));
+ case xv_QueryBestSize: return(ProcXvQueryBestSize(client));
+ case xv_QueryPortAttributes: return(ProcXvQueryPortAttributes(client));
+ default:
+ if (stuff->data < xvNumRequests)
+ {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0,
+ BadImplementation);
+ return(BadImplementation);
+ }
+ else
+ {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
+ return(BadRequest);
+ }
+ }
+}
+
+int
+SProcXvDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ UpdateCurrentTime();
+
+ switch (stuff->data)
+ {
+ case xv_QueryExtension: return(SProcXvQueryExtension(client));
+ case xv_QueryAdaptors: return(SProcXvQueryAdaptors(client));
+ case xv_QueryEncodings: return(SProcXvQueryEncodings(client));
+ case xv_PutVideo: return(SProcXvPutVideo(client));
+ case xv_PutStill: return(SProcXvPutStill(client));
+ case xv_GetVideo: return(SProcXvGetVideo(client));
+ case xv_GetStill: return(SProcXvGetStill(client));
+ case xv_GrabPort: return(SProcXvGrabPort(client));
+ case xv_UngrabPort: return(SProcXvUngrabPort(client));
+ case xv_SelectVideoNotify: return(SProcXvSelectVideoNotify(client));
+ case xv_SelectPortNotify: return(SProcXvSelectPortNotify(client));
+ case xv_StopVideo: return(SProcXvStopVideo(client));
+ case xv_SetPortAttribute: return(SProcXvSetPortAttribute(client));
+ case xv_GetPortAttribute: return(SProcXvGetPortAttribute(client));
+ case xv_QueryBestSize: return(SProcXvQueryBestSize(client));
+ case xv_QueryPortAttributes: return(SProcXvQueryPortAttributes(client));
+ default:
+ if (stuff->data < xvNumRequests)
+ {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0,
+ BadImplementation);
+ return(BadImplementation);
+ }
+ else
+ {
+ SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
+ return(BadRequest);
+ }
+ }
+}
+
+static int
+ProcXvQueryExtension(ClientPtr client)
+{
+ xvQueryExtensionReply rep;
+ REQUEST(xvQueryExtensionReq);
+ REQUEST_SIZE_MATCH(xvQueryExtensionReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.version = XvVersion;
+ rep.revision = XvRevision;
+
+ _WriteQueryExtensionReply(client, &rep);
+
+ return Success;
+
+}
+
+static int
+ProcXvQueryAdaptors(ClientPtr client)
+{
+ xvFormat format;
+ xvAdaptorInfo ainfo;
+ xvQueryAdaptorsReply rep;
+ int totalSize;
+ int na;
+ XvAdaptorPtr pa;
+ int nf;
+ XvFormatPtr pf;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+
+ REQUEST(xvQueryAdaptorsReq);
+ REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
+
+ if(!(pWin = (WindowPtr)LookupWindow(stuff->window, client) ))
+ {
+ client->errorValue = stuff->window;
+ return (BadWindow);
+ }
+
+ pScreen = pWin->drawable.pScreen;
+ pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
+
+ if (!pxvs)
+ {
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_adaptors = 0;
+ rep.length = 0;
+
+ _WriteQueryAdaptorsReply(client, &rep);
+
+ return Success;
+ }
+
+ (* pxvs->ddQueryAdaptors)(pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_adaptors = pxvs->nAdaptors;
+
+ /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
+
+ totalSize = pxvs->nAdaptors * sz_xvAdaptorInfo;
+
+ /* FOR EACH ADPATOR ADD UP THE BYTES FOR ENCODINGS AND FORMATS */
+
+ na = pxvs->nAdaptors;
+ pa = pxvs->pAdaptors;
+ while (na--)
+ {
+ totalSize += (strlen(pa->name) + 3) & ~3;
+ totalSize += pa->nFormats * sz_xvFormat;
+ pa++;
+ }
+
+ rep.length = totalSize >> 2;
+
+ _WriteQueryAdaptorsReply(client, &rep);
+
+ na = pxvs->nAdaptors;
+ pa = pxvs->pAdaptors;
+ while (na--)
+ {
+
+ ainfo.base_id = pa->base_id;
+ ainfo.num_ports = pa->nPorts;
+ ainfo.type = pa->type;
+ ainfo.name_size = strlen(pa->name);
+ ainfo.num_formats = pa->nFormats;
+
+ _WriteAdaptorInfo(client, &ainfo);
+
+ WriteToClient(client, ainfo.name_size, pa->name);
+
+ nf = pa->nFormats;
+ pf = pa->pFormats;
+ while (nf--)
+ {
+ format.depth = pf->depth;
+ format.visual = pf->visual;
+ _WriteFormat(client, &format);
+ pf++;
+ }
+
+ pa++;
+
+ }
+
+ return (client->noClientException);
+
+}
+
+static int
+ProcXvQueryEncodings(ClientPtr client)
+{
+ xvEncodingInfo einfo;
+ xvQueryEncodingsReply rep;
+ int totalSize;
+ XvPortPtr pPort;
+ int ne;
+ XvEncodingPtr pe;
+ int status;
+
+ REQUEST(xvQueryEncodingsReq);
+ REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_encodings = pPort->pAdaptor->nEncodings;
+
+ /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
+
+ ne = pPort->pAdaptor->nEncodings;
+ pe = pPort->pAdaptor->pEncodings;
+ totalSize = ne * sz_xvEncodingInfo;
+ while (ne--)
+ {
+ totalSize += (strlen(pe->name) + 3) & ~3;
+ pe++;
+ }
+
+ rep.length = totalSize >> 2;
+
+ _WriteQueryEncodingsReply(client, &rep);
+
+ ne = pPort->pAdaptor->nEncodings;
+ pe = pPort->pAdaptor->pEncodings;
+ do
+ {
+ einfo.encoding = pe->id;
+ einfo.name_size = strlen(pe->name);
+ einfo.width = pe->width;
+ einfo.height = pe->height;
+ einfo.rate.numerator = pe->rate.numerator;
+ einfo.rate.denominator = pe->rate.denominator;
+ _WriteEncodingInfo(client, &einfo);
+ WriteToClient(client, einfo.name_size, pe->name);
+ pe++;
+ } while (--ne);
+
+ return (client->noClientException);
+
+}
+
+static int
+ProcXvPutVideo(ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ XvPortPtr pPort;
+ register GCPtr pGC;
+ int status;
+
+ REQUEST(xvPutVideoReq);
+ REQUEST_SIZE_MATCH(xvPutVideoReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!(pPort->pAdaptor->type & XvInputMask))
+ {
+ client->errorValue = stuff->port;
+ return (BadMatch);
+ }
+
+ status = XVCALL(diMatchPort)(pPort, pDraw);
+ if (status != Success)
+ {
+ return status;
+ }
+
+ return XVCALL(diPutVideo)(client, pDraw, pPort, pGC,
+ stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
+
+}
+
+static int
+ProcXvPutStill(ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ XvPortPtr pPort;
+ register GCPtr pGC;
+ int status;
+
+ REQUEST(xvPutStillReq);
+ REQUEST_SIZE_MATCH(xvPutStillReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!(pPort->pAdaptor->type & XvInputMask))
+ {
+ client->errorValue = stuff->port;
+ return (BadMatch);
+ }
+
+ status = XVCALL(diMatchPort)(pPort, pDraw);
+ if (status != Success)
+ {
+ return status;
+ }
+
+ return XVCALL(diPutStill)(client, pDraw, pPort, pGC,
+ stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
+
+}
+
+
+static int
+ProcXvGetVideo(ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ XvPortPtr pPort;
+ register GCPtr pGC;
+ int status;
+
+ REQUEST(xvGetVideoReq);
+ REQUEST_SIZE_MATCH(xvGetVideoReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!(pPort->pAdaptor->type & XvOutputMask))
+ {
+ client->errorValue = stuff->port;
+ return (BadMatch);
+ }
+
+ status = XVCALL(diMatchPort)(pPort, pDraw);
+ if (status != Success)
+ {
+ return status;
+ }
+
+ return XVCALL(diGetVideo)(client, pDraw, pPort, pGC,
+ stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
+
+}
+
+
+static int
+ProcXvGetStill(ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ XvPortPtr pPort;
+ register GCPtr pGC;
+ int status;
+
+ REQUEST(xvGetStillReq);
+ REQUEST_SIZE_MATCH(xvGetStillReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!(pPort->pAdaptor->type & XvOutputMask))
+ {
+ client->errorValue = stuff->port;
+ return (BadMatch);
+ }
+
+ status = XVCALL(diMatchPort)(pPort, pDraw);
+ if (status != Success)
+ {
+ return status;
+ }
+
+ return XVCALL(diGetStill)(client, pDraw, pPort, pGC,
+ stuff->vid_x, stuff->vid_y,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_x, stuff->drw_y,
+ stuff->drw_w, stuff->drw_h);
+
+}
+
+static int
+ProcXvSelectVideoNotify(ClientPtr client)
+{
+ register DrawablePtr pDraw;
+ REQUEST(xvSelectVideoNotifyReq);
+ REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
+
+ if(!(pDraw = (DrawablePtr)LOOKUP_DRAWABLE(stuff->drawable, client) ))
+ {
+ client->errorValue = stuff->drawable;
+ return (BadWindow);
+ }
+
+ return XVCALL(diSelectVideoNotify)(client, pDraw, stuff->onoff);
+
+}
+
+static int
+ProcXvSelectPortNotify(ClientPtr client)
+{
+ int status;
+ XvPortPtr pPort;
+ REQUEST(xvSelectPortNotifyReq);
+ REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ return XVCALL(diSelectPortNotify)(client, pPort, stuff->onoff);
+
+}
+
+static int
+ProcXvGrabPort(ClientPtr client)
+{
+ int result, status;
+ XvPortPtr pPort;
+ xvGrabPortReply rep;
+ REQUEST(xvGrabPortReq);
+ REQUEST_SIZE_MATCH(xvGrabPortReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ status = XVCALL(diGrabPort)(client, pPort, stuff->time, &result);
+
+ if (status != Success)
+ {
+ return status;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.result = result;
+
+ _WriteGrabPortReply(client, &rep);
+
+ return Success;
+
+}
+
+static int
+ProcXvUngrabPort(ClientPtr client)
+{
+ int status;
+ XvPortPtr pPort;
+ REQUEST(xvGrabPortReq);
+ REQUEST_SIZE_MATCH(xvGrabPortReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ return XVCALL(diUngrabPort)(client, pPort, stuff->time);
+
+}
+
+
+static int
+ProcXvStopVideo(ClientPtr client)
+{
+ int status;
+ register DrawablePtr pDraw;
+ XvPortPtr pPort;
+ REQUEST(xvStopVideoReq);
+ REQUEST_SIZE_MATCH(xvStopVideoReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if(!(pDraw = LOOKUP_DRAWABLE(stuff->drawable, client) ))
+ {
+ client->errorValue = stuff->drawable;
+ return (BadDrawable);
+ }
+
+ return XVCALL(diStopVideo)(client, pPort, pDraw);
+
+}
+
+static int
+ProcXvSetPortAttribute(ClientPtr client)
+{
+ int status;
+ XvPortPtr pPort;
+ REQUEST(xvSetPortAttributeReq);
+ REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!ValidAtom(stuff->attribute))
+ {
+ client->errorValue = stuff->attribute;
+ return(BadAtom);
+ }
+
+ status = XVCALL(diSetPortAttribute)(client, pPort,
+ stuff->attribute, stuff->value);
+
+ if (status == BadMatch)
+ client->errorValue = stuff->attribute;
+ else
+ client->errorValue = stuff->value;
+
+ return status;
+
+}
+
+static int
+ProcXvGetPortAttribute(ClientPtr client)
+{
+ INT32 value;
+ int status;
+ XvPortPtr pPort;
+ xvGetPortAttributeReply rep;
+ REQUEST(xvGetPortAttributeReq);
+ REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ if (!ValidAtom(stuff->attribute))
+ {
+ client->errorValue = stuff->attribute;
+ return(BadAtom);
+ }
+
+ status = XVCALL(diGetPortAttribute)(client, pPort, stuff->attribute, &value);
+ if (status != Success)
+ {
+ client->errorValue = stuff->attribute;
+ return status;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.value = value;
+
+ _WriteGetPortAttributeReply(client, &rep);
+
+ return Success;
+}
+
+static int
+ProcXvQueryBestSize(ClientPtr client)
+{
+ int status;
+ unsigned int actual_width, actual_height;
+ XvPortPtr pPort;
+ xvQueryBestSizeReply rep;
+ REQUEST(xvQueryBestSizeReq);
+ REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+
+ (* pPort->pAdaptor->ddQueryBestSize)(client, pPort, stuff->motion,
+ stuff->vid_w, stuff->vid_h,
+ stuff->drw_w, stuff->drw_h,
+ &actual_width, &actual_height);
+
+ rep.actual_width = actual_width;
+ rep.actual_height = actual_height;
+
+ _WriteQueryBestSizeReply(client, &rep);
+
+ return Success;
+}
+
+
+static int
+ProcXvQueryPortAttributes(ClientPtr client)
+{
+ int status, size, i;
+ XvPortPtr pPort;
+ XvAttributePtr pAtt;
+ xvQueryPortAttributesReply rep;
+ xvAttributeInfo Info;
+ REQUEST(xvQueryPortAttributesReq);
+ REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
+
+ if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
+ {
+ client->errorValue = stuff->port;
+ return (_XvBadPort);
+ }
+
+ if ((status = _AllocatePort(stuff->port, pPort)) != Success)
+ {
+ client->errorValue = stuff->port;
+ return (status);
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.num_attributes = pPort->numAttributes;
+ rep.text_size = 0;
+
+ for(i = 0, pAtt = pPort->attributes;
+ i < pPort->numAttributes;
+ i++, pAtt++) {
+
+ rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L;
+ }
+
+ rep.length = (pPort->numAttributes * sz_xvAttributeInfo) + rep.text_size;
+ rep.length >>= 2;
+
+ _WriteQueryPortAttributesReply(client, &rep);
+
+ for(i = 0, pAtt = pPort->attributes;
+ i < pPort->numAttributes;
+ i++, pAtt++) {
+
+ size = strlen(pAtt->name) + 1; /* pass the NULL */
+ Info.flags = pAtt->flags;
+ Info.size = (size + 3) & ~3L;
+
+ _WriteAttributeInfo(client, &Info);
+
+ WriteToClient(client, size, pAtt->name);
+ }
+
+ return Success;
+}
+
+
+/* Swapped Procs */
+
+static int
+SProcXvQueryExtension(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvQueryExtensionReq);
+ swaps(&stuff->length, n);
+ return ProcXvQueryExtension(client);
+}
+
+static int
+SProcXvQueryAdaptors(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvQueryAdaptorsReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return ProcXvQueryAdaptors(client);
+}
+
+static int
+SProcXvQueryEncodings(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvQueryEncodingsReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ return ProcXvQueryEncodings(client);
+}
+
+static int
+SProcXvGrabPort(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvGrabPortReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->time, n);
+ return ProcXvGrabPort(client);
+}
+
+static int
+SProcXvUngrabPort(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvUngrabPortReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->time, n);
+ return ProcXvUngrabPort(client);
+}
+
+static int
+SProcXvPutVideo(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvPutVideoReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->vid_x, n);
+ swaps(&stuff->vid_y, n);
+ swaps(&stuff->vid_w, n);
+ swaps(&stuff->vid_h, n);
+ swaps(&stuff->drw_x, n);
+ swaps(&stuff->drw_y, n);
+ swaps(&stuff->drw_w, n);
+ swaps(&stuff->drw_h, n);
+ return ProcXvPutVideo(client);
+}
+
+static int
+SProcXvPutStill(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvPutStillReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->vid_x, n);
+ swaps(&stuff->vid_y, n);
+ swaps(&stuff->vid_w, n);
+ swaps(&stuff->vid_h, n);
+ swaps(&stuff->drw_x, n);
+ swaps(&stuff->drw_y, n);
+ swaps(&stuff->drw_w, n);
+ swaps(&stuff->drw_h, n);
+ return ProcXvPutStill(client);
+}
+
+static int
+SProcXvGetVideo(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvGetVideoReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->vid_x, n);
+ swaps(&stuff->vid_y, n);
+ swaps(&stuff->vid_w, n);
+ swaps(&stuff->vid_h, n);
+ swaps(&stuff->drw_x, n);
+ swaps(&stuff->drw_y, n);
+ swaps(&stuff->drw_w, n);
+ swaps(&stuff->drw_h, n);
+ return ProcXvGetVideo(client);
+}
+
+static int
+SProcXvGetStill(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvGetStillReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->vid_x, n);
+ swaps(&stuff->vid_y, n);
+ swaps(&stuff->vid_w, n);
+ swaps(&stuff->vid_h, n);
+ swaps(&stuff->drw_x, n);
+ swaps(&stuff->drw_y, n);
+ swaps(&stuff->drw_w, n);
+ swaps(&stuff->drw_h, n);
+ return ProcXvGetStill(client);
+}
+
+static int
+SProcXvSelectVideoNotify(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvSelectVideoNotifyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ return ProcXvSelectVideoNotify(client);
+}
+
+static int
+SProcXvSelectPortNotify(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvSelectPortNotifyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ return ProcXvSelectPortNotify(client);
+}
+
+static int
+SProcXvStopVideo(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvStopVideoReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->drawable, n);
+ return ProcXvStopVideo(client);
+}
+
+static int
+SProcXvSetPortAttribute(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvSetPortAttributeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->attribute, n);
+ return ProcXvSetPortAttribute(client);
+}
+
+static int
+SProcXvGetPortAttribute(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvGetPortAttributeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swapl(&stuff->attribute, n);
+ return ProcXvGetPortAttribute(client);
+}
+
+static int
+SProcXvQueryBestSize(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvQueryBestSizeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ swaps(&stuff->vid_w, n);
+ swaps(&stuff->vid_h, n);
+ swaps(&stuff->drw_w, n);
+ swaps(&stuff->drw_h, n);
+ return ProcXvQueryBestSize(client);
+}
+
+static int
+SProcXvQueryPortAttributes(ClientPtr client)
+{
+ register char n;
+ REQUEST(xvQueryPortAttributesReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->port, n);
+ return ProcXvQueryPortAttributes(client);
+}
+
+
+static int
+SWriteQueryExtensionReply(
+ ClientPtr client,
+ xvQueryExtensionReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->version, n);
+ swaps(&rep->revision, n);
+
+ (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteQueryAdaptorsReply(
+ ClientPtr client,
+ xvQueryAdaptorsReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->num_adaptors, n);
+
+ (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteQueryEncodingsReply(
+ ClientPtr client,
+ xvQueryEncodingsReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->num_encodings, n);
+
+ (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteAdaptorInfo(
+ ClientPtr client,
+ xvAdaptorInfo *pAdaptor
+){
+ register char n;
+
+ swapl(&pAdaptor->base_id, n);
+ swaps(&pAdaptor->name_size, n);
+ swaps(&pAdaptor->num_ports, n);
+ swaps(&pAdaptor->num_formats, n);
+
+ (void)WriteToClient(client, sz_xvAdaptorInfo, (char *)pAdaptor);
+
+ return Success;
+}
+
+static int
+SWriteEncodingInfo(
+ ClientPtr client,
+ xvEncodingInfo *pEncoding
+){
+ register char n;
+
+ swapl(&pEncoding->encoding, n);
+ swaps(&pEncoding->name_size, n);
+ swaps(&pEncoding->width, n);
+ swaps(&pEncoding->height, n);
+ swapl(&pEncoding->rate.numerator, n);
+ swapl(&pEncoding->rate.denominator, n);
+ (void)WriteToClient(client, sz_xvEncodingInfo, (char *)pEncoding);
+
+ return Success;
+}
+
+static int
+SWriteFormat(
+ ClientPtr client,
+ xvFormat *pFormat
+){
+ register char n;
+
+ swapl(&pFormat->visual, n);
+ (void)WriteToClient(client, sz_xvFormat, (char *)pFormat);
+
+ return Success;
+}
+
+static int
+SWriteAttributeInfo(
+ ClientPtr client,
+ xvAttributeInfo *pAtt
+){
+ register char n;
+
+ swapl(&pAtt->flags, n);
+ swapl(&pAtt->size, n);
+ (void)WriteToClient(client, sz_xvAttributeInfo, (char *)pAtt);
+
+ return Success;
+}
+
+
+static int
+SWriteGrabPortReply(
+ ClientPtr client,
+ xvGrabPortReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+
+ (void)WriteToClient(client, sz_xvGrabPortReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteGetPortAttributeReply(
+ ClientPtr client,
+ xvGetPortAttributeReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swapl(&rep->value, n);
+
+ (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteQueryBestSizeReply(
+ ClientPtr client,
+ xvQueryBestSizeReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->actual_width, n);
+ swaps(&rep->actual_height, n);
+
+ (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+SWriteQueryPortAttributesReply(
+ ClientPtr client,
+ xvQueryPortAttributesReply *rep
+){
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swapl(&rep->num_attributes, n);
+ swapl(&rep->text_size, n);
+
+ (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)&rep);
+
+ return Success;
+}
diff --git a/xc/programs/Xserver/Xext/xvdix.h b/xc/programs/Xserver/Xext/xvdix.h
new file mode 100644
index 000000000..91c401ded
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xvdix.h
@@ -0,0 +1,247 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xvdix.h,v 1.4 1999/05/23 08:14:48 dawes Exp $ */
+
+#ifndef XVDIX_H
+#define XVDIX_H
+/*
+** File:
+**
+** xvdix.h --- Xv device independent header file
+**
+** Author:
+**
+** David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+** 29.08.91 Carver
+** - removed UnrealizeWindow wrapper unrealizing windows no longer
+** preempts video
+**
+** 11.06.91 Carver
+** - changed SetPortControl to SetPortAttribute
+** - changed GetPortControl to GetPortAttribute
+** - changed QueryBestSize
+**
+** 15.05.91 Carver
+** - version 2.0 upgrade
+**
+** 24.01.91 Carver
+** - version 1.4 upgrade
+**
+*/
+
+#include "pixmap.h"
+#include "Xvproto.h"
+
+extern int XvScreenIndex;
+extern unsigned long XvExtensionGeneration;
+extern unsigned long XvScreenGeneration;
+extern unsigned long XvResourceGeneration;
+
+extern int XvReqCode;
+extern int XvEventBase;
+extern int XvErrorBase;
+
+extern unsigned long XvRTPort;
+extern unsigned long XvRTEncoding;
+extern unsigned long XvRTGrab;
+extern unsigned long XvRTVideoNotify;
+extern unsigned long XvRTVideoNotifyList;
+extern unsigned long XvRTPortNotify;
+
+typedef struct {
+ int numerator;
+ int denominator;
+} XvRationalRec, *XvRationalPtr;
+
+typedef struct {
+ char depth;
+ unsigned long visual;
+} XvFormatRec, *XvFormatPtr;
+
+typedef struct {
+ unsigned long id;
+ ClientPtr client;
+} XvGrabRec, *XvGrabPtr;
+
+typedef struct _XvVideoNotifyRec {
+ struct _XvVideoNotifyRec *next;
+ ClientPtr client;
+ unsigned long id;
+ unsigned long mask;
+} XvVideoNotifyRec, *XvVideoNotifyPtr;
+
+typedef struct _XvPortNotifyRec {
+ struct _XvPortNotifyRec *next;
+ ClientPtr client;
+ unsigned long id;
+} XvPortNotifyRec, *XvPortNotifyPtr;
+
+typedef struct {
+ int id;
+ ScreenPtr pScreen;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} XvEncodingRec, *XvEncodingPtr;
+
+typedef struct {
+ unsigned long base_id;
+ unsigned char type;
+ char *name;
+ int nEncodings;
+ XvEncodingPtr pEncodings;
+ int nFormats;
+ XvFormatPtr pFormats;
+ int nPorts;
+ struct _XvPortRec *pPorts;
+ ScreenPtr pScreen;
+ int (* ddAllocatePort)(unsigned long, struct _XvPortRec*,
+ struct _XvPortRec**);
+ int (* ddFreePort)(struct _XvPortRec*);
+ int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+ int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr);
+ int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32);
+ int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*);
+ int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8,
+ CARD16, CARD16,CARD16, CARD16,
+ unsigned int*, unsigned int*);
+ DevUnion devPriv;
+} XvAdaptorRec, *XvAdaptorPtr;
+
+/* XXX this is a guess */
+typedef struct _XvAttributeRec {
+ int flags;
+ char *name;
+} XvAttributeRec, *XvAttributePtr;
+
+typedef struct _XvPortRec {
+ unsigned long id;
+ XvAdaptorPtr pAdaptor;
+ XvPortNotifyPtr pNotify;
+ DrawablePtr pDraw;
+ ClientPtr client;
+ XvGrabRec grab;
+ TimeStamp time;
+ XvAttributePtr attributes;
+ int numAttributes;
+ DevUnion devPriv;
+} XvPortRec, *XvPortPtr;
+
+#define LOOKUP_PORT(_id, client)\
+ ((XvPortPtr)LookupIDByType(_id, XvRTPort))
+
+#define LOOKUP_ENCODING(_id, client)\
+ ((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding))
+
+#define LOOKUP_VIDEONOTIFY_LIST(_id, client)\
+ ((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList))
+
+#define LOOKUP_PORTNOTIFY_LIST(_id, client)\
+ ((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList))
+
+typedef struct {
+ int version, revision;
+ int nAdaptors;
+ XvAdaptorPtr pAdaptors;
+ DestroyWindowProcPtr DestroyWindow;
+ DestroyPixmapProcPtr DestroyPixmap;
+ CloseScreenProcPtr CloseScreen;
+ Bool (* ddCloseScreen)(int, ScreenPtr);
+ int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*);
+ DevUnion devPriv;
+} XvScreenRec, *XvScreenPtr;
+
+#define SCREEN_PROLOGUE(pScreen, field)\
+ ((pScreen)->field = \
+ ((XvScreenPtr) \
+ (pScreen)->devPrivates[XvScreenIndex].ptr)->field)
+
+#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+/* Errors */
+
+#define _XvBadPort (XvBadPort+XvErrorBase)
+#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
+
+extern int ProcXvDispatch(ClientPtr);
+extern int SProcXvDispatch(ClientPtr);
+
+extern void XvExtensionInit(void);
+extern int XvScreenInit(ScreenPtr);
+extern int XvGetScreenIndex(void);
+extern unsigned long XvGetRTPort(void);
+extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
+extern int XvdiVideoStopped(XvPortPtr, int);
+
+extern int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+extern int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+extern int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+extern int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+extern int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
+extern int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
+extern int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
+extern int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
+extern int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
+extern int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
+extern int XvdiMatchPort(XvPortPtr, DrawablePtr);
+extern int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
+extern int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
+
+
+#if defined(__STDC__) && !defined(UNIXCPP)
+
+#define XVCALL(name) Xv##name
+
+#else
+
+#define XVCALL(name) Xv/**/name
+
+#endif
+
+
+#endif /* XVDIX_H */
+
diff --git a/xc/programs/Xserver/Xext/xvmain.c b/xc/programs/Xserver/Xext/xvmain.c
new file mode 100644
index 000000000..5edf92542
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xvmain.c
@@ -0,0 +1,1173 @@
+/***********************************************************
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xvmain.c,v 1.6 1999/03/07 11:40:26 dawes Exp $ */
+
+/*
+** File:
+**
+** xvmain.c --- Xv server extension main device independent module.
+**
+** Author:
+**
+** David Carver (Digital Workstation Engineering/Project Athena)
+**
+** Revisions:
+**
+** 04.09.91 Carver
+** - change: stop video always generates an event even when video
+** wasn't active
+**
+** 29.08.91 Carver
+** - change: unrealizing windows no longer preempts video
+**
+** 11.06.91 Carver
+** - changed SetPortControl to SetPortAttribute
+** - changed GetPortControl to GetPortAttribute
+** - changed QueryBestSize
+**
+** 28.05.91 Carver
+** - fixed Put and Get requests to not preempt operations to same drawable
+**
+** 15.05.91 Carver
+** - version 2.0 upgrade
+**
+** 19.03.91 Carver
+** - fixed Put and Get requests to honor grabbed ports.
+** - fixed Video requests to update di structure with new drawable, and
+** client after calling ddx.
+**
+** 24.01.91 Carver
+** - version 1.4 upgrade
+**
+** Notes:
+**
+** Port structures reference client structures in a two different
+** ways: when grabs, or video is active. Each reference is encoded
+** as fake client resources and thus when the client is goes away so
+** does the reference (it is zeroed). No other action is taken, so
+** video doesn't necessarily stop. It probably will as a result of
+** other resources going away, but if a client starts video using
+** none of its own resources, then the video will continue to play
+** after the client disappears.
+**
+**
+*/
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "gc.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "input.h"
+
+#define GLOBAL
+
+#include "Xv.h"
+#include "Xvproto.h"
+#include "xvdix.h"
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+int XvScreenIndex = -1;
+unsigned long XvExtensionGeneration;
+unsigned long XvScreenGeneration;
+unsigned long XvResourceGeneration;
+
+int XvReqCode;
+int XvEventBase;
+int XvErrorBase;
+
+unsigned long XvRTPort;
+unsigned long XvRTEncoding;
+unsigned long XvRTGrab;
+unsigned long XvRTVideoNotify;
+unsigned long XvRTVideoNotifyList;
+unsigned long XvRTPortNotify;
+
+
+
+/* EXTERNAL */
+
+extern WindowPtr *WindowTable;
+extern XID clientErrorValue;
+
+static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
+static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
+static Bool CreateResourceTypes(void);
+
+static int lastScreenWithAdaptors = 0;
+
+static Bool XvCloseScreen(int, ScreenPtr);
+static Bool XvDestroyPixmap(PixmapPtr);
+static Bool XvDestroyWindow(WindowPtr);
+static void XvResetProc(ExtensionEntry*);
+static int XvdiDestroyGrab(pointer, XID);
+static int XvdiDestroyEncoding(pointer, XID);
+static int XvdiDestroyVideoNotify(pointer, XID);
+static int XvdiDestroyPortNotify(pointer, XID);
+static int XvdiDestroyVideoNotifyList(pointer, XID);
+static int XvdiDestroyPort(pointer, XID);
+static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
+
+
+
+
+/*
+** XvExtensionInit
+**
+**
+*/
+
+void
+XvExtensionInit()
+{
+ int ii;
+ register ExtensionEntry *extEntry;
+
+ /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
+ INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
+
+ if (XvScreenGeneration != serverGeneration)
+ {
+ if (!CreateResourceTypes())
+ {
+ ErrorF("XvExtensionInit: Unable to allocate resource types\n");
+ return;
+ }
+ XvScreenIndex = AllocateScreenPrivateIndex ();
+ if (XvScreenIndex < 0)
+ {
+ ErrorF("XvExtensionInit: Unable to allocate screen private index\n");
+ return;
+ }
+
+ XvScreenGeneration = serverGeneration;
+ }
+
+ /* ITS A LITTLE HARD TO UNDERSTAND WHAT THIS DOES, BUT ESSENTIALLY I WANT
+ ALL SCREEN THAT HAVE ADAPTORS TO HAVE A VALID DEVPRIVATE POINTER AND ANY
+ THAT DON'T TO HAVE NULL DEVPRIVATE POINTERS; THIS WAY I DON'T HAVE TO
+ CALL A SPECIAL XV SCREEN INITIALIZE FOR SCREENS WITHOUT ADAPTORS; THERE
+ SHOULD BE AN EASIER WAY TO DO THIS, BUT main.c DOESN'T INITIALIZE THE
+ DEVPRIVATE POINTERS FOR A NEWLY CREATED SCREEN, NOR ARE THEY INITIALIZED
+ WHEN A NEW SCREEN PRIVATE INDEX IS ALLOCATED */
+
+ for (ii=lastScreenWithAdaptors; ii<screenInfo.numScreens; ii++)
+ screenInfo.screens[ii]->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
+ lastScreenWithAdaptors = screenInfo.numScreens;
+
+ if (XvExtensionGeneration != serverGeneration)
+ {
+ XvExtensionGeneration = serverGeneration;
+
+ extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
+ ProcXvDispatch, SProcXvDispatch,
+ XvResetProc, StandardMinorOpcode);
+ if (!extEntry)
+ {
+ FatalError("XvExtensionInit: AddExtensions failed\n");
+ }
+
+ XvReqCode = extEntry->base;
+ XvEventBase = extEntry->eventBase;
+ XvErrorBase = extEntry->errorBase;
+
+ EventSwapVector[XvEventBase+XvVideoNotify] =
+ WriteSwappedVideoNotifyEvent;
+ EventSwapVector[XvEventBase+XvPortNotify] =
+ WriteSwappedPortNotifyEvent;
+
+ (void)MakeAtom(XvName, strlen(XvName), xTrue);
+
+ }
+}
+
+static Bool
+CreateResourceTypes()
+
+{
+
+ if (XvResourceGeneration == serverGeneration) return TRUE;
+
+ XvResourceGeneration = serverGeneration;
+
+ if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
+ return FALSE;
+ }
+
+ if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
+ return FALSE;
+ }
+
+ if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
+ return FALSE;
+ }
+
+ if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
+ return FALSE;
+ }
+
+ if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
+ return FALSE;
+ }
+
+ if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify)))
+ {
+ ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+
+}
+
+int
+XvScreenInit(ScreenPtr pScreen)
+{
+
+ int ii;
+ XvScreenPtr pxvs;
+
+ if (XvScreenGeneration != serverGeneration)
+ {
+ if (!CreateResourceTypes())
+ {
+ ErrorF("XvScreenInit: Unable to allocate resource types\n");
+ return BadAlloc;
+ }
+ XvScreenIndex = AllocateScreenPrivateIndex ();
+ if (XvScreenIndex < 0)
+ {
+ ErrorF("XvScreenInit: Unable to allocate screen private index\n");
+ return BadAlloc;
+ }
+ XvScreenGeneration = serverGeneration;
+ }
+
+ /* ITS A LITTLE HARD TO UNDERSTAND WHAT THIS DOES, BUT ESSENTIALLY I WANT
+ ALL SCREEN THAT HAVE ADAPTORS TO HAVE A VALID DEVPRIVATE POINTER AND ANY
+ THAT DON'T TO HAVE NULL DEVPRIVATE POINTERS; THIS WAY I DON'T HAVE TO
+ CALL A SPECIAL XV SCREEN INITIALIZE FOR SCREENS WITHOUT ADAPTORS; THERE
+ SHOULD BE AN EASIER WAY TO DO THIS, BUT main.c DOESN'T INITIALIZE THE
+ DEVPRIVATE POINTERS FOR A NEWLY CREATED SCREEN, NOR ARE THEY INITIALIZED
+ WHEN A NEW SCREEN PRIVATE INDEX IS ALLOCATED */
+
+ for (ii=lastScreenWithAdaptors; ii<screenInfo.numScreens; ii++)
+ screenInfo.screens[ii]->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
+ lastScreenWithAdaptors = screenInfo.numScreens;
+
+ if (pScreen->devPrivates[XvScreenIndex].ptr)
+ {
+ ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
+ }
+
+ /* ALLOCATE SCREEN PRIVATE RECORD */
+
+ pxvs = (XvScreenPtr) xalloc (sizeof (XvScreenRec));
+ if (!pxvs)
+ {
+ ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
+ return BadAlloc;
+ }
+
+ pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs;
+
+
+ pxvs->DestroyPixmap = pScreen->DestroyPixmap;
+ pxvs->DestroyWindow = pScreen->DestroyWindow;
+ pxvs->CloseScreen = pScreen->CloseScreen;
+
+ pScreen->DestroyPixmap = XvDestroyPixmap;
+ pScreen->DestroyWindow = XvDestroyWindow;
+ pScreen->CloseScreen = XvCloseScreen;
+
+ return Success;
+}
+
+static Bool
+XvCloseScreen(
+ int ii,
+ ScreenPtr pScreen
+){
+
+ XvScreenPtr pxvs;
+
+ pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr;
+
+ pScreen->DestroyPixmap = pxvs->DestroyPixmap;
+ pScreen->DestroyWindow = pxvs->DestroyWindow;
+ pScreen->CloseScreen = pxvs->CloseScreen;
+
+ (* pxvs->ddCloseScreen)(ii, pScreen);
+
+ xfree(pxvs);
+
+ pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
+
+ return (*pScreen->CloseScreen)(ii, pScreen);
+
+}
+
+static void
+XvResetProc(ExtensionEntry* extEntry)
+{
+ lastScreenWithAdaptors = 0;
+}
+
+int
+XvGetScreenIndex()
+{
+ return XvScreenIndex;
+}
+
+unsigned long
+XvGetRTPort()
+{
+ return XvRTPort;
+}
+
+static Bool
+XvDestroyPixmap(PixmapPtr pPix)
+{
+ Bool status;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+ XvAdaptorPtr pa;
+ int na;
+ XvPortPtr pp;
+ int np;
+
+ pScreen = pPix->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, DestroyPixmap);
+
+ pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
+
+ /* CHECK TO SEE IF THIS PORT IS IN USE */
+
+ pa = pxvs->pAdaptors;
+ na = pxvs->nAdaptors;
+ while (na--)
+ {
+ np = pa->nPorts;
+ pp = pa->pPorts;
+
+ while (np--)
+ {
+ if (pp->pDraw == (DrawablePtr)pPix)
+ {
+ XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
+
+ (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp,
+ pp->pDraw);
+
+ pp->pDraw = (DrawablePtr)NULL;
+ pp->client = (ClientPtr)NULL;
+ pp->time = currentTime;
+ }
+ pp++;
+ }
+ pa++;
+ }
+
+ status = (* pScreen->DestroyPixmap)(pPix);
+
+ SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
+
+ return status;
+
+}
+
+static Bool
+XvDestroyWindow(WindowPtr pWin)
+{
+ Bool status;
+ ScreenPtr pScreen;
+ XvScreenPtr pxvs;
+ XvAdaptorPtr pa;
+ int na;
+ XvPortPtr pp;
+ int np;
+
+ pScreen = pWin->drawable.pScreen;
+
+ SCREEN_PROLOGUE(pScreen, DestroyWindow);
+
+ pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
+
+ /* CHECK TO SEE IF THIS PORT IS IN USE */
+
+ pa = pxvs->pAdaptors;
+ na = pxvs->nAdaptors;
+ while (na--)
+ {
+ np = pa->nPorts;
+ pp = pa->pPorts;
+
+ while (np--)
+ {
+ if (pp->pDraw == (DrawablePtr)pWin)
+ {
+ XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
+
+ (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp,
+ pp->pDraw);
+
+ pp->pDraw = (DrawablePtr)NULL;
+ pp->client = (ClientPtr)NULL;
+ pp->time = currentTime;
+ }
+ pp++;
+ }
+ pa++;
+ }
+
+
+ status = (* pScreen->DestroyWindow)(pWin);
+
+ SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
+
+ return status;
+
+}
+
+/* The XvdiVideoStopped procedure is a hook for the device dependent layer.
+ It provides a way for the dd layer to inform the di layer that video has
+ stopped in a port for reasons that the di layer had no control over; note
+ that it doesn't call back into the dd layer */
+
+int
+XvdiVideoStopped(XvPortPtr pPort, int reason)
+{
+
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
+
+ if (!pPort->pDraw) return Success;
+
+ XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
+
+ pPort->pDraw = (DrawablePtr)NULL;
+ pPort->client = (ClientPtr)NULL;
+ pPort->time = currentTime;
+
+ return Success;
+
+}
+
+static int
+XvdiDestroyPort(pointer pPort, XID id)
+{
+ return (* ((XvPortPtr)pPort)->pAdaptor->ddFreePort)(pPort);
+}
+
+static int
+XvdiDestroyGrab(pointer pGrab, XID id)
+{
+ ((XvGrabPtr)pGrab)->client = (ClientPtr)NULL;
+ return Success;
+}
+
+static int
+XvdiDestroyVideoNotify(pointer pn, XID id)
+{
+ /* JUST CLEAR OUT THE client POINTER FIELD */
+
+ ((XvVideoNotifyPtr)pn)->client = (ClientPtr)NULL;
+ return Success;
+}
+
+static int
+XvdiDestroyPortNotify(pointer pn, XID id)
+{
+ /* JUST CLEAR OUT THE client POINTER FIELD */
+
+ ((XvPortNotifyPtr)pn)->client = (ClientPtr)NULL;
+ return Success;
+}
+
+static int
+XvdiDestroyVideoNotifyList(pointer pn, XID id)
+{
+ XvVideoNotifyPtr npn,cpn;
+
+ /* ACTUALLY DESTROY THE NOTITY LIST */
+
+ cpn = (XvVideoNotifyPtr)pn;
+
+ while (cpn)
+ {
+ npn = cpn->next;
+ if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
+ xfree(cpn);
+ cpn = npn;
+ }
+ return Success;
+}
+
+static int
+XvdiDestroyEncoding(pointer value, XID id)
+{
+ return Success;
+}
+
+static int
+XvdiSendVideoNotify(pPort, pDraw, reason)
+
+XvPortPtr pPort;
+DrawablePtr pDraw;
+int reason;
+
+{
+ xvEvent event;
+ XvVideoNotifyPtr pn;
+
+ pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
+
+ while (pn)
+ {
+ if (pn->client)
+ {
+ event.u.u.type = XvEventBase + XvVideoNotify;
+ event.u.u.sequenceNumber = pn->client->sequence;
+ event.u.videoNotify.time = currentTime.milliseconds;
+ event.u.videoNotify.drawable = pDraw->id;
+ event.u.videoNotify.port = pPort->id;
+ event.u.videoNotify.reason = reason;
+ (void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
+ NoEventMask, NullGrab);
+ }
+ pn = pn->next;
+ }
+
+ return Success;
+
+}
+
+
+int
+XvdiSendPortNotify(
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 value
+){
+ xvEvent event;
+ XvPortNotifyPtr pn;
+
+ pn = pPort->pNotify;
+
+ while (pn)
+ {
+ if (pn->client)
+ {
+ event.u.u.type = XvEventBase + XvPortNotify;
+ event.u.u.sequenceNumber = pn->client->sequence;
+ event.u.portNotify.time = currentTime.milliseconds;
+ event.u.portNotify.port = pPort->id;
+ event.u.portNotify.attribute = attribute;
+ event.u.portNotify.value = value;
+ (void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask,
+ NoEventMask, NullGrab);
+ }
+ pn = pn->next;
+ }
+
+ return Success;
+
+}
+
+int
+XvdiPutVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ int status;
+ DrawablePtr pOldDraw;
+
+ if(!drw_w || !drw_h || !vid_w || !vid_h)
+ return BadValue;
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
+ }
+
+ /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
+ EVENTS TO ANY CLIENTS WHO WANT THEM */
+
+ pOldDraw = pPort->pDraw;
+ if ((pOldDraw) && (pOldDraw != pDraw))
+ {
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+ }
+
+ status = (* pPort->pAdaptor->ddPutVideo)(client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
+
+ if ((pPort->pDraw) && (pOldDraw != pDraw))
+ {
+ pPort->client = client;
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
+ }
+
+ pPort->time = currentTime;
+
+ return (Success);
+
+}
+
+int
+XvdiPutStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ int status;
+
+ if(!drw_w || !drw_h || !vid_w || !vid_h)
+ return BadValue;
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
+ }
+
+ pPort->time = currentTime;
+
+ status = (* pPort->pAdaptor->ddPutStill)(client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
+
+ return status;
+
+}
+int
+XvdiGetVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ int status;
+ DrawablePtr pOldDraw;
+
+ if(!drw_w || !drw_h || !vid_w || !vid_h)
+ return BadValue;
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
+ }
+
+ /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED
+ EVENTS TO ANY CLIENTS WHO WANT THEM */
+
+ pOldDraw = pPort->pDraw;
+ if ((pOldDraw) && (pOldDraw != pDraw))
+ {
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+ }
+
+ status = (* pPort->pAdaptor->ddGetVideo)(client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
+
+ if ((pPort->pDraw) && (pOldDraw != pDraw))
+ {
+ pPort->client = client;
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
+ }
+
+ pPort->time = currentTime;
+
+ return (Success);
+
+}
+
+int
+XvdiGetStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ int status;
+
+ if(!drw_w || !drw_h || !vid_w || !vid_h)
+ return BadValue;
+
+ /* UPDATE TIME VARIABLES FOR USE IN EVENTS */
+
+ UpdateCurrentTime();
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if (pPort->grab.client && (pPort->grab.client != client))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
+ }
+
+ status = (* pPort->pAdaptor->ddGetStill)(client, pDraw, pPort, pGC,
+ vid_x, vid_y, vid_w, vid_h,
+ drw_x, drw_y, drw_w, drw_h);
+
+ pPort->time = currentTime;
+
+ return status;
+
+}
+
+int
+XvdiGrabPort(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Time ctime,
+ int *p_result
+){
+ unsigned long id;
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(ctime);
+
+ if (pPort->grab.client && (client != pPort->grab.client))
+ {
+ *p_result = XvAlreadyGrabbed;
+ return Success;
+ }
+
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, pPort->time) == EARLIER))
+ {
+ *p_result = XvInvalidTime;
+ return Success;
+ }
+
+ if (client == pPort->grab.client)
+ {
+ *p_result = Success;
+ return Success;
+ }
+
+ id = FakeClientID(client->index);
+
+ if (!AddResource(id, XvRTGrab, &pPort->grab))
+ {
+ return BadAlloc;
+ }
+
+ /* IF THERE IS ACTIVE VIDEO THEN STOP IT */
+
+ if ((pPort->pDraw) && (client != pPort->client))
+ {
+ XVCALL(diStopVideo)((ClientPtr)NULL, pPort, pPort->pDraw);
+ }
+
+ pPort->grab.client = client;
+ pPort->grab.id = id;
+
+ pPort->time = currentTime;
+
+ *p_result = Success;
+
+ return Success;
+
+}
+
+int
+XvdiUngrabPort(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Time ctime
+){
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(ctime);
+
+ if ((!pPort->grab.client) || (client != pPort->grab.client))
+ {
+ return Success;
+ }
+
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, pPort->time) == EARLIER))
+ {
+ return Success;
+ }
+
+ /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */
+
+ FreeResource(pPort->grab.id, XvRTGrab);
+ pPort->grab.client = (ClientPtr)NULL;
+
+ pPort->time = currentTime;
+
+ return Success;
+
+}
+
+
+int
+XvdiSelectVideoNotify(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ BOOL onoff
+){
+ XvVideoNotifyPtr pn,tpn,fpn;
+
+ /* FIND VideoNotify LIST */
+
+ pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
+
+ /* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
+
+ if (!onoff && !pn) return Success;
+
+ /* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
+ WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
+
+ if (!pn)
+ {
+ if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
+ return BadAlloc;
+ tpn->next = (XvVideoNotifyPtr)NULL;
+ if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
+ {
+ xfree(tpn);
+ return BadAlloc;
+ }
+ }
+ else
+ {
+ /* LOOK TO SEE IF ENTRY ALREADY EXISTS */
+
+ fpn = (XvVideoNotifyPtr)NULL;
+ tpn = pn;
+ while (tpn)
+ {
+ if (tpn->client == client)
+ {
+ if (!onoff) tpn->client = (ClientPtr)NULL;
+ return Success;
+ }
+ if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
+ tpn = tpn->next;
+ }
+
+ /* IF TUNNING OFF, THEN JUST RETURN */
+
+ if (!onoff) return Success;
+
+ /* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
+
+ if (fpn)
+ {
+ tpn = fpn;
+ }
+ else
+ {
+ if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec))))
+ return BadAlloc;
+ tpn->next = pn->next;
+ pn->next = tpn;
+ }
+ }
+
+ /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */
+ /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */
+
+ tpn->client = (ClientPtr)NULL;
+ tpn->id = FakeClientID(client->index);
+ AddResource(tpn->id, XvRTVideoNotify, tpn);
+
+ tpn->client = client;
+ return Success;
+
+}
+
+int
+XvdiSelectPortNotify(
+ ClientPtr client,
+ XvPortPtr pPort,
+ BOOL onoff
+){
+ XvPortNotifyPtr pn,tpn;
+
+ /* SEE IF CLIENT IS ALREADY IN LIST */
+
+ tpn = (XvPortNotifyPtr)NULL;
+ pn = pPort->pNotify;
+ while (pn)
+ {
+ if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */
+ if (pn->client == client) break;
+ pn = pn->next;
+ }
+
+ /* IS THE CLIENT ALREADY ON THE LIST? */
+
+ if (pn)
+ {
+ /* REMOVE IT? */
+
+ if (!onoff)
+ {
+ pn->client = (ClientPtr)NULL;
+ FreeResource(pn->id, XvRTPortNotify);
+ }
+
+ return Success;
+ }
+
+ /* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
+ CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
+
+ if (!tpn)
+ {
+ if (!(tpn = (XvPortNotifyPtr)xalloc(sizeof(XvPortNotifyRec))))
+ return BadAlloc;
+ tpn->next = pPort->pNotify;
+ pPort->pNotify = tpn;
+ }
+
+ tpn->client = client;
+ tpn->id = FakeClientID(client->index);
+ AddResource(tpn->id, XvRTPortNotify, tpn);
+
+ return Success;
+
+}
+
+int
+XvdiStopVideo(
+ ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+ int status;
+
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
+
+ if (!pPort->pDraw || (pPort->pDraw != pDraw))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvStopped);
+ return Success;
+ }
+
+ /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
+ INFORM CLIENT OF ITS FAILURE */
+
+ if ((client) && (pPort->grab.client) && (pPort->grab.client != client))
+ {
+ XvdiSendVideoNotify(pPort, pDraw, XvBusy);
+ return Success;
+ }
+
+ XvdiSendVideoNotify(pPort, pDraw, XvStopped);
+
+ status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw);
+
+ pPort->pDraw = (DrawablePtr)NULL;
+ pPort->client = (ClientPtr)client;
+ pPort->time = currentTime;
+
+ return status;
+
+}
+
+int
+XvdiPreemptVideo(
+ ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+ int status;
+
+ /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
+
+ if (!pPort->pDraw || (pPort->pDraw != pDraw)) return Success;
+
+ XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
+
+ status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw);
+
+ pPort->pDraw = (DrawablePtr)NULL;
+ pPort->client = (ClientPtr)client;
+ pPort->time = currentTime;
+
+ return status;
+
+}
+
+int
+XvdiMatchPort(
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+
+ XvAdaptorPtr pa;
+ XvFormatPtr pf;
+ int nf;
+
+ pa = pPort->pAdaptor;
+
+ if (pa->pScreen != pDraw->pScreen) return BadMatch;
+
+ nf = pa->nFormats;
+ pf = pa->pFormats;
+
+ while (nf--)
+ {
+ if ((pf->depth == pDraw->depth) &&
+ ((pDraw->type == DRAWABLE_PIXMAP) ||
+ (wVisual(((WindowPtr)pDraw)) == pf->visual)))
+ return Success;
+ pf++;
+ }
+
+ return BadMatch;
+
+}
+
+int
+XvdiSetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 value
+){
+
+ XvdiSendPortNotify(pPort, attribute, value);
+
+ return
+ (* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value);
+
+}
+
+int
+XvdiGetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 *p_value
+){
+
+ return
+ (* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value);
+
+}
+
+static void
+WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to)
+
+{
+
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.videoNotify.sequenceNumber,
+ to->u.videoNotify.sequenceNumber);
+ cpswapl(from->u.videoNotify.time, to->u.videoNotify.time);
+ cpswapl(from->u.videoNotify.drawable, to->u.videoNotify.drawable);
+ cpswapl(from->u.videoNotify.port, to->u.videoNotify.port);
+
+}
+
+static void
+WriteSwappedPortNotifyEvent(xvEvent *from, xvEvent *to)
+
+{
+
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.portNotify.sequenceNumber, to->u.portNotify.sequenceNumber);
+ cpswapl(from->u.portNotify.time, to->u.portNotify.time);
+ cpswapl(from->u.portNotify.port, to->u.portNotify.port);
+ cpswapl(from->u.portNotify.value, to->u.portNotify.value);
+
+}
diff --git a/xc/programs/Xserver/Xext/xvmod.c b/xc/programs/Xserver/Xext/xvmod.c
new file mode 100644
index 000000000..c8846eb8a
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xvmod.c
@@ -0,0 +1,19 @@
+/* $XFree86: xc/programs/Xserver/Xext/xvmod.c,v 1.1 1998/08/13 14:45:36 dawes Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "gc.h"
+#include "Xv.h"
+#include "Xvproto.h"
+#include "xvdix.h"
+#include "xvmodproc.h"
+
+void
+XvRegister()
+{
+ XvScreenInitProc = XvScreenInit;
+ XvGetScreenIndexProc = XvGetScreenIndex;
+ XvGetRTPortProc = XvGetRTPort;
+}
+
diff --git a/xc/programs/Xserver/Xext/xvmodproc.h b/xc/programs/Xserver/Xext/xvmodproc.h
new file mode 100644
index 000000000..978c400f2
--- /dev/null
+++ b/xc/programs/Xserver/Xext/xvmodproc.h
@@ -0,0 +1,7 @@
+/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.1 1998/08/13 14:45:36 dawes Exp $ */
+
+extern int (*XvGetScreenIndexProc)(void);
+extern unsigned long (*XvGetRTPortProc)(void);
+extern int (*XvScreenInitProc)(ScreenPtr);
+
+extern void XvRegister(void);
diff --git a/xc/programs/Xserver/Xi/Imakefile b/xc/programs/Xserver/Xi/Imakefile
new file mode 100644
index 000000000..51245ff40
--- /dev/null
+++ b/xc/programs/Xserver/Xi/Imakefile
@@ -0,0 +1,89 @@
+XCOMM $XConsortium: Imakefile /main/8 1996/09/28 16:56:49 rws $
+XCOMM $XFree86: xc/programs/Xserver/Xi/Imakefile,v 3.2 1999/04/17 09:08:22 dawes Exp $
+#include <Server.tmpl>
+
+ SRCS = allowev.c \
+ chgkbd.c \
+ chgdctl.c \
+ chgfctl.c \
+ chgkmap.c \
+ chgprop.c \
+ chgptr.c \
+ closedev.c \
+ devbell.c \
+ exevents.c \
+ extinit.c \
+ getdctl.c \
+ getfctl.c \
+ getfocus.c \
+ getbmap.c \
+ getkmap.c \
+ getmmap.c \
+ getprop.c \
+ getselev.c \
+ getvers.c \
+ gtmotion.c \
+ grabdev.c \
+ grabdevb.c \
+ grabdevk.c \
+ listdev.c \
+ opendev.c \
+ queryst.c \
+ selectev.c \
+ sendexev.c \
+ setdval.c \
+ setfocus.c \
+ setmode.c \
+ setbmap.c \
+ setmmap.c \
+ stubs.c \
+ ungrdev.c \
+ ungrdevb.c \
+ ungrdevk.c
+
+ OBJS = allowev.o \
+ chgkbd.o \
+ chgdctl.o \
+ chgfctl.o \
+ chgkmap.o \
+ chgprop.o \
+ chgptr.o \
+ closedev.o \
+ devbell.o \
+ exevents.o \
+ extinit.o \
+ getdctl.o \
+ getfctl.o \
+ getfocus.o \
+ getbmap.o \
+ getkmap.o \
+ getmmap.o \
+ getprop.o \
+ getselev.o \
+ getvers.o \
+ gtmotion.o \
+ grabdev.o \
+ grabdevb.o \
+ grabdevk.o \
+ listdev.o \
+ opendev.o \
+ queryst.o \
+ selectev.o \
+ sendexev.o \
+ setdval.o \
+ setfocus.o \
+ setmode.o \
+ setbmap.o \
+ setmmap.o \
+ ungrdev.o \
+ ungrdevb.o \
+ ungrdevk.o
+ INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC)
+ LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
+
+NormalLibraryTarget(xinput,$(OBJS))
+NormalLibraryObjectRule()
+LintLibraryTarget(xinput,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/Xi/allowev.c b/xc/programs/Xserver/Xi/allowev.c
new file mode 100644
index 000000000..455be1705
--- /dev/null
+++ b/xc/programs/Xserver/Xi/allowev.c
@@ -0,0 +1,137 @@
+/* $TOG: allowev.c /main/5 1998/02/09 15:27:57 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/allowev.c,v 3.2 1998/10/04 09:36:57 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Function to allow frozen events to be routed from extension input devices.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "allowev.h"
+#include "dixevents.h"
+
+/***********************************************************************
+ *
+ * This procedure allows frozen events to be routed.
+ *
+ */
+
+int
+SProcXAllowDeviceEvents(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xAllowDeviceEventsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
+ swapl(&stuff->time, n);
+ return(ProcXAllowDeviceEvents(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure allows frozen events to be routed.
+ *
+ */
+
+int
+ProcXAllowDeviceEvents(client)
+ register ClientPtr client;
+ {
+ TimeStamp time;
+ DeviceIntPtr thisdev;
+
+ REQUEST(xAllowDeviceEventsReq);
+ REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
+
+ thisdev = LookupDeviceIntRec (stuff->deviceid);
+ if (thisdev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
+ return Success;
+ }
+ time = ClientTimeToServerTime(stuff->time);
+
+ switch (stuff->mode)
+ {
+ case ReplayThisDevice:
+ AllowSome(client, time, thisdev, NOT_GRABBED);
+ break;
+ case SyncThisDevice:
+ AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
+ break;
+ case AsyncThisDevice:
+ AllowSome(client, time, thisdev, THAWED);
+ break;
+ case AsyncOtherDevices:
+ AllowSome(client, time, thisdev, THAW_OTHERS);
+ break;
+ case SyncAll:
+ AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
+ break;
+ case AsyncAll:
+ AllowSome(client, time, thisdev, THAWED_BOTH);
+ break;
+ default:
+ SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0,
+ BadValue);
+ client->errorValue = stuff->mode;
+ return Success;
+ }
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/allowev.h b/xc/programs/Xserver/Xi/allowev.h
new file mode 100644
index 000000000..950824927
--- /dev/null
+++ b/xc/programs/Xserver/Xi/allowev.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/allowev.h,v 3.1 1996/04/15 11:18:23 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef ALLOWEV_H
+#define ALLOWEV_H 1
+
+int
+SProcXAllowDeviceEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXAllowDeviceEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* ALLOWEV_H */
diff --git a/xc/programs/Xserver/Xi/chgdctl.c b/xc/programs/Xserver/Xi/chgdctl.c
new file mode 100644
index 000000000..3d386d023
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgdctl.c
@@ -0,0 +1,211 @@
+/* $TOG: chgdctl.c /main/5 1998/02/09 15:28:01 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgdctl.c,v 3.2 1998/10/04 09:36:57 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Change Device control attributes for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h" /* control constants */
+#include "XIstubs.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgdctl.h"
+
+/***********************************************************************
+ *
+ * This procedure changes the control attributes for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXChangeDeviceControl(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xChangeDeviceControlReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
+ swaps(&stuff->control, n);
+ return(ProcXChangeDeviceControl(client));
+ }
+
+/***********************************************************************
+ *
+ * Change the control attributes.
+ *
+ */
+
+int
+ProcXChangeDeviceControl(client)
+ ClientPtr client;
+ {
+ unsigned len;
+ int i, status;
+ DeviceIntPtr dev;
+ xDeviceResolutionCtl *r;
+ xChangeDeviceControlReply rep;
+ AxisInfoPtr a;
+ CARD32 *resolution;
+
+ REQUEST(xChangeDeviceControlReq);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
+
+ len = stuff->length - (sizeof(xChangeDeviceControlReq) >>2);
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
+ BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ChangeDeviceControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ switch (stuff->control)
+ {
+ case DEVICE_RESOLUTION:
+ r = (xDeviceResolutionCtl *) &stuff[1];
+ if ((len < (sizeof(xDeviceResolutionCtl)>>2)) ||
+ (len != (sizeof(xDeviceResolutionCtl)>>2) +
+ r->num_valuators))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl,
+ 0, BadLength);
+ return Success;
+ }
+ if (!dev->valuator)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+ if ((dev->grab) && !SameClient(dev->grab, client))
+ {
+ rep.status = AlreadyGrabbed;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ }
+ resolution = (CARD32 *) (r + 1);
+ if (r->first_valuator + r->num_valuators > dev->valuator->numAxes)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
+ BadValue);
+ return Success;
+ }
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
+ if (status == Success)
+ {
+ a = &dev->valuator->axes[r->first_valuator];
+ for (i=0; i<r->num_valuators; i++)
+ if (*(resolution+i) < (a+i)->min_resolution ||
+ *(resolution+i) > (a+i)->max_resolution)
+ {
+ SendErrorToClient (client, IReqCode,
+ X_ChangeDeviceControl, 0, BadValue);
+ return Success;
+ }
+ for (i=0; i<r->num_valuators; i++)
+ (a++)->resolution = *resolution++;
+ }
+ else if (status == DeviceBusy)
+ {
+ rep.status = DeviceBusy;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ }
+ else
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+ break;
+ default:
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
+ BadValue);
+ return Success;
+ }
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the xChangeDeviceControl function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXChangeDeviceControl (client, size, rep)
+ ClientPtr client;
+ int size;
+ xChangeDeviceControlReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
+
diff --git a/xc/programs/Xserver/Xi/chgdctl.h b/xc/programs/Xserver/Xi/chgdctl.h
new file mode 100644
index 000000000..4d245388d
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgdctl.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgdctl.h,v 3.1 1996/04/15 11:18:25 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGDCTL_H
+#define CHGDCTL_H 1
+
+int
+SProcXChangeDeviceControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangeDeviceControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXChangeDeviceControl (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xChangeDeviceControlReply * /* rep */
+#endif
+ );
+
+#endif /* CHGDCTL_H */
diff --git a/xc/programs/Xserver/Xi/chgfctl.c b/xc/programs/Xserver/Xi/chgfctl.c
new file mode 100644
index 000000000..9a8c0f0b9
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgfctl.c
@@ -0,0 +1,655 @@
+/* $TOG: chgfctl.c /main/14 1998/02/09 15:28:05 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgfctl.c,v 3.2 1998/10/04 09:36:58 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Change feedback control attributes for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h" /* control constants */
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgfctl.h"
+
+#define DO_ALL (-1)
+
+/***********************************************************************
+ *
+ * This procedure changes the control attributes for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXChangeFeedbackControl(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xChangeFeedbackControlReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
+ swapl(&stuff->mask, n);
+ return(ProcXChangeFeedbackControl(client));
+ }
+
+/***********************************************************************
+ *
+ * Change the control attributes.
+ *
+ */
+
+int
+ProcXChangeFeedbackControl(client)
+ ClientPtr client;
+ {
+ unsigned len;
+ DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ PtrFeedbackPtr p;
+ IntegerFeedbackPtr i;
+ StringFeedbackPtr s;
+ BellFeedbackPtr b;
+ LedFeedbackPtr l;
+
+ REQUEST(xChangeFeedbackControlReq);
+ REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
+
+ len = stuff->length - (sizeof(xChangeFeedbackControlReq) >>2);
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadDevice);
+ return Success;
+ }
+
+ switch (stuff->feedbackid)
+ {
+ case KbdFeedbackClass:
+ if (len != (sizeof(xKbdFeedbackCtl)>>2))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (k=dev->kbdfeed; k; k=k->next)
+ if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ case PtrFeedbackClass:
+ if (len != (sizeof(xPtrFeedbackCtl)>>2))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (p=dev->ptrfeed; p; p=p->next)
+ if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ case StringFeedbackClass:
+ {
+ register char n;
+ xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
+ if (client->swapped)
+ {
+ swaps(&f->num_keysyms,n);
+ }
+ if (len != ((sizeof(xStringFeedbackCtl)>>2) + f->num_keysyms))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (s=dev->stringfeed; s; s=s->next)
+ if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ }
+ case IntegerFeedbackClass:
+ if (len != (sizeof(xIntegerFeedbackCtl)>>2))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (i=dev->intfeed; i; i=i->next)
+ if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ case LedFeedbackClass:
+ if (len != (sizeof(xLedFeedbackCtl)>>2))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (l=dev->leds; l; l=l->next)
+ if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ case BellFeedbackClass:
+ if (len != (sizeof(xBellFeedbackCtl)>>2))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (b=dev->bell; b; b=b->next)
+ if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
+ {
+ ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]);
+ return Success;
+ }
+ break;
+ default:
+ break;
+ }
+
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes KbdFeedbackClass data.
+ *
+ */
+
+int
+ChangeKbdFeedback (client, dev, mask, k, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ KbdFeedbackPtr k;
+ xKbdFeedbackCtl *f;
+ {
+ register char n;
+ KeybdCtrl kctrl;
+ int t;
+ int key = DO_ALL;
+
+ if (client->swapped)
+ {
+ swaps(&f->length,n);
+ swaps(&f->pitch,n);
+ swaps(&f->duration,n);
+ swapl(&f->led_mask,n);
+ swapl(&f->led_values,n);
+ }
+
+ kctrl = k->ctrl;
+ if (mask & DvKeyClickPercent)
+ {
+ t = f->click;
+ if (t == -1)
+ t = defaultKeyboardControl.click;
+ else if (t < 0 || t > 100)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ kctrl.click = t;
+ }
+
+ if (mask & DvPercent)
+ {
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ kctrl.bell = t;
+ }
+
+ if (mask & DvPitch)
+ {
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ kctrl.bell_pitch = t;
+ }
+
+ if (mask & DvDuration)
+ {
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ kctrl.bell_duration = t;
+ }
+
+ if (mask & DvLed)
+ {
+ kctrl.leds &= ~(f->led_mask);
+ kctrl.leds |= (f->led_mask & f->led_values);
+ }
+
+ if (mask & DvKey)
+ {
+ key = (KeyCode) f->key;
+ if (key < 8 || key > 255)
+ {
+ client->errorValue = key;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ if (!(mask & DvAutoRepeatMode))
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+
+ if (mask & DvAutoRepeatMode)
+ {
+ int inx = (key >> 3);
+ int kmask = (1 << (key & 7));
+ t = (CARD8) f->auto_repeat_mode;
+ if (t == AutoRepeatModeOff)
+ {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = FALSE;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ }
+ else if (t == AutoRepeatModeOn)
+ {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = TRUE;
+ else
+ kctrl.autoRepeats[inx] |= kmask;
+ }
+ else if (t == AutoRepeatModeDefault)
+ {
+ if (key == DO_ALL)
+ kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
+ else
+ kctrl.autoRepeats[inx] &= ~kmask;
+ kctrl.autoRepeats[inx] =
+ (kctrl.autoRepeats[inx] & ~kmask) |
+ (defaultKeyboardControl.autoRepeats[inx] & kmask);
+ }
+ else
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ }
+
+ k->ctrl = kctrl;
+ (*k->CtrlProc)(dev, &k->ctrl);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes PtrFeedbackClass data.
+ *
+ */
+
+int
+ChangePtrFeedback (client, dev, mask, p, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ PtrFeedbackPtr p;
+ xPtrFeedbackCtl *f;
+ {
+ register char n;
+ PtrCtrl pctrl; /* might get BadValue part way through */
+
+ if (client->swapped)
+ {
+ swaps(&f->length,n);
+ swaps(&f->num,n);
+ swaps(&f->denom,n);
+ swaps(&f->thresh,n);
+ }
+
+ pctrl = p->ctrl;
+ if (mask & DvAccelNum)
+ {
+ int accelNum;
+
+ accelNum = f->num;
+ if (accelNum == -1)
+ pctrl.num = defaultPointerControl.num;
+ else if (accelNum < 0)
+ {
+ client->errorValue = accelNum;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ else pctrl.num = accelNum;
+ }
+
+ if (mask & DvAccelDenom)
+ {
+ int accelDenom;
+
+ accelDenom = f->denom;
+ if (accelDenom == -1)
+ pctrl.den = defaultPointerControl.den;
+ else if (accelDenom <= 0)
+ {
+ client->errorValue = accelDenom;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ else pctrl.den = accelDenom;
+ }
+
+ if (mask & DvThreshold)
+ {
+ int threshold;
+
+ threshold = f->thresh;
+ if (threshold == -1)
+ pctrl.threshold = defaultPointerControl.threshold;
+ else if (threshold < 0)
+ {
+ client->errorValue = threshold;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ else pctrl.threshold = threshold;
+ }
+
+ p->ctrl = pctrl;
+ (*p->CtrlProc)(dev, &p->ctrl);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes IntegerFeedbackClass data.
+ *
+ */
+
+int
+ChangeIntegerFeedback (client, dev, mask, i, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ IntegerFeedbackPtr i;
+ xIntegerFeedbackCtl *f;
+ {
+ register char n;
+
+ if (client->swapped)
+ {
+ swaps(&f->length,n);
+ swapl(&f->int_to_display,n);
+ }
+
+ i->ctrl.integer_displayed = f->int_to_display;
+ (*i->CtrlProc)(dev, &i->ctrl);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes StringFeedbackClass data.
+ *
+ */
+
+int
+ChangeStringFeedback (client, dev, mask, s, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ StringFeedbackPtr s;
+ xStringFeedbackCtl *f;
+ {
+ register char n;
+ register long *p;
+ int i, j;
+ KeySym *syms, *sup_syms;
+
+ syms = (KeySym *) (f+1);
+ if (client->swapped)
+ {
+ swaps(&f->length,n); /* swapped num_keysyms in calling proc */
+ p = (long *) (syms);
+ for (i=0; i<f->num_keysyms; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ }
+
+ if (f->num_keysyms > s->ctrl.max_symbols)
+ {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ sup_syms = s->ctrl.symbols_supported;
+ for (i=0; i<f->num_keysyms; i++)
+ {
+ for (j=0; j<s->ctrl.num_symbols_supported; j++)
+ if (*(syms+i) == *(sup_syms+j))
+ break;
+ if (j==s->ctrl.num_symbols_supported)
+ {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+
+ s->ctrl.num_symbols_displayed = f->num_keysyms;
+ for (i=0; i<f->num_keysyms; i++)
+ *(s->ctrl.symbols_displayed+i) = *(syms+i);
+ (*s->CtrlProc)(dev, &s->ctrl);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes BellFeedbackClass data.
+ *
+ */
+
+int
+ChangeBellFeedback (client, dev, mask, b, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ BellFeedbackPtr b;
+ xBellFeedbackCtl *f;
+ {
+ register char n;
+ int t;
+ BellCtrl bctrl; /* might get BadValue part way through */
+
+ if (client->swapped)
+ {
+ swaps(&f->length,n);
+ swaps(&f->pitch,n);
+ swaps(&f->duration,n);
+ }
+
+ bctrl = b->ctrl;
+ if (mask & DvPercent)
+ {
+ t = f->percent;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ bctrl.percent = t;
+ }
+
+ if (mask & DvPitch)
+ {
+ t = f->pitch;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ bctrl.pitch = t;
+ }
+
+ if (mask & DvDuration)
+ {
+ t = f->duration;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadValue);
+ return Success;
+ }
+ bctrl.duration = t;
+ }
+ b->ctrl = bctrl;
+ (*b->CtrlProc)(dev, &b->ctrl);
+ return Success;
+ }
+
+/******************************************************************************
+ *
+ * This procedure changes LedFeedbackClass data.
+ *
+ */
+
+int
+ChangeLedFeedback (client, dev, mask, l, f)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned long mask;
+ LedFeedbackPtr l;
+ xLedFeedbackCtl *f;
+ {
+ register char n;
+ LedCtrl lctrl; /* might get BadValue part way through */
+
+ if (client->swapped)
+ {
+ swaps(&f->length,n);
+ swapl(&f->led_values,n);
+ swapl(&f->led_mask,n);
+ }
+
+ f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
+ f->led_values &= l->ctrl.led_mask; /* set only supported leds */
+ if (mask & DvLed)
+ {
+ lctrl.led_mask = f->led_mask;
+ lctrl.led_values = f->led_values;
+ (*l->CtrlProc)(dev, &lctrl);
+ l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
+ l->ctrl.led_values |= (f->led_mask & f->led_values);/* OR in set leds*/
+ }
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/chgfctl.h b/xc/programs/Xserver/Xi/chgfctl.h
new file mode 100644
index 000000000..ebf41976c
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgfctl.h
@@ -0,0 +1,110 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgfctl.h,v 3.1 1996/04/15 11:18:26 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGFCTL_H
+#define CHGFCTL_H 1
+
+int
+SProcXChangeFeedbackControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangeFeedbackControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ChangeKbdFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ KbdFeedbackPtr /* k */,
+ xKbdFeedbackCtl * /* f */
+#endif
+ );
+
+int
+ChangePtrFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ PtrFeedbackPtr /* p */,
+ xPtrFeedbackCtl * /* f */
+#endif
+ );
+
+int
+ChangeIntegerFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ IntegerFeedbackPtr /* i */,
+ xIntegerFeedbackCtl * /* f */
+#endif
+ );
+
+int
+ChangeStringFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ StringFeedbackPtr /* s */,
+ xStringFeedbackCtl * /* f */
+#endif
+ );
+
+int
+ChangeBellFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ BellFeedbackPtr /* b */,
+ xBellFeedbackCtl * /* f */
+#endif
+ );
+
+int
+ChangeLedFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* dev */,
+ unsigned long /* mask */,
+ LedFeedbackPtr /* l */,
+ xLedFeedbackCtl * /* f */
+#endif
+ );
+
+#endif /* CHGFCTL_H */
diff --git a/xc/programs/Xserver/Xi/chgkbd.c b/xc/programs/Xserver/Xi/chgkbd.c
new file mode 100644
index 000000000..2f9522caf
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgkbd.c
@@ -0,0 +1,209 @@
+/* $TOG: chgkbd.c /main/21 1998/02/09 15:28:12 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkbd.c,v 3.3 1998/10/04 09:36:59 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to change the keyboard device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgkbd.h"
+#include "chgptr.h"
+
+/***********************************************************************
+ *
+ * This procedure changes the keyboard device.
+ *
+ */
+
+int
+SProcXChangeKeyboardDevice(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xChangeKeyboardDeviceReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
+ return(ProcXChangeKeyboardDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure is invoked to swap the request bytes if the server and
+ * client have a different byte order.
+ *
+ */
+
+int
+ProcXChangeKeyboardDevice (client)
+ register ClientPtr client;
+ {
+ int i;
+ DeviceIntPtr xkbd = inputInfo.keyboard;
+ DeviceIntPtr dev;
+ FocusClassPtr xf = xkbd->focus;
+ FocusClassPtr df;
+ KeyClassPtr k;
+ xChangeKeyboardDeviceReply rep;
+ changeDeviceNotify ev;
+ extern Bool Must_have_memory;
+
+ REQUEST(xChangeKeyboardDeviceReq);
+ REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ChangeKeyboardDevice;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ rep.status = -1;
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
+ return Success;
+ }
+
+ k = dev->key;
+ if (k == NULL)
+ {
+ rep.status = -1;
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadMatch);
+ return Success;
+ }
+
+ if (((dev->grab) && !SameClient(dev->grab, client)) ||
+ ((xkbd->grab) && !SameClient(xkbd->grab, client)))
+ rep.status = AlreadyGrabbed;
+ else if ((dev->sync.frozen &&
+ dev->sync.other && !SameClient(dev->sync.other, client)) ||
+ (xkbd->sync.frozen &&
+ xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
+ rep.status = GrabFrozen;
+ else
+ {
+ if (ChangeKeyboardDevice (xkbd, dev) != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
+ return Success;
+ }
+ if (!dev->focus)
+ InitFocusClassDeviceStruct (dev);
+ if (!dev->kbdfeed)
+ InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr)NoopDDA,
+ (KbdCtrlProcPtr)NoopDDA);
+ df = dev->focus;
+ df->win = xf->win;
+ df->revert = xf->revert;
+ df->time = xf->time;
+ df->traceGood = xf->traceGood;
+ if (df->traceSize != xf->traceSize)
+ {
+ Must_have_memory = TRUE; /* XXX */
+ df->trace = (WindowPtr *) xrealloc(df->trace,
+ xf->traceSize * sizeof(WindowPtr));
+ Must_have_memory = FALSE; /* XXX */
+ }
+ df->traceSize = xf->traceSize;
+ for (i=0; i<df->traceSize; i++)
+ df->trace[i] = xf->trace[i];
+ RegisterOtherDevice (xkbd);
+ RegisterKeyboardDevice (dev);
+
+ ev.type = ChangeDeviceNotify;
+ ev.deviceid = stuff->deviceid;
+ ev.time = currentTime.milliseconds;
+ ev.request = NewKeyboard;
+
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
+ SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
+ k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
+
+ rep.status = 0;
+ }
+
+ WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply),
+ &rep);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XChangeKeyboardDevice
+ * function, if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXChangeKeyboardDevice (client, size, rep)
+ ClientPtr client;
+ int size;
+ xChangeKeyboardDeviceReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/chgkbd.h b/xc/programs/Xserver/Xi/chgkbd.h
new file mode 100644
index 000000000..98b95a6b0
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgkbd.h
@@ -0,0 +1,54 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgkbd.h,v 3.1 1996/04/15 11:18:27 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGKBD_H
+#define CHGKBD_H 1
+
+int
+SProcXChangeKeyboardDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangeKeyboardDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXChangeKeyboardDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xChangeKeyboardDeviceReply * /* rep */
+#endif
+ );
+
+
+#endif /* CHGKBD_H */
diff --git a/xc/programs/Xserver/Xi/chgkmap.c b/xc/programs/Xserver/Xi/chgkmap.c
new file mode 100644
index 000000000..5862a51e2
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgkmap.c
@@ -0,0 +1,128 @@
+/* $TOG: chgkmap.c /main/5 1998/02/09 15:28:16 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkmap.c,v 3.1 1998/10/04 09:36:59 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Change key mapping for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgkmap.h"
+
+/***********************************************************************
+ *
+ * This procedure swaps the request when the client and
+ * server have different byte orderings.
+ *
+ */
+
+int
+SProcXChangeDeviceKeyMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i, count;
+
+ REQUEST(xChangeDeviceKeyMappingReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
+ p = (long *) &stuff[1];
+ count = stuff->keyCodes * stuff->keySymsPerKeyCode;
+ for (i = 0; i < count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ return(ProcXChangeDeviceKeyMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * Change the device key mapping.
+ *
+ */
+
+int
+ProcXChangeDeviceKeyMapping(client)
+ register ClientPtr client;
+ {
+ int ret;
+ unsigned len;
+ DeviceIntPtr dev;
+
+ REQUEST(xChangeDeviceKeyMappingReq);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
+ BadDevice);
+ return Success;
+ }
+ len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
+
+ ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
+ stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
+ (KeySym *)&stuff[1]);
+
+ if (ret != Success)
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
+ ret);
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/chgkmap.h b/xc/programs/Xserver/Xi/chgkmap.h
new file mode 100644
index 000000000..fa7035988
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgkmap.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgkmap.h,v 3.1 1996/04/15 11:18:28 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGKMAP_H
+#define CHGKMAP_H 1
+
+int
+SProcXChangeDeviceKeyMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangeDeviceKeyMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* CHGKMAP_H */
diff --git a/xc/programs/Xserver/Xi/chgprop.c b/xc/programs/Xserver/Xi/chgprop.c
new file mode 100644
index 000000000..89a6515a5
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgprop.c
@@ -0,0 +1,166 @@
+/* $TOG: chgprop.c /main/10 1998/02/09 15:28:20 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgprop.c,v 3.1 1998/10/04 09:36:59 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Function to modify the dont-propagate-list for an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h"
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgprop.h"
+#include "grabdev.h"
+
+/***********************************************************************
+ *
+ * This procedure returns the extension version.
+ *
+ */
+
+int
+SProcXChangeDeviceDontPropagateList(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+
+ REQUEST(xChangeDeviceDontPropagateListReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
+ swapl(&stuff->window, n);
+ swaps(&stuff->count, n);
+ p = (long *) &stuff[1];
+ for (i=0; i<stuff->count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ return(ProcXChangeDeviceDontPropagateList(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure changes the dont-propagate list for the specified window.
+ *
+ */
+
+int
+ProcXChangeDeviceDontPropagateList (client)
+ register ClientPtr client;
+ {
+ int i;
+ WindowPtr pWin;
+ struct tmask tmp[EMASKSIZE];
+ OtherInputMasks *others;
+
+ REQUEST(xChangeDeviceDontPropagateListReq);
+ REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
+
+ if (stuff->length !=(sizeof(xChangeDeviceDontPropagateListReq)>>2) +
+ stuff->count)
+ {
+ SendErrorToClient (client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
+ BadLength);
+ return Success;
+ }
+
+ pWin = (WindowPtr) LookupWindow (stuff->window, client);
+ if (!pWin)
+ {
+ client->errorValue = stuff->window;
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
+ BadWindow);
+ return Success;
+ }
+
+ if (stuff->mode != AddToList && stuff->mode != DeleteFromList)
+ {
+ client->errorValue = stuff->window;
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
+ BadMode);
+ return Success;
+ }
+
+ if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
+ stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success)
+ return Success;
+
+ others = wOtherInputMasks(pWin);
+ if (!others && stuff->mode == DeleteFromList)
+ return Success;
+ for (i=0; i<EMASKSIZE; i++)
+ {
+ if (tmp[i].mask == 0)
+ continue;
+
+ if (stuff->mode == DeleteFromList)
+ tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
+ else if (others)
+ tmp[i].mask |= others->dontPropagateMask[i];
+
+ if (DeviceEventSuppressForWindow (pWin,client,tmp[i].mask,i) != Success)
+ {
+ SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
+ BadClass);
+ return Success;
+ }
+ }
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/chgprop.h b/xc/programs/Xserver/Xi/chgprop.h
new file mode 100644
index 000000000..a72c6f036
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgprop.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgprop.h,v 3.1 1996/04/15 11:18:29 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGPROP_H
+#define CHGPROP_H 1
+
+int
+SProcXChangeDeviceDontPropagateList (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangeDeviceDontPropagateList (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* CHGPROP_H */
diff --git a/xc/programs/Xserver/Xi/chgptr.c b/xc/programs/Xserver/Xi/chgptr.c
new file mode 100644
index 000000000..0022e99f0
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgptr.c
@@ -0,0 +1,257 @@
+/* $TOG: chgptr.c /main/20 1998/02/09 15:28:25 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgptr.c,v 3.4 1998/10/04 09:37:00 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to change the pointer device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgptr.h"
+
+extern ScreenInfo screenInfo;
+extern WindowPtr *WindowTable;
+
+/***********************************************************************
+ *
+ * This procedure is invoked to swap the request bytes if the server and
+ * client have a different byte order.
+ *
+ */
+
+int
+SProcXChangePointerDevice(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xChangePointerDeviceReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
+ return(ProcXChangePointerDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure changes the device used as the X pointer.
+ *
+ */
+
+int
+ProcXChangePointerDevice (client)
+ register ClientPtr client;
+ {
+ DeviceIntPtr xptr = inputInfo.pointer;
+ DeviceIntPtr dev;
+ ValuatorClassPtr v;
+ xChangePointerDeviceReply rep;
+ changeDeviceNotify ev;
+
+ REQUEST(xChangePointerDeviceReq);
+ REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ChangePointerDevice;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ rep.status = -1;
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
+ return Success;
+ }
+
+ v = dev->valuator;
+ if (v == NULL || v->numAxes < 2 ||
+ stuff->xaxis >= v->numAxes ||
+ stuff->yaxis >= v->numAxes)
+ {
+ rep.status = -1;
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
+ return Success;
+ }
+
+ if (((dev->grab) && !SameClient(dev->grab, client)) ||
+ ((xptr->grab) && !SameClient(xptr->grab, client)))
+ rep.status = AlreadyGrabbed;
+ else if ((dev->sync.frozen &&
+ dev->sync.other && !SameClient(dev->sync.other, client)) ||
+ (xptr->sync.frozen &&
+ xptr->sync.other && !SameClient(xptr->sync.other, client)))
+ rep.status = GrabFrozen;
+ else
+ {
+ if (ChangePointerDevice (
+ xptr, dev, stuff->xaxis, stuff->yaxis) != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
+ return Success;
+ }
+ if (dev->focus)
+ DeleteFocusClassDeviceStruct(dev);
+ if (!dev->button)
+ InitButtonClassDeviceStruct (dev, 0, NULL);
+ if (!dev->ptrfeed)
+ InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
+ RegisterOtherDevice (xptr);
+ RegisterPointerDevice (dev);
+
+ ev.type = ChangeDeviceNotify;
+ ev.deviceid = stuff->deviceid;
+ ev.time = currentTime.milliseconds;
+ ev.request = NewPointer;
+
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
+ SendMappingNotify (MappingPointer, 0, 0, client);
+
+ rep.status = 0;
+ }
+
+ WriteReplyToClient (client, sizeof (xChangePointerDeviceReply),
+ &rep);
+ return Success;
+ }
+
+void
+DeleteFocusClassDeviceStruct(dev)
+ DeviceIntPtr dev;
+ {
+ xfree(dev->focus->trace);
+ xfree(dev->focus);
+ dev->focus = NULL;
+ }
+
+/***********************************************************************
+ *
+ * Send an event to interested clients in all windows on all screens.
+ *
+ */
+
+void
+SendEventToAllWindows (dev, mask, ev, count)
+ DeviceIntPtr dev;
+ Mask mask;
+ xEvent *ev;
+ int count;
+ {
+ int i;
+ WindowPtr pWin, p1;
+
+ for (i=0; i<screenInfo.numScreens; i++)
+ {
+ pWin = WindowTable[i];
+ (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
+ p1 = pWin->firstChild;
+ FindInterestedChildren (dev, p1, mask, ev, count);
+ }
+ }
+
+/***********************************************************************
+ *
+ * Walk through the window tree, finding all clients that want to know
+ * about the ChangeDeviceNotify Event.
+ *
+ */
+
+void
+FindInterestedChildren (dev, p1, mask, ev, count)
+ DeviceIntPtr dev;
+ WindowPtr p1;
+ Mask mask;
+ xEvent *ev;
+ int count;
+ {
+ WindowPtr p2;
+
+ while (p1)
+ {
+ p2 = p1->firstChild;
+ (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
+ FindInterestedChildren (dev, p2, mask, ev, count);
+ p1 = p1->nextSib;
+ }
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XChangePointerDevice
+ * function, if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXChangePointerDevice (client, size, rep)
+ ClientPtr client;
+ int size;
+ xChangePointerDeviceReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/chgptr.h b/xc/programs/Xserver/Xi/chgptr.h
new file mode 100644
index 000000000..93f5822fc
--- /dev/null
+++ b/xc/programs/Xserver/Xi/chgptr.h
@@ -0,0 +1,81 @@
+/* $XFree86: xc/programs/Xserver/Xi/chgptr.h,v 3.1 1996/04/15 11:18:31 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CHGPTR_H
+#define CHGPTR_H 1
+
+int
+SProcXChangePointerDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXChangePointerDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+DeleteFocusClassDeviceStruct(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* dev */
+#endif
+ );
+
+void
+SendEventToAllWindows (
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* dev */,
+ Mask /* mask */,
+ xEvent * /* ev */,
+ int /* count */
+#endif
+ );
+
+void
+FindInterestedChildren ( /* FIXME: could be static? */
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* dev */,
+ WindowPtr /* p1 */,
+ Mask /* mask */,
+ xEvent * /* ev */,
+ int /* count */
+#endif
+ );
+
+void
+SRepXChangePointerDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xChangePointerDeviceReply * /* rep */
+#endif
+ );
+
+#endif /* CHGPTR_H */
diff --git a/xc/programs/Xserver/Xi/closedev.c b/xc/programs/Xserver/Xi/closedev.c
new file mode 100644
index 000000000..2e89c5a1c
--- /dev/null
+++ b/xc/programs/Xserver/Xi/closedev.c
@@ -0,0 +1,186 @@
+/* $TOG: closedev.c /main/8 1998/02/09 15:28:29 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/closedev.c,v 3.1 1998/10/04 09:37:00 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to close an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "scrnintstr.h" /* screen structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "closedev.h"
+
+extern ScreenInfo screenInfo;
+extern WindowPtr *WindowTable;
+
+/***********************************************************************
+ *
+ * This procedure closes an input device.
+ *
+ */
+
+int
+SProcXCloseDevice(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xCloseDeviceReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCloseDeviceReq);
+ return(ProcXCloseDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure closes an input device.
+ *
+ */
+
+int
+ProcXCloseDevice(client)
+ register ClientPtr client;
+ {
+ int i;
+ WindowPtr pWin, p1;
+ DeviceIntPtr d;
+
+ REQUEST(xCloseDeviceReq);
+ REQUEST_SIZE_MATCH(xCloseDeviceReq);
+
+ d = LookupDeviceIntRec (stuff->deviceid);
+ if (d == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
+ return Success;
+ }
+
+ if (d->grab && SameClient(d->grab, client))
+ (*d->DeactivateGrab)(d); /* release active grab */
+
+ /* Remove event selections from all windows for events from this device
+ and selected by this client.
+ Delete passive grabs from all windows for this device. */
+
+ for (i=0; i<screenInfo.numScreens; i++)
+ {
+ pWin = WindowTable[i];
+ DeleteDeviceEvents (d, pWin, client);
+ p1 = pWin->firstChild;
+ DeleteEventsFromChildren (d, p1, client);
+ }
+
+ CloseInputDevice (d, client);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * Walk througth the window tree, deleting event selections for this client
+ * from this device from all windows.
+ *
+ */
+
+void
+DeleteEventsFromChildren(dev, p1, client)
+ DeviceIntPtr dev;
+ WindowPtr p1;
+ ClientPtr client;
+ {
+ WindowPtr p2;
+
+ while (p1)
+ {
+ p2 = p1->firstChild;
+ DeleteDeviceEvents (dev, p1, client);
+ DeleteEventsFromChildren(dev, p2, client);
+ p1 = p1->nextSib;
+ }
+ }
+
+/***********************************************************************
+ *
+ * Clear out event selections and passive grabs from a window for the
+ * specified device.
+ *
+ */
+
+void
+DeleteDeviceEvents (dev, pWin, client)
+ DeviceIntPtr dev;
+ WindowPtr pWin;
+ ClientPtr client;
+ {
+ InputClientsPtr others;
+ OtherInputMasks *pOthers;
+ GrabPtr grab, next;
+
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
+ for (others=pOthers->inputClients; others;
+ others = others->next)
+ if (SameClient(others,client))
+ others->mask[dev->id] = NoEventMask;
+
+ for (grab = wPassiveGrabs(pWin); grab; grab=next)
+ {
+ next = grab->next;
+ if ((grab->device == dev) &&
+ (client->clientAsMask == CLIENT_BITS(grab->resource)))
+ FreeResource (grab->resource, RT_NONE);
+ }
+ }
diff --git a/xc/programs/Xserver/Xi/closedev.h b/xc/programs/Xserver/Xi/closedev.h
new file mode 100644
index 000000000..f71336e96
--- /dev/null
+++ b/xc/programs/Xserver/Xi/closedev.h
@@ -0,0 +1,62 @@
+/* $XFree86: xc/programs/Xserver/Xi/closedev.h,v 3.1 1996/04/15 11:18:32 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef CLOSEDEV_H
+#define CLOSEDEV_H 1
+
+int
+SProcXCloseDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXCloseDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+DeleteEventsFromChildren(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* dev */,
+ WindowPtr /* p1 */,
+ ClientPtr /* client */
+#endif
+ );
+
+void
+DeleteDeviceEvents (
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* dev */,
+ WindowPtr /* pWin */,
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* CLOSEDEV_H */
diff --git a/xc/programs/Xserver/Xi/devbell.c b/xc/programs/Xserver/Xi/devbell.c
new file mode 100644
index 000000000..08c294d5f
--- /dev/null
+++ b/xc/programs/Xserver/Xi/devbell.c
@@ -0,0 +1,165 @@
+/* $TOG: devbell.c /main/5 1998/02/09 15:28:33 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/devbell.c,v 3.1 1998/10/04 09:37:01 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to change the keyboard device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "devbell.h"
+
+/***********************************************************************
+ *
+ * This procedure is invoked to swap the request bytes if the server and
+ * client have a different byte order.
+ *
+ */
+
+int
+SProcXDeviceBell(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xDeviceBellReq);
+ swaps(&stuff->length, n);
+ return(ProcXDeviceBell(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure rings a bell on an extension device.
+ *
+ */
+
+int
+ProcXDeviceBell (client)
+ register ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ BellFeedbackPtr b;
+ int base;
+ int newpercent;
+ CARD8 class;
+ pointer ctrl;
+ BellProcPtr proc;
+
+ REQUEST(xDeviceBellReq);
+ REQUEST_SIZE_MATCH(xDeviceBellReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ client->errorValue = stuff->deviceid;
+ SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
+ return Success;
+ }
+
+ if (stuff->percent < -100 || stuff->percent > 100)
+ {
+ client->errorValue = stuff->percent;
+ SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
+ return Success;
+ }
+ if (stuff->feedbackclass == KbdFeedbackClass)
+ {
+ for (k=dev->kbdfeed; k; k=k->next)
+ if (k->ctrl.id == stuff->feedbackid)
+ break;
+ if (!k)
+ {
+ client->errorValue = stuff->feedbackid;
+ SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
+ return Success;
+ }
+ base = k->ctrl.bell;
+ proc = k->BellProc;
+ ctrl = (pointer) &(k->ctrl);
+ class = KbdFeedbackClass;
+ }
+ else if (stuff->feedbackclass == BellFeedbackClass)
+ {
+ for (b=dev->bell; b; b=b->next)
+ if (b->ctrl.id == stuff->feedbackid)
+ break;
+ if (!b)
+ {
+ client->errorValue = stuff->feedbackid;
+ SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
+ return Success;
+ }
+ base = b->ctrl.percent;
+ proc = b->BellProc;
+ ctrl = (pointer) &(b->ctrl);
+ class = BellFeedbackClass;
+ }
+ else
+ {
+ client->errorValue = stuff->feedbackclass;
+ SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
+ return Success;
+ }
+ newpercent = (base * stuff->percent) / 100;
+ if (stuff->percent < 0)
+ newpercent = base + newpercent;
+ else
+ newpercent = base - newpercent + stuff->percent;
+ (*proc)(newpercent, dev, ctrl, class);
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/devbell.h b/xc/programs/Xserver/Xi/devbell.h
new file mode 100644
index 000000000..cccb31de9
--- /dev/null
+++ b/xc/programs/Xserver/Xi/devbell.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/devbell.h,v 3.1 1996/04/15 11:18:32 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef DEVBELL_H
+#define DEVBELL_H 1
+
+int
+SProcXDeviceBell (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXDeviceBell (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* DEVBELL_H */
diff --git a/xc/programs/Xserver/Xi/exevents.c b/xc/programs/Xserver/Xi/exevents.c
new file mode 100644
index 000000000..fa0d0012d
--- /dev/null
+++ b/xc/programs/Xserver/Xi/exevents.c
@@ -0,0 +1,1433 @@
+/* $TOG: exevents.c /main/53 1998/02/09 15:28:37 kaleb $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/exevents.c,v 3.7 1998/12/05 14:39:57 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Routines to register and initialize extension input devices.
+ * This also contains ProcessOtherEvent, the routine called from DDX
+ * to route extension events.
+ *
+ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "XI.h"
+#include "XIproto.h"
+#include "inputstr.h"
+#include "windowstr.h"
+#include "miscstruct.h"
+#include "region.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* DeliverFocusedEvent */
+#include "dixgrabs.h" /* CreateGrab() */
+
+#include "chgptr.h"
+
+#define WID(w) ((w) ? ((w)->drawable.id) : 0)
+#define AllModifiersMask ( \
+ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
+ Mod3Mask | Mod4Mask | Mod5Mask )
+#define AllButtonsMask ( \
+ Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
+#define Motion_Filter(class) (DevicePointerMotionMask | \
+ (class)->state | (class)->motionMask)
+
+static Bool ShouldFreeInputMasks(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ Bool /* ignoreSelectedEvents */
+#endif
+ );
+static Bool MakeInputMasks (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
+
+/**************************************************************************
+ *
+ * Procedures for extension device event routing.
+ *
+ */
+
+void
+RegisterOtherDevice (device)
+ DeviceIntPtr device;
+ {
+ device->public.processInputProc = ProcessOtherEvent;
+ device->public.realInputProc = ProcessOtherEvent;
+ (device)->ActivateGrab = ActivateKeyboardGrab;
+ (device)->DeactivateGrab = DeactivateKeyboardGrab;
+ }
+
+/*ARGSUSED*/
+void
+ProcessOtherEvent (xE, other, count)
+ xEventPtr xE;
+ register DeviceIntPtr other;
+ int count;
+ {
+ register BYTE *kptr;
+ register int i;
+ register CARD16 modifiers;
+ register CARD16 mask;
+ GrabPtr grab = other->grab;
+ Bool deactivateDeviceGrab = FALSE;
+ int key, bit, rootX, rootY;
+ ButtonClassPtr b = other->button;
+ KeyClassPtr k = other->key;
+ ValuatorClassPtr v = other->valuator;
+ deviceValuator *xV = (deviceValuator *) xE;
+
+ if (xE->u.u.type != DeviceValuator) {
+ GetSpritePosition(&rootX, &rootY);
+ xE->u.keyButtonPointer.rootX = rootX;
+ xE->u.keyButtonPointer.rootY = rootY;
+ key = xE->u.u.detail;
+ NoticeEventTime(xE);
+ xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
+ inputInfo.pointer->button->state;
+ bit = 1 << (key & 7);
+ }
+ if (DeviceEventCallback)
+ {
+ DeviceEventInfoRec eventinfo;
+ eventinfo.events = (xEventPtr) xE;
+ eventinfo.count = count;
+ CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
+ }
+ for (i=1; i<count; i++)
+ if ((++xV)->type == DeviceValuator)
+ {
+ int first = xV->first_valuator;
+ int *axisvals;
+
+ if (xV->num_valuators && (!v || (xV->num_valuators && (first + xV->num_valuators > v->numAxes))))
+ FatalError("Bad valuators reported for device %s\n",other->name);
+ xV->device_state = 0;
+ if (k)
+ xV->device_state |= k->state;
+ if (b)
+ xV->device_state |= b->state;
+ if (v && v->axisVal)
+ {
+ axisvals = v->axisVal;
+ switch (xV->num_valuators) {
+ case 6:
+ *(axisvals+first+5) = xV->valuator5;
+ case 5:
+ *(axisvals+first+4) = xV->valuator4;
+ case 4:
+ *(axisvals+first+3) = xV->valuator3;
+ case 3:
+ *(axisvals+first+2) = xV->valuator2;
+ case 2:
+ *(axisvals+first+1) = xV->valuator1;
+ case 1:
+ *(axisvals+first) = xV->valuator0;
+ case 0:
+ default:
+ break;
+ }
+ }
+ }
+
+ if (xE->u.u.type == DeviceKeyPress)
+ {
+ modifiers = k->modifierMap[key];
+ kptr = &k->down[key >> 3];
+ if (*kptr & bit) /* allow ddx to generate multiple downs */
+ {
+ if (!modifiers)
+ {
+ xE->u.u.type = DeviceKeyRelease;
+ ProcessOtherEvent(xE, other, count);
+ xE->u.u.type = DeviceKeyPress;
+ /* release can have side effects, don't fall through */
+ ProcessOtherEvent(xE, other, count);
+ }
+ return;
+ }
+ if (other->valuator)
+ other->valuator->motionHintWindow = NullWindow;
+ *kptr |= bit;
+ k->prev_state = k->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers)
+ {
+ /* This key affects modifier "i" */
+ k->modifierKeyCount[i]++;
+ k->state |= mask;
+ modifiers &= ~mask;
+ }
+ }
+ if (!grab && CheckDeviceGrabs(other, xE, 0, count))
+ {
+ other->activatingKey = key;
+ return;
+ }
+ }
+ else if (xE->u.u.type == DeviceKeyRelease)
+ {
+ kptr = &k->down[key >> 3];
+ if (!(*kptr & bit)) /* guard against duplicates */
+ return;
+ modifiers = k->modifierMap[key];
+ if (other->valuator)
+ other->valuator->motionHintWindow = NullWindow;
+ *kptr &= ~bit;
+ k->prev_state = k->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers)
+ {
+ /* This key affects modifier "i" */
+ if (--k->modifierKeyCount[i] <= 0)
+ {
+ k->modifierKeyCount[i] = 0;
+ k->state &= ~mask;
+ }
+ modifiers &= ~mask;
+ }
+ }
+
+ if (other->fromPassiveGrab && (key == other->activatingKey))
+ deactivateDeviceGrab = TRUE;
+ }
+ else if (xE->u.u.type == DeviceButtonPress)
+ {
+ kptr = &b->down[key >> 3];
+ *kptr |= bit;
+ if (other->valuator)
+ other->valuator->motionHintWindow = NullWindow;
+ b->buttonsDown++;
+ b->motionMask = DeviceButtonMotionMask;
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
+ return;
+ if (xE->u.u.detail <= 5)
+ b->state |= (Button1Mask >> 1) << xE->u.u.detail;
+ SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
+ if (!grab)
+ if (CheckDeviceGrabs(other, xE, 0, count))
+ return;
+
+ }
+ else if (xE->u.u.type == DeviceButtonRelease)
+ {
+ kptr = &b->down[key >> 3];
+ *kptr &= ~bit;
+ if (other->valuator)
+ other->valuator->motionHintWindow = NullWindow;
+ if (!--b->buttonsDown)
+ b->motionMask = 0;
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
+ return;
+ if (xE->u.u.detail <= 5)
+ b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
+ SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
+ if (!b->state && other->fromPassiveGrab)
+ deactivateDeviceGrab = TRUE;
+ }
+ else if (xE->u.u.type == ProximityIn)
+ other->valuator->mode &= ~OutOfProximity;
+ else if (xE->u.u.type == ProximityOut)
+ other->valuator->mode |= OutOfProximity;
+
+ if (grab)
+ DeliverGrabbedEvent(xE, other, deactivateDeviceGrab, count);
+ else if (other->focus)
+ DeliverFocusedEvent(other, xE, GetSpriteWindow(), count);
+ else
+ DeliverDeviceEvents(GetSpriteWindow(), xE, NullGrab, NullWindow,
+ other, count);
+
+ if (deactivateDeviceGrab == TRUE)
+ (*other->DeactivateGrab)(other);
+ }
+
+int
+InitProximityClassDeviceStruct( DeviceIntPtr dev)
+{
+ register ProximityClassPtr proxc;
+
+ proxc = (ProximityClassPtr)xalloc(sizeof(ProximityClassRec));
+ if (!proxc)
+ return FALSE;
+ dev->proximity = proxc;
+ return TRUE;
+}
+
+void
+InitValuatorAxisStruct( DeviceIntPtr dev,
+ int axnum,
+ int minval,
+ int maxval,
+ int resolution,
+ int min_res,
+ int max_res )
+{
+ register AxisInfoPtr ax = dev->valuator->axes + axnum;
+
+ ax->min_value = minval;
+ ax->max_value = maxval;
+ ax->resolution = resolution;
+ ax->min_resolution = min_res;
+ ax->max_resolution = max_res;
+}
+
+static void
+#if NeedFunctionPrototypes
+FixDeviceStateNotify (
+ DeviceIntPtr dev,
+ deviceStateNotify *ev,
+ KeyClassPtr k,
+ ButtonClassPtr b,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceStateNotify (dev, ev, k, b, v, first)
+ DeviceIntPtr dev;
+ deviceStateNotify *ev;
+ KeyClassPtr k;
+ ButtonClassPtr b;
+ ValuatorClassPtr v;
+ int first;
+#endif
+{
+ ev->type = DeviceStateNotify;
+ ev->deviceid = dev->id;
+ ev->time = currentTime.milliseconds;
+ ev->classes_reported = 0;
+ ev->num_keys = 0;
+ ev->num_buttons = 0;
+ ev->num_valuators = 0;
+
+ if (b) {
+ ev->classes_reported |= (1 << ButtonClass);
+ ev->num_buttons = b->numButtons;
+ memmove((char *) &ev->buttons[0], (char *) b->down, 4);
+ }
+ else if (k) {
+ ev->classes_reported |= (1 << KeyClass);
+ ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
+ memmove((char *) &ev->keys[0], (char *) k->down, 4);
+ }
+ if (v) {
+ int nval = v->numAxes - first;
+ ev->classes_reported |= (1 << ValuatorClass);
+ ev->classes_reported |= (dev->valuator->mode << ModeBitsShift);
+ ev->num_valuators = nval < 3 ? nval : 3;
+ switch (ev->num_valuators)
+ {
+ case 3:
+ ev->valuator2 = v->axisVal[first+2];
+ case 2:
+ ev->valuator1 = v->axisVal[first+1];
+ case 1:
+ ev->valuator0 = v->axisVal[first];
+ break;
+ }
+ }
+ }
+
+static void
+#if NeedFunctionPrototypes
+FixDeviceValuator (
+ DeviceIntPtr dev,
+ deviceValuator *ev,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceValuator (dev, ev, v, first)
+ DeviceIntPtr dev;
+ deviceValuator *ev;
+ ValuatorClassPtr v;
+ int first;
+#endif
+{
+ int nval = v->numAxes - first;
+
+ ev->type = DeviceValuator;
+ ev->deviceid = dev->id;
+ ev->num_valuators = nval < 3 ? nval : 3;
+ ev->first_valuator = first;
+ switch (ev->num_valuators) {
+ case 3:
+ ev->valuator2 = v->axisVal[first+2];
+ case 2:
+ ev->valuator1 = v->axisVal[first+1];
+ case 1:
+ ev->valuator0 = v->axisVal[first];
+ break;
+ }
+ first += ev->num_valuators;
+ }
+
+void
+DeviceFocusEvent(dev, type, mode, detail, pWin)
+ DeviceIntPtr dev;
+ int type, mode, detail;
+ register WindowPtr pWin;
+ {
+ deviceFocus event;
+
+ if (type == FocusIn)
+ type = DeviceFocusIn;
+ else
+ type = DeviceFocusOut;
+
+ event.deviceid = dev->id;
+ event.mode = mode;
+ event.type = type;
+ event.detail = detail;
+ event.window = pWin->drawable.id;
+ event.time = currentTime.milliseconds;
+
+ (void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1,
+ DeviceFocusChangeMask, NullGrab, dev->id);
+
+ if ((type == DeviceFocusIn) &&
+ (wOtherInputMasks(pWin)) &&
+ (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
+ {
+ int evcount = 1;
+ deviceStateNotify *ev, *sev;
+ deviceKeyStateNotify *kev;
+ deviceButtonStateNotify *bev;
+
+ KeyClassPtr k;
+ ButtonClassPtr b;
+ ValuatorClassPtr v;
+ int nval=0, nkeys=0, nbuttons=0, first=0;
+
+ if ((b=dev->button) != NULL) {
+ nbuttons = b->numButtons;
+ if (nbuttons > 32)
+ evcount++;
+ }
+ if ((k=dev->key) != NULL) {
+ nkeys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
+ if (nkeys > 32)
+ evcount++;
+ if (nbuttons > 0) {
+ evcount++;
+ }
+ }
+ if ((v=dev->valuator) != NULL) {
+ nval = v->numAxes;
+
+ if (nval > 3)
+ evcount++;
+ if (nval > 6) {
+ if (!(k && b))
+ evcount++;
+ if (nval > 9)
+ evcount += ((nval - 7) / 3);
+ }
+ }
+
+ sev = ev = (deviceStateNotify *) xalloc(evcount * sizeof(xEvent));
+ FixDeviceStateNotify (dev, ev, NULL, NULL, NULL, first);
+
+ if (b != NULL) {
+ FixDeviceStateNotify (dev, ev++, NULL, b, v, first);
+ first += 3;
+ nval -= 3;
+ if (nbuttons > 32) {
+ (ev-1)->deviceid |= MORE_EVENTS;
+ bev = (deviceButtonStateNotify *) ev++;
+ bev->type = DeviceButtonStateNotify;
+ bev->deviceid = dev->id;
+ memmove((char *) &bev->buttons[0], (char *) &b->down[4], 28);
+ }
+ if (nval > 0) {
+ (ev-1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ if (k != NULL) {
+ FixDeviceStateNotify (dev, ev++, k, NULL, v, first);
+ first += 3;
+ nval -= 3;
+ if (nkeys > 32) {
+ (ev-1)->deviceid |= MORE_EVENTS;
+ kev = (deviceKeyStateNotify *) ev++;
+ kev->type = DeviceKeyStateNotify;
+ kev->deviceid = dev->id;
+ memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
+ }
+ if (nval > 0) {
+ (ev-1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ while (nval > 0) {
+ FixDeviceStateNotify (dev, ev++, NULL, NULL, v, first);
+ first += 3;
+ nval -= 3;
+ if (nval > 0) {
+ (ev-1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ (void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount,
+ DeviceStateNotifyMask, NullGrab, dev->id);
+ xfree (sev);
+ }
+ }
+
+int
+#if NeedFunctionPrototypes
+GrabButton(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 button,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Cursor rcursor,
+ Window rconfineTo,
+ Mask eventMask)
+#else
+GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
+ modifier_device, button, grabWindow, ownerEvents, rcursor, rconfineTo,
+ eventMask)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ BYTE this_device_mode;
+ BYTE other_devices_mode;
+ CARD16 modifiers;
+ DeviceIntPtr modifier_device;
+ CARD8 button;
+ Window grabWindow;
+ BOOL ownerEvents;
+ Cursor rcursor;
+ Window rconfineTo;
+ Mask eventMask;
+#endif
+{
+ WindowPtr pWin, confineTo;
+ CursorPtr cursor;
+ GrabPtr grab;
+
+ if ((this_device_mode != GrabModeSync) &&
+ (this_device_mode != GrabModeAsync))
+ {
+ client->errorValue = this_device_mode;
+ return BadValue;
+ }
+ if ((other_devices_mode != GrabModeSync) &&
+ (other_devices_mode != GrabModeAsync))
+ {
+ client->errorValue = other_devices_mode;
+ return BadValue;
+ }
+ if ((modifiers != AnyModifier) &&
+ (modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = modifiers;
+ return BadValue;
+ }
+ if ((ownerEvents != xFalse) && (ownerEvents != xTrue))
+ {
+ client->errorValue = ownerEvents;
+ return BadValue;
+ }
+ pWin = LookupWindow(grabWindow, client);
+ if (!pWin)
+ return BadWindow;
+ if (rconfineTo == None)
+ confineTo = NullWindow;
+ else
+ {
+ confineTo = LookupWindow(rconfineTo, client);
+ if (!confineTo)
+ return BadWindow;
+ }
+ if (rcursor == None)
+ cursor = NullCursor;
+ else
+ {
+ cursor = (CursorPtr)LookupIDByType(rcursor, RT_CURSOR);
+ if (!cursor)
+ {
+ client->errorValue = rcursor;
+ return BadCursor;
+ }
+ }
+
+ grab = CreateGrab(client->index, dev, pWin, eventMask,
+ (Bool)ownerEvents, (Bool) this_device_mode, (Bool)other_devices_mode,
+ modifier_device, modifiers, DeviceButtonPress, button, confineTo,
+ cursor);
+ if (!grab)
+ return BadAlloc;
+ return AddPassiveGrabToList(grab);
+ }
+
+int
+#if NeedFunctionPrototypes
+GrabKey(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 key,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Mask mask)
+#else
+GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
+ modifier_device, key, grabWindow, ownerEvents, mask)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ BYTE this_device_mode;
+ BYTE other_devices_mode;
+ CARD16 modifiers;
+ DeviceIntPtr modifier_device;
+ CARD8 key;
+ Window grabWindow;
+ BOOL ownerEvents;
+ Mask mask;
+#endif
+{
+ WindowPtr pWin;
+ GrabPtr grab;
+ KeyClassPtr k = dev->key;
+
+ if (k==NULL)
+ return BadMatch;
+ if ((other_devices_mode != GrabModeSync) &&
+ (other_devices_mode != GrabModeAsync))
+ {
+ client->errorValue = other_devices_mode;
+ return BadValue;
+ }
+ if ((this_device_mode != GrabModeSync) &&
+ (this_device_mode != GrabModeAsync))
+ {
+ client->errorValue = this_device_mode;
+ return BadValue;
+ }
+ if (((key > k->curKeySyms.maxKeyCode) ||
+ (key < k->curKeySyms.minKeyCode))
+ && (key != AnyKey))
+ {
+ client->errorValue = key;
+ return BadValue;
+ }
+ if ((modifiers != AnyModifier) &&
+ (modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = modifiers;
+ return BadValue;
+ }
+ if ((ownerEvents != xTrue) && (ownerEvents != xFalse))
+ {
+ client->errorValue = ownerEvents;
+ return BadValue;
+ }
+ pWin = LookupWindow(grabWindow, client);
+ if (!pWin)
+ return BadWindow;
+
+ grab = CreateGrab(client->index, dev, pWin,
+ mask, ownerEvents, this_device_mode, other_devices_mode,
+ modifier_device, modifiers, DeviceKeyPress, key, NullWindow,
+ NullCursor);
+ if (!grab)
+ return BadAlloc;
+ return AddPassiveGrabToList(grab);
+ }
+
+int
+SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
+ DeviceIntPtr dev;
+ WindowPtr pWin;
+ ClientPtr client;
+ Mask mask;
+ Mask exclusivemasks;
+ Mask validmasks;
+{
+ int mskidx = dev->id;
+ int i, ret;
+ Mask check;
+ InputClientsPtr others;
+
+ if (mask & ~validmasks)
+ {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ check = (mask & exclusivemasks);
+ if (wOtherInputMasks(pWin))
+ {
+ if (check & wOtherInputMasks(pWin)->inputEvents[mskidx])
+ { /* It is illegal for two different
+ clients to select on any of the
+ events for maskcheck. However,
+ it is OK, for some client to
+ continue selecting on one of those
+ events. */
+ for (others = wOtherInputMasks(pWin)->inputClients; others;
+ others = others->next)
+ {
+ if (!SameClient(others, client) && (check &
+ others->mask[mskidx]))
+ return BadAccess;
+ }
+ }
+ for (others = wOtherInputMasks(pWin)->inputClients; others;
+ others = others->next)
+ {
+ if (SameClient(others, client))
+ {
+ check = others->mask[mskidx];
+ others->mask[mskidx] = mask;
+ if (mask == 0)
+ {
+ for (i=0; i<EMASKSIZE; i++)
+ if (i != mskidx && others->mask[i] != 0)
+ break;
+ if (i == EMASKSIZE)
+ {
+ RecalculateDeviceDeliverableEvents(pWin);
+ if (ShouldFreeInputMasks(pWin, FALSE))
+ FreeResource(others->resource, RT_NONE);
+ return Success;
+ }
+ }
+ goto maskSet;
+ }
+ }
+ }
+ check = 0;
+ if ((ret = AddExtensionClient (pWin, client, mask, mskidx)) != Success)
+ return ret;
+maskSet:
+ if (dev->valuator)
+ if ((dev->valuator->motionHintWindow == pWin) &&
+ (mask & DevicePointerMotionHintMask) &&
+ !(check & DevicePointerMotionHintMask) &&
+ !dev->grab)
+ dev->valuator->motionHintWindow = NullWindow;
+ RecalculateDeviceDeliverableEvents(pWin);
+ return Success;
+}
+
+int
+AddExtensionClient (pWin, client, mask, mskidx)
+ WindowPtr pWin;
+ ClientPtr client;
+ Mask mask;
+ int mskidx;
+ {
+ InputClientsPtr others;
+
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ return BadAlloc;
+ others = (InputClients *) xalloc(sizeof(InputClients));
+ if (!others)
+ return BadAlloc;
+ if (!pWin->optional->inputMasks && !MakeInputMasks (pWin))
+ return BadAlloc;
+ bzero((char *) &others->mask[0], sizeof(Mask)*EMASKSIZE);
+ others->mask[mskidx] = mask;
+ others->resource = FakeClientID(client->index);
+ others->next = pWin->optional->inputMasks->inputClients;
+ pWin->optional->inputMasks->inputClients = others;
+ if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer)pWin))
+ return BadAlloc;
+ return Success;
+ }
+
+static Bool
+MakeInputMasks (pWin)
+ WindowPtr pWin;
+ {
+ struct _OtherInputMasks *imasks;
+
+ imasks = (struct _OtherInputMasks *)
+ xalloc (sizeof (struct _OtherInputMasks));
+ if (!imasks)
+ return FALSE;
+ bzero((char *) imasks, sizeof (struct _OtherInputMasks));
+ pWin->optional->inputMasks = imasks;
+ return TRUE;
+ }
+
+void
+RecalculateDeviceDeliverableEvents(pWin)
+ WindowPtr pWin;
+ {
+ register InputClientsPtr others;
+ struct _OtherInputMasks *inputMasks; /* default: NULL */
+ register WindowPtr pChild, tmp;
+ int i;
+
+ pChild = pWin;
+ while (1)
+ {
+ if ((inputMasks = wOtherInputMasks(pChild)) != 0)
+ {
+ for (others = inputMasks->inputClients; others;
+ others = others->next)
+ {
+ for (i=0; i<EMASKSIZE; i++)
+ inputMasks->inputEvents[i] |= others->mask[i];
+ }
+ for (i=0; i<EMASKSIZE; i++)
+ inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i];
+ for (tmp = pChild->parent; tmp; tmp=tmp->parent)
+ if (wOtherInputMasks(tmp))
+ for (i=0; i<EMASKSIZE; i++)
+ inputMasks->deliverableEvents[i] |=
+ (wOtherInputMasks(tmp)->deliverableEvents[i]
+ & ~inputMasks->dontPropagateMask[i] & PropagateMask[i]);
+ }
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+ }
+
+int
+InputClientGone(pWin, id)
+ register WindowPtr pWin;
+ XID id;
+ {
+ register InputClientsPtr other, prev;
+ if (!wOtherInputMasks(pWin))
+ return(Success);
+ prev = 0;
+ for (other = wOtherInputMasks(pWin)->inputClients; other;
+ other = other->next)
+ {
+ if (other->resource == id)
+ {
+ if (prev)
+ {
+ prev->next = other->next;
+ xfree(other);
+ }
+ else if (!(other->next))
+ {
+ if (ShouldFreeInputMasks(pWin, TRUE))
+ {
+ wOtherInputMasks(pWin)->inputClients = other->next;
+ xfree(wOtherInputMasks(pWin));
+ pWin->optional->inputMasks = (OtherInputMasks *) NULL;
+ CheckWindowOptionalNeed (pWin);
+ xfree(other);
+ }
+ else
+ {
+ other->resource = FakeClientID(0);
+ if (!AddResource(other->resource, RT_INPUTCLIENT,
+ (pointer)pWin))
+ return BadAlloc;
+ }
+ }
+ else
+ {
+ wOtherInputMasks(pWin)->inputClients = other->next;
+ xfree(other);
+ }
+ RecalculateDeviceDeliverableEvents(pWin);
+ return(Success);
+ }
+ prev = other;
+ }
+ FatalError("client not on device event list");
+ /*NOTREACHED*/
+ }
+
+int
+SendEvent (client, d, dest, propagate, ev, mask, count)
+ ClientPtr client;
+ DeviceIntPtr d;
+ Window dest;
+ Bool propagate;
+ xEvent *ev;
+ Mask mask;
+ int count;
+ {
+ WindowPtr pWin;
+ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
+ WindowPtr spriteWin=GetSpriteWindow();
+
+ if (dest == PointerWindow)
+ pWin = spriteWin;
+ else if (dest == InputFocus)
+ {
+ WindowPtr inputFocus;
+
+ if (!d->focus)
+ inputFocus = spriteWin;
+ else
+ inputFocus = d->focus->win;
+
+ if (inputFocus == FollowKeyboardWin)
+ inputFocus = inputInfo.keyboard->focus->win;
+
+ if (inputFocus == NoneWin)
+ return Success;
+
+ /* If the input focus is PointerRootWin, send the event to where
+ the pointer is if possible, then perhaps propogate up to root. */
+ if (inputFocus == PointerRootWin)
+ inputFocus = GetCurrentRootWindow();
+
+ if (IsParent(inputFocus, spriteWin))
+ {
+ effectiveFocus = inputFocus;
+ pWin = spriteWin;
+ }
+ else
+ effectiveFocus = pWin = inputFocus;
+ }
+ else
+ pWin = LookupWindow(dest, client);
+ if (!pWin)
+ return BadWindow;
+ if ((propagate != xFalse) && (propagate != xTrue))
+ {
+ client->errorValue = propagate;
+ return BadValue;
+ }
+ ev->u.u.type |= 0x80;
+ if (propagate)
+ {
+ for (;pWin; pWin = pWin->parent)
+ {
+ if (DeliverEventsToWindow( pWin, ev, count, mask, NullGrab, d->id))
+ return Success;
+ if (pWin == effectiveFocus)
+ return Success;
+ if (wOtherInputMasks(pWin))
+ mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id];
+ if (!mask)
+ break;
+ }
+ }
+ else
+ (void)(DeliverEventsToWindow( pWin, ev, count, mask, NullGrab, d->id));
+ return Success;
+ }
+
+int
+SetButtonMapping (client, dev, nElts, map)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ int nElts;
+ BYTE *map;
+ {
+ register int i;
+ ButtonClassPtr b = dev->button;
+
+ if (b == NULL)
+ return BadMatch;
+
+ if (nElts != b->numButtons)
+ {
+ client->errorValue = nElts;
+ return BadValue;
+ }
+ if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
+ return BadValue;
+ for (i=0; i < nElts; i++)
+ if ((b->map[i + 1] != map[i]) &&
+ BitIsOn(b->down, i + 1))
+ return MappingBusy;
+ for (i = 0; i < nElts; i++)
+ b->map[i + 1] = map[i];
+ return Success;
+ }
+
+int
+SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ int len;
+ int rlen;
+ int numKeyPerModifier;
+ KeyCode *inputMap;
+ KeyClassPtr *k;
+{
+ KeyCode *map;
+ int inputMapLen;
+ register int i;
+
+ *k = dev->key;
+ if (*k == NULL)
+ return BadMatch;
+ if (len != ((numKeyPerModifier<<1) + rlen))
+ return BadLength;
+
+ inputMapLen = 8*numKeyPerModifier;
+
+ /*
+ * Now enforce the restriction that "all of the non-zero keycodes must be
+ * in the range specified by min-keycode and max-keycode in the
+ * connection setup (else a Value error)"
+ */
+ i = inputMapLen;
+ while (i--) {
+ if (inputMap[i]
+ && (inputMap[i] < (*k)->curKeySyms.minKeyCode
+ || inputMap[i] > (*k)->curKeySyms.maxKeyCode)) {
+ client->errorValue = inputMap[i];
+ return -1; /* BadValue collides with MappingFailed */
+ }
+ }
+
+ /*
+ * Now enforce the restriction that none of the old or new
+ * modifier keys may be down while we change the mapping, and
+ * that the DDX layer likes the choice.
+ */
+ if (!AllModifierKeysAreUp (dev, (*k)->modifierKeyMap,
+ (int)(*k)->maxKeysPerModifier, inputMap, (int)numKeyPerModifier)
+ ||
+ !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier,
+ (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier)) {
+ return MappingBusy;
+ } else {
+ for (i = 0; i < inputMapLen; i++) {
+ if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)dev)) {
+ return MappingFailed;
+ }
+ }
+ }
+
+ /*
+ * Now build the keyboard's modifier bitmap from the
+ * list of keycodes.
+ */
+ if (inputMapLen) {
+ map = (KeyCode *)xalloc(inputMapLen);
+ if (!map)
+ return BadAlloc;
+ }
+ if ((*k)->modifierKeyMap)
+ xfree((*k)->modifierKeyMap);
+ if (inputMapLen) {
+ (*k)->modifierKeyMap = map;
+ memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen);
+ } else
+ (*k)->modifierKeyMap = NULL;
+
+ (*k)->maxKeysPerModifier = numKeyPerModifier;
+ for (i = 0; i < MAP_LENGTH; i++)
+ (*k)->modifierMap[i] = 0;
+ for (i = 0; i < inputMapLen; i++) if (inputMap[i]) {
+ (*k)->modifierMap[inputMap[i]]
+ |= (1<<(i/ (*k)->maxKeysPerModifier));
+ }
+
+ return(MappingSuccess);
+ }
+
+void
+#if NeedFunctionPrototypes
+SendDeviceMappingNotify(
+ CARD8 request,
+ KeyCode firstKeyCode,
+ CARD8 count,
+ DeviceIntPtr dev)
+#else
+SendDeviceMappingNotify(request, firstKeyCode, count, dev)
+ CARD8 request, count;
+ KeyCode firstKeyCode;
+ DeviceIntPtr dev;
+#endif
+{
+ xEvent event;
+ deviceMappingNotify *ev = (deviceMappingNotify *) &event;
+
+ ev->type = DeviceMappingNotify;
+ ev->request = request;
+ ev->deviceid = dev->id;
+ ev->time = currentTime.milliseconds;
+ if (request == MappingKeyboard)
+ {
+ ev->firstKeyCode = firstKeyCode;
+ ev->count = count;
+ }
+
+ SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
+ }
+
+int
+#if NeedFunctionPrototypes
+ChangeKeyMapping(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ unsigned len,
+ int type,
+ KeyCode firstKeyCode,
+ CARD8 keyCodes,
+ CARD8 keySymsPerKeyCode,
+ KeySym *map)
+#else
+ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
+ keySymsPerKeyCode, map)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ unsigned len;
+ int type;
+ KeyCode firstKeyCode;
+ CARD8 keyCodes;
+ CARD8 keySymsPerKeyCode;
+ KeySym *map;
+#endif
+{
+ KeySymsRec keysyms;
+ KeyClassPtr k = dev->key;
+
+ if (k == NULL)
+ return (BadMatch);
+
+ if (len != (keyCodes * keySymsPerKeyCode))
+ return BadLength;
+
+ if ((firstKeyCode < k->curKeySyms.minKeyCode) ||
+ (firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode))
+ {
+ client->errorValue = firstKeyCode;
+ return BadValue;
+ }
+ if (keySymsPerKeyCode == 0)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ keysyms.minKeyCode = firstKeyCode;
+ keysyms.maxKeyCode = firstKeyCode + keyCodes - 1;
+ keysyms.mapWidth = keySymsPerKeyCode;
+ keysyms.map = map;
+ if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
+ return BadAlloc;
+ SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes,
+ dev);
+ return client->noClientException;
+ }
+
+void
+DeleteWindowFromAnyExtEvents(pWin, freeResources)
+ WindowPtr pWin;
+ Bool freeResources;
+ {
+ int i;
+ DeviceIntPtr dev;
+ InputClientsPtr ic;
+ struct _OtherInputMasks *inputMasks;
+
+ for (dev=inputInfo.devices; dev; dev=dev->next)
+ {
+ if (dev == inputInfo.pointer ||
+ dev == inputInfo.keyboard)
+ continue;
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
+ }
+
+ for (dev=inputInfo.off_devices; dev; dev=dev->next)
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
+
+ if (freeResources)
+ while ((inputMasks = wOtherInputMasks(pWin)) != 0)
+ {
+ ic = inputMasks->inputClients;
+ for (i=0; i<EMASKSIZE; i++)
+ inputMasks->dontPropagateMask[i] = 0;
+ FreeResource(ic->resource, RT_NONE);
+ }
+ }
+
+void
+DeleteDeviceFromAnyExtEvents(pWin, dev)
+ WindowPtr pWin;
+ DeviceIntPtr dev;
+ {
+ WindowPtr parent;
+
+ /* Deactivate any grabs performed on this window, before making
+ any input focus changes.
+ Deactivating a device grab should cause focus events. */
+
+ if (dev->grab && (dev->grab->window == pWin))
+ (*dev->DeactivateGrab)(dev);
+
+ /* If the focus window is a root window (ie. has no parent)
+ then don't delete the focus from it. */
+
+ if (dev->focus && (pWin==dev->focus->win) && (pWin->parent != NullWindow))
+ {
+ int focusEventMode = NotifyNormal;
+
+ /* If a grab is in progress, then alter the mode of focus events. */
+
+ if (dev->grab)
+ focusEventMode = NotifyWhileGrabbed;
+
+ switch (dev->focus->revert)
+ {
+ case RevertToNone:
+ DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
+ dev->focus->win = NoneWin;
+ dev->focus->traceGood = 0;
+ break;
+ case RevertToParent:
+ parent = pWin;
+ do
+ {
+ parent = parent->parent;
+ dev->focus->traceGood--;
+ } while (!parent->realized);
+ DoFocusEvents(dev, pWin, parent, focusEventMode);
+ dev->focus->win = parent;
+ dev->focus->revert = RevertToNone;
+ break;
+ case RevertToPointerRoot:
+ DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode);
+ dev->focus->win = PointerRootWin;
+ dev->focus->traceGood = 0;
+ break;
+ case RevertToFollowKeyboard:
+ if (inputInfo.keyboard->focus->win) {
+ DoFocusEvents(dev, pWin, inputInfo.keyboard->focus->win,
+ focusEventMode);
+ dev->focus->win = FollowKeyboardWin;
+ dev->focus->traceGood = 0;
+ } else {
+ DoFocusEvents(dev, pWin, NoneWin, focusEventMode);
+ dev->focus->win = NoneWin;
+ dev->focus->traceGood = 0;
+ }
+ break;
+ }
+ }
+
+ if (dev->valuator)
+ if (dev->valuator->motionHintWindow == pWin)
+ dev->valuator->motionHintWindow = NullWindow;
+ }
+
+int
+MaybeSendDeviceMotionNotifyHint (pEvents, mask)
+ deviceKeyButtonPointer *pEvents;
+ Mask mask;
+ {
+ DeviceIntPtr dev;
+
+ dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS);
+ if (pEvents->type == DeviceMotionNotify)
+ {
+ if (mask & DevicePointerMotionHintMask)
+ {
+ if (WID(dev->valuator->motionHintWindow) == pEvents->event)
+ {
+ return 1; /* don't send, but pretend we did */
+ }
+ pEvents->detail = NotifyHint;
+ }
+ else
+ {
+ pEvents->detail = NotifyNormal;
+ }
+ }
+ return (0);
+ }
+
+void
+CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
+ WindowPtr pWin;
+ int type;
+ deviceKeyButtonPointer *xE;
+ GrabPtr grab;
+ ClientPtr client;
+ Mask deliveryMask;
+ {
+ DeviceIntPtr dev;
+
+ dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS);
+ if (type == DeviceMotionNotify)
+ dev->valuator->motionHintWindow = pWin;
+ else if ((type == DeviceButtonPress) && (!grab) &&
+ (deliveryMask & DeviceButtonGrabMask))
+ {
+ GrabRec tempGrab;
+
+ tempGrab.device = dev;
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.window = pWin;
+ tempGrab.ownerEvents = (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE;
+ tempGrab.eventMask = deliveryMask;
+ tempGrab.keyboardMode = GrabModeAsync;
+ tempGrab.pointerMode = GrabModeAsync;
+ tempGrab.confineTo = NullWindow;
+ tempGrab.cursor = NullCursor;
+ (*dev->ActivateGrab)(dev, &tempGrab, currentTime, TRUE);
+ }
+ }
+
+Mask
+DeviceEventMaskForClient(dev, pWin, client)
+ DeviceIntPtr dev;
+ WindowPtr pWin;
+ ClientPtr client;
+ {
+ register InputClientsPtr other;
+
+ if (!wOtherInputMasks(pWin))
+ return 0;
+ for (other = wOtherInputMasks(pWin)->inputClients; other;
+ other = other->next)
+ {
+ if (SameClient(other, client))
+ return other->mask[dev->id];
+ }
+ return 0;
+ }
+
+void
+MaybeStopDeviceHint(dev, client)
+ register DeviceIntPtr dev;
+ ClientPtr client;
+{
+ WindowPtr pWin;
+ GrabPtr grab = dev->grab;
+ pWin = dev->valuator->motionHintWindow;
+
+ if ((grab && SameClient(grab, client) &&
+ ((grab->eventMask & DevicePointerMotionHintMask) ||
+ (grab->ownerEvents &&
+ (DeviceEventMaskForClient(dev, pWin, client) &
+ DevicePointerMotionHintMask)))) ||
+ (!grab &&
+ (DeviceEventMaskForClient(dev, pWin, client) &
+ DevicePointerMotionHintMask)))
+ dev->valuator->motionHintWindow = NullWindow;
+}
+
+int
+DeviceEventSuppressForWindow(pWin, client, mask, maskndx)
+ WindowPtr pWin;
+ ClientPtr client;
+ Mask mask;
+ int maskndx;
+ {
+ struct _OtherInputMasks *inputMasks = wOtherInputMasks (pWin);
+
+ if (mask & ~PropagateMask[maskndx])
+ {
+ client->errorValue = mask;
+ return BadValue;
+ }
+
+ if (mask == 0)
+ {
+ if (inputMasks)
+ inputMasks->dontPropagateMask[maskndx] = mask;
+ }
+ else
+ {
+ if (!inputMasks)
+ AddExtensionClient (pWin, client, 0, 0);
+ inputMasks = wOtherInputMasks(pWin);
+ inputMasks->dontPropagateMask[maskndx] = mask;
+ }
+ RecalculateDeviceDeliverableEvents(pWin);
+ if (ShouldFreeInputMasks(pWin, FALSE))
+ FreeResource(inputMasks->inputClients->resource, RT_NONE);
+ return Success;
+ }
+
+static Bool
+ShouldFreeInputMasks (pWin, ignoreSelectedEvents)
+ WindowPtr pWin;
+ Bool ignoreSelectedEvents;
+ {
+ int i;
+ Mask allInputEventMasks = 0;
+ struct _OtherInputMasks *inputMasks = wOtherInputMasks (pWin);
+
+ for (i=0; i<EMASKSIZE; i++)
+ allInputEventMasks |= inputMasks->dontPropagateMask[i];
+ if (!ignoreSelectedEvents)
+ for (i=0; i<EMASKSIZE; i++)
+ allInputEventMasks |= inputMasks->inputEvents[i];
+ if (allInputEventMasks == 0)
+ return TRUE;
+ else
+ return FALSE;
+ }
diff --git a/xc/programs/Xserver/Xi/exglobals.h b/xc/programs/Xserver/Xi/exglobals.h
new file mode 100644
index 000000000..f07618b84
--- /dev/null
+++ b/xc/programs/Xserver/Xi/exglobals.h
@@ -0,0 +1,76 @@
+/* $XFree86: xc/programs/Xserver/Xi/exglobals.h,v 3.3 1998/12/05 14:39:57 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*****************************************************************
+ *
+ * Globals referenced elsewhere in the server.
+ *
+ */
+#ifndef EXGLOBALS_H
+#define EXGLOBALS_H 1
+
+extern int IReqCode;
+extern int BadDevice;
+extern int BadEvent;
+extern int BadMode;
+extern int DeviceBusy;
+extern int BadClass;
+
+extern Mask DevicePointerMotionMask;
+extern Mask DevicePointerMotionHintMask;
+extern Mask DeviceFocusChangeMask;
+extern Mask DeviceStateNotifyMask;
+extern Mask ChangeDeviceNotifyMask;
+extern Mask DeviceMappingNotifyMask;
+extern Mask DeviceOwnerGrabButtonMask;
+extern Mask DeviceButtonGrabMask;
+extern Mask DeviceButtonMotionMask;
+extern Mask PropagateMask[];
+
+extern int DeviceValuator;
+extern int DeviceKeyPress;
+extern int DeviceKeyRelease;
+extern int DeviceButtonPress;
+extern int DeviceButtonRelease;
+extern int DeviceMotionNotify;
+extern int DeviceFocusIn;
+extern int DeviceFocusOut;
+extern int ProximityIn;
+extern int ProximityOut;
+extern int DeviceStateNotify;
+extern int DeviceKeyStateNotify;
+extern int DeviceButtonStateNotify;
+extern int DeviceMappingNotify;
+extern int ChangeDeviceNotify;
+
+extern int RT_INPUTCLIENT;
+
+#if 0
+/* FIXME: in dix */
+extern InputInfo inputInfo;
+#endif
+
+#endif /* EXGLOBALS_H */
diff --git a/xc/programs/Xserver/Xi/extinit.c b/xc/programs/Xserver/Xi/extinit.c
new file mode 100644
index 000000000..09aa9470f
--- /dev/null
+++ b/xc/programs/Xserver/Xi/extinit.c
@@ -0,0 +1,1013 @@
+/* $TOG: extinit.c /main/19 1998/02/09 15:28:43 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/extinit.c,v 3.4 1998/10/04 09:37:02 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Dispatch routines and initialization routines for the X input extension.
+ *
+ */
+
+#define NUMTYPES 15
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#include "gcstruct.h" /* pointer for extnsionst.h*/
+#include "extnsionst.h" /* extension entry */
+#include "XI.h"
+#include "XIproto.h"
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+#include "swaprep.h"
+
+/* modules local to Xi */
+#include "allowev.h"
+#include "chgdctl.h"
+#include "chgfctl.h"
+#include "chgkbd.h"
+#include "chgprop.h"
+#include "chgptr.h"
+#include "closedev.h"
+#include "devbell.h"
+#include "getbmap.h"
+#include "getbmap.h"
+#include "getdctl.h"
+#include "getfctl.h"
+#include "getfocus.h"
+#include "getkmap.h"
+#include "getmmap.h"
+#include "getprop.h"
+#include "getselev.h"
+#include "getvers.h"
+#include "getvers.h"
+#include "grabdev.h"
+#include "grabdevb.h"
+#include "grabdevk.h"
+#include "gtmotion.h"
+#include "listdev.h"
+#include "opendev.h"
+#include "queryst.h"
+#include "selectev.h"
+#include "sendexev.h"
+#include "chgkmap.h"
+#include "setbmap.h"
+#include "setdval.h"
+#include "setfocus.h"
+#include "setmmap.h"
+#include "setmode.h"
+#include "ungrdev.h"
+#include "ungrdevb.h"
+#include "ungrdevk.h"
+
+static Mask lastExtEventMask = 1;
+int ExtEventIndex;
+Mask ExtValidMasks[EMASKSIZE];
+Mask ExtExclusiveMasks[EMASKSIZE];
+
+struct dev_type
+ {
+ Atom type;
+ char *name;
+ }dev_type [] = {{0,XI_KEYBOARD},
+ {0,XI_MOUSE},
+ {0,XI_TABLET},
+ {0,XI_TOUCHSCREEN},
+ {0,XI_TOUCHPAD},
+ {0,XI_BARCODE},
+ {0,XI_BUTTONBOX},
+ {0,XI_KNOB_BOX},
+ {0,XI_ONE_KNOB},
+ {0,XI_NINE_KNOB},
+ {0,XI_TRACKBALL},
+ {0,XI_QUADRATURE},
+ {0,XI_ID_MODULE},
+ {0,XI_SPACEBALL},
+ {0,XI_DATAGLOVE},
+ {0,XI_EYETRACKER},
+ {0,XI_CURSORKEYS},
+ {0,XI_FOOTMOUSE}};
+
+CARD8 event_base [numInputClasses];
+XExtEventInfo EventInfo[32];
+
+/*****************************************************************
+ *
+ * Globals referenced elsewhere in the server.
+ *
+ */
+
+int IReqCode = 0;
+int BadDevice = 0;
+int BadEvent = 1;
+int BadMode = 2;
+int DeviceBusy = 3;
+int BadClass = 4;
+
+Mask DevicePointerMotionMask;
+Mask DevicePointerMotionHintMask;
+Mask DeviceFocusChangeMask;
+Mask DeviceStateNotifyMask;
+Mask ChangeDeviceNotifyMask;
+Mask DeviceMappingNotifyMask;
+Mask DeviceOwnerGrabButtonMask;
+Mask DeviceButtonGrabMask;
+Mask DeviceButtonMotionMask;
+
+int DeviceValuator;
+int DeviceKeyPress;
+int DeviceKeyRelease;
+int DeviceButtonPress;
+int DeviceButtonRelease;
+int DeviceMotionNotify;
+int DeviceFocusIn;
+int DeviceFocusOut;
+int ProximityIn;
+int ProximityOut;
+int DeviceStateNotify;
+int DeviceKeyStateNotify;
+int DeviceButtonStateNotify;
+int DeviceMappingNotify;
+int ChangeDeviceNotify;
+
+int RT_INPUTCLIENT;
+
+/*****************************************************************
+ *
+ * Externs defined elsewhere in the X server.
+ *
+ */
+
+extern XExtensionVersion AllExtensionVersions[];
+
+Mask PropagateMask[MAX_DEVICES];
+
+/*****************************************************************
+ *
+ * Declarations of local routines.
+ *
+ */
+
+static XExtensionVersion thisversion =
+ {XI_Present,
+ XI_Add_XChangeDeviceControl_Major,
+ XI_Add_XChangeDeviceControl_Minor};
+
+/**********************************************************************
+ *
+ * IExtensionInit - initialize the input extension.
+ *
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
+ *
+ * This extension has several events and errors.
+ *
+ */
+
+void
+XInputExtensionInit()
+{
+ ExtensionEntry *extEntry;
+
+ extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
+ SProcIDispatch, IResetProc, StandardMinorOpcode);
+ if (extEntry)
+ {
+ IReqCode = extEntry->base;
+ AllExtensionVersions[IReqCode-128] = thisversion;
+ MakeDeviceTypeAtoms ();
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
+ FixExtensionEvents (extEntry);
+ ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
+ EventSwapVector[DeviceValuator] = SEventIDispatch;
+ EventSwapVector[DeviceKeyPress] = SEventIDispatch;
+ EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
+ EventSwapVector[DeviceButtonPress] = SEventIDispatch;
+ EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
+ EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
+ EventSwapVector[DeviceFocusIn] = SEventIDispatch;
+ EventSwapVector[DeviceFocusOut] = SEventIDispatch;
+ EventSwapVector[ProximityIn] = SEventIDispatch;
+ EventSwapVector[ProximityOut] = SEventIDispatch;
+ EventSwapVector[DeviceStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
+ EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ }
+ else
+ {
+ FatalError("IExtensionInit: AddExtensions failed\n");
+ }
+ }
+
+/*************************************************************************
+ *
+ * ProcIDispatch - main dispatch routine for requests to this extension.
+ * This routine is used if server and client have the same byte ordering.
+ *
+ */
+
+int
+ProcIDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ if (stuff->data == X_GetExtensionVersion)
+ return(ProcXGetExtensionVersion(client));
+ if (stuff->data == X_ListInputDevices)
+ return(ProcXListInputDevices(client));
+ else if (stuff->data == X_OpenDevice)
+ return(ProcXOpenDevice(client));
+ else if (stuff->data == X_CloseDevice)
+ return(ProcXCloseDevice(client));
+ else if (stuff->data == X_SetDeviceMode)
+ return(ProcXSetDeviceMode(client));
+ else if (stuff->data == X_SelectExtensionEvent)
+ return(ProcXSelectExtensionEvent(client));
+ else if (stuff->data == X_GetSelectedExtensionEvents)
+ return(ProcXGetSelectedExtensionEvents(client));
+ else if (stuff->data == X_ChangeDeviceDontPropagateList)
+ return(ProcXChangeDeviceDontPropagateList(client));
+ else if (stuff->data == X_GetDeviceDontPropagateList)
+ return(ProcXGetDeviceDontPropagateList(client));
+ else if (stuff->data == X_GetDeviceMotionEvents)
+ return(ProcXGetDeviceMotionEvents(client));
+ else if (stuff->data == X_ChangeKeyboardDevice)
+ return(ProcXChangeKeyboardDevice(client));
+ else if (stuff->data == X_ChangePointerDevice)
+ return(ProcXChangePointerDevice(client));
+ else if (stuff->data == X_GrabDevice)
+ return(ProcXGrabDevice(client));
+ else if (stuff->data == X_UngrabDevice)
+ return(ProcXUngrabDevice(client));
+ else if (stuff->data == X_GrabDeviceKey)
+ return(ProcXGrabDeviceKey(client));
+ else if (stuff->data == X_UngrabDeviceKey)
+ return(ProcXUngrabDeviceKey(client));
+ else if (stuff->data == X_GrabDeviceButton)
+ return(ProcXGrabDeviceButton(client));
+ else if (stuff->data == X_UngrabDeviceButton)
+ return(ProcXUngrabDeviceButton(client));
+ else if (stuff->data == X_AllowDeviceEvents)
+ return(ProcXAllowDeviceEvents(client));
+ else if (stuff->data == X_GetDeviceFocus)
+ return(ProcXGetDeviceFocus(client));
+ else if (stuff->data == X_SetDeviceFocus)
+ return(ProcXSetDeviceFocus(client));
+ else if (stuff->data == X_GetFeedbackControl)
+ return(ProcXGetFeedbackControl(client));
+ else if (stuff->data == X_ChangeFeedbackControl)
+ return(ProcXChangeFeedbackControl(client));
+ else if (stuff->data == X_GetDeviceKeyMapping)
+ return(ProcXGetDeviceKeyMapping(client));
+ else if (stuff->data == X_ChangeDeviceKeyMapping)
+ return(ProcXChangeDeviceKeyMapping(client));
+ else if (stuff->data == X_GetDeviceModifierMapping)
+ return(ProcXGetDeviceModifierMapping(client));
+ else if (stuff->data == X_SetDeviceModifierMapping)
+ return(ProcXSetDeviceModifierMapping(client));
+ else if (stuff->data == X_GetDeviceButtonMapping)
+ return(ProcXGetDeviceButtonMapping(client));
+ else if (stuff->data == X_SetDeviceButtonMapping)
+ return(ProcXSetDeviceButtonMapping(client));
+ else if (stuff->data == X_QueryDeviceState)
+ return(ProcXQueryDeviceState(client));
+ else if (stuff->data == X_SendExtensionEvent)
+ return(ProcXSendExtensionEvent(client));
+ else if (stuff->data == X_DeviceBell)
+ return(ProcXDeviceBell(client));
+ else if (stuff->data == X_SetDeviceValuators)
+ return(ProcXSetDeviceValuators(client));
+ else if (stuff->data == X_GetDeviceControl)
+ return(ProcXGetDeviceControl(client));
+ else if (stuff->data == X_ChangeDeviceControl)
+ return(ProcXChangeDeviceControl(client));
+ else
+ {
+ SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
+ }
+ return(BadRequest);
+ }
+
+/*******************************************************************************
+ *
+ * SProcXDispatch
+ *
+ * Main swapped dispatch routine for requests to this extension.
+ * This routine is used if server and client do not have the same byte ordering.
+ *
+ */
+
+int
+SProcIDispatch(client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ if (stuff->data == X_GetExtensionVersion)
+ return(SProcXGetExtensionVersion(client));
+ if (stuff->data == X_ListInputDevices)
+ return(SProcXListInputDevices(client));
+ else if (stuff->data == X_OpenDevice)
+ return(SProcXOpenDevice(client));
+ else if (stuff->data == X_CloseDevice)
+ return(SProcXCloseDevice(client));
+ else if (stuff->data == X_SetDeviceMode)
+ return(SProcXSetDeviceMode(client));
+ else if (stuff->data == X_SelectExtensionEvent)
+ return(SProcXSelectExtensionEvent(client));
+ else if (stuff->data == X_GetSelectedExtensionEvents)
+ return(SProcXGetSelectedExtensionEvents(client));
+ else if (stuff->data == X_ChangeDeviceDontPropagateList)
+ return(SProcXChangeDeviceDontPropagateList(client));
+ else if (stuff->data == X_GetDeviceDontPropagateList)
+ return(SProcXGetDeviceDontPropagateList(client));
+ else if (stuff->data == X_GetDeviceMotionEvents)
+ return(SProcXGetDeviceMotionEvents(client));
+ else if (stuff->data == X_ChangeKeyboardDevice)
+ return(SProcXChangeKeyboardDevice(client));
+ else if (stuff->data == X_ChangePointerDevice)
+ return(SProcXChangePointerDevice(client));
+ else if (stuff->data == X_GrabDevice)
+ return(SProcXGrabDevice(client));
+ else if (stuff->data == X_UngrabDevice)
+ return(SProcXUngrabDevice(client));
+ else if (stuff->data == X_GrabDeviceKey)
+ return(SProcXGrabDeviceKey(client));
+ else if (stuff->data == X_UngrabDeviceKey)
+ return(SProcXUngrabDeviceKey(client));
+ else if (stuff->data == X_GrabDeviceButton)
+ return(SProcXGrabDeviceButton(client));
+ else if (stuff->data == X_UngrabDeviceButton)
+ return(SProcXUngrabDeviceButton(client));
+ else if (stuff->data == X_AllowDeviceEvents)
+ return(SProcXAllowDeviceEvents(client));
+ else if (stuff->data == X_GetDeviceFocus)
+ return(SProcXGetDeviceFocus(client));
+ else if (stuff->data == X_SetDeviceFocus)
+ return(SProcXSetDeviceFocus(client));
+ else if (stuff->data == X_GetFeedbackControl)
+ return(SProcXGetFeedbackControl(client));
+ else if (stuff->data == X_ChangeFeedbackControl)
+ return(SProcXChangeFeedbackControl(client));
+ else if (stuff->data == X_GetDeviceKeyMapping)
+ return(SProcXGetDeviceKeyMapping(client));
+ else if (stuff->data == X_ChangeDeviceKeyMapping)
+ return(SProcXChangeDeviceKeyMapping(client));
+ else if (stuff->data == X_GetDeviceModifierMapping)
+ return(SProcXGetDeviceModifierMapping(client));
+ else if (stuff->data == X_SetDeviceModifierMapping)
+ return(SProcXSetDeviceModifierMapping(client));
+ else if (stuff->data == X_GetDeviceButtonMapping)
+ return(SProcXGetDeviceButtonMapping(client));
+ else if (stuff->data == X_SetDeviceButtonMapping)
+ return(SProcXSetDeviceButtonMapping(client));
+ else if (stuff->data == X_QueryDeviceState)
+ return(SProcXQueryDeviceState(client));
+ else if (stuff->data == X_SendExtensionEvent)
+ return(SProcXSendExtensionEvent(client));
+ else if (stuff->data == X_DeviceBell)
+ return(SProcXDeviceBell(client));
+ else if (stuff->data == X_SetDeviceValuators)
+ return(SProcXSetDeviceValuators(client));
+ else if (stuff->data == X_GetDeviceControl)
+ return(SProcXGetDeviceControl(client));
+ else if (stuff->data == X_ChangeDeviceControl)
+ return(SProcXChangeDeviceControl(client));
+ else
+ {
+ SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
+ }
+ return(BadRequest);
+ }
+
+/**********************************************************************
+ *
+ * SReplyIDispatch
+ * Swap any replies defined in this extension.
+ *
+ */
+
+/* FIXME: this would be more concise and readable in ANSI C */
+#define DISPATCH(code) \
+ if (rep->RepType == X_##code) \
+ SRepX##code (client, len, (x##code##Reply *) rep)
+
+void
+SReplyIDispatch (client, len, rep)
+ ClientPtr client;
+ int len;
+ xGrabDeviceReply *rep; /* All we look at is the type field */
+{ /* This is common to all replies */
+ if (rep->RepType == X_GetExtensionVersion)
+ SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
+ else if (rep->RepType == X_ListInputDevices)
+ SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
+ else if (rep->RepType == X_OpenDevice)
+ SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
+ else if (rep->RepType == X_SetDeviceMode)
+ SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
+ else if (rep->RepType == X_GetSelectedExtensionEvents)
+ SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
+ else if (rep->RepType == X_GetDeviceDontPropagateList)
+ SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep);
+ else if (rep->RepType == X_GetDeviceMotionEvents)
+ SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep);
+ else if (rep->RepType == X_ChangeKeyboardDevice)
+ SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep);
+ else if (rep->RepType == X_ChangePointerDevice)
+ SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
+ else if (rep->RepType == X_GrabDevice)
+ SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
+ else if (rep->RepType == X_GetDeviceFocus)
+ SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
+ else if (rep->RepType == X_GetFeedbackControl)
+ SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
+ else if (rep->RepType == X_GetDeviceKeyMapping)
+ SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
+ else if (rep->RepType == X_GetDeviceModifierMapping)
+ SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep);
+ else if (rep->RepType == X_SetDeviceModifierMapping)
+ SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep);
+ else if (rep->RepType == X_GetDeviceButtonMapping)
+ SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep);
+ else if (rep->RepType == X_SetDeviceButtonMapping)
+ SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
+ else if (rep->RepType == X_QueryDeviceState)
+ SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
+ else if (rep->RepType == X_SetDeviceValuators)
+ SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
+ else if (rep->RepType == X_GetDeviceControl)
+ SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
+ else if (rep->RepType == X_ChangeDeviceControl)
+ SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
+ else
+ {
+ FatalError("XINPUT confused sending swapped reply");
+ }
+ }
+
+/*****************************************************************************
+ *
+ * SEventIDispatch
+ *
+ * Swap any events defined in this extension.
+ */
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
+
+void
+SEventIDispatch (from, to)
+ xEvent *from;
+ xEvent *to;
+{
+ int type = from->u.u.type & 0177;
+
+ if (type == DeviceValuator)
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
+ else if (type == DeviceKeyPress)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceKeyRelease)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceButtonPress)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceButtonRelease)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceMotionNotify)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceFocusIn)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == DeviceFocusOut)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == ProximityIn)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == ProximityOut)
+ {
+ SKeyButtonPtrEvent (from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ }
+ else if (type == DeviceStateNotify)
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
+ else if (type == DeviceKeyStateNotify)
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
+ else if (type == DeviceButtonStateNotify)
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
+ else if (type == DeviceMappingNotify)
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
+ else if (type == ChangeDeviceNotify)
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+ else
+ {
+ FatalError("XInputExtension: Impossible event!\n");
+ }
+ }
+
+/************************************************************************
+ *
+ * This function swaps the DeviceValuator event.
+ *
+ */
+
+void
+SEventDeviceValuator (from, to)
+ deviceValuator *from;
+ deviceValuator *to;
+ {
+ register char n;
+ register int i;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swaps(&to->device_state,n);
+ ip = &to->valuator0;
+ for (i=0; i<6; i++)
+ {
+ swapl((ip+i),n); /* macro - braces are required */
+ }
+ }
+
+void
+SEventFocus (from, to)
+ deviceFocus *from;
+ deviceFocus *to;
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swapl(&to->window, n);
+ }
+
+void
+SDeviceStateNotifyEvent (from, to)
+ deviceStateNotify *from;
+ deviceStateNotify *to;
+{
+ register int i;
+ register char n;
+ INT32 *ip B32;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ ip = &to->valuator0;
+ for (i=0; i<3; i++)
+ {
+ swapl((ip+i),n); /* macro - braces are required */
+ }
+ }
+
+void
+SDeviceKeyStateNotifyEvent (from, to)
+ deviceKeyStateNotify *from;
+ deviceKeyStateNotify *to;
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ }
+
+void
+SDeviceButtonStateNotifyEvent (from, to)
+ deviceButtonStateNotify *from;
+ deviceButtonStateNotify *to;
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ }
+
+void
+SChangeDeviceNotifyEvent (from, to)
+ changeDeviceNotify *from;
+ changeDeviceNotify *to;
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ }
+
+void
+SDeviceMappingNotifyEvent (from, to)
+ deviceMappingNotify *from;
+ deviceMappingNotify *to;
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ }
+
+/************************************************************************
+ *
+ * This function sets up extension event types and masks.
+ *
+ */
+
+void
+FixExtensionEvents (extEntry)
+ ExtensionEntry *extEntry;
+{
+ Mask mask;
+
+ DeviceValuator = extEntry->eventBase;
+ DeviceKeyPress = DeviceValuator + 1;
+ DeviceKeyRelease = DeviceKeyPress + 1;
+ DeviceButtonPress = DeviceKeyRelease + 1;
+ DeviceButtonRelease = DeviceButtonPress + 1;
+ DeviceMotionNotify = DeviceButtonRelease + 1;
+ DeviceFocusIn = DeviceMotionNotify + 1;
+ DeviceFocusOut = DeviceFocusIn + 1;
+ ProximityIn = DeviceFocusOut + 1;
+ ProximityOut = ProximityIn + 1;
+ DeviceStateNotify = ProximityOut + 1;
+ DeviceMappingNotify = DeviceStateNotify + 1;
+ ChangeDeviceNotify = DeviceMappingNotify + 1;
+ DeviceKeyStateNotify = ChangeDeviceNotify + 1;
+ DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
+
+ event_base[KeyClass] = DeviceKeyPress;
+ event_base[ButtonClass] = DeviceButtonPress;
+ event_base[ValuatorClass] = DeviceMotionNotify;
+ event_base[ProximityClass] = ProximityIn;
+ event_base[FocusClass] = DeviceFocusIn;
+ event_base[OtherClass] = DeviceStateNotify;
+
+ BadDevice += extEntry->errorBase;
+ BadEvent += extEntry->errorBase;
+ BadMode += extEntry->errorBase;
+ DeviceBusy += extEntry->errorBase;
+ BadClass += extEntry->errorBase;
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, DeviceKeyPress);
+ AllowPropagateSuppress (mask);
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, DeviceKeyRelease);
+ AllowPropagateSuppress (mask);
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, DeviceButtonPress);
+ AllowPropagateSuppress (mask);
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, DeviceButtonRelease);
+ AllowPropagateSuppress (mask);
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, ProximityIn);
+ SetMaskForExtEvent (mask, ProximityOut);
+ AllowPropagateSuppress (mask);
+
+ mask = GetNextExtEventMask ();
+ DeviceStateNotifyMask = mask;
+ SetMaskForExtEvent (mask, DeviceStateNotify);
+
+ mask = GetNextExtEventMask ();
+ DevicePointerMotionMask = mask;
+ SetMaskForExtEvent (mask, DeviceMotionNotify);
+ AllowPropagateSuppress (mask);
+
+ DevicePointerMotionHintMask = GetNextExtEventMask();
+ SetEventInfo (DevicePointerMotionHintMask, _devicePointerMotionHint);
+ SetEventInfo (GetNextExtEventMask(), _deviceButton1Motion);
+ SetEventInfo (GetNextExtEventMask(), _deviceButton2Motion);
+ SetEventInfo (GetNextExtEventMask(), _deviceButton3Motion);
+ SetEventInfo (GetNextExtEventMask(), _deviceButton4Motion);
+ SetEventInfo (GetNextExtEventMask(), _deviceButton5Motion);
+ DeviceButtonMotionMask = GetNextExtEventMask();
+ SetEventInfo (DeviceButtonMotionMask, _deviceButtonMotion);
+
+ DeviceFocusChangeMask = GetNextExtEventMask ();
+ SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusIn);
+ SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusOut);
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, DeviceMappingNotify);
+ DeviceMappingNotifyMask = mask;
+
+ mask = GetNextExtEventMask ();
+ SetMaskForExtEvent (mask, ChangeDeviceNotify);
+ ChangeDeviceNotifyMask = mask;
+
+ DeviceButtonGrabMask = GetNextExtEventMask();
+ SetEventInfo (DeviceButtonGrabMask, _deviceButtonGrab);
+ SetExclusiveAccess (DeviceButtonGrabMask);
+
+ DeviceOwnerGrabButtonMask = GetNextExtEventMask();
+ SetEventInfo (DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
+ SetEventInfo (0, _noExtensionEvent);
+ }
+
+/************************************************************************
+ *
+ * This function restores extension event types and masks to their
+ * initial state.
+ *
+ */
+
+void
+RestoreExtensionEvents ()
+{
+ int i;
+
+ IReqCode = 0;
+
+ for (i=0; i<ExtEventIndex-1; i++)
+ {
+ if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
+ SetMaskForEvent(0,EventInfo[i].type);
+ EventInfo[i].mask = 0;
+ EventInfo[i].type = 0;
+ }
+ ExtEventIndex = 0;
+ lastExtEventMask = 1;
+ DeviceValuator = 0;
+ DeviceKeyPress = 1;
+ DeviceKeyRelease = 2;
+ DeviceButtonPress = 3;
+ DeviceButtonRelease = 4;
+ DeviceMotionNotify = 5;
+ DeviceFocusIn = 6;
+ DeviceFocusOut = 7;
+ ProximityIn = 8;
+ ProximityOut = 9;
+ DeviceStateNotify = 10;
+ DeviceMappingNotify = 11;
+ ChangeDeviceNotify = 12;
+ DeviceKeyStateNotify = 13;
+ DeviceButtonStateNotify = 13;
+
+ BadDevice = 0;
+ BadEvent = 1;
+ BadMode = 2;
+ DeviceBusy = 3;
+ BadClass = 4;
+
+ }
+
+/***********************************************************************
+ *
+ * IResetProc.
+ * Remove reply-swapping routine.
+ * Remove event-swapping routine.
+ *
+ */
+
+void
+IResetProc(unused)
+ ExtensionEntry *unused;
+ {
+
+ ReplySwapVector[IReqCode] = ReplyNotSwappd;
+ EventSwapVector[DeviceValuator] = NotImplemented;
+ EventSwapVector[DeviceKeyPress] = NotImplemented;
+ EventSwapVector[DeviceKeyRelease] = NotImplemented;
+ EventSwapVector[DeviceButtonPress] = NotImplemented;
+ EventSwapVector[DeviceButtonRelease] = NotImplemented;
+ EventSwapVector[DeviceMotionNotify] = NotImplemented;
+ EventSwapVector[DeviceFocusIn] = NotImplemented;
+ EventSwapVector[DeviceFocusOut] = NotImplemented;
+ EventSwapVector[ProximityIn] = NotImplemented;
+ EventSwapVector[ProximityOut] = NotImplemented;
+ EventSwapVector[DeviceStateNotify] = NotImplemented;
+ EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
+ EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
+ EventSwapVector[DeviceMappingNotify] = NotImplemented;
+ EventSwapVector[ChangeDeviceNotify] = NotImplemented;
+ RestoreExtensionEvents ();
+ }
+
+/***********************************************************************
+ *
+ * Assign an id and type to an input device.
+ *
+ */
+
+void
+AssignTypeAndName (dev, type, name)
+ DeviceIntPtr dev;
+ Atom type;
+ char *name;
+{
+ dev->type = type;
+ dev->name = (char *) xalloc(strlen(name)+1);
+ strcpy (dev->name, name);
+ }
+
+/***********************************************************************
+ *
+ * Make device type atoms.
+ *
+ */
+
+void
+MakeDeviceTypeAtoms ()
+ {
+ int i;
+
+ for (i=0; i<NUMTYPES; i++)
+ dev_type[i].type =
+ MakeAtom (dev_type[i].name, strlen(dev_type[i].name), 1);
+ }
+
+/**************************************************************************
+ *
+ * Return a DeviceIntPtr corresponding to a specified device id.
+ * This will not return the pointer or keyboard, or devices that are not on.
+ *
+ */
+
+DeviceIntPtr
+#if NeedFunctionPrototypes
+LookupDeviceIntRec (
+ CARD8 id)
+#else
+LookupDeviceIntRec (id)
+ CARD8 id;
+#endif
+{
+ DeviceIntPtr dev;
+
+ for (dev=inputInfo.devices; dev; dev=dev->next)
+ {
+ if (dev->id == id)
+ {
+ if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
+ return (NULL);
+ return (dev);
+ }
+ }
+ return (NULL);
+ }
+
+/**************************************************************************
+ *
+ * Allow the specified event to be restricted to being selected by one
+ * client at a time.
+ * The default is to allow more than one client to select the event.
+ *
+ */
+
+void
+SetExclusiveAccess (mask)
+ Mask mask;
+ {
+ int i;
+
+ for (i=0; i<MAX_DEVICES; i++)
+ ExtExclusiveMasks[i] |= mask;
+ }
+
+/**************************************************************************
+ *
+ * Allow the specified event to have its propagation suppressed.
+ * The default is to not allow suppression of propagation.
+ *
+ */
+
+void
+AllowPropagateSuppress (mask)
+ Mask mask;
+ {
+ int i;
+
+ for (i=0; i<MAX_DEVICES; i++)
+ PropagateMask[i] |= mask;
+ }
+
+/**************************************************************************
+ *
+ * Return the next available extension event mask.
+ *
+ */
+
+Mask
+GetNextExtEventMask ()
+ {
+ int i;
+ Mask mask = lastExtEventMask;
+
+ if (lastExtEventMask == 0)
+ {
+ FatalError("GetNextExtEventMask: no more events are available.");
+ }
+ lastExtEventMask <<= 1;
+
+ for (i=0; i<MAX_DEVICES; i++)
+ ExtValidMasks[i] |= mask;
+ return mask;
+ }
+
+/**************************************************************************
+ *
+ * Assign the specified mask to the specified event.
+ *
+ */
+
+void
+SetMaskForExtEvent(mask, event)
+ Mask mask;
+ int event;
+ {
+
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = event;
+
+ if ((event < LASTEvent) || (event >= 128))
+ FatalError("MaskForExtensionEvent: bogus event number");
+ SetMaskForEvent(mask,event);
+ }
+
+/**************************************************************************
+ *
+ * Record an event mask where there is no unique corresponding event type.
+ * We can't call SetMaskForEvent, since that would clobber the existing
+ * mask for that event. MotionHint and ButtonMotion are examples.
+ *
+ * Since extension event types will never be less than 64, we can use
+ * 0-63 in the EventInfo array as the "type" to be used to look up this
+ * mask. This means that the corresponding macros such as
+ * DevicePointerMotionHint must have access to the same constants.
+ *
+ */
+
+void
+SetEventInfo(mask, constant)
+ Mask mask;
+ int constant;
+ {
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = constant;
+ }
diff --git a/xc/programs/Xserver/Xi/getbmap.c b/xc/programs/Xserver/Xi/getbmap.c
new file mode 100644
index 000000000..d72241fcb
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getbmap.c
@@ -0,0 +1,146 @@
+/* $TOG: getbmap.c /main/5 1998/02/09 15:28:50 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getbmap.c,v 3.1 1998/10/04 09:37:03 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to return the version of the extension.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getbmap.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the button mapping for the specified device.
+ *
+ */
+
+int
+SProcXGetDeviceButtonMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceButtonMappingReq);
+ swaps(&stuff->length, n);
+ return(ProcXGetDeviceButtonMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure gets the button mapping for the specified device.
+ *
+ */
+
+int
+ProcXGetDeviceButtonMapping (client)
+ register ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ xGetDeviceButtonMappingReply rep;
+ ButtonClassPtr b;
+
+ REQUEST(xGetDeviceButtonMappingReq);
+ REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceButtonMapping;
+ rep.nElts = 0;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
+ BadDevice);
+ return Success;
+ }
+
+ b = dev->button;
+ if (b == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
+ BadMatch);
+ return Success;
+ }
+ rep.nElts = b->numButtons;
+ rep.length = (rep.nElts + (4-1))/4;
+ WriteReplyToClient (client, sizeof (xGetDeviceButtonMappingReply), &rep);
+ (void)WriteToClient(client, rep.nElts,
+ (char *)&b->map[1]);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceButtonMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceButtonMapping (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceButtonMappingReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getbmap.h b/xc/programs/Xserver/Xi/getbmap.h
new file mode 100644
index 000000000..30de6f5c6
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getbmap.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getbmap.h,v 3.1 1996/04/15 11:18:37 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETBMAP_H
+#define GETBMAP_H 1
+
+int
+SProcXGetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceButtonMapping (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetDeviceButtonMapping (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceButtonMappingReply * /* rep */
+#endif
+ );
+
+#endif /* GETBMAP_H */
diff --git a/xc/programs/Xserver/Xi/getdctl.c b/xc/programs/Xserver/Xi/getdctl.c
new file mode 100644
index 000000000..0d9494055
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getdctl.c
@@ -0,0 +1,222 @@
+/* $TOG: getdctl.c /main/5 1998/02/09 15:28:55 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getdctl.c,v 3.2 1998/10/04 09:37:03 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Get Device control attributes for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getdctl.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the control attributes for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetDeviceControl(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceControlReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetDeviceControlReq);
+ swaps(&stuff->control, n);
+ return(ProcXGetDeviceControl(client));
+ }
+
+/***********************************************************************
+ *
+ * Get the state of the specified device control.
+ *
+ */
+
+int
+ProcXGetDeviceControl(client)
+ ClientPtr client;
+ {
+ int total_length = 0;
+ char *buf, *savbuf;
+ register DeviceIntPtr dev;
+ xGetDeviceControlReply rep;
+
+ REQUEST(xGetDeviceControlReq);
+ REQUEST_SIZE_MATCH(xGetDeviceControlReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
+ BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ switch (stuff->control)
+ {
+ case DEVICE_RESOLUTION:
+ if (!dev->valuator)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+ total_length = sizeof (xDeviceResolutionState) +
+ (3 * sizeof(int) * dev->valuator->numAxes);
+ break;
+ default:
+ SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
+ BadValue);
+ return Success;
+ }
+
+ buf = (char *) xalloc (total_length);
+ if (!buf)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadAlloc);
+ return Success;
+ }
+ savbuf=buf;
+
+ switch (stuff->control)
+ {
+ case DEVICE_RESOLUTION:
+ CopySwapDeviceResolution(client, dev->valuator, buf,
+ total_length);
+ break;
+ default:
+ break;
+ }
+
+ rep.length = (total_length+3) >> 2;
+ WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree (savbuf);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies DeviceResolution data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapDeviceResolution (client, v, buf, length)
+ ClientPtr client;
+ ValuatorClassPtr v;
+ char *buf;
+ int length;
+ {
+ register char n;
+ AxisInfoPtr a;
+ xDeviceResolutionState *r;
+ int i, *iptr;
+
+ r = (xDeviceResolutionState *) buf;
+ r->control = DEVICE_RESOLUTION;
+ r->length = length;
+ r->num_valuators = v->numAxes;
+ buf += sizeof (xDeviceResolutionState);
+ iptr = (int *) buf;
+ for (i=0,a=v->axes; i<v->numAxes; i++,a++)
+ *iptr++ = a->resolution;
+ for (i=0,a=v->axes; i<v->numAxes; i++,a++)
+ *iptr++ = a->min_resolution;
+ for (i=0,a=v->axes; i<v->numAxes; i++,a++)
+ *iptr++ = a->max_resolution;
+ if (client->swapped)
+ {
+ swaps (&r->control,n);
+ swaps (&r->length,n);
+ swapl (&r->num_valuators,n);
+ iptr = (int *) buf;
+ for (i=0; i < (3 * v->numAxes); i++,iptr++)
+ {
+ swapl (iptr,n);
+ }
+ }
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the xGetDeviceControl function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceControl (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceControlReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
+
diff --git a/xc/programs/Xserver/Xi/getdctl.h b/xc/programs/Xserver/Xi/getdctl.h
new file mode 100644
index 000000000..d22675f4f
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getdctl.h
@@ -0,0 +1,63 @@
+/* $XFree86: xc/programs/Xserver/Xi/getdctl.h,v 3.1 1996/04/15 11:18:38 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETDCTL_H
+#define GETDCTL_H 1
+
+int
+SProcXGetDeviceControl (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceControl (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+CopySwapDeviceResolution (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ ValuatorClassPtr /* v */,
+ char * /* buf */,
+ int /* length */
+#endif
+ );
+
+void
+SRepXGetDeviceControl (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceControlReply * /* rep */
+#endif
+ );
+
+#endif /* GETDCTL_H */
diff --git a/xc/programs/Xserver/Xi/getfctl.c b/xc/programs/Xserver/Xi/getfctl.c
new file mode 100644
index 000000000..de314f6cf
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getfctl.c
@@ -0,0 +1,414 @@
+/* $TOG: getfctl.c /main/14 1998/02/09 15:29:01 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfctl.c,v 3.2 1998/10/04 09:37:04 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Get feedback control attributes for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getfctl.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the control attributes for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetFeedbackControl(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetFeedbackControlReq);
+ swaps(&stuff->length, n);
+ return(ProcXGetFeedbackControl(client));
+ }
+
+/***********************************************************************
+ *
+ * Get the feedback control state.
+ *
+ */
+
+int
+ProcXGetFeedbackControl(client)
+ ClientPtr client;
+ {
+ int total_length = 0;
+ char *buf, *savbuf;
+ register DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ PtrFeedbackPtr p;
+ IntegerFeedbackPtr i;
+ StringFeedbackPtr s;
+ BellFeedbackPtr b;
+ LedFeedbackPtr l;
+ xGetFeedbackControlReply rep;
+
+ REQUEST(xGetFeedbackControlReq);
+ REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetFeedbackControl, 0,
+ BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetFeedbackControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.num_feedbacks = 0;
+
+ for (k=dev->kbdfeed; k; k=k->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xKbdFeedbackState);
+ }
+ for (p=dev->ptrfeed; p; p=p->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xPtrFeedbackState);
+ }
+ for (s=dev->stringfeed; s; s=s->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xStringFeedbackState) +
+ (s->ctrl.num_symbols_supported * sizeof (KeySym));
+ }
+ for (i=dev->intfeed; i; i=i->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xIntegerFeedbackState);
+ }
+ for (l=dev->leds; l; l=l->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xLedFeedbackState);
+ }
+ for (b=dev->bell; b; b=b->next)
+ {
+ rep.num_feedbacks++;
+ total_length += sizeof(xBellFeedbackState);
+ }
+
+ if (total_length == 0)
+ {
+ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ buf = (char *) xalloc (total_length);
+ if (!buf)
+ {
+ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
+ BadAlloc);
+ return Success;
+ }
+ savbuf=buf;
+
+ for (k=dev->kbdfeed; k; k=k->next)
+ CopySwapKbdFeedback (client, k, &buf);
+ for (p=dev->ptrfeed; p; p=p->next)
+ CopySwapPtrFeedback (client, p, &buf);
+ for (s=dev->stringfeed; s; s=s->next)
+ CopySwapStringFeedback (client, s, &buf);
+ for (i=dev->intfeed; i; i=i->next)
+ CopySwapIntegerFeedback (client, i, &buf);
+ for (l=dev->leds; l; l=l->next)
+ CopySwapLedFeedback (client, l, &buf);
+ for (b=dev->bell; b; b=b->next)
+ CopySwapBellFeedback (client, b, &buf);
+
+ rep.length = (total_length+3) >> 2;
+ WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree (savbuf);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies KbdFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapKbdFeedback (client, k, buf)
+ ClientPtr client;
+ KbdFeedbackPtr k;
+ char **buf;
+ {
+ int i;
+ register char n;
+ xKbdFeedbackState *k2;
+
+ k2 = (xKbdFeedbackState *) *buf;
+ k2->class = KbdFeedbackClass;
+ k2->length = sizeof (xKbdFeedbackState);
+ k2->id = k->ctrl.id;
+ k2->click = k->ctrl.click;
+ k2->percent = k->ctrl.bell;
+ k2->pitch = k->ctrl.bell_pitch;
+ k2->duration = k->ctrl.bell_duration;
+ k2->led_mask = k->ctrl.leds;
+ k2->global_auto_repeat = k->ctrl.autoRepeat;
+ for (i=0; i<32; i++)
+ k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
+ if (client->swapped)
+ {
+ swaps(&k2->length,n);
+ swaps(&k2->pitch,n);
+ swaps(&k2->duration,n);
+ swapl(&k2->led_mask,n);
+ swapl(&k2->led_values,n);
+ }
+ *buf += sizeof (xKbdFeedbackState);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies PtrFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapPtrFeedback (client, p, buf)
+ ClientPtr client;
+ PtrFeedbackPtr p;
+ char **buf;
+ {
+ register char n;
+ xPtrFeedbackState *p2;
+
+ p2 = (xPtrFeedbackState *) *buf;
+ p2->class = PtrFeedbackClass;
+ p2->length = sizeof (xPtrFeedbackState);
+ p2->id = p->ctrl.id;
+ p2->accelNum = p->ctrl.num;
+ p2->accelDenom = p->ctrl.den;
+ p2->threshold = p->ctrl.threshold;
+ if (client->swapped)
+ {
+ swaps(&p2->length,n);
+ swaps(&p2->accelNum,n);
+ swaps(&p2->accelDenom,n);
+ swaps(&p2->threshold,n);
+ }
+ *buf += sizeof (xPtrFeedbackState);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies IntegerFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapIntegerFeedback (client, i, buf)
+ ClientPtr client;
+ IntegerFeedbackPtr i;
+ char **buf;
+ {
+ register char n;
+ xIntegerFeedbackState *i2;
+
+ i2 = (xIntegerFeedbackState *) *buf;
+ i2->class = IntegerFeedbackClass;
+ i2->length = sizeof (xIntegerFeedbackState);
+ i2->id = i->ctrl.id;
+ i2->resolution = i->ctrl.resolution;
+ i2->min_value = i->ctrl.min_value;
+ i2->max_value = i->ctrl.max_value;
+ if (client->swapped)
+ {
+ swaps(&i2->length,n);
+ swapl(&i2->resolution,n);
+ swapl(&i2->min_value,n);
+ swapl(&i2->max_value,n);
+ }
+ *buf += sizeof (xIntegerFeedbackState);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies StringFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapStringFeedback (client, s, buf)
+ ClientPtr client;
+ StringFeedbackPtr s;
+ char **buf;
+ {
+ int i;
+ register char n;
+ xStringFeedbackState *s2;
+ KeySym *kptr;
+
+ s2 = (xStringFeedbackState *) *buf;
+ s2->class = StringFeedbackClass;
+ s2->length = sizeof (xStringFeedbackState) +
+ s->ctrl.num_symbols_supported * sizeof (KeySym);
+ s2->id = s->ctrl.id;
+ s2->max_symbols = s->ctrl.max_symbols;
+ s2->num_syms_supported = s->ctrl.num_symbols_supported;
+ *buf += sizeof (xStringFeedbackState);
+ kptr = (KeySym *) (*buf);
+ for (i=0; i<s->ctrl.num_symbols_supported; i++)
+ *kptr++ = *(s->ctrl.symbols_supported+i);
+ if (client->swapped)
+ {
+ swaps(&s2->length,n);
+ swaps(&s2->max_symbols,n);
+ swaps(&s2->num_syms_supported,n);
+ kptr = (KeySym *) (*buf);
+ for (i=0; i<s->ctrl.num_symbols_supported; i++,kptr++)
+ {
+ swapl(kptr,n);
+ }
+ }
+ *buf += (s->ctrl.num_symbols_supported * sizeof (KeySym));
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies LedFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapLedFeedback (client, l, buf)
+ ClientPtr client;
+ LedFeedbackPtr l;
+ char **buf;
+ {
+ register char n;
+ xLedFeedbackState *l2;
+
+ l2 = (xLedFeedbackState *) *buf;
+ l2->class = LedFeedbackClass;
+ l2->length = sizeof (xLedFeedbackState);
+ l2->id = l->ctrl.id;
+ l2->led_values = l->ctrl.led_values;
+ l2->led_mask = l->ctrl.led_mask;
+ if (client->swapped)
+ {
+ swaps(&l2->length,n);
+ swapl(&l2->led_values,n);
+ swapl(&l2->led_mask,n);
+ }
+ *buf += sizeof (xLedFeedbackState);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies BellFeedbackClass data, swapping if necessary.
+ *
+ */
+
+void
+CopySwapBellFeedback (client, b, buf)
+ ClientPtr client;
+ BellFeedbackPtr b;
+ char **buf;
+ {
+ register char n;
+ xBellFeedbackState *b2;
+
+ b2 = (xBellFeedbackState *) *buf;
+ b2->class = BellFeedbackClass;
+ b2->length = sizeof (xBellFeedbackState);
+ b2->id = b->ctrl.id;
+ b2->percent = b->ctrl.percent;
+ b2->pitch = b->ctrl.pitch;
+ b2->duration = b->ctrl.duration;
+ if (client->swapped)
+ {
+ swaps(&b2->length,n);
+ swaps(&b2->pitch,n);
+ swaps(&b2->duration,n);
+ }
+ *buf += sizeof (xBellFeedbackState);
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the xGetFeedbackControl function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetFeedbackControl (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetFeedbackControlReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->num_feedbacks, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getfctl.h b/xc/programs/Xserver/Xi/getfctl.h
new file mode 100644
index 000000000..e51830d49
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getfctl.h
@@ -0,0 +1,107 @@
+/* $XFree86: xc/programs/Xserver/Xi/getfctl.h,v 3.1 1996/04/15 11:18:39 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETFCTL_H
+#define GETFCTL_H 1
+
+int
+SProcXGetFeedbackControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetFeedbackControl(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+CopySwapKbdFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ KbdFeedbackPtr /* k */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapPtrFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ PtrFeedbackPtr /* p */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapIntegerFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ IntegerFeedbackPtr /* i */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapStringFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ StringFeedbackPtr /* s */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapLedFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ LedFeedbackPtr /* l */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapBellFeedback (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ BellFeedbackPtr /* b */,
+ char ** /* buf */
+#endif
+ );
+
+void
+SRepXGetFeedbackControl (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetFeedbackControlReply * /* rep */
+#endif
+ );
+
+#endif /* GETFCTL_H */
diff --git a/xc/programs/Xserver/Xi/getfocus.c b/xc/programs/Xserver/Xi/getfocus.c
new file mode 100644
index 000000000..28a261486
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getfocus.c
@@ -0,0 +1,149 @@
+/* $TOG: getfocus.c /main/6 1998/02/09 15:29:07 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfocus.c,v 3.1 1998/10/04 09:37:04 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to get the focus for an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "windowstr.h" /* focus struct */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getfocus.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the focus for a device.
+ *
+ */
+
+int
+SProcXGetDeviceFocus(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceFocusReq);
+ swaps(&stuff->length, n);
+ return(ProcXGetDeviceFocus(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure gets the focus for a device.
+ *
+ */
+
+int
+ProcXGetDeviceFocus(client)
+ ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ FocusClassPtr focus;
+ xGetDeviceFocusReply rep;
+
+ REQUEST(xGetDeviceFocusReq);
+ REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL || !dev->focus)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceFocus;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ focus = dev->focus;
+
+ if (focus->win == NoneWin)
+ rep.focus = None;
+ else if (focus->win == PointerRootWin)
+ rep.focus = PointerRoot;
+ else if (focus->win == FollowKeyboardWin)
+ rep.focus = FollowKeyboard;
+ else
+ rep.focus = focus->win->drawable.id;
+
+ rep.time = focus->time.milliseconds;
+ rep.revertTo = focus->revert;
+ WriteReplyToClient (client, sizeof(xGetDeviceFocusReply), &rep);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the GetDeviceFocus function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceFocus (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceFocusReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swapl(&rep->focus, n);
+ swapl(&rep->time, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getfocus.h b/xc/programs/Xserver/Xi/getfocus.h
new file mode 100644
index 000000000..8a21c860c
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getfocus.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getfocus.h,v 3.1 1996/04/15 11:18:40 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETFOCUS_H
+#define GETFOCUS_H 1
+
+int
+SProcXGetDeviceFocus(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceFocus(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetDeviceFocus (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceFocusReply * /* rep */
+#endif
+ );
+
+#endif /* GETFOCUS_H */
diff --git a/xc/programs/Xserver/Xi/getkmap.c b/xc/programs/Xserver/Xi/getkmap.c
new file mode 100644
index 000000000..be06a12eb
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getkmap.c
@@ -0,0 +1,170 @@
+/* $TOG: getkmap.c /main/6 1998/02/09 15:29:13 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getkmap.c,v 3.2 1998/10/04 09:37:05 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Get the key mapping for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
+
+#include "getkmap.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the key mapping for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetDeviceKeyMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceKeyMappingReq);
+ swaps(&stuff->length, n);
+ return(ProcXGetDeviceKeyMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * Get the device key mapping.
+ *
+ */
+
+int
+ProcXGetDeviceKeyMapping(client)
+ register ClientPtr client;
+ {
+ xGetDeviceKeyMappingReply rep;
+ DeviceIntPtr dev;
+ KeySymsPtr k;
+
+ REQUEST(xGetDeviceKeyMappingReq);
+ REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
+ BadDevice);
+ return Success;
+ }
+
+ if (dev->key == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
+ BadMatch);
+ return Success;
+ }
+ k = &dev->key->curKeySyms;
+
+ if ((stuff->firstKeyCode < k->minKeyCode) ||
+ (stuff->firstKeyCode > k->maxKeyCode))
+ {
+ client->errorValue = stuff->firstKeyCode;
+ SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
+ BadValue);
+ return Success;
+ }
+
+ if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1)
+ {
+ client->errorValue = stuff->count;
+ SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
+ BadValue);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceKeyMapping;
+ rep.sequenceNumber = client->sequence;
+ rep.keySymsPerKeyCode = k->mapWidth;
+ rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
+ WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
+
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
+ WriteSwappedDataToClient(
+ client,
+ k->mapWidth * stuff->count * sizeof(KeySym),
+ &k->map[(stuff->firstKeyCode - k->minKeyCode) *
+ k->mapWidth]);
+
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceKeyMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceKeyMapping (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceKeyMappingReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
+
diff --git a/xc/programs/Xserver/Xi/getkmap.h b/xc/programs/Xserver/Xi/getkmap.h
new file mode 100644
index 000000000..780a2e016
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getkmap.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getkmap.h,v 3.1 1996/04/15 11:18:41 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETKMAP_H
+#define GETKMAP_H 1
+
+int
+SProcXGetDeviceKeyMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceKeyMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetDeviceKeyMapping (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceKeyMappingReply * /* rep */
+#endif
+ );
+
+#endif /* GETKMAP_H */
diff --git a/xc/programs/Xserver/Xi/getmmap.c b/xc/programs/Xserver/Xi/getmmap.c
new file mode 100644
index 000000000..e2794c9fd
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getmmap.c
@@ -0,0 +1,150 @@
+/* $TOG: getmmap.c /main/5 1998/02/09 15:29:19 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getmmap.c,v 3.1 1998/10/04 09:37:05 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Get the modifier mapping for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h" /* Request macro */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getmmap.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the modifier mapping for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXGetDeviceModifierMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceModifierMappingReq);
+ swaps(&stuff->length, n);
+ return(ProcXGetDeviceModifierMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * Get the device Modifier mapping.
+ *
+ */
+
+int
+ProcXGetDeviceModifierMapping(client)
+ ClientPtr client;
+ {
+ CARD8 maxkeys;
+ DeviceIntPtr dev;
+ xGetDeviceModifierMappingReply rep;
+ KeyClassPtr kp;
+
+ REQUEST(xGetDeviceModifierMappingReq);
+ REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
+ BadDevice);
+ return Success;
+ }
+
+ kp = dev->key;
+ if (kp == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
+ BadMatch);
+ return Success;
+ }
+ maxkeys = kp->maxKeysPerModifier;
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceModifierMapping;
+ rep.numKeyPerModifier = maxkeys;
+ rep.sequenceNumber = client->sequence;
+ /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
+ rep.length = 2*maxkeys;
+
+ WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
+
+ /* Reply with the (modified by DDX) map that SetModifierMapping passed in */
+ WriteToClient(client, 8*maxkeys, (char *)kp->modifierKeyMap);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceModifierMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceModifierMapping (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceModifierMappingReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getmmap.h b/xc/programs/Xserver/Xi/getmmap.h
new file mode 100644
index 000000000..cf9ca000d
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getmmap.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getmmap.h,v 3.1 1996/04/15 11:18:42 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETMMAP_H
+#define GETMMAP_H 1
+
+int
+SProcXGetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetDeviceModifierMapping (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceModifierMappingReply * /* rep */
+#endif
+ );
+
+#endif /* GETMMAP_H */
diff --git a/xc/programs/Xserver/Xi/getprop.c b/xc/programs/Xserver/Xi/getprop.c
new file mode 100644
index 000000000..19dfd110a
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getprop.c
@@ -0,0 +1,207 @@
+/* $TOG: getprop.c /main/8 1998/02/09 15:29:25 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.3 1998/10/04 09:37:06 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Function to return the dont-propagate-list for an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structs */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
+
+#include "getprop.h"
+
+extern XExtEventInfo EventInfo[];
+extern int ExtEventIndex;
+
+/***********************************************************************
+ *
+ * Handle a request from a client with a different byte order.
+ *
+ */
+
+int
+SProcXGetDeviceDontPropagateList(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceDontPropagateListReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
+ swapl(&stuff->window, n);
+ return(ProcXGetDeviceDontPropagateList(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+ProcXGetDeviceDontPropagateList (client)
+ register ClientPtr client;
+ {
+ CARD16 count = 0;
+ int i;
+ XEventClass *buf, *tbuf;
+ WindowPtr pWin;
+ xGetDeviceDontPropagateListReply rep;
+ OtherInputMasks *others;
+
+ REQUEST(xGetDeviceDontPropagateListReq);
+ REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceDontPropagateList;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.count = 0;
+
+ pWin = (WindowPtr) LookupWindow (stuff->window, client);
+ if (!pWin)
+ {
+ client->errorValue = stuff->window;
+ SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
+ BadWindow);
+ return Success;
+ }
+
+ if ((others = wOtherInputMasks(pWin)) != 0)
+ {
+ for (i=0; i<EMASKSIZE; i++)
+ tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
+ &count, COUNT);
+ if (count)
+ {
+ rep.count = count;
+ buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass));
+ rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
+
+ tbuf = buf;
+ for (i=0; i<EMASKSIZE; i++)
+ tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i,
+ NULL, CREATE);
+ }
+ }
+
+ WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply),
+ &rep);
+
+ if (count)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
+ xfree (buf);
+ }
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure gets a list of event classes from a mask word.
+ * A single mask may translate to more than one event class.
+ *
+ */
+
+XEventClass
+*ClassFromMask (buf, mask, maskndx, count, mode)
+ XEventClass *buf;
+ Mask mask;
+ int maskndx;
+ CARD16 *count;
+ int mode;
+ {
+ int i,j;
+ int id = maskndx;
+ Mask tmask = 0x80000000;
+
+ for (i=0; i<32; i++,tmask>>=1)
+ if (tmask & mask)
+ {
+ for (j=0; j<ExtEventIndex; j++)
+ if (EventInfo[j].mask == tmask)
+ {
+ if (mode == COUNT)
+ (*count)++;
+ else
+ *buf++ = (id << 8) | EventInfo[j].type;
+ }
+ }
+ return (buf);
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceDontPropagateList function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceDontPropagateList (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceDontPropagateListReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->count, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getprop.h b/xc/programs/Xserver/Xi/getprop.h
new file mode 100644
index 000000000..4f467e041
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getprop.h
@@ -0,0 +1,64 @@
+/* $XFree86: xc/programs/Xserver/Xi/getprop.h,v 3.1 1996/04/15 11:18:44 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETPROP_H
+#define GETPROP_H 1
+
+int
+SProcXGetDeviceDontPropagateList(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceDontPropagateList (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+XEventClass *
+ClassFromMask (
+#if NeedFunctionPrototypes
+ XEventClass * /* buf */,
+ Mask /* mask */,
+ int /* maskndx */,
+ CARD16 * /* count */,
+ int /* mode */
+#endif
+ );
+
+void
+SRepXGetDeviceDontPropagateList (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceDontPropagateListReply * /* rep */
+#endif
+ );
+
+#endif /* GETPROP_H */
diff --git a/xc/programs/Xserver/Xi/getselev.c b/xc/programs/Xserver/Xi/getselev.c
new file mode 100644
index 000000000..9c0839e34
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getselev.c
@@ -0,0 +1,188 @@
+/* $XFree86: xc/programs/Xserver/Xi/getselev.c,v 3.3 1998/10/04 09:37:06 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* $TOG: getselev.c /main/9 1998/02/09 15:29:30 kaleb $ */
+
+/***********************************************************************
+ *
+ * Extension function to get the current selected events for a given window.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "XI.h"
+#include "XIproto.h"
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window struct */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
+
+#include "getprop.h"
+#include "getselev.h"
+
+/***********************************************************************
+ *
+ * This procedure gets the current selected extension events.
+ *
+ */
+
+int
+SProcXGetSelectedExtensionEvents(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetSelectedExtensionEventsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
+ swapl(&stuff->window, n);
+ return(ProcXGetSelectedExtensionEvents(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure gets the current device select mask,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+int
+ProcXGetSelectedExtensionEvents(client)
+ register ClientPtr client;
+ {
+ int i;
+ int total_length = 0;
+ xGetSelectedExtensionEventsReply rep;
+ WindowPtr pWin;
+ XEventClass *buf;
+ XEventClass *tclient;
+ XEventClass *aclient;
+ OtherInputMasks *pOthers;
+ InputClientsPtr others;
+
+ REQUEST(xGetSelectedExtensionEventsReq);
+ REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetSelectedExtensionEvents;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.this_client_count = 0;
+ rep.all_clients_count = 0;
+
+ if (!(pWin = LookupWindow(stuff->window, client)))
+ {
+ SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
+ BadWindow);
+ return Success;
+ }
+
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
+ {
+ for (others = pOthers->inputClients; others; others=others->next)
+ for (i=0; i<EMASKSIZE; i++)
+ tclient = ClassFromMask (NULL, others->mask[i], i,
+ &rep.all_clients_count, COUNT);
+
+ for (others = pOthers->inputClients; others; others=others->next)
+ if (SameClient(others, client))
+ {
+ for (i=0; i<EMASKSIZE; i++)
+ tclient = ClassFromMask (NULL, others->mask[i], i,
+ &rep.this_client_count, COUNT);
+ break;
+ }
+
+ total_length = (rep.all_clients_count + rep.this_client_count) *
+ sizeof (XEventClass);
+ rep.length = (total_length + 3) >> 2;
+ buf = (XEventClass *) xalloc (total_length);
+
+ tclient = buf;
+ aclient = buf + rep.this_client_count;
+ if (others)
+ for (i=0; i<EMASKSIZE; i++)
+ tclient = ClassFromMask (tclient, others->mask[i], i, NULL, CREATE);
+
+ for (others = pOthers->inputClients; others; others=others->next)
+ for (i=0; i<EMASKSIZE; i++)
+ aclient = ClassFromMask (aclient, others->mask[i], i, NULL, CREATE);
+ }
+
+ WriteReplyToClient (client, sizeof(xGetSelectedExtensionEventsReply), &rep);
+
+ if (total_length)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient( client, total_length, buf);
+ xfree (buf);
+ }
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetSelectedExtensionEvents function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetSelectedExtensionEvents (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetSelectedExtensionEventsReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->this_client_count, n);
+ swaps(&rep->all_clients_count, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getselev.h b/xc/programs/Xserver/Xi/getselev.h
new file mode 100644
index 000000000..0d4e6a467
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getselev.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getselev.h,v 3.1 1996/04/15 11:18:49 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETSELEV_H
+#define GETSELEV_H 1
+
+int
+SProcXGetSelectedExtensionEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetSelectedExtensionEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetSelectedExtensionEvents (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetSelectedExtensionEventsReply * /* rep */
+#endif
+ );
+
+#endif /* GETSELEV_H */
diff --git a/xc/programs/Xserver/Xi/getvers.c b/xc/programs/Xserver/Xi/getvers.c
new file mode 100644
index 000000000..1828eb6fa
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getvers.c
@@ -0,0 +1,149 @@
+/* $TOG: getvers.c /main/7 1998/02/09 15:29:34 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getvers.c,v 3.1 1998/10/04 09:37:07 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to return the version of the extension.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getvers.h"
+
+XExtensionVersion AllExtensionVersions[128];
+
+/***********************************************************************
+ *
+ * Handle a request from a client with a different byte order than us.
+ *
+ */
+
+int
+SProcXGetExtensionVersion(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetExtensionVersionReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
+ swaps(&stuff->nbytes, n);
+ return(ProcXGetExtensionVersion(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+ProcXGetExtensionVersion (client)
+ register ClientPtr client;
+ {
+ xGetExtensionVersionReply rep;
+
+ REQUEST(xGetExtensionVersionReq);
+ REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
+
+ if (stuff->length != (sizeof(xGetExtensionVersionReq) +
+ stuff->nbytes + 3)>>2)
+ {
+ SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
+ BadLength);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetExtensionVersion;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.major_version = 0;
+ rep.minor_version = 0;
+
+ rep.present = TRUE;
+ if (rep.present)
+ {
+ rep.major_version =
+ AllExtensionVersions[IReqCode-128].major_version;
+ rep.minor_version =
+ AllExtensionVersions[IReqCode-128].minor_version;
+ }
+ WriteReplyToClient (client, sizeof (xGetExtensionVersionReply), &rep);
+
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetExtensionVersion function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetExtensionVersion (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetExtensionVersionReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swaps(&rep->major_version, n);
+ swaps(&rep->minor_version, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/getvers.h b/xc/programs/Xserver/Xi/getvers.h
new file mode 100644
index 000000000..1646633e9
--- /dev/null
+++ b/xc/programs/Xserver/Xi/getvers.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/getvers.h,v 3.1 1996/04/15 11:18:50 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GETVERS_H
+#define GETVERS_H 1
+
+int
+SProcXGetExtensionVersion(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetExtensionVersion (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetExtensionVersion (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetExtensionVersionReply * /* rep */
+#endif
+ );
+
+#endif /* GETVERS_H */
diff --git a/xc/programs/Xserver/Xi/grabdev.c b/xc/programs/Xserver/Xi/grabdev.c
new file mode 100644
index 000000000..088b0c698
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdev.c
@@ -0,0 +1,224 @@
+/* $TOG: grabdev.c /main/10 1998/02/09 15:29:47 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdev.c,v 3.1 1998/10/04 09:37:07 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to grab an extension device.
+ *
+ */
+
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* GrabDevice */
+
+#include "grabdev.h"
+
+extern XExtEventInfo EventInfo[];
+extern int ExtEventIndex;
+
+/***********************************************************************
+ *
+ * Swap the request if the requestor has a different byte order than us.
+ *
+ */
+
+int
+SProcXGrabDevice(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+
+ REQUEST(xGrabDeviceReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
+ swapl(&stuff->grabWindow, n);
+ swapl(&stuff->time, n);
+ swaps(&stuff->event_count, n);
+ p = (long *) &stuff[1];
+ for (i=0; i<stuff->event_count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+
+ return(ProcXGrabDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * Grab an extension device.
+ *
+ */
+
+int
+ProcXGrabDevice(client)
+ ClientPtr client;
+ {
+ int error;
+ xGrabDeviceReply rep;
+ DeviceIntPtr dev;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xGrabDeviceReq);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
+
+ if (stuff->length !=(sizeof(xGrabDeviceReq)>>2) + stuff->event_count)
+ {
+ SendErrorToClient (client, IReqCode, X_GrabDevice, 0, BadLength);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GrabDevice;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
+ return Success;
+ }
+
+ if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
+ stuff->event_count, tmp, dev, X_GrabDevice) != Success)
+ return Success;
+
+ error = GrabDevice (client, dev, stuff->this_device_mode,
+ stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents,
+ stuff->time, tmp[stuff->deviceid].mask, &rep.status);
+
+ if (error != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
+ return Success;
+ }
+ WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
+ return Success;
+ }
+
+
+/***********************************************************************
+ *
+ * This procedure creates an event mask from a list of XEventClasses.
+ *
+ */
+
+int
+CreateMaskFromList (client, list, count, mask, dev, req)
+ ClientPtr client;
+ XEventClass *list;
+ int count;
+ struct tmask mask[];
+ DeviceIntPtr dev;
+ int req;
+ {
+ int i,j;
+ int device;
+ DeviceIntPtr tdev;
+
+ for (i=0; i<EMASKSIZE; i++)
+ {
+ mask[i].mask = 0;
+ mask[i].dev = NULL;
+ }
+
+ for (i=0; i<count; i++, list++)
+ {
+ device = *list >> 8;
+ if (device > 255)
+ {
+ SendErrorToClient(client, IReqCode, req, 0, BadClass);
+ return BadClass;
+ }
+ tdev = LookupDeviceIntRec (device);
+ if (tdev==NULL || (dev != NULL && tdev != dev))
+ {
+ SendErrorToClient(client, IReqCode, req, 0, BadClass);
+ return BadClass;
+ }
+
+ for (j=0; j<ExtEventIndex; j++)
+ if (EventInfo[j].type == (*list & 0xff))
+ {
+ mask[device].mask |= EventInfo[j].mask;
+ mask[device].dev = (Pointer) tdev;
+ break;
+ }
+ }
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGrabDevice function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGrabDevice (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGrabDeviceReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/grabdev.h b/xc/programs/Xserver/Xi/grabdev.h
new file mode 100644
index 000000000..382e06b99
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdev.h
@@ -0,0 +1,65 @@
+/* $XFree86: xc/programs/Xserver/Xi/grabdev.h,v 3.1 1996/04/15 11:18:51 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GRABDEV_H
+#define GRABDEV_H 1
+
+int
+SProcXGrabDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGrabDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+CreateMaskFromList (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ XEventClass * /* list */,
+ int /* count */,
+ struct tmask /* mask */[],
+ DeviceIntPtr /* dev */,
+ int /* req */
+#endif
+ );
+
+void
+SRepXGrabDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGrabDeviceReply * /* rep */
+#endif
+ );
+
+#endif /* GRABDEV_H */
diff --git a/xc/programs/Xserver/Xi/grabdevb.c b/xc/programs/Xserver/Xi/grabdevb.c
new file mode 100644
index 000000000..72c6a7c42
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdevb.c
@@ -0,0 +1,162 @@
+/* $TOG: grabdevb.c /main/10 1998/02/09 15:29:38 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevb.c,v 3.1 1998/10/04 09:37:08 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to grab a button on an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "grabdevb.h"
+
+/***********************************************************************
+ *
+ * Handle requests from clients with a different byte order.
+ *
+ */
+
+int
+SProcXGrabDeviceButton(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+
+ REQUEST(xGrabDeviceButtonReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ swaps(&stuff->event_count, n);
+ p = (long *) &stuff[1];
+ for (i=0; i<stuff->event_count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+
+ return(ProcXGrabDeviceButton(client));
+ }
+
+/***********************************************************************
+ *
+ * Grab a button on an extension device.
+ *
+ */
+
+int
+ProcXGrabDeviceButton(client)
+ ClientPtr client;
+ {
+ int ret;
+ DeviceIntPtr dev;
+ DeviceIntPtr mdev;
+ XEventClass *class;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xGrabDeviceButtonReq);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
+
+ if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count)
+ {
+ SendErrorToClient (client, IReqCode, X_GrabDeviceButton, 0, BadLength);
+ return Success;
+ }
+
+ dev = LookupDeviceIntRec (stuff->grabbed_device);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
+ BadDevice);
+ return Success;
+ }
+ if (stuff->modifier_device != UseXKeyboard)
+ {
+ mdev = LookupDeviceIntRec (stuff->modifier_device);
+ if (mdev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
+ BadDevice);
+ return Success;
+ }
+ if (mdev->key == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+ else
+ mdev = (DeviceIntPtr) LookupKeyboardDevice();
+
+ class = (XEventClass *) (&stuff[1]); /* first word of values */
+
+ if ((ret = CreateMaskFromList (client, class,
+ stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success)
+ return Success;
+ ret = GrabButton(client, dev, stuff->this_device_mode,
+ stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
+ stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0,
+ tmp[stuff->grabbed_device].mask);
+
+ if (ret != Success)
+ SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
+ return(Success);
+ }
diff --git a/xc/programs/Xserver/Xi/grabdevb.h b/xc/programs/Xserver/Xi/grabdevb.h
new file mode 100644
index 000000000..39b96bcf1
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdevb.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/grabdevb.h,v 3.1 1996/04/15 11:18:52 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GRABDEVB_H
+#define GRABDEVB_H 1
+
+int
+SProcXGrabDeviceButton(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGrabDeviceButton(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* GRABDEVB_H */
diff --git a/xc/programs/Xserver/Xi/grabdevk.c b/xc/programs/Xserver/Xi/grabdevk.c
new file mode 100644
index 000000000..22246fc8f
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdevk.c
@@ -0,0 +1,166 @@
+/* $TOG: grabdevk.c /main/9 1998/02/09 15:29:42 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevk.c,v 3.1 1998/10/04 09:37:08 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to grab a key on an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "grabdevk.h"
+
+/***********************************************************************
+ *
+ * Handle requests from clients with a different byte order.
+ *
+ */
+
+int
+SProcXGrabDeviceKey(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+
+ REQUEST(xGrabDeviceKeyReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ swaps(&stuff->event_count, n);
+ p = (long *) &stuff[1];
+ for (i=0; i<stuff->event_count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ return(ProcXGrabDeviceKey(client));
+ }
+
+/***********************************************************************
+ *
+ * Grab a key on an extension device.
+ *
+ */
+
+int
+ProcXGrabDeviceKey(client)
+ ClientPtr client;
+ {
+ int ret;
+ DeviceIntPtr dev;
+ DeviceIntPtr mdev;
+ XEventClass *class;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xGrabDeviceKeyReq);
+ REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
+
+ if (stuff->length !=(sizeof(xGrabDeviceKeyReq)>>2) + stuff->event_count)
+ {
+ SendErrorToClient (client, IReqCode, X_GrabDeviceKey, 0, BadLength);
+ return Success;
+ }
+
+ dev = LookupDeviceIntRec (stuff->grabbed_device);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
+ BadDevice);
+ return Success;
+ }
+
+ if (stuff->modifier_device != UseXKeyboard)
+ {
+ mdev = LookupDeviceIntRec (stuff->modifier_device);
+ if (mdev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
+ BadDevice);
+ return Success;
+ }
+ if (mdev->key == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+ else
+ mdev = (DeviceIntPtr) LookupKeyboardDevice();
+
+ class = (XEventClass *) (&stuff[1]); /* first word of values */
+
+ if ((ret = CreateMaskFromList (client, class,
+ stuff->event_count, tmp, dev, X_GrabDeviceKey)) != Success)
+ return Success;
+
+ ret = GrabKey(client, dev, stuff->this_device_mode,
+ stuff->other_devices_mode, stuff->modifiers, mdev, stuff->key,
+ stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask);
+
+ if (ret != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
+ return Success;
+ }
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/grabdevk.h b/xc/programs/Xserver/Xi/grabdevk.h
new file mode 100644
index 000000000..7e533fe16
--- /dev/null
+++ b/xc/programs/Xserver/Xi/grabdevk.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/grabdevk.h,v 3.1 1996/04/15 11:18:53 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GRABDEVK_H
+#define GRABDEVK_H 1
+
+int
+SProcXGrabDeviceKey(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGrabDeviceKey(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* GRABDEVK_H */
diff --git a/xc/programs/Xserver/Xi/gtmotion.c b/xc/programs/Xserver/Xi/gtmotion.c
new file mode 100644
index 000000000..9c9696a6e
--- /dev/null
+++ b/xc/programs/Xserver/Xi/gtmotion.c
@@ -0,0 +1,205 @@
+/* $TOG: gtmotion.c /main/13 1998/02/09 15:29:51 kaleb $ */ /*ALLOC-FIX*/
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/gtmotion.c,v 3.4 1998/10/04 09:37:09 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to get the motion history from an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "gtmotion.h"
+
+/***********************************************************************
+ *
+ * Swap the request if server and client have different byte ordering.
+ *
+ */
+
+int
+SProcXGetDeviceMotionEvents(client)
+register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xGetDeviceMotionEventsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
+ swapl(&stuff->start, n);
+ swapl(&stuff->stop, n);
+ return(ProcXGetDeviceMotionEvents(client));
+ }
+
+/****************************************************************************
+ *
+ * Get the motion history for an extension pointer devices.
+ *
+ */
+
+int
+ProcXGetDeviceMotionEvents(client)
+ ClientPtr client;
+{
+ INT32 *coords = NULL, *bufptr;
+ xGetDeviceMotionEventsReply rep;
+ unsigned long i;
+ int num_events, axes, size, tsize;
+ unsigned long nEvents;
+ DeviceIntPtr dev;
+ TimeStamp start, stop;
+ int length = 0;
+ ValuatorClassPtr v;
+
+ REQUEST(xGetDeviceMotionEventsReq);
+
+ REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
+ BadDevice);
+ return Success;
+ }
+ v = dev->valuator;
+ if (v==NULL || v->numAxes == 0)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
+ BadMatch);
+ return Success;
+ }
+ if (dev->valuator->motionHintWindow)
+ MaybeStopDeviceHint(dev, client);
+ axes = v->numAxes;
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceMotionEvents;
+ rep.sequenceNumber = client->sequence;
+ rep.nEvents = 0;
+ rep.axes = axes;
+ rep.mode = v->mode & DeviceMode;
+ rep.length = 0;
+ start = ClientTimeToServerTime(stuff->start);
+ stop = ClientTimeToServerTime(stuff->stop);
+ if (CompareTimeStamps(start, stop) == LATER ||
+ CompareTimeStamps(start, currentTime) == LATER)
+ {
+ WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
+ return Success;
+ }
+ if (CompareTimeStamps(stop, currentTime) == LATER)
+ stop = currentTime;
+ num_events = v->numMotionEvents;
+ if (num_events)
+ {
+ size = sizeof(Time) + (axes * sizeof (INT32));
+ tsize = num_events * size;
+ coords = (INT32 *) ALLOCATE_LOCAL(tsize);
+ if (!coords)
+ {
+ SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
+ BadAlloc);
+ return Success;
+ }
+ rep.nEvents = (v->GetMotionProc) (
+ dev, (xTimecoord *)coords, /* XXX */
+ start.milliseconds, stop.milliseconds, (ScreenPtr)NULL);
+ }
+ if (rep.nEvents > 0)
+ {
+ length = (rep.nEvents * size +3) >> 2;
+ rep.length = length;
+ }
+ nEvents = rep.nEvents;
+ WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
+ if (nEvents)
+ {
+ if (client->swapped)
+ {
+ register char n;
+
+ bufptr = coords;
+ for (i=0; i<nEvents * (axes+1); i++)
+ {
+ swapl(bufptr, n);
+ bufptr++;
+ }
+ }
+ WriteToClient(client, length * 4, (char *)coords);
+ }
+ if (coords)
+ DEALLOCATE_LOCAL(coords);
+ return Success;
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XGetDeviceMotionEvents function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXGetDeviceMotionEvents (client, size, rep)
+ ClientPtr client;
+ int size;
+ xGetDeviceMotionEventsReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ swapl(&rep->nEvents, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/gtmotion.h b/xc/programs/Xserver/Xi/gtmotion.h
new file mode 100644
index 000000000..1139a1a76
--- /dev/null
+++ b/xc/programs/Xserver/Xi/gtmotion.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/gtmotion.h,v 3.1 1996/04/15 11:18:56 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef GTMOTION_H
+#define GTMOTION_H 1
+
+int
+SProcXGetDeviceMotionEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXGetDeviceMotionEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXGetDeviceMotionEvents (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xGetDeviceMotionEventsReply * /* rep */
+#endif
+ );
+
+#endif /* GTMOTION_H */
diff --git a/xc/programs/Xserver/Xi/listdev.c b/xc/programs/Xserver/Xi/listdev.c
new file mode 100644
index 000000000..204e510e2
--- /dev/null
+++ b/xc/programs/Xserver/Xi/listdev.c
@@ -0,0 +1,399 @@
+/* $TOG: listdev.c /main/13 1998/02/09 15:29:56 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/listdev.c,v 3.2 1998/10/04 09:37:12 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Extension function to list the available input devices.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h" /* FIXME */
+
+#include "listdev.h"
+
+#define VPC 20 /* Max # valuators per chunk */
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+SProcXListInputDevices(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xListInputDevicesReq);
+ swaps(&stuff->length, n);
+ return(ProcXListInputDevices(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+ProcXListInputDevices (client)
+ register ClientPtr client;
+ {
+ xListInputDevicesReply rep;
+ int numdevs;
+ int namesize = 1; /* need 1 extra byte for strcpy */
+ int size = 0;
+ int total_length;
+ char *devbuf;
+ char *classbuf;
+ char *namebuf;
+ char *savbuf;
+ xDeviceInfo *dev;
+ DeviceIntPtr d;
+
+ REQUEST_SIZE_MATCH(xListInputDevicesReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ListInputDevices;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ AddOtherInputDevices ();
+ numdevs = inputInfo.numDevices;
+
+ for (d=inputInfo.devices; d; d=d->next)
+ SizeDeviceInfo (d, &namesize, &size);
+ for (d=inputInfo.off_devices; d; d=d->next)
+ SizeDeviceInfo (d, &namesize, &size);
+
+ total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
+ devbuf = (char *) xalloc (total_length);
+ classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
+ namebuf = classbuf + size;
+ savbuf = devbuf;
+
+ dev = (xDeviceInfoPtr) devbuf;
+ for (d=inputInfo.devices; d; d=d->next,dev++)
+ ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
+ for (d=inputInfo.off_devices; d; d=d->next,dev++)
+ ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
+
+ rep.ndevices = numdevs;
+ rep.length = (total_length + 3) >> 2;
+ WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree (savbuf);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure calculates the size of the information to be returned
+ * for an input device.
+ *
+ */
+
+void
+SizeDeviceInfo (d, namesize, size)
+ DeviceIntPtr d;
+ int *namesize;
+ int *size;
+ {
+ int chunks;
+
+ *namesize += 1;
+ if (d->name)
+ *namesize += strlen (d->name);
+ if (d->key != NULL)
+ *size += sizeof (xKeyInfo);
+ if (d->button != NULL)
+ *size += sizeof (xButtonInfo);
+ if (d->valuator != NULL)
+ {
+ chunks = ((int) d->valuator->numAxes + 19) / VPC;
+ *size += (chunks * sizeof(xValuatorInfo) +
+ d->valuator->numAxes * sizeof(xAxisInfo));
+ }
+ }
+
+/***********************************************************************
+ *
+ * This procedure lists information to be returned for an input device.
+ *
+ */
+
+void
+ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf)
+ ClientPtr client;
+ DeviceIntPtr d;
+ xDeviceInfoPtr dev;
+ char **devbuf;
+ char **classbuf;
+ char **namebuf;
+ {
+ CopyDeviceName (namebuf, d->name);
+ CopySwapDevice (client, d, 0, devbuf);
+ if (d->key != NULL)
+ {
+ CopySwapKeyClass(client, d->key, classbuf);
+ dev->num_classes++;
+ }
+ if (d->button != NULL)
+ {
+ CopySwapButtonClass(client, d->button, classbuf);
+ dev->num_classes++;
+ }
+ if (d->valuator != NULL)
+ {
+ dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf);
+ }
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies data to the DeviceInfo struct, swapping if necessary.
+ *
+ * We need the extra byte in the allocated buffer, because the trailing null
+ * hammers one extra byte, which is overwritten by the next name except for
+ * the last name copied.
+ *
+ */
+
+void
+CopyDeviceName (namebuf, name)
+ char **namebuf;
+ char *name;
+ {
+ char *nameptr = (char *) *namebuf;
+
+ if (name)
+ {
+ *nameptr++ = strlen (name);
+ strcpy (nameptr, name);
+ *namebuf += (strlen (name)+1);
+ }
+ else
+ {
+ *nameptr++ = 0;
+ *namebuf += 1;
+ }
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies data to the DeviceInfo struct, swapping if necessary.
+ *
+ */
+
+void
+CopySwapDevice (client, d, num_classes, buf)
+ register ClientPtr client;
+ DeviceIntPtr d;
+ int num_classes;
+ char **buf;
+ {
+ register char n;
+ xDeviceInfoPtr dev;
+
+ dev = (xDeviceInfoPtr) *buf;
+
+ dev->id = d->id;
+ dev->type = d->type;
+ dev->num_classes = num_classes;
+ if (d == inputInfo.keyboard)
+ dev->use = IsXKeyboard;
+ else if (d == inputInfo.pointer)
+ dev->use = IsXPointer;
+ else
+ dev->use = IsXExtensionDevice;
+ if (client->swapped)
+ {
+ swapl(&dev->type, n); /* macro - braces are required */
+ }
+ *buf += sizeof (xDeviceInfo);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies KeyClass information, swapping if necessary.
+ *
+ */
+
+void
+CopySwapKeyClass (client, k, buf)
+ register ClientPtr client;
+ KeyClassPtr k;
+ char **buf;
+ {
+ register char n;
+ xKeyInfoPtr k2;
+
+ k2 = (xKeyInfoPtr) *buf;
+ k2->class = KeyClass;
+ k2->length = sizeof (xKeyInfo);
+ k2->min_keycode = k->curKeySyms.minKeyCode;
+ k2->max_keycode = k->curKeySyms.maxKeyCode;
+ k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
+ if (client->swapped)
+ {
+ swaps(&k2->num_keys,n);
+ }
+ *buf += sizeof (xKeyInfo);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies ButtonClass information, swapping if necessary.
+ *
+ */
+
+void
+CopySwapButtonClass (client, b, buf)
+ register ClientPtr client;
+ ButtonClassPtr b;
+ char **buf;
+ {
+ register char n;
+ xButtonInfoPtr b2;
+
+ b2 = (xButtonInfoPtr) *buf;
+ b2->class = ButtonClass;
+ b2->length = sizeof (xButtonInfo);
+ b2->num_buttons = b->numButtons;
+ if (client->swapped)
+ {
+ swaps(&b2->num_buttons,n); /* macro - braces are required */
+ }
+ *buf += sizeof (xButtonInfo);
+ }
+
+/***********************************************************************
+ *
+ * This procedure copies ValuatorClass information, swapping if necessary.
+ *
+ * Devices may have up to 255 valuators. The length of a ValuatorClass is
+ * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
+ * The maximum length is therefore (8 + 255 * 12) = 3068. However, the
+ * length field is one byte. If a device has more than 20 valuators, we
+ * must therefore return multiple valuator classes to the client.
+ *
+ */
+
+int
+CopySwapValuatorClass (client, v, buf)
+ register ClientPtr client;
+ ValuatorClassPtr v;
+ char **buf;
+{
+ int i, j, axes, t_axes;
+ register char n;
+ xValuatorInfoPtr v2;
+ AxisInfo *a;
+ xAxisInfoPtr a2;
+
+ for (i=0,axes=v->numAxes; i < ((v->numAxes+19)/VPC); i++, axes-=VPC) {
+ t_axes = axes < VPC ? axes : VPC;
+ if (t_axes < 0)
+ t_axes = v->numAxes % VPC;
+ v2 = (xValuatorInfoPtr) *buf;
+ v2->class = ValuatorClass;
+ v2->length = sizeof (xValuatorInfo) + t_axes * sizeof (xAxisInfo);
+ v2->num_axes = t_axes;
+ v2->mode = v->mode & DeviceMode;
+ v2->motion_buffer_size = v->numMotionEvents;
+ if (client->swapped)
+ {
+ swapl(&v2->motion_buffer_size,n);
+ }
+ *buf += sizeof (xValuatorInfo);
+ a = v->axes + (VPC * i);
+ a2 = (xAxisInfoPtr) *buf;
+ for (j=0; j<t_axes; j++) {
+ a2->min_value = a->min_value;
+ a2->max_value = a->max_value;
+ a2->resolution = a->resolution;
+ if (client->swapped) {
+ swapl(&a2->min_value,n);
+ swapl(&a2->max_value,n);
+ swapl(&a2->resolution,n);
+ }
+ a2++;
+ a++;
+ *buf += sizeof (xAxisInfo);
+ }
+ }
+ return (i);
+}
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XListInputDevices function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXListInputDevices (client, size, rep)
+ ClientPtr client;
+ int size;
+ xListInputDevicesReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/listdev.h b/xc/programs/Xserver/Xi/listdev.h
new file mode 100644
index 000000000..d1ecde2ab
--- /dev/null
+++ b/xc/programs/Xserver/Xi/listdev.h
@@ -0,0 +1,119 @@
+/* $XFree86: xc/programs/Xserver/Xi/listdev.h,v 3.1 1996/04/15 11:18:57 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef LISTDEV_H
+#define LISTDEV_H 1
+
+int
+SProcXListInputDevices(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXListInputDevices (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SizeDeviceInfo (
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* d */,
+ int * /* namesize */,
+ int * /* size */
+#endif
+ );
+
+void
+ListDeviceInfo (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* d */,
+ xDeviceInfoPtr /* dev */,
+ char ** /* devbuf */,
+ char ** /* classbuf */,
+ char ** /* namebuf */
+#endif
+ );
+
+void
+CopyDeviceName (
+#if NeedFunctionPrototypes
+ char ** /* namebuf */,
+ char * /* name */
+#endif
+ );
+
+void
+CopySwapDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ DeviceIntPtr /* d */,
+ int /* num_classes */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapKeyClass (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ KeyClassPtr /* k */,
+ char ** /* buf */
+#endif
+ );
+
+void
+CopySwapButtonClass (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ ButtonClassPtr /* b */,
+ char ** /* buf */
+#endif
+ );
+
+int
+CopySwapValuatorClass (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ ValuatorClassPtr /* v */,
+ char ** /* buf */
+#endif
+ );
+
+void
+SRepXListInputDevices (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xListInputDevicesReply * /* rep */
+#endif
+ );
+
+#endif /* LISTDEV_H */
diff --git a/xc/programs/Xserver/Xi/opendev.c b/xc/programs/Xserver/Xi/opendev.c
new file mode 100644
index 000000000..c02f4a469
--- /dev/null
+++ b/xc/programs/Xserver/Xi/opendev.c
@@ -0,0 +1,197 @@
+/* $TOG: opendev.c /main/9 1998/02/09 15:30:00 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/opendev.c,v 3.1 1998/10/04 09:37:12 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to open an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "windowstr.h" /* window structure */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "opendev.h"
+
+extern CARD8 event_base [];
+
+/***********************************************************************
+ *
+ * This procedure swaps the request if the server and client have different
+ * byte orderings.
+ *
+ */
+
+int
+SProcXOpenDevice(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xOpenDeviceReq);
+ swaps(&stuff->length, n);
+ return(ProcXOpenDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure causes the server to open an input device.
+ *
+ */
+
+int
+ProcXOpenDevice(client)
+ register ClientPtr client;
+ {
+ xInputClassInfo evbase [numInputClasses];
+ Bool enableit = FALSE;
+ int j=0;
+ int status = Success;
+ xOpenDeviceReply rep;
+ DeviceIntPtr dev;
+
+ REQUEST(xOpenDeviceReq);
+ REQUEST_SIZE_MATCH(xOpenDeviceReq);
+
+ if (stuff->deviceid == inputInfo.pointer->id ||
+ stuff->deviceid == inputInfo.keyboard->id)
+ {
+ SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
+ return Success;
+ }
+
+ if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) /* not open */
+ {
+ for (dev=inputInfo.off_devices; dev; dev=dev->next)
+ if (dev->id == stuff->deviceid)
+ break;
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
+ return Success;
+ }
+ enableit = TRUE;
+ }
+
+ OpenInputDevice (dev, client, &status);
+ if (status != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
+ return Success;
+ }
+ if (enableit && dev->inited && dev->startup)
+ (void)EnableDevice(dev);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_OpenDevice;
+ rep.sequenceNumber = client->sequence;
+ if (dev->key != NULL)
+ {
+ evbase[j].class = KeyClass;
+ evbase[j++].event_type_base = event_base[KeyClass];
+ }
+ if (dev->button != NULL)
+ {
+ evbase[j].class = ButtonClass;
+ evbase[j++].event_type_base = event_base[ButtonClass];
+ }
+ if (dev->valuator != NULL)
+ {
+ evbase[j].class = ValuatorClass;
+ evbase[j++].event_type_base = event_base[ValuatorClass];
+ }
+ if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
+ dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL)
+ {
+ evbase[j].class = FeedbackClass;
+ evbase[j++].event_type_base = event_base[FeedbackClass];
+ }
+ if (dev->focus != NULL)
+ {
+ evbase[j].class = FocusClass;
+ evbase[j++].event_type_base = event_base[FocusClass];
+ }
+ if (dev->proximity != NULL)
+ {
+ evbase[j].class = ProximityClass;
+ evbase[j++].event_type_base = event_base[ProximityClass];
+ }
+ evbase[j].class = OtherClass;
+ evbase[j++].event_type_base = event_base[OtherClass];
+ rep.length = (j * sizeof (xInputClassInfo) + 3) >> 2;
+ rep.num_classes = j;
+ WriteReplyToClient (client, sizeof (xOpenDeviceReply), &rep);
+ WriteToClient(client, j * sizeof (xInputClassInfo), (char *)evbase);
+ return (Success);
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XOpenDevice function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXOpenDevice (client, size, rep)
+ ClientPtr client;
+ int size;
+ xOpenDeviceReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/opendev.h b/xc/programs/Xserver/Xi/opendev.h
new file mode 100644
index 000000000..0813e59ad
--- /dev/null
+++ b/xc/programs/Xserver/Xi/opendev.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/opendev.h,v 3.1 1996/04/15 11:18:58 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef OPENDEV_H
+#define OPENDEV_H 1
+
+int
+SProcXOpenDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXOpenDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXOpenDevice (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xOpenDeviceReply * /* rep */
+#endif
+ );
+
+#endif /* OPENDEV_H */
diff --git a/xc/programs/Xserver/Xi/queryst.c b/xc/programs/Xserver/Xi/queryst.c
new file mode 100644
index 000000000..f2187d391
--- /dev/null
+++ b/xc/programs/Xserver/Xi/queryst.c
@@ -0,0 +1,207 @@
+/* $TOG: queryst.c /main/12 1998/02/09 15:30:05 kaleb $ */
+/*
+
+Copyright 1998, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/Xi/queryst.c,v 3.3 1998/10/04 09:37:13 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to query the state of an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "queryst.h"
+
+/***********************************************************************
+ *
+ * This procedure allows a client to query the state of a device.
+ *
+ */
+
+int
+SProcXQueryDeviceState(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xQueryDeviceStateReq);
+ swaps(&stuff->length, n);
+ return(ProcXQueryDeviceState(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure allows frozen events to be routed.
+ *
+ */
+
+int
+ProcXQueryDeviceState(client)
+ register ClientPtr client;
+ {
+ register char n;
+ int i;
+ int num_classes = 0;
+ int total_length = 0;
+ char *buf, *savbuf;
+ KeyClassPtr k;
+ xKeyState *tk;
+ ButtonClassPtr b;
+ xButtonState *tb;
+ ValuatorClassPtr v;
+ xValuatorState *tv;
+ xQueryDeviceStateReply rep;
+ DeviceIntPtr dev;
+ int *values;
+
+ REQUEST(xQueryDeviceStateReq);
+ REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_QueryDeviceState;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
+ BadDevice);
+ return Success;
+ }
+
+ v = dev->valuator;
+ if (v != NULL && v->motionHintWindow != NULL)
+ MaybeStopDeviceHint(dev, client);
+
+ k = dev->key;
+ if (k != NULL)
+ {
+ total_length += sizeof (xKeyState);
+ num_classes++;
+ }
+
+ b = dev->button;
+ if (b != NULL)
+ {
+ total_length += sizeof (xButtonState);
+ num_classes++;
+ }
+
+ if (v != NULL)
+ {
+ total_length += (sizeof(xValuatorState) +
+ (v->numAxes * sizeof(int)));
+ num_classes++;
+ }
+ buf = (char *) xalloc (total_length);
+ if (!buf)
+ {
+ SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
+ BadAlloc);
+ return Success;
+ }
+ savbuf = buf;
+
+ if (k != NULL)
+ {
+ tk = (xKeyState *) buf;
+ tk->class = KeyClass;
+ tk->length = sizeof (xKeyState);
+ tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1;
+ for (i = 0; i<32; i++)
+ tk->keys[i] = k->down[i];
+ buf += sizeof (xKeyState);
+ }
+
+ if (b != NULL)
+ {
+ tb = (xButtonState *) buf;
+ tb->class = ButtonClass;
+ tb->length = sizeof (xButtonState);
+ tb->num_buttons = b->numButtons;
+ for (i = 0; i<32; i++)
+ tb->buttons[i] = b->down[i];
+ buf += sizeof (xButtonState);
+ }
+
+ if (v != NULL)
+ {
+ tv = (xValuatorState *) buf;
+ tv->class = ValuatorClass;
+ tv->length = sizeof (xValuatorState);
+ tv->num_valuators = v->numAxes;
+ tv->mode = v->mode;
+ buf += sizeof(xValuatorState);
+ for (i=0, values=v->axisVal; i<v->numAxes; i++)
+ {
+ *((int *) buf) = *values++;
+ if (client->swapped)
+ {
+ swapl ((int *) buf, n);/* macro - braces needed */
+ }
+ buf += sizeof(int);
+ }
+ }
+
+ rep.num_classes = num_classes;
+ rep.length = (total_length + 3) >> 2;
+ WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
+ if (total_length > 0)
+ WriteToClient (client, total_length, savbuf);
+ xfree (savbuf);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XQueryDeviceState function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXQueryDeviceState (client, size, rep)
+ ClientPtr client;
+ int size;
+ xQueryDeviceStateReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/queryst.h b/xc/programs/Xserver/Xi/queryst.h
new file mode 100644
index 000000000..6d6b4b65b
--- /dev/null
+++ b/xc/programs/Xserver/Xi/queryst.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/queryst.h,v 3.1 1996/04/15 11:19:00 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef QUERYST_H
+#define QUERYST_H 1
+
+int
+SProcXQueryDeviceState(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXQueryDeviceState(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXQueryDeviceState (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xQueryDeviceStateReply * /* rep */
+#endif
+ );
+
+#endif /* QUERYST_H */
diff --git a/xc/programs/Xserver/Xi/selectev.c b/xc/programs/Xserver/Xi/selectev.c
new file mode 100644
index 000000000..5260bcd83
--- /dev/null
+++ b/xc/programs/Xserver/Xi/selectev.c
@@ -0,0 +1,151 @@
+/* $TOG: selectev.c /main/7 1998/02/09 15:30:09 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/selectev.c,v 3.1 1998/10/04 09:37:13 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to select input from an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "selectev.h"
+
+extern Mask ExtExclusiveMasks[];
+extern Mask ExtValidMasks[];
+
+/***********************************************************************
+ *
+ * Handle requests from clients with a different byte order.
+ *
+ */
+
+int
+SProcXSelectExtensionEvent (client)
+register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+
+ REQUEST(xSelectExtensionEventReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
+ swapl(&stuff->window, n);
+ swaps(&stuff->count, n);
+ p = (long *) &stuff[1];
+ for (i=0; i<stuff->count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ return(ProcXSelectExtensionEvent(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure selects input from an extension device.
+ *
+ */
+
+int
+ProcXSelectExtensionEvent (client)
+ register ClientPtr client;
+ {
+ int ret;
+ int i;
+ WindowPtr pWin;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xSelectExtensionEventReq);
+ REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
+
+ if (stuff->length !=(sizeof(xSelectExtensionEventReq)>>2) + stuff->count)
+ {
+ SendErrorToClient (client, IReqCode, X_SelectExtensionEvent, 0,
+ BadLength);
+ return Success;
+ }
+
+ pWin = (WindowPtr) LookupWindow (stuff->window, client);
+ if (!pWin)
+ {
+ client->errorValue = stuff->window;
+ SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
+ BadWindow);
+ return Success;
+ }
+
+ if ((ret = CreateMaskFromList (client, (XEventClass *)&stuff[1],
+ stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success)
+ return Success;
+
+ for (i=0; i<EMASKSIZE; i++)
+ if (tmp[i].dev != NULL)
+ {
+ if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask,
+ ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
+ {
+ SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
+ ret);
+ return Success;
+ }
+ }
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/selectev.h b/xc/programs/Xserver/Xi/selectev.h
new file mode 100644
index 000000000..79332e199
--- /dev/null
+++ b/xc/programs/Xserver/Xi/selectev.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/selectev.h,v 3.1 1996/04/15 11:19:01 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SELECTEV_H
+#define SELECTEV_H 1
+
+int
+SProcXSelectExtensionEvent (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSelectExtensionEvent (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* SELECTEV_H */
diff --git a/xc/programs/Xserver/Xi/sendexev.c b/xc/programs/Xserver/Xi/sendexev.c
new file mode 100644
index 000000000..9a94c78ad
--- /dev/null
+++ b/xc/programs/Xserver/Xi/sendexev.c
@@ -0,0 +1,173 @@
+/* $TOG: sendexev.c /main/7 1998/02/09 15:30:14 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/sendexev.c,v 3.1 1998/10/04 09:37:14 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to send an extension event.
+ *
+ */
+
+#define EXTENSION_EVENT_BASE 64
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* Window */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "sendexev.h"
+
+extern int lastEvent; /* Defined in extension.c */
+
+/***********************************************************************
+ *
+ * Handle requests from clients with a different byte order than us.
+ *
+ */
+
+int
+SProcXSendExtensionEvent(client)
+ register ClientPtr client;
+ {
+ register char n;
+ register long *p;
+ register int i;
+ xEvent eventT;
+ xEvent *eventP;
+ EventSwapPtr proc;
+
+ REQUEST(xSendExtensionEventReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
+ swapl(&stuff->destination, n);
+ swaps(&stuff->count, n);
+ eventP = (xEvent *) &stuff[1];
+ for (i=0; i<stuff->num_events; i++,eventP++)
+ {
+ proc = EventSwapVector[eventP->u.u.type & 0177];
+ if (proc == NotImplemented) /* no swapping proc; invalid event type? */
+ return (BadValue);
+ (*proc)(eventP, &eventT);
+ *eventP = eventT;
+ }
+
+ p = (long *) (((xEvent *) &stuff[1]) + stuff->num_events);
+ for (i=0; i<stuff->count; i++)
+ {
+ swapl(p, n);
+ p++;
+ }
+ return(ProcXSendExtensionEvent(client));
+ }
+
+/***********************************************************************
+ *
+ * Send an event to some client, as if it had come from an extension input
+ * device.
+ *
+ */
+
+int
+ProcXSendExtensionEvent (client)
+ register ClientPtr client;
+ {
+ int ret;
+ DeviceIntPtr dev;
+ xEvent *first;
+ XEventClass *list;
+ struct tmask tmp[EMASKSIZE];
+
+ REQUEST(xSendExtensionEventReq);
+ REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
+
+ if (stuff->length !=(sizeof(xSendExtensionEventReq)>>2) + stuff->count +
+ (stuff->num_events * (sizeof (xEvent) >> 2)))
+ {
+ SendErrorToClient (client, IReqCode, X_SendExtensionEvent, 0,
+ BadLength);
+ return Success;
+ }
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
+ BadDevice);
+ return Success;
+ }
+
+ /* The client's event type must be one defined by an extension. */
+
+ first = ((xEvent *) &stuff[1]);
+ if ( ! ((EXTENSION_EVENT_BASE <= first->u.u.type) &&
+ (first->u.u.type < lastEvent)) )
+ {
+ client->errorValue = first->u.u.type;
+ SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
+ BadValue);
+ return Success;
+ }
+
+ list = (XEventClass *) (first + stuff->num_events);
+ if ((ret = CreateMaskFromList (client, list, stuff->count, tmp, dev,
+ X_SendExtensionEvent)) != Success)
+ return Success;
+
+ ret = (SendEvent (client, dev, stuff->destination,
+ stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask,
+ stuff->num_events));
+
+ if (ret != Success)
+ SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/sendexev.h b/xc/programs/Xserver/Xi/sendexev.h
new file mode 100644
index 000000000..876bbe647
--- /dev/null
+++ b/xc/programs/Xserver/Xi/sendexev.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/sendexev.h,v 3.1 1996/04/15 11:19:02 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SENDEXEV_H
+#define SENDEXEV_H 1
+
+int
+SProcXSendExtensionEvent(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSendExtensionEvent(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* SENDEXEV_H */
diff --git a/xc/programs/Xserver/Xi/setbmap.c b/xc/programs/Xserver/Xi/setbmap.c
new file mode 100644
index 000000000..6c2102891
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setbmap.c
@@ -0,0 +1,162 @@
+/* $TOG: setbmap.c /main/6 1998/02/09 15:30:18 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setbmap.c,v 3.1 1998/10/04 09:37:14 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to change the button mapping of an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#define IsOn(ptr, bit) \
+ (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
+
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setbmap.h"
+
+/***********************************************************************
+ *
+ * This procedure changes the button mapping.
+ *
+ */
+
+int
+SProcXSetDeviceButtonMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xSetDeviceButtonMappingReq);
+ swaps(&stuff->length, n);
+ return(ProcXSetDeviceButtonMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+ProcXSetDeviceButtonMapping (client)
+ register ClientPtr client;
+ {
+ int ret;
+ xSetDeviceButtonMappingReply rep;
+ DeviceIntPtr dev;
+
+ REQUEST(xSetDeviceButtonMappingReq);
+ REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
+
+ if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
+ stuff->map_length + 3)>>2)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
+ BadLength);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_SetDeviceButtonMapping;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.status = MappingSuccess;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
+ BadDevice);
+ return Success;
+ }
+
+ ret = SetButtonMapping (client, dev, stuff->map_length, (BYTE *)&stuff[1]);
+
+ if (ret == BadValue || ret == BadMatch)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
+ ret);
+ return Success;
+ }
+ else
+ {
+ rep.status = ret;
+ WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
+ }
+
+ if (ret != MappingBusy)
+ SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XSetDeviceButtonMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXSetDeviceButtonMapping (client, size, rep)
+ ClientPtr client;
+ int size;
+ xSetDeviceButtonMappingReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/setbmap.h b/xc/programs/Xserver/Xi/setbmap.h
new file mode 100644
index 000000000..3e85c0a58
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setbmap.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/setbmap.h,v 3.1 1996/04/15 11:19:03 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SETBMAP_H
+#define SETBMAP_H 1
+
+int
+SProcXSetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXSetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xSetDeviceButtonMappingReply * /* rep */
+#endif
+ );
+
+#endif /* SETBMAP_H */
diff --git a/xc/programs/Xserver/Xi/setdval.c b/xc/programs/Xserver/Xi/setdval.c
new file mode 100644
index 000000000..d8f55484f
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setdval.c
@@ -0,0 +1,166 @@
+/* $TOG: setdval.c /main/5 1998/02/09 15:30:22 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setdval.c,v 3.1 1998/10/04 09:37:15 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to change the mode of an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setdval.h"
+
+/***********************************************************************
+ *
+ * Handle a request from a client with a different byte order.
+ *
+ */
+
+int
+SProcXSetDeviceValuators(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xSetDeviceValuatorsReq);
+ swaps(&stuff->length, n);
+ return(ProcXSetDeviceValuators(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure sets the value of valuators on an extension input device.
+ *
+ */
+
+int
+ProcXSetDeviceValuators(client)
+ register ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ xSetDeviceValuatorsReply rep;
+
+ REQUEST(xSetDeviceValuatorsReq);
+ REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_SetDeviceValuators;
+ rep.length = 0;
+ rep.status = Success;
+ rep.sequenceNumber = client->sequence;
+
+ if (stuff->length !=(sizeof(xSetDeviceValuatorsReq)>>2) +
+ stuff->num_valuators)
+ {
+ SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
+ BadLength);
+ return Success;
+ }
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
+ BadDevice);
+ return Success;
+ }
+ if (dev->valuator == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
+ BadMatch);
+ return Success;
+ }
+
+ if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
+ BadValue);
+ return Success;
+ }
+
+ if ((dev->grab) && !SameClient(dev->grab, client))
+ rep.status = AlreadyGrabbed;
+ else
+ rep.status = SetDeviceValuators (client, dev, (int *) &stuff[1],
+ stuff->first_valuator, stuff->num_valuators);
+
+ if (rep.status != Success && rep.status != AlreadyGrabbed)
+ SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
+ rep.status);
+ else
+ WriteReplyToClient (client, sizeof (xSetDeviceValuatorsReply), &rep);
+
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XSetDeviceValuators function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXSetDeviceValuators (client, size, rep)
+ ClientPtr client;
+ int size;
+ xSetDeviceValuatorsReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/setdval.h b/xc/programs/Xserver/Xi/setdval.h
new file mode 100644
index 000000000..5a8b42192
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setdval.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/setdval.h,v 3.1 1996/04/15 11:19:04 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SETDVAL_H
+#define SETDVAL_H 1
+
+int
+SProcXSetDeviceValuators(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSetDeviceValuators(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXSetDeviceValuators(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xSetDeviceValuatorsReply * /* rep */
+#endif
+ );
+
+#endif /* SETDVAL_H */
diff --git a/xc/programs/Xserver/Xi/setfocus.c b/xc/programs/Xserver/Xi/setfocus.c
new file mode 100644
index 000000000..290994e88
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setfocus.c
@@ -0,0 +1,118 @@
+/* $TOG: setfocus.c /main/7 1998/02/09 15:30:28 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setfocus.c,v 3.1 1998/10/04 09:37:15 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to set the focus for an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "windowstr.h" /* focus struct */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+
+#include "dixevents.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setfocus.h"
+
+/***********************************************************************
+ *
+ * This procedure sets the focus for a device.
+ *
+ */
+
+int
+SProcXSetDeviceFocus(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xSetDeviceFocusReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
+ swapl(&stuff->focus, n);
+ swapl(&stuff->time, n);
+ return(ProcXSetDeviceFocus(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure sets the focus for a device.
+ *
+ */
+
+int
+ProcXSetDeviceFocus(client)
+ register ClientPtr client;
+ {
+ int ret;
+ register DeviceIntPtr dev;
+
+ REQUEST(xSetDeviceFocusReq);
+ REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
+
+ dev = LookupDeviceIntRec (stuff->device);
+ if (dev==NULL || !dev->focus)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
+ return Success;
+ }
+
+ ret = SetInputFocus (client, dev, stuff->focus, stuff->revertTo,
+ stuff->time, TRUE);
+ if (ret != Success)
+ SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
+
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/setfocus.h b/xc/programs/Xserver/Xi/setfocus.h
new file mode 100644
index 000000000..44a98193a
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setfocus.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/setfocus.h,v 3.1 1996/04/15 11:19:05 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SETFOCUS_H
+#define SETFOCUS_H 1
+
+int
+SProcXSetDeviceFocus(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSetDeviceFocus(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* SETFOCUS_H */
diff --git a/xc/programs/Xserver/Xi/setmmap.c b/xc/programs/Xserver/Xi/setmmap.c
new file mode 100644
index 000000000..4c6de8b62
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setmmap.c
@@ -0,0 +1,156 @@
+/* $TOG: setmmap.c /main/7 1998/02/09 15:30:32 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmmap.c,v 3.1 1998/10/04 09:37:16 dawes Exp $ */
+
+/********************************************************************
+ *
+ * Set modifier mapping for an extension device.
+ *
+ */
+
+#define NEED_EVENTS /* for inputstr.h */
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setmmap.h"
+
+/***********************************************************************
+ *
+ * This procedure sets the modifier mapping for an extension device,
+ * for clients on machines with a different byte ordering than the server.
+ *
+ */
+
+int
+SProcXSetDeviceModifierMapping(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xSetDeviceModifierMappingReq);
+ swaps(&stuff->length, n);
+ return(ProcXSetDeviceModifierMapping(client));
+ }
+
+/***********************************************************************
+ *
+ * Set the device Modifier mapping.
+ *
+ */
+
+int
+ProcXSetDeviceModifierMapping(client)
+ ClientPtr client;
+ {
+ int ret;
+ xSetDeviceModifierMappingReply rep;
+ DeviceIntPtr dev;
+ KeyClassPtr kp;
+
+ REQUEST(xSetDeviceModifierMappingReq);
+ REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,
+ BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_SetDeviceModifierMapping;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ ret = SetModifierMapping(client, dev, stuff->length,
+ (sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
+ (BYTE *)&stuff[1], &kp);
+
+ if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
+ {
+ rep.success = ret;
+ if (ret == MappingSuccess)
+ SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
+ WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),&rep);
+ }
+ else
+ {
+ if (ret==-1)
+ ret=BadValue;
+ SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,ret);
+ }
+
+
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XSetDeviceModifierMapping function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXSetDeviceModifierMapping (client, size, rep)
+ ClientPtr client;
+ int size;
+ xSetDeviceModifierMappingReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
+
diff --git a/xc/programs/Xserver/Xi/setmmap.h b/xc/programs/Xserver/Xi/setmmap.h
new file mode 100644
index 000000000..925373e9e
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setmmap.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/setmmap.h,v 3.1 1996/04/15 11:19:06 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SETMMAP_H
+#define SETMMAP_H 1
+
+int
+SProcXSetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXSetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xSetDeviceModifierMappingReply * /* rep */
+#endif
+ );
+
+#endif /* SETMMAP_H */
diff --git a/xc/programs/Xserver/Xi/setmode.c b/xc/programs/Xserver/Xi/setmode.c
new file mode 100644
index 000000000..34bdc6748
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setmode.c
@@ -0,0 +1,150 @@
+/* $TOG: setmode.c /main/11 1998/02/09 15:30:36 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmode.c,v 3.1 1998/10/04 09:37:16 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to change the mode of an extension input device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setmode.h"
+
+/***********************************************************************
+ *
+ * Handle a request from a client with a different byte order.
+ *
+ */
+
+int
+SProcXSetDeviceMode(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xSetDeviceModeReq);
+ swaps(&stuff->length, n);
+ return(ProcXSetDeviceMode(client));
+ }
+
+/***********************************************************************
+ *
+ * This procedure sets the mode of a device.
+ *
+ */
+
+int
+ProcXSetDeviceMode(client)
+ register ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ xSetDeviceModeReply rep;
+
+ REQUEST(xSetDeviceModeReq);
+ REQUEST_SIZE_MATCH(xSetDeviceModeReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_SetDeviceMode;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient (client, IReqCode, X_SetDeviceMode, 0, BadDevice);
+ return Success;
+ }
+ if (dev->valuator == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
+ return Success;
+ }
+ if ((dev->grab) && !SameClient(dev->grab, client))
+ rep.status = AlreadyGrabbed;
+ else
+ rep.status = SetDeviceMode (client, dev, stuff->mode);
+
+ if (rep.status == Success)
+ dev->valuator->mode = stuff->mode;
+ else if (rep.status != AlreadyGrabbed)
+ {
+ SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
+ return Success;
+ }
+
+ WriteReplyToClient (client, sizeof (xSetDeviceModeReply), &rep);
+ return Success;
+ }
+
+/***********************************************************************
+ *
+ * This procedure writes the reply for the XSetDeviceMode function,
+ * if the client and server have a different byte ordering.
+ *
+ */
+
+void
+SRepXSetDeviceMode (client, size, rep)
+ ClientPtr client;
+ int size;
+ xSetDeviceModeReply *rep;
+ {
+ register char n;
+
+ swaps(&rep->sequenceNumber, n);
+ swapl(&rep->length, n);
+ WriteToClient(client, size, (char *)rep);
+ }
diff --git a/xc/programs/Xserver/Xi/setmode.h b/xc/programs/Xserver/Xi/setmode.h
new file mode 100644
index 000000000..cd27ba146
--- /dev/null
+++ b/xc/programs/Xserver/Xi/setmode.h
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/Xi/setmode.h,v 3.1 1996/04/15 11:19:07 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef SETMODE_H
+#define SETMODE_H 1
+
+int
+SProcXSetDeviceMode(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXSetDeviceMode(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+void
+SRepXSetDeviceMode(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ int /* size */,
+ xSetDeviceModeReply * /* rep */
+#endif
+ );
+
+#endif /* SETMODE_H */
diff --git a/xc/programs/Xserver/Xi/stubs.c b/xc/programs/Xserver/Xi/stubs.c
new file mode 100644
index 000000000..00b3fbc25
--- /dev/null
+++ b/xc/programs/Xserver/Xi/stubs.c
@@ -0,0 +1,315 @@
+/* $TOG: stubs.c /main/12 1998/02/09 15:30:40 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.2 1998/10/04 09:37:17 dawes Exp $ */
+
+/*
+ * stubs.c -- stub routines for the X server side of the XINPUT
+ * extension. This file is mainly to be used only as documentation.
+ * There is not much code here, and you can't get a working XINPUT
+ * server just using this.
+ * The Xvfb server uses this file so it will compile with the same
+ * object files as the real X server for a platform that has XINPUT.
+ * Xnest could do the same thing.
+ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangeKeyboardDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the keyboard device.
+ *
+ * The X keyboard device has a FocusRec. If the device that has been
+ * made into the new X keyboard did not have a FocusRec,
+ * ProcXChangeKeyboardDevice will allocate one for it.
+ *
+ * If you do not want clients to be able to focus the old X keyboard
+ * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
+ *
+ * If you support input devices with keys that you do not want to be
+ * used as the X keyboard, you need to check for them here and return
+ * a BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you do want
+ * clients to be able to focus the old X keyboard). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ */
+
+int
+ChangeKeyboardDevice (old_dev, new_dev)
+ DeviceIntPtr old_dev;
+ DeviceIntPtr new_dev;
+ {
+ /***********************************************************************
+ DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
+ **********************************************************************/
+ return BadMatch;
+ }
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangePointerDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the pointer device.
+ *
+ * The X pointer device does not have a FocusRec. If the device that
+ * has been made into the new X pointer had a FocusRec,
+ * ProcXChangePointerDevice will free it.
+ *
+ * If you want clients to be able to focus the old pointer device that
+ * has now become accessible through the input extension, you need to
+ * add a FocusRec to it here.
+ *
+ * The XChangePointerDevice protocol request also allows the client
+ * to choose which axes of the new pointer device are used to move
+ * the X cursor in the X- and Y- directions. If the axes are different
+ * than the default ones, you need to keep track of that here.
+ *
+ * If you support input devices with valuators that you do not want to be
+ * used as the X pointer, you need to check for them here and return a
+ * BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you don't want
+ * clients to be able to focus the old X pointer). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ */
+
+int
+#if NeedFunctionPrototypes
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+#else
+ChangePointerDevice (old_dev, new_dev, x, y)
+ DeviceIntPtr old_dev, new_dev;
+ unsigned char x, y;
+#endif
+ {
+ /***********************************************************************
+ InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
+
+ x_axis = x; * keep track of new x-axis*
+ y_axis = y; * keep track of new y-axis*
+ if (x_axis != 0 || y_axis != 1)
+ axes_changed = TRUE; * remember axes have changed*
+ else
+ axes_changed = FALSE;
+ *************************************************************************/
+ return BadMatch;
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXCloseDevice
+ *
+ * Take care of implementation-dependent details of closing a device.
+ * Some implementations may actually close the device, others may just
+ * remove this clients interest in that device.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ *
+ */
+
+void
+CloseInputDevice (d, client)
+ DeviceIntPtr d;
+ ClientPtr client;
+ {
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXListInputDevices
+ *
+ * This is the implementation-dependent routine to initialize an input
+ * device to the point that information about it can be listed.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. If some other process has the device open, the
+ * server may not be able to get information about the device to list it.
+ *
+ * This procedure should be used by implementations that do not initialize
+ * all input devices at server startup. It should do device-dependent
+ * initialization for any devices not previously initialized, and call
+ * AddInputDevice for each of those devices so that a DeviceIntRec will be
+ * created for them.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ * The commented-out sample code shows what you might do if you don't want
+ * the default.
+ *
+ */
+
+void
+AddOtherInputDevices ()
+ {
+ /**********************************************************************
+ for each uninitialized device, do something like:
+
+ DeviceIntPtr dev;
+ DeviceProc deviceProc;
+ pointer private;
+
+ dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
+ dev->public.devicePrivate = private;
+ RegisterOtherDevice(dev);
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ ************************************************************************/
+
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXOpenDevice
+ *
+ * This is the implementation-dependent routine to open an input device.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. This entry point is for the latter type of
+ * implementation.
+ *
+ * If the physical device is not already open, do it here. In this case,
+ * you need to keep track of the fact that one or more clients has the
+ * device open, and physically close it when the last client that has
+ * it open does an XCloseDevice.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are opened during X server initialization and kept open).
+ *
+ */
+
+void
+OpenInputDevice (dev, client, status)
+ DeviceIntPtr dev;
+ ClientPtr client;
+ int *status;
+ {
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceMode
+ *
+ * Change the mode of an extension device.
+ * This function is used to change the mode of a device from reporting
+ * relative motion to reporting absolute positional information, and
+ * vice versa.
+ * The default implementation below is that no such devices are supported.
+ *
+ */
+
+int
+SetDeviceMode (client, dev, mode)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int mode;
+ {
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceValuators
+ *
+ * Set the value of valuators on an extension input device.
+ * This function is used to set the initial value of valuators on
+ * those input devices that are capable of reporting either relative
+ * motion or an absolute position, and allow an initial position to be set.
+ * The default implementation below is that no such devices are supported.
+ *
+ */
+
+int
+SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+ {
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXChangeDeviceControl
+ *
+ * Change the specified device controls on an extension input device.
+ *
+ */
+
+int
+ChangeDeviceControl (client, dev, control)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ xDeviceCtl *control;
+ {
+ switch (control->control)
+ {
+ case DEVICE_RESOLUTION:
+ return (BadMatch);
+ default:
+ return (BadMatch);
+ }
+ }
diff --git a/xc/programs/Xserver/Xi/ungrdev.c b/xc/programs/Xserver/Xi/ungrdev.c
new file mode 100644
index 000000000..79cc349e2
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdev.c
@@ -0,0 +1,115 @@
+/* $TOG: ungrdev.c /main/5 1998/02/09 15:30:54 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdev.c,v 3.1 1998/10/04 09:37:17 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to release a grab of an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "ungrdev.h"
+
+/***********************************************************************
+ *
+ * Handle requests from a client with a different byte order.
+ *
+ */
+
+int
+SProcXUngrabDevice(client)
+register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xUngrabDeviceReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xUngrabDeviceReq);
+ swapl(&stuff->time, n);
+ return(ProcXUngrabDevice(client));
+ }
+
+/***********************************************************************
+ *
+ * Release a grab of an extension device.
+ *
+ */
+
+int
+ProcXUngrabDevice(client)
+register ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ GrabPtr grab;
+ TimeStamp time;
+
+ REQUEST(xUngrabDeviceReq);
+ REQUEST_SIZE_MATCH(xUngrabDeviceReq);
+
+ dev = LookupDeviceIntRec (stuff->deviceid);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
+ return Success;
+ }
+ grab = dev->grab;
+
+ time = ClientTimeToServerTime(stuff->time);
+ if ((CompareTimeStamps(time, currentTime) != LATER) &&
+ (CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client))
+ (*dev->DeactivateGrab)(dev);
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/ungrdev.h b/xc/programs/Xserver/Xi/ungrdev.h
new file mode 100644
index 000000000..6b00a3ef6
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdev.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/ungrdev.h,v 3.1 1996/04/15 11:19:08 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef UNGRDEV_H
+#define UNGRDEV_H 1
+
+int
+SProcXUngrabDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXUngrabDevice(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* UNGRDEV_H */
diff --git a/xc/programs/Xserver/Xi/ungrdevb.c b/xc/programs/Xserver/Xi/ungrdevb.c
new file mode 100644
index 000000000..3bbec1f6a
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdevb.c
@@ -0,0 +1,170 @@
+/* $TOG: ungrdevb.c /main/8 1998/02/09 15:30:44 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.c,v 3.2 1998/10/04 09:37:18 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to release a grab of a button on an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevb.h"
+
+#define AllModifiersMask ( \
+ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
+ Mod3Mask | Mod4Mask | Mod5Mask )
+
+/***********************************************************************
+ *
+ * Handle requests from a client with a different byte order.
+ *
+ */
+
+int
+SProcXUngrabDeviceButton(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xUngrabDeviceButtonReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ return(ProcXUngrabDeviceButton(client));
+ }
+
+/***********************************************************************
+ *
+ * Release a grab of a button on an extension device.
+ *
+ */
+
+int
+ProcXUngrabDeviceButton(client)
+ ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ DeviceIntPtr mdev;
+ WindowPtr pWin;
+ GrabRec temporaryGrab;
+
+ REQUEST(xUngrabDeviceButtonReq);
+ REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
+
+ dev = LookupDeviceIntRec (stuff->grabbed_device);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadDevice);
+ return Success;
+ }
+ if (dev->button == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadMatch);
+ return Success;
+ }
+
+ if (stuff->modifier_device != UseXKeyboard)
+ {
+ mdev = LookupDeviceIntRec (stuff->modifier_device);
+ if (mdev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadDevice);
+ return Success;
+ }
+ if (mdev->key == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+ else
+ mdev = (DeviceIntPtr) LookupKeyboardDevice();
+
+ pWin = LookupWindow(stuff->grabWindow, client);
+ if (!pWin)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadWindow);
+ return Success;
+ }
+
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
+ BadValue);
+ return Success;
+ }
+
+ temporaryGrab.resource = client->clientAsMask;
+ temporaryGrab.device = dev;
+ temporaryGrab.window = pWin;
+ temporaryGrab.type = DeviceButtonPress;
+ temporaryGrab.modifierDevice = mdev;
+ temporaryGrab.modifiersDetail.exact = stuff->modifiers;
+ temporaryGrab.modifiersDetail.pMask = NULL;
+ temporaryGrab.detail.exact = stuff->button;
+ temporaryGrab.detail.pMask = NULL;
+
+ DeletePassiveGrabFromList(&temporaryGrab);
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/ungrdevb.h b/xc/programs/Xserver/Xi/ungrdevb.h
new file mode 100644
index 000000000..d416c73c6
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdevb.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.h,v 3.1 1996/04/15 11:19:10 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef UNGRDEVB_H
+#define UNGRDEVB_H 1
+
+int
+SProcXUngrabDeviceButton(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXUngrabDeviceButton(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* UNGRDEVB_H */
diff --git a/xc/programs/Xserver/Xi/ungrdevk.c b/xc/programs/Xserver/Xi/ungrdevk.c
new file mode 100644
index 000000000..c9eec4d4c
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdevk.c
@@ -0,0 +1,176 @@
+/* $TOG: ungrdevk.c /main/8 1998/02/09 15:30:50 kaleb $ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevk.c,v 3.2 1998/10/04 09:37:18 dawes Exp $ */
+
+/***********************************************************************
+ *
+ * Request to release a grab of a key on an extension device.
+ *
+ */
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "X.h" /* for inputstr.h */
+#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
+#include "windowstr.h" /* window structure */
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevk.h"
+
+#define AllModifiersMask ( \
+ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
+ Mod3Mask | Mod4Mask | Mod5Mask )
+
+/***********************************************************************
+ *
+ * Handle requests from a client with a different byte order.
+ *
+ */
+
+int
+SProcXUngrabDeviceKey(client)
+ register ClientPtr client;
+ {
+ register char n;
+
+ REQUEST(xUngrabDeviceKeyReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ return(ProcXUngrabDeviceKey(client));
+ }
+
+/***********************************************************************
+ *
+ * Release a grab of a key on an extension device.
+ *
+ */
+
+int
+ProcXUngrabDeviceKey(client)
+ ClientPtr client;
+ {
+ DeviceIntPtr dev;
+ DeviceIntPtr mdev;
+ WindowPtr pWin;
+ GrabRec temporaryGrab;
+
+ REQUEST(xUngrabDeviceKeyReq);
+ REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
+
+ dev = LookupDeviceIntRec (stuff->grabbed_device);
+ if (dev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadDevice);
+ return Success;
+ }
+ if (dev->key == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
+ return Success;
+ }
+
+ if (stuff->modifier_device != UseXKeyboard)
+ {
+ mdev = LookupDeviceIntRec (stuff->modifier_device);
+ if (mdev == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadDevice);
+ return Success;
+ }
+ if (mdev->key == NULL)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadMatch);
+ return Success;
+ }
+ }
+ else
+ mdev = (DeviceIntPtr) LookupKeyboardDevice();
+
+ pWin = LookupWindow(stuff->grabWindow, client);
+ if (!pWin)
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadWindow);
+ return Success;
+ }
+ if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
+ (stuff->key < dev->key->curKeySyms.minKeyCode))
+ && (stuff->key != AnyKey))
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadValue);
+ return Success;
+ }
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
+ BadValue);
+ return Success;
+ }
+
+ temporaryGrab.resource = client->clientAsMask;
+ temporaryGrab.device = dev;
+ temporaryGrab.window = pWin;
+ temporaryGrab.type = DeviceKeyPress;
+ temporaryGrab.modifierDevice = mdev;
+ temporaryGrab.modifiersDetail.exact = stuff->modifiers;
+ temporaryGrab.modifiersDetail.pMask = NULL;
+ temporaryGrab.detail.exact = stuff->key;
+ temporaryGrab.detail.pMask = NULL;
+
+ DeletePassiveGrabFromList(&temporaryGrab);
+ return Success;
+ }
diff --git a/xc/programs/Xserver/Xi/ungrdevk.h b/xc/programs/Xserver/Xi/ungrdevk.h
new file mode 100644
index 000000000..26dc14ae0
--- /dev/null
+++ b/xc/programs/Xserver/Xi/ungrdevk.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevk.h,v 3.1 1996/04/15 11:19:12 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifndef UNGRDEVK_H
+#define UNGRDEVK_H 1
+
+int
+SProcXUngrabDeviceKey(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+int
+ProcXUngrabDeviceKey(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+
+#endif /* UNGRDEVK_H */
diff --git a/xc/programs/Xserver/Xnest.def b/xc/programs/Xserver/Xnest.def
new file mode 100644
index 000000000..96eff68f5
--- /dev/null
+++ b/xc/programs/Xserver/Xnest.def
@@ -0,0 +1,4 @@
+NAME Xnest NOTWINDOWCOMPAT
+DESCRIPTION "X11R6 XFree86 3.2 Xserver XNEST EMX09C"
+PROTMODE
+EXETYPE OS2
diff --git a/xc/programs/Xserver/XpConfig/C/print/Xprinters b/xc/programs/Xserver/XpConfig/C/print/Xprinters
new file mode 100644
index 000000000..77de49ef8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/Xprinters
@@ -0,0 +1,43 @@
+########################################################################
+#
+# $XConsortium: Xprinters /main/1 1996/11/24 16:23:30 rws $
+#
+# X*printers sample configuration file
+#
+#
+# This file belongs in /usr/lib/X11/X*printers, where the "*" is the
+# display number of the server. For example, if the server is
+# invoked using the command X :0, then the X0printers file is used.
+########################################################################
+
+########################################################################
+# Use lpstat to augment the list of printers managed by the
+# server. (This is the default behavior if the X*printers file does
+# not exist, or if an "Augment_Printer_List" line is not specified.)
+########################################################################
+#Augment_Printer_List %(default)%
+
+########################################################################
+# Use the specified command pipeline to augment the list of printers
+# managed by the server.
+########################################################################
+#Augment_Printer_List lpstat -a | cut -d " " -f 1 # equivalent to default
+
+########################################################################
+# Do not augment the list of printers managed by the server.
+########################################################################
+#Augment_Printer_List %none%
+
+########################################################################
+# Add individual printers to the list of printers managed by the
+# server. These are aliases, determined by driver name.
+########################################################################
+
+
+# EXAMPLES
+#
+# Printer xppspr
+# Printer xppclpr
+# Printer xppclmonopr
+# Printer xprasterpr
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/attributes/document b/xc/programs/Xserver/XpConfig/C/print/attributes/document
new file mode 100644
index 000000000..a5990e13f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/attributes/document
@@ -0,0 +1,38 @@
+# $XConsortium: document /main/2 1996/12/04 10:45:14 rws $
+# Document DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "dj_1.plex: duplex"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.plex: duplex"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.plex: duplex"
+
+
+*content-orientation: portrait
+*copy-count: 1
+*default-medium: iso-a4
+*default-printer-resolution: 300
+*document-format: {Postscript 2}
+*plex: duplex
+
+
+# EXAMPLES
+#
+# *content-orientation: landscape
+# *copy-count: 3
+# *default-input-tray: main
+# *default-medium: iso-a4
+# *default-printer-resolution: 600
+# *document-format: {PCL 5}
+# *plex: simplex
+# *xp-listfonts-modes: xp-list-internal-printer-fonts
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/attributes/job b/xc/programs/Xserver/XpConfig/C/print/attributes/job
new file mode 100644
index 000000000..808b030ab
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/attributes/job
@@ -0,0 +1,25 @@
+# $XConsortium: job /main/2 1996/12/04 10:45:23 rws $
+# Job DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "laser_1.job-priority: 1"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.job-priority: 1"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.job-priority: 1"
+
+*notification-profile: {}
+
+# EXAMPLES
+#
+# *job-name: Example Job Name
+# *notification-profile: {{event-report-job-completed} electronic-mail}
+# *xp-spooler-command-options: -onb
diff --git a/xc/programs/Xserver/XpConfig/C/print/attributes/printer b/xc/programs/Xserver/XpConfig/C/print/attributes/printer
new file mode 100644
index 000000000..df4e4446b
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/attributes/printer
@@ -0,0 +1,80 @@
+# $XConsortium: printer /main/2 1996/12/04 10:45:27 rws $
+# Printer DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "dj_1.document-formats-ready: {pcl 5}"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.document-formats-ready: {pcl 5}"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.document-formats-ready: {pcl 5}"
+
+
+*xp-ddx-identifier: XP-POSTSCRIPT
+
+
+# IMPORTANT EXAMPLES
+#
+# The following are examples of how a printer name is bound
+# to a model-config file and ddx driver.
+#
+# Warning: most X-Servers have a hard limit on the number of ddx
+# drivers (ie, screens) they can support at runtime (usually 3 or
+# 4). Whatever the number of printers, they cannot create a
+# dependency for more than the limit on ddx drivers. Assuming
+# "Xprinters" listed all four xp*pr printers below, X-Servers
+# with a limit of 3 would not work.
+#
+# xppspr.xp-model-identifier: HPDJ1600C
+# xppspr.xp-ddx-identifier: XP-POSTSCRIPT
+# xppspr.document-formats-ready: { PostScript 2 }
+#
+# xppclpr.xp-model-identifier: HPDJ1600C
+# xppclpr.xp-ddx-identifier: XP-PCL-COLOR
+# xppclpr.document-formats-ready: { PCL 5 }
+#
+# xppclmonopr.xp-model-identifier: HPDJ1600C
+# xppclmonopr.xp-ddx-identifier: XP-PCL-MONO
+# xppclmonopr.document-formats-ready: { PCL 5 }
+#
+# xprasterpr.xp-model-identifier: HPDJ1600C
+# xprasterpr.xp-ddx-identifier: XP-RASTER
+
+
+# MORE EXAMPLES of items often configured in this file
+#
+# *descriptor: This printer has not been given a name
+# *dt-pdm-command: dtpdm
+# *input-trays-medium: {top na-letter} {bottom iso-a4}
+# *xp-model-identifier: HPDJ1600C
+# *xp-spooler-command: /opt/mystuff/bin/mylp -p %printer-name% -c %copy-count% \
+# -j %job-name% -o %options%
+
+
+# USUALLY SET BY THE ddx driver
+#
+# *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+
+
+# USUALLY SET BY THE model-config FILE
+#
+# *document-formats-supported: {PCL 5}
+# *medium-source-sizes-supported: \
+# { top {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} } \
+# { bottom {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} }
+# *plexes-supported: simplex duplex tumble
+# *printer-model: Hewlett-Packard LaserJet IV
+# *printer-resolutions-supported: 300
+# *xp-ddx-identifier: XP-PCL-COLOR
+# *xp-embedded-formats-supported: {PCL 5} {HPGL 2}
+# *xp-listfonts-modes-supported: xp-list-internal-printer-fonts
+# *xp-raw-formats-supported: {PCL 5}
+# *xp-setup-proviso: xp-setup-optional
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/ddx-config/raster/pcl b/xc/programs/Xserver/XpConfig/C/print/ddx-config/raster/pcl
new file mode 100644
index 000000000..46e8e8e95
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/ddx-config/raster/pcl
@@ -0,0 +1,39 @@
+# $XConsortium: pcl /main/2 1996/12/04 10:45:32 rws $
+# This is the file which you should customize to include the printers that
+# will print through the raster driver. The early part of this file
+# specifies some commn useful defaults. You can override them when
+# you list your printers in the second part of this file. This file is
+# an X Resource file. To learn more about this file format, consult
+# the functional specification.
+
+# Note that the reference printer for CDEnext is the HP DeskJet 1600C.
+# This driver may work for other printers, but the reference printer
+# is the only officially supported printer.
+
+
+# DEFAULTS
+# ========
+
+# The attributes below apply to all printers unless the section below
+# specifies something different for the printer.
+
+# Default printer attributes
+# --------------------------
+# Printer attributes control the choices that users will see in the
+# setup dialog for those printers.
+
+# The attributes below apply to all printes unless the section below
+# specifies something different for the printer.
+
+*.media-ready: na-letter-white
+*.descriptor: Printer supported by CDEnext DtPrint System.
+*.printer-model: HPDJ1600C
+
+# Printer Specifics
+
+# Use this section to override the defaults listed above or to override the
+# printer attributes described in the model file.
+# The lines describing "laser" are just a sample to help you get started.
+
+# laser.printer-name: laser
+# laser.spooler-name: laser
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
new file mode 100644
index 000000000..09cc489a5
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
new file mode 100644
index 000000000..b21a9a2a8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
new file mode 100644
index 000000000..485b874c5
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
new file mode 100644
index 000000000..524934c71
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
new file mode 100644
index 000000000..2ef9bc52c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
new file mode 100644
index 000000000..3d69311ef
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
new file mode 100644
index 000000000..3833d4f54
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
new file mode 100644
index 000000000..289a95e5c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
new file mode 100644
index 000000000..a5984bed1
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
new file mode 100644
index 000000000..df27cd71e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
new file mode 100644
index 000000000..fb2b5a433
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
new file mode 100644
index 000000000..f0e58c435
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
new file mode 100644
index 000000000..8821ff155
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
new file mode 100644
index 000000000..e5980fc0e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
new file mode 100644
index 000000000..d9a151d7f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
new file mode 100644
index 000000000..d14fca56f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
new file mode 100644
index 000000000..7a341506f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
new file mode 100644
index 000000000..c20e39a21
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
new file mode 100644
index 000000000..4a4a35281
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
new file mode 100644
index 000000000..8d97d4339
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
new file mode 100644
index 000000000..19844c9c6
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
new file mode 100644
index 000000000..5415c3f44
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
new file mode 100644
index 000000000..038dfdb46
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
new file mode 100644
index 000000000..382a78575
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
new file mode 100644
index 000000000..1c7edf653
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
new file mode 100644
index 000000000..2f077f40f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
new file mode 100644
index 000000000..1ce190d51
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
new file mode 100644
index 000000000..45d6906ba
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
new file mode 100644
index 000000000..b991b5edb
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00081.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00081.pmf
new file mode 100644
index 000000000..1935a9f00
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00081.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00082.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00082.pmf
new file mode 100644
index 000000000..2000dc057
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00082.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00083.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00083.pmf
new file mode 100644
index 000000000..90f0e45a8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00083.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00084.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00084.pmf
new file mode 100644
index 000000000..52ba39b96
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00084.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00085.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00085.pmf
new file mode 100644
index 000000000..f5c9053af
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00085.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00086.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00086.pmf
new file mode 100644
index 000000000..b7586ca61
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00086.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00087.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00087.pmf
new file mode 100644
index 000000000..82f054999
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00087.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00088.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00088.pmf
new file mode 100644
index 000000000..591c96b59
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00088.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00089.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00089.pmf
new file mode 100644
index 000000000..c8160954a
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00089.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00090.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00090.pmf
new file mode 100644
index 000000000..895cfe26a
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00090.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00091.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00091.pmf
new file mode 100644
index 000000000..3bdcae4ba
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00091.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00092.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00092.pmf
new file mode 100644
index 000000000..a56d47504
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00092.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00093.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
new file mode 100644
index 000000000..c85f3b4de
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00094.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00094.pmf
new file mode 100644
index 000000000..875bf1df8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/9nb00094.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/README b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/README
new file mode 100644
index 000000000..a0dad28e2
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/README
@@ -0,0 +1,197 @@
+$XConsortium: README /main/2 1996/12/09 07:15:00 kaleb $
+
+This directory contains "printer metric files" for the X Print
+Server suitable for the DeskJet 1600C printer. The following
+*.pmf files were generated by the Hewlett-Packard Company.
+
+ 9nb00051.pmf
+ 9nb00052.pmf
+ 9nb00053.pmf
+ 9nb00054.pmf
+ 9nb00055.pmf
+ 9nb00056.pmf
+ 9nb00057.pmf
+ 9nb00058.pmf
+ 9nb00059.pmf
+ 9nb00060.pmf
+ 9nb00061.pmf
+ 9nb00062.pmf
+ 9nb00063.pmf
+ 9nb00064.pmf
+ 9nb00065.pmf
+ 9nb00066.pmf
+ 9nb00067.pmf
+ 9nb00068.pmf
+ 9nb00069.pmf
+ 9nb00070.pmf
+ 9nb00071.pmf
+ 9nb00072.pmf
+ 9nb00073.pmf
+ 9nb00074.pmf
+ 9nb00075.pmf
+ 9nb00076.pmf
+ 9nb00077.pmf
+ 9nb00079.pmf
+ 9nb00080.pmf
+ 9nb00081.pmf
+ 9nb00082.pmf
+ 9nb00083.pmf
+ 9nb00084.pmf
+ 9nb00085.pmf
+ 9nb00086.pmf
+ 9nb00087.pmf
+ 9nb00088.pmf
+ 9nb00089.pmf
+ 9nb00090.pmf
+ 9nb00091.pmf
+ 9nb00092.pmf
+ 9nb00093.pmf
+ 9nb00094.pmf
+ lpr0ye1a.pmf
+
+For reasons of not supporting iso8859.1 and hp-roman8, the following
+DeskJet 1600C printer fonts were not converted to *.pmf files.
+
+ 9nb00078.pmf
+ 9nb00095.pmf
+ lpr0ylga.pmf
+ lpr0ypca.pmf
+ lpr0ypda.pmf
+ lpr0ypma.pmf
+ lpr0yr8a.pmf
+
+Output from the conversion utility is as follows:
+
+ Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf
+ -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf
+ -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf
+ -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf
+ -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf
+ -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf
+ -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf
+ -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf
+ -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf
+ -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf
+ -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf
+ -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf
+ -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf
+ -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf
+ -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf
+ -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf
+ -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf
+ -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf
+ -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf
+ -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf
+ -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf
+ -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf
+ -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf
+ -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf
+ -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf
+ -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf
+ -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf
+ -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf
+ -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf
+ -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf
+ -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf
+ -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf
+ -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1
+ ------------------------------------
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
new file mode 100644
index 000000000..1499aa845
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.dir b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.dir
new file mode 100644
index 000000000..da702ccc1
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.dir
@@ -0,0 +1,45 @@
+44
+lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1
+9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1
+9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1
+9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1
+9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1
+9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1
+9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1
+9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1
+9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1
+9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1
+9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1
+9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1
+9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1
+9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1
+9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1
+9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1
+9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1
+9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1
+9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1
+9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1
+9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1
+9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1
+9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1
+9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1
+9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1
+9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf
new file mode 100644
index 000000000..483748893
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/model-config b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/model-config
new file mode 100644
index 000000000..40a5ea06c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPDJ1600C/model-config
@@ -0,0 +1,44 @@
+# $XConsortium: model-config /main/3 1996/12/09 07:10:16 kaleb $
+# This is the configuration file for the HP DeskJet 1600C printer.
+#
+# The CDEnext SI supports two 1600C drivers XP-PCL-MONO and
+# XP-PCL-COLOR, which work with this configuration file.
+#
+# Attribute IDs must be qualified using either the printer-model
+# identifier or an asterisk ('*'). For example, if "HPDJ1600C" is the
+# printer-model, then to initialize the 'plexes-supported' attribute
+# to 'simplex', use: "HPDJ1600C.plexes-supported: simplex". For the
+# asterisk, use: "*.plexes-supported: simplex". If the same attribute
+# is specified using each method, the printer-model qualified entry
+# takes precedence.
+
+HPDJ1600C.printer-model: "Hewlett-Packard DeskJet 1600C"
+HPDJ1600C.printer-resolutions-supported: 300
+HPDJ1600C.content-orientations-supported: portrait landscape
+HPDJ1600C.document-formats-supported: {PCL 5} {PostScript 2}
+HPDJ1600C.plexes-supported: simplex duplex
+HPDJ1600C.xp-ddx-identifier: XP-PCL-COLOR
+HPDJ1600C.xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
+HPDJ1600C.xp-setup-proviso: setup-optional
+
+# 1/4" unprintable margins
+HPDJ1600C.medium-source-sizes-supported:\
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {executive FALSE {6.35 177.75 6.35 260.35}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-japanese-postcard FALSE {6 94 6 142 }}\
+ {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
+}
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00051.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00051.pmf
new file mode 100644
index 000000000..09cc489a5
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00051.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00052.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00052.pmf
new file mode 100644
index 000000000..b21a9a2a8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00052.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00053.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00053.pmf
new file mode 100644
index 000000000..485b874c5
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00053.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00054.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00054.pmf
new file mode 100644
index 000000000..524934c71
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00054.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00055.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00055.pmf
new file mode 100644
index 000000000..2ef9bc52c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00055.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00056.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00056.pmf
new file mode 100644
index 000000000..3d69311ef
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00056.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00057.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00057.pmf
new file mode 100644
index 000000000..3833d4f54
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00057.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00058.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00058.pmf
new file mode 100644
index 000000000..289a95e5c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00058.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00059.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00059.pmf
new file mode 100644
index 000000000..a5984bed1
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00059.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00060.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00060.pmf
new file mode 100644
index 000000000..df27cd71e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00060.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00061.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00061.pmf
new file mode 100644
index 000000000..fb2b5a433
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00061.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00062.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00062.pmf
new file mode 100644
index 000000000..f0e58c435
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00062.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00063.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00063.pmf
new file mode 100644
index 000000000..8821ff155
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00063.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00064.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00064.pmf
new file mode 100644
index 000000000..e5980fc0e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00064.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00065.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00065.pmf
new file mode 100644
index 000000000..d9a151d7f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00065.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00066.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00066.pmf
new file mode 100644
index 000000000..d14fca56f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00066.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00067.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00067.pmf
new file mode 100644
index 000000000..7a341506f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00067.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00068.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00068.pmf
new file mode 100644
index 000000000..c20e39a21
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00068.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00069.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00069.pmf
new file mode 100644
index 000000000..4a4a35281
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00069.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00070.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00070.pmf
new file mode 100644
index 000000000..8d97d4339
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00070.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00071.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00071.pmf
new file mode 100644
index 000000000..19844c9c6
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00071.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00072.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00072.pmf
new file mode 100644
index 000000000..5415c3f44
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00072.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00073.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00073.pmf
new file mode 100644
index 000000000..038dfdb46
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00073.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00074.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00074.pmf
new file mode 100644
index 000000000..382a78575
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00074.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00075.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00075.pmf
new file mode 100644
index 000000000..1c7edf653
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00075.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00076.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00076.pmf
new file mode 100644
index 000000000..2f077f40f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00076.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00077.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00077.pmf
new file mode 100644
index 000000000..1ce190d51
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00077.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00079.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00079.pmf
new file mode 100644
index 000000000..45d6906ba
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00079.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00080.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00080.pmf
new file mode 100644
index 000000000..b991b5edb
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00080.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00081.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00081.pmf
new file mode 100644
index 000000000..1935a9f00
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00081.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00082.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00082.pmf
new file mode 100644
index 000000000..2000dc057
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00082.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00083.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00083.pmf
new file mode 100644
index 000000000..90f0e45a8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00083.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00084.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00084.pmf
new file mode 100644
index 000000000..52ba39b96
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00084.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00085.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00085.pmf
new file mode 100644
index 000000000..f5c9053af
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00085.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00086.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00086.pmf
new file mode 100644
index 000000000..b7586ca61
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00086.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00087.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00087.pmf
new file mode 100644
index 000000000..82f054999
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00087.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00088.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00088.pmf
new file mode 100644
index 000000000..591c96b59
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00088.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00089.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00089.pmf
new file mode 100644
index 000000000..c8160954a
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00089.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00090.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00090.pmf
new file mode 100644
index 000000000..895cfe26a
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00090.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00091.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00091.pmf
new file mode 100644
index 000000000..3bdcae4ba
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00091.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00092.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00092.pmf
new file mode 100644
index 000000000..a56d47504
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00092.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00093.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00093.pmf
new file mode 100644
index 000000000..c85f3b4de
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00093.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00094.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00094.pmf
new file mode 100644
index 000000000..875bf1df8
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/9nb00094.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/README b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/README
new file mode 100644
index 000000000..5ce380237
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/README
@@ -0,0 +1,203 @@
+$XConsortium: README /main/2 1996/12/09 07:15:18 kaleb $
+
+This directory contains "printer metric files" for the X Print
+Server suitable for the LaserJet 4 family of printers - 4, 4L,
+4M, 4ML, 4MP, 4P, 4Si, 4Si-MX. The following *.pmf files were
+generated by the Hewlett-Packard Company.
+
+ 9nb00051.pmf
+ 9nb00052.pmf
+ 9nb00053.pmf
+ 9nb00054.pmf
+ 9nb00055.pmf
+ * 9nb00056.pmf
+ * 9nb00057.pmf
+ * 9nb00058.pmf
+ * 9nb00059.pmf
+ * 9nb00060.pmf
+ 9nb00061.pmf
+ 9nb00062.pmf
+ 9nb00063.pmf
+ 9nb00064.pmf
+ * 9nb00065.pmf
+ * 9nb00066.pmf
+ * 9nb00067.pmf
+ * 9nb00068.pmf
+ 9nb00069.pmf
+ 9nb00070.pmf
+ 9nb00071.pmf
+ * 9nb00072.pmf
+ * 9nb00073.pmf
+ * 9nb00074.pmf
+ * 9nb00075.pmf
+ * 9nb00076.pmf
+ 9nb00077.pmf
+ * 9nb00079.pmf
+ * 9nb00080.pmf
+ * 9nb00081.pmf
+ * 9nb00082.pmf
+ 9nb00083.pmf
+ 9nb00084.pmf
+ 9nb00085.pmf
+ 9nb00086.pmf
+ 9nb00087.pmf
+ 9nb00088.pmf
+ 9nb00089.pmf
+ 9nb00090.pmf
+ 9nb00091.pmf
+ 9nb00092.pmf
+ 9nb00093.pmf
+ 9nb00094.pmf
+ lpr0ye1a.pmf
+
+
+ * note - the marked fonts are NOT supported by the 4L printer. If
+ making extensive use of the 4L, you may want to create a special
+ 4L model-config area and exclude these fonts.
+
+For reasons of not supporting iso8859.1 and hp-roman8, the following
+Laserjet 4 printer fonts were not converted to *.pmf files.
+
+ 9nb00078.pmf
+ 9nb00095.pmf
+ lpr0ylga.pmf
+ lpr0ypca.pmf
+ lpr0ypda.pmf
+ lpr0ypma.pmf
+ lpr0yr8a.pmf
+
+Output from the conversion utility is as follows:
+
+ Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf
+ -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf
+ -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf
+ -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf
+ -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf
+ -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf
+ -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf
+ -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf
+ -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf
+ -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf
+ -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf
+ -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf
+ -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf
+ -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf
+ -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf
+ -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf
+ -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf
+ -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf
+ -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf
+ -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf
+ -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf
+ -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf
+ -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf
+ -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf
+ -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf
+ -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf
+ -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf
+ -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf
+ -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf
+ -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf
+ -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf
+ -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf
+ -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1
+ ------------------------------------
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
new file mode 100644
index 000000000..1499aa845
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.dir b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.dir
new file mode 100644
index 000000000..da702ccc1
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/fonts.dir
@@ -0,0 +1,45 @@
+44
+lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1
+9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1
+9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1
+9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1
+9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1
+9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1
+9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1
+9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1
+9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1
+9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1
+9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1
+9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1
+9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1
+9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1
+9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1
+9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1
+9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1
+9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1
+9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1
+9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1
+9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1
+9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1
+9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1
+9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1
+9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1
+9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf
new file mode 100644
index 000000000..483748893
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/model-config b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/model-config
new file mode 100644
index 000000000..6f9b5bc46
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/HPLJ4family/model-config
@@ -0,0 +1,44 @@
+# $XConsortium: model-config /main/2 1996/12/09 07:10:35 kaleb $
+# This is the configuration file for the HP LaserJet 4 Printers.
+#
+# Though not a deliverable for the CDEnext SI, the XP-PCL-MONO
+# driver should be able to support the LaserJet 4 printers.
+#
+# Attribute IDs must be qualified using either the printer-model
+# identifier or an asterisk ('*'). For example, if "HPLJ4family" is the
+# printer-model, then to initialize the 'plexes-supported' attribute
+# to 'simplex', use: "HPLJ4family.plexes-supported: simplex". For the
+# asterisk, use: "*.plexes-supported: simplex". If the same attribute
+# is specified using each method, the printer-model qualified entry
+# takes precedence.
+
+HPLJ4family.printer-model: "Hewlett-Packard LaserJet 4 Series"
+HPLJ4family.printer-resolutions-supported: 300 600
+HPLJ4family.content-orientations-supported: portrait landscape
+HPLJ4family.document-formats-supported: {PCL 5} {PostScript 2}
+HPLJ4family.plexes-supported: simplex duplex
+HPLJ4family.xp-ddx-identifier: XP-PCL-MONO
+HPLJ4family.xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
+HPLJ4family.xp-setup-proviso: setup-optional
+
+# 1/4" unprintable margins
+HPLJ4family.medium-source-sizes-supported:\
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {executive FALSE {6.35 177.75 6.35 260.35}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-japanese-postcard FALSE {6 94 6 142 }}\
+ {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
+}
+
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Book.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Book.pmf
new file mode 100644
index 000000000..c86e5913e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Book.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-BookOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-BookOblique.pmf
new file mode 100644
index 000000000..f816b4e7d
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-BookOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Demi.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Demi.pmf
new file mode 100644
index 000000000..22260596e
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-Demi.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-DemiOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-DemiOblique.pmf
new file mode 100644
index 000000000..6b0a9083f
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/AvantGarde-DemiOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Bold.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Bold.pmf
new file mode 100644
index 000000000..7ab985197
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Bold.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-BoldOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-BoldOblique.pmf
new file mode 100644
index 000000000..77643aed4
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-BoldOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Oblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Oblique.pmf
new file mode 100644
index 000000000..ce73bc27b
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier-Oblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier.pmf
new file mode 100644
index 000000000..4712b1967
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Courier.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Bold.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Bold.pmf
new file mode 100644
index 000000000..6902ef4a9
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Bold.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-BoldOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-BoldOblique.pmf
new file mode 100644
index 000000000..d0571d91a
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-BoldOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Oblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Oblique.pmf
new file mode 100644
index 000000000..4dba3c4c0
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica-Oblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica.pmf
new file mode 100644
index 000000000..234b98f77
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Helvetica.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Book.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Book.pmf
new file mode 100644
index 000000000..41a3223a3
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Book.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-BookOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-BookOblique.pmf
new file mode 100644
index 000000000..41c012cdb
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-BookOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Demi.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Demi.pmf
new file mode 100644
index 000000000..9502719f2
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-Demi.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-DemiOblique.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-DemiOblique.pmf
new file mode 100644
index 000000000..05e9f79f4
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/LubalinGraph-DemiOblique.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Bold.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Bold.pmf
new file mode 100644
index 000000000..7d49a9918
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Bold.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-BoldItalic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-BoldItalic.pmf
new file mode 100644
index 000000000..9e2ee5ba5
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-BoldItalic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Italic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Italic.pmf
new file mode 100644
index 000000000..6bef4bea0
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Italic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Roman.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Roman.pmf
new file mode 100644
index 000000000..5244c5903
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/NewCenturySchlbk-Roman.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Demi.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Demi.pmf
new file mode 100644
index 000000000..7c4ee6893
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Demi.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-DemiItalic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-DemiItalic.pmf
new file mode 100644
index 000000000..3bd761f55
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-DemiItalic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Light.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Light.pmf
new file mode 100644
index 000000000..52c87124b
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-Light.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-LightItalic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-LightItalic.pmf
new file mode 100644
index 000000000..1022a46e9
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Souvenir-LightItalic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Symbol.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Symbol.pmf
new file mode 100644
index 000000000..f42ec8f16
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Symbol.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Bold.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Bold.pmf
new file mode 100644
index 000000000..1dea0e23c
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Bold.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-BoldItalic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-BoldItalic.pmf
new file mode 100644
index 000000000..9e6e54e64
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-BoldItalic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Italic.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Italic.pmf
new file mode 100644
index 000000000..35e637513
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Italic.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Roman.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Roman.pmf
new file mode 100644
index 000000000..2fbaf7601
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/Times-Roman.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/ZapfDingbats.pmf b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/ZapfDingbats.pmf
new file mode 100644
index 000000000..24bd46ff1
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/ZapfDingbats.pmf
Binary files differ
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/fonts.dir b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/fonts.dir
new file mode 100644
index 000000000..54d499e45
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/fonts/fonts.dir
@@ -0,0 +1,14 @@
+13
+Courier-Bold.pmf -adobe-courier-bold-r-normal--199-120-1200-1200-p-1190-iso8859-1
+Courier-BoldOblique.pmf -adobe-courier-bold-i-normal--199-120-1200-1200-p-1190-iso8859-1
+Courier-Oblique.pmf -adobe-courier-medium-i-normal--199-120-1200-1200-p-1190-iso8859-1
+Courier.pmf -adobe-courier-medium-r-normal--199-120-1200-1200-p-1190-iso8859-1
+Helvetica-Bold.pmf -adobe-helvetica-bold-r-normal--199-120-1200-1200-p-1123-iso8859-1
+Helvetica-BoldOblique.pmf -adobe-helvetica-bold-i-normal--199-120-1200-1200-p-1123-iso8859-1
+Helvetica-Oblique.pmf -adobe-helvetica-medium-i-normal--199-120-1200-1200-p-1085-iso8859-1
+Helvetica.pmf -adobe-helvetica-medium-r-normal--199-120-1200-1200-p-1085-iso8859-1
+Symbol.pmf -adobe-symbol-medium-r-normal--199-120-1200-1200-p-1166-adobe-fontspecific
+Times-Bold.pmf -adobe-times-bold-r-normal--199-120-1200-1200-p-1076-iso8859-1
+Times-BoldItalic.pmf -adobe-times-bold-i-normal--199-120-1200-1200-p-1044-iso8859-1
+Times-Italic.pmf -adobe-times-medium-i-normal--199-120-1200-1200-p-1025-iso8859-1
+Times-Roman.pmf -adobe-times-medium-r-normal--199-120-1200-1200-p-1030-iso8859-1
diff --git a/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/model-config b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/model-config
new file mode 100644
index 000000000..ff7f0e2fa
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/C/print/models/SPSPARC2/model-config
@@ -0,0 +1,13 @@
+# $XConsortium: model-config /main/2 1996/12/09 07:10:48 kaleb $
+SPSPARC2.printer-model: "SunPics SPARCprinter II"
+SPSPARC2.printer-resolutions-supported: 300
+SPSPARC2.content-orientations-supported: portrait landscape
+SPSPARC2.document-formats-supported: {PostScript 2}
+SPSPARC2.plexes-supported: simplex
+SPSPARC2.xp-ddx-identifier: XP-POSTSCRIPT
+SPSPARC2.xp-embedded-formats-supported: { PostScript 2 }
+*xp-setup-proviso: setup-optional
+SPSPARC2.medium-source-sizes-supported: \
+ { '' {na-letter FALSE {6.35 209.55 6.35 273.05}} \
+ {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}}
diff --git a/xc/programs/Xserver/XpConfig/README b/xc/programs/Xserver/XpConfig/README
new file mode 100644
index 000000000..689d99333
--- /dev/null
+++ b/xc/programs/Xserver/XpConfig/README
@@ -0,0 +1,318 @@
+
+ --------------------------------------
+ The X Print Service - The Basics
+ --------------------------------------
+
+Index
+ - 1.0 X Print Service Overview
+
+ - 2.0 How the X Print Service Works
+
+ - 3.0 Using the X Print Service
+ - 3.1 X Print Server Configuration
+ - 3.2 Starting the X Print Service
+ - 3.3 Configuring the environment
+ - 3.4 General End-User Sequence
+
+
+1.0 X Print Service Overview
+=============================
+
+The "X Print Service" technology allows X rendering to devices such as
+printers and fax. Most of the service is available in the X11
+technology stack as Xp, with the remainder in the CDE technology stack
+as DtPrint. Modifications have also been made to the Motif technology
+stack to support Xp and DtPrint.
+
+The Xp portion consists of:
+ * Xp Extension for the X-Server (included in the X-Server Xprt)
+ * Xp Extension API for the client side (libXp)
+ * PCL ddx driver that converts core X to native PCL
+ * Postscript ddx driver that converts core X to native Postscript
+ * Raster ddx driver that generates xwd rasters which can be
+ converted to PCL or Postscript rasters
+
+The DtPrint portion consists of:
+ * A collection of print GUIs (libDtPrint)
+ * A Print Dialog Manager that can assist a client in
+ setting printing options (dtpdm, dtpdmd)
+
+From an X clients perspective, it can attach to one of two nearly
+identical X-Servers, a "Video" X-Server, and a "Print" X-Server
+which has the additional Xp capability but otherwise looks and
+behaves the same.
+
+
+
+2.0 How the X Print Service Works
+==================================
+
+The X Print Service expands on the traditional X-Server and Xlib world
+in four ways.
+
+1. Most obvious is the use of "print ddx drivers" instead of
+ "video ddx drivers". While a video ddx driver modifies pixels
+ in a video frame buffer, a print ddx driver generates "page
+ description language (PDL)" output such as PCL or Postscript.
+
+ Once a print ddx driver generates PDL output, it can be sent to
+ a spooler such as lp(1) or retrieved by the client.
+
+ Though not currently done, a single X-Server can support both
+ print and video ddx drivers.
+
+2. Since printers support "paged" output, unlike video, a portion
+ of the Xp Extension supports APIs to delineate printed output.
+ For example, XpStartPage and XpEndPage tell the X-Server where
+ a physical page starts and ends in an otherwise continuous
+ stream of X rendering primitives. Likewise, XpStartJob and
+ XpEndJob determine when a collection of pages starts and ends.
+ XpEndJob typically causes the generated PDL to be submitted to
+ a spooler, such as lp(1).
+
+3. Since printers have extensive capabilities, another portion of
+ the Xp Extension supports APIs to manipulate "print contexts".
+
+ Once a printer is selected using the Xp Extension API, a print
+ context to represent it can be created. A print context
+ embodies the printer selected - it contains the printer's
+ default capabilities, selectable range of capabilities,
+ printer state, and generated output. Some "attributes" within
+ the print context can be modified by the user, and the
+ X-Server and print ddx driver will react accordingly. For
+ example, the attribute "content-orientation" can be set to
+ "landscape" or "portrait".
+
+4. Since printers can have "built in" fonts, the Xp Extension in
+ the X-Server works with the print ddx drivers to make
+ available (for printing only) additional fonts on a per print
+ context basis.
+
+ When a print context is created and set for a given printer,
+ the X font calls may be able to access additional printer
+ fonts. To do this (typically), the X-Server must have access
+ to "printer metric files" (.pmf) that describe at minimum the
+ metrics of the built in fonts.
+
+
+
+3.0 Using the X Print Service
+==============================
+
+There are three tasks to start the X Print Service: 1) configuring the
+X Print Server, 2) starting the X Print Service, 3) configuring the user
+session so that clients can find the running X Print Service.
+
+The tasks are described in detail below.
+
+
+3.1 X Print Server Configuration
+---------------------------------
+
+The X Print Server (Xprt) can read a number of configuration files which
+control its behavior and support for printers. Each vendor platform has
+a default location for this information. Xprt can also read the
+environment variable XPCONFIGDIR to locate alternate configuration
+directories. Common settings include:
+
+ * export XPCONFIGDIR=/X11/lib/X11/XpConfig/
+
+ * export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/
+
+Xprt has many built-in defaults, and lacking any configuration files,
+will immediately try to support all printers visible via lpstat(1).
+
+In order of importance for configuration by a system administrator, the
+configuration files for a "C" locale are as follows.
+
+ ${XPCONFIGDIR}/C/print/Xprinters
+
+ `Xprinters' is the top most configuration file. It tells
+ Xprt which specific printer names (e.g. mylaser) should
+ be supported, and whether lpstat(1) or other commands
+ should be used to automatically supplement the list of
+ printers.
+
+ ${XPCONFIGDIR}/C/print/attributes/printer
+
+ The `printer' file maps printer names to model
+ configurations (see `model-config' below). For example,
+ "mylaser" could be mapped to a "HPDJ1600C", and all other
+ arbitrary printers could be mapped to a default, such as
+ "HPLJ4SI". When depending on lpstat(1) in the Xprinters
+ file, setting up defaults in `printer' becomes all the
+ more important.
+
+ ${XPCONFIGDIR}/C/print/attributes/document
+
+ The `document' file specifies the initial document values
+ for any print jobs. For example, which paper tray to
+ use, what default resolution, etc.
+
+ ${XPCONFIGDIR}/C/print/attributes/job
+
+ The `job' file specifies the initial job values for any
+ print jobs. For example, "notification-profile" can be
+ set so that when a print job is successfully sent to a
+ printer, e-mail is sent to the user.
+
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/model-config
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/fonts.dir
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
+
+ The `model-config' file has attributes that describe the
+ printer model's capabilities and default settings.
+ Printer model fonts may also be present. The model-config
+ file also identifies the print ddx driver to be used.
+
+ For each printer model supported, a complete hierarchy of
+ files should exist. In most cases, these files do not
+ need to be modified.
+
+ ${XPCONFIGDIR}/C/print/ddx-config/raster/pcl
+ ${XPCONFIGDIR}/C/print/ddx-config/raster/postscript
+
+ The print ddx drivers can have highly specific
+ configuration files to control their behavior. In most
+ cases, these files do not need to be modified.
+
+
+3.2 Starting the X Print Service
+---------------------------------
+
+The summary checklist for starting the X Print Service is as follows:
+
+1. Choose an execution model for the X Print Service. The X
+ Print Service can be run on a per-user session basis, per
+ machine basis, or can be run on a few machines globally
+ available to a number of users.
+
+2. If print jobs are to be submitted to a spooler (almost always
+ the case), make sure all needed printers are available to the
+ spooler subsystem (most often lp(1)) on the same machine
+ running the X Print Service.
+
+3. Configure the X Print Server. See ``X Print Server
+ Configuration''.
+
+4. Depending on #1, start the X Print Server process "Xprt", and
+ then the Print Dialog Manager Daemon process "dtpdmd" at the
+ appropriate times.
+
+The details are described below.
+
+Because the X Print Service is based on X, it can be easily distributed.
+The most significant factors in which execution model to choose will be
+driven by:
+
+ * how many printers will be accessable through the printer
+ subsystem on any given machine. A system administrator may
+ choose to cluster printers on a few given machines, or
+ scatter them across an organization and possibly make
+ extensive use of remote spoolers to make them globally
+ available.
+
+ * how many machines will need a copy of the X Print Server
+ configuration files. The files have been architected so
+ that one super-set version of them can be maintained and
+ distributed (e.g. via NFS), and a per-machine or per-user
+ version of the `Xprinters' is all that is needed to have the
+ appropriate information in them utilized or ignored.
+
+ * how many users can demand services from a given X Print
+ Service.
+
+With the above in mind, some obvious execution models include:
+
+ * Global - in this model, the system administrator is choosing
+ to run the X Print Service on a *few* select machines with
+ appropriate printers configured, and allow clients access to
+ the global resource. This can centralize the administration
+ of printers and configuration files, but may have to be
+ monitored for performance loading.
+
+ Startup would likely be done by boot-up scripts.
+
+ * Per-machine - every machine with potential X Print Service
+ users would run the service. Printer and configuration file
+ administration is decentralized, and usage would be limited
+ to the users on the machine.
+
+ Startup would likely be done by boot-up scripts.
+
+ * Per-user session - every user would run an entire X Print
+ Service for themselves. In the future, the Video X Server
+ normally started may contain Print X Server capability, so
+ this model becomes very natural.
+
+ Startup would likely be done at session login or by
+ launching actions or processes manually once the user
+ logs in. Note: the dtpdmd must be started after Xprt.
+
+Starting of the processes is straight forward. In strict order:
+
+ [machineA] % Xprt [-XpFile <Xprinters file>] [:dispNum] &
+
+ Note that Xprt will look for configuration files in either
+ a default location or where XPCONFIGDIR points.
+
+ -XpFile specifies an alternate `Xprinters' file, rather
+ than the default one or `${XPCONFIGDIR}/C/print/Xprinters'.
+
+ [machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log] &
+
+ The dtpdmd will maintain an X-Selection on the X-Server,
+ and will start dtpdm's as required to service requests.
+
+In all but the per-user session model, the machine running the dtpdmd
+(thus dtpdm's) will need display authorization to the users video
+display.
+
+
+
+3.3 Configuring the environment
+--------------------------------
+
+Once a X Print Server and dtpdmd have been started -- many of them
+in some cases -- clients will need to find and use them. There are
+two mechanisms that allow clients to discover X Print Servers and
+printers.
+
+ * "X Print Specifier" - assuming usage of the DtPrint print
+ dialogs, the following notation is understood:
+
+ printer_name@machine[:dispNum]
+
+ For example:
+
+ colorlj7@printhub:2
+
+ In the above example, the X Print Server running at `printhub:2'
+ is assumed to support the printer named `colorlj7'.
+
+ * "XPSERVERLIST" - assuming usage of the DtPrint print dialogs,
+ the environment variable "XPSERVERLIST" can contain a list
+ of X Print Servers. For example:
+
+ XPSERVERLIST="printhub:2 printhub:3 otherdept:0"
+
+ Then in the dialogs, only a printer name needs to be entered.
+ The dialog will then search the X Print Servers in XPSERVERLIST
+ for a server than supports the printer, and then establish
+ contact.
+
+3.4 General End-User Sequence
+------------------------------
+
+From most CDEnext applications, printing is accomplished by bringing
+down the <File> menu and selecting <Print...>. This will result in
+the DtPrintSetupBox dialog, which will request the name of a printer,
+and offer limited capability to configure print options (e.g. number
+of copies). If the user wishes, they can select <Setup...>, which
+will start a dtpdm capable of modifying additional print options.
+Finally, the user should select <Print>.
+
+
+
+$XConsortium: README /main/1 1996/12/15 21:53:55 rws $
diff --git a/xc/programs/Xserver/Xprint/AttrValid.c b/xc/programs/Xserver/Xprint/AttrValid.c
new file mode 100644
index 000000000..4fcf4c1a9
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/AttrValid.c
@@ -0,0 +1,681 @@
+/* $XConsortium: AttrValid.c /main/2 1996/11/16 15:23:21 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+#include <scrnintstr.h>
+
+#define _XP_PRINT_SERVER_
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#include "AttrValid.h"
+
+/*
+ * default medium-source-sizes supported = na-letter w/.25" margins
+ */
+static XpOidMediumDiscreteSize DefaultMediumSize = {
+ xpoid_val_medium_size_na_letter, xFalse, {6.35, 209.55, 6.35, 273.05}
+};
+static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
+ &DefaultMediumSize, 1
+};
+static XpOidMediumSourceSize DefaultMediumSourceSize = {
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
+};
+static XpOidMediumSS DefaultMediumSS = {
+ &DefaultMediumSourceSize, 1
+};
+
+/*
+ * if 'valid_oid_list' is NULL any oid found is considered valid
+ */
+XpOid
+XpGetOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list)
+{
+ XpOid value_oid;
+
+ value_oid = XpOidFromString(XpGetStringAttr(pContext, pool, oid));
+ if((const XpOidList*)NULL == valid_oid_list
+ ||
+ XpOidListHasOid(valid_oid_list, value_oid))
+ {
+ return value_oid;
+ }
+ else
+ {
+ return xpoid_none;
+ }
+}
+
+void
+XpPutOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ XpOid value_oid)
+{
+ XpPutStringAttr(pContext, pool, oid, XpOidString(value_oid));
+}
+
+void
+XpValidateOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ XpOid default_oid)
+{
+ XpOid value_oid;
+ value_oid = XpGetOidAttr(pContext, pool, oid, valid_oids);
+ XpPutOidAttr(pContext, pool, oid,
+ value_oid == xpoid_none ? default_oid : value_oid);
+}
+
+/*
+ * if 'valid_card_list' is NULL any cardinal found is considered valid
+ */
+unsigned long
+XpGetCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list)
+{
+ unsigned long value_card;
+
+ if(XpOidParseUnsignedValue(XpGetStringAttr(pContext, pool, oid),
+ (const char**)NULL,
+ &value_card))
+ {
+ if((const XpOidCardList*)NULL == valid_card_list
+ ||
+ XpOidCardListHasCard(valid_card_list, value_card))
+ {
+ return value_card;
+ }
+ }
+ return 0;
+}
+
+void
+XpPutCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ unsigned long value_card)
+{
+ if(value_card > 0)
+ {
+ char value_out[16];
+ sprintf(value_out, "%lu", value_card);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ }
+ else
+ XpPutStringAttr(pContext, pool, oid, (const char*)NULL);
+}
+
+void
+XpValidateCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ unsigned long default_card)
+{
+ unsigned long value_card;
+ value_card = XpGetCardAttr(pContext, pool, oid, valid_cards);
+ XpPutCardAttr(pContext, pool, oid,
+ value_card == 0 ? default_card : value_card);
+}
+
+XpOidList*
+XpGetListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list)
+{
+ return XpOidListNew(XpGetStringAttr(pContext, pool, oid), valid_oid_list);
+}
+
+void
+XpPutListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* list)
+{
+ char* value_out;
+
+ value_out = XpOidListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ const XpOidList* default_oids)
+{
+ XpOidList* list = XpGetListAttr(pContext, pool, oid, valid_oids);
+ if(XpOidListCount(list) == 0)
+ XpPutListAttr(pContext, pool, oid, default_oids);
+ else
+ XpPutListAttr(pContext, pool, oid, list);
+ XpOidListDelete(list);
+}
+
+XpOidCardList*
+XpGetCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list)
+{
+ return XpOidCardListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_card_list);
+}
+
+void
+XpPutCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* list)
+{
+ char* value_out;
+
+ value_out = XpOidCardListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ const XpOidCardList* default_cards)
+{
+ XpOidCardList* list = XpGetCardListAttr(pContext, pool, oid, valid_cards);
+ if(XpOidCardListCount(list) == 0 && (XpOidCardList*)NULL != default_cards)
+ XpPutCardListAttr(pContext, pool, oid, default_cards);
+ else
+ XpPutCardListAttr(pContext, pool, oid, list);
+ XpOidCardListDelete(list);
+}
+
+XpOidDocFmtList*
+XpGetDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmt_list)
+{
+ return XpOidDocFmtListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_fmt_list);
+}
+
+void
+XpPutDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* list)
+{
+ char* value_out;
+
+ value_out = XpOidDocFmtListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmts,
+ const XpOidDocFmtList* default_fmts)
+{
+ XpOidDocFmtList* list;
+
+ list = XpGetDocFmtListAttr(pContext, pool, oid, valid_fmts);
+ if(XpOidDocFmtListCount(list) == 0
+ &&
+ (XpOidDocFmtList*)NULL != default_fmts)
+ {
+ XpPutDocFmtListAttr(pContext, pool, oid, default_fmts);
+ }
+ else
+ {
+ XpPutDocFmtListAttr(pContext, pool, oid, list);
+ }
+ XpOidDocFmtListDelete(list);
+}
+
+XpOidMediumSS*
+XpGetMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes)
+{
+ return XpOidMediumSSNew(XpGetStringAttr(pContext, pool, oid),
+ valid_trays, valid_sizes);
+}
+
+void
+XpPutMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidMediumSS* msss)
+{
+ char* value_out;
+
+ value_out = XpOidMediumSSString(msss);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+const XpOidMediumSS*
+XpGetDefaultMediumSS()
+{
+ return &DefaultMediumSS;
+}
+
+XpOidTrayMediumList*
+XpGetTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss)
+{
+ return XpOidTrayMediumListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_trays, msss);
+}
+
+void
+XpPutTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidTrayMediumList* tm)
+{
+ char* value_out;
+
+ value_out = XpOidTrayMediumListString(tm);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes)
+{
+ const XpOidMediumSS* msss;
+ XpOidMediumSS* pool_msss;
+ XpOidTrayMediumList* tm;
+
+ pool_msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ valid_trays, valid_sizes);
+ if(0 == XpOidMediumSSCount(pool_msss))
+ msss = XpGetDefaultMediumSS();
+ else
+ msss = pool_msss;
+ XpPutMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported, msss);
+
+ tm = XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ valid_trays, msss);
+ XpPutTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium, tm);
+
+ XpOidMediumSSDelete(pool_msss);
+ XpOidTrayMediumListDelete(tm);
+}
+
+
+void
+XpValidatePrinterPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * content-orientations-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ vpr->valid_content_orientations_supported,
+ vpr->default_content_orientations_supported);
+ /*
+ * document-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_formats_supported,
+ vpr->valid_document_formats_supported,
+ vpr->default_document_formats_supported);
+ /*
+ * plexes-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported,
+ vpr->valid_plexes_supported,
+ vpr->default_plexes_supported);
+ /*
+ * printer-resolutions-supported
+ */
+ XpValidateCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ vpr->valid_printer_resolutions_supported,
+ vpr->default_printer_resolutions_supported);
+ /*
+ * xp-embedded-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_embedded_formats_supported,
+ vpr->valid_xp_embedded_formats_supported,
+ vpr->default_xp_embedded_formats_supported);
+ /*
+ * xp-listfonts-modes-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_listfonts_modes_supported,
+ vpr->valid_xp_listfonts_modes_supported,
+ vpr->default_xp_listfonts_modes_supported);
+ /*
+ * xp-raw-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_raw_formats_supported,
+ vpr->valid_xp_raw_formats_supported,
+ vpr->default_xp_raw_formats_supported);
+ /*
+ * xp-setup-proviso
+ */
+ XpValidateOidAttr(pContext, XPPrinterAttr, xpoid_att_xp_setup_proviso,
+ vpr->valid_xp_setup_proviso, xpoid_none);
+ /*
+ * medium-source-sizes-supported
+ * input-trays-mdeium
+ */
+ XpValidatePrinterMediaAttrs(pContext,
+ vpr->valid_input_trays,
+ vpr->valid_medium_sizes);
+}
+
+
+void
+XpValidateNotificationProfile(XpContextPtr pContext)
+{
+ const char* value_in;
+ const char* value_out;
+
+ value_in = XpGetStringAttr(pContext, XPJobAttr,
+ xpoid_att_notification_profile);
+ value_out = XpOidNotifyString(XpOidNotifyParse(value_in));
+ XpPutStringAttr(pContext, XPJobAttr,
+ xpoid_att_notification_profile, value_out);
+}
+
+void
+XpValidateJobPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * Note: the 'vpr' argument is unused in this
+ * implementation; it is reserved for future use
+ */
+ XpOidList* job_attrs_supported;
+ /*
+ * only validate attributes found in job-attributes-supported
+ */
+ job_attrs_supported = XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_job_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * notification-profile
+ */
+ if(XpOidListHasOid(job_attrs_supported, xpoid_att_notification_profile))
+ {
+ XpValidateNotificationProfile(pContext);
+ }
+ /*
+ * clean up
+ */
+ XpOidListDelete(job_attrs_supported);
+}
+
+
+static void
+XpValidateDocOrPagePool(XpContextPtr pContext,
+ XPAttributes pool, /* XPDocAttr or XPPageAttr */
+ const XpOidList* attrs_supported,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * content-orientation
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_content_orientation))
+ {
+ XpOidList* content_orientations_supported;
+ content_orientations_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ vpr->valid_content_orientations_supported);
+ XpValidateOidAttr(pContext, pool, xpoid_att_content_orientation,
+ content_orientations_supported, xpoid_none);
+ XpOidListDelete(content_orientations_supported);
+ }
+ /*
+ * copy-count
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_copy_count))
+ XpValidateCardAttr(pContext, pool, xpoid_att_copy_count,
+ (const XpOidCardList*)NULL, 0);
+ /*
+ * default-printer-resolution
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_printer_resolution))
+ {
+ XpOidCardList* printer_resolutions_supported;
+ printer_resolutions_supported =
+ XpGetCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ vpr->valid_printer_resolutions_supported);
+ XpValidateCardAttr(pContext, pool,
+ xpoid_att_default_printer_resolution,
+ printer_resolutions_supported, 0);
+ XpOidCardListDelete(printer_resolutions_supported);
+ }
+ /*
+ * default-input-tray
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_input_tray))
+ {
+ XpOidTrayMediumList* input_trays_medium;
+ const char* value_in;
+ XpOid value_tray;
+
+ input_trays_medium =
+ XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ (const XpOidList*)NULL,
+ (const XpOidMediumSS*)NULL);
+ value_in =
+ XpGetStringAttr(pContext, pool, xpoid_att_default_input_tray);
+ value_tray = XpOidFromString(value_in);
+ if(!XpOidTrayMediumListHasTray(input_trays_medium, value_tray))
+ value_tray = xpoid_none;
+ XpPutOidAttr(pContext, pool, xpoid_att_default_input_tray, value_tray);
+ XpOidTrayMediumListDelete(input_trays_medium);
+ }
+ /*
+ * default-medium
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_medium))
+ {
+ XpOidMediumSS* msss;
+ const char* value_in;
+ XpOid value_size;
+
+ msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ value_in = XpGetStringAttr(pContext, pool, xpoid_att_default_medium);
+ value_size = XpOidFromString(value_in);
+ if(!XpOidMediumSSHasSize(msss, value_size))
+ value_size = xpoid_none;
+ XpPutOidAttr(pContext, pool, xpoid_att_default_medium, value_size);
+ XpOidMediumSSDelete(msss);
+ }
+ /*
+ * document-format
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_document_format))
+ {
+ XpOidDocFmtList* document_formats_supported;
+ const char* value_in;
+ XpOidDocFmt* document_format;
+ const char* value_out;
+
+ document_formats_supported =
+ XpGetDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_formats_supported,
+ vpr->valid_document_formats_supported);
+ value_in = XpGetStringAttr(pContext, pool, xpoid_att_document_format);
+ document_format = XpOidDocFmtNew(value_in);
+ if(XpOidDocFmtListHasFmt(document_formats_supported, document_format))
+ value_out = XpOidDocFmtString(document_format);
+ else
+ value_out = XpOidDocFmtString(vpr->default_document_format);
+ XpOidDocFmtListDelete(document_formats_supported);
+ XpOidDocFmtDelete(document_format);
+ XpPutStringAttr(pContext, pool, xpoid_att_document_format, value_out);
+ XpOidFree(value_out);
+ }
+ /*
+ * plex
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_plex))
+ {
+ XpOidList* plexes_supported;
+ plexes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported,
+ vpr->valid_plexes_supported);
+ XpValidateOidAttr(pContext, pool, xpoid_att_plex,
+ plexes_supported, xpoid_none);
+ XpOidListDelete(plexes_supported);
+ }
+ /*
+ * xp-listfonts-modes
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_xp_listfonts_modes))
+ {
+ XpOidList* xp_listfonts_modes_supported;
+ xp_listfonts_modes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_listfonts_modes_supported,
+ vpr->valid_xp_listfonts_modes_supported);
+ XpValidateListAttr(pContext, pool, xpoid_att_xp_listfonts_modes,
+ xp_listfonts_modes_supported,
+ (const XpOidList*)NULL);
+ XpOidListDelete(xp_listfonts_modes_supported);
+ }
+}
+
+void
+XpValidateDocumentPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ XpOidList* document_attrs_supported;
+ /*
+ * only validate attributes found in document-attributes-supported
+ */
+ document_attrs_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * validate
+ */
+ XpValidateDocOrPagePool(pContext, XPDocAttr,
+ document_attrs_supported, vpr);
+ /*
+ * clean up
+ */
+ XpOidListDelete(document_attrs_supported);
+}
+
+void
+XpValidatePagePool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ XpOidList* page_attrs_supported;
+ /*
+ * only validate attributes found in xp-page-attributes-supported
+ */
+ page_attrs_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_page_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * validate
+ */
+ XpValidateDocOrPagePool(pContext, XPPageAttr,
+ page_attrs_supported, vpr);
+ /*
+ * clean up
+ */
+ XpOidListDelete(page_attrs_supported);
+}
+
+void
+XpValidateAttributePool(XpContextPtr pContext,
+ XPAttributes pool,
+ const XpValidatePoolsRec* vpr)
+{
+ switch(pool)
+ {
+ case XPPrinterAttr:
+ XpValidatePrinterPool(pContext, vpr);
+ break;
+
+ case XPDocAttr:
+ XpValidateDocumentPool(pContext, vpr);
+ break;
+
+ case XPJobAttr:
+ XpValidateJobPool(pContext, vpr);
+ break;
+
+ case XPPageAttr:
+ XpValidatePagePool(pContext, vpr);
+ break;
+
+ default:
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/AttrValid.h b/xc/programs/Xserver/Xprint/AttrValid.h
new file mode 100644
index 000000000..436cb46a5
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/AttrValid.h
@@ -0,0 +1,206 @@
+/* $XConsortium: AttrValid.h /main/1 1996/09/28 16:57:36 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifndef _Xp_AttrValid_h
+#define _Xp_AttrValid_h
+
+#include "Oid.h"
+#include "attributes.h"
+
+#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
+
+/*
+ * Attribute pool validation valid values and defaults
+ */
+typedef struct
+{
+ XpOidList* valid_content_orientations_supported;
+ XpOidList* default_content_orientations_supported;
+
+ XpOidDocFmtList* valid_document_formats_supported;
+ XpOidDocFmtList* default_document_formats_supported;
+
+ XpOidList* valid_input_trays;
+ XpOidList* valid_medium_sizes;
+
+ XpOidList* valid_plexes_supported;
+ XpOidList* default_plexes_supported;
+
+ XpOidCardList* valid_printer_resolutions_supported;
+ XpOidCardList* default_printer_resolutions_supported;
+
+ XpOidDocFmtList* valid_xp_embedded_formats_supported;
+ XpOidDocFmtList* default_xp_embedded_formats_supported;
+
+ XpOidList* valid_xp_listfonts_modes_supported;
+ XpOidList* default_xp_listfonts_modes_supported;
+
+ XpOidDocFmtList* valid_xp_raw_formats_supported;
+ XpOidDocFmtList* default_xp_raw_formats_supported;
+
+ XpOidList* valid_xp_setup_proviso;
+
+ XpOidDocFmt* default_document_format;
+
+} XpValidatePoolsRec;
+
+/*
+ * XpOid resource access
+ */
+#define XpGetStringAttr(pContext, pool, oid) \
+ (const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
+#define XpPutStringAttr(pContext, pool, oid, value) \
+ XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
+/*
+ * XpOid-valued attribute access
+ */
+XpOid XpGetOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list);
+void XpPutOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ XpOid value_oid);
+void XpValidateOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ XpOid default_oid);
+/*
+ * cardinal-valued attribute access
+ */
+unsigned long XpGetCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list);
+void XpPutCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ unsigned long value_card);
+void XpValidateCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ unsigned long default_card);
+/*
+ * XpOidList-valued attribute access
+ */
+XpOidList* XpGetListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list);
+void XpPutListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* list);
+void XpValidateListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ const XpOidList* default_oids);
+/*
+ * XpOidCardList-valued attribute access
+ */
+XpOidCardList* XpGetCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list);
+void XpPutCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* list);
+void XpValidateCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ const XpOidCardList* default_cards);
+/*
+ * XpOidDocFmtList-valued attribute access
+ */
+XpOidDocFmtList* XpGetDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmt_list);
+void XpPutDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* list);
+void XpValidateDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmts,
+ const XpOidDocFmtList* default_fmts);
+/*
+ * XpOidMediumSS-valued attribute access
+ */
+XpOidMediumSS* XpGetMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+void XpPutMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidMediumSS* msss);
+const XpOidMediumSS* XpGetDefaultMediumSS();
+
+/*
+ * XpOidTrayMediumList-valued attribute access
+ */
+XpOidTrayMediumList* XpGetTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss);
+void XpPutTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidTrayMediumList* tm);
+/*
+ * Attribute pool validation
+ */
+void XpValidateAttributePool(XpContextPtr pContext,
+ XPAttributes pool,
+ const XpValidatePoolsRec* vpr);
+void XpValidatePrinterPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidateJobPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidateDocumentPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidatePagePool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+
+
+#endif /* _Xp_AttrValid_h - don't add anything after this line */
diff --git a/xc/programs/Xserver/Xprint/DiPrint.h b/xc/programs/Xserver/Xprint/DiPrint.h
new file mode 100644
index 000000000..feb7563bb
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/DiPrint.h
@@ -0,0 +1,54 @@
+/* $XConsortium: DiPrint.h /main/1 1996/09/28 16:57:42 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*
+ * The XpDiListEntry struct is the type of each element of the array
+ * handed back to the extension code to handle a GetPrinterList request.
+ * We don't use the printerDb directly because of the desire to handle
+ * multiple locales. Creating this new array for each GetPrinterList
+ * request will allow us to build it with the description in the locale of
+ * the requesting client.
+ */
+typedef struct _diListEntry {
+ char *name;
+ char *description;
+ char *localeName;
+ unsigned long rootWinId;
+} XpDiListEntry;
+
+extern void XpDiFreePrinterList(XpDiListEntry **list);
+
+extern XpDiListEntry **XpDiGetPrinterList(
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale);
diff --git a/xc/programs/Xserver/Xprint/Imakefile b/xc/programs/Xserver/Xprint/Imakefile
new file mode 100644
index 000000000..fde3aa41b
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Imakefile
@@ -0,0 +1,124 @@
+XCOMM $TOG: Imakefile /main/5 1997/11/14 11:11:40 kaleb $
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.13 1999/04/17 09:08:22 dawes Exp $
+#include <Server.tmpl>
+
+#ifndef XpRasterDDX
+#define XpRasterDDX NO
+#endif
+#ifndef XpColorPclDDX
+#define XpColorPclDDX YES
+#endif
+#ifndef XpMonoPclDDX
+#define XpMonoPclDDX NO
+#endif
+#ifndef XpPostScriptDDX
+#define XpPostScriptDDX YES
+#endif
+
+SRCS1 = Init.c Quarks.c attributes.c Util.c mediaSizes.c \
+ Oid.c AttrValid.c
+
+OBJS1 = Init.o Quarks.o attributes.o Util.o mediaSizes.o \
+ Oid.o AttrValid.o
+
+#ifdef OS2Architecture
+SRCS_OS2 = os2_stubs.c
+OBJS_OS2 = os2_stubs.o
+#endif
+
+#if XprtServer
+#if PrintOnlyServer || defined(PrintServerExtensions)
+#if PrintOnlyServer
+PO_DEFINES = -DPRINT_ONLY_SERVER
+#endif
+#ifdef PrintServerExtensions
+XPEXT_DEFINES = PrintServerExtensions
+#else
+XPEXT_DEFINES = $(EXT_DEFINES)
+#endif
+SRCS3 = miinitext.c panoramiXstubs.c dpmsstubs.c
+OBJS3 = miinitext.o panoramiXstubs.o dpmsstubs.o
+#endif
+SRCS2 = ddxInit.c
+OBJS2 = ddxInit.o
+#endif
+
+SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS_OS2)
+
+OBJS = $(OBJS1) $(OBJS_OS2)
+
+#if XpRasterDDX
+RASTDIR = raster
+RASTDEF = -DXPRASTERDDX
+#endif
+#if XpColorPclDDX
+PCLDIR = pcl
+PCLDEF = -DXPPCLDDX
+#endif
+#if XpMonoPclDDX
+MPCLDIR = pcl-mono
+MPCLDEF = -DXPMONOPCLDDX
+#endif
+#if XpPostScriptDDX
+PSDIR = ps
+PSDEF = -DXPPSDDX
+#endif
+
+OS_DEFINES = ServerOSDefines
+#if HasMkstemp
+MKTMP_DEFINES = -DHAS_MKSTEMP
+#endif
+
+SUBDIRS = $(RASTDIR) $(PCLDIR) $(MPCLDIR) $(PSDIR)
+#define IHaveSubdirs
+
+ INCLUDES = -I. -I../mfb \
+ -I../mi \
+ -I../cfb \
+ -I../include \
+ -I$(XINCLUDESRC) -I$(TOP)/include \
+ -I$(EXTINCSRC) -I$(FONTINCSRC)
+
+ LINTLIBS = $(TOP)/server/dix/llib-ldix.ln $(TOP)/server/os/llib-los.ln \
+ $(TOP)/server/ddx/mfb/llib-lmfb.ln \
+ $(TOP)/server/ddx/mi/llib-lmi.ln \
+ $(TOP)/server/ddx/cfb/llib-lcfb.ln
+
+DEFINES = -DXPRINTDIR=\"$(XPRINTDIR)\" $(RASTDEF) $(PCLDEF) $(MPCLDEF) \
+ $(PSDEF) $(MKTMP_DEFINES) -UXFree86LOADER
+
+NormalLibraryObjectRule()
+
+#if XprtServer
+all:: $(OBJS2) $(OBJS3) $(OBJS_OS2)
+#endif
+
+NormalLibraryTarget(printer,$(OBJS))
+NormalLintTarget($(SRCS))
+
+SpecialCObjectRule(ddxInit,$(ICONFIGFILES),$(PO_DEFINES) $(OS_DEFINES) $(EXT_DEFINES))
+#if XprtServer && (PrintOnlyServer || defined(PrintServerExtensions))
+LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
+SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(PO_DEFINES) $(OS_DEFINES) $(XPEXT_DEFINES) -DXPRINT -UGLXEXT)
+#if PrintOnlyServer
+LinkSourceFile(panoramiXstubs.c,$(SERVERSRC)/Xext)
+SpecialCObjectRule(panoramiXstubs,$(ICONFIGFILES),$(PO_DEFINES) $(OS_DEFINES) $(XPEXT_DEFINES) -DXPRINT)
+LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext)
+SpecialCObjectRule(dpmsstubs,$(ICONFIGFILES),$(PO_DEFINES) $(OS_DEFINES) $(XPEXT_DEFINES) -DXPRINT)
+#endif
+#endif
+
+#ifdef OS2Architecture
+LinkSourceFile(os2_stubs.c,../hw/xfree86/os-support/os2)
+SpecialCObjectRule(os2_stubs,$(ICONFIGFILES),-DOS2NULLSELECT)
+#endif
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+MakeLintLibSubdirs($(SUBDIRS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/Xprint/Init.c b/xc/programs/Xserver/Xprint/Init.c
new file mode 100644
index 000000000..ebdee8e5a
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Init.c
@@ -0,0 +1,1795 @@
+/* $TOG: Init.c /main/6 1997/06/12 09:59:34 samborn $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Init.c
+** *
+** * Contents:
+** * The InitOutput routine here would presumably
+** * be called from the normal server's InitOutput
+** * after all display screens have been added.
+** * There is are ifdef'd routines suitable for
+** * use in building a printer-only server. Turn
+** * on the "PRINTER_ONLY_SERVER" define if this is
+** * to be the only ddx-level driver.
+** *
+** * Copyright: Copyright 1993,1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.6 1997/06/15 07:12:11 dawes Exp $ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <locale.h>
+#ifdef __hpux
+#include <sys/sysmacros.h>
+#endif
+
+#include "X.h"
+#define NEED_EVENTS 1
+#include "Xproto.h"
+#include <servermd.h>
+
+#include "screenint.h"
+#include "input.h"
+#include "cursor.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "inputstr.h"
+
+#include "gcstruct.h"
+#include "fonts/fontstruct.h"
+#include "errno.h"
+
+#define _XP_PRINT_SERVER_
+#include "Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+typedef char *XPointer;
+#define Status int
+#include <Xresource.h>
+
+#include "DiPrint.h"
+#include "AttrValid.h"
+#include "attributes.h"
+
+extern char *display; /* display number as a string */
+
+#include "os.h"
+
+extern char *getenv();
+extern void XpAddPrinterAttribute();
+extern char *XpGetConfigDir();
+extern XpContextPtr XpContextOfClient();
+
+/*
+extern int GiveUp();
+*/
+
+extern WindowPtr *WindowTable; /* declared in dix:globals.c */
+
+
+#if NeedFunctionPrototypes
+
+static void GetDriverFromPrinterName(
+ char *printerName,
+ char **driverName,
+ Bool (**initScreenFunc)());
+static void GenericScreenInit(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+static Bool InitPrintDrivers(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+
+#else
+
+static void GetDriverFromPrinterName();
+static void GenericScreenInit();
+static Bool InitPrintDrivers();
+
+#endif
+
+
+/*
+ * The following two defines are used to build the name "X*printers", where
+ * the "*" is replaced by the display number. This is used to construct
+ * the name of the default printers configuration file if the -XpFile
+ * command line option was not specified.
+ */
+#define XNPRINTERSFILEPREFIX "/X"
+#define XNPRINTERSFILESUFFIX "printers"
+#define XPRINTERSFILENAME "Xprinters"
+
+#define MODELDIRNAME "/models"
+#define FONTDIRNAME "/fonts"
+
+/*
+ * The string LIST_QUEUES is fed to a shell to generate an ordered
+ * list of available printers on the system. These string definitions
+ * are taken from the file PrintSubSys.C within the code for the
+ * dtprintinfo program.
+ */
+#ifdef AIXV4
+const char *LIST_QUEUES = "lsallq | grep -v '^bsh$' | sort";
+#else
+#ifdef hpux
+const char *LIST_QUEUES = "LANG=C lpstat -v | "
+ "awk '"
+ " $2 == \"for\" "
+ " { "
+ " x = match($3, /:/); "
+ " print substr($3, 1, x-1)"
+ " }' | sort";
+#else
+#ifdef __osf__
+ const char *LIST_QUEUES = "LANG=C lpstat -v | "
+ "nawk '"
+ " $2 == \"for\" "
+ " { print $10 }' "
+ " | sort";
+#else
+#ifdef __uxp__
+const char *LIST_QUEUES = "LANG=C lpstat -v | "
+ "nawk '"
+ " $4 == \"for\" "
+ " { "
+ " x = match($5, /:/); "
+ " print substr($5, 1, x-1)"
+ " }' | sort";
+#else
+#if defined(CSRG_BASED) || defined(linux) || defined(ISC)
+const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
+ "sed -e /:/s/// | sort";
+#else
+const char *LIST_QUEUES = "LANG=C lpstat -v | "
+ "nawk '"
+ " $2 == \"for\" "
+ " { "
+ " x = match($3, /:/); "
+ " print substr($3, 1, x-1)"
+ " }' | sort";
+#endif
+#endif
+#endif
+#endif
+#endif
+
+#ifdef XPRASTERDDX
+
+static
+PixmapFormatRec RasterPixmapFormats[] = {
+ 1, 1, BITMAP_SCANLINE_PAD
+};
+#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
+
+extern Bool InitializeRasterDriver();
+extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
+
+#endif
+
+#ifdef XPPCLDDX
+
+static
+PixmapFormatRec ColorPclPixmapFormats[] = {
+ 1, 1, BITMAP_SCANLINE_PAD,
+ 8, 8, BITMAP_SCANLINE_PAD,
+ 24,32, BITMAP_SCANLINE_PAD
+};
+
+#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
+
+extern Bool InitializeColorPclDriver();
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
+#endif
+
+#ifdef XPMONOPCLDDX
+
+static
+PixmapFormatRec MonoPclPixmapFormats[] = {
+ 1, 1, BITMAP_SCANLINE_PAD
+};
+
+#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
+
+extern Bool InitializeMonoPclDriver();
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
+#endif
+
+#ifdef XPPSDDX
+
+static
+PixmapFormatRec PSPixmapFormats[] = {
+ 1, 1, BITMAP_SCANLINE_PAD,
+ 8, 8, BITMAP_SCANLINE_PAD,
+ 24,32, BITMAP_SCANLINE_PAD
+};
+
+#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
+
+extern Bool InitializePsDriver();
+extern XpValidatePoolsRec PsValidatePoolsRec;
+
+#endif
+
+
+typedef Bool (*pBFunc)();
+typedef void (*pVFunc)();
+/*
+ * The driverInitArray contains an entry for each driver the
+ * server knows about. Each element contains pointers to pixmap formats, the
+ * driver's initialization routine, and pointers to the driver's
+ * attribute validation rec, and/or a driver function which
+ * returns the maximum medium width&height, and maximum resolution
+ * given a printer name. Either the validation rec OR the dimension
+ * function can be NULL. If the function is non-NULL then it
+ * will be called, and will be passed the (possibly NULL) validation rec.
+ * If the function is NULL, then XpGetMaxWidthHeightRes() is called.
+ */
+typedef struct _driverInitRec {
+ char *driverName;
+ pBFunc initFunc;
+ XpValidatePoolsRec *pValRec;
+ pVFunc dimensionsFunc;
+ PixmapFormatRec *pFmts;
+ int numFmts;
+} driverInitRec;
+
+static driverInitRec driverInits[] = {
+#ifdef XPRASTERDDX
+ {
+ "XP-RASTER",
+ InitializeRasterDriver,
+ &RasterValidatePoolsRec,
+ (pVFunc) NULL,
+ RasterPixmapFormats,
+ NUMRASTFORMATS
+ },
+#endif
+#ifdef XPPCLDDX
+ {
+ "XP-PCL-COLOR",
+ InitializeColorPclDriver,
+ &PclValidatePoolsRec,
+ (pVFunc) NULL,
+ ColorPclPixmapFormats,
+ NUMCPCLFORMATS
+ },
+#endif
+#ifdef XPMONOPCLDDX
+ {
+ "XP-PCL-MONO",
+ InitializeMonoPclDriver,
+ &PclValidatePoolsRec,
+ (pVFunc) NULL,
+ MonoPclPixmapFormats,
+ NUMMPCLFORMATS
+ },
+#endif
+#ifdef XPPSDDX
+ {
+ "XP-POSTSCRIPT",
+ InitializePsDriver,
+ &PsValidatePoolsRec,
+ (pVFunc) NULL,
+ PSPixmapFormats,
+ NUMPSFORMATS
+ },
+#endif
+};
+
+
+/*
+ * The printerDb variable points to a list of PrinterDbEntry structs
+ * which map printer names with screen numbers and driver names.
+ */
+typedef struct _printerDbEntry {
+ struct _printerDbEntry *next;
+ char *name;
+ char *qualifier;
+ int screenNum;
+ char *driverName;
+} PrinterDbEntry, *PrinterDbPtr;
+
+static PrinterDbPtr printerDb = (PrinterDbPtr)NULL;
+
+/*
+ * The nameMap is a list used in initializing the attribute store
+ * for each printer. The list is freed once the printerDb is built
+ * and the attribute stores for all printers have been initialized.
+ */
+typedef struct _nameMapEntry {
+ struct _nameMapEntry *next;
+ char *name;
+ char *qualifier;
+} NameMapEntry, *NameMapPtr;
+
+static NameMapPtr nameMap = (NameMapPtr)NULL;
+
+/*
+ * The driverMap is a list which provides the mapping between driver names
+ * and screen numbers. It is built and used
+ * by RehashPrinterList to correctly fill in the screenNum field in the
+ * printerDb entries. The list is freed before RehashPrinterList terminates.
+ */
+typedef struct _driverMapping {
+ struct _driverMapping *next;
+ char *driverName;
+ int screenNum;
+} DriverMapEntry, *DriverMapPtr;
+
+static const char configFilePath[] =
+"/etc/dt/config/print:/usr/dt/config/print";
+
+static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
+
+static int printScreenPrivIndex,
+ printWindowPrivIndex,
+ printGCPrivIndex;
+static unsigned long printGeneration = 0;
+static char *configFileName = (char *)NULL;
+static Bool freeDefaultFontPath = FALSE;
+static char *origFontPath = (char *)NULL;
+
+/*
+ * XprintOptions checks argv[i] to see if it is our command line
+ * option specifying a configuration file name. It returns the index
+ * of the next option to process.
+ */
+int
+XprintOptions(argc, argv, i)
+ int argc;
+ char **argv;
+ int i;
+{
+ if(strcmp(argv[i], "-XpFile") == 0)
+ {
+ configFileName = argv[i + 1];
+ return i + 2;
+ }
+ else
+ return i;
+}
+
+/************************************************************
+ * GetInitFunc --
+ *
+ * This routine is called from the InitPrintDrivers function.
+ * Given the name of a driver, return a pointer to the driver's
+ * initialization function.
+ *
+ * Results:
+ * Returns a pointer to the initialization function for the driver.
+ *
+ *
+ ************************************************************/
+
+/*
+typedef Bool (*pIFunc)();
+static pIFunc
+GetInitFunc(driverName)
+*/
+
+static Bool (*
+GetInitFunc(driverName))()
+ char *driverName;
+{
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ int i;
+
+ for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if( !strcmp( driverName, pInitRec->driverName ) )
+ return pInitRec->initFunc;
+ }
+
+ return (Bool(*)())NULL;
+}
+
+static void
+GetDimFuncAndRec(
+ char *driverName,
+ XpValidatePoolsRec **pValRec,
+ pVFunc *dimensionsFunc)
+{
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ int i;
+
+ for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if( !strcmp( driverName, pInitRec->driverName ) )
+ {
+ *dimensionsFunc = pInitRec->dimensionsFunc;
+ *pValRec = pInitRec->pValRec;
+ return ;
+ }
+ }
+
+ *dimensionsFunc = (pVFunc)NULL;
+ *pValRec = (XpValidatePoolsRec *)NULL;
+ return;
+}
+
+static void
+FreePrinterDb()
+{
+ PrinterDbPtr pCurEntry, pNextEntry;
+
+ for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
+ {
+ pNextEntry = pCurEntry->next;
+ if(pCurEntry->name != (char *)NULL)
+ xfree(pCurEntry->name);
+ /*
+ * We don't free the driver name, because it's expected to simply
+ * be a pointer into the xrm database.
+ */
+ xfree(pCurEntry);
+ }
+ printerDb = (PrinterDbPtr)NULL;
+}
+
+/*
+ * AddPrinterDbName allocates an entry in the printerDb list, and
+ * initializes the "name". It returns TRUE if the element was
+ * successfully added, and FALSE if an allocation error ocurred.
+ * XXX AddPrinterDbName needs to check for (and not add) duplicate names.
+ */
+static Bool
+AddPrinterDbName(name)
+ char *name;
+{
+ PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
+
+ if(pEntry == (PrinterDbPtr)NULL) return FALSE;
+ pEntry->name = strdup(name);
+ pEntry->qualifier = (char *)NULL;
+
+ if(printerDb == (PrinterDbPtr)NULL)
+ {
+ pEntry->next = (PrinterDbPtr)NULL;
+ printerDb = pEntry;
+ }
+ else
+ {
+ pEntry->next = printerDb;
+ printerDb = pEntry;
+ }
+ return TRUE;
+}
+
+static void
+AugmentPrinterDb(command)
+ char *command;
+{
+ FILE *fp;
+ char name[256];
+
+ fp = popen(command, "r");
+ /* XXX is a 256 character limit overly restrictive for printer names? */
+ while(fgets(name, 256, fp) != (char *)NULL && strlen(name))
+ {
+ name[strlen(name) - 1] = (char)'\0'; /* strip the \n */
+ AddPrinterDbName(name);
+ }
+ pclose(fp);
+}
+
+/*
+ * FreeNameMap frees all remaining memory associated with the nameMap.
+ */
+static void
+FreeNameMap()
+{
+ NameMapPtr pEntry, pTmp;
+
+ for(pEntry = nameMap, pTmp = (NameMapPtr)NULL;
+ pEntry != (NameMapPtr)NULL;
+ pEntry = pTmp)
+ {
+ if(pEntry->name != (char *)NULL)
+ xfree(pEntry->name);
+ if(pEntry->qualifier != (char *)NULL)
+ xfree(pEntry->qualifier);
+ pTmp = pEntry->next;
+ xfree(pEntry);
+ }
+ nameMap = (NameMapPtr)NULL;
+}
+
+/*
+ * AddNameMap adds an element to the nameMap linked list.
+ */
+static Bool
+AddNameMap(name, qualifier)
+ char *name;
+ char *qualifier;
+{
+ NameMapPtr pEntry;
+
+ if((pEntry = (NameMapPtr)xalloc(sizeof(NameMapEntry))) == (NameMapPtr)NULL)
+ return FALSE;
+ pEntry->name = name;
+ pEntry->qualifier = qualifier;
+ pEntry->next = nameMap;
+ nameMap = pEntry;
+ return TRUE;
+}
+
+/*
+ * MergeNameMap - puts the "map" names (aka qualifiers, aliases) into
+ * the printerDb. This should be called once, after both the printerDb
+ * and nameMap lists are complete. When/if MergeNameMap finds a map for
+ * an entry in the printerDb, the qualifier is _moved_ (not copied) to
+ * the printerDb. This means that the qualifier pointer in the nameMap
+ * is NULLed out.
+ */
+static void
+MergeNameMap()
+{
+ NameMapPtr pMap;
+ PrinterDbPtr pDb;
+
+ for(pMap = nameMap; pMap != (NameMapPtr)NULL; pMap = pMap->next)
+ {
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(!strcmp(pMap->name, pDb->name))
+ {
+ pDb->qualifier = pMap->qualifier;
+ pMap->qualifier = (char *)NULL;
+ }
+ }
+ }
+}
+
+/*
+ * CreatePrinterAttrs causes the attribute stores to be built for
+ * each printer in the printerDb.
+ */
+static void
+CreatePrinterAttrs()
+{
+ PrinterDbPtr pDb;
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ XpBuildAttributeStore(pDb->name, (pDb->qualifier)?
+ pDb->qualifier : pDb->name);
+ }
+}
+
+#ifdef XPPSDDX
+#define defaultDriver "XP-POSTSCRIPT"
+#else
+#ifdef XPPCLDDX
+#define defaultDriver "XP-PCL-COLOR"
+#else
+#ifdef XPMONOPCLDDX
+#define defaultDriver "XP-PCL-MONO"
+#else
+#define defaultDriver "XP-RASTER"
+#endif
+#endif
+#endif
+
+/*
+ * StoreDriverNames - queries the attribute store for the ddx-identifier.
+ * if the ddx-identifier is not in the attribute database, then a default
+ * ddx-identifier is store in both the attribute store for the printer,
+ * and in the printerDb.
+ * The ddx-identifier is stored in the printerDb for use in initializing
+ * the screens.
+ */
+static void
+StoreDriverNames()
+{
+ PrinterDbPtr pEntry;
+
+ for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL;
+ pEntry = pEntry->next)
+ {
+ pEntry->driverName = (char*)XpGetPrinterAttribute(pEntry->name,
+ "xp-ddx-identifier");
+ if(pEntry->driverName == (char *)NULL ||
+ strlen(pEntry->driverName) == 0 ||
+ GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
+ {
+ if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
+ ErrorF("Xp Extension: Can't load driver %s\n",
+ pEntry->driverName);
+ ErrorF(" init function missing\n");
+ }
+
+ pEntry->driverName = defaultDriver;
+ XpAddPrinterAttribute(pEntry->name,
+ (pEntry->qualifier != (char *)NULL)?
+ pEntry->qualifier : pEntry->name,
+ "*xp-ddx-identifier", pEntry->driverName);
+ }
+ }
+}
+
+char *
+MbStrchr(
+ char *str,
+ int ch)
+{
+ size_t mbCurMax = MB_CUR_MAX;
+ wchar_t targetChar, curChar;
+ char tmpChar;
+ int i, numBytes, byteLen;
+
+ if(mbCurMax <= 1) return strchr(str, ch);
+
+ tmpChar = (char)ch;
+ mbtowc(&targetChar, &tmpChar, mbCurMax);
+ for(i = 0, numBytes = 0, byteLen = strlen(str); i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &str[i], mbCurMax);
+ if(curChar == targetChar) return &str[i];
+ }
+ return (char *)NULL;
+}
+
+/*
+ * GetConfigFileName - Looks for a "Xprinters" file in
+ * $(XPRINTDIR)/$LANG/print, and then in $(XPRINTDIR)/C/print. If it
+ * finds such a file, it returns the path to the file. The returned
+ * string must be freed by the caller.
+ */
+static char *
+GetConfigFileName()
+{
+ /*
+ * We need to find the system-wide file, if one exists. This
+ * file can be in either $(XPRINTDIR)/$LANG/print, or in
+ * $(PRINTDIR)/C/print, and the file itself is named "Xprinters".
+ */
+ char *dirName, *filePath;
+
+ /*
+ * Check for a LANG-specific file.
+ */
+ if(dirName = XpGetConfigDir(TRUE))
+ {
+ filePath = (char *)xalloc(strlen(dirName) +
+ strlen(XPRINTERSFILENAME) + 2);
+
+ if(filePath == (char *)NULL)
+ {
+ xfree(dirName);
+ return (char *)NULL;
+ }
+
+ sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME);
+ xfree(dirName);
+ if(access(filePath, R_OK) == 0)
+ return filePath;
+
+ xfree(filePath);
+ }
+
+ if(dirName = XpGetConfigDir(FALSE))
+ {
+ filePath = (char *)xalloc(strlen(dirName) +
+ strlen(XPRINTERSFILENAME) + 2);
+ if(filePath == (char *)NULL)
+ {
+ xfree(dirName);
+ return (char *)NULL;
+ }
+ sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME);
+ xfree(dirName);
+ if(access(filePath, R_OK) == 0)
+ return filePath;
+ xfree(filePath);
+ }
+ return (char *)NULL;
+}
+
+/*
+ * BuildPrinterDb - reads the config file if it exists, and if necessary
+ * executes a command such as lpstat to generate a list of printers.
+ * XXX
+ * XXX BuildPrinterDb must be rewritten to allow 16-bit characters in
+ * XXX printer names. The will involve replacing the use of strtok() and its
+ * XXX related functions.
+ * XXX At the same time, BuildPrinterDb and it's support routines should have
+ * XXX allocation error checking added.
+ * XXX
+ */
+static PrinterDbPtr
+BuildPrinterDb()
+{
+ char *printerList, *augmentCmd = (char *)NULL;
+ Bool defaultAugment = TRUE, freeConfigFileName;
+
+ if(configFileName && access(configFileName, R_OK) != 0)
+ {
+ ErrorF("Xp Extension: Can't open file %s\n", configFileName);
+ }
+ if(!configFileName && (configFileName = GetConfigFileName()))
+ freeConfigFileName = TRUE;
+ else
+ freeConfigFileName = FALSE;
+
+ if(configFileName != (char *)NULL && access(configFileName, R_OK) == 0)
+ {
+ char line[256];
+ FILE *fp = fopen(configFileName, "r");
+
+ while(fgets(line, 256, fp) != (char *)NULL)
+ {
+ char *tok, *ptr;
+ if((tok = strtok(line, " \t\012")) != (char *)NULL)
+ {
+ if(tok[0] == (char)'#') continue;
+ if(strcmp(tok, "Printer") == 0)
+ {
+ while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
+ {
+ if(ptr = MbStrchr(tok, '\012'))
+ *ptr = (char)'\0';
+ AddPrinterDbName(tok);
+ }
+ }
+ else if(strcmp(tok, "Map") == 0)
+ {
+ char *name, *qualifier;
+
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ continue;
+ name = strdup(tok);
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ {
+ xfree(name);
+ continue;
+ }
+ qualifier = strdup(tok);
+ AddNameMap(name, qualifier);
+ }
+ else if(strcmp(tok, "Augment_Printer_List") == 0)
+ {
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ continue;
+
+ if(strcmp(tok, "%default%") == 0)
+ continue;
+ defaultAugment = FALSE;
+ if(strcmp(tok, "%none%") == 0)
+ continue;
+ AugmentPrinterDb(tok);
+ }
+ else
+ break; /* XXX Generate an error? */
+ }
+ }
+ fclose(fp);
+ }
+
+ if(defaultAugment == TRUE)
+ {
+ AugmentPrinterDb(LIST_QUEUES);
+ }
+
+ MergeNameMap();
+ FreeNameMap();
+
+ /* Create the attribute stores for all printers */
+ CreatePrinterAttrs();
+
+ /*
+ * Find the drivers for each printers, and store the driver names
+ * in the printerDb
+ */
+ StoreDriverNames();
+
+ if(freeConfigFileName)
+ {
+ xfree(configFileName);
+ configFileName = (char *)NULL;
+ }
+
+ return printerDb;
+}
+
+static void
+FreeDriverMap(driverMap)
+ DriverMapPtr driverMap;
+{
+ DriverMapPtr pCurEntry, pNextEntry;
+
+ for(pCurEntry = driverMap, pNextEntry = (DriverMapPtr)NULL;
+ pCurEntry != (DriverMapPtr)NULL; pCurEntry = pNextEntry)
+ {
+ pNextEntry = pCurEntry->next;
+ if(pCurEntry->driverName != (char *)NULL)
+ xfree(pCurEntry->driverName);
+ xfree(pCurEntry);
+ }
+}
+
+/*
+ * XpRehashPrinterList rebuilds the list of printers known to the
+ * server. It first walks the printerDb to build a table mapping
+ * driver names and screen numbers, since this is not an easy mapping
+ * to change in the sample server. The normal configuration files are
+ * then read & parsed to create the new list of printers. Printers
+ * which require drivers other than those already initialized are
+ * deleted from the printerDb. This leaves attribute stores in place
+ * for inaccessible printers, but those stores will be cleaned up in
+ * the next rehash or server recycle.
+ */
+int
+XpRehashPrinterList()
+{
+ PrinterDbPtr pEntry, pPrev;
+ DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
+ int result;
+
+ /* Build driverMap */
+ for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next)
+ {
+ for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL;
+ pDrvEnt = pDrvEnt->next)
+ {
+ if(!strcmp(pEntry->driverName, pDrvEnt->driverName))
+ break;
+ }
+
+ if(pDrvEnt != (DriverMapPtr)NULL)
+ continue;
+
+ if((pDrvEnt = (DriverMapPtr)xalloc(sizeof(DriverMapEntry))) ==
+ (DriverMapPtr)NULL)
+ {
+ FreeDriverMap(driverMap);
+ return BadAlloc;
+ }
+ pDrvEnt->driverName = strdup(pEntry->driverName);
+ pDrvEnt->screenNum = pEntry->screenNum;
+ pDrvEnt->next = driverMap;
+ driverMap = pDrvEnt;
+ }
+
+ /* Free the old printerDb */
+ FreePrinterDb();
+
+ /* Free/Rehash attribute stores */
+ if((result = XpRehashAttributes()) != Success)
+ return result;
+
+ /* Build a new printerDb */
+ if(BuildPrinterDb() == (PrinterDbPtr)NULL)
+ return BadAlloc;
+
+ /* Walk PrinterDb & either store screenNum, or delete printerDb entry */
+ for(pEntry = printerDb, pPrev = (PrinterDbPtr)NULL;
+ pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next)
+ {
+ for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL;
+ pDrvEnt = pDrvEnt->next)
+ {
+ if(!strcmp(printerDb->driverName, pDrvEnt->driverName))
+ break;
+ }
+
+ /*
+ * Either store the screen number, or delete the printerDb entry.
+ * Deleting the entry leaves orphaned attribute stores, but they'll
+ * get cleaned up at the next rehash or server recycle.
+ */
+ if(pDrvEnt != (DriverMapPtr)NULL)
+ {
+ pEntry->screenNum = pDrvEnt->screenNum;
+ pPrev = pEntry;
+ }
+ else {
+ if(pPrev)
+ pPrev->next = pEntry->next;
+ else
+ pPrev = pEntry->next;
+ if(pEntry->name != (char *)NULL)
+ xfree(pEntry->name);
+ xfree(pEntry);
+ pEntry = pPrev;
+ }
+ }
+
+ FreeDriverMap(driverMap);
+
+ return Success;
+}
+
+/*
+ * ValidateFontDir looks for a valid font directory for the specified
+ * printer model within the specified configuration directory. It returns
+ * the directory name, or NULL if no valid font directory was found.
+ * It is the caller's responsibility to free the returned font directory
+ * name.
+ */
+static char *
+ValidateFontDir(
+ char *configDir,
+ char *modelName)
+{
+ char *pathName;
+
+ if(!configDir || !modelName)
+ return (char *)NULL;
+
+ pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) +
+ strlen(modelName) + strlen(FONTDIRNAME) +
+ strlen("fonts.dir") + 5);
+ if(!pathName)
+ return (char *)NULL;
+ sprintf(pathName, "%s/%s/%s/%s/%s", configDir, MODELDIRNAME, modelName,
+ FONTDIRNAME, "fonts.dir");
+ if(access(pathName, R_OK) != 0)
+ {
+ xfree(pathName);
+ return (char *)NULL;
+ }
+ pathName[strlen(pathName) - 9] = (char)'\0'; /* erase fonts.dir */
+ return pathName;
+}
+
+/*
+ * FindFontDir returns a pointer to the path name of the font directory
+ * for the specified printer model name, if such a directory exists.
+ * The directory contents are superficially checked for validity.
+ * The caller must free the returned char *.
+ *
+ * We first look in the locale-specific model-config directory, and
+ * then fall back to the C language model-config directory.
+ */
+static char *
+FindFontDir(
+ char *modelName)
+{
+ char *configDir, *fontDir;
+
+ if(!modelName || !strlen(modelName))
+ return (char *)NULL;
+
+ configDir = XpGetConfigDir(TRUE);
+ if(fontDir = ValidateFontDir(configDir, modelName))
+ {
+ xfree(configDir);
+ return fontDir;
+ }
+
+ if(configDir)
+ xfree(configDir);
+ configDir = XpGetConfigDir(FALSE);
+ fontDir = ValidateFontDir(configDir, modelName);
+
+ xfree(configDir);
+
+ return fontDir;
+}
+
+/*
+ * AddToFontPath adds the specified font path element to the global
+ * defaultFontPath string. It adds the keyword "PRINTER:" to the front
+ * of the path to denote that this is a printer-specific font path
+ * element.
+ */
+static char PATH_PREFIX[] = "PRINTER:";
+static int PATH_PREFIX_LEN = sizeof(PATH_PREFIX) - 1; /* same as strlen() */
+
+static void
+AddToFontPath(
+ char *pathName)
+{
+ char *newPath;
+ Bool freeOldPath;
+
+ if(defaultFontPath == origFontPath)
+ freeOldPath = FALSE;
+ else
+ freeOldPath = TRUE;
+
+ newPath = (char *)xalloc(strlen(defaultFontPath) + strlen(pathName) +
+ PATH_PREFIX_LEN + 2);
+
+ sprintf(newPath, "%s%s,%s", PATH_PREFIX, pathName, defaultFontPath);
+
+ if(freeOldPath)
+ xfree(defaultFontPath);
+
+ defaultFontPath = newPath;
+ return;
+}
+
+/*
+ * AugmentFontPath adds printer-model-specific font path elements to
+ * the front of the font path global variable "defaultFontPath" (dix/globals.c).
+ * We can't call SetFontPath() because the font code has not yet been
+ * initialized when InitOutput is called (from whence this routine is called).
+ *
+ * This utilizes the static variables origFontPath and
+ * freeDefaultFontPath to track the original contents of defaultFontPath,
+ * and to properly free the modified version upon server recycle.
+ */
+static void
+AugmentFontPath()
+{
+ char *newPath, *modelID, **allIDs = (char **)NULL;
+ PrinterDbPtr pDb, pDbEntry;
+ int numModels, i;
+
+ if(!origFontPath)
+ origFontPath = defaultFontPath;
+
+ if(freeDefaultFontPath)
+ {
+ xfree(defaultFontPath);
+ defaultFontPath = origFontPath;
+ freeDefaultFontPath = FALSE;
+ }
+
+ /*
+ * Build a list of printer models to check for internal fonts.
+ */
+ for(pDbEntry = printerDb, numModels = 0;
+ pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ modelID =
+ (char*)XpGetPrinterAttribute(pDbEntry->name,
+ "xp-model-identifier");
+
+ if(modelID && strlen(modelID) != 0)
+ {
+ /* look for current model in the list of allIDs */
+ for(i = 0; i < numModels; i++)
+ {
+ if(!strcmp(modelID, allIDs[i]))
+ {
+ modelID = (char *)NULL;
+ break;
+ }
+ }
+ }
+
+ /*
+ * If this printer's model-identifier isn't in the allIDs list,
+ * then add it to allIDs.
+ */
+ if(modelID && strlen(modelID) != 0)
+ {
+ allIDs = (char **)xrealloc(allIDs, (numModels+2) * sizeof(char *));
+ if(allIDs == (char **)NULL)
+ return;
+ allIDs[numModels] = modelID;
+ allIDs[numModels + 1] = (char *)NULL;
+ numModels++;
+ }
+ }
+
+ /* for each model, check for a valid font directory, and add it to
+ * the front of defaultFontPath.
+ */
+ for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
+ {
+ char *fontDir;
+ if(fontDir = FindFontDir(allIDs[i]))
+ {
+ AddToFontPath(fontDir);
+ xfree(fontDir);
+ freeDefaultFontPath = TRUE;
+ }
+ }
+
+ if(allIDs)
+ xfree(allIDs);
+
+ return;
+}
+
+/*
+ * XpClientIsBitmapClient is called by the font code to find out if
+ * a particular client should be granted access to bitmap fonts.
+ * This function works by
+ * calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine
+ * the context associated with the client, and then queries the context's
+ * attributes to determine whether the bitmap fonts should be visible.
+ * It looks at the value of the xp-listfonts-mode document/page attribute to
+ * see if xp-list-glyph-fonts has been left out of the mode list. Only
+ * if the xp-listfonts-mode attribute exists, and it does not contain
+ * xp-list-glyph-fonts does this function return FALSE. In any other
+ * case the funtion returns TRUE, indicating that the bitmap fonts
+ * should be visible to the client.
+ */
+Bool
+XpClientIsBitmapClient(
+ ClientPtr client)
+{
+ XpContextPtr pContext;
+ char *mode;
+
+ if(!(pContext = XpContextOfClient(client)))
+ return TRUE;
+
+ /*
+ * Check the page attributes, and if it's not defined there, then
+ * check the document attributes.
+ */
+ mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-mode");
+ if(!mode || !strlen(mode))
+ {
+ mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-mode");
+ if(!mode || !strlen(mode))
+ return TRUE;
+ }
+
+ if(!strstr(mode, "xp-list-glyph-fonts"))
+ return FALSE;
+
+ return TRUE;
+}
+/*
+ * XpClientIsPrintClient is called by the font code to find out if
+ * a particular client has set a context which references a printer
+ * which utilizes a particular font path. This function works by
+ * calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine
+ * the context associated with the client, and then looks up the
+ * font directory for the context. The font directory is then compared
+ * with the directory specified in the FontPathElement which is passed in.
+ */
+Bool
+XpClientIsPrintClient(
+ ClientPtr client,
+ FontPathElementPtr fpe)
+{
+ XpContextPtr pContext;
+ char *modelID, *fontDir;
+
+ if(!(pContext = XpContextOfClient(client)))
+ return FALSE;
+
+ if (!fpe)
+ return TRUE;
+
+ modelID = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-model-identifier");
+ if(!modelID || !strlen(modelID))
+ return FALSE;
+
+ if(!(fontDir = FindFontDir(modelID)))
+ return FALSE;
+
+ /*
+ * The grunge here is to ignore the PATH_PREFIX at the front of the
+ * fpe->name.
+ */
+ if(fpe->name_length < PATH_PREFIX_LEN ||
+ (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
+ strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
+ fpe->name_length - PATH_PREFIX_LEN))
+ {
+ xfree(fontDir);
+ return FALSE;
+ }
+ xfree(fontDir);
+ return TRUE;
+}
+
+static void
+AddFormats(pScreenInfo, driverName)
+ ScreenInfo *pScreenInfo;
+ char *driverName;
+{
+ int i, j;
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ PixmapFormatRec *formats;
+ int numfmts;
+
+ for (pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if ( !strcmp( driverName, pInitRec->driverName ) )
+ break;
+ }
+ if (i >= numDrivers)
+ return;
+ formats = pInitRec->pFmts;
+ numfmts = pInitRec->numFmts;
+ for (i = 0; i < numfmts && pScreenInfo->numPixmapFormats < MAXFORMATS; i++)
+ {
+ for (j = 0; j < pScreenInfo->numPixmapFormats; j++) {
+ if (pScreenInfo->formats[j].depth == formats[i].depth &&
+ pScreenInfo->formats[j].bitsPerPixel == formats[i].bitsPerPixel &&
+ pScreenInfo->formats[j].scanlinePad == formats[i].scanlinePad)
+ break;
+ }
+ if (j == pScreenInfo->numPixmapFormats) {
+ pScreenInfo->formats[j] = formats[i];
+ pScreenInfo->numPixmapFormats++;
+ }
+ }
+}
+
+/************************************************************
+ * PrinterInitOutput --
+ * This routine is to be called from a ddx's InitOutput
+ * during the server startup initialization, and when
+ * the server is to be reset. The routine creates the
+ * screens associated with configured printers by calling
+ * dix:AddScreen. The configuration information comes from a
+ * database read from the X*printers file.
+ *
+ * Results:
+ * The array of ScreenRec pointers referenced by
+ * pScreenInfo->screen is increased by the addition
+ * of the printer screen(s), as is the value of
+ * pScreenInfo->numScreens. This is done via calls
+ * to AddScreen() in dix.
+ *
+ ************************************************************/
+
+void
+PrinterInitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ PrinterDbPtr pDb, pDbEntry;
+ int driverCount = 0, i;
+ char **driverNames;
+ char *configDir;
+
+ /*
+ * this little test is just a warning at startup to make sure
+ * that the config directory exists.
+ *
+ * what this ugly looking if says is that if both ways of
+ * calling configDir works and both directories don't exist,
+ * then print an error saying we can't find the non-lang one.
+ */
+ if (((configDir = XpGetConfigDir(TRUE)) != NULL) &&
+ (access(configDir, F_OK) == 0))
+ {
+ xfree(configDir);
+ }
+ else if (((configDir = XpGetConfigDir(FALSE)) != NULL) &&
+ (access(configDir, F_OK) == 0))
+ {
+ xfree(configDir);
+ }
+ else {
+ ErrorF("Xp Extension: could not find config dir %s\n",
+ configDir ? configDir : XPRINTDIR);
+
+ if (configDir) xfree(configDir);
+ }
+
+ if(printerDb != (PrinterDbPtr)NULL)
+ FreePrinterDb();
+
+ /*
+ * Calling BuildPrinterDb serves to build the printer database,
+ * and to initialize the attribute store for each printer.
+ * The driver can, if it so desires, modify the attribute
+ * store at a later time.
+ */
+ if((pDb = BuildPrinterDb()) == (PrinterDbPtr)NULL) return;
+
+ /*
+ * We now have to decide how many screens to initialize, and call
+ * AddScreen for each one. The printerDb must be properly initialized
+ * for at least one screen's worth of printers prior to calling AddScreen
+ * because InitPrintDrivers reads the printerDb to determine which
+ * driver(s) to init on a particular screen.
+ * We put each driver's printers on a different
+ * screen, and call AddScreen for each screen/driver pair.
+ */
+ /* count the number of printers */
+ for(pDbEntry = pDb, driverCount = 0; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next, driverCount++)
+ ;
+ /*
+ * Allocate memory for the worst case - a driver per printer
+ */
+ driverNames = (char **)xalloc(sizeof(char *) * driverCount);
+
+ /*
+ * Assign the driver for the first printer to the first screen
+ */
+ pDb->screenNum = screenInfo.numScreens;
+ driverNames[0] = pDb->driverName;
+ driverCount = 1;
+ AddFormats(pScreenInfo, pDb->driverName);
+
+ /*
+ * For each printer, look to see if its driver is already assigned
+ * to a screen, and if so copy that screen number into the printerDb.
+ * Otherwise, assign a new screen number to the driver for this
+ * printer.
+ */
+ for(pDbEntry = pDb; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ Bool foundMatch;
+
+ for(i = 0, foundMatch = FALSE; i < driverCount; i++)
+ {
+ if(!strcmp(driverNames[i], pDbEntry->driverName))
+ {
+ foundMatch = TRUE;
+ pDbEntry->screenNum = screenInfo.numScreens + i;
+ break;
+ }
+ }
+ if(foundMatch == FALSE)
+ {
+ driverNames[driverCount] = pDbEntry->driverName;
+ pDbEntry->screenNum = screenInfo.numScreens + driverCount;
+ AddFormats(pScreenInfo, pDbEntry->driverName);
+ driverCount++;
+ }
+ }
+
+ for(i = 0; i < driverCount; i++)
+ {
+ int curScreen = screenInfo.numScreens;
+ if(AddScreen(InitPrintDrivers, argc, argv) < 0)
+ {
+ PrinterDbPtr pPrev;
+ /*
+ * AddScreen failed, so we pull the associated printers
+ * from the list.
+ */
+ ErrorF("Xp Extension: Could not add screen for driver %s\n",
+ driverNames[i]);
+ for(pPrev = pDbEntry = printerDb; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ if(pDbEntry->screenNum == curScreen)
+ {
+ if(pPrev == printerDb)
+ {
+ printerDb = pDbEntry->next;
+ pPrev = printerDb;
+ }
+ else
+ pPrev->next = pDbEntry->next;
+
+ xfree(pDbEntry->name);
+ xfree(pDbEntry);
+ pDbEntry = pPrev;
+ }
+ else
+ {
+ if(pDbEntry->screenNum > curScreen)
+ pDbEntry->screenNum--;
+ pPrev = pDbEntry;
+ }
+ }
+ }
+ }
+
+ xfree(driverNames);
+
+ AugmentFontPath();
+
+ if(pScreenInfo->numScreens > MAXSCREENS)
+ {
+ ErrorF("The number of printer screens requested ");
+ ErrorF("exceeds the allowable limit of %d screens.\n", MAXSCREENS);
+ ErrorF("Please reduce the number of requested printers in your ");
+ ErrorF("\nX%sprinters file.", display);
+ ErrorF("Server exiting...\n");
+ exit(-1);
+ }
+}
+
+/*
+ * InitPrintDrivers is called from dix:AddScreen. It in turn calls the
+ * driver initialization routine for any and all drivers which are
+ * implicated in supporting printers on the particular screen number
+ * specified by the "index" parameter. The printerDb variable is used
+ * to determine which printers are to be associated with a particular
+ * screen.
+ */
+static Bool
+InitPrintDrivers(index, pScreen, argc, argv)
+ int index;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+ PrinterDbPtr pDb, pDb2;
+
+ GenericScreenInit(index, pScreen, argc, argv);
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(pDb->screenNum == index)
+ {
+ Bool callInit = TRUE;
+ for(pDb2 = printerDb; pDb2 != pDb; pDb2 = pDb2->next)
+ {
+ if(!strcmp(pDb->driverName, pDb2->driverName))
+ {
+ callInit = FALSE;
+ break;
+ }
+ }
+ if(callInit == TRUE)
+ {
+ Bool (*initFunc)();
+ initFunc = GetInitFunc(pDb->driverName);
+ if(initFunc(index, pScreen, argc, argv) == FALSE)
+ {
+ /* XXX - What do I do if the driver's init fails? */
+ }
+ }
+ }
+ }
+ return TRUE;
+}
+
+void
+_XpVoidNoop()
+{
+ return;
+}
+
+Bool
+_XpBoolNoop()
+{
+ return TRUE;
+}
+
+/*
+ * GenericScreenInit - The common initializations required by all
+ * printer screens and drivers. It sets the screen's cursor functions
+ * to Noops, and computes the maximum screen (i.e. medium) dimensions.
+ */
+
+static void
+GenericScreenInit( index, pScreen, argc, argv )
+ int index;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+ int i;
+ float fWidth, fHeight, maxWidth, maxHeight;
+ unsigned short width, height;
+ PrinterDbPtr pDb, pDb2;
+ int res, maxRes;
+
+ /*
+ * Set the cursor ops to no-op functions.
+ */
+ pScreen->DisplayCursor = (DisplayCursorProcPtr)_XpBoolNoop;
+ pScreen->RealizeCursor = (RealizeCursorProcPtr)_XpBoolNoop;
+ pScreen->UnrealizeCursor = (UnrealizeCursorProcPtr)_XpBoolNoop;
+ pScreen->SetCursorPosition = (SetCursorPositionProcPtr)_XpBoolNoop;
+ pScreen->ConstrainCursor = (ConstrainCursorProcPtr)_XpVoidNoop;
+ pScreen->CursorLimits = (CursorLimitsProcPtr)_XpVoidNoop;
+ pScreen->RecolorCursor = (RecolorCursorProcPtr)_XpVoidNoop;
+
+ /*
+ * Find the largest paper size for all the printers on the given
+ * screen.
+ */
+ maxRes = 0;
+ maxWidth = maxHeight = 0.0;
+ for( pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(pDb->screenNum == index)
+ {
+
+ XpValidatePoolsRec *pValRec;
+ pVFunc dimensionsFunc;
+
+ GetDimFuncAndRec(pDb->driverName, &pValRec, &dimensionsFunc);
+ if(dimensionsFunc != (pVFunc)NULL)
+ dimensionsFunc(pDb->name, pValRec, &fWidth, &fHeight, &res);
+ else
+ XpGetMaxWidthHeightRes(pDb->name, pValRec, &fWidth,
+ &fHeight, &res);
+ if( res > maxRes )
+ maxRes = res;
+ if( fWidth > maxWidth )
+ maxWidth = fWidth;
+ if( fHeight > maxHeight )
+ maxHeight = fHeight;
+ }
+ }
+
+ width = (unsigned short) (maxWidth * maxRes / 25.4);
+ height = (unsigned short) (maxHeight * maxRes / 25.4);
+ pScreen->width = pScreen->height = ( width > height ) ? width :
+ height;
+
+ pScreen->mmWidth = pScreen->mmHeight = ( maxWidth > maxHeight ) ?
+ (unsigned short)(maxWidth + 0.5) :
+ (unsigned short)(maxHeight + 0.5);
+}
+
+/*
+ * QualifyName - takes an unqualified file name such as X6printers and
+ * a colon-separated list of directory path names such as
+ * /etc/opt/dt:/opt/dt/config.
+ *
+ * Returns a fully qualified file path name such as /etc/opt/dt/X6printers.
+ * The returned value is malloc'd, and the caller is responsible for
+ * freeing the associated memory.
+ */
+static char *
+QualifyName(fileName, searchPath)
+ char *fileName;
+ char *searchPath;
+{
+ char * curPath = searchPath;
+ char * nextPath;
+ char * chance;
+ FILE *pFile;
+
+ if (fileName == NULL || searchPath == NULL)
+ return NULL;
+
+ while (1) {
+ if ((nextPath = strchr(curPath, ':')) != NULL)
+ *nextPath = 0;
+
+ chance = (char *)xalloc(strlen(curPath) + strlen(fileName) + 2);
+ sprintf(chance,"%s/%s",curPath,fileName);
+
+ /* see if we can read from the file */
+ if((pFile = fopen(chance, "r")) != (FILE *)NULL)
+ {
+ fclose(pFile);
+ /* ... restore the colon, .... */
+ if (nextPath)
+ *nextPath = ':';
+
+ return chance;
+ }
+
+ xfree(chance);
+
+ if (nextPath == NULL) /* End of path list? */
+ break;
+
+ /* try the next path */
+ curPath = nextPath + 1;
+ }
+ return NULL;
+}
+
+/*
+ * FillPrinterListEntry fills in a single XpDiListEntry element with data
+ * derived from the supplied PrinterDbPtr element.
+ *
+ * XXX A smarter (i.e. future) version of this routine might inspect the
+ * XXX "locale" parameter and attempt to match the "description" and
+ * XXX "localeName" elements of the XpDiListEntry to the specified locale.
+ */
+static void
+FillPrinterListEntry(pEntry, pDb, localeLen, locale)
+ XpDiListEntry *pEntry;
+ PrinterDbPtr pDb;
+ int localeLen;
+ char *locale;
+{
+ static char *localeStr = (char *)NULL;
+
+ if(localeStr == (char *)NULL)
+ localeStr = strdup(setlocale(LC_ALL, (const char *)NULL));
+
+ pEntry->name = pDb->name;
+ pEntry->description =
+ (char*)XpGetPrinterAttribute(pDb->name, "descriptor");
+ pEntry->localeName = localeStr;
+ pEntry->rootWinId = WindowTable[pDb->screenNum]->drawable.id;
+}
+
+/*
+ * GetPrinterListInfo fills in the XpDiListEntry struct pointed to by the
+ * parameter pEntry with the information regarding the printer specified
+ * by the name and nameLen parameters. The pointers placed in the
+ * XpDiListEntry structure MUST NOT be freed by the caller. They are
+ * pointers into existing long-lived databases.
+ *
+ */
+static Bool
+GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
+ XpDiListEntry *pEntry;
+ int nameLen;
+ char *name;
+ int localeLen;
+ char *locale;
+{
+ PrinterDbPtr pDb, pDb2;
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
+ {
+ FillPrinterListEntry(pEntry, pDb, localeLen, locale);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*
+ * XpDiFreePrinterList is the approved method of releasing memory used
+ * for a printer list.
+ */
+void
+XpDiFreePrinterList(list)
+ XpDiListEntry **list;
+{
+ int i;
+
+ for(i = 0; list[i] != (XpDiListEntry *)NULL; i++)
+ xfree(list[i]);
+ xfree(list);
+}
+
+/*
+ * XpDiGetPrinterList returns a pointer to a NULL-terminated array of
+ * XpDiListEntry pointers. Each entry structure contains the name,
+ * description, root window, and locale of a printer. The call returns
+ * either a list of all printers configured on the server, or it returns
+ * the information for one specific printer depending on the values passed
+ * in. Non-NULL values passed in indicate that only the information for
+ * the one specific printer is desired, while NULL values indicate that
+ * the information for all printers is desired.
+ */
+XpDiListEntry **
+XpDiGetPrinterList(nameLen, name, localeLen, locale)
+ int nameLen;
+ char *name;
+ int localeLen;
+ char *locale;
+{
+ XpDiListEntry **pList;
+
+ if(!nameLen || name == (char *)NULL)
+ {
+ int i;
+ PrinterDbPtr pDb, pDb2;
+
+ for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
+ pDb = pDb->next, i++)
+ ;
+
+ if((pList = (XpDiListEntry **)xalloc((i+1) * sizeof(XpDiListEntry *)))
+ == (XpDiListEntry **)NULL)
+ return pList;
+
+ pList[i] = (XpDiListEntry *)NULL;
+ for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
+ pDb = pDb->next, i++)
+ {
+ if((pList[i] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry)))==
+ (XpDiListEntry *)NULL)
+ {
+ XpDiFreePrinterList(pList);
+ return (XpDiListEntry **)NULL;
+ }
+ FillPrinterListEntry(pList[i], pDb, localeLen, locale);
+ }
+ }
+ else
+ {
+ if((pList = (XpDiListEntry **)xalloc(2 * sizeof(XpDiListEntry *))) ==
+ (XpDiListEntry **)NULL)
+ return pList;
+
+ if((pList[0] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry))) ==
+ (XpDiListEntry *)NULL)
+ {
+ xfree(pList);
+ return (XpDiListEntry **)NULL;
+ }
+ pList[1] = (XpDiListEntry *)NULL;
+ if(GetPrinterListInfo(pList[0], nameLen, name, localeLen, locale) ==
+ FALSE)
+ {
+ xfree(pList[0]);
+ pList[0] = (XpDiListEntry *)NULL;
+ }
+ }
+ return pList;
+}
+
+WindowPtr
+XpDiValidatePrinter(printerName, printerNameLen)
+ char *printerName;
+ int printerNameLen;
+{
+ PrinterDbPtr pCurEntry;
+ WindowPtr pWin;
+
+ for(pCurEntry = printerDb;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
+ {
+ if(strlen(pCurEntry->name) == printerNameLen &&
+ !strncmp(pCurEntry->name, printerName, printerNameLen))
+ return WindowTable[pCurEntry->screenNum];
+ }
+ return (WindowPtr)NULL;
+}
+
+/*
+ * XpDiGetDriverName takes a screen index and a printer name, and returns
+ * a pointer to the name of the driver to be used for the specified printer
+ * on the specified screen.
+ */
+char *
+XpDiGetDriverName(index, printerName)
+ int index;
+ char *printerName;
+{
+
+ PrinterDbPtr pCurEntry;
+
+ for(pCurEntry = printerDb;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
+ {
+ if(pCurEntry->screenNum == index &&
+ !strcmp(pCurEntry->name, printerName))
+ return pCurEntry->driverName;
+ }
+
+ return (char *)NULL; /* XXX Should we supply a default driverName? */
+}
diff --git a/xc/programs/Xserver/Xprint/Oid.c b/xc/programs/Xserver/Xprint/Oid.c
new file mode 100644
index 000000000..2c967149a
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Oid.c
@@ -0,0 +1,3179 @@
+/* $XConsortium: Oid.c /main/2 1996/12/11 15:26:39 lehors $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.2 1998/12/20 11:57:25 dawes Exp $ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "os.h"
+#include "Oid.h"
+#include <X11/Xfuncs.h> /* for memmove */
+
+/*
+ * XpOidNotify value strings
+ */
+#define NOTIFY_EMAIL_STR "{{event-report-job-completed} electronic-mail}"
+#define NOTIFY_NONE_STR "{}"
+
+#define SafeStrLen(s) ((s) ? strlen((s)) : 0)
+
+/*
+ * entry type for the object identifier string map
+ */
+typedef struct _XpOidStringMapEntry
+{
+ const char* string;
+ int length;
+ int msg_set;
+ int msg_number;
+ const char* default_message;
+
+} XpOidStringMapEntry;
+
+/*
+ * include the auto-generated static XpOidStringMap
+ */
+#include "OidStrs.h"
+
+/*
+ * XpOid static function declarations
+ */
+static XpOid XpOidParse(const char* value_string,
+ const char** ptr_return);
+/*
+ * XpOidList static function declarations
+ */
+static XpOidList* XpOidListParse(const char* value_string,
+ const XpOidList* valid_oids,
+ const char** ptr_return, int i);
+
+/*
+ * XpOidList static function declarations
+ */
+static XpOidCardList* XpOidCardListParse(const char* value_string,
+ const XpOidCardList* valid_cards,
+ const char** ptr_return, int i);
+
+/*
+ * XpOidMediumSourceSize static function declarations
+ */
+static XpOidMediumSS* MediumSSParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return, int i);
+static XpOidMediumContinuousSize* MediumContinuousSizeParse(const char*,
+ const char**);
+static void MediumContinuousSizeDelete(XpOidMediumContinuousSize* me);
+static XpOidMediumDiscreteSizeList* MediumDiscreteSizeListParse(const char*,
+ const XpOidList*,
+ const char**,
+ int i);
+static void MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list);
+
+static BOOL ParseArea(const char* value_string,
+ const char** ptr_return,
+ XpOidArea* area_return);
+static BOOL ParseRealRange(const char* value_string,
+ const char** ptr_return,
+ XpOidRealRange* range_return);
+
+/*
+ * XpOidTrayMediumList static function declarations
+ */
+static XpOidTrayMediumList* TrayMediumListParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const char** ptr_return,
+ int i);
+static void TrayMediumListValidate(XpOidTrayMediumList* me,
+ const XpOidMediumSS* msss);
+
+/*
+ * XpOidDocFmt
+ */
+static BOOL XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
+ const char* value_string,
+ const char** ptr_return);
+
+/*
+ * XpOidDocFmtListParse
+ */
+static XpOidDocFmtList* XpOidDocFmtListParse(const char* value_string,
+ const XpOidDocFmtList* valid_fmts,
+ const char** ptr_return, int i);
+
+/*
+ * misc. parsing static function declarations
+ */
+static BOOL ParseBoolValue(const char* value_string,
+ const char** ptr_return,
+ BOOL* bool_return);
+static BOOL ParseRealValue(const char* value_string,
+ const char** ptr_return,
+ float* real_return);
+static BOOL ParseSeqEnd(
+ const char* value_string,
+ const char** ptr_return);
+static BOOL ParseSeqStart(
+ const char* value_string,
+ const char** ptr_return);
+static BOOL ParseUnspecifiedValue(
+ const char* value_string,
+ const char** ptr_return);
+static int SpanToken(
+ const char* string);
+static int SpanWhitespace(
+ const char* string);
+
+/*
+ * String comparison function.
+ */
+#ifdef HAVE_STRCASECMP
+# define StrnCaseCmp(s1, s2, len) strncasecmp(s1, s2, len)
+#else
+static int StrnCaseCmp(const char *s1, const char *s2, size_t len);
+#endif
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidString
+ *
+ * Description:
+ *
+ * Obtain the string representation of an XpOid.
+ *
+ * Example: XpOidString(xpoid_copy_count) returns "copy-count".
+ *
+ * Return value:
+ *
+ * A const pointer to the string.
+ */
+const char*
+XpOidString(XpOid xp_oid)
+{
+ /*
+ * XpOid enum values are index values into the string map
+ */
+ return XpOidStringMap[xp_oid].string;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidStringLength
+ *
+ * Description:
+ *
+ * Obtain the length of the string representation for a given
+ * XpOid.
+ *
+ * Return value:
+ *
+ * The string length in bytes.
+ *
+ */
+int
+XpOidStringLength(XpOid xp_oid)
+{
+ /*
+ * XpOid enum values are index values into the string map
+ */
+ return XpOidStringMap[xp_oid].length;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidFromString
+ *
+ * Description:
+ *
+ * Obtains the XpOid given a string representation of an XpOid.
+ *
+ * Example: XpOidFromString("copy-count") returns 'xpoid_copy_count'.
+ *
+ * Return value:
+ *
+ * The XpOid if successful. 'xpoid_none' if the string pointed to by
+ * 'value is not recognized or if 'value' is NULL.
+ */
+XpOid
+XpOidFromString(const char* value)
+{
+ if(value == (const char*)NULL)
+ return xpoid_none;
+ else
+ return XpOidParse(value, (const char**)NULL);
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidParse
+ *
+ * Description:
+ *
+ * Parse the next whitespace-delimited string from 'value_string'
+ * updating 'ptr_return' to point to the next unparsed location in
+ * 'value_string'. 'ptr_return' can be NULL.
+ *
+ * Return value:
+ *
+ * The corresponding XpOid for the parsed name string.
+ * A return value of xpoid_none is returned if the parsed name
+ * was not a valid oid or if no name was found.
+ *
+ */
+static XpOid
+XpOidParse(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ int length;
+ int i;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * get the whitespace-delimited token length
+ */
+ length = SpanToken(ptr);
+ /*
+ * match the oid string in the map
+ */
+ for(i = 0; i < XpOidStringMapCount; i++)
+ if(length == XpOidStringMap[i].length)
+ if(strncmp(ptr, XpOidStringMap[i].string, length) == 0)
+ break;
+ if(i == XpOidStringMapCount)
+ i = xpoid_none;
+ /*
+ * update the return pointer and return
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr+length;
+ return i;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListNew
+ *
+ * Description:
+ *
+ * Creates a new XpOidList initialized from a whitespace-delimited
+ * list of recognized string representations of oids. The returned
+ * list will contain only oids found within the passed 'valid_oids'
+ * XpOidList.
+ *
+ * Note: One may notice that in order to create an XpOidList with
+ * this function, an XpOidList is needed; the 'valid_oids' list
+ * is often an statically initialized structure. XpOidListInit
+ * can also be used.
+ *
+ * Return value:
+ *
+ * NULL if the passed 'value_string' is NULL.
+ *
+ * If the list indicated by 'value_string' is empty or contains only
+ * unrecognized oid string representations, a new XpOidList
+ * containing zero elements is returned.
+ *
+ * If 'valid_oids' is NULL all oids are considered valid.
+ *
+ */
+XpOidList*
+XpOidListNew(const char* value_string,
+ const XpOidList* valid_oids)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidList*)NULL;
+ else
+ {
+ const char* ptr;
+ return XpOidListParse(value_string, valid_oids, &ptr, 0);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListDelete
+ *
+ * Description:
+ *
+ * Frees the memory allocated for 'list'.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidListDelete(XpOidList* list)
+{
+ if(list != (XpOidList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListParse
+ *
+ * Description:
+ *
+ * This function recursively parses the whitespace-delimited list of
+ * oid string representations passed via 'value_string'. Oids are
+ * only added to the resulting list if they are found within the
+ * passed 'valid_oids' XpOidList.
+ *
+ * 'ptr_return' points to a char* variable allocated by the
+ * caller, and is really only of use during recursion (upon return to
+ * the original caller, it will point to the end of value_string).
+ *
+ * 'value_string' and 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ * A newly allocated and initialized XpOidList.
+ *
+ * If the list indicated by 'value_string' is empty or contains only
+ * unrecognized oid string representations, a new XpOidList
+ * containing zero elements is returned.
+ *
+ * If 'valid_oids' is NULL all oids are considered valid.
+ *
+ */
+static XpOidList*
+XpOidListParse(const char* value_string,
+ const XpOidList* valid_oids,
+ const char** ptr_return,
+ int i)
+{
+ XpOid oid;
+ XpOidList* list;
+ /*
+ * parse the next valid oid out of the value string
+ */
+ ptr_return = &value_string;
+ while(1)
+ {
+ if(**ptr_return == '\0')
+ {
+ /*
+ * end of value string; stop parsing
+ */
+ oid = xpoid_none;
+ break;
+ }
+ /*
+ * parse the next oid from the value
+ */
+ oid = XpOidParse(*ptr_return, ptr_return);
+ if(xpoid_none == oid)
+ {
+ /*
+ * unrecognized oid; keep parsing
+ */
+ continue;
+ }
+ if((const XpOidList*)NULL == valid_oids
+ ||
+ XpOidListHasOid(valid_oids, oid))
+ {
+ /*
+ * valid oid found; stop parsing
+ */
+ break;
+ }
+ }
+
+ if(oid == xpoid_none)
+ {
+ /*
+ * end of value string; allocate the list structure
+ */
+ list = (XpOidList*)XpOidCalloc(1, sizeof(XpOidList));
+ list->count = i;
+ list->list = (XpOid*)XpOidCalloc(i, sizeof(XpOid));
+ }
+ else
+ {
+ /*
+ * recurse
+ */
+ list = XpOidListParse(*ptr_return, valid_oids, ptr_return, i+1);
+ /*
+ * set the oid in the list
+ */
+ list->list[i] = oid;
+ }
+ /*
+ * return
+ */
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListHasOid
+ *
+ * Description:
+ *
+ * Determines if 'oid' is an element of 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the oid is found in the list.
+ *
+ * xFalse if the oid is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidListHasOid(const XpOidList* list, XpOid oid)
+{
+ int i;
+ if(list != (XpOidList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == oid)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListGetIndex
+ *
+ * Description:
+ *
+ * Returns the array index of 'oid' in 'list'
+ *
+ * Return value:
+ *
+ * The index of 'oid' in list.
+ *
+ * -1 if the oid is not in the list, or if 'list' is NULL.
+ *
+ */
+int
+XpOidListGetIndex(const XpOidList* list, XpOid oid)
+{
+ int i;
+ if(list != (XpOidList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == oid)
+ return i;
+ return -1;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidList structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char*
+XpOidListString(const XpOidList* me)
+{
+ int i;
+ int length;
+ char* str;
+ char* ptr;
+ /*
+ * allocate enough memory for the oid string representations,
+ * including intervening whitespace
+ */
+ for(i = 0, length = 0; i < XpOidListCount(me); i++)
+ length += XpOidStringLength(XpOidListGetOid(me, i)) + 1;
+ str = XpOidMalloc(length+1);
+ /*
+ * format the list
+ */
+ for(i = 0, ptr = str; i < XpOidListCount(me); i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i)));
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i)));
+#endif
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListNew
+ *
+ * Description:
+ *
+ * Creates a new instance of an empty XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * The new XpOidLinkedList.
+ *
+ */
+XpOidLinkedList*
+XpOidLinkedListNew()
+{
+ return (XpOidLinkedList*)XpOidCalloc(1, sizeof(XpOidLinkedList));
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListDelete
+ *
+ * Description:
+ *
+ * Frees the memory allocated for a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidLinkedListDelete(XpOidLinkedList* me)
+{
+ if(me != (XpOidLinkedList*)NULL)
+ {
+ while(me->head)
+ {
+ me->current = me->head;
+ me->head = me->current->next;
+ XpOidFree((char*)me->current);
+ }
+ XpOidFree((char*)me);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListGetOid
+ *
+ * Description:
+ *
+ * Retrieves the oid at position 'i' (zero-based) in the
+ * XpOidLinkedList 'me'.
+ *
+ * Return value:
+ *
+ * The oid at position 'i'.
+ *
+ * xpoid_none if the oid was not found, or the list is empty (or if
+ * the list contains xpoid_none at position 'i').
+ */
+XpOid
+XpOidLinkedListGetOid(XpOidLinkedList* me, int i)
+{
+ if(me == (XpOidLinkedList*)NULL || i < 0 || i >= me->count)
+ {
+ return xpoid_none;
+ }
+ else
+ {
+ me->current = me->head;
+ while(i--) me->current = me->current->next;
+ return me->current->oid;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListAddOid
+ *
+ * Description:
+ *
+ * Adds an oid to the end of an XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidLinkedListAddOid(XpOidLinkedList* me, XpOid oid)
+{
+ me->current = (XpOidNode)XpOidCalloc(1, sizeof(struct XpOidNodeStruct));
+ me->current->oid = oid;
+ ++me->count;
+ if(me->tail)
+ {
+ me->tail->next = me->current;
+ me->tail = me->current;
+ }
+ else
+ me->head = me->tail = me->current;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListGetIndex
+ *
+ * Description:
+ *
+ * Returns the position of an oid in a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * The zero-based position of 'oid' in the list.
+ *
+ * -1 if the oid is not in the list, or if 'me' is NULL.
+ *
+ */
+int
+XpOidLinkedListGetIndex(XpOidLinkedList* me, XpOid oid)
+{
+ if((XpOidLinkedList*)NULL != me)
+ {
+ int i = 0;
+ me->current = me->head;
+ while(me->current)
+ if(me->current->oid == oid)
+ {
+ return i;
+ }
+ else
+ {
+ ++i;
+ me->current = me->current->next;
+ }
+ }
+ return -1;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListHasOid
+ *
+ * Description:
+ *
+ * Determines if an oid is an element of a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * xTrue if the oid is found in the list.
+ *
+ * xFalse if the oid is not in the list, or if 'me' is NULL.
+ */
+BOOL
+XpOidLinkedListHasOid(XpOidLinkedList* me,
+ XpOid oid)
+{
+ if((XpOidLinkedList*)NULL != me)
+ {
+ me->current = me->head;
+ while(me->current)
+ if(me->current->oid == oid)
+ return xTrue;
+ else
+ me->current = me->current->next;
+ }
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListFirstOid
+ *
+ * Description:
+ *
+ * Positions the XpOidLinkedList 'current' pointer to the first entry
+ * in the list.
+ *
+ * Return value:
+ *
+ * The first oid in the list, or xpoid_none if the list NULL or
+ * empty.
+ */
+XpOid
+XpOidLinkedListFirstOid(XpOidLinkedList* me)
+{
+ if((XpOidLinkedList*)NULL != me && (me->current = me->head))
+ return me->current->oid;
+ else
+ return xpoid_none;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListNextOid
+ *
+ * Description:
+ *
+ * Positions the XpOidLinkedList 'current' pointer to the next entry
+ * in the list.
+ *
+ * Return value:
+ *
+ * The next oid, or xpoid_none if the end of the list has been
+ * reached.
+ */
+XpOid
+XpOidLinkedListNextOid(XpOidLinkedList* me)
+{
+ if(me->current ? me->current = me->current->next : xFalse)
+ return me->current->oid;
+ else
+ return xpoid_none;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSNew
+ *
+ * Description:
+ *
+ * Creates a new XpOidMediumSS initialized from a string value
+ * specified using the medium-source-sizes syntax. See
+ * MediumSSParse() below for parsing details.
+ *
+ * Return value:
+ *
+ * NULL if the passed 'value_string' is NULL, or if a syntax error is
+ * encountered while parsing the medium-source-sizes value.
+ *
+ */
+XpOidMediumSS*
+XpOidMediumSSNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidMediumSS*)NULL;
+ else
+ {
+ const char* ptr = value_string + SpanWhitespace(value_string);
+ if(*ptr == '\0')
+ return (XpOidMediumSS*)NULL;
+ else
+ return MediumSSParse(ptr, valid_trays, valid_medium_sizes,
+ &ptr, 0);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumSSParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumSS*
+MediumSSParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return,
+ int i)
+{
+ XpOidMediumSS* medium_ss;
+ XpOidMediumSourceSize mss;
+ /*
+ * check for the start of a new MediumSourceSize sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * check for an unspecified tray value
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mss.input_tray = xpoid_unspecified;
+ else
+ {
+ const char* tray_str;
+ *ptr_return += SpanWhitespace(*ptr_return);
+ tray_str = *ptr_return;
+ /*
+ * parse out the input tray
+ */
+ mss.input_tray = XpOidParse(*ptr_return, ptr_return);
+ if((const XpOidList*)NULL != valid_trays
+ &&
+ !XpOidListHasOid(valid_trays, mss.input_tray)
+ )
+ mss.input_tray = xpoid_none;
+ if(xpoid_none == mss.input_tray)
+ {
+ char* invalid_tray_str;
+ int len = *ptr_return - tray_str;
+ if(len > 0)
+ {
+ invalid_tray_str = XpOidMalloc(len+1);
+ strncpy(invalid_tray_str, tray_str, len);
+ invalid_tray_str[len] = '\0';
+ ErrorF("%s\nInvalid tray (%s) found. Will attempt to continue parsing.\n",
+ XPMSG_WARN_MSS, invalid_tray_str);
+ XpOidFree(invalid_tray_str);
+ }
+ }
+ }
+ /*
+ * attempt to parse a Continuous MediumSize sequence
+ */
+ mss.ms.continuous_size =
+ MediumContinuousSizeParse(*ptr_return, ptr_return);
+ if(mss.ms.continuous_size != (XpOidMediumContinuousSize*)NULL)
+ {
+ mss.mstag = XpOidMediumSS_CONTINUOUS;
+ }
+ else
+ {
+ /*
+ * not continuous, try Discrete MediumSize
+ */
+ mss.ms.discrete =
+ MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, 0);
+ if(mss.ms.discrete == (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ const char* tray_str;
+ /*
+ * syntax error (MediumDiscreteSizeListParse reports error)
+ */
+ switch(mss.input_tray)
+ {
+ case xpoid_none:
+ tray_str = "an invalid";
+ break;
+ case xpoid_unspecified:
+ tray_str = "default (tray specifier omitted)";
+ break;
+ default:
+ tray_str = XpOidString(mss.input_tray);
+ break;
+ }
+ ErrorF("%s\nError occurred while parsing medium sizes for %s tray.\n",
+ XPMSG_WARN_MSS, tray_str);
+ return NULL;
+ }
+ mss.mstag = XpOidMediumSS_DISCRETE;
+ }
+ /*
+ * parse out the MediumSourceSize sequence end
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nSequence End expected. Unparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return NULL;
+ }
+ /*
+ * recurse to parse the next MediumSourceSize sequence
+ */
+ medium_ss = MediumSSParse(*ptr_return,
+ valid_trays, valid_medium_sizes,
+ ptr_return,
+ xpoid_none == mss.input_tray ? i : i+1);
+ if(medium_ss == (XpOidMediumSS*)NULL
+ ||
+ xpoid_none == mss.input_tray)
+ {
+ /*
+ * syntax error or invalid tray - clean up
+ */
+ switch(mss.mstag)
+ {
+ case XpOidMediumSS_CONTINUOUS:
+ MediumContinuousSizeDelete(mss.ms.continuous_size);
+ break;
+ case XpOidMediumSS_DISCRETE:
+ MediumDiscreteSizeListDelete(mss.ms.discrete);
+ break;
+ }
+ if(medium_ss == (XpOidMediumSS*)NULL)
+ /*
+ * syntax error - return
+ */
+ return NULL;
+ }
+ if(xpoid_none != mss.input_tray)
+ {
+ /*
+ * copy the current MediumSourceSize into the array
+ */
+ memmove((medium_ss->mss)+i, &mss, sizeof(XpOidMediumSourceSize));
+ }
+ }
+ else
+ {
+ /*
+ * MediumSourceSize sequence start not found
+ */
+ if(**ptr_return == '\0')
+ {
+ if(0 == i)
+ {
+ ErrorF("%s\nNo valid trays found.\n", XPMSG_WARN_MSS);
+ return NULL;
+ }
+ /*
+ * end of value string; allocate the MediumSS structure
+ */
+ medium_ss = (XpOidMediumSS*)XpOidCalloc(1, sizeof(XpOidMediumSS));
+ medium_ss->count = i;
+ medium_ss->mss = (XpOidMediumSourceSize*)
+ XpOidCalloc(i, sizeof(XpOidMediumSourceSize));
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nSequence Start expected.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return NULL;
+ }
+ }
+ return medium_ss;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+void
+XpOidMediumSSDelete(XpOidMediumSS* me)
+{
+ if(me != (XpOidMediumSS*)NULL)
+ {
+ int i;
+ for(i = 0; i < me->count; i++)
+ {
+ switch((me->mss)[i].mstag)
+ {
+ case XpOidMediumSS_CONTINUOUS:
+ MediumContinuousSizeDelete((me->mss)[i].ms.continuous_size);
+ break;
+ case XpOidMediumSS_DISCRETE:
+ MediumDiscreteSizeListDelete((me->mss)[i].ms.discrete);
+ break;
+ }
+ }
+ XpOidFree((char*)me);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSHasSize
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+BOOL
+XpOidMediumSSHasSize(XpOidMediumSS* me, XpOid page_size)
+{
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+
+ if(me != (XpOidMediumSS*)NULL && page_size != xpoid_none)
+ for(i_mss = 0; i_mss < me->count; i_mss++)
+ {
+ switch((me->mss)[i_mss].mstag)
+ {
+ case XpOidMediumSS_DISCRETE:
+ ds_list = (me->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ return xTrue;
+ break;
+
+ case XpOidMediumSS_CONTINUOUS:
+ /*
+ * unsupported
+ */
+ break;
+ }
+ }
+ /*
+ * return
+ */
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidMediumSS structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char* XpOidMediumSSString(const XpOidMediumSS* me)
+{
+ int itray, isize;
+ int valid_size_count;
+ int length;
+ char* str;
+ char* ptr;
+ XpOidMediumDiscreteSize* ds;
+ char buf[128];
+ /*
+ * determine the size of the string representation
+ */
+ for(itray = 0, length = 0; itray < XpOidMediumSSCount(me); itray++)
+ {
+ if(xpoid_none == me->mss[itray].input_tray
+ ||
+ XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag)
+ {
+ /*
+ * skip invalid tray or unsupported continuous size spec
+ */
+ continue;
+ }
+ for(isize = 0, valid_size_count = 0;
+ isize < me->mss[itray].ms.discrete->count;
+ isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size == xpoid_none)
+ continue;
+ ++valid_size_count;
+ length += XpOidStringLength(ds->page_size);
+ length += ds->long_edge_feeds ? 4 : 5; /* "True" or "False" */
+#if defined(sun) && !defined(SVR4)
+ sprintf(buf, "{%.4f %.4f %.4f %.4f}",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+ length += strlen(buf);
+#else
+ length += sprintf(buf, "{%.4f %.4f %.4f %.4f}",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+#endif
+ length += 5; /* "{<size> <feed> <area>} " */
+ }
+ if(valid_size_count == 0)
+ {
+ /*
+ * no valid sizes, skip
+ */
+ continue;
+ }
+ if(xpoid_unspecified == me->mss[itray].input_tray)
+ length += 2; /* "''" */
+ else
+ length += XpOidStringLength(me->mss[itray].input_tray);
+ length += 4; /* "{<tray> <sizes>} " */
+ }
+ /*
+ * allocate
+ */
+ str = XpOidMalloc(length+1);
+ /*
+ * format
+ */
+ for(itray = 0, ptr = str; itray < XpOidMediumSSCount(me); itray++)
+ {
+ if(xpoid_none == me->mss[itray].input_tray
+ ||
+ XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag)
+ {
+ /*
+ * skip invalid tray or unsupported continuous size spec
+ */
+ continue;
+ }
+ /*
+ * check to ensure all of the specified sizes are valid
+ */
+ for(isize = 0, valid_size_count = 0;
+ isize < me->mss[itray].ms.discrete->count;
+ isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size != xpoid_none)
+ ++valid_size_count;
+ }
+ if(valid_size_count == 0)
+ {
+ /*
+ * no valid sizes, skip
+ */
+ continue;
+ }
+
+ if(xpoid_unspecified == me->mss[itray].input_tray)
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{'' ");
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{'' ");
+#endif
+ }
+ else
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s ", XpOidString(me->mss[itray].input_tray));
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{%s ",
+ XpOidString(me->mss[itray].input_tray));
+#endif
+ }
+ for(isize = 0; isize < me->mss[itray].ms.discrete->count; isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size != xpoid_none)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ",
+ XpOidString(ds->page_size),
+ ds->long_edge_feeds ? "True" : "False",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ",
+ XpOidString(ds->page_size),
+ ds->long_edge_feeds ? "True" : "False",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+#endif
+ }
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "} ");
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "} ");
+#endif
+ }
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumContinuousSizeParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumContinuousSize*
+MediumContinuousSizeParse(const char* value_string,
+ const char** ptr_return)
+{
+ const char* first_nonws_ptr;
+ XpOidMediumContinuousSize* mcs = NULL;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the MediumSize sequence start char
+ */
+ if(!ParseSeqStart(first_nonws_ptr, ptr_return))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * peek ahead to see if it looks like we actually have a continuous
+ * size spec (looking for the sequence start char on the 1st range spec)
+ */
+ if(!ParseSeqStart(*ptr_return, (const char**)NULL))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * Ok, let's go for it
+ */
+ mcs = (XpOidMediumContinuousSize*)
+ XpOidCalloc(1, sizeof(XpOidMediumContinuousSize));
+ /*
+ * "range across the feed direction"
+ */
+ if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_across_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "increment across the feed direction" (optional, default 0)
+ */
+ if(!ParseUnspecifiedValue(*ptr_return, ptr_return))
+ if(!ParseRealValue(*ptr_return, ptr_return,
+ &mcs->increment_across_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "range in the feed direction"
+ */
+ if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_in_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "increment in the feed direction" (optional, default 0)
+ */
+ if(!ParseUnspecifiedValue(*ptr_return, ptr_return))
+ if(!ParseRealValue(*ptr_return, ptr_return,
+ &mcs->increment_in_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "long edge feeds" flag (default TRUE)
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mcs->long_edge_feeds = xTrue;
+ else
+ if(!ParseBoolValue(*ptr_return, ptr_return, &mcs->long_edge_feeds))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "generic assured reproduction area"
+ */
+ if(!ParseArea(*ptr_return, ptr_return, &mcs->assured_reproduction_area))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * parse out the MediumSize sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * return
+ */
+ return mcs;
+
+
+ MediumContinuousSizeParse_error:
+ /*
+ * syntax error - don't log since this function may be called
+ * as a lookahead
+ */
+ *ptr_return = first_nonws_ptr;
+ XpOidFree((char*)mcs);
+ return NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumContinuousSizeDelete
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static void
+MediumContinuousSizeDelete(XpOidMediumContinuousSize* me)
+{
+ XpOidFree((char*)me);
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumDiscreteSizeListParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumDiscreteSizeList*
+MediumDiscreteSizeListParse(const char* value_string,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return,
+ int i)
+{
+ XpOidMediumDiscreteSizeList* list;
+ XpOidMediumDiscreteSize mds;
+ /*
+ * check for the start of a new MediumSize sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * "page size"
+ */
+ mds.page_size = XpOidParse(*ptr_return, ptr_return);
+ if((const XpOidList*)NULL != valid_medium_sizes
+ &&
+ !XpOidListHasOid(valid_medium_sizes, mds.page_size)
+ )
+ mds.page_size = xpoid_none;
+ /*
+ * "long edge feeds" flag (default TRUE)
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mds.long_edge_feeds = xTrue;
+ else
+ if(!ParseBoolValue(*ptr_return, ptr_return,
+ &mds.long_edge_feeds))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nBoolean expected.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * "assured reproduction area"
+ */
+ if(!ParseArea(*ptr_return, ptr_return,
+ &mds.assured_reproduction_area))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nArea specification error.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * parse out the MediumSize sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ ErrorF("%s\nSequence End expected. Unparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * recurse to parse the next Discrete MediumSize sequence
+ */
+ if(mds.page_size == xpoid_none)
+ {
+ list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, i);
+ }
+ else
+ {
+ list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, i+1);
+ if(list != (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ /*
+ * copy the current discrete MediumSize into the list
+ */
+ memmove((list->list)+i, &mds, sizeof(XpOidMediumDiscreteSize));
+ }
+ }
+ }
+ else
+ {
+ /*
+ * MediumSize sequence start not found; end of the discrete sizes
+ * list
+ */
+ if(0 == i)
+ {
+ ErrorF("%s\nNo valid medium sizes found for tray.\n",
+ XPMSG_WARN_MSS);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ list = (XpOidMediumDiscreteSizeList*)
+ XpOidCalloc(1, sizeof(XpOidMediumDiscreteSizeList));
+ list->count = i;
+ list->list = (XpOidMediumDiscreteSize*)
+ XpOidCalloc(i, sizeof(XpOidMediumDiscreteSize));
+ }
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumDiscreteSizeListDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static void
+MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list)
+{
+ if(list != (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListNew
+ *
+ * Description:
+ *
+ * Only need the valid trays; validation requires bumping up against
+ * msss using TrayMediumListValidate; this needs valid trays
+ * because of unspecified trays ion msss, but
+ * TrayMediumListValidate will take care of invalid sizes...
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+XpOidTrayMediumList*
+XpOidTrayMediumListNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidTrayMediumList*)NULL;
+ else
+ {
+ const char* ptr;
+ XpOidTrayMediumList* me;
+ me = TrayMediumListParse(value_string, valid_trays, &ptr, 0);
+ if((XpOidTrayMediumList*)NULL != me)
+ TrayMediumListValidate(me, msss);
+ return me;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+void
+XpOidTrayMediumListDelete(XpOidTrayMediumList* list)
+{
+ if(list != (XpOidTrayMediumList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: TrayMediumListParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidTrayMediumList*
+TrayMediumListParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const char** ptr_return, int i)
+{
+ XpOidTrayMedium tm;
+ XpOidTrayMediumList* list;
+ /*
+ * check for the start of a new InputTrayMedium sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * "input tray"
+ */
+ tm.input_tray = XpOidParse(*ptr_return, ptr_return);
+ if((XpOidList*)NULL != valid_trays
+ &&
+ !XpOidListHasOid(valid_trays, tm.input_tray)
+ )
+ tm.input_tray = xpoid_none;
+ /*
+ * "medium"
+ */
+ tm.medium = XpOidParse(*ptr_return, ptr_return);
+ /*
+ * parse out the InputTrayMedium sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ ErrorF("%s\n", XPMSG_WARN_ITM);
+ return NULL;
+ }
+ /*
+ * recurse to parse the next InputTrayMedium sequence
+ */
+ list = TrayMediumListParse(*ptr_return, valid_trays, ptr_return, i+1);
+ if(list != (XpOidTrayMediumList*)NULL)
+ {
+ /*
+ * copy the current InputTrayMedium into the list
+ */
+ memmove((list->list)+i, &tm, sizeof(XpOidTrayMedium));
+ }
+ }
+ else
+ {
+ /*
+ * InputTrayMedium sequence start not found
+ */
+ if(**ptr_return == '\0')
+ {
+ /*
+ * end of the list
+ */
+ list = (XpOidTrayMediumList*)
+ XpOidCalloc(1, sizeof(XpOidTrayMediumList));
+ list->count = i;
+ list->list = (XpOidTrayMedium*)
+ XpOidCalloc(i, sizeof(XpOidTrayMedium));
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\n", XPMSG_WARN_ITM);
+ return NULL;
+ }
+ }
+ /*
+ * return
+ */
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: TrayMediumListValidate
+ *
+ * Description:
+ *
+ * Validate the input-trays-medium list based on a passed
+ * medium-source-sizes-supported structure. The validated
+ * input-trays-medium list will have the same number of entries upon
+ * return from this function. Invalid entries are indicated by
+ * setting the tray specification to xpoid_none.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+static void
+TrayMediumListValidate(XpOidTrayMediumList* me,
+ const XpOidMediumSS* msss)
+{
+ int i_mss, i_ds, i_itm;
+ XpOidMediumDiscreteSizeList* ds_list;
+ int tray_count;
+ XpOid current_tray, current_medium;
+ XpOidMediumDiscreteSizeList* unspecified_tray_ds;
+ XpOidMediumDiscreteSizeList* tray_ds;
+
+ if(msss == (XpOidMediumSS*)NULL
+ ||
+ me == (XpOidTrayMediumList*)NULL)
+ {
+ return;
+ }
+ /*
+ * loop through the input trays medium list
+ */
+ for(i_itm = 0; i_itm < XpOidTrayMediumListCount(me); i_itm++)
+ {
+ current_tray = XpOidTrayMediumListTray(me, i_itm);
+ if(current_tray == xpoid_none)
+ continue;
+ current_medium = XpOidTrayMediumListMedium(me, i_itm);
+ if(current_medium == xpoid_none)
+ {
+ /*
+ * no medium; invalidate this entry
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ continue;
+ }
+ /*
+ * loop through the MediumSourceSizes, looking for an appropriate
+ * discrete sizes spec for the current tray
+ */
+ unspecified_tray_ds = (XpOidMediumDiscreteSizeList*)NULL;
+ tray_ds = (XpOidMediumDiscreteSizeList*)NULL;
+ for(i_mss = 0;
+ i_mss < msss->count &&
+ tray_ds == (XpOidMediumDiscreteSizeList*)NULL;
+ i_mss++)
+ {
+ switch((msss->mss)[i_mss].mstag)
+ {
+ case XpOidMediumSS_DISCRETE:
+ if((msss->mss)[i_mss].input_tray == current_tray)
+ tray_ds = (msss->mss)[i_mss].ms.discrete;
+ else if((msss->mss)[i_mss].input_tray == xpoid_unspecified)
+ unspecified_tray_ds = (msss->mss)[i_mss].ms.discrete;
+ break;
+
+ case XpOidMediumSS_CONTINUOUS:
+ /*
+ * unsupported
+ */
+ break;
+ }
+ }
+ /*
+ * if the tray was not matched, use the unspecified tray size
+ * list
+ */
+ if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ /*
+ * not even an unspecified tray, invalidate this
+ * input-trays-medium entry.
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ continue;
+ }
+ else
+ tray_ds = unspecified_tray_ds;
+ /*
+ * loop through the discrete sizes list, looking for a size that
+ * matches the medium for the current input tray
+ */
+ for(i_ds = 0; i_ds < tray_ds->count; i_ds++)
+ {
+ /*
+ * check to see if the current input tray's medium size
+ * matches the current discrete size
+ *
+ * Note: in the CDEnext SI, medium identifiers coincide with
+ * medium-size identifiers. If the DP-Medium object is
+ * ever implemented, this check would need to be
+ * changed so that the input tray's medium size is
+ * obtained from the indicated Medium object, and not
+ * inferred from the medium identifier itself.
+ */
+ if((tray_ds->list)[i_ds].page_size == current_medium)
+ {
+ /*
+ * The current input tray's medium size matches the
+ * current discrete medium size.
+ */
+ break;
+ }
+ }
+ if(i_ds == tray_ds->count)
+ {
+ /*
+ * The current input tray's medium size was not found in the
+ * discrete size list; mark the input tray medium entry
+ * invalid
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ }
+
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidTrayMediumList structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char* XpOidTrayMediumListString(const XpOidTrayMediumList* me)
+{
+ int i;
+ int length;
+ char* str;
+ char* ptr;
+ XpOid tray;
+ /*
+ * allocate enough memory for the string representation,
+ * including intervening delimiters and whitespace
+ */
+ for(i = 0, length = 0; i < XpOidTrayMediumListCount(me); i++)
+ {
+ tray = XpOidTrayMediumListTray(me, i);
+ if(xpoid_none != tray)
+ {
+ length += XpOidStringLength(tray);
+ length += XpOidStringLength(XpOidTrayMediumListMedium(me, i));
+ length += 4;
+ }
+ }
+ str = XpOidMalloc(length+1);
+ /*
+ * format the list
+ */
+ for(i = 0, ptr = str; i < XpOidTrayMediumListCount(me); i++)
+ {
+ tray = XpOidTrayMediumListTray(me, i);
+ if(xpoid_none != tray)
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s %s} ",
+ XpOidString(tray),
+ XpOidString(XpOidTrayMediumListMedium(me, i)));
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{%s %s} ",
+ XpOidString(tray),
+ XpOidString(XpOidTrayMediumListMedium(me, i)));
+#endif
+ }
+ }
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListHasTray
+ *
+ * Description:
+ *
+ * Determines if 'tray' is found in 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the tray is found in the list.
+ *
+ * xFalse if the tray is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray)
+{
+ int i;
+ if(list != (XpOidTrayMediumList*)NULL && tray != xpoid_none)
+ for(i = 0; i < list->count; i++)
+ if(XpOidTrayMediumListTray(list, i) == tray)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseArea
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a XpOidArea.
+ *
+ * Return value:
+ *
+ * xTrue if the XpOidArea was successfully parsed. ptr_return is
+ * updated to point to location where the parsing ended.
+ *
+ * xFalse if a XpOidArea was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseArea(const char* value_string,
+ const char** ptr_return,
+ XpOidArea* area_return)
+{
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the area sequence start
+ */
+ if(!ParseSeqStart(first_nonws_ptr, &ptr))
+ goto ParseArea_error;
+ /*
+ * parse the minimum x value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->minimum_x : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the maximum x value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->maximum_x : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the minimum y value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->minimum_y : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the maximum y value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->maximum_y : NULL))
+ goto ParseArea_error;
+ /*
+ * parse out the area sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto ParseArea_error;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return xTrue;
+
+
+ ParseArea_error:
+ /*
+ * syntax error
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseRealRange
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a
+ * XpOidRealRange.
+ *
+ * Return value:
+ *
+ * xTrue if the XpOidRealRange was successfully
+ * parsed. ptr_return is updated to point to location where the
+ * parsing ended.
+ *
+ * xFalse if a XpOidRealRange was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseRealRange(const char* value_string,
+ const char** ptr_return,
+ XpOidRealRange* range_return)
+{
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the range sequence start
+ */
+ if(!ParseSeqStart(first_nonws_ptr, &ptr))
+ goto ParseRealRange_error;
+ /*
+ * parse the lower bound
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ range_return ? &range_return->lower_bound : NULL))
+ goto ParseRealRange_error;
+ /*
+ * parse the upper bound
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ range_return ? &range_return->upper_bound : NULL))
+ goto ParseRealRange_error;
+ /*
+ * parse out the range sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto ParseRealRange_error;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return xTrue;
+
+
+ ParseRealRange_error:
+ /*
+ * syntax error
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidNotifyParse
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidNotify XpOidNotifyParse(const char* value_string)
+{
+ const char* ptr = value_string;
+
+ if(value_string == (const char*)NULL)
+ return XPOID_NOTIFY_NONE;
+ /*
+ * look for an event handling profile sequence start
+ */
+ if(!ParseSeqStart(value_string, &ptr))
+ {
+ if('\0' == *ptr)
+ /*
+ * empty value is valid
+ */
+ return XPOID_NOTIFY_NONE;
+ else
+ return XPOID_NOTIFY_UNSUPPORTED;
+ }
+ /*
+ * look for an event set sequence start
+ */
+ if(!ParseSeqStart(ptr, &ptr))
+ {
+ /*
+ * check for an empty event handling profile
+ */
+ if(ParseSeqEnd(ptr, &ptr))
+ {
+ ptr += SpanWhitespace(ptr);
+ if(*ptr == '\0')
+ /*
+ * valid empty event handling profile sequence
+ */
+ return XPOID_NOTIFY_NONE;
+ }
+ return XPOID_NOTIFY_UNSUPPORTED;
+ }
+ /*
+ * the only event in the set should be report job completed
+ */
+ if(xpoid_val_event_report_job_completed != XpOidParse(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * event set sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * delivery method of electronic mail
+ */
+ if(xpoid_val_delivery_method_electronic_mail != XpOidParse(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * event handling profile sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * end of value
+ */
+ ptr += SpanWhitespace(ptr);
+ if('\0' == *ptr)
+ /*
+ * valid supported notification profile
+ */
+ return XPOID_NOTIFY_EMAIL;
+ else
+ return XPOID_NOTIFY_UNSUPPORTED;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidNotifyString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+const char* XpOidNotifyString(XpOidNotify notify)
+{
+ switch(notify)
+ {
+ case XPOID_NOTIFY_UNSUPPORTED:
+ return (const char*)NULL;
+ break;
+ case XPOID_NOTIFY_NONE:
+ return NOTIFY_NONE_STR;
+ break;
+ case XPOID_NOTIFY_EMAIL:
+ return NOTIFY_EMAIL_STR;
+ break;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidDocFmt*
+XpOidDocFmtNew(const char* value_string)
+{
+ XpOidDocFmt* doc_fmt;
+ const char* ptr;
+
+ if((const char*)NULL == value_string)
+ return (XpOidDocFmt*)NULL;
+ ptr = value_string + SpanWhitespace(value_string);
+ if('\0' == *ptr)
+ return (XpOidDocFmt*)NULL;
+ /*
+ * get the document format from the value string
+ */
+ doc_fmt = (XpOidDocFmt*)XpOidCalloc(1, sizeof(XpOidDocFmt));
+ if(xTrue == XpOidDocFmtNext(doc_fmt, ptr, &ptr))
+ {
+ /*
+ * verify that the document format is the only value specified
+ */
+ ptr += SpanWhitespace(ptr);
+ if('\0' == *ptr)
+ /*
+ * valid document-format value
+ */
+ return doc_fmt;
+ }
+ /*
+ * invalid
+ */
+ XpOidDocFmtDelete(doc_fmt);
+ ErrorF("%s\n", XPMSG_WARN_DOC_FMT);
+ return (XpOidDocFmt*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidDocFmtDelete(XpOidDocFmt* doc_fmt)
+{
+ if((XpOidDocFmt*)NULL != doc_fmt)
+ {
+ XpOidFree(doc_fmt->format);
+ XpOidFree(doc_fmt->variant);
+ XpOidFree(doc_fmt->version);
+ XpOidFree(doc_fmt);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidDocFmtString(XpOidDocFmt* doc_fmt)
+{
+ if((XpOidDocFmt*)NULL != doc_fmt)
+ {
+ if((char*)NULL != doc_fmt->format)
+ {
+ char* str = XpOidMalloc(1+SafeStrLen(doc_fmt->format)+
+ 1+SafeStrLen(doc_fmt->variant)+
+ 1+SafeStrLen(doc_fmt->version)+
+ 1+1);
+ sprintf(str, "{%s %s %s}", doc_fmt->format,
+ (char*)NULL != doc_fmt->variant ? doc_fmt->variant : "",
+ (char*)NULL != doc_fmt->version ? doc_fmt->version : "");
+ return str;
+ }
+ }
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtNext
+ *
+ * Description:
+ *
+ * Assumes non-NULL value string.
+ *
+ * Return value:
+ *
+ *
+ */
+static BOOL
+XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
+ const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ const char* first_nonws_ptr;
+ const char* format;
+ const char* variant;
+ const char* version;
+ int format_len;
+ int variant_len;
+ int version_len;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ first_nonws_ptr = ptr;
+ /*
+ * sequence start
+ */
+ if(!ParseSeqStart(ptr, &ptr))
+ goto XpOidDocFmtNext_error;
+ /*
+ * skip whitepace to the start of the document format, and save the
+ * location
+ */
+ ptr += SpanWhitespace(ptr);
+ format = ptr;
+ /*
+ * document format
+ */
+ if(0 == (format_len = SpanToken(ptr)))
+ goto XpOidDocFmtNext_error;
+ ptr += format_len;
+ /*
+ * optional variant
+ */
+ ptr += SpanWhitespace(ptr);
+ variant = ptr;
+ if(0 != (variant_len = SpanToken(ptr)))
+ {
+ ptr += variant_len;
+ /*
+ * optional version
+ */
+ ptr += SpanWhitespace(ptr);
+ version = ptr;
+ version_len = SpanToken(ptr);
+ ptr += version_len;
+ }
+ else
+ version_len = 0;
+ /*
+ * sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto XpOidDocFmtNext_error;
+ /*
+ * update return pointer
+ */
+ if((const char**)NULL != ptr_return)
+ *ptr_return = ptr;
+ /*
+ * update the passed document format struct
+ */
+ memset(doc_fmt, 0, sizeof(XpOidDocFmt));
+ doc_fmt->format = XpOidMalloc(format_len+1);
+ strncpy(doc_fmt->format, format, format_len);
+ doc_fmt->format[format_len] = '\0';
+ if(0 < variant_len)
+ {
+ doc_fmt->variant = XpOidMalloc(variant_len+1);
+ strncpy(doc_fmt->variant, variant, variant_len);
+ doc_fmt->variant[variant_len] = '\0';
+ if(0 < version_len)
+ {
+ doc_fmt->version = XpOidMalloc(version_len+1);
+ strncpy(doc_fmt->version, version, version_len);
+ doc_fmt->version[version_len] = '\0';
+ }
+ }
+ return xTrue;
+
+ XpOidDocFmtNext_error:
+ if((const char**)NULL != ptr_return)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidDocFmtList*
+XpOidDocFmtListNew(const char* value_string,
+ const XpOidDocFmtList* valid_fmts)
+{
+ if((char*)NULL != value_string)
+ {
+ const char* ptr;
+ return XpOidDocFmtListParse(value_string, valid_fmts, &ptr, 0);
+ }
+ return (XpOidDocFmtList*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidDocFmtListDelete(XpOidDocFmtList* list)
+{
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ int i;
+ for(i = 0; i < list->count; i++)
+ {
+ XpOidFree(list->list[i].format);
+ XpOidFree(list->list[i].variant);
+ XpOidFree(list->list[i].version);
+ }
+ XpOidFree(list->list);
+ XpOidFree(list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListString
+ *
+ * Description:
+ *
+ * Assumes the passed structure is valid.
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidDocFmtListString(const XpOidDocFmtList* list)
+{
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ if(0 < list->count)
+ {
+ int i;
+ int str_len;
+ char* str;
+ char* ptr;
+ /*
+ * allocate the return string
+ */
+ for(i = 0, str_len = 0; i < list->count; i++)
+ {
+ str_len +=
+ 1 + SafeStrLen(list->list[i].format) +
+ 1 + SafeStrLen(list->list[i].variant) +
+ 1 + SafeStrLen(list->list[i].version) + 2;
+ }
+ str = XpOidMalloc(str_len+1);
+ /*
+ * print the list into the string and return it
+ */
+ ptr = str;
+ for(i = 0; i < list->count; i++)
+ {
+ XpOidDocFmt* df = &list->list[i];
+
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s %s %s} ",
+ df->format,
+ (char*)NULL != df->variant ? df->variant : "",
+ (char*)NULL != df->version ? df->version : "");
+ ptr += strlen(ptr);
+#else
+ ptr +=
+ sprintf(ptr, "{%s %s %s} ",
+ df->format,
+ (char*)NULL != df->variant ? df->variant : "",
+ (char*)NULL != df->version ? df->version : "");
+#endif
+ }
+ return str;
+ }
+ }
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListParse
+ *
+ * Description:
+ *
+ * Assumes the passed value_string and ptr_return are non-NULL.
+ *
+ * Return value:
+ *
+ *
+ */
+static XpOidDocFmtList*
+XpOidDocFmtListParse(const char* value_string,
+ const XpOidDocFmtList* valid_fmts,
+ const char** ptr_return,
+ int i)
+{
+ XpOidDocFmt doc_fmt;
+ XpOidDocFmtList* list;
+ BOOL status;
+ /*
+ * get the next document-format from the value string, skipping
+ * values not found in the passed list of valid formats
+ */
+ *ptr_return = value_string;
+ while((status = XpOidDocFmtNext(&doc_fmt, *ptr_return, ptr_return))
+ &&
+ (const XpOidDocFmtList*)NULL != valid_fmts
+ &&
+ !XpOidDocFmtListHasFmt(valid_fmts, &doc_fmt)
+ );
+
+ if(xFalse == status)
+ {
+ if('\0' == **ptr_return)
+ {
+ if(0 == i)
+ {
+ /*
+ * empty value string
+ */
+ return (XpOidDocFmtList*)NULL;
+ }
+ else
+ {
+ /*
+ * done parsing; allocate the list and return
+ */
+ list =
+ (XpOidDocFmtList*)XpOidCalloc(1, sizeof(XpOidDocFmtList));
+ list->count = i;
+ list->list = (XpOidDocFmt*)XpOidCalloc(i, sizeof(XpOidDocFmt));
+ return list;
+ }
+ }
+ else
+ {
+ /*
+ * invalid document format
+ */
+ ErrorF("%s\n", XPMSG_WARN_DOCFMT_LIST);
+ return (XpOidDocFmtList*)NULL;
+ }
+ }
+ else
+ {
+ /*
+ * recurse to parse remaining document formats
+ */
+ list = XpOidDocFmtListParse(*ptr_return, valid_fmts, ptr_return, i+1);
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ /*
+ * add this doc fmt to the list
+ */
+ list->list[i].format = doc_fmt.format;
+ list->list[i].variant = doc_fmt.variant;
+ list->list[i].version = doc_fmt.version;
+ }
+ return list;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListHasFmt
+ *
+ * Description:
+ *
+ * Assumes the passed structure is valid.
+ *
+ * Return value:
+ *
+ *
+ */
+BOOL
+XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
+ const XpOidDocFmt* fmt)
+{
+ int i;
+ if(list != (XpOidDocFmtList*)NULL
+ &&
+ fmt != (XpOidDocFmt*)NULL
+ &&
+ fmt->format != (char*)NULL
+ )
+ {
+ for(i = 0; i < list->count; i++)
+ {
+ /*
+ * formats must match
+ */
+ if(strcmp(fmt->format, list->list[i].format) != 0)
+ continue;
+ /*
+ * variants must both be NULL or match
+ */
+ if(fmt->variant == (char*)NULL)
+ if(list->list[i].variant == (char*)NULL)
+ return xTrue;
+ else
+ continue;
+ if(list->list[i].variant == (char*)NULL)
+ continue;
+ if(strcmp(fmt->variant, list->list[i].variant) != 0)
+ continue;
+ /*
+ * versions must both be NULL or match
+ */
+ if(fmt->version == (char*)NULL)
+ if(list->list[i].version == (char*)NULL)
+ return xTrue;
+ else
+ continue;
+ if(list->list[i].version == (char*)NULL)
+ continue;
+ if(strcmp(fmt->version, list->list[i].version) == 0)
+ return xTrue;
+ }
+ }
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidCardList*
+XpOidCardListNew(const char* value_string, const XpOidCardList* valid_cards)
+{
+ if((const char*)NULL != value_string)
+ {
+ const char* ptr;
+
+ return XpOidCardListParse(value_string, valid_cards, &ptr, 0);
+ }
+ else
+ return (XpOidCardList*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidCardListDelete(XpOidCardList* list)
+{
+ if((XpOidCardList*)NULL != list)
+ {
+ XpOidFree(list->list);
+ XpOidFree(list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidCardListString(const XpOidCardList* list)
+{
+ if((XpOidCardList*)NULL != list)
+ {
+ char buf[48];
+ int str_len;
+ char* str;
+ int i;
+ char* ptr;
+ /*
+ * allocate the output string
+ */
+ for(i = 0, str_len = 0; i < list->count; i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(buf, "%lu", list->list[i]) + 1;
+ str_len += strlen(buf);
+ }
+#else
+ str_len += sprintf(buf, "%lu", list->list[i]) + 1;
+#endif
+ str = XpOidMalloc(str_len+1);
+ /*
+ * write the list to the string
+ */
+ for(i = 0, ptr = str; i < list->count; i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "%lu ", list->list[i]);
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "%lu ", list->list[i]);
+#endif
+ return str;
+ }
+ else
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListHasCard
+ *
+ * Description:
+ *
+ * Determines if 'card' is an element of 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the card is found in the list.
+ *
+ * xFalse if the card is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidCardListHasCard(const XpOidCardList* list, unsigned long card)
+{
+ int i;
+ if(list != (XpOidCardList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == card)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListParse
+ *
+ * Description:
+ *
+ * Assumes the passed value_string and ptr_return are non-NULL.
+ *
+ * Return value:
+ *
+ *
+ */
+static XpOidCardList*
+XpOidCardListParse(const char* value_string,
+ const XpOidCardList* valid_cards,
+ const char** ptr_return,
+ int i)
+{
+ unsigned long card;
+ XpOidCardList* list;
+ BOOL status;
+
+ /*
+ * get the next card from the value string, skipping values not
+ * found in the passed list of valid cards
+ */
+ *ptr_return = value_string;
+ while((status = XpOidParseUnsignedValue(*ptr_return, ptr_return, &card))
+ &&
+ (const XpOidCardList*)NULL != valid_cards
+ &&
+ !XpOidCardListHasCard(valid_cards, card)
+ );
+
+ if(xFalse == status)
+ {
+ if('\0' == **ptr_return)
+ {
+ if(0 == i)
+ {
+ /*
+ * empty value string
+ */
+ return (XpOidCardList*)NULL;
+ }
+ else
+ {
+ /*
+ * done parsing; allocate the list and return
+ */
+ list = (XpOidCardList*)XpOidCalloc(1, sizeof(XpOidCardList));
+ list->count = i;
+ list->list =
+ (unsigned long*)XpOidCalloc(i, sizeof(unsigned long));
+ return list;
+ }
+ }
+ else
+ {
+ /*
+ * parsing error
+ */
+ ErrorF("%s\n", XPMSG_WARN_CARD_LIST);
+ return (XpOidCardList*)NULL;
+ }
+ }
+ else
+ {
+ /*
+ * recurse to parse remaining cardinal values
+ */
+ list = XpOidCardListParse(*ptr_return, valid_cards, ptr_return, i+1);
+ if((XpOidCardList*)NULL != list)
+ {
+ /*
+ * add this value to the list
+ */
+ list->list[i] = card;
+ }
+ return list;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseBoolValue
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+static BOOL
+ParseBoolValue(const char* value_string,
+ const char** ptr_return,
+ BOOL* bool_return)
+{
+ const char* ptr;
+ int length;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * get the whitespace-delimited token length
+ */
+ length = SpanToken(ptr);
+ /*
+ * determine if true or false or bad
+ */
+ if(StrnCaseCmp(ptr, "TRUE", length) == 0)
+ {
+ if(bool_return != (BOOL*)NULL)
+ *bool_return = xTrue;
+ status = xTrue;
+ }
+ else if(StrnCaseCmp(ptr, "FALSE", length) == 0)
+ {
+ if(bool_return != (BOOL*)NULL)
+ *bool_return = xFalse;
+ status = xTrue;
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ status = xFalse;
+ }
+ /*
+ * update the return pointer and return
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = status ? ptr+length : ptr;
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidParseUnsignedValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a unsigned number.
+ *
+ * Return value:
+ *
+ * xTrue if a unsigned number was successfully parsed. ptr_return is
+ * updated to point to location where the unsigned number parsing
+ * ended.
+ *
+ * xFalse if a unsigned number was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+BOOL
+XpOidParseUnsignedValue(const char* value_string,
+ const char** ptr_return,
+ unsigned long* unsigned_return)
+{
+ long value;
+ BOOL status;
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ value = strtol(first_nonws_ptr, (char**)(&ptr), 0);
+ if(ptr == first_nonws_ptr || value < 0)
+ status = xFalse;
+ else
+ status = xTrue;
+ /*
+ * update return parms
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ if(unsigned_return != (unsigned long*)NULL)
+ *unsigned_return = (unsigned long)value;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseRealValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a real number.
+ *
+ * Return value:
+ *
+ * xTrue if a real number was successfully parsed. ptr_return is
+ * updated to point to location where the real number parsing
+ * ended.
+ *
+ * xFalse if a real number was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseRealValue(const char* value_string,
+ const char** ptr_return,
+ float* real_return)
+{
+ float real_value;
+ BOOL status;
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ real_value = (float)strtod(first_nonws_ptr, (char**)(&ptr));
+ if(ptr == first_nonws_ptr)
+ status = xFalse;
+ else
+ status = xTrue;
+ /*
+ * update return parms
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ if(real_return != (float*)NULL)
+ *real_return = real_value;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseSeqEnd
+ *
+ * Description:
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out the sequence end
+ * character '}'.
+ *
+ * Return value:
+ *
+ * xTrue if the sequence end character was parsed; ptr_return is
+ * updated to point to the first char following the sequence end
+ * character.
+ *
+ * xFalse if the sequence end character was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseSeqEnd(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the sequence end character
+ */
+ if(*ptr == '}')
+ {
+ status = xTrue;
+ ++ptr;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseSeqStart
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out the sequence start
+ * character '{'.
+ *
+ * Return value:
+ *
+ * xTrue if the sequence start character was parsed; ptr_return is
+ * updated to point to the first char following the sequence start
+ * character.
+ *
+ * xFalse if the sequence start character was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseSeqStart(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the sequence start character
+ */
+ if(*ptr == '{')
+ {
+ status = xTrue;
+ ++ptr;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseUnspecifiedValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out an unspecified optional
+ * value (i.e. matching '' or "" - skips all data between the set of
+ * quotes).
+ *
+ * Return value:
+ *
+ * xTrue if an unspecified value was parsed; ptr_return is updated to
+ * point to the first char following the trailing quote.
+ *
+ * xFalse if an unspecified value was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseUnspecifiedValue(const char* value_string,
+ const char** ptr_return)
+{
+ BOOL status;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out an unspecified optional value ('' or "")
+ */
+ if(*ptr == '\'' || *ptr == '"')
+ {
+ char delim[2];
+
+ if(ptr_return != (const char**)NULL)
+ {
+ delim[0] = *ptr;
+ delim[1] = '\0';
+ /*
+ * skip over the matching delimiter
+ */
+ ++ptr;
+ ptr += strcspn(ptr, delim);
+ if(*ptr != '\0')
+ ++ptr;
+ }
+ status = xTrue;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: SpanToken
+ *
+ * Description:
+ *
+ * Returns the length of the initial segment of the passed string
+ * that consists entirely of non-whitespace and non-sequence
+ * delimiter characters.
+ *
+ *
+ */
+static int
+SpanToken(const char* string)
+{
+ const char* ptr;
+ for(ptr = string;
+ *ptr != '\0' && !isspace(*ptr) && *ptr != '{' && *ptr != '}';
+ ++ptr);
+ return ptr - string;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: SpanWhitespace
+ *
+ * Description:
+ *
+ * Returns the length of the initial segment of the passed string
+ * that consists entirely of whitespace characters.
+ *
+ *
+ */
+static int
+SpanWhitespace(const char* string)
+{
+ const char* ptr;
+ for(ptr = string; *ptr != '\0' && isspace(*ptr); ++ptr);
+ return ptr - string;
+}
+
+#ifndef HAVE_STRCASECMP
+/*
+ * ------------------------------------------------------------------------
+ * Name: StrnCaseCmp
+ *
+ * Description:
+ *
+ * Implements strncasecmp() for those platforms that need it.
+ *
+ *
+ */
+static int
+StrnCaseCmp(const char *s1, const char *s2, size_t len)
+{
+ char c1, c2;
+ int result;
+
+ while (len--)
+ {
+ c1 = *s1++;
+ c2 = *s2++;
+ result = tolower(c1) - tolower(c2);
+
+ if (result != 0)
+ return result;
+ }
+
+ return 0;
+}
+#endif
diff --git a/xc/programs/Xserver/Xprint/Oid.h b/xc/programs/Xserver/Xprint/Oid.h
new file mode 100644
index 000000000..c06e978af
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Oid.h
@@ -0,0 +1,289 @@
+/* $XConsortium: Oid.h /main/1 1996/09/28 16:58:20 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifndef _Xp_Oid_h
+#define _Xp_Oid_h
+
+#include <Xproto.h>
+
+/*
+ * include the auto-generated XpOid enum definition
+ */
+#include "OidDefs.h"
+
+/*
+ * messages
+ */
+#define XPMSG_WARN_MSS "Syntax error parsing medium-source-sizes"
+#define XPMSG_WARN_ITM "Syntax error parsing input-trays-medium"
+#define XPMSG_WARN_DOC_FMT "Syntax error parsing document format"
+#define XPMSG_WARN_DOCFMT_LIST "Syntax error parsing document format list"
+#define XPMSG_WARN_CARD_LIST "Syntax error parsing cardinal list"
+
+/*
+ * macros for memory allocation
+ */
+#define XpOidMalloc(size) ((char*)Xalloc((unsigned long)(size)))
+#define XpOidCalloc(count, size) \
+ ((char*)Xcalloc((unsigned long)((count)*(size))))
+#define XpOidFree(mem) (Xfree((unsigned long*)(mem)))
+
+/*
+ * list of object identifiers
+ */
+typedef struct _XpOidList
+{
+ XpOid* list;
+ int count;
+} XpOidList;
+
+/*
+ * linked list of object identifiers
+ */
+typedef struct XpOidNodeStruct
+{
+ XpOid oid;
+ struct XpOidNodeStruct* next;
+} *XpOidNode;
+
+typedef struct _XpOidLinkedList
+{
+ XpOidNode head;
+ XpOidNode tail;
+ XpOidNode current;
+ int count;
+} XpOidLinkedList;
+
+/*
+ * XpOidMediumSourceSize and related definitions
+ */
+typedef struct
+{
+ float minimum_x;
+ float maximum_x;
+ float minimum_y;
+ float maximum_y;
+} XpOidArea;
+
+typedef struct
+{
+ float lower_bound;
+ float upper_bound;
+} XpOidRealRange;
+
+typedef struct
+{
+ XpOidRealRange range_across_feed;
+ float increment_across_feed;
+ XpOidRealRange range_in_feed;
+ float increment_in_feed;
+ BOOL long_edge_feeds;
+ XpOidArea assured_reproduction_area;
+} XpOidMediumContinuousSize;
+
+typedef struct
+{
+ XpOid page_size;
+ BOOL long_edge_feeds;
+ XpOidArea assured_reproduction_area;
+} XpOidMediumDiscreteSize;
+
+typedef struct
+{
+ XpOidMediumDiscreteSize* list;
+ int count;
+} XpOidMediumDiscreteSizeList;
+
+typedef struct
+{
+ XpOid input_tray; /* may be set to xpoid_none or xpoid_unspecified */
+ enum { XpOidMediumSS_DISCRETE, XpOidMediumSS_CONTINUOUS } mstag;
+ union
+ {
+ XpOidMediumDiscreteSizeList* discrete;
+ XpOidMediumContinuousSize* continuous_size;
+ } ms; /* "ms" is short for medium-size */
+
+} XpOidMediumSourceSize;
+
+typedef struct
+{
+ XpOidMediumSourceSize* mss;
+ int count;
+} XpOidMediumSS;
+
+
+typedef struct
+{
+ XpOid input_tray; /* may be set to xpoid_none */
+ XpOid medium;
+} XpOidTrayMedium;
+
+typedef struct
+{
+ XpOidTrayMedium* list;
+ int count;
+} XpOidTrayMediumList;
+
+typedef enum {
+ XPOID_NOTIFY_UNSUPPORTED,
+ XPOID_NOTIFY_NONE,
+ XPOID_NOTIFY_EMAIL
+} XpOidNotify;
+
+typedef struct
+{
+ unsigned long *list;
+ int count;
+} XpOidCardList;
+
+typedef struct
+{
+ char* format;
+ char* variant;
+ char* version;
+} XpOidDocFmt;
+
+typedef struct
+{
+ XpOidDocFmt* list;
+ int count;
+} XpOidDocFmtList;
+
+
+/*
+ * XpOid public methods
+ */
+const char* XpOidString(XpOid);
+int XpOidStringLength(XpOid);
+XpOid XpOidFromString(const char* value);
+
+/*
+ * XpOidList public methods
+ */
+XpOidList* XpOidListNew(const char* value_string,
+ const XpOidList* valid_oids);
+#define XpOidListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
+void XpOidListDelete(XpOidList*);
+#define XpOidListCount(l) ((l) ? (l)->count : 0)
+#define XpOidListGetOid(l, i) ((l) ? (l)->list[(i)] : xpoid_none)
+int XpOidListGetIndex(const XpOidList* list, XpOid oid);
+BOOL XpOidListHasOid(const XpOidList* list, XpOid oid);
+char* XpOidListString(const XpOidList*);
+
+
+/*
+ * XpOidLinkedList public methods
+ */
+XpOidLinkedList* XpOidLinkedListNew();
+void XpOidLinkedListDelete(XpOidLinkedList*);
+#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
+XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
+void XpOidLinkedListAddOid(XpOidLinkedList* list, XpOid oid);
+int XpOidLinkedListGetIndex(XpOidLinkedList* list, XpOid oid);
+BOOL XpOidLinkedListHasOid(XpOidLinkedList* list,
+ XpOid oid);
+XpOid XpOidLinkedListFirstOid(XpOidLinkedList* list);
+XpOid XpOidLinkedListNextOid(XpOidLinkedList* list);
+
+/*
+ * XpOidMediumSourceSize public methods
+ */
+XpOidMediumSS* XpOidMediumSSNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes);
+void XpOidMediumSSDelete(XpOidMediumSS*);
+#define XpOidMediumSSCount(me) ((me) ? (me)->count : 0)
+BOOL XpOidMediumSSHasSize(XpOidMediumSS*, XpOid medium_size);
+char* XpOidMediumSSString(const XpOidMediumSS*);
+
+/*
+ * XpOidTrayMediumList public methods
+ */
+XpOidTrayMediumList* XpOidTrayMediumListNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss);
+void XpOidTrayMediumListDelete(XpOidTrayMediumList* me);
+#define XpOidTrayMediumListCount(me) ((me) ? (me)->count : 0)
+#define XpOidTrayMediumListTray(me, i) \
+ ((me) ? (me)->list[(i)].input_tray : xpoid_none)
+#define XpOidTrayMediumListMedium(me, i) \
+ ((me) ? (me)->list[(i)].medium : xpoid_none)
+char* XpOidTrayMediumListString(const XpOidTrayMediumList*);
+
+/*
+ * XpOidNotify public methods
+ */
+XpOidNotify XpOidNotifyParse(const char* value_string);
+const char* XpOidNotifyString(XpOidNotify notify);
+
+/*
+ * XpOidDocFmt public methods
+ */
+XpOidDocFmt* XpOidDocFmtNew(const char* value_string);
+void XpOidDocFmtDelete(XpOidDocFmt*);
+char* XpOidDocFmtString(XpOidDocFmt*);
+
+/*
+ * XpOidDocFmtList public methods
+ */
+XpOidDocFmtList* XpOidDocFmtListNew(const char* value_string,
+ const XpOidDocFmtList* valid_fmts);
+void XpOidDocFmtListDelete(XpOidDocFmtList*);
+char* XpOidDocFmtListString(const XpOidDocFmtList*);
+#define XpOidDocFmtListCount(me) ((me) ? (me)->count : 0)
+#define XpOidDocFmtListGetDocFmt(me, i) \
+ ((me) ? &(me)->list[(i)] : (XpDocFmt*)NULL)
+BOOL XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
+ const XpOidDocFmt* fmt);
+/*
+ * XpOidCardList public methods
+ */
+XpOidCardList* XpOidCardListNew(const char* value_string,
+ const XpOidCardList* valid_cards);
+#define XpOidCardListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
+void XpOidCardListDelete(XpOidCardList*);
+char* XpOidCardListString(const XpOidCardList*);
+#define XpOidCardListCount(me) ((me) ? (me)->count : 0)
+#define XpOidCardListGetCard(me, i) ((me) ? (me)->list[(i)] : 0)
+BOOL XpOidCardListHasCard(const XpOidCardList*, unsigned long);
+
+/*
+ * misc parsing functions
+ */
+BOOL XpOidParseUnsignedValue(const char* value_string,
+ const char** ptr_return,
+ unsigned long* unsigned_return);
+
+
+#endif /* _Xp_Oid_h - don't add anything after this line */
diff --git a/xc/programs/Xserver/Xprint/OidDefs.h b/xc/programs/Xserver/Xprint/OidDefs.h
new file mode 100644
index 000000000..660c4653f
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/OidDefs.h
@@ -0,0 +1,153 @@
+/* $XConsortium: OidDefs.h /main/1 1996/09/28 16:58:29 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* This is an automatically-generated file. Do not edit. */
+
+typedef enum {
+ xpoid_none,
+ xpoid_unspecified,
+ xpoid_att_descriptor,
+ xpoid_att_content_orientation,
+ xpoid_att_copy_count,
+ xpoid_att_default_printer_resolution,
+ xpoid_att_default_input_tray,
+ xpoid_att_default_medium,
+ xpoid_att_document_format,
+ xpoid_att_plex,
+ xpoid_att_xp_listfonts_modes,
+ xpoid_att_job_name,
+ xpoid_att_job_owner,
+ xpoid_att_notification_profile,
+ xpoid_att_xp_setup_state,
+ xpoid_att_xp_spooler_command_options,
+ xpoid_att_content_orientations_supported,
+ xpoid_att_document_formats_supported,
+ xpoid_att_dt_pdm_command,
+ xpoid_att_input_trays_medium,
+ xpoid_att_medium_source_sizes_supported,
+ xpoid_att_plexes_supported,
+ xpoid_att_printer_model,
+ xpoid_att_printer_name,
+ xpoid_att_printer_resolutions_supported,
+ xpoid_att_xp_embedded_formats_supported,
+ xpoid_att_xp_listfonts_modes_supported,
+ xpoid_att_xp_page_attributes_supported,
+ xpoid_att_xp_raw_formats_supported,
+ xpoid_att_xp_setup_proviso,
+ xpoid_att_document_attributes_supported,
+ xpoid_att_job_attributes_supported,
+ xpoid_att_locale,
+ xpoid_att_multiple_documents_supported,
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape,
+ xpoid_val_medium_size_iso_a0,
+ xpoid_val_medium_size_iso_a1,
+ xpoid_val_medium_size_iso_a2,
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_iso_a5,
+ xpoid_val_medium_size_iso_a6,
+ xpoid_val_medium_size_iso_a7,
+ xpoid_val_medium_size_iso_a8,
+ xpoid_val_medium_size_iso_a9,
+ xpoid_val_medium_size_iso_a10,
+ xpoid_val_medium_size_iso_b0,
+ xpoid_val_medium_size_iso_b1,
+ xpoid_val_medium_size_iso_b2,
+ xpoid_val_medium_size_iso_b3,
+ xpoid_val_medium_size_iso_b4,
+ xpoid_val_medium_size_iso_b5,
+ xpoid_val_medium_size_iso_b6,
+ xpoid_val_medium_size_iso_b7,
+ xpoid_val_medium_size_iso_b8,
+ xpoid_val_medium_size_iso_b9,
+ xpoid_val_medium_size_iso_b10,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_folio,
+ xpoid_val_medium_size_invoice,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_quarto,
+ xpoid_val_medium_size_iso_c3,
+ xpoid_val_medium_size_iso_c4,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_c6,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_10x13_envelope,
+ xpoid_val_medium_size_na_9x12_envelope,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_na_7x9_envelope,
+ xpoid_val_medium_size_na_9x11_envelope,
+ xpoid_val_medium_size_na_10x14_envelope,
+ xpoid_val_medium_size_na_number_9_envelope,
+ xpoid_val_medium_size_na_6x9_envelope,
+ xpoid_val_medium_size_na_10x15_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_a,
+ xpoid_val_medium_size_b,
+ xpoid_val_medium_size_c,
+ xpoid_val_medium_size_d,
+ xpoid_val_medium_size_e,
+ xpoid_val_medium_size_jis_b0,
+ xpoid_val_medium_size_jis_b1,
+ xpoid_val_medium_size_jis_b2,
+ xpoid_val_medium_size_jis_b3,
+ xpoid_val_medium_size_jis_b4,
+ xpoid_val_medium_size_jis_b5,
+ xpoid_val_medium_size_jis_b6,
+ xpoid_val_medium_size_jis_b7,
+ xpoid_val_medium_size_jis_b8,
+ xpoid_val_medium_size_jis_b9,
+ xpoid_val_medium_size_jis_b10,
+ xpoid_val_plex_simplex,
+ xpoid_val_plex_duplex,
+ xpoid_val_plex_tumble,
+ xpoid_val_input_tray_top,
+ xpoid_val_input_tray_middle,
+ xpoid_val_input_tray_bottom,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_side,
+ xpoid_val_event_report_job_completed,
+ xpoid_val_delivery_method_electronic_mail,
+ xpoid_val_xp_setup_mandatory,
+ xpoid_val_xp_setup_optional,
+ xpoid_val_xp_setup_ok,
+ xpoid_val_xp_setup_incomplete,
+ xpoid_val_xp_list_glyph_fonts,
+ xpoid_val_xp_list_internal_printer_fonts
+} XpOid;
diff --git a/xc/programs/Xserver/Xprint/OidStrs.h b/xc/programs/Xserver/Xprint/OidStrs.h
new file mode 100644
index 000000000..af2041a68
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/OidStrs.h
@@ -0,0 +1,155 @@
+/* $XConsortium: OidStrs.h /main/1 1996/09/28 16:58:35 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* This is an automatically-generated file. Do not edit. */
+
+static int XpOidStringMapCount = 117;
+
+static const XpOidStringMapEntry XpOidStringMap[] = {
+ { "", 0 },
+ { "", 0 },
+ { "descriptor", 10 },
+ { "content-orientation", 19 },
+ { "copy-count", 10 },
+ { "default-printer-resolution", 26 },
+ { "default-input-tray", 18 },
+ { "default-medium", 14 },
+ { "document-format", 15 },
+ { "plex", 4 },
+ { "xp-listfonts-modes", 18 },
+ { "job-name", 8 },
+ { "job-owner", 9 },
+ { "notification-profile", 20 },
+ { "xp-setup-state", 14 },
+ { "xp-spooler-command-options", 26 },
+ { "content-orientations-supported", 30 },
+ { "document-formats-supported", 26 },
+ { "dt-pdm-command", 14 },
+ { "input-trays-medium", 18 },
+ { "medium-source-sizes-supported", 29 },
+ { "plexes-supported", 16 },
+ { "printer-model", 13 },
+ { "printer-name", 12 },
+ { "printer-resolutions-supported", 29 },
+ { "xp-embedded-formats-supported", 29 },
+ { "xp-listfonts-modes-supported", 28 },
+ { "xp-page-attributes-supported", 28 },
+ { "xp-raw-formats-supported", 24 },
+ { "xp-setup-proviso", 16 },
+ { "document-attributes-supported", 29 },
+ { "job-attributes-supported", 24 },
+ { "locale", 6 },
+ { "multiple-documents-supported", 28 },
+ { "portrait", 8 },
+ { "landscape", 9 },
+ { "reverse-portrait", 16 },
+ { "reverse-landscape", 17 },
+ { "iso-a0", 6 },
+ { "iso-a1", 6 },
+ { "iso-a2", 6 },
+ { "iso-a3", 6 },
+ { "iso-a4", 6 },
+ { "iso-a5", 6 },
+ { "iso-a6", 6 },
+ { "iso-a7", 6 },
+ { "iso-a8", 6 },
+ { "iso-a9", 6 },
+ { "iso-a10", 7 },
+ { "iso-b0", 6 },
+ { "iso-b1", 6 },
+ { "iso-b2", 6 },
+ { "iso-b3", 6 },
+ { "iso-b4", 6 },
+ { "iso-b5", 6 },
+ { "iso-b6", 6 },
+ { "iso-b7", 6 },
+ { "iso-b8", 6 },
+ { "iso-b9", 6 },
+ { "iso-b10", 7 },
+ { "na-letter", 9 },
+ { "na-legal", 8 },
+ { "executive", 9 },
+ { "folio", 5 },
+ { "invoice", 7 },
+ { "ledger", 6 },
+ { "quarto", 6 },
+ { "iso-c3", 6 },
+ { "iso-c4", 6 },
+ { "iso-c5", 6 },
+ { "iso-c6", 6 },
+ { "iso-designated-long", 19 },
+ { "na-10x13-envelope", 17 },
+ { "na-9x12-envelope", 16 },
+ { "na-number-10-envelope", 21 },
+ { "na-7x9-envelope", 15 },
+ { "na-9x11-envelope", 16 },
+ { "na-10x14-envelope", 17 },
+ { "na-number-9-envelope", 20 },
+ { "na-6x9-envelope", 15 },
+ { "na-10x15-envelope", 17 },
+ { "monarch-envelope", 16 },
+ { "a", 1 },
+ { "b", 1 },
+ { "c", 1 },
+ { "d", 1 },
+ { "e", 1 },
+ { "jis-b0", 6 },
+ { "jis-b1", 6 },
+ { "jis-b2", 6 },
+ { "jis-b3", 6 },
+ { "jis-b4", 6 },
+ { "jis-b5", 6 },
+ { "jis-b6", 6 },
+ { "jis-b7", 6 },
+ { "jis-b8", 6 },
+ { "jis-b9", 6 },
+ { "jis-b10", 7 },
+ { "simplex", 7 },
+ { "duplex", 6 },
+ { "tumble", 6 },
+ { "top", 3 },
+ { "middle", 6 },
+ { "bottom", 6 },
+ { "envelope", 8 },
+ { "manual", 6 },
+ { "large-capacity", 14 },
+ { "main", 4 },
+ { "side", 4 },
+ { "event-report-job-completed", 26 },
+ { "electronic-mail", 15 },
+ { "xp-setup-mandatory", 18 },
+ { "xp-setup-optional", 17 },
+ { "xp-setup-ok", 11 },
+ { "xp-setup-incomplete", 19 },
+ { "xp-list-glyph-fonts", 19 },
+ { "xp-list-internal-printer-fonts", 30 }
+};
diff --git a/xc/programs/Xserver/Xprint/Quarks.c b/xc/programs/Xserver/Xprint/Quarks.c
new file mode 100644
index 000000000..7a73f7eb8
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Quarks.c
@@ -0,0 +1,373 @@
+/*
+ * $XConsortium: Quarks.c /main/1 1996/09/28 16:58:44 rws $
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "Xlibint.h"
+#include <X11/Xresource.h>
+
+/* Not cost effective, at least for vanilla MIT clients */
+/* #define PERMQ */
+
+typedef unsigned long Signature;
+typedef unsigned long Entry;
+#ifdef PERMQ
+typedef unsigned char Bits;
+#endif
+
+static XrmQuark nextQuark = 1; /* next available quark number */
+static unsigned long quarkMask = 0;
+static Entry zero = 0;
+static Entry *quarkTable = &zero; /* crock */
+static unsigned long quarkRehash;
+static XrmString **stringTable = NULL;
+#ifdef PERMQ
+static Bits **permTable = NULL;
+#endif
+static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */
+
+#define QUANTUMSHIFT 8
+#define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1)
+#define CHUNKPER 8
+#define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1)
+
+#define LARGEQUARK ((Entry)0x80000000L)
+#define QUARKSHIFT 18
+#define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT)
+#define XSIGMASK ((1L << QUARKSHIFT) - 1)
+
+#define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1))
+#ifdef PERMQ
+#define QUANTSIZE (STRQUANTSIZE + \
+ (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3))
+#else
+#define QUANTSIZE STRQUANTSIZE
+#endif
+
+#define HASH(sig) ((sig) & quarkMask)
+#define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1)
+#define REHASH(idx,rehash) ((idx + rehash) & quarkMask)
+#define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK]
+#ifdef PERMQ
+#define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3]
+#define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7)))
+#define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7))
+#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7))
+#endif
+
+/* Permanent memory allocation */
+
+#define WALIGN sizeof(unsigned long)
+#define DALIGN sizeof(double)
+
+#define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1))
+static char *neverFreeTable = NULL;
+static int neverFreeTableSize = 0;
+
+static char *permalloc(length)
+ register unsigned int length;
+{
+ char *ret;
+
+ if (neverFreeTableSize < length) {
+ if (length >= NEVERFREETABLESIZE)
+ return Xmalloc(length);
+ if (! (ret = Xmalloc(NEVERFREETABLESIZE)))
+ return (char *) NULL;
+ neverFreeTableSize = NEVERFREETABLESIZE;
+ neverFreeTable = ret;
+ }
+ ret = neverFreeTable;
+ neverFreeTable += length;
+ neverFreeTableSize -= length;
+ return(ret);
+}
+
+char *Xpermalloc(length)
+ unsigned int length;
+{
+ int i;
+
+ if (neverFreeTableSize && length < NEVERFREETABLESIZE) {
+#ifndef WORD64
+ if ((sizeof(struct {char a; double b;}) !=
+ (sizeof(struct {char a; unsigned long b;}) -
+ sizeof(unsigned long) + sizeof(double))) &&
+ !(length & (DALIGN-1)) &&
+ (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1))) {
+ neverFreeTableSize -= DALIGN - i;
+ neverFreeTable += DALIGN - i;
+ } else
+#endif
+ if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) {
+ neverFreeTableSize -= WALIGN - i;
+ neverFreeTable += WALIGN - i;
+ }
+ }
+ return permalloc(length);
+}
+
+static Bool
+ExpandQuarkTable()
+{
+ unsigned long oldmask, newmask;
+ register char c, *s;
+ register Entry *oldentries, *entries;
+ register Entry entry;
+ register int oldidx, newidx, rehash;
+ Signature sig;
+ XrmQuark q;
+
+ oldentries = quarkTable;
+ if (oldmask = quarkMask)
+ newmask = (oldmask << 1) + 1;
+ else {
+ if (!stringTable) {
+ stringTable = (XrmString **)Xmalloc(sizeof(XrmString *) *
+ CHUNKPER);
+ if (!stringTable)
+ return False;
+ stringTable[0] = (XrmString *)NULL;
+ }
+#ifdef PERMQ
+ if (!permTable)
+ permTable = (Bits **)Xmalloc(sizeof(Bits *) * CHUNKPER);
+ if (!permTable)
+ return False;
+#endif
+ stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE);
+ if (!stringTable[0])
+ return False;
+#ifdef PERMQ
+ permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE);
+#endif
+ newmask = 0x1ff;
+ }
+ entries = (Entry *)Xmalloc(sizeof(Entry) * (newmask + 1));
+ if (!entries)
+ return False;
+ bzero((char *)entries, sizeof(Entry) * (newmask + 1));
+ quarkTable = entries;
+ quarkMask = newmask;
+ quarkRehash = quarkMask - 2;
+ for (oldidx = 0; oldidx <= oldmask; oldidx++) {
+ if (entry = oldentries[oldidx]) {
+ if (entry & LARGEQUARK)
+ q = entry & (LARGEQUARK-1);
+ else
+ q = (entry >> QUARKSHIFT) & QUARKMASK;
+ for (sig = 0, s = NAME(q); c = *s++; )
+ sig = (sig << 1) + c;
+ newidx = HASH(sig);
+ if (entries[newidx]) {
+ rehash = REHASHVAL(sig);
+ do {
+ newidx = REHASH(newidx, rehash);
+ } while (entries[newidx]);
+ }
+ entries[newidx] = entry;
+ }
+ }
+ if (oldmask)
+ Xfree((char *)oldentries);
+ return True;
+}
+
+#if NeedFunctionPrototypes
+XrmQuark _XrmInternalStringToQuark(
+ register _Xconst char *name, register int len, register Signature sig,
+ Bool permstring)
+#else
+XrmQuark _XrmInternalStringToQuark(name, len, sig, permstring)
+ register XrmString name;
+ register int len;
+ register Signature sig;
+ Bool permstring;
+#endif
+{
+ register XrmQuark q;
+ register Entry entry;
+ register int idx, rehash;
+ register int i;
+ register char *s1, *s2;
+ char *new;
+
+ rehash = 0;
+ idx = HASH(sig);
+ while (entry = quarkTable[idx]) {
+ if (entry & LARGEQUARK)
+ q = entry & (LARGEQUARK-1);
+ else {
+ if ((entry - sig) & XSIGMASK)
+ goto nomatch;
+ q = (entry >> QUARKSHIFT) & QUARKMASK;
+ }
+ for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) {
+ if (*s1++ != *s2++)
+ goto nomatch;
+ }
+ if (*s2) {
+nomatch: if (!rehash)
+ rehash = REHASHVAL(sig);
+ idx = REHASH(idx, rehash);
+ continue;
+ }
+#ifdef PERMQ
+ if (permstring && !ISPERM(q)) {
+ Xfree(NAME(q));
+ NAME(q) = (char *)name;
+ SETPERM(q);
+ }
+#endif
+ return q;
+ }
+ if (nextUniq == nextQuark)
+ return NULLQUARK;
+ if ((nextQuark + (nextQuark >> 2)) > quarkMask) {
+ if (!ExpandQuarkTable())
+ return NULLQUARK;
+ return _XrmInternalStringToQuark(name, len, sig, permstring);
+ }
+ q = nextQuark;
+ if (!(q & QUANTUMMASK)) {
+ if (!(q & CHUNKMASK)) {
+ if (!(new = Xrealloc((char *)stringTable,
+ sizeof(XrmString *) *
+ ((q >> QUANTUMSHIFT) + CHUNKPER))))
+ return NULLQUARK;
+ stringTable = (XrmString **)new;
+#ifdef PERMQ
+ if (!(new = Xrealloc((char *)permTable,
+ sizeof(Bits *) *
+ ((q >> QUANTUMSHIFT) + CHUNKPER))))
+ return NULLQUARK;
+ permTable = (Bits **)new;
+#endif
+ }
+ new = Xpermalloc(QUANTSIZE);
+ if (!new)
+ return NULLQUARK;
+ stringTable[q >> QUANTUMSHIFT] = (XrmString *)new;
+#ifdef PERMQ
+ permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE);
+#endif
+ }
+ if (!permstring) {
+ s2 = (char *)name;
+#ifdef PERMQ
+ name = Xmalloc(len+1);
+#else
+ name = permalloc(len+1);
+#endif
+ if (!name)
+ return NULLQUARK;
+ for (i = len, s1 = (char *)name; --i >= 0; )
+ *s1++ = *s2++;
+ *s1++ = '\0';
+#ifdef PERMQ
+ CLEARPERM(q);
+ }
+ else {
+ SETPERM(q);
+#endif
+ }
+ NAME(q) = (char *)name;
+ if (q <= QUARKMASK)
+ entry = (q << QUARKSHIFT) | (sig & XSIGMASK);
+ else
+ entry = q | LARGEQUARK;
+ quarkTable[idx] = entry;
+ nextQuark++;
+ return q;
+}
+
+#if NeedFunctionPrototypes
+XrmQuark XrmStringToQuark(
+ _Xconst char *name)
+#else
+XrmQuark XrmStringToQuark(name)
+ XrmString name;
+#endif
+{
+ register char c, *tname;
+ register Signature sig = 0;
+
+ if (!name)
+ return (NULLQUARK);
+
+ for (tname = (char *)name; c = *tname++; )
+ sig = (sig << 1) + c;
+
+ return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False);
+}
+
+#if NeedFunctionPrototypes
+XrmQuark XrmPermStringToQuark(
+ _Xconst char *name)
+#else
+XrmQuark XrmPermStringToQuark(name)
+ XrmString name;
+#endif
+{
+ register char c, *tname;
+ register Signature sig = 0;
+
+ if (!name)
+ return (NULLQUARK);
+
+ for (tname = (char *)name; c = *tname++; )
+ sig = (sig << 1) + c;
+
+ return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True);
+}
+
+XrmQuark XrmUniqueQuark()
+{
+ if (nextUniq == nextQuark)
+ return NULLQUARK;
+ return nextUniq--;
+}
+
+XrmString XrmQuarkToString(quark)
+ register XrmQuark quark;
+{
+ if (quark <= 0 || quark >= nextQuark)
+ return NULLSTRING;
+#ifdef PERMQ
+ /* We have to mark the quark as permanent, since the caller might hold
+ * onto the string pointer forver.
+ */
+ SETPERM(quark);
+#endif
+ return NAME(quark);
+}
diff --git a/xc/programs/Xserver/Xprint/Util.c b/xc/programs/Xserver/Xprint/Util.c
new file mode 100644
index 000000000..b3e8c4e21
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Util.c
@@ -0,0 +1,390 @@
+/* $TOG: Util.c /main/4 1998/03/25 09:17:45 kaleb $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/Util.c,v 1.9 1999/08/31 08:54:01 dawes Exp $ */
+
+/* To get the tempnam() prototype in <stdio.h> */
+#if defined(linux) && defined(__STRICT_ANSI__)
+#undef __STRICT_ANSI__
+#endif
+
+#include "Xos.h" /* for unistd.h and string.h */
+#include <stdio.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+
+#define _XP_PRINT_SERVER_
+#include "extensions/Print.h"
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#define IN_FILE_STRING "%(InFile)%"
+#define OUT_FILE_STRING "%(OutFile)%"
+
+/*
+ * ReplaceAnyString returns a string combining the input strings.
+ * It replaces all occurances of 'target' with the supplied
+ * 'replacement'.
+ * The original input string will generally be freed,
+ * and the caller is responsible for freeing whatever string is returned.
+ */
+char *
+ReplaceAnyString(
+ char *string,
+ char *target,
+ char *replacement)
+{
+ char *pKeyString;
+
+ if(replacement != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, target)) != (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) + strlen(replacement) -
+ strlen(target) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, replacement);
+ strcat(newString, pKeyString + strlen(target));
+ xfree(string);
+ string = newString;
+ }
+ }
+
+ return string;
+}
+
+/*
+ * ReplaceFileString returns a string combining the input strings.
+ * It replaces all occurances of IN_FILE_STRING with the supplied
+ * inFileName, and all occurances of OUT_FILE_STRING with the
+ * supplied outFileName. The original input string will generally be freed,
+ * and the caller is responsible for freeing whatever string is returned.
+ */
+char *
+ReplaceFileString(string, inFileName, outFileName)
+ char *string;
+ char *inFileName;
+ char *outFileName;
+{
+ char *pKeyString,
+ *pInFileString = IN_FILE_STRING,
+ *pOutFileString = OUT_FILE_STRING;
+
+ if(inFileName != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, pInFileString)) !=
+ (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) +
+ strlen(inFileName) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, inFileName);
+ strcat(newString, pKeyString + strlen(pInFileString));
+ xfree(string);
+ string = newString;
+ }
+ }
+
+ if(outFileName != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, pOutFileString)) !=
+ (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) +
+ strlen(outFileName) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, outFileName);
+ strcat(newString, pKeyString + strlen(pOutFileString));
+ xfree(string);
+ string = newString;
+ }
+ }
+ return string;
+}
+
+/*
+ * ExecCommand takes two character pointers - the command to execute,
+ * and the "argv" style NULL-terminated vector of arguments for the command.
+ * We wait for the command to terminate before continuing to ensure that
+ * we don't delete the job file before the spooler has made a copy.
+ */
+void
+ExecCommand(pCommand, argVector)
+ char *pCommand;
+ char **argVector;
+{
+ pid_t childPid;
+ int status;
+
+ if((childPid = fork()) == 0)
+ {
+ execv(pCommand, argVector);
+ }
+ else
+ {
+ (void) waitpid(childPid, &status, 0);
+ }
+ return;
+}
+
+/*
+ * TransferBytes reads numBytes of data from pSrcFile and writes them
+ * to pDstFile. It returns the number of bytes actually transfered,
+ * which will be numBytes if it's successful. Neither pSrcFile nor
+ * pDstFile are rewound or their pointers otherwise modified prior to
+ * beginning the transfer.
+ */
+int
+TransferBytes(pSrcFile, pDstFile, numBytes)
+ FILE *pSrcFile,
+ *pDstFile;
+ int numBytes;
+{
+ char buf[10240];
+ int bytesWritten = 0, bytesToXfer;
+
+ for(bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes);
+ bytesToXfer > 0;
+ bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes - bytesWritten))
+ {
+ if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
+ return bytesWritten;
+ if(fwrite((void *)buf, (size_t) 1, bytesToXfer, pDstFile) < bytesToXfer)
+ return bytesWritten;
+ bytesWritten += bytesToXfer;
+ }
+ return bytesWritten;
+}
+
+/*
+ * CopyContentsAndDelete - does the work of copying and deleting the
+ * pre, no, and post raster files as well as the raster file itself.
+ */
+Bool
+CopyContentsAndDelete(ppSrcFile, pSrcFileName, pDstFile)
+ FILE **ppSrcFile,
+ *pDstFile;
+ char **pSrcFileName;
+{
+ struct stat statBuf;
+
+ if(stat(*pSrcFileName, &statBuf) < 0)
+ return FALSE;
+ rewind(*ppSrcFile);
+ if(TransferBytes(*ppSrcFile, pDstFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ return FALSE;
+ fclose(*ppSrcFile);
+ *ppSrcFile = (FILE *)NULL;
+ unlink(*pSrcFileName);
+ xfree(*pSrcFileName);
+ *pSrcFileName = (char *)NULL;
+
+ return TRUE;
+}
+
+
+#define QUADPAD(x) ((((x)+3)>>2)<<2)
+
+int
+XpSendDocumentData(
+ ClientPtr client,
+ FILE *fp,
+ int fileLen,
+ int maxBufSize)
+{
+ xPrintGetDocumentDataReply *pRep;
+ int bytesWritten, bytesToWrite;
+ int result = Success;
+
+ if(client->clientGone)
+ return Success;
+
+ pRep = (xPrintGetDocumentDataReply *)xalloc(sz_xPrintGetDocumentDataReply+
+ QUADPAD(maxBufSize));
+
+ for(bytesToWrite = min(maxBufSize, fileLen),
+ bytesWritten = 0;
+ bytesToWrite > 0;
+ bytesToWrite = min(maxBufSize, fileLen - bytesWritten))
+ {
+ pRep->type = X_Reply;
+ pRep->sequenceNumber = client->sequence;
+ pRep->length = (QUADPAD(bytesToWrite)) >> 2;
+ pRep->dataLen = bytesToWrite;
+
+ if(fread((void *)(pRep + 1), (size_t) 1, bytesToWrite, fp) <
+ bytesToWrite)
+ {
+ result = BadAlloc; /* XXX poor error choice? */
+ pRep->statusCode = 2; /* XXX Is this the right value??? */
+ }
+ else
+ pRep->statusCode = 0; /* XXX Ignored??? */
+
+ pRep->finishedFlag = FALSE;
+
+ if (client->swapped) {
+ int n;
+ long l;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, l);
+ swapl(&pRep->statusCode, l); /* XXX Why are these longs??? */
+ swapl(&pRep->finishedFlag, l); /* XXX Why are these longs??? */
+ swapl(&pRep->dataLen, l);
+ }
+
+ (void)WriteToClient(client,
+ sz_xPrintGetDocumentDataReply + bytesToWrite,
+ (char *)pRep);
+ bytesWritten += bytesToWrite;
+ }
+
+ xfree(pRep);
+ return result;
+}
+
+/*
+ * XpFinishDocData - send a DocumentData reply with the "finishedFlag"
+ * field set to TRUE. This routine should be called from the EndJob
+ * function of a driver after the driver has sent all required
+ * document data (presumably via XpSendDocumentData).
+ */
+int
+XpFinishDocData(
+ ClientPtr client)
+{
+ xPrintGetDocumentDataReply rep;
+
+ if(client->clientGone)
+ return Success;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.dataLen = 0;
+ rep.finishedFlag = TRUE;
+ rep.statusCode = 0;
+
+ if (client->swapped) {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swapl(&rep.statusCode, l); /* XXX Why are these longs??? */
+ swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */
+ swapl(&rep.dataLen, l);
+ }
+
+ (void)WriteToClient(client, sz_xPrintGetDocumentDataReply, (char *)&rep);
+ return Success;
+}
+
+static
+char *XpDirName(char *fname)
+{
+ char *fn, *ptr;
+
+ fn = (char *)xalloc(strlen(fname) + 1);
+ if (fn) {
+ strcpy(fn, fname);
+ ptr = strrchr(fn, '/');
+ if (!ptr) {
+ ptr = fn;
+ *ptr++ = '.';
+ } else if (ptr == fn)
+ ptr++;
+ *ptr = '\0';
+ }
+ return fn;
+}
+
+Bool
+XpOpenTmpFile(
+ char *mode,
+ char **fname,
+ FILE **stream)
+{
+#ifndef HAS_MKSTEMP
+ char *fn = NULL;
+
+ /* note that there is a small race condition here... */
+ if (!(*fname = tempnam(NULL, NULL)) ||
+ !(fn = XpDirName(*fname)) ||
+ access(fn, W_OK) ||
+ !(*stream = fopen(*fname, mode)))
+
+ {
+ xfree(fn);
+ xfree(*fname);
+ *fname = NULL;
+ *stream = NULL;
+ return FALSE;
+ }
+ xfree(fn);
+#else
+ int fd;
+
+ *stream = NULL;
+ *fname = (char *)xalloc(14);
+ if (*fname == NULL)
+ return FALSE;
+ strcpy(*fname, "/tmp/xpXXXXXX");
+ fd = mkstemp(*fname);
+ if (fd < 0) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+ *stream = fdopen(fd, mode);
+ if (stream == NULL) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+#endif
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/Xprint/ValTree.c b/xc/programs/Xserver/Xprint/ValTree.c
new file mode 100644
index 000000000..7861108bf
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ValTree.c
@@ -0,0 +1,187 @@
+/* $XConsortium: ValTree.c /main/1 1996/09/28 16:58:58 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+#include "X.h"
+#include "scrnintstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "regionstr.h"
+#include "mivalidate.h"
+
+/*
+ * XpValidateTree - a validateTree routine which ignores overlapping
+ * top-level windows when computing the clip lists for such windows.
+ * This can be used by any driver which maintains a separate memory
+ * store for each top-level window (with its respective children).
+ * If the pParent is not the root window, then miValidateTree
+ * is used unmodified.
+ *
+ * The strategy if pParent is the root is to save off the
+ * current values of pParent->firstChild and pParent->lastChild,
+ * replacing both with the single child of interest. We save off
+ * pChild->prevSib and pChild->nextSib, and replace them with NullWindow.
+ * We save off pParent->clipList, and replace it with
+ * pParent->winSize - pChild->winSize. We then call miValidateTree
+ * to do the needed ComputeClips on the pChild's heirarchy.
+ * pParent's clipList is then recomputed based on the sizes
+ * of its children, and the saved pointers are restored.
+ * The trees associated with the siblings of pChild must be descended
+ * and cleaned of any marks (i.e. the valdata pointer freed, and set to NULL),
+ * and pParent' AfterValidate structure's exposed field must be updated.
+ */
+/*ARGSUSED*/
+int
+XpValidateTree (pParent, pChild, kind)
+ WindowPtr pParent; /* Parent to validate */
+ WindowPtr pChild; /* First child of pParent that was
+ * affected */
+ VTKind kind; /* What kind of configuration caused call */
+{
+ RegionRec origPrntClip; /* orig clipList for parent */
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec tmpPrntClip; /* parent clipList - child borderClip */
+ RegionRec exposed; /* For intermediate calculations */
+ register ScreenPtr pScreen;
+ register WindowPtr pWin;
+ Bool overlap;
+ int viewvals;
+ Bool forward;
+
+ WindowPtr origFirstChild, origLastChild, origPrevSib, origNextSib;
+
+ /*
+ * If we're validating something other than a top-level window,
+ * then just invoke miValidateTree.
+ */
+ if(pParent->parent != NullWindow)
+ return miValidateTree(pParent, pChild, kind);
+
+ /*
+ * If it's a stack change of top levels then it's a no-op for
+ * this scheme, so we just clean up any marks on windows and return.
+ */
+ if(kind == VTStack)
+ {
+ CleanMarks(pParent);
+ return 1;
+ }
+
+ pScreen = pParent->drawable.pScreen;
+ if (pChild == NullWindow)
+ pChild = pParent->firstChild;
+
+ /* Save off the existing window heirarchy */
+ origFirstChild = pParent->firstChild;
+ origLastChild = pParent->lastChild;
+ origPrevSib = pChild->prevSib;
+ origNextSib = pChild->nextSib;
+ pParent->firstChild = pChild;
+ pParent->lastChild = pChild;
+ pChild->prevSib = NullWindow;
+ pChild->nextSib = NullWindow;
+
+ /*
+ * Set pParent's clipList to be its winSize minus the pChild's
+ * borderSize.
+ */
+ origPrntClip = pParent->clipList;
+ REGION_INIT(pScreen, &tmpPrntClip, NullBox, 0);
+ REGION_SUBRACT(pScreen, &tmpPrntClip, &pParent->winSize,
+ &pChild->borderSize);
+ pParent->clipList = tmpPrntClip;
+
+ /*
+ * Call miValidateTree on the pruned tree.
+ */
+ (void) miValidateTree(pParent, pChild, kind);
+
+ /* Restore the saved heirarchy */
+ pChild->prevSib = origPrevSib;
+ pChild->nextSib = origNextSib;
+ pParent->firstChild = origFirstChild;
+ pParent->lastChild = origLastChild;
+
+ /*
+ * Compute pParent's clipList by taking its winSize and subracting
+ * the borderSize of each of its children.
+ */
+ for(pWin = pParent->firstChild,
+ REGION_COPY(pScreen, &pParent->clipList, &pParent->winSize);
+ pWin != NullWindow;
+ pWin = pWin->nextSib)
+ {
+ REGION_SUBTRACT(pScreen, &pParent->clipList, &pParent->clipList,
+ &pWin->borderSize);
+ }
+
+ /*
+ * Compute pParent's AfterValidate structure by subracting the original
+ * clipList from the newly computed clipList.
+ */
+ REGION_INIT(pScreen, &pParent->valdata->after.exposed, NullBox, 0);
+ REGION_SUBTRACT(pScreen, &pParent->valdata->after.exposed,
+ &pParent->clipList, &origPrntClip);
+
+ /*
+ * Remove the marks from all but pParent and pChild's heirarchy.
+ * i.e. from all of pChild's siblings and their children.
+ */
+ for(pWin = pParent->firstChild; pWin != NullWindow; pWin = pWin->nextSib)
+ {
+ WindowPtr pCurChild = pWin;
+
+ if(pCurChild == pChild)
+ continue;
+
+ while (1)
+ {
+ if(pCurChild->valdata)
+ {
+ xfree(pCurChild->valdata);
+ pCurChild->valdata = (ValidatePtr)NULL;
+ }
+
+ if (pCurChild->firstChild)
+ {
+ pCurChild = pCurChild->firstChild;
+ continue;
+ }
+ while (!pCurChild->nextSib && (pCurChild != pWin))
+ pCurChild = pCurChild->parent;
+ if (pCurChild == pWin)
+ break;
+ pCurChild = pCurChild->nextSib;
+ }
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/Xlcint.h b/xc/programs/Xserver/Xprint/Xlcint.h
new file mode 100644
index 000000000..b86cf1aed
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Xlcint.h
@@ -0,0 +1,625 @@
+/*
+ * $XConsortium: Xlcint.h /main/1 1996/09/28 16:59:05 rws $
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/*
+ * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
+ * and Nippon Telegraph and Telephone Corporation
+ * Copyright 1991 by the Massachusetts Institute of Technology
+ * Copyright 1991 by the Open Software Foundation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of OMRON, NTT Software, NTT, Open
+ * Software Foundation and M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. OMRON, NTT Software, NTT, Open Software
+ * Foundation and M.I.T. make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION AND M.I.T.
+ * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATIONN OR M.I.T. BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Li Yuhong OMRON Corporation
+ * Tatsuya Kato NTT Software Corporation
+ * Hiroshi Kuribayashi OMRON Coproration
+ * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co.
+ *
+ * M. Collins OSF
+ */
+
+
+#ifndef _XLCINT_H_
+#define _XLCINT_H_
+
+#ifdef NOT_IN_SERVER
+
+#include <X11/Xresource.h>
+
+/* current Ultrix compiler gets horribly confused */
+#if defined(FUNCPROTO) && defined(ultrix)
+#undef NeedFunctionPrototypes
+#endif
+
+typedef struct _XIMFilter {
+ struct _XIMFilter *next;
+ Window window;
+ unsigned long event_mask;
+ int start_type, end_type;
+ Bool (*filter)(
+#if NeedFunctionPrototypes
+ Display*, Window, XEvent*, XPointer
+#endif
+ );
+ XPointer client_data;
+} XFilterEventRec, *XFilterEventList;
+
+#ifdef offsetof
+#define XOffsetOf(s_type,field) offsetof(s_type,field)
+#else
+#define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field))
+#endif
+
+#define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0])))
+
+typedef struct {
+ char *name;
+ XPointer value;
+} XIMArg;
+
+#define ICInputStyle 0
+#define ICClientWindow 1
+#define ICFocusWindow 2
+#define ICFilterEvents 3
+#define ICArea 4
+#define ICAreaNeeded 5
+#define ICSpotLocation 6
+#define ICColormap 7
+#define ICStdColormap 8
+#define ICForeground 9
+#define ICBackground 10
+#define ICBackgroundPixmap 11
+#define ICFontSet 12
+#define ICLineSpace 13
+#define ICCursor 14
+#define ICResourceClass 26
+#define ICResourceName 27
+#ifdef __hpux
+#define ICNlioctl 28 /* must be > 14 + 11 */
+#endif
+
+#define IMQueryInputStyle 0
+
+#define IMResourceWrite 1
+#define IMResourceRead 2
+#define IMResourceReadWrite 3
+
+/*
+ * define secondary data structs which are part of Input methods
+ * and input context
+ */
+typedef struct {
+ XrmQuark xrm_name; /* Resource name quark */
+ int xrm_size; /* Size in bytes of data */
+ long xrm_offset; /* -offset-1 */
+ unsigned short mode; /* Read Write Permission */
+ int mask; /* ? */
+} XIMrmResource, *XIMrmResourceList;
+
+typedef struct {
+ char *resource_name; /* Resource string */
+ int resource_size; /* Size in bytes of data */
+ long resource_offset; /* -offset-1 */
+ unsigned short mode; /* Read Write Permission */
+ int mask; /* ? */
+} XIMResource, *XIMResourceList;
+
+typedef struct {
+ XIMCallback start;
+ XIMCallback done;
+ XIMCallback draw;
+ XIMCallback caret;
+} ICCallbacks;
+
+/*
+ * data block describing the visual attributes associated with
+ * an input context
+ */
+typedef struct {
+ XRectangle area;
+ XRectangle area_needed;
+ XPoint spot_location;
+ Colormap colormap;
+ Atom std_colormap;
+ unsigned long foreground;
+ unsigned long background;
+ Pixmap background_pixmap;
+ XFontSet fontset;
+ int line_space;
+ Cursor cursor;
+ ICCallbacks callbacks;
+} ICAttributes, *ICAttributesPtr;
+
+typedef struct _XLCd *XLCd; /* need forward reference */
+
+/*
+ * define an LC, it's methods, and data.
+ */
+
+typedef struct {
+ char* (*map_modifiers)( /* called by XSetModifiers */
+#if NeedFunctionPrototypes
+ XLCd, char*, char*
+#endif
+ );
+ XFontSet (*create_fontset)(
+#if NeedFunctionPrototypes
+ XLCd, Display*, char*, char**, int, char***, int*
+#endif
+ );
+ XIM (*open_im)(
+#if NeedFunctionPrototypes
+ XLCd, Display*, XrmDatabase, char*, char*
+#endif
+ );
+} XLCdMethodsRec, *XLCdMethods;
+
+
+typedef struct {
+ char* name; /* name of this LC */
+ char* modifiers; /* modifiers of locale */
+} XLCdCoreRec, *XLCdCore;
+
+
+typedef struct _XLCd {
+ XLCdMethods methods; /* methods of this LC */
+ XLCdCoreRec core; /* data of this LC */
+} XLCdRec;
+
+
+/*
+ * X Font Sets are an instantiable object, so we define it, the
+ * object itself, a method list and data
+ */
+
+/*
+ * XFontSet object method list
+ */
+typedef struct {
+ /* pure font methods */
+
+ void (*free)(
+#if NeedFunctionPrototypes
+ Display*, XFontSet
+#endif
+ );
+
+ /* multi-byte text drawing methods */
+
+ int (*mb_escapement)(
+#if NeedFunctionPrototypes
+ XFontSet, char*, int
+#endif
+ );
+ int (*mb_extents)(
+#if NeedFunctionPrototypes
+ XFontSet, char*, int, XRectangle*, XRectangle*
+#endif
+ );
+ Status (*mb_extents_per_char)(
+#if NeedFunctionPrototypes
+ XFontSet, char*, int, XRectangle*, XRectangle*, int, int*,
+ XRectangle*, XRectangle*
+#endif
+ );
+ int (*mb_draw_string)(
+#if NeedFunctionPrototypes
+ Display*, Drawable, XFontSet, GC, int, int, char*, int
+#endif
+ );
+ void (*mb_draw_image_string)(
+#if NeedFunctionPrototypes
+ Display*, Drawable, XFontSet, GC, int, int, char*, int
+#endif
+ );
+
+ /* wide character text drawing methods */
+
+ int (*wc_escapement)(
+#if NeedFunctionPrototypes
+ XFontSet, wchar_t*, int
+#endif
+ );
+ int (*wc_extents)(
+#if NeedFunctionPrototypes
+ XFontSet, wchar_t*, int, XRectangle*, XRectangle*
+#endif
+ );
+ Status (*wc_extents_per_char)(
+#if NeedFunctionPrototypes
+ XFontSet, wchar_t*, int, XRectangle*, XRectangle*, int, int*,
+ XRectangle*, XRectangle*
+#endif
+ );
+ int (*wc_draw_string)(
+#if NeedFunctionPrototypes
+ Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int
+#endif
+ );
+ void (*wc_draw_image_string)(
+#if NeedFunctionPrototypes
+ Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int
+#endif
+ );
+} XFontSetMethodsRec, *XFontSetMethods;
+
+
+/*
+ * XFontSet LC independent data
+ */
+
+typedef struct {
+ XLCd lcd; /* LC of this font set */
+ char * base_name_list; /* base font name list */
+ int num_of_fonts; /* number of fonts */
+ char ** font_name_list; /* font names list */
+ XFontStruct ** font_struct_list; /* font struct list */
+ XFontSetExtents font_set_extents; /* font set extents */
+ char * default_string; /* default string */
+ Bool context_dependent; /* context-dependent drawing */
+} XFontSetCoreRec, *XFontSetCore;
+
+
+/*
+ * An XFontSet. Implementations may need to extend this data structure to
+ * accomodate additional data, state information etc.
+ */
+typedef struct _XFontSet {
+ XFontSetMethods methods; /* methods of this font set */
+ XFontSetCoreRec core; /* data of this font set */
+} XFontSetRec;
+
+
+
+/*
+ * X Input Managers are an instantiable object, so we define it, the
+ * object itself, a method list and data.
+ */
+
+/*
+ * an Input Manager object method list
+ */
+typedef struct {
+ Status (*close)(
+#if NeedFunctionPrototypes
+ XIM
+#endif
+ );
+ char* (*get_values)(
+#if NeedFunctionPrototypes
+ XIM, XIMArg*
+#endif
+ );
+ XIC (*create_ic)(
+#if NeedFunctionPrototypes
+ XIM, XIMArg*
+#endif
+ );
+} XIMMethodsRec, *XIMMethods;
+
+/*
+ * Input Manager LC independent data
+ */
+typedef struct {
+ XLCd lcd; /* LC of this input method */
+ XIC ic_chain; /* list of ICs for this IM */
+
+ Display * display; /* display */
+ XrmDatabase rdb;
+ char * res_name;
+ char * res_class;
+
+ XIMrmResourceList ic_resources; /* compiled IC resource list */
+ unsigned int ic_num_resources;
+ XIMrmResourceList ic_attr_resources; /* compiled IC visual res */
+ unsigned int ic_num_attr_resources;
+} XIMCoreRec, *XIMCore;
+
+
+
+/*
+ * An X Input Manager (IM). Implementations may need to extend this data
+ * structure to accomodate additional data, state information etc.
+ */
+typedef struct _XIM {
+ XIMMethods methods; /* method list of this IM */
+ XIMCoreRec core; /* data of this IM */
+} XIMRec;
+
+
+
+/*
+ * X Input Contexts (IC) are an instantiable object, so we define it, the
+ * object itself, a method list and data for this object
+ */
+
+/*
+ * Input Context method list
+ */
+typedef struct {
+ void (*destroy)(
+#if NeedFunctionPrototypes
+ XIC
+#endif
+ );
+ void (*set_focus)(
+#if NeedFunctionPrototypes
+ XIC
+#endif
+ );
+ void (*unset_focus)(
+#if NeedFunctionPrototypes
+ XIC
+#endif
+ );
+ char* (*set_values)(
+#if NeedFunctionPrototypes
+ XIC, XIMArg*
+#endif
+ );
+ char* (*get_values)(
+#if NeedFunctionPrototypes
+ XIC, XIMArg*
+#endif
+ );
+ char* (*mb_reset)(
+#if NeedFunctionPrototypes
+ XIC
+#endif
+ );
+ wchar_t* (*wc_reset)(
+#if NeedFunctionPrototypes
+ XIC
+#endif
+ );
+ int (*mb_lookup_string)(
+#if NeedFunctionPrototypes
+ XIC, XKeyEvent*, char*, int, KeySym*, Status*
+#endif
+ );
+ int (*wc_lookup_string)(
+#if NeedFunctionPrototypes
+ XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status*
+#endif
+ );
+} XICMethodsRec, *XICMethods;
+
+
+
+/*
+ * Input Context LC independent data
+ */
+typedef struct {
+ XIM im; /* XIM this IC belongs too */
+ XIC next; /* linked list of ICs for IM */
+
+ Window client_window; /* window IM can use for */
+ /* display or subwindows */
+ XIMStyle input_style; /* IM's input style */
+ Window focus_window; /* where key events go */
+ XrmDatabase res_database; /* where IM gets resources */
+ char * string_database; /* string for IM's resources */
+ XIMCallback geometry_callback; /* client callback */
+ int preedit_state; /* */
+ unsigned long filter_events; /* event mask from IM */
+
+ ICAttributes preedit_attr; /* visuals of preedit area */
+ ICAttributes status_attr; /* visuals of status area */
+} XICCoreRec, *XICCore;
+
+
+/*
+ * an Input Context. Implementations may need to extend this data
+ * structure to accomodate additional data, state information etc.
+ */
+typedef struct _XIC {
+ XICMethods methods; /* method list of this IC */
+ XICCoreRec core; /* data of this IC */
+} XICRec;
+
+#endif /* NOT_IN_SERVER */
+
+/*
+ * Methods for Xrm parsing
+ */
+
+typedef struct {
+ void (*mbinit)(
+#if NeedFunctionPrototypes
+ XPointer /* state */
+#endif
+ );
+ char (*mbchar)(
+#if NeedFunctionPrototypes
+ XPointer /* state */,
+ char* /* str */,
+ int* /* lenp */
+#endif
+ );
+ void (*mbfinish)(
+#if NeedFunctionPrototypes
+ XPointer /* state */
+#endif
+ );
+ char* (*lcname)(
+#if NeedFunctionPrototypes
+ XPointer /* state */
+#endif
+ );
+ void (*destroy)(
+#if NeedFunctionPrototypes
+ XPointer /* state */
+#endif
+ );
+} XrmMethodsRec, *XrmMethods;
+
+#ifdef NOT_IN_SERVER
+
+/* current Ultrix compiler gets horribly confused */
+#if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO)
+#define NeedFunctionPrototypes 1
+#endif
+
+typedef XLCd (*XLCdLoadProc)(
+#if NeedFunctionPrototypes
+ char*
+#endif
+);
+
+_XFUNCPROTOBEGIN
+
+extern XLCd _XlcCurrentLC(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern Bool _XlcValidModSyntax(
+#if NeedFunctionPrototypes
+ char* /* mods */,
+ char** /* valid */
+#endif
+);
+
+extern char *_XlcDefaultMapModifiers(
+#if NeedFunctionPrototypes
+ XLCd /* lcd */,
+ char* /* user_mods */,
+ char* /* prog_mods */
+#endif
+);
+
+extern void _XIMCompileResourceList(
+#if NeedFunctionPrototypes
+ XIMResourceList /* res */,
+ unsigned int /* num_res */
+#endif
+);
+
+extern void _XCopyToArg(
+#if NeedFunctionPrototypes
+ XPointer /* src */,
+ XPointer* /* dst */,
+ unsigned int /* size */
+#endif
+);
+
+extern char ** _XParseBaseFontNameList(
+#if NeedFunctionPrototypes
+ char* /* str */,
+ int* /* num */
+#endif
+);
+
+extern XrmMethods _XrmInitParseInfo(
+#if NeedFunctionPrototypes
+ XPointer* /* statep */
+#endif
+);
+
+extern void _XRegisterFilterByMask(
+#if NeedFunctionPrototypes
+ Display* /* dpy */,
+ Window /* window */,
+ unsigned long /* event_mask */,
+ Bool (*)(
+#if NeedNestedPrototypes
+ Display* /* display */,
+ Window /* window */,
+ XEvent* /* event */,
+ XPointer /* client_data */
+#endif
+ ) /* filter */,
+ XPointer /* client_data */
+#endif
+);
+
+extern void _XRegisterFilterByType(
+#if NeedFunctionPrototypes
+ Display* /* dpy */,
+ Window /* window */,
+ int /* start_type */,
+ int /* end_type */,
+ Bool (*)(
+#if NeedNestedPrototypes
+ Display* /* display */,
+ Window /* window */,
+ XEvent* /* event */,
+ XPointer /* client_data */
+#endif
+ ) /* filter */,
+ XPointer /* client_data */
+#endif
+);
+
+extern void _XUnregisterFilter(
+#if NeedFunctionPrototypes
+ Display* /* dpy */,
+ Window /* window */,
+ Bool (*)(
+#if NeedNestedPrototypes
+ Display* /* display */,
+ Window /* window */,
+ XEvent* /* event */,
+ XPointer /* client_data */
+#endif
+ ) /* filter */,
+ XPointer /* client_data */
+#endif
+);
+
+_XFUNCPROTOEND
+
+#endif /* NOT_IN_SERVER */
+
+#endif /* _XLCINT_H_ */
diff --git a/xc/programs/Xserver/Xprint/Xresource.h b/xc/programs/Xserver/Xprint/Xresource.h
new file mode 100644
index 000000000..b7ded0270
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Xresource.h
@@ -0,0 +1,423 @@
+/* $XConsortium: Xresource.h /main/1 1996/09/28 16:59:12 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/***********************************************************
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef _XRESOURCE_H_
+#define _XRESOURCE_H_
+
+/* You must include <X11/Xlib.h> before including this file */
+
+/****************************************************************
+ ****************************************************************
+ *** ***
+ *** ***
+ *** X Resource Manager Intrinsics ***
+ *** ***
+ *** ***
+ ****************************************************************
+ ****************************************************************/
+
+_XFUNCPROTOBEGIN
+
+/****************************************************************
+ *
+ * Memory Management
+ *
+ ****************************************************************/
+
+extern char *Xpermalloc(
+#if NeedFunctionPrototypes
+ unsigned int /* size */
+#endif
+);
+
+/****************************************************************
+ *
+ * Quark Management
+ *
+ ****************************************************************/
+
+typedef int XrmQuark, *XrmQuarkList;
+#define NULLQUARK ((XrmQuark) 0)
+
+typedef char *XrmString;
+#define NULLSTRING ((XrmString) 0)
+
+/* find quark for string, create new quark if none already exists */
+extern XrmQuark XrmStringToQuark(
+#if NeedFunctionPrototypes
+ _Xconst char* /* string */
+#endif
+);
+
+extern XrmQuark XrmPermStringToQuark(
+#if NeedFunctionPrototypes
+ _Xconst char* /* string */
+#endif
+);
+
+/* find string for quark */
+extern XrmString XrmQuarkToString(
+#if NeedFunctionPrototypes
+ XrmQuark /* quark */
+#endif
+);
+
+extern XrmQuark XrmUniqueQuark(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
+
+
+/****************************************************************
+ *
+ * Conversion of Strings to Lists
+ *
+ ****************************************************************/
+
+typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList;
+
+extern void XrmStringToQuarkList(
+#if NeedFunctionPrototypes
+ _Xconst char* /* string */,
+ XrmQuarkList /* quarks_return */
+#endif
+);
+
+extern void XrmStringToBindingQuarkList(
+#if NeedFunctionPrototypes
+ _Xconst char* /* string */,
+ XrmBindingList /* bindings_return */,
+ XrmQuarkList /* quarks_return */
+#endif
+);
+
+/****************************************************************
+ *
+ * Name and Class lists.
+ *
+ ****************************************************************/
+
+typedef XrmQuark XrmName;
+typedef XrmQuarkList XrmNameList;
+#define XrmNameToString(name) XrmQuarkToString(name)
+#define XrmStringToName(string) XrmStringToQuark(string)
+#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name)
+
+typedef XrmQuark XrmClass;
+typedef XrmQuarkList XrmClassList;
+#define XrmClassToString(c_class) XrmQuarkToString(c_class)
+#define XrmStringToClass(c_class) XrmStringToQuark(c_class)
+#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class)
+
+
+
+/****************************************************************
+ *
+ * Resource Representation Types and Values
+ *
+ ****************************************************************/
+
+typedef XrmQuark XrmRepresentation;
+#define XrmStringToRepresentation(string) XrmStringToQuark(string)
+#define XrmRepresentationToString(type) XrmQuarkToString(type)
+
+typedef struct {
+ unsigned int size;
+ XPointer addr;
+} XrmValue, *XrmValuePtr;
+
+
+/****************************************************************
+ *
+ * Resource Manager Functions
+ *
+ ****************************************************************/
+
+typedef struct _XrmHashBucketRec *XrmHashBucket;
+typedef XrmHashBucket *XrmHashTable;
+typedef XrmHashTable XrmSearchList[];
+typedef struct _XrmHashBucketRec *XrmDatabase;
+
+
+extern void XrmDestroyDatabase(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */
+#endif
+);
+
+extern void XrmQPutResource(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ XrmBindingList /* bindings */,
+ XrmQuarkList /* quarks */,
+ XrmRepresentation /* type */,
+ XrmValue* /* value */
+#endif
+);
+
+extern void XrmPutResource(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ _Xconst char* /* specifier */,
+ _Xconst char* /* type */,
+ XrmValue* /* value */
+#endif
+);
+
+extern void XrmQPutStringResource(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ XrmBindingList /* bindings */,
+ XrmQuarkList /* quarks */,
+ _Xconst char* /* value */
+#endif
+);
+
+extern void XrmPutStringResource(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ _Xconst char* /* specifier */,
+ _Xconst char* /* value */
+#endif
+);
+
+extern void XrmPutLineResource(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ _Xconst char* /* line */
+#endif
+);
+
+extern XrmQGetResource(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */,
+ XrmNameList /* quark_name */,
+ XrmClassList /* quark_class */,
+ XrmRepresentation* /* quark_type_return */,
+ XrmValue* /* value_return */
+#endif
+);
+
+extern Bool XrmGetResource(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */,
+ _Xconst char* /* str_name */,
+ _Xconst char* /* str_class */,
+ char** /* str_type_return */,
+ XrmValue* /* value_return */
+#endif
+);
+
+extern Bool XrmQGetSearchList(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */,
+ XrmNameList /* names */,
+ XrmClassList /* classes */,
+ XrmSearchList /* list_return */,
+ int /* list_length */
+#endif
+);
+
+extern Bool XrmQGetSearchResource(
+#if NeedFunctionPrototypes
+ XrmSearchList /* list */,
+ XrmName /* name */,
+ XrmClass /* class */,
+ XrmRepresentation* /* type_return */,
+ XrmValue* /* value_return */
+#endif
+);
+
+/****************************************************************
+ *
+ * Resource Database Management
+ *
+ ****************************************************************/
+
+#ifdef NOT_IN_SERVER
+
+extern void XrmSetDatabase(
+#if NeedFunctionPrototypes
+ Display* /* display */,
+ XrmDatabase /* database */
+#endif
+);
+
+extern XrmDatabase XrmGetDatabase(
+#if NeedFunctionPrototypes
+ Display* /* display */
+#endif
+);
+
+#endif /* NOT_IN_SERVER */
+
+extern XrmDatabase XrmGetFileDatabase(
+#if NeedFunctionPrototypes
+ _Xconst char* /* filename */
+#endif
+);
+
+extern Status XrmCombineFileDatabase(
+#if NeedFunctionPrototypes
+ _Xconst char* /* filename */,
+ XrmDatabase* /* target */,
+ Bool /* override */
+#endif
+);
+
+extern XrmDatabase XrmGetStringDatabase(
+#if NeedFunctionPrototypes
+ _Xconst char* /* data */ /* null terminated string */
+#endif
+);
+
+extern void XrmPutFileDatabase(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */,
+ _Xconst char* /* filename */
+#endif
+);
+
+extern void XrmMergeDatabases(
+#if NeedFunctionPrototypes
+ XrmDatabase /* source_db */,
+ XrmDatabase* /* target_db */
+#endif
+);
+
+extern void XrmCombineDatabase(
+#if NeedFunctionPrototypes
+ XrmDatabase /* source_db */,
+ XrmDatabase* /* target_db */,
+ Bool /* override */
+#endif
+);
+
+#define XrmEnumAllLevels 0
+#define XrmEnumOneLevel 1
+
+extern Bool XrmEnumerateDatabase(
+#if NeedFunctionPrototypes
+ XrmDatabase /* db */,
+ XrmNameList /* name_prefix */,
+ XrmClassList /* class_prefix */,
+ int /* mode */,
+ Bool (*)(
+#if NeedNestedPrototypes
+ XrmDatabase* /* db */,
+ XrmBindingList /* bindings */,
+ XrmQuarkList /* quarks */,
+ XrmRepresentation* /* type */,
+ XrmValue* /* value */,
+ XPointer /* closure */
+#endif
+ ) /* proc */,
+ XPointer /* closure */
+#endif
+);
+
+extern char *XrmLocaleOfDatabase(
+#if NeedFunctionPrototypes
+ XrmDatabase /* database */
+#endif
+);
+
+
+/****************************************************************
+ *
+ * Command line option mapping to resource entries
+ *
+ ****************************************************************/
+
+typedef enum {
+ XrmoptionNoArg, /* Value is specified in OptionDescRec.value */
+ XrmoptionIsArg, /* Value is the option string itself */
+ XrmoptionStickyArg, /* Value is characters immediately following option */
+ XrmoptionSepArg, /* Value is next argument in argv */
+ XrmoptionResArg, /* Resource and value in next argument in argv */
+ XrmoptionSkipArg, /* Ignore this option and the next argument in argv */
+ XrmoptionSkipLine, /* Ignore this option and the rest of argv */
+ XrmoptionSkipNArgs /* Ignore this option and the next
+ OptionDescRes.value arguments in argv */
+} XrmOptionKind;
+
+typedef struct {
+ char *option; /* Option abbreviation in argv */
+ char *specifier; /* Resource specifier */
+ XrmOptionKind argKind; /* Which style of option it is */
+ XPointer value; /* Value to provide if XrmoptionNoArg */
+} XrmOptionDescRec, *XrmOptionDescList;
+
+
+extern void XrmParseCommand(
+#if NeedFunctionPrototypes
+ XrmDatabase* /* database */,
+ XrmOptionDescList /* table */,
+ int /* table_count */,
+ _Xconst char* /* name */,
+ int* /* argc_in_out */,
+ char** /* argv_in_out */
+#endif
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XRESOURCE_H_ */
+/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/programs/Xserver/Xprint/Xrm.c b/xc/programs/Xserver/Xprint/Xrm.c
new file mode 100644
index 000000000..55879dd05
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/Xrm.c
@@ -0,0 +1,2600 @@
+/*
+ * $TOG: Xrm.c /main/4 1997/06/22 07:14:18 kaleb $
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/***********************************************************
+Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard,
+Massachusetts, and the Massachusetts Institute of Technology, Cambridge,
+Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/Xrm.c,v 1.5 1997/06/22 12:20:21 dawes Exp $ */
+
+#include <stdio.h>
+#include <ctype.h>
+#ifdef NOT_IN_SERVER
+#include "Xlibint.h"
+#include <X11/Xresource.h>
+#else
+typedef char *XPointer;
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <Xfuncproto.h>
+#include "Xresource.h"
+#endif /* NOT_IN_SERVER */
+#include "Xlcint.h"
+#include "XrmI.h"
+
+#if __STDC__
+#define Const const
+#else
+#define Const /**/
+#endif
+#if __STDC__ && !defined(VMS)
+#define RConst const
+#else
+#define RConst /**/
+#endif
+
+/*
+
+These Xrm routines allow very fast lookup of resources in the resource
+database. Several usage patterns are exploited:
+
+(1) Widgets get a lot of resources at one time. Rather than look up each from
+scratch, we can precompute the prioritized list of database levels once, then
+search for each resource starting at the beginning of the list.
+
+(2) Many database levels don't contain any leaf resource nodes. There is no
+point in looking for resources on a level that doesn't contain any. This
+information is kept on a per-level basis.
+
+(3) Sometimes the widget instance tree is structured such that you get the same
+class name repeated on the fully qualified widget name. This can result in the
+same database level occuring multiple times on the search list. The code below
+only checks to see if you get two identical search lists in a row, rather than
+look back through all database levels, but in practice this removes all
+duplicates I've ever observed.
+
+Joel McCormack
+
+*/
+
+/*
+
+The Xrm representation has been completely redesigned to substantially reduce
+memory and hopefully improve performance.
+
+The database is structured into two kinds of tables: LTables that contain
+only values, and NTables that contain only other tables.
+
+Some invariants:
+
+The next pointer of the top-level node table points to the top-level leaf
+table, if any.
+
+Within an LTable, for a given name, the tight value always precedes the
+loose value, and if both are present the loose value is always right after
+the tight value.
+
+Within an NTable, all of the entries for a given name are contiguous,
+in the order tight NTable, loose NTable, tight LTable, loose LTable.
+
+Bob Scheifler
+
+*/
+
+typedef unsigned long Signature;
+
+static XrmQuark XrmQString, XrmQANY;
+
+typedef Bool (*DBEnumProc)(
+#if NeedNestedPrototypes /* this is Nested on purpose, to match Xlib.h */
+ XrmDatabase* /* db */,
+ XrmBindingList /* bindings */,
+ XrmQuarkList /* quarks */,
+ XrmRepresentation* /* type */,
+ XrmValue* /* value */,
+ XPointer /* closure */
+#endif
+);
+
+typedef struct _VEntry {
+ struct _VEntry *next; /* next in chain */
+ XrmQuark name; /* name of this entry */
+ unsigned int tight:1; /* 1 if it is a tight binding */
+ unsigned int string:1; /* 1 if type is String */
+ unsigned int size:30; /* size of value */
+} VEntryRec, *VEntry;
+
+
+typedef struct _DEntry {
+ VEntryRec entry; /* entry */
+ XrmRepresentation type; /* representation type */
+} DEntryRec, *DEntry;
+
+/* the value is right after the structure */
+#define StringValue(ve) (XPointer)((ve) + 1)
+#define RepType(ve) ((DEntry)(ve))->type
+/* the value is right after the structure */
+#define DataValue(ve) (XPointer)(((DEntry)(ve)) + 1)
+#define RawValue(ve) (char *)((ve)->string ? StringValue(ve) : DataValue(ve))
+
+typedef struct _NTable {
+ struct _NTable *next; /* next in chain */
+ XrmQuark name; /* name of this entry */
+ unsigned int tight:1; /* 1 if it is a tight binding */
+ unsigned int leaf:1; /* 1 if children are values */
+ unsigned int hasloose:1; /* 1 if has loose children */
+ unsigned int hasany:1; /* 1 if has ANY entry */
+ unsigned int pad:4; /* unused */
+ unsigned int mask:8; /* hash size - 1 */
+ unsigned int entries:16; /* number of children */
+} NTableRec, *NTable;
+
+/* the buckets are right after the structure */
+#define NodeBuckets(ne) ((NTable *)((ne) + 1))
+#define NodeHash(ne,q) NodeBuckets(ne)[(q) & (ne)->mask]
+
+/* leaf tables have an extra level of indirection for the buckets,
+ * so that resizing can be done without invalidating a search list.
+ * This is completely ugly, and wastes some memory, but the Xlib
+ * spec doesn't really specify whether invalidation is OK, and the
+ * old implementation did not invalidate.
+ */
+typedef struct _LTable {
+ NTableRec table;
+ VEntry *buckets;
+} LTableRec, *LTable;
+
+#define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask]
+
+/* An XrmDatabase just holds a pointer to the first top-level table.
+ * The type name is no longer descriptive, but better to not change
+ * the Xresource.h header file. This type also gets used to define
+ * XrmSearchList, which is a complete crock, but we'll just leave it
+ * and caste types as required.
+ */
+typedef struct _XrmHashBucketRec {
+ NTable table;
+ XPointer mbstate;
+ XrmMethods methods;
+} XrmHashBucketRec;
+
+/* closure used in get/put resource */
+typedef struct _VClosure {
+ XrmRepresentation *type; /* type of value */
+ XrmValuePtr value; /* value itself */
+} VClosureRec, *VClosure;
+
+/* closure used in get search list */
+typedef struct _SClosure {
+ LTable *list; /* search list */
+ int idx; /* index of last filled element */
+ int limit; /* maximum index */
+} SClosureRec, *SClosure;
+
+/* placed in XrmSearchList to indicate next table is loose only */
+#define LOOSESEARCH ((LTable)1)
+
+/* closure used in enumerate database */
+typedef struct _EClosure {
+ XrmDatabase db; /* the database */
+ DBEnumProc proc; /* the user proc */
+ XPointer closure; /* the user closure */
+ XrmBindingList bindings; /* binding list */
+ XrmQuarkList quarks; /* quark list */
+ int mode; /* XrmEnum<kind> */
+} EClosureRec, *EClosure;
+
+/* predicate to determine when to resize a hash table */
+#define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2))
+
+#define GROW(prev) \
+ if (GrowthPred((*prev)->entries, (*prev)->mask)) \
+ GrowTable(prev)
+
+/* pick a reasonable value for maximum depth of resource database */
+#define MAXDBDEPTH 100
+
+/* macro used in get/search functions */
+
+/* find an entry named ename, with leafness given by leaf */
+#define NFIND(ename) \
+ q = ename; \
+ entry = NodeHash(table, q); \
+ while (entry && entry->name != q) \
+ entry = entry->next; \
+ if (leaf && entry && !entry->leaf) { \
+ entry = entry->next; \
+ if (entry && !entry->leaf) \
+ entry = entry->next; \
+ if (entry && entry->name != q) \
+ entry = (NTable)NULL; \
+ }
+
+/* resourceQuarks keeps track of what quarks have been associated with values
+ * in all LTables. If a quark has never been used in an LTable, we don't need
+ * to bother looking for it.
+ */
+
+static unsigned char *resourceQuarks = (unsigned char *)NULL;
+static XrmQuark maxResourceQuark = -1;
+
+/* determines if a quark has been used for a value in any database */
+#define IsResourceQuark(q) ((q) > 0 && (q) <= maxResourceQuark && \
+ resourceQuarks[(q) >> 3] & (1 << ((q) & 7)))
+
+typedef unsigned char XrmBits;
+
+#define BSLASH ((XrmBits) (1 << 5))
+#define NORMAL ((XrmBits) (1 << 4))
+#define EOQ ((XrmBits) (1 << 3))
+#define SEP ((XrmBits) (1 << 2))
+#define ENDOF ((XrmBits) (1 << 1))
+#define SPACE (NORMAL|EOQ|SEP|(XrmBits)0)
+#define RSEP (NORMAL|EOQ|SEP|(XrmBits)1)
+#define EOS (EOQ|SEP|ENDOF|(XrmBits)0)
+#define EOL (EOQ|SEP|ENDOF|(XrmBits)1)
+#define BINDING (NORMAL|EOQ)
+#define ODIGIT (NORMAL|(XrmBits)1)
+
+#define next_char(ch,str) xrmtypes[(unsigned char)((ch) = *(++(str)))]
+#define next_mbchar(ch,len,str) xrmtypes[(unsigned char)(ch = (*db->methods->mbchar)(db->mbstate, str, &len), str += len, ch)]
+
+#define is_space(bits) ((bits) == SPACE)
+#define is_EOQ(bits) ((bits) & EOQ)
+#define is_EOF(bits) ((bits) == EOS)
+#define is_EOL(bits) ((bits) & ENDOF)
+#define is_binding(bits) ((bits) == BINDING)
+#define is_odigit(bits) ((bits) == ODIGIT)
+#define is_separator(bits) ((bits) & SEP)
+#define is_nonpcs(bits) (!(bits))
+#define is_normal(bits) ((bits) & NORMAL)
+#define is_simple(bits) ((bits) & (NORMAL|BSLASH))
+#define is_special(bits) ((bits) & (ENDOF|BSLASH))
+
+/* parsing types */
+static XrmBits Const xrmtypes[256] = {
+ EOS,0,0,0,0,0,0,0,
+ 0,SPACE,EOL,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ SPACE,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,BINDING,NORMAL,NORMAL,NORMAL,BINDING,NORMAL,
+ ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,
+ NORMAL,NORMAL,RSEP,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,BSLASH,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,
+ NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,0
+ /* The rest will be automatically initialized to zero. */
+};
+
+void XrmInitialize()
+{
+ XrmQString = XrmPermStringToQuark("String");
+ XrmQANY = XrmPermStringToQuark("?");
+}
+
+#ifdef NOT_IN_SERVER
+XrmDatabase XrmGetDatabase(display)
+ Display *display;
+{
+ return display->db;
+}
+
+void XrmSetDatabase(display, database)
+ Display *display;
+ XrmDatabase database;
+{
+ display->db = database;
+}
+#endif /* NOT_IN_SERVER */
+
+#if NeedFunctionPrototypes
+void XrmStringToQuarkList(
+ register _Xconst char *name,
+ register XrmQuarkList quarks) /* RETURN */
+#else
+void XrmStringToQuarkList(name, quarks)
+ register char *name;
+ register XrmQuarkList quarks; /* RETURN */
+#endif
+{
+ register XrmBits bits;
+ register Signature sig = 0;
+ register char ch, *tname;
+ register int i = 0;
+
+ if (tname = (char *)name) {
+ tname--;
+ while (!is_EOF(bits = next_char(ch, tname))) {
+ if (is_binding (bits)) {
+ if (i) {
+ /* Found a complete name */
+ *quarks++ = _XrmInternalStringToQuark(name,tname - name,
+ sig, False);
+ i = 0;
+ sig = 0;
+ }
+ name = tname+1;
+ }
+ else {
+ sig = (sig << 1) + ch; /* Compute the signature. */
+ i++;
+ }
+ }
+ *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False);
+ }
+ *quarks = NULLQUARK;
+}
+
+#if NeedFunctionPrototypes
+void XrmStringToBindingQuarkList(
+ register _Xconst char *name,
+ register XrmBindingList bindings, /* RETURN */
+ register XrmQuarkList quarks) /* RETURN */
+#else
+void XrmStringToBindingQuarkList(name, bindings, quarks)
+ register char *name;
+ register XrmBindingList bindings; /* RETURN */
+ register XrmQuarkList quarks; /* RETURN */
+#endif
+{
+ register XrmBits bits;
+ register Signature sig = 0;
+ register char ch, *tname;
+ register XrmBinding binding;
+ register int i = 0;
+
+ if (tname = (char *)name) {
+ tname--;
+ binding = XrmBindTightly;
+ while (!is_EOF(bits = next_char(ch, tname))) {
+ if (is_binding (bits)) {
+ if (i) {
+ /* Found a complete name */
+ *bindings++ = binding;
+ *quarks++ = _XrmInternalStringToQuark(name, tname - name,
+ sig, False);
+
+ i = 0;
+ sig = 0;
+ binding = XrmBindTightly;
+ }
+ name = tname+1;
+
+ if (ch == '*')
+ binding = XrmBindLoosely;
+ }
+ else {
+ sig = (sig << 1) + ch; /* Compute the signature. */
+ i++;
+ }
+ }
+ *bindings = binding;
+ *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False);
+ }
+ *quarks = NULLQUARK;
+}
+
+#ifdef DEBUG
+
+static void PrintQuarkList(quarks, stream)
+ XrmQuarkList quarks;
+ FILE *stream;
+{
+ Bool firstNameSeen;
+
+ for (firstNameSeen = False; *quarks; quarks++) {
+ if (firstNameSeen) {
+ (void) fprintf(stream, ".");
+ }
+ firstNameSeen = True;
+ (void) fputs(XrmQuarkToString(*quarks), stream);
+ }
+} /* PrintQuarkList */
+
+#endif /* DEBUG */
+
+/*ARGSUSED*/
+static void mbnoop(state)
+ XPointer state;
+{
+}
+
+/*ARGSUSED*/
+static char mbchar(state, str, lenp)
+ XPointer state;
+ char *str;
+ int *lenp;
+{
+ *lenp = 1;
+ return *str;
+}
+
+/*ARGSUSED*/
+static char *lcname(state)
+ XPointer state;
+{
+ return "C";
+}
+
+static RConst XrmMethodsRec mb_methods = {
+ mbnoop,
+ mbchar,
+ mbnoop,
+ lcname,
+ mbnoop
+};
+
+static XrmDatabase NewDatabase()
+{
+ register XrmDatabase db;
+
+ db = (XrmDatabase) xalloc(sizeof(XrmHashBucketRec));
+ if (db) {
+ db->table = (NTable)NULL;
+ db->mbstate = (XPointer)NULL;
+#ifdef NOT_IN_SERVER
+ db->methods = _XrmInitParseInfo(&db->mbstate);
+#else
+ db->methods = (XrmMethods) NULL;
+#endif /* NOT_IN_SERVER */
+ if (!db->methods)
+ db->methods = (XrmMethods)&mb_methods;
+ }
+ return db;
+}
+
+/* move all values from ftable to ttable, and free ftable's buckets.
+ * ttable is quaranteed empty to start with.
+ */
+static void MoveValues(ftable, ttable)
+ LTable ftable;
+ register LTable ttable;
+{
+ register VEntry fentry, nfentry;
+ register VEntry *prev;
+ register VEntry *bucket;
+ register VEntry tentry;
+ register int i;
+
+ for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) {
+ for (fentry = *bucket++; fentry; fentry = nfentry) {
+ prev = &LeafHash(ttable, fentry->name);
+ tentry = *prev;
+ *prev = fentry;
+ /* chain on all with same name, to preserve invariant order */
+ while ((nfentry = fentry->next) && nfentry->name == fentry->name)
+ fentry = nfentry;
+ fentry->next = tentry;
+ }
+ }
+ xfree((char *)ftable->buckets);
+}
+
+/* move all tables from ftable to ttable, and free ftable.
+ * ttable is quaranteed empty to start with.
+ */
+static void MoveTables(ftable, ttable)
+ NTable ftable;
+ register NTable ttable;
+{
+ register NTable fentry, nfentry;
+ register NTable *prev;
+ register NTable *bucket;
+ register NTable tentry;
+ register int i;
+
+ for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) {
+ for (fentry = *bucket++; fentry; fentry = nfentry) {
+ prev = &NodeHash(ttable, fentry->name);
+ tentry = *prev;
+ *prev = fentry;
+ /* chain on all with same name, to preserve invariant order */
+ while ((nfentry = fentry->next) && nfentry->name == fentry->name)
+ fentry = nfentry;
+ fentry->next = tentry;
+ }
+ }
+ xfree((char *)ftable);
+}
+
+/* grow the table, based on current number of entries */
+static void GrowTable(prev)
+ NTable *prev;
+{
+ register NTable table;
+ register int i;
+
+ table = *prev;
+ i = table->mask;
+ if (i == 255) /* biggest it gets */
+ return;
+ while (i < 255 && GrowthPred(table->entries, i))
+ i = (i << 1) + 1;
+ i++; /* i is now the new size */
+ if (table->leaf) {
+ register LTable ltable;
+ LTableRec otable;
+
+ ltable = (LTable)table;
+ /* cons up a copy to make MoveValues look symmetric */
+ otable = *ltable;
+ ltable->buckets = (VEntry *)xalloc(i * sizeof(VEntry));
+ if (!ltable->buckets) {
+ ltable->buckets = otable.buckets;
+ return;
+ }
+ ltable->table.mask = i - 1;
+ bzero((char *)ltable->buckets, i * sizeof(VEntry));
+ MoveValues(&otable, ltable);
+ } else {
+ register NTable ntable;
+
+ ntable = (NTable)xalloc(sizeof(NTableRec) + i * sizeof(NTable));
+ if (!ntable)
+ return;
+ *ntable = *table;
+ ntable->mask = i - 1;
+ bzero((char *)NodeBuckets(ntable), i * sizeof(NTable));
+ *prev = ntable;
+ MoveTables(table, ntable);
+ }
+}
+
+/* merge values from ftable into *pprev, destroy ftable in the process */
+static void MergeValues(ftable, pprev, override)
+ LTable ftable;
+ NTable *pprev;
+ Bool override;
+{
+ register VEntry fentry, tentry;
+ register VEntry *prev;
+ register LTable ttable;
+ VEntry *bucket;
+ int i;
+ register XrmQuark q;
+
+ ttable = (LTable)*pprev;
+ if (ftable->table.hasloose)
+ ttable->table.hasloose = 1;
+ for (i = ftable->table.mask, bucket = ftable->buckets;
+ i >= 0;
+ i--, bucket++) {
+ for (fentry = *bucket; fentry; ) {
+ q = fentry->name;
+ prev = &LeafHash(ttable, q);
+ tentry = *prev;
+ while (tentry && tentry->name != q)
+ tentry = *(prev = &tentry->next);
+ /* note: test intentionally uses fentry->name instead of q */
+ /* permits serendipitous inserts */
+ while (tentry && tentry->name == fentry->name) {
+ /* if tentry is earlier, skip it */
+ if (!fentry->tight && tentry->tight) {
+ tentry = *(prev = &tentry->next);
+ continue;
+ }
+ if (fentry->tight != tentry->tight) {
+ /* no match, chain in fentry */
+ *prev = fentry;
+ prev = &fentry->next;
+ fentry = *prev;
+ *prev = tentry;
+ ttable->table.entries++;
+ } else if (override) {
+ /* match, chain in fentry, splice out and free tentry */
+ *prev = fentry;
+ prev = &fentry->next;
+ fentry = *prev;
+ *prev = tentry->next;
+ /* free the overridden entry */
+ xfree((char *)tentry);
+ /* get next tentry */
+ tentry = *prev;
+ } else {
+ /* match, discard fentry */
+ prev = &tentry->next;
+ tentry = fentry; /* use as a temp var */
+ fentry = fentry->next;
+ /* free the overpowered entry */
+ xfree((char *)tentry);
+ /* get next tentry */
+ tentry = *prev;
+ }
+ if (!fentry)
+ break;
+ }
+ /* at this point, tentry cannot match any fentry named q */
+ /* chain in all bindings together, preserve invariant order */
+ while (fentry && fentry->name == q) {
+ *prev = fentry;
+ prev = &fentry->next;
+ fentry = *prev;
+ *prev = tentry;
+ ttable->table.entries++;
+ }
+ }
+ }
+ xfree((char *)ftable->buckets);
+ xfree((char *)ftable);
+ /* resize if necessary, now that we're all done */
+ GROW(pprev);
+}
+
+/* merge tables from ftable into *pprev, destroy ftable in the process */
+static void MergeTables(ftable, pprev, override)
+ NTable ftable;
+ NTable *pprev;
+ Bool override;
+{
+ register NTable fentry, tentry;
+ NTable nfentry;
+ register NTable *prev;
+ register NTable ttable;
+ NTable *bucket;
+ int i;
+ register XrmQuark q;
+
+ ttable = *pprev;
+ if (ftable->hasloose)
+ ttable->hasloose = 1;
+ if (ftable->hasany)
+ ttable->hasany = 1;
+ for (i = ftable->mask, bucket = NodeBuckets(ftable);
+ i >= 0;
+ i--, bucket++) {
+ for (fentry = *bucket; fentry; ) {
+ q = fentry->name;
+ prev = &NodeHash(ttable, q);
+ tentry = *prev;
+ while (tentry && tentry->name != q)
+ tentry = *(prev = &tentry->next);
+ /* note: test intentionally uses fentry->name instead of q */
+ /* permits serendipitous inserts */
+ while (tentry && tentry->name == fentry->name) {
+ /* if tentry is earlier, skip it */
+ if ((fentry->leaf && !tentry->leaf) ||
+ (!fentry->tight && tentry->tight &&
+ (fentry->leaf || !tentry->leaf))) {
+ tentry = *(prev = &tentry->next);
+ continue;
+ }
+ nfentry = fentry->next;
+ if (fentry->leaf != tentry->leaf ||
+ fentry->tight != tentry->tight) {
+ /* no match, just chain in */
+ *prev = fentry;
+ *(prev = &fentry->next) = tentry;
+ ttable->entries++;
+ } else {
+ if (fentry->leaf)
+ MergeValues((LTable)fentry, prev, override);
+ else
+ MergeTables(fentry, prev, override);
+ /* bump to next tentry */
+ tentry = *(prev = &(*prev)->next);
+ }
+ /* bump to next fentry */
+ fentry = nfentry;
+ if (!fentry)
+ break;
+ }
+ /* at this point, tentry cannot match any fentry named q */
+ /* chain in all bindings together, preserve invariant order */
+ while (fentry && fentry->name == q) {
+ *prev = fentry;
+ prev = &fentry->next;
+ fentry = *prev;
+ *prev = tentry;
+ ttable->entries++;
+ }
+ }
+ }
+ xfree((char *)ftable);
+ /* resize if necessary, now that we're all done */
+ GROW(pprev);
+}
+
+void XrmCombineDatabase(from, into, override)
+ XrmDatabase from, *into;
+ Bool override;
+{
+ register NTable *prev;
+ register NTable ftable, ttable, nftable;
+
+ if (!*into) {
+ *into = from;
+ } else if (from) {
+ if (ftable = from->table) {
+ prev = &(*into)->table;
+ ttable = *prev;
+ if (!ftable->leaf) {
+ nftable = ftable->next;
+ if (ttable && !ttable->leaf) {
+ /* both have node tables, merge them */
+ MergeTables(ftable, prev, override);
+ /* bump to into's leaf table, if any */
+ ttable = *(prev = &(*prev)->next);
+ } else {
+ /* into has no node table, link from's in */
+ *prev = ftable;
+ *(prev = &ftable->next) = ttable;
+ }
+ /* bump to from's leaf table, if any */
+ ftable = nftable;
+ } else {
+ /* bump to into's leaf table, if any */
+ if (ttable && !ttable->leaf)
+ ttable = *(prev = &ttable->next);
+ }
+ if (ftable) {
+ /* if into has a leaf, merge, else insert */
+ if (ttable)
+ MergeValues((LTable)ftable, prev, override);
+ else
+ *prev = ftable;
+ }
+ }
+ (from->methods->destroy)(from->mbstate);
+ xfree((char *)from);
+ }
+}
+
+void XrmMergeDatabases(from, into)
+ XrmDatabase from, *into;
+{
+ XrmCombineDatabase(from, into, True);
+}
+
+/* store a value in the database, overriding any existing entry */
+static void PutEntry(db, bindings, quarks, type, value)
+ XrmDatabase db;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation type;
+ XrmValuePtr value;
+{
+ register NTable *pprev, *prev;
+ register NTable table;
+ register XrmQuark q;
+ register VEntry *vprev;
+ register VEntry entry;
+ NTable *nprev, *firstpprev;
+
+#define NEWTABLE(q,i) \
+ table = (NTable)xalloc(sizeof(LTableRec)); \
+ if (!table) \
+ return; \
+ table->name = q; \
+ table->hasloose = 0; \
+ table->hasany = 0; \
+ table->mask = 0; \
+ table->entries = 0; \
+ if (quarks[i]) { \
+ table->leaf = 0; \
+ nprev = NodeBuckets(table); \
+ } else { \
+ table->leaf = 1; \
+ if (!(nprev = (NTable *)xalloc(sizeof(VEntry *)))) \
+ return; \
+ ((LTable)table)->buckets = (VEntry *)nprev; \
+ } \
+ *nprev = (NTable)NULL; \
+ table->next = *prev; \
+ *prev = table
+
+ if (!db || !*quarks)
+ return;
+ table = *(prev = &db->table);
+ /* if already at leaf, bump to the leaf table */
+ if (!quarks[1] && table && !table->leaf)
+ table = *(prev = &table->next);
+ pprev = prev;
+ if (!table || (quarks[1] && table->leaf)) {
+ /* no top-level node table, create one and chain it in */
+ NEWTABLE(NULLQUARK,1);
+ table->tight = 1; /* arbitrary */
+ prev = nprev;
+ } else {
+ /* search along until we need a value */
+ while (quarks[1]) {
+ q = *quarks;
+ table = *(prev = &NodeHash(table, q));
+ while (table && table->name != q)
+ table = *(prev = &table->next);
+ if (!table)
+ break; /* not found */
+ if (quarks[2]) {
+ if (table->leaf)
+ break; /* not found */
+ } else {
+ if (!table->leaf) {
+ /* bump to leaf table, if any */
+ table = *(prev = &table->next);
+ if (!table || table->name != q)
+ break; /* not found */
+ if (!table->leaf) {
+ /* bump to leaf table, if any */
+ table = *(prev = &table->next);
+ if (!table || table->name != q)
+ break; /* not found */
+ }
+ }
+ }
+ if (*bindings == XrmBindTightly) {
+ if (!table->tight)
+ break; /* not found */
+ } else {
+ if (table->tight) {
+ /* bump to loose table, if any */
+ table = *(prev = &table->next);
+ if (!table || table->name != q ||
+ !quarks[2] != table->leaf)
+ break; /* not found */
+ }
+ }
+ /* found that one, bump to next quark */
+ pprev = prev;
+ quarks++;
+ bindings++;
+ }
+ if (!quarks[1]) {
+ /* found all the way to a leaf */
+ q = *quarks;
+ entry = *(vprev = &LeafHash((LTable)table, q));
+ while (entry && entry->name != q)
+ entry = *(vprev = &entry->next);
+ /* if want loose and have tight, bump to next entry */
+ if (entry && *bindings == XrmBindLoosely && entry->tight)
+ entry = *(vprev = &entry->next);
+ if (entry && entry->name == q &&
+ (*bindings == XrmBindTightly) == entry->tight) {
+ /* match, need to override */
+ if ((type == XrmQString) == entry->string &&
+ entry->size == value->size) {
+ /* update type if not String, can be different */
+ if (!entry->string)
+ RepType(entry) = type;
+ /* identical size, just overwrite value */
+ bcopy((char *)value->addr, RawValue(entry), value->size);
+ return;
+ }
+ /* splice out and free old entry */
+ *vprev = entry->next;
+ xfree((char *)entry);
+ (*pprev)->entries--;
+ }
+ /* this is where to insert */
+ prev = (NTable *)vprev;
+ }
+ }
+ /* keep the top table, because we may have to grow it */
+ firstpprev = pprev;
+ /* iterate until we get to the leaf */
+ while (quarks[1]) {
+ /* build a new table and chain it in */
+ NEWTABLE(*quarks,2);
+ if (*quarks++ == XrmQANY)
+ (*pprev)->hasany = 1;
+ if (*bindings++ == XrmBindTightly) {
+ table->tight = 1;
+ } else {
+ table->tight = 0;
+ (*pprev)->hasloose = 1;
+ }
+ (*pprev)->entries++;
+ pprev = prev;
+ prev = nprev;
+ }
+ /* now allocate the value entry */
+ entry = (VEntry)xalloc(((type == XrmQString) ?
+ sizeof(VEntryRec) : sizeof(DEntryRec)) +
+ value->size);
+ if (!entry)
+ return;
+ entry->name = q = *quarks;
+ if (*bindings == XrmBindTightly) {
+ entry->tight = 1;
+ } else {
+ entry->tight = 0;
+ (*pprev)->hasloose = 1;
+ }
+ /* chain it in, with a bit of type cast ugliness */
+ entry->next = *((VEntry *)prev);
+ *((VEntry *)prev) = entry;
+ entry->size = value->size;
+ if (type == XrmQString) {
+ entry->string = 1;
+ } else {
+ entry->string = 0;
+ RepType(entry) = type;
+ }
+ /* save a copy of the value */
+ bcopy((char *)value->addr, RawValue(entry), value->size);
+ (*pprev)->entries++;
+ /* this is a new leaf, need to remember it for search lists */
+ if (q > maxResourceQuark) {
+ unsigned oldsize = (maxResourceQuark + 1) >> 3;
+ unsigned size = ((q | 0x7f) + 1) >> 3; /* reallocate in chunks */
+ if (resourceQuarks)
+ resourceQuarks = (unsigned char *)xrealloc((char *)resourceQuarks,
+ size);
+ else
+ resourceQuarks = (unsigned char *)xalloc(size);
+ if (resourceQuarks) {
+ bzero((char *)&resourceQuarks[oldsize], size - oldsize);
+ maxResourceQuark = (size << 3) - 1;
+ } else {
+ maxResourceQuark = -1;
+ }
+ }
+ if (q > 0 && resourceQuarks)
+ resourceQuarks[q >> 3] |= 1 << (q & 0x7);
+ GROW(firstpprev);
+
+#undef NEWTABLE
+}
+
+void XrmQPutResource(pdb, bindings, quarks, type, value)
+ XrmDatabase *pdb;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation type;
+ XrmValuePtr value;
+{
+ if (!*pdb) *pdb = NewDatabase();
+ PutEntry(*pdb, bindings, quarks, type, value);
+}
+
+#if NeedFunctionPrototypes
+void XrmPutResource(
+ XrmDatabase *pdb,
+ _Xconst char *specifier,
+ _Xconst char *type,
+ XrmValuePtr value)
+#else
+void XrmPutResource(pdb, specifier, type, value)
+ XrmDatabase *pdb;
+ char *specifier;
+ char *type;
+ XrmValuePtr value;
+#endif
+{
+ XrmBinding bindings[MAXDBDEPTH+1];
+ XrmQuark quarks[MAXDBDEPTH+1];
+
+ if (!*pdb) *pdb = NewDatabase();
+ XrmStringToBindingQuarkList(specifier, bindings, quarks);
+ PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value);
+}
+
+#if NeedFunctionPrototypes
+void XrmQPutStringResource(
+ XrmDatabase *pdb,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ _Xconst char *str)
+#else
+void XrmQPutStringResource(pdb, bindings, quarks, str)
+ XrmDatabase *pdb;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ char *str;
+#endif
+{
+ XrmValue value;
+
+ if (!*pdb) *pdb = NewDatabase();
+ value.addr = (XPointer) str;
+ value.size = strlen(str)+1;
+ PutEntry(*pdb, bindings, quarks, XrmQString, &value);
+}
+
+/* Function Name: GetDatabase
+ * Description: Parses a string and stores it as a database.
+ * Arguments: db - the database.
+ * str - a pointer to the string containing the database.
+ * filename - source filename, if any.
+ * doall - whether to do all lines or just one
+ */
+
+/*
+ * This function is highly optimized to inline as much as possible.
+ * Be very careful with modifications, or simplifications, as they
+ * may adversely affect the performance.
+ *
+ * Chris Peterson, MIT X Consortium 5/17/90.
+ */
+
+/*
+ * Xlib spec says max 100 quarks in a lookup, will stop and return if
+ * return if any single production's lhs has more than 100 components.
+ */
+#define QLIST_SIZE 100
+
+/*
+ * This should be big enough to handle things like the XKeysymDB or biggish
+ * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on
+ * the heap.
+ */
+#define DEF_BUFF_SIZE 8192
+
+static void GetIncludeFile();
+
+static void GetDatabase(db, str, filename, doall)
+ XrmDatabase db;
+ register char *str;
+ char *filename;
+ Bool doall;
+{
+ char *rhs;
+ char *lhs, lhs_s[DEF_BUFF_SIZE];
+ XrmQuark quarks[QLIST_SIZE + 1]; /* allow for a terminal NullQuark */
+ XrmBinding bindings[QLIST_SIZE + 1];
+
+ register char *ptr;
+ register XrmBits bits = 0;
+ register char c;
+ register Signature sig;
+ register char *ptr_max;
+ register int num_quarks;
+ register XrmBindingList t_bindings;
+
+ int len, alloc_chars;
+ unsigned long str_len;
+ XrmValue value;
+ Bool only_pcs;
+ Bool dolines;
+
+ if (!db)
+ return;
+
+ /*
+ * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for
+ * speed otherwise malloc the buffer. From a buffer overflow standpoint
+ * we can be sure that neither: a) a component on the lhs, or b) a
+ * value on the rhs, will be longer than the overall length of str,
+ * i.e. strlen(str).
+ *
+ * This should give good performance when parsing "*foo: bar" type
+ * databases as might be passed with -xrm command line options; but
+ * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB
+ * files, the size of the buffers will be overly large. One way
+ * around this would be to double-parse each production with a resulting
+ * performance hit. In any event we can be assured that a lhs component
+ * name or a rhs value won't be longer than str itself.
+ */
+
+ str_len = strlen (str);
+ if (DEF_BUFF_SIZE > str_len) lhs = lhs_s;
+ else if ((lhs = (char*) xalloc (str_len)) == NULL)
+ return;
+
+ alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE;
+ if ((rhs = (char*) xalloc (alloc_chars)) == NULL) {
+ if (lhs != lhs_s) Xfree (lhs);
+ return;
+ }
+
+ (*db->methods->mbinit)(db->mbstate);
+ str--;
+ dolines = True;
+ while (!is_EOF(bits) && dolines) {
+ dolines = doall;
+
+ /*
+ * First: Remove extra whitespace.
+ */
+
+ do {
+ bits = next_char(c, str);
+ } while is_space(bits);
+
+ /*
+ * Ignore empty lines.
+ */
+
+ if (is_EOL(bits))
+ continue; /* start a new line. */
+
+ /*
+ * Second: check the first character in a line to see if it is
+ * "!" signifying a comment, or "#" signifying a directive.
+ */
+
+ if (c == '!') { /* Comment, spin to next newline */
+ while (is_simple(bits = next_char(c, str))) {}
+ if (is_EOL(bits))
+ continue;
+ while (!is_EOL(bits = next_mbchar(c, len, str))) {}
+ str--;
+ continue; /* start a new line. */
+ }
+
+ if (c == '#') { /* Directive */
+ /* remove extra whitespace */
+ only_pcs = True;
+ while (is_space(bits = next_char(c, str))) {};
+ /* only "include" directive is currently defined */
+ if (!strncmp(str, "include", 7)) {
+ str += (7-1);
+ /* remove extra whitespace */
+ while (is_space(bits = next_char(c, str))) {};
+ /* must have a starting " */
+ if (c == '"') {
+ char *fname = str+1;
+ len = 0;
+ do {
+ if (only_pcs) {
+ bits = next_char(c, str);
+ if (is_nonpcs(bits))
+ only_pcs = False;
+ }
+ if (!only_pcs)
+ bits = next_mbchar(c, len, str);
+ } while (c != '"' && !is_EOL(bits));
+ /* must have an ending " */
+ if (c == '"')
+ GetIncludeFile(db, filename, fname, str - len - fname);
+ }
+ }
+ /* spin to next newline */
+ if (only_pcs) {
+ while (is_simple(bits))
+ bits = next_char(c, str);
+ if (is_EOL(bits))
+ continue;
+ }
+ while (!is_EOL(bits))
+ bits = next_mbchar(c, len, str);
+ str--;
+ continue; /* start a new line. */
+ }
+
+ /*
+ * Third: loop through the LHS of the resource specification
+ * storing characters and converting this to a Quark.
+ */
+
+ num_quarks = 0;
+ t_bindings = bindings;
+
+ sig = 0;
+ ptr = lhs;
+ *t_bindings = XrmBindTightly;
+ for(;;) {
+ if (!is_binding(bits)) {
+ while (!is_EOQ(bits)) {
+ *ptr++ = c;
+ sig = (sig << 1) + c; /* Compute the signature. */
+ bits = next_char(c, str);
+ }
+
+ quarks[num_quarks++] =
+ _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False);
+
+ if (num_quarks > QLIST_SIZE) {
+ Xfree(rhs);
+ if (lhs != lhs_s) Xfree (lhs);
+ (*db->methods->mbfinish)(db->mbstate);
+ return;
+ }
+
+ if (is_separator(bits)) {
+ if (!is_space(bits))
+ break;
+
+ /* Remove white space */
+ do {
+ *ptr++ = c;
+ sig = (sig << 1) + c; /* Compute the signature. */
+ } while (is_space(bits = next_char(c, str)));
+
+ /*
+ * The spec doesn't permit it, but support spaces
+ * internal to resource name/class
+ */
+
+ if (is_separator(bits))
+ break;
+ num_quarks--;
+ continue;
+ }
+
+ if (c == '.')
+ *(++t_bindings) = XrmBindTightly;
+ else
+ *(++t_bindings) = XrmBindLoosely;
+
+ sig = 0;
+ ptr = lhs;
+ }
+ else {
+ /*
+ * Magic unspecified feature #254.
+ *
+ * If two separators appear with no Text between them then
+ * ignore them.
+ *
+ * If anyone of those separators is a '*' then the binding
+ * will be loose, otherwise it will be tight.
+ */
+
+ if (c == '*')
+ *t_bindings = XrmBindLoosely;
+ }
+
+ bits = next_char(c, str);
+ }
+
+ quarks[num_quarks] = NULLQUARK;
+
+ /*
+ * Make sure that there is a ':' in this line.
+ */
+
+ if (c != ':') {
+ char oldc;
+
+ /*
+ * A parsing error has occured, toss everything on the line
+ * a new_line can still be escaped with a '\'.
+ */
+
+ while (is_normal(bits))
+ bits = next_char(c, str);
+ if (is_EOL(bits))
+ continue;
+ bits = next_mbchar(c, len, str);
+ do {
+ oldc = c;
+ bits = next_mbchar(c, len, str);
+ } while (c && (c != '\n' || oldc == '\\'));
+ str--;
+ continue;
+ }
+
+ /*
+ * I now have a quark and binding list for the entire left hand
+ * side. "c" currently points to the ":" separating the left hand
+ * side for the right hand side. It is time to begin processing
+ * the right hand side.
+ */
+
+ /*
+ * Fourth: Remove more whitespace
+ */
+
+ for(;;) {
+ if (is_space(bits = next_char(c, str)))
+ continue;
+ if (c != '\\')
+ break;
+ bits = next_char(c, str);
+ if (c == '\n')
+ continue;
+ str--;
+ bits = BSLASH;
+ c = '\\';
+ break;
+ }
+
+ /*
+ * Fifth: Process the right hand side.
+ */
+
+ ptr = rhs;
+ ptr_max = ptr + alloc_chars - 4;
+ only_pcs = True;
+ len = 1;
+
+ for(;;) {
+
+ /*
+ * Tight loop for the normal case: Non backslash, non-end of value
+ * character that will fit into the allocated buffer.
+ */
+
+ if (only_pcs) {
+ while (is_normal(bits) && ptr < ptr_max) {
+ *ptr++ = c;
+ bits = next_char(c, str);
+ }
+ if (is_EOL(bits))
+ break;
+ if (is_nonpcs(bits)) {
+ only_pcs = False;
+ bits = next_mbchar(c, len, str);
+ }
+ }
+ while (!is_special(bits) && ptr + len <= ptr_max) {
+ len = -len;
+ while (len)
+ *ptr++ = str[len++];
+ bits = next_mbchar(c, len, str);
+ }
+
+ if (is_EOL(bits)) {
+ str--;
+ break;
+ }
+
+ if (c == '\\') {
+ /*
+ * We need to do some magic after a backslash.
+ */
+
+ if (only_pcs) {
+ bits = next_char(c, str);
+ if (is_nonpcs(bits))
+ only_pcs = False;
+ }
+ if (!only_pcs)
+ bits = next_mbchar(c, len, str);
+
+ if (is_EOL(bits)) {
+ if (is_EOF(bits))
+ continue;
+ } else if (c == 'n') {
+ /*
+ * "\n" means insert a newline.
+ */
+ *ptr++ = '\n';
+ } else if (c == '\\') {
+ /*
+ * "\\" completes to just one backslash.
+ */
+ *ptr++ = '\\';
+ } else {
+ /*
+ * pick up to three octal digits after the '\'.
+ */
+ char temp[3];
+ int count = 0;
+ while (is_odigit(bits) && count < 3) {
+ temp[count++] = c;
+ if (only_pcs) {
+ bits = next_char(c, str);
+ if (is_nonpcs(bits))
+ only_pcs = False;
+ }
+ if (!only_pcs)
+ bits = next_mbchar(c, len, str);
+ }
+
+ /*
+ * If we found three digits then insert that octal code
+ * into the value string as a character.
+ */
+
+ if (count == 3) {
+ *ptr++ = (unsigned char) ((temp[0] - '0') * 0100 +
+ (temp[1] - '0') * 010 +
+ (temp[2] - '0'));
+ }
+ else {
+ int tcount;
+
+ /*
+ * Otherwise just insert those characters into the
+ * string, since no special processing is needed on
+ * numerics we can skip the special processing.
+ */
+
+ for (tcount = 0; tcount < count; tcount++) {
+ *ptr++ = temp[tcount]; /* print them in
+ the correct order */
+ }
+ }
+ continue;
+ }
+ if (only_pcs) {
+ bits = next_char(c, str);
+ if (is_nonpcs(bits))
+ only_pcs = False;
+ }
+ if (!only_pcs)
+ bits = next_mbchar(c, len, str);
+ }
+
+ /*
+ * It is important to make sure that there is room for at least
+ * four more characters in the buffer, since I can add that
+ * many characters into the buffer after a backslash has occured.
+ */
+
+ if (ptr + len > ptr_max) {
+ char * temp_str;
+
+ alloc_chars += BUFSIZ/10;
+ temp_str = (char *)xrealloc(rhs, sizeof(char) * alloc_chars);
+
+ if (!temp_str) {
+ xfree(rhs);
+ if (lhs != lhs_s) xfree(lhs);
+ (*db->methods->mbfinish)(db->mbstate);
+ return;
+ }
+
+ ptr = temp_str + (ptr - rhs); /* reset pointer. */
+ rhs = temp_str;
+ ptr_max = rhs + alloc_chars - 4;
+ }
+ }
+
+ /*
+ * Lastly: Terminate the value string, and store this entry
+ * into the database.
+ */
+
+ *ptr++ = '\0';
+
+ /* Store it in database */
+ value.size = ptr - rhs;
+ value.addr = (XPointer) rhs;
+
+ PutEntry(db, bindings, quarks, XrmQString, &value);
+ }
+
+ if (lhs != lhs_s) xfree (lhs);
+ xfree(rhs);
+ (*db->methods->mbfinish)(db->mbstate);
+}
+
+#if NeedFunctionPrototypes
+void XrmPutStringResource(
+ XrmDatabase *pdb,
+ _Xconst char*specifier,
+ _Xconst char*str)
+#else
+void XrmPutStringResource(pdb, specifier, str)
+ XrmDatabase *pdb;
+ char *specifier;
+ char *str;
+#endif
+{
+ XrmValue value;
+ XrmBinding bindings[MAXDBDEPTH+1];
+ XrmQuark quarks[MAXDBDEPTH+1];
+
+ if (!*pdb) *pdb = NewDatabase();
+ XrmStringToBindingQuarkList(specifier, bindings, quarks);
+ value.addr = (XPointer) str;
+ value.size = strlen(str)+1;
+ PutEntry(*pdb, bindings, quarks, XrmQString, &value);
+}
+
+
+#if NeedFunctionPrototypes
+void XrmPutLineResource(
+ XrmDatabase *pdb,
+ _Xconst char*line)
+#else
+void XrmPutLineResource(pdb, line)
+ XrmDatabase *pdb;
+ char *line;
+#endif
+{
+ if (!*pdb) *pdb = NewDatabase();
+ GetDatabase(*pdb, line, (char *)NULL, False);
+}
+
+#if NeedFunctionPrototypes
+XrmDatabase XrmGetStringDatabase(
+ _Xconst char *data)
+#else
+XrmDatabase XrmGetStringDatabase(data)
+ char *data;
+#endif
+{
+ XrmDatabase db;
+
+ db = NewDatabase();
+ GetDatabase(db, data, (char *)NULL, True);
+ return db;
+}
+
+/* Function Name: ReadInFile
+ * Description: Reads the file into a buffer.
+ * Arguments: filename - the name of the file.
+ * Returns: An allocated string containing the contents of the file.
+ */
+
+static char *
+ReadInFile(filename)
+char * filename;
+{
+ register int fd, size;
+ char * filebuf;
+
+ if ( (fd = OpenFile(filename)) == -1 )
+ return (char *)NULL;
+
+ GetSizeOfFile(filename, size);
+
+ if (!(filebuf = (char *)xalloc(size + 1))) { /* leave room for '\0' */
+ close(fd);
+ return (char *)NULL;
+ }
+
+ if (ReadFile(fd, filebuf, size) != size) { /* If we didn't read the
+ correct number of bytes. */
+ CloseFile(fd);
+ xfree(filebuf);
+ return (char *)NULL;
+ }
+ CloseFile(fd);
+
+ filebuf[size] = '\0'; /* NULL terminate it. */
+ return filebuf;
+}
+
+static void
+GetIncludeFile(db, base, fname, fnamelen)
+ XrmDatabase db;
+ char *base;
+ char *fname;
+ int fnamelen;
+{
+ int len;
+ char *str;
+ char realfname[BUFSIZ];
+
+ if (fnamelen <= 0 || fnamelen >= BUFSIZ)
+ return;
+ if (*fname != '/' && base && (str = rindex(base, '/'))) {
+ len = str - base + 1;
+ if (len + fnamelen >= BUFSIZ)
+ return;
+ strncpy(realfname, base, len);
+ strncpy(realfname + len, fname, fnamelen);
+ realfname[len + fnamelen] = '\0';
+ } else {
+ strncpy(realfname, fname, fnamelen);
+ realfname[fnamelen] = '\0';
+ }
+ if (!(str = ReadInFile(realfname)))
+ return;
+ GetDatabase(db, str, realfname, True);
+ xfree(str);
+}
+
+#if NeedFunctionPrototypes
+XrmDatabase XrmGetFileDatabase(
+ _Xconst char *filename)
+#else
+XrmDatabase XrmGetFileDatabase(filename)
+ char *filename;
+#endif
+{
+ XrmDatabase db;
+ char *str;
+
+ if (!(str = ReadInFile(filename)))
+ return (XrmDatabase)NULL;
+
+ db = NewDatabase();
+ GetDatabase(db, str, filename, True);
+ xfree(str);
+ return db;
+}
+
+#if NeedFunctionPrototypes
+Status XrmCombineFileDatabase(
+ _Xconst char *filename,
+ XrmDatabase *target,
+ Bool override)
+#else
+Status XrmCombineFileDatabase(filename, target, override)
+ char *filename;
+ XrmDatabase *target;
+ Bool override;
+#endif
+{
+ XrmDatabase db;
+ char *str;
+
+ if (!(str = ReadInFile(filename)))
+ return 0;
+ if (override) {
+ db = *target;
+ if (!db)
+ *target = db = NewDatabase();
+ } else
+ db = NewDatabase();
+ GetDatabase(db, str, filename, True);
+ xfree(str);
+ if (!override)
+ XrmCombineDatabase(db, target, False);
+ return 1;
+}
+
+/* call the user proc for every value in the table, arbitrary order.
+ * stop if user proc returns True. level is current depth in database.
+ */
+/*ARGSUSED*/
+static Bool EnumLTable(table, names, classes, level, closure)
+ LTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ register int level;
+ register EClosure closure;
+{
+ register VEntry *bucket;
+ register int i;
+ register VEntry entry;
+ XrmValue value;
+ XrmRepresentation type;
+ Bool tightOk;
+
+ closure->bindings[level] = (table->table.tight ?
+ XrmBindTightly : XrmBindLoosely);
+ closure->quarks[level] = table->table.name;
+ level++;
+ tightOk = !*names;
+ closure->quarks[level + 1] = NULLQUARK;
+ for (i = table->table.mask, bucket = table->buckets;
+ i >= 0;
+ i--, bucket++) {
+ for (entry = *bucket; entry; entry = entry->next) {
+ if (entry->tight && !tightOk)
+ continue;
+ closure->bindings[level] = (entry->tight ?
+ XrmBindTightly : XrmBindLoosely);
+ closure->quarks[level] = entry->name;
+ value.size = entry->size;
+ if (entry->string) {
+ type = XrmQString;
+ value.addr = StringValue(entry);
+ } else {
+ type = RepType(entry);
+ value.addr = DataValue(entry);
+ }
+ if ((*closure->proc)(&closure->db, closure->bindings+1,
+ closure->quarks+1, &type, &value,
+ closure->closure))
+ return True;
+ }
+ }
+ return False;
+}
+
+static Bool EnumAllNTable(table, level, closure)
+ NTable table;
+ register int level;
+ register EClosure closure;
+{
+ register NTable *bucket;
+ register int i;
+ register NTable entry;
+ XrmQuark empty = NULLQUARK;
+
+ if (level >= MAXDBDEPTH)
+ return False;
+ for (i = table->mask, bucket = NodeBuckets(table);
+ i >= 0;
+ i--, bucket++) {
+ for (entry = *bucket; entry; entry = entry->next) {
+ if (entry->leaf) {
+ if (EnumLTable((LTable)entry, &empty, &empty, level, closure))
+ return True;
+ } else {
+ closure->bindings[level] = (entry->tight ?
+ XrmBindTightly : XrmBindLoosely);
+ closure->quarks[level] = entry->name;
+ if (EnumAllNTable(entry, level+1, closure))
+ return True;
+ }
+ }
+ }
+ return False;
+}
+
+/* recurse on every table in the table, arbitrary order.
+ * stop if user proc returns True. level is current depth in database.
+ */
+static Bool EnumNTable(table, names, classes, level, closure)
+ NTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ register int level;
+ register EClosure closure;
+{
+ register NTable entry;
+ register XrmQuark q;
+ register unsigned int leaf;
+ Bool (*get)();
+ Bool bilevel;
+
+/* find entries named ename, leafness leaf, tight or loose, and call get */
+#define ITIGHTLOOSE(ename) \
+ NFIND(ename); \
+ if (entry) { \
+ if (leaf == entry->leaf) { \
+ if (!leaf && !entry->tight && entry->next && \
+ entry->next->name == q && entry->next->tight && \
+ (bilevel || entry->next->hasloose) && \
+ EnumLTable((LTable)entry->next, names+1, classes+1, \
+ level, closure)) \
+ return True; \
+ if ((*get)(entry, names+1, classes+1, level, closure)) \
+ return True; \
+ if (entry->tight && (entry = entry->next) && \
+ entry->name == q && leaf == entry->leaf && \
+ (*get)(entry, names+1, classes+1, level, closure)) \
+ return True; \
+ } else if (entry->leaf) { \
+ if ((bilevel || entry->hasloose) && \
+ EnumLTable((LTable)entry, names+1, classes+1, level, closure))\
+ return True; \
+ if (entry->tight && (entry = entry->next) && \
+ entry->name == q && (bilevel || entry->hasloose) && \
+ EnumLTable((LTable)entry, names+1, classes+1, level, closure))\
+ return True; \
+ } \
+ }
+
+/* find entries named ename, leafness leaf, loose only, and call get */
+#define ILOOSE(ename) \
+ NFIND(ename); \
+ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \
+ entry = (NTable)NULL; \
+ if (entry) { \
+ if (leaf == entry->leaf) { \
+ if ((*get)(entry, names+1, classes+1, level, closure)) \
+ return True; \
+ } else if (entry->leaf && (bilevel || entry->hasloose)) { \
+ if (EnumLTable((LTable)entry, names+1, classes+1, level, closure))\
+ return True; \
+ } \
+ }
+
+ if (level >= MAXDBDEPTH)
+ return False;
+ closure->bindings[level] = (table->tight ?
+ XrmBindTightly : XrmBindLoosely);
+ closure->quarks[level] = table->name;
+ level++;
+ if (!*names) {
+ if (EnumAllNTable(table, level, closure))
+ return True;
+ } else {
+ if (names[1] || closure->mode == XrmEnumAllLevels) {
+ get = EnumNTable; /* recurse */
+ leaf = 0;
+ bilevel = !names[1];
+ } else {
+ get = EnumLTable; /* bottom of recursion */
+ leaf = 1;
+ bilevel = False;
+ }
+ if (table->hasloose && closure->mode == XrmEnumAllLevels) {
+ NTable *bucket;
+ int i;
+ XrmQuark empty = NULLQUARK;
+
+ for (i = table->mask, bucket = NodeBuckets(table);
+ i >= 0;
+ i--, bucket++) {
+ q = NULLQUARK;
+ for (entry = *bucket; entry; entry = entry->next) {
+ if (!entry->tight && entry->name != q &&
+ entry->name != *names && entry->name != *classes) {
+ q = entry->name;
+ if (entry->leaf) {
+ if (EnumLTable((LTable)entry, &empty, &empty,
+ level, closure))
+ return True;
+ } else {
+ if (EnumNTable(entry, &empty, &empty,
+ level, closure))
+ return True;
+ }
+ }
+ }
+ }
+ }
+
+ ITIGHTLOOSE(*names); /* do name, tight and loose */
+ ITIGHTLOOSE(*classes); /* do class, tight and loose */
+ if (table->hasany) {
+ ITIGHTLOOSE(XrmQANY); /* do ANY, tight and loose */
+ }
+ if (table->hasloose) {
+ while (1) {
+ names++;
+ classes++;
+ if (!*names)
+ break;
+ if (!names[1] && closure->mode != XrmEnumAllLevels) {
+ get = EnumLTable; /* bottom of recursion */
+ leaf = 1;
+ }
+ ILOOSE(*names); /* loose names */
+ ILOOSE(*classes); /* loose classes */
+ if (table->hasany) {
+ ILOOSE(XrmQANY); /* loose ANY */
+ }
+ }
+ names--;
+ classes--;
+ }
+ }
+ /* now look for matching leaf nodes */
+ entry = table->next;
+ if (!entry)
+ return False;
+ if (entry->leaf) {
+ if (entry->tight && !table->tight)
+ entry = entry->next;
+ } else {
+ entry = entry->next;
+ if (!entry || !entry->tight)
+ return False;
+ }
+ if (!entry || entry->name != table->name)
+ return False;
+ /* found one */
+ level--;
+ if ((!*names || entry->hasloose) &&
+ EnumLTable((LTable)entry, names, classes, level, closure))
+ return True;
+ if (entry->tight && entry == table->next && (entry = entry->next) &&
+ entry->name == table->name && (!*names || entry->hasloose))
+ return EnumLTable((LTable)entry, names, classes, level, closure);
+ return False;
+
+#undef ITIGHTLOOSE
+#undef ILOOSE
+}
+
+/* call the proc for every value in the database, arbitrary order.
+ * stop if the proc returns True.
+ */
+Bool XrmEnumerateDatabase(db, names, classes, mode, proc, closure)
+ XrmDatabase db;
+ XrmNameList names;
+ XrmClassList classes;
+ int mode;
+ DBEnumProc proc;
+ XPointer closure;
+{
+ XrmBinding bindings[MAXDBDEPTH+2];
+ XrmQuark quarks[MAXDBDEPTH+2];
+ register NTable table;
+ EClosureRec eclosure;
+
+ if (!db)
+ return False;
+ eclosure.db = db;
+ eclosure.proc = proc;
+ eclosure.closure = closure;
+ eclosure.bindings = bindings;
+ eclosure.quarks = quarks;
+ eclosure.mode = mode;
+ table = db->table;
+ if (table && !table->leaf && !*names && mode == XrmEnumOneLevel)
+ table = table->next;
+ if (table) {
+ if (!table->leaf)
+ return EnumNTable(table, names, classes, 0, &eclosure);
+ else
+ return EnumLTable((LTable)table, names, classes, 0, &eclosure);
+ }
+ return False;
+}
+
+static void PrintBindingQuarkList(bindings, quarks, stream)
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ FILE *stream;
+{
+ Bool firstNameSeen;
+
+ for (firstNameSeen = False; *quarks; bindings++, quarks++) {
+ if (*bindings == XrmBindLoosely) {
+ (void) fprintf(stream, "*");
+ } else if (firstNameSeen) {
+ (void) fprintf(stream, ".");
+ }
+ firstNameSeen = True;
+ (void) fputs(XrmQuarkToString(*quarks), stream);
+ }
+}
+
+/* output out the entry in correct file syntax */
+/*ARGSUSED*/
+static Bool DumpEntry(db, bindings, quarks, type, value, data)
+ XrmDatabase *db;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation *type;
+ XrmValuePtr value;
+ XPointer data;
+{
+ FILE *stream = (FILE *)data;
+ register unsigned int i;
+ register char *s;
+ register char c;
+
+ if (*type != XrmQString)
+ (void) putc('!', stream);
+ PrintBindingQuarkList(bindings, quarks, stream);
+ s = value->addr;
+ i = value->size;
+ if (*type == XrmQString) {
+ (void) fputs(":\t", stream);
+ if (i)
+ i--;
+ }
+ else
+ fprintf(stream, "=%s:\t", XrmRepresentationToString(*type));
+ if (i && (*s == ' ' || *s == '\t'))
+ (void) putc('\\', stream); /* preserve leading whitespace */
+ while (i--) {
+ c = *s++;
+ if (c == '\n') {
+ if (i)
+ (void) fputs("\\n\\\n", stream);
+ else
+ (void) fputs("\\n", stream);
+ } else if (c == '\\')
+ (void) fputs("\\\\", stream);
+ else if ((c < ' ' && c != '\t') ||
+ ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0))
+ (void) fprintf(stream, "\\%03o", (unsigned char)c);
+ else
+ (void) putc(c, stream);
+ }
+ (void) putc('\n', stream);
+ return False;
+}
+
+#ifdef DEBUG
+
+void PrintTable(table, file)
+ NTable table;
+ FILE *file;
+{
+ XrmBinding bindings[MAXDBDEPTH+1];
+ XrmQuark quarks[MAXDBDEPTH+1];
+ EClosureRec closure;
+ XrmQuark empty = NULLQUARK;
+
+ closure.db = (XrmDatabase)NULL;
+ closure.proc = DumpEntry;
+ closure.closure = (XPointer)file;
+ closure.bindings = bindings;
+ closure.quarks = quarks;
+ closure.mode = XrmEnumAllLevels;
+ if (table->leaf)
+ EnumLTable((LTable)table, &empty, &empty, 0, &closure);
+ else
+ EnumNTable(table, &empty, &empty, 0, &closure);
+}
+
+#endif /* DEBUG */
+
+#if NeedFunctionPrototypes
+void XrmPutFileDatabase(
+ XrmDatabase db,
+ _Xconst char *fileName)
+#else
+void XrmPutFileDatabase(db, fileName)
+ XrmDatabase db;
+ char *fileName;
+#endif
+{
+ FILE *file;
+ XrmQuark empty = NULLQUARK;
+
+ if (!db) return;
+ if (!(file = fopen(fileName, "w"))) return;
+ (void)XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels,
+ DumpEntry, (XPointer) file);
+ fclose(file);
+}
+
+/* macros used in get/search functions */
+
+/* find entries named ename, leafness leaf, tight or loose, and call get */
+#define GTIGHTLOOSE(ename,looseleaf) \
+ NFIND(ename); \
+ if (entry) { \
+ if (leaf == entry->leaf) { \
+ if (!leaf && !entry->tight && entry->next && \
+ entry->next->name == q && entry->next->tight && \
+ entry->next->hasloose && \
+ looseleaf((LTable)entry->next, names+1, classes+1, closure)) \
+ return True; \
+ if ((*get)(entry, names+1, classes+1, closure)) \
+ return True; \
+ if (entry->tight && (entry = entry->next) && \
+ entry->name == q && leaf == entry->leaf && \
+ (*get)(entry, names+1, classes+1, closure)) \
+ return True; \
+ } else if (entry->leaf) { \
+ if (entry->hasloose && \
+ looseleaf((LTable)entry, names+1, classes+1, closure)) \
+ return True; \
+ if (entry->tight && (entry = entry->next) && \
+ entry->name == q && entry->hasloose && \
+ looseleaf((LTable)entry, names+1, classes+1, closure)) \
+ return True; \
+ } \
+ }
+
+/* find entries named ename, leafness leaf, loose only, and call get */
+#define GLOOSE(ename,looseleaf) \
+ NFIND(ename); \
+ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \
+ entry = (NTable)NULL; \
+ if (entry) { \
+ if (leaf == entry->leaf) { \
+ if ((*get)(entry, names+1, classes+1, closure)) \
+ return True; \
+ } else if (entry->leaf && entry->hasloose) { \
+ if (looseleaf((LTable)entry, names+1, classes+1, closure)) \
+ return True; \
+ } \
+ }
+
+/* add tight/loose entry to the search list, return True if list is full */
+/*ARGSUSED*/
+static Bool AppendLEntry(table, names, classes, closure)
+ LTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ register SClosure closure;
+{
+ /* check for duplicate */
+ if (closure->idx >= 0 && closure->list[closure->idx] == table)
+ return False;
+ if (closure->idx == closure->limit)
+ return True;
+ /* append it */
+ closure->idx++;
+ closure->list[closure->idx] = table;
+ return False;
+}
+
+/* add loose entry to the search list, return True if list is full */
+/*ARGSUSED*/
+static Bool AppendLooseLEntry(table, names, classes, closure)
+ LTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ register SClosure closure;
+{
+ /* check for duplicate */
+ if (closure->idx >= 0 && closure->list[closure->idx] == table)
+ return False;
+ if (closure->idx >= closure->limit - 1)
+ return True;
+ /* append it */
+ closure->idx++;
+ closure->list[closure->idx] = LOOSESEARCH;
+ closure->idx++;
+ closure->list[closure->idx] = table;
+ return False;
+}
+
+/* search for a leaf table */
+static Bool SearchNEntry(table, names, classes, closure)
+ NTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ SClosure closure;
+{
+ register NTable entry;
+ register XrmQuark q;
+ register unsigned int leaf;
+ Bool (*get)();
+
+ if (names[1]) {
+ get = SearchNEntry; /* recurse */
+ leaf = 0;
+ } else {
+ get = AppendLEntry; /* bottom of recursion */
+ leaf = 1;
+ }
+ GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */
+ GTIGHTLOOSE(*classes, AppendLooseLEntry); /* do class, tight and loose */
+ if (table->hasany) {
+ GTIGHTLOOSE(XrmQANY, AppendLooseLEntry); /* do ANY, tight and loose */
+ }
+ if (table->hasloose) {
+ while (1) {
+ names++;
+ classes++;
+ if (!*names)
+ break;
+ if (!names[1]) {
+ get = AppendLEntry; /* bottom of recursion */
+ leaf = 1;
+ }
+ GLOOSE(*names, AppendLooseLEntry); /* loose names */
+ GLOOSE(*classes, AppendLooseLEntry); /* loose classes */
+ if (table->hasany) {
+ GLOOSE(XrmQANY, AppendLooseLEntry); /* loose ANY */
+ }
+ }
+ }
+ /* now look for matching leaf nodes */
+ entry = table->next;
+ if (!entry)
+ return False;
+ if (entry->leaf) {
+ if (entry->tight && !table->tight)
+ entry = entry->next;
+ } else {
+ entry = entry->next;
+ if (!entry || !entry->tight)
+ return False;
+ }
+ if (!entry || entry->name != table->name)
+ return False;
+ /* found one */
+ if (entry->hasloose &&
+ AppendLooseLEntry((LTable)entry, names, classes, closure))
+ return True;
+ if (entry->tight && entry == table->next && (entry = entry->next) &&
+ entry->name == table->name && entry->hasloose)
+ return AppendLooseLEntry((LTable)entry, names, classes, closure);
+ return False;
+}
+
+Bool XrmQGetSearchList(db, names, classes, searchList, listLength)
+ XrmDatabase db;
+ XrmNameList names;
+ XrmClassList classes;
+ XrmSearchList searchList; /* RETURN */
+ int listLength;
+{
+ register NTable table;
+ SClosureRec closure;
+
+ if (listLength <= 0)
+ return False;
+ closure.list = (LTable *)searchList;
+ closure.idx = -1;
+ closure.limit = listLength - 2;
+ if (db) {
+ table = db->table;
+ if (*names) {
+ if (table && !table->leaf) {
+ if (SearchNEntry(table, names, classes, &closure))
+ return False;
+ } else if (table && table->hasloose &&
+ AppendLooseLEntry((LTable)table, names, classes,
+ &closure))
+ return False;
+ } else {
+ if (table && !table->leaf)
+ table = table->next;
+ if (table && AppendLEntry((LTable)table, names, classes, &closure))
+ return False;
+ }
+ }
+ closure.list[closure.idx + 1] = (LTable)NULL;
+ return True;
+}
+
+Bool XrmQGetSearchResource(searchList, name, class, pType, pValue)
+ XrmSearchList searchList;
+ register XrmName name;
+ register XrmClass class;
+ XrmRepresentation *pType; /* RETURN */
+ XrmValue *pValue; /* RETURN */
+{
+ register LTable *list;
+ register LTable table;
+ register VEntry entry;
+ int flags;
+
+/* find tight or loose entry */
+#define VTIGHTLOOSE(q) \
+ entry = LeafHash(table, q); \
+ while (entry && entry->name != q) \
+ entry = entry->next; \
+ if (entry) \
+ break
+
+/* find loose entry */
+#define VLOOSE(q) \
+ entry = LeafHash(table, q); \
+ while (entry && entry->name != q) \
+ entry = entry->next; \
+ if (entry) { \
+ if (!entry->tight) \
+ break; \
+ if ((entry = entry->next) && entry->name == q) \
+ break; \
+ }
+
+ list = (LTable *)searchList;
+ /* figure out which combination of name and class we need to search for */
+ flags = 0;
+ if (IsResourceQuark(name))
+ flags = 2;
+ if (IsResourceQuark(class))
+ flags |= 1;
+ if (!flags) {
+ /* neither name nor class has ever been used to name a resource */
+ table = (LTable)NULL;
+ } else if (flags == 3) {
+ /* both name and class */
+ while (table = *list++) {
+ if (table != LOOSESEARCH) {
+ VTIGHTLOOSE(name); /* do name, tight and loose */
+ VTIGHTLOOSE(class); /* do class, tight and loose */
+ } else {
+ table = *list++;
+ VLOOSE(name); /* do name, loose only */
+ VLOOSE(class); /* do class, loose only */
+ }
+ }
+ } else {
+ /* just one of name or class */
+ if (flags == 1)
+ name = class;
+ while (table = *list++) {
+ if (table != LOOSESEARCH) {
+ VTIGHTLOOSE(name); /* tight and loose */
+ } else {
+ table = *list++;
+ VLOOSE(name); /* loose only */
+ }
+ }
+ }
+ if (table) {
+ /* found a match */
+ if (entry->string) {
+ *pType = XrmQString;
+ pValue->addr = StringValue(entry);
+ } else {
+ *pType = RepType(entry);
+ pValue->addr = DataValue(entry);
+ }
+ pValue->size = entry->size;
+ return True;
+ }
+ *pType = NULLQUARK;
+ pValue->addr = (XPointer)NULL;
+ pValue->size = 0;
+ return False;
+
+#undef VTIGHTLOOSE
+#undef VLOOSE
+}
+
+/* look for a tight/loose value */
+static Bool GetVEntry(table, names, classes, closure)
+ LTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ VClosure closure;
+{
+ register VEntry entry;
+ register XrmQuark q;
+
+ /* try name first */
+ q = *names;
+ entry = LeafHash(table, q);
+ while (entry && entry->name != q)
+ entry = entry->next;
+ if (!entry) {
+ /* not found, try class */
+ q = *classes;
+ entry = LeafHash(table, q);
+ while (entry && entry->name != q)
+ entry = entry->next;
+ if (!entry)
+ return False;
+ }
+ if (entry->string) {
+ *closure->type = XrmQString;
+ closure->value->addr = StringValue(entry);
+ } else {
+ *closure->type = RepType(entry);
+ closure->value->addr = DataValue(entry);
+ }
+ closure->value->size = entry->size;
+ return True;
+}
+
+/* look for a loose value */
+static Bool GetLooseVEntry(table, names, classes, closure)
+ LTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ VClosure closure;
+{
+ register VEntry entry;
+ register XrmQuark q;
+
+#define VLOOSE(ename) \
+ q = ename; \
+ entry = LeafHash(table, q); \
+ while (entry && entry->name != q) \
+ entry = entry->next; \
+ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \
+ entry = (VEntry)NULL;
+
+ /* bump to last component */
+ while (names[1]) {
+ names++;
+ classes++;
+ }
+ VLOOSE(*names); /* do name, loose only */
+ if (!entry) {
+ VLOOSE(*classes); /* do class, loose only */
+ if (!entry)
+ return False;
+ }
+ if (entry->string) {
+ *closure->type = XrmQString;
+ closure->value->addr = StringValue(entry);
+ } else {
+ *closure->type = RepType(entry);
+ closure->value->addr = DataValue(entry);
+ }
+ closure->value->size = entry->size;
+ return True;
+
+#undef VLOOSE
+}
+
+/* recursive search for a value */
+static Bool GetNEntry(table, names, classes, closure)
+ NTable table;
+ XrmNameList names;
+ XrmClassList classes;
+ VClosure closure;
+{
+ register NTable entry;
+ register XrmQuark q;
+ register unsigned int leaf;
+ Bool (*get)();
+ NTable otable;
+
+ if (names[2]) {
+ get = GetNEntry; /* recurse */
+ leaf = 0;
+ } else {
+ get = GetVEntry; /* bottom of recursion */
+ leaf = 1;
+ }
+ GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */
+ GTIGHTLOOSE(*classes, GetLooseVEntry); /* do class, tight and loose */
+ if (table->hasany) {
+ GTIGHTLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, tight and loose */
+ }
+ if (table->hasloose) {
+ while (1) {
+ names++;
+ classes++;
+ if (!names[1])
+ break;
+ if (!names[2]) {
+ get = GetVEntry; /* bottom of recursion */
+ leaf = 1;
+ }
+ GLOOSE(*names, GetLooseVEntry); /* do name, loose only */
+ GLOOSE(*classes, GetLooseVEntry); /* do class, loose only */
+ if (table->hasany) {
+ GLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, loose only */
+ }
+ }
+ }
+ /* look for matching leaf tables */
+ otable = table;
+ table = table->next;
+ if (!table)
+ return False;
+ if (table->leaf) {
+ if (table->tight && !otable->tight)
+ table = table->next;
+ } else {
+ table = table->next;
+ if (!table || !table->tight)
+ return False;
+ }
+ if (!table || table->name != otable->name)
+ return False;
+ /* found one */
+ if (table->hasloose &&
+ GetLooseVEntry((LTable)table, names, classes, closure))
+ return True;
+ if (table->tight && table == otable->next) {
+ table = table->next;
+ if (table && table->name == otable->name && table->hasloose)
+ return GetLooseVEntry((LTable)table, names, classes, closure);
+ }
+ return False;
+}
+
+Bool XrmQGetResource(db, names, classes, pType, pValue)
+ XrmDatabase db;
+ XrmNameList names;
+ XrmClassList classes;
+ XrmRepresentation *pType; /* RETURN */
+ XrmValuePtr pValue; /* RETURN */
+{
+ register NTable table;
+ VClosureRec closure;
+
+ if (db && *names) {
+ closure.type = pType;
+ closure.value = pValue;
+ table = db->table;
+ if (names[1]) {
+ if (table && !table->leaf) {
+ if (GetNEntry(table, names, classes, &closure))
+ return True;
+ } else if (table && table->hasloose &&
+ GetLooseVEntry((LTable)table, names, classes, &closure))
+ return True;
+ } else {
+ if (table && !table->leaf)
+ table = table->next;
+ if (table && GetVEntry((LTable)table, names, classes, &closure))
+ return True;
+ }
+ }
+ *pType = NULLQUARK;
+ pValue->addr = (XPointer)NULL;
+ pValue->size = 0;
+ return False;
+}
+
+#if NeedFunctionPrototypes
+Bool XrmGetResource(db, name_str, class_str, pType_str, pValue)
+ XrmDatabase db;
+ _Xconst char *name_str;
+ _Xconst char *class_str;
+ XrmString *pType_str; /* RETURN */
+ XrmValuePtr pValue; /* RETURN */
+#else
+Bool XrmGetResource(db, name_str, class_str, pType_str, pValue)
+ XrmDatabase db;
+ XrmString name_str;
+ XrmString class_str;
+ XrmString *pType_str; /* RETURN */
+ XrmValuePtr pValue; /* RETURN */
+#endif
+{
+ XrmName names[MAXDBDEPTH+1];
+ XrmClass classes[MAXDBDEPTH+1];
+ XrmRepresentation fromType;
+ Bool result;
+
+ XrmStringToNameList(name_str, names);
+ XrmStringToClassList(class_str, classes);
+ result = XrmQGetResource(db, names, classes, &fromType, pValue);
+ (*pType_str) = XrmQuarkToString(fromType);
+ return result;
+}
+
+/* destroy all values, plus table itself */
+static void DestroyLTable(table)
+ LTable table;
+{
+ register int i;
+ register VEntry *buckets;
+ register VEntry entry, next;
+
+ buckets = table->buckets;
+ for (i = table->table.mask; i >= 0; i--, buckets++) {
+ for (next = *buckets; entry = next; ) {
+ next = entry->next;
+ xfree((char *)entry);
+ }
+ }
+ xfree((char *)table->buckets);
+ xfree((char *)table);
+}
+
+/* destroy all contained tables, plus table itself */
+static void DestroyNTable(table)
+ NTable table;
+{
+ register int i;
+ register NTable *buckets;
+ register NTable entry, next;
+
+ buckets = NodeBuckets(table);
+ for (i = table->mask; i >= 0; i--, buckets++) {
+ for (next = *buckets; entry = next; ) {
+ next = entry->next;
+ if (entry->leaf)
+ DestroyLTable((LTable)entry);
+ else
+ DestroyNTable(entry);
+ }
+ }
+ xfree((char *)table);
+}
+
+char *XrmLocaleOfDatabase(db)
+ XrmDatabase db;
+{
+ return (*db->methods->lcname)(db->mbstate);
+}
+
+void XrmDestroyDatabase(db)
+ XrmDatabase db;
+{
+ register NTable table, next;
+
+ if (db) {
+ for (next = db->table; table = next; ) {
+ next = table->next;
+ if (table->leaf)
+ DestroyLTable((LTable)table);
+ else
+ DestroyNTable(table);
+ }
+ (*db->methods->destroy)(db->mbstate);
+ xfree((char *)db);
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/XrmI.h b/xc/programs/Xserver/Xprint/XrmI.h
new file mode 100644
index 000000000..25afd0e51
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/XrmI.h
@@ -0,0 +1,68 @@
+/* $XConsortium: XrmI.h /main/1 1996/09/28 16:59:28 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*
+
+Copyright 1990 by the Massachusetts Institute of Technology
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of M.I.T. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. M.I.T. makes no representations about the
+suitability of this software for any purpose. It is provided "as is"
+without express or implied warranty.
+
+*/
+
+/*
+ * Macros to abstract out reading the file, and getting its size.
+ *
+ * You may need to redefine these for various other operating systems.
+ */
+
+#include <X11/Xos.h>
+#include <sys/stat.h>
+
+#define OpenFile(name) open((name), O_RDONLY)
+#define CloseFile(fd) close((fd))
+#define ReadFile(fd,buf,size) read((fd), (buf), (size))
+#define GetSizeOfFile(name,size) \
+{ \
+ struct stat status_buffer; \
+ if ( (stat((name), &status_buffer)) == -1 ) \
+ size = -1; \
+ else \
+ size = status_buffer.st_size; \
+}
diff --git a/xc/programs/Xserver/Xprint/attributes.c b/xc/programs/Xserver/Xprint/attributes.c
new file mode 100644
index 000000000..9001c2f3b
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/attributes.c
@@ -0,0 +1,1577 @@
+/* $XConsortium: attributes.c /main/6 1996/12/30 14:56:11 kaleb $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: attributes.c
+** *
+** * Contents:
+** * Implementation of the attribute store for Xp.
+** *
+** * Copyright: Copyright 1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.7 1997/01/18 06:53:09 dawes Exp $ */
+
+#include <Xproto.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <pwd.h>
+
+#include <scrnintstr.h>
+
+#define _XP_PRINT_SERVER_
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#include "Xrm.c"
+
+static XrmDatabase CopyDb(XrmDatabase inDb);
+
+extern XrmDatabase XpSpoolerGetServerAttributes();
+
+static int attrGeneration = 0;
+
+typedef struct {
+ XrmDatabase *pDb;
+ char *qualifier;
+ char *modelId;
+} DbEnumStruct;
+
+typedef struct {
+ char *stringDb;
+ int nextPos;
+ int space;
+} StringDbStruct;
+
+typedef struct _printerAttrs {
+ struct _printerAttrs *next;
+ char *name;
+ char *qualifier;
+ XrmDatabase printerAttrs;
+ XrmDatabase docAttrs;
+ XrmDatabase jobAttrs;
+} PrAttrs, *PrAttrPtr;
+
+static PrAttrPtr attrList = (PrAttrPtr)NULL;
+
+typedef struct _systemAttrs {
+ XrmDatabase doc;
+ XrmDatabase job;
+ XrmDatabase printers;
+ XrmDatabase server;
+} SysAttrs, *SysAttrsPtr;
+
+SysAttrs systemAttributes;
+
+/*
+ * attrCtxtPrivIndex hold the attribute store's context private index.
+ * This index is allocated at the time the attribute store is initialized.
+ */
+static int attrCtxtPrivIndex;
+
+/*
+ * The ContextAttrs structure descibes the context private space reserved
+ * by the attribute store.
+ */
+typedef struct _contextAttrs {
+ XrmDatabase printerAttrs;
+ XrmDatabase docAttrs;
+ XrmDatabase jobAttrs;
+ XrmDatabase pageAttrs;
+} ContextAttrs, *ContextAttrPtr;
+
+/*
+ * XPDIR is relative to (i.e. is a subdir of) XPRINTDIR/$LANG.
+ */
+static const char XPDIR[] = "/print";
+/*
+ * The following files/directories define or are within subdirectories of the
+ * above-defined XPDIR.
+ */
+static const char XPPRINTERATTRFILE[] = "/attributes/printer";
+static const char XPJOBATTRFILE[] = "/attributes/job";
+static const char XPDOCATTRFILE[] = "/attributes/document";
+static const char XPMODELDIR[] = "/models";
+
+static char NULL_STRING[] = "\0";
+
+/*
+ * XpGetConfigDir returns a string containing the path name of the print
+ * server configuration directory. If the useLocale parameter is False
+ * the it returns the path to the "/C" directory. If the useLocale
+ * parameter is True it returns the path to the directory associated with
+ * $LANG. It makes no attempt to ensure that the directory actually exists.
+ */
+char *
+XpGetConfigDir(useLocale)
+ Bool useLocale;
+{
+ char *dirName, *langName, *langDir, *configDir;
+ Bool freeLangDir = False;
+
+ if(useLocale == False) langDir = "/C";
+ else
+ {
+ if((langName = getenv("LANG")) == (char *)NULL)
+ return (char *)NULL;
+ else
+ {
+ if(strcmp(langName, "C") == 0)
+ return (char *)NULL;
+ langDir = (char *)xalloc(strlen(langName) + 2);
+ sprintf(langDir, "/%s", langName);
+ freeLangDir = True;
+ }
+ }
+
+ /*
+ * If the XPCONFIGDIR environment variable is not set, then use the
+ * compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
+ * compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
+ */
+ if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
+ configDir = XPRINTDIR;
+
+ dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) +
+ strlen(langDir) + 1);
+ sprintf(dirName, "%s%s%s", configDir, langDir, XPDIR);
+
+ if(freeLangDir == True)
+ xfree(langDir);
+
+ return dirName;
+}
+
+/*
+ * GetMergedDatabase reads and merges xrmdb files from the top-level printer
+ * config directory, and from the directory associated with the current
+ * locale (if other than the top-level).
+ */
+static XrmDatabase
+GetMergedDatabase(attrName)
+ char *attrName;
+{
+ char *dirName, *fileName;
+ XrmDatabase db;
+
+ if((dirName = XpGetConfigDir(False)) == (char *)NULL)
+ return (XrmDatabase)NULL;
+ if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) ==
+ (char *)NULL)
+ return (XrmDatabase)NULL;
+ sprintf(fileName, "%s%s", dirName, attrName);
+ db = XrmGetFileDatabase(fileName);
+ xfree(fileName);
+ xfree(dirName);
+
+ if((dirName = XpGetConfigDir(True)) == (char *)NULL)
+ return db;
+ if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) ==
+ (char *)NULL)
+ return db;
+ sprintf(fileName, "%s%s", dirName, attrName);
+ (void)XrmCombineFileDatabase(fileName, &db, True);
+ xfree(fileName);
+ xfree(dirName);
+
+ return db;
+}
+
+/*
+ * BuildSystemAttributes reads the on-disk configuration files for printers,
+ * initial job, and initial document attributes. The resulting xrm
+ * databases are then dissected as needed for each printer.
+ * It also allocates a contextPrivate space for the attributes,
+ * reserving space to store pointers to the attribute stores for
+ * the context.
+ */
+static void
+BuildSystemAttributes()
+{
+ if(systemAttributes.printers != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.printers);
+ systemAttributes.printers = GetMergedDatabase(XPPRINTERATTRFILE);
+ if(systemAttributes.job != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.job);
+ systemAttributes.job = GetMergedDatabase(XPJOBATTRFILE);
+ if(systemAttributes.doc != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.doc);
+ systemAttributes.doc = GetMergedDatabase(XPDOCATTRFILE);
+ if(systemAttributes.server != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.server);
+ systemAttributes.server = XpSpoolerGetServerAttributes();
+ return;
+}
+
+/*
+ * AddDbEntry is called by XrmEnumerateDatabase, and adds the supplied
+ * database entry to the database pointed to within the "DbEnumStruct"
+ * passed as the client_data (aka "closure").
+ */
+static Bool
+AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
+ XrmDatabase *sourceDB;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation *type;
+ XrmValue *value;
+ XPointer client_data;
+{
+ DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
+ XrmName xrm_name[5];
+ XrmClass xrm_class[5];
+ XrmBinding xrm_bind[3];
+ XrmValue realVal;
+ XrmRepresentation rep_type;
+
+ xrm_name[0] = XrmStringToQuark (pEnumStruct->qualifier);
+ xrm_class[0] = XrmStringToQuark (pEnumStruct->modelId);
+
+ for(;*quarks; quarks++)
+ xrm_name[1] = xrm_class[1] = *quarks;
+
+ xrm_name[2] = (XrmQuark)NULL;
+ xrm_class[2] = (XrmQuark)NULL;
+
+ if(XrmQGetResource (*sourceDB, xrm_name, xrm_class, &rep_type, &realVal))
+ {
+ xrm_bind[0] = XrmBindLoosely;
+
+ xrm_name[0] = xrm_name[1];
+ xrm_name[1] = NULLQUARK;
+
+ XrmQPutStringResource(pEnumStruct->pDb, xrm_bind, xrm_name,
+ (char *)realVal.addr);
+ }
+
+ return FALSE;
+}
+
+/*
+ * BuildPrinterAttrs - builds and returns an XrmDatabase for the printer
+ * of the specified name/qualifier, if we have enough information.
+ * If we don't have a model-config
+ * file, then just enumerate the systemAttributes->printers database,
+ * otherwise read in the model-config database and merge into it the
+ * systemAttributes->printers database. This database is then enumerated
+ * with the printer qualifier (and the model name as class if we have it), and
+ * the resulting elements are stored into the database for this particular
+ * printer.
+ */
+static XrmDatabase
+BuildPrinterAttrs(printerName, qualifierName)
+ char *printerName;
+ char *qualifierName;
+{
+ XrmDatabase printerDB = (XrmDatabase)NULL;
+
+ if(systemAttributes.printers != (XrmDatabase)NULL)
+ {
+ char *dirName, *fileName;
+ XrmDatabase modelDB = (XrmDatabase)NULL;
+ XrmName xrm_name[5], xrm_class[2];
+ XrmRepresentation rep_type;
+ XrmValue value;
+ DbEnumStruct enumStruct;
+ Bool freeModelDB = False;
+ /*
+ * Build the initial db based on the model-config files
+ */
+ xrm_name[0] = XrmStringToQuark (qualifierName);
+ xrm_name[1] = XrmStringToQuark ("xp-model-identifier");
+ xrm_name[2] = (XrmQuark)NULL;
+ XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name,
+ &rep_type, &value);
+
+ if(value.addr != (XPointer)NULL)
+ {
+ fileName = (char *)xalloc(strlen(XPMODELDIR) +
+ strlen((char *)value.addr) +
+ strlen("model-config") + 3);
+ sprintf(fileName, "%s/%s/%s", XPMODELDIR, value.addr,
+ "model-config");
+ modelDB = GetMergedDatabase(fileName);
+ xfree(fileName);
+ if(modelDB != (XrmDatabase)NULL)
+ {
+ XrmDatabase tempDB = (XrmDatabase)NULL;
+ /*
+ * have to make a temp copy because MergeDatabase destroys
+ * the "source" database. Merge in the printers DB
+ */
+ tempDB = CopyDb(systemAttributes.printers);
+ XrmMergeDatabases(tempDB, &modelDB);
+ freeModelDB = True;
+ }
+ }
+
+ /*
+ * Check to see if we knew the name AND found a database file
+ */
+ if(modelDB == (XrmDatabase)NULL)
+ modelDB = systemAttributes.printers;
+
+ xrm_name[0] = XrmStringToQuark (qualifierName);
+ xrm_name[1] = (XrmQuark)NULL;
+ xrm_class[0] = XrmStringToQuark((char *)value.addr);
+ xrm_class[1] = (XrmQuark)NULL;
+ enumStruct.pDb = &printerDB;
+ enumStruct.qualifier = (char *)qualifierName;
+ enumStruct.modelId = (char *)value.addr;
+ XrmEnumerateDatabase(modelDB, xrm_name, xrm_class, XrmEnumAllLevels,
+ AddDbEntry, (XPointer) &enumStruct);
+
+ if(freeModelDB == True) XrmDestroyDatabase(modelDB);
+ }
+ XrmPutStringResource(&printerDB, "*printer-name", printerName);
+ XrmPutStringResource(&printerDB, "*qualifier", qualifierName);
+ return printerDB;
+}
+
+/*
+ * BuildABase - builds an XrmDatabase by enumerating the supplied sourceBase
+ * database for elements relevant for the printer named by printerName,
+ * and deriving a class for printerName from the model declared in the
+ * systemAttributes.printers database. If no model is defined for this
+ * printer then the printerName is used as the class as well.
+ *
+ * This is used to build the initial value document and initial value
+ * job attribute databases for each printer by searching the system
+ * level doc and job databases.
+ */
+static XrmDatabase
+BuildABase(printerName, qualifierName, sourceBase)
+ char *printerName;
+ char *qualifierName;
+ XrmDatabase sourceBase;
+{
+ XrmDatabase builtDB = (XrmDatabase)NULL;
+
+ if(sourceBase != (XrmDatabase)NULL)
+ {
+ XrmName xrm_name[5], xrm_class[2];
+ XrmRepresentation rep_type;
+ XrmValue value;
+ DbEnumStruct enumStruct;
+
+ /*
+ * Retrieve the model name for use as the class.
+ */
+ xrm_name[0] = XrmStringToQuark (printerName);
+ xrm_name[1] = XrmStringToQuark ("xp-model-identifier");
+ xrm_name[2] = (XrmQuark)NULL;
+ XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name,
+ &rep_type, &value);
+ /*
+ * if we have a model name then use it as the class, otherwise
+ * just use the printer name as the class as well as the name.
+ */
+ if(value.addr != (XPointer)NULL)
+ xrm_class[0] = XrmStringToQuark((char *)value.addr);
+ else
+ xrm_class[0] = xrm_name[0];
+ xrm_class[1] = (XrmQuark)NULL;
+
+ xrm_name[1] = (XrmQuark)NULL;
+
+ enumStruct.pDb = &builtDB;
+ enumStruct.qualifier = (char *)qualifierName;
+ enumStruct.modelId = (char *)value.addr;
+ XrmEnumerateDatabase(sourceBase, xrm_name, xrm_class, XrmEnumAllLevels,
+ AddDbEntry, (XPointer) &enumStruct);
+ }
+
+ XrmPutStringResource(&builtDB, "*qualifier", qualifierName);
+
+ return builtDB;
+}
+
+/*
+ * FreeAttrList is called upon server recycle, and frees the printer
+ * databases stored in the global attrList.
+ */
+static void
+FreeAttrList()
+{
+ PrAttrPtr pAttr, pNext;
+
+ for(pAttr = attrList, pNext = attrList;
+ pAttr != (PrAttrPtr)NULL;
+ pAttr = pNext)
+ {
+ pNext = pAttr->next;
+ if(pAttr->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->printerAttrs);
+ if(pAttr->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->docAttrs);
+ if(pAttr->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->jobAttrs);
+ xfree(pAttr->name);
+ xfree(pAttr->qualifier);
+ xfree(pAttr);
+ }
+ attrList = (PrAttrPtr)NULL;
+}
+
+/*
+ * XpRehashAttributes - frees the per-printer attribute list and
+ * calls BuildSystemAttributes to rebuild the overall attribute
+ * store. It is expected that a caller of this will follow it
+ * by calling XpBuildAttributeStore for a new list of printers.
+ */
+int
+XpRehashAttributes()
+{
+ if(attrList != (PrAttrPtr)NULL)
+ FreeAttrList();
+ BuildSystemAttributes();
+ return Success;
+}
+
+/*
+ * XpBuildAttributeStore - creates the attribute database associated
+ * with the specified printer. The first time this is called it
+ * calls BuildSystemAttributes to create the system-level databases.
+ */
+void
+XpBuildAttributeStore(printerName, qualifierName)
+ char *printerName;
+ char *qualifierName;
+{
+ PrAttrPtr pAttr;
+
+ if((pAttr = (PrAttrPtr)xalloc(sizeof(PrAttrs))) == (PrAttrPtr)NULL)
+ return;
+
+ if(attrGeneration != serverGeneration)
+ {
+ if(attrList != (PrAttrPtr)NULL)
+ FreeAttrList();
+ attrCtxtPrivIndex = XpAllocateContextPrivateIndex();
+ XpAllocateContextPrivate(attrCtxtPrivIndex, sizeof(ContextAttrs));
+ BuildSystemAttributes();
+
+ attrGeneration = serverGeneration;
+ }
+
+ if(attrList == (PrAttrPtr)NULL)
+ {
+ pAttr->next = (PrAttrPtr)NULL;
+ attrList = pAttr;
+ }
+ else
+ {
+ pAttr->next = attrList;
+ attrList = pAttr;
+ }
+
+ pAttr->name = strdup(printerName);
+ pAttr->qualifier = strdup(qualifierName);
+ pAttr->printerAttrs = BuildPrinterAttrs(printerName, qualifierName);
+ pAttr->docAttrs = BuildABase(printerName, qualifierName,
+ systemAttributes.doc);
+ pAttr->jobAttrs = BuildABase(printerName, qualifierName,
+ systemAttributes.job);
+}
+
+
+static Bool
+StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
+ XrmDatabase *sourceDB;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation *type;
+ XrmValue *value;
+ XPointer client_data;
+{
+ XrmDatabase *outDb = (XrmDatabase *)client_data;
+
+ XrmQPutStringResource(outDb, bindings, quarks, (char *)value->addr);
+
+ return FALSE;
+}
+
+/*
+ * XpCopyDb - makes a copy of the specified XrmDatabase and returns
+ * the copy.
+ */
+static XrmDatabase
+CopyDb(inDb)
+ XrmDatabase inDb;
+{
+ XrmDatabase outDb = (XrmDatabase)NULL;
+ XrmQuark empty = NULLQUARK;
+
+ (void)XrmEnumerateDatabase(inDb, &empty, &empty, XrmEnumAllLevels,
+ StoreEntry, (XPointer) &outDb);
+ return outDb;
+}
+
+/*
+ * XpInitAttributes - initializes the attribute store for the specified
+ * context. It does this by making copies of the printer, doc, and job
+ * attributes databases for the printer associated with the context.
+ */
+void
+XpInitAttributes( pContext )
+ XpContextPtr pContext;
+{
+ ContextAttrPtr pCtxtAttrs;
+ PrAttrPtr pPrAttr = attrList;
+
+ /* Initialize all the pointers to NULL */
+ pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ (void)memset((void *)pCtxtAttrs, 0, (size_t) sizeof(ContextAttrs));
+
+ for(pPrAttr = attrList; pPrAttr != (PrAttrPtr)NULL; pPrAttr = pPrAttr->next)
+ if(!strcmp(pPrAttr->name, pContext->printerName)) break;
+
+ if(pPrAttr != (PrAttrPtr)NULL)
+ {
+ pCtxtAttrs->printerAttrs = CopyDb(pPrAttr->printerAttrs);
+ pCtxtAttrs->docAttrs = CopyDb(pPrAttr->docAttrs);
+ pCtxtAttrs->jobAttrs = CopyDb(pPrAttr->jobAttrs);
+ }
+}
+
+void
+XpDestroyAttributes( pContext )
+ XpContextPtr pContext;
+{
+ ContextAttrPtr pCtxtAttrs;
+
+ pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+
+ if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->printerAttrs);
+ if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->docAttrs);
+ if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->jobAttrs);
+ if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->pageAttrs);
+}
+
+/*
+ * XpGetOneAttribute returns the string value of the specified attribute
+ * in the specified class for the specified print context. If the attribute
+ * doesn't exist in the database for this context, or if the class database
+ * doesn't exist for this context, then NULL is returned. The caller must
+ * not free the returned string, as the returned pointer points into the
+ * database. This function can also return a value from the server attributes,
+ * in which case the pContext parameter is ignored.
+ */
+char *
+XpGetOneAttribute( pContext, class, attributeName )
+ XpContextPtr pContext;
+ XPAttributes class;
+ char *attributeName;
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db = (XrmDatabase)NULL;
+ char *retVal;
+ XrmName xrm_name[3];
+ XrmRepresentation rep_type;
+ XrmValue value;
+
+ if(class == XPServerAttr)
+ {
+ if(systemAttributes.server == (XrmDatabase)NULL)
+ return NULL_STRING;
+
+ xrm_name[0] = XrmStringToQuark (attributeName);
+ xrm_name[1] = (XrmQuark)NULL;
+ XrmQGetResource(systemAttributes.server, xrm_name, xrm_name,
+ &rep_type, &value);
+
+ if(value.addr == (char *)NULL)
+ return NULL_STRING;
+ return (char *)value.addr;
+ }
+ else
+ {
+ pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ switch(class)
+ {
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ break;
+ }
+ }
+ if(db == (XrmDatabase)NULL)
+ return NULL_STRING;
+
+ xrm_name[0] = XrmStringToQuark ("qualifier");
+ xrm_name[1] = (XrmQuark)NULL;
+ XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value);
+
+ xrm_name[0] = XrmStringToQuark (value.addr);
+ xrm_name[1] = XrmStringToQuark (attributeName);
+ xrm_name[2] = (XrmQuark)NULL;
+ if(XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value))
+ return (char *)value.addr;
+ else
+ return NULL_STRING;
+}
+
+/*
+ * XpPutOneAttribute updates one attribute for the specified
+ * context and class. This function is intended for use by the attribute
+ * validation module which updates the XrmDatabases directly. This
+ * function does not recognize XPServerAttr.
+ */
+void
+XpPutOneAttribute( pContext, class, attributeName, value )
+
+XpContextPtr pContext;
+XPAttributes class;
+const char* attributeName;
+const char* value;
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db;
+ XrmBinding bindings[1];
+ XrmQuark quarks[2];
+
+ pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ switch(class)
+ {
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ return;
+ }
+ bindings[0] = XrmBindLoosely;
+ quarks[0] = XrmStringToQuark(attributeName);
+ quarks[1] = (XrmQuark)NULL;
+ XrmQPutStringResource(&db, bindings, quarks, value ? value : "");
+}
+
+
+
+/*******************************************************************************
+ *
+ * The following routines: ExpandSpace, PutString, PutByte, and AppendEntry
+ * form the functional core of the GetAttributes routine. Xrm does not
+ * supply a routine to form a string database from an XrmDatabase, except
+ * by writing the database to a file. This code avoids the file system
+ * overhead, but is a bit clunky in its memory management.
+ *
+ ******************************************************************************/
+
+/*
+ * ExpandSpace expands the memory allocated for the string database in
+ * the StringDbStruct passed in, and updates the "space" field of the
+ * struct to indicate the new amount of space available.
+ */
+static Bool
+ExpandSpace(pStr)
+ StringDbStruct *pStr;
+{
+ char *newSpace;
+
+ if((newSpace = (char *)xrealloc(pStr->stringDb, pStr->nextPos + pStr->space
+ + 1024)) == (char *)NULL)
+ return False;
+ pStr->space += 1024;
+ pStr->stringDb = newSpace;
+ return True;
+}
+
+/*
+ * PutString puts the contents of a null-terminated string into the string
+ * database in the StringDbStruct passed in. If there is insufficient room
+ * for the string, ExpandSpace is called, and the nextPos and space fields
+ * are updated.
+ */
+static void
+PutString(pStr, pString)
+ StringDbStruct *pStr;
+ char *pString;
+{
+ int len = strlen(pString);
+
+ if(len >= pStr->space)
+ if(!ExpandSpace(pStr))
+ return;
+ strcpy(&pStr->stringDb[pStr->nextPos], pString);
+ pStr->nextPos += len;
+ pStr->space -= len;
+}
+
+/*
+ * PutByte puts a single byte value in to the string database in the passed-in
+ * StringDbStruct. ExpandSpace is called if there is insufficient room for
+ * the byte, and the nextPos and space fields are updated.
+ */
+static void
+PutByte(pStr, byte)
+ StringDbStruct *pStr;
+ char byte;
+{
+ if(pStr->space <= 1)
+ if(!ExpandSpace(pStr))
+ return;
+ pStr->stringDb[pStr->nextPos] = byte;
+ pStr->nextPos++;
+ pStr->space--;
+}
+
+/*
+ * AppendEntry is called by XrmEnumerateDatabase, and serves to append
+ * a database entry onto a string database. The passed-in "closure"
+ * struct contains a pointer to the string, and a count of the remaining
+ * bytes. If there are insufficient remaining bytes then the struct
+ * is realloced, and the count of the space remaining is updated.
+ * Database elements of types other than String are ignored!
+ * This code is based directly on that in "DumpEntry" in Xrm.c.
+ */
+static Bool
+AppendEntry(db, bindings, quarks, type, value, data)
+ XrmDatabase *db;
+ XrmBindingList bindings;
+ XrmQuarkList quarks;
+ XrmRepresentation *type;
+ XrmValuePtr value;
+ XPointer data;
+{
+ StringDbStruct *pEnumStr = (StringDbStruct *)data;
+ Bool firstNameSeen;
+ unsigned int i;
+ char *s, c;
+
+ if (*type != XrmQString)
+ return;
+
+ for (firstNameSeen = False; *quarks; bindings++, quarks++) {
+ if (*bindings == XrmBindLoosely) {
+ PutString(pEnumStr, "*");
+ } else if (firstNameSeen) {
+ PutString(pEnumStr, ".");
+ }
+ firstNameSeen = True;
+ PutString(pEnumStr, XrmQuarkToString(*quarks));
+ }
+ s = value->addr;
+ i = value->size;
+ PutString(pEnumStr, ":\t");
+ if(i) i--;
+
+ if (i && (*s == ' ' || *s == '\t'))
+ PutByte(pEnumStr, '\\'); /* preserve leading whitespace */
+
+ while (i--) {
+ c = *s++;
+ if (c == '\n') {
+ if (i)
+ PutString(pEnumStr, "\\n\\\n");
+ else
+ PutString(pEnumStr, "\\n");
+ } else if (c == '\\')
+ PutString(pEnumStr, "\\\\");
+ else if ((c < ' ' && c != '\t') ||
+ ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0))
+ {
+ char temp[4];
+ (void) sprintf(temp, "\\%03o", (unsigned char)c);
+ PutString(pEnumStr, temp);
+ }
+ else
+ PutByte(pEnumStr, c);
+ }
+ PutByte(pEnumStr, '\n');
+ pEnumStr->stringDb[pEnumStr->nextPos] = (char)'\0';
+ return False;
+}
+
+/*
+ * XpGetAttributes returns a string database version of the Xrm database
+ * for the specified context and class. This function can also return the
+ * contents of the server attributes, in which case the pContext parameter
+ * is ignored.
+ *
+ * The caller is responsible for freeing the returned string,
+ * unlike XpGetOneAttribute, where the caller must not free the string.
+ */
+char *
+XpGetAttributes( pContext, class )
+ XpContextPtr pContext;
+ XPAttributes class;
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db = (XrmDatabase)NULL;
+ char *retVal;
+ StringDbStruct enumStruct;
+ XrmQuark empty = NULLQUARK;
+
+ if(class == XPServerAttr)
+ db = systemAttributes.server;
+ else
+ {
+ pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ switch(class)
+ {
+ case XPServerAttr:
+ db = systemAttributes.server;
+ break;
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ break;
+ }
+ }
+ if(db == (XrmDatabase)NULL)
+ {
+ char *retval = (char *)xalloc(1);
+ retval[0] = (char)'\0';
+ return retval;
+ }
+
+ if((enumStruct.stringDb = (char *)xalloc(1024)) == (char *)NULL)
+ return (char *)NULL;
+ enumStruct.stringDb[0] = (char)'\0';
+ enumStruct.nextPos = 0;
+ enumStruct.space = 1024;
+ (void)XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels,
+ AppendEntry, (XPointer) &enumStruct);
+
+ return enumStruct.stringDb;
+}
+
+int
+XpAugmentAttributes( pContext, class, attributes )
+ XpContextPtr pContext;
+ XPAttributes class;
+ char *attributes;
+{
+ XrmDatabase db;
+ ContextAttrPtr pCtxtAttrs;
+
+ db = XrmGetStringDatabase(attributes);
+ if(db == (XrmDatabase)NULL) return BadAlloc;
+
+ pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ switch(class)
+ {
+ case XPPrinterAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->printerAttrs);
+ break;
+ case XPDocAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->docAttrs);
+ break;
+ case XPJobAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->jobAttrs);
+ break;
+ case XPPageAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->pageAttrs);
+ break;
+ default:
+ break;
+ }
+ return Success;
+}
+
+/*
+ * XpSetAttributes - sets the attribute stores for a specified context.
+ */
+int
+XpSetAttributes( pContext, class, attributes )
+ XpContextPtr pContext;
+ XPAttributes class;
+ char *attributes;
+{
+ XrmDatabase db;
+ ContextAttrPtr pCtxtAttrs;
+
+ db = XrmGetStringDatabase(attributes);
+ if(db == (XrmDatabase)NULL) return BadAlloc;
+
+ pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ switch(class)
+ {
+ case XPPrinterAttr:
+ if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->printerAttrs);
+ pCtxtAttrs->printerAttrs = db;
+ break;
+ case XPDocAttr:
+ if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->docAttrs);
+ pCtxtAttrs->docAttrs = db;
+ break;
+ case XPJobAttr:
+ if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->jobAttrs);
+ pCtxtAttrs->jobAttrs = db;
+ break;
+ case XPPageAttr:
+ if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->pageAttrs);
+ pCtxtAttrs->pageAttrs = db;
+ break;
+ default:
+ break;
+ }
+ return Success;
+}
+
+void
+XpAddPrinterAttribute(printerName, printerQualifier, attributeName,
+ attributeValue)
+ char *printerName;
+ char *printerQualifier;
+ char *attributeName;
+ char *attributeValue;
+{
+ PrAttrPtr pAttr;
+
+ for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next)
+ {
+ if(!strcmp(printerQualifier, pAttr->qualifier))
+ {
+ XrmPutStringResource(&pAttr->printerAttrs, attributeName,
+ attributeValue);
+ break;
+ }
+ }
+}
+
+const char *
+XpGetPrinterAttribute(const char *printerName,
+ const char *attribute)
+{
+ PrAttrPtr pAttr;
+ XrmValue value;
+ char *type;
+
+ for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next)
+ {
+ if(!strcmp(printerName, pAttr->qualifier))
+ {
+ char *attrStr;
+
+ attrStr = (char *)xalloc(strlen(printerName) + strlen(attribute) +
+ 2);
+ sprintf(attrStr, "%s.%s", printerName, attribute);
+ XrmGetResource(pAttr->printerAttrs, attrStr, attrStr,
+ &type, &value);
+ xfree(attrStr);
+ break;
+ }
+ }
+ if(value.addr != (XPointer)NULL && strlen(value.addr) != 0)
+ return value.addr;
+ else
+ return "";
+}
+
+/*******************************************************************************
+ *
+ * The following routines are not attribute routines, but are rather
+ * spooler interface functions. They should presumably move to
+ * a SpoolerIf.c of some similarly named file.
+ *
+ ******************************************************************************/
+#include <locale.h>
+
+static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
+*job-attributes-supported: job-name job-owner\
+ notification-profile xp-spooler-command-options\n\
+*multiple-documents-supported: False";
+
+XrmDatabase
+XpSpoolerGetServerAttributes()
+{
+ char *totalAttrs, *localeName;
+ XrmDatabase db;
+
+ localeName = setlocale(LC_CTYPE, (char *)NULL);
+ if(!localeName || strlen(localeName) == 0)
+ localeName = "C";
+
+ if((totalAttrs = (char *)xalloc(strlen(serverAttrStr) + strlen(localeName)
+ + 11)) == (char *)NULL)
+ return (XrmDatabase)NULL;
+ sprintf(totalAttrs, "%s\n%s\t%s", serverAttrStr, "*locale:", localeName);
+
+ db = XrmGetStringDatabase(totalAttrs);
+ xfree(totalAttrs);
+ return db;
+}
+
+/*
+ * ExecuteCommand takes two pointers - the command to execute,
+ * and the "argv" style NULL-terminated vector of arguments for the command.
+ * We wait for the command to terminate before continuing to ensure that
+ * we don't delete the job file before the spooler has made a copy.
+ */
+static void
+ExecCommand(pCommand, argVector)
+ char *pCommand;
+ char **argVector;
+{
+ pid_t childPid;
+ int status;
+
+ if((childPid = fork()) == 0)
+ {
+ /* return BadAlloc? */
+ if (execv(pCommand, argVector) == -1) {
+ FatalError("unable to exec '%s'", pCommand);
+ }
+ }
+ else
+ {
+ (void) waitpid(childPid, &status, 0);
+ }
+ return;
+}
+
+/*
+ * SendFileToCommand takes three character pointers - the file name,
+ * the command to execute,
+ * and the "argv" style NULL-terminated vector of arguments for the command.
+ * The command is exec'd, and the file contents are sent to the command
+ * via stdin.
+ *
+ * WARNING: This function will try to adopt the userId of the supplied
+ * user name prior to exec'ing the supplied command.
+ */
+static void
+SendFileToCommand(
+ char *fileName,
+ char *pCommand,
+ char **argVector,
+ char *userName)
+{
+ pid_t childPid;
+ int pipefd[2];
+ int status;
+ struct stat statBuf;
+ FILE *fp, *outPipe;
+
+ if(pipe(pipefd))
+ return;
+
+ if(stat(fileName, &statBuf) < 0 || (int)statBuf.st_size == 0)
+ {
+ close(pipefd[0]);
+ close(pipefd[1]);
+ return;
+ }
+
+ fp = fopen(fileName, "r");
+ if(fp == (FILE *)NULL)
+ {
+ close(pipefd[0]);
+ close(pipefd[1]);
+ return;
+ }
+
+ if((childPid = fork()) == 0)
+ {
+ close(pipefd[1]);
+ close(0);
+ dup(pipefd[0]);
+ close(pipefd[0]);
+
+ /*
+ * If a user name is specified, try to set our uid to match that
+ * user name. This is to allow e.g. a banner page to show the
+ * name of the printing user rather than the user who started
+ * the print server.
+ */
+ if(userName)
+ {
+ uid_t myUid;
+
+ if((myUid = geteuid()) == (uid_t)0)
+ {
+ struct passwd *pPasswd;
+
+ if((pPasswd = getpwnam(userName)))
+ {
+ setuid((uid_t)pPasswd->pw_uid);
+ }
+ }
+ }
+ /* return BadAlloc? */
+ if (execv(pCommand, argVector) == -1) {
+ FatalError("unable to exec '%s'", pCommand);
+ }
+ }
+ else
+ {
+ int res;
+
+ (void) close(pipefd[0]);
+
+ outPipe = fdopen(pipefd[1], "w");
+ (void) TransferBytes(fp, outPipe, (int)statBuf.st_size);
+
+ (void) fclose(outPipe);
+ (void) fclose(fp);
+
+ (void) waitpid(childPid, &status, 0);
+ }
+ return;
+}
+
+/*
+ * ReplaceAllKeywords causes all the predefined keywords (e.g. %options%)
+ * to be replaced with the appropriate values derived from the attribute
+ * store for the supplied print context. The ReplaceAnyString utility
+ * routine is used to perform the actual replacements.
+ */
+extern char *ReplaceAnyString(char *, char *, char *);
+
+static char *
+ReplaceAllKeywords(
+ XpContextPtr pContext,
+ char *command)
+{
+ char *cmdOpt;
+
+ cmdOpt = XpGetOneAttribute(pContext, XPPrinterAttr,
+ "xp-spooler-printer-name");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%printer-name%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%printer-name%",
+ pContext->printerName);
+
+ cmdOpt = XpGetOneAttribute(pContext, XPDocAttr, "copy-count");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%copy-count%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%copy-count%", "1");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-name");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%job-name%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%job-name%", "");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-owner");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%job-owner%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%job-owner%", "");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr,
+ "xp-spooler-command-options");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%options%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%options%", "");
+
+ return command;
+}
+
+#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL)) || defined(__EMX__) || defined(ISC) || defined(Lynx)
+#define iswspace(c) (isascii(c) && isspace(toascii(c)))
+#endif
+
+/*
+ * GetToken - takes in a string and returns a malloc'd copy of the
+ * first non-white-space sequence of characters in the string.
+ * It returns the number of _bytes_ (NOT characters) parsed through
+ * the inStr to get to the end of the returned token.
+ */
+static int
+GetToken(
+ char *inStr,
+ char **outStr)
+{
+ size_t mbCurMax = MB_CUR_MAX;
+ wchar_t curChar;
+ int i, numBytes, byteLen = strlen(inStr);
+ char *tok;
+
+ /*
+ * read through any leading white space.
+ */
+ for(i = 0, numBytes = 0; i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &inStr[i], mbCurMax);
+ if(!iswspace(curChar))
+ break;
+ }
+ tok = inStr + i;
+
+ /*
+ * find the end of the token.
+ */
+ byteLen = strlen(tok);
+ for(i = 0, numBytes = 0; i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &tok[i], mbCurMax);
+ if(iswspace(curChar))
+ break;
+ }
+
+ if((*outStr = (char *)xalloc(i + 1)) == (char *)NULL)
+ return 0;
+ strncpy(*outStr, tok, i);
+ (*outStr)[i] = (char)'\0';
+ return (tok + i) - inStr;
+}
+
+static void
+FreeVector(
+ char **vector)
+{
+ int i;
+
+ if(vector == (char **)NULL) return;
+
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ xfree(vector[i]);
+ xfree(vector);
+}
+
+
+/*
+ * AddVector appends the pAddition arg vector to the pTarget arg vector.
+ * If the pTarget cannot be realloc'd, then pTarget is set to NULL.
+ */
+static void
+AddVector(
+ char ***pTarget,
+ char **pAddition)
+{
+ int numTarget, numAdd, i;
+
+ for(numTarget = 0; (*pTarget)[numTarget] != (char *)NULL; numTarget++)
+ ;
+ for(numAdd = 0; pAddition[numAdd] != (char *)NULL; numAdd++)
+ ;
+
+ *pTarget = (char **)xrealloc((void *)*pTarget, (numTarget + numAdd + 1) *
+ sizeof(char *));
+ if(*pTarget == (char **)NULL)
+ return;
+ for(i = 0; i < numAdd; i++)
+ (*pTarget)[numTarget + i] = pAddition[i];
+
+ (*pTarget)[numTarget + numAdd] = (char *)NULL;
+}
+
+static char **
+BuildArgVector(
+ char *argString,
+ XpContextPtr pContext)
+{
+ char **pVector;
+ char *curTok;
+ int numChars, i;
+ static int beenHere = 0; /* prevent recursion on embedded %options%
+ */
+
+ pVector = (char **)xalloc(sizeof(char *));
+ pVector[0] = (char *)NULL;
+ for(i = 0; (numChars = GetToken(argString, &curTok)) != 0;
+ i++, argString += numChars)
+ {
+ if(beenHere || strcmp(curTok, "%options%"))
+ {
+ if(curTok[0] == (char)'\0')
+ {
+ xfree(curTok);
+ }
+ else
+ {
+ pVector = (char **)xrealloc((void *)pVector,
+ (i + 2)*sizeof(char *));
+ if(pVector == (char **)NULL)
+ return (char **)NULL;
+ pVector[i] = curTok;
+ pVector[i + 1] = (char *)NULL;
+ }
+ }
+ else if(!beenHere)
+ {
+ char **optionsVec;
+
+ curTok = ReplaceAllKeywords(pContext, curTok);
+ beenHere = 1;
+ optionsVec = BuildArgVector(curTok, pContext);
+ xfree(curTok);
+ beenHere = 0;
+ AddVector(&pVector, optionsVec);
+ xfree(optionsVec);
+ }
+ }
+ if(numChars == 0 && curTok != (char *)NULL)
+ xfree(curTok);
+ return pVector;
+}
+
+/*
+ * VectorizeCommand takes a string and breaks it into a command name and
+ * an array of character pointers suitable for handing to execv. The
+ * array is NULL-terminated.
+ * The returned char * is the command name, and should be freed when no
+ * longer needed. The array elements returned in the pVector parameter
+ * should be individually freed, and the array itself should also be
+ * freed when no longer needed.
+ */
+static char *
+VectorizeCommand(
+ char *command,
+ char ***pVector,
+ XpContextPtr pContext)
+{
+ char *cmdName, *curTok;
+ int i, numChars;
+
+ if(command == (char *)NULL)
+ return (char *)NULL;
+
+ numChars = GetToken(command, &cmdName);
+
+ if(cmdName == (char *)NULL)
+ return (char *)NULL;
+
+ *pVector = BuildArgVector(command, pContext);
+
+ return cmdName;
+}
+
+#ifdef hpux
+static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%";
+#else
+static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%";
+#endif
+
+int
+XpSubmitJob(fileName, pContext)
+ char *fileName;
+ XpContextPtr pContext;
+{
+ char **vector, *cmdNam, *cmdOpt, *command, *userName;
+ int i;
+
+ command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
+ if(command == (char *)NULL || strlen(command) == 0)
+ command = strdup(DEFAULT_SPOOL_COMMAND);
+ else
+ command = strdup(command);
+ if(command == (char *)NULL)
+ return BadAlloc;
+
+ cmdNam = VectorizeCommand(command, &vector, pContext);
+ xfree(command);
+
+ if(cmdNam == (char *)NULL)
+ return BadAlloc;
+
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ {
+ vector[i] = ReplaceAllKeywords(pContext, vector[i]);
+ if(vector[i] == (char *)NULL)
+ {
+ xfree(cmdNam);
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ xfree(vector[i]);
+ xfree(vector);
+ return BadAlloc;
+ }
+ }
+
+ userName = XpGetOneAttribute(pContext, XPJobAttr, "job-owner");
+ if(userName != (char *)NULL && strlen(userName) == 0)
+ userName = (char *)NULL;
+
+ SendFileToCommand(fileName, cmdNam, vector, userName);
+
+ FreeVector(vector);
+ xfree(cmdNam);
+}
+
+/*
+ * SearchInputTrays()
+ *
+ * Given a tray, return the medium in the tray. Conversely, given a
+ * medium, return a tray in which it can be found. In either case,
+ * return NULL if the given tray or medium cannot be found.
+ */
+#define TRAY 0
+#define MEDIUM 1
+
+static char *
+SearchInputTrays(XpContextPtr pCon,
+ int which,
+ char *val)
+{
+ char *inputTraysMedium, tray[80], medium[80], *copy;
+ char *pS, *pE, *pLast;
+
+ inputTraysMedium = XpGetOneAttribute( pCon, XPPrinterAttr,
+ "input-trays-medium" );
+
+ copy = strdup( inputTraysMedium );
+ pS = copy;
+ pLast = copy + strlen( copy );
+
+ while( pS < pLast )
+ {
+ while( *pS && *pS != '{' )
+ pS++;
+
+ pE = ++pS;
+ while( *pE && *pE != '}' )
+ pE++;
+ *pE = '\0';
+
+ sscanf( pS, "%s %s", tray, medium );
+
+ if( which == MEDIUM && !strcmp( val, medium ) )
+ {
+ xfree( copy );
+ return strdup( tray );
+ }
+
+ if( which == TRAY && !strcmp( val, tray ) )
+ {
+ xfree( copy );
+ return strdup( medium );
+ }
+
+ pS = pE + 1;
+ }
+
+ xfree( copy );
+ return strdup( NULL_STRING );
+}
+
+/*
+ * XpGetTrayMediumFromContext()
+ *
+ * Given a print context, hit the input-trays-medium,
+ * default-input-tray and default-medium attributes to find the
+ * appropriate tray to use, and the medium in that tray.
+ */
+void
+XpGetTrayMediumFromContext(XpContextPtr pCon,
+ char **medium,
+ char **tray)
+{
+ char *defMedium, *defTray;
+ char *t, *m;
+ char *pS, *pE, *pLast;
+
+ defMedium = XpGetOneAttribute( pCon, XPPageAttr,
+ "default-medium" );
+ if( *defMedium == '\0' )
+ defMedium = XpGetOneAttribute( pCon, XPDocAttr,
+ "default-medium" );
+
+ defTray = XpGetOneAttribute( pCon, XPPageAttr,
+ "default-input-tray" );
+ if( *defTray == '\0' )
+ defTray = XpGetOneAttribute( pCon, XPDocAttr,
+ "default-input-tray" );
+
+ /*
+ * First, check to see if the default tray has the default medium
+ * installed. This is the ideal case.
+ */
+ m = SearchInputTrays( pCon, TRAY, defTray );
+ if( !strcmp( m, defMedium ) )
+ {
+ xfree( m );
+ *tray = strdup( defTray );
+ *medium = strdup( defMedium );
+ return;
+ }
+
+ /*
+ * If the default tray doesn't have the default medium, search for
+ * a tray which has the default medium.
+ */
+ t = SearchInputTrays( pCon, MEDIUM, defMedium );
+ if( t )
+ {
+ *tray = t;
+ *medium = strdup( defMedium );
+ return;
+ }
+
+ /*
+ * If all else fails, just return the default tray, and whatever
+ * medium happens to be there. Note that we simply return
+ * whatever is in the attribute store. Any further correction is
+ * left up to the DDX driver.
+ */
+ *tray = strdup( defTray );
+ *medium = m;
+ xfree( t );
+}
diff --git a/xc/programs/Xserver/Xprint/attributes.h b/xc/programs/Xserver/Xprint/attributes.h
new file mode 100644
index 000000000..f4104a0f8
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/attributes.h
@@ -0,0 +1,77 @@
+/* $XConsortium: attributes.h /main/1 1996/09/28 16:59:43 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "Oid.h"
+
+/*
+ * attributes.c
+ */
+void XpInitAttributes(XpContextPtr pContext);
+char *XpGetOneAttribute(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributeName);
+void XpPutOneAttribute(XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value);
+char *XpGetAttributes(XpContextPtr pContext,
+ XPAttributes class);
+int XpAugmentAttributes(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes);
+int XpSetAttributes(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes);
+const char *XpGetPrinterAttribute(const char *printerName,
+ const char *attribute);
+void XpGetTrayMediumFromContext(XpContextPtr pCon,
+ char **medium,
+ char **tray);
+
+/*
+ * mediaSizes.c
+ */
+int XpGetResolution(XpContextPtr pContext);
+XpOid XpGetContentOrientation(XpContextPtr pContext);
+XpOid XpGetPlex(XpContextPtr pContext);
+XpOid XpGetPageSize(XpContextPtr pContext,
+ XpOid* pTray,
+ const XpOidMediumSS* msss);
+void XpGetMediumMillimeters(XpOid page_size,
+ float *width,
+ float *height);
+void XpGetMediumDimensions(XpContextPtr pContext,
+ unsigned short *width,
+ unsigned short *height);
+void XpGetReproductionArea(XpContextPtr pContext,
+ xRectangle *pRect);
diff --git a/xc/programs/Xserver/Xprint/ddxInit.c b/xc/programs/Xserver/Xprint/ddxInit.c
new file mode 100644
index 000000000..374ba524d
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ddxInit.c
@@ -0,0 +1,380 @@
+/* $XConsortium: ddxInit.c /main/2 1996/11/16 15:23:55 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.9 1999/05/14 14:11:08 dawes Exp $ */
+
+#include "X.h"
+#include "Xproto.h"
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "Xos.h"
+
+#ifdef XFree86Server
+/*
+ * when building the loader, we add some code that tries to
+ * switch bit ordering based on xf86bpp; since Xprt doesn't
+ * use that, we have to add this dummy here
+ */
+int xf86bpp = 8;
+#endif
+static void Exit();
+void _XpVoidNoop();
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitOutput --
+ * If this is built as a print-only server, then we must supply
+ * an InitOutput routine. If a normal server's real ddx InitOutput
+ * is used, then it should call PrinterInitOutput if it so desires.
+ * The ddx-level hook is needed to allow the printer stuff to
+ * create additional screens. An extension can't reliably do
+ * this for two reasons:
+ *
+ * 1) If InitOutput doesn't create any screens, then main()
+ * exits before calling InitExtensions().
+ *
+ * 2) Other extensions may rely on knowing about all screens
+ * when they initialize, and we can't guarantee the order
+ * of extension initialization.
+ *
+ * Results:
+ * ScreenInfo filled in, and PrinterInitOutput is called to create
+ * the screens associated with printers.
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+
+void
+InitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ int i;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = 0; /* get them in PrinterInitOutput */
+ screenInfo.numVideoScreens = 0;
+#ifdef PRINT_ONLY_SERVER
+ PrinterInitOutput(pScreenInfo, argc, argv);
+#endif
+}
+
+static void
+BellProc(volume, pDev)
+ int volume;
+ DeviceIntPtr pDev;
+{
+ return;
+}
+
+static void
+KeyControlProc(pDev, ctrl)
+ DeviceIntPtr pDev;
+ KeybdCtrl *ctrl;
+{
+ return;
+}
+
+static KeySym printKeyMap[256];
+static CARD8 printModMap[256];
+
+static int
+KeyboardProc(pKbd, what, argc, argv)
+ DevicePtr pKbd;
+ int what;
+ int argc;
+ char *argv[];
+{
+ KeySymsRec keySyms;
+
+ keySyms.minKeyCode = 8;
+ keySyms.maxKeyCode = 8;
+ keySyms.mapWidth = 1;
+ keySyms.map = printKeyMap;
+
+ switch(what)
+ {
+ case DEVICE_INIT:
+ InitKeyboardDeviceStruct(pKbd, &keySyms, printModMap,
+ (BellProcPtr)BellProc,
+ KeyControlProc);
+ break;
+ case DEVICE_ON:
+ break;
+ case DEVICE_OFF:
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+#include "../mi/mipointer.h"
+static int
+PointerProc(pPtr, what, argc, argv)
+ DevicePtr pPtr;
+ int what;
+ int argc;
+ char *argv[];
+{
+#define NUM_BUTTONS 1
+ CARD8 map[NUM_BUTTONS];
+
+ switch(what)
+ {
+ case DEVICE_INIT:
+ {
+ map[0] = 0;
+ InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS,
+ miPointerGetMotionEvents,
+ (PtrCtrlProcPtr)_XpVoidNoop,
+ miPointerGetMotionBufferSize());
+ break;
+ }
+ case DEVICE_ON:
+ break;
+ case DEVICE_OFF:
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+void
+InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ DeviceIntPtr ptr, kbd;
+
+ ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
+ kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
+ RegisterPointerDevice(ptr);
+ RegisterKeyboardDevice(kbd);
+ return;
+}
+
+
+Bool
+LegalModifier(key, dev)
+ unsigned int key;
+ DevicePtr dev;
+{
+ return TRUE;
+}
+
+void
+ProcessInputEvents()
+{
+}
+
+#ifdef DDXOSINIT
+void
+OsVendorInit()
+{
+}
+#endif
+
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError()
+{
+}
+#endif
+
+#ifdef DDXTIME
+CARD32
+GetTimeInMillis()
+{
+ struct timeval tp;
+
+ X_GETTIMEOFDAY(&tp);
+ return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}
+#endif
+
+/****************************************
+* ddxUseMsg()
+*
+* Called my usemsg from os/utils/c
+*
+*****************************************/
+
+void ddxUseMsg()
+{
+ /* Right now, let's just do nothing */
+}
+
+static void Exit (code)
+ int code;
+{
+ exit (code);
+}
+
+void AbortDDX ()
+{
+}
+
+void ddxGiveUp() /* Called by GiveUp() */
+{
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+
+{
+#ifdef PRINT_ONLY_SERVER
+ return XprintOptions(argc, argv, i) - i;
+#else
+ return(0);
+#endif
+}
+
+#ifdef XINPUT
+
+#include "XI.h"
+#include "XIproto.h"
+
+extern int BadDevice;
+
+ChangePointerDevice (old_dev, new_dev, x, y)
+ DeviceIntPtr old_dev;
+ DeviceIntPtr new_dev;
+ unsigned char x,y;
+{
+ return (BadDevice);
+}
+
+int
+ChangeDeviceControl (client, dev, control)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ xDeviceCtl *control;
+{
+ return BadMatch;
+}
+
+OpenInputDevice (dev, client, status)
+ DeviceIntPtr dev;
+ ClientPtr client;
+ int *status;
+{
+ return;
+}
+
+AddOtherInputDevices ()
+{
+ return;
+}
+
+CloseInputDevice (dev, client)
+ DeviceIntPtr dev;
+ ClientPtr client;
+{
+ return;
+}
+
+ChangeKeyboardDevice (old_dev, new_dev)
+ DeviceIntPtr old_dev;
+ DeviceIntPtr new_dev;
+{
+ return (Success);
+}
+
+SetDeviceMode (client, dev, mode)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int mode;
+{
+ return BadMatch;
+}
+
+SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+{
+ return BadMatch;
+}
+
+
+#endif /* XINPUT */
+
+#ifdef XTESTEXT1
+
+void
+XTestJumpPointer(x, y, dev)
+ int x, y, dev;
+{
+ return;
+}
+
+void
+XTestGetPointerPos(x, y)
+{
+ return;
+}
+
+void
+XTestGenerateEvent(dev, keycode, keystate, x, y)
+ int dev, keycode, keystate, x, y;
+{
+ return;
+}
+
+#endif /* XTESTEXT1 */
+
+#ifdef AIXV3
+/*
+ * This is just to get the server to link on AIX, where some bits
+ * that should be in os/ are instead in hw/ibm.
+ */
+int SelectWaitTime = 10000; /* usec */
+#endif
diff --git a/xc/programs/Xserver/Xprint/mediaSizes.c b/xc/programs/Xserver/Xprint/mediaSizes.c
new file mode 100644
index 000000000..845e6bbf8
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/mediaSizes.c
@@ -0,0 +1,739 @@
+/* $XConsortium: mediaSizes.c /main/1 1996/09/28 16:59:55 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: mediaSizes.c
+** *
+** * Contents:
+** * Routines to return the sizes associated
+** * with particular media and particular printers.
+** *
+** * Created: 2/19/96
+** *
+** * Copyright: Copyright 1993,1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <locale.h>
+
+#include "X.h"
+#include "dixstruct.h"
+#include "screenint.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "fontstruct.h"
+
+#define _XP_PRINT_SERVER_
+#include "Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#include "DiPrint.h"
+#include "AttrValid.h"
+
+extern XpContextPtr XpContextOfClient();
+
+typedef struct {
+ XpOid page_size;
+ float width;
+ float height;
+} PageDimensionsRec;
+
+static PageDimensionsRec PageDimensions[] =
+{
+ {xpoid_val_medium_size_na_letter, 215.9, 279.4},
+ {xpoid_val_medium_size_na_legal, 215.9, 355.6},
+ {xpoid_val_medium_size_executive, 184.15, 266.7},
+ {xpoid_val_medium_size_folio, 210.82, 330.2},
+ {xpoid_val_medium_size_invoice, 139.7, 215.9},
+ {xpoid_val_medium_size_ledger, 279.4, 431.8},
+ {xpoid_val_medium_size_quarto, 215.9, 275.082},
+ {xpoid_val_medium_size_a, 215.9, 279.4},
+ {xpoid_val_medium_size_b, 279.4, 431.8},
+ {xpoid_val_medium_size_c, 431.8, 558.8},
+ {xpoid_val_medium_size_d, 558.8, 863.6},
+ {xpoid_val_medium_size_e, 863.6, 1117.6},
+ {xpoid_val_medium_size_na_6x9_envelope, 152.4, 228.6},
+ {xpoid_val_medium_size_na_10x15_envelope, 254, 381},
+ {xpoid_val_medium_size_monarch_envelope, 98.298, 190.5},
+ {xpoid_val_medium_size_na_10x13_envelope, 254, 330.2},
+ {xpoid_val_medium_size_na_9x12_envelope, 228.6, 304.8},
+ {xpoid_val_medium_size_na_number_10_envelope, 104.775, 241.3},
+ {xpoid_val_medium_size_na_7x9_envelope, 177.8, 228.6},
+ {xpoid_val_medium_size_na_9x11_envelope, 228.6, 279.4},
+ {xpoid_val_medium_size_na_10x14_envelope, 254, 355.6},
+ {xpoid_val_medium_size_na_number_9_envelope, 98.425, 225.425},
+ {xpoid_val_medium_size_iso_a0, 841, 1189},
+ {xpoid_val_medium_size_iso_a1, 594, 841},
+ {xpoid_val_medium_size_iso_a2, 420, 594},
+ {xpoid_val_medium_size_iso_a3, 297, 420},
+ {xpoid_val_medium_size_iso_a4, 210, 297},
+ {xpoid_val_medium_size_iso_a5, 148, 210},
+ {xpoid_val_medium_size_iso_a6, 105, 148},
+ {xpoid_val_medium_size_iso_a7, 74, 105},
+ {xpoid_val_medium_size_iso_a8, 52, 74},
+ {xpoid_val_medium_size_iso_a9, 37, 52},
+ {xpoid_val_medium_size_iso_a10, 26, 37},
+ {xpoid_val_medium_size_iso_b0, 1000, 1414},
+ {xpoid_val_medium_size_iso_b1, 707, 1000},
+ {xpoid_val_medium_size_iso_b2, 500, 707},
+ {xpoid_val_medium_size_iso_b3, 353, 500},
+ {xpoid_val_medium_size_iso_b4, 250, 353},
+ {xpoid_val_medium_size_iso_b5, 176, 250},
+ {xpoid_val_medium_size_iso_b6, 125, 176},
+ {xpoid_val_medium_size_iso_b7, 88, 125},
+ {xpoid_val_medium_size_iso_b8, 62, 88},
+ {xpoid_val_medium_size_iso_b9, 44, 62},
+ {xpoid_val_medium_size_iso_b10, 31, 44},
+ {xpoid_val_medium_size_jis_b0, 1030, 1456},
+ {xpoid_val_medium_size_jis_b1, 728, 1030},
+ {xpoid_val_medium_size_jis_b2, 515, 728},
+ {xpoid_val_medium_size_jis_b3, 364, 515},
+ {xpoid_val_medium_size_jis_b4, 257, 364},
+ {xpoid_val_medium_size_jis_b5, 182, 257},
+ {xpoid_val_medium_size_jis_b6, 128, 182},
+ {xpoid_val_medium_size_jis_b7, 91, 128},
+ {xpoid_val_medium_size_jis_b8, 64, 91},
+ {xpoid_val_medium_size_jis_b9, 45, 64},
+ {xpoid_val_medium_size_jis_b10, 32, 45},
+ {xpoid_val_medium_size_iso_c3, 324, 458},
+ {xpoid_val_medium_size_iso_c4, 229, 324},
+ {xpoid_val_medium_size_iso_c5, 162, 229},
+ {xpoid_val_medium_size_iso_c6, 114, 162},
+ {xpoid_val_medium_size_iso_designated_long, 110, 220}
+};
+
+/*
+ * XpGetResolution returns an integer representing the printer resolution
+ * in dots-per-inch for the specified print context.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+int
+XpGetResolution(
+ XpContextPtr pContext)
+{
+ unsigned long resolution;
+
+ resolution = XpGetCardAttr(pContext, XPPageAttr,
+ xpoid_att_default_printer_resolution,
+ (XpOidCardList*)NULL);
+ if(0 == resolution)
+ resolution = XpGetCardAttr(pContext, XPDocAttr,
+ xpoid_att_default_printer_resolution,
+ (XpOidCardList*)NULL);
+ if(0 == resolution)
+ {
+ XpOidCardList* resolutions_supported;
+ /*
+ * default-printer-resolution not specified; default to 1st entry
+ * in printer-resolutions-supported.
+ */
+ resolutions_supported =
+ XpGetCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ (XpOidCardList*)NULL);
+ resolution = XpOidCardListGetCard(resolutions_supported, 0);
+ XpOidCardListDelete(resolutions_supported);
+ }
+ return (int)resolution;
+}
+
+/*
+ * XpGetContentOrientation determines the content-orientation as
+ * determined by the passed context. The page and document pools are
+ * queried in turn for a specified content-orientation attribute. If none
+ * is found the first content-orientation in the
+ * content-orientations-supported printer attribute is taken as the
+ * default.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetContentOrientation(
+ XpContextPtr pContext)
+{
+ XpOid orientation;
+
+ orientation = XpGetOidAttr(pContext, XPPageAttr,
+ xpoid_att_content_orientation,
+ (XpOidList*)NULL);
+ if(xpoid_none == orientation)
+ orientation = XpGetOidAttr(pContext, XPDocAttr,
+ xpoid_att_content_orientation,
+ (XpOidList*)NULL);
+ if(xpoid_none == orientation)
+ {
+ XpOidList* content_orientations_supported;
+
+ content_orientations_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ (XpOidList*)NULL);
+ orientation = XpOidListGetOid(content_orientations_supported, 0);
+ XpOidListDelete(content_orientations_supported);
+ }
+ return orientation;
+}
+
+/*
+ * XpGetPlex determines the plex as determined by the passed context. The page
+ * and document pools are queried in turn for a specified plex attribute. If
+ * none is found the first plex in the plexes-supported printer attribute is
+ * taken as the default.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetPlex(
+ XpContextPtr pContext)
+{
+ XpOid plex;
+
+ plex = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_plex,
+ (XpOidList*)NULL);
+ if(xpoid_none == plex)
+ plex = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_plex,
+ (XpOidList*)NULL);
+ if(xpoid_none == plex)
+ {
+ XpOidList* plexes_supported;
+
+ plexes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_plexes_supported,
+ (XpOidList*)NULL);
+ plex = XpOidListGetOid(plexes_supported, 0);
+ XpOidListDelete(plexes_supported);
+ }
+ return plex;
+}
+
+/*
+ * XpGetPageSize returns the XpOid of the current page size (medium names
+ * are page sizes in this implementation) as indicated by the passed
+ * context.
+ *
+ * The relevant input-tray is returned in pTray. This parm must not be
+ * NULL. If the input-tray is not indicated or irrelevant, xpoid_none
+ * will be returned.
+ *
+ * This function optionally takes a XpOidMediumSS representation of the
+ * medium-source-sizes-supported attribute in order to avoid parsing the
+ * string value twice for calling functions that need to parse m-s-s-s
+ * anyway (e.g. XpGetReproductionArea). If the caller has no other reason
+ * to parse medium-source-sizes-supported, it is recommended that NULL be
+ * passed. This function will obtain medium-source-sizes-supported if it
+ * needs to.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetPageSize(XpContextPtr pContext,
+ XpOid* pTray,
+ const XpOidMediumSS* msss)
+{
+ XpOid medium;
+ /*
+ * check to see if default-medium is specified
+ */
+ medium = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_default_medium,
+ (const XpOidList*)NULL);
+ if(medium == xpoid_none)
+ {
+ /*
+ * default-medium not in page pool; try the document pool
+ */
+ medium = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_default_medium,
+ (const XpOidList*)NULL);
+ }
+ if(medium == xpoid_none)
+ {
+ /*
+ * default-medium not specified; try default-input-tray
+ */
+ *pTray = XpGetOidAttr(pContext, XPPageAttr,
+ xpoid_att_default_input_tray,
+ (const XpOidList*)NULL);
+ if(*pTray == xpoid_none)
+ {
+ /*
+ * default-input-tray not in page pool; try the document pool
+ */
+ *pTray = XpGetOidAttr(pContext, XPDocAttr,
+ xpoid_att_default_input_tray,
+ (const XpOidList*)NULL);
+ }
+ if(*pTray != xpoid_none)
+ {
+ /*
+ * default-input-tray found; get corresponding medium from
+ * input-trays-medium
+ */
+ XpOidTrayMediumList* input_trays_medium;
+ int i;
+
+ input_trays_medium =
+ XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ (const XpOidList*)NULL,
+ (const XpOidMediumSS*)NULL);
+ for(i = 0; i < XpOidTrayMediumListCount(input_trays_medium); i++)
+ {
+ if(*pTray == XpOidTrayMediumListTray(input_trays_medium, i))
+ {
+ medium = XpOidTrayMediumListMedium(input_trays_medium, i);
+ break;
+ }
+ }
+ XpOidTrayMediumListDelete(input_trays_medium);
+ }
+ }
+ else
+ *pTray = xpoid_none;
+
+ if(medium == xpoid_none)
+ {
+ XpOidMediumSS* local_msss = (XpOidMediumSS*)NULL;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ /*
+ * no medium specified; use 1st page size found in
+ * medium-source-sizes-supported
+ */
+ if((XpOidMediumSS*)NULL == msss)
+ msss = local_msss =
+ XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ for(i_mss = 0;
+ i_mss < XpOidMediumSSCount(msss) && xpoid_none == medium;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(xpoid_none != (ds_list->list)[i_ds].page_size)
+ {
+ medium = (ds_list->list)[i_ds].page_size;
+ break;
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(local_msss);
+ }
+ return medium;
+}
+
+/*
+ * XpGetMediumMillimeters returns into the supplied float pointers the
+ * width and height in millimeters of the passed page size identifier.
+ */
+void
+XpGetMediumMillimeters(
+ XpOid page_size,
+ float *width, /* return */
+ float *height) /* return */
+{
+ int i;
+
+ *width = *height = 0;
+ for(i = 0; i < XpNumber(PageDimensions); i++)
+ {
+ if(page_size == PageDimensions[i].page_size)
+ {
+ *width = PageDimensions[i].width;
+ *height = PageDimensions[i].height;
+ return;
+ }
+ }
+}
+
+/*
+ * Converts a millimeter specification into pixels given a resolution in
+ * DPI.
+ */
+static float
+MmToPixels(float mm, int resolution)
+{
+ float f;
+
+ f = mm * resolution;
+ f /= 25.4;
+ return f;
+}
+
+/*
+ * XpGetMediumDimensions returns into the supplied short pointers the
+ * width and height in pixels of the medium associated with the specified
+ * print context. It obtains the page size associated with the current
+ * medium by calling XpGetPageSize. It passes XpGetMediumMillimeters the
+ * page size, and converts the returned millimeter dimensions into pixels
+ * using the resolution returned by XpGetResolution.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+void
+XpGetMediumDimensions(
+ XpContextPtr pContext,
+ unsigned short *width, /* return */
+ unsigned short *height) /* return */
+{
+ XpOid page_size;
+ XpOid tray;
+ XpOid orientation;
+
+ int resolution;
+ float w_mm, h_mm;
+
+ page_size = XpGetPageSize(pContext, &tray, (XpOidMediumSS*)NULL);
+ if(page_size == xpoid_none)
+ {
+ /*
+ * fail-safe: if the pools have been validated, this defaulting logic
+ * isn't needed.
+ */
+ page_size = xpoid_val_medium_size_na_letter;
+ }
+ XpGetMediumMillimeters(page_size, &w_mm, &h_mm);
+ resolution = XpGetResolution(pContext);
+ orientation = XpGetContentOrientation(pContext);
+ switch(orientation)
+ {
+ case xpoid_val_content_orientation_landscape:
+ case xpoid_val_content_orientation_reverse_landscape:
+ /*
+ * transpose width and height
+ */
+ *height = MmToPixels(w_mm, resolution);
+ *width = MmToPixels(h_mm, resolution);
+ break;
+
+ default:
+ *width = MmToPixels(w_mm, resolution);
+ *height = MmToPixels(h_mm, resolution);
+ break;
+ }
+}
+
+/*
+ * XRectangleFromXpOidArea converts an XpOidArea area specification
+ * into an XRectangle. The passed resolution is used to convert from
+ * millimeters (XpOidArea) into pixels (XRectangle).
+ */
+static void
+XRectangleFromXpOidArea(
+ xRectangle *pRect,
+ const XpOidArea* repro,
+ int resolution,
+ XpOid orientation)
+{
+ switch(orientation)
+ {
+ case xpoid_val_content_orientation_landscape:
+ case xpoid_val_content_orientation_reverse_landscape:
+ /*
+ * transpose x and y, width and height
+ */
+ pRect->y = MmToPixels(repro->minimum_x, resolution);
+ pRect->x = MmToPixels(repro->minimum_y, resolution);
+ pRect->height =
+ MmToPixels(repro->maximum_x - repro->minimum_x, resolution);
+ pRect->width =
+ MmToPixels(repro->maximum_y - repro->minimum_y, resolution);
+ break;
+
+ default:
+ pRect->x = MmToPixels(repro->minimum_x, resolution);
+ pRect->y = MmToPixels(repro->minimum_y, resolution);
+ pRect->width =
+ MmToPixels(repro->maximum_x - repro->minimum_x, resolution);
+ pRect->height =
+ MmToPixels(repro->maximum_y - repro->minimum_y, resolution);
+ break;
+ }
+}
+
+/*
+ * XpGetReproductionArea queries the current pool attribute values in
+ * order to determine the reproduction area for the currently selected
+ * medium.
+ *
+ * First the current page size (equivalent to current medium) and tray
+ * (if specified) is retrieved via XpGetPageSize. The value of the
+ * medium-source-sizes-supported attribute is interrogated until a matching
+ * entry for the current page size and tray is found. The reproduction
+ * area defined for the current entry is converted into an XRectangle
+ * using XRectangleFromXpOidArea and returned to the caller.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+void
+XpGetReproductionArea(XpContextPtr pContext,
+ xRectangle *pRect)
+{
+ XpOid page_size;
+ XpOid tray;
+ XpOidMediumSS* msss;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ XpOidArea* repro;
+ BOOL done;
+ int resolution;
+ XpOid orientation;
+ /*
+ * find the appropriate assured reproduction area for the current
+ * tray and page size in the medium-source-sizes-supported attribute.
+ */
+ msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ page_size = XpGetPageSize(pContext, &tray, msss);
+ resolution = XpGetResolution(pContext);
+ orientation = XpGetContentOrientation(pContext);
+
+ memset(pRect, 0, sizeof(xRectangle));
+
+ if(xpoid_none == tray)
+ {
+ /*
+ * no tray specified; use 1st matching page size
+ */
+ for(i_mss = 0, done = xFalse;
+ i_mss < XpOidMediumSSCount(msss) && !done;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ {
+ repro =
+ &(ds_list->list)[i_ds].assured_reproduction_area;
+ XRectangleFromXpOidArea(pRect, repro,
+ resolution, orientation);
+ done = xTrue;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ /*
+ * tray && page size specified; find matching entry
+ */
+ for(i_mss = 0, done = xFalse;
+ i_mss < XpOidMediumSSCount(msss) && !done;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray
+ &&
+ (tray == (msss->mss)[i_mss].input_tray
+ ||
+ xpoid_unspecified == (msss->mss)[i_mss].input_tray)
+ )
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ {
+ repro =
+ &(ds_list->list)[i_ds].assured_reproduction_area;
+ XRectangleFromXpOidArea(pRect, repro,
+ resolution, orientation);
+ if(xpoid_unspecified != (msss->mss)[i_mss].input_tray)
+ {
+ /*
+ * exact match on tray takes precendence over
+ * unspecified tray entry in m-s-s-s
+ */
+ done = xTrue;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(msss);
+}
+
+/*
+ * XpGetMaxWidthHeightRes returns into the supplied width and height
+ * unsigned short pointers the dimensions in millimeters of the largest
+ * supported media for a specific printer. It looks at the
+ * medium-source-sizes-supported attribute (if it exists) to determine
+ * the list of possible media, and calls XpGetMediumMillimeters to get the
+ * dimensions for each medium. If the m-s-s-s attribute is not defined,
+ * then the dimensions for the na-letter medium is returned.
+ *
+ * This function also returns the largest resolution in DPI defined in
+ * printer-resolutions-supported. If printer-resolutions-supported is not
+ * specified, the default is obtained from the passed XpValidatePoolsRec.
+ *
+ * The passed XpValidatePoolsRec is also used to determine valid values
+ * when parsing attribute values.
+ */
+void
+XpGetMaxWidthHeightRes(
+ const char *printer_name,
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution)
+{
+ const char* value;
+ const char* attr_str;
+ XpOidMediumSS* pool_msss;
+ const XpOidMediumSS* msss;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ float w, h;
+ XpOidCardList* pool_resolutions_supported;
+ const XpOidCardList* resolutions_supported;
+ int i;
+ int res;
+ /*
+ * get the max medium width and height
+ */
+ attr_str = XpOidString(xpoid_att_medium_source_sizes_supported);
+ value = XpGetPrinterAttribute(printer_name, attr_str);
+ pool_msss = XpOidMediumSSNew(value,
+ vpr->valid_input_trays,
+ vpr->valid_medium_sizes);
+ if(0 == XpOidMediumSSCount(pool_msss))
+ msss = XpGetDefaultMediumSS();
+ else
+ msss = pool_msss;
+ *width = *height = 0;
+ for(i_mss = 0; i_mss < XpOidMediumSSCount(msss); i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(xpoid_none != (ds_list->list)[i_ds].page_size)
+ {
+ XpGetMediumMillimeters((ds_list->list)[i_ds].page_size,
+ &w, &h);
+ if(w > *width) *width = w;
+ if(h > *height) *height = h;
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(pool_msss);
+ /*
+ * get the maximum resolution
+ */
+ attr_str = XpOidString(xpoid_att_printer_resolutions_supported);
+ value = XpGetPrinterAttribute(printer_name, attr_str);
+ pool_resolutions_supported =
+ XpOidCardListNew(value, vpr->valid_printer_resolutions_supported);
+ if(0 == XpOidCardListCount(pool_resolutions_supported))
+ resolutions_supported = vpr->default_printer_resolutions_supported;
+ else
+ resolutions_supported = pool_resolutions_supported;
+ *resolution = 0;
+ for(i = 0; i < XpOidCardListCount(resolutions_supported); i++)
+ {
+ res = XpOidCardListGetCard(resolutions_supported, i);
+ if(res > *resolution) *resolution = res;
+ }
+ XpOidCardListDelete(pool_resolutions_supported);
+}
+
+FontResolutionPtr
+XpGetClientResolutions(client, num)
+ ClientPtr client;
+ int *num;
+{
+ static struct _FontResolution res;
+ int resolution = XpGetResolution(XpContextOfClient(client));
+
+ res.x_resolution = resolution;
+ res.y_resolution = resolution;
+
+ res.point_size = 120;
+
+ *num = 1;
+
+ return &res;
+}
+
+
+void XpSetFontResFunc(client)
+ ClientPtr client;
+{
+ client->fontResFunc = XpGetClientResolutions;
+}
+
+
+void XpUnsetFontResFunc(client)
+ ClientPtr client;
+{
+ client->fontResFunc = NULL;
+}
diff --git a/xc/programs/Xserver/Xprint/pcl-mono/Imakefile b/xc/programs/Xserver/Xprint/pcl-mono/Imakefile
new file mode 100644
index 000000000..35c3b0f4c
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl-mono/Imakefile
@@ -0,0 +1,6 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/09/28 17:00:04 rws $
+#define PclDriver -DXP_PCL_MONO
+#define LinkDirectory ../pcl
+
+#include "../pcl/Imakefile"
+
diff --git a/xc/programs/Xserver/Xprint/pcl/Imakefile b/xc/programs/Xserver/Xprint/pcl/Imakefile
new file mode 100644
index 000000000..d6586cab6
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/Imakefile
@@ -0,0 +1,77 @@
+XCOMM $XFree86: xc/programs/Xserver/Xprint/pcl/Imakefile,v 1.5 1999/07/18 15:47:37 dawes Exp $
+
+
+
+XCOMM $XConsortium: Imakefile /main/1 1996/09/28 17:00:10 rws $
+
+#include <Server.tmpl>
+
+#ifndef PixelSize
+#define PixelSize 8
+#endif
+
+#ifdef PclDriver
+PCL_DRIVER = PclDriver
+#else
+PCL_DRIVER = -DXP_PCL_COLOR
+#endif
+
+SRCS1 = PclInit.c PclMisc.c PclWindow.c PclFonts.c PclPrint.c \
+ PclArea.c PclArc.c PclGC.c PclLine.c PclPixel.c PclPolygon.c \
+ PclSpans.c PclText.c PclCursor.c PclAttr.c PclPixmap.c PclSFonts.c \
+ PclColor.c PclAttVal.c
+
+OBJS1 = PclInit.o PclMisc.o PclWindow.o PclFonts.o PclPrint.o \
+ PclArea.o PclArc.o PclGC.o PclLine.o PclPixel.o PclPolygon.o \
+ PclSpans.o PclText.o PclCursor.o PclAttr.o PclPixmap.o PclSFonts.o \
+ PclColor.o PclAttVal.o
+
+SRCS = $(SRCS1)
+
+OBJS = $(OBJS1)
+
+DEFINES = -DPSZ=PixelSize $(PCL_DRIVER) -UXFree86LOADER
+
+ INCLUDES = -I. \
+ -I../../cfb \
+ -I$(TOP) \
+ -I../../include -I.. -I$(TOP)/include \
+ -I$(TOP)/include/extensions -I$(TOP)/include/fonts \
+ -I../../mi -I../../mfb -I../../cfb
+
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \
+ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln \
+ ../../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+NormalLibraryTarget(pcl,$(OBJS))
+NormalLintTarget($(SRCS1) $(SRCS2))
+#ifdef LinkDirectory
+LinkSourceFile(Pcl.h,LinkDirectory)
+LinkSourceFile(Pclmap.h,LinkDirectory)
+LinkSourceFile(PclDef.h,LinkDirectory)
+LinkSourceFile(PclSFonts.h,LinkDirectory)
+
+LinkSourceFile(PclArc.c,LinkDirectory)
+LinkSourceFile(PclArea.c,LinkDirectory)
+LinkSourceFile(PclAttr.c,LinkDirectory)
+LinkSourceFile(PclAttVal.c,LinkDirectory)
+LinkSourceFile(PclColor.c,LinkDirectory)
+LinkSourceFile(PclCursor.c,LinkDirectory)
+LinkSourceFile(PclFonts.c,LinkDirectory)
+LinkSourceFile(PclGC.c,LinkDirectory)
+LinkSourceFile(PclInit.c,LinkDirectory)
+LinkSourceFile(PclLine.c,LinkDirectory)
+LinkSourceFile(PclMisc.c,LinkDirectory)
+LinkSourceFile(PclPixel.c,LinkDirectory)
+LinkSourceFile(PclPixmap.c,LinkDirectory)
+LinkSourceFile(PclPolygon.c,LinkDirectory)
+LinkSourceFile(PclPrint.c,LinkDirectory)
+LinkSourceFile(PclSFonts.c,LinkDirectory)
+LinkSourceFile(PclSpans.c,LinkDirectory)
+LinkSourceFile(PclText.c,LinkDirectory)
+LinkSourceFile(PclWindow.c,LinkDirectory)
+#endif
+
+DependTarget()
diff --git a/xc/programs/Xserver/Xprint/pcl/Pcl.h b/xc/programs/Xserver/Xprint/pcl/Pcl.h
new file mode 100644
index 000000000..10615a2d0
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/Pcl.h
@@ -0,0 +1,581 @@
+/* $XConsortium: Pcl.h /main/3 1996/12/30 14:56:18 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: Pcl.h
+** *
+** * Contents: defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.4 1998/12/20 11:57:26 dawes Exp $ */
+
+#ifndef _PCL_H_
+#define _PCL_H_
+
+#include <stdio.h>
+#include "scrnintstr.h"
+
+/*
+#include "X.h"
+#include "Xproto.h"
+#include "Xatom.h"
+#include "misc.h"
+#include "screenint.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "servermd.h" */ /* needed for IMAGE_BUFSIZE */
+
+#include "PclDef.h"
+#include "Pclmap.h"
+#include "PclSFonts.h"
+
+#define _XP_PRINT_SERVER_
+#include "Print.h"
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#include "miscstruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+typedef char *XPointer;
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <Xfuncproto.h>
+#include "../Xresource.h"
+
+/******
+ * externally visible variables from PclInit.c
+ ******/
+extern int PclScreenPrivateIndex, PclWindowPrivateIndex;
+extern int PclContextPrivateIndex;
+extern int PclPixmapPrivateIndex;
+extern int PclGCPrivateIndex;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a list of
+ * print contexts which use the colormap.
+ */
+typedef struct _pclcontextlist {
+ XpContextPtr context;
+ struct _pclcontextlist *next;
+} PclContextList, *PclContextListPtr;
+
+typedef struct _pclcmaptocontexts {
+ long colormapId;
+ PclContextListPtr contexts;
+ struct _pclcmaptocontexts *next;
+} PclCmapToContexts;
+
+typedef struct {
+ PclCmapToContexts *colormaps;
+ CloseScreenProcPtr CloseScreen;
+} PclScreenPrivRec, *PclScreenPrivPtr;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a PCL
+ * palette ID.
+ */
+typedef struct _palettemap {
+ long colormapId;
+ int paletteId;
+ int downloaded;
+ struct _palettemap *next;
+} PclPaletteMap, *PclPaletteMapPtr;
+
+typedef struct {
+ char *jobFileName;
+ FILE *pJobFile;
+ char *pageFileName;
+ FILE *pPageFile;
+ GC lastGC;
+ unsigned char *dash;
+ int validGC;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+ PclSoftFontInfoPtr pSoftFontInfo;
+ PclPaletteMapPtr palettes;
+ int currentPalette;
+ int nextPaletteId;
+ PclPaletteMap staticGrayPalette;
+ PclPaletteMap trueColorPalette;
+ PclPaletteMap specialTrueColorPalette;
+ unsigned char *ctbl;
+ int ctbldim;
+ int isRaw;
+#ifdef XP_PCL_LJ3
+ unsigned int fcount;
+ unsigned int fcount_max;
+ char *figures;
+#endif /* XP_PCL_LJ3 */
+} PclContextPrivRec, *PclContextPrivPtr;
+
+typedef struct {
+ int validContext;
+ XpContextPtr context;
+} PclWindowPrivRec, *PclWindowPrivPtr;
+
+typedef struct {
+ unsigned long stippleFg, stippleBg;
+} PclGCPrivRec, *PclGCPrivPtr;
+
+typedef struct {
+ XpContextPtr context;
+ char *tempFileName;
+ FILE *tempFile;
+ GC lastGC;
+ int validGC;
+} PclPixmapPrivRec, *PclPixmapPrivPtr;
+
+/******
+ * Defined functions
+ ******/
+#define SEND_PCL(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
+#define SEND_PCL_COUNT(f,c,n) fwrite( c, sizeof( char ), n, f )
+
+#ifndef XP_PCL_LJ3
+#define SAVE_PCL(f,p,c) SEND_PCL(f,c)
+#define SAVE_PCL_COUNT(f,p,c,n) SEND_PCL_COUNT(f,c,n)
+#define MACRO_START(f,p) SEND_PCL(f, "\033&f1Y\033&f0X")
+#define MACRO_END(f) SEND_PCL(f, "\033&f1X")
+#else
+#define SAVE_PCL(f,p,c) PclSpoolFigs(p, c, strlen(c))
+#define SAVE_PCL_COUNT(f,p,c,n) PclSpoolFigs(p, c, n)
+#define MACRO_START(f,p) p->fcount = 0
+#define MACRO_END(f) /* do nothing */
+#endif /* XP_PCL_LJ3 */
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/******
+ * Functions in PclArc.c
+ ******/
+extern void PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+extern void PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+
+/******
+ * Functions in PclArea.c
+ ******/
+extern void PclPutImage(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage);
+extern RegionPtr PclCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty);
+RegionPtr PclCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane);
+
+
+/******
+ * Functions in PclAttr.c
+ ******/
+extern char *PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool );
+extern char *PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr );
+extern int PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+extern int PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+
+/******
+ * Functions in PclColor.c
+ ******/
+extern Bool PclCreateDefColormap(ScreenPtr pScreen);
+extern Bool PclCreateColormap(ColormapPtr pColor);
+extern void PclDestroyColormap(ColormapPtr pColor);
+extern void PclInstallColormap(ColormapPtr pColor);
+extern void PclUninstallColormap(ColormapPtr pColor);
+extern int PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList);
+extern void PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs);
+extern void PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual);
+extern int PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile);
+
+/******
+ * Functions in PclCursor.c
+ ******/
+extern void PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox);
+extern void PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftbox);
+extern Bool PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern void PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed);
+extern Bool PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent);
+
+/******
+ * Functions in PclGC.c
+ ******/
+extern Bool PclCreateGC(GCPtr pGC);
+extern void PclDestroyGC(GCPtr pGC);
+extern int PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile);
+extern void PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable);
+extern void PclSetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC gc );
+extern int PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file );
+
+/******
+ * Functions in PclInit.c
+ ******/
+extern Bool InitializePclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+static Bool PclDestroyContext( XpContextPtr pCon );
+extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
+
+/******
+ * Functions in PclLine.c
+ ******/
+extern void PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments);
+
+/******
+ * Functions in PclMisc.c
+ ******/
+extern void PclQueryBestSize(
+ int class,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen);
+extern char *GetPropString(WindowPtr pWin, char *propName);
+extern int SystemCmd(char *cmdStr);
+extern int PclGetMediumDimensions(
+ XpContextPtr pCon,
+ CARD16 *pWidth,
+ CARD16 *pHeight);
+extern int PclGetReproducibleArea(
+ XpContextPtr pCon,
+ xRectangle *pRect);
+
+/******
+ * Functions in PclPixel.c
+ ******/
+extern void PclPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int width,
+ int height,
+ int x,
+ int y);
+
+/******
+ * Functions in PclPixmap.c
+ ******/
+extern PixmapPtr PclCreatePixmap(
+ ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth);
+extern Bool PclDestroyPixmap(PixmapPtr pPixmap);
+
+/******
+ * Functions in PclPolygon.c
+ ******/
+extern void PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+extern void PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints);
+extern void PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+
+/******
+ * Functions in PclSpans.c
+ ******/
+extern void PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+extern void PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted);
+
+/******
+ * Functions in PclText.c
+ ******/
+extern int PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern int PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern void PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+extern void PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+
+/******
+ * Functions in PclWindow.c
+ ******/
+extern Bool PclCreateWindow(register WindowPtr pWin);
+extern Bool PclDestroyWindow(WindowPtr pWin);
+extern Bool PclMapWindow(WindowPtr pWindow);
+extern Bool PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y);
+extern Bool PclUnmapWindow(WindowPtr pWindow);
+extern Bool PclUnmapWindow(WindowPtr pWindow);
+extern void PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+extern Bool PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask);
+extern void PclPaintWindow(
+ WindowPtr pWin,
+ RegionPtr pRegion,
+ int what);
+
+/******
+ * Functions in PclFonts.c
+ ******/
+extern Bool PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+extern Bool PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+
+/******
+ * Functions in PclPrint.c
+ ******/
+extern int PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client);
+extern int PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type);
+extern int PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client);
+extern int PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize);
+
+
+#endif /* _PCL_H_ */
+
+
+
+
+
+
+
+
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclArc.c b/xc/programs/Xserver/Xprint/pcl/PclArc.c
new file mode 100644
index 000000000..558c5bc81
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclArc.c
@@ -0,0 +1,264 @@
+/* $XConsortium: PclArc.c /main/1 1996/09/28 17:00:23 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArc.c
+** *
+** * Contents:
+** * Arc-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArc.c,v 1.2 1998/03/20 21:04:50 hohndel Exp $ */
+
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+static void
+PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nArcs;
+ xArc *pArcs;
+ void (*DoIt)();
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec r;
+ RegionPtr drawRegion, region, transClip;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ xRectangle repro;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ fudge = 3 * pGC->lineWidth;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ XpGetReproductionArea( pCon, &repro );
+
+ /*
+ * Generate the PCL code to draw the collection of arcs, by
+ * defining it as a macro which uses the HP-GL/2 arc drawing
+ * function.
+ */
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0; i < nArcs; i++ )
+ {
+ xArc Arc = pArcs[i];
+ double b, X, Y, ratio;
+ double angle1;
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ /* Calculate the start of the arc */
+ if( ( Arc.angle1 / 64 ) % 360 == 90 )
+ {
+ X = 0;
+ Y = -Arc.height / 2.0;
+ }
+ else if( ( Arc.angle1 / 64 ) % 360 == 270 )
+ {
+ X = 0;
+ Y = Arc.height / 2.0;
+ }
+ else
+ {
+ /* Convert the angle to radians */
+ angle1 = ( Arc.angle1 / 64.0 ) * 3.141592654 / 180.0;
+
+ b = (Arc.height / 2.0);
+ X = b * cos( angle1 );
+ Y = -b * sin( angle1 );
+ }
+
+ /* Change the coordinate system to scale the ellipse */
+ ratio = (double)Arc.height / (double)Arc.width;
+
+ sprintf( t, "SC%.2f,%.2f,%d,%d;",
+ (repro.x - Arc.width / 2 - xoffset - Arc.x) * ratio,
+ (repro.x - Arc.width / 2 - xoffset - Arc.x +
+ repro.width) * ratio,
+ repro.y - Arc.height / 2 - yoffset - Arc.y + repro.height,
+ repro.y - Arc.height / 2 - yoffset - Arc.y);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ DoIt( outFile, pConPriv, X, Y, Arc );
+
+ /* Build the bounding box */
+ r.x1 = -Arc.width / 2 - fudge;
+ r.y1 = -Arc.height / 2 - fudge;
+ r.x2 = Arc.width / 2 + fudge;
+ r.y2 = Arc.height / 2 + fudge;
+ drawRegion = miRegionCreate( &r, 0 );
+
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END( outFile );
+
+ /*
+ * Intersect the bounding box with the clip region.
+ */
+ region = miRegionCreate( NULL, 0 );
+ transClip = miRegionCreate( NULL, 0 );
+ miRegionCopy( transClip, pGC->pCompositeClip );
+ miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2),
+ -(yoffset + Arc.y + Arc.height / 2) );
+ miIntersect( region, drawRegion, transClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the collection of arcs to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, ratio);
+
+ /*
+ * Restore the coordinate system
+ */
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x,
+ repro.x + repro.width, repro.y + repro.height,
+ repro.y );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ miRegionDestroy( transClip );
+ }
+}
+
+/*
+ * Draw a simple non-filled arc, centered on the origin and starting
+ * at the given point.
+ */
+static void
+DrawArc(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PD;AA0,0,%.2f;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+void
+PclPolyArc( pDrawable, pGC, nArcs, pArcs )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nArcs;
+ xArc *pArcs;
+{
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
+}
+
+/*
+ * Draw a filled wedge, from the origin, to the given point, through
+ * the appropriate angle, and back to the origin.
+ */
+static void
+DoWedge(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU0,0;WG%.2f,%.2f,%.2f;", sqrt( X * X + Y * Y ),
+ (float)A.angle1 / -64.0,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+static void
+DoChord(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PM0;AA0,0,%.2f;PA%d,%d;PM2;FP;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 , (int)X, (int)Y );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+
+void
+PclPolyFillArc( pDrawable, pGC, nArcs, pArcs )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nArcs;
+ xArc *pArcs;
+{
+ switch( pGC->arcMode )
+ {
+ case ArcChord:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoChord );
+ break;
+ case ArcPieSlice:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoWedge );
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclArea.c b/xc/programs/Xserver/Xprint/pcl/PclArea.c
new file mode 100644
index 000000000..d90c8319f
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclArea.c
@@ -0,0 +1,485 @@
+/* $XConsortium: PclArea.c /main/3 1996/12/30 16:36:46 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArea.c
+** *
+** * Contents:
+** * Image and Area functions for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArea.c,v 1.5 1998/03/20 21:04:50 hohndel Exp $ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "region.h"
+
+#include "cfb.h"
+
+void
+PclPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage)
+{
+ PixmapPtr pPixmap;
+ unsigned long oldFg, oldBg;
+ XID gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
+
+ if( ( w == 0 ) || ( h == 0 ) )
+ return;
+
+ if( format != XYPixmap )
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+ if( !pPixmap )
+ return;
+
+ if( format == ZPixmap )
+ (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y );
+ else
+ (void)(*pGC->ops->CopyPlane)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y, 1 );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+ else
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+
+ if( !pPixmap )
+ return;
+
+ depth = pGC->depth;
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0] = ~0L;
+ gcv[1] = 0;
+ DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
+ bytesPer = (long)h * BitmapBytePad( w + leftPad );
+
+ for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
+ {
+ if( i & oldPlanemask )
+ {
+ extern void cfbPutImage(), cfb32PutImage();
+ gcv[0] = i;
+ DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
+ ValidateGC( pDrawable, pGC );
+ if (pPixmap->drawable.depth <= 8 )
+ cfbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h,
+ leftPad, XYBitmap, pImage );
+ else if (pPixmap->drawable.depth <= 32 )
+ cfb32PutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h,
+ leftPad, XYBitmap, pImage );
+ }
+ }
+ gcv[0] = oldPlanemask;
+ gcv[1] = oldFg;
+ gcv[2] = oldBg;
+ DoChangeGC( pGC, GCPlaneMask | GCForeground | GCBackground,
+ gcv, 0 );
+
+ PclCopyArea( (DrawablePtr)pPixmap, pDrawable, pGC, leftPad,
+ 0, w, h, x, y );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+}
+
+/*
+ * PclMonoPixmapFragment()
+ *
+ * Given a 1-bit-deep pixmap, send the appropriate part of it to the
+ * output file as a PCL raster graphics command.
+ */
+static void
+PclMonoPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use mfbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = BitmapBytePad( x2 - x1 );
+
+ bits = (char *)xalloc( h * w );
+ mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ XYPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i <= h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+static void
+PclColorPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+ extern void cfbGetImage(), cfb32GetImage();
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use cfbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = PixmapBytePad( x2 - x1, pix->drawable.depth );
+
+ bits = (char *)xalloc( h * w );
+ if (pix->drawable.depth <= 8)
+ cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ ZPixmap, ~0, bits );
+ else if (pix->drawable.depth <= 32)
+ cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ ZPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i < h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+RegionPtr
+PclCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty)
+{
+ PixmapPtr pixSrc = (PixmapPtr)pSrc;
+ char t[80];
+ FILE *srcFile, *dstFile;
+ GC srcGC, dstGC;
+ unsigned long valid;
+ struct stat statBuf;
+ XpContextPtr pCon;
+ xRectangle repro;
+ PclPixmapPrivPtr pPriv;
+ RegionPtr drawRegion, region, whole, ret;
+ BoxRec box;
+ BoxPtr prect;
+ int nrect;
+ void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
+ short, short );
+ extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea();
+
+ /*
+ * Since we don't store any information on a per-window basis, we
+ * can't copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /*
+ * If we're copying from a pixmap to a pixmap, we just use the
+ * mfb/cfb code to do the work.
+ */
+ if( pDst->type == DRAWABLE_PIXMAP )
+ {
+ if( pSrc->depth == 1 )
+ return mfbCopyArea( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty );
+ else if( pSrc->depth <= 8 )
+ return cfbCopyArea( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty );
+ else if( pSrc->depth <= 32 )
+ return cfb32CopyArea( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty );
+ }
+
+/*
+ PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
+*/
+ PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
+
+ /*
+ * If we're copying to a window, we have to do some actual
+ * drawing, instead of just handing it off to mfb or cfb. Start
+ * by determining the region that will be drawn.
+ */
+ box.x1 = srcx;
+ box.y1 = srcy;
+ box.x2 = srcx + width;
+ box.y2 = srcy + height;
+ drawRegion = miRegionCreate( &box, 0 );
+ miTranslateRegion( drawRegion, dstx, dsty );
+
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * Now select the operation to be performed on each box in the
+ * region.
+ */
+ if( pSrc->depth == 1 )
+ doFragment = PclMonoPixmapFragment;
+ else
+ doFragment = PclColorPixmapFragment;
+
+ /*
+ * Actually draw each section of the bitmap.
+ */
+ nrect = REGION_NUM_RECTS( region );
+ prect = REGION_RECTS( region );
+
+ while( nrect )
+ {
+ (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
+ prect->y1 - dsty, prect->x2 - dstx,
+ prect->y2 - dsty, prect->x1, prect->y1 );
+
+ nrect--;
+ prect++;
+ }
+
+ /*
+ * Update the destination's GC to the source's GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDst, srcGC );
+*/
+
+ /*
+ * Determine the region that needs to be returned. This is the
+ * region of the source that falls outside the boundary of the
+ * pixmap.
+ */
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pixSrc->drawable.width;
+ box.y2 = pixSrc->drawable.height;
+ whole = miRegionCreate( &box, 0 );
+ ret = miRegionCreate( NULL, 0 );
+
+ miTranslateRegion( drawRegion, -dstx, -dsty );
+ miSubtract( ret, drawRegion, whole );
+
+ /*
+ * Clean up the regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ miRegionDestroy( whole );
+
+ if( miRegionNotEmpty( ret ) )
+ return ret;
+ else
+ {
+ miRegionDestroy( ret );
+ return NULL;
+ }
+}
+
+RegionPtr
+PclCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane)
+{
+ RegionPtr reg;
+ GCPtr scratchGC;
+ PixmapPtr scratchPix;
+ extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane();
+
+ /*
+ * Since we don't store PCL on a per-window basis, there's no good
+ * way to copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /*
+ * Copying from a pixmap to a pixmap is already implemented by
+ * mfb/cfb.
+ */
+ if( pSrc->type == DRAWABLE_PIXMAP &&
+ pDst->type == DRAWABLE_PIXMAP )
+ {
+ if( pDst->depth == 1 )
+ return mfbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty, plane );
+ else if( pDst->depth <= 8 )
+ return cfbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty, plane );
+ else if( pDst->depth <= 32 )
+ return cfb32CopyPlane( pSrc, pDst, pGC, srcx, srcy, width,
+ height, dstx, dsty, plane );
+ }
+
+ /*
+ * We can use the mfb/cfbCopyPlane function to do the work of grabbing
+ * the plane and converting it to the desired visual. Once that's
+ * done, we already know how to do a CopyArea.
+ */
+ scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
+ height, pDst->depth );
+
+ scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ if( pDst->depth == 1 )
+ {
+ mfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix );
+ mfbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
+ srcx, srcy, width, height, 0, 0, plane );
+ }
+ else if( pDst->depth <= 8 )
+ {
+ cfbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix );
+ cfbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
+ srcx, srcy, width, height, 0, 0, plane );
+ }
+ else if( pDst->depth <= 32 )
+ {
+ cfb32ValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix );
+ cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
+ srcx, srcy, width, height, 0, 0, plane );
+ }
+
+ reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
+ height, dstx, dsty );
+
+ FreeScratchGC( scratchGC );
+
+ (*pDst->pScreen->DestroyPixmap)( scratchPix );
+
+ return reg;
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclAttVal.c b/xc/programs/Xserver/Xprint/pcl/PclAttVal.c
new file mode 100644
index 000000000..037d3ea35
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclAttVal.c
@@ -0,0 +1,203 @@
+/*
+ * $XConsortium: PclAttVal.c /main/1 1996/09/28 17:00:37 rws $
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "Pcl.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+
+
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL },
+};
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL }
+};
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+ { "Postscript", "2", NULL },
+ { "ASCII", NULL, NULL }
+
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOid ValidInputTraysOids[] = {
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_bottom
+};
+static XpOidList ValidInputTrays = {
+ ValidInputTraysOids, XpNumber(ValidInputTraysOids)
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_jis_b5,
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "PCL", "5", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec PclValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xc/programs/Xserver/Xprint/pcl/PclAttr.c b/xc/programs/Xserver/Xprint/pcl/PclAttr.c
new file mode 100644
index 000000000..6d23858b9
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclAttr.c
@@ -0,0 +1,83 @@
+/* $XConsortium: PclAttr.c /main/1 1996/09/28 17:00:45 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclAttr.c
+** *
+** * Contents:
+** * Attribute-handling functions for the PCL driver
+** *
+** * Created: 2/2/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "Pcl.h"
+#include "attributes.h"
+
+char *
+PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool )
+{
+ return XpGetAttributes( pCon, pool );
+}
+
+char *
+PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr )
+{
+ return XpGetOneAttribute( pCon, pool, attr );
+}
+int
+PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpAugmentAttributes( pCon, pool, attrs );
+}
+
+int
+PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpSetAttributes( pCon, pool, attrs );
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclColor.c b/xc/programs/Xserver/Xprint/pcl/PclColor.c
new file mode 100644
index 000000000..0f31b5a20
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclColor.c
@@ -0,0 +1,862 @@
+/* $XConsortium: PclColor.c /main/4 1996/12/30 16:36:57 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclColorInit.c
+** *
+** * Contents:
+** * Colormap handing code of Pcl driver for the
+** * print server.
+** *
+** * Created: 4/8/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclColor.c,v 1.6 1997/01/14 22:14:15 dawes Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <math.h>
+
+#include "colormapst.h"
+#include "windowstr.h"
+#include "resource.h"
+
+#include "Pcl.h"
+
+PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc);
+
+unsigned char *PclReadMap(char *, int *);
+
+void PclLookUp( ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b);
+
+static void lookup(unsigned char *src,
+ unsigned char *dst,
+ int num,
+ unsigned char *map,
+ int dim);
+static void trilinear(unsigned char *p,
+ unsigned char *out,
+ unsigned char *d,
+ int dim,
+ unsigned char def);
+
+
+/*
+ * This seems to be (and is) a duplication of effort; one would think
+ * that cfbCreateDefColormap would be sufficient. It almost is. The
+ * only change made in this function is that the black and white pixels
+ * are allocated with three separate variables for red, green and blue
+ * values, instead of the single variable in cfbCreateDefColormap. The
+ * single variable leads to the one value being corrected by
+ * ResolveColor three times, which leads to incorrect colors.
+ */
+
+Bool
+PclCreateDefColormap(ScreenPtr pScreen)
+{
+ unsigned short wp_red = ~0, wp_green = ~0, wp_blue = ~0;
+ unsigned short bp_red = 0, bp_green = 0, bp_blue = 0;
+ VisualPtr pVisual;
+ ColormapPtr cmap;
+ Pixel wp, bp;
+
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++)
+ ;
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0)
+ != Success)
+ return FALSE;
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(cmap, &wp_red, &wp_green, &wp_blue, &wp, 0) !=
+ Success) ||
+ (AllocColor(cmap, &bp_red, &bp_green, &bp_blue, &bp, 0) !=
+ Success))
+ return FALSE;
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+ (*pScreen->InstallColormap)(cmap);
+ return TRUE;
+}
+
+/*
+ * Add colormap to list of colormaps on screen
+ */
+Bool
+PclCreateColormap(ColormapPtr pColor)
+{
+ PclCmapToContexts *new;
+ PclScreenPrivPtr sPriv;
+
+ sPriv = (PclScreenPrivPtr)pColor->pScreen
+ ->devPrivates[PclScreenPrivateIndex].ptr;
+
+ /*
+ * Use existing code to initialize the values in the colormap
+ */
+ cfbInitializeColormap( pColor );
+
+ /*
+ * Set up the mapping between the color map and the context
+ */
+ new = (PclCmapToContexts *)xalloc( sizeof( PclCmapToContexts ) );
+
+ if( new )
+ {
+ new->colormapId = pColor->mid;
+ new->contexts = NULL;
+ new->next = sPriv->colormaps;
+ sPriv->colormaps = new;
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+void
+PclDestroyColormap(ColormapPtr pColor)
+{
+ PclScreenPrivPtr sPriv;
+ PclCmapToContexts *pCmap, *tCmap;
+ PclContextListPtr con, tCon;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pPal;
+ char t[80];
+
+ /*
+ * At DestroyContext time, colormaps may be destroyed twice, so if the
+ * pointer is NULL, just crash out.
+ */
+ if( !pColor )
+ return;
+
+ /*
+ * Find the colormap <-> contexts mapping
+ */
+ sPriv = (PclScreenPrivPtr)pColor->pScreen
+ ->devPrivates[PclScreenPrivateIndex].ptr;
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ if( pCmap->colormapId == pColor->mid )
+ break;
+ tCmap = pCmap;
+ pCmap = pCmap->next;
+ }
+
+ /*
+ * For each context, delete the palette in the printer and
+ * free the mapping.
+ */
+ if( pCmap )
+ {
+ con = pCmap->contexts;
+ while( con )
+ {
+ cPriv = con->context->devPrivates[PclContextPrivateIndex].ptr;
+
+ pPal = cPriv->palettes;
+ while( pPal )
+ {
+ if( pPal->colormapId == pColor->mid )
+ break;
+ pPal = pPal->next;
+ }
+
+ if( cPriv->pPageFile )
+ {
+ sprintf( t, "\033&p%dI\033*p2C", pPal->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+
+ tCon = con;
+ con = con->next;
+ xfree( tCon );
+ }
+
+ /*
+ * Delete the colormap<->contexts mapping
+ */
+ if( sPriv->colormaps == pCmap )
+ /* Delete from the front */
+ sPriv->colormaps = pCmap->next;
+ else
+ /* Delete from the middle */
+ tCmap->next = pCmap->next;
+ free( pCmap );
+ }
+}
+
+void
+PclInstallColormap(ColormapPtr pColor)
+{
+}
+
+void
+PclUninstallColormap(ColormapPtr pColor)
+{
+}
+
+int
+PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList)
+{
+ return 0;
+}
+
+void
+PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs)
+{
+ PclCmapToContexts *p;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ char t[80], t2[30];
+ int i;
+
+ sPriv = (PclScreenPrivPtr)pColor->pScreen
+ ->devPrivates[PclScreenPrivateIndex].ptr;
+ p = sPriv->colormaps;
+ while( p )
+ {
+ if( p->colormapId == pColor->mid )
+ break;
+ p = p->next;
+ }
+
+ if( p )
+ {
+ con = p->contexts;
+ while( con )
+ {
+ /*
+ * For each context, get the palette ID and update the
+ * appropriate palette.
+ */
+ cPriv = con->context
+ ->devPrivates[PclContextPrivateIndex].ptr;
+ pMap = PclFindPaletteMap( cPriv, pColor, NULL );
+
+ /*
+ * Update the palette
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ if( pColor->class == PseudoColor )
+ {
+ unsigned short r, g, b;
+ unsigned int pID;
+ for( i = 0; i < ndef; i++ )
+ {
+ pID = pdefs[i].pixel;
+ if ( pColor->red[i].fShared )
+ {
+ r = pColor->red[pID].co.shco.red->color;
+ g = pColor->red[pID].co.shco.green->color;
+ b = pColor->red[pID].co.shco.blue->color;
+ }
+ else
+ {
+ r = pColor->red[pID].co.local.red;
+ g = pColor->red[pID].co.local.green;
+ b = pColor->red[pID].co.local.blue;
+ }
+
+ if( pdefs[i].flags & DoRed )
+ r = pdefs[i].red;
+ if( pdefs[i].flags & DoGreen )
+ g = pdefs[i].green;
+ if( pdefs[i].flags & DoBlue )
+ b = pdefs[i].blue;
+ PclLookUp(pColor, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, pID);
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+ }
+
+ sprintf( t, "\033&p%dS", cPriv->currentPalette );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ con = con->next;
+ }
+ }
+}
+
+void
+PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual)
+{
+ /*
+ * We need to map the X color range of [0,65535] to the PCL color
+ * range of [0,32767].
+ */
+ *pRed >>= 1;
+ *pGreen >>= 1;
+ *pBlue >>= 1;
+}
+
+PclPaletteMapPtr
+PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc)
+{
+ PclPaletteMapPtr p = cPriv->palettes, new;
+
+ /*
+ * If the colormap is static, grab one of the special palettes. If we come
+ * into this from StoreColors, there will be no GC, but by definition we're
+ * looking at a dynamic color map, so the special colors will not be
+ * needed.
+ */
+ if( gc )
+ {
+ if( cmap->pVisual->class == StaticGray )
+ return &( cPriv->staticGrayPalette );
+ else if( cmap->pVisual->class == TrueColor )
+ {
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ return &( cPriv->specialTrueColorPalette );
+ else
+ return &( cPriv->trueColorPalette );
+ }
+ }
+
+
+ /* Look for the colormap ID <-> palette ID mapping */
+ while( p )
+ {
+ if( p->colormapId == cmap->mid )
+ return p;
+ p = p->next;
+ }
+
+ /* If the colormap isn't already there, make an entry for it */
+ new = (PclPaletteMapPtr)xalloc( sizeof( PclPaletteMap ) );
+ new->colormapId = cmap->mid;
+ new->paletteId = cPriv->nextPaletteId++;
+ new->downloaded = 0;
+ new->next = cPriv->palettes;
+ cPriv->palettes = new;
+ return new;
+}
+
+int
+PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile)
+{
+ PclScreenPrivPtr sPriv;
+
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ PclCmapToContexts *pCmap, *tCmap;
+ PclContextListPtr new;
+ char t[80];
+ Colormap c;
+ ColormapPtr cmap;
+ WindowPtr win = (WindowPtr)pDrawable;
+ unsigned short r, g, b, rr, gg, bb;
+ int i;
+
+ cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ c = wColormap( win );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+ pMap = PclFindPaletteMap( cPriv, cmap, gc );
+
+ if( cPriv->currentPalette == pMap->paletteId )
+ /*
+ * If the requested colormap is already active, nothing needs to
+ * be done.
+ */
+ return;
+
+ /*
+ * Now we activate the palette in the printer
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( outFile, t );
+ cPriv->currentPalette = pMap->paletteId;
+
+ if( pMap->downloaded == 0 )
+ /*
+ * If the requested colormap has not been downloaded to the
+ * printer, we need to do that before activating it.
+ */
+ {
+ /*
+ * Add the colormap to the screen-level colormap<->context mapping.
+ */
+ sPriv = (PclScreenPrivPtr)cmap->pScreen
+ ->devPrivates[PclScreenPrivateIndex].ptr;
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ if( pCmap->colormapId == cmap->mid )
+ break;
+ tCmap = pCmap;
+ pCmap = pCmap->next;
+ }
+ new = (PclContextListPtr)xalloc( sizeof( PclContextList ) );
+ new->context = pCon;
+ new->next = pCmap->contexts;
+ pCmap->contexts = new;
+
+ /*
+ * XXX Download the colormap
+ */
+ if( cmap->class == StaticGray )
+ {
+#ifdef XP_PCL_COLOR
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, 1, 1, 1, 1 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now program the two colors */
+ sprintf( t, "\033*v0a0b0c%dI", cmap->pScreen->blackPixel );
+ SEND_PCL( cPriv->pPageFile, t );
+ sprintf( t, "\033*v32767a32767b32767c%dI",
+ cmap->pScreen->whitePixel );
+ SEND_PCL( cPriv->pPageFile, t );
+#endif /* XP_PCL_COLOR */
+ }
+ else if( cmap->class == PseudoColor )
+ {
+ sprintf( t,
+ "\033*v18W%c%c%c%c%c%c",
+ 0, 1, cmap->pVisual->nplanes, 16, 16, 16 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ if ( cPriv->ctbl != NULL )
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0xff, 0x00, 0xff,
+ 0x00, 0xff );
+ else
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ for(i = 0; i < cmap->pVisual->ColormapEntries; i++ )
+ {
+ if( cmap->red[i].fShared )
+ {
+ r = cmap->red[i].co.shco.red->color;
+ g = cmap->red[i].co.shco.green->color;
+ b = cmap->red[i].co.shco.blue->color;
+ }
+ else
+ {
+ r = cmap->red[i].co.local.red;
+ g = cmap->red[i].co.local.green;
+ b = cmap->red[i].co.local.blue;
+ }
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, i );
+ SEND_PCL( outFile, t );
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ unsigned short lim;
+
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0xff,
+ 0x00, 0xff,
+ 0x00, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ rr = (r * 0xff)/7;
+ gg = (g * 0xff)/7;
+ bb = (b * 0xff)/3;
+ PclLookUp(cmap, cPriv, &rr, &gg, &bb);
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ rr, gg, bb, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+ else
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x07,
+ 0x00, 0x07,
+ 0x00, 0x03 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ r, g, b, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+
+ }
+ else
+ {
+ lim = (1 << cmap->pVisual->bitsPerRGBValue) - 1;
+
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 3,
+ cmap->pVisual->nplanes,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff);
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+ }
+
+ }
+ pMap->downloaded = 1;
+ }
+
+}
+
+void PclLookUp(
+ ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b
+)
+{
+ unsigned char cdata[3];
+
+ if( cmap->class == PseudoColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r >> 8;
+ cdata[1] = *g >> 8;
+ cdata[2] = *b >> 8;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ else
+ {
+ *r >>= 1;
+ *g >>= 1;
+ *b >>= 1;
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r;
+ cdata[1] = *g;
+ cdata[2] = *b;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ }
+ return;
+}
+
+unsigned char *PclReadMap(char *name, int *dim)
+{
+ FILE *fp;
+ unsigned char *data;
+ long size;
+
+ if ((fp=fopen(name, "r")) == NULL) {
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+
+ /* Could do this with a lookup table, if the constraint is that the
+ 3 map dimensions must be equal. */
+ switch (size) {
+ case 8*8*8*3:
+ *dim = 8;
+ break;
+ case 16*16*16*3:
+ *dim = 16;
+ break;
+ case 17*17*17*3:
+ *dim = 17;
+ break;
+ case 65*65*65*3:
+ *dim = 65;
+ break;
+ default:
+ fclose(fp);
+ return(NULL);
+ }
+
+ if ((data = (unsigned char *) xalloc(sizeof(char) * size)) == NULL) {
+ fclose(fp);
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_SET);
+
+ if (fread(data, sizeof(char), size, fp) != size) {
+ fclose(fp);
+ free(data);
+ return(NULL);
+ }
+
+ fclose(fp);
+ return(data);
+}
+
+/************************************************************************
+ *
+ * Here is the mapper.
+ *
+ ************************************************************************/
+
+#define SCL(x) ((x)*(dim-1)/255)
+/* Interleaved-map lookup */
+static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
+{
+ int i;
+ unsigned char *p1, *p2, *p3;
+ int shift, offset;
+
+#define _INTERPOLATE
+#ifndef _INTERPOLATE
+ for (i=0; i<num; i++) {
+ p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ src += 3;
+ }
+#else
+ for (i=0; i<num; i++) {
+ trilinear(src, dst, map, dim, 128);
+ src += 3;
+ dst += 3;
+ }
+#endif
+}
+
+/*
+ * C code from the article
+ * "Tri-linear Interpolation"
+ * by Steve Hill, sah@ukc.ac.uk
+ * in "Graphics Gems IV", Academic Press, 1994
+ *
+ * Fri Feb 16 14:12:43 PST 1996
+ * Modified to use for 8-bit color mapping -- A. Fitzhugh,
+ * HP Labs, Printing Technology Department
+ */
+
+/* linear interpolation from l (when a=0) to h (when a=1)*/
+/* (equal to (a*h)+((1-a)*l) */
+#define LERP(a,l,h) ((l)+((((h)-(l))*(a))>>8))
+
+static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, int dim, unsigned char def)
+{
+#define DENS(X, Y, Z, ch) d[((X*dim+Y)*dim+Z)*3+ch]
+
+ int x0, y0, z0,
+ x1, y1, z1,
+ i;
+ unsigned char *dp,
+ fx, fy, fz,
+ d000, d001, d010, d011,
+ d100, d101, d110, d111,
+ dx00, dx01, dx10, dx11,
+ dxy0, dxy1, dxyz;
+ float scale;
+
+ scale = 255.0 / (dim-1);
+
+ x0 = p[0] / scale;
+ y0 = p[1] / scale;
+ z0 = p[2] / scale;
+
+ /* Fractions should range from 0-1.0 (fixed point 8-256) */
+ fx = (((int) (p[0] - x0 * scale)) << 8) / 255;
+ fy = (((int) (p[1] - y0 * scale)) << 8) / 255;
+ fz = (((int) (p[2] - z0 * scale)) << 8) / 255;
+
+ x1 = x0 + 1;
+ y1 = y0 + 1;
+ z1 = z0 + 1;
+
+ for (i=0; i<3; i++) {
+
+ if (x0 >= 0 && x1 < dim &&
+ y0 >= 0 && y1 < dim &&
+ z0 >= 0 && z1 < dim) {
+ dp = &DENS(x0, y0, z0, i);
+ d000 = dp[0];
+ d100 = dp[3];
+ dp += dim*3;
+ d010 = dp[0];
+ d110 = dp[3];
+ dp += dim*dim*3;
+ d011 = dp[0];
+ d111 = dp[3];
+ dp -= dim*3;
+ d001 = dp[0];
+ d101 = dp[3];
+ } else {
+# define INRANGE(X, Y, Z) \
+ ((X) >= 0 && (X) < dim && \
+ (Y) >= 0 && (Y) < dim && \
+ (Z) >= 0 && (Z) < dim)
+
+ d000 = INRANGE(x0, y0, z0) ? DENS(x0, y0, z0, i) : def;
+ d001 = INRANGE(x0, y0, z1) ? DENS(x0, y0, z1, i) : def;
+ d010 = INRANGE(x0, y1, z0) ? DENS(x0, y1, z0, i) : def;
+ d011 = INRANGE(x0, y1, z1) ? DENS(x0, y1, z1, i) : def;
+
+ d100 = INRANGE(x1, y0, z0) ? DENS(x1, y0, z0, i) : def;
+ d101 = INRANGE(x1, y0, z1) ? DENS(x1, y0, z1, i) : def;
+ d110 = INRANGE(x1, y1, z0) ? DENS(x1, y1, z0, i) : def;
+ d111 = INRANGE(x1, y1, z1) ? DENS(x1, y1, z1, i) : def;
+ }
+
+ dx00 = LERP(fx, d000, d100);
+ dx01 = LERP(fx, d001, d101);
+ dx10 = LERP(fx, d010, d110);
+ dx11 = LERP(fx, d011, d111);
+
+ dxy0 = LERP(fy, dx00, dx10);
+ dxy1 = LERP(fy, dx01, dx11);
+
+ out[i] = LERP(fz, dxy0, dxy1);
+ }
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclCursor.c b/xc/programs/Xserver/Xprint/pcl/PclCursor.c
new file mode 100644
index 000000000..7e8e1c2a8
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclCursor.c
@@ -0,0 +1,110 @@
+/* $XConsortium: PclCursor.c /main/1 1996/09/28 17:00:59 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclCursor.c
+** *
+** * Contents:
+** * Cursor-handling code for the PCL DDX driver
+** *
+** * Created: 1/18/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include <stdio.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclConstrainCursor( pScreen, pBox )
+ ScreenPtr pScreen;
+ BoxPtr pBox;
+{
+}
+
+void
+PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox )
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ BoxPtr pHotBox;
+ BoxPtr pTopLeftBox;
+{
+}
+
+Bool
+PclDisplayCursor( pScreen, pCursor )
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ return True;
+}
+
+Bool
+PclRealizeCursor( pScreen, pCursor )
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ return True;
+}
+
+Bool
+PclUnrealizeCursor( pScreen, pCursor )
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ return True;
+}
+
+void
+PclRecolorCursor( pScreen, pCursor, displayed )
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ Bool displayed;
+{
+}
+
+Bool
+PclSetCursorPosition( pScreen, x, y, generateEvent )
+ ScreenPtr pScreen;
+ int x;
+ int y;
+ Bool generateEvent;
+{
+ return True;
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclDef.h b/xc/programs/Xserver/Xprint/pcl/PclDef.h
new file mode 100644
index 000000000..acc4a3e26
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclDef.h
@@ -0,0 +1,64 @@
+/* $XConsortium: PclDef.h /main/1 1996/09/28 17:01:04 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclDef.h
+** *
+** * Contents: extran defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 7/31/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifndef _PCLDEF_H_
+#define _PCLDEF_H_
+
+#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER"
+#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER"
+#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND"
+#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND"
+#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION"
+#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER"
+#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER"
+#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND"
+
+#define DT_IN_FILE_STRING "%(InFile)%"
+#define DT_OUT_FILE_STRING "%(OutFile)%"
+#define DT_ALLOWED_COMMANDS_FILE "printCommands"
+
+#endif /* _PCLDEF_H_ */
diff --git a/xc/programs/Xserver/Xprint/pcl/PclFonts.c b/xc/programs/Xserver/Xprint/pcl/PclFonts.c
new file mode 100644
index 000000000..59776eb08
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclFonts.c
@@ -0,0 +1,69 @@
+/* $XConsortium: PclFonts.c /main/1 1996/09/28 17:01:09 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclFonts.c
+** *
+** * Contents:
+** * Font code for Pcl driver.
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "miscstruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+
+#include "Pcl.h"
+
+Bool
+PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+Bool
+PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclGC.c b/xc/programs/Xserver/Xprint/pcl/PclGC.c
new file mode 100644
index 000000000..01fd0a787
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclGC.c
@@ -0,0 +1,1042 @@
+/* $TOG: PclGC.c /main/3 1997/06/11 17:53:43 samborn $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclGC.c
+** *
+** * Contents:
+** * Graphics Context handling for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.6 1998/12/20 11:57:26 dawes Exp $ */
+
+#include "gcstruct.h"
+
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "migc.h"
+#include "scrnintstr.h"
+#include "resource.h"
+
+static GCOps PclGCOps =
+{
+ PclFillSpans,
+ PclSetSpans,
+ PclPutImage,
+ PclCopyArea,
+ PclCopyPlane,
+ PclPolyPoint,
+ PclPolyLine,
+ PclPolySegment,
+ PclPolyRectangle,
+ PclPolyArc,
+ PclFillPolygon,
+ PclPolyFillRect,
+ PclPolyFillArc,
+ PclPolyText8,
+ PclPolyText16,
+ PclImageText8,
+ PclImageText16,
+ PclImageGlyphBlt,
+ PclPolyGlyphBlt,
+ PclPushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+}
+;
+
+
+static GCFuncs PclGCFuncs =
+{
+ PclValidateGC,
+ miChangeGC,
+ miCopyGC,
+ PclDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+}
+;
+
+Bool
+PclCreateGC( pGC )
+ GCPtr pGC;
+{
+ if( pGC->depth == 1 )
+ {
+ if( mfbCreateGC( pGC ) == FALSE )
+ return FALSE;
+ }
+ else if( pGC->depth <= 8 )
+ {
+ if( cfbCreateGC( pGC ) == FALSE )
+ return FALSE;
+ }
+ else if( pGC->depth <= 32 )
+ {
+ if( cfb32CreateGC( pGC ) == FALSE )
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ pGC->ops = &PclGCOps;
+ pGC->funcs = &PclGCFuncs;
+
+ return TRUE;
+}
+
+void
+PclDestroyGC(GCPtr pGC)
+{
+ /* Handle the mfb and cfb, which share a GC private struct */
+ miDestroyGC( pGC );
+}
+
+
+int
+PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
+ DrawablePtr pDrawable;
+ GC *gc;
+ unsigned long *valid;
+ FILE **file;
+{
+ XpContextPtr pCon;
+ PclPixmapPrivPtr pPriv;
+ PclContextPrivPtr cPriv;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ /*
+ * If we ever get here, something is wrong.
+ */
+ return FALSE;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+
+ if( pCon == NULL )
+ return FALSE;
+ else
+ {
+ cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+ *gc = cPriv->lastGC;
+ *valid = cPriv->validGC;
+ *file = cPriv->pPageFile;
+ return TRUE;
+ }
+
+ default:
+ return FALSE;
+ }
+}
+
+void
+PclSetDrawablePrivateGC( pDrawable, gc )
+ DrawablePtr pDrawable;
+ GC gc;
+{
+ PixmapPtr pix;
+ XpContextPtr pCon;
+ PclPixmapPrivPtr pixPriv;
+ PclContextPrivPtr pPriv;
+ int i;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ pix = (PixmapPtr)pDrawable;
+ pixPriv = pix->devPrivates[PclPixmapPrivateIndex].ptr;
+
+ pixPriv->lastGC = gc;
+ pixPriv->validGC = 1;
+ break;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pPriv = ((PclContextPrivPtr)
+ (pCon->devPrivates[PclContextPrivateIndex].ptr));
+
+ pPriv->validGC = 1;
+ pPriv->lastGC = gc;
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+ break;
+ }
+}
+
+static void
+PclSendPattern(char *bits,
+ int sz,
+ int depth,
+ int h,
+ int w,
+ int patNum,
+ FILE *outFile)
+{
+ char t[80], *row, *mod;
+ int w2;
+ int i, j;
+
+ SEND_PCL( outFile, "\033%0A" );
+
+ if( depth == 1 )
+ {
+ /* Each row must be word-aligned */
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+/*
+ if( w2 % 2 )
+ w2++;
+*/
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else if( depth == 8 )
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 8 ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ mod = (char *)xalloc( w2 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 24 ) )
+ {
+ char r, g, b;
+ for( j = 0; j < w2; j++ ) {
+ r = ((row[j*4+1] >> 5) & 0x7) << 5;
+ g = ((row[j*4+2] >> 5) & 0x7) << 2;
+ b = ((row[j*4+3] >> 6) & 0x3);
+ mod[j] = r | g | b;
+ }
+ SEND_PCL_COUNT( outFile, mod, w2 );
+ }
+
+ xfree( mod );
+ }
+
+ SEND_PCL( outFile, "\033%0B" );
+}
+
+int
+PclUpdateDrawableGC( pGC, pDrawable, outFile )
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+ FILE **outFile;
+{
+ Mask drawableMask, changeMask = 0;
+ GC dGC;
+ unsigned long valid;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ Colormap c;
+ ColormapPtr cmap;
+ PclGCPrivPtr gcPriv = (PclGCPrivPtr)
+ (pGC->devPrivates[PclGCPrivateIndex].ptr);
+
+ if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) )
+ return FALSE;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Here's where we update the colormap. Since there can be
+ * different colormaps installed on each window, we need to check
+ * before each drawing request that the correct palette is active in
+ * the printer. This is as good a place as any.
+ */
+ if( !PclUpdateColormap( pDrawable, pCon, pGC, *outFile ) )
+ return FALSE;
+
+ /*
+ * If the drawable's last GC is NULL, this means that this is
+ * the first time the drawable is being used. Therefore, we need
+ * to emit PCL for all the GC fields.
+ */
+ if( valid == 0 )
+ changeMask = ~0;
+
+ /*
+ * If we have two different GC structures, there is no alternative
+ * but to scan through them both to determine the changeMask.
+ */
+ else
+ {
+ if( dGC.alu != pGC->alu )
+ changeMask |= GCFunction;
+ if( dGC.fgPixel != pGC->fgPixel )
+ changeMask |= GCForeground;
+ if( dGC.bgPixel != pGC->bgPixel )
+ changeMask |= GCBackground;
+ if( dGC.lineWidth != pGC->lineWidth )
+ changeMask |= GCLineWidth;
+ if( dGC.lineStyle != pGC->lineStyle )
+ changeMask |= GCLineStyle;
+ if( dGC.capStyle != pGC->capStyle )
+ changeMask |= GCCapStyle;
+ if( dGC.joinStyle != pGC->joinStyle )
+ changeMask |= GCJoinStyle;
+ if( dGC.fillStyle != pGC->fillStyle )
+ changeMask |= GCFillStyle;
+ if( dGC.tile.pixmap != pGC->tile.pixmap )
+ changeMask |= GCTile;
+ if( dGC.stipple != pGC->stipple )
+ changeMask |= GCStipple;
+ if( dGC.patOrg.x != pGC->patOrg.x )
+ changeMask |= GCTileStipXOrigin;
+ if( dGC.patOrg.y != pGC->patOrg.y )
+ changeMask |= GCTileStipYOrigin;
+
+ if( dGC.numInDashList == pGC->numInDashList )
+ for( i = 0; i < dGC.numInDashList; i++ )
+ if( cPriv->dash[i] != pGC->dash[i] )
+ {
+ changeMask |= GCDashList;
+ break;
+ }
+ else
+ changeMask |= GCDashList;
+ }
+
+ /*
+ * Once the changeMask has been determined, we scan it and emit
+ * the appropriate PCL code to set the drawing attributes.
+ */
+
+ /* Must be in HP-GL/2 mode to set attributes */
+ SEND_PCL( *outFile, "\033%0B" );
+
+ if( changeMask & GCFunction )
+ {
+#ifdef XP_PCL_COLOR
+
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#else
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#endif /* XP_PCL_COLOR */
+ }
+
+#if 0
+ if( changeMask & GCFunction )
+ {
+ int rop = -1;
+ char t[10];
+
+ switch( pGC->alu )
+ {
+ case GXclear:
+ rop = 1;
+ break;
+ case GXand:
+ rop = 136;
+ break;
+ case GXandReverse:
+ rop = 68;
+ break;
+ case GXcopy:
+ rop = 204;
+ break;
+ case GXandInverted:
+ rop = 34;
+ break;
+ case GXnoop:
+ rop = 170;
+ break;
+ case GXxor:
+ rop = 238;
+ break;
+ case GXor:
+ rop = 238;
+ break;
+ case GXnor:
+ rop = 17;
+ break;
+ case GXequiv:
+ rop = 153;
+ break;
+ case GXinvert:
+ rop = 85;
+ break;
+ case GXorReverse:
+ rop = 221;
+ break;
+ case GXcopyInverted:
+ rop = 51;
+ break;
+ case GXorInverted:
+ rop = 187;
+ break;
+ case GXnand:
+ rop = 119;
+ break;
+ case GXset:
+ rop = 0;
+ break;
+ }
+ if( rop != -1 )
+ {
+ sprintf( t, "MC1,%d;", rop );
+ SEND_PCL( *outFile, t );
+#endif
+
+ if( changeMask & GCForeground )
+ switch( pGC->fgPixel )
+ {
+ case 1:
+ SEND_PCL( *outFile, "SP1;" );
+ break;
+ default:
+ SEND_PCL( *outFile, "SP0;" );
+ break;
+ }
+
+ if( changeMask & GCForeground )
+ {
+ char t[40];
+
+#ifdef XP_PCL_COLOR
+ c = wColormap( ((WindowPtr)pDrawable) );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+
+ if( cmap->class == TrueColor )
+ {
+ if( pGC->fillStyle != FillTiled || pGC->tileIsPixel ) {
+ unsigned short r, g, b;
+
+ r = (pGC->fgPixel & cmap->pVisual->redMask)
+ >> (cmap->pVisual->offsetRed );
+ g = (pGC->fgPixel & cmap->pVisual->greenMask)
+ >> (cmap->pVisual->offsetGreen);
+ b = (pGC->fgPixel & cmap->pVisual->blueMask)
+ >> (cmap->pVisual->offsetBlue);
+
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033%%0A\033*v%ua%ub%uc0I\033%%0B", r, g, b);
+ SEND_PCL( *outFile, t );
+ }
+ }
+ else /* PseudoColor or StaticGray */
+ {
+ sprintf( t, "SP%d;", pGC->fgPixel );
+ SEND_PCL( *outFile, t );
+ }
+#else
+ ScreenPtr screen;
+ screen = pDrawable->pScreen;
+ if ( pGC->fgPixel == screen->whitePixel )
+ SEND_PCL( *outFile, "SP0;");
+ else
+ SEND_PCL( *outFile, "SP1;");
+#endif /* XP_PCL_COLOR */
+ }
+
+ if( changeMask & GCJoinStyle )
+ switch( pGC->joinStyle )
+ {
+ case JoinMiter:
+ SEND_PCL( *outFile, "LA2,1;" );
+ break;
+ case JoinRound:
+ SEND_PCL( *outFile, "LA2,4;" );
+ break;
+ case JoinBevel:
+ SEND_PCL( *outFile, "LA2,5;" );
+ break;
+ }
+
+ if( changeMask & GCCapStyle )
+ switch( pGC->capStyle )
+ {
+ case CapNotLast:
+ case CapButt:
+ SEND_PCL( *outFile, "LA1,1;" );
+ break;
+ case CapRound:
+ SEND_PCL( *outFile, "LA1,4;" );
+ break;
+ case CapProjecting:
+ SEND_PCL( *outFile, "LA1,2;" );
+ break;
+ }
+
+ if( changeMask & GCLineWidth )
+ {
+ float penWidth, pixelsPerMM;
+ ScreenPtr screen;
+ char temp[30];
+
+ if( pGC->lineWidth == 0 || pGC->lineWidth == 1 )
+ /* A pen width of 0.0 mm gives a one-pixel-wide line */
+ penWidth = 0.0;
+ else
+ {
+ screen = pDrawable->pScreen;
+ pixelsPerMM = (float)screen->width / (float)screen->mmWidth;
+
+ penWidth = pGC->lineWidth / pixelsPerMM;
+ }
+ sprintf( temp, "PW%g;", penWidth );
+ SEND_PCL( *outFile, temp );
+ }
+
+ if( changeMask & GCLineStyle )
+ {
+ int i, num = pGC->numInDashList;
+ double total;
+ char t[30];
+
+ switch( pGC->lineStyle )
+ {
+ case LineSolid:
+ SEND_PCL( *outFile, "LT;" );
+ break;
+ case LineOnOffDash:
+ /*
+ * Calculate the pattern length of the dashes, in pixels,
+ * then convert to mm
+ */
+ for( i = 0, total = 0.0; i < 20 && i < num; i++ )
+ total += pGC->dash[i];
+ if( num % 2 )
+ for( i = num; i < 20 && i < num + num; i++ )
+ total += pGC->dash[i-num];
+
+ total *= ( (double)pDrawable->pScreen->mmWidth /
+ (double)pDrawable->pScreen->width );
+
+ sprintf( t, "LT8,%f,1;", total );
+ SEND_PCL( *outFile, t );
+ break;
+ }
+ }
+
+
+ if( changeMask & GCFillStyle )
+ switch( pGC->fillStyle )
+ {
+ case FillSolid:
+ SEND_PCL( *outFile, "FT1;TR0;CF;" );
+ break;
+ case FillTiled:
+ SEND_PCL( *outFile, "FT22,100;TR0;CF2,0;" );
+ break;
+ case FillOpaqueStippled:
+ SEND_PCL( *outFile, "FT22,101;TR0;CF2,0;" );
+ if( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg )
+ changeMask |= GCStipple;
+ break;
+ case FillStippled:
+ SEND_PCL( *outFile, "FT22,102;TR1;CF2,0;" );
+ break;
+ }
+
+ if( changeMask & GCTile && !pGC->tileIsPixel )
+ {
+ char t[80], *bits, *row, *mod;
+ int h, w, w2, sz;
+ int i, j;
+
+ h = pGC->tile.pixmap->drawable.height;
+ w = pGC->tile.pixmap->drawable.width;
+
+ if( pGC->tile.pixmap->drawable.depth == 1 )
+ {
+ sz = h * BitmapBytePad( w );
+
+ bits = (char *)xalloc( sz );
+ mfbGetImage(pGC->tile.pixmap, 0, 0, w, h, XYPixmap, ~0, bits);
+ PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
+ xfree( bits );
+ }
+ else if( pGC->tile.pixmap->drawable.depth == 8 )
+ {
+ sz = h * PixmapBytePad( w, 8 );
+ bits = (char *)xalloc( sz );
+ cfbGetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ PclSendPattern( bits, sz, 8, h, w, 100, *outFile );
+ xfree( bits );
+ }
+ else
+ {
+ sz = h * PixmapBytePad( w, 24 );
+
+ bits = (char *)xalloc( sz );
+ cfb32GetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ PclSendPattern( bits, sz, 24, h, w, 100, *outFile );
+ xfree( bits );
+ }
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ /*
+ * We have to resend the stipple pattern either when the stipple itself
+ * changes, or if we're in FillOpaqueStippled mode and either the
+ * foreground or the background color changes.
+ */
+ if( changeMask & GCStipple ||
+ ( pGC->fillStyle == FillOpaqueStippled &&
+ ( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg ) ) )
+ {
+ int h, w, i, sz, w2;
+ char *bits, *row, t[30];
+ PixmapPtr scratchPix;
+ GCPtr scratchGC;
+
+ if( pGC->stipple != NULL )
+ {
+ SEND_PCL( *outFile, "\033%0A" );
+
+ h = pGC->stipple->drawable.height;
+ w = pGC->stipple->drawable.width;
+ sz = h * BitmapBytePad( w );
+
+ bits = (char *)xalloc( sz );
+ mfbGetImage( pGC->stipple, 0, 0, w, h, XYPixmap, ~0, bits );
+
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+ /*
+ * XXX The PCL docs say that I need to word-align each
+ * XXX row, but I get garbage when I do...
+ */
+ /*
+ if( w2 % 2 )
+ w2++;
+ */
+
+ sprintf( t, "\033*c102g%dW", h * w2 + 8 );
+ SEND_PCL( *outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( *outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( *outFile, row, w2 );
+
+ SEND_PCL( *outFile, "\033%0B" );
+
+ xfree( bits );
+
+ /*
+ * Also do the opaque stipple, as a tile
+ */
+ if( pGC->depth != 1 )
+ sz = h * PixmapBytePad( w, pGC->depth );
+ bits = (char *)xalloc( sz );
+
+ scratchPix =
+ (*pGC->pScreen->CreatePixmap)( pGC->pScreen,
+ w, h, pGC->depth );
+ scratchGC = GetScratchGC( pGC->depth, pGC->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ if( pGC->depth == 1 )
+ {
+ mfbValidateGC( scratchGC, ~0L,
+ (DrawablePtr)scratchPix );
+ mfbCopyPlane( pGC->stipple,
+ (DrawablePtr)scratchPix, scratchGC, 0,
+ 0, w, h, 0, 0, 1 );
+ mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0,
+ bits );
+ }
+ else if( pGC->depth <= 8 )
+ {
+ cfbValidateGC( scratchGC, ~0L,
+ (DrawablePtr)scratchPix );
+ cfbCopyPlane( pGC->stipple,
+ (DrawablePtr)scratchPix, scratchGC, 0,
+ 0, w, h, 0, 0, 1 );
+ cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0,
+ bits );
+ }
+ else if( pGC->depth <= 32 )
+ {
+ cfb32ValidateGC( scratchGC, ~0L,
+ (DrawablePtr)scratchPix );
+ cfb32CopyPlane( pGC->stipple,
+ (DrawablePtr)scratchPix, scratchGC, 0,
+ 0, w, h, 0, 0, 1 );
+ cfb32GetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0,
+ bits );
+ }
+ PclSendPattern( bits, sz, pGC->depth, h, w, 101, *outFile );
+ FreeScratchGC( scratchGC );
+ (*pGC->pScreen->DestroyPixmap)( scratchPix );
+ xfree( bits );
+ }
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ if( changeMask & GCDashList )
+ {
+ int num = pGC->numInDashList;
+ double total;
+ char dashes[20];
+ char t[100], t2[20];
+
+ /* Make up the doubled dash list, if necessary */
+ for( i = 0; i < 20 && i < num; i++ )
+ dashes[i] = pGC->dash[i];
+
+ if( num % 2 )
+ {
+ for( i = num; i < 20 && i < num + num; i++ )
+ dashes[i] = dashes[i-num];
+ if( ( num *= 2 ) > 20 )
+ num = 20;
+ }
+
+ /* Add up dash lengths to get percentage */
+ for( i = 0, total = 0; i < num; i++ )
+ total += dashes[i];
+
+ /* Build up the HP-GL/2 for the dash list */
+ strcpy( t, "UL8" );
+ for( i = 0; i < num; i++ )
+ {
+ sprintf( t2, ",%d",
+ (int)( ( (double)dashes[i] / total * 100.0 ) + 0.5 ) );
+ strcat( t, t2 );
+ }
+ strcat( t, ";" );
+ SEND_PCL( *outFile, t );
+ }
+
+
+ /* Go back to PCL mode */
+ SEND_PCL( *outFile, "\033%0A" );
+
+ /*
+ * Update the drawable's private information, which includes
+ * erasing the drawable's private changeMask, since all the
+ * changes have been made.
+ */
+ if( changeMask )
+ PclSetDrawablePrivateGC( pDrawable, *pGC );
+
+ return TRUE;
+}
+
+/*
+ * PclComputeCompositeClip()
+ *
+ * I'd like to use the miComputeCompositeClip function, but it sticks
+ * things into the mi GC privates, where the PCL driver can't get at
+ * it. So, rather than mess around with the mi code, I ripped it out
+ * and made the appropriate changes here.
+ */
+
+
+void
+PclComputeCompositeClip(pGC, pDrawable)
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+{
+ ScreenPtr pScreen = pGC->pScreen;
+
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else
+ {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE)
+ {
+ if (freeCompClip)
+ REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else
+ {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pScreen, pregWin);
+ }
+ else if (freeTmpClip)
+ {
+ REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else
+ {
+ pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else
+ {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip)
+ {
+ REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
+ }
+ else
+ {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION)
+ {
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ -pGC->clipOrg.x, -pGC->clipOrg.y);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ } /* end of composite clip for pixmap */
+}
+
+/*
+ * PclValidateGC()
+ *
+ * Unlike many screen GCValidate routines, this function should not need
+ * to mess with setting the drawing functions. Different drawing
+ * functions are usually needed to optimize such things as drawing
+ * wide or dashed lines; this functionality will be handled primarily
+ * by the printer itself, while the necessary PCL code to set the
+ * attributes will be done in PclUpdateDrawableGC().
+ */
+
+/*ARGSUSED*/
+void
+PclValidateGC( pGC, changes, pDrawable )
+ GCPtr pGC;
+ unsigned long changes;
+ DrawablePtr pDrawable;
+{
+ /*
+ * Pixmaps should be handled by their respective validation
+ * functions.
+ */
+ if( pDrawable->type == DRAWABLE_PIXMAP )
+ {
+ if( pDrawable->depth == 1 )
+ {
+ mfbValidateGC( pGC, ~0, pDrawable );
+ }
+ else if( pDrawable->depth <= 8 )
+ {
+ cfbValidateGC( pGC, ~0, pDrawable );
+ }
+ else if( pDrawable->depth <= 32 )
+ {
+ cfb32ValidateGC( pGC, ~0, pDrawable );
+ }
+ return;
+ }
+
+ /*
+ * Reset the drawing operations
+ */
+ pGC->ops = &PclGCOps;
+
+ /*
+ * Validate the information, and correct it if necessary.
+ */
+
+ /*
+ * If necessary, compute the composite clip region. (Code ripped
+ * from migc.c)
+ */
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ PclComputeCompositeClip(pGC, pDrawable);
+ }
+
+ /*
+ * PCL does not directly support the DoubleDash line style, nor is
+ * there an easy way to simulate it, so we'll just change it to a
+ * LineOnOffDash, which is supported by PCL.
+ */
+ if( ( changes & GCLineStyle ) && ( pGC->lineStyle == LineDoubleDash ) )
+ pGC->lineStyle = LineOnOffDash;
+
+ /*
+ * Update the drawable's changeMask to reflect the changes made to the GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
+*/
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclInit.c b/xc/programs/Xserver/Xprint/pcl/PclInit.c
new file mode 100644
index 000000000..db89adee5
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclInit.c
@@ -0,0 +1,640 @@
+/* $XConsortium: PclInit.c /main/3 1996/12/30 16:37:06 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclInit.c
+** *
+** * Contents:
+** * Initialization code of Pcl driver for the print server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclInit.c,v 1.6 1998/06/27 12:53:46 hohndel Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "Pcl.h"
+#include "AttrValid.h"
+
+#include "cfb.h"
+
+#include "attributes.h"
+#include "windowstr.h"
+
+#define MODELDIRNAME "/models"
+extern char *XpGetConfigDir();
+
+static void AllocatePclPrivates(
+ ScreenPtr pScreen);
+static int PclInitContext(XpContextPtr pCon);
+
+extern Bool _XpBoolNoop();
+extern void _XpVoidNoop();
+
+extern unsigned char *PclReadMap(char *, int *);
+
+int PclScreenPrivateIndex;
+int PclContextPrivateIndex;
+int PclPixmapPrivateIndex;
+int PclWindowPrivateIndex;
+int PclGCPrivateIndex;
+
+#ifdef XP_PCL_COLOR
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 },
+ { 2, PseudoColor, 8, 256, 8, 0, 0, 0, 0, 0, 0 },
+ { 3, TrueColor, 8, 256, 24, 0xFF0000, 0xFF00, 0xFF, 16, 8, 0 }
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL },
+ { 8, 1, NULL },
+ { 24, 1, NULL }
+};
+#else
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0}
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL }
+};
+#endif /* XP_PCL_COLOR */
+
+
+#define NUM_VISUALS(visuals) (sizeof(visuals) / sizeof(VisualRec))
+#define NUM_DEPTHS(depths) (sizeof(depths) / sizeof(DepthRec))
+
+Bool
+PclCloseScreen(int index,
+ ScreenPtr pScreen)
+{
+ PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ xfree( pPriv );
+
+ return (*pScreen->CloseScreen)(index, pScreen);
+}
+
+Bool
+InitializePclDriver(ndx, pScreen, argc, argv)
+ int ndx;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+ int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes;
+ int i;
+ PclScreenPrivPtr pPriv;
+ char **printerNames;
+ int numPrinters;
+
+ /*
+ * Register this driver's InitContext function with the print
+ * extension. This is a bit sleazy, as the extension hasn't yet
+ * been initialized, but the extensionneeds to know this, and this
+ * seems the best time to provide the information.
+ */
+#ifdef XP_PCL_COLOR
+ XpRegisterInitFunc( pScreen, "XP-PCL-COLOR", PclInitContext );
+#elif XP_PCL_MONO
+ XpRegisterInitFunc( pScreen, "XP-PCL-MONO", PclInitContext );
+#else
+ XpRegisterInitFunc( pScreen, "XP-PCL-LJ3", PclInitContext );
+#endif /* XP_PCL_MONO */
+
+ /*
+ * Create and fill in the devPrivate for the PCL driver.
+ */
+ AllocatePclPrivates(pScreen);
+
+ pPriv =
+ (PclScreenPrivPtr)pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+
+ maxDim = MAX( pScreen->height, pScreen->width );
+ xRes = pScreen->width / ( pScreen->mmWidth / 25.4 );
+ yRes = pScreen->height / ( pScreen->mmHeight / 25.4 );
+ maxRes = MAX( xRes, yRes );
+
+#ifdef XP_PCL_COLOR
+ cfbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes );
+ /*
+ * Clean up the fields that we stomp (code taken from cfbCloseScreen)
+ */
+ for( i = 0; i < pScreen->numDepths; i++ )
+ xfree( pScreen->allowedDepths[i].vids );
+ xfree( pScreen->allowedDepths );
+ xfree( pScreen->visuals );
+#else
+ mfbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes );
+#endif /* XP_PCL_COLOR */
+
+ miInitializeBackingStore ( pScreen );
+
+ pScreen->defColormap = FakeClientID(0);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = PclCloseScreen;
+
+ pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
+ pScreen->SaveScreen = _XpBoolNoop;
+ pScreen->GetImage = _XpVoidNoop;
+ pScreen->GetSpans = _XpVoidNoop;
+ pScreen->CreateWindow = PclCreateWindow;
+ pScreen->DestroyWindow = PclDestroyWindow;
+/*
+ pScreen->PositionWindow = PclPositionWindow;
+*/
+ pScreen->ChangeWindowAttributes = PclChangeWindowAttributes;
+/*
+ pScreen->RealizeWindow = PclMapWindow;
+ pScreen->UnrealizeWindow = PclUnmapWindow;
+*/
+ pScreen->PaintWindowBackground = PclPaintWindow;
+ pScreen->PaintWindowBorder = PclPaintWindow;
+ pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */
+
+ pScreen->CreatePixmap = PclCreatePixmap;
+ pScreen->DestroyPixmap = PclDestroyPixmap;
+ pScreen->RealizeFont = PclRealizeFont;
+ pScreen->UnrealizeFont = PclUnrealizeFont;
+ pScreen->CreateGC = PclCreateGC;
+
+ pScreen->CreateColormap = PclCreateColormap;
+ pScreen->DestroyColormap = PclDestroyColormap;
+ pScreen->InstallColormap = (InstallColormapProcPtr)NoopDDA;
+ pScreen->UninstallColormap = (UninstallColormapProcPtr)NoopDDA;
+ pScreen->ListInstalledColormaps = PclListInstalledColormaps;
+ pScreen->StoreColors = PclStoreColors;
+/*
+ pScreen->ResolveColor = PclResolveColor;
+*/
+
+ pScreen->BitmapToRegion = mfbPixmapToRegion;
+
+ pScreen->ConstrainCursor = PclConstrainCursor;
+ pScreen->CursorLimits = PclCursorLimits;
+ pScreen->DisplayCursor = PclDisplayCursor;
+ pScreen->RealizeCursor = PclRealizeCursor;
+ pScreen->UnrealizeCursor = PclUnrealizeCursor;
+ pScreen->RecolorCursor = PclRecolorCursor;
+ pScreen->SetCursorPosition = PclSetCursorPosition;
+
+ pScreen->visuals = Visuals;
+ pScreen->numVisuals = NUM_VISUALS( Visuals );
+ pScreen->allowedDepths = Depths;
+ pScreen->numDepths = NUM_DEPTHS( Depths );
+
+ for( i = 0; i < NUM_DEPTHS( Depths ); i++ )
+ {
+ pScreen->allowedDepths[i].vids =
+ (VisualID *)xalloc( sizeof(VisualID ) );
+ pScreen->allowedDepths[i].vids[0] = i + 1;
+ }
+
+#ifdef XP_PCL_COLOR
+ pScreen->rootVisual = 2;
+ pScreen->rootDepth = 8;
+#else
+ pScreen->rootVisual = 1;
+ pScreen->rootDepth = 1;
+#endif /* XP_PCL_COLOR */
+
+ pPriv->colormaps = NULL;
+ PclCreateDefColormap( pScreen );
+
+ return TRUE;
+}
+
+static void
+AllocatePclPrivates(
+ ScreenPtr pScreen)
+{
+ static int PclGeneration = -1;
+
+ if(PclGeneration != serverGeneration)
+ {
+ PclScreenPrivateIndex = AllocateScreenPrivateIndex();
+
+ PclWindowPrivateIndex = AllocateWindowPrivateIndex();
+ AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
+ sizeof( PclWindowPrivRec ) );
+
+ PclContextPrivateIndex = XpAllocateContextPrivateIndex();
+ XpAllocateContextPrivate( PclContextPrivateIndex,
+ sizeof( PclContextPrivRec ) );
+
+ PclGCPrivateIndex = AllocateGCPrivateIndex();
+ AllocateGCPrivate( pScreen, PclGCPrivateIndex,
+ sizeof( PclGCPrivRec ) );
+
+ PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
+ AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
+ sizeof( PclPixmapPrivRec ) );
+
+ PclGeneration = serverGeneration;
+ }
+
+ pScreen->devPrivates[PclScreenPrivateIndex].ptr = (pointer)xalloc(
+ sizeof(PclScreenPrivRec));
+}
+
+/*
+ * PclInitContext
+ *
+ * Establish the appropriate values for a PrintContext used with the PCL
+ * driver.
+ */
+
+static char DOC_ATT_SUPP[]="document-attributes-supported";
+static char DOC_ATT_VAL[]="document-format";
+static char JOB_ATT_SUPP[]="job-attributes-supported";
+static char JOB_ATT_VAL[]="";
+static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
+static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
+default-input-tray default-medium plex";
+
+static int
+PclInitContext( pCon )
+ XpContextPtr pCon;
+{
+ XpDriverFuncsPtr pFuncs;
+ PclContextPrivPtr pConPriv;
+ char *server, *attrStr;
+ char *modelID;
+ char *configDir;
+ char *pathName;
+ extern XpValidatePoolsRec PclValidatePoolsRec;
+ int i, j;
+ float width, height;
+ XpOidMediumDiscreteSizeList* ds_list;
+ XpOidArea* repro;
+ XpOid page_size;
+ XpOidMediumSS* m;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes( pCon );
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &( pCon->funcs );
+ pFuncs->StartJob = PclStartJob;
+ pFuncs->EndJob = PclEndJob;
+ pFuncs->StartDoc = (int (*)())PclStartDoc;
+ pFuncs->EndDoc = PclEndDoc;
+ pFuncs->StartPage = PclStartPage;
+ pFuncs->EndPage = PclEndPage;
+ pFuncs->PutDocumentData = PclDocumentData;
+ pFuncs->GetDocumentData = PclGetDocumentData;
+ pFuncs->GetAttributes = (char *(*)())PclGetAttributes;
+ pFuncs->SetAttributes = (int (*)())PclSetAttributes;
+ pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes;
+ pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute;
+ pFuncs->DestroyContext = PclDestroyContext;
+ pFuncs->GetMediumDimensions = PclGetMediumDimensions;
+ pFuncs->GetReproducibleArea = PclGetReproducibleArea;
+
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv =
+ (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pageFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->pPageFile = (FILE *)NULL;
+ pConPriv->dash = NULL;
+ pConPriv->validGC = 0;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ modelID = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-model-identifier");
+ if ( (configDir = XpGetConfigDir(False)) != (char *) NULL ) {
+ pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) +
+ strlen(modelID) + strlen("color.map") + 4);
+ if (pathName) {
+ sprintf(pathName, "%s/%s/%s/%s", configDir, MODELDIRNAME, modelID,
+ "color.map");
+ pConPriv->ctbl = PclReadMap(pathName, &pConPriv->ctbldim);
+ xfree(pathName);
+
+ } else
+ pConPriv->ctbl = NULL;
+ } else
+ pConPriv->ctbl = NULL;
+
+#ifdef XP_PCL_LJ3
+ /*
+ * Initialize the spooling buffer for saving the figures temporary
+ * (LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.)
+ */
+ pConPriv->fcount = 0;
+ if ( !(pConPriv->figures = (char *)xalloc(1024)) )
+ pConPriv->fcount_max = 0;
+ else
+ pConPriv->fcount_max = 1024;
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * document-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(DOC_ATT_SUPP)
+ + strlen(DOC_ATT_VAL) +
+ strlen(PAGE_ATT_VAL) + 6 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s %s", DOC_ATT_SUPP, server,
+ DOC_ATT_VAL, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * job-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(JOB_ATT_SUPP)
+ + strlen(JOB_ATT_VAL) + 4 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * xp-page-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(PAGE_ATT_SUPP)
+ + strlen(PAGE_ATT_VAL) + 4 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * Validate the attribute pools
+ */
+ XpValidateAttributePool( pCon, XPPrinterAttr, &PclValidatePoolsRec );
+
+ /*
+ * Munge the reproducible areas to reflect the fact that PCL will not let
+ * me move the right or left margins closer than .25" to the edge of the
+ * paper.
+ */
+ m = XpGetMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*) NULL,
+ (const XpOidList*) NULL );
+ for( i = 0; i < XpOidMediumSSCount( m ); i++ )
+ {
+ if( XpOidMediumSS_DISCRETE == (m->mss)[i].mstag )
+ {
+ ds_list = (m->mss)[i].ms.discrete;
+ for( j = 0; j < ds_list->count; j++ )
+ {
+ repro = &(ds_list->list)[j].assured_reproduction_area;
+ page_size = (ds_list->list)[j].page_size;
+ XpGetMediumMillimeters( page_size, &width, &height );
+
+ if( repro->minimum_x < 6.35 )
+ repro->minimum_x = 6.35;
+ if( width - repro->maximum_x < 6.35 )
+ repro->maximum_x = width - 6.35;
+ }
+ }
+ }
+ XpPutMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported, m );
+ XpOidMediumSSDelete( m );
+
+ /*
+ * Finish validating the attribute pools
+ */
+
+ XpValidateAttributePool( pCon, XPDocAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPJobAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPPageAttr, &PclValidatePoolsRec );
+
+ /*
+ * Clear out the colormap storage
+ */
+ pConPriv->palettes = NULL;
+
+ return Success;
+}
+
+static Bool
+PclDestroyContext( pCon )
+ XpContextPtr pCon;
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ PclPaletteMapPtr p, t;
+ PclCmapToContexts *pCmap;
+ ScreenPtr screen;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con, prevCon, temp;
+
+
+ /*
+ * Clean up the temporary files
+ */
+ if( pConPriv->pPageFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pPageFile );
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if( pConPriv->pageFileName != (char *)NULL )
+ {
+ unlink( pConPriv->pageFileName );
+ xfree( pConPriv->pageFileName );
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ if( pConPriv->pJobFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pJobFile );
+ pConPriv->pJobFile = NULL;
+ }
+ if( pConPriv->jobFileName != (char *)NULL )
+ {
+ unlink( pConPriv->jobFileName );
+ xfree( pConPriv->jobFileName );
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ xfree( pConPriv->dash );
+ xfree(pConPriv->ctbl);
+ pConPriv->ctbl = NULL;
+#ifdef XP_PCL_LJ3
+ xfree( pConPriv->figures );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Destroy the colormap<->palette mappings
+ */
+ p = pConPriv->palettes;
+ while( p )
+ {
+ t = p;
+ p = p->next;
+ xfree( t );
+ }
+ pConPriv->palettes = NULL;
+
+ /*
+ * Remove the context from the screen-level colormap<->contexts mappings
+ */
+ screen = screenInfo.screens[pCon->screenNum];
+ sPriv = (PclScreenPrivPtr)screen->devPrivates[PclScreenPrivateIndex].ptr;
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ con = pCmap->contexts;
+ prevCon = NULL;
+
+ while( con )
+ {
+ if( con->context->contextID == pCon->contextID )
+ {
+ if( prevCon )
+ {
+ temp = con;
+ prevCon->next = con = con->next;
+ }
+ else
+ {
+ temp = pCmap->contexts;
+ pCmap->contexts = con = con->next;
+ }
+ xfree( temp );
+ }
+ else
+ con = con->next;
+ }
+
+ pCmap = pCmap->next;
+ }
+
+ XpDestroyAttributes(pCon);
+
+ return Success;
+}
+
+XpContextPtr
+PclGetContextFromWindow( win )
+ WindowPtr win;
+{
+ PclWindowPrivPtr pPriv;
+
+ while( win )
+ {
+ pPriv =
+ (PclWindowPrivPtr)win->devPrivates[PclWindowPrivateIndex].ptr;
+ if( pPriv->validContext )
+ return pPriv->context;
+
+ win = win->parent;
+ }
+
+ return NULL;
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclLine.c b/xc/programs/Xserver/Xprint/pcl/PclLine.c
new file mode 100644
index 000000000..aa96c4d72
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclLine.c
@@ -0,0 +1,311 @@
+/* $XConsortium: PclLine.c /main/2 1996/12/30 14:56:54 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclLine.c
+** *
+** * Contents:
+** * Line drawing routines for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclLine.c,v 1.4 1998/03/20 21:04:51 hohndel Exp $ */
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+/*
+ * PclPolyLine()
+ * PclPolySegment()
+ *
+ * Generates PCL code to draw a polyline, or a collection of distinct
+ * line segments, clipped by the current clip region. Since PCL
+ * supports clipping to a rectangle, and the clip region is
+ * represented as a collection of visible rectangles, we can draw and
+ * clip the line by repeatedly drawing the complete line, clipped to
+ * each rectangle in the clip region.
+ *
+ * Since each box in the clipping region generates approximately 30
+ * bytes of PCL code, we have to have a way to avoid having a large
+ * number of boxes. The worst problem the case where the clipping
+ * region is a collection of one-pixel-high boxes, perhaps arising
+ * from a bitmap clip mask, or a region defined by a non-rectangular
+ * polygon.
+ *
+ * To alleviate this problem, we create a second clipping region,
+ * which consists of the union of the bounding boxes of each line
+ * segment. (Each bounding box is also increased by some amount
+ * related to the current line width to allow for non-zero-width
+ * lines, and for the various end and join styles.) This region is
+ * intersected with the "real" clipping region to get the region used
+ * to actually clip the polyline. This should result in a significant
+ * reduction in the number of clip rectangles, as the region-handling
+ * code should consolidate many of the fragments of one-pixel-high
+ * rectangles into larger rectangles.
+ */
+
+void
+PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ int nbox;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = miRegionCreate( NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the "fudge factor" based on the line width.
+ * Multiplying by three seems to be a good first guess.
+ * XXX I need to think of a way to test this.
+ */
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the polyline, by defining it as a
+ * macro which uses the HP-GL/2 line drawing function.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
+ pPoints[0].y + pDrawable->y );
+ SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
+
+ switch( mode )
+ {
+ case CoordModeOrigin:
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ SAVE_PCL( outFile, pConPriv, "PA" );
+ break;
+ case CoordModePrevious:
+ xoffset = yoffset = 0;
+ SAVE_PCL( outFile, pConPriv, "PR" );
+ break;
+ }
+
+ /*
+ * Build the "drawing region" as we build the PCL to draw the
+ * line.
+ */
+ for(i = 1, r = drawRects; i < nPoints; i++, r++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset,
+ pPoints[i].y + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
+ r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
+ r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
+ r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = miRectsToRegion( nPoints - 1, drawRects, CT_UNSORTED );
+ if( mode == CoordModePrevious )
+ miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ xfree( drawRects );
+}
+
+void
+PclPolySegment( pDrawable, pGC, nSegments, pSegments )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nSegments;
+ xSegment *pSegments;
+{
+ FILE *outFile, *dummy;
+ char t[80];
+ int xoffset, yoffset;
+ int nbox, i;
+ unsigned long valid;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ GC cacheGC;
+
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Allocate the storage for the temporary regions.
+ */
+ region = miRegionCreate( NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( nSegments * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the fudge factor, based on the line width
+ */
+ fudge = pGC->lineWidth * 3 + 1;
+
+ /*
+ * Turn off line joining.
+ */
+ SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
+
+ /*
+ * Generate the PCL code to draw the segments, by defining them as
+ * a macro which uses the HP-GL/2 line drawing function.
+ *
+ * XXX I wonder if this should be implemented using the Encoded
+ * XXX Polyline function. Since I'm only sending it once, it's not
+ * XXX necessarily too important.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nSegments; i++, r++ )
+ {
+ r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
+ r->y = MIN( pSegments[i].y1, pSegments[i].y2 ) + yoffset;
+ r->width = abs( pSegments[i].x1 - pSegments[i].x2 );
+ r->height = abs( pSegments[i].y1 - pSegments[i].y2 );
+
+ sprintf( t, "PU%d,%d;PD%d,%d;", pSegments[i].x1 + xoffset,
+ pSegments[i].y1 + yoffset, pSegments[i].x2 +
+ xoffset, pSegments[i].y2 + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x -= fudge;
+ r->y -= fudge;
+ r->width += 2 * fudge;
+ r->height += 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END ( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire set of segments to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Now we need to reset the line join mode to whatever it was at before.
+ * The easiest way is to force the cached GC's joinstyle to be different
+ * from the current GC's joinstyle, then re-update the GC. This way, we
+ * don't have to duplicate code unnecessarily.
+ */
+ PclGetDrawablePrivateStuff( pDrawable, &cacheGC, &valid, &dummy );
+ cacheGC.joinStyle = !cacheGC.joinStyle;
+ PclSetDrawablePrivateGC( pDrawable, cacheGC );
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Clean up
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ xfree( drawRects );
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclMisc.c b/xc/programs/Xserver/Xprint/pcl/PclMisc.c
new file mode 100644
index 000000000..ab669e638
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclMisc.c
@@ -0,0 +1,294 @@
+/* $XConsortium: PclMisc.c /main/3 1996/12/30 14:56:58 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclMisc.c
+** *
+** * Contents:
+** * Miscellaneous code for Pcl driver.
+** *
+** * Created: 2/01/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclMisc.c,v 1.5 1998/12/20 11:57:26 dawes Exp $ */
+
+#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
+#include <stdio.h>
+#include "Pcl.h"
+
+#include "cursor.h"
+#include "resource.h"
+
+#include "windowstr.h"
+#include "propertyst.h"
+
+
+/*ARGSUSED*/
+void
+PclQueryBestSize(
+ int type,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen)
+{
+ unsigned width, highBit;
+
+ switch(type)
+ {
+ case CursorShape:
+ *pwidth = 0;
+ *pheight = 0;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the nearest power of two >= what they gave us */
+ highBit = 0x80000000;
+ /* Find the highest 1 bit in the given width */
+ while(!(highBit & width))
+ highBit >>= 1;
+ /* If greater than that then return the next power of two */
+ if((highBit - 1) & width)
+ highBit <<= 1;
+ *pwidth = highBit;
+ /* height is a don't-care */
+ break;
+ }
+}
+
+/*
+ * GetPropString searches the window heirarchy from pWin up looking for
+ * a property by the name of propName. If found, returns the property's
+ * value. If not, it returns NULL.
+ */
+char *
+GetPropString(
+ WindowPtr pWin,
+ char *propName)
+{
+ Atom atom;
+ PropertyPtr pProp = (PropertyPtr)NULL;
+ char *retVal;
+
+ atom = MakeAtom(propName, strlen(propName), FALSE);
+ if(atom != BAD_RESOURCE)
+ {
+ WindowPtr pPropWin;
+ int n;
+
+ /*
+ * The atom has been defined, but it might only exist as a
+ * property on an unrelated window.
+ */
+ for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
+ pPropWin = pPropWin->parent)
+ {
+ for(pProp = (PropertyPtr)(wUserProps(pPropWin));
+ pProp != (PropertyPtr)NULL;
+ pProp = pProp->next)
+ {
+ if (pProp->propertyName == atom)
+ break;
+ }
+ if(pProp != (PropertyPtr)NULL)
+ break;
+ }
+ if(pProp == (PropertyPtr)NULL)
+ return (char *)NULL;
+
+ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
+ retVal = (char *)xalloc(n + 1);
+ (void)memcpy((void *)retVal, (void *)pProp->data, n);
+ retVal[n] = '\0';
+
+ return retVal;
+ }
+
+ return (char *)NULL;
+}
+
+#include <signal.h>
+
+/* ARGSUSED */
+static void SigchldHndlr (
+ int dummy)
+{
+ int status, w;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ w = wait (&status);
+
+ /*
+ * Is this really necessary?
+ */
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+}
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+ /*
+ * get the old handler, and set the action to IGN
+ */
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+
+
+/*
+ * PclGetMediumDimensions is installed in the GetMediumDimensions field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * PclGetReproducibleArea is installed in the GetReproducibleArea field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
+
+#ifdef XP_PCL_LJ3
+/*
+ * PclSpoolFigs spooled the rendering PCL/HP-GL2 commands into the
+ * temporary buffer pointed by figures pointer in pcl private context.
+ * LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.
+ */
+void
+PclSpoolFigs(PclContextPrivPtr pConPriv, char *t, int n)
+{
+char *ptr;
+
+ ptr = pConPriv->figures;
+ while ( ( pConPriv->fcount + n) > pConPriv->fcount_max ) {
+ ptr = (char *)xrealloc(ptr, 1024 + pConPriv->fcount_max);
+ if ( !ptr )
+ return;
+ pConPriv->figures = ptr;
+ pConPriv->fcount_max += 1024;
+ }
+ ptr += pConPriv->fcount;
+ pConPriv->fcount += n;
+ memcpy(ptr, t, n);
+}
+#endif /* XP_PCL_LJ3 */
+
+/*
+ * PclSendData:
+ * For XP-PCL-COLOR/XP-PCL-MONO, it executes the macro stored before
+ * in the clipped area.
+ * For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
+ */
+PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio
+)
+{
+char *ptr;
+int n;
+char t[80];
+
+#ifdef XP_PCL_LJ3
+ ptr = pConPriv->figures;
+ n = pConPriv->fcount;
+#else
+ ptr = "\033&f3X";
+ n = 5;
+#endif /* XP_PCL_LJ3 */
+
+ while( nbox )
+ {
+ /*
+ * Set the HP-GL/2 input window to the current
+ * rectangle in the clip region, then send the code to
+ * execute the macro defined above.
+ */
+ if (ratio == 1.0)
+ sprintf( t, "\033%%0BIW%d,%d,%d,%d;\033%%0A",
+ pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ else
+ sprintf( t, "\033%%0BIW%g,%d,%g,%d;\033%%0A",
+ ratio * pbox->x1, pbox->y1,
+ ratio * pbox->x2, pbox->y2 );
+
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, ptr, n);
+
+ nbox--;
+ pbox++;
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclPixel.c b/xc/programs/Xserver/Xprint/pcl/PclPixel.c
new file mode 100644
index 000000000..a9206308b
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclPixel.c
@@ -0,0 +1,154 @@
+/* $XConsortium: PclPixel.c /main/1 1996/09/28 17:01:49 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPixel.c
+** *
+** * Contents:
+** * Pixel-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include <stdio.h>
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+void
+PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+{
+ char t[80], *command;
+ FILE *outFile;
+ int xoffset, yoffset;
+ BoxRec box;
+ int xloc, yloc, i;
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ PclPixmapPrivPtr pPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ /*
+ * Enter HP-GL/2 and change the line style to one in which only
+ * the vertices of the specified polyline are drawn. We must also
+ * temporarily change the line width so that only a single pixel
+ * is drawn. Then move to the first possible location.
+ */
+ xloc = pPoints[0].x + pDrawable->x;
+ yloc = pPoints[0].y + pDrawable->y;
+
+ sprintf( t, "\27%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Check each point against the clip region. If it is outside the
+ * region, don't send the PCL to the printer.
+ */
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ if( miPointInRegion( pGC->clientClip, xloc, yloc, &box ) )
+ {
+ sprintf( t, ",%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+ }
+
+ if( mode == CoordModeOrigin )
+ {
+ xloc = pPoints[i+1].x + xoffset;
+ yloc = pPoints[i+1].y + yoffset;
+ }
+ else
+ {
+ xloc += pPoints[i+1].x;
+ yloc += pPoints[i+1].y;
+ }
+ }
+
+ /*
+ * Change the line style and width back to what they were before
+ * this routine was called. No, this isn't pretty...
+ */
+ if( pDrawable->type == DRAWABLE_WINDOW )
+ {
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+/*
+ cPriv->changeMask = GCLineWidth | GCLineStyle;
+*/
+ }
+ else
+ {
+ pPriv =
+ ((PixmapPtr)pDrawable)->devPrivates[PclPixmapPrivateIndex].ptr;
+/*
+ pPriv->changeMask = GCLineWidth | GCLineStyle;
+*/
+ }
+
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Go back to PCL
+ */
+ SEND_PCL( outFile, "\27%0A" );
+}
+
+void
+PclPushPixels( pGC, pBitmap, pDrawable, width, height, x, y )
+ GCPtr pGC;
+ PixmapPtr pBitmap;
+ DrawablePtr pDrawable;
+ int width;
+ int height;
+ int x;
+ int y;
+{
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclPixmap.c b/xc/programs/Xserver/Xprint/pcl/PclPixmap.c
new file mode 100644
index 000000000..2871c5c65
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclPixmap.c
@@ -0,0 +1,80 @@
+/* $XConsortium: PclPixmap.c /main/1 1996/09/28 17:01:58 rws $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPixmap.c
+** *
+** * Contents:
+** * Pixmap handling code for the PCL DDX driver
+** *
+** * Created: 2/19/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#include "Pcl.h"
+/*#include "cfb.h"*/
+/* #include "mfb.h" */
+#include "pixmapstr.h"
+
+PixmapPtr
+PclCreatePixmap(ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth)
+{
+extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap();
+
+ if( depth == 1 )
+ return mfbCreatePixmap( pScreen, width, height, depth );
+ else if( depth <= 8 )
+ return cfbCreatePixmap( pScreen, width, height, depth );
+ else if( depth <= 32 )
+ return cfb32CreatePixmap( pScreen, width, height, depth );
+}
+
+
+Bool
+PclDestroyPixmap(PixmapPtr pPixmap)
+{
+extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap();
+ if( pPixmap->drawable.depth == 1 )
+ return mfbDestroyPixmap( pPixmap );
+ else if( pPixmap->drawable.depth <= 8 )
+ return cfbDestroyPixmap( pPixmap );
+ else if( pPixmap->drawable.depth <= 32 )
+ return cfb32DestroyPixmap( pPixmap );
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclPolygon.c b/xc/programs/Xserver/Xprint/pcl/PclPolygon.c
new file mode 100644
index 000000000..1dcfed241
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclPolygon.c
@@ -0,0 +1,348 @@
+/* $XConsortium: PclPolygon.c /main/2 1996/12/30 14:57:02 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPolygon.c
+** *
+** * Contents:
+** * Draws Polygons and Rectangles for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.4 1998/03/20 21:04:51 hohndel Exp $ */
+
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclPolyRectangle( pDrawable, pGC, nRects, pRects )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nRects;
+ xRectangle *pRects;
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = miRegionCreate( NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the rectangles, by defining them
+ * as a macro which uses the HP-GL/2 rectangle drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
+ rect.y + yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset -
+ fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
+
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ xfree( drawRects );
+}
+
+void
+PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int shape;
+ int mode;
+ int nPoints;
+ DDXPointPtr pPoints;
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec box;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ int xtop, xbottom, yleft, yright;
+ int fillRule;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ char *command;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Generate the PCL code to draw the filled polygon, by defining
+ * it as a macro which uses the HP-GL/2 polygon drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ if( mode == CoordModeOrigin )
+ {
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ command = "PA";
+ }
+ else
+ {
+ xoffset = yoffset = 0;
+ command = "PR";
+ }
+
+ /* Begin the polygon */
+ sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ + yoffset, command );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Seed the bounding box */
+ xtop = xbottom = pPoints[0].x + xoffset;
+ yleft = yright = pPoints[0].y + yoffset;
+
+ /* Add the rest of the points to the polygon */
+ for( i = 1; i < nPoints; i++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
+ yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Update the bounding box */
+ xtop = MIN( xtop, pPoints[i].x + xoffset );
+ xbottom = MAX( xbottom, pPoints[i].x + xoffset );
+ yleft = MIN( yleft, pPoints[i].y + yoffset );
+ yright = MAX( yright, pPoints[i].y + yoffset );
+ }
+
+ /* Close the polygon and the macro */
+
+ if( pGC->fillRule == EvenOddRule )
+ fillRule = 0;
+ else
+ fillRule = 1;
+
+ sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END ( outFile );
+
+ /*
+ * Build the bounding region from the bounding box of the polygon
+ */
+ box.x1 = xtop;
+ box.y1 = yleft;
+ box.x2 = xbottom;
+ box.y2 = yright;
+ drawRegion = miRegionCreate( &box, 0 );
+
+ if( mode == CoordModePrevious )
+ miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
+
+ region = miRegionCreate( NULL, 0 );
+
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the polygon to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+}
+
+void
+PclPolyFillRect( pDrawable, pGC, nRects, pRects )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nRects;
+ xRectangle *pRects;
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = miRegionCreate( NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the filled rectangles, by
+ * defining them as a macro which uses the HP-GL/2 rectangle
+ * drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
+ yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+ xfree( drawRects );
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclPrint.c b/xc/programs/Xserver/Xprint/pcl/PclPrint.c
new file mode 100644
index 000000000..f5fdd455c
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclPrint.c
@@ -0,0 +1,719 @@
+/* $XConsortium: PclPrint.c /main/4 1996/12/30 16:37:15 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPrint.c
+** *
+** * Contents: Print extension code of Pcl driver
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPrint.c,v 1.4 1996/12/31 07:06:01 dawes Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <X11/Xprotostr.h>
+
+#define NEED_EVENTS
+#include "Xproto.h"
+#undef NEED_EVENTS
+
+#include "Pcl.h"
+
+#include "windowstr.h"
+#include "attributes.h"
+#include "AttrValid.h"
+#include "Oid.h"
+
+extern PclSoftFontInfoPtr PclCreateSoftFontInfo();
+extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr);
+
+int
+PclStartJob( pCon, sendClientData, client )
+ XpContextPtr pCon;
+ Bool sendClientData;
+ ClientPtr client;
+
+{
+ PclContextPrivPtr pConPriv =
+ (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
+ char *jobHeader;
+ char s[40];
+ PclPaletteMap *pal;
+
+ /*
+ * Check for existing page file, and delete it if it exists.
+ */
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ unlink(pConPriv->pageFileName);
+ xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+
+ /*
+ * Create/Initialize the SoftFontInfo structure
+ */
+ pConPriv->pSoftFontInfo = PclCreateSoftFontInfo();
+
+ /*
+ * Set up the colormap handling
+ */
+ pConPriv->palettes = NULL;
+ pConPriv->nextPaletteId = 4;
+ pConPriv->currentPalette = 0;
+
+ pal = &( pConPriv->staticGrayPalette );
+ pal->paletteId = 1;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->trueColorPalette );
+ pal->paletteId = 2;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->specialTrueColorPalette );
+ pal->paletteId = 3;
+ pal->downloaded = 0;
+
+ return Success;
+}
+
+int
+PclEndJob( pCon, cancel )
+ XpContextPtr pCon;
+ Bool cancel;
+{
+ PclContextPrivPtr priv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+#ifdef CCP_DEBUG
+ FILE *xpoutput;
+#endif
+ FILE *fp;
+ int retVal;
+ char *fileName, *trailer;
+ struct stat statBuf;
+ int n;
+ PclPaletteMapPtr p, t;
+
+ trailer = "\033%-12345X@PJL RESET\n";
+
+ if( cancel == True )
+ {
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient == NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return Success;
+ }
+
+ if( priv->getDocClient != (ClientPtr)NULL && priv->getDocBufSize > 0 )
+ {
+ /*
+ * We need to stash the trailer information somewhere...
+ */
+ if (!XpOpenTmpFile("w+", &fileName, &fp))
+ return BadAlloc;
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( fp, trailer );
+ rewind( fp );
+
+ retVal = XpSendDocumentData( priv->getDocClient, fp,
+ strlen( trailer ),
+ priv->getDocBufSize );
+#endif /* XP_PCL_LJ3 */
+
+ fclose( fp );
+ unlink( fileName );
+ xfree( fileName );
+
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient == NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return retVal;
+ }
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( priv->pJobFile, trailer );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Submit the job to the spooler
+ */
+ fflush( priv->pJobFile );
+
+ /*
+ * Dump the job file to another output file, for testing
+ * purposes.
+ */
+ rewind( priv->pJobFile );
+ n = stat( priv->jobFileName, &statBuf );
+
+#ifdef CCP_DEBUG
+ unlink( "/users/prince/XpOutput" );
+ xpoutput = fopen( "/users/prince/XpOutput", "w" );
+
+ rewind( priv->pJobFile );
+ n = TransferBytes( priv->pJobFile, xpoutput,
+ (int)statBuf.st_size );
+ fclose( xpoutput );
+#endif
+
+ XpSubmitJob( priv->jobFileName, pCon );
+ fclose( priv->pJobFile );
+ unlink( priv->jobFileName );
+ xfree( priv->jobFileName );
+ priv->jobFileName = NULL;
+
+ PclDestroySoftFontInfo(priv->pSoftFontInfo);
+ priv->pSoftFontInfo = (PclSoftFontInfoPtr) NULL;
+
+ /*
+ * Clear out the colormap cache
+ */
+ p = priv->palettes;
+ while( p )
+ {
+ p->downloaded = 0;
+ p = p->next;
+ }
+
+ return Success;
+}
+
+/* StartPage
+ *
+ * If page file exists
+ * close page file
+ * set page file pointer = NULL
+ * unlink page file
+ * Create a new page file
+ * Send the page header information to the page file
+ * ClearArea the window and all descendant windows
+ */
+int
+PclStartPage( pCon, pWin )
+ XpContextPtr pCon;
+ WindowPtr pWin;
+{
+ register WindowPtr pChild;
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ PclWindowPrivPtr pWinPriv =
+ (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
+ xRectangle repro;
+ char t[80];
+ XpOid orient, plex, tray, medium;
+ unsigned short wid, ht;
+ int dir, plexNum, num;
+ xEvent event;
+
+ /*
+ * Put a pointer to the context in the window private structure
+ */
+ pWinPriv->validContext = 1;
+ pWinPriv->context = pCon;
+
+ /*
+ * Clear out the old page file, if necessary
+ */
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Make up a new page file.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->pageFileName, &pConPriv->pPageFile))
+ return BadAlloc;
+
+ /*
+ * Reset the GC cached in the context private struct.
+ */
+ pConPriv->validGC = 0;
+
+ /*
+ * Set the page orientation
+ */
+ orient = XpGetContentOrientation( pCon );
+ switch( orient )
+ {
+ case xpoid_val_content_orientation_landscape:
+ dir = 1;
+ break;
+ case xpoid_val_content_orientation_reverse_portrait:
+ dir = 2;
+ break;
+ case xpoid_val_content_orientation_reverse_landscape:
+ dir = 3;
+ break;
+ case xpoid_val_content_orientation_portrait:
+ default:
+ dir = 0;
+ break;
+ }
+ sprintf( t, "\033&l%dO", dir );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the duplexing method. Since PCL wants to think of it in
+ * terms of the "binding edge," and the attribute store thinks in
+ * "duplex/tumble," this is a little complicated.
+ *
+ * Actually, this has no bearing on the output, since the HP1600C
+ * will only print on one side of the paper, and ignore all
+ * requests to enable duplexing. But, in an attempt to keep this
+ * driver somewhat generic, we'll enable it anyway.
+ */
+ plex = XpGetPlex( pCon );
+
+ if( plex == xpoid_val_plex_duplex )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 1;
+ else
+ plexNum = 2;
+ }
+ else if( plex == xpoid_val_plex_tumble )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 2;
+ else
+ plexNum = 1;
+ }
+ else
+ plexNum = 0;
+ sprintf( t, "\033&l%dS", plexNum );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the input tray or medium. If XpGetPageSize gives us a valid medium,
+ * we can just send that to the printer, and let the printer handle the
+ * details. Otherwise, we select the tray returned from XpGetPageSize,
+ * which will be either a tray that should contain the correct medium
+ * (possibly with operator intervention), or the default tray from the
+ * config files.
+ */
+ medium = XpGetPageSize( pCon, &tray, NULL );
+ if( medium != xpoid_none )
+ {
+ switch( medium )
+ {
+ case xpoid_val_medium_size_na_legal:
+ num = 3;
+ break;
+ case xpoid_val_medium_size_iso_a3:
+ num = 27;
+ break;
+ case xpoid_val_medium_size_iso_a4:
+ num = 26;
+ break;
+ case xpoid_val_medium_size_executive:
+ num = 1;
+ break;
+ case xpoid_val_medium_size_ledger:
+ num = 6;
+ break;
+ case xpoid_val_medium_size_monarch_envelope:
+ num = 80;
+ break;
+ case xpoid_val_medium_size_na_number_10_envelope:
+ num = 81;
+ break;
+ case xpoid_val_medium_size_iso_designated_long:
+ num = 90;
+ break;
+ case xpoid_val_medium_size_iso_c5:
+ num = 91;
+ break;
+ case xpoid_val_medium_size_iso_b5:
+ num = 100;
+ break;
+ case xpoid_val_medium_size_jis_b5:
+ num = 45;
+ break;
+ case xpoid_val_medium_size_na_letter:
+ default:
+ num = 2;
+ break;
+ }
+ sprintf( t, "\033&l%dA", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+ else
+ {
+ switch( tray )
+ {
+ case xpoid_val_input_tray_manual:
+ num = 2;
+ break;
+ case xpoid_val_input_tray_envelope:
+ num = 3;
+ break;
+ case xpoid_val_input_tray_large_capacity:
+ num = 5;
+ break;
+ case xpoid_val_input_tray_bottom:
+ num = 4;
+ break;
+ case xpoid_val_input_tray_main:
+ default:
+ num = 1;
+ break;
+ }
+ sprintf( t, "\033&l%dH", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+
+ /*
+ * Set the scaling factors so that the HP-GL/2 coordinate system
+ * matches the X coordinate system, both in axis orientation and
+ * in unit<->pixel conversion.
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T", (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ return Success;
+}
+
+/*
+ * When sending the generated PCL code back to the client, we send everything
+ * that we have generated so far for the job. After sending the data, we clean
+ * out the job file, to avoid repeatedly sending the same data.
+ */
+
+static int
+SendDocData( PclContextPrivPtr pPriv )
+{
+ struct stat statBuf;
+ int ret;
+
+ rewind( pPriv->pJobFile );
+ if( stat( pPriv->jobFileName, &statBuf ) < 0 )
+ return BadAlloc;
+
+ ret = XpSendDocumentData( pPriv->getDocClient, pPriv->pJobFile,
+ (int)statBuf.st_size, pPriv->getDocBufSize );
+
+ /*
+ * Clean out the job file
+ */
+ fclose( pPriv->pJobFile );
+ unlink( pPriv->jobFileName );
+
+ xfree(pPriv->jobFileName);
+
+ if (!XpOpenTmpFile("w+", &pPriv->jobFileName, &pPriv->pJobFile))
+ return BadAlloc;
+
+ return ret;
+}
+
+/*
+ * EndPage:
+ *
+ * Write page trailer to page file
+ * Write page file to job file
+ */
+int
+PclEndPage( pCon, pWin )
+ XpContextPtr pCon;
+ WindowPtr pWin;
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ PclWindowPrivPtr pWinPriv =
+ (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
+
+ struct stat statBuf;
+
+ /*
+ * Send the page trailer to the page file.
+ */
+ SEND_PCL( pConPriv->pPageFile, "\014" );
+ fflush( pConPriv->pPageFile );
+
+ /*
+ * Write the page file contents to the job file, or to the
+ * whatever client has called GetDocumentData.
+ *
+ * pWinPriv->pPageFile must first be set to the start of the page file.
+ */
+ rewind(pConPriv->pPageFile);
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ return BadAlloc;
+
+ if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ return BadAlloc;
+
+ if( pConPriv->getDocClient != (ClientPtr)NULL &&
+ pConPriv->getDocBufSize > 0 )
+ {
+ return SendDocData( pConPriv );
+ }
+
+ return Success;
+}
+
+/*
+ * The PclStartDoc() and PclEndDoc() functions serve basically as NOOP
+ * placeholders. This driver doesn't deal with the notion of multiple
+ * documents per page.
+ */
+
+int
+PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+#ifndef XP_PCL_LJ3
+ /*
+ * Set the printer resolution for the page. Since we can only
+ * render color at 300dpi, we just hard-code this.
+ */
+ SEND_PCL( pConPriv->pJobFile,
+ "\033%-12345X@PJL SET RESOLUTION = 300\r\n" );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Initialize HP-GL/2
+ */
+ SEND_PCL( pConPriv->pJobFile, "\033E\033%0BIN,SP1,TR0;\033%0A" );
+
+ /*
+ * Stash the type of the document (used by PutDocumentData operation)
+ */
+ pConPriv->isRaw = (type == XPDocRaw);
+
+ return Success;
+}
+
+int
+PclEndDoc( pCon, cancel )
+ XpContextPtr pCon;
+ Bool cancel;
+{
+ /*
+ * XXX What should I do if I get cancel == TRUE?
+ */
+ return Success;
+}
+
+/*
+ * PclDocumentData()
+ *
+ * Hand any pre-generated PDL down to the spool files, formatting it
+ * as necessary to fit the given window.
+ *
+ */
+
+#define DOC_PCL 1
+#define DOC_HPGL 2
+
+int
+PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client)
+ XpContextPtr pCon;
+ DrawablePtr pDraw;
+ char *pData;
+ int len_data;
+ char *pFmt;
+ int len_fmt;
+ char *pOpt;
+ int len_opt;
+ ClientPtr client;
+{
+ int type;
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ XpOidDocFmtList *formats;
+ XpOidDocFmt *f;
+ char t[80];
+ xRectangle repro;
+
+ /*
+ * Verify the input format
+ */
+ formats = XpGetDocFmtListAttr( pCon, XPPrinterAttr,
+ (pPriv->isRaw) ?
+ xpoid_att_xp_raw_formats_supported :
+ xpoid_att_xp_embedded_formats_supported,
+ NULL );
+ f = XpOidDocFmtNew( pFmt );
+ if( !XpOidDocFmtListHasFmt( formats, f ) )
+ {
+ XpOidDocFmtListDelete( formats );
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+ XpOidDocFmtListDelete( formats );
+
+ if( !(pPriv->isRaw) )
+ {
+ if( !strcmp( f->format, "PCL" ) )
+ type = DOC_PCL;
+ else if( !strcmp( f->format, "HPGL" ) )
+ type = DOC_HPGL;
+ else
+ {
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Move the picture frame to the appropriate place on the page,
+ * then assume that the embedded code will scale it properly.
+ */
+ sprintf( t, "\033&l0E\033*p%dx%dY",
+ pDraw->x - 75,
+ pDraw->y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*coT",
+ (int)( pDraw->width / 300.0 * 720.0 ),
+ (int)( pDraw->height / 300.0 * 720.0 ) );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+ }
+
+
+ /*
+ * Send the data down the pipe
+ */
+ SEND_PCL_COUNT( pPriv->pPageFile, pData, len_data );
+
+ /*
+ * If it's not a raw document, clean up the embedding
+ */
+ if( !(pPriv->isRaw) )
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Reset the picture frame
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T",
+ (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+
+ XpOidDocFmtDelete( f );
+ return Success;
+}
+
+/*
+ *
+ * PclGetDocumentData()
+ *
+ * This function allows the driver to send the generated PCL back to
+ * the client.
+ *
+ * XXX This function is barely spec'ed, much less implemented!
+ */
+
+int
+PclGetDocumentData( pCon, client, maxBufferSize )
+ XpContextPtr pCon;
+ ClientPtr client;
+ int maxBufferSize;
+{
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+
+ pPriv->getDocClient = client;
+ pPriv->getDocBufSize = maxBufferSize;
+
+ return Success;
+}
diff --git a/xc/programs/Xserver/Xprint/pcl/PclSFonts.c b/xc/programs/Xserver/Xprint/pcl/PclSFonts.c
new file mode 100644
index 000000000..991b40016
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclSFonts.c
@@ -0,0 +1,432 @@
+/* $XConsortium: PclSFonts.c /main/2 1996/12/30 14:57:11 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSFonts.c
+** *
+** * Contents:
+** * Send Soft Font Download data to the specified
+** * file pointer.
+** *
+** * Created: 3/4/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.3 1996/12/31 07:06:02 dawes Exp $ */
+
+
+#include <stdio.h>
+#include "Pcl.h"
+
+static char tmp1;
+static short tmp2;
+#define Put1byte(fp, x) tmp1=x; fwrite((char *)&tmp1, 1, 1, fp)
+#define Put2bytes(fp, x) tmp2=x; fwrite((char *)&tmp2, 2, 1, fp)
+
+#define ESC 0x1b
+#define SYMBOL_SET 277
+#define MAX_CINDEX 255
+
+static unsigned int PclDownloadChar(FILE *,PclCharDataPtr,unsigned short,unsigned char);
+static unsigned int PclDownloadHeader(FILE *, PclFontDescPtr, unsigned short);
+
+#ifdef PCL_FONT_COMPRESS
+static unsigned char *compress_bitmap_data(PclCharDataPtr, unsigned int *);
+#endif /* PCL_FONT_COMPRESS */
+
+/* -*- PclDownloadSoftFont8 -*-
+ * Send the Character Definition Command for 8-bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code,
+ int flag
+)
+{
+ /*
+ * Check whether the font header has already been downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->fid ) {
+ pfh->fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->fid);
+ }
+ pfh->index[*code] = *code;
+ PclDownloadChar(fp, pcd, pfh->fid, pfh->index[*code]);
+
+}
+
+/* -*- PclDownloadSoftFont16 -*-
+ * Send the Character Definition Command for 16 bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col,
+ int flag
+)
+{
+ /*
+ * Check whether the font header is already downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->cur_cindex ) {
+ pfh->cur_fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->cur_fid);
+ }
+ pfh->index[row][col].fid = pfh->cur_fid;
+ pfh->index[row][col].cindex = pfh->cur_cindex++;
+ if ( pfh->cur_cindex > MAX_CINDEX )
+ pfh->cur_cindex = 0;
+
+ PclDownloadChar(fp, pcd, pfh->index[row][col].fid, pfh->index[row][col].cindex);
+}
+
+/* -*- PclCreateSoftFontInfo -*-
+ * Create and Initialize the structure for storing the information
+ * of the downloaded soft font.
+ * **************************************************************************/
+PclSoftFontInfoPtr
+PclCreateSoftFontInfo(
+)
+{
+PclSoftFontInfoPtr pSoftFontInfo;
+
+ pSoftFontInfo = (PclSoftFontInfoPtr)xalloc(sizeof(PclSoftFontInfoRec));
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclSoftFontInfoPtr) NULL;
+ pSoftFontInfo->phead8 = (PclFontHead8Ptr)NULL;
+ pSoftFontInfo->phead16 = (PclFontHead16Ptr)NULL;
+ pSoftFontInfo->pinfont = (PclInternalFontPtr)NULL;
+ pSoftFontInfo->cur_max_fid = 1;
+ return pSoftFontInfo;
+}
+
+/* -*- PclDestroySoftFontInfo -*-
+ * Destroy the soft font information structure
+ * **************************************************************************/
+void
+PclDestroySoftFontInfo( PclSoftFontInfoPtr pSoftFontInfo )
+{
+PclFontHead8Ptr pfh8, pfh8_next;
+PclFontHead16Ptr pfh16, pfh16_next;
+PclInternalFontPtr pin, pin_next;
+unsigned char nindex_row, nindex_col;
+int i, j;
+
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
+ return;
+
+ pfh8 = pSoftFontInfo->phead8;
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ xfree(pfh8->fontname);
+ xfree(pfh8->index);
+ pfh8_next = pfh8->next;
+ xfree(pfh8);
+ pfh8 = pfh8_next;
+ }
+
+ pfh16 = pSoftFontInfo->phead16;
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ xfree(pfh16->fontname);
+ nindex_col = pfh16->lastCol - pfh16->firstCol + 1;
+ nindex_row = pfh16->lastRow - pfh16->firstRow + 1;
+ for (i=0; i<nindex_row; i++)
+ xfree(pfh16->index[i]);
+ xfree(pfh16->index);
+ pfh16_next = pfh16->next;
+ xfree(pfh16);
+ pfh16 = pfh16_next;
+ }
+
+ pin = pSoftFontInfo->pinfont;
+ while (pin != (PclInternalFontPtr) NULL) {
+ xfree(pin->fontname);
+ pin_next = pin->next;
+ xfree(pin);
+ pin = pin_next;
+ }
+
+ xfree(pSoftFontInfo);
+}
+
+/* -*- PclDownloadHeader -*-
+ * Send the Font Header Commnad.
+ * Format 0 : Font Header for Pcl Bitmapped Fonts
+ * Format 20 : Font Header for Resolution Specified Bitmapped Fonts
+ * **************************************************************************/
+static unsigned int
+PclDownloadHeader(
+ FILE *fp,
+ PclFontDescPtr fd,
+ unsigned short fid
+)
+{
+int nbytes;
+
+#ifdef XP_PCL_LJ3
+ nbytes = 64;
+#else
+ nbytes = 68;
+#endif /* XP_PCL_LJ3 */
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c*c%dD", ESC, fid);
+
+ /*
+ * Font Header Commnad : Esc )s#W[font header data]
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c)s%dW", ESC, nbytes);
+
+ Put2bytes(fp, nbytes); /* Font Description Size */
+#ifdef XP_PCL_LJ3
+ Put1byte(fp, 0); /* Header Format */
+#else
+ Put1byte(fp, 20); /* Header Format */
+#endif /* XP_PCL_LJ3 */
+ Put1byte(fp, 2); /* Font Type */
+ Put2bytes(fp, 0); /* Style MSB */
+ Put2bytes(fp, fd->ascent); /* BaseLine Position */
+ Put2bytes(fp, fd->cellwidth); /* Cell Width */
+ Put2bytes(fp, fd->cellheight); /* Cell Height */
+ Put1byte(fp, 0); /* Orienation */
+ Put1byte(fp, fd->spacing); /* Spacing */
+ Put2bytes(fp, SYMBOL_SET); /* Symbol Set */
+ Put2bytes(fp, fd->pitch*4); /* font pitch */
+ Put2bytes(fp, fd->cellheight * 4); /* Height */
+ Put2bytes(fp, 0); /* x-Height */
+ Put1byte(fp, 0); /* width type (normal) */
+ Put1byte(fp, 0); /* Style LSB */
+ Put1byte(fp, 0); /* Stroke Weight */
+ Put1byte(fp, 5); /* Typeface LSB */
+ Put1byte(fp, 0); /* Typeface MSB */
+ Put1byte(fp, 0); /* Serif Style */
+ Put1byte(fp, 0); /* Quality */
+ Put1byte(fp, 0); /* Placement */
+ Put1byte(fp, 0); /* Underline Position */
+ Put1byte(fp, 0); /* Underline Thickness */
+ Put2bytes(fp, fd->cellheight*1.2); /* Text Height */
+ Put2bytes(fp, fd->cellwidth * 4); /* Text Width */
+ Put2bytes(fp, 0); /* First Code */
+ Put2bytes(fp, 255); /* Last Code */
+ Put1byte(fp, 0); /* Pitch Extend */
+ Put1byte(fp, 0); /* Height Extend */
+ Put2bytes(fp, 0); /* Cap Height */
+ Put2bytes(fp, 0); /* Font Number 1 */
+ Put2bytes(fp, 0); /* Font Number 2 */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+
+#ifdef XP_PCL_LJ3
+ return 64;
+#else
+ Put2bytes(fp, 300); /* X Resolution */
+ Put2bytes(fp, 300); /* Y Resolution */
+ return 68;
+#endif /* XP_PCL_LJ3 */
+
+}
+
+/* -*- PclDownloadCharacter -*-
+ * Send the Character Definition Command.
+ * **************************************************************************/
+static unsigned int
+PclDownloadChar(
+ FILE *fp,
+ PclCharDataPtr cd,
+ unsigned short fid,
+ unsigned char code
+)
+{
+unsigned int nbytes, n;
+unsigned char *raster;
+
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ * Character Code Command : Esc *c#E
+ * (Default = 0, Range = 0 - 65535)
+ */
+ fprintf(fp, "%c*c%dd%dE", ESC, fid, code);
+
+ /*
+ * Character Definition Command : Esc (s#W[character descriptor and data]
+ * (Default = N/A, Range = 0 - 32767)
+ */
+
+ nbytes = n = cd->height * ((cd->width + 7) / 8);
+#ifdef PCL_FONT_COMPRESS
+ raster = compress_bitmap_data(cd, &nbytes);
+#else
+ raster = (unsigned char *)NULL;
+#endif /* PCL_FONT_COMPRESS */
+ fprintf(fp, "%c(s%dW", ESC, nbytes + 16);
+
+ Put1byte(fp, 4); /* Format */
+ Put1byte(fp, 0); /* Continuation */
+ Put1byte(fp, 14); /* Descriptor Size */
+ if (raster) { /* Class */
+ Put1byte(fp, 2);
+ } else {
+ Put1byte(fp, 1); /* Class */
+ }
+ Put2bytes(fp, 0); /* Orientation */
+ Put2bytes(fp, cd->h_offset); /* left offset */
+ Put2bytes(fp, cd->v_offset); /* top offset */
+ Put2bytes(fp, cd->width); /* character width */
+ Put2bytes(fp, cd->height); /* character height */
+ Put2bytes(fp, cd->font_pitch*4); /* delta X */
+
+ /*
+ * Raster Character Data
+ */
+ if (raster) {
+ fwrite(raster, nbytes, 1, fp);
+ xfree(raster);
+ } else
+ fwrite(cd->raster_top, nbytes, 1, fp);
+
+ return n + 16;
+}
+
+
+#ifdef PCL_FONT_COMPRESS
+/* -*- compress_bitmap_data -*-
+ * Compress Bitmap data
+ * **************************************************************************/
+static unsigned char *
+compress_bitmap_data(
+ PclCharDataPtr cd,
+ unsigned int *nbytes
+)
+{
+unsigned int byte_width;
+unsigned char *raster, *rptr_s, *rptr_e, *rptr_end;
+unsigned char *tmp_s, *tmp_ptr;
+unsigned char *p;
+unsigned char cur, pixel;
+unsigned int num;
+
+int i, j, k, w;
+
+ byte_width = (cd->width + 7) / 8;
+ *nbytes = cd->height * byte_width;
+
+ /* Create buffer for storing compress bitmap glyph */
+ raster = (unsigned char *)xalloc(*nbytes);
+ rptr_s = raster;
+ rptr_e = raster;
+ rptr_end = raster + *nbytes;
+
+ tmp_s = (unsigned char *)xalloc(cd->width * 8 + 2);
+
+ p = cd->raster_top;
+ for (i=0; i<cd->height; i++) {
+ tmp_ptr = tmp_s;
+ *tmp_ptr++ = 0;
+ if ( (*p>>7)&0x1 == 1 ) {
+ *tmp_ptr++ = 0;
+ cur = 1;
+ } else {
+ cur = 0;
+ }
+ num = 0;
+ for (j=0, w=0; j<byte_width; j++, p++) {
+ for (k=0; k<8 && w<cd->width; k++, w++) {
+ pixel = (*p>>(7-k))&0x1;
+ if ( pixel == cur ) {
+ num++;
+ } else {
+ cur = pixel;
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num;
+ num = 1;
+ }
+ }
+ }
+ if ( pixel == cur ) {
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num&0xff;
+ } else
+ *tmp_ptr++ = num;
+
+ if ( ((rptr_e - rptr_s) == (tmp_ptr - tmp_s)) &&
+ !memcmp(rptr_s+1, tmp_s+1, (tmp_ptr - tmp_s) - 1) )
+ *rptr_s += 1;
+ else {
+ if ( rptr_e + (tmp_ptr - tmp_s) > rptr_end ) {
+ xfree(raster);
+ xfree(tmp_s);
+ return (unsigned char *)NULL;
+ }
+ memcpy (rptr_e, tmp_s, tmp_ptr - tmp_s);
+ rptr_s = rptr_e;
+ rptr_e = rptr_s + (tmp_ptr - tmp_s);
+ }
+ }
+ xfree(tmp_s);
+ *nbytes = rptr_e - raster;
+
+ return raster;
+}
+#endif /* PCL_FONT_COMPRESS */
diff --git a/xc/programs/Xserver/Xprint/pcl/PclSFonts.h b/xc/programs/Xserver/Xprint/pcl/PclSFonts.h
new file mode 100644
index 000000000..6708d038c
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclSFonts.h
@@ -0,0 +1,112 @@
+/* $XConsortium: PclSFonts.h /main/1 1996/09/28 17:02:39 rws $ */
+#ifndef _PCLFONTS_H
+#define _PCLFONTS_H
+
+/* -*-H-*-
+******************************************************************************
+******************************************************************************
+*
+* File: PclFonts.h
+* Description: Send Soft Font Download data to the specified file pointer.
+*
+*
+******************************************************************************
+******************************************************************************
+*/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+typedef struct {
+ unsigned char fid; /* sfont font ID */
+ unsigned char cindex; /* character indext */
+} PclFontMapRec, PclFontMapPtr;
+
+typedef struct {
+ int h_offset;
+ int v_offset;
+ unsigned int width;
+ unsigned int height;
+ int font_pitch;
+ unsigned char *raster_top;
+} PclCharDataRec, *PclCharDataPtr;
+
+typedef struct {
+ unsigned char spacing;
+ unsigned int pitch;
+ unsigned int cellheight;
+ unsigned int cellwidth;
+ int ascent;
+ int descent;
+} PclFontDescRec, *PclFontDescPtr;
+
+typedef struct _PclFontHead8Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short fid;
+ unsigned char *index;
+ struct _PclFontHead8Rec *next;
+} PclFontHead8Rec, *PclFontHead8Ptr;
+
+typedef struct _PclFontHead16Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short cur_fid;
+ unsigned char cur_cindex;
+ PclFontMapRec **index;
+ unsigned short firstCol;
+ unsigned short lastCol;
+ unsigned short firstRow;
+ unsigned short lastRow;
+ struct _PclFontHead16Rec *next;
+} PclFontHead16Rec, *PclFontHead16Ptr;
+
+typedef struct _PclInternalFontRec {
+ char *fontname;
+ float pitch;
+ float height;
+ char *pcl_font_name;
+ char *spacing;
+ struct _PclInternalFontRec *next;
+} PclInternalFontRec, *PclInternalFontPtr;
+
+typedef struct {
+ PclFontHead8Ptr phead8;
+ PclFontHead16Ptr phead16;
+ PclInternalFontPtr pinfont;
+ unsigned char cur_max_fid;
+} PclSoftFontInfoRec, *PclSoftFontInfoPtr;
+
+#define MONOSPACE 0
+#define PROPSPACE 1
+
+#endif /* _PCLFONTS_H */
diff --git a/xc/programs/Xserver/Xprint/pcl/PclSpans.c b/xc/programs/Xserver/Xprint/pcl/PclSpans.c
new file mode 100644
index 000000000..045aee16a
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclSpans.c
@@ -0,0 +1,137 @@
+/* $XConsortium: PclSpans.c /main/2 1996/12/30 14:57:17 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSpans.c
+** *
+** * Contents:
+** * Code to set and fill spans in the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.3 1996/12/31 07:06:03 dawes Exp $ */
+
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nSpans;
+ DDXPointPtr pPoints;
+ int *pWidths;
+ int fSorted;
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ xRectangle *rects, *r;
+ RegionPtr fillRegion, region;
+ int i;
+ int nbox;
+ BoxPtr pbox;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ /*
+ * Build a region out of the spans
+ */
+ rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = rects; i < nSpans; i++, r++ )
+ {
+ r->x = pPoints[i].x + xoffset;
+ r->y = pPoints[i].y + yoffset;
+ r->width = pWidths[i];
+ r->height = 1;
+ }
+ fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ?
+ CT_YSORTED : CT_UNSORTED );
+
+ /*
+ * Intersect this region with the clip region. Whatever's left,
+ * should be filled.
+ */
+ miIntersect( region, fillRegion, pGC->clientClip );
+
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ /* Enter HP-GL/2 */
+ SEND_PCL( outFile, "\27%0B" );
+
+ while( nbox )
+ {
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ SEND_PCL( outFile, t );
+
+ nbox--;
+ pbox++;
+ }
+
+ /* Go back to PCL */
+ SEND_PCL( outFile, "\27%0A" );
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( fillRegion );
+ miRegionDestroy( region );
+ xfree( rects );
+}
+
+void
+PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ char *pSrc;
+ DDXPointPtr pPoints;
+ int *pWidths;
+ int nSpans;
+ int fSorted;
+{
+}
+
+
diff --git a/xc/programs/Xserver/Xprint/pcl/PclText.c b/xc/programs/Xserver/Xprint/pcl/PclText.c
new file mode 100644
index 000000000..5e4ca79fa
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclText.c
@@ -0,0 +1,932 @@
+/* $XConsortium: PclText.c /main/2 1996/12/30 14:57:22 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclText.c
+** *
+** * Contents:
+** * Character-drawing routines for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclText.c,v 1.4 1998/03/20 21:04:51 hohndel Exp $ */
+
+#ifdef DO_TWO_BYTE_PCL
+#include "iconv.h"
+#endif /* DO_TWO_BYTE_PCL */
+#include "gcstruct.h"
+#include "windowstr.h"
+
+#include "Pcl.h"
+#include "migc.h"
+#include "Xatom.h"
+
+#include "PclSFonts.h"
+
+static PclFontHead8Ptr makeFontHeader8 (FontPtr, PclSoftFontInfoPtr);
+static PclFontHead16Ptr makeFontHeader16(FontPtr, PclSoftFontInfoPtr);
+static PclInternalFontPtr makeInternalFont(FontPtr, PclSoftFontInfoPtr);
+static void fillFontDescData(FontPtr, PclFontDescPtr, unsigned int);
+static PclCharDataPtr fillCharDescData(PclCharDataPtr, CharInfoPtr);
+static void output_text(FILE *, PclContextPrivPtr, unsigned char);
+static char * getFontName(FontPtr);
+static char isInternal(FontPtr);
+static void selectInternalFont(FILE *, PclInternalFontPtr, int);
+static void selectSize(FILE *, PclContextPrivPtr, PclInternalFontPtr);
+static char t[80];
+
+#ifdef DO_TWO_BYTE_PCL
+static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
+#endif /* DO_TWO_BYTE_PCL */
+
+#define ESC 0x1b
+#define PER 0x25
+#define ETX 0x3
+#define ETX_ALT 0x2a
+#define DOWNLOAD_FONT 0
+#define INTERNAL_FONT 1
+
+int
+PclPolyText8( pDrawable, pGC, x, y, count, string )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x;
+ int y;
+ int count;
+ char *string;
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead8Ptr pfh8 = (PclFontHead8Ptr)NULL;
+PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
+PclCharDataRec cd;
+unsigned char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ Linear8Bit, &n, charinfo);
+ if ( n == 0 )
+ return x;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh8 = makeFontHeader8(pGC->font, pSoftFontInfo);
+ if (!pfh8)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( !pfh8->index[*p] ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont8(pConPriv->pJobFile, pSoftFontInfo,
+ pfh8, &cd, p);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( last_fid != pfh8->fid ) {
+ sprintf(t, "%c;FI%d;SS;LB", ETX, pfh8->fid);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ last_fid = pfh8->fid;
+ }
+
+ output_text(outFile, pConPriv, pfh8->index[*p]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+ char *internalFont;
+ int pixel_size;
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ selectSize(outFile, pConPriv, pin);
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ output_text(outFile, pConPriv, *p);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + charinfo[0]->metrics.leftSideBearing + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y;
+ box.x2 = x + w - charinfo[n-1]->metrics.characterWidth
+ + charinfo[n-1]->metrics.rightSideBearing + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+
+ return x+w;
+}
+
+int
+PclPolyText16( pDrawable, pGC, x, y, count, string )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x;
+ int y;
+ int count;
+ unsigned short *string;
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
+PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
+PclCharDataRec cd;
+FontInfoPtr pfi;
+unsigned char row, col;
+char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+unsigned short def;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ pCon->devPrivates[PclContextPrivateIndex].ptr;
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh16 = makeFontHeader16(pGC->font, pSoftFontInfo);
+ if (!pfh16)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ pfi = (FontInfoRec *)&pGC->font->info;
+ p = (char *)string;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = (def>>8)&0xff - pfi->firstRow;
+ col = def&0xff - pfi->firstCol;
+ }
+ if ( !pfh16->index[row][col].fid ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont16(pConPriv->pJobFile, pSoftFontInfo,
+ pfh16, &cd, row, col);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = (def>>8)&0xff - pfi->firstRow;
+ col = def&0xff - pfi->firstCol;
+ }
+ if ( last_fid != pfh16->index[row][col].fid ) {
+ sprintf(t, "%cFI%d;SS;LB",
+ ETX, pfh16->index[row][col].fid);
+ SAVE_PCL( outFile, pConPriv, t );
+ last_fid = pfh16->index[row][col].fid;
+ }
+
+ output_text(outFile, pConPriv, pfh16->index[row][col].cindex);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+#ifdef DO_TWO_BYTE_PCL
+ char *internalFont;
+ int pixel_size;
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+ fprintf(outFile, "%c&t31P", ESC);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+
+ w = 0;
+ last_fid = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ char tobuf[3];
+ code_conv(pSoftFontInfo, pGC->font, (char *)p, tobuf);
+ fprintf(outFile, "%c%c", tobuf[0], tobuf[1]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ MACRO_END( outFile );
+#else
+ return x;
+#endif /* DO_TWO_BYTE_PCL */
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + charinfo[0]->metrics.leftSideBearing + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y;
+ box.x2 = x + w - charinfo[n-1]->metrics.characterWidth
+ + charinfo[n-1]->metrics.rightSideBearing + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy( drawRegion );
+ miRegionDestroy( region );
+
+ return x+w;
+}
+
+void
+PclImageText8( pDrawable, pGC, x, y, count, string )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ int count;
+ char *string;
+{
+}
+
+void
+PclImageText16( pDrawable, pGC, x, y, count, string )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x;
+ int y;
+ int count;
+ unsigned short *string;
+{
+}
+
+void
+PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nGlyphs;
+ CharInfoPtr *pCharInfo;
+ pointer pGlyphBase;
+{
+}
+
+void
+PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nGlyphs;
+ CharInfoPtr *pCharInfo;
+ pointer pGlyphBase;
+{
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static PclFontHead8Ptr
+makeFontHeader8(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead8Ptr phead8 = pSoftFontInfo->phead8;
+PclFontHead8Ptr pfh8 = phead8;
+PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex;
+int i, j;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ if (!strcmp(pfh8->fontname, fontname))
+ return pfh8;
+ prev = pfh8;
+ pfh8 = pfh8->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh8 = (PclFontHead8Ptr)xalloc(sizeof(PclFontHead8Rec));
+ if (pfh8 == (PclFontHead8Ptr)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ Linear8Bit, &n, charinfo);
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh8->fd), space_width);
+ pfh8->fid = 0;
+ pfh8->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh8->fontname == (char *)NULL) {
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+ strcpy(pfh8->fontname, fontname);
+
+ nindex = 0xff;
+ pfh8->index = (unsigned char *)xalloc(nindex);
+ if ( pfh8->index == (unsigned char *) NULL ) {
+ xfree(pfh8->fontname);
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+
+ for (i=0; i<=nindex; i++)
+ pfh8->index[i] = 0x0;
+
+ pfh8->next = (PclFontHead8Ptr)NULL;
+
+ if ( prev == (PclFontHead8Ptr) NULL)
+ pSoftFontInfo->phead8 = pfh8;
+ else
+ prev->next = pfh8;
+
+ return pfh8;
+}
+
+static PclFontHead16Ptr
+makeFontHeader16(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead16Ptr phead16 = pSoftFontInfo->phead16;
+PclFontHead16Ptr pfh16 = phead16;
+PclFontHead16Ptr prev = (PclFontHead16Ptr)NULL;
+PclFontMapRec ** index;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex_row, nindex_col;
+int i, j;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ if (!strcmp(pfh16->fontname, fontname))
+ return pfh16;
+ prev = pfh16;
+ pfh16 = pfh16->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh16 = (PclFontHead16Ptr)xalloc(sizeof(PclFontHead16Rec));
+ if (pfh16 == (PclFontHead16Ptr)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh16->fd), space_width);
+ pfh16->cur_fid = 0;
+ pfh16->cur_cindex = 0;
+ pfh16->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh16->fontname == (char *)NULL) {
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ strcpy(pfh16->fontname, fontname);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ nindex_col = pfi->lastCol - pfi->firstCol + 1;
+ nindex_row = pfi->lastRow - pfi->firstRow + 1;
+ index = (PclFontMapRec **)xalloc(sizeof(PclFontMapRec *)*nindex_row);
+ if (index == (PclFontMapRec **)NULL) {
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (i=0; i<nindex_row; i++) {
+ index[i] = (PclFontMapRec *)xalloc(sizeof(PclFontMapRec)*nindex_col);
+ if (index[i] == (PclFontMapRec *)NULL) {
+ for(j=0; j<i; j++)
+ xfree(index[j]);
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (j=0; j<=nindex_col; j++)
+ index[i][j].fid = 0x0;
+ }
+
+ pfh16->index = index;
+ pfh16->firstCol = pfi->firstCol;
+ pfh16->lastCol = pfi->lastCol;
+ pfh16->firstRow = pfi->firstRow;
+ pfh16->lastRow = pfi->lastRow;
+ pfh16->next = (PclFontHead16Ptr)NULL;
+
+ if ( prev == (PclFontHead16Ptr) NULL)
+ pSoftFontInfo->phead16 = pfh16;
+ else
+ prev->next = pfh16;
+
+ return pfh16;
+}
+
+static PclInternalFontPtr
+makeInternalFont(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclInternalFontPtr pinfont = pSoftFontInfo->pinfont;
+PclInternalFontPtr pin = pinfont;
+PclInternalFontPtr prev = (PclInternalFontPtr)NULL;
+FontPropPtr props;
+FontInfoPtr pfi;
+char *fontname;
+Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
+int res, width;
+int mask;
+int i;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclInternalFontPtr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ while (pin != (PclInternalFontPtr) NULL) {
+ if (!strcmp(pin->fontname, fontname))
+ return pin;
+ prev = pin;
+ pin = pin->next;
+ }
+
+ /*
+ * Create Internal Font Information
+ */
+ pin = (PclInternalFontPtr)xalloc(sizeof(PclInternalFontRec));
+ if (pin == (PclInternalFontPtr)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ pin->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pin->fontname == (char *)NULL) {
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+ strcpy(pin->fontname, fontname);
+
+ xa_pcl_font_name = MakeAtom("PCL_FONT_NAME", strlen("PCL_FONT_NAME"), TRUE);
+ xa_res = MakeAtom("RESOLUTION_X", strlen("RESOLUTION_X"), TRUE);
+ xa_ave_width = MakeAtom("AVERAGE_WIDTH", strlen("AVERAGE_WIDTH"), TRUE);
+ xa_spacing = MakeAtom("SPACING", strlen("SPACING"), TRUE);
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+
+ mask = 0;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( props->name == xa_pcl_font_name ) {
+ pin->pcl_font_name = NameForAtom(props->value);
+ mask |= 0x1;
+ } else if ( props->name == XA_POINT_SIZE ) {
+ pin->height = (float) props->value / 10.0;
+ mask |= 0x2;
+ } else if ( props->name == xa_res ) {
+ res = (int) props->value;
+ mask |= 0x4;
+ } else if ( props->name == xa_ave_width ) {
+ width = (int) props->value / 10;
+ mask |= 0x8;
+ } else if ( props->name == xa_spacing ) {
+ pin->spacing = NameForAtom(props->value);
+ mask |= 0x10;
+ }
+ }
+ if ( mask != 0x1f ) {
+ xfree(pin->fontname);
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+
+ if ( *pin->spacing != 'P' || *pin->spacing != 'p' )
+ pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
+
+ pin->next = (PclInternalFontPtr)NULL;
+ if ( prev == (PclInternalFontPtr) NULL)
+ pSoftFontInfo->pinfont = pin;
+ else
+ prev->next = pin;
+
+ return pin;
+}
+
+static void
+fillFontDescData(FontPtr pfont, PclFontDescPtr pfd, unsigned int space)
+{
+FontInfoPtr pfi;
+
+ pfi = (FontInfoRec *)&pfont->info;
+
+ if ( (pfi->maxbounds.leftSideBearing == pfi->minbounds.leftSideBearing)
+ && (pfi->maxbounds.rightSideBearing == pfi->minbounds.rightSideBearing)
+ && (pfi->maxbounds.characterWidth == pfi->minbounds.characterWidth)
+ && (pfi->maxbounds.ascent == pfi->minbounds.ascent)
+ && (pfi->maxbounds.descent == pfi->minbounds.descent)
+ )
+ pfd->spacing = MONOSPACE;
+ else
+ pfd->spacing = PROPSPACE;
+
+ pfd->pitch = space;
+ pfd->cellheight = FONTMAXBOUNDS(pfont,ascent)
+ + FONTMAXBOUNDS(pfont,descent);
+ pfd->cellwidth = FONTMAXBOUNDS(pfont,rightSideBearing)
+ - FONTMINBOUNDS(pfont,leftSideBearing);
+ pfd->ascent = FONTMAXBOUNDS(pfont,ascent); /*FONTASCENT(pfont);*/
+ pfd->descent = FONTMAXBOUNDS(pfont,descent); /*FONTDESCENT(pfont);*/
+}
+
+static PclCharDataPtr
+fillCharDescData(PclCharDataPtr pcd, CharInfoPtr pci)
+{
+unsigned int byte_width;
+unsigned char *p;
+register int nbyGlyphWidth;
+unsigned char *pglyph, *pg;
+int i, j;
+
+ pcd->h_offset = pci->metrics.leftSideBearing;
+ pcd->v_offset = pci->metrics.ascent;
+ pcd->width = pci->metrics.rightSideBearing
+ - pci->metrics.leftSideBearing;
+ pcd->height = pci->metrics.ascent + pci->metrics.descent;
+ pcd->font_pitch = pci->metrics.characterWidth;
+
+ byte_width = (pcd->width + 7)/8;
+ pcd->raster_top = (unsigned char *)xalloc(byte_width * pcd->height);
+ if (pcd->raster_top == (unsigned char *)NULL)
+ return (PclCharDataPtr)NULL;
+
+ p = pcd->raster_top;
+ nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ for (i=0; i<pcd->height; i++) {
+ pg = pglyph + nbyGlyphWidth * i;
+ for (j=0; j<byte_width; j++)
+ *p++ = *pg++;
+ }
+ return pcd;
+}
+
+static void
+output_text(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ unsigned char index)
+{
+ if ( index == ETX ) {
+ sprintf(t, "%c;DT%c,1;LB%c%c;DT%c,1;LB",
+ ETX, ETX_ALT, ETX, ETX_ALT, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "%c", index);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ }
+}
+
+static char *
+getFontName(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+char *fontname;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ fontname = (char *) NULL;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( props->name == XA_FONT ) {
+ fontname = (char *)NameForAtom(props->value);
+ break;
+ }
+ }
+ return fontname;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Internal Font Selection */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static char
+isInternal(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+Atom dest;
+
+ dest = MakeAtom("DESTINATION", strlen("DESTINATION"), TRUE);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( props->name == dest && props->value == 2 )
+ return INTERNAL_FONT;
+ }
+ return DOWNLOAD_FONT;
+}
+
+static void
+selectInternalFont(FILE *outFile, PclInternalFontPtr pin, int fid)
+{
+ fprintf(outFile, "%c*c%dD", ESC, fid);
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' )
+ fprintf(outFile, pin->pcl_font_name, pin->height);
+ else
+ fprintf(outFile, pin->pcl_font_name, pin->pitch);
+ fprintf(outFile, "%c*c6F", ESC);
+}
+
+static void
+selectSize(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ PclInternalFontPtr pin)
+{
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' ) {
+ sprintf(t, "SD4,%f;", pin->height);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "SD3,%f;", pin->pitch);
+ SAVE_PCL( outFile, pConPriv, t );
+ }
+ return;
+}
+
+#ifdef DO_TWO_BYTE_PCL
+static void
+code_conv(
+ PclSoftFontInfoPtr pSoftFontInfo,
+ FontPtr pfont,
+ char *from,
+ char *to
+)
+{
+iconv_t cd;
+char frombuf[9], *fromptr;
+size_t inbyte = 5, outbyte=2;
+
+ fromptr = frombuf;
+ frombuf[0] = 0x1b; /* Esc */
+ frombuf[1] = 0x24; /* $ */
+ frombuf[2] = 0x42; /* B */
+ frombuf[3] = *from;
+ frombuf[4] = *(from+1);
+ frombuf[5] = 0x1b; /* Esc */
+ frombuf[6] = 0x28; /* ( */
+ frombuf[7] = 0x4a; /* J */
+ frombuf[8] = 0x0;
+ if ((cd = iconv_open("sjis", "jis")) == (iconv_t)(-1)) {
+ *to = (unsigned char)NULL;
+ return;
+ }
+
+ if ( iconv(cd, &fromptr, &inbyte, &to, &outbyte) == -1 )
+ *to = (unsigned char)NULL;
+
+ iconv_close(cd);
+ return;
+}
+#endif /* DO_TWO_BYTE_PCL */
diff --git a/xc/programs/Xserver/Xprint/pcl/PclWindow.c b/xc/programs/Xserver/Xprint/pcl/PclWindow.c
new file mode 100644
index 000000000..2fef1415f
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/PclWindow.c
@@ -0,0 +1,452 @@
+/* $XConsortium: PclWindow.c /main/3 1996/12/30 16:37:28 kaleb $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclWindow.c
+** *
+** * Contents:
+** * Window code for Pcl driver.
+** *
+** * Created: 2/02/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclWindow.c,v 1.7 1998/12/20 11:57:27 dawes Exp $ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "mistruct.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+extern WindowPtr *WindowTable;
+
+/*
+ * The following list of strings defines the properties which will be
+ * placed on the screen's root window if the property was defined in
+ * the start-up configuration resource database.
+ */
+static /* const */ char *propStrings[] = {
+ DT_PRINT_JOB_HEADER,
+ DT_PRINT_JOB_TRAILER,
+ DT_PRINT_JOB_COMMAND, /* old-obsolete */
+ DT_PRINT_JOB_EXEC_COMMAND,
+ DT_PRINT_JOB_EXEC_OPTIONS,
+ DT_PRINT_PAGE_HEADER,
+ DT_PRINT_PAGE_TRAILER,
+ DT_PRINT_PAGE_COMMAND,
+ (char *)NULL
+};
+
+
+/*
+ * PclCreateWindow - watch for the creation of the root window.
+ * When it's created, register the screen with the print extension,
+ * and put the default command/header properties on it.
+ */
+/*ARGSUSED*/
+
+Bool
+PclCreateWindow(
+ register WindowPtr pWin)
+{
+ PclWindowPrivPtr pPriv;
+
+#if 0
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr)
+ pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ pWin->devPrivates[PclWindowPrivateIndex].ptr;
+
+ /*
+ * Initialize this window's private struct.
+ */
+ pWinPriv->jobFileName = (char *)NULL;
+ pWinPriv->pJobFile = (FILE *)NULL;
+ pWinPriv->pageFileName = (char *)NULL;
+ pWinPriv->pPageFile = (FILE *)NULL;
+
+ if(pWin->parent == (WindowPtr)NULL) /* root window? */
+ {
+ Atom propName; /* type = XA_STRING */
+ char *propVal;
+ int i;
+ XrmDatabase rmdb = pScreenPriv->resDB;
+
+ /*
+ * Put the defaults spec'd in the config files in properties on this
+ * screen's root window.
+ */
+ for(i = 0; propStrings[i] != (char *)NULL; i++)
+ {
+ if((propVal = _DtPrintGetPrinterResource(pWin, rmdb,
+ propStrings[i])) !=
+ (char *)NULL)
+ {
+ propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
+ TRUE);
+ ChangeWindowProperty(pWin, propName, XA_STRING, 8,
+ PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
+ xfree(propVal);
+ }
+ }
+ }
+
+ return status;
+#endif
+
+ /*
+ * Invalidate the window's private print context.
+ */
+ pPriv = (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
+ pPriv->validContext = 0;
+
+ return TRUE;
+}
+
+
+/*ARGSUSED*/
+Bool PclMapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclUnmapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void
+PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+}
+
+/*ARGSUSED*/
+Bool
+PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask)
+{
+ if( pWin->backingStore != NotUseful )
+ {
+ pWin->backingStore = NotUseful;
+ mask |= CWBackingStore;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * This function is largely ripped from miPaintWindow, but modified so
+ * that the background is not painted to the root window, and so that
+ * the backing store is not referenced.
+ */
+void
+PclPaintWindow(
+ WindowPtr pWin,
+ RegionPtr pRegion,
+ int what)
+{
+ int status;
+ WindowPtr pRoot;
+
+#define FUNCTION 0
+#define FOREGROUND 1
+#define TILE 2
+#define FILLSTYLE 3
+#define ABSX 4
+#define ABSY 5
+#define CLIPMASK 6
+#define SUBWINDOW 7
+#define COUNT_BITS 8
+
+ pointer gcval[7];
+ pointer newValues [COUNT_BITS];
+
+ BITS32 gcmask, index, mask;
+ RegionRec prgnWin;
+ DDXPointRec oldCorner;
+ BoxRec box;
+ WindowPtr pBgWin;
+ GCPtr pGC;
+ register int i;
+ register BoxPtr pbox;
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+ register xRectangle *prect;
+ int numRects;
+
+ gcmask = 0;
+
+ /*
+ * We don't want to paint a window that has no place to put the
+ * PCL output.
+ */
+ if( PclGetContextFromWindow( pWin ) == (XpContextPtr)NULL )
+ return;
+
+ if (what == PW_BACKGROUND)
+ {
+ switch (pWin->backgroundState) {
+ case None:
+ return;
+ case ParentRelative:
+ (*pWin->parent->drawable.pScreen->PaintWindowBackground)
+ (pWin->parent, pRegion, what);
+ return;
+ case BackgroundPixel:
+ newValues[FOREGROUND] = (pointer)pWin->background.pixel;
+ newValues[FILLSTYLE] = (pointer)FillSolid;
+ gcmask |= GCForeground | GCFillStyle;
+ break;
+ case BackgroundPixmap:
+ newValues[TILE] = (pointer)pWin->background.pixmap;
+ newValues[FILLSTYLE] = (pointer)FillTiled;
+ gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin |
+ GCTileStipYOrigin;
+ break;
+ }
+ }
+ else
+ {
+ if (pWin->borderIsPixel)
+ {
+ newValues[FOREGROUND] = (pointer)pWin->border.pixel;
+ newValues[FILLSTYLE] = (pointer)FillSolid;
+ gcmask |= GCForeground | GCFillStyle;
+ }
+ else
+ {
+ newValues[TILE] = (pointer)pWin->border.pixmap;
+ newValues[FILLSTYLE] = (pointer)FillTiled;
+ gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin
+ | GCTileStipYOrigin;
+ }
+ }
+
+ prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(pRegion) *
+ sizeof(xRectangle));
+ if (!prect)
+ return;
+
+ newValues[FUNCTION] = (pointer)GXcopy;
+ gcmask |= GCFunction | GCClipMask;
+
+ i = pScreen->myNum;
+ pRoot = WindowTable[i];
+
+ pBgWin = pWin;
+ if (what == PW_BORDER)
+ {
+ while (pBgWin->backgroundState == ParentRelative)
+ pBgWin = pBgWin->parent;
+ }
+
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+ if (!pGC)
+ {
+ DEALLOCATE_LOCAL(prect);
+ return;
+ }
+ /*
+ * mash the clip list so we can paint the border by
+ * mangling the window in place, pretending it
+ * spans the entire screen
+ */
+ if (what == PW_BORDER)
+ {
+ prgnWin = pWin->clipList;
+ oldCorner.x = pWin->drawable.x;
+ oldCorner.y = pWin->drawable.y;
+ pWin->drawable.x = pWin->drawable.y = 0;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT(pScreen, &pWin->clipList, &box, 1);
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ newValues[ABSX] = (pointer)(long)pBgWin->drawable.x;
+ newValues[ABSY] = (pointer)(long)pBgWin->drawable.y;
+ }
+ else
+ {
+ newValues[ABSX] = (pointer)0;
+ newValues[ABSY] = (pointer)0;
+ }
+
+/*
+ * XXX Backing store is turned off for the PCL driver
+
+ if (pWin->backStorage)
+ (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC,
+ GuaranteeVisBack);
+ */
+
+ mask = gcmask;
+ gcmask = 0;
+ i = 0;
+ while (mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+ switch (index) {
+ case GCFunction:
+ if ((pointer)(long) pGC->alu != newValues[FUNCTION]) {
+ gcmask |= index;
+ gcval[i++] = newValues[FUNCTION];
+ }
+ break;
+ case GCTileStipXOrigin:
+ if ((pointer)(long) pGC->patOrg.x != newValues[ABSX]) {
+ gcmask |= index;
+ gcval[i++] = newValues[ABSX];
+ }
+ break;
+ case GCTileStipYOrigin:
+ if ((pointer)(long) pGC->patOrg.y != newValues[ABSY]) {
+ gcmask |= index;
+ gcval[i++] = newValues[ABSY];
+ }
+ break;
+ case GCClipMask:
+ if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
+ gcmask |= index;
+ gcval[i++] = (pointer)CT_NONE;
+ }
+ break;
+ case GCSubwindowMode:
+ if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
+ gcmask |= index;
+ gcval[i++] = newValues[SUBWINDOW];
+ }
+ break;
+ case GCTile:
+ if (pGC->tileIsPixel ||
+ (pointer) pGC->tile.pixmap != newValues[TILE])
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[TILE];
+ }
+ break;
+ case GCFillStyle:
+ if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
+ gcmask |= index;
+ gcval[i++] = newValues[FILLSTYLE];
+ }
+ break;
+ case GCForeground:
+ if ((pointer) pGC->fgPixel != newValues[FOREGROUND]) {
+ gcmask |= index;
+ gcval[i++] = newValues[FOREGROUND];
+ }
+ break;
+ }
+ }
+
+ if (gcmask)
+ DoChangeGC(pGC, gcmask, (XID *)gcval, 1);
+
+ if (pWin->drawable.serialNumber != pGC->serialNumber)
+ ValidateGC((DrawablePtr)pWin, pGC);
+
+ numRects = REGION_NUM_RECTS(pRegion);
+ pbox = REGION_RECTS(pRegion);
+ for (i= numRects; --i >= 0; pbox++, prect++)
+ {
+ prect->x = pbox->x1 - pWin->drawable.x;
+ prect->y = pbox->y1 - pWin->drawable.y;
+ prect->width = pbox->x2 - pbox->x1;
+ prect->height = pbox->y2 - pbox->y1;
+ }
+ prect -= numRects;
+ (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
+ DEALLOCATE_LOCAL(prect);
+
+/*
+ * XXX Backing store is turned off for the PCL driver
+
+ if (pWin->backStorage)
+ (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC,
+ GuaranteeNothing);
+ */
+
+ if (what == PW_BORDER)
+ {
+ REGION_UNINIT(pScreen, &pWin->clipList);
+ pWin->clipList = prgnWin;
+ pWin->drawable.x = oldCorner.x;
+ pWin->drawable.y = oldCorner.y;
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ FreeScratchGC(pGC);
+
+}
+
+/*ARGSUSED*/
+Bool
+PclDestroyWindow(
+ WindowPtr pWin)
+{
+ return TRUE;
+}
+
diff --git a/xc/programs/Xserver/Xprint/pcl/Pclmap.h b/xc/programs/Xserver/Xprint/pcl/Pclmap.h
new file mode 100644
index 000000000..906e82491
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/pcl/Pclmap.h
@@ -0,0 +1,205 @@
+/* $XConsortium: Pclmap.h /main/2 1996/11/16 15:27:02 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.2 1997/02/23 11:33:36 dawes Exp $ */
+
+#ifndef _PCLMAP_H_
+#define _PCLMAP_H_
+
+#ifdef XP_PCL_COLOR
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) PclCr##subname
+#define CATNAME(prefix,subname) prefix##Color##subname
+#else
+#define NAME(subname) PclCr/**/subname
+#define CATNAME(prefix,subname) prefix/**/Color/**/subname
+#endif
+#endif /* XP_PCL_COLOR */
+
+#ifdef XP_PCL_MONO
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) PclMn##subname
+#define CATNAME(prefix,subname) prefix##Mono##subname
+#else
+#define NAME(subname) PclMn/**/subname
+#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
+#endif
+#endif /* XP_PCL_MONO */
+
+#ifdef XP_PCL_LJ3
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) PclLj3##subname
+#define CATNAME(prefix,subname) prefix##Lj3##subname
+#else
+#define NAME(subname) PclLj3/**/subname
+#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
+#endif
+#endif /* XP_PCL_LJ3 */
+
+/* PclInit.c */
+#define InitializePclDriver CATNAME(Initialize, PclDriver)
+#define PclCloseScreen NAME(CloseScreen)
+#define PclGetContextFromWindow NAME(GetContextFromWindow)
+#define PclScreenPrivateIndex NAME(ScreenPrivateIndex)
+#define PclWindowPrivateIndex NAME(WindowPrivateIndex)
+#define PclContextPrivateIndex NAME(ContextPrivateIndex)
+#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex)
+#define PclGCPrivateIndex NAME(GCPrivateIndex)
+
+/* PclPrint.c */
+#define PclStartJob NAME(StartJob)
+#define PclEndJob NAME(EndJob)
+#define PclStartPage NAME(StartPage)
+#define PclEndPage NAME(EndPage)
+#define PclStartDoc NAME(StartDoc)
+#define PclEndDoc NAME(EndDoc)
+#define PclDocumentData NAME(DocumentData)
+#define PclGetDocumentData NAME(GetDocumentData)
+
+/* PclWindow.c */
+#define PclCreateWindow NAME(CreateWindow)
+#define PclMapWindow NAME(MapWindow)
+#define PclPositionWindow NAME(PositionWindow)
+#define PclUnmapWindow NAME(UnmapWindow)
+#define PclCopyWindow NAME(CopyWindow)
+#define PclChangeWindowAttributes NAME(ChangeWindowAttributes)
+#define PclPaintWindow NAME(PaintWindow)
+#define PclDestroyWindow NAME(DestroyWindow)
+
+/* PclGC.c */
+#define PclCreateGC NAME(CreateGC)
+#define PclDestroyGC NAME(DestroyGC)
+#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff)
+#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC)
+#define PclSendPattern NAME(SendPattern)
+#define PclUpdateDrawableGC NAME(UpdateDrawableGC)
+#define PclComputeCompositeClip NAME(ComputeCompositeClip)
+#define PclValidateGC NAME(ValidateGC)
+
+/* PclAttr.c */
+#define PclGetAttributes NAME(GetAttributes)
+#define PclGetOneAttribute NAME(GetOneAttribute)
+#define PclAugmentAttributes NAME(AugmentAttributes)
+#define PclSetAttributes NAME(SetAttributes)
+
+/* PclColor.c */
+#define PclLookUp NAME(LookUp)
+#define PclCreateDefColormap NAME(CreateDefColormap)
+#define PclCreateColormap NAME(CreateColormap)
+#define PclDestroyColormap NAME(DestroyColormap)
+#define PclInstallColormap NAME(InstallColormap)
+#define PclUninstallColormap NAME(UninstallColormap)
+#define PclListInstalledColormaps NAME(ListInstalledColormaps)
+#define PclStoreColors NAME(StoreColors)
+#define PclResolveColor NAME(ResolveColor)
+#define PclFindPaletteMap NAME(FindPaletteMap)
+#define PclUpdateColormap NAME(UpdateColormap)
+#define PclReadMap NAME(ReadMap)
+
+/* PclPixmap.c */
+#define PclCreatePixmap NAME(CreatePixmap)
+#define PclDestroyPixmap NAME(DestroyPixmap)
+
+/* PclArc.c */
+#define PclDoArc NAME(DoArc)
+#define PclPolyArc NAME(PolyArc)
+#define PclPolyFillArc NAME(PolyFillArc)
+
+/* PclArea.c */
+#define PclPutImage NAME(PutImage)
+#define PclCopyArea NAME(CopyArea)
+#define PclCopyPlane NAME(CopyPlane)
+
+/* PclLine */
+#define PclPolyLine NAME(PolyLine)
+#define PclPolySegment NAME(PolySegment)
+
+/* PclPixel.c */
+#define PclPolyPoint NAME(PolyPoint)
+#define PclPushPixels NAME(PushPixels)
+
+/* PclPolygon.c */
+#define PclPolyRectangle NAME(PolyRectangle)
+#define PclFillPolygon NAME(FillPolygon)
+#define PclPolyFillRect NAME(PolyFillRect)
+
+/* PclSpans.c */
+#define PclFillSpans NAME(FillSpans)
+#define PclSetSpans NAME(SetSpans)
+
+/* PclText.c */
+#define PclPolyText8 NAME(PolyText8)
+#define PclPolyText16 NAME(PolyText16)
+#define PclImageText8 NAME(ImageText8)
+#define PclImageText16 NAME(ImageText16)
+#define PclImageGlyphBlt NAME(ImageGlyphBlt)
+#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
+#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
+
+/* PclFonts.c */
+#define PclRealizeFont NAME(RealizeFont)
+#define PclUnrealizeFont NAME(UnrealizeFont)
+
+/* PclSFonts.c */
+#define PclDownloadSoftFont8 NAME(DownloadSoftFont8)
+#define PclDownloadSoftFont16 NAME(DownloadSoftFont16)
+#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo)
+#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo)
+
+/* PclMisc.c */
+#define PclQueryBestSize NAME(QueryBestSize)
+#define GetPropString NAME(GetPropString)
+#define SystemCmd NAME(SystemCmd)
+#define PclGetMediumDimensions NAME(GetMediumDimensions)
+#define PclGetReproducibleArea NAME(GetReproducibleArea)
+#define PclSpoolFigs NAME(SpoolFigs)
+#define PclSendData NAME(SendData)
+
+/* PclCursor.c */
+#define PclConstrainCursor NAME(ConstrainCursor)
+#define PclCursorLimits NAME(CursorLimits)
+#define PclDisplayCursor NAME(DisplayCursor)
+#define PclRealizeCursor NAME(RealizeCursor)
+#define PclUnrealizeCursor NAME(UnrealizeCursor)
+#define PclRecolorCursor NAME(RecolorCursor)
+#define PclSetCursorPosition NAME(SetCursorPosition)
+
+#endif /* _PCLMAP_H_ */
diff --git a/xc/programs/Xserver/Xprint/ps/Imakefile b/xc/programs/Xserver/Xprint/ps/Imakefile
new file mode 100644
index 000000000..6364505c6
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/Imakefile
@@ -0,0 +1,43 @@
+XCOMM $XFree86: xc/programs/Xserver/Xprint/ps/Imakefile,v 1.5 1999/07/18 15:47:38 dawes Exp $
+
+
+
+
+XCOMM $XConsortium: Imakefile /main/2 1996/11/16 15:24:20 rws $
+
+#include <Server.tmpl>
+
+SRCS1 = PsInit.c PsPrint.c PsGC.c PsMisc.c PsSpans.c PsArea.c PsPixel.c \
+ PsLine.c PsPolygon.c PsArc.c PsText.c PsWindow.c PsFonts.c \
+ PsAttr.c PsAttVal.c PsColor.c PsPixmap.c psout.c
+
+OBJS1 = PsInit.o PsPrint.o PsGC.o PsMisc.o PsSpans.o PsArea.o PsPixel.o \
+ PsLine.o PsPolygon.o PsArc.o PsText.o PsWindow.o PsFonts.o \
+ PsAttr.o PsAttVal.o PsColor.o PsPixmap.o psout.o
+
+SRCS = $(SRCS1)
+
+OBJS = $(OBJS1)
+
+XCOMM DEFINES = -DPIXPRIV
+ DEFINES = -UXFree86LOADER
+
+ INCLUDES = -I. \
+ -I../../cfb \
+ -I../$(TOP) \
+ -I../../include -I.. -I$(TOP)/include \
+ -I$(EXTINCSRC) -I$(FONTINCSRC) \
+ -I$(FONTLIBSRC)/include \
+ -I../../mi -I../../mfb
+
+ LINTLIBS = $(TOP)/server/dix/llib-ldix.ln $(TOP)/server/os/llib-los.ln \
+ $(TOP)/server/ddx/mfb/llib-lmfb.ln \
+ $(TOP)/server/ddx/mi/llib-lmi.ln \
+ $(TOP)/server/ddx/cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+NormalLibraryTarget(ps,$(OBJS))
+NormalLintTarget($(SRCS1) $(SRCS2))
+
+DependTarget()
diff --git a/xc/programs/Xserver/Xprint/ps/Ps.h b/xc/programs/Xserver/Xprint/ps/Ps.h
new file mode 100644
index 000000000..e6ee49315
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/Ps.h
@@ -0,0 +1,512 @@
+/* $TOG: Ps.h /main/4 1998/02/09 15:43:35 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: Ps.h
+** *
+** * Contents: defines and includes for the Ps driver
+** * for a printing X server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.4 1998/10/04 09:37:26 dawes Exp $ */
+
+#ifndef _PS_H_
+#define _PS_H_
+
+#include <stdio.h>
+
+#ifdef abs
+#undef abs /* this is because of a non-Spec1170ness in misc.h */
+#endif
+#include <stdlib.h>
+#include "scrnintstr.h"
+#include "dix.h"
+
+/*
+#include "X.h"
+#include "Xproto.h"
+#include "Xatom.h"
+#include "misc.h"
+#include "screenint.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "servermd.h"*/ /* needed for IMAGE_BUFSIZE */
+
+#include "PsDef.h"
+#include "psout.h"
+
+#define _XP_PRINT_SERVER_
+#include "Print.h"
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#include "miscstruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+typedef char *XPointer;
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <Xfuncproto.h>
+#include "../Xresource.h"
+
+/*
+ * Public index variables from PsInit.c
+ */
+
+extern int PsScreenPrivateIndex;
+extern int PsWindowPrivateIndex;
+extern int PsContextPrivateIndex;
+extern int PsPixmapPrivateIndex;
+
+/*
+ * Display list structures
+ */
+
+#define DPY_BLOCKSIZE 4096
+
+typedef struct
+{
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+} PsPolyPointsRec;
+
+typedef struct
+{
+ int nSegments;
+ xSegment *pSegments;
+} PsSegmentsRec;
+
+typedef struct
+{
+ int nRects;
+ xRectangle *pRects;
+} PsRectanglesRec;
+
+typedef struct
+{
+ int nArcs;
+ xArc *pArcs;
+} PsArcsRec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int count;
+ char *string;
+} PsText8Rec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int count;
+ unsigned short *string;
+} PsText16Rec;
+
+typedef struct
+{
+ int depth;
+ int x;
+ int y;
+ int w;
+ int h;
+ int leftPad;
+ int format;
+ int res; /* image resolution */
+ char *pData;
+} PsImageRec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int w;
+ int h;
+} PsFrameRec;
+
+typedef enum
+{
+ PolyPointCmd,
+ PolyLineCmd,
+ PolySegmentCmd,
+ PolyRectangleCmd,
+ FillPolygonCmd,
+ PolyFillRectCmd,
+ PolyArcCmd,
+ PolyFillArcCmd,
+ Text8Cmd,
+ Text16Cmd,
+ TextI8Cmd,
+ TextI16Cmd,
+ PutImageCmd,
+ BeginFrameCmd,
+ EndFrameCmd
+} DisplayElmType;
+
+typedef struct _DisplayElmRec
+{
+ DisplayElmType type;
+ GCPtr gc;
+ union
+ {
+ PsPolyPointsRec polyPts;
+ PsSegmentsRec segments;
+ PsRectanglesRec rects;
+ PsArcsRec arcs;
+ PsText8Rec text8;
+ PsText16Rec text16;
+ PsImageRec image;
+ PsFrameRec frame;
+ } c;
+} DisplayElmRec;
+
+typedef DisplayElmRec *DisplayElmPtr;
+
+typedef struct _DisplayListRec
+{
+ struct _DisplayListRec *next;
+ int nelms;
+ DisplayElmRec elms[DPY_BLOCKSIZE];
+} DisplayListRec;
+
+typedef DisplayListRec *DisplayListPtr;
+
+/*
+ * Private structures
+ */
+
+typedef struct
+{
+ XrmDatabase resDB;
+ ColormapPtr CMap;
+ Bool (*DestroyWindow)();
+} PsScreenPrivRec, *PsScreenPrivPtr;
+
+typedef struct
+{
+ char *jobFileName;
+ FILE *pJobFile;
+ GC lastGC;
+ unsigned char *dash;
+ int validGC;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+ PsOutPtr pPsOut;
+} PsContextPrivRec, *PsContextPrivPtr;
+
+typedef struct
+{
+ int validContext;
+ XpContextPtr context;
+} PsWindowPrivRec, *PsWindowPrivPtr;
+
+typedef struct
+{
+ XpContextPtr context;
+ GC lastGC;
+ int validGC;
+ DisplayListPtr dispList;
+} PsPixmapPrivRec, *PsPixmapPrivPtr;
+
+/*
+ * Macro functions
+ */
+
+#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/*
+ * Functions in PsInit.c
+ */
+
+extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
+ char **argv);
+static Bool PsDestroyContext(XpContextPtr pCon);
+extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
+
+/*
+ * Functions in PsPrint.c
+ */
+
+extern int PsStartJob(XpContextPtr pCon, Bool sendClientData, ClientPtr client);
+extern int PsEndJob(XpContextPtr pCon, Bool cancel);
+extern int PsStartPage(XpContextPtr pCon, WindowPtr pWin);
+extern int PsEndPage(XpContextPtr pCon, WindowPtr pWin);
+extern int PsStartDoc(XpContextPtr pCon);
+extern int PsEndDoc(XpContextPtr pCon, Bool cancel);
+extern int PsDocumentData(XpContextPtr pCon, DrawablePtr pDraw, char *pData,
+ int len_data, char *pFmt, int len_fmt, char *pOpt, int len_opt,
+ ClientPtr client);
+extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
+ int maxBufferSize);
+
+/*
+ * Functions in PsGC.c
+ */
+
+extern Bool PsCreateGC(GCPtr pGC);
+static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
+ unsigned long *valid, PsOutPtr *psOut,
+ ColormapPtr *cMap);
+extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
+ PsOutPtr *psOut, ColormapPtr *cMap);
+extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+extern void PsChangeGC(GCPtr pGC, unsigned long changes);
+extern void PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+extern void PsDestroyGC(GCPtr pGC);
+extern void PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
+extern void PsDestroyClip(GCPtr pGC);
+extern void PsCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+extern GCPtr PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc);
+
+/*
+ * Functions in PsMisc.c
+ */
+
+extern void PsQueryBestSize(int type, short *pwidth, short *pheight,
+ ScreenPtr pScreen);
+extern Bool PsCloseScreen(int index, ScreenPtr pScreen);
+extern void PsLineAttrs(PsOutPtr psOut, GCPtr pGC, ColormapPtr cMap);
+extern int PsGetMediumDimensions(
+ XpContextPtr pCon,
+ CARD16 *pWidth,
+ CARD16 *pHeight);
+extern int PsGetReproducibleArea(
+ XpContextPtr pCon,
+ xRectangle *pRect);
+extern int PsSetImageResolution(
+ XpContextPtr pCon,
+ int imageRes,
+ Bool *status);
+
+/*
+ * Functions in PsSpans.c
+ */
+
+extern void PsFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
+ DDXPointPtr pPoints, int *pWidths, int fSorted);
+extern void PsSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ DDXPointPtr pPoints, int *pWidths, int nSpans,
+ int fSorted);
+
+/*
+ * Functions in PsArea.c
+ */
+
+extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ int imageRes, char *pImage);
+extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pImage);
+extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+extern RegionPtr PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane);
+
+/*
+ * Functions in PsPixel.c
+ */
+
+extern void PsPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int nPoints, xPoint *pPoints);
+extern void PsPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
+ int width, int height, int x, int y);
+
+/*
+ * Functions in PsLine.c
+ */
+
+extern void PsPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int nPoints, xPoint *pPoints);
+extern void PsPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments);
+
+/*
+ * Functions in PsPolygon.c
+ */
+
+extern void PsPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRects,
+ xRectangle *pRects);
+extern void PsFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int nPoints, DDXPointPtr pPoints);
+extern void PsPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRects,
+ xRectangle *pRects);
+
+/*
+ * Functions in PsPolygon.c
+ */
+
+extern void PsPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
+ xArc *pArcs);
+extern void PsPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
+ xArc *pArcs);
+
+/*
+ * Functions in PsText.c
+ */
+
+extern int PsPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *string);
+extern int PsPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, unsigned short *string);
+extern void PsImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *string);
+extern void PsImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, unsigned short *string);
+extern void PsImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+extern void PsPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+
+/*
+ * Functions in PsWindow.c
+ */
+
+extern Bool PsCreateWindow(WindowPtr pWin);
+extern Bool PsMapWindow(WindowPtr pWin);
+extern Bool PsPositionWindow(WindowPtr pWin, int x, int y);
+extern Bool PsUnmapWindow(WindowPtr pWin);
+extern void PsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+extern Bool PsChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+extern void PsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
+extern Bool PsDestroyWindow(WindowPtr pWin);
+
+/*
+ * Functions in PsFonts.c
+ */
+
+extern Bool PsRealizeFont(ScreenPtr pscr, FontPtr pFont);
+extern Bool PsUnrealizeFont(ScreenPtr pscr, FontPtr pFont);
+extern char *PsGetFontName(FontPtr pFont);
+extern int PsGetFontSize(FontPtr pFont, float *mtx);
+extern char *PsGetPSFontName(FontPtr pFont);
+extern int PsIsISOLatin1Encoding(FontPtr pFont);
+
+/*
+ * Functions in PsAttr.c
+ */
+
+extern char *PsGetAttributes(XpContextPtr pCon, XPAttributes pool);
+extern char *PsGetOneAttribute(XpContextPtr pCon, XPAttributes pool,
+ char *attr);
+extern int PsAugmentAttributes(XpContextPtr pCon, XPAttributes pool,
+ char *attrs);
+extern int PsSetAttributes(XpContextPtr pCon, XPAttributes pool, char *attrs);
+
+/*
+ * Functions in PsColor.c
+ */
+
+extern Bool PsCreateColormap(ColormapPtr pColor);
+extern void PsDestroyColormap(ColormapPtr pColor);
+extern void PsInstallColormap(ColormapPtr pColor);
+extern void PsUninstallColormap(ColormapPtr pColor);
+extern int PsListInstalledColormaps(ScreenPtr pScreen, XID *pCmapList);
+extern void PsStoreColors(ColormapPtr pColor, int ndef, xColorItem *pdefs);
+extern void PsResolveColor(unsigned short *pRed, unsigned short *pGreen,
+ unsigned short *pBlue, VisualPtr pVisual);
+extern int PsGetPixelColor(ColormapPtr cMap, int pixval);
+extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
+ ColormapPtr cMap);
+
+/*
+ * Functions in PsPixmap.c
+ */
+
+extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height,
+ int depth);
+extern Bool PsDestroyPixmap(PixmapPtr pPixmap);
+extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv);
+extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable);
+extern int PsCloneDisplayElm(PixmapPtr dst,
+ DisplayElmPtr elm, DisplayElmPtr newElm,
+ int xoff, int yoff);
+extern void PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff,
+ int yoff, int x, int y, int w, int h);
+extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
+extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
+extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
+
+#endif /* _PS_H_ */
diff --git a/xc/programs/Xserver/Xprint/ps/PsArc.c b/xc/programs/Xserver/Xprint/ps/PsArc.c
new file mode 100644
index 000000000..de7f19da0
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsArc.c
@@ -0,0 +1,174 @@
+/* $TOG: PsArc.c /main/4 1998/02/10 08:17:20 barstow $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsArc.c
+** *
+** * Contents: Arc-drawing code for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include <stdio.h>
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyArcCmd;
+ elm->gc = gc;
+ elm->c.arcs.nArcs = nArcs;
+ elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc));
+ memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nArcs ; i++ )
+ {
+ PsOut_DrawArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y,
+ (int)pArcs[i].width, (int)pArcs[i].height,
+ (float)pArcs[i].angle1/64.,
+ (float)pArcs[i].angle2/64.);
+ }
+ }
+}
+
+void
+PsPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyFillArcCmd;
+ elm->gc = gc;
+ elm->c.arcs.nArcs = nArcs;
+ elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc));
+ memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsArcEnum styl;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ PsLineAttrs(psOut, pGC, cMap);
+ if( pGC->arcMode==ArcChord ) styl = PsChord;
+ else styl = PsPieSlice;
+ for( i=0 ; i<nArcs ; i++ )
+ {
+ PsOut_FillArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y,
+ (int)pArcs[i].width, (int)pArcs[i].height,
+ (float)pArcs[i].angle1/64.,
+ (float)pArcs[i].angle2/64., styl);
+ }
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsArea.c b/xc/programs/Xserver/Xprint/ps/PsArea.c
new file mode 100644
index 000000000..70feba6e1
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsArea.c
@@ -0,0 +1,281 @@
+/* $TOG: PsArea.c /main/3 1998/02/09 15:42:11 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsArea.c
+** *
+** * Contents: Image and Area functions for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, int imageRes, char *pImage)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ int size = PixmapBytePad(w, depth)*h;
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+ elm = &disp->elms[disp->nelms];
+ elm->type = PutImageCmd;
+ elm->gc = gc;
+ elm->c.image.depth = depth;
+ elm->c.image.x = x;
+ elm->c.image.y = y;
+ elm->c.image.w = w;
+ elm->c.image.h = h;
+ elm->c.image.leftPad = leftPad;
+ elm->c.image.format = format;
+ elm->c.image.res = imageRes;
+ elm->c.image.pData = (char *)xalloc(size);
+ memcpy(elm->c.image.pData, pImage, size);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i, j;
+ int r, c;
+ int swap;
+ char *pt;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ int pageRes, sw, sh;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ if (!imageRes) {
+ sw = w;
+ sh = h;
+ } else {
+ pageRes = XpGetResolution(XpGetPrintContext(requestingClient));
+ sw = (float)w * (float)pageRes / (float)imageRes + 0.5;
+ sh = (float)h * (float)pageRes / (float)imageRes + 0.5;
+ }
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ pt = (char *)(&i); i = 1; if( pt[0]=='\001' ) swap = 1; else swap = 0;
+
+ if( depth==24 )
+ {
+ PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ if( format==XYPixmap )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ char *planes[3];
+ planes[0] = pImage;
+ planes[1] = &pImage[rowsiz*h];
+ planes[2] = &pImage[rowsiz*h*2];
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt[3];
+ for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
+ for( c=0 ; c<w ; c++ )
+ {
+ for( i=0 ; i<3 ; i++ )
+ { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
+ }
+ }
+ }
+ else if( format==ZPixmap )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( c=0 ; c<w ; c++,pt+=4 )
+ {
+ if( swap )
+ {
+ char tmp[4];
+ tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
+ PsOut_OutImageBytes(psOut, 3, &tmp[1]);
+ }
+ else
+ PsOut_OutImageBytes(psOut, 3, &pt[1]);
+ }
+ }
+ }
+ else goto error;
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==8 )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( c=0 ; c<w ; c++,pt++ )
+ {
+ int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
+ char *ipt = (char *)&val;
+ if( swap )
+ {
+ char tmp[4];
+ tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ PsOut_OutImageBytes(psOut, 3, &tmp[1]);
+ }
+ else
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==1 )
+ {
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImage(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+ if( swap )
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+ else
+ iv_ = iv;
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ }
+ }
+error:
+ return;
+}
+
+void
+PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XpContextPtr pcon;
+ if (requestingClient && (pcon = XpGetPrintContext(requestingClient)))
+ PsPutScaledImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ pcon->imageRes, pImage);
+}
+
+RegionPtr
+PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
+ int width, int height, int dstx, int dsty)
+{
+ PixmapPtr src = (PixmapPtr)pSrc;
+ PixmapPtr dst = (PixmapPtr)pDst;
+
+ if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL;
+ if( pDst->type!=DRAWABLE_PIXMAP )
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL;
+ PsOut_Offset(psOut, pDst->x, pDst->y);
+ PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height);
+ PsReplayPixmap(src, pDst);
+ PsOut_EndFrame(psOut);
+ }
+ else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty,
+ width, height);
+ return NULL;
+}
+
+RegionPtr
+PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
+ int width, int height, int dstx, int dsty, unsigned long plane)
+{
+ PixmapPtr src = (PixmapPtr)pSrc;
+ PixmapPtr dst = (PixmapPtr)pDst;
+
+ if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL;
+ if( pDst->type!=DRAWABLE_PIXMAP )
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL;
+ PsOut_Offset(psOut, pDst->x, pDst->y);
+ PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height);
+ PsReplayPixmap(src, pDst);
+ PsOut_EndFrame(psOut);
+ }
+ else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty,
+ width, height);
+ return NULL;
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsAttVal.c b/xc/programs/Xserver/Xprint/ps/PsAttVal.c
new file mode 100644
index 000000000..fdc0fc13d
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsAttVal.c
@@ -0,0 +1,206 @@
+/*
+ * $XConsortium: PsAttVal.c /main/1 1996/11/16 15:24:44 rws $
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttVal.c,v 1.3 1999/03/02 11:49:25 dawes Exp $ */
+
+#include "Ps.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 300,
+ 600
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+
+
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
+};
+
+/*
+** So filtered printers that accept other raw formats can be
+** used with this driver.
+**
+** Noah Roberts (jik-)
+*/
+#if 0
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+#endif
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOid ValidInputTraysOids[] = {
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_bottom
+};
+static XpOidList ValidInputTrays = {
+ ValidInputTraysOids, XpNumber(ValidInputTraysOids)
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_number_10_envelope
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "Postscript", "2", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec PsValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xc/programs/Xserver/Xprint/ps/PsAttr.c b/xc/programs/Xserver/Xprint/ps/PsAttr.c
new file mode 100644
index 000000000..34e997449
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsAttr.c
@@ -0,0 +1,109 @@
+/* $TOG: PsAttr.c /main/3 1998/02/09 15:42:17 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsAttr.c
+** *
+** * Contents: Attribute-handling functions for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "Ps.h"
+#include "attributes.h"
+
+char *
+PsGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool)
+{
+ return XpGetAttributes(pCon, pool);
+}
+
+char *
+PsGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr)
+{
+ return XpGetOneAttribute(pCon, pool, attr);
+}
+
+int
+PsAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs)
+{
+ return XpAugmentAttributes(pCon, pool, attrs);
+}
+
+int
+PsSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs)
+{
+ return XpSetAttributes(pCon, pool, attrs);
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsColor.c b/xc/programs/Xserver/Xprint/ps/PsColor.c
new file mode 100644
index 000000000..d621d11f1
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsColor.c
@@ -0,0 +1,219 @@
+/* $TOG: PsColor.c /main/3 1998/02/09 15:42:27 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsColor.c
+** *
+** * Contents: Color routines for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "colormapst.h"
+
+Bool
+PsCreateColormap(ColormapPtr pColor)
+{
+ int i;
+ unsigned short rgb;
+ VisualPtr pVisual = pColor->pVisual;
+ Pixel pix;
+
+ if( pVisual->class==TrueColor )
+ {
+ for( i=0 ; i<pVisual->ColormapEntries ; i++ )
+ {
+ rgb = (i<<8)|i;
+
+ pColor->red[i].fShared = FALSE;
+ pColor->red[i].co.local.red = rgb;
+ pColor->red[i].co.local.green = 0;
+ pColor->red[i].co.local.blue = 0;
+
+ pColor->green[i].fShared = FALSE;
+ pColor->green[i].co.local.red = 0;
+ pColor->green[i].co.local.green = rgb;
+ pColor->green[i].co.local.blue = 0;
+
+ pColor->blue[i].fShared = FALSE;
+ pColor->blue[i].co.local.red = 0;
+ pColor->blue[i].co.local.green = 0;
+ pColor->blue[i].co.local.blue = rgb;
+ }
+ }
+ return TRUE;
+}
+
+void
+PsDestroyColormap(ColormapPtr pColor)
+{
+}
+
+void
+PsInstallColormap(ColormapPtr pColor)
+{
+ PsScreenPrivPtr pPriv =
+ (PsScreenPrivPtr)pColor->pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ pPriv->CMap = pColor;
+}
+
+void
+PsUninstallColormap(ColormapPtr pColor)
+{
+}
+
+int
+PsListInstalledColormaps(
+ ScreenPtr pScreen,
+ XID *pCmapList)
+{
+ return 0;
+}
+
+void
+PsStoreColors(
+ ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs)
+{
+ int i;
+ for( i=0 ; i<ndef ; i++ )
+ {
+ if( pdefs[i].flags&DoRed )
+ pColor->red[pdefs[i].pixel].co.local.red = pdefs[i].red;
+ if( pdefs[i].flags&DoGreen )
+ pColor->red[pdefs[i].pixel].co.local.green = pdefs[i].green;
+ if( pdefs[i].flags&DoBlue )
+ pColor->red[pdefs[i].pixel].co.local.blue = pdefs[i].blue;
+ }
+}
+
+void
+PsResolveColor(
+ unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual)
+{
+}
+
+int
+PsGetPixelColor(ColormapPtr cMap, int pixval)
+{
+ int r, g, b;
+ if( cMap->pVisual->class==TrueColor ) return(pixval);
+ if( pixval<0 || pixval>255 ) return(0);
+ r = cMap->red[pixval].co.local.red>>8;
+ g = cMap->red[pixval].co.local.green>>8;
+ b = cMap->red[pixval].co.local.blue>>8;
+ return((r<<16)|(g<<8)|b);
+}
+
+void
+PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
+ ColormapPtr cMap)
+{
+ switch(pGC->fillStyle)
+ {
+ case FillSolid:
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ break;
+ case FillTiled:
+ if( !PsOut_BeginPattern(psOut, pGC->tile.pixmap,
+ pGC->tile.pixmap->drawable.width,
+ pGC->tile.pixmap->drawable.height, PsTile, 0, 0) )
+ {
+ PsReplayPixmap(pGC->tile.pixmap, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->tile.pixmap, PsTile);
+ break;
+ case FillStippled:
+ if( !PsOut_BeginPattern(psOut, pGC->stipple,
+ pGC->stipple->drawable.width,
+ pGC->stipple->drawable.height, PsStip, 0,
+ PsGetPixelColor(cMap, pGC->fgPixel)) )
+ {
+ PsReplayPixmap(pGC->stipple, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->stipple, PsStip);
+ break;
+ case FillOpaqueStippled:
+ if( !PsOut_BeginPattern(psOut, pGC->stipple,
+ pGC->stipple->drawable.width,
+ pGC->stipple->drawable.height, PsOpStip,
+ PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel)) )
+ {
+ PsReplayPixmap(pGC->stipple, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->stipple, PsOpStip);
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsDef.h b/xc/programs/Xserver/Xprint/ps/PsDef.h
new file mode 100644
index 000000000..3751f7190
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsDef.h
@@ -0,0 +1,89 @@
+/* $TOG: PsDef.h /main/3 1998/02/09 15:42:31 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsDef.h
+** *
+** * Contents: extran defines and includes for the Ps driver
+** * for a printing X server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+#ifndef _PSDEF_H_
+#define _PSDEF_H_
+
+#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER"
+#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER"
+#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND"
+#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND"
+#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION"
+#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER"
+#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER"
+#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND"
+
+#define DT_IN_FILE_STRING "%(InFile)%"
+#define DT_OUT_FILE_STRING "%(OutFile)%"
+#define DT_ALLOWED_COMMANDS_FILE "printCommands"
+
+#endif /* _PSDEF_H_ */
diff --git a/xc/programs/Xserver/Xprint/ps/PsFonts.c b/xc/programs/Xserver/Xprint/ps/PsFonts.c
new file mode 100644
index 000000000..2b1773e58
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsFonts.c
@@ -0,0 +1,181 @@
+/* $TOG: PsFonts.c /main/3 1998/02/09 15:42:34 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsFonts.c
+** *
+** * Contents: Font code for PS driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "miscstruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include "fontxlfd.h"
+
+#include "Ps.h"
+
+Bool
+PsRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+Bool
+PsUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+char *
+PsGetFontName(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom name = MakeAtom("FONT", 4, True);
+ Atom value = (Atom)0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( props[i].name==name )
+ { value = props[i].value; break; }
+ }
+ if( !value ) return (char *)0;
+ return NameForAtom(value);
+}
+
+int
+PsGetFontSize(FontPtr pFont, float *mtx)
+{
+ FontScalableRec vals;
+ char *name = PsGetFontName(pFont);
+ int value = 0;
+
+ FontParseXLFDName(name, &vals, FONT_XLFD_REPLACE_NONE);
+ if( vals.values_supplied&PIXELSIZE_ARRAY )
+ {
+ int i;
+ for( i=0 ; i<4 ; i++ )
+ mtx[i] = (float)vals.pixel_matrix[i];
+ }
+ else
+ {
+ value = vals.pixel;
+ if( !value ) value = 20;
+ }
+ return value;
+}
+
+char *
+PsGetPSFontName(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom name = MakeAtom("_ADOBE_POSTSCRIPT_FONTNAME", 26, True);
+ Atom value = (Atom)0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( props[i].name==name )
+ { value = props[i].value; break; }
+ }
+ if( !value ) return "Times-Roman";
+ return NameForAtom(value);
+}
+
+int
+PsIsISOLatin1Encoding(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True);
+ Atom enc = MakeAtom("CHARSET_ENCODING", 16, True);
+ Atom rv = 0, ev = 0;
+ char *rp = 0;
+ char *ep = 0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( props[i].name==reg ) rv = props[i].value;
+ if( props[i].name==enc ) ev = props[i].value;
+ }
+ if( rv ) rp = NameForAtom(rv);
+ if( ev ) ep = NameForAtom(ev);
+ if( (!rp) || (!ep) ) return(0);
+ if( (char)tolower(rp[0])!='i' ||
+ (char)tolower(rp[1])!='s' ||
+ (char)tolower(rp[2])!='o' ||
+ memcmp(&rp[3], "8859", 4)!=0 ||
+ ep[0]!='1' ) return(0);
+ return(1);
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsGC.c b/xc/programs/Xserver/Xprint/ps/PsGC.c
new file mode 100644
index 000000000..4879ea1dd
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsGC.c
@@ -0,0 +1,376 @@
+/* $TOG: PsGC.c /main/4 1998/02/09 15:42:38 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsGC.c
+** *
+** * Contents: Graphics Context handling for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "migc.h"
+#include "scrnintstr.h"
+
+static GCOps PsGCOps =
+{
+ PsFillSpans,
+ PsSetSpans,
+ PsPutImage,
+ PsCopyArea,
+ PsCopyPlane,
+ PsPolyPoint,
+ PsPolyLine,
+ PsPolySegment,
+ PsPolyRectangle,
+ PsPolyArc,
+ PsFillPolygon,
+ PsPolyFillRect,
+ PsPolyFillArc,
+ PsPolyText8,
+ PsPolyText16,
+ PsImageText8,
+ PsImageText16,
+ PsImageGlyphBlt,
+ PsPolyGlyphBlt,
+ PsPushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+
+static GCFuncs PsGCFuncs =
+{
+ PsValidateGC,
+ PsChangeGC,
+ PsCopyGC,
+ PsDestroyGC,
+ PsChangeClip,
+ PsDestroyClip,
+ PsCopyClip
+};
+
+Bool
+PsCreateGC(pGC)
+ GCPtr pGC;
+{
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ pGC->ops = &PsGCOps;
+ pGC->funcs = &PsGCFuncs;
+
+ pGC->clientClip = (pointer)xalloc(sizeof(PsClipRec));
+ memset(pGC->clientClip, 0, sizeof(PsClipRec));
+ return TRUE;
+}
+
+static int
+PsGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ PsOutPtr *psOut,
+ ColormapPtr *cMap)
+{
+ XpContextPtr pCon;
+ PsPixmapPrivPtr pPriv;
+ PsContextPrivPtr cPriv;
+ PsScreenPrivPtr sPriv;
+
+ switch(pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+ return FALSE;
+ case DRAWABLE_WINDOW:
+ pCon = PsGetContextFromWindow((WindowPtr)pDrawable);
+ if( pCon==NULL ) return FALSE;
+ else
+ {
+ cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
+ sPriv = (PsScreenPrivPtr)
+ pDrawable->pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ *gc = cPriv->lastGC;
+ *valid = cPriv->validGC;
+ *psOut = cPriv->pPsOut;
+ *cMap = sPriv->CMap;
+ return TRUE;
+ }
+ default:
+ return FALSE;
+ }
+}
+
+int
+PsUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ PsOutPtr *psOut,
+ ColormapPtr *cMap)
+{
+ GC dGC;
+ unsigned long valid;
+ int i;
+ PsContextPrivPtr cPriv;
+ BoxPtr boxes;
+
+ if (!PsGetDrawablePrivateStuff(pDrawable, &dGC, &valid, psOut, cMap))
+ return FALSE;
+
+ switch (pDrawable->type) {
+
+ case DRAWABLE_PIXMAP:
+ /* we don't support pixmaps yet! */
+ return FALSE;
+ break;
+ case DRAWABLE_WINDOW:
+ if( pGC )
+ {
+ RegionPtr pReg;
+ WindowPtr pWin = (WindowPtr)pDrawable;
+ Bool freeClip;
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+ if( clp->outterClips )
+ { xfree(clp->outterClips); clp->outterClips = 0; }
+ clp->nOutterClips = 0;
+ if( pGC->subWindowMode==IncludeInferiors )
+ {
+ pReg = NotClippedByChildren(pWin);
+ freeClip = TRUE;
+ }
+ else
+ {
+ pReg = &pWin->clipList;
+ freeClip = FALSE;
+ }
+
+ if( pReg->data )
+ {
+ boxes = (BoxPtr)((char *)pReg->data+sizeof(long)*2);
+ clp->nOutterClips = pReg->data->numRects;
+ clp->outterClips =
+ (PsRectPtr)xalloc(clp->nOutterClips*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nOutterClips ; i++ )
+ {
+ clp->outterClips[i].x = boxes[i].x1;
+ clp->outterClips[i].y = boxes[i].y1;
+ clp->outterClips[i].w = (boxes[i].x2-boxes[i].x1)+1;
+ clp->outterClips[i].h = (boxes[i].y2-boxes[i].y1)+1;
+ }
+ }
+
+ if( freeClip ) (*pGC->pScreen->RegionDestroy)(pReg);
+ PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
+ PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
+ }
+ cPriv = ( PsGetContextFromWindow( (WindowPtr)pDrawable ) )
+ ->devPrivates[PsContextPrivateIndex].ptr;
+ break;
+ }
+ return TRUE;
+}
+
+void
+PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ pGC->ops = &PsGCOps;
+}
+
+void
+PsChangeGC(GCPtr pGC, unsigned long changes)
+{
+}
+
+void
+PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+}
+
+void
+PsDestroyGC(GCPtr pGC)
+{
+ PsDestroyClip(pGC);
+ xfree(pGC->clientClip);
+}
+
+void
+PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
+{
+ int i;
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+ RegionPtr rgn;
+ BoxPtr boxes;
+ xRectangle *rects;
+
+ PsDestroyClip(pGC);
+ pGC->clientClipType = type;
+ switch(type)
+ {
+ case CT_NONE: break;
+ case CT_PIXMAP:
+ clp->elms = PsCreateFillElementList((PixmapPtr)pValue, &clp->nElms);
+ (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
+ break;
+ case CT_REGION:
+ rgn = (RegionPtr)pValue;
+ boxes = (BoxPtr)((char *)rgn->data+sizeof(long)*2);
+ clp->nRects = rgn->data->numRects;
+ clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nRects ; i++ )
+ {
+ clp->rects[i].x = boxes[i].x1;
+ clp->rects[i].y = boxes[i].y1;
+ clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1;
+ clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1;
+ }
+ (*pGC->pScreen->RegionDestroy)((RegionPtr)pValue);
+ break;
+ case CT_UNSORTED:
+ case CT_YSORTED:
+ case CT_YXSORTED:
+ case CT_YXBANDED:
+ rects = (xRectangle *)pValue;
+ clp->nRects = nrects;
+ clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nRects ; i++ )
+ {
+ clp->rects[i].x = rects[i].x;
+ clp->rects[i].y = rects[i].y;
+ clp->rects[i].w = rects[i].width;
+ clp->rects[i].h = rects[i].height;
+ }
+ xfree(pValue);
+ break;
+ }
+}
+
+void
+PsDestroyClip(GCPtr pGC)
+{
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+
+ if( clp->rects ) xfree(clp->rects);
+ if( clp->outterClips ) xfree(clp->outterClips);
+ clp->rects = (PsRectPtr)0;
+ clp->outterClips = (PsRectPtr)0;
+ clp->nRects = 0;
+ clp->nOutterClips = 0;
+ if( clp->elms ) PsDestroyFillElementList(clp->nElms, clp->elms);
+ clp->elms = (PsElmPtr)0;
+ clp->nElms = 0;
+ pGC->clientClipType = CT_NONE;
+}
+
+void
+PsCopyClip(GCPtr pDst, GCPtr pSrc)
+{
+ PsClipPtr src = (PsClipPtr)pSrc->clientClip;
+ PsClipPtr dst = (PsClipPtr)pDst->clientClip;
+
+ PsDestroyClip(pDst);
+ pDst->clientClipType = pSrc->clientClipType;
+ *dst = *src;
+ if( src->rects )
+ {
+ dst->rects = (PsRectPtr)xalloc(src->nRects*sizeof(PsRectRec));
+ memcpy(dst->rects, src->rects, src->nRects*sizeof(PsRectRec));
+ }
+ if( src->elms )
+ dst->elms = PsCloneFillElementList(src->nElms, src->elms);
+}
+
+
+GCPtr
+PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc)
+{
+ GCPtr pDst;
+
+ if ((pDst =
+ CreateScratchGC(pDrawable->pScreen, pDrawable->depth)) == NULL)
+ {
+ return NULL;
+ }
+
+ if (CopyGC(pSrc, pDst,
+ GCFunction | GCPlaneMask | GCForeground | GCBackground |
+ GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle |
+ GCFillStyle | GCFillRule | GCTile | GCStipple |
+ GCTileStipXOrigin | GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask | GCDashOffset | GCDashList |
+ GCArcMode) != Success)
+ {
+ (void)FreeGC(pDst, (GContext)0);
+
+ return NULL;
+ }
+
+ return pDst;
+}
+
diff --git a/xc/programs/Xserver/Xprint/ps/PsInit.c b/xc/programs/Xserver/Xprint/ps/PsInit.c
new file mode 100644
index 000000000..f64d1679a
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsInit.c
@@ -0,0 +1,405 @@
+/* $TOG: PsInit.c /main/6 1998/02/09 15:42:43 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsInit.c
+** *
+** * Contents: Initialization code of Ps driver for the print server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsInit.c,v 1.7 1998/10/04 09:37:26 dawes Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include "Ps.h"
+#include "AttrValid.h"
+#include "../../mfb/mfb.h"
+
+#include "windowstr.h"
+
+static void AllocatePsPrivates(ScreenPtr pScreen);
+static int PsInitContext(XpContextPtr pCon);
+
+extern Bool _XpBoolNoop();
+extern void _XpVoidNoop();
+extern Bool cfbCreateDefColormap(ScreenPtr pScreen);
+
+int PsScreenPrivateIndex;
+int PsContextPrivateIndex;
+int PsPixmapPrivateIndex;
+int PsWindowPrivateIndex;
+
+Bool
+InitializePsDriver(ndx, pScreen, argc, argv)
+ int ndx;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+ int maxXres, maxYres, maxWidth, maxHeight;
+ int maxRes, maxDim, numBytes;
+ PsScreenPrivPtr pPriv;
+ char **printerNames;
+ int numPrinters;
+ int nVisuals;
+ int nDepths;
+ VisualPtr visuals;
+ DepthPtr depths;
+
+/*
+ * Register this driver's InitContext function with the print
+ * extension.
+ */
+ XpRegisterInitFunc(pScreen, "XP-POSTSCRIPT", PsInitContext);
+
+/*
+ * Create and fill in the devPrivate for the PS driver.
+ */
+ AllocatePsPrivates(pScreen);
+
+ pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+/*pPriv->resDB = rmdb;*/
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+ pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
+ pScreen->SaveScreen = _XpBoolNoop;
+ pScreen->GetImage = _XpVoidNoop;
+ pScreen->GetSpans = _XpVoidNoop;
+ pScreen->CreateWindow = PsCreateWindow;
+ pScreen->DestroyWindow = PsDestroyWindow;
+ pScreen->PositionWindow = PsPositionWindow;
+ pScreen->ChangeWindowAttributes = PsChangeWindowAttributes;
+ pScreen->RealizeWindow = PsMapWindow;
+ pScreen->UnrealizeWindow = PsUnmapWindow;
+ pScreen->PaintWindowBackground = PsPaintWindow;
+ pScreen->PaintWindowBorder = PsPaintWindow;
+ pScreen->CloseScreen = PsCloseScreen;
+ pScreen->CopyWindow = PsCopyWindow;
+ /* XXX Hard routine to write! */
+
+/*
+ * These two are going to be VERY different...
+ */
+ pScreen->CreatePixmap = PsCreatePixmap;
+ pScreen->DestroyPixmap = PsDestroyPixmap;
+ pScreen->RealizeFont = PsRealizeFont;
+ pScreen->UnrealizeFont = PsUnrealizeFont;
+ pScreen->CreateGC = PsCreateGC;
+ pScreen->CreateColormap = PsCreateColormap;
+ pScreen->DestroyColormap = PsDestroyColormap;
+ pScreen->InstallColormap = PsInstallColormap;
+ pScreen->UninstallColormap = PsUninstallColormap;
+ pScreen->ListInstalledColormaps = PsListInstalledColormaps;
+ pScreen->StoreColors = PsStoreColors;
+ pScreen->ResolveColor = PsResolveColor;
+ /* Will BitmapToRegion make any difference at all? */
+ pScreen->BitmapToRegion = mfbPixmapToRegion;
+
+ nVisuals = 2;
+ nDepths = 2;
+ visuals = (VisualPtr)xalloc(nVisuals*sizeof(VisualRec));
+ depths = (DepthPtr) xalloc(nDepths*sizeof(DepthRec));
+
+ visuals[0].vid = FakeClientID(0);
+ visuals[0].class = TrueColor;
+ visuals[0].bitsPerRGBValue = 8;
+ visuals[0].ColormapEntries = 256;
+ visuals[0].nplanes = 24;
+ visuals[0].redMask = 0x00FF0000;
+ visuals[0].greenMask = 0x0000FF00;
+ visuals[0].blueMask = 0x000000FF;
+ visuals[0].offsetRed = 16;
+ visuals[0].offsetGreen = 8;
+ visuals[0].offsetBlue = 0;
+
+ visuals[1].vid = FakeClientID(0);
+ visuals[1].class = PseudoColor;
+ visuals[1].bitsPerRGBValue = 0;
+ visuals[1].ColormapEntries = 256;
+ visuals[1].nplanes = 8;
+ visuals[1].redMask = 0x0;
+ visuals[1].greenMask = 0x0;
+ visuals[1].blueMask = 0x0;
+ visuals[1].offsetRed = 0x0;
+ visuals[1].offsetGreen = 0x0;
+ visuals[1].offsetBlue = 0x0;
+
+ depths[0].depth = 24;
+ depths[0].numVids = 1;
+ depths[0].vids = &visuals[0].vid;
+
+ depths[1].depth = 8;
+ depths[1].numVids = 1;
+ depths[1].vids = &visuals[1].vid;
+
+/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 24 BIT */
+/* miScreenInit(pScreen, (pointer)0,
+ pScreen->width, pScreen->height,
+ pScreen->width / (pScreen->mmWidth / 25.40),
+ pScreen->height / (pScreen->mmHeight / 25.40),
+ 0, 24, nDepths,
+ depths, visuals[1].vid, nVisuals, visuals); */
+
+/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 8 BIT */
+ miScreenInit(pScreen, (pointer)0,
+ pScreen->width, pScreen->height,
+ (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
+ (int) (pScreen->height / (pScreen->mmHeight / 25.40)),
+ 0, 8, nDepths,
+ depths, visuals[1].vid, nVisuals, visuals);
+
+ if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
+
+/*scalingScreenInit(pScreen);*/
+
+ return TRUE;
+}
+
+static void
+AllocatePsPrivates(ScreenPtr pScreen)
+{
+ static int PsGeneration = -1;
+
+ if(PsGeneration != serverGeneration)
+ {
+ PsScreenPrivateIndex = AllocateScreenPrivateIndex();
+
+ PsWindowPrivateIndex = AllocateWindowPrivateIndex();
+ AllocateWindowPrivate(pScreen, PsWindowPrivateIndex,
+ sizeof(PsWindowPrivRec));
+
+ PsContextPrivateIndex = XpAllocateContextPrivateIndex();
+ XpAllocateContextPrivate(PsContextPrivateIndex,
+ sizeof(PsContextPrivRec));
+
+ PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
+ AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
+ sizeof(PsPixmapPrivRec));
+
+ PsGeneration = serverGeneration;
+ }
+ pScreen->devPrivates[PsScreenPrivateIndex].ptr =
+ (pointer)xalloc(sizeof(PsScreenPrivRec));
+}
+
+/*
+ * PsInitContext
+ *
+ * Establish the appropriate values for a PrintContext used with the PS
+ * driver.
+ */
+
+static char DOC_ATT_SUPP[]="document-attributes-supported";
+static char DOC_ATT_VAL[]="document-format";
+static char JOB_ATT_SUPP[]="job-attributes-supported";
+static char JOB_ATT_VAL[]="";
+static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
+static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
+default-input-tray default-medium plex";
+
+static int
+PsInitContext(pCon)
+ XpContextPtr pCon;
+{
+ XpDriverFuncsPtr pFuncs;
+ PsContextPrivPtr pConPriv;
+ char *server, *attrStr;
+ extern XpValidatePoolsRec PsValidatePoolsRec;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes(pCon);
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &(pCon->funcs);
+ pFuncs->StartJob = PsStartJob;
+ pFuncs->EndJob = PsEndJob;
+ pFuncs->StartDoc = PsStartDoc;
+ pFuncs->EndDoc = PsEndDoc;
+ pFuncs->StartPage = PsStartPage;
+ pFuncs->EndPage = PsEndPage;
+ pFuncs->PutDocumentData = PsDocumentData;
+ pFuncs->GetDocumentData = PsGetDocumentData;
+ pFuncs->GetAttributes = (char *(*)())PsGetAttributes;
+ pFuncs->SetAttributes = (int (*)())PsSetAttributes;
+ pFuncs->AugmentAttributes = (int (*)())PsAugmentAttributes;
+ pFuncs->GetOneAttribute = (char *(*)())PsGetOneAttribute;
+ pFuncs->DestroyContext = PsDestroyContext;
+ pFuncs->GetMediumDimensions = PsGetMediumDimensions;
+ pFuncs->GetReproducibleArea = PsGetReproducibleArea;
+ pFuncs->SetImageResolution = PsSetImageResolution;
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+
+ /*
+ * document-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) +
+ strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
+ + strlen(PAGE_ATT_VAL) + 6)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s %s",
+ DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * job-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) + strlen(JOB_ATT_SUPP) +
+ strlen(JOB_ATT_VAL) + 4)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * xp-page-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) +
+ strlen(PAGE_ATT_VAL) + 4)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * Validate the attribute pools
+ */
+ XpValidateAttributePool(pCon, XPPrinterAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPDocAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPJobAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPPageAttr, &PsValidatePoolsRec);
+
+ return Success;
+}
+
+static Bool
+PsDestroyContext(pCon)
+ XpContextPtr pCon;
+{
+ PsContextPrivPtr pConPriv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+
+ if( pConPriv->pJobFile!=(FILE *)NULL )
+ {
+ fclose(pConPriv->pJobFile);
+ pConPriv->pJobFile = NULL;
+ }
+ if( pConPriv->jobFileName!=(char *)NULL )
+ {
+ unlink(pConPriv->jobFileName);
+ xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+/*### free up visuals/depths ###*/
+
+ return Success;
+}
+
+XpContextPtr
+PsGetContextFromWindow(win)
+ WindowPtr win;
+{
+ PsWindowPrivPtr pPriv;
+
+ while( win )
+ {
+ pPriv = (PsWindowPrivPtr)win->devPrivates[PsWindowPrivateIndex].ptr;
+ if( pPriv->validContext ) return pPriv->context;
+ win = win->parent;
+ }
+
+ return NULL;
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsLine.c b/xc/programs/Xserver/Xprint/ps/PsLine.c
new file mode 100644
index 000000000..c9abce1ee
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsLine.c
@@ -0,0 +1,185 @@
+/* $TOG: PsLine.c /main/4 1998/02/09 15:42:47 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsLine.c
+** *
+** * Contents: Line drawing routines for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsLine.c,v 1.4 1998/10/04 09:37:27 dawes Exp $ */
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyLineCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Lines(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolySegmentCmd;
+ elm->gc = gc;
+ elm->c.segments.nSegments = nSegments;
+ elm->c.segments.pSegments = (xSegment *)xalloc(nSegments*sizeof(xSegment));
+ memcpy(elm->c.segments.pSegments, pSegments, nSegments*sizeof(xSegment));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointRec pts[2];
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nSegments ; i++ )
+ {
+ pts[0].x = pSegments[i].x1;
+ pts[0].y = pSegments[i].y1;
+ pts[1].x = pSegments[i].x2;
+ pts[1].y = pSegments[i].y2;
+ PsOut_Lines(psOut, 2, pts);
+ }
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsMisc.c b/xc/programs/Xserver/Xprint/ps/PsMisc.c
new file mode 100644
index 000000000..61856db53
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsMisc.c
@@ -0,0 +1,317 @@
+/* $TOG: PsMisc.c /main/5 1998/02/09 15:42:51 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsMisc.c
+** *
+** * Contents: Miscellaneous code for Ps driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsMisc.c,v 1.4 1998/10/04 09:37:27 dawes Exp $ */
+
+#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
+#include <stdio.h>
+#include "Ps.h"
+
+#include "cursor.h"
+#include "resource.h"
+
+#include "windowstr.h"
+#include "propertyst.h"
+
+
+/*ARGSUSED*/
+void
+PsQueryBestSize(
+ int type,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen)
+{
+ unsigned width, highBit;
+
+ switch(type)
+ {
+ case CursorShape:
+ *pwidth = 0;
+ *pheight = 0;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the nearest power of two >= what they gave us */
+ highBit = 0x80000000;
+ /* Find the highest 1 bit in the given width */
+ while(!(highBit & width))
+ highBit >>= 1;
+ /* If greater than that then return the next power of two */
+ if((highBit - 1) & width)
+ highBit <<= 1;
+ *pwidth = highBit;
+ /* height is a don't-care */
+ break;
+ }
+}
+
+/*
+ * PsGetMediumDimensions is installed in the GetMediumDimensions field
+ * of each Ps-initialized context.
+ */
+int
+PsGetMediumDimensions(XpContextPtr pCon, CARD16 *width, CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * PsGetReproducibleArea is installed in the GetReproducibleArea field
+ * of each Ps-initialized context.
+ */
+int
+PsGetReproducibleArea(XpContextPtr pCon, xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
+
+/*
+ * PsSetImageResolution is installed in the SetImageResolution field
+ * of each Ps-initialized context.
+ */
+int
+PsSetImageResolution(XpContextPtr pCon, int imageRes, Bool *status)
+{
+ pCon->imageRes = imageRes;
+ *status = True;
+ return Success;
+}
+
+/*
+ * GetPropString searches the window heirarchy from pWin up looking for
+ * a property by the name of propName. If found, returns the property's
+ * value. If not, it returns NULL.
+ */
+/*
+char *
+GetPropString(
+ WindowPtr pWin,
+ char *propName)
+{
+ Atom atom;
+ PropertyPtr pProp = (PropertyPtr)NULL;
+ char *retVal;
+
+ atom = MakeAtom(propName, strlen(propName), FALSE);
+ if(atom != BAD_RESOURCE)
+ {
+ WindowPtr pPropWin;
+ int n;
+*/
+
+ /*
+ * The atom has been defined, but it might only exist as a
+ * property on an unrelated window.
+ */
+/*
+ for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
+ pPropWin = pPropWin->parent)
+ {
+ for(pProp = (PropertyPtr)(wUserProps(pPropWin));
+ pProp != (PropertyPtr)NULL;
+ pProp = pProp->next)
+ {
+ if (pProp->propertyName == atom)
+ break;
+ }
+ if(pProp != (PropertyPtr)NULL)
+ break;
+ }
+ if(pProp == (PropertyPtr)NULL)
+ return (char *)NULL;
+
+ n = (pProp->format/8) * pProp->size; *//* size (bytes) of prop */
+/*
+ retVal = (char *)xalloc(n + 1);
+ (void)memcpy((void *)retVal, (void *)pProp->data, n);
+ retVal[n] = '\0';
+
+ return retVal;
+ }
+
+ return (char *)NULL;
+}
+
+#include <signal.h>
+
+*/
+/* ARGSUSED */
+/*
+static void SigchldHndlr (int dummy)
+{
+ int status, w;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ w = wait (&status);
+
+*/
+ /*
+ * Is this really necessary?
+ */
+/*
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+}
+*/
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+/*
+int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+*/
+ /*
+ * get the old handler, and set the action to IGN
+ */
+/*
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+*/
+
+Bool
+PsCloseScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+void
+PsLineAttrs(
+ PsOutPtr psOut,
+ GCPtr pGC,
+ ColormapPtr cMap)
+{
+ int i;
+ int nDsh;
+ int dshOff;
+ int *dsh;
+ PsCapEnum cap;
+ PsJoinEnum join;
+
+ switch(pGC->capStyle) {
+ case CapButt: cap = PsCButt; break;
+ case CapRound: cap = PsCRound; break;
+ case CapProjecting: cap = PsCSquare; break;
+ default: cap = PsCButt; break; }
+ switch(pGC->joinStyle) {
+ case JoinMiter: join = PsJMiter; break;
+ case JoinRound: join = PsJRound; break;
+ case JoinBevel: join = PsJBevel; break;
+ default: join = PsJBevel; break; }
+ if( pGC->lineStyle==LineSolid ) { nDsh = dshOff = 0; dsh = (int *)0; }
+ else
+ {
+ nDsh = pGC->numInDashList;
+ dshOff = pGC->dashOffset;
+ if( !nDsh ) dsh = (int *)0;
+ else
+ {
+ dsh = (int *)xalloc(sizeof(int)*nDsh);
+ for( i=0 ; i<nDsh ; i++ ) dsh[i] = (int)pGC->dash[i]&0xFF;
+ }
+ }
+
+ if( pGC->lineStyle!=LineDoubleDash )
+ PsOut_LineAttrs(psOut, (int)pGC->lineWidth,
+ cap, join, nDsh, dsh, dshOff, -1);
+ else
+ PsOut_LineAttrs(psOut, (int)pGC->lineWidth,
+ cap, join, nDsh, dsh, dshOff,
+ PsGetPixelColor(cMap, pGC->bgPixel));
+ if( nDsh && dsh ) xfree(dsh);
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsPixel.c b/xc/programs/Xserver/Xprint/ps/PsPixel.c
new file mode 100644
index 000000000..e28b6c6e6
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsPixel.c
@@ -0,0 +1,150 @@
+/* $TOG: PsPixel.c /main/4 1998/02/09 15:43:05 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPixel.c
+** *
+** * Contents: Pixel-drawing code for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1995 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixel.c,v 1.4 1998/10/04 09:37:28 dawes Exp $ */
+
+#include <stdio.h>
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Ps.h"
+
+void
+PsPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyPointCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Points(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int width,
+ int height,
+ int x,
+ int y)
+{
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsPixmap.c b/xc/programs/Xserver/Xprint/ps/PsPixmap.c
new file mode 100644
index 000000000..d49c3f683
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsPixmap.c
@@ -0,0 +1,589 @@
+/* $TOG: PsPixmap.c /main/3 1998/02/09 15:43:09 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixmap.c,v 1.2 1999/01/31 12:21:40 dawes Exp $ */
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPixmap.c
+** *
+** * Contents: Pixmap functions for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1995 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Ps.h"
+
+PixmapPtr
+PsCreatePixmap(
+ ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth)
+{
+ PixmapPtr pPixmap;
+
+ pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec));
+ if( !pPixmap) return NullPixmap;
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+
+ pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xalloc(sizeof(PsPixmapPrivRec));
+ if( !pPixmap->devPrivate.ptr )
+ { xfree(pPixmap); return NullPixmap; }
+ memset(pPixmap->devPrivate.ptr, 0, sizeof(PsPixmapPrivRec));
+ return pPixmap;
+}
+
+Bool
+PsDestroyPixmap(PixmapPtr pPixmap)
+{
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+
+ if( --pPixmap->refcnt ) return TRUE;
+ while( disp )
+ {
+ int i;
+ DisplayListPtr oldDisp = disp;
+ disp = disp->next;
+ for( i=0 ; i<oldDisp->nelms ; i++ )
+ {
+ DisplayElmPtr elm = &oldDisp->elms[i];
+
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ case PolyLineCmd:
+ if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints);
+ break;
+ case PolySegmentCmd:
+ if( elm->c.segments.pSegments ) xfree(elm->c.segments.pSegments);
+ break;
+ case PolyRectangleCmd:
+ if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects);
+ break;
+ case FillPolygonCmd:
+ if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints);
+ break;
+ case PolyFillRectCmd:
+ if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects);
+ break;
+ case PolyArcCmd:
+ if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs);
+ break;
+ case PolyFillArcCmd:
+ if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs);
+ break;
+ case Text8Cmd:
+ case TextI8Cmd:
+ if( elm->c.text8.string ) xfree(elm->c.text8.string);
+ break;
+ case Text16Cmd:
+ case TextI16Cmd:
+ if( elm->c.text16.string ) xfree(elm->c.text16.string);
+ break;
+ case PutImageCmd:
+ if( elm->c.image.pData ) xfree(elm->c.image.pData);
+ break;
+ case BeginFrameCmd:
+ break;
+ case EndFrameCmd:
+ break;
+ }
+
+ if (elm->type != BeginFrameCmd && elm->type != EndFrameCmd) {
+ (void) FreeGC(elm->gc, (GContext) 0);
+ }
+ }
+ xfree(oldDisp);
+ }
+ xfree(priv);
+ xfree(pPixmap);
+ return TRUE;
+}
+
+DisplayListPtr
+PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
+{
+ DisplayListPtr disp = priv->dispList;
+
+ for(; disp ; disp=disp->next )
+ {
+ if( disp->nelms>=DPY_BLOCKSIZE && disp->next ) continue;
+ if( disp->nelms<DPY_BLOCKSIZE ) return(disp);
+ disp->next = (DisplayListPtr)xalloc(sizeof(DisplayListRec));
+ disp->next->next = (DisplayListPtr)0;
+ disp->next->nelms = 0;
+ }
+ disp = (DisplayListPtr)xalloc(sizeof(DisplayListRec));
+ disp->next = (DisplayListPtr)0;
+ disp->nelms = 0;
+ priv->dispList = disp;
+ return(disp);
+}
+
+void
+PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
+{
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ PsPolyPoint(pDrawable, elm->gc, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolyLineCmd:
+ PsPolyLine(pDrawable, elm->gc, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolySegmentCmd:
+ PsPolySegment(pDrawable, elm->gc, elm->c.segments.nSegments,
+ elm->c.segments.pSegments);
+ break;
+ case PolyRectangleCmd:
+ PsPolyRectangle(pDrawable, elm->gc, elm->c.rects.nRects,
+ elm->c.rects.pRects);
+ break;
+ case FillPolygonCmd:
+ PsFillPolygon(pDrawable, elm->gc, 0, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolyFillRectCmd:
+ PsPolyFillRect(pDrawable, elm->gc, elm->c.rects.nRects,
+ elm->c.rects.pRects);
+ break;
+ case PolyArcCmd:
+ PsPolyArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs);
+ break;
+ case PolyFillArcCmd:
+ PsPolyFillArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs);
+ break;
+ case Text8Cmd:
+ PsPolyText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y,
+ elm->c.text8.count, elm->c.text8.string);
+ break;
+ case Text16Cmd:
+ PsPolyText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y,
+ elm->c.text16.count, elm->c.text16.string);
+ break;
+ case TextI8Cmd:
+ PsImageText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y,
+ elm->c.text8.count, elm->c.text8.string);
+ break;
+ case TextI16Cmd:
+ PsImageText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y,
+ elm->c.text16.count, elm->c.text16.string);
+ break;
+ case PutImageCmd:
+ PsPutScaledImage(pDrawable, elm->gc, elm->c.image.depth,
+ elm->c.image.x, elm->c.image.y,
+ elm->c.image.w, elm->c.image.h, elm->c.image.leftPad,
+ elm->c.image.format, elm->c.image.res,
+ elm->c.image.pData);
+ break;
+ case BeginFrameCmd:
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_BeginFrame(psOut, 0, 0, elm->c.frame.x, elm->c.frame.y,
+ elm->c.frame.w, elm->c.frame.h);
+ }
+ break;
+ case EndFrameCmd:
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_EndFrame(psOut);
+ }
+ break;
+ }
+}
+
+void
+PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable)
+{
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+ DisplayElmPtr elm;
+
+ for(; disp ; disp=disp->next )
+ {
+ int i;
+ for( i=0,elm=disp->elms ; i<disp->nelms ; i++,elm++ )
+ PsReplay(elm, pDrawable);
+ }
+}
+
+int
+PsCloneDisplayElm(PixmapPtr dst, DisplayElmPtr elm, DisplayElmPtr newElm,
+ int xoff, int yoff)
+{
+ int i;
+ int size;
+ int status = 0;
+
+ *newElm = *elm;
+
+ /* I think this is the correct return value */
+ if ((newElm->gc = PsCreateAndCopyGC(&dst->drawable, elm->gc)) == NULL) {
+ return 1;
+ }
+
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ case PolyLineCmd:
+ newElm->c.polyPts.pPoints =
+ (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint));
+ for( i=0 ; i<elm->c.polyPts.nPoints ; i++ )
+ {
+ newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff;
+ newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff;
+ }
+ break;
+ case PolySegmentCmd:
+ newElm->c.segments.pSegments =
+ (xSegment *)xalloc(elm->c.segments.nSegments*sizeof(xSegment));
+ for( i=0 ; i<elm->c.segments.nSegments ; i++ )
+ {
+ newElm->c.segments.pSegments[i].x1 =
+ elm->c.segments.pSegments[i].x1+xoff;
+ newElm->c.segments.pSegments[i].y1 =
+ elm->c.segments.pSegments[i].y1+yoff;
+ newElm->c.segments.pSegments[i].x2 =
+ elm->c.segments.pSegments[i].x2+xoff;
+ newElm->c.segments.pSegments[i].y2 =
+ elm->c.segments.pSegments[i].y2+yoff;
+ }
+ break;
+ case PolyRectangleCmd:
+ newElm->c.rects.pRects =
+ (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle));
+ for( i=0 ; i<elm->c.rects.nRects ; i++ )
+ {
+ newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff;
+ newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff;
+ newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width;
+ newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height;
+ }
+ break;
+ case FillPolygonCmd:
+ newElm->c.polyPts.pPoints =
+ (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint));
+ for( i=0 ; i<elm->c.polyPts.nPoints ; i++ )
+ {
+ newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff;
+ newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff;
+ }
+ break;
+ case PolyFillRectCmd:
+ newElm->c.rects.pRects =
+ (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle));
+ for( i=0 ; i<elm->c.rects.nRects ; i++ )
+ {
+ newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff;
+ newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff;
+ newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width;
+ newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height;
+ }
+ break;
+ case PolyArcCmd:
+ newElm->c.arcs.pArcs =
+ (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc));
+ for( i=0 ; i<elm->c.arcs.nArcs ; i++ )
+ {
+ newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff;
+ newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff;
+ newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width;
+ newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height;
+ newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1;
+ newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2;
+ }
+ break;
+ case PolyFillArcCmd:
+ newElm->c.arcs.pArcs =
+ (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc));
+ for( i=0 ; i<elm->c.arcs.nArcs ; i++ )
+ {
+ newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff;
+ newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff;
+ newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width;
+ newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height;
+ newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1;
+ newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2;
+ }
+ break;
+ case Text8Cmd:
+ case TextI8Cmd:
+ newElm->c.text8.string = (char *)xalloc(elm->c.text8.count);
+ memcpy(newElm->c.text8.string, elm->c.text8.string, elm->c.text8.count);
+ newElm->c.text8.x += xoff;
+ newElm->c.text8.y += yoff;
+ break;
+ case Text16Cmd:
+ case TextI16Cmd:
+ newElm->c.text16.string =
+ (unsigned short *)xalloc(elm->c.text16.count*sizeof(unsigned short));
+ memcpy(newElm->c.text16.string, elm->c.text16.string,
+ elm->c.text16.count*sizeof(unsigned short));
+ newElm->c.text16.x += xoff;
+ newElm->c.text16.y += yoff;
+ break;
+ case PutImageCmd:
+ size = PixmapBytePad(elm->c.image.w, elm->c.image.depth)*elm->c.image.h;
+ newElm->c.image.pData = (char *)xalloc(size);
+ memcpy(newElm->c.image.pData, elm->c.image.pData, size);
+ newElm->c.image.x += xoff;
+ newElm->c.image.y += yoff;
+ break;
+ case BeginFrameCmd:
+ case EndFrameCmd:
+ status = 1;
+ break;
+ }
+ return(status);
+}
+
+void
+PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff, int yoff,
+ int x, int y, int w, int h)
+{
+ PsPixmapPrivPtr sPriv = (PsPixmapPrivPtr)src->devPrivate.ptr;
+ PsPixmapPrivPtr dPriv = (PsPixmapPrivPtr)dst->devPrivate.ptr;
+ DisplayListPtr sDisp;
+ DisplayListPtr dDisp = PsGetFreeDisplayBlock(dPriv);
+ DisplayElmPtr elm = &dDisp->elms[dDisp->nelms];
+
+ elm->type = BeginFrameCmd;
+ elm->c.frame.x = x;
+ elm->c.frame.y = y;
+ elm->c.frame.w = w;
+ elm->c.frame.h = h;
+ dDisp->nelms += 1;
+
+ sDisp = sPriv->dispList;
+ for(; sDisp ; sDisp=sDisp->next )
+ {
+ int i;
+ for( i=0,elm=sDisp->elms ; i<sDisp->nelms ; i++,elm++ )
+ {
+ dDisp = PsGetFreeDisplayBlock(dPriv);
+ if (PsCloneDisplayElm(dst, elm, &dDisp->elms[dDisp->nelms],
+ xoff, yoff)==0)
+ {
+ dDisp->nelms += 1;
+ }
+ }
+ }
+
+ dDisp = PsGetFreeDisplayBlock(dPriv);
+ elm = &dDisp->elms[dDisp->nelms];
+ elm->type = EndFrameCmd;
+ dDisp->nelms += 1;
+}
+
+PsElmPtr
+PsCreateFillElementList(PixmapPtr pix, int *nElms)
+{
+ PsElmPtr elms = (PsElmPtr)0;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+ PsArcEnum styl;
+
+ *nElms = 0;
+ for(; disp ; disp=disp->next )
+ {
+ int i;
+ DisplayElmPtr elm = disp->elms;
+
+ for( i=0 ; i<disp->nelms ; i++,elm++ )
+ {
+ if( !elm->gc->fgPixel ) continue;
+ switch(elm->type)
+ {
+ case FillPolygonCmd:
+ *nElms += 1;
+ break;
+ case PolyFillRectCmd:
+ *nElms += elm->c.rects.nRects;
+ break;
+ case PolyFillArcCmd:
+ *nElms += elm->c.arcs.nArcs;
+ break;
+ }
+ }
+ }
+
+ if( (*nElms) )
+ {
+ elms = (PsElmPtr)xalloc((*nElms)*sizeof(PsElmRec));
+ if( elms )
+ {
+ disp = priv->dispList;
+ *nElms = 0;
+ for(; disp ; disp=disp->next )
+ {
+ int i, k;
+ DisplayElmPtr elm = disp->elms;
+
+ for( i=0 ; i<disp->nelms ; i++,elm++ )
+ {
+ if( !elm->gc->fgPixel ) continue;
+ switch(elm->type)
+ {
+ case FillPolygonCmd:
+ elms[*nElms].type = PSOUT_POINTS;
+ elms[*nElms].nPoints = elm->c.polyPts.nPoints;
+ elms[*nElms].c.points =
+ (PsPointPtr)xalloc(elms[*nElms].nPoints*sizeof(PsPointRec));
+ for( k=0 ; k<elms[*nElms].nPoints ; k++ )
+ {
+ elms[*nElms].c.points[k].x = elm->c.polyPts.pPoints[k].x;
+ elms[*nElms].c.points[k].y = elm->c.polyPts.pPoints[k].y;
+ }
+ *nElms += 1;
+ break;
+ case PolyFillRectCmd:
+ for( k=0 ; k<elm->c.rects.nRects ; k++ )
+ {
+ elms[*nElms].type = PSOUT_RECT;
+ elms[*nElms].nPoints = 0;
+ elms[*nElms].c.rect.x = elm->c.rects.pRects[k].x;
+ elms[*nElms].c.rect.y = elm->c.rects.pRects[k].y;
+ elms[*nElms].c.rect.w = elm->c.rects.pRects[k].width;
+ elms[*nElms].c.rect.h = elm->c.rects.pRects[k].height;
+ *nElms += 1;
+ }
+ break;
+ case PolyFillArcCmd:
+ if( elm->gc->arcMode==ArcChord ) styl = PsChord;
+ else styl = PsPieSlice;
+ for( k=0 ; k<elm->c.rects.nRects ; k++ )
+ {
+ elms[*nElms].type = PSOUT_ARC;
+ elms[*nElms].nPoints = 0;
+ elms[*nElms].c.arc.x = elm->c.arcs.pArcs[k].x;
+ elms[*nElms].c.arc.y = elm->c.arcs.pArcs[k].y;
+ elms[*nElms].c.arc.w = elm->c.arcs.pArcs[k].width;
+ elms[*nElms].c.arc.h = elm->c.arcs.pArcs[k].height;
+ elms[*nElms].c.arc.a1 = elm->c.arcs.pArcs[k].angle1;
+ elms[*nElms].c.arc.a2 = elm->c.arcs.pArcs[k].angle2;
+ elms[*nElms].c.arc.style = styl;
+ *nElms += 1;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ return(elms);
+}
+
+PsElmPtr
+PsCloneFillElementList(int nElms, PsElmPtr elms)
+{
+ int i;
+ PsElmPtr newElms;
+
+ newElms = (PsElmPtr)xalloc(nElms*sizeof(PsElmRec));
+ if( !newElms ) return(newElms);
+ for( i=0 ; i<nElms ; i++ )
+ {
+ newElms[i] = elms[i];
+
+ if( elms[i].type==PSOUT_POINTS )
+ {
+ newElms[i].c.points =
+ (PsPointPtr)xalloc(elms[i].nPoints*sizeof(PsElmRec));
+ memcpy(newElms[i].c.points, elms[i].c.points,
+ elms[i].nPoints*sizeof(PsPointRec));
+ }
+ }
+ return(newElms);
+}
+
+void
+PsDestroyFillElementList(int nElms, PsElmPtr elms)
+{
+ int i;
+
+ for( i=0 ; i<nElms ; i++ )
+ { if( elms[i].type==PSOUT_POINTS ) xfree(elms[i].c.points); }
+
+ xfree(elms);
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsPolygon.c b/xc/programs/Xserver/Xprint/ps/PsPolygon.c
new file mode 100644
index 000000000..f318988ea
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsPolygon.c
@@ -0,0 +1,229 @@
+/* $TOG: PsPolygon.c /main/4 1998/02/09 15:43:14 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPolygon.c
+** *
+** * Contents: Draws Polygons and Rectangles for the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPolygon.c,v 1.4 1998/10/04 09:37:28 dawes Exp $ */
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyRectangleCmd;
+ elm->gc = gc;
+ elm->c.rects.nRects = nRects;
+ elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle));
+ memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nRects ; i++ )
+ {
+ PsOut_DrawRect(psOut, (int)pRects[i].x, (int)pRects[i].y,
+ (int)pRects[i].width, (int)pRects[i].height);
+ }
+ }
+}
+
+void
+PsFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = FillPolygonCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ PsRuleEnum rule;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ if( pGC->fillRule==EvenOddRule ) rule = PsEvenOdd;
+ else rule = PsNZWinding;
+ PsOut_FillRule(psOut, rule);
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Polygon(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyFillRectCmd;
+ elm->gc = gc;
+ elm->c.rects.nRects = nRects;
+ elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle));
+ memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ for( i=0 ; i<nRects ; i++ )
+ {
+ PsOut_FillRect(psOut, (int)pRects[i].x, (int)pRects[i].y,
+ (int)pRects[i].width, (int)pRects[i].height);
+ }
+ }
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsPrint.c b/xc/programs/Xserver/Xprint/ps/PsPrint.c
new file mode 100644
index 000000000..1c4e2ec0e
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsPrint.c
@@ -0,0 +1,401 @@
+/* $TOG: PsPrint.c /main/5 1998/02/09 15:43:18 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPrint.c
+** *
+** * Contents: Print extension code of Ps driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPrint.c,v 1.5 1998/10/04 09:37:29 dawes Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <errno.h>
+#include <X11/Xprotostr.h>
+
+#define NEED_EVENTS
+#include "Xproto.h"
+#undef NEED_EVENTS
+
+#include "Ps.h"
+
+#include "windowstr.h"
+#include "attributes.h"
+#include "Oid.h"
+
+int
+PsStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
+{
+ PsContextPrivPtr pConPriv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ char *jobHeader;
+ CARD16 width, height;
+ char s[20];
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+
+/*
+ * Write the job header to the job file.
+ */
+
+ pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile);
+
+ return Success;
+}
+
+
+
+/* I thought about making this following code into a set of routines
+ or using a goto, or something, but in the end decided not to,
+ because the plain old listing here makes the logic clearer. */
+int
+PsEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ int r;
+ struct stat buffer;
+ int error;
+
+ PsContextPrivPtr priv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+
+ if (cancel == True) {
+ if (priv->getDocClient != (ClientPtr) NULL) {
+ (void) XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ /* job is cancelled - do we really care if we're out of space? */
+ (void) fclose(priv->pJobFile);
+ priv->pJobFile = NULL;
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ return Success;
+ }
+
+ /*
+ * Append any trailing information here
+ */
+ PsOut_EndFile(priv->pPsOut, 0);
+
+ /* this is where we find out if we're out of space */
+ error = (fclose(priv->pJobFile) == EOF);
+ priv->pJobFile = NULL;
+
+ /* status to the client if we have ran out of space on the disk or
+ some other resource problem with the temporary file... */
+ if (error) {
+ if (priv->getDocClient != (ClientPtr) NULL) {
+ (void) XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ return BadAlloc;
+ }
+
+ /* we have finished without incident & no cancel */
+
+ if (priv->getDocClient != NULL && priv->getDocBufSize > 0) {
+ FILE *file;
+
+ file = fopen(priv->jobFileName, "r");
+ if (!file || (fstat(fileno(file), &buffer) < 0))
+ r = BadAlloc;
+ else
+ r = XpSendDocumentData(priv->getDocClient, file, buffer.st_size,
+ priv->getDocBufSize);
+ if (file)
+ fclose(file);
+
+ (void) XpFinishDocData(priv->getDocClient);
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+ else {
+ XpSubmitJob(priv->jobFileName, pCon);
+
+ r = Success;
+ }
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ return r;
+}
+
+/* StartPage
+ */
+int
+PsStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ int iorient, iplex, icount, ires;
+ unsigned short iwd, iht;
+ char *count;
+ register WindowPtr pChild;
+ PsContextPrivPtr pConPriv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsWindowPrivPtr pWinPriv =
+ (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ char s[80];
+ xEvent event;
+ XpOid orient, plex;
+
+/*
+ * Put a pointer to the context in the window private structure
+ */
+ pWinPriv->validContext = 1;
+ pWinPriv->context = pCon;
+
+ /*
+ * Get the orientation
+ */
+ orient = XpGetContentOrientation(pCon);
+ switch (orient) {
+ case xpoid_val_content_orientation_landscape:
+ iorient = 1;
+ break;
+ case xpoid_val_content_orientation_reverse_portrait:
+ iorient = 2;
+ break;
+ case xpoid_val_content_orientation_reverse_landscape:
+ iorient = 3;
+ break;
+ case xpoid_val_content_orientation_portrait:
+ default:
+ iorient = 0;
+ break;
+ }
+
+ /*
+ * Get the count
+ */
+ count = XpGetOneAttribute(pCon, XPDocAttr, "copy-count");
+ if( count )
+ {
+ int ii = sscanf(count, "%d", &icount);
+ if( ii!=1 ) icount = 1;
+ }
+ else icount = 1;
+
+ /*
+ * Get the plex
+ */
+ plex = XpGetPlex(pCon);
+ if (plex == xpoid_val_plex_duplex) iplex = 1;
+ else if (plex == xpoid_val_plex_tumble) iplex = 2;
+ else iplex = 0;
+
+ /*
+ * Get the resolution and media size
+ */
+ ires = XpGetResolution(pCon);
+ XpGetMediumDimensions(pCon, &iwd, &iht);
+
+ /*
+ * Start the page
+ */
+ PsOut_BeginPage(pConPriv->pPsOut, iorient, icount, iplex, ires,
+ (int)iwd, (int)iht);
+
+ return Success;
+}
+
+
+/*
+ * EndPage:
+ *
+ * Write page trailer to page file
+ * Write page file to job file
+ */
+int
+PsEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PsWindowPrivPtr pWinPriv =
+ (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ PsContextPrivPtr pConPriv =
+ (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+
+ PsOut_EndPage(pConPriv->pPsOut);
+
+ pWinPriv->validContext = 0;
+ pWinPriv->context = NULL;
+
+ /* status to the client if we have ran out of space on the disk or
+ some other resource problem with the temporary file... */
+/* if (ferror(pConPriv->pJobFile)) return BadAlloc; */
+
+ return Success;
+}
+
+/*
+ * The PsStartDoc() and PsEndDoc() functions serve basically as NOOP
+ * placeholders. This driver doesn't deal with the notion of multiple
+ * documents per page.
+ */
+
+int
+PsStartDoc(XpContextPtr pCon)
+{
+ return Success;
+}
+
+int
+PsEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ return Success;
+}
+
+/*
+ * PsDocumentData()
+ *
+ * Hand any pre-generated PDL down to the spool files, formatting it
+ * as necessary to fit the given window.
+ */
+
+int
+PsDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
+{
+ PsContextPrivPtr cPriv;
+ PsOutPtr psOut;
+
+ if (len_fmt != 12 || !strcmp(pFmt, "PostScript 2") || len_opt)
+ return BadValue;
+ cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
+ psOut = cPriv->pPsOut;
+
+ if (pDraw)
+ PsOut_BeginFrame(psOut, 0, 0, pDraw->x, pDraw->y,
+ pDraw->width, pDraw->height);
+ PsOut_RawData(psOut, pData, len_data);
+ if (pDraw)
+ PsOut_EndFrame(psOut);
+
+ return Success;
+}
+
+/*
+ *
+ * PsGetDocumentData()
+ *
+ * This function allows the driver to send the generated PS back to
+ * the client.
+ */
+
+int
+PsGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ PsContextPrivPtr pPriv = (PsContextPrivPtr)
+ pCon->devPrivates[PsContextPrivateIndex].ptr;
+
+ pPriv->getDocClient = client;
+ pPriv->getDocBufSize = maxBufferSize;
+
+ return Success;
+}
+
diff --git a/xc/programs/Xserver/Xprint/ps/PsSpans.c b/xc/programs/Xserver/Xprint/ps/PsSpans.c
new file mode 100644
index 000000000..98674782e
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsSpans.c
@@ -0,0 +1,159 @@
+/* $TOG: PsSpans.c /main/4 1998/02/09 15:43:23 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsSpans.c
+** *
+** * Contents: Code to set and fill spans in the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsSpans.c,v 1.4 1998/10/04 09:37:29 dawes Exp $ */
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
+{
+ char t[80];
+ PsOutPtr psOut;
+ int xoffset, yoffset;
+ xRectangle *rects, *r;
+ RegionPtr fillRegion, region;
+ int i;
+ int nbox;
+ BoxPtr pbox;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+
+ /*
+ * Build a region out of the spans
+ */
+ rects = (xRectangle *)xalloc(nSpans*sizeof(xRectangle));
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = rects; i < nSpans; i++, r++ )
+ {
+ r->x = pPoints[i].x + xoffset;
+ r->y = pPoints[i].y + yoffset;
+ r->width = pWidths[i];
+ r->height = 1;
+ }
+ fillRegion = miRectsToRegion(nSpans, rects,
+ (fSorted)?CT_YSORTED:CT_UNSORTED);
+
+ /*
+ * Intersect this region with the clip region. Whatever's left,
+ * should be filled.
+ */
+/*miIntersect(region, fillRegion, pGC->clientClip);*/
+
+ pbox = REGION_RECTS(region);
+ nbox = REGION_NUM_RECTS(region);
+
+ /* Enter HP-GL/2 */
+ /*###SEND_PCL( outFile, "\27%0B" );*/
+
+ while( nbox )
+ {
+/*###
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ SEND_PCL( outFile, t );
+*/
+ nbox--;
+ pbox++;
+ }
+
+ /* Go back to PCL */
+ /*###SEND_PCL( outFile, "\27%0A" );*/
+
+ /*
+ * Clean up the temporary regions
+ */
+ miRegionDestroy(fillRegion);
+ miRegionDestroy(region);
+ xfree(rects);
+}
+
+void
+PsSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
+{
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsText.c b/xc/programs/Xserver/Xprint/ps/PsText.c
new file mode 100644
index 000000000..e43c41293
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsText.c
@@ -0,0 +1,298 @@
+/* $TOG: PsText.c /main/4 1998/02/09 15:43:26 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsText.c
+** *
+** * Contents: Character-drawing routines for the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsText.c,v 1.4 1998/10/04 09:37:29 dawes Exp $ */
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+int
+PsPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = Text8Cmd;
+ elm->gc = gc;
+ elm->c.text8.x = x;
+ elm->c.text8.y = y;
+ elm->c.text8.count = count;
+ elm->c.text8.string = (char *)xalloc(count);
+ memcpy(elm->c.text8.string, string, count);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int iso;
+ int siz;
+ float mtx[4];
+ char *fnam;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return x;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ fnam = PsGetPSFontName(pGC->font);
+ if( !fnam ) return x;
+ siz = PsGetFontSize(pGC->font, mtx);
+ iso = PsIsISOLatin1Encoding(pGC->font);
+ if( !siz ) PsOut_TextAttrsMtx(psOut, fnam, mtx, iso);
+ else PsOut_TextAttrs(psOut, fnam, siz, iso);
+ PsOut_Text(psOut, x, y, string, count, -1);
+ }
+ return x;
+}
+
+int
+PsPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = Text16Cmd;
+ elm->gc = gc;
+ elm->c.text16.x = x;
+ elm->c.text16.y = y;
+ elm->c.text16.count = count;
+ elm->c.text16.string =
+ (unsigned short *)xalloc(count*sizeof(unsigned short));
+ memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ char *str;
+ if( !count ) return x;
+ str = (char *)xalloc(count);
+ for( i=0 ; i<count ; i++ ) str[i] = string[i];
+ PsPolyText8(pDrawable, pGC, x, y, count, str);
+ xfree(str);
+ }
+ return x;
+}
+
+void
+PsImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = TextI8Cmd;
+ elm->gc = gc;
+ elm->c.text8.x = x;
+ elm->c.text8.y = y;
+ elm->c.text8.count = count;
+ elm->c.text8.string = (char *)xalloc(count);
+ memcpy(elm->c.text8.string, string, count);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int iso;
+ int siz;
+ float mtx[4];
+ char *fnam;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ fnam = PsGetPSFontName(pGC->font);
+ if( !fnam ) return;
+ siz = PsGetFontSize(pGC->font, mtx);
+ iso = PsIsISOLatin1Encoding(pGC->font);
+ if( !siz ) PsOut_TextAttrsMtx(psOut, fnam, mtx, iso);
+ else PsOut_TextAttrs(psOut, fnam, siz, iso);
+ PsOut_Text(psOut, x, y, string, count, PsGetPixelColor(cMap, pGC->bgPixel));
+ }
+}
+
+void
+PsImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = TextI16Cmd;
+ elm->gc = gc;
+ elm->c.text16.x = x;
+ elm->c.text16.y = y;
+ elm->c.text16.count = count;
+ elm->c.text16.string =
+ (unsigned short *)xalloc(count*sizeof(unsigned short));
+ memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ char *str;
+ if( !count ) return;
+ str = (char *)xalloc(count);
+ for( i=0 ; i<count ; i++ ) str[i] = string[i];
+ PsImageText8(pDrawable, pGC, x, y, count, str);
+ free(str);
+ }
+}
+
+void
+PsImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ /* NOT TO BE IMPLEMENTED */
+}
+
+void
+PsPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ /* NOT TO BE IMPLEMENTED */
+}
diff --git a/xc/programs/Xserver/Xprint/ps/PsWindow.c b/xc/programs/Xserver/Xprint/ps/PsWindow.c
new file mode 100644
index 000000000..682558ee3
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/PsWindow.c
@@ -0,0 +1,456 @@
+/* $TOG: PsWindow.c /main/5 1998/02/09 15:43:30 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsWindow.c
+** *
+** * Contents: Window code for PS driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsWindow.c,v 1.8 1998/12/20 11:57:27 dawes Exp $ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "mistruct.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Ps.h"
+
+extern WindowPtr *WindowTable;
+
+/*
+ * The following list of strings defines the properties which will be
+ * placed on the screen's root window if the property was defined in
+ * the start-up configuration resource database.
+ */
+static char *propStrings[] = {
+ DT_PRINT_JOB_HEADER,
+ DT_PRINT_JOB_TRAILER,
+ DT_PRINT_JOB_COMMAND,
+ DT_PRINT_JOB_EXEC_COMMAND,
+ DT_PRINT_JOB_EXEC_OPTIONS,
+ DT_PRINT_PAGE_HEADER,
+ DT_PRINT_PAGE_TRAILER,
+ DT_PRINT_PAGE_COMMAND,
+ (char *)NULL
+};
+
+
+/*
+ * PsCreateWindow - watch for the creation of the root window.
+ * When it's created, register the screen with the print extension,
+ * and put the default command/header properties on it.
+ */
+/*ARGSUSED*/
+
+Bool
+PsCreateWindow(WindowPtr pWin)
+{
+ PsWindowPrivPtr pPriv;
+
+#if 0
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr)
+ pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ pWin->devPrivates[PsWindowPrivateIndex].ptr;
+
+ /*
+ * Initialize this window's private struct.
+ */
+ pWinPriv->jobFileName = (char *)NULL;
+ pWinPriv->pJobFile = (FILE *)NULL;
+ pWinPriv->pageFileName = (char *)NULL;
+ pWinPriv->pPageFile = (FILE *)NULL;
+
+ if(pWin->parent == (WindowPtr)NULL) /* root window? */
+ {
+ Atom propName; /* type = XA_STRING */
+ char *propVal;
+ int i;
+ XrmDatabase rmdb = pScreenPriv->resDB;
+
+ /*
+ * Put the defaults spec'd in the config files in properties on this
+ * screen's root window.
+ */
+ for(i = 0; propStrings[i] != (char *)NULL; i++)
+ {
+ if((propVal = _DtPrintGetPrinterResource(pWin, rmdb,
+ propStrings[i])) !=
+ (char *)NULL)
+ {
+ propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
+ TRUE);
+ ChangeWindowProperty(pWin, propName, XA_STRING, 8,
+ PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
+ xfree(propVal);
+ }
+ }
+ }
+
+ return status;
+#endif
+
+ pPriv = (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ pPriv->validContext = 0;
+
+ return TRUE;
+}
+
+
+/*ARGSUSED*/
+Bool PsMapWindow(WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PsPositionWindow(
+ WindowPtr pWin,
+ int x,
+ int y)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PsUnmapWindow(WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void
+PsCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+}
+
+/*ARGSUSED*/
+Bool
+PsChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask)
+{
+ return TRUE;
+}
+
+
+void
+PsPaintWindow(
+ WindowPtr pWin,
+ RegionPtr pRegion,
+ int what)
+{
+ int status;
+ WindowPtr pRoot;
+
+#define FUNCTION 0
+#define FOREGROUND 1
+#define TILE 2
+#define FILLSTYLE 3
+#define ABSX 4
+#define ABSY 5
+#define CLIPMASK 6
+#define SUBWINDOW 7
+#define COUNT_BITS 8
+
+ pointer gcval[7];
+ pointer newValues [COUNT_BITS];
+
+ BITS32 gcmask, index, mask;
+ RegionRec prgnWin;
+ DDXPointRec oldCorner;
+ BoxRec box;
+ WindowPtr pBgWin;
+ GCPtr pGC;
+ register int i;
+ register BoxPtr pbox;
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+ register xRectangle *prect;
+ int numRects;
+
+ gcmask = 0;
+
+ /*
+ * We don't want to paint a window that has no place to put the
+ * PS output.
+ */
+ if( PsGetContextFromWindow(pWin)==(XpContextPtr)NULL ) return;
+
+ if( what==PW_BACKGROUND )
+ {
+ switch(pWin->backgroundState)
+ {
+ case None: return;
+ case ParentRelative:
+ (*pWin->parent->drawable.pScreen->PaintWindowBackground)
+ (pWin->parent, pRegion, what);
+ return;
+ case BackgroundPixel:
+ newValues[FOREGROUND] = (pointer)pWin->background.pixel;
+ newValues[FILLSTYLE] = (pointer)FillSolid;
+ gcmask |= GCForeground | GCFillStyle;
+ break;
+ case BackgroundPixmap:
+ newValues[TILE] = (pointer)pWin->background.pixmap;
+ newValues[FILLSTYLE] = (pointer)FillTiled;
+ gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
+ break;
+ }
+ }
+ else
+ {
+ if( pWin->borderIsPixel )
+ {
+ newValues[FOREGROUND] = (pointer)pWin->border.pixel;
+ newValues[FILLSTYLE] = (pointer)FillSolid;
+ gcmask |= GCForeground | GCFillStyle;
+ }
+ else
+ {
+ newValues[TILE] = (pointer)pWin->border.pixmap;
+ newValues[FILLSTYLE] = (pointer)FillTiled;
+ gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
+ }
+ }
+
+ prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(pRegion) *
+ sizeof(xRectangle));
+ if( !prect ) return;
+
+ newValues[FUNCTION] = (pointer)GXcopy;
+ gcmask |= GCFunction | GCClipMask;
+
+ i = pScreen->myNum;
+ pRoot = WindowTable[i];
+
+ pBgWin = pWin;
+ if (what == PW_BORDER)
+ {
+ while( pBgWin->backgroundState==ParentRelative ) pBgWin = pBgWin->parent;
+ }
+
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+ if( !pGC )
+ {
+ DEALLOCATE_LOCAL(prect);
+ return;
+ }
+ /*
+ * mash the clip list so we can paint the border by
+ * mangling the window in place, pretending it
+ * spans the entire screen
+ */
+ if( what==PW_BORDER )
+ {
+ prgnWin = pWin->clipList;
+ oldCorner.x = pWin->drawable.x;
+ oldCorner.y = pWin->drawable.y;
+ pWin->drawable.x = pWin->drawable.y = 0;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT(pScreen, &pWin->clipList, &box, 1);
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ newValues[ABSX] = (pointer)(long)pBgWin->drawable.x;
+ newValues[ABSY] = (pointer)(long)pBgWin->drawable.y;
+ }
+ else
+ {
+ newValues[ABSX] = (pointer)0;
+ newValues[ABSY] = (pointer)0;
+ }
+
+/*
+ * XXX Backing store is turned off for the PS driver
+
+ if( pWin->backStorage )
+ (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
+ */
+
+ mask = gcmask;
+ gcmask = 0;
+ i = 0;
+ while( mask )
+ {
+ index = lowbit (mask);
+ mask &= ~index;
+ switch(index)
+ {
+ case GCFunction:
+ if( (pointer)(long)pGC->alu!=newValues[FUNCTION] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[FUNCTION];
+ }
+ break;
+ case GCTileStipXOrigin:
+ if( (pointer)(long)pGC->patOrg.x!=newValues[ABSX] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[ABSX];
+ }
+ break;
+ case GCTileStipYOrigin:
+ if( (pointer)(long)pGC->patOrg.y!=newValues[ABSY] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[ABSY];
+ }
+ break;
+ case GCClipMask:
+ if( (pointer)(long)pGC->clientClipType!=(pointer)CT_NONE )
+ {
+ gcmask |= index;
+ gcval[i++] = (pointer)CT_NONE;
+ }
+ break;
+ case GCSubwindowMode:
+ if( (pointer)(long)pGC->subWindowMode!=newValues[SUBWINDOW] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[SUBWINDOW];
+ }
+ break;
+ case GCTile:
+ if( pGC->tileIsPixel || (pointer)pGC->tile.pixmap!=newValues[TILE] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[TILE];
+ }
+ break;
+ case GCFillStyle:
+ if( (pointer)(long)pGC->fillStyle!=newValues[FILLSTYLE] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[FILLSTYLE];
+ }
+ break;
+ case GCForeground:
+ if( (pointer)pGC->fgPixel!=newValues[FOREGROUND] )
+ {
+ gcmask |= index;
+ gcval[i++] = newValues[FOREGROUND];
+ }
+ break;
+ }
+ }
+
+ if( gcmask ) DoChangeGC(pGC, gcmask, (XID *)gcval, 1);
+
+ if( pWin->drawable.serialNumber!=pGC->serialNumber )
+ ValidateGC((DrawablePtr)pWin, pGC);
+
+ numRects = REGION_NUM_RECTS(pRegion);
+ pbox = REGION_RECTS(pRegion);
+ for( i=numRects ; --i >= 0 ; pbox++,prect++ )
+ {
+ prect->x = pbox->x1 - pWin->drawable.x;
+ prect->y = pbox->y1 - pWin->drawable.y;
+ prect->width = pbox->x2 - pbox->x1;
+ prect->height = pbox->y2 - pbox->y1;
+ }
+ prect -= numRects;
+ (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
+ DEALLOCATE_LOCAL(prect);
+
+/*
+ * XXX Backing store is turned off for the PS driver
+
+ if( pWin->backStorage )
+ (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);
+ */
+
+ if( what==PW_BORDER )
+ {
+ REGION_UNINIT(pScreen, &pWin->clipList);
+ pWin->clipList = prgnWin;
+ pWin->drawable.x = oldCorner.x;
+ pWin->drawable.y = oldCorner.y;
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ FreeScratchGC(pGC);
+}
+
+/*ARGSUSED*/
+Bool
+PsDestroyWindow(WindowPtr pWin)
+{
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/Xprint/ps/psout.c b/xc/programs/Xserver/Xprint/ps/psout.c
new file mode 100644
index 000000000..a28159e5a
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/psout.c
@@ -0,0 +1,1343 @@
+/* $TOG: psout.c /main/6 1998/02/09 15:42:56 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: psout.c
+** *
+** * Contents: Code to output PostScript to file
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.c,v 1.5 1998/12/20 11:57:28 dawes Exp $ */
+
+/*
+ * For XFree86 3.3.3:
+ *
+ * As a *quick* way of preventing some buffers overflowing onto the stack,
+ * they have been made static. There are potential problems with
+ * PsOutRec.Buf overflowing too which should be investigated as part of a
+ * review of this code, but that is at least always allocated with malloc
+ * and shouldn't pose an immediate stack trashing problem.
+ *
+ */
+
+#include <stdlib.h>
+#include "os.h"
+#include "psout.h"
+
+PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
+
+typedef void *voidPtr;
+
+typedef struct PsPatRec_
+{
+ PsFillEnum type;
+ voidPtr tag;
+} PsPatRec;
+
+typedef PsPatRec *PsPatPtr;
+
+typedef struct PsOutRec_
+{
+ FILE *Fp;
+ char Buf[256];
+ int CurColor;
+ int LineWidth;
+ PsCapEnum LineCap;
+ PsJoinEnum LineJoin;
+ int NDashes;
+ int *Dashes;
+ int DashOffset;
+ int LineBClr;
+ PsRuleEnum FillRule;
+ char *FontName;
+ int FontSize;
+ float FontMtx[4];
+ int ImageFormat;
+ int RevImage;
+ int NPatterns;
+ int MxPatterns;
+ PsPatPtr Patterns;
+ int ClipType;
+ PsClipRec Clip;
+ int InFrame;
+ int XOff;
+ int YOff;
+
+ PsFillEnum InTile;
+ int ImgSkip;
+ int ImgBClr;
+ int ImgFClr;
+ int ImgX;
+ int ImgY;
+ int ImgW;
+ int ImgH;
+ int SclW;
+ int SclH;
+
+ int NDownloads;
+ int MxDownloads;
+ char **Downloads;
+} PsOutRec;
+
+/*
+ * Standard definitions
+ */
+
+static char *S_StandardDefs = "\
+/d{def}bind def\
+/b{bind}bind d\
+/bd{b d}b d\
+/x{exch}bd\
+/xd{x d}bd\
+/dp{dup}bd\
+/t{true}bd\
+/f{false}bd\
+/p{pop}bd\
+/r{roll}bd\
+/c{copy}bd\
+/i{index}bd\
+/rp{repeat}bd\
+/n{newpath}bd\
+/w{setlinewidth}bd\
+/lc{setlinecap}bd\
+/lj{setlinejoin}bd\
+/sml{setmiterlimit}bd\
+/ds{setdash}bd\
+/ie{ifelse}bd\
+/len{length}bd\
+/m{moveto}bd\
+/l{lineto}bd\
+/rl{rlineto}bd\
+/a{arc}bd\
+/an{arcn}bd\
+/st{stroke}bd\
+/fl{fill}bd\
+/ef{eofill}bd\
+/sp{showpage}bd\
+/cp{closepath}bd\
+/clp{clippath}bd\
+/cl{clip}bd\
+/pb{pathbbox}bd\
+/tr{translate}bd\
+/rt{rotate}bd\
+/dv{div}bd\
+/ml{mul}bd\
+/ad{add}bd\
+/ng{neg}bd\
+/scl{scale}bd\
+/sc{setrgbcolor}bd\
+/g{setgray}bd\
+/gs{gsave}bd\
+/gr{grestore}bd\
+/sv{save}bd\
+/rs{restore}bd\
+/mx{matrix}bd\
+/cm{currentmatrix}bd\
+/sm{setmatrix}bd\
+/ccm{concatmatrix}bd\
+/cc{concat}bd\
+/ff{findfont}bd\
+/mf{makefont}bd\
+/sf{setfont}bd\
+/cft{currentfont}bd\
+/fd{FontDirectory}bd\
+/sh{show}bd\
+/stw{stringwidth}bd\
+/ci{colorimage}bd\
+/ig{image}bd\
+/im{imagemask}bd\
+/cf{currentfile}bd\
+/rh{readhexstring}bd\
+/str{string}bd\
+/al{aload}bd\
+/wh{where}bd\
+/kn{known}bd\
+/stp{stopped}bd\
+/bg{begin}bd\
+/ed{end}bd\
+/fa{forall}bd\
+/pi{putinterval}bd\
+/mk{mark}bd\
+/ctm{cleartomark}bd\
+/df{definefont}bd\
+/cd{currentdict}bd\
+/db{20 dict dp bg}bd\
+/de{ed}bd\
+/languagelevel wh{p languagelevel}{1}ie\
+ 1 eq{/makepattern{p}bd/setpattern{p}bd/setpagedevice{p}bd}if\
+/mp{makepattern}bd\
+/spt{setpattern}bd\
+/spd{setpagedevice}bd\
+";
+
+/*
+ * Composite definitions
+ *
+ *
+ * XYr - Return X/Y dpi for device
+ *
+ * XYr <xdpi> <ydpi>
+ *
+ * Cs - Coordinate setup (for origin upper left)
+ *
+ * <orient(0,1,2,3)> Cs
+ *
+ * P - Draw a point
+ *
+ * <x> <y> P
+ *
+ * R - Add rectangle to path
+ *
+ * <x> <y> <w> <h> R
+ *
+ * Ac - Add arc to path
+ *
+ * <x> <y> <w> <h> <ang1> <ang2> Ac
+ *
+ * An - Add arc to path (counterclockwise)
+ *
+ * <x> <y> <w> <h> <ang1> <ang2> An
+ *
+ * Tf - Set font
+ *
+ * <font_name> <size> <iso> Tf
+ *
+ * Tfm - Set font with matrix
+ *
+ * <font_name> <matrix> <iso> Tfm
+ *
+ * T - Draw text
+ *
+ * <text> <x> <y> T
+ *
+ * Tb - Draw text with background color
+ *
+ * <text> <x> <y> <bg_red> <bg_green> <bg_blue> Tb
+ *
+ * Im1 - Image 1 bit monochrome imagemask
+ *
+ * <x> <y> <w> <h> <sw> <sh> Im1
+ *
+ * Im24 - Image 24 bit RGB color
+ *
+ * <x> <y> <w> <h> <sw> <sh> Im24
+ *
+ * Im1t - Image 1 bit monochrome imagemask (in tile)
+ *
+ * <data> <x> <y> <w> <h> <sw> <sh> Im1t
+ *
+ * Im24t - Image 24 bit RGB color (in tile)
+ *
+ * <data> <x> <y> <w> <h> <sw> <sh> Im24t
+ */
+
+static char *S_CompositeDefs = "\
+/XYr{/currentpagedevice wh\
+ {p currentpagedevice dp /HWResolution kn\
+ {/HWResolution get al p}{p 300 300}ie}{300 300}ie}bd\
+/Cs{dp 0 eq{0 pHt tr XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\
+ dp 1 eq{90 rt XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\
+ dp 2 eq{pWd 0 tr XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if\
+ 3 eq{pHt pWd tr 90 rt XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if}bd\
+/P{gs 1 w [] 0 ds 2 c m .1 ad x .1 ad x l st gr}bd\
+/R{4 2 r m 1 i 0 rl 0 x rl ng 0 rl cp}bd\
+/Ac{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r a mx_ sm}bd\
+/An{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r an mx_ sm}bd\
+/ISO{dp len dict bg{1 i/FID ne{d}{p p}ie}fa\
+ /Encoding ISOLatin1Encoding d cd ed df}bd\
+/iN{dp len str cvs dp len x 1 i 3 ad str 2 c c p x p dp 3 -1 r(ISO)pi}bd\
+/Tp{{x dp iN dp fd x kn{x p dp/f_ x d ff}{dp/f_ x d x ff ISO}ie x}\
+ {x dp/f_ x d ff x}ie}bd\
+/Tf{Tp[x 0 0 2 i ng 0 0] dp/fm_ x d mf sf}bd\
+/Tfm{Tp 1 -1 tm1_ scl tm2_ ccm dp/fm_ x d mf sf}bd\
+/T{m sh}bd\
+/Tb{gs sc f_ ff sf cft/FontMatrix get 3 get\
+ cft/FontBBox get dp 1 get x 3 get 2 i ml 3 1 r ml\
+ 0 0 m 4 i stw p 4 i 4 i m fm_ cc\
+ 0 2 i rl dp 0 rl 0 2 i ng rl 0 3 i rl ng 0 rl cp fl p p\
+ gr T}bd\
+/Im1{6 4 r tr scl t [3 i 0 0 5 i 0 0]{cf str1 rh p} im}bd\
+/Im24{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{cf str3 rh p} f 3 ci}bd\
+/Im1t{6 4 r tr scl t [3 i 0 0 5 i 0 0]{} im}bd\
+/Im24t{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{} f 3 ci}bd\
+";
+
+/*
+ * Setup definitions
+ */
+
+static char *S_SetupDefs = "\
+ /mx_ mx d\
+ /im_ mx d\
+ /tm1_ mx d\
+ /tm2_ mx d\
+ /str3 3 str d\
+ /str1 1 str d\
+";
+
+/*******************************************************************
+ * PRIVATE FUNCTIONS *
+ *******************************************************************/
+
+static void
+S_Flush(PsOutPtr self)
+{
+ if( self->Buf[0] )
+ {
+ if( self->Buf[strlen(self->Buf)-1]!='\n' ) strcat(self->Buf, "\n");
+
+ if (!ferror(self->Fp)) {
+ (void) fputs(self->Buf, self->Fp);
+ }
+
+ self->Buf[0] = '\0';
+ }
+}
+
+static void
+S_Comment(PsOutPtr self, char *comment)
+{
+ S_Flush(self);
+ strcpy(self->Buf, comment);
+ S_Flush(self);
+}
+
+static void
+S_OutDefs(PsOutPtr self, char *defs)
+{
+ int i, k=0;
+ S_Flush(self);
+ memset(self->Buf, 0, 256);
+ for( i=0 ; defs[i]!='\0' ;)
+ {
+ if( k>70 && (i==0 || (i && defs[i-1]!='/')) &&
+ (defs[i]==' ' || defs[i]=='/' || defs[i]=='{') )
+ {
+ S_Flush(self);
+ k = 0;
+ memset(self->Buf, 0, 256);
+ }
+ if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; }
+ self->Buf[k] = defs[i];
+ k++; i++;
+ }
+ S_Flush(self);
+}
+
+static void
+S_OutNum(PsOutPtr self, float num)
+{
+ int i;
+ static char buf[64];
+ sprintf(buf, "%.3f", num);
+ for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
+ if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
+ if( self->Buf[0] ) strcat(self->Buf, " ");
+ strcat(self->Buf, buf);
+ if( strlen(self->Buf)>70 ) S_Flush(self);
+}
+
+static void
+S_OutStr(PsOutPtr self, char *txt, int txtl)
+{
+ int i, k;
+ static char buf[512];
+ for( i=0,k=0 ; i<txtl ; i++ )
+ {
+ if( (txt[i]>=' ' && txt[i]<='~') &&
+ txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' )
+ { buf[k] = txt[i]; k++; continue; }
+ buf[k] = '\\'; k++;
+ sprintf(&buf[k], "%03o", txt[i]&0xFF);
+ k += 3;
+ }
+ strcat(self->Buf, "(");
+ i = strlen(self->Buf);
+ memcpy(&self->Buf[i], buf, k);
+ self->Buf[i+k] = '\0';
+ strcat(self->Buf, ")");
+ if( strlen(self->Buf)>70 ) S_Flush(self);
+}
+
+static void
+S_OutTok(PsOutPtr self, char *tok, int cr)
+{
+ if( self->Buf[0] ) strcat(self->Buf, " ");
+ strcat(self->Buf, tok);
+ if( cr ) S_Flush(self);
+}
+
+static void
+S_Color(PsOutPtr self, int clr)
+{
+ int ir, ig, ib;
+ ir = clr>>16; ig = (clr>>8)&0xFF; ib = clr&0xFF;
+ if( ir==ig && ig==ib )
+ { S_OutNum(self, (float)ir/255.); S_OutTok(self, "g", 1); }
+ else
+ {
+ S_OutNum(self, (float)ir/255.);
+ S_OutNum(self, (float)ig/255.);
+ S_OutNum(self, (float)ib/255.);
+ S_OutTok(self, "sc", 1);
+ }
+}
+
+/*******************************************************************
+ * PUBLIC FUNCTIONS *
+ *******************************************************************/
+
+PsOutPtr
+PsOut_BeginFile(FILE *fp)
+{
+ int i;
+/*
+ * Get ready to output PostScript header
+ */
+ PsOutPtr psout;
+ psout = (PsOutPtr)xalloc(sizeof(PsOutRec));
+ memset(psout, 0, sizeof(PsOutRec));
+ psout->Fp = fp;
+
+/*
+ * Output PostScript header
+ */
+ S_Comment(psout, "%!PS-Adobe-3.0 EPSF-3.0");
+ S_Comment(psout, "%%Creator: The Open Group PostScript Print Server");
+ /*### BoundingBox ###*/
+ S_Comment(psout, "%%EndComments");
+ S_Comment(psout, "%%BeginProlog");
+ S_Comment(psout, "%%BeginProcSet: XServer_PS_Functions");
+ S_OutDefs(psout, S_StandardDefs);
+ S_OutDefs(psout, S_CompositeDefs);
+ S_Comment(psout, "%%EndProcSet");
+ S_Comment(psout, "%%EndProlog");
+ S_Comment(psout, "%%BeginSetup");
+ S_OutDefs(psout, S_SetupDefs);
+ S_Comment(psout, "%%EndSetup");
+/*
+ * Initialize the structure
+ */
+ psout->CurColor = 0xFFFFFFFF;
+ psout->LineWidth = 1;
+ psout->LineCap = PsCButt;
+ psout->LineJoin = PsJMiter;
+ psout->NDashes = 0;
+ psout->Dashes = (int *)0;
+ psout->FontName = (char *)0;
+ psout->FontSize = 0;
+ for( i=0 ; i<4 ; i++ ) psout->FontMtx[i] = 0.;
+ psout->ImageFormat = 0;
+ return(psout);
+}
+
+void
+PsOut_EndFile(PsOutPtr self, int closeFile)
+{
+ int i;
+
+ S_Comment(self, "%%EOF");
+ if( self->NDashes && self->Dashes ) xfree(self->Dashes);
+ if( self->FontName ) xfree(self->FontName);
+ if( self->Patterns ) xfree(self->Patterns);
+ if( self->Clip.rects ) xfree(self->Clip.rects);
+ if( closeFile ) fclose(self->Fp);
+ for( i=0 ; i<self->NDownloads ; i++ ) xfree(self->Downloads[i]);
+ if( self->Downloads ) xfree(self->Downloads);
+ xfree(self);
+}
+
+void
+PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex, int res,
+ int wd, int ht)
+{
+ float fwd = ((float)wd/(float)res)*72.;
+ float fht = ((float)ht/(float)res)*72.;
+ S_OutTok(self, "/pWd", 0);
+ S_OutNum(self, fwd);
+ S_OutTok(self, "d /pHt", 0);
+ S_OutNum(self, fht);
+ S_OutTok(self, "d", 1);
+
+ S_OutTok(self, "{db", 0);
+ if( count>1 )
+ {
+ S_OutTok(self, "/NumCopies", 0);
+ S_OutNum(self, (float)count);
+ S_OutTok(self, "d", 0);
+ }
+ if( plex ) S_OutTok(self, "/Duplex t d", 0);
+ if( plex==1 ) S_OutTok(self, "/Tumble f d", 0);
+ else S_OutTok(self, "/Tumble t d", 0);
+
+ S_OutTok(self, "/Orientation", 0);
+ S_OutNum(self, (float) orient);
+
+ S_OutTok(self, "d/HWResolution [", 0);
+ S_OutNum(self, (float)res);
+ S_OutNum(self, (float)res);
+ S_OutTok(self, "] d/PageSize [pWd pHt]d de spd}stp p", 1);
+
+ S_OutTok(self, "gs", 0);
+ S_OutNum(self, (float)orient);
+ S_OutTok(self, "Cs 100 sml gs", 1);
+}
+
+void
+PsOut_EndPage(PsOutPtr self)
+{
+ S_OutTok(self, "gr gr sp", 1);
+}
+
+void
+PsOut_DirtyAttributes(PsOutPtr self)
+{
+ int i;
+ self->CurColor = 0xFFFFFFFF;
+ self->LineWidth = -1;
+ self->LineCap = (PsCapEnum)-1;
+ self->LineJoin = (PsJoinEnum)-1;
+ self->NDashes = -1;
+ self->FontSize = -1;
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
+ if( self->Dashes ) { xfree(self->Dashes); self->Dashes = (int *)0; }
+ if( self->FontName ) { xfree(self->FontName); self->FontName = (char *)0; }
+}
+
+void
+PsOut_Comment(PsOutPtr self, char *comment)
+{
+ S_Comment(self, comment);
+}
+
+void
+PsOut_Offset(PsOutPtr self, int x, int y)
+{
+ self->XOff = x;
+ self->YOff = y;
+}
+
+void
+PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf)
+{
+ int i, k;
+ int changed = 0;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InTile ) return;
+ if( self->InFrame ) xo = yo = 0;
+ if( clpTyp!=self->ClipType ) changed = 1;
+ else
+ {
+ if( clpinf->nRects!=self->Clip.nRects ) changed = 1;
+ else
+ {
+ if( clpinf->nOutterClips!=self->Clip.nOutterClips ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nOutterClips ; i++ )
+ {
+ if( memcmp(&clpinf->outterClips[i], &self->Clip.outterClips[i],
+ sizeof(PsRectRec))!=0 ) break;
+ }
+ if( i<clpinf->nOutterClips ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nRects ; i++ )
+ {
+ if( memcmp(&clpinf->rects[i], &self->Clip.rects[i],
+ sizeof(PsRectRec))!=0 ) { changed = 1; break; }
+ }
+ }
+ }
+ }
+ if( clpinf->nElms!=self->Clip.nElms ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nElms ; i++ )
+ {
+ if( clpinf->elms[i].type!=PSOUT_POINTS )
+ {
+ if( memcmp(&clpinf->elms[i], &self->Clip.elms[i],
+ sizeof(PsElmRec))!=0 ) { changed = 1; break; }
+ }
+ else
+ {
+ if( clpinf->elms[i].type!=self->Clip.elms[i].type ||
+ clpinf->elms[i].nPoints!=self->Clip.elms[i].nPoints )
+ { changed = 1; break; }
+ else
+ {
+ for( k=0 ; k<clpinf->elms[i].nPoints ; k++ )
+ {
+ if( memcmp(&clpinf->elms[i].c.points[k],
+ &self->Clip.elms[i].c.points[k], sizeof(PsPointRec)) )
+ { changed = 1; break; }
+ }
+ if( changed ) break;
+ }
+ }
+ }
+ }
+ }
+ if( !changed ) return;
+
+ if( self->Clip.rects ) xfree(self->Clip.rects);
+ if( self->Clip.outterClips ) xfree(self->Clip.outterClips);
+ if( self->Clip.elms )
+ PsDestroyFillElementList(self->Clip.nElms, self->Clip.elms);
+ self->ClipType = clpTyp;
+ self->Clip.nRects = clpinf->nRects;
+ self->Clip.nElms = clpinf->nElms;
+ self->Clip.nOutterClips = clpinf->nOutterClips;
+ if( clpinf->nRects )
+ {
+ self->Clip.rects = (PsRectPtr)xalloc(clpinf->nRects*sizeof(PsRectRec));
+ memcpy(self->Clip.rects, clpinf->rects, clpinf->nRects*sizeof(PsRectRec));
+ }
+ else self->Clip.rects = 0;
+ if( clpinf->nOutterClips )
+ {
+ self->Clip.outterClips = (PsRectPtr)xalloc(clpinf->nOutterClips*
+ sizeof(PsRectRec));
+ memcpy(self->Clip.outterClips, clpinf->outterClips,
+ clpinf->nOutterClips*sizeof(PsRectRec));
+ }
+ else self->Clip.outterClips = 0;
+ if( clpinf->nElms )
+ self->Clip.elms = PsCloneFillElementList(clpinf->nElms, clpinf->elms);
+ else self->Clip.elms = 0;
+
+ PsOut_DirtyAttributes(self);
+ S_OutTok(self, "gr gs", 1);
+ if( self->Clip.nOutterClips )
+ {
+ for( i=0 ; i<self->Clip.nOutterClips ; i++ )
+ {
+ S_OutNum(self, (float)(self->Clip.outterClips[i].x));
+ S_OutNum(self, (float)(self->Clip.outterClips[i].y));
+ S_OutNum(self, (float)self->Clip.outterClips[i].w);
+ S_OutNum(self, (float)self->Clip.outterClips[i].h);
+ S_OutTok(self, "R", 1);
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+ if( self->Clip.nRects )
+ {
+ for( i=0 ; i<self->Clip.nRects ; i++ )
+ {
+ S_OutNum(self, (float)(self->Clip.rects[i].x+xo));
+ S_OutNum(self, (float)(self->Clip.rects[i].y+yo));
+ S_OutNum(self, (float)self->Clip.rects[i].w);
+ S_OutNum(self, (float)self->Clip.rects[i].h);
+ S_OutTok(self, "R", 1);
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+ if( self->Clip.nElms )
+ {
+ PsElmPtr elm = self->Clip.elms;
+ for( i=0 ; i<self->Clip.nElms ; i++,elm++ )
+ {
+ switch(elm->type)
+ {
+ case PSOUT_POINTS:
+ for( k=0 ; k<elm->nPoints ; k++ )
+ {
+ S_OutNum(self, (float)elm->c.points[k].x+xo);
+ S_OutNum(self, (float)elm->c.points[k].y+yo);
+ if( k==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ S_OutTok(self, "cp", 1);
+ break;
+ case PSOUT_RECT:
+ S_OutNum(self, (float)elm->c.rect.x+xo);
+ S_OutNum(self, (float)elm->c.rect.y+yo);
+ S_OutNum(self, (float)elm->c.rect.w);
+ S_OutNum(self, (float)elm->c.rect.h);
+ S_OutTok(self, "R", 1);
+ break;
+ case PSOUT_ARC:
+ if( elm->c.arc.style==PsPieSlice )
+ {
+ S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.);
+ S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.);
+ S_OutTok(self, "m", 0);
+ }
+ S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.);
+ S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.);
+ S_OutNum(self, (float)elm->c.arc.w);
+ S_OutNum(self, (float)elm->c.arc.h);
+ S_OutNum(self, (float)elm->c.arc.a1/64.);
+ S_OutNum(self, (float)elm->c.arc.a1/64.+(float)elm->c.arc.a2/64.);
+ if( elm->c.arc.a2<0 ) S_OutTok(self, "An cp", 1);
+ else S_OutTok(self, "Ac cp", 1);
+ break;
+ }
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+}
+
+void
+PsOut_Color(PsOutPtr self, int clr)
+{
+ if( clr==self->CurColor || self->InTile>=PsStip ) return;
+ self->CurColor = clr;
+ S_Color(self, clr);
+}
+
+void
+PsOut_FillRule(PsOutPtr self, PsRuleEnum rule)
+{
+ self->FillRule = rule;
+}
+
+void
+PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, PsJoinEnum join,
+ int nDsh, int *dsh, int dshOff, int bclr)
+{
+ int i;
+ int same = 1;
+
+ if( wd!=self->LineWidth && wd>=0 )
+ {
+ if( wd==0 ) wd = 1;
+ self->LineWidth = wd;
+ S_OutNum(self, (float)wd); S_OutTok(self, "w", 1);
+ }
+ if( cap!=self->LineCap )
+ {
+ self->LineCap = cap;
+ S_OutNum(self, (float)cap); S_OutTok(self, "lc", 1);
+ }
+ if( join!=self->LineJoin )
+ {
+ self->LineJoin = join;
+ S_OutNum(self, (float)join); S_OutTok(self, "lj", 1);
+ }
+ if( nDsh!=self->NDashes ) same = 0;
+ else if( dshOff!=self->DashOffset ) same = 0;
+ else if( nDsh )
+ {
+ for( i=0 ; i<nDsh ; i++ )
+ { if( dsh[i]!=self->Dashes[i] ) break; }
+ if( i<nDsh ) same = 0;
+ }
+ if( !same )
+ {
+ if( self->NDashes && self->Dashes )
+ { xfree(self->Dashes); self->Dashes = (int *)0; }
+ self->NDashes = nDsh;
+ self->DashOffset = dshOff;
+ if( nDsh ) self->Dashes = (int *)xalloc(sizeof(int)*nDsh);
+ S_OutTok(self, "[", 0);
+ for( i=0 ; i<nDsh ; i++ )
+ {
+ self->Dashes[i] = dsh[i];
+ S_OutNum(self, (float)dsh[i]);
+ }
+ S_OutTok(self, "]", 0);
+ S_OutNum(self, (float)dshOff);
+ S_OutTok(self, "ds", 1);
+ }
+
+ if( nDsh ) self->LineBClr = bclr; else bclr = -1;
+}
+
+void
+PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
+{
+ int i;
+ static char buf[256];
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ siz==self->FontSize ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ self->FontSize = siz;
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
+ strcpy(buf, "/"); strcat(buf, fnam);
+ S_OutTok(self, buf, 0);
+ S_OutNum(self, (float)siz);
+ if( iso ) S_OutTok(self, "t", 0);
+ else S_OutTok(self, "f", 0);
+ S_OutTok(self, "Tf", 1);
+}
+
+void
+PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
+{
+ int i;
+ static char buf[256];
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
+ mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i];
+ self->FontSize = -1;
+ strcpy(buf, "/"); strcat(buf, fnam); strcat(buf, " [");
+ S_OutTok(self, buf, 0);
+ for( i=0 ; i<4 ; i++ ) S_OutNum(self, mtx[i]);
+ S_OutTok(self, "0 0]", 0);
+ if( iso ) S_OutTok(self, "t", 0);
+ else S_OutTok(self, "f", 0);
+ S_OutTok(self, "Tfm", 1);
+}
+
+void
+PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<=2 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ if( i==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ if( self->FillRule==PsEvenOdd ) S_OutTok(self, "cp ef", 1);
+ else S_OutTok(self, "cp fl", 1);
+}
+
+void
+PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R fl", 1);
+}
+
+void
+PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2, PsArcEnum style)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ if( style==PsPieSlice )
+ {
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutTok(self, "m", 0);
+ }
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, ang1);
+ S_OutNum(self, ang1+ang2);
+ if( ang2<0 ) S_OutTok(self, "An cp fl", 1);
+ else S_OutTok(self, "Ac cp fl", 1);
+}
+
+void
+PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<1 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ if( i==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ if( self->LineBClr>=0 )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<1 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ S_OutTok(self, "P", 1);
+ }
+}
+
+void
+PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R", 0);
+ if( self->LineBClr>=0 )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, ang1);
+ S_OutNum(self, ang1+ang2);
+ if( ang2<0 ) S_OutTok(self, "An", 0);
+ else S_OutTok(self, "Ac", 0);
+ if( self->LineBClr>=0 )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, int bclr)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutStr(self, text, textl);
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ if( bclr<0 ) S_OutTok(self, "T", 1);
+ else
+ {
+ int ir = bclr>>16;
+ int ig = (bclr>>8)&0xFF;
+ int ib = bclr&0xFF;
+ S_OutNum(self, (float)ir/255.);
+ S_OutNum(self, (float)ig/255.);
+ S_OutNum(self, (float)ib/255.);
+ S_OutTok(self, "Tb", 1);
+ }
+}
+
+void
+PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
+ int w, int h, int sw, int sh, int format)
+{
+ int savClr = self->CurColor;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ if( self->InTile )
+ {
+ if( self->InTile>=PsStip && format!=1 ) { self->ImgSkip = 1; return; }
+ self->ImgBClr = bclr; self->ImgFClr = fclr;
+ self->ImgX = x; self->ImgY = y;
+ self->ImgW = w; self->ImgH = h;
+ self->SclW = sw; self->SclH = sh;
+ S_OutTok(self, "<", 0);
+ self->ImageFormat = format;
+ self->RevImage = 0;
+ if( self->InTile==PsTile && format==1 && fclr==0xFFFFFF )
+ self->RevImage = 1;
+ return;
+ }
+
+ self->RevImage = 0;
+ if( format==1 )
+ {
+ S_OutTok(self, "gs", 0);
+ if( fclr==0xFFFFFF )
+ {
+ PsOut_Color(self, fclr);
+ PsOut_FillRect(self, x, y, sw, sh);
+ PsOut_Color(self, bclr);
+ self->RevImage = 1;
+ }
+ else
+ {
+ PsOut_Color(self, bclr);
+ PsOut_FillRect(self, x, y, sw, sh);
+ PsOut_Color(self, fclr);
+ }
+ }
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, (float)sw);
+ S_OutNum(self, (float)sh);
+ if( format==1 ) S_OutTok(self, "Im1", 1);
+ else S_OutTok(self, "Im24", 1);
+ self->ImageFormat = format;
+ self->CurColor = savClr;
+}
+
+void
+PsOut_EndImage(PsOutPtr self)
+{
+ if( self->ImgSkip ) { self->ImgSkip = 0; return; }
+ if( self->InTile )
+ {
+ S_OutTok(self, ">", 1);
+ if( self->ImageFormat==1 && self->InTile==PsTile )
+ {
+ if( self->ImgFClr==0xFFFFFF )
+ {
+ PsOut_Color(self, self->ImgFClr);
+ PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH);
+ PsOut_Color(self, self->ImgBClr);
+ }
+ else
+ {
+ PsOut_Color(self, self->ImgBClr);
+ PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH);
+ PsOut_Color(self, self->ImgFClr);
+ }
+ }
+ S_OutNum(self, (float)self->ImgX);
+ S_OutNum(self, (float)self->ImgY);
+ S_OutNum(self, (float)self->ImgW);
+ S_OutNum(self, (float)self->ImgH);
+ S_OutNum(self, (float)self->SclW);
+ S_OutNum(self, (float)self->SclH);
+ if( self->ImageFormat==1 ) S_OutTok(self, "Im1t", 1);
+ else S_OutTok(self, "Im24t", 1);
+ self->ImageFormat = 0;
+ self->RevImage = 0;
+ return;
+ }
+
+ self->ImageFormat = 0;
+ self->RevImage = 0;
+ S_Flush(self);
+ S_OutTok(self, "gr", 1);
+}
+
+void
+PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes)
+{
+ int i;
+ char buf[5];
+
+ if( (!self->ImageFormat) || self->ImgSkip ) return;
+ for( i=0 ; i<nBytes ; i++ )
+ {
+ if( self->RevImage ) sprintf(buf, "%02x", (int)(bytes[i]^0xFF)&0xFF);
+ else sprintf(buf, "%02x", (int)bytes[i]&0xFF);
+ strcat(self->Buf, buf);
+ if( strlen(self->Buf)>70 ) S_Flush(self);
+ }
+}
+
+void
+PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
+ int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame ) xo = yo = 0;
+ S_OutTok(self, "gs", 0);
+ S_OutNum(self, (float)(x+xo));
+ S_OutNum(self, (float)(y+yo));
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R cl n", 0);
+ xoff += xo; yoff += yo;
+ if( xoff || yoff )
+ {
+ S_OutNum(self, (float)xoff);
+ S_OutNum(self, (float)yoff);
+ S_OutTok(self, "tr", 0);
+ }
+ S_OutTok(self, "gs", 1);
+ self->InFrame += 1;
+}
+
+void
+PsOut_EndFrame(PsOutPtr self)
+{
+ self->InFrame -= 1;
+ if( self->InFrame<0 ) self->InFrame = 0;
+ S_OutTok(self, "gr gr", 1);
+ PsOut_DirtyAttributes(self);
+}
+
+int
+PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
+ int bclr, int fclr)
+{
+ int i;
+ char key[64];
+
+ for( i=0 ; i<self->NPatterns ; i++ )
+ { if( self->Patterns[i].tag==tag && self->Patterns[i].type==type ) break; }
+ if( i<self->NPatterns ) return(1);
+ if( (self->NPatterns+1)>self->MxPatterns )
+ {
+ if( self->Patterns )
+ {
+ self->MxPatterns *= 2;
+ self->Patterns =
+ (PsPatPtr)xrealloc(self->Patterns, sizeof(PsPatRec)*self->MxPatterns);
+ }
+ else
+ {
+ self->MxPatterns = 64;
+ self->Patterns = (PsPatPtr)xalloc(sizeof(PsPatRec)*self->MxPatterns);
+ }
+ }
+ self->Patterns[self->NPatterns].tag = tag;
+ self->Patterns[self->NPatterns].type = type;
+ sprintf(key, "/ %ld", (long)tag);
+ switch(type) {
+ case PsTile: key[1] = 't'; break;
+ case PsStip: key[1] = 's'; break;
+ case PsOpStip: key[1] = 'o'; break; }
+ S_OutTok(self, key, 0);
+ S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
+ S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "]d/XStep", 0);
+ S_OutNum(self, (float)w);
+ S_OutTok(self, "d/YStep", 0);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "d/PaintProc{bg sv", 1);
+ if( type==PsOpStip )
+ {
+ S_Color(self, bclr);
+ S_OutTok(self, "0 0", 0);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R fl", 1);
+ }
+ if( type!=PsTile ) S_Color(self, fclr);
+ self->NPatterns += 1;
+ self->InTile = type;
+ return(0);
+}
+
+void
+PsOut_EndPattern(PsOutPtr self)
+{
+ self->InTile = PsSolid;
+ S_OutTok(self, "rs ed}d de im_ mp d", 1);
+}
+
+void
+PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
+{
+ int i;
+ char key[64];
+
+ for( i=0 ; i<self->NPatterns ; i++ )
+ { if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
+ if( i>=self->NPatterns ) return;
+ sprintf(key, " %ld", (long)tag);
+ switch(type) {
+ case PsTile: key[0] = 't'; break;
+ case PsStip: key[0] = 's'; break;
+ case PsOpStip: key[0] = 'o'; break; }
+ S_OutTok(self, key, 0);
+ S_OutTok(self, "spt", 1);
+ self->CurColor = 0xFFFFFFFF;
+}
+
+void
+PsOut_RawData(PsOutPtr self, char *data, int len)
+{
+ S_Flush(self);
+ if (!ferror(self->Fp)) {
+ (void) fwrite(data, 1, len, self->Fp);
+ }
+}
+
+void
+PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
+{
+ int i;
+ int stt;
+ static char buf[256];
+ FILE *fp;
+
+ for( i=0 ; i<self->NDownloads ; i++ )
+ { if( strcmp(name, self->Downloads[i])==0 ) break; }
+ if( i<self->NDownloads ) return;
+
+ if( (self->NDownloads+1)>self->MxDownloads )
+ {
+ if( self->NDownloads )
+ {
+ self->MxDownloads *= 2;
+ self->Downloads = (char **)xrealloc(self->Downloads,
+ self->MxDownloads*sizeof(char *));
+ }
+ else
+ {
+ self->MxDownloads = 32;
+ self->Downloads = (char **)xalloc(self->MxDownloads*sizeof(char *));
+ }
+ }
+
+ self->Downloads[self->NDownloads] = (char *)xalloc(strlen(name)+1);
+ strcpy(self->Downloads[self->NDownloads], name);
+ self->NDownloads += 1;
+
+ S_Flush(self);
+ sprintf(buf, "%%%%BeginFont: %s", name);
+ S_Comment(self, buf);
+ fp = fopen(fname, "r");
+ if( !fp ) return;
+ fread(buf, 1, 1, fp);
+ fseek(fp, (long)0, 0);
+ if( (buf[0]&0xFF)==0x80 )
+ {
+ int len;
+
+ for(;;)
+ {
+ stt = fread(buf, 1, 2, fp);
+ if( stt!=2 || (buf[0]&0xFF)!=0x80 ) break;
+ if( (int)buf[1]<1 || (int)buf[1]>2 ) break;
+ stt = fread(buf, 1, 4, fp);
+ if( stt!=4 ) break;
+ len = ((buf[3]&0xFF)<<24)|((buf[2]&0xFF)<<16)|
+ ((buf[1]&0xFF)<<8)|(buf[0]&0xFF);
+ for(; len ;)
+ {
+ i = len<256 ? len : 256;
+ stt = fread(buf, 1, i, fp);
+ if( stt<=0 ) break;
+ if (!ferror(self->Fp)) {
+ (void) fwrite(buf, 1, stt, self->Fp);
+ }
+ if( stt<i ) break;
+ len -= i;
+ }
+ }
+ }
+ else
+ {
+ for(;;)
+ {
+ stt = fread(buf, 1, 256, fp);
+ if( stt<=0 ) break;
+ if (!ferror(self->Fp)) {
+ (void) fwrite(buf, 1, stt, self->Fp);
+ }
+ if( stt<256 ) break;
+ }
+ }
+ fclose(fp);
+ S_Flush(self);
+ S_Comment(self, "%%EndFont");
+}
diff --git a/xc/programs/Xserver/Xprint/ps/psout.h b/xc/programs/Xserver/Xprint/ps/psout.h
new file mode 100644
index 000000000..fc08afb5d
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/ps/psout.h
@@ -0,0 +1,197 @@
+/* $TOG: psout.h /main/3 1998/02/09 15:43:01 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: psout.h
+** *
+** * Contents: Include file for psout.c
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifndef _psout_
+#define _psout_
+
+#include <stdio.h>
+
+typedef enum PsCapEnum_ { PsCButt=0, PsCRound, PsCSquare } PsCapEnum;
+typedef enum PsJoinEnum_ { PsJMiter=0, PsJRound, PsJBevel } PsJoinEnum;
+typedef enum PsArcEnum_ { PsChord, PsPieSlice } PsArcEnum;
+typedef enum PsRuleEnum_ { PsEvenOdd, PsNZWinding } PsRuleEnum;
+typedef enum PsFillEnum_ { PsSolid=0, PsTile, PsStip, PsOpStip } PsFillEnum;
+
+typedef struct PsPointRec_
+{
+ int x;
+ int y;
+} PsPointRec;
+
+typedef PsPointRec *PsPointPtr;
+
+typedef struct PsRectRec_
+{
+ int x;
+ int y;
+ int w;
+ int h;
+} PsRectRec;
+
+typedef PsRectRec *PsRectPtr;
+
+typedef struct PsArcRec_
+{
+ int x;
+ int y;
+ int w;
+ int h;
+ int a1;
+ int a2;
+ PsArcEnum style;
+} PsArcRec;
+
+typedef PsArcRec *PsArcPtr;
+
+#define PSOUT_RECT 0
+#define PSOUT_ARC 1
+#define PSOUT_POINTS 2
+
+typedef struct PsElmRec_
+{
+ int type;
+ int nPoints;
+ union
+ {
+ PsRectRec rect;
+ PsArcRec arc;
+ PsPointPtr points;
+ } c;
+} PsElmRec;
+
+typedef PsElmRec *PsElmPtr;
+
+typedef struct PsClipRec_
+{
+ int nRects;
+ PsRectPtr rects;
+ int nElms;
+ PsElmPtr elms;
+ int nOutterClips;
+ PsRectPtr outterClips;
+} PsClipRec;
+
+typedef PsClipRec *PsClipPtr;
+
+typedef struct PsOutRec_ *PsOutPtr;
+
+extern PsOutPtr PsOut_BeginFile(FILE *fp);
+extern void PsOut_EndFile(PsOutPtr self, int closeFile);
+extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex,
+ int res, int wd, int ht);
+extern void PsOut_EndPage(PsOutPtr self);
+extern void PsOut_DirtyAttributes(PsOutPtr self);
+extern void PsOut_Comment(PsOutPtr self, char *comment);
+extern void PsOut_Offset(PsOutPtr self, int x, int y);
+
+extern void PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf);
+
+extern void PsOut_Color(PsOutPtr self, int clr);
+extern void PsOut_FillRule(PsOutPtr self, PsRuleEnum rule);
+extern void PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap,
+ PsJoinEnum join, int nDsh, int *dsh, int dshOff,
+ int bclr);
+extern void PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso);
+extern void PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso);
+
+extern void PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h);
+extern void PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2, PsArcEnum style);
+
+extern void PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h);
+extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2);
+
+extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
+ int bclr);
+
+extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
+extern void PsOut_EndImage(PsOutPtr self);
+extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
+
+extern void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
+ int w, int h);
+extern void PsOut_EndFrame(PsOutPtr self);
+
+extern int PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h,
+ PsFillEnum type, int bclr, int fclr);
+extern void PsOut_EndPattern(PsOutPtr self);
+extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
+
+extern void PsOut_RawData(PsOutPtr self, char *data, int len);
+extern void PsOut_DownloadType1(PsOutPtr self, char *name, char *fname);
+
+#endif
diff --git a/xc/programs/Xserver/Xprint/raster/Imakefile b/xc/programs/Xserver/Xprint/raster/Imakefile
new file mode 100644
index 000000000..401fc0d67
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/raster/Imakefile
@@ -0,0 +1,30 @@
+XCOMM $XFree86: xc/programs/Xserver/Xprint/raster/Imakefile,v 1.4 1999/04/17 09:08:26 dawes Exp $
+
+
+
+
+XCOMM $XConsortium: Imakefile /main/1 1996/09/28 17:05:59 rws $
+
+#include <Server.tmpl>
+
+SRCS1 = Raster.c RasterAttVal.c
+OBJS1 = Raster.o RasterAttVal.o
+
+SRCS = $(SRCS1)
+
+OBJS = $(OBJS1)
+
+ INCLUDES = -I. \
+ -I../../cfb -I$(TOP) \
+ -I../../include -I.. -I$(TOP)/include
+
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \
+ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln \
+ ../../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+NormalLibraryTarget(raster,$(OBJS))
+NormalLintTarget($(SRCS1) $(SRCS2))
+
+DependTarget()
diff --git a/xc/programs/Xserver/Xprint/raster/Raster.c b/xc/programs/Xserver/Xprint/raster/Raster.c
new file mode 100644
index 000000000..23c3681cb
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/raster/Raster.c
@@ -0,0 +1,1463 @@
+/* $TOG: Raster.c /main/4 1998/04/06 14:56:49 mgreess $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.c,v 1.3 1998/10/04 09:37:32 dawes Exp $ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Raster.c
+** *
+** * Contents:
+** * Raster driver for the print server.
+** *
+** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "X.h"
+#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
+#define NEED_EVENTS
+#include "Xproto.h"
+#undef NEED_EVENTS
+#include "Xatom.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "servermd.h" /* needed for IMAGE_BUFSIZE */
+
+#define _XP_PRINT_SERVER_
+#include "extensions/Print.h"
+#undef _XP_PRINT_SERVER_
+#include "Raster.h"
+
+#include "attributes.h"
+#include "AttrValid.h"
+
+static void AllocateRasterPrivates(
+ ScreenPtr pScreen);
+static Bool RasterChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask);
+static int StartJob(
+ XpContextPtr pCon,
+ Bool sendClientData);
+static int StartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+static int StartDoc(
+ XpContextPtr pCon);
+static int EndDoc(
+ XpContextPtr pCon,
+ Bool cancel);
+static int EndJob(
+ XpContextPtr pCon,
+ Bool cancel);
+static int EndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin,
+ Bool cancel);
+static int DocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pDoc_fmt,
+ int len_fmt,
+ char *pOptions,
+ int len_options,
+ ClientPtr client);
+static int GetDocumentData(
+ XpContextPtr pContext,
+ ClientPtr client,
+ int maxBufferSize);
+static void FreePageFiles(
+ RasterContextPrivPtr pWinPriv);
+static int SystemCmd(
+ char *pCommand);
+static Bool RasterCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+static int RasterInitContext(XpContextPtr pCon);
+static Bool RasterDestroyContext(XpContextPtr pCon);
+static char *RasterGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class);
+static char *RasterGetOneAttribute(XpContextPtr pCon,
+ XPAttributes class,
+ char *attribute);
+static void RasterSetAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes);
+static void RasterAugmentAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes);
+static int RasterMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height);
+static int RasterReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect);
+
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+
+extern Bool _XpBoolNoop();
+extern void _XpVoidNoop();
+extern void XpDestroyAttributes();
+extern char *ReplaceFileString(
+ char *string,
+ char *inFileName,
+ char *outFileName);
+extern char *XpGetConfigDir();
+
+extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
+
+static int RasterScreenPrivateIndex, RasterContextPrivateIndex;
+static int RasterGeneration = 0;
+static char RASTER_DRIV_NAME[] = "XP-RASTER";
+
+Bool
+InitializeRasterDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ char specifier[MAX_TOKEN_LEN];
+ int xRes, yRes, maxWidth, maxHeight;
+ int maxRes, maxDim, numBytes;
+ RasterScreenPrivPtr pPriv;
+ XpDriverFuncsPtr pFuncs;
+ char **printerNames, *printDescFile;
+ int numPrinters;
+
+ /*
+ * Register this driver's InitContext function with the print extension.
+ * This is a bit
+ * sleazy, as the extension hasn't yet been initialized, but the
+ * extension needs to know this, and this seems the best time to
+ * provide the information.
+ */
+ XpRegisterInitFunc( pScreen, RASTER_DRIV_NAME, RasterInitContext );
+
+ /*
+ * Create and load the devPrivate for the printer layer.
+ */
+ AllocateRasterPrivates(pScreen);
+
+ pPriv = (RasterScreenPrivPtr)
+ pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+
+ maxDim = MAX( pScreen->height, pScreen->width );
+ numBytes = maxDim + BITMAP_SCANLINE_PAD - 1; /* pixels per row */
+ numBytes *= maxDim;
+ numBytes /= 8; /* bytes per row */
+ xRes = pScreen->width / (pScreen->mmWidth / 25.4);
+ yRes = pScreen->height / (pScreen->mmHeight / 25.4);
+ maxRes = MAX( xRes, yRes );
+
+ pPriv->pBits = (char *)xalloc(numBytes);
+
+ /*
+ * Have to allocate maxDim X maxDim to allow for landscape mode.
+ */
+ mfbScreenInit(pScreen, pPriv->pBits, maxDim, maxDim, maxRes,
+ maxRes, maxDim);
+ miInitializeBackingStore(pScreen);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+ if(mfbCreateDefColormap(pScreen) == FALSE)
+ ; /* XXX what do I do if it fails? */
+
+ /*
+ cfbScreenInit(pScreen, pPriv->pBits, maxWidth, maxHeight, maxXres,
+ maxYres, maxWidth);
+ miInitializeBackingStore(pScreen);
+ scalingScreenInit(pScreen);
+ */
+
+ pScreen->SaveScreen = _XpBoolNoop;
+ pPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = RasterCloseScreen;
+
+ return TRUE;
+}
+
+/*
+ * GetPropString searches the context's config database for a property
+ * by the name of propName. If found, it returns the property's
+ * value, otherwise it returns NULL unless the requested attribute
+ * is RASTER_PRINT_PAGE_COMMAND, in which case it returns a hard-coded
+ * default string to invoke xpr to produce a PostScript(tm) formatted
+ * raster.
+ */
+
+static char *
+GetPropString(
+ XpContextPtr pCon,
+ char *propName)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ char *type;
+ XrmValue val;
+
+ if( XrmGetResource(pConPriv->config, propName, propName, &type, &val) ==
+ True )
+ return (char *)val.addr;
+
+ if( !strcmp( propName, RASTER_PRINT_PAGE_COMMAND ) )
+ return "xpr -device ps %(InFile)% > %(OutFile)%";
+ else
+ return NULL;
+}
+
+static int
+StartJob(
+ XpContextPtr pCon,
+ Bool sendClientData)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ char *jobHeader;
+
+ /*
+ * Check for existing page file, and delete it if it exists.
+ */
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ unlink(pConPriv->pageFileName);
+ Xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if(!sendClientData)
+ {
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+/*
+ * StartDoc and EndDoc are just no-ops in this implementation, since
+ * our view of the spooler really doesn't recognize documents.
+ */
+
+static int
+StartDoc(
+ XpContextPtr pCon)
+{
+ return Success;
+}
+
+static int EndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ return Success;
+}
+
+/*
+ * BuidArgVector takes a pointer to a comma-separated list of command
+ * options and splits it out into an array of argument pointers. The
+ * caller must not free the optionList after calling this function until
+ * the returned arg vector is no longer needed, at which time the arg
+ * vector should also be freed.
+ */
+
+#define SEPARATOR_CHAR (char)','
+
+static char **
+BuildArgVector(
+ char *optionList,
+ char **argVector,
+ int argCount)
+{
+ char *curArg, *lastChar, *endArg;
+ int optionLen;
+
+ curArg = optionList;
+ lastChar = optionList + strlen(optionList); /* includes final NULL */
+
+ while(curArg != (char *)NULL && curArg < lastChar)
+ {
+ /* strip leading white space */
+ while(curArg < lastChar && isascii((int)*curArg) &&
+ isspace((int)*curArg))
+ curArg++;
+
+ if(curArg < lastChar)
+ {
+ argVector = (char **)Xrealloc(argVector,
+ sizeof(char *) * (argCount + 2));
+ argVector[argCount] = curArg;
+ argVector[++argCount] = (char *)NULL;
+
+ endArg = strchr(curArg, SEPARATOR_CHAR);
+
+ /* Should I strip trailing white space ??? */
+
+ if(endArg != (char *)NULL)
+ {
+ *endArg = (char)'\0';
+ curArg = endArg + 1;
+ }
+ else
+ curArg = (char *)NULL;
+ }
+ }
+
+ return argVector;
+}
+
+static int
+EndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+
+ if( cancel == True )
+ {
+ if(pConPriv->getDocClient != (ClientPtr)NULL) {
+ XpFinishDocData(pConPriv->getDocClient);
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ }
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ {
+ unlink(pConPriv->jobFileName);
+ Xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ return Success;
+ }
+
+ if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0)
+ {
+ XpFinishDocData(pConPriv->getDocClient);
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+
+ return Success;
+ }
+
+ if(pConPriv->pJobFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pJobFile);
+ pConPriv->pJobFile = (FILE *)NULL;
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ {
+ XpSubmitJob( pConPriv->jobFileName, pCon );
+ unlink(pConPriv->jobFileName);
+ Xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+ }
+
+ return Success;
+}
+
+/* StartPage
+ *
+ * If page file exists
+ * close page file
+ * set page file pointer = NULL
+ * unlink page file
+ */
+static int
+StartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ register WindowPtr pChild;
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ unsigned short width, height;
+ xEvent event;
+
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ return Success;
+}
+
+#include "X11/XWDFile.h"
+
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+/*
+ * Get the XWDColors of all pixels in colormap - returns # of colors
+ */
+static XWDColor *
+Get_XWDColors(
+ ColormapPtr pCmap)
+{
+ int i, ncolors;
+ xrgb *prgbList;
+ Pixel *pPixels;
+ XWDColor *colors;
+
+ ncolors = pCmap->pVisual->ColormapEntries;
+ if (!(colors = (XWDColor *) malloc (sizeof(XWDColor) * ncolors)))
+ return (XWDColor *) NULL;
+ if (!(prgbList = (xrgb*) malloc(sizeof(xrgb) * ncolors)))
+ {
+ Xfree(colors);
+ return (XWDColor *) NULL;
+ }
+ if (!(pPixels = (Pixel*) malloc(sizeof(Pixel) * ncolors)))
+ {
+ Xfree(colors);
+ Xfree(prgbList);
+ return (XWDColor *) NULL;
+ }
+
+ if (pCmap->pVisual->class == DirectColor ||
+ pCmap->pVisual->class == TrueColor) {
+ Pixel red, green, blue, red1, green1, blue1;
+
+ red = green = blue = 0;
+ red1 = lowbit(pCmap->pVisual->redMask);
+ green1 = lowbit(pCmap->pVisual->greenMask);
+ blue1 = lowbit(pCmap->pVisual->blueMask);
+ for (i=0; i<ncolors; i++) {
+ colors[i].pixel = red|green|blue;
+ colors[i].pad = 0;
+ red += red1;
+ if (red > pCmap->pVisual->redMask)
+ red = 0;
+ green += green1;
+ if (green > pCmap->pVisual->greenMask)
+ green = 0;
+ blue += blue1;
+ if (blue > pCmap->pVisual->blueMask)
+ blue = 0;
+ }
+ } else {
+ for (i=0; i<ncolors; i++) {
+ colors[i].pixel = i;
+ colors[i].pad = 0;
+ }
+ }
+
+ for(i = 0; i < ncolors; i++)
+ pPixels[i] = colors[i].pixel;
+
+ QueryColors(pCmap, ncolors, pPixels, prgbList);
+ Xfree(pPixels);
+
+ for(i = 0; i < ncolors; i++)
+ {
+ colors[i].red = prgbList[i].red;
+ colors[i].green = prgbList[i].green;
+ colors[i].blue = prgbList[i].blue;
+ }
+ Xfree(prgbList);
+
+ return(colors);
+}
+
+static
+_swapshort (
+ register char *bp,
+ register unsigned n)
+{
+ register char c;
+ register char *ep = bp + n;
+
+ while (bp < ep) {
+ c = *bp;
+ *bp = *(bp + 1);
+ bp++;
+ *bp++ = c;
+ }
+}
+
+static
+_swaplong (
+ register char *bp,
+ register unsigned n)
+{
+ register char c;
+ register char *ep = bp + n;
+ register char *sp;
+
+ while (bp < ep) {
+ sp = bp + 3;
+ c = *sp;
+ *sp = *bp;
+ *bp++ = c;
+ sp = bp + 1;
+ c = *sp;
+ *sp = *bp;
+ *bp++ = c;
+ bp += 2;
+ }
+}
+static int
+WriteWindowRaster(
+ WindowPtr pWin,
+ FILE *pRasterFile)
+{
+ long widthBytesLine, length;
+ int nlines, linesPerBuf, height, linesDone;
+ char *pBuf;
+ DrawablePtr pDraw = &pWin->drawable;
+ XWDFileHeader header;
+ int win_name_size;
+ int header_size;
+ int ncolors, i;
+ char *win_name;
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+ XWDColor *pColors;
+ unsigned long swaptest = 1;
+
+ widthBytesLine = PixmapBytePad(pWin->drawable.width, pWin->drawable.depth);
+ length = widthBytesLine * pWin->drawable.height;
+ height = pWin->drawable.height;
+
+ if(length <= 0)
+ return Success;
+
+ if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else
+ {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height)
+ {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) && (length & 3))
+ {
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
+ while (length & 3)
+ {
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ if(!(pBuf = (char *) Xalloc(length)))
+ return (BadAlloc);
+
+ /*
+ * Start of Xwd header code.
+ */
+
+ /*
+ * XXX - Should we use the real window name???
+ */
+ win_name = "xwdump";
+ /* sizeof(char) is included for the null string terminator. */
+ win_name_size = strlen(win_name) + sizeof(char);
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP);
+ pVisual = pCmap->pVisual;
+ if((pColors = Get_XWDColors(pCmap)) == (XWDColor *)NULL)
+ {
+ Xfree(pBuf);
+ return (BadAlloc);
+ }
+
+ /*
+ * Write out header information.
+ */
+ header_size = sizeof(header) + win_name_size;
+ header.header_size = (CARD32) header_size;
+ header.file_version = (CARD32) XWD_FILE_VERSION;
+ header.pixmap_format = (CARD32) ZPixmap; /* Must match GetImage below */
+ header.pixmap_depth = (CARD32) pDraw->depth;
+ header.pixmap_width = (CARD32) pDraw->width;
+ header.pixmap_height = (CARD32) pDraw->height;
+ header.xoffset = (CARD32) 0;
+ header.byte_order = (CARD32) screenInfo.imageByteOrder;
+ header.bitmap_unit = (CARD32) screenInfo.bitmapScanlineUnit;
+ header.bitmap_bit_order = (CARD32) screenInfo.bitmapBitOrder;
+ header.bitmap_pad = (CARD32) screenInfo.bitmapScanlinePad;
+ header.bits_per_pixel = (CARD32) pDraw->bitsPerPixel;
+ header.bytes_per_line = (CARD32) widthBytesLine;
+ header.visual_class = (CARD32) pVisual->class;
+ header.red_mask = (CARD32) pVisual->redMask;
+ header.green_mask = (CARD32) pVisual->greenMask;
+ header.blue_mask = (CARD32) pVisual->blueMask;
+ header.bits_per_rgb = (CARD32) pVisual->bitsPerRGBValue;
+ header.colormap_entries = (CARD32) pVisual->ColormapEntries;
+ header.ncolors = ncolors = (CARD32) pVisual->ColormapEntries;
+ header.window_width = (CARD32) pDraw->width;
+ header.window_height = (CARD32) pDraw->height;
+ header.window_x = 0;
+ header.window_y = 0;
+ header.window_bdrwidth = (CARD32) 0;
+
+ if (*(char *) &swaptest) {
+ _swaplong((char *) &header, sizeof(header));
+ for (i = 0; i < ncolors; i++) {
+ _swaplong((char *) &pColors[i].pixel, sizeof(long));
+ _swapshort((char *) &pColors[i].red, 3 * sizeof(short));
+ }
+ }
+
+ (void) fwrite((char *)&header, sizeof(header), 1, pRasterFile);
+ (void) fwrite(win_name, win_name_size, 1, pRasterFile);
+ (void) fwrite((char *) pColors, sizeof(XWDColor), ncolors, pRasterFile);
+
+ Xfree(pColors);
+
+ /*
+ * End of Xwd header code.
+ */
+
+ linesDone = 0;
+ while(height - linesDone > 0)
+ {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ 0,
+ linesDone,
+ pWin->drawable.width,
+ nlines,
+ ZPixmap,
+ ~0,
+ pBuf);
+
+ if(fwrite(pBuf, sizeof(char), (size_t)(nlines * widthBytesLine),
+ pRasterFile) !=
+ (size_t)(nlines * widthBytesLine))
+ {
+ Xfree(pBuf);
+ return BadAlloc;
+ }
+ linesDone += nlines;
+ }
+ Xfree(pBuf);
+ return Success;
+}
+
+
+static int
+SendPage( XpContextPtr pCon )
+{
+ struct stat statBuf;
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ return BadAlloc;
+
+ return XpSendDocumentData(pConPriv->getDocClient,
+ pConPriv->pPageFile, (int)statBuf.st_size,
+ pConPriv->getDocBufSize);
+}
+
+/*
+ * EndPage:
+ *
+ * If page file doesn't exist:
+ * {
+ * Create page file
+ * Open page file
+ * Write page header to page file
+ * if(preRasterFile exists)
+ * copy preRasterFile contents to page file
+ * if(noRasterFile exists)
+ * write noRasterFile contents to page file
+ * else
+ * Create raster image file
+ * Open raster image file
+ * GetImage data
+ * Write Image data to raster image file
+ * invoke page_command on raster image file
+ * Write raster image file contents to page file
+ * Unlink tempPage file
+ * if(postRasterFile exists)
+ * write postRasterFile contents to page file
+ * Write page trailer to page file
+ * }
+ * Write page file to job file
+ */
+static int
+EndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin,
+ Bool cancel)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ struct stat statBuf;
+ char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL,
+ *pHeader = (char *)NULL, *pTrailer = (char *)NULL;
+ FILE *pRasterFile = (FILE *)NULL;
+
+ if( cancel == True )
+ return Success;
+
+ if(pConPriv->pageFileName == (char *)NULL)
+ {
+ /*
+ * Open the page file.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->pageFileName,
+ &pConPriv->pPageFile))
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Copy any pre-raster document data to the page file.
+ */
+ if(pConPriv->pPreRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pPreRasterFile,
+ &pConPriv->preRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy either the no-raster document data, or the raster
+ * data itself to the page file.
+ * If the no-raster file exists, then we don't process the
+ * actual window raster bits.
+ */
+ if(pConPriv->pNoRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pNoRasterFile,
+ &pConPriv->noRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+ else
+ {
+ /*
+ * Open the raster image file.
+ */
+ if (!XpOpenTmpFile("w", &rasterFileName, &pRasterFile))
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Write the page image data to the raster image file.
+ */
+ if(WriteWindowRaster(pWin, pRasterFile) != Success)
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Invoke the page_command on the raster image file.
+ */
+ if((pCommand = GetPropString(pCon, RASTER_PRINT_PAGE_COMMAND)) !=
+ (char *)NULL)
+ {
+ char *outFileName;
+ FILE *pOutFile;
+
+ if (!XpOpenTmpFile("w", &outFileName, &pOutFile))
+ goto BAD_PAGE_ALLOC;
+ fclose(pOutFile);
+
+ pCommand = ReplaceFileString(strdup(pCommand), rasterFileName,
+ outFileName);
+ fclose(pRasterFile);
+ SystemCmd(pCommand);
+ free(pCommand);
+ /*
+ * Delete the unprocessed raster file.
+ */
+ unlink(rasterFileName);
+ Xfree(rasterFileName);
+ rasterFileName = outFileName;
+ if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL)
+ goto BAD_PAGE_ALLOC;
+ }
+ else
+ {
+ fclose(pRasterFile);
+ if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy the raster image file contents to the page file.
+ * Note that pRasterFile must be set to the start of the
+ * raster file.
+ */
+ if(CopyContentsAndDelete(&pRasterFile,
+ &rasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy any post-raster document data to the page file.
+ */
+ if(pConPriv->pPostRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pPostRasterFile,
+ &pConPriv->postRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ }
+
+ /*
+ * Write the page file contents to the job file or to the client
+ * performing GetDocumentData.
+ * pConPriv->pPageFile must first be set to the start of the page file.
+ */
+ rewind(pConPriv->pPageFile);
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Send the page data to whatever client has called GetDocumentData.
+ */
+ if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0)
+ {
+ int retval;
+ /*
+ * We should do something like the following: suspend the
+ * caller until we can gracefully write all the data in small
+ * chunks to the receiver, but for now we'll just call WriteToClient
+ * on the huge chunk
+ */
+ retval = SendPage(pCon);
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ unlink(pConPriv->pageFileName);
+ free(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ return retval;
+ }
+
+ if(pConPriv->pJobFile == (FILE *)NULL)
+ {
+ /*
+ * This shouldn't be necessary. I believe we only get here if
+ * someone calls "EndPage" prior to "StartJob". This error
+ * condition should probably be trapped at a higher level.
+ */
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ Xfree(pConPriv->jobFileName);
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ goto BAD_PAGE_ALLOC;
+ }
+
+ if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ goto BAD_PAGE_ALLOC;
+
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ unlink(pConPriv->pageFileName);
+ free(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+
+ return Success;
+
+ BAD_PAGE_ALLOC:
+
+ FreePageFiles(pConPriv);
+
+ if(pRasterFile != (FILE *)NULL)
+ fclose(pRasterFile);
+ if(rasterFileName != (char *)NULL)
+ {
+ unlink(rasterFileName);
+ Xfree(rasterFileName);
+ }
+ return BadAlloc;
+}
+
+static int
+DocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pDoc_fmt,
+ int len_fmt,
+ char *pOptions,
+ int len_options,
+ ClientPtr client)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ char *preRasterStr = PRE_RASTER, *postRasterStr = POST_RASTER,
+ *noRasterStr = NO_RASTER;
+
+ /*
+ * Check that options equals either PRE_RASTER or POST_RASTER.
+ */
+ if(len_options == strlen(preRasterStr) &&
+ strncmp(pOptions, preRasterStr, strlen(preRasterStr)) == 0)
+ {
+ if(pConPriv->pPreRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->preRasterFileName,
+ &pConPriv->pPreRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pPreRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pPreRasterFile);
+ }
+ else if(len_options == strlen(postRasterStr) &&
+ strncmp(pOptions, postRasterStr, strlen(postRasterStr)) == 0)
+ {
+ if(pConPriv->pPostRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->postRasterFileName,
+ &pConPriv->pPostRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pPostRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pPostRasterFile);
+ }
+ else if(len_options == strlen(noRasterStr) &&
+ strncmp(pOptions, noRasterStr, strlen(noRasterStr)) == 0)
+ {
+ if(pConPriv->pNoRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->noRasterFileName,
+ &pConPriv->pNoRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pNoRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pNoRasterFile);
+ }
+ else
+ return BadValue;
+
+ return Success;
+}
+
+/*
+ * GetDocumentData notes which client is requesting the document data for
+ * a particular context. The Raster driver's EndPage function causes the
+ * data to be written to the proper client.
+ */
+static int
+GetDocumentData(
+ XpContextPtr pContext,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pContext->devPrivates[RasterContextPrivateIndex].ptr;
+
+ pConPriv->getDocClient = client;
+ pConPriv->getDocBufSize = maxBufferSize;
+ return Success;
+}
+
+static void
+AllocateRasterPrivates(
+ ScreenPtr pScreen)
+{
+ if(RasterGeneration != serverGeneration)
+ {
+ RasterScreenPrivateIndex = AllocateScreenPrivateIndex();
+ RasterContextPrivateIndex = XpAllocateContextPrivateIndex();
+ XpAllocateContextPrivate( RasterContextPrivateIndex,
+ sizeof( RasterContextPrivRec ) );
+
+ RasterGeneration = serverGeneration;
+ }
+ pScreen->devPrivates[RasterScreenPrivateIndex].ptr = (pointer)Xalloc(
+ sizeof(RasterScreenPrivRec));
+}
+
+/*
+ * RasterChangeWindowAttributes - Make sure that the window's backing
+ * store is turned on.
+ */
+static Bool
+RasterChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask)
+{
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
+ pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+
+ if(pWin->backingStore == NotUseful)
+ {
+ pWin->backingStore = WhenMapped;
+ mask |= CWBackingStore;
+ }
+
+ if(pScreenPriv->ChangeWindowAttributes != (Bool (*)())NULL)
+ {
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+ status = pScreen->ChangeWindowAttributes(pWin, mask);
+ pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
+ }
+ if(status != TRUE)
+ return status;
+}
+
+/*
+ * RasterValidateDocFormats - Inspects the files available in the
+ * ddx-config/XP-RASTER directory to find the names of PDLs for which
+ * we have processing commands. These names are then intersected with
+ * the contents of the printer's document-formats-supported attribute,
+ * and the result is stored back into document-formats-supported.
+ * We have hard-coded knowledge of how to produce PS, so we always
+ * leave that in, if it's listed in document-formats-supported,
+ * even if we don't have a configuration file. If there is a
+ * configuration file for PS, then its contents will override our default.
+ */
+static void
+RasterValidateDocFormats(
+ XpContextPtr pCon)
+{
+}
+
+/*
+ * RasterValidateAttrs - Inspects and Corrects the attribute values
+ * in the specified context.
+ */
+static void
+RasterValidateAttrs(
+ XpContextPtr pCon)
+{
+ RasterValidateDocFormats(pCon);
+ XpValidatePrinterPool(pCon, &RasterValidatePoolsRec);
+ XpValidateJobPool(pCon, &RasterValidatePoolsRec);
+ XpValidateDocumentPool(pCon, &RasterValidatePoolsRec);
+}
+
+/*
+ * RasterInitContext - Establish the appropriate values for a
+ * PrintContext used with the Raster Driver.
+ */
+static char DOC_ATT_SUPP[]="document-attributes-supported:\tdefault-medium document-format";
+static char JOB_ATT_SUPP[]="job-attributes-supported:\t";
+static char DDX_DIR[]="ddx-config";
+
+static int
+RasterInitContext(
+ XpContextPtr pCon)
+{
+ char *configFileName, *val, *attrStr;
+ RasterContextPrivPtr pConPriv;
+ XpDriverFuncsPtr pFuncs;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes( pCon );
+
+ /*
+ * Validate the attributes
+ */
+ RasterValidateAttrs( pCon );
+
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &( pCon->funcs );
+ pFuncs->StartJob = StartJob;
+ pFuncs->EndJob = EndJob;
+ pFuncs->StartDoc = StartDoc;
+ pFuncs->EndDoc = EndDoc;
+ pFuncs->StartPage = StartPage;
+ pFuncs->EndPage = EndPage;
+ pFuncs->PutDocumentData = DocumentData;
+ pFuncs->GetDocumentData = GetDocumentData;
+ pFuncs->DestroyContext = RasterDestroyContext;
+ pFuncs->GetAttributes = (char *(*)())RasterGetAttributes;
+ pFuncs->GetOneAttribute = (char *(*)())RasterGetOneAttribute;
+ pFuncs->SetAttributes = (int(*)())RasterSetAttributes;
+ pFuncs->AugmentAttributes = (int(*)())RasterAugmentAttributes;
+ pFuncs->GetMediumDimensions = (int(*)())RasterMediumDimensions;
+ pFuncs->GetReproducibleArea = (int(*)())RasterReproducibleArea;
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pageFileName = (char *)NULL;
+ pConPriv->preRasterFileName = (char *)NULL;
+ pConPriv->postRasterFileName = (char *)NULL;
+ pConPriv->noRasterFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->pPageFile = (FILE *)NULL;
+ pConPriv->pPreRasterFile = (FILE *)NULL;
+ pConPriv->pPostRasterFile = (FILE *)NULL;
+ pConPriv->pNoRasterFile = (FILE *)NULL;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+
+ /*
+ * Get the configuration information for the context's printer
+ */
+ configFileName = XpGetOneAttribute( pCon, XPPrinterAttr,
+ "xp-ddx-config-file-name" );
+ if(configFileName && strlen(configFileName))
+ {
+ if( configFileName[0] == '/' )
+ pConPriv->config = XrmGetFileDatabase( configFileName );
+ else
+ {
+ char *configDir, *configFilePath;
+
+ configDir = XpGetConfigDir(FALSE);
+ configFilePath = (char *)malloc((strlen(configDir) +
+ strlen(DDX_DIR) +
+ strlen(RASTER_DRIV_NAME) +
+ strlen(configFileName) +
+ 4)* sizeof(char));
+ sprintf(configFilePath, "%s/%s/%s/%s", configDir, DDX_DIR,
+ RASTER_DRIV_NAME, configFileName);
+ pConPriv->config = XrmGetFileDatabase(configFilePath);
+ free(configDir);
+ free(configFilePath);
+ }
+ }
+ else
+ pConPriv->config = (XrmDatabase)NULL;
+
+ /*
+ * Add our own attribute initialization
+ */
+ /*
+ * document-attributes-supported
+ */
+ val = XpGetOneAttribute(pCon, XPServerAttr, "document-attributes-supported");
+ if((attrStr = (char *)xalloc(strlen(val) + strlen(DOC_ATT_SUPP) + 4)) ==
+ (char *)NULL)
+ return BadAlloc;
+ sprintf(attrStr, "*%s %s", DOC_ATT_SUPP, val);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * job-attributes-supported
+ */
+ val = XpGetOneAttribute(pCon, XPServerAttr, "job-attributes-supported");
+ if((attrStr = (char *)xalloc(strlen(val) + strlen(JOB_ATT_SUPP) + 4)) ==
+ (char *)NULL)
+ return BadAlloc;
+ sprintf(attrStr, "*%s %s", JOB_ATT_SUPP, val);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * PageAttributesSupported
+ */
+ XpAugmentAttributes(pCon, XPPrinterAttr, "*xp-page-attributes-supported:");
+
+ return Success;
+}
+
+
+
+static Bool
+RasterDestroyContext(
+ XpContextPtr pCon)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ pCon->devPrivates[RasterContextPrivateIndex].ptr;
+
+ /*
+ * Clean up the temporary files
+ */
+ FreePageFiles( pConPriv );
+
+ if( pConPriv->pJobFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pJobFile );
+ pConPriv->pJobFile = (FILE *)NULL;
+ }
+ if( pConPriv->jobFileName != (char *)NULL )
+ {
+ unlink( pConPriv->jobFileName );
+ Xfree( pConPriv->jobFileName );
+ }
+ if(pConPriv->config)
+ {
+ XrmDestroyDatabase(pConPriv->config);
+ pConPriv->config = (XrmDatabase)NULL;
+ }
+
+ XpDestroyAttributes( pCon );
+ return Success;
+}
+
+static char *
+RasterGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class)
+{
+ return XpGetAttributes( pContext, class );
+}
+
+static char *
+RasterGetOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attr)
+{
+ return XpGetOneAttribute( pContext, class, attr );
+}
+
+static void
+RasterSetAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes)
+{
+ XpSetAttributes( pCon, class, attributes );
+}
+
+static void
+RasterAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes)
+{
+ XpAugmentAttributes( pCon, class, attributes );
+}
+
+static void
+FreePageFiles(
+ RasterContextPrivPtr pConPriv)
+{
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ Xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+ if(pConPriv->pPreRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPreRasterFile);
+ pConPriv->pPreRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->preRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->preRasterFileName);
+ Xfree(pConPriv->preRasterFileName);
+ pConPriv->preRasterFileName = (char *)NULL;
+ }
+ if(pConPriv->pPostRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPostRasterFile);
+ pConPriv->pPostRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->postRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->postRasterFileName);
+ Xfree(pConPriv->postRasterFileName);
+ pConPriv->postRasterFileName = (char *)NULL;
+ }
+ if(pConPriv->pNoRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pNoRasterFile);
+ pConPriv->pNoRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->noRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->noRasterFileName);
+ Xfree(pConPriv->noRasterFileName);
+ pConPriv->noRasterFileName = (char *)NULL;
+ }
+}
+
+/*
+ * RasterCloseScreen - Call any wrapped CloseScreen function,
+ * and free the screen memory.
+ */
+static Bool
+RasterCloseScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ Bool status = Success;
+ RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
+ pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+
+ /*
+ * Call any wrapped CloseScreen proc.
+ */
+ if(pScreenPriv->CloseScreen != (Bool (*)())NULL)
+ {
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ status = pScreen->CloseScreen(index, pScreen);
+ pScreen->CloseScreen = RasterCloseScreen;
+ }
+
+ Xfree(pScreenPriv->pBits);
+ Xfree(pScreenPriv);
+
+ return status;
+}
+
+#include <signal.h>
+
+/* ARGSUSED */
+static void SigchldHndlr (int dummy)
+{
+ int status, w;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ w = wait (&status);
+
+ /*
+ * Is this really necessary?
+ */
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+}
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+static int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+ /*
+ * get the old handler, and set the action to IGN
+ */
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+
+/*
+ * RasterMediumDimensions is installed in the GetMediumDimensions field
+ * of each raster-initialized context.
+ */
+static int
+RasterMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * RasterReproducibleArea is installed in the GetReproducibleArea field
+ * of each raster-initialized context.
+ */
+static int
+RasterReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
diff --git a/xc/programs/Xserver/Xprint/raster/Raster.h b/xc/programs/Xserver/Xprint/raster/Raster.h
new file mode 100644
index 000000000..b37ac418f
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/raster/Raster.h
@@ -0,0 +1,106 @@
+/* $XConsortium: Raster.h /main/2 1996/11/16 15:26:32 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Raster.h
+** *
+** * Contents: defines and includes for the raster layer
+** * for a printing X server.
+** *
+** * Copyright: Copyright 1993 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+#ifndef _RASTER_H_
+#define _RASTER_H_
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+typedef char *XPointer;
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <Xfuncproto.h>
+#include "../Xresource.h"
+
+#define _XP_PRINT_SERVER_
+#include "extensions/Printstr.h"
+#undef _XP_PRINT_SERVER_
+
+#define MAX_TOKEN_LEN 512
+
+#define RASTER_PRINT_PAGE_COMMAND "_XP_RASTER_PAGE_PROC_COMMAND"
+
+#define RASTER_IN_FILE_STRING "%(InFile)%"
+#define RASTER_OUT_FILE_STRING "%(OutFile)%"
+
+#define RASTER_ALLOWED_COMMANDS_FILE "printCommands"
+
+/*
+ * Defines for the "options" in DtPrintDocumentData.
+ */
+#define PRE_RASTER "PRE-RASTER"
+#define POST_RASTER "POST-RASTER"
+#define NO_RASTER "NO-RASTER"
+
+
+typedef struct {
+ char *pBits;
+ Bool (* CreateWindow)(); /* pWin */
+ Bool (* ChangeWindowAttributes)(); /* pWin, mask */
+ Bool (* DestroyWindow)(); /* pWin */
+ Bool (* CloseScreen)(); /* index, pScreen */
+} RasterScreenPrivRec, *RasterScreenPrivPtr;
+
+typedef struct {
+ XrmDatabase config;
+ char *jobFileName;
+ FILE *pJobFile;
+ char *pageFileName;
+ FILE *pPageFile;
+ char *preRasterFileName; /* Pre-raster document data */
+ FILE *pPreRasterFile;
+ char *noRasterFileName; /* Raster replacement document data */
+ FILE *pNoRasterFile;
+ char *postRasterFileName; /* Post-raster document data */
+ FILE *pPostRasterFile;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+} RasterContextPrivRec, *RasterContextPrivPtr;
+
+#endif /* _RASTER_H_ */
diff --git a/xc/programs/Xserver/Xprint/raster/RasterAttVal.c b/xc/programs/Xserver/Xprint/raster/RasterAttVal.c
new file mode 100644
index 000000000..8bf2248f9
--- /dev/null
+++ b/xc/programs/Xserver/Xprint/raster/RasterAttVal.c
@@ -0,0 +1,236 @@
+/* $XConsortium: RasterAttVal.c /main/1 1996/09/28 17:06:26 rws $ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+#include <stdio.h>
+#include "X.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#define _XP_PRINT_SERVER_
+#include "extensions/Print.h"
+#undef _XP_PRINT_SERVER_
+#include "Raster.h"
+
+#include "attributes.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 150, 300, 600
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ (XpOidDocFmt *)NULL, 0
+};
+
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ (XpOidDocFmt *)NULL, 0
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOidList ValidInputTrays = {
+ (XpOid *)NULL, 0
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a0,
+ xpoid_val_medium_size_iso_a1,
+ xpoid_val_medium_size_iso_a2,
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_iso_a5,
+ xpoid_val_medium_size_iso_a6,
+ xpoid_val_medium_size_iso_a7,
+ xpoid_val_medium_size_iso_a8,
+ xpoid_val_medium_size_iso_a9,
+ xpoid_val_medium_size_iso_a10,
+ xpoid_val_medium_size_iso_b0,
+ xpoid_val_medium_size_iso_b1,
+ xpoid_val_medium_size_iso_b2,
+ xpoid_val_medium_size_iso_b3,
+ xpoid_val_medium_size_iso_b4,
+ xpoid_val_medium_size_iso_b5,
+ xpoid_val_medium_size_iso_b6,
+ xpoid_val_medium_size_iso_b7,
+ xpoid_val_medium_size_iso_b8,
+ xpoid_val_medium_size_iso_b9,
+ xpoid_val_medium_size_iso_b10,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_folio,
+ xpoid_val_medium_size_invoice,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_quarto,
+ xpoid_val_medium_size_iso_c3,
+ xpoid_val_medium_size_iso_c4,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_c6,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_10x13_envelope,
+ xpoid_val_medium_size_na_9x12_envelope,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_na_7x9_envelope,
+ xpoid_val_medium_size_na_9x11_envelope,
+ xpoid_val_medium_size_na_10x14_envelope,
+ xpoid_val_medium_size_na_number_9_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_a,
+ xpoid_val_medium_size_b,
+ xpoid_val_medium_size_c,
+ xpoid_val_medium_size_d,
+ xpoid_val_medium_size_e,
+ xpoid_val_medium_size_jis_b0,
+ xpoid_val_medium_size_jis_b1,
+ xpoid_val_medium_size_jis_b2,
+ xpoid_val_medium_size_jis_b3,
+ xpoid_val_medium_size_jis_b4,
+ xpoid_val_medium_size_jis_b5,
+ xpoid_val_medium_size_jis_b6,
+ xpoid_val_medium_size_jis_b7,
+ xpoid_val_medium_size_jis_b8,
+ xpoid_val_medium_size_jis_b9,
+ xpoid_val_medium_size_jis_b10
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "Postscript", "2", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec RasterValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xc/programs/Xserver/Xserver.man b/xc/programs/Xserver/Xserver.man
new file mode 100644
index 000000000..593082718
--- /dev/null
+++ b/xc/programs/Xserver/Xserver.man
@@ -0,0 +1,698 @@
+.\" $TOG: Xserver.man /main/68 1998/02/09 14:12:35 kaleb $
+.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.12 1999/03/14 03:21:21 dawes Exp $
+.TH XSERVER 1 "Release 6.4" "X Version 11"
+.SH NAME
+Xserver \- X Window System display server
+.SH SYNOPSIS
+.B X
+[option ...]
+.SH DESCRIPTION
+.I X
+is the generic name for the X Window System display server. It is
+frequently a link or a copy of the appropriate server binary for
+driving the most frequently used server on a given machine.
+.SH "STARTING THE SERVER"
+The X server is usually started from the X Display Manager program \fIxdm(1)\fP.
+This utility is run from the system boot files and takes care of keeping
+the server running, prompting for usernames and passwords, and starting up
+the user sessions.
+.PP
+Installations that run more than one window system may need to use the
+\fIxinit(1)\fP utility instead of \fIxdm\fP. However, \fIxinit\fP is
+to be considered a tool for building startup scripts and is not
+intended for use by end users. Site administrators are \fBstrongly\fP
+urged to use \fIxdm\fP, or build other interfaces for novice users.
+.PP
+The X server may also be started directly by the user, though this
+method is usually reserved for testing and is not recommended for
+normal operation. On some platforms, the user must have special
+permission to start the X server, often because access to certain
+devices (e.g. /dev/mouse) is restricted.
+.PP
+When the X server starts up, it typically takes over the display. If
+you are running on a workstation whose console is the display, you may
+not be able to log into the console while the server is running.
+.SH OPTIONS
+All of the X servers accept the following command line options:
+.TP 8
+.B :\fIdisplaynumber\fP
+the X server runs as the given \fIdisplaynumber\fP, which by default is 0.
+If multiple X servers are to run simultaneously on a host, each must have
+a unique display number. See the DISPLAY
+NAMES section of the \fIX(1)\fP manual page to learn how to specify
+which display number clients should try to use.
+.TP 8
+.B \-a \fInumber\fP
+sets pointer acceleration (i.e. the ratio of how much is reported to how much
+the user actually moved the pointer).
+.TP 8
+.B \-ac
+disables host-based access control mechanisms. Enables access by any host,
+and permits any host to modify the access control list.
+Use with extreme caution.
+This option exists primarily for running test suites remotely.
+.TP 8
+.B \-audit \fIlevel\fP
+Sets the audit trail level. The default level is 1, meaning only connection
+rejections are reported. Level 2 additionally reports all successful
+connections and disconnects. Level 4 enables messages from the
+SECURITY extension, if present, including generation and revocation of
+authorizations and violations of the security policy.
+Level 0 turns off the audit trail.
+Audit lines are sent as standard error output.
+.TP 8
+.B \-auth \fIauthorization-file\fP
+Specifies a file which contains a collection of authorization records used
+to authenticate access. See also the \fIxdm\fP and \fIXsecurity\fP manual
+pages.
+.TP 8
+.B bc
+disables certain kinds of error checking, for bug compatibility with
+previous releases (e.g., to work around bugs in R2 and R3 xterms and toolkits).
+Deprecated.
+.TP 8
+.B \-bs
+disables backing store support on all screens.
+.TP 8
+.B \-c
+turns off key-click.
+.TP 8
+.B c \fIvolume\fP
+sets key-click volume (allowable range: 0-100).
+.TP 8
+.B \-cc \fIclass\fP
+sets the visual class for the root window of color screens.
+The class numbers are as specified in the X protocol.
+Not obeyed by all servers.
+.TP 8
+.B \-co \fIfilename\fP
+sets name of RGB color database. The default is <XRoot>/lib/X11/rgb,
+where <XRoot> refers to the root of the X11 install tree.
+.ig
+.TP 8
+.B \-config \fIfilename\fP
+reads more options from the given file. Options in the file may be separated
+by newlines if desired. If a '#' character appears on a line, all characters
+between it and the next newline are ignored, providing a simple commenting
+facility. The \fB\-config\fP option itself may appear in the file.
+.BR NOTE :
+This option is disabled when the Xserver is run with an effective uid
+different from the user's real uid.
+..
+.TP 8
+.B \-core
+causes the server to generate a core dump on fatal errors.
+.TP 8
+.B \-dpi \fIresolution\fP
+sets the resolution of the screen, in dots per inch.
+To be used when the server cannot determine the screen size from the hardware.
+.TP 8
+.B \-deferglyphs \fIwhichfonts\fP
+specifies the types of fonts for which the server should attempt to use
+deferred glyph loading. \fIwhichfonts\fP can be all (all fonts),
+none (no fonts), or 16 (16 bit fonts only).
+.TP 8
+.B \-f \fIvolume\fP
+sets feep (bell) volume (allowable range: 0-100).
+.TP 8
+.B \-fc \fIcursorFont\fP
+sets default cursor font.
+.TP 8
+.B \-fn \fIfont\fP
+sets the default font.
+.TP 8
+.B \-fp \fIfontPath\fP
+sets the search path for fonts. This path is a comma separated list
+of directories which the X server searches for font databases.
+.TP 8
+.B \-help
+prints a usage message.
+.TP 8
+.B \-I
+causes all remaining command line arguments to be ignored.
+.TP 8
+.B \-kb
+disables the XKEYBOARD extension if present.
+.TP 8
+.B \-nolisten \fItrans-type\fP
+Disable a transport type. For example, TCP/IP connections can be disabled
+with
+.B \-nolisten tcp
+.TP 8
+.B \-noreset
+prevents a server reset when the last client connection is closed. This
+overrides a previous
+.B \-terminate
+command line option.
+.TP 8
+.B \-p \fIminutes\fP
+sets screen-saver pattern cycle time in minutes.
+.TP 8
+.B \-pn
+permits the server to continue running if it fails to establish all of
+its well-known sockets (connection points for clients), but
+establishes at least one.
+.TP 8
+.B \-r
+turns off auto-repeat.
+.TP 8
+.B r
+turns on auto-repeat.
+.TP 8
+.B \-s \fIminutes\fP
+sets screen-saver timeout time in minutes.
+.TP 8
+.B \-su
+disables save under support on all screens.
+.TP 8
+.B \-t \fInumber\fP
+sets pointer acceleration threshold in pixels (i.e. after how many pixels
+pointer acceleration should take effect).
+.TP 8
+.B \-terminate
+causes the server to terminate at server reset, instead of continuing to run.
+This overrides a previous
+.B \-noreset
+command line option.
+.TP 8
+.B \-to \fIseconds\fP
+sets default connection timeout in seconds.
+.TP 8
+.B \-tst
+disables all testing extensions (e.g., XTEST, XTrap, XTestExtension1, RECORD).
+.TP 8
+.B tty\fIxx\fP
+ignored, for servers started the ancient way (from init).
+.TP 8
+.B v
+sets video-off screen-saver preference.
+.TP 8
+.B \-v
+sets video-on screen-saver preference.
+.TP 8
+.B \-wm
+forces the default backing-store of all windows to be WhenMapped. This
+is a backdoor way of getting backing-store to apply to all windows.
+Although all mapped windows will have backing store, the backing store
+attribute value reported by the server for a window will be the last
+value established by a client. If it has never been set by a client,
+the server will report the default value, NotUseful. This behavior is
+required by the X protocol, which allows the server to exceed the
+client's backing store expectations but does not provide a way to tell
+the client that it is doing so.
+.TP 8
+.B \-x \fIextension\fP
+loads the specified extension at init.
+This is a no-op for most implementations.
+.TP 8
+.B [+-]xinerama
+enable(+) or disable(-) XINERAMA extension. Default is disabled.
+.SH SERVER DEPENDENT OPTIONS
+Some X servers accept the following options:
+.TP 8
+.B \-ld \fIkilobytes\fP
+sets the data space limit of the server to the specified number of kilobytes.
+A value of zero makes the data size as large as possible. The default value
+of \-1 leaves the data space limit unchanged.
+.TP 8
+.B \-lf \fIfiles\fP
+sets the number-of-open-files limit of the server to the specified number.
+A value of zero makes the limit as large as possible. The default value
+of \-1 leaves the limit unchanged.
+.TP 8
+.B \-ls \fIkilobytes\fP
+sets the stack space limit of the server to the specified number of kilobytes.
+A value of zero makes the stack size as large as possible. The default value
+of \-1 leaves the stack space limit unchanged.
+.TP 8
+.B \-logo
+turns on the X Window System logo display in the screen-saver.
+There is currently no way to change this from a client.
+.TP 8
+.B nologo
+turns off the X Window System logo display in the screen-saver.
+There is currently no way to change this from a client.
+.SH XDMCP OPTIONS
+X servers that support XDMCP have the following options.
+See the \fIX Display Manager Control Protocol\fP specification for more
+information.
+.TP 8
+.B \-query \fIhost-name\fP
+Enable XDMCP and send Query packets to the specified host.
+.TP 8
+.B \-broadcast
+Enable XDMCP and broadcast BroadcastQuery packets to the network. The
+first responding display manager will be chosen for the session.
+.TP 8
+.B \-indirect \fIhost-name\fP
+Enable XDMCP and send IndirectQuery packets to the specified host.
+.TP 8
+.B \-port \fIport-num\fP
+Use an alternate port number for XDMCP packets. Must be specified before
+any \-query, \-broadcast or \-indirect options.
+.TP 8
+.B \-once
+Causes the server to terminate (rather than reset) when the XDMCP session ends.
+.TP 8
+.B \-class \fIdisplay-class\fP
+XDMCP has an additional display qualifier used in resource lookup for
+display-specific options. This option sets that value, by default it
+is "MIT-Unspecified" (not a very useful value).
+.TP 8
+.B \-cookie \fIxdm-auth-bits\fP
+When testing XDM-AUTHENTICATION-1, a private key is shared between the
+server and the manager. This option sets the value of that private
+data (not that it is very private, being on the command line!).
+.TP 8
+.B \-displayID \fIdisplay-id\fP
+Yet another XDMCP specific value, this one allows the display manager to
+identify each display so that it can locate the shared key.
+.SH XKEYBOARD OPTIONS
+X servers that support the XKEYBOARD extension accept the following options:
+.TP 8
+.B \-xkbdir \fIdirectory\fP
+base directory for keyboard layout files
+.TP 8
+.B \-xkbmap \fIfilename\fP
+keyboard description to load on startup
+.TP 8
+.B [+-]accessx
+enable(+) or disable(-) AccessX key sequences
+.TP 8
+.B \-ar1 \fImilliseconds\fP
+sets the length of time in milliseconds that a key must be depressed before
+autorepeat starts
+.TP 8
+.B \-ar2 \fImilliseconds\fP
+sets the length of time in milliseconds that should elapse between
+autorepeat-generated keystrokes
+.PP
+Many servers also have device-specific command line options. See the
+manual pages for the individual servers for more details.
+.SH SECURITY EXTENSION OPTIONS
+X servers that support the SECURITY extension accept the following option:
+.TP 8
+.B \-sp \fIfilename\fP
+causes
+the server to attempt to read and interpret filename as a security policy
+file with the format described below. The file is read at
+server startup and reread at each server reset.
+.PP
+The syntax of the security policy file is as follows.
+Notation: "*" means zero or more occurrences of the preceding element,
+and "+" means one or more occurrences. To interpret <foo/bar>, ignore
+the text after the /; it is used to distinguish between instances of
+<foo> in the next section.
+.PP
+.nf
+<policy file> ::= <version line> <other line>*
+
+<version line> ::= <string/v> '\en'
+
+<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
+
+<comment> ::= # <not newline>* '\en'
+
+<blank line> ::= <space> '\en'
+
+<site policy> ::= sitepolicy <string/sp> '\en'
+
+<access rule> ::= property <property/ar> <window> <perms> '\en'
+
+<property> ::= <string>
+
+<window> ::= any | root | <required property>
+
+<required property> ::= <property/rp> | <property with value>
+
+<property with value> ::= <property/rpv> = <string/rv>
+
+<perms> ::= [ <operation> | <action> | <space> ]*
+
+<operation> ::= r | w | d
+
+<action> ::= a | i | e
+
+<string> ::= <dbl quoted string> | <single quoted string> | <unqouted string>
+
+<dbl quoted string> ::= <space> " <not dqoute>* " <space>
+
+<single quoted string> ::= <space> ' <not squote>* ' <space>
+
+<unquoted string> ::= <space> <not space>+ <space>
+
+<space> ::= [ ' ' | '\et' ]*
+
+Character sets:
+
+<not newline> ::= any character except '\en'
+<not dqoute> ::= any character except "
+<not squote> ::= any character except '
+<not space> ::= any character except those in <space>
+.fi
+.PP
+The semantics associated with the above syntax are as follows.
+.PP
+<version line>, the first line in the file, specifies the file format
+version. If the server does not recognize the version <string/v>, it
+ignores the rest of the file. The version string for the file format
+described here is "version-1" .
+.PP
+Once past the <version line>, lines that do not match the above syntax
+are ignored.
+.PP
+<comment> lines are ignored.
+.PP
+<sitepolicy> lines are currently ignored. They are intended to
+specify the site policies used by the XC-QUERY-SECURITY-1
+authorization method.
+.PP
+<access rule> lines specify how the server should react to untrusted
+client requests that affect the X Window property named <property/ar>.
+The rest of this section describes the interpretation of an
+<access rule>.
+.PP
+For an <access rule> to apply to a given instance of <property/ar>,
+<property/ar> must be on a window that is in the set of windows
+specified by <window>. If <window> is any, the rule applies to
+<property/ar> on any window. If <window> is root, the rule applies to
+<property/ar> only on root windows.
+.PP
+If <window> is <required property>, the following apply. If <required
+property> is a <property/rp>, the rule applies when the window also
+has that <property/rp>, regardless of its value. If <required
+property> is a <property with value>, <property/rpv> must also have
+the value specified by <string/rv>. In this case, the property must
+have type STRING and format 8, and should contain one or more
+null-terminated strings. If any of the strings match <string/rv>, the
+rule applies.
+.PP
+The definition of string matching is simple case-sensitive string
+comparison with one elaboration: the occurence of the character '*' in
+<string/rv> is a wildcard meaning "any string." A <string/rv> can
+contain multiple wildcards anywhere in the string. For example, "x*"
+matches strings that begin with x, "*x" matches strings that end with
+x, "*x*" matches strings containing x, and "x*y*" matches strings that
+start with x and subsequently contain y.
+.PP
+There may be multiple <access rule> lines for a given <property/ar>.
+The rules are tested in the order that they appear in the file. The
+first rule that applies is used.
+.PP
+<perms> specify operations that untrusted clients may attempt, and
+the actions that the server should take in response to those operations.
+.PP
+<operation> can be r (read), w (write), or d (delete). The following
+table shows how X Protocol property requests map to these operations
+in The Open Group server implementation.
+.PP
+.nf
+GetProperty r, or r and d if delete = True
+ChangeProperty w
+RotateProperties r and w
+DeleteProperty d
+ListProperties none, untrusted clients can always list all properties
+.fi
+.PP
+<action> can be a (allow), i (ignore), or e (error). Allow means
+execute the request as if it had been issued by a trusted client.
+Ignore means treat the request as a no-op. In the case of
+GetProperty, ignore means return an empty property value if the
+property exists, regardless of its actual value. Error means do not
+execute the request and return a BadAtom error with the atom set to
+the property name. Error is the default action for all properties,
+including those not listed in the security policy file.
+.PP
+An <action> applies to all <operation>s that follow it, until the next
+<action> is encountered. Thus, irwad means ignore read and write,
+allow delete.
+.PP
+GetProperty and RotateProperties may do multiple operations (r and d,
+or r and w). If different actions apply to the operations, the most
+severe action is applied to the whole request; there is no partial
+request execution. The severity ordering is: allow < ignore < error.
+Thus, if the <perms> for a property are ired (ignore read, error
+delete), and an untrusted client attempts GetProperty on that property
+with delete = True, an error is returned, but the property value is
+not. Similarly, if any of the properties in a RotateProperties do not
+allow both read and write, an error is returned without changing any
+property values.
+.PP
+Here is an example security policy file.
+.PP
+.ta 3i 4i
+.nf
+version-1
+
+# Allow reading of application resources, but not writing.
+property RESOURCE_MANAGER root ar iw
+property SCREEN_RESOURCES root ar iw
+
+# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
+# and allowing access may give away too much information.
+property CUT_BUFFER0 root irw
+property CUT_BUFFER1 root irw
+property CUT_BUFFER2 root irw
+property CUT_BUFFER3 root irw
+property CUT_BUFFER4 root irw
+property CUT_BUFFER5 root irw
+property CUT_BUFFER6 root irw
+property CUT_BUFFER7 root irw
+
+# If you are using Motif, you probably want these.
+property _MOTIF_DEFAULT_BINDINGS root ar iw
+property _MOTIF_DRAG_WINDOW root ar iw
+property _MOTIF_DRAG_TARGETS any ar iw
+property _MOTIF_DRAG_ATOMS any ar iw
+property _MOTIF_DRAG_ATOM_PAIRS any ar iw
+
+# The next two rules let xwininfo -tree work when untrusted.
+property WM_NAME any ar
+
+# Allow read of WM_CLASS, but only for windows with WM_NAME.
+# This might be more restrictive than necessary, but demonstrates
+# the <required property> facility, and is also an attempt to
+# say "top level windows only."
+property WM_CLASS WM_NAME ar
+
+# These next three let xlsclients work untrusted. Think carefully
+# before including these; giving away the client machine name and command
+# may be exposing too much.
+property WM_STATE WM_NAME ar
+property WM_CLIENT_MACHINE WM_NAME ar
+property WM_COMMAND WM_NAME ar
+
+# To let untrusted clients use the standard colormaps created by
+# xstdcmap, include these lines.
+property RGB_DEFAULT_MAP root ar
+property RGB_BEST_MAP root ar
+property RGB_RED_MAP root ar
+property RGB_GREEN_MAP root ar
+property RGB_BLUE_MAP root ar
+property RGB_GRAY_MAP root ar
+
+# To let untrusted clients use the color management database created
+# by xcmsdb, include these lines.
+property XDCCC_LINEAR_RGB_CORRECTION root ar
+property XDCCC_LINEAR_RGB_MATRICES root ar
+property XDCCC_GRAY_SCREENWHITEPOINT root ar
+property XDCCC_GRAY_CORRECTION root ar
+
+# To let untrusted clients use the overlay visuals that many vendors
+# support, include this line.
+property SERVER_OVERLAY_VISUALS root ar
+
+# Dumb examples to show other capabilities.
+
+# oddball property names and explicit specification of error conditions
+property "property with spaces" 'property with "' aw er ed
+
+# Allow deletion of Woo-Hoo if window also has property OhBoy with value
+# ending in "son". Reads and writes will cause an error.
+property Woo-Hoo OhBoy = "*son" ad
+
+.fi
+.SH "NETWORK CONNECTIONS"
+The X server supports client connections via a platform-dependent subset of
+the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
+and several varieties of SVR4 local connections. See the DISPLAY
+NAMES section of the \fIX(1)\fP manual page to learn how to specify
+which transport type clients should try to use.
+.SH GRANTING ACCESS
+The X server implements a platform-dependent subset of the following
+authorization protocols: MIT-MAGIC-COOKIE-1, XDM-AUTHORIZATION-1,
+SUN-DES-1, and MIT-KERBEROS-5. See the \fIXsecurity(1)\fP manual page
+for information on the operation of these protocols.
+.PP
+Authorization data required by the above protocols is passed to the
+server in a private file named with the \fB\-auth\fP command line
+option. Each time the server is about to accept the first connection
+after a reset (or when the server is starting), it reads this file.
+If this file contains any authorization records, the local host is not
+automatically allowed access to the server, and only clients which
+send one of the authorization records contained in the file in the
+connection setup information will be allowed access. See the
+\fIXau\fP manual page for a description of the binary format of this
+file. See \fIxauth(1)\fP for maintenance of this file, and distribution
+of its contents to remote hosts.
+.PP
+The X server also uses a host-based access control list for deciding
+whether or not to accept connections from clients on a particular machine.
+If no other authorization mechanism is being used,
+this list initially consists of the host on which the server is running as
+well as any machines listed in the file \fI/etc/X\fBn\fI.hosts\fR, where
+\fBn\fP is the display number of the server. Each line of the file should
+contain either an Internet hostname (e.g. expo.lcs.mit.edu) or a DECnet
+hostname in double colon format (e.g. hydra::). There should be no leading
+or trailing spaces on any lines. For example:
+.sp
+.in +8
+.nf
+joesworkstation
+corporate.company.com
+star::
+bigcpu::
+.fi
+.in -8
+.PP
+Users can add or remove hosts from this list and enable or disable access
+control using the \fIxhost\fP command from the same machine as the server.
+.PP
+If the X FireWall Proxy (\fIxfwp\fP) is being used without a sitepolicy,
+host-based authorization must be turned on for clients to be able to
+connect to the X server via the \fIxfwp\fP. If \fIxfwp\fP is run without
+a configuration file and thus no sitepolicy is defined, if \fIxfwp\fP
+is using an X server where xhost + has been run to turn off host-based
+authorization checks, when a client tries to connect to this X server
+via \fIxfwp\fP, the X server will deny the connection. See \fIxfwp(1)\fP
+for more information about this proxy.
+.PP
+The X protocol intrinsically does not have any notion of window operation
+permissions or place any restrictions on what a client can do; if a program can
+connect to a display, it has full run of the screen.
+X servers that support the SECURITY extension fare better because clients
+can be designated untrusted via the authorization they use to connect; see
+the \fIxauth(1)\fP manual page for details. Restrictions are imposed
+on untrusted clients that curtail the mischief they can do. See the SECURITY
+extension specification for a complete list of these restrictions.
+.PP
+Sites that have better
+authentication and authorization systems might wish to make
+use of the hooks in the libraries and the server to provide additional
+security models.
+.SH SIGNALS
+The X server attaches special meaning to the following signals:
+.TP 8
+.I SIGHUP
+This signal causes the server to close all existing connections, free all
+resources, and restore all defaults. It is sent by the display manager
+whenever the main user's main application (usually an \fIxterm\fP or window
+manager) exits to force the server to clean up and prepare for the next
+user.
+.TP 8
+.I SIGTERM
+This signal causes the server to exit cleanly.
+.TP 8
+.I SIGUSR1
+This signal is used quite differently from either of the above. When the
+server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN
+instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to
+its parent process after it has set up the various connection schemes.
+\fIXdm\fP uses this feature to recognize when connecting to the server
+is possible.
+.SH FONTS
+The X server
+can obtain fonts from directories and/or from font servers.
+The list of directories and font servers
+the X server uses when trying to open a font is controlled
+by the \fIfont path\fP.
+.LP
+The default font path is
+"<XRoot>/lib/X11/fonts/misc/,
+<XRoot>/lib/X11/fonts/Speedo/,
+<XRoot>/lib/X11/fonts/Type1/,
+<XRoot>/lib/X11/fonts/75dpi/,
+<XRoot>/lib/X11/fonts/100dpi/" .
+where <XRoot> refers to the root of the X11 install tree.
+.LP
+The font path can be set with the \fB\-fp\fP option or by \fIxset(1)\fP
+after the server has started.
+.SH FILES
+.TP 30
+/etc/X\fBn\fP.hosts
+Initial access control list for display number \fBn\fP
+.TP 30
+<XRoot>/lib/X11/fonts/misc, <XRoot>/lib/X11/fonts/75dpi, <XRoot>/lib/X11/fonts/100dpi
+Bitmap font directories
+.TP 30
+<XRoot>/lib/X11/fonts/Speedo, <XRoot>/lib/X11/fonts/Type1
+Outline font directories
+.TP 30
+<XRoot>/lib/X11/fonts/PEX
+PEX font directories
+.TP 30
+<XRoot>/lib/X11/rgb.txt
+Color database
+.TP 30
+/tmp/.X11-unix/X\fBn\fP
+Unix domain socket for display number \fBn\fP
+.TP 30
+/tmp/rcX\fBn\fP
+Kerberos 5 replay cache for display number \fBn\fP
+.TP 30
+/usr/adm/X\fBn\fPmsgs
+Error log file for display number \fBn\fP if run from \fIinit(8)\fP
+.TP 30
+<XRoot>/lib/X11/xdm/xdm-errors
+Default error log file if the server is run from \fIxdm(1)\fP
+.LP
+Note: <XRoot> refers to the root of the X11 install tree.
+.SH "SEE ALSO"
+General information: X(1)
+.PP
+Protocols:
+.I "X Window System Protocol,"
+.I "The X Font Service Protocol,"
+.I "X Display Manager Control Protocol"
+.PP
+Fonts: bdftopcf(1), mkfontdir(1), xfs(1), xlsfonts(1), xfontsel(1), xfd(1),
+.I "X Logical Font Description Conventions"
+.PP
+Security: Xsecurity(1), xauth(1), Xau(1), xdm(1), xhost(1), xfwp(1)
+.I "Security Extension Specification"
+.PP
+Starting the server: xdm(1), xinit(1)
+.PP
+Controlling the server once started: xset(1), xsetroot(1), xhost(1)
+.PP
+Server-specific man pages:
+Xdec(1), XmacII(1), Xsun(1), Xnest(1), Xvfb(1),
+XF86_Accel(1), XF86_SVGA(1), XFree86(1)
+.PP
+Server internal documentation:
+.I "Definition of the Porting Layer for the X v11 Sample Server"
+.SH AUTHORS
+The sample server was originally written by Susan Angebranndt, Raymond
+Drewry, Philip Karlton, and Todd Newman, from Digital Equipment
+Corporation, with support from a large cast. It has since been
+extensively rewritten by Keith Packard and Bob Scheifler, from MIT.
+Dave Wiggins took over post-R5 and made substantial improvements.
diff --git a/xc/programs/Xserver/Xvfb.def b/xc/programs/Xserver/Xvfb.def
new file mode 100644
index 000000000..59f6b1e38
--- /dev/null
+++ b/xc/programs/Xserver/Xvfb.def
@@ -0,0 +1,4 @@
+NAME Xvfb WINDOWCOMPAT
+DESCRIPTION "X11R6 XFree86 3.2 Xserver Xvfb EMX09C"
+PROTMODE
+EXETYPE OS2
diff --git a/xc/programs/Xserver/afb/Imakefile b/xc/programs/Xserver/afb/Imakefile
new file mode 100644
index 000000000..a099fd3f7
--- /dev/null
+++ b/xc/programs/Xserver/afb/Imakefile
@@ -0,0 +1,69 @@
+XCOMM $XFree86: xc/programs/Xserver/afb/Imakefile,v 3.6 1999/08/14 10:49:26 dawes Exp $
+XCOMM $XConsortium: Imakefile,v 1.38 94/03/11 18:47:47 dpw Exp $
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifdef XFree86Version
+#if DoLoadableServer
+MODSRC = afbmodule.c
+MODOBJ = afbmodule.o
+#endif
+#endif
+
+SRCS1 = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpntwin.c afbpixmap.c \
+ afbimage.c afbline.c afbbres.c afbhrzvert.c afbbresd.c afbpushpxl.c \
+ afbzerarc.c afbfillarc.c afbfillsp.c afbsetsp.c afbscrinit.c \
+ afbclip.c afbbitblt.c afbgetsp.c afbpolypnt.c afbbltC.c afbbltX.c \
+ afbbltCI.c afbbltO.c afbbltG.c afbcmap.c afbtileC.c afbtileG.c \
+ afbmisc.c afbbstore.c
+
+SRCS = $(SRCS1) afbseg.c afbbltC.c afbbltX.c afbbltCI.c afbbltO.c afbbltG.c \
+ afbtileC.c afbtileG.c $(MODSRC)
+
+OBJS = afbgc.o afbwindow.o afbfont.o afbpixmap.o afbfillsp.o afbsetsp.o \
+ afbscrinit.o afbclip.o afbbitblt.o afbgetsp.o afbbltC.o afbbltX.o \
+ afbbltCI.o afbbltO.o afbbltG.o afbcmap.o afbimage.o afbzerarc.o \
+ afbfillarc.o afbply1rct.o afbtileC.o afbtileG.o afbfillrct.o \
+ afbpolypnt.o afbmisc.o afbbstore.o afbbresd.o afbimggblt.o \
+ afbpushpxl.o afbplygblt.o afbtegblt.o afbpntwin.o afbpntarea.o \
+ afbbres.o afbhrzvert.o afbline.o afbseg.o $(MODOBJ)
+
+INCLUDES = -I. -I../cfb -I../mfb -I../mi -I../include -I$(XINCLUDESRC) \
+ -I$(FONTINCSRC) $(EXTRAINCLUDES)
+LINTDEFS = -DMFBPOLYGLYPHBLT=afbPolyGlyphBltWhite \
+ -DMFBIMAGEGLYPHBLT=afbImageGlyphBltWhite \
+ -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE -DOPEQ=MFB_OPEQ_WHITE
+
+LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln
+
+ModuleObjectRule()
+LibraryModuleTarget(afb,$(OBJS))
+LintLibraryTarget(afb,$(SRCS1))
+NormalLintTarget($(LINTDEFS) $(SRCS1))
+
+ObjectFromSpecialSource(afbseg,afbline,-DPOLYSEGMENT)
+
+ObjectFromSpecialSource(afbbltC,afbblt,-DMROP=Mcopy)
+
+ObjectFromSpecialSource(afbbltX,afbblt,-DMROP=Mxor)
+
+ObjectFromSpecialSource(afbbltCI,afbblt,-DMROP=McopyInverted)
+
+ObjectFromSpecialSource(afbbltO,afbblt,-DMROP=Mor)
+
+ObjectFromSpecialSource(afbbltG,afbblt,-DMROP=0)
+
+ObjectFromSpecialSource(afbtileC,afbtile,-DMROP=Mcopy)
+
+ObjectFromSpecialSource(afbtileG,afbtile,-DMROP=0)
+
+InstallLibraryModule(afb,$(MODULEDIR),.)
+
+#ifndef OS2Architecture
+DependTarget()
+#endif
+
+InstallDriverSDKLibraryModule(afb,$(DRIVERSDKMODULEDIR),.)
+
+InstallDriverSDKNonExecFile(afb.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/xc/programs/Xserver/afb/README b/xc/programs/Xserver/afb/README
new file mode 100644
index 000000000..5c9586013
--- /dev/null
+++ b/xc/programs/Xserver/afb/README
@@ -0,0 +1,10 @@
+
+All stuff in this directory is based on Xdaniver (read Xdaniver.doc).
+
+Actually this is the same code as in the ilbm directory, except that here the
+conversion from normal bitplanes to interleaved bitplanes didn't happen.
+
+--
+Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be
+Wavelets, Linux/m68k on Amiga http://www.cs.kuleuven.ac.be/~geert/
+Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
diff --git a/xc/programs/Xserver/afb/Xdaniver.doc b/xc/programs/Xserver/afb/Xdaniver.doc
new file mode 100644
index 000000000..1c8ad5ad4
--- /dev/null
+++ b/xc/programs/Xserver/afb/Xdaniver.doc
@@ -0,0 +1,218 @@
+
+What is it?
+-----------
+
+Xdaniver is a fast, colour X11R6 server for the Amiga's custom chip set
+under NetBSD 1.0 and NetBSD-current, supporting all the Amiga's display
+depths from 1 to 4 (upto 16 colours) on ECS machines and 1 to 8 (upto 256
+colours) on AGA machines (though, not all resolutions are available, see
+General Information below).
+
+Xdaniver is designed to be a drop-in replacement for the Xmono server provided
+with the X11R6 binary distribution supplied by Bernd Ernesti available from
+ftp.uni-regensburg.de or one of its mirrors.
+
+Unlike previous colour X servers for the Amiga that emulate a chunky pixel
+screen in fast RAM, use the standard frame buffer drivers provided with the
+X11R6 source code to draw and then use a chunky to planar conversion routine
+to write the results to the screen (all very slow), Xdaniver uses a heavily
+modified mono frame buffer driver to draw directly using the Amiga's planar
+format. The net result is much faster drawing and support for all the Amiga's
+custom display depths but, as usual, the fewer planes used, the faster the
+drawing operations of the X server. Even so, on my A1200 with a 33Mhz 68030,
+I'm getting reasonable performance when using 8 bit planes in Dbl NTSC mode.
+
+Installation
+------------
+
+You will need to have first obtained and installed the X11R6 binary
+distribution available from ftp.uni-regensburg.de in
+/pub/NetBSD-Amiga/contrib/X11 or one of its mirrors. Xdaniver has been
+compiled to expect font and configuration files sitting under
+/usr/local/X11R6, if your setup is different you will need to provide a
+symbolic link from /usr/local/X11R6 to where your tree resides or supply
+several command line flags to the server.
+
+To get Xdaniver running as the default X server, copy the uncompressed binary
+into /usr/local/X11R6/bin, remove the current X file from that directory
+(which is a symbolic link to Xmono) and replace it with a link to Xdaniver:
+
+ gzip -d < X11R6.Xdaniver.1.01.tar.gz | tar xvf -
+ mv Xdaniver /usr/local/X11R6/bin
+ cd /usr/local/X11R6/bin
+ rm X
+ ln -s Xdaniver X
+
+Note that on some setups, the devices /dev/kbd, /dev/mouse and /dev/view??
+have been created to be accessable only by superuser; Xdaniver needs to open
+these devices. To workaround this problem, log on as superuser and then
+either make Xdaniver setuid root:
+
+ chown root Xdaniver
+ chmod 4755 Xdaniver
+
+or give everyone access the devices:
+
+ chmod 666 /dev/kbd /dev/mouse /dev/view??
+
+the latter option is a possible cause of a security hole if your machine is
+ever used multi-user.
+
+General Information
+-------------------
+
+The default resolution of the server is 700x430 and the default depth 4. AGA
+users might what to increase the display depth by editing the startx script
+and providing a -depth <depth> argument to Xdaniver on the xinit line of the
+script. As always, the lower the depth, the faster the drawing and window
+manipulation of the server.
+
+The resolution can be altered similarly by suppling -width <width> and
+-height <height> arguments to the server.
+
+The NetBSD kernel selects actual screen modes by picking a mode who's
+natural, non-overscanned size best-fits the requested resolution.
+Unfortunately, for AGA users, the 1.0 kernel only has support for the
+Dbl-NTSC AGA display mode and only this mode has support for depths greater
+than 4. The NetBSD-current (work-in-progress) kernel also has support for
+Dbl-PAL but still no support for the Super72 or other super-hires modes
+(perhaps some kind, kernel-hacker could add support for them ?).
+
+If you have a 2 button mouse (like me) you might want to try and use the 3
+button mouse emulation. On other systems, it is usual for the left and right
+buttons to be provided and emulate the middle button by pressing both
+buttons together, however, the middle button is tends to be used more than
+the right button so I have provided two options:
+
+-emulateright (or -3), the two physical mouse buttons act as left and middle
+and pressing them both together emulates the right button.
+
+-emulatemiddle (or -2), the two physical mouse buttons act as left and right
+and pressing them both together emulated the middle button.
+
+When using screen depths of less than 6 (4 is the maximum for ECS machines)
+the lack of possible colours on screen at once causes problems for many X
+applications. Specifying -cc 2 as a command line argument to Xdaniver
+causes the server to switch the default visual type from PsuedoColor to
+StaticColor; to put it simply, the server prefills the colormap with a
+selection of 16 colours (depth 4) and when an application asks for a
+particular colour, its gets allocated one that is closest to one from the
+selection of 16. This removes the 'WARNING: Cannot allocate colormap entry
+for "XXX"' errors but at the expense of applications not being able to get
+the precise colour they wanted. Also, some badly written X applications fail
+altogether when presented with a StaticColor visual.
+
+Bugs/Limitations
+----------------
+
+The limited choice of display resolutions for AGA/ECS machines is a real
+pain - requires a kernel change to fix. Worse still, the kernel specifies
+the maximum overscan resolution on the Dbl-NTSC to be 724x482 but selecting
+anything more than 702x430 on my machine causes the screen either sheer
+diagonally (as if the bytes per row calculation in Xdaniver or the kernel is
+wrong) or completely loose sync (suggesting a custom chip register sync
+calculation bug). As other, non-aga modes aren't affected when selection
+overscan both problems seem to point to a kernel driver bug. Also, depths
+greater than 4 for AGA users are only supported by the kernel in the Dbl-NTSC
+mode (and Dbl-PAL with the current-NetBSD kernel).
+
+I know of one bug so-far (there will be more), The PutImage request of an XY
+format image expects the bitplane order to be the reverse of that specified
+in the X protocol but since virtually all applications use the Z (chunky)
+format, you are unlikely to come across this problem.
+
+The PutImage request of Z format images is a little slow - when I have time
+I'll try and add one of the fast assembly chunky-to-planar routines developed
+for doom style games/demos. Unfortunately, the current crop all require a
+picture size that is a multiple of 32 pixels and so cannot be used out-of-the-
+box.
+
+Some extra performance could easily be squeezed out of the terminal font
+drawing code (used by xterm) - when I have time I'll add the code.
+
+The Amiga's blitter and sprites are totally unused and will remain so
+until/if someone else adds support to the kernel. The blitter would help
+speed up screen scrolling and window manipulation and sprite support could
+be used for the X pointer shape (if small enough) which would speed up all
+drawing operations (no need to remove the software based pointer shape
+first, draw, then replace the pointer shape).
+
+I removed the X image extension (XIE) from the X server as it increased the
+size of the binary by some 400k. I haven't come across any applications that
+need it yet (I haven't been looking!) so if you need the extension for some
+reason send me e-mail and I'll build a server with the extension included.
+
+The 3 button mouse emulation is very simple - to emulate the 3rd button you
+have to press both button precisely at the same moment - I've got quite good
+at it now. When I have some spare time I'll add a timer so you will have a
+few milli-seconds between one button being pressed and the next and it still
+being registered as the emulated button.
+
+AGA users don't forget to provide the -A flag to loadbsd to enable the one
+AGA mode in the 1.0 kernel but only if you have a VGA, multisync or dual-scan
+monitor, of course !
+
+Xdaniver has been tested on:
+
+A1200, 33Mhz 68030, 8Mb RAM and NetBSD 1.0 by myself.
+A4000/40, 12Mb RAM and NetBSD 1.0 by Andreas Holzhammer.
+A3000, 12Mb RAM and NetBSD 1.0 by Charlie Root, Stuart Park and others.
+A3000, 25Mhz 68040, 18Mb RAM and NetBSD-current by Michael K. Sanders.
+A2000, 8Mb RAM and NetBSD (version unknown) by Hubert Feyrer.
+
+Release and Bug Fix History
+---------------------------
+
+1.0 - First release
+
+1.01 Bugs fixed:
+ - Narrow (<32 pixels) Z format GetImage requests corrupted the stack
+ and could cause the server to core dump. (Xpaint caused this problem)
+ - Drawing dots (PolyPoint request) into a clipped window caused a
+ c pointer to go out of range, causing a core dump (xv showed this
+ problem).
+
+ New features:
+ - Simple 3 button mouse emulation using a 2 button mouse; specify
+ -emulate_middle (or -2) or -emulate_right (or -3) on the server's
+ command line and press both mouse buttons together emulate the 'missing'
+ button.
+ - Basic beep sound support added by sending bell characters to the
+ console.
+ - Source code released.
+
+Disclaimer and Copyright Notices
+--------------------------------
+
+Multi-depth planar frame buffer code:
+Copyright (c) 1995 by Daniver Limited.
+
+Large portions:
+Copyright (c) 1994 by Eduardo Horvath.
+Copyright (c) 1987-1995 by the Regents of the University of California.
+Copyright (c) 1987 by Sun Microsystems, Inc. Mountain View, CA.
+Copyright (c) 1987-1995 by X Consortium.
+Copyright (c) 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+Copyright (c) 1989 Network Computing Devices, Inc., Mountain View, California.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies. The Daniver Limited,
+the above companies and individuals makes no representations about the
+suitability of this software for any purpose. It is provided "as is" without
+express or implied warranty.
+
+Credits
+-------
+
+Thanks to Bernd Ernesti for making the operating system server source code
+available for others to use and Eduardo Horvath and Andy Heffernan, who (I
+think) did the original Xmono server port.
+
+Also, many thanks to the first brave users who tested Xdaniver for me on other
+Amiga setups and found a few bugs in the process.
+
+Gary Henderson.
+
+Daytime: garyh@wet.sbi.com
+Home: gary@daniver.demon.co.uk
diff --git a/xc/programs/Xserver/afb/afb.h b/xc/programs/Xserver/afb/afb.h
new file mode 100644
index 000000000..ef96c3231
--- /dev/null
+++ b/xc/programs/Xserver/afb/afb.h
@@ -0,0 +1,1272 @@
+/* $XFree86: xc/programs/Xserver/afb/afb.h,v 3.5 1999/06/27 16:17:29 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afb.h,v 5.31 94/04/17 20:28:15 dpw Exp $ */
+/* Monochrome Frame Buffer definitions
+ written by drewry, september 1986
+*/
+
+#include "pixmap.h"
+#include "region.h"
+#include "gc.h"
+#include "colormap.h"
+#include "miscstruct.h"
+#include "mibstore.h"
+
+extern int afbInverseAlu[];
+extern int afbScreenPrivateIndex;
+/* warning: PixelType definition duplicated in maskbits.h */
+#ifndef PixelType
+#define PixelType unsigned long
+#endif /* PixelType */
+
+#define AFB_MAX_DEPTH 8
+
+/* afbbitblt.c */
+
+extern void afbDoBitblt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern RegionPtr afbBitBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ void (*doBitBlt)(
+#if NeedNestedPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+ ),
+ unsigned long /*planemask*/
+#endif
+);
+
+extern RegionPtr afbCopyArea(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr/*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/
+#endif
+);
+
+extern RegionPtr afbCopyPlane(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr/*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ unsigned long /*plane*/
+#endif
+);
+
+extern void afbCopy1ToN(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbltC.c */
+
+extern void afbDoBitbltCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbltCI.c */
+
+extern void afbDoBitbltCopyInverted(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbltG.c */
+
+extern void afbDoBitbltGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbltO.c */
+
+extern void afbDoBitbltOr(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbltX.c */
+
+extern void afbDoBitbltXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbbres.c */
+
+extern void afbBresS(
+#if NeedFunctionPrototypes
+ PixelType * /*addrl*/,
+ int /*nlwidth*/,
+ int /*sizeDst*/,
+ int /*depthDst*/,
+ int /*signdx*/,
+ int /*signdy*/,
+ int /*axis*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*e*/,
+ int /*e1*/,
+ int /*e2*/,
+ int /*len*/,
+ unsigned char * /*rrops*/
+#endif
+);
+/* afbbresd.c */
+
+extern void afbBresD(
+#if NeedFunctionPrototypes
+ int * /*pdashIndex*/,
+ unsigned char * /*pDash*/,
+ int /*numInDashList*/,
+ int * /*pdashOffset*/,
+ int /*isDoubleDash*/,
+ PixelType * /*addrl*/,
+ int /*nlwidth*/,
+ int /*sizeDst*/,
+ int /*depthDst*/,
+ int /*signdx*/,
+ int /*signdy*/,
+ int /*axis*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*e*/,
+ int /*e1*/,
+ int /*e2*/,
+ int /*len*/,
+ unsigned char * /*rrops*/,
+ unsigned char * /*bgrrops*/
+#endif
+);
+/* afbbstore.c */
+
+extern void afbSaveAreas(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/,
+ RegionPtr /*prgnSave*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern void afbRestoreAreas(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/,
+ RegionPtr /*prgnRestore*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ WindowPtr /*pWin*/
+#endif
+);
+/* afbclip.c */
+
+extern RegionPtr afbPixmapToRegion(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/
+#endif
+);
+
+/* afbcmap.c */
+
+extern Bool afbInitializeColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern void afbResolveColor(
+#if NeedFunctionPrototypes
+ unsigned short * /*pred*/,
+ unsigned short * /*pgreen*/,
+ unsigned short * /*pblue*/,
+ VisualPtr /*pVisual*/
+#endif
+);
+
+extern Bool afbSetVisualTypes(
+#if NeedFunctionPrototypes
+ int /*depth*/,
+ int /*visuals*/,
+ int /*bitsPerRGB*/
+#endif
+);
+
+extern int afbListInstalledColormaps(ScreenPtr, Colormap *);
+extern void afbInstallColormap(ColormapPtr);
+extern void afbUninstallColormap(ColormapPtr);
+extern Bool afbCreateDefColormap(ScreenPtr);
+
+/* afbfillarc.c */
+
+extern void afbPolyFillArcSolid(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+/* afbfillrct.c */
+
+extern void afbPolyFillRect(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nrectFill*/,
+ xRectangle * /*prectInit*/
+#endif
+);
+
+/* afbply1rct.c */
+extern void afbFillPolygonSolid(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*shape*/,
+ int /*count*/,
+ DDXPointPtr /*ptsIn*/
+#endif
+);
+
+/* afbfillsp.c */
+
+extern void afbSolidFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbStippleFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbTileFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbUnnaturalTileFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbUnnaturalStippleFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbOpaqueStippleFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void afbUnnaturalOpaqueStippleFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+/* afbfont.c */
+
+extern Bool afbRealizeFont(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pscr*/,
+ FontPtr /*pFont*/
+#endif
+);
+
+extern Bool afbUnrealizeFont(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pscr*/,
+ FontPtr /*pFont*/
+#endif
+);
+/* afbgc.c */
+
+extern Bool afbCreateGC(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/
+#endif
+);
+
+extern void afbValidateGC(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ unsigned long /*changes*/,
+ DrawablePtr /*pDrawable*/
+#endif
+);
+
+extern void afbDestroyGC(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/
+#endif
+);
+
+extern void afbReduceRop(
+#if NeedFunctionPrototypes
+ int /*alu*/,
+ Pixel /*src*/,
+ unsigned long /*planemask*/,
+ int /*depth*/,
+ unsigned char * /*rrops*/
+#endif
+);
+
+extern void afbReduceOpaqueStipple (
+#if NeedFunctionPrototypes
+ Pixel /*fg*/,
+ Pixel /*bg*/,
+ unsigned long /*planemask*/,
+ int /*depth*/,
+ unsigned char * /*rrops*/
+#endif
+);
+
+extern void afbComputeCompositeClip(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ DrawablePtr /*pDrawable*/
+#endif
+);
+
+/* afbgetsp.c */
+
+extern void afbGetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*wMax*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ int /*nspans*/,
+ char * /*pdstStart*/
+#endif
+);
+/* afbhrzvert.c */
+
+extern int afbHorzS(
+#if NeedFunctionPrototypes
+ PixelType * /*addrl*/,
+ int /*nlwidth*/,
+ int /*sizeDst*/,
+ int /*depthDst*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*len*/,
+ unsigned char * /*rrops*/
+#endif
+);
+
+extern int afbVertS(
+#if NeedFunctionPrototypes
+ PixelType * /*addrl*/,
+ int /*nlwidth*/,
+ int /*sizeDst*/,
+ int /*depthDst*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*len*/,
+ unsigned char * /*rrops*/
+#endif
+);
+/* afbigbblak.c */
+
+extern void afbImageGlyphBlt (
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* afbigbwht.c */
+
+/* afbimage.c */
+
+extern void afbPutImage(
+#if NeedFunctionPrototypes
+ DrawablePtr /*dst*/,
+ GCPtr /*pGC*/,
+ int /*depth*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ int /*leftPad*/,
+ int /*format*/,
+ char * /*pImage*/
+#endif
+);
+
+extern void afbGetImage(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*sx*/,
+ int /*sy*/,
+ int /*w*/,
+ int /*h*/,
+ unsigned int /*format*/,
+ unsigned long /*planeMask*/,
+ char * /*pdstLine*/
+#endif
+);
+/* afbline.c */
+
+extern void afbLineSS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+#endif
+);
+
+extern void afbLineSD(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+#endif
+);
+
+/* afbmisc.c */
+
+extern void afbQueryBestSize(
+#if NeedFunctionPrototypes
+ int /*class*/,
+ unsigned short * /*pwidth*/,
+ unsigned short * /*pheight*/,
+ ScreenPtr /*pScreen*/
+#endif
+);
+/* afbpntarea.c */
+
+extern void afbSolidFillArea(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ unsigned char * /*rrops*/
+#endif
+);
+
+extern void afbStippleAreaPPW(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ PixmapPtr /*pstipple*/,
+ unsigned char * /*rrops*/
+#endif
+);
+extern void afbStippleArea(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ PixmapPtr /*pstipple*/,
+ int /*xOff*/,
+ int /*yOff*/,
+ unsigned char * /*rrops*/
+#endif
+);
+/* afbplygblt.c */
+
+extern void afbPolyGlyphBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+
+/* afbpixmap.c */
+
+extern PixmapPtr afbCreatePixmap(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ int /*width*/,
+ int /*height*/,
+ int /*depth*/
+#endif
+);
+
+extern Bool afbDestroyPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/
+#endif
+);
+
+extern PixmapPtr afbCopyPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pSrc*/
+#endif
+);
+
+extern void afbPadPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/
+#endif
+);
+
+extern void afbXRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/,
+ int /*rw*/
+#endif
+);
+
+extern void afbYRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/,
+ int /*rh*/
+#endif
+);
+
+extern void afbCopyRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*psrcPix*/,
+ PixmapPtr * /*ppdstPix*/,
+ int /*xrot*/,
+ int /*yrot*/
+#endif
+);
+extern void afbPaintWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ RegionPtr /*pRegion*/,
+ int /*what*/
+#endif
+);
+/* afbpolypnt.c */
+
+extern void afbPolyPoint(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ xPoint * /*pptInit*/
+#endif
+);
+/* afbpushpxl.c */
+
+extern void afbPushPixels(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ PixmapPtr /*pBitMap*/,
+ DrawablePtr /*pDrawable*/,
+ int /*dx*/,
+ int /*dy*/,
+ int /*xOrg*/,
+ int /*yOrg*/
+#endif
+);
+/* afbscrclse.c */
+
+extern Bool afbCloseScreen(
+#if NeedFunctionPrototypes
+ int /*index*/,
+ ScreenPtr /*pScreen*/
+#endif
+);
+/* afbscrinit.c */
+
+extern Bool afbAllocatePrivates(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ int * /*pWinIndex*/,
+ int * /*pGCIndex*/
+#endif
+);
+
+extern Bool afbScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ pointer /*pbits*/,
+ int /*xsize*/,
+ int /*ysize*/,
+ int /*dpix*/,
+ int /*dpiy*/,
+ int /*width*/
+#endif
+);
+
+extern PixmapPtr afbGetWindowPixmap(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern void afbSetWindowPixmap(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ PixmapPtr /*pPix*/
+#endif
+);
+
+/* afbseg.c */
+
+extern void afbSegmentSS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSeg*/
+#endif
+);
+
+extern void afbSegmentSD(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSeg*/
+#endif
+);
+/* afbsetsp.c */
+
+extern int afbSetScanline(
+#if NeedFunctionPrototypes
+ int /*y*/,
+ int /*xOrigin*/,
+ int /*xStart*/,
+ int /*xEnd*/,
+ PixelType * /*psrc*/,
+ int /*alu*/,
+ PixelType * /*pdstBase*/,
+ int /*widthDst*/,
+ int /*sizeDst*/,
+ int /*depthDst*/,
+ int /*sizeSrc*/
+#endif
+);
+
+extern void afbSetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ char * /*psrc*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ int /*nspans*/,
+ int /*fSorted*/
+#endif
+);
+/* afbtegblt.c */
+
+extern void afbTEGlyphBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* afbtileC.c */
+
+extern void afbTileAreaPPWCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbtileG.c */
+
+extern void afbTileAreaPPWGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void afbTileAreaCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ int /*xOff*/,
+ int /*yOff*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbtileG.c */
+
+extern void afbTileAreaGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ int /*xOff*/,
+ int /*yOff*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void afbOpaqueStippleAreaPPWCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ unsigned char */*rropsOS*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbtileG.c */
+
+extern void afbOpaqueStippleAreaPPWGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ unsigned char */*rropsOS*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void afbOpaqueStippleAreaCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ int /*xOff*/,
+ int /*yOff*/,
+ unsigned char */*rropsOS*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* afbtileG.c */
+
+extern void afbOpaqueStippleAreaGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ int /*nbox*/,
+ BoxPtr /*pbox*/,
+ int /*alu*/,
+ PixmapPtr /*ptile*/,
+ int /*xOff*/,
+ int /*yOff*/,
+ unsigned char */*rropsOS*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+/* afbwindow.c */
+
+extern Bool afbCreateWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern Bool afbDestroyWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern Bool afbMapWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWindow*/
+#endif
+);
+
+extern Bool afbPositionWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/
+#endif
+);
+
+extern Bool afbUnmapWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWindow*/
+#endif
+);
+
+extern void afbCopyWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ DDXPointRec /*ptOldOrg*/,
+ RegionPtr /*prgnSrc*/
+#endif
+);
+
+extern Bool afbChangeWindowAttributes(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ unsigned long /*mask*/
+#endif
+);
+/* afbzerarc.c */
+
+extern void afbZeroPolyArcSS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+
+/*
+ private field of pixmap
+ pixmap.devPrivate = (PixelType *)pointer_to_bits
+ pixmap.devKind = width_of_pixmap_in_bytes
+
+ private field of screen
+ a pixmap, for which we allocate storage. devPrivate is a pointer to
+the bits in the hardware framebuffer. note that devKind can be poked to
+make the code work for framebuffers that are wider than their
+displayable screen (e.g. the early vsII, which displayed 960 pixels
+across, but was 1024 in the hardware.)
+
+ private field of GC
+*/
+
+typedef struct {
+ unsigned char rrops[AFB_MAX_DEPTH]; /* reduction of rasterop to 1 of 3 */
+ unsigned char rropOS[AFB_MAX_DEPTH]; /* rop for opaque stipple */
+} afbPrivGC;
+typedef afbPrivGC *afbPrivGCPtr;
+
+extern int afbGCPrivateIndex; /* index into GC private array */
+extern int afbWindowPrivateIndex; /* index into Window private array */
+#ifdef PIXMAP_PER_WINDOW
+extern int frameWindowPrivateIndex; /* index into Window private array */
+#endif
+
+#define afbGetGCPrivate(pGC) \
+ ((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr))
+
+/* private field of window */
+typedef struct {
+ unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */
+ unsigned char fastBackground;
+ unsigned short unused; /* pad for alignment with Sun compiler */
+ DDXPointRec oldRotate;
+ PixmapPtr pRotatedBackground;
+ PixmapPtr pRotatedBorder;
+} afbPrivWin;
+
+/* Common macros for extracting drawing information */
+
+#define afbGetTypedWidth(pDrawable,wtype)( \
+ (((pDrawable)->type == DRAWABLE_WINDOW) ? \
+ (int)(((PixmapPtr)((pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr))->devKind) : \
+ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
+
+#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
+
+#define afbGetPixelWidth(pDrawable) afbGetTypedWidth(pDrawable, PixelType)
+
+#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
+ PixmapPtr _pPix; \
+ if ((pDrawable)->type == DRAWABLE_WINDOW) \
+ _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
+ else \
+ _pPix = (PixmapPtr)(pDrawable); \
+ (pointer) = (ptype *) _pPix->devPrivate.ptr; \
+ (width) = ((int) _pPix->devKind) / sizeof (wtype); \
+}
+
+#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
+ PixmapPtr _pPix; \
+ if ((pDrawable)->type == DRAWABLE_WINDOW) \
+ _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
+ else \
+ _pPix = (PixmapPtr)(pDrawable); \
+ (pointer) = (PixelType *)_pPix->devPrivate.ptr; \
+ (width) = ((int)_pPix->devKind) / sizeof (PixelType); \
+ (size) = (width) * _pPix->drawable.height; \
+ (dep) = _pPix->drawable.depth; \
+}
+
+#define afbGetByteWidthAndPointer(pDrawable, width, pointer) \
+ afbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
+
+#define afbGetPixelWidthAndPointer(pDrawable, width, pointer) \
+ afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
+
+#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
+ PixmapPtr _pPix = (PixmapPtr)(pWin)->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
+ (pointer) = (ptype *) _pPix->devPrivate.ptr; \
+ (width) = ((int) _pPix->devKind) / sizeof (wtype); \
+}
+
+#define afbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
+ afbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
+
+#define afbGetWindowByteWidthAndPointer(pWin, width, pointer) \
+ afbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
+
+/* afb uses the following macros to calculate addresses in drawables.
+ * To support banked framebuffers, the macros come in four flavors.
+ * All four collapse into the same definition on unbanked devices.
+ *
+ * afbScanlineFoo - calculate address and do bank switching
+ * afbScanlineFooNoBankSwitch - calculate address, don't bank switch
+ * afbScanlineFooSrc - calculate address, switch source bank
+ * afbScanlineFooDst - calculate address, switch destination bank
+ */
+
+/* The NoBankSwitch versions are the same for banked and unbanked cases */
+
+#define afbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
+#define afbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
+#define afbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
+ afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
+#define afbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
+ afbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
+
+#ifdef MFB_LINE_BANK
+
+#include "afblinebank.h" /* get macro definitions from this file */
+
+#else /* !MFB_LINE_BANK - unbanked case */
+
+#define afbScanlineInc(_ptr, _off) afbScanlineIncNoBankSwitch(_ptr, _off)
+#define afbScanlineIncSrc(_ptr, _off) afbScanlineInc(_ptr, _off)
+#define afbScanlineIncDst(_ptr, _off) afbScanlineInc(_ptr, _off)
+
+#define afbScanlineOffset(_ptr, _off) afbScanlineOffsetNoBankSwitch(_ptr, _off)
+#define afbScanlineOffsetSrc(_ptr, _off) afbScanlineOffset(_ptr, _off)
+#define afbScanlineOffsetDst(_ptr, _off) afbScanlineOffset(_ptr, _off)
+
+#define afbScanlineSrc(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
+#define afbScanlineDst(_ptr, _x, _y, _w) afbScanline(_ptr, _x, _y, _w)
+
+#define afbScanlineDeltaSrc(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
+#define afbScanlineDeltaDst(_ptr, _y, _w) afbScanlineDelta(_ptr, _y, _w)
+
+#endif /* MFB_LINE_BANK */
+
+#define afbScanlineDelta(_ptr, _y, _w) \
+ afbScanlineOffset(_ptr, (_y) * (_w))
+
+#define afbScanline(_ptr, _x, _y, _w) \
+ afbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
+
+/* precomputed information about each glyph for GlyphBlt code.
+ this saves recalculating the per glyph information for each box.
+*/
+
+typedef struct _afbpos{
+ int xpos; /* xposition of glyph's origin */
+ int xchar; /* x position mod 32 */
+ int leftEdge;
+ int rightEdge;
+ int topEdge;
+ int bottomEdge;
+ PixelType *pdstBase; /* longword with character origin */
+ int widthGlyph; /* width in bytes of this glyph */
+} afbTEXTPOS;
+
+/* reduced raster ops for afb */
+#define RROP_BLACK GXclear
+#define RROP_WHITE GXset
+#define RROP_NOP GXnoop
+#define RROP_INVERT GXinvert
+#define RROP_COPY GXcopy
+
+/* macros for afbbitblt.c, afbfillsp.c
+ these let the code do one switch on the rop per call, rather
+ than a switch on the rop per item (span or rectangle.)
+*/
+
+#define fnCLEAR(src, dst) (0)
+#define fnAND(src, dst) (src & dst)
+#define fnANDREVERSE(src, dst) (src & ~dst)
+#define fnCOPY(src, dst) (src)
+#define fnANDINVERTED(src, dst) (~src & dst)
+#define fnNOOP(src, dst) (dst)
+#define fnXOR(src, dst) (src ^ dst)
+#define fnOR(src, dst) (src | dst)
+#define fnNOR(src, dst) (~(src | dst))
+#define fnEQUIV(src, dst) (~src ^ dst)
+#define fnINVERT(src, dst) (~dst)
+#define fnORREVERSE(src, dst) (src | ~dst)
+#define fnCOPYINVERTED(src, dst) (~src)
+#define fnORINVERTED(src, dst) (~src | dst)
+#define fnNAND(src, dst) (~(src & dst))
+#undef fnSET
+#define fnSET(src, dst) (~0)
+
+/* Using a "switch" statement is much faster in most cases
+ * since the compiler can do a look-up table or multi-way branch
+ * instruction, depending on the architecture. The result on
+ * A Sun 3/50 is at least 2.5 times faster, assuming a uniform
+ * distribution of RasterOp operation types.
+ *
+ * However, doing some profiling on a running system reveals
+ * GXcopy is the operation over 99.5% of the time and
+ * GXxor is the next most frequent (about .4%), so we make special
+ * checks for those first.
+ *
+ * Note that this requires a change to the "calling sequence"
+ * since we can't engineer a "switch" statement to have an lvalue.
+ */
+#undef DoRop
+#define DoRop(result, alu, src, dst) \
+{ \
+ if (alu == GXcopy) \
+ result = fnCOPY (src, dst); \
+ else if (alu == GXxor) \
+ result = fnXOR (src, dst); \
+ else \
+ switch (alu) { \
+ case GXclear: \
+ result = fnCLEAR (src, dst); \
+ break; \
+ case GXand: \
+ result = fnAND (src, dst); \
+ break; \
+ case GXandReverse: \
+ result = fnANDREVERSE (src, dst); \
+ break; \
+ case GXandInverted: \
+ result = fnANDINVERTED (src, dst); \
+ break; \
+ case GXnoop: \
+ result = fnNOOP (src, dst); \
+ break; \
+ case GXor: \
+ result = fnOR (src, dst); \
+ break; \
+ case GXnor: \
+ result = fnNOR (src, dst); \
+ break; \
+ case GXequiv: \
+ result = fnEQUIV (src, dst); \
+ break; \
+ case GXinvert: \
+ result = fnINVERT (src, dst); \
+ break; \
+ case GXorReverse: \
+ result = fnORREVERSE (src, dst); \
+ break; \
+ case GXcopyInverted: \
+ result = fnCOPYINVERTED (src, dst); \
+ break; \
+ case GXorInverted: \
+ result = fnORINVERTED (src, dst); \
+ break; \
+ case GXnand: \
+ result = fnNAND (src, dst); \
+ break; \
+ case GXset: \
+ result = fnSET (src, dst); \
+ break; \
+ } \
+}
+
+
+/* C expression fragments for various operations. These get passed in
+ * as -D's on the compile command line. See afb/Imakefile. This
+ * fixes XBUG 6319.
+ *
+ * This seems like a good place to point out that afb's use of the
+ * words black and white is an unfortunate misnomer. In afb code, black
+ * means zero, and white means one.
+ */
+#define MFB_OPEQ_WHITE |=
+#define MFB_OPEQ_BLACK &=~
+#define MFB_OPEQ_INVERT ^=
+#define MFB_EQWHOLEWORD_WHITE =~0
+#define MFB_EQWHOLEWORD_BLACK =0
+#define MFB_EQWHOLEWORD_INVERT ^=~0
+#define MFB_OP_WHITE /* nothing */
+#define MFB_OP_BLACK ~
+
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
+
diff --git a/xc/programs/Xserver/afb/afbbitblt.c b/xc/programs/Xserver/afb/afbbitblt.c
new file mode 100644
index 000000000..c88800b4b
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbbitblt.c
@@ -0,0 +1,476 @@
+/* $XFree86: xc/programs/Xserver/afb/afbbitblt.c,v 3.2 1998/03/20 21:04:53 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbbitblt.c,v 5.25 94/04/17 20:28:16 dpw Exp $ */
+
+#include "X.h"
+#include "Xprotostr.h"
+
+#include "miscstruct.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "mi.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+
+static unsigned char afbRropsOS[AFB_MAX_DEPTH];
+
+/* CopyArea and CopyPlane for a monchrome frame buffer
+
+
+ clip the source rectangle to the source's available bits. (this
+avoids copying unnecessary pieces that will just get exposed anyway.)
+this becomes the new shape of the destination.
+ clip the destination region to the composite clip in the
+GC. this requires translating the destination region to (dstx, dsty).
+ build a list of source points, one for each rectangle in the
+destination. this is a simple translation.
+ go do the multiple rectangle copies
+ do graphics exposures
+*/
+/** Optimized for drawing pixmaps into windows, especially when drawing into
+ ** unobscured windows. Calls to the general-purpose region code were
+ ** replaced with rectangle-to-rectangle clipping comparisions. This is
+ ** possible, since the pixmap is a single rectangle. In an unobscured
+ ** window, the destination clip is also a single rectangle, and region
+ ** code can be avoided entirely. This is a big savings, since the region
+ ** code uses XAlloc() and makes many function calls.
+ **
+ ** In addition, if source is a pixmap, there is no need to call the
+ ** expensive miHandleExposures() routine. Instead, we simply return NULL.
+ **
+ ** Previously, drawing a pixmap into an unobscured window executed at least
+ ** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code.
+ **
+ ** Now, the same operation requires no XAlloc()'s, no region function calls,
+ ** and much less overhead. Nice for drawing lots of small pixmaps.
+ */
+
+void
+afbDoBitblt(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ switch (alu) {
+ case GXcopy:
+ afbDoBitbltCopy(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ break;
+ case GXxor:
+ afbDoBitbltXor(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ break;
+ case GXcopyInverted:
+ afbDoBitbltCopyInverted(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ break;
+ case GXor:
+ afbDoBitbltOr(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ break;
+ default:
+ afbDoBitbltGeneral(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+ break;
+ }
+}
+
+RegionPtr
+afbCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
+ dstx, dsty)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+{
+ void (*doBitBlt)();
+
+ switch (pGC->alu) {
+ case GXcopy:
+ doBitBlt = afbDoBitbltCopy;
+ break;
+ case GXxor:
+ doBitBlt = afbDoBitbltXor;
+ break;
+ case GXcopyInverted:
+ doBitBlt = afbDoBitbltCopyInverted;
+ break;
+ case GXor:
+ doBitBlt = afbDoBitbltOr;
+ break;
+ default:
+ doBitBlt = afbDoBitbltGeneral;
+ break;
+ }
+
+ return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
+ width, height, dstx, dsty, doBitBlt, pGC->planemask));
+}
+
+RegionPtr
+afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
+ dstx, dsty, doBitBlt, planemask)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ register GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+ void (*doBitBlt)();
+ unsigned long planemask;
+{
+ RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ Bool freeSrcClip = FALSE;
+
+ RegionPtr prgnExposed;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ register BoxPtr pbox;
+ int i;
+ register int dx;
+ register int dy;
+ xRectangle origSource;
+ DDXPointRec origDest;
+ int numRects;
+ BoxRec fastBox;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+ void (*localDoBitBlt)();
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if ((pSrcDrawable != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate)
+ (*pSrcDrawable->pScreen->SourceValidate)(pSrcDrawable, srcx, srcy, width,
+ height);
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP)
+ if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = pGC->pCompositeClip;
+ else
+ fastClip = 1;
+ else if (pGC->subWindowMode == IncludeInferiors)
+ if (!((WindowPtr)pSrcDrawable)->parent)
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ else if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = pGC->pCompositeClip;
+ else {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ else
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip) {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x) {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y) {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int)pSrcDrawable->width) {
+ fastBox.x2 = pSrcDrawable->x + (int)pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int)pSrcDrawable->height) {
+ fastBox.y2 = pSrcDrawable->y + (int)pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW)
+ if (!((WindowPtr)pDstDrawable)->realized) {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip) {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+ cclip = pGC->pCompositeClip;
+ if (REGION_NUM_RECTS(cclip) == 1) {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1)
+ fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2)
+ fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1)
+ fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2)
+ fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
+ REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0);
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ } else {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
+ }
+ } else
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+
+ if (!fastClip) {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
+ pGC->pCompositeClip);
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height) {
+ if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+ sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doBitBlt)(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc,
+ planemask);
+
+ DEALLOCATE_LOCAL(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose) {
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height, origDest.x,
+ origDest.y, (unsigned long)0);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
+
+RegionPtr
+afbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
+ dstx, dsty, plane)
+DrawablePtr pSrcDrawable, pDstDrawable;
+register GC *pGC;
+int srcx, srcy;
+int width, height;
+int dstx, dsty;
+unsigned long plane;
+{
+ int alu;
+ RegionPtr prgnExposed = NULL;
+ unsigned long old_planemask;
+ PixmapPtr pPixmap = NULL;
+
+ if (pDstDrawable->depth == 1) {
+ old_planemask = pGC->planemask;
+ pGC->planemask = plane;
+ if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) {
+ prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ } else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) {
+ unsigned char rop;
+
+ afbReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop);
+ alu = pGC->alu;
+ pGC->alu = rop;
+ prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx,
+ dsty);
+ pGC->alu = alu;
+ } else { /* need to invert the src */
+ alu = pGC->alu;
+ pGC->alu = afbInverseAlu[alu];
+ prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx,
+ dsty);
+ pGC->alu = alu;
+ }
+ pGC->planemask = old_planemask;
+ } else {
+ int free_pixmap = FALSE;
+ PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable;
+ ScreenPtr pScreen = pSrcDrawable->pScreen;
+ GCPtr pGC1;
+
+ if (pSrcDrawable == pDstDrawable ||
+ pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) {
+ /* Copy a plane from source drawable to a tmp 1-bit deep pixmap */
+ /* XXX: Range check width and height */
+ pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1);
+
+ if (!pBitmap)
+ return(NULL);
+ pGC1 = GetScratchGC(1, pScreen);
+ if (!pGC1) {
+ (*pScreen->DestroyPixmap)(pBitmap);
+ return(NULL);
+ }
+ ValidateGC((DrawablePtr)pBitmap, pGC1);
+ (void)afbBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy,
+ width, height, 0, 0, afbDoBitbltCopy, plane);
+ free_pixmap = TRUE;
+ }
+#if 0
+ else {
+ /* XXX: could cope with N-deep pixmap source case without using tmp
+ * src bitmap by setting up a scratch pixmap header and fiddle
+ * around with the pbits pointer.
+ */
+ }
+#endif
+ afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->depth, afbRropsOS);
+ (void)afbBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width,
+ height, dstx, dsty, afbCopy1ToN, pGC->planemask);
+ if (free_pixmap) {
+ (*pScreen->DestroyPixmap)(pBitmap);
+ FreeScratchGC(pGC1);
+ }
+
+ if (pGC->fExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx,
+ srcy, width, height, dstx, dsty,
+ plane);
+ }
+ return prgnExposed;
+}
+
+void
+afbCopy1ToN(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ int numRects = REGION_NUM_RECTS(prgnDst);
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int r;
+
+ for (r = 0; r < numRects; r++, pbox++, pptSrc++) {
+ int dx = pptSrc->x;
+ int dy = pptSrc->y;
+
+ if (alu == GXcopy)
+ afbOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy,
+ afbRropsOS, planemask);
+ else
+ afbOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx,
+ dy, afbRropsOS, planemask);
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbblt.c b/xc/programs/Xserver/afb/afbblt.c
new file mode 100644
index 000000000..b7a670dd4
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbblt.c
@@ -0,0 +1,566 @@
+/* $XFree86: xc/programs/Xserver/afb/afbblt.c,v 3.0 1996/08/18 01:45:24 dawes Exp $ */
+/*
+ * afb copy area
+ */
+
+/*
+
+Copyright (c) 1989 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+Author: Keith Packard
+
+*/
+/* $XConsortium: afbblt.c,v 1.11 94/04/17 20:28:16 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "maskbits.h"
+#include "fastblt.h"
+#include "mergerop.h"
+
+void
+MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ PixelType *psrcBase, *pdstBase; /* start of src and dst bitmaps */
+ int widthSrc, widthDst; /* add to get to same position in next line */
+ int heightSrc, heightDst;
+ int sizeSrc, sizeDst;
+
+ BoxPtr pbox;
+ int nbox;
+
+ BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ /* temporaries for shuffling rectangles */
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ /* shuffling boxes entails shuffling the
+ source points too */
+ int w, h;
+ int xdir; /* 1 = left right, -1 = right left/ */
+ int ydir; /* 1 = top down, -1 = bottom up */
+
+ PixelType *psrcLine, *pdstLine;
+ /* pointers to line with current src and dst */
+ register PixelType *psrc; /* pointer to current src longword */
+ register PixelType *pdst; /* pointer to current dst longword */
+
+ MROP_DECLARE_REG()
+
+ /* following used for looping through a line */
+ PixelType startmask, endmask; /* masks for writing ends of dst */
+ int nlMiddle; /* whole longwords in dst */
+ int xoffSrc, xoffDst;
+ register int leftShift, rightShift;
+ register PixelType bits;
+ register PixelType bits1;
+ register int nl; /* temp copy of nlMiddle */
+
+ /* place to store full source word */
+ int nstart; /* number of ragged bits at start of dst */
+ int nend; /* number of ragged bits at end of dst */
+ int srcStartOver; /* pulling nstart bits from src
+ overflows into the next word? */
+ int careful;
+ int tmpSrc;
+ int depthSrc;
+ int depthDst;
+
+ MROP_INITIALIZE(alu,0);
+
+ afbGetPixelWidthSizeDepthAndPointer(pSrc, widthSrc, sizeSrc, depthSrc,
+ psrcBase);
+ afbGetPixelWidthSizeDepthAndPointer(pDst, widthDst, sizeDst, depthDst,
+ pdstBase);
+
+ /* Special case where depth of dest pixmap is 1 but source pixmap isn't
+ * Used for GetImage to copy a plane from a source pixmap to a particular
+ * dest pixmap plane.
+ * Note: planemask should have only one bit set or several planes from
+ * the source will be copied to the same dest plane.
+ */
+ if (depthDst == 1 && depthDst != depthSrc)
+ sizeDst = 0;
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1)) {
+ /* walk source botttom to top */
+ ydir = -1;
+ widthSrc = -widthSrc;
+ widthDst = -widthDst;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+ if(!pptNew1) {
+ DEALLOCATE_LOCAL(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ } else {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1)) {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2) {
+ if (pptNew2)
+ DEALLOCATE_LOCAL(pptNew2);
+ if (pboxNew2)
+ DEALLOCATE_LOCAL(pboxNew2);
+ if (pboxNew1) {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox) {
+ while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ } else {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ while(nbox--) {
+ int d;
+ for (d = 0; d < depthSrc; d++) {
+ PixelType *psrcB;
+ PixelType *pdstB;
+
+ if (!(planemask & (1 << d)))
+ continue;
+
+ psrcB = psrcBase + sizeSrc * d; /* @@@ NEXT PLANE @@@ */
+ pdstB = pdstBase + sizeDst * d; /* @@@ NEXT PLANE @@@ */
+
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+
+ if (ydir == -1) { /* start at last scanline of rectangle */
+ psrcLine = afbScanlineDeltaSrc(psrcB, -(pptSrc->y+h-1), widthSrc);
+ pdstLine = afbScanlineDeltaDst(pdstB, -(pbox->y2-1), widthDst);
+ } else { /* start at first scanline */
+ psrcLine = afbScanlineDeltaSrc(psrcB, pptSrc->y, widthSrc);
+ pdstLine = afbScanlineDeltaDst(pdstB, pbox->y1, widthDst);
+ }
+ if ((pbox->x1 & PIM) + w <= PPW) {
+ maskpartialbits (pbox->x1, w, startmask);
+ endmask = 0;
+ nlMiddle = 0;
+ } else {
+ maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
+ }
+ if (xdir == 1) {
+ xoffSrc = pptSrc->x & PIM;
+ xoffDst = pbox->x1 & PIM;
+ pdstLine += (pbox->x1 >> PWSH);
+ psrcLine += (pptSrc->x >> PWSH);
+#ifdef DO_UNALIGNED_BITBLT
+ nl = xoffSrc - xoffDst;
+ psrcLine = (PixelType *)(((unsigned char *) psrcLine) + nl);
+#else
+ if (xoffSrc == xoffDst)
+#endif
+ {
+ while (h--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ if (startmask) {
+ *pdst = MROP_MASK(*psrc, *pdst, startmask);
+ psrc++;
+ pdst++;
+ }
+ nl = nlMiddle;
+
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
+#define BodyEven(n) BodyOdd(n)
+
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+#ifdef NOTDEF
+ /* you'd think this would be faster --
+ * a single instruction instead of 6
+ * but measurements show it to be ~15% slower
+ */
+ while ((nl -= 6) >= 0) {
+ asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
+ : "=m" (*(char *)pdst)
+ : "m" (*(char *)psrc)
+ : "d0", "d1", "d2", "d3",
+ "a2", "a3");
+ pdst += 6;
+ }
+ nl += 6;
+ while (nl--)
+ *pdst++ = *psrc++;
+#endif
+ DuffL(nl, label1,
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;)
+#endif
+
+ if (endmask)
+ *pdst = MROP_MASK(*psrc, *pdst, endmask);
+ afbScanlineIncDst(pdstLine, widthDst);
+ afbScanlineIncSrc(psrcLine, widthSrc);
+ }
+ }
+#ifndef DO_UNALIGNED_BITBLT
+ else {
+ if (xoffSrc > xoffDst) {
+ leftShift = (xoffSrc - xoffDst);
+ rightShift = PPW - leftShift;
+ } else {
+ rightShift = (xoffDst - xoffSrc);
+ leftShift = PPW - rightShift;
+ }
+ while (h--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ bits = 0;
+ if (xoffSrc > xoffDst)
+ bits = *psrc++;
+ if (startmask) {
+ bits1 = BitLeft(bits,leftShift);
+ bits = *psrc++;
+ bits1 |= BitRight(bits,rightShift);
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) \
+bits = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
+
+#define BodyEven(n) \
+bits1 = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+bits = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
+pdst++;
+
+#define BodyEven(n) \
+bits1 = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
+pdst++;
+
+#define LoopReset ;
+
+#endif /* !FAST_CONSTANT_OFFSET_MODE */
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL(nl,label2,
+ bits1 = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
+ pdst++;
+ )
+#endif
+
+ if (endmask) {
+ bits1 = BitLeft(bits, leftShift);
+ if (BitLeft(endmask, rightShift)) {
+ bits = *psrc;
+ bits1 |= BitRight(bits, rightShift);
+ }
+ *pdst = MROP_MASK (bits1, *pdst, endmask);
+ }
+ afbScanlineIncDst(pdstLine, widthDst);
+ afbScanlineIncSrc(psrcLine, widthSrc);
+ }
+ }
+#endif /* DO_UNALIGNED_BITBLT */
+ } else { /* xdir == -1 */
+ xoffSrc = (pptSrc->x + w - 1) & PIM;
+ xoffDst = (pbox->x2 - 1) & PIM;
+ pdstLine += ((pbox->x2-1) >> PWSH) + 1;
+ psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
+#ifdef DO_UNALIGNED_BITBLT
+ nl = xoffSrc - xoffDst;
+ psrcLine = (PixelType *)
+ (((unsigned char *) psrcLine) + nl);
+#else
+ if (xoffSrc == xoffDst)
+#endif
+ {
+ while (h--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ if (endmask) {
+ pdst--;
+ psrc--;
+ *pdst = MROP_MASK (*psrc, *pdst, endmask);
+ }
+ nl = nlMiddle;
+
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+ psrc -= nl & (UNROLL - 1);
+ pdst -= nl & (UNROLL - 1);
+
+#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
+
+#define BodyEven(n) BodyOdd(n)
+
+#define LoopReset \
+pdst -= UNROLL;\
+psrc -= UNROLL;
+
+#else
+
+#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
+#define BodyEven(n) BodyOdd(n)
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL(nl,label3,
+ --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
+#endif
+
+ if (startmask) {
+ --pdst;
+ --psrc;
+ *pdst = MROP_MASK(*psrc, *pdst, startmask);
+ }
+ afbScanlineIncDst(pdstLine, widthDst);
+ afbScanlineIncSrc(psrcLine, widthSrc);
+ }
+ }
+#ifndef DO_UNALIGNED_BITBLT
+ else {
+ if (xoffDst > xoffSrc) {
+ rightShift = (xoffDst - xoffSrc);
+ leftShift = PPW - rightShift;
+ } else {
+ leftShift = (xoffSrc - xoffDst);
+ rightShift = PPW - leftShift;
+ }
+ while (h--) {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ bits = 0;
+ if (xoffDst > xoffSrc)
+ bits = *--psrc;
+ if (endmask) {
+ bits1 = BitRight(bits, rightShift);
+ bits = *--psrc;
+ bits1 |= BitLeft(bits, leftShift);
+ pdst--;
+ *pdst = MROP_MASK(bits1, *pdst, endmask);
+ }
+ nl = nlMiddle;
+
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+#ifdef FAST_CONSTANT_OFFSET_MODE
+ psrc -= nl & (UNROLL - 1);
+ pdst -= nl & (UNROLL - 1);
+
+#define BodyOdd(n) \
+bits = psrc[n-1]; \
+pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
+
+#define BodyEven(n) \
+bits1 = psrc[n-1]; \
+pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
+
+#define LoopReset \
+pdst -= UNROLL; \
+psrc -= UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+bits = *--psrc; --pdst; \
+*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
+
+#define BodyEven(n) \
+bits1 = *--psrc; --pdst; \
+*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
+
+#define LoopReset ;
+
+#endif
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL(nl, label4,
+ bits1 = BitRight(bits, rightShift);
+ bits = *--psrc;
+ --pdst;
+ *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
+ )
+#endif
+
+ if (startmask) {
+ bits1 = BitRight(bits, rightShift);
+ if (BitRight (startmask, leftShift)) {
+ bits = *--psrc;
+ bits1 |= BitLeft(bits, leftShift);
+ }
+ --pdst;
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ }
+ afbScanlineIncDst(pdstLine, widthDst);
+ afbScanlineIncSrc(psrcLine, widthSrc);
+ }
+ }
+#endif
+ }
+ }
+ pbox++;
+ pptSrc++;
+ }
+ if (pboxNew2) {
+ DEALLOCATE_LOCAL(pptNew2);
+ DEALLOCATE_LOCAL(pboxNew2);
+ }
+ if (pboxNew1) {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbbres.c b/xc/programs/Xserver/afb/afbbres.c
new file mode 100644
index 000000000..227f3bc1f
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbbres.c
@@ -0,0 +1,321 @@
+/* $XFree86: xc/programs/Xserver/afb/afbbres.c,v 3.0 1996/08/18 01:45:25 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbbres.c,v 1.22 94/04/17 20:28:17 dpw Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#include "afb.h"
+#include "maskbits.h"
+#include "miline.h"
+
+/* Solid bresenham line */
+/* NOTES
+ e2 is used less often than e1, so it's not in a register
+*/
+
+void
+afbBresS(addrlbase, nlwidth, sizeDst, depthDst, signdx, signdy, axis, x1, y1,
+ e, e1, e2, len, rrops)
+PixelType *addrlbase; /* pointer to base of bitmap */
+int nlwidth; /* width in longwords of bitmap */
+int sizeDst;
+int depthDst;
+int signdx, signdy; /* signs of directions */
+int axis; /* major axis (Y_AXIS or X_AXIS) */
+int x1, y1; /* initial point */
+register int e; /* error accumulator */
+register int e1; /* bresenham increments */
+int e2;
+int len; /* length of line */
+unsigned char *rrops;
+{
+ register int yinc; /* increment to next scanline, in bytes */
+ register PixelType *addrl; /* bitmask long pointer */
+ register PixelType bit; /* current bit being set/cleared/etc. */
+ PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
+ PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
+
+ register int e3 = e2-e1;
+ PixelType tmp;
+ int saveE;
+ int saveLen;
+ int d;
+
+ /* point to longword containing first point */
+ yinc = signdy * nlwidth;
+ e = e-e1; /* to make looping easier */
+
+ if (!len)
+ return;
+
+ saveLen = len;
+ saveE = e;
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(addrlbase, x1, y1, nlwidth);
+ addrlbase += sizeDst; /* @@@ NEXT PLANE @@@ */
+ len = saveLen;
+ e = saveE;
+ bit = mask[x1 & PIM];
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ if (axis == X_AXIS) {
+ if (signdx > 0) {
+ tmp = *addrl;
+ for (;;) {
+ tmp &= ~bit;
+ if (!--len)
+ break;
+ bit = SCRRIGHT(bit,1);
+ e += e1;
+ if (e >= 0) {
+ *addrl = tmp;
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ if (!bit) {
+ bit = leftbit;
+ addrl ++;
+ }
+ tmp = *addrl;
+ } else if (!bit) {
+ *addrl = tmp;
+ bit = leftbit;
+ addrl ++;
+ tmp = *addrl;
+ }
+ }
+ *addrl = tmp;
+ } else {
+ tmp = *addrl;
+ for (;;) {
+ tmp &= ~bit;
+ if (!--len)
+ break;
+ e += e1;
+ bit = SCRLEFT(bit,1);
+ if (e >= 0) {
+ *addrl = tmp;
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ if (!bit) {
+ bit = rightbit;
+ addrl --;
+ }
+ tmp = *addrl;
+ } else if (!bit) {
+ *addrl = tmp;
+ bit = rightbit;
+ addrl --;
+ tmp = *addrl;
+ }
+ }
+ *addrl = tmp;
+ }
+ } /* if X_AXIS */ else {
+ if (signdx > 0) {
+ while(len--) {
+ *addrl &= ~bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ } else {
+ while(len--) {
+ *addrl &= ~bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit;addrl --; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ }
+ } /* else Y_AXIS */
+ break;
+
+ case RROP_WHITE:
+ if (axis == X_AXIS) {
+ if (signdx > 0) {
+ tmp = *addrl;
+ for (;;) {
+ tmp |= bit;
+ if (!--len)
+ break;
+ e += e1;
+ bit = SCRRIGHT(bit,1);
+ if (e >= 0) {
+ *addrl = tmp;
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ if (!bit) {
+ bit = leftbit;
+ addrl ++;
+ }
+ tmp = *addrl;
+ } else if (!bit) {
+ *addrl = tmp;
+ bit = leftbit;
+ addrl ++;
+ tmp = *addrl;
+ }
+ }
+ *addrl = tmp;
+ } else {
+ tmp = *addrl;
+ for (;;) {
+ tmp |= bit;
+ if (!--len)
+ break;
+ e += e1;
+ bit = SCRLEFT(bit,1);
+ if (e >= 0) {
+ *addrl = tmp;
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ if (!bit) {
+ bit = rightbit;
+ addrl --;
+ }
+ tmp = *addrl;
+ } else if (!bit) {
+ *addrl = tmp;
+ bit = rightbit;
+ addrl --;
+ tmp = *addrl;
+ }
+ }
+ *addrl = tmp;
+ }
+ } /* if X_AXIS */ else {
+ if (signdx > 0) {
+ while(len--) {
+ *addrl |= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ } else {
+ while(len--) {
+ *addrl |= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit;addrl --; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ }
+ } /* else Y_AXIS */
+ break;
+
+ case RROP_INVERT:
+ if (axis == X_AXIS) {
+ if (signdx > 0) {
+ while(len--) {
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ }
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ }
+ } else {
+ while(len--) {
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ }
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit;addrl --; }
+ }
+ }
+ } /* if X_AXIS */ else {
+ if (signdx > 0) {
+ while(len--) {
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ } else {
+ while(len--) {
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit; addrl --; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ }
+ }
+ } /* else Y_AXIS */
+ } /* switch */
+ } /* for (d = ... ) */
+}
diff --git a/xc/programs/Xserver/afb/afbbresd.c b/xc/programs/Xserver/afb/afbbresd.c
new file mode 100644
index 000000000..57309175e
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbbresd.c
@@ -0,0 +1,212 @@
+/* $XFree86: xc/programs/Xserver/afb/afbbresd.c,v 3.0 1996/08/18 01:45:26 dawes Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbbresd.c,v 1.10 94/04/17 20:28:18 dpw Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#include "afb.h"
+#include "maskbits.h"
+#include "miline.h"
+
+/* Dashed bresenham line */
+
+#define StepDash\
+ if (!--dashRemaining) { \
+ if (++ dashIndex == numInDashList) \
+ dashIndex = 0; \
+ dashRemaining = pDash[dashIndex]; \
+ rop = fgrop; \
+ if (dashIndex & 1) \
+ rop = bgrop; \
+ }
+
+void
+afbBresD(pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
+ addrlbase, nlwidth, sizeDst, depthDst,
+ signdx, signdy, axis, x1, y1, e, e1, e2, len, rrops, bgrrops)
+int *pdashIndex; /* current dash */
+unsigned char *pDash; /* dash list */
+int numInDashList; /* total length of dash list */
+int *pdashOffset; /* offset into current dash */
+int isDoubleDash;
+PixelType *addrlbase; /* pointer to base of bitmap */
+int nlwidth; /* width in longwords of bitmap */
+int sizeDst;
+int depthDst;
+int signdx, signdy; /* signs of directions */
+int axis; /* major axis (Y_AXIS or X_AXIS) */
+int x1, y1; /* initial point */
+register int e; /* error accumulator */
+register int e1; /* bresenham increments */
+int e2;
+int len; /* length of line */
+unsigned char *rrops;
+unsigned char *bgrrops;
+{
+ register int yinc; /* increment to next scanline, in bytes */
+ register PixelType *addrl;
+ register int e3 = e2-e1;
+ register unsigned long bit;
+ PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
+ PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
+ int dashIndex;
+ int dashOffset;
+ int dashRemaining;
+ int rop;
+ int fgrop;
+ int bgrop;
+ int saveE;
+ int saveLen;
+ int d;
+
+ dashOffset = *pdashOffset;
+ dashIndex = *pdashIndex;
+ dashRemaining = pDash[dashIndex] - dashOffset;
+ /* point to longword containing first point */
+
+ yinc = signdy * nlwidth;
+ e = e-e1; /* to make looping easier */
+
+ saveE = e;
+ saveLen = len;
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(addrlbase, x1, y1, nlwidth);
+ addrlbase += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ fgrop = rrops[d];
+ bgrop = bgrrops[d];
+
+ e = saveE;
+ len = saveLen;
+ bit = mask[x1 & PIM];
+
+ rop = fgrop;
+ if (!isDoubleDash)
+ bgrop = -1;
+ if (dashIndex & 1)
+ rop = bgrop;
+
+ if (axis == X_AXIS) {
+ if (signdx > 0) {
+ while(len--) {
+ if (rop == RROP_BLACK)
+ *addrl &= ~bit;
+ else if (rop == RROP_WHITE)
+ *addrl |= bit;
+ else if (rop == RROP_INVERT)
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ }
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ StepDash
+ }
+ } else {
+ while(len--) {
+ if (rop == RROP_BLACK)
+ *addrl &= ~bit;
+ else if (rop == RROP_WHITE)
+ *addrl |= bit;
+ else if (rop == RROP_INVERT)
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ afbScanlineInc(addrl, yinc);
+ e += e3;
+ }
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit;addrl --; }
+ StepDash
+ }
+ }
+ } /* if X_AXIS */ else {
+ if (signdx > 0) {
+ while(len--) {
+ if (rop == RROP_BLACK)
+ *addrl &= ~bit;
+ else if (rop == RROP_WHITE)
+ *addrl |= bit;
+ else if (rop == RROP_INVERT)
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit;addrl ++; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ StepDash
+ }
+ } else {
+ while(len--) {
+ if (rop == RROP_BLACK)
+ *addrl &= ~bit;
+ else if (rop == RROP_WHITE)
+ *addrl |= bit;
+ else if (rop == RROP_INVERT)
+ *addrl ^= bit;
+ e += e1;
+ if (e >= 0) {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit;addrl --; }
+ e += e3;
+ }
+ afbScanlineInc(addrl, yinc);
+ StepDash
+ }
+ }
+ } /* else Y_AXIS */
+ } /* for (d = ...) */
+ *pdashIndex = dashIndex;
+ *pdashOffset = pDash[dashIndex] - dashRemaining;
+}
diff --git a/xc/programs/Xserver/afb/afbbstore.c b/xc/programs/Xserver/afb/afbbstore.c
new file mode 100644
index 000000000..725f93d48
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbbstore.c
@@ -0,0 +1,152 @@
+/* $XFree86: xc/programs/Xserver/afb/afbbstore.c,v 3.0 1996/08/18 01:45:28 dawes Exp $ */
+/* $XConsortium: afbbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+*/
+
+#include "afb.h"
+#include "X.h"
+#include "mibstore.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+
+/*-
+ *-----------------------------------------------------------------------
+ * afbSaveAreas --
+ * Function called by miSaveAreas to actually fetch the areas to be
+ * saved into the backing pixmap. This is very simple to do, since
+ * afbDoBitblt is designed for this very thing. The region to save is
+ * already destination-relative and we're given the offset to the
+ * window origin, so we have only to create an array of points of the
+ * u.l. corners of the boxes in the region translated to the screen
+ * coordinate system and fetch the screen pixmap out of its devPrivate
+ * field....
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Data are copied from the screen into the pixmap.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+afbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
+ PixmapPtr pPixmap; /* Backing pixmap */
+ RegionPtr prgnSave; /* Region to save (pixmap-relative) */
+ int xorg; /* X origin of region */
+ int yorg; /* Y origin of region */
+ WindowPtr pWin;
+{
+ register DDXPointPtr pPt;
+ DDXPointPtr pPtsInit;
+ register BoxPtr pBox;
+ register int numRects;
+
+ numRects = REGION_NUM_RECTS(prgnSave);
+ pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
+ if (!pPtsInit)
+ return;
+
+ pBox = REGION_RECTS(prgnSave);
+ pPt = pPtsInit;
+ while (numRects--) {
+ pPt->x = pBox->x1 + xorg;
+ pPt->y = pBox->y1 + yorg;
+ pPt++;
+ pBox++;
+ }
+
+ afbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr,
+ (DrawablePtr)pPixmap,
+ GXcopy,
+ prgnSave,
+ pPtsInit, wBackingBitPlanes (pWin));
+
+ DEALLOCATE_LOCAL(pPtsInit);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * afbRestoreAreas --
+ * Function called by miRestoreAreas to actually fetch the areas to be
+ * restored from the backing pixmap. This is very simple to do, since
+ * afbDoBitblt is designed for this very thing. The region to restore is
+ * already destination-relative and we're given the offset to the
+ * window origin, so we have only to create an array of points of the
+ * u.l. corners of the boxes in the region translated to the pixmap
+ * coordinate system and fetch the screen pixmap out of its devPrivate
+ * field....
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Data are copied from the pixmap into the screen.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+afbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
+ PixmapPtr pPixmap; /* Backing pixmap */
+ RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
+ int xorg; /* X origin of window */
+ int yorg; /* Y origin of window */
+ WindowPtr pWin;
+{
+ register DDXPointPtr pPt;
+ DDXPointPtr pPtsInit;
+ register BoxPtr pBox;
+ register int numRects;
+
+ numRects = REGION_NUM_RECTS(prgnRestore);
+ pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
+ if (!pPtsInit)
+ return;
+
+ pBox = REGION_RECTS(prgnRestore);
+ pPt = pPtsInit;
+ while (numRects--) {
+ pPt->x = pBox->x1 - xorg;
+ pPt->y = pBox->y1 - yorg;
+ pPt++;
+ pBox++;
+ }
+
+ afbDoBitblt((DrawablePtr)pPixmap,
+ (DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr,
+ GXcopy,
+ prgnRestore,
+ pPtsInit, wBackingBitPlanes (pWin));
+
+ DEALLOCATE_LOCAL(pPtsInit);
+}
diff --git a/xc/programs/Xserver/afb/afbclip.c b/xc/programs/Xserver/afb/afbclip.c
new file mode 100644
index 000000000..4074f819f
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbclip.c
@@ -0,0 +1,245 @@
+/* $XFree86: xc/programs/Xserver/afb/afbclip.c,v 3.1 1999/06/13 13:47:37 dawes Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbclip.c,v 5.6 94/04/17 20:28:19 dpw Exp $ */
+
+#include "X.h"
+#include "miscstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "gc.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "afb.h"
+
+#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
+if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
+ (!((reg)->data->numRects && \
+ ((r-1)->y1 == (ry1)) && \
+ ((r-1)->y2 == (ry2)) && \
+ ((r-1)->x1 <= (rx1)) && \
+ ((r-1)->x2 >= (rx2))))) \
+{ \
+ if ((reg)->data->numRects == (reg)->data->size) \
+ { \
+ miRectAlloc(reg, 1); \
+ fr = REGION_BOXPTR(reg); \
+ r = fr + (reg)->data->numRects; \
+ } \
+ r->x1 = (rx1); \
+ r->y1 = (ry1); \
+ r->x2 = (rx2); \
+ r->y2 = (ry2); \
+ (reg)->data->numRects++; \
+ if(r->x1 < (reg)->extents.x1) \
+ (reg)->extents.x1 = r->x1; \
+ if(r->x2 > (reg)->extents.x2) \
+ (reg)->extents.x2 = r->x2; \
+ r++; \
+}
+
+/* Convert bitmap clip mask into clipping region.
+ * First, goes through each line and makes boxes by noting the transitions
+ * from 0 to 1 and 1 to 0.
+ * Then it coalesces the current line with the previous if they have boxes
+ * at the same X coordinates.
+ */
+RegionPtr
+afbPixmapToRegion(pPix)
+ PixmapPtr pPix;
+{
+ register RegionPtr pReg;
+ register PixelType *pw, w;
+ register int ib;
+ int width, h, base, rx1, crects;
+ PixelType *pwLineEnd;
+ int irectPrevStart, irectLineStart;
+ register BoxPtr prectO, prectN;
+ BoxPtr FirstRect, rects, prectLineStart;
+ Bool fInBox, fSame;
+ register PixelType mask0 = mask[0];
+ PixelType *pwLine;
+ int nWidth;
+
+ pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
+ if(!pReg)
+ return NullRegion;
+ FirstRect = REGION_BOXPTR(pReg);
+ rects = FirstRect;
+
+ pwLine = (PixelType *) pPix->devPrivate.ptr;
+ nWidth = pPix->devKind / PGSZB;
+
+ width = pPix->drawable.width;
+ pReg->extents.x1 = width - 1;
+ pReg->extents.x2 = 0;
+ irectPrevStart = -1;
+ for(h = 0; h < pPix->drawable.height; h++) {
+ pw = pwLine;
+ pwLine += nWidth;
+ irectLineStart = rects - FirstRect;
+ /* If the Screen left most bit of the word is set, we're starting in
+ * a box */
+ if(*pw & mask0) {
+ fInBox = TRUE;
+ rx1 = 0;
+ }
+ else
+ fInBox = FALSE;
+ /* Process all words which are fully in the pixmap */
+ pwLineEnd = pw + (width >> PWSH);
+ for (base = 0; pw < pwLineEnd; base += PPW) {
+ w = *pw++;
+ if (fInBox) {
+ if (!~w)
+ continue;
+ } else {
+ if (!w)
+ continue;
+ }
+ for(ib = 0; ib < PPW; ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if(w & mask0) {
+ if(!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ } else {
+ if(fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = SCRLEFT(w, 1);
+ }
+ }
+ if(width & PIM) {
+ /* Process final partial word on line */
+ w = *pw++;
+ for(ib = 0; ib < (width & PIM); ib++) {
+ /* If the Screen left most bit of the word is set, we're
+ * starting a box */
+ if(w & mask0) {
+ if(!fInBox) {
+ rx1 = base + ib;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ } else {
+ if(fInBox) {
+ /* end box */
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + ib, h + 1);
+ fInBox = FALSE;
+ }
+ }
+ /* Shift the word VISUALLY left one. */
+ w = SCRLEFT(w, 1);
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if(fInBox) {
+ ADDRECT(pReg, rects, FirstRect,
+ rx1, h, base + (width & PIM), h + 1);
+ }
+ /* if all rectangles on this line have the same x-coords as
+ * those on the previous line, then add 1 to all the previous y2s and
+ * throw away all the rectangles from this line
+ */
+ fSame = FALSE;
+ if(irectPrevStart != -1) {
+ crects = irectLineStart - irectPrevStart;
+ if(crects == ((rects - FirstRect) - irectLineStart)) {
+ prectO = FirstRect + irectPrevStart;
+ prectN = prectLineStart = FirstRect + irectLineStart;
+ fSame = TRUE;
+ while(prectO < prectLineStart) {
+ if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) {
+ fSame = FALSE;
+ break;
+ }
+ prectO++;
+ prectN++;
+ }
+ if (fSame) {
+ prectO = FirstRect + irectPrevStart;
+ while(prectO < prectLineStart) {
+ prectO->y2 += 1;
+ prectO++;
+ }
+ rects -= crects;
+ pReg->data->numRects -= crects;
+ }
+ }
+ }
+ if(!fSame)
+ irectPrevStart = irectLineStart;
+ }
+ if (!pReg->data->numRects)
+ pReg->extents.x1 = pReg->extents.x2 = 0;
+ else
+ {
+ pReg->extents.y1 = REGION_BOXPTR(pReg)->y1;
+ pReg->extents.y2 = REGION_END(pReg)->y2;
+ if (pReg->data->numRects == 1) {
+ xfree(pReg->data);
+ pReg->data = (RegDataPtr)NULL;
+ }
+ }
+#ifdef DEBUG
+ if (!miValidRegion(pReg))
+ FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
+#endif
+ return(pReg);
+}
diff --git a/xc/programs/Xserver/afb/afbcmap.c b/xc/programs/Xserver/afb/afbcmap.c
new file mode 100644
index 000000000..e56558972
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbcmap.c
@@ -0,0 +1,121 @@
+/* $XFree86: xc/programs/Xserver/afb/afbcmap.c,v 3.1 1998/11/22 10:36:58 dawes Exp $ */
+/* $XConsortium: afbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or X Consortium
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and X Consortium make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "colormapst.h"
+#include "resource.h"
+#include "micmap.h"
+
+int
+afbListInstalledColormaps(pScreen, pmaps)
+ ScreenPtr pScreen;
+ Colormap *pmaps;
+{
+ return miListInstalledColormaps(pScreen, pmaps);
+}
+
+
+void
+afbInstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ miInstallColormap(pmap);
+}
+
+void
+afbUninstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ miUninstallColormap(pmap);
+}
+
+void
+afbResolveColor(pred, pgreen, pblue, pVisual)
+ unsigned short *pred, *pgreen, *pblue;
+ register VisualPtr pVisual;
+{
+ miResolveColor(pred, pgreen, pblue, pVisual);
+}
+
+Bool
+afbInitializeColormap(pmap)
+ register ColormapPtr pmap;
+{
+ return miInitializeColormap(pmap);
+}
+
+int
+afbExpandDirectColors(pmap, ndef, indefs, outdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *indefs, *outdefs;
+{
+ return miExpandDirectColors(pmap, ndef, indefs, outdefs);
+}
+
+Bool
+afbCreateDefColormap(pScreen)
+ ScreenPtr pScreen;
+{
+ return miCreateDefColormap(pScreen);
+}
+
+Bool
+afbSetVisualTypes(depth, visuals, bitsPerRGB)
+ int depth;
+ int visuals;
+ int bitsPerRGB;
+{
+ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
+}
+
+/*
+ * Given a list of formats for a screen, create a list
+ * of visuals and depths for the screen which correspond to
+ * the set which can be used with this version of afb.
+ */
+
+Bool
+afbInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp,
+ sizes, bitsPerRGB)
+ VisualPtr *visualp;
+ DepthPtr *depthp;
+ int *nvisualp, *ndepthp;
+ int *rootDepthp;
+ VisualID *defaultVisp;
+ unsigned long sizes;
+ int bitsPerRGB;
+{
+ return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB, -1);
+}
diff --git a/xc/programs/Xserver/afb/afbfillarc.c b/xc/programs/Xserver/afb/afbfillarc.c
new file mode 100644
index 000000000..a05c32228
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbfillarc.c
@@ -0,0 +1,355 @@
+/* $XFree86: xc/programs/Xserver/afb/afbfillarc.c,v 3.1 1998/03/20 21:04:54 hohndel Exp $ */
+/************************************************************
+
+Copyright (c) 1989 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+********************************************************/
+
+/* $XConsortium: afbfillarc.c,v 5.14 94/04/17 20:28:20 dpw Exp $ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "miscstruct.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "afb.h"
+#include "maskbits.h"
+#include "mifillarc.h"
+#include "mi.h"
+
+static void
+afbFillEllipseSolid(pDraw, arc, rrops)
+ DrawablePtr pDraw;
+ xArc *arc;
+ register unsigned char *rrops;
+{
+ int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ register int slw;
+ miFillArcRec info;
+ PixelType *addrlt, *addrlb;
+ register PixelType *pdst;
+ PixelType *addrl;
+ register int n;
+ register int d;
+ int nlwidth;
+ register int xpos;
+ PixelType startmask, endmask;
+ int nlmiddle;
+ int depthDst;
+ int sizeDst;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ addrlt);
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt += nlwidth * (yorg - y);
+ addrlb += nlwidth * (yorg + y + dy);
+ while (y) {
+ addrlt += nlwidth;
+ addrlb -= nlwidth;
+ MIFILLARCSTEP(slw);
+ if (!slw)
+ continue;
+ xpos = xorg - x;
+ pdst = addrl = afbScanlineOffset(addrlt, (xpos >> PWSH));
+ if (((xpos & PIM) + slw) < PPW) {
+ maskpartialbits(xpos, slw, startmask);
+ for (d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ *pdst &= ~startmask;
+ break;
+ case RROP_WHITE:
+ *pdst |= startmask;
+ break;
+ case RROP_INVERT:
+ *pdst ^= startmask;
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ if (miFillArcLower(slw)) {
+ pdst = afbScanlineOffset(addrlb, (xpos >> PWSH));
+
+ for (d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ *pdst &= ~startmask;
+ break;
+ case RROP_WHITE:
+ *pdst |= startmask;
+ break;
+ case RROP_INVERT:
+ *pdst ^= startmask;
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ }
+ continue;
+ }
+ maskbits(xpos, slw, startmask, endmask, nlmiddle);
+ for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ n = nlmiddle;
+ pdst = addrl;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ if (startmask)
+ *pdst++ &= ~startmask;
+ while (n--)
+ *pdst++ = 0;
+ if (endmask)
+ *pdst &= ~endmask;
+ break;
+
+ case RROP_WHITE:
+ if (startmask)
+ *pdst++ |= startmask;
+ while (n--)
+ *pdst++ = ~0;
+ if (endmask)
+ *pdst |= endmask;
+ break;
+
+ case RROP_INVERT:
+ if (startmask)
+ *pdst++ ^= startmask;
+ while (n--)
+ *pdst++ ^= ~0;
+ if (endmask)
+ *pdst ^= endmask;
+ break;
+
+ case RROP_NOP:
+ break;
+ }
+ }
+ if (!miFillArcLower(slw))
+ continue;
+ addrl = afbScanlineOffset(addrlb, (xpos >> PWSH));
+ for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ n = nlmiddle;
+ pdst = addrl;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ if (startmask)
+ *pdst++ &= ~startmask;
+ while (n--)
+ *pdst++ = 0;
+ if (endmask)
+ *pdst &= ~endmask;
+ break;
+
+ case RROP_WHITE:
+ if (startmask)
+ *pdst++ |= startmask;
+ while (n--)
+ *pdst++ = ~0;
+ if (endmask)
+ *pdst |= endmask;
+ break;
+
+ case RROP_INVERT:
+ if (startmask)
+ *pdst++ ^= startmask;
+ while (n--)
+ *pdst++ ^= ~0;
+ if (endmask)
+ *pdst ^= endmask;
+ break;
+
+ case RROP_NOP:
+ break;
+ }
+ }
+ }
+}
+
+#define FILLSPAN(xl,xr,addr) \
+ if (xr >= xl) { \
+ width = xr - xl + 1; \
+ addrl = afbScanlineOffset(addr, (xl >> PWSH)); \
+ if (((xl & PIM) + width) < PPW) { \
+ maskpartialbits(xl, width, startmask); \
+ for (pdst = addrl, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */ \
+ switch (rrops[d]) { \
+ case RROP_BLACK: \
+ *pdst &= ~startmask; \
+ break; \
+ case RROP_WHITE: \
+ *pdst |= startmask; \
+ break; \
+ case RROP_INVERT: \
+ *pdst ^= startmask; \
+ break; \
+ case RROP_NOP: \
+ break; \
+ } \
+ } \
+ } else { \
+ maskbits(xl, width, startmask, endmask, nlmiddle); \
+ for (d = 0; d < depthDst; d++, addrl += sizeDst) { /* @@@ NEXT PLANE @@@ */ \
+ n = nlmiddle; \
+ pdst = addrl; \
+ switch (rrops[d]) { \
+ case RROP_BLACK: \
+ if (startmask) \
+ *pdst++ &= ~startmask; \
+ while (n--) \
+ *pdst++ = 0; \
+ if (endmask) \
+ *pdst &= ~endmask; \
+ break; \
+ case RROP_WHITE: \
+ if (startmask) \
+ *pdst++ |= startmask; \
+ while (n--) \
+ *pdst++ = ~0; \
+ if (endmask) \
+ *pdst |= endmask; \
+ break; \
+ case RROP_INVERT: \
+ if (startmask) \
+ *pdst++ ^= startmask; \
+ while (n--) \
+ *pdst++ ^= ~0; \
+ if (endmask) \
+ *pdst ^= endmask; \
+ break; \
+ case RROP_NOP: \
+ break; \
+ } \
+ } \
+ } \
+ }
+
+#define FILLSLICESPANS(flip,addr) \
+ if (!flip) { \
+ FILLSPAN(xl, xr, addr); \
+ } else { \
+ xc = xorg - x; \
+ FILLSPAN(xc, xr, addr); \
+ xc += slw - 1; \
+ FILLSPAN(xl, xc, addr); \
+ }
+
+static void
+afbFillArcSliceSolidCopy(pDraw, pGC, arc, rrops)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ xArc *arc;
+ register unsigned char *rrops;
+{
+ PixelType *addrl;
+ register PixelType *pdst;
+ register int n;
+ register int d;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int xl, xr, xc;
+ PixelType *addrlt, *addrlb;
+ int nlwidth;
+ int width;
+ PixelType startmask, endmask;
+ int nlmiddle;
+ int sizeDst;
+ int depthDst;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ addrlt);
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt = afbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth);
+ addrlb = afbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth);
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ while (y > 0) {
+ afbScanlineIncNoBankSwitch(addrlt, nlwidth);
+ afbScanlineIncNoBankSwitch(addrlb, -nlwidth);
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice)) {
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_top, addrlt);
+ }
+ if (miFillSliceLower(slice)) {
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_bot, addrlb);
+ }
+ }
+}
+
+void
+afbPolyFillArcSolid(pDraw, pGC, narcs, parcs)
+ register DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ afbPrivGC *priv;
+ register xArc *arc;
+ register int i;
+ BoxRec box;
+ RegionPtr cclip;
+ unsigned char *rrops;
+
+ priv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr;
+ rrops = priv->rrops;
+ cclip = pGC->pCompositeClip;
+ for (arc = parcs, i = narcs; --i >= 0; arc++) {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc)) {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ box.x2 = box.x1 + (int)arc->width + 1;
+ box.y2 = box.y1 + (int)arc->height + 1;
+ if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) {
+ if ((arc->angle2 >= FULLCIRCLE) ||
+ (arc->angle2 <= -FULLCIRCLE))
+ afbFillEllipseSolid(pDraw, arc, rrops);
+ else
+ afbFillArcSliceSolidCopy(pDraw, pGC, arc, rrops);
+ continue;
+ }
+ }
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbfillrct.c b/xc/programs/Xserver/afb/afbfillrct.c
new file mode 100644
index 000000000..4d93c2634
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbfillrct.c
@@ -0,0 +1,293 @@
+/* $XFree86: xc/programs/Xserver/afb/afbfillrct.c,v 3.1 1998/03/20 21:04:54 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbfillrct.c,v 5.10 94/04/17 20:28:21 dpw Exp $ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "miscstruct.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+#define MODEQ(a, b) ((a) %= (b))
+void afbPaintOddSize();
+
+/*
+ filled rectangles.
+ translate the rectangles, clip them, and call the
+helper function in the GC.
+*/
+
+#define NUM_STACK_RECTS 1024
+
+void
+afbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nrectFill; /* number of rectangles to fill */
+ xRectangle *prectInit; /* Pointer to first rectangle to fill */
+{
+ xRectangle *prect;
+ RegionPtr prgnClip;
+ register BoxPtr pbox;
+ register BoxPtr pboxClipped;
+ BoxPtr pboxClippedBase;
+ BoxPtr pextent;
+ BoxRec stackRects[NUM_STACK_RECTS];
+ int numRects;
+ int n;
+ int xorg, yorg;
+ afbPrivGC *priv;
+ PixmapPtr ppix;
+ unsigned char *rrops;
+ unsigned char *rropsOS;
+
+ priv = (afbPrivGC *)pGC->devPrivates[afbGCPrivateIndex].ptr;
+ ppix = pGC->pRotatedPixmap;
+ prgnClip = pGC->pCompositeClip;
+ rrops = priv->rrops;
+ rropsOS = priv->rropOS;
+
+ prect = prectInit;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (xorg || yorg) {
+ prect = prectInit;
+ n = nrectFill;
+ Duff(n, prect->x += xorg; prect->y += yorg; prect++);
+ }
+
+ prect = prectInit;
+
+ numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
+ if (numRects > NUM_STACK_RECTS) {
+ pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+ if (!pboxClippedBase)
+ return;
+ }
+ else
+ pboxClippedBase = stackRects;
+
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1) {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_RECTS(prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--) {
+ if ((pboxClipped->x1 = prect->x) < x1)
+ pboxClipped->x1 = x1;
+
+ if ((pboxClipped->y1 = prect->y) < y1)
+ pboxClipped->y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ pboxClipped->x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ pboxClipped->y2 = by2;
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ }
+ }
+ } else {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--) {
+ BoxRec box;
+
+ if ((box.x1 = prect->x) < x1)
+ box.x1 = x1;
+
+ if ((box.y1 = prect->y) < y1)
+ box.y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ box.x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ box.y2 = by2;
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+ if (pboxClipped != pboxClippedBase) {
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ afbSolidFillArea(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, rrops);
+ break;
+ case FillTiled:
+ switch (pGC->alu) {
+ case GXcopy:
+ if (pGC->pRotatedPixmap)
+ afbTileAreaPPWCopy(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, GXcopy,
+ pGC->pRotatedPixmap, pGC->planemask);
+ else
+ afbTileAreaCopy (pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, GXcopy,
+ pGC->tile.pixmap,
+ pGC->patOrg.x, pGC->patOrg.y,
+ pGC->planemask);
+ break;
+
+ default:
+ if (pGC->pRotatedPixmap)
+ afbTileAreaPPWGeneral(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->alu,
+ pGC->pRotatedPixmap,
+ pGC->planemask);
+ else
+ afbTileAreaGeneral(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->alu,
+ pGC->tile.pixmap,
+ pGC->patOrg.x, pGC->patOrg.y,
+ pGC->planemask);
+ break;
+ } /* switch (alu) */
+ break;
+
+ case FillStippled:
+ if (pGC->pRotatedPixmap)
+ afbStippleAreaPPW(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->pRotatedPixmap, rrops);
+ else
+ afbStippleArea(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->stipple,
+ pGC->patOrg.x, pGC->patOrg.y, rrops);
+ break;
+
+ case FillOpaqueStippled:
+ switch (pGC->alu) {
+ case GXcopy:
+ if (pGC->pRotatedPixmap)
+ afbOpaqueStippleAreaPPWCopy(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, GXcopy,
+ pGC->pRotatedPixmap,
+ rropsOS, pGC->planemask);
+ else
+ afbOpaqueStippleAreaCopy(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, GXcopy,
+ pGC->stipple,
+ pGC->patOrg.x, pGC->patOrg.y, rropsOS,
+ pGC->planemask);
+ break;
+
+ default:
+ if (pGC->pRotatedPixmap)
+ afbOpaqueStippleAreaPPWGeneral(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->alu,
+ pGC->pRotatedPixmap,
+ rropsOS,
+ pGC->planemask);
+ else
+ afbOpaqueStippleAreaGeneral(pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC->alu,
+ pGC->stipple,
+ pGC->patOrg.x, pGC->patOrg.y,
+ rropsOS,
+ pGC->planemask);
+ break;
+ } /* switch (alu) */
+ break;
+ }
+ }
+ if (pboxClippedBase != stackRects)
+ DEALLOCATE_LOCAL(pboxClippedBase);
+}
diff --git a/xc/programs/Xserver/afb/afbfillsp.c b/xc/programs/Xserver/afb/afbfillsp.c
new file mode 100644
index 000000000..419d6bc69
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbfillsp.c
@@ -0,0 +1,1128 @@
+/* $XFree86: xc/programs/Xserver/afb/afbfillsp.c,v 3.1 1998/03/20 21:04:54 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbfillsp.c,v 5.13 94/04/17 20:28:21 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "afb.h"
+#include "maskbits.h"
+
+#include "mergerop.h"
+
+#include "servermd.h"
+#include "mi.h"
+#include "mispans.h"
+
+/* scanline filling for monochrome frame buffer
+ written by drewry, oct 1986
+
+ these routines all clip. they assume that anything that has called
+them has already translated the points (i.e. pGC->miTranslate is
+non-zero, which is howit gets set in afbCreateGC().)
+
+ the number of new scnalines created by clipping ==
+MaxRectsPerBand * nSpans.
+
+*/
+
+
+void
+afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *addrl;/* pointer to current longword in bitmap */
+ register int nlmiddle;
+ register PixelType startmask;
+ register PixelType endmask;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int depthDst;
+ int sizeDst;
+ int d;
+ unsigned char *rrops;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+ while (n--) {
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (*pwidth) {
+ addrl = addrlBase;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ /* all bits inside same longword */
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl &= ~startmask;
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ &= ~startmask;
+ Duff (nlmiddle, *addrl++ = 0x0);
+ if (endmask)
+ *addrl &= ~endmask;
+ }
+ break;
+
+ case RROP_WHITE:
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ /* all bits inside same longword */
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl |= startmask;
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ |= startmask;
+ Duff (nlmiddle, *addrl++ = ~0);
+ if (endmask)
+ *addrl |= endmask;
+ }
+ break;
+ case RROP_INVERT:
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ /* all bits inside same longword */
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl ^= startmask;
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ ^= startmask;
+ Duff (nlmiddle, *addrl++ ^= ~0);
+ if (endmask)
+ *addrl ^= endmask;
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ }
+ pwidth++;
+ ppt++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+void
+afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *addrl;/* pointer to current longword in bitmap */
+ register PixelType src;
+ register int nlmiddle;
+ register PixelType startmask;
+ register PixelType endmask;
+ PixmapPtr pStipple;
+ PixelType *psrc;
+ int tileHeight;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int d;
+ int depthDst;
+ int sizeDst;
+ unsigned char *rrops;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ pStipple = pGC->pRotatedPixmap;
+ tileHeight = pStipple->drawable.height;
+ psrc = (PixelType *)(pStipple->devPrivate.ptr);
+
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+
+ while (n--) {
+ src = psrc[ppt->y % tileHeight];
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ addrl = addrlBase;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ /* all bits inside same longword */
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl &= ~(src & startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ &= ~(src & startmask);
+ Duff (nlmiddle, *addrl++ &= ~src);
+ if (endmask)
+ *addrl &= ~(src & endmask);
+ }
+ break;
+ case RROP_WHITE:
+ /* all bits inside same longword */
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl |= (src & startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ |= (src & startmask);
+ Duff (nlmiddle, *addrl++ |= src);
+ if (endmask)
+ *addrl |= (src & endmask);
+ }
+ break;
+ case RROP_INVERT:
+ /* all bits inside same longword */
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl ^= (src & startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask)
+ *addrl++ ^= (src & startmask);
+ Duff (nlmiddle, *addrl++ ^= src);
+ if (endmask)
+ *addrl ^= (src & endmask);
+ }
+ break;
+
+ case RROP_NOP:
+ break;
+ }
+ }
+ pwidth++;
+ ppt++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+void
+afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *addrl; /* pointer to current longword in bitmap */
+ register PixelType src;
+ register int nlmiddle;
+ register PixelType startmask;
+ register PixelType endmask;
+ PixmapPtr pTile;
+ PixelType *psrc;
+ int tileHeight;
+ int rop;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int sizeDst;
+ int depthDst;
+ int d;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ pTile = pGC->pRotatedPixmap;
+ tileHeight = pTile->drawable.height;
+ psrc = (PixelType *)(pTile->devPrivate.ptr);
+ rop = pGC->alu;
+
+ switch(rop) {
+ case GXcopy:
+#define DoMaskCopyRop(src,dst,mask) ((dst) & ~(mask) | (src) & (mask))
+ while (n--) {
+ if (*pwidth) {
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(pGC->planemask & (1 << d)))
+ continue;
+
+ addrl = addrlBase;
+ src = psrc[ppt->y % tileHeight + tileHeight * d];
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl = DoMaskCopyRop (src, *addrl, startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask) {
+ *addrl = DoMaskCopyRop (src, *addrl, startmask);
+ addrl++;
+ }
+ while (nlmiddle--) {
+ *addrl = src;
+ addrl++;
+ }
+ if (endmask)
+ *addrl = DoMaskCopyRop (src, *addrl, endmask);
+ }
+ }
+ }
+ pwidth++;
+ ppt++;
+ }
+ break;
+
+ default:
+ {
+ register DeclareMergeRop ();
+
+ InitializeMergeRop(rop,~0);
+ while (n--) {
+ if (*pwidth) {
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(pGC->planemask & (1 << d)))
+ continue;
+
+ addrl = addrlBase;
+
+ src = psrc[ppt->y % tileHeight + tileHeight * d];
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl = DoMaskMergeRop (src, *addrl, startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask) {
+ *addrl = DoMaskMergeRop (src, *addrl, startmask);
+ addrl++;
+ }
+ while (nlmiddle--) {
+ *addrl = DoMergeRop (src, *addrl);
+ addrl++;
+ }
+ if (endmask)
+ *addrl = DoMaskMergeRop (src, *addrl, endmask);
+ }
+ }
+ }
+ pwidth++;
+ ppt++;
+ }
+ break;
+ }
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+void
+afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *addrl; /* pointer to current longword in bitmap */
+ register PixelType src;
+ register int nlmiddle;
+ register PixelType startmask;
+ register PixelType endmask;
+ PixmapPtr pTile;
+ PixelType *psrc;
+ int tileHeight;
+ int rop;
+ unsigned char *rropsOS;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int sizeDst;
+ int depthDst;
+ int d;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ pTile = pGC->pRotatedPixmap;
+ tileHeight = pTile->drawable.height;
+ psrc = (PixelType *)(pTile->devPrivate.ptr);
+ rop = pGC->alu;
+ rropsOS = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rropOS;
+
+ switch(rop) {
+ case GXcopy:
+#define DoMaskCopyRop(src,dst,mask) ((dst) & ~(mask) | (src) & (mask))
+ while (n--) {
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+ if (*pwidth) {
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ src = 0;
+ break;
+ case RROP_WHITE:
+ src = ~0;
+ break;
+ case RROP_INVERT:
+ src = ~psrc[ppt->y % tileHeight];
+ break;
+ case RROP_COPY:
+ src = psrc[ppt->y % tileHeight];
+ break;
+ case RROP_NOP:
+ continue;
+ }
+
+ addrl = addrlBase;
+
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl = DoMaskCopyRop (src, *addrl, startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask) {
+ *addrl = DoMaskCopyRop (src, *addrl, startmask);
+ addrl++;
+ }
+ while (nlmiddle--) {
+ *addrl = src;
+ addrl++;
+ }
+ if (endmask)
+ *addrl = DoMaskCopyRop (src, *addrl, endmask);
+ }
+ } /* for (d = ...) */
+ }
+
+ pwidth++;
+ ppt++;
+ }
+ break;
+
+ default:
+ {
+ register DeclareMergeRop ();
+
+ InitializeMergeRop(rop,~0);
+ while (n--) {
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+ if (*pwidth) {
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ src = 0;
+ break;
+ case RROP_WHITE:
+ src = ~0;
+ break;
+ case RROP_INVERT:
+ src = ~psrc[ppt->y % tileHeight];
+ break;
+ case RROP_COPY:
+ src = psrc[ppt->y % tileHeight];
+ break;
+ case RROP_NOP:
+ continue;
+ }
+
+ addrl = addrlBase;
+
+ if ( ((ppt->x & PIM) + *pwidth) < PPW) {
+ maskpartialbits(ppt->x, *pwidth, startmask);
+ *addrl = DoMaskMergeRop (src, *addrl, startmask);
+ } else {
+ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
+ if (startmask) {
+ *addrl = DoMaskMergeRop (src, *addrl, startmask);
+ addrl++;
+ }
+ while (nlmiddle--) {
+ *addrl = DoMergeRop (src, *addrl);
+ addrl++;
+ }
+ if (endmask)
+ *addrl = DoMaskMergeRop (src, *addrl, endmask);
+ }
+ } /* for (d = ...) */
+ }
+ pwidth++;
+ ppt++;
+ } /* while (n) */
+ break;
+ }
+ } /* switch (rop) */
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+/* Fill spans with tiles that aren't PPW bits wide */
+void
+afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ int iline; /* first line of tile to use */
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *pdst;/* pointer to current word in bitmap */
+ register PixelType *psrc;/* pointer to current word in tile */
+ register int nlMiddle;
+ register int rop, nstart;
+ PixelType startmask;
+ PixmapPtr pTile; /* pointer to tile we want to fill with */
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ int tlwidth, rem, tileWidth, tileHeight, endinc;
+ PixelType endmask, *psrcT;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int sizeDst;
+ int sizeTile;
+ int depthDst;
+ register int d;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ pTile = pGC->tile.pixmap;
+ tlwidth = pTile->devKind / PGSZB;
+ rop = pGC->alu;
+
+ xSrc = pDrawable->x;
+ ySrc = pDrawable->y;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+ sizeTile = tlwidth * tileHeight;
+
+ /* this replaces rotating the tile. Instead we just adjust the offset
+ * at which we start grabbing bits from the tile.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and rem always stay within the tile bounds.
+ */
+ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
+ ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
+
+ while (n--) {
+ iline = (ppt->y - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth);
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+
+ for (d = 0; d < depthDst; d++, psrcT += sizeTile, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(pGC->planemask & (1 << d)))
+ continue;
+
+ if (*pwidth) {
+ x = ppt->x;
+ pdst = addrlBase;
+ width = *pwidth;
+ while(width > 0) {
+ psrc = psrcT;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+ getandputrop((psrc+endinc), (rem&PIM), (x & PIM), w, pdst, rop);
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ putbitsrop(*psrc, x & PIM, w, pdst, rop);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ putbitsrop(*psrc, (x & PIM), nstart, pdst, rop);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ getandputrop0(psrc, nstart, PPW, pdst, rop);
+ pdst++;
+ psrc++;
+ }
+ if(endmask) {
+ getandputrop0(psrc, nstart, nend, pdst, rop);
+ }
+ }
+ x += w;
+ width -= w;
+ }
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+/* Fill spans with stipples that aren't PPW bits wide */
+void
+afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ int iline; /* first line of tile to use */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *pdst; /* pointer to current word in bitmap */
+ register PixelType *psrc; /* pointer to current word in tile */
+ register int nlMiddle;
+ register int rop, nstart;
+ PixelType startmask;
+ PixmapPtr pTile; /* pointer to tile we want to fill with */
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ PixelType endmask, *psrcT;
+ int tlwidth, rem, tileWidth, endinc;
+ int tileHeight;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ unsigned char *rrops;
+ register int d;
+ int sizeDst;
+ int depthDst;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ pTile = pGC->stipple;
+ tlwidth = pTile->devKind / PGSZB;
+ xSrc = pDrawable->x;
+ ySrc = pDrawable->y;
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+
+ /* this replaces rotating the stipple. Instead, we just adjust the offset
+ * at which we start grabbing bits from the stipple.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and rem always stay within the tile bounds.
+ */
+ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
+ ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
+ while (n--) {
+ iline = (ppt->y - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth);
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ rop = rrops[d];
+ if (rop == RROP_NOP)
+ continue;
+
+ pdst = addrlBase;
+ x = ppt->x;
+
+ if (*pwidth) {
+ width = *pwidth;
+ while(width > 0) {
+ psrc = psrcT;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+ getandputrrop((psrc + endinc), (rem & PIM), (x & PIM),
+ w, pdst, rop)
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ putbitsrrop(*psrc, x & PIM, w, pdst, rop);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ getandputrrop0(psrc, nstart, PPW, pdst, rop);
+ pdst++;
+ psrc++;
+ }
+ if(endmask) {
+ getandputrrop0(psrc, nstart, nend, pdst, rop);
+ }
+ }
+ x += w;
+ width -= w;
+ }
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+/* Fill spans with OpaqueStipples that aren't PPW bits wide */
+void
+afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ int iline; /* first line of tile to use */
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ PixelType *addrlBase; /* pointer to start of bitmap */
+ PixelType *pBase;
+ int nlwidth; /* width in longwords of bitmap */
+ register PixelType *pdst;/* pointer to current word in bitmap */
+ register PixelType *psrc;/* pointer to current word in tile */
+ register int nlMiddle;
+ register int d;
+ register PixelType tmpsrc;
+ register PixelType tmpdst;
+ register int alu, nstart;
+ register unsigned char *rropsOS;
+ PixelType startmask;
+ PixmapPtr pTile; /* pointer to tile we want to fill with */
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ int tlwidth, rem, tileWidth, tileHeight, endinc;
+ PixelType endmask, *psrcT;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int sizeDst;
+ int sizeTile;
+ int depthDst;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree) {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ pTile = pGC->stipple;
+ tlwidth = pTile->devKind / PGSZB;
+ alu = pGC->alu;
+
+ xSrc = pDrawable->x;
+ ySrc = pDrawable->y;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+ rropsOS = afbGetGCPrivate(pGC)->rropOS;
+
+ /* this replaces rotating the tile. Instead we just adjust the offset
+ * at which we start grabbing bits from the tile.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and rem always stay within the tile bounds.
+ */
+ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
+ ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
+
+ while (n--) {
+ iline = (ppt->y - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth);
+ addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
+
+ for (d = 0; d < depthDst; d++, addrlBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(pGC->planemask & (1 << d)))
+ continue;
+
+ if (*pwidth) {
+ x = ppt->x;
+ pdst = addrlBase;
+ width = *pwidth;
+ while(width > 0) {
+ psrc = psrcT;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+
+ case RROP_COPY:
+ getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
+ break;
+
+ case RROP_INVERT:
+ getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+
+ if (alu != GXcopy) {
+ getbits (pdst, (x & PIM), w, tmpdst);
+ DoRop (tmpsrc, alu, tmpsrc, tmpdst);
+ }
+
+ putbits (tmpsrc, (x & PIM), w, pdst);
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ tmpsrc = *psrc;
+ break;
+ case RROP_INVERT:
+ tmpsrc = ~*psrc;
+ break;
+ }
+ if (alu != GXcopy) {
+ getbits (pdst, (x & PIM), w, tmpdst);
+ DoRop (tmpsrc, alu, tmpsrc, tmpdst);
+ }
+ putbits (tmpsrc, (x & PIM), w, pdst);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ tmpsrc = *psrc;
+ break;
+ case RROP_INVERT:
+ tmpsrc = ~*psrc;
+ break;
+ }
+ if (alu != GXcopy) {
+ getbits (pdst, (x & PIM), nstart, tmpdst);
+ DoRop (tmpsrc, alu, tmpsrc, tmpdst);
+ }
+ putbits (tmpsrc, (x & PIM), nstart, pdst);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ getbits (psrc, nstart, PPW, tmpsrc);
+ break;
+ case RROP_INVERT:
+ getbits (psrc, nstart, PPW, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+ if (alu != GXcopy) {
+ tmpdst = *pdst;
+ DoRop (tmpsrc, alu, tmpsrc, tmpdst);
+ }
+ *pdst++ = tmpsrc;
+ /*putbits (tmpsrc, 0, PPW, pdst);
+ pdst++;*/
+ psrc++;
+ }
+ if(endmask) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+
+ case RROP_COPY:
+ getbits (psrc, nstart, nend, tmpsrc);
+ break;
+
+ case RROP_INVERT:
+ getbits (psrc, nstart, nend, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+ if (alu != GXcopy) {
+ tmpdst = *pdst;
+ DoRop (tmpsrc, alu, tmpsrc, tmpdst);
+ }
+ putbits (tmpsrc, 0, nend, pdst);
+ }
+ }
+ x += w;
+ width -= w;
+ }
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
diff --git a/xc/programs/Xserver/afb/afbfont.c b/xc/programs/Xserver/afb/afbfont.c
new file mode 100644
index 000000000..0ad8d9de3
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbfont.c
@@ -0,0 +1,75 @@
+/* $XFree86: xc/programs/Xserver/afb/afbfont.c,v 3.0 1996/08/18 01:45:35 dawes Exp $ */
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XConsortium: afbfont.c,v 1.18 94/04/17 20:28:22 keith Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+
+/*ARGSUSED*/
+Bool
+afbRealizeFont( pscr, pFont)
+ ScreenPtr pscr;
+ FontPtr pFont;
+{
+ return (TRUE);
+}
+
+/*ARGSUSED*/
+Bool
+afbUnrealizeFont( pscr, pFont)
+ ScreenPtr pscr;
+ FontPtr pFont;
+{
+ return (TRUE);
+}
diff --git a/xc/programs/Xserver/afb/afbgc.c b/xc/programs/Xserver/afb/afbgc.c
new file mode 100644
index 000000000..cabddbdc9
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbgc.c
@@ -0,0 +1,710 @@
+/* $XFree86: xc/programs/Xserver/afb/afbgc.c,v 3.2 1999/06/20 15:02:46 dawes Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbgc.c,v 5.35 94/04/17 20:28:23 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "dixfontstr.h"
+#include "fontstruct.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mistruct.h"
+#include "migc.h"
+
+#include "maskbits.h"
+
+static GCFuncs afbFuncs = {
+ afbValidateGC,
+ miChangeGC,
+ miCopyGC,
+ afbDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip
+};
+
+static GCOps afbGCOps = {
+ afbSolidFS,
+ afbSetSpans,
+ afbPutImage,
+ afbCopyArea,
+ miCopyPlane,
+ afbPolyPoint,
+ afbLineSS,
+ afbSegmentSS,
+ miPolyRectangle,
+ afbZeroPolyArcSS,
+ afbFillPolygonSolid,
+ afbPolyFillRect,
+ afbPolyFillArcSolid,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ afbTEGlyphBlt,
+ afbPolyGlyphBlt,
+ afbPushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+
+Bool
+afbCreateGC(pGC)
+ register GCPtr pGC;
+{
+ afbPrivGC *pPriv;
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ /* some of the output primitives aren't really necessary, since
+ they will be filled in ValidateGC because of dix/CreateGC()
+ setting all the change bits. Others are necessary because although
+ they depend on being a monochrome frame buffer, they don't change
+ */
+
+ pGC->ops = &afbGCOps;
+ pGC->funcs = &afbFuncs;
+
+ /* afb wants to translate before scan convesion */
+ pGC->miTranslate = 1;
+
+ pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
+ afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
+ pPriv->rrops);
+ afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->depth, pPriv->rropOS);
+
+ pGC->fExpose = TRUE;
+ pGC->pRotatedPixmap = NullPixmap;
+ pGC->freeCompClip = FALSE;
+ return TRUE;
+}
+
+/* Clipping conventions
+ if the drawable is a window
+ CT_REGION ==> pCompositeClip really is the composite
+ CT_other ==> pCompositeClip is the window clip region
+ if the drawable is a pixmap
+ CT_REGION ==> pCompositeClip is the translated client region
+ clipped to the pixmap boundary
+ CT_other ==> pCompositeClip is the pixmap bounding box
+*/
+
+/*ARGSUSED*/
+void
+afbValidateGC(pGC, changes, pDrawable)
+ register GCPtr pGC;
+ unsigned long changes;
+ DrawablePtr pDrawable;
+{
+ register afbPrivGCPtr devPriv;
+ int mask; /* stateChanges */
+ int index; /* used for stepping through bitfields */
+ int xrot, yrot; /* rotations for tile and stipple pattern */
+ int rrop; /* reduced rasterop */
+ /* flags for changing the proc vector
+ and updating things in devPriv
+ */
+ int new_rotate, new_rrop, new_line, new_text, new_fill;
+ DDXPointRec oldOrg; /* origin of thing GC was last used with */
+
+ oldOrg = pGC->lastWinOrg;
+
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+
+ /* we need to re-rotate the tile if the previous window/pixmap
+ origin (oldOrg) differs from the new window/pixmap origin
+ (pGC->lastWinOrg)
+ */
+ new_rotate = (oldOrg.x != pGC->lastWinOrg.x) ||
+ (oldOrg.y != pGC->lastWinOrg.y);
+
+
+ devPriv = ((afbPrivGCPtr)(pGC->devPrivates[afbGCPrivateIndex].ptr));
+
+
+ /*
+ if the client clip is different or moved OR
+ the subwindowMode has changed OR
+ the window's clip has changed since the last validation
+ we need to recompute the composite clip
+ */
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
+ afbComputeCompositeClip(pGC, pDrawable);
+
+ new_rrop = FALSE;
+ new_line = FALSE;
+ new_text = FALSE;
+ new_fill = FALSE;
+
+ mask = changes;
+ while (mask) {
+ index = lowbit(mask);
+ mask &= ~index;
+
+ /* this switch acculmulates a list of which procedures
+ might have to change due to changes in the GC. in
+ some cases (e.g. changing one 16 bit tile for another)
+ we might not really need a change, but the code is
+ being paranoid.
+ this sort of batching wins if, for example, the alu
+ and the font have been changed, or any other pair
+ of items that both change the same thing.
+ */
+ switch (index) {
+ case GCPlaneMask:
+ case GCFunction:
+ case GCForeground:
+ new_rrop = TRUE;
+ break;
+ case GCBackground:
+ new_rrop = TRUE; /* for opaque stipples */
+ break;
+ case GCLineStyle:
+ case GCLineWidth:
+ case GCJoinStyle:
+ new_line = TRUE;
+ break;
+ case GCCapStyle:
+ break;
+ case GCFillStyle:
+ new_fill = TRUE;
+ break;
+ case GCFillRule:
+ break;
+ case GCTile:
+ if(pGC->tileIsPixel)
+ break;
+ new_rotate = TRUE;
+ new_fill = TRUE;
+ break;
+
+ case GCStipple:
+ if(pGC->stipple == (PixmapPtr)NULL)
+ break;
+ new_rotate = TRUE;
+ new_fill = TRUE;
+ break;
+
+ case GCTileStipXOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCTileStipYOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCFont:
+ new_text = TRUE;
+ break;
+ case GCSubwindowMode:
+ break;
+ case GCGraphicsExposures:
+ break;
+ case GCClipXOrigin:
+ break;
+ case GCClipYOrigin:
+ break;
+ case GCClipMask:
+ break;
+ case GCDashOffset:
+ break;
+ case GCDashList:
+ break;
+ case GCArcMode:
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* deal with the changes we've collected .
+ new_rrop must be done first because subsequent things
+ depend on it.
+ */
+
+ if(new_rotate || new_fill) {
+ Bool new_pix = FALSE;
+
+ /* figure out how much to rotate */
+ xrot = pGC->patOrg.x;
+ yrot = pGC->patOrg.y;
+ xrot += pDrawable->x;
+ yrot += pDrawable->y;
+
+ switch (pGC->fillStyle) {
+ case FillTiled:
+ /* copy current tile and stipple */
+ if (!pGC->tileIsPixel &&
+ (pGC->tile.pixmap->drawable.width <= PPW) &&
+ !(pGC->tile.pixmap->drawable.width &
+ (pGC->tile.pixmap->drawable.width - 1))) {
+ afbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
+ xrot, yrot);
+ new_pix = TRUE;
+ }
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) &&
+ !(pGC->stipple->drawable.width &
+ (pGC->stipple->drawable.width - 1))) {
+ afbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
+ xrot, yrot);
+ new_pix = TRUE;
+ }
+ }
+ /* destroy any previously rotated tile or stipple */
+ if (!new_pix && pGC->pRotatedPixmap) {
+ (*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
+ pGC->pRotatedPixmap = (PixmapPtr)NULL;
+ }
+ }
+
+ /*
+ * duck out here when the GC is unchanged
+ */
+
+ if (!changes)
+ return;
+
+ if (new_rrop || new_fill) {
+ afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pDrawable->depth,
+ devPriv->rrops);
+ afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->depth, devPriv->rropOS);
+ new_fill = TRUE;
+ }
+
+ if (new_line || new_fill || new_text) {
+ if (!pGC->ops->devPrivate.val) {
+ pGC->ops = miCreateGCOps(pGC->ops);
+ pGC->ops->devPrivate.val = 1;
+ }
+ }
+
+ if (new_line || new_fill) {
+ if (pGC->lineWidth == 0) {
+ if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid)
+ pGC->ops->PolyArc = afbZeroPolyArcSS;
+ else
+ pGC->ops->PolyArc = miZeroPolyArc;
+ } else
+ pGC->ops->PolyArc = miPolyArc;
+ if (pGC->lineStyle == LineSolid) {
+ if(pGC->lineWidth == 0) {
+ if (pGC->fillStyle == FillSolid) {
+ pGC->ops->PolySegment = afbSegmentSS;
+ pGC->ops->Polylines = afbLineSS;
+ }
+ else
+ {
+ pGC->ops->PolySegment = miPolySegment;
+ pGC->ops->Polylines = miZeroLine;
+ }
+ } else {
+ pGC->ops->PolySegment = miPolySegment;
+ pGC->ops->Polylines = miWideLine;
+ }
+ } else {
+ if(pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) {
+ pGC->ops->PolySegment = afbSegmentSD;
+ pGC->ops->Polylines = afbLineSD;
+ } else {
+ pGC->ops->PolySegment = miPolySegment;
+ pGC->ops->Polylines = miWideDash;
+ }
+ }
+ }
+
+ if (new_text || new_fill) {
+ if ((pGC->font) &&
+ (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)) {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ } else {
+ /* special case ImageGlyphBlt for terminal emulator fonts */
+ if ((pGC->font) &&
+ TERMINALFONT(pGC->font)) {
+ pGC->ops->ImageGlyphBlt = afbTEGlyphBlt;
+ } else {
+ pGC->ops->ImageGlyphBlt = afbImageGlyphBlt;
+ }
+
+ /* now do PolyGlyphBlt */
+ if (pGC->fillStyle == FillSolid) {
+ pGC->ops->PolyGlyphBlt = afbPolyGlyphBlt;
+ } else {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ }
+ }
+ }
+
+ if (new_fill) {
+ /* install a suitable fillspans and pushpixels */
+ pGC->ops->PushPixels = afbPushPixels;
+ pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ pGC->ops->FillSpans = afbSolidFS;
+ pGC->ops->FillPolygon = afbFillPolygonSolid;
+ pGC->ops->PolyFillArc = afbPolyFillArcSolid;
+ break;
+ case FillTiled:
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = afbTileFS;
+ else
+ pGC->ops->FillSpans = afbUnnaturalTileFS;
+ break;
+ case FillOpaqueStippled:
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = afbOpaqueStippleFS;
+ else
+ pGC->ops->FillSpans = afbUnnaturalOpaqueStippleFS;
+ break;
+
+ case FillStippled:
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = afbStippleFS;
+ else
+ pGC->ops->FillSpans = afbUnnaturalStippleFS;
+ break;
+ }
+ } /* end of new_fill */
+}
+
+void
+afbDestroyGC(pGC)
+ GCPtr pGC;
+{
+ if (pGC->pRotatedPixmap)
+ (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
+ if (pGC->freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ miDestroyGCOps(pGC->ops);
+}
+
+/* table to map alu(src, dst) to alu(~src, dst) */
+int afbInverseAlu[16] = {
+ GXclear,
+ GXandInverted,
+ GXnor,
+ GXcopyInverted,
+ GXand,
+ GXnoop,
+ GXequiv,
+ GXorInverted,
+ GXandReverse,
+ GXxor,
+ GXinvert,
+ GXnand,
+ GXcopy,
+ GXor,
+ GXorReverse,
+ GXset
+};
+
+void
+afbReduceOpaqueStipple(fg, bg, planemask, depth, rop)
+register PixelType fg;
+register PixelType bg;
+register unsigned long planemask;
+int depth;
+register unsigned char *rop;
+{
+ register int d;
+ register Pixel mask = 1;
+
+ bg ^= fg;
+
+ for (d = 0; d < depth; d++, mask <<= 1) {
+ if (!(planemask & mask))
+ rop[d] = RROP_NOP;
+ else if (!(bg & mask)) {
+ /* Both fg and bg have a 0 or 1 in this plane */
+ if (fg & mask)
+ rop[d] = RROP_WHITE;
+ else
+ rop[d] = RROP_BLACK;
+ } else {
+ /* Both fg and bg have different bits on this plane */
+ if (fg & mask)
+ rop[d] = RROP_COPY;
+ else
+ rop[d] = RROP_INVERT;
+ }
+ }
+}
+
+void
+afbReduceRop(alu, src, planemask, depth, rop)
+ register int alu;
+ register Pixel src;
+ register unsigned long planemask;
+ int depth;
+ register unsigned char *rop;
+{
+ register int d;
+ register Pixel mask = 1;
+
+ for (d = 0; d < depth; d++, mask <<= 1) {
+ if (!(planemask & mask))
+ rop[d] = RROP_NOP;
+ else if ((src & mask) == 0) /* src is black */
+ switch (alu) {
+ case GXclear:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXand:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXandReverse:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXcopy:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXandInverted:
+ rop[d] = RROP_NOP;
+ break;
+ case GXnoop:
+ rop[d] = RROP_NOP;
+ break;
+ case GXxor:
+ rop[d] = RROP_NOP;
+ break;
+ case GXor:
+ rop[d] = RROP_NOP;
+ break;
+ case GXnor:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXequiv:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXinvert:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXorReverse:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXcopyInverted:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXorInverted:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXnand:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXset:
+ rop[d] = RROP_WHITE;
+ break;
+ }
+ else /* src is white */
+ switch (alu) {
+ case GXclear:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXand:
+ rop[d] = RROP_NOP;
+ break;
+ case GXandReverse:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXcopy:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXandInverted:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXnoop:
+ rop[d] = RROP_NOP;
+ break;
+ case GXxor:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXor:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXnor:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXequiv:
+ rop[d] = RROP_NOP;
+ break;
+ case GXinvert:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXorReverse:
+ rop[d] = RROP_WHITE;
+ break;
+ case GXcopyInverted:
+ rop[d] = RROP_BLACK;
+ break;
+ case GXorInverted:
+ rop[d] = RROP_NOP;
+ break;
+ case GXnand:
+ rop[d] = RROP_INVERT;
+ break;
+ case GXset:
+ rop[d] = RROP_WHITE;
+ break;
+ }
+ }
+}
+
+void
+afbComputeCompositeClip(pGC, pDrawable)
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+{
+ ScreenPtr pScreen = pGC->pScreen;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ } else {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ } else {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip) {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
+ pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pScreen, pregWin);
+ } else if (freeTmpClip) {
+ REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ } else {
+ pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip) {
+ REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
+ } else {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION) {
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
+ -pGC->clipOrg.y);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
+ pGC->clipOrg.y);
+ }
+ } /* end of composite clip for pixmap */
+} /* end afbComputeCompositeClip */
diff --git a/xc/programs/Xserver/afb/afbgetsp.c b/xc/programs/Xserver/afb/afbgetsp.c
new file mode 100644
index 000000000..92de9aa53
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbgetsp.c
@@ -0,0 +1,163 @@
+/* $XFree86: xc/programs/Xserver/afb/afbgetsp.c,v 3.0 1996/08/18 01:45:37 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbgetsp.c,v 5.10 94/04/17 20:28:24 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+
+#include "misc.h"
+#include "region.h"
+#include "gc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+#include "servermd.h"
+
+/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
+ * and continuing for pwidth[i] bits
+ * Each scanline returned will be server scanline padded, i.e., it will come
+ * out to an integral number of words.
+ */
+/*ARGSUSED*/
+void
+afbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pchardstStart; /* where to put the bits */
+{
+ PixelType *pdstStart = (PixelType *)pchardstStart;
+ register PixelType *pdst; /* where to put the bits */
+ register PixelType *psrc; /* where to get the bits */
+ register PixelType tmpSrc; /* scratch buffer for bits */
+ PixelType *psrcBase; /* start of src bitmap */
+ int widthSrc; /* width of pixmap in bytes */
+ int sizeSrc;
+ int depthSrc;
+ register DDXPointPtr pptLast; /* one past last point to get */
+ int xEnd; /* last pixel to copy from */
+ register int nstart;
+ register int d;
+ int nend;
+ int srcStartOver;
+ PixelType startmask, endmask;
+ unsigned int srcBit;
+ int nlMiddle, nl;
+ int w;
+
+ pptLast = ppt + nspans;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthSrc, sizeSrc, depthSrc,
+ psrcBase);
+ pdst = pdstStart;
+
+ while(ppt < pptLast) {
+ /* XXX should this really be << PWSH, or * 8, or * PGSZB? */
+ xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
+ pwidth++;
+ for (d = 0; d < depthSrc; d++) {
+ psrc = afbScanline(psrcBase, ppt->x, ppt->y, widthSrc);
+ psrcBase += sizeSrc; /* @@@ NEXT PLANE @@@ */
+ w = xEnd - ppt->x;
+ srcBit = ppt->x & PIM;
+
+ if (srcBit + w <= PPW)
+ {
+ getandputbits0(psrc, srcBit, w, pdst);
+ pdst++;
+ }
+ else
+ {
+
+ maskbits(ppt->x, w, startmask, endmask, nlMiddle);
+ if (startmask)
+ nstart = PPW - srcBit;
+ else
+ nstart = 0;
+ if (endmask)
+ nend = xEnd & PIM;
+ srcStartOver = srcBit + nstart > PLST;
+ if (startmask)
+ {
+ getandputbits0(psrc, srcBit, nstart, pdst);
+ if(srcStartOver)
+ psrc++;
+ }
+ nl = nlMiddle;
+#ifdef FASTPUTBITS
+ Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;);
+#else
+ while (nl--)
+ {
+ tmpSrc = *psrc;
+ putbits(tmpSrc, nstart, PPW, pdst);
+ psrc++;
+ pdst++;
+ }
+#endif
+ if (endmask)
+ {
+ putbits(*psrc, nstart, nend, pdst);
+ if(nstart + nend > PPW)
+ pdst++;
+ }
+ if (startmask || endmask)
+ pdst++;
+ }
+ }
+ ppt++;
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbhrzvert.c b/xc/programs/Xserver/afb/afbhrzvert.c
new file mode 100644
index 000000000..93e163007
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbhrzvert.c
@@ -0,0 +1,206 @@
+/* $XFree86: xc/programs/Xserver/afb/afbhrzvert.c,v 3.0 1996/08/18 01:45:38 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbhrzvert.c,v 1.15 94/04/17 20:28:24 dpw Exp $ */
+
+#include "X.h"
+
+#include "gc.h"
+#include "window.h"
+#include "pixmap.h"
+#include "region.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+/* horizontal solid line
+ abs(len) > 1
+*/
+afbHorzS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops)
+PixelType *pbase; /* pointer to base of bitmap */
+register int nlwidth; /* width in longwords of bitmap */
+int sizeDst;
+int depthDst;
+int x1; /* initial point */
+int y1;
+int len; /* length of line */
+register unsigned char *rrops;
+{
+ register PixelType *addrl;
+ register PixelType startmask;
+ register PixelType endmask;
+ register int nlmiddle;
+ register int d;
+ int saveNLmiddle;
+
+ /* force the line to go left to right
+ but don't draw the last point
+ */
+ if (len < 0) {
+ x1 += len;
+ x1 += 1;
+ len = -len;
+ }
+
+ /* all bits inside same longword */
+ if ( ((x1 & PIM) + len) < PPW) {
+ maskpartialbits(x1, len, startmask);
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(pbase, x1, y1, nlwidth);
+ pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ *addrl &= ~startmask;
+ break;
+ case RROP_WHITE:
+ *addrl |= startmask;
+ break;
+ case RROP_INVERT:
+ *addrl ^= startmask;
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+ } else {
+ maskbits(x1, len, startmask, endmask, nlmiddle);
+ saveNLmiddle = nlmiddle;
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(pbase, x1, y1, nlwidth);
+ pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
+ nlmiddle = saveNLmiddle;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ if (startmask)
+ *addrl++ &= ~startmask;
+ Duff (nlmiddle, *addrl++ = 0x0);
+ if (endmask)
+ *addrl &= ~endmask;
+ break;
+
+ case RROP_WHITE:
+ if (startmask)
+ *addrl++ |= startmask;
+ Duff (nlmiddle, *addrl++ = ~0);
+ if (endmask)
+ *addrl |= endmask;
+ break;
+
+ case RROP_INVERT:
+ if (startmask)
+ *addrl++ ^= startmask;
+ Duff (nlmiddle, *addrl++ ^= ~0);
+ if (endmask)
+ *addrl ^= endmask;
+ break;
+
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ... ) */
+ }
+}
+
+/* vertical solid line
+ this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
+ better code. sigh. we know that len will never be 0 or 1, so
+ it's OK to use it.
+*/
+
+afbVertS(pbase, nlwidth, sizeDst, depthDst, x1, y1, len, rrops)
+PixelType *pbase; /* pointer to base of bitmap */
+register int nlwidth; /* width in longwords of bitmap */
+int sizeDst;
+int depthDst;
+int x1, y1; /* initial point */
+register int len; /* length of line */
+unsigned char *rrops;
+{
+ register PixelType *addrl;
+ register PixelType bitmask;
+ int saveLen;
+ int d;
+
+ if (len < 0) {
+ nlwidth = -nlwidth;
+ len = -len;
+ }
+
+ saveLen = len;
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(pbase, x1, y1, nlwidth);
+ pbase += sizeDst; /* @@@ NEXT PLANE @@@ */
+ len = saveLen;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ bitmask = rmask[x1 & PIM];
+ Duff(len, *addrl &= bitmask; afbScanlineInc(addrl, nlwidth) );
+ break;
+
+ case RROP_WHITE:
+ bitmask = mask[x1 & PIM];
+ Duff(len, *addrl |= bitmask; afbScanlineInc(addrl, nlwidth) );
+ break;
+
+ case RROP_INVERT:
+ bitmask = mask[x1 & PIM];
+ Duff(len, *addrl ^= bitmask; afbScanlineInc(addrl, nlwidth) );
+ break;
+
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+}
diff --git a/xc/programs/Xserver/afb/afbimage.c b/xc/programs/Xserver/afb/afbimage.c
new file mode 100644
index 000000000..00fc0952e
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbimage.c
@@ -0,0 +1,297 @@
+/* $XFree86: xc/programs/Xserver/afb/afbimage.c,v 3.2 1998/03/20 21:04:55 hohndel Exp $ */
+
+#include "X.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "afb.h"
+#include "maskbits.h"
+#include "servermd.h"
+#include "mfb.h"
+
+void
+afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int depth, x, y, width, height;
+ int leftPad;
+ int format;
+ char *pImage;
+{
+ PixmapPtr pPixmap;
+
+ if ((width == 0) || (height == 0))
+ return;
+
+ if (format != ZPixmap || depth == 1 || pDraw->depth == 1) {
+ pPixmap = GetScratchPixmapHeader(pDraw->pScreen, width+leftPad, height,
+ depth, depth,
+ BitmapBytePad(width+leftPad),
+ (pointer)pImage);
+ if (!pPixmap)
+ return;
+
+ pGC->fExpose = FALSE;
+ if (format == XYBitmap)
+ (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
+ 0, width, height, x, y, 1);
+ else {
+#if 0
+ /* XXX: bit plane order wronge ! */
+ pPixmap->drawable.depth = 1;
+ pPixmap->drawable.bitsPerPixel = 1;
+
+ switch (pGC->alu) {
+ case GXcopy:
+ doBitBlt = afbDoBitbltCopy;
+ break;
+ case GXxor:
+ doBitBlt = afbDoBitbltXor;
+ break;
+ case GXcopyInverted:
+ doBitBlt = afbDoBitbltCopyInverted;
+ break;
+ case GXor:
+ doBitBlt = afbDoBitbltOr;
+ break;
+ default:
+ doBitBlt = afbDoBitbltGeneral;
+ break;
+ }
+
+ for (plane = (1L << (pPixmap->drawable.depth - 1)); plane;
+ plane >>= 1) {
+ (void)afbBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
+ width, height, x, y, doBitBlt, plane);
+ /* pDraw->devKind += sizeDst; */
+ }
+#else
+ (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
+ 0, width, height, x, y);
+#endif
+ }
+
+ pGC->fExpose = TRUE;
+ FreeScratchPixmapHeader(pPixmap);
+ } else {
+ /* Chunky to planar conversion required */
+
+ PixmapPtr pPixmap;
+ ScreenPtr pScreen = pDraw->pScreen;
+ int widthSrc;
+ int start_srcshift;
+ register int b;
+ register int dstshift;
+ register int shift_step;
+ register PixelType dst;
+ register PixelType srcbits;
+ register PixelType *pdst;
+ register PixelType *psrc;
+ int start_bit;
+ register int nl;
+ register int h;
+ register int d;
+ int sizeDst;
+ PixelType *pdstBase;
+ int widthDst;
+ int depthDst;
+
+ /* Create a tmp pixmap */
+ pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth);
+ if (!pPixmap)
+ return;
+
+ afbGetPixelWidthSizeDepthAndPointer((DrawablePtr)pPixmap, widthDst,
+ sizeDst, depthDst, pdstBase);
+
+ widthSrc = PixmapWidthInPadUnits(width, depth);
+ /* XXX: if depth == 8, use fast chunky to planar assembly function.*/
+ if (depth > 4) {
+ start_srcshift = 24;
+ shift_step = 8;
+ } else {
+ start_srcshift = 28;
+ shift_step = 4;
+ }
+
+ for (d = 0; d < depth; d++, pdstBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ start_bit = start_srcshift + d;
+ psrc = (PixelType *)pImage;
+ pdst = pdstBase;
+ h = height;
+
+ while (h--) {
+ dstshift = PPW - 1;
+ dst = 0;
+ nl = widthSrc;
+ while (nl--) {
+ srcbits = *psrc++;
+ for (b = start_bit; b >= 0; b -= shift_step) {
+ dst |= ((srcbits >> b) & 1) << dstshift;
+ if (--dstshift < 0) {
+ dstshift = PPW - 1;
+ *pdst++ = dst;
+ dst = 0;
+ }
+ }
+ }
+ if (dstshift != PPW - 1)
+ *pdst++ = dst;
+ }
+ } /* for (d = ...) */
+
+ pGC->fExpose = FALSE;
+ (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
+ width, height, x, y);
+ pGC->fExpose = TRUE;
+ (*pScreen->DestroyPixmap)(pPixmap);
+ }
+}
+
+void
+afbGetImage(pDrawable, sx, sy, width, height, format, planemask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, width, height;
+ unsigned int format;
+ unsigned long planemask;
+ char *pdstLine;
+{
+ BoxRec box;
+ DDXPointRec ptSrc;
+ RegionRec rgnDst;
+ ScreenPtr pScreen;
+ PixmapPtr pPixmap;
+
+ if ((width == 0) || (height == 0))
+ return;
+
+ pScreen = pDrawable->pScreen;
+ sx += pDrawable->x;
+ sy += pDrawable->y;
+
+ if (format == XYPixmap || pDrawable->depth == 1) {
+ pPixmap = GetScratchPixmapHeader(pScreen, width, height, 1, 1,
+ BitmapBytePad(width), (pointer)pdstLine);
+ if (!pPixmap)
+ return;
+
+ ptSrc.x = sx;
+ ptSrc.y = sy;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+
+ pPixmap->drawable.depth = 1;
+ pPixmap->drawable.bitsPerPixel = 1;
+ /* dix layer only ever calls GetImage with 1 bit set in planemask
+ * when format is XYPixmap.
+ */
+ afbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc,
+ planemask);
+
+ FreeScratchPixmapHeader(pPixmap);
+ REGION_UNINIT(pScreen, &rgnDst);
+ } else {
+ /* Planar to chunky conversion required */
+
+ PixelType *psrcBits;
+ PixelType *psrcLine;
+ PixelType startmask, endmask;
+ int depthSrc;
+ int widthSrc;
+ int sizeSrc;
+ int sizeDst;
+ int widthDst;
+ register PixelType *psrc;
+ register PixelType *pdst;
+ register PixelType dst;
+ register PixelType srcbits;
+ register int d;
+ register int b;
+ register int dstshift;
+ register int shift_step;
+ register int start_endbit;
+ int start_startbit;
+ register int end_endbit;
+ register int start_dstshift;
+ register int nl;
+ register int h;
+ int nlmiddle;
+
+ widthDst = PixmapWidthInPadUnits(width, pDrawable->depth);
+ sizeDst = widthDst * height;
+
+ /* Clear the dest image */
+ bzero(pdstLine, sizeDst << 2);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthSrc, sizeSrc,
+ depthSrc, psrcBits);
+
+ psrcBits = afbScanline(psrcBits, sx, sy, widthSrc);
+
+ start_startbit = PPW - 1 - (sx & PIM);
+ if ((sx & PIM) + width < PPW) {
+ maskpartialbits(sx, width, startmask);
+ nlmiddle = 0;
+ endmask = 0;
+ start_endbit = PPW - ((sx + width) & PIM);
+ } else {
+ maskbits(sx, width, startmask, endmask, nlmiddle);
+ start_endbit = 0;
+ end_endbit = PPW - ((sx + width) & PIM);
+ }
+ /* ZPixmap images have either 4 or 8 bits per pixel dependent on
+ * depth.
+ */
+ if (depthSrc > 4) {
+ start_dstshift = 24;
+ shift_step = 8;
+ } else {
+ start_dstshift = 28;
+ shift_step = 4;
+ }
+#define SHIFT_BITS(start_bit,end_bit) \
+for (b = (start_bit); b >= (end_bit); b--) { \
+ dst |= ((srcbits >> b) & 1) << dstshift; \
+ if ((dstshift -= shift_step) < 0) { \
+ dstshift = start_dstshift + d; \
+ *pdst++ = dst; \
+ dst = *pdst; \
+ } \
+} \
+
+ for (d = 0; d < depthSrc; d++, psrcBits += sizeSrc) { /* @@@ NEXT PLANE @@@ */
+ psrcLine = psrcBits;
+ pdst = (PixelType *)pdstLine;
+ h = height;
+
+ while (h--) {
+ psrc = psrcLine;
+ psrcLine += widthSrc;
+ dst = *pdst;
+ dstshift = start_dstshift + d;
+
+ if (startmask) {
+ srcbits = *psrc++ & startmask;
+ SHIFT_BITS(start_startbit, start_endbit);
+ }
+
+ nl = nlmiddle;
+ while (nl--) {
+ srcbits = *psrc++;
+ SHIFT_BITS(PPW - 1, 0);
+ }
+ if (endmask) {
+ srcbits = *psrc & endmask;
+ SHIFT_BITS(PPW - 1, end_endbit);
+ }
+
+ if (dstshift != start_dstshift + d)
+ *pdst++ = dst;
+ } /* while (h--) */
+ } /* for (d = ...) */
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbimggblt.c b/xc/programs/Xserver/afb/afbimggblt.c
new file mode 100644
index 000000000..fbffb35dc
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbimggblt.c
@@ -0,0 +1,466 @@
+/* $XFree86: xc/programs/Xserver/afb/afbimggblt.c,v 3.1 1998/03/20 21:04:55 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbimggblt.c,v 5.17 94/04/17 20:28:25 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "maskbits.h"
+
+/*
+ we should eventually special-case fixed-width fonts for ImageText.
+
+ this works for fonts with glyphs <= 32 bits wide.
+
+ the clipping calculations are done for worst-case fonts.
+we make no assumptions about the heights, widths, or bearings
+of the glyphs. if we knew that the glyphs are all the same height,
+we could clip the tops and bottoms per clipping box, rather
+than per character per clipping box. if we knew that the glyphs'
+left and right bearings were wlle-behaved, we could clip a single
+character at the start, output until the last unclipped
+character, and then clip the last one. this is all straightforward
+to determine based on max-bounds and min-bounds from the font.
+ there is some inefficiency introduced in the per-character
+clipping to make what's going on clearer.
+
+ (it is possible, for example, for a font to be defined in which the
+next-to-last character in a font would be clipped out, but the last
+one wouldn't. the code below deals with this.)
+
+ Image text looks at the bits in the glyph and the fg and bg in the
+GC. it paints a rectangle, as defined in the protocol dcoument,
+and the paints the characters.
+
+ the register allocations for startmask and endmask may not
+be the right thing. are there two other deserving candidates?
+xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
+*/
+
+void
+afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ ExtentInfoRec info; /* used by QueryGlyphExtents() */
+ BoxRec bbox; /* string's bounding box */
+ xRectangle backrect;/* backing rectangle to paint.
+ in the general case, NOT necessarily
+ the same as the string's bounding box
+ */
+
+ CharInfoPtr pci;
+ int xorg, yorg; /* origin of drawable in bitmap */
+ int widthDst; /* width of dst in longwords */
+
+ /* these keep track of the character origin */
+ PixelType *pdstBase;
+ /* points to longword with character origin */
+ int xchar; /* xorigin of char (mod 32) */
+
+ /* these are used for placing the glyph */
+ register int xoff; /* x offset of left edge of glyph (mod 32) */
+ register PixelType *pdst;
+ /* pointer to current longword in dst */
+
+ register int d;
+ int depthDst;
+ int sizeDst;
+ int hSave;
+ int w; /* width of glyph in bits */
+ int h; /* height of glyph */
+ int widthGlyph; /* width of glyph, in bytes */
+ unsigned char rrops[AFB_MAX_DEPTH];
+ register unsigned char *pglyph;
+ /* pointer to current row of glyph */
+ unsigned char *pglyphSave;
+
+ /* used for putting down glyph */
+ register PixelType tmpSrc;
+ /* for getting bits from glyph */
+ register PixelType startmask;
+ register PixelType endmask;
+
+ register int nFirst;/* bits of glyph in current longword */
+ PixelType *pdstSave;
+ int oldFill;
+ afbPrivGC *pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
+ pdstBase);
+
+ QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
+
+ backrect.x = x;
+ backrect.y = y - FONTASCENT(pGC->font);
+ backrect.width = info.overallWidth;
+ backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+
+ x += xorg;
+ y += yorg;
+
+ bbox.x1 = x + info.overallLeft;
+ bbox.x2 = x + info.overallRight;
+ bbox.y1 = y - info.overallAscent;
+ bbox.y2 = y + info.overallDescent;
+
+ oldFill = pGC->fillStyle;
+ pGC->fillStyle = FillSolid;
+ afbReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
+ pPriv->rrops);
+ afbPolyFillRect(pDrawable, pGC, 1, &backrect);
+ pGC->fillStyle = oldFill;
+ afbReduceRop (pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
+ pPriv->rrops);
+ afbReduceRop (GXcopy, pGC->fgPixel, pGC->planemask, pGC->depth, rrops);
+
+ /* the faint-hearted can open their eyes now */
+
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
+ case rgnOUT:
+ break;
+ case rgnIN:
+ pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
+ xchar = x & PIM;
+
+ while(nglyph--) {
+ pci = *ppci;
+ pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ hSave = pci->metrics.ascent + pci->metrics.descent;
+ widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+ /* start at top scanline of glyph */
+ pdstSave = afbScanlineDelta(pdstBase, -pci->metrics.ascent,
+ widthDst);
+
+ /* find correct word in scanline and x offset within it
+ for left edge of glyph
+ */
+ xoff = xchar + pci->metrics.leftSideBearing;
+ if (xoff > PLST) {
+ pdstSave++;
+ xoff &= PIM;
+ } else if (xoff < 0) {
+ xoff += PPW;
+ pdstSave--;
+ }
+
+ for (d = 0; d < depthDst; d++) {
+ h = hSave;
+ pdst = pdstSave;
+ pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
+ pglyph = pglyphSave;
+
+ if ((xoff + w) <= PPW) {
+ /* glyph all in one longword */
+ maskpartialbits(xoff, w, startmask);
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ } else {
+ /* glyph crosses longword boundary */
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
+ *(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ } /* glyph crosses longwords boundary */
+ } /* depth loop */
+ /* update character origin */
+ x += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST) {
+ xchar -= PPW;
+ pdstBase++;
+ } else if (xchar < 0) {
+ xchar += PPW;
+ pdstBase--;
+ }
+ ppci++;
+ } /* while nglyph-- */
+ break;
+ case rgnPART:
+ {
+ afbTEXTPOS *ppos;
+ int nbox;
+ BoxPtr pbox;
+ RegionPtr cclip;
+ int xpos; /* x position of char origin */
+ int i;
+ BoxRec clip;
+ int leftEdge, rightEdge;
+ int topEdge, bottomEdge;
+ int glyphRow; /* first row of glyph not wholly
+ clipped out */
+ int glyphCol; /* leftmost visible column of glyph */
+ int getWidth; /* bits to get from glyph */
+
+ if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS))))
+ return;
+
+ pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
+ xpos = x;
+ xchar = xpos & PIM;
+
+ for (i = 0; i < nglyph; i++) {
+ pci = ppci[i];
+
+ ppos[i].xpos = xpos;
+ ppos[i].xchar = xchar;
+ ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
+ ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
+ ppos[i].topEdge = y - pci->metrics.ascent;
+ ppos[i].bottomEdge = y + pci->metrics.descent;
+ ppos[i].pdstBase = pdstBase;
+ ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+
+ xpos += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST) {
+ xchar &= PIM;
+ pdstBase++;
+ } else if (xchar < 0) {
+ xchar += PPW;
+ pdstBase--;
+ }
+ }
+
+ cclip = pGC->pCompositeClip;
+ pbox = REGION_RECTS(cclip);
+ nbox = REGION_NUM_RECTS(cclip);
+
+ /* HACK ALERT
+ since we continue out of the loop below so often, it
+ is easier to increment pbox at the top than at the end.
+ don't try this at home.
+ */
+ pbox--;
+ while(nbox--) {
+ pbox++;
+ clip.x1 = max(bbox.x1, pbox->x1);
+ clip.y1 = max(bbox.y1, pbox->y1);
+ clip.x2 = min(bbox.x2, pbox->x2);
+ clip.y2 = min(bbox.y2, pbox->y2);
+ if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
+ continue;
+
+ for(i=0; i<nglyph; i++) {
+ pci = ppci[i];
+ xchar = ppos[i].xchar;
+
+ /* clip the left and right edges */
+ if (ppos[i].leftEdge < clip.x1)
+ leftEdge = clip.x1;
+ else
+ leftEdge = ppos[i].leftEdge;
+
+ if (ppos[i].rightEdge > clip.x2)
+ rightEdge = clip.x2;
+ else
+ rightEdge = ppos[i].rightEdge;
+
+ w = rightEdge - leftEdge;
+ if (w <= 0)
+ continue;
+
+ /* clip the top and bottom edges */
+ if (ppos[i].topEdge < clip.y1)
+ topEdge = clip.y1;
+ else
+ topEdge = ppos[i].topEdge;
+
+ if (ppos[i].bottomEdge > clip.y2)
+ bottomEdge = clip.y2;
+ else
+ bottomEdge = ppos[i].bottomEdge;
+
+ hSave = bottomEdge - topEdge;
+ if (hSave <= 0)
+ continue;
+
+ glyphRow = (topEdge - y) + pci->metrics.ascent;
+ widthGlyph = ppos[i].widthGlyph;
+ pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
+ pglyphSave += (glyphRow * widthGlyph);
+
+ glyphCol = (leftEdge - ppos[i].xpos) -
+ (pci->metrics.leftSideBearing);
+ getWidth = w + glyphCol;
+
+ pdstSave = afbScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
+ widthDst);
+ xoff = xchar + (leftEdge - ppos[i].xpos);
+ if (xoff > PLST) {
+ xoff &= PIM;
+ pdstSave++;
+ } else if (xoff < 0) {
+ xoff += PPW;
+ pdstSave--;
+ }
+
+ for (d = 0; d < depthDst; d++) {
+ h = hSave;
+ pdst = pdstSave;
+ pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
+ pglyph = pglyphSave;
+
+ if ((xoff + w) <= PPW) {
+ maskpartialbits(xoff, w, startmask);
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ } else {
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
+ *(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ } /* depth */
+ } /* for each glyph */
+ } /* while nbox-- */
+ DEALLOCATE_LOCAL(ppos);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbline.c b/xc/programs/Xserver/afb/afbline.c
new file mode 100644
index 000000000..12ac16fc6
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbline.c
@@ -0,0 +1,698 @@
+/* $XFree86: xc/programs/Xserver/afb/afbline.c,v 3.1 1998/03/20 21:04:55 hohndel Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbline.c,v 5.18 94/04/17 20:28:26 dpw Exp $ */
+
+#include "X.h"
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "mistruct.h"
+
+#include "afb.h"
+#include "maskbits.h"
+#include "miline.h"
+
+/* single-pixel lines on a color frame buffer
+
+ NON-SLOPED LINES
+ horizontal lines are always drawn left to right; we have to
+move the endpoints right by one after they're swapped.
+ horizontal lines will be confined to a single band of a
+region. the code finds that band (giving up if the lower
+bound of the band is above the line we're drawing); then it
+finds the first box in that band that contains part of the
+line. we clip the line to subsequent boxes in that band.
+ vertical lines are always drawn top to bottom (y-increasing.)
+this requires adding one to the y-coordinate of each endpoint
+after swapping.
+
+ SLOPED LINES
+ when clipping a sloped line, we bring the second point inside
+the clipping box, rather than one beyond it, and then add 1 to
+the length of the line before drawing it. this lets us use
+the same box for finding the outcodes for both endpoints. since
+the equation for clipping the second endpoint to an edge gives us
+1 beyond the edge, we then have to move the point towards the
+first point by one step on the major axis.
+ eventually, there will be a diagram here to explain what's going
+on. the method uses Cohen-Sutherland outcodes to determine
+outsideness, and a method similar to Pike's layers for doing the
+actual clipping.
+
+*/
+
+void
+#ifdef POLYSEGMENT
+afbSegmentSS(pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+afbLineSS(pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ unsigned int oc1; /* outcode of point 1 */
+ unsigned int oc2; /* outcode of point 2 */
+
+ PixelType *addrlBase; /* pointer to start of drawable */
+ PixelType *addrl; /* address of destination pixmap */
+ int nlwidth; /* width in longwords of destination pixmap */
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int depthDst;
+ int d;
+ int sizeDst;
+ unsigned char *rrops;
+
+ /* a bunch of temporaries */
+ register int y1, y2;
+ register int x1, x2;
+ RegionPtr cclip;
+
+ cclip = pGC->pCompositeClip;
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ addrlBase);
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (x1 == x2) /* vertical line */
+ {
+ /* make the line go top to bottom of screen, keeping
+ endpoint semantics
+ */
+ if (y1 > y2) {
+ register int tmp;
+
+ tmp = y2;
+ y2 = y1 + 1;
+ y1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ y1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ y2++;
+#endif
+ /* get to first band that might contain part of line */
+ while ((nbox) && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ if (nbox) {
+ /* stop when lower edge of box is beyond end of line */
+ while((nbox) && (y2 >= pbox->y1)) {
+ if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
+ int y1t, y2t;
+ /* this box has part of the line in it */
+ y1t = max(y1, pbox->y1);
+ y2t = min(y2, pbox->y2);
+ if (y1t != y2t)
+ afbVertS(addrlBase, nlwidth, sizeDst, depthDst, x1, y1t,
+ y2t-y1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
+ }
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ y2 = ppt->y + yorg;
+#endif
+ } else if (y1 == y2) /* horizontal line */ {
+ /* force line from left to right, keeping
+ endpoint semantics
+ */
+ if (x1 > x2) {
+ register int tmp;
+
+ tmp = x2;
+ x2 = x1 + 1;
+ x1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ x1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ x2++;
+#endif
+
+ /* find the correct band */
+ while( (nbox) && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* try to draw the line, if we haven't gone beyond it */
+ if ((nbox) && (pbox->y1 <= y1)) {
+ int tmp;
+
+ /* when we leave this band, we're done */
+ tmp = pbox->y1;
+ while((nbox) && (pbox->y1 == tmp)) {
+ int x1t, x2t;
+
+ if (pbox->x2 <= x1) {
+ /* skip boxes until one might contain start point */
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ /* stop if left of box is beyond right of line */
+ if (pbox->x1 >= x2) {
+ nbox = 0;
+ break;
+ }
+
+ x1t = max(x1, pbox->x1);
+ x2t = min(x2, pbox->x2);
+ if (x1t != x2t)
+ afbHorzS(addrlBase, nlwidth, sizeDst, depthDst, x1t, y1,
+ x2t-x1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ x2 = ppt->x + xorg;
+#endif
+ }
+ else /* sloped line */
+ {
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady,
+ signdx, signdy, 1, 1, octant);
+
+ if (adx > ady) {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ } else {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--) {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0) {
+ if (axis == X_AXIS)
+ len = adx;
+ else
+ len = ady;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ len++;
+#endif
+ afbBresS(addrlBase, nlwidth, sizeDst, depthDst, signdx, signdy,
+ axis, x1, y1, e, e1, e2, len, rrops); /* @@@ NEXT PLANE PASSED @@@ */
+ break;
+ } else if (oc1 & oc2) {
+ pbox++;
+ } else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
+ pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pbox++;
+ continue;
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ afbBresS(addrlBase, nlwidth, sizeDst, depthDst, signdx,
+ signdy, axis, new_x1, new_y1, err, e1, e2, len,
+ rrops); /* @@@ NEXT PLANE PASSED @@@ */
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+ } /* sloped line */
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1))) {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--) {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) &&
+ (y2 < pbox->y2)) {
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(addrlBase, x2, y2, nlwidth);
+ addrlBase += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ switch(rrops[d]) {
+ case RROP_BLACK:
+ *addrl &= rmask[x2 & PIM];
+ break;
+ case RROP_WHITE:
+ *addrl |= mask[x2 & PIM];
+ break;
+ case RROP_INVERT:
+ *addrl ^= mask[x2 & PIM];
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+ break;
+ } else
+ pbox++;
+ }
+ }
+#endif
+}
+
+/*
+ * Draw dashed 1-pixel lines.
+ */
+
+void
+#ifdef POLYSEGMENT
+afbSegmentSD(pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+afbLineSD(pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ register unsigned int oc1; /* outcode of point 1 */
+ register unsigned int oc2; /* outcode of point 2 */
+
+ PixelType *addrlBase; /* address of destination pixmap */
+ PixelType *addrl;
+ int nlwidth; /* width in longwords of destination pixmap */
+ int sizeDst;
+ int depthDst;
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int x1, x2, y1, y2;
+ RegionPtr cclip;
+ unsigned char *rrops;
+ unsigned char bgrrops[AFB_MAX_DEPTH];
+ unsigned char *pDash;
+ int dashOffset;
+ int numInDashList;
+ int dashIndex;
+ int isDoubleDash;
+ int dashIndexTmp, dashOffsetTmp;
+ int unclippedlen;
+ int d;
+
+ cclip = pGC->pCompositeClip;
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ addrlBase);
+
+ /* compute initial dash values */
+
+ pDash = (unsigned char *) pGC->dash;
+ numInDashList = pGC->numInDashList;
+ isDoubleDash = (pGC->lineStyle == LineDoubleDash);
+ dashIndex = 0;
+ dashOffset = 0;
+ miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+
+ if (isDoubleDash)
+ afbReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
+ bgrrops);
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
+ 1, 1, octant);
+
+ if (adx > ady) {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ unclippedlen = adx;
+ } else {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ unclippedlen = ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--) {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0) {
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ unclippedlen++;
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+ afbBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
+ isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
+ signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
+ rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
+ break;
+#else
+ afbBresD(&dashIndex, pDash, numInDashList, &dashOffset,
+ isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
+ signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
+ rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
+ goto dontStep;
+#endif
+ } else if (oc1 & oc2) {
+ pbox++;
+ } else /* have to clip */ {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1) {
+ pbox++;
+ continue;
+ }
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+ if (clip1) {
+ int dlen;
+
+ if (axis == X_AXIS)
+ dlen = abs(new_x1 - x1);
+ else
+ dlen = abs(new_y1 - y1);
+ miStepDash (dlen, &dashIndexTmp, pDash,
+ numInDashList, &dashOffsetTmp);
+ }
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ afbBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
+ isDoubleDash, addrlBase, nlwidth, sizeDst, depthDst,
+ signdx, signdy, axis, new_x1, new_y1, err, e1, e2,
+ len, rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+#ifndef POLYSEGMENT
+ /*
+ * walk the dash list around to the next line
+ */
+ miStepDash (unclippedlen, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+dontStep: ;
+#endif
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((dashIndex & 1) == 0 || isDoubleDash) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1))) {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--) {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) &&
+ (y2 < pbox->y2)) {
+ int rop;
+
+ for (d = 0; d < depthDst; d++) {
+ addrl = afbScanline(addrlBase, x2, y2, nlwidth);
+ addrlBase += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ rop = rrops[d];
+ if (dashIndex & 1)
+ rop = bgrrops[d];
+
+ switch (rop) {
+ case RROP_BLACK:
+ *addrl &= rmask[x2 & PIM];
+ break;
+ case RROP_WHITE:
+ *addrl |= mask[x2 & PIM];
+ break;
+
+ case RROP_INVERT:
+ *addrl ^= mask[x2 & PIM];
+ break;
+
+ case RROP_NOP:
+ break;
+ }
+ } /* for (d = ...) */
+ break;
+ } else
+ pbox++;
+ }
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/afb/afbmisc.c b/xc/programs/Xserver/afb/afbmisc.c
new file mode 100644
index 000000000..c0ae1c545
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbmisc.c
@@ -0,0 +1,92 @@
+/* $XFree86: xc/programs/Xserver/afb/afbmisc.c,v 3.0 1996/08/18 01:45:44 dawes Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbmisc.c,v 5.4 94/04/17 20:28:27 dpw Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#include "cursor.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+
+/*ARGSUSED*/
+void
+afbQueryBestSize(class, pwidth, pheight, pScreen)
+int class;
+unsigned short *pwidth;
+unsigned short *pheight;
+ScreenPtr pScreen;
+{
+ unsigned width, test;
+
+ switch(class) {
+ case CursorShape:
+ if (*pwidth > pScreen->width)
+ *pwidth = pScreen->width;
+ if (*pheight > pScreen->height)
+ *pheight = pScreen->height;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the closes power of two not less than what they gave me */
+ test = 0x80000000;
+ /* Find the highest 1 bit in the width given */
+ while(!(test & width))
+ test >>= 1;
+ /* If their number is greater than that, bump up to the next
+ * power of two */
+ if((test - 1) & width)
+ test <<= 1;
+ *pwidth = test;
+ /* We don't care what height they use */
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbmodule.c b/xc/programs/Xserver/afb/afbmodule.c
new file mode 100644
index 000000000..19f196ad8
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbmodule.c
@@ -0,0 +1,49 @@
+/* $XFree86: xc/programs/Xserver/afb/afbmodule.c,v 1.1 1999/06/13 13:47:38 dawes Exp $ */
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef XFree86LOADER
+
+#include "xf86Module.h"
+#include "afb.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "afb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+XF86ModuleData afbModuleData = { &VersRec, NULL, NULL };
+
+#endif
diff --git a/xc/programs/Xserver/afb/afbpixmap.c b/xc/programs/Xserver/afb/afbpixmap.c
new file mode 100644
index 000000000..fe0d8bc79
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbpixmap.c
@@ -0,0 +1,292 @@
+/* $XFree86: xc/programs/Xserver/afb/afbpixmap.c,v 3.1 1997/06/03 14:11:07 hohndel Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbpixmap.c,v 5.13 94/04/17 20:28:28 dpw Exp $ */
+
+/* pixmap management
+ written by drewry, september 1986
+
+ on a monchrome device, a pixmap is a bitmap.
+*/
+
+#include "Xmd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "maskbits.h"
+
+#include "afb.h"
+#include "mi.h"
+
+#include "servermd.h"
+#include "mfb.h"
+
+PixmapPtr
+afbCreatePixmap(pScreen, width, height, depth)
+ ScreenPtr pScreen;
+ int width;
+ int height;
+ int depth;
+{
+ PixmapPtr pPixmap;
+ int datasize;
+ int paddedWidth;
+
+ paddedWidth = BitmapBytePad(width);
+ datasize = height * paddedWidth * depth;
+ pPixmap = AllocatePixmap(pScreen, datasize);
+ if (!pPixmap)
+ return(NullPixmap);
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = depth;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = paddedWidth;
+ pPixmap->refcnt = 1;
+#ifdef PIXPRIV
+ pPixmap->devPrivate.ptr = datasize ?
+ (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
+#else
+ pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
+#endif
+ return(pPixmap);
+}
+
+Bool
+afbDestroyPixmap(pPixmap)
+ PixmapPtr pPixmap;
+{
+ if(--pPixmap->refcnt)
+ return(TRUE);
+ xfree(pPixmap);
+ return(TRUE);
+}
+
+
+PixmapPtr
+afbCopyPixmap(pSrc)
+ register PixmapPtr pSrc;
+{
+ register PixmapPtr pDst;
+ int size;
+ ScreenPtr pScreen;
+
+ size = pSrc->drawable.height * pSrc->devKind * pSrc->drawable.depth;
+ pScreen = pSrc->drawable.pScreen;
+ pDst = (*pScreen->CreatePixmap)(pScreen, pSrc->drawable.width,
+ pSrc->drawable.height, pSrc->drawable.depth);
+ if (!pDst)
+ return(NullPixmap);
+ memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
+ return(pDst);
+}
+
+
+/* replicates a pattern to be a full 32 bits wide.
+ relies on the fact that each scnaline is longword padded.
+ doesn't do anything if pixmap is not a factor of 32 wide.
+ changes width field of pixmap if successful, so that the fast
+ XRotatePixmap code gets used if we rotate the pixmap later.
+
+ calculate number of times to repeat
+ for each scanline of pattern
+ zero out area to be filled with replicate
+ left shift and or in original as many times as needed
+*/
+void
+afbPadPixmap(pPixmap)
+ PixmapPtr pPixmap;
+{
+ register int width = pPixmap->drawable.width;
+ register int h;
+ register PixelType mask;
+ register PixelType *p;
+ register PixelType bits; /* real pattern bits */
+ register int i;
+ int d;
+ int rep; /* repeat count for pattern */
+
+ if (width >= PPW)
+ return;
+
+ rep = PPW/width;
+ if (rep*width != PPW)
+ return;
+
+ mask = endtab[width];
+
+ p = (PixelType *)(pPixmap->devPrivate.ptr);
+
+ for (d = 0; d < pPixmap->drawable.depth; d++) {
+ for (h = 0; h < pPixmap->drawable.height; h++) {
+ *p &= mask;
+ bits = *p;
+ for(i = 1; i < rep; i++) {
+ bits = SCRRIGHT(bits, width);
+ *p |= bits;
+ }
+ p++; /* @@@ NEXT PLANE @@@ */
+ }
+ }
+ pPixmap->drawable.width = PPW;
+}
+
+/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
+ * words are PPW bits wide, and that the least significant bit appears on the
+ * left.
+ */
+void
+afbXRotatePixmap(pPix, rw)
+ PixmapPtr pPix;
+ register int rw;
+{
+ register PixelType *pw, *pwFinal;
+ register PixelType t;
+
+ if (pPix == NullPixmap)
+ return;
+
+ pw = (PixelType *)pPix->devPrivate.ptr;
+ rw %= (int)pPix->drawable.width;
+ if (rw < 0)
+ rw += (int)pPix->drawable.width;
+ if(pPix->drawable.width == PPW) {
+ pwFinal = pw + pPix->drawable.height * pPix->drawable.depth;
+ while(pw < pwFinal) {
+ t = *pw;
+ *pw++ = SCRRIGHT(t, rw) |
+ (SCRLEFT(t, (PPW-rw)) & endtab[rw]);
+ }
+ } else {
+ /* We no longer do this. Validate doesn't try to rotate odd-size
+ * tiles or stipples. afbUnnatural<tile/stipple>FS works directly off
+ * the unrotate tile/stipple in the GC
+ */
+ ErrorF("X internal error: trying to rotate odd-sized pixmap.\n");
+ }
+
+}
+
+/* Rotates pixmap pPix by h lines. Assumes that h is always less than
+ pPix->height
+ works on any width.
+ */
+void
+afbYRotatePixmap(pPix, rh)
+ register PixmapPtr pPix;
+ int rh;
+{
+ int nbyDown; /* bytes to move down to row 0; also offset of
+ row rh */
+ int nbyUp; /* bytes to move up to line rh; also
+ offset of first line moved down to 0 */
+ char *pbase;
+ char *ptmp;
+ int height;
+ int d;
+
+ if (pPix == NullPixmap)
+ return;
+ height = (int) pPix->drawable.height;
+ rh %= height;
+ if (rh < 0)
+ rh += height;
+
+ nbyDown = rh * pPix->devKind;
+ nbyUp = (pPix->devKind * height) - nbyDown;
+
+ if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
+ return;
+
+ for (d = 0; d < pPix->drawable.depth; d++) {
+ pbase = (char *)pPix->devPrivate.ptr + pPix->devKind * height * d; /* @@@ NEXT PLANE @@@ */
+
+ memmove(ptmp, pbase, nbyUp); /* save the low rows */
+ memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
+ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */
+ }
+ DEALLOCATE_LOCAL(ptmp);
+}
+
+void
+afbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
+ register PixmapPtr psrcPix, *ppdstPix;
+ int xrot, yrot;
+{
+ register PixmapPtr pdstPix;
+
+ if ((pdstPix = *ppdstPix) &&
+ (pdstPix->devKind == psrcPix->devKind) &&
+ (pdstPix->drawable.height == psrcPix->drawable.height) &&
+ (pdstPix->drawable.depth == psrcPix->drawable.depth)) {
+ memmove((char *)pdstPix->devPrivate.ptr,
+ (char *)psrcPix->devPrivate.ptr,
+ psrcPix->drawable.height * psrcPix->devKind *
+ psrcPix->drawable.depth);
+ pdstPix->drawable.width = psrcPix->drawable.width;
+ pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ } else {
+ if (pdstPix)
+ /* FIX XBUG 6168 */
+ (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
+ *ppdstPix = pdstPix = afbCopyPixmap(psrcPix);
+ if (!pdstPix)
+ return;
+ }
+ afbPadPixmap(pdstPix);
+ if (xrot)
+ afbXRotatePixmap(pdstPix, xrot);
+ if (yrot)
+ afbYRotatePixmap(pdstPix, yrot);
+}
diff --git a/xc/programs/Xserver/afb/afbply1rct.c b/xc/programs/Xserver/afb/afbply1rct.c
new file mode 100644
index 000000000..4af2f96ff
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbply1rct.c
@@ -0,0 +1,296 @@
+/* $XFree86: xc/programs/Xserver/afb/afbply1rct.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/*
+ * $XConsortium: afbply1rct.c,v 1.9 94/04/17 20:28:28 dpw Exp $
+ *
+Copyright (c) 1990 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#include "X.h"
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "mistruct.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+#if defined(mips) || defined(sparc)
+#define GetHighWord(x) (((int)(x)) >> 16)
+#else
+#define GetHighWord(x) (((int)(x)) / 65536)
+#endif
+
+#if IMAGE_BYTE_ORDER == MSBFirst
+#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int)((short) (i))))
+#define coordToInt(x,y) (((x) << 16) | (y))
+#define intToX(i) (GetHighWord(i))
+#define intToY(i) ((int)((short) i))
+#else
+#define intToCoord(i,x,y) (((x) = (int)((short) (i))), ((y) = GetHighWord(i)))
+#define coordToInt(x,y) (((y) << 16) | (x))
+#define intToX(i) ((int)((short) (i)))
+#define intToY(i) (GetHighWord(i))
+#endif
+
+void
+afbFillPolygonSolid (pDrawable, pGC, shape, mode, count, ptsIn)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int shape;
+ int mode;
+ int count;
+ DDXPointPtr ptsIn;
+{
+ afbPrivGCPtr devPriv;
+ int nlwidth;
+ PixelType *addrl, *addr;
+ int maxy;
+ int origin;
+ register int vertex1, vertex2;
+ int c;
+ BoxPtr extents;
+ int clip;
+ int y;
+ int *vertex1p, *vertex2p;
+ int *endp;
+ int x1, x2;
+ int dx1, dx2;
+ int dy1, dy2;
+ int e1, e2;
+ int step1, step2;
+ int sign1, sign2;
+ int h;
+ int l, r;
+ PixelType mask, bits = ~((PixelType)0);
+ int nmiddle;
+ register unsigned char *rrops;
+ register int n;
+ register int d;
+ int sizeDst;
+ int depthDst;
+ register PixelType *pdst;
+
+ devPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
+
+ if (mode == CoordModePrevious || shape != Convex ||
+ REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
+ miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+ origin = *((int *) &pDrawable->x);
+ origin -= (origin & 0x8000) << 1;
+ extents = &pGC->pCompositeClip->extents;
+ vertex1 = *((int *) &extents->x1) - origin;
+ vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
+ clip = 0;
+ y = 32767;
+ maxy = 0;
+ vertex2p = (int *) ptsIn;
+ endp = vertex2p + count;
+ while (count--) {
+ c = *vertex2p;
+ clip |= (c - vertex1) | (vertex2 - c);
+ c = intToY(c);
+ if (c < y) {
+ y = c;
+ vertex1p = vertex2p;
+ }
+ vertex2p++;
+ if (c > maxy)
+ maxy = c;
+ }
+ if (y == maxy)
+ return;
+
+ if (clip & 0x80008000) {
+ miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
+ return;
+ }
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ addrl);
+ rrops = devPriv->rrops;
+ addrl = afbScanlineDelta(addrl, y + pDrawable->y, nlwidth);
+ origin = intToX(origin);
+ vertex2p = vertex1p;
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
+ x = intToX(vertex); \
+ if (dy = intToY(c) - y) { \
+ dx = intToX(c) - x; \
+ step = 0; \
+ if (dx >= 0) { \
+ e = 0; \
+ sign = 1; \
+ if (dx >= dy) {\
+ step = dx / dy; \
+ dx = dx % dy; \
+ } \
+ } else { \
+ e = 1 - dy; \
+ sign = -1; \
+ dx = -dx; \
+ if (dx >= dy) { \
+ step = - (dx / dy); \
+ dx = dx % dy; \
+ } \
+ } \
+ } \
+ x += origin; \
+ vertex = c; \
+}
+
+#define Step(x,dx,dy,e,sign,step) {\
+ x += step; \
+ if ((e += dx) > 0) { \
+ x += sign; \
+ e -= dy; \
+ } \
+}
+ for (;;) {
+ if (y == intToY(vertex1)) {
+ do {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ } else {
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2)) {
+ do {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ } else {
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+ /* fill spans for this segment */
+ y += h;
+ for (;;) {
+ l = x1;
+ r = x2;
+ nmiddle = x2 - x1;
+ if (nmiddle < 0) {
+ nmiddle = -nmiddle;
+ l = x2;
+ r = x1;
+ }
+ c = l & PIM;
+ l -= c;
+ l = l >> PWSH;
+ addr = addrl + l;
+ if (c + nmiddle < PPW) {
+ mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
+ for (pdst = addr, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ *pdst &= ~mask;
+ break;
+ case RROP_WHITE:
+ *pdst |= mask;
+ break;
+ case RROP_INVERT:
+ *pdst ^= mask;
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ } else {
+ if (c) {
+ mask = SCRRIGHT(bits, c);
+ for (pdst = addr, d = 0; d < depthDst; d++, pdst += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ *pdst &= ~mask;
+ break;
+ case RROP_WHITE:
+ *pdst |= mask;
+ break;
+ case RROP_INVERT:
+ *pdst ^= mask;
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ nmiddle += c - PPW;
+ addr++;
+ }
+ nmiddle >>= PWSH;
+ mask = ~SCRRIGHT(bits, r & PIM);
+
+ for (d = 0; d < depthDst; d++, addr += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ n = nmiddle;
+ pdst = addr;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ Duff (n, *pdst++ = 0;)
+ if (mask)
+ *pdst &= ~mask;
+ break;
+ case RROP_WHITE:
+ Duff (n, *pdst++ = ~0;);
+ if (mask)
+ *pdst |= mask;
+ break;
+ case RROP_INVERT:
+ Duff (n, *pdst++ ^= ~0;);
+ if (mask)
+ *pdst ^= mask;
+ break;
+ case RROP_NOP:
+ break;
+ }
+ }
+ }
+ if (!--h)
+ break;
+ afbScanlineInc(addrl, nlwidth);
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ if (y == maxy)
+ break;
+ afbScanlineInc(addrl, nlwidth);
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbplygblt.c b/xc/programs/Xserver/afb/afbplygblt.c
new file mode 100644
index 000000000..b6281cb3b
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbplygblt.c
@@ -0,0 +1,461 @@
+/* $XFree86: xc/programs/Xserver/afb/afbplygblt.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbimggblt.c,v 5.17 94/04/17 20:28:25 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "maskbits.h"
+
+/*
+ this works for fonts with glyphs <= 32 bits wide.
+
+ the clipping calculations are done for worst-case fonts.
+we make no assumptions about the heights, widths, or bearings
+of the glyphs. if we knew that the glyphs are all the same height,
+we could clip the tops and bottoms per clipping box, rather
+than per character per clipping box. if we knew that the glyphs'
+left and right bearings were wlle-behaved, we could clip a single
+character at the start, output until the last unclipped
+character, and then clip the last one. this is all straightforward
+to determine based on max-bounds and min-bounds from the font.
+ there is some inefficiency introduced in the per-character
+clipping to make what's going on clearer.
+
+ (it is possible, for example, for a font to be defined in which the
+next-to-last character in a font would be clipped out, but the last
+one wouldn't. the code below deals with this.)
+
+*/
+
+void
+afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ ExtentInfoRec info; /* used by QueryGlyphExtents() */
+ BoxRec bbox; /* string's bounding box */
+ xRectangle backrect; /* backing rectangle to paint.
+ in the general case, NOT necessarily
+ the same as the string's bounding box
+ */
+
+ CharInfoPtr pci;
+ int xorg, yorg; /* origin of drawable in bitmap */
+ int widthDst; /* width of dst in longwords */
+
+ /* these keep track of the character origin */
+ PixelType *pdstBase;
+ /* points to longword with character origin */
+ int xchar; /* xorigin of char (mod 32) */
+
+ /* these are used for placing the glyph */
+ register int xoff; /* x offset of left edge of glyph (mod 32) */
+ register PixelType *pdst; /* pointer to current longword in dst */
+
+ register int d;
+ int depthDst;
+ int sizeDst;
+ int hSave;
+ int w; /* width of glyph in bits */
+ int h; /* height of glyph */
+ int widthGlyph; /* width of glyph, in bytes */
+ unsigned char *rrops;
+ register unsigned char *pglyph;
+ /* pointer to current row of glyph */
+ unsigned char *pglyphSave;
+
+ /* used for putting down glyph */
+ register PixelType tmpSrc;
+ /* for getting bits from glyph */
+ register PixelType startmask;
+ register PixelType endmask;
+
+ register int nFirst; /* bits of glyph in current longword */
+ PixelType *pdstSave;
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
+ pdstBase);
+
+ QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
+
+ x += xorg;
+ y += yorg;
+
+ bbox.x1 = x + info.overallLeft;
+ bbox.x2 = x + info.overallRight;
+ bbox.y1 = y - info.overallAscent;
+ bbox.y2 = y + info.overallDescent;
+
+ rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rrops;
+
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
+ case rgnOUT:
+ break;
+ case rgnIN:
+ pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
+ xchar = x & PIM;
+
+ while(nglyph--) {
+ pci = *ppci;
+ pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ hSave = pci->metrics.ascent + pci->metrics.descent;
+ widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+ /* start at top scanline of glyph */
+ pdstSave = afbScanlineDelta(pdstBase, -pci->metrics.ascent,
+ widthDst);
+
+ /* find correct word in scanline and x offset within it
+ for left edge of glyph
+ */
+ xoff = xchar + pci->metrics.leftSideBearing;
+ if (xoff > PLST) {
+ pdstSave++;
+ xoff &= PIM;
+ } else if (xoff < 0) {
+ xoff += PPW;
+ pdstSave--;
+ }
+
+ for (d = 0; d < depthDst; d++) {
+ h = hSave;
+ pdst = pdstSave;
+ pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
+ pglyph = pglyphSave;
+
+ if ((xoff + w) <= PPW) {
+ /* glyph all in one longword */
+ maskpartialbits(xoff, w, startmask);
+ switch (rrops[d]) {
+ case RROP_WHITE:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_BLACK:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ }
+ } else {
+ /* glyph crosses longword boundary */
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+ switch (rrops[d]) {
+ case RROP_WHITE:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_BLACK:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ getleftbits(pglyph, w, tmpSrc);
+ *pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ }
+ } /* glyph crosses longwords boundary */
+ } /* depth loop */
+ /* update character origin */
+ x += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST) {
+ xchar -= PPW;
+ pdstBase++;
+ } else if (xchar < 0) {
+ xchar += PPW;
+ pdstBase--;
+ }
+ ppci++;
+ } /* while nglyph-- */
+ break;
+ case rgnPART:
+ {
+ afbTEXTPOS *ppos;
+ int nbox;
+ BoxPtr pbox;
+ RegionPtr cclip;
+ int xpos; /* x position of char origin */
+ int i;
+ BoxRec clip;
+ int leftEdge, rightEdge;
+ int topEdge, bottomEdge;
+ int glyphRow; /* first row of glyph not wholly
+ clipped out */
+ int glyphCol; /* leftmost visible column of glyph */
+ int getWidth; /* bits to get from glyph */
+
+ if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS))))
+ return;
+
+ pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
+ xpos = x;
+ xchar = xpos & PIM;
+
+ for (i = 0; i < nglyph; i++) {
+ pci = ppci[i];
+
+ ppos[i].xpos = xpos;
+ ppos[i].xchar = xchar;
+ ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
+ ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
+ ppos[i].topEdge = y - pci->metrics.ascent;
+ ppos[i].bottomEdge = y + pci->metrics.descent;
+ ppos[i].pdstBase = pdstBase;
+ ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+
+ xpos += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST) {
+ xchar &= PIM;
+ pdstBase++;
+ } else if (xchar < 0) {
+ xchar += PPW;
+ pdstBase--;
+ }
+ }
+
+ cclip = pGC->pCompositeClip;
+ pbox = REGION_RECTS(cclip);
+ nbox = REGION_NUM_RECTS(cclip);
+
+ /* HACK ALERT
+ since we continue out of the loop below so often, it
+ is easier to increment pbox at the top than at the end.
+ don't try this at home.
+ */
+ pbox--;
+ while(nbox--) {
+ pbox++;
+ clip.x1 = max(bbox.x1, pbox->x1);
+ clip.y1 = max(bbox.y1, pbox->y1);
+ clip.x2 = min(bbox.x2, pbox->x2);
+ clip.y2 = min(bbox.y2, pbox->y2);
+ if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
+ continue;
+
+ for(i=0; i<nglyph; i++) {
+ pci = ppci[i];
+ xchar = ppos[i].xchar;
+
+ /* clip the left and right edges */
+ if (ppos[i].leftEdge < clip.x1)
+ leftEdge = clip.x1;
+ else
+ leftEdge = ppos[i].leftEdge;
+
+ if (ppos[i].rightEdge > clip.x2)
+ rightEdge = clip.x2;
+ else
+ rightEdge = ppos[i].rightEdge;
+
+ w = rightEdge - leftEdge;
+ if (w <= 0)
+ continue;
+
+ /* clip the top and bottom edges */
+ if (ppos[i].topEdge < clip.y1)
+ topEdge = clip.y1;
+ else
+ topEdge = ppos[i].topEdge;
+
+ if (ppos[i].bottomEdge > clip.y2)
+ bottomEdge = clip.y2;
+ else
+ bottomEdge = ppos[i].bottomEdge;
+
+ hSave = bottomEdge - topEdge;
+ if (hSave <= 0)
+ continue;
+
+ glyphRow = (topEdge - y) + pci->metrics.ascent;
+ widthGlyph = ppos[i].widthGlyph;
+ pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
+ pglyphSave += (glyphRow * widthGlyph);
+
+ glyphCol = (leftEdge - ppos[i].xpos) -
+ (pci->metrics.leftSideBearing);
+ getWidth = w + glyphCol;
+
+ pdstSave = afbScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
+ widthDst);
+ xoff = xchar + (leftEdge - ppos[i].xpos);
+ if (xoff > PLST) {
+ xoff &= PIM;
+ pdstSave++;
+ } else if (xoff < 0) {
+ xoff += PPW;
+ pdstSave--;
+ }
+
+ for (d = 0; d < depthDst; d++) {
+ h = hSave;
+ pdst = pdstSave;
+ pdstSave += sizeDst; /* @@@ NEXT PLANE @@@ */
+ pglyph = pglyphSave;
+
+ if ((xoff + w) <= PPW) {
+ maskpartialbits(xoff, w, startmask);
+ switch (rrops[d]) {
+ case RROP_WHITE:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_BLACK:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ }
+ } else {
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+ switch (rrops[d]) {
+ case RROP_WHITE:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_BLACK:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ *pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
+ *(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
+ pglyph += widthGlyph;
+ afbScanlineInc(pdst, widthDst);
+ }
+ break;
+ }
+ }
+ } /* depth */
+ } /* for each glyph */
+ } /* while nbox-- */
+ DEALLOCATE_LOCAL(ppos);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbpntarea.c b/xc/programs/Xserver/afb/afbpntarea.c
new file mode 100644
index 000000000..87a6e6229
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbpntarea.c
@@ -0,0 +1,654 @@
+/* $XFree86: xc/programs/Xserver/afb/afbpntarea.c,v 3.0 1996/08/18 01:45:49 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbpntarea.c,v 5.7 94/04/17 20:28:29 dpw Exp $ */
+
+#include "X.h"
+
+#include "windowstr.h"
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+/*
+ the solid fillers are called for rectangles and window backgrounds.
+ the boxes are already translated.
+ maybe this should always take a pixmap instead of a drawable?
+
+ NOTE:
+ iy = ++iy < tileHeight ? iy : 0
+is equivalent to iy%= tileheight, and saves a division.
+*/
+
+/*ARGSUSED*/
+void
+afbSolidFillArea (pDraw, nbox, pbox, rrops)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ register unsigned char *rrops;
+{
+ int nlwidth; /* width in longwords of the drawable */
+ int w; /* width of current box */
+ register int h; /* height of current box */
+ register PixelType *p; /* pointer to bits we're writing */
+ register int nlw; /* loop version of nlwMiddle */
+ register PixelType startmask;
+ register PixelType endmask;
+ /* masks for reggedy bits at either end of line */
+ register int nlwExtra;
+ /* to get from right of box to left of next span */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ PixelType *pbits; /* pointer to start of drawable */
+ PixelType *saveP;
+ int saveH;
+ int depthDst;
+ int sizeDst;
+ register int d;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pbits);
+
+ while (nbox--) {
+ w = pbox->x2 - pbox->x1;
+ saveH = pbox->y2 - pbox->y1;
+
+ saveP = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
+
+ if ( ((pbox->x1 & PIM) + w) < PPW) {
+ for (d = 0; d < depthDst; d++) {
+ h = saveH;
+ p = saveP;
+ saveP += sizeDst; /* @@@ NEXT PLANE @@@ */
+ maskpartialbits(pbox->x1, w, startmask);
+ nlwExtra = nlwidth;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ Duff(h, *p &= ~startmask; afbScanlineInc(p, nlwExtra));
+ break;
+ case RROP_WHITE:
+ Duff(h, *p |= startmask; afbScanlineInc(p, nlwExtra));
+ break;
+ case RROP_INVERT:
+ Duff(h, *p ^= startmask; afbScanlineInc(p, nlwExtra));
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ..) */
+ } else {
+ maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
+
+ for (d = 0; d < depthDst; d++) {
+ h = saveH;
+ p = saveP;
+ saveP += sizeDst; /* @@@ NEXT PLANE @@@ */
+ nlwExtra = nlwidth - nlwMiddle;
+
+ if (startmask && endmask) {
+ nlwExtra -= 1;
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p &= ~startmask;
+ p++;
+ Duff(nlw, *p++ = 0);
+ *p &= ~endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p |= startmask;
+ p++;
+ Duff(nlw, *p++ = ~0);
+ *p |= endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p ^= startmask;
+ p++;
+ Duff(nlw, *p++ ^= ~0);
+ *p ^= endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ } else if (startmask && !endmask) {
+ nlwExtra -= 1;
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p &= ~startmask;
+ p++;
+ Duff(nlw, *p++ = 0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p |= startmask;
+ p++;
+ Duff(nlw, *p++ = ~0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ nlw = nlwMiddle;
+ *p ^= startmask;
+ p++;
+ Duff(nlw, *p++ ^= ~0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ }
+ } else if (!startmask && endmask) {
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ = 0);
+ *p &= ~endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ = ~0);
+ *p |= endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ ^= ~0);
+ *p ^= endmask;
+ afbScanlineInc(p, nlwExtra);
+ }
+ case RROP_NOP:
+ break;
+ }
+ } else { /* no ragged bits at either end */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ = 0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ = ~0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ ^= ~0);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ }
+ } /* for (d = 0 ... ) */
+ }
+ pbox++;
+ }
+}
+
+/* stipple a list of boxes -
+
+you can use the reduced rasterop for stipples. if rrop is
+black, AND the destination with (not stipple pattern). if rrop is
+white OR the destination with the stipple pattern. if rrop is invert,
+XOR the destination with the stipple pattern.
+*/
+
+/*ARGSUSED*/
+void
+afbStippleAreaPPW (pDraw, nbox, pbox, pstipple, rrops)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ PixmapPtr pstipple;
+ unsigned char *rrops;
+{
+ register PixelType *psrc;
+ /* pointer to bits in tile, if needed */
+ int tileHeight; /* height of the tile */
+ register PixelType srcpix;
+
+ int nlwidth; /* width in longwords of the drawable */
+ int w; /* width of current box */
+ register int nlw; /* loop version of nlwMiddle */
+ register PixelType *p; /* pointer to bits we're writing */
+ register int h; /* height of current box */
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ int nlwExtra; /* to get from right of box to left of next span */
+ int sizeDst;
+ int depthDst;
+ int d;
+ int saveIy;
+ register int iy; /* index of current scanline in tile */
+ PixelType *pbits; /* pointer to start of drawable */
+ PixelType *pBase;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ tileHeight = pstipple->drawable.height;
+ psrc = (PixelType *)(pstipple->devPrivate.ptr);
+
+ while (nbox--) {
+ w = pbox->x2 - pbox->x1;
+ saveIy = pbox->y1 % tileHeight;
+ pbits = pBase;
+
+ if ( ((pbox->x1 & PIM) + w) < PPW) {
+ maskpartialbits(pbox->x1, w, startmask);
+ nlwExtra = nlwidth;
+ for (d = 0; d < depthDst; d++) {
+ p = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
+ pbits += sizeDst; /* @@@ NEXT PLANE @@@ */
+ iy = saveIy;
+ h = pbox->y2 - pbox->y1;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ *p &= ~(srcpix & startmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ *p |= (srcpix & startmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ *p ^= (srcpix & startmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+
+ } else {
+ maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
+
+ for (d = 0; d < depthDst; d++) {
+ nlwExtra = nlwidth - nlwMiddle;
+ p = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
+ pbits += sizeDst; /* @@@ NEXT PLANE @@@ */
+ iy = saveIy;
+ h = pbox->y2 - pbox->y1;
+
+ if (startmask && endmask) {
+ nlwExtra -= 1;
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p &= ~(srcpix & startmask);
+ p++;
+ Duff (nlw, *p++ &= ~srcpix);
+ *p &= ~(srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p |= (srcpix & startmask);
+ p++;
+ Duff (nlw, *p++ |= srcpix);
+ *p |= (srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p ^= (srcpix & startmask);
+ p++;
+ Duff (nlw, *p++ ^= srcpix);
+ *p ^= (srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } else if (startmask && !endmask) {
+ nlwExtra -= 1;
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p &= ~(srcpix & startmask);
+ p++;
+ Duff(nlw, *p++ &= ~srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p |= (srcpix & startmask);
+ p++;
+ Duff(nlw, *p++ |= srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ *p ^= (srcpix & startmask);
+ p++;
+ Duff(nlw, *p++ ^= srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } else if (!startmask && endmask) {
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ &= ~srcpix);
+ *p &= ~(srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ |= srcpix);
+ *p |= (srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ ^= srcpix);
+ *p ^= (srcpix & endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } else { /* no ragged bits at either end */
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ &= ~srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_WHITE:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ |= srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ case RROP_INVERT:
+ while (h--) {
+ srcpix = psrc[iy];
+ iy = ++iy < tileHeight ? iy : 0;
+ nlw = nlwMiddle;
+ Duff(nlw, *p++ ^= srcpix);
+ afbScanlineInc(p, nlwExtra);
+ }
+ break;
+ } /* switch */
+ }
+ } /* for (d = ...) */
+ }
+ pbox++;
+ }
+}
+
+void
+afbStippleArea (pDraw, nbox, pbox, pTile, xOff, yOff, rrops)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ PixmapPtr pTile;
+ int xOff;
+ int yOff;
+ unsigned char *rrops;
+{
+ register PixelType *psrc; /* pointer to bits in tile, if needed */
+ int nlwidth; /* width in longwords of the drawable */
+ register int h; /* height of current box */
+ register PixelType *pdst; /* pointer to bits we're writing */
+ int sizeDst;
+ int depthDst;
+ int sizeTile;
+ int tileLine;
+ int iline;
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ int tlwidth, rem, tileWidth, tileHeight, endinc;
+ int saveW;
+ register int rop;
+ PixelType *psrcT;
+ int d;
+ int nstart;
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlMiddle; /* number of longwords between sides of boxes */
+ int iy;
+ PixelType *pBase; /* pointer to start of drawable */
+ PixelType *saveP;
+ PixelType *pStartDst;
+ PixelType *pStartTile;
+ int saveH;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ tileHeight = pTile->drawable.height;
+ tileWidth = pTile->drawable.width;
+ tlwidth = pTile->devKind / sizeof (PixelType);
+
+ xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
+ ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
+
+ while (nbox--) {
+ saveW = pbox->x2 - pbox->x1;
+ iline = (pbox->y1 - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr;
+ tileLine = iline * tlwidth;
+ saveH = pbox->y2 - pbox->y1;
+ saveP = afbScanline(pBase, pbox->x1, pbox->y1, nlwidth);
+
+ for (d = 0; d < depthDst; d++, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ h = saveH;
+ pStartDst = saveP;
+ pStartTile = psrcT + tileLine;
+ iy = iline;
+
+ while (h--) {
+ x = pbox->x1;
+ width = saveW;
+ pdst = pStartDst;
+ rop = rrops[d];
+
+ while(width > 0) {
+ psrc = pStartTile;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+ getandputrrop((psrc + endinc), (rem & PIM), (x & PIM),
+ w, pdst, rop)
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ putbitsrrop(*psrc, x & PIM, w, pdst, rop);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ getandputrrop0(psrc, nstart, PPW, pdst, rop);
+ pdst++;
+ psrc++;
+ }
+
+ if(endmask) {
+ getandputrrop0(psrc, nstart, nend, pdst, rop);
+ }
+ }
+ x += w;
+ width -= w;
+ } /* while (width > 0) */
+
+ pStartDst += nlwidth;
+ if (++iy >= tileHeight) {
+ iy = 0;
+ pStartTile = psrcT;
+ } else
+ pStartTile += tlwidth;
+
+ } /* while (h) */
+ } /* for (d = ... ) */
+ pbox++;
+ } /* for each box */
+}
diff --git a/xc/programs/Xserver/afb/afbpntwin.c b/xc/programs/Xserver/afb/afbpntwin.c
new file mode 100644
index 000000000..17d924059
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbpntwin.c
@@ -0,0 +1,124 @@
+/* $XFree86: xc/programs/Xserver/afb/afbpntwin.c,v 3.0 1996/08/18 01:45:50 dawes Exp $ */
+/* $XConsortium: afbpntwin.c,v 5.12 94/04/17 20:28:30 dpw Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+
+#include "windowstr.h"
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+#include "mi.h"
+
+void
+afbPaintWindow(pWin, pRegion, what)
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ int what;
+{
+ register afbPrivWin *pPrivWin;
+ unsigned char rrops[AFB_MAX_DEPTH];
+
+ pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
+
+ switch (what) {
+ case PW_BACKGROUND:
+ switch (pWin->backgroundState) {
+ case None:
+ return;
+ case ParentRelative:
+ do {
+ pWin = pWin->parent;
+ } while (pWin->backgroundState == ParentRelative);
+ (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
+ what);
+ return;
+ case BackgroundPixmap:
+ if (pPrivWin->fastBackground) {
+ afbTileAreaPPWCopy((DrawablePtr)pWin,
+ REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion), GXcopy,
+ pPrivWin->pRotatedBackground, ~0);
+ return;
+ } else {
+ afbTileAreaCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion), GXcopy,
+ pWin->background.pixmap, 0, 0, ~0);
+ return;
+ }
+ break;
+ case BackgroundPixel:
+ afbReduceRop(GXcopy, pWin->background.pixel, ~0,
+ pWin->drawable.depth, rrops);
+ afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion), rrops);
+ return;
+ }
+ break;
+ case PW_BORDER:
+ if (pWin->borderIsPixel) {
+ afbReduceRop(GXcopy, pWin->border.pixel, ~0, pWin->drawable.depth,
+ rrops);
+ afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion), rrops);
+ return;
+ } else if (pPrivWin->fastBorder) {
+ afbTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion), GXcopy,
+ pPrivWin->pRotatedBorder, ~0);
+ return;
+ }
+ break;
+ }
+ miPaintWindow(pWin, pRegion, what);
+}
diff --git a/xc/programs/Xserver/afb/afbpolypnt.c b/xc/programs/Xserver/afb/afbpolypnt.c
new file mode 100644
index 000000000..da9f13d82
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbpolypnt.c
@@ -0,0 +1,145 @@
+/* $XFree86: xc/programs/Xserver/afb/afbpolypnt.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbpolypnt.c,v 5.6 94/04/17 20:28:30 dpw Exp $ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "miscstruct.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+void
+afbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
+ register DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt;
+ xPoint *pptInit;
+{
+
+ register BoxPtr pbox;
+ register int nbox;
+ register int d;
+
+ register PixelType *addrl;
+ PixelType *pBase;
+ PixelType *pBaseSave;
+ int nlwidth;
+ int sizeDst;
+ int depthDst;
+
+ int nptTmp;
+ register xPoint *ppt;
+
+ register int x;
+ register int y;
+ register unsigned char *rrops;
+ afbPrivGC *pGCPriv;
+
+ pGCPriv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
+ pBaseSave);
+
+ rrops = pGCPriv->rrops;
+ if ((mode == CoordModePrevious) && (npt > 1))
+ for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++) {
+ ppt->x += (ppt-1)->x;
+ ppt->y += (ppt-1)->y;
+ }
+
+ nbox = REGION_NUM_RECTS(pGC->pCompositeClip);
+ pbox = REGION_RECTS(pGC->pCompositeClip);
+ for (; --nbox >= 0; pbox++)
+ for (d = 0, pBase = pBaseSave; d < depthDst; d++, pBase += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ addrl = pBase;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
+ x = ppt->x + pDrawable->x;
+ y = ppt->y + pDrawable->y;
+ if ((x >= pbox->x1) && (x < pbox->x2) &&
+ (y >= pbox->y1) && (y < pbox->y2))
+ *afbScanline(addrl, x, y, nlwidth) &= rmask[x & PIM];
+ }
+ break;
+
+ case RROP_WHITE:
+ for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
+ x = ppt->x + pDrawable->x;
+ y = ppt->y + pDrawable->y;
+ if ((x >= pbox->x1) && (x < pbox->x2) &&
+ (y >= pbox->y1) && (y < pbox->y2))
+ *afbScanline(addrl, x, y, nlwidth) |= mask[x & PIM];
+ }
+ break;
+
+ case RROP_INVERT:
+ for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
+ x = ppt->x + pDrawable->x;
+ y = ppt->y + pDrawable->y;
+ if ((x >= pbox->x1) && (x < pbox->x2) &&
+ (y >= pbox->y1) && (y < pbox->y2))
+ *afbScanline(addrl, x, y, nlwidth) ^= mask[x & PIM];
+ }
+ break;
+
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+}
diff --git a/xc/programs/Xserver/afb/afbpushpxl.c b/xc/programs/Xserver/afb/afbpushpxl.c
new file mode 100644
index 000000000..688aec973
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbpushpxl.c
@@ -0,0 +1,256 @@
+/* $XFree86: xc/programs/Xserver/afb/afbpushpxl.c,v 3.1 1998/03/20 21:04:56 hohndel Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbpushpxl.c,v 5.6 94/04/17 20:28:31 dpw Exp $ */
+
+#include "X.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miscstruct.h"
+#include "maskbits.h"
+#include "regionstr.h"
+#include "afb.h"
+
+/* afbSolidPP is courtesy of xhacks@csri.toronto.edu
+
+ For fillStyle==FillSolid, a monochrome PushPixels can be reduced to
+ a ROP in the following way: (Note that the ROP is the same as the
+ result of ROP(src=0x3,dst=0x5))
+
+ src=0011 0000 0011
+ dst=0101 0101 0101
+ rop fg=0 fg=1
+ GXclear 0x0 0000 0100 0100 0
+ GXand 0x1 0001 0100 0101 s&d
+ GXandReverse 0x2 0010 0100 0110 s&~d
+ GXcopy 0x3 0011 0100 0111 s
+ GXandInverted 0x4 0100 0101 0100 ~s&d
+ GXnoop 0x5 0101 0101 0101 d
+ GXxor 0x6 0110 0101 0110 s^d
+ GXor 0x7 0111 0101 0111 s|d
+ GXnor 0x8 1000 0110 0100 ~s&~d
+ GXequiv 0x9 1001 0110 0101 ~s^d
+ GXinvert 0xa 1010 0110 0110 ~d
+ GXorReverse 0xb 1011 0110 0111 s|~d
+ GXcopyInverted 0xc 1100 0111 0100 ~s
+ GXorInverted 0xd 1101 0111 0101 ~s|d
+ GXnand 0xe 1110 0111 0110 ~s|~d
+ GXset 0xf 1111 0111 0111 1
+
+For src=0: newRop = 0x4|(rop>>2)
+For src=1: newRop = 0x4|(rop&3)
+*/
+
+/* afbSolidPP -- squeegees the forground color of pGC through pBitMap
+ * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
+ * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
+ * is set in the bitmap, the fill style is put onto the drawable using
+ * the GC's logical function. The drawable is not changed where the bitmap
+ * has a zero bit or outside the area covered by the stencil.
+ */
+void
+afbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
+ GCPtr pGC;
+ PixmapPtr pBitMap;
+ DrawablePtr pDrawable;
+ int dx, dy, xOrg, yOrg;
+{
+ unsigned char alu;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc;
+ BoxRec srcBox;
+ register DDXPointPtr ppt;
+ register BoxPtr pbox;
+ int i;
+
+ if (!pGC->planemask & 1) return;
+
+ /* compute the reduced rop function */
+ alu = pGC->alu;
+ if (!(pGC->fgPixel&1)) alu >>= 2;
+ alu = (alu & 0x3) | 0x4;
+ if (alu == GXnoop) return;
+
+ srcBox.x1 = xOrg;
+ srcBox.y1 = yOrg;
+ srcBox.x2 = xOrg + dx;
+ srcBox.y2 = yOrg + dy;
+ REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1);
+
+ /* clip the shape of the dst to the destination composite clip */
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
+
+ if (!REGION_NIL(&rgnDst)) {
+ i = REGION_NUM_RECTS(&rgnDst);
+ pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
+ if(pptSrc) {
+ for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc; --i >= 0;
+ pbox++, ppt++) {
+ ppt->x = pbox->x1 - xOrg;
+ ppt->y = pbox->y1 - yOrg;
+ }
+ afbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc,
+ pGC->planemask);
+ DEALLOCATE_LOCAL(pptSrc);
+ }
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+}
+
+#define NPT 128
+
+/* afbPushPixels -- squeegees the forground color of pGC through pBitMap
+ * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
+ * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
+ * is set in the bitmap, the fill style is put onto the drawable using
+ * the GC's logical function. The drawable is not changed where the bitmap
+ * has a zero bit or outside the area covered by the stencil.
+ */
+void
+afbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
+ GCPtr pGC;
+ PixmapPtr pBitMap;
+ DrawablePtr pDrawable;
+ int dx, dy, xOrg, yOrg;
+{
+ int h, dxDivPPW, ibEnd;
+ PixelType *pwLineStart;
+ register PixelType *pw, *pwEnd;
+ register PixelType mask;
+ register int ib;
+ register PixelType w;
+ register int ipt; /* index into above arrays */
+ Bool fInBox;
+ DDXPointRec pt[NPT];
+ int width[NPT];
+
+ /* Now scan convert the pixmap and use the result to call fillspans in
+ * in the drawable with the original GC */
+ ipt = 0;
+ dxDivPPW = dx/PPW;
+ for (h = 0; h < dy; h++) {
+
+ pw = (PixelType *)
+ (((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind));
+ pwLineStart = pw;
+ /* Process all words which are fully in the pixmap */
+
+ fInBox = FALSE;
+ pwEnd = pwLineStart + dxDivPPW;
+ while(pw < pwEnd) {
+ w = *pw;
+ mask = endtab[1];
+ for(ib = 0; ib < PPW; ib++) {
+ if(w & mask) {
+ if(!fInBox) {
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ } else {
+ if(fInBox) {
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
+ width, TRUE);
+ ipt = 0;
+ }
+ /* end box */
+ fInBox = FALSE;
+ }
+ }
+ mask = SCRRIGHT(mask, 1);
+ }
+ pw++;
+ }
+ ibEnd = dx & PIM;
+ if(ibEnd) {
+ /* Process final partial word on line */
+ w = *pw;
+ mask = endtab[1];
+ for(ib = 0; ib < ibEnd; ib++) {
+ if(w & mask) {
+ if(!fInBox) {
+ /* start new box */
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ fInBox = TRUE;
+ }
+ } else {
+ if(fInBox) {
+ /* end box */
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
+ width, TRUE);
+ ipt = 0;
+ }
+ fInBox = FALSE;
+ }
+ }
+ mask = SCRRIGHT(mask, 1);
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if(fInBox) {
+ width[ipt] = dx + xOrg - pt[ipt].x;
+ if (++ipt >= NPT) {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ }
+ }
+ /* Flush any remaining spans */
+ if (ipt) {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbscrinit.c b/xc/programs/Xserver/afb/afbscrinit.c
new file mode 100644
index 000000000..d2b3fd02b
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbscrinit.c
@@ -0,0 +1,244 @@
+/* $XFree86: xc/programs/Xserver/afb/afbscrinit.c,v 3.5 1998/11/22 10:36:59 dawes Exp $ */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbscrinit.c,v 5.17 94/04/17 20:28:34 dpw Exp $ */
+
+#include "X.h"
+#include "Xproto.h" /* for xColorItem */
+#include "Xmd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "afb.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "migc.h"
+#include "servermd.h"
+
+#ifdef PIXMAP_PER_WINDOW
+int frameWindowPrivateIndex;
+#endif
+int afbWindowPrivateIndex;
+int afbGCPrivateIndex;
+int afbScreenPrivateIndex;
+
+static unsigned long afbGeneration = 0;
+
+BSFuncRec afbBSFuncRec = {
+ afbSaveAreas,
+ afbRestoreAreas,
+ (BackingStoreSetClipmaskRgnProcPtr) 0,
+ (BackingStoreGetImagePixmapProcPtr) 0,
+ (BackingStoreGetSpansPixmapProcPtr) 0,
+};
+
+Bool
+afbCloseScreen(index, pScreen)
+ int index;
+ ScreenPtr pScreen;
+{
+ int d;
+ DepthPtr depths = pScreen->allowedDepths;
+
+ for (d = 0; d < pScreen->numDepths; d++)
+ xfree(depths[d].vids);
+ xfree(depths);
+ xfree(pScreen->visuals);
+ xfree(pScreen->devPrivates[afbScreenPrivateIndex].ptr);
+ return(TRUE);
+}
+
+Bool
+afbCreateScreenResources(pScreen)
+ ScreenPtr pScreen;
+{
+ Bool retval;
+
+ pointer oldDevPrivate = pScreen->devPrivate;
+
+ pScreen->devPrivate = pScreen->devPrivates[afbScreenPrivateIndex].ptr;
+ retval = miCreateScreenResources(pScreen);
+
+ /* Modify screen's pixmap devKind value stored off devPrivate to
+ * be the width of a single plane in longs rather than the width
+ * of a chunky screen in longs as incorrectly setup by the mi routine.
+ */
+ ((PixmapPtr)pScreen->devPrivate)->devKind = BitmapBytePad(pScreen->width);
+ pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ return(retval);
+}
+
+Bool
+afbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
+ ScreenPtr pScreen;
+ int *pWinIndex, *pGCIndex;
+{
+ if (afbGeneration != serverGeneration) {
+#ifdef PIXMAP_PER_WINDOW
+ frameWindowPrivateIndex = AllocateWindowPrivateIndex();
+#endif
+ afbWindowPrivateIndex = AllocateWindowPrivateIndex();
+ afbGCPrivateIndex = AllocateGCPrivateIndex();
+ afbGeneration = serverGeneration;
+ }
+ if (pWinIndex)
+ *pWinIndex = afbWindowPrivateIndex;
+ if (pGCIndex)
+ *pGCIndex = afbGCPrivateIndex;
+
+ afbScreenPrivateIndex = AllocateScreenPrivateIndex();
+ pScreen->GetWindowPixmap = afbGetWindowPixmap;
+ pScreen->SetWindowPixmap = afbSetWindowPixmap;
+ return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) &&
+ AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC)));
+}
+
+/* dts * (inch/dot) * (25.4 mm / inch) = mm */
+Bool
+afbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+ pointer oldDevPrivate;
+
+ rootdepth = 0;
+ if (!afbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual, 256, 8)) {
+ ErrorF("afbInitVisuals: FALSE\n");
+ return FALSE;
+ }
+ if (!afbAllocatePrivates(pScreen,(int *)NULL, (int *)NULL)) {
+ ErrorF("afbAllocatePrivates: FALSE\n");
+ return FALSE;
+ }
+
+ pScreen->defColormap = (Colormap)FakeClientID(0);
+ /* whitePixel, blackPixel */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 0;
+ pScreen->QueryBestSize = afbQueryBestSize;
+ /* SaveScreen */
+ pScreen->GetImage = afbGetImage;
+ pScreen->GetSpans = afbGetSpans;
+ pScreen->CreateWindow = afbCreateWindow;
+ pScreen->DestroyWindow = afbDestroyWindow;
+ pScreen->PositionWindow = afbPositionWindow;
+ pScreen->ChangeWindowAttributes = afbChangeWindowAttributes;
+ pScreen->RealizeWindow = afbMapWindow;
+ pScreen->UnrealizeWindow = afbUnmapWindow;
+ pScreen->PaintWindowBackground = afbPaintWindow;
+ pScreen->PaintWindowBorder = afbPaintWindow;
+ pScreen->CopyWindow = afbCopyWindow;
+ pScreen->CreatePixmap = afbCreatePixmap;
+ pScreen->DestroyPixmap = afbDestroyPixmap;
+ pScreen->RealizeFont = afbRealizeFont;
+ pScreen->UnrealizeFont = afbUnrealizeFont;
+ pScreen->CreateGC = afbCreateGC;
+ pScreen->CreateColormap = afbInitializeColormap;
+ pScreen->DestroyColormap = (void (*)())NoopDDA;
+ pScreen->InstallColormap = afbInstallColormap;
+ pScreen->UninstallColormap = afbUninstallColormap;
+ pScreen->ListInstalledColormaps = afbListInstalledColormaps;
+ pScreen->StoreColors = (void (*)())NoopDDA;
+ pScreen->ResolveColor = afbResolveColor;
+ pScreen->BitmapToRegion = afbPixmapToRegion;
+ oldDevPrivate = pScreen->devPrivate;
+ if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth,
+ ndepths, depths, defaultVisual, nvisuals, visuals)) {
+ ErrorF("miScreenInit: FALSE\n");
+ return FALSE;
+ }
+
+ pScreen->CloseScreen = afbCloseScreen;
+ pScreen->CreateScreenResources = afbCreateScreenResources;
+ pScreen->BackingStoreFuncs = afbBSFuncRec;
+
+ pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+
+ return TRUE;
+}
+
+PixmapPtr
+afbGetWindowPixmap(pWin)
+ WindowPtr pWin;
+{
+#ifdef PIXMAP_PER_WINDOW
+ return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
+#else
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return (* pScreen->GetScreenPixmap)(pScreen);
+#endif
+}
+
+void
+afbSetWindowPixmap(pWin, pPix)
+ WindowPtr pWin;
+ PixmapPtr pPix;
+{
+#ifdef PIXMAP_PER_WINDOW
+ pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
+#else
+ (* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
+#endif
+}
diff --git a/xc/programs/Xserver/afb/afbsetsp.c b/xc/programs/Xserver/afb/afbsetsp.c
new file mode 100644
index 000000000..8f6a69125
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbsetsp.c
@@ -0,0 +1,264 @@
+/* $XFree86: xc/programs/Xserver/afb/afbsetsp.c,v 3.1 1998/03/20 21:04:57 hohndel Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbsetsp.c,v 5.8 94/04/17 20:28:34 dpw Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+
+#include "misc.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+#include "servermd.h"
+
+
+/* afbSetScanline -- copies the bits from psrc to the drawable starting at
+ * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
+ * starts on the scanline. (I.e., if this scanline passes through multiple
+ * boxes, we may not want to start grabbing bits at psrc but at some offset
+ * further on.)
+ */
+afbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst,
+ sizeDst, depthDst, sizeSrc)
+ int y;
+ int xOrigin; /* where this scanline starts */
+ int xStart; /* first bit to use from scanline */
+ int xEnd; /* last bit to use from scanline + 1 */
+ register PixelType *psrc;
+ register int alu; /* raster op */
+ PixelType *pdstBase; /* start of the drawable */
+ int widthDst; /* width of drawable in words */
+ int sizeDst;
+ int depthDst;
+ int sizeSrc;
+{
+ int w; /* width of scanline in bits */
+ register PixelType *pdst; /* where to put the bits */
+ register PixelType tmpSrc; /* scratch buffer to collect bits in */
+ int dstBit; /* offset in bits from beginning of
+ * word */
+ register int nstart; /* number of bits from first partial */
+ register int nend; /* " " last partial word */
+ int offSrc;
+ PixelType startmask, endmask;
+ PixelType *savePsrc = psrc + ((xStart - xOrigin) >> PWSH);
+ int nlMiddle, nl;
+ int d;
+
+ for (d = 0; d < depthDst; d++) {
+ pdst = afbScanline(pdstBase, xStart, y, widthDst) + sizeDst * d; /* @@@ NEXT PLANE @@@ */
+ psrc = savePsrc + sizeSrc * d; /* @@@ NEXT PLANE @@@ */
+ offSrc = (xStart - xOrigin) & PIM;
+ w = xEnd - xStart;
+ dstBit = xStart & PIM;
+
+ if (dstBit + w <= PPW) {
+ getandputrop(psrc, offSrc, dstBit, w, pdst, alu)
+ } else {
+ maskbits(xStart, w, startmask, endmask, nlMiddle);
+ if (startmask)
+ nstart = PPW - dstBit;
+ else
+ nstart = 0;
+ if (endmask)
+ nend = xEnd & PIM;
+ else
+ nend = 0;
+ if (startmask) {
+ getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu)
+ pdst++;
+ offSrc += nstart;
+ if (offSrc > PLST) {
+ psrc++;
+ offSrc -= PPW;
+ }
+ }
+ nl = nlMiddle;
+ while (nl--) {
+ getbits(psrc, offSrc, PPW, tmpSrc);
+ DoRop(*pdst, alu, tmpSrc, *pdst);
+ pdst++;
+ psrc++;
+ }
+ if (endmask) {
+ getandputrop0(psrc, offSrc, nend, pdst, alu);
+ }
+ }
+ }
+}
+
+
+
+/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
+ * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
+ * are in increasing Y order.
+ * Source bit lines are server scanline padded so that they always begin
+ * on a word boundary.
+ */
+void
+afbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ char *pcharsrc;
+ register DDXPointPtr ppt;
+ int *pwidth;
+ int nspans;
+ int fSorted;
+{
+ PixelType *psrc = (PixelType *)pcharsrc;
+ PixelType *pdstBase; /* start of dst bitmap */
+ int widthDst; /* width of bitmap in words */
+ int sizeDst;
+ int depthDst;
+ int sizeSrc;
+ register BoxPtr pbox, pboxLast, pboxTest;
+ register DDXPointPtr pptLast;
+ int alu;
+ RegionPtr prgnDst;
+ int xStart, xEnd;
+ int yMax;
+
+ alu = pGC->alu;
+ prgnDst = pGC->pCompositeClip;
+
+ pptLast = ppt + nspans;
+
+ yMax = pDrawable->y + (int) pDrawable->height;
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
+ pdstBase);
+
+ pbox = REGION_RECTS(prgnDst);
+ pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
+
+ if(fSorted) {
+ /* scan lines sorted in ascending order. Because they are sorted, we
+ * don't have to check each scanline against each clip box. We can be
+ * sure that this scanline only has to be clipped to boxes at or after the
+ * beginning of this y-band
+ */
+ pboxTest = pbox;
+ while(ppt < pptLast) {
+ pbox = pboxTest;
+ if(ppt->y >= yMax)
+ break;
+ while(pbox < pboxLast) {
+ if(pbox->y1 > ppt->y) {
+ /* scanline is before clip box */
+ break;
+ } else if(pbox->y2 <= ppt->y) {
+ /* clip box is before scanline */
+ pboxTest = ++pbox;
+ continue;
+ } else if(pbox->x1 > ppt->x + *pwidth) {
+ /* clip box is to right of scanline */
+ break;
+ } else if(pbox->x2 <= ppt->x) {
+ /* scanline is to right of clip box */
+ pbox++;
+ continue;
+ }
+
+ /* at least some of the scanline is in the current clip box */
+ xStart = max(pbox->x1, ppt->x);
+ xEnd = min(ppt->x + *pwidth, pbox->x2);
+ sizeSrc = PixmapWidthInPadUnits(*pwidth, 1);
+ afbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, pdstBase,
+ widthDst, sizeDst, depthDst, sizeSrc);
+ if(ppt->x + *pwidth <= pbox->x2) {
+ /* End of the line, as it were */
+ break;
+ } else
+ pbox++;
+ }
+ /* We've tried this line against every box; it must be outside them
+ * all. move on to the next point */
+ ppt++;
+ psrc += sizeSrc * depthDst;
+ pwidth++;
+ }
+ } else {
+ /* scan lines not sorted. We must clip each line against all the boxes */
+ while(ppt < pptLast) {
+ if(ppt->y >= 0 && ppt->y < yMax) {
+ for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) {
+ if(pbox->y1 > ppt->y) {
+ /* rest of clip region is above this scanline,
+ * skip it */
+ break;
+ }
+ if(pbox->y2 <= ppt->y) {
+ /* clip box is below scanline */
+ pbox++;
+ break;
+ }
+ if(pbox->x1 <= ppt->x + *pwidth &&
+ pbox->x2 > ppt->x) {
+ xStart = max(pbox->x1, ppt->x);
+ xEnd = min(pbox->x2, ppt->x + *pwidth);
+ sizeSrc = PixmapWidthInPadUnits(*pwidth, 1);
+ afbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
+ pdstBase, widthDst, sizeDst, depthDst,
+ sizeSrc);
+ }
+
+ }
+ }
+ psrc += sizeSrc * depthDst;
+ ppt++;
+ pwidth++;
+ }
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbtegblt.c b/xc/programs/Xserver/afb/afbtegblt.c
new file mode 100644
index 000000000..f785fa334
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbtegblt.c
@@ -0,0 +1,592 @@
+/* $XFree86: xc/programs/Xserver/afb/afbtegblt.c,v 3.1 1998/03/20 21:04:57 hohndel Exp $ */
+/* $XConsortium: afbtegblt.c,v 5.14 94/04/17 20:28:35 dpw Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "afb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "maskbits.h"
+
+/*
+ this works for fonts with glyphs <= PPW bits wide.
+
+ This should be called only with a terminal-emulator font;
+this means that the FIXED_METRICS flag is set, and that
+glyphbounds == charbounds.
+
+ in theory, this goes faster; even if it doesn't, it reduces the
+flicker caused by writing a string over itself with image text (since
+the background gets repainted per character instead of per string.)
+this seems to be important for some converted X10 applications.
+
+ Image text looks at the bits in the glyph and the fg and bg in the
+GC. it paints a rectangle, as defined in the protocol dcoument,
+and the paints the characters.
+
+*/
+
+#if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS)
+#define FASTCHARS
+#endif
+
+/*
+ * this macro "knows" that only characters <= 8 bits wide will
+ * fit this case (which is why it is independent of GLYPHPADBYTES)
+ */
+
+#if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4)
+#if GLYPHPADBYTES == 1
+#define ShiftAmnt 24
+#else
+#define ShiftAmnt 16
+#endif
+
+/*
+ * Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its
+ * first argument more than once. Thus the imbedded char++ have to be moved.
+ * (DHD)
+ */
+#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
+#if PPW == 32
+#define GetBits4 c = (*char1++ << ShiftAmnt) | \
+ SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
+ SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
+ SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
+#else /* PPW */
+#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
+ (SCRRIGHT (*char2++ << ShiftAmnt, xoff2) << 32 ) | \
+ (SCRRIGHT (*char3++ << ShiftAmnt, xoff3) << 32 ) | \
+ (SCRRIGHT (*char4++ << ShiftAmnt, xoff4) << 32 ) | \
+ (*char5++ << ShiftAmnt) | \
+ SCRRIGHT (*char6++ << ShiftAmnt, xoff6) | \
+ SCRRIGHT (*char7++ << ShiftAmnt, xoff7) | \
+ SCRRIGHT (*char8++ << ShiftAmnt, xoff8);
+#endif /* PPW */
+#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
+#if PPW == 32
+#define GetBits4 c = (*char1++ << ShiftAmnt) | \
+ SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
+ SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
+ SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
+ char2++; char3++; char4++;
+#else /* PPW == 64 */
+#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
+ (SCRRIGHT (*char2 << ShiftAmnt, xoff2) << 32 ) | \
+ (SCRRIGHT (*char3 << ShiftAmnt, xoff3) << 32 ) | \
+ (SCRRIGHT (*char4 << ShiftAmnt, xoff4) << 32 ) | \
+ (*char5++ << ShiftAmnt) | \
+ SCRRIGHT (*char6 << ShiftAmnt, xoff6) | \
+ SCRRIGHT (*char7 << ShiftAmnt, xoff7) | \
+ SCRRIGHT (*char8 << ShiftAmnt, xoff8); \
+ char2++; char3++; char4++; char6++; char7++; char8++;
+#endif /* PPW */
+#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
+
+#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
+
+#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
+#if PPW == 32
+#define GetBits4 c = *char1++ | \
+ SCRRIGHT (*char2++, xoff2) | \
+ SCRRIGHT (*char3++, xoff3) | \
+ SCRRIGHT (*char4++, xoff4);
+#else /* PPW == 64 */
+#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
+ (SCRRIGHT (*char2++, xoff2) << 64 ) | \
+ (SCRRIGHT (*char3++, xoff3) << 64 ) | \
+ (SCRRIGHT (*char4++, xoff4) << 64 ) | \
+ SCRRIGHT (*char5++, xoff5) | \
+ SCRRIGHT (*char6++, xoff6) | \
+ SCRRIGHT (*char7++, xoff7) | \
+ SCRRIGHT (*char8++, xoff8));
+#endif /* PPW */
+#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
+#if PPW == 32
+#define GetBits4 c = *char1++ | \
+ SCRRIGHT (*char2, xoff2) | \
+ SCRRIGHT (*char3, xoff3) | \
+ SCRRIGHT (*char4, xoff4); \
+ char2++; char3++; char4++;
+#else /* PPW == 64 */
+#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
+ (SCRRIGHT (*char2, xoff2) << 64 ) | \
+ (SCRRIGHT (*char3, xoff3) << 64 ) | \
+ (SCRRIGHT (*char4, xoff4) << 64 ) | \
+ SCRRIGHT (*char5, xoff5) | \
+ SCRRIGHT (*char6, xoff6) | \
+ SCRRIGHT (*char7, xoff7) | \
+ SCRRIGHT (*char8, xoff8)); \
+ char2++; char3++; char4++; \
+ char5++; char6++; char7++; char8++;
+#endif /* PPW */
+#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
+
+#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
+
+
+#if GLYPHPADBYTES == 1
+typedef unsigned char *glyphPointer;
+#define USE_LEFTBITS
+#endif
+
+#if GLYPHPADBYTES == 2
+typedef unsigned short *glyphPointer;
+#define USE_LEFTBITS
+#endif
+
+#if GLYPHPADBYTES == 4
+typedef unsigned int *glyphPointer;
+#endif
+
+#ifdef USE_LEFTBITS
+#define GetBits1 getleftbits (char1, widthGlyph, c); \
+ c &= glyphMask; \
+ char1 = (glyphPointer) (((char *) char1) + glyphBytes);
+#else
+#define GetBits1 c = *char1++;
+#endif
+
+void
+afbTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ FontPtr pfont = pGC->font;
+ int widthDst;
+ PixelType *pdstBase; /* pointer to longword with top row
+ of current glyph */
+
+ int h; /* height of glyph and char */
+ register int xpos; /* current x */
+ int ypos; /* current y */
+ int widthGlyph;
+
+ int hTmp; /* counter for height */
+ register PixelType startmask, endmask;
+ int nfirst; /* used if glyphs spans a longword boundary */
+ BoxRec bbox; /* for clipping */
+ int widthGlyphs;
+ int sizeDst;
+ int depthDst;
+ PixelType *saveDst;
+ register PixelType *dst;
+ register PixelType c;
+ register int d;
+ register int xoff1, xoff2, xoff3, xoff4;
+ register glyphPointer char1, char2, char3, char4;
+ glyphPointer schar1, schar2, schar3, schar4;
+#if PPW == 64
+ register int xoff5, xoff6, xoff7, xoff8;
+ register glyphPointer char5, char6, char7, char8;
+ glyphPointer schar5, schar6, schar7, schar8;
+#endif /* PPW */
+
+ unsigned char *rrops;
+#ifdef USE_LEFTBITS
+ register PixelType glyphMask;
+ register PixelType tmpSrc;
+ register int glyphBytes;
+#endif
+
+ afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
+ pdstBase);
+
+ xpos = x + pDrawable->x;
+ ypos = y + pDrawable->y;
+
+ widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
+ h = FONTASCENT(pfont) + FONTDESCENT(pfont);
+
+ xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
+ ypos -= FONTASCENT(pfont);
+
+ rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rropOS;
+
+ bbox.x1 = xpos;
+ bbox.x2 = xpos + (widthGlyph * nglyph);
+ bbox.y1 = ypos;
+ bbox.y2 = ypos + h;
+
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
+ case rgnPART:
+ /* this is the WRONG thing to do, but it works.
+ calling the non-terminal text is easy, but slow, given
+ what we know about the font.
+
+ the right thing to do is something like:
+ for each clip rectangle
+ compute at which row the glyph starts to be in it,
+ and at which row the glyph ceases to be in it
+ compute which is the first glyph inside the left
+ edge, and the last one inside the right edge
+ draw a fractional first glyph, using only
+ the rows we know are in
+ draw all the whole glyphs, using the appropriate rows
+ draw any pieces of the last glyph, using the right rows
+
+ this way, the code would take advantage of knowing that
+ all glyphs are the same height and don't overlap.
+
+ one day...
+ */
+ afbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ case rgnOUT:
+ return;
+ }
+ pdstBase = afbScanlineDeltaNoBankSwitch(pdstBase, ypos, widthDst);
+ widthGlyphs = widthGlyph * PGSZB;
+
+#ifdef USE_LEFTBITS
+ glyphMask = endtab[widthGlyph];
+ glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
+#endif
+
+ if (nglyph >= PGSZB && widthGlyphs <= PPW) {
+ while (nglyph >= PGSZB) {
+ nglyph -= PGSZB;
+ xoff1 = xpos & PIM;
+ xoff2 = widthGlyph;
+ xoff3 = xoff2 + widthGlyph;
+ xoff4 = xoff3 + widthGlyph;
+#if PPW == 64
+ xoff5 = xoff4 + widthGlyph;
+ xoff6 = xoff5 + widthGlyph;
+ xoff7 = xoff6 + widthGlyph;
+ xoff8 = xoff7 + widthGlyph;
+#endif /* PPW */
+ schar1 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar2 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar3 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar4 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+#if PPW == 64
+ schar5 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar6 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar7 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+ schar8 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
+#endif /* PPW */
+
+ hTmp = h;
+ saveDst = afbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
+
+#ifndef FASTCHARS
+ if (xoff1 + widthGlyphs <= PPW) {
+ maskpartialbits (xoff1, widthGlyphs, startmask);
+#endif
+ for (d = 0; d < depthDst; d++) {
+ hTmp = h;
+ dst = saveDst;
+ saveDst += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (hTmp--) {
+#ifdef FASTCHARS
+ FASTPUTBITS(0, xoff1, widthGlyphs, dst);
+#else
+ *(dst) &= ~startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (hTmp--) {
+#ifdef FASTCHARS
+ FASTPUTBITS(~0, xoff1, widthGlyphs, dst);
+#else
+ *(dst) |= startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ char1 = schar1;
+ char2 = schar2;
+ char3 = schar3;
+ char4 = schar4;
+ /* XXX */
+ while (hTmp--) {
+ GetBits4
+#ifdef FASTCHARS
+# if BITMAP_BIT_ORDER == MSBFirst
+ c >>= PPW - widthGlyphs;
+# endif
+ FASTPUTBITS(~c, xoff1, widthGlyphs, dst);
+#else
+ *(dst) = (*dst) & ~startmask | ~SCRRIGHT(c, xoff1) & startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_COPY:
+ char1 = schar1;
+ char2 = schar2;
+ char3 = schar3;
+ char4 = schar4;
+
+ while (hTmp--) {
+ GetBits4
+#ifdef FASTCHARS
+# if BITMAP_BIT_ORDER == MSBFirst
+ c >>= PPW - widthGlyphs;
+#endif
+ FASTPUTBITS(c, xoff1, widthGlyphs, dst);
+#else
+ *(dst) = (*dst) & ~startmask | SCRRIGHT(c, xoff1) & startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch (rrops[d]) */
+ } /* for (d = ... ) */
+#ifndef FASTCHARS
+ } else {
+ maskPPWbits (xoff1, widthGlyphs, startmask, endmask);
+ nfirst = PPW - xoff1;
+ for (d = 0; d < depthDst; d++) {
+ hTmp = h;
+ dst = saveDst;
+ saveDst += sizeDst; /* @@@ NEXT PLANE @@@ */
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (hTmp--) {
+ dst[0] &= ~startmask;
+ dst[1] &= ~endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (hTmp--) {
+ dst[0] |= startmask;
+ dst[1] |= endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ char1 = schar1;
+ char2 = schar2;
+ char3 = schar3;
+ char4 = schar4;
+
+ while (hTmp--) {
+ GetBits4
+ dst[0] = dst[0] & ~startmask |
+ ~SCRRIGHT(c,xoff1) & startmask;
+ dst[1] = dst[1] & ~endmask |
+ ~SCRLEFT(c,nfirst) & endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_COPY:
+ char1 = schar1;
+ char2 = schar2;
+ char3 = schar3;
+ char4 = schar4;
+
+ while (hTmp--) {
+ GetBits4
+ dst[0] = dst[0] & ~startmask |
+ SCRRIGHT(c,xoff1) & startmask;
+ dst[1] = dst[1] & ~endmask |
+ SCRLEFT(c,nfirst) & endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ... ) */
+ }
+#endif
+ xpos += widthGlyphs;
+ }
+ }
+
+ while(nglyph--) {
+ xoff1 = xpos & PIM;
+ schar1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
+ hTmp = h;
+ saveDst = afbScanlineOffset(pdstBase, (xpos >> PWSH));
+
+ if (xoff1 + widthGlyph <= PPW) {
+ maskpartialbits (xoff1, widthGlyph, startmask);
+
+ for (d = 0; d < depthDst; d++) {
+ hTmp = h;
+ dst = saveDst;
+ saveDst += sizeDst; /* @@@ NEXT PLANE @@@ */
+ char1 = schar1;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (hTmp--) {
+ (*dst) &= ~startmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (hTmp--) {
+ (*dst) |= startmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (hTmp--) {
+#ifdef FASTCHARS
+#ifdef USE_LEFTBITS
+ FASTGETBITS (char1,0,widthGlyph,c);
+ char1 = (glyphPointer) (((char *) char1) + glyphBytes);
+#else
+ c = *char1++;
+#if BITMAP_BIT_ORDER == MSBFirst
+ c >>= PPW - widthGlyph;
+#endif
+#endif
+ FASTPUTBITS (~c,xoff1,widthGlyph,dst);
+#else
+ GetBits1
+ (*dst) = (*dst) & ~startmask | ~SCRRIGHT(c, xoff1) & startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_COPY:
+ while (hTmp--) {
+#ifdef FASTCHARS
+#ifdef USE_LEFTBITS
+ FASTGETBITS (char1,0,widthGlyph,c);
+ char1 = (glyphPointer) (((char *) char1) + glyphBytes);
+#else
+ c = *char1++;
+#if BITMAP_BIT_ORDER == MSBFirst
+ c >>= PPW - widthGlyph;
+#endif
+#endif
+ FASTPUTBITS (c,xoff1,widthGlyph,dst);
+#else
+ GetBits1
+ (*dst) = (*dst) & ~startmask | SCRRIGHT(c, xoff1) & startmask;
+#endif
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+ } else {
+ maskPPWbits (xoff1, widthGlyph, startmask, endmask);
+ nfirst = PPW - xoff1;
+
+ for (d = 0; d < depthDst; d++) {
+ hTmp = h;
+ dst = saveDst;
+ saveDst += sizeDst; /* @@@ NEXT PLANE @@@ */
+ char1 = schar1;
+
+ switch (rrops[d]) {
+ case RROP_BLACK:
+ while (hTmp--) {
+ dst[0] &= ~startmask;
+ dst[1] &= ~endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_WHITE:
+ while (hTmp--) {
+ dst[0] |= startmask;
+ dst[1] |= endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_INVERT:
+ while (hTmp--) {
+ GetBits1
+ dst[0] = dst[0] & ~startmask |
+ ~SCRRIGHT(c,xoff1) & startmask;
+ dst[1] = dst[1] & ~endmask |
+ ~SCRLEFT(c,nfirst) & endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_COPY:
+ while (hTmp--) {
+ GetBits1
+ dst[0] = dst[0] & ~startmask |
+ SCRRIGHT(c,xoff1) & startmask;
+ dst[1] = dst[1] & ~endmask |
+ SCRLEFT(c,nfirst) & endmask;
+ afbScanlineInc(dst, widthDst);
+ }
+ break;
+ case RROP_NOP:
+ break;
+ } /* switch */
+ } /* for (d = ...) */
+ }
+
+ xpos += widthGlyph;
+ }
+}
diff --git a/xc/programs/Xserver/afb/afbtile.c b/xc/programs/Xserver/afb/afbtile.c
new file mode 100644
index 000000000..dfbdab041
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbtile.c
@@ -0,0 +1,850 @@
+/* $XFree86: xc/programs/Xserver/afb/afbtile.c,v 3.0 1996/08/18 01:45:57 dawes Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XConsortium: afbtile.c,v 5.8 94/04/17 20:28:36 dpw Exp $ */
+
+#include "X.h"
+
+#include "windowstr.h"
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "afb.h"
+#include "maskbits.h"
+
+#include "mergerop.h"
+/*
+
+ the boxes are already translated.
+
+ NOTE:
+ iy = ++iy < tileHeight ? iy : 0
+is equivalent to iy%= tileheight, and saves a division.
+*/
+
+/*
+ tile area with a PPW bit wide pixmap
+*/
+void
+MROP_NAME(afbTileAreaPPW)(pDraw, nbox, pbox, alu, ptile, planemask)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ int alu;
+ PixmapPtr ptile;
+ unsigned long planemask;
+{
+ register PixelType *psrc;
+ /* pointer to bits in tile, if needed */
+ int tileHeight; /* height of the tile */
+ register PixelType srcpix;
+ int nlwidth; /* width in longwords of the drawable */
+ int w; /* width of current box */
+ MROP_DECLARE_REG ()
+ register int h; /* height of current box */
+ register int nlw; /* loop version of nlwMiddle */
+ register PixelType *p; /* pointer to bits we're writing */
+ int sizeDst;
+ int depthDst;
+ int tlwidth;
+ register int d;
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ int nlwExtra; /* to get from right of box to left of next span */
+ register int iy; /* index of current scanline in tile */
+ PixelType *pbits; /* pointer to start of drawable */
+ PixelType *saveP;
+ PixelType *pSaveSrc;
+ int saveH;
+ int saveIY;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pbits);
+
+ MROP_INITIALIZE(alu,~0)
+
+ tileHeight = ptile->drawable.height;
+ tlwidth = ptile->devKind / sizeof (PixelType);
+ pSaveSrc = (PixelType *)(ptile->devPrivate.ptr);
+
+ while (nbox--) {
+ w = pbox->x2 - pbox->x1;
+ saveH = pbox->y2 - pbox->y1;
+ saveIY = pbox->y1 % tileHeight;
+ saveP = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
+ psrc = pSaveSrc;
+
+ if (((pbox->x1 & PIM) + w) < PPW) {
+ maskpartialbits(pbox->x1, w, startmask);
+ nlwExtra = nlwidth;
+ for (d = 0; d < depthDst; d++, saveP += sizeDst, psrc += tileHeight) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ p = saveP;
+ h = saveH;
+ iy = saveIY;
+
+ while (h--) {
+ srcpix = psrc[iy];
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ *p = MROP_MASK(srcpix,*p,startmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ }
+ } else {
+ maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
+
+ for (d = 0; d < depthDst; d++, saveP += sizeDst, psrc += tileHeight) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ p = saveP;
+ h = saveH;
+ iy = saveIY;
+ nlwExtra = nlwidth - nlwMiddle;
+
+ if (startmask && endmask) {
+ nlwExtra -= 1;
+ while (h--) {
+ srcpix = psrc[iy];
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ *p = MROP_MASK (srcpix,*p,startmask);
+ p++;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+
+ *p = MROP_MASK(srcpix,*p,endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else if (startmask && !endmask) {
+ nlwExtra -= 1;
+ while (h--) {
+ srcpix = psrc[iy];
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ *p = MROP_MASK(srcpix,*p,startmask);
+ p++;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else if (!startmask && endmask) {
+ while (h--) {
+ srcpix = psrc[iy];
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+
+ *p = MROP_MASK(srcpix,*p,endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else { /* no ragged bits at either end */
+ while (h--) {
+ srcpix = psrc[iy];
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ while (nlw--) {
+ *p = MROP_SOLID (srcpix,*p);
+ p++;
+ }
+ afbScanlineInc(p, nlwExtra);
+ }
+ }
+ } /* for (d = ...) */
+ }
+ pbox++;
+ }
+}
+
+void
+MROP_NAME(afbTileArea)(pDraw, nbox, pbox, alu, pTile, xOff, yOff, planemask)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ int alu;
+ PixmapPtr pTile;
+ int xOff;
+ int yOff;
+ unsigned long planemask;
+{
+ register PixelType *psrc;
+ /* pointer to bits in tile, if needed */
+ int nlwidth; /* width in longwords of the drawable */
+ MROP_DECLARE_REG ()
+ register int h; /* height of current box */
+ register PixelType *pdst; /* pointer to bits we're writing */
+ register PixelType tmpsrc, tmpdst;
+ int sizeDst;
+ int depthDst;
+ int sizeTile;
+ int tileLine;
+ int iline;
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ int tlwidth, rem, tileWidth, tileHeight, endinc;
+ int saveW;
+ PixelType *psrcT;
+ int d;
+ int nstart;
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlMiddle; /* number of longwords between sides of boxes */
+ int iy;
+ PixelType *pBase; /* pointer to start of drawable */
+ PixelType *saveP;
+ PixelType *pStartDst;
+ PixelType *pStartTile;
+ int saveH;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ MROP_INITIALIZE(alu,~0)
+
+ tileHeight = pTile->drawable.height;
+ tileWidth = pTile->drawable.width;
+ tlwidth = pTile->devKind / sizeof (PixelType);
+ sizeTile = tlwidth * tileHeight;
+
+ xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
+ ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
+
+ while (nbox--) {
+ saveW = pbox->x2 - pbox->x1;
+ iline = (pbox->y1 - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr;
+ tileLine = iline * tlwidth;
+ saveH = pbox->y2 - pbox->y1;
+ saveP = afbScanline(pBase, pbox->x1, pbox->y1, nlwidth);
+
+ for (d = 0; d < depthDst; d++, psrcT += sizeTile, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ h = saveH;
+ pStartDst = saveP;
+ pStartTile = psrcT + tileLine;
+ iy = iline;
+
+ while (h--) {
+ x = pbox->x1;
+ width = saveW;
+ pdst = pStartDst;
+ while(width > 0) {
+ psrc = pStartTile;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+
+ getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), w, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), w, pdst);
+
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ tmpsrc = *psrc;
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), w, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), w, pdst);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ tmpsrc = *psrc;
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), nstart, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), nstart, pdst);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ getbits (psrc, nstart, PPW, tmpsrc);
+#if (MROP) != Mcopy
+ tmpdst = *pdst;
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ *pdst++ = tmpsrc;
+ /*putbits (tmpsrc, 0, PPW, pdst);
+ pdst++;*/
+ psrc++;
+ }
+
+ if(endmask) {
+ getbits (psrc, nstart, nend, tmpsrc);
+#if (MROP) != Mcopy
+ tmpdst = *pdst;
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, 0, nend, pdst);
+ }
+ }
+ x += w;
+ width -= w;
+ } /* while (width > 0) */
+
+ pStartDst += nlwidth;
+ if (++iy >= tileHeight) {
+ iy = 0;
+ pStartTile = psrcT;
+ } else
+ pStartTile += tlwidth;
+
+ } /* while (h) */
+ } /* for (d = ... ) */
+ pbox++;
+ } /* for each box */
+}
+
+void
+MROP_NAME(afbOpaqueStippleAreaPPW)(pDraw, nbox, pbox, alu, ptile,
+ rropsOS, planemask)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ int alu;
+ PixmapPtr ptile;
+ register unsigned char *rropsOS;
+ unsigned long planemask;
+{
+ register PixelType *psrc;
+ /* pointer to bits in tile, if needed */
+ int tileHeight; /* height of the tile */
+ register PixelType srcpix;
+ int nlwidth; /* width in longwords of the drawable */
+ int w; /* width of current box */
+ MROP_DECLARE_REG ()
+ register int h; /* height of current box */
+ register int nlw; /* loop version of nlwMiddle */
+ register PixelType *p; /* pointer to bits we're writing */
+ int sizeDst;
+ int depthDst;
+ register int d;
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ int nlwExtra; /* to get from right of box to left of next span */
+ register int iy; /* index of current scanline in tile */
+ PixelType *pbits; /* pointer to start of drawable */
+ PixelType *saveP;
+ int saveH;
+ int saveIY;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pbits);
+
+ MROP_INITIALIZE(alu,~0)
+
+ tileHeight = ptile->drawable.height;
+ psrc = (PixelType *)(ptile->devPrivate.ptr);
+
+ while (nbox--) {
+ w = pbox->x2 - pbox->x1;
+ saveH = pbox->y2 - pbox->y1;
+ saveIY = pbox->y1 % tileHeight;
+ saveP = afbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
+
+ if ( ((pbox->x1 & PIM) + w) < PPW) {
+ maskpartialbits(pbox->x1, w, startmask);
+ nlwExtra = nlwidth;
+ for (d = 0; d < depthDst; d++, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ p = saveP;
+ h = saveH;
+ iy = saveIY;
+
+ while (h--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ srcpix = 0;
+ break;
+ case RROP_WHITE:
+ srcpix = ~0;
+ break;
+ case RROP_COPY:
+ srcpix = psrc[iy];
+ break;
+ case RROP_INVERT:
+ srcpix = ~psrc[iy];
+ break;
+ }
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ *p = MROP_MASK(srcpix,*p,startmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ }
+ } else {
+ maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
+
+ for (d = 0; d < depthDst; d++, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ p = saveP;
+ h = saveH;
+ iy = saveIY;
+ nlwExtra = nlwidth - nlwMiddle;
+
+ if (startmask && endmask) {
+ nlwExtra -= 1;
+ while (h--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ srcpix = 0;
+ break;
+ case RROP_WHITE:
+ srcpix = ~0;
+ break;
+ case RROP_COPY:
+ srcpix = psrc[iy];
+ break;
+ case RROP_INVERT:
+ srcpix = ~psrc[iy];
+ break;
+ }
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ *p = MROP_MASK (srcpix,*p,startmask);
+ p++;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+
+ *p = MROP_MASK(srcpix,*p,endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else if (startmask && !endmask) {
+ nlwExtra -= 1;
+ while (h--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ srcpix = 0;
+ break;
+ case RROP_WHITE:
+ srcpix = ~0;
+ break;
+ case RROP_COPY:
+ srcpix = psrc[iy];
+ break;
+ case RROP_INVERT:
+ srcpix = ~psrc[iy];
+ break;
+ }
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ *p = MROP_MASK(srcpix,*p,startmask);
+ p++;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else if (!startmask && endmask) {
+ while (h--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ srcpix = 0;
+ break;
+ case RROP_WHITE:
+ srcpix = ~0;
+ break;
+ case RROP_COPY:
+ srcpix = psrc[iy];
+ break;
+ case RROP_INVERT:
+ srcpix = ~psrc[iy];
+ break;
+ }
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ while (nlw--) {
+ *p = MROP_SOLID(srcpix,*p);
+ p++;
+ }
+
+ *p = MROP_MASK(srcpix,*p,endmask);
+ afbScanlineInc(p, nlwExtra);
+ }
+ } else { /* no ragged bits at either end */
+ while (h--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ srcpix = 0;
+ break;
+ case RROP_WHITE:
+ srcpix = ~0;
+ break;
+ case RROP_COPY:
+ srcpix = psrc[iy];
+ break;
+ case RROP_INVERT:
+ srcpix = ~psrc[iy];
+ break;
+ }
+ iy++;
+ if (iy == tileHeight)
+ iy = 0;
+ nlw = nlwMiddle;
+ while (nlw--) {
+ *p = MROP_SOLID (srcpix,*p);
+ p++;
+ }
+ afbScanlineInc(p, nlwExtra);
+ }
+ }
+ } /* for (d = ...) */
+ }
+ pbox++;
+ }
+}
+
+void
+MROP_NAME(afbOpaqueStippleArea)(pDraw, nbox, pbox, alu, pTile, xOff, yOff,
+ rropsOS, planemask)
+ DrawablePtr pDraw;
+ int nbox;
+ BoxPtr pbox;
+ int alu;
+ PixmapPtr pTile;
+ int xOff;
+ int yOff;
+ register unsigned char *rropsOS;
+ unsigned long planemask;
+{
+ register PixelType *psrc;
+ /* pointer to bits in tile, if needed */
+ int nlwidth; /* width in longwords of the drawable */
+ MROP_DECLARE_REG ()
+ register int h; /* height of current box */
+ register PixelType *pdst; /* pointer to bits we're writing */
+ register PixelType tmpsrc, tmpdst;
+ int sizeDst;
+ int depthDst;
+ int tileLine;
+ int iline;
+ int w, width, x, xSrc, ySrc, srcStartOver, nend;
+ int tlwidth, rem, tileWidth, tileHeight, endinc;
+ int saveW;
+ PixelType *psrcT;
+ int d;
+ int nstart;
+ PixelType startmask;
+ PixelType endmask; /* masks for reggedy bits at either end of line */
+ int nlMiddle; /* number of longwords between sides of boxes */
+ int iy;
+ PixelType *pBase; /* pointer to start of drawable */
+ PixelType *saveP;
+ PixelType *pStartDst;
+ PixelType *pStartTile;
+ int saveH;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ pBase);
+
+ MROP_INITIALIZE(alu,~0)
+
+ tileHeight = pTile->drawable.height;
+ tileWidth = pTile->drawable.width;
+ tlwidth = pTile->devKind / sizeof (PixelType);
+
+ xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
+ ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
+
+ while (nbox--) {
+ saveW = pbox->x2 - pbox->x1;
+ iline = (pbox->y1 - ySrc) % tileHeight;
+ psrcT = (PixelType *) pTile->devPrivate.ptr;
+ tileLine = iline * tlwidth;
+ saveH = pbox->y2 - pbox->y1;
+ saveP = afbScanline(pBase, pbox->x1, pbox->y1, nlwidth);
+
+ for (d = 0; d < depthDst; d++, saveP += sizeDst) { /* @@@ NEXT PLANE @@@ */
+ if (!(planemask & (1 << d)))
+ continue;
+
+ h = saveH;
+ pStartDst = saveP;
+ pStartTile = psrcT + tileLine;
+ iy = iline;
+
+ while (h--) {
+ x = pbox->x1;
+ width = saveW;
+ pdst = pStartDst;
+ while(width > 0) {
+ psrc = pStartTile;
+ w = min(tileWidth, width);
+ if((rem = (x - xSrc) % tileWidth) != 0) {
+ /* if we're in the middle of the tile, get
+ as many bits as will finish the span, or
+ as many as will get to the left edge of the tile,
+ or a longword worth, starting at the appropriate
+ offset in the tile.
+ */
+ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
+ endinc = rem / BITMAP_SCANLINE_PAD;
+
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+
+ case RROP_COPY:
+ getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
+ break;
+
+ case RROP_INVERT:
+ getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), w, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), w, pdst);
+
+ if((x & PIM) + w >= PPW)
+ pdst++;
+ } else if(((x & PIM) + w) < PPW) {
+ /* doing < PPW bits is easy, and worth special-casing */
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ tmpsrc = *psrc;
+ break;
+ case RROP_INVERT:
+ tmpsrc = ~*psrc;
+ break;
+ }
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), w, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), w, pdst);
+ } else {
+ /* start at the left edge of the tile,
+ and put down as much as we can
+ */
+ maskbits(x, w, startmask, endmask, nlMiddle);
+
+ if (startmask)
+ nstart = PPW - (x & PIM);
+ else
+ nstart = 0;
+ if (endmask)
+ nend = (x + w) & PIM;
+ else
+ nend = 0;
+
+ srcStartOver = nstart > PLST;
+
+ if(startmask) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ tmpsrc = *psrc;
+ break;
+ case RROP_INVERT:
+ tmpsrc = ~*psrc;
+ break;
+ }
+#if (MROP) != Mcopy
+ getbits (pdst, (x & PIM), nstart, tmpdst);
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, (x & PIM), nstart, pdst);
+ pdst++;
+ if(srcStartOver)
+ psrc++;
+ }
+
+ while(nlMiddle--) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+ case RROP_COPY:
+ getbits (psrc, nstart, PPW, tmpsrc);
+ break;
+ case RROP_INVERT:
+ getbits (psrc, nstart, PPW, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+#if (MROP) != Mcopy
+ tmpdst = *pdst;
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ *pdst++ = tmpsrc;
+ /*putbits (tmpsrc, 0, PPW, pdst);
+ pdst++; */
+ psrc++;
+ }
+
+ if(endmask) {
+ switch (rropsOS[d]) {
+ case RROP_BLACK:
+ tmpsrc = 0;
+ break;
+ case RROP_WHITE:
+ tmpsrc = ~0;
+ break;
+
+ case RROP_COPY:
+ getbits (psrc, nstart, nend, tmpsrc);
+ break;
+
+ case RROP_INVERT:
+ getbits (psrc, nstart, nend, tmpsrc);
+ tmpsrc = ~tmpsrc;
+ break;
+ }
+#if (MROP) != Mcopy
+ tmpdst = *pdst;
+ tmpsrc = DoMergeRop (tmpsrc, tmpdst);
+#endif
+ putbits (tmpsrc, 0, nend, pdst);
+ }
+ }
+ x += w;
+ width -= w;
+ } /* while (width > 0) */
+
+ pStartDst += nlwidth;
+ if (++iy >= tileHeight) {
+ iy = 0;
+ pStartTile = psrcT;
+ } else
+ pStartTile += tlwidth;
+
+ } /* while (h) */
+ } /* for (d = ... ) */
+ pbox++;
+ } /* for each box */
+}
diff --git a/xc/programs/Xserver/afb/afbwindow.c b/xc/programs/Xserver/afb/afbwindow.c
new file mode 100644
index 000000000..40597c72a
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbwindow.c
@@ -0,0 +1,316 @@
+/* $XFree86: xc/programs/Xserver/afb/afbwindow.c,v 3.0 1996/08/18 01:45:58 dawes Exp $ */
+/* $XConsortium: afbwindow.c,v 5.14 94/04/17 20:28:36 dpw Exp $ */
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "afb.h"
+#include "mistruct.h"
+#include "regionstr.h"
+#include "maskbits.h"
+
+extern WindowPtr *WindowTable;
+
+Bool
+afbCreateWindow(pWin)
+ register WindowPtr pWin;
+{
+ register afbPrivWin *pPrivWin;
+
+ pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
+ pPrivWin->pRotatedBorder = NullPixmap;
+ pPrivWin->pRotatedBackground = NullPixmap;
+ pPrivWin->fastBackground = FALSE;
+ pPrivWin->fastBorder = FALSE;
+#ifdef PIXMAP_PER_WINDOW
+ pWin->devPrivates[frameWindowPrivateIndex].ptr =
+ pWin->pDrawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr;
+#endif
+
+ return (TRUE);
+}
+
+/* This always returns true, because Xfree can't fail. It might be possible
+ * on some devices for Destroy to fail */
+Bool
+afbDestroyWindow(pWin)
+ WindowPtr pWin;
+{
+ register afbPrivWin *pPrivWin;
+
+ pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
+
+ if (pPrivWin->pRotatedBorder)
+ (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
+ if (pPrivWin->pRotatedBackground)
+ (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground);
+
+ return (TRUE);
+}
+
+/*ARGSUSED*/
+Bool
+afbMapWindow(pWindow)
+ WindowPtr pWindow;
+{
+ return (TRUE);
+}
+
+/* (x, y) is the upper left corner of the window on the screen
+ do we really need to pass this? (is it a;ready in pWin->absCorner?)
+ we only do the rotation for pixmaps that are 32 bits wide (padded
+or otherwise.)
+ afbChangeWindowAttributes() has already put a copy of the pixmap
+in pPrivWin->pRotated*
+*/
+
+/*ARGSUSED*/
+Bool
+afbPositionWindow(pWin, x, y)
+ WindowPtr pWin;
+ int x, y;
+{
+ register afbPrivWin *pPrivWin;
+ int reset = 0;
+
+ pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
+ if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) {
+ afbXRotatePixmap(pPrivWin->pRotatedBackground,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ afbYRotatePixmap(pPrivWin->pRotatedBackground,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ reset = 1;
+ }
+
+ if (!pWin->borderIsPixel && pPrivWin->fastBorder) {
+ while (pWin->backgroundState == ParentRelative)
+ pWin = pWin->parent;
+ afbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ afbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ reset = 1;
+ }
+ if (reset) {
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+
+ /* This is the "wrong" fix to the right problem, but it doesn't really
+ * cost very much. When the window is moved, we need to invalidate any
+ * RotatedPixmap that exists in any GC currently validated against this
+ * window.
+ */
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ /* Again, we have no failure modes indicated by any of the routines
+ * we've called, so we have to assume it worked */
+ return (TRUE);
+}
+
+/*ARGSUSED*/
+Bool
+afbUnmapWindow(pWindow)
+ WindowPtr pWindow;
+{
+ return (TRUE);
+}
+
+/* UNCLEAN!
+ this code calls the bitblt helper code directly.
+
+ afbCopyWindow copies only the parts of the destination that are
+visible in the source.
+*/
+
+
+void
+afbCopyWindow(pWin, ptOldOrg, prgnSrc)
+ WindowPtr pWin;
+ DDXPointRec ptOldOrg;
+ RegionPtr prgnSrc;
+{
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ RegionPtr prgnDst;
+ register BoxPtr pbox;
+ register int dx, dy;
+ register int i, nbox;
+ WindowPtr pwinRoot;
+
+ pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+
+ prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip,
+ prgnSrc);
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+ if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+ return;
+ ppt = pptSrc;
+
+ for (i=nbox; --i >= 0; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ afbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst,
+ pptSrc, ~0);
+ DEALLOCATE_LOCAL(pptSrc);
+ REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
+}
+
+
+
+/* swap in correct PaintWindow* routine. If we can use a fast output
+routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
+of it in devPrivate.
+*/
+Bool
+afbChangeWindowAttributes(pWin, mask)
+ register WindowPtr pWin;
+ register unsigned long mask;
+{
+ register unsigned long index;
+ register afbPrivWin *pPrivWin;
+ WindowPtr pBgWin;
+
+ pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
+ /*
+ * When background state changes from ParentRelative and
+ * we had previously rotated the fast border pixmap to match
+ * the parent relative origin, rerotate to match window
+ */
+ if (mask & (CWBackPixmap | CWBackPixel) &&
+ pWin->backgroundState != ParentRelative && pPrivWin->fastBorder &&
+ (pPrivWin->oldRotate.x != pWin->drawable.x ||
+ pPrivWin->oldRotate.y != pWin->drawable.y)) {
+ afbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ afbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ while(mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+ switch(index) {
+ case CWBackPixmap:
+ if (pWin->backgroundState == None)
+ pPrivWin->fastBackground = FALSE;
+ else if (pWin->backgroundState == ParentRelative) {
+ pPrivWin->fastBackground = FALSE;
+ /* Rotate border to match parent origin */
+ if (pPrivWin->pRotatedBorder) {
+ for (pBgWin = pWin->parent;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ afbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x - pPrivWin->oldRotate.x);
+ afbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.y - pPrivWin->oldRotate.y);
+ pPrivWin->oldRotate.x = pBgWin->drawable.x;
+ pPrivWin->oldRotate.y = pBgWin->drawable.y;
+ }
+ } else if ((pWin->background.pixmap->drawable.width <= PPW) &&
+ !(pWin->background.pixmap->drawable.width &
+ (pWin->background.pixmap->drawable.width - 1))) {
+ afbCopyRotatePixmap(pWin->background.pixmap,
+ &pPrivWin->pRotatedBackground,
+ pWin->drawable.x, pWin->drawable.y);
+ if (pPrivWin->pRotatedBackground) {
+ pPrivWin->fastBackground = TRUE;
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ } else
+ pPrivWin->fastBackground = FALSE;
+ } else
+ pPrivWin->fastBackground = FALSE;
+ break;
+
+ case CWBackPixel:
+ pPrivWin->fastBackground = FALSE;
+ break;
+
+ case CWBorderPixmap:
+ if ((pWin->border.pixmap->drawable.width <= PPW) &&
+ !(pWin->border.pixmap->drawable.width &
+ (pWin->border.pixmap->drawable.width - 1))) {
+ for (pBgWin = pWin;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ afbCopyRotatePixmap(pWin->border.pixmap,
+ &pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x, pBgWin->drawable.y);
+ if (pPrivWin->pRotatedBorder) {
+ pPrivWin->fastBorder = TRUE;
+ pPrivWin->oldRotate.x = pBgWin->drawable.x;
+ pPrivWin->oldRotate.y = pBgWin->drawable.y;
+ } else
+ pPrivWin->fastBorder = FALSE;
+ } else
+ pPrivWin->fastBorder = FALSE;
+ break;
+ case CWBorderPixel:
+ pPrivWin->fastBorder = FALSE;
+ break;
+ }
+ }
+ /* Again, we have no failure modes indicated by any of the routines
+ * we've called, so we have to assume it worked */
+ return (TRUE);
+}
diff --git a/xc/programs/Xserver/afb/afbzerarc.c b/xc/programs/Xserver/afb/afbzerarc.c
new file mode 100644
index 000000000..a12891363
--- /dev/null
+++ b/xc/programs/Xserver/afb/afbzerarc.c
@@ -0,0 +1,207 @@
+/* $XFree86: xc/programs/Xserver/afb/afbzerarc.c,v 3.1 1998/03/20 21:04:58 hohndel Exp $ */
+/************************************************************
+
+Copyright (c) 1989 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+********************************************************/
+
+/* $XConsortium: afbzerarc.c,v 5.19 94/04/17 20:28:37 dpw Exp $ */
+
+/* Derived from:
+ * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
+ * by M. L. V. Pitteway
+ * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
+ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "miscstruct.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "afb.h"
+#include "maskbits.h"
+#include "mizerarc.h"
+#include "mi.h"
+
+/*
+ * Note: LEFTMOST must be the bit leftmost in the actual screen
+ * representation. This depends also on the IMAGE_BYTE_ORDER.
+ * LONG2CHARS() takes care of the re-ordering as required. (DHD)
+ */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define LEFTMOST ((PixelType) LONG2CHARS((1 << PLST)))
+#else
+#define LEFTMOST ((PixelType) LONG2CHARS(1))
+#endif
+
+#define Pixelate(base,yoff,xoff) \
+{ \
+ paddr = afbScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \
+ pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \
+ for (de = 0; de < depthDst; de++, paddr += sizeDst) /* @@@ NEXT PLANE @@@ */ \
+ switch (rrops[de]) { \
+ case RROP_BLACK: \
+ *paddr &= ~pmask; \
+ break; \
+ case RROP_WHITE: \
+ *paddr |= pmask; \
+ break; \
+ case RROP_INVERT: \
+ *paddr ^= pmask; \
+ break; \
+ case RROP_NOP: \
+ break; \
+ } \
+}
+
+#define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff);
+
+static void
+afbZeroArcSS(pDraw, pGC, arc)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ xArc *arc;
+{
+ miZeroArcRec info;
+ Bool do360;
+ register int de;
+ register int x, y, a, b, d, mask;
+ register int k1, k3, dx, dy;
+ PixelType *addrl;
+ PixelType *yorgl, *yorgol;
+ PixelType pixel;
+ int nlwidth, yoffset, dyoffset;
+ int sizeDst, depthDst;
+ PixelType pmask;
+ register PixelType *paddr;
+ register unsigned char *rrops;
+
+ rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
+
+ afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
+ addrl);
+ do360 = miZeroArcSetup(arc, &info, TRUE);
+ yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
+ yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
+ info.xorg += pDraw->x;
+ info.xorgo += pDraw->x;
+ MIARCSETUP();
+ yoffset = y ? nlwidth : 0;
+ dyoffset = 0;
+ mask = info.initialMask;
+ if (!(arc->width & 1)) {
+ DoPix(2, yorgl, 0, info.xorgo);
+ DoPix(8, yorgol, 0, info.xorgo);
+ }
+ if (!info.end.x || !info.end.y) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
+ int xoffset = nlwidth;
+ PixelType *yorghl = afbScanlineDeltaNoBankSwitch(yorgl, info.h, nlwidth);
+ int xorghp = info.xorg + info.h;
+ int xorghn = info.xorg - info.h;
+
+ while (1) {
+ Pixelate(yorgl, yoffset, info.xorg + x);
+ Pixelate(yorgl, yoffset, info.xorg - x);
+ Pixelate(yorgol, -yoffset, info.xorg - x);
+ Pixelate(yorgol, -yoffset, info.xorg + x);
+ if (a < 0)
+ break;
+ Pixelate(yorghl, -xoffset, xorghp - y);
+ Pixelate(yorghl, -xoffset, xorghn + y);
+ Pixelate(yorghl, xoffset, xorghn + y);
+ Pixelate(yorghl, xoffset, xorghp - y);
+ xoffset += nlwidth;
+ MIARCCIRCLESTEP(yoffset += nlwidth;);
+ }
+ x = info.w;
+ yoffset = info.h * nlwidth;
+ } else if (do360) {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = nlwidth;);
+ Pixelate(yorgl, yoffset, info.xorg + x);
+ Pixelate(yorgl, yoffset, info.xorgo - x);
+ Pixelate(yorgol, -yoffset, info.xorgo - x);
+ Pixelate(yorgol, -yoffset, info.xorg + x);
+ MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
+ }
+ } else {
+ while (y < info.h || x < info.w) {
+ MIARCOCTANTSHIFT(dyoffset = nlwidth;);
+ if ((x == info.start.x) || (y == info.start.y)) {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+ DoPix(1, yorgl, yoffset, info.xorg + x);
+ DoPix(2, yorgl, yoffset, info.xorgo - x);
+ DoPix(4, yorgol, -yoffset, info.xorgo - x);
+ DoPix(8, yorgol, -yoffset, info.xorg + x);
+ if ((x == info.end.x) || (y == info.end.y)) {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
+ }
+ }
+ if ((x == info.start.x) || (y == info.start.y))
+ mask = info.start.mask;
+ DoPix(1, yorgl, yoffset, info.xorg + x);
+ DoPix(4, yorgol, -yoffset, info.xorgo - x);
+ if (arc->height & 1) {
+ DoPix(2, yorgl, yoffset, info.xorgo - x);
+ DoPix(8, yorgol, -yoffset, info.xorg + x);
+ }
+}
+
+void
+afbZeroPolyArcSS(pDraw, pGC, narcs, parcs)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ register xArc *arc;
+ register int i;
+ BoxRec box;
+ RegionPtr cclip;
+
+ cclip = pGC->pCompositeClip;
+ for (arc = parcs, i = narcs; --i >= 0; arc++) {
+ if (miCanZeroArc(arc)) {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ box.x2 = box.x1 + (int)arc->width + 1;
+ box.y2 = box.y1 + (int)arc->height + 1;
+ if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
+ afbZeroArcSS(pDraw, pGC, arc);
+ else
+ miZeroPolyArc(pDraw, pGC, 1, arc);
+ } else
+ miPolyArc(pDraw, pGC, 1, arc);
+ }
+}
diff --git a/xc/programs/Xserver/cfb/Imakefile b/xc/programs/Xserver/cfb/Imakefile
new file mode 100644
index 000000000..adfe37315
--- /dev/null
+++ b/xc/programs/Xserver/cfb/Imakefile
@@ -0,0 +1,276 @@
+XCOMM $TOG: Imakefile /main/71 1997/11/17 10:00:11 msr $
+XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile,v 3.23 1999/08/21 13:48:13 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#ifndef PixelSize
+#define PixelSize 8
+#endif
+
+#if PixelSize == 8
+/* cfb8cppl.c MUST come last to avoid confusing makedepend */
+PSZSRCS = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c
+PSZOBJS = cfb8bit.o cfbteblt8.o cfbglrop8.o cfbpush8.o cfbrctstp8.o
+#ifdef MipsArchitecture
+#ifndef ArcArchitecture
+#ifndef Mips64Architecture
+STIPPLESRC = stipmips.s stipmipste.s
+STIPPLEOBJ = stipmips.o stipmipste.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+#endif
+#ifdef SparcArchitecture
+STIPPLESRC = stipsparc.s stipsparcte.s
+STIPPLEOBJ = stipsparc.o stipsparcte.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+
+#if PixelSize == 32
+#ifdef SparcArchitecture
+STIPPLESRC = stipsprc32.s stipsprcte32.s
+STIPPLEOBJ = stipsprc32.o stipsprcte32.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+
+#ifdef XFree86Version
+#if DoLoadableServer
+XFMODSRC = cfbmodule.c
+XFMODOBJ = cfbmodule.o
+#endif
+#endif
+
+#if !(DoLoadableServer && defined(LinkDirectory))
+CFBCMAP = cfbcmap.o
+#endif
+
+SRCS = cfbgc.c cfbrrop.c cfbwindow.c \
+ cfbpntwin.c cfbmskbits.c cfbpixmap.c cfbbitblt.c \
+ cfbfillsp.c cfbsetsp.c cfbscrinit.c cfballpriv.c \
+ cfbgetsp.c cfbfillrct.c \
+ cfbsolidC.c cfbsolidX.c cfbsolidG.c \
+ cfbtileoddC.c cfbtileoddG.c cfbtile32C.c cfbtile32G.c \
+ cfbcmap.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \
+ cfbfillarcC.c cfbfillarcG.c \
+ cfbigblt8.c cfbglblt8.c cfbtegblt.c cfbbstore.c \
+ cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c \
+ cfbpolypnt.c \
+ cfbbres.c cfbline.c cfbhrzvert.c cfbbresd.c cfbimage.c cfbseg.c \
+ cfb8lineCO.c cfb8lineX.c cfb8lineG.c cfb8lineCP.c \
+ cfb8segC.c cfb8segX.c cfb8segG.c cfb8segCS.c \
+ cfbply1rctC.c cfbply1rctG.c cfbcppl.c $(PSZSRCS) $(XFMODSRC)
+
+OBJS = cfbgc.o cfbrrop.o cfbwindow.o \
+ cfbgetsp.o cfbfillrct.o \
+ cfbsolidC.o cfbsolidX.o cfbsolidG.o \
+ cfbtileoddC.o cfbtileoddG.o cfbtile32C.o cfbtile32G.o \
+ cfbfillsp.o cfbsetsp.o cfbscrinit.o cfballpriv.o \
+ cfbpntwin.o cfbmskbits.o cfbpixmap.o \
+ $(CFBCMAP) cfbzerarcC.o cfbzerarcX.o cfbzerarcG.o \
+ cfbfillarcC.o cfbfillarcG.o \
+ cfbigblt8.o cfbglblt8.o cfbtegblt.o cfbbstore.o \
+ cfbpolypnt.o \
+ cfbbres.o cfbline.o cfbhrzvert.o cfbbresd.o cfbimage.o cfbseg.o \
+ cfb8lineCO.o cfb8lineX.o cfb8lineG.o cfb8lineCP.o \
+ cfb8segCS.o cfb8segX.o cfb8segG.o cfb8segC.o \
+ cfbbitblt.o cfbbltC.o cfbbltX.o cfbbltO.o cfbbltG.o \
+ cfbply1rctC.o cfbply1rctG.o cfbcppl.o $(PSZOBJS) $(STIPPLEOBJ) \
+ $(XFMODOBJ)
+
+#ifdef XFree86Version
+PLATFORMDEFS = -DXFREE86
+#endif
+
+#if BuildLowMem
+ LMDEFINES = -ULOWMEMFTPT
+#endif
+
+ INCLUDES = -I. -I../cfb -I../mfb -I../mi -I../include -I$(XINCLUDESRC) \
+ -I$(FONTINCSRC) -I$(EXTINCSRC)
+ LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln
+ DEFINES = $(LMDEFINES) -DPSZ=PixelSize $(PLATFORMDEFS)
+
+#if PixelSize == 8
+CFBNAME = cfb
+#elif PixelSize == 16
+CFBNAME = cfb16
+#elif PixelSize == 24
+CFBNAME = cfb24
+#elif PixelSize == 32
+CFBNAME = cfb32
+#endif
+
+ModuleObjectRule()
+LibraryModuleTarget($(CFBNAME),$(OBJS))
+
+LintLibraryTarget($(CFBNAME),$(SRCS))
+
+NormalLintTarget($(SRCS))
+
+#ifdef LinkDirectory
+
+LinkSourceFile(cfb.h,LinkDirectory)
+LinkSourceFile(cfbmap.h,LinkDirectory)
+LinkSourceFile(cfballpriv.c,LinkDirectory)
+LinkSourceFile(cfbbitblt.c,LinkDirectory)
+LinkSourceFile(cfbblt.c,LinkDirectory)
+LinkSourceFile(cfbbres.c,LinkDirectory)
+LinkSourceFile(cfbbresd.c,LinkDirectory)
+LinkSourceFile(cfbbstore.c,LinkDirectory)
+LinkSourceFile(cfbcmap.c,LinkDirectory)
+LinkSourceFile(cfbcppl.c,LinkDirectory)
+LinkSourceFile(cfbfillarc.c,LinkDirectory)
+LinkSourceFile(cfbfillrct.c,LinkDirectory)
+LinkSourceFile(cfbfillsp.c,LinkDirectory)
+LinkSourceFile(cfbgc.c,LinkDirectory)
+LinkSourceFile(cfbgetsp.c,LinkDirectory)
+LinkSourceFile(cfbhrzvert.c,LinkDirectory)
+LinkSourceFile(cfbimage.c,LinkDirectory)
+LinkSourceFile(cfbline.c,LinkDirectory)
+LinkSourceFile(cfb8line.c,LinkDirectory)
+LinkSourceFile(cfbmskbits.c,LinkDirectory)
+LinkSourceFile(cfbmskbits.h,LinkDirectory)
+LinkSourceFile(cfbpixmap.c,LinkDirectory)
+LinkSourceFile(cfbply1rct.c,LinkDirectory)
+LinkSourceFile(cfbpntwin.c,LinkDirectory)
+LinkSourceFile(cfbpolypnt.c,LinkDirectory)
+LinkSourceFile(cfbrrop.c,LinkDirectory)
+LinkSourceFile(cfbrrop.h,LinkDirectory)
+LinkSourceFile(cfbscrinit.c,LinkDirectory)
+LinkSourceFile(cfbsetsp.c,LinkDirectory)
+LinkSourceFile(cfbsolid.c,LinkDirectory)
+LinkSourceFile(cfbigblt8.c,LinkDirectory)
+LinkSourceFile(cfbglblt8.c,LinkDirectory)
+LinkSourceFile(cfbtegblt.c,LinkDirectory)
+LinkSourceFile(cfbtileodd.c,LinkDirectory)
+LinkSourceFile(cfbtile32.c,LinkDirectory)
+LinkSourceFile(cfbwindow.c,LinkDirectory)
+LinkSourceFile(cfbzerarc.c,LinkDirectory)
+LinkSourceFile(cfb8bit.h,LinkDirectory)
+#if PixelSize == 8
+LinkSourceFile(cfb8bit.c,LinkDirectory)
+LinkSourceFile(cfb8cppl.c,LinkDirectory)
+LinkSourceFile(cfbpush8.c,LinkDirectory)
+LinkSourceFile(cfbrctstp8.c,LinkDirectory)
+LinkSourceFile(cfbteblt8.c,LinkDirectory)
+#ifdef MipsArchitecture
+LinkSourceFile(stipmips.s,LinkDirectory)
+#endif
+#ifdef SparcArchitecture
+LinkSourceFile(stipsparc.s,LinkDirectory)
+#endif
+#endif
+#if PixelSize == 32
+#ifdef SparcArchitecture
+LinkSourceFile(stipsprc32.s,LinkDirectory)
+#endif
+#endif
+#endif
+
+ObjectFromSpecialSource(cfbseg,cfbline,-DPOLYSEGMENT)
+
+ObjectFromSpecialSource(cfbfillarcC,cfbfillarc,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbfillarcG,cfbfillarc,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbzerarcC,cfbzerarc,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbzerarcX,cfbzerarc,-DRROP=GXxor)
+ObjectFromSpecialSource(cfbzerarcG,cfbzerarc,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbbltC,cfbblt,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbbltX,cfbblt,-DMROP=Mxor)
+ObjectFromSpecialSource(cfbbltO,cfbblt,-DMROP=Mor)
+ObjectFromSpecialSource(cfbbltG,cfbblt,-DMROP=0)
+
+ObjectFromSpecialSource(cfbsolidC,cfbsolid,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbsolidX,cfbsolid,-DRROP=GXxor)
+ObjectFromSpecialSource(cfbsolidG,cfbsolid,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbtileoddC,cfbtileodd,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbtileoddG,cfbtileodd,-DMROP=0)
+
+ObjectFromSpecialSource(cfbtile32C,cfbtile32,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbtile32G,cfbtile32,-DMROP=0)
+
+ObjectFromSpecialSource(cfb8lineCO,cfb8line,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfb8lineCP,cfb8line,-DRROP=GXcopy -DPREVIOUS)
+ObjectFromSpecialSource(cfb8lineX,cfb8line,-DRROP=GXxor)
+ObjectFromSpecialSource(cfb8lineG,cfb8line,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfb8segCS,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT -DWIDTH_SHIFT)
+ObjectFromSpecialSource(cfb8segC,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT)
+ObjectFromSpecialSource(cfb8segX,cfb8line,-DRROP=GXxor -DPOLYSEGMENT)
+ObjectFromSpecialSource(cfb8segG,cfb8line,-DRROP=GXset -DPOLYSEGMENT)
+
+ObjectFromSpecialSource(cfbply1rctC,cfbply1rct,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbply1rctG,cfbply1rct,-DRROP=GXset)
+
+SpecialCObjectRule(cfbglblt8,$(_NOOP_),$(STIPPLEDEF))
+SpecialCObjectRule(cfbpixmap,$(ICONFIGFILES),$(_NOOP_))
+SpecialCObjectRule(cfbcmap,$(ICONFIGFILES),$(EXT_DEFINES) $(GLX_DEFINES))
+
+#if PixelSize == 8
+ObjectFromSpecialSource(cfbglrop8,cfbglblt8,-DGLYPHROP)
+
+#ifdef MipsArchitecture
+stipmipste.s: stipmips.s
+ $(RM) $@
+ $(LN) stipmips.s stipmipste.s
+clean::
+ $(RM) stipmipste.s
+
+stipmipste.o: stipmipste.s
+ $(AS) -o $@ -DTETEXT stipmipste.s
+#endif
+
+#ifdef SparcArchitecture
+stipsparcte.s: stipsparc.s
+ $(RM) $@
+ $(LN) stipsparc.s stipsparcte.s
+clean::
+ $(RM) stipsparcte.s
+
+stipsparc.o: stipsparc.s
+ $(CPP) stipsparc.s | $(AS) -o $@ -
+
+stipsparcte.o: stipsparcte.s
+ $(CPP) -DTETEXT stipsparcte.s | $(AS) -o $@ -
+#endif
+#endif
+
+#if PixelSize == 32
+#ifdef SparcArchitecture
+stipsprcte32.s: stipsprc32.s
+ $(RM) $@
+ $(LN) stipsprc32.s stipsprcte32.s
+clean::
+ $(RM) stipsprcte32.s
+
+stipsprc32.o: stipsprc32.s
+ $(CPP) stipsprc32.s | $(AS) -o $@ -
+
+stipsprcte32.o: stipsprcte32.s
+ $(CPP) -DTETEXT stipsprcte32.s | $(AS) -o $@ -
+#endif
+#endif
+
+InstallLibraryModule($(CFBNAME),$(MODULEDIR),.)
+
+#ifndef OS2Architecture
+DependTarget()
+#endif
+
+
+InstallDriverSDKLibraryModule($(CFBNAME),$(DRIVERSDKMODULEDIR),.)
+
+#if PixelSize == 8
+InstallDriverSDKNonExecFile(cfb.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(cfb16.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(cfb24.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(cfb32.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(cfbmap.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(cfbunmap.h,$(DRIVERSDKINCLUDEDIR))
+#endif
diff --git a/xc/programs/Xserver/cfb/cfb.h b/xc/programs/Xserver/cfb/cfb.h
new file mode 100644
index 000000000..3d84eb295
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb.h
@@ -0,0 +1,1565 @@
+/* $TOG: cfb.h /main/53 1998/02/09 14:08:27 kaleb $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.19 1999/08/21 13:48:13 dawes Exp $ */
+
+#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY)
+
+#include "X.h"
+#include "pixmap.h"
+#include "region.h"
+#include "gc.h"
+#include "colormap.h"
+#include "miscstruct.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "mfb.h"
+#undef PixelType
+
+#include "cfbmap.h"
+
+#ifndef CFB_PROTOTYPES_ONLY
+#define __CFB_H__
+/*
+ private filed of pixmap
+ pixmap.devPrivate = (unsigned int *)pointer_to_bits
+ pixmap.devKind = width_of_pixmap_in_bytes
+*/
+
+extern int cfbGCPrivateIndex;
+extern int cfbWindowPrivateIndex;
+
+/* private field of GC */
+typedef struct {
+ unsigned char rop; /* special case rop values */
+ /* next two values unused in cfb, included for compatibility with mfb */
+ unsigned char ropOpStip; /* rop for opaque stipple */
+ /* this value is ropFillArea in mfb, usurped for cfb */
+ unsigned char oneRect; /* drawable has one clip rect */
+ unsigned long xor, and; /* reduced rop values */
+ } cfbPrivGC;
+
+typedef cfbPrivGC *cfbPrivGCPtr;
+
+#define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\
+ (pGC)->devPrivates[cfbGCPrivateIndex].ptr)
+
+#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
+
+/* way to carry RROP info around */
+typedef struct {
+ unsigned char rop;
+ unsigned long xor, and;
+} cfbRRopRec, *cfbRRopPtr;
+
+/* private field of window */
+typedef struct {
+ unsigned char fastBorder; /* non-zero if border is 32 bits wide */
+ unsigned char fastBackground;
+ unsigned short unused; /* pad for alignment with Sun compiler */
+ DDXPointRec oldRotate;
+ PixmapPtr pRotatedBackground;
+ PixmapPtr pRotatedBorder;
+ } cfbPrivWin;
+
+#define cfbGetWindowPrivate(_pWin) ((cfbPrivWin *)\
+ (_pWin)->devPrivates[cfbWindowPrivateIndex].ptr)
+
+
+/* cfb8bit.c */
+
+extern int cfbSetStipple(
+#if NeedFunctionPrototypes
+ int /*alu*/,
+ unsigned long /*fg*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern int cfbSetOpaqueStipple(
+#if NeedFunctionPrototypes
+ int /*alu*/,
+ unsigned long /*fg*/,
+ unsigned long /*bg*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern int cfbComputeClipMasks32(
+#if NeedFunctionPrototypes
+ BoxPtr /*pBox*/,
+ int /*numRects*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ CARD32 * /*clips*/
+#endif
+);
+#endif /* !CFB_PROTOTYPES_ONLY */
+/* cfb8cppl.c */
+
+extern void cfbCopyImagePlane(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern void cfbCopyPlane8to1(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+
+extern void cfbCopyPlane16to1(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+
+extern void cfbCopyPlane24to1(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+
+extern void cfbCopyPlane32to1(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+#endif
+
+/* cfb8lineCO.c */
+
+extern int cfb8LineSS1RectCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/,
+ DDXPointPtr /*pptInitOrig*/,
+ int * /*x1p*/,
+ int * /*y1p*/,
+ int * /*x2p*/,
+ int * /*y2p*/
+#endif
+);
+
+extern void cfb8LineSS1Rect(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+#endif
+);
+
+extern void cfb8ClippedLineCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*x2*/,
+ int /*y2*/,
+ BoxPtr /*boxp*/,
+ Bool /*shorten*/
+#endif
+);
+/* cfb8lineCP.c */
+
+extern int cfb8LineSS1RectPreviousCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/,
+ DDXPointPtr /*pptInitOrig*/,
+ int * /*x1p*/,
+ int * /*y1p*/,
+ int * /*x2p*/,
+ int * /*y2p*/
+
+#endif
+);
+/* cfb8lineG.c */
+
+extern int cfb8LineSS1RectGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/,
+ DDXPointPtr /*pptInitOrig*/,
+ int * /*x1p*/,
+ int * /*y1p*/,
+ int * /*x2p*/,
+ int * /*y2p*/
+#endif
+);
+
+extern void cfb8ClippedLineGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*x2*/,
+ int /*y2*/,
+ BoxPtr /*boxp*/,
+ Bool /*shorten*/
+#endif
+);
+/* cfb8lineX.c */
+
+extern int cfb8LineSS1RectXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/,
+ DDXPointPtr /*pptInitOrig*/,
+ int * /*x1p*/,
+ int * /*y1p*/,
+ int * /*x2p*/,
+ int * /*y2p*/
+#endif
+);
+
+extern void cfb8ClippedLineXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*x2*/,
+ int /*y2*/,
+ BoxPtr /*boxp*/,
+ Bool /*shorten*/
+#endif
+);
+/* cfb8segC.c */
+
+extern int cfb8SegmentSS1RectCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegInit*/
+#endif
+);
+/* cfb8segCS.c */
+
+extern int cfb8SegmentSS1RectShiftCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegInit*/
+#endif
+);
+
+extern void cfb8SegmentSS1Rect(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegInit*/
+#endif
+);
+/* cfb8segG.c */
+
+extern int cfb8SegmentSS1RectGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegInit*/
+#endif
+);
+/* cfbsegX.c */
+
+extern int cfb8SegmentSS1RectXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegInit*/
+#endif
+);
+/* cfballpriv.c */
+
+extern Bool cfbAllocatePrivates(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ int * /*window_index*/,
+ int * /*gc_index*/
+#endif
+);
+/* cfbbitblt.c */
+
+extern RegionPtr cfbBitBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr/*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ void (* /*doBitBlt*/)(
+#if NeedNestedPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+ ),
+ unsigned long /*bitPlane*/
+#endif
+);
+
+extern void cfbDoBitblt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern RegionPtr cfbCopyArea(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr/*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/
+#endif
+);
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern void cfbCopyPlane1to8(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ int /*rop*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+#endif
+
+extern RegionPtr cfbCopyPlane(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ unsigned long /*bitPlane*/
+#endif
+);
+/* cfbbltC.c */
+
+extern void cfbDoBitbltCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbbltG.c */
+
+extern void cfbDoBitbltGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbbltO.c */
+
+extern void cfbDoBitbltOr(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbbltX.c */
+
+extern void cfbDoBitbltXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ int /*alu*/,
+ RegionPtr /*prgnDst*/,
+ DDXPointPtr /*pptSrc*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbbres.c */
+
+extern void cfbBresS(
+#if NeedFunctionPrototypes
+ int /*rop*/,
+ unsigned long /*and*/,
+ unsigned long /*xor*/,
+ unsigned long * /*addrl*/,
+ int /*nlwidth*/,
+ int /*signdx*/,
+ int /*signdy*/,
+ int /*axis*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*e*/,
+ int /*e1*/,
+ int /*e2*/,
+ int /*len*/
+#endif
+);
+/* cfbbresd.c */
+
+extern void cfbBresD(
+#if NeedFunctionPrototypes
+ cfbRRopPtr /*rrops*/,
+ int * /*pdashIndex*/,
+ unsigned char * /*pDash*/,
+ int /*numInDashList*/,
+ int * /*pdashOffset*/,
+ int /*isDoubleDash*/,
+ unsigned long * /*addrl*/,
+ int /*nlwidth*/,
+ int /*signdx*/,
+ int /*signdy*/,
+ int /*axis*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*e*/,
+ int /*e1*/,
+ int /*e2*/,
+ int /*len*/
+#endif
+);
+/* cfbbstore.c */
+
+extern void cfbSaveAreas(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/,
+ RegionPtr /*prgnSave*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern void cfbRestoreAreas(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/,
+ RegionPtr /*prgnRestore*/,
+ int /*xorg*/,
+ int /*yorg*/,
+ WindowPtr /*pWin*/
+#endif
+);
+/* cfbcmap.c */
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern int cfbListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ Colormap * /*pmaps*/
+#endif
+);
+
+extern void cfbInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern void cfbUninstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern void cfbResolveColor(
+#if NeedFunctionPrototypes
+ unsigned short * /*pred*/,
+ unsigned short * /*pgreen*/,
+ unsigned short * /*pblue*/,
+ VisualPtr /*pVisual*/
+#endif
+);
+
+extern Bool cfbInitializeColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+extern int cfbExpandDirectColors(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ int /*ndef*/,
+ xColorItem * /*indefs*/,
+ xColorItem * /*outdefs*/
+#endif
+);
+
+extern Bool cfbCreateDefColormap(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+
+extern Bool cfbSetVisualTypes(
+#if NeedFunctionPrototypes
+ int /*depth*/,
+ int /*visuals*/,
+ int /*bitsPerRGB*/
+#endif
+);
+
+extern void cfbClearVisualTypes(void);
+
+extern Bool cfbInitVisuals(
+#if NeedFunctionPrototypes
+ VisualPtr * /*visualp*/,
+ DepthPtr * /*depthp*/,
+ int * /*nvisualp*/,
+ int * /*ndepthp*/,
+ int * /*rootDepthp*/,
+ VisualID * /*defaultVisp*/,
+ unsigned long /*sizes*/,
+ int /*bitsPerRGB*/
+#endif
+);
+#endif
+/* cfbfillarcC.c */
+
+extern void cfbPolyFillArcSolidCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+/* cfbfillarcG.c */
+
+extern void cfbPolyFillArcSolidGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+/* cfbfillrct.c */
+
+extern void cfbFillBoxTileOdd(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*n*/,
+ BoxPtr /*rects*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/
+#endif
+);
+
+extern void cfbFillRectTileOdd(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbPolyFillRect(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nrectFill*/,
+ xRectangle * /*prectInit*/
+#endif
+);
+/* cfbfillsp.c */
+
+extern void cfbUnnaturalTileFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void cfbUnnaturalStippleFS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern void cfb8Stipple32FS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+
+extern void cfb8OpaqueStipple32FS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+#endif
+/* cfbgc.c */
+
+extern GCOpsPtr cfbMatchCommon(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ cfbPrivGCPtr /*devPriv*/
+#endif
+);
+
+extern Bool cfbCreateGC(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/
+#endif
+);
+
+extern void cfbValidateGC(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ unsigned long /*changes*/,
+ DrawablePtr /*pDrawable*/
+#endif
+);
+
+/* cfbgetsp.c */
+
+extern void cfbGetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*wMax*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ int /*nspans*/,
+ char * /*pdstStart*/
+#endif
+);
+/* cfbglblt8.c */
+
+extern void cfbPolyGlyphBlt8(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* cfbglrop8.c */
+
+extern void cfbPolyGlyphRop8(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* cfbhrzvert.c */
+
+extern int cfbHorzS(
+#if NeedFunctionPrototypes
+ int /*rop*/,
+ unsigned long /*and*/,
+ unsigned long /*xor*/,
+ unsigned long * /*addrl*/,
+ int /*nlwidth*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*len*/
+#endif
+);
+
+extern void cfbVertS(
+#if NeedFunctionPrototypes
+ int /*rop*/,
+ unsigned long /*and*/,
+ unsigned long /*xor*/,
+ unsigned long * /*addrl*/,
+ int /*nlwidth*/,
+ int /*x1*/,
+ int /*y1*/,
+ int /*len*/
+#endif
+);
+/* cfbigblt8.c */
+
+extern void cfbImageGlyphBlt8(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* cfbimage.c */
+
+extern void cfbPutImage(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*depth*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ int /*leftPad*/,
+ int /*format*/,
+ char * /*pImage*/
+#endif
+);
+
+extern void cfbGetImage(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*sx*/,
+ int /*sy*/,
+ int /*w*/,
+ int /*h*/,
+ unsigned int /*format*/,
+ unsigned long /*planeMask*/,
+ char * /*pdstLine*/
+#endif
+);
+/* cfbline.c */
+
+extern void cfbLineSS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+#endif
+);
+
+extern void cfbLineSD(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+#endif
+);
+/* cfbmskbits.c */
+/* cfbpixmap.c */
+
+extern PixmapPtr cfbCreatePixmap(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ int /*width*/,
+ int /*height*/,
+ int /*depth*/
+#endif
+);
+
+extern Bool cfbDestroyPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/
+#endif
+);
+
+extern PixmapPtr cfbCopyPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pSrc*/
+#endif
+);
+
+extern void cfbPadPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPixmap*/
+#endif
+);
+
+extern void cfbXRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/,
+ int /*rw*/
+#endif
+);
+
+extern void cfbYRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/,
+ int /*rh*/
+#endif
+);
+
+extern void cfbCopyRotatePixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*psrcPix*/,
+ PixmapPtr * /*ppdstPix*/,
+ int /*xrot*/,
+ int /*yrot*/
+#endif
+);
+/* cfbply1rctC.c */
+
+extern void cfbFillPoly1RectCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*shape*/,
+ int /*mode*/,
+ int /*count*/,
+ DDXPointPtr /*ptsIn*/
+#endif
+);
+/* cfbply1rctG.c */
+
+extern void cfbFillPoly1RectGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*shape*/,
+ int /*mode*/,
+ int /*count*/,
+ DDXPointPtr /*ptsIn*/
+#endif
+);
+/* cfbpntwin.c */
+
+extern void cfbPaintWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ RegionPtr /*pRegion*/,
+ int /*what*/
+#endif
+);
+
+extern void cfbFillBoxSolid(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ unsigned long /*pixel*/
+#endif
+);
+
+extern void cfbFillBoxTile32(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ PixmapPtr /*tile*/
+#endif
+);
+/* cfbpolypnt.c */
+
+extern void cfbPolyPoint(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ xPoint * /*pptInit*/
+#endif
+);
+/* cfbpush8.c */
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern void cfbPushPixels8(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/,
+ PixmapPtr /*pBitmap*/,
+ DrawablePtr /*pDrawable*/,
+ int /*dx*/,
+ int /*dy*/,
+ int /*xOrg*/,
+ int /*yOrg*/
+#endif
+);
+/* cfbrctstp8.c */
+
+extern void cfb8FillRectOpaqueStippled32(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfb8FillRectTransparentStippled32(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfb8FillRectStippledUnnatural(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+#endif
+/* cfbrrop.c */
+
+extern int cfbReduceRasterOp(
+#if NeedFunctionPrototypes
+ int /*rop*/,
+ unsigned long /*fg*/,
+ unsigned long /*pm*/,
+ unsigned long * /*andp*/,
+ unsigned long * /*xorp*/
+#endif
+);
+/* cfbscrinit.c */
+
+extern Bool cfbCloseScreen(
+#if NeedFunctionPrototypes
+ int /*index*/,
+ ScreenPtr /*pScreen*/
+#endif
+);
+
+extern Bool cfbSetupScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ pointer /*pbits*/,
+ int /*xsize*/,
+ int /*ysize*/,
+ int /*dpix*/,
+ int /*dpiy*/,
+ int /*width*/
+#endif
+);
+
+extern Bool cfbFinishScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ pointer /*pbits*/,
+ int /*xsize*/,
+ int /*ysize*/,
+ int /*dpix*/,
+ int /*dpiy*/,
+ int /*width*/
+#endif
+);
+
+extern Bool cfbScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/,
+ pointer /*pbits*/,
+ int /*xsize*/,
+ int /*ysize*/,
+ int /*dpix*/,
+ int /*dpiy*/,
+ int /*width*/
+#endif
+);
+
+extern PixmapPtr cfbGetScreenPixmap(
+#if NeedFunctionPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+
+extern void cfbSetScreenPixmap(
+#if NeedFunctionPrototypes
+ PixmapPtr /*pPix*/
+#endif
+);
+
+/* cfbseg.c */
+
+extern void cfbSegmentSS(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSeg*/
+#endif
+);
+
+extern void cfbSegmentSD(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSeg*/
+#endif
+);
+/* cfbsetsp.c */
+
+extern int cfbSetScanline(
+#if NeedFunctionPrototypes
+ int /*y*/,
+ int /*xOrigin*/,
+ int /*xStart*/,
+ int /*xEnd*/,
+ unsigned int * /*psrc*/,
+ int /*alu*/,
+ int * /*pdstBase*/,
+ int /*widthDst*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbSetSpans(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ char * /*psrc*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ int /*nspans*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbsolidC.c */
+
+extern void cfbFillRectSolidCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbSolidSpansCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbsolidG.c */
+
+extern void cfbFillRectSolidGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbSolidSpansGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbsolidX.c */
+
+extern void cfbFillRectSolidXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbSolidSpansXor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbteblt8.c */
+
+#ifndef CFB_PROTOTYPES_ONLY
+extern void cfbTEGlyphBlt8(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*xInit*/,
+ int /*yInit*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+#endif
+/* cfbtegblt.c */
+
+extern void cfbTEGlyphBlt(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr/*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+#endif
+);
+/* cfbtile32C.c */
+
+extern void cfbFillRectTile32Copy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbTile32FSCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbtile32G.c */
+
+extern void cfbFillRectTile32General(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/
+#endif
+);
+
+extern void cfbTile32FSGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+#endif
+);
+/* cfbtileoddC.c */
+
+extern void cfbFillBoxTileOddCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillSpanTileOddCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*n*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillBoxTile32sCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillSpanTile32sCopy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*n*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbtileoddG.c */
+
+extern void cfbFillBoxTileOddGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillSpanTileOddGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*n*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillBoxTile32sGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*nBox*/,
+ BoxPtr /*pBox*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern void cfbFillSpanTile32sGeneral(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDrawable*/,
+ int /*n*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ PixmapPtr /*tile*/,
+ int /*xrot*/,
+ int /*yrot*/,
+ int /*alu*/,
+ unsigned long /*planemask*/
+#endif
+);
+/* cfbwindow.c */
+
+extern Bool cfbCreateWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern Bool cfbDestroyWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+
+extern Bool cfbMapWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWindow*/
+#endif
+);
+
+extern Bool cfbPositionWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/
+#endif
+);
+
+extern Bool cfbUnmapWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWindow*/
+#endif
+);
+
+extern void cfbCopyWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ DDXPointRec /*ptOldOrg*/,
+ RegionPtr /*prgnSrc*/
+#endif
+);
+
+extern Bool cfbChangeWindowAttributes(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/,
+ unsigned long /*mask*/
+#endif
+);
+/* cfbzerarcC.c */
+
+extern void cfbZeroPolyArcSS8Copy(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+/* cfbzerarcG.c */
+
+extern void cfbZeroPolyArcSS8General(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+/* cfbzerarcX.c */
+
+extern void cfbZeroPolyArcSS8Xor(
+#if NeedFunctionPrototypes
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+#endif
+);
+
+#if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE)
+
+#define CFB_NEED_SCREEN_PRIVATE
+
+extern int cfbScreenPrivateIndex;
+#endif
+
+#ifndef CFB_PROTOTYPES_ONLY
+
+/* Common macros for extracting drawing information */
+
+#define cfbGetWindowPixmap(d) \
+ ((* ((DrawablePtr)(d))->pScreen->GetWindowPixmap)((WindowPtr)(d)))
+
+#define cfbGetTypedWidth(pDrawable,wtype) (\
+ (((pDrawable)->type != DRAWABLE_PIXMAP) ? \
+ (int) (cfbGetWindowPixmap(pDrawable)->devKind) : \
+ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
+
+#define cfbGetByteWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned char)
+
+#define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType)
+
+#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned long)
+
+#define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
+ PixmapPtr _pPix; \
+ if ((pDrawable)->type != DRAWABLE_PIXMAP) \
+ _pPix = cfbGetWindowPixmap(pDrawable); \
+ else \
+ _pPix = (PixmapPtr) (pDrawable); \
+ (pointer) = (ptype *) _pPix->devPrivate.ptr; \
+ (width) = ((int) _pPix->devKind) / sizeof (wtype); \
+}
+
+#define cfbGetByteWidthAndPointer(pDrawable, width, pointer) \
+ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
+
+#define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \
+ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned long, unsigned long)
+
+#define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
+ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
+
+#define cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
+ PixmapPtr _pPix = cfbGetWindowPixmap((DrawablePtr) (pWin)); \
+ (pointer) = (ptype *) _pPix->devPrivate.ptr; \
+ (width) = ((int) _pPix->devKind) / sizeof (wtype); \
+}
+
+#define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \
+ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned long, unsigned long)
+
+#define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
+ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char)
+
+#define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \
+ cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
+
+/* Macros which handle a coordinate in a single register */
+
+/* Most compilers will convert divide by 65536 into a shift, if signed
+ * shifts exist. If your machine does arithmetic shifts and your compiler
+ * can't get it right, add to this line.
+ */
+
+/* mips compiler - what a joke - it CSEs the 65536 constant into a reg
+ * forcing as to use div instead of shift. Let's be explicit.
+ */
+
+#if defined(mips) || defined(sparc) || defined(__alpha) || defined(__alpha__) || defined(__i386__) || defined(i386)
+#define GetHighWord(x) (((int) (x)) >> 16)
+#else
+#define GetHighWord(x) (((int) (x)) / 65536)
+#endif
+
+#if IMAGE_BYTE_ORDER == MSBFirst
+#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
+#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff))
+#define intToX(i) (GetHighWord(i))
+#define intToY(i) ((int) ((short) i))
+#else
+#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
+#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff))
+#define intToX(i) ((int) ((short) (i)))
+#define intToY(i) (GetHighWord(i))
+#endif
+/*
+ * if CFB is built as a module, it shouldn't call libc functions.
+ */
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
+#endif /* !CFB_PROTOTYPES_ONLY */
+
+#endif
diff --git a/xc/programs/Xserver/cfb/cfb16.h b/xc/programs/Xserver/cfb/cfb16.h
new file mode 100644
index 000000000..3d51cd142
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb16.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb16.h,v 1.4 1998/11/28 10:42:50 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB16_H_
+#define _CFB16_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 16
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB16_H_ */
diff --git a/xc/programs/Xserver/cfb/cfb24.h b/xc/programs/Xserver/cfb/cfb24.h
new file mode 100644
index 000000000..f1876f74d
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb24.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb24.h,v 1.4 1998/11/28 10:42:51 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB24_H_
+#define _CFB24_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 24
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB24_H_ */
diff --git a/xc/programs/Xserver/cfb/cfb32.h b/xc/programs/Xserver/cfb/cfb32.h
new file mode 100644
index 000000000..5ea4c13c8
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb32.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb32.h,v 1.4 1998/11/28 10:42:51 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB32_H_
+#define _CFB32_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 32
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB32_H_ */
diff --git a/xc/programs/Xserver/cfb/cfb8bit.c b/xc/programs/Xserver/cfb/cfb8bit.c
new file mode 100644
index 000000000..6f01d1d73
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb8bit.c
@@ -0,0 +1,462 @@
+/* $TOG: cfb8bit.c /main/14 1998/02/09 14:03:59 kaleb $ */
+/*
+
+Copyright 1989, 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+ * cfb8bit.c
+ *
+ * 8 bit color frame buffer utility routines
+ */
+
+
+#if PSZ == 8
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+PixelGroup cfb8StippleMasks[NUM_MASKS] = {
+#if NUM_MASKS == 16
+ 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
+ 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
+ 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
+ 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff
+#else /* NUM_MASKS == 256 */
+ 0x0000000000000000, 0x00000000000000ff,
+ 0x000000000000ff00, 0x000000000000ffff,
+ 0x0000000000ff0000, 0x0000000000ff00ff,
+ 0x0000000000ffff00, 0x0000000000ffffff,
+ 0x00000000ff000000, 0x00000000ff0000ff,
+ 0x00000000ff00ff00, 0x00000000ff00ffff,
+ 0x00000000ffff0000, 0x00000000ffff00ff,
+ 0x00000000ffffff00, 0x00000000ffffffff,
+ 0x000000ff00000000, 0x000000ff000000ff,
+ 0x000000ff0000ff00, 0x000000ff0000ffff,
+ 0x000000ff00ff0000, 0x000000ff00ff00ff,
+ 0x000000ff00ffff00, 0x000000ff00ffffff,
+ 0x000000ffff000000, 0x000000ffff0000ff,
+ 0x000000ffff00ff00, 0x000000ffff00ffff,
+ 0x000000ffffff0000, 0x000000ffffff00ff,
+ 0x000000ffffffff00, 0x000000ffffffffff,
+ 0x0000ff0000000000, 0x0000ff00000000ff,
+ 0x0000ff000000ff00, 0x0000ff000000ffff,
+ 0x0000ff0000ff0000, 0x0000ff0000ff00ff,
+ 0x0000ff0000ffff00, 0x0000ff0000ffffff,
+ 0x0000ff00ff000000, 0x0000ff00ff0000ff,
+ 0x0000ff00ff00ff00, 0x0000ff00ff00ffff,
+ 0x0000ff00ffff0000, 0x0000ff00ffff00ff,
+ 0x0000ff00ffffff00, 0x0000ff00ffffffff,
+ 0x0000ffff00000000, 0x0000ffff000000ff,
+ 0x0000ffff0000ff00, 0x0000ffff0000ffff,
+ 0x0000ffff00ff0000, 0x0000ffff00ff00ff,
+ 0x0000ffff00ffff00, 0x0000ffff00ffffff,
+ 0x0000ffffff000000, 0x0000ffffff0000ff,
+ 0x0000ffffff00ff00, 0x0000ffffff00ffff,
+ 0x0000ffffffff0000, 0x0000ffffffff00ff,
+ 0x0000ffffffffff00, 0x0000ffffffffffff,
+ 0x00ff000000000000, 0x00ff0000000000ff,
+ 0x00ff00000000ff00, 0x00ff00000000ffff,
+ 0x00ff000000ff0000, 0x00ff000000ff00ff,
+ 0x00ff000000ffff00, 0x00ff000000ffffff,
+ 0x00ff0000ff000000, 0x00ff0000ff0000ff,
+ 0x00ff0000ff00ff00, 0x00ff0000ff00ffff,
+ 0x00ff0000ffff0000, 0x00ff0000ffff00ff,
+ 0x00ff0000ffffff00, 0x00ff0000ffffffff,
+ 0x00ff00ff00000000, 0x00ff00ff000000ff,
+ 0x00ff00ff0000ff00, 0x00ff00ff0000ffff,
+ 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff,
+ 0x00ff00ff00ffff00, 0x00ff00ff00ffffff,
+ 0x00ff00ffff000000, 0x00ff00ffff0000ff,
+ 0x00ff00ffff00ff00, 0x00ff00ffff00ffff,
+ 0x00ff00ffffff0000, 0x00ff00ffffff00ff,
+ 0x00ff00ffffffff00, 0x00ff00ffffffffff,
+ 0x00ffff0000000000, 0x00ffff00000000ff,
+ 0x00ffff000000ff00, 0x00ffff000000ffff,
+ 0x00ffff0000ff0000, 0x00ffff0000ff00ff,
+ 0x00ffff0000ffff00, 0x00ffff0000ffffff,
+ 0x00ffff00ff000000, 0x00ffff00ff0000ff,
+ 0x00ffff00ff00ff00, 0x00ffff00ff00ffff,
+ 0x00ffff00ffff0000, 0x00ffff00ffff00ff,
+ 0x00ffff00ffffff00, 0x00ffff00ffffffff,
+ 0x00ffffff00000000, 0x00ffffff000000ff,
+ 0x00ffffff0000ff00, 0x00ffffff0000ffff,
+ 0x00ffffff00ff0000, 0x00ffffff00ff00ff,
+ 0x00ffffff00ffff00, 0x00ffffff00ffffff,
+ 0x00ffffffff000000, 0x00ffffffff0000ff,
+ 0x00ffffffff00ff00, 0x00ffffffff00ffff,
+ 0x00ffffffffff0000, 0x00ffffffffff00ff,
+ 0x00ffffffffffff00, 0x00ffffffffffffff,
+ 0xff00000000000000, 0xff000000000000ff,
+ 0xff0000000000ff00, 0xff0000000000ffff,
+ 0xff00000000ff0000, 0xff00000000ff00ff,
+ 0xff00000000ffff00, 0xff00000000ffffff,
+ 0xff000000ff000000, 0xff000000ff0000ff,
+ 0xff000000ff00ff00, 0xff000000ff00ffff,
+ 0xff000000ffff0000, 0xff000000ffff00ff,
+ 0xff000000ffffff00, 0xff000000ffffffff,
+ 0xff0000ff00000000, 0xff0000ff000000ff,
+ 0xff0000ff0000ff00, 0xff0000ff0000ffff,
+ 0xff0000ff00ff0000, 0xff0000ff00ff00ff,
+ 0xff0000ff00ffff00, 0xff0000ff00ffffff,
+ 0xff0000ffff000000, 0xff0000ffff0000ff,
+ 0xff0000ffff00ff00, 0xff0000ffff00ffff,
+ 0xff0000ffffff0000, 0xff0000ffffff00ff,
+ 0xff0000ffffffff00, 0xff0000ffffffffff,
+ 0xff00ff0000000000, 0xff00ff00000000ff,
+ 0xff00ff000000ff00, 0xff00ff000000ffff,
+ 0xff00ff0000ff0000, 0xff00ff0000ff00ff,
+ 0xff00ff0000ffff00, 0xff00ff0000ffffff,
+ 0xff00ff00ff000000, 0xff00ff00ff0000ff,
+ 0xff00ff00ff00ff00, 0xff00ff00ff00ffff,
+ 0xff00ff00ffff0000, 0xff00ff00ffff00ff,
+ 0xff00ff00ffffff00, 0xff00ff00ffffffff,
+ 0xff00ffff00000000, 0xff00ffff000000ff,
+ 0xff00ffff0000ff00, 0xff00ffff0000ffff,
+ 0xff00ffff00ff0000, 0xff00ffff00ff00ff,
+ 0xff00ffff00ffff00, 0xff00ffff00ffffff,
+ 0xff00ffffff000000, 0xff00ffffff0000ff,
+ 0xff00ffffff00ff00, 0xff00ffffff00ffff,
+ 0xff00ffffffff0000, 0xff00ffffffff00ff,
+ 0xff00ffffffffff00, 0xff00ffffffffffff,
+ 0xffff000000000000, 0xffff0000000000ff,
+ 0xffff00000000ff00, 0xffff00000000ffff,
+ 0xffff000000ff0000, 0xffff000000ff00ff,
+ 0xffff000000ffff00, 0xffff000000ffffff,
+ 0xffff0000ff000000, 0xffff0000ff0000ff,
+ 0xffff0000ff00ff00, 0xffff0000ff00ffff,
+ 0xffff0000ffff0000, 0xffff0000ffff00ff,
+ 0xffff0000ffffff00, 0xffff0000ffffffff,
+ 0xffff00ff00000000, 0xffff00ff000000ff,
+ 0xffff00ff0000ff00, 0xffff00ff0000ffff,
+ 0xffff00ff00ff0000, 0xffff00ff00ff00ff,
+ 0xffff00ff00ffff00, 0xffff00ff00ffffff,
+ 0xffff00ffff000000, 0xffff00ffff0000ff,
+ 0xffff00ffff00ff00, 0xffff00ffff00ffff,
+ 0xffff00ffffff0000, 0xffff00ffffff00ff,
+ 0xffff00ffffffff00, 0xffff00ffffffffff,
+ 0xffffff0000000000, 0xffffff00000000ff,
+ 0xffffff000000ff00, 0xffffff000000ffff,
+ 0xffffff0000ff0000, 0xffffff0000ff00ff,
+ 0xffffff0000ffff00, 0xffffff0000ffffff,
+ 0xffffff00ff000000, 0xffffff00ff0000ff,
+ 0xffffff00ff00ff00, 0xffffff00ff00ffff,
+ 0xffffff00ffff0000, 0xffffff00ffff00ff,
+ 0xffffff00ffffff00, 0xffffff00ffffffff,
+ 0xffffffff00000000, 0xffffffff000000ff,
+ 0xffffffff0000ff00, 0xffffffff0000ffff,
+ 0xffffffff00ff0000, 0xffffffff00ff00ff,
+ 0xffffffff00ffff00, 0xffffffff00ffffff,
+ 0xffffffffff000000, 0xffffffffff0000ff,
+ 0xffffffffff00ff00, 0xffffffffff00ffff,
+ 0xffffffffffff0000, 0xffffffffffff00ff,
+ 0xffffffffffffff00, 0xffffffffffffffff
+#endif
+};
+
+int cfb8StippleMode, cfb8StippleAlu, cfb8StippleRRop;
+PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
+PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
+
+int
+cfb8SetStipple (alu, fg, planemask)
+int alu;
+unsigned long fg, planemask;
+{
+ unsigned long and, xor, rrop;
+ int s;
+ unsigned long c;
+
+ cfb8StippleMode = FillStippled;
+ cfb8StippleAlu = alu;
+ cfb8StippleFg = fg & PMSK;
+ cfb8StipplePm = planemask & PMSK;
+ rrop = cfbReduceRasterOp (alu, fg, planemask, &and, &xor);
+ cfb8StippleRRop = rrop;
+ /*
+ * create the appropriate pixel-fill bits for current
+ * foreground
+ */
+ for (s = 0; s < NUM_MASKS; s++)
+ {
+ c = cfb8StippleMasks[s];
+ cfb8StippleAnd[s] = and | ~c;
+ cfb8StippleXor[s] = xor & c;
+ }
+ return TRUE;
+}
+
+
+int
+cfb8SetOpaqueStipple (alu, fg, bg, planemask)
+int alu;
+unsigned long fg, bg, planemask;
+{
+ unsigned long andfg, xorfg, andbg, xorbg, rropfg, rropbg;
+ int s;
+ unsigned long c;
+
+ cfb8StippleMode = FillOpaqueStippled;
+ cfb8StippleAlu = alu;
+ cfb8StippleFg = fg & PMSK;
+ cfb8StippleBg = bg & PMSK;
+ cfb8StipplePm = planemask & PMSK;
+ rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg);
+ rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg);
+ if (rropfg == rropbg)
+ cfb8StippleRRop = rropfg;
+ else
+ cfb8StippleRRop = GXset;
+ /*
+ * create the appropriate pixel-fill bits for current
+ * foreground
+ */
+ for (s = 0; s < NUM_MASKS; s++)
+ {
+ c = cfb8StippleMasks[s];
+ cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c);
+ cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c);
+ }
+ return TRUE;
+}
+
+/*
+ * a grungy little routine. This computes clip masks
+ * for partial character blts. Returns rgnOUT if the
+ * entire character is clipped; returns rgnIN if the entire
+ * character is unclipped; returns rgnPART if a portion of
+ * the character is visible. Computes clip masks for each
+ * longword of the character -- and those with the
+ * contents of the glyph to compute the visible bits.
+ */
+
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+PixelGroup cfb8BitLenMasks[PGSZ] = {
+ 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff,
+ 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff,
+ 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff,
+ 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff,
+ 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff,
+ 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff,
+ 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f,
+ 0x0000000f, 0x00000007, 0x00000003, 0x00000001,
+};
+#else
+PixelGroup cfb8BitLenMasks[PGSZ] = {
+ 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8,
+ 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80,
+ 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800,
+ 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000,
+ 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000,
+ 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000,
+ 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000,
+ 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000,
+};
+#endif /* BITMAP_BIT_ORDER */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+PixelGroup cfb8BitLenMasks[PGSZ] = {
+ 0xffffffffffffffff, 0x7fffffffffffffff,
+ 0x3fffffffffffffff, 0x1fffffffffffffff,
+ 0x0fffffffffffffff, 0x07ffffffffffffff,
+ 0x03ffffffffffffff, 0x01ffffffffffffff,
+ 0x00ffffffffffffff, 0x007fffffffffffff,
+ 0x003fffffffffffff, 0x001fffffffffffff,
+ 0x000fffffffffffff, 0x0007ffffffffffff,
+ 0x0003ffffffffffff, 0x0001ffffffffffff,
+ 0x0000ffffffffffff, 0x00007fffffffffff,
+ 0x00003fffffffffff, 0x00001fffffffffff,
+ 0x00000fffffffffff, 0x000007ffffffffff,
+ 0x000003ffffffffff, 0x000001ffffffffff,
+ 0x000000ffffffffff, 0x0000007fffffffff,
+ 0x0000003fffffffff, 0x0000001fffffffff,
+ 0x0000000fffffffff, 0x00000007ffffffff,
+ 0x00000003ffffffff, 0x00000001ffffffff,
+ 0x00000000ffffffff, 0x000000007fffffff,
+ 0x000000003fffffff, 0x000000001fffffff,
+ 0x000000000fffffff, 0x0000000007ffffff,
+ 0x0000000003ffffff, 0x0000000001ffffff,
+ 0x0000000000ffffff, 0x00000000007fffff,
+ 0x00000000003fffff, 0x00000000001fffff,
+ 0x00000000000fffff, 0x000000000007ffff,
+ 0x000000000003ffff, 0x000000000001ffff,
+ 0x000000000000ffff, 0x0000000000007fff,
+ 0x0000000000003fff, 0x0000000000001fff,
+ 0x0000000000000fff, 0x00000000000007ff,
+ 0x00000000000003ff, 0x00000000000001ff,
+ 0x00000000000000ff, 0x000000000000007f,
+ 0x000000000000003f, 0x000000000000001f,
+ 0x000000000000000f, 0x0000000000000007,
+ 0x0000000000000003, 0x0000000000000001
+};
+#else
+PixelGroup cfb8BitLenMasks[PGSZ] = {
+ 0xffffffffffffffff, 0xfffffffffffffffe,
+ 0xfffffffffffffffc, 0xfffffffffffffff8,
+ 0xfffffffffffffff0, 0xffffffffffffffe0,
+ 0xffffffffffffffc0, 0xffffffffffffff80,
+ 0xffffffffffffff00, 0xfffffffffffffe00,
+ 0xfffffffffffffc00, 0xfffffffffffff800,
+ 0xfffffffffffff000, 0xffffffffffffe000,
+ 0xffffffffffffc000, 0xffffffffffff8000,
+ 0xffffffffffff0000, 0xfffffffffffe0000,
+ 0xfffffffffffc0000, 0xfffffffffff80000,
+ 0xfffffffffff00000, 0xffffffffffe00000,
+ 0xffffffffffc00000, 0xffffffffff800000,
+ 0xffffffffff000000, 0xfffffffffe000000,
+ 0xfffffffffc000000, 0xfffffffff8000000,
+ 0xfffffffff0000000, 0xffffffffe0000000,
+ 0xffffffffc0000000, 0xffffffff80000000,
+ 0xffffffff00000000, 0xfffffffe00000000,
+ 0xfffffffc00000000, 0xfffffff800000000,
+ 0xfffffff000000000, 0xffffffe000000000,
+ 0xffffffc000000000, 0xffffff8000000000,
+ 0xffffff0000000000, 0xfffffe0000000000,
+ 0xfffffc0000000000, 0xfffff80000000000,
+ 0xfffff00000000000, 0xffffe00000000000,
+ 0xffffc00000000000, 0xffff800000000000,
+ 0xffff000000000000, 0xfffe000000000000,
+ 0xfffc000000000000, 0xfff8000000000000,
+ 0xfff0000000000000, 0xffe0000000000000,
+ 0xffc0000000000000, 0xff80000000000000,
+ 0xff00000000000000, 0xfe00000000000000,
+ 0xfc00000000000000, 0xf800000000000000,
+ 0xf000000000000000, 0xe000000000000000,
+ 0xc000000000000000, 0x8000000000000000
+};
+#endif /* BITMAP_BIT_ORDER */
+#endif /* PGSZ */
+
+
+
+int
+cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips)
+ BoxPtr pBox;
+ int numRects;
+ int x, y, w, h;
+ CARD32 *clips;
+{
+ int yBand, yBandBot;
+ int ch;
+ unsigned long clip;
+ int partIN = FALSE, partOUT = FALSE;
+ int result;
+
+ if (numRects == 0)
+ return rgnOUT;
+ while (numRects && pBox->y2 <= y)
+ {
+ --numRects;
+ ++pBox;
+ }
+ if (!numRects || pBox->y1 >= y + h)
+ return rgnOUT;
+ yBand = pBox->y1;
+ while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
+ {
+ --numRects;
+ ++pBox;
+ }
+ if (!numRects || pBox->y1 >= y + h)
+ return rgnOUT;
+ if (numRects &&
+ x >= pBox->x1 &&
+ x + w <= pBox->x2 &&
+ y >= pBox->y1 &&
+ y + h <= pBox->y2)
+ {
+ return rgnIN;
+ }
+ ch = 0;
+ while (numRects && pBox->y1 < y + h)
+ {
+ yBand = pBox->y1;
+ yBandBot = pBox->y2;
+ while (ch < h && y + ch < yBand)
+ {
+ partOUT = TRUE;
+ clips[ch++] = 0;
+ }
+ if (ch >= h)
+ break;
+ while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
+ {
+ --numRects;
+ ++pBox;
+ }
+ if (!numRects)
+ break;
+ clip = 0;
+ while (numRects && pBox->y1 == yBand && pBox->x1 < x + w)
+ {
+ if (x < pBox->x1)
+ if (pBox->x2 < x + w)
+ clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x];
+ else
+ clip |= cfb8BitLenMasks[pBox->x1 - x];
+ else
+ if (pBox->x2 < x + w)
+ clip |= ~cfb8BitLenMasks[pBox->x2 - x];
+ else
+ clip = ~0;
+ --numRects;
+ ++pBox;
+ }
+ if (clip != 0)
+ partIN = TRUE;
+ if (clip != ~0)
+ partOUT = TRUE;
+ while (ch < h && y + ch < yBandBot)
+ clips[ch++] = clip;
+ while (numRects && pBox->y1 == yBand)
+ {
+ --numRects;
+ ++pBox;
+ }
+ }
+ while (ch < h)
+ {
+ partOUT = TRUE;
+ clips[ch++] = 0;
+ }
+ result = rgnOUT;
+ if (partIN)
+ {
+ if (partOUT)
+ result = rgnPART;
+ else
+ result = rgnIN;
+ }
+ return result;
+}
+
+#endif /* PSZ == 8 */
diff --git a/xc/programs/Xserver/cfb/cfb8bit.h b/xc/programs/Xserver/cfb/cfb8bit.h
new file mode 100644
index 000000000..a6ee778d8
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb8bit.h
@@ -0,0 +1,1572 @@
+/*
+ * cfb8bit.h
+ *
+ * Defines which are only useful to 8 bit color frame buffers
+ *
+ * That doesn't seem to be true any more. Some of the macros in here
+ * are used for depths other than 8. Perhaps the file should be
+ * renamed. dpw
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfb8bit.h,v 3.3 1998/10/04 09:37:34 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/* $TOG: cfb8bit.h /main/19 1998/02/09 14:04:05 kaleb $ */
+
+#include "servermd.h"
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define GetBitGroup(x) (((PixelGroup) (x)) >> (PGSZ - PGSZB))
+#define NextBitGroup(x) ((x) <<= PGSZB)
+#define NextSomeBits(x,n) ((x) <<= (n))
+#else
+#define GetBitGroup(x) ((x) & PGSZBMSK)
+#define NextBitGroup(x) ((x) >>= PGSZB)
+#define NextSomeBits(x,n) ((x) >>= (n))
+#endif
+
+#define RotBitsLeft(x,k) ((x) = BitLeft (x,k) | \
+ BitRight (x, PGSZ-(k)))
+
+#if defined(__GNUC__) && defined(mc68020)
+#undef RotBitsLeft
+#define RotBitsLeft(x,k) asm("rol%.l %2,%0" \
+ : "=d" (x) \
+ : "0" (x), "dI" (k))
+#endif
+
+#if PSZ == 8
+
+#define GetPixelGroup(x) (cfb8StippleXor[GetBitGroup(x)])
+#define RRopPixels(dst,x) (DoRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x]))
+#define RRopPixelGroup(dst,x) (RRopPixels(dst,GetBitGroup(x)))
+#define MaskRRopPixels(dst,x,mask) (DoMaskRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x], mask))
+
+#define NUM_MASKS (1<<PPW) /* XXX goes in cfbmskbits.h? */
+extern int cfb8StippleMode, cfb8StippleAlu;
+extern PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
+extern PixelGroup cfb8StippleMasks[NUM_MASKS];
+extern PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
+extern int cfb8StippleRRop;
+
+#define cfb8PixelMasks cfb8StippleMasks
+#define cfb8Pixels cfb8StippleXor
+
+#define cfb8CheckPixels(fg, bg) \
+ (FillOpaqueStippled == cfb8StippleMode && \
+ GXcopy == cfb8StippleAlu && \
+ ((fg) & PMSK) == cfb8StippleFg && \
+ ((bg) & PMSK) == cfb8StippleBg && \
+ PMSK == cfb8StipplePm)
+
+#define cfb8CheckOpaqueStipple(alu,fg,bg,pm) \
+ ((FillOpaqueStippled == cfb8StippleMode && \
+ (alu) == cfb8StippleAlu && \
+ ((fg) & PMSK) == cfb8StippleFg && \
+ ((bg) & PMSK) == cfb8StippleBg && \
+ ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetOpaqueStipple(alu,fg,bg,pm))
+
+#define cfb8CheckStipple(alu,fg,pm) \
+ ((FillStippled == cfb8StippleMode && \
+ (alu) == cfb8StippleAlu && \
+ ((fg) & PMSK) == cfb8StippleFg && \
+ ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetStipple(alu,fg,pm))
+
+#define cfb8SetPixels(fg,bg) cfb8SetOpaqueStipple(GXcopy,fg,bg,PMSK)
+
+/*
+ * These macros are shared between the unnatural spans code
+ * and the unnatural rectangle code. No reasonable person
+ * would attempt to use them anyplace else.
+ */
+
+#define NextUnnaturalStippleWord \
+ if (bitsLeft >= MFB_PPW) \
+ { \
+ inputBits = *srcTemp++; \
+ bitsLeft -= MFB_PPW; \
+ partBitsLeft = MFB_PPW; \
+ } \
+ else \
+ { \
+ inputBits = 0; \
+ if (bitsLeft) \
+ inputBits = *srcTemp & ~cfb8BitLenMasks[bitsLeft]; \
+ srcTemp = srcStart; \
+ partBitsLeft = bitsLeft; \
+ bitsLeft = bitsWhole; \
+ }
+
+#define NextUnnaturalStippleBits \
+ if (partBitsLeft >= PPW) { \
+ bits = GetBitGroup (inputBits); \
+ NextBitGroup (inputBits); \
+ partBitsLeft -= PPW; \
+ } else { \
+ bits = GetBitGroup (inputBits); \
+ nextPartBits = PPW - partBitsLeft; \
+ NextUnnaturalStippleWord \
+ if (partBitsLeft < nextPartBits) { \
+ if (partBitsLeft) {\
+ bits |= BitRight (GetBitGroup (inputBits), \
+ PPW - nextPartBits) & PPWMSK;\
+ nextPartBits -= partBitsLeft; \
+ } \
+ NextUnnaturalStippleWord \
+ } \
+ bits |= BitRight (GetBitGroup (inputBits), \
+ PPW - nextPartBits) & PPWMSK; \
+ NextSomeBits (inputBits, nextPartBits); \
+ partBitsLeft -= nextPartBits; \
+ }
+
+#define NextUnnaturalStippleBitsFast \
+ if (partBitsLeft >= PPW) { \
+ bits = GetBitGroup(inputBits); \
+ NextBitGroup(inputBits); \
+ partBitsLeft -= PPW; \
+ } else { \
+ bits = GetBitGroup (inputBits); \
+ nextPartBits = PPW - partBitsLeft; \
+ inputBits = *srcTemp++; \
+ bits |= BitRight (GetBitGroup (inputBits), \
+ partBitsLeft) & PPWMSK; \
+ NextSomeBits (inputBits, nextPartBits); \
+ partBitsLeft = MFB_PPW - nextPartBits; \
+ }
+
+/*
+ * WriteBitGroup takes the destination address, a pixel
+ * value (which must be 8 bits duplicated 4 time with PFILL)
+ * and the PPW bits to write, which must be in the low order
+ * bits of the register (probably from GetBitGroup) and writes
+ * the appropriate locations in memory with the pixel value. This
+ * is a copy-mode only operation.
+ */
+
+#define RRopBitGroup(dst,bits) \
+ { \
+ register PixelGroup _bitsTmp = (bits); \
+ *(dst) = RRopPixels(*(dst),bits); \
+ }
+
+#define MaskRRopBitGroup(dst,bits,mask) \
+ { \
+ register PixelGroup _bitsTmp = (bits); \
+ *(dst) = MaskRRopPixels(*(dst),bits,mask); \
+ }
+#endif /* PSZ == 8 */
+
+#if !defined(AVOID_MEMORY_READ) && PSZ == 8
+
+#define WriteBitGroup(dst,pixel,bits) \
+ { \
+ register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
+ *(dst) = (*(dst) & ~_maskTmp) | ((pixel) & _maskTmp); \
+ }
+
+#define SwitchBitGroup(dst,pixel,bits) \
+ { \
+ register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
+ register PixelGroup _pixTmp = ((pixel) & _maskTmp); \
+ _maskTmp = ~_maskTmp; \
+ SwitchBitsLoop (*(dst) = (*(dst) & _maskTmp) | _pixTmp;) \
+ }
+
+#else /* AVOID_MEMORY_READ */
+
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define SinglePixel0 3
+#define SinglePixel1 2
+#define SinglePixel2 1
+#define SinglePixel3 0
+#define SinglePixel4 7
+#define SinglePixel5 6
+#define SinglePixel6 5
+#define SinglePixel7 4
+#define SinglePixel8 0xB
+#define SinglePixel9 0xA
+#define DoublePixel0 1
+#define DoublePixel1 0
+#define DoublePixel2 3
+#define DoublePixel3 2
+#define DoublePixel4 5
+#define DoublePixel5 4
+#else
+#define SinglePixel0 0
+#define SinglePixel1 1
+#define SinglePixel2 2
+#define SinglePixel3 3
+#define SinglePixel4 4
+#define SinglePixel5 5
+#define SinglePixel6 6
+#define SinglePixel7 7
+#define SinglePixel8 8
+#define SinglePixel9 9
+#define DoublePixel0 0
+#define DoublePixel1 1
+#define DoublePixel2 2
+#define DoublePixel3 3
+#define DoublePixel4 4
+#define DoublePixel5 5
+#endif
+#define QuadPixel0 0
+#define QuadPixel1 1
+#define QuadPixel2 2
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define SinglePixel0 7
+#define SinglePixel1 6
+#define SinglePixel2 5
+#define SinglePixel3 4
+#define SinglePixel4 3
+#define SinglePixel5 2
+#define SinglePixel6 1
+#define SinglePixel7 0
+#define DoublePixel0 3
+#define DoublePixel1 2
+#define DoublePixel2 1
+#define DoublePixel3 0
+#define QuadPixel0 1
+#define QuadPixel1 0
+#else
+#define SinglePixel0 0
+#define SinglePixel1 1
+#define SinglePixel2 2
+#define SinglePixel3 3
+#define SinglePixel4 4
+#define SinglePixel5 5
+#define SinglePixel6 6
+#define SinglePixel7 7
+#define DoublePixel0 0
+#define DoublePixel1 1
+#define DoublePixel2 2
+#define DoublePixel3 3
+#define QuadPixel0 0
+#define QuadPixel1 1
+#endif
+#define OctaPixel0 0
+#endif /* PGSZ == 64 */
+
+#if PSZ == 8
+
+#if PGSZ == 32
+#define WriteBitGroup(dst,pixel,bits) \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[0] = (pixel); \
+ break; \
+ }
+#else /* PGSZ == 64 */
+#define WriteBitGroup(dst,pixel,bits) \
+ if ( bits == 0xff ) \
+ ((PixelGroup *) (dst))[OctaPixel0] = (pixel); \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ break; \
+ } \
+ }
+#endif /* PGSZ == 64 */
+
+#if PGSZ == 32
+#define SwitchBitGroup(dst,pixel,bits) { \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);) \
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[0] = (pixel);) \
+ break; \
+ } \
+}
+#else /* PGSZ == 64 */
+#define SwitchBitGroup(dst,pixel,bits) { \
+ if ( bits == 0xff ) \
+ SwitchBitsLoop (((PixelGroup *) (dst))[OctaPixel0] = (pixel);) \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);)\
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel);) \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel);)\
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel1] = (pixel);) \
+ break; \
+ } \
+ } \
+}
+#endif /* PGSZ == 64 */
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+
+#if PGSZ == 32
+#define WriteBitGroup(dst,pixel,bits) \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ }
+#else /* PGSZ == 64 */
+#define WriteBitGroup(dst,pixel,bits) \
+ if ( bits == 0xff ) { \
+ ((PixelGroup *) (dst))[QuadPixel0] = (pixel); \
+ ((PixelGroup *) (dst))[QuadPixel1] = (pixel); \
+ } \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
+ break; \
+ } \
+ }
+#endif /* PGSZ */
+
+#if PGSZ == 32
+#define SwitchBitGroup(dst,pixel,bits) { \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel);) \
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
+ break; \
+ } \
+}
+#else /* PGSZ == 64 */
+#define SwitchBitGroup(dst,pixel,bits) { \
+ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
+#endif /* PGSZ */
+
+#endif /* PSZ == 16 */
+
+#if PSZ == 24
+/* 32 000011112222*/
+/* 24 000111222333*/
+/* 16 001122334455*/
+/* 8 0123456789AB*/
+#if PGSZ == 32
+#define WriteBitGroup(dst,pixel,bits) \
+ { \
+ register CARD32 reg_pixel = (pixel); \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \
+ break; \
+ case 2: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
+ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
+ break; \
+ case 3: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
+ ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \
+ break; \
+ case 4: \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \
+ break; \
+ case 5: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 16; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 6: \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 7: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
+ break; \
+ case 8: \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \
+ break; \
+ case 9: \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \
+ break; \
+ case 10: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ break; \
+ case 11: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
+ break; \
+ case 12: \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 13: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel2] = \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 14: \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
+ break; \
+ case 15: \
+ ((CARD16 *) (dst))[DoublePixel0] = \
+ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
+ ((CARD8 *) (dst))[SinglePixel3] = \
+ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD16 *) (dst))[DoublePixel2] = \
+ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
+ reg_pixel >>= 8; \
+ ((CARD8 *) (dst))[SinglePixel8] = \
+ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
+ break; \
+ } \
+ }
+#else /* PGSZ == 64 */
+#define WriteBitGroup(dst,pixel,bits) \
+ if ( bits == 0xff ) { \
+ ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
+ } \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ } \
+ }
+#endif /* PGSZ */
+
+#if PGSZ == 32
+#define SwitchBitGroup(dst,pixel,bits) { \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \
+ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
+ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
+ break; \
+ } \
+}
+#else /* PGSZ == 64 */
+#define SwitchBitGroup(dst,pixel,bits) { \
+ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
+#endif /* PGSZ */
+
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+
+#if PGSZ == 32
+#define WriteBitGroup(dst,pixel,bits) \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ }
+#else /* PGSZ == 64 */
+#define WriteBitGroup(dst,pixel,bits) \
+ if ( bits == 0xff ) { \
+ ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
+ ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
+ } \
+ else { \
+ switch (bits & 0x0f) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
+ break; \
+ } \
+ switch ((bits & 0xf0) >> 4) { \
+ case 0: \
+ break; \
+ case 1: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ break; \
+ case 2: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 3: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ break; \
+ case 4: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 5: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 6: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 7: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ break; \
+ case 8: \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 9: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 10: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 11: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 12: \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 13: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 14: \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ case 15: \
+ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
+ break; \
+ } \
+ }
+#endif /* PGSZ */
+
+#if PGSZ == 32
+#define SwitchBitGroup(dst,pixel,bits) { \
+ switch (bits) { \
+ case 0: \
+ break; \
+ case 1: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel);) \
+ break; \
+ case 2: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
+ break; \
+ case 3: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
+ break; \
+ case 4: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 5: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 6: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 7: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
+ break; \
+ case 8: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 9: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 10: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 11: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 12: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 13: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 14: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ case 15: \
+ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
+ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
+ break; \
+ } \
+}
+#else /* PGSZ == 64 */
+#define SwitchBitGroup(dst,pixel,bits) { \
+ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
+#endif /* PGSZ */
+
+#endif /* PSZ == 32 */
+#endif /* AVOID_MEMORY_READ */
+
+extern PixelGroup cfb8BitLenMasks[PGSZ];
+
+extern int cfb8SetStipple (
+#if NeedFunctionPrototypes
+ int /*alu*/,
+ unsigned long /*fg*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern int cfb8SetOpaqueStipple (
+#if NeedFunctionPrototypes
+ int /*alu*/,
+ unsigned long /*fg*/,
+ unsigned long /*bg*/,
+ unsigned long /*planemask*/
+#endif
+);
+
+extern int cfb8ComputeClipMasks32 (
+#if NeedFunctionPrototypes
+ BoxPtr /*pBox*/,
+ int /*numRects*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ CARD32 * /*clips*/
+#endif
+);
diff --git a/xc/programs/Xserver/cfb/cfb8line.c b/xc/programs/Xserver/cfb/cfb8line.c
new file mode 100644
index 000000000..a9a866f19
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfb8line.c
@@ -0,0 +1,1482 @@
+/*
+ * $TOG: cfb8line.c /main/34 1998/02/09 14:04:19 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ *
+ * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.10 1999/03/28 15:32:11 dawes Exp $
+ * Jeff Anton'x fixes: cfb8line.c 97/02/07
+ */
+
+#include "X.h"
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "mistruct.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfbrrop.h"
+#include "miline.h"
+
+#ifdef PIXEL_ADDR
+
+#if defined(__GNUC__) && defined(mc68020)
+#define STUPID volatile
+#define REARRANGE
+#else
+#define STUPID
+#endif
+
+#ifdef __GNUC__
+/* lame compiler doesn't even look at 'register' attributes */
+#define I_H do{
+#define I_T }while(0);
+#define IMPORTANT_START I_H I_H I_H I_H I_H I_H I_H I_H I_H I_H
+#define IMPORTANT_END I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T
+#else
+#define IMPORTANT_START
+#define IMPORTANT_END
+#endif
+
+#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
+
+#ifdef POLYSEGMENT
+
+# ifdef sun
+# define WIDTH_FAST 1152
+# endif
+
+# ifdef ultrix
+# define WIDTH_FAST 1024
+# endif
+
+# ifdef Mips
+# define WIDTH_FAST 4096
+# endif
+# ifdef WIDTH_FAST
+# if WIDTH_FAST == 1024
+# define FAST_MUL(y) ((y) << 10)
+# endif
+
+# if WIDTH_FAST == 1152
+# define FAST_MUL(y) (((y) << 10) + ((y) << 7))
+# endif
+
+# if WIDTH_FAST == 1280
+# define FAST_MUL(y) (((y) << 10) + ((y) << 8))
+# endif
+
+# if WIDTH_FAST == 2048
+# define FAST_MUL(y) ((y) << 11)
+# endif
+
+# if WIDTH_FAST == 4096
+# define FAST_MUL(y) ((y) << 12)
+# endif
+# endif
+
+# if defined(WIDTH_SHIFT)
+# ifdef FAST_MUL
+# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Shift))
+# if RROP == GXcopy
+# define INCLUDE_OTHERS
+# define SERIOUS_UNROLLING
+# endif
+# define INCLUDE_DRAW
+# define NWIDTH(nwidth) WIDTH_FAST
+# define WIDTH_MUL(y,w) FAST_MUL(y)
+# endif
+# else
+# define FUNC_NAME(e) RROP_NAME(e)
+# define WIDTH_MUL(y,w) ((y) * (w))
+# define NWIDTH(nwidth) (nwidth)
+# define INCLUDE_DRAW
+# if !defined (FAST_MUL) && RROP == GXcopy
+# define INCLUDE_OTHERS
+# define SERIOUS_UNROLLING
+# endif
+# endif
+#else
+
+# define INCLUDE_DRAW
+# define WIDTH_MUL(y,w) ((y) * (w))
+# define NWIDTH(nwidth) nwidth
+# ifdef PREVIOUS
+# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Previous))
+# else
+# define FUNC_NAME(e) RROP_NAME(e)
+# if RROP == GXcopy
+# define INCLUDE_OTHERS
+# ifdef PLENTIFUL_REGISTERS
+# define SAVE_X2Y2
+# endif
+# define ORIGIN
+# define SERIOUS_UNROLLING
+# else
+# define EITHER_MODE
+# endif
+# endif
+#endif
+
+#if PSZ == 24
+#define PXL2ADR(x) ((x)*3 >> 2)
+
+#if RROP == GXcopy
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
+ *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#endif
+#if RROP == GXxor
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp ^= piQxelXor[0] & 0xFFFFFF; \
+ break; \
+ case 1: \
+ *addrp ^= piQxelXor[2] & 0xFFFFFF00; \
+ break; \
+ case 3: \
+ *addrp ^= piQxelXor[0] & 0xFF000000; \
+ *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \
+ break; \
+ case 2: \
+ *addrp ^= piQxelXor[1] & 0xFFFF0000; \
+ *(addrp+1) ^= piQxelXor[2] & 0xFF; \
+ break; \
+ }
+#endif
+#if RROP == GXand
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp &= piQxelAnd[0] | 0xFF000000; \
+ break; \
+ case 1: \
+ *addrp &= piQxelAnd[2] | 0xFF; \
+ break; \
+ case 3: \
+ *addrp &= 0xFFFFFF | piQxelAnd[0]; \
+ *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \
+ break; \
+ case 2: \
+ *addrp &= 0xFFFF | piQxelAnd[1]; \
+ *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \
+ break; \
+ }
+#endif
+#if RROP == GXor
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp |= piQxelOr[0] & 0xFFFFFF; \
+ break; \
+ case 1: \
+ *addrp |= piQxelOr[2] & 0xFFFFFF00; \
+ break; \
+ case 3: \
+ *addrp |= piQxelOr[0] & 0xFF000000; \
+ *(addrp+1) |= piQxelOr[1] & 0xFFFF; \
+ break; \
+ case 2: \
+ *addrp |= piQxelOr[1] & 0xFFFF0000; \
+ *(addrp+1) |= piQxelOr[2] & 0xFF; \
+ break; \
+ }
+#endif
+#if RROP == GXset
+#define body_rop \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \
+ ^ (piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \
+ ^ (piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \
+ ^ (piQxelXor[0] & 0xFF000000); \
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \
+ ^ (piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \
+ ^ (piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \
+ ^ (piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#endif
+#endif /* PSZ == 24 */
+
+#define BUGFIX_clip
+
+#ifdef INCLUDE_DRAW
+
+int
+#ifdef POLYSEGMENT
+FUNC_NAME(cfb8SegmentSS1Rect) (pDrawable, pGC, nseg, pSegInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ xSegment *pSegInit;
+#else
+FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
+ x1p,y1p,x2p,y2p)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit, pptInitOrig;
+ int *x1p, *y1p, *x2p, *y2p;
+#endif /* POLYSEGEMENT */
+{
+ register long e;
+ register int y1_or_e1;
+ register PixelType *addrp;
+ register int stepmajor;
+ register int stepminor;
+#ifndef REARRANGE
+ register long e3;
+#endif
+#ifdef mc68000
+ register short x1_or_len;
+#else
+ register int x1_or_len;
+#endif
+ RROP_DECLARE
+
+#ifdef SAVE_X2Y2
+# define c2 y2
+#else
+ register int c2;
+#endif
+#ifndef ORIGIN
+ register int _x1, _y1, _x2, _y2; /* only used for CoordModePrevious */
+ int extents_x1, extents_y1, extents_x2, extents_y2;
+#endif /* !ORIGIN */
+#ifndef PREVIOUS
+ register int upperleft, lowerright;
+ CARD32 ClipMask = 0x80008000;
+#endif /* !PREVIOUS */
+#ifdef POLYSEGMENT
+ register int capStyle;
+#endif /* POLYSEGMENT */
+#ifdef SAVE_X2Y2
+ register int x2, y2;
+# define X1 x1_or_len
+# define Y1 y1_or_e1
+# define X2 x2
+# define Y2 y2
+#else
+# ifdef POLYSEGMENT
+# define X1 x1_or_len
+# define Y1 y1_or_e1
+# else
+# define X1 intToX(y1_or_e1)
+# define Y1 intToY(y1_or_e1)
+# endif /* POLYSEGMENT */
+# define X2 intToX(c2)
+# define Y2 intToY(c2)
+#endif /* SAVE_X2Y2 */
+ PixelType *addr;
+ int nwidth;
+ cfbPrivGCPtr devPriv;
+ BoxPtr extents;
+ int *ppt;
+#if PSZ == 24
+ int xBase; /* x of addr */
+ int xOffset; /* x of addrp */
+ int xOffset_t; /* x of t */
+ PixelType *addrLineEnd;
+ char *addrb;
+ int stepmajor3, stepminor3, majordx, minordx;
+#endif
+#ifdef BUGFIX_clip
+ int ex_x1, ex_y1, ex_x2, ex_y2;
+#endif
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+
+ devPriv = cfbGetGCPrivate(pGC);
+ cfbGetPixelWidthAndPointer (pDrawable, nwidth, addr);
+#ifndef REARRANGE
+ RROP_FETCH_GCPRIV(devPriv);
+#endif
+ extents = &pGC->pCompositeClip->extents;
+#ifndef PREVIOUS
+ c2 = *((int *) &pDrawable->x);
+ c2 -= (c2 & 0x8000) << 1;
+ upperleft = *((int *) &extents->x1) - c2;
+ lowerright = *((int *) &extents->x2) - c2 - 0x00010001;
+#endif /* !PREVIOUS */
+#ifdef BUGFIX_clip
+ ex_x1 = extents->x1 - pDrawable->x;
+ ex_y1 = extents->y1 - pDrawable->y;
+ ex_x2 = extents->x2 - pDrawable->x;
+ ex_y2 = extents->y2 - pDrawable->y;
+#endif
+#if PSZ == 24
+ xBase = pDrawable->x;
+ addr += WIDTH_MUL(pDrawable->y,nwidth);
+#else
+ addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x;
+#endif
+#ifdef POLYSEGMENT
+ capStyle = pGC->capStyle - CapNotLast;
+ ppt = (int *) pSegInit;
+ while (nseg--)
+#else /* POLYSEGMENT */
+#ifdef EITHER_MODE
+ mode -= CoordModePrevious;
+ if (!mode)
+#endif /* EITHER_MODE */
+#ifndef ORIGIN
+ { /* CoordModePrevious */
+ ppt = (int *)pptInit + 1;
+ _x1 = *x1p;
+ _y1 = *y1p;
+ extents_x1 = extents->x1 - pDrawable->x;
+ extents_x2 = extents->x2 - pDrawable->x;
+ extents_y1 = extents->y1 - pDrawable->y;
+ extents_y2 = extents->y2 - pDrawable->y;
+ if (_x1 < extents_x1 || _x1 >= extents_x2 ||
+ _y1 < extents_y1 || _y1 >= extents_y2)
+ {
+ c2 = *ppt++;
+ intToCoord(c2, _x2, _y2);
+ *x2p = _x1 + _x2;
+ *y2p = _y1 + _y2;
+ return 1;
+ }
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(_y1, nwidth);
+ xOffset = xBase + _x1;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
+ addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1;
+#endif
+ _x2 = _x1;
+ _y2 = _y1;
+ }
+#endif /* !ORIGIN */
+#ifdef EITHER_MODE
+ else
+#endif /* EITHER_MODE */
+#ifndef PREVIOUS
+ {
+ ppt = (int *) pptInit;
+ c2 = *ppt++;
+ if (isClipped (c2, upperleft, lowerright))
+ {
+ return 1;
+ }
+#ifdef SAVE_X2Y2
+ intToCoord(c2,x2,y2);
+#endif
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(Y2, nwidth);
+ xOffset = xBase + X2;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
+ addrp = addr + WIDTH_MUL(Y2, nwidth) + X2;
+#endif
+ }
+#endif /* !PREVIOUS */
+ while (--npt)
+#endif /* POLYSEGMENT */
+ {
+#ifdef POLYSEGMENT
+ y1_or_e1 = ppt[0];
+ c2 = ppt[1];
+ ppt += 2;
+ if (isClipped(y1_or_e1,upperleft,lowerright)|isClipped(c2,upperleft,lowerright))
+ break;
+ intToCoord(y1_or_e1,x1_or_len,y1_or_e1);
+ /* compute now to avoid needing x1, y1 later */
+#if PSZ == 24
+ addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth);
+ xOffset = xBase + x1_or_len;
+ addrb = (char *)addrLineEnd + xOffset * 3;
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#else
+ addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len;
+#endif
+#else /* !POLYSEGMENT */
+#ifdef EITHER_MODE
+ if (!mode)
+#endif /* EITHER_MODE */
+#ifndef ORIGIN
+ {
+ /* CoordModePrevious */
+ _x1 = _x2;
+ _y1 = _y2;
+ c2 = *ppt++;
+ intToCoord(c2, _x2, _y2);
+ _x2 = _x1 + _x2;
+ _y2 = _y1 + _y2;
+
+#ifdef BUGFIX_clip
+ if (_x2 < ex_x1 || _x2 >= ex_x2 ||
+ _y2 < ex_y1 || _y2 >= ex_y2)
+#else
+ if (_x2 < extents_x1 || _x2 >= extents_x2 ||
+ _y2 < extents_y1 || _y2 >= extents_y2)
+#endif
+ {
+ break;
+ }
+ CalcLineDeltas(_x1, _y1, _x2, _y2, x1_or_len, y1_or_e1,
+ stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
+ }
+#endif /* !ORIGIN */
+#ifdef EITHER_MODE
+ else
+#endif /* EITHER_MODE */
+#ifndef PREVIOUS
+ {
+#ifndef SAVE_X2Y2
+ y1_or_e1 = c2;
+#else
+ y1_or_e1 = y2;
+ x1_or_len = x2;
+#endif /* SAVE_X2Y2 */
+ c2 = *ppt++;
+
+ if (isClipped (c2, upperleft, lowerright))
+ break;
+#ifdef SAVE_X2Y2
+ intToCoord(c2,x2,y2);
+#endif
+ CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1,
+ stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
+ }
+#endif /* !PREVIOUS */
+#endif /* POLYSEGMENT */
+
+#ifdef POLYSEGMENT
+ CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1,
+ stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
+ /*
+ * although the horizontal code works for polyline, it
+ * slows down 10 pixel lines by 15%. Thus, this
+ * code is optimized for horizontal segments and
+ * random orientation lines, which seems like a reasonable
+ * assumption
+ */
+ if (y1_or_e1 != 0)
+ {
+#endif /* POLYSEGMENT */
+ if (x1_or_len < y1_or_e1)
+ {
+#ifdef REARRANGE
+ register int e3;
+#endif
+
+ e3 = x1_or_len;
+ x1_or_len = y1_or_e1;
+ y1_or_e1 = e3;
+
+ e3 = stepminor;
+ stepminor = stepmajor;
+ stepmajor = e3;
+ SetYMajorOctant(octant);
+ }
+
+ e = -x1_or_len;
+#ifdef POLYSEGMENT
+ if (!capStyle)
+ x1_or_len--;
+#endif
+
+ {
+#ifdef REARRANGE
+ register int e3;
+ RROP_DECLARE
+ RROP_FETCH_GCPRIV(devPriv);
+#endif
+
+ y1_or_e1 = y1_or_e1 << 1;
+ e3 = e << 1;
+
+ FIXUP_ERROR(e, octant, bias);
+
+#if PSZ == 24
+ if (stepmajor == 1 || stepmajor == -1){
+ stepmajor3 = stepmajor * 3;
+ stepminor3 = stepminor * sizeof (long);
+ majordx = stepmajor; minordx = 0;
+ } else {
+ stepmajor3 = stepmajor * sizeof (long);
+ stepminor3 = stepminor * 3;
+ majordx = 0; minordx = stepminor;
+ }
+#endif
+
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepmajor3; \
+ xOffset += majordx; \
+ e += y1_or_e1; \
+ if (e >= 0){ \
+ addrb += stepminor3; \
+ xOffset += minordx; \
+ e += e3; \
+ } \
+ }
+#else /* PSZ == 24 */
+
+#define body {\
+ RROP_SOLID(addrp); \
+ addrp += stepmajor; \
+ e += y1_or_e1; \
+ if (e >= 0) \
+ { \
+ addrp += stepminor; \
+ e += e3; \
+ } \
+ }
+#endif /* PSZ == 24 */
+
+#ifdef LARGE_INSTRUCTION_CACHE
+
+# ifdef SERIOUS_UNROLLING
+# define UNROLL 16
+# else
+# define UNROLL 4
+# endif
+#define CASE(n) case -n: body
+
+ while ((x1_or_len -= UNROLL) >= 0)
+ {
+ body body body body
+# if UNROLL >= 8
+ body body body body
+# endif
+# if UNROLL >= 12
+ body body body body
+# endif
+# if UNROLL >= 16
+ body body body body
+# endif
+ }
+ switch (x1_or_len)
+ {
+ CASE(1) CASE(2) CASE(3)
+# if UNROLL >= 8
+ CASE(4) CASE(5) CASE(6) CASE(7)
+# endif
+# if UNROLL >= 12
+ CASE(8) CASE(9) CASE(10) CASE(11)
+# endif
+# if UNROLL >= 16
+ CASE(12) CASE(13) CASE(14) CASE(15)
+# endif
+ }
+#else /* !LARGE_INSTRUCTION_CACHE */
+
+ IMPORTANT_START
+ IMPORTANT_START
+
+ if (x1_or_len & 1)
+ body
+ x1_or_len >>= 1;
+ while (x1_or_len--) {
+ body body
+ }
+
+ IMPORTANT_END
+ IMPORTANT_END
+#endif /* LARGE_INSTRUCTION_CACHE */
+
+#ifdef POLYSEGMENT
+#if PSZ == 24
+ body_rop
+#else
+ RROP_SOLID(addrp);
+#endif
+#endif
+#if PSZ == 24
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+#endif
+ }
+#undef body
+#ifdef POLYSEGMENT
+ }
+ else /* Polysegment horizontal line optimization */
+ {
+# ifdef REARRANGE
+ register int e3;
+ RROP_DECLARE
+ RROP_FETCH_GCPRIV(devPriv);
+# endif /* REARRANGE */
+ if (stepmajor < 0)
+ {
+#if PSZ == 24
+ xOffset -= x1_or_len;
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#else
+ addrp -= x1_or_len;
+#endif
+ if (capStyle)
+ x1_or_len++;
+ else
+#if PSZ == 24
+ xOffset++;
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#else
+ addrp++;
+#endif
+ }
+ else
+ {
+#if PSZ == 24
+ addrp = addrLineEnd + PXL2ADR(xOffset);
+#endif
+ if (capStyle)
+ x1_or_len++;
+ }
+# if PSZ == 24
+ y1_or_e1 = xOffset & 3;
+# else
+# if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/
+ y1_or_e1 = ((long) addrp) & 0x7;
+ addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
+# else
+ y1_or_e1 = ((long) addrp) & PIM;
+ addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
+# endif
+#if PGSZ == 32
+# if PWSH != 2
+ y1_or_e1 >>= (2 - PWSH);
+# endif
+#else /* PGSZ == 64 */
+# if PWSH != 3
+ y1_or_e1 >>= (3 - PWSH);
+# endif
+#endif /* PGSZ */
+# endif /* PSZ == 24 */
+#if PSZ == 24
+ {
+#if RROP == GXcopy
+ register int nlmiddle;
+ int leftIndex = xOffset & 3;
+ int rightIndex = (xOffset + x1_or_len) & 3;
+#else
+ register int pidx;
+#endif
+
+#if RROP == GXcopy
+ nlmiddle = x1_or_len;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+ if(rightIndex){
+ nlmiddle -= rightIndex;
+ }
+
+ nlmiddle >>= 2;
+ switch(leftIndex+x1_or_len){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = piQxelXor[2];
+ break;
+ case 1:
+ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrp++ = piQxelXor[1];
+ *addrp = piQxelXor[2];
+ break;
+ case 2:
+ *addrp++ =((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *addrp = piQxelXor[2];
+ break;
+ case 3:
+ *addrp =((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ case 1:
+ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrp++ = piQxelXor[1];
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ case 2:
+ *addrp++ =((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+ break;
+ case 2:
+ switch(leftIndex){
+/*
+ case 2:
+ *addrp++ = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+*/
+ case 1:
+ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 0:
+ *addrp++ = piQxelXor[0];
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ if(x1_or_len){
+ *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ }
+/*
+ else{
+ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ }
+*/
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+/*
+ maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
+*/
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrp++ = piQxelXor[1];
+ *addrp++ = piQxelXor[2];
+ break;
+ case 2:
+ *addrp++ = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *addrp++ = piQxelXor[2];
+ break;
+ case 3:
+ *addrp++ = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ }
+ while(nlmiddle--){
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp++ = piQxelXor[2];
+ }
+ switch(rightIndex++){
+ case 0:
+ break;
+ case 1:
+ *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *addrp++ = piQxelXor[0];
+ *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 3:
+ *addrp++ = piQxelXor[0];
+ *addrp++ = piQxelXor[1];
+ *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+/*
+ if (e3){
+ e3 &= 0xFFFFFF;
+ switch(rightIndex&3){
+ case 0:
+ *addrp = ((*addrp) & (0xFF000000 | ~e3))
+ | (piQxelXor[0] & 0xFFFFFF & e3);
+ break;
+ case 1:
+ *addrp++ = ((*addrp) & (0xFFFFFF | ~(e3<<24)))
+ | (piQxelXor[0] & 0xFF000000 & (e3<<24));
+ *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8)))
+ | (piQxelXor[1] & 0xFFFF & (e3 >> 8));
+ break;
+ case 2:
+ *addrp++ = ((*addrp) & (0xFFFF|~(e3 << 16)))
+ | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16));
+ *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16)))
+ | (piQxelXor[2] & 0xFF & (e3 >> 16));
+ break;
+ case 3:
+ *addrp++ = ((*addrp) & (0xFF|~(e3<<8)))
+ | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8));
+ break;
+ }
+ }
+*/
+ }
+ }
+#else /* GXcopy */
+ addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03));
+ if (x1_or_len <= 1){
+ if (x1_or_len)
+ RROP_SOLID24(addrp, xOffset);
+ } else {
+ maskbits(xOffset, x1_or_len, e, e3, x1_or_len);
+ pidx = xOffset & 3;
+ if (e){
+ RROP_SOLID_MASK(addrp, e, pidx-1);
+ addrp++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ while (--x1_or_len >= 0){
+ RROP_SOLID(addrp, pidx);
+ addrp++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (e3)
+ RROP_SOLID_MASK(addrp, e3, pidx);
+ }
+#endif /* GXcopy */
+ }
+#else /* PSZ == 24 */
+ if (y1_or_e1 + x1_or_len <= PPW)
+ {
+ if (x1_or_len)
+ {
+ maskpartialbits(y1_or_e1, x1_or_len, e)
+#ifdef __sparc__
+ RROP_SOLID_MASK_lu((unsigned long *) addrp, e);
+#else
+ RROP_SOLID_MASK((unsigned long *) addrp, e);
+#endif
+ }
+ }
+ else
+ {
+ maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
+ if (e)
+ {
+ RROP_SOLID_MASK((unsigned long *) addrp, e);
+ addrp += PPW;
+ }
+#ifdef __sparc__
+ RROP_SPAN_lu(addrp, x1_or_len)
+#else
+ RROP_SPAN(addrp, x1_or_len)
+#endif
+ if (e3)
+#ifdef __sparc__
+ RROP_SOLID_MASK_lu((unsigned long *) addrp, e3);
+#else
+ RROP_SOLID_MASK((unsigned long *) addrp, e3);
+#endif
+ }
+#endif /* PSZ == 24 */
+ }
+#endif /* POLYSEGMENT */
+ }
+#ifdef POLYSEGMENT
+ if (nseg >= 0)
+ return (xSegment *) ppt - pSegInit;
+#else
+ if (npt)
+ {
+#ifdef EITHER_MODE
+ if (!mode)
+#endif /* EITHER_MODE */
+#ifndef ORIGIN
+ {
+ *x1p = _x1;
+ *y1p = _y1;
+ *x2p = _x2;
+ *y2p = _y2;
+ }
+#endif /* !ORIGIN */
+ return ((DDXPointPtr) ppt - pptInit) - 1;
+ }
+#endif /* POLYSEGMENT */
+
+#ifndef POLYSEGMENT
+# ifndef ORIGIN
+# define C2 c2
+# else
+# define C2 ppt[-1]
+# endif
+#ifdef EITHER_MODE
+ if (pGC->capStyle != CapNotLast &&
+ ((mode ? (C2 != *((int *) pptInitOrig))
+ : ((_x2 != pptInitOrig->x) ||
+ (_y2 != pptInitOrig->y)))
+ || (ppt == ((int *)pptInitOrig) + 2)))
+#endif /* EITHER_MODE */
+#ifdef PREVIOUS
+ if (pGC->capStyle != CapNotLast &&
+ ((_x2 != pptInitOrig->x) ||
+ (_y2 != pptInitOrig->y) ||
+ (ppt == ((int *)pptInitOrig) + 2)))
+#endif /* PREVIOUS */
+#ifdef ORIGIN
+ if (pGC->capStyle != CapNotLast &&
+ ((C2 != *((int *) pptInitOrig)) ||
+ (ppt == ((int *)pptInitOrig) + 2)))
+#endif /* !PREVIOUS */
+ {
+# ifdef REARRANGE
+ RROP_DECLARE
+
+ RROP_FETCH_GCPRIV(devPriv);
+# endif
+#if PSZ == 24
+#if RROP == GXcopy
+ switch(xOffset & 3){
+ case 0:
+ *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000);
+ *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXxor
+ switch(xOffset & 3){
+ case 0:
+ *addrp ^= (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp ^= (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp ^= (piQxelXor[0] & 0xFF000000);
+ *(addrp+1) ^= (piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp ^= (piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) ^= (piQxelXor[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXand
+ switch(xOffset & 3){
+ case 0:
+ *addrp &= (piQxelAnd[0] | 0xFF000000);
+ break;
+ case 3:
+ *addrp &= (piQxelAnd[2] | 0xFF);
+ break;
+ case 1:
+ *addrp &= (0xFFFFFF|piQxelAnd[0]);
+ *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]);
+ break;
+ case 2:
+ *addrp &= (0xFFFF|piQxelAnd[1]);
+ *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]);
+ break;
+ }
+#endif
+#if RROP == GXor
+ switch(xOffset & 3){
+ case 0:
+ *addrp |= (piQxelOr[0] & 0xFFFFFF);
+ break;
+ case 3:
+ *addrp |= (piQxelOr[2] & 0xFFFFFF00);
+ break;
+ case 1:
+ *addrp |= (piQxelOr[0] & 0xFF000000);
+ *(addrp+1) |= (piQxelOr[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp |= (piQxelOr[1] & 0xFFFF0000);
+ *(addrp+1) |= (piQxelOr[2] & 0xFF);
+ break;
+ }
+#endif
+#if RROP == GXset
+ switch(xOffset & 3){
+ case 0:
+ *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF));
+ break;
+ case 3:
+ *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00));
+ break;
+ case 1:
+ *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000));
+ *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF));
+ break;
+ case 2:
+ *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000));
+ *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF));
+ break;
+ }
+#endif
+#else
+ RROP_SOLID (addrp);
+# endif
+ }
+#endif /* !POLYSEGMENT */
+ return -1;
+}
+
+#endif /* INCLUDE_DRAW */
+
+
+#ifdef INCLUDE_OTHERS
+
+#ifdef POLYSEGMENT
+
+void
+cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ xSegment *pSegInit;
+{
+ int (*func)();
+ void (*clip)();
+ int drawn;
+ cfbPrivGCPtr devPriv;
+
+#if defined(__arm32__) && PSZ != 8
+ /* XXX -JJK */
+ /* There is a painting bug when PSZ != 8; I need to track it down! */
+ cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
+ return;
+#endif
+
+ devPriv = cfbGetGCPrivate(pGC);
+#ifdef NO_ONE_RECT
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
+ {
+ cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
+ return;
+ }
+#endif
+ switch (devPriv->rop)
+ {
+ case GXcopy:
+ func = cfb8SegmentSS1RectCopy;
+ clip = cfb8ClippedLineCopy;
+#ifdef FAST_MUL
+ if (cfbGetPixelWidth (pDrawable) == WIDTH_FAST)
+ func = cfb8SegmentSS1RectShiftCopy;
+#endif
+ break;
+ case GXxor:
+ func = cfb8SegmentSS1RectXor;
+ clip = cfb8ClippedLineXor;
+ break;
+ default:
+ func = cfb8SegmentSS1RectGeneral;
+ clip = cfb8ClippedLineGeneral;
+ break;
+ }
+ while (nseg)
+ {
+ drawn = (*func) (pDrawable, pGC, nseg, pSegInit);
+ if (drawn == -1)
+ break;
+ (*clip) (pDrawable, pGC,
+ pSegInit[drawn-1].x1, pSegInit[drawn-1].y1,
+ pSegInit[drawn-1].x2, pSegInit[drawn-1].y2,
+ &pGC->pCompositeClip->extents,
+ pGC->capStyle == CapNotLast);
+ pSegInit += drawn;
+ nseg -= drawn;
+ }
+}
+
+#else /* POLYSEGMENT */
+
+void
+cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int npt;
+ DDXPointPtr pptInit;
+{
+ int (*func)();
+ void (*clip)();
+ int drawn;
+ cfbPrivGCPtr devPriv;
+ int x1, y1, x2, y2;
+ DDXPointPtr pptInitOrig = pptInit;
+
+#if defined(__arm32__) && PSZ != 8
+ /* XXX -JJK */
+ /* There is a painting bug when PSZ != 8; I need to track it down! */
+ cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
+ return;
+#endif
+
+ devPriv = cfbGetGCPrivate(pGC);
+#ifdef NO_ONE_RECT
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
+ {
+ cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
+ return;
+ }
+#endif
+ switch (devPriv->rop)
+ {
+ case GXcopy:
+ func = cfb8LineSS1RectCopy;
+ clip = cfb8ClippedLineCopy;
+ if (mode == CoordModePrevious)
+ func = cfb8LineSS1RectPreviousCopy;
+ break;
+ case GXxor:
+ func = cfb8LineSS1RectXor;
+ clip = cfb8ClippedLineXor;
+ break;
+ default:
+ func = cfb8LineSS1RectGeneral;
+ clip = cfb8ClippedLineGeneral;
+ break;
+ }
+ if (mode == CoordModePrevious)
+ {
+ x1 = pptInit->x;
+ y1 = pptInit->y;
+ while (npt > 1)
+ {
+ drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
+ &x1, &y1, &x2, &y2);
+ if (drawn == -1)
+ break;
+ (*clip) (pDrawable, pGC, x1, y1, x2, y2,
+ &pGC->pCompositeClip->extents,
+ drawn != npt - 1 || pGC->capStyle == CapNotLast);
+ pptInit += drawn;
+ npt -= drawn;
+ x1 = x2;
+ y1 = y2;
+ }
+ }
+ else
+ {
+ while (npt > 1)
+ {
+ drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
+ &x1, &y1, &x2, &y2);
+ if (drawn == -1)
+ break;
+ (*clip) (pDrawable, pGC,
+ pptInit[drawn-1].x, pptInit[drawn-1].y,
+ pptInit[drawn].x, pptInit[drawn].y,
+ &pGC->pCompositeClip->extents,
+ drawn != npt - 1 || pGC->capStyle == CapNotLast);
+ pptInit += drawn;
+ npt -= drawn;
+ }
+ }
+}
+
+#endif /* else POLYSEGMENT */
+#endif /* INCLUDE_OTHERS */
+
+#if !defined(POLYSEGMENT) && !defined (PREVIOUS)
+
+void
+RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x1, y1, x2, y2;
+ BoxPtr boxp;
+ Bool shorten;
+{
+ int oc1, oc2;
+ int e, e1, e3, len;
+ int adx, ady;
+
+ PixelType *addr;
+ int nwidth;
+ int stepx, stepy;
+ int xorg, yorg;
+ int new_x1, new_y1, new_x2, new_y2;
+ Bool pt1_clipped, pt2_clipped;
+ int changex, changey, result;
+#if PSZ == 24
+ int xOffset;
+ PixelType *addrLineEnd;
+ char *addrb;
+ int stepx3, stepy3;
+#endif
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+
+ cfbGetPixelWidthAndPointer(pDrawable, nwidth, addr);
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ x1 += xorg;
+ y1 += yorg;
+ x2 += xorg;
+ y2 += yorg;
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES (oc1, x1, y1, boxp);
+ OUTCODES (oc2, x2, y2, boxp);
+
+ if (oc1 & oc2)
+ return;
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, stepx, stepy, 1, nwidth, octant);
+
+ if (adx <= ady)
+ {
+ int t;
+
+ t = adx;
+ adx = ady;
+ ady = t;
+
+ t = stepx;
+ stepx = stepy;
+ stepy = t;
+
+ SetYMajorOctant(octant);
+ }
+ e = - adx;
+ e1 = ady << 1;
+ e3 = - (adx << 1);
+
+ FIXUP_ERROR(e, octant, bias);
+
+ new_x1 = x1;
+ new_y1 = y1;
+ new_x2 = x2;
+ new_y2 = y2;
+ pt1_clipped = 0;
+ pt2_clipped = 0;
+
+ if (IsXMajorOctant(octant))
+ {
+ result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady,
+ &pt1_clipped, &pt2_clipped,
+ octant, bias, oc1, oc2);
+ if (result == -1)
+ return;
+
+ len = abs(new_x2 - new_x1) - 1; /* this routine needs the "-1" */
+
+ /* if we've clipped the endpoint, always draw the full length
+ * of the segment, because then the capstyle doesn't matter
+ * if x2,y2 isn't clipped, use the capstyle
+ * (shorten == TRUE <--> CapNotLast)
+ */
+ if (pt2_clipped || !shorten)
+ len++;
+
+ if (pt1_clipped)
+ {
+ /* must calculate new error terms */
+ changex = abs(new_x1 - x1);
+ changey = abs(new_y1 - y1);
+ e = e + changey * e3 + changex * e1;
+ }
+ }
+ else /* Y_AXIS */
+ {
+ result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ ady, adx,
+ &pt1_clipped, &pt2_clipped,
+ octant, bias, oc1, oc2);
+ if (result == -1)
+ return;
+
+ len = abs(new_y2 - new_y1) - 1; /* this routine needs the "-1" */
+
+ /* if we've clipped the endpoint, always draw the full length
+ * of the segment, because then the capstyle doesn't matter
+ * if x2,y2 isn't clipped, use the capstyle
+ * (shorten == TRUE <--> CapNotLast)
+ */
+ if (pt2_clipped || !shorten)
+ len++;
+
+ if (pt1_clipped)
+ {
+ /* must calculate new error terms */
+ changex = abs(new_x1 - x1);
+ changey = abs(new_y1 - y1);
+ e = e + changex * e3 + changey * e1;
+ }
+ }
+ x1 = new_x1;
+ y1 = new_y1;
+ {
+ register PixelType *addrp;
+ RROP_DECLARE
+
+ RROP_FETCH_GC(pGC);
+
+#if PSZ == 24
+ xOffset = x1;
+ addrLineEnd = addr + (y1 * nwidth);
+ addrb = (char *)addrLineEnd + x1 * 3;
+ if (stepx == 1 || stepx == -1){
+ stepx3 = stepx * 3;
+ stepy3 = stepy * sizeof (long);
+ } else {
+ stepx3 = stepx * sizeof (long);
+ stepy3 = stepy * 3;
+ }
+#else
+ addrp = addr + (y1 * nwidth) + x1;
+#endif
+
+#ifndef REARRANGE
+ if (!ady)
+ {
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepx3; \
+ }
+#else
+#define body { RROP_SOLID(addrp); addrp += stepx; }
+#endif
+ while (len >= PGSZB)
+ {
+ body body body body
+#if PGSZ == 64
+ body body body body
+#endif
+ len -= PGSZB;
+ }
+ switch (len)
+ {
+#if PGSZ == 64
+ case 7: body case 6: body case 5: body case 4: body
+#endif
+ case 3: body case 2: body case 1: body
+ }
+#undef body
+ }
+ else
+#endif /* !REARRANGE */
+ {
+#if PSZ == 24
+#define body {\
+ body_rop \
+ addrb += stepx3; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrb += stepy3; \
+ e += e3; \
+ } \
+ }
+#else
+#define body {\
+ RROP_SOLID(addrp); \
+ addrp += stepx; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrp += stepy; \
+ e += e3; \
+ } \
+ }
+#endif
+
+#ifdef LARGE_INSTRUCTION_CACHE
+ while ((len -= PGSZB) >= 0)
+ {
+ body body body body
+#if PGSZ == 64
+ body body body body
+#endif
+ }
+ switch (len)
+ {
+ case -1: body case -2: body case -3: body
+#if PGSZ == 64
+ case -4: body case -5: body case -6: body case -7: body
+#endif
+ }
+#else /* !LARGE_INSTRUCTION_CACHE */
+ IMPORTANT_START;
+
+ while ((len -= 2) >= 0)
+ {
+ body body;
+ }
+ if (len & 1)
+ body;
+
+ IMPORTANT_END;
+#endif /* LARGE_INSTRUCTION_CACHE */
+ }
+#if PSZ == 24
+ body_rop
+#else
+ RROP_SOLID(addrp);
+#endif
+#undef body
+ }
+}
+
+#endif /* !POLYSEGMENT && !PREVIOUS */
+#endif /* PIXEL_ADDR */
diff --git a/xc/programs/Xserver/cfb/cfballpriv.c b/xc/programs/Xserver/cfb/cfballpriv.c
new file mode 100644
index 000000000..f9addcd64
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfballpriv.c
@@ -0,0 +1,88 @@
+/*
+ * $TOG: cfballpriv.c /main/6 1998/02/09 14:04:27 kaleb $
+ *
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfballpriv.c,v 1.8 1999/04/04 08:46:06 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "cfb.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "cfbmskbits.h"
+#include "mibstore.h"
+
+#if PSZ==8
+int cfbWindowPrivateIndex;
+int cfbGCPrivateIndex;
+#ifdef CFB_NEED_SCREEN_PRIVATE
+int cfbScreenPrivateIndex = -1;
+#endif
+#endif
+#ifdef CFB_NEED_SCREEN_PRIVATE
+static unsigned long cfbGeneration = 0;
+#endif
+
+
+Bool
+cfbAllocatePrivates(pScreen, window_index, gc_index)
+ ScreenPtr pScreen;
+ int *window_index, *gc_index;
+{
+ if (!window_index || !gc_index ||
+ *window_index == -1 && *gc_index == -1)
+ {
+ if (!mfbAllocatePrivates(pScreen,
+ &cfbWindowPrivateIndex, &cfbGCPrivateIndex))
+ return FALSE;
+ if (window_index)
+ *window_index = cfbWindowPrivateIndex;
+ if (gc_index)
+ *gc_index = cfbGCPrivateIndex;
+ }
+ else
+ {
+ cfbWindowPrivateIndex = *window_index;
+ cfbGCPrivateIndex = *gc_index;
+ }
+ if (!AllocateWindowPrivate(pScreen, cfbWindowPrivateIndex,
+ sizeof(cfbPrivWin)) ||
+ !AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
+ return FALSE;
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ if (cfbGeneration != serverGeneration)
+ {
+ cfbScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ cfbGeneration = serverGeneration;
+ }
+ if (cfbScreenPrivateIndex == -1)
+ return FALSE;
+#endif
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/cfb/cfbbitblt.c b/xc/programs/Xserver/cfb/cfbbitblt.c
new file mode 100644
index 000000000..648a749b2
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbbitblt.c
@@ -0,0 +1,1153 @@
+/*
+ * cfb copy area
+ */
+
+/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.6 1999/08/21 13:48:14 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Keith Packard
+
+*/
+/* $TOG: cfbbitblt.c /main/73 1998/05/14 14:41:31 msr $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mi.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+#include "fastblt.h"
+#define MFB_CONSTS_ONLY
+#include "maskbits.h"
+
+#if PSZ == 8
+#define cfbCopyPlane1toN cfbCopyPlane1to8
+#define cfbCopyPlaneNto1 cfbCopyPlane8to1
+#else
+unsigned int FgPixel, BgPixel;
+# if PSZ == 16
+#define cfbCopyPlane1toN cfbCopyPlane1to16
+#define cfbCopyPlaneNto1 cfbCopyPlane16to1
+# endif
+# if PSZ == 24
+#define cfbCopyPlane1toN cfbCopyPlane1to24
+#define cfbCopyPlaneNto1 cfbCopyPlane24to1
+# endif
+# if PSZ == 32
+#define cfbCopyPlane1toN cfbCopyPlane1to32
+#define cfbCopyPlaneNto1 cfbCopyPlane32to1
+# endif
+#endif
+
+RegionPtr
+cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+ void (*doBitBlt)();
+ unsigned long bitPlane;
+{
+ RegionPtr prgnSrcClip; /* may be a new region, or just a copy */
+ Bool freeSrcClip = FALSE;
+
+ RegionPtr prgnExposed;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ register BoxPtr pbox;
+ int i;
+ register int dx;
+ register int dy;
+ xRectangle origSource;
+ DDXPointRec origDest;
+ int numRects;
+ BoxRec fastBox;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if ((pSrcDrawable != pDstDrawable) &&
+ pSrcDrawable->pScreen->SourceValidate)
+ {
+ (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP)
+ {
+ if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = cfbGetCompositeClip(pGC);
+ }
+ else
+ {
+ fastClip = 1;
+ }
+ }
+ else
+ {
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ if (!((WindowPtr) pSrcDrawable)->parent)
+ {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ }
+ else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = cfbGetCompositeClip(pGC);
+ }
+ else
+ {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ }
+ else
+ {
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip)
+ {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x)
+ {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y)
+ {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
+ {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
+ {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW)
+ {
+ if (!((WindowPtr)pDstDrawable)->realized)
+ {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip)
+ {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ /* XXX because CopyPlane uses this routine for 8-to-1 bit
+ * copies, this next line *must* also correctly fetch the
+ * composite clip from an mfb gc
+ */
+
+ cclip = cfbGetCompositeClip(pGC);
+ if (REGION_NUM_RECTS(cclip) == 1)
+ {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0);
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ }
+ else
+ {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
+ }
+ }
+ else
+ {
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst,
+ &rgnDst,
+ cfbGetCompositeClip(pGC));
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height)
+ {
+ if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+ sizeof(DDXPointRec))))
+ {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
+ DEALLOCATE_LOCAL(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose)
+ {
+ extern RegionPtr miHandleExposures();
+
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed =
+ miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height,
+ origDest.x, origDest.y, bitPlane);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
+
+
+void
+cfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ void (*blt)() = cfbDoBitbltGeneral;
+ if ((planemask & PMSK) == PMSK) {
+ switch (alu) {
+ case GXcopy:
+ blt = cfbDoBitbltCopy;
+ break;
+ case GXxor:
+ blt = cfbDoBitbltXor;
+ break;
+ case GXor:
+ blt = cfbDoBitbltOr;
+ break;
+ }
+ }
+ (*blt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask);
+}
+
+RegionPtr
+cfbCopyArea(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+{
+ void (*doBitBlt) ();
+
+ doBitBlt = cfbDoBitbltCopy;
+ if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK)
+ {
+ doBitBlt = cfbDoBitbltGeneral;
+ if ((pGC->planemask & PMSK) == PMSK)
+ {
+ switch (pGC->alu) {
+ case GXxor:
+ doBitBlt = cfbDoBitbltXor;
+ break;
+ case GXor:
+ doBitBlt = cfbDoBitbltOr;
+ break;
+ }
+ }
+ }
+ return cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0L);
+}
+
+#if PSZ == 8
+void
+cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
+ DrawablePtr pSrcDrawable; /* must be a bitmap */
+ DrawablePtr pDstDrawable; /* must be depth 8 drawable */
+ int rop; /* not used; caller must call cfb8CheckOpaqueStipple
+ * beforehand to get cfb8StippleRRop set correctly */
+ unsigned long planemask; /* to apply to destination writes */
+ RegionPtr prgnDst; /* region in destination to draw to;
+ * screen relative coords. if dest is a window;
+ * drawable relative if dest is a pixmap */
+ DDXPointPtr pptSrc; /* drawable relative src coords to copy from;
+ * must be one point for each box in prgnDst */
+ unsigned long bitPlane; /* not used; assumed always to be 1 */
+{
+ int srcx, srcy; /* upper left corner of box being copied in source */
+ int dstx, dsty; /* upper left corner of box being copied in dest */
+ int width, height; /* in pixels, unpadded, of box being copied */
+ int xoffSrc; /* bit # in leftmost word of row from which copying starts */
+ int xoffDst; /* byte # in leftmost word of row from which copying starts */
+ unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */
+ int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/
+ int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */
+ unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
+ * may point into middle of row */
+ register unsigned long *psrc, *pdst; /* steps within the row */
+ register unsigned long bits, tmp; /* bits from source */
+ register int leftShift;
+ register int rightShift;
+ unsigned long startmask; /* left edge pixel mask */
+ unsigned long endmask; /* right edge pixel mask */
+ register int nlMiddle; /* number of words in middle of the row to draw */
+ register int nl;
+ int firstoff;
+ int secondoff;
+ unsigned long src;
+ int nbox; /* number of boxes in region to copy */
+ BoxPtr pbox; /* steps thru boxes in region */
+ int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after
+ * the main "middle" loop */
+
+ cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
+ cfbGetLongWidthAndPointer (pDstDrawable, widthDst, pdstBase)
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+
+ psrcLine = psrcBase + srcy * widthSrc + (srcx >> MFB_PWSH);
+ pdstLine = pdstBase + dsty * widthDst + (dstx >> PWSH);
+ xoffSrc = srcx & MFB_PIM; /* finds starting bit in src */
+ xoffDst = dstx & PIM; /* finds starting byte in dst */
+
+ /* compute startmask, endmask, nlMiddle */
+
+ if (xoffDst + width < PPW) /* XXX should this be '<= PPW' ? */
+ { /* the copy only affects one word per row in destination */
+ maskpartialbits(dstx, width, startmask);
+ endmask = 0; /* nothing on right edge */
+ nlMiddle = 0; /* nothing in middle */
+ }
+ else
+ { /* the copy will affect multiple words per row in destination */
+ maskbits(dstx, width, startmask, endmask, nlMiddle);
+ }
+
+ /*
+ * compute constants for the first four bits to be
+ * copied. This avoids troubles with partial first
+ * writes, and difficult shift computation
+ */
+ if (startmask)
+ {
+ firstoff = xoffSrc - xoffDst;
+ if (firstoff > (MFB_PPW-PPW))
+ secondoff = MFB_PPW - firstoff;
+ if (xoffDst)
+ {
+ srcx += (PPW-xoffDst);
+ xoffSrc = srcx & MFB_PIM;
+ }
+ }
+ leftShift = xoffSrc;
+ rightShift = MFB_PPW - leftShift;
+
+ pixelsRemainingOnRightEdge = (nlMiddle & 7) * PPW +
+ ((dstx + width) & PIM);
+
+ /* setup is done; now let's move some bits */
+
+ /* caller must call cfb8CheckOpaqueStipple before this function
+ * to set cfb8StippleRRop!
+ */
+
+ if (cfb8StippleRRop == GXcopy)
+ {
+ while (height--)
+ { /* one iteration of this loop copies one row */
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+ if (startmask)
+ {
+ if (firstoff < 0)
+ tmp = BitRight (bits, -firstoff);
+ else
+ {
+ tmp = BitLeft (bits, firstoff);
+ /*
+ * need a more cautious test for partialmask
+ * case...
+ */
+ if (firstoff >= (MFB_PPW-PPW))
+ {
+ bits = *psrc++;
+ if (firstoff != (MFB_PPW-PPW))
+ tmp |= BitRight (bits, secondoff);
+ }
+ }
+ *pdst = (*pdst & ~startmask) | (GetPixelGroup(tmp) & startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl >= 8)
+ {
+ nl -= 8;
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != MFB_PPW)
+ tmp |= BitRight(bits, rightShift);
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+# define StorePixels(pdst,o,pixels) (pdst)[o] = (pixels)
+# define EndStep(pdst,o) (pdst) += (o)
+# define StoreRopPixels(pdst,o,and,xor) (pdst)[o] = DoRRop((pdst)[o],and,xor);
+#else
+# define StorePixels(pdst,o,pixels) *(pdst)++ = (pixels)
+# define EndStep(pdst,o)
+# define StoreRopPixels(pdst,o,and,xor) *(pdst) = DoRRop(*(pdst),and,xor); (pdst)++;
+#endif
+
+#define Step(c) NextBitGroup(c);
+#define StoreBitsPlain(o,c) StorePixels(pdst,o,GetPixelGroup(c))
+#define StoreRopBitsPlain(o,c) StoreRopPixels(pdst,o,\
+ cfb8StippleAnd[GetBitGroup(c)], \
+ cfb8StippleXor[GetBitGroup(c)])
+#define StoreBits0(c) StoreBitsPlain(0,c)
+#define StoreRopBits0(c) StoreRopBitsPlain(0,c)
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+# define StoreBits(o,c) StoreBitsPlain(o,c)
+# define StoreRopBits(o,c) StoreRopBitsPlain(o,c)
+# define FirstStep(c) Step(c)
+#else /* BITMAP_BIT_ORDER == LSBFirst */
+#if PGSZ == 64
+# define StoreBits(o,c) StorePixels(pdst,o, (cfb8Pixels[c & 0xff]))
+# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
+ (cfb8StippleAnd[c & 0xff]), \
+ (cfb8StippleXor[c & 0xff]))
+# define FirstStep(c) c = BitLeft (c, 8);
+#else
+/* 0x3c is 0xf << 2 (4 bits, long word) */
+# define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\
+ (((char *) cfb8Pixels) + (c & 0x3c))))
+# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
+ *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
+ *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c))))
+# define FirstStep(c) c = BitLeft (c, 2);
+#endif /* PGSZ */
+#endif /* BITMAP_BIT_ORDER */
+
+ StoreBits0(tmp); FirstStep(tmp);
+ StoreBits(1,tmp); Step(tmp);
+ StoreBits(2,tmp); Step(tmp);
+ StoreBits(3,tmp); Step(tmp);
+ StoreBits(4,tmp); Step(tmp);
+ StoreBits(5,tmp); Step(tmp);
+ StoreBits(6,tmp); Step(tmp);
+ StoreBits(7,tmp); EndStep (pdst,8);
+ }
+
+ /* do rest of middle and partial word on right edge */
+
+ if (pixelsRemainingOnRightEdge)
+ {
+ tmp = BitLeft(bits, leftShift);
+
+ if (pixelsRemainingOnRightEdge > rightShift)
+ {
+ bits = *psrc++;
+ tmp |= BitRight (bits, rightShift);
+ }
+ EndStep (pdst, nl);
+ switch (nl)
+ {
+ case 7:
+ StoreBitsPlain(-7,tmp); Step(tmp);
+ case 6:
+ StoreBitsPlain(-6,tmp); Step(tmp);
+ case 5:
+ StoreBitsPlain(-5,tmp); Step(tmp);
+ case 4:
+ StoreBitsPlain(-4,tmp); Step(tmp);
+ case 3:
+ StoreBitsPlain(-3,tmp); Step(tmp);
+ case 2:
+ StoreBitsPlain(-2,tmp); Step(tmp);
+ case 1:
+ StoreBitsPlain(-1,tmp); Step(tmp);
+ }
+ if (endmask)
+ *pdst = (*pdst & ~endmask) | (GetPixelGroup(tmp) & endmask);
+ }
+ }
+ }
+ else /* cfb8StippleRRop != GXcopy */
+ {
+ while (height--)
+ { /* one iteration of this loop copies one row */
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+
+ /* do partial word on left edge */
+
+ if (startmask)
+ {
+ if (firstoff < 0)
+ tmp = BitRight (bits, -firstoff);
+ else
+ {
+ tmp = BitLeft (bits, firstoff);
+ if (firstoff >= (MFB_PPW-PPW))
+ {
+ bits = *psrc++;
+ if (firstoff != (MFB_PPW-PPW))
+ tmp |= BitRight (bits, secondoff);
+ }
+ }
+ src = GetBitGroup(tmp);
+ *pdst = MaskRRopPixels (*pdst, src, startmask);
+ pdst++;
+ }
+
+ /* do middle of row */
+
+ nl = nlMiddle;
+ while (nl >= 8)
+ {
+ nl -= 8;
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != MFB_PPW)
+ tmp |= BitRight(bits, rightShift);
+ StoreRopBits0(tmp); FirstStep(tmp);
+ StoreRopBits(1,tmp); Step(tmp);
+ StoreRopBits(2,tmp); Step(tmp);
+ StoreRopBits(3,tmp); Step(tmp);
+ StoreRopBits(4,tmp); Step(tmp);
+ StoreRopBits(5,tmp); Step(tmp);
+ StoreRopBits(6,tmp); Step(tmp);
+ StoreRopBits(7,tmp); EndStep(pdst,8);
+ }
+
+ /* do rest of middle and partial word on right edge */
+
+ if (pixelsRemainingOnRightEdge)
+ {
+ tmp = BitLeft(bits, leftShift);
+
+ if (pixelsRemainingOnRightEdge > rightShift)
+ {
+ bits = *psrc++; /* XXX purify abr here */
+ tmp |= BitRight (bits, rightShift);
+ }
+ while (nl--)
+ {
+ src = GetBitGroup (tmp);
+ *pdst = RRopPixels (*pdst, src);
+ pdst++;
+ NextBitGroup(tmp);
+ }
+ if (endmask)
+ {
+ src = GetBitGroup (tmp);
+ *pdst = MaskRRopPixels (*pdst, src, endmask);
+ }
+ }
+ } /* end copy one row */
+ } /* end alu is non-copy-mode case */
+ } /* end iteration over region boxes */
+}
+
+#else /* PSZ == 8 */
+
+#define mfbmaskbits(x, w, startmask, endmask, nlw) \
+ startmask = starttab[(x)&0x1f]; \
+ endmask = endtab[((x)+(w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5;
+
+#define mfbmaskpartialbits(x, w, mask) \
+ mask = partmasks[(x)&0x1f][(w)&0x1f];
+
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+
+
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+
+/******************************************************************/
+
+void
+#if PSZ == 16
+cfbCopyPlane1to16 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 24
+cfbCopyPlane1to24 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 32
+cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ unsigned long planemask;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty;
+ int width, height;
+ int xoffSrc;
+ unsigned long *psrcBase, *pdstBase;
+ int widthSrc, widthDst;
+ unsigned int *psrcLine;
+ register unsigned int *psrc;
+#if PSZ == 16
+ unsigned short *pdstLine;
+ register unsigned short *pdst;
+#endif
+#if PSZ == 32
+ unsigned int *pdstLine;
+ register unsigned int *pdst;
+#endif
+#if PSZ == 24
+ unsigned char *pdstLine;
+ register unsigned char *pdst;
+#endif
+ register unsigned int bits, tmp;
+ register unsigned int fgpixel, bgpixel;
+ register unsigned int src;
+ register unsigned int dst;
+ register int leftShift, rightShift;
+ register int i, nl;
+ int nbox;
+ BoxPtr pbox;
+ int result;
+
+#if PSZ == 16
+ unsigned int doublet[4]; /* Pixel values for 16bpp expansion. */
+#endif
+#if PSZ == 32
+ unsigned int doublet[8]; /* Pixel values for 32bpp expansion */
+#endif
+
+ fgpixel = FgPixel & planemask;
+ bgpixel = BgPixel & planemask;
+
+#if PSZ == 16
+ if (rop == GXcopy && (planemask & PMSK) == PMSK) {
+ doublet[0] = bgpixel | (bgpixel << 16);
+ doublet[1] = fgpixel | (bgpixel << 16);
+ doublet[2] = bgpixel | (fgpixel << 16);
+ doublet[3] = fgpixel | (fgpixel << 16);
+ }
+#endif
+#if PSZ == 32
+ if (rop == GXcopy && (planemask & PMSK) == PMSK) {
+ doublet[0] = bgpixel; doublet[1] = bgpixel;
+ doublet[2] = fgpixel; doublet[3] = bgpixel;
+ doublet[4] = bgpixel; doublet[5] = fgpixel;
+ doublet[6] = fgpixel; doublet[7] = fgpixel;
+ }
+#endif
+
+ /* must explicitly ask for "int" widths, as code below expects it */
+ /* on some machines (Alpha), "long" and "int" are not the same size */
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, unsigned long)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, unsigned long)
+
+#if PSZ == 16
+ widthDst <<= 1;
+#endif
+#if PSZ == 24
+ widthDst <<= 2;
+#endif
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+ psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + (srcx >> 5);
+#if PSZ == 16
+ pdstLine = (unsigned short *)pdstBase + dsty * widthDst + dstx;
+#endif
+#if PSZ == 24
+ pdstLine = (unsigned char *)pdstBase + dsty * widthDst + dstx * 3;
+#endif
+#if PSZ == 32
+ pdstLine = (unsigned int *)pdstBase + dsty * widthDst + dstx;
+#endif
+ xoffSrc = srcx & 0x1f;
+
+ /*
+ * compute constants for the first four bits to be
+ * copied. This avoids troubles with partial first
+ * writes, and difficult shift computation
+ */
+ leftShift = xoffSrc;
+ rightShift = 32 - leftShift;
+
+ if (rop == GXcopy && (planemask & PMSK) == PMSK)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+ nl = width;
+ while (nl >= 32)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != 32)
+ tmp |= BitRight(bits, rightShift);
+ i = 0;
+#if PSZ == 16
+ /*
+ * I've thrown in some optimization to at least write
+ * some aligned 32-bit words instead of 16-bit shorts.
+ */
+ if ((unsigned int)psrc & 2) {
+ /* Write unaligned 16-bit word at left edge. */
+ if (tmp & 0x01)
+ *pdst = fgpixel;
+ else
+ *pdst = bgpixel;
+ pdst++;
+ i++;
+ }
+ while (i <= 24)
+ {
+ unsigned tmpbits = tmp >> i;
+ *(unsigned int *)pdst = doublet[tmpbits & 0x03];
+ *(unsigned int *)(pdst + 2) =
+ doublet[(tmpbits >> 2) & 0x03];
+ *(unsigned int *)(pdst + 4) =
+ doublet[(tmpbits >> 4) & 0x03];
+ *(unsigned int *)(pdst + 6) =
+ doublet[(tmpbits >> 6) & 0x03];
+ pdst += 8; /* Advance four 32-bit words. */
+ i += 8;
+ }
+ while (i <= 30)
+ {
+ *(unsigned int *)pdst =
+ doublet[(tmp >> i) & 0x03];
+ pdst += 2; /* Advance one 32-bit word. */
+ i += 2;
+ }
+ if (i == 31) {
+ if ((tmp >> 31) & 0x01)
+ *pdst = fgpixel;
+ else
+ *pdst = bgpixel;
+ pdst++;
+ }
+#endif
+#if PSZ == 24
+ while (i < 32) {
+ if ((tmp >> i) & 0x01) {
+ *pdst = fgpixel;
+ *(pdst + 1) = fgpixel >> 8;
+ *(pdst + 2) = fgpixel >> 16;
+ }
+ else {
+ *pdst = bgpixel;
+ *(pdst + 1) = bgpixel >> 8;
+ *(pdst + 2) = bgpixel >> 16;
+ }
+ pdst += 3;
+ i++;
+ }
+#endif
+#if PSZ == 32
+ while (i <= 28) {
+ int pair;
+ pair = (tmp >> i) & 0x03;
+ *pdst = doublet[pair * 2];
+ *(pdst + 1) = doublet[pair * 2 + 1];
+ pair = (tmp >> (i + 2)) & 0x03;
+ *(pdst + 2) = doublet[pair * 2];
+ *(pdst + 3) = doublet[pair * 2 + 1];
+ pdst += 4;
+ i += 4;
+ }
+ while (i < 32) {
+ *pdst = ((tmp >> i) & 0x01) ? fgpixel : bgpixel;
+ pdst++;
+ i++;
+ }
+#endif
+ nl -= 32;
+ }
+
+ if (nl)
+ {
+ tmp = BitLeft(bits, leftShift);
+ /*
+ * better condition needed -- mustn't run
+ * off the end of the source...
+ */
+ if (rightShift != 32)
+ {
+ bits = *psrc++;
+ tmp |= BitRight (bits, rightShift);
+ }
+ i = 32;
+ while (nl--)
+ {
+ --i;
+#if PSZ == 24
+ if ((tmp >> (31 - i)) & 0x01) {
+ *pdst = fgpixel;
+ *(pdst + 1) = fgpixel >> 8;
+ *(pdst + 2) = fgpixel >> 16;
+ }
+ else {
+ *pdst = bgpixel;
+ *(pdst + 1) = bgpixel >> 8;
+ *(pdst + 2) = bgpixel >> 16;
+ }
+ pdst += 3;
+#else
+ *pdst = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+ pdst++;
+#endif
+ }
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ bits = *psrc++;
+ nl = width;
+ while (nl >= 32)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ if (rightShift != 32)
+ tmp |= BitRight(bits, rightShift);
+ i = 32;
+ while (i--)
+ {
+ src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+#if PSZ == 24
+ dst = *pdst;
+ dst |= (*(pdst + 1)) << 8;
+ dst |= (*(pdst + 2)) << 16;
+ DoRop (result, rop, src, dst);
+ *pdst = (dst & ~planemask) |
+ (result & planemask);
+ *(pdst+1) = ((dst & ~planemask) >> 8) |
+ ((result & planemask) >> 8);
+ *(pdst+2) = ((dst & ~planemask) >> 16) |
+ ((result & planemask) >> 16);
+ pdst += 3;
+#else
+ DoRop (result, rop, src, *pdst);
+
+ *pdst = (*pdst & ~planemask) |
+ (result & planemask);
+ pdst++;
+#endif
+ }
+ nl -= 32;
+ }
+
+ if (nl)
+ {
+ tmp = BitLeft(bits, leftShift);
+ /*
+ * better condition needed -- mustn't run
+ * off the end of the source...
+ */
+ if (rightShift != 32)
+ {
+ bits = *psrc++;
+ tmp |= BitRight (bits, rightShift);
+ }
+ i = 32;
+ while (nl--)
+ {
+ --i;
+ src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
+#if PSZ == 24
+ dst = *pdst;
+ dst |= (*(pdst + 1)) << 8;
+ dst |= (*(pdst + 2)) << 16;
+ DoRop (result, rop, src, dst);
+ *pdst = (dst & ~planemask) |
+ (result & planemask);
+ *(pdst+1) = ((dst & ~planemask) >> 8) |
+ ((result & planemask) >> 8);
+ *(pdst+2) = ((dst & ~planemask) >> 16) |
+ ((result & planemask) >> 16);
+ pdst += 3;
+#else
+ DoRop (result, rop, src, *pdst);
+
+ *pdst = (*pdst & ~planemask) |
+ (result & planemask);
+ pdst++;
+#endif
+ }
+ }
+ }
+ }
+ }
+}
+
+#endif /* PSZ == 8 */
+
+/* shared among all different cfb depths through linker magic */
+
+RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ GCPtr pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+ unsigned long bitPlane;
+{
+ RegionPtr ret;
+ extern RegionPtr miHandleExposures();
+ void (*doBitBlt)();
+
+ if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ)
+ {
+ if (bitPlane == 1)
+ {
+ doBitBlt = cfbCopyPlane1toN;
+#if PSZ == 8
+ cfb8CheckOpaqueStipple (pGC->alu,
+ pGC->fgPixel, pGC->bgPixel,
+ pGC->planemask);
+#else
+ FgPixel = pGC->fgPixel;
+ BgPixel = pGC->bgPixel;
+#endif
+ ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane);
+ }
+ else
+ ret = miHandleExposures (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ }
+ else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1)
+ {
+ extern int InverseAlu[16];
+ int oldalu;
+
+ oldalu = pGC->alu;
+ if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1)
+ pGC->alu = InverseAlu[pGC->alu];
+ else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
+ pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
+ ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ cfbCopyPlaneNto1, bitPlane);
+ pGC->alu = oldalu;
+ }
+ else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == PSZ)
+ {
+ PixmapPtr pBitmap;
+ ScreenPtr pScreen = pSrcDrawable->pScreen;
+ GCPtr pGC1;
+
+ pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1);
+ if (!pBitmap)
+ return NULL;
+ pGC1 = GetScratchGC (1, pScreen);
+ if (!pGC1)
+ {
+ (*pScreen->DestroyPixmap) (pBitmap);
+ return NULL;
+ }
+ /*
+ * don't need to set pGC->fgPixel,bgPixel as copyPlaneNto1
+ * ignores pixel values, expecting the rop to "do the
+ * right thing", which GXcopy will.
+ */
+ ValidateGC ((DrawablePtr) pBitmap, pGC1);
+ /* no exposures here, scratch GC's don't get graphics expose */
+ (void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap,
+ pGC1, srcx, srcy, width, height, 0, 0,
+ cfbCopyPlaneNto1, bitPlane);
+#if PSZ == 8
+ cfb8CheckOpaqueStipple (pGC->alu,
+ pGC->fgPixel, pGC->bgPixel,
+ pGC->planemask);
+#else
+ FgPixel = pGC->fgPixel;
+ BgPixel = pGC->bgPixel;
+#endif
+ /* no exposures here, copy bits from inside a pixmap */
+ (void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC,
+ 0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1);
+ FreeScratchGC (pGC1);
+ (*pScreen->DestroyPixmap) (pBitmap);
+ /* compute resultant exposures */
+ ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+ }
+ else
+ ret = miCopyPlane (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ return ret;
+}
+
+
diff --git a/xc/programs/Xserver/cfb/cfbblt.c b/xc/programs/Xserver/cfb/cfbblt.c
new file mode 100644
index 000000000..3f5bb22be
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbblt.c
@@ -0,0 +1,931 @@
+/*
+ * cfb copy area
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.7 1999/01/26 10:40:03 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Keith Packard
+
+*/
+/* $TOG: cfbblt.c /main/14 1998/02/09 14:04:41 kaleb $ */
+
+/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+#include "fastblt.h"
+#include "mergerop.h"
+
+#ifdef notdef /* XXX fails right now, walks off end of pixmaps */
+#if defined (FAST_UNALIGNED_READS) && PSZ == 8
+#define DO_UNALIGNED_BITBLT
+#endif
+#endif
+
+#if defined(FAST_MEMCPY) && (MROP == Mcopy) && PSZ == 8
+#define DO_MEMCPY
+#endif
+
+/* ................................................. */
+/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */
+
+#if PSZ == 24 && (MROP) == 0
+
+/* The default macros are defined in mergerop.h, and none of them are
+ really appropriate for what we want to do.
+
+ There are two ways of fixing this: either define SLOW_24BIT_COPY
+ to copy pixel by pixel, or (by default) use the following macros
+ modified from mergerop.h
+
+ MROP_SOLID and MROP_MASK are defined for each of the operations,
+ i.e. each value of MROP.
+
+ There are special cases for Mcopy, McopyInverted, Mxor, and Mor.
+ There is a completely generic version for MROP=0, and a simplified
+ generic version which works for (Mcopy|Mxor|MandReverse|Mor).
+
+ However, the generic version does not work for the 24-bit case
+ because the pixels cannot be packed exactly into a machine word (32
+ bits).
+
+ Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for
+ the 24-bit case. However, these each copy a single *pixel*, not a
+ single machine word. They take an rvalue source pixel, an lvalue
+ destination, and the pixel index. The latter is used to find the
+ position of the pixel data within the two words *dst and *(dst+1).
+
+ Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from
+ an lvalue source to an lvalue destination. MROP_PIXEL24 is used to
+ assemble the source pixel from the adjacent words *src and
+ *(src+1), and this is then split between the destination words
+ using the non-P macros above.
+
+ But we want to copy entire words for the sake of efficiency.
+ Unfortunately if a plane mask is specified this must be shifted
+ from one word to the next. Fortunately the pattern repeats after 3
+ words, so we unroll the planemask here and redefine MROP_SOLID
+ and MROP_MASK. */
+
+
+#endif /* MROP == 0 && PSZ == 24 */
+
+/* ................................................. */
+
+#if PSZ == 24
+#define BYPP 3
+#if PGSZ == 32
+#define P3W 4 /* pixels in 3 machine words */
+#define PAM 3 /* pixel align mask; PAM = P3W -1 */
+#define P2WSH 2
+#else
+#define P3W 8 /* pixels in 3 machine words */
+#define PAM 7 /* pixel align mask; PAM = P3W -1 */
+#define P2WSH 3
+#endif
+#endif
+
+void
+MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ unsigned long *psrcBase, *pdstBase;
+ /* start of src and dst bitmaps */
+ int widthSrc, widthDst; /* add to get to same position in next line */
+
+ BoxPtr pbox;
+ int nbox;
+
+ BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ /* temporaries for shuffling rectangles */
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ /* shuffling boxes entails shuffling the
+ source points too */
+ int w, h;
+ int xdir; /* 1 = left right, -1 = right left/ */
+ int ydir; /* 1 = top down, -1 = bottom up */
+
+ unsigned long *psrcLine, *pdstLine;
+ /* pointers to line with current src and dst */
+ register unsigned long *psrc;/* pointer to current src longword */
+ register unsigned long *pdst;/* pointer to current dst longword */
+
+ MROP_DECLARE_REG()
+
+ /* following used for looping through a line */
+ unsigned long startmask, endmask; /* masks for writing ends of dst */
+ int nlMiddle; /* whole longwords in dst */
+ int xoffSrc, xoffDst, xoffEnd;
+ register int leftShift, rightShift;
+ register unsigned long bits;
+ register unsigned long bits1;
+ register int nl; /* temp copy of nlMiddle */
+
+ /* place to store full source word */
+ int nstart; /* number of ragged bits at start of dst */
+ int nend; /* number of ragged bits at end of dst */
+ int srcStartOver; /* pulling nstart bits from src
+ overflows into the next word? */
+ int careful;
+ int tmpSrc;
+#if PSZ == 24
+#ifdef DO_MEMCPY
+ int w2;
+#endif
+
+#if MROP == 0
+ unsigned char *psrcBaseByte, *pdstBaseByte;
+ int widthSrcBytes, widthDstBytes;
+
+ cfbGetByteWidthAndPointer (pSrc, widthSrcBytes, psrcBaseByte)
+
+ cfbGetByteWidthAndPointer (pDst, widthDstBytes, pdstBaseByte)
+#endif
+#endif
+
+ MROP_INITIALIZE(alu,planemask)
+
+ cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase)
+
+ cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase)
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1))
+ {
+ /* walk source botttom to top */
+ ydir = -1;
+ widthSrc = -widthSrc;
+ widthDst = -widthDst;
+
+ if (nbox > 1)
+ {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+ if(!pptNew1)
+ {
+ DEALLOCATE_LOCAL(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox)
+ {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase)
+ {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ }
+ else
+ {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1))
+ {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1)
+ {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2)
+ {
+ if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
+ if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+ if (pboxNew1)
+ {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox)
+ {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase)
+ {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ }
+ else
+ {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ while(nbox--)
+ {
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+
+#if PSZ == 24
+#ifdef DO_MEMCPY
+ w2 = w * BYPP;
+#endif
+#endif
+ if (ydir == -1) /* start at last scanline of rectangle */
+ {
+ psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc);
+ pdstLine = pdstBase + ((pbox->y2-1) * -widthDst);
+ }
+ else /* start at first scanline */
+ {
+ psrcLine = psrcBase + (pptSrc->y * widthSrc);
+ pdstLine = pdstBase + (pbox->y1 * widthDst);
+ }
+#if PSZ == 24
+ if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM))
+#else
+ if ((pbox->x1 & PIM) + w <= PPW)
+#endif
+ {
+ maskpartialbits (pbox->x1, w, endmask);
+ startmask = 0;
+ nlMiddle = 0;
+ }
+ else
+ {
+ maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
+ }
+
+#if PSZ == 24
+#if 0
+ nlMiddle = w - (pbox->x2 &PAM);;
+ if(pbox->x1 & PAM){
+ nlMiddle -= (PAM+1 - (pbox->x1 &PAM));
+ }
+ nlMiddle >>= P2WSH;
+ if(nlMiddle < 0)
+ nlMiddle = 0;
+#endif
+#endif
+
+#ifdef DO_MEMCPY
+ /* If the src and dst scanline don't overlap, do forward case. */
+
+ if ((xdir == 1) || (pptSrc->y != pbox->y1)
+ || (pptSrc->x + w <= pbox->x1))
+ {
+#if PSZ == 24
+ char *psrc = (char *) psrcLine + (pptSrc->x * BYPP);
+ char *pdst = (char *) pdstLine + (pbox->x1 * BYPP);
+#else
+ char *psrc = (char *) psrcLine + pptSrc->x;
+ char *pdst = (char *) pdstLine + pbox->x1;
+#endif
+ while (h--)
+ {
+#if PSZ == 24
+ memcpy(pdst, psrc, w2);
+#else
+ memcpy(pdst, psrc, w);
+#endif
+ pdst += widthDst << PWSH;
+ psrc += widthSrc << PWSH;
+ }
+ }
+#else /* ! DO_MEMCPY */
+ if (xdir == 1)
+ {
+#if PSZ == 24 && MROP == 0
+ /* Note: x is a pixel number; the byte offset is 3*x;
+ therefore the offset within a word is (3*x) & 3 ==
+ (4*x-x) & 3 == (-x) & 3. The offsets therefore
+ DECREASE by 1 for each pixel.
+ */
+ xoffSrc = ( - pptSrc->x) & PAM;
+ xoffDst = ( - pbox->x1) & PAM;
+#if 1
+ if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */
+ || (widthDstBytes & PAM != widthSrcBytes & PAM && h > 1))
+#else
+ if(1)
+#endif
+ /* Width also must be same, if hight > 1 */
+ {
+ /* ...otherwise, pixel by pixel operation */
+ while (h--)
+ {
+ register int i, si, sii, di;
+
+ for (i = 0, si = pptSrc->x, di = pbox->x1;
+ i < w;
+ i++, si++, di++) {
+ psrc = psrcLine + ((si * BYPP) >> P2WSH);
+ pdst = pdstLine + ((di * BYPP) >> P2WSH);
+ sii = (si & 3);
+ MROP_SOLID24P(psrc, pdst, sii, di);
+ }
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ }
+ }
+ else
+#endif
+ {
+
+#if PSZ == 24
+
+#if MROP != 0
+ xoffSrc = ( - pptSrc->x) & PAM;
+ xoffDst = ( - pbox->x1) & PAM;
+#endif
+ pdstLine += (pbox->x1 * BYPP) >> P2WSH;
+ psrcLine += (pptSrc->x * BYPP) >> P2WSH;
+#else
+ xoffSrc = pptSrc->x & PIM;
+ xoffDst = pbox->x1 & PIM;
+ pdstLine += (pbox->x1 >> PWSH);
+ psrcLine += (pptSrc->x >> PWSH);
+#endif
+#ifdef DO_UNALIGNED_BITBLT
+ nl = xoffSrc - xoffDst;
+ psrcLine = (unsigned long *)
+ (((unsigned char *) psrcLine) + nl);
+#else
+#if PSZ == 24 && MROP == 0
+ /* alredy satisfied */
+#else
+ if (xoffSrc == xoffDst)
+#endif
+#endif
+ {
+ while (h--)
+ {
+#if PSZ == 24 && MROP == 0
+ register int index;
+ register int im3;
+#endif /* PSZ == 24 && MROP == 0 */
+ psrc = psrcLine;
+ pdst = pdstLine;
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+#if PSZ == 24 && MROP == 0
+ index = (int)(pdst - pdstBase);
+ im3 = index % 3;
+#endif /* PSZ == 24 && MROP == 0 */
+ if (startmask)
+ {
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3);
+ index++;
+ im3 = index % 3;
+#else /* PSZ != 24 || MROP != 0 */
+ *pdst = MROP_MASK(*psrc, *pdst, startmask);
+#endif /* PSZ == 24 && MROP == 0 */
+ psrc++;
+ pdst++;
+ }
+
+ nl = nlMiddle;
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
+#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
+#else /* PSZ != 24 || MROP != 0 */
+#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#endif /* PSZ == 24 && MROP == 0 */
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3;
+#define BodyEven(n) BodyOdd(n)
+#else /* PSZ != 24 || MROP != 0 */
+#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
+#define BodyEven(n) BodyOdd(n)
+#endif /* PSZ == 24 && MROP == 0 */
+
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+#ifdef NOTDEF
+ /* you'd think this would be faster --
+ * a single instruction instead of 6
+ * but measurements show it to be ~15% slower
+ */
+ while ((nl -= 6) >= 0)
+ {
+ asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
+ : "=m" (*(char *)pdst)
+ : "m" (*(char *)psrc)
+ : "d0", "d1", "d2", "d3",
+ "a2", "a3");
+ pdst += 6;
+ }
+ nl += 6;
+ while (nl--)
+ *pdst++ = *psrc++;
+#endif
+#if 0 /*PSZ == 24 && MROP == 0*/
+ DuffL(nl, label1,
+ *pdst = DoMergeRop24u(*psrc, *pdst, im3);
+ pdst++; psrc++; index++;im3 = index % 3;)
+#else /* !(PSZ == 24 && MROP == 0) */
+ DuffL(nl, label1,
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;)
+#endif /* PSZ == 24 && MROP == 0 */
+#endif
+
+ if (endmask)
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
+ *pdst = MROP_MASK(*psrc, *pdst, endmask);
+#endif /* PSZ == 24 && MROP == 0 */
+ }
+ }
+#ifndef DO_UNALIGNED_BITBLT
+#if PSZ == 24 && MROP == 0
+ /* can not happen */
+#else /* !(PSZ == 24 && MROP == 0) */
+ else /* xoffSrc != xoffDst */
+ {
+ if (xoffSrc > xoffDst)
+ {
+#if PSZ == 24
+ leftShift = (xoffSrc - xoffDst) << 3;
+#else
+#if PGSZ == 32
+ leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
+#else /* PGSZ == 64 */
+ leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
+#endif /* PGSZ */
+#endif
+ rightShift = PGSZ - leftShift;
+ }
+ else
+ {
+#if PSZ == 24
+ rightShift = (xoffDst - xoffSrc) << 3;
+#else
+#if PGSZ == 32
+ rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
+#else /* PGSZ == 64 */
+ rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
+#endif /* PGSZ */
+#endif
+ leftShift = PGSZ - rightShift;
+ }
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ bits = 0;
+ if (xoffSrc > xoffDst)
+ bits = *psrc++;
+ if (startmask)
+ {
+ bits1 = BitLeft(bits,leftShift);
+ bits = *psrc++;
+ bits1 |= BitRight(bits,rightShift);
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) \
+bits = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
+
+#define BodyEven(n) \
+bits1 = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+bits = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
+pdst++;
+
+#define BodyEven(n) \
+bits1 = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
+pdst++;
+
+#define LoopReset ;
+
+#endif /* !FAST_CONSTANT_OFFSET_MODE */
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL (nl,label2,
+ bits1 = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
+ pdst++;
+ )
+#endif
+
+ if (endmask)
+ {
+ bits1 = BitLeft(bits, leftShift);
+ if (BitLeft(endmask, rightShift))
+ {
+ bits = *psrc;
+ bits1 |= BitRight(bits, rightShift);
+ }
+ *pdst = MROP_MASK (bits1, *pdst, endmask);
+ }
+ }
+ }
+#endif /* (PSZ == 24 && MROP == 0) */
+#endif /* DO_UNALIGNED_BITBLT */
+
+ }
+ }
+#endif /* ! DO_MEMCPY */
+ else /* xdir == -1 */
+ {
+#if PSZ == 24 && MROP == 0
+ xoffSrc = (-(pptSrc->x + w)) & PAM;
+ xoffDst = (-pbox->x2) & PAM;
+#if 1
+ if(xoffSrc != xoffDst /* Alignments must be same. */
+ || (widthDstBytes & PAM != widthSrcBytes & PAM && h > 1))
+#else
+ if(1)
+#endif
+ /* Width also must be same, if hight > 1 */
+ {
+ /* ...otherwise, pixel by pixel operation */
+ while (h--)
+ {
+ register int i, si, sii, di;
+
+ for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1;
+ i < w;
+ i++, si--, di--) {
+ psrc = psrcLine + ((si * BYPP) >> P2WSH);
+ pdst = pdstLine + ((di * BYPP) >> P2WSH);
+ sii = (si & PAM);
+ MROP_SOLID24P(psrc, pdst, sii, di);
+ }
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ }
+ }else
+#endif /* MROP == 0 && PSZ == 24 */
+ {
+
+#if PSZ == 24
+#if MROP == 0
+ /* already calculated */
+#else
+ xoffSrc = (pptSrc->x + w) & PAM;
+ xoffDst = pbox->x2 & PAM;
+#endif
+ pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1;
+ psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1;
+#else
+ xoffSrc = (pptSrc->x + w - 1) & PIM;
+ xoffDst = (pbox->x2 - 1) & PIM;
+ pdstLine += ((pbox->x2-1) >> PWSH) + 1;
+ psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
+#endif
+#ifdef DO_UNALIGNED_BITBLT
+#if PSZ == 24
+ nl = xoffDst - xoffSrc;
+#else
+ nl = xoffSrc - xoffDst;
+#endif
+ psrcLine = (unsigned long *)
+ (((unsigned char *) psrcLine) + nl);
+#else
+#if PSZ == 24 && MROP == 0
+ /* already satisfied */
+#else
+ if (xoffSrc == xoffDst)
+#endif
+#endif
+ {
+ while (h--)
+ {
+#if PSZ == 24 && MROP == 0
+ register int index;
+ register int im3;
+#endif /* PSZ == 24 && MROP == 0 */
+ psrc = psrcLine;
+ pdst = pdstLine;
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+#if PSZ == 24 && MROP == 0
+ index = (int)(pdst - pdstBase);
+#endif /* PSZ == 24 && MROP == 0 */
+
+ if (endmask)
+ {
+ pdst--;
+ psrc--;
+#if PSZ == 24 && MROP == 0
+ index--;
+ im3 = index % 3;
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3);
+#else /* !(PSZ == 24 && MROP == 0) */
+ *pdst = MROP_MASK (*psrc, *pdst, endmask);
+#endif /* PSZ == 24 && MROP == 0 */
+ }
+ nl = nlMiddle;
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+ psrc -= nl & (UNROLL - 1);
+ pdst -= nl & (UNROLL - 1);
+
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
+#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
+#endif /* PSZ == 24 && MROP == 0 */
+
+#define BodyEven(n) BodyOdd(n)
+
+#define LoopReset \
+pdst -= UNROLL;\
+psrc -= UNROLL;
+
+#else
+
+#if PSZ == 24 && MROP == 0
+#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);
+#else /* !(PSZ == 24 && MROP == 0) */
+#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
+#endif /* PSZ == 24 && MROP == 0 */
+#define BodyEven(n) BodyOdd(n)
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+#if PSZ == 24 && MROP == 0
+ DuffL(nl,label3,
+ --pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);)
+#else /* !(PSZ == 24 && MROP == 0) */
+ DuffL(nl,label3,
+ --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
+#endif /* PSZ == 24 && MROP == 0 */
+#endif
+
+ if (startmask)
+ {
+ --pdst;
+ --psrc;
+#if PSZ == 24 && MROP == 0
+ *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3);
+#else /* !(PSZ == 24 && MROP == 0) */
+ *pdst = MROP_MASK(*psrc, *pdst, startmask);
+#endif /* PSZ == 24 && MROP == 0 */
+ }
+ }
+ }
+#ifndef DO_UNALIGNED_BITBLT
+#if PSZ == 24 && MROP == 0
+ /* can not happen */
+#else /* !( PSZ == 24 && MROP == 0) */
+ else
+ {
+ if (xoffDst > xoffSrc)
+ {
+#if PSZ == 24
+ leftShift = (xoffDst - xoffSrc) << 3;
+ rightShift = PGSZ - leftShift;
+#else
+#if PGSZ == 32
+ rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
+#else /* PGSZ == 64 */
+ rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
+#endif /* PGSZ */
+ leftShift = PGSZ - rightShift;
+#endif
+ }
+ else
+ {
+#if PSZ == 24
+ rightShift = (xoffSrc - xoffDst) << 3;
+ leftShift = PGSZ - rightShift;
+#else
+#if PGSZ == 32
+ leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
+#else /* PGSZ == 64 */
+ leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
+#endif /* PGSZ */
+ rightShift = PGSZ - leftShift;
+#endif
+ }
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ bits = 0;
+#if PSZ == 24
+ if (xoffSrc > xoffDst)
+#else
+ if (xoffDst > xoffSrc)
+#endif
+ bits = *--psrc;
+ if (endmask)
+ {
+ bits1 = BitRight(bits, rightShift);
+ bits = *--psrc;
+ bits1 |= BitLeft(bits, leftShift);
+ pdst--;
+ *pdst = MROP_MASK(bits1, *pdst, endmask);
+ }
+ nl = nlMiddle;
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+#ifdef FAST_CONSTANT_OFFSET_MODE
+ psrc -= nl & (UNROLL - 1);
+ pdst -= nl & (UNROLL - 1);
+
+#define BodyOdd(n) \
+bits = psrc[n-1]; \
+pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
+
+#define BodyEven(n) \
+bits1 = psrc[n-1]; \
+pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
+
+#define LoopReset \
+pdst -= UNROLL; \
+psrc -= UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+bits = *--psrc; --pdst; \
+*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
+
+#define BodyEven(n) \
+bits1 = *--psrc; --pdst; \
+*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
+
+#define LoopReset ;
+
+#endif
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL (nl, label4,
+ bits1 = BitRight(bits, rightShift);
+ bits = *--psrc;
+ --pdst;
+ *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
+ )
+#endif
+
+ if (startmask)
+ {
+ bits1 = BitRight(bits, rightShift);
+ if (BitRight (startmask, leftShift))
+ {
+ bits = *--psrc;
+ bits1 |= BitLeft(bits, leftShift);
+ }
+ --pdst;
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ }
+ }
+ }
+#endif /* PSZ == 24 && MROP == 0 */
+#endif
+ }
+ }
+ pbox++;
+ pptSrc++;
+ }
+ if (pboxNew2)
+ {
+ DEALLOCATE_LOCAL(pptNew2);
+ DEALLOCATE_LOCAL(pboxNew2);
+ }
+ if (pboxNew1)
+ {
+ DEALLOCATE_LOCAL(pptNew1);
+ DEALLOCATE_LOCAL(pboxNew1);
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbbres.c b/xc/programs/Xserver/cfb/cfbbres.c
new file mode 100644
index 000000000..dc24de690
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbbres.c
@@ -0,0 +1,334 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbres.c,v 3.2 1998/10/04 09:37:37 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: cfbbres.c /main/16 1998/02/09 14:04:53 kaleb $ */
+#include "X.h"
+#include "misc.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "servermd.h"
+#include "miline.h"
+
+/* Solid bresenham line */
+/* NOTES
+ e2 is used less often than e1, so it's not in a register
+*/
+
+void
+cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
+ e2, len)
+ int rop;
+ unsigned long and, xor;
+ unsigned long *addrl; /* pointer to base of bitmap */
+ int nlwidth; /* width in longwords of bitmap */
+ register int signdx;
+ int signdy; /* signs of directions */
+ int axis; /* major axis (Y_AXIS or X_AXIS) */
+ int x1, y1; /* initial point */
+ register int e; /* error accumulator */
+ register int e1; /* bresenham increments */
+ int e2;
+ int len; /* length of line */
+{
+ register int e3 = e2-e1;
+#if PSZ == 24
+ unsigned long piQxelXor[3],piQxelAnd[3];
+ char *addrb;
+ int nlwidth3, signdx3;
+#endif
+#ifdef PIXEL_ADDR
+ register PixelType *addrp; /* Pixel pointer */
+
+ if (len == 0)
+ return;
+ /* point to first point */
+ nlwidth <<= PWSH;
+#if PSZ == 24
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth);
+ addrb = (char *)addrp + x1 * 3;
+
+ piQxelXor[0] = (xor << 24) | xor;
+ piQxelXor[1] = (xor << 16)| (xor >> 8);
+ piQxelXor[2] = (xor << 8) | (xor >> 16);
+ piQxelAnd[0] = (and << 24) | and;
+ piQxelAnd[1] = (and << 16)| (and >> 8);
+ piQxelAnd[2] = (and << 8) | (and >> 16);
+#else
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
+#endif
+ if (signdy < 0)
+ nlwidth = -nlwidth;
+ e = e-e1; /* to make looping easier */
+#if PSZ == 24
+ nlwidth3 = nlwidth * sizeof (long);
+ signdx3 = signdx * 3;
+#endif
+
+ if (axis == Y_AXIS)
+ {
+ int t;
+
+ t = nlwidth;
+ nlwidth = signdx;
+ signdx = t;
+#if PSZ == 24
+ t = nlwidth3;
+ nlwidth3 = signdx3;
+ signdx3 = t;
+#endif
+ }
+ if (rop == GXcopy)
+ {
+ --len;
+#if PSZ == 24
+#define body_copy \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
+ *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
+ *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
+ break; \
+ }
+#define body {\
+ body_copy \
+ addrb += signdx3; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrb += nlwidth3; \
+ e += e3; \
+ } \
+ }
+#else /* PSZ == 24 */
+#define body {\
+ *addrp = xor; \
+ addrp += signdx; \
+ e += e1; \
+ if (e >= 0) \
+ { \
+ addrp += nlwidth; \
+ e += e3; \
+ } \
+ }
+#endif /* PSZ == 24 */
+ while (len >= 4)
+ {
+ body body body body
+ len -= 4;
+ }
+ switch (len)
+ {
+ case 3: body case 2: body case 1: body
+ }
+#undef body
+#if PSZ == 24
+ body_copy
+# undef body_copy
+#else
+ *addrp = xor;
+#endif
+ }
+ else /* not GXcopy */
+ {
+ while(len--)
+ {
+#if PSZ == 24
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03);
+ switch((unsigned long)addrb & 3){
+ case 0:
+ *addrp = (*addrp & (piQxelAnd[0]|0xFF000000))
+ ^ (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 1:
+ *addrp = (*addrp & (piQxelAnd[2]|0xFF))
+ ^ (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ case 3:
+ *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF))
+ ^ (piQxelXor[0] & 0xFF000000);
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000))
+ ^ (piQxelXor[1] & 0xFFFF);
+ break;
+ case 2:
+ *addrp = (*addrp & (piQxelAnd[1]|0xFFFF))
+ ^ (piQxelXor[1] & 0xFFFF0000);
+ *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00))
+ ^ (piQxelXor[2] & 0xFF);
+ break;
+ }
+ e += e1;
+ if (e >= 0)
+ {
+ addrb += nlwidth3;
+ e += e3;
+ }
+ addrb += signdx3;
+#else /* PSZ == 24 */
+ *addrp = DoRRop (*addrp, and, xor);
+ e += e1;
+ if (e >= 0)
+ {
+ addrp += nlwidth;
+ e += e3;
+ }
+ addrp += signdx;
+#endif /* PSZ == 24 */
+ }
+ }
+#else /* !PIXEL_ADDR */
+ register unsigned long tmp, bit;
+ unsigned long leftbit, rightbit;
+
+ /* point to longword containing first point */
+#if PSZ == 24
+ addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2);
+#else
+ addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
+#endif
+ if (signdy < 0)
+ nlwidth = -nlwidth;
+ e = e-e1; /* to make looping easier */
+
+ leftbit = cfbmask[0];
+#if PSZ == 24
+ rightbit = cfbmask[(PPW-1)<<1];
+ bit = cfbmask[(x1 & 3)<<1];
+#else
+ rightbit = cfbmask[PPW-1];
+ bit = cfbmask[x1 & PIM];
+#endif
+
+ if (axis == X_AXIS)
+ {
+ if (signdx > 0)
+ {
+ while (len--)
+ {
+ *addrl = DoMaskRRop (*addrl, and, xor, bit);
+ bit = SCRRIGHT(bit,1);
+ e += e1;
+ if (e >= 0)
+ {
+ addrl += nlwidth;
+ e += e3;
+ }
+ if (!bit)
+ {
+ bit = leftbit;
+ addrl++;
+ }
+ }
+ }
+ else
+ {
+ while (len--)
+ {
+ *addrl = DoMaskRRop (*addrl, and, xor, bit);
+ e += e1;
+ bit = SCRLEFT(bit,1);
+ if (e >= 0)
+ {
+ addrl += nlwidth;
+ e += e3;
+ }
+ if (!bit)
+ {
+ bit = rightbit;
+ addrl--;
+ }
+ }
+ }
+ } /* if X_AXIS */
+ else
+ {
+ if (signdx > 0)
+ {
+ while(len--)
+ {
+ *addrl = DoMaskRRop (*addrl, and, xor, bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRRIGHT(bit,1);
+ if (!bit)
+ {
+ bit = leftbit;
+ addrl++;
+ }
+ e += e3;
+ }
+ addrl += nlwidth;
+ }
+ }
+ else
+ {
+ while(len--)
+ {
+ *addrl = DoMaskRRop (*addrl, and, xor, bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRLEFT(bit,1);
+ if (!bit)
+ {
+ bit = rightbit;
+ addrl--;
+ }
+ e += e3;
+ }
+ addrl += nlwidth;
+ }
+ }
+ } /* else Y_AXIS */
+#endif
+}
diff --git a/xc/programs/Xserver/cfb/cfbbresd.c b/xc/programs/Xserver/cfb/cfbbresd.c
new file mode 100644
index 000000000..0046a93b7
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbbresd.c
@@ -0,0 +1,398 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbresd.c,v 3.2 1998/10/04 09:37:37 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: cfbbresd.c /main/17 1998/02/09 14:04:47 kaleb $ */
+#include "X.h"
+#include "misc.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "miline.h"
+
+/* Dashed bresenham line */
+
+void
+cfbBresD(rrops,
+ pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1, e, e1, e2, len)
+ cfbRRopPtr rrops;
+ int *pdashIndex; /* current dash */
+ unsigned char *pDash; /* dash list */
+ int numInDashList; /* total length of dash list */
+ int *pdashOffset; /* offset into current dash */
+ int isDoubleDash;
+ unsigned long *addrl; /* pointer to base of bitmap */
+ int nlwidth; /* width in longwords of bitmap */
+ int signdx, signdy; /* signs of directions */
+ int axis; /* major axis (Y_AXIS or X_AXIS) */
+ int x1, y1; /* initial point */
+ register int e; /* error accumulator */
+ register int e1; /* bresenham increments */
+ int e2;
+ int len; /* length of line */
+{
+#ifdef PIXEL_ADDR
+ register PixelType *addrp;
+#endif
+ register int e3 = e2-e1;
+ int dashIndex;
+ int dashOffset;
+ int dashRemaining;
+ unsigned long xorFg, andFg, xorBg, andBg;
+ Bool isCopy;
+ int thisDash;
+#if PSZ == 24
+ unsigned long xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3];
+ char *addrb;
+ int signdx3, signdy3;
+#endif
+
+ dashOffset = *pdashOffset;
+ dashIndex = *pdashIndex;
+ isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy);
+#if PSZ == 24
+ xorFg = rrops[0].xor & 0xffffff;
+ andFg = rrops[0].and & 0xffffff;
+ xorBg = rrops[1].xor & 0xffffff;
+ andBg = rrops[1].and & 0xffffff;
+ xorPiQxlFg[0] = xorFg | (xorFg << 24);
+ xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16);
+ xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8);
+ andPiQxlFg[0] = andFg | (andFg << 24);
+ andPiQxlFg[1] = (andFg >> 8) | (andFg << 16);
+ andPiQxlFg[2] = (andFg >> 16) | (andFg << 8);
+ xorPiQxlBg[0] = xorBg | (xorBg << 24);
+ xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16);
+ xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8);
+ andPiQxlBg[0] = andBg | (andBg << 24);
+ andPiQxlBg[1] = (andBg >> 8) | (andBg << 16);
+ andPiQxlBg[2] = (andFg >> 16) | (andBg << 8);
+#else
+ xorFg = rrops[0].xor;
+ andFg = rrops[0].and;
+ xorBg = rrops[1].xor;
+ andBg = rrops[1].and;
+#endif
+ dashRemaining = pDash[dashIndex] - dashOffset;
+ if ((thisDash = dashRemaining) >= len)
+ {
+ thisDash = len;
+ dashRemaining -= len;
+ }
+ e = e-e1; /* to make looping easier */
+
+#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;}
+
+#define NextDash {\
+ dashIndex++; \
+ if (dashIndex == numInDashList) \
+ dashIndex = 0; \
+ dashRemaining = pDash[dashIndex]; \
+ if ((thisDash = dashRemaining) >= len) \
+ { \
+ dashRemaining -= len; \
+ thisDash = len; \
+ } \
+}
+
+#ifdef PIXEL_ADDR
+
+#if PSZ == 24
+#define Loop(store) while (thisDash--) {\
+ store; \
+ BresStep(addrb+=signdy3,addrb+=signdx3) \
+ }
+ /* point to first point */
+ nlwidth <<= PWSH;
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth);
+ addrb = (char *)addrp + x1 * 3;
+
+#else
+#define Loop(store) while (thisDash--) {\
+ store; \
+ BresStep(addrp+=signdy,addrp+=signdx) \
+ }
+ /* point to first point */
+ nlwidth <<= PWSH;
+ addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
+#endif
+ signdy *= nlwidth;
+#if PSZ == 24
+ signdx3 = signdx * 3;
+ signdy3 = signdy * sizeof (long);
+#endif
+ if (axis == Y_AXIS)
+ {
+ int t;
+
+ t = signdx;
+ signdx = signdy;
+ signdy = t;
+#if PSZ == 24
+ t = signdx3;
+ signdx3 = signdy3;
+ signdy3 = t;
+#endif
+ }
+
+ if (isCopy)
+ {
+#if PSZ == 24
+#define body_copy(pix) { \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \
+ *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \
+ *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \
+ break; \
+ } \
+}
+#endif /* PSZ == 24 */
+
+ for (;;)
+ {
+ len -= thisDash;
+ if (dashIndex & 1) {
+ if (isDoubleDash) {
+#if PSZ == 24
+ Loop(body_copy(xorPiQxlBg))
+#else
+ Loop(*addrp = xorBg)
+#endif
+ } else {
+ Loop(;)
+ }
+ } else {
+#if PSZ == 24
+ Loop(body_copy(xorPiQxlFg))
+#else
+ Loop(*addrp = xorFg)
+#endif
+ }
+ if (!len)
+ break;
+ NextDash
+ }
+#undef body_copy
+ }
+ else
+ {
+#define body_set(and, xor) { \
+ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
+ switch((unsigned long)addrb & 3){ \
+ case 0: \
+ *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \
+ break; \
+ case 1: \
+ *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \
+ break; \
+ case 3: \
+ *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \
+ *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \
+ break; \
+ case 2: \
+ *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \
+ *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \
+ break; \
+ } \
+}
+
+ for (;;)
+ {
+ len -= thisDash;
+ if (dashIndex & 1) {
+ if (isDoubleDash) {
+#if PSZ == 24
+ Loop(body_set(andPiQxlBg, xorPiQxlBg))
+#else
+ Loop(*addrp = DoRRop(*addrp,andBg, xorBg))
+#endif
+ } else {
+ Loop(;)
+ }
+ } else {
+#if PSZ == 24
+ Loop(body_set(andPiQxlFg, xorPiQxlFg))
+#else
+ Loop(*addrp = DoRRop(*addrp,andFg, xorFg))
+#endif
+ }
+ if (!len)
+ break;
+ NextDash
+ }
+#undef body_set
+ }
+#else /* !PIXEL_ADDR */
+ {
+ register unsigned long tmp;
+ unsigned long startbit, bit;
+
+ /* point to longword containing first point */
+#if PSZ == 24
+ addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2);
+#else
+ addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
+#endif
+ signdy = signdy * nlwidth;
+
+ if (signdx > 0)
+ startbit = cfbmask[0];
+ else
+#if PSZ == 24
+ startbit = cfbmask[(PPW-1)<<1];
+ bit = cfbmask[(x1 & 3)<<1];
+#else
+ startbit = cfbmask[PPW-1];
+ bit = cfbmask[x1 & PIM];
+#endif
+
+#if PSZ == 24
+#define X_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(addrl += signdy, \
+ if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }) \
+ }
+#define Y_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }, \
+ addrl += signdy) \
+ }
+#else
+#define X_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(addrl += signdy, \
+ if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }) \
+ }
+#define Y_Loop(store) while(thisDash--) {\
+ store; \
+ BresStep(if (signdx > 0) \
+ bit = SCRRIGHT(bit,1); \
+ else \
+ bit = SCRLEFT(bit,1); \
+ if (!bit) \
+ { \
+ bit = startbit; \
+ addrl += signdx; \
+ }, \
+ addrl += signdy) \
+ }
+#endif
+
+ if (axis == X_AXIS)
+ {
+ for (;;)
+ {
+ len -= thisDash;
+ if (dashIndex & 1) {
+ if (isDoubleDash) {
+ X_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
+ } else {
+ X_Loop(;)
+ }
+ } else {
+ X_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
+ }
+ if (!len)
+ break;
+ NextDash
+ }
+ } /* if X_AXIS */
+ else
+ {
+ for (;;)
+ {
+ len -= thisDash;
+ if (dashIndex & 1) {
+ if (isDoubleDash) {
+ Y_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
+ } else {
+ Y_Loop(;)
+ }
+ } else {
+ Y_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
+ }
+ if (!len)
+ break;
+ NextDash
+ }
+ } /* else Y_AXIS */
+ }
+#endif
+ *pdashIndex = dashIndex;
+ *pdashOffset = pDash[dashIndex] - dashRemaining;
+}
diff --git a/xc/programs/Xserver/cfb/cfbbstore.c b/xc/programs/Xserver/cfb/cfbbstore.c
new file mode 100644
index 000000000..90020c188
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbbstore.c
@@ -0,0 +1,141 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbbstore.c,v 1.4 1999/01/31 12:21:41 dawes Exp $ */
+/*-
+ * cfbbstore.c --
+ * Functions required by the backing-store implementation in MI.
+ *
+ * Copyright (c) 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ *
+ */
+/* $TOG: cfbbstore.c /main/18 1998/02/17 11:03:44 kaleb $ */
+
+#include "cfb.h"
+#include "X.h"
+#include "mibstore.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+
+/*-
+ *-----------------------------------------------------------------------
+ * cfbSaveAreas --
+ * Function called by miSaveAreas to actually fetch the areas to be
+ * saved into the backing pixmap. This is very simple to do, since
+ * cfbDoBitblt is designed for this very thing. The region to save is
+ * already destination-relative and we're given the offset to the
+ * window origin, so we have only to create an array of points of the
+ * u.l. corners of the boxes in the region translated to the screen
+ * coordinate system and fetch the screen pixmap out of its devPrivate
+ * field....
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Data are copied from the screen into the pixmap.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
+ PixmapPtr pPixmap; /* Backing pixmap */
+ RegionPtr prgnSave; /* Region to save (pixmap-relative) */
+ int xorg; /* X origin of region */
+ int yorg; /* Y origin of region */
+ WindowPtr pWin;
+{
+ register DDXPointPtr pPt;
+ DDXPointPtr pPtsInit;
+ register BoxPtr pBox;
+ register int i;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ PixmapPtr pScrPix;
+
+ i = REGION_NUM_RECTS(prgnSave);
+ pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
+ if (!pPtsInit)
+ return;
+
+ pBox = REGION_RECTS(prgnSave);
+ pPt = pPtsInit;
+ while (--i >= 0) {
+ pPt->x = pBox->x1 + xorg;
+ pPt->y = pBox->y1 + yorg;
+ pPt++;
+ pBox++;
+ }
+
+ pScrPix = (*pScreen->GetWindowPixmap)(pWin);
+
+
+ cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
+ GXcopy, prgnSave, pPtsInit, ~0L);
+
+ DEALLOCATE_LOCAL (pPtsInit);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * cfbRestoreAreas --
+ * Function called by miRestoreAreas to actually fetch the areas to be
+ * restored from the backing pixmap. This is very simple to do, since
+ * cfbDoBitblt is designed for this very thing. The region to restore is
+ * already destination-relative and we're given the offset to the
+ * window origin, so we have only to create an array of points of the
+ * u.l. corners of the boxes in the region translated to the pixmap
+ * coordinate system and fetch the screen pixmap out of its devPrivate
+ * field....
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Data are copied from the pixmap into the screen.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
+ PixmapPtr pPixmap; /* Backing pixmap */
+ RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
+ int xorg; /* X origin of window */
+ int yorg; /* Y origin of window */
+ WindowPtr pWin;
+{
+ register DDXPointPtr pPt;
+ DDXPointPtr pPtsInit;
+ register BoxPtr pBox;
+ register int i;
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ PixmapPtr pScrPix;
+
+ i = REGION_NUM_RECTS(prgnRestore);
+ pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
+ if (!pPtsInit)
+ return;
+
+ pBox = REGION_RECTS(prgnRestore);
+ pPt = pPtsInit;
+ while (--i >= 0) {
+ pPt->x = pBox->x1 - xorg;
+ pPt->y = pBox->y1 - yorg;
+ pPt++;
+ pBox++;
+ }
+
+ pScrPix = (*pScreen->GetWindowPixmap)(pWin);
+
+ cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
+ GXcopy, prgnRestore, pPtsInit, ~0L);
+
+ DEALLOCATE_LOCAL (pPtsInit);
+}
diff --git a/xc/programs/Xserver/cfb/cfbcmap.c b/xc/programs/Xserver/cfb/cfbcmap.c
new file mode 100644
index 000000000..c9a19af5a
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbcmap.c
@@ -0,0 +1,126 @@
+/* $TOG: cfbcmap.c /main/25 1998/02/09 14:05:03 kaleb $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbcmap.c,v 3.11 1999/04/11 13:10:39 dawes Exp $ */
+
+
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "colormapst.h"
+#include "resource.h"
+#include "micmap.h"
+
+int
+cfbListInstalledColormaps(pScreen, pmaps)
+ ScreenPtr pScreen;
+ Colormap *pmaps;
+{
+ return miListInstalledColormaps(pScreen, pmaps);
+}
+
+void
+cfbInstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ miInstallColormap(pmap);
+}
+
+void
+cfbUninstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ miUninstallColormap(pmap);
+}
+
+void
+cfbResolveColor(pred, pgreen, pblue, pVisual)
+ unsigned short *pred, *pgreen, *pblue;
+ register VisualPtr pVisual;
+{
+ miResolveColor(pred, pgreen, pblue, pVisual);
+}
+
+Bool
+cfbInitializeColormap(pmap)
+ register ColormapPtr pmap;
+{
+ return miInitializeColormap(pmap);
+}
+
+int
+cfbExpandDirectColors (pmap, ndef, indefs, outdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *indefs, *outdefs;
+{
+ return miExpandDirectColors(pmap, ndef, indefs, outdefs);
+}
+
+Bool
+cfbCreateDefColormap(pScreen)
+ ScreenPtr pScreen;
+{
+ return miCreateDefColormap(pScreen);
+}
+
+void
+cfbClearVisualTypes()
+{
+ miClearVisualTypes();
+}
+
+Bool
+cfbSetVisualTypes (depth, visuals, bitsPerRGB)
+ int depth;
+ int visuals;
+ int bitsPerRGB;
+{
+ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
+}
+
+/*
+ * Given a list of formats for a screen, create a list
+ * of visuals and depths for the screen which coorespond to
+ * the set which can be used with this version of cfb.
+ */
+
+Bool
+cfbInitVisuals (visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB)
+ VisualPtr *visualp;
+ DepthPtr *depthp;
+ int *nvisualp, *ndepthp;
+ int *rootDepthp;
+ VisualID *defaultVisp;
+ unsigned long sizes;
+ int bitsPerRGB;
+{
+ return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
+ defaultVisp, sizes, bitsPerRGB, -1);
+}
diff --git a/xc/programs/Xserver/cfb/cfbcppl.c b/xc/programs/Xserver/cfb/cfbcppl.c
new file mode 100644
index 000000000..56abbe2aa
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbcppl.c
@@ -0,0 +1,478 @@
+/*
+ * $TOG: cfb8cppl.c /main/16 1998/02/09 14:04:13 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbcppl.c,v 1.1 1999/08/21 13:48:14 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "cfb.h"
+#if PSZ == 8
+#undef PSZ /* for maskbits.h */
+#include "maskbits.h"
+#define PSZ 8
+#endif
+#include "mergerop.h"
+
+
+void
+cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+#if PSZ == 8
+ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+#if PSZ == 16
+ cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+#if PSZ == 32
+ cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+}
+
+#if PSZ == 8
+
+#if BITMAP_BIT_ORDER == MSBFirst
+#define LeftMost (MFB_PPW-1)
+#define StepBit(bit, inc) ((bit) -= (inc))
+#else
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+#endif
+
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+
+void
+cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty, width, height;
+ unsigned char *psrcBase;
+ PixelType *pdstBase;
+ int widthSrc, widthDst;
+ unsigned char *psrcLine;
+ PixelType *pdstLine;
+ register unsigned char *psrc;
+ register int i;
+ register int curBit;
+ register int bitPos;
+ register unsigned long bits;
+ register PixelType *pdst;
+ PixelType startmask, endmask;
+ int niStart, niEnd;
+ int bitStart, bitEnd;
+ int nl, nlMiddle;
+ int nbox;
+ BoxPtr pbox;
+ MROP_DECLARE()
+
+ if (!(planemask & 1))
+ return;
+
+ if (rop != GXcopy)
+ MROP_INITIALIZE (rop, planemask);
+
+ cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
+
+ mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase)
+
+ bitPos = ffs (bitPlane) - 1;
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+ psrcLine = psrcBase + srcy * widthSrc + srcx;
+ pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst);
+ dstx &= MFB_PIM;
+ if (dstx + width <= MFB_PPW)
+ {
+ maskpartialbits(dstx, width, startmask);
+ nlMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ maskbits (dstx, width, startmask, endmask, nlMiddle);
+ }
+ if (startmask)
+ {
+ niStart = min(MFB_PPW - dstx, width);
+ bitStart = LeftMost;
+ StepBit (bitStart, dstx);
+ }
+ if (endmask)
+ {
+ niEnd = (dstx + width) & MFB_PIM;
+ bitEnd = LeftMost;
+ }
+ if (rop == GXcopy)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ mfbScanlineInc(pdstLine, widthDst);
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = *pdst & ~startmask | bits;
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = MFB_PPW;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst++ = bits;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = *pdst & ~endmask | bits;
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ mfbScanlineInc(pdstLine, widthDst);
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_MASK(bits, *pdst, startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = MFB_PPW;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_SOLID(bits, *pdst);
+ pdst++;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_MASK (bits, *pdst, endmask);
+ }
+ }
+ }
+ }
+}
+
+#else /* PSZ == 8 */
+
+#define mfbmaskbits(x, w, startmask, endmask, nlw) \
+ startmask = starttab[(x)&0x1f]; \
+ endmask = endtab[((x)+(w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5;
+
+#define mfbmaskpartialbits(x, w, mask) \
+ mask = partmasks[(x)&0x1f][(w)&0x1f];
+
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+
+
+#if PSZ == 24
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ if (bitPos < 8) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ psrc += 2; \
+ } \
+ else if (bitPos < 16) \
+ { \
+ psrc++; \
+ bits |= ((*psrc++ >> (bitPos - 8)) & 1) << curBit; \
+ psrc++; \
+ } \
+ else \
+ { \
+ psrc += 2; \
+ bits |= ((*psrc++ >> (bitPos - 16)) & 1) << curBit; \
+ } \
+ StepBit (curBit, 1); \
+ } \
+}
+#else
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+#endif
+
+void
+#if PSZ == 16
+cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 24
+cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 32
+cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty, width, height;
+ unsigned long *psrcBase;
+ unsigned long *pdstBase;
+ int widthSrc, widthDst;
+#if PSZ == 16
+ unsigned short *psrcLine;
+ register unsigned short *psrc;
+#endif
+#if PSZ == 24
+ unsigned char *psrcLine;
+ register unsigned char *psrc;
+#endif
+#if PSZ == 32
+ unsigned int *psrcLine;
+ register unsigned int *psrc;
+#endif
+ unsigned int *pdstLine;
+ register unsigned int *pdst;
+ register int i;
+ register int curBit;
+ register int bitPos;
+ register unsigned int bits;
+ unsigned int startmask, endmask;
+ int niStart, niEnd;
+ int bitStart, bitEnd;
+ int nl, nlMiddle;
+ int nbox;
+ BoxPtr pbox;
+ int result;
+
+ extern int starttab[32], endtab[32];
+ extern unsigned int partmasks[32][32];
+
+
+ if (!(planemask & 1))
+ return;
+
+ /* must explicitly ask for "int" widths, as code below expects it */
+ /* on some machines (Alpha), "long" and "int" are not the same size */
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, unsigned long)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, unsigned long)
+
+#if PSZ == 16
+ widthSrc <<= 1;
+#endif
+#if PSZ == 24
+ widthSrc <<= 2;
+#endif
+
+ bitPos = ffs (bitPlane) - 1;
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+#if PSZ == 16
+ psrcLine = (unsigned short *)psrcBase + srcy * widthSrc + srcx;
+#endif
+#if PSZ == 24
+ psrcLine = (unsigned char *)psrcBase + srcy * widthSrc + srcx * 3;
+#endif
+#if PSZ == 32
+ psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx;
+#endif
+ pdstLine = (unsigned int *)pdstBase + dsty * widthDst + (dstx >> 5);
+ if (dstx + width <= 32)
+ {
+ mfbmaskpartialbits(dstx, width, startmask);
+ nlMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ mfbmaskbits (dstx, width, startmask, endmask, nlMiddle);
+ }
+ if (startmask)
+ {
+ niStart = 32 - (dstx & 0x1f);
+ bitStart = LeftMost;
+ StepBit (bitStart, (dstx & 0x1f));
+ }
+ if (endmask)
+ {
+ niEnd = (dstx + width) & 0x1f;
+ bitEnd = LeftMost;
+ }
+ if (rop == GXcopy)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+
+ *pdst = (*pdst & ~startmask) | bits;
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = 32;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst++ = bits;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+
+ *pdst = (*pdst & ~endmask) | bits;
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+
+ *pdst = (*pdst & ~startmask) |
+ (result & startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = 32;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+ *pdst = result;
+ ++pdst;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+
+ *pdst = (*pdst & ~endmask) |
+ (result & endmask);
+ }
+ }
+ }
+ }
+}
+
+#endif /* PSZ == 8 */
diff --git a/xc/programs/Xserver/cfb/cfbfillarc.c b/xc/programs/Xserver/cfb/cfbfillarc.c
new file mode 100644
index 000000000..d51498681
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbfillarc.c
@@ -0,0 +1,364 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.2 1998/10/04 09:37:39 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: cfbfillarc.c /main/18 1998/02/09 14:05:10 kaleb $ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "miscstruct.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "mifillarc.h"
+#include "cfbrrop.h"
+#include "mi.h"
+
+/* gcc 1.35 is stupid */
+#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020)
+#define STUPID volatile
+#else
+#define STUPID
+#endif
+
+static void
+RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ xArc *arc;
+{
+ STUPID int x, y, e;
+ STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ miFillArcRec info;
+#if PSZ == 24
+ unsigned char *addrlt, *addrlb;
+#else
+ unsigned long *addrlt, *addrlb;
+#endif
+ register unsigned long *addrl;
+ register int n;
+ int nlwidth;
+ RROP_DECLARE
+ register int xpos;
+ register int slw;
+ unsigned long startmask, endmask;
+ int nlmiddle;
+#if PSZ == 24
+ register int pidx;
+ int xpos3;
+#endif
+
+#if PSZ == 24
+ cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
+#else
+ cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
+#endif
+
+ RROP_FETCH_GC(pGC);
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt += nlwidth * (yorg - y);
+ addrlb += nlwidth * (yorg + y + dy);
+ while (y)
+ {
+ addrlt += nlwidth;
+ addrlb -= nlwidth;
+ MIFILLARCSTEP(slw);
+ if (!slw)
+ continue;
+ xpos = xorg - x;
+#if PSZ == 24
+ xpos3 = (xpos * 3) & ~0x03;
+ addrl = (unsigned long *)((char *)addrlt + xpos3);
+ if (slw == 1){
+ RROP_SOLID24(addrl, xpos);
+ if (miFillArcLower(slw)){
+ addrl = (unsigned long *)((char *)addrlb + xpos3);
+ RROP_SOLID24(addrl, xpos);
+ }
+ continue;
+ }
+ maskbits(xpos, slw, startmask, endmask, nlmiddle);
+ xpos &= 3;
+ pidx = xpos;
+ if (startmask){
+ RROP_SOLID_MASK(addrl, startmask, pidx-1);
+ addrl++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ n = nlmiddle;
+ while (--n >= 0){
+ RROP_SOLID(addrl, pidx);
+ addrl++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask, pidx);
+ if (!miFillArcLower(slw))
+ continue;
+ addrl = (unsigned long *)((char *)addrlb + xpos3);
+ pidx = xpos;
+ if (startmask){
+ RROP_SOLID_MASK(addrl, startmask, pidx-1);
+ addrl++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ n = nlmiddle;
+ while (--n >= 0){
+ RROP_SOLID(addrl, pidx);
+ addrl++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask, pidx);
+#else /* PSZ == 24 */
+ addrl = addrlt + (xpos >> PWSH);
+ if (((xpos & PIM) + slw) <= PPW)
+ {
+ maskpartialbits(xpos, slw, startmask);
+ RROP_SOLID_MASK(addrl,startmask);
+ if (miFillArcLower(slw))
+ {
+ addrl = addrlb + (xpos >> PWSH);
+ RROP_SOLID_MASK(addrl, startmask);
+ }
+ continue;
+ }
+ maskbits(xpos, slw, startmask, endmask, nlmiddle);
+ if (startmask)
+ {
+ RROP_SOLID_MASK(addrl, startmask);
+ addrl++;
+ }
+ n = nlmiddle;
+ RROP_SPAN(addrl,n)
+
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask);
+ if (!miFillArcLower(slw))
+ continue;
+ addrl = addrlb + (xpos >> PWSH);
+ if (startmask)
+ {
+ RROP_SOLID_MASK(addrl, startmask);
+ addrl++;
+ }
+ n = nlmiddle;
+ RROP_SPAN(addrl, n);
+ if (endmask)
+ RROP_SOLID_MASK(addrl, endmask);
+#endif /* PSZ == 24 */
+ }
+}
+
+#if PSZ == 24
+#define FILLSPAN(xl,xr,addr) \
+ if (xr >= xl){ \
+ n = xr - xl + 1; \
+ addrl = (unsigned long *)((char *)addr + ((xl * 3) & ~0x03)); \
+ if (n <= 1){ \
+ if (n) \
+ RROP_SOLID24(addrl, xl); \
+ } else { \
+ maskbits(xl, n, startmask, endmask, n); \
+ pidx = xl & 3; \
+ if (startmask){ \
+ RROP_SOLID_MASK(addrl, startmask, pidx-1); \
+ addrl++; \
+ if (pidx == 3) \
+ pidx = 0; \
+ } \
+ while (--n >= 0){ \
+ RROP_SOLID(addrl, pidx); \
+ addrl++; \
+ if (++pidx == 3) \
+ pidx = 0; \
+ } \
+ if (endmask) \
+ RROP_SOLID_MASK(addrl, endmask, pidx); \
+ } \
+ }
+#else /* PSZ == 24 */
+#define FILLSPAN(xl,xr,addr) \
+ if (xr >= xl) \
+ { \
+ n = xr - xl + 1; \
+ addrl = addr + (xl >> PWSH); \
+ if (((xl & PIM) + n) <= PPW) \
+ { \
+ maskpartialbits(xl, n, startmask); \
+ RROP_SOLID_MASK(addrl, startmask); \
+ } \
+ else \
+ { \
+ maskbits(xl, n, startmask, endmask, n); \
+ if (startmask) \
+ { \
+ RROP_SOLID_MASK(addrl, startmask); \
+ addrl++; \
+ } \
+ while (n--) \
+ { \
+ RROP_SOLID(addrl); \
+ ++addrl; \
+ } \
+ if (endmask) \
+ RROP_SOLID_MASK(addrl, endmask); \
+ } \
+ }
+#endif /* PSZ == 24 */
+
+#define FILLSLICESPANS(flip,addr) \
+ if (!flip) \
+ { \
+ FILLSPAN(xl, xr, addr); \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ FILLSPAN(xc, xr, addr); \
+ xc += slw - 1; \
+ FILLSPAN(xl, xc, addr); \
+ }
+
+static void
+RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ xArc *arc;
+{
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int xl, xr, xc;
+#if PSZ == 24
+ unsigned char *addrlt, *addrlb;
+#else
+ unsigned long *addrlt, *addrlb;
+#endif
+ register unsigned long *addrl;
+ register int n;
+ int nlwidth;
+ RROP_DECLARE
+ unsigned long startmask, endmask;
+#if PSZ == 24
+ register int pidx;
+#endif /* PSZ == 24 */
+
+#if PSZ == 24
+ cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
+#else
+ cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
+#endif
+
+ RROP_FETCH_GC(pGC);
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt += nlwidth * (yorg - y);
+ addrlb += nlwidth * (yorg + y + dy);
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ while (y > 0)
+ {
+ addrlt += nlwidth;
+ addrlb -= nlwidth;
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice))
+ {
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_top, addrlt);
+ }
+ if (miFillSliceLower(slice))
+ {
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_bot, addrlb);
+ }
+ }
+}
+
+void
+RROP_NAME(cfbPolyFillArcSolid) (pDraw, pGC, narcs, parcs)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ register xArc *arc;
+ register int i;
+ int x2, y2;
+ BoxRec box;
+ RegionPtr cclip;
+
+ cclip = cfbGetCompositeClip(pGC);
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc))
+ {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int)arc->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int)arc->height + 1;
+ box.y2 = y2;
+ if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) &&
+ (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
+ {
+ if ((arc->angle2 >= FULLCIRCLE) ||
+ (arc->angle2 <= -FULLCIRCLE))
+ RROP_NAME(cfbFillEllipseSolid)(pDraw, pGC, arc);
+ else
+ RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc);
+ continue;
+ }
+ }
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbfillrct.c b/xc/programs/Xserver/cfb/cfbfillrct.c
new file mode 100644
index 000000000..7ba885aaf
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbfillrct.c
@@ -0,0 +1,299 @@
+/*
+ * Fill rectangles.
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillrct.c,v 3.5 1999/03/14 03:21:31 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/* $TOG: cfbfillrct.c /main/20 1998/02/09 14:05:17 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "mergerop.h"
+
+
+void
+cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot)
+ DrawablePtr pDrawable;
+ int n;
+ BoxPtr rects;
+ PixmapPtr tile;
+ int xrot, yrot;
+{
+#if PSZ == 24
+ if (tile->drawable.width & 3)
+#else
+ if (tile->drawable.width & PIM)
+#endif
+ cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
+ else
+ cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
+}
+
+void
+cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox;
+ BoxPtr pBox;
+{
+ int xrot, yrot;
+ void (*fill)();
+
+ xrot = pDrawable->x + pGC->patOrg.x;
+ yrot = pDrawable->y + pGC->patOrg.y;
+#if PSZ == 24
+ if (pGC->tile.pixmap->drawable.width & 3)
+#else
+ if (pGC->tile.pixmap->drawable.width & PIM)
+#endif
+ {
+ fill = cfbFillBoxTileOddGeneral;
+ if ((pGC->planemask & PMSK) == PMSK)
+ {
+ if (pGC->alu == GXcopy)
+ fill = cfbFillBoxTileOddCopy;
+ }
+ }
+ else
+ {
+ fill = cfbFillBoxTile32sGeneral;
+ if ((pGC->planemask & PMSK) == PMSK)
+ {
+ if (pGC->alu == GXcopy)
+ fill = cfbFillBoxTile32sCopy;
+ }
+ }
+ (*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
+}
+
+#define NUM_STACK_RECTS 1024
+
+void
+cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int nrectFill; /* number of rectangles to fill */
+ xRectangle *prectInit; /* Pointer to first rectangle to fill */
+{
+ xRectangle *prect;
+ RegionPtr prgnClip;
+ register BoxPtr pbox;
+ register BoxPtr pboxClipped;
+ BoxPtr pboxClippedBase;
+ BoxPtr pextent;
+ BoxRec stackRects[NUM_STACK_RECTS];
+ cfbPrivGC *priv;
+ int numRects;
+ void (*BoxFill)();
+ int n;
+ int xorg, yorg;
+
+#if PSZ != 8
+ if ((pGC->fillStyle == FillStippled) ||
+ (pGC->fillStyle == FillOpaqueStippled)) {
+ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
+ return;
+ }
+#endif
+
+ priv = cfbGetGCPrivate(pGC);
+ prgnClip = pGC->pCompositeClip;
+
+ BoxFill = 0;
+ switch (pGC->fillStyle)
+ {
+ case FillSolid:
+ switch (priv->rop) {
+ case GXcopy:
+ BoxFill = cfbFillRectSolidCopy;
+ break;
+ case GXxor:
+ BoxFill = cfbFillRectSolidXor;
+ break;
+ default:
+ BoxFill = cfbFillRectSolidGeneral;
+ break;
+ }
+ break;
+ case FillTiled:
+ if (!pGC->pRotatedPixmap)
+ BoxFill = cfbFillRectTileOdd;
+ else
+ {
+ if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
+ BoxFill = cfbFillRectTile32Copy;
+ else
+ BoxFill = cfbFillRectTile32General;
+ }
+ break;
+#if PSZ == 8
+ case FillStippled:
+ if (!pGC->pRotatedPixmap)
+ BoxFill = cfb8FillRectStippledUnnatural;
+ else
+ BoxFill = cfb8FillRectTransparentStippled32;
+ break;
+ case FillOpaqueStippled:
+ if (!pGC->pRotatedPixmap)
+ BoxFill = cfb8FillRectStippledUnnatural;
+ else
+ BoxFill = cfb8FillRectOpaqueStippled32;
+ break;
+#endif
+ }
+ prect = prectInit;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (xorg || yorg)
+ {
+ prect = prectInit;
+ n = nrectFill;
+ while(n--)
+ {
+ prect->x += xorg;
+ prect->y += yorg;
+ prect++;
+ }
+ }
+
+ prect = prectInit;
+
+ numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
+ if (numRects > NUM_STACK_RECTS)
+ {
+ pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+ if (!pboxClippedBase)
+ return;
+ }
+ else
+ pboxClippedBase = stackRects;
+
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1)
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_RECTS(prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ if ((pboxClipped->x1 = prect->x) < x1)
+ pboxClipped->x1 = x1;
+
+ if ((pboxClipped->y1 = prect->y) < y1)
+ pboxClipped->y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ pboxClipped->x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ pboxClipped->y2 = by2;
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2))
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ else
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ BoxRec box;
+
+ if ((box.x1 = prect->x) < x1)
+ box.x1 = x1;
+
+ if ((box.y1 = prect->y) < y1)
+ box.y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ box.x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ box.y2 = by2;
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--)
+ {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2)
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+ if (pboxClipped != pboxClippedBase)
+ (*BoxFill) (pDrawable, pGC,
+ pboxClipped-pboxClippedBase, pboxClippedBase);
+ if (pboxClippedBase != stackRects)
+ DEALLOCATE_LOCAL(pboxClippedBase);
+}
diff --git a/xc/programs/Xserver/cfb/cfbfillsp.c b/xc/programs/Xserver/cfb/cfbfillsp.c
new file mode 100644
index 000000000..d295d4f9c
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbfillsp.c
@@ -0,0 +1,994 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbfillsp.c,v 3.3 1998/10/04 09:37:40 dawes Exp $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: cfbfillsp.c /main/47 1998/02/09 14:05:23 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+#include "mergerop.h"
+
+#if PSZ == 8
+#include "cfb8bit.h"
+#endif
+
+#define MFB_CONSTS_ONLY
+#include "maskbits.h"
+
+#include "mi.h"
+#include "mispans.h"
+
+/* scanline filling for color frame buffer
+ written by drewry, oct 1986 modified by smarks
+ changes for compatibility with Little-endian systems Jul 1987; MIT:yba.
+
+ these routines all clip. they assume that anything that has called
+them has already translated the points (i.e. pGC->miTranslate is
+non-zero, which is howit gets set in cfbCreateGC().)
+
+ the number of new scnalines created by clipping ==
+MaxRectsPerBand * nSpans.
+
+ FillSolid is overloaded to be used for OpaqueStipple as well,
+if fgPixel == bgPixel.
+Note that for solids, PrivGC.rop == PrivGC.ropOpStip
+
+
+ FillTiled is overloaded to be used for OpaqueStipple, if
+fgPixel != bgPixel. based on the fill style, it uses
+{RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip}
+*/
+
+#ifdef notdef
+#include <stdio.h>
+static
+dumpspans(n, ppt, pwidth)
+ int n;
+ DDXPointPtr ppt;
+ int *pwidth;
+{
+ fprintf(stderr,"%d spans\n", n);
+ while (n--) {
+ fprintf(stderr, "[%d,%d] %d\n", ppt->x, ppt->y, *pwidth);
+ ppt++;
+ pwidth++;
+ }
+ fprintf(stderr, "\n");
+}
+#endif
+
+/* Fill spans with tiles that aren't 32 bits wide */
+void
+cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+DrawablePtr pDrawable;
+GC *pGC;
+int nInit; /* number of spans to fill */
+DDXPointPtr pptInit; /* pointer to list of start points */
+int *pwidthInit; /* pointer to list of n widths */
+int fSorted;
+{
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ void (*fill)();
+ int xrot, yrot;
+
+ if (!(pGC->planemask))
+ return;
+
+#if PSZ == 24
+ if (pGC->tile.pixmap->drawable.width & 3)
+#else
+ if (pGC->tile.pixmap->drawable.width & PIM)
+#endif
+ {
+ fill = cfbFillSpanTileOddGeneral;
+ if ((pGC->planemask & PMSK) == PMSK)
+ {
+ if (pGC->alu == GXcopy)
+ fill = cfbFillSpanTileOddCopy;
+ }
+ }
+ else
+ {
+ fill = cfbFillSpanTile32sGeneral;
+ if ((pGC->planemask & PMSK) == PMSK)
+ {
+ if (pGC->alu == GXcopy)
+ fill = cfbFillSpanTile32sCopy;
+ }
+ }
+ n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
+ if ( n == 0 )
+ return;
+ pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!ppt || !pwidth)
+ {
+ if (ppt) DEALLOCATE_LOCAL(ppt);
+ if (pwidth) DEALLOCATE_LOCAL(pwidth);
+ return;
+ }
+ n = miClipSpans( cfbGetCompositeClip(pGC),
+ pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ xrot = pDrawable->x + pGC->patOrg.x;
+ yrot = pDrawable->y + pGC->patOrg.y;
+
+ (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
+
+ DEALLOCATE_LOCAL(ppt);
+ DEALLOCATE_LOCAL(pwidth);
+}
+
+#if PSZ == 8
+
+void
+cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+DrawablePtr pDrawable;
+GC *pGC;
+int nInit; /* number of spans to fill */
+DDXPointPtr pptInit; /* pointer to list of start points */
+int *pwidthInit; /* pointer to list of n widths */
+int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidth; /* pointer to list of n widths */
+ int *pwidthFree;/* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ unsigned long *pdstBase; /* pointer to start of bitmap */
+ int nlwDst; /* width in longwords of bitmap */
+ register unsigned long *pdst; /* pointer to current word in bitmap */
+ PixmapPtr pStipple; /* pointer to stipple we want to fill with */
+ int nlw;
+ int x, y, w, xrem, xSrc, ySrc;
+ int stwidth, stippleWidth;
+ int stippleHeight;
+ register unsigned long bits, inputBits;
+ register int partBitsLeft;
+ int nextPartBits;
+ int bitsLeft, bitsWhole;
+ unsigned long *srcTemp, *srcStart;
+ unsigned long *psrcBase;
+ unsigned long startmask, endmask;
+
+ if (pGC->fillStyle == FillStippled)
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+ else
+ cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
+
+ if (cfb8StippleRRop == GXnoop)
+ return;
+
+ n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
+ if ( n == 0 )
+ return;
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans( cfbGetCompositeClip(pGC),
+ pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ /*
+ * OK, so what's going on here? We have two Drawables:
+ *
+ * The Stipple:
+ * Depth = 1
+ * Width = stippleWidth
+ * Words per scanline = stwidth
+ * Pointer to pixels = pStipple->devPrivate.ptr
+ */
+
+ pStipple = pGC->stipple;
+
+ stwidth = pStipple->devKind >> PWSH;
+ stippleWidth = pStipple->drawable.width;
+ stippleHeight = pStipple->drawable.height;
+ psrcBase = (unsigned long *) pStipple->devPrivate.ptr;
+
+ /*
+ * The Target:
+ * Depth = PSZ
+ * Width = determined from *pwidth
+ * Words per scanline = nlwDst
+ * Pointer to pixels = addrlBase
+ */
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
+
+ /* this replaces rotating the stipple. Instead we just adjust the offset
+ * at which we start grabbing bits from the stipple.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and xrem always stay within the stipple bounds.
+ */
+
+ modulus (pGC->patOrg.x, stippleWidth, xSrc);
+ xSrc += pDrawable->x - stippleWidth;
+ modulus (pGC->patOrg.y, stippleHeight, ySrc);
+ ySrc += pDrawable->y - stippleHeight;
+
+ bitsWhole = stippleWidth;
+
+ while (n--)
+ {
+ x = ppt->x;
+ y = ppt->y;
+ ppt++;
+ w = *pwidth++;
+ pdst = pdstBase + y * nlwDst + (x >> PWSH);
+ y = (y - ySrc) % stippleHeight;
+ srcStart = psrcBase + y * stwidth;
+ xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth;
+ srcTemp = srcStart + (xrem >> MFB_PWSH);
+ bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
+ xrem &= MFB_PIM;
+ NextUnnaturalStippleWord
+ if (partBitsLeft < xrem)
+ FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d",
+ partBitsLeft, xrem);
+ NextSomeBits (inputBits, xrem);
+ partBitsLeft -= xrem;
+ if (((x & PIM) + w) <= PPW)
+ {
+ maskpartialbits (x, w, startmask)
+ NextUnnaturalStippleBits
+ *pdst = MaskRRopPixels(*pdst,bits,startmask);
+ }
+ else
+ {
+ maskbits (x, w, startmask, endmask, nlw);
+ nextPartBits = (x & (PGSZB-1)) + w;
+ if (nextPartBits < partBitsLeft)
+ {
+ if (startmask)
+ {
+ MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask)
+ pdst++;
+ NextBitGroup (inputBits);
+ }
+ while (nlw--)
+ {
+ RRopBitGroup (pdst, GetBitGroup (inputBits));
+ pdst++;
+ NextBitGroup (inputBits);
+ }
+ if (endmask)
+ {
+ MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask)
+ }
+ }
+ else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft)
+ {
+ NextUnnaturalStippleBitsFast
+ if (startmask)
+ {
+ *pdst = MaskRRopPixels(*pdst,bits,startmask);
+ pdst++;
+ NextUnnaturalStippleBitsFast
+ }
+ while (nlw--)
+ {
+ *pdst = RRopPixels(*pdst,bits);
+ pdst++;
+ NextUnnaturalStippleBitsFast
+ }
+ if (endmask)
+ *pdst = MaskRRopPixels (*pdst,bits,endmask);
+ }
+ else
+ {
+ NextUnnaturalStippleBits
+ if (startmask)
+ {
+ *pdst = MaskRRopPixels(*pdst,bits,startmask);
+ pdst++;
+ NextUnnaturalStippleBits
+ }
+ while (nlw--)
+ {
+ *pdst = RRopPixels(*pdst,bits);
+ pdst++;
+ NextUnnaturalStippleBits
+ }
+ if (endmask)
+ *pdst = MaskRRopPixels(*pdst,bits,endmask);
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+#else /* PSZ != 8 */
+
+/* Fill spans with stipples that aren't 32 bits wide */
+void
+cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+DrawablePtr pDrawable;
+GC *pGC;
+int nInit; /* number of spans to fill */
+DDXPointPtr pptInit; /* pointer to list of start points */
+int *pwidthInit; /* pointer to list of n widths */
+int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ register DDXPointPtr ppt; /* pointer to list of start points */
+ register int *pwidth; /* pointer to list of n widths */
+ int iline; /* first line of tile to use */
+ unsigned long *addrlBase; /* pointer to start of bitmap */
+ int nlwidth; /* width in longwords of bitmap */
+ register unsigned long *pdst; /* pointer to current word in bitmap */
+ PixmapPtr pStipple; /* pointer to stipple we want to fill with */
+ register int w;
+ int width, x, xrem, xSrc, ySrc;
+ unsigned long tmpSrc, tmpDst1, tmpDst2;
+ int stwidth, stippleWidth;
+ unsigned long *psrcS;
+ int rop, stiprop;
+ int stippleHeight;
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ unsigned long fgfill, bgfill;
+
+ if (!(pGC->planemask))
+ return;
+
+ n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
+ if ( n == 0 )
+ return;
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans( cfbGetCompositeClip(pGC),
+ pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+ rop = pGC->alu;
+ if (pGC->fillStyle == FillStippled) {
+ switch (rop) {
+ case GXand:
+ case GXcopy:
+ case GXnoop:
+ case GXor:
+ stiprop = rop;
+ break;
+ default:
+ stiprop = rop;
+ rop = GXcopy;
+ }
+ }
+ fgfill = PFILL(pGC->fgPixel);
+ bgfill = PFILL(pGC->bgPixel);
+
+ /*
+ * OK, so what's going on here? We have two Drawables:
+ *
+ * The Stipple:
+ * Depth = 1
+ * Width = stippleWidth
+ * Words per scanline = stwidth
+ * Pointer to pixels = pStipple->devPrivate.ptr
+ */
+ pStipple = pGC->stipple;
+
+ stwidth = pStipple->devKind / PGSZB;
+ stippleWidth = pStipple->drawable.width;
+ stippleHeight = pStipple->drawable.height;
+
+ /*
+ * The Target:
+ * Depth = PSZ
+ * Width = determined from *pwidth
+ * Words per scanline = nlwidth
+ * Pointer to pixels = addrlBase
+ */
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrlBase)
+
+ /* this replaces rotating the stipple. Instead we just adjust the offset
+ * at which we start grabbing bits from the stipple.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and xrem always stay within the stipple bounds.
+ */
+ modulus (pGC->patOrg.x, stippleWidth, xSrc);
+ xSrc += pDrawable->x - stippleWidth;
+ modulus (pGC->patOrg.y, stippleHeight, ySrc);
+ ySrc += pDrawable->y - stippleHeight;
+
+ while (n--)
+ {
+ iline = (ppt->y - ySrc) % stippleHeight;
+ x = ppt->x;
+ pdst = addrlBase + (ppt->y * nlwidth);
+ psrcS = (unsigned long *) pStipple->devPrivate.ptr + (iline * stwidth);
+
+ if (*pwidth)
+ {
+ width = *pwidth;
+ while(width > 0)
+ {
+ int xtemp, tmpx;
+ register unsigned long *ptemp;
+ register unsigned long *pdsttmp;
+ /*
+ * Do a stripe through the stipple & destination w pixels
+ * wide. w is not more than:
+ * - the width of the destination
+ * - the width of the stipple
+ * - the distance between x and the next word
+ * boundary in the destination
+ * - the distance between x and the next word
+ * boundary in the stipple
+ */
+
+ /* width of dest/stipple */
+ xrem = (x - xSrc) % stippleWidth;
+#if PSZ == 24
+ w = 1;
+#else
+ w = min((stippleWidth - xrem), width);
+ /* dist to word bound in dest */
+ w = min(w, PPW - (x & PIM));
+ /* dist to word bound in stip */
+ w = min(w, MFB_PPW - (x & MFB_PIM));
+#endif
+
+ xtemp = (xrem & MFB_PIM);
+ ptemp = (unsigned long *)(psrcS + (xrem >> MFB_PWSH));
+#if PSZ == 24
+ tmpx = x & 3;
+ pdsttmp = pdst + ((x * 3)>>2);
+#else
+ tmpx = x & PIM;
+ pdsttmp = pdst + (x>>PWSH);
+#endif
+ switch ( pGC->fillStyle ) {
+ case FillOpaqueStippled:
+#if PSZ == 24
+ getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem);
+ getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem);
+#else
+ getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1);
+ getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2);
+#endif
+ break;
+ case FillStippled:
+ /* Fill tmpSrc with the source pixels */
+#if PSZ == 24
+ getbits24(pdsttmp, tmpSrc, x);
+ getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem);
+#else
+ getbits(pdsttmp, tmpx, w, tmpSrc);
+ getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1);
+#endif
+ if (rop != stiprop) {
+#if PSZ == 24
+ putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop);
+#else
+ putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop);
+#endif
+ } else {
+ tmpSrc = fgfill;
+ }
+#if PSZ == 24
+ getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem);
+#else
+ getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2);
+#endif
+ break;
+ }
+ tmpDst2 |= tmpDst1;
+#if PSZ == 24
+ putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop);
+#else
+ putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop);
+#endif
+ x += w;
+ width -= w;
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+#endif /* PSZ == 8 */
+
+#if PSZ == 8
+
+void
+cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidth; /* pointer to list of n widths */
+ unsigned long *src; /* pointer to bits in stipple, if needed */
+ int stippleHeight; /* height of the stipple */
+ PixmapPtr stipple;
+
+ int nlwDst; /* width in longwords of the dest pixmap */
+ int x,y,w; /* current span */
+ unsigned long startmask;
+ unsigned long endmask;
+ register unsigned long *dst; /* pointer to bits we're writing */
+ register int nlw;
+ unsigned long *dstTmp;
+ int nlwTmp;
+
+ unsigned long *pbits; /* pointer to start of pixmap */
+ register unsigned long xor;
+ register unsigned long mask;
+ register unsigned long bits; /* bits from stipple */
+ int wEnd;
+
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ cfbPrivGCPtr devPriv;
+
+ devPriv = cfbGetGCPrivate(pGC);
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ if ( n == 0 )
+ return;
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ stipple = pGC->pRotatedPixmap;
+ src = (unsigned long *)stipple->devPrivate.ptr;
+ stippleHeight = stipple->drawable.height;
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+ while (n--)
+ {
+ w = *pwidth++;
+ x = ppt->x;
+ y = ppt->y;
+ ppt++;
+ dst = pbits + (y * nlwDst) + (x >> PWSH);
+ if (((x & PIM) + w) <= PPW)
+ {
+ maskpartialbits(x, w, startmask);
+ endmask = 0;
+ nlw = 0;
+ }
+ else
+ {
+ maskbits (x, w, startmask, endmask, nlw);
+ }
+ bits = src[y % stippleHeight];
+ RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
+#if PPW == 4
+ if (cfb8StippleRRop == GXcopy)
+ {
+ xor = devPriv->xor;
+ if (w < (PGSZ*2))
+ {
+ if (startmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dst = (*dst & ~(mask & startmask)) |
+ (xor & (mask & startmask));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ while (nlw--)
+ {
+ WriteBitGroup (dst,xor,GetBitGroup(bits))
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dst = (*dst & ~(mask & endmask)) |
+ (xor & (mask & endmask));
+ }
+ }
+ else
+ { /* XXX constants probably not OK here */
+ wEnd = 7 - (nlw & 7);
+ nlw = (nlw >> 3) + 1;
+ dstTmp = dst;
+ nlwTmp = nlw;
+ if (startmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dstTmp = (*dstTmp & ~(mask & startmask)) |
+ (xor & (mask & startmask));
+ dstTmp++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ w = 7 - wEnd;
+ while (w--)
+ {
+ dst = dstTmp;
+ dstTmp++;
+ nlw = nlwTmp;
+#if defined(__GNUC__) && defined(mc68020)
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ xor = xor & mask;
+ mask = ~mask;
+ while (nlw--)
+ {
+ *dst = (*dst & mask) | xor;
+ dst += 8;
+ }
+ xor = devPriv->xor;
+#else
+#define SwitchBitsLoop(body) \
+ while (nlw--) \
+ { \
+ body \
+ dst += 8; \
+ }
+ SwitchBitGroup(dst, xor, GetBitGroup(bits));
+#undef SwitchBitsLoop
+#endif
+ NextBitGroup (bits);
+ }
+ nlwTmp--;
+ w = wEnd + 1;
+ if (endmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ dst = dstTmp + (nlwTmp << 3);
+ *dst = (*dst & ~(mask & endmask)) |
+ (xor & (mask & endmask));
+ }
+ while (w--)
+ {
+ nlw = nlwTmp;
+ dst = dstTmp;
+ dstTmp++;
+#if defined(__GNUC__) && defined(mc68020)
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ xor = xor & mask;
+ mask = ~mask;
+ while (nlw--)
+ {
+ *dst = (*dst & mask) | xor;
+ dst += 8;
+ }
+ xor = devPriv->xor;
+#else
+#define SwitchBitsLoop(body) \
+ while (nlw--) \
+ { \
+ body \
+ dst += 8; \
+ }
+ SwitchBitGroup(dst, xor, GetBitGroup(bits));
+#undef SwitchBitsLoop
+#endif
+ NextBitGroup (bits);
+ }
+ }
+ }
+ else
+#endif /* PPW == 4 */
+ {
+ if (startmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, startmask);
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ while (nlw--)
+ {
+ RRopBitGroup(dst, GetBitGroup(bits));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, endmask);
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+void
+cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidth; /* pointer to list of n widths */
+ unsigned long *src; /* pointer to bits in stipple, if needed */
+ int stippleHeight; /* height of the stipple */
+ PixmapPtr stipple;
+
+ int nlwDst; /* width in longwords of the dest pixmap */
+ int x,y,w; /* current span */
+ unsigned long startmask;
+ unsigned long endmask;
+ register unsigned long *dst; /* pointer to bits we're writing */
+ register int nlw;
+ unsigned long *dstTmp;
+ int nlwTmp;
+
+ unsigned long *pbits; /* pointer to start of pixmap */
+ register unsigned long xor;
+ register unsigned long mask;
+ register unsigned long bits; /* bits from stipple */
+ int wEnd;
+
+ int *pwidthFree; /* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ cfbPrivGCPtr devPriv;
+
+ devPriv = cfbGetGCPrivate(pGC);
+
+ cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ if ( n == 0 )
+ return;
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ stipple = pGC->pRotatedPixmap;
+ src = (unsigned long *)stipple->devPrivate.ptr;
+ stippleHeight = stipple->drawable.height;
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+ while (n--)
+ {
+ w = *pwidth++;
+ x = ppt->x;
+ y = ppt->y;
+ ppt++;
+ dst = pbits + (y * nlwDst) + (x >> PWSH);
+ if (((x & PIM) + w) <= PPW)
+ {
+ maskpartialbits(x, w, startmask);
+ endmask = 0;
+ nlw = 0;
+ }
+ else
+ {
+ maskbits (x, w, startmask, endmask, nlw);
+ }
+ bits = src[y % stippleHeight];
+ RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
+#if PPW == 4
+ if (cfb8StippleRRop == GXcopy)
+ {
+ xor = devPriv->xor;
+ if (w < PGSZ*2)
+ {
+ if (startmask)
+ {
+ *dst = *dst & ~startmask |
+ GetPixelGroup (bits) & startmask;
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ while (nlw--)
+ {
+ *dst++ = GetPixelGroup(bits);
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ *dst = *dst & ~endmask |
+ GetPixelGroup (bits) & endmask;
+ }
+ }
+ else
+ { /* XXX consts probably not OK here */
+ wEnd = 7 - (nlw & 7);
+ nlw = (nlw >> 3) + 1;
+ dstTmp = dst;
+ nlwTmp = nlw;
+ if (startmask)
+ {
+ *dstTmp = *dstTmp & ~startmask |
+ GetPixelGroup (bits) & startmask;
+ dstTmp++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ w = 7 - wEnd;
+ while (w--)
+ {
+ nlw = nlwTmp;
+ dst = dstTmp;
+ dstTmp++;
+ xor = GetPixelGroup (bits);
+ while (nlw--)
+ {
+ *dst = xor;
+ dst += 8;
+ }
+ NextBitGroup (bits);
+ }
+ nlwTmp--;
+ w = wEnd + 1;
+ if (endmask)
+ {
+ dst = dstTmp + (nlwTmp << 3);
+ *dst = (*dst & ~endmask) |
+ GetPixelGroup (bits) & endmask;
+ }
+ while (w--)
+ {
+ nlw = nlwTmp;
+ dst = dstTmp;
+ dstTmp++;
+ xor = GetPixelGroup (bits);
+ while (nlw--)
+ {
+ *dst = xor;
+ dst += 8;
+ }
+ NextBitGroup (bits);
+ }
+ }
+ }
+ else
+#endif /* PPW == 4 */
+ {
+ if (startmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, startmask);
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ while (nlw--)
+ {
+ RRopBitGroup(dst, GetBitGroup(bits));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, endmask);
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
+
+#endif /* PSZ == 8 */
diff --git a/xc/programs/Xserver/cfb/cfbgc.c b/xc/programs/Xserver/cfb/cfbgc.c
new file mode 100644
index 000000000..510e345d3
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbgc.c
@@ -0,0 +1,787 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbgc.c,v 1.3 1998/10/04 09:37:41 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: cfbgc.c /main/92 1998/02/09 14:05:32 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "cfb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mistruct.h"
+#include "mibstore.h"
+#include "migc.h"
+
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+#if PSZ == 8
+# define useTEGlyphBlt cfbTEGlyphBlt8
+#else
+# ifdef WriteBitGroup
+# define useTEGlyphBlt cfbImageGlyphBlt8
+# else
+# define useTEGlyphBlt cfbTEGlyphBlt
+# endif
+#endif
+
+#ifdef WriteBitGroup
+# define useImageGlyphBlt cfbImageGlyphBlt8
+# define usePolyGlyphBlt cfbPolyGlyphBlt8
+#else
+# define useImageGlyphBlt miImageGlyphBlt
+# define usePolyGlyphBlt miPolyGlyphBlt
+#endif
+
+#ifdef FOUR_BIT_CODE
+# define usePushPixels cfbPushPixels8
+#else
+#ifndef LOWMEMFTPT
+# define usePushPixels mfbPushPixels
+#else
+# define usePushPixels miPushPixels
+#endif /* ifndef LOWMEMFTPT */
+#endif
+
+#ifdef PIXEL_ADDR
+# define ZeroPolyArc cfbZeroPolyArcSS8Copy
+#else
+# define ZeroPolyArc miZeroPolyArc
+#endif
+
+GCFuncs cfbGCFuncs = {
+ cfbValidateGC,
+ miChangeGC,
+ miCopyGC,
+ miDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+
+GCOps cfbTEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps cfbNonTEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps cfbTEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+ ZeroPolyArc,
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps cfbNonTEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+#ifdef PIXEL_ADDR
+ cfbZeroPolyArcSS8Copy,
+#else
+ miZeroPolyArc,
+#endif
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps *
+cfbMatchCommon (pGC, devPriv)
+ GCPtr pGC;
+ cfbPrivGCPtr devPriv;
+{
+ if (pGC->lineWidth != 0)
+ return 0;
+ if (pGC->lineStyle != LineSolid)
+ return 0;
+ if (pGC->fillStyle != FillSolid)
+ return 0;
+ if (devPriv->rop != GXcopy)
+ return 0;
+ if (pGC->font &&
+ FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
+ FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
+ {
+ if (TERMINALFONT(pGC->font)
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+#ifdef NO_ONE_RECT
+ return &cfbTEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfbTEOps1Rect;
+ else
+ return &cfbTEOps;
+#endif
+ else
+#ifdef NO_ONE_RECT
+ return &cfbNonTEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfbNonTEOps1Rect;
+ else
+ return &cfbNonTEOps;
+#endif
+ }
+ return 0;
+}
+
+Bool
+cfbCreateGC(pGC)
+ register GCPtr pGC;
+{
+ cfbPrivGC *pPriv;
+
+ if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
+ return (mfbCreateGC(pGC));
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ /*
+ * some of the output primitives aren't really necessary, since they
+ * will be filled in ValidateGC because of dix/CreateGC() setting all
+ * the change bits. Others are necessary because although they depend
+ * on being a color frame buffer, they don't change
+ */
+
+ pGC->ops = &cfbNonTEOps;
+ pGC->funcs = &cfbGCFuncs;
+
+ /* cfb wants to translate before scan conversion */
+ pGC->miTranslate = 1;
+
+ pPriv = cfbGetGCPrivate(pGC);
+ pPriv->rop = pGC->alu;
+ pPriv->oneRect = FALSE;
+ pGC->fExpose = TRUE;
+ pGC->freeCompClip = FALSE;
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
+ return TRUE;
+}
+
+/* Clipping conventions
+ if the drawable is a window
+ CT_REGION ==> pCompositeClip really is the composite
+ CT_other ==> pCompositeClip is the window clip region
+ if the drawable is a pixmap
+ CT_REGION ==> pCompositeClip is the translated client region
+ clipped to the pixmap boundary
+ CT_other ==> pCompositeClip is the pixmap bounding box
+*/
+
+void
+cfbValidateGC(pGC, changes, pDrawable)
+ register GCPtr pGC;
+ unsigned long changes;
+ DrawablePtr pDrawable;
+{
+ int mask; /* stateChanges */
+ int index; /* used for stepping through bitfields */
+ int new_rrop;
+ int new_line, new_text, new_fillspans, new_fillarea;
+ int new_rotate;
+ int xrot, yrot;
+ /* flags for changing the proc vector */
+ cfbPrivGCPtr devPriv;
+ int oneRect;
+
+ new_rotate = pGC->lastWinOrg.x != pDrawable->x ||
+ pGC->lastWinOrg.y != pDrawable->y;
+
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+ devPriv = cfbGetGCPrivate(pGC);
+
+ new_rrop = FALSE;
+ new_line = FALSE;
+ new_text = FALSE;
+ new_fillspans = FALSE;
+ new_fillarea = FALSE;
+
+ /*
+ * if the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last validation
+ * we need to recompute the composite clip
+ */
+
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ miComputeCompositeClip (pGC, pDrawable);
+#ifdef NO_ONE_RECT
+ devPriv->oneRect = FALSE;
+#else
+ oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
+ if (oneRect != devPriv->oneRect)
+ new_line = TRUE;
+ devPriv->oneRect = oneRect;
+#endif
+ }
+
+ mask = changes;
+ while (mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+
+ /*
+ * this switch acculmulates a list of which procedures might have
+ * to change due to changes in the GC. in some cases (e.g.
+ * changing one 16 bit tile for another) we might not really need
+ * a change, but the code is being paranoid. this sort of batching
+ * wins if, for example, the alu and the font have been changed,
+ * or any other pair of items that both change the same thing.
+ */
+ switch (index) {
+ case GCFunction:
+ case GCForeground:
+ new_rrop = TRUE;
+ break;
+ case GCPlaneMask:
+ new_rrop = TRUE;
+ new_text = TRUE;
+ break;
+ case GCBackground:
+ break;
+ case GCLineStyle:
+ case GCLineWidth:
+ new_line = TRUE;
+ break;
+ case GCJoinStyle:
+ case GCCapStyle:
+ break;
+ case GCFillStyle:
+ new_text = TRUE;
+ new_fillspans = TRUE;
+ new_line = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCFillRule:
+ break;
+ case GCTile:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+
+ case GCStipple:
+ if (pGC->stipple)
+ {
+ int width = pGC->stipple->drawable.width;
+ PixmapPtr nstipple;
+
+ if ((width <= PGSZ) && !(width & (width - 1)) &&
+ (nstipple = cfbCopyPixmap(pGC->stipple)))
+ {
+ cfbPadPixmap(nstipple);
+ (*pGC->pScreen->DestroyPixmap)(pGC->stipple);
+ pGC->stipple = nstipple;
+ }
+ }
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+
+ case GCTileStipXOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCTileStipYOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCFont:
+ new_text = TRUE;
+ break;
+ case GCSubwindowMode:
+ break;
+ case GCGraphicsExposures:
+ break;
+ case GCClipXOrigin:
+ break;
+ case GCClipYOrigin:
+ break;
+ case GCClipMask:
+ break;
+ case GCDashOffset:
+ break;
+ case GCDashList:
+ break;
+ case GCArcMode:
+ break;
+ default:
+ break;
+ }
+ }
+
+ /*
+ * If the drawable has changed, ensure suitable
+ * entries are in the proc vector.
+ */
+ if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) {
+ new_fillspans = TRUE; /* deal with FillSpans later */
+ }
+
+ if (new_rotate || new_fillspans)
+ {
+ Bool new_pix = FALSE;
+
+ xrot = pGC->patOrg.x + pDrawable->x;
+ yrot = pGC->patOrg.y + pDrawable->y;
+
+ switch (pGC->fillStyle)
+ {
+ case FillTiled:
+ if (!pGC->tileIsPixel)
+ {
+ int width = pGC->tile.pixmap->drawable.width * PSZ;
+
+ if ((width <= PGSZ) && !(width & (width - 1)))
+ {
+ cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
+ xrot, yrot);
+ new_pix = TRUE;
+ }
+ }
+ break;
+#ifdef FOUR_BIT_CODE
+ case FillStippled:
+ case FillOpaqueStippled:
+ {
+ int width = pGC->stipple->drawable.width;
+
+ if ((width <= PGSZ) && !(width & (width - 1)))
+ {
+ mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
+ xrot, yrot);
+ new_pix = TRUE;
+ }
+ }
+ break;
+#endif
+ }
+ if (!new_pix && pGC->pRotatedPixmap)
+ {
+ (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
+ }
+ }
+
+ if (new_rrop)
+ {
+ int old_rrop;
+
+ old_rrop = devPriv->rop;
+ devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
+ pGC->planemask,
+ &devPriv->and, &devPriv->xor);
+ if (old_rrop == devPriv->rop)
+ new_rrop = FALSE;
+ else
+ {
+#ifdef PIXEL_ADDR
+ new_line = TRUE;
+#endif
+#ifdef WriteBitGroup
+ new_text = TRUE;
+#endif
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ }
+ }
+
+ if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
+ {
+ GCOps *newops;
+
+ if (newops = cfbMatchCommon (pGC, devPriv))
+ {
+ if (pGC->ops->devPrivate.val)
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = newops;
+ new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
+ }
+ else
+ {
+ if (!pGC->ops->devPrivate.val)
+ {
+ pGC->ops = miCreateGCOps (pGC->ops);
+ pGC->ops->devPrivate.val = 1;
+ }
+ }
+ }
+
+ /* deal with the changes we've collected */
+ if (new_line)
+ {
+ pGC->ops->FillPolygon = miFillPolygon;
+#ifdef NO_ONE_RECT
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#else
+ if (devPriv->oneRect && pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#endif
+ if (pGC->lineWidth == 0)
+ {
+#ifdef PIXEL_ADDR
+ if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
+ {
+ switch (devPriv->rop)
+ {
+ case GXxor:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
+ break;
+ case GXcopy:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
+ break;
+ default:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
+ break;
+ }
+ }
+ else
+#endif
+ pGC->ops->PolyArc = miZeroPolyArc;
+ }
+ else
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ switch (pGC->lineStyle)
+ {
+ case LineSolid:
+ if(pGC->lineWidth == 0)
+ {
+ if (pGC->fillStyle == FillSolid)
+ {
+#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
+ if (devPriv->oneRect &&
+ ((pDrawable->x >= pGC->pScreen->width - 32768) &&
+ (pDrawable->y >= pGC->pScreen->height - 32768)))
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ } else
+#endif
+#ifdef NO_ONE_RECT
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ }
+#else
+ {
+ pGC->ops->Polylines = cfbLineSS;
+ pGC->ops->PolySegment = cfbSegmentSS;
+ }
+#endif
+ }
+ else
+ pGC->ops->Polylines = miZeroLine;
+ }
+ else
+ pGC->ops->Polylines = miWideLine;
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
+ {
+ pGC->ops->Polylines = cfbLineSD;
+ pGC->ops->PolySegment = cfbSegmentSD;
+ } else
+ pGC->ops->Polylines = miWideDash;
+ break;
+ }
+ }
+
+ if (new_text && (pGC->font))
+ {
+ if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)
+ {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ else
+ {
+#ifdef WriteBitGroup
+ if (pGC->fillStyle == FillSolid)
+ {
+ if (devPriv->rop == GXcopy)
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
+ else
+#ifdef FOUR_BIT_CODE
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
+#else
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+#endif
+ }
+ else
+#endif
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ /* special case ImageGlyphBlt for terminal emulator fonts */
+#if !defined(WriteBitGroup) || PSZ == 8
+ if (TERMINALFONT(pGC->font) &&
+ (pGC->planemask & PMSK) == PMSK
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+ {
+ pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
+ }
+ else
+#endif
+ {
+#ifdef WriteBitGroup
+ if (devPriv->rop == GXcopy &&
+ pGC->fillStyle == FillSolid &&
+ (pGC->planemask & PMSK) == PMSK)
+ pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
+ else
+#endif
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ }
+ }
+
+
+ if (new_fillspans) {
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillSpans = cfbSolidSpansCopy;
+ break;
+ case GXxor:
+ pGC->ops->FillSpans = cfbSolidSpansXor;
+ break;
+ default:
+ pGC->ops->FillSpans = cfbSolidSpansGeneral;
+ break;
+ }
+ break;
+ case FillTiled:
+ if (pGC->pRotatedPixmap)
+ {
+ if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
+ pGC->ops->FillSpans = cfbTile32FSCopy;
+ else
+ pGC->ops->FillSpans = cfbTile32FSGeneral;
+ }
+ else
+ pGC->ops->FillSpans = cfbUnnaturalTileFS;
+ break;
+ case FillStippled:
+#ifdef FOUR_BIT_CODE
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = cfb8Stipple32FS;
+ else
+#endif
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ case FillOpaqueStippled:
+#ifdef FOUR_BIT_CODE
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = cfb8OpaqueStipple32FS;
+ else
+#endif
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ default:
+ FatalError("cfbValidateGC: illegal fillStyle\n");
+ }
+ } /* end of new_fillspans */
+
+ if (new_fillarea) {
+#ifndef FOUR_BIT_CODE
+ pGC->ops->PolyFillRect = miPolyFillRect;
+ if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
+ {
+ pGC->ops->PolyFillRect = cfbPolyFillRect;
+ }
+#endif
+#ifdef FOUR_BIT_CODE
+#ifndef LOWMEMFTPT
+ pGC->ops->PushPixels = mfbPushPixels;
+#else
+ pGC->ops->PushPixels = miPushPixels;
+#endif /* ifndef LOWMEMFTPT */
+ if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
+ pGC->ops->PushPixels = cfbPushPixels8;
+#endif
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop)
+ {
+ case GXcopy:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
+ break;
+ default:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
+ break;
+ }
+ }
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbgetsp.c b/xc/programs/Xserver/cfb/cfbgetsp.c
new file mode 100644
index 000000000..acaaa06ae
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbgetsp.c
@@ -0,0 +1,195 @@
+/* $TOG: cfbgetsp.c /main/29 1998/02/09 14:05:39 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbgetsp.c,v 3.4 1998/10/04 09:37:43 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+
+#include "misc.h"
+#include "region.h"
+#include "gc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
+ * and continuing for pwidth[i] bits
+ * Each scanline returned will be server scanline padded, i.e., it will come
+ * out to an integral number of words.
+ */
+void
+cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pchardstStart; /* where to put the bits */
+{
+ PixelGroup *pdstStart = (PixelGroup *)pchardstStart;
+ register PixelGroup *pdst; /* where to put the bits */
+ register PixelGroup *psrc; /* where to get the bits */
+ register PixelGroup tmpSrc; /* scratch buffer for bits */
+ PixelGroup *psrcBase; /* start of src bitmap */
+ int widthSrc; /* width of pixmap in bytes */
+ register DDXPointPtr pptLast; /* one past last point to get */
+ int xEnd; /* last pixel to copy from */
+ register int nstart;
+ int nend;
+ PixelGroup startmask, endmask;
+ int nlMiddle, nl, srcBit;
+ int w;
+ PixelGroup *pdstNext;
+#if PSZ == 24
+ register char *psrcb, *pdstb;
+ register int xIndex = 0;
+#endif
+
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
+ return;
+ case PSZ:
+ break;
+ default:
+ FatalError("cfbGetSpans: invalid depth\n");
+ }
+
+
+ cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase)
+
+#ifdef PIXEL_ADDR
+# if PSZ != 24
+ if ((nspans == 1) && (*pwidth == 1))
+ {
+ tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc))
+ + ppt->x);
+#if BITMAP_BIT_ORDER == MSBFirst
+ tmpSrc <<= (sizeof (unsigned long) - sizeof (PixelType)) * 8;
+#endif
+ *pdstStart = tmpSrc;
+ return;
+ }
+# endif /* PSZ != 24 */
+#endif
+ pdst = pdstStart;
+ pptLast = ppt + nspans;
+ while(ppt < pptLast)
+ {
+#if PSZ == 24
+ xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(long) / 3);
+ w = xEnd - ppt->x;
+ psrc = psrcBase + ppt->y * widthSrc;
+ srcBit = ppt->x;
+ psrcb = (char *)psrc + (ppt->x * 3);
+ xIndex = 0;
+ pdstb = (char *)pdst;
+ pdstNext = pdst + ((w * 3 + 3) >> 2);
+#else
+ xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
+ w = xEnd - ppt->x;
+ psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH);
+ srcBit = ppt->x & PIM;
+ pdstNext = pdst + ((w + PPW - 1) >> PWSH);
+#endif
+
+#if PSZ == 24
+ if (w < 0)
+ FatalError("cfb24GetSpans: Internal error (w < 0)\n");
+ nl = w;
+ while (nl--){
+ psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03);
+ getbits24(psrc, tmpSrc, srcBit);
+ pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03);
+ putbits24(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0), xIndex);
+ srcBit++;
+ psrcb += 3;
+ xIndex++;
+ pdstb += 3;
+ }
+ pdst = pdstNext;
+#else /* PSZ == 24 */
+ if (srcBit + w <= PPW)
+ {
+ getbits(psrc, srcBit, w, tmpSrc);
+ putbits(tmpSrc, 0, w, pdst, ~((unsigned long)0));
+ pdst++;
+ }
+ else
+ {
+ maskbits(ppt->x, w, startmask, endmask, nlMiddle);
+ nstart = 0;
+ if (startmask)
+ {
+ nstart = PPW - srcBit;
+ getbits(psrc, srcBit, nstart, tmpSrc);
+ putbits(tmpSrc, 0, nstart, pdst, ~((unsigned long)0));
+ if(srcBit + nstart >= PPW)
+ psrc++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ tmpSrc = *psrc;
+ putbits(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0));
+ psrc++;
+ pdst++;
+ }
+ if (endmask)
+ {
+ nend = xEnd & PIM;
+ getbits(psrc, 0, nend, tmpSrc);
+ putbits(tmpSrc, nstart, nend, pdst, ~((unsigned long)0));
+ }
+ pdst = pdstNext;
+ }
+#endif /* PSZ == 24 */
+ ppt++;
+ pwidth++;
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbglblt8.c b/xc/programs/Xserver/cfb/cfbglblt8.c
new file mode 100644
index 000000000..5c0ab74f5
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbglblt8.c
@@ -0,0 +1,460 @@
+/* $TOG: cfbglblt8.c /main/33 1998/02/09 14:05:46 kaleb $ */
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.2 1998/10/04 09:37:43 dawes Exp $ */
+
+/*
+ * Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode
+ * only.
+ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "cfb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+#define BOX_OVERLAP(box1, box2, xoffset, yoffset) \
+ ((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \
+ ((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \
+ (box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \
+ ((int) (box2)->y1 + (yoffset)) <= (box1)->y2)
+
+#define BOX_CONTAINS(box1, box2, xoffset, yoffset) \
+ ((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \
+ ((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \
+ (box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \
+ ((int) (box2)->y2 + (yoffset)) <= (box1)->y2)
+
+#if defined(FOUR_BIT_CODE) || defined(WriteBitGroup) && !defined(GLYPHROP)
+
+#if GLYPHPADBYTES != 4
+#define USE_LEFTBITS
+#endif
+
+#ifdef USE_LEFTBITS
+typedef unsigned char *glyphPointer;
+extern unsigned long endtab[];
+
+#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \
+ (dst) &= widthMask; \
+ (bits) += widthGlyph;
+#define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \
+ dst = BitRight (dst, off);
+#else
+typedef CARD32 *glyphPointer;
+
+#define GlyphBits(bits,width,dst) dst = *bits++;
+#define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off);
+#endif
+
+#ifdef GLYPHROP
+#define cfbPolyGlyphBlt8 cfbPolyGlyphRop8
+#define cfbPolyGlyphBlt8Clipped cfbPolyGlyphRop8Clipped
+
+#undef WriteBitGroup
+#define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits)
+
+#endif
+
+static void cfbPolyGlyphBlt8Clipped();
+
+#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS)
+#define USE_STIPPLE_CODE
+#endif
+
+#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS)
+#ifdef USE_STIPPLE_CODE
+#undef USE_STIPPLE_CODE
+#endif
+#include "stip68kgnu.h"
+#endif
+
+#if PSZ == 24
+#define DST_INC 3
+#else
+#define DST_INC (PGSZB >> PWSH)
+#endif
+
+/* cfbStippleStack/cfbStippleStackTE are coded in assembly language.
+ * They are only provided on some architecures.
+ */
+#ifdef USE_STIPPLE_CODE
+extern void cfbStippleStack (), cfbStippleStackTE ();
+#endif
+
+void
+cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ register unsigned long c;
+#ifndef GLYPHROP
+ register unsigned long pixel;
+#endif
+ register unsigned long *dst;
+ register glyphPointer glyphBits;
+ register int xoff;
+
+ FontPtr pfont = pGC->font;
+ CharInfoPtr pci;
+ unsigned long *dstLine;
+ unsigned long *pdstBase;
+ int hTmp;
+ int bwidthDst;
+ int widthDst;
+ int h;
+ int ew;
+ BoxRec bbox; /* for clipping */
+ int widthDiff;
+ int w;
+ RegionPtr clip;
+ BoxPtr extents;
+#ifdef USE_LEFTBITS
+ int widthGlyph;
+ unsigned long widthMask;
+#endif
+#ifndef STIPPLE
+#ifdef USE_STIPPLE_CODE
+ void (*stipple)();
+
+ stipple = cfbStippleStack;
+ if (FONTCONSTMETRICS(pfont))
+ stipple = cfbStippleStackTE;
+#endif
+#endif
+
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ /* compute an approximate (but covering) bounding box */
+ bbox.x1 = 0;
+ if ((ppci[0]->metrics.leftSideBearing < 0))
+ bbox.x1 = ppci[0]->metrics.leftSideBearing;
+ h = nglyph - 1;
+ w = ppci[h]->metrics.rightSideBearing;
+ while (--h >= 0)
+ w += ppci[h]->metrics.characterWidth;
+ bbox.x2 = w;
+ bbox.y1 = -FONTMAXBOUNDS(pfont,ascent);
+ bbox.y2 = FONTMAXBOUNDS(pfont,descent);
+
+ clip = cfbGetCompositeClip(pGC);
+ extents = &clip->extents;
+
+ if (!clip->data)
+ {
+ if (!BOX_CONTAINS(extents, &bbox, x, y))
+ {
+ if (BOX_OVERLAP (extents, &bbox, x, y))
+ cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
+ nglyph, ppci, pglyphBase);
+ return;
+ }
+ }
+ else
+ {
+ /* check to make sure some of the text appears on the screen */
+ if (!BOX_OVERLAP (extents, &bbox, x, y))
+ return;
+
+ bbox.x1 += x;
+ bbox.x2 += x;
+ bbox.y1 += y;
+ bbox.y2 += y;
+
+ switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox))
+ {
+ case rgnPART:
+ cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
+ nglyph, ppci, pglyphBase);
+ case rgnOUT:
+ return;
+ }
+ }
+
+#ifdef GLYPHROP
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+#else
+ pixel = cfbGetGCPrivate(pGC)->xor;
+#endif
+
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+
+ widthDst = bwidthDst / PGSZB;
+ while (nglyph--)
+ {
+ pci = *ppci++;
+ glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
+ xoff = x + pci->metrics.leftSideBearing;
+#if PSZ == 24
+ dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3);
+#else
+ dstLine = pdstBase +
+ (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH);
+#endif
+ x += pci->metrics.characterWidth;
+ if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ {
+#if PSZ == 24
+ xoff &= 0x03;
+#else
+ xoff &= PIM;
+#endif /* PSZ == 24 */
+#ifdef STIPPLE
+ STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
+#else
+#ifdef USE_STIPPLE_CODE
+ (*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
+#else
+#ifdef USE_LEFTBITS
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ widthGlyph = PADGLYPHWIDTHBYTES(w);
+ widthMask = endtab[w];
+#endif
+ do {
+ dst = dstLine;
+ dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ GlyphBits(glyphBits, w, c)
+ WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
+ dst += DST_INC;
+ c = BitLeft(c,PGSZB - xoff);
+ while (c)
+ {
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst += DST_INC;
+ }
+ } while (--hTmp);
+#endif /* USE_STIPPLE_CODE else */
+#endif /* STIPPLE else */
+ }
+ }
+}
+
+static void
+cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ unsigned char *pglyphBase; /* start of array of glyphs */
+{
+ register unsigned long c;
+#ifndef GLYPHROP
+ register unsigned long pixel;
+#endif
+ register unsigned long *dst;
+ register glyphPointer glyphBits;
+ register int xoff;
+ unsigned long c1;
+
+ CharInfoPtr pci;
+ FontPtr pfont = pGC->font;
+ unsigned long *dstLine;
+ unsigned long *pdstBase;
+ CARD32 *cTmp, *clips;
+ int maxAscent, maxDescent;
+ int minLeftBearing;
+ int hTmp;
+ int widthDst;
+ int bwidthDst;
+ int ew;
+ int xG, yG;
+ BoxPtr pBox;
+ int numRects;
+ int widthDiff;
+ int w;
+ RegionPtr pRegion;
+ int yBand;
+#ifdef GLYPHROP
+ unsigned long bits;
+#endif
+#ifdef USE_LEFTBITS
+ int widthGlyph;
+ unsigned long widthMask;
+#endif
+
+#ifdef GLYPHROP
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+#else
+ pixel = cfbGetGCPrivate(pGC)->xor;
+#endif
+
+ cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long)
+
+ widthDst = bwidthDst / PGSZB;
+ maxAscent = FONTMAXBOUNDS(pfont,ascent);
+ maxDescent = FONTMAXBOUNDS(pfont,descent);
+ minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing);
+
+ pRegion = cfbGetCompositeClip(pGC);
+
+ pBox = REGION_RECTS(pRegion);
+ numRects = REGION_NUM_RECTS (pRegion);
+ while (numRects && pBox->y2 <= y - maxAscent)
+ {
+ ++pBox;
+ --numRects;
+ }
+ if (!numRects || pBox->y1 >= y + maxDescent)
+ return;
+ yBand = pBox->y1;
+ while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing)
+ {
+ ++pBox;
+ --numRects;
+ }
+ if (!numRects)
+ return;
+ clips = (CARD32 *)ALLOCATE_LOCAL ((maxAscent + maxDescent) *
+ sizeof (CARD32));
+ while (nglyph--)
+ {
+ pci = *ppci++;
+ glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ xG = x + pci->metrics.leftSideBearing;
+ yG = y - pci->metrics.ascent;
+ x += pci->metrics.characterWidth;
+ if (hTmp = pci->metrics.descent + pci->metrics.ascent)
+ {
+#if PSZ == 24
+ dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3);
+ /* never use (xG*3)>>2 */
+#else
+ dstLine = pdstBase + yG * widthDst + (xG >> PWSH);
+#endif
+#if PSZ == 24
+ xoff = xG & 3;
+#else
+ xoff = xG & PIM;
+#endif
+#ifdef USE_LEFTBITS
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ widthGlyph = PADGLYPHWIDTHBYTES(w);
+ widthMask = endtab[w];
+#endif
+ switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips))
+ {
+ case rgnPART:
+#ifdef USE_LEFTBITS
+ cTmp = clips;
+ do {
+ dst = dstLine;
+ dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ GlyphBits(glyphBits, w, c)
+ c &= *cTmp++;
+ if (c)
+ {
+ WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
+ c = BitLeft(c,PGSZB - xoff);
+ dst += DST_INC;
+ while (c)
+ {
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst += DST_INC;
+ }
+ }
+ } while (--hTmp);
+ break;
+#else /* !USE_LEFT_BITS */
+ {
+ int h;
+
+ h = hTmp;
+ do
+ {
+ --h;
+ clips[h] = clips[h] & glyphBits[h];
+ } while (h);
+ }
+ glyphBits = clips;
+ /* fall through */
+#endif /* USE_LEFT_BITS */
+ case rgnIN:
+#ifdef STIPPLE
+ STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
+#else
+#ifdef USE_STIPPLE_CODE
+ cfbStippleStackTE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
+#else
+ do {
+ dst = dstLine;
+ dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst);
+ GlyphBits(glyphBits, w, c)
+ if (c)
+ {
+ /* This code originally could read memory locations
+ * that were not mapped. Hence we have to check the
+ * trailing bits to see whether they are zero and if
+ * then skip them correctly. This is no problem for
+ * the GXcopy case, since there only the pixels that
+ * are non-zero are written ...
+ */
+#ifndef GLYPHROP
+ WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
+ c = BitLeft(c,PGSZB - xoff);
+ dst += DST_INC;
+#else /* GLYPHROP */
+ if (bits = GetBitGroup(BitRight(c,xoff)))
+ WriteBitGroup(dst, pixel, bits);
+ c = BitLeft(c,PGSZB - xoff);
+ dst += DST_INC;
+
+ while (c && ((bits = GetBitGroup(c)) == 0))
+ {
+ NextBitGroup(c);
+ dst += DST_INC;
+ }
+#endif /* GLYPHROP */
+ while (c)
+ {
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst += DST_INC;
+ }
+ }
+ } while (--hTmp);
+#endif /* USE_STIPPLE_CODE else */
+#endif /* STIPPLE else */
+ break;
+ }
+ }
+ }
+ DEALLOCATE_LOCAL (clips);
+}
+
+#endif /* FOUR_BIT_CODE */
diff --git a/xc/programs/Xserver/cfb/cfbhrzvert.c b/xc/programs/Xserver/cfb/cfbhrzvert.c
new file mode 100644
index 000000000..e10afaffe
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbhrzvert.c
@@ -0,0 +1,516 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbhrzvert.c,v 3.3 1998/10/04 09:37:44 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987,1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: cfbhrzvert.c /main/9 1998/02/09 14:05:53 kaleb $ */
+#include "X.h"
+
+#include "gc.h"
+#include "window.h"
+#include "pixmap.h"
+#include "region.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+/* horizontal solid line
+ abs(len) > 1
+*/
+cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len)
+register int rop;
+register unsigned long and;
+register unsigned long xor;
+register unsigned long *addrl; /* pointer to base of bitmap */
+int nlwidth; /* width in longwords of bitmap */
+int x1; /* initial point */
+int y1;
+int len; /* length of line */
+{
+ register int nlmiddle;
+ register unsigned long startmask;
+ register unsigned long endmask;
+#if PSZ == 24
+ int leftIndex, rightIndex, xOffset;
+ unsigned long piQxelAnd[3], piQxelXor[3];
+ piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000);
+ piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000);
+ piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF);
+
+ piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000);
+ piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000);
+ piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF);
+
+ leftIndex = x1 & 3;
+ rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3;
+ nlmiddle = len;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+ if(rightIndex){
+ nlmiddle -= rightIndex;
+ }
+ if (nlmiddle < 0)
+ nlmiddle = 0;
+
+ nlmiddle >>= 2;
+
+ addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0);
+
+ switch(leftIndex+len){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 1:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 2:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 3:
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ case 1:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ case 2:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ }
+ break;
+ case 2:
+ if(leftIndex){
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ }
+ else{
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ }
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ if (rop == GXcopy){
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl++ = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *addrl++ = piQxelXor[1];
+ *addrl++ = piQxelXor[2];
+ break;
+ case 2:
+ *addrl++ = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *addrl++ = piQxelXor[2];
+ break;
+ case 3:
+ *addrl++ = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+ break;
+ }
+ while(nlmiddle--){
+ *addrl++ = piQxelXor[0];
+ *addrl++ = piQxelXor[1];
+ *addrl++ = piQxelXor[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *addrl++ = piQxelXor[0];
+ *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+ break;
+ case 3:
+ *addrl++ = piQxelXor[0];
+ *addrl++ = piQxelXor[1];
+ *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+ break;
+ }
+ }
+ else{
+ if(rop == GXxor){
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl++ ^= (piQxelXor[0]&0xFF000000);
+ *addrl++ ^= piQxelXor[1];
+ *addrl++ ^= piQxelXor[2];
+ break;
+ case 2:
+ *addrl++ ^= (piQxelXor[1]& 0xFFFF0000);
+ *addrl++ ^= piQxelXor[2];
+ break;
+ case 3:
+ *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00);
+ break;
+ }
+ while(nlmiddle--){
+ *addrl++ ^= piQxelXor[0];
+ *addrl++ ^= piQxelXor[1];
+ *addrl++ ^= piQxelXor[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl ^= (piQxelXor[0]& 0xFFFFFF);
+ break;
+ case 2:
+ *addrl++ ^= piQxelXor[0];
+ *addrl ^= (piQxelXor[1]&0xFFFF);
+ break;
+ case 3:
+ *addrl++ ^= piQxelXor[0];
+ *addrl++ ^= piQxelXor[1];
+ *addrl ^= (piQxelXor[2]&0xFF);
+ break;
+ }
+ }
+ else{
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 2:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ break;
+ case 3:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ break;
+ }
+ while(nlmiddle--){
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+ break;
+ case 2:
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ break;
+ case 3:
+ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
+ *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
+ *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
+ break;
+ }
+
+ }
+ }
+ }
+ }
+#else
+ addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
+
+ /* all bits inside same longword */
+ if ( ((x1 & PIM) + len) < PPW)
+ {
+ maskpartialbits(x1, len, startmask);
+ *addrl = DoMaskRRop (*addrl, and, xor, startmask);
+ }
+ else
+ {
+ maskbits(x1, len, startmask, endmask, nlmiddle);
+ if (rop == GXcopy)
+ {
+ if (startmask)
+ {
+ *addrl = (*addrl & ~startmask) | (xor & startmask);
+ addrl++;
+ }
+ while (nlmiddle--)
+ *addrl++ = xor;
+ if (endmask)
+ *addrl = (*addrl & ~endmask) | (xor & endmask);
+ }
+ else
+ {
+ if (startmask)
+ {
+ *addrl = DoMaskRRop (*addrl, and, xor, startmask);
+ addrl++;
+ }
+ if (rop == GXxor)
+ {
+ while (nlmiddle--)
+ *addrl++ ^= xor;
+ }
+ else
+ {
+ while (nlmiddle--)
+ {
+ *addrl = DoRRop (*addrl, and, xor);
+ addrl++;
+ }
+ }
+ if (endmask)
+ *addrl = DoMaskRRop (*addrl, and, xor, endmask);
+ }
+ }
+#endif
+}
+
+/* vertical solid line */
+
+void
+cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len)
+int rop;
+register unsigned long and, xor;
+register unsigned long *addrl; /* pointer to base of bitmap */
+register int nlwidth; /* width in longwords of bitmap */
+int x1, y1; /* initial point */
+register int len; /* length of line */
+{
+#if PSZ == 24
+ int xIdx;
+ unsigned long and2, xor2, offset, mask, mask2;
+#endif
+#ifdef PIXEL_ADDR
+ register PixelType *bits = (PixelType *) addrl;
+
+#if PSZ == 24
+ nlwidth <<= PWSH;
+ xIdx = x1 & 3;
+ bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2));
+#else
+ nlwidth <<= PWSH;
+ bits = bits + (y1 * nlwidth) + x1;
+#endif
+#if PSZ == 24
+ mask2 = 0;
+ switch(xIdx){
+ case 0:
+ mask = 0xFF000000;
+ xor &= 0xFFFFFF;
+ and |= 0xFF000000;
+ break;
+ case 3:
+ mask = 0xFF;
+ xor &= 0xFFFFFF;
+ xor <<= 8;
+ and <<= 8;
+ and |= 0xFF;
+ break;
+ case 1:
+ mask = 0xFFFFFF;
+ mask2 = 0xFFFF0000;
+ xor2 = (xor>>8) & 0xFFFF;
+ xor &= 0xFF;
+ xor <<= 24;
+ and2 = (and >> 8 ) | 0xFFFF0000;
+ and <<= 24;
+ and |= 0xFFFFFF;
+ break;
+ case 2:
+ mask = 0x0000FFFF;
+ mask2 = 0xFFFFFF00;
+ xor2 = (xor >> 16) & 0xFF;
+ xor <<= 16;
+ xor &= 0xFFFF0000;
+ and2 = (and >> 16) | 0xFFFFFF00;
+ and <<= 16;
+ and |= 0xFFFF;
+ break;
+ }
+#endif
+
+ /*
+ * special case copy and xor to avoid a test per pixel
+ */
+ if (rop == GXcopy)
+ {
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ case 3:
+ while (len--){
+ *bits = (*bits & mask)| xor;
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ case 2:
+ while (len--){
+ *bits = (*bits & mask)| xor;
+ bits++;
+ *bits = (*bits & mask2)| xor2;
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
+ while (len--)
+ {
+ *bits = xor;
+ bits += nlwidth;
+ }
+#endif
+ }
+ else if (rop == GXxor)
+ {
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ case 3:
+ while (len--){
+ *bits ^= xor;
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ case 2:
+ while (len--){
+ *bits ^= xor;
+ bits++;
+ *bits ^= xor2;
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
+ while (len--)
+ {
+ *bits ^= xor;
+ bits += nlwidth;
+ }
+#endif
+ }
+ else
+ {
+#if PSZ == 24
+ switch(xIdx){
+ case 0:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF);
+ bits += nlwidth;
+ }
+ break;
+ case 3:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00);
+ bits += nlwidth;
+ }
+ break;
+ case 1:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFF000000);
+ bits++;
+ *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF);
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ case 2:
+ while (len--){
+ *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000);
+ bits++;
+ *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF);
+ bits--;
+ bits += nlwidth;
+ }
+ break;
+ }
+#else
+ while (len--)
+ {
+ *bits = DoRRop(*bits, and, xor);
+ bits += nlwidth;
+ }
+#endif
+ }
+#else /* !PIXEL_ADDR */
+#if PSZ == 24
+ addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2);
+
+ and |= ~cfbmask[(x1 & 3)<<1];
+ xor &= cfbmask[(x1 & 3)<<1];
+#else
+ addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
+
+ and |= ~cfbmask[x1 & PIM];
+ xor &= cfbmask[x1 & PIM];
+#endif
+
+ while (len--)
+ {
+ *addrl = DoRRop (*addrl, and, xor);
+ addrl += nlwidth;
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/cfb/cfbigblt8.c b/xc/programs/Xserver/cfb/cfbigblt8.c
new file mode 100644
index 000000000..978ccb8a3
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbigblt8.c
@@ -0,0 +1,106 @@
+/*
+ * $TOG: cfbigblt8.c /main/10 1998/02/09 14:05:59 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* $XFree86: xc/programs/Xserver/cfb/cfbigblt8.c,v 1.3 1998/10/04 09:37:44 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "mi.h"
+#include "cfb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+void
+cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci;
+ pointer pglyphBase;
+{
+ ExtentInfoRec info; /* used by QueryGlyphExtents() */
+ xRectangle backrect;
+ int fillStyle;
+ int alu;
+ int fgPixel;
+ int rop;
+ int xor;
+ int and;
+ int pm;
+ cfbPrivGC *priv;
+
+ /*
+ * We can't avoid GC validations if calling mi functions.
+ */
+ if ((pGC->ops->PolyFillRect == miPolyFillRect) ||
+ (pGC->ops->PolyGlyphBlt == miPolyGlyphBlt))
+ {
+ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ return;
+ }
+
+ QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
+
+ if (info.overallWidth >= 0)
+ {
+ backrect.x = x;
+ backrect.width = info.overallWidth;
+ }
+ else
+ {
+ backrect.x = x + info.overallWidth;
+ backrect.width = -info.overallWidth;
+ }
+ backrect.y = y - FONTASCENT(pGC->font);
+ backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+
+ priv = cfbGetGCPrivate(pGC);
+
+ /* this code cheats by knowing that ValidateGC isn't
+ * necessary for PolyFillRect
+ */
+
+ fgPixel = pGC->fgPixel;
+
+ pGC->fgPixel = pGC->bgPixel;
+ priv->xor = PFILL(pGC->bgPixel);
+
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect);
+
+ pGC->fgPixel = fgPixel;
+
+ priv->xor = PFILL(pGC->fgPixel);
+
+ (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+
+}
diff --git a/xc/programs/Xserver/cfb/cfbimage.c b/xc/programs/Xserver/cfb/cfbimage.c
new file mode 100644
index 000000000..629108e31
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbimage.c
@@ -0,0 +1,191 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbimage.c,v 1.7 1999/08/21 13:48:15 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: cfbimage.c /main/20 1998/02/09 14:06:06 kaleb $ */
+
+#include "X.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "servermd.h"
+#include "mi.h"
+
+void
+cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int depth, x, y, w, h;
+ int leftPad;
+ int format;
+ char *pImage;
+{
+ int bitsPerPixel;
+ PixmapPtr pPixmap;
+
+ if ((w == 0) || (h == 0))
+ return;
+
+ if (format != XYPixmap)
+ {
+ pPixmap = GetScratchPixmapHeader(pDraw->pScreen, w+leftPad, h, depth,
+ BitsPerPixel(depth), PixmapBytePad(w+leftPad, depth),
+ (pointer)pImage);
+ if (!pPixmap)
+ return;
+
+ pGC->fExpose = FALSE;
+ if (format == ZPixmap)
+ (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC,
+ leftPad, 0, w, h, x, y);
+ else
+ (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC,
+ leftPad, 0, w, h, x, y, 1);
+ pGC->fExpose = TRUE;
+ FreeScratchPixmapHeader(pPixmap);
+ }
+ else
+ {
+ unsigned long oldFg, oldBg;
+ XID gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
+
+ depth = pGC->depth;
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0] = ~0L;
+ gcv[1] = 0;
+ DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
+ bytesPer = (long)h * BitmapBytePad(w + leftPad);
+
+ for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
+ {
+ if (i & oldPlanemask)
+ {
+ gcv[0] = i;
+ DoChangeGC(pGC, GCPlaneMask, gcv, 0);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
+ XYBitmap, pImage);
+ }
+ }
+ gcv[0] = oldPlanemask;
+ gcv[1] = oldFg;
+ gcv[2] = oldBg;
+ DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+ ValidateGC(pDraw, pGC);
+ }
+}
+
+void
+cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ BoxRec box;
+ DDXPointRec ptSrc;
+ RegionRec rgnDst;
+ ScreenPtr pScreen;
+ PixmapPtr pPixmap;
+
+ if ((w == 0) || (h == 0))
+ return;
+ if (pDrawable->bitsPerPixel == 1)
+ {
+#ifndef LOWMEMFTPT
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+#else
+ miGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+#endif /* ifndef LOWMEMFTPT */
+ return;
+ }
+ pScreen = pDrawable->pScreen;
+ if (format == ZPixmap)
+ {
+ pPixmap = GetScratchPixmapHeader(pScreen, w, h,
+ pDrawable->depth, pDrawable->bitsPerPixel,
+ PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine);
+ if (!pPixmap)
+ return;
+ if ((planeMask & PMSK) != PMSK)
+ bzero((char *)pdstLine, pPixmap->devKind * h);
+ ptSrc.x = sx + pDrawable->x;
+ ptSrc.y = sy + pDrawable->y;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+ cfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
+ &ptSrc, planeMask);
+ REGION_UNINIT(pScreen, &rgnDst);
+ FreeScratchPixmapHeader(pPixmap);
+ }
+ else
+ {
+ pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1,
+ /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine);
+ if (!pPixmap)
+ return;
+
+ ptSrc.x = sx + pDrawable->x;
+ ptSrc.y = sy + pDrawable->y;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+ cfbCopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
+ &ptSrc, planeMask);
+ REGION_UNINIT(pScreen, &rgnDst);
+ FreeScratchPixmapHeader(pPixmap);
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbline.c b/xc/programs/Xserver/cfb/cfbline.c
new file mode 100644
index 000000000..cfffb9195
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbline.c
@@ -0,0 +1,750 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbline.c,v 3.2 1998/10/04 09:37:45 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: cfbline.c /main/25 1998/02/09 14:06:12 kaleb $ */
+#include "X.h"
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "mistruct.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "miline.h"
+
+/* single-pixel lines on a color frame buffer
+
+ NON-SLOPED LINES
+ horizontal lines are always drawn left to right; we have to
+move the endpoints right by one after they're swapped.
+ horizontal lines will be confined to a single band of a
+region. the code finds that band (giving up if the lower
+bound of the band is above the line we're drawing); then it
+finds the first box in that band that contains part of the
+line. we clip the line to subsequent boxes in that band.
+ vertical lines are always drawn top to bottom (y-increasing.)
+this requires adding one to the y-coordinate of each endpoint
+after swapping.
+
+ SLOPED LINES
+ when clipping a sloped line, we bring the second point inside
+the clipping box, rather than one beyond it, and then add 1 to
+the length of the line before drawing it. this lets us use
+the same box for finding the outcodes for both endpoints. since
+the equation for clipping the second endpoint to an edge gives us
+1 beyond the edge, we then have to move the point towards the
+first point by one step on the major axis.
+ eventually, there will be a diagram here to explain what's going
+on. the method uses Cohen-Sutherland outcodes to determine
+outsideness, and a method similar to Pike's layers for doing the
+actual clipping.
+
+*/
+
+void
+#ifdef POLYSEGMENT
+cfbSegmentSS (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ unsigned int oc1; /* outcode of point 1 */
+ unsigned int oc2; /* outcode of point 2 */
+
+ unsigned long *addrl; /* address of destination pixmap */
+ int nlwidth; /* width in longwords of destination pixmap */
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+
+ /* a bunch of temporaries */
+ int tmp;
+ register int y1, y2;
+ register int x1, x2;
+ RegionPtr cclip;
+ cfbPrivGCPtr devPriv;
+ unsigned long xor, and;
+ int alu;
+
+ devPriv = cfbGetGCPrivate(pGC);
+ cclip = pGC->pCompositeClip;
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
+
+ alu = devPriv->rop;
+ xor = devPriv->xor;
+ and = devPriv->and;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious)
+ {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (x1 == x2) /* vertical line */
+ {
+ /* make the line go top to bottom of screen, keeping
+ endpoint semantics
+ */
+ if (y1 > y2)
+ {
+ register int tmp;
+
+ tmp = y2;
+ y2 = y1 + 1;
+ y1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ y1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ y2++;
+#endif
+ /* get to first band that might contain part of line */
+ while ((nbox) && (pbox->y2 <= y1))
+ {
+ pbox++;
+ nbox--;
+ }
+
+ if (nbox)
+ {
+ /* stop when lower edge of box is beyond end of line */
+ while((nbox) && (y2 >= pbox->y1))
+ {
+ if ((x1 >= pbox->x1) && (x1 < pbox->x2))
+ {
+ int y1t, y2t;
+ /* this box has part of the line in it */
+ y1t = max(y1, pbox->y1);
+ y2t = min(y2, pbox->y2);
+ if (y1t != y2t)
+ {
+ cfbVertS (alu, and, xor,
+ addrl, nlwidth,
+ x1, y1t, y2t-y1t);
+ }
+ }
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ y2 = ppt->y + yorg;
+#endif
+ }
+ else if (y1 == y2) /* horizontal line */
+ {
+ /* force line from left to right, keeping
+ endpoint semantics
+ */
+ if (x1 > x2)
+ {
+ register int tmp;
+
+ tmp = x2;
+ x2 = x1 + 1;
+ x1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ x1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ x2++;
+#endif
+
+ /* find the correct band */
+ while( (nbox) && (pbox->y2 <= y1))
+ {
+ pbox++;
+ nbox--;
+ }
+
+ /* try to draw the line, if we haven't gone beyond it */
+ if ((nbox) && (pbox->y1 <= y1))
+ {
+ /* when we leave this band, we're done */
+ tmp = pbox->y1;
+ while((nbox) && (pbox->y1 == tmp))
+ {
+ int x1t, x2t;
+
+ if (pbox->x2 <= x1)
+ {
+ /* skip boxes until one might contain start point */
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ /* stop if left of box is beyond right of line */
+ if (pbox->x1 >= x2)
+ {
+ nbox = 0;
+ break;
+ }
+
+ x1t = max(x1, pbox->x1);
+ x2t = min(x2, pbox->x2);
+ if (x1t != x2t)
+ {
+ cfbHorzS (alu, and, xor,
+ addrl, nlwidth,
+ x1t, y1, x2t-x1t);
+ }
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ x2 = ppt->x + xorg;
+#endif
+ }
+ else /* sloped line */
+ {
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
+ 1, 1, octant);
+
+ if (adx > ady)
+ {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ }
+ else
+ {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--)
+ {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0)
+ {
+ if (axis == X_AXIS)
+ len = adx;
+ else
+ len = ady;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ len++;
+#endif
+ cfbBresS (alu, and, xor,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, len);
+ break;
+ }
+ else if (oc1 & oc2)
+ {
+ pbox++;
+ }
+ else
+ {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
+ pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len)
+ {
+ /* unwind bresenham error term to first point */
+ if (clip1)
+ {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ cfbBresS(alu, and, xor,
+ addrl, nlwidth,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e2, len);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+ } /* sloped line */
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--)
+ {
+ if ((x2 >= pbox->x1) &&
+ (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) &&
+ (y2 < pbox->y2))
+ {
+ unsigned long mask;
+ unsigned long scrbits;
+
+#if PSZ == 24
+ mask = cfbmask[(x2 & 3)<<1];
+ addrl += (y2 * nlwidth) + ((x2*3) >> 2);
+#else
+ mask = cfbmask[x2 & PIM];
+ addrl += (y2 * nlwidth) + (x2 >> PWSH);
+#endif
+ scrbits = *addrl;
+ *addrl = (scrbits & ~mask) |
+ (DoRRop (scrbits, and, xor) & mask);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+}
+
+/*
+ * Draw dashed 1-pixel lines.
+ */
+
+void
+#ifdef POLYSEGMENT
+cfbSegmentSD (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ register unsigned int oc1; /* outcode of point 1 */
+ register unsigned int oc2; /* outcode of point 2 */
+
+ unsigned long *addrl; /* address of destination pixmap */
+ int nlwidth; /* width in longwords of destination pixmap */
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int x1, x2, y1, y2;
+ RegionPtr cclip;
+ cfbRRopRec rrops[2];
+ unsigned char *pDash;
+ int dashOffset;
+ int numInDashList;
+ int dashIndex;
+ int isDoubleDash;
+ int dashIndexTmp, dashOffsetTmp;
+ int unclippedlen;
+ cfbPrivGCPtr devPriv;
+
+ devPriv = cfbGetGCPrivate(pGC);
+ cclip = pGC->pCompositeClip;
+ rrops[0].rop = devPriv->rop;
+ rrops[0].and = devPriv->and;
+ rrops[0].xor = devPriv->xor;
+ if (pGC->alu == GXcopy)
+ {
+ rrops[1].rop = GXcopy;
+ rrops[1].and = 0;
+ rrops[1].xor = PFILL (pGC->bgPixel);
+ }
+ else
+ {
+ rrops[1].rop = cfbReduceRasterOp (pGC->alu,
+ pGC->bgPixel, pGC->planemask,
+ &rrops[1].and, &rrops[1].xor);
+ }
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
+
+ /* compute initial dash values */
+
+ pDash = (unsigned char *) pGC->dash;
+ numInDashList = pGC->numInDashList;
+ isDoubleDash = (pGC->lineStyle == LineDoubleDash);
+ dashIndex = 0;
+ dashOffset = 0;
+ miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious)
+ {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
+
+ if (adx > ady)
+ {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ unclippedlen = adx;
+ }
+ else
+ {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ unclippedlen = ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--)
+ {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0)
+ {
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ unclippedlen++;
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+ cfbBresD (rrops,
+ &dashIndexTmp, pDash, numInDashList,
+ &dashOffsetTmp, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, unclippedlen);
+ break;
+#else
+ cfbBresD (rrops,
+ &dashIndex, pDash, numInDashList,
+ &dashOffset, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, unclippedlen);
+ goto dontStep;
+#endif
+ }
+ else if (oc1 & oc2)
+ {
+ pbox++;
+ }
+ else /* have to clip */
+ {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+ int dashIndexTmp, dashOffsetTmp;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
+ pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+
+ if (clip1)
+ {
+ int dlen;
+
+ if (axis == X_AXIS)
+ dlen = abs(new_x1 - x1);
+ else
+ dlen = abs(new_y1 - y1);
+ miStepDash (dlen, &dashIndexTmp, pDash,
+ numInDashList, &dashOffsetTmp);
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len)
+ {
+ /* unwind bresenham error term to first point */
+ if (clip1)
+ {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ cfbBresD (rrops,
+ &dashIndexTmp, pDash, numInDashList,
+ &dashOffsetTmp, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e2, len);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+#ifndef POLYSEGMENT
+ /*
+ * walk the dash list around to the next line
+ */
+ miStepDash (unclippedlen, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+dontStep: ;
+#endif
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((dashIndex & 1) == 0 || isDoubleDash) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--)
+ {
+ if ((x2 >= pbox->x1) &&
+ (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) &&
+ (y2 < pbox->y2))
+ {
+ unsigned long mask;
+ int pix;
+
+ pix = 0;
+ if (dashIndex & 1)
+ pix = 1;
+#if PSZ == 24
+ mask = cfbmask[(x2 & 3)<<1];
+ addrl += (y2 * nlwidth) + ((x2 *3)>> 2);
+#else
+ mask = cfbmask[x2 & PIM];
+ addrl += (y2 * nlwidth) + (x2 >> PWSH);
+#endif
+ *addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/cfb/cfbmap.h b/xc/programs/Xserver/cfb/cfbmap.h
new file mode 100644
index 000000000..dce25c804
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbmap.h
@@ -0,0 +1,195 @@
+/*
+ * $TOG: cfbmap.h /main/12 1998/02/09 14:06:19 kaleb $
+ *
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.7 1998/11/28 10:42:51 dawes Exp $ */
+
+/*
+ * Map names around so that multiple depths can be supported simultaneously
+ */
+
+/* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */
+
+#if PSZ != 8
+#if PSZ == 32
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) cfb32##subname
+#else
+#define NAME(subname) cfb32/**/subname
+#endif
+#endif
+
+#if PSZ == 24
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) cfb24##subname
+#else
+#define NAME(subname) cfb24/**/subname
+#endif
+#endif
+
+#if PSZ == 16
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) cfb16##subname
+#else
+#define NAME(subname) cfb16/**/subname
+#endif
+#endif
+
+#if PSZ == 4
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define NAME(subname) cfb4##subname
+#else
+#define NAME(subname) cfb4/**/subname
+#endif
+#endif
+
+#ifndef NAME
+cfb can not hack PSZ yet
+#endif
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define CATNAME(prefix,subname) prefix##subname
+#else
+#define CATNAME(prefix,subname) prefix/**/subname
+#endif
+
+#define cfbScreenPrivateIndex NAME(ScreenPrivateIndex)
+#define QuartetBitsTable NAME(QuartetBitsTable)
+#define QuartetPixelMaskTable NAME(QuartetPixelMaskTable)
+#define cfbAllocatePrivates NAME(AllocatePrivates)
+#define cfbBSFuncRec NAME(BSFuncRec)
+#define cfbBitBlt NAME(BitBlt)
+#define cfbBresD NAME(BresD)
+#define cfbBresS NAME(BresS)
+#define cfbChangeWindowAttributes NAME(ChangeWindowAttributes)
+#define cfbCloseScreen NAME(CloseScreen)
+#define cfbCopyArea NAME(CopyArea)
+#define cfbCopyImagePlane NAME(CopyImagePlane)
+#define cfbCopyPixmap NAME(CopyPixmap)
+#define cfbCopyPlane NAME(CopyPlane)
+#define cfbCopyRotatePixmap NAME(CopyRotatePixmap)
+#define cfbCopyWindow NAME(CopyWindow)
+#define cfbCreateGC NAME(CreateGC)
+#define cfbCreatePixmap NAME(CreatePixmap)
+#define cfbCreateWindow NAME(CreateWindow)
+#define cfbCreateScreenResources NAME(CreateScreenResources)
+#define cfbDestroyPixmap NAME(DestroyPixmap)
+#define cfbDestroyWindow NAME(DestroyWindow)
+#define cfbDoBitblt NAME(DoBitblt)
+#define cfbDoBitbltCopy NAME(DoBitbltCopy)
+#define cfbDoBitbltGeneral NAME(DoBitbltGeneral)
+#define cfbDoBitbltOr NAME(DoBitbltOr)
+#define cfbDoBitbltXor NAME(DoBitbltXor)
+#define cfbFillBoxSolid NAME(FillBoxSolid)
+#define cfbFillBoxTile32 NAME(FillBoxTile32)
+#define cfbFillBoxTile32sCopy NAME(FillBoxTile32sCopy)
+#define cfbFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral)
+#define cfbFillBoxTileOdd NAME(FillBoxTileOdd)
+#define cfbFillBoxTileOddCopy NAME(FillBoxTileOddCopy)
+#define cfbFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral)
+#define cfbFillPoly1RectCopy NAME(FillPoly1RectCopy)
+#define cfbFillPoly1RectGeneral NAME(FillPoly1RectGeneral)
+#define cfbFillRectSolidCopy NAME(FillRectSolidCopy)
+#define cfbFillRectSolidGeneral NAME(FillRectSolidGeneral)
+#define cfbFillRectSolidXor NAME(FillRectSolidXor)
+#define cfbFillRectTile32Copy NAME(FillRectTile32Copy)
+#define cfbFillRectTile32General NAME(FillRectTile32General)
+#define cfbFillRectTileOdd NAME(FillRectTileOdd)
+#define cfbFillSpanTile32sCopy NAME(FillSpanTile32sCopy)
+#define cfbFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral)
+#define cfbFillSpanTileOddCopy NAME(FillSpanTileOddCopy)
+#define cfbFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral)
+#define cfbFinishScreenInit NAME(FinishScreenInit)
+#define cfbGCFuncs NAME(GCFuncs)
+#define cfbGetImage NAME(GetImage)
+#define cfbGetScreenPixmap NAME(GetScreenPixmap)
+#define cfbGetSpans NAME(GetSpans)
+#define cfbHorzS NAME(HorzS)
+#define cfbImageGlyphBlt8 NAME(ImageGlyphBlt8)
+#define cfbLineSD NAME(LineSD)
+#define cfbLineSS NAME(LineSS)
+#define cfbMapWindow NAME(MapWindow)
+#define cfbMatchCommon NAME(MatchCommon)
+#define cfbNonTEOps NAME(NonTEOps)
+#define cfbNonTEOps1Rect NAME(NonTEOps1Rect)
+#define cfbPadPixmap NAME(PadPixmap)
+#define cfbPaintWindow NAME(PaintWindow)
+#define cfbPolyGlyphBlt8 NAME(PolyGlyphBlt8)
+#define cfbPolyGlyphRop8 NAME(PolyGlyphRop8)
+#define cfbPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy)
+#define cfbPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral)
+#define cfbPolyFillRect NAME(PolyFillRect)
+#define cfbPolyPoint NAME(PolyPoint)
+#define cfbPositionWindow NAME(PositionWindow)
+#define cfbPutImage NAME(PutImage)
+#define cfbReduceRasterOp NAME(ReduceRasterOp)
+#define cfbRestoreAreas NAME(RestoreAreas)
+#define cfbSaveAreas NAME(SaveAreas)
+#define cfbScreenInit NAME(ScreenInit)
+#define cfbSegmentSD NAME(SegmentSD)
+#define cfbSegmentSS NAME(SegmentSS)
+#define cfbSetScanline NAME(SetScanline)
+#define cfbSetScreenPixmap NAME(SetScreenPixmap)
+#define cfbSetSpans NAME(SetSpans)
+#define cfbSetupScreen NAME(SetupScreen)
+#define cfbSolidSpansCopy NAME(SolidSpansCopy)
+#define cfbSolidSpansGeneral NAME(SolidSpansGeneral)
+#define cfbSolidSpansXor NAME(SolidSpansXor)
+#define cfbStippleStack NAME(StippleStack)
+#define cfbStippleStackTE NAME(StippleStackTE)
+#define cfbTEGlyphBlt NAME(TEGlyphBlt)
+#define cfbTEOps NAME(TEOps)
+#define cfbTEOps1Rect NAME(TEOps1Rect)
+#define cfbTile32FSCopy NAME(Tile32FSCopy)
+#define cfbTile32FSGeneral NAME(Tile32FSGeneral)
+#define cfbUnmapWindow NAME(UnmapWindow)
+#define cfbUnnaturalStippleFS NAME(UnnaturalStippleFS)
+#define cfbUnnaturalTileFS NAME(UnnaturalTileFS)
+#define cfbValidateGC NAME(ValidateGC)
+#define cfbVertS NAME(VertS)
+#define cfbXRotatePixmap NAME(XRotatePixmap)
+#define cfbYRotatePixmap NAME(YRotatePixmap)
+#define cfbendpartial NAME(endpartial)
+#define cfbendtab NAME(endtab)
+#define cfbmask NAME(mask)
+#define cfbrmask NAME(rmask)
+#define cfbstartpartial NAME(startpartial)
+#define cfbstarttab NAME(starttab)
+#define cfb8LineSS1Rect NAME(LineSS1Rect)
+#define cfb8SegmentSS1Rect NAME(SegmentSS1Rect)
+#define cfb8ClippedLineCopy NAME(ClippedLineCopy)
+#define cfb8ClippedLineXor NAME(ClippedLineXor)
+#define cfb8ClippedLineGeneral NAME(ClippedLineGeneral )
+#define cfb8SegmentSS1RectCopy NAME(SegmentSS1RectCopy)
+#define cfb8SegmentSS1RectXor NAME(SegmentSS1RectXor)
+#define cfb8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral )
+#define cfb8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy)
+#define cfb8LineSS1RectCopy NAME(LineSS1RectCopy)
+#define cfb8LineSS1RectXor NAME(LineSS1RectXor)
+#define cfb8LineSS1RectGeneral NAME(LineSS1RectGeneral )
+#define cfb8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy)
+#define cfbZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy)
+#define cfbZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor)
+#define cfbZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral)
+
+#endif /* PSZ != 8 */
diff --git a/xc/programs/Xserver/cfb/cfbmodule.c b/xc/programs/Xserver/cfb/cfbmodule.c
new file mode 100644
index 000000000..87af699db
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbmodule.c
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbmodule.c,v 1.8 1999/01/26 05:53:48 dawes Exp $ */
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef XFree86LOADER
+
+#include "xf86Module.h"
+#include "cfb.h"
+
+static MODULESETUPPROTO(cfbSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+XF86ModuleData cfbModuleData = { &VersRec, cfbSetup, NULL };
+
+static pointer
+cfbSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires mfb, so load it */
+ return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
+
+#endif
diff --git a/xc/programs/Xserver/cfb/cfbmskbits.c b/xc/programs/Xserver/cfb/cfbmskbits.c
new file mode 100644
index 000000000..0dd9eb900
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbmskbits.c
@@ -0,0 +1,1398 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.c,v 3.1 1998/10/04 09:37:46 dawes Exp $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/* $TOG: cfbmskbits.c /main/16 1998/02/09 14:06:25 kaleb $ */
+
+/*
+ * ==========================================================================
+ * Converted to Color Frame Buffer by smarks@sun, April-May 1987. The "bit
+ * numbering" in the doc below really means "byte numbering" now.
+ * ==========================================================================
+ */
+
+/*
+ these tables are used by several macros in the cfb code.
+
+ the vax numbers everything left to right, so bit indices on the
+screen match bit indices in longwords. the pc-rt and Sun number
+bits on the screen the way they would be written on paper,
+(i.e. msb to the left), and so a bit index n on the screen is
+bit index 32-n in a longword
+
+ see also cfbmskbits.h
+*/
+#include <X.h>
+#include <Xmd.h>
+#include <servermd.h>
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+#define _cfbBits(a) (PixelGroup)(a)
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define cfbBits(v) _cfbBits(v)
+#else /* BITMAP_BIT_ORDER == LSBFirst */
+#define cfbFlip2(a) ((((a) & 0x1) << 1) | (((a) & 0x2) >> 1))
+#define cfbFlip4(a) ((cfbFlip2(a) << 2) | cfbFlip2(a >> 2))
+#define cfbFlip8(a) ((cfbFlip4(a) << 4) | cfbFlip4(a >> 4))
+#define cfbFlip16(a) ((cfbFlip8(a) << 8) | cfbFlip8(a >> 8))
+#define cfbFlip32(a) ((cfbFlip16(a) << 16) | cfbFlip16(a >> 16))
+#if PGSZ == 32
+#define cfbBits(a) cfbFlip32(_cfbBits(a))
+#else /* PGSZ == 64 */
+#define cfbFlip64(a) ((cfbFlip32(a) << 32) | cfbFlip32(a >> 32))
+#define cfbBits(a) cfbFlip64(_cfbBits(a))
+#endif /* PGSZ */
+#endif /* BITMAP_BIT_ORDER */
+
+/* NOTE:
+the first element in starttab could be 0xffffffff. making it 0
+lets us deal with a full first word in the middle loop, rather
+than having to do the multiple reads and masks that we'd
+have to do if we thought it was partial.
+*/
+#if PSZ == 4
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0x0FFFFFFF),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x000FFFFF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00000FFF),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000000F)
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0xF0000000),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFF00000),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFFFFF000),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFFFFF0)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0FFFFFFFFFFFFFFF),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ cfbBits(0x000FFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x00000FFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x0000000FFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x000000000FFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x00000000000FFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x0000000000000FFF),
+ cfbBits(0x00000000000000FF),
+ cfbBits(0x000000000000000F),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xF000000000000000),
+ cfbBits(0xFF00000000000000),
+ cfbBits(0xFFF0000000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFF00000000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFFFFF000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFF0000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFFFFF00000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFFFFF000),
+ cfbBits(0xFFFFFFFFFFFFFF00),
+ cfbBits(0xFFFFFFFFFFFFFFF0),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 4 */
+
+#if PSZ == 8
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x000000FF)
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFFFFFF00)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x00000000000000FF)
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFF00000000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFFFFFF00)
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0x0000FFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0xFFFF0000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ };
+#endif /* PGSZ */
+#endif
+
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00FFFFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFF000000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFF000000000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+#if PGSZ == 32
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x00000000),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x00000000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstarttab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x00000000FFFFFFFF),
+ };
+PixelGroup cfbendtab[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 32 */
+
+/* a hack, for now, since the entries for 0 need to be all
+ 1 bits, not all zeros.
+ this means the code DOES NOT WORK for segments of length
+ 0 (which is only a problem in the horizontal line code.)
+*/
+#if PSZ == 4
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0x0FFFFFFF),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x000FFFFF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00000FFF),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000000F)
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xF0000000),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFF00000),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFFFFF000),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFFFFF0)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x0FFFFFFFFFFFFFFF),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ cfbBits(0x000FFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x00000FFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x0000000FFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x000000000FFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x00000000000FFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x0000000000000FFF),
+ cfbBits(0x00000000000000FF),
+ cfbBits(0x000000000000000F),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xF000000000000000),
+ cfbBits(0xFF00000000000000),
+ cfbBits(0xFFF0000000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFF00000000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFFFFF000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFF0000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFFFFF00000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFFFFF000),
+ cfbBits(0xFFFFFFFFFFFFFF00),
+ cfbBits(0xFFFFFFFFFFFFFFF0),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 4 */
+
+#if PSZ == 8
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x000000FF)
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFFFFFF00)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x00000000000000FF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xFF00000000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFFFFFF00),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0x0000FFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFFFF0000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x000000000000FFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 16 */
+
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0x000000FF),
+ cfbBits(0x0000FFFF),
+ cfbBits(0x00FFFFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0xFFFF0000),
+ cfbBits(0xFF000000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0x0000000000FFFFFF),
+ cfbBits(0x000000000000FFFF),
+ cfbBits(0x00000000000000FF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ cfbBits(0xFFFFFFFFFF000000),
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0xFF00000000000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+#if PGSZ == 32
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbstartpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0x00000000FFFFFFFF),
+ };
+
+PixelGroup cfbendpartial[] =
+ {
+ cfbBits(0xFFFFFFFFFFFFFFFF),
+ cfbBits(0xFFFFFFFF00000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 32 */
+
+/* used for masking bits in bresenham lines
+ mask[n] is used to mask out all but bit n in a longword (n is a
+screen position).
+ rmask[n] is used to mask out the single bit at position n (n
+is a screen posiotion.)
+*/
+
+#if PSZ == 4
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xF0000000),
+ cfbBits(0x0F000000),
+ cfbBits(0x00F00000),
+ cfbBits(0x000F0000),
+ cfbBits(0x0000F000),
+ cfbBits(0x00000F00),
+ cfbBits(0x000000F0),
+ cfbBits(0x0000000F)
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x0FFFFFFF),
+ cfbBits(0xF0FFFFFF),
+ cfbBits(0xFF0FFFFF),
+ cfbBits(0xFFF0FFFF),
+ cfbBits(0xFFFF0FFF),
+ cfbBits(0xFFFFF0FF),
+ cfbBits(0xFFFFFF0F),
+ cfbBits(0xFFFFFFF0)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xF000000000000000),
+ cfbBits(0x0F00000000000000),
+ cfbBits(0x00F0000000000000),
+ cfbBits(0x000F000000000000),
+ cfbBits(0x0000F00000000000),
+ cfbBits(0x00000F0000000000),
+ cfbBits(0x000000F000000000),
+ cfbBits(0x0000000F00000000),
+ cfbBits(0x00000000F0000000),
+ cfbBits(0x000000000F000000),
+ cfbBits(0x0000000000F00000),
+ cfbBits(0x00000000000F0000),
+ cfbBits(0x000000000000F000),
+ cfbBits(0x0000000000000F00),
+ cfbBits(0x00000000000000F0),
+ cfbBits(0x000000000000000F),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x0FFFFFFFFFFFFFFF),
+ cfbBits(0xF0FFFFFFFFFFFFFF),
+ cfbBits(0xFF0FFFFFFFFFFFFF),
+ cfbBits(0xFFF0FFFFFFFFFFFF),
+ cfbBits(0xFFFF0FFFFFFFFFFF),
+ cfbBits(0xFFFFF0FFFFFFFFFF),
+ cfbBits(0xFFFFFF0FFFFFFFFF),
+ cfbBits(0xFFFFFFF0FFFFFFFF),
+ cfbBits(0xFFFFFFFF0FFFFFFF),
+ cfbBits(0xFFFFFFFFF0FFFFFF),
+ cfbBits(0xFFFFFFFFFF0FFFFF),
+ cfbBits(0xFFFFFFFFFFF0FFFF),
+ cfbBits(0xFFFFFFFFFFFF0FFF),
+ cfbBits(0xFFFFFFFFFFFFF0FF),
+ cfbBits(0xFFFFFFFFFFFFFF0F),
+ cfbBits(0xFFFFFFFFFFFFFFF0),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 4 */
+
+#if PSZ == 8
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFF000000),
+ cfbBits(0x00FF0000),
+ cfbBits(0x0000FF00),
+ cfbBits(0x000000FF)
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x00FFFFFF),
+ cfbBits(0xFF00FFFF),
+ cfbBits(0xFFFF00FF),
+ cfbBits(0xFFFFFF00)
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFF00000000000000),
+ cfbBits(0x00FF000000000000),
+ cfbBits(0x0000FF0000000000),
+ cfbBits(0x000000FF00000000),
+ cfbBits(0x00000000FF000000),
+ cfbBits(0x0000000000FF0000),
+ cfbBits(0x000000000000FF00),
+ cfbBits(0x00000000000000FF),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ cfbBits(0xFF00FFFFFFFFFFFF),
+ cfbBits(0xFFFF00FFFFFFFFFF),
+ cfbBits(0xFFFFFF00FFFFFFFF),
+ cfbBits(0xFFFFFFFF00FFFFFF),
+ cfbBits(0xFFFFFFFFFF00FFFF),
+ cfbBits(0xFFFFFFFFFFFF00FF),
+ cfbBits(0xFFFFFFFFFFFFFF00),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFF0000),
+ cfbBits(0x0000FFFF),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x0000FFFF),
+ cfbBits(0xFFFF0000),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFF000000000000),
+ cfbBits(0x0000FFFF00000000),
+ cfbBits(0x00000000FFFF0000),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x0000FFFFFFFFFFFF),
+ cfbBits(0xFFFF0000FFFFFFFF),
+ cfbBits(0xFFFFFFFF0000FFFF),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 16 */
+
+#if PSZ == 24
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFF00),
+ cfbBits(0x00000000),
+ cfbBits(0x000000FF),
+ cfbBits(0xFFFF0000),
+ cfbBits(0x0000FFFF),
+ cfbBits(0xFF000000),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0x00000000),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x000000FF),
+ cfbBits(0xFFFFFFFF),
+ cfbBits(0xFFFFFF00),
+ cfbBits(0x0000FFFF),
+ cfbBits(0xFFFF0000),
+ cfbBits(0x00FFFFFF),
+ cfbBits(0xFF000000),
+ cfbBits(0xFFFFFFFF),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFF0000000000),
+ cfbBits(0x000000FFFFFF0000),
+ cfbBits(0x000000000000FFFF),
+ };
+PixelGroup cfbmask2[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0000000000000000),
+ cfbBits(0xFF00000000000000),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x000000FFFFFFFFFF),
+ cfbBits(0xFFFFFF000000FFFF),
+ cfbBits(0xFFFFFFFFFFFF0000),
+ };
+PixelGroup cfbrmask2[] =
+ {
+ cfbBits(0x0000000000000000),
+ cfbBits(0x0000000000000000),
+ cfbBits(0x00FFFFFFFFFFFFFF),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+#if PGSZ == 32
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0xFFFFFFFF),
+ };
+#else /* PGSZ == 64 */
+PixelGroup cfbmask[] =
+ {
+ cfbBits(0xFFFFFFFF00000000),
+ cfbBits(0x00000000FFFFFFFF),
+ };
+PixelGroup cfbrmask[] =
+ {
+ cfbBits(0x00000000FFFFFFFF),
+ cfbBits(0xFFFFFFFF00000000),
+ };
+#endif /* PGSZ */
+#endif /* PSZ == 32 */
+
+/*
+ * QuartetBitsTable contains PPW+1 masks whose binary values are masks in the
+ * low order quartet that contain the number of bits specified in the
+ * index. This table is used by getstipplepixels.
+ */
+#if PSZ == 4
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00000000 */
+ 0x00000080, /* 1 - 10000000 */
+ 0x000000C0, /* 2 - 11000000 */
+ 0x000000E0, /* 3 - 11100000 */
+ 0x000000F0, /* 4 - 11110000 */
+ 0x000000F8, /* 5 - 11111000 */
+ 0x000000FC, /* 6 - 11111100 */
+ 0x000000FE, /* 7 - 11111110 */
+ 0x000000FF /* 8 - 11111111 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00000000 */
+ 0x00000001, /* 1 - 00000001 */
+ 0x00000003, /* 2 - 00000011 */
+ 0x00000007, /* 3 - 00000111 */
+ 0x0000000F, /* 4 - 00001111 */
+ 0x0000001F, /* 5 - 00011111 */
+ 0x0000003F, /* 6 - 00111111 */
+ 0x0000007F, /* 7 - 01111111 */
+ 0x000000FF /* 8 - 11111111 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0000000000000000 */
+ 0x00008000, /* 1 - 1000000000000000 */
+ 0x0000C000, /* 2 - 1100000000000000 */
+ 0x0000E000, /* 3 - 1110000000000000 */
+ 0x0000F000, /* 4 - 1111000000000000 */
+ 0x0000F800, /* 5 - 1111100000000000 */
+ 0x0000FC00, /* 6 - 1111110000000000 */
+ 0x0000FE00, /* 7 - 1111111000000000 */
+ 0x0000FF00, /* 8 - 1111111100000000 */
+ 0x0000FF80, /* 9 - 1111111110000000 */
+ 0x0000FFC0, /* 10- 1111111111000000 */
+ 0x0000FFE0, /* 11- 1111111111100000 */
+ 0x0000FFF0, /* 12- 1111111111110000 */
+ 0x0000FFF8, /* 13- 1111111111111000 */
+ 0x0000FFFC, /* 14- 1111111111111100 */
+ 0x0000FFFE, /* 15- 1111111111111110 */
+ 0x0000FFFF, /* 16- 1111111111111111 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0000000000000000 */
+ 0x00000001, /* 1 - 0000000000000001 */
+ 0x00000003, /* 2 - 0000000000000011 */
+ 0x00000007, /* 3 - 0000000000000111 */
+ 0x0000000F, /* 4 - 0000000000001111 */
+ 0x0000001F, /* 5 - 0000000000011111 */
+ 0x0000003F, /* 6 - 0000000000111111 */
+ 0x0000007F, /* 7 - 0000000001111111 */
+ 0x000000FF, /* 8 - 0000000011111111 */
+ 0x000001FF, /* 9 - 0000000111111111 */
+ 0x000003FF, /* 10- 0000001111111111 */
+ 0x000007FF, /* 11- 0000011111111111 */
+ 0x00000FFF, /* 12- 0000111111111111 */
+ 0x00001FFF, /* 13- 0001111111111111 */
+ 0x00003FFF, /* 14- 0011111111111111 */
+ 0x00007FFF, /* 15- 0111111111111111 */
+ 0x0000FFFF, /* 16- 1111111111111111 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 4 */
+
+#if PSZ == 8
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0000 */
+ 0x00000008, /* 1 - 1000 */
+ 0x0000000C, /* 2 - 1100 */
+ 0x0000000E, /* 3 - 1110 */
+ 0x0000000F /* 4 - 1111 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0000 */
+ 0x00000001, /* 1 - 0001 */
+ 0x00000003, /* 2 - 0011 */
+ 0x00000007, /* 3 - 0111 */
+ 0x0000000F /* 4 - 1111 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00000000 */
+ 0x00000080, /* 1 - 10000000 */
+ 0x000000C0, /* 2 - 11000000 */
+ 0x000000E0, /* 3 - 11100000 */
+ 0x000000F0, /* 4 - 11110000 */
+ 0x000000F8, /* 5 - 11111000 */
+ 0x000000FC, /* 6 - 11111100 */
+ 0x000000FE, /* 7 - 11111110 */
+ 0x000000FF /* 8 - 11111111 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00000000 */
+ 0x00000001, /* 1 - 00000001 */
+ 0x00000003, /* 2 - 00000011 */
+ 0x00000007, /* 3 - 00000111 */
+ 0x0000000F, /* 4 - 10000111 */
+ 0x0000001F, /* 5 - 00011111 */
+ 0x0000003F, /* 6 - 00111111 */
+ 0x0000007F, /* 7 - 01111111 */
+ 0x000000FF /* 8 - 11111111 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00 */
+ 0x00000002, /* 1 - 10 */
+ 0x00000003, /* 2 - 11 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00 */
+ 0x00000001, /* 1 - 01 */
+ 0x00000003, /* 2 - 11 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0000 */
+ 0x00000008, /* 1 - 1000 */
+ 0x0000000C, /* 2 - 1100 */
+ 0x0000000E, /* 3 - 1110 */
+ 0x0000000F, /* 4 - 1111 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0000 */
+ 0x00000001, /* 1 - 0001 */
+ 0x00000003, /* 2 - 0011 */
+ 0x00000007, /* 3 - 0111 */
+ 0x0000000F, /* 4 - 1111 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 16 */
+
+#if PSZ == 24
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00 */
+ 0x00000002, /* 1 - 10 */
+ 0x00000003, /* 2 - 11*/
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00 */
+ 0x00000001, /* 1 - 01 */
+ 0x00000003, /* 2 - 11 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+PixelGroup QuartetBitsTable[] = {
+#if PGSZ == 32
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 0 */
+ 0x00000001, /* 1 - 1 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#else /* PGSZ == 64 */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ 0x00000000, /* 0 - 00 */
+ 0x00000002, /* 1 - 10 */
+ 0x00000003, /* 2 - 11*/
+#else /* (BITMAP_BIT_ORDER == LSBFirst */
+ 0x00000000, /* 0 - 00 */
+ 0x00000001, /* 1 - 01 */
+ 0x00000003, /* 2 - 11 */
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif /* PGSZ */
+};
+#endif /* PSZ == 32 */
+
+/*
+ * QuartetPixelMaskTable is used by getstipplepixels to get a pixel mask
+ * corresponding to a quartet of bits. Note: the bit/byte order dependency
+ * is handled by QuartetBitsTable above.
+ */
+#if PSZ == 4
+#if PGSZ == 32
+PixelGroup QuartetPixelMaskTable[] = {
+ 0x00000000,
+ 0x0000000F,
+ 0x000000F0,
+ 0x000000FF,
+ 0x00000F00,
+ 0x00000F0F,
+ 0x00000FF0,
+ 0x00000FFF,
+ 0x0000F000,
+ 0x0000F00F,
+ 0x0000F0F0,
+ 0x0000F0FF,
+ 0x0000FF00,
+ 0x0000FF0F,
+ 0x0000FFF0,
+ 0x0000FFFF,
+ 0x000F0000,
+ 0x000F000F,
+ 0x000F00F0,
+ 0x000F00FF,
+ 0x000F0F00,
+ 0x000F0F0F,
+ 0x000F0FF0,
+ 0x000F0FFF,
+ 0x000FF000,
+ 0x000FF00F,
+ 0x000FF0F0,
+ 0x000FF0FF,
+ 0x000FFF00,
+ 0x000FFF0F,
+ 0x000FFFF0,
+ 0x000FFFFF,
+ 0x00F00000,
+ 0x00F0000F,
+ 0x00F000F0,
+ 0x00F000FF,
+ 0x00F00F00,
+ 0x00F00F0F,
+ 0x00F00FF0,
+ 0x00F00FFF,
+ 0x00F0F000,
+ 0x00F0F00F,
+ 0x00F0F0F0,
+ 0x00F0F0FF,
+ 0x00F0FF00,
+ 0x00F0FF0F,
+ 0x00F0FFF0,
+ 0x00F0FFFF,
+ 0x00FF0000,
+ 0x00FF000F,
+ 0x00FF00F0,
+ 0x00FF00FF,
+ 0x00FF0F00,
+ 0x00FF0F0F,
+ 0x00FF0FF0,
+ 0x00FF0FFF,
+ 0x00FFF000,
+ 0x00FFF00F,
+ 0x00FFF0F0,
+ 0x00FFF0FF,
+ 0x00FFFF00,
+ 0x00FFFF0F,
+ 0x00FFFFF0,
+ 0x00FFFFFF,
+ 0x0F000000,
+ 0x0F00000F,
+ 0x0F0000F0,
+ 0x0F0000FF,
+ 0x0F000F00,
+ 0x0F000F0F,
+ 0x0F000FF0,
+ 0x0F000FFF,
+ 0x0F00F000,
+ 0x0F00F00F,
+ 0x0F00F0F0,
+ 0x0F00F0FF,
+ 0x0F00FF00,
+ 0x0F00FF0F,
+ 0x0F00FFF0,
+ 0x0F00FFFF,
+ 0x0F0F0000,
+ 0x0F0F000F,
+ 0x0F0F00F0,
+ 0x0F0F00FF,
+ 0x0F0F0F00,
+ 0x0F0F0F0F,
+ 0x0F0F0FF0,
+ 0x0F0F0FFF,
+ 0x0F0FF000,
+ 0x0F0FF00F,
+ 0x0F0FF0F0,
+ 0x0F0FF0FF,
+ 0x0F0FFF00,
+ 0x0F0FFF0F,
+ 0x0F0FFFF0,
+ 0x0F0FFFFF,
+ 0x0FF00000,
+ 0x0FF0000F,
+ 0x0FF000F0,
+ 0x0FF000FF,
+ 0x0FF00F00,
+ 0x0FF00F0F,
+ 0x0FF00FF0,
+ 0x0FF00FFF,
+ 0x0FF0F000,
+ 0x0FF0F00F,
+ 0x0FF0F0F0,
+ 0x0FF0F0FF,
+ 0x0FF0FF00,
+ 0x0FF0FF0F,
+ 0x0FF0FFF0,
+ 0x0FF0FFFF,
+ 0x0FFF0000,
+ 0x0FFF000F,
+ 0x0FFF00F0,
+ 0x0FFF00FF,
+ 0x0FFF0F00,
+ 0x0FFF0F0F,
+ 0x0FFF0FF0,
+ 0x0FFF0FFF,
+ 0x0FFFF000,
+ 0x0FFFF00F,
+ 0x0FFFF0F0,
+ 0x0FFFF0FF,
+ 0x0FFFFF00,
+ 0x0FFFFF0F,
+ 0x0FFFFFF0,
+ 0x0FFFFFFF,
+ 0xF0000000,
+ 0xF000000F,
+ 0xF00000F0,
+ 0xF00000FF,
+ 0xF0000F00,
+ 0xF0000F0F,
+ 0xF0000FF0,
+ 0xF0000FFF,
+ 0xF000F000,
+ 0xF000F00F,
+ 0xF000F0F0,
+ 0xF000F0FF,
+ 0xF000FF00,
+ 0xF000FF0F,
+ 0xF000FFF0,
+ 0xF000FFFF,
+ 0xF00F0000,
+ 0xF00F000F,
+ 0xF00F00F0,
+ 0xF00F00FF,
+ 0xF00F0F00,
+ 0xF00F0F0F,
+ 0xF00F0FF0,
+ 0xF00F0FFF,
+ 0xF00FF000,
+ 0xF00FF00F,
+ 0xF00FF0F0,
+ 0xF00FF0FF,
+ 0xF00FFF00,
+ 0xF00FFF0F,
+ 0xF00FFFF0,
+ 0xF00FFFFF,
+ 0xF0F00000,
+ 0xF0F0000F,
+ 0xF0F000F0,
+ 0xF0F000FF,
+ 0xF0F00F00,
+ 0xF0F00F0F,
+ 0xF0F00FF0,
+ 0xF0F00FFF,
+ 0xF0F0F000,
+ 0xF0F0F00F,
+ 0xF0F0F0F0,
+ 0xF0F0F0FF,
+ 0xF0F0FF00,
+ 0xF0F0FF0F,
+ 0xF0F0FFF0,
+ 0xF0F0FFFF,
+ 0xF0FF0000,
+ 0xF0FF000F,
+ 0xF0FF00F0,
+ 0xF0FF00FF,
+ 0xF0FF0F00,
+ 0xF0FF0F0F,
+ 0xF0FF0FF0,
+ 0xF0FF0FFF,
+ 0xF0FFF000,
+ 0xF0FFF00F,
+ 0xF0FFF0F0,
+ 0xF0FFF0FF,
+ 0xF0FFFF00,
+ 0xF0FFFF0F,
+ 0xF0FFFFF0,
+ 0xF0FFFFFF,
+ 0xFF000000,
+ 0xFF00000F,
+ 0xFF0000F0,
+ 0xFF0000FF,
+ 0xFF000F00,
+ 0xFF000F0F,
+ 0xFF000FF0,
+ 0xFF000FFF,
+ 0xFF00F000,
+ 0xFF00F00F,
+ 0xFF00F0F0,
+ 0xFF00F0FF,
+ 0xFF00FF00,
+ 0xFF00FF0F,
+ 0xFF00FFF0,
+ 0xFF00FFFF,
+ 0xFF0F0000,
+ 0xFF0F000F,
+ 0xFF0F00F0,
+ 0xFF0F00FF,
+ 0xFF0F0F00,
+ 0xFF0F0F0F,
+ 0xFF0F0FF0,
+ 0xFF0F0FFF,
+ 0xFF0FF000,
+ 0xFF0FF00F,
+ 0xFF0FF0F0,
+ 0xFF0FF0FF,
+ 0xFF0FFF00,
+ 0xFF0FFF0F,
+ 0xFF0FFFF0,
+ 0xFF0FFFFF,
+ 0xFFF00000,
+ 0xFFF0000F,
+ 0xFFF000F0,
+ 0xFFF000FF,
+ 0xFFF00F00,
+ 0xFFF00F0F,
+ 0xFFF00FF0,
+ 0xFFF00FFF,
+ 0xFFF0F000,
+ 0xFFF0F00F,
+ 0xFFF0F0F0,
+ 0xFFF0F0FF,
+ 0xFFF0FF00,
+ 0xFFF0FF0F,
+ 0xFFF0FFF0,
+ 0xFFF0FFFF,
+ 0xFFFF0000,
+ 0xFFFF000F,
+ 0xFFFF00F0,
+ 0xFFFF00FF,
+ 0xFFFF0F00,
+ 0xFFFF0F0F,
+ 0xFFFF0FF0,
+ 0xFFFF0FFF,
+ 0xFFFFF000,
+ 0xFFFFF00F,
+ 0xFFFFF0F0,
+ 0xFFFFF0FF,
+ 0xFFFFFF00,
+ 0xFFFFFF0F,
+ 0xFFFFFFF0,
+ 0xFFFFFFFF,
+};
+#else /* PGSZ == 64 */
+No QuartetPixelMaskTable for psz=PSZ
+this would be a 64K entry table, a bit much I think.
+Try breaking things in two:
+mask = table[index&0xff00]<<32 | table[index&0xff]
+#endif /* PGSZ */
+#endif /* PSZ == 4 */
+
+#if PSZ == 8
+PixelGroup QuartetPixelMaskTable[] = {
+#if PGSZ == 32
+ 0x00000000,
+ 0x000000FF,
+ 0x0000FF00,
+ 0x0000FFFF,
+ 0x00FF0000,
+ 0x00FF00FF,
+ 0x00FFFF00,
+ 0x00FFFFFF,
+ 0xFF000000,
+ 0xFF0000FF,
+ 0xFF00FF00,
+ 0xFF00FFFF,
+ 0xFFFF0000,
+ 0xFFFF00FF,
+ 0xFFFFFF00,
+ 0xFFFFFFFF
+#else /* PGSZ == 64 */
+ 0x0000000000000000, 0x00000000000000FF,
+ 0x000000000000FF00, 0x000000000000FFFF,
+ 0x0000000000FF0000, 0x0000000000FF00FF,
+ 0x0000000000FFFF00, 0x0000000000FFFFFF,
+ 0x00000000FF000000, 0x00000000FF0000FF,
+ 0x00000000FF00FF00, 0x00000000FF00FFFF,
+ 0x00000000FFFF0000, 0x00000000FFFF00FF,
+ 0x00000000FFFFFF00, 0x00000000FFFFFFFF,
+ 0x000000FF00000000, 0x000000FF000000FF,
+ 0x000000FF0000FF00, 0x000000FF0000FFFF,
+ 0x000000FF00FF0000, 0x000000FF00FF00FF,
+ 0x000000FF00FFFF00, 0x000000FF00FFFFFF,
+ 0x000000FFFF000000, 0x000000FFFF0000FF,
+ 0x000000FFFF00FF00, 0x000000FFFF00FFFF,
+ 0x000000FFFFFF0000, 0x000000FFFFFF00FF,
+ 0x000000FFFFFFFF00, 0x000000FFFFFFFFFF,
+ 0x0000FF0000000000, 0x0000FF00000000FF,
+ 0x0000FF000000FF00, 0x0000FF000000FFFF,
+ 0x0000FF0000FF0000, 0x0000FF0000FF00FF,
+ 0x0000FF0000FFFF00, 0x0000FF0000FFFFFF,
+ 0x0000FF00FF000000, 0x0000FF00FF0000FF,
+ 0x0000FF00FF00FF00, 0x0000FF00FF00FFFF,
+ 0x0000FF00FFFF0000, 0x0000FF00FFFF00FF,
+ 0x0000FF00FFFFFF00, 0x0000FF00FFFFFFFF,
+ 0x0000FFFF00000000, 0x0000FFFF000000FF,
+ 0x0000FFFF0000FF00, 0x0000FFFF0000FFFF,
+ 0x0000FFFF00FF0000, 0x0000FFFF00FF00FF,
+ 0x0000FFFF00FFFF00, 0x0000FFFF00FFFFFF,
+ 0x0000FFFFFF000000, 0x0000FFFFFF0000FF,
+ 0x0000FFFFFF00FF00, 0x0000FFFFFF00FFFF,
+ 0x0000FFFFFFFF0000, 0x0000FFFFFFFF00FF,
+ 0x0000FFFFFFFFFF00, 0x0000FFFFFFFFFFFF,
+ 0x00FF000000000000, 0x00FF0000000000FF,
+ 0x00FF00000000FF00, 0x00FF00000000FFFF,
+ 0x00FF000000FF0000, 0x00FF000000FF00FF,
+ 0x00FF000000FFFF00, 0x00FF000000FFFFFF,
+ 0x00FF0000FF000000, 0x00FF0000FF0000FF,
+ 0x00FF0000FF00FF00, 0x00FF0000FF00FFFF,
+ 0x00FF0000FFFF0000, 0x00FF0000FFFF00FF,
+ 0x00FF0000FFFFFF00, 0x00FF0000FFFFFFFF,
+ 0x00FF00FF00000000, 0x00FF00FF000000FF,
+ 0x00FF00FF0000FF00, 0x00FF00FF0000FFFF,
+ 0x00FF00FF00FF0000, 0x00FF00FF00FF00FF,
+ 0x00FF00FF00FFFF00, 0x00FF00FF00FFFFFF,
+ 0x00FF00FFFF000000, 0x00FF00FFFF0000FF,
+ 0x00FF00FFFF00FF00, 0x00FF00FFFF00FFFF,
+ 0x00FF00FFFFFF0000, 0x00FF00FFFFFF00FF,
+ 0x00FF00FFFFFFFF00, 0x00FF00FFFFFFFFFF,
+ 0x00FFFF0000000000, 0x00FFFF00000000FF,
+ 0x00FFFF000000FF00, 0x00FFFF000000FFFF,
+ 0x00FFFF0000FF0000, 0x00FFFF0000FF00FF,
+ 0x00FFFF0000FFFF00, 0x00FFFF0000FFFFFF,
+ 0x00FFFF00FF000000, 0x00FFFF00FF0000FF,
+ 0x00FFFF00FF00FF00, 0x00FFFF00FF00FFFF,
+ 0x00FFFF00FFFF0000, 0x00FFFF00FFFF00FF,
+ 0x00FFFF00FFFFFF00, 0x00FFFF00FFFFFFFF,
+ 0x00FFFFFF00000000, 0x00FFFFFF000000FF,
+ 0x00FFFFFF0000FF00, 0x00FFFFFF0000FFFF,
+ 0x00FFFFFF00FF0000, 0x00FFFFFF00FF00FF,
+ 0x00FFFFFF00FFFF00, 0x00FFFFFF00FFFFFF,
+ 0x00FFFFFFFF000000, 0x00FFFFFFFF0000FF,
+ 0x00FFFFFFFF00FF00, 0x00FFFFFFFF00FFFF,
+ 0x00FFFFFFFFFF0000, 0x00FFFFFFFFFF00FF,
+ 0x00FFFFFFFFFFFF00, 0x00FFFFFFFFFFFFFF,
+ 0xFF00000000000000, 0xFF000000000000FF,
+ 0xFF0000000000FF00, 0xFF0000000000FFFF,
+ 0xFF00000000FF0000, 0xFF00000000FF00FF,
+ 0xFF00000000FFFF00, 0xFF00000000FFFFFF,
+ 0xFF000000FF000000, 0xFF000000FF0000FF,
+ 0xFF000000FF00FF00, 0xFF000000FF00FFFF,
+ 0xFF000000FFFF0000, 0xFF000000FFFF00FF,
+ 0xFF000000FFFFFF00, 0xFF000000FFFFFFFF,
+ 0xFF0000FF00000000, 0xFF0000FF000000FF,
+ 0xFF0000FF0000FF00, 0xFF0000FF0000FFFF,
+ 0xFF0000FF00FF0000, 0xFF0000FF00FF00FF,
+ 0xFF0000FF00FFFF00, 0xFF0000FF00FFFFFF,
+ 0xFF0000FFFF000000, 0xFF0000FFFF0000FF,
+ 0xFF0000FFFF00FF00, 0xFF0000FFFF00FFFF,
+ 0xFF0000FFFFFF0000, 0xFF0000FFFFFF00FF,
+ 0xFF0000FFFFFFFF00, 0xFF0000FFFFFFFFFF,
+ 0xFF00FF0000000000, 0xFF00FF00000000FF,
+ 0xFF00FF000000FF00, 0xFF00FF000000FFFF,
+ 0xFF00FF0000FF0000, 0xFF00FF0000FF00FF,
+ 0xFF00FF0000FFFF00, 0xFF00FF0000FFFFFF,
+ 0xFF00FF00FF000000, 0xFF00FF00FF0000FF,
+ 0xFF00FF00FF00FF00, 0xFF00FF00FF00FFFF,
+ 0xFF00FF00FFFF0000, 0xFF00FF00FFFF00FF,
+ 0xFF00FF00FFFFFF00, 0xFF00FF00FFFFFFFF,
+ 0xFF00FFFF00000000, 0xFF00FFFF000000FF,
+ 0xFF00FFFF0000FF00, 0xFF00FFFF0000FFFF,
+ 0xFF00FFFF00FF0000, 0xFF00FFFF00FF00FF,
+ 0xFF00FFFF00FFFF00, 0xFF00FFFF00FFFFFF,
+ 0xFF00FFFFFF000000, 0xFF00FFFFFF0000FF,
+ 0xFF00FFFFFF00FF00, 0xFF00FFFFFF00FFFF,
+ 0xFF00FFFFFFFF0000, 0xFF00FFFFFFFF00FF,
+ 0xFF00FFFFFFFFFF00, 0xFF00FFFFFFFFFFFF,
+ 0xFFFF000000000000, 0xFFFF0000000000FF,
+ 0xFFFF00000000FF00, 0xFFFF00000000FFFF,
+ 0xFFFF000000FF0000, 0xFFFF000000FF00FF,
+ 0xFFFF000000FFFF00, 0xFFFF000000FFFFFF,
+ 0xFFFF0000FF000000, 0xFFFF0000FF0000FF,
+ 0xFFFF0000FF00FF00, 0xFFFF0000FF00FFFF,
+ 0xFFFF0000FFFF0000, 0xFFFF0000FFFF00FF,
+ 0xFFFF0000FFFFFF00, 0xFFFF0000FFFFFFFF,
+ 0xFFFF00FF00000000, 0xFFFF00FF000000FF,
+ 0xFFFF00FF0000FF00, 0xFFFF00FF0000FFFF,
+ 0xFFFF00FF00FF0000, 0xFFFF00FF00FF00FF,
+ 0xFFFF00FF00FFFF00, 0xFFFF00FF00FFFFFF,
+ 0xFFFF00FFFF000000, 0xFFFF00FFFF0000FF,
+ 0xFFFF00FFFF00FF00, 0xFFFF00FFFF00FFFF,
+ 0xFFFF00FFFFFF0000, 0xFFFF00FFFFFF00FF,
+ 0xFFFF00FFFFFFFF00, 0xFFFF00FFFFFFFFFF,
+ 0xFFFFFF0000000000, 0xFFFFFF00000000FF,
+ 0xFFFFFF000000FF00, 0xFFFFFF000000FFFF,
+ 0xFFFFFF0000FF0000, 0xFFFFFF0000FF00FF,
+ 0xFFFFFF0000FFFF00, 0xFFFFFF0000FFFFFF,
+ 0xFFFFFF00FF000000, 0xFFFFFF00FF0000FF,
+ 0xFFFFFF00FF00FF00, 0xFFFFFF00FF00FFFF,
+ 0xFFFFFF00FFFF0000, 0xFFFFFF00FFFF00FF,
+ 0xFFFFFF00FFFFFF00, 0xFFFFFF00FFFFFFFF,
+ 0xFFFFFFFF00000000, 0xFFFFFFFF000000FF,
+ 0xFFFFFFFF0000FF00, 0xFFFFFFFF0000FFFF,
+ 0xFFFFFFFF00FF0000, 0xFFFFFFFF00FF00FF,
+ 0xFFFFFFFF00FFFF00, 0xFFFFFFFF00FFFFFF,
+ 0xFFFFFFFFFF000000, 0xFFFFFFFFFF0000FF,
+ 0xFFFFFFFFFF00FF00, 0xFFFFFFFFFF00FFFF,
+ 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFF00FF,
+ 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFFFFFF,
+#endif /* PGSZ */
+};
+#endif /* PSZ == 8 */
+
+#if PSZ == 16
+PixelGroup QuartetPixelMaskTable[] = {
+#if PGSZ == 32
+ 0x00000000,
+ 0x0000FFFF,
+ 0xFFFF0000,
+ 0xFFFFFFFF,
+#else /* PGSZ == 64 */
+ 0x0000000000000000, 0x000000000000FFFF,
+ 0x00000000FFFF0000, 0x00000000FFFFFFFF,
+ 0x0000FFFF00000000, 0x0000FFFF0000FFFF,
+ 0x0000FFFFFFFF0000, 0x0000FFFFFFFFFFFF,
+ 0xFFFF000000000000, 0xFFFF00000000FFFF,
+ 0xFFFF0000FFFF0000, 0xFFFF0000FFFFFFFF,
+ 0xFFFFFFFF00000000, 0xFFFFFFFF0000FFFF,
+ 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFFFFFF,
+#endif /* PGSZ */
+};
+#endif /* PSZ == 16 */
+
+#if PSZ == 24
+PixelGroup QuartetPixelMaskTable[] = {
+#if PGSZ == 32
+/* Four pixels consist three pixel groups....*/
+ 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/
+/* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/
+/* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/
+/* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/
+/* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/
+/* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/
+/* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/
+/* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/
+/* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/
+/* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/
+/* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/
+/* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/
+/* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/
+/* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/
+/* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/
+/* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/
+/* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/
+#else /* PGSZ == 64 */
+ 0x0000000000000000, 0x0000000000FFFFFF,
+ 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF
+#endif /* PGSZ */
+};
+#endif /* PSZ == 24 */
+
+#if PSZ == 32
+PixelGroup QuartetPixelMaskTable[] = {
+#if PGSZ == 32
+ 0x00000000,
+ 0xFFFFFFFF,
+#else /* PGSZ == 64 */
+ 0x0000000000000000,
+ 0x00000000FFFFFFFF,
+ 0xFFFFFFFF00000000,
+ 0xFFFFFFFFFFFFFFFF
+#endif /* PGSZ */
+};
+#endif /* PSZ == 32 */
+
+#if PSZ == 24
+int cfb24Shift[] =
+#if (BITMAP_BIT_ORDER == MSBFirst)
+{8,0,16,16,8,24,0,0};
+#else /* (BITMAP_BIT_ORDER == LSBFirst) */
+{0,0,24,8,16,16,8,0};
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+#endif
diff --git a/xc/programs/Xserver/cfb/cfbmskbits.h b/xc/programs/Xserver/cfb/cfbmskbits.h
new file mode 100644
index 000000000..8655715cc
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbmskbits.h
@@ -0,0 +1,893 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.7 1998/12/20 11:57:29 dawes Exp $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/* $TOG: cfbmskbits.h /main/28 1998/02/09 14:06:32 kaleb $ */
+/* Optimizations for PSZ == 32 added by Kyle Marvin (marvin@vitec.com) */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#if defined(XFREE86) || ( defined(__OpenBSD__) && defined(__alpha__) )
+#define NO_COMPILER_H_EXTRAS
+#include "compiler.h"
+#endif
+
+/*
+ * ==========================================================================
+ * Converted from mfb to support memory-mapped color framebuffer by smarks@sun,
+ * April-May 1987.
+ *
+ * The way I did the conversion was to consider each longword as an
+ * array of four bytes instead of an array of 32 one-bit pixels. So
+ * getbits() and putbits() retain much the same calling sequence, but
+ * they move bytes around instead of bits. Of course, this entails the
+ * removal of all of the one-bit-pixel dependencies from the other
+ * files, but the major bit-hacking stuff should be covered here.
+ *
+ * I've created some new macros that make it easier to understand what's
+ * going on in the pixel calculations, and that make it easier to change the
+ * pixel size.
+ *
+ * name explanation
+ * ---- -----------
+ * PSZ pixel size (in bits)
+ * PGSZ pixel group size (in bits)
+ * PGSZB pixel group size (in bytes)
+ * PGSZBMSK mask with lowest PGSZB bits set to 1
+ * PPW pixels per word (pixels per pixel group)
+ * PPWMSK mask with lowest PPW bits set to 1
+ * PLST index of last pixel in a word (should be PPW-1)
+ * PIM pixel index mask (index within a pixel group)
+ * PWSH pixel-to-word shift (should be log2(PPW))
+ * PMSK mask with lowest PSZ bits set to 1
+ *
+ *
+ * Here are some sample values. In the notation cfbA,B: A is PSZ, and
+ * B is PGSZB. All the other values are derived from these
+ * two. This table does not show all combinations!
+ *
+ * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8
+ * ---- ------ ------- ------ ------ ------ -------
+ * PSZ 8 24 32 8 24 32
+ * PGSZ 32 32 32 64 64 64
+ * PGSZB 4 4 4 8 8 8
+ * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF
+ * PPW 4 1 1 8 2 2
+ * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3
+ * PLST 3 0 0 7 1 1
+ * PIM 0x3 0x0 0x0 0x7 0x1? 0x1
+ * PWSH 2 0 0 3 1 1
+ * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF
+ *
+ *
+ * I have also added a new macro, PFILL, that takes one pixel and
+ * replicates it throughout a word. This macro definition is dependent
+ * upon pixel and word size; it doesn't use macros like PPW and so
+ * forth. Examples: for monochrome, PFILL(1) => 0xffffffff, PFILL(0) =>
+ * 0x00000000. For 8-bit color, PFILL(0x5d) => 0x5d5d5d5d. This macro
+ * is used primarily for replicating a plane mask into a word.
+ *
+ * Color framebuffers operations also support the notion of a plane
+ * mask. This mask determines which planes of the framebuffer can be
+ * altered; the others are left unchanged. I have added another
+ * parameter to the putbits and putbitsrop macros that is the plane
+ * mask.
+ * ==========================================================================
+ */
+
+/*
+ * PSZ needs to be defined before we get here. Usually it comes from a
+ * -DPSZ=foo on the compilation command line.
+ */
+
+#ifndef PSZ
+#define PSZ 8
+#endif
+
+/*
+ * PixelGroup is the data type used to operate on groups of pixels.
+ * We typedef it here to unsigned long with the assumption that you
+ * want to manipulate as many pixels at a time as you can. If unsigned
+ * long is not appropriate for your server, define it to something else
+ * before including this file. In this case you will also have to define
+ * PGSZB to the size in bytes of PixelGroup.
+ */
+#ifndef PixelGroup
+typedef unsigned long PixelGroup;
+#ifdef LONG64
+#define PGSZB 8
+#else
+#define PGSZB 4
+#endif /* LONG64 */
+#endif /* PixelGroup */
+
+#define PGSZ (PGSZB << 3)
+#define PPW (PGSZ/PSZ)
+#define PLST (PPW-1)
+#define PIM PLST
+#define PMSK (((PixelGroup)1 << PSZ) - 1)
+#define PPWMSK (((PixelGroup)1 << PPW) - 1) /* instead of BITMSK */
+#define PGSZBMSK (((PixelGroup)1 << PGSZB) - 1)
+
+/* set PWSH = log2(PPW) using brute force */
+
+#if PPW == 1
+#define PWSH 0
+#else
+#if PPW == 2
+#define PWSH 1
+#else
+#if PPW == 4
+#define PWSH 2
+#else
+#if PPW == 8
+#define PWSH 3
+#else
+#if PPW == 16
+#define PWSH 4
+#endif /* PPW == 16 */
+#endif /* PPW == 8 */
+#endif /* PPW == 4 */
+#endif /* PPW == 2 */
+#endif /* PPW == 1 */
+
+/* Defining PIXEL_ADDR means that individual pixels are addressable by this
+ * machine (as type PixelType). A possible CFB architecture which supported
+ * 8-bits-per-pixel on a non byte-addressable machine would not have this
+ * defined.
+ *
+ * Defining FOUR_BIT_CODE means that cfb knows how to stipple on this machine;
+ * eventually, stippling code for 16 and 32 bit devices should be written
+ * which would allow them to also use FOUR_BIT_CODE. There isn't that
+ * much to do in those cases, but it would make them quite a bit faster.
+ */
+
+#if PSZ == 8
+#define PIXEL_ADDR
+typedef CARD8 PixelType;
+#define FOUR_BIT_CODE
+#endif
+
+#if PSZ == 16
+#define PIXEL_ADDR
+typedef CARD16 PixelType;
+#endif
+
+#if PSZ == 24
+#undef PMSK
+#define PMSK 0xFFFFFF
+/*#undef PIM
+#define PIM 3*/
+#define PIXEL_ADDR
+typedef CARD32 PixelType;
+#endif
+
+#if PSZ == 32
+#undef PMSK
+#define PMSK 0xFFFFFFFF
+#define PIXEL_ADDR
+typedef CARD32 PixelType;
+#endif
+
+
+/* the following notes use the following conventions:
+SCREEN LEFT SCREEN RIGHT
+in this file and maskbits.c, left and right refer to screen coordinates,
+NOT bit numbering in registers.
+
+cfbstarttab[n]
+ pixels[0,n-1] = 0's pixels[n,PPW-1] = 1's
+cfbendtab[n] =
+ pixels[0,n-1] = 1's pixels[n,PPW-1] = 0's
+
+cfbstartpartial[], cfbendpartial[]
+ these are used as accelerators for doing putbits and masking out
+bits that are all contained between longword boudaries. the extra
+256 bytes of data seems a small price to pay -- code is smaller,
+and narrow things (e.g. window borders) go faster.
+
+the names may seem misleading; they are derived not from which end
+of the word the bits are turned on, but at which end of a scanline
+the table tends to be used.
+
+look at the tables and macros to understand boundary conditions.
+(careful readers will note that starttab[n] = ~endtab[n] for n != 0)
+
+-----------------------------------------------------------------------
+these two macros depend on the screen's bit ordering.
+in both of them x is a screen position. they are used to
+combine bits collected from multiple longwords into a
+single destination longword, and to unpack a single
+source longword into multiple destinations.
+
+SCRLEFT(dst, x)
+ takes dst[x, PPW] and moves them to dst[0, PPW-x]
+ the contents of the rest of dst are 0 ONLY IF
+ dst is UNSIGNED.
+ is cast as an unsigned.
+ this is a right shift on the VAX, left shift on
+ Sun and pc-rt.
+
+SCRRIGHT(dst, x)
+ takes dst[0,x] and moves them to dst[PPW-x, PPW]
+ the contents of the rest of dst are 0 ONLY IF
+ dst is UNSIGNED.
+ this is a left shift on the VAX, right shift on
+ Sun and pc-rt.
+
+
+the remaining macros are cpu-independent; all bit order dependencies
+are built into the tables and the two macros above.
+
+maskbits(x, w, startmask, endmask, nlw)
+ for a span of width w starting at position x, returns
+a mask for ragged pixels at start, mask for ragged pixels at end,
+and the number of whole longwords between the ends.
+
+maskpartialbits(x, w, mask)
+ works like maskbits(), except all the pixels are in the
+ same longword (i.e. (x&0xPIM + w) <= PPW)
+
+mask32bits(x, w, startmask, endmask, nlw)
+ as maskbits, but does not calculate nlw. it is used by
+ cfbGlyphBlt to put down glyphs <= PPW bits wide.
+
+getbits(psrc, x, w, dst)
+ starting at position x in psrc (x < PPW), collect w
+ pixels and put them in the screen left portion of dst.
+ psrc is a longword pointer. this may span longword boundaries.
+ it special-cases fetching all w bits from one longword.
+
+ +--------+--------+ +--------+
+ | | m |n| | ==> | m |n| |
+ +--------+--------+ +--------+
+ x x+w 0 w
+ psrc psrc+1 dst
+ m = PPW - x
+ n = w - m
+
+ implementation:
+ get m pixels, move to screen-left of dst, zeroing rest of dst;
+ get n pixels from next word, move screen-right by m, zeroing
+ lower m pixels of word.
+ OR the two things together.
+
+putbits(src, x, w, pdst, planemask)
+ starting at position x in pdst, put down the screen-leftmost
+ w bits of src. pdst is a longword pointer. this may
+ span longword boundaries.
+ it special-cases putting all w bits into the same longword.
+
+ +--------+ +--------+--------+
+ | m |n| | ==> | | m |n| |
+ +--------+ +--------+--------+
+ 0 w x x+w
+ dst pdst pdst+1
+ m = PPW - x
+ n = w - m
+
+ implementation:
+ get m pixels, shift screen-right by x, zero screen-leftmost x
+ pixels; zero rightmost m bits of *pdst and OR in stuff
+ from before the semicolon.
+ shift src screen-left by m, zero bits n-32;
+ zero leftmost n pixels of *(pdst+1) and OR in the
+ stuff from before the semicolon.
+
+putbitsrop(src, x, w, pdst, planemask, ROP)
+ like putbits but calls DoRop with the rasterop ROP (see cfb.h for
+ DoRop)
+
+getleftbits(psrc, w, dst)
+ get the leftmost w (w<=PPW) bits from *psrc and put them
+ in dst. this is used by the cfbGlyphBlt code for glyphs
+ <=PPW bits wide.
+*/
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define BitRight(lw,n) ((lw) >> (n))
+#define BitLeft(lw,n) ((lw) << (n))
+#else /* (BITMAP_BIT_ORDER == LSBFirst) */
+#define BitRight(lw,n) ((lw) << (n))
+#define BitLeft(lw,n) ((lw) >> (n))
+#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
+
+#define SCRLEFT(lw, n) BitLeft (lw, (n) * PSZ)
+#define SCRRIGHT(lw, n) BitRight(lw, (n) * PSZ)
+
+/*
+ * Note that the shift direction is independent of the byte ordering of the
+ * machine. The following is portable code.
+ */
+#if PPW == 16
+#define PFILL(p) ( ((p)&PMSK) | \
+ ((p)&PMSK) << PSZ | \
+ ((p)&PMSK) << 2*PSZ | \
+ ((p)&PMSK) << 3*PSZ | \
+ ((p)&PMSK) << 4*PSZ | \
+ ((p)&PMSK) << 5*PSZ | \
+ ((p)&PMSK) << 6*PSZ | \
+ ((p)&PMSK) << 7*PSZ | \
+ ((p)&PMSK) << 8*PSZ | \
+ ((p)&PMSK) << 9*PSZ | \
+ ((p)&PMSK) << 10*PSZ | \
+ ((p)&PMSK) << 11*PSZ | \
+ ((p)&PMSK) << 12*PSZ | \
+ ((p)&PMSK) << 13*PSZ | \
+ ((p)&PMSK) << 14*PSZ | \
+ ((p)&PMSK) << 15*PSZ )
+#define PFILL2(p, pf) { \
+ pf = (p) & PMSK; \
+ pf |= (pf << PSZ); \
+ pf |= (pf << 2*PSZ); \
+ pf |= (pf << 4*PSZ); \
+ pf |= (pf << 8*PSZ); \
+}
+#endif /* PPW == 16 */
+#if PPW == 8
+#define PFILL(p) ( ((p)&PMSK) | \
+ ((p)&PMSK) << PSZ | \
+ ((p)&PMSK) << 2*PSZ | \
+ ((p)&PMSK) << 3*PSZ | \
+ ((p)&PMSK) << 4*PSZ | \
+ ((p)&PMSK) << 5*PSZ | \
+ ((p)&PMSK) << 6*PSZ | \
+ ((p)&PMSK) << 7*PSZ )
+#define PFILL2(p, pf) { \
+ pf = (p) & PMSK; \
+ pf |= (pf << PSZ); \
+ pf |= (pf << 2*PSZ); \
+ pf |= (pf << 4*PSZ); \
+}
+#endif
+#if PPW == 4
+#define PFILL(p) ( ((p)&PMSK) | \
+ ((p)&PMSK) << PSZ | \
+ ((p)&PMSK) << 2*PSZ | \
+ ((p)&PMSK) << 3*PSZ )
+#define PFILL2(p, pf) { \
+ pf = (p) & PMSK; \
+ pf |= (pf << PSZ); \
+ pf |= (pf << 2*PSZ); \
+}
+#endif
+#if PPW == 2
+#define PFILL(p) ( ((p)&PMSK) | \
+ ((p)&PMSK) << PSZ )
+#define PFILL2(p, pf) { \
+ pf = (p) & PMSK; \
+ pf |= (pf << PSZ); \
+}
+#endif
+#if PPW == 1
+#define PFILL(p) (p)
+#define PFILL2(p,pf) (pf = (p))
+#endif
+
+/*
+ * Reduced raster op - using precomputed values, perform the above
+ * in three instructions
+ */
+
+#define DoRRop(dst, and, xor) (((dst) & (and)) ^ (xor))
+
+#define DoMaskRRop(dst, and, xor, mask) \
+ (((dst) & ((and) | ~(mask))) ^ (xor & mask))
+
+#if PSZ != 32 || PPW != 1
+
+# if (PSZ == 24 && PPW == 1)
+#define maskbits(x, w, startmask, endmask, nlw) {\
+ startmask = cfbstarttab[(x)&3]; \
+ endmask = cfbendtab[((x)+(w)) & 3]; \
+ nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \
+}
+
+#define mask32bits(x, w, startmask, endmask) \
+ startmask = cfbstarttab[(x)&3]; \
+ endmask = cfbendtab[((x)+(w)) & 3];
+
+#define maskpartialbits(x, w, mask) \
+ mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3];
+
+#define maskbits24(x, w, startmask, endmask, nlw) \
+ startmask = cfbstarttab24[(x) & 3]; \
+ endmask = cfbendtab24[((x)+(w)) & 3]; \
+ if (startmask){ \
+ nlw = (((w) - (4 - ((x) & 3))) >> 2); \
+ } else { \
+ nlw = (w) >> 2; \
+ }
+
+#define getbits24(psrc, dst, index) {\
+ register int idx; \
+ switch(idx = ((index)&3)<<1){ \
+ case 0: \
+ dst = (*(psrc) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \
+ BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+}
+
+#define putbits24(src, x, w, pdst, planemask, index) {\
+ register PixelGroup dstpixel; \
+ register unsigned int idx; \
+ switch(idx = ((index)&3)<<1){ \
+ case 0: \
+ dstpixel = (*(pdst) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
+ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+ dstpixel &= ~(planemask); \
+ dstpixel |= (src & planemask); \
+ *(pdst) &= cfbrmask[idx]; \
+ switch(idx){ \
+ case 0: \
+ *(pdst) |= (dstpixel & cfbmask[idx]); \
+ break; \
+ case 2: \
+ case 4: \
+ pdst++;idx++; \
+ *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \
+ (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ pdst--;idx--; \
+ case 6: \
+ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ break; \
+ }; \
+}
+
+#define putbitsrop24(src, x, pdst, planemask, rop) \
+{ \
+ register PixelGroup t1, dstpixel; \
+ register unsigned int idx; \
+ switch(idx = (x)<<1){ \
+ case 0: \
+ dstpixel = (*(pdst) &cfbmask[idx]); \
+ break; \
+ case 6: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
+ break; \
+ default: \
+ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
+ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
+ }; \
+ DoRop(t1, rop, (src), dstpixel); \
+ dstpixel &= ~planemask; \
+ dstpixel |= (t1 & planemask); \
+ *(pdst) &= cfbrmask[idx]; \
+ switch(idx){ \
+ case 0: \
+ *(pdst) |= (dstpixel & cfbmask[idx]); \
+ break; \
+ case 2: \
+ case 4: \
+ *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \
+ (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \
+ case 6: \
+ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
+ }; \
+}
+# else /* PSZ == 24 && PPW == 1 */
+#define maskbits(x, w, startmask, endmask, nlw) \
+ startmask = cfbstarttab[(x)&PIM]; \
+ endmask = cfbendtab[((x)+(w)) & PIM]; \
+ if (startmask) \
+ nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \
+ else \
+ nlw = (w) >> PWSH;
+
+#define maskpartialbits(x, w, mask) \
+ mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM];
+
+#define mask32bits(x, w, startmask, endmask) \
+ startmask = cfbstarttab[(x)&PIM]; \
+ endmask = cfbendtab[((x)+(w)) & PIM];
+
+/* FIXME */
+#define maskbits24(x, w, startmask, endmask, nlw) \
+ abort()
+#define getbits24(psrc, dst, index) \
+ abort()
+#define putbits24(src, x, w, pdst, planemask, index) \
+ abort()
+#define putbitsrop24(src, x, pdst, planemask, rop) \
+ abort()
+
+#endif /* PSZ == 24 && PPW == 1 */
+
+#define getbits(psrc, x, w, dst) \
+if ( ((x) + (w)) <= PPW) \
+{ \
+ dst = SCRLEFT(*(psrc), (x)); \
+} \
+else \
+{ \
+ int m; \
+ m = PPW-(x); \
+ dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \
+ (SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \
+}
+
+
+#define putbits(src, x, w, pdst, planemask) \
+if ( ((x)+(w)) <= PPW) \
+{ \
+ PixelGroup tmpmask; \
+ maskpartialbits((x), (w), tmpmask); \
+ tmpmask &= PFILL(planemask); \
+ *(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \
+} \
+else \
+{ \
+ unsigned long m; \
+ unsigned long n; \
+ PixelGroup pm = PFILL(planemask); \
+ m = PPW-(x); \
+ n = (w) - m; \
+ *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \
+ (SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \
+ *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
+ (SCRLEFT(src, m) & (cfbendtab[n] & pm)); \
+}
+#if defined(__GNUC__) && defined(mc68020)
+#undef getbits
+#define FASTGETBITS(psrc, x, w, dst) \
+ asm ("bfextu %3{%1:%2},%0" \
+ : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
+
+#define getbits(psrc,x,w,dst) \
+{ \
+ FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \
+ dst = SCRLEFT(dst,PPW-(w)); \
+}
+
+#define FASTPUTBITS(src, x, w, pdst) \
+ asm ("bfins %3,%0{%1:%2}" \
+ : "=o" (*(char *)(pdst)) \
+ : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
+
+#undef putbits
+#define putbits(src, x, w, pdst, planemask) \
+{ \
+ if (planemask != PMSK) { \
+ PixelGroup _m, _pm; \
+ FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \
+ PFILL2(planemask, _pm); \
+ _m &= (~_pm); \
+ _m |= (SCRRIGHT(src, PPW-(w)) & _pm); \
+ FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \
+ } else { \
+ FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \
+ } \
+}
+
+
+#endif /* mc68020 */
+
+#define putbitsrop(src, x, w, pdst, planemask, rop) \
+if ( ((x)+(w)) <= PPW) \
+{ \
+ PixelGroup tmpmask; \
+ PixelGroup t1, t2; \
+ maskpartialbits((x), (w), tmpmask); \
+ PFILL2(planemask, t1); \
+ tmpmask &= t1; \
+ t1 = SCRRIGHT((src), (x)); \
+ DoRop(t2, rop, t1, *(pdst)); \
+ *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
+} \
+else \
+{ \
+ unsigned long m; \
+ unsigned long n; \
+ PixelGroup t1, t2; \
+ PixelGroup pm; \
+ PFILL2(planemask, pm); \
+ m = PPW-(x); \
+ n = (w) - m; \
+ t1 = SCRRIGHT((src), (x)); \
+ DoRop(t2, rop, t1, *(pdst)); \
+ *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\
+ t1 = SCRLEFT((src), m); \
+ DoRop(t2, rop, t1, *((pdst) + 1)); \
+ *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
+ (t2 & (cfbendtab[n] & pm)); \
+}
+
+#else /* PSZ == 32 && PPW == 1*/
+
+/*
+ * These macros can be optimized for 32-bit pixels since there is no
+ * need to worry about left/right edge masking. These macros were
+ * derived from the above using the following reductions:
+ *
+ * - x & PIW = 0 [since PIW = 0]
+ * - all masking tables are only indexed by 0 [ due to above ]
+ * - cfbstartab[0] and cfbendtab[0] = 0 [ no left/right edge masks]
+ * - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask]
+ *
+ * Macro reduction based upon constants cannot be performed automatically
+ * by the compiler since it does not know the contents of the masking
+ * arrays in cfbmskbits.c.
+ */
+#define maskbits(x, w, startmask, endmask, nlw) \
+ startmask = endmask = 0; \
+ nlw = (w);
+
+#define maskpartialbits(x, w, mask) \
+ mask = 0xFFFFFFFF;
+
+#define mask32bits(x, w, startmask, endmask) \
+ startmask = endmask = 0;
+
+/*
+ * For 32-bit operations, getbits(), putbits(), and putbitsrop()
+ * will only be invoked with x = 0 and w = PPW (1). The getbits()
+ * macro is only called within left/right edge logic, which doesn't
+ * happen for 32-bit pixels.
+ */
+#define getbits(psrc, x, w, dst) (dst) = *(psrc)
+
+#define putbits(src, x, w, pdst, planemask) \
+ *(pdst) = (*(pdst) & ~planemask) | (src & planemask);
+
+#define putbitsrop(src, x, w, pdst, planemask, rop) \
+{ \
+ PixelGroup t1; \
+ DoRop(t1, rop, (src), *(pdst)); \
+ *(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \
+}
+
+#endif /* PSZ != 32 */
+
+/*
+ * Use these macros only when you're using the MergeRop stuff
+ * in ../mfb/mergerop.h
+ */
+
+/* useful only when not spanning destination longwords */
+#if PSZ == 24
+#define putbitsmropshort24(src,x,w,pdst,index) {\
+ PixelGroup _tmpmask; \
+ PixelGroup _t1; \
+ maskpartialbits ((x), (w), _tmpmask); \
+ _t1 = SCRRIGHT((src), (x)); \
+ DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \
+}
+#endif
+#define putbitsmropshort(src,x,w,pdst) {\
+ PixelGroup _tmpmask; \
+ PixelGroup _t1; \
+ maskpartialbits ((x), (w), _tmpmask); \
+ _t1 = SCRRIGHT((src), (x)); \
+ *pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \
+}
+
+/* useful only when spanning destination longwords */
+#define putbitsmroplong(src,x,w,pdst) { \
+ PixelGroup _startmask, _endmask; \
+ int _m; \
+ PixelGroup _t1; \
+ _m = PPW - (x); \
+ _startmask = cfbstarttab[x]; \
+ _endmask = cfbendtab[(w) - _m]; \
+ _t1 = SCRRIGHT((src), (x)); \
+ pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \
+ _t1 = SCRLEFT ((src),_m); \
+ pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \
+}
+
+#define putbitsmrop(src,x,w,pdst) \
+if ((x) + (w) <= PPW) {\
+ putbitsmropshort(src,x,w,pdst); \
+} else { \
+ putbitsmroplong(src,x,w,pdst); \
+}
+
+#if GETLEFTBITS_ALIGNMENT == 1
+#define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc)
+#define getleftbits24(psrc, w, dst, idx){ \
+ regiseter int index; \
+ switch(index = ((idx)&3)<<1){ \
+ case 0: \
+ dst = (*((unsigned int *) psrc))&cfbmask[index]; \
+ break; \
+ case 2: \
+ case 4: \
+ dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \
+ dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \
+ break; \
+ case 6: \
+ dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \
+ break; \
+ }; \
+}
+#endif /* GETLEFTBITS_ALIGNMENT == 1 */
+
+#define getglyphbits(psrc, x, w, dst) \
+{ \
+ dst = BitLeft((unsigned) *(psrc), (x)); \
+ if ( ((x) + (w)) > 32) \
+ dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \
+}
+#if GETLEFTBITS_ALIGNMENT == 2
+#define getleftbits(psrc, w, dst) \
+ { \
+ if ( ((int)(psrc)) & 0x01 ) \
+ getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
+ else \
+ dst = *((unsigned int *) psrc); \
+ }
+#endif /* GETLEFTBITS_ALIGNMENT == 2 */
+
+#if GETLEFTBITS_ALIGNMENT == 4
+#define getleftbits(psrc, w, dst) \
+ { \
+ int off, off_b; \
+ off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
+ getglyphbits( \
+ (unsigned int *)( ((char *)(psrc)) - off), \
+ (off_b), (w), (dst) \
+ ); \
+ }
+#endif /* GETLEFTBITS_ALIGNMENT == 4 */
+
+/*
+ * getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix )
+ *
+ * Converts bits to pixels in a reasonable way. Takes w (1 <= w <= PPW)
+ * bits from *psrcstip, starting at bit x; call this a quartet of bits.
+ * Then, takes the pixels from *psrcpix corresponding to the one-bits (if
+ * ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet
+ * and puts these pixels into destpix.
+ *
+ * Example:
+ *
+ * getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest )
+ *
+ * 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011
+ *
+ * This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101.
+ * It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this
+ * quartet, so dest = 0x005D007F.
+ *
+ * XXX Works with both byte order.
+ * XXX This works for all values of x and w within a doubleword.
+ */
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \
+{ \
+ PixelGroup q; \
+ int m; \
+ if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \
+ q = (*(psrcstip)) << m; \
+ if ( (x)+(w) > (PPW*PSZ) ) \
+ q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \
+ } \
+ else \
+ q = (*(psrcstip)) >> -m; \
+ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
+/* I just copied this to get the linker satisfied on PowerPC,
+ * so this may not be correct at all.
+ */
+#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
+{ \
+ PixelGroup q, srcpix, srcstip; \
+ unsigned long src; \
+ register unsigned int stipidx; \
+ q = *(psrcstip) >> (xt); \
+ q = ((ones) ? q : ~q) & 1; \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
+#else /* BITMAP_BIT_ORDER == LSB */
+#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \
+{ \
+ PixelGroup q; \
+ q = ldq_u(psrcstip) >> (xt); \
+ if ( ((xt)+(w)) > (PPW*PSZ) ) \
+ q |= (ldq_u((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \
+ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
+#if PSZ == 24
+# if 0
+#define getstipplepixels24( psrcstip,xt,w,ones,psrcpix,destpix,stipindex,srcindex,dstindex) \
+{ \
+ PixelGroup q, srcpix, srcstip; \
+ unsigned long src; \
+ register unsigned int sidx; \
+ register unsigned int didx; \
+ register unsigned int stipidx; \
+ sidx = ((srcindex) & 3)<<1; \
+ didx = ((dstindex) & 3)<<1; \
+ q = *(psrcstip) >> (xt); \
+/* if((srcindex)!=0)*/ \
+/* src = (((*(psrcpix)) << cfb24Shift[sidx]) & (cfbmask[sidx])) |*/ \
+/* (((*((psrcpix)+1)) << cfb24Shift[sidx+1]) & (cfbmask[sidx+1])); */\
+/* else */\
+ src = (*(psrcpix))&0xFFFFFF; \
+ if ( ((xt)+(w)) > PGSZ ) \
+ q |= (*((psrcstip)+1)) << (PGSZ -(xt)); \
+ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
+ src &= QuartetPixelMaskTable[q]; \
+ *(destpix) &= cfbrmask[didx]; \
+ switch(didx) {\
+ case 0: \
+ *(destpix) |= (src &cfbmask[didx]); \
+ break; \
+ case 2: \
+ case 4: \
+ destpix++;didx++; \
+ *(destpix) = ((*(destpix)) & (cfbrmask[didx]))| \
+ (BitLeft(src, cfb24Shift[didx]) & (cfbmask[didx])); \
+ destpix--; didx--;\
+ case 6: \
+ *(destpix) |= (BitRight(src, cfb24Shift[didx]) & cfbmask[didx]); \
+ break; \
+ }; \
+}
+# else
+#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
+{ \
+ PixelGroup q, srcpix, srcstip; \
+ unsigned long src; \
+ register unsigned int stipidx; \
+ q = *(psrcstip) >> (xt); \
+ q = ((ones) ? q : ~q) & 1; \
+ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
+}
+# endif
+#endif /* PSZ == 24 */
+#endif
+
+extern PixelGroup cfbstarttab[];
+extern PixelGroup cfbendtab[];
+extern PixelGroup cfbstartpartial[];
+extern PixelGroup cfbendpartial[];
+extern PixelGroup cfbrmask[];
+extern PixelGroup cfbmask[];
+extern PixelGroup QuartetBitsTable[];
+extern PixelGroup QuartetPixelMaskTable[];
+#if PSZ == 24
+extern int cfb24Shift[];
+#endif
diff --git a/xc/programs/Xserver/cfb/cfbpixmap.c b/xc/programs/Xserver/cfb/cfbpixmap.c
new file mode 100644
index 000000000..71099be76
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbpixmap.c
@@ -0,0 +1,366 @@
+/* $TOG: cfbpixmap.c /main/34 1998/02/09 14:06:38 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* pixmap management
+ written by drewry, september 1986
+
+ on a monchrome device, a pixmap is a bitmap.
+*/
+
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "mi.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+extern unsigned long endtab[];
+
+PixmapPtr
+cfbCreatePixmap (pScreen, width, height, depth)
+ ScreenPtr pScreen;
+ int width;
+ int height;
+ int depth;
+{
+ PixmapPtr pPixmap;
+ int datasize;
+ int paddedWidth;
+
+ paddedWidth = PixmapBytePad(width, depth);
+ datasize = height * paddedWidth;
+ pPixmap = AllocatePixmap(pScreen, datasize);
+ if (!pPixmap)
+ return NullPixmap;
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = paddedWidth;
+ pPixmap->refcnt = 1;
+#ifdef PIXPRIV
+ pPixmap->devPrivate.ptr = datasize ?
+ (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
+#else
+ pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
+#endif
+ return pPixmap;
+}
+
+Bool
+cfbDestroyPixmap(pPixmap)
+ PixmapPtr pPixmap;
+{
+ if(--pPixmap->refcnt)
+ return TRUE;
+ xfree(pPixmap);
+ return TRUE;
+}
+
+PixmapPtr
+cfbCopyPixmap(pSrc)
+ register PixmapPtr pSrc;
+{
+ register PixmapPtr pDst;
+ int size;
+ ScreenPtr pScreen;
+
+ size = pSrc->drawable.height * pSrc->devKind;
+ pScreen = pSrc->drawable.pScreen;
+ pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width,
+ pSrc->drawable.height, pSrc->drawable.depth);
+ if (!pDst)
+ return NullPixmap;
+ memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
+ return pDst;
+}
+
+
+/* replicates a pattern to be a full 32 bits wide.
+ relies on the fact that each scnaline is longword padded.
+ doesn't do anything if pixmap is not a factor of 32 wide.
+ changes width field of pixmap if successful, so that the fast
+ cfbXRotatePixmap code gets used if we rotate the pixmap later.
+ cfbYRotatePixmap code gets used if we rotate the pixmap later.
+
+ calculate number of times to repeat
+ for each scanline of pattern
+ zero out area to be filled with replicate
+ left shift and or in original as many times as needed
+*/
+void
+cfbPadPixmap(pPixmap)
+ PixmapPtr pPixmap;
+{
+ register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel);
+ register int h;
+ register unsigned long mask;
+ register unsigned long *p;
+ register unsigned long bits; /* real pattern bits */
+ register int i;
+ int rep; /* repeat count for pattern */
+
+ if (width >= PGSZ)
+ return;
+
+ rep = PGSZ/width;
+ if (rep*width != PGSZ)
+ return;
+
+ mask = endtab[width];
+
+ p = (unsigned long *)(pPixmap->devPrivate.ptr);
+ for (h=0; h < pPixmap->drawable.height; h++)
+ {
+ *p &= mask;
+ bits = *p;
+ for(i=1; i<rep; i++)
+ {
+#if (BITMAP_BIT_ORDER == MSBFirst)
+ bits >>= width;
+#else
+ bits <<= width;
+#endif
+ *p |= bits;
+ }
+ p++;
+ }
+ pPixmap->drawable.width = PGSZ/(pPixmap->drawable.bitsPerPixel);
+}
+
+
+#ifdef notdef
+/*
+ * cfb debugging routine -- assumes pixmap is 1 byte deep
+ */
+static cfbdumppixmap(pPix)
+ PixmapPtr pPix;
+{
+ unsigned int *pw;
+ char *psrc, *pdst;
+ int i, j;
+ char line[66];
+
+ ErrorF( "pPixmap: 0x%x\n", pPix);
+ ErrorF( "%d wide %d high\n", pPix->drawable.width, pPix->drawable.height);
+ if (pPix->drawable.width > 64)
+ {
+ ErrorF( "too wide to see\n");
+ return;
+ }
+
+ pw = (unsigned int *) pPix->devPrivate.ptr;
+ psrc = (char *) pw;
+
+/*
+ for ( i=0; i<pPix->drawable.height; ++i )
+ ErrorF( "0x%x\n", pw[i] );
+*/
+
+ for ( i = 0; i < pPix->drawable.height; ++i ) {
+ pdst = line;
+ for(j = 0; j < pPix->drawable.width; j++) {
+ *pdst++ = *psrc++ ? 'X' : ' ' ;
+ }
+ *pdst++ = '\n';
+ *pdst++ = '\0';
+ ErrorF( "%s", line);
+ }
+}
+#endif /* notdef */
+
+/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
+ * words are PGSZ bits wide, and that the least significant bit appears on the
+ * left.
+ */
+void
+cfbXRotatePixmap(pPix, rw)
+ PixmapPtr pPix;
+ register int rw;
+{
+ register unsigned long *pw, *pwFinal;
+ register unsigned long t;
+ int rot;
+
+ if (pPix == NullPixmap)
+ return;
+
+ switch (((DrawablePtr) pPix)->bitsPerPixel) {
+ case PSZ:
+ break;
+ case 1:
+ mfbXRotatePixmap(pPix, rw);
+ return;
+ default:
+ ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
+ return;
+ }
+ pw = (unsigned long *)pPix->devPrivate.ptr;
+ modulus (rw, (int) pPix->drawable.width, rot);
+ if(pPix->drawable.width == PPW)
+ {
+ pwFinal = pw + pPix->drawable.height;
+ while(pw < pwFinal)
+ {
+ t = *pw;
+ *pw++ = SCRRIGHT(t, rot) |
+ (SCRLEFT(t, (PPW-rot)) & cfbendtab[rot]);
+ }
+ }
+ else
+ {
+ ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n");
+#ifdef notdef
+ register unsigned long *pwTmp;
+ int size, tsize;
+
+ tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
+ pwTmp = (unsigned long *) ALLOCATE_LOCAL(pPix->drawable.height * tsize);
+ if (!pwTmp)
+ return;
+ /* divide pw (the pixmap) in two vertically at (w - rot) and swap */
+ tsize >>= 2;
+ size = pPix->devKind >> SIZE0F(PixelGroup);
+ cfbQuickBlt((long *)pw, (long *)pwTmp,
+ 0, 0, 0, 0,
+ (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
+ size, tsize);
+ cfbQuickBlt((long *)pw, (long *)pw,
+ (int)pPix->drawable.width - rot, 0, 0, 0,
+ rot, (int)pPix->drawable.height,
+ size, size);
+ cfbQuickBlt((long *)pwTmp, (long *)pw,
+ 0, 0, rot, 0,
+ (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
+ tsize, size);
+ DEALLOCATE_LOCAL(pwTmp);
+#endif
+ }
+}
+
+/* Rotates pixmap pPix by h lines. Assumes that h is always less than
+ pPix->drawable.height
+ works on any width.
+ */
+void
+cfbYRotatePixmap(pPix, rh)
+ register PixmapPtr pPix;
+ int rh;
+{
+ int nbyDown; /* bytes to move down to row 0; also offset of
+ row rh */
+ int nbyUp; /* bytes to move up to line rh; also
+ offset of first line moved down to 0 */
+ char *pbase;
+ char *ptmp;
+ int rot;
+
+ if (pPix == NullPixmap)
+ return;
+ switch (((DrawablePtr) pPix)->bitsPerPixel) {
+ case PSZ:
+ break;
+ case 1:
+ mfbYRotatePixmap(pPix, rh);
+ return;
+ default:
+ ErrorF("cfbYRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
+ return;
+ }
+
+ modulus (rh, (int) pPix->drawable.height, rot);
+ pbase = (char *)pPix->devPrivate.ptr;
+
+ nbyDown = rot * pPix->devKind;
+ nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown;
+ if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
+ return;
+
+ memmove(ptmp, pbase, nbyUp); /* save the low rows */
+ memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
+ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */
+ DEALLOCATE_LOCAL(ptmp);
+}
+
+void
+cfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
+ register PixmapPtr psrcPix, *ppdstPix;
+ int xrot, yrot;
+{
+ register PixmapPtr pdstPix;
+
+ if ((pdstPix = *ppdstPix) &&
+ (pdstPix->devKind == psrcPix->devKind) &&
+ (pdstPix->drawable.height == psrcPix->drawable.height))
+ {
+ memmove((char *)pdstPix->devPrivate.ptr,
+ (char *)psrcPix->devPrivate.ptr,
+ psrcPix->drawable.height * psrcPix->devKind);
+ pdstPix->drawable.width = psrcPix->drawable.width;
+ pdstPix->drawable.depth = psrcPix->drawable.depth;
+ pdstPix->drawable.bitsPerPixel = psrcPix->drawable.bitsPerPixel;
+ pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ else
+ {
+ if (pdstPix)
+ /* FIX XBUG 6168 */
+ (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
+ *ppdstPix = pdstPix = cfbCopyPixmap(psrcPix);
+ if (!pdstPix)
+ return;
+ }
+ cfbPadPixmap(pdstPix);
+ if (xrot)
+ cfbXRotatePixmap(pdstPix, xrot);
+ if (yrot)
+ cfbYRotatePixmap(pdstPix, yrot);
+}
diff --git a/xc/programs/Xserver/cfb/cfbply1rct.c b/xc/programs/Xserver/cfb/cfbply1rct.c
new file mode 100644
index 000000000..29f6e0d79
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbply1rct.c
@@ -0,0 +1,347 @@
+/*
+ * $TOG: cfbply1rct.c /main/17 1998/02/09 14:06:45 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbply1rct.c,v 3.5 1998/10/04 09:37:47 dawes Exp $ */
+
+#include "X.h"
+
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "mistruct.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfbrrop.h"
+
+void
+RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int shape;
+ int mode;
+ int count;
+ DDXPointPtr ptsIn;
+{
+ cfbPrivGCPtr devPriv;
+ int nwidth;
+ unsigned long *addrl, *addr;
+#if PSZ == 24
+ unsigned long startmask, endmask;
+ register int pidx;
+#endif
+ int maxy;
+ int origin;
+ register int vertex1, vertex2;
+ int c;
+ BoxPtr extents;
+ int clip;
+ int y;
+ int *vertex1p, *vertex2p;
+ int *endp;
+ int x1, x2;
+ int dx1, dx2;
+ int dy1, dy2;
+ int e1, e2;
+ int step1, step2;
+ int sign1, sign2;
+ int h;
+ int l, r;
+ unsigned long mask, bits = ~((unsigned long)0);
+ int nmiddle;
+ RROP_DECLARE
+
+ if (mode == CoordModePrevious)
+ {
+ miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ devPriv = cfbGetGCPrivate(pGC);
+#ifdef NO_ONE_RECT
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
+ {
+ miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+#endif
+ origin = *((int *) &pDrawable->x);
+ vertex2 = origin - ((origin & 0x8000) << 1);
+ extents = &pGC->pCompositeClip->extents;
+ RROP_FETCH_GCPRIV(devPriv);
+ vertex1 = *((int *) &extents->x1) - vertex2;
+ vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
+ clip = 0;
+ y = 32767;
+ maxy = 0;
+ vertex2p = (int *) ptsIn;
+ endp = vertex2p + count;
+ if (shape == Convex)
+ {
+ while (count--)
+ {
+ c = *vertex2p;
+ clip |= (c - vertex1) | (vertex2 - c);
+ c = intToY(c);
+ if (c < y)
+ {
+ y = c;
+ vertex1p = vertex2p;
+ }
+ vertex2p++;
+ if (c > maxy)
+ maxy = c;
+ }
+ }
+ else
+ {
+ int yFlip = 0;
+ dx1 = 1;
+ x2 = -1;
+ x1 = -1;
+ while (count--)
+ {
+ c = *vertex2p;
+ clip |= (c - vertex1) | (vertex2 - c);
+ c = intToY(c);
+ if (c < y)
+ {
+ y = c;
+ vertex1p = vertex2p;
+ }
+ vertex2p++;
+ if (c > maxy)
+ maxy = c;
+ if (c == x1)
+ continue;
+ if (dx1 > 0)
+ {
+ if (x2 < 0)
+ x2 = c;
+ else
+ dx2 = dx1 = (c - x1) >> 31;
+ }
+ else
+ if ((c - x1) >> 31 != dx1)
+ {
+ dx1 = ~dx1;
+ yFlip++;
+ }
+ x1 = c;
+ }
+ x1 = (x2 - c) >> 31;
+ if (x1 != dx1)
+ yFlip++;
+ if (x1 != dx2)
+ yFlip++;
+ if (yFlip != 2)
+ clip = 0x8000;
+ }
+ if (y == maxy)
+ return;
+
+ if (clip & 0x80008000)
+ {
+ miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
+ return;
+ }
+
+#define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth)
+
+ cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long);
+ addrl = AddrYPlus(addrl,y + pDrawable->y);
+ origin = intToX(origin);
+ vertex2p = vertex1p;
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
+ x = intToX(vertex); \
+ if (dy = intToY(c) - y) { \
+ dx = intToX(c) - x; \
+ step = 0; \
+ if (dx >= 0) \
+ { \
+ e = 0; \
+ sign = 1; \
+ if (dx >= dy) {\
+ step = dx / dy; \
+ dx = dx % dy; \
+ } \
+ } \
+ else \
+ { \
+ e = 1 - dy; \
+ sign = -1; \
+ dx = -dx; \
+ if (dx >= dy) { \
+ step = - (dx / dy); \
+ dx = dx % dy; \
+ } \
+ } \
+ } \
+ x += origin; \
+ vertex = c; \
+}
+
+#define Step(x,dx,dy,e,sign,step) {\
+ x += step; \
+ if ((e += dx) > 0) \
+ { \
+ x += sign; \
+ e -= dy; \
+ } \
+}
+ for (;;)
+ {
+ if (y == intToY(vertex1))
+ {
+ do
+ {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ }
+ else
+ {
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2))
+ {
+ do
+ {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ }
+ else
+ {
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+ /* fill spans for this segment */
+ y += h;
+ for (;;)
+ {
+ l = x1;
+ r = x2;
+ nmiddle = x2 - x1;
+ if (nmiddle < 0)
+ {
+ nmiddle = -nmiddle;
+ l = x2;
+ r = x1;
+ }
+#if PPW > 1
+ c = l & PIM;
+ l -= c;
+#endif
+
+#if PGSZ == 32
+#define LWRD_SHIFT 2
+#else /* PGSZ == 64 */
+#define LWRD_SHIFT 3
+#endif /* PGSZ */
+
+#if PSZ == 24
+ addr = (unsigned long *)((char *)addrl + ((l * 3) & ~0x03));
+#else /* PSZ == 24 */
+#if PWSH > LWRD_SHIFT
+ l = l >> (PWSH - LWRD_SHIFT);
+#endif
+#if PWSH < LWRD_SHIFT
+ l = l << (LWRD_SHIFT - PWSH);
+#endif
+ addr = (unsigned long *) (((char *) addrl) + l);
+#endif /* PSZ == 24 */
+#if PSZ == 24
+ if (nmiddle <= 1){
+ if (nmiddle)
+ RROP_SOLID24(addr, l);
+ } else {
+ maskbits(l, nmiddle, startmask, endmask, nmiddle);
+ pidx = l & 3;
+ if (startmask){
+ RROP_SOLID_MASK(addr, startmask, pidx-1);
+ addr++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ while (--nmiddle >= 0){
+ RROP_SOLID(addr, pidx);
+ addr++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addr, endmask, pidx);
+ }
+#else /* PSZ == 24 */
+#if PPW > 1
+ if (c + nmiddle < PPW)
+ {
+ mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
+ RROP_SOLID_MASK(addr,mask);
+ }
+ else
+ {
+ if (c)
+ {
+ mask = SCRRIGHT(bits, c);
+ RROP_SOLID_MASK(addr,mask);
+ nmiddle += c - PPW;
+ addr++;
+ }
+#endif
+ nmiddle >>= PWSH;
+ while (--nmiddle >= 0) {
+ RROP_SOLID(addr); addr++;
+ }
+#if PPW > 1
+ if (mask = ~SCRRIGHT(bits, r & PIM))
+ RROP_SOLID_MASK(addr,mask);
+ }
+#endif
+#endif /* PSZ == 24 */
+ if (!--h)
+ break;
+ addrl = AddrYPlus (addrl, 1);
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ if (y == maxy)
+ break;
+ addrl = AddrYPlus (addrl, 1);
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbpntwin.c b/xc/programs/Xserver/cfb/cfbpntwin.c
new file mode 100644
index 000000000..410c7c61c
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbpntwin.c
@@ -0,0 +1,734 @@
+/* $TOG: cfbpntwin.c /main/26 1998/02/09 14:06:51 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbpntwin.c,v 3.2 1999/05/15 06:24:50 dawes Exp $ */
+
+#include "X.h"
+
+#include "windowstr.h"
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "mi.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+void
+cfbPaintWindow(pWin, pRegion, what)
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ int what;
+{
+ register cfbPrivWin *pPrivWin;
+ WindowPtr pBgWin;
+
+ pPrivWin = cfbGetWindowPrivate(pWin);
+
+
+ switch (what) {
+ case PW_BACKGROUND:
+ switch (pWin->backgroundState) {
+ case None:
+ break;
+ case ParentRelative:
+ do {
+ pWin = pWin->parent;
+ } while (pWin->backgroundState == ParentRelative);
+ (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
+ what);
+ break;
+ case BackgroundPixmap:
+ if (pPrivWin->fastBackground)
+ {
+ cfbFillBoxTile32 ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pPrivWin->pRotatedBackground);
+ }
+ else
+ {
+ int xorg = pWin->drawable.x;
+ int yorg = pWin->drawable.y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int index = pWin->drawable.pScreen->myNum;
+ if(WindowTable[index] == pWin) {
+ xorg -= panoramiXdataPtr[index].x;
+ yorg -= panoramiXdataPtr[index].y;
+ }
+ }
+#endif
+ cfbFillBoxTileOdd ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->background.pixmap,
+ xorg, yorg);
+ }
+ break;
+ case BackgroundPixel:
+ cfbFillBoxSolid ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->background.pixel);
+ break;
+ }
+ break;
+ case PW_BORDER:
+ if (pWin->borderIsPixel)
+ {
+ cfbFillBoxSolid ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->border.pixel);
+ }
+ else if (pPrivWin->fastBorder)
+ {
+ cfbFillBoxTile32 ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pPrivWin->pRotatedBorder);
+ }
+ else
+ {
+ int xorg, yorg;
+
+ for (pBgWin = pWin;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+
+ xorg = pBgWin->drawable.x;
+ yorg = pBgWin->drawable.y;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int index = pWin->drawable.pScreen->myNum;
+ if(WindowTable[index] == pBgWin) {
+ xorg -= panoramiXdataPtr[index].x;
+ yorg -= panoramiXdataPtr[index].y;
+ }
+ }
+#endif
+
+ cfbFillBoxTileOdd ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->border.pixmap,
+ xorg, yorg);
+ }
+ break;
+ }
+}
+
+/*
+ * Use the RROP macros in copy mode
+ */
+
+#define RROP GXcopy
+#include "cfbrrop.h"
+
+#ifdef RROP_UNROLL
+# define Expand(left,right,leftAdjust) {\
+ int part = nmiddle & RROP_UNROLL_MASK; \
+ int widthStep; \
+ widthStep = widthDst - nmiddle - leftAdjust; \
+ nmiddle >>= RROP_UNROLL_SHIFT; \
+ while (h--) { \
+ left \
+ pdst += part; \
+ switch (part) { \
+ RROP_UNROLL_CASE(pdst) \
+ } \
+ m = nmiddle; \
+ while (m) { \
+ pdst += RROP_UNROLL; \
+ RROP_UNROLL_LOOP(pdst) \
+ m--; \
+ } \
+ right \
+ pdst += widthStep; \
+ } \
+}
+
+#else
+# define Expand(left, right, leftAdjust) { \
+ int widthStep; \
+ widthStep = widthDst - nmiddle - leftAdjust; \
+ while (h--) { \
+ left \
+ m = nmiddle; \
+ while (m--) {\
+ RROP_SOLID(pdst); \
+ pdst++; \
+ } \
+ right \
+ pdst += widthStep; \
+ } \
+}
+#endif
+
+void
+cfbFillBoxSolid (pDrawable, nBox, pBox, pixel)
+ DrawablePtr pDrawable;
+ int nBox;
+ BoxPtr pBox;
+ unsigned long pixel;
+{
+ unsigned long *pdstBase;
+ int widthDst;
+ register int h;
+ register unsigned long rrop_xor;
+ register unsigned long *pdst;
+ register unsigned long leftMask, rightMask;
+ int nmiddle;
+ register int m;
+ int w;
+#if PSZ == 24
+ int leftIndex, rightIndex;
+ unsigned long piQxelArray[3], xOffset, *pdstULC; /*upper left corner*/
+
+ piQxelArray[0] = (pixel&0xFFFFFF) | ((pixel&0xFF)<<24);
+ piQxelArray[1] = ((pixel&0xFFFF00)>>8) | ((pixel&0xFFFF)<<16);
+ piQxelArray[2] = ((pixel&0xFFFFFF)<<8) | ((pixel&0xFF0000)>>16);
+#endif
+
+ cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase);
+
+ rrop_xor = PFILL(pixel);
+ for (; nBox; nBox--, pBox++)
+ {
+ pdst = pdstBase + pBox->y1 * widthDst;
+ h = pBox->y2 - pBox->y1;
+ w = pBox->x2 - pBox->x1;
+#if PSZ == 8
+ if (w == 1)
+ {
+ register char *pdstb = ((char *) pdst) + pBox->x1;
+ int incr = widthDst * PGSZB;
+
+ while (h--)
+ {
+ *pdstb = rrop_xor;
+ pdstb += incr;
+ }
+ }
+ else
+ {
+#endif
+#if PSZ == 24
+/* _Box has x1, y1, x2, y2*/
+ leftIndex = pBox->x1 & 3;
+ rightIndex = ((leftIndex+w)<5)?0:(pBox->x2 &3);
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdst = pdstBase + pBox->y1 * widthDst + ((pBox->x1*3) >> 2);
+
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst -=2;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst -=2;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst-- = piQxelArray[2];
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2:
+ while(h--){
+ if(leftIndex){
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ }
+ else{
+ *pdst++ = piQxelArray[0];
+ }
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ w = nmiddle;
+ pdstULC = pdst;
+/* maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);*/
+ while(h--){
+ nmiddle = w;
+ pdst = pdstULC;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ break;
+ case 2:
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst++ = piQxelArray[2];
+ break;
+ case 3:
+ *pdst++ = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ break;
+ }
+ while(nmiddle--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *pdst++ = piQxelArray[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ break;
+ case 3:
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ break;
+ }
+ pdstULC += widthDst;
+ }
+
+ }
+ }
+#else
+ pdst += (pBox->x1 >> PWSH);
+ if ((pBox->x1 & PIM) + w <= PPW)
+ {
+ maskpartialbits(pBox->x1, w, leftMask);
+ while (h--) {
+ *pdst = (*pdst & ~leftMask) | (rrop_xor & leftMask);
+ pdst += widthDst;
+ }
+ }
+ else
+ {
+ maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);
+ if (leftMask)
+ {
+ if (rightMask)
+ {
+ Expand (RROP_SOLID_MASK (pdst, leftMask); pdst++; ,
+ RROP_SOLID_MASK (pdst, rightMask); ,
+ 1)
+ }
+ else
+ {
+ Expand (RROP_SOLID_MASK (pdst, leftMask); pdst++;,
+ ;,
+ 1)
+ }
+ }
+ else
+ {
+ if (rightMask)
+ {
+ Expand (;,
+ RROP_SOLID_MASK (pdst, rightMask);,
+ 0)
+ }
+ else
+ {
+ Expand (;,
+ ;,
+ 0)
+ }
+ }
+ }
+#endif
+#if PSZ == 8
+ }
+#endif
+ }
+}
+
+void
+cfbFillBoxTile32 (pDrawable, nBox, pBox, tile)
+ DrawablePtr pDrawable;
+ int nBox; /* number of boxes to fill */
+ BoxPtr pBox; /* pointer to list of boxes to fill */
+ PixmapPtr tile; /* rotated, expanded tile */
+{
+ register unsigned long rrop_xor;
+ register unsigned long *pdst;
+ register int m;
+ unsigned long *psrc;
+ int tileHeight;
+
+ int widthDst;
+ int w;
+ int h;
+ register unsigned long leftMask;
+ register unsigned long rightMask;
+ int nmiddle;
+ int y;
+ int srcy;
+
+ unsigned long *pdstBase;
+#if PSZ == 24
+ int leftIndex, rightIndex;
+ unsigned long piQxelArray[3], xOffset, *pdstULC;
+#endif
+
+ tileHeight = tile->drawable.height;
+ psrc = (unsigned long *)tile->devPrivate.ptr;
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase);
+
+ while (nBox--)
+ {
+#if PSZ == 24
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ y = pBox->y1;
+ leftIndex = pBox->x1 & 3;
+/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/
+ rightIndex = pBox->x2 &3;
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdst = pdstBase + ((pBox->x1 *3)>> 2) + pBox->y1 * widthDst;
+ srcy = y % tileHeight;
+
+#define StepTile piQxelArray[0] = (psrc[srcy] & 0xFFFFFF) | ((psrc[srcy] & 0xFF)<<24); \
+ piQxelArray[1] = (psrc[srcy] & 0xFFFF00) | ((psrc[srcy] & 0xFFFF)<<16); \
+ piQxelArray[2] = ((psrc[srcy] & 0xFF0000)>>16) | \
+ ((psrc[srcy] & 0xFFFFFF)<<8); \
+ /*rrop_xor = psrc[srcy];*/ \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0;
+
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ StepTile
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst-=2;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ StepTile
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst = piQxelArray[2];
+ pdst-=2;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst-- = piQxelArray[2];
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+ StepTile
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+ StepTile
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2:
+ while(h--){
+ StepTile
+ if(leftIndex){
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ }
+ else{
+ *pdst++ = piQxelArray[0];
+ }
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+ StepTile
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ w = nmiddle;
+ pdstULC = pdst;
+
+ while(h--){
+ StepTile
+ nmiddle = w;
+ pdst = pdstULC;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000);
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ break;
+ case 2:
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000);
+ *pdst++ = piQxelArray[2];
+ break;
+ case 3:
+ *pdst++ = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00);
+ break;
+ }
+ while(nmiddle--){
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst++ = piQxelArray[2];
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF);
+ break;
+ case 2:
+ *pdst++ = piQxelArray[0];
+ *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF);
+ break;
+ case 3:
+ *pdst++ = piQxelArray[0];
+ *pdst++ = piQxelArray[1];
+ *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF);
+ break;
+ }
+ pdstULC += widthDst;
+ }
+ }
+ }
+#else
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ y = pBox->y1;
+ pdst = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+ srcy = y % tileHeight;
+
+#define StepTile rrop_xor = psrc[srcy]; \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0;
+
+ if ( ((pBox->x1 & PIM) + w) < PPW)
+ {
+ maskpartialbits(pBox->x1, w, leftMask);
+ rightMask = ~leftMask;
+ while (h--)
+ {
+ StepTile
+ *pdst = (*pdst & rightMask) | (rrop_xor & leftMask);
+ pdst += widthDst;
+ }
+ }
+ else
+ {
+ maskbits(pBox->x1, w, leftMask, rightMask, nmiddle);
+
+ if (leftMask)
+ {
+ if (rightMask)
+ {
+ Expand (StepTile
+ RROP_SOLID_MASK(pdst, leftMask); pdst++;,
+ RROP_SOLID_MASK(pdst, rightMask);,
+ 1)
+ }
+ else
+ {
+ Expand (StepTile
+ RROP_SOLID_MASK(pdst, leftMask); pdst++;,
+ ;,
+ 1)
+ }
+ }
+ else
+ {
+ if (rightMask)
+ {
+ Expand (StepTile
+ ,
+ RROP_SOLID_MASK(pdst, rightMask);,
+ 0)
+ }
+ else
+ {
+ Expand (StepTile
+ ,
+ ;,
+ 0)
+ }
+ }
+ }
+#endif
+ pBox++;
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbpolypnt.c b/xc/programs/Xserver/cfb/cfbpolypnt.c
new file mode 100644
index 000000000..bed909018
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbpolypnt.c
@@ -0,0 +1,194 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbpolypnt.c,v 3.2 1998/10/04 09:37:48 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: cfbpolypnt.c /main/19 1998/02/09 14:06:58 kaleb $ */
+
+#include "X.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "scrnintstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
+
+/* WARNING: pbox contains two shorts. This code assumes they are packed
+ * and can be referenced together as an INT32.
+ */
+
+#define PointLoop(fill) { \
+ for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \
+ --nbox >= 0; \
+ pbox++) \
+ { \
+ c1 = *((INT32 *) &pbox->x1) - off; \
+ c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \
+ for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \
+ { \
+ pt = *ppt++; \
+ if (!isClipped(pt,c1,c2)) { \
+ fill \
+ } \
+ } \
+ } \
+}
+
+#if PSZ == 24
+# include "cfbrrop24.h"
+#endif
+
+void
+cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int npt;
+ xPoint *pptInit;
+{
+ register INT32 pt;
+ register INT32 c1, c2;
+ register unsigned long ClipMask = 0x80008000;
+ register unsigned long xor;
+#ifdef PIXEL_ADDR
+ register PixelType *addrp;
+ register int npwidth;
+ PixelType *addrpt;
+#else
+ register unsigned long *addrl;
+ register int nlwidth;
+ register int xoffset;
+ unsigned long *addrlt;
+#endif
+#if PSZ == 24
+ RROP_DECLARE
+ register int xtmp;
+ register PixelType *p;
+#endif
+ register INT32 *ppt;
+ RegionPtr cclip;
+ int nbox;
+ register int i;
+ register BoxPtr pbox;
+ unsigned long and;
+ int rop = pGC->alu;
+ int off;
+ cfbPrivGCPtr devPriv;
+ xPoint *pptPrev;
+
+ devPriv =cfbGetGCPrivate(pGC);
+ rop = devPriv->rop;
+ if (rop == GXnoop)
+ return;
+ cclip = pGC->pCompositeClip;
+ xor = devPriv->xor;
+ if ((mode == CoordModePrevious) && (npt > 1))
+ {
+ for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++)
+ {
+ pptPrev->x += (pptPrev-1)->x;
+ pptPrev->y += (pptPrev-1)->y;
+ }
+ }
+ off = *((int *) &pDrawable->x);
+ off -= (off & 0x8000) << 1;
+#ifdef PIXEL_ADDR
+ cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp);
+#if PSZ == 24
+ addrp = addrp + pDrawable->y * npwidth;
+#else
+ addrp = addrp + pDrawable->y * npwidth + pDrawable->x;
+#endif
+ if (rop == GXcopy)
+ {
+#if PSZ == 24
+ RROP_COPY_SETUP(xor)
+#endif
+ if (!(npwidth & (npwidth - 1)))
+ {
+ npwidth = ffs(npwidth) - 1;
+#if PSZ == 24
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2);
+ RROP_SOLID24_COPY(p, xtmp))
+#else
+ PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;)
+#endif
+ }
+#ifdef sun
+ else if (npwidth == 1152)
+ {
+ register int y;
+ PointLoop(y = intToY(pt); *(addrp + (y << 10) + (y << 7) + intToX(pt)) = xor;)
+ }
+#endif
+ else
+ {
+#if PSZ == 24
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
+ RROP_SOLID24_COPY(p, xtmp))
+#else
+ PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;)
+#endif
+ }
+ }
+ else
+ {
+ and = devPriv->and;
+#if PSZ == 24
+ RROP_SET_SETUP(xor, and)
+ PointLoop(
+ xtmp = pDrawable->x + intToX(pt);
+ p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
+ RROP_SOLID24_SET(p, xtmp))
+#else
+ PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt);
+ *addrpt = DoRRop (*addrpt, and, xor);)
+#endif
+ }
+#else /* !PIXEL_ADDR */
+ cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl);
+ addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH);
+ xoffset = pDrawable->x & PIM;
+ and = devPriv->and;
+#if PSZ == 24
+ PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ + ((intToX(pt) + xoffset) >> PWSH);
+ *addrlt = DoRRop (*addrlt,
+ and | ~cfbmask[(intToX(pt) + xoffset) & PIM],
+ xor & cfbmask[(intToX(pt) + xoffset) & PIM]);
+ )
+#else
+ PointLoop( addrlt = addrl + intToY(pt) * nlwidth
+ + ((intToX(pt) + xoffset) >> PWSH);
+ *addrlt = DoRRop (*addrlt,
+ and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1],
+ xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]);
+ )
+#endif
+#endif /* PIXEL_ADDR */
+}
diff --git a/xc/programs/Xserver/cfb/cfbpush8.c b/xc/programs/Xserver/cfb/cfbpush8.c
new file mode 100644
index 000000000..c5bd22309
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbpush8.c
@@ -0,0 +1,182 @@
+/*
+ * Push Pixels for 8 bit displays.
+ */
+
+/* $XFree86: xc/programs/Xserver/cfb/cfbpush8.c,v 1.3 1998/10/04 09:37:49 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+/* $TOG: cfbpush8.c /main/18 1998/02/09 14:07:04 kaleb $ */
+
+#if PSZ == 8
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+#define MFB_CONSTS_ONLY
+#include "maskbits.h"
+
+void
+cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
+ GCPtr pGC;
+ PixmapPtr pBitmap;
+ DrawablePtr pDrawable;
+ int dx, dy, xOrg, yOrg;
+{
+ register unsigned long *src, *dst;
+ register unsigned long pixel;
+ register unsigned long c, bits;
+ unsigned long *pdstLine, *psrcLine;
+ unsigned long *pdstBase;
+ int srcWidth;
+ int dstWidth;
+ int xoff;
+ int nBitmapLongs, nPixmapLongs;
+ int nBitmapTmp, nPixmapTmp;
+ unsigned long rightMask;
+ BoxRec bbox;
+ cfbPrivGCPtr devPriv;
+
+ bbox.x1 = xOrg;
+ bbox.y1 = yOrg;
+ bbox.x2 = bbox.x1 + dx;
+ bbox.y2 = bbox.y1 + dy;
+ devPriv = cfbGetGCPrivate(pGC);
+
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
+ {
+ case rgnPART:
+#ifndef LOWMEMFTPT
+ mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg);
+#else
+ miPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg);
+#endif /* ifndef LOWMEMFTPT */
+ case rgnOUT:
+ return;
+ }
+
+ cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase)
+
+ psrcLine = (unsigned long *) pBitmap->devPrivate.ptr;
+ srcWidth = (int) pBitmap->devKind >> PWSH;
+
+ pixel = devPriv->xor;
+ xoff = xOrg & PIM;
+ nBitmapLongs = (dx + xoff) >> MFB_PWSH;
+ nPixmapLongs = (dx + PGSZB + xoff) >> PWSH;
+
+ rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)];
+
+ pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH);
+
+ while (dy--)
+ {
+ c = 0;
+ nPixmapTmp = nPixmapLongs;
+ nBitmapTmp = nBitmapLongs;
+ src = psrcLine;
+ dst = pdstLine;
+ while (nBitmapTmp--)
+ {
+ bits = *src++;
+ c |= BitRight (bits, xoff);
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ nPixmapTmp -= 8;
+ c = 0;
+ if (xoff)
+ c = BitLeft (bits, PGSZ - xoff);
+ }
+ if (BitLeft (rightMask, xoff))
+ c |= BitRight (*src, xoff);
+ c &= rightMask;
+ switch (nPixmapTmp) {
+ case 8:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 7:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 6:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 5:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 4:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 3:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 2:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 1:
+ WriteBitGroup(dst, pixel, GetBitGroup(c));
+ NextBitGroup(c);
+ dst++;
+ case 0:
+ break;
+ }
+ pdstLine += dstWidth;
+ psrcLine += srcWidth;
+ }
+}
+
+#endif
diff --git a/xc/programs/Xserver/cfb/cfbrctstp8.c b/xc/programs/Xserver/cfb/cfbrctstp8.c
new file mode 100644
index 000000000..66b52f6bf
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbrctstp8.c
@@ -0,0 +1,587 @@
+/*
+ * Fill 32 bit stippled rectangles for 8 bit frame buffers
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbrctstp8.c,v 3.2 1998/10/04 09:37:49 dawes Exp $ */
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Keith Packard, MIT X Consortium
+
+*/
+
+/* $TOG: cfbrctstp8.c /main/18 1998/02/09 14:07:10 kaleb $ */
+
+#if PSZ == 8
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+#define MFB_CONSTS_ONLY
+#include "maskbits.h"
+
+void
+cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox; /* number of boxes to fill */
+ register BoxPtr pBox; /* pointer to list of boxes to fill */
+{
+ unsigned long *src;
+ int stippleHeight;
+
+ int nlwDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current box */
+ register int h; /* height of current box */
+ unsigned long startmask;
+ unsigned long endmask; /* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ register int nlw; /* loop version of nlwMiddle */
+ unsigned long *dstLine;
+ register unsigned long *dst; /* pointer to bits we're writing */
+ unsigned long *dstTmp;
+ int y; /* current scan line */
+
+ unsigned long *pbits;/* pointer to start of pixmap */
+ register unsigned long bits; /* bits from stipple */
+ int rot, lastStop, i;
+ register unsigned long xor, and;
+ PixmapPtr stipple;
+ int wEnd;
+
+ stipple = pGC->pRotatedPixmap;
+
+ cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
+
+ stippleHeight = stipple->drawable.height;
+ src = (unsigned long *)stipple->devPrivate.ptr;
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+ while (nBox--)
+ {
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ y = pBox->y1;
+ dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH);
+ if (((pBox->x1 & PIM) + w) <= PPW)
+ {
+ maskpartialbits(pBox->x1, w, startmask);
+ nlwMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ maskbits (pBox->x1, w, startmask, endmask, nlwMiddle);
+ }
+ rot = (pBox->x1 & ((PGSZ-1) & ~PIM));
+ pBox++;
+ y = y % stippleHeight;
+#if PPW == 4
+ if (cfb8StippleRRop == GXcopy)
+ {
+ if (w < PGSZ*2)
+ {
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot)
+ RotBitsLeft(bits,rot);
+ dst = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ *dst = *dst & ~startmask |
+ GetPixelGroup (bits) & startmask;
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ nlw = nlwMiddle;
+ while (nlw--)
+ {
+ *dst++ = GetPixelGroup(bits);
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ *dst = *dst & ~endmask |
+ GetPixelGroup (bits) & endmask;
+ }
+ }
+ }
+ else
+ {
+ wEnd = 7 - (nlwMiddle & 7);
+ nlwMiddle = (nlwMiddle >> 3) + 1;
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot != 0)
+ RotBitsLeft (bits, rot);
+ dstTmp = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ *dstTmp = *dstTmp & ~startmask |
+ GetPixelGroup (bits) & startmask;
+ dstTmp++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ w = 7 - wEnd;
+ while (w--)
+ {
+ nlw = nlwMiddle;
+ dst = dstTmp;
+ dstTmp++;
+ xor = GetPixelGroup (bits);
+ while (nlw--)
+ {
+ *dst = xor;
+ dst += 8;
+ }
+ NextBitGroup (bits);
+ }
+ nlwMiddle--;
+ w = wEnd + 1;
+ if (endmask)
+ {
+ dst = dstTmp + (nlwMiddle << 3);
+ *dst = (*dst & ~endmask) |
+ GetPixelGroup (bits) & endmask;
+ }
+ while (w--)
+ {
+ nlw = nlwMiddle;
+ dst = dstTmp;
+ dstTmp++;
+ xor = GetPixelGroup (bits);
+ while (nlw--)
+ {
+ *dst = xor;
+ dst += 8;
+ }
+ NextBitGroup (bits);
+ }
+ nlwMiddle++;
+ }
+ }
+ }
+ else
+#endif /* PPW == 4 */
+ {
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot)
+ RotBitsLeft(bits,rot);
+ dst = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, startmask);
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ nlw = nlwMiddle;
+ while (nlw--)
+ {
+ RRopBitGroup(dst, GetBitGroup(bits));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, endmask);
+ }
+ }
+ }
+ }
+}
+
+void
+cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox; /* number of boxes to fill */
+ BoxPtr pBox; /* pointer to list of boxes to fill */
+{
+ int x, y, w, h;
+ int nlwMiddle, nlwDst, nlwTmp;
+ unsigned long startmask, endmask;
+ register unsigned long *dst;
+ unsigned long *dstLine, *pbits, *dstTmp;
+ unsigned long *src;
+ register unsigned long xor;
+ register unsigned long bits, mask;
+ int rot;
+ int wEnd;
+ cfbPrivGCPtr devPriv;
+ PixmapPtr stipple;
+ int stippleHeight;
+ register int nlw;
+
+ devPriv = cfbGetGCPrivate(pGC);
+ stipple = pGC->pRotatedPixmap;
+ src = (unsigned long *)stipple->devPrivate.ptr;
+ stippleHeight = stipple->drawable.height;
+
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+ while (nBox--)
+ {
+ x = pBox->x1;
+ w = pBox->x2 - x;
+ if (((x & PIM) + w) <= PPW)
+ {
+ maskpartialbits(x, w, startmask);
+ endmask = 0;
+ nlwMiddle = 0;
+ }
+ else
+ {
+ maskbits (x, w, startmask, endmask, nlwMiddle);
+ }
+ rot = (x & ((PGSZ-1) & ~PIM));
+ y = pBox->y1;
+ dstLine = pbits + (y * nlwDst) + (x >> PWSH);
+ h = pBox->y2 - y;
+ pBox++;
+ y %= stippleHeight;
+#if PPW == 4
+ if (cfb8StippleRRop == GXcopy)
+ {
+ xor = devPriv->xor;
+ if (w < PGSZ*2)
+ {
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot != 0)
+ RotBitsLeft (bits, rot);
+ dst = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dst = (*dst & ~(mask & startmask)) |
+ (xor & (mask & startmask));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ nlw = nlwMiddle;
+ while (nlw--)
+ {
+ WriteBitGroup (dst,xor,GetBitGroup(bits))
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dst = (*dst & ~(mask & endmask)) |
+ (xor & (mask & endmask));
+ }
+ }
+ }
+ else
+ {
+ wEnd = 7 - (nlwMiddle & 7);
+ nlwMiddle = (nlwMiddle >> 3) + 1;
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot != 0)
+ RotBitsLeft (bits, rot);
+ dstTmp = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ *dstTmp = (*dstTmp & ~(mask & startmask)) |
+ (xor & (mask & startmask));
+ dstTmp++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ w = 7 - wEnd;
+ while (w--)
+ {
+ nlw = nlwMiddle;
+ dst = dstTmp;
+ dstTmp++;
+#if defined(__GNUC__) && defined(mc68020)
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ xor = xor & mask;
+ mask = ~mask;
+ while (nlw--)
+ {
+ *dst = (*dst & mask) | xor;
+ dst += 8;
+ }
+ xor = devPriv->xor;
+#else
+#define SwitchBitsLoop(body) \
+ while (nlw--) \
+ { \
+ body \
+ dst += 8; \
+ }
+ SwitchBitGroup(dst, xor, GetBitGroup(bits));
+#undef SwitchBitsLoop
+#endif
+ NextBitGroup (bits);
+ }
+ nlwMiddle--;
+ w = wEnd + 1;
+ if (endmask)
+ {
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ dst = dstTmp + (nlwMiddle << 3);
+ *dst = (*dst & ~(mask & endmask)) |
+ (xor & (mask & endmask));
+ }
+ while (w--)
+ {
+ nlw = nlwMiddle;
+ dst = dstTmp;
+ dstTmp++;
+#if defined(__GNUC__) && defined(mc68020)
+ mask = cfb8PixelMasks[GetBitGroup(bits)];
+ xor = xor & mask;
+ mask = ~mask;
+ while (nlw--)
+ {
+ *dst = (*dst & mask) | xor;
+ dst += 8;
+ }
+ xor = devPriv->xor;
+#else
+#define SwitchBitsLoop(body) \
+ while (nlw--) \
+ { \
+ body \
+ dst += 8; \
+ }
+ SwitchBitGroup(dst, xor, GetBitGroup(bits));
+#undef SwitchBitsLoop
+#endif
+ NextBitGroup (bits);
+ }
+ nlwMiddle++;
+ }
+ }
+ }
+ else
+#endif /* PPW == 4 */
+ {
+ while (h--)
+ {
+ bits = src[y];
+ y++;
+ if (y == stippleHeight)
+ y = 0;
+ if (rot != 0)
+ RotBitsLeft (bits, rot);
+ dst = dstLine;
+ dstLine += nlwDst;
+ if (startmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, startmask);
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ nlw = nlwMiddle;
+ while (nlw--)
+ {
+ RRopBitGroup(dst, GetBitGroup(bits));
+ dst++;
+ RotBitsLeft (bits, PGSZB);
+ }
+ if (endmask)
+ {
+ xor = GetBitGroup(bits);
+ *dst = MaskRRopPixels(*dst, xor, endmask);
+ }
+ }
+ }
+ }
+}
+
+
+void
+cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox;
+ register BoxPtr pBox;
+{
+ unsigned long *pdstBase; /* pointer to start of bitmap */
+ unsigned long *pdstLine; /* current destination line */
+ int nlwDst; /* width in longwords of bitmap */
+ PixmapPtr pStipple; /* pointer to stipple we want to fill with */
+ int nlwMiddle;
+ register int nlw;
+ int x, y, w, h, xrem, xSrc, ySrc;
+ int stwidth, stippleWidth;
+ int stippleHeight;
+ register unsigned long bits, inputBits;
+ register int partBitsLeft;
+ int nextPartBits;
+ int bitsLeft, bitsWhole;
+ register unsigned long *pdst; /* pointer to current word in bitmap */
+ unsigned long *srcTemp, *srcStart;
+ unsigned long *psrcBase;
+ unsigned long startmask, endmask;
+
+ if (pGC->fillStyle == FillStippled)
+ cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
+ else
+ cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
+
+ if (cfb8StippleRRop == GXnoop)
+ return;
+
+ /*
+ * OK, so what's going on here? We have two Drawables:
+ *
+ * The Stipple:
+ * Depth = 1
+ * Width = stippleWidth
+ * Words per scanline = stwidth
+ * Pointer to pixels = pStipple->devPrivate.ptr
+ */
+
+ pStipple = pGC->stipple;
+
+ stwidth = pStipple->devKind >> PWSH;
+ stippleWidth = pStipple->drawable.width;
+ stippleHeight = pStipple->drawable.height;
+ psrcBase = (unsigned long *) pStipple->devPrivate.ptr;
+
+ /*
+ * The Target:
+ * Depth = PSZ
+ * Width = determined from *pwidth
+ * Words per scanline = nlwDst
+ * Pointer to pixels = addrlBase
+ */
+
+ xSrc = pDrawable->x;
+ ySrc = pDrawable->y;
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
+
+ /* this replaces rotating the stipple. Instead we just adjust the offset
+ * at which we start grabbing bits from the stipple.
+ * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
+ * so that iline and xrem always stay within the stipple bounds.
+ */
+
+ xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth;
+ ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight;
+
+ bitsWhole = stippleWidth;
+
+ while (nBox--)
+ {
+ x = pBox->x1;
+ y = pBox->y1;
+ w = pBox->x2 - x;
+ h = pBox->y2 - y;
+ pBox++;
+ pdstLine = pdstBase + y * nlwDst + (x >> PWSH);
+ y = (y - ySrc) % stippleHeight;
+ srcStart = psrcBase + y * stwidth;
+ xrem = ((x & ~PIM) - xSrc) % stippleWidth;
+ if (((x & PIM) + w) < PPW)
+ {
+ maskpartialbits (x, w, startmask);
+ nlwMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ maskbits (x, w, startmask, endmask, nlwMiddle);
+ }
+ while (h--)
+ {
+ srcTemp = srcStart + (xrem >> MFB_PWSH);
+ bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
+ NextUnnaturalStippleWord
+ NextSomeBits (inputBits, (xrem & MFB_PIM));
+ partBitsLeft -= (xrem & MFB_PIM);
+ NextUnnaturalStippleBits
+ nlw = nlwMiddle;
+ pdst = pdstLine;
+ if (startmask)
+ {
+ *pdst = MaskRRopPixels(*pdst,bits,startmask);
+ pdst++;
+ NextUnnaturalStippleBits
+ }
+ while (nlw--)
+ {
+ *pdst = RRopPixels(*pdst,bits);
+ pdst++;
+ NextUnnaturalStippleBits
+ }
+ if (endmask)
+ *pdst = MaskRRopPixels(*pdst,bits,endmask);
+ pdstLine += nlwDst;
+ y++;
+ srcStart += stwidth;
+ if (y == stippleHeight)
+ {
+ y = 0;
+ srcStart = psrcBase;
+ }
+ }
+ }
+}
+
+#endif /* PSZ == 8 */
diff --git a/xc/programs/Xserver/cfb/cfbrrop.c b/xc/programs/Xserver/cfb/cfbrrop.c
new file mode 100644
index 000000000..2a2533ee6
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbrrop.c
@@ -0,0 +1,217 @@
+/*
+ * $TOG: cfbrrop.c /main/9 1998/02/09 14:07:18 kaleb $
+ *
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* cfb reduced rasterop computations */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+
+/* A description:
+ *
+ * There are four possible operations on each bit in the destination word,
+ *
+ * 1 2 3 4
+ *
+ * 0 0 0 1 1
+ * 1 0 1 0 1
+ *
+ * On examination of the reduced rop equation (dst = (dst & and) ^ xor),
+ * these four fall to reduced rops as follows:
+ *
+ * and 0 1 1 0
+ * xor 0 0 1 1
+ *
+ * or, (if 'and' is expensive) (dst = (dst | or) ^ xor)
+ *
+ * or 1 0 0 1
+ * xor 1 0 1 0
+ *
+ * The trouble with using this later equation is that trivial
+ * rasterop reduction is more difficult; some common rasterops
+ * use complicated expressions of xor/and instead of the simple
+ * ones while other common rasterops are not made any simpler:
+ *
+ * GXcopy: *dst = ~xor instead of *dst = xor
+ * GXand: *dst = *dst & ~or instead of *dst = *dst & and
+ * GXor: *dst = *dst | or instead of *dst = *dst | xor
+ * GXxor: *dst = *dst ^ xor instead of *dst = *dst ^ xor
+ *
+ * If you're really set on using this second mechanism, the changes
+ * are pretty simple.
+ *
+ * All that remains is to provide a mechanism for computing and/xor values
+ * based on the raster op and foreground value.
+ *
+ * The 16 rops fall as follows, with the associated reduced
+ * rop and/xor and or/xor values. The values in parenthesis following the
+ * reduced values gives an equation using the source value for
+ * the reduced value, and is one of {0, src, ~src, 1} as appropriate.
+ *
+ * clear and andReverse copy
+ * src 0 1 0 1 0 1 0 1
+ * dst 0 0 0 0 0 0 0 0 1 0 0 1
+ * 1 0 0 1 0 1 1 0 0 1 0 1
+ *
+ * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
+ * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
+ *
+ * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
+ * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
+ *
+ * andInverted noop xor or
+ * src 0 1 0 1 0 1 0 1
+ * dst 0 0 0 0 0 0 0 0 1 0 0 1
+ * 1 1 0 1 1 1 1 1 0 1 1 1
+ *
+ * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
+ * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
+ *
+ * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
+ * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
+ *
+ * nor equiv invert orReverse
+ * src 0 1 0 1 0 1 0 1
+ * dst 0 1 0 0 1 0 0 1 1 0 1 1
+ * 1 0 0 1 0 1 1 0 0 1 0 1
+ *
+ * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
+ * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
+ *
+ * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
+ * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
+ *
+ * copyInverted orInverted nand set
+ * src 0 1 0 1 0 1 0 1
+ * dst 0 1 0 0 1 0 0 1 1 0 1 1
+ * 1 1 0 1 1 1 1 1 0 1 1 1
+ *
+ * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
+ * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
+ *
+ * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
+ * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
+ */
+
+int
+cfbReduceRasterOp (rop, fg, pm, andp, xorp)
+ int rop;
+ unsigned long fg, pm;
+ unsigned long *andp, *xorp;
+{
+ unsigned long and, xor;
+ int rrop;
+
+ fg = PFILL (fg);
+ pm = PFILL (pm);
+ switch (rop)
+ {
+ case GXclear:
+ and = 0;
+ xor = 0;
+ break;
+ case GXand:
+ and = fg;
+ xor = 0;
+ break;
+ case GXandReverse:
+ and = fg;
+ xor = fg;
+ break;
+ case GXcopy:
+ and = 0;
+ xor = fg;
+ break;
+ case GXandInverted:
+ and = ~fg;
+ xor = 0;
+ break;
+ case GXnoop:
+ and = ~0;
+ xor = 0;
+ break;
+ case GXxor:
+ and = ~0;
+ xor = fg;
+ break;
+ case GXor:
+ and = ~fg;
+ xor = fg;
+ break;
+ case GXnor:
+ and = ~fg;
+ xor = ~fg;
+ break;
+ case GXequiv:
+ and = ~0;
+ xor = ~fg;
+ break;
+ case GXinvert:
+ and = ~0;
+ xor = ~0;
+ break;
+ case GXorReverse:
+ and = ~fg;
+ xor = ~0;
+ break;
+ case GXcopyInverted:
+ and = 0;
+ xor = ~fg;
+ break;
+ case GXorInverted:
+ and = fg;
+ xor = ~fg;
+ break;
+ case GXnand:
+ and = fg;
+ xor = ~0;
+ break;
+ case GXset:
+ and = 0;
+ xor = ~0;
+ break;
+ }
+ and |= ~pm;
+ xor &= pm;
+ *andp = and;
+ *xorp = xor;
+ /* check for some special cases to reduce computation */
+ if (and == 0)
+ rrop = GXcopy;
+ /* nothing checks for GXnoop
+ else if (and == ~0 && xor == 0)
+ rrop = GXnoop;
+ */
+ else if (and == ~0)
+ rrop = GXxor;
+ else if (xor == 0)
+ rrop = GXand;
+ else if ( (and ^ xor) == ~0) /* fix XBUG 6541 */
+ rrop = GXor;
+ else
+ rrop = GXset; /* rop not reduced */
+ return rrop;
+}
diff --git a/xc/programs/Xserver/cfb/cfbrrop.h b/xc/programs/Xserver/cfb/cfbrrop.h
new file mode 100644
index 000000000..b23dd491e
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbrrop.h
@@ -0,0 +1,334 @@
+/*
+ * $TOG: cfbrrop.h /main/11 1998/02/09 14:07:24 kaleb $
+ *
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.4 1999/03/28 15:32:11 dawes Exp $ */
+
+#ifndef GXcopy
+#include "X.h"
+#endif
+
+#define RROP_FETCH_GC(gc) \
+ RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr))
+
+#ifndef RROP
+#define RROP GXset
+#endif
+
+#if RROP == GXcopy
+#if PSZ == 24
+#define RROP_DECLARE register unsigned long rrop_xor; \
+ unsigned long piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4){ \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
+ } \
+ }
+#define RROP_SOLID(dst, idx) \
+ (*(dst) = piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
+#else
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
+#define RROP_DECLARE register unsigned long rrop_xor;
+#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
+#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
+#define RROP_SOLID_lu(dst) stq_u(rrop_xor, dst)
+#define RROP_SOLID_MASK_lu(dst,mask) stq_u((ldq_u(dst) & ~(mask)) | ((rrop_xor) & (mask)), dst)
+#endif
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
+#endif /* GXcopy */
+
+#if RROP == GXxor
+#if PSZ == 24
+#define RROP_DECLARE register unsigned long rrop_xor; \
+ unsigned long piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) ^= spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4) \
+ *((dst)+1) ^= spiQxelXor[idx+1]; \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) ^= piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) ^= (piQxelXor[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register unsigned long rrop_xor;
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
+#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
+#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
+#define RROP_SOLID_lu(dst) stq_u(ldq_u(dst) ^ rrop_xor, dst)
+#define RROP_SOLID_MASK_lu(dst,mask) stq_u(ldq_u(dst) ^ ((rrop_xor) & (mask)), dst)
+#endif
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
+#endif /* GXxor */
+
+#if RROP == GXand
+#if PSZ == 24
+#define RROP_DECLARE register unsigned long rrop_and; \
+ unsigned long piQxelAnd[3], spiQxelAnd[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) &= spiQxelAnd[0]; \
+ break; \
+ case 3: \
+ *(dst) &= spiQxelAnd[1]; \
+ break; \
+ case 1: \
+ *(dst) &= spiQxelAnd[2]; \
+ *((dst)+1) &= spiQxelAnd[3]; \
+ break; \
+ case 2: \
+ *(dst) &= spiQxelAnd[4]; \
+ *((dst)+1) &= spiQxelAnd[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) &= piQxelAnd[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
+#else
+#define RROP_DECLARE register unsigned long rrop_and;
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
+#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
+#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
+#endif
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
+#endif /* GXand */
+
+#if RROP == GXor
+#if PSZ == 24
+#define RROP_DECLARE register unsigned long rrop_or; \
+ unsigned long piQxelOr[3], spiQxelOr[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
+ spiQxelOr[0] = rrop_or & 0xFFFFFF; \
+ spiQxelOr[1] = rrop_or << 24; \
+ spiQxelOr[2] = rrop_or << 16; \
+ spiQxelOr[3] = rrop_or << 8; \
+ spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
+ spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
+ piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
+ piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
+ piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) |= spiQxelOr[0]; \
+ break; \
+ case 3: \
+ *(dst) |= spiQxelOr[3]; \
+ break; \
+ case 1: \
+ *(dst) |= spiQxelOr[1]; \
+ *((dst)+1) |= spiQxelOr[4]; \
+ break; \
+ case 2: \
+ *(dst) |= spiQxelOr[2]; \
+ *((dst)+1) |= spiQxelOr[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) |= piQxelOr[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) |= (piQxelOr[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register unsigned long rrop_or;
+#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
+#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
+#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
+#endif
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
+#endif /* GXor */
+
+#if RROP == GXnoop
+#define RROP_DECLARE
+#define RROP_FETCH_GCPRIV(devPriv)
+#define RROP_SOLID(dst)
+#define RROP_SOLID_MASK(dst,mask)
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop)
+#endif /* GXnoop */
+
+#if RROP == GXset
+#if PSZ == 24
+#define RROP_DECLARE register unsigned long rrop_and, rrop_xor; \
+ unsigned long piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[1] = rrop_xor << 24; \
+ spiQxelXor[2] = rrop_xor << 16; \
+ spiQxelXor[3] = rrop_xor << 8; \
+ spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
+ spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
+ break; \
+ case 3: \
+ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
+ break; \
+ case 1: \
+ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
+ break; \
+ case 2: \
+ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
+#else
+#define RROP_DECLARE register unsigned long rrop_and, rrop_xor;
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ rrop_xor = (devPriv)->xor;
+#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
+#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
+#define RROP_SOLID_lu(dst) stq_u(DoRRop (ldq_u(dst), rrop_and, rrop_xor), dst)
+#define RROP_SOLID_MASK_lu(dst,mask) stq_u(DoMaskRRop (ldq_u(dst), rrop_and, rrop_xor, (mask)), dst)
+#endif
+#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
+#endif /* GXset */
+
+#define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i));
+#define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i)
+#define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i)
+#define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i)
+#define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i)
+#define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1)
+#define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p)
+#define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p)
+#define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p)
+#ifdef LONG64
+#define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p)
+#endif /* LONG64 */
+
+#define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i));
+#define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1)
+#define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2)
+#define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4)
+#define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8)
+#define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16)
+#ifdef LONG64
+#define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32)
+#endif /* LONG64 */
+
+#if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy)
+
+#ifdef LONG64
+#define RROP_UNROLL_SHIFT 6
+#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p)
+#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64)
+#else /* not LONG64 */
+#define RROP_UNROLL_SHIFT 5
+#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p)
+#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32)
+#endif /* LONG64 */
+#define RROP_UNROLL (1<<RROP_UNROLL_SHIFT)
+#define RROP_UNROLL_MASK (RROP_UNROLL-1)
+
+#define RROP_SPAN(pdst,nmiddle) {\
+ int part = (nmiddle) & RROP_UNROLL_MASK; \
+ (nmiddle) >>= RROP_UNROLL_SHIFT; \
+ (pdst) += part * (sizeof (unsigned long) / sizeof (*pdst)); \
+ switch (part) {\
+ RROP_UNROLL_CASE((unsigned long *) (pdst)) \
+ } \
+ while (--(nmiddle) >= 0) { \
+ (pdst) += RROP_UNROLL * (sizeof (unsigned long) / sizeof (*pdst)); \
+ RROP_UNROLL_LOOP((unsigned long *) (pdst)) \
+ } \
+}
+#else
+#define RROP_SPAN(pdst,nmiddle) \
+ while (--(nmiddle) >= 0) { \
+ RROP_SOLID((unsigned long *) (pdst)); \
+ (pdst) += sizeof (unsigned long) / sizeof (*pdst); \
+ }
+#define RROP_SPAN_lu(pdst,nmiddle) \
+ while (--(nmiddle) >= 0) { \
+ RROP_SOLID_lu((unsigned long *) (pdst)); \
+ (pdst) += sizeof (unsigned long) / sizeof (*pdst); \
+ }
+#endif
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
+#else
+#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
+#endif
diff --git a/xc/programs/Xserver/cfb/cfbscrinit.c b/xc/programs/Xserver/cfb/cfbscrinit.c
new file mode 100644
index 000000000..5579608b7
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbscrinit.c
@@ -0,0 +1,217 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbscrinit.c,v 1.17 1998/12/20 11:57:29 dawes Exp $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $TOG: cfbscrinit.c /main/60 1998/02/09 14:07:30 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "cfb.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "cfbmskbits.h"
+#include "mibstore.h"
+
+BSFuncRec cfbBSFuncRec = {
+ cfbSaveAreas,
+ cfbRestoreAreas,
+ (BackingStoreSetClipmaskRgnProcPtr) 0,
+ (BackingStoreGetImagePixmapProcPtr) 0,
+ (BackingStoreGetSpansPixmapProcPtr) 0,
+};
+
+Bool
+cfbCloseScreen (index, pScreen)
+ int index;
+ ScreenPtr pScreen;
+{
+ int d;
+ DepthPtr depths = pScreen->allowedDepths;
+
+ for (d = 0; d < pScreen->numDepths; d++)
+ xfree (depths[d].vids);
+ xfree (depths);
+ xfree (pScreen->visuals);
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ xfree (pScreen->devPrivates[cfbScreenPrivateIndex].ptr);
+#else
+ xfree (pScreen->devPrivate);
+#endif
+ return TRUE;
+}
+
+Bool
+cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ int i;
+
+ if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0))
+ return FALSE;
+ pScreen->defColormap = FakeClientID(0);
+ /* let CreateDefColormap do whatever it wants for pixels */
+ pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+ pScreen->QueryBestSize = mfbQueryBestSize;
+ /* SaveScreen */
+ pScreen->GetImage = cfbGetImage;
+ pScreen->GetSpans = cfbGetSpans;
+ pScreen->CreateWindow = cfbCreateWindow;
+ pScreen->DestroyWindow = cfbDestroyWindow;
+ pScreen->PositionWindow = cfbPositionWindow;
+ pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes;
+ pScreen->RealizeWindow = cfbMapWindow;
+ pScreen->UnrealizeWindow = cfbUnmapWindow;
+ pScreen->PaintWindowBackground = cfbPaintWindow;
+ pScreen->PaintWindowBorder = cfbPaintWindow;
+ pScreen->CopyWindow = cfbCopyWindow;
+ pScreen->CreatePixmap = cfbCreatePixmap;
+ pScreen->DestroyPixmap = cfbDestroyPixmap;
+ pScreen->RealizeFont = mfbRealizeFont;
+ pScreen->UnrealizeFont = mfbUnrealizeFont;
+ pScreen->CreateGC = cfbCreateGC;
+ pScreen->CreateColormap = cfbInitializeColormap;
+ pScreen->DestroyColormap = (void (*)())NoopDDA;
+ pScreen->InstallColormap = cfbInstallColormap;
+ pScreen->UninstallColormap = cfbUninstallColormap;
+ pScreen->ListInstalledColormaps = cfbListInstalledColormaps;
+ pScreen->StoreColors = (void (*)())NoopDDA;
+ pScreen->ResolveColor = cfbResolveColor;
+ pScreen->BitmapToRegion = mfbPixmapToRegion;
+
+ mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane);
+ return TRUE;
+}
+
+#ifdef CFB_NEED_SCREEN_PRIVATE
+Bool
+cfbCreateScreenResources(pScreen)
+ ScreenPtr pScreen;
+{
+ Bool retval;
+
+ pointer oldDevPrivate = pScreen->devPrivate;
+ pScreen->devPrivate = pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
+ retval = miCreateScreenResources(pScreen);
+ pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ return retval;
+}
+#endif
+
+Bool
+cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ int i, j;
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ pointer oldDevPrivate;
+#endif
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+
+ rootdepth = 0;
+ if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual,((unsigned long)1<<(PSZ-1)), 8))
+ return FALSE;
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ oldDevPrivate = pScreen->devPrivate;
+#endif
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ /* overwrite miCloseScreen with our own */
+ pScreen->CloseScreen = cfbCloseScreen;
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ pScreen->CreateScreenResources = cfbCreateScreenResources;
+ pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+#endif
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ pScreen->GetScreenPixmap = cfbGetScreenPixmap;
+ pScreen->SetScreenPixmap = cfbSetScreenPixmap;
+ return TRUE;
+}
+
+/* dts * (inch/dot) * (25.4 mm / inch) = mm */
+Bool
+cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
+ return FALSE;
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+
+PixmapPtr
+cfbGetScreenPixmap(pScreen)
+ ScreenPtr pScreen;
+{
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
+#else
+ return (PixmapPtr)pScreen->devPrivate;
+#endif
+}
+
+void
+cfbSetScreenPixmap(pPix)
+ PixmapPtr pPix;
+{
+#ifdef CFB_NEED_SCREEN_PRIVATE
+ if (pPix)
+ pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr =
+ (pointer)pPix;
+#else
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer)pPix;
+#endif
+}
diff --git a/xc/programs/Xserver/cfb/cfbsetsp.c b/xc/programs/Xserver/cfb/cfbsetsp.c
new file mode 100644
index 000000000..a9f3652ff
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbsetsp.c
@@ -0,0 +1,303 @@
+/* $TOG: cfbsetsp.c /main/21 1998/02/09 14:07:36 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbsetsp.c,v 3.1 1998/10/04 09:37:51 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+
+#include "misc.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include <mergerop.h>
+
+/* cfbSetScanline -- copies the bits from psrc to the drawable starting at
+ * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
+ * starts on the scanline. (I.e., if this scanline passes through multiple
+ * boxes, we may not want to start grabbing bits at psrc but at some offset
+ * further on.)
+ */
+cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask)
+ int y;
+ int xOrigin; /* where this scanline starts */
+ int xStart; /* first bit to use from scanline */
+ int xEnd; /* last bit to use from scanline + 1 */
+ register unsigned int *psrc;
+ register int alu; /* raster op */
+ int *pdstBase; /* start of the drawable */
+ int widthDst; /* width of drawable in words */
+ unsigned long planemask;
+{
+ int w; /* width of scanline in bits */
+ register int *pdst; /* where to put the bits */
+ register int tmpSrc; /* scratch buffer to collect bits in */
+ int dstBit; /* offset in bits from beginning of
+ * word */
+ register int nstart; /* number of bits from first partial */
+ register int nend; /* " " last partial word */
+ int offSrc;
+ int startmask, endmask, nlMiddle, nl;
+#if PSZ == 24
+ register char *psrcb, *pdstb;
+ register int xIndex;
+#endif
+ DeclareMergeRop()
+
+ InitializeMergeRop(alu,planemask);
+#if PSZ == 24
+ pdst = pdstBase + (y * widthDst);
+ xIndex = xStart;
+ pdstb = (char *)pdst + (xStart * 3);
+ offSrc = xStart - xOrigin;
+ psrcb = (char *)psrc + (offSrc * 3);
+#else
+ pdst = pdstBase + (y * widthDst) + (xStart >> PWSH);
+ psrc += (xStart - xOrigin) >> PWSH;
+ offSrc = (xStart - xOrigin) & PIM;
+#endif
+ w = xEnd - xStart;
+ dstBit = xStart & PIM;
+
+#if PSZ == 24
+ nl = w;
+ while (nl--){
+ psrc = (unsigned int *)((unsigned long)psrcb & ~0x03);
+ getbits24(psrc, tmpSrc, offSrc);
+ pdst = (int *)((unsigned long)pdstb & ~0x03);
+ DoMergeRop24(tmpSrc, pdst, xIndex);
+ offSrc++;
+ psrcb += 3;
+ xIndex++;
+ pdstb += 3;
+ }
+#else /* PSZ == 24 */
+ if (dstBit + w <= PPW)
+ {
+ maskpartialbits(dstBit, w, startmask);
+ endmask = 0;
+ nlMiddle = 0;
+ }
+ else
+ {
+ maskbits(xStart, w, startmask, endmask, nlMiddle);
+ }
+ if (startmask)
+ nstart = PPW - dstBit;
+ else
+ nstart = 0;
+ if (endmask)
+ nend = xEnd & PIM;
+ else
+ nend = 0;
+ if (startmask)
+ {
+ getbits(psrc, offSrc, nstart, tmpSrc);
+ putbitsmropshort(tmpSrc, dstBit, nstart, pdst);
+ pdst++;
+ offSrc += nstart;
+ if (offSrc > PLST)
+ {
+ psrc++;
+ offSrc -= PPW;
+ }
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ getbits(psrc, offSrc, PPW, tmpSrc);
+ *pdst = DoMergeRop(tmpSrc, *pdst);
+ pdst++;
+ psrc++;
+ }
+ if (endmask)
+ {
+ getbits(psrc, offSrc, nend, tmpSrc);
+ putbitsmropshort(tmpSrc, 0, nend, pdst);
+ }
+#endif /* PSZ == 24 */
+}
+
+
+
+/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
+ * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
+ * are in increasing Y order.
+ * Source bit lines are server scanline padded so that they always begin
+ * on a word boundary.
+ */
+void
+cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ char *pcharsrc;
+ register DDXPointPtr ppt;
+ int *pwidth;
+ int nspans;
+ int fSorted;
+{
+ unsigned int *psrc = (unsigned int *)pcharsrc;
+ unsigned long *pdstBase; /* start of dst bitmap */
+ int widthDst; /* width of bitmap in words */
+ register BoxPtr pbox, pboxLast, pboxTest;
+ register DDXPointPtr pptLast;
+ int alu;
+ RegionPtr prgnDst;
+ int xStart, xEnd;
+ int yMax;
+
+ alu = pGC->alu;
+ prgnDst = cfbGetCompositeClip(pGC);
+ pptLast = ppt + nspans;
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ yMax = (int) pDrawable->y + (int) pDrawable->height;
+
+ pbox = REGION_RECTS(prgnDst);
+ pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
+
+ if(fSorted)
+ {
+ /* scan lines sorted in ascending order. Because they are sorted, we
+ * don't have to check each scanline against each clip box. We can be
+ * sure that this scanline only has to be clipped to boxes at or after the
+ * beginning of this y-band
+ */
+ pboxTest = pbox;
+ while(ppt < pptLast)
+ {
+ pbox = pboxTest;
+ if(ppt->y >= yMax)
+ break;
+ while(pbox < pboxLast)
+ {
+ if(pbox->y1 > ppt->y)
+ {
+ /* scanline is before clip box */
+ break;
+ }
+ else if(pbox->y2 <= ppt->y)
+ {
+ /* clip box is before scanline */
+ pboxTest = ++pbox;
+ continue;
+ }
+ else if(pbox->x1 > ppt->x + *pwidth)
+ {
+ /* clip box is to right of scanline */
+ break;
+ }
+ else if(pbox->x2 <= ppt->x)
+ {
+ /* scanline is to right of clip box */
+ pbox++;
+ continue;
+ }
+
+ /* at least some of the scanline is in the current clip box */
+ xStart = max(pbox->x1, ppt->x);
+ xEnd = min(ppt->x + *pwidth, pbox->x2);
+ cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
+ (int *)pdstBase, widthDst, pGC->planemask);
+ if(ppt->x + *pwidth <= pbox->x2)
+ {
+ /* End of the line, as it were */
+ break;
+ }
+ else
+ pbox++;
+ }
+ /* We've tried this line against every box; it must be outside them
+ * all. move on to the next point */
+ ppt++;
+ psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
+ pwidth++;
+ }
+ }
+ else
+ {
+ /* scan lines not sorted. We must clip each line against all the boxes */
+ while(ppt < pptLast)
+ {
+ if(ppt->y >= 0 && ppt->y < yMax)
+ {
+
+ for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++)
+ {
+ if(pbox->y1 > ppt->y)
+ {
+ /* rest of clip region is above this scanline,
+ * skip it */
+ break;
+ }
+ if(pbox->y2 <= ppt->y)
+ {
+ /* clip box is below scanline */
+ pbox++;
+ break;
+ }
+ if(pbox->x1 <= ppt->x + *pwidth &&
+ pbox->x2 > ppt->x)
+ {
+ xStart = max(pbox->x1, ppt->x);
+ xEnd = min(pbox->x2, ppt->x + *pwidth);
+ cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
+ (int *)pdstBase, widthDst, pGC->planemask);
+ }
+
+ }
+ }
+ psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
+ ppt++;
+ pwidth++;
+ }
+ }
+}
+
diff --git a/xc/programs/Xserver/cfb/cfbsolid.c b/xc/programs/Xserver/cfb/cfbsolid.c
new file mode 100644
index 000000000..db1efe99d
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbsolid.c
@@ -0,0 +1,1320 @@
+/*
+ * $TOG: cfbsolid.c /main/10 1998/02/09 14:07:43 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbsolid.c,v 3.3 1998/10/04 13:23:58 dawes Exp $ */
+
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfbrrop.h"
+
+#include "mi.h"
+#include "mispans.h"
+
+#if defined(FAST_CONSTANT_OFFSET_MODE) && (RROP != GXcopy)
+# define Expand(left,right,leftAdjust) {\
+ int part = nmiddle & 3; \
+ int widthStep; \
+ widthStep = widthDst - nmiddle - leftAdjust; \
+ nmiddle >>= 2; \
+ pdst = pdstRect; \
+ while (h--) { \
+ left \
+ pdst += part; \
+ switch (part) { \
+ RROP_UNROLL_CASE3(pdst) \
+ } \
+ m = nmiddle; \
+ while (m) { \
+ pdst += 4; \
+ RROP_UNROLL_LOOP4(pdst,-4) \
+ m--; \
+ } \
+ right \
+ pdst += widthStep; \
+ } \
+}
+#else
+# ifdef RROP_UNROLL
+# define Expand(left,right,leftAdjust) {\
+ int part = nmiddle & RROP_UNROLL_MASK; \
+ int widthStep; \
+ widthStep = widthDst - nmiddle - leftAdjust; \
+ nmiddle >>= RROP_UNROLL_SHIFT; \
+ pdst = pdstRect; \
+ while (h--) { \
+ left \
+ pdst += part; \
+ switch (part) { \
+ RROP_UNROLL_CASE(pdst) \
+ } \
+ m = nmiddle; \
+ while (m) { \
+ pdst += RROP_UNROLL; \
+ RROP_UNROLL_LOOP(pdst) \
+ m--; \
+ } \
+ right \
+ pdst += widthStep; \
+ } \
+}
+
+# else
+# define Expand(left, right, leftAdjust) { \
+ while (h--) { \
+ pdst = pdstRect; \
+ left \
+ m = nmiddle; \
+ while (m--) {\
+ RROP_SOLID(pdst); \
+ pdst++; \
+ } \
+ right \
+ pdstRect += widthDst; \
+ } \
+}
+# endif
+#endif
+
+
+void
+RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox;
+ BoxPtr pBox;
+{
+ register int m;
+ register unsigned long *pdst;
+ RROP_DECLARE
+ register unsigned long leftMask, rightMask;
+ unsigned long *pdstBase, *pdstRect;
+ int nmiddle;
+ int h;
+ int w;
+ int widthDst;
+#if PSZ == 24
+ int leftIndex, rightIndex, xOffset;
+#endif
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ RROP_FETCH_GC(pGC)
+
+ for (; nBox; nBox--, pBox++)
+ {
+ pdstRect = pdstBase + pBox->y1 * widthDst;
+ h = pBox->y2 - pBox->y1;
+ w = pBox->x2 - pBox->x1;
+#if PSZ == 8
+ if (w == 1)
+ {
+ register char *pdstb = ((char *) pdstRect) + pBox->x1;
+ int incr = widthDst * PGSZB;
+
+ while (h--)
+ {
+ RROP_SOLID (pdstb);
+ pdstb += incr;
+ }
+ }
+ else
+ {
+#endif
+#if PSZ == 24
+ leftIndex = pBox->x1 &3;
+/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/
+ rightIndex = pBox->x2 &3;
+
+ nmiddle = w - rightIndex;
+ if(leftIndex){
+ nmiddle -= (4 - leftIndex);
+ }
+ nmiddle >>= 2;
+ if(nmiddle < 0)
+ nmiddle = 0;
+
+ pdstRect += (pBox->x1 * 3) >> 2;
+ pdst = pdstRect;
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ pdst += widthDst;
+ }
+ break;
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 3:
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 2: /* leftIndex + w = 2*/
+ switch(leftIndex){
+ case 2:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+ *pdst-- &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 1:
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*case 2 leftIndex == 0 */
+ while(h--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ pdst += widthDst;
+ }
+ break;
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+ while(h--){
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[0] | 0xFF000000);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ pdst += widthDst;
+ }
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ while(h--){
+ pdst = pdstRect;
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ pdst++;
+#endif
+ break;
+ }
+ m = nmiddle;
+ while(m--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst++ = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ *pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ *pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst++;
+#endif
+ break;
+ }
+ pdstRect += widthDst;
+ }
+ }
+ }
+#else /* PSZ != 24 */
+ pdstRect += (pBox->x1 >> PWSH);
+ if ((pBox->x1 & PIM) + w <= PPW)
+ {
+ maskpartialbits(pBox->x1, w, leftMask);
+ pdst = pdstRect;
+ while (h--) {
+ RROP_SOLID_MASK (pdst, leftMask);
+ pdst += widthDst;
+ }
+ }
+ else
+ {
+ maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);
+ if (leftMask)
+ {
+ if (rightMask) /* left mask and right mask */
+ {
+ Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;,
+ RROP_SOLID_MASK (pdst, rightMask);, 1)
+ }
+ else /* left mask and no right mask */
+ {
+ Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;,
+ ;, 1)
+ }
+ }
+ else
+ {
+ if (rightMask) /* no left mask and right mask */
+ {
+ Expand(;,
+ RROP_SOLID_MASK (pdst, rightMask);, 0)
+ }
+ else /* no left mask and no right mask */
+ {
+ Expand(;,
+ ;, 0)
+ }
+ }
+ }
+#endif
+#if PSZ == 8
+ }
+#endif
+ }
+}
+
+void
+RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ unsigned long *pdstBase;
+ int widthDst;
+
+ RROP_DECLARE
+
+ register unsigned long *pdst;
+ register int nlmiddle;
+ register unsigned long startmask, endmask;
+ register int w;
+ int x;
+
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidthFree;/* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ int *pwidth;
+ cfbPrivGCPtr devPriv;
+#if PSZ == 24
+ int leftIndex, rightIndex, xOffset;
+#endif
+
+ devPriv = cfbGetGCPrivate(pGC);
+ RROP_FETCH_GCPRIV(devPriv)
+ n = nInit * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ while (n--)
+ {
+ x = ppt->x;
+ pdst = pdstBase + (ppt->y * widthDst);
+ ++ppt;
+ w = *pwidth++;
+ if (!w)
+ continue;
+#if PSZ == 24
+ leftIndex = x &3;
+/* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/
+ rightIndex = (x+w)&3;
+
+ nlmiddle = w - rightIndex;
+ if(leftIndex){
+ nlmiddle -= (4 - leftIndex);
+ }
+/* nlmiddle += 3;*/
+ nlmiddle >>= 2;
+ if(nlmiddle < 0)
+ nlmiddle = 0;
+
+ pdst += (x >> 2)*3;
+ pdst += leftIndex? (leftIndex -1):0;
+ switch(leftIndex+w){
+ case 4:
+ switch(leftIndex){
+ case 0:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst--;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+#endif
+ break;
+ }
+ break;
+ case 3:
+ switch(leftIndex){
+ case 0:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ pdst--;
+ break;
+ case 2:
+/* pdst++;*/
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
+ *pdst-- ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst-- |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst--;
+#endif
+ break;
+ }
+ break;
+ case 2: /* leftIndex + w = 2*/
+ if(leftIndex){
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ }
+ else{ /*case 2 leftIndex === 0 */
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst-- ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst-- |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ pdst--;
+#endif
+ }
+ break;
+ case 1: /*only if leftIndex = 0 and w = 1*/
+#if RROP == GXcopy
+ *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst &= (piQxelAnd[0] | 0xFF000000);
+#endif
+#if RROP == GXor
+ *pdst |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ break;
+ case 0: /*never*/
+ break;
+ default:
+ {
+ switch(leftIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFF000000);
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFF000000);
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF);
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[2] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
+ pdst++;
+#endif
+ break;
+ }
+ while(nlmiddle--){
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = piQxelXor[2];
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= piQxelXor[2];
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= piQxelAnd[2];
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= piQxelOr[2];
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
+ pdst++;
+#endif
+ }
+ switch(rightIndex){
+ case 0:
+ break;
+ case 1:
+#if RROP == GXcopy
+ *pdst++ = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= (piQxelAnd[0] | 0xFF);
+#endif
+#if RROP == GXor
+ *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
+#endif
+ break;
+ case 2:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= (piQxelXor[1] & 0xFFFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= (piQxelOr[1] & 0xFFFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ *pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
+ *pdst++;
+#endif
+ break;
+ case 3:
+#if RROP == GXcopy
+ *pdst++ = piQxelXor[0];
+ *pdst++ = piQxelXor[1];
+ *pdst++ = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXxor
+ *pdst++ ^= piQxelXor[0];
+ *pdst++ ^= piQxelXor[1];
+ *pdst++ ^= (piQxelXor[2] & 0xFF);
+#endif
+#if RROP == GXand
+ *pdst++ &= piQxelAnd[0];
+ *pdst++ &= piQxelAnd[1];
+ *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
+#endif
+#if RROP == GXor
+ *pdst++ |= piQxelOr[0];
+ *pdst++ |= piQxelOr[1];
+ *pdst++ |= (piQxelOr[2] & 0xFF);
+#endif
+#if RROP == GXset
+ *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
+ pdst++;
+ *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
+ pdst++;
+ *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
+ pdst++;
+#endif
+ break;
+ }
+ }
+}
+#else
+#if PSZ == 8
+ if (w <= PGSZB)
+ {
+ register char *addrb;
+
+ addrb = ((char *) pdst) + x;
+ while (w--)
+ {
+ RROP_SOLID (addrb);
+ addrb++;
+ }
+ }
+#else
+ if ((x & PIM) + w <= PPW)
+ {
+ pdst += x >> PWSH;
+ maskpartialbits (x, w, startmask);
+ RROP_SOLID_MASK (pdst, startmask);
+ }
+#endif
+ else
+ {
+ pdst += x >> PWSH;
+ maskbits (x, w, startmask, endmask, nlmiddle);
+ if (startmask)
+ {
+ RROP_SOLID_MASK (pdst, startmask);
+ ++pdst;
+ }
+
+ RROP_SPAN(pdst,nlmiddle)
+ if (endmask)
+ {
+ RROP_SOLID_MASK (pdst, endmask);
+ }
+ }
+#endif
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
diff --git a/xc/programs/Xserver/cfb/cfbteblt8.c b/xc/programs/Xserver/cfb/cfbteblt8.c
new file mode 100644
index 000000000..25a2b8b28
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbteblt8.c
@@ -0,0 +1,579 @@
+/*
+ * TEGblt - ImageText expanded glyph fonts only. For
+ * 8 bit displays, in Copy mode with no clipping.
+ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/* $TOG: cfbteblt8.c /main/26 1998/02/09 14:07:48 kaleb $ */
+
+#if PSZ == 8
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "cfb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+/*
+ * this code supports up to 5 characters at a time. The performance
+ * differences between 4 and 5 is usually small (~7% on PMAX) and
+ * frequently negative (SPARC and Sun3), so this file is compiled
+ * only once for now. If you want to use the other options, you'll
+ * need to hack cfbgc.c as well.
+ */
+
+#ifndef NGLYPHS
+#define NGLYPHS 4
+#define DO_COMMON
+#endif
+
+#ifdef DO_COMMON
+#define CFBTEGBLT8 cfbTEGlyphBlt8
+#endif
+
+/*
+ * On little-endian machines (or where fonts are padded to 32-bit
+ * boundaries) we can use some magic to avoid the expense of getleftbits
+ */
+
+#if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4)
+
+#if GLYPHPADBYTES == 1
+typedef unsigned char *glyphPointer;
+#define USE_LEFTBITS
+#endif
+
+#if GLYPHPADBYTES == 2
+typedef unsigned short *glyphPointer;
+#define USE_LEFTBITS
+#endif
+
+#if GLYPHPADBYTES == 4
+typedef unsigned int *glyphPointer;
+#endif
+
+#define GetBitsL c = BitLeft (*leftChar++, lshift)
+#define NGetBits1S(r) c = BitRight(*char1++ r, xoff1)
+#define NGetBits1L(r) GetBitsL | BitRight(*char1++ r, xoff1)
+#define NGetBits1U(r) c = *char1++ r
+#define NGetBits2S(r) NGetBits1S(| BitRight(*char2++ r, widthGlyph))
+#define NGetBits2L(r) NGetBits1L(| BitRight(*char2++ r, widthGlyph))
+#define NGetBits2U(r) NGetBits1U(| BitRight(*char2++ r, widthGlyph))
+#define NGetBits3S(r) NGetBits2S(| BitRight(*char3++ r, widthGlyph))
+#define NGetBits3L(r) NGetBits2L(| BitRight(*char3++ r, widthGlyph))
+#define NGetBits3U(r) NGetBits2U(| BitRight(*char3++ r, widthGlyph))
+#define NGetBits4S(r) NGetBits3S(| BitRight(*char4++ r, widthGlyph))
+#define NGetBits4L(r) NGetBits3L(| BitRight(*char4++ r, widthGlyph))
+#define NGetBits4U(r) NGetBits3U(| BitRight(*char4++ r, widthGlyph))
+#define NGetBits5S(r) NGetBits4S(| BitRight(*char5++ r, widthGlyph))
+#define NGetBits5L(r) NGetBits4L(| BitRight(*char5++ r, widthGlyph))
+#define NGetBits5U(r) NGetBits4U(| BitRight(*char5++ r, widthGlyph))
+#define GetBits1S c = BitRight(*char1++, xoff1)
+#define GetBits1L GetBitsL | BitRight(*char1++, xoff1)
+#define GetBits1U c = *char1++
+#define GetBits2S NGetBits1S(| BitRight(*char2++, widthGlyph))
+#define GetBits2L NGetBits1L(| BitRight(*char2++, widthGlyph))
+#define GetBits2U NGetBits1U(| BitRight(*char2++, widthGlyph))
+#define GetBits3S NGetBits2S(| BitRight(*char3++, widthGlyph))
+#define GetBits3L NGetBits2L(| BitRight(*char3++, widthGlyph))
+#define GetBits3U NGetBits2U(| BitRight(*char3++, widthGlyph))
+#define GetBits4S NGetBits3S(| BitRight(*char4++, widthGlyph))
+#define GetBits4L NGetBits3L(| BitRight(*char4++, widthGlyph))
+#define GetBits4U NGetBits3U(| BitRight(*char4++, widthGlyph))
+#define GetBits5S NGetBits4S(| BitRight(*char5++, widthGlyph))
+#define GetBits5L NGetBits4L(| BitRight(*char5++, widthGlyph))
+#define GetBits5U NGetBits4U(| BitRight(*char5++, widthGlyph))
+
+#else
+
+typedef unsigned int *glyphPointer;
+
+#define USE_LEFTBITS
+#define ALL_LEFTBITS
+
+#define GetBitsL WGetBitsL
+#define GetBits1S WGetBits1S
+#define GetBits1L WGetBits1L
+#define GetBits1U WGetBits1U
+
+#define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff2);
+#define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff2);
+#define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff2);
+
+#define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff3);
+#define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff3);
+#define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff3);
+
+#define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff4);
+#define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff4);
+#define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff4);
+
+#define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff5);
+#define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff5);
+#define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \
+ c |= BitRight(tmpSrc, xoff5);
+
+#endif
+
+#ifdef USE_LEFTBITS
+extern unsigned long endtab[];
+
+#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes))
+
+#define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \
+ IncChar (ch);
+
+#define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \
+ dst &= mask;
+
+#define WGetBitsL Get1Bits(leftChar,c); \
+ c = BitLeft (c, lshift);
+#define WGetBits1S Get1Bits (char1, c) \
+ c = BitRight (c, xoff1);
+#define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \
+ c |= BitRight (tmpSrc, xoff1);
+#define WGetBits1U Get1Bits (char1, c)
+
+#else
+#define WGetBitsL GetBitsL
+#define WGetBits1S GetBits1S
+#define WGetBits1L GetBits1L
+#define WGetBits1U GetBits1U
+#endif
+
+#if NGLYPHS == 2
+# define GetBitsNS GetBits2S
+# define GetBitsNL GetBits2L
+# define GetBitsNU GetBits2U
+# define LastChar char2
+#ifndef CFBTEGBLT8
+# define CFBTEGBLT8 cfbTEGlyphBlt8x2
+#endif
+#endif
+#if NGLYPHS == 3
+# define GetBitsNS GetBits3S
+# define GetBitsNL GetBits3L
+# define GetBitsNU GetBits3U
+# define LastChar char3
+#ifndef CFBTEGBLT8
+# define CFBTEGBLT8 cfbTEGlyphBlt8x3
+#endif
+#endif
+#if NGLYPHS == 4
+# define GetBitsNS GetBits4S
+# define GetBitsNL GetBits4L
+# define GetBitsNU GetBits4U
+# define LastChar char4
+#ifndef CFBTEGBLT8
+# define CFBTEGBLT8 cfbTEGlyphBlt8x4
+#endif
+#endif
+#if NGLYPHS == 5
+# define GetBitsNS GetBits5S
+# define GetBitsNL GetBits5L
+# define GetBitsNU GetBits5U
+# define LastChar char5
+#ifndef CFBTEGBLT8
+# define CFBTEGBLT8 cfbTEGlyphBlt8x5
+#endif
+#endif
+
+/* another ugly giant macro */
+#define SwitchEm switch (ew) \
+ { \
+ case 0: \
+ break; \
+ case 1: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 \
+ Loop \
+ } \
+ break; \
+ case 2: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) \
+ Loop \
+ } \
+ break; \
+ case 3: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \
+ Loop \
+ } \
+ break; \
+ case 4: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step \
+ StoreBits(2) Step StoreBits(3) \
+ Loop \
+ } \
+ break; \
+ case 5: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step \
+ StoreBits(2) Step StoreBits(3) Step \
+ StoreBits(4) \
+ Loop \
+ } \
+ break; \
+ case 6: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step \
+ StoreBits(2) Step StoreBits(3) Step \
+ StoreBits(4) Step StoreBits(5) \
+ Loop \
+ } \
+ break; \
+ case 7: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step \
+ StoreBits(2) Step StoreBits(3) Step \
+ StoreBits(4) Step StoreBits(5) Step \
+ StoreBits(6) \
+ Loop \
+ } \
+ break; \
+ case 8: \
+ while (hTmp--) { \
+ GetBits; \
+ StoreBits0 FirstStep StoreBits(1) Step \
+ StoreBits(2) Step StoreBits(3) Step \
+ StoreBits(4) Step StoreBits(5) Step \
+ StoreBits(6) Step StoreBits(7) \
+ Loop \
+ } \
+ break; \
+ }
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+#define StorePixels(o,p) dst[o] = p
+#define Loop dst += widthDst;
+#else
+#define StorePixels(o,p) *dst++ = (p)
+#define Loop dst += widthLeft;
+#endif
+
+#define Step NextBitGroup(c);
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define StoreBits(o) StorePixels(o,GetPixelGroup(c));
+#define FirstStep Step
+#else
+#if PGSZ == 64
+#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]);
+#define FirstStep Step
+#else /* PGSZ == 32 */
+#define StoreBits(o) StorePixels(o,*((unsigned long *) (((char *) cfb8Pixels) + (c & 0x3c))));
+#define FirstStep c = BitLeft (c, 2);
+#endif /* PGSZ */
+#endif /* BITMAP_BIT_ORDER */
+
+
+void
+CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int xInit, yInit;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ register unsigned long c;
+ register unsigned long *dst;
+ register unsigned long leftMask, rightMask;
+ register int hTmp;
+ register int xoff1;
+ register glyphPointer char1;
+ register glyphPointer char2;
+#if NGLYPHS >= 3
+ register glyphPointer char3;
+#endif
+#if NGLYPHS >= 4
+ register glyphPointer char4;
+#endif
+#if NGLYPHS >= 5
+ register glyphPointer char5;
+#endif
+#ifdef ALL_LEFTBITS
+ int xoff2, xoff3, xoff4, xoff5;
+#endif
+
+ FontPtr pfont = pGC->font;
+ unsigned long *dstLine;
+ glyphPointer oldRightChar;
+ unsigned long *pdstBase;
+ glyphPointer leftChar;
+ int widthDst, widthLeft;
+ int widthGlyph;
+ int h;
+ int ew;
+ int x, y;
+ BoxRec bbox; /* for clipping */
+ int lshift;
+ int widthGlyphs;
+#ifdef USE_LEFTBITS
+ register unsigned long glyphMask;
+ register unsigned long tmpSrc;
+ register int glyphBytes;
+#endif
+
+ widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
+ h = FONTASCENT(pfont) + FONTDESCENT(pfont);
+ if (!h)
+ return;
+ x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x;
+ y = yInit - FONTASCENT(pfont) + pDrawable->y;
+ bbox.x1 = x;
+ bbox.x2 = x + (widthGlyph * nglyph);
+ bbox.y1 = y;
+ bbox.y2 = y + h;
+
+ switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
+ {
+ case rgnPART:
+ cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+ case rgnOUT:
+ return;
+ }
+
+ if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel))
+ cfb8SetPixels (pGC->fgPixel, pGC->bgPixel);
+
+ leftChar = 0;
+
+ cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase)
+
+#if NGLYPHS == 2
+ widthGlyphs = widthGlyph << 1;
+#else
+#if NGLYPHS == 4
+ widthGlyphs = widthGlyph << 2;
+#else
+ widthGlyphs = widthGlyph * NGLYPHS;
+#endif
+#endif
+
+#ifdef USE_LEFTBITS
+ glyphMask = endtab[widthGlyph];
+ glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
+#endif
+
+ pdstBase += y * widthDst;
+#ifdef DO_COMMON
+ if (widthGlyphs <= 32)
+#endif
+ while (nglyph >= NGLYPHS)
+ {
+ nglyph -= NGLYPHS;
+ hTmp = h;
+ dstLine = pdstBase + (x >> PWSH);
+ xoff1 = x & PIM;
+ char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+ char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+#ifdef ALL_LEFTBITS
+ xoff2 = xoff1 + widthGlyph;
+#endif
+#if NGLYPHS >= 3
+ char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+#ifdef ALL_LEFTBITS
+ xoff3 = xoff2 + widthGlyph;
+#endif
+#endif
+#if NGLYPHS >= 4
+ char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+#ifdef ALL_LEFTBITS
+ xoff4 = xoff3 + widthGlyph;
+#endif
+#endif
+#if NGLYPHS >= 5
+ char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+#ifdef ALL_LEFTBITS
+ xoff5 = xoff4 + widthGlyph;
+#endif
+#endif
+ oldRightChar = LastChar;
+ dst = dstLine;
+ if (xoff1)
+ {
+ ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1;
+#ifndef FAST_CONSTANT_OFFSET_MODE
+ widthLeft = widthDst - ew;
+#endif
+ if (!leftChar)
+ {
+ leftMask = cfbendtab[xoff1];
+ rightMask = cfbstarttab[xoff1];
+
+#define StoreBits0 StorePixels (0,dst[0] & leftMask | \
+ GetPixelGroup(c) & rightMask);
+#define GetBits GetBitsNS
+
+ SwitchEm
+
+#undef GetBits
+#undef StoreBits0
+
+ }
+ else
+ {
+ lshift = widthGlyph - xoff1;
+
+#define StoreBits0 StorePixels (0,GetPixelGroup(c));
+#define GetBits GetBitsNL
+
+ SwitchEm
+
+#undef GetBits
+#undef StoreBits0
+
+ }
+ }
+ else
+ {
+#if NGLYPHS == 4 && PGSZ == 32
+ ew = widthGlyph; /* widthGlyphs >> 2 */
+#else
+ ew = widthGlyphs >> PWSH;
+#endif
+#ifndef FAST_CONSTANT_OFFSET_MODE
+ widthLeft = widthDst - ew;
+#endif
+
+#define StoreBits0 StorePixels (0,GetPixelGroup(c));
+#define GetBits GetBitsNU
+
+ SwitchEm
+
+#undef GetBits
+#undef StoreBits0
+
+ }
+ x += widthGlyphs;
+ leftChar = oldRightChar;
+ }
+ while (nglyph--)
+ {
+ xoff1 = x & PIM;
+ char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
+ hTmp = h;
+ dstLine = pdstBase + (x >> PWSH);
+ oldRightChar = char1;
+ dst = dstLine;
+ if (xoff1)
+ {
+ ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1;
+#ifndef FAST_CONSTANT_OFFSET_MODE
+ widthLeft = widthDst - ew;
+#endif
+ if (!leftChar)
+ {
+ leftMask = cfbendtab[xoff1];
+ rightMask = cfbstarttab[xoff1];
+
+#define StoreBits0 StorePixels (0,dst[0] & leftMask | GetPixelGroup(c) & rightMask);
+#define GetBits WGetBits1S
+
+ SwitchEm
+#undef GetBits
+#undef StoreBits0
+
+ }
+ else
+ {
+ lshift = widthGlyph - xoff1;
+
+#define StoreBits0 StorePixels (0,GetPixelGroup(c));
+#define GetBits WGetBits1L
+
+ SwitchEm
+#undef GetBits
+#undef StoreBits0
+
+ }
+ }
+ else
+ {
+ ew = widthGlyph >> PWSH;
+
+#ifndef FAST_CONSTANT_OFFSET_MODE
+ widthLeft = widthDst - ew;
+#endif
+
+#define StoreBits0 StorePixels (0,GetPixelGroup(c));
+#define GetBits WGetBits1U
+
+ SwitchEm
+
+#undef GetBits
+#undef StoreBits0
+
+ }
+ x += widthGlyph;
+ leftChar = oldRightChar;
+ }
+ /*
+ * draw the tail of the last character
+ */
+ xoff1 = x & PIM;
+ if (xoff1)
+ {
+ rightMask = cfbstarttab[xoff1];
+ leftMask = cfbendtab[xoff1];
+ lshift = widthGlyph - xoff1;
+ dst = pdstBase + (x >> PWSH);
+ hTmp = h;
+ while (hTmp--)
+ {
+ GetBitsL;
+ *dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask);
+ dst += widthDst;
+ }
+ }
+}
+#endif /* PSZ == 8 */
diff --git a/xc/programs/Xserver/cfb/cfbtegblt.c b/xc/programs/Xserver/cfb/cfbtegblt.c
new file mode 100644
index 000000000..460d9a1d6
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbtegblt.c
@@ -0,0 +1,221 @@
+/* $TOG: cfbtegblt.c /main/15 1998/02/09 14:07:55 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $XFree86: xc/programs/Xserver/cfb/cfbtegblt.c,v 3.2 1998/10/04 09:37:52 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "cfb.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+#include "mi.h"
+#define MFB_CONSTS_ONLY
+#include "maskbits.h"
+
+/*
+ this works for fonts with glyphs <= 32 bits wide, on an
+ arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays.
+
+ This should be called only with a terminal-emulator font;
+this means that the FIXED_METRICS flag is set, and that
+glyphbounds == charbounds.
+
+ in theory, this goes faster; even if it doesn't, it reduces the
+flicker caused by writing a string over itself with image text (since
+the background gets repainted per character instead of per string.)
+this seems to be important for some converted X10 applications.
+
+ Image text looks at the bits in the glyph and the fg and bg in the
+GC. it paints a rectangle, as defined in the protocol dcoument,
+and the paints the characters.
+
+*/
+
+void
+cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ FontPtr pfont = pGC->font;
+ int widthDst;
+ unsigned long *pdstBase; /* pointer to longword with top row
+ of current glyph */
+
+ int w; /* width of glyph and char */
+ int h; /* height of glyph and char */
+ register int xpos=x; /* current x%32 */
+ int ypos=y; /* current y%32 */
+ register unsigned char *pglyph;
+ int widthGlyph;
+
+ register unsigned long *pdst;/* pointer to current longword in dst */
+ int hTmp; /* counter for height */
+ BoxRec bbox; /* for clipping */
+
+ register int wtmp,xtemp,width;
+ unsigned long bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp;
+ int tmpx;
+#if PSZ == 24
+ int xIndex;
+#endif
+
+ xpos += pDrawable->x;
+ ypos += pDrawable->y;
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ wtmp = FONTMAXBOUNDS(pfont,characterWidth);
+ h = FONTASCENT(pfont) + FONTDESCENT(pfont);
+ widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci);
+
+ xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
+ ypos -= FONTASCENT(pfont);
+
+ bbox.x1 = xpos;
+ bbox.x2 = xpos + (wtmp * nglyph);
+ bbox.y1 = ypos;
+ bbox.y2 = ypos + h;
+
+ fgfill = PFILL(pGC->fgPixel);
+ bgfill = PFILL(pGC->bgPixel);
+
+ switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
+ {
+ case rgnOUT:
+ break;
+ case rgnPART:
+ /* this is the WRONG thing to do, but it works.
+ calling the non-terminal text is easy, but slow, given
+ what we know about the font.
+
+ the right thing to do is something like:
+ for each clip rectangle
+ compute at which row the glyph starts to be in it,
+ and at which row the glyph ceases to be in it
+ compute which is the first glyph inside the left
+ edge, and the last one inside the right edge
+ draw a fractional first glyph, using only
+ the rows we know are in
+ draw all the whole glyphs, using the appropriate rows
+ draw any pieces of the last glyph, using the right rows
+
+ this way, the code would take advantage of knowing that
+ all glyphs are the same height and don't overlap.
+
+ one day...
+ */
+ cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ break;
+ case rgnIN:
+
+ pdtmp = pdstBase + (widthDst * ypos);
+ while(nglyph--)
+ {
+
+ pglyph = FONTGLYPHBITS(pglyphBase, *ppci++);
+ pdst = pdtmp;
+ hTmp = h;
+
+ while (hTmp--)
+ {
+ x = xpos;
+ width = wtmp;
+ xtemp = 0;
+
+ while (width > 0)
+ {
+#if PSZ == 24
+ tmpx = x & 3;
+ w = 1;
+#else
+ tmpx = x & PIM;
+ w = min(width, PPW - tmpx);
+ w = min(w, (PGSZ - xtemp));
+#endif
+
+#if PSZ == 24
+ ptemp = (unsigned long *)(pglyph + ((xtemp *3)>> 2));
+#else
+ ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH));
+#endif
+#if PSZ == 24
+ getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp);
+ getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp);
+#else
+ getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1);
+ getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2);
+#endif
+
+ {
+ unsigned long tmpDst = tmpDst1 | tmpDst2;
+#if PSZ == 24
+ unsigned long *pdsttmp = pdst + ((x*3) >> 2);
+ putbits24(tmpDst,tmpx,w,pdsttmp,pGC->planemask,x);
+#else
+ unsigned long *pdsttmp = pdst + (x >> PWSH);
+ putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask);
+#endif
+ }
+ x += w;
+ xtemp += w;
+ width -= w;
+ }
+ pglyph += widthGlyph;
+ pdst += widthDst;
+ }
+ xpos += wtmp;
+ }
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbtile32.c b/xc/programs/Xserver/cfb/cfbtile32.c
new file mode 100644
index 000000000..8b454226a
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbtile32.c
@@ -0,0 +1,495 @@
+/*
+ * Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow.
+ * no depth dependencies.
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbtile32.c,v 3.2 1998/10/04 09:37:52 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/* $TOG: cfbtile32.c /main/9 1998/02/09 14:08:01 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+#include "mergerop.h"
+
+#include "mi.h"
+#include "mispans.h"
+
+#ifdef sparc
+#define SHARED_IDCACHE
+#endif
+
+#if PSZ == 24
+#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
+/*#define STORE24(p,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<<cfb24Shift[idx])&cfbmask[idx])| \
+ (*(p)&cfbrmask[idx])); \
+ idx++; \
+ (p)++; \
+ *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))>>cfb24Shift[idx])&cfbmask[idx])| \
+ (*(p)&cfbrmask[idx])); \
+ (p)--; \
+ }*/
+#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index)
+
+#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask)))
+#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \
+ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
+ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
+
+#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+# define Expand(left,right) {\
+ int part = nlwMiddle & ((PGSZB*2)-1); \
+ nlwMiddle *= 3; \
+ nlwMiddle >>= PWSH + 3; \
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ p += part; \
+ switch (part) { \
+ case 7: \
+ STORE24(p - 7, xtmp - 7); \
+ case 6: \
+ STORE24(p - 6, xtmp - 6); \
+ case 5: \
+ STORE24(p - 5, xtmp - 5); \
+ case 4: \
+ STORE24(p - 4, xtmp - 4); \
+ case 3: \
+ STORE24(p - 3, xtmp - 3); \
+ case 2: \
+ STORE24(p - 2, xtmp - 2); \
+ case 1: \
+ STORE24(p - 1, xtmp - 1); \
+ } \
+ nlw = nlwMiddle; \
+ while (nlw) { \
+ STORE24 (p + 0, xtmp + 0); \
+ STORE24 (p + 1, xtmp + 1); \
+ STORE24 (p + 2, xtmp + 2); \
+ STORE24 (p + 3, xtmp + 3); \
+ STORE24 (p + 4, xtmp + 4); \
+ STORE24 (p + 5, xtmp + 5); \
+ STORE24 (p + 6, xtmp + 6); \
+ STORE24 (p + 7, xtmp + 7); \
+ p += 8; \
+ xtmp += 8; \
+ nlw--; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#else
+#define Expand(left,right) {\
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ while (nlw--) \
+ { \
+ STORE24(p,xtmp); \
+ if(xtmp&3) p++; \
+ xtmp++; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#endif
+#else /*PSZ != 24*/
+#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
+
+#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
+# define Expand(left,right) {\
+ int part = nlwMiddle & ((PGSZB*2)-1); \
+ nlwMiddle >>= PWSH + 1; \
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ p += part; \
+ switch (part) { \
+ case 7: \
+ STORE(p - 7); \
+ case 6: \
+ STORE(p - 6); \
+ case 5: \
+ STORE(p - 5); \
+ case 4: \
+ STORE(p - 4); \
+ case 3: \
+ STORE(p - 3); \
+ case 2: \
+ STORE(p - 2); \
+ case 1: \
+ STORE(p - 1); \
+ } \
+ nlw = nlwMiddle; \
+ while (nlw) { \
+ STORE (p + 0); \
+ STORE (p + 1); \
+ STORE (p + 2); \
+ STORE (p + 3); \
+ STORE (p + 4); \
+ STORE (p + 5); \
+ STORE (p + 6); \
+ STORE (p + 7); \
+ p += 8; \
+ nlw--; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#else
+#define Expand(left,right) {\
+ while (h--) { \
+ srcpix = psrc[srcy]; \
+ MROP_PREBUILD(srcpix); \
+ ++srcy; \
+ if (srcy == tileHeight) \
+ srcy = 0; \
+ left \
+ nlw = nlwMiddle; \
+ while (nlw--) \
+ { \
+ STORE(p); \
+ p++; \
+ } \
+ right \
+ p += nlwExtra; \
+ } \
+}
+#endif
+#endif /*PSZ == 24*/
+
+void
+MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox; /* number of boxes to fill */
+ BoxPtr pBox; /* pointer to list of boxes to fill */
+{
+ register unsigned long srcpix;
+ unsigned long *psrc; /* pointer to bits in tile, if needed */
+ int tileHeight; /* height of the tile */
+
+ int nlwDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current box */
+ register int h; /* height of current box */
+ register unsigned long startmask;
+ register unsigned long endmask; /* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ int nlwExtra; /* to get from right of box to left of next span */
+ register int nlw; /* loop version of nlwMiddle */
+ register unsigned long *p; /* pointer to bits we're writing */
+ int y; /* current scan line */
+ int srcy; /* current tile position */
+
+ unsigned long *pbits;/* pointer to start of pixmap */
+ PixmapPtr tile; /* rotated, expanded tile */
+ MROP_DECLARE_REG()
+ MROP_PREBUILT_DECLARE()
+#if PSZ == 24
+ unsigned long xtmp;
+#endif
+
+ tile = pGC->pRotatedPixmap;
+ tileHeight = tile->drawable.height;
+ psrc = (unsigned long *)tile->devPrivate.ptr;
+
+ MROP_INITIALIZE(pGC->alu, pGC->planemask);
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+ while (nBox--)
+ {
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ y = pBox->y1;
+#if PSZ == 24
+ xtmp = pBox->x1;
+ p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2);
+/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/
+#else
+ p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH);
+#endif
+ srcy = y % tileHeight;
+
+#if PSZ == 24
+ if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3))
+#else
+ if ( ((pBox->x1 & PIM) + w) <= PPW)
+#endif
+ {
+ maskpartialbits(pBox->x1, w, startmask);
+ nlwExtra = nlwDst;
+ while (h--)
+ {
+ srcpix = psrc[srcy];
+ MROP_PREBUILD(srcpix);
+ ++srcy;
+ if (srcy == tileHeight)
+ srcy = 0;
+ *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
+ p += nlwExtra;
+ }
+ }
+ else
+ {
+ maskbits(pBox->x1, w, startmask, endmask, nlwMiddle);
+ nlwExtra = nlwDst - nlwMiddle;
+
+ if (startmask)
+ {
+ nlwExtra -= 1;
+ if (endmask)
+ {
+ Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
+ *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
+ }
+ else
+ {
+ Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
+ ;)
+ }
+ }
+ else
+ {
+ if (endmask)
+ {
+ Expand(;,
+ *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
+ }
+ else
+ {
+ Expand(;,
+ ;)
+ }
+ }
+ }
+ pBox++;
+ }
+}
+
+void
+MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nInit; /* number of spans to fill */
+ DDXPointPtr pptInit; /* pointer to list of start points */
+ int *pwidthInit; /* pointer to list of n widths */
+ int fSorted;
+{
+ /* next three parameters are post-clip */
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidth;/* pointer to list of n widths */
+ unsigned long *pbits; /* pointer to start of bitmap */
+ int nlwDst; /* width in longwords of bitmap */
+ register unsigned long *p; /* pointer to current longword in bitmap */
+ register int w; /* current span width */
+ register int nlw;
+ register int x;
+ register unsigned long startmask;
+ register unsigned long endmask;
+ register unsigned long srcpix;
+ int y;
+ int *pwidthFree;/* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ PixmapPtr tile;
+ unsigned long *psrc; /* pointer to bits in tile */
+ int tileHeight;/* height of the tile */
+ MROP_DECLARE_REG ()
+ MROP_PREBUILT_DECLARE()
+#if PSZ == 24
+ unsigned long xtmp;
+#endif
+
+ n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
+ pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ n = miClipSpans( cfbGetCompositeClip(pGC),
+ pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted);
+
+ tile = pGC->pRotatedPixmap;
+ tileHeight = tile->drawable.height;
+ psrc = (unsigned long *)tile->devPrivate.ptr;
+
+ MROP_INITIALIZE(pGC->alu, pGC->planemask);
+
+ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
+
+#if MROP == Mcopy
+ if (!(tileHeight & (tileHeight-1)))
+ {
+ tileHeight--;
+ while (n--)
+ {
+ x = ppt->x;
+ y = ppt->y;
+ ++ppt;
+ w = *pwidth++;
+#if PSZ == 24
+/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/
+ xtmp = x;
+ p = pbits + (y * nlwDst) + ((x >> 2)*3);
+#else
+ p = pbits + (y * nlwDst) + (x >> PWSH);
+#endif
+ srcpix = psrc[y & tileHeight];
+ MROP_PREBUILD(srcpix);
+
+#if PSZ == 24
+ if ((x & 3) + w < 5)
+#else
+ if ((x & PIM) + w < PPW)
+#endif
+ {
+ maskpartialbits(x, w, startmask);
+ *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
+ }
+ else
+ {
+ maskbits(x, w, startmask, endmask, nlw);
+ if (startmask)
+ {
+ *p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
+#if PSZ == 24
+ if(xtmp&3) p++;
+ xtmp++;
+#else
+ p++;
+#endif
+ }
+ while (nlw--)
+ {
+#if PSZ == 24
+ STORE24(p,xtmp);
+ if(xtmp&3) p++;
+ ++xtmp;
+#else
+ STORE(p);
+ ++p;
+#endif
+ }
+ if (endmask)
+ {
+ *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
+ }
+ }
+ }
+ }
+ else
+#endif
+ {
+ while (n--)
+ {
+ x = ppt->x;
+ y = ppt->y;
+ ++ppt;
+ w = *pwidth++;
+#if PSZ == 24
+/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/
+ p = pbits + (y * nlwDst) + ((x >> 2)*3);
+ xtmp = x;
+#else
+ p = pbits + (y * nlwDst) + (x >> PWSH);
+#endif
+ srcpix = psrc[y % tileHeight];
+ MROP_PREBUILD(srcpix);
+
+#if PSZ == 24
+ if ((x & 3) + w < 5)
+#else
+ if ((x & PIM) + w < PPW)
+#endif
+ {
+ maskpartialbits(x, w, startmask);
+ *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
+ }
+ else
+ {
+ maskbits(x, w, startmask, endmask, nlw);
+ if (startmask)
+ {
+ *p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
+#if PSZ == 24
+ if(xtmp&3)p++;
+ xtmp++;
+#else
+ p++;
+#endif
+ }
+ while (nlw--)
+ {
+#if PSZ == 24
+ STORE24(p,xtmp);
+ if(xtmp&3)p++;
+ xtmp++;
+#else
+ STORE(p);
+ ++p;
+#endif
+ }
+ if (endmask)
+ {
+ *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
+ }
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+}
diff --git a/xc/programs/Xserver/cfb/cfbtileodd.c b/xc/programs/Xserver/cfb/cfbtileodd.c
new file mode 100644
index 000000000..24406a74d
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbtileodd.c
@@ -0,0 +1,1215 @@
+/*
+ * Fill odd tiled rectangles and spans.
+ * no depth dependencies.
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbtileodd.c,v 3.2 1999/01/23 09:55:38 dawes Exp $ */
+
+/*
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+*/
+
+/* $TOG: cfbtileodd.c /main/17 1998/02/09 14:08:07 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+#include "mergerop.h"
+
+#if PSZ == 24
+#if PGSZ == 32
+#define LEFTSHIFT_AMT (3)
+#else /* PGSZ == 64 */
+#define LEFTSHIFT_AMT (4 - PWSH)
+#endif /* PGSZ */
+#else /* PSZ != 24 */
+#if PGSZ == 32
+#define LEFTSHIFT_AMT (5 - PWSH)
+#else /* PGSZ == 64 */
+#define LEFTSHIFT_AMT (6 - PWSH)
+#endif /* PGSZ */
+#endif /* PSZ == 24*/
+
+#define LastTileBits {\
+ tmp = bits; \
+ if (tileEndPart) \
+ bits = (*pSrc & tileEndMask) | BitRight (*pSrcLine, tileEndLeftShift); \
+ else \
+ bits = *pSrc; \
+}
+
+#if PSZ == 24
+#define ResetTileBits {\
+ pSrc = pSrcLine; \
+ nlwSrc = widthSrc;\
+ if (tileEndPart) { \
+ if (4 - xoff + tileEndPart <= 4) {\
+ bits = *pSrc++; \
+ nlwSrc--; \
+ } else \
+ bits = BitLeft(tmp, tileEndLeftShift) | \
+ BitRight(bits, tileEndRightShift); \
+ xoff = (xoff + xoffStep) & 3; \
+ leftShift = xoff << LEFTSHIFT_AMT; \
+ rightShift = PGSZ - leftShift; \
+ }\
+}
+#else
+#define ResetTileBits {\
+ pSrc = pSrcLine; \
+ nlwSrc = widthSrc;\
+ if (tileEndPart) { \
+ if (PPW - xoff + tileEndPart <= PPW) {\
+ bits = *pSrc++; \
+ nlwSrc--; \
+ } else \
+ bits = BitLeft(tmp, tileEndLeftShift) | \
+ BitRight(bits, tileEndRightShift); \
+ xoff = (xoff + xoffStep) & PIM; \
+ leftShift = xoff << LEFTSHIFT_AMT; \
+ rightShift = PGSZ - leftShift; \
+ }\
+}
+#endif
+
+#define NextTileBits {\
+ if (nlwSrc == 1) {\
+ LastTileBits\
+ } else { \
+ if (nlwSrc == 0) {\
+ ResetTileBits\
+ } \
+ if (nlwSrc == 1) {\
+ LastTileBits\
+ } else {\
+ tmp = bits; \
+ bits = *pSrc++; \
+ }\
+ }\
+ nlwSrc--; \
+}
+
+void
+MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
+ DrawablePtr pDrawable;
+ int nBox; /* number of boxes to fill */
+ register BoxPtr pBox; /* pointer to list of boxes to fill */
+ PixmapPtr tile; /* tile */
+ int xrot, yrot;
+ int alu;
+ unsigned long planemask;
+{
+ int tileWidth; /* width of tile in pixels */
+ int tileHeight; /* height of the tile */
+ int widthSrc;
+
+ int widthDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current box */
+ int h; /* height of current box */
+ unsigned long startmask;
+ unsigned long endmask;/* masks for reggedy bits at either end of line */
+ int nlwMiddle; /* number of longwords between sides of boxes */
+ int nlwSrc; /* number of whole longwords in source */
+
+ register int nlw; /* loop version of nlwMiddle */
+ int srcy; /* current tile y position */
+ int srcx; /* current tile x position */
+ int xoffDst, xoffSrc;
+ int leftShift, rightShift;
+
+ MROP_DECLARE_REG()
+
+ unsigned long *pdstBase; /* pointer to start of dest */
+ unsigned long *pDstLine; /* poitner to start of dest box */
+ unsigned long *pSrcBase; /* pointer to start of source */
+ unsigned long *pSrcLine; /* pointer to start of source line */
+ register unsigned long *pDst;
+ register unsigned long *pSrc;
+ register unsigned long bits, tmp;
+ register int nlwPart;
+ int xoffStart, xoff;
+ int leftShiftStart, rightShiftStart, nlwSrcStart;
+ unsigned long tileEndMask;
+ int tileEndLeftShift, tileEndRightShift;
+ int xoffStep;
+ int tileEndPart;
+ int needFirst;
+ unsigned long narrow[2];
+ unsigned long narrowMask;
+ int narrowShift;
+ Bool narrowTile;
+
+ MROP_INITIALIZE (alu, planemask)
+
+ tileHeight = tile->drawable.height;
+ tileWidth = tile->drawable.width;
+ widthSrc = tile->devKind / PGSZB;
+ narrowTile = FALSE;
+ if (widthSrc == 1)
+ {
+ narrowShift = tileWidth;
+ narrowMask = cfbendpartial [tileWidth];
+ tileWidth *= 2;
+ widthSrc = 2;
+ narrowTile = TRUE;
+ }
+ pSrcBase = (unsigned long *)tile->devPrivate.ptr;
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+#if PSZ == 24
+ tileEndPart = (4 - tileWidth) & 3;
+ tileEndMask = cfbendpartial[tileWidth & 3];
+#else
+ tileEndPart = tileWidth & PIM;
+ tileEndMask = cfbendpartial[tileEndPart];
+#endif /* PSZ == 24 */
+ tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
+ tileEndRightShift = PGSZ - tileEndLeftShift;
+#if PSZ == 24
+ xoffStep = 4 - tileEndPart;
+#else
+ xoffStep = PPW - tileEndPart;
+#endif /* PSZ == 24 */
+ /*
+ * current assumptions: tile > 32 bits wide.
+ */
+ while (nBox--)
+ {
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+ modulus (pBox->x1 - xrot, tileWidth, srcx);
+ modulus (pBox->y1 - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffDst = (4 - pBox->x1) & 3;
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
+ xoffDst = pBox->x1 & PIM;
+ if (xoffDst + w < PPW)
+#endif
+ {
+ maskpartialbits(pBox->x1, w, startmask);
+ endmask = 0;
+ nlwMiddle = 0;
+ }
+ else
+ {
+ maskbits (pBox->x1, w, startmask, endmask, nlwMiddle)
+ }
+#if PSZ == 24
+ pDstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
+#else
+ pDstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+#endif
+ pSrcLine = pSrcBase + (srcy * widthSrc);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+#else
+ xoffSrc = srcx & PIM;
+#endif
+ if (xoffSrc >= xoffDst)
+ {
+ xoffStart = xoffSrc - xoffDst;
+ needFirst = 1;
+ }
+ else
+ {
+#if PSZ == 24
+ xoffStart = 4 - (xoffDst - xoffSrc);
+#else
+ xoffStart = PPW - (xoffDst - xoffSrc);
+#endif
+ needFirst = 0;
+ }
+ leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
+ rightShiftStart = PGSZ - leftShiftStart;
+#if PSZ == 24
+ nlwSrcStart = widthSrc - ((srcx*3) >> 2);
+#else
+ nlwSrcStart = widthSrc - (srcx >> PWSH);
+#endif
+ while (h--)
+ {
+ /* XXX only works when narrowShift >= PPW/2 */
+ if (narrowTile)
+ {
+ tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
+ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
+#if PSZ == 24
+ narrow[1] = BitLeft (tmp, 8) |
+ BitRight(tmp, 16);
+#else
+ narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
+ SCRRIGHT(tmp, 2 * narrowShift - PPW);
+#endif
+ pSrcLine = narrow;
+ }
+ xoff = xoffStart;
+ leftShift = leftShiftStart;
+ rightShift = rightShiftStart;
+ nlwSrc = nlwSrcStart;
+#if PSZ == 24
+ pSrc = pSrcLine + ((srcx * 3) >> 2);
+#else
+ pSrc = pSrcLine + (srcx >> PWSH);
+#endif
+ pDst = pDstLine;
+ bits = 0;
+ if (needFirst)
+ {
+ NextTileBits
+ }
+ if (startmask)
+ {
+ NextTileBits
+ tmp = BitLeft(tmp, leftShift);
+ if (rightShift != PGSZ)
+ tmp |= BitRight(bits,rightShift);
+ *pDst = MROP_MASK (tmp, *pDst, startmask);
+ ++pDst;
+ }
+ nlw = nlwMiddle;
+ while (nlw)
+ {
+#if MROP == Mcopy
+ if (nlwSrc > 1)
+ {
+ nlwPart = nlw;
+ if (nlwPart >= nlwSrc)
+ nlwPart = nlwSrc - 1;
+ nlw -= nlwPart;
+ nlwSrc -= nlwPart;
+ if (rightShift != PGSZ)
+ {
+ while (nlwPart--)
+ {
+ tmp = bits;
+ bits = *pSrc++;
+ *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
+ BitRight (bits, rightShift),
+ *pDst);
+ ++pDst;
+ }
+ }
+ else
+ {
+ if (nlwPart)
+ {
+ *pDst = MROP_SOLID (bits, *pDst);
+ ++pDst;
+ nlwPart--;
+ while (nlwPart--)
+ {
+ *pDst = MROP_SOLID(*pSrc, *pDst);
+ ++pDst; ++pSrc;
+ }
+ bits = *pSrc++;
+ }
+ }
+ }
+ else
+#endif
+ {
+ NextTileBits
+ if (rightShift != PGSZ)
+ {
+ *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
+ BitRight(bits, rightShift),
+ *pDst);
+ }
+ else
+ {
+ *pDst = MROP_SOLID (tmp, *pDst);
+ }
+ ++pDst;
+ nlw--;
+ }
+ }
+ if (endmask)
+ {
+ NextTileBits
+ if (rightShift == PGSZ)
+ bits = 0;
+ *pDst = MROP_MASK (BitLeft(tmp, leftShift) |
+ BitRight(bits,rightShift),
+ *pDst, endmask);
+ }
+ pDstLine += widthDst;
+ pSrcLine += widthSrc;
+ if (++srcy == tileHeight)
+ {
+ srcy = 0;
+ pSrcLine = pSrcBase;
+ }
+ }
+ pBox++;
+ }
+}
+
+void
+MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
+ DrawablePtr pDrawable;
+ int n;
+ DDXPointPtr ppt;
+ int *pwidth;
+ PixmapPtr tile;
+ int xrot, yrot;
+ int alu;
+ unsigned long planemask;
+{
+ int tileWidth; /* width of tile in pixels */
+ int tileHeight; /* height of the tile */
+ int widthSrc;
+
+ int widthDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current span */
+ unsigned long startmask;
+ unsigned long endmask; /* masks for reggedy bits at either end of line */
+ int nlwSrc; /* number of whole longwords in source */
+
+ register int nlw; /* loop version of nlwMiddle */
+ int srcy; /* current tile y position */
+ int srcx; /* current tile x position */
+ int xoffDst, xoffSrc;
+ int leftShift, rightShift;
+
+ MROP_DECLARE_REG()
+
+ unsigned long *pdstBase; /* pointer to start of dest */
+ unsigned long *pDstLine; /* poitner to start of dest box */
+ unsigned long *pSrcBase; /* pointer to start of source */
+ unsigned long *pSrcLine; /* pointer to start of source line */
+ register unsigned long *pDst;
+ register unsigned long *pSrc;
+ register unsigned long bits, tmp;
+ register int nlwPart;
+ int xoffStart, xoff;
+ int leftShiftStart, rightShiftStart, nlwSrcStart;
+ unsigned long tileEndMask;
+ int tileEndLeftShift, tileEndRightShift;
+ int xoffStep;
+ int tileEndPart;
+ int needFirst;
+ unsigned long narrow[2];
+ unsigned long narrowMask;
+ int narrowShift;
+ Bool narrowTile;
+
+ MROP_INITIALIZE (alu, planemask)
+
+ tileHeight = tile->drawable.height;
+ tileWidth = tile->drawable.width;
+ widthSrc = tile->devKind / PGSZB;
+ narrowTile = FALSE;
+ if (widthSrc == 1)
+ {
+ narrowShift = tileWidth;
+ narrowMask = cfbendpartial [tileWidth];
+ tileWidth *= 2;
+ widthSrc = 2;
+ narrowTile = TRUE;
+ }
+ pSrcBase = (unsigned long *)tile->devPrivate.ptr;
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+#if PSZ == 24
+ tileEndPart = (4 - tileWidth) & 3;
+ tileEndMask = cfbendpartial[tileWidth & 3];
+#else
+ tileEndPart = tileWidth & PIM;
+ tileEndMask = cfbendpartial[tileEndPart];
+#endif
+ tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
+ tileEndRightShift = PGSZ - tileEndLeftShift;
+#if PSZ == 24
+ xoffStep = 4 - tileEndPart;
+#else
+ xoffStep = PPW - tileEndPart;
+#endif
+ while (n--)
+ {
+ w = *pwidth++;
+ modulus (ppt->x - xrot, tileWidth, srcx);
+ modulus (ppt->y - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffDst = (4 - ppt->x) & 3;
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
+ xoffDst = ppt->x & PIM;
+ if (xoffDst + w < PPW)
+#endif
+ {
+ maskpartialbits(ppt->x, w, startmask);
+ endmask = 0;
+ nlw = 0;
+ }
+ else
+ {
+ maskbits (ppt->x, w, startmask, endmask, nlw)
+ }
+#if PSZ == 24
+ pDstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2);
+#else
+ pDstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
+#endif
+ pSrcLine = pSrcBase + (srcy * widthSrc);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+#else
+ xoffSrc = srcx & PIM;
+#endif
+ if (xoffSrc >= xoffDst)
+ {
+ xoffStart = xoffSrc - xoffDst;
+ needFirst = 1;
+ }
+ else
+ {
+#if PSZ == 24
+ xoffStart = 4 - (xoffDst - xoffSrc);
+#else
+ xoffStart = PPW - (xoffDst - xoffSrc);
+#endif
+ needFirst = 0;
+ }
+ leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
+ rightShiftStart = PGSZ - leftShiftStart;
+#if PSZ == 24
+ nlwSrcStart = widthSrc - ((srcx*3) >> 2);
+#else
+ nlwSrcStart = widthSrc - (srcx >> PWSH);
+#endif
+ /* XXX only works when narrowShift >= PPW/2 */
+ if (narrowTile)
+ {
+ tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
+ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
+#if PSZ == 24
+ narrow[1] = BitLeft (tmp, 8) |
+ BitRight(tmp, 16);
+#else
+ narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
+ SCRRIGHT(tmp, 2 * narrowShift - PPW);
+#endif
+ pSrcLine = narrow;
+ }
+ xoff = xoffStart;
+ leftShift = leftShiftStart;
+ rightShift = rightShiftStart;
+ nlwSrc = nlwSrcStart;
+#if PSZ == 24
+ pSrc = pSrcLine + ((srcx * 3) >> 2);
+#else
+ pSrc = pSrcLine + (srcx >> PWSH);
+#endif
+ pDst = pDstLine;
+ bits = 0;
+ if (needFirst)
+ {
+ NextTileBits
+ }
+ if (startmask)
+ {
+ NextTileBits
+ tmp = BitLeft(tmp, leftShift);
+ if (rightShift != PGSZ)
+ tmp |= BitRight(bits,rightShift);
+ *pDst = MROP_MASK (tmp, *pDst, startmask);
+ ++pDst;
+ }
+ while (nlw)
+ {
+#if MROP == Mcopy
+ if (nlwSrc > 1)
+ {
+ nlwPart = nlw;
+ if (nlwPart >= nlwSrc)
+ nlwPart = nlwSrc - 1;
+ nlw -= nlwPart;
+ nlwSrc -= nlwPart;
+ if (rightShift != PGSZ)
+ {
+ while (nlwPart--)
+ {
+ tmp = bits;
+ bits = *pSrc++;
+ *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
+ BitRight (bits, rightShift),
+ *pDst);
+ ++pDst;
+ }
+ }
+ else
+ {
+ if (nlwPart)
+ {
+ *pDst = MROP_SOLID (bits, *pDst);
+ ++pDst;
+ nlwPart--;
+ while (nlwPart--)
+ {
+ *pDst = MROP_SOLID(*pSrc, *pDst);
+ ++pDst; ++pSrc;
+ }
+ bits = *pSrc++;
+ }
+ }
+ }
+ else
+#endif
+ {
+ NextTileBits
+ if (rightShift != PGSZ)
+ {
+ *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
+ BitRight(bits, rightShift),
+ *pDst);
+ ++pDst;
+ }
+ else
+ {
+ *pDst = MROP_SOLID (tmp, *pDst);
+ ++pDst;
+ }
+ nlw--;
+ }
+ }
+ if (endmask)
+ {
+ NextTileBits
+ if (rightShift == PGSZ)
+ bits = 0;
+ *pDst = MROP_MASK (BitLeft(tmp, leftShift) |
+ BitRight(bits,rightShift),
+ *pDst, endmask);
+ }
+ ppt++;
+ }
+}
+
+# include "fastblt.h"
+
+#define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; }
+
+void
+MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
+ DrawablePtr pDrawable;
+ int nBox; /* number of boxes to fill */
+ register BoxPtr pBox; /* pointer to list of boxes to fill */
+ PixmapPtr tile; /* tile */
+ int xrot, yrot;
+ int alu;
+ unsigned long planemask;
+{
+ int tileWidth; /* width of tile */
+ int tileHeight; /* height of the tile */
+ int widthSrc; /* width in longwords of the source tile */
+
+ int widthDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current box */
+ int h; /* height of current box */
+ unsigned long startmask;
+ unsigned long endmask;/* masks for reggedy bits at either end of line */
+ int nlMiddle; /* number of longwords between sides of boxes */
+
+ register int nl; /* loop version of nlMiddle */
+ int srcy; /* current tile y position */
+ int srcx; /* current tile x position */
+ int srcRemaining; /* number of longwords remaining in source */
+ int xoffDst, xoffSrc;
+ int srcStart; /* number of longwords source offset at left of box */
+ int leftShift, rightShift;
+
+ MROP_DECLARE_REG()
+
+ unsigned long *pdstBase; /* pointer to start of dest */
+ unsigned long *pdstLine; /* poitner to start of dest box */
+ unsigned long *psrcBase; /* pointer to start of source */
+ unsigned long *psrcLine; /* pointer to fetch point of source */
+ unsigned long *psrcStart; /* pointer to start of source line */
+ register unsigned long *pdst;
+ register unsigned long *psrc;
+ register unsigned long bits, bits1;
+ register int nlTemp;
+
+ MROP_INITIALIZE (alu, planemask)
+
+ psrcBase = (unsigned long *)tile->devPrivate.ptr;
+ tileHeight = tile->drawable.height;
+ tileWidth = tile->drawable.width;
+#if PSZ == 24
+ widthSrc = tile->devKind / PGSZB;
+#else
+ widthSrc = tileWidth >> PWSH;
+#endif
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ while (nBox--)
+ {
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+
+ /* set up source */
+ modulus (pBox->x1 - xrot, tileWidth, srcx);
+ modulus (pBox->y1 - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+ srcStart = (srcx * 3) >> 2;
+#else
+ xoffSrc = srcx & PIM;
+ srcStart = (srcx >> PWSH);
+#endif
+ psrcStart = psrcBase + (srcy * widthSrc);
+ psrcLine = psrcStart + srcStart;
+
+ /* set up dest */
+#if PSZ == 24
+ xoffDst = (4 - pBox->x1) & 3;
+ pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
+#else
+ xoffDst = pBox->x1 & PIM;
+ pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
+#endif
+ /* set up masks */
+#if PSZ == 24
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
+ if (xoffDst + w < PPW)
+#endif
+ {
+ maskpartialbits(pBox->x1, w, startmask);
+ endmask = 0;
+ nlMiddle = 0;
+ }
+ else
+ {
+ maskbits (pBox->x1, w, startmask, endmask, nlMiddle)
+ }
+ if (xoffSrc == xoffDst)
+ {
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ srcRemaining = widthSrc - srcStart;
+ if (startmask)
+ {
+ *pdst = MROP_MASK (*psrc, *pdst, startmask);
+ pdst++;
+ IncSrcPtr
+ }
+ nlTemp = nlMiddle;
+ while (nlTemp)
+ {
+ nl = nlTemp;
+ if (nl > srcRemaining)
+ nl = srcRemaining;
+
+ nlTemp -= nl;
+ srcRemaining -= nl;
+
+#if MROP == Mcopy
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
+#define BodyEven(n) BodyOdd(n)
+
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL(nl, label1,
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;)
+#endif
+#else
+ while (nl--) {
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;
+ }
+#endif
+ if (!srcRemaining)
+ {
+ srcRemaining = widthSrc;
+ psrc = psrcStart;
+ }
+ }
+ if (endmask)
+ {
+ *pdst = MROP_MASK (*psrc, *pdst, endmask);
+ }
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ psrcStart += widthSrc;
+ if (++srcy == tileHeight)
+ {
+ psrcStart = psrcBase;
+ psrcLine = psrcStart + srcStart;
+ srcy = 0;
+ }
+ }
+ }
+ else
+ {
+ if (xoffSrc > xoffDst)
+ {
+ leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
+ rightShift = PGSZ - leftShift;
+ }
+ else
+ {
+ rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
+ leftShift = PGSZ - rightShift;
+ }
+ while (h--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ bits = 0;
+ srcRemaining = widthSrc - srcStart;
+ if (xoffSrc > xoffDst)
+ {
+ bits = *psrc;
+ IncSrcPtr
+ }
+ if (startmask)
+ {
+ bits1 = BitLeft(bits,leftShift);
+ bits = *psrc;
+ IncSrcPtr
+ bits1 |= BitRight(bits,rightShift);
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ pdst++;
+ }
+ nlTemp = nlMiddle;
+ while (nlTemp)
+ {
+ nl = nlTemp;
+ if (nl > srcRemaining)
+ nl = srcRemaining;
+
+ nlTemp -= nl;
+ srcRemaining -= nl;
+
+#if MROP == Mcopy
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) \
+ bits = psrc[-n]; \
+ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
+
+#define BodyEven(n) \
+ bits1 = psrc[-n]; \
+ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
+
+#define LoopReset \
+ pdst += UNROLL; \
+ psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+ bits = *psrc++; \
+ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
+ pdst++;
+
+#define BodyEven(n) \
+ bits1 = *psrc++; \
+ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
+ pdst++;
+
+#define LoopReset ;
+
+#endif /* !FAST_CONSTANT_OFFSET_MODE */
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL (nl,label2,
+ bits1 = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
+ pdst++;
+ )
+#endif
+#else
+ while (nl--) {
+ bits1 = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
+ pdst++;
+ }
+#endif
+ if (!srcRemaining)
+ {
+ srcRemaining = widthSrc;
+ psrc = psrcStart;
+ }
+ }
+
+ if (endmask)
+ {
+ bits1 = BitLeft(bits, leftShift);
+ if (BitLeft(endmask, rightShift))
+ {
+ bits = *psrc;
+ bits1 |= BitRight(bits, rightShift);
+ }
+ *pdst = MROP_MASK (bits1, *pdst, endmask);
+ }
+ pdstLine += widthDst;
+ psrcLine += widthSrc;
+ psrcStart += widthSrc;
+ if (++srcy == tileHeight)
+ {
+ psrcStart = psrcBase;
+ psrcLine = psrcStart + srcStart;
+ srcy = 0;
+ }
+ }
+ }
+ pBox++;
+ }
+}
+
+void
+MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
+ DrawablePtr pDrawable;
+ int n;
+ DDXPointPtr ppt;
+ int *pwidth;
+ PixmapPtr tile;
+ int xrot, yrot;
+ int alu;
+ unsigned long planemask;
+{
+ int tileWidth; /* width of tile */
+ int tileHeight; /* height of the tile */
+ int widthSrc; /* width in longwords of the source tile */
+
+ int widthDst; /* width in longwords of the dest pixmap */
+ int w; /* width of current box */
+ unsigned long startmask;
+ unsigned long endmask;/* masks for reggedy bits at either end of line */
+ int nlMiddle; /* number of longwords between sides of boxes */
+
+ register int nl; /* loop version of nlMiddle */
+ int srcy; /* current tile y position */
+ int srcx; /* current tile x position */
+ int srcRemaining; /* number of longwords remaining in source */
+ int xoffDst, xoffSrc;
+ int srcStart; /* number of longwords source offset at left of box */
+ int leftShift, rightShift;
+
+ MROP_DECLARE_REG()
+
+ unsigned long *pdstBase; /* pointer to start of dest */
+ unsigned long *pdstLine; /* poitner to start of dest box */
+ unsigned long *psrcBase; /* pointer to start of source */
+ unsigned long *psrcLine; /* pointer to fetch point of source */
+ unsigned long *psrcStart; /* pointer to start of source line */
+ register unsigned long *pdst;
+ register unsigned long *psrc;
+ register unsigned long bits, bits1;
+ register int nlTemp;
+
+ MROP_INITIALIZE (alu, planemask)
+
+ psrcBase = (unsigned long *)tile->devPrivate.ptr;
+ tileHeight = tile->drawable.height;
+ tileWidth = tile->drawable.width;
+#if PSZ == 24
+ widthSrc = tile->devKind / PGSZB;
+#else
+ widthSrc = tileWidth >> PWSH;
+#endif
+
+ cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
+
+ while (n--)
+ {
+ w = *pwidth++;
+
+ /* set up source */
+ modulus (ppt->x - xrot, tileWidth, srcx);
+ modulus (ppt->y - yrot, tileHeight, srcy);
+#if PSZ == 24
+ xoffSrc = (4 - srcx) & 3;
+ srcStart = (srcx * 3) >> 2;
+#else
+ xoffSrc = srcx & PIM;
+ srcStart = (srcx >> PWSH);
+#endif
+ psrcStart = psrcBase + (srcy * widthSrc);
+ psrcLine = psrcStart + srcStart;
+
+ /* set up dest */
+#if PSZ == 24
+ xoffDst = (4 - ppt->x) & 3;
+ pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2);
+ /* set up masks */
+ if (w == 1 && (xoffDst == 0 || xoffDst == 1))
+#else
+ xoffDst = ppt->x & PIM;
+ pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
+ /* set up masks */
+ if (xoffDst + w < PPW)
+#endif
+ {
+ maskpartialbits(ppt->x, w, startmask);
+ endmask = 0;
+ nlMiddle = 0;
+ }
+ else
+ {
+ maskbits (ppt->x, w, startmask, endmask, nlMiddle)
+ }
+
+ if (xoffSrc == xoffDst)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ srcRemaining = widthSrc - srcStart;
+ if (startmask)
+ {
+ *pdst = MROP_MASK (*psrc, *pdst, startmask);
+ pdst++;
+ IncSrcPtr
+ }
+ nlTemp = nlMiddle;
+ while (nlTemp)
+ {
+ nl = nlTemp;
+ if (nl > srcRemaining)
+ nl = srcRemaining;
+
+ nlTemp -= nl;
+ srcRemaining -= nl;
+
+#if MROP == Mcopy
+#ifdef LARGE_INSTRUCTION_CACHE
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
+#define BodyEven(n) BodyOdd(n)
+
+#define LoopReset ;
+
+#endif
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL(nl, label1,
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;)
+#endif
+#else
+ while (nl--) {
+ *pdst = MROP_SOLID (*psrc, *pdst);
+ pdst++; psrc++;
+ }
+#endif
+ if (!srcRemaining)
+ {
+ srcRemaining = widthSrc;
+ psrc = psrcStart;
+ }
+ }
+ if (endmask)
+ {
+ *pdst = MROP_MASK (*psrc, *pdst, endmask);
+ }
+ }
+ else
+ {
+ if (xoffSrc > xoffDst)
+ {
+ leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
+ rightShift = PGSZ - leftShift;
+ }
+ else
+ {
+ rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
+ leftShift = PGSZ - rightShift;
+ }
+ psrc = psrcLine;
+ pdst = pdstLine;
+ bits = 0;
+ srcRemaining = widthSrc - srcStart;
+ if (xoffSrc > xoffDst)
+ {
+ bits = *psrc;
+ IncSrcPtr
+ }
+ if (startmask)
+ {
+ bits1 = BitLeft(bits,leftShift);
+ bits = *psrc;
+ IncSrcPtr
+ bits1 |= BitRight(bits,rightShift);
+ *pdst = MROP_MASK(bits1, *pdst, startmask);
+ pdst++;
+ }
+ nlTemp = nlMiddle;
+ while (nlTemp)
+ {
+ nl = nlTemp;
+ if (nl > srcRemaining)
+ nl = srcRemaining;
+
+ nlTemp -= nl;
+ srcRemaining -= nl;
+
+#if MROP == Mcopy
+#ifdef LARGE_INSTRUCTION_CACHE
+ bits1 = bits;
+
+#ifdef FAST_CONSTANT_OFFSET_MODE
+
+ psrc += nl & (UNROLL-1);
+ pdst += nl & (UNROLL-1);
+
+#define BodyOdd(n) \
+bits = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
+
+#define BodyEven(n) \
+bits1 = psrc[-n]; \
+pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
+
+#define LoopReset \
+pdst += UNROLL; \
+psrc += UNROLL;
+
+#else
+
+#define BodyOdd(n) \
+bits = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
+pdst++;
+
+#define BodyEven(n) \
+bits1 = *psrc++; \
+*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
+pdst++;
+
+#define LoopReset ;
+
+#endif /* !FAST_CONSTANT_OFFSET_MODE */
+
+ PackedLoop
+
+#undef BodyOdd
+#undef BodyEven
+#undef LoopReset
+
+#else
+ DuffL (nl,label2,
+ bits1 = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
+ pdst++;
+ )
+#endif
+#else
+ while (nl--) {
+ bits1 = BitLeft(bits,leftShift);
+ bits = *psrc++;
+ *pdst = MROP_SOLID(bits1|BitRight(bits,rightShift), *pdst);
+ pdst++;
+ }
+#endif
+ if (!srcRemaining)
+ {
+ srcRemaining = widthSrc;
+ psrc = psrcStart;
+ }
+ }
+
+ if (endmask)
+ {
+ bits1 = BitLeft(bits, leftShift);
+ if (BitLeft(endmask, rightShift))
+ {
+ bits = *psrc;
+ bits1 |= BitRight(bits, rightShift);
+ }
+ *pdst = MROP_MASK (bits1, *pdst, endmask);
+ }
+ }
+ ppt++;
+ }
+}
diff --git a/xc/programs/Xserver/cfb/cfbunmap.h b/xc/programs/Xserver/cfb/cfbunmap.h
new file mode 100644
index 000000000..5235c2239
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbunmap.h
@@ -0,0 +1,153 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbunmap.h,v 1.4 1998/11/28 10:42:52 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/*
+ * Unmap names
+ */
+
+#undef NAME
+#undef CATNAME
+
+#undef cfbScreenPrivateIndex
+#undef QuartetBitsTable
+#undef QuartetPixelMaskTable
+#undef cfbAllocatePrivates
+#undef cfbBSFuncRec
+#undef cfbBitBlt
+#undef cfbBresD
+#undef cfbBresS
+#undef cfbChangeWindowAttributes
+#undef cfbCloseScreen
+#undef cfbCopyArea
+#undef cfbCopyImagePlane
+#undef cfbCopyPixmap
+#undef cfbCopyPlane
+#undef cfbCopyRotatePixmap
+#undef cfbCopyWindow
+#undef cfbCreateGC
+#undef cfbCreatePixmap
+#undef cfbCreateWindow
+#undef cfbCreateScreenResources
+#undef cfbDestroyPixmap
+#undef cfbDestroyWindow
+#undef cfbDoBitblt
+#undef cfbDoBitbltCopy
+#undef cfbDoBitbltGeneral
+#undef cfbDoBitbltOr
+#undef cfbDoBitbltXor
+#undef cfbFillBoxSolid
+#undef cfbFillBoxTile32
+#undef cfbFillBoxTile32sCopy
+#undef cfbFillBoxTile32sGeneral
+#undef cfbFillBoxTileOdd
+#undef cfbFillBoxTileOddCopy
+#undef cfbFillBoxTileOddGeneral
+#undef cfbFillPoly1RectCopy
+#undef cfbFillPoly1RectGeneral
+#undef cfbFillRectSolidCopy
+#undef cfbFillRectSolidGeneral
+#undef cfbFillRectSolidXor
+#undef cfbFillRectTile32Copy
+#undef cfbFillRectTile32General
+#undef cfbFillRectTileOdd
+#undef cfbFillSpanTile32sCopy
+#undef cfbFillSpanTile32sGeneral
+#undef cfbFillSpanTileOddCopy
+#undef cfbFillSpanTileOddGeneral
+#undef cfbFinishScreenInit
+#undef cfbGCFuncs
+#undef cfbGetImage
+#undef cfbGetScreenPixmap
+#undef cfbGetSpans
+#undef cfbHorzS
+#undef cfbImageGlyphBlt8
+#undef cfbLineSD
+#undef cfbLineSS
+#undef cfbMapWindow
+#undef cfbMatchCommon
+#undef cfbNonTEOps
+#undef cfbNonTEOps1Rect
+#undef cfbPadPixmap
+#undef cfbPaintWindow
+#undef cfbPolyGlyphBlt8
+#undef cfbPolyGlyphRop8
+#undef cfbPolyFillArcSolidCopy
+#undef cfbPolyFillArcSolidGeneral
+#undef cfbPolyFillRect
+#undef cfbPolyPoint
+#undef cfbPositionWindow
+#undef cfbPutImage
+#undef cfbReduceRasterOp
+#undef cfbRestoreAreas
+#undef cfbSaveAreas
+#undef cfbScreenInit
+#undef cfbSegmentSD
+#undef cfbSegmentSS
+#undef cfbSetScanline
+#undef cfbSetScreenPixmap
+#undef cfbSetSpans
+#undef cfbSetupScreen
+#undef cfbSolidSpansCopy
+#undef cfbSolidSpansGeneral
+#undef cfbSolidSpansXor
+#undef cfbStippleStack
+#undef cfbStippleStackTE
+#undef cfbTEGlyphBlt
+#undef cfbTEOps
+#undef cfbTEOps1Rect
+#undef cfbTile32FSCopy
+#undef cfbTile32FSGeneral
+#undef cfbUnmapWindow
+#undef cfbUnnaturalStippleFS
+#undef cfbUnnaturalTileFS
+#undef cfbValidateGC
+#undef cfbVertS
+#undef cfbXRotatePixmap
+#undef cfbYRotatePixmap
+#undef cfbendpartial
+#undef cfbendtab
+#undef cfbmask
+#undef cfbrmask
+#undef cfbstartpartial
+#undef cfbstarttab
+#undef cfb8LineSS1Rect
+#undef cfb8SegmentSS1Rect
+#undef cfb8ClippedLineCopy
+#undef cfb8ClippedLineXor
+#undef cfb8ClippedLineGeneral
+#undef cfb8SegmentSS1RectCopy
+#undef cfb8SegmentSS1RectXor
+#undef cfb8SegmentSS1RectGeneral
+#undef cfb8SegmentSS1RectShiftCopy
+#undef cfb8LineSS1RectCopy
+#undef cfb8LineSS1RectXor
+#undef cfb8LineSS1RectGeneral
+#undef cfb8LineSS1RectPreviousCopy
+#undef cfbZeroPolyArcSS8Copy
+#undef cfbZeroPolyArcSS8Xor
+#undef cfbZeroPolyArcSS8General
+
diff --git a/xc/programs/Xserver/cfb/cfbwindow.c b/xc/programs/Xserver/cfb/cfbwindow.c
new file mode 100644
index 000000000..f17ed648f
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbwindow.c
@@ -0,0 +1,330 @@
+/* $TOG: cfbwindow.c /main/43 1998/02/09 14:08:14 kaleb $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#include "X.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "cfb.h"
+#include "mistruct.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+
+extern WindowPtr *WindowTable;
+
+Bool
+cfbCreateWindow(pWin)
+ WindowPtr pWin;
+{
+ cfbPrivWin *pPrivWin;
+
+ pPrivWin = cfbGetWindowPrivate(pWin);
+ pPrivWin->pRotatedBorder = NullPixmap;
+ pPrivWin->pRotatedBackground = NullPixmap;
+ pPrivWin->fastBackground = FALSE;
+ pPrivWin->fastBorder = FALSE;
+ pPrivWin->oldRotate.x = 0;
+ pPrivWin->oldRotate.y = 0;
+
+#ifdef PIXMAP_PER_WINDOW
+ /* Setup pointer to Screen pixmap */
+ pWin->devPrivates[frameWindowPrivateIndex].ptr =
+ (pointer) cfbGetScreenPixmap(pWin->drawable.pScreen);
+#endif
+
+ return TRUE;
+}
+
+Bool
+cfbDestroyWindow(pWin)
+ WindowPtr pWin;
+{
+ cfbPrivWin *pPrivWin;
+
+ pPrivWin = cfbGetWindowPrivate(pWin);
+
+ if (pPrivWin->pRotatedBorder)
+ (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
+ if (pPrivWin->pRotatedBackground)
+ (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground);
+ return(TRUE);
+}
+
+/*ARGSUSED*/
+Bool
+cfbMapWindow(pWindow)
+ WindowPtr pWindow;
+{
+ return(TRUE);
+}
+
+/* (x, y) is the upper left corner of the window on the screen
+ do we really need to pass this? (is it a;ready in pWin->absCorner?)
+ we only do the rotation for pixmaps that are 32 bits wide (padded
+or otherwise.)
+ cfbChangeWindowAttributes() has already put a copy of the pixmap
+in pPrivWin->pRotated*
+*/
+/*ARGSUSED*/
+Bool
+cfbPositionWindow(pWin, x, y)
+ WindowPtr pWin;
+ int x, y;
+{
+ cfbPrivWin *pPrivWin;
+ int setxy = 0;
+
+ pPrivWin = cfbGetWindowPrivate(pWin);
+ if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground)
+ {
+ cfbXRotatePixmap(pPrivWin->pRotatedBackground,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBackground,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ setxy = 1;
+ }
+
+ if (!pWin->borderIsPixel && pPrivWin->fastBorder)
+ {
+ while (pWin->backgroundState == ParentRelative)
+ pWin = pWin->parent;
+ cfbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ setxy = 1;
+ }
+ if (setxy)
+ {
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ return (TRUE);
+}
+
+/*ARGSUSED*/
+Bool
+cfbUnmapWindow(pWindow)
+ WindowPtr pWindow;
+{
+ return (TRUE);
+}
+
+/* UNCLEAN!
+ this code calls the bitblt helper code directly.
+
+ cfbCopyWindow copies only the parts of the destination that are
+visible in the source.
+*/
+
+
+void
+cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
+ WindowPtr pWin;
+ DDXPointRec ptOldOrg;
+ RegionPtr prgnSrc;
+{
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ RegionRec rgnDst;
+ register BoxPtr pbox;
+ register int dx, dy;
+ register int i, nbox;
+ WindowPtr pwinRoot;
+
+ pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+
+ REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+ {
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ for (i = nbox; --i >= 0; ppt++, pbox++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ GXcopy, &rgnDst, pptSrc, ~0L);
+ DEALLOCATE_LOCAL(pptSrc);
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+}
+
+
+
+/* swap in correct PaintWindow* routine. If we can use a fast output
+routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
+of it in devPrivates[cfbWindowPrivateIndex].ptr.
+*/
+Bool
+cfbChangeWindowAttributes(pWin, mask)
+ WindowPtr pWin;
+ unsigned long mask;
+{
+ register unsigned long index;
+ register cfbPrivWin *pPrivWin;
+ int width;
+ WindowPtr pBgWin;
+
+ pPrivWin = cfbGetWindowPrivate(pWin);
+
+ /*
+ * When background state changes from ParentRelative and
+ * we had previously rotated the fast border pixmap to match
+ * the parent relative origin, rerotate to match window
+ */
+ if (mask & (CWBackPixmap | CWBackPixel) &&
+ pWin->backgroundState != ParentRelative &&
+ pPrivWin->fastBorder &&
+ (pPrivWin->oldRotate.x != pWin->drawable.x ||
+ pPrivWin->oldRotate.y != pWin->drawable.y))
+ {
+ cfbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ while(mask)
+ {
+ index = lowbit (mask);
+ mask &= ~index;
+ switch(index)
+ {
+ case CWBackPixmap:
+ if (pWin->backgroundState == None)
+ {
+ pPrivWin->fastBackground = FALSE;
+ }
+ else if (pWin->backgroundState == ParentRelative)
+ {
+ pPrivWin->fastBackground = FALSE;
+ /* Rotate border to match parent origin */
+ if (pPrivWin->pRotatedBorder) {
+ for (pBgWin = pWin->parent;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ cfbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.y - pPrivWin->oldRotate.y);
+ pPrivWin->oldRotate.x = pBgWin->drawable.x;
+ pPrivWin->oldRotate.y = pBgWin->drawable.y;
+ }
+ }
+ else if (((width = (pWin->background.pixmap->drawable.width * PSZ))
+ <= PGSZ) && !(width & (width - 1)))
+ {
+ cfbCopyRotatePixmap(pWin->background.pixmap,
+ &pPrivWin->pRotatedBackground,
+ pWin->drawable.x,
+ pWin->drawable.y);
+ if (pPrivWin->pRotatedBackground)
+ {
+ pPrivWin->fastBackground = TRUE;
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ else
+ {
+ pPrivWin->fastBackground = FALSE;
+ }
+ }
+ else
+ {
+ pPrivWin->fastBackground = FALSE;
+ }
+ break;
+
+ case CWBackPixel:
+ pPrivWin->fastBackground = FALSE;
+ break;
+
+ case CWBorderPixmap:
+ if (((width = (pWin->border.pixmap->drawable.width * PSZ)) <= PGSZ) &&
+ !(width & (width - 1)))
+ {
+ for (pBgWin = pWin;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ cfbCopyRotatePixmap(pWin->border.pixmap,
+ &pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x,
+ pBgWin->drawable.y);
+ if (pPrivWin->pRotatedBorder)
+ {
+ pPrivWin->fastBorder = TRUE;
+ pPrivWin->oldRotate.x = pBgWin->drawable.x;
+ pPrivWin->oldRotate.y = pBgWin->drawable.y;
+ }
+ else
+ {
+ pPrivWin->fastBorder = FALSE;
+ }
+ }
+ else
+ {
+ pPrivWin->fastBorder = FALSE;
+ }
+ break;
+ case CWBorderPixel:
+ pPrivWin->fastBorder = FALSE;
+ break;
+ }
+ }
+ return (TRUE);
+}
+
diff --git a/xc/programs/Xserver/cfb/cfbzerarc.c b/xc/programs/Xserver/cfb/cfbzerarc.c
new file mode 100644
index 000000000..4b408b363
--- /dev/null
+++ b/xc/programs/Xserver/cfb/cfbzerarc.c
@@ -0,0 +1,313 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.1 1998/10/04 09:37:53 dawes Exp $ */
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* $TOG: cfbzerarc.c /main/25 1998/02/09 14:08:20 kaleb $ */
+
+/* Derived from:
+ * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
+ * by M. L. V. Pitteway
+ * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
+ */
+
+#include "X.h"
+#include "Xprotostr.h"
+#include "miscstruct.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "cfb.h"
+#include "cfbmskbits.h"
+#include "mizerarc.h"
+#include "cfbrrop.h"
+#include "mi.h"
+
+#ifdef PIXEL_ADDR
+
+static void
+RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ xArc *arc;
+{
+ miZeroArcRec info;
+ Bool do360;
+ register int x;
+ PixelType *addrp;
+ register PixelType *yorgp, *yorgop;
+#if PSZ == 24
+ int xorg, xorg3, xorgo, xorgo3;
+ register int xtmp;
+#endif
+ RROP_DECLARE
+ register int yoffset;
+ int npwidth, dyoffset;
+ register int y, a, b, d, mask;
+ register int k1, k3, dx, dy;
+
+ cfbGetPixelWidthAndPointer(pDraw,npwidth, addrp)
+
+ RROP_FETCH_GC (pGC);
+ do360 = miZeroArcSetup(arc, &info, TRUE);
+ yorgp = addrp + ((info.yorg + pDraw->y) * npwidth);
+ yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth);
+ info.xorg += pDraw->x;
+ info.xorgo += pDraw->x;
+#if PSZ == 24
+ xorg = info.xorg;
+ xorg3 = xorg * 3;
+ info.xorg = (info.xorg * 3) >> 2;
+ xorgo = info.xorgo;
+ xorgo3 = xorgo * 3;
+ info.xorgo = (info.xorgo * 3) >> 2;
+#endif
+ MIARCSETUP();
+ yoffset = y ? npwidth : 0;
+ dyoffset = 0;
+ mask = info.initialMask;
+ if (!(arc->width & 1))
+ {
+#if PSZ == 24
+ if (mask & 2)
+ RROP_SOLID24((yorgp + info.xorgo), xorgo);
+ if (mask & 8)
+ RROP_SOLID24((yorgop + info.xorgo), xorgo);
+#else
+ if (mask & 2)
+ RROP_SOLID((yorgp + info.xorgo));
+ if (mask & 8)
+ RROP_SOLID((yorgop + info.xorgo));
+#endif /* PSZ == 24 */
+ }
+ if (!info.end.x || !info.end.y)
+ {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1))
+ {
+ register int xoffset = npwidth;
+#if PSZ == 24
+ PixelType *yorghb = yorgp + (info.h * npwidth);
+ register int tmp1, tmp2, tmp1_3, tmp2_3;
+
+ tmp1 = xorg + info.h;
+ tmp1_3 = tmp1 * 3;
+ tmp2 = xorg - info.h;
+ tmp2_3 = tmp2 * 3;
+ while (1)
+ {
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ xtmp = (xorg3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x);
+ if (a < 0)
+ break;
+ xtmp = (tmp1_3 - y * 3) >> 2;
+ RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y);
+ RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y);
+ xtmp = (tmp2_3 + y * 3) >> 2;
+ RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y);
+ RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y);
+ xoffset += npwidth;
+ MIARCCIRCLESTEP(yoffset += npwidth;);
+ }
+#else
+ PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg;
+ PixelType *yorgohb = yorghb - info.h;
+
+ yorgp += info.xorg;
+ yorgop += info.xorg;
+ yorghb += info.h;
+ while (1)
+ {
+ RROP_SOLID(yorgp + yoffset + x);
+ RROP_SOLID(yorgp + yoffset - x);
+ RROP_SOLID(yorgop - yoffset - x);
+ RROP_SOLID(yorgop - yoffset + x);
+ if (a < 0)
+ break;
+ RROP_SOLID(yorghb - xoffset - y);
+ RROP_SOLID(yorgohb - xoffset + y);
+ RROP_SOLID(yorgohb + xoffset + y);
+ RROP_SOLID(yorghb + xoffset - y);
+ xoffset += npwidth;
+ MIARCCIRCLESTEP(yoffset += npwidth;);
+ }
+ yorgp -= info.xorg;
+ yorgop -= info.xorg;
+#endif /* PSZ == 24 */
+ x = info.w;
+ yoffset = info.h * npwidth;
+ }
+ else if (do360)
+ {
+ while (y < info.h || x < info.w)
+ {
+ MIARCOCTANTSHIFT(dyoffset = npwidth;);
+#if PSZ == 24
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+#else
+ RROP_SOLID(yorgp + yoffset + info.xorg + x);
+ RROP_SOLID(yorgp + yoffset + info.xorgo - x);
+ RROP_SOLID(yorgop - yoffset + info.xorgo - x);
+ RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif
+ MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
+ }
+ }
+ else
+ {
+ while (y < info.h || x < info.w)
+ {
+ MIARCOCTANTSHIFT(dyoffset = npwidth;);
+ if ((x == info.start.x) || (y == info.start.y))
+ {
+ mask = info.start.mask;
+ info.start = info.altstart;
+ }
+#if PSZ == 24
+ if (mask & 1){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ }
+ if (mask & 2){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 4){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 8){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ }
+#else
+ if (mask & 1)
+ RROP_SOLID(yorgp + yoffset + info.xorg + x);
+ if (mask & 2)
+ RROP_SOLID(yorgp + yoffset + info.xorgo - x);
+ if (mask & 4)
+ RROP_SOLID(yorgop - yoffset + info.xorgo - x);
+ if (mask & 8)
+ RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif /* PSZ == 24 */
+ if ((x == info.end.x) || (y == info.end.y))
+ {
+ mask = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
+ }
+ }
+ if ((x == info.start.x) || (y == info.start.y))
+ mask = info.start.mask;
+#if PSZ == 24
+ if (mask & 1){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
+ }
+ if (mask & 4){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
+ }
+#else
+ if (mask & 1)
+ RROP_SOLID(yorgp + yoffset + info.xorg + x);
+ if (mask & 4)
+ RROP_SOLID(yorgop - yoffset + info.xorgo - x);
+#endif /* PSZ == 24 */
+ if (arc->height & 1)
+ {
+#if PSZ == 24
+ if (mask & 2){
+ xtmp = (xorgo3 - x * 3) >> 2;
+ RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
+ }
+ if (mask & 8){
+ xtmp = (xorg3 + x * 3) >> 2;
+ RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
+ }
+#else
+ if (mask & 2)
+ RROP_SOLID(yorgp + yoffset + info.xorgo - x);
+ if (mask & 8)
+ RROP_SOLID(yorgop - yoffset + info.xorg + x);
+#endif /* PSZ == 24 */
+ }
+}
+
+void
+RROP_NAME (cfbZeroPolyArcSS8) (pDraw, pGC, narcs, parcs)
+ register DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ register xArc *arc;
+ register int i;
+ BoxRec box;
+ int x2, y2;
+ RegionPtr cclip;
+
+ cclip = cfbGetCompositeClip(pGC);
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miCanZeroArc(arc))
+ {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int)arc->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int)arc->height + 1;
+ box.y2 = y2;
+ if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) &&
+ (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
+ RROP_NAME (cfbZeroArcSS8) (pDraw, pGC, arc);
+ else
+ miZeroPolyArc(pDraw, pGC, 1, arc);
+ }
+ else
+ miPolyArc(pDraw, pGC, 1, arc);
+ }
+}
+
+#endif
diff --git a/xc/programs/Xserver/cfb/stip68kgnu.h b/xc/programs/Xserver/cfb/stip68kgnu.h
new file mode 100644
index 000000000..0406b3ac9
--- /dev/null
+++ b/xc/programs/Xserver/cfb/stip68kgnu.h
@@ -0,0 +1,119 @@
+/*
+ * $TOG: stip68kgnu.h /main/4 1998/02/09 14:08:34 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/stip68kgnu.h,v 3.2 1998/10/04 09:37:54 dawes Exp $ */
+
+/*
+ * Stipple stack macro for 68k GCC
+ */
+
+#define STIPPLE(addr,stipple,value,width,count,shift) \
+ __asm volatile ( \
+ "lea 5f,%/a1\n\
+ moveq #28,%/d2\n\
+ addl %2,%/d2\n\
+ moveq #28,%/d3\n\
+ subql #4,%2\n\
+ negl %2\n\
+1:\n\
+ movel %0,%/a0\n\
+ addl %6,%0\n\
+ movel %3@+,%/d1\n\
+ jeq 3f\n\
+ movel %/d1,%/d0\n\
+ lsrl %/d2,%/d0\n\
+ lsll #5,%/d0\n\
+ lsll %2,%/d1\n\
+ jmp %/a1@(%/d0:l)\n\
+2:\n\
+ addl #4,%/a0\n\
+ movel %/d1,%/d0\n\
+ lsrl %/d3,%/d0\n\
+ lsll #5,%/d0\n\
+ lsll #4,%/d1\n\
+ jmp %/a1@(%/d0:l)\n\
+5:\n\
+ jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x20\n\
+ moveb %5,%/a0@(3)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x40\n\
+ moveb %5,%/a0@(2)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x60\n\
+ movew %5,%/a0@(2)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
+ . = 5b + 0x80\n\
+ moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xa0\n\
+ moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xc0\n\
+ movew %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0xe0\n\
+ movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x100\n\
+ moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x120\n\
+ moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x140\n\
+ moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x160\n\
+ movew %5,%/a0@(2) ; moveb %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x180\n\
+ movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1a0\n\
+ moveb %5,%/a0@(3) ; movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1c0\n\
+ moveb %5,%/a0@(2) ; movew %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
+ . = 5b + 0x1e0\n\
+ movel %5,%/a0@\n\
+ andl %/d1,%/d1 ; jne 2b ; \n\
+3: dbra %1,1b ; \n\
+4:\n"\
+ : "=a" (addr), /* %0 */ \
+ "=d" (count), /* %1 */ \
+ "=d" (shift), /* %2 */ \
+ "=a" (stipple) /* %3 */ \
+ : "0" (addr), /* %4 */ \
+ "d" (value), /* %5 */ \
+ "a" (width), /* %6 */ \
+ "1" (count-1), /* %7 */ \
+ "2" (shift), /* %8 */ \
+ "3" (stipple) /* %9 */ \
+ : /* ctemp */ "d0", \
+ /* c */ "d1", \
+ /* lshift */ "d2", \
+ /* rshift */ "d3", \
+ /* atemp */ "a0", \
+ /* case */ "a1")
diff --git a/xc/programs/Xserver/cfb/stipmips.s b/xc/programs/Xserver/cfb/stipmips.s
new file mode 100644
index 000000000..d6988e459
--- /dev/null
+++ b/xc/programs/Xserver/cfb/stipmips.s
@@ -0,0 +1,277 @@
+/*
+ * $TOG: stipmips.s /main/11 1998/02/09 14:08:40 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/*
+ * MIPS assembly code for optimized text rendering.
+ *
+ * Other stippling could be done in assembly, but the payoff is
+ * not nearly as large. Mostly because large areas are heavily
+ * optimized already.
+ */
+
+#ifdef MIPSEL
+# define BitsR sll
+# define BitsL srl
+# define BO(o) o
+# define HO(o) o
+# define WO(o) o
+# define FourBits(dest,bits) and dest, bits, 0xf
+#else
+# define BitsR srl
+# define BitsL sll
+# define BO(o) 3-o
+# define HO(o) 2-o
+# define WO(o) o
+# define FourBits(dest,bits) srl dest, bits, 28
+#endif
+
+/* reordering instructions would be fatal here */
+ .set noreorder
+
+
+/*
+ * cfbStippleStack(addr, stipple, value, stride, Count, Shift)
+ * 4 5 6 7 16(sp) 20(sp)
+ *
+ * Apply successive 32-bit stipples starting at addr, addr+stride, ...
+ *
+ * Used for text rendering, but only when no data could be lost
+ * when the stipple is shifted left by Shift bits
+ */
+/* arguments */
+#define addr $4
+#define stipple $5
+#define value $6
+#define stride $7
+#define Count 16($sp)
+#define Shift 20($sp)
+
+/* local variables */
+#define count $14
+#define shift $13
+#define atemp $12
+#define bits $11
+#define lshift $9
+#define sbase $8
+#define stemp $2
+
+#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
+#define CASE_MASK 0x1e0 /* first case mask */
+
+#define ForEachLine $200
+#define NextLine $201
+#define NextLine1 $202
+#define CaseBegin $203
+#define ForEachBits $204
+#define ForEachBits1 $205
+#define NextBits $206
+
+#ifdef TETEXT
+#define cfbStippleStack cfbStippleStackTE
+#endif
+
+ .globl cfbStippleStack
+ .ent cfbStippleStack 2
+cfbStippleStack:
+ .frame $sp, 0, $31
+ lw count, Count /* fetch stack params */
+ la sbase,CaseBegin /* load up switch table */
+ lw shift, Shift
+ li lshift, 4 /* compute offset within */
+ subu lshift, lshift, shift /* stipple of remaining bits */
+#ifdef MIPSEL
+ addu shift, shift, CASE_SIZE /* first shift for LSB */
+#else
+ addu shift, shift, 28-CASE_SIZE /* first shift for MSB */
+#endif
+ /* do ... while (--count > 0); */
+ForEachLine:
+ lw bits, 0(stipple) /* get stipple bits */
+ move atemp, addr /* set up for this line */
+#ifdef TETEXT
+ /* Terminal emulator fonts are expanded and have many 0 rows */
+ beqz bits, NextLine /* skip out early on 0 */
+#endif
+ addu addr, addr, stride /* step for the loop */
+ BitsR stemp, bits, shift /* get first bits */
+ and stemp, stemp, CASE_MASK /* compute first branch */
+ addu stemp, stemp, sbase /* ... */
+ j stemp /* ... */
+ BitsL bits, bits, lshift /* set remaining bits */
+
+ForEachBits:
+ addu atemp, atemp, 4
+ForEachBits1:
+ FourBits(stemp, bits) /* compute jump for */
+ sll stemp, stemp, CASE_SIZE /* next four bits */
+ addu stemp, stemp, sbase /* ... */
+ j stemp /* ... */
+ BitsL bits, bits, 4 /* step for remaining bits */
+CaseBegin:
+ bnez bits, ForEachBits1 /* 0 */
+ addu atemp, atemp, 4
+NextLine:
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* 1 */
+ sb value, BO(0)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* 2 */
+ sb value, BO(1)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* 3 */
+ sh value, HO(0)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* 4 */
+ sb value, BO(2)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ sb value, BO(0)(atemp) /* 5 */
+ bnez bits, ForEachBits
+ sb value, BO(2)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ sb value, BO(1)(atemp) /* 6 */
+ bnez bits, ForEachBits
+ sb value, BO(2)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ bnez bits, ForEachBits /* 7 */
+ swl value, BO(2)(atemp) /* untested on MSB */
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* 8 */
+ sb value, BO(3)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ sb value, BO(0)(atemp) /* 9 */
+ bnez bits, ForEachBits
+ sb value, BO(3)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ sb value, BO(1)(atemp) /* a */
+ bnez bits, ForEachBits
+ sb value, BO(3)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ sh value, HO(0)(atemp) /* b */
+ bnez bits, ForEachBits
+ sb value, BO(3)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ bnez bits, ForEachBits /* c */
+ sh value, HO(2)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ sb value, BO(0)(atemp) /* d */
+ bnez bits, ForEachBits
+ sh value, HO(2)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+
+ bnez bits, ForEachBits /* e */
+ swr value, BO(1)(atemp) /* untested on MSB */
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ bnez bits, ForEachBits /* f */
+ sw value, WO(0)(atemp)
+ addu count, count, -1
+ bnez count, ForEachLine
+ addu stipple, stipple, 4
+ j $31
+ nop
+ nop
+
+ .end cfbStippleStack
diff --git a/xc/programs/Xserver/cfb/stipple68k.s b/xc/programs/Xserver/cfb/stipple68k.s
new file mode 100644
index 000000000..17fa205a8
--- /dev/null
+++ b/xc/programs/Xserver/cfb/stipple68k.s
@@ -0,0 +1,227 @@
+/*
+ * $TOG: stipple68k.s /main/4 1998/02/09 14:08:48 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/stipple68k.s,v 3.1 1998/10/04 09:37:54 dawes Exp $ */
+
+/*
+ * Stipple code for 68k processors
+ */
+
+#ifdef __ELF__
+#ifdef TETEXT
+#define _cfbStippleStack cfbStippleStackTE
+#else
+#define _cfbStippleStack cfbStippleStack
+#endif
+#else
+#ifdef TETEXT
+#define _cfbStippleStack _cfbStippleStackTE
+#endif
+#endif
+
+
+#define atemp a0
+#define addr a1
+#define stipple a2
+#define stride a3
+#define case a4
+
+#define ctemp d0
+#define value d1
+#define count d2
+#define shift d3
+#define c d4
+#define lshift d5
+#define rshift d6
+
+#define PushMask #0x3e38
+#define PopMask #0x1c7c
+#define NumReg 8
+#define arg0 36
+#define arg1 40
+#define arg2 44
+#define arg3 48
+#define arg4 52
+#define arg5 56
+#define arg6 60
+
+#ifdef __ELF__
+#define ForEachLine .L2
+#define ForEachBits .L5
+#define a0 %A0
+#define a1 %A1
+#define a2 %A2
+#define a3 %A3
+#define a4 %A4
+#define a5 %A5
+#define a6 %A6
+#define sp %SP
+#define d0 %D0
+#define d1 %D1
+#define d2 %D2
+#define d3 %D3
+#define d4 %D4
+#define d5 %D5
+#define d6 %D6
+#define d7 %D7
+#else
+#define ForEachLine L2
+#define ForEachBits L5
+#endif
+#define CASE_SIZE 5
+
+.text
+ .even
+ .globl _cfbStippleStack
+_cfbStippleStack:
+ moveml PushMask,sp@-
+ movel sp@(arg0),addr
+ movel sp@(arg1),stipple
+ movel sp@(arg2),value
+ movel sp@(arg3),stride
+ movew sp@(arg4+2),count
+ movel sp@(arg5),shift
+ subqw #1,count /* predecrement count */
+ lea CaseBegin,case
+ movew #28,lshift
+ addl shift,lshift
+ movew #28,rshift
+ subql #4,shift
+ negl shift
+ForEachLine:
+ movel addr,atemp
+ addl stride,addr
+ movel stipple@+,c
+#ifdef TETEXT
+ jeq NextLine
+#endif
+ /* Get first few bits */
+ movel c,ctemp
+ lsrl lshift,ctemp
+ lsll #CASE_SIZE,ctemp
+ lsll shift,c /* set up for next bits */
+ jmp case@(ctemp:l)
+
+ForEachBits:
+ addl #4,atemp
+ movel c,ctemp
+ lsrl rshift,ctemp /* better than lsrl, andi */
+ lsll #CASE_SIZE,ctemp
+ lsll #4,c /* set up for next bits */
+ jmp case@(ctemp:l)
+
+#define Break \
+ andl c,c ; \
+ jne ForEachBits ; \
+ dbra count,ForEachLine ; \
+ moveml sp@+,PopMask ; \
+ rts ;
+
+CaseBegin:
+ jne ForEachBits /* 0 */
+NextLine:
+ dbra count,ForEachLine
+ moveml sp@+,PopMask
+ rts
+
+ . = CaseBegin + 0x20
+
+ moveb value,atemp@(3) /* 1 */
+ Break
+
+ . = CaseBegin + 0x40
+
+ moveb value,atemp@(2) /* 2 */
+ Break
+
+ . = CaseBegin + 0x60
+
+ movew value,atemp@(2) /* 3 */
+ Break
+
+ . = CaseBegin + 0x80
+
+ moveb value,atemp@(1) /* 4 */
+ Break
+
+ . = CaseBegin + 0xa0
+
+ moveb value,atemp@(3) /* 5 */
+ moveb value,atemp@(1)
+ Break
+
+ . = CaseBegin + 0xc0
+
+ movew value,atemp@(1) /* 6 */
+ Break
+
+ . = CaseBegin + 0xe0
+
+ movew value,atemp@(2) /* 7 */
+ moveb value,atemp@(1)
+ Break
+
+ . = CaseBegin + 0x100
+
+ moveb value,atemp@ /* 8 */
+ Break
+
+ . = CaseBegin + 0x120
+
+ moveb value,atemp@(3) /* 9 */
+ moveb value,atemp@
+ Break
+
+ . = CaseBegin + 0x140
+
+ moveb value,atemp@(2) /* a */
+ moveb value,atemp@
+ Break
+
+ . = CaseBegin + 0x160
+
+ movew value,atemp@(2) /* b */
+ moveb value,atemp@
+ Break
+
+ . = CaseBegin + 0x180
+
+ movew value,atemp@ /* c */
+ Break
+
+ . = CaseBegin + 0x1a0
+
+ moveb value,atemp@(3) /* d */
+ movew value,atemp@
+ Break
+
+ . = CaseBegin + 0x1c0
+
+ moveb value,atemp@(2) /* e */
+ movew value,atemp@
+ Break
+
+ . = CaseBegin + 0x1e0
+
+ movel value,atemp@ /* f */
+ Break
diff --git a/xc/programs/Xserver/cfb/stipsparc.s b/xc/programs/Xserver/cfb/stipsparc.s
new file mode 100644
index 000000000..3203cd4e2
--- /dev/null
+++ b/xc/programs/Xserver/cfb/stipsparc.s
@@ -0,0 +1,277 @@
+/*
+ * $TOG: stipsparc.s /main/10 1998/02/09 14:08:53 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.3 1999/03/29 13:17:03 dawes Exp $ */
+
+/*
+ * SPARC assembly code for optimized text rendering.
+ *
+ * Other stippling could be done in assembly, but the payoff is
+ * not nearly as large. Mostly because large areas are heavily
+ * optimized already.
+ */
+
+/* not that I expect to ever see an LSB SPARC, but ... */
+#ifdef LITTLE_ENDIAN
+# define BitsR sll
+# define BitsL srl
+# define BO(o) o
+# define HO(o) o
+# define WO(o) o
+# define FourBits(dest,bits) and bits, 0xf, dest
+#else
+# define BitsR srl
+# define BitsL sll
+# define BO(o) 3-o
+# define HO(o) 2-o
+# define WO(o) o
+# define FourBits(dest,bits) srl bits, 28, dest
+#endif
+
+/*
+ * cfbStippleStack(addr, stipple, value, stride, Count, Shift)
+ * 4 5 6 7 16(sp) 20(sp)
+ *
+ * Apply successive 32-bit stipples starting at addr, addr+stride, ...
+ *
+ * Used for text rendering, but only when no data could be lost
+ * when the stipple is shifted left by Shift bits
+ */
+/* arguments */
+#define addr %i0
+#define stipple %i1
+#define value %i2
+#define stride %i3
+#define count %i4
+#define shift %i5
+
+/* local variables */
+#define atemp %l0
+#define bits %l1
+#define lshift %l2
+#define sbase %l3
+#define stemp %l4
+
+#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
+#define CASE_MASK 0x1e0 /* first case mask */
+
+#define ForEachLine LY1
+#define NextLine LY2
+#define CaseBegin LY3
+#define ForEachBits LY4
+#define NextBits LY5
+
+#if defined(SVR4) || defined(__ELF__)
+#ifdef TETEXT
+#define _cfbStippleStack cfbStippleStackTE
+#else
+#define _cfbStippleStack cfbStippleStack
+#endif
+#else
+#ifdef TETEXT
+#define _cfbStippleStack _cfbStippleStackTE
+#endif
+#endif
+ .seg "text"
+ .proc 16
+ .globl _cfbStippleStack
+_cfbStippleStack:
+ save %sp,-64,%sp
+ sethi %hi(CaseBegin),sbase /* load up switch table */
+ or sbase,%lo(CaseBegin),sbase
+
+ mov 4,lshift /* compute offset within */
+ sub lshift, shift, lshift /* stipple of remaining bits */
+#ifdef LITTLE_ENDIAN
+ inc CASE_SIZE, shift /* first shift for LSB */
+#else
+ inc 28-CASE_SIZE, shift /* first shift for MSB */
+#endif
+ /* do ... while (--count > 0); */
+ForEachLine:
+ ld [stipple],bits /* get stipple bits */
+ mov addr,atemp /* set up for this line */
+#ifdef TETEXT
+ /* Terminal emulator fonts are expanded and have many 0 rows */
+ tst bits
+ bz NextLine /* skip out early on 0 */
+#endif
+ add addr, stride, addr /* step for the loop */
+ BitsR bits, shift, stemp /* get first bits */
+ and stemp, CASE_MASK, stemp /* compute first jump */
+ BitsL bits, lshift, bits /* set remaining bits */
+ jmp sbase+stemp /* ... */
+ tst bits
+
+ForEachBits:
+ inc 4, atemp
+ForEachBits1:
+ FourBits(stemp, bits) /* compute jump for */
+ sll stemp, CASE_SIZE, stemp /* these four bits */
+ BitsL bits, 4, bits /* step for remaining bits */
+ jmp sbase+stemp /* jump */
+ tst bits
+CaseBegin:
+ bnz,a ForEachBits1 /* 0 */
+ inc 4, atemp
+NextLine:
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 1 */
+ stb value, [atemp+BO(0)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 2 */
+ stb value, [atemp+BO(1)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 3 */
+ sth value, [atemp+HO(0)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 4 */
+ stb value, [atemp+BO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ stb value, [atemp+BO(0)] /* 5 */
+ bnz ForEachBits
+ stb value, [atemp+BO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ stb value, [atemp+BO(1)] /* 6 */
+ bnz ForEachBits
+ stb value, [atemp+BO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ sth value, [atemp+HO(0)] /* 7 */
+ bnz ForEachBits
+ stb value, [atemp+BO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ bnz ForEachBits /* 8 */
+ stb value, [atemp+BO(3)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ stb value, [atemp+BO(0)] /* 9 */
+ bnz ForEachBits
+ stb value, [atemp+BO(3)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ stb value, [atemp+BO(1)] /* a */
+ bnz ForEachBits
+ stb value, [atemp+BO(3)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ sth value, [atemp+HO(0)] /* b */
+ bnz ForEachBits
+ stb value, [atemp+BO(3)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ bnz ForEachBits /* c */
+ sth value, [atemp+HO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ stb value, [atemp+BO(0)] /* d */
+ bnz ForEachBits
+ sth value, [atemp+HO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ stb value, [atemp+BO(1)] /* e */
+ bnz ForEachBits
+ sth value, [atemp+HO(2)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ bnz ForEachBits /* f */
+ st value, [atemp+WO(0)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
diff --git a/xc/programs/Xserver/cfb/stipsprc32.s b/xc/programs/Xserver/cfb/stipsprc32.s
new file mode 100644
index 000000000..416ca71e8
--- /dev/null
+++ b/xc/programs/Xserver/cfb/stipsprc32.s
@@ -0,0 +1,278 @@
+/*
+ * $TOG: stipsprc32.s /main/4 1998/02/09 14:09:00 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.3 1999/03/29 13:17:03 dawes Exp $ */
+
+/*
+ * SPARC assembly code for optimized text rendering.
+ *
+ * Other stippling could be done in assembly, but the payoff is
+ * not nearly as large. Mostly because large areas are heavily
+ * optimized already.
+ */
+
+/* not that I expect to ever see an LSB SPARC, but ... */
+#ifdef LITTLE_ENDIAN
+# define BitsR sll
+# define BitsL srl
+# define WO(o) 3-o
+# define FourBits(dest,bits) and bits, 0xf, dest
+#else
+# define BitsR srl
+# define BitsL sll
+# define WO(o) o
+# define FourBits(dest,bits) srl bits, 28, dest
+#endif
+
+/*
+ * cfb32StippleStack(addr, stipple, value, stride, Count, Shift)
+ * 4 5 6 7 16(sp) 20(sp)
+ *
+ * Apply successive 32-bit stipples starting at addr, addr+stride, ...
+ *
+ * Used for text rendering, but only when no data could be lost
+ * when the stipple is shifted left by Shift bits
+ */
+/* arguments */
+#define addr %i0
+#define stipple %i1
+#define value %i2
+#define stride %i3
+#define count %i4
+#define shift %i5
+
+/* local variables */
+#define atemp %l0
+#define bits %l1
+#define lshift %l2
+#define sbase %l3
+#define stemp %l4
+
+#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
+#define CASE_MASK 0x1e0 /* first case mask */
+
+#define ForEachLine LY1
+#define NextLine LY2
+#define CaseBegin LY3
+#define ForEachBits LY4
+#define NextBits LY5
+
+#if defined(SVR4) || defined(__ELF__)
+#ifdef TETEXT
+#define _cfb32StippleStack cfb32StippleStackTE
+#else
+#define _cfb32StippleStack cfb32StippleStack
+#endif
+#else
+#ifdef TETEXT
+#define _cfb32StippleStack _cfb32StippleStackTE
+#endif
+#endif
+
+ .seg "text"
+ .proc 16
+ .globl _cfb32StippleStack
+_cfb32StippleStack:
+ save %sp,-64,%sp
+ sethi %hi(CaseBegin),sbase /* load up switch table */
+ or sbase,%lo(CaseBegin),sbase
+
+ mov 4,lshift /* compute offset within */
+ sub lshift, shift, lshift /* stipple of remaining bits */
+#ifdef LITTLE_ENDIAN
+ inc CASE_SIZE, shift /* first shift for LSB */
+#else
+ inc 28-CASE_SIZE, shift /* first shift for MSB */
+#endif
+ /* do ... while (--count > 0); */
+ForEachLine:
+ ld [stipple],bits /* get stipple bits */
+ mov addr,atemp /* set up for this line */
+#ifdef TETEXT
+ /* Terminal emulator fonts are expanded and have many 0 rows */
+ tst bits
+ bz NextLine /* skip out early on 0 */
+#endif
+ add addr, stride, addr /* step for the loop */
+ BitsR bits, shift, stemp /* get first bits */
+ and stemp, CASE_MASK, stemp /* compute first jump */
+ BitsL bits, lshift, bits /* set remaining bits */
+ jmp sbase+stemp /* ... */
+ tst bits
+
+ForEachBits:
+ inc 16, atemp
+ForEachBits1:
+ FourBits(stemp, bits) /* compute jump for */
+ sll stemp, CASE_SIZE, stemp /* these four bits */
+ BitsL bits, 4, bits /* step for remaining bits */
+ jmp sbase+stemp /* jump */
+ tst bits
+CaseBegin:
+ bnz,a ForEachBits1 /* 0 */
+ inc 16, atemp
+NextLine:
+ deccc 1, count
+NextLine1:
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 1 */
+ st value, [atemp+WO(12)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ bnz ForEachBits /* 2 */
+ st value, [atemp+WO(8)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ st value, [atemp+WO(8)] /* 3 */
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ bnz ForEachBits /* 4 */
+ st value, [atemp+WO(4)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ st value, [atemp+WO(4)] /* 5 */
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ st value, [atemp+WO(4)] /* 6 */
+ bnz ForEachBits
+ st value, [atemp+WO(8)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ st value, [atemp+WO(4)] /* 7 */
+ st value, [atemp+WO(8)]
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ b NextLine1
+ deccc 1, count
+ nop
+ nop
+
+ bnz ForEachBits /* 8 */
+ st value, [atemp+WO(0)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+ nop
+
+ st value, [atemp+WO(0)] /* 9 */
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ st value, [atemp+WO(0)] /* a */
+ bnz ForEachBits
+ st value, [atemp+WO(8)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ st value, [atemp+WO(0)] /* b */
+ st value, [atemp+WO(8)]
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ b NextLine1
+ deccc 1, count
+ nop
+ nop
+
+ st value, [atemp+WO(0)] /* c */
+ bnz ForEachBits
+ st value, [atemp+WO(4)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
+
+ st value, [atemp+WO(0)] /* d */
+ st value, [atemp+WO(4)]
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ b NextLine1
+ deccc 1, count
+ nop
+ nop
+
+ st value, [atemp+WO(0)] /* e */
+ st value, [atemp+WO(4)]
+ bnz ForEachBits
+ st value, [atemp+WO(8)]
+ b NextLine1
+ deccc 1, count
+ nop
+ nop
+
+ st value, [atemp+WO(0)] /* f */
+ st value, [atemp+WO(4)]
+ st value, [atemp+WO(8)]
+ bnz ForEachBits
+ st value, [atemp+WO(12)]
+ deccc 1, count
+ bnz,a ForEachLine
+ inc 4, stipple
+ ret
+ restore
diff --git a/xc/programs/Xserver/cfb16/Imakefile b/xc/programs/Xserver/cfb16/Imakefile
new file mode 100644
index 000000000..3cd230409
--- /dev/null
+++ b/xc/programs/Xserver/cfb16/Imakefile
@@ -0,0 +1,5 @@
+XCOMM $XConsortium: Imakefile,v 1.1 91/12/28 13:32:27 rws Exp $
+#define PixelSize 16
+#define LinkDirectory ../cfb
+
+#include "../cfb/Imakefile"
diff --git a/xc/programs/Xserver/cfb16/cfbmodule.c b/xc/programs/Xserver/cfb16/cfbmodule.c
new file mode 100644
index 000000000..c8c79b545
--- /dev/null
+++ b/xc/programs/Xserver/cfb16/cfbmodule.c
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/cfb16/cfbmodule.c,v 1.8 1999/01/26 05:53:49 dawes Exp $ */
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef XFree86LOADER
+
+#include "xf86Module.h"
+#include "cfb.h"
+
+static MODULESETUPPROTO(cfb16Setup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb16",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+XF86ModuleData cfb16ModuleData = { &VersRec, cfb16Setup, NULL };
+
+static pointer
+cfb16Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires cfb, so load it */
+ return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
+
+#endif
diff --git a/xc/programs/Xserver/cfb24/Imakefile b/xc/programs/Xserver/cfb24/Imakefile
new file mode 100644
index 000000000..46e93dd43
--- /dev/null
+++ b/xc/programs/Xserver/cfb24/Imakefile
@@ -0,0 +1,5 @@
+XCOMM $XFree86: xc/programs/Xserver/cfb24/Imakefile,v 3.0 1996/06/29 09:06:07 dawes Exp $
+#define PixelSize 24
+#define LinkDirectory ../cfb
+
+#include "../cfb/Imakefile"
diff --git a/xc/programs/Xserver/cfb24/cfbmodule.c b/xc/programs/Xserver/cfb24/cfbmodule.c
new file mode 100644
index 000000000..cf363f3c7
--- /dev/null
+++ b/xc/programs/Xserver/cfb24/cfbmodule.c
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/cfb24/cfbmodule.c,v 1.8 1999/01/26 05:53:49 dawes Exp $ */
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef XFree86LOADER
+
+#include "xf86Module.h"
+#include "cfb.h"
+
+static MODULESETUPPROTO(cfb24Setup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb24",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+XF86ModuleData cfb24ModuleData = { &VersRec, cfb24Setup, NULL };
+
+static pointer
+cfb24Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires cfb, so load it */
+ return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
+
+#endif
diff --git a/xc/programs/Xserver/cfb24/cfbrrop24.h b/xc/programs/Xserver/cfb24/cfbrrop24.h
new file mode 100644
index 000000000..f77009ddc
--- /dev/null
+++ b/xc/programs/Xserver/cfb24/cfbrrop24.h
@@ -0,0 +1,60 @@
+/* $XFree86: xc/programs/Xserver/cfb24/cfbrrop24.h,v 3.0 1996/06/29 09:06:09 dawes Exp $ */
+
+#define RROP_DECLARE register unsigned long rrop_and, rrop_xor; \
+ unsigned long piQxelAnd[3], piQxelXor[3], spiQxelAnd[8], spiQxelXor[8];
+
+#define RROP_COPY_SETUP(ptn) \
+ spiQxelXor[0] = ptn & 0xFFFFFF; \
+ spiQxelXor[2] = ptn << 24; \
+ spiQxelXor[3] = (ptn & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = ptn << 16; \
+ spiQxelXor[5] = (ptn & 0xFF0000)>> 16; \
+ spiQxelXor[6] = ptn << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0;
+
+#define RROP_SOLID24_COPY(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
+ }
+
+#define RROP_SET_SETUP(xor, and) \
+ spiQxelXor[0] = xor & 0xFFFFFF; \
+ spiQxelXor[1] = xor << 24; \
+ spiQxelXor[2] = xor << 16; \
+ spiQxelXor[3] = xor << 8; \
+ spiQxelXor[4] = (xor >> 8) & 0xFFFF; \
+ spiQxelXor[5] = (xor >> 16) & 0xFF; \
+ spiQxelAnd[0] = (and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[1] = (and << 24) | 0xFFFFFF; \
+ spiQxelAnd[2] = (and << 16) | 0xFFFF; \
+ spiQxelAnd[3] = (and << 8) | 0xFF; \
+ spiQxelAnd[4] = ((and >> 8) & 0xFFFF) | 0xFFFF0000; \
+ spiQxelAnd[5] = ((and >> 16) & 0xFF) | 0xFFFFFF00; \
+ piQxelAnd[0] = (and & 0xFFFFFF)|(and << 24); \
+ piQxelAnd[1] = (and << 16)|((and >> 8) & 0xFFFF); \
+ piQxelAnd[2] = (and << 8)|((and >> 16) & 0xFF); \
+ piQxelXor[0] = (xor & 0xFFFFFF)|(xor << 24); \
+ piQxelXor[1] = (xor << 16)|((xor >> 8) & 0xFFFF); \
+ piQxelXor[2] = (xor << 8)|((xor >> 16) & 0xFF);
+
+
+#define RROP_SOLID24_SET(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
+ break; \
+ case 3: \
+ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
+ break; \
+ case 1: \
+ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
+ break; \
+ case 2: \
+ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
+ break; \
+ } \
+ }
diff --git a/xc/programs/Xserver/cfb32/Imakefile b/xc/programs/Xserver/cfb32/Imakefile
new file mode 100644
index 000000000..ca7a0a7f2
--- /dev/null
+++ b/xc/programs/Xserver/cfb32/Imakefile
@@ -0,0 +1,5 @@
+XCOMM $XConsortium: Imakefile,v 1.1 91/12/28 13:32:46 rws Exp $
+#define PixelSize 32
+#define LinkDirectory ../cfb
+
+#include "../cfb/Imakefile"
diff --git a/xc/programs/Xserver/cfb32/cfbmodule.c b/xc/programs/Xserver/cfb32/cfbmodule.c
new file mode 100644
index 000000000..791b64285
--- /dev/null
+++ b/xc/programs/Xserver/cfb32/cfbmodule.c
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/cfb32/cfbmodule.c,v 1.8 1999/01/26 05:53:49 dawes Exp $ */
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef XFree86LOADER
+
+#include "xf86Module.h"
+#include "cfb.h"
+
+static MODULESETUPPROTO(cfb32Setup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb32",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+XF86ModuleData cfb32ModuleData = { &VersRec, cfb32Setup, NULL };
+
+static pointer
+cfb32Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires cfb, so load it */
+ return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
+
+#endif
diff --git a/xc/programs/Xserver/dbe/Imakefile b/xc/programs/Xserver/dbe/Imakefile
new file mode 100644
index 000000000..6e09449d9
--- /dev/null
+++ b/xc/programs/Xserver/dbe/Imakefile
@@ -0,0 +1,32 @@
+XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:06:40 rws $
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/dbe/Imakefile,v 3.7 1999/08/14 10:49:27 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+#if DoLoadableServer
+ MSRCS = dbemodule.c
+ MOBJS = dbemodule.o
+#endif
+
+ SRCS = dbe.c midbe.c $(MSRCS)
+ OBJS = dbe.o midbe.o $(MOBJS)
+ INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(EXTRAINCLUDES)
+ LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
+
+ModuleObjectRule()
+
+LibraryModuleTarget(dbe,$(OBJS))
+
+LintLibraryTarget(dbe,$(SRCS))
+NormalLintTarget($(SRCS))
+
+InstallLibraryModule(dbe,$(MODULEDIR),extensions)
+
+DependTarget()
+
+InstallDriverSDKLibraryModule(dbe,$(DRIVERSDKMODULEDIR),extensions)
diff --git a/xc/programs/Xserver/dbe/dbe.c b/xc/programs/Xserver/dbe/dbe.c
new file mode 100644
index 000000000..d1630408e
--- /dev/null
+++ b/xc/programs/Xserver/dbe/dbe.c
@@ -0,0 +1,1981 @@
+/* $XConsortium: dbe.c /main/4 1996/08/01 19:24:47 dpw $ */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * DIX DBE code
+ *
+ *****************************************************************************/
+/* $XFree86: xc/programs/Xserver/dbe/dbe.c,v 3.6 1998/12/20 11:57:31 dawes Exp $ */
+
+
+/* INCLUDES */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+#define NEED_DBE_PROTOCOL
+#include "dbestruct.h"
+#include "midbe.h"
+
+#ifdef XFree86LOADER
+#include "xf86_ansic.h"
+#endif
+
+/* GLOBALS */
+
+/* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */
+static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
+
+/* These are static globals copied to DBE's screen private for use by DDX */
+static int dbeScreenPrivIndex;
+static int dbeWindowPrivIndex;
+
+/* These are static globals copied to DBE's screen private for use by DDX */
+static RESTYPE dbeDrawableResType;
+static RESTYPE dbeWindowPrivResType;
+
+/* This global is used by DbeAllocWinPrivPrivIndex() */
+static int winPrivPrivCount = 0;
+
+/* Used to generate DBE's BadBuffer error. */
+static int dbeErrorBase;
+
+/* Used by DbeRegisterFunction() to initialize the initialization function
+ * table only once per server lifetime.
+ */
+static Bool firstRegistrationPass = TRUE;
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeValidateBuffer
+ *
+ * Description:
+ *
+ * This function is called from VALIDATE_DRAWABLE_AND_GC and from
+ * various places in dispatch.c if the server has been compiled with
+ * the flags -DNEED_DBE_BUF_BITS and -DNEED_DBE_BUF_VALIDATE.
+ * When pWin->dstBuffer changes, this function will be called with pWin
+ * as the first argument, the drawable ID that was specified as the
+ * second argument (could be a back buffer id), and True for the third
+ * argument.
+ * When pWin->srcBuffer changes, the third argument will be False, and
+ * the first two arguments are as described for dstBuffer.
+ *
+ * This function should prepare the hardware to access the specified
+ * buffer for reads (if dstbuf is False) or writes (if dstbuf is True).
+ *
+ *****************************************************************************/
+
+void
+DbeValidateBuffer(pWin, drawID, dstbuf)
+ WindowPtr pWin;
+ XID drawID;
+ Bool dstbuf;
+{
+ DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
+ if (pDbeScreenPriv->ValidateBuffer)
+ (*pDbeScreenPriv->ValidateBuffer)(pWin, drawID, dstbuf);
+}
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeRegisterFunction
+ *
+ * Description:
+ *
+ * This function registers the DBE init function for the specified screen.
+ *
+ *****************************************************************************/
+
+void
+DbeRegisterFunction(pScreen, funct)
+ ScreenPtr pScreen;
+ Bool (*funct)();
+{
+ int i;
+
+ /* Initialize the initialization function table if it has not been
+ * initialized already.
+ */
+ if (firstRegistrationPass)
+ {
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ DbeInitFunct[i] = NULL;
+ }
+
+ firstRegistrationPass = FALSE;
+ }
+
+ DbeInitFunct[pScreen->myNum] = funct;
+
+} /* DbeRegisterFunction() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeAllocWinPriv
+ *
+ * Description:
+ *
+ * This function was cloned from AllocateWindow() in window.c.
+ * This function allocates a window priv structure to be associated
+ * with a double-buffered window.
+ *
+ *****************************************************************************/
+static DbeWindowPrivPtr
+DbeAllocWinPriv(pScreen)
+ ScreenPtr pScreen;
+{
+ DbeWindowPrivPtr pDbeWindowPriv;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ register char *ptr;
+ register DevUnion *ppriv;
+ register unsigned int *sizes;
+ register unsigned int size;
+ register int i;
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(pDbeScreenPriv->totalWinPrivSize);
+
+ if (pDbeWindowPriv)
+ {
+ ppriv = (DevUnion *)(pDbeWindowPriv + 1);
+ pDbeWindowPriv->devPrivates = ppriv;
+ sizes = pDbeScreenPriv->winPrivPrivSizes;
+ ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen);
+ for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++)
+ {
+ if (size = *sizes)
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+ }
+
+ return(pDbeWindowPriv);
+
+} /* DbeAllocWinPriv() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeFallbackAllocWinPriv
+ *
+ * Description:
+ *
+ * This is a fallback function for AllocWinPriv().
+ *
+ *****************************************************************************/
+
+static DbeWindowPrivPtr
+DbeFallbackAllocWinPriv(pScreen)
+ ScreenPtr pScreen;
+{
+ return (NULL);
+
+} /* DbeFallbackAllocWinPriv() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeAllocWinPrivPrivIndex
+ *
+ * Description:
+ *
+ * This function was cloned from AllocateWindowPrivateIndex() in window.c.
+ * This function allocates a new window priv priv index by simply returning
+ * an incremented private counter.
+ *
+ *****************************************************************************/
+
+static int
+DbeAllocWinPrivPrivIndex()
+{
+ return winPrivPrivCount++;
+
+} /* DbeAllocWinPrivPrivIndex() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeAllocWinPrivPriv
+ *
+ * Description:
+ *
+ * This function was cloned from AllocateWindowPrivate() in privates.c.
+ * This function allocates a private structure to be hung off
+ * a window private.
+ *
+ *****************************************************************************/
+
+static Bool
+DbeAllocWinPrivPriv(pScreen, index, amount)
+ register ScreenPtr pScreen;
+ int index;
+ unsigned int amount;
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+ unsigned int oldamount;
+
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (index >= pDbeScreenPriv->winPrivPrivLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(pDbeScreenPriv->winPrivPrivSizes,
+ (index + 1) * sizeof(unsigned));
+ if (!nsizes)
+ {
+ return(FALSE);
+ }
+
+ while (pDbeScreenPriv->winPrivPrivLen <= index)
+ {
+ nsizes[pDbeScreenPriv->winPrivPrivLen++] = 0;
+ pDbeScreenPriv->totalWinPrivSize += sizeof(DevUnion);
+ }
+
+ pDbeScreenPriv->winPrivPrivSizes = nsizes;
+ }
+
+ oldamount = pDbeScreenPriv->winPrivPrivSizes[index];
+
+ if (amount > oldamount)
+ {
+ pDbeScreenPriv->winPrivPrivSizes[index] = amount;
+ pDbeScreenPriv->totalWinPrivSize += (amount - oldamount);
+ }
+ return(TRUE);
+
+} /* DbeAllocWinPrivPriv() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeStubScreen
+ *
+ * Description:
+ *
+ * This is function stubs the function pointers in the given DBE screen
+ * private and increments the number of stubbed screens.
+ *
+ *****************************************************************************/
+
+static void
+DbeStubScreen(pDbeScreenPriv, nStubbedScreens)
+ DbeScreenPrivPtr pDbeScreenPriv;
+ int *nStubbedScreens;
+{
+ /* Stub DIX. */
+ pDbeScreenPriv->SetupBackgroundPainter = NULL;
+ pDbeScreenPriv->AllocWinPriv = NULL;
+ pDbeScreenPriv->AllocWinPrivPrivIndex = NULL;
+ pDbeScreenPriv->AllocWinPrivPriv = NULL;
+
+ /* Do not unwrap PositionWindow nor DestroyWindow. If the DDX
+ * initialization function failed, we assume that it did not wrap
+ * PositionWindow. Also, DestroyWindow is only wrapped if the DDX
+ * initialization function succeeded.
+ */
+
+ /* Stub DDX. */
+ pDbeScreenPriv->GetVisualInfo = NULL;
+ pDbeScreenPriv->AllocBackBufferName = NULL;
+ pDbeScreenPriv->SwapBuffers = NULL;
+ pDbeScreenPriv->BeginIdiom = NULL;
+ pDbeScreenPriv->EndIdiom = NULL;
+ pDbeScreenPriv->WinPrivDelete = NULL;
+ pDbeScreenPriv->ResetProc = NULL;
+ pDbeScreenPriv->ValidateBuffer = NULL;
+
+ (*nStubbedScreens)++;
+
+} /* DbeStubScreen() */
+
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeGetVersion
+ *
+ * Description:
+ *
+ * This function is for processing a DbeGetVersion request.
+ * This request returns the major and minor version numbers of this
+ * extension.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeGetVersion(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeGetVersionReq);
+ xDbeGetVersionReply rep;
+ register int n;
+
+
+ REQUEST_SIZE_MATCH(xDbeGetVersionReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = DBE_MAJOR_VERSION;
+ rep.minorVersion = DBE_MINOR_VERSION;
+
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ }
+
+ WriteToClient(client, sizeof(xDbeGetVersionReply), (char *)&rep);
+
+ return(client->noClientException);
+
+} /* ProcDbeGetVersion() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeAllocateBackBufferName
+ *
+ * Description:
+ *
+ * This function is for processing a DbeAllocateBackBufferName request.
+ * This request allocates a drawable ID used to refer to the back buffer
+ * of a window.
+ *
+ * Return Values:
+ *
+ * BadAlloc - server can not allocate resources
+ * BadIDChoice - id is out of range for client; id is already in use
+ * BadMatch - window is not an InputOutput window;
+ * visual of window is not on list returned by
+ * DBEGetVisualInfo;
+ * BadValue - invalid swap action is specified
+ * BadWindow - window is not a valid window
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeAllocateBackBufferName(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeAllocateBackBufferNameReq);
+ WindowPtr pWin;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ XdbeScreenVisualInfo scrVisInfo;
+ register int i;
+ Bool visualMatched = FALSE;
+ xDbeSwapAction swapAction;
+ VisualID visual;
+ int status;
+
+
+ REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
+
+ /* The window must be valid. */
+ if (!(pWin = SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess)))
+ {
+ return(BadWindow);
+ }
+
+ /* The window must be InputOutput. */
+ if (pWin->drawable.class != InputOutput)
+ {
+ return(BadMatch);
+ }
+
+ /* The swap action must be valid. */
+ swapAction = stuff->swapAction; /* use local var for performance. */
+ if ((swapAction != XdbeUndefined ) &&
+ (swapAction != XdbeBackground) &&
+ (swapAction != XdbeUntouched ) &&
+ (swapAction != XdbeCopied ))
+ {
+ return(BadValue);
+ }
+
+ /* The id must be in range and not already in use. */
+ LEGAL_NEW_RESOURCE(stuff->buffer, client);
+
+ /* The visual of the window must be in the list returned by
+ * GetVisualInfo.
+ */
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
+ if (!pDbeScreenPriv->GetVisualInfo)
+ return(BadMatch); /* screen doesn't support double buffering */
+
+ if (!(*pDbeScreenPriv->GetVisualInfo)(pWin->drawable.pScreen, &scrVisInfo))
+ {
+ /* GetVisualInfo() failed to allocate visual info data. */
+ return(BadAlloc);
+ }
+
+ /* See if the window's visual is on the list. */
+ visual = wVisual(pWin);
+ for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++)
+ {
+ if (scrVisInfo.visinfo[i].visual == visual)
+ {
+ visualMatched = TRUE;
+ }
+ }
+
+ /* Free what was allocated by the GetVisualInfo() call above. */
+ xfree(scrVisInfo.visinfo);
+
+ if (!visualMatched)
+ {
+ return(BadMatch);
+ }
+
+ if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL)
+ {
+ /* There is no buffer associated with the window.
+ * Allocate a window priv.
+ */
+
+ if (!(pDbeWindowPriv =
+ (*pDbeScreenPriv->AllocWinPriv)(pWin->drawable.pScreen)))
+ {
+ return(BadAlloc);
+ }
+
+ /* Make the window priv a DBE window priv resource. */
+ if (!AddResource(stuff->buffer, dbeWindowPrivResType,
+ (pointer)pDbeWindowPriv))
+ {
+ xfree(pDbeWindowPriv);
+ return(BadAlloc);
+ }
+
+ /* Fill out window priv information. */
+ pDbeWindowPriv->pWindow = pWin;
+ pDbeWindowPriv->width = pWin->drawable.width;
+ pDbeWindowPriv->height = pWin->drawable.height;
+ pDbeWindowPriv->x = pWin->drawable.x;
+ pDbeWindowPriv->y = pWin->drawable.y;
+ pDbeWindowPriv->nBufferIDs = 0;
+
+ /* Set the buffer ID array pointer to the initial (static) array). */
+ pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs;
+
+ /* Initialize the buffer ID list. */
+ pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
+ pDbeWindowPriv->IDs[0] = stuff->buffer;
+ for (i = 1; i < DBE_INIT_MAX_IDS; i++)
+ {
+ pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
+ }
+
+
+ /* Actually connect the window priv to the window. */
+ pWin->devPrivates[dbeWindowPrivIndex].ptr = (pointer)pDbeWindowPriv;
+
+ } /* if -- There is no buffer associated with the window. */
+
+ else
+ {
+ /* A buffer is already associated with the window.
+ * Add the new buffer ID to the array, reallocating the array memory
+ * if necessary.
+ */
+
+ /* Determine if there is a free element in the ID array. */
+ for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++)
+ {
+ if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT)
+ {
+ /* There is still room in the ID array. */
+ break;
+ }
+ }
+
+ if (i == pDbeWindowPriv->maxAvailableIDs)
+ {
+ /* No more room in the ID array -- reallocate another array. */
+ XID *pIDs;
+
+
+ /* Setup an array pointer for the realloc operation below. */
+ if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
+ {
+ /* We will malloc a new array. */
+ pIDs = NULL;
+ }
+ else
+ {
+ /* We will realloc a new array. */
+ pIDs = pDbeWindowPriv->IDs;
+ }
+
+ /* malloc/realloc a new array and initialize all elements to 0. */
+ pDbeWindowPriv->IDs = (XID *)xrealloc(pIDs,
+ (pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
+ if (!pDbeWindowPriv->IDs)
+ {
+ return(BadAlloc);
+ }
+ memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0,
+ (pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS -
+ pDbeWindowPriv->nBufferIDs) * sizeof(XID));
+
+ if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
+ {
+ /* We just went from using the initial (static) array to a
+ * newly allocated array. Copy the IDs from the initial array
+ * to the new array.
+ */
+ memcpy(pDbeWindowPriv->IDs, pDbeWindowPriv->initIDs,
+ DBE_INIT_MAX_IDS * sizeof(XID));
+ }
+
+ pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS;
+ }
+
+ /* Finally, record the buffer ID in the array. */
+ pDbeWindowPriv->IDs[i] = stuff->buffer;
+
+ /* Associate the new ID with an existing window priv. */
+ if (!AddResource(stuff->buffer, dbeWindowPrivResType,
+ (pointer)pDbeWindowPriv))
+ {
+ pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
+ return(BadAlloc);
+ }
+
+ } /* else -- A buffer is already associated with the window. */
+
+
+ /* Call the DDX routine to allocate the back buffer. */
+ status = (*pDbeScreenPriv->AllocBackBufferName)(pWin, stuff->buffer,
+ stuff->swapAction);
+
+ if ((status != Success) && (pDbeWindowPriv->nBufferIDs == 0))
+ {
+ /* The DDX buffer allocation routine failed for the first buffer of
+ * this window.
+ */
+ xfree(pDbeWindowPriv);
+ return(status);
+ }
+
+ /* Increment the number of buffers (XIDs) associated with this window. */
+ pDbeWindowPriv->nBufferIDs++;
+
+ /* Set swap action on all calls. */
+ pDbeWindowPriv->swapAction = stuff->swapAction;
+
+
+ return(status);
+
+} /* ProcDbeAllocateBackBufferName() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeDeallocateBackBufferName
+ *
+ * Description:
+ *
+ * This function is for processing a DbeDeallocateBackBufferName request.
+ * This request frees a drawable ID that was obtained by a
+ * DbeAllocateBackBufferName request.
+ *
+ * Return Values:
+ *
+ * BadBuffer - buffer to deallocate is not associated with a window
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeDeallocateBackBufferName(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeDeallocateBackBufferNameReq);
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int i;
+
+
+ REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
+
+ /* Buffer name must be valid */
+ if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
+ stuff->buffer, dbeWindowPrivResType, SecurityDestroyAccess)) ||
+ !(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType,
+ SecurityDestroyAccess)))
+ {
+ client->errorValue = stuff->buffer;
+ return(dbeErrorBase + DbeBadBuffer);
+ }
+
+ /* Make sure that the id is valid for the window.
+ * This is paranoid code since we already looked up the ID by type
+ * above.
+ */
+
+ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
+ {
+ /* Loop through the ID list to find the ID. */
+ if (pDbeWindowPriv->IDs[i] == stuff->buffer)
+ {
+ break;
+ }
+ }
+
+ if (i == pDbeWindowPriv->nBufferIDs)
+ {
+ /* We did not find the ID in the ID list. */
+ client->errorValue = stuff->buffer;
+ return(dbeErrorBase + DbeBadBuffer);
+ }
+
+ FreeResource(stuff->buffer, RT_NONE);
+
+ return(Success);
+
+} /* ProcDbeDeallocateBackBufferName() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeSwapBuffers
+ *
+ * Description:
+ *
+ * This function is for processing a DbeSwapBuffers request.
+ * This request swaps the buffers for all windows listed, applying the
+ * appropriate swap action for each window.
+ *
+ * Return Values:
+ *
+ * BadAlloc - local allocation failed; this return value is not defined
+ * by the protocol
+ * BadMatch - a window in request is not double-buffered; a window in
+ * request is listed more than once
+ * BadValue - invalid swap action is specified; no swap action is
+ * specified
+ * BadWindow - a window in request is not valid
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeSwapBuffers(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeSwapBuffersReq);
+ WindowPtr pWin;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeSwapInfoPtr swapInfo;
+ xDbeSwapInfo *dbeSwapInfo;
+ int error;
+ register int i, j;
+ int nStuff;
+
+
+ REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
+ nStuff = stuff->n; /* use local variable for performance. */
+
+ if (nStuff == 0)
+ {
+ return(Success);
+ }
+
+ /* Get to the swap info appended to the end of the request. */
+ dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
+
+ /* Allocate array to record swap information. */
+ swapInfo = (DbeSwapInfoPtr)ALLOCATE_LOCAL(nStuff * sizeof(DbeSwapInfoRec));
+ if (swapInfo == NULL)
+ {
+ return(BadAlloc);
+ }
+
+
+ for (i = 0; i < nStuff; i++)
+ {
+ /* Check all windows to swap. */
+
+ /* Each window must be a valid window - BadWindow. */
+ if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client,
+ SecurityWriteAccess)))
+ {
+ DEALLOCATE_LOCAL(swapInfo);
+ return(BadWindow);
+ }
+
+ /* Each window must be double-buffered - BadMatch. */
+ if (DBE_WINDOW_PRIV(pWin) == NULL)
+ {
+ DEALLOCATE_LOCAL(swapInfo);
+ return(BadMatch);
+ }
+
+ /* Each window must only be specified once - BadMatch. */
+ for (j = i + 1; j < nStuff; j++)
+ {
+ if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
+ {
+ DEALLOCATE_LOCAL(swapInfo);
+ return(BadMatch);
+ }
+ }
+
+ /* Each swap action must be valid - BadValue. */
+ if ((dbeSwapInfo[i].swapAction != XdbeUndefined ) &&
+ (dbeSwapInfo[i].swapAction != XdbeBackground) &&
+ (dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
+ (dbeSwapInfo[i].swapAction != XdbeCopied ))
+ {
+ DEALLOCATE_LOCAL(swapInfo);
+ return(BadValue);
+ }
+
+ /* Everything checks out OK. Fill in the swap info array. */
+ swapInfo[i].pWindow = pWin;
+ swapInfo[i].swapAction = dbeSwapInfo[i].swapAction;
+
+ } /* for (i = 0; i < nStuff; i++) */
+
+
+ /* Call the DDX routine to perform the swap(s). The DDX routine should
+ * scan the swap list (swap info), swap any buffers that it knows how to
+ * handle, delete them from the list, and update nStuff to indicate how
+ * many windows it did not handle.
+ *
+ * This scheme allows a range of sophistication in the DDX SwapBuffers()
+ * implementation. Naive implementations could just swap the first buffer
+ * in the list, move the last buffer to the front, decrement nStuff, and
+ * return. The next level of sophistication could be to scan the whole
+ * list for windows on the same screen. Up another level, the DDX routine
+ * could deal with cross-screen synchronization.
+ */
+
+ while (nStuff > 0)
+ {
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow);
+ error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
+ if (error != Success)
+ {
+ DEALLOCATE_LOCAL(swapInfo);
+ return(error);
+ }
+ }
+
+ DEALLOCATE_LOCAL(swapInfo);
+ return(Success);
+
+} /* ProcDbeSwapBuffers() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeBeginIdiom
+ *
+ * Description:
+ *
+ * This function is for processing a DbeBeginIdiom request.
+ * This request informs the server that a complex swap will immediately
+ * follow this request.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeBeginIdiom(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeBeginIdiomReq);
+ DbeScreenPrivPtr pDbeScreenPriv;
+ register int i;
+
+
+ REQUEST_SIZE_MATCH(xDbeBeginIdiomReq);
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]);
+
+ /* Call the DDX begin idiom procedure if there is one. */
+ if (pDbeScreenPriv->BeginIdiom)
+ {
+ (*pDbeScreenPriv->BeginIdiom)(client);
+ }
+ }
+
+ return(Success);
+
+} /* ProcDbeBeginIdiom() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeGetVisualInfo
+ *
+ * Description:
+ *
+ * This function is for processing a ProcDbeGetVisualInfo request.
+ * This request returns information about which visuals support
+ * double buffering.
+ *
+ * Return Values:
+ *
+ * BadDrawable - value in screen specifiers is not a valid drawable
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeGetVisualInfo(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeGetVisualInfoReq);
+ DbeScreenPrivPtr pDbeScreenPriv;
+ xDbeGetVisualInfoReply rep;
+ Drawable *drawables;
+ DrawablePtr *pDrawables = NULL;
+ register int i, j, n;
+ register int count; /* number of visual infos in reply */
+ register int length; /* length of reply */
+ ScreenPtr pScreen;
+ XdbeScreenVisualInfo *pScrVisInfo;
+
+
+ REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
+
+ /* Make sure any specified drawables are valid. */
+ if (stuff->n != 0)
+ {
+ if (!(pDrawables = (DrawablePtr *)ALLOCATE_LOCAL(stuff->n *
+ sizeof(DrawablePtr))))
+ {
+ return(BadAlloc);
+ }
+
+ drawables = (Drawable *)&stuff[1];
+
+ for (i = 0; i < stuff->n; i++)
+ {
+ if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable(
+ drawables[i], client, SecurityReadAccess)))
+ {
+ DEALLOCATE_LOCAL(pDrawables);
+ return(BadDrawable);
+ }
+ }
+ }
+
+ count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
+ if (!(pScrVisInfo = (XdbeScreenVisualInfo *)xalloc(count *
+ sizeof(XdbeScreenVisualInfo))))
+ {
+ if (pDrawables)
+ {
+ DEALLOCATE_LOCAL(pDrawables);
+ }
+
+ return(BadAlloc);
+ }
+
+ length = 0;
+
+ for (i = 0; i < count; i++)
+ {
+ pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
+ pDrawables[i]->pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
+ {
+ /* We failed to alloc pScrVisInfo[i].visinfo. */
+
+ /* Free visinfos that we allocated for previous screen infos.*/
+ for (j = 0; j < i; j++)
+ {
+ xfree(pScrVisInfo[j].visinfo);
+ }
+
+ /* Free pDrawables if we needed to allocate it above. */
+ if (pDrawables)
+ {
+ DEALLOCATE_LOCAL(pDrawables);
+ }
+
+ return(BadAlloc);
+ }
+
+ /* Account for n, number of xDbeVisInfo items in list. */
+ length += sizeof(CARD32);
+
+ /* Account for n xDbeVisInfo items */
+ length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = length;
+ rep.m = count;
+
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.m, n);
+ }
+
+ /* Send off reply. */
+ WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *)&rep);
+
+ for (i = 0; i < count; i++)
+ {
+ CARD32 data32;
+
+ /* For each screen in the reply, send off the visual info */
+
+ /* Send off number of visuals. */
+ data32 = (CARD32)pScrVisInfo[i].count;
+
+ if (client->swapped)
+ {
+ swapl(&data32, n);
+ }
+
+ WriteToClient(client, sizeof(CARD32), (char *)&data32);
+
+ /* Now send off visual info items. */
+ for (j = 0; j < pScrVisInfo[i].count; j++)
+ {
+ xDbeVisInfo visInfo;
+
+ /* Copy the data in the client data structure to a protocol
+ * data structure. We will send data to the client from the
+ * protocol data structure.
+ */
+
+ visInfo.visualID = (CARD32)pScrVisInfo[i].visinfo[j].visual;
+ visInfo.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth;
+ visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel;
+
+ if (client->swapped)
+ {
+ swapl(&visInfo.visualID, n);
+
+ /* We do not need to swap depth and perfLevel since they are
+ * already 1 byte quantities.
+ */
+ }
+
+ /* Write visualID(32), depth(8), perfLevel(8), and pad(16). */
+ WriteToClient(client, 2*sizeof(CARD32), (char *)&visInfo.visualID);
+ }
+ }
+
+ /* Clean up memory. */
+ for (i = 0; i < count; i++)
+ {
+ xfree(pScrVisInfo[i].visinfo);
+ }
+ xfree(pScrVisInfo);
+
+ if (pDrawables)
+ {
+ DEALLOCATE_LOCAL(pDrawables);
+ }
+
+ return(client->noClientException);
+
+} /* ProcDbeGetVisualInfo() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeGetbackBufferAttributes
+ *
+ * Description:
+ *
+ * This function is for processing a ProcDbeGetbackBufferAttributes
+ * request. This request returns information about a back buffer.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeGetBackBufferAttributes(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeGetBackBufferAttributesReq);
+ xDbeGetBackBufferAttributesReply rep;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int n;
+
+
+ REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
+
+ if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
+ stuff->buffer, dbeWindowPrivResType, SecurityReadAccess)))
+ {
+ rep.attributes = None;
+ }
+ else
+ {
+ rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.attributes, n);
+ }
+
+ WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply),
+ (char *)&rep);
+ return(client->noClientException);
+
+} /* ProcDbeGetbackBufferAttributes() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: ProcDbeDispatch
+ *
+ * Description:
+ *
+ * This function dispatches DBE requests.
+ *
+ *****************************************************************************/
+
+static int
+ProcDbeDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+
+ switch (stuff->data)
+ {
+ case X_DbeGetVersion:
+ return(ProcDbeGetVersion(client));
+
+ case X_DbeAllocateBackBufferName:
+ return(ProcDbeAllocateBackBufferName(client));
+
+ case X_DbeDeallocateBackBufferName:
+ return(ProcDbeDeallocateBackBufferName(client));
+
+ case X_DbeSwapBuffers:
+ return(ProcDbeSwapBuffers(client));
+
+ case X_DbeBeginIdiom:
+ return(ProcDbeBeginIdiom(client));
+
+ case X_DbeEndIdiom:
+ return(Success);
+
+ case X_DbeGetVisualInfo:
+ return(ProcDbeGetVisualInfo(client));
+
+ case X_DbeGetBackBufferAttributes:
+ return(ProcDbeGetBackBufferAttributes(client));
+
+ default:
+ return(BadRequest);
+ }
+
+} /* ProcDbeDispatch() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeGetVersion
+ *
+ * Description:
+ *
+ * This function is for processing a DbeGetVersion request on a swapped
+ * server. This request returns the major and minor version numbers of
+ * this extension.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeGetVersion(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeGetVersionReq);
+ register int n;
+
+
+ swaps(&stuff->length, n);
+ return(ProcDbeGetVersion(client));
+
+} /* SProcDbeGetVersion() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeAllocateBackBufferName
+ *
+ * Description:
+ *
+ * This function is for processing a DbeAllocateBackBufferName request on
+ * a swapped server. This request allocates a drawable ID used to refer
+ * to the back buffer of a window.
+ *
+ * Return Values:
+ *
+ * BadAlloc - server can not allocate resources
+ * BadIDChoice - id is out of range for client; id is already in use
+ * BadMatch - window is not an InputOutput window;
+ * visual of window is not on list returned by
+ * DBEGetVisualInfo;
+ * BadValue - invalid swap action is specified
+ * BadWindow - window is not a valid window
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeAllocateBackBufferName(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeAllocateBackBufferNameReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
+
+ swapl(&stuff->window, n);
+ swapl(&stuff->buffer, n);
+ /* stuff->swapAction is a byte. We do not need to swap this field. */
+
+ return(ProcDbeAllocateBackBufferName(client));
+
+} /* SProcDbeAllocateBackBufferName() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeDeallocateBackBufferName
+ *
+ * Description:
+ *
+ * This function is for processing a DbeDeallocateBackBufferName request
+ * on a swapped server. This request frees a drawable ID that was
+ * obtained by a DbeAllocateBackBufferName request.
+ *
+ * Return Values:
+ *
+ * BadBuffer - buffer to deallocate is not associated with a window
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeDeallocateBackBufferName(client)
+ ClientPtr client;
+{
+ REQUEST (xDbeDeallocateBackBufferNameReq);
+ register int n;
+
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
+
+ swapl(&stuff->buffer, n);
+
+ return(ProcDbeDeallocateBackBufferName(client));
+
+} /* SProcDbeDeallocateBackBufferName() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeSwapBuffers
+ *
+ * Description:
+ *
+ * This function is for processing a DbeSwapBuffers request on a swapped
+ * server. This request swaps the buffers for all windows listed,
+ * applying the appropriate swap action for each window.
+ *
+ * Return Values:
+ *
+ * BadMatch - a window in request is not double-buffered; a window in
+ * request is listed more than once; all windows in request do
+ * not have the same root
+ * BadValue - invalid swap action is specified
+ * BadWindow - a window in request is not valid
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeSwapBuffers(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeSwapBuffersReq);
+ register int i, n;
+ xDbeSwapInfo *pSwapInfo;
+
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
+
+ swapl(&stuff->n, n);
+
+ if (stuff->n != 0)
+ {
+ pSwapInfo = (xDbeSwapInfo *)stuff+1;
+
+ /* The swap info following the fix part of this request is a window(32)
+ * followed by a 1 byte swap action and then 3 pad bytes. We only need
+ * to swap the window information.
+ */
+ for (i = 0; i < stuff->n; i++)
+ {
+ swapl(&pSwapInfo->window, n);
+ }
+ }
+
+ return(ProcDbeSwapBuffers(client));
+
+} /* SProcDbeSwapBuffers() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeBeginIdiom
+ *
+ * Description:
+ *
+ * This function is for processing a DbeBeginIdiom request on a swapped
+ * server. This request informs the server that a complex swap will
+ * immediately follow this request.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeBeginIdiom(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeBeginIdiomReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ return(ProcDbeBeginIdiom(client));
+
+} /* SProcDbeBeginIdiom() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeGetVisualInfo
+ *
+ * Description:
+ *
+ * This function is for processing a ProcDbeGetVisualInfo request on a
+ * swapped server. This request returns information about which visuals
+ * support double buffering.
+ *
+ * Return Values:
+ *
+ * BadDrawable - value in screen specifiers is not a valid drawable
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeGetVisualInfo(client)
+ ClientPtr client;
+{
+ REQUEST(xDbeGetVisualInfoReq);
+ register int n;
+
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
+
+ swapl(&stuff->n, n);
+ SwapRestL(stuff);
+
+ return(ProcDbeGetVisualInfo(client));
+
+} /* SProcDbeGetVisualInfo() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeGetbackBufferAttributes
+ *
+ * Description:
+ *
+ * This function is for processing a ProcDbeGetbackBufferAttributes
+ * request on a swapped server. This request returns information about a
+ * back buffer.
+ *
+ * Return Values:
+ *
+ * Success
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeGetBackBufferAttributes(client)
+ ClientPtr client;
+{
+ REQUEST (xDbeGetBackBufferAttributesReq);
+ register int n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
+
+ swapl(&stuff->buffer, n);
+
+ return(ProcDbeGetBackBufferAttributes(client));
+
+} /* SProcDbeGetBackBufferAttributes() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: SProcDbeDispatch
+ *
+ * Description:
+ *
+ * This function dispatches DBE requests on a swapped server.
+ *
+ *****************************************************************************/
+
+static int
+SProcDbeDispatch(client)
+ ClientPtr client;
+{
+ REQUEST(xReq);
+
+
+ switch (stuff->data)
+ {
+ case X_DbeGetVersion:
+ return(SProcDbeGetVersion(client));
+
+ case X_DbeAllocateBackBufferName:
+ return(SProcDbeAllocateBackBufferName(client));
+
+ case X_DbeDeallocateBackBufferName:
+ return(SProcDbeDeallocateBackBufferName(client));
+
+ case X_DbeSwapBuffers:
+ return(SProcDbeSwapBuffers(client));
+
+ case X_DbeBeginIdiom:
+ return(SProcDbeBeginIdiom(client));
+
+ case X_DbeEndIdiom:
+ return(Success);
+
+ case X_DbeGetVisualInfo:
+ return(SProcDbeGetVisualInfo(client));
+
+ case X_DbeGetBackBufferAttributes:
+ return(SProcDbeGetBackBufferAttributes(client));
+
+ default:
+ return (BadRequest);
+ }
+
+} /* SProcDbeDispatch() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeSetupBackgroundPainter
+ *
+ * Description:
+ *
+ * This function sets up pGC to clear pixmaps.
+ *
+ * Return Values:
+ *
+ * TRUE - setup was successful
+ * FALSE - the window's background state is NONE
+ *
+ *****************************************************************************/
+
+static Bool
+DbeSetupBackgroundPainter(pWin, pGC)
+ WindowPtr pWin;
+ GCPtr pGC;
+{
+ pointer gcvalues[4];
+ int ts_x_origin, ts_y_origin;
+ PixUnion background;
+ int backgroundState;
+ Mask gcmask;
+
+
+ /* First take care of any ParentRelative stuff by altering the
+ * tile/stipple origin to match the coordinates of the upper-left
+ * corner of the first ancestor without a ParentRelative background.
+ * This coordinate is, of course, negative.
+ */
+ ts_x_origin = ts_y_origin = 0;
+ while (pWin->backgroundState == ParentRelative)
+ {
+ ts_x_origin -= pWin->origin.x;
+ ts_y_origin -= pWin->origin.y;
+
+ pWin = pWin->parent;
+ }
+ backgroundState = pWin->backgroundState;
+ background = pWin->background;
+
+ switch (backgroundState)
+ {
+ case BackgroundPixel:
+ gcvalues[0] = (pointer)background.pixel;
+ gcvalues[1] = (pointer)FillSolid;
+ gcmask = GCForeground|GCFillStyle;
+ break;
+
+ case BackgroundPixmap:
+ gcvalues[0] = (pointer)FillTiled;
+ gcvalues[1] = (pointer)background.pixmap;
+ gcvalues[2] = (pointer)(long)ts_x_origin;
+ gcvalues[3] = (pointer)(long)ts_y_origin;
+ gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
+ break;
+
+ default:
+ /* pWin->backgroundState == None */
+ return(FALSE);
+ }
+
+ if (DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE) != 0)
+ {
+ return(FALSE);
+ }
+
+ return(TRUE);
+
+} /* DbeSetupBackgroundPainter() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeDrawableDelete
+ *
+ * Description:
+ *
+ * This is the resource delete function for dbeDrawableResType.
+ * It is registered when the drawable resource type is created in
+ * DbeExtensionInit().
+ *
+ * To make resource deletion simple, we do not do anything in this function
+ * and leave all resource deleteion to DbeWindowPrivDelete(), which will
+ * eventually be called or already has been called. Deletion functions are
+ * not guaranteed to be called in any particular order.
+ *
+ *****************************************************************************/
+static int
+DbeDrawableDelete(pDrawable, id)
+ pointer pDrawable;
+ XID id;
+{
+ return(Success);
+
+} /* DbeDrawableDelete() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeWindowPrivDelete
+ *
+ * Description:
+ *
+ * This is the resource delete function for dbeWindowPrivResType.
+ * It is registered when the drawable resource type is created in
+ * DbeExtensionInit().
+ *
+ *****************************************************************************/
+static int
+DbeWindowPrivDelete(pDbeWinPriv, id)
+ pointer pDbeWinPriv;
+ XID id;
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr)pDbeWinPriv;
+ int i;
+
+
+ /*
+ **************************************************************************
+ ** Remove the buffer ID from the ID array.
+ **************************************************************************
+ */
+
+ /* Find the ID in the ID array. */
+ i = 0;
+ while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id))
+ {
+ i++;
+ }
+
+ if (i == pDbeWindowPriv->nBufferIDs)
+ {
+ /* We did not find the ID in the array. We should never get here. */
+ return(BadValue);
+ }
+
+ /* Remove the ID from the array. */
+
+ if (i < (pDbeWindowPriv->nBufferIDs - 1))
+ {
+ /* Compress the buffer ID array, overwriting the ID in the process. */
+ memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i+1],
+ (pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
+ }
+ else
+ {
+ /* We are removing the last ID in the array, in which case, the
+ * assignement below is all that we need to do.
+ */
+ }
+ pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs - 1] = DBE_FREE_ID_ELEMENT;
+
+ pDbeWindowPriv->nBufferIDs--;
+
+ /* If an extended array was allocated, then check to see if the remaining
+ * buffer IDs will fit in the static array.
+ */
+
+ if ((pDbeWindowPriv->maxAvailableIDs > DBE_INIT_MAX_IDS) &&
+ (pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS))
+ {
+ /* Copy the IDs back into the static array. */
+ memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs,
+ DBE_INIT_MAX_IDS * sizeof(XID));
+
+ /* Free the extended array; use the static array. */
+ xfree(pDbeWindowPriv->IDs);
+ pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs;
+ pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
+ }
+
+
+ /*
+ **************************************************************************
+ ** Perform DDX level tasks.
+ **************************************************************************
+ */
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(
+ (DbeWindowPrivPtr)pDbeWindowPriv);
+ (*pDbeScreenPriv->WinPrivDelete)((DbeWindowPrivPtr)pDbeWindowPriv, id);
+
+
+ /*
+ **************************************************************************
+ ** Perform miscellaneous tasks if this is the last buffer associated
+ ** with the window.
+ **************************************************************************
+ */
+
+ if (pDbeWindowPriv->nBufferIDs == 0)
+ {
+ /* Reset the DBE window priv pointer. */
+ pDbeWindowPriv->pWindow->devPrivates[dbeWindowPrivIndex].ptr =
+ (pointer)NULL;
+
+ /* We are done with the window priv. */
+ xfree(pDbeWindowPriv);
+ }
+
+ return(Success);
+
+} /* DbeWindowPrivDelete() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeResetProc
+ *
+ * Description:
+ *
+ * This routine is called at the end of every server generation.
+ * It deallocates any memory reserved for the extension and performs any
+ * other tasks related to shutting down the extension.
+ *
+ *****************************************************************************/
+static void
+DbeResetProc(extEntry)
+ ExtensionEntry *extEntry;
+{
+ int i;
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+
+
+ if (dbeScreenPrivIndex < 0)
+ {
+ return;
+ }
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (pDbeScreenPriv)
+ {
+ /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit().*/
+ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
+
+ if (pDbeScreenPriv->ResetProc)
+ (*pDbeScreenPriv->ResetProc)(pScreen);
+
+ if (pDbeScreenPriv->winPrivPrivSizes)
+ {
+ xfree(pDbeScreenPriv->winPrivPrivSizes);
+ }
+
+ xfree(pDbeScreenPriv);
+ }
+ }
+
+ /* We want to init the initialization function table after every server
+ * reset in DbeRegisterFunction().
+ */
+ firstRegistrationPass = TRUE;
+
+} /* DbeResetProc() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeDestroyWindow
+ *
+ * Description:
+ *
+ * This is the wrapper for pScreen->DestroyWindow.
+ * This function frees buffer resources for a window before it is
+ * destroyed.
+ *
+ *****************************************************************************/
+
+static Bool
+DbeDestroyWindow(pWin)
+ WindowPtr pWin;
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ ScreenPtr pScreen;
+ Bool ret;
+
+
+ /*
+ **************************************************************************
+ ** 1. Unwrap the member routine.
+ **************************************************************************
+ */
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
+
+ /*
+ **************************************************************************
+ ** 2. Do any work necessary before the member routine is called.
+ **
+ ** Call the window priv delete function for all buffer IDs associated
+ ** with this window.
+ **************************************************************************
+ */
+
+ if (pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))
+ {
+ while (pDbeWindowPriv)
+ {
+ /* *DbeWinPrivDelete() will free the window private and set it to
+ * NULL if there are no more buffer IDs associated with this
+ * window.
+ */
+ FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
+ pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
+ }
+ }
+
+ /*
+ **************************************************************************
+ ** 3. Call the member routine, saving its result if necessary.
+ **************************************************************************
+ */
+
+ ret = (*pScreen->DestroyWindow)(pWin);
+
+ /*
+ **************************************************************************
+ ** 4. Rewrap the member routine, restoring the wrapper value first in case
+ ** the wrapper (or something that it wrapped) change this value.
+ **************************************************************************
+ */
+
+ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DbeDestroyWindow;
+
+ /*
+ **************************************************************************
+ ** 5. Do any work necessary after the member routine has been called.
+ **
+ ** In this case we do not need to do anything.
+ **************************************************************************
+ */
+
+ return(ret);
+
+} /* DbeDestroyWindow() */
+
+
+/******************************************************************************
+ *
+ * DBE DIX Procedure: DbeExtensionInit
+ *
+ * Description:
+ *
+ * Called from InitExtensions in main()
+ *
+ *****************************************************************************/
+
+void
+DbeExtensionInit()
+{
+ ExtensionEntry *extEntry;
+ register int i, j;
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ int nStubbedScreens = 0;
+ Bool ddxInitSuccess;
+
+
+ /* Allocate private pointers in windows and screens. */
+
+ if ((dbeScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
+ {
+ return;
+ }
+
+ if ((dbeWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
+ {
+ return;
+ }
+
+ /* Initialize the priv priv counts between server generations. */
+ winPrivPrivCount = 0;
+
+ /* Create the resource types. */
+ dbeDrawableResType =
+ CreateNewResourceType(DbeDrawableDelete) | RC_CACHED | RC_DRAWABLE;
+ dbeWindowPrivResType =
+ CreateNewResourceType(DbeWindowPrivDelete);
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ /* For each screen, set up DBE screen privates and init DIX and DDX
+ * interface.
+ */
+
+ pScreen = screenInfo.screens[i];
+
+ if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) ||
+ !(pDbeScreenPriv =
+ (DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
+ {
+ /* If we can not alloc a window or screen private,
+ * then free any privates that we already alloc'ed and return
+ */
+
+ for (j = 0; j < i; j++)
+ {
+ xfree(screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr);
+ screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr = NULL;
+ }
+ return;
+ }
+
+ pScreen->devPrivates[dbeScreenPrivIndex].ptr = (pointer)pDbeScreenPriv;
+
+ /* Store the DBE priv priv size info for later use when allocating
+ * priv privs at the driver level.
+ */
+ pDbeScreenPriv->winPrivPrivLen = 0;
+ pDbeScreenPriv->winPrivPrivSizes = (unsigned *)NULL;
+ pDbeScreenPriv->totalWinPrivSize = sizeof(DbeWindowPrivRec);
+
+ /* Copy the resource types */
+ pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType;
+ pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType;
+
+ /* Copy the private indices */
+ pDbeScreenPriv->dbeScreenPrivIndex = dbeScreenPrivIndex;
+ pDbeScreenPriv->dbeWindowPrivIndex = dbeWindowPrivIndex;
+
+ if(DbeInitFunct[i])
+ {
+ /* This screen supports DBE. */
+
+ /* Setup DIX. */
+ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
+ pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
+ pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
+ pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
+
+ /* Setup DDX. */
+ ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv);
+
+ /* DDX DBE initialization may have the side affect of
+ * reallocating pDbeScreenPriv, so we need to update it.
+ */
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (ddxInitSuccess)
+ {
+ /* Wrap DestroyWindow. The DDX initialization function
+ * already wrapped PositionWindow for us.
+ */
+
+ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DbeDestroyWindow;
+ }
+ else
+ {
+ /* DDX initialization failed. Stub the screen. */
+ DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
+ }
+ }
+ else
+ {
+ /* This screen does not support DBE. */
+
+#ifndef DISABLE_MI_DBE_BY_DEFAULT
+ /* Setup DIX. */
+ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
+ pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
+ pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
+ pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
+
+ /* Setup DDX. */
+ ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv);
+
+ /* DDX DBE initialization may have the side affect of
+ * reallocating pDbeScreenPriv, so we need to update it.
+ */
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (ddxInitSuccess)
+ {
+ /* Wrap DestroyWindow. The DDX initialization function
+ * already wrapped PositionWindow for us.
+ */
+
+ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DbeDestroyWindow;
+ }
+ else
+ {
+ /* DDX initialization failed. Stub the screen. */
+ DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
+ }
+#else
+ DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
+#endif
+
+ } /* else -- this screen does not support DBE. */
+
+ } /* for (i = 0; i < screenInfo.numScreens; i++) */
+
+
+ if (nStubbedScreens == screenInfo.numScreens)
+ {
+ /* All screens stubbed. Clean up and return. */
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ xfree(screenInfo.screens[i]->devPrivates[dbeScreenPrivIndex].ptr);
+ pScreen->devPrivates[dbeScreenPrivIndex].ptr = NULL;
+ }
+ return;
+ }
+
+
+ /* Now add the extension. */
+ extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
+ DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
+ DbeResetProc, StandardMinorOpcode);
+
+ dbeErrorBase = extEntry->errorBase;
+
+} /* DbeExtensionInit() */
+
diff --git a/xc/programs/Xserver/dbe/dbemodule.c b/xc/programs/Xserver/dbe/dbemodule.c
new file mode 100644
index 000000000..52d955392
--- /dev/null
+++ b/xc/programs/Xserver/dbe/dbemodule.c
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/dbe/dbemodule.c,v 1.6 1999/01/26 05:53:50 dawes Exp $ */
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(dbeSetup);
+
+extern void DbeExtensionInit(INITARGS);
+
+ExtensionModule dbeExt = {
+ DbeExtensionInit,
+ "DOUBLE-BUFFER",
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "dbe",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+/*
+ * Data for the loader
+ */
+XF86ModuleData dbeModuleData = { &VersRec, dbeSetup, NULL };
+
+static pointer
+dbeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LoadExtension(&dbeExt);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
diff --git a/xc/programs/Xserver/dbe/dbestruct.h b/xc/programs/Xserver/dbe/dbestruct.h
new file mode 100644
index 000000000..7921758f6
--- /dev/null
+++ b/xc/programs/Xserver/dbe/dbestruct.h
@@ -0,0 +1,261 @@
+/* $XConsortium: dbestruct.h /main/3 1995/09/22 10:21:05 dpw $ */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for DIX-related DBE
+ *
+ *****************************************************************************/
+
+
+#ifndef DBE_STRUCT_H
+#define DBE_STRUCT_H
+
+
+/* INCLUDES */
+
+#define NEED_DBE_PROTOCOL
+#include "Xdbeproto.h"
+#include "windowstr.h"
+
+
+/* DEFINES */
+
+#define DBE_SCREEN_PRIV(pScreen) \
+ ((dbeScreenPrivIndex < 0) ? \
+ NULL : \
+ ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr)))
+
+#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
+ DBE_SCREEN_PRIV((pDrawable)->pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
+ DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
+ DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
+ DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
+
+#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
+ DBE_SCREEN_PRIV((pGC)->pScreen)
+
+#define DBE_WINDOW_PRIV(pWindow)\
+ ((dbeWindowPrivIndex < 0) ? \
+ NULL : \
+ ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr)))
+
+/* Initial size of the buffer ID array in the window priv. */
+#define DBE_INIT_MAX_IDS 2
+
+/* Reallocation increment for the buffer ID array. */
+#define DBE_INCR_MAX_IDS 4
+
+/* Marker for free elements in the buffer ID array. */
+#define DBE_FREE_ID_ELEMENT 0
+
+
+/* TYPEDEFS */
+
+/* Record used to pass swap information between DIX and DDX swapping
+ * procedures.
+ */
+typedef struct _DbeSwapInfoRec
+{
+ WindowPtr pWindow;
+ unsigned char swapAction;
+
+} DbeSwapInfoRec, *DbeSwapInfoPtr;
+
+/*
+ ******************************************************************************
+ ** Per-window data
+ ******************************************************************************
+ */
+
+typedef struct _DbeWindowPrivRec
+{
+ /* A pointer to the window with which the DBE window private (buffer) is
+ * associated.
+ */
+ WindowPtr pWindow;
+
+ /* Last known swap action for this buffer. Legal values for this field
+ * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
+ */
+ unsigned char swapAction;
+
+ /* Last known buffer size.
+ */
+ unsigned short width, height;
+
+ /* Coordinates used for static gravity when the window is positioned.
+ */
+ short x, y;
+
+ /* Number of XIDs associated with this buffer.
+ */
+ int nBufferIDs;
+
+ /* Capacity of the current buffer ID array, IDs. */
+ int maxAvailableIDs;
+
+ /* Pointer to the array of buffer IDs. This initially points to initIDs.
+ * When the static limit of the initIDs array is reached, the array is
+ * reallocated and this pointer is set to the new array instead of initIDs.
+ */
+ XID *IDs;
+
+ /* Initial array of buffer IDs. We are defining the XID array within the
+ * window priv to optimize for data locality. In most cases, only one
+ * buffer will be associated with a window. Having the array declared
+ * here can prevent us from accessing the data in another memory page,
+ * possibly resulting in a page swap and loss of performance. Initially we
+ * will use this array to store buffer IDs. For situations where we have
+ * more IDs than can fit in this static array, we will allocate a larger
+ * array to use, possibly suffering a performance loss.
+ */
+ XID initIDs[DBE_INIT_MAX_IDS];
+
+ /* Device-specific private information.
+ */
+ DevUnion *devPrivates;
+
+} DbeWindowPrivRec, *DbeWindowPrivPtr;
+
+
+/*
+ ******************************************************************************
+ ** Per-screen data
+ ******************************************************************************
+ */
+
+typedef struct _DbeScreenPrivRec
+{
+ /* Info for creating window privs */
+ int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */
+ unsigned int *winPrivPrivSizes; /* Array of private record sizes */
+ unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */
+
+ /* Resources created by DIX to be used by DDX */
+ RESTYPE dbeDrawableResType;
+ RESTYPE dbeWindowPrivResType;
+
+ /* Private indices created by DIX to be used by DDX */
+ int dbeScreenPrivIndex;
+ int dbeWindowPrivIndex;
+
+ /* Wrapped functions
+ * It is the responsibilty of the DDX layer to wrap PositionWindow().
+ * DbeExtensionInit wraps DestroyWindow().
+ */
+ PositionWindowProcPtr PositionWindow;
+ DestroyWindowProcPtr DestroyWindow;
+
+ /* Per-screen DIX routines */
+ Bool (*SetupBackgroundPainter)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWin*/,
+ GCPtr /*pGC*/
+#endif
+);
+ DbeWindowPrivPtr (*AllocWinPriv)(
+#if NeedNestedPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+ int (*AllocWinPrivPrivIndex)(
+#if NeedNestedPrototypes
+ void
+#endif
+);
+ Bool (*AllocWinPrivPriv)(
+#if NeedNestedPrototypes
+ ScreenPtr /*pScreen*/,
+ int /*index*/,
+ unsigned /*amount*/
+#endif
+);
+
+ /* Per-screen DDX routines */
+ Bool (*GetVisualInfo)(
+#if NeedNestedPrototypes
+ ScreenPtr /*pScreen*/,
+ XdbeScreenVisualInfo * /*pVisInfo*/
+#endif
+);
+ int (*AllocBackBufferName)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWin*/,
+ XID /*bufId*/,
+ int /*swapAction*/
+#endif
+);
+ int (*SwapBuffers)(
+#if NeedNestedPrototypes
+ ClientPtr /*client*/,
+ int * /*pNumWindows*/,
+ DbeSwapInfoPtr /*swapInfo*/
+#endif
+);
+ void (*BeginIdiom)(
+#if NeedNestedPrototypes
+ ClientPtr /*client*/
+#endif
+);
+ void (*EndIdiom)(
+#if NeedNestedPrototypes
+ ClientPtr /*client*/
+#endif
+);
+ void (*WinPrivDelete)(
+#if NeedNestedPrototypes
+ DbeWindowPrivPtr /*pDbeWindowPriv*/,
+ XID /*bufId*/
+#endif
+);
+ void (*ResetProc)(
+#if NeedNestedPrototypes
+ ScreenPtr /*pScreen*/
+#endif
+);
+ void (*ValidateBuffer)(
+#if NeedNestedPrototypes
+ WindowPtr /*pWin*/,
+ XID /*bufId*/,
+ Bool /*dstbuffer*/
+#endif
+);
+
+ /* Device-specific private information.
+ */
+ DevUnion *devPrivates;
+
+} DbeScreenPrivRec, *DbeScreenPrivPtr;
+
+#endif /* DBE_STRUCT_H */
diff --git a/xc/programs/Xserver/dbe/midbe.c b/xc/programs/Xserver/dbe/midbe.c
new file mode 100644
index 000000000..20b14baa3
--- /dev/null
+++ b/xc/programs/Xserver/dbe/midbe.c
@@ -0,0 +1,848 @@
+/* $XConsortium: midbe.c /main/4 1995/09/25 15:19:01 dpw $ */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Machine-independent DBE code
+ *
+ *****************************************************************************/
+
+
+/* INCLUDES */
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "opaque.h"
+#include "dbestruct.h"
+#include "midbestr.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "inputstr.h"
+
+
+/* DEFINES */
+
+
+/* TYPEDEFS */
+
+
+/* GLOBALS */
+
+static int miDbePrivPrivGeneration = 0;
+static int miDbeWindowPrivPrivIndex = -1;
+static int miDbeScreenPrivPrivIndex = -1;
+RESTYPE dbeDrawableResType;
+RESTYPE dbeWindowPrivResType;
+int dbeScreenPrivIndex = -1;
+int dbeWindowPrivIndex = -1;
+
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeGetVisualInfo
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeGetVisualInfo request. This function
+ * is called through pDbeScreenPriv->GetVisualInfo. This function is also
+ * called for the DbeAllocateBackBufferName request at the extension level;
+ * it is called by ProcDbeAllocateBackBufferName() in dbe.c.
+ *
+ * If memory allocation fails or we can not get the visual info, this
+ * function returns FALSE. Otherwise, it returns TRUE for success.
+ *
+ *****************************************************************************/
+
+static Bool
+miDbeGetVisualInfo(pScreen, pScrVisInfo)
+ ScreenPtr pScreen;
+ XdbeScreenVisualInfo *pScrVisInfo;
+{
+ register int i, j, k;
+ register int count;
+ DepthPtr pDepth;
+ XdbeVisualInfo *visInfo;
+
+
+ /* Determine number of visuals for this screen. */
+ for (i = 0, count = 0; i < pScreen->numDepths; i++)
+ {
+ count += pScreen->allowedDepths[i].numVids;
+ }
+
+ /* Allocate an array of XdbeVisualInfo items. */
+ if (!(visInfo = (XdbeVisualInfo *)xalloc(count * sizeof(XdbeVisualInfo))))
+ {
+ return(FALSE); /* memory alloc failure */
+ }
+
+ for (i = 0, k = 0; i < pScreen->numDepths; i++)
+ {
+ /* For each depth of this screen, get visual information. */
+
+ pDepth = &pScreen->allowedDepths[i];
+
+ for (j = 0; j < pDepth->numVids; j++)
+ {
+ /* For each visual for this depth of this screen, get visual ID
+ * and visual depth. Since this is MI code, we will always return
+ * the same performance level for all visuals (0). A higher
+ * performance level value indicates higher performance.
+ */
+ visInfo[k].visual = pDepth->vids[j];
+ visInfo[k].depth = pDepth->depth;
+ visInfo[k].perflevel = 0;
+ k++;
+ }
+ }
+
+ /* Record the number of visuals and point visual_depth to
+ * the array of visual info.
+ */
+ pScrVisInfo->count = count;
+ pScrVisInfo->visinfo = visInfo;
+
+ return(TRUE); /* success */
+
+} /* miDbeGetVisualInfo() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miAllocBackBufferName
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeAllocateBackBufferName request.
+ *
+ *****************************************************************************/
+
+static int
+miDbeAllocBackBufferName(pWin, bufId, swapAction)
+ WindowPtr pWin;
+ XID bufId;
+ int swapAction;
+{
+ ScreenPtr pScreen;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ xRectangle clearRect;
+
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
+
+ if (pDbeWindowPriv->nBufferIDs == 0)
+ {
+ /* There is no buffer associated with the window.
+ * We have to create the window priv priv. Remember, the window
+ * priv was created at the DIX level, so all we need to do is
+ * create the priv priv and attach it to the priv.
+ */
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ /* Setup the window priv priv. */
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv;
+
+ /* Get a front pixmap. */
+ if (!(pDbeWindowPrivPriv->pFrontBuffer =
+ (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth)))
+ {
+ return(BadAlloc);
+ }
+
+ /* Get a back pixmap. */
+ if (!(pDbeWindowPrivPriv->pBackBuffer =
+ (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
+ pDbeWindowPriv->height,
+ pWin->drawable.depth)))
+ {
+ (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
+ return(BadAlloc);
+ }
+
+
+ /* Make the back pixmap a DBE drawable resource. */
+ if (!AddResource(bufId, dbeDrawableResType,
+ (pointer)pDbeWindowPrivPriv->pBackBuffer))
+ {
+ /* free the buffer and the drawable resource */
+ FreeResource(bufId, RT_NONE);
+ return(BadAlloc);
+ }
+
+
+ /* Attach the priv priv to the priv. */
+ pDbeWindowPriv->devPrivates[miDbeWindowPrivPrivIndex].ptr =
+ (pointer)pDbeWindowPrivPriv;
+
+
+ /* Clear the back buffer. */
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+ if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
+ {
+ ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
+ clearRect.x = clearRect.y = 0;
+ clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
+ (*pGC->ops->PolyFillRect)(
+ (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1,
+ &clearRect);
+ }
+ FreeScratchGC(pGC);
+
+ } /* if no buffer associated with the window */
+
+ else
+ {
+ /* A buffer is already associated with the window.
+ * Place the new buffer ID information at the head of the ID list.
+ */
+
+ /* Associate the new ID with an existing pixmap. */
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ if (!AddResource(bufId, dbeDrawableResType,
+ (pointer)pDbeWindowPrivPriv->pBackBuffer))
+ {
+ return(BadAlloc);
+ }
+
+ }
+
+ return(Success);
+
+} /* miDbeAllocBackBufferName() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeAliasBuffers
+ *
+ * Description:
+ *
+ * This function associates all XIDs of a buffer with the back pixmap
+ * stored in the window priv.
+ *
+ *****************************************************************************/
+
+static void
+miDbeAliasBuffers(pDbeWindowPriv)
+ DbeWindowPrivPtr pDbeWindowPriv;
+{
+ int i;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
+ MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+
+ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
+ {
+ ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
+ (pointer)pDbeWindowPrivPriv->pBackBuffer);
+ }
+
+} /* miDbeAliasBuffers() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeSwapBuffers
+ *
+ * Description:
+ *
+ * This is the MI function for the DbeSwapBuffers request.
+ *
+ *****************************************************************************/
+
+static int
+miDbeSwapBuffers(client, pNumWindows, swapInfo)
+ ClientPtr client;
+ int *pNumWindows;
+ DbeSwapInfoPtr swapInfo;
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+ GCPtr pGC;
+ WindowPtr pWin;
+ register int i;
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+ PixmapPtr pTmpBuffer;
+ xRectangle clearRect;
+
+
+ pWin = swapInfo[0].pWindow;
+ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
+ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
+
+ /*
+ **********************************************************************
+ ** Setup before swap.
+ **********************************************************************
+ */
+
+ switch(swapInfo[0].swapAction)
+ {
+ case XdbeUndefined:
+ break;
+
+ case XdbeBackground:
+ break;
+
+ case XdbeUntouched:
+ ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC);
+ (*pGC->ops->CopyArea)((DrawablePtr)pWin,
+ (DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
+ pGC, 0, 0, pWin->drawable.width,
+ pWin->drawable.height, 0, 0);
+ break;
+
+ case XdbeCopied:
+ break;
+
+ }
+
+ /*
+ **********************************************************************
+ ** Swap.
+ **********************************************************************
+ */
+
+ ValidateGC((DrawablePtr)pWin, pGC);
+ (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
+ (DrawablePtr)pWin, pGC, 0, 0,
+ pWin->drawable.width, pWin->drawable.height,
+ 0, 0);
+
+ /*
+ **********************************************************************
+ ** Tasks after swap.
+ **********************************************************************
+ */
+
+ switch(swapInfo[0].swapAction)
+ {
+ case XdbeUndefined:
+ break;
+
+ case XdbeBackground:
+ if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
+ {
+ ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC);
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width =
+ pDbeWindowPrivPriv->pBackBuffer->drawable.width;
+ clearRect.height =
+ pDbeWindowPrivPriv->pBackBuffer->drawable.height;
+ (*pGC->ops->PolyFillRect)(
+ (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
+ pGC, 1, &clearRect);
+ }
+ break;
+
+ case XdbeUntouched:
+ /* Swap pixmap pointers. */
+ pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
+ pDbeWindowPrivPriv->pBackBuffer =
+ pDbeWindowPrivPriv->pFrontBuffer;
+ pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
+
+ miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
+
+ break;
+
+ case XdbeCopied:
+ break;
+
+ }
+
+ /* Remove the swapped window from the swap information array and decrement
+ * pNumWindows to indicate to the DIX level how many windows were actually
+ * swapped.
+ */
+
+ if (*pNumWindows > 1)
+ {
+ /* We were told to swap more than one window, but we only swapped the
+ * first one. Remove the first window in the list by moving the last
+ * window to the beginning.
+ */
+ swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow;
+ swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction;
+
+ /* Clear the last window information just to be safe. */
+ swapInfo[*pNumWindows - 1].pWindow = (WindowPtr)NULL;
+ swapInfo[*pNumWindows - 1].swapAction = 0;
+ }
+ else
+ {
+ /* Clear the window information just to be safe. */
+ swapInfo[0].pWindow = (WindowPtr)NULL;
+ swapInfo[0].swapAction = 0;
+ }
+
+ (*pNumWindows)--;
+
+ FreeScratchGC(pGC);
+
+ return(Success);
+
+} /* miSwapBuffers() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeWinPrivDelete
+ *
+ * Description:
+ *
+ * This is the MI function for deleting the dbeWindowPrivResType resource.
+ * This function is invoked indirectly by calling FreeResource() to free
+ * the resources associated with a DBE buffer ID. There are 5 ways that
+ * miDbeWinPrivDelete() can be called by FreeResource(). They are:
+ *
+ * - A DBE window is destroyed, in which case the DbeDestroyWindow()
+ * wrapper is invoked. The wrapper calls FreeResource() for all DBE
+ * buffer IDs.
+ *
+ * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
+ * after a buffer allocation failure.
+ *
+ * - The PositionWindow wrapper, miDbePositionWindow(), calls
+ * FreeResource() when it fails to create buffers of the new size.
+ * FreeResource() is called for all DBE buffer IDs.
+ *
+ * - FreeClientResources() calls FreeResource() when a client dies or the
+ * the server resets.
+ *
+ * When FreeResource() is called for a DBE buffer ID, the delete function
+ * for the only other type of DBE resource, dbeDrawableResType, is also
+ * invoked. This delete function (DbeDrawableDelete) is a NOOP to make
+ * resource deletion easier. It is not guaranteed which delete function is
+ * called first. Hence, we will let miDbeWinPrivDelete() free all DBE
+ * resources.
+ *
+ * This function deletes/frees the following stuff associated with
+ * the window private:
+ *
+ * - the ID node in the ID list representing the passed in ID.
+ *
+ * In addition, pDbeWindowPriv->nBufferIDs is decremented.
+ *
+ * If this function is called for the last/only buffer ID for a window,
+ * these are additionally deleted/freed:
+ *
+ * - the front and back pixmaps
+ * - the window priv itself
+ *
+ *****************************************************************************/
+
+static void
+miDbeWinPrivDelete(pDbeWindowPriv, bufId)
+ DbeWindowPrivPtr pDbeWindowPriv;
+ XID bufId;
+{
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+
+
+ if (pDbeWindowPriv->nBufferIDs != 0)
+ {
+ /* We still have at least one more buffer ID associated with this
+ * window.
+ */
+ return;
+ }
+
+
+ /* We have no more buffer IDs associated with this window. We need to
+ * free some stuff.
+ */
+
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+
+ /* Destroy the front and back pixmaps. */
+ if (pDbeWindowPrivPriv->pFrontBuffer)
+ {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
+ pDbeWindowPrivPriv->pFrontBuffer);
+ }
+ if (pDbeWindowPrivPriv->pBackBuffer)
+ {
+ (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
+ pDbeWindowPrivPriv->pBackBuffer);
+ }
+
+} /* miDbeWinPrivDelete() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbePositionWindow
+ *
+ * Description:
+ *
+ * This function was cloned from miMbxPositionWindow() in mimultibuf.c.
+ * This function resizes the buffer when the window is resized.
+ *
+ *****************************************************************************/
+
+static Bool
+miDbePositionWindow(pWin, x, y)
+ WindowPtr pWin;
+ int x;
+ int y;
+{
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+ DbeWindowPrivPtr pDbeWindowPriv;
+ int width, height;
+ int dx, dy, dw, dh;
+ int sourcex, sourcey;
+ int destx, desty;
+ int savewidth, saveheight;
+ PixmapPtr pFrontBuffer;
+ PixmapPtr pBackBuffer;
+ Bool clear;
+ GCPtr pGC;
+ xRectangle clearRect;
+ Bool ret;
+
+
+ /*
+ **************************************************************************
+ ** 1. Unwrap the member routine.
+ **************************************************************************
+ */
+
+ pScreen = pWin->drawable.pScreen;
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
+
+ /*
+ **************************************************************************
+ ** 2. Do any work necessary before the member routine is called.
+ **
+ ** In this case we do not need to do anything.
+ **************************************************************************
+ */
+
+ /*
+ **************************************************************************
+ ** 3. Call the member routine, saving its result if necessary.
+ **************************************************************************
+ */
+
+ ret = (*pScreen->PositionWindow)(pWin, x, y);
+
+ /*
+ **************************************************************************
+ ** 4. Rewrap the member routine, restoring the wrapper value first in case
+ ** the wrapper (or something that it wrapped) change this value.
+ **************************************************************************
+ */
+
+ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = miDbePositionWindow;
+
+ /*
+ **************************************************************************
+ ** 5. Do any work necessary after the member routine has been called.
+ **************************************************************************
+ */
+
+ if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
+ {
+ return(ret);
+ }
+
+ if (pDbeWindowPriv->width == pWin->drawable.width &&
+ pDbeWindowPriv->height == pWin->drawable.height)
+ {
+ return(ret);
+ }
+
+ width = pWin->drawable.width;
+ height = pWin->drawable.height;
+
+ dx = pWin->drawable.x - pDbeWindowPriv->x;
+ dy = pWin->drawable.y - pDbeWindowPriv->y;
+ dw = width - pDbeWindowPriv->width;
+ dh = height - pDbeWindowPriv->height;
+
+ GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty);
+
+ clear = ((pDbeWindowPriv->width < (unsigned short)width ) ||
+ (pDbeWindowPriv->height < (unsigned short)height) ||
+ (pWin->bitGravity == ForgetGravity));
+
+ sourcex = 0;
+ sourcey = 0;
+ savewidth = pDbeWindowPriv->width;
+ saveheight = pDbeWindowPriv->height;
+
+ /* Clip rectangle to source and destination. */
+ if (destx < 0)
+ {
+ savewidth += destx;
+ sourcex -= destx;
+ destx = 0;
+ }
+
+ if (destx + savewidth > width)
+ {
+ savewidth = width - destx;
+ }
+
+ if (desty < 0)
+ {
+ saveheight += desty;
+ sourcey -= desty;
+ desty = 0;
+ }
+
+ if (desty + saveheight > height)
+ {
+ saveheight = height - desty;
+ }
+
+ pDbeWindowPriv->width = width;
+ pDbeWindowPriv->height = height;
+ pDbeWindowPriv->x = pWin->drawable.x;
+ pDbeWindowPriv->y = pWin->drawable.y;
+
+ pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+
+ if (clear)
+ {
+ if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
+ {
+ clearRect.x = 0;
+ clearRect.y = 0;
+ clearRect.width = width;
+ clearRect.height = height;
+ }
+ else
+ {
+ clear = FALSE;
+ }
+ }
+
+ /* Create DBE buffer pixmaps equal to size of resized window. */
+ pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
+ pWin->drawable.depth);
+
+ pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
+ pWin->drawable.depth);
+
+ if (!pFrontBuffer || !pBackBuffer)
+ {
+ /* We failed at creating 1 or 2 of the pixmaps. */
+
+ if (pFrontBuffer)
+ {
+ (*pScreen->DestroyPixmap)(pFrontBuffer);
+ }
+
+ if (pBackBuffer)
+ {
+ (*pScreen->DestroyPixmap)(pBackBuffer);
+ }
+
+ /* Destroy all buffers for this window. */
+ while (pDbeWindowPriv)
+ {
+ /* DbeWindowPrivDelete() will free the window private if there no
+ * more buffer IDs associated with this window.
+ */
+ FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
+ pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
+ }
+
+ FreeScratchGC(pGC);
+ return(FALSE);
+ }
+
+ else
+ {
+ /* Clear out the new DBE buffer pixmaps. */
+
+ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
+
+
+ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
+ ValidateGC((DrawablePtr)pFrontBuffer, pGC);
+
+ /* I suppose this could avoid quite a bit of work if
+ * it computed the minimal area required.
+ */
+ if (clear)
+ {
+ (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1,
+ &clearRect);
+ (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1,
+ &clearRect);
+ }
+
+ /* Copy the contents of the old DBE pixmaps to the new pixmaps. */
+ if (pWin->bitGravity != ForgetGravity)
+ {
+ (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
+ (DrawablePtr)pFrontBuffer, pGC, sourcex,
+ sourcey, savewidth, saveheight, destx, desty);
+ (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
+ (DrawablePtr)pBackBuffer, pGC, sourcex,
+ sourcey, savewidth, saveheight, destx, desty);
+ }
+
+ /* Destroy the old pixmaps, and point the DBE window priv to the new
+ * pixmaps.
+ */
+
+ (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
+ (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer);
+
+ pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
+ pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
+
+ /* Make sure all XID are associated with the new back pixmap. */
+ miDbeAliasBuffers(pDbeWindowPriv);
+
+ FreeScratchGC(pGC);
+ }
+
+ return(ret);
+
+} /* miDbePositionWindow() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeResetProc
+ *
+ * Description:
+ *
+ * This function is called from DbeResetProc(), which is called at the end
+ * of every server generation. This function peforms any MI-specific
+ * shutdown tasks.
+ *
+ *****************************************************************************/
+
+static void
+miDbeResetProc(pScreen)
+ ScreenPtr pScreen;
+{
+ DbeScreenPrivPtr pDbeScreenPriv;
+
+
+ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ /* Unwrap wrappers */
+ pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
+
+} /* miDbeResetProc() */
+
+
+/******************************************************************************
+ *
+ * DBE MI Procedure: miDbeInit
+ *
+ * Description:
+ *
+ * This is the MI initialization function called by DbeExtensionInit().
+ *
+ *****************************************************************************/
+
+Bool
+miDbeInit(pScreen, pDbeScreenPriv)
+ ScreenPtr pScreen;
+ DbeScreenPrivPtr pDbeScreenPriv;
+{
+ /* Copy resource types created by DIX */
+ dbeDrawableResType = pDbeScreenPriv->dbeDrawableResType;
+ dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType;
+
+ /* Copy private indices created by DIX */
+ dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex;
+ dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex;
+
+ /* Reset the window priv privs if generations do not match. */
+ if (miDbePrivPrivGeneration != serverGeneration)
+ {
+ /*
+ **********************************************************************
+ ** Allocate the window priv priv.
+ **********************************************************************
+ */
+
+ miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)();
+
+ if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen,
+ miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec)))
+ {
+ return(FALSE);
+ }
+
+ /* Make sure we only do this code once. */
+ miDbePrivPrivGeneration = serverGeneration;
+
+ } /* if -- Reset priv privs. */
+
+ /* Wrap functions. */
+ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
+ pScreen->PositionWindow = miDbePositionWindow;
+
+ /* Initialize the per-screen DBE function pointers. */
+ pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
+ pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
+ pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
+ pDbeScreenPriv->BeginIdiom = 0;
+ pDbeScreenPriv->EndIdiom = 0;
+ pDbeScreenPriv->ResetProc = miDbeResetProc;
+ pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
+
+ /* The mi implementation doesn't need buffer validation. */
+ pDbeScreenPriv->ValidateBuffer = (void (*)())NoopDDA;
+
+ return(TRUE);
+
+} /* miDbeInit() */
diff --git a/xc/programs/Xserver/dbe/midbe.h b/xc/programs/Xserver/dbe/midbe.h
new file mode 100644
index 000000000..ca8a79ed5
--- /dev/null
+++ b/xc/programs/Xserver/dbe/midbe.h
@@ -0,0 +1,48 @@
+/* $XConsortium: midbe.h /main/3 1995/09/22 10:21:33 dpw $ */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for users of machine-independent DBE code
+ *
+ *****************************************************************************/
+
+
+#ifndef MIDBE_H
+#define MIDBE_H
+
+/* EXTERNS */
+
+extern Bool miDbeInit(
+#if NeedFunctionPrototypes
+ ScreenPtr pScreen,
+ DbeScreenPrivPtr pDbeScreenPriv
+#endif
+);
+
+#endif /* MIDBE_H */
+
diff --git a/xc/programs/Xserver/dbe/midbestr.h b/xc/programs/Xserver/dbe/midbestr.h
new file mode 100644
index 000000000..f1c68d2a9
--- /dev/null
+++ b/xc/programs/Xserver/dbe/midbestr.h
@@ -0,0 +1,96 @@
+/* $XConsortium: midbestruct.h /main/3 1995/09/22 10:21:49 dpw $ */
+/******************************************************************************
+ *
+ * Copyright (c) 1994, 1995 Hewlett-Packard Company
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Hewlett-Packard
+ * Company shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization from the Hewlett-Packard Company.
+ *
+ * Header file for users of machine-independent DBE code
+ *
+ *****************************************************************************/
+
+
+#ifndef MIDBE_STRUCT_H
+#define MIDBE_STRUCT_H
+
+
+/* DEFINES */
+
+#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
+ (((miDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \
+ NULL : \
+ ((MiDbeWindowPrivPrivPtr) \
+ ((pDbeWindowPriv)->devPrivates[miDbeWindowPrivPrivIndex].ptr)))
+
+#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
+ MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
+
+#define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \
+ (((miDbeScreenPrivPrivIndex < 0) || (!pDbeScreenPriv)) ? \
+ NULL : \
+ ((MiDbeScreenPrivPrivPtr) \
+ ((pDbeScreenPriv)->devPrivates[miDbeScreenPrivPrivIndex].ptr)))
+
+
+/* TYPEDEFS */
+
+typedef struct _MiDbeWindowPrivPrivRec
+{
+ /* Place machine-specific fields in here.
+ * Since this is mi code, we do not really have machine-specific fields.
+ */
+
+ /* Pointer to a drawable that contains the contents of the back buffer.
+ */
+ PixmapPtr pBackBuffer;
+
+ /* Pointer to a drawable that contains the contents of the front buffer.
+ * This pointer is only used for the XdbeUntouched swap action. For that
+ * swap action, we need to copy the front buffer (window) contents into
+ * this drawable, copy the contents of current back buffer drawable (the
+ * back buffer) into the window, swap the front and back drawable pointers,
+ * and then swap the drawable/resource associations in the resource
+ * database.
+ */
+ PixmapPtr pFrontBuffer;
+
+ /* Pointer back to our window private with which we are associated. */
+ DbeWindowPrivPtr pDbeWindowPriv;
+
+} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
+
+typedef struct _MiDbeScreenPrivPrivRec
+{
+ /* Place machine-specific fields in here.
+ * Since this is mi code, we do not really have machine-specific fields.
+ */
+
+ /* Pointer back to our screen private with which we are associated. */
+ DbeScreenPrivPtr pDbeScreenPriv;
+
+} MiDbeScreenPrivPrivRec, *MiDbeScreenPrivPrivPtr;
+
+#endif /* MIDBE_STRUCT_H */
+
diff --git a/xc/programs/Xserver/dix/BuiltInAtoms b/xc/programs/Xserver/dix/BuiltInAtoms
new file mode 100644
index 000000000..910c62706
--- /dev/null
+++ b/xc/programs/Xserver/dix/BuiltInAtoms
@@ -0,0 +1,329 @@
+File: .../x11/server/dix/BuiltInAtoms
+
+This file is of a fixed format and is used to generate both the file
+include/XAtom.h and dix/initatoms.c. Neither of those files should be
+edited directly. Changing the atoms in this file, or even the order in
+which they occur, is equivalent to forcing a new (minor) version number
+on the server. Take care.
+
+The format of the file is that each built in atom starts in column 1
+with no text, other than spaces and tabs, on that line other than a
+mandatory trailing "@" at the end of the line. For each atom (Foo)
+below the defines will be of the form
+ #define XA_Foo <n>
+and the string value of the atom will be "Foo".
+
+The comment lines in this file are not guaranteed to be accurate. To see the
+current truth, look at the Xlib documentation as well as the protocol spec.
+
+Atoms occur in five distinct name spaces within the protocol. Any particular
+atom may or may not have some client interpretation within each of the name
+spaces. For each of the built in atoms, the intended semantics and the space
+within which it is defined is indicated.
+
+Those name spaces are
+ Property names
+ Property types
+ Selections
+ Font properties
+ Type of a ClientMessage event (none built into server)
+
+For the font properties mentioned here, see the spec for more information.
+
+ -- Selections --
+
+PRIMARY @
+ Selection.
+SECONDARY @
+ Selection.
+
+ -- Property types and names --
+
+ARC @
+ Property type:
+ x, y: INT16
+ width, height: CARD16,
+ angle1, angle2: INT16
+ATOM @
+ Property type:
+ atom: ATOM
+BITMAP @
+ Property type:
+ bitmap: PIXMAP
+ This is asserted to be of depth 1.
+CARDINAL @
+ Property type:
+ card: CARD32 or CARD16 or CARD8
+ the datum size is dependent on the property format
+COLORMAP @
+ Property type:
+ colormap: COLORMAP
+CURSOR @
+ Property type:
+ cursor: CURSOR
+CUT_BUFFER0 @
+CUT_BUFFER1 @
+CUT_BUFFER2 @
+CUT_BUFFER3 @
+CUT_BUFFER4 @
+CUT_BUFFER5 @
+CUT_BUFFER6 @
+CUT_BUFFER7 @
+ Property name: (type: STRING)
+ Used to implement cut buffer ring, in particular Andrew uses
+ this mechanism. Anyone else using this sort of IPC mechanism
+ should use these properties.
+
+ Data is normally fetched and stored out of CUT_BUFFER0; the
+ RotateProperties request is used to rotate these buffers.
+DRAWABLE @
+ Property type:
+ drawable: DRAWABLE
+FONT @
+ Property type:
+ font: FONT
+INTEGER @
+ Property type:
+ card: INT32 or INT16 or INT8
+ the datum size is dependent on the property format
+PIXMAP @
+ Property type:
+ pixmap: PIXMAP
+POINT @
+ Property type:
+ x, y: INT16
+RECTANGLE @
+ Property type:
+ x, y: INT16
+ width, height: CARD16
+RESOURCE_MANAGER @
+ Property name: (type: STRING)
+ Contents of the user's resource manager data base.
+RGB_COLOR_MAP @
+ Property type:
+ colormap: COLORMAP
+ red-max: CARD32
+ red-mult: CARD32
+ green-max: CARD32
+ green-mult: CARD32
+ blue-max: CARD32
+ blue-mult: CARD32
+ base-pixel: CARD32
+
+ The fields `red_max', `green_max', and `blue_max' give the maximum
+ red, green, and blue values, respectively. Each color
+ coefficient ranges from 0 to its max, inclusive. For example,
+ a common colormap allocation is 3/3/2: 3 planes for red, 3
+ planes for green, and 2 planes for blue. Such a colormap would
+ have red_max == 7, green_max = 7, and blue_max = 3. An alternate
+ allocation that uses only 216 colors is red_max = 5, green_max =
+ 5, and blue_max = 5.
+
+ The fields `red_mult', `green_mult', and `blue_mult' give the
+ scale factors used to compose a full pixel value. (See next
+ paragraph.) For a 3/3/2 allocation red_mult might be 32,
+ green_mult might be 4, and blue_mult might be 1. For a
+ 6-colors-each allocation, red_mult might be 36, green_mult might
+ be 6, and blue_mult might be 1.
+
+ The field `base_pixel' gives the base pixel value used to
+ compose a full pixel value. Normally base_pixel is obtained
+ from a call to XAllocColorPlanes(). Given integer red, green,
+ and blue coefficients in their appropriate ranges, one can
+ compute a corresponding pixel value with the expression:
+
+ r * red_mult + g * green_mult + b * blue_mult + base_pixel
+
+ For gray-scale colormaps, only the colormap, red_max, red_mult,
+ and base_pixel fields are defined; the other fields are
+ ignored. To compute a gray-scale pixel value, use:
+
+ gray * red_mult + base_pixel
+
+ This is provided to allow applications to share color maps.
+
+RGB_BEST_MAP @
+RGB_BLUE_MAP @
+RGB_DEFAULT_MAP @
+RGB_GRAY_MAP @
+RGB_GREEN_MAP @
+RGB_RED_MAP @
+ Property name: (type: RGB_COLOR_MAP)
+ The needs of most applications can be met with five colormaps.
+ Polite applications may need only a small RGB space, and can
+ use a portion of the default color map. Applications doing
+ high-quality RGB rendering will need an entire colormap,
+ filled with as large an RGB space as possible, e.g. 332. For
+ color separations, an application may need maximum device
+ resolution for each of red, green, and blue, even if this
+ requires three renderings with three colormaps.
+
+ Each of the above five names would be used for sharing color
+ maps.
+STRING @
+ Property type:
+ sequence of Bytes
+VISUALID @
+ Property type:
+ visual: VISUALID
+WINDOW @
+ Property type:
+ window: WINDOW
+WM_COMMAND @
+ Property name: (type: STRING)
+ Command line arguments used to invoke this application. The
+ arguments are delimited by null characters (ASCII 0).
+WM_HINTS @
+ Property type:
+ flags: CARD32
+ input: BOOL32
+ initial-state: CARD32
+ icon-pixmap: PIXMAP
+ icon-window: WINDOW
+ icon_mask: BITMAP
+ icon-x, icon-y: INT32
+ flags contains the following bits
+ 0x00000001 input hint
+ 0x00000002 state hint
+ 0x00000004 icon pixmap hint
+ 0x00000008 icon window hint
+ 0x00000010 icon position hint
+ values for initial-state
+ 0 unspecified -> application does not
+ care and WM should pick one.
+ 1 normal
+ 2 zoomed
+ 3 iconic
+ 4 inactive -> application believes
+ itself to be seldomly used. WM may wish to
+ place it on an inactive menu.
+ This type is potentially extensible. The order is critical;
+ append to the end only.
+ Property name: (type: WM_HINTS)
+ Additional hints set by the client for use by the window
+ manager.
+WM_CLIENT_MACHINE @
+ Property name: (type: STRING)
+ used to communicate with the window manager. The host name
+ of the machine the client is running on may be set here.
+WM_ICON_NAME @
+ Property name: (type: STRING)
+ what the application would like the label to be for
+ the iconic form of the window.
+WM_ICON_SIZE @
+ Property type:
+ minWidth, min-height: CARD32
+ maxWidth, max-height: CARD32
+ widthInc, height-inc: CARD32
+ Property name: (type: ICON_SIZE)
+ The window manager may set this property on the root window
+ to specify the icon sizes it allows.
+WM_NAME @
+ Property name: (type: STRING)
+ used to communicate with the window manager. This is
+ what the application would like the label for the window.
+WM_NORMAL_HINTS @
+ Property name: (type: SIZE_HINTS)
+ used to communicate with the window manager. This is size
+ hints for a window in its "normal" state.
+WM_SIZE_HINTS @
+ Property type:
+ flags: CARD32
+ x, y: INT32
+ width, height: CARD32
+ min-width, min-height: CARD32
+ max-width, max-height: CARD32
+ width-inc, height-inc: CARD32
+ min-aspect-x, min-aspect-y: CARD32
+ max-aspect-x, max-aspect-y: CARD32
+ flags contains the following bits
+ 0x00000001 user specified x and y
+ 0x00000002 user specified width and height
+ 0x00000004 program specified position
+ 0x00000008 program specified size
+ 0x00000010 program specified minimum size
+ 0x00000020 program specified maximum size
+ 0x00000040 program specified resize increment
+ 0x00000080 program specified aspect ratio
+ This type is potentially extensible. The order is critical;
+ append to the end only.
+WM_ZOOM_HINTS @
+ Property name: (type: SIZE_HINTS)
+ used to communicate with the window manager. This is size
+ hints for a window in its "zoomed" state.
+
+ -- Font properties --
+
+MIN_SPACE @
+ Font property: CARD32
+NORM_SPACE @
+ Font property: CARD32
+MAX_SPACE @
+ Font property: CARD32
+END_SPACE @
+ Font property: CARD32
+SUPERSCRIPT_X @
+ Font property: INT32
+SUPERSCRIPT_Y @
+ Font property: INT32
+SUBSCRIPT_X @
+ Font property: INT32
+SUBSCRIPT_Y @
+ Font property: INT32
+UNDERLINE_POSITION @
+ Font property: INT32
+UNDERLINE_THICKNESS @
+ Font property: CARD32
+STRIKEOUT_ASCENT @
+ Font property: INT32
+STRIKEOUT_DESCENT @
+ Font property: INT32
+ITALIC_ANGLE @
+ Font property: INT32
+X_HEIGHT @
+ Font property: INT32
+QUAD_WIDTH @
+ Font property: INT32
+WEIGHT @
+ Font property: CARD32
+POINT_SIZE @
+ Font property: CARD32
+RESOLUTION @
+ Font property: CARD32
+
+The following optional properties on fonts have values that are atoms. The
+atom print name is the useful information.
+
+COPYRIGHT @
+ of the font distribution
+NOTICE @
+ trademark/copyright of the character shapes
+FONT_NAME @
+ name of this particular instance of a font
+FAMILY_NAME @
+ name of the 'font family' to which it belongs
+FULL_NAME @
+ full text name of the font
+
+The following aren't in order but putting them at the end avoids encoding
+changes.
+
+CAP_HEIGHT @
+ Font property: CARD32
+
+
+WM_CLASS @
+ Property name: (type: STRING)
+ Used (possibly by some window managers; definitely by
+ session managers) to look up resources in the resource
+ data base on behalf of the client who set this property.
+ There are 2 elements:
+ {char *resource_name; char *resource_class;}
+ delimited by a null character (ascii 0)
+
+WM_TRANSIENT_FOR @
+ Property name: (type: WINDOW)
+ Used by transient top-level windows, such as dialog
+ boxes, to point to their logical "parents". The window
+ manager can then take down the dialog boxes when the
+ "parent" gets iconified, for instance.
diff --git a/xc/programs/Xserver/dix/CHANGES b/xc/programs/Xserver/dix/CHANGES
new file mode 100644
index 000000000..d8fb7c31a
--- /dev/null
+++ b/xc/programs/Xserver/dix/CHANGES
@@ -0,0 +1,17 @@
+The following changes have been made to this directory since R3 (for
+a full description, see doc/Server/r4.tbl.ms):
+
+ o Windows restructured (memory reduction, devPrivates and speedups)
+ o GCs restructured (memory reduction, devPrivates and wrappers)
+ o Screens restructured (window ops merged in, devPrivates)
+ o Pixmaps restructured (drawable changes mostly)
+ o Cursors restructured (shares glyph bits now)
+ o Visuals restructured (screen index removed, fields rearranged)
+ o Devices restructured (input extension changes)
+ o Out of memory changes. Many interfaces now return OutOfMemory
+ status.
+ o Synchronous grab code rewritten. Should conform to our
+ understanding of the protocol now. Be careful when time
+ stamping events (don't allow time to run backwards).
+ o Resource types redesigned and rewritten.
+ o Internal fake color allocation routine for software cursors.
diff --git a/xc/programs/Xserver/dix/Imakefile b/xc/programs/Xserver/dix/Imakefile
new file mode 100644
index 000000000..dd9e54c80
--- /dev/null
+++ b/xc/programs/Xserver/dix/Imakefile
@@ -0,0 +1,88 @@
+XCOMM $XConsortium: Imakefile /main/52 1996/12/02 10:20:03 lehors $
+XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.9 1999/04/17 09:08:28 dawes Exp $
+#include <Server.tmpl>
+
+#if PrintOnlyServer
+XPSRC = xpstubs.c
+XPOBJ = xpstubs.o
+#endif
+
+#if !HasFfs
+FFS_SRC = ffs.c
+FFS_OBJ = ffs.o
+#endif
+
+SRCS = atom.c colormap.c cursor.c devices.c dispatch.c dixutils.c events.c \
+ extension.c gc.c globals.c glyphcurs.c grabs.c \
+ main.c property.c resource.c swaprep.c swapreq.c \
+ tables.c window.c initatoms.c dixfonts.c privates.c pixmap.c $(FFS_SRC)
+OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \
+ extension.o gc.o globals.o glyphcurs.o grabs.o \
+ main.o property.o resource.o swaprep.o swapreq.o \
+ tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ)
+
+ INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC)
+ LINTLIBS = ../os/llib-los.ln
+
+/*
+ * The following configuration parameters may be set in the appropriate
+ * .macros files or site.def in the directory util/imake.includes/:
+ *
+ * DefaultFontPath COMPILEDDEFAULTFONTPATH
+ * DefaultRGBDatabase RGB_DB
+ *
+ * The sample util/imake.includes/Imake.tmpl will provide generic defaults.
+ * The values in site.h are simply a last line of defense and should not be
+ * changed.
+ */
+
+#ifdef DefaultFontPath
+DEFAULTFONTPATH = DefaultFontPath
+SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\"
+#endif
+
+#ifdef DefaultRGBDatabase
+DEFAULTRGBDATABASE = DefaultRGBDatabase
+ SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\"
+#endif
+
+#ifdef DefaultDisplayClass
+DEFAULTDISPLAYCLASS = DefaultDisplayClass
+ SITE_DISPLAY_CLASS = -DCOMPILEDDISPLAYCLASS=\"$(DEFAULTDISPLAYCLASS)\"
+#endif
+
+#ifdef XVendorString
+VENDORSTRING = XVendorString
+ VENDOR_STRING = -DVENDOR_STRING=\"$(VENDORSTRING)\"
+#endif
+
+#ifdef XVendorRelease
+VENDORRELEASE = XVendorRelease
+ VENDOR_RELEASE = -DVENDOR_RELEASE=$(VENDORRELEASE)
+#endif
+
+#if HasKrb5
+ K5DEFS = Krb5Defines
+#endif
+
+SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_RGB_DB) $(SITE_DISPLAY_CLASS)
+
+VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE)
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(dix,$(OBJS))
+LintLibraryTarget(dix,$(SRCS) $(XPSRC))
+NormalLintTarget($(SRCS) $(XPSRC))
+
+SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES))
+SpecialCObjectRule(tables,$(ICONFIGFILES),$(K5DEFS))
+SpecialCObjectRule(dispatch,$(ICONFIGFILES),$(K5DEFS))
+SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES))
+SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_))
+SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_))
+
+#if PrintOnlyServer
+NormalLibraryTarget(xpstubs,$(XPOBJ))
+#endif
+
+DependTarget()
diff --git a/xc/programs/Xserver/dix/atom.c b/xc/programs/Xserver/dix/atom.c
new file mode 100644
index 000000000..b6dfc2ebb
--- /dev/null
+++ b/xc/programs/Xserver/dix/atom.c
@@ -0,0 +1,209 @@
+/* $XFree86: xc/programs/Xserver/dix/atom.c,v 3.1 1998/10/04 09:38:01 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: atom.c /main/11 1998/02/09 14:17:45 kaleb $ */
+
+#include "X.h"
+#include "Xatom.h"
+#include "misc.h"
+#include "resource.h"
+#include "dix.h"
+
+#define InitialTableSize 100
+
+typedef struct _Node {
+ struct _Node *left, *right;
+ Atom a;
+ unsigned int fingerPrint;
+ char *string;
+} NodeRec, *NodePtr;
+
+static Atom lastAtom = None;
+static NodePtr atomRoot = (NodePtr)NULL;
+static unsigned long tableLength;
+static NodePtr *nodeTable;
+
+Atom
+MakeAtom(string, len, makeit)
+ char *string;
+ unsigned len;
+ Bool makeit;
+{
+ register NodePtr * np;
+ unsigned i;
+ int comp;
+ register unsigned int fp = 0;
+
+ np = &atomRoot;
+ for (i = 0; i < (len+1)/2; i++)
+ {
+ fp = fp * 27 + string[i];
+ fp = fp * 27 + string[len - 1 - i];
+ }
+ while (*np != (NodePtr) NULL)
+ {
+ if (fp < (*np)->fingerPrint)
+ np = &((*np)->left);
+ else if (fp > (*np)->fingerPrint)
+ np = &((*np)->right);
+ else
+ { /* now start testing the strings */
+ comp = strncmp(string, (*np)->string, (int)len);
+ if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
+ np = &((*np)->left);
+ else if (comp > 0)
+ np = &((*np)->right);
+ else
+ return(*np)->a;
+ }
+ }
+ if (makeit)
+ {
+ register NodePtr nd;
+
+ nd = (NodePtr) xalloc(sizeof(NodeRec));
+ if (!nd)
+ return BAD_RESOURCE;
+ if (lastAtom < XA_LAST_PREDEFINED)
+ {
+ nd->string = string;
+ }
+ else
+ {
+ nd->string = (char *) xalloc(len + 1);
+ if (!nd->string) {
+ xfree(nd);
+ return BAD_RESOURCE;
+ }
+ strncpy(nd->string, string, (int)len);
+ nd->string[len] = 0;
+ }
+ if ((lastAtom + 1) >= tableLength) {
+ NodePtr *table;
+
+ table = (NodePtr *) xrealloc(nodeTable,
+ tableLength * (2 * sizeof(NodePtr)));
+ if (!table) {
+ if (nd->string != string)
+ xfree(nd->string);
+ xfree(nd);
+ return BAD_RESOURCE;
+ }
+ tableLength <<= 1;
+ nodeTable = table;
+ }
+ *np = nd;
+ nd->left = nd->right = (NodePtr) NULL;
+ nd->fingerPrint = fp;
+ nd->a = (++lastAtom);
+ *(nodeTable+lastAtom) = nd;
+ return nd->a;
+ }
+ else
+ return None;
+}
+
+Bool
+ValidAtom(atom)
+ Atom atom;
+{
+ return (atom != None) && (atom <= lastAtom);
+}
+
+char *
+NameForAtom(atom)
+ Atom atom;
+{
+ NodePtr node;
+ if (atom > lastAtom) return 0;
+ if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
+ return node->string;
+}
+
+void
+AtomError()
+{
+ FatalError("initializing atoms");
+}
+
+void
+FreeAtom(patom)
+ NodePtr patom;
+{
+ if(patom->left)
+ FreeAtom(patom->left);
+ if(patom->right)
+ FreeAtom(patom->right);
+ if (patom->a > XA_LAST_PREDEFINED)
+ xfree(patom->string);
+ xfree(patom);
+}
+
+void
+FreeAllAtoms()
+{
+ if(atomRoot == (NodePtr)NULL)
+ return;
+ FreeAtom(atomRoot);
+ atomRoot = (NodePtr)NULL;
+ xfree(nodeTable);
+ nodeTable = (NodePtr *)NULL;
+ lastAtom = None;
+}
+
+void
+InitAtoms()
+{
+ FreeAllAtoms();
+ tableLength = InitialTableSize;
+ nodeTable = (NodePtr *)xalloc(InitialTableSize*sizeof(NodePtr));
+ if (!nodeTable)
+ AtomError();
+ nodeTable[None] = (NodePtr)NULL;
+ MakePredeclaredAtoms();
+ if (lastAtom != XA_LAST_PREDEFINED)
+ AtomError ();
+}
+
+
diff --git a/xc/programs/Xserver/dix/buildatoms b/xc/programs/Xserver/dix/buildatoms
new file mode 100755
index 000000000..dfbbca8a9
--- /dev/null
+++ b/xc/programs/Xserver/dix/buildatoms
@@ -0,0 +1,43 @@
+#!/bin/sh
+hfile=../../../include/Xatom.h
+cfile=initatoms.c
+rm -f $hfile $cfile
+umask 222
+awk '
+BEGIN {
+ hfile = "'$hfile'";
+ cfile = "'$cfile'";
+ hformat = "#define XA_%s ((Atom) %d)\n";
+ printf("#ifndef XATOM_H\n") > hfile;
+ printf("#define XATOM_H 1\n\n") > hfile;
+ printf("/* THIS IS A GENERATED FILE\n") > hfile;
+ printf(" *\n") > hfile;
+ printf(" * Do not change! Changing this file implies a protocol change!\n") > hfile;
+ printf(" */\n\n") > hfile;
+
+ printf("/* THIS IS A GENERATED FILE\n") > cfile;
+ printf(" *\n") > cfile;
+ printf(" * Do not change! Changing this file implies a protocol change!\n") > cfile;
+ printf(" */\n\n") > cfile;
+ printf("#include \"X.h\"\n") > cfile;
+ printf("#include \"Xatom.h\"\n") > cfile;
+ printf("#include \"misc.h\"\n") > cfile;
+ printf("#include \"dix.h\"\n") > cfile;
+ printf("void MakePredeclaredAtoms()\n") > cfile;
+ printf("{\n") > cfile;
+
+ }
+
+NF == 2 && $2 == "@" {
+ printf(hformat, $1, ++atomno) > hfile ;
+ printf(" if (MakeAtom(\"%s\", %d, 1) != XA_%s) AtomError();\n", $1, length($1), $1) > cfile ;
+ }
+
+END {
+ printf("\n") > hfile;
+ printf(hformat, "LAST_PREDEFINED", atomno) > hfile ;
+ printf("#endif /* XATOM_H */\n") > hfile;
+ printf("}\n") > cfile ;
+ }
+' BuiltInAtoms
+exit 0
diff --git a/xc/programs/Xserver/dix/colormap.c b/xc/programs/Xserver/dix/colormap.c
new file mode 100644
index 000000000..0b7fbb165
--- /dev/null
+++ b/xc/programs/Xserver/dix/colormap.c
@@ -0,0 +1,2873 @@
+/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.3 1998/10/04 09:38:02 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: colormap.c /main/74 1998/03/24 18:17:31 kaleb $ */
+
+#include "X.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "misc.h"
+#include "dix.h"
+#include "colormapst.h"
+#include "os.h"
+#include "scrnintstr.h"
+#include "resource.h"
+#include "windowstr.h"
+
+extern XID clientErrorValue;
+
+static Pixel FindBestPixel(
+#if NeedFunctionPrototypes
+ EntryPtr /*pentFirst*/,
+ int /*size*/,
+ xrgb * /*prgb*/,
+ int /*channel*/
+#endif
+);
+
+static int AllComp(
+#if NeedFunctionPrototypes
+ EntryPtr /*pent*/,
+ xrgb * /*prgb*/
+#endif
+);
+
+static int RedComp(
+#if NeedFunctionPrototypes
+ EntryPtr /*pent*/,
+ xrgb * /*prgb*/
+#endif
+);
+
+static int GreenComp(
+#if NeedFunctionPrototypes
+ EntryPtr /*pent*/,
+ xrgb * /*prgb*/
+#endif
+);
+
+static int BlueComp(
+#if NeedFunctionPrototypes
+ EntryPtr /*pent*/,
+ xrgb * /*prgb*/
+#endif
+);
+
+static void FreePixels(
+#if NeedFunctionPrototypes
+ register ColormapPtr /*pmap*/,
+ register int /*client*/
+#endif
+);
+
+static void CopyFree(
+#if NeedFunctionPrototypes
+ int /*channel*/,
+ int /*client*/,
+ ColormapPtr /*pmapSrc*/,
+ ColormapPtr /*pmapDst*/
+#endif
+);
+
+static void FreeCell(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ Pixel /*i*/,
+ int /*channel*/
+#endif
+);
+
+static void UpdateColors(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/
+#endif
+);
+
+static int AllocDirect(
+#if NeedFunctionPrototypes
+ int /*client*/,
+ ColormapPtr /*pmap*/,
+ int /*c*/,
+ int /*r*/,
+ int /*g*/,
+ int /*b*/,
+ Bool /*contig*/,
+ Pixel * /*pixels*/,
+ Pixel * /*prmask*/,
+ Pixel * /*pgmask*/,
+ Pixel * /*pbmask*/
+#endif
+);
+
+static int AllocPseudo(
+#if NeedFunctionPrototypes
+ int /*client*/,
+ ColormapPtr /*pmap*/,
+ int /*c*/,
+ int /*r*/,
+ Bool /*contig*/,
+ Pixel * /*pixels*/,
+ Pixel * /*pmask*/,
+ Pixel ** /*pppixFirst*/
+#endif
+);
+
+static Bool AllocCP(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ EntryPtr /*pentFirst*/,
+ int /*count*/,
+ int /*planes*/,
+ Bool /*contig*/,
+ Pixel * /*pixels*/,
+ Pixel * /*pMask*/
+#endif
+);
+
+static Bool AllocShared(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ Pixel * /*ppix*/,
+ int /*c*/,
+ int /*r*/,
+ int /*g*/,
+ int /*b*/,
+ Pixel /*rmask*/,
+ Pixel /*gmask*/,
+ Pixel /*bmask*/,
+ Pixel * /*ppixFirst*/
+#endif
+);
+
+static int FreeCo(
+#if NeedFunctionPrototypes
+ ColormapPtr /*pmap*/,
+ int /*client*/,
+ int /*color*/,
+ int /*npixIn*/,
+ Pixel * /*ppixIn*/,
+ Pixel /*mask*/
+#endif
+);
+
+static int TellNoMap(
+#if NeedFunctionPrototypes
+ WindowPtr /*pwin*/,
+ Colormap * /*pmid*/
+#endif
+);
+
+static void FindColorInRootCmap (
+#if NeedFunctionPrototypes
+ ColormapPtr /* pmap */,
+ EntryPtr /* pentFirst */,
+ int /* size */,
+ xrgb* /* prgb */,
+ Pixel* /* pPixel */,
+ int /* channel */,
+ ColorCompareProcPtr /* comp */
+#endif
+);
+
+#define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
+#define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
+#define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1)
+#define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask)
+
+/* GetNextBitsOrBreak(bits, mask, base) --
+ * (Suggestion: First read the macro, then read this explanation.
+ *
+ * Either generate the next value to OR in to a pixel or break out of this
+ * while loop
+ *
+ * This macro is used when we're trying to generate all 2^n combinations of
+ * bits in mask. What we're doing here is counting in binary, except that
+ * the bits we use to count may not be contiguous. This macro will be
+ * called 2^n times, returning a different value in bits each time. Then
+ * it will cause us to break out of a surrounding loop. (It will always be
+ * called from within a while loop.)
+ * On call: mask is the value we want to find all the combinations for
+ * base has 1 bit set where the least significant bit of mask is set
+ *
+ * For example,if mask is 01010, base should be 0010 and we count like this:
+ * 00010 (see this isn't so hard),
+ * then we add base to bits and get 0100. (bits & ~mask) is (0100 & 0100) so
+ * we add that to bits getting (0100 + 0100) =
+ * 01000 for our next value.
+ * then we add 0010 to get
+ * 01010 and we're done (easy as 1, 2, 3)
+ */
+#define GetNextBitsOrBreak(bits, mask, base) \
+ if((bits) == (mask)) \
+ break; \
+ (bits) += (base); \
+ while((bits) & ~(mask)) \
+ (bits) += ((bits) & ~(mask));
+/* ID of server as client */
+#define SERVER_ID 0
+
+typedef struct _colorResource
+{
+ Colormap mid;
+ int client;
+} colorResource;
+
+/* Invariants:
+ * refcnt == 0 means entry is empty
+ * refcnt > 0 means entry is useable by many clients, so it can't be changed
+ * refcnt == AllocPrivate means entry owned by one client only
+ * fShared should only be set if refcnt == AllocPrivate, and only in red map
+ */
+
+
+/* Create and initialize the color map */
+int
+CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client)
+ Colormap mid; /* resource to use for this colormap */
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ ColormapPtr *ppcmap;
+ int alloc; /* 1 iff all entries are allocated writeable */
+ int client;
+{
+ int class, size;
+ unsigned long sizebytes;
+ ColormapPtr pmap;
+ register EntryPtr pent;
+ int i;
+ register Pixel *ppix, **pptr;
+ extern int colormapPrivateCount;
+
+ class = pVisual->class;
+ if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID))
+ return (BadMatch);
+
+ size = pVisual->ColormapEntries;
+ sizebytes = (size * sizeof(Entry)) +
+ (MAXCLIENTS * sizeof(Pixel *)) +
+ (MAXCLIENTS * sizeof(int));
+ if ((class | DynamicClass) == DirectColor)
+ sizebytes *= 3;
+ sizebytes += sizeof(ColormapRec);
+ pmap = (ColormapPtr) xalloc(sizebytes);
+ if (!pmap)
+ return (BadAlloc);
+ pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec));
+ sizebytes = size * sizeof(Entry);
+ pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes);
+ pmap->numPixelsRed = (int *)((char *)pmap->clientPixelsRed +
+ (MAXCLIENTS * sizeof(Pixel *)));
+ pmap->mid = mid;
+ pmap->flags = 0; /* start out with all flags clear */
+ if(mid == pScreen->defColormap)
+ pmap->flags |= IsDefault;
+ pmap->pScreen = pScreen;
+ pmap->pVisual = pVisual;
+ pmap->class = class;
+ if ((class | DynamicClass) == DirectColor)
+ size = NUMRED(pVisual);
+ pmap->freeRed = size;
+ bzero ((char *) pmap->red, (int)sizebytes);
+ bzero((char *) pmap->numPixelsRed, MAXCLIENTS * sizeof(int));
+ for (pptr = &pmap->clientPixelsRed[MAXCLIENTS]; --pptr >= pmap->clientPixelsRed; )
+ *pptr = (Pixel *)NULL;
+ if (alloc == AllocAll)
+ {
+ if (class & DynamicClass)
+ pmap->flags |= AllAllocated;
+ for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeRed = 0;
+ ppix = (Pixel *)xalloc(size * sizeof(Pixel));
+ if (!ppix)
+ {
+ xfree(pmap);
+ return (BadAlloc);
+ }
+ pmap->clientPixelsRed[client] = ppix;
+ for(i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsRed[client] = size;
+ }
+
+ if ((class | DynamicClass) == DirectColor)
+ {
+ pmap->freeGreen = NUMGREEN(pVisual);
+ pmap->green = (EntryPtr)((char *)pmap->numPixelsRed +
+ (MAXCLIENTS * sizeof(int)));
+ pmap->clientPixelsGreen = (Pixel **)((char *)pmap->green + sizebytes);
+ pmap->numPixelsGreen = (int *)((char *)pmap->clientPixelsGreen +
+ (MAXCLIENTS * sizeof(Pixel *)));
+ pmap->freeBlue = NUMBLUE(pVisual);
+ pmap->blue = (EntryPtr)((char *)pmap->numPixelsGreen +
+ (MAXCLIENTS * sizeof(int)));
+ pmap->clientPixelsBlue = (Pixel **)((char *)pmap->blue + sizebytes);
+ pmap->numPixelsBlue = (int *)((char *)pmap->clientPixelsBlue +
+ (MAXCLIENTS * sizeof(Pixel *)));
+
+ bzero ((char *) pmap->green, (int)sizebytes);
+ bzero ((char *) pmap->blue, (int)sizebytes);
+
+ memmove((char *) pmap->clientPixelsGreen,
+ (char *) pmap->clientPixelsRed,
+ MAXCLIENTS * sizeof(Pixel *));
+ memmove((char *) pmap->clientPixelsBlue,
+ (char *) pmap->clientPixelsRed,
+ MAXCLIENTS * sizeof(Pixel *));
+ bzero((char *) pmap->numPixelsGreen, MAXCLIENTS * sizeof(int));
+ bzero((char *) pmap->numPixelsBlue, MAXCLIENTS * sizeof(int));
+
+ /* If every cell is allocated, mark its refcnt */
+ if (alloc == AllocAll)
+ {
+ size = pmap->freeGreen;
+ for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeGreen = 0;
+ ppix = (Pixel *) xalloc(size * sizeof(Pixel));
+ if (!ppix)
+ {
+ xfree(pmap->clientPixelsRed[client]);
+ xfree(pmap);
+ return(BadAlloc);
+ }
+ pmap->clientPixelsGreen[client] = ppix;
+ for(i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsGreen[client] = size;
+
+ size = pmap->freeBlue;
+ for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--)
+ pent->refcnt = AllocPrivate;
+ pmap->freeBlue = 0;
+ ppix = (Pixel *) xalloc(size * sizeof(Pixel));
+ if (!ppix)
+ {
+ xfree(pmap->clientPixelsGreen[client]);
+ xfree(pmap->clientPixelsRed[client]);
+ xfree(pmap);
+ return(BadAlloc);
+ }
+ pmap->clientPixelsBlue[client] = ppix;
+ for(i = 0; i < size; i++)
+ ppix[i] = i;
+ pmap->numPixelsBlue[client] = size;
+ }
+ }
+ if (!AddResource(mid, RT_COLORMAP, (pointer)pmap))
+ return (BadAlloc);
+ /* If the device wants a chance to initialize the colormap in any way,
+ * this is it. In specific, if this is a Static colormap, this is the
+ * time to fill in the colormap's values */
+ pmap->flags |= BeingCreated;
+
+
+ /*
+ * Allocate the array of devPrivate's for this colormap.
+ */
+
+ if (colormapPrivateCount == 0)
+ pmap->devPrivates = NULL;
+ else
+ {
+ pmap->devPrivates = (DevUnion *) xalloc (
+ colormapPrivateCount * sizeof(DevUnion));
+
+ if (!pmap->devPrivates)
+ {
+ FreeResource (mid, RT_NONE);
+ return BadAlloc;
+ }
+ }
+
+ if (!(*pScreen->CreateColormap)(pmap))
+ {
+ FreeResource (mid, RT_NONE);
+ return BadAlloc;
+ }
+ pmap->flags &= ~BeingCreated;
+ *ppcmap = pmap;
+ return (Success);
+}
+
+int
+FreeColormap (value, mid)
+ pointer value; /* must conform to DeleteType */
+ XID mid;
+{
+ int i;
+ register EntryPtr pent;
+ ColormapPtr pmap = (ColormapPtr)value;
+
+ if(CLIENT_ID(mid) != SERVER_ID)
+ {
+ (*pmap->pScreen->UninstallColormap) (pmap);
+ WalkTree(pmap->pScreen, (VisitWindowProcPtr)TellNoMap, (pointer) &mid);
+ }
+
+ /* This is the device's chance to undo anything it needs to, especially
+ * to free any storage it allocated */
+ (*pmap->pScreen->DestroyColormap)(pmap);
+
+ if(pmap->clientPixelsRed)
+ {
+ for(i = 0; i < MAXCLIENTS; i++)
+ xfree(pmap->clientPixelsRed[i]);
+ }
+
+ if ((pmap->class == PseudoColor) || (pmap->class == GrayScale))
+ {
+ for(pent = &pmap->red[pmap->pVisual->ColormapEntries - 1];
+ pent >= pmap->red;
+ pent--)
+ {
+ if(pent->fShared)
+ {
+ if (--pent->co.shco.red->refcnt == 0)
+ xfree(pent->co.shco.red);
+ if (--pent->co.shco.green->refcnt == 0)
+ xfree(pent->co.shco.green);
+ if (--pent->co.shco.blue->refcnt == 0)
+ xfree(pent->co.shco.blue);
+ }
+ }
+ }
+ if((pmap->class | DynamicClass) == DirectColor)
+ {
+ for(i = 0; i < MAXCLIENTS; i++)
+ {
+ xfree(pmap->clientPixelsGreen[i]);
+ xfree(pmap->clientPixelsBlue[i]);
+ }
+ }
+
+ if (pmap->devPrivates)
+ xfree(pmap->devPrivates);
+
+ xfree(pmap);
+ return(Success);
+}
+
+/* Tell window that pmid has disappeared */
+static int
+TellNoMap (pwin, pmid)
+ WindowPtr pwin;
+ Colormap *pmid;
+{
+ xEvent xE;
+ if (wColormap(pwin) == *pmid)
+ {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = None;
+ xE.u.colormap.new = TRUE;
+ xE.u.colormap.state = ColormapUninstalled;
+ DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+ if (pwin->optional) {
+ pwin->optional->colormap = None;
+ CheckWindowOptionalNeed (pwin);
+ }
+ }
+
+ return (WT_WALKCHILDREN);
+}
+
+/* Tell window that pmid got uninstalled */
+int
+TellLostMap (pwin, value)
+ WindowPtr pwin;
+ pointer value;
+{
+ Colormap *pmid = (Colormap *)value;
+ xEvent xE;
+ if (wColormap(pwin) == *pmid)
+ {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = *pmid;
+ xE.u.colormap.new = FALSE;
+ xE.u.colormap.state = ColormapUninstalled;
+ DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+ }
+
+ return (WT_WALKCHILDREN);
+}
+
+/* Tell window that pmid got installed */
+int
+TellGainedMap (pwin, value)
+ WindowPtr pwin;
+ pointer value;
+{
+ Colormap *pmid = (Colormap *)value;
+ xEvent xE;
+ if (wColormap (pwin) == *pmid)
+ {
+ /* This should be call to DeliverEvent */
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pwin->drawable.id;
+ xE.u.colormap.colormap = *pmid;
+ xE.u.colormap.new = FALSE;
+ xE.u.colormap.state = ColormapInstalled;
+ DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+ }
+
+ return (WT_WALKCHILDREN);
+}
+
+
+int
+CopyColormapAndFree (mid, pSrc, client)
+ Colormap mid;
+ ColormapPtr pSrc;
+ int client;
+{
+ ColormapPtr pmap = (ColormapPtr) NULL;
+ int result, alloc, size;
+ Colormap midSrc;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+
+ pScreen = pSrc->pScreen;
+ pVisual = pSrc->pVisual;
+ midSrc = pSrc->mid;
+ alloc = ((pSrc->flags & AllAllocated) && CLIENT_ID(midSrc) == client) ?
+ AllocAll : AllocNone;
+ size = pVisual->ColormapEntries;
+
+ /* If the create returns non-0, it failed */
+ result = CreateColormap (mid, pScreen, pVisual, &pmap, alloc, client);
+ if(result != Success)
+ return(result);
+ if(alloc == AllocAll)
+ {
+ memmove((char *)pmap->red, (char *)pSrc->red, size * sizeof(Entry));
+ if((pmap->class | DynamicClass) == DirectColor)
+ {
+ memmove((char *)pmap->green, (char *)pSrc->green, size * sizeof(Entry));
+ memmove((char *)pmap->blue, (char *)pSrc->blue, size * sizeof(Entry));
+ }
+ pSrc->flags &= ~AllAllocated;
+ FreePixels(pSrc, client);
+ UpdateColors(pmap);
+ return(Success);
+ }
+
+ CopyFree(REDMAP, client, pSrc, pmap);
+ if ((pmap->class | DynamicClass) == DirectColor)
+ {
+ CopyFree(GREENMAP, client, pSrc, pmap);
+ CopyFree(BLUEMAP, client, pSrc, pmap);
+ }
+ if (pmap->class & DynamicClass)
+ UpdateColors(pmap);
+ /* XXX should worry about removing any RT_CMAPENTRY resource */
+ return(Success);
+}
+
+/* Helper routine for freeing large numbers of cells from a map */
+static void
+CopyFree (channel, client, pmapSrc, pmapDst)
+ int channel, client;
+ ColormapPtr pmapSrc, pmapDst;
+{
+ int z, npix, oldFree;
+ EntryPtr pentSrcFirst, pentDstFirst;
+ EntryPtr pentSrc, pentDst;
+ Pixel *ppix;
+ int nalloc;
+
+ switch(channel)
+ {
+ default: /* so compiler can see that everything gets initialized */
+ case REDMAP:
+ ppix = (pmapSrc->clientPixelsRed)[client];
+ npix = (pmapSrc->numPixelsRed)[client];
+ pentSrcFirst = pmapSrc->red;
+ pentDstFirst = pmapDst->red;
+ oldFree = pmapSrc->freeRed;
+ break;
+ case GREENMAP:
+ ppix = (pmapSrc->clientPixelsGreen)[client];
+ npix = (pmapSrc->numPixelsGreen)[client];
+ pentSrcFirst = pmapSrc->green;
+ pentDstFirst = pmapDst->green;
+ oldFree = pmapSrc->freeGreen;
+ break;
+ case BLUEMAP:
+ ppix = (pmapSrc->clientPixelsBlue)[client];
+ npix = (pmapSrc->numPixelsBlue)[client];
+ pentSrcFirst = pmapSrc->blue;
+ pentDstFirst = pmapDst->blue;
+ oldFree = pmapSrc->freeBlue;
+ break;
+ }
+ nalloc = 0;
+ if (pmapSrc->class & DynamicClass)
+ {
+ for(z = npix; --z >= 0; ppix++)
+ {
+ /* Copy entries */
+ pentSrc = pentSrcFirst + *ppix;
+ pentDst = pentDstFirst + *ppix;
+ if (pentDst->refcnt > 0)
+ {
+ pentDst->refcnt++;
+ }
+ else
+ {
+ *pentDst = *pentSrc;
+ nalloc++;
+ if (pentSrc->refcnt > 0)
+ pentDst->refcnt = 1;
+ else
+ pentSrc->fShared = FALSE;
+ }
+ FreeCell(pmapSrc, *ppix, channel);
+ }
+ }
+
+ /* Note that FreeCell has already fixed pmapSrc->free{Color} */
+ switch(channel)
+ {
+ case REDMAP:
+ pmapDst->freeRed -= nalloc;
+ (pmapDst->clientPixelsRed)[client] =
+ (pmapSrc->clientPixelsRed)[client];
+ (pmapSrc->clientPixelsRed)[client] = (Pixel *) NULL;
+ (pmapDst->numPixelsRed)[client] = (pmapSrc->numPixelsRed)[client];
+ (pmapSrc->numPixelsRed)[client] = 0;
+ break;
+ case GREENMAP:
+ pmapDst->freeGreen -= nalloc;
+ (pmapDst->clientPixelsGreen)[client] =
+ (pmapSrc->clientPixelsGreen)[client];
+ (pmapSrc->clientPixelsGreen)[client] = (Pixel *) NULL;
+ (pmapDst->numPixelsGreen)[client] = (pmapSrc->numPixelsGreen)[client];
+ (pmapSrc->numPixelsGreen)[client] = 0;
+ break;
+ case BLUEMAP:
+ pmapDst->freeBlue -= nalloc;
+ pmapDst->clientPixelsBlue[client] = pmapSrc->clientPixelsBlue[client];
+ pmapSrc->clientPixelsBlue[client] = (Pixel *) NULL;
+ pmapDst->numPixelsBlue[client] = pmapSrc->numPixelsBlue[client];
+ pmapSrc->numPixelsBlue[client] = 0;
+ break;
+ }
+}
+
+/* Free the ith entry in a color map. Must handle freeing of
+ * colors allocated through AllocColorPlanes */
+static void
+FreeCell (pmap, i, channel)
+ ColormapPtr pmap;
+ Pixel i;
+ int channel;
+{
+ EntryPtr pent;
+ int *pCount;
+
+
+ switch (channel)
+ {
+ default: /* so compiler can see that everything gets initialized */
+ case PSEUDOMAP:
+ case REDMAP:
+ pent = (EntryPtr) &pmap->red[i];
+ pCount = &pmap->freeRed;
+ break;
+ case GREENMAP:
+ pent = (EntryPtr) &pmap->green[i];
+ pCount = &pmap->freeGreen;
+ break;
+ case BLUEMAP:
+ pent = (EntryPtr) &pmap->blue[i];
+ pCount = &pmap->freeBlue;
+ break;
+ }
+ /* If it's not privately allocated and it's not time to free it, just
+ * decrement the count */
+ if (pent->refcnt > 1)
+ pent->refcnt--;
+ else
+ {
+ /* If the color type is shared, find the sharedcolor. If decremented
+ * refcnt is 0, free the shared cell. */
+ if (pent->fShared)
+ {
+ if(--pent->co.shco.red->refcnt == 0)
+ xfree(pent->co.shco.red);
+ if(--pent->co.shco.green->refcnt == 0)
+ xfree(pent->co.shco.green);
+ if(--pent->co.shco.blue->refcnt == 0)
+ xfree(pent->co.shco.blue);
+ pent->fShared = FALSE;
+ }
+ pent->refcnt = 0;
+ *pCount += 1;
+ }
+}
+
+static void
+UpdateColors (pmap)
+ ColormapPtr pmap;
+{
+ xColorItem *defs;
+ register xColorItem *pdef;
+ register EntryPtr pent;
+ register VisualPtr pVisual;
+ int i, n, size;
+
+ pVisual = pmap->pVisual;
+ size = pVisual->ColormapEntries;
+ defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem));
+ if (!defs)
+ return;
+ n = 0;
+ pdef = defs;
+ if (pmap->class == DirectColor)
+ {
+ for (i = 0; i < size; i++)
+ {
+ if (!pmap->red[i].refcnt &&
+ !pmap->green[i].refcnt &&
+ !pmap->blue[i].refcnt)
+ continue;
+ pdef->pixel = ((Pixel)i << pVisual->offsetRed) |
+ ((Pixel)i << pVisual->offsetGreen) |
+ ((Pixel)i << pVisual->offsetBlue);
+ pdef->red = pmap->red[i].co.local.red;
+ pdef->green = pmap->green[i].co.local.green;
+ pdef->blue = pmap->blue[i].co.local.blue;
+ pdef->flags = DoRed|DoGreen|DoBlue;
+ pdef++;
+ n++;
+ }
+ }
+ else
+ {
+ for (i = 0, pent = pmap->red; i < size; i++, pent++)
+ {
+ if (!pent->refcnt)
+ continue;
+ pdef->pixel = i;
+ if(pent->fShared)
+ {
+ pdef->red = pent->co.shco.red->color;
+ pdef->green = pent->co.shco.green->color;
+ pdef->blue = pent->co.shco.blue->color;
+ }
+ else
+ {
+ pdef->red = pent->co.local.red;
+ pdef->green = pent->co.local.green;
+ pdef->blue = pent->co.local.blue;
+ }
+ pdef->flags = DoRed|DoGreen|DoBlue;
+ pdef++;
+ n++;
+ }
+ }
+ if (n)
+ (*pmap->pScreen->StoreColors)(pmap, n, defs);
+ DEALLOCATE_LOCAL(defs);
+}
+
+/* Get a read-only color from a ColorMap (probably slow for large maps)
+ * Returns by changing the value in pred, pgreen, pblue and pPix
+ */
+int
+AllocColor (pmap, pred, pgreen, pblue, pPix, client)
+ ColormapPtr pmap;
+ unsigned short *pred, *pgreen, *pblue;
+ Pixel *pPix;
+ int client;
+{
+ Pixel pixR, pixG, pixB;
+ int entries;
+ xrgb rgb;
+ int class;
+ VisualPtr pVisual;
+ int npix;
+ Pixel *ppix;
+
+ pVisual = pmap->pVisual;
+ (*pmap->pScreen->ResolveColor) (pred, pgreen, pblue, pVisual);
+ rgb.red = *pred;
+ rgb.green = *pgreen;
+ rgb.blue = *pblue;
+ class = pmap->class;
+ entries = pVisual->ColormapEntries;
+
+ /* If the colormap is being created, then we want to be able to change
+ * the colormap, even if it's a static type. Otherwise, we'd never be
+ * able to initialize static colormaps
+ */
+ if(pmap->flags & BeingCreated)
+ class |= DynamicClass;
+
+ /* If this is one of the static storage classes, and we're not initializing
+ * it, the best we can do is to find the closest color entry to the
+ * requested one and return that.
+ */
+ switch (class) {
+ case StaticColor:
+ case StaticGray:
+ /* Look up all three components in the same pmap */
+ *pPix = pixR = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
+ *pred = pmap->red[pixR].co.local.red;
+ *pgreen = pmap->red[pixR].co.local.green;
+ *pblue = pmap->red[pixR].co.local.blue;
+ npix = pmap->numPixelsRed[client];
+ ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return (BadAlloc);
+ ppix[npix] = pixR;
+ pmap->clientPixelsRed[client] = ppix;
+ pmap->numPixelsRed[client]++;
+ break;
+
+ case TrueColor:
+ /* Look up each component in its own map, then OR them together */
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
+ *pPix = (pixR << pVisual->offsetRed) |
+ (pixG << pVisual->offsetGreen) |
+ (pixB << pVisual->offsetBlue);
+ *pred = pmap->red[pixR].co.local.red;
+ *pgreen = pmap->green[pixG].co.local.green;
+ *pblue = pmap->blue[pixB].co.local.blue;
+ npix = pmap->numPixelsRed[client];
+ ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return (BadAlloc);
+ ppix[npix] = pixR;
+ pmap->clientPixelsRed[client] = ppix;
+ npix = pmap->numPixelsGreen[client];
+ ppix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return (BadAlloc);
+ ppix[npix] = pixG;
+ pmap->clientPixelsGreen[client] = ppix;
+ npix = pmap->numPixelsBlue[client];
+ ppix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client],
+ (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ return (BadAlloc);
+ ppix[npix] = pixB;
+ pmap->clientPixelsBlue[client] = ppix;
+ pmap->numPixelsRed[client]++;
+ pmap->numPixelsGreen[client]++;
+ pmap->numPixelsBlue[client]++;
+ break;
+
+ case GrayScale:
+ case PseudoColor:
+ if (pmap->mid != pmap->pScreen->defColormap &&
+ pmap->pVisual->vid == pmap->pScreen->rootVisual)
+ {
+ ColormapPtr prootmap = (ColormapPtr)
+ SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
+ RT_COLORMAP, SecurityReadAccess);
+
+ if (pmap->class == prootmap->class)
+ FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
+ pPix, PSEUDOMAP, AllComp);
+ }
+ if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP,
+ client, AllComp) != Success)
+ return (BadAlloc);
+ break;
+
+ case DirectColor:
+ if (pmap->mid != pmap->pScreen->defColormap &&
+ pmap->pVisual->vid == pmap->pScreen->rootVisual)
+ {
+ ColormapPtr prootmap = (ColormapPtr)
+ SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
+ RT_COLORMAP, SecurityReadAccess);
+
+ if (pmap->class == prootmap->class)
+ {
+ pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
+ FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
+ &pixR, REDMAP, RedComp);
+ pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
+ FindColorInRootCmap (prootmap, prootmap->green, entries, &rgb,
+ &pixG, GREENMAP, GreenComp);
+ pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
+ FindColorInRootCmap (prootmap, prootmap->blue, entries, &rgb,
+ &pixB, BLUEMAP, BlueComp);
+ *pPix = pixR | pixG | pixB;
+ }
+ }
+
+ pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed;
+ if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
+ client, RedComp) != Success)
+ return (BadAlloc);
+ pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
+ GREENMAP, client, GreenComp) != Success)
+ {
+ (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0);
+ return (BadAlloc);
+ }
+ pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
+ client, BlueComp) != Success)
+ {
+ (void)FreeCo(pmap, client, GREENMAP, 1, &pixG, (Pixel)0);
+ (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0);
+ return (BadAlloc);
+ }
+ *pPix = pixR | pixG | pixB;
+ break;
+ }
+
+ /* if this is the client's first pixel in this colormap, tell the
+ * resource manager that the client has pixels in this colormap which
+ * should be freed when the client dies */
+ if ((pmap->numPixelsRed[client] == 1) &&
+ (CLIENT_ID(pmap->mid) != client) &&
+ !(pmap->flags & BeingCreated))
+ {
+ colorResource *pcr;
+
+ pcr = (colorResource *) xalloc(sizeof(colorResource));
+ if (!pcr)
+ {
+ (void)FreeColors(pmap, client, 1, pPix, (Pixel)0);
+ return (BadAlloc);
+ }
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
+ return (BadAlloc);
+ }
+ return (Success);
+}
+
+/*
+ * FakeAllocColor -- fake an AllocColor request by
+ * returning a free pixel if availible, otherwise returning
+ * the closest matching pixel. This is used by the mi
+ * software sprite code to recolor cursors. A nice side-effect
+ * is that this routine will never return failure.
+ */
+
+void
+FakeAllocColor (pmap, item)
+ register ColormapPtr pmap;
+ register xColorItem *item;
+{
+ Pixel pixR, pixG, pixB;
+ Pixel temp;
+ int entries;
+ xrgb rgb;
+ int class;
+ register VisualPtr pVisual;
+
+ pVisual = pmap->pVisual;
+ rgb.red = item->red;
+ rgb.green = item->green;
+ rgb.blue = item->blue;
+ (*pmap->pScreen->ResolveColor) (&rgb.red, &rgb.green, &rgb.blue, pVisual);
+ class = pmap->class;
+ entries = pVisual->ColormapEntries;
+
+ switch (class) {
+ case GrayScale:
+ case PseudoColor:
+ item->pixel = 0;
+ if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP,
+ -1, AllComp) == Success) {
+ item->pixel = temp;
+ break;
+ }
+ /* fall through ... */
+ case StaticColor:
+ case StaticGray:
+ item->pixel = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP);
+ break;
+
+ case DirectColor:
+ /* Look up each component in its own map, then OR them together */
+ pixR = (item->pixel & pVisual->redMask) >> pVisual->offsetRed;
+ pixG = (item->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ pixB = (item->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP,
+ -1, RedComp) != Success)
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP)
+ << pVisual->offsetRed;
+ if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG,
+ GREENMAP, -1, GreenComp) != Success)
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb,
+ GREENMAP) << pVisual->offsetGreen;
+ if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP,
+ -1, BlueComp) != Success)
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP)
+ << pVisual->offsetBlue;
+ item->pixel = pixR | pixG | pixB;
+ break;
+
+ case TrueColor:
+ /* Look up each component in its own map, then OR them together */
+ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP);
+ pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP);
+ pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
+ item->pixel = (pixR << pVisual->offsetRed) |
+ (pixG << pVisual->offsetGreen) |
+ (pixB << pVisual->offsetBlue);
+ break;
+ }
+}
+
+/* free a pixel value obtained from FakeAllocColor */
+void
+FakeFreeColor(pmap, pixel)
+ register ColormapPtr pmap;
+ Pixel pixel;
+{
+ register VisualPtr pVisual;
+ Pixel pixR, pixG, pixB;
+
+ switch (pmap->class) {
+ case GrayScale:
+ case PseudoColor:
+ if (pmap->red[pixel].refcnt == AllocTemporary)
+ pmap->red[pixel].refcnt = 0;
+ break;
+ case DirectColor:
+ pVisual = pmap->pVisual;
+ pixR = (pixel & pVisual->redMask) >> pVisual->offsetRed;
+ pixG = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ pixB = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (pmap->red[pixR].refcnt == AllocTemporary)
+ pmap->red[pixR].refcnt = 0;
+ if (pmap->green[pixG].refcnt == AllocTemporary)
+ pmap->green[pixG].refcnt = 0;
+ if (pmap->blue[pixB].refcnt == AllocTemporary)
+ pmap->blue[pixB].refcnt = 0;
+ break;
+ }
+}
+
+typedef unsigned short BigNumUpper;
+typedef unsigned long BigNumLower;
+
+#define BIGNUMLOWERBITS 24
+#define BIGNUMUPPERBITS 16
+#define BIGNUMLOWER (1 << BIGNUMLOWERBITS)
+#define BIGNUMUPPER (1 << BIGNUMUPPERBITS)
+#define UPPERPART(i) ((i) >> BIGNUMLOWERBITS)
+#define LOWERPART(i) ((i) & (BIGNUMLOWER - 1))
+
+typedef struct _bignum {
+ BigNumUpper upper;
+ BigNumLower lower;
+} BigNumRec, *BigNumPtr;
+
+#define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\
+ ((x)->upper == (y)->upper && (x)->lower > (y)->lower))
+
+#define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \
+ ((r)->lower = LOWERPART(u)))
+
+#define MaxBigNum(r) (((r)->upper = BIGNUMUPPER-1), \
+ ((r)->lower = BIGNUMLOWER-1))
+
+static void
+#if NeedFunctionPrototypes
+BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r)
+#else
+BigNumAdd (x, y, r)
+ BigNumPtr x, y, r;
+#endif
+{
+ BigNumLower lower, carry = 0;
+
+ lower = x->lower + y->lower;
+ if (lower >= BIGNUMLOWER) {
+ lower -= BIGNUMLOWER;
+ carry = 1;
+ }
+ r->lower = lower;
+ r->upper = x->upper + y->upper + carry;
+}
+
+static Pixel
+FindBestPixel(pentFirst, size, prgb, channel)
+ EntryPtr pentFirst;
+ int size;
+ xrgb *prgb;
+ int channel;
+{
+ EntryPtr pent;
+ Pixel pixel, final;
+ long dr, dg, db;
+ unsigned long sq;
+ BigNumRec minval, sum, temp;
+
+ final = 0;
+ MaxBigNum(&minval);
+ /* look for the minimal difference */
+ for (pent = pentFirst, pixel = 0; pixel < size; pent++, pixel++)
+ {
+ dr = dg = db = 0;
+ switch(channel)
+ {
+ case PSEUDOMAP:
+ dg = (long) pent->co.local.green - prgb->green;
+ db = (long) pent->co.local.blue - prgb->blue;
+ case REDMAP:
+ dr = (long) pent->co.local.red - prgb->red;
+ break;
+ case GREENMAP:
+ dg = (long) pent->co.local.green - prgb->green;
+ break;
+ case BLUEMAP:
+ db = (long) pent->co.local.blue - prgb->blue;
+ break;
+ }
+ sq = dr * dr;
+ UnsignedToBigNum (sq, &sum);
+ sq = dg * dg;
+ UnsignedToBigNum (sq, &temp);
+ BigNumAdd (&sum, &temp, &sum);
+ sq = db * db;
+ UnsignedToBigNum (sq, &temp);
+ BigNumAdd (&sum, &temp, &sum);
+ if (BigNumGreater (&minval, &sum))
+ {
+ final = pixel;
+ minval = sum;
+ }
+ }
+ return(final);
+}
+
+static void
+FindColorInRootCmap (pmap, pentFirst, size, prgb, pPixel, channel, comp)
+ ColormapPtr pmap;
+ EntryPtr pentFirst;
+ int size;
+ xrgb* prgb;
+ Pixel* pPixel;
+ int channel;
+ ColorCompareProcPtr comp;
+{
+ EntryPtr pent;
+ Pixel pixel;
+ int count;
+
+ if ((pixel = *pPixel) >= size)
+ pixel = 0;
+ for (pent = pentFirst + pixel, count = size; --count >= 0; pent++, pixel++)
+ {
+ if (pent->refcnt > 0 && (*comp) (pent, prgb))
+ {
+ switch (channel)
+ {
+ case REDMAP:
+ pixel <<= pmap->pVisual->offsetRed;
+ break;
+ case GREENMAP:
+ pixel <<= pmap->pVisual->offsetGreen;
+ break;
+ case BLUEMAP:
+ pixel <<= pmap->pVisual->offsetBlue;
+ break;
+ default: /* PSEUDOMAP */
+ break;
+ }
+ *pPixel = pixel;
+ }
+ }
+}
+
+/* Tries to find a color in pmap that exactly matches the one requested in prgb
+ * if it can't it allocates one.
+ * Starts looking at pentFirst + *pPixel, so if you want a specific pixel,
+ * load *pPixel with that value, otherwise set it to 0
+ */
+int
+FindColor (pmap, pentFirst, size, prgb, pPixel, channel, client, comp)
+ ColormapPtr pmap;
+ EntryPtr pentFirst;
+ int size;
+ xrgb *prgb;
+ Pixel *pPixel;
+ int channel;
+ int client;
+ ColorCompareProcPtr comp;
+{
+ EntryPtr pent;
+ Bool foundFree;
+ Pixel pixel, Free;
+ int npix, count, *nump;
+ Pixel **pixp, *ppix;
+ xColorItem def;
+
+ foundFree = FALSE;
+
+ if((pixel = *pPixel) >= size)
+ pixel = 0;
+ /* see if there is a match, and also look for a free entry */
+ for (pent = pentFirst + pixel, count = size; --count >= 0; )
+ {
+ if (pent->refcnt > 0)
+ {
+ if ((*comp) (pent, prgb))
+ {
+ if (client >= 0)
+ pent->refcnt++;
+ *pPixel = pixel;
+ switch(channel)
+ {
+ case REDMAP:
+ *pPixel <<= pmap->pVisual->offsetRed;
+ case PSEUDOMAP:
+ break;
+ case GREENMAP:
+ *pPixel <<= pmap->pVisual->offsetGreen;
+ break;
+ case BLUEMAP:
+ *pPixel <<= pmap->pVisual->offsetBlue;
+ break;
+ }
+ goto gotit;
+ }
+ }
+ else if (!foundFree && pent->refcnt == 0)
+ {
+ Free = pixel;
+ foundFree = TRUE;
+ /* If we're initializing the colormap, then we are looking for
+ * the first free cell we can find, not to minimize the number
+ * of entries we use. So don't look any further. */
+ if(pmap->flags & BeingCreated)
+ break;
+ }
+ pixel++;
+ if(pixel >= size)
+ {
+ pent = pentFirst;
+ pixel = 0;
+ }
+ else
+ pent++;
+ }
+
+ /* If we got here, we didn't find a match. If we also didn't find
+ * a free entry, we're out of luck. Otherwise, we'll usurp a free
+ * entry and fill it in */
+ if (!foundFree)
+ return (BadAlloc);
+ pent = pentFirst + Free;
+ pent->fShared = FALSE;
+ pent->refcnt = (client >= 0) ? 1 : AllocTemporary;
+
+ switch (channel)
+ {
+ case PSEUDOMAP:
+ pent->co.local.red = prgb->red;
+ pent->co.local.green = prgb->green;
+ pent->co.local.blue = prgb->blue;
+ def.red = prgb->red;
+ def.green = prgb->green;
+ def.blue = prgb->blue;
+ def.flags = (DoRed|DoGreen|DoBlue);
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free;
+ break;
+
+ case REDMAP:
+ pent->co.local.red = prgb->red;
+ def.red = prgb->red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoRed;
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free << pmap->pVisual->offsetRed;
+ break;
+
+ case GREENMAP:
+ pent->co.local.green = prgb->green;
+ def.red = pmap->red[0].co.local.red;
+ def.green = prgb->green;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoGreen;
+ if (client >= 0)
+ pmap->freeGreen--;
+ def.pixel = Free << pmap->pVisual->offsetGreen;
+ break;
+
+ case BLUEMAP:
+ pent->co.local.blue = prgb->blue;
+ def.red = pmap->red[0].co.local.red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = prgb->blue;
+ def.flags = DoBlue;
+ if (client >= 0)
+ pmap->freeBlue--;
+ def.pixel = Free << pmap->pVisual->offsetBlue;
+ break;
+ }
+ (*pmap->pScreen->StoreColors) (pmap, 1, &def);
+ pixel = Free;
+ *pPixel = def.pixel;
+
+gotit:
+ if (pmap->flags & BeingCreated || client == -1)
+ return(Success);
+ /* Now remember the pixel, for freeing later */
+ switch (channel)
+ {
+ case PSEUDOMAP:
+ case REDMAP:
+ nump = pmap->numPixelsRed;
+ pixp = pmap->clientPixelsRed;
+ break;
+
+ case GREENMAP:
+ nump = pmap->numPixelsGreen;
+ pixp = pmap->clientPixelsGreen;
+ break;
+
+ case BLUEMAP:
+ nump = pmap->numPixelsBlue;
+ pixp = pmap->clientPixelsBlue;
+ break;
+ }
+ npix = nump[client];
+ ppix = (Pixel *) xrealloc (pixp[client], (npix + 1) * sizeof(Pixel));
+ if (!ppix)
+ {
+ pent->refcnt--;
+ if (!pent->fShared)
+ switch (channel)
+ {
+ case PSEUDOMAP:
+ case REDMAP:
+ pmap->freeRed++;
+ break;
+ case GREENMAP:
+ pmap->freeGreen++;
+ break;
+ case BLUEMAP:
+ pmap->freeBlue++;
+ break;
+ }
+ return(BadAlloc);
+ }
+ ppix[npix] = pixel;
+ pixp[client] = ppix;
+ nump[client]++;
+
+ return(Success);
+}
+
+/* Comparison functions -- passed to FindColor to determine if an
+ * entry is already the color we're looking for or not */
+static int
+AllComp (pent, prgb)
+ EntryPtr pent;
+ xrgb *prgb;
+{
+ if((pent->co.local.red == prgb->red) &&
+ (pent->co.local.green == prgb->green) &&
+ (pent->co.local.blue == prgb->blue) )
+ return (1);
+ return (0);
+}
+
+static int
+RedComp (pent, prgb)
+ EntryPtr pent;
+ xrgb *prgb;
+{
+ if (pent->co.local.red == prgb->red)
+ return (1);
+ return (0);
+}
+
+static int
+GreenComp (pent, prgb)
+ EntryPtr pent;
+ xrgb *prgb;
+{
+ if (pent->co.local.green == prgb->green)
+ return (1);
+ return (0);
+}
+
+static int
+BlueComp (pent, prgb)
+ EntryPtr pent;
+ xrgb *prgb;
+{
+ if (pent->co.local.blue == prgb->blue)
+ return (1);
+ return (0);
+}
+
+
+/* Read the color value of a cell */
+
+int
+QueryColors (pmap, count, ppixIn, prgbList)
+ ColormapPtr pmap;
+ int count;
+ Pixel *ppixIn;
+ xrgb *prgbList;
+{
+ Pixel *ppix, pixel;
+ xrgb *prgb;
+ VisualPtr pVisual;
+ EntryPtr pent;
+ Pixel i;
+ int errVal = Success;
+
+ pVisual = pmap->pVisual;
+ if ((pmap->class | DynamicClass) == DirectColor)
+ {
+ int numred, numgreen, numblue;
+ Pixel rgbbad;
+
+ numred = NUMRED(pVisual);
+ numgreen = NUMGREEN(pVisual);
+ numblue = NUMBLUE(pVisual);
+ rgbbad = ~RGBMASK(pVisual);
+ for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++)
+ {
+ pixel = *ppix;
+ if (pixel & rgbbad) {
+ clientErrorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ i = (pixel & pVisual->redMask) >> pVisual->offsetRed;
+ if (i >= numred)
+ {
+ clientErrorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->red = pmap->red[i].co.local.red;
+ i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (i >= numgreen)
+ {
+ clientErrorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->green = pmap->green[i].co.local.green;
+ i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (i >= numblue)
+ {
+ clientErrorValue = pixel;
+ errVal = BadValue;
+ continue;
+ }
+ prgb->blue = pmap->blue[i].co.local.blue;
+ }
+ }
+ else
+ {
+ for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++)
+ {
+ pixel = *ppix;
+ if (pixel >= pVisual->ColormapEntries)
+ {
+ clientErrorValue = pixel;
+ errVal = BadValue;
+ }
+ else
+ {
+ pent = (EntryPtr)&pmap->red[pixel];
+ if (pent->fShared)
+ {
+ prgb->red = pent->co.shco.red->color;
+ prgb->green = pent->co.shco.green->color;
+ prgb->blue = pent->co.shco.blue->color;
+ }
+ else
+ {
+ prgb->red = pent->co.local.red;
+ prgb->green = pent->co.local.green;
+ prgb->blue = pent->co.local.blue;
+ }
+ }
+ }
+ }
+ return (errVal);
+}
+
+static void
+FreePixels(pmap, client)
+ register ColormapPtr pmap;
+ register int client;
+{
+ register Pixel *ppix, *ppixStart;
+ register int n;
+ int class;
+#ifdef LBX
+ Bool grabbed;
+ Bool zeroRefCount;
+ Bool anyRefCountReachedZero = 0;
+#endif
+
+ class = pmap->class;
+ ppixStart = pmap->clientPixelsRed[client];
+ if (class & DynamicClass)
+ {
+ n = pmap->numPixelsRed[client];
+#ifdef LBX
+ grabbed = LbxCheckCmapGrabbed (pmap);
+ if (grabbed)
+ {
+ /*
+ * If the colormap is grabbed by a proxy, the server must
+ * notify the proxy of all cells that are freed (the refcount
+ * has reached zero on these cells).
+ */
+
+ LbxBeginFreeCellsEvent (pmap);
+ LbxSortPixelList (ppixStart, n);
+ }
+#endif
+ for (ppix = ppixStart; --n >= 0; )
+ {
+ FreeCell(pmap, *ppix, REDMAP);
+#ifdef LBX
+ /*
+ * Only PSEUDO colormaps are grabbed by LBX proxies.
+ * Check if the ref count reached zero on this pixel.
+ */
+
+ zeroRefCount = pmap->red[*ppix].refcnt == 0;
+ if (zeroRefCount)
+ anyRefCountReachedZero = 1;
+
+ if (grabbed && zeroRefCount)
+ LbxAddFreeCellToEvent (pmap, *ppix);
+#endif
+ ppix++;
+ }
+#ifdef LBX
+ if (grabbed)
+ LbxEndFreeCellsEvent (pmap);
+ else if (anyRefCountReachedZero)
+ {
+ /*
+ * We only send LbxFreeCell events to a proxy that has the colormap
+ * grabbed. If the colormap is not grabbed, the proxy that last
+ * had the colormap grabbed will not be able to do a smart grab
+ * in the future. A smart grab can only occur if the proxy is kept
+ * up to date on every alloc/free change in the colormap.
+ */
+
+ LbxDisableSmartGrab (pmap);
+ }
+#endif
+ }
+
+ xfree(ppixStart);
+ pmap->clientPixelsRed[client] = (Pixel *) NULL;
+ pmap->numPixelsRed[client] = 0;
+ if ((class | DynamicClass) == DirectColor)
+ {
+ ppixStart = pmap->clientPixelsGreen[client];
+ if (class & DynamicClass)
+ for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;)
+ FreeCell(pmap, *ppix++, GREENMAP);
+ xfree(ppixStart);
+ pmap->clientPixelsGreen[client] = (Pixel *) NULL;
+ pmap->numPixelsGreen[client] = 0;
+
+ ppixStart = pmap->clientPixelsBlue[client];
+ if (class & DynamicClass)
+ for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; )
+ FreeCell(pmap, *ppix++, BLUEMAP);
+ xfree(ppixStart);
+ pmap->clientPixelsBlue[client] = (Pixel *) NULL;
+ pmap->numPixelsBlue[client] = 0;
+ }
+}
+
+/* Free all of a client's colors and cells */
+/*ARGSUSED*/
+int
+FreeClientPixels (value, fakeid)
+ pointer value; /* must conform to DeleteType */
+ XID fakeid;
+{
+ ColormapPtr pmap;
+ colorResource *pcr = (colorResource *)value;
+
+ pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP);
+ if (pmap)
+ FreePixels(pmap, pcr->client);
+ xfree(pcr);
+ return Success;
+}
+
+int
+AllocColorCells (client, pmap, colors, planes, contig, ppix, masks)
+ int client;
+ ColormapPtr pmap;
+ int colors, planes;
+ Bool contig;
+ Pixel *ppix;
+ Pixel *masks;
+{
+ Pixel rmask, gmask, bmask, *ppixFirst, r, g, b;
+ int n, class;
+ int ok;
+ int oldcount;
+ colorResource *pcr = (colorResource *)NULL;
+
+ class = pmap->class;
+ if (!(class & DynamicClass))
+ return (BadAlloc); /* Shouldn't try on this type */
+ oldcount = pmap->numPixelsRed[client];
+ if (pmap->class == DirectColor)
+ oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
+ if (!oldcount && (CLIENT_ID(pmap->mid) != client))
+ {
+ pcr = (colorResource *) xalloc(sizeof(colorResource));
+ if (!pcr)
+ return (BadAlloc);
+ }
+
+ if (pmap->class == DirectColor)
+ {
+ ok = AllocDirect (client, pmap, colors, planes, planes, planes,
+ contig, ppix, &rmask, &gmask, &bmask);
+ if(ok == Success)
+ {
+ for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b)
+ {
+ while(!(rmask & r))
+ r += r;
+ while(!(gmask & g))
+ g += g;
+ while(!(bmask & b))
+ b += b;
+ *masks++ = r | g | b;
+ }
+ }
+ }
+ else
+ {
+ ok = AllocPseudo (client, pmap, colors, planes, contig, ppix, &rmask,
+ &ppixFirst);
+ if(ok == Success)
+ {
+ for (r = 1, n = planes; --n >= 0; r += r)
+ {
+ while(!(rmask & r))
+ r += r;
+ *masks++ = r;
+ }
+ }
+ }
+
+ /* if this is the client's first pixels in this colormap, tell the
+ * resource manager that the client has pixels in this colormap which
+ * should be freed when the client dies */
+ if ((ok == Success) && pcr)
+ {
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
+ ok = BadAlloc;
+ } else if (pcr)
+ xfree(pcr);
+
+ return (ok);
+}
+
+
+int
+AllocColorPlanes (client, pmap, colors, r, g, b, contig, pixels,
+ prmask, pgmask, pbmask)
+ int client;
+ ColormapPtr pmap;
+ int colors, r, g, b;
+ Bool contig;
+ Pixel *pixels;
+ Pixel *prmask, *pgmask, *pbmask;
+{
+ int ok;
+ Pixel mask, *ppixFirst;
+ register Pixel shift;
+ register int i;
+ int class;
+ int oldcount;
+ colorResource *pcr = (colorResource *)NULL;
+
+ class = pmap->class;
+ if (!(class & DynamicClass))
+ return (BadAlloc); /* Shouldn't try on this type */
+ oldcount = pmap->numPixelsRed[client];
+ if (class == DirectColor)
+ oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
+ if (!oldcount && (CLIENT_ID(pmap->mid) != client))
+ {
+ pcr = (colorResource *) xalloc(sizeof(colorResource));
+ if (!pcr)
+ return (BadAlloc);
+ }
+
+ if (class == DirectColor)
+ {
+ ok = AllocDirect (client, pmap, colors, r, g, b, contig, pixels,
+ prmask, pgmask, pbmask);
+ }
+ else
+ {
+ /* Allocate the proper pixels */
+ /* XXX This is sort of bad, because of contig is set, we force all
+ * r + g + b bits to be contiguous. Should only force contiguity
+ * per mask
+ */
+ ok = AllocPseudo (client, pmap, colors, r + g + b, contig, pixels,
+ &mask, &ppixFirst);
+
+ if(ok == Success)
+ {
+ /* now split that mask into three */
+ *prmask = *pgmask = *pbmask = 0;
+ shift = 1;
+ for (i = r; --i >= 0; shift += shift)
+ {
+ while (!(mask & shift))
+ shift += shift;
+ *prmask |= shift;
+ }
+ for (i = g; --i >= 0; shift += shift)
+ {
+ while (!(mask & shift))
+ shift += shift;
+ *pgmask |= shift;
+ }
+ for (i = b; --i >= 0; shift += shift)
+ {
+ while (!(mask & shift))
+ shift += shift;
+ *pbmask |= shift;
+ }
+
+ /* set up the shared color cells */
+ if (!AllocShared(pmap, pixels, colors, r, g, b,
+ *prmask, *pgmask, *pbmask, ppixFirst))
+ {
+ (void)FreeColors(pmap, client, colors, pixels, mask);
+ ok = BadAlloc;
+ }
+ }
+ }
+
+ /* if this is the client's first pixels in this colormap, tell the
+ * resource manager that the client has pixels in this colormap which
+ * should be freed when the client dies */
+ if ((ok == Success) && pcr)
+ {
+ pcr->mid = pmap->mid;
+ pcr->client = client;
+ if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
+ ok = BadAlloc;
+ } else if (pcr)
+ xfree(pcr);
+
+ return (ok);
+}
+
+static int
+AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask)
+ int client;
+ ColormapPtr pmap;
+ int c, r, g, b;
+ Bool contig;
+ Pixel *pixels;
+ Pixel *prmask, *pgmask, *pbmask;
+{
+ Pixel *ppixRed, *ppixGreen, *ppixBlue;
+ Pixel *ppix, *pDst, *p;
+ int npix, npixR, npixG, npixB;
+ Bool okR, okG, okB;
+ Pixel *rpix = 0, *gpix = 0, *bpix = 0;
+
+ npixR = c << r;
+ npixG = c << g;
+ npixB = c << b;
+ if ((r >= 32) || (g >= 32) || (b >= 32) ||
+ (npixR > pmap->freeRed) || (npixR < c) ||
+ (npixG > pmap->freeGreen) || (npixG < c) ||
+ (npixB > pmap->freeBlue) || (npixB < c))
+ return BadAlloc;
+
+ /* start out with empty pixels */
+ for(p = pixels; p < pixels + c; p++)
+ *p = 0;
+
+ ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel));
+ ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel));
+ ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel));
+ if (!ppixRed || !ppixGreen || !ppixBlue)
+ {
+ if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue);
+ if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen);
+ if (ppixRed) DEALLOCATE_LOCAL(ppixRed);
+ return(BadAlloc);
+ }
+
+ okR = AllocCP(pmap, pmap->red, c, r, contig, ppixRed, prmask);
+ okG = AllocCP(pmap, pmap->green, c, g, contig, ppixGreen, pgmask);
+ okB = AllocCP(pmap, pmap->blue, c, b, contig, ppixBlue, pbmask);
+
+ if (okR && okG && okB)
+ {
+ rpix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+ (pmap->numPixelsRed[client] + (c << r)) *
+ sizeof(Pixel));
+ if (rpix)
+ pmap->clientPixelsRed[client] = rpix;
+ gpix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client],
+ (pmap->numPixelsGreen[client] + (c << g)) *
+ sizeof(Pixel));
+ if (gpix)
+ pmap->clientPixelsGreen[client] = gpix;
+ bpix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client],
+ (pmap->numPixelsBlue[client] + (c << b)) *
+ sizeof(Pixel));
+ if (bpix)
+ pmap->clientPixelsBlue[client] = bpix;
+ }
+
+ if (!okR || !okG || !okB || !rpix || !gpix || !bpix)
+ {
+ if (okR)
+ for(ppix = ppixRed, npix = npixR; --npix >= 0; ppix++)
+ pmap->red[*ppix].refcnt = 0;
+ if (okG)
+ for(ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++)
+ pmap->green[*ppix].refcnt = 0;
+ if (okB)
+ for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
+ pmap->blue[*ppix].refcnt = 0;
+ DEALLOCATE_LOCAL(ppixBlue);
+ DEALLOCATE_LOCAL(ppixGreen);
+ DEALLOCATE_LOCAL(ppixRed);
+ return(BadAlloc);
+ }
+
+ *prmask <<= pmap->pVisual->offsetRed;
+ *pgmask <<= pmap->pVisual->offsetGreen;
+ *pbmask <<= pmap->pVisual->offsetBlue;
+
+ ppix = rpix + pmap->numPixelsRed[client];
+ for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++)
+ {
+ *ppix++ = *p;
+ if(p < ppixRed + c)
+ *pDst++ |= *p << pmap->pVisual->offsetRed;
+ }
+ pmap->numPixelsRed[client] += npixR;
+ pmap->freeRed -= npixR;
+
+ ppix = gpix + pmap->numPixelsGreen[client];
+ for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++)
+ {
+ *ppix++ = *p;
+ if(p < ppixGreen + c)
+ *pDst++ |= *p << pmap->pVisual->offsetGreen;
+ }
+ pmap->numPixelsGreen[client] += npixG;
+ pmap->freeGreen -= npixG;
+
+ ppix = bpix + pmap->numPixelsBlue[client];
+ for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++)
+ {
+ *ppix++ = *p;
+ if(p < ppixBlue + c)
+ *pDst++ |= *p << pmap->pVisual->offsetBlue;
+ }
+ pmap->numPixelsBlue[client] += npixB;
+ pmap->freeBlue -= npixB;
+
+ DEALLOCATE_LOCAL(ppixBlue);
+ DEALLOCATE_LOCAL(ppixGreen);
+ DEALLOCATE_LOCAL(ppixRed);
+
+ return (Success);
+}
+
+static int
+AllocPseudo (client, pmap, c, r, contig, pixels, pmask, pppixFirst)
+ int client;
+ ColormapPtr pmap;
+ int c, r;
+ Bool contig;
+ Pixel *pixels;
+ Pixel *pmask;
+ Pixel **pppixFirst;
+{
+ Pixel *ppix, *p, *pDst, *ppixTemp;
+ int npix;
+ Bool ok;
+
+ npix = c << r;
+ if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
+ return(BadAlloc);
+ if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel))))
+ return(BadAlloc);
+ ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
+
+ if (ok)
+ {
+
+ /* all the allocated pixels are added to the client pixel list,
+ * but only the unique ones are returned to the client */
+ ppix = (Pixel *)xrealloc(pmap->clientPixelsRed[client],
+ (pmap->numPixelsRed[client] + npix) * sizeof(Pixel));
+ if (!ppix)
+ {
+ for (p = ppixTemp; p < ppixTemp + npix; p++)
+ pmap->red[*p].refcnt = 0;
+ return (BadAlloc);
+ }
+ pmap->clientPixelsRed[client] = ppix;
+ ppix += pmap->numPixelsRed[client];
+ *pppixFirst = ppix;
+ pDst = pixels;
+ for (p = ppixTemp; p < ppixTemp + npix; p++)
+ {
+ *ppix++ = *p;
+ if(p < ppixTemp + c)
+ *pDst++ = *p;
+ }
+ pmap->numPixelsRed[client] += npix;
+ pmap->freeRed -= npix;
+ }
+ DEALLOCATE_LOCAL(ppixTemp);
+ return (ok ? Success : BadAlloc);
+}
+
+/* Allocates count << planes pixels from colormap pmap for client. If
+ * contig, then the plane mask is made of consecutive bits. Returns
+ * all count << pixels in the array pixels. The first count of those
+ * pixels are the unique pixels. *pMask has the mask to Or with the
+ * unique pixels to get the rest of them.
+ *
+ * Returns True iff all pixels could be allocated
+ * All cells allocated will have refcnt set to AllocPrivate and shared to FALSE
+ * (see AllocShared for why we care)
+ */
+static Bool
+AllocCP (pmap, pentFirst, count, planes, contig, pixels, pMask)
+ ColormapPtr pmap;
+ EntryPtr pentFirst;
+ int count, planes;
+ Bool contig;
+ Pixel *pixels, *pMask;
+
+{
+ EntryPtr ent;
+ Pixel pixel, base, entries, maxp, save;
+ int dplanes, found;
+ Pixel *ppix;
+ Pixel mask;
+ Pixel finalmask;
+
+ dplanes = pmap->pVisual->nplanes;
+
+ /* Easy case. Allocate pixels only */
+ if (planes == 0)
+ {
+ /* allocate writable entries */
+ ppix = pixels;
+ ent = pentFirst;
+ pixel = 0;
+ while (--count >= 0)
+ {
+ /* Just find count unallocated cells */
+ while (ent->refcnt)
+ {
+ ent++;
+ pixel++;
+ }
+ ent->refcnt = AllocPrivate;
+ *ppix++ = pixel;
+ ent->fShared = FALSE;
+ }
+ *pMask = 0;
+ return (TRUE);
+ }
+ else if (planes > dplanes)
+ {
+ return (FALSE);
+ }
+
+ /* General case count pixels * 2 ^ planes cells to be allocated */
+
+ /* make room for new pixels */
+ ent = pentFirst;
+
+ /* first try for contiguous planes, since it's fastest */
+ for (mask = (((Pixel)1) << planes) - 1, base = 1, dplanes -= (planes - 1);
+ --dplanes >= 0;
+ mask += mask, base += base)
+ {
+ ppix = pixels;
+ found = 0;
+ pixel = 0;
+ entries = pmap->pVisual->ColormapEntries - mask;
+ while (pixel < entries)
+ {
+ save = pixel;
+ maxp = pixel + mask + base;
+ /* check if all are free */
+ while (pixel != maxp && ent[pixel].refcnt == 0)
+ pixel += base;
+ if (pixel == maxp)
+ {
+ /* this one works */
+ *ppix++ = save;
+ found++;
+ if (found == count)
+ {
+ /* found enough, allocate them all */
+ while (--count >= 0)
+ {
+ pixel = pixels[count];
+ maxp = pixel + mask;
+ while (1)
+ {
+ ent[pixel].refcnt = AllocPrivate;
+ ent[pixel].fShared = FALSE;
+ if (pixel == maxp)
+ break;
+ pixel += base;
+ *ppix++ = pixel;
+ }
+ }
+ *pMask = mask;
+ return (TRUE);
+ }
+ }
+ pixel = save + 1;
+ if (pixel & mask)
+ pixel += mask;
+ }
+ }
+
+ dplanes = pmap->pVisual->nplanes;
+ if (contig || planes == 1 || dplanes < 3)
+ return (FALSE);
+
+ /* this will be very slow for large maps, need a better algorithm */
+
+ /*
+ we can generate the smallest and largest numbers that fits in dplanes
+ bits and contain exactly planes bits set as follows. First, we need to
+ check that it is possible to generate such a mask at all.
+ (Non-contiguous masks need one more bit than contiguous masks). Then
+ the smallest such mask consists of the rightmost planes-1 bits set, then
+ a zero, then a one in position planes + 1. The formula is
+ (3 << (planes-1)) -1
+ The largest such masks consists of the leftmost planes-1 bits set, then
+ a zero, then a one bit in position dplanes-planes-1. If dplanes is
+ smaller than 32 (the number of bits in a word) then the formula is:
+ (1<<dplanes) - (1<<(dplanes-planes+1) + (1<<dplanes-planes-1)
+ If dplanes = 32, then we can't calculate (1<<dplanes) and we have
+ to use:
+ ( (1<<(planes-1)) - 1) << (dplanes-planes+1) + (1<<(dplanes-planes-1))
+
+ << Thank you, Loretta>>>
+
+ */
+
+ finalmask =
+ (((((Pixel)1)<<(planes-1)) - 1) << (dplanes-planes+1)) +
+ (((Pixel)1)<<(dplanes-planes-1));
+ for (mask = (((Pixel)3) << (planes -1)) - 1; mask <= finalmask; mask++)
+ {
+ /* next 3 magic statements count number of ones (HAKMEM #169) */
+ pixel = (mask >> 1) & 033333333333;
+ pixel = mask - pixel - ((pixel >> 1) & 033333333333);
+ if ((((pixel + (pixel >> 3)) & 030707070707) % 077) != planes)
+ continue;
+ ppix = pixels;
+ found = 0;
+ entries = pmap->pVisual->ColormapEntries - mask;
+ base = lowbit (mask);
+ for (pixel = 0; pixel < entries; pixel++)
+ {
+ if (pixel & mask)
+ continue;
+ maxp = 0;
+ /* check if all are free */
+ while (ent[pixel + maxp].refcnt == 0)
+ {
+ GetNextBitsOrBreak(maxp, mask, base);
+ }
+ if ((maxp < mask) || (ent[pixel + mask].refcnt != 0))
+ continue;
+ /* this one works */
+ *ppix++ = pixel;
+ found++;
+ if (found < count)
+ continue;
+ /* found enough, allocate them all */
+ while (--count >= 0)
+ {
+ pixel = (pixels)[count];
+ maxp = 0;
+ while (1)
+ {
+ ent[pixel + maxp].refcnt = AllocPrivate;
+ ent[pixel + maxp].fShared = FALSE;
+ GetNextBitsOrBreak(maxp, mask, base);
+ *ppix++ = pixel + maxp;
+ }
+ }
+
+ *pMask = mask;
+ return (TRUE);
+ }
+ }
+ return (FALSE);
+}
+
+static Bool
+AllocShared (pmap, ppix, c, r, g, b, rmask, gmask, bmask, ppixFirst)
+ ColormapPtr pmap;
+ Pixel *ppix;
+ int c, r, g, b;
+ Pixel rmask, gmask, bmask;
+ Pixel *ppixFirst; /* First of the client's new pixels */
+{
+ Pixel *pptr, *cptr;
+ int npix, z, npixClientNew, npixShared;
+ Pixel basemask, base, bits, common;
+ SHAREDCOLOR *pshared, **ppshared, **psharedList;
+
+ npixClientNew = c << (r + g + b);
+ npixShared = (c << r) + (c << g) + (c << b);
+ psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared *
+ sizeof(SHAREDCOLOR *));
+ if (!psharedList)
+ return FALSE;
+ ppshared = psharedList;
+ for (z = npixShared; --z >= 0; )
+ {
+ if (!(ppshared[z] = (SHAREDCOLOR *)xalloc(sizeof(SHAREDCOLOR))))
+ {
+ for (z++ ; z < npixShared; z++)
+ xfree(ppshared[z]);
+ return FALSE;
+ }
+ }
+ for(pptr = ppix, npix = c; --npix >= 0; pptr++)
+ {
+ basemask = ~(gmask | bmask);
+ common = *pptr & basemask;
+ if (rmask)
+ {
+ bits = 0;
+ base = lowbit (rmask);
+ while(1)
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == (common | bits))
+ {
+ pmap->red[*cptr].fShared = TRUE;
+ pmap->red[*cptr].co.shco.red = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, rmask, base);
+ }
+ }
+ else
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == common)
+ {
+ pmap->red[*cptr].fShared = TRUE;
+ pmap->red[*cptr].co.shco.red = pshared;
+ }
+ }
+ }
+ basemask = ~(rmask | bmask);
+ common = *pptr & basemask;
+ if (gmask)
+ {
+ bits = 0;
+ base = lowbit (gmask);
+ while(1)
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (r + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == (common | bits))
+ {
+ pmap->red[*cptr].co.shco.green = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, gmask, base);
+ }
+ }
+ else
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == common)
+ {
+ pmap->red[*cptr].co.shco.green = pshared;
+ }
+ }
+ }
+ basemask = ~(rmask | gmask);
+ common = *pptr & basemask;
+ if (bmask)
+ {
+ bits = 0;
+ base = lowbit (bmask);
+ while(1)
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (r + g);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == (common | bits))
+ {
+ pmap->red[*cptr].co.shco.blue = pshared;
+ }
+ }
+ GetNextBitsOrBreak(bits, bmask, base);
+ }
+ }
+ else
+ {
+ pshared = *ppshared++;
+ pshared->refcnt = 1 << (g + b);
+ for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++)
+ {
+ if ((*cptr & basemask) == common)
+ {
+ pmap->red[*cptr].co.shco.blue = pshared;
+ }
+ }
+ }
+ }
+ DEALLOCATE_LOCAL(psharedList);
+ return TRUE;
+}
+
+
+/* Free colors and/or cells (probably slow for large numbers) */
+
+int
+FreeColors (pmap, client, count, pixels, mask)
+ ColormapPtr pmap;
+ int client, count;
+ Pixel *pixels;
+ Pixel mask;
+{
+ int rval, result, class;
+ Pixel rmask;
+
+ class = pmap->class;
+ if (pmap->flags & AllAllocated)
+ return(BadAccess);
+ if ((class | DynamicClass) == DirectColor)
+ {
+ rmask = mask & RGBMASK(pmap->pVisual);
+ result = FreeCo(pmap, client, REDMAP, count, pixels,
+ mask & pmap->pVisual->redMask);
+ /* If any of the three calls fails, we must report that, if more
+ * than one fails, it's ok that we report the last one */
+ rval = FreeCo(pmap, client, GREENMAP, count, pixels,
+ mask & pmap->pVisual->greenMask);
+ if(rval != Success)
+ result = rval;
+ rval = FreeCo(pmap, client, BLUEMAP, count, pixels,
+ mask & pmap->pVisual->blueMask);
+ if(rval != Success)
+ result = rval;
+ }
+ else
+ {
+ rmask = mask & ((((Pixel)1) << pmap->pVisual->nplanes) - 1);
+ result = FreeCo(pmap, client, PSEUDOMAP, count, pixels, rmask);
+ }
+ if ((mask != rmask) && count)
+ {
+ clientErrorValue = *pixels | mask;
+ result = BadValue;
+ }
+ /* XXX should worry about removing any RT_CMAPENTRY resource */
+ return (result);
+}
+
+/* Helper for FreeColors -- frees all combinations of *newpixels and mask bits
+ * which the client has allocated in channel colormap cells of pmap.
+ * doesn't change newpixels if it doesn't need to */
+static int
+FreeCo (pmap, client, color, npixIn, ppixIn, mask)
+ ColormapPtr pmap; /* which colormap head */
+ int client;
+ int color; /* which sub-map, eg RED, BLUE, PSEUDO */
+ int npixIn; /* number of pixels passed in */
+ Pixel *ppixIn; /* list of base pixels */
+ Pixel mask; /* mask client gave us */
+{
+
+ Pixel *ppixClient, pixTest;
+ int npixClient, npixNew, npix;
+ Pixel bits, base, cmask, rgbbad;
+ Pixel *pptr, *cptr;
+ int n, zapped;
+ int errVal = Success;
+ int offset, numents;
+#ifdef LBX
+ Bool grabbed;
+ Bool zeroRefCount;
+ Bool anyRefCountReachedZero = 0;
+#endif
+
+ if (npixIn == 0)
+ return (errVal);
+ bits = 0;
+ zapped = 0;
+ base = lowbit (mask);
+
+ switch(color)
+ {
+ case REDMAP:
+ cmask = pmap->pVisual->redMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetRed;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsRed[client];
+ npixClient = pmap->numPixelsRed[client];
+ break;
+ case GREENMAP:
+ cmask = pmap->pVisual->greenMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetGreen;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsGreen[client];
+ npixClient = pmap->numPixelsGreen[client];
+ break;
+ case BLUEMAP:
+ cmask = pmap->pVisual->blueMask;
+ rgbbad = ~RGBMASK(pmap->pVisual);
+ offset = pmap->pVisual->offsetBlue;
+ numents = (cmask >> offset) + 1;
+ ppixClient = pmap->clientPixelsBlue[client];
+ npixClient = pmap->numPixelsBlue[client];
+ break;
+ default: /* so compiler can see that everything gets initialized */
+ case PSEUDOMAP:
+ cmask = ~((Pixel)0);
+ rgbbad = 0;
+ offset = 0;
+ numents = pmap->pVisual->ColormapEntries;
+ ppixClient = pmap->clientPixelsRed[client];
+ npixClient = pmap->numPixelsRed[client];
+ break;
+ }
+
+#ifdef LBX
+ grabbed = LbxCheckCmapGrabbed (pmap);
+
+ if (grabbed)
+ {
+ /*
+ * If the colormap is grabbed by a proxy, the server must
+ * notify the proxy of all cells that are freed (the refcount
+ * has reached zero on these cells).
+ */
+
+ LbxBeginFreeCellsEvent (pmap);
+ LbxSortPixelList (ppixIn, npixIn);
+ }
+#endif
+
+ /* zap all pixels which match */
+ while (1)
+ {
+ /* go through pixel list */
+ for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++)
+ {
+ pixTest = ((*pptr | bits) & cmask) >> offset;
+ if ((pixTest >= numents) || (*pptr & rgbbad))
+ {
+ clientErrorValue = *pptr | bits;
+ errVal = BadValue;
+ continue;
+ }
+
+ /* find match in client list */
+ for (cptr = ppixClient, npix = npixClient;
+ --npix >= 0 && *cptr != pixTest;
+ cptr++) ;
+
+ if (npix >= 0)
+ {
+ if (pmap->class & DynamicClass)
+ {
+ FreeCell(pmap, pixTest, color);
+#ifdef LBX
+ /*
+ * Only PSEUDO colormaps are grabbed by LBX proxies.
+ * Check if the ref count reached zero on this pixel.
+ */
+
+ zeroRefCount = pmap->red[pixTest].refcnt == 0;
+ if (zeroRefCount)
+ anyRefCountReachedZero = 1;
+
+ if (grabbed && zeroRefCount)
+ LbxAddFreeCellToEvent (pmap, pixTest);
+#endif
+ }
+ *cptr = ~((Pixel)0);
+ zapped++;
+ }
+ else
+ errVal = BadAccess;
+ }
+ /* generate next bits value */
+ GetNextBitsOrBreak(bits, mask, base);
+ }
+
+#ifdef LBX
+ if (grabbed)
+ LbxEndFreeCellsEvent (pmap);
+ else if (anyRefCountReachedZero)
+ {
+ /*
+ * We only send LbxFreeCell events to a proxy that has the colormap
+ * grabbed. If the colormap is not grabbed, the proxy that last
+ * had the colormap grabbed will not be able to do a smart grab
+ * in the future. A smart grab can only occur if the proxy is kept
+ * up to date on every alloc/free change in the colormap.
+ */
+
+ LbxDisableSmartGrab (pmap);
+ }
+#endif
+
+ /* delete freed pixels from client pixel list */
+ if (zapped)
+ {
+ npixNew = npixClient - zapped;
+ if (npixNew)
+ {
+ /* Since the list can only get smaller, we can do a copy in
+ * place and then realloc to a smaller size */
+ pptr = cptr = ppixClient;
+
+ /* If we have all the new pixels, we don't have to examine the
+ * rest of the old ones */
+ for(npix = 0; npix < npixNew; cptr++)
+ {
+ if (*cptr != ~((Pixel)0))
+ {
+ *pptr++ = *cptr;
+ npix++;
+ }
+ }
+ pptr = (Pixel *)xrealloc(ppixClient, npixNew * sizeof(Pixel));
+ if (pptr)
+ ppixClient = pptr;
+ npixClient = npixNew;
+ }
+ else
+ {
+ npixClient = 0;
+ xfree(ppixClient);
+ ppixClient = (Pixel *)NULL;
+ }
+ switch(color)
+ {
+ case PSEUDOMAP:
+ case REDMAP:
+ pmap->clientPixelsRed[client] = ppixClient;
+ pmap->numPixelsRed[client] = npixClient;
+ break;
+ case GREENMAP:
+ pmap->clientPixelsGreen[client] = ppixClient;
+ pmap->numPixelsGreen[client] = npixClient;
+ break;
+ case BLUEMAP:
+ pmap->clientPixelsBlue[client] = ppixClient;
+ pmap->numPixelsBlue[client] = npixClient;
+ break;
+ }
+ }
+ return (errVal);
+}
+
+
+
+/* Redefine color values */
+int
+StoreColors (pmap, count, defs)
+ ColormapPtr pmap;
+ int count;
+ xColorItem *defs;
+{
+ register Pixel pix;
+ register xColorItem *pdef;
+ register EntryPtr pent, pentT, pentLast;
+ register VisualPtr pVisual;
+ SHAREDCOLOR *pred, *pgreen, *pblue;
+ int n, ChgRed, ChgGreen, ChgBlue, idef;
+ int class, errVal = Success;
+ int ok;
+
+
+ class = pmap->class;
+ if(!(class & DynamicClass) && !(pmap->flags & BeingCreated))
+ {
+ return(BadAccess);
+ }
+ pVisual = pmap->pVisual;
+
+ idef = 0;
+ if((class | DynamicClass) == DirectColor)
+ {
+ int numred, numgreen, numblue;
+ Pixel rgbbad;
+
+ numred = NUMRED(pVisual);
+ numgreen = NUMGREEN(pVisual);
+ numblue = NUMBLUE(pVisual);
+ rgbbad = ~RGBMASK(pVisual);
+ for (pdef = defs, n = 0; n < count; pdef++, n++)
+ {
+ ok = TRUE;
+ (*pmap->pScreen->ResolveColor)
+ (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
+
+ if (pdef->pixel & rgbbad)
+ {
+ errVal = BadValue;
+ clientErrorValue = pdef->pixel;
+ continue;
+ }
+ pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed;
+ if (pix >= numred)
+ {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->red[pix].refcnt != AllocPrivate)
+ {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoRed)
+ {
+ pmap->red[pix].co.local.red = pdef->red;
+ }
+ else
+ {
+ pdef->red = pmap->red[pix].co.local.red;
+ }
+
+ pix = (pdef->pixel & pVisual->greenMask) >> pVisual->offsetGreen;
+ if (pix >= numgreen)
+ {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->green[pix].refcnt != AllocPrivate)
+ {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoGreen)
+ {
+ pmap->green[pix].co.local.green = pdef->green;
+ }
+ else
+ {
+ pdef->green = pmap->green[pix].co.local.green;
+ }
+
+ pix = (pdef->pixel & pVisual->blueMask) >> pVisual->offsetBlue;
+ if (pix >= numblue)
+ {
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->blue[pix].refcnt != AllocPrivate)
+ {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+ else if (pdef->flags & DoBlue)
+ {
+ pmap->blue[pix].co.local.blue = pdef->blue;
+ }
+ else
+ {
+ pdef->blue = pmap->blue[pix].co.local.blue;
+ }
+ /* If this is an o.k. entry, then it gets added to the list
+ * to be sent to the hardware. If not, skip it. Once we've
+ * skipped one, we have to copy all the others.
+ */
+ if(ok)
+ {
+ if(idef != n)
+ defs[idef] = defs[n];
+ idef++;
+ } else
+ clientErrorValue = pdef->pixel;
+ }
+ }
+ else
+ {
+ for (pdef = defs, n = 0; n < count; pdef++, n++)
+ {
+
+ ok = TRUE;
+ if (pdef->pixel >= pVisual->ColormapEntries)
+ {
+ clientErrorValue = pdef->pixel;
+ errVal = BadValue;
+ ok = FALSE;
+ }
+ else if (pmap->red[pdef->pixel].refcnt != AllocPrivate)
+ {
+ errVal = BadAccess;
+ ok = FALSE;
+ }
+
+ /* If this is an o.k. entry, then it gets added to the list
+ * to be sent to the hardware. If not, skip it. Once we've
+ * skipped one, we have to copy all the others.
+ */
+ if(ok)
+ {
+ if(idef != n)
+ defs[idef] = defs[n];
+ idef++;
+ }
+ else
+ continue;
+
+ (*pmap->pScreen->ResolveColor)
+ (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual);
+
+ pent = &pmap->red[pdef->pixel];
+
+ if(pdef->flags & DoRed)
+ {
+ if(pent->fShared)
+ {
+ pent->co.shco.red->color = pdef->red;
+ if (pent->co.shco.red->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.red = pdef->red;
+ }
+ else
+ {
+ if(pent->fShared)
+ pdef->red = pent->co.shco.red->color;
+ else
+ pdef->red = pent->co.local.red;
+ }
+ if(pdef->flags & DoGreen)
+ {
+ if(pent->fShared)
+ {
+ pent->co.shco.green->color = pdef->green;
+ if (pent->co.shco.green->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.green = pdef->green;
+ }
+ else
+ {
+ if(pent->fShared)
+ pdef->green = pent->co.shco.green->color;
+ else
+ pdef->green = pent->co.local.green;
+ }
+ if(pdef->flags & DoBlue)
+ {
+ if(pent->fShared)
+ {
+ pent->co.shco.blue->color = pdef->blue;
+ if (pent->co.shco.blue->refcnt > 1)
+ ok = FALSE;
+ }
+ else
+ pent->co.local.blue = pdef->blue;
+ }
+ else
+ {
+ if(pent->fShared)
+ pdef->blue = pent->co.shco.blue->color;
+ else
+ pdef->blue = pent->co.local.blue;
+ }
+
+ if(!ok)
+ {
+ /* have to run through the colormap and change anybody who
+ * shares this value */
+ pred = pent->co.shco.red;
+ pgreen = pent->co.shco.green;
+ pblue = pent->co.shco.blue;
+ ChgRed = pdef->flags & DoRed;
+ ChgGreen = pdef->flags & DoGreen;
+ ChgBlue = pdef->flags & DoBlue;
+ pentLast = pmap->red + pVisual->ColormapEntries;
+
+ for(pentT = pmap->red; pentT < pentLast; pentT++)
+ {
+ if(pentT->fShared && (pentT != pent))
+ {
+ xColorItem defChg;
+
+ /* There are, alas, devices in this world too dumb
+ * to read their own hardware colormaps. Sick, but
+ * true. So we're going to be really nice and load
+ * the xColorItem with the proper value for all the
+ * fields. We will only set the flags for those
+ * fields that actually change. Smart devices can
+ * arrange to change only those fields. Dumb devices
+ * can rest assured that we have provided for them,
+ * and can change all three fields */
+
+ defChg.flags = 0;
+ if(ChgRed && pentT->co.shco.red == pred)
+ {
+ defChg.flags |= DoRed;
+ }
+ if(ChgGreen && pentT->co.shco.green == pgreen)
+ {
+ defChg.flags |= DoGreen;
+ }
+ if(ChgBlue && pentT->co.shco.blue == pblue)
+ {
+ defChg.flags |= DoBlue;
+ }
+ if(defChg.flags != 0)
+ {
+ defChg.pixel = pentT - pmap->red;
+ defChg.red = pentT->co.shco.red->color;
+ defChg.green = pentT->co.shco.green->color;
+ defChg.blue = pentT->co.shco.blue->color;
+ (*pmap->pScreen->StoreColors) (pmap, 1, &defChg);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ /* Note that we use idef, the count of acceptable entries, and not
+ * count, the count of proposed entries */
+ if (idef != 0)
+ ( *pmap->pScreen->StoreColors) (pmap, idef, defs);
+ return (errVal);
+}
+
+int
+IsMapInstalled(map, pWin)
+ Colormap map;
+ WindowPtr pWin;
+{
+ Colormap *pmaps;
+ int imap, nummaps, found;
+
+ pmaps = (Colormap *) ALLOCATE_LOCAL(
+ pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
+ if(!pmaps)
+ return(FALSE);
+ nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
+ (pWin->drawable.pScreen, pmaps);
+ found = FALSE;
+ for(imap = 0; imap < nummaps; imap++)
+ {
+ if(pmaps[imap] == map)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ DEALLOCATE_LOCAL(pmaps);
+ return (found);
+}
diff --git a/xc/programs/Xserver/dix/cursor.c b/xc/programs/Xserver/dix/cursor.c
new file mode 100644
index 000000000..23a9fcb3d
--- /dev/null
+++ b/xc/programs/Xserver/dix/cursor.c
@@ -0,0 +1,418 @@
+/* $XFree86: xc/programs/Xserver/dix/cursor.c,v 3.3 1998/10/04 09:38:02 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/* $TOG: cursor.c /main/20 1998/02/09 14:18:18 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "dixstruct.h"
+#include "cursorstr.h"
+#include "dixfontstr.h"
+#include "opaque.h"
+
+typedef struct _GlyphShare {
+ FontPtr font;
+ unsigned short sourceChar;
+ unsigned short maskChar;
+ CursorBitsPtr bits;
+ struct _GlyphShare *next;
+} GlyphShare, *GlyphSharePtr;
+
+static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
+
+static void
+#if NeedFunctionPrototypes
+FreeCursorBits(CursorBitsPtr bits)
+#else
+FreeCursorBits(bits)
+ CursorBitsPtr bits;
+#endif
+{
+ if (--bits->refcnt > 0)
+ return;
+ xfree(bits->source);
+ xfree(bits->mask);
+ if (bits->refcnt == 0)
+ {
+ register GlyphSharePtr *prev, this;
+
+ for (prev = &sharedGlyphs;
+ (this = *prev) && (this->bits != bits);
+ prev = &this->next)
+ ;
+ if (this)
+ {
+ *prev = this->next;
+ CloseFont(this->font, (Font)0);
+ xfree(this);
+ }
+ xfree(bits);
+ }
+}
+
+/*
+ * To be called indirectly by DeleteResource; must use exactly two args
+ */
+/*ARGSUSED*/
+int
+FreeCursor(value, cid)
+ pointer value; /* must conform to DeleteType */
+ XID cid;
+{
+ int nscr;
+ CursorPtr pCurs = (CursorPtr)value;
+
+ ScreenPtr pscr;
+
+ if ( --pCurs->refcnt > 0)
+ return(Success);
+
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
+ {
+ pscr = screenInfo.screens[nscr];
+ (void)( *pscr->UnrealizeCursor)( pscr, pCurs);
+ }
+ FreeCursorBits(pCurs->bits);
+ xfree( pCurs);
+ return(Success);
+}
+
+
+/*
+ * We check for empty cursors so that we won't have to display them
+ */
+static void
+CheckForEmptyMask(CursorBitsPtr bits)
+{
+ register unsigned char *msk = bits->mask;
+ int n = BitmapBytePad(bits->width) * bits->height;
+
+ bits->emptyMask = FALSE;
+ while(n--)
+ if(*(msk++) != 0) return;
+ bits->emptyMask = TRUE;
+}
+
+/*
+ * does nothing about the resource table, just creates the data structure.
+ * does not copy the src and mask bits
+ */
+CursorPtr
+AllocCursor(psrcbits, pmaskbits, cm,
+ foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue)
+ unsigned char * psrcbits; /* server-defined padding */
+ unsigned char * pmaskbits; /* server-defined padding */
+ CursorMetricPtr cm;
+ unsigned foreRed, foreGreen, foreBlue;
+ unsigned backRed, backGreen, backBlue;
+{
+ CursorBitsPtr bits;
+ CursorPtr pCurs;
+ int nscr;
+ ScreenPtr pscr;
+
+ pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
+ if (!pCurs)
+ {
+ xfree(psrcbits);
+ xfree(pmaskbits);
+ return (CursorPtr)NULL;
+ }
+ bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
+ bits->source = psrcbits;
+ bits->mask = pmaskbits;
+ bits->width = cm->width;
+ bits->height = cm->height;
+ bits->xhot = cm->xhot;
+ bits->yhot = cm->yhot;
+ bits->refcnt = -1;
+ CheckForEmptyMask(bits);
+
+ pCurs->bits = bits;
+ pCurs->refcnt = 1;
+
+ pCurs->foreRed = foreRed;
+ pCurs->foreGreen = foreGreen;
+ pCurs->foreBlue = foreBlue;
+
+ pCurs->backRed = backRed;
+ pCurs->backGreen = backGreen;
+ pCurs->backBlue = backBlue;
+
+ /*
+ * realize the cursor for every screen
+ */
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
+ {
+ pscr = screenInfo.screens[nscr];
+ if (!( *pscr->RealizeCursor)( pscr, pCurs))
+ {
+ while (--nscr >= 0)
+ {
+ pscr = screenInfo.screens[nscr];
+ ( *pscr->UnrealizeCursor)( pscr, pCurs);
+ }
+ FreeCursorBits(bits);
+ xfree(pCurs);
+ return (CursorPtr)NULL;
+ }
+ }
+ return pCurs;
+}
+
+int
+AllocGlyphCursor(source, sourceChar, mask, maskChar,
+ foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue,
+ ppCurs, client)
+ Font source, mask;
+ unsigned int sourceChar, maskChar;
+ unsigned foreRed, foreGreen, foreBlue;
+ unsigned backRed, backGreen, backBlue;
+ CursorPtr *ppCurs;
+ ClientPtr client;
+{
+ FontPtr sourcefont, maskfont;
+ unsigned char *srcbits;
+ unsigned char *mskbits;
+ CursorMetricRec cm;
+ int res;
+ CursorBitsPtr bits;
+ CursorPtr pCurs;
+ int nscr;
+ ScreenPtr pscr;
+ GlyphSharePtr pShare;
+
+ sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT,
+ SecurityReadAccess);
+ maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT,
+ SecurityReadAccess);
+
+ if (!sourcefont)
+ {
+ client->errorValue = source;
+ return(BadFont);
+ }
+ if (!maskfont && (mask != None))
+ {
+ client->errorValue = mask;
+ return(BadFont);
+ }
+ if (sourcefont != maskfont)
+ pShare = (GlyphSharePtr)NULL;
+ else
+ {
+ for (pShare = sharedGlyphs;
+ pShare &&
+ ((pShare->font != sourcefont) ||
+ (pShare->sourceChar != sourceChar) ||
+ (pShare->maskChar != maskChar));
+ pShare = pShare->next)
+ ;
+ }
+ if (pShare)
+ {
+ pCurs = (CursorPtr)xalloc(sizeof(CursorRec));
+ if (!pCurs)
+ return BadAlloc;
+ bits = pShare->bits;
+ bits->refcnt++;
+ }
+ else
+ {
+ if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm))
+ {
+ client->errorValue = sourceChar;
+ return BadValue;
+ }
+ if (!maskfont)
+ {
+ register long n;
+ register unsigned char *mskptr;
+
+ n = BitmapBytePad(cm.width)*(long)cm.height;
+ mskptr = mskbits = (unsigned char *)xalloc(n);
+ if (!mskptr)
+ return BadAlloc;
+ while (--n >= 0)
+ *mskptr++ = ~0;
+ }
+ else
+ {
+ if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm))
+ {
+ client->errorValue = maskChar;
+ return BadValue;
+ }
+ if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0)
+ return res;
+ }
+ if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0)
+ {
+ xfree(mskbits);
+ return res;
+ }
+ if (sourcefont != maskfont)
+ {
+ pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
+ if (pCurs)
+ bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
+ else
+ bits = (CursorBitsPtr)NULL;
+ }
+ else
+ {
+ pCurs = (CursorPtr)xalloc(sizeof(CursorRec));
+ if (pCurs)
+ bits = (CursorBitsPtr)xalloc(sizeof(CursorBits));
+ else
+ bits = (CursorBitsPtr)NULL;
+ }
+ if (!bits)
+ {
+ xfree(pCurs);
+ xfree(mskbits);
+ xfree(srcbits);
+ return BadAlloc;
+ }
+ bits->source = srcbits;
+ bits->mask = mskbits;
+ bits->width = cm.width;
+ bits->height = cm.height;
+ bits->xhot = cm.xhot;
+ bits->yhot = cm.yhot;
+ if (sourcefont != maskfont)
+ bits->refcnt = -1;
+ else
+ {
+ bits->refcnt = 1;
+ pShare = (GlyphSharePtr)xalloc(sizeof(GlyphShare));
+ if (!pShare)
+ {
+ FreeCursorBits(bits);
+ return BadAlloc;
+ }
+ pShare->font = sourcefont;
+ sourcefont->refcnt++;
+ pShare->sourceChar = sourceChar;
+ pShare->maskChar = maskChar;
+ pShare->bits = bits;
+ pShare->next = sharedGlyphs;
+ sharedGlyphs = pShare;
+ }
+ }
+ CheckForEmptyMask(bits);
+ pCurs->bits = bits;
+ pCurs->refcnt = 1;
+
+ pCurs->foreRed = foreRed;
+ pCurs->foreGreen = foreGreen;
+ pCurs->foreBlue = foreBlue;
+
+ pCurs->backRed = backRed;
+ pCurs->backGreen = backGreen;
+ pCurs->backBlue = backBlue;
+
+ /*
+ * realize the cursor for every screen
+ */
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
+ {
+ pscr = screenInfo.screens[nscr];
+ if (!( *pscr->RealizeCursor)( pscr, pCurs))
+ {
+ while (--nscr >= 0)
+ {
+ pscr = screenInfo.screens[nscr];
+ ( *pscr->UnrealizeCursor)( pscr, pCurs);
+ }
+ FreeCursorBits(pCurs->bits);
+ xfree(pCurs);
+ return BadAlloc;
+ }
+ }
+ *ppCurs = pCurs;
+ return Success;
+}
+
+/***********************************************************
+ * CreateRootCursor
+ *
+ * look up the name of a font
+ * open the font
+ * add the font to the resource table
+ * make a cursor from the glyphs
+ * add the cursor to the resource table
+ *************************************************************/
+
+CursorPtr
+CreateRootCursor(pfilename, glyph)
+ char * pfilename;
+ unsigned int glyph;
+{
+ CursorPtr curs;
+ FontPtr cursorfont;
+ int err;
+ XID fontID;
+
+ fontID = FakeClientID(0);
+ err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
+ (unsigned)strlen( pfilename), pfilename);
+ if (err != Success)
+ return NullCursor;
+
+ cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
+ if (!cursorfont)
+ return NullCursor;
+ if (AllocGlyphCursor(fontID, glyph, fontID, glyph + 1,
+ 0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success)
+ return NullCursor;
+
+ if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
+ return NullCursor;
+
+ return curs;
+}
diff --git a/xc/programs/Xserver/dix/devices.c b/xc/programs/Xserver/dix/devices.c
new file mode 100644
index 000000000..4723e2e0d
--- /dev/null
+++ b/xc/programs/Xserver/dix/devices.c
@@ -0,0 +1,1752 @@
+/* $XFree86: xc/programs/Xserver/dix/devices.c,v 3.15 1999/05/16 06:55:40 dawes Exp $ */
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+
+/* $TOG: devices.c /main/55 1998/02/09 14:18:25 kaleb $ */
+
+#include "X.h"
+#include "misc.h"
+#include "resource.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "dixstruct.h"
+#include "site.h"
+#define XKB_IN_SERVER
+#ifdef XKB
+#include "XKBsrv.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+#include "dispatch.h"
+#include "swaprep.h"
+#include "dixevents.h"
+
+DeviceIntPtr
+_AddInputDevice(deviceProc, autoStart)
+ DeviceProc deviceProc;
+ Bool autoStart;
+{
+ register DeviceIntPtr dev;
+
+ if (inputInfo.numDevices >= MAX_DEVICES)
+ return (DeviceIntPtr)NULL;
+ dev = (DeviceIntPtr) xalloc(sizeof(DeviceIntRec));
+ if (!dev)
+ return (DeviceIntPtr)NULL;
+ dev->name = (char *)NULL;
+ dev->type = 0;
+ dev->id = inputInfo.numDevices;
+ inputInfo.numDevices++;
+ dev->public.on = FALSE;
+ dev->public.processInputProc = (ProcessInputProc)NoopDDA;
+ dev->public.realInputProc = (ProcessInputProc)NoopDDA;
+ dev->public.enqueueInputProc = EnqueueEvent;
+ dev->deviceProc = deviceProc;
+ dev->startup = autoStart;
+ dev->sync.frozen = FALSE;
+ dev->sync.other = NullGrab;
+ dev->sync.state = NOT_GRABBED;
+ dev->sync.event = (xEvent *) NULL;
+ dev->sync.evcount = 0;
+ dev->grab = NullGrab;
+ dev->grabTime = currentTime;
+ dev->fromPassiveGrab = FALSE;
+ dev->key = (KeyClassPtr)NULL;
+ dev->valuator = (ValuatorClassPtr)NULL;
+ dev->button = (ButtonClassPtr)NULL;
+ dev->focus = (FocusClassPtr)NULL;
+ dev->proximity = (ProximityClassPtr)NULL;
+ dev->kbdfeed = (KbdFeedbackPtr)NULL;
+ dev->ptrfeed = (PtrFeedbackPtr)NULL;
+ dev->intfeed = (IntegerFeedbackPtr)NULL;
+ dev->stringfeed = (StringFeedbackPtr)NULL;
+ dev->bell = (BellFeedbackPtr)NULL;
+ dev->leds = (LedFeedbackPtr)NULL;
+ dev->next = inputInfo.off_devices;
+#ifdef XKB
+ dev->xkb_interest= NULL;
+#endif
+ inputInfo.off_devices = dev;
+ return dev;
+}
+
+Bool
+EnableDevice(dev)
+ register DeviceIntPtr dev;
+{
+ register DeviceIntPtr *prev;
+
+ for (prev = &inputInfo.off_devices;
+ *prev && (*prev != dev);
+ prev = &(*prev)->next)
+ ;
+ if ((*prev != dev) || !dev->inited ||
+ ((*dev->deviceProc)(dev, DEVICE_ON) != Success))
+ return FALSE;
+ *prev = dev->next;
+ dev->next = inputInfo.devices;
+ inputInfo.devices = dev;
+ return TRUE;
+}
+
+Bool
+DisableDevice(dev)
+ register DeviceIntPtr dev;
+{
+ register DeviceIntPtr *prev;
+
+ for (prev = &inputInfo.devices;
+ *prev && (*prev != dev);
+ prev = &(*prev)->next)
+ ;
+ if (*prev != dev)
+ return FALSE;
+ (void)(*dev->deviceProc)(dev, DEVICE_OFF);
+ *prev = dev->next;
+ dev->next = inputInfo.off_devices;
+ inputInfo.off_devices = dev;
+ return TRUE;
+}
+
+int
+InitAndStartDevices()
+{
+ register DeviceIntPtr dev, next;
+
+ for (dev = inputInfo.off_devices; dev; dev = dev->next)
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ for (dev = inputInfo.off_devices; dev; dev = next)
+ {
+ next = dev->next;
+ if (dev->inited && dev->startup)
+ (void)EnableDevice(dev);
+ }
+ for (dev = inputInfo.devices;
+ dev && (dev != inputInfo.keyboard);
+ dev = dev->next)
+ ;
+ if (!dev || (dev != inputInfo.keyboard)) {
+ ErrorF("No core keyboard\n");
+ return BadImplementation;
+ }
+ for (dev = inputInfo.devices;
+ dev && (dev != inputInfo.pointer);
+ dev = dev->next)
+ ;
+ if (!dev || (dev != inputInfo.pointer)) {
+ ErrorF("No core pointer\n");
+ return BadImplementation;
+ }
+ return Success;
+}
+
+static void
+#if NeedFunctionPrototypes
+CloseDevice(register DeviceIntPtr dev)
+#else
+CloseDevice(dev)
+ register DeviceIntPtr dev;
+#endif
+{
+ KbdFeedbackPtr k, knext;
+ PtrFeedbackPtr p, pnext;
+ IntegerFeedbackPtr i, inext;
+ StringFeedbackPtr s, snext;
+ BellFeedbackPtr b, bnext;
+ LedFeedbackPtr l, lnext;
+
+ if (dev->inited)
+ (void)(*dev->deviceProc)(dev, DEVICE_CLOSE);
+ xfree(dev->name);
+ if (dev->key)
+ {
+#ifdef XKB
+ if (dev->key->xkbInfo)
+ XkbFreeInfo(dev->key->xkbInfo);
+#endif
+ xfree(dev->key->curKeySyms.map);
+ xfree(dev->key->modifierKeyMap);
+ xfree(dev->key);
+ }
+ xfree(dev->valuator);
+#ifdef XKB
+ if ((dev->button)&&(dev->button->xkb_acts))
+ xfree(dev->button->xkb_acts);
+#endif
+ xfree(dev->button);
+ if (dev->focus)
+ {
+ xfree(dev->focus->trace);
+ xfree(dev->focus);
+ }
+ xfree(dev->proximity);
+ for (k=dev->kbdfeed; k; k=knext)
+ {
+ knext = k->next;
+#ifdef XKB
+ if (k->xkb_sli)
+ XkbFreeSrvLedInfo(k->xkb_sli);
+#endif
+ xfree(k);
+ }
+ for (p=dev->ptrfeed; p; p=pnext)
+ {
+ pnext = p->next;
+ xfree(p);
+ }
+ for (i=dev->intfeed; i; i=inext)
+ {
+ inext = i->next;
+ xfree(i);
+ }
+ for (s=dev->stringfeed; s; s=snext)
+ {
+ snext = s->next;
+ xfree(s->ctrl.symbols_supported);
+ xfree(s->ctrl.symbols_displayed);
+ xfree(s);
+ }
+ for (b=dev->bell; b; b=bnext)
+ {
+ bnext = b->next;
+ xfree(b);
+ }
+ for (l=dev->leds; l; l=lnext)
+ {
+ lnext = l->next;
+#ifdef XKB
+ if (l->xkb_sli)
+ XkbFreeSrvLedInfo(l->xkb_sli);
+#endif
+ xfree(l);
+ }
+#ifdef XKB
+ while (dev->xkb_interest) {
+ XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
+ }
+#endif
+ xfree(dev->sync.event);
+ xfree(dev);
+}
+
+void
+CloseDownDevices()
+{
+ register DeviceIntPtr dev, next;
+
+ for (dev = inputInfo.devices; dev; dev = next)
+ {
+ next = dev->next;
+ CloseDevice(dev);
+ }
+ for (dev = inputInfo.off_devices; dev; dev = next)
+ {
+ next = dev->next;
+ CloseDevice(dev);
+ }
+ inputInfo.keyboard = NULL;
+ inputInfo.pointer = NULL;
+}
+
+void
+RemoveDevice(dev)
+ register DeviceIntPtr dev;
+{
+ register DeviceIntPtr prev,tmp,next;
+
+ prev= NULL;
+ for (tmp= inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
+ next = tmp->next;
+ if (tmp==dev) {
+ CloseDevice(tmp);
+ if (prev==NULL)
+ inputInfo.devices = next;
+ else
+ prev->next = next;
+ inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
+ return;
+ }
+ }
+
+ prev= NULL;
+ for (tmp= inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) {
+ next = tmp->next;
+ if (tmp==dev) {
+ CloseDevice(tmp);
+ if (prev==NULL)
+ inputInfo.off_devices = next;
+ else
+ prev->next = next;
+ inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
+ return;
+ }
+ }
+ ErrorF("Internal Error! Attempt to remove a non-existent device\n");
+ return;
+}
+
+int
+NumMotionEvents()
+{
+ return inputInfo.pointer->valuator->numMotionEvents;
+}
+
+void
+_RegisterPointerDevice(device)
+ DeviceIntPtr device;
+{
+ inputInfo.pointer = device;
+#ifdef XKB
+ if (noXkbExtension) {
+ device->public.processInputProc = CoreProcessPointerEvent;
+ device->public.realInputProc = CoreProcessPointerEvent;
+ } else {
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
+ }
+#else
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
+#endif
+ device->ActivateGrab = ActivatePointerGrab;
+ device->DeactivateGrab = DeactivatePointerGrab;
+ if (!device->name)
+ {
+ char *p = "pointer";
+ device->name = (char *)xalloc(strlen(p) + 1);
+ strcpy(device->name, p);
+ }
+}
+
+void
+_RegisterKeyboardDevice(device)
+ DeviceIntPtr device;
+{
+ inputInfo.keyboard = device;
+#ifdef XKB
+ if (noXkbExtension) {
+ device->public.processInputProc = CoreProcessKeyboardEvent;
+ device->public.realInputProc = CoreProcessKeyboardEvent;
+ } else {
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
+ }
+#else
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
+#endif
+ device->ActivateGrab = ActivateKeyboardGrab;
+ device->DeactivateGrab = DeactivateKeyboardGrab;
+ if (!device->name)
+ {
+ char *k = "keyboard";
+ device->name = (char *)xalloc(strlen(k) + 1);
+ strcpy(device->name, k);
+ }
+}
+
+DevicePtr
+LookupKeyboardDevice()
+{
+ return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
+}
+
+DevicePtr
+LookupPointerDevice()
+{
+ return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
+}
+
+DevicePtr
+LookupDevice(id)
+ int id;
+{
+ DeviceIntPtr dev;
+
+ for (dev=inputInfo.devices; dev; dev=dev->next) {
+ if (dev->id == (CARD8)id)
+ return (DevicePtr)dev;
+ }
+ for (dev=inputInfo.off_devices; dev; dev=dev->next) {
+ if (dev->id == (CARD8)id)
+ return (DevicePtr)dev;
+ }
+ return NULL;
+}
+
+void
+QueryMinMaxKeyCodes(minCode, maxCode)
+ KeyCode *minCode, *maxCode;
+{
+ if (inputInfo.keyboard) {
+ *minCode = inputInfo.keyboard->key->curKeySyms.minKeyCode;
+ *maxCode = inputInfo.keyboard->key->curKeySyms.maxKeyCode;
+ }
+}
+
+Bool
+SetKeySymsMap(dst, src)
+ register KeySymsPtr dst, src;
+{
+ int i, j;
+ int rowDif = src->minKeyCode - dst->minKeyCode;
+ /* if keysym map size changes, grow map first */
+
+ if (src->mapWidth < dst->mapWidth)
+ {
+ for (i = src->minKeyCode; i <= src->maxKeyCode; i++)
+ {
+#define SI(r, c) (((r-src->minKeyCode)*src->mapWidth) + (c))
+#define DI(r, c) (((r - dst->minKeyCode)*dst->mapWidth) + (c))
+ for (j = 0; j < src->mapWidth; j++)
+ dst->map[DI(i, j)] = src->map[SI(i, j)];
+ for (j = src->mapWidth; j < dst->mapWidth; j++)
+ dst->map[DI(i, j)] = NoSymbol;
+#undef SI
+#undef DI
+ }
+ return TRUE;
+ }
+ else if (src->mapWidth > dst->mapWidth)
+ {
+ KeySym *map;
+ int bytes = sizeof(KeySym) * src->mapWidth *
+ (dst->maxKeyCode - dst->minKeyCode + 1);
+ map = (KeySym *)xalloc(bytes);
+ if (!map)
+ return FALSE;
+ bzero((char *)map, bytes);
+ if (dst->map)
+ {
+ for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++)
+ memmove((char *)&map[i*src->mapWidth],
+ (char *)&dst->map[i*dst->mapWidth],
+ dst->mapWidth * sizeof(KeySym));
+ xfree(dst->map);
+ }
+ dst->mapWidth = src->mapWidth;
+ dst->map = map;
+ }
+ memmove((char *)&dst->map[rowDif * dst->mapWidth],
+ (char *)src->map,
+ (int)(src->maxKeyCode - src->minKeyCode + 1) *
+ dst->mapWidth * sizeof(KeySym));
+ return TRUE;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+InitModMap(register KeyClassPtr keyc)
+#else
+InitModMap(keyc)
+ register KeyClassPtr keyc;
+#endif
+{
+ int i, j;
+ CARD8 keysPerModifier[8];
+ CARD8 mask;
+
+ keyc->maxKeysPerModifier = 0;
+ for (i = 0; i < 8; i++)
+ keysPerModifier[i] = 0;
+ for (i = 8; i < MAP_LENGTH; i++)
+ {
+ for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
+ {
+ if (mask & keyc->modifierMap[i])
+ {
+ if (++keysPerModifier[j] > keyc->maxKeysPerModifier)
+ keyc->maxKeysPerModifier = keysPerModifier[j];
+ }
+ }
+ }
+ keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier);
+ if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
+ return (FALSE);
+ bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
+ for (i = 0; i < 8; i++)
+ keysPerModifier[i] = 0;
+ for (i = 8; i < MAP_LENGTH; i++)
+ {
+ for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
+ {
+ if (mask & keyc->modifierMap[i])
+ {
+ keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) +
+ keysPerModifier[j]] = i;
+ keysPerModifier[j]++;
+ }
+ }
+ }
+ return TRUE;
+}
+
+Bool
+InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers)
+ DeviceIntPtr dev;
+ KeySymsPtr pKeySyms;
+ CARD8 pModifiers[];
+{
+ int i;
+ register KeyClassPtr keyc;
+
+ keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec));
+ if (!keyc)
+ return FALSE;
+ keyc->curKeySyms.map = (KeySym *)NULL;
+ keyc->curKeySyms.mapWidth = 0;
+ keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode;
+ keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode;
+ keyc->modifierKeyMap = (KeyCode *)NULL;
+ keyc->state = 0;
+ keyc->prev_state = 0;
+ if (pModifiers)
+ memmove((char *)keyc->modifierMap, (char *)pModifiers, MAP_LENGTH);
+ else
+ bzero((char *)keyc->modifierMap, MAP_LENGTH);
+ bzero((char *)keyc->down, DOWN_LENGTH);
+ for (i = 0; i < 8; i++)
+ keyc->modifierKeyCount[i] = 0;
+ if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc))
+ {
+ xfree(keyc->curKeySyms.map);
+ xfree(keyc->modifierKeyMap);
+ xfree(keyc);
+ return FALSE;
+ }
+ dev->key = keyc;
+#ifdef XKB
+ dev->key->xkbInfo= NULL;
+ if (!noXkbExtension) XkbInitDevice(dev);
+#endif
+ return TRUE;
+}
+
+Bool
+InitButtonClassDeviceStruct(dev, numButtons, map)
+ register DeviceIntPtr dev;
+ int numButtons;
+ CARD8 *map;
+{
+ register ButtonClassPtr butc;
+ int i;
+
+ butc = (ButtonClassPtr)xalloc(sizeof(ButtonClassRec));
+ if (!butc)
+ return FALSE;
+ butc->numButtons = numButtons;
+ for (i = 1; i <= numButtons; i++)
+ butc->map[i] = map[i];
+ butc->buttonsDown = 0;
+ butc->state = 0;
+ butc->motionMask = 0;
+ bzero((char *)butc->down, DOWN_LENGTH);
+#ifdef XKB
+ butc->xkb_acts= NULL;
+#endif
+ dev->button = butc;
+ return TRUE;
+}
+
+Bool
+InitValuatorClassDeviceStruct(dev, numAxes, motionProc, numMotionEvents, mode)
+ DeviceIntPtr dev;
+ ValuatorMotionProcPtr motionProc;
+ int numAxes;
+ int numMotionEvents;
+ int mode;
+{
+ int i;
+ register ValuatorClassPtr valc;
+
+ valc = (ValuatorClassPtr)xalloc(sizeof(ValuatorClassRec) +
+ numAxes * sizeof(AxisInfo) +
+ numAxes * sizeof(unsigned int));
+ if (!valc)
+ return FALSE;
+ valc->GetMotionProc = motionProc;
+ valc->numMotionEvents = numMotionEvents;
+ valc->motionHintWindow = NullWindow;
+ valc->numAxes = numAxes;
+ valc->mode = mode;
+ valc->axes = (AxisInfoPtr)(valc + 1);
+ valc->axisVal = (int *)(valc->axes + numAxes);
+ for (i=0; i<numAxes; i++)
+ valc->axisVal[i]=0;
+ dev->valuator = valc;
+ return TRUE;
+}
+
+Bool
+InitFocusClassDeviceStruct(dev)
+ DeviceIntPtr dev;
+{
+ register FocusClassPtr focc;
+
+ focc = (FocusClassPtr)xalloc(sizeof(FocusClassRec));
+ if (!focc)
+ return FALSE;
+ focc->win = PointerRootWin;
+ focc->revert = None;
+ focc->time = currentTime;
+ focc->trace = (WindowPtr *)NULL;
+ focc->traceSize = 0;
+ focc->traceGood = 0;
+ dev->focus = focc;
+ return TRUE;
+}
+
+Bool
+InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)
+ DeviceIntPtr dev;
+ BellProcPtr bellProc;
+ KbdCtrlProcPtr controlProc;
+{
+ register KbdFeedbackPtr feedc;
+
+ feedc = (KbdFeedbackPtr)xalloc(sizeof(KbdFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->BellProc = bellProc;
+ feedc->CtrlProc = controlProc;
+#ifdef XKB
+ defaultKeyboardControl.autoRepeat = TRUE;
+#endif
+ feedc->ctrl = defaultKeyboardControl;
+ feedc->ctrl.id = 0;
+ if ((feedc->next = dev->kbdfeed) != 0)
+ feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1;
+ dev->kbdfeed = feedc;
+#ifdef XKB
+ feedc->xkb_sli= NULL;
+ if (!noXkbExtension)
+ XkbFinishDeviceInit(dev);
+#endif
+ (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
+ return TRUE;
+}
+
+Bool
+InitPtrFeedbackClassDeviceStruct(dev, controlProc)
+ DeviceIntPtr dev;
+ PtrCtrlProcPtr controlProc;
+{
+ register PtrFeedbackPtr feedc;
+
+ feedc = (PtrFeedbackPtr)xalloc(sizeof(PtrFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->CtrlProc = controlProc;
+#ifdef sgi
+ feedc->ctrl.num = 1;
+ feedc->ctrl.den = 1;
+ feedc->ctrl.threshold = 1;
+#else
+ feedc->ctrl = defaultPointerControl;
+#endif
+ feedc->ctrl.id = 0;
+ if ( (feedc->next = dev->ptrfeed) )
+ feedc->ctrl.id = dev->ptrfeed->ctrl.id + 1;
+ dev->ptrfeed = feedc;
+ (*controlProc)(dev, &feedc->ctrl);
+ return TRUE;
+}
+
+
+LedCtrl defaultLedControl = {
+ DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0};
+
+BellCtrl defaultBellControl = {
+ DEFAULT_BELL,
+ DEFAULT_BELL_PITCH,
+ DEFAULT_BELL_DURATION,
+ 0};
+
+IntegerCtrl defaultIntegerControl = {
+ DEFAULT_INT_RESOLUTION,
+ DEFAULT_INT_MIN_VALUE,
+ DEFAULT_INT_MAX_VALUE,
+ DEFAULT_INT_DISPLAYED,
+ 0};
+
+Bool
+InitStringFeedbackClassDeviceStruct (dev, controlProc, max_symbols,
+ num_symbols_supported, symbols)
+ DeviceIntPtr dev;
+ StringCtrlProcPtr controlProc;
+ int max_symbols;
+ int num_symbols_supported;
+ KeySym *symbols;
+{
+ int i;
+ register StringFeedbackPtr feedc;
+
+ feedc = (StringFeedbackPtr)xalloc(sizeof(StringFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->CtrlProc = controlProc;
+ feedc->ctrl.num_symbols_supported = num_symbols_supported;
+ feedc->ctrl.num_symbols_displayed = 0;
+ feedc->ctrl.max_symbols = max_symbols;
+ feedc->ctrl.symbols_supported = (KeySym *)
+ xalloc (sizeof (KeySym) * num_symbols_supported);
+ feedc->ctrl.symbols_displayed = (KeySym *)
+ xalloc (sizeof (KeySym) * max_symbols);
+ if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
+ {
+ if (feedc->ctrl.symbols_supported)
+ xfree(feedc->ctrl.symbols_supported);
+ if (feedc->ctrl.symbols_displayed)
+ xfree(feedc->ctrl.symbols_displayed);
+ xfree(feedc);
+ return FALSE;
+ }
+ for (i=0; i<num_symbols_supported; i++)
+ *(feedc->ctrl.symbols_supported+i) = *symbols++;
+ for (i=0; i<max_symbols; i++)
+ *(feedc->ctrl.symbols_displayed+i) = (KeySym) NULL;
+ feedc->ctrl.id = 0;
+ if ( (feedc->next = dev->stringfeed) )
+ feedc->ctrl.id = dev->stringfeed->ctrl.id + 1;
+ dev->stringfeed = feedc;
+ (*controlProc)(dev, &feedc->ctrl);
+ return TRUE;
+}
+
+Bool
+InitBellFeedbackClassDeviceStruct (dev, bellProc, controlProc)
+ DeviceIntPtr dev;
+ BellProcPtr bellProc;
+ BellCtrlProcPtr controlProc;
+{
+ register BellFeedbackPtr feedc;
+
+ feedc = (BellFeedbackPtr)xalloc(sizeof(BellFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->CtrlProc = controlProc;
+ feedc->BellProc = bellProc;
+ feedc->ctrl = defaultBellControl;
+ feedc->ctrl.id = 0;
+ if ( (feedc->next = dev->bell) )
+ feedc->ctrl.id = dev->bell->ctrl.id + 1;
+ dev->bell = feedc;
+ (*controlProc)(dev, &feedc->ctrl);
+ return TRUE;
+}
+
+Bool
+InitLedFeedbackClassDeviceStruct (dev, controlProc)
+ DeviceIntPtr dev;
+ LedCtrlProcPtr controlProc;
+{
+ register LedFeedbackPtr feedc;
+
+ feedc = (LedFeedbackPtr)xalloc(sizeof(LedFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->CtrlProc = controlProc;
+ feedc->ctrl = defaultLedControl;
+ feedc->ctrl.id = 0;
+ if ( (feedc->next = dev->leds) )
+ feedc->ctrl.id = dev->leds->ctrl.id + 1;
+#ifdef XKB
+ feedc->xkb_sli= NULL;
+#endif
+ dev->leds = feedc;
+ (*controlProc)(dev, &feedc->ctrl);
+ return TRUE;
+}
+
+Bool
+InitIntegerFeedbackClassDeviceStruct (dev, controlProc)
+ DeviceIntPtr dev;
+ IntegerCtrlProcPtr controlProc;
+{
+ register IntegerFeedbackPtr feedc;
+
+ feedc = (IntegerFeedbackPtr)xalloc(sizeof(IntegerFeedbackClassRec));
+ if (!feedc)
+ return FALSE;
+ feedc->CtrlProc = controlProc;
+ feedc->ctrl = defaultIntegerControl;
+ feedc->ctrl.id = 0;
+ if ( (feedc->next = dev->intfeed) )
+ feedc->ctrl.id = dev->intfeed->ctrl.id + 1;
+ dev->intfeed = feedc;
+ (*controlProc)(dev, &feedc->ctrl);
+ return TRUE;
+}
+
+Bool
+InitPointerDeviceStruct(device, map, numButtons, motionProc, controlProc,
+ numMotionEvents)
+ DevicePtr device;
+ CARD8 *map;
+ int numButtons;
+ PtrCtrlProcPtr controlProc;
+ ValuatorMotionProcPtr motionProc;
+ int numMotionEvents;
+{
+ DeviceIntPtr dev = (DeviceIntPtr)device;
+
+ return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
+ InitValuatorClassDeviceStruct(dev, 2, motionProc,
+ numMotionEvents, 0) &&
+ InitPtrFeedbackClassDeviceStruct(dev, controlProc));
+}
+
+Bool
+InitKeyboardDeviceStruct(device, pKeySyms, pModifiers, bellProc, controlProc)
+ DevicePtr device;
+ KeySymsPtr pKeySyms;
+ CARD8 pModifiers[];
+ BellProcPtr bellProc;
+ KbdCtrlProcPtr controlProc;
+{
+ DeviceIntPtr dev = (DeviceIntPtr)device;
+
+ return(InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers) &&
+ InitFocusClassDeviceStruct(dev) &&
+ InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc));
+}
+
+void
+SendMappingNotify(request, firstKeyCode, count, client)
+ unsigned int request, count;
+ unsigned int firstKeyCode;
+ ClientPtr client;
+{
+ int i;
+ xEvent event;
+
+ event.u.u.type = MappingNotify;
+ event.u.mappingNotify.request = request;
+ if (request == MappingKeyboard)
+ {
+ event.u.mappingNotify.firstKeyCode = firstKeyCode;
+ event.u.mappingNotify.count = count;
+ }
+#ifdef XKB
+ if (!noXkbExtension &&
+ ((request == MappingKeyboard) || (request == MappingModifier))) {
+ XkbApplyMappingChange(inputInfo.keyboard,request,firstKeyCode,count,
+ client);
+ }
+#endif
+
+ /* 0 is the server client */
+ for (i=1; i<currentMaxClients; i++)
+ {
+ if (clients[i] && clients[i]->clientState == ClientStateRunning)
+ {
+#ifdef XKB
+ if (!noXkbExtension &&
+ (request == MappingKeyboard) &&
+ (clients[i]->xkbClientFlags != 0) &&
+ (clients[i]->mapNotifyMask&XkbKeySymsMask))
+ continue;
+#endif
+ event.u.u.sequenceNumber = clients[i]->sequence;
+ WriteEventsToClient(clients[i], 1, &event);
+ }
+ }
+}
+
+/*
+ * n-squared algorithm. n < 255 and don't want to copy the whole thing and
+ * sort it to do the checking. How often is it called? Just being lazy?
+ */
+Bool
+BadDeviceMap(buff, length, low, high, errval)
+ register BYTE *buff;
+ int length;
+ unsigned low, high;
+ XID *errval;
+{
+ register int i, j;
+
+ for (i = 0; i < length; i++)
+ if (buff[i]) /* only check non-zero elements */
+ {
+ if ((low > buff[i]) || (high < buff[i]))
+ {
+ *errval = buff[i];
+ return TRUE;
+ }
+ for (j = i + 1; j < length; j++)
+ if (buff[i] == buff[j])
+ {
+ *errval = buff[i];
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+Bool
+AllModifierKeysAreUp(dev, map1, per1, map2, per2)
+ register DeviceIntPtr dev;
+ register CARD8 *map1, *map2;
+ int per1, per2;
+{
+ register int i, j, k;
+ register CARD8 *down = dev->key->down;
+
+ for (i = 8; --i >= 0; map2 += per2)
+ {
+ for (j = per1; --j >= 0; map1++)
+ {
+ if (*map1 && BitIsOn(down, *map1))
+ {
+ for (k = per2; (--k >= 0) && (*map1 != map2[k]);)
+ ;
+ if (k < 0)
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+int
+ProcSetModifierMapping(client)
+ ClientPtr client;
+{
+ xSetModifierMappingReply rep;
+ REQUEST(xSetModifierMappingReq);
+ KeyCode *inputMap;
+ int inputMapLen;
+ register int i;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+ register KeyClassPtr keyc = keybd->key;
+
+ REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
+
+ if (client->req_len != ((stuff->numKeyPerModifier<<1) +
+ (sizeof (xSetModifierMappingReq)>>2)))
+ return BadLength;
+
+ inputMapLen = 8*stuff->numKeyPerModifier;
+ inputMap = (KeyCode *)&stuff[1];
+
+ /*
+ * Now enforce the restriction that "all of the non-zero keycodes must be
+ * in the range specified by min-keycode and max-keycode in the
+ * connection setup (else a Value error)"
+ */
+ i = inputMapLen;
+ while (i--)
+ {
+ if (inputMap[i]
+ && (inputMap[i] < keyc->curKeySyms.minKeyCode
+ || inputMap[i] > keyc->curKeySyms.maxKeyCode))
+ {
+ client->errorValue = inputMap[i];
+ return BadValue;
+ }
+ }
+
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, keybd, TRUE))
+ return BadAccess;
+#endif
+
+#ifdef LBX
+ LbxFlushModifierMapTag();
+#endif
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.success = MappingSuccess;
+
+ /*
+ * Now enforce the restriction that none of the old or new
+ * modifier keys may be down while we change the mapping, and
+ * that the DDX layer likes the choice.
+ */
+ if (!AllModifierKeysAreUp(keybd, keyc->modifierKeyMap,
+ (int)keyc->maxKeysPerModifier,
+ inputMap, (int)stuff->numKeyPerModifier)
+ ||
+ !AllModifierKeysAreUp(keybd, inputMap, (int)stuff->numKeyPerModifier,
+ keyc->modifierKeyMap,
+ (int)keyc->maxKeysPerModifier))
+ {
+ rep.success = MappingBusy;
+ }
+ else
+ {
+ for (i = 0; i < inputMapLen; i++)
+ {
+ if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)keybd))
+ {
+ rep.success = MappingFailed;
+ break;
+ }
+ }
+ }
+
+ if (rep.success == MappingSuccess)
+ {
+ KeyCode *map;
+ /*
+ * Now build the keyboard's modifier bitmap from the
+ * list of keycodes.
+ */
+ map = (KeyCode *)xalloc(inputMapLen);
+ if (!map && inputMapLen)
+ return BadAlloc;
+ if (keyc->modifierKeyMap)
+ xfree(keyc->modifierKeyMap);
+ keyc->modifierKeyMap = map;
+ memmove((char *)map, (char *)inputMap, inputMapLen);
+
+ keyc->maxKeysPerModifier = stuff->numKeyPerModifier;
+ for (i = 0; i < MAP_LENGTH; i++)
+ keyc->modifierMap[i] = 0;
+ for (i = 0; i < inputMapLen; i++)
+ {
+ if (inputMap[i])
+ keyc->modifierMap[inputMap[i]] |=
+ (1<<(((unsigned int)i)/keyc->maxKeysPerModifier));
+ }
+ }
+
+ if (rep.success == MappingSuccess)
+ SendMappingNotify(MappingModifier, 0, 0, client);
+
+ WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
+
+ return(client->noClientException);
+}
+
+int
+ProcGetModifierMapping(client)
+ ClientPtr client;
+{
+ xGetModifierMappingReply rep;
+ register KeyClassPtr keyc = inputInfo.keyboard->key;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.numKeyPerModifier = keyc->maxKeysPerModifier;
+ rep.sequenceNumber = client->sequence;
+ /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
+ rep.length = keyc->maxKeysPerModifier << 1;
+
+ WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
+
+ /* Use the (modified by DDX) map that SetModifierMapping passed in */
+ (void)WriteToClient(client, (int)(keyc->maxKeysPerModifier << 3),
+ (char *)keyc->modifierKeyMap);
+ return client->noClientException;
+}
+
+int
+ProcChangeKeyboardMapping(client)
+ ClientPtr client;
+{
+ REQUEST(xChangeKeyboardMappingReq);
+ unsigned len;
+ KeySymsRec keysyms;
+ register KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
+
+ len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2);
+ if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode))
+ return BadLength;
+ if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode))
+ {
+ client->errorValue = stuff->firstKeyCode;
+ return BadValue;
+ }
+ if ( ((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
+ curKeySyms->maxKeyCode) ||
+ (stuff->keySymsPerKeyCode == 0))
+ {
+ client->errorValue = stuff->keySymsPerKeyCode;
+ return BadValue;
+ }
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard,
+ TRUE))
+ return BadAccess;
+#endif
+ keysyms.minKeyCode = stuff->firstKeyCode;
+ keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
+ keysyms.mapWidth = stuff->keySymsPerKeyCode;
+ keysyms.map = (KeySym *)&stuff[1];
+ if (!SetKeySymsMap(curKeySyms, &keysyms))
+ return BadAlloc;
+#ifdef LBX
+ LbxFlushKeyboardMapTag();
+#endif
+ SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
+ client);
+ return client->noClientException;
+
+}
+
+int
+ProcSetPointerMapping(client)
+ ClientPtr client;
+{
+ REQUEST(xSetPointerMappingReq);
+ BYTE *map;
+ xSetPointerMappingReply rep;
+ register unsigned int i;
+ DeviceIntPtr mouse = inputInfo.pointer;
+
+ REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
+ if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2)
+ return BadLength;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.success = MappingSuccess;
+ map = (BYTE *)&stuff[1];
+ if (stuff->nElts != mouse->button->numButtons)
+ {
+ client->errorValue = stuff->nElts;
+ return BadValue;
+ }
+ if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue))
+ return BadValue;
+ for (i=0; i < stuff->nElts; i++)
+ if ((mouse->button->map[i + 1] != map[i]) &&
+ BitIsOn(mouse->button->down, i + 1))
+ {
+ rep.success = MappingBusy;
+ WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
+ return Success;
+ }
+ for (i = 0; i < stuff->nElts; i++)
+ mouse->button->map[i + 1] = map[i];
+ SendMappingNotify(MappingPointer, 0, 0, client);
+ WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
+ return Success;
+}
+
+int
+ProcGetKeyboardMapping(client)
+ ClientPtr client;
+{
+ xGetKeyboardMappingReply rep;
+ REQUEST(xGetKeyboardMappingReq);
+ KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+
+ REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
+
+ if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode))
+ {
+ client->errorValue = stuff->firstKeyCode;
+ return BadValue;
+ }
+ if (stuff->firstKeyCode + stuff->count >
+ (unsigned)(curKeySyms->maxKeyCode + 1))
+ {
+ client->errorValue = stuff->count;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.keySymsPerKeyCode = curKeySyms->mapWidth;
+ /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
+ rep.length = (curKeySyms->mapWidth * stuff->count);
+ WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+ WriteSwappedDataToClient(
+ client,
+ curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
+ &curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) *
+ curKeySyms->mapWidth]);
+
+ return client->noClientException;
+}
+
+int
+ProcGetPointerMapping(client)
+ ClientPtr client;
+{
+ xGetPointerMappingReply rep;
+ ButtonClassPtr butc = inputInfo.pointer->button;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.nElts = butc->numButtons;
+ rep.length = ((unsigned)rep.nElts + (4-1))/4;
+ WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
+ (void)WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]);
+ return Success;
+}
+
+void
+NoteLedState(keybd, led, on)
+ DeviceIntPtr keybd;
+ int led;
+ Bool on;
+{
+ KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl;
+ if (on)
+ ctrl->leds |= ((Leds)1 << (led - 1));
+ else
+ ctrl->leds &= ~((Leds)1 << (led - 1));
+}
+
+int
+Ones(mask) /* HACKMEM 169 */
+ unsigned long mask;
+{
+ register unsigned long y;
+
+ y = (mask >> 1) &033333333333;
+ y = mask - y - ((y >>1) & 033333333333);
+ return (((y + (y >> 3)) & 030707070707) % 077);
+}
+
+int
+ProcChangeKeyboardControl (client)
+ ClientPtr client;
+{
+#define DO_ALL (-1)
+ KeybdCtrl ctrl;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+ XID *vlist;
+ int t;
+ int led = DO_ALL;
+ int key = DO_ALL;
+ BITS32 vmask, index2;
+ int mask, i;
+ REQUEST(xChangeKeyboardControlReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+ vmask = stuff->mask;
+ if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
+ return BadLength;
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, keybd, TRUE))
+ return BadAccess;
+#endif
+ vlist = (XID *)&stuff[1]; /* first word of values */
+ ctrl = keybd->kbdfeed->ctrl;
+ while (vmask)
+ {
+ index2 = (BITS32) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
+ {
+ case KBKeyClickPercent:
+ t = (INT8)*vlist;
+ vlist++;
+ if (t == -1)
+ t = defaultKeyboardControl.click;
+ else if (t < 0 || t > 100)
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.click = t;
+ break;
+ case KBBellPercent:
+ t = (INT8)*vlist;
+ vlist++;
+ if (t == -1)
+ t = defaultKeyboardControl.bell;
+ else if (t < 0 || t > 100)
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell = t;
+ break;
+ case KBBellPitch:
+ t = (INT16)*vlist;
+ vlist++;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_pitch;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell_pitch = t;
+ break;
+ case KBBellDuration:
+ t = (INT16)*vlist;
+ vlist++;
+ if (t == -1)
+ t = defaultKeyboardControl.bell_duration;
+ else if (t < 0)
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+ ctrl.bell_duration = t;
+ break;
+ case KBLed:
+ led = (CARD8)*vlist;
+ vlist++;
+ if (led < 1 || led > 32)
+ {
+ client->errorValue = led;
+ return BadValue;
+ }
+ if (!(stuff->mask & KBLedMode))
+ return BadMatch;
+ break;
+ case KBLedMode:
+ t = (CARD8)*vlist;
+ vlist++;
+ if (t == LedModeOff)
+ {
+ if (led == DO_ALL)
+ ctrl.leds = 0x0;
+ else
+ ctrl.leds &= ~(((Leds)(1)) << (led - 1));
+ }
+ else if (t == LedModeOn)
+ {
+ if (led == DO_ALL)
+ ctrl.leds = ~0L;
+ else
+ ctrl.leds |= (((Leds)(1)) << (led - 1));
+ }
+ else
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+#ifdef XKB
+ if (!noXkbExtension) {
+ XkbEventCauseRec cause;
+ XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
+ keybd->kbdfeed->ctrl.leds = ctrl.leds;
+ XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
+ ctrl.leds, &cause);
+ }
+#endif
+ break;
+ case KBKey:
+ key = (KeyCode)*vlist;
+ vlist++;
+ if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode ||
+ (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode)
+ {
+ client->errorValue = key;
+ return BadValue;
+ }
+ if (!(stuff->mask & KBAutoRepeatMode))
+ return BadMatch;
+ break;
+ case KBAutoRepeatMode:
+ i = (key >> 3);
+ mask = (1 << (key & 7));
+ t = (CARD8)*vlist;
+ vlist++;
+#ifdef XKB
+ if (!noXkbExtension && key != DO_ALL)
+ XkbDisableComputedAutoRepeats(keybd,key);
+#endif
+ if (t == AutoRepeatModeOff)
+ {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = FALSE;
+ else
+ ctrl.autoRepeats[i] &= ~mask;
+ }
+ else if (t == AutoRepeatModeOn)
+ {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = TRUE;
+ else
+ ctrl.autoRepeats[i] |= mask;
+ }
+ else if (t == AutoRepeatModeDefault)
+ {
+ if (key == DO_ALL)
+ ctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
+ else
+ ctrl.autoRepeats[i] =
+ (ctrl.autoRepeats[i] & ~mask) |
+ (defaultKeyboardControl.autoRepeats[i] & mask);
+ }
+ else
+ {
+ client->errorValue = t;
+ return BadValue;
+ }
+ break;
+ default:
+ client->errorValue = stuff->mask;
+ return BadValue;
+ }
+ }
+ keybd->kbdfeed->ctrl = ctrl;
+#ifdef XKB
+ /* The XKB RepeatKeys control and core protocol global autorepeat */
+ /* value are linked */
+ if (!noXkbExtension) {
+ XkbSetRepeatKeys(keybd,key,keybd->kbdfeed->ctrl.autoRepeat);
+ }
+ else
+#endif
+ (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl);
+ return Success;
+#undef DO_ALL
+}
+
+int
+ProcGetKeyboardControl (client)
+ ClientPtr client;
+{
+ int i;
+ register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
+ xGetKeyboardControlReply rep;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.length = 5;
+ rep.sequenceNumber = client->sequence;
+ rep.globalAutoRepeat = ctrl->autoRepeat;
+ rep.keyClickPercent = ctrl->click;
+ rep.bellPercent = ctrl->bell;
+ rep.bellPitch = ctrl->bell_pitch;
+ rep.bellDuration = ctrl->bell_duration;
+ rep.ledMask = ctrl->leds;
+ for (i = 0; i < 32; i++)
+ rep.map[i] = ctrl->autoRepeats[i];
+ WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
+ return Success;
+}
+
+int
+ProcBell(client)
+ ClientPtr client;
+{
+ register DeviceIntPtr keybd = inputInfo.keyboard;
+ int base = keybd->kbdfeed->ctrl.bell;
+ int newpercent;
+ REQUEST(xBellReq);
+ REQUEST_SIZE_MATCH(xBellReq);
+ if (stuff->percent < -100 || stuff->percent > 100)
+ {
+ client->errorValue = stuff->percent;
+ return BadValue;
+ }
+ newpercent = (base * stuff->percent) / 100;
+ if (stuff->percent < 0)
+ newpercent = base + newpercent;
+ else
+ newpercent = base - newpercent + stuff->percent;
+#ifdef XKB
+ if (!noXkbExtension)
+ XkbHandleBell(FALSE,FALSE, keybd, newpercent, &keybd->kbdfeed->ctrl, 0,
+ None, NULL, client);
+ else
+#endif
+ (*keybd->kbdfeed->BellProc)(newpercent, keybd,
+ (pointer) &keybd->kbdfeed->ctrl, 0);
+ return Success;
+}
+
+int
+ProcChangePointerControl(client)
+ ClientPtr client;
+{
+ DeviceIntPtr mouse = inputInfo.pointer;
+ PtrCtrl ctrl; /* might get BadValue part way through */
+ REQUEST(xChangePointerControlReq);
+
+ REQUEST_SIZE_MATCH(xChangePointerControlReq);
+ ctrl = mouse->ptrfeed->ctrl;
+ if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse))
+ {
+ client->errorValue = stuff->doAccel;
+ return(BadValue);
+ }
+ if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse))
+ {
+ client->errorValue = stuff->doThresh;
+ return(BadValue);
+ }
+ if (stuff->doAccel)
+ {
+ if (stuff->accelNum == -1)
+ ctrl.num = defaultPointerControl.num;
+ else if (stuff->accelNum < 0)
+ {
+ client->errorValue = stuff->accelNum;
+ return BadValue;
+ }
+ else ctrl.num = stuff->accelNum;
+ if (stuff->accelDenum == -1)
+ ctrl.den = defaultPointerControl.den;
+ else if (stuff->accelDenum <= 0)
+ {
+ client->errorValue = stuff->accelDenum;
+ return BadValue;
+ }
+ else ctrl.den = stuff->accelDenum;
+ }
+ if (stuff->doThresh)
+ {
+ if (stuff->threshold == -1)
+ ctrl.threshold = defaultPointerControl.threshold;
+ else if (stuff->threshold < 0)
+ {
+ client->errorValue = stuff->threshold;
+ return BadValue;
+ }
+ else ctrl.threshold = stuff->threshold;
+ }
+ mouse->ptrfeed->ctrl = ctrl;
+ (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
+ return Success;
+}
+
+int
+ProcGetPointerControl(client)
+ ClientPtr client;
+{
+ register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
+ xGetPointerControlReply rep;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.threshold = ctrl->threshold;
+ rep.accelNumerator = ctrl->num;
+ rep.accelDenominator = ctrl->den;
+ WriteReplyToClient(client, sizeof(xGenericReply), &rep);
+ return Success;
+}
+
+void
+MaybeStopHint(dev, client)
+ register DeviceIntPtr dev;
+ ClientPtr client;
+{
+ GrabPtr grab = dev->grab;
+
+ if ((grab && SameClient(grab, client) &&
+ ((grab->eventMask & PointerMotionHintMask) ||
+ (grab->ownerEvents &&
+ (EventMaskForClient(dev->valuator->motionHintWindow, client) &
+ PointerMotionHintMask)))) ||
+ (!grab &&
+ (EventMaskForClient(dev->valuator->motionHintWindow, client) &
+ PointerMotionHintMask)))
+ dev->valuator->motionHintWindow = NullWindow;
+}
+
+int
+ProcGetMotionEvents(client)
+ ClientPtr client;
+{
+ WindowPtr pWin;
+ xTimecoord * coords = (xTimecoord *) NULL;
+ xGetMotionEventsReply rep;
+ int i, count, xmin, xmax, ymin, ymax;
+ unsigned long nEvents;
+ DeviceIntPtr mouse = inputInfo.pointer;
+ TimeStamp start, stop;
+ REQUEST(xGetMotionEventsReq);
+
+ REQUEST_SIZE_MATCH(xGetMotionEventsReq);
+ pWin = SecurityLookupWindow(stuff->window, client, TRUE);
+ if (!pWin)
+ return BadWindow;
+ if (mouse->valuator->motionHintWindow)
+ MaybeStopHint(mouse, client);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ nEvents = 0;
+ start = ClientTimeToServerTime(stuff->start);
+ stop = ClientTimeToServerTime(stuff->stop);
+ if ((CompareTimeStamps(start, stop) != LATER) &&
+ (CompareTimeStamps(start, currentTime) != LATER) &&
+ mouse->valuator->numMotionEvents)
+ {
+ if (CompareTimeStamps(stop, currentTime) == LATER)
+ stop = currentTime;
+ coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents
+ * sizeof(xTimecoord));
+ if (!coords)
+ return BadAlloc;
+ count = (*mouse->valuator->GetMotionProc) (mouse, coords,
+ start.milliseconds,
+ stop.milliseconds,
+ pWin->drawable.pScreen);
+ xmin = pWin->drawable.x - wBorderWidth (pWin);
+ xmax = pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth (pWin);
+ ymin = pWin->drawable.y - wBorderWidth (pWin);
+ ymax = pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin);
+ for (i = 0; i < count; i++)
+ if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
+ (ymin <= coords[i].y) && (coords[i].y < ymax))
+ {
+ coords[nEvents].time = coords[i].time;
+ coords[nEvents].x = coords[i].x - pWin->drawable.x;
+ coords[nEvents].y = coords[i].y - pWin->drawable.y;
+ nEvents++;
+ }
+ }
+ rep.length = nEvents * (sizeof(xTimecoord) >> 2);
+ rep.nEvents = nEvents;
+ WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
+ if (nEvents)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
+ WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
+ (char *)coords);
+ }
+ if (coords)
+ DEALLOCATE_LOCAL(coords);
+ return Success;
+}
+
+int
+ProcQueryKeymap(client)
+ ClientPtr client;
+{
+ xQueryKeymapReply rep;
+ int i;
+ CARD8 *down = inputInfo.keyboard->key->down;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 2;
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
+ {
+ bzero((char *)&rep.map[0], 32);
+ }
+ else
+#endif
+ for (i = 0; i<32; i++)
+ rep.map[i] = down[i];
+ WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
+ return Success;
+}
+
+/******************************************************************************
+ * The following entrypoints are provided for binary compatibility with
+ * previous versions (they make casts, where the current version changes types
+ * for more stringent prototype checking).
+ ******************************************************************************/
+#ifdef AddInputDevice
+#undef AddInputDevice
+
+#if NeedFunctionPrototypes
+DevicePtr
+AddInputDevice(
+ DeviceProc deviceProc,
+ Bool autoStart)
+#else
+DevicePtr
+AddInputDevice(deviceProc, autoStart)
+ DeviceProc deviceProc;
+ Bool autoStart;
+#endif
+{
+ return (DevicePtr)_AddInputDevice(deviceProc, autoStart);
+}
+#endif /* AddInputDevice */
+
+#ifdef RegisterPointerDevice
+#undef RegisterPointerDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterPointerDevice(DevicePtr device)
+#else
+void
+RegisterPointerDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterPointerDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterPointerDevice */
+
+#ifdef RegisterKeyboardDevice
+#undef RegisterKeyboardDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterKeyboardDevice(DevicePtr device)
+#else
+void
+RegisterKeyboardDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterKeyboardDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterKeyboardDevice */
diff --git a/xc/programs/Xserver/dix/dispatch.c b/xc/programs/Xserver/dix/dispatch.c
new file mode 100644
index 000000000..78d592fa7
--- /dev/null
+++ b/xc/programs/Xserver/dix/dispatch.c
@@ -0,0 +1,4086 @@
+/* $TOG: dispatch.c /main/196 1998/02/09 14:18:32 kaleb $ */
+/************************************************************
+
+Copyright 1987, 1989, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.14 1999/03/14 03:21:32 dawes Exp $ */
+
+#ifdef PANORAMIX_DEBUG
+#include <stdio.h>
+int ProcInitialConnection();
+#endif
+
+#include "windowstr.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "selection.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "opaque.h"
+#include "input.h"
+#include "servermd.h"
+#include "extnsionst.h"
+#include "dixfont.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
+#include "dixevents.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+#ifdef XAPPGROUP
+#include "Xagsrv.h"
+#endif
+#ifdef XKB
+#define XKB_IN_SERVER
+#include "inputstr.h"
+#include "XKBsrv.h"
+#endif
+
+#define mskcnt ((MAXCLIENTS + 31) / 32)
+#define BITMASK(i) (1 << ((i) & 31))
+#define MASKIDX(i) ((i) >> 5)
+#define MASKWORD(buf, i) buf[MASKIDX(i)]
+#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
+#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
+#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
+
+extern WindowPtr *WindowTable;
+extern xConnSetupPrefix connSetupPrefix;
+extern char *ConnectionInfo;
+extern void ReleaseActiveGrabs();
+extern void NotImplemented();
+extern void SwapConnClientPrefix(
+#if NeedFunctionPrototypes
+ xConnClientPrefix *
+#endif
+);
+
+Selection *CurrentSelections;
+int NumCurrentSelections;
+
+static ClientPtr grabClient;
+#define GrabNone 0
+#define GrabActive 1
+#define GrabKickout 2
+static int grabState = GrabNone;
+static long grabWaiters[mskcnt];
+CallbackListPtr ServerGrabCallback = NULL;
+HWEventQueuePtr checkForInput[2];
+extern int connBlockScreenStart;
+
+extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(), WriteSConnectionInfo();
+extern void WriteSConnSetupPrefix();
+
+static void KillAllClients(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+static void DeleteClientFromAnySelections(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/
+#endif
+);
+
+#ifdef LBX
+extern unsigned long StandardRequestLength();
+#endif
+
+static int nextFreeClientID; /* always MIN free client ID */
+
+static int nClients; /* number of authorized clients */
+
+CallbackListPtr ClientStateCallback;
+char dispatchException = 0;
+char isItTimeToYield;
+
+/* Various of the DIX function interfaces were not designed to allow
+ * the client->errorValue to be set on BadValue and other errors.
+ * Rather than changing interfaces and breaking untold code we introduce
+ * a new global that dispatch can use.
+ */
+XID clientErrorValue; /* XXX this is a kludge */
+
+#define SAME_SCREENS(a, b) (\
+ (a.pScreen == b.pScreen))
+
+void
+SetInputCheck(c0, c1)
+ HWEventQueuePtr c0, c1;
+{
+ checkForInput[0] = c0;
+ checkForInput[1] = c1;
+}
+
+void
+UpdateCurrentTime()
+{
+ TimeStamp systime;
+
+ /* To avoid time running backwards, we must call GetTimeInMillis before
+ * calling ProcessInputEvents.
+ */
+ systime.months = currentTime.months;
+ systime.milliseconds = GetTimeInMillis();
+ if (systime.milliseconds < currentTime.milliseconds)
+ systime.months++;
+ if (*checkForInput[0] != *checkForInput[1])
+ ProcessInputEvents();
+ if (CompareTimeStamps(systime, currentTime) == LATER)
+ currentTime = systime;
+}
+
+/* Like UpdateCurrentTime, but can't call ProcessInputEvents */
+void
+UpdateCurrentTimeIf()
+{
+ TimeStamp systime;
+
+ systime.months = currentTime.months;
+ systime.milliseconds = GetTimeInMillis();
+ if (systime.milliseconds < currentTime.milliseconds)
+ systime.months++;
+ if (*checkForInput[0] == *checkForInput[1])
+ currentTime = systime;
+}
+
+void
+InitSelections()
+{
+ if (CurrentSelections)
+ xfree(CurrentSelections);
+ CurrentSelections = (Selection *)NULL;
+ NumCurrentSelections = 0;
+}
+
+void
+FlushClientCaches(id)
+ XID id;
+{
+ int i;
+ register ClientPtr client;
+
+ client = clients[CLIENT_ID(id)];
+ if (client == NullClient)
+ return ;
+ for (i=0; i<currentMaxClients; i++)
+ {
+ client = clients[i];
+ if (client != NullClient)
+ {
+ if (client->lastDrawableID == id)
+ {
+ client->lastDrawableID = WindowTable[0]->drawable.id;
+ client->lastDrawable = (DrawablePtr)WindowTable[0];
+ }
+ else if (client->lastGCID == id)
+ {
+ client->lastGCID = INVALID;
+ client->lastGC = (GCPtr)NULL;
+ }
+ }
+ }
+}
+
+#define MAJOROP ((xReq *)client->requestBuffer)->reqType
+
+void
+Dispatch()
+{
+ register int *clientReady; /* array of request ready clients */
+ register int result;
+ register ClientPtr client;
+ register int nready;
+ register HWEventQueuePtr* icheck = checkForInput;
+
+ nextFreeClientID = 1;
+ InitSelections();
+ nClients = 0;
+
+ clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients);
+ if (!clientReady)
+ return;
+
+ while (!dispatchException)
+ {
+ if (*icheck[0] != *icheck[1])
+ {
+ ProcessInputEvents();
+ FlushIfCriticalOutputPending();
+ }
+
+ nready = WaitForSomething(clientReady);
+
+ /*****************
+ * Handle events in round robin fashion, doing input between
+ * each round
+ *****************/
+
+ while (!dispatchException && (--nready >= 0))
+ {
+ client = clients[clientReady[nready]];
+ if (! client)
+ {
+ /* KillClient can cause this to happen */
+ continue;
+ }
+ /* GrabServer activation can cause this to be true */
+ if (grabState == GrabKickout)
+ {
+ grabState = GrabActive;
+ break;
+ }
+ isItTimeToYield = FALSE;
+
+ requestingClient = client;
+ while (!isItTimeToYield)
+ {
+ if (*icheck[0] != *icheck[1])
+ {
+ ProcessInputEvents();
+ FlushIfCriticalOutputPending();
+ }
+
+ /* now, finally, deal with client requests */
+
+ result = ReadRequestFromClient(client);
+ if (result <= 0)
+ {
+ if (result < 0)
+ CloseDownClient(client);
+ break;
+ }
+
+ client->sequence++;
+#ifdef DEBUG
+ if (client->requestLogIndex == MAX_REQUEST_LOG)
+ client->requestLogIndex = 0;
+ client->requestLog[client->requestLogIndex] = MAJOROP;
+ client->requestLogIndex++;
+#endif
+ if (result > (MAX_BIG_REQUEST_SIZE << 2))
+ result = BadLength;
+ else
+ result = (* client->requestVector[MAJOROP])(client);
+
+ if (result != Success)
+ {
+ if (client->noClientException != Success)
+ CloseDownClient(client);
+ else
+ SendErrorToClient(client, MAJOROP,
+ MinorOpcodeOfRequest(client),
+ client->errorValue, result);
+ break;
+ }
+ }
+ FlushAllOutput();
+
+ requestingClient = NULL;
+ }
+ dispatchException &= ~DE_PRIORITYCHANGE;
+ }
+ KillAllClients();
+ DEALLOCATE_LOCAL(clientReady);
+ dispatchException &= ~DE_RESET;
+}
+
+#undef MAJOROP
+
+/*ARGSUSED*/
+int
+ProcBadRequest(client)
+ ClientPtr client;
+{
+ return (BadRequest);
+}
+
+int
+ProcCreateWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pParent, pWin;
+ REQUEST(xCreateWindowReq);
+ int result;
+ int len;
+
+ REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
+
+ LEGAL_NEW_RESOURCE(stuff->wid, client);
+ if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
+ SecurityWriteAccess)))
+ return BadWindow;
+ len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ pWin = CreateWindow(stuff->wid, pParent, stuff->x,
+ stuff->y, stuff->width, stuff->height,
+ stuff->borderWidth, stuff->class,
+ stuff->mask, (XID *) &stuff[1],
+ (int)stuff->depth,
+ client, stuff->visual, &result);
+ if (pWin)
+ {
+ Mask mask = pWin->eventMask;
+
+ pWin->eventMask = 0; /* subterfuge in case AddResource fails */
+ if (!AddResource(stuff->wid, RT_WINDOW, (pointer)pWin))
+ return BadAlloc;
+ pWin->eventMask = mask;
+ }
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
+
+int
+ProcChangeWindowAttributes(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xChangeWindowAttributesReq);
+ register int result;
+ int len;
+
+ REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
+ if (len != Ones(stuff->valueMask))
+ return BadLength;
+ result = ChangeWindowAttributes(pWin,
+ stuff->valueMask,
+ (XID *) &stuff[1],
+ client);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
+
+int
+ProcGetWindowAttributes(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+ xGetWindowAttributesReply wa;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ GetWindowAttributes(pWin, client, &wa);
+ WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
+ return(client->noClientException);
+}
+
+int
+ProcDestroyWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityDestroyAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (pWin->parent)
+ FreeResource(stuff->id, RT_NONE);
+ return(client->noClientException);
+}
+
+int
+ProcDestroySubwindows(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityDestroyAccess);
+ if (!pWin)
+ return(BadWindow);
+ DestroySubwindows(pWin, client);
+ return(client->noClientException);
+}
+
+int
+ProcChangeSaveSet(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xChangeSaveSetReq);
+ register int result;
+
+ REQUEST_SIZE_MATCH(xChangeSaveSetReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
+ return BadMatch;
+ if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
+ {
+ result = AlterSaveSetForClient(client, pWin, stuff->mode);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+ }
+ else
+ {
+ client->errorValue = stuff->mode;
+ return( BadValue );
+ }
+}
+
+int
+ProcReparentWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin, pParent;
+ REQUEST(xReparentWindowReq);
+ register int result;
+
+ REQUEST_SIZE_MATCH(xReparentWindowReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
+ SecurityWriteAccess);
+ if (!pParent)
+ return(BadWindow);
+ if (SAME_SCREENS(pWin->drawable, pParent->drawable))
+ {
+ if ((pWin->backgroundState == ParentRelative) &&
+ (pParent->drawable.depth != pWin->drawable.depth))
+ return BadMatch;
+ if ((pWin->drawable.class != InputOnly) &&
+ (pParent->drawable.class == InputOnly))
+ return BadMatch;
+ result = ReparentWindow(pWin, pParent,
+ (short)stuff->x, (short)stuff->y, client);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+ }
+ else
+ return (BadMatch);
+}
+
+int
+ProcMapWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ MapWindow(pWin, client);
+ /* update cache to say it is mapped */
+ return(client->noClientException);
+}
+
+int
+ProcMapSubwindows(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ MapSubwindows(pWin, client);
+ /* update cache to say it is mapped */
+ return(client->noClientException);
+}
+
+int
+ProcUnmapWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ UnmapWindow(pWin, FALSE);
+ /* update cache to say it is mapped */
+ return(client->noClientException);
+}
+
+int
+ProcUnmapSubwindows(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ UnmapSubwindows(pWin);
+ return(client->noClientException);
+}
+
+int
+ProcConfigureWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xConfigureWindowReq);
+ register int result;
+ int len;
+
+ REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
+ pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
+ if (Ones((Mask)stuff->mask) != len)
+ return BadLength;
+ result = ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1],
+ client);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
+
+int
+ProcCirculateWindow(client)
+ register ClientPtr client;
+{
+ register WindowPtr pWin;
+ REQUEST(xCirculateWindowReq);
+
+ REQUEST_SIZE_MATCH(xCirculateWindowReq);
+ if ((stuff->direction != RaiseLowest) &&
+ (stuff->direction != LowerHighest))
+ {
+ client->errorValue = stuff->direction;
+ return BadValue;
+ }
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ CirculateWindow(pWin, (int)stuff->direction, client);
+ return(client->noClientException);
+}
+
+int
+GetGeometry(client, rep)
+ register ClientPtr client;
+ xGetGeometryReply *rep;
+{
+ register DrawablePtr pDraw;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess);
+ rep->type = X_Reply;
+ rep->length = 0;
+ rep->sequenceNumber = client->sequence;
+ rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep->depth = pDraw->depth;
+ rep->width = pDraw->width;
+ rep->height = pDraw->height;
+
+ /* XXX - Because the pixmap-implementation of the multibuffer extension
+ * may have the buffer-id's drawable resource value be a pointer
+ * to the buffer's window instead of the buffer itself
+ * (this happens if the buffer is the displayed buffer),
+ * we also have to check that the id matches before we can
+ * truly say that it is a DRAWABLE_WINDOW.
+ */
+
+ if ((pDraw->type == UNDRAWABLE_WINDOW) ||
+ ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id)))
+ {
+ register WindowPtr pWin = (WindowPtr)pDraw;
+ rep->x = pWin->origin.x - wBorderWidth (pWin);
+ rep->y = pWin->origin.y - wBorderWidth (pWin);
+ rep->borderWidth = pWin->borderWidth;
+ }
+ else /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */
+ {
+ rep->x = rep->y = rep->borderWidth = 0;
+ }
+
+ return Success;
+}
+
+
+int
+ProcGetGeometry(client)
+ register ClientPtr client;
+{
+ xGetGeometryReply rep;
+ int status;
+
+ if ((status = GetGeometry(client, &rep)) != Success)
+ return status;
+
+ WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
+ return(client->noClientException);
+}
+
+
+int
+ProcQueryTree(client)
+ register ClientPtr client;
+{
+
+ xQueryTreeReply reply;
+ int numChildren = 0;
+ register WindowPtr pChild, pWin, pHead;
+ Window *childIDs = (Window *)NULL;
+#ifdef PANORAMIX
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int j, thisScreen;
+#endif
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ reply.type = X_Reply;
+ reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
+ reply.sequenceNumber = client->sequence;
+ if (pWin->parent)
+ reply.parent = pWin->parent->drawable.id;
+ else
+ reply.parent = (Window)None;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ thisScreen = 0;
+ for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
+ if ( pWin->winSize.extents.x1 < (panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)) {
+ thisScreen = j;
+ break;
+ }
+ }
+ }
+ if ( !noPanoramiXExtension && thisScreen ) {
+ PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ pWin = (WindowPtr)SecurityLookupWindow(pPanoramiXWin->info[thisScreen].id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ pHead = RealChildHead(pWin);
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ numChildren++;
+ if (numChildren)
+ {
+ int curChild = 0;
+ childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
+ if (!childIDs)
+ return BadAlloc;
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pChild->drawable.id, thisScreen);
+ IF_RETURN(!pPanoramiXWin, BadWindow);
+ childIDs[curChild++] = pPanoramiXWin->info[0].id;
+ }
+ } /* numChildren */
+ }else { /* otherwise its screen 0, and nothing changes */
+ pHead = RealChildHead(pWin);
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ numChildren++;
+ if (numChildren)
+ {
+ int curChild = 0;
+
+ childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
+ if (!childIDs)
+ return BadAlloc;
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ childIDs[curChild++] = pChild->drawable.id;
+ }
+ }
+#else
+ pHead = RealChildHead(pWin);
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ numChildren++;
+ if (numChildren)
+ {
+ int curChild = 0;
+
+ childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window));
+ if (!childIDs)
+ return BadAlloc;
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ childIDs[curChild++] = pChild->drawable.id;
+ }
+#endif
+
+ reply.nChildren = numChildren;
+ reply.length = (numChildren * sizeof(Window)) >> 2;
+
+ WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
+ if (numChildren)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
+ DEALLOCATE_LOCAL(childIDs);
+ }
+
+ return(client->noClientException);
+}
+
+int
+ProcInternAtom(client)
+ register ClientPtr client;
+{
+ Atom atom;
+ char *tchar;
+ REQUEST(xInternAtomReq);
+
+ REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes);
+ if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse))
+ {
+ client->errorValue = stuff->onlyIfExists;
+ return(BadValue);
+ }
+ tchar = (char *) &stuff[1];
+ atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
+ if (atom != BAD_RESOURCE)
+ {
+ xInternAtomReply reply;
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.atom = atom;
+ WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
+ return(client->noClientException);
+ }
+ else
+ return (BadAlloc);
+}
+
+int
+ProcGetAtomName(client)
+ register ClientPtr client;
+{
+ char *str;
+ xGetAtomNameReply reply;
+ int len;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ if ( (str = NameForAtom(stuff->id)) )
+ {
+ len = strlen(str);
+ reply.type = X_Reply;
+ reply.length = (len + 3) >> 2;
+ reply.sequenceNumber = client->sequence;
+ reply.nameLength = len;
+ WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
+ (void)WriteToClient(client, len, str);
+ return(client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadAtom);
+ }
+}
+
+#ifdef K5AUTH
+extern int k5_bad();
+#endif
+
+int
+ProcSetSelectionOwner(client)
+ register ClientPtr client;
+{
+ WindowPtr pWin;
+ TimeStamp time;
+ REQUEST(xSetSelectionOwnerReq);
+
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+ UpdateCurrentTime();
+ time = ClientTimeToServerTime(stuff->time);
+
+ /* If the client's time stamp is in the future relative to the server's
+ time stamp, do not set the selection, just return success. */
+ if (CompareTimeStamps(time, currentTime) == LATER)
+ return Success;
+ if (stuff->window != None)
+ {
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ }
+ else
+ pWin = (WindowPtr)None;
+ if (ValidAtom(stuff->selection))
+ {
+ int i = 0;
+
+ /*
+ * First, see if the selection is already set...
+ */
+ while ((i < NumCurrentSelections) &&
+ CurrentSelections[i].selection != stuff->selection)
+ i++;
+ if (i < NumCurrentSelections)
+ {
+ xEvent event;
+
+ /* If the timestamp in client's request is in the past relative
+ to the time stamp indicating the last time the owner of the
+ selection was set, do not set the selection, just return
+ success. */
+ if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged)
+ == EARLIER)
+ return Success;
+ if (CurrentSelections[i].client &&
+ (!pWin || (CurrentSelections[i].client != client)))
+ {
+ event.u.u.type = SelectionClear;
+ event.u.selectionClear.time = time.milliseconds;
+ event.u.selectionClear.window = CurrentSelections[i].window;
+ event.u.selectionClear.atom = CurrentSelections[i].selection;
+ (void) TryClientEvents (CurrentSelections[i].client, &event, 1,
+ NoEventMask, NoEventMask /* CantBeFiltered */,
+ NullGrab);
+ }
+ }
+ else
+ {
+ /*
+ * It doesn't exist, so add it...
+ */
+ Selection *newsels;
+
+ if (i == 0)
+ newsels = (Selection *)xalloc(sizeof(Selection));
+ else
+ newsels = (Selection *)xrealloc(CurrentSelections,
+ (NumCurrentSelections + 1) * sizeof(Selection));
+ if (!newsels)
+ return BadAlloc;
+ NumCurrentSelections++;
+ CurrentSelections = newsels;
+ CurrentSelections[i].selection = stuff->selection;
+ }
+ CurrentSelections[i].lastTimeChanged = time;
+ CurrentSelections[i].window = stuff->window;
+ CurrentSelections[i].pWin = pWin;
+ CurrentSelections[i].client = (pWin ? client : NullClient);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->selection;
+ return (BadAtom);
+ }
+}
+
+int
+ProcGetSelectionOwner(client)
+ register ClientPtr client;
+{
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ if (ValidAtom(stuff->id))
+ {
+ int i;
+ xGetSelectionOwnerReply reply;
+
+ i = 0;
+ while ((i < NumCurrentSelections) &&
+ CurrentSelections[i].selection != stuff->id) i++;
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ if (i < NumCurrentSelections)
+ reply.owner = CurrentSelections[i].window;
+ else
+ reply.owner = None;
+ WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply);
+ return(client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadAtom);
+ }
+}
+
+int
+ProcConvertSelection(client)
+ register ClientPtr client;
+{
+ Bool paramsOkay;
+ xEvent event;
+ WindowPtr pWin;
+ REQUEST(xConvertSelectionReq);
+
+ REQUEST_SIZE_MATCH(xConvertSelectionReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+
+ paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
+ if (stuff->property != None)
+ paramsOkay &= ValidAtom(stuff->property);
+ if (paramsOkay)
+ {
+ int i;
+
+ i = 0;
+ while ((i < NumCurrentSelections) &&
+ CurrentSelections[i].selection != stuff->selection) i++;
+ if ((i < NumCurrentSelections) &&
+ (CurrentSelections[i].window != None)
+#ifdef XCSECURITY
+ && (!client->CheckAccess ||
+ (* client->CheckAccess)(client, CurrentSelections[i].window,
+ RT_WINDOW, SecurityReadAccess,
+ CurrentSelections[i].pWin))
+#endif
+ )
+ {
+ event.u.u.type = SelectionRequest;
+ event.u.selectionRequest.time = stuff->time;
+ event.u.selectionRequest.owner =
+ CurrentSelections[i].window;
+ event.u.selectionRequest.requestor = stuff->requestor;
+ event.u.selectionRequest.selection = stuff->selection;
+ event.u.selectionRequest.target = stuff->target;
+ event.u.selectionRequest.property = stuff->property;
+ if (TryClientEvents(
+ CurrentSelections[i].client, &event, 1, NoEventMask,
+ NoEventMask /* CantBeFiltered */, NullGrab))
+ return (client->noClientException);
+ }
+ event.u.u.type = SelectionNotify;
+ event.u.selectionNotify.time = stuff->time;
+ event.u.selectionNotify.requestor = stuff->requestor;
+ event.u.selectionNotify.selection = stuff->selection;
+ event.u.selectionNotify.target = stuff->target;
+ event.u.selectionNotify.property = None;
+ (void) TryClientEvents(client, &event, 1, NoEventMask,
+ NoEventMask /* CantBeFiltered */, NullGrab);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->property;
+ return (BadAtom);
+ }
+}
+
+int
+ProcGrabServer(client)
+ register ClientPtr client;
+{
+ REQUEST_SIZE_MATCH(xReq);
+ if (grabState != GrabNone && client != grabClient)
+ {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ BITSET(grabWaiters, client->index);
+ IgnoreClient(client);
+ return(client->noClientException);
+ }
+ OnlyListenToOneClient(client);
+ grabState = GrabKickout;
+ grabClient = client;
+
+ if (ServerGrabCallback)
+ {
+ ServerGrabInfoRec grabinfo;
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_GRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
+ }
+
+ return(client->noClientException);
+}
+
+static void
+#if NeedFunctionPrototypes
+UngrabServer(ClientPtr client)
+#else
+UngrabServer(client)
+ ClientPtr client;
+#endif
+{
+ int i;
+
+ grabState = GrabNone;
+ ListenToAllClients();
+ for (i = mskcnt; --i >= 0 && !grabWaiters[i]; )
+ ;
+ if (i >= 0)
+ {
+ i <<= 5;
+ while (!GETBIT(grabWaiters, i))
+ i++;
+ BITCLEAR(grabWaiters, i);
+ AttendClient(clients[i]);
+ }
+
+ if (ServerGrabCallback)
+ {
+ ServerGrabInfoRec grabinfo;
+ grabinfo.client = client;
+ grabinfo.grabstate = SERVER_UNGRABBED;
+ CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo);
+ }
+}
+
+int
+ProcUngrabServer(client)
+ register ClientPtr client;
+{
+ REQUEST_SIZE_MATCH(xReq);
+ UngrabServer(client);
+ return(client->noClientException);
+}
+
+int
+ProcTranslateCoords(client)
+ register ClientPtr client;
+{
+ REQUEST(xTranslateCoordsReq);
+
+ register WindowPtr pWin, pDst;
+ xTranslateCoordsReply rep;
+
+ REQUEST_SIZE_MATCH(xTranslateCoordsReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
+ SecurityReadAccess);
+ if (!pDst)
+ return(BadWindow);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!SAME_SCREENS(pWin->drawable, pDst->drawable))
+ {
+ rep.sameScreen = xFalse;
+ rep.child = None;
+ rep.dstX = rep.dstY = 0;
+ }
+ else
+ {
+ INT16 x, y;
+ rep.sameScreen = xTrue;
+ rep.child = None;
+ /* computing absolute coordinates -- adjust to destination later */
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
+ pWin = pDst->firstChild;
+ while (pWin)
+ {
+#ifdef SHAPE
+ BoxRec box;
+#endif
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth (pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
+ (y < pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin))
+#ifdef SHAPE
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ POINT_IN_REGION(pWin->drawable.pScreen,
+ &pWin->borderSize, x, y, &box))
+#endif
+ )
+ {
+ rep.child = pWin->drawable.id;
+ pWin = (WindowPtr) NULL;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ /* adjust to destination coordinates */
+ rep.dstX = x - pDst->drawable.x;
+ rep.dstY = y - pDst->drawable.y;
+ }
+ WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
+ return(client->noClientException);
+}
+
+int
+ProcOpenFont(client)
+ register ClientPtr client;
+{
+ int err;
+ REQUEST(xOpenFontReq);
+
+ REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes);
+ client->errorValue = stuff->fid;
+ LEGAL_NEW_RESOURCE(stuff->fid, client);
+ err = OpenFont(client, stuff->fid, (Mask) 0,
+ stuff->nbytes, (char *)&stuff[1]);
+ if (err == Success)
+ {
+ return(client->noClientException);
+ }
+ else
+ return err;
+}
+
+int
+ProcCloseFont(client)
+ register ClientPtr client;
+{
+ FontPtr pFont;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
+ SecurityDestroyAccess);
+ if ( pFont != (FontPtr)NULL) /* id was valid */
+ {
+ FreeResource(stuff->id, RT_NONE);
+ return(client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadFont);
+ }
+}
+
+int
+ProcQueryFont(client)
+ register ClientPtr client;
+{
+ xQueryFontReply *reply;
+ FontPtr pFont;
+ register GC *pGC;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ client->errorValue = stuff->id; /* EITHER font or gc */
+ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
+ SecurityReadAccess);
+ if (!pFont)
+ {
+ /* can't use VERIFY_GC because it might return BadGC */
+ pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
+ SecurityReadAccess);
+ if (!pGC)
+ {
+ client->errorValue = stuff->id;
+ return(BadFont); /* procotol spec says only error is BadFont */
+ }
+ pFont = pGC->font;
+ }
+
+ {
+ xCharInfo *pmax = FONTINKMAX(pFont);
+ xCharInfo *pmin = FONTINKMIN(pFont);
+ int nprotoxcistructs;
+ int rlength;
+
+ nprotoxcistructs = (
+ pmax->rightSideBearing == pmin->rightSideBearing &&
+ pmax->leftSideBearing == pmin->leftSideBearing &&
+ pmax->descent == pmin->descent &&
+ pmax->ascent == pmin->ascent &&
+ pmax->characterWidth == pmin->characterWidth) ?
+ 0 : N2dChars(pFont);
+
+ rlength = sizeof(xQueryFontReply) +
+ FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
+ nprotoxcistructs * sizeof(xCharInfo);
+ reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength);
+ if(!reply)
+ {
+ return(BadAlloc);
+ }
+
+ reply->type = X_Reply;
+ reply->length = (rlength - sizeof(xGenericReply)) >> 2;
+ reply->sequenceNumber = client->sequence;
+ QueryFont( pFont, reply, nprotoxcistructs);
+
+ WriteReplyToClient(client, rlength, reply);
+ DEALLOCATE_LOCAL(reply);
+ return(client->noClientException);
+ }
+}
+
+int
+ProcQueryTextExtents(client)
+ register ClientPtr client;
+{
+ REQUEST(xQueryTextExtentsReq);
+ xQueryTextExtentsReply reply;
+ FontPtr pFont;
+ GC *pGC;
+ ExtentInfoRec info;
+ unsigned long length;
+
+ REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
+
+ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT,
+ SecurityReadAccess);
+ if (!pFont)
+ {
+ pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC,
+ SecurityReadAccess);
+ if (!pGC)
+ {
+ client->errorValue = stuff->fid;
+ return(BadFont);
+ }
+ pFont = pGC->font;
+ }
+ length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2);
+ length = length << 1;
+ if (stuff->oddLength)
+ {
+ if (length == 0)
+ return(BadLength);
+ length--;
+ }
+ if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info))
+ return(BadAlloc);
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.drawDirection = info.drawDirection;
+ reply.fontAscent = info.fontAscent;
+ reply.fontDescent = info.fontDescent;
+ reply.overallAscent = info.overallAscent;
+ reply.overallDescent = info.overallDescent;
+ reply.overallWidth = info.overallWidth;
+ reply.overallLeft = info.overallLeft;
+ reply.overallRight = info.overallRight;
+ WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
+ return(client->noClientException);
+}
+
+int
+ProcListFonts(client)
+ register ClientPtr client;
+{
+ REQUEST(xListFontsReq);
+
+ REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
+
+ return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
+ stuff->maxNames);
+}
+
+int
+ProcListFontsWithInfo(client)
+ register ClientPtr client;
+{
+ REQUEST(xListFontsWithInfoReq);
+
+ REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes);
+
+ return StartListFontsWithInfo(client, stuff->nbytes,
+ (unsigned char *) &stuff[1], stuff->maxNames);
+}
+
+/*ARGSUSED*/
+int
+dixDestroyPixmap(value, pid)
+ pointer value; /* must conform to DeleteType */
+ XID pid;
+{
+ PixmapPtr pPixmap = (PixmapPtr)value;
+ return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
+}
+
+int
+ProcCreatePixmap(client)
+ register ClientPtr client;
+{
+ PixmapPtr pMap;
+ register DrawablePtr pDraw;
+ REQUEST(xCreatePixmapReq);
+ DepthPtr pDepth;
+ register int i;
+
+ REQUEST_SIZE_MATCH(xCreatePixmapReq);
+ client->errorValue = stuff->pid;
+ LEGAL_NEW_RESOURCE(stuff->pid, client);
+ SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
+ SecurityReadAccess);
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ if (stuff->depth != 1)
+ {
+ pDepth = pDraw->pScreen->allowedDepths;
+ for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
+ return BadValue;
+ }
+CreatePmap:
+ pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap)
+ (pDraw->pScreen, stuff->width,
+ stuff->height, stuff->depth);
+ if (pMap)
+ {
+ pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pMap->drawable.id = stuff->pid;
+ if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
+ return(client->noClientException);
+ }
+ return (BadAlloc);
+}
+
+int
+ProcFreePixmap(client)
+ register ClientPtr client;
+{
+ PixmapPtr pMap;
+
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP,
+ SecurityDestroyAccess);
+ if (pMap)
+ {
+ FreeResource(stuff->id, RT_NONE);
+ return(client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadPixmap);
+ }
+}
+
+int
+ProcCreateGC(client)
+ register ClientPtr client;
+{
+ int error;
+ GC *pGC;
+ register DrawablePtr pDraw;
+ unsigned len;
+ REQUEST(xCreateGCReq);
+
+ REQUEST_AT_LEAST_SIZE(xCreateGCReq);
+ client->errorValue = stuff->gc;
+ LEGAL_NEW_RESOURCE(stuff->gc, client);
+ SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client,
+ SecurityReadAccess);
+ len = client->req_len - (sizeof(xCreateGCReq) >> 2);
+ if (len != Ones(stuff->mask))
+ return BadLength;
+ pGC = (GC *)CreateGC(pDraw, stuff->mask,
+ (XID *) &stuff[1], &error);
+ if (error != Success)
+ return error;
+ if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
+ return (BadAlloc);
+ return(client->noClientException);
+}
+
+int
+ProcChangeGC(client)
+ register ClientPtr client;
+{
+ GC *pGC;
+ REQUEST(xChangeGCReq);
+ int result;
+ unsigned len;
+
+ REQUEST_AT_LEAST_SIZE(xChangeGCReq);
+ SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess);
+ len = client->req_len - (sizeof(xChangeGCReq) >> 2);
+ if (len != Ones(stuff->mask))
+ return BadLength;
+
+ result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return(result);
+ }
+}
+
+int
+ProcCopyGC(client)
+ register ClientPtr client;
+{
+ register GC *dstGC;
+ register GC *pGC;
+ int result;
+ REQUEST(xCopyGCReq);
+
+ REQUEST_SIZE_MATCH(xCopyGCReq);
+ SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, SecurityReadAccess);
+ SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, SecurityWriteAccess);
+ if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
+ return (BadMatch);
+ result = CopyGC(pGC, dstGC, stuff->mask);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return(result);
+ }
+}
+
+int
+ProcSetDashes(client)
+ register ClientPtr client;
+{
+ register GC *pGC;
+ int result;
+ REQUEST(xSetDashesReq);
+
+ REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
+ if (stuff->nDashes == 0)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+
+ SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess);
+
+ result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
+ (unsigned char *)&stuff[1]);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return(result);
+ }
+}
+
+int
+ProcSetClipRectangles(client)
+ register ClientPtr client;
+{
+ int nr;
+ int result;
+ register GC *pGC;
+ REQUEST(xSetClipRectanglesReq);
+
+ REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
+ if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
+ (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
+ {
+ client->errorValue = stuff->ordering;
+ return BadValue;
+ }
+ SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess);
+
+ nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
+ if (nr & 4)
+ return(BadLength);
+ nr >>= 3;
+ result = SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
+ nr, (xRectangle *)&stuff[1], (int)stuff->ordering);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
+
+int
+ProcFreeGC(client)
+ register ClientPtr client;
+{
+ register GC *pGC;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess);
+ FreeResource(stuff->id, RT_NONE);
+ return(client->noClientException);
+}
+
+int
+ProcClearToBackground(client)
+ register ClientPtr client;
+{
+ REQUEST(xClearAreaReq);
+ register WindowPtr pWin;
+
+ REQUEST_SIZE_MATCH(xClearAreaReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (pWin->drawable.class == InputOnly)
+ {
+ client->errorValue = stuff->window;
+ return (BadMatch);
+ }
+ if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
+ {
+ client->errorValue = stuff->exposures;
+ return(BadValue);
+ }
+ (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,
+ stuff->width, stuff->height,
+ (Bool)stuff->exposures);
+ return(client->noClientException);
+}
+
+int
+ProcCopyArea(client)
+ register ClientPtr client;
+{
+ register DrawablePtr pDst;
+ register DrawablePtr pSrc;
+ register GC *pGC;
+ REQUEST(xCopyAreaReq);
+ RegionPtr pRgn;
+
+ REQUEST_SIZE_MATCH(xCopyAreaReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable)
+ {
+ SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
+ {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ }
+ else
+ pSrc = pDst;
+
+ SET_DBE_SRCBUF(pSrc, stuff->srcDrawable);
+
+ pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
+ if (pGC->graphicsExposures)
+ {
+ (*pDst->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
+ if (pRgn)
+ REGION_DESTROY(pDst->pScreen, pRgn);
+ }
+
+ return(client->noClientException);
+}
+
+int
+ProcCopyPlane(client)
+ register ClientPtr client;
+{
+ register DrawablePtr psrcDraw, pdstDraw;
+ register GC *pGC;
+ REQUEST(xCopyPlaneReq);
+ RegionPtr pRgn;
+
+ REQUEST_SIZE_MATCH(xCopyPlaneReq);
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable)
+ {
+ SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if (pdstDraw->pScreen != psrcDraw->pScreen)
+ {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ }
+ else
+ psrcDraw = pdstDraw;
+
+ SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable);
+
+ /* Check to see if stuff->bitPlane has exactly ONE good bit set */
+ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ (stuff->bitPlane > (1L << (psrcDraw->depth - 1))))
+ {
+ client->errorValue = stuff->bitPlane;
+ return(BadValue);
+ }
+
+ pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY, stuff->bitPlane);
+ if (pGC->graphicsExposures)
+ {
+ (*pdstDraw->pScreen->SendGraphicsExpose)
+ (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
+ if (pRgn)
+ REGION_DESTROY(pdstDraw->pScreen, pRgn);
+ }
+ return(client->noClientException);
+}
+
+int
+ProcPolyPoint(client)
+ register ClientPtr client;
+{
+ int npoint;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyPointReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyPointReq);
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious))
+ {
+ client->errorValue = stuff->coordMode;
+ return BadValue;
+ }
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
+ if (npoint)
+ (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
+ (xPoint *) &stuff[1]);
+ return (client->noClientException);
+}
+
+int
+ProcPolyLine(client)
+ register ClientPtr client;
+{
+ int npoint;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyLineReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyLineReq);
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious))
+ {
+ client->errorValue = stuff->coordMode;
+ return BadValue;
+ }
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
+ if (npoint > 1)
+ (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
+ (DDXPointPtr) &stuff[1]);
+ return(client->noClientException);
+}
+
+int
+ProcPolySegment(client)
+ register ClientPtr client;
+{
+ int nsegs;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolySegmentReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
+ if (nsegs & 4)
+ return(BadLength);
+ nsegs >>= 3;
+ if (nsegs)
+ (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
+ return (client->noClientException);
+}
+
+int
+ProcPolyRectangle (client)
+ register ClientPtr client;
+{
+ int nrects;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyRectangleReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
+ if (nrects & 4)
+ return(BadLength);
+ nrects >>= 3;
+ if (nrects)
+ (*pGC->ops->PolyRectangle)(pDraw, pGC,
+ nrects, (xRectangle *) &stuff[1]);
+ return(client->noClientException);
+}
+
+int
+ProcPolyArc(client)
+ register ClientPtr client;
+{
+ int narcs;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyArcReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyArcReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
+ if (narcs % sizeof(xArc))
+ return(BadLength);
+ narcs /= sizeof(xArc);
+ if (narcs)
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
+ return (client->noClientException);
+}
+
+int
+ProcFillPoly(client)
+ register ClientPtr client;
+{
+ int things;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xFillPolyReq);
+
+ REQUEST_AT_LEAST_SIZE(xFillPolyReq);
+ if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) &&
+ (stuff->shape != Convex))
+ {
+ client->errorValue = stuff->shape;
+ return BadValue;
+ }
+ if ((stuff->coordMode != CoordModeOrigin) &&
+ (stuff->coordMode != CoordModePrevious))
+ {
+ client->errorValue = stuff->coordMode;
+ return BadValue;
+ }
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
+ if (things)
+ (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
+ stuff->coordMode, things,
+ (DDXPointPtr) &stuff[1]);
+ return(client->noClientException);
+}
+
+int
+ProcPolyFillRectangle(client)
+ register ClientPtr client;
+{
+ int things;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyFillRectangleReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
+ if (things & 4)
+ return(BadLength);
+ things >>= 3;
+ if (things)
+ (*pGC->ops->PolyFillRect) (pDraw, pGC, things,
+ (xRectangle *) &stuff[1]);
+ return (client->noClientException);
+}
+
+int
+ProcPolyFillArc(client)
+ register ClientPtr client;
+{
+ int narcs;
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ REQUEST(xPolyFillArcReq);
+
+ REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
+ if (narcs % sizeof(xArc))
+ return(BadLength);
+ narcs /= sizeof(xArc);
+ if (narcs)
+ (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
+ return (client->noClientException);
+}
+
+/* 64-bit server notes: the protocol restricts padding of images to
+ * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
+ * to use internally. Removes need for internal alignment checking.
+ * All of the PutImage functions could be changed individually, but
+ * as currently written, they call other routines which require things
+ * to be 64-bit padded on scanlines, so we changed things here.
+ * If an image would be padded differently for 64- versus 32-, then
+ * copy each scanline to a 64-bit padded scanline.
+ * Also, we need to make sure that the image is aligned on a 64-bit
+ * boundary, even if the scanlines are padded to our satisfaction.
+ */
+int
+ProcPutImage(client)
+ register ClientPtr client;
+{
+ register GC *pGC;
+ register DrawablePtr pDraw;
+ long length; /* length of scanline server padded */
+ long lengthProto; /* length of scanline protocol padded */
+ char *tmpImage;
+ REQUEST(xPutImageReq);
+
+ REQUEST_AT_LEAST_SIZE(xPutImageReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ if (stuff->format == XYBitmap)
+ {
+ if ((stuff->depth != 1) ||
+ (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
+ return BadMatch;
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
+#endif
+ }
+ else if (stuff->format == XYPixmap)
+ {
+ if ((pDraw->depth != stuff->depth) ||
+ (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
+ return BadMatch;
+ length = BitmapBytePad(stuff->width + stuff->leftPad);
+ length *= stuff->depth;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
+ lengthProto *= stuff->depth;
+#endif
+ }
+ else if (stuff->format == ZPixmap)
+ {
+ if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
+ return BadMatch;
+ length = PixmapBytePad(stuff->width, stuff->depth);
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ lengthProto = PixmapBytePadProto(stuff->width, stuff->depth);
+#endif
+ }
+ else
+ {
+ client->errorValue = stuff->format;
+ return BadValue;
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* handle 64 bit case where protocol may pad to 32 and we want 64 */
+ if ( length != lengthProto ) {
+ register int i;
+ char * stuffptr, /* pointer into protocol data */
+ * tmpptr; /* new location to copy to */
+
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
+ return (BadAlloc);
+
+ bzero(tmpImage,length*stuff->height);
+
+ if ( stuff->format == XYPixmap ) {
+ int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad);
+ int lineBytesProto =
+ BitmapBytePadProto(stuff->width + stuff->leftPad);
+ int depth = stuff->depth;
+
+ stuffptr = (char *)&stuff[1];
+ tmpptr = tmpImage;
+ for ( i = 0; i < stuff->height*stuff->depth;
+ stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
+ memmove(tmpptr,stuffptr,lineBytesProto);
+ }
+ else {
+ for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage;
+ i < stuff->height;
+ stuffptr += lengthProto,tmpptr += length, i++)
+ memmove(tmpptr,stuffptr,lengthProto);
+ }
+ }
+
+ /* handle 64-bit case where stuff is not 64-bit aligned */
+ else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) {
+ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
+ return (BadAlloc);
+ memmove(tmpImage,(char *)&stuff[1],length*stuff->height);
+ }
+ else
+ tmpImage = (char *)&stuff[1];
+#else
+ tmpImage = (char *)&stuff[1];
+ lengthProto = length;
+#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+
+ if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) +
+ (sizeof(xPutImageReq) >> 2)) != client->req_len)
+ return BadLength;
+
+ (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
+ stuff->width, stuff->height,
+ stuff->leftPad, stuff->format, tmpImage);
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* free up our temporary space if used */
+ if (tmpImage != (char *)&stuff[1])
+ DEALLOCATE_LOCAL(tmpImage);
+#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+
+ return (client->noClientException);
+}
+
+
+int
+DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
+ register ClientPtr client;
+ Drawable drawable;
+ int format;
+ int x, y, width, height;
+ Mask planemask;
+ xGetImageReply **im_return;
+{
+ register DrawablePtr pDraw;
+ int nlines, linesPerBuf;
+ register int linesDone;
+ long widthBytesLine, length;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ long widthBytesLineProto, lengthProto;
+#endif
+ Mask plane;
+ char *pBuf;
+ xGetImageReply xgi;
+ RegionPtr pVisibleRegion = NULL;
+
+ if ((format != XYPixmap) && (format != ZPixmap))
+ {
+ client->errorValue = format;
+ return(BadValue);
+ }
+ SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess);
+ if(pDraw->type == DRAWABLE_WINDOW)
+ {
+ if( /* check for being viewable */
+ !((WindowPtr) pDraw)->realized ||
+ /* check for being on screen */
+ pDraw->x + x < 0 ||
+ pDraw->x + x + width > pDraw->pScreen->width ||
+ pDraw->y + y < 0 ||
+ pDraw->y + y + height > pDraw->pScreen->height ||
+ /* check for being inside of border */
+ x < - wBorderWidth((WindowPtr)pDraw) ||
+ x + width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ y < -wBorderWidth((WindowPtr)pDraw) ||
+ y + height > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height
+ )
+ return(BadMatch);
+ xgi.visual = wVisual (((WindowPtr) pDraw));
+ }
+ else
+ {
+ if(x < 0 ||
+ x+width > (int)pDraw->width ||
+ y < 0 ||
+ y+height > (int)pDraw->height
+ )
+ return(BadMatch);
+ xgi.visual = None;
+ }
+
+ SET_DBE_SRCBUF(pDraw, drawable);
+
+ xgi.type = X_Reply;
+ xgi.sequenceNumber = client->sequence;
+ xgi.depth = pDraw->depth;
+ if(format == ZPixmap)
+ {
+ widthBytesLine = PixmapBytePad(width, pDraw->depth);
+ length = widthBytesLine * height;
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth);
+ lengthProto = widthBytesLineProto * height;
+#endif
+ }
+ else
+ {
+ widthBytesLine = BitmapBytePad(width);
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ /* only planes asked for */
+ length = widthBytesLine * height *
+ Ones(planemask & (plane | (plane - 1)));
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ widthBytesLineProto = BitmapBytePadProto(width);
+ lengthProto = widthBytesLineProto * height *
+ Ones(planemask & (plane | (plane - 1)));
+#endif
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ xgi.length = lengthProto;
+#else
+ xgi.length = length;
+#endif
+
+ if (im_return) {
+ pBuf = (char *)xalloc(sz_xGetImageReply + length);
+ if (!pBuf)
+ return (BadAlloc);
+ if (widthBytesLine == 0)
+ linesPerBuf = 0;
+ else
+ linesPerBuf = height;
+ *im_return = (xGetImageReply *)pBuf;
+ *(xGetImageReply *)pBuf = xgi;
+ pBuf += sz_xGetImageReply;
+ } else {
+ xgi.length = (xgi.length + 3) >> 2;
+ if (widthBytesLine == 0 || height == 0)
+ linesPerBuf = 0;
+ else if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else
+ {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height)
+ {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) &&
+ (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
+ {
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
+ while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))
+ {
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ if(!(pBuf = (char *) ALLOCATE_LOCAL(length)))
+ return (BadAlloc);
+ WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
+ }
+
+#ifdef XCSECURITY
+ if (client->trustLevel != XSecurityClientTrusted &&
+ pDraw->type == DRAWABLE_WINDOW)
+ {
+ pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);
+ if (pVisibleRegion)
+ {
+ REGION_TRANSLATE(pScreen, pVisibleRegion, -pDraw->x, -pDraw->y);
+ }
+ }
+#endif
+
+ if (linesPerBuf == 0)
+ {
+ /* nothing to do */
+ }
+ else if (format == ZPixmap)
+ {
+ linesDone = 0;
+ while (height - linesDone > 0)
+ {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
+ format,
+ planemask,
+ (pointer) pBuf);
+#ifdef XCSECURITY
+ if (pVisibleRegion)
+ SecurityCensorImage(client, pVisibleRegion, widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
+#endif
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* for 64-bit server, convert image to pad to 32 bits */
+ if ( widthBytesLine != widthBytesLineProto ) {
+ register char * bufPtr, * protoPtr;
+ register int i;
+
+ for (i = 1,
+ bufPtr = pBuf + widthBytesLine,
+ protoPtr = pBuf + widthBytesLineProto;
+ i < nlines;
+ bufPtr += widthBytesLine,
+ protoPtr += widthBytesLineProto,
+ i++)
+ memmove(protoPtr, bufPtr, widthBytesLineProto);
+ }
+#endif
+ /* Note that this is NOT a call to WriteSwappedDataToClient,
+ as we do NOT byte swap */
+ if (!im_return)
+/* Don't split me, gcc pukes when you do */
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLineProto),
+ pBuf);
+#else
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
+#endif
+ linesDone += nlines;
+ }
+ }
+ else /* XYPixmap */
+ {
+ for (; plane; plane >>= 1)
+ {
+ if (planemask & plane)
+ {
+ linesDone = 0;
+ while (height - linesDone > 0)
+ {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ x,
+ y + linesDone,
+ width,
+ nlines,
+ format,
+ plane,
+ (pointer)pBuf);
+#ifdef XCSECURITY
+ if (pVisibleRegion)
+ SecurityCensorImage(client, pVisibleRegion,
+ widthBytesLine,
+ pDraw, x, y + linesDone, width,
+ nlines, format, pBuf);
+#endif
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* for 64-bit server, convert image to pad to 32 bits */
+ if ( widthBytesLine != widthBytesLineProto ) {
+ register char * bufPtr, * protoPtr;
+ register int i;
+
+ for (i = 1,
+ bufPtr = pBuf + widthBytesLine,
+ protoPtr = pBuf + widthBytesLineProto;
+ i < nlines;
+ bufPtr += widthBytesLine,
+ protoPtr += widthBytesLineProto,
+ i++)
+ memmove(protoPtr, bufPtr, widthBytesLineProto);
+ }
+#endif
+ /* Note: NOT a call to WriteSwappedDataToClient,
+ as we do NOT byte swap */
+ if (im_return) {
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ pBuf += nlines * widthBytesLineProto;
+#else
+ pBuf += nlines * widthBytesLine;
+#endif
+ } else
+/* Don't split me, gcc pukes when you do */
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLineProto),
+ pBuf);
+#else
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
+#endif
+ linesDone += nlines;
+ }
+ }
+ }
+ }
+#ifdef XCSECURITY
+ if (pVisibleRegion)
+ REGION_DESTROY(pScreen, pVisibleRegion);
+#endif
+ if (!im_return)
+ DEALLOCATE_LOCAL(pBuf);
+ return (client->noClientException);
+}
+
+int
+ProcGetImage(client)
+ register ClientPtr client;
+{
+ REQUEST(xGetImageReq);
+
+ REQUEST_SIZE_MATCH(xGetImageReq);
+
+ return DoGetImage(client, stuff->format, stuff->drawable,
+ stuff->x, stuff->y,
+ (int)stuff->width, (int)stuff->height,
+ stuff->planeMask, (xGetImageReply **)NULL);
+}
+
+int
+ProcPolyText(client)
+ register ClientPtr client;
+{
+ int err;
+ REQUEST(xPolyTextReq);
+ DrawablePtr pDraw;
+ GC *pGC;
+
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = PolyText(client,
+ pDraw,
+ pGC,
+ (unsigned char *)&stuff[1],
+ ((unsigned char *) stuff) + (client->req_len << 2),
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ {
+ return(client->noClientException);
+ }
+ else
+ return err;
+}
+
+int
+ProcImageText8(client)
+ register ClientPtr client;
+{
+ int err;
+ register DrawablePtr pDraw;
+ register GC *pGC;
+
+ REQUEST(xImageTextReq);
+
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = ImageText(client,
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ {
+ return(client->noClientException);
+ }
+ else
+ return err;
+}
+
+int
+ProcImageText16(client)
+ register ClientPtr client;
+{
+ int err;
+ register DrawablePtr pDraw;
+ register GC *pGC;
+
+ REQUEST(xImageTextReq);
+
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+
+ err = ImageText(client,
+ pDraw,
+ pGC,
+ stuff->nChars,
+ (unsigned char *)&stuff[1],
+ stuff->x,
+ stuff->y,
+ stuff->reqType,
+ stuff->drawable);
+
+ if (err == Success)
+ {
+ return(client->noClientException);
+ }
+ else
+ return err;
+}
+
+
+int
+ProcCreateColormap(client)
+ register ClientPtr client;
+{
+ VisualPtr pVisual;
+ ColormapPtr pmap;
+ Colormap mid;
+ register WindowPtr pWin;
+ ScreenPtr pScreen;
+ REQUEST(xCreateColormapReq);
+ int i, result;
+
+ REQUEST_SIZE_MATCH(xCreateColormapReq);
+
+ if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll))
+ {
+ client->errorValue = stuff->alloc;
+ return(BadValue);
+ }
+ mid = stuff->mid;
+ LEGAL_NEW_RESOURCE(mid, client);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+
+ pScreen = pWin->drawable.pScreen;
+ for (i = 0, pVisual = pScreen->visuals;
+ i < pScreen->numVisuals;
+ i++, pVisual++)
+ {
+ if (pVisual->vid != stuff->visual)
+ continue;
+ result = CreateColormap(mid, pScreen, pVisual, &pmap,
+ (int)stuff->alloc, client->index);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+ }
+ client->errorValue = stuff->visual;
+ return(BadValue);
+}
+
+int
+ProcFreeColormap(client)
+ register ClientPtr client;
+{
+ ColormapPtr pmap;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP,
+ SecurityDestroyAccess);
+ if (pmap)
+ {
+ /* Freeing a default colormap is a no-op */
+ if (!(pmap->flags & IsDefault))
+ FreeResource(stuff->id, RT_NONE);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadColor);
+ }
+}
+
+
+int
+ProcCopyColormapAndFree(client)
+ register ClientPtr client;
+{
+ Colormap mid;
+ ColormapPtr pSrcMap;
+ REQUEST(xCopyColormapAndFreeReq);
+ int result;
+
+ REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
+ mid = stuff->mid;
+ LEGAL_NEW_RESOURCE(mid, client);
+ if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap,
+ RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) )
+ {
+ result = CopyColormapAndFree(mid, pSrcMap, client->index);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+ }
+ else
+ {
+ client->errorValue = stuff->srcCmap;
+ return(BadColor);
+ }
+}
+
+int
+ProcInstallColormap(client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,
+ RT_COLORMAP, SecurityReadAccess);
+ if (pcmp)
+ {
+ (*(pcmp->pScreen->InstallColormap)) (pcmp);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadColor);
+ }
+}
+
+int
+ProcUninstallColormap(client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id,
+ RT_COLORMAP, SecurityReadAccess);
+ if (pcmp)
+ {
+ if(pcmp->mid != pcmp->pScreen->defColormap)
+ (*(pcmp->pScreen->UninstallColormap)) (pcmp);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadColor);
+ }
+}
+
+int
+ProcListInstalledColormaps(client)
+ register ClientPtr client;
+{
+ xListInstalledColormapsReply *preply;
+ int nummaps;
+ WindowPtr pWin;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityReadAccess);
+
+ if (!pWin)
+ return(BadWindow);
+
+ preply = (xListInstalledColormapsReply *)
+ ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
+ pWin->drawable.pScreen->maxInstalledCmaps *
+ sizeof(Colormap));
+ if(!preply)
+ return(BadAlloc);
+
+ preply->type = X_Reply;
+ preply->sequenceNumber = client->sequence;
+ nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
+ (pWin->drawable.pScreen, (Colormap *)&preply[1]);
+ preply->nColormaps = nummaps;
+ preply->length = nummaps;
+ WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
+ DEALLOCATE_LOCAL(preply);
+ return(client->noClientException);
+}
+
+int
+ProcAllocColor(client)
+ register ClientPtr client;
+{
+ ColormapPtr pmap;
+ int retval;
+ xAllocColorReply acr;
+ REQUEST(xAllocColorReq);
+
+ REQUEST_SIZE_MATCH(xAllocColorReq);
+ pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pmap)
+ {
+#ifdef LBX
+ /*
+ * If the colormap is grabbed by a proxy, the server will have
+ * to regain control over the colormap. This AllocColor request
+ * will be handled after the server gets back the colormap control.
+ */
+ if (LbxCheckColorRequest (client, pmap, (xReq *) stuff))
+ return Success;
+#endif
+ acr.type = X_Reply;
+ acr.length = 0;
+ acr.sequenceNumber = client->sequence;
+ acr.red = stuff->red;
+ acr.green = stuff->green;
+ acr.blue = stuff->blue;
+ acr.pixel = 0;
+ if( (retval = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
+ &acr.pixel, client->index)) )
+ {
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return (retval);
+ }
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
+ return (client->noClientException);
+
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcAllocNamedColor (client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xAllocNamedColorReq);
+
+ REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ int retval;
+
+ xAllocNamedColorReply ancr;
+
+#ifdef LBX
+ /*
+ * If the colormap is grabbed by a proxy, the server will have
+ * to regain control over the colormap. This AllocNamedColor request
+ * will be handled after the server gets back the colormap control.
+ */
+ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
+ return Success;
+#endif
+ ancr.type = X_Reply;
+ ancr.length = 0;
+ ancr.sequenceNumber = client->sequence;
+
+ if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes,
+ &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue))
+ {
+ ancr.screenRed = ancr.exactRed;
+ ancr.screenGreen = ancr.exactGreen;
+ ancr.screenBlue = ancr.exactBlue;
+ ancr.pixel = 0;
+ if( (retval = AllocColor(pcmp,
+ &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue,
+ &ancr.pixel, client->index)) )
+ {
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(retval);
+ }
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
+ return (client->noClientException);
+ }
+ else
+ return(BadName);
+
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcAllocColorCells (client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xAllocColorCellsReq);
+
+ REQUEST_SIZE_MATCH(xAllocColorCellsReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ xAllocColorCellsReply accr;
+ int npixels, nmasks, retval;
+ long length;
+ Pixel *ppixels, *pmasks;
+
+#ifdef LBX
+ /*
+ * If the colormap is grabbed by a proxy, the server will have
+ * to regain control over the colormap. This AllocColorCells request
+ * will be handled after the server gets back the colormap control.
+ */
+ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
+ return Success;
+#endif
+ npixels = stuff->colors;
+ if (!npixels)
+ {
+ client->errorValue = npixels;
+ return (BadValue);
+ }
+ if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
+ {
+ client->errorValue = stuff->contiguous;
+ return (BadValue);
+ }
+ nmasks = stuff->planes;
+ length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
+ ppixels = (Pixel *)ALLOCATE_LOCAL(length);
+ if(!ppixels)
+ return(BadAlloc);
+ pmasks = ppixels + npixels;
+
+ if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
+ (Bool)stuff->contiguous, ppixels, pmasks)) )
+ {
+ DEALLOCATE_LOCAL(ppixels);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(retval);
+ }
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ {
+ accr.type = X_Reply;
+ accr.length = length >> 2;
+ accr.sequenceNumber = client->sequence;
+ accr.nPixels = npixels;
+ accr.nMasks = nmasks;
+ WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
+ DEALLOCATE_LOCAL(ppixels);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcAllocColorPlanes(client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xAllocColorPlanesReq);
+
+ REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ xAllocColorPlanesReply acpr;
+ int npixels, retval;
+ long length;
+ Pixel *ppixels;
+
+#ifdef LBX
+ /*
+ * If the colormap is grabbed by a proxy, the server will have
+ * to regain control over the colormap. This AllocColorPlanes request
+ * will be handled after the server gets back the colormap control.
+ */
+ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff))
+ return Success;
+#endif
+ npixels = stuff->colors;
+ if (!npixels)
+ {
+ client->errorValue = npixels;
+ return (BadValue);
+ }
+ if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
+ {
+ client->errorValue = stuff->contiguous;
+ return (BadValue);
+ }
+ acpr.type = X_Reply;
+ acpr.sequenceNumber = client->sequence;
+ acpr.nPixels = npixels;
+ length = (long)npixels * sizeof(Pixel);
+ ppixels = (Pixel *)ALLOCATE_LOCAL(length);
+ if(!ppixels)
+ return(BadAlloc);
+ if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
+ (int)stuff->red, (int)stuff->green, (int)stuff->blue,
+ (Bool)stuff->contiguous, ppixels,
+ &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
+ {
+ DEALLOCATE_LOCAL(ppixels);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(retval);
+ }
+ acpr.length = length >> 2;
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ DEALLOCATE_LOCAL(ppixels);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcFreeColors (client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xFreeColorsReq);
+
+ REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ int count;
+ int retval;
+
+ if(pcmp->flags & AllAllocated)
+ return(BadAccess);
+ count = ((client->req_len << 2)- sizeof(xFreeColorsReq)) >> 2;
+ retval = FreeColors(pcmp, client->index, count,
+ (Pixel *)&stuff[1], (Pixel)stuff->planeMask);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return(retval);
+ }
+
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcStoreColors (client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xStoreColorsReq);
+
+ REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ int count;
+ int retval;
+
+ count = (client->req_len << 2) - sizeof(xStoreColorsReq);
+ if (count % sizeof(xColorItem))
+ return(BadLength);
+ count /= sizeof(xColorItem);
+ retval = StoreColors(pcmp, count, (xColorItem *)&stuff[1]);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return(retval);
+ }
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcStoreNamedColor (client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xStoreNamedColorReq);
+
+ REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityWriteAccess);
+ if (pcmp)
+ {
+ xColorItem def;
+ int retval;
+
+ if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1],
+ stuff->nbytes, &def.red, &def.green, &def.blue))
+ {
+ def.flags = stuff->flags;
+ def.pixel = stuff->pixel;
+ retval = StoreColors(pcmp, 1, &def);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(retval);
+ }
+ return (BadName);
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcQueryColors(client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xQueryColorsReq);
+
+ REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityReadAccess);
+ if (pcmp)
+ {
+ int count, retval;
+ xrgb *prgbs;
+ xQueryColorsReply qcr;
+
+ count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
+ prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb));
+ if(!prgbs && count)
+ return(BadAlloc);
+ if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
+ {
+ if (prgbs) DEALLOCATE_LOCAL(prgbs);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ {
+ client->errorValue = clientErrorValue;
+ return (retval);
+ }
+ }
+ qcr.type = X_Reply;
+ qcr.length = (count * sizeof(xrgb)) >> 2;
+ qcr.sequenceNumber = client->sequence;
+ qcr.nColors = count;
+ WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
+ if (count)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
+ WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
+ }
+ if (prgbs) DEALLOCATE_LOCAL(prgbs);
+ return(client->noClientException);
+
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcLookupColor(client)
+ register ClientPtr client;
+{
+ ColormapPtr pcmp;
+ REQUEST(xLookupColorReq);
+
+ REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
+ pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap,
+ RT_COLORMAP, SecurityReadAccess);
+ if (pcmp)
+ {
+ xLookupColorReply lcr;
+
+ if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes,
+ &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue))
+ {
+ lcr.type = X_Reply;
+ lcr.length = 0;
+ lcr.sequenceNumber = client->sequence;
+ lcr.screenRed = lcr.exactRed;
+ lcr.screenGreen = lcr.exactGreen;
+ lcr.screenBlue = lcr.exactBlue;
+ (*pcmp->pScreen->ResolveColor)(&lcr.screenRed,
+ &lcr.screenGreen,
+ &lcr.screenBlue,
+ pcmp->pVisual);
+ WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
+ return(client->noClientException);
+ }
+ return (BadName);
+ }
+ else
+ {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+}
+
+int
+ProcCreateCursor( client)
+ register ClientPtr client;
+{
+ CursorPtr pCursor;
+
+ register PixmapPtr src;
+ register PixmapPtr msk;
+ unsigned char * srcbits;
+ unsigned char * mskbits;
+ unsigned short width, height;
+ long n;
+ CursorMetricRec cm;
+
+
+ REQUEST(xCreateCursorReq);
+
+ REQUEST_SIZE_MATCH(xCreateCursorReq);
+ LEGAL_NEW_RESOURCE(stuff->cid, client);
+
+ src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source,
+ RT_PIXMAP, SecurityReadAccess);
+ msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask,
+ RT_PIXMAP, SecurityReadAccess);
+ if ( src == (PixmapPtr)NULL)
+ {
+ client->errorValue = stuff->source;
+ return (BadPixmap);
+ }
+ if ( msk == (PixmapPtr)NULL)
+ {
+ if (stuff->mask != None)
+ {
+ client->errorValue = stuff->mask;
+ return (BadPixmap);
+ }
+ }
+ else if ( src->drawable.width != msk->drawable.width
+ || src->drawable.height != msk->drawable.height
+ || src->drawable.depth != 1
+ || msk->drawable.depth != 1)
+ return (BadMatch);
+
+ width = src->drawable.width;
+ height = src->drawable.height;
+
+ if ( stuff->x > width
+ || stuff->y > height )
+ return (BadMatch);
+
+ n = BitmapBytePad(width)*height;
+ srcbits = (unsigned char *)xalloc(n);
+ if (!srcbits)
+ return (BadAlloc);
+ mskbits = (unsigned char *)xalloc(n);
+ if (!mskbits)
+ {
+ xfree(srcbits);
+ return (BadAlloc);
+ }
+
+ /* zeroing the (pad) bits helps some ddx cursor handling */
+ bzero((char *)srcbits, n);
+ (* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
+ XYPixmap, 1, (pointer)srcbits);
+ if ( msk == (PixmapPtr)NULL)
+ {
+ register unsigned char *bits = mskbits;
+ while (--n >= 0)
+ *bits++ = ~0;
+ }
+ else
+ {
+ /* zeroing the (pad) bits helps some ddx cursor handling */
+ bzero((char *)mskbits, n);
+ (* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width,
+ height, XYPixmap, 1, (pointer)mskbits);
+ }
+ cm.width = width;
+ cm.height = height;
+ cm.xhot = stuff->x;
+ cm.yhot = stuff->y;
+ pCursor = AllocCursor( srcbits, mskbits, &cm,
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue);
+
+ if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
+ return (client->noClientException);
+ return BadAlloc;
+}
+
+int
+ProcCreateGlyphCursor( client)
+ register ClientPtr client;
+{
+ CursorPtr pCursor;
+ int res;
+
+ REQUEST(xCreateGlyphCursorReq);
+
+ REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
+ LEGAL_NEW_RESOURCE(stuff->cid, client);
+
+ res = AllocGlyphCursor(stuff->source, stuff->sourceChar,
+ stuff->mask, stuff->maskChar,
+ stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
+ stuff->backRed, stuff->backGreen, stuff->backBlue,
+ &pCursor, client);
+ if (res != Success)
+ return res;
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
+ return client->noClientException;
+ return BadAlloc;
+}
+
+
+int
+ProcFreeCursor(client)
+ register ClientPtr client;
+{
+ CursorPtr pCursor;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id,
+ RT_CURSOR, SecurityDestroyAccess);
+ if (pCursor)
+ {
+ FreeResource(stuff->id, RT_NONE);
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadCursor);
+ }
+}
+
+int
+ProcQueryBestSize (client)
+ register ClientPtr client;
+{
+ xQueryBestSizeReply reply;
+ register DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ REQUEST(xQueryBestSizeReq);
+
+ REQUEST_SIZE_MATCH(xQueryBestSizeReq);
+ if ((stuff->class != CursorShape) &&
+ (stuff->class != TileShape) &&
+ (stuff->class != StippleShape))
+ {
+ client->errorValue = stuff->class;
+ return(BadValue);
+ }
+ SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
+ SecurityReadAccess);
+ if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
+ return (BadMatch);
+ pScreen = pDraw->pScreen;
+ (* pScreen->QueryBestSize)(stuff->class, &stuff->width,
+ &stuff->height, pScreen);
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ reply.width = stuff->width;
+ reply.height = stuff->height;
+ WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
+ return (client->noClientException);
+}
+
+
+int
+ProcSetScreenSaver (client)
+ register ClientPtr client;
+{
+ int blankingOption, exposureOption;
+ REQUEST(xSetScreenSaverReq);
+
+ REQUEST_SIZE_MATCH(xSetScreenSaverReq);
+ blankingOption = stuff->preferBlank;
+ if ((blankingOption != DontPreferBlanking) &&
+ (blankingOption != PreferBlanking) &&
+ (blankingOption != DefaultBlanking))
+ {
+ client->errorValue = blankingOption;
+ return BadValue;
+ }
+ exposureOption = stuff->allowExpose;
+ if ((exposureOption != DontAllowExposures) &&
+ (exposureOption != AllowExposures) &&
+ (exposureOption != DefaultExposures))
+ {
+ client->errorValue = exposureOption;
+ return BadValue;
+ }
+ if (stuff->timeout < -1)
+ {
+ client->errorValue = stuff->timeout;
+ return BadValue;
+ }
+ if (stuff->interval < -1)
+ {
+ client->errorValue = stuff->interval;
+ return BadValue;
+ }
+
+ if (blankingOption == DefaultBlanking)
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
+ else
+ ScreenSaverBlanking = blankingOption;
+ if (exposureOption == DefaultExposures)
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ else
+ ScreenSaverAllowExposures = exposureOption;
+
+ if (stuff->timeout >= 0)
+ ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND;
+ else
+ ScreenSaverTime = defaultScreenSaverTime;
+ if (stuff->interval >= 0)
+ ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND;
+ else
+ ScreenSaverInterval = defaultScreenSaverInterval;
+ return (client->noClientException);
+}
+
+int
+ProcGetScreenSaver(client)
+ register ClientPtr client;
+{
+ xGetScreenSaverReply rep;
+
+ REQUEST_SIZE_MATCH(xReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.timeout = ScreenSaverTime / MILLI_PER_SECOND;
+ rep.interval = ScreenSaverInterval / MILLI_PER_SECOND;
+ rep.preferBlanking = ScreenSaverBlanking;
+ rep.allowExposures = ScreenSaverAllowExposures;
+ WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
+ return (client->noClientException);
+}
+
+int
+ProcChangeHosts(client)
+ register ClientPtr client;
+{
+ REQUEST(xChangeHostsReq);
+ int result;
+
+ REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength);
+
+ if(stuff->mode == HostInsert)
+ result = AddHost(client, (int)stuff->hostFamily,
+ stuff->hostLength, (pointer)&stuff[1]);
+ else if (stuff->mode == HostDelete)
+ result = RemoveHost(client, (int)stuff->hostFamily,
+ stuff->hostLength, (pointer)&stuff[1]);
+ else
+ {
+ client->errorValue = stuff->mode;
+ return BadValue;
+ }
+ if (!result)
+ result = client->noClientException;
+ return (result);
+}
+
+int
+ProcListHosts(client)
+ register ClientPtr client;
+{
+extern int GetHosts();
+ xListHostsReply reply;
+ int len, nHosts, result;
+ pointer pdata;
+ REQUEST(xListHostsReq);
+
+ REQUEST_SIZE_MATCH(xListHostsReq);
+#ifdef XCSECURITY
+ /* untrusted clients can't list hosts */
+ if (client->trustLevel != XSecurityClientTrusted)
+ {
+ SecurityAudit("client %d attempted to list hosts\n", client->index);
+ return BadAccess;
+ }
+#endif
+ result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
+ if (result != Success)
+ return(result);
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.nHosts = nHosts;
+ reply.length = len >> 2;
+ WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
+ if (nHosts)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
+ WriteSwappedDataToClient(client, len, pdata);
+ }
+ xfree(pdata);
+ return (client->noClientException);
+}
+
+int
+ProcChangeAccessControl(client)
+ register ClientPtr client;
+{
+ int result;
+ REQUEST(xSetAccessControlReq);
+
+ REQUEST_SIZE_MATCH(xSetAccessControlReq);
+ if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess))
+ {
+ client->errorValue = stuff->mode;
+ return BadValue;
+ }
+ result = ChangeAccessControl(client, stuff->mode == EnableAccess);
+ if (!result)
+ result = client->noClientException;
+ return (result);
+}
+
+int
+ProcKillClient(client)
+ register ClientPtr client;
+{
+ REQUEST(xResourceReq);
+ ClientPtr killclient;
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ if (stuff->id == AllTemporary)
+ {
+ CloseDownRetainedResources();
+ return (client->noClientException);
+ }
+
+ if ((killclient = LookupClient(stuff->id, client)))
+ {
+ CloseDownClient(killclient);
+ /* if an LBX proxy gets killed, isItTimeToYield will be set */
+ if (isItTimeToYield || (client == killclient))
+ {
+ /* force yield and return Success, so that Dispatch()
+ * doesn't try to touch client
+ */
+ isItTimeToYield = TRUE;
+ return (Success);
+ }
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->id;
+ return (BadValue);
+ }
+}
+
+int
+ProcSetFontPath(client)
+ register ClientPtr client;
+{
+ unsigned char *ptr;
+ unsigned long nbytes, total;
+ long nfonts;
+ int n, result;
+ int error;
+ REQUEST(xSetFontPathReq);
+
+ REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
+
+ nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
+ total = nbytes;
+ ptr = (unsigned char *)&stuff[1];
+ nfonts = stuff->nFonts;
+ while (--nfonts >= 0)
+ {
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return(BadLength);
+ total -= n;
+ ptr += n;
+ }
+ if (total >= 4)
+ return(BadLength);
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
+ &error);
+ if (!result)
+ {
+ result = client->noClientException;
+ client->errorValue = error;
+ }
+ return (result);
+}
+
+int
+ProcGetFontPath(client)
+ register ClientPtr client;
+{
+ xGetFontPathReply reply;
+ int stringLens, numpaths;
+ unsigned char *bufferStart;
+ REQUEST (xReq);
+
+ REQUEST_SIZE_MATCH(xReq);
+ bufferStart = GetFontPath(&numpaths, &stringLens);
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = (stringLens + numpaths + 3) >> 2;
+ reply.nPaths = numpaths;
+
+ WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
+ if (stringLens || numpaths)
+ (void)WriteToClient(client, stringLens + numpaths, (char *)bufferStart);
+ return(client->noClientException);
+}
+
+int
+ProcChangeCloseDownMode(client)
+ register ClientPtr client;
+{
+ REQUEST(xSetCloseDownModeReq);
+
+ REQUEST_SIZE_MATCH(xSetCloseDownModeReq);
+ if ((stuff->mode == AllTemporary) ||
+ (stuff->mode == RetainPermanent) ||
+ (stuff->mode == RetainTemporary))
+ {
+ client->closeDownMode = stuff->mode;
+ return (client->noClientException);
+ }
+ else
+ {
+ client->errorValue = stuff->mode;
+ return (BadValue);
+ }
+}
+
+int ProcForceScreenSaver(client)
+ register ClientPtr client;
+{
+ REQUEST(xForceScreenSaverReq);
+
+ REQUEST_SIZE_MATCH(xForceScreenSaverReq);
+
+ if ((stuff->mode != ScreenSaverReset) &&
+ (stuff->mode != ScreenSaverActive))
+ {
+ client->errorValue = stuff->mode;
+ return BadValue;
+ }
+ SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode);
+ return client->noClientException;
+}
+
+int ProcNoOperation(client)
+ register ClientPtr client;
+{
+ REQUEST_AT_LEAST_SIZE(xReq);
+
+ /* noop -- don't do anything */
+ return(client->noClientException);
+}
+
+void
+InitProcVectors()
+{
+ int i;
+ for (i = 0; i<256; i++)
+ {
+ if(!ProcVector[i])
+ {
+ ProcVector[i] = SwappedProcVector[i] = ProcBadRequest;
+ ReplySwapVector[i] = ReplyNotSwappd;
+ }
+#ifdef K5AUTH
+ if (!k5_Vector[i])
+ {
+ k5_Vector[i] = k5_bad;
+ }
+#endif
+ }
+ for(i = LASTEvent; i < 128; i++)
+ {
+ EventSwapVector[i] = NotImplemented;
+ }
+
+}
+
+/**********************
+ * CloseDownClient
+ *
+ * Client can either mark his resources destroy or retain. If retained and
+ * then killed again, the client is really destroyed.
+ *********************/
+
+char dispatchExceptionAtReset = DE_RESET;
+
+void
+CloseDownClient(client)
+ register ClientPtr client;
+{
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+#endif
+ Bool really_close_down = client->clientGone ||
+ client->closeDownMode == DestroyAll;
+
+ if (!client->clientGone)
+ {
+ /* ungrab server if grabbing client dies */
+ if (grabState != GrabNone && grabClient == client)
+ {
+ UngrabServer(client);
+ }
+ BITCLEAR(grabWaiters, client->index);
+ DeleteClientFromAnySelections(client);
+ ReleaseActiveGrabs(client);
+ DeleteClientFontStuff(client);
+ if (!really_close_down)
+ {
+ /* This frees resources that should never be retained
+ * no matter what the close down mode is. Actually we
+ * could do this unconditionally, but it's probably
+ * better not to traverse all the client's resources
+ * twice (once here, once a few lines down in
+ * FreeClientResources) in the common case of
+ * really_close_down == TRUE.
+ */
+ FreeClientNeverRetainResources(client);
+ client->clientState = ClientStateRetained;
+ if (ClientStateCallback)
+ {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ }
+ client->clientGone = TRUE; /* so events aren't sent to client */
+ if (ClientIsAsleep(client))
+ ClientSignal (client);
+ ProcessWorkQueueZombies();
+#ifdef LBX
+ ProcessQTagZombies();
+#endif
+ CloseDownConnection(client);
+
+ /* If the client made it to the Running stage, nClients has
+ * been incremented on its behalf, so we need to decrement it
+ * now. If it hasn't gotten to Running, nClients has *not*
+ * been incremented, so *don't* decrement it.
+ */
+ if (client->clientState != ClientStateInitial &&
+ client->clientState != ClientStateAuthenticating )
+ {
+ --nClients;
+ }
+ }
+
+ if (really_close_down)
+ {
+ if (client->clientState == ClientStateRunning && nClients == 0)
+ dispatchException |= dispatchExceptionAtReset;
+
+ client->clientState = ClientStateGone;
+ if (ClientStateCallback)
+ {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ FreeClientResources(client);
+#ifdef PANORAMIX
+ PANORAMIX_FREE(client);
+#endif
+ if (client->index < nextFreeClientID)
+ nextFreeClientID = client->index;
+ clients[client->index] = NullClient;
+ xfree(client);
+
+ while (!clients[currentMaxClients-1])
+ currentMaxClients--;
+ }
+}
+
+static void
+KillAllClients()
+{
+ int i;
+ for (i=1; i<currentMaxClients; i++)
+ if (clients[i])
+ CloseDownClient(clients[i]);
+}
+
+/*********************
+ * CloseDownRetainedResources
+ *
+ * Find all clients that are gone and have terminated in RetainTemporary
+ * and destroy their resources.
+ *********************/
+
+void
+CloseDownRetainedResources()
+{
+ register int i;
+ register ClientPtr client;
+
+ for (i=1; i<currentMaxClients; i++)
+ {
+ client = clients[i];
+ if (client && (client->closeDownMode == RetainTemporary)
+ && (client->clientGone))
+ CloseDownClient(client);
+ }
+}
+
+void InitClient(client, i, ospriv)
+ ClientPtr client;
+ int i;
+ pointer ospriv;
+{
+ client->index = i;
+ client->sequence = 0;
+ client->clientAsMask = ((Mask)i) << CLIENTOFFSET;
+ client->clientGone = FALSE;
+ if (i)
+ {
+ client->closeDownMode = DestroyAll;
+ client->lastDrawable = (DrawablePtr)WindowTable[0];
+ client->lastDrawableID = WindowTable[0]->drawable.id;
+ }
+ else
+ {
+ client->closeDownMode = RetainPermanent;
+ client->lastDrawable = (DrawablePtr)NULL;
+ client->lastDrawableID = INVALID;
+ }
+ client->lastGC = (GCPtr) NULL;
+ client->lastGCID = INVALID;
+ client->numSaved = 0;
+ client->saveSet = (pointer *)NULL;
+ client->noClientException = Success;
+#ifdef DEBUG
+ client->requestLogIndex = 0;
+#endif
+ client->requestVector = InitialVector;
+ client->osPrivate = ospriv;
+ client->swapped = FALSE;
+ client->big_requests = FALSE;
+ client->priority = 0;
+ client->clientState = ClientStateInitial;
+#ifdef XKB
+ if (!noXkbExtension) {
+ client->xkbClientFlags = 0;
+ client->mapNotifyMask = 0;
+ QueryMinMaxKeyCodes(&client->minKC,&client->maxKC);
+ }
+#endif
+ client->replyBytesRemaining = 0;
+#ifdef LBX
+ client->readRequest = StandardReadRequestFromClient;
+#endif
+#ifdef XCSECURITY
+ client->trustLevel = XSecurityClientTrusted;
+ client->CheckAccess = NULL;
+ client->authId = 0;
+#endif
+#ifdef XAPPGROUP
+ client->appgroup = NULL;
+#endif
+ client->fontResFunc = NULL;
+}
+
+extern int clientPrivateLen;
+extern unsigned *clientPrivateSizes;
+extern unsigned totalClientSize;
+
+int
+InitClientPrivates(client)
+ ClientPtr client;
+{
+ register char *ptr;
+ DevUnion *ppriv;
+ register unsigned *sizes;
+ register unsigned size;
+ register int i;
+
+ if (totalClientSize == sizeof(ClientRec))
+ ppriv = (DevUnion *)NULL;
+ else if (client->index)
+ ppriv = (DevUnion *)(client + 1);
+ else
+ {
+ ppriv = (DevUnion *)xalloc(totalClientSize - sizeof(ClientRec));
+ if (!ppriv)
+ return 0;
+ }
+ client->devPrivates = ppriv;
+ sizes = clientPrivateSizes;
+ ptr = (char *)(ppriv + clientPrivateLen);
+ for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ( (size = *sizes) )
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+ return 1;
+}
+
+/************************
+ * int NextAvailableClient(ospriv)
+ *
+ * OS dependent portion can't assign client id's because of CloseDownModes.
+ * Returns NULL if there are no free clients.
+ *************************/
+
+ClientPtr
+NextAvailableClient(ospriv)
+ pointer ospriv;
+{
+ register int i;
+ register ClientPtr client;
+ xReq data;
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXFreeGC;
+ PanoramiXGC *pPanoramiXFreeGCback = NULL;
+ PanoramiXWindow *pPanoramiXFreeWin;
+ PanoramiXWindow *pPanoramiXFreeWinback = NULL;
+ PanoramiXCmap *pPanoramiXFreeCmap;
+ PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
+ PanoramiXPmap *pPanoramiXFreePmap;
+ PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+#endif
+
+ i = nextFreeClientID;
+ if (i == MAXCLIENTS)
+ return (ClientPtr)NULL;
+ clients[i] = client = (ClientPtr)xalloc(totalClientSize);
+ if (!client)
+ return (ClientPtr)NULL;
+ InitClient(client, i, ospriv);
+ InitClientPrivates(client);
+ if (!InitClientResources(client))
+ {
+ xfree(client);
+ return (ClientPtr)NULL;
+ }
+ data.reqType = 1;
+ data.length = (sz_xReq + sz_xConnClientPrefix) >> 2;
+ if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
+ {
+ FreeClientResources(client);
+#ifdef PANORAMIX
+ PANORAMIX_FREE(client);
+#endif
+ xfree(client);
+ return (ClientPtr)NULL;
+ }
+ if (i == currentMaxClients)
+ currentMaxClients++;
+ while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
+ nextFreeClientID++;
+ if (ClientStateCallback)
+ {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ return(client);
+}
+
+int
+ProcInitialConnection(client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ register xConnClientPrefix *prefix;
+ int whichbyte = 1;
+
+ prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
+ if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
+ return (client->noClientException = -1);
+ if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
+ (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l')))
+ {
+ client->swapped = TRUE;
+ SwapConnClientPrefix(prefix);
+ }
+ stuff->reqType = 2;
+ stuff->length += ((prefix->nbytesAuthProto + (unsigned)3) >> 2) +
+ ((prefix->nbytesAuthString + (unsigned)3) >> 2);
+ if (client->swapped)
+ {
+ swaps(&stuff->length, whichbyte);
+ }
+ ResetCurrentRequest(client);
+ return (client->noClientException);
+}
+
+#ifdef LBX
+void
+IncrementClientCount()
+{
+ nClients++;
+}
+#endif
+
+int
+SendConnSetup(client, reason)
+ register ClientPtr client;
+ char *reason;
+{
+ register xWindowRoot *root;
+ register int i;
+ int numScreens;
+ char* lConnectionInfo;
+ xConnSetupPrefix* lconnSetupPrefix;
+
+ if (reason)
+ {
+ xConnSetupPrefix csp;
+ char pad[3];
+
+ csp.success = xFalse;
+ csp.lengthReason = strlen(reason);
+ csp.length = (csp.lengthReason + (unsigned)3) >> 2;
+ csp.majorVersion = X_PROTOCOL;
+ csp.minorVersion = X_PROTOCOL_REVISION;
+ if (client->swapped)
+ WriteSConnSetupPrefix(client, &csp);
+ else
+ (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
+ (void)WriteToClient(client, (int)csp.lengthReason, reason);
+ return (client->noClientException = -1);
+ }
+
+ numScreens = screenInfo.numScreens;
+ lConnectionInfo = ConnectionInfo;
+ lconnSetupPrefix = &connSetupPrefix;
+
+ /* We're about to start speaking X protocol back to the client by
+ * sending the connection setup info. This means the authorization
+ * step is complete, and we can count the client as an
+ * authorized one.
+ */
+ nClients++;
+
+ client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
+ client->sequence = 0;
+#ifdef XAPPGROUP
+ XagConnectionInfo (client, &lconnSetupPrefix, &lConnectionInfo, &numScreens);
+#endif
+ ((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
+ ((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+ /* fill in the "currentInputMask" */
+ root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+#endif
+
+ for (i=0; i<numScreens; i++)
+ {
+ register unsigned int j;
+ register xDepth *pDepth;
+
+ root->currentInputMask = WindowTable[i]->eventMask |
+ wOtherEventMasks (WindowTable[i]);
+ pDepth = (xDepth *)(root + 1);
+ for (j = 0; j < root->nDepths; j++)
+ {
+ pDepth = (xDepth *)(((char *)(pDepth + 1)) +
+ pDepth->nVisuals * sizeof(xVisualType));
+ }
+ root = (xWindowRoot *)pDepth;
+ }
+
+ if (client->swapped)
+ {
+ WriteSConnSetupPrefix(client, lconnSetupPrefix);
+ WriteSConnectionInfo(client,
+ (unsigned long)(lconnSetupPrefix->length << 2),
+ lConnectionInfo);
+ }
+ else
+ {
+ (void)WriteToClient(client, sizeof(xConnSetupPrefix),
+ (char *) lconnSetupPrefix);
+ (void)WriteToClient(client, (int)(lconnSetupPrefix->length << 2),
+ lConnectionInfo);
+ }
+ client->clientState = ClientStateRunning;
+ if (ClientStateCallback)
+ {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = lconnSetupPrefix;
+ clientinfo.setup = (xConnSetup *)lConnectionInfo;
+ CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
+ }
+ return (client->noClientException);
+}
+
+int
+ProcEstablishConnection(client)
+ register ClientPtr client;
+{
+ char *reason, *auth_proto, *auth_string;
+ register xConnClientPrefix *prefix;
+ REQUEST(xReq);
+
+ prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
+ auth_proto = (char *)prefix + sz_xConnClientPrefix;
+ auth_string = auth_proto + ((prefix->nbytesAuthProto + 3) & ~3);
+ if ((prefix->majorVersion != X_PROTOCOL) ||
+ (prefix->minorVersion != X_PROTOCOL_REVISION))
+ reason = "Protocol version mismatch";
+ else
+ reason = ClientAuthorized(client,
+ (unsigned short)prefix->nbytesAuthProto,
+ auth_proto,
+ (unsigned short)prefix->nbytesAuthString,
+ auth_string);
+ /*
+ * If Kerberos is being used for this client, the clientState
+ * will be set to ClientStateAuthenticating at this point.
+ * More messages need to be exchanged among the X server, Kerberos
+ * server, and client to figure out if everyone is authorized.
+ * So we don't want to send the connection setup info yet, since
+ * the auth step isn't really done.
+ */
+ if (client->clientState == ClientStateCheckingSecurity)
+ client->clientState = ClientStateCheckedSecurity;
+ else if (client->clientState != ClientStateAuthenticating)
+ return(SendConnSetup(client, reason));
+ return(client->noClientException);
+}
+
+void
+SendErrorToClient(client, majorCode, minorCode, resId, errorCode)
+ ClientPtr client;
+ unsigned int majorCode;
+ unsigned int minorCode;
+ XID resId;
+ int errorCode;
+{
+ xError rep;
+
+ rep.type = X_Error;
+ rep.sequenceNumber = client->sequence;
+ rep.errorCode = errorCode;
+ rep.majorCode = majorCode;
+ rep.minorCode = minorCode;
+ rep.resourceID = resId;
+
+ WriteEventsToClient (client, 1, (xEvent *)&rep);
+}
+
+void
+DeleteWindowFromAnySelections(pWin)
+ WindowPtr pWin;
+{
+ register int i;
+
+ for (i = 0; i< NumCurrentSelections; i++)
+ if (CurrentSelections[i].pWin == pWin)
+ {
+ CurrentSelections[i].pWin = (WindowPtr)NULL;
+ CurrentSelections[i].window = None;
+ CurrentSelections[i].client = NullClient;
+ }
+}
+
+static void
+DeleteClientFromAnySelections(client)
+ ClientPtr client;
+{
+ register int i;
+
+ for (i = 0; i< NumCurrentSelections; i++)
+ if (CurrentSelections[i].client == client)
+ {
+ CurrentSelections[i].pWin = (WindowPtr)NULL;
+ CurrentSelections[i].window = None;
+ CurrentSelections[i].client = NullClient;
+ }
+}
+
+void
+MarkClientException(client)
+ ClientPtr client;
+{
+ client->noClientException = -1;
+}
diff --git a/xc/programs/Xserver/dix/dispatch.h b/xc/programs/Xserver/dix/dispatch.h
new file mode 100644
index 000000000..48b287b2b
--- /dev/null
+++ b/xc/programs/Xserver/dix/dispatch.h
@@ -0,0 +1,206 @@
+/* $XFree86: xc/programs/Xserver/dix/dispatch.h,v 3.1 1996/05/06 05:56:15 dawes Exp $ */
+/************************************************************
+
+Copyright 1996 by Thomas E. Dickey <dickey@clark.net>
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the above listed
+copyright holder(s) not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
+TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * This prototypes the dispatch.c module (except for functions declared in
+ * global headers), plus related dispatch procedures from devices.c, events.c,
+ * extension.c, property.c.
+ */
+
+#ifndef DISPATCH_H
+#define DISPATCH_H 1
+
+#ifdef LBX
+void IncrementClientCount(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+#endif
+
+void CloseDownClient(
+#if NeedFunctionPrototypes
+ ClientPtr client
+#endif
+);
+
+void Dispatch(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+void InitProcVectors(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+ClientPtr NextAvailableClient(
+#if NeedFunctionPrototypes
+ pointer ospriv
+#endif
+);
+
+int SendConnSetup(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ char * /* reason */
+#endif
+);
+
+void SetInputCheck(
+#if NeedFunctionPrototypes
+ HWEventQueuePtr /* c0 */,
+ HWEventQueuePtr /* c1 */
+#endif
+);
+
+DISPATCH_PROC(InitClientPrivates);
+DISPATCH_PROC(ProcAllocColor);
+DISPATCH_PROC(ProcAllocColorCells);
+DISPATCH_PROC(ProcAllocColorPlanes);
+DISPATCH_PROC(ProcAllocNamedColor);
+DISPATCH_PROC(ProcAllowEvents);
+DISPATCH_PROC(ProcBadRequest);
+DISPATCH_PROC(ProcBell);
+DISPATCH_PROC(ProcChangeAccessControl);
+DISPATCH_PROC(ProcChangeActivePointerGrab);
+DISPATCH_PROC(ProcChangeCloseDownMode);
+DISPATCH_PROC(ProcChangeGC);
+DISPATCH_PROC(ProcChangeHosts);
+DISPATCH_PROC(ProcChangeKeyboardControl);
+DISPATCH_PROC(ProcChangeKeyboardMapping);
+DISPATCH_PROC(ProcChangePointerControl);
+DISPATCH_PROC(ProcChangeProperty);
+DISPATCH_PROC(ProcChangeSaveSet);
+DISPATCH_PROC(ProcChangeWindowAttributes);
+DISPATCH_PROC(ProcCirculateWindow);
+DISPATCH_PROC(ProcClearToBackground);
+DISPATCH_PROC(ProcCloseFont);
+DISPATCH_PROC(ProcConfigureWindow);
+DISPATCH_PROC(ProcConvertSelection);
+DISPATCH_PROC(ProcCopyArea);
+DISPATCH_PROC(ProcCopyColormapAndFree);
+DISPATCH_PROC(ProcCopyGC);
+DISPATCH_PROC(ProcCopyPlane);
+DISPATCH_PROC(ProcCreateColormap);
+DISPATCH_PROC(ProcCreateCursor);
+DISPATCH_PROC(ProcCreateGC);
+DISPATCH_PROC(ProcCreateGlyphCursor);
+DISPATCH_PROC(ProcCreatePixmap);
+DISPATCH_PROC(ProcCreateWindow);
+DISPATCH_PROC(ProcDeleteProperty);
+DISPATCH_PROC(ProcDestroySubwindows);
+DISPATCH_PROC(ProcDestroyWindow);
+DISPATCH_PROC(ProcEstablishConnection);
+DISPATCH_PROC(ProcFillPoly);
+DISPATCH_PROC(ProcForceScreenSaver);
+DISPATCH_PROC(ProcFreeColormap);
+DISPATCH_PROC(ProcFreeColors);
+DISPATCH_PROC(ProcFreeCursor);
+DISPATCH_PROC(ProcFreeGC);
+DISPATCH_PROC(ProcFreePixmap);
+DISPATCH_PROC(ProcGetAtomName);
+DISPATCH_PROC(ProcGetFontPath);
+DISPATCH_PROC(ProcGetGeometry);
+DISPATCH_PROC(ProcGetImage);
+DISPATCH_PROC(ProcGetInputFocus);
+DISPATCH_PROC(ProcGetKeyboardControl);
+DISPATCH_PROC(ProcGetKeyboardMapping);
+DISPATCH_PROC(ProcGetModifierMapping);
+DISPATCH_PROC(ProcGetMotionEvents);
+DISPATCH_PROC(ProcGetPointerControl);
+DISPATCH_PROC(ProcGetPointerMapping);
+DISPATCH_PROC(ProcGetProperty);
+DISPATCH_PROC(ProcGetScreenSaver);
+DISPATCH_PROC(ProcGetSelectionOwner);
+DISPATCH_PROC(ProcGetWindowAttributes);
+DISPATCH_PROC(ProcGrabButton);
+DISPATCH_PROC(ProcGrabKey);
+DISPATCH_PROC(ProcGrabKeyboard);
+DISPATCH_PROC(ProcGrabPointer);
+DISPATCH_PROC(ProcGrabServer);
+DISPATCH_PROC(ProcImageText16);
+DISPATCH_PROC(ProcImageText8);
+DISPATCH_PROC(ProcInitialConnection);
+DISPATCH_PROC(ProcInstallColormap);
+DISPATCH_PROC(ProcInternAtom);
+DISPATCH_PROC(ProcKillClient);
+DISPATCH_PROC(ProcListExtensions);
+DISPATCH_PROC(ProcListFonts);
+DISPATCH_PROC(ProcListFontsWithInfo);
+DISPATCH_PROC(ProcListHosts);
+DISPATCH_PROC(ProcListInstalledColormaps);
+DISPATCH_PROC(ProcListProperties);
+DISPATCH_PROC(ProcLookupColor);
+DISPATCH_PROC(ProcMapSubwindows);
+DISPATCH_PROC(ProcMapWindow);
+DISPATCH_PROC(ProcNoOperation);
+DISPATCH_PROC(ProcOpenFont);
+DISPATCH_PROC(ProcPolyArc);
+DISPATCH_PROC(ProcPolyFillArc);
+DISPATCH_PROC(ProcPolyFillRectangle);
+DISPATCH_PROC(ProcPolyLine);
+DISPATCH_PROC(ProcPolyPoint);
+DISPATCH_PROC(ProcPolyRectangle);
+DISPATCH_PROC(ProcPolySegment);
+DISPATCH_PROC(ProcPolyText);
+DISPATCH_PROC(ProcPutImage);
+DISPATCH_PROC(ProcQueryBestSize);
+DISPATCH_PROC(ProcQueryColors);
+DISPATCH_PROC(ProcQueryExtension);
+DISPATCH_PROC(ProcQueryFont);
+DISPATCH_PROC(ProcQueryKeymap);
+DISPATCH_PROC(ProcQueryPointer);
+DISPATCH_PROC(ProcQueryTextExtents);
+DISPATCH_PROC(ProcQueryTree);
+DISPATCH_PROC(ProcRecolorCursor);
+DISPATCH_PROC(ProcReparentWindow);
+DISPATCH_PROC(ProcRotateProperties);
+DISPATCH_PROC(ProcSendEvent);
+DISPATCH_PROC(ProcSetClipRectangles);
+DISPATCH_PROC(ProcSetDashes);
+DISPATCH_PROC(ProcSetFontPath);
+DISPATCH_PROC(ProcSetInputFocus);
+DISPATCH_PROC(ProcSetModifierMapping);
+DISPATCH_PROC(ProcSetPointerMapping);
+DISPATCH_PROC(ProcSetScreenSaver);
+DISPATCH_PROC(ProcSetSelectionOwner);
+DISPATCH_PROC(ProcStoreColors);
+DISPATCH_PROC(ProcStoreNamedColor);
+DISPATCH_PROC(ProcTranslateCoords);
+DISPATCH_PROC(ProcUngrabButton);
+DISPATCH_PROC(ProcUngrabKey);
+DISPATCH_PROC(ProcUngrabKeyboard);
+DISPATCH_PROC(ProcUngrabPointer);
+DISPATCH_PROC(ProcUngrabServer);
+DISPATCH_PROC(ProcUninstallColormap);
+DISPATCH_PROC(ProcUnmapSubwindows);
+DISPATCH_PROC(ProcUnmapWindow);
+DISPATCH_PROC(ProcWarpPointer);
+
+#endif /* DISPATCH_H */
diff --git a/xc/programs/Xserver/dix/dixfonts.c b/xc/programs/Xserver/dix/dixfonts.c
new file mode 100644
index 000000000..c9dfcf71d
--- /dev/null
+++ b/xc/programs/Xserver/dix/dixfonts.c
@@ -0,0 +1,2215 @@
+/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.19 1999/08/21 13:48:16 dawes Exp $ */
+/************************************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+
+/* $TOG: dixfonts.c /main/61 1998/05/28 15:47:54 kaleb $ */
+
+#define NEED_REPLIES
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "cursorstr.h"
+#include "misc.h"
+#include "opaque.h"
+#include "dixfontstr.h"
+#include "closestr.h"
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#endif
+
+#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
+
+extern pointer fosNaturalParams;
+extern FontPtr defaultFont;
+
+static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
+static int num_fpes = 0;
+FPEFunctions *fpe_functions = (FPEFunctions *) 0;
+static int num_fpe_types = 0;
+
+static unsigned char *font_path_string;
+
+static int num_slept_fpes = 0;
+static int size_slept_fpes = 0;
+static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0;
+static FontPatternCachePtr patternCache;
+
+int
+FontToXError(err)
+ int err;
+{
+ switch (err) {
+ case Successful:
+ return Success;
+ case AllocError:
+ return BadAlloc;
+ case BadFontName:
+ case BadFontPath:
+ return BadName;
+ case BadFontFormat: /* is there something better? */
+ case BadCharRange:
+ return BadValue;
+ default:
+ return err;
+ }
+}
+
+
+/*
+ * adding RT_FONT prevents conflict with default cursor font
+ */
+Bool
+SetDefaultFont(defaultfontname)
+ char *defaultfontname;
+{
+ int err;
+ FontPtr pf;
+ XID fid;
+
+ fid = FakeClientID(0);
+ err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
+ (unsigned) strlen(defaultfontname), defaultfontname);
+ if (err != Success)
+ return FALSE;
+ pf = (FontPtr) LookupIDByType(fid, RT_FONT);
+ if (pf == (FontPtr) NULL)
+ return FALSE;
+ defaultFont = pf;
+ return TRUE;
+}
+
+/*
+ * note that the font wakeup queue is not refcounted. this is because
+ * an fpe needs to be added when it's inited, and removed when it's finally
+ * freed, in order to handle any data that isn't requested, like FS events.
+ *
+ * since the only thing that should call these routines is the renderer's
+ * init_fpe() and free_fpe(), there shouldn't be any problem in using
+ * freed data.
+ */
+void
+QueueFontWakeup(fpe)
+ FontPathElementPtr fpe;
+{
+ int i;
+ FontPathElementPtr *new;
+
+ for (i = 0; i < num_slept_fpes; i++) {
+ if (slept_fpes[i] == fpe) {
+
+#ifdef DEBUG
+ fprintf(stderr, "re-queueing fpe wakeup\n");
+#endif
+
+ return;
+ }
+ }
+ if (num_slept_fpes == size_slept_fpes) {
+ new = (FontPathElementPtr *)
+ xrealloc(slept_fpes,
+ sizeof(FontPathElementPtr) * (size_slept_fpes + 4));
+ if (!new)
+ return;
+ slept_fpes = new;
+ size_slept_fpes += 4;
+ }
+ slept_fpes[num_slept_fpes] = fpe;
+ num_slept_fpes++;
+}
+
+void
+RemoveFontWakeup(fpe)
+ FontPathElementPtr fpe;
+{
+ int i,
+ j;
+
+ for (i = 0; i < num_slept_fpes; i++) {
+ if (slept_fpes[i] == fpe) {
+ for (j = i; j < num_slept_fpes; j++) {
+ slept_fpes[j] = slept_fpes[j + 1];
+ }
+ num_slept_fpes--;
+ return;
+ }
+ }
+}
+
+/* ARGSUSED */
+void
+FontWakeup(data, count, LastSelectMask)
+ pointer data;
+ int count;
+ pointer LastSelectMask;
+{
+ int i;
+ FontPathElementPtr fpe;
+
+ if (count < 0)
+ return;
+ /* wake up any fpe's that may be waiting for information */
+ for (i = 0; i < num_slept_fpes; i++) {
+ fpe = slept_fpes[i];
+ (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask);
+ }
+}
+
+/* XXX -- these two funcs may want to be broken into macros */
+static void
+#if NeedFunctionPrototypes
+UseFPE(FontPathElementPtr fpe)
+#else
+UseFPE(fpe)
+ FontPathElementPtr fpe;
+#endif
+{
+ fpe->refcount++;
+}
+
+static void
+#if NeedFunctionPrototypes
+FreeFPE (FontPathElementPtr fpe)
+#else
+FreeFPE (fpe)
+ FontPathElementPtr fpe;
+#endif
+{
+ fpe->refcount--;
+ if (fpe->refcount == 0) {
+ (*fpe_functions[fpe->type].free_fpe) (fpe);
+ xfree(fpe->name);
+ xfree(fpe);
+ }
+}
+
+static Bool
+#if NeedFunctionPrototypes
+doOpenFont(ClientPtr client, OFclosurePtr c)
+#else
+doOpenFont(client, c)
+ ClientPtr client;
+ OFclosurePtr c;
+#endif
+{
+ FontPtr pfont = NullFont;
+ FontPathElementPtr fpe;
+ ScreenPtr pScr;
+ int err = Successful;
+ int i;
+ char *alias,
+ *newname;
+ int newlen;
+ int aliascount = 20;
+ /*
+ * Decide at runtime what FontFormat to use.
+ */
+ Mask FontFormat =
+
+ ((screenInfo.imageByteOrder == LSBFirst) ?
+ BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
+
+ ((screenInfo.bitmapBitOrder == LSBFirst) ?
+ BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
+
+ BitmapFormatImageRectMin |
+
+#if GLYPHPADBYTES == 1
+ BitmapFormatScanlinePad8 |
+#endif
+
+#if GLYPHPADBYTES == 2
+ BitmapFormatScanlinePad16 |
+#endif
+
+#if GLYPHPADBYTES == 4
+ BitmapFormatScanlinePad32 |
+#endif
+
+#if GLYPHPADBYTES == 8
+ BitmapFormatScanlinePad64 |
+#endif
+
+ BitmapFormatScanlineUnit8;
+
+ if (client->clientGone)
+ {
+ if (c->current_fpe < c->num_fpes)
+ {
+ fpe = c->fpe_list[c->current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
+ }
+ while (c->current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current_fpe];
+ err = (*fpe_functions[fpe->type].open_font)
+ ((pointer) client, fpe, c->flags,
+ c->fontname, c->fnamelen, FontFormat,
+ BitmapFormatMaskByte |
+ BitmapFormatMaskBit |
+ BitmapFormatMaskImageRectangle |
+ BitmapFormatMaskScanLinePad |
+ BitmapFormatMaskScanLineUnit,
+ c->fontid, &pfont, &alias,
+ c->non_cachable_font && c->non_cachable_font->fpe == fpe ?
+ c->non_cachable_font :
+ (FontPtr)0);
+
+ if (err == FontNameAlias && alias) {
+ newlen = strlen(alias);
+ newname = (char *) xrealloc(c->fontname, newlen);
+ if (!newname) {
+ err = AllocError;
+ break;
+ }
+ memmove(newname, alias, newlen);
+ c->fontname = newname;
+ c->fnamelen = newlen;
+ c->current_fpe = 0;
+ if (--aliascount <= 0)
+ break;
+ continue;
+ }
+ if (err == BadFontName) {
+ c->current_fpe++;
+ continue;
+ }
+ if (err == Suspended) {
+ if (!c->slept) {
+ c->slept = TRUE;
+ ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c);
+ }
+ return TRUE;
+ }
+ break;
+ }
+
+ if (err != Successful)
+ goto bail;
+ if (!pfont) {
+ err = BadFontName;
+ goto bail;
+ }
+ if (!pfont->fpe)
+ pfont->fpe = fpe;
+ pfont->refcnt++;
+ if (pfont->refcnt == 1) {
+ UseFPE(pfont->fpe);
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pScr = screenInfo.screens[i];
+ if (pScr->RealizeFont)
+ {
+ if (!(*pScr->RealizeFont) (pScr, pfont))
+ {
+ CloseFont (pfont, (Font) 0);
+ err = AllocError;
+ goto bail;
+ }
+ }
+ }
+ }
+ if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) {
+ err = AllocError;
+ goto bail;
+ }
+ if (patternCache && pfont != c->non_cachable_font)
+ CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
+ pfont);
+bail:
+ if (err != Successful && c->client != serverClient) {
+ SendErrorToClient(c->client, X_OpenFont, 0,
+ c->fontid, FontToXError(err));
+ }
+ if (c->slept)
+ ClientWakeup(c->client);
+ for (i = 0; i < c->num_fpes; i++) {
+ FreeFPE(c->fpe_list[i]);
+ }
+ xfree(c->fpe_list);
+ xfree(c->fontname);
+ xfree(c);
+ return TRUE;
+}
+
+int
+OpenFont(client, fid, flags, lenfname, pfontname)
+ ClientPtr client;
+ XID fid;
+ Mask flags;
+ unsigned lenfname;
+ char *pfontname;
+{
+ OFclosurePtr c;
+ int i;
+ FontPtr cached = (FontPtr)0;
+
+#ifdef FONTDEBUG
+ char *f;
+ f = (char *)xalloc(lenfname + 1);
+ memmove(f, pfontname, lenfname);
+ f[lenfname] = '\0';
+ ErrorF("OpenFont: fontname is \"%s\"\n", f);
+ xfree(f);
+#endif
+ if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
+ return BadName;
+ if (patternCache)
+ {
+
+ /*
+ ** Check name cache. If we find a cached version of this font that
+ ** is cachable, immediately satisfy the request with it. If we find
+ ** a cached version of this font that is non-cachable, we do not
+ ** satisfy the request with it. Instead, we pass the FontPtr to the
+ ** FPE's open_font code (the fontfile FPE in turn passes the
+ ** information to the rasterizer; the fserve FPE ignores it).
+ **
+ ** Presumably, the font is marked non-cachable because the FPE has
+ ** put some licensing restrictions on it. If the FPE, using
+ ** whatever logic it relies on, determines that it is willing to
+ ** share this existing font with the client, then it has the option
+ ** to return the FontPtr we passed it as the newly-opened font.
+ ** This allows the FPE to exercise its licensing logic without
+ ** having to create another instance of a font that already exists.
+ */
+
+ cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
+ if (cached && cached->info.cachable)
+ {
+ if (!AddResource(fid, RT_FONT, (pointer) cached))
+ return BadAlloc;
+ cached->refcnt++;
+ return Success;
+ }
+ }
+ c = (OFclosurePtr) xalloc(sizeof(OFclosureRec));
+ if (!c)
+ return BadAlloc;
+ c->fontname = (char *) xalloc(lenfname);
+ c->origFontName = pfontname;
+ c->origFontNameLen = lenfname;
+ if (!c->fontname) {
+ xfree(c);
+ return BadAlloc;
+ }
+ /*
+ * copy the current FPE list, so that if it gets changed by another client
+ * while we're blocking, the request still appears atomic
+ */
+ c->fpe_list = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * num_fpes);
+ if (!c->fpe_list) {
+ xfree(c->fontname);
+ xfree(c);
+ return BadAlloc;
+ }
+ memmove(c->fontname, pfontname, lenfname);
+ for (i = 0; i < num_fpes; i++) {
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
+ }
+ c->client = client;
+ c->fontid = fid;
+ c->current_fpe = 0;
+ c->num_fpes = num_fpes;
+ c->fnamelen = lenfname;
+ c->slept = FALSE;
+ c->flags = flags;
+ c->non_cachable_font = cached;
+
+ (void) doOpenFont(client, c);
+ return Success;
+}
+
+/*
+ * Decrement font's ref count, and free storage if ref count equals zero
+ */
+/*ARGSUSED*/
+int
+CloseFont(value, fid)
+ pointer value; /* must conform to DeleteType */
+ XID fid;
+{
+ int nscr;
+ ScreenPtr pscr;
+ FontPathElementPtr fpe;
+ FontPtr pfont = (FontPtr)value;
+
+ if (pfont == NullFont)
+ return (Success);
+ if (--pfont->refcnt == 0) {
+ if (patternCache && pfont->info.cachable)
+ RemoveCachedFontPattern (patternCache, pfont);
+ /*
+ * since the last reference is gone, ask each screen to free any
+ * storage it may have allocated locally for it.
+ */
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
+ pscr = screenInfo.screens[nscr];
+ if (pscr->UnrealizeFont)
+ (*pscr->UnrealizeFont) (pscr, pfont);
+ }
+ if (pfont == defaultFont)
+ defaultFont = NULL;
+#ifdef LBX
+ LbxFreeFontTag(pfont);
+#endif
+ fpe = pfont->fpe;
+ (*fpe_functions[fpe->type].close_font) (fpe, pfont);
+ FreeFPE(fpe);
+ }
+ return (Success);
+}
+
+
+/***====================================================================***/
+
+ /*
+ * \ Sets up pReply as the correct QueryFontReply for pFont with the first
+ * nProtoCCIStructs char infos. \
+ */
+
+void
+QueryFont(pFont, pReply, nProtoCCIStructs)
+ FontPtr pFont;
+ xQueryFontReply *pReply; /* caller must allocate this storage */
+ int nProtoCCIStructs;
+{
+ FontPropPtr pFP;
+ int r,
+ c,
+ i;
+ xFontProp *prFP;
+ xCharInfo *prCI;
+ xCharInfo *charInfos[256];
+ unsigned char chars[512];
+ int ninfos;
+ unsigned long ncols;
+ unsigned long count;
+
+ /* pr->length set in dispatch */
+ pReply->minCharOrByte2 = pFont->info.firstCol;
+ pReply->defaultChar = pFont->info.defaultCh;
+ pReply->maxCharOrByte2 = pFont->info.lastCol;
+ pReply->drawDirection = pFont->info.drawDirection;
+ pReply->allCharsExist = pFont->info.allExist;
+ pReply->minByte1 = pFont->info.firstRow;
+ pReply->maxByte1 = pFont->info.lastRow;
+ pReply->fontAscent = pFont->info.fontAscent;
+ pReply->fontDescent = pFont->info.fontDescent;
+
+ pReply->minBounds = pFont->info.ink_minbounds;
+ pReply->maxBounds = pFont->info.ink_maxbounds;
+
+ pReply->nFontProps = pFont->info.nprops;
+ pReply->nCharInfos = nProtoCCIStructs;
+
+ for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]);
+ i < pFont->info.nprops;
+ i++, pFP++, prFP++) {
+ prFP->name = pFP->name;
+ prFP->value = pFP->value;
+ }
+
+ ninfos = 0;
+ ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1);
+ prCI = (xCharInfo *) (prFP);
+ for (r = pFont->info.firstRow;
+ ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow;
+ r++) {
+ i = 0;
+ for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) {
+ chars[i++] = r;
+ chars[i++] = c;
+ }
+ (*pFont->get_metrics) (pFont, ncols, chars,
+ TwoD16Bit, &count, charInfos);
+ i = 0;
+ for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
+ *prCI = *charInfos[i];
+ prCI++;
+ ninfos++;
+ }
+ }
+ return;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
+#else
+doListFontsAndAliases(client, c)
+ ClientPtr client;
+ LFclosurePtr c;
+#endif
+{
+ FontPathElementPtr fpe;
+ int err = Successful;
+ FontNamesPtr names = NULL;
+ char *name, *resolved=NULL;
+ int namelen, resolvedlen;
+ int nnames;
+ int stringLens;
+ int i;
+ xListFontsReply reply;
+ char *bufptr;
+ char *bufferStart;
+ int aliascount;
+
+ if (client->clientGone)
+ {
+ if (c->current.current_fpe < c->num_fpes)
+ {
+ fpe = c->fpe_list[c->current.current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
+ }
+
+ if (!c->current.patlen)
+ goto finish;
+
+ while (c->current.current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current.current_fpe];
+ err = Successful;
+
+ if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
+ {
+ /* This FPE doesn't support/require list_fonts_and_aliases */
+
+ err = (*fpe_functions[fpe->type].list_fonts)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ c->names);
+
+ if (err == Suspended) {
+ if (!c->slept) {
+ c->slept = TRUE;
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
+ (pointer) c);
+ }
+ return TRUE;
+ }
+
+ err = BadFontName;
+ }
+ else
+ {
+ /* Start of list_fonts_and_aliases functionality. Modeled
+ after list_fonts_with_info in that it resolves aliases,
+ except that the information collected from FPEs is just
+ names, not font info. Each list_next_font_or_alias()
+ returns either a name into name/namelen or an alias into
+ name/namelen and its target name into resolved/resolvedlen.
+ The code at this level then resolves the alias by polling
+ the FPEs. */
+
+ if (!c->current.list_started) {
+ err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ &c->current.private);
+ if (err == Suspended) {
+ if (!c->slept) {
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
+ (pointer) c);
+ c->slept = TRUE;
+ }
+ return TRUE;
+ }
+ if (err == Successful)
+ c->current.list_started = TRUE;
+ }
+ if (err == Successful) {
+ char *tmpname;
+ name = 0;
+ err = (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &name, &namelen, &tmpname,
+ &resolvedlen, c->current.private);
+ if (err == Suspended) {
+ if (!c->slept) {
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
+ (pointer) c);
+ c->slept = TRUE;
+ }
+ return TRUE;
+ }
+ if (err == FontNameAlias) {
+ if (resolved) xfree(resolved);
+ resolved = (char *) xalloc(resolvedlen + 1);
+ if (resolved)
+ memmove(resolved, tmpname, resolvedlen + 1);
+ }
+ }
+
+ if (err == Successful)
+ {
+ if (c->haveSaved)
+ {
+ if (c->savedName)
+ (void)AddFontNamesName(c->names, c->savedName,
+ c->savedNameLen);
+ }
+ else
+ (void)AddFontNamesName(c->names, name, namelen);
+ }
+
+ /*
+ * When we get an alias back, save our state and reset back to
+ * the start of the FPE looking for the specified name. As
+ * soon as a real font is found for the alias, pop back to the
+ * old state
+ */
+ else if (err == FontNameAlias) {
+ char tmp_pattern[XLFDMAXFONTNAMELEN];
+ /*
+ * when an alias recurses, we need to give
+ * the last FPE a chance to clean up; so we call
+ * it again, and assume that the error returned
+ * is BadFontName, indicating the alias resolution
+ * is complete.
+ */
+ memmove(tmp_pattern, resolved, resolvedlen);
+ if (c->haveSaved)
+ {
+ char *tmpname;
+ int tmpnamelen;
+
+ tmpname = 0;
+ (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
+ &tmpname, &tmpnamelen, c->current.private);
+ if (--aliascount <= 0)
+ {
+ err = BadFontName;
+ goto ContBadFontName;
+ }
+ }
+ else
+ {
+ c->saved = c->current;
+ c->haveSaved = TRUE;
+ if (c->savedName)
+ xfree(c->savedName);
+ c->savedName = (char *)xalloc(namelen + 1);
+ if (c->savedName)
+ memmove(c->savedName, name, namelen + 1);
+ c->savedNameLen = namelen;
+ aliascount = 20;
+ }
+ memmove(c->current.pattern, tmp_pattern, resolvedlen);
+ c->current.patlen = resolvedlen;
+ c->current.max_names = c->names->nnames + 1;
+ c->current.current_fpe = -1;
+ c->current.private = 0;
+ err = BadFontName;
+ }
+ }
+ /*
+ * At the end of this FPE, step to the next. If we've finished
+ * processing an alias, pop state back. If we've collected enough
+ * font names, quit.
+ */
+ if (err == BadFontName) {
+ ContBadFontName: ;
+ c->current.list_started = FALSE;
+ c->current.current_fpe++;
+ err = Successful;
+ if (c->haveSaved)
+ {
+ if (c->names->nnames == c->current.max_names ||
+ c->current.current_fpe == c->num_fpes) {
+ c->haveSaved = FALSE;
+ c->current = c->saved;
+ /* Give the saved namelist a chance to clean itself up */
+ continue;
+ }
+ }
+ if (c->names->nnames == c->current.max_names)
+ break;
+ }
+ }
+
+ /*
+ * send the reply
+ */
+ if (err != Successful) {
+ SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err));
+ goto bail;
+ }
+
+finish:
+
+ names = c->names;
+ nnames = names->nnames;
+ client = c->client;
+ stringLens = 0;
+ for (i = 0; i < nnames; i++)
+ stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
+
+ reply.type = X_Reply;
+ reply.length = (stringLens + nnames + 3) >> 2;
+ reply.nFonts = nnames;
+ reply.sequenceNumber = client->sequence;
+
+ bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2);
+
+ if (!bufptr && reply.length) {
+ SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
+ goto bail;
+ }
+ /*
+ * since WriteToClient long word aligns things, copy to temp buffer and
+ * write all at once
+ */
+ for (i = 0; i < nnames; i++) {
+ if (names->length[i] > 255)
+ reply.nFonts--;
+ else
+ {
+ *bufptr++ = names->length[i];
+ memmove( bufptr, names->names[i], names->length[i]);
+ bufptr += names->length[i];
+ }
+ }
+ nnames = reply.nFonts;
+ reply.length = (stringLens + nnames + 3) >> 2;
+ client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
+ WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
+ (void) WriteToClient(client, stringLens + nnames, bufferStart);
+ DEALLOCATE_LOCAL(bufferStart);
+
+bail:
+ if (c->slept)
+ ClientWakeup(client);
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->fpe_list);
+ if (c->savedName) xfree(c->savedName);
+ FreeFontNames(names);
+ xfree(c);
+ if (resolved) xfree(resolved);
+ return TRUE;
+}
+
+int
+ListFonts(client, pattern, length, max_names)
+ ClientPtr client;
+ unsigned char *pattern;
+ unsigned int length;
+ unsigned int max_names;
+{
+ int i;
+ LFclosurePtr c;
+
+ /*
+ * The right error to return here would be BadName, however the
+ * specification does not allow for a Name error on this request.
+ * Perhaps a better solution would be to return a nil list, i.e.
+ * a list containing zero fontnames.
+ */
+ if (length > XLFDMAXFONTNAMELEN)
+ return BadAlloc;
+
+ if (!(c = (LFclosurePtr) xalloc(sizeof *c)))
+ return BadAlloc;
+ c->fpe_list = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * num_fpes);
+ if (!c->fpe_list) {
+ xfree(c);
+ return BadAlloc;
+ }
+ c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
+ if (!c->names)
+ {
+ xfree(c->fpe_list);
+ xfree(c);
+ return BadAlloc;
+ }
+ memmove( c->current.pattern, pattern, length);
+ for (i = 0; i < num_fpes; i++) {
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
+ }
+ c->client = client;
+ c->num_fpes = num_fpes;
+ c->current.patlen = length;
+ c->current.current_fpe = 0;
+ c->current.max_names = max_names;
+ c->current.list_started = FALSE;
+ c->current.private = 0;
+ c->haveSaved = FALSE;
+ c->slept = FALSE;
+ c->savedName = 0;
+ doListFontsAndAliases(client, c);
+ return Success;
+}
+
+int
+doListFontsWithInfo(client, c)
+ ClientPtr client;
+ LFWIclosurePtr c;
+{
+ FontPathElementPtr fpe;
+ int err = Successful;
+ char *name;
+ int namelen;
+ int numFonts;
+ FontInfoRec fontInfo,
+ *pFontInfo;
+ xListFontsWithInfoReply *reply;
+ int length;
+ xFontProp *pFP;
+ int i;
+ int aliascount;
+ xListFontsWithInfoReply finalReply;
+
+ if (client->clientGone)
+ {
+ if (c->current.current_fpe < c->num_fpes)
+ {
+ fpe = c->fpe_list[c->current.current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
+ }
+ client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo];
+ if (!c->current.patlen)
+ goto finish;
+ while (c->current.current_fpe < c->num_fpes)
+ {
+ fpe = c->fpe_list[c->current.current_fpe];
+ err = Successful;
+ if (!c->current.list_started)
+ {
+ err = (*fpe_functions[fpe->type].start_list_fonts_with_info)
+ (client, fpe, c->current.pattern, c->current.patlen,
+ c->current.max_names, &c->current.private);
+ if (err == Suspended)
+ {
+ if (!c->slept)
+ {
+ ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
+ c->slept = TRUE;
+ }
+ return TRUE;
+ }
+ if (err == Successful)
+ c->current.list_started = TRUE;
+ }
+ if (err == Successful)
+ {
+ name = 0;
+ pFontInfo = &fontInfo;
+ err = (*fpe_functions[fpe->type].list_next_font_with_info)
+ (client, fpe, &name, &namelen, &pFontInfo,
+ &numFonts, c->current.private);
+ if (err == Suspended)
+ {
+ if (!c->slept)
+ {
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsWithInfo,
+ c);
+ c->slept = TRUE;
+ }
+ return TRUE;
+ }
+ }
+ /*
+ * When we get an alias back, save our state and reset back to the
+ * start of the FPE looking for the specified name. As soon as a real
+ * font is found for the alias, pop back to the old state
+ */
+ if (err == FontNameAlias)
+ {
+ /*
+ * when an alias recurses, we need to give
+ * the last FPE a chance to clean up; so we call
+ * it again, and assume that the error returned
+ * is BadFontName, indicating the alias resolution
+ * is complete.
+ */
+ if (c->haveSaved)
+ {
+ char *tmpname;
+ int tmpnamelen;
+ FontInfoPtr tmpFontInfo;
+
+ tmpname = 0;
+ tmpFontInfo = &fontInfo;
+ (void) (*fpe_functions[fpe->type].list_next_font_with_info)
+ (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo,
+ &numFonts, c->current.private);
+ if (--aliascount <= 0)
+ {
+ err = BadFontName;
+ goto ContBadFontName;
+ }
+ }
+ else
+ {
+ c->saved = c->current;
+ c->haveSaved = TRUE;
+ c->savedNumFonts = numFonts;
+ c->savedName = (char *) pFontInfo;
+ aliascount = 20;
+ }
+ memmove(c->current.pattern, name, namelen);
+ c->current.patlen = namelen;
+ c->current.max_names = 1;
+ c->current.current_fpe = 0;
+ c->current.private = 0;
+ c->current.list_started = FALSE;
+ }
+ /*
+ * At the end of this FPE, step to the next. If we've finished
+ * processing an alias, pop state back. If we've sent enough font
+ * names, quit. Always wait for BadFontName to let the FPE
+ * have a chance to clean up.
+ */
+ else if (err == BadFontName)
+ {
+ ContBadFontName: ;
+ c->current.list_started = FALSE;
+ c->current.current_fpe++;
+ err = Successful;
+ if (c->haveSaved)
+ {
+ if (c->current.max_names == 0 ||
+ c->current.current_fpe == c->num_fpes)
+ {
+ c->haveSaved = FALSE;
+ c->saved.max_names -= (1 - c->current.max_names);
+ c->current = c->saved;
+ }
+ }
+ else if (c->current.max_names == 0)
+ break;
+ }
+ else if (err == Successful)
+ {
+ length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
+ reply = c->reply;
+ if (c->length < length)
+ {
+ reply = (xListFontsWithInfoReply *) xrealloc(c->reply, length);
+ if (!reply)
+ {
+ err = AllocError;
+ break;
+ }
+ c->reply = reply;
+ c->length = length;
+ }
+ if (c->haveSaved)
+ {
+ numFonts = c->savedNumFonts;
+ name = c->savedName;
+ namelen = strlen(name);
+ }
+ reply->type = X_Reply;
+ reply->length = (sizeof *reply - sizeof(xGenericReply) +
+ pFontInfo->nprops * sizeof(xFontProp) +
+ namelen + 3) >> 2;
+ reply->sequenceNumber = client->sequence;
+ reply->nameLength = namelen;
+ reply->minBounds = pFontInfo->ink_minbounds;
+ reply->maxBounds = pFontInfo->ink_maxbounds;
+ reply->minCharOrByte2 = pFontInfo->firstCol;
+ reply->maxCharOrByte2 = pFontInfo->lastCol;
+ reply->defaultChar = pFontInfo->defaultCh;
+ reply->nFontProps = pFontInfo->nprops;
+ reply->drawDirection = pFontInfo->drawDirection;
+ reply->minByte1 = pFontInfo->firstRow;
+ reply->maxByte1 = pFontInfo->lastRow;
+ reply->allCharsExist = pFontInfo->allExist;
+ reply->fontAscent = pFontInfo->fontAscent;
+ reply->fontDescent = pFontInfo->fontDescent;
+ reply->nReplies = numFonts;
+ pFP = (xFontProp *) (reply + 1);
+ for (i = 0; i < pFontInfo->nprops; i++)
+ {
+ pFP->name = pFontInfo->props[i].name;
+ pFP->value = pFontInfo->props[i].value;
+ pFP++;
+ }
+ WriteSwappedDataToClient(client, length, reply);
+ (void) WriteToClient(client, namelen, name);
+ if (pFontInfo == &fontInfo)
+ {
+ xfree(fontInfo.props);
+ xfree(fontInfo.isStringProp);
+ }
+ --c->current.max_names;
+ }
+ }
+finish:
+ length = sizeof(xListFontsWithInfoReply);
+ bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply));
+ finalReply.type = X_Reply;
+ finalReply.sequenceNumber = client->sequence;
+ finalReply.length = (sizeof(xListFontsWithInfoReply)
+ - sizeof(xGenericReply)) >> 2;
+ WriteSwappedDataToClient(client, length, &finalReply);
+bail:
+ if (c->slept)
+ ClientWakeup(client);
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->reply);
+ xfree(c->fpe_list);
+ xfree(c);
+ return TRUE;
+}
+
+int
+StartListFontsWithInfo(client, length, pattern, max_names)
+ ClientPtr client;
+ int length;
+ unsigned char *pattern;
+ int max_names;
+{
+ int i;
+ LFWIclosurePtr c;
+
+ /*
+ * The right error to return here would be BadName, however the
+ * specification does not allow for a Name error on this request.
+ * Perhaps a better solution would be to return a nil list, i.e.
+ * a list containing zero fontnames.
+ */
+ if (length > XLFDMAXFONTNAMELEN)
+ return BadAlloc;
+
+ if (!(c = (LFWIclosurePtr) xalloc(sizeof *c)))
+ goto badAlloc;
+ c->fpe_list = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * num_fpes);
+ if (!c->fpe_list)
+ {
+ xfree(c);
+ goto badAlloc;
+ }
+ memmove(c->current.pattern, pattern, length);
+ for (i = 0; i < num_fpes; i++)
+ {
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
+ }
+ c->client = client;
+ c->num_fpes = num_fpes;
+ c->reply = 0;
+ c->length = 0;
+ c->current.patlen = length;
+ c->current.current_fpe = 0;
+ c->current.max_names = max_names;
+ c->current.list_started = FALSE;
+ c->current.private = 0;
+ c->savedNumFonts = 0;
+ c->haveSaved = FALSE;
+ c->slept = FALSE;
+ doListFontsWithInfo(client, c);
+ return Success;
+badAlloc:
+ return BadAlloc;
+}
+
+#define TextEltHeader 2
+#define FontShiftSize 5
+static XID clearGC[] = { CT_NONE };
+#define clearGCmask (GCClipMask)
+
+int
+doPolyText(client, c)
+ ClientPtr client;
+ register PTclosurePtr c;
+{
+ register FontPtr pFont = c->pGC->font, oldpFont;
+ Font fid, oldfid;
+ int err = Success, lgerr; /* err is in X error, not font error, space */
+ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state;
+ FontPathElementPtr fpe;
+ GC *origGC;
+
+ if (client->clientGone)
+ {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+
+ if (c->slept)
+ {
+ /* Client has died, but we cannot bail out right now. We
+ need to clean up after the work we did when going to
+ sleep. Setting the drawable pointer to 0 makes this
+ happen without any attempts to render or perform other
+ unnecessary activities. */
+ c->pDraw = (DrawablePtr)0;
+ }
+ else
+ {
+ err = Success;
+ goto bail;
+ }
+ }
+
+ /* Make sure our drawable hasn't disappeared while we slept. */
+ if (c->slept &&
+ c->pDraw &&
+ c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
+ RC_DRAWABLE, SecurityWriteAccess))
+ {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client and avoid further
+ rendering while we clean up after ourself. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ c->pDraw = (DrawablePtr)0;
+ }
+
+ client_state = c->slept ? SLEEPING : NEVER_SLEPT;
+
+ while (c->endReq - c->pElt > TextEltHeader)
+ {
+ if (*c->pElt == FontChange)
+ {
+ if (c->endReq - c->pElt < FontShiftSize)
+ {
+ err = BadLength;
+ goto bail;
+ }
+
+ oldpFont = pFont;
+ oldfid = fid;
+
+ fid = ((Font)*(c->pElt+4)) /* big-endian */
+ | ((Font)*(c->pElt+3)) << 8
+ | ((Font)*(c->pElt+2)) << 16
+ | ((Font)*(c->pElt+1)) << 24;
+ pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT,
+ SecurityReadAccess);
+ if (!pFont)
+ {
+ client->errorValue = fid;
+ err = BadFont;
+ /* restore pFont and fid for step 4 (described below) */
+ pFont = oldpFont;
+ fid = oldfid;
+
+ /* If we're in START_SLEEP mode, the following step
+ shortens the request... in the unlikely event that
+ the fid somehow becomes valid before we come through
+ again to actually execute the polytext, which would
+ then mess up our refcounting scheme badly. */
+ c->err = err;
+ c->endReq = c->pElt;
+
+ goto bail;
+ }
+
+ /* Step 3 (described below) on our new font */
+ if (client_state == START_SLEEP)
+ pFont->refcnt++;
+ else
+ {
+ if (pFont != c->pGC->font && c->pDraw)
+ {
+ ChangeGC( c->pGC, GCFont, &fid);
+ ValidateGC(c->pDraw, c->pGC);
+ if (c->reqType == X_PolyText8)
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
+ else
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
+ }
+
+ /* Undo the refcnt++ we performed when going to sleep */
+ if (client_state == SLEEPING)
+ (void)CloseFont(c->pGC->font, (Font)0);
+ }
+ c->pElt += FontShiftSize;
+ }
+ else /* print a string */
+ {
+ unsigned char *pNextElt;
+ pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize;
+ if ( pNextElt > c->endReq)
+ {
+ err = BadLength;
+ goto bail;
+ }
+ if (client_state == START_SLEEP)
+ {
+ c->pElt = pNextElt;
+ continue;
+ }
+ if (c->pDraw)
+ {
+ lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize,
+ c->pElt + TextEltHeader);
+ }
+ else lgerr = Successful;
+
+ if (lgerr == Suspended)
+ {
+ if (!c->slept) {
+ int len;
+ GC *pGC;
+ PTclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to do a few things
+ to ensure successful and atomic-appearing execution of the
+ remainder of the request. First, copy the remainder of the
+ request into a safe malloc'd area. Second, create a scratch GC
+ to use for the remainder of the request. Third, mark all fonts
+ referenced in the remainder of the request to prevent their
+ deallocation. Fourth, make the original GC look like the
+ request has completed... set its font to the final font value
+ from this request. These GC manipulations are for the unlikely
+ (but possible) event that some other client is using the GC.
+ Steps 3 and 4 are performed by running this procedure through
+ the remainder of the request in a special no-render mode
+ indicated by client_state = START_SLEEP. */
+
+ /* Step 1 */
+ /* Allocate a malloc'd closure structure to replace
+ the local one we were passed */
+ new_closure = (PTclosurePtr) xalloc(sizeof(PTclosureRec));
+ if (!new_closure)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+ c = new_closure;
+
+ len = c->endReq - c->pElt;
+ c->data = (unsigned char *)xalloc(len);
+ if (!c->data)
+ {
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(c->data, c->pElt, len);
+ c->pElt = c->data;
+ c->endReq = c->pElt + len;
+
+ /* Step 2 */
+
+ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
+ if (!pGC)
+ {
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(c->pGC, pGC, GCFunction |
+ GCPlaneMask | GCForeground |
+ GCBackground | GCFillStyle |
+ GCTile | GCStipple |
+ GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) !=
+ Success)
+ {
+ FreeScratchGC(pGC);
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ origGC = c->pGC;
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ c->slept = TRUE;
+ ClientSleep(client,
+ (ClientSleepProcPtr)doPolyText,
+ (pointer) c);
+
+ /* Set up to perform steps 3 and 4 */
+ client_state = START_SLEEP;
+ continue; /* on to steps 3 and 4 */
+ }
+ return TRUE;
+ }
+ else if (lgerr != Successful)
+ {
+ err = FontToXError(lgerr);
+ goto bail;
+ }
+ if (c->pDraw)
+ {
+ c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
+ c->xorg = (* c->polyText)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ *c->pElt, c->pElt + TextEltHeader);
+ }
+ c->pElt = pNextElt;
+ }
+ }
+
+bail:
+
+ if (client_state == START_SLEEP)
+ {
+ /* Step 4 */
+ if (pFont != origGC->font)
+ {
+ ChangeGC(origGC, GCFont, &fid);
+ ValidateGC(c->pDraw, origGC);
+ }
+
+ /* restore pElt pointer for execution of remainder of the request */
+ c->pElt = c->data;
+ return TRUE;
+ }
+
+ if (c->err != Success) err = c->err;
+ if (err != Success && c->client != serverClient) {
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (c->slept)
+ {
+ ClientWakeup(c->client);
+ ChangeGC(c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font)0);
+ c->pGC->font = NullFont;
+
+ FreeScratchGC(c->pGC);
+ xfree(c->data);
+ xfree(c);
+ }
+ return TRUE;
+}
+
+int
+PolyText(client, pDraw, pGC, pElt, endReq, xorg, yorg, reqType, did)
+ ClientPtr client;
+ DrawablePtr pDraw;
+ GC *pGC;
+ unsigned char *pElt;
+ unsigned char *endReq;
+ int xorg;
+ int yorg;
+ int reqType;
+ XID did;
+{
+ PTclosureRec local_closure;
+
+ local_closure.pElt = pElt;
+ local_closure.endReq = endReq;
+ local_closure.client = client;
+ local_closure.pDraw = pDraw;
+ local_closure.xorg = xorg;
+ local_closure.yorg = yorg;
+ if ((local_closure.reqType = reqType) == X_PolyText8)
+ {
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
+ local_closure.itemSize = 1;
+ }
+ else
+ {
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
+ local_closure.itemSize = 2;
+ }
+ local_closure.pGC = pGC;
+ local_closure.did = did;
+ local_closure.err = Success;
+ local_closure.slept = FALSE;
+
+ (void) doPolyText(client, &local_closure);
+ return Success;
+}
+
+
+#undef TextEltHeader
+#undef FontShiftSize
+
+int
+doImageText(client, c)
+ ClientPtr client;
+ register ITclosurePtr c;
+{
+ int err = Success, lgerr; /* err is in X error, not font error, space */
+ FontPathElementPtr fpe;
+
+ if (client->clientGone)
+ {
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
+ }
+
+ /* Make sure our drawable hasn't disappeared while we slept. */
+ if (c->slept &&
+ c->pDraw &&
+ c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
+ RC_DRAWABLE, SecurityWriteAccess))
+ {
+ /* Our drawable has disappeared. Treat like client died... ask
+ the FPE code to clean up after client. */
+ fpe = c->pGC->font->fpe;
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ err = Success;
+ goto bail;
+ }
+
+ lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
+ if (lgerr == Suspended)
+ {
+ if (!c->slept) {
+ GC *pGC;
+ unsigned char *data;
+ ITclosurePtr new_closure;
+
+ /* We're putting the client to sleep. We need to
+ save some state. Similar problem to that handled
+ in doPolyText, but much simpler because the
+ request structure is much simpler. */
+
+ new_closure = (ITclosurePtr) xalloc(sizeof(ITclosureRec));
+ if (!new_closure)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ *new_closure = *c;
+ c = new_closure;
+
+ data = (unsigned char *)xalloc(c->nChars * c->itemSize);
+ if (!data)
+ {
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ memmove(data, c->data, c->nChars * c->itemSize);
+ c->data = data;
+
+ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
+ if (!pGC)
+ {
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
+ GCForeground | GCBackground | GCFillStyle |
+ GCTile | GCStipple | GCTileStipXOrigin |
+ GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask)) != Success)
+ {
+ FreeScratchGC(pGC);
+ xfree(c->data);
+ xfree(c);
+ err = BadAlloc;
+ goto bail;
+ }
+ c->pGC = pGC;
+ ValidateGC(c->pDraw, c->pGC);
+
+ c->slept = TRUE;
+ ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c);
+ }
+ return TRUE;
+ }
+ else if (lgerr != Successful)
+ {
+ err = FontToXError(lgerr);
+ goto bail;
+ }
+ if (c->pDraw)
+ {
+ (* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg,
+ c->nChars, c->data);
+ }
+
+bail:
+
+ if (err != Success && c->client != serverClient) {
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
+ }
+ if (c->slept)
+ {
+ ClientWakeup(c->client);
+ ChangeGC(c->pGC, clearGCmask, clearGC);
+
+ /* Unreference the font from the scratch GC */
+ CloseFont(c->pGC->font, (Font)0);
+ c->pGC->font = NullFont;
+
+ FreeScratchGC(c->pGC);
+ xfree(c->data);
+ xfree(c);
+ }
+ return TRUE;
+}
+
+int
+ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did)
+ ClientPtr client;
+ DrawablePtr pDraw;
+ GC *pGC;
+ int nChars;
+ unsigned char *data;
+ int xorg;
+ int yorg;
+ int reqType;
+ XID did;
+{
+ ITclosureRec local_closure;
+
+ local_closure.client = client;
+ local_closure.pDraw = pDraw;
+ local_closure.pGC = pGC;
+ local_closure.nChars = nChars;
+ local_closure.data = data;
+ local_closure.xorg = xorg;
+ local_closure.yorg = yorg;
+ if ((local_closure.reqType = reqType) == X_ImageText8)
+ {
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
+ local_closure.itemSize = 1;
+ }
+ else
+ {
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
+ local_closure.itemSize = 2;
+ }
+ local_closure.did = did;
+ local_closure.slept = FALSE;
+
+ (void) doImageText(client, &local_closure);
+ return Success;
+}
+
+
+/* does the necessary magic to figure out the fpe type */
+static int
+#if NeedFunctionPrototypes
+DetermineFPEType(char *pathname)
+#else
+DetermineFPEType(pathname)
+ char *pathname;
+#endif
+{
+ int i;
+
+ for (i = 0; i < num_fpe_types; i++) {
+ if ((*fpe_functions[i].name_check) (pathname))
+ return i;
+ }
+ return -1;
+}
+
+
+static void
+#if NeedFunctionPrototypes
+FreeFontPath(FontPathElementPtr *list, int n, Bool force)
+#else
+FreeFontPath(list, n, force)
+ FontPathElementPtr *list;
+ Bool force;
+ int n;
+#endif
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ if (force) {
+ /* Sanity check that all refcounts will be 0 by the time
+ we get to the end of the list. */
+ int found = 1; /* the first reference is us */
+ int j;
+ for (j = i+1; j < n; j++) {
+ if (list[j] == list[i])
+ found++;
+ }
+ if (list[i]->refcount != found) {
+ ErrorF("FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n",
+ list[i]->name_length, list[i]->name,
+ list[i]->refcount, found);
+ list[i]->refcount = found; /* ensure it will get freed */
+ }
+ }
+ FreeFPE(list[i]);
+ }
+ xfree((char *) list);
+}
+
+static FontPathElementPtr
+#if NeedFunctionPrototypes
+find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len)
+#else
+find_existing_fpe(list, num, name, len)
+ FontPathElementPtr *list;
+ int num;
+ unsigned char *name;
+ int len;
+#endif
+{
+ FontPathElementPtr fpe;
+ int i;
+
+ for (i = 0; i < num; i++) {
+ fpe = list[i];
+ if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0)
+ return fpe;
+ }
+ return (FontPathElementPtr) 0;
+}
+
+
+static int
+#if NeedFunctionPrototypes
+SetFontPathElements(int npaths, unsigned char *paths, int *bad)
+#else
+SetFontPathElements(npaths, paths, bad)
+ int npaths;
+ unsigned char *paths;
+ int *bad;
+#endif
+{
+ int i,
+ err;
+ int valid_paths = 0;
+ unsigned int len;
+ unsigned char *cp = paths;
+ FontPathElementPtr fpe,
+ *fplist;
+
+ fplist = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * npaths);
+ if (!fplist) {
+ *bad = 0;
+ return BadAlloc;
+ }
+ for (i = 0; i < num_fpe_types; i++) {
+ if (fpe_functions[i].set_path_hook)
+ (*fpe_functions[i].set_path_hook) ();
+ }
+ for (i = 0; i < npaths; i++) {
+ len = (unsigned int) (*cp++);
+
+ if (len) {
+ /* if it's already in our active list, just reset it */
+ /*
+ * note that this can miss FPE's in limbo -- may be worth catching
+ * them, though it'd muck up refcounting
+ */
+ fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
+ if (fpe) {
+ err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
+ if (err == Successful) {
+ UseFPE(fpe);/* since it'll be decref'd later when freed
+ * from the old list */
+ fplist[valid_paths++] = fpe;
+ cp += len;
+ continue;
+ }
+ /* if error or can't do it, act like it's a new one */
+ }
+ fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
+ if (!fpe) {
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->name = (char *) xalloc(len + 1);
+ if (!fpe->name) {
+ xfree(fpe);
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->refcount = 1;
+
+ strncpy(fpe->name, (char *) cp, (int) len);
+ cp += len;
+ fpe->name[len] = '\0';
+ fpe->name_length = len;
+ fpe->type = DetermineFPEType(fpe->name);
+ if (fpe->type == -1) {
+ xfree(fpe->name);
+ xfree(fpe);
+ err = BadValue;
+ goto bail;
+ }
+ err = (*fpe_functions[fpe->type].init_fpe) (fpe);
+ if (!loadableFonts) {
+ if (err != Successful) {
+ xfree(fpe->name);
+ xfree(fpe);
+ err = BadValue;
+ goto bail;
+ }
+ fplist[valid_paths++] = fpe;
+ } else {
+ if (err == Successful) /* a successful font, add it to list */
+ fplist[valid_paths++] = fpe;
+ else
+ ErrorF("Removing %s from the valid list of fontpaths\n",
+ fpe->name);
+ }
+ } else {
+ err = BadValue;
+ goto bail;
+ }
+ }
+
+ FreeFontPath(font_path_elements, num_fpes, FALSE);
+ font_path_elements = fplist;
+ if (patternCache)
+ EmptyFontPatternCache(patternCache);
+ num_fpes = valid_paths;
+
+ return Success;
+bail:
+ *bad = i;
+ while (--i >= 0)
+ FreeFPE(fplist[i]);
+ xfree(fplist);
+ return err;
+}
+
+/* XXX -- do we need to pass error down to each renderer? */
+int
+SetFontPath(client, npaths, paths, error)
+ ClientPtr client;
+ int npaths;
+ unsigned char *paths;
+ int *error;
+{
+ int err = Success;
+
+ if (npaths == 0) {
+ if (SetDefaultFontPath(defaultFontPath) != Success)
+ return BadName;
+ } else {
+ err = SetFontPathElements(npaths, paths, error);
+ }
+ return err;
+}
+
+int
+SetDefaultFontPath(path)
+ char *path;
+{
+ unsigned char *cp,
+ *pp,
+ *nump,
+ *newpath;
+ int num = 1,
+ len,
+ err,
+ size = 0,
+ bad;
+
+ /* get enough for string, plus values -- use up commas */
+ len = strlen(path) + 1;
+ nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
+ if (!newpath)
+ return BadAlloc;
+ pp = (unsigned char *) path;
+ cp++;
+ while (*pp) {
+ if (*pp == ',') {
+ *nump = (unsigned char) size;
+ nump = cp++;
+ pp++;
+ num++;
+ size = 0;
+ } else {
+ *cp++ = *pp++;
+ size++;
+ }
+ }
+ *nump = (unsigned char) size;
+
+ err = SetFontPathElements(num, newpath, &bad);
+
+ DEALLOCATE_LOCAL(newpath);
+
+ return err;
+}
+
+unsigned char *
+GetFontPath(count, length)
+ int *count;
+ int *length;
+{
+ int i;
+ unsigned char *c;
+ int len;
+ FontPathElementPtr fpe;
+
+ len = 0;
+ for (i = 0; i < num_fpes; i++) {
+ fpe = font_path_elements[i];
+ len += fpe->name_length + 1;
+ }
+ font_path_string = (unsigned char *) xrealloc(font_path_string, len);
+ if (!font_path_string)
+ return NULL;
+
+ c = font_path_string;
+ *length = 0;
+ for (i = 0; i < num_fpes; i++) {
+ fpe = font_path_elements[i];
+ *c = fpe->name_length;
+ *length += *c++;
+ memmove(c, fpe->name, fpe->name_length);
+ c += fpe->name_length;
+ }
+ *count = num_fpes;
+ return font_path_string;
+}
+
+int
+LoadGlyphs(client, pfont, nchars, item_size, data)
+ ClientPtr client;
+ FontPtr pfont;
+ unsigned nchars;
+ int item_size;
+ unsigned char *data;
+{
+ if (fpe_functions[pfont->fpe->type].load_glyphs)
+ return (*fpe_functions[pfont->fpe->type].load_glyphs)
+ (client, pfont, 0, nchars, item_size, data);
+ else
+ return Successful;
+}
+
+void
+DeleteClientFontStuff(client)
+ ClientPtr client;
+{
+ int i;
+ FontPathElementPtr fpe;
+
+ for (i = 0; i < num_fpes; i++)
+ {
+ fpe = font_path_elements[i];
+ if (fpe_functions[fpe->type].client_died)
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+}
+
+void
+InitFonts ()
+{
+ patternCache = MakeFontPatternCache();
+
+ if (screenInfo.numScreens > screenInfo.numVideoScreens) {
+ PrinterFontRegisterFpeFunctions();
+ FontFileCheckRegisterFpeFunctions();
+ check_fs_register_fpe_functions();
+ } else {
+ FontFileRegisterFpeFunctions();
+ fs_register_fpe_functions();
+ }
+}
+
+int
+GetDefaultPointSize ()
+{
+ return 120;
+}
+
+
+FontResolutionPtr
+GetClientResolutions (num)
+ int *num;
+{
+ if (requestingClient && requestingClient->fontResFunc != NULL &&
+ !requestingClient->clientGone)
+ {
+ return (*requestingClient->fontResFunc)(requestingClient, num);
+ }
+ else {
+ static struct _FontResolution res;
+ ScreenPtr pScreen;
+
+ pScreen = screenInfo.screens[0];
+ res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth;
+ /*
+ * XXX - we'll want this as long as bitmap instances are prevalent
+ so that we can match them from scalable fonts
+ */
+ if (res.x_resolution < 88)
+ res.x_resolution = 75;
+ else
+ res.x_resolution = 100;
+ res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight;
+ if (res.y_resolution < 88)
+ res.y_resolution = 75;
+ else
+ res.y_resolution = 100;
+ res.point_size = 120;
+ *num = 1;
+ return &res;
+ }
+}
+
+/*
+ * returns the type index of the new fpe
+ *
+ * should be called (only once!) by each type of fpe when initialized
+ */
+
+int
+RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func,
+ SetPathFunc set_path_func)
+{
+ FPEFunctions *new;
+
+ /* grow the list */
+ new = (FPEFunctions *) xrealloc(fpe_functions,
+ (num_fpe_types + 1) * sizeof(FPEFunctions));
+ if (!new)
+ return -1;
+ fpe_functions = new;
+
+ fpe_functions[num_fpe_types].name_check = name_func;
+ fpe_functions[num_fpe_types].open_font = open_func;
+ fpe_functions[num_fpe_types].close_font = close_func;
+ fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func;
+ fpe_functions[num_fpe_types].list_fonts = list_func;
+ fpe_functions[num_fpe_types].start_list_fonts_with_info =
+ start_lfwi_func;
+ fpe_functions[num_fpe_types].list_next_font_with_info =
+ next_lfwi_func;
+ fpe_functions[num_fpe_types].init_fpe = init_func;
+ fpe_functions[num_fpe_types].free_fpe = free_func;
+ fpe_functions[num_fpe_types].reset_fpe = reset_func;
+ fpe_functions[num_fpe_types].client_died = client_died;
+ fpe_functions[num_fpe_types].load_glyphs = load_glyphs;
+ fpe_functions[num_fpe_types].start_list_fonts_and_aliases =
+ start_list_alias_func;
+ fpe_functions[num_fpe_types].list_next_font_or_alias =
+ next_list_alias_func;
+ fpe_functions[num_fpe_types].set_path_hook = set_path_func;
+
+ return num_fpe_types++;
+}
+
+void
+FreeFonts()
+{
+ if (patternCache) {
+ FreeFontPatternCache(patternCache);
+ patternCache = 0;
+ }
+ FreeFontPath(font_path_elements, num_fpes, TRUE);
+ font_path_elements = 0;
+ num_fpes = 0;
+ xfree(fpe_functions);
+ num_fpe_types = 0;
+ fpe_functions = (FPEFunctions *) 0;
+}
+
+/* convenience functions for FS interface */
+
+FontPtr
+find_old_font(id)
+ XID id;
+{
+ return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE,
+ SecurityUnknownAccess);
+}
+
+Font
+GetNewFontClientID()
+{
+ return FakeClientID(0);
+}
+
+int
+StoreFontClientFont(pfont, id)
+ FontPtr pfont;
+ Font id;
+{
+ return AddResource(id, RT_NONE, (pointer) pfont);
+}
+
+void
+DeleteFontClientID(id)
+ Font id;
+{
+ FreeResource(id, RT_NONE);
+}
+
+int
+client_auth_generation(client)
+ ClientPtr client;
+{
+ return 0;
+}
+
+static int fs_handlers_installed = 0;
+static unsigned int last_server_gen;
+
+int
+init_fs_handlers(fpe, block_handler)
+ FontPathElementPtr fpe;
+ BlockHandlerProcPtr block_handler;
+{
+ /* if server has reset, make sure the b&w handlers are reinstalled */
+ if (last_server_gen < serverGeneration) {
+ last_server_gen = serverGeneration;
+ fs_handlers_installed = 0;
+ }
+ if (fs_handlers_installed == 0) {
+
+#ifdef DEBUG
+ fprintf(stderr, "adding FS b & w handlers\n");
+#endif
+
+ if (!RegisterBlockAndWakeupHandlers(block_handler,
+ FontWakeup, (pointer) 0))
+ return AllocError;
+ fs_handlers_installed++;
+ }
+ QueueFontWakeup(fpe);
+ return Successful;
+}
+
+void
+remove_fs_handlers(fpe, block_handler, all)
+ FontPathElementPtr fpe;
+ BlockHandlerProcPtr block_handler;
+ Bool all;
+{
+ if (all) {
+ /* remove the handlers if no one else is using them */
+ if (--fs_handlers_installed == 0) {
+
+#ifdef DEBUG
+ fprintf(stderr, "removing FS b & w handlers\n");
+#endif
+
+ RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
+ (pointer) 0);
+ }
+ }
+ RemoveFontWakeup(fpe);
+}
+
+#ifdef DEBUG
+#define GLWIDTHBYTESPADDED(bits,nbytes) \
+ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
+ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
+ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
+ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
+ : 0)
+
+#define GLYPH_SIZE(ch, nbytes) \
+ GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \
+ (ch)->metrics.leftSideBearing, (nbytes))
+dump_char_ascii(cip)
+ CharInfoPtr cip;
+{
+ int r,
+ l;
+ int bpr;
+ int byte;
+ static unsigned maskTab[] = {
+ (1 << 7), (1 << 6), (1 << 5), (1 << 4),
+ (1 << 3), (1 << 2), (1 << 1), (1 << 0),
+ };
+
+ bpr = GLYPH_SIZE(cip, 4);
+ for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) {
+ pointer row = (pointer) cip->bits + r * bpr;
+
+ byte = 0;
+ for (l = 0; l <= (cip->metrics.rightSideBearing -
+ cip->metrics.leftSideBearing); l++) {
+ if (maskTab[l & 7] & row[l >> 3])
+ putchar('X');
+ else
+ putchar('.');
+ }
+ putchar('\n');
+ }
+}
+
+#endif
diff --git a/xc/programs/Xserver/dix/dixutils.c b/xc/programs/Xserver/dix/dixutils.c
new file mode 100644
index 000000000..ea4d0e3c8
--- /dev/null
+++ b/xc/programs/Xserver/dix/dixutils.c
@@ -0,0 +1,1002 @@
+/* $XFree86: xc/programs/Xserver/dix/dixutils.c,v 3.4 1999/01/13 08:30:52 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+
+(c)Copyright 1988,1991 Adobe Systems Incorporated. All rights reserved.
+
+Permission to use, copy, modify, distribute, and sublicense this software and its
+documentation for any purpose and without fee is hereby granted, provided that
+the above copyright notices appear in all copies and that both those copyright
+notices and this permission notice appear in supporting documentation and that
+the name of Adobe Systems Incorporated not be used in advertising or publicity
+pertaining to distribution of the software without specific, written prior
+permission. No trademark license to use the Adobe trademarks is hereby
+granted. If the Adobe trademark "Display PostScript"(tm) is used to describe
+this software, its functionality or for any other purpose, such use shall be
+limited to a statement that this software works in conjunction with the Display
+PostScript system. Proper trademark attribution to reflect Adobe's ownership
+of the trademark shall be given whenever any such reference to the Display
+PostScript system is made.
+
+ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY
+PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ADOBE
+DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
+INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE TO YOU
+OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,NEGLIGENCE, STRICT
+LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT PROVIDE ANY TRAINING OR OTHER
+SUPPORT FOR THE SOFTWARE.
+
+Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+Incorporated which may be registered in certain jurisdictions.
+
+Author: Adobe Systems Incorporated
+
+*/
+
+/* $TOG: dixutils.c /main/34 1998/02/09 14:18:57 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#define XK_LATIN1
+#include "keysymdef.h"
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+/*
+ * CompareTimeStamps returns -1, 0, or +1 depending on if the first
+ * argument is less than, equal to or greater than the second argument.
+ */
+
+int
+CompareTimeStamps(a, b)
+ TimeStamp a, b;
+{
+ if (a.months < b.months)
+ return EARLIER;
+ if (a.months > b.months)
+ return LATER;
+ if (a.milliseconds < b.milliseconds)
+ return EARLIER;
+ if (a.milliseconds > b.milliseconds)
+ return LATER;
+ return SAMETIME;
+}
+
+/*
+ * convert client times to server TimeStamps
+ */
+
+#define HALFMONTH ((unsigned long) 1<<31)
+TimeStamp
+ClientTimeToServerTime(c)
+ CARD32 c;
+{
+ TimeStamp ts;
+ if (c == CurrentTime)
+ return currentTime;
+ ts.months = currentTime.months;
+ ts.milliseconds = c;
+ if (c > currentTime.milliseconds)
+ {
+ if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
+ ts.months -= 1;
+ }
+ else if (c < currentTime.milliseconds)
+ {
+ if (((unsigned long)currentTime.milliseconds - c) > HALFMONTH)
+ ts.months += 1;
+ }
+ return ts;
+}
+
+/*
+ * ISO Latin-1 case conversion routine
+ *
+ * this routine always null-terminates the result, so
+ * beware of too-small buffers
+ */
+
+void
+CopyISOLatin1Lowered(dest, source, length)
+ register unsigned char *dest, *source;
+ int length;
+{
+ register int i;
+
+ for (i = 0; i < length; i++, source++, dest++)
+ {
+ if ((*source >= XK_A) && (*source <= XK_Z))
+ *dest = *source + (XK_a - XK_A);
+ else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis))
+ *dest = *source + (XK_agrave - XK_Agrave);
+ else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn))
+ *dest = *source + (XK_oslash - XK_Ooblique);
+ else
+ *dest = *source;
+ }
+ *dest = '\0';
+}
+
+#ifdef XCSECURITY
+
+/* SecurityLookupWindow and SecurityLookupDrawable:
+ * Look up the window/drawable taking into account the client doing
+ * the lookup and the type of access desired. Return the window/drawable
+ * if it exists and the client is allowed access, else return NULL.
+ * Most Proc* functions should be calling these instead of
+ * LookupWindow and LookupDrawable, which do no access checks.
+ */
+
+WindowPtr
+SecurityLookupWindow(rid, client, access_mode)
+ XID rid;
+ ClientPtr client;
+ Mask access_mode;
+{
+ WindowPtr pWin;
+
+ client->errorValue = rid;
+ if(rid == INVALID)
+ return NULL;
+ if (client->trustLevel != XSecurityClientTrusted)
+ return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode);
+ if (client->lastDrawableID == rid)
+ {
+ if (client->lastDrawable->type == DRAWABLE_WINDOW)
+ return ((WindowPtr) client->lastDrawable);
+ return (WindowPtr) NULL;
+ }
+ pWin = (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode);
+ if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) {
+ client->lastDrawable = (DrawablePtr) pWin;
+ client->lastDrawableID = rid;
+ client->lastGCID = INVALID;
+ client->lastGC = (GCPtr)NULL;
+ }
+ return pWin;
+}
+
+
+pointer
+SecurityLookupDrawable(rid, client, access_mode)
+ XID rid;
+ ClientPtr client;
+ Mask access_mode;
+{
+ register DrawablePtr pDraw;
+
+ if(rid == INVALID)
+ return (pointer) NULL;
+ if (client->trustLevel != XSecurityClientTrusted)
+ return (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE,
+ access_mode);
+ if (client->lastDrawableID == rid)
+ return ((pointer) client->lastDrawable);
+ pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE,
+ access_mode);
+ if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))
+ return (pointer)pDraw;
+ return (pointer)NULL;
+}
+
+/* We can't replace the LookupWindow and LookupDrawable functions with
+ * macros because of compatibility with loadable servers.
+ */
+
+WindowPtr
+LookupWindow(rid, client)
+ XID rid;
+ ClientPtr client;
+{
+ return SecurityLookupWindow(rid, client, SecurityUnknownAccess);
+}
+
+pointer
+LookupDrawable(rid, client)
+ XID rid;
+ ClientPtr client;
+{
+ return SecurityLookupDrawable(rid, client, SecurityUnknownAccess);
+}
+
+#else /* not XCSECURITY */
+
+WindowPtr
+LookupWindow(rid, client)
+ XID rid;
+ ClientPtr client;
+{
+ WindowPtr pWin;
+
+ client->errorValue = rid;
+ if(rid == INVALID)
+ return NULL;
+ if (client->lastDrawableID == rid)
+ {
+ if (client->lastDrawable->type == DRAWABLE_WINDOW)
+ return ((WindowPtr) client->lastDrawable);
+ return (WindowPtr) NULL;
+ }
+ pWin = (WindowPtr)LookupIDByType(rid, RT_WINDOW);
+ if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) {
+ client->lastDrawable = (DrawablePtr) pWin;
+ client->lastDrawableID = rid;
+ client->lastGCID = INVALID;
+ client->lastGC = (GCPtr)NULL;
+ }
+ return pWin;
+}
+
+
+pointer
+LookupDrawable(rid, client)
+ XID rid;
+ ClientPtr client;
+{
+ register DrawablePtr pDraw;
+
+ if(rid == INVALID)
+ return (pointer) NULL;
+ if (client->lastDrawableID == rid)
+ return ((pointer) client->lastDrawable);
+ pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE);
+ if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))
+ return (pointer)pDraw;
+ return (pointer)NULL;
+}
+
+#endif /* XCSECURITY */
+
+ClientPtr
+LookupClient(rid, client)
+ XID rid;
+ ClientPtr client;
+{
+ pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
+ SecurityReadAccess);
+ int clientIndex = CLIENT_ID(rid);
+
+ if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT))
+ {
+ return clients[clientIndex];
+ }
+ return (ClientPtr)NULL;
+}
+
+
+int
+AlterSaveSetForClient(client, pWin, mode)
+ ClientPtr client;
+ WindowPtr pWin;
+ unsigned mode;
+{
+ int numnow;
+ pointer *pTmp;
+ int j;
+
+ numnow = client->numSaved;
+ j = 0;
+ if (numnow)
+ {
+ pTmp = client->saveSet;
+ while ((j < numnow) && (pTmp[j] != (pointer)pWin))
+ j++;
+ }
+ if (mode == SetModeInsert)
+ {
+ if (j < numnow) /* duplicate */
+ return(Success);
+ numnow++;
+ pTmp = (pointer *)xrealloc(client->saveSet, sizeof(pointer) * numnow);
+ if (!pTmp)
+ return(BadAlloc);
+ client->saveSet = pTmp;
+ client->numSaved = numnow;
+ client->saveSet[numnow - 1] = (pointer)pWin;
+ return(Success);
+ }
+ else if ((mode == SetModeDelete) && (j < numnow))
+ {
+ while (j < numnow-1)
+ {
+ pTmp[j] = pTmp[j+1];
+ j++;
+ }
+ numnow--;
+ if (numnow)
+ {
+ pTmp = (pointer *)xrealloc(client->saveSet,
+ sizeof(pointer) * numnow);
+ if (pTmp)
+ client->saveSet = pTmp;
+ }
+ else
+ {
+ xfree(client->saveSet);
+ client->saveSet = (pointer *)NULL;
+ }
+ client->numSaved = numnow;
+ return(Success);
+ }
+ return(Success);
+}
+
+void
+DeleteWindowFromAnySaveSet(pWin)
+ WindowPtr pWin;
+{
+ register int i;
+ register ClientPtr client;
+
+ for (i = 0; i< currentMaxClients; i++)
+ {
+ client = clients[i];
+ if (client && client->numSaved)
+ (void)AlterSaveSetForClient(client, pWin, SetModeDelete);
+ }
+}
+
+/* No-op Don't Do Anything : sometimes we need to be able to call a procedure
+ * that doesn't do anything. For example, on screen with only static
+ * colormaps, if someone calls install colormap, it's easier to have a dummy
+ * procedure to call than to check if there's a procedure
+ */
+void
+NoopDDA(
+#if NeedVarargsPrototypes
+ void* f, ...
+#endif
+)
+{
+}
+
+typedef struct _BlockHandler {
+ BlockHandlerProcPtr BlockHandler;
+ WakeupHandlerProcPtr WakeupHandler;
+ pointer blockData;
+ Bool deleted;
+} BlockHandlerRec, *BlockHandlerPtr;
+
+static BlockHandlerPtr handlers;
+static int numHandlers;
+static int sizeHandlers;
+static Bool inHandler;
+static Bool handlerDeleted;
+
+/* called from the OS layer */
+void
+BlockHandler(pTimeout, pReadmask)
+pointer pTimeout; /* DIX doesn't want to know how OS represents time */
+pointer pReadmask; /* nor how it represents the set of descriptors */
+{
+ register int i, j;
+
+ ++inHandler;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ (* screenInfo.screens[i]->BlockHandler)(i,
+ screenInfo.screens[i]->blockData,
+ pTimeout, pReadmask);
+ for (i = 0; i < numHandlers; i++)
+ (*handlers[i].BlockHandler) (handlers[i].blockData,
+ pTimeout, pReadmask);
+ if (handlerDeleted)
+ {
+ for (i = 0; i < numHandlers;)
+ if (handlers[i].deleted)
+ {
+ for (j = i; j < numHandlers - 1; j++)
+ handlers[j] = handlers[j+1];
+ numHandlers--;
+ }
+ else
+ i++;
+ handlerDeleted = FALSE;
+ }
+ --inHandler;
+}
+
+void
+WakeupHandler(result, pReadmask)
+int result; /* 32 bits of undefined result from the wait */
+pointer pReadmask; /* the resulting descriptor mask */
+{
+ register int i, j;
+
+ ++inHandler;
+ for (i = numHandlers - 1; i >= 0; i--)
+ (*handlers[i].WakeupHandler) (handlers[i].blockData,
+ result, pReadmask);
+ for (i = 0; i < screenInfo.numScreens; i++)
+ (* screenInfo.screens[i]->WakeupHandler)(i,
+ screenInfo.screens[i]->wakeupData,
+ result, pReadmask);
+ if (handlerDeleted)
+ {
+ for (i = 0; i < numHandlers;)
+ if (handlers[i].deleted)
+ {
+ for (j = i; j < numHandlers - 1; j++)
+ handlers[j] = handlers[j+1];
+ numHandlers--;
+ }
+ else
+ i++;
+ handlerDeleted = FALSE;
+ }
+ --inHandler;
+}
+
+/* Reentrant with BlockHandler and WakeupHandler, except wakeup won't
+ * get called until next time
+ */
+
+Bool
+RegisterBlockAndWakeupHandlers (blockHandler, wakeupHandler, blockData)
+ BlockHandlerProcPtr blockHandler;
+ WakeupHandlerProcPtr wakeupHandler;
+ pointer blockData;
+{
+ BlockHandlerPtr new;
+
+ if (numHandlers >= sizeHandlers)
+ {
+ new = (BlockHandlerPtr) xrealloc (handlers, (numHandlers + 1) *
+ sizeof (BlockHandlerRec));
+ if (!new)
+ return FALSE;
+ handlers = new;
+ sizeHandlers = numHandlers + 1;
+ }
+ handlers[numHandlers].BlockHandler = blockHandler;
+ handlers[numHandlers].WakeupHandler = wakeupHandler;
+ handlers[numHandlers].blockData = blockData;
+ handlers[numHandlers].deleted = FALSE;
+ numHandlers = numHandlers + 1;
+ return TRUE;
+}
+
+void
+RemoveBlockAndWakeupHandlers (blockHandler, wakeupHandler, blockData)
+ BlockHandlerProcPtr blockHandler;
+ WakeupHandlerProcPtr wakeupHandler;
+ pointer blockData;
+{
+ int i;
+
+ for (i = 0; i < numHandlers; i++)
+ if (handlers[i].BlockHandler == blockHandler &&
+ handlers[i].WakeupHandler == wakeupHandler &&
+ handlers[i].blockData == blockData)
+ {
+ if (inHandler)
+ {
+ handlerDeleted = TRUE;
+ handlers[i].deleted = TRUE;
+ }
+ else
+ {
+ for (; i < numHandlers - 1; i++)
+ handlers[i] = handlers[i+1];
+ numHandlers--;
+ }
+ break;
+ }
+}
+
+void
+InitBlockAndWakeupHandlers ()
+{
+ xfree (handlers);
+ handlers = (BlockHandlerPtr) 0;
+ numHandlers = 0;
+ sizeHandlers = 0;
+}
+
+/*
+ * A general work queue. Perform some task before the server
+ * sleeps for input.
+ */
+
+WorkQueuePtr workQueue;
+static WorkQueuePtr *workQueueLast = &workQueue;
+
+void
+ProcessWorkQueue()
+{
+ WorkQueuePtr q, *p;
+
+ p = &workQueue;
+ /*
+ * Scan the work queue once, calling each function. Those
+ * which return TRUE are removed from the queue, otherwise
+ * they will be called again. This must be reentrant with
+ * QueueWorkProc.
+ */
+ while (q = *p)
+ {
+ if ((*q->function) (q->client, q->closure))
+ {
+ /* remove q from the list */
+ *p = q->next; /* don't fetch until after func called */
+ xfree (q);
+ }
+ else
+ {
+ p = &q->next; /* don't fetch until after func called */
+ }
+ }
+ workQueueLast = p;
+}
+
+void
+ProcessWorkQueueZombies()
+{
+ WorkQueuePtr q, *p;
+
+ p = &workQueue;
+ while (q = *p)
+ {
+ if (q->client && q->client->clientGone)
+ {
+ (void) (*q->function) (q->client, q->closure);
+ /* remove q from the list */
+ *p = q->next; /* don't fetch until after func called */
+ xfree (q);
+ }
+ else
+ {
+ p = &q->next; /* don't fetch until after func called */
+ }
+ }
+ workQueueLast = p;
+}
+
+Bool
+#if NeedFunctionPrototypes
+QueueWorkProc (
+ Bool (*function)(
+#if NeedNestedPrototypes
+ ClientPtr /* pClient */,
+ pointer /* closure */
+#endif
+ ),
+ ClientPtr client,
+ pointer closure)
+#else
+QueueWorkProc (function, client, closure)
+ Bool (*function)();
+ ClientPtr client;
+ pointer closure;
+#endif
+{
+ WorkQueuePtr q;
+
+ q = (WorkQueuePtr) xalloc (sizeof *q);
+ if (!q)
+ return FALSE;
+ q->function = function;
+ q->client = client;
+ q->closure = closure;
+ q->next = NULL;
+ *workQueueLast = q;
+ workQueueLast = &q->next;
+ return TRUE;
+}
+
+/*
+ * Manage a queue of sleeping clients, awakening them
+ * when requested, by using the OS functions IgnoreClient
+ * and AttendClient. Note that this *ignores* the troubles
+ * with request data interleaving itself with events, but
+ * we'll leave that until a later time.
+ */
+
+typedef struct _SleepQueue {
+ struct _SleepQueue *next;
+ ClientPtr client;
+ ClientSleepProcPtr function;
+ pointer closure;
+} SleepQueueRec, *SleepQueuePtr;
+
+static SleepQueuePtr sleepQueue = NULL;
+
+Bool
+ClientSleep (client, function, closure)
+ ClientPtr client;
+ ClientSleepProcPtr function;
+ pointer closure;
+{
+ SleepQueuePtr q;
+
+ q = (SleepQueuePtr) xalloc (sizeof *q);
+ if (!q)
+ return FALSE;
+
+ IgnoreClient (client);
+ q->next = sleepQueue;
+ q->client = client;
+ q->function = function;
+ q->closure = closure;
+ sleepQueue = q;
+ return TRUE;
+}
+
+Bool
+ClientSignal (client)
+ ClientPtr client;
+{
+ SleepQueuePtr q;
+
+ for (q = sleepQueue; q; q = q->next)
+ if (q->client == client)
+ {
+ return QueueWorkProc (q->function, q->client, q->closure);
+ }
+ return FALSE;
+}
+
+void
+ClientWakeup (client)
+ ClientPtr client;
+{
+ SleepQueuePtr q, *prev;
+
+ prev = &sleepQueue;
+ while ( (q = *prev) )
+ {
+ if (q->client == client)
+ {
+ *prev = q->next;
+ xfree (q);
+ if (client->clientGone)
+ CloseDownClient(client);
+ else
+ AttendClient (client);
+ break;
+ }
+ prev = &q->next;
+ }
+}
+
+Bool
+ClientIsAsleep (client)
+ ClientPtr client;
+{
+ SleepQueuePtr q;
+
+ for (q = sleepQueue; q; q = q->next)
+ if (q->client == client)
+ return TRUE;
+ return FALSE;
+}
+
+/*
+ * Generic Callback Manager
+ */
+
+/* ===== Private Procedures ===== */
+
+static int numCallbackListsToCleanup = 0;
+static CallbackListPtr **listsToCleanup = NULL;
+
+static Bool
+#if NeedFunctionPrototypes
+_AddCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
+_AddCallback(pcbl, callback, data)
+ CallbackListPtr *pcbl;
+ CallbackProcPtr callback;
+ pointer data;
+#endif
+{
+ CallbackPtr cbr;
+
+ cbr = (CallbackPtr) xalloc(sizeof(CallbackRec));
+ if (!cbr)
+ return FALSE;
+ cbr->proc = callback;
+ cbr->data = data;
+ cbr->next = (*pcbl)->list;
+ cbr->deleted = FALSE;
+ (*pcbl)->list = cbr;
+ return TRUE;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+_DeleteCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
+_DeleteCallback(pcbl, callback, data)
+ CallbackListPtr *pcbl;
+ CallbackProcPtr callback;
+ pointer data;
+#endif
+{
+ CallbackListPtr cbl = *pcbl;
+ CallbackPtr cbr, pcbr;
+
+ for (pcbr = NULL, cbr = cbl->list;
+ cbr != NULL;
+ pcbr = cbr, cbr = cbr->next)
+ {
+ if ((cbr->proc == callback) && (cbr->data == data))
+ break;
+ }
+ if (cbr != NULL)
+ {
+ if (cbl->inCallback)
+ {
+ ++(cbl->numDeleted);
+ cbr->deleted = TRUE;
+ }
+ else
+ {
+ if (pcbr == NULL)
+ cbl->list = cbr->next;
+ else
+ pcbr->next = cbr->next;
+ xfree(cbr);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+#if NeedFunctionPrototypes
+_CallCallbacks(
+ CallbackListPtr *pcbl,
+ pointer call_data)
+#else
+_CallCallbacks(pcbl, call_data)
+ CallbackListPtr *pcbl;
+ pointer call_data;
+#endif
+{
+ CallbackListPtr cbl = *pcbl;
+ CallbackPtr cbr, pcbr;
+
+ ++(cbl->inCallback);
+ for (cbr = cbl->list; cbr != NULL; cbr = cbr->next)
+ {
+ (*(cbr->proc)) (pcbl, cbr->data, call_data);
+ }
+ --(cbl->inCallback);
+
+ if (cbl->inCallback) return;
+
+ /* Was the entire list marked for deletion? */
+
+ if (cbl->deleted)
+ {
+ DeleteCallbackList(pcbl);
+ return;
+ }
+
+ /* Were some individual callbacks on the list marked for deletion?
+ * If so, do the deletions.
+ */
+
+ if (cbl->numDeleted)
+ {
+ for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; )
+ {
+ if (cbr->deleted)
+ {
+ if (pcbr)
+ {
+ cbr = cbr->next;
+ xfree(pcbr->next);
+ pcbr->next = cbr;
+ } else
+ {
+ cbr = cbr->next;
+ xfree(cbl->list);
+ cbl->list = cbr;
+ }
+ cbl->numDeleted--;
+ }
+ else /* this one wasn't deleted */
+ {
+ pcbr = cbr;
+ cbr = cbr->next;
+ }
+ }
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+_DeleteCallbackList(
+ CallbackListPtr *pcbl)
+#else
+_DeleteCallbackList(pcbl)
+ CallbackListPtr *pcbl;
+#endif
+{
+ CallbackListPtr cbl = *pcbl;
+ CallbackPtr cbr, nextcbr;
+ int i;
+
+ if (cbl->inCallback)
+ {
+ cbl->deleted = TRUE;
+ return;
+ }
+
+ for (i = 0; i < numCallbackListsToCleanup; i++)
+ {
+ if ((listsToCleanup[i] = pcbl) != 0)
+ {
+ listsToCleanup[i] = NULL;
+ break;
+ }
+ }
+
+ for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
+ {
+ nextcbr = cbr->next;
+ xfree(cbr);
+ }
+ xfree(cbl);
+ *pcbl = NULL;
+}
+
+static CallbackFuncsRec default_cbfuncs =
+{
+ _AddCallback,
+ _DeleteCallback,
+ _CallCallbacks,
+ _DeleteCallbackList
+};
+
+/* ===== Public Procedures ===== */
+
+Bool
+CreateCallbackList(pcbl, cbfuncs)
+ CallbackListPtr *pcbl;
+ CallbackFuncsPtr cbfuncs;
+{
+ CallbackListPtr cbl;
+ int i;
+
+ if (!pcbl) return FALSE;
+ cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec));
+ if (!cbl) return FALSE;
+ cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs;
+ cbl->inCallback = 0;
+ cbl->deleted = FALSE;
+ cbl->numDeleted = 0;
+ cbl->list = NULL;
+ *pcbl = cbl;
+
+ for (i = 0; i < numCallbackListsToCleanup; i++)
+ {
+ if (!listsToCleanup[i])
+ {
+ listsToCleanup[i] = pcbl;
+ return TRUE;
+ }
+ }
+
+ listsToCleanup = (CallbackListPtr **)xnfrealloc(listsToCleanup,
+ sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1));
+ listsToCleanup[numCallbackListsToCleanup] = pcbl;
+ numCallbackListsToCleanup++;
+ return TRUE;
+}
+
+Bool
+AddCallback(pcbl, callback, data)
+ CallbackListPtr *pcbl;
+ CallbackProcPtr callback;
+ pointer data;
+{
+ if (!pcbl) return FALSE;
+ if (!*pcbl)
+ { /* list hasn't been created yet; go create it */
+ if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL))
+ return FALSE;
+ }
+ return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data));
+}
+
+Bool
+DeleteCallback(pcbl, callback, data)
+ CallbackListPtr *pcbl;
+ CallbackProcPtr callback;
+ pointer data;
+{
+ if (!pcbl || !*pcbl) return FALSE;
+ return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data));
+}
+
+void
+CallCallbacks(pcbl, call_data)
+ CallbackListPtr *pcbl;
+ pointer call_data;
+{
+ if (!pcbl || !*pcbl) return;
+ (*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data);
+}
+
+void
+DeleteCallbackList(pcbl)
+ CallbackListPtr *pcbl;
+{
+ if (!pcbl || !*pcbl) return;
+ (*(*pcbl)->funcs.DeleteCallbackList) (pcbl);
+}
+
+void
+InitCallbackManager()
+{
+ int i;
+
+ for (i = 0; i < numCallbackListsToCleanup; i++)
+ {
+ DeleteCallbackList(listsToCleanup[i]);
+ }
+ if (listsToCleanup) xfree(listsToCleanup);
+
+ numCallbackListsToCleanup = 0;
+ listsToCleanup = NULL;
+}
diff --git a/xc/programs/Xserver/dix/events.c b/xc/programs/Xserver/dix/events.c
new file mode 100644
index 000000000..501159bc4
--- /dev/null
+++ b/xc/programs/Xserver/dix/events.c
@@ -0,0 +1,4668 @@
+/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.20 1999/05/30 14:04:11 dawes Exp $ */
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+
+
+/* $TOG: events.c /main/188 1998/02/09 14:19:04 kaleb $ */
+
+#include "X.h"
+#include "misc.h"
+#include "resource.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+
+#include "dixstruct.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "globals.h"
+
+#ifdef XKB
+#include "XKBsrv.h"
+#if NeedFunctionPrototypes
+extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
+#else
+extern Bool XkbFilterEvents();
+#endif
+#endif
+
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "dispatch.h"
+
+extern WindowPtr *WindowTable;
+
+extern void (* EventSwapVector[128]) ();
+
+#define EXTENSION_EVENT_BASE 64
+
+#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
+#define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask )
+#define AllButtonsMask ( \
+ Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
+#define MotionMask ( \
+ PointerMotionMask | Button1MotionMask | \
+ Button2MotionMask | Button3MotionMask | Button4MotionMask | \
+ Button5MotionMask | ButtonMotionMask )
+#define PropagateMask ( \
+ KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
+ MotionMask )
+#define PointerGrabMask ( \
+ ButtonPressMask | ButtonReleaseMask | \
+ EnterWindowMask | LeaveWindowMask | \
+ PointerMotionHintMask | KeymapStateMask | \
+ MotionMask )
+#define AllModifiersMask ( \
+ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
+ Mod3Mask | Mod4Mask | Mod5Mask )
+#define AllEventMasks (lastEventMask|(lastEventMask-1))
+/*
+ * The following relies on the fact that the Button<n>MotionMasks are equal
+ * to the corresponding Button<n>Masks from the current modifier/button state.
+ */
+#define Motion_Filter(class) (PointerMotionMask | \
+ (class)->state | (class)->motionMask)
+
+
+#define WID(w) ((w) ? ((w)->drawable.id) : 0)
+
+#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
+
+CallbackListPtr EventCallback;
+CallbackListPtr DeviceEventCallback;
+
+#define DNPMCOUNT 8
+
+Mask DontPropagateMasks[DNPMCOUNT];
+static int DontPropagateRefCnts[DNPMCOUNT];
+
+#ifdef DEBUG
+static debug_events = 0;
+#endif
+InputInfo inputInfo;
+
+static struct {
+ QdEventPtr pending, *pendtail;
+ DeviceIntPtr replayDev; /* kludgy rock to put flag for */
+ WindowPtr replayWin; /* ComputeFreezes */
+ Bool playingEvents;
+ TimeStamp time;
+} syncEvents;
+
+/*
+ * The window trace information is used to avoid having to compute all the
+ * windows between the root and the current pointer window each time a button
+ * or key goes down. The grabs on each of those windows must be checked.
+ */
+static WindowPtr *spriteTrace = (WindowPtr *)NULL;
+#define ROOT spriteTrace[0]
+static int spriteTraceSize = 0;
+static int spriteTraceGood;
+
+typedef struct {
+ int x, y;
+ ScreenPtr pScreen;
+} HotSpot;
+
+static struct {
+ CursorPtr current;
+ BoxRec hotLimits; /* logical constraints of hot spot */
+ Bool confined; /* confined to screen */
+#ifdef SHAPE
+ RegionPtr hotShape; /* additional logical shape constraint */
+#endif
+ BoxRec physLimits; /* physical constraints of hot spot */
+ WindowPtr win; /* window of logical position */
+ HotSpot hot; /* logical pointer position */
+ HotSpot hotPhys; /* physical pointer position */
+} sprite; /* info about the cursor sprite */
+
+static void DoEnterLeaveEvents(
+#if NeedFunctionPrototypes
+ WindowPtr /*fromWin*/,
+ WindowPtr /*toWin*/,
+ int /*mode*/
+#endif
+);
+
+static WindowPtr XYToWindow(
+#if NeedFunctionPrototypes
+ int /*x*/,
+ int /*y*/
+#endif
+);
+
+void DeliverFocusedEvent();
+int DeliverDeviceEvents();
+void DoFocusEvents();
+Mask EventMaskForClient();
+Bool CheckDeviceGrabs();
+void EnqueueEvent();
+
+extern Bool GrabMatchesSecond();
+extern Bool DeletePassiveGrabFromList();
+extern int AddPassiveGrabToList();
+
+extern Bool permitOldBugs;
+extern Bool Must_have_memory;
+extern int lastEvent;
+#ifdef XINPUT
+extern int DeviceMotionNotify, DeviceButtonPress, DeviceKeyPress;
+#endif
+
+static Mask lastEventMask;
+
+#define CantBeFiltered NoEventMask
+static Mask filters[128] =
+{
+ NoSuchEvent, /* 0 */
+ NoSuchEvent, /* 1 */
+ KeyPressMask, /* KeyPress */
+ KeyReleaseMask, /* KeyRelease */
+ ButtonPressMask, /* ButtonPress */
+ ButtonReleaseMask, /* ButtonRelease */
+ PointerMotionMask, /* MotionNotify (initial state) */
+ EnterWindowMask, /* EnterNotify */
+ LeaveWindowMask, /* LeaveNotify */
+ FocusChangeMask, /* FocusIn */
+ FocusChangeMask, /* FocusOut */
+ KeymapStateMask, /* KeymapNotify */
+ ExposureMask, /* Expose */
+ CantBeFiltered, /* GraphicsExpose */
+ CantBeFiltered, /* NoExpose */
+ VisibilityChangeMask, /* VisibilityNotify */
+ SubstructureNotifyMask, /* CreateNotify */
+ StructureAndSubMask, /* DestroyNotify */
+ StructureAndSubMask, /* UnmapNotify */
+ StructureAndSubMask, /* MapNotify */
+ SubstructureRedirectMask, /* MapRequest */
+ StructureAndSubMask, /* ReparentNotify */
+ StructureAndSubMask, /* ConfigureNotify */
+ SubstructureRedirectMask, /* ConfigureRequest */
+ StructureAndSubMask, /* GravityNotify */
+ ResizeRedirectMask, /* ResizeRequest */
+ StructureAndSubMask, /* CirculateNotify */
+ SubstructureRedirectMask, /* CirculateRequest */
+ PropertyChangeMask, /* PropertyNotify */
+ CantBeFiltered, /* SelectionClear */
+ CantBeFiltered, /* SelectionRequest */
+ CantBeFiltered, /* SelectionNotify */
+ ColormapChangeMask, /* ColormapNotify */
+ CantBeFiltered, /* ClientMessage */
+ CantBeFiltered /* MappingNotify */
+};
+
+static CARD8 criticalEvents[32] =
+{
+ 0x3c /* key and button events */
+};
+
+Mask
+GetNextEventMask()
+{
+ lastEventMask <<= 1;
+ return lastEventMask;
+}
+
+void
+SetMaskForEvent(mask, event)
+ Mask mask;
+ int event;
+{
+ if ((event < LASTEvent) || (event >= 128))
+ FatalError("SetMaskForEvent: bogus event number");
+ filters[event] = mask;
+}
+
+void
+SetCriticalEvent(event)
+ int event;
+{
+ if (event >= 128)
+ FatalError("SetCriticalEvent: bogus event number");
+ criticalEvents[event >> 3] |= 1 << (event & 7);
+}
+
+static void
+#if NeedFunctionPrototypes
+SyntheticMotion(int x, int y)
+#else
+SyntheticMotion(x, y)
+ int x, y;
+#endif
+{
+ xEvent xE;
+
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+ if (syncEvents.playingEvents)
+ xE.u.keyButtonPointer.time = syncEvents.time.milliseconds;
+ else
+ xE.u.keyButtonPointer.time = currentTime.milliseconds;
+ xE.u.u.type = MotionNotify;
+ (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
+}
+
+#ifdef SHAPE
+static void
+#if NeedFunctionPrototypes
+ConfineToShape(RegionPtr shape, int *px, int *py)
+#else
+ConfineToShape(shape, px, py)
+ RegionPtr shape;
+ int *px, *py;
+#endif
+{
+ BoxRec box;
+ int x = *px, y = *py;
+ int incx = 1, incy = 1;
+
+ if (POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box))
+ return;
+ box = *REGION_EXTENTS(sprite.hot.pScreen, shape);
+ /* this is rather crude */
+ do {
+ x += incx;
+ if (x >= box.x2)
+ {
+ incx = -1;
+ x = *px - 1;
+ }
+ else if (x < box.x1)
+ {
+ incx = 1;
+ x = *px;
+ y += incy;
+ if (y >= box.y2)
+ {
+ incy = -1;
+ y = *py - 1;
+ }
+ else if (y < box.y1)
+ return; /* should never get here! */
+ }
+ } while (!POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box));
+ *px = x;
+ *py = y;
+}
+#endif
+
+static void
+#if NeedFunctionPrototypes
+CheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents,
+ Bool confineToScreen,
+ ScreenPtr pScreen)
+#else
+CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
+ CursorPtr cursor;
+ Bool generateEvents;
+ Bool confineToScreen;
+ ScreenPtr pScreen;
+#endif
+{
+ HotSpot new;
+
+ if (!cursor)
+ return;
+ new = sprite.hotPhys;
+ if (pScreen)
+ new.pScreen = pScreen;
+ else
+ pScreen = new.pScreen;
+ (*pScreen->CursorLimits) (pScreen, cursor, &sprite.hotLimits,
+ &sprite.physLimits);
+ sprite.confined = confineToScreen;
+ (* pScreen->ConstrainCursor)(pScreen, &sprite.physLimits);
+ if (new.x < sprite.physLimits.x1)
+ new.x = sprite.physLimits.x1;
+ else
+ if (new.x >= sprite.physLimits.x2)
+ new.x = sprite.physLimits.x2 - 1;
+ if (new.y < sprite.physLimits.y1)
+ new.y = sprite.physLimits.y1;
+ else
+ if (new.y >= sprite.physLimits.y2)
+ new.y = sprite.physLimits.y2 - 1;
+#ifdef SHAPE
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
+#endif
+ if ((pScreen != sprite.hotPhys.pScreen) ||
+ (new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
+ {
+ if (pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys = new;
+ (*pScreen->SetCursorPosition) (pScreen, new.x, new.y, generateEvents);
+ if (!generateEvents)
+ SyntheticMotion(new.x, new.y);
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+CheckVirtualMotion(
+ register QdEventPtr qe,
+ register WindowPtr pWin)
+#else
+CheckVirtualMotion(qe, pWin)
+ register QdEventPtr qe;
+ register WindowPtr pWin;
+#endif
+{
+
+ if (qe)
+ {
+ sprite.hot.pScreen = qe->pScreen;
+ sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
+ sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
+ pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
+ NullWindow;
+ }
+ if (pWin)
+ {
+ BoxRec lims;
+
+ if (sprite.hot.pScreen != pWin->drawable.pScreen)
+ {
+ sprite.hot.pScreen = pWin->drawable.pScreen;
+ sprite.hot.x = sprite.hot.y = 0;
+ }
+ lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize);
+ if (sprite.hot.x < lims.x1)
+ sprite.hot.x = lims.x1;
+ else if (sprite.hot.x >= lims.x2)
+ sprite.hot.x = lims.x2 - 1;
+ if (sprite.hot.y < lims.y1)
+ sprite.hot.y = lims.y1;
+ else if (sprite.hot.y >= lims.y2)
+ sprite.hot.y = lims.y2 - 1;
+#ifdef SHAPE
+ if (wBoundingShape(pWin))
+ ConfineToShape(&pWin->borderSize, &sprite.hot.x, &sprite.hot.y);
+#endif
+ if (qe)
+ {
+ qe->pScreen = sprite.hot.pScreen;
+ qe->event->u.keyButtonPointer.rootX = sprite.hot.x;
+ qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ }
+ ROOT = WindowTable[sprite.hot.pScreen->myNum];
+}
+
+void
+ConfineCursorToWindow(pWin, generateEvents, confineToScreen)
+ WindowPtr pWin;
+ Bool generateEvents;
+ Bool confineToScreen;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (syncEvents.playingEvents)
+ {
+ CheckVirtualMotion((QdEventPtr)NULL, pWin);
+ SyntheticMotion(sprite.hot.x, sprite.hot.y);
+ }
+ else
+ {
+ sprite.hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize);
+#ifdef SHAPE
+ sprite.hotShape = wBoundingShape(pWin) ? &pWin->borderSize
+ : NullRegion;
+#endif
+ CheckPhysLimits(sprite.current, generateEvents, confineToScreen,
+ pScreen);
+ }
+}
+
+Bool
+PointerConfinedToScreen()
+{
+ return sprite.confined;
+}
+
+static void
+#if NeedFunctionPrototypes
+ChangeToCursor(CursorPtr cursor)
+#else
+ChangeToCursor(cursor)
+ CursorPtr cursor;
+#endif
+{
+ if (cursor != sprite.current)
+ {
+ if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
+ (sprite.current->bits->yhot != cursor->bits->yhot))
+ CheckPhysLimits(cursor, FALSE, PointerConfinedToScreen(),
+ (ScreenPtr)NULL);
+ (*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
+ cursor);
+ sprite.current = cursor;
+ }
+}
+
+/* returns true if b is a descendent of a */
+Bool
+IsParent(a, b)
+ register WindowPtr a, b;
+{
+ for (b = b->parent; b; b = b->parent)
+ if (b == a) return TRUE;
+ return FALSE;
+}
+
+static void
+#if NeedFunctionPrototypes
+PostNewCursor(void)
+#else
+PostNewCursor()
+#endif
+{
+ register WindowPtr win;
+ register GrabPtr grab = inputInfo.pointer->grab;
+
+ if (syncEvents.playingEvents)
+ return;
+ if (grab)
+ {
+ if (grab->cursor)
+ {
+ ChangeToCursor(grab->cursor);
+ return;
+ }
+ if (IsParent(grab->window, sprite.win))
+ win = sprite.win;
+ else
+ win = grab->window;
+ }
+ else
+ win = sprite.win;
+ for (; win; win = win->parent)
+ if (win->optional && win->optional->cursor != NullCursor)
+ {
+ ChangeToCursor(win->optional->cursor);
+ return;
+ }
+}
+
+WindowPtr
+GetCurrentRootWindow()
+{
+ return ROOT;
+}
+
+WindowPtr
+GetSpriteWindow()
+{
+ return sprite.win;
+}
+
+CursorPtr
+GetSpriteCursor()
+{
+ return sprite.current;
+}
+
+void
+GetSpritePosition(px, py)
+ int *px, *py;
+{
+ *px = sprite.hotPhys.x;
+ *py = sprite.hotPhys.y;
+}
+
+#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
+
+static void
+#if NeedFunctionPrototypes
+MonthChangedOrBadTime(register xEvent *xE)
+#else
+MonthChangedOrBadTime(xE)
+ register xEvent *xE;
+#endif
+{
+ /* If the ddx/OS is careless about not processing timestamped events from
+ * different sources in sorted order, then it's possible for time to go
+ * backwards when it should not. Here we ensure a decent time.
+ */
+ if ((currentTime.milliseconds - xE->u.keyButtonPointer.time) > TIMESLOP)
+ currentTime.months++;
+ else
+ xE->u.keyButtonPointer.time = currentTime.milliseconds;
+}
+
+#define NoticeTime(xE) { \
+ if ((xE)->u.keyButtonPointer.time < currentTime.milliseconds) \
+ MonthChangedOrBadTime(xE); \
+ currentTime.milliseconds = (xE)->u.keyButtonPointer.time; \
+ lastDeviceEventTime = currentTime; }
+
+void
+NoticeEventTime(xE)
+ register xEvent *xE;
+{
+ if (!syncEvents.playingEvents)
+ NoticeTime(xE);
+}
+
+/**************************************************************************
+ * The following procedures deal with synchronous events *
+ **************************************************************************/
+
+void
+EnqueueEvent(xE, device, count)
+ xEvent *xE;
+ DeviceIntPtr device;
+ int count;
+{
+ register QdEventPtr tail = *syncEvents.pendtail;
+ register QdEventPtr qe;
+ xEvent *qxE;
+
+ NoticeTime(xE);
+ if (DeviceEventCallback)
+ {
+ DeviceEventInfoRec eventinfo;
+ /* The RECORD spec says that the root window field of motion events
+ * must be valid. At this point, it hasn't been filled in yet, so
+ * we do it here. The long expression below is necessary to get
+ * the current root window; the apparently reasonable alternative
+ * GetCurrentRootWindow()->drawable.id doesn't give you the right
+ * answer on the first motion event after a screen change because
+ * the data that GetCurrentRootWindow relies on hasn't been
+ * updated yet.
+ */
+ if (xE->u.u.type == MotionNotify)
+ xE->u.keyButtonPointer.root =
+ WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
+ eventinfo.events = xE;
+ eventinfo.count = count;
+ CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
+ }
+ if (xE->u.u.type == MotionNotify)
+ {
+ sprite.hotPhys.x = xE->u.keyButtonPointer.rootX;
+ sprite.hotPhys.y = xE->u.keyButtonPointer.rootY;
+ /* do motion compression */
+ if (tail &&
+ (tail->event->u.u.type == MotionNotify) &&
+ (tail->pScreen == sprite.hotPhys.pScreen))
+ {
+ tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x;
+ tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y;
+ tail->event->u.keyButtonPointer.time = xE->u.keyButtonPointer.time;
+ tail->months = currentTime.months;
+ return;
+ }
+ }
+ qe = (QdEventPtr)xalloc(sizeof(QdEventRec) + (count * sizeof(xEvent)));
+ if (!qe)
+ return;
+ qe->next = (QdEventPtr)NULL;
+ qe->device = device;
+ qe->pScreen = sprite.hotPhys.pScreen;
+ qe->months = currentTime.months;
+ qe->event = (xEvent *)(qe + 1);
+ qe->evcount = count;
+ for (qxE = qe->event; --count >= 0; qxE++, xE++)
+ *qxE = *xE;
+ if (tail)
+ syncEvents.pendtail = &tail->next;
+ *syncEvents.pendtail = qe;
+}
+
+static void
+#if NeedFunctionPrototypes
+PlayReleasedEvents(void)
+#else
+PlayReleasedEvents()
+#endif
+{
+ register QdEventPtr *prev, qe;
+ register DeviceIntPtr dev;
+
+ prev = &syncEvents.pending;
+ while ( (qe = *prev) )
+ {
+ if (!qe->device->sync.frozen)
+ {
+ *prev = qe->next;
+ if (*syncEvents.pendtail == *prev)
+ syncEvents.pendtail = prev;
+ if (qe->event->u.u.type == MotionNotify)
+ CheckVirtualMotion(qe, NullWindow);
+ syncEvents.time.months = qe->months;
+ syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
+ (*qe->device->public.processInputProc)(qe->event, qe->device,
+ qe->evcount);
+ xfree(qe);
+ for (dev = inputInfo.devices; dev && dev->sync.frozen; dev = dev->next)
+ ;
+ if (!dev)
+ break;
+ /* Playing the event may have unfrozen another device. */
+ /* So to play it safe, restart at the head of the queue */
+ prev = &syncEvents.pending;
+ }
+ else
+ prev = &qe->next;
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+FreezeThaw(register DeviceIntPtr dev, Bool frozen)
+#else
+FreezeThaw(dev, frozen)
+ register DeviceIntPtr dev;
+ Bool frozen;
+#endif
+{
+ dev->sync.frozen = frozen;
+ if (frozen)
+ dev->public.processInputProc = dev->public.enqueueInputProc;
+ else
+ dev->public.processInputProc = dev->public.realInputProc;
+}
+
+void
+ComputeFreezes()
+{
+ register DeviceIntPtr replayDev = syncEvents.replayDev;
+ register int i;
+ WindowPtr w;
+ register xEvent *xE;
+ int count;
+ GrabPtr grab;
+ register DeviceIntPtr dev;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN));
+ if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending))
+ return;
+ syncEvents.playingEvents = TRUE;
+ if (replayDev)
+ {
+#ifdef PANORAMIX
+ int j;
+ WindowPtr tempw;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+ xE = replayDev->sync.event;
+ count = replayDev->sync.evcount;
+ syncEvents.replayDev = (DeviceIntPtr)NULL;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ for (j = PanoramiXNumScreens - 1; j>=0; j--)
+ if (XE_PTR.rootX >= panoramiXdataPtr[j].x
+ && XE_PTR.rootX < (panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)
+ && XE_PTR.rootY >= panoramiXdataPtr[j].y
+ && XE_PTR.rootY < (panoramiXdataPtr[j].y +panoramiXdataPtr[j].height))
+ break;
+ XE_PTR.rootX -= panoramiXdataPtr[j].x;
+ XE_PTR.rootY -= panoramiXdataPtr[j].y;
+ XE_PTR.eventX -= panoramiXdataPtr[j].x;
+ XE_PTR.eventY -= panoramiXdataPtr[j].y;
+ w = XYToWindow(XE_PTR.rootX, XE_PTR.rootY);
+ }else
+#endif
+ w = XYToWindow(
+ xE->u.keyButtonPointer.rootX, xE->u.keyButtonPointer.rootY);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ for (i = 0; i < spriteTraceGood; i++) {
+ tempw = spriteTrace[i];
+ j = (tempw->drawable.pScreen)->myNum;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, tempw->drawable.id, j);
+ j = ((syncEvents.replayWin)->drawable.pScreen)->myNum;
+ if (pPanoramiXWin)
+ tempw = (WindowPtr)
+ LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
+
+ if (syncEvents.replayWin == tempw) {
+ if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
+ if (replayDev->focus)
+ DeliverFocusedEvent(replayDev, xE, w, count);
+ else
+ DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
+ replayDev, count);
+ goto playmore;
+ }
+ } /* for */
+ } else { /* if !noPanoramiXExtension */
+#endif
+ for (i = 0; i < spriteTraceGood; i++)
+ if (syncEvents.replayWin == spriteTrace[i])
+ {
+ if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
+ if (replayDev->focus)
+ DeliverFocusedEvent(replayDev, xE, w, count);
+ else
+ DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
+ replayDev, count);
+ goto playmore;
+ }
+#ifdef PANORAMIX
+ }
+#endif
+ /* must not still be in the same stack */
+ if (replayDev->focus)
+ DeliverFocusedEvent(replayDev, xE, w, count);
+ else
+ DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count);
+ }
+playmore:
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (!dev->sync.frozen)
+ {
+ PlayReleasedEvents();
+ break;
+ }
+ }
+ syncEvents.playingEvents = FALSE;
+ /* the following may have been skipped during replay, so do it now */
+ if ((grab = inputInfo.pointer->grab) && grab->confineTo)
+ {
+ if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys.x = sprite.hotPhys.y = 0;
+ ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
+ }
+ else
+ ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum],
+ TRUE, FALSE);
+ PostNewCursor();
+}
+
+void
+CheckGrabForSyncs(thisDev, thisMode, otherMode)
+ register DeviceIntPtr thisDev;
+ Bool thisMode, otherMode;
+{
+ register GrabPtr grab = thisDev->grab;
+ register DeviceIntPtr dev;
+
+ if (thisMode == GrabModeSync)
+ thisDev->sync.state = FROZEN_NO_EVENT;
+ else
+ { /* free both if same client owns both */
+ thisDev->sync.state = THAWED;
+ if (thisDev->sync.other &&
+ (CLIENT_BITS(thisDev->sync.other->resource) ==
+ CLIENT_BITS(grab->resource)))
+ thisDev->sync.other = NullGrab;
+ }
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev != thisDev)
+ {
+ if (otherMode == GrabModeSync)
+ dev->sync.other = grab;
+ else
+ { /* free both if same client owns both */
+ if (dev->sync.other &&
+ (CLIENT_BITS(dev->sync.other->resource) ==
+ CLIENT_BITS(grab->resource)))
+ dev->sync.other = NullGrab;
+ }
+ }
+ }
+ ComputeFreezes();
+}
+
+void
+ActivatePointerGrab(mouse, grab, time, autoGrab)
+ register GrabPtr grab;
+ register DeviceIntPtr mouse;
+ TimeStamp time;
+ Bool autoGrab;
+{
+ WindowPtr oldWin = (mouse->grab) ? mouse->grab->window
+ : sprite.win;
+
+ if (grab->confineTo)
+ {
+ if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys.x = sprite.hotPhys.y = 0;
+#ifdef PANORAMIX
+ if ((!noPanoramiXExtension) &&
+ ( grab->confineTo->drawable.x + grab->confineTo->drawable.width >
+ (grab->confineTo->drawable.pScreen)->width ||
+ grab->confineTo->drawable.x < 0) )
+ ConfineCursorToWindow(grab->confineTo, FALSE, FALSE);
+ else
+#endif
+ ConfineCursorToWindow(grab->confineTo, FALSE, TRUE);
+ }
+ DoEnterLeaveEvents(oldWin, grab->window, NotifyGrab);
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (syncEvents.playingEvents)
+ mouse->grabTime = syncEvents.time;
+ else
+ mouse->grabTime = time;
+ if (grab->cursor)
+ grab->cursor->refcnt++;
+ mouse->activeGrab = *grab;
+ mouse->grab = &mouse->activeGrab;
+ mouse->fromPassiveGrab = autoGrab;
+ PostNewCursor();
+ CheckGrabForSyncs(mouse,
+ (Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+}
+
+void
+DeactivatePointerGrab(mouse)
+ register DeviceIntPtr mouse;
+{
+ register GrabPtr grab = mouse->grab;
+ register DeviceIntPtr dev;
+
+ mouse->valuator->motionHintWindow = NullWindow;
+ mouse->grab = NullGrab;
+ mouse->sync.state = NOT_GRABBED;
+ mouse->fromPassiveGrab = FALSE;
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->sync.other == grab)
+ dev->sync.other = NullGrab;
+ }
+ DoEnterLeaveEvents(grab->window, sprite.win, NotifyUngrab);
+ if (grab->confineTo)
+ ConfineCursorToWindow(ROOT, FALSE, FALSE);
+ PostNewCursor();
+ if (grab->cursor)
+ FreeCursor(grab->cursor, (Cursor)0);
+ ComputeFreezes();
+}
+
+void
+ActivateKeyboardGrab(keybd, grab, time, passive)
+ register DeviceIntPtr keybd;
+ GrabPtr grab;
+ TimeStamp time;
+ Bool passive;
+{
+ WindowPtr oldWin;
+
+ if (keybd->grab)
+ oldWin = keybd->grab->window;
+ else if (keybd->focus)
+ oldWin = keybd->focus->win;
+ else
+ oldWin = sprite.win;
+ if (oldWin == FollowKeyboardWin)
+ oldWin = inputInfo.keyboard->focus->win;
+ if (keybd->valuator)
+ keybd->valuator->motionHintWindow = NullWindow;
+ DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
+ if (syncEvents.playingEvents)
+ keybd->grabTime = syncEvents.time;
+ else
+ keybd->grabTime = time;
+ keybd->activeGrab = *grab;
+ keybd->grab = &keybd->activeGrab;
+ keybd->fromPassiveGrab = passive;
+ CheckGrabForSyncs(keybd,
+ (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
+}
+
+void
+DeactivateKeyboardGrab(keybd)
+ register DeviceIntPtr keybd;
+{
+ register GrabPtr grab = keybd->grab;
+ register DeviceIntPtr dev;
+ register WindowPtr focusWin = keybd->focus ? keybd->focus->win
+ : sprite.win;
+
+ if (focusWin == FollowKeyboardWin)
+ focusWin = inputInfo.keyboard->focus->win;
+ if (keybd->valuator)
+ keybd->valuator->motionHintWindow = NullWindow;
+ keybd->grab = NullGrab;
+ keybd->sync.state = NOT_GRABBED;
+ keybd->fromPassiveGrab = FALSE;
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->sync.other == grab)
+ dev->sync.other = NullGrab;
+ }
+ DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
+ ComputeFreezes();
+}
+
+void
+AllowSome(client, time, thisDev, newState)
+ ClientPtr client;
+ TimeStamp time;
+ register DeviceIntPtr thisDev;
+ int newState;
+{
+ Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
+ TimeStamp grabTime;
+ register DeviceIntPtr dev;
+
+ thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client);
+ thisSynced = FALSE;
+ otherGrabbed = FALSE;
+ othersFrozen = TRUE;
+ grabTime = thisDev->grabTime;
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev == thisDev)
+ continue;
+ if (dev->grab && SameClient(dev->grab, client))
+ {
+ if (!(thisGrabbed || otherGrabbed) ||
+ (CompareTimeStamps(dev->grabTime, grabTime) == LATER))
+ grabTime = dev->grabTime;
+ otherGrabbed = TRUE;
+ if (thisDev->sync.other == dev->grab)
+ thisSynced = TRUE;
+ if (dev->sync.state < FROZEN)
+ othersFrozen = FALSE;
+ }
+ else if (!dev->sync.other || !SameClient(dev->sync.other, client))
+ othersFrozen = FALSE;
+ }
+ if (!((thisGrabbed && thisDev->sync.state >= FROZEN) || thisSynced))
+ return;
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, grabTime) == EARLIER))
+ return;
+ switch (newState)
+ {
+ case THAWED: /* Async */
+ if (thisGrabbed)
+ thisDev->sync.state = THAWED;
+ if (thisSynced)
+ thisDev->sync.other = NullGrab;
+ ComputeFreezes();
+ break;
+ case FREEZE_NEXT_EVENT: /* Sync */
+ if (thisGrabbed)
+ {
+ thisDev->sync.state = FREEZE_NEXT_EVENT;
+ if (thisSynced)
+ thisDev->sync.other = NullGrab;
+ ComputeFreezes();
+ }
+ break;
+ case THAWED_BOTH: /* AsyncBoth */
+ if (othersFrozen)
+ {
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->grab && SameClient(dev->grab, client))
+ dev->sync.state = THAWED;
+ if (dev->sync.other && SameClient(dev->sync.other, client))
+ dev->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
+ case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */
+ if (othersFrozen)
+ {
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->grab && SameClient(dev->grab, client))
+ dev->sync.state = FREEZE_BOTH_NEXT_EVENT;
+ if (dev->sync.other && SameClient(dev->sync.other, client))
+ dev->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
+ case NOT_GRABBED: /* Replay */
+ if (thisGrabbed && thisDev->sync.state == FROZEN_WITH_EVENT)
+ {
+ if (thisSynced)
+ thisDev->sync.other = NullGrab;
+ syncEvents.replayDev = thisDev;
+ syncEvents.replayWin = thisDev->grab->window;
+ (*thisDev->DeactivateGrab)(thisDev);
+ syncEvents.replayDev = (DeviceIntPtr)NULL;
+ }
+ break;
+ case THAW_OTHERS: /* AsyncOthers */
+ if (othersFrozen)
+ {
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev == thisDev)
+ continue;
+ if (dev->grab && SameClient(dev->grab, client))
+ dev->sync.state = THAWED;
+ if (dev->sync.other && SameClient(dev->sync.other, client))
+ dev->sync.other = NullGrab;
+ }
+ ComputeFreezes();
+ }
+ break;
+ }
+}
+
+int
+ProcAllowEvents(client)
+ register ClientPtr client;
+{
+ TimeStamp time;
+ DeviceIntPtr mouse = inputInfo.pointer;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+ REQUEST(xAllowEventsReq);
+
+ REQUEST_SIZE_MATCH(xAllowEventsReq);
+ time = ClientTimeToServerTime(stuff->time);
+ switch (stuff->mode)
+ {
+ case ReplayPointer:
+ AllowSome(client, time, mouse, NOT_GRABBED);
+ break;
+ case SyncPointer:
+ AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
+ break;
+ case AsyncPointer:
+ AllowSome(client, time, mouse, THAWED);
+ break;
+ case ReplayKeyboard:
+ AllowSome(client, time, keybd, NOT_GRABBED);
+ break;
+ case SyncKeyboard:
+ AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
+ break;
+ case AsyncKeyboard:
+ AllowSome(client, time, keybd, THAWED);
+ break;
+ case SyncBoth:
+ AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
+ break;
+ case AsyncBoth:
+ AllowSome(client, time, keybd, THAWED_BOTH);
+ break;
+ default:
+ client->errorValue = stuff->mode;
+ return BadValue;
+ }
+ return Success;
+}
+
+void
+ReleaseActiveGrabs(client)
+ ClientPtr client;
+{
+ register DeviceIntPtr dev;
+ Bool done;
+
+ /* XXX CloseDownClient should remove passive grabs before
+ * releasing active grabs.
+ */
+ do {
+ done = TRUE;
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->grab && SameClient(dev->grab, client))
+ {
+ (*dev->DeactivateGrab)(dev);
+ done = FALSE;
+ }
+ }
+ } while (!done);
+}
+
+/**************************************************************************
+ * The following procedures deal with delivering events *
+ **************************************************************************/
+
+int
+TryClientEvents (client, pEvents, count, mask, filter, grab)
+ ClientPtr client;
+ GrabPtr grab;
+ xEvent *pEvents;
+ int count;
+ Mask mask, filter;
+{
+ int i;
+ int type;
+
+#ifdef DEBUG
+ if (debug_events) ErrorF(
+ "Event([%d, %d], mask=0x%x), client=%d",
+ pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
+#endif
+ if ((client) && (client != serverClient) && (!client->clientGone) &&
+ ((filter == CantBeFiltered) || (mask & filter)))
+ {
+ if (grab && !SameClient(grab, client))
+ return -1; /* don't send, but notify caller */
+ type = pEvents->u.u.type;
+ if (type == MotionNotify)
+ {
+ if (mask & PointerMotionHintMask)
+ {
+ if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
+ pEvents->u.keyButtonPointer.event)
+ {
+#ifdef DEBUG
+ if (debug_events) ErrorF("\n");
+ fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
+#endif
+ return 1; /* don't send, but pretend we did */
+ }
+ pEvents->u.u.detail = NotifyHint;
+ }
+ else
+ {
+ pEvents->u.u.detail = NotifyNormal;
+ }
+ }
+#ifdef XINPUT
+ else
+ {
+ if ((type == DeviceMotionNotify) &&
+ MaybeSendDeviceMotionNotifyHint
+ ((deviceKeyButtonPointer*)pEvents, mask) != 0)
+ return 1;
+ }
+#endif
+ type &= 0177;
+ if (type != KeymapNotify)
+ {
+ /* all extension events must have a sequence number */
+ for (i = 0; i < count; i++)
+ pEvents[i].u.u.sequenceNumber = client->sequence;
+ }
+
+ if (BitIsOn(criticalEvents, type))
+ SetCriticalOutputPending();
+
+ WriteEventsToClient(client, count, pEvents);
+#ifdef DEBUG
+ if (debug_events) ErrorF( " delivered\n");
+#endif
+ return 1;
+ }
+ else
+ {
+#ifdef DEBUG
+ if (debug_events) ErrorF("\n");
+#endif
+ return 0;
+ }
+}
+
+int
+DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
+ register WindowPtr pWin;
+ GrabPtr grab;
+ xEvent *pEvents;
+ int count;
+ Mask filter;
+ int mskidx;
+{
+ int deliveries = 0, nondeliveries = 0;
+ int attempt;
+ register InputClients *other;
+ ClientPtr client = NullClient;
+ Mask deliveryMask; /* If a grab occurs due to a button press, then
+ this mask is the mask of the grab. */
+ int type = pEvents->u.u.type;
+
+ /* CantBeFiltered means only window owner gets the event */
+ if ((filter == CantBeFiltered) || !(type & EXTENSION_EVENT_BASE))
+ {
+ /* if nobody ever wants to see this event, skip some work */
+ if (filter != CantBeFiltered &&
+ !((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
+ return 0;
+ if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count,
+ pWin->eventMask, filter, grab)) )
+ {
+ if (attempt > 0)
+ {
+ deliveries++;
+ client = wClient(pWin);
+ deliveryMask = pWin->eventMask;
+ } else
+ nondeliveries--;
+ }
+ }
+ if (filter != CantBeFiltered)
+ {
+ if (type & EXTENSION_EVENT_BASE)
+ {
+ OtherInputMasks *inputMasks;
+
+ inputMasks = wOtherInputMasks(pWin);
+ if (!inputMasks ||
+ !(inputMasks->inputEvents[mskidx] & filter))
+ return 0;
+ other = inputMasks->inputClients;
+ }
+ else
+ other = (InputClients *)wOtherClients(pWin);
+ for (; other; other = other->next)
+ {
+ if ( (attempt = TryClientEvents(rClient(other), pEvents, count,
+ other->mask[mskidx], filter, grab)) )
+ {
+ if (attempt > 0)
+ {
+ deliveries++;
+ client = rClient(other);
+ deliveryMask = other->mask[mskidx];
+ } else
+ nondeliveries--;
+ }
+ }
+ }
+ if ((type == ButtonPress) && deliveries && (!grab))
+ {
+ GrabRec tempGrab;
+
+ tempGrab.device = inputInfo.pointer;
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.window = pWin;
+ tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE;
+ tempGrab.eventMask = deliveryMask;
+ tempGrab.keyboardMode = GrabModeAsync;
+ tempGrab.pointerMode = GrabModeAsync;
+ tempGrab.confineTo = NullWindow;
+ tempGrab.cursor = NullCursor;
+ (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab,
+ currentTime, TRUE);
+ }
+ else if ((type == MotionNotify) && deliveries)
+ inputInfo.pointer->valuator->motionHintWindow = pWin;
+#ifdef XINPUT
+ else
+ {
+ if (((type == DeviceMotionNotify) || (type == DeviceButtonPress)) &&
+ deliveries)
+ CheckDeviceGrabAndHintWindow (pWin, type,
+ (deviceKeyButtonPointer*) pEvents,
+ grab, client, deliveryMask);
+ }
+#endif
+ if (deliveries)
+ return deliveries;
+ return nondeliveries;
+}
+
+/* If the event goes to dontClient, don't send it and return 0. if
+ send works, return 1 or if send didn't work, return 2.
+ Only works for core events.
+*/
+
+int
+MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
+ register WindowPtr pWin;
+ xEvent *pEvents;
+ int count;
+ Mask filter;
+ ClientPtr dontClient;
+{
+ register OtherClients *other;
+
+ if (pWin->eventMask & filter)
+ {
+ if (wClient(pWin) == dontClient)
+ return 0;
+ return TryClientEvents(wClient(pWin), pEvents, count,
+ pWin->eventMask, filter, NullGrab);
+ }
+ for (other = wOtherClients(pWin); other; other = other->next)
+ {
+ if (other->mask & filter)
+ {
+ if (SameClient(other, dontClient))
+ return 0;
+ return TryClientEvents(rClient(other), pEvents, count,
+ other->mask, filter, NullGrab);
+ }
+ }
+ return 2;
+}
+
+static void
+#if NeedFunctionPrototypes
+FixUpEventFromWindow(
+ xEvent *xE,
+ WindowPtr pWin,
+ Window child,
+ Bool calcChild)
+#else
+FixUpEventFromWindow(xE, pWin, child, calcChild)
+ xEvent *xE;
+ WindowPtr pWin;
+ Window child;
+ Bool calcChild;
+#endif
+{
+#ifdef PANORAMIX
+ int j;
+ int k = (pWin->drawable.pScreen)->myNum;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ if (calcChild)
+ {
+ WindowPtr w=spriteTrace[spriteTraceGood-1];
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension){
+ j = (w->drawable.pScreen)->myNum;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, w->drawable.id, j);
+ if (pPanoramiXWin)
+ w = (WindowPtr)LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
+ }
+#endif
+ /* If the search ends up past the root should the child field be
+ set to none or should the value in the argument be passed
+ through. It probably doesn't matter since everyone calls
+ this function with child == None anyway. */
+
+ while (w)
+ {
+ /* If the source window is same as event window, child should be
+ none. Don't bother going all all the way back to the root. */
+
+ if (w == pWin)
+ {
+ child = None;
+ break;
+ }
+
+ if (w->parent == pWin)
+ {
+ child = w->drawable.id;
+ break;
+ }
+ w = w->parent;
+ }
+ }
+ xE->u.keyButtonPointer.root = ROOT->drawable.id;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension){
+ pPanoramiXWin=PanoramiXWinRoot;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pWin->drawable.id, k);
+ if (pPanoramiXWin)
+ pWin = (WindowPtr)LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
+ if (pWin) {
+ xE->u.keyButtonPointer.event = pWin->drawable.id;
+ xE->u.keyButtonPointer.eventX = xE->u.keyButtonPointer.rootX -
+ pWin->drawable.x +
+ panoramiXdataPtr[sprite.hot.pScreen->myNum].x;
+ xE->u.keyButtonPointer.eventY = xE->u.keyButtonPointer.rootY -
+ pWin->drawable.y +
+ panoramiXdataPtr[sprite.hot.pScreen->myNum].y;
+ }else if (pPanoramiXWin)
+ xE->u.keyButtonPointer.event = pPanoramiXWin->info[0].id;
+ xE->u.keyButtonPointer.sameScreen = xTrue;
+ xE->u.keyButtonPointer.child = child;
+ }
+ else {
+#endif
+ xE->u.keyButtonPointer.event = pWin->drawable.id;
+ if (sprite.hot.pScreen == pWin->drawable.pScreen)
+ {
+ xE->u.keyButtonPointer.sameScreen = xTrue;
+ xE->u.keyButtonPointer.child = child;
+ xE->u.keyButtonPointer.eventX =
+ xE->u.keyButtonPointer.rootX - pWin->drawable.x;
+ xE->u.keyButtonPointer.eventY =
+ xE->u.keyButtonPointer.rootY - pWin->drawable.y;
+ }
+ else
+ {
+ xE->u.keyButtonPointer.sameScreen = xFalse;
+ xE->u.keyButtonPointer.child = None;
+ xE->u.keyButtonPointer.eventX = 0;
+ xE->u.keyButtonPointer.eventY = 0;
+ }
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+int
+DeliverDeviceEvents(pWin, xE, grab, stopAt, dev, count)
+ register WindowPtr pWin, stopAt;
+ register xEvent *xE;
+ GrabPtr grab;
+ DeviceIntPtr dev;
+ int count;
+{
+ Window child = None;
+ int type = xE->u.u.type;
+ Mask filter = filters[type];
+ int deliveries = 0;
+
+ if (type & EXTENSION_EVENT_BASE)
+ {
+ register OtherInputMasks *inputMasks;
+ int mskidx = dev->id;
+
+ inputMasks = wOtherInputMasks(pWin);
+ if (inputMasks && !(filter & inputMasks->deliverableEvents[mskidx]))
+ return 0;
+ while (pWin)
+ {
+ if (inputMasks && (inputMasks->inputEvents[mskidx] & filter))
+ {
+ FixUpEventFromWindow(xE, pWin, child, FALSE);
+ deliveries = DeliverEventsToWindow(pWin, xE, count, filter,
+ grab, mskidx);
+ if (deliveries > 0)
+ return deliveries;
+ }
+ if ((deliveries < 0) ||
+ (pWin == stopAt) ||
+ (inputMasks &&
+ (filter & inputMasks->dontPropagateMask[mskidx])))
+ return 0;
+ child = pWin->drawable.id;
+ pWin = pWin->parent;
+ if (pWin)
+ inputMasks = wOtherInputMasks(pWin);
+ }
+ }
+ else
+ {
+ if (!(filter & pWin->deliverableEvents))
+ return 0;
+ while (pWin)
+ {
+ if ((wOtherEventMasks(pWin)|pWin->eventMask) & filter)
+ {
+ FixUpEventFromWindow(xE, pWin, child, FALSE);
+ deliveries = DeliverEventsToWindow(pWin, xE, count, filter,
+ grab, 0);
+ if (deliveries > 0)
+ return deliveries;
+ }
+ if ((deliveries < 0) ||
+ (pWin == stopAt) ||
+ (filter & wDontPropagateMask(pWin)))
+ return 0;
+ child = pWin->drawable.id;
+ pWin = pWin->parent;
+ }
+ }
+ return 0;
+}
+
+/* not useful for events that propagate up the tree or extension events */
+int
+DeliverEvents(pWin, xE, count, otherParent)
+ register WindowPtr pWin, otherParent;
+ register xEvent *xE;
+ int count;
+{
+ Mask filter;
+ int deliveries;
+
+ if (!count)
+ return 0;
+ filter = filters[xE->u.u.type];
+ if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify))
+ xE->u.destroyNotify.event = pWin->drawable.id;
+ if (filter != StructureAndSubMask)
+ return DeliverEventsToWindow(pWin, xE, count, filter, NullGrab, 0);
+ deliveries = DeliverEventsToWindow(pWin, xE, count, StructureNotifyMask,
+ NullGrab, 0);
+ if (pWin->parent)
+ {
+ xE->u.destroyNotify.event = pWin->parent->drawable.id;
+ deliveries += DeliverEventsToWindow(pWin->parent, xE, count,
+ SubstructureNotifyMask, NullGrab,
+ 0);
+ if (xE->u.u.type == ReparentNotify)
+ {
+ xE->u.destroyNotify.event = otherParent->drawable.id;
+ deliveries += DeliverEventsToWindow(otherParent, xE, count,
+ SubstructureNotifyMask,
+ NullGrab, 0);
+ }
+ }
+ return deliveries;
+}
+
+static WindowPtr
+#if NeedFunctionPrototypes
+XYToWindow(int x, int y)
+#else
+XYToWindow(x, y)
+ int x, y;
+#endif
+{
+ register WindowPtr pWin;
+#ifdef SHAPE
+ BoxRec box;
+#endif
+
+ spriteTraceGood = 1; /* root window still there */
+ pWin = ROOT->firstChild;
+ while (pWin)
+ {
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth(pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
+ (y < pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin))
+#ifdef SHAPE
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ POINT_IN_REGION(pWin->drawable.pScreen,
+ &pWin->borderSize, x, y, &box))
+#endif
+ )
+ {
+ if (spriteTraceGood >= spriteTraceSize)
+ {
+ spriteTraceSize += 10;
+ Must_have_memory = TRUE; /* XXX */
+ spriteTrace = (WindowPtr *)xrealloc(
+ spriteTrace, spriteTraceSize*sizeof(WindowPtr));
+ Must_have_memory = FALSE; /* XXX */
+ }
+ spriteTrace[spriteTraceGood++] = pWin;
+ pWin = pWin->firstChild;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ return spriteTrace[spriteTraceGood-1];
+}
+
+static Bool
+#if NeedFunctionPrototypes
+CheckMotion(xEvent *xE)
+#else
+CheckMotion(xE)
+ xEvent *xE;
+#endif
+{
+ WindowPtr prevSpriteWin = sprite.win;
+
+ if (xE && !syncEvents.playingEvents)
+ {
+ if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
+ {
+ sprite.hot.pScreen = sprite.hotPhys.pScreen;
+ ROOT = WindowTable[sprite.hot.pScreen->myNum];
+ }
+ sprite.hot.x = xE->u.keyButtonPointer.rootX;
+ sprite.hot.y = xE->u.keyButtonPointer.rootY;
+ if (sprite.hot.x < sprite.physLimits.x1)
+ sprite.hot.x = sprite.physLimits.x1;
+ else if (sprite.hot.x >= sprite.physLimits.x2)
+ sprite.hot.x = sprite.physLimits.x2 - 1;
+ if (sprite.hot.y < sprite.physLimits.y1)
+ sprite.hot.y = sprite.physLimits.y1;
+ else if (sprite.hot.y >= sprite.physLimits.y2)
+ sprite.hot.y = sprite.physLimits.y2 - 1;
+#ifdef SHAPE
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
+#endif
+ sprite.hotPhys = sprite.hot;
+ if ((sprite.hotPhys.x != xE->u.keyButtonPointer.rootX) ||
+ (sprite.hotPhys.y != xE->u.keyButtonPointer.rootY))
+ (*sprite.hotPhys.pScreen->SetCursorPosition)(
+ sprite.hotPhys.pScreen,
+ sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
+ xE->u.keyButtonPointer.rootX = sprite.hot.x;
+ xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+
+ sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
+#ifdef notyet
+ if (!(sprite.win->deliverableEvents &
+ Motion_Filter(inputInfo.pointer->button))
+ !syncEvents.playingEvents)
+ {
+ /* XXX Do PointerNonInterestBox here */
+ }
+#endif
+ if (sprite.win != prevSpriteWin)
+ {
+ if (prevSpriteWin != NullWindow) {
+ if (!xE)
+ UpdateCurrentTimeIf();
+ DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal);
+ }
+ PostNewCursor();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void
+WindowsRestructured()
+{
+ (void) CheckMotion((xEvent *)NULL);
+}
+
+void
+DefineInitialRootWindow(win)
+ register WindowPtr win;
+{
+ register ScreenPtr pScreen = win->drawable.pScreen;
+
+ sprite.hotPhys.pScreen = pScreen;
+ sprite.hotPhys.x = pScreen->width / 2;
+ sprite.hotPhys.y = pScreen->height / 2;
+ sprite.hot = sprite.hotPhys;
+ sprite.hotLimits.x2 = pScreen->width;
+ sprite.hotLimits.y2 = pScreen->height;
+ sprite.win = win;
+ sprite.current = wCursor (win);
+ spriteTraceGood = 1;
+ ROOT = win;
+ (*pScreen->CursorLimits) (
+ pScreen, sprite.current, &sprite.hotLimits, &sprite.physLimits);
+ sprite.confined = FALSE;
+ (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
+ (*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE);
+ (*pScreen->DisplayCursor) (pScreen, sprite.current);
+}
+
+/*
+ * This does not take any shortcuts, and even ignores its argument, since
+ * it does not happen very often, and one has to walk up the tree since
+ * this might be a newly instantiated cursor for an intermediate window
+ * between the one the pointer is in and the one that the last cursor was
+ * instantiated from.
+ */
+/*ARGSUSED*/
+void
+WindowHasNewCursor(pWin)
+ WindowPtr pWin;
+{
+ PostNewCursor();
+}
+
+void
+NewCurrentScreen(newScreen, x, y)
+ ScreenPtr newScreen;
+ int x,y;
+{
+ sprite.hotPhys.x = x;
+ sprite.hotPhys.y = y;
+ if (newScreen != sprite.hotPhys.pScreen)
+ ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE);
+}
+
+int
+ProcWarpPointer(client)
+ ClientPtr client;
+{
+ WindowPtr dest = NULL;
+ int x, y;
+ ScreenPtr newScreen;
+#ifdef PANORAMIX
+ int i, softx, softy;
+ WindowPtr sWin = NULL;
+ ScreenPtr sftScreen;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST(xWarpPointerReq);
+
+ REQUEST_SIZE_MATCH(xWarpPointerReq);
+ if (stuff->dstWid != None)
+ {
+ dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
+ if (!dest)
+ return BadWindow;
+ }
+ x = sprite.hotPhys.x;
+ y = sprite.hotPhys.y;
+ if (stuff->srcWid != None)
+ {
+ int winX, winY;
+ WindowPtr source = SecurityLookupWindow(stuff->srcWid, client,
+ SecurityReadAccess);
+ if (!source)
+ return BadWindow;
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if (source->drawable.pScreen != sprite.hotPhys.pScreen ||
+ x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int)stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int)stuff->srcHeight < y) ||
+ !PointInWindowIsVisible(source, x, y))
+ return Success;
+ }
+ if (dest)
+ {
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ newScreen = dest->drawable.pScreen;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->dstWid);
+#endif
+ }
+ else
+ newScreen = sprite.hotPhys.pScreen;
+ x += stuff->dstX;
+ y += stuff->dstY;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ if (pPanoramiXWin) {
+ for ( i = 0 ; i < PanoramiXNumScreens; i++) {
+ sWin = SecurityLookupWindow(pPanoramiXWin->info[i].id, client,
+ SecurityReadAccess);
+ sftScreen = sWin->drawable.pScreen;
+ softx = sftScreen->width + panoramiXdataPtr[i].x;
+ softy = sftScreen->height + panoramiXdataPtr[i].y;
+ /* Figure out which screen the cursor is on. The destination (x,y)
+ values are coming from the client, so it believes we have a screen
+ size of (sizeofScreen * NumberOfScreens )*/
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ if ((x > softx) || (y > softy))
+ continue;
+ else
+ break;
+ }
+ newScreen = sftScreen;
+ }
+ if (x < 0)
+ x = 0;
+ else if (x >= newScreen->width + panoramiXdataPtr[newScreen->myNum].x )
+ x = newScreen->width + panoramiXdataPtr[newScreen->myNum].x - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= newScreen->height + panoramiXdataPtr[newScreen->myNum].y )
+ y = newScreen->height + panoramiXdataPtr[newScreen->myNum].y - 1;
+ x -= panoramiXdataPtr[newScreen->myNum].x;
+ y -= panoramiXdataPtr[newScreen->myNum].y;
+ }else {
+#endif
+ if (x < 0)
+ x = 0;
+ else if (x >= newScreen->width)
+ x = newScreen->width - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= newScreen->height)
+ y = newScreen->height - 1;
+#if PANORAMIX
+ }
+#endif
+ if (newScreen == sprite.hotPhys.pScreen)
+ {
+ if (x < sprite.physLimits.x1)
+ x = sprite.physLimits.x1;
+ else if (x >= sprite.physLimits.x2)
+ x = sprite.physLimits.x2 - 1;
+ if (y < sprite.physLimits.y1)
+ y = sprite.physLimits.y1;
+ else if (y >= sprite.physLimits.y2)
+ y = sprite.physLimits.y2 - 1;
+#ifdef SHAPE
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &x, &y);
+#endif
+ (*newScreen->SetCursorPosition)(newScreen, x, y, TRUE);
+ }
+ else if (!PointerConfinedToScreen())
+ {
+ NewCurrentScreen(newScreen, x, y);
+ }
+ return Success;
+}
+
+/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
+ passive grab set on the window to be activated. */
+
+static Bool
+#if NeedFunctionPrototypes
+CheckPassiveGrabsOnWindow(
+ WindowPtr pWin,
+ register DeviceIntPtr device,
+ register xEvent *xE,
+ int count)
+#else
+CheckPassiveGrabsOnWindow(pWin, device, xE, count)
+ WindowPtr pWin;
+ register DeviceIntPtr device;
+ register xEvent *xE;
+ int count;
+#endif
+{
+ register GrabPtr grab = wPassiveGrabs(pWin);
+ GrabRec tempGrab;
+ register xEvent *dxE;
+
+ if (!grab)
+ return FALSE;
+ tempGrab.window = pWin;
+ tempGrab.device = device;
+ tempGrab.type = xE->u.u.type;
+ tempGrab.detail.exact = xE->u.u.detail;
+ tempGrab.detail.pMask = NULL;
+ tempGrab.modifiersDetail.pMask = NULL;
+ for (; grab; grab = grab->next)
+ {
+#ifdef XKB
+ DeviceIntPtr gdev;
+ XkbSrvInfoPtr xkbi;
+
+ gdev= grab->modifierDevice;
+ xkbi= gdev->key->xkbInfo;
+#endif
+ tempGrab.modifierDevice = grab->modifierDevice;
+ if (device == grab->modifierDevice &&
+ (xE->u.u.type == KeyPress
+#ifdef XINPUT
+ || xE->u.u.type == DeviceKeyPress
+#endif
+ ))
+ tempGrab.modifiersDetail.exact =
+#ifdef XKB
+ (noXkbExtension?gdev->key->prev_state:xkbi->state.grab_mods);
+#else
+ grab->modifierDevice->key->prev_state;
+#endif
+ else
+ tempGrab.modifiersDetail.exact =
+#ifdef XKB
+ (noXkbExtension ? gdev->key->state : xkbi->state.grab_mods);
+#else
+ grab->modifierDevice->key->state;
+#endif
+ if (GrabMatchesSecond(&tempGrab, grab) &&
+ (!grab->confineTo ||
+ (grab->confineTo->realized &&
+ REGION_NOTEMPTY( grab->confineTo->drawable.pScreen,
+ &grab->confineTo->borderSize))))
+ {
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE))
+ return FALSE;
+#endif
+#ifdef XKB
+ if (!noXkbExtension) {
+ xE->u.keyButtonPointer.state &= 0x1f00;
+ xE->u.keyButtonPointer.state |=
+ tempGrab.modifiersDetail.exact&(~0x1f00);
+ }
+#endif
+ (*device->ActivateGrab)(device, grab, currentTime, TRUE);
+
+ FixUpEventFromWindow(xE, grab->window, None, TRUE);
+
+ (void) TryClientEvents(rClient(grab), xE, count,
+ filters[xE->u.u.type],
+ filters[xE->u.u.type], grab);
+
+ if (device->sync.state == FROZEN_NO_EVENT)
+ {
+ if (device->sync.evcount < count)
+ {
+ Must_have_memory = TRUE; /* XXX */
+ device->sync.event = (xEvent *)xrealloc(device->sync.event,
+ count*
+ sizeof(xEvent));
+ Must_have_memory = FALSE; /* XXX */
+ }
+ device->sync.evcount = count;
+ for (dxE = device->sync.event; --count >= 0; dxE++, xE++)
+ *dxE = *xE;
+ device->sync.state = FROZEN_WITH_EVENT;
+ }
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*
+"CheckDeviceGrabs" handles both keyboard and pointer events that may cause
+a passive grab to be activated. If the event is a keyboard event, the
+ancestors of the focus window are traced down and tried to see if they have
+any passive grabs to be activated. If the focus window itself is reached and
+it's descendants contain they pointer, the ancestors of the window that the
+pointer is in are then traced down starting at the focus window, otherwise no
+grabs are activated. If the event is a pointer event, the ancestors of the
+window that the pointer is in are traced down starting at the root until
+CheckPassiveGrabs causes a passive grab to activate or all the windows are
+tried. PRH
+*/
+
+Bool
+CheckDeviceGrabs(device, xE, checkFirst, count)
+ register DeviceIntPtr device;
+ register xEvent *xE;
+ int checkFirst;
+ int count;
+{
+ register int i;
+#ifdef PANORAMIX
+ register int j,k;
+ PanoramiXWindow *pPanoramiXWin = NULL;
+#endif
+ register WindowPtr pWin;
+ register FocusClassPtr focus = device->focus;
+
+ if ((xE->u.u.type == ButtonPress
+#ifdef XINPUT
+ || xE->u.u.type == DeviceButtonPress
+#endif
+ ) && device->button->buttonsDown != 1)
+ return FALSE;
+
+ i = checkFirst;
+
+ if (focus)
+ {
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ k = (ROOT->drawable.pScreen)->myNum;
+ for (; i < focus->traceGood; i++)
+ {
+ pWin = focus->trace[i];
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
+ if (pPanoramiXWin) {
+ pWin = (WindowPtr)
+ LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
+ }
+ if ( pWin && pWin->optional &&
+ CheckPassiveGrabsOnWindow(pWin, device, xE, count))
+ return TRUE;
+ }
+ }else {
+#endif
+ for (; i < focus->traceGood; i++)
+ {
+ pWin = focus->trace[i];
+ if (pWin->optional &&
+ CheckPassiveGrabsOnWindow(pWin, device, xE, count))
+ return TRUE;
+ }
+#ifdef PANORAMIX
+ }
+#endif
+
+ if ((focus->win == NoneWin) ||
+ (i >= spriteTraceGood) ||
+ ((i > checkFirst) && (pWin != spriteTrace[i-1])))
+ return FALSE;
+ }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ k = (ROOT->drawable.pScreen)->myNum;;
+ for (; i < spriteTraceGood; i++) {
+ pWin = spriteTrace[i];
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, pWin->drawable.id, k);
+ if (pPanoramiXWin) {
+ for ( j= PanoramiXNumScreens - 1; j>=0; j--) {
+ pWin = (WindowPtr)
+ LookupIDByType(pPanoramiXWin->info[j].id, RT_WINDOW);
+ if ( pWin && pWin->optional &&
+ CheckPassiveGrabsOnWindow(pWin, device, xE, count))
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+ }else {
+#endif
+ for (; i < spriteTraceGood; i++)
+ {
+ pWin = spriteTrace[i];
+ if (pWin->optional &&
+ CheckPassiveGrabsOnWindow(pWin, device, xE, count))
+ return TRUE;
+ }
+
+ return FALSE;
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+void
+DeliverFocusedEvent(keybd, xE, window, count)
+ xEvent *xE;
+ DeviceIntPtr keybd;
+ WindowPtr window;
+ int count;
+{
+ WindowPtr focus = keybd->focus->win;
+ int mskidx = 0;
+#ifdef PANORAMIX
+ register int k;
+ WindowPtr orig_focus;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ if (focus == FollowKeyboardWin)
+ focus = inputInfo.keyboard->focus->win;
+ if (!focus)
+ return;
+ if (focus == PointerRootWin)
+ {
+ DeliverDeviceEvents(window, xE, NullGrab, NullWindow, keybd, count);
+ return;
+ }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ k = (ROOT->drawable.pScreen)->myNum;
+ orig_focus = focus;
+ PANORAMIXFIND_ID(pPanoramiXWin, focus->drawable.id);
+ if (pPanoramiXWin) {
+ focus = (WindowPtr) LookupIDByType(pPanoramiXWin->info[k].id, RT_WINDOW);
+ }
+ }
+#endif
+ if ((focus == window) || IsParent(focus, window))
+ {
+ if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count))
+ return;
+ }
+ /* just deliver it to the focus window */
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ focus = orig_focus;
+ }
+#endif
+ FixUpEventFromWindow(xE, focus, None, FALSE);
+ if (xE->u.u.type & EXTENSION_EVENT_BASE)
+ mskidx = keybd->id;
+ (void)DeliverEventsToWindow(focus, xE, count, filters[xE->u.u.type],
+ NullGrab, mskidx);
+}
+
+void
+DeliverGrabbedEvent(xE, thisDev, deactivateGrab, count)
+ register xEvent *xE;
+ register DeviceIntPtr thisDev;
+ Bool deactivateGrab;
+ int count;
+{
+ register GrabPtr grab = thisDev->grab;
+ int deliveries = 0;
+ register DeviceIntPtr dev;
+ register xEvent *dxE;
+
+ if (grab->ownerEvents)
+ {
+ WindowPtr focus;
+
+ if (thisDev->focus)
+ {
+ focus = thisDev->focus->win;
+ if (focus == FollowKeyboardWin)
+ focus = inputInfo.keyboard->focus->win;
+ }
+ else
+ focus = PointerRootWin;
+ if (focus == PointerRootWin)
+ deliveries = DeliverDeviceEvents(sprite.win, xE, grab, NullWindow,
+ thisDev, count);
+ else if (focus && (focus == sprite.win || IsParent(focus, sprite.win)))
+ deliveries = DeliverDeviceEvents(sprite.win, xE, grab, focus,
+ thisDev, count);
+ else if (focus)
+ deliveries = DeliverDeviceEvents(focus, xE, grab, focus,
+ thisDev, count);
+ }
+ if (!deliveries)
+ {
+ FixUpEventFromWindow(xE, grab->window, None, TRUE);
+ deliveries = TryClientEvents(rClient(grab), xE, count,
+ (Mask)grab->eventMask,
+ filters[xE->u.u.type], grab);
+ if (deliveries && (xE->u.u.type == MotionNotify
+#ifdef XINPUT
+ || xE->u.u.type == DeviceMotionNotify
+#endif
+ ))
+ thisDev->valuator->motionHintWindow = grab->window;
+ }
+ if (deliveries && !deactivateGrab && (xE->u.u.type != MotionNotify
+#ifdef XINPUT
+ && xE->u.u.type != DeviceMotionNotify
+#endif
+ ))
+ switch (thisDev->sync.state)
+ {
+ case FREEZE_BOTH_NEXT_EVENT:
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev == thisDev)
+ continue;
+ FreezeThaw(dev, TRUE);
+ if ((dev->sync.state == FREEZE_BOTH_NEXT_EVENT) &&
+ (CLIENT_BITS(dev->grab->resource) ==
+ CLIENT_BITS(thisDev->grab->resource)))
+ dev->sync.state = FROZEN_NO_EVENT;
+ else
+ dev->sync.other = thisDev->grab;
+ }
+ /* fall through */
+ case FREEZE_NEXT_EVENT:
+ thisDev->sync.state = FROZEN_WITH_EVENT;
+ FreezeThaw(thisDev, TRUE);
+ if (thisDev->sync.evcount < count)
+ {
+ Must_have_memory = TRUE; /* XXX */
+ thisDev->sync.event = (xEvent *)xrealloc(thisDev->sync.event,
+ count*sizeof(xEvent));
+ Must_have_memory = FALSE; /* XXX */
+ }
+ thisDev->sync.evcount = count;
+ for (dxE = thisDev->sync.event; --count >= 0; dxE++, xE++)
+ *dxE = *xE;
+ break;
+ }
+}
+
+void
+#ifdef XKB
+CoreProcessKeyboardEvent (xE, keybd, count)
+#else
+ProcessKeyboardEvent (xE, keybd, count)
+#endif
+ register xEvent *xE;
+ register DeviceIntPtr keybd;
+ int count;
+{
+ int key, bit;
+ register BYTE *kptr;
+ register int i;
+ register CARD8 modifiers;
+ register CARD16 mask;
+ GrabPtr grab = keybd->grab;
+ Bool deactivateGrab = FALSE;
+ register KeyClassPtr keyc = keybd->key;
+
+ if (!syncEvents.playingEvents)
+ {
+ NoticeTime(xE);
+ if (DeviceEventCallback)
+ {
+ DeviceEventInfoRec eventinfo;
+ eventinfo.events = xE;
+ eventinfo.count = count;
+ CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
+ }
+ }
+ xE->u.keyButtonPointer.state = (keyc->state |
+ inputInfo.pointer->button->state);
+ xE->u.keyButtonPointer.rootX = sprite.hot.x;
+ xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ key = xE->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+ modifiers = keyc->modifierMap[key];
+#ifdef DEBUG
+ if ((xkbDebugFlags&0x4)&&
+ ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
+ ErrorF("CoreProcessKbdEvent: Key %d %s\n",key,
+ (xE->u.u.type==KeyPress?"down":"up"));
+ }
+#endif
+ switch (xE->u.u.type)
+ {
+ case KeyPress:
+ if (*kptr & bit) /* allow ddx to generate multiple downs */
+ {
+ if (!modifiers)
+ {
+ xE->u.u.type = KeyRelease;
+ (*keybd->public.processInputProc)(xE, keybd, count);
+ xE->u.u.type = KeyPress;
+ /* release can have side effects, don't fall through */
+ (*keybd->public.processInputProc)(xE, keybd, count);
+ }
+ return;
+ }
+ inputInfo.pointer->valuator->motionHintWindow = NullWindow;
+ *kptr |= bit;
+ keyc->prev_state = keyc->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers)
+ {
+ /* This key affects modifier "i" */
+ keyc->modifierKeyCount[i]++;
+ keyc->state |= mask;
+ modifiers &= ~mask;
+ }
+ }
+ if (!grab && CheckDeviceGrabs(keybd, xE, 0, count))
+ {
+ keybd->activatingKey = key;
+ return;
+ }
+ break;
+ case KeyRelease:
+ if (!(*kptr & bit)) /* guard against duplicates */
+ return;
+ inputInfo.pointer->valuator->motionHintWindow = NullWindow;
+ *kptr &= ~bit;
+ keyc->prev_state = keyc->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers) {
+ /* This key affects modifier "i" */
+ if (--keyc->modifierKeyCount[i] <= 0) {
+ keyc->state &= ~mask;
+ keyc->modifierKeyCount[i] = 0;
+ }
+ modifiers &= ~mask;
+ }
+ }
+ if (keybd->fromPassiveGrab && (key == keybd->activatingKey))
+ deactivateGrab = TRUE;
+ break;
+ default:
+ FatalError("Impossible keyboard event");
+ }
+ if (grab)
+ DeliverGrabbedEvent(xE, keybd, deactivateGrab, count);
+ else
+ DeliverFocusedEvent(keybd, xE, sprite.win, count);
+ if (deactivateGrab)
+ (*keybd->DeactivateGrab)(keybd);
+}
+
+void
+#ifdef XKB
+CoreProcessPointerEvent (xE, mouse, count)
+#else
+ProcessPointerEvent (xE, mouse, count)
+#endif
+ register xEvent *xE;
+ register DeviceIntPtr mouse;
+ int count;
+{
+ register GrabPtr grab = mouse->grab;
+ Bool deactivateGrab = FALSE;
+ register ButtonClassPtr butc = mouse->button;
+#ifdef XKB
+ XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo;
+#endif
+
+ if (!syncEvents.playingEvents)
+ NoticeTime(xE)
+ xE->u.keyButtonPointer.state = (butc->state | (
+#ifdef XKB
+ (noXkbExtension ?
+ inputInfo.keyboard->key->state :
+ xkbi->state.grab_mods)
+#else
+ inputInfo.keyboard->key->state
+#endif
+ ));
+ {
+ NoticeTime(xE);
+ if (DeviceEventCallback)
+ {
+ DeviceEventInfoRec eventinfo;
+ /* see comment in EnqueueEvents regarding the next three lines */
+ if (xE->u.u.type == MotionNotify)
+ xE->u.keyButtonPointer.root =
+ WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
+ eventinfo.events = xE;
+ eventinfo.count = count;
+ CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
+ }
+ }
+ if (xE->u.u.type != MotionNotify)
+ {
+ register int key;
+ register BYTE *kptr;
+ int bit;
+#ifdef PANORAMIX
+ int j;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int x_off = 0, y_off = 0;
+#endif
+
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ for (j = PanoramiXNumScreens - 1; j; j--) {
+ if (xE->u.keyButtonPointer.root == PanoramiXWinRoot->info[j].id)
+ break;
+ }
+ if (j) {
+ xE->u.keyButtonPointer.root = PanoramiXWinRoot->info[0].id;
+ xE->u.keyButtonPointer.sameScreen = xTrue;
+ }
+
+ PANORAMIXFIND_ID(pPanoramiXWin, xE->u.keyButtonPointer.event);
+ if (pPanoramiXWin) {
+ for (j = PanoramiXNumScreens - 1; j; j--) {
+ if (pPanoramiXWin->info[j].id == xE->u.keyButtonPointer.event)
+ break;
+ }
+ }
+ if (j && pPanoramiXWin) {
+ xE->u.keyButtonPointer.event = pPanoramiXWin->info[0].id;
+ }
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, xE->u.keyButtonPointer.child);
+ if (pPanoramiXWin) {
+ for (j = PanoramiXNumScreens - 1; j; j--) {
+ if (pPanoramiXWin->info[j].id == xE->u.keyButtonPointer.child)
+ break;
+ }
+ }
+ if (j && pPanoramiXWin)
+ xE->u.keyButtonPointer.child = pPanoramiXWin->info[0].id;
+
+ xE->u.keyButtonPointer.rootX = sprite.hot.x;
+ xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ }else {
+#endif
+ xE->u.keyButtonPointer.rootX = sprite.hot.x;
+ xE->u.keyButtonPointer.rootY = sprite.hot.y;
+#ifdef PANORAMIX
+ }
+#endif
+ key = xE->u.u.detail;
+ kptr = &butc->down[key >> 3];
+ bit = 1 << (key & 7);
+ switch (xE->u.u.type)
+ {
+ case ButtonPress:
+ mouse->valuator->motionHintWindow = NullWindow;
+ butc->buttonsDown++;
+ butc->motionMask = ButtonMotionMask;
+ *kptr |= bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
+ xE->u.u.detail = butc->map[key];
+#endif
+ if (xE->u.u.detail == 0)
+ return;
+ if (xE->u.u.detail <= 5)
+ butc->state |= (Button1Mask >> 1) << xE->u.u.detail;
+ filters[MotionNotify] = Motion_Filter(butc);
+ if (!grab)
+ if (CheckDeviceGrabs(mouse, xE, 0, count))
+ return;
+ break;
+ case ButtonRelease:
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (!--butc->buttonsDown)
+ butc->motionMask = 0;
+ *kptr &= ~bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
+ xE->u.u.detail = butc->map[key];
+#endif
+ if (xE->u.u.detail == 0)
+ return;
+ if (xE->u.u.detail <= 5)
+ butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
+ filters[MotionNotify] = Motion_Filter(butc);
+ if (!butc->state && mouse->fromPassiveGrab)
+ deactivateGrab = TRUE;
+ break;
+ default:
+ FatalError("bogus pointer event from ddx");
+ }
+ }
+ else if (!CheckMotion(xE))
+ return;
+ if (grab)
+ DeliverGrabbedEvent(xE, mouse, deactivateGrab, count);
+ else
+ DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
+ mouse, count);
+ if (deactivateGrab)
+ (*mouse->DeactivateGrab)(mouse);
+}
+
+#define AtMostOneClient \
+ (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
+
+void
+RecalculateDeliverableEvents(pWin)
+ register WindowPtr pWin;
+{
+ register OtherClients *others;
+ register WindowPtr pChild;
+
+ pChild = pWin;
+ while (1)
+ {
+ if (pChild->optional)
+ {
+ pChild->optional->otherEventMasks = 0;
+ for (others = wOtherClients(pChild); others; others = others->next)
+ {
+ pChild->optional->otherEventMasks |= others->mask;
+ }
+ }
+ pChild->deliverableEvents = pChild->eventMask|
+ wOtherEventMasks(pChild);
+ if (pChild->parent)
+ pChild->deliverableEvents |=
+ (pChild->parent->deliverableEvents &
+ ~wDontPropagateMask(pChild) & PropagateMask);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+}
+
+int
+OtherClientGone(value, id)
+ pointer value; /* must conform to DeleteType */
+ XID id;
+{
+ register OtherClientsPtr other, prev;
+ register WindowPtr pWin = (WindowPtr)value;
+
+ prev = 0;
+ for (other = wOtherClients(pWin); other; other = other->next)
+ {
+ if (other->resource == id)
+ {
+ if (prev)
+ prev->next = other->next;
+ else
+ {
+ if (!(pWin->optional->otherClients = other->next))
+ CheckWindowOptionalNeed (pWin);
+ }
+ xfree(other);
+ RecalculateDeliverableEvents(pWin);
+ return(Success);
+ }
+ prev = other;
+ }
+ FatalError("client not on event list");
+ /*NOTREACHED*/
+ return -1; /* make compiler happy */
+}
+
+int
+EventSelectForWindow(pWin, client, mask)
+ register WindowPtr pWin;
+ register ClientPtr client;
+ Mask mask;
+{
+ Mask check;
+ OtherClients * others;
+
+ if (mask & ~AllEventMasks)
+ {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ check = (mask & AtMostOneClient);
+ if (check & (pWin->eventMask|wOtherEventMasks(pWin)))
+ { /* It is illegal for two different
+ clients to select on any of the
+ events for AtMostOneClient. However,
+ it is OK, for some client to
+ continue selecting on one of those
+ events. */
+ if ((wClient(pWin) != client) && (check & pWin->eventMask))
+ return BadAccess;
+ for (others = wOtherClients (pWin); others; others = others->next)
+ {
+ if (!SameClient(others, client) && (check & others->mask))
+ return BadAccess;
+ }
+ }
+ if (wClient (pWin) == client)
+ {
+ check = pWin->eventMask;
+#ifdef SGIMISC
+ pWin->eventMask =
+ (mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask);
+#else
+ pWin->eventMask = mask;
+#endif
+ }
+ else
+ {
+ for (others = wOtherClients (pWin); others; others = others->next)
+ {
+ if (SameClient(others, client))
+ {
+ check = others->mask;
+#ifdef SGIMISC
+ mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask);
+#endif
+ if (mask == 0)
+ {
+ FreeResource(others->resource, RT_NONE);
+ return Success;
+ }
+ else
+ others->mask = mask;
+ goto maskSet;
+ }
+ }
+ check = 0;
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ return BadAlloc;
+ others = (OtherClients *) xalloc(sizeof(OtherClients));
+ if (!others)
+ return BadAlloc;
+ others->mask = mask;
+ others->resource = FakeClientID(client->index);
+ others->next = pWin->optional->otherClients;
+ pWin->optional->otherClients = others;
+ if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin))
+ return BadAlloc;
+ }
+maskSet:
+ if ((inputInfo.pointer->valuator->motionHintWindow == pWin) &&
+ (mask & PointerMotionHintMask) &&
+ !(check & PointerMotionHintMask) &&
+ !inputInfo.pointer->grab)
+ inputInfo.pointer->valuator->motionHintWindow = NullWindow;
+ RecalculateDeliverableEvents(pWin);
+ return Success;
+}
+
+/*ARGSUSED*/
+int
+EventSuppressForWindow(pWin, client, mask, checkOptional)
+ register WindowPtr pWin;
+ register ClientPtr client;
+ Mask mask;
+ Bool *checkOptional;
+{
+ register int i, free;
+
+ if ((mask & ~PropagateMask) && !permitOldBugs)
+ {
+ client->errorValue = mask;
+ return BadValue;
+ }
+ if (pWin->dontPropagate)
+ DontPropagateRefCnts[pWin->dontPropagate]--;
+ if (!mask)
+ i = 0;
+ else
+ {
+ for (i = DNPMCOUNT, free = 0; --i > 0; )
+ {
+ if (!DontPropagateRefCnts[i])
+ free = i;
+ else if (mask == DontPropagateMasks[i])
+ break;
+ }
+ if (!i && free)
+ {
+ i = free;
+ DontPropagateMasks[i] = mask;
+ }
+ }
+ if (i || !mask)
+ {
+ pWin->dontPropagate = i;
+ if (i)
+ DontPropagateRefCnts[i]++;
+ if (pWin->optional)
+ {
+ pWin->optional->dontPropagateMask = mask;
+ *checkOptional = TRUE;
+ }
+ }
+ else
+ {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ {
+ if (pWin->dontPropagate)
+ DontPropagateRefCnts[pWin->dontPropagate]++;
+ return BadAlloc;
+ }
+ pWin->dontPropagate = 0;
+ pWin->optional->dontPropagateMask = mask;
+ }
+ RecalculateDeliverableEvents(pWin);
+ return Success;
+}
+
+static WindowPtr
+#if NeedFunctionPrototypes
+CommonAncestor(
+ register WindowPtr a,
+ register WindowPtr b)
+#else
+CommonAncestor(a, b)
+ register WindowPtr a, b;
+#endif
+{
+ for (b = b->parent; b; b = b->parent)
+ if (IsParent(b, a)) return b;
+ return NullWindow;
+}
+
+static void
+#if NeedFunctionPrototypes
+EnterLeaveEvent(
+ int type,
+ int mode,
+ int detail,
+ register WindowPtr pWin,
+ Window child)
+#else
+EnterLeaveEvent(type, mode, detail, pWin, child)
+ int type, mode, detail;
+ register WindowPtr pWin;
+ Window child;
+#endif
+{
+ xEvent event;
+ register DeviceIntPtr keybd = inputInfo.keyboard;
+ WindowPtr focus;
+ register DeviceIntPtr mouse = inputInfo.pointer;
+ register GrabPtr grab = mouse->grab;
+ Mask mask;
+
+ if ((pWin == mouse->valuator->motionHintWindow) &&
+ (detail != NotifyInferior))
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (grab)
+ {
+ mask = (pWin == grab->window) ? grab->eventMask : 0;
+ if (grab->ownerEvents)
+ mask |= EventMaskForClient(pWin, rClient(grab));
+ }
+ else
+ {
+ mask = pWin->eventMask | wOtherEventMasks(pWin);
+ }
+ if (mask & filters[type])
+ {
+ event.u.u.type = type;
+ event.u.u.detail = detail;
+ event.u.enterLeave.time = currentTime.milliseconds;
+ event.u.enterLeave.rootX = sprite.hot.x;
+ event.u.enterLeave.rootY = sprite.hot.y;
+ /* Counts on the same initial structure of crossing & button events! */
+ FixUpEventFromWindow(&event, pWin, None, FALSE);
+ /* Enter/Leave events always set child */
+ event.u.enterLeave.child = child;
+ event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
+ ELFlagSameScreen : 0;
+#ifdef XKB
+ if (!noXkbExtension) {
+ event.u.enterLeave.state = mouse->button->state & 0x1f00;
+ event.u.enterLeave.state |=
+ XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
+ } else
+#endif
+ event.u.enterLeave.state = keybd->key->state | mouse->button->state;
+ event.u.enterLeave.mode = mode;
+ focus = keybd->focus->win;
+ if ((focus != NoneWin) &&
+ ((pWin == focus) || (focus == PointerRootWin) ||
+ IsParent(focus, pWin)))
+ event.u.enterLeave.flags |= ELFlagFocus;
+ if (grab)
+ (void)TryClientEvents(rClient(grab), &event, 1, mask,
+ filters[type], grab);
+ else
+ (void)DeliverEventsToWindow(pWin, &event, 1, filters[type],
+ NullGrab, 0);
+ }
+ if ((type == EnterNotify) && (mask & KeymapStateMask))
+ {
+ xKeymapEvent ke;
+
+#ifdef XCSECURITY
+ ClientPtr client = grab ? rClient(grab)
+ : clients[CLIENT_ID(pWin->drawable.id)];
+ if (!SecurityCheckDeviceAccess(client, keybd, FALSE))
+ {
+ bzero((char *)&ke.map[0], 31);
+ }
+ else
+#endif
+ memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
+ ke.type = KeymapNotify;
+ if (grab)
+ (void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1, mask,
+ KeymapStateMask, grab);
+ else
+ (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1,
+ KeymapStateMask, NullGrab, 0);
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
+#else
+EnterNotifies(ancestor, child, mode, detail)
+ WindowPtr ancestor, child;
+ int mode, detail;
+#endif
+{
+ WindowPtr parent = child->parent;
+
+ if (ancestor == parent)
+ return;
+ EnterNotifies(ancestor, parent, mode, detail);
+ EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id);
+}
+
+static void
+#if NeedFunctionPrototypes
+LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
+#else
+LeaveNotifies(child, ancestor, mode, detail)
+ WindowPtr child, ancestor;
+ int detail, mode;
+#endif
+{
+ register WindowPtr pWin;
+
+ if (ancestor == child)
+ return;
+ for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent)
+ {
+ EnterLeaveEvent(LeaveNotify, mode, detail, pWin, child->drawable.id);
+ child = pWin;
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
+#else
+DoEnterLeaveEvents(fromWin, toWin, mode)
+ WindowPtr fromWin, toWin;
+ int mode;
+#endif
+{
+ if (fromWin == toWin)
+ return;
+ if (IsParent(fromWin, toWin))
+ {
+ EnterLeaveEvent(LeaveNotify, mode, NotifyInferior, fromWin, None);
+ EnterNotifies(fromWin, toWin, mode, NotifyVirtual);
+ EnterLeaveEvent(EnterNotify, mode, NotifyAncestor, toWin, None);
+ }
+ else if (IsParent(toWin, fromWin))
+ {
+ EnterLeaveEvent(LeaveNotify, mode, NotifyAncestor, fromWin, None);
+ LeaveNotifies(fromWin, toWin, mode, NotifyVirtual);
+ EnterLeaveEvent(EnterNotify, mode, NotifyInferior, toWin, None);
+ }
+ else
+ { /* neither fromWin nor toWin is descendent of the other */
+ WindowPtr common = CommonAncestor(toWin, fromWin);
+ /* common == NullWindow ==> different screens */
+ EnterLeaveEvent(LeaveNotify, mode, NotifyNonlinear, fromWin, None);
+ LeaveNotifies(fromWin, common, mode, NotifyNonlinearVirtual);
+ EnterNotifies(common, toWin, mode, NotifyNonlinearVirtual);
+ EnterLeaveEvent(EnterNotify, mode, NotifyNonlinear, toWin, None);
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin)
+#else
+FocusEvent(dev, type, mode, detail, pWin)
+ DeviceIntPtr dev;
+ int type, mode, detail;
+ register WindowPtr pWin;
+#endif
+{
+ xEvent event;
+
+#ifdef XINPUT
+ if (dev != inputInfo.keyboard)
+ {
+ DeviceFocusEvent(dev, type, mode, detail, pWin);
+ return;
+ }
+#endif
+ event.u.focus.mode = mode;
+ event.u.u.type = type;
+ event.u.u.detail = detail;
+ event.u.focus.window = pWin->drawable.id;
+ (void)DeliverEventsToWindow(pWin, &event, 1, filters[type], NullGrab,
+ 0);
+ if ((type == FocusIn) &&
+ ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
+ {
+ xKeymapEvent ke;
+#ifdef XCSECURITY
+ ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)];
+ if (!SecurityCheckDeviceAccess(client, dev, FALSE))
+ {
+ bzero((char *)&ke.map[0], 31);
+ }
+ else
+#endif
+ memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31);
+ ke.type = KeymapNotify;
+ (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1,
+ KeymapStateMask, NullGrab, 0);
+ }
+}
+
+ /*
+ * recursive because it is easier
+ * no-op if child not descended from ancestor
+ */
+static Bool
+#if NeedFunctionPrototypes
+FocusInEvents(
+ DeviceIntPtr dev,
+ WindowPtr ancestor, WindowPtr child, WindowPtr skipChild,
+ int mode, int detail,
+ Bool doAncestor)
+#else
+FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
+ DeviceIntPtr dev;
+ WindowPtr ancestor, child, skipChild;
+ int mode, detail;
+ Bool doAncestor;
+#endif
+{
+ if (child == NullWindow)
+ return ancestor == NullWindow;
+ if (ancestor == child)
+ {
+ if (doAncestor)
+ FocusEvent(dev, FocusIn, mode, detail, child);
+ return TRUE;
+ }
+ if (FocusInEvents(dev, ancestor, child->parent, skipChild, mode, detail,
+ doAncestor))
+ {
+ if (child != skipChild)
+ FocusEvent(dev, FocusIn, mode, detail, child);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* dies horribly if ancestor is not an ancestor of child */
+static void
+#if NeedFunctionPrototypes
+FocusOutEvents(
+ DeviceIntPtr dev,
+ WindowPtr child, WindowPtr ancestor,
+ int mode, int detail,
+ Bool doAncestor)
+#else
+FocusOutEvents(dev, child, ancestor, mode, detail, doAncestor)
+ DeviceIntPtr dev;
+ WindowPtr child, ancestor;
+ int mode;
+ int detail;
+ Bool doAncestor;
+#endif
+{
+ register WindowPtr pWin;
+
+ for (pWin = child; pWin != ancestor; pWin = pWin->parent)
+ FocusEvent(dev, FocusOut, mode, detail, pWin);
+ if (doAncestor)
+ FocusEvent(dev, FocusOut, mode, detail, ancestor);
+}
+
+void
+DoFocusEvents(dev, fromWin, toWin, mode)
+ DeviceIntPtr dev;
+ WindowPtr fromWin, toWin;
+ int mode;
+{
+ int out, in; /* for holding details for to/from
+ PointerRoot/None */
+ int i;
+
+ if (fromWin == toWin)
+ return;
+ out = (fromWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot;
+ in = (toWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot;
+ /* wrong values if neither, but then not referenced */
+
+ if ((toWin == NullWindow) || (toWin == PointerRootWin))
+ {
+ if ((fromWin == NullWindow) || (fromWin == PointerRootWin))
+ {
+ if (fromWin == PointerRootWin)
+ FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
+ TRUE);
+ /* Notify all the roots */
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out,
+ WindowTable[sprite.hotPhys.pScreen->myNum]);
+ else {
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+ }
+#else
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#endif
+ }
+ else
+ {
+ if (IsParent(fromWin, sprite.win))
+ FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer,
+ FALSE);
+ FocusEvent(dev, FocusOut, mode, NotifyNonlinear, fromWin);
+ /* next call catches the root too, if the screen changed */
+ FocusOutEvents(dev, fromWin->parent, NullWindow, mode,
+ NotifyNonlinearVirtual, FALSE);
+ }
+ /* Notify all the roots */
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusIn, mode, in,
+ WindowTable[sprite.hotPhys.pScreen->myNum]);
+ else {
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
+ }
+#else
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
+#endif
+ if (toWin == PointerRootWin)
+ (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
+ NotifyPointer, TRUE);
+ }
+ else
+ {
+ if ((fromWin == NullWindow) || (fromWin == PointerRootWin))
+ {
+ if (fromWin == PointerRootWin)
+ FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
+ TRUE);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out,
+ WindowTable[sprite.hotPhys.pScreen->myNum]);
+ else {
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+ }
+#else
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#endif
+ if (toWin->parent != NullWindow)
+ (void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
+ NotifyNonlinearVirtual, TRUE);
+ FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin);
+ if (IsParent(toWin, sprite.win))
+ (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode,
+ NotifyPointer, FALSE);
+ }
+ else
+ {
+ if (IsParent(toWin, fromWin))
+ {
+ FocusEvent(dev, FocusOut, mode, NotifyAncestor, fromWin);
+ FocusOutEvents(dev, fromWin->parent, toWin, mode,
+ NotifyVirtual, FALSE);
+ FocusEvent(dev, FocusIn, mode, NotifyInferior, toWin);
+ if ((IsParent(toWin, sprite.win)) &&
+ (sprite.win != fromWin) &&
+ (!IsParent(fromWin, sprite.win)) &&
+ (!IsParent(sprite.win, fromWin)))
+ (void)FocusInEvents(dev, toWin, sprite.win, NullWindow,
+ mode, NotifyPointer, FALSE);
+ }
+ else
+ if (IsParent(fromWin, toWin))
+ {
+ if ((IsParent(fromWin, sprite.win)) &&
+ (sprite.win != fromWin) &&
+ (!IsParent(toWin, sprite.win)) &&
+ (!IsParent(sprite.win, toWin)))
+ FocusOutEvents(dev, sprite.win, fromWin, mode,
+ NotifyPointer, FALSE);
+ FocusEvent(dev, FocusOut, mode, NotifyInferior, fromWin);
+ (void)FocusInEvents(dev, fromWin, toWin, toWin, mode,
+ NotifyVirtual, FALSE);
+ FocusEvent(dev, FocusIn, mode, NotifyAncestor, toWin);
+ }
+ else
+ {
+ /* neither fromWin or toWin is child of other */
+ WindowPtr common = CommonAncestor(toWin, fromWin);
+ /* common == NullWindow ==> different screens */
+ if (IsParent(fromWin, sprite.win))
+ FocusOutEvents(dev, sprite.win, fromWin, mode,
+ NotifyPointer, FALSE);
+ FocusEvent(dev, FocusOut, mode, NotifyNonlinear, fromWin);
+ if (fromWin->parent != NullWindow)
+ FocusOutEvents(dev, fromWin->parent, common, mode,
+ NotifyNonlinearVirtual, FALSE);
+ if (toWin->parent != NullWindow)
+ (void)FocusInEvents(dev, common, toWin, toWin, mode,
+ NotifyNonlinearVirtual, FALSE);
+ FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin);
+ if (IsParent(toWin, sprite.win))
+ (void)FocusInEvents(dev, toWin, sprite.win, NullWindow,
+ mode, NotifyPointer, FALSE);
+ }
+ }
+ }
+}
+
+int
+#if NeedFunctionPrototypes
+SetInputFocus(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ Window focusID,
+ CARD8 revertTo,
+ Time ctime,
+ Bool followOK)
+#else
+SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
+ ClientPtr client;
+ DeviceIntPtr dev;
+ Window focusID;
+ CARD8 revertTo;
+ Time ctime;
+ Bool followOK;
+#endif
+{
+ register FocusClassPtr focus;
+ register WindowPtr focusWin;
+ int mode;
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ if ((revertTo != RevertToParent) &&
+ (revertTo != RevertToPointerRoot) &&
+ (revertTo != RevertToNone) &&
+ ((revertTo != RevertToFollowKeyboard) || !followOK))
+ {
+ client->errorValue = revertTo;
+ return BadValue;
+ }
+ time = ClientTimeToServerTime(ctime);
+ if ((focusID == None) || (focusID == PointerRoot))
+ focusWin = (WindowPtr)(long)focusID;
+ else if ((focusID == FollowKeyboard) && followOK)
+ focusWin = inputInfo.keyboard->focus->win;
+ else if (!(focusWin = SecurityLookupWindow(focusID, client,
+ SecurityReadAccess)))
+ return BadWindow;
+ else
+ {
+ /* It is a match error to try to set the input focus to an
+ unviewable window. */
+
+ if(!focusWin->realized)
+ return(BadMatch);
+ }
+ focus = dev->focus;
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, focus->time) == EARLIER))
+ return Success;
+ mode = (dev->grab) ? NotifyWhileGrabbed : NotifyNormal;
+ if (focus->win == FollowKeyboardWin)
+ DoFocusEvents(dev, inputInfo.keyboard->focus->win, focusWin, mode);
+ else
+ DoFocusEvents(dev, focus->win, focusWin, mode);
+ focus->time = time;
+ focus->revert = revertTo;
+ if (focusID == FollowKeyboard)
+ focus->win = FollowKeyboardWin;
+ else
+ focus->win = focusWin;
+ if ((focusWin == NoneWin) || (focusWin == PointerRootWin))
+ focus->traceGood = 0;
+ else
+ {
+ int depth = 0;
+ register WindowPtr pWin;
+
+ for (pWin = focusWin; pWin; pWin = pWin->parent) depth++;
+ if (depth > focus->traceSize)
+ {
+ focus->traceSize = depth+1;
+ Must_have_memory = TRUE; /* XXX */
+ focus->trace = (WindowPtr *)xrealloc(focus->trace,
+ focus->traceSize *
+ sizeof(WindowPtr));
+ Must_have_memory = FALSE; /* XXX */
+ }
+ focus->traceGood = depth;
+ for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--)
+ focus->trace[depth] = pWin;
+ }
+ return Success;
+}
+
+#ifdef PANORAMIX
+int PanoramiXSetInputFocus(ClientPtr client)
+{
+ REQUEST(xSetInputFocusReq);
+ int j, result;
+ Window winID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST_SIZE_MATCH(xSetInputFocusReq);
+ j = (sprite.hotPhys.pScreen)->myNum;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->focus);
+ winID = pPanoramiXWin ? pPanoramiXWin->info[j].id : stuff->focus;
+ result = SetInputFocus(client, inputInfo.keyboard, winID, stuff->revertTo,
+ stuff->time, FALSE);
+ return(result);
+}
+#endif
+
+int
+ProcSetInputFocus(client)
+ ClientPtr client;
+{
+ REQUEST(xSetInputFocusReq);
+
+ REQUEST_SIZE_MATCH(xSetInputFocusReq);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return PanoramiXSetInputFocus(client);
+#endif
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
+ return Success;
+#endif
+ return SetInputFocus(client, inputInfo.keyboard, stuff->focus,
+ stuff->revertTo, stuff->time, FALSE);
+}
+
+#ifdef PANORAMIX
+int PanoramiXGetInputFocus(ClientPtr client)
+{
+ xGetInputFocusReply rep;
+ REQUEST(xReq);
+ int j;
+ FocusClassPtr focus = inputInfo.keyboard->focus;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+
+ REQUEST_SIZE_MATCH(xReq);
+ j = (sprite.hotPhys.pScreen)->myNum;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (focus->win == NoneWin)
+ rep.focus = None;
+ else if (focus->win == PointerRootWin)
+ rep.focus = PointerRoot;
+ else{
+ rep.focus = focus->win->drawable.id;
+ PANORAMIXFIND_ID_BY_SCRNUM(pPanoramiXWin, focus->win->drawable.id, j);
+ if (pPanoramiXWin)
+ rep.focus = pPanoramiXWin->info[0].id;
+ }
+ rep.revertTo = focus->revert;
+ WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
+ return Success;
+}
+#endif
+
+int
+ProcGetInputFocus(client)
+ ClientPtr client;
+{
+ xGetInputFocusReply rep;
+ REQUEST(xReq);
+ FocusClassPtr focus = inputInfo.keyboard->focus;
+
+ REQUEST_SIZE_MATCH(xReq);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return PanoramiXGetInputFocus(client);
+#endif
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (focus->win == NoneWin)
+ rep.focus = None;
+ else if (focus->win == PointerRootWin)
+ rep.focus = PointerRoot;
+ else rep.focus = focus->win->drawable.id;
+ rep.revertTo = focus->revert;
+ WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
+ return Success;
+}
+
+int
+ProcGrabPointer(client)
+ ClientPtr client;
+{
+ xGrabPointerReply rep;
+ DeviceIntPtr device = inputInfo.pointer;
+ GrabPtr grab;
+ WindowPtr pWin, confineTo;
+ CursorPtr cursor, oldCursor;
+ REQUEST(xGrabPointerReq);
+ TimeStamp time;
+#ifdef PANORAMIX
+ int j,i, PanoramiXNum;
+ Bool NotViewable, NotRealized;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST_SIZE_MATCH(xGrabPointerReq);
+ UpdateCurrentTime();
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
+ NotViewable = FALSE;
+ }
+#endif
+ if ((stuff->pointerMode != GrabModeSync) &&
+ (stuff->pointerMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->pointerMode;
+ return BadValue;
+ }
+ if ((stuff->keyboardMode != GrabModeSync) &&
+ (stuff->keyboardMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->keyboardMode;
+ return BadValue;
+ }
+ if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue))
+ {
+ client->errorValue = stuff->ownerEvents;
+ return BadValue;
+ }
+ if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs)
+ {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
+ }
+ pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ if (pPanoramiXWin) {
+ pWin = SecurityLookupWindow(pPanoramiXWin->info[PanoramiXNum].id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+ }
+ if (stuff->confineTo == PanoramiXWinRoot->info[0].id)
+ stuff->confineTo = None;
+ }
+#endif
+ if (stuff->confineTo == None)
+ confineTo = NullWindow;
+#ifdef PANORAMIX
+ else if ( !noPanoramiXExtension ) {
+ if (stuff->confineTo) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->confineTo);
+ if (pPanoramiXWin) {
+ stuff->confineTo = pPanoramiXWin->info[sprite.hotPhys.pScreen->
+myNum].id;
+ confineTo = SecurityLookupWindow(stuff->confineTo, client,
+ SecurityReadAccess);
+ if (!confineTo)
+ return BadWindow;
+ }
+ if ((confineTo && !(confineTo->realized &&
+ REGION_NOTEMPTY(confineTo->drawable.pScreen, &confineTo->
+borderSize))))
+ NotViewable = TRUE;
+ }
+ } else {
+#else
+ else
+ {
+#endif
+ confineTo = SecurityLookupWindow(stuff->confineTo, client,
+ SecurityReadAccess);
+ if (!confineTo)
+ return BadWindow;
+ }
+ if (stuff->cursor == None)
+ cursor = NullCursor;
+ else
+ {
+ cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
+ RT_CURSOR, SecurityReadAccess);
+ if (!cursor)
+ {
+ client->errorValue = stuff->cursor;
+ return BadCursor;
+ }
+ }
+ /* at this point, some sort of reply is guaranteed. */
+ time = ClientTimeToServerTime(stuff->time);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ grab = device->grab;
+ if ((grab) && !SameClient(grab, client))
+ rep.status = AlreadyGrabbed;
+#ifdef PANORAMIX
+ else if ((!noPanoramiXExtension ) &&
+ (!(pWin->realized) || NotViewable))
+ rep.status = GrabNotViewable;
+ else if ((noPanoramiXExtension) && (!pWin->realized) ||
+ (confineTo &&
+ !(confineTo->realized &&
+ REGION_NOTEMPTY( confineTo->drawable.pScreen,
+ &confineTo->borderSize))))
+#else
+ else if ((!pWin->realized) ||
+ (confineTo &&
+ !(confineTo->realized &&
+ REGION_NOTEMPTY( confineTo->drawable.pScreen,
+ &confineTo->borderSize))))
+#endif
+ rep.status = GrabNotViewable;
+ else if (device->sync.frozen &&
+ device->sync.other && !SameClient(device->sync.other, client))
+ rep.status = GrabFrozen;
+ else if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, device->grabTime) == EARLIER))
+ rep.status = GrabInvalidTime;
+ else
+ {
+ GrabRec tempGrab;
+
+ oldCursor = NullCursor;
+ if (grab)
+ {
+ if (grab->confineTo && !confineTo)
+ ConfineCursorToWindow(ROOT, FALSE, FALSE);
+ oldCursor = grab->cursor;
+ }
+ tempGrab.cursor = cursor;
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.ownerEvents = stuff->ownerEvents;
+ tempGrab.eventMask = stuff->eventMask;
+ tempGrab.confineTo = confineTo;
+ tempGrab.window = pWin;
+ tempGrab.keyboardMode = stuff->keyboardMode;
+ tempGrab.pointerMode = stuff->pointerMode;
+ tempGrab.device = device;
+ (*device->ActivateGrab)(device, &tempGrab, time, FALSE);
+ if (oldCursor)
+ FreeCursor (oldCursor, (Cursor)0);
+ rep.status = GrabSuccess;
+ }
+ WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
+ return Success;
+}
+
+int
+ProcChangeActivePointerGrab(client)
+ ClientPtr client;
+{
+ DeviceIntPtr device = inputInfo.pointer;
+ register GrabPtr grab = device->grab;
+ CursorPtr newCursor, oldCursor;
+ REQUEST(xChangeActivePointerGrabReq);
+ TimeStamp time;
+
+ REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
+ if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs)
+ {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
+ }
+ if (stuff->cursor == None)
+ newCursor = NullCursor;
+ else
+ {
+ newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
+ RT_CURSOR, SecurityReadAccess);
+ if (!newCursor)
+ {
+ client->errorValue = stuff->cursor;
+ return BadCursor;
+ }
+ }
+ if (!grab)
+ return Success;
+ if (!SameClient(grab, client))
+ return Success;
+ time = ClientTimeToServerTime(stuff->time);
+ if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, device->grabTime) == EARLIER))
+ return Success;
+ oldCursor = grab->cursor;
+ grab->cursor = newCursor;
+ if (newCursor)
+ newCursor->refcnt++;
+ PostNewCursor();
+ if (oldCursor)
+ FreeCursor(oldCursor, (Cursor)0);
+ grab->eventMask = stuff->eventMask;
+ return Success;
+}
+
+int
+ProcUngrabPointer(client)
+ ClientPtr client;
+{
+ DeviceIntPtr device = inputInfo.pointer;
+ GrabPtr grab;
+ TimeStamp time;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ UpdateCurrentTime();
+ grab = device->grab;
+ time = ClientTimeToServerTime(stuff->id);
+ if ((CompareTimeStamps(time, currentTime) != LATER) &&
+ (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client))
+ (*device->DeactivateGrab)(device);
+ return Success;
+}
+
+int
+GrabDevice(client, dev, this_mode, other_mode, grabWindow, ownerEvents, ctime,
+ mask, status)
+ register ClientPtr client;
+ register DeviceIntPtr dev;
+ unsigned this_mode;
+ unsigned other_mode;
+ Window grabWindow;
+ unsigned ownerEvents;
+ Time ctime;
+ Mask mask;
+ CARD8 *status;
+{
+ register WindowPtr pWin;
+ register GrabPtr grab;
+ TimeStamp time;
+
+ UpdateCurrentTime();
+ if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
+ {
+ client->errorValue = this_mode;
+ return BadValue;
+ }
+ if ((other_mode != GrabModeSync) && (other_mode != GrabModeAsync))
+ {
+ client->errorValue = other_mode;
+ return BadValue;
+ }
+ if ((ownerEvents != xFalse) && (ownerEvents != xTrue))
+ {
+ client->errorValue = ownerEvents;
+ return BadValue;
+ }
+ pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+ time = ClientTimeToServerTime(ctime);
+ grab = dev->grab;
+ if (grab && !SameClient(grab, client))
+ *status = AlreadyGrabbed;
+ else if (!pWin->realized)
+ *status = GrabNotViewable;
+ else if ((CompareTimeStamps(time, currentTime) == LATER) ||
+ (CompareTimeStamps(time, dev->grabTime) == EARLIER))
+ *status = GrabInvalidTime;
+ else if (dev->sync.frozen &&
+ dev->sync.other && !SameClient(dev->sync.other, client))
+ *status = GrabFrozen;
+ else
+ {
+ GrabRec tempGrab;
+
+ tempGrab.window = pWin;
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.ownerEvents = ownerEvents;
+ tempGrab.keyboardMode = this_mode;
+ tempGrab.pointerMode = other_mode;
+ tempGrab.eventMask = mask;
+ tempGrab.device = dev;
+ (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE);
+ *status = GrabSuccess;
+ }
+ return Success;
+}
+
+int
+ProcGrabKeyboard(client)
+ ClientPtr client;
+{
+ xGrabKeyboardReply rep;
+ REQUEST(xGrabKeyboardReq);
+ int result;
+#ifdef PANORAMIX
+ int PanoramiXNum;
+ Window winID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST_SIZE_MATCH(xGrabKeyboardReq);
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
+ {
+ result = Success;
+ rep.status = AlreadyGrabbed;
+ }
+ else
+#endif
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
+ winID = stuff->grabWindow;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ stuff->grabWindow = pPanoramiXWin ? pPanoramiXWin->info[PanoramiXNum].id : winID;
+ }
+#endif
+ result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode,
+ stuff->pointerMode, stuff->grabWindow,
+ stuff->ownerEvents, stuff->time,
+ KeyPressMask | KeyReleaseMask, &rep.status);
+ if (result != Success)
+ return result;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
+ return Success;
+}
+
+int
+ProcUngrabKeyboard(client)
+ ClientPtr client;
+{
+ DeviceIntPtr device = inputInfo.keyboard;
+ GrabPtr grab;
+ TimeStamp time;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ UpdateCurrentTime();
+ grab = device->grab;
+ time = ClientTimeToServerTime(stuff->id);
+ if ((CompareTimeStamps(time, currentTime) != LATER) &&
+ (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
+ (grab) && SameClient(grab, client))
+ (*device->DeactivateGrab)(device);
+ return Success;
+}
+
+int
+ProcQueryPointer(client)
+ ClientPtr client;
+{
+ xQueryPointerReply rep;
+ WindowPtr pWin, t;
+ REQUEST(xResourceReq);
+ DeviceIntPtr mouse = inputInfo.pointer;
+#ifdef PANORAMIX
+ int PanoramiXNum;
+ Window winID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ t = sprite.win;
+ PanoramiXNum = (sprite.hotPhys.pScreen)->myNum;
+ if (t == pWin) {
+ /* we probably want pWin of some Fake Window */
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+ winID = pPanoramiXWin ? pPanoramiXWin->info[PanoramiXNum].id : stuff->id;
+ pWin = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ }
+ }
+#endif
+ if (mouse->valuator->motionHintWindow)
+ MaybeStopHint(mouse, client);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.mask = mouse->button->state | inputInfo.keyboard->key->state;
+ rep.length = 0;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ rep.root = PanoramiXWinRoot->info[0].id;
+ rep.rootX = sprite.hot.x + panoramiXdataPtr[PanoramiXNum].x;
+ rep.rootY = sprite.hot.y + panoramiXdataPtr[PanoramiXNum].y;
+ } else {
+#endif
+ rep.root = (ROOT)->drawable.id;
+ rep.rootX = sprite.hot.x;
+ rep.rootY = sprite.hot.y;
+#ifdef PANORAMIX
+ }
+#endif
+ rep.child = None;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ rep.sameScreen = xTrue;
+ rep.winX = sprite.hot.x - pWin->drawable.x + panoramiXdataPtr[PanoramiXNum].x;
+ rep.winY = sprite.hot.y - pWin->drawable.y + panoramiXdataPtr[PanoramiXNum].y;
+ for (; pPanoramiXWin &&
+ ((unsigned long)LookupIDByType(pPanoramiXWin->info[PanoramiXNum].id,
+ RT_WINDOW) != (unsigned long) t); pPanoramiXWin = pPanoramiXWin->next);
+ if (pPanoramiXWin)
+ t = (WindowPtr)LookupIDByType(pPanoramiXWin->info[0].id, RT_WINDOW);
+ for (; t; t = t->parent) {
+ if (t->parent == pWin) {
+ rep.child = t->drawable.id;
+ break;
+ }
+ }
+ } else {
+#endif
+ if (sprite.hot.pScreen == pWin->drawable.pScreen)
+ {
+ rep.sameScreen = xTrue;
+ rep.winX = sprite.hot.x - pWin->drawable.x;
+ rep.winY = sprite.hot.y - pWin->drawable.y;
+ for (t = sprite.win; t; t = t->parent)
+ if (t->parent == pWin)
+ {
+ rep.child = t->drawable.id;
+ break;
+ }
+ }
+ else
+ {
+ rep.sameScreen = xFalse;
+ rep.winX = 0;
+ rep.winY = 0;
+ }
+#ifdef PANORAMIX
+ }
+#endif
+
+ WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
+
+ return(Success);
+}
+
+void
+InitEvents()
+{
+ int i;
+
+ sprite.hot.pScreen = sprite.hotPhys.pScreen = (ScreenPtr)NULL;
+ inputInfo.numDevices = 0;
+ inputInfo.devices = (DeviceIntPtr)NULL;
+ inputInfo.off_devices = (DeviceIntPtr)NULL;
+ inputInfo.keyboard = (DeviceIntPtr)NULL;
+ inputInfo.pointer = (DeviceIntPtr)NULL;
+ if (spriteTraceSize == 0)
+ {
+ spriteTraceSize = 32;
+ spriteTrace = (WindowPtr *)xalloc(32*sizeof(WindowPtr));
+ if (!spriteTrace)
+ FatalError("failed to allocate spriteTrace");
+ }
+ spriteTraceGood = 0;
+ lastEventMask = OwnerGrabButtonMask;
+ filters[MotionNotify] = PointerMotionMask;
+ sprite.win = NullWindow;
+ sprite.current = NullCursor;
+ sprite.hotLimits.x1 = 0;
+ sprite.hotLimits.y1 = 0;
+ sprite.hotLimits.x2 = 0;
+ sprite.hotLimits.y2 = 0;
+ sprite.confined = FALSE;
+ syncEvents.replayDev = (DeviceIntPtr)NULL;
+ syncEvents.replayWin = NullWindow;
+ while (syncEvents.pending)
+ {
+ QdEventPtr next = syncEvents.pending->next;
+ xfree(syncEvents.pending);
+ syncEvents.pending = next;
+ }
+ syncEvents.pendtail = &syncEvents.pending;
+ syncEvents.playingEvents = FALSE;
+ syncEvents.time.months = 0;
+ syncEvents.time.milliseconds = 0; /* hardly matters */
+ currentTime.months = 0;
+ currentTime.milliseconds = GetTimeInMillis();
+ lastDeviceEventTime = currentTime;
+ for (i = 0; i < DNPMCOUNT; i++)
+ {
+ DontPropagateMasks[i] = 0;
+ DontPropagateRefCnts[i] = 0;
+ }
+}
+
+int
+ProcSendEvent(client)
+ ClientPtr client;
+{
+ WindowPtr pWin;
+ WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
+ REQUEST(xSendEventReq);
+
+ REQUEST_SIZE_MATCH(xSendEventReq);
+
+ /* The client's event type must be a core event type or one defined by an
+ extension. */
+
+ if ( ! ((stuff->event.u.u.type > X_Reply &&
+ stuff->event.u.u.type < LASTEvent) ||
+ (stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
+ stuff->event.u.u.type < (unsigned)lastEvent)))
+ {
+ client->errorValue = stuff->event.u.u.type;
+ return BadValue;
+ }
+ if (stuff->event.u.u.type == ClientMessage &&
+ stuff->event.u.u.detail != 8 &&
+ stuff->event.u.u.detail != 16 &&
+ stuff->event.u.u.detail != 32 &&
+ !permitOldBugs)
+ {
+ client->errorValue = stuff->event.u.u.detail;
+ return BadValue;
+ }
+ if ((stuff->eventMask & ~AllEventMasks) && !permitOldBugs)
+ {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
+ }
+
+ if (stuff->destination == PointerWindow)
+ pWin = sprite.win;
+ else if (stuff->destination == InputFocus)
+ {
+ WindowPtr inputFocus = inputInfo.keyboard->focus->win;
+
+ if (inputFocus == NoneWin)
+ return Success;
+
+ /* If the input focus is PointerRootWin, send the event to where
+ the pointer is if possible, then perhaps propogate up to root. */
+ if (inputFocus == PointerRootWin)
+ inputFocus = ROOT;
+
+ if (IsParent(inputFocus, sprite.win))
+ {
+ effectiveFocus = inputFocus;
+ pWin = sprite.win;
+ }
+ else
+ effectiveFocus = pWin = inputFocus;
+ }
+ else
+ pWin = SecurityLookupWindow(stuff->destination, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+ if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
+ {
+ client->errorValue = stuff->propagate;
+ return BadValue;
+ }
+ stuff->event.u.u.type |= 0x80;
+ if (stuff->propagate)
+ {
+#ifdef PANORAMIX
+ if (noPanoramiXExtension){
+#endif
+ for (;pWin; pWin = pWin->parent)
+ {
+ if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask,
+ NullGrab, 0))
+ return Success;
+ if (pWin == effectiveFocus)
+ return Success;
+ stuff->eventMask &= ~wDontPropagateMask(pWin);
+ if (!stuff->eventMask)
+ break;
+ }
+#ifdef PANORAMIX
+ }
+#endif
+ }
+ else
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+#endif
+ (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask,
+ NullGrab, 0);
+ return Success;
+}
+
+int
+ProcUngrabKey(client)
+ ClientPtr client;
+{
+ REQUEST(xUngrabKeyReq);
+ WindowPtr pWin;
+ GrabRec tempGrab;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+#ifdef PANORAMIX
+ int i;
+ Bool result, anyTrue;
+ Window GrabWinID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register GrabPtr grab;
+#endif
+
+ REQUEST_SIZE_MATCH(xUngrabKeyReq);
+ pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+
+ if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
+ (stuff->key < keybd->key->curKeySyms.minKeyCode))
+ && (stuff->key != AnyKey))
+ {
+ client->errorValue = stuff->key;
+ return BadValue;
+ }
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
+ }
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.device = keybd;
+ tempGrab.window = pWin;
+ tempGrab.modifiersDetail.exact = stuff->modifiers;
+ tempGrab.modifiersDetail.pMask = NULL;
+ tempGrab.modifierDevice = inputInfo.keyboard;
+ tempGrab.type = KeyPress;
+ tempGrab.detail.exact = stuff->key;
+ tempGrab.detail.pMask = NULL;
+
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ anyTrue = FALSE;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
+ GrabWinID = pPanoramiXWin ?
+ pPanoramiXWin->info[i].id : stuff->grabWindow;
+ pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
+ tempGrab.window = pWin;
+ result = DeletePassiveGrabFromList(&tempGrab);
+ if (result == TRUE)
+ anyTrue = result;
+ }
+ if (anyTrue)
+ return(Success);
+ else
+ return(BadAlloc);
+ }else {
+#endif
+ if (!DeletePassiveGrabFromList(&tempGrab))
+ return(BadAlloc);
+ return(Success);
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+int
+ProcGrabKey(client)
+ ClientPtr client;
+{
+ WindowPtr pWin;
+ REQUEST(xGrabKeyReq);
+ GrabPtr grab;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+#ifdef PANORAMIX
+ int i, result, anySuccess;
+ Window GrabWinID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST_SIZE_MATCH(xGrabKeyReq);
+ if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
+ {
+ client->errorValue = stuff->ownerEvents;
+ return(BadValue);
+ }
+ if ((stuff->pointerMode != GrabModeSync) &&
+ (stuff->pointerMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->pointerMode;
+ return BadValue;
+ }
+ if ((stuff->keyboardMode != GrabModeSync) &&
+ (stuff->keyboardMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->keyboardMode;
+ return BadValue;
+ }
+ if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
+ (stuff->key < keybd->key->curKeySyms.minKeyCode))
+ && (stuff->key != AnyKey))
+ {
+ client->errorValue = stuff->key;
+ return BadValue;
+ }
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
+ }
+ pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ anySuccess = BadAccess;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
+ GrabWinID = pPanoramiXWin ?
+ pPanoramiXWin->info[i].id : stuff->grabWindow;
+ pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
+ grab = CreateGrab(client->index, keybd, pWin,
+ (Mask)(KeyPressMask | KeyReleaseMask),
+ (Bool)stuff->ownerEvents,
+ (Bool)stuff->keyboardMode,
+ (Bool)stuff->pointerMode,
+ keybd, stuff->modifiers, KeyPress,
+ stuff->key, NullWindow, NullCursor);
+ if (!grab)
+ return BadAlloc;
+ result = AddPassiveGrabToList(grab);
+ if (result == Success)
+ anySuccess = result;
+ }
+ return (anySuccess);
+ }else {
+#endif
+ grab = CreateGrab(client->index, keybd, pWin,
+ (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
+ (Bool)stuff->keyboardMode, (Bool)stuff->pointerMode,
+ keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor);
+ if (!grab)
+ return BadAlloc;
+ return AddPassiveGrabToList(grab);
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+
+int
+ProcGrabButton(client)
+ ClientPtr client;
+{
+ WindowPtr pWin, confineTo;
+ REQUEST(xGrabButtonReq);
+ CursorPtr cursor;
+ GrabPtr grab;
+#ifdef PANORAMIX
+ int i, result, anySuccess;
+ Bool NotViewable, NotRealized;
+ Window GrabWinID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+#endif
+
+ REQUEST_SIZE_MATCH(xGrabButtonReq);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ) {
+ NotViewable = FALSE;
+ }
+#endif
+ if ((stuff->pointerMode != GrabModeSync) &&
+ (stuff->pointerMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->pointerMode;
+ return BadValue;
+ }
+ if ((stuff->keyboardMode != GrabModeSync) &&
+ (stuff->keyboardMode != GrabModeAsync))
+ {
+ client->errorValue = stuff->keyboardMode;
+ return BadValue;
+ }
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
+ }
+ if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue))
+ {
+ client->errorValue = stuff->ownerEvents;
+ return BadValue;
+ }
+ if (stuff->eventMask & ~PointerGrabMask)
+ {
+ client->errorValue = stuff->eventMask;
+ return BadValue;
+ }
+ pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension ){
+ if (stuff->confineTo == PanoramiXWinRoot->info[0].id)
+ stuff->confineTo = None;
+ }
+#endif
+ if (stuff->confineTo == None)
+ confineTo = NullWindow;
+#ifdef PANORAMIX
+ else if ( !noPanoramiXExtension ) {
+ if (stuff->confineTo) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->confineTo);
+ if (pPanoramiXWin) {
+ for ( i = PanoramiXNumScreens - 1; i >=0 ; i--) {
+ stuff->confineTo = pPanoramiXWin->info[i].id;
+ confineTo = SecurityLookupWindow(stuff->confineTo, client,
+ SecurityReadAccess);
+ if (!confineTo)
+ return BadWindow;
+ /* find where confined windows top-left corner lies
+ and based on its coordinates choose the window
+ which is truly seen. Then check realized/empty
+ and pass this window to activate grab. */
+ if ((confineTo->drawable.x >= 0) &&
+ (confineTo->drawable.x <= panoramiXdataPtr[i].x))
+ break;
+ }
+ } else
+ confineTo = SecurityLookupWindow(stuff->confineTo, client,
+ SecurityReadAccess);
+ if (!confineTo)
+ return BadWindow;
+ }
+ } else {
+#else
+ else {
+#endif
+ confineTo = SecurityLookupWindow(stuff->confineTo, client,
+ SecurityReadAccess);
+ if (!confineTo)
+ return BadWindow;
+ }
+ if (stuff->cursor == None)
+ cursor = NullCursor;
+ else
+ {
+ cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
+ RT_CURSOR, SecurityReadAccess);
+ if (!cursor)
+ {
+ client->errorValue = stuff->cursor;
+ return BadCursor;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ anySuccess = BadAccess;
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
+ GrabWinID = pPanoramiXWin ?
+ pPanoramiXWin->info[i].id : stuff->grabWindow;
+ pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
+ grab = CreateGrab(client->index, inputInfo.pointer, pWin,
+ permitOldBugs ? (Mask)(stuff->eventMask |
+ ButtonPressMask | ButtonReleaseMask) :
+ (Mask)stuff->eventMask,
+ (Bool)stuff->ownerEvents,
+ (Bool) stuff->keyboardMode,
+ (Bool)stuff->pointerMode,
+ inputInfo.keyboard, stuff->modifiers,
+ ButtonPress, stuff->button, confineTo, cursor);
+ if (!grab)
+ return BadAlloc;
+ result = AddPassiveGrabToList(grab);
+ if (result == Success)
+ anySuccess = result;
+ }
+ return (anySuccess);
+ }else {
+#endif
+ grab = CreateGrab(client->index, inputInfo.pointer, pWin,
+ permitOldBugs ? (Mask)(stuff->eventMask |
+ ButtonPressMask | ButtonReleaseMask) :
+ (Mask)stuff->eventMask,
+ (Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode,
+ (Bool)stuff->pointerMode, inputInfo.keyboard, stuff->modifiers,
+ ButtonPress, stuff->button, confineTo, cursor);
+ if (!grab)
+ return BadAlloc;
+ return AddPassiveGrabToList(grab);
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+int
+ProcUngrabButton(client)
+ ClientPtr client;
+{
+ REQUEST(xUngrabButtonReq);
+ WindowPtr pWin;
+ GrabRec tempGrab;
+#ifdef PANORAMIX
+ int i;
+ Bool result, anyTrue;
+ Window GrabWinID;
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ register GrabPtr grab;
+#endif
+
+ REQUEST_SIZE_MATCH(xUngrabButtonReq);
+ if ((stuff->modifiers != AnyModifier) &&
+ (stuff->modifiers & ~AllModifiersMask))
+ {
+ client->errorValue = stuff->modifiers;
+ return BadValue;
+ }
+ pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+ tempGrab.resource = client->clientAsMask;
+ tempGrab.device = inputInfo.pointer;
+ tempGrab.window = pWin;
+ tempGrab.modifiersDetail.exact = stuff->modifiers;
+ tempGrab.modifiersDetail.pMask = NULL;
+ tempGrab.modifierDevice = inputInfo.keyboard;
+ tempGrab.type = ButtonPress;
+ tempGrab.detail.exact = stuff->button;
+ tempGrab.detail.pMask = NULL;
+
+#ifdef PANORAMIX
+ anyTrue = FALSE;
+ if ( !noPanoramiXExtension ){
+ PANORAMIXFIND_ID(pPanoramiXWin, stuff->grabWindow);
+ FOR_NSCREENS_OR_ONCE(pPanoramiXWin, i) {
+ GrabWinID = pPanoramiXWin ?
+ pPanoramiXWin->info[i].id : stuff->grabWindow;
+ pWin = SecurityLookupWindow(GrabWinID, client, SecurityReadAccess);
+ tempGrab.window = pWin;
+ result = DeletePassiveGrabFromList(&tempGrab);
+ if (result == TRUE)
+ anyTrue = result;
+ }
+ if (anyTrue)
+ return (Success);
+ else
+ return (BadAlloc);
+ }else {
+#endif
+ if (!DeletePassiveGrabFromList(&tempGrab))
+ return(BadAlloc);
+ return(Success);
+#ifdef PANORAMIX
+ }
+#endif
+}
+
+void
+DeleteWindowFromAnyEvents(pWin, freeResources)
+ WindowPtr pWin;
+ Bool freeResources;
+{
+ WindowPtr parent;
+ DeviceIntPtr mouse = inputInfo.pointer;
+ DeviceIntPtr keybd = inputInfo.keyboard;
+ FocusClassPtr focus = keybd->focus;
+ OtherClientsPtr oc;
+ GrabPtr passive;
+
+
+ /* Deactivate any grabs performed on this window, before making any
+ input focus changes. */
+
+ if (mouse->grab &&
+ ((mouse->grab->window == pWin) || (mouse->grab->confineTo == pWin)))
+ (*mouse->DeactivateGrab)(mouse);
+
+ /* Deactivating a keyboard grab should cause focus events. */
+
+ if (keybd->grab && (keybd->grab->window == pWin))
+ (*keybd->DeactivateGrab)(keybd);
+
+ /* If the focus window is a root window (ie. has no parent) then don't
+ delete the focus from it. */
+
+ if ((pWin == focus->win) && (pWin->parent != NullWindow))
+ {
+ int focusEventMode = NotifyNormal;
+
+ /* If a grab is in progress, then alter the mode of focus events. */
+
+ if (keybd->grab)
+ focusEventMode = NotifyWhileGrabbed;
+
+ switch (focus->revert)
+ {
+ case RevertToNone:
+ DoFocusEvents(keybd, pWin, NoneWin, focusEventMode);
+ focus->win = NoneWin;
+ focus->traceGood = 0;
+ break;
+ case RevertToParent:
+ parent = pWin;
+ do
+ {
+ parent = parent->parent;
+ focus->traceGood--;
+ } while (!parent->realized
+/* This would be a good protocol change -- windows being reparented
+ during SaveSet processing would cause the focus to revert to the
+ nearest enclosing window which will survive the death of the exiting
+ client, instead of ending up reverting to a dying window and thence
+ to None
+ */
+#ifdef NOTDEF
+ || clients[CLIENT_ID(parent->drawable.id)]->clientGone
+#endif
+ );
+ DoFocusEvents(keybd, pWin, parent, focusEventMode);
+ focus->win = parent;
+ focus->revert = RevertToNone;
+ break;
+ case RevertToPointerRoot:
+ DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode);
+ focus->win = PointerRootWin;
+ focus->traceGood = 0;
+ break;
+ }
+ }
+
+ if (mouse->valuator->motionHintWindow == pWin)
+ mouse->valuator->motionHintWindow = NullWindow;
+
+ if (freeResources)
+ {
+ if (pWin->dontPropagate)
+ DontPropagateRefCnts[pWin->dontPropagate]--;
+ while ( (oc = wOtherClients(pWin)) )
+ FreeResource(oc->resource, RT_NONE);
+ while ( (passive = wPassiveGrabs(pWin)) )
+ FreeResource(passive->resource, RT_NONE);
+ }
+#ifdef XINPUT
+ DeleteWindowFromAnyExtEvents(pWin, freeResources);
+#endif
+}
+
+/* Call this whenever some window at or below pWin has changed geometry */
+
+/*ARGSUSED*/
+void
+CheckCursorConfinement(pWin)
+ WindowPtr pWin;
+{
+ GrabPtr grab = inputInfo.pointer->grab;
+ WindowPtr confineTo;
+
+ if (grab && (confineTo = grab->confineTo))
+ {
+ if (!REGION_NOTEMPTY( confineTo->drawable.pScreen,
+ &confineTo->borderSize))
+ (*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer);
+ else if ((pWin == confineTo) || IsParent(pWin, confineTo))
+ ConfineCursorToWindow(confineTo, TRUE, TRUE);
+ }
+}
+
+Mask
+EventMaskForClient(pWin, client)
+ WindowPtr pWin;
+ ClientPtr client;
+{
+ register OtherClientsPtr other;
+
+ if (wClient (pWin) == client)
+ return pWin->eventMask;
+ for (other = wOtherClients(pWin); other; other = other->next)
+ {
+ if (SameClient(other, client))
+ return other->mask;
+ }
+ return 0;
+}
+
+int
+ProcRecolorCursor(client)
+ ClientPtr client;
+{
+ CursorPtr pCursor;
+ int nscr;
+ ScreenPtr pscr;
+ REQUEST(xRecolorCursorReq);
+
+ REQUEST_SIZE_MATCH(xRecolorCursorReq);
+ pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
+ RT_CURSOR, SecurityWriteAccess);
+ if ( !pCursor)
+ {
+ client->errorValue = stuff->cursor;
+ return (BadCursor);
+ }
+
+ pCursor->foreRed = stuff->foreRed;
+ pCursor->foreGreen = stuff->foreGreen;
+ pCursor->foreBlue = stuff->foreBlue;
+
+ pCursor->backRed = stuff->backRed;
+ pCursor->backGreen = stuff->backGreen;
+ pCursor->backBlue = stuff->backBlue;
+
+ for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
+ {
+ pscr = screenInfo.screens[nscr];
+ ( *pscr->RecolorCursor)(pscr, pCursor,
+ (pCursor == sprite.current) &&
+ (pscr == sprite.hotPhys.pScreen));
+ }
+ return (Success);
+}
+
+void
+WriteEventsToClient(pClient, count, events)
+ ClientPtr pClient;
+ int count;
+ xEvent *events;
+{
+ xEvent eventTo, *eventFrom;
+ int i;
+#ifdef PANORAMIX
+ PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ int x_off = 0, y_off = 0;
+ int j,NewId,OrigId;
+#endif
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ switch (events->u.u.type) {
+ case ButtonPress : case ButtonRelease :
+ case MotionNotify : case KeyPress :
+ FORCE_ROOT(events->u.keyButtonPointer, j);
+ events->u.keyButtonPointer.sameScreen = xTrue;
+ for (i = 0; i < count; i++) {
+ FORCE_WIN(events[i].u.keyButtonPointer.event, j);
+ if (events[i].u.keyButtonPointer.child) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events[i].u.keyButtonPointer.child, j);
+ }
+ }
+ break;
+ case EnterNotify : case LeaveNotify :
+ FORCE_ROOT(events->u.enterLeave, j);
+ for (i = 0; i < count; i++) {
+ FORCE_WIN(events[i].u.enterLeave.event, j);
+ if (events[i].u.enterLeave.child) {
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events[i].u.enterLeave.child, j);
+ }
+ }
+ break;
+ case Expose :
+ /* Need to do this count time, ensure no fake
+ window ideas are send to client */
+ for (i = 0; i < count; i++)
+ FORCE_WIN(events[i].u.expose.window, j);
+ break;
+ case FocusOut :
+ FORCE_WIN(events->u.focus.window, j);
+ break;
+ case FocusIn :
+ FORCE_WIN(events->u.focus.window, j);
+ break;
+ case VisibilityNotify :
+ FORCE_WIN(events->u.visibility.window, j);
+ break;
+ case GraphicsExpose :
+ FORCE_WIN(events->u.graphicsExposure.drawable, j);
+ break;
+ case NoExpose :
+ SKIP_FAKE_WINDOW(events->u.noExposure.drawable, j);
+ break;
+ case CreateNotify :
+ FORCE_WIN(events->u.createNotify.parent, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.createNotify.window, j);
+ break;
+ case ColormapNotify :
+ FORCE_WIN(events->u.colormap.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.colormap.colormap, j);
+ break;
+ case MapNotify :
+ SKIP_FAKE_WINDOW(events->u.mapNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.mapNotify.window, j);
+ break;
+ case UnmapNotify :
+ SKIP_FAKE_WINDOW(events->u.unmapNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.unmapNotify.window, j);
+ break;
+ case DestroyNotify :
+ SKIP_FAKE_WINDOW(events->u.destroyNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.destroyNotify.window, j);
+ break;
+ case GravityNotify :
+ FORCE_WIN(events->u.gravity.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.gravity.window, j);
+ break;
+ case MapRequest :
+ SKIP_FAKE_WINDOW(events->u.mapRequest.parent, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.mapRequest.window, j);
+ break;
+ case ConfigureNotify :
+ FORCE_WIN(events->u.configureNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.configureNotify.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.configureNotify.aboveSibling, j);
+ break;
+ case ConfigureRequest :
+ SKIP_FAKE_WINDOW(events->u.configureRequest.parent, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.configureRequest.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.configureRequest.sibling, j);
+ break;
+ case ResizeRequest :
+ FORCE_WIN(events->u.resizeRequest.window, j);
+ break;
+ case CirculateNotify : case CirculateRequest :
+ case ReparentNotify :
+ FORCE_WIN(events->u.circulate.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.circulate.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.circulate.parent, j);
+ break;
+ case PropertyNotify :
+ SKIP_FAKE_WINDOW(events->u.property.window, j);
+ break;
+ case ClientMessage :
+ SKIP_FAKE_WINDOW(events->u.clientMessage.window, j);
+ break;
+ default :
+ switch (events->u.u.type & ~0x80) {
+ case VisibilityNotify :
+ FORCE_WIN(events->u.visibility.window, j);
+ break;
+ case MapNotify :
+ SKIP_FAKE_WINDOW(events->u.mapNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.mapNotify.window, j);
+ break;
+ case UnmapNotify :
+ SKIP_FAKE_WINDOW(events->u.unmapNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.unmapNotify.window, j);
+ case MapRequest :
+ SKIP_FAKE_WINDOW(events->u.mapRequest.parent, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.mapRequest.window, j);
+ break;
+ case ConfigureNotify :
+ FORCE_WIN(events->u.configureNotify.event, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.configureNotify.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ FORCE_WIN(events->u.configureNotify.aboveSibling, j);
+ break;
+ case ConfigureRequest :
+ SKIP_FAKE_WINDOW(events->u.configureRequest.parent, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.configureRequest.window, j);
+ pPanoramiXWin = PanoramiXWinRoot;
+ SKIP_FAKE_WINDOW(events->u.configureRequest.sibling, j);
+ break;
+ default :
+ break;
+ } /* default case */
+ break;
+ } /* case */
+ }
+#endif
+
+#ifdef XKB
+ if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events)))
+ return;
+#endif
+
+ if (EventCallback)
+ {
+ EventInfoRec eventinfo;
+ eventinfo.client = pClient;
+ eventinfo.events = events;
+ eventinfo.count = count;
+ CallCallbacks(&EventCallback, (pointer)&eventinfo);
+ }
+ if(pClient->swapped)
+ {
+ for(i = 0; i < count; i++)
+ {
+ eventFrom = &events[i];
+ /* Remember to strip off the leading bit of type in case
+ this event was sent with "SendEvent." */
+ (*EventSwapVector[eventFrom->u.u.type & 0177])
+ (eventFrom, &eventTo);
+ (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo);
+ }
+ }
+ else
+ {
+ (void)WriteToClient(pClient, count * sizeof(xEvent), (char *) events);
+ }
+}
diff --git a/xc/programs/Xserver/dix/extension.c b/xc/programs/Xserver/dix/extension.c
new file mode 100644
index 000000000..89d0dfcbf
--- /dev/null
+++ b/xc/programs/Xserver/dix/extension.c
@@ -0,0 +1,468 @@
+/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.7 1999/01/13 08:30:53 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: extension.c /main/37 1998/02/09 14:19:21 kaleb $ */
+
+#include "X.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "dispatch.h"
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+#define EXTENSION_BASE 128
+#define EXTENSION_EVENT_BASE 64
+#define LAST_EVENT 128
+#define LAST_ERROR 255
+
+ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS];
+
+static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
+
+int lastEvent = EXTENSION_EVENT_BASE;
+static int lastError = FirstExtensionError;
+static unsigned int NumExtensions = 0;
+
+ExtensionEntry *AddExtension(name, NumEvents, NumErrors, MainProc,
+ SwappedMainProc, CloseDownProc, MinorOpcodeProc)
+ char *name;
+ int NumEvents;
+ int NumErrors;
+ int (* MainProc)();
+ int (* SwappedMainProc)();
+ void (* CloseDownProc)();
+ unsigned short (* MinorOpcodeProc)();
+{
+ int i;
+ register ExtensionEntry *ext, **newexts;
+
+ if (!MainProc || !SwappedMainProc || !CloseDownProc || !MinorOpcodeProc)
+ return((ExtensionEntry *) NULL);
+ if ((lastEvent + NumEvents > LAST_EVENT) ||
+ (unsigned)(lastError + NumErrors > LAST_ERROR))
+ return((ExtensionEntry *) NULL);
+
+ ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry));
+ if (!ext)
+ return((ExtensionEntry *) NULL);
+ ext->name = (char *)xalloc(strlen(name) + 1);
+ ext->num_aliases = 0;
+ ext->aliases = (char **)NULL;
+ if (!ext->name)
+ {
+ xfree(ext);
+ return((ExtensionEntry *) NULL);
+ }
+ strcpy(ext->name, name);
+ i = NumExtensions;
+ newexts = (ExtensionEntry **) xrealloc(extensions,
+ (i + 1) * sizeof(ExtensionEntry *));
+ if (!newexts)
+ {
+ xfree(ext->name);
+ xfree(ext);
+ return((ExtensionEntry *) NULL);
+ }
+ NumExtensions++;
+ extensions = newexts;
+ extensions[i] = ext;
+ ext->index = i;
+ ext->base = i + EXTENSION_BASE;
+ ext->CloseDown = CloseDownProc;
+ ext->MinorOpcode = MinorOpcodeProc;
+ ProcVector[i + EXTENSION_BASE] = MainProc;
+ SwappedProcVector[i + EXTENSION_BASE] = SwappedMainProc;
+ if (NumEvents)
+ {
+ ext->eventBase = lastEvent;
+ ext->eventLast = lastEvent + NumEvents;
+ lastEvent += NumEvents;
+ }
+ else
+ {
+ ext->eventBase = 0;
+ ext->eventLast = 0;
+ }
+ if (NumErrors)
+ {
+ ext->errorBase = lastError;
+ ext->errorLast = lastError + NumErrors;
+ lastError += NumErrors;
+ }
+ else
+ {
+ ext->errorBase = 0;
+ ext->errorLast = 0;
+ }
+#ifdef XCSECURITY
+ ext->secure = FALSE;
+#endif
+
+#ifdef LBX
+ (void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase);
+#endif
+ return(ext);
+}
+
+Bool AddExtensionAlias(alias, ext)
+ char *alias;
+ ExtensionEntry *ext;
+{
+ char *name;
+ char **aliases;
+
+ aliases = (char **)xrealloc(ext->aliases,
+ (ext->num_aliases + 1) * sizeof(char *));
+ if (!aliases)
+ return FALSE;
+ ext->aliases = aliases;
+ name = (char *)xalloc(strlen(alias) + 1);
+ if (!name)
+ return FALSE;
+ strcpy(name, alias);
+ ext->aliases[ext->num_aliases] = name;
+ ext->num_aliases++;
+#ifdef LBX
+ return LbxAddExtensionAlias(ext->index, alias);
+#else
+ return TRUE;
+#endif
+}
+
+static int
+FindExtension(extname, len)
+ char *extname;
+ int len;
+{
+ int i, j;
+
+ for (i=0; i<NumExtensions; i++)
+ {
+ if ((strlen(extensions[i]->name) == len) &&
+ !strncmp(extname, extensions[i]->name, len))
+ break;
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ {
+ if ((strlen(extensions[i]->aliases[j]) == len) &&
+ !strncmp(extname, extensions[i]->aliases[j], len))
+ break;
+ }
+ if (j >= 0) break;
+ }
+ return ((i == NumExtensions) ? -1 : i);
+}
+
+void
+DeclareExtensionSecurity(extname, secure)
+ char *extname;
+ Bool secure;
+{
+#ifdef XCSECURITY
+ int i = FindExtension(extname, strlen(extname));
+ if (i >= 0)
+ {
+ int majorop = extensions[i]->base;
+ extensions[i]->secure = secure;
+ if (secure)
+ {
+ UntrustedProcVector[majorop] = ProcVector[majorop];
+ SwappedUntrustedProcVector[majorop] = SwappedProcVector[majorop];
+ }
+ else
+ {
+ UntrustedProcVector[majorop] = ProcBadRequest;
+ SwappedUntrustedProcVector[majorop] = ProcBadRequest;
+ }
+ }
+#endif
+#ifdef LBX
+ LbxDeclareExtensionSecurity(extname, secure);
+#endif
+}
+
+unsigned short
+StandardMinorOpcode(client)
+ ClientPtr client;
+{
+ return ((xReq *)client->requestBuffer)->data;
+}
+
+unsigned short
+MinorOpcodeOfRequest(client)
+ ClientPtr client;
+{
+ unsigned char major;
+
+ major = ((xReq *)client->requestBuffer)->reqType;
+ if (major < EXTENSION_BASE)
+ return 0;
+ major -= EXTENSION_BASE;
+ if (major >= NumExtensions)
+ return 0;
+ return (*extensions[major]->MinorOpcode)(client);
+}
+
+void
+CloseDownExtensions()
+{
+ register int i,j;
+
+#ifdef LBX
+ LbxCloseDownExtensions();
+#endif
+
+ for (i = NumExtensions - 1; i >= 0; i--)
+ {
+ (* extensions[i]->CloseDown)(extensions[i]);
+ NumExtensions = i;
+ xfree(extensions[i]->name);
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ xfree(extensions[i]->aliases[j]);
+ xfree(extensions[i]->aliases);
+ xfree(extensions[i]);
+ }
+ xfree(extensions);
+ extensions = (ExtensionEntry **)NULL;
+ lastEvent = EXTENSION_EVENT_BASE;
+ lastError = FirstExtensionError;
+ for (i=0; i<MAXSCREENS; i++)
+ {
+ register ScreenProcEntry *spentry = &AuxillaryScreenProcs[i];
+
+ while (spentry->num)
+ {
+ spentry->num--;
+ xfree(spentry->procList[spentry->num].name);
+ }
+ xfree(spentry->procList);
+ spentry->procList = (ProcEntryPtr)NULL;
+ }
+}
+
+
+int
+ProcQueryExtension(client)
+ ClientPtr client;
+{
+ xQueryExtensionReply reply;
+ int i;
+ REQUEST(xQueryExtensionReq);
+
+ REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
+
+ reply.type = X_Reply;
+ reply.length = 0;
+ reply.major_opcode = 0;
+ reply.sequenceNumber = client->sequence;
+
+ if ( ! NumExtensions )
+ reply.present = xFalse;
+ else
+ {
+ i = FindExtension((char *)&stuff[1], stuff->nbytes);
+ if (i < 0
+#ifdef XCSECURITY
+ /* don't show insecure extensions to untrusted clients */
+ || (client->trustLevel == XSecurityClientUntrusted &&
+ !extensions[i]->secure)
+#endif
+ )
+ reply.present = xFalse;
+ else
+ {
+ reply.present = xTrue;
+ reply.major_opcode = extensions[i]->base;
+ reply.first_event = extensions[i]->eventBase;
+ reply.first_error = extensions[i]->errorBase;
+ }
+ }
+ WriteReplyToClient(client, sizeof(xQueryExtensionReply), &reply);
+ return(client->noClientException);
+}
+
+int
+ProcListExtensions(client)
+ ClientPtr client;
+{
+ xListExtensionsReply reply;
+ char *bufptr, *buffer;
+ int total_length = 0;
+
+ REQUEST_SIZE_MATCH(xReq);
+
+ reply.type = X_Reply;
+ reply.nExtensions = 0;
+ reply.length = 0;
+ reply.sequenceNumber = client->sequence;
+ buffer = NULL;
+
+ if ( NumExtensions )
+ {
+ register int i, j;
+
+ for (i=0; i<NumExtensions; i++)
+ {
+#ifdef XCSECURITY
+ /* don't show insecure extensions to untrusted clients */
+ if (client->trustLevel == XSecurityClientUntrusted &&
+ !extensions[i]->secure)
+ continue;
+#endif
+ total_length += strlen(extensions[i]->name) + 1;
+ reply.nExtensions += 1 + extensions[i]->num_aliases;
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ total_length += strlen(extensions[i]->aliases[j]) + 1;
+ }
+ reply.length = (total_length + 3) >> 2;
+ buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length);
+ if (!buffer)
+ return(BadAlloc);
+ for (i=0; i<NumExtensions; i++)
+ {
+ int len;
+#ifdef XCSECURITY
+ if (client->trustLevel == XSecurityClientUntrusted &&
+ !extensions[i]->secure)
+ continue;
+#endif
+ *bufptr++ = len = strlen(extensions[i]->name);
+ memmove(bufptr, extensions[i]->name, len);
+ bufptr += len;
+ for (j = extensions[i]->num_aliases; --j >= 0;)
+ {
+ *bufptr++ = len = strlen(extensions[i]->aliases[j]);
+ memmove(bufptr, extensions[i]->aliases[j], len);
+ bufptr += len;
+ }
+ }
+ }
+ WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply);
+ if (reply.length)
+ {
+ WriteToClient(client, total_length, buffer);
+ DEALLOCATE_LOCAL(buffer);
+ }
+ return(client->noClientException);
+}
+
+
+ExtensionLookupProc
+LookupProc(name, pGC)
+ char *name;
+ GCPtr pGC;
+{
+ register int i;
+ register ScreenProcEntry *spentry;
+ spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum];
+ if (spentry->num)
+ {
+ for (i = 0; i < spentry->num; i++)
+ if (strcmp(name, spentry->procList[i].name) == 0)
+ return(spentry->procList[i].proc);
+ }
+ return (ExtensionLookupProc)NULL;
+}
+
+Bool
+RegisterProc(name, pGC, proc)
+ char *name;
+ GC *pGC;
+ ExtensionLookupProc proc;
+{
+ return RegisterScreenProc(name, pGC->pScreen, proc);
+}
+
+Bool
+RegisterScreenProc(name, pScreen, proc)
+ char *name;
+ ScreenPtr pScreen;
+ ExtensionLookupProc proc;
+{
+ register ScreenProcEntry *spentry;
+ register ProcEntryPtr procEntry = (ProcEntryPtr)NULL;
+ char *newname;
+ int i;
+
+ spentry = &AuxillaryScreenProcs[pScreen->myNum];
+ /* first replace duplicates */
+ if (spentry->num)
+ {
+ for (i = 0; i < spentry->num; i++)
+ if (strcmp(name, spentry->procList[i].name) == 0)
+ {
+ procEntry = &spentry->procList[i];
+ break;
+ }
+ }
+ if (procEntry)
+ procEntry->proc = proc;
+ else
+ {
+ newname = (char *)xalloc(strlen(name)+1);
+ if (!newname)
+ return FALSE;
+ procEntry = (ProcEntryPtr)
+ xrealloc(spentry->procList,
+ sizeof(ProcEntryRec) * (spentry->num+1));
+ if (!procEntry)
+ {
+ xfree(newname);
+ return FALSE;
+ }
+ spentry->procList = procEntry;
+ procEntry += spentry->num;
+ procEntry->name = newname;
+ strcpy(newname, name);
+ procEntry->proc = proc;
+ spentry->num++;
+ }
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/dix/ffs.c b/xc/programs/Xserver/dix/ffs.c
new file mode 100644
index 000000000..cb4f38df5
--- /dev/null
+++ b/xc/programs/Xserver/dix/ffs.c
@@ -0,0 +1,33 @@
+/* $TOG: ffs.c /main/2 1998/02/09 14:19:26 kaleb $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+int
+ffs(int i)
+{
+ int j;
+ for (j = 1; (i & 1) == 0; j++)
+ i >>= 1;
+ return j;
+}
diff --git a/xc/programs/Xserver/dix/gc.c b/xc/programs/Xserver/dix/gc.c
new file mode 100644
index 000000000..c3a8bc398
--- /dev/null
+++ b/xc/programs/Xserver/dix/gc.c
@@ -0,0 +1,1330 @@
+/* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.5 1998/10/04 09:38:08 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: gc.c /main/71 1998/02/09 14:19:32 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "misc.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "dix.h"
+#include <assert.h>
+
+extern XID clientErrorValue;
+extern FontPtr defaultFont;
+
+static Bool CreateDefaultTile(
+#if NeedFunctionPrototypes
+ GCPtr /*pGC*/
+#endif
+);
+
+unsigned char DefaultDash[2] = {4, 4};
+
+void
+ValidateGC(pDraw, pGC)
+ DrawablePtr pDraw;
+ GC *pGC;
+{
+ (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw);
+ pGC->stateChanges = 0;
+ pGC->serialNumber = pDraw->serialNumber;
+}
+
+
+/* dixChangeGC(client, pGC, mask, pC32, pUnion)
+ *
+ * This function was created as part of the Security extension
+ * implementation. The client performing the gc change must be passed so
+ * that access checks can be performed on any tiles, stipples, or fonts
+ * that are specified. ddxen can call this too; they should normally
+ * pass NullClient for the client since any access checking should have
+ * already been done at a higher level.
+ *
+ * Since we had to create a new function anyway, we decided to change the
+ * way the list of gc values is passed to eliminate the compiler warnings
+ * caused by the DoChangeGC interface. You can pass the values via pC32
+ * or pUnion, but not both; one of them must be NULL. If you don't need
+ * to pass any pointers, you can use either one:
+ *
+ * /* example calling dixChangeGC using pC32 parameter
+ * CARD32 v[2];
+ * v[0] = foreground;
+ * v[1] = background;
+ * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL);
+ *
+ * /* example calling dixChangeGC using pUnion parameter;
+ * /* same effect as above
+ * ChangeGCVal v[2];
+ * v[0].val = foreground;
+ * v[1].val = background;
+ * dixChangeGC(client, pGC, GCForeground|GCBackground, NULL, v);
+ *
+ * However, if you need to pass a pointer to a pixmap or font, you MUST
+ * use the pUnion parameter.
+ *
+ * /* example calling dixChangeGC passing pointers in the value list
+ * ChangeGCVal v[2];
+ * v[0].val = FillTiled;
+ * v[1].ptr = pPixmap; /* pointer to a pixmap
+ * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v);
+ *
+ * Note: we could have gotten by with just the pUnion parameter, but on
+ * 64 bit machines that would have forced us to copy the value list that
+ * comes in the ChangeGC request.
+ *
+ * Ideally, we'd change all the DoChangeGC calls to dixChangeGC, but this
+ * is far too many changes to consider at this time, so we've only
+ * changed the ones that caused compiler warnings. New code should use
+ * dixChangeGC.
+ *
+ * dpw
+ */
+
+#define NEXTVAL(_type, _var) { \
+ if (pC32) _var = (_type)*pC32++; \
+ else { \
+ _var = (_type)(pUnion->val); pUnion++; \
+ } \
+ }
+
+#define NEXT_PTR(_type, _var) { \
+ assert(pUnion); _var = (_type)pUnion->ptr; pUnion++; }
+
+int
+dixChangeGC(client, pGC, mask, pC32, pUnion)
+ ClientPtr client;
+ register GC *pGC;
+ register BITS32 mask;
+ CARD32 *pC32;
+ ChangeGCValPtr pUnion;
+{
+ register BITS32 index2;
+ register int error = 0;
+ PixmapPtr pPixmap;
+ BITS32 maskQ;
+
+ assert( (pC32 && !pUnion) || (!pC32 && pUnion) );
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+
+ maskQ = mask; /* save these for when we walk the GCque */
+ while (mask && !error)
+ {
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ pGC->stateChanges |= index2;
+ switch (index2)
+ {
+ case GCFunction:
+ {
+ CARD8 newalu;
+ NEXTVAL(CARD8, newalu);
+ if (newalu <= GXset)
+ pGC->alu = newalu;
+ else
+ {
+ clientErrorValue = newalu;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCPlaneMask:
+ NEXTVAL(unsigned long, pGC->planemask);
+ break;
+ case GCForeground:
+ NEXTVAL(unsigned long, pGC->fgPixel);
+ /*
+ * this is for CreateGC
+ */
+ if (!pGC->tileIsPixel && !pGC->tile.pixmap)
+ {
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = pGC->fgPixel;
+ }
+ break;
+ case GCBackground:
+ NEXTVAL(unsigned long, pGC->bgPixel);
+ break;
+ case GCLineWidth: /* ??? line width is a CARD16 */
+ NEXTVAL(CARD16, pGC->lineWidth);
+ break;
+ case GCLineStyle:
+ {
+ unsigned int newlinestyle;
+ NEXTVAL(unsigned int, newlinestyle);
+ if (newlinestyle <= LineDoubleDash)
+ pGC->lineStyle = newlinestyle;
+ else
+ {
+ clientErrorValue = newlinestyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCCapStyle:
+ {
+ unsigned int newcapstyle;
+ NEXTVAL(unsigned int, newcapstyle);
+ if (newcapstyle <= CapProjecting)
+ pGC->capStyle = newcapstyle;
+ else
+ {
+ clientErrorValue = newcapstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCJoinStyle:
+ {
+ unsigned int newjoinstyle;
+ NEXTVAL(unsigned int, newjoinstyle);
+ if (newjoinstyle <= JoinBevel)
+ pGC->joinStyle = newjoinstyle;
+ else
+ {
+ clientErrorValue = newjoinstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCFillStyle:
+ {
+ unsigned int newfillstyle;
+ NEXTVAL(unsigned int, newfillstyle);
+ if (newfillstyle <= FillOpaqueStippled)
+ pGC->fillStyle = newfillstyle;
+ else
+ {
+ clientErrorValue = newfillstyle;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCFillRule:
+ {
+ unsigned int newfillrule;
+ NEXTVAL(unsigned int, newfillrule);
+ if (newfillrule <= WindingRule)
+ pGC->fillRule = newfillrule;
+ else
+ {
+ clientErrorValue = newfillrule;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCTile:
+ {
+ XID newpix = 0;
+ if (pUnion)
+ {
+ NEXT_PTR(PixmapPtr, pPixmap);
+ }
+ else
+ {
+ NEXTVAL(XID, newpix);
+ pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
+ newpix, RT_PIXMAP, SecurityReadAccess);
+ }
+ if (pPixmap)
+ {
+ if ((pPixmap->drawable.depth != pGC->depth) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen))
+ {
+ error = BadMatch;
+ }
+ else
+ {
+ pPixmap->refcnt++;
+ if (!pGC->tileIsPixel)
+ (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
+ pGC->tileIsPixel = FALSE;
+ pGC->tile.pixmap = pPixmap;
+ }
+ }
+ else
+ {
+ clientErrorValue = newpix;
+ error = BadPixmap;
+ }
+ break;
+ }
+ case GCStipple:
+ {
+ XID newstipple = 0;
+ if (pUnion)
+ {
+ NEXT_PTR(PixmapPtr, pPixmap);
+ }
+ else
+ {
+ NEXTVAL(XID, newstipple)
+ pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
+ newstipple, RT_PIXMAP, SecurityReadAccess);
+ }
+ if (pPixmap)
+ {
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen))
+ {
+ error = BadMatch;
+ }
+ else
+ {
+ pPixmap->refcnt++;
+ if (pGC->stipple)
+ (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
+ pGC->stipple = pPixmap;
+ }
+ }
+ else
+ {
+ clientErrorValue = newstipple;
+ error = BadPixmap;
+ }
+ break;
+ }
+ case GCTileStipXOrigin:
+ NEXTVAL(INT16, pGC->patOrg.x);
+ break;
+ case GCTileStipYOrigin:
+ NEXTVAL(INT16, pGC->patOrg.y);
+ break;
+ case GCFont:
+ {
+ FontPtr pFont;
+ XID newfont = 0;
+ if (pUnion)
+ {
+ NEXT_PTR(FontPtr, pFont);
+ }
+ else
+ {
+ NEXTVAL(XID, newfont)
+ pFont = (FontPtr)SecurityLookupIDByType(client, newfont,
+ RT_FONT, SecurityReadAccess);
+ }
+ if (pFont)
+ {
+ pFont->refcnt++;
+ if (pGC->font)
+ CloseFont(pGC->font, (Font)0);
+ pGC->font = pFont;
+ }
+ else
+ {
+ clientErrorValue = newfont;
+ error = BadFont;
+ }
+ break;
+ }
+ case GCSubwindowMode:
+ {
+ unsigned int newclipmode;
+ NEXTVAL(unsigned int, newclipmode);
+ if (newclipmode <= IncludeInferiors)
+ pGC->subWindowMode = newclipmode;
+ else
+ {
+ clientErrorValue = newclipmode;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCGraphicsExposures:
+ {
+ unsigned int newge;
+ NEXTVAL(unsigned int, newge);
+ if (newge <= xTrue)
+ pGC->graphicsExposures = newge;
+ else
+ {
+ clientErrorValue = newge;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCClipXOrigin:
+ NEXTVAL(INT16, pGC->clipOrg.x);
+ break;
+ case GCClipYOrigin:
+ NEXTVAL(INT16, pGC->clipOrg.y);
+ break;
+ case GCClipMask:
+ {
+ Pixmap pid;
+ int clipType;
+
+ if (pUnion)
+ {
+ NEXT_PTR(PixmapPtr, pPixmap);
+ }
+ else
+ {
+ NEXTVAL(Pixmap, pid)
+ if (pid == None)
+ {
+ clipType = CT_NONE;
+ pPixmap = NullPixmap;
+ }
+ else
+ pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
+ pid, RT_PIXMAP, SecurityReadAccess);
+ }
+
+ if (pPixmap)
+ {
+ if ((pPixmap->drawable.depth != 1) ||
+ (pPixmap->drawable.pScreen != pGC->pScreen))
+ {
+ error = BadMatch;
+ }
+ else
+ {
+ clipType = CT_PIXMAP;
+ pPixmap->refcnt++;
+ }
+ }
+ else if (!pUnion && (pid != None))
+ {
+ clientErrorValue = pid;
+ error = BadPixmap;
+ }
+ if(error == Success)
+ {
+ (*pGC->funcs->ChangeClip)(pGC, clipType,
+ (pointer)pPixmap, 0);
+ }
+ break;
+ }
+ case GCDashOffset:
+ NEXTVAL(INT16, pGC->dashOffset);
+ break;
+ case GCDashList:
+ {
+ CARD8 newdash;
+ NEXTVAL(CARD8, newdash);
+ if (newdash == 4)
+ {
+ if (pGC->dash != DefaultDash)
+ {
+ xfree(pGC->dash);
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+ }
+ }
+ else if (newdash != 0)
+ {
+ unsigned char *dash;
+
+ dash = (unsigned char *)xalloc(2 * sizeof(unsigned char));
+ if (dash)
+ {
+ if (pGC->dash != DefaultDash)
+ xfree(pGC->dash);
+ pGC->numInDashList = 2;
+ pGC->dash = dash;
+ dash[0] = newdash;
+ dash[1] = newdash;
+ }
+ else
+ error = BadAlloc;
+ }
+ else
+ {
+ clientErrorValue = newdash;
+ error = BadValue;
+ }
+ break;
+ }
+ case GCArcMode:
+ {
+ unsigned int newarcmode;
+ NEXTVAL(unsigned int, newarcmode);
+ if (newarcmode <= ArcPieSlice)
+ pGC->arcMode = newarcmode;
+ else
+ {
+ clientErrorValue = newarcmode;
+ error = BadValue;
+ }
+ break;
+ }
+ default:
+ clientErrorValue = maskQ;
+ error = BadValue;
+ break;
+ }
+ } /* end while mask && !error */
+
+ if (pGC->fillStyle == FillTiled && pGC->tileIsPixel)
+ {
+ if (!CreateDefaultTile (pGC))
+ {
+ pGC->fillStyle = FillSolid;
+ error = BadAlloc;
+ }
+ }
+ (*pGC->funcs->ChangeGC)(pGC, maskQ);
+ return error;
+}
+
+#undef NEXTVAL
+#undef NEXT_PTR
+
+/* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells
+ * it that all of the entries are constants or IDs */
+int
+ChangeGC(pGC, mask, pval)
+ register GC *pGC;
+ register BITS32 mask;
+ XID *pval;
+{
+ return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
+}
+
+/* DoChangeGC(pGC, mask, pval, fPointer)
+ mask is a set of bits indicating which values to change.
+ pval contains an appropriate value for each mask.
+ fPointer is true if the values for tiles, stipples, fonts or clipmasks
+ are pointers instead of IDs. Note: if you are passing pointers you
+ MUST declare the array of values as type pointer! Other data types
+ may not be large enough to hold pointers on some machines. Yes,
+ this means you have to cast to (XID *) when you pass the array to
+ DoChangeGC. Similarly, if you are not passing pointers (fPointer = 0) you
+ MUST declare the array as type XID (not unsigned long!), or again the wrong
+ size data type may be used. To avoid this cruftiness, use dixChangeGC
+ above.
+
+ if there is an error, the value is marked as changed
+ anyway, which is probably wrong, but infrequent.
+
+NOTE:
+ all values sent over the protocol for ChangeGC requests are
+32 bits long
+*/
+int
+DoChangeGC(pGC, mask, pval, fPointer)
+ register GC *pGC;
+ register BITS32 mask;
+ XID *pval;
+ int fPointer;
+{
+ if (fPointer)
+ /* XXX might be a problem on 64 bit big-endian servers */
+ dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
+ else
+ dixChangeGC(NullClient, pGC, mask, pval, NULL);
+}
+
+
+/* CreateGC(pDrawable, mask, pval, pStatus)
+ creates a default GC for the given drawable, using mask to fill
+ in any non-default values.
+ Returns a pointer to the new GC on success, NULL otherwise.
+ returns status of non-default fields in pStatus
+BUG:
+ should check for failure to create default tile
+
+*/
+
+static GCPtr
+#if NeedFunctionPrototypes
+AllocateGC(ScreenPtr pScreen)
+#else
+AllocateGC(pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ GCPtr pGC;
+ register char *ptr;
+ register DevUnion *ppriv;
+ register unsigned *sizes;
+ register unsigned size;
+ register int i;
+
+ pGC = (GCPtr)xalloc(pScreen->totalGCSize);
+ if (pGC)
+ {
+ ppriv = (DevUnion *)(pGC + 1);
+ pGC->devPrivates = ppriv;
+ sizes = pScreen->GCPrivateSizes;
+ ptr = (char *)(ppriv + pScreen->GCPrivateLen);
+ for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ( (size = *sizes) )
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+ }
+ return pGC;
+}
+
+GCPtr
+CreateGC(pDrawable, mask, pval, pStatus)
+ DrawablePtr pDrawable;
+ BITS32 mask;
+ XID *pval;
+ int *pStatus;
+{
+ register GCPtr pGC;
+
+ pGC = AllocateGC(pDrawable->pScreen);
+ if (!pGC)
+ {
+ *pStatus = BadAlloc;
+ return (GCPtr)NULL;
+ }
+
+ pGC->pScreen = pDrawable->pScreen;
+ pGC->depth = pDrawable->depth;
+ pGC->alu = GXcopy; /* dst <- src */
+ pGC->planemask = ~0;
+ pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
+ pGC->funcs = 0;
+
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcPieSlice;
+ if (mask & GCForeground)
+ {
+ /*
+ * magic special case -- ChangeGC checks for this condition
+ * and snags the Foreground value to create a pseudo default-tile
+ */
+ pGC->tileIsPixel = FALSE;
+ pGC->tile.pixmap = NullPixmap;
+ }
+ else
+ {
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = 0;
+ }
+
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = TRUE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = (pointer)NULL;
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+ pGC->dashOffset = 0;
+ pGC->lastWinOrg.x = 0;
+ pGC->lastWinOrg.y = 0;
+
+ /* use the default font and stipple */
+ pGC->font = defaultFont;
+ defaultFont->refcnt++;
+ pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
+ pGC->stipple->refcnt++;
+
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
+ if (!(*pGC->pScreen->CreateGC)(pGC))
+ *pStatus = BadAlloc;
+ else if (mask)
+ *pStatus = ChangeGC(pGC, mask, pval);
+ else
+ *pStatus = Success;
+ if (*pStatus != Success)
+ {
+ if (!pGC->tileIsPixel && !pGC->tile.pixmap)
+ pGC->tileIsPixel = TRUE; /* undo special case */
+ FreeGC(pGC, (XID)0);
+ pGC = (GCPtr)NULL;
+ }
+
+ return (pGC);
+}
+
+static Bool
+CreateDefaultTile (pGC)
+ GCPtr pGC;
+{
+ XID tmpval[3];
+ PixmapPtr pTile;
+ GCPtr pgcScratch;
+ xRectangle rect;
+ CARD16 w, h;
+
+ w = 1;
+ h = 1;
+ (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen);
+ pTile = (PixmapPtr)
+ (*pGC->pScreen->CreatePixmap)(pGC->pScreen,
+ w, h, pGC->depth);
+ pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
+ if (!pTile || !pgcScratch)
+ {
+ if (pTile)
+ (*pTile->drawable.pScreen->DestroyPixmap)(pTile);
+ if (pgcScratch)
+ FreeScratchGC(pgcScratch);
+ return FALSE;
+ }
+ tmpval[0] = GXcopy;
+ tmpval[1] = pGC->tile.pixel;
+ tmpval[2] = FillSolid;
+ (void)ChangeGC(pgcScratch, GCFunction | GCForeground | GCFillStyle,
+ tmpval);
+ ValidateGC((DrawablePtr)pTile, pgcScratch);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pTile, pgcScratch, 1, &rect);
+ /* Always remember to free the scratch graphics context after use. */
+ FreeScratchGC(pgcScratch);
+
+ pGC->tileIsPixel = FALSE;
+ pGC->tile.pixmap = pTile;
+ return TRUE;
+}
+
+int
+CopyGC(pgcSrc, pgcDst, mask)
+ register GC *pgcSrc;
+ register GC *pgcDst;
+ register BITS32 mask;
+{
+ register BITS32 index2;
+ BITS32 maskQ;
+ int error = 0;
+
+ if (pgcSrc == pgcDst)
+ return Success;
+ pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pgcDst->stateChanges |= mask;
+ maskQ = mask;
+ while (mask)
+ {
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ switch (index2)
+ {
+ case GCFunction:
+ pgcDst->alu = pgcSrc->alu;
+ break;
+ case GCPlaneMask:
+ pgcDst->planemask = pgcSrc->planemask;
+ break;
+ case GCForeground:
+ pgcDst->fgPixel = pgcSrc->fgPixel;
+ break;
+ case GCBackground:
+ pgcDst->bgPixel = pgcSrc->bgPixel;
+ break;
+ case GCLineWidth:
+ pgcDst->lineWidth = pgcSrc->lineWidth;
+ break;
+ case GCLineStyle:
+ pgcDst->lineStyle = pgcSrc->lineStyle;
+ break;
+ case GCCapStyle:
+ pgcDst->capStyle = pgcSrc->capStyle;
+ break;
+ case GCJoinStyle:
+ pgcDst->joinStyle = pgcSrc->joinStyle;
+ break;
+ case GCFillStyle:
+ pgcDst->fillStyle = pgcSrc->fillStyle;
+ break;
+ case GCFillRule:
+ pgcDst->fillRule = pgcSrc->fillRule;
+ break;
+ case GCTile:
+ {
+ if (EqualPixUnion(pgcDst->tileIsPixel,
+ pgcDst->tile,
+ pgcSrc->tileIsPixel,
+ pgcSrc->tile))
+ {
+ break;
+ }
+ if (!pgcDst->tileIsPixel)
+ (* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap);
+ pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
+ pgcDst->tile = pgcSrc->tile;
+ if (!pgcDst->tileIsPixel)
+ pgcDst->tile.pixmap->refcnt++;
+ break;
+ }
+ case GCStipple:
+ {
+ if (pgcDst->stipple == pgcSrc->stipple)
+ break;
+ if (pgcDst->stipple)
+ (* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple);
+ pgcDst->stipple = pgcSrc->stipple;
+ if (pgcDst->stipple)
+ pgcDst->stipple->refcnt ++;
+ break;
+ }
+ case GCTileStipXOrigin:
+ pgcDst->patOrg.x = pgcSrc->patOrg.x;
+ break;
+ case GCTileStipYOrigin:
+ pgcDst->patOrg.y = pgcSrc->patOrg.y;
+ break;
+ case GCFont:
+ if (pgcDst->font == pgcSrc->font)
+ break;
+ if (pgcDst->font)
+ CloseFont(pgcDst->font, (Font)0);
+ if ((pgcDst->font = pgcSrc->font) != NullFont)
+ (pgcDst->font)->refcnt++;
+ break;
+ case GCSubwindowMode:
+ pgcDst->subWindowMode = pgcSrc->subWindowMode;
+ break;
+ case GCGraphicsExposures:
+ pgcDst->graphicsExposures = pgcSrc->graphicsExposures;
+ break;
+ case GCClipXOrigin:
+ pgcDst->clipOrg.x = pgcSrc->clipOrg.x;
+ break;
+ case GCClipYOrigin:
+ pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
+ break;
+ case GCClipMask:
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ break;
+ case GCDashOffset:
+ pgcDst->dashOffset = pgcSrc->dashOffset;
+ break;
+ case GCDashList:
+ if (pgcSrc->dash == DefaultDash)
+ {
+ if (pgcDst->dash != DefaultDash)
+ {
+ xfree(pgcDst->dash);
+ pgcDst->numInDashList = pgcSrc->numInDashList;
+ pgcDst->dash = pgcSrc->dash;
+ }
+ }
+ else
+ {
+ unsigned char *dash;
+ unsigned int i;
+
+ dash = (unsigned char *)xalloc(pgcSrc->numInDashList *
+ sizeof(unsigned char));
+ if (dash)
+ {
+ if (pgcDst->dash != DefaultDash)
+ xfree(pgcDst->dash);
+ pgcDst->numInDashList = pgcSrc->numInDashList;
+ pgcDst->dash = dash;
+ for (i=0; i<pgcSrc->numInDashList; i++)
+ dash[i] = pgcSrc->dash[i];
+ }
+ else
+ error = BadAlloc;
+ }
+ break;
+ case GCArcMode:
+ pgcDst->arcMode = pgcSrc->arcMode;
+ break;
+ default:
+ clientErrorValue = maskQ;
+ error = BadValue;
+ break;
+ }
+ }
+ if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel)
+ {
+ if (!CreateDefaultTile (pgcDst))
+ {
+ pgcDst->fillStyle = FillSolid;
+ error = BadAlloc;
+ }
+ }
+ (*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst);
+ return error;
+}
+
+/*****************
+ * FreeGC
+ * does the diX part of freeing the characteristics in the GC
+ ***************/
+
+/*ARGSUSED*/
+int
+FreeGC(value, gid)
+ pointer value; /* must conform to DeleteType */
+ XID gid;
+{
+ GCPtr pGC = (GCPtr)value;
+
+ CloseFont(pGC->font, (Font)0);
+ (* pGC->funcs->DestroyClip)(pGC);
+
+ if (!pGC->tileIsPixel)
+ (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
+ if (pGC->stipple)
+ (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
+
+ (*pGC->funcs->DestroyGC) (pGC);
+ if (pGC->dash != DefaultDash)
+ xfree(pGC->dash);
+ xfree(pGC);
+ return(Success);
+}
+
+void
+SetGCMask(pGC, selectMask, newDataMask)
+ GCPtr pGC;
+ Mask selectMask;
+ Mask newDataMask;
+{
+ pGC->stateChanges = (~selectMask & pGC->stateChanges) |
+ (selectMask & newDataMask);
+ if (selectMask & newDataMask)
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+}
+
+
+
+/* CreateScratchGC(pScreen, depth)
+ like CreateGC, but doesn't do the default tile or stipple,
+since we can't create them without already having a GC. any code
+using the tile or stipple has to set them explicitly anyway,
+since the state of the scratch gc is unknown. This is OK
+because ChangeGC() has to be able to deal with NULL tiles and
+stipples anyway (in case the CreateGC() call has provided a
+value for them -- we can't set the default tile until the
+client-supplied attributes are installed, since the fgPixel
+is what fills the default tile. (maybe this comment should
+go with CreateGC() or ChangeGC().)
+*/
+
+GCPtr
+CreateScratchGC(pScreen, depth)
+ ScreenPtr pScreen;
+ unsigned depth;
+{
+ register GCPtr pGC;
+
+ pGC = AllocateGC(pScreen);
+ if (!pGC)
+ return (GCPtr)NULL;
+
+ pGC->pScreen = pScreen;
+ pGC->depth = depth;
+ pGC->alu = GXcopy; /* dst <- src */
+ pGC->planemask = ~0;
+ pGC->serialNumber = 0;
+
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcPieSlice;
+ pGC->font = defaultFont;
+ if ( pGC->font) /* necessary, because open of default font could fail */
+ pGC->font->refcnt++;
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = 0;
+ pGC->stipple = NullPixmap;
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = TRUE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ pGC->clientClipType = CT_NONE;
+ pGC->dashOffset = 0;
+ pGC->numInDashList = 2;
+ pGC->dash = DefaultDash;
+ pGC->lastWinOrg.x = 0;
+ pGC->lastWinOrg.y = 0;
+
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
+ if (!(*pScreen->CreateGC)(pGC))
+ {
+ FreeGC(pGC, (XID)0);
+ pGC = (GCPtr)NULL;
+ }
+ return pGC;
+}
+
+void
+FreeGCperDepth(screenNum)
+ int screenNum;
+{
+ register int i;
+ register ScreenPtr pScreen;
+ GCPtr *ppGC;
+
+ pScreen = screenInfo.screens[screenNum];
+ ppGC = pScreen->GCperDepth;
+
+ for (i = 0; i <= pScreen->numDepths; i++)
+ (void)FreeGC(ppGC[i], (XID)0);
+ pScreen->rgf = ~0L;
+}
+
+
+Bool
+CreateGCperDepth(screenNum)
+ int screenNum;
+{
+ register int i;
+ register ScreenPtr pScreen;
+ DepthPtr pDepth;
+ GCPtr *ppGC;
+
+ pScreen = screenInfo.screens[screenNum];
+ pScreen->rgf = 0;
+ ppGC = pScreen->GCperDepth;
+ /* do depth 1 separately because it's not included in list */
+ if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
+ return FALSE;
+ ppGC[0]->graphicsExposures = FALSE;
+
+ pDepth = pScreen->allowedDepths;
+ for (i=0; i<pScreen->numDepths; i++, pDepth++)
+ {
+ if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth)))
+ {
+ for (; i >= 0; i--)
+ (void)FreeGC(ppGC[i], (XID)0);
+ return FALSE;
+ }
+ ppGC[i+1]->graphicsExposures = FALSE;
+ }
+ return TRUE;
+}
+
+Bool
+CreateDefaultStipple(screenNum)
+ int screenNum;
+{
+ register ScreenPtr pScreen;
+ XID tmpval[3];
+ xRectangle rect;
+ CARD16 w, h;
+ GCPtr pgcScratch;
+
+ pScreen = screenInfo.screens[screenNum];
+
+ w = 16;
+ h = 16;
+ (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen);
+ if (!(pScreen->PixmapPerDepth[0] =
+ (*pScreen->CreatePixmap)(pScreen, w, h, 1)))
+ return FALSE;
+ /* fill stipple with 1 */
+ tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid;
+ pgcScratch = GetScratchGC(1, pScreen);
+ if (!pgcScratch)
+ {
+ (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
+ return FALSE;
+ }
+ (void)ChangeGC(pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
+ ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pScreen->PixmapPerDepth[0],
+ pgcScratch, 1, &rect);
+ FreeScratchGC(pgcScratch);
+ return TRUE;
+}
+
+void
+FreeDefaultStipple(screenNum)
+ int screenNum;
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
+}
+
+int
+SetDashes(pGC, offset, ndash, pdash)
+register GCPtr pGC;
+unsigned offset;
+register unsigned ndash;
+register unsigned char *pdash;
+{
+ register long i;
+ register unsigned char *p, *indash;
+ BITS32 maskQ = 0;
+
+ i = ndash;
+ p = pdash;
+ while (i--)
+ {
+ if (!*p++)
+ {
+ /* dash segment must be > 0 */
+ clientErrorValue = 0;
+ return BadValue;
+ }
+ }
+
+ if (ndash & 1)
+ p = (unsigned char *)xalloc(2 * ndash * sizeof(unsigned char));
+ else
+ p = (unsigned char *)xalloc(ndash * sizeof(unsigned char));
+ if (!p)
+ return BadAlloc;
+
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ if (offset != pGC->dashOffset)
+ {
+ pGC->dashOffset = offset;
+ pGC->stateChanges |= GCDashOffset;
+ maskQ |= GCDashOffset;
+ }
+
+ if (pGC->dash != DefaultDash)
+ xfree(pGC->dash);
+ pGC->numInDashList = ndash;
+ pGC->dash = p;
+ if (ndash & 1)
+ {
+ pGC->numInDashList += ndash;
+ indash = pdash;
+ i = ndash;
+ while (i--)
+ *p++ = *indash++;
+ }
+ while(ndash--)
+ *p++ = *pdash++;
+ pGC->stateChanges |= GCDashList;
+ maskQ |= GCDashList;
+
+ if (pGC->funcs->ChangeGC)
+ (*pGC->funcs->ChangeGC) (pGC, maskQ);
+ return Success;
+}
+
+int
+VerifyRectOrder(nrects, prects, ordering)
+ int nrects;
+ xRectangle *prects;
+ int ordering;
+{
+ register xRectangle *prectP, *prectN;
+ register int i;
+
+ switch(ordering)
+ {
+ case Unsorted:
+ return CT_UNSORTED;
+ case YSorted:
+ if(nrects > 1)
+ {
+ for(i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects;
+ i++, prectP++, prectN++)
+ if(prectN->y < prectP->y)
+ return -1;
+ }
+ return CT_YSORTED;
+ case YXSorted:
+ if(nrects > 1)
+ {
+ for(i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects;
+ i++, prectP++, prectN++)
+ if((prectN->y < prectP->y) ||
+ ( (prectN->y == prectP->y) &&
+ (prectN->x < prectP->x) ) )
+ return -1;
+ }
+ return CT_YXSORTED;
+ case YXBanded:
+ if(nrects > 1)
+ {
+ for(i = 1, prectP = prects, prectN = prects + 1;
+ i < nrects;
+ i++, prectP++, prectN++)
+ if((prectN->y != prectP->y &&
+ prectN->y < prectP->y + (int) prectP->height) ||
+ ((prectN->y == prectP->y) &&
+ (prectN->height != prectP->height ||
+ prectN->x < prectP->x + (int) prectP->width)))
+ return -1;
+ }
+ return CT_YXBANDED;
+ }
+ return -1;
+}
+
+int
+SetClipRects(pGC, xOrigin, yOrigin, nrects, prects, ordering)
+ GCPtr pGC;
+ int xOrigin, yOrigin;
+ int nrects;
+ xRectangle *prects;
+ int ordering;
+{
+ int newct, size;
+ xRectangle *prectsNew;
+
+ newct = VerifyRectOrder(nrects, prects, ordering);
+ if (newct < 0)
+ return(BadMatch);
+ size = nrects * sizeof(xRectangle);
+ prectsNew = (xRectangle *) xalloc(size);
+ if (!prectsNew && size)
+ return BadAlloc;
+
+ pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ pGC->clipOrg.x = xOrigin;
+ pGC->stateChanges |= GCClipXOrigin;
+
+ pGC->clipOrg.y = yOrigin;
+ pGC->stateChanges |= GCClipYOrigin;
+
+ if (size)
+ memmove((char *)prectsNew, (char *)prects, size);
+ (*pGC->funcs->ChangeClip)(pGC, newct, (pointer)prectsNew, nrects);
+ if (pGC->funcs->ChangeGC)
+ (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask);
+ return Success;
+}
+
+
+/*
+ sets reasonable defaults
+ if we can get a pre-allocated one, use it and mark it as used.
+ if we can't, create one out of whole cloth (The Velveteen GC -- if
+ you use it often enough it will become real.)
+*/
+GCPtr
+GetScratchGC(depth, pScreen)
+ register unsigned depth;
+ register ScreenPtr pScreen;
+{
+ register int i;
+ register GCPtr pGC;
+
+ for (i=0; i<=pScreen->numDepths; i++)
+ if ( pScreen->GCperDepth[i]->depth == depth &&
+ !(pScreen->rgf & (1L << (i+1)))
+ )
+ {
+ pScreen->rgf |= (1L << (i+1));
+ pGC = (pScreen->GCperDepth[i]);
+
+ pGC->alu = GXcopy;
+ pGC->planemask = ~0;
+ pGC->serialNumber = 0;
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 1;
+ pGC->lineWidth = 0;
+ pGC->lineStyle = LineSolid;
+ pGC->capStyle = CapButt;
+ pGC->joinStyle = JoinMiter;
+ pGC->fillStyle = FillSolid;
+ pGC->fillRule = EvenOddRule;
+ pGC->arcMode = ArcChord;
+ pGC->patOrg.x = 0;
+ pGC->patOrg.y = 0;
+ pGC->subWindowMode = ClipByChildren;
+ pGC->graphicsExposures = FALSE;
+ pGC->clipOrg.x = 0;
+ pGC->clipOrg.y = 0;
+ if (pGC->clientClipType != CT_NONE)
+ (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
+ return pGC;
+ }
+ /* if we make it this far, need to roll our own */
+ pGC = CreateScratchGC(pScreen, depth);
+ if (pGC)
+ pGC->graphicsExposures = FALSE;
+ return pGC;
+}
+
+/*
+ if the gc to free is in the table of pre-existing ones,
+mark it as available.
+ if not, free it for real
+*/
+void
+FreeScratchGC(pGC)
+ register GCPtr pGC;
+{
+ register ScreenPtr pScreen = pGC->pScreen;
+ register int i;
+
+ for (i=0; i<=pScreen->numDepths; i++)
+ {
+ if ( pScreen->GCperDepth[i] == pGC)
+ {
+ pScreen->rgf &= ~(1L << (i+1));
+ return;
+ }
+ }
+ (void)FreeGC(pGC, (GContext)0);
+}
diff --git a/xc/programs/Xserver/dix/globals.c b/xc/programs/Xserver/dix/globals.c
new file mode 100644
index 000000000..887662dee
--- /dev/null
+++ b/xc/programs/Xserver/dix/globals.c
@@ -0,0 +1,141 @@
+/* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.6 1998/10/04 09:38:09 dawes Exp $ */
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* $TOG: globals.c /main/21 1998/02/09 14:19:40 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "input.h"
+#include "dixfont.h"
+#include "site.h"
+#include "dixstruct.h"
+#include "os.h"
+
+ScreenInfo screenInfo;
+KeybdCtrl defaultKeyboardControl = {
+ DEFAULT_KEYBOARD_CLICK,
+ DEFAULT_BELL,
+ DEFAULT_BELL_PITCH,
+ DEFAULT_BELL_DURATION,
+ DEFAULT_AUTOREPEAT,
+ DEFAULT_AUTOREPEATS,
+ DEFAULT_LEDS,
+ 0};
+
+PtrCtrl defaultPointerControl = {
+ DEFAULT_PTR_NUMERATOR,
+ DEFAULT_PTR_DENOMINATOR,
+ DEFAULT_PTR_THRESHOLD,
+ 0};
+
+ClientPtr *clients;
+ClientPtr serverClient;
+int currentMaxClients; /* current size of clients array */
+
+WindowPtr *WindowTable;
+
+unsigned long globalSerialNumber = 0;
+unsigned long serverGeneration = 0;
+
+/* these next four are initialized in main.c */
+CARD32 ScreenSaverTime;
+CARD32 ScreenSaverInterval;
+int ScreenSaverBlanking;
+int ScreenSaverAllowExposures;
+
+#ifdef DPMSExtension
+#define DEFAULT_STANDBY_TIME DEFAULT_SCREEN_SAVER_TIME * 2
+#define DEFAULT_SUSPEND_TIME DEFAULT_SCREEN_SAVER_TIME * 3
+#define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
+CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
+CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;
+CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME;
+CARD16 DPMSPowerLevel = 0;
+Bool defaultDPMSEnabled = FALSE;
+Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
+Bool DPMSDisabledSwitch = FALSE; /* switch states */
+Bool DPMSCapableFlag = FALSE;
+CARD32 DPMSStandbyTime;
+CARD32 DPMSSuspendTime;
+CARD32 DPMSOffTime;
+Bool DPMSEnabled;
+#endif
+
+CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
+CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
+int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
+int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
+#ifndef NOLOGOHACK
+int logoScreenSaver = DEFAULT_LOGO_SCREEN_SAVER;
+#endif
+
+char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
+char *defaultTextFont = COMPILEDDEFAULTFONT;
+char *defaultCursorFont = COMPILEDCURSORFONT;
+char *rgbPath = RGB_DB;
+char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
+FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
+ every compilation of dix code */
+Bool loadableFonts = FALSE;
+CursorPtr rootCursor;
+ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
+
+TimeStamp currentTime;
+TimeStamp lastDeviceEventTime;
+
+Bool permitOldBugs = FALSE; /* turn off some error checking, to permit certain
+ * old broken clients (like R2/R3 xterms) to work
+ */
+
+int defaultColorVisualClass = -1;
+int monitorResolution = 0;
+
+char *display;
+
+CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
+int argcGlobal;
+char **argvGlobal;
diff --git a/xc/programs/Xserver/dix/glyphcurs.c b/xc/programs/Xserver/dix/glyphcurs.c
new file mode 100644
index 000000000..0d047a6b1
--- /dev/null
+++ b/xc/programs/Xserver/dix/glyphcurs.c
@@ -0,0 +1,193 @@
+/************************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+
+/* $TOG: glyphcurs.c /main/29 1998/02/09 14:19:46 kaleb $ */
+
+#include "misc.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "resource.h"
+#include "dix.h"
+#include "cursorstr.h"
+#include "opaque.h"
+#include "servermd.h"
+
+
+/*
+ get the bits out of the font in a portable way. to avoid
+dealing with padding and such-like, we draw the glyph into
+a bitmap, then read the bits out with GetImage, which
+uses server-natural format.
+ since all screens return the same bitmap format, we'll just use
+the first one we find.
+ the character origin lines up with the hotspot in the
+cursor metrics.
+*/
+
+int
+ServerBitsFromGlyph(pfont, ch, cm, ppbits)
+ FontPtr pfont;
+ unsigned int ch;
+ register CursorMetricPtr cm;
+ unsigned char **ppbits;
+{
+ register ScreenPtr pScreen;
+ register GCPtr pGC;
+ xRectangle rect;
+ PixmapPtr ppix;
+ long nby;
+ char *pbits;
+ ChangeGCVal gcval[3];
+ unsigned char char2b[2];
+
+ /* turn glyph index into a protocol-format char2b */
+ char2b[0] = (unsigned char)(ch >> 8);
+ char2b[1] = (unsigned char)(ch & 0xff);
+
+ pScreen = screenInfo.screens[0];
+ nby = BitmapBytePad(cm->width) * (long)cm->height;
+ pbits = (char *)xalloc(nby);
+ if (!pbits)
+ return BadAlloc;
+ /* zeroing the (pad) bits seems to help some ddx cursor handling */
+ bzero(pbits, nby);
+
+ ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
+ cm->height, 1);
+ pGC = GetScratchGC(1, pScreen);
+ if (!ppix || !pGC)
+ {
+ if (ppix)
+ (*pScreen->DestroyPixmap)(ppix);
+ if (pGC)
+ FreeScratchGC(pGC);
+ xfree(pbits);
+ return BadAlloc;
+ }
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = cm->width;
+ rect.height = cm->height;
+
+ /* fill the pixmap with 0 */
+ gcval[0].val = GXcopy;
+ gcval[1].val = 0;
+ gcval[2].ptr = (pointer)pfont;
+ dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont,
+ NULL, gcval);
+ ValidateGC((DrawablePtr)ppix, pGC);
+ (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect);
+
+ /* draw the glyph */
+ gcval[0].val = 1;
+ dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval);
+ ValidateGC((DrawablePtr)ppix, pGC);
+ (*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot,
+ 1, (unsigned short *)char2b);
+ (*pScreen->GetImage)((DrawablePtr)ppix, 0, 0, cm->width, cm->height,
+ XYPixmap, 1, pbits);
+ *ppbits = (unsigned char *)pbits;
+ FreeScratchGC(pGC);
+ (*pScreen->DestroyPixmap)(ppix);
+ return Success;
+}
+
+
+Bool
+CursorMetricsFromGlyph( pfont, ch, cm)
+ register FontPtr pfont;
+ unsigned ch;
+ register CursorMetricPtr cm;
+{
+ CharInfoPtr pci;
+ unsigned long nglyphs;
+ CARD8 chs[2];
+ FontEncoding encoding;
+
+ chs[0] = ch >> 8;
+ chs[1] = ch;
+ encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit;
+ if (encoding == Linear16Bit)
+ {
+ if (ch < pfont->info.firstCol || pfont->info.lastCol < ch)
+ return FALSE;
+ }
+ else
+ {
+ if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0])
+ return FALSE;
+ if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1])
+ return FALSE;
+ }
+ (*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci);
+ if (nglyphs == 0)
+ return FALSE;
+ cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ cm->height = pci->metrics.descent + pci->metrics.ascent;
+ if (pci->metrics.leftSideBearing > 0)
+ {
+ cm->width += pci->metrics.leftSideBearing;
+ cm->xhot = 0;
+ }
+ else
+ {
+ cm->xhot = -pci->metrics.leftSideBearing;
+ if (pci->metrics.rightSideBearing < 0)
+ cm->width -= pci->metrics.rightSideBearing;
+ }
+ if (pci->metrics.ascent < 0)
+ {
+ cm->height -= pci->metrics.ascent;
+ cm->yhot = 0;
+ }
+ else
+ {
+ cm->yhot = pci->metrics.ascent;
+ if (pci->metrics.descent < 0)
+ cm->height -= pci->metrics.descent;
+ }
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/dix/grabs.c b/xc/programs/Xserver/dix/grabs.c
new file mode 100644
index 000000000..307f6ee7f
--- /dev/null
+++ b/xc/programs/Xserver/dix/grabs.c
@@ -0,0 +1,487 @@
+/* $TOG: grabs.c /main/23 1998/02/09 14:19:51 kaleb $ */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN action OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+/* $XFree86: xc/programs/Xserver/dix/grabs.c,v 3.1 1998/10/04 09:38:09 dawes Exp $ */
+
+#include "X.h"
+#include "misc.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "cursorstr.h"
+#include "dixgrabs.h"
+
+extern InputInfo inputInfo;
+
+#define BITMASK(i) (((Mask)1) << ((i) & 31))
+#define MASKIDX(i) ((i) >> 5)
+#define MASKWORD(buf, i) buf[MASKIDX(i)]
+#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
+#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
+#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
+
+GrabPtr
+#if NeedFunctionPrototypes
+CreateGrab(
+ int client,
+ DeviceIntPtr device,
+ WindowPtr window,
+ Mask eventMask,
+ Bool ownerEvents, Bool keyboardMode, Bool pointerMode,
+ DeviceIntPtr modDevice,
+ unsigned short modifiers,
+ int type,
+ KeyCode keybut, /* key or button */
+ WindowPtr confineTo,
+ CursorPtr cursor)
+#else
+CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
+ pointerMode, modDevice, modifiers, type, keybut, confineTo, cursor)
+ int client;
+ DeviceIntPtr device;
+ WindowPtr window;
+ Mask eventMask;
+ Bool ownerEvents, keyboardMode, pointerMode;
+ DeviceIntPtr modDevice;
+ unsigned short modifiers;
+ int type;
+ KeyCode keybut; /* key or button */
+ WindowPtr confineTo;
+ CursorPtr cursor;
+#endif
+{
+ GrabPtr grab;
+
+ grab = (GrabPtr)xalloc(sizeof(GrabRec));
+ if (!grab)
+ return (GrabPtr)NULL;
+ grab->resource = FakeClientID(client);
+ grab->device = device;
+ grab->coreGrab = ((device == inputInfo.keyboard) ||
+ (device == inputInfo.pointer));
+ grab->window = window;
+ grab->eventMask = eventMask;
+ grab->ownerEvents = ownerEvents;
+ grab->keyboardMode = keyboardMode;
+ grab->pointerMode = pointerMode;
+ grab->modifiersDetail.exact = modifiers;
+ grab->modifiersDetail.pMask = NULL;
+ grab->modifierDevice = modDevice;
+ grab->coreMods = ((modDevice == inputInfo.keyboard) ||
+ (modDevice == inputInfo.pointer));
+ grab->type = type;
+ grab->detail.exact = keybut;
+ grab->detail.pMask = NULL;
+ grab->confineTo = confineTo;
+ grab->cursor = cursor;
+ if (cursor)
+ cursor->refcnt++;
+ return grab;
+
+}
+
+static void
+#if NeedFunctionPrototypes
+FreeGrab(GrabPtr pGrab)
+#else
+FreeGrab(pGrab)
+ GrabPtr pGrab;
+#endif
+{
+ if (pGrab->modifiersDetail.pMask != NULL)
+ xfree(pGrab->modifiersDetail.pMask);
+
+ if (pGrab->detail.pMask != NULL)
+ xfree(pGrab->detail.pMask);
+
+ if (pGrab->cursor)
+ FreeCursor(pGrab->cursor, (Cursor)0);
+
+ xfree(pGrab);
+}
+
+/*ARGSUSED*/
+int
+DeletePassiveGrab(value, id)
+ pointer value;
+ XID id;
+{
+ register GrabPtr g, prev;
+ GrabPtr pGrab = (GrabPtr)value;
+
+ /* it is OK if the grab isn't found */
+ prev = 0;
+ for (g = (wPassiveGrabs (pGrab->window)); g; g = g->next)
+ {
+ if (pGrab == g)
+ {
+ if (prev)
+ prev->next = g->next;
+ else
+ if (!(pGrab->window->optional->passiveGrabs = g->next))
+ CheckWindowOptionalNeed (pGrab->window);
+ break;
+ }
+ prev = g;
+ }
+ FreeGrab(pGrab);
+ return Success;
+}
+
+static Mask *
+#if NeedFunctionPrototypes
+DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail)
+#else
+DeleteDetailFromMask(pDetailMask, detail)
+ Mask *pDetailMask;
+ unsigned short detail;
+#endif
+{
+ register Mask *mask;
+ register int i;
+
+ mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask);
+ if (mask)
+ {
+ if (pDetailMask)
+ for (i = 0; i < MasksPerDetailMask; i++)
+ mask[i]= pDetailMask[i];
+ else
+ for (i = 0; i < MasksPerDetailMask; i++)
+ mask[i]= ~0L;
+ BITCLEAR(mask, detail);
+ }
+ return mask;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+IsInGrabMask(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
+IsInGrabMask(firstDetail, secondDetail, exception)
+ DetailRec firstDetail, secondDetail;
+ unsigned short exception;
+#endif
+{
+ if (firstDetail.exact == exception)
+ {
+ if (firstDetail.pMask == NULL)
+ return TRUE;
+
+ /* (at present) never called with two non-null pMasks */
+ if (secondDetail.exact == exception)
+ return FALSE;
+
+ if (GETBIT(firstDetail.pMask, secondDetail.exact))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+IdenticalExactDetails(
+ unsigned short firstExact,
+ unsigned short secondExact,
+ unsigned short exception)
+#else
+IdenticalExactDetails(firstExact, secondExact, exception)
+ unsigned short firstExact, secondExact, exception;
+#endif
+{
+ if ((firstExact == exception) || (secondExact == exception))
+ return FALSE;
+
+ if (firstExact == secondExact)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+DetailSupersedesSecond(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
+DetailSupersedesSecond(firstDetail, secondDetail, exception)
+ DetailRec firstDetail, secondDetail;
+ unsigned short exception;
+#endif
+{
+ if (IsInGrabMask(firstDetail, secondDetail, exception))
+ return TRUE;
+
+ if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact,
+ exception))
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
+#else
+GrabSupersedesSecond(pFirstGrab, pSecondGrab)
+ GrabPtr pFirstGrab, pSecondGrab;
+#endif
+{
+ if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail,
+ pSecondGrab->modifiersDetail,
+ (unsigned short)AnyModifier))
+ return FALSE;
+
+ if (DetailSupersedesSecond(pFirstGrab->detail,
+ pSecondGrab->detail, (unsigned short)AnyKey))
+ return TRUE;
+
+ return FALSE;
+}
+
+Bool
+GrabMatchesSecond(pFirstGrab, pSecondGrab)
+ GrabPtr pFirstGrab, pSecondGrab;
+{
+ if ((pFirstGrab->device != pSecondGrab->device) ||
+ (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) ||
+ (pFirstGrab->type != pSecondGrab->type))
+ return FALSE;
+
+ if (GrabSupersedesSecond(pFirstGrab, pSecondGrab) ||
+ GrabSupersedesSecond(pSecondGrab, pFirstGrab))
+ return TRUE;
+
+ if (DetailSupersedesSecond(pSecondGrab->detail, pFirstGrab->detail,
+ (unsigned short)AnyKey)
+ &&
+ DetailSupersedesSecond(pFirstGrab->modifiersDetail,
+ pSecondGrab->modifiersDetail,
+ (unsigned short)AnyModifier))
+ return TRUE;
+
+ if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail,
+ (unsigned short)AnyKey)
+ &&
+ DetailSupersedesSecond(pSecondGrab->modifiersDetail,
+ pFirstGrab->modifiersDetail,
+ (unsigned short)AnyModifier))
+ return TRUE;
+
+ return FALSE;
+}
+
+int
+AddPassiveGrabToList(pGrab)
+ GrabPtr pGrab;
+{
+ GrabPtr grab;
+
+ for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
+ {
+ if (GrabMatchesSecond(pGrab, grab))
+ {
+ if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
+ {
+ FreeGrab(pGrab);
+ return BadAccess;
+ }
+ }
+ }
+
+ if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window))
+ {
+ FreeGrab(pGrab);
+ return BadAlloc;
+ }
+ pGrab->next = pGrab->window->optional->passiveGrabs;
+ pGrab->window->optional->passiveGrabs = pGrab;
+ if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer)pGrab))
+ return Success;
+ return BadAlloc;
+}
+
+/* the following is kinda complicated, because we need to be able to back out
+ * if any allocation fails
+ */
+
+Bool
+DeletePassiveGrabFromList(pMinuendGrab)
+ GrabPtr pMinuendGrab;
+{
+ register GrabPtr grab;
+ GrabPtr *deletes, *adds;
+ Mask ***updates, **details;
+ int i, ndels, nadds, nups;
+ Bool ok;
+
+#define UPDATE(mask,exact) \
+ if (!(details[nups] = DeleteDetailFromMask(mask, exact))) \
+ ok = FALSE; \
+ else \
+ updates[nups++] = &(mask)
+
+ i = 0;
+ for (grab = wPassiveGrabs(pMinuendGrab->window); grab; grab = grab->next)
+ i++;
+ if (!i)
+ return TRUE;
+ deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
+ adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
+ updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **));
+ details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *));
+ if (!deletes || !adds || !updates || !details)
+ {
+ if (details) DEALLOCATE_LOCAL(details);
+ if (updates) DEALLOCATE_LOCAL(updates);
+ if (adds) DEALLOCATE_LOCAL(adds);
+ if (deletes) DEALLOCATE_LOCAL(deletes);
+ return FALSE;
+ }
+ ndels = nadds = nups = 0;
+ ok = TRUE;
+ for (grab = wPassiveGrabs(pMinuendGrab->window);
+ grab && ok;
+ grab = grab->next)
+ {
+ if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) ||
+ !GrabMatchesSecond(grab, pMinuendGrab))
+ continue;
+ if (GrabSupersedesSecond(pMinuendGrab, grab))
+ {
+ deletes[ndels++] = grab;
+ }
+ else if ((grab->detail.exact == AnyKey)
+ && (grab->modifiersDetail.exact != AnyModifier))
+ {
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+ }
+ else if ((grab->modifiersDetail.exact == AnyModifier)
+ && (grab->detail.exact != AnyKey))
+ {
+ UPDATE(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.exact);
+ }
+ else if ((pMinuendGrab->detail.exact != AnyKey)
+ && (pMinuendGrab->modifiersDetail.exact != AnyModifier))
+ {
+ GrabPtr pNewGrab;
+
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+
+ pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device,
+ grab->window, (Mask)grab->eventMask,
+ (Bool)grab->ownerEvents,
+ (Bool)grab->keyboardMode,
+ (Bool)grab->pointerMode,
+ grab->modifierDevice,
+ AnyModifier, (int)grab->type,
+ pMinuendGrab->detail.exact,
+ grab->confineTo, grab->cursor);
+ if (!pNewGrab)
+ ok = FALSE;
+ else if (!(pNewGrab->modifiersDetail.pMask =
+ DeleteDetailFromMask(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.exact))
+ ||
+ (!pNewGrab->window->optional &&
+ !MakeWindowOptional(pNewGrab->window)))
+ {
+ FreeGrab(pNewGrab);
+ ok = FALSE;
+ }
+ else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,
+ (pointer)pNewGrab))
+ ok = FALSE;
+ else
+ adds[nadds++] = pNewGrab;
+ }
+ else if (pMinuendGrab->detail.exact == AnyKey)
+ {
+ UPDATE(grab->modifiersDetail.pMask,
+ pMinuendGrab->modifiersDetail.exact);
+ }
+ else
+ {
+ UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);
+ }
+ }
+
+ if (!ok)
+ {
+ for (i = 0; i < nadds; i++)
+ FreeResource(adds[i]->resource, RT_NONE);
+ for (i = 0; i < nups; i++)
+ xfree(details[i]);
+ }
+ else
+ {
+ for (i = 0; i < ndels; i++)
+ FreeResource(deletes[i]->resource, RT_NONE);
+ for (i = 0; i < nadds; i++)
+ {
+ grab = adds[i];
+ grab->next = grab->window->optional->passiveGrabs;
+ grab->window->optional->passiveGrabs = grab;
+ }
+ for (i = 0; i < nups; i++)
+ {
+ xfree(*updates[i]);
+ *updates[i] = details[i];
+ }
+ }
+ DEALLOCATE_LOCAL(details);
+ DEALLOCATE_LOCAL(updates);
+ DEALLOCATE_LOCAL(adds);
+ DEALLOCATE_LOCAL(deletes);
+ return ok;
+
+#undef UPDATE
+}
diff --git a/xc/programs/Xserver/dix/initatoms.c b/xc/programs/Xserver/dix/initatoms.c
new file mode 100644
index 000000000..7aadd909a
--- /dev/null
+++ b/xc/programs/Xserver/dix/initatoms.c
@@ -0,0 +1,80 @@
+/* THIS IS A GENERATED FILE
+ *
+ * Do not change! Changing this file implies a protocol change!
+ */
+
+#include "X.h"
+#include "Xatom.h"
+#include "misc.h"
+#include "dix.h"
+void MakePredeclaredAtoms()
+{
+ if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
+ if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
+ if (MakeAtom("ARC", 3, 1) != XA_ARC) AtomError();
+ if (MakeAtom("ATOM", 4, 1) != XA_ATOM) AtomError();
+ if (MakeAtom("BITMAP", 6, 1) != XA_BITMAP) AtomError();
+ if (MakeAtom("CARDINAL", 8, 1) != XA_CARDINAL) AtomError();
+ if (MakeAtom("COLORMAP", 8, 1) != XA_COLORMAP) AtomError();
+ if (MakeAtom("CURSOR", 6, 1) != XA_CURSOR) AtomError();
+ if (MakeAtom("CUT_BUFFER0", 11, 1) != XA_CUT_BUFFER0) AtomError();
+ if (MakeAtom("CUT_BUFFER1", 11, 1) != XA_CUT_BUFFER1) AtomError();
+ if (MakeAtom("CUT_BUFFER2", 11, 1) != XA_CUT_BUFFER2) AtomError();
+ if (MakeAtom("CUT_BUFFER3", 11, 1) != XA_CUT_BUFFER3) AtomError();
+ if (MakeAtom("CUT_BUFFER4", 11, 1) != XA_CUT_BUFFER4) AtomError();
+ if (MakeAtom("CUT_BUFFER5", 11, 1) != XA_CUT_BUFFER5) AtomError();
+ if (MakeAtom("CUT_BUFFER6", 11, 1) != XA_CUT_BUFFER6) AtomError();
+ if (MakeAtom("CUT_BUFFER7", 11, 1) != XA_CUT_BUFFER7) AtomError();
+ if (MakeAtom("DRAWABLE", 8, 1) != XA_DRAWABLE) AtomError();
+ if (MakeAtom("FONT", 4, 1) != XA_FONT) AtomError();
+ if (MakeAtom("INTEGER", 7, 1) != XA_INTEGER) AtomError();
+ if (MakeAtom("PIXMAP", 6, 1) != XA_PIXMAP) AtomError();
+ if (MakeAtom("POINT", 5, 1) != XA_POINT) AtomError();
+ if (MakeAtom("RECTANGLE", 9, 1) != XA_RECTANGLE) AtomError();
+ if (MakeAtom("RESOURCE_MANAGER", 16, 1) != XA_RESOURCE_MANAGER) AtomError();
+ if (MakeAtom("RGB_COLOR_MAP", 13, 1) != XA_RGB_COLOR_MAP) AtomError();
+ if (MakeAtom("RGB_BEST_MAP", 12, 1) != XA_RGB_BEST_MAP) AtomError();
+ if (MakeAtom("RGB_BLUE_MAP", 12, 1) != XA_RGB_BLUE_MAP) AtomError();
+ if (MakeAtom("RGB_DEFAULT_MAP", 15, 1) != XA_RGB_DEFAULT_MAP) AtomError();
+ if (MakeAtom("RGB_GRAY_MAP", 12, 1) != XA_RGB_GRAY_MAP) AtomError();
+ if (MakeAtom("RGB_GREEN_MAP", 13, 1) != XA_RGB_GREEN_MAP) AtomError();
+ if (MakeAtom("RGB_RED_MAP", 11, 1) != XA_RGB_RED_MAP) AtomError();
+ if (MakeAtom("STRING", 6, 1) != XA_STRING) AtomError();
+ if (MakeAtom("VISUALID", 8, 1) != XA_VISUALID) AtomError();
+ if (MakeAtom("WINDOW", 6, 1) != XA_WINDOW) AtomError();
+ if (MakeAtom("WM_COMMAND", 10, 1) != XA_WM_COMMAND) AtomError();
+ if (MakeAtom("WM_HINTS", 8, 1) != XA_WM_HINTS) AtomError();
+ if (MakeAtom("WM_CLIENT_MACHINE", 17, 1) != XA_WM_CLIENT_MACHINE) AtomError();
+ if (MakeAtom("WM_ICON_NAME", 12, 1) != XA_WM_ICON_NAME) AtomError();
+ if (MakeAtom("WM_ICON_SIZE", 12, 1) != XA_WM_ICON_SIZE) AtomError();
+ if (MakeAtom("WM_NAME", 7, 1) != XA_WM_NAME) AtomError();
+ if (MakeAtom("WM_NORMAL_HINTS", 15, 1) != XA_WM_NORMAL_HINTS) AtomError();
+ if (MakeAtom("WM_SIZE_HINTS", 13, 1) != XA_WM_SIZE_HINTS) AtomError();
+ if (MakeAtom("WM_ZOOM_HINTS", 13, 1) != XA_WM_ZOOM_HINTS) AtomError();
+ if (MakeAtom("MIN_SPACE", 9, 1) != XA_MIN_SPACE) AtomError();
+ if (MakeAtom("NORM_SPACE", 10, 1) != XA_NORM_SPACE) AtomError();
+ if (MakeAtom("MAX_SPACE", 9, 1) != XA_MAX_SPACE) AtomError();
+ if (MakeAtom("END_SPACE", 9, 1) != XA_END_SPACE) AtomError();
+ if (MakeAtom("SUPERSCRIPT_X", 13, 1) != XA_SUPERSCRIPT_X) AtomError();
+ if (MakeAtom("SUPERSCRIPT_Y", 13, 1) != XA_SUPERSCRIPT_Y) AtomError();
+ if (MakeAtom("SUBSCRIPT_X", 11, 1) != XA_SUBSCRIPT_X) AtomError();
+ if (MakeAtom("SUBSCRIPT_Y", 11, 1) != XA_SUBSCRIPT_Y) AtomError();
+ if (MakeAtom("UNDERLINE_POSITION", 18, 1) != XA_UNDERLINE_POSITION) AtomError();
+ if (MakeAtom("UNDERLINE_THICKNESS", 19, 1) != XA_UNDERLINE_THICKNESS) AtomError();
+ if (MakeAtom("STRIKEOUT_ASCENT", 16, 1) != XA_STRIKEOUT_ASCENT) AtomError();
+ if (MakeAtom("STRIKEOUT_DESCENT", 17, 1) != XA_STRIKEOUT_DESCENT) AtomError();
+ if (MakeAtom("ITALIC_ANGLE", 12, 1) != XA_ITALIC_ANGLE) AtomError();
+ if (MakeAtom("X_HEIGHT", 8, 1) != XA_X_HEIGHT) AtomError();
+ if (MakeAtom("QUAD_WIDTH", 10, 1) != XA_QUAD_WIDTH) AtomError();
+ if (MakeAtom("WEIGHT", 6, 1) != XA_WEIGHT) AtomError();
+ if (MakeAtom("POINT_SIZE", 10, 1) != XA_POINT_SIZE) AtomError();
+ if (MakeAtom("RESOLUTION", 10, 1) != XA_RESOLUTION) AtomError();
+ if (MakeAtom("COPYRIGHT", 9, 1) != XA_COPYRIGHT) AtomError();
+ if (MakeAtom("NOTICE", 6, 1) != XA_NOTICE) AtomError();
+ if (MakeAtom("FONT_NAME", 9, 1) != XA_FONT_NAME) AtomError();
+ if (MakeAtom("FAMILY_NAME", 11, 1) != XA_FAMILY_NAME) AtomError();
+ if (MakeAtom("FULL_NAME", 9, 1) != XA_FULL_NAME) AtomError();
+ if (MakeAtom("CAP_HEIGHT", 10, 1) != XA_CAP_HEIGHT) AtomError();
+ if (MakeAtom("WM_CLASS", 8, 1) != XA_WM_CLASS) AtomError();
+ if (MakeAtom("WM_TRANSIENT_FOR", 16, 1) != XA_WM_TRANSIENT_FOR) AtomError();
+}
diff --git a/xc/programs/Xserver/dix/main.c b/xc/programs/Xserver/dix/main.c
new file mode 100644
index 000000000..d6b41ac43
--- /dev/null
+++ b/xc/programs/Xserver/dix/main.c
@@ -0,0 +1,820 @@
+/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.26 1999/04/11 13:10:40 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $TOG: main.c /main/86 1998/02/09 14:20:03 kaleb $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xos.h" /* for unistd.h */
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "extension.h"
+#ifndef PANORAMIX
+#include "extnsionst.h"
+#endif
+#include "colormap.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "font.h"
+#include "opaque.h"
+#include "servermd.h"
+#include "site.h"
+#include "dixfont.h"
+#ifndef PANORAMIX
+#include "dixevents.h" /* InitEvents() */
+#include "dispatch.h" /* InitProcVectors() */
+#endif
+
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include "dpms.h"
+#endif
+
+void ddxGiveUp();
+
+extern int InitClientPrivates(
+#if NeedFunctionPrototypes
+ ClientPtr /*client*/
+#endif
+);
+
+extern void Dispatch(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern char *display;
+char *ConnectionInfo;
+xConnSetupPrefix connSetupPrefix;
+
+extern WindowPtr *WindowTable;
+extern FontPtr defaultFont;
+extern int screenPrivateCount;
+
+extern void InitProcVectors();
+extern void InitEvents();
+extern void DefineInitialRootWindow();
+extern Bool CreateGCperDepthArray();
+
+#ifndef PANORAMIX
+static
+#endif
+Bool CreateConnectionBlock(void);
+
+static void FreeScreen(ScreenPtr);
+
+PaddingInfo PixmapWidthPaddingInfo[33];
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+/* add padding info for 32-bit interface. PutImage and GetImage will
+ * work on 32-bit padding while the rest of the server will work
+ * on 64-bit padding (Alpha).
+ */
+PaddingInfo PixmapWidthPaddingInfoProto[33];
+#endif
+
+int connBlockScreenStart;
+
+static int restart = 0;
+
+/*
+ * Dummy entry for EventSwapVector[]
+ */
+/*ARGSUSED*/
+void
+NotImplemented(
+#if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR)
+ xEvent * from,
+ xEvent * to
+#endif
+ )
+{
+ FatalError("Not implemented");
+}
+
+/*
+ * Dummy entry for ReplySwapVector[]
+ */
+/*ARGSUSED*/
+void
+ReplyNotSwappd(
+#if NeedNestedPrototypes
+ ClientPtr pClient ,
+ int size ,
+ void * pbuf
+#endif
+ )
+{
+ FatalError("Not implemented");
+}
+
+/*
+ * This array encodes the answer to the question "what is the log base 2
+ * of the number of pixels that fit in a scanline pad unit?"
+ * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
+ */
+static int answer[6][4] = {
+ /* pad pad pad pad*/
+ /* 8 16 32 64 */
+
+ { 3, 4, 5 , 6 }, /* 1 bit per pixel */
+ { 1, 2, 3 , 4 }, /* 4 bits per pixel */
+ { 0, 1, 2 , 3 }, /* 8 bits per pixel */
+ { ~0, 0, 1 , 2 }, /* 16 bits per pixel */
+ { ~0, ~0, 0 , 1 }, /* 24 bits per pixel */
+ { ~0, ~0, 0 , 1 } /* 32 bits per pixel */
+};
+
+/*
+ * This array gives the answer to the question "what is the first index for
+ * the answer array above given the number of bits per pixel?"
+ * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
+ */
+static int indexForBitsPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 1, ~0, ~0, ~0, /* 4 bits per pixel */
+ 2, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 4, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 5 /* 32 bits per pixel */
+};
+
+/*
+ * This array gives the bytesperPixel value for cases where the number
+ * of bits per pixel is a multiple of 8 but not a power of 2.
+ */
+static int answerBytesPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 0, ~0, ~0, ~0, /* 4 bits per pixel */
+ 0, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0 /* 32 bits per pixel */
+};
+
+/*
+ * This array gives the answer to the question "what is the second index for
+ * the answer array above given the number of bits per scanline pad unit?"
+ * Note that ~0 is an invalid entry (mostly for the benefit of the reader).
+ */
+static int indexForScanlinePad[ 65 ] = {
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ ~0, ~0, ~0, ~0,
+ 3 /* 64 bits per scanline pad unit */
+};
+
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int i, j, k, error;
+ HWEventQueueType alwaysCheckForInput[2];
+
+ /* Notice if we're restarted. Probably this is because we jumped through
+ * an uninitialized pointer */
+ if (restart)
+ FatalError("server restarted. Jumped through uninitialized pointer?\n");
+ else
+ restart = 1;
+
+#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
+ ExpandCommandLine(&argc, &argv);
+#endif
+
+ InitConnectionLimits();
+
+ /* These are needed by some routines which are called from interrupt
+ * handlers, thus have no direct calling path back to main and thus
+ * can't be passed argc, argv as parameters */
+ argcGlobal = argc;
+ argvGlobal = argv;
+ display = "0";
+ ProcessCommandLine(argc, argv);
+
+ alwaysCheckForInput[0] = 0;
+ alwaysCheckForInput[1] = 1;
+ while(1)
+ {
+ serverGeneration++;
+ ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+#ifdef DPMSExtension
+ DPMSStandbyTime = defaultDPMSStandbyTime;
+ DPMSSuspendTime = defaultDPMSSuspendTime;
+ DPMSOffTime = defaultDPMSOffTime;
+ DPMSEnabled = defaultDPMSEnabled;
+ DPMSPowerLevel = 0;
+#endif
+ InitBlockAndWakeupHandlers();
+ /* Perform any operating system dependent initializations you'd like */
+ OsInit();
+ if(serverGeneration == 1)
+ {
+ CreateWellKnownSockets();
+ InitProcVectors();
+ clients = (ClientPtr *)xalloc(MAXCLIENTS * sizeof(ClientPtr));
+ if (!clients)
+ FatalError("couldn't create client array");
+ for (i=1; i<MAXCLIENTS; i++)
+ clients[i] = NullClient;
+ serverClient = (ClientPtr)xalloc(sizeof(ClientRec));
+ if (!serverClient)
+ FatalError("couldn't create server client");
+ InitClient(serverClient, 0, (pointer)NULL);
+ }
+ else
+ ResetWellKnownSockets ();
+ clients[0] = serverClient;
+ currentMaxClients = 1;
+
+ if (!InitClientResources(serverClient)) /* for root resources */
+ FatalError("couldn't init server resources");
+
+ SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
+ screenInfo.arraySize = MAXSCREENS;
+ screenInfo.numScreens = 0;
+ screenInfo.numVideoScreens = -1;
+ WindowTable = (WindowPtr *)xalloc(MAXSCREENS * sizeof(WindowPtr));
+ if (!WindowTable)
+ FatalError("couldn't create root window table");
+
+ /*
+ * Just in case the ddx doesnt supply a format for depth 1 (like qvss).
+ */
+ j = indexForBitsPerPixel[ 1 ];
+ k = indexForScanlinePad[ BITMAP_SCANLINE_PAD ];
+ PixmapWidthPaddingInfo[1].padRoundUp = BITMAP_SCANLINE_PAD-1;
+ PixmapWidthPaddingInfo[1].padPixelsLog2 = answer[j][k];
+ j = indexForBitsPerPixel[8]; /* bits per byte */
+ PixmapWidthPaddingInfo[1].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[1].bitsPerPixel = 1;
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* Fake out protocol interface to make them believe we support
+ * a different padding than the actual internal padding.
+ */
+ j = indexForBitsPerPixel[ 1 ];
+ k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
+ PixmapWidthPaddingInfoProto[1].padRoundUp = BITMAP_SCANLINE_PAD_PROTO-1;
+ PixmapWidthPaddingInfoProto[1].padPixelsLog2 = answer[j][k];
+ j = indexForBitsPerPixel[8]; /* bits per byte */
+ PixmapWidthPaddingInfoProto[1].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[1].bitsPerPixel = 1;
+#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+
+ InitAtoms();
+ InitEvents();
+ InitGlyphCaching();
+ ResetClientPrivates();
+ ResetScreenPrivates();
+ ResetWindowPrivates();
+ ResetGCPrivates();
+#ifdef PIXPRIV
+ ResetPixmapPrivates();
+#endif
+ ResetColormapPrivates();
+ ResetFontPrivateIndex();
+ InitCallbackManager();
+ InitVisualWrap();
+ InitOutput(&screenInfo, argc, argv);
+ if (screenInfo.numScreens < 1)
+ FatalError("no screens found");
+ if (screenInfo.numVideoScreens < 0)
+ screenInfo.numVideoScreens = screenInfo.numScreens;
+#ifdef XPRINT
+ PrinterInitOutput(&screenInfo, argc, argv);
+#endif
+ InitExtensions(argc, argv);
+ if (!InitClientPrivates(serverClient))
+ FatalError("failed to allocate serverClient devprivates");
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ if (!CreateScratchPixmapsForScreen(i))
+ FatalError("failed to create scratch pixmaps");
+ if (pScreen->CreateScreenResources &&
+ !(*pScreen->CreateScreenResources)(pScreen))
+ FatalError("failed to create screen resources");
+ if (!CreateGCperDepth(i))
+ FatalError("failed to create scratch GCs");
+ if (!CreateDefaultStipple(i))
+ FatalError("failed to create default stipple");
+ if (!CreateRootWindow(pScreen))
+ FatalError("failed to create root window");
+ }
+ InitInput(argc, argv);
+ if (InitAndStartDevices() != Success)
+ FatalError("failed to initialize core devices");
+
+ InitFonts();
+ if (loadableFonts) {
+ SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
+ } else {
+ if (SetDefaultFontPath(defaultFontPath) != Success)
+ ErrorF("failed to set default font path '%s'",
+ defaultFontPath);
+ }
+ if (!SetDefaultFont(defaultTextFont))
+ FatalError("could not open default font '%s'", defaultTextFont);
+ if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
+ FatalError("could not open default cursor font '%s'",
+ defaultCursorFont);
+#ifdef DPMSExtension
+ /* check all screens, looking for DPMS Capabilities */
+ DPMSCapableFlag = DPMSSupported();
+ if (!DPMSCapableFlag)
+ DPMSEnabled = FALSE;
+#endif
+
+#ifdef PANORAMIX
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
+#endif
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ InitRootWindow(WindowTable[i]);
+ DefineInitialRootWindow(WindowTable[0]);
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock())
+ FatalError("could not create connection block info");
+ if (!PanoramiXCreateScreenRegion(WindowTable[0]))
+ FatalError("could not create PanoramiX Screen Region");
+ } else
+#endif
+ {
+ if (!CreateConnectionBlock())
+ FatalError("could not create connection block info");
+ }
+
+ Dispatch();
+
+ /* Now free up whatever must be freed */
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ CloseDownExtensions();
+
+#ifdef PANORAMIX
+ {
+ Bool remember_it = noPanoramiXExtension;
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
+#else
+ FreeAllResources();
+#endif
+
+ CloseDownDevices();
+ for (i = screenInfo.numScreens - 1; i >= 0; i--)
+ {
+ FreeScratchPixmapsForScreen(i);
+ FreeGCperDepth(i);
+ FreeDefaultStipple(i);
+ (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
+ FreeScreen(screenInfo.screens[i]);
+ screenInfo.numScreens = i;
+ }
+ xfree(WindowTable);
+ FreeFonts ();
+ xfree(serverClient->devPrivates);
+
+ if (dispatchException & DE_TERMINATE)
+ {
+ CloseWellKnownConnections();
+ OsCleanup();
+ ddxGiveUp();
+ break;
+ }
+
+ xfree(ConnectionInfo);
+ }
+ return(0);
+}
+
+static int padlength[4] = {0, 3, 2, 1};
+
+#ifndef PANORAMIX
+static
+#endif
+Bool
+CreateConnectionBlock()
+{
+ xConnSetup setup;
+ xWindowRoot root;
+ xDepth depth;
+ xVisualType visual;
+ xPixmapFormat format;
+ unsigned long vid;
+ int i, j, k,
+ lenofblock,
+ sizesofar = 0;
+ char *pBuf;
+
+
+ /* Leave off the ridBase and ridMask, these must be sent with
+ connection */
+
+ setup.release = VENDOR_RELEASE;
+ /*
+ * per-server image and bitmap parameters are defined in Xmd.h
+ */
+ setup.imageByteOrder = screenInfo.imageByteOrder;
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if ( screenInfo.bitmapScanlineUnit > 32 )
+ setup.bitmapScanlineUnit = 32;
+ else
+#endif
+ setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if ( screenInfo.bitmapScanlinePad > 32 )
+ setup.bitmapScanlinePad = 32;
+ else
+#endif
+ setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
+
+ setup.bitmapBitOrder = screenInfo.bitmapBitOrder;
+ setup.motionBufferSize = NumMotionEvents();
+ setup.numRoots = screenInfo.numScreens;
+ setup.nbytesVendor = strlen(VENDOR_STRING);
+ setup.numFormats = screenInfo.numPixmapFormats;
+ setup.maxRequestSize = MAX_REQUEST_SIZE;
+ QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode);
+
+ lenofblock = sizeof(xConnSetup) +
+ ((setup.nbytesVendor + 3) & ~3) +
+ (setup.numFormats * sizeof(xPixmapFormat)) +
+ (setup.numRoots * sizeof(xWindowRoot));
+ ConnectionInfo = (char *) xalloc(lenofblock);
+ if (!ConnectionInfo)
+ return FALSE;
+
+ memmove(ConnectionInfo, (char *)&setup, sizeof(xConnSetup));
+ sizesofar = sizeof(xConnSetup);
+ pBuf = ConnectionInfo + sizeof(xConnSetup);
+
+ memmove(pBuf, VENDOR_STRING, (int)setup.nbytesVendor);
+ sizesofar += setup.nbytesVendor;
+ pBuf += setup.nbytesVendor;
+ i = padlength[setup.nbytesVendor & 3];
+ sizesofar += i;
+ while (--i >= 0)
+ *pBuf++ = 0;
+
+ for (i=0; i<screenInfo.numPixmapFormats; i++)
+ {
+ format.depth = screenInfo.formats[i].depth;
+ format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ if ( screenInfo.formats[i].scanlinePad > 32 )
+ format.scanLinePad = 32;
+ else
+#endif
+ format.scanLinePad = screenInfo.formats[i].scanlinePad;
+ memmove(pBuf, (char *)&format, sizeof(xPixmapFormat));
+ pBuf += sizeof(xPixmapFormat);
+ sizesofar += sizeof(xPixmapFormat);
+ }
+
+ connBlockScreenStart = sizesofar;
+ for (i=0; i<screenInfo.numScreens; i++)
+ {
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ VisualPtr pVisual;
+
+ pScreen = screenInfo.screens[i];
+ root.windowId = WindowTable[i]->drawable.id;
+ root.defaultColormap = pScreen->defColormap;
+ root.whitePixel = pScreen->whitePixel;
+ root.blackPixel = pScreen->blackPixel;
+ root.currentInputMask = 0; /* filled in when sent */
+ root.pixWidth = pScreen->width;
+ root.pixHeight = pScreen->height;
+ root.mmWidth = pScreen->mmWidth;
+ root.mmHeight = pScreen->mmHeight;
+ root.minInstalledMaps = pScreen->minInstalledCmaps;
+ root.maxInstalledMaps = pScreen->maxInstalledCmaps;
+ root.rootVisualID = pScreen->rootVisual;
+ root.backingStore = pScreen->backingStoreSupport;
+ root.saveUnders = pScreen->saveUnderSupport != NotUseful;
+ root.rootDepth = pScreen->rootDepth;
+ root.nDepths = pScreen->numDepths;
+ memmove(pBuf, (char *)&root, sizeof(xWindowRoot));
+ sizesofar += sizeof(xWindowRoot);
+ pBuf += sizeof(xWindowRoot);
+
+ pDepth = pScreen->allowedDepths;
+ for(j = 0; j < pScreen->numDepths; j++, pDepth++)
+ {
+ lenofblock += sizeof(xDepth) +
+ (pDepth->numVids * sizeof(xVisualType));
+ pBuf = (char *)xrealloc(ConnectionInfo, lenofblock);
+ if (!pBuf)
+ {
+ xfree(ConnectionInfo);
+ return FALSE;
+ }
+ ConnectionInfo = pBuf;
+ pBuf += sizesofar;
+ depth.depth = pDepth->depth;
+ depth.nVisuals = pDepth->numVids;
+ memmove(pBuf, (char *)&depth, sizeof(xDepth));
+ pBuf += sizeof(xDepth);
+ sizesofar += sizeof(xDepth);
+ for(k = 0; k < pDepth->numVids; k++)
+ {
+ vid = pDepth->vids[k];
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != vid;
+ pVisual++)
+ ;
+ visual.visualID = vid;
+ visual.class = pVisual->class;
+ visual.bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual.colormapEntries = pVisual->ColormapEntries;
+ visual.redMask = pVisual->redMask;
+ visual.greenMask = pVisual->greenMask;
+ visual.blueMask = pVisual->blueMask;
+ memmove(pBuf, (char *)&visual, sizeof(xVisualType));
+ pBuf += sizeof(xVisualType);
+ sizesofar += sizeof(xVisualType);
+ }
+ }
+ }
+ connSetupPrefix.success = xTrue;
+ connSetupPrefix.length = lenofblock/4;
+ connSetupPrefix.majorVersion = X_PROTOCOL;
+ connSetupPrefix.minorVersion = X_PROTOCOL_REVISION;
+ return TRUE;
+}
+
+/*
+ grow the array of screenRecs if necessary.
+ call the device-supplied initialization procedure
+with its screen number, a pointer to its ScreenRec, argc, and argv.
+ return the number of successfully installed screens.
+
+*/
+
+int
+#if NeedFunctionPrototypes
+AddScreen(
+ Bool (* pfnInit)(
+#if NeedNestedPrototypes
+ int /*index*/,
+ ScreenPtr /*pScreen*/,
+ int /*argc*/,
+ char ** /*argv*/
+#endif
+ ),
+ int argc,
+ char **argv)
+#else
+AddScreen(pfnInit, argc, argv)
+ Bool (* pfnInit)();
+ int argc;
+ char **argv;
+#endif
+{
+
+ int i;
+ int scanlinepad, format, depth, bitsPerPixel, j, k;
+ ScreenPtr pScreen;
+#ifdef DEBUG
+ void (**jNI) ();
+#endif /* DEBUG */
+
+ i = screenInfo.numScreens;
+ if (i == MAXSCREENS)
+ return -1;
+
+ pScreen = (ScreenPtr) xalloc(sizeof(ScreenRec));
+ if (!pScreen)
+ return -1;
+
+ pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
+ screenPrivateCount);
+ if (!pScreen->devPrivates && screenPrivateCount)
+ {
+ xfree(pScreen);
+ return -1;
+ }
+ pScreen->myNum = i;
+ pScreen->WindowPrivateLen = 0;
+ pScreen->WindowPrivateSizes = (unsigned *)NULL;
+ pScreen->totalWindowSize =
+ ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
+ pScreen->GCPrivateLen = 0;
+ pScreen->GCPrivateSizes = (unsigned *)NULL;
+ pScreen->totalGCSize =
+ ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
+#ifdef PIXPRIV
+ pScreen->PixmapPrivateLen = 0;
+ pScreen->PixmapPrivateSizes = (unsigned *)NULL;
+ pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
+#endif
+ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
+ pScreen->CreateScreenResources = 0;
+
+#ifdef DEBUG
+ for (jNI = &pScreen->QueryBestSize;
+ jNI < (void (**) ()) &pScreen->SendGraphicsExpose;
+ jNI++)
+ *jNI = NotImplemented;
+#endif /* DEBUG */
+
+ /*
+ * This loop gets run once for every Screen that gets added,
+ * but thats ok. If the ddx layer initializes the formats
+ * one at a time calling AddScreen() after each, then each
+ * iteration will make it a little more accurate. Worst case
+ * we do this loop N * numPixmapFormats where N is # of screens.
+ * Anyway, this must be called after InitOutput and before the
+ * screen init routine is called.
+ */
+ for (format=0; format<screenInfo.numPixmapFormats; format++)
+ {
+ depth = screenInfo.formats[format].depth;
+ bitsPerPixel = screenInfo.formats[format].bitsPerPixel;
+ scanlinepad = screenInfo.formats[format].scanlinePad;
+ j = indexForBitsPerPixel[ bitsPerPixel ];
+ k = indexForScanlinePad[ scanlinepad ];
+ PixmapWidthPaddingInfo[ depth ].padPixelsLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[ depth ].padRoundUp =
+ (scanlinepad/bitsPerPixel) - 1;
+ j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
+ PixmapWidthPaddingInfo[ depth ].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
+ if (answerBytesPerPixel[bitsPerPixel])
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 1;
+ PixmapWidthPaddingInfo[ depth ].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
+ else
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 0;
+ }
+
+#ifdef INTERNAL_VS_EXTERNAL_PADDING
+ /* Fake out protocol interface to make them believe we support
+ * a different padding than the actual internal padding.
+ */
+ j = indexForBitsPerPixel[ bitsPerPixel ];
+ k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
+ PixmapWidthPaddingInfoProto[ depth ].padPixelsLog2 = answer[j][k];
+ PixmapWidthPaddingInfoProto[ depth ].padRoundUp =
+ (BITMAP_SCANLINE_PAD_PROTO/bitsPerPixel) - 1;
+ j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
+ PixmapWidthPaddingInfoProto[ depth ].padBytesLog2 = answer[j][k];
+ PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
+ if (answerBytesPerPixel[bitsPerPixel])
+ {
+ PixmapWidthPaddingInfoProto[ depth ].notPower2 = 1;
+ PixmapWidthPaddingInfoProto[ depth ].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
+ else
+ {
+ PixmapWidthPaddingInfoProto[ depth ].notPower2 = 0;
+ }
+#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+ }
+
+ /* This is where screen specific stuff gets initialized. Load the
+ screen structure, call the hardware, whatever.
+ This is also where the default colormap should be allocated and
+ also pixel values for blackPixel, whitePixel, and the cursor
+ Note that InitScreen is NOT allowed to modify argc, argv, or
+ any of the strings pointed to by argv. They may be passed to
+ multiple screens.
+ */
+ pScreen->rgf = ~0L; /* there are no scratch GCs yet*/
+ WindowTable[i] = NullWindow;
+ screenInfo.screens[i] = pScreen;
+ screenInfo.numScreens++;
+ if (!(*pfnInit)(i, pScreen, argc, argv))
+ {
+ FreeScreen(pScreen);
+ screenInfo.numScreens--;
+ return -1;
+ }
+ return i;
+}
+
+static void
+FreeScreen(pScreen)
+ ScreenPtr pScreen;
+{
+ xfree(pScreen->WindowPrivateSizes);
+ xfree(pScreen->GCPrivateSizes);
+#ifdef PIXPRIV
+ xfree(pScreen->PixmapPrivateSizes);
+#endif
+ xfree(pScreen->devPrivates);
+ xfree(pScreen);
+}
diff --git a/xc/programs/Xserver/dix/pixmap.c b/xc/programs/Xserver/dix/pixmap.c
new file mode 100644
index 000000000..424220617
--- /dev/null
+++ b/xc/programs/Xserver/dix/pixmap.c
@@ -0,0 +1,146 @@
+/* $TOG: pixmap.c /main/5 1998/02/09 14:20:10 kaleb $ */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/dix/pixmap.c,v 3.3 1998/10/04 09:38:10 dawes Exp $ */
+
+#include "X.h"
+#include "scrnintstr.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "servermd.h"
+#include "site.h"
+
+
+/*
+ * Scratch pixmap management and device independent pixmap allocation
+ * function.
+ */
+
+
+/* callable by ddx */
+PixmapPtr
+GetScratchPixmapHeader(pScreen, width, height, depth, bitsPerPixel, devKind,
+ pPixData)
+ ScreenPtr pScreen;
+ int width;
+ int height;
+ int depth;
+ int bitsPerPixel;
+ int devKind;
+ pointer pPixData;
+{
+ PixmapPtr pPixmap = pScreen->pScratchPixmap;
+
+ if (pPixmap)
+ pScreen->pScratchPixmap = NULL;
+ else
+ /* width and height of 0 means don't allocate any pixmap data */
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth);
+
+ if (pPixmap) {
+ if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData))
+ return pPixmap;
+ (*pScreen->DestroyPixmap)(pPixmap);
+ }
+ return NullPixmap;
+}
+
+
+/* callable by ddx */
+void
+FreeScratchPixmapHeader(pPixmap)
+ PixmapPtr pPixmap;
+{
+ if (pPixmap)
+ {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+
+ pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */
+ if (pScreen->pScratchPixmap)
+ (*pScreen->DestroyPixmap)(pPixmap);
+ else
+ pScreen->pScratchPixmap = pPixmap;
+ }
+}
+
+
+Bool
+CreateScratchPixmapsForScreen(scrnum)
+ int scrnum;
+{
+ /* let it be created on first use */
+ screenInfo.screens[scrnum]->pScratchPixmap = NULL;
+ return TRUE;
+}
+
+
+void
+FreeScratchPixmapsForScreen(scrnum)
+ int scrnum;
+{
+ FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap);
+}
+
+
+/* callable by ddx */
+PixmapPtr
+AllocatePixmap(pScreen, pixDataSize)
+ ScreenPtr pScreen;
+ int pixDataSize;
+{
+ PixmapPtr pPixmap;
+#ifdef PIXPRIV
+ char *ptr;
+ DevUnion *ppriv;
+ unsigned *sizes;
+ unsigned size;
+ int i;
+
+ pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize);
+ if (!pPixmap)
+ return NullPixmap;
+ ppriv = (DevUnion *)(pPixmap + 1);
+ pPixmap->devPrivates = ppriv;
+ sizes = pScreen->PixmapPrivateSizes;
+ ptr = (char *)(ppriv + pScreen->PixmapPrivateLen);
+ for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ((size = *sizes) != 0)
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+#else
+ pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + pixDataSize);
+#endif
+ return pPixmap;
+}
diff --git a/xc/programs/Xserver/dix/privates.c b/xc/programs/Xserver/dix/privates.c
new file mode 100644
index 000000000..6c7059fa2
--- /dev/null
+++ b/xc/programs/Xserver/dix/privates.c
@@ -0,0 +1,363 @@
+/* $TOG: privates.c /main/6 1998/02/09 14:20:16 kaleb $ */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/dix/privates.c,v 3.5 1998/10/04 09:38:11 dawes Exp $ */
+
+#include "X.h"
+#include "scrnintstr.h"
+#include "misc.h"
+#include "os.h"
+#include "windowstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "colormapst.h"
+#include "servermd.h"
+#include "site.h"
+
+/*
+ * See the Wrappers and devPrivates section in "Definition of the
+ * Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms)
+ * for information on how to use devPrivates.
+ */
+
+/*
+ * client private machinery
+ */
+
+static int clientPrivateCount;
+int clientPrivateLen;
+unsigned *clientPrivateSizes;
+unsigned totalClientSize;
+
+void
+ResetClientPrivates()
+{
+ clientPrivateCount = 0;
+ clientPrivateLen = 0;
+ xfree(clientPrivateSizes);
+ clientPrivateSizes = (unsigned *)NULL;
+ totalClientSize =
+ ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
+}
+
+int
+AllocateClientPrivateIndex()
+{
+ return clientPrivateCount++;
+}
+
+Bool
+AllocateClientPrivate(index2, amount)
+ int index2;
+ unsigned amount;
+{
+ unsigned oldamount;
+
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= clientPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(clientPrivateSizes,
+ (index2 + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (clientPrivateLen <= index2)
+ {
+ nsizes[clientPrivateLen++] = 0;
+ totalClientSize += sizeof(DevUnion);
+ }
+ clientPrivateSizes = nsizes;
+ }
+ oldamount = clientPrivateSizes[index2];
+ if (amount > oldamount)
+ {
+ clientPrivateSizes[index2] = amount;
+ totalClientSize += (amount - oldamount);
+ }
+ return TRUE;
+}
+
+/*
+ * screen private machinery
+ */
+
+int screenPrivateCount;
+
+void
+ResetScreenPrivates()
+{
+ screenPrivateCount = 0;
+}
+
+/* this can be called after some screens have been created,
+ * so we have to worry about resizing existing devPrivates
+ */
+int
+AllocateScreenPrivateIndex()
+{
+ int idx;
+ int i;
+ ScreenPtr pScreen;
+ DevUnion *nprivs;
+
+ idx = screenPrivateCount++;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ nprivs = (DevUnion *)xrealloc(pScreen->devPrivates,
+ screenPrivateCount * sizeof(DevUnion));
+ if (!nprivs)
+ {
+ screenPrivateCount--;
+ return -1;
+ }
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
+ pScreen->devPrivates = nprivs;
+ }
+ return idx;
+}
+
+
+/*
+ * window private machinery
+ */
+
+static int windowPrivateCount;
+
+void
+ResetWindowPrivates()
+{
+ windowPrivateCount = 0;
+}
+
+int
+AllocateWindowPrivateIndex()
+{
+ return windowPrivateCount++;
+}
+
+Bool
+AllocateWindowPrivate(pScreen, index2, amount)
+ register ScreenPtr pScreen;
+ int index2;
+ unsigned amount;
+{
+ unsigned oldamount;
+
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->WindowPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes,
+ (index2 + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (pScreen->WindowPrivateLen <= index2)
+ {
+ nsizes[pScreen->WindowPrivateLen++] = 0;
+ pScreen->totalWindowSize += sizeof(DevUnion);
+ }
+ pScreen->WindowPrivateSizes = nsizes;
+ }
+ oldamount = pScreen->WindowPrivateSizes[index2];
+ if (amount > oldamount)
+ {
+ pScreen->WindowPrivateSizes[index2] = amount;
+ pScreen->totalWindowSize += (amount - oldamount);
+ }
+ return TRUE;
+}
+
+
+/*
+ * gc private machinery
+ */
+
+static int gcPrivateCount;
+
+void
+ResetGCPrivates()
+{
+ gcPrivateCount = 0;
+}
+
+int
+AllocateGCPrivateIndex()
+{
+ return gcPrivateCount++;
+}
+
+Bool
+AllocateGCPrivate(pScreen, index2, amount)
+ register ScreenPtr pScreen;
+ int index2;
+ unsigned amount;
+{
+ unsigned oldamount;
+
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->GCPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes,
+ (index2 + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (pScreen->GCPrivateLen <= index2)
+ {
+ nsizes[pScreen->GCPrivateLen++] = 0;
+ pScreen->totalGCSize += sizeof(DevUnion);
+ }
+ pScreen->GCPrivateSizes = nsizes;
+ }
+ oldamount = pScreen->GCPrivateSizes[index2];
+ if (amount > oldamount)
+ {
+ pScreen->GCPrivateSizes[index2] = amount;
+ pScreen->totalGCSize += (amount - oldamount);
+ }
+ return TRUE;
+}
+
+
+/*
+ * pixmap private machinery
+ */
+#ifdef PIXPRIV
+static int pixmapPrivateCount;
+
+void
+ResetPixmapPrivates()
+{
+ pixmapPrivateCount = 0;
+}
+
+int
+AllocatePixmapPrivateIndex()
+{
+ return pixmapPrivateCount++;
+}
+
+Bool
+AllocatePixmapPrivate(pScreen, index2, amount)
+ register ScreenPtr pScreen;
+ int index2;
+ unsigned amount;
+{
+ unsigned oldamount;
+
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->PixmapPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes,
+ (index2 + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (pScreen->PixmapPrivateLen <= index2)
+ {
+ nsizes[pScreen->PixmapPrivateLen++] = 0;
+ pScreen->totalPixmapSize += sizeof(DevUnion);
+ }
+ pScreen->PixmapPrivateSizes = nsizes;
+ }
+ oldamount = pScreen->PixmapPrivateSizes[index2];
+ if (amount > oldamount)
+ {
+ pScreen->PixmapPrivateSizes[index2] = amount;
+ pScreen->totalPixmapSize += (amount - oldamount);
+ }
+ pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
+ return TRUE;
+}
+#endif
+
+
+/*
+ * colormap private machinery
+ */
+
+int colormapPrivateCount;
+
+void
+ResetColormapPrivates()
+{
+ colormapPrivateCount = 0;
+}
+
+
+int
+AllocateColormapPrivateIndex (initPrivFunc)
+
+InitCmapPrivFunc initPrivFunc;
+
+{
+ int index;
+ int i;
+ ColormapPtr pColormap;
+ DevUnion *privs;
+
+ index = colormapPrivateCount++;
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ /*
+ * AllocateColormapPrivateIndex may be called after the
+ * default colormap has been created on each screen!
+ *
+ * We must resize the devPrivates array for the default
+ * colormap on each screen, making room for this new private.
+ * We also call the initialization function 'initPrivFunc' on
+ * the new private allocated for each default colormap.
+ */
+
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ pColormap = (ColormapPtr) LookupIDByType (
+ pScreen->defColormap, RT_COLORMAP);
+
+ privs = (DevUnion *) xrealloc (pColormap->devPrivates,
+ colormapPrivateCount * sizeof(DevUnion));
+
+ pColormap->devPrivates = privs;
+
+ if (!privs || !(*initPrivFunc)(pColormap))
+ {
+ colormapPrivateCount--;
+ return -1;
+ }
+ }
+
+ return index;
+}
diff --git a/xc/programs/Xserver/dix/property.c b/xc/programs/Xserver/dix/property.c
new file mode 100644
index 000000000..9dbe5bc89
--- /dev/null
+++ b/xc/programs/Xserver/dix/property.c
@@ -0,0 +1,731 @@
+/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.7 1999/01/13 08:30:54 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: property.c /main/42 1998/02/09 14:20:24 kaleb $ */
+
+#include "X.h"
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "dixstruct.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+#if defined(LBX) || defined(LBX_COMPAT)
+int fWriteToClient(client, len, buf)
+ ClientPtr client;
+ int len;
+ char *buf;
+{
+ return WriteToClient(client, len, buf);
+}
+#endif
+
+/*****************************************************************
+ * Property Stuff
+ *
+ * ChangeProperty, DeleteProperty, GetProperties,
+ * ListProperties
+ *
+ * Properties below to windows. A allocate slots each time
+ * a property is added. No fancy searching done.
+ *
+ *****************************************************************/
+
+#ifdef notdef
+static void
+PrintPropertys(pWin)
+ WindowPtr pWin;
+{
+ PropertyPtr pProp;
+ register int j;
+
+ pProp = pWin->userProps;
+ while (pProp)
+ {
+ ErrorF( "%x %x\n", pProp->propertyName, pProp->type);
+ ErrorF("property format: %d\n", pProp->format);
+ ErrorF("property data: \n");
+ for (j=0; j<(pProp->format/8)*pProp->size; j++)
+ ErrorF("%c\n", pProp->data[j]);
+ pProp = pProp->next;
+ }
+}
+#endif
+
+int
+ProcRotateProperties(client)
+ ClientPtr client;
+{
+ int i, j, delta;
+ REQUEST(xRotatePropertiesReq);
+ WindowPtr pWin;
+ register Atom * atoms;
+ PropertyPtr * props; /* array of pointer */
+ PropertyPtr pProp;
+ xEvent event;
+
+ REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
+ UpdateCurrentTime();
+ pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (!stuff->nAtoms)
+ return(Success);
+ atoms = (Atom *) & stuff[1];
+ props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr));
+ if (!props)
+ return(BadAlloc);
+ for (i = 0; i < stuff->nAtoms; i++)
+ {
+#ifdef XCSECURITY
+ char action = SecurityCheckPropertyAccess(client, pWin, atoms[i],
+ SecurityReadAccess|SecurityWriteAccess);
+#endif
+ if (!ValidAtom(atoms[i])
+#ifdef XCSECURITY
+ || (SecurityErrorOperation == action)
+#endif
+ )
+ {
+ DEALLOCATE_LOCAL(props);
+ client->errorValue = atoms[i];
+ return BadAtom;
+ }
+#ifdef XCSECURITY
+ if (SecurityIgnoreOperation == action)
+ {
+ DEALLOCATE_LOCAL(props);
+ return Success;
+ }
+#endif
+ for (j = i + 1; j < stuff->nAtoms; j++)
+ if (atoms[j] == atoms[i])
+ {
+ DEALLOCATE_LOCAL(props);
+ return BadMatch;
+ }
+ pProp = wUserProps (pWin);
+ while (pProp)
+ {
+ if (pProp->propertyName == atoms[i])
+ goto found;
+ pProp = pProp->next;
+ }
+ DEALLOCATE_LOCAL(props);
+ return BadMatch;
+found:
+ props[i] = pProp;
+ }
+ delta = stuff->nPositions;
+
+ /* If the rotation is a complete 360 degrees, then moving the properties
+ around and generating PropertyNotify events should be skipped. */
+
+ if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 )
+ {
+ while (delta < 0) /* faster if abs value is small */
+ delta += stuff->nAtoms;
+ for (i = 0; i < stuff->nAtoms; i++)
+ {
+ /* Generate a PropertyNotify event for each property whose value
+ is changed in the order in which they appear in the request. */
+
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyNewValue;
+ event.u.property.atom = props[i]->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+
+ props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
+ }
+ }
+ DEALLOCATE_LOCAL(props);
+ return Success;
+}
+
+int
+ProcChangeProperty(client)
+ ClientPtr client;
+{
+ WindowPtr pWin;
+ char format, mode;
+ unsigned long len;
+ int sizeInBytes;
+ int totalSize;
+ int err;
+ REQUEST(xChangePropertyReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
+ UpdateCurrentTime();
+ format = stuff->format;
+ mode = stuff->mode;
+ if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
+ (mode != PropModePrepend))
+ {
+ client->errorValue = mode;
+ return BadValue;
+ }
+ if ((format != 8) && (format != 16) && (format != 32))
+ {
+ client->errorValue = format;
+ return BadValue;
+ }
+ len = stuff->nUnits;
+ if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
+ return BadLength;
+ sizeInBytes = format>>3;
+ totalSize = len * sizeInBytes;
+ REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
+
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return(BadAtom);
+ }
+ if (!ValidAtom(stuff->type))
+ {
+ client->errorValue = stuff->type;
+ return(BadAtom);
+ }
+
+#ifdef XCSECURITY
+ switch (SecurityCheckPropertyAccess(client, pWin, stuff->property,
+ SecurityWriteAccess))
+ {
+ case SecurityErrorOperation:
+ client->errorValue = stuff->property;
+ return BadAtom;
+ case SecurityIgnoreOperation:
+ return Success;
+ }
+#endif
+
+#ifdef LBX
+ err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
+ (int)format, (int)mode, len, TRUE, (pointer)&stuff[1], TRUE, NULL);
+#else
+ err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
+ (int)mode, len, (pointer)&stuff[1], TRUE);
+#endif
+ if (err != Success)
+ return err;
+ else
+ return client->noClientException;
+}
+
+int
+ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent)
+ WindowPtr pWin;
+ Atom property, type;
+ int format, mode;
+ unsigned long len;
+ pointer value;
+ Bool sendevent;
+{
+#ifdef LBX
+ return LbxChangeWindowProperty(NULL, pWin, property, type,
+ format, mode, len, TRUE, value,
+ sendevent, NULL);
+#else
+ PropertyPtr pProp;
+ xEvent event;
+ int sizeInBytes;
+ int totalSize;
+ pointer data;
+
+ sizeInBytes = format>>3;
+ totalSize = len * sizeInBytes;
+
+ /* first see if property already exists */
+
+ pProp = wUserProps (pWin);
+ while (pProp)
+ {
+ if (pProp->propertyName == property)
+ break;
+ pProp = pProp->next;
+ }
+ if (!pProp) /* just add to list */
+ {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ return(BadAlloc);
+ pProp = (PropertyPtr)xalloc(sizeof(PropertyRec));
+ if (!pProp)
+ return(BadAlloc);
+ data = (pointer)xalloc(totalSize);
+ if (!data && len)
+ {
+ xfree(pProp);
+ return(BadAlloc);
+ }
+ pProp->propertyName = property;
+ pProp->type = type;
+ pProp->format = format;
+ pProp->data = data;
+ if (len)
+ memmove((char *)data, (char *)value, totalSize);
+ pProp->size = len;
+ pProp->next = pWin->optional->userProps;
+ pWin->optional->userProps = pProp;
+ }
+ else
+ {
+ /* To append or prepend to a property the request format and type
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
+
+ if ((format != pProp->format) && (mode != PropModeReplace))
+ return(BadMatch);
+ if ((pProp->type != type) && (mode != PropModeReplace))
+ return(BadMatch);
+ if (mode == PropModeReplace)
+ {
+ if (totalSize != pProp->size * (pProp->format >> 3))
+ {
+ data = (pointer)xrealloc(pProp->data, totalSize);
+ if (!data && len)
+ return(BadAlloc);
+ pProp->data = data;
+ }
+ if (len)
+ memmove((char *)pProp->data, (char *)value, totalSize);
+ pProp->size = len;
+ pProp->type = type;
+ pProp->format = format;
+ }
+ else if (len == 0)
+ {
+ /* do nothing */
+ }
+ else if (mode == PropModeAppend)
+ {
+ data = (pointer)xrealloc(pProp->data,
+ sizeInBytes * (len + pProp->size));
+ if (!data)
+ return(BadAlloc);
+ pProp->data = data;
+ memmove(&((char *)data)[pProp->size * sizeInBytes],
+ (char *)value,
+ totalSize);
+ pProp->size += len;
+ }
+ else if (mode == PropModePrepend)
+ {
+ data = (pointer)xalloc(sizeInBytes * (len + pProp->size));
+ if (!data)
+ return(BadAlloc);
+ memmove(&((char *)data)[totalSize], (char *)pProp->data,
+ (int)(pProp->size * sizeInBytes));
+ memmove((char *)data, (char *)value, totalSize);
+ xfree(pProp->data);
+ pProp->data = data;
+ pProp->size += len;
+ }
+ }
+ if (sendevent)
+ {
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyNewValue;
+ event.u.property.atom = pProp->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ }
+ return(Success);
+#endif
+}
+
+int
+DeleteProperty(pWin, propName)
+ WindowPtr pWin;
+ Atom propName;
+{
+ PropertyPtr pProp, prevProp;
+ xEvent event;
+
+ if (!(pProp = wUserProps (pWin)))
+ return(Success);
+ prevProp = (PropertyPtr)NULL;
+ while (pProp)
+ {
+ if (pProp->propertyName == propName)
+ break;
+ prevProp = pProp;
+ pProp = pProp->next;
+ }
+ if (pProp)
+ {
+ if (prevProp == (PropertyPtr)NULL) /* takes care of head */
+ {
+ if (!(pWin->optional->userProps = pProp->next))
+ CheckWindowOptionalNeed (pWin);
+ }
+ else
+ {
+ prevProp->next = pProp->next;
+ }
+#ifdef LBX
+ if (pProp->tag_id)
+ TagDeleteTag(pProp->tag_id);
+#endif
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyDelete;
+ event.u.property.atom = pProp->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ xfree(pProp->data);
+ xfree(pProp);
+ }
+ return(Success);
+}
+
+void
+DeleteAllWindowProperties(pWin)
+ WindowPtr pWin;
+{
+ PropertyPtr pProp, pNextProp;
+ xEvent event;
+
+ pProp = wUserProps (pWin);
+ while (pProp)
+ {
+#ifdef LBX
+ if (pProp->tag_id)
+ TagDeleteTag(pProp->tag_id);
+#endif
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyDelete;
+ event.u.property.atom = pProp->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ pNextProp = pProp->next;
+ xfree(pProp->data);
+ xfree(pProp);
+ pProp = pNextProp;
+ }
+}
+
+static int
+NullPropertyReply(client, propertyType, format, reply)
+ ClientPtr client;
+ ATOM propertyType;
+ int format;
+ xGetPropertyReply *reply;
+{
+ reply->nItems = 0;
+ reply->length = 0;
+ reply->bytesAfter = 0;
+ reply->propertyType = propertyType;
+ reply->format = format;
+ WriteReplyToClient(client, sizeof(xGenericReply), reply);
+ return(client->noClientException);
+}
+
+/*****************
+ * GetProperty
+ * If type Any is specified, returns the property from the specified
+ * window regardless of its type. If a type is specified, returns the
+ * property only if its type equals the specified type.
+ * If delete is True and a property is returned, the property is also
+ * deleted from the window and a PropertyNotify event is generated on the
+ * window.
+ *****************/
+
+int
+ProcGetProperty(client)
+ ClientPtr client;
+{
+ PropertyPtr pProp, prevProp;
+ unsigned long n, len, ind;
+ WindowPtr pWin;
+ xGetPropertyReply reply;
+ REQUEST(xGetPropertyReq);
+
+ REQUEST_SIZE_MATCH(xGetPropertyReq);
+ if (stuff->delete)
+ UpdateCurrentTime();
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return BadWindow;
+
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return(BadAtom);
+ }
+ if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
+ {
+ client->errorValue = stuff->delete;
+ return(BadValue);
+ }
+ if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
+ {
+ client->errorValue = stuff->type;
+ return(BadAtom);
+ }
+
+ pProp = wUserProps (pWin);
+ prevProp = (PropertyPtr)NULL;
+ while (pProp)
+ {
+ if (pProp->propertyName == stuff->property)
+ break;
+ prevProp = pProp;
+ pProp = pProp->next;
+ }
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ if (!pProp)
+ return NullPropertyReply(client, None, 0, &reply);
+
+#ifdef XCSECURITY
+ {
+ Mask access_mode = SecurityReadAccess;
+
+ if (stuff->delete)
+ access_mode |= SecurityDestroyAccess;
+ switch(SecurityCheckPropertyAccess(client, pWin, stuff->property,
+ access_mode))
+ {
+ case SecurityErrorOperation:
+ client->errorValue = stuff->property;
+ return BadAtom;;
+ case SecurityIgnoreOperation:
+ return NullPropertyReply(client, pProp->type, pProp->format,
+ &reply);
+ }
+ }
+#endif
+ /* If the request type and actual type don't match. Return the
+ property information, but not the data. */
+
+ if (((stuff->type != pProp->type) &&
+ (stuff->type != AnyPropertyType))
+ )
+ {
+ reply.bytesAfter = pProp->size;
+ reply.format = pProp->format;
+ reply.length = 0;
+ reply.nItems = 0;
+ reply.propertyType = pProp->type;
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+ return(Success);
+ }
+#ifdef LBX
+ /* make sure we have the current value */
+ if (pProp->tag_id && pProp->owner_pid) {
+ LbxStallPropRequest(client, pProp);
+ return client->noClientException;
+ }
+#endif
+
+/*
+ * Return type, format, value to client
+ */
+ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
+ ind = stuff->longOffset << 2;
+
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
+
+ if (n < ind)
+ {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * stuff->longLength);
+
+ reply.bytesAfter = n - (ind + len);
+ reply.format = pProp->format;
+ reply.length = (len + 3) >> 2;
+ reply.nItems = len / (pProp->format / 8 );
+ reply.propertyType = pProp->type;
+
+ if (stuff->delete && (reply.bytesAfter == 0))
+ { /* send the event */
+ xEvent event;
+
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyDelete;
+ event.u.property.atom = pProp->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ }
+
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+ if (len)
+ {
+ switch (reply.format) {
+ case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
+ case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
+ default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
+ }
+ WriteSwappedDataToClient(client, len,
+ (char *)pProp->data + ind);
+ }
+
+ if (stuff->delete && (reply.bytesAfter == 0))
+ { /* delete the Property */
+#ifdef LBX
+ if (pProp->tag_id)
+ TagDeleteTag(pProp->tag_id);
+#endif
+ if (prevProp == (PropertyPtr)NULL) /* takes care of head */
+ {
+ if (!(pWin->optional->userProps = pProp->next))
+ CheckWindowOptionalNeed (pWin);
+ }
+ else
+ prevProp->next = pProp->next;
+ xfree(pProp->data);
+ xfree(pProp);
+ }
+ return(client->noClientException);
+}
+
+int
+ProcListProperties(client)
+ ClientPtr client;
+{
+ Atom *pAtoms, *temppAtoms;
+ xListPropertiesReply xlpr;
+ int numProps = 0;
+ WindowPtr pWin;
+ PropertyPtr pProp;
+ REQUEST(xResourceReq);
+
+ REQUEST_SIZE_MATCH(xResourceReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+
+ pProp = wUserProps (pWin);
+ while (pProp)
+ {
+ pProp = pProp->next;
+ numProps++;
+ }
+ if (numProps)
+ if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
+ return(BadAlloc);
+
+ xlpr.type = X_Reply;
+ xlpr.nProperties = numProps;
+ xlpr.length = (numProps * sizeof(Atom)) >> 2;
+ xlpr.sequenceNumber = client->sequence;
+ pProp = wUserProps (pWin);
+ temppAtoms = pAtoms;
+ while (pProp)
+ {
+ *temppAtoms++ = pProp->propertyName;
+ pProp = pProp->next;
+ }
+ WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
+ if (numProps)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
+ WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
+ DEALLOCATE_LOCAL(pAtoms);
+ }
+ return(client->noClientException);
+}
+
+int
+ProcDeleteProperty(client)
+ register ClientPtr client;
+{
+ WindowPtr pWin;
+ REQUEST(xDeletePropertyReq);
+ int result;
+
+ REQUEST_SIZE_MATCH(xDeletePropertyReq);
+ UpdateCurrentTime();
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ SecurityWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return (BadAtom);
+ }
+
+#ifdef XCSECURITY
+ switch(SecurityCheckPropertyAccess(client, pWin, stuff->property,
+ SecurityDestroyAccess))
+ {
+ case SecurityErrorOperation:
+ client->errorValue = stuff->property;
+ return BadAtom;;
+ case SecurityIgnoreOperation:
+ return Success;
+ }
+#endif
+
+ result = DeleteProperty(pWin, stuff->property);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
diff --git a/xc/programs/Xserver/dix/resource.c b/xc/programs/Xserver/dix/resource.c
new file mode 100644
index 000000000..6cf788ec0
--- /dev/null
+++ b/xc/programs/Xserver/dix/resource.c
@@ -0,0 +1,993 @@
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+
+/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
+
+/* Routines to manage various kinds of resources:
+ *
+ * CreateNewResourceType, CreateNewResourceClass, InitClientResources,
+ * FakeClientID, AddResource, FreeResource, FreeClientResources,
+ * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange
+ */
+
+/*
+ * A resource ID is a 32 bit quantity, the upper 3 bits of which are
+ * off-limits for client-visible resources. The next 7 bits are
+ * used as client ID, and the low 22 bits come from the client.
+ * A resource ID is "hashed" by extracting and xoring subfields
+ * (varying with the size of the hash table).
+ *
+ * It is sometimes necessary for the server to create an ID that looks
+ * like it belongs to a client. This ID, however, must not be one
+ * the client actually can create, or we have the potential for conflict.
+ * The 30th bit of the ID is reserved for the server's use for this
+ * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to
+ * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a
+ * resource "owned" by the client.
+ */
+/* $XFree86: xc/programs/Xserver/dix/resource.c,v 3.5 1999/01/26 10:40:07 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "misc.h"
+#include "os.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "opaque.h"
+#include "windowstr.h"
+#include "dixfont.h"
+#include "colormap.h"
+#include "inputstr.h"
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "cursor.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+extern WindowPtr *WindowTable;
+#include <assert.h>
+
+static void RebuildTable(
+#if NeedFunctionPrototypes
+ int /*client*/
+#endif
+);
+
+#if 0
+/* These should be in a header */
+extern int DeleteWindow(), dixDestroyPixmap(), FreeGC();
+extern int CloseFont(), FreeCursor();
+extern int FreeColormap(), FreeClientPixels();
+extern int OtherClientGone(), DeletePassiveGrab();
+#endif
+
+#define SERVER_MINID 32
+
+#define INITBUCKETS 64
+#define INITHASHSIZE 6
+#define MAXHASHSIZE 11
+
+typedef struct _Resource {
+ struct _Resource *next;
+ XID id;
+ RESTYPE type;
+ pointer value;
+} ResourceRec, *ResourcePtr;
+#define NullResource ((ResourcePtr)NULL)
+
+typedef struct _ClientResource {
+ ResourcePtr *resources;
+ int elements;
+ int buckets;
+ int hashsize; /* log(2)(buckets) */
+ XID fakeID;
+ XID endFakeID;
+ XID expectID;
+} ClientResourceRec;
+
+static RESTYPE lastResourceType;
+static RESTYPE lastResourceClass;
+static RESTYPE TypeMask;
+
+static DeleteType *DeleteFuncs = (DeleteType *)NULL;
+
+RESTYPE
+CreateNewResourceType(deleteFunc)
+ DeleteType deleteFunc;
+{
+ RESTYPE next = lastResourceType + 1;
+ DeleteType *funcs;
+
+ if (next & lastResourceClass)
+ return 0;
+ funcs = (DeleteType *)xrealloc(DeleteFuncs,
+ (next + 1) * sizeof(DeleteType));
+ if (!funcs)
+ return 0;
+ lastResourceType = next;
+ DeleteFuncs = funcs;
+ DeleteFuncs[next] = deleteFunc;
+ return next;
+}
+
+RESTYPE
+CreateNewResourceClass()
+{
+ RESTYPE next = lastResourceClass >> 1;
+
+ if (next & lastResourceType)
+ return 0;
+ lastResourceClass = next;
+ TypeMask = next - 1;
+ return next;
+}
+
+ClientResourceRec clientTable[MAXCLIENTS];
+
+/*****************
+ * InitClientResources
+ * When a new client is created, call this to allocate space
+ * in resource table
+ *****************/
+
+Bool
+InitClientResources(client)
+ ClientPtr client;
+{
+ register int i, j;
+
+ if (client == serverClient)
+ {
+ lastResourceType = RT_LASTPREDEF;
+ lastResourceClass = RC_LASTPREDEF;
+ TypeMask = RC_LASTPREDEF - 1;
+ if (DeleteFuncs)
+ xfree(DeleteFuncs);
+ DeleteFuncs = (DeleteType *)xalloc((lastResourceType + 1) *
+ sizeof(DeleteType));
+ if (!DeleteFuncs)
+ return FALSE;
+ DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA;
+ DeleteFuncs[RT_WINDOW & TypeMask] = DeleteWindow;
+ DeleteFuncs[RT_PIXMAP & TypeMask] = dixDestroyPixmap;
+ DeleteFuncs[RT_GC & TypeMask] = FreeGC;
+ DeleteFuncs[RT_FONT & TypeMask] = CloseFont;
+ DeleteFuncs[RT_CURSOR & TypeMask] = FreeCursor;
+ DeleteFuncs[RT_COLORMAP & TypeMask] = FreeColormap;
+ DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels;
+ DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone;
+ DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
+ }
+ clientTable[i = client->index].resources =
+ (ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr));
+ if (!clientTable[i].resources)
+ return FALSE;
+ clientTable[i].buckets = INITBUCKETS;
+ clientTable[i].elements = 0;
+ clientTable[i].hashsize = INITHASHSIZE;
+ /* Many IDs allocated from the server client are visible to clients,
+ * so we don't use the SERVER_BIT for them, but we have to start
+ * past the magic value constants used in the protocol. For normal
+ * clients, we can start from zero, with SERVER_BIT set.
+ */
+ clientTable[i].fakeID = client->clientAsMask |
+ (client->index ? SERVER_BIT : SERVER_MINID);
+ clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
+ clientTable[i].expectID = client->clientAsMask;
+ for (j=0; j<INITBUCKETS; j++)
+ {
+ clientTable[i].resources[j] = NullResource;
+ }
+ return TRUE;
+}
+
+static int
+#if NeedFunctionPrototypes
+Hash(int client, register XID id)
+#else
+Hash(client, id)
+ int client;
+ register XID id;
+#endif
+{
+ id &= RESOURCE_ID_MASK;
+ switch (clientTable[client].hashsize)
+ {
+ case 6:
+ return ((int)(0x03F & (id ^ (id>>6) ^ (id>>12))));
+ case 7:
+ return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13))));
+ case 8:
+ return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16))));
+ case 9:
+ return ((int)(0x1FF & (id ^ (id>>9))));
+ case 10:
+ return ((int)(0x3FF & (id ^ (id>>10))));
+ case 11:
+ return ((int)(0x7FF & (id ^ (id>>11))));
+ }
+ return -1;
+}
+
+static XID
+#if NeedFunctionPrototypes
+AvailableID(
+ register int client,
+ register XID id,
+ register XID maxid,
+ register XID goodid)
+#else
+AvailableID(client, id, maxid, goodid)
+ register int client;
+ register XID id, maxid, goodid;
+#endif
+{
+ register ResourcePtr res;
+
+ if ((goodid >= id) && (goodid <= maxid))
+ return goodid;
+ for (; id <= maxid; id++)
+ {
+ res = clientTable[client].resources[Hash(client, id)];
+ while (res && (res->id != id))
+ res = res->next;
+ if (!res)
+ return id;
+ }
+ return 0;
+}
+
+void
+GetXIDRange(client, server, minp, maxp)
+ int client;
+ Bool server;
+ XID *minp, *maxp;
+{
+ register XID id, maxid;
+ register ResourcePtr *resp;
+ register ResourcePtr res;
+ register int i;
+ XID goodid;
+
+ id = (Mask)client << CLIENTOFFSET;
+ if (server)
+ id |= client ? SERVER_BIT : SERVER_MINID;
+ maxid = id | RESOURCE_ID_MASK;
+ goodid = 0;
+ for (resp = clientTable[client].resources, i = clientTable[client].buckets;
+ --i >= 0;)
+ {
+ for (res = *resp++; res; res = res->next)
+ {
+ if ((res->id < id) || (res->id > maxid))
+ continue;
+ if (((res->id - id) >= (maxid - res->id)) ?
+ (goodid = AvailableID(client, id, res->id - 1, goodid)) :
+ !(goodid = AvailableID(client, res->id + 1, maxid, goodid)))
+ maxid = res->id - 1;
+ else
+ id = res->id + 1;
+ }
+ }
+ if (id > maxid)
+ id = maxid = 0;
+ *minp = id;
+ *maxp = maxid;
+}
+
+/* GetXIDList is called by the XC-MISC extension's MiscGetXIDList function.
+ * This function tries to find count unused XIDs for the given client. It
+ * puts the IDs in the array pids and returns the number found, which should
+ * almost always be the number requested.
+ *
+ * The circumstances that lead to a call to this function are very rare.
+ * Xlib must run out of IDs while trying to generate a request that wants
+ * multiple ID's, like the Multi-buffering CreateImageBuffers request.
+ *
+ * No rocket science in the implementation; just iterate over all
+ * possible IDs for the given client and pick the first count IDs
+ * that aren't in use. A more efficient algorithm could probably be
+ * invented, but this will be used so rarely that this should suffice.
+ */
+
+unsigned int
+GetXIDList(pClient, count, pids)
+ ClientPtr pClient;
+ unsigned int count;
+ XID *pids;
+{
+ unsigned int found = 0;
+ XID id = pClient->clientAsMask;
+ XID maxid;
+
+ maxid = id | RESOURCE_ID_MASK;
+ while ( (found < count) && (id <= maxid) )
+ {
+ if (!LookupIDByClass(id, RC_ANY))
+ {
+ pids[found++] = id;
+ }
+ id++;
+ }
+ return found;
+}
+
+/*
+ * Return the next usable fake client ID.
+ *
+ * Normally this is just the next one in line, but if we've used the last
+ * in the range, we need to find a new range of safe IDs to avoid
+ * over-running another client.
+ */
+
+XID
+FakeClientID(client)
+ register int client;
+{
+ XID id, maxid;
+
+ id = clientTable[client].fakeID++;
+ if (id != clientTable[client].endFakeID)
+ return id;
+ GetXIDRange(client, TRUE, &id, &maxid);
+ if (!id) {
+ if (!client)
+ FatalError("FakeClientID: server internal ids exhausted\n");
+ MarkClientException(clients[client]);
+ id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3);
+ maxid = id | RESOURCE_ID_MASK;
+ }
+ clientTable[client].fakeID = id + 1;
+ clientTable[client].endFakeID = maxid + 1;
+ return id;
+}
+
+Bool
+AddResource(id, type, value)
+ XID id;
+ RESTYPE type;
+ pointer value;
+{
+ int client;
+ register ClientResourceRec *rrec;
+ register ResourcePtr res, *head;
+
+ client = CLIENT_ID(id);
+ rrec = &clientTable[client];
+ if (!rrec->buckets)
+ {
+ ErrorF("AddResource(%x, %x, %x), client=%d \n",
+ id, type, (unsigned long)value, client);
+ FatalError("client not in use\n");
+ }
+ if ((rrec->elements >= 4*rrec->buckets) &&
+ (rrec->hashsize < MAXHASHSIZE))
+ RebuildTable(client);
+ head = &rrec->resources[Hash(client, id)];
+ res = (ResourcePtr)xalloc(sizeof(ResourceRec));
+ if (!res)
+ {
+ (*DeleteFuncs[type & TypeMask])(value, id);
+ return FALSE;
+ }
+ res->next = *head;
+ res->id = id;
+ res->type = type;
+ res->value = value;
+ *head = res;
+ rrec->elements++;
+ if (!(id & SERVER_BIT) && (id >= rrec->expectID))
+ rrec->expectID = id + 1;
+ return TRUE;
+}
+
+static void
+RebuildTable(client)
+ int client;
+{
+ register int j;
+ register ResourcePtr res, next;
+ ResourcePtr **tails, *resources;
+ register ResourcePtr **tptr, *rptr;
+
+ /*
+ * For now, preserve insertion order, since some ddx layers depend
+ * on resources being free in the opposite order they are added.
+ */
+
+ j = 2 * clientTable[client].buckets;
+ tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *));
+ if (!tails)
+ return;
+ resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr));
+ if (!resources)
+ {
+ DEALLOCATE_LOCAL(tails);
+ return;
+ }
+ for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
+ {
+ *rptr = NullResource;
+ *tptr = rptr;
+ }
+ clientTable[client].hashsize++;
+ for (j = clientTable[client].buckets,
+ rptr = clientTable[client].resources;
+ --j >= 0;
+ rptr++)
+ {
+ for (res = *rptr; res; res = next)
+ {
+ next = res->next;
+ res->next = NullResource;
+ tptr = &tails[Hash(client, res->id)];
+ **tptr = res;
+ *tptr = &res->next;
+ }
+ }
+ DEALLOCATE_LOCAL(tails);
+ clientTable[client].buckets *= 2;
+ xfree(clientTable[client].resources);
+ clientTable[client].resources = resources;
+}
+
+void
+FreeResource(id, skipDeleteFuncType)
+ XID id;
+ RESTYPE skipDeleteFuncType;
+{
+ int cid;
+ register ResourcePtr res;
+ register ResourcePtr *prev, *head;
+ register int *eltptr;
+ int elements;
+ Bool gotOne = FALSE;
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXGC;
+ PanoramiXGC *pPanoramiXGCback = NULL;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+ PanoramiXCmap *pPanoramiXCmap;
+ PanoramiXCmap *pPanoramiXCmapback = NULL;
+ PanoramiXPmap *pPanoramiXPmap;
+ PanoramiXPmap *pPanoramiXPmapback = NULL;
+ XID FreeID, FoundID ;
+ RESTYPE PanoramiXType;
+
+#endif
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+ {
+ head = &clientTable[cid].resources[Hash(cid, id)];
+ eltptr = &clientTable[cid].elements;
+
+ prev = head;
+ while ( (res = *prev) )
+ {
+ if (res->id == id)
+ {
+ RESTYPE rtype = res->type;
+ *prev = res->next;
+ elements = --*eltptr;
+ if (rtype & RC_CACHED)
+ FlushClientCaches(res->id);
+ if (rtype != skipDeleteFuncType)
+ (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ FoundID = 0;
+ FreeID = res->id;
+ PanoramiXType = res->type;
+ PANORAMIX_MARKFREE(FreeID,PanoramiXType);
+ }
+#endif
+ xfree(res);
+ if (*eltptr != elements)
+ prev = head; /* prev may no longer be valid */
+ gotOne = TRUE;
+ }
+ else
+ prev = &res->next;
+ }
+ if(clients[cid] && (id == clients[cid]->lastDrawableID))
+ {
+ clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
+ clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
+ }
+ }
+ if (!gotOne)
+ FatalError("Freeing resource id=%X which isn't there", id);
+}
+
+
+void
+FreeResourceByType(id, type, skipFree)
+ XID id;
+ RESTYPE type;
+ Bool skipFree;
+{
+ int cid;
+ register ResourcePtr res;
+ register ResourcePtr *prev, *head;
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXGC;
+ PanoramiXGC *pPanoramiXGCback = NULL;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+ PanoramiXCmap *pPanoramiXCmap;
+ PanoramiXCmap *pPanoramiXCmapback = NULL;
+ PanoramiXPmap *pPanoramiXPmap;
+ PanoramiXPmap *pPanoramiXPmapback = NULL;
+ XID FreeID, FoundID;
+ RESTYPE PanoramiXType;
+
+#endif
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+ {
+ head = &clientTable[cid].resources[Hash(cid, id)];
+
+ prev = head;
+ while ( (res = *prev) )
+ {
+ if (res->id == id && res->type == type)
+ {
+ *prev = res->next;
+ if (type & RC_CACHED)
+ FlushClientCaches(res->id);
+ if (!skipFree)
+ (*DeleteFuncs[type & TypeMask])(res->value, res->id);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ FoundID = 0;
+ FreeID = res->id;
+ PanoramiXType = res->type;
+ PANORAMIX_MARKFREE(FreeID,PanoramiXType);
+ }
+#endif
+ xfree(res);
+ break;
+ }
+ else
+ prev = &res->next;
+ }
+ if(clients[cid] && (id == clients[cid]->lastDrawableID))
+ {
+ clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
+ clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
+ }
+ }
+}
+
+/*
+ * Change the value associated with a resource id. Caller
+ * is responsible for "doing the right thing" with the old
+ * data
+ */
+
+Bool
+ChangeResourceValue (id, rtype, value)
+ XID id;
+ RESTYPE rtype;
+ pointer value;
+{
+ int cid;
+ register ResourcePtr res;
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
+ {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type == rtype))
+ {
+ if (rtype & RC_CACHED)
+ FlushClientCaches(res->id);
+ res->value = value;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/* Note: if func adds or deletes resources, then func can get called
+ * more than once for some resources. If func adds new resources,
+ * func might or might not get called for them. func cannot both
+ * add and delete an equal number of resources!
+ */
+
+void
+FindClientResourcesByType(client, type, func, cdata)
+ ClientPtr client;
+ RESTYPE type;
+ FindResType func;
+ pointer cdata;
+{
+ register ResourcePtr *resources;
+ register ResourcePtr this, next;
+ int i, elements;
+ register int *eltptr;
+
+ if (!client)
+ client = serverClient;
+
+ resources = clientTable[client->index].resources;
+ eltptr = &clientTable[client->index].elements;
+ for (i = 0; i < clientTable[client->index].buckets; i++)
+ {
+ for (this = resources[i]; this; this = next)
+ {
+ next = this->next;
+ if (!type || this->type == type) {
+ elements = *eltptr;
+ (*func)(this->value, this->id, cdata);
+ if (*eltptr != elements)
+ next = resources[i]; /* start over */
+ }
+ }
+ }
+}
+
+void
+FreeClientNeverRetainResources(client)
+ ClientPtr client;
+{
+ ResourcePtr *resources;
+ ResourcePtr this;
+ ResourcePtr *prev;
+ int j;
+
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXGC;
+ PanoramiXGC *pPanoramiXGCback = NULL;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+ PanoramiXCmap *pPanoramiXCmap;
+ PanoramiXCmap *pPanoramiXCmapback = NULL;
+ PanoramiXPmap *pPanoramiXPmap;
+ PanoramiXPmap *pPanoramiXPmapback = NULL;
+ XID FreeID, FoundID;
+ RESTYPE PanoramiXType;
+#endif
+
+ if (!client)
+ return;
+
+ resources = clientTable[client->index].resources;
+ for (j=0; j < clientTable[client->index].buckets; j++)
+ {
+ prev = &resources[j];
+ while ( (this = *prev) )
+ {
+ RESTYPE rtype = this->type;
+ if (rtype & RC_NEVERRETAIN)
+ {
+ *prev = this->next;
+ if (rtype & RC_CACHED)
+ FlushClientCaches(this->id);
+ (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ FoundID = 0;
+ FreeID = this->id;
+ PanoramiXType = this->type;
+ PANORAMIX_MARKFREE(FreeID,PanoramiXType);
+ }
+#endif
+ xfree(this);
+ }
+ else
+ prev = &this->next;
+ }
+ }
+}
+
+void
+FreeClientResources(client)
+ ClientPtr client;
+{
+ register ResourcePtr *resources;
+ register ResourcePtr this;
+ int j;
+#ifdef PANORAMIX
+ PanoramiXGC *pPanoramiXGC;
+ PanoramiXGC *pPanoramiXGCback = NULL;
+ PanoramiXWindow *pPanoramiXWin;
+ PanoramiXWindow *pPanoramiXWinback = NULL;
+ PanoramiXCmap *pPanoramiXCmap;
+ PanoramiXCmap *pPanoramiXCmapback = NULL;
+ PanoramiXPmap *pPanoramiXPmap;
+ PanoramiXPmap *pPanoramiXPmapback = NULL;
+ XID FreeID, FoundID = 0;
+ RESTYPE PanoramiXType;
+#endif
+
+ /* This routine shouldn't be called with a null client, but just in
+ case ... */
+
+ if (!client)
+ return;
+
+ HandleSaveSet(client);
+
+ resources = clientTable[client->index].resources;
+ for (j=0; j < clientTable[client->index].buckets; j++)
+ {
+ /* It may seem silly to update the head of this resource list as
+ we delete the members, since the entire list will be deleted any way,
+ but there are some resource deletion functions "FreeClientPixels" for
+ one which do a LookupID on another resource id (a Colormap id in this
+ case), so the resource list must be kept valid up to the point that
+ it is deleted, so every time we delete a resource, we must update the
+ head, just like in FreeResource. I hope that this doesn't slow down
+ mass deletion appreciably. PRH */
+
+ ResourcePtr *head;
+
+ head = &resources[j];
+
+ for (this = *head; this; this = *head)
+ {
+ RESTYPE rtype = this->type;
+ *head = this->next;
+ if (rtype & RC_CACHED)
+ FlushClientCaches(this->id);
+ (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ FoundID = 0;
+ FreeID = this->id;
+ PanoramiXType = this->type;
+ PANORAMIX_MARKFREE(FreeID,PanoramiXType);
+ }
+#endif
+ xfree(this);
+ }
+ }
+ xfree(clientTable[client->index].resources);
+ clientTable[client->index].buckets = 0;
+}
+
+void
+FreeAllResources()
+{
+ int i;
+
+ for (i = currentMaxClients; --i >= 0; )
+ {
+ if (clientTable[i].buckets)
+ FreeClientResources(clients[i]);
+ }
+}
+
+Bool
+LegalNewID(id, client)
+ XID id;
+ register ClientPtr client;
+{
+
+#ifdef PANORAMIX
+ XID minid, maxid;
+
+ if (!noPanoramiXExtension) {
+ minid = client->clientAsMask | (client->index ?
+ SERVER_BIT : SERVER_MINID);
+ maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
+ if ((id >= minid) && (id <= maxid))
+ return TRUE;
+ }
+#endif /* PANORAMIX */
+ return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
+ ((clientTable[client->index].expectID <= id) ||
+ !LookupIDByClass(id, RC_ANY)));
+}
+
+#ifdef XCSECURITY
+
+/* SecurityLookupIDByType and SecurityLookupIDByClass:
+ * These are the heart of the resource ID security system. They take
+ * two additional arguments compared to the old LookupID functions:
+ * the client doing the lookup, and the access mode (see resource.h).
+ * The resource is returned if it exists and the client is allowed access,
+ * else NULL is returned.
+ */
+
+pointer
+SecurityLookupIDByType(client, id, rtype, mode)
+ ClientPtr client;
+ XID id;
+ RESTYPE rtype;
+ Mask mode;
+{
+ int cid;
+ register ResourcePtr res;
+ pointer retval = NULL;
+
+ assert(client == NullClient ||
+ (client->index <= currentMaxClients && clients[client->index] == client));
+ assert( (rtype & TypeMask) <= lastResourceType);
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
+ clientTable[cid].buckets)
+ {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type == rtype))
+ {
+ retval = res->value;
+ break;
+ }
+ }
+ if (retval && client && client->CheckAccess)
+ retval = (* client->CheckAccess)(client, id, rtype, mode, retval);
+ return retval;
+}
+
+
+pointer
+SecurityLookupIDByClass(client, id, classes, mode)
+ ClientPtr client;
+ XID id;
+ RESTYPE classes;
+ Mask mode;
+{
+ int cid;
+ register ResourcePtr res;
+ pointer retval = NULL;
+
+ assert(client == NullClient ||
+ (client->index <= currentMaxClients && clients[client->index] == client));
+ assert (classes >= lastResourceClass);
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
+ clientTable[cid].buckets)
+ {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type & classes))
+ {
+ retval = res->value;
+ break;
+ }
+ }
+ if (retval && client && client->CheckAccess)
+ retval = (* client->CheckAccess)(client, id, res->type, mode, retval);
+ return retval;
+}
+
+/* We can't replace the LookupIDByType and LookupIDByClass functions with
+ * macros because of compatibility with loadable servers.
+ */
+
+pointer
+LookupIDByType(id, rtype)
+ XID id;
+ RESTYPE rtype;
+{
+ return SecurityLookupIDByType(NullClient, id, rtype,
+ SecurityUnknownAccess);
+}
+
+pointer
+LookupIDByClass(id, classes)
+ XID id;
+ RESTYPE classes;
+{
+ return SecurityLookupIDByClass(NullClient, id, classes,
+ SecurityUnknownAccess);
+}
+
+#else /* not XCSECURITY */
+
+/*
+ * LookupIDByType returns the object with the given id and type, else NULL.
+ */
+pointer
+LookupIDByType(id, rtype)
+ XID id;
+ RESTYPE rtype;
+{
+ int cid;
+ register ResourcePtr res;
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
+ clientTable[cid].buckets)
+ {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type == rtype))
+ return res->value;
+ }
+ return (pointer)NULL;
+}
+
+/*
+ * LookupIDByClass returns the object with the given id and any one of the
+ * given classes, else NULL.
+ */
+pointer
+LookupIDByClass(id, classes)
+ XID id;
+ RESTYPE classes;
+{
+ int cid;
+ register ResourcePtr res;
+
+ if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
+ clientTable[cid].buckets)
+ {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if ((res->id == id) && (res->type & classes))
+ return res->value;
+ }
+ return (pointer)NULL;
+}
+
+#endif /* XCSECURITY */
diff --git a/xc/programs/Xserver/dix/swaprep.c b/xc/programs/Xserver/dix/swaprep.c
new file mode 100644
index 000000000..8fe758e8b
--- /dev/null
+++ b/xc/programs/Xserver/dix/swaprep.c
@@ -0,0 +1,1471 @@
+/* $XFree86: xc/programs/Xserver/dix/swaprep.c,v 3.4 1999/08/31 08:39:03 dawes Exp $ */
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* $TOG: swaprep.c /main/26 1998/02/09 14:20:38 kaleb $ */
+
+#include "X.h"
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "fontstruct.h"
+#include "scrnintstr.h"
+#include "swaprep.h"
+#include "globals.h"
+
+static void SwapFontInfo(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */
+#endif
+);
+
+#ifndef LBX
+static void SwapCharInfo(
+#if NeedFunctionPrototypes
+ xCharInfo * /* pInfo */
+#endif
+ );
+
+static void SwapFont(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */,
+ Bool /* hasGlyphs */
+#endif
+ );
+#endif
+
+/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
+void
+Swap32Write(pClient, size, pbuf)
+ ClientPtr pClient;
+ int size; /* in bytes */
+ register CARD32 *pbuf;
+{
+ register int i;
+ register char n;
+
+ size >>= 2;
+ for(i = 0; i < size; i++)
+ /* brackets are mandatory here, because "swapl" macro expands
+ to several statements */
+ {
+ swapl(&pbuf[i], n);
+ }
+ (void)WriteToClient(pClient, size << 2, (char *) pbuf);
+}
+
+void
+CopySwap32Write(pClient, size, pbuf)
+ ClientPtr pClient;
+ int size; /* in bytes */
+ CARD32 *pbuf;
+{
+ int bufsize = size;
+ CARD32 *pbufT;
+ register CARD32 *from, *to, *fromLast, *toLast;
+ CARD32 tmpbuf[1];
+
+ /* Allocate as big a buffer as we can... */
+ while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize)))
+ {
+ bufsize >>= 1;
+ if (bufsize == 4)
+ {
+ pbufT = tmpbuf;
+ break;
+ }
+ }
+
+ /* convert lengths from # of bytes to # of longs */
+ size >>= 2;
+ bufsize >>= 2;
+
+ from = pbuf;
+ fromLast = from + size;
+ while (from < fromLast) {
+ int nbytes;
+ to = pbufT;
+ toLast = to + min (bufsize, fromLast - from);
+ nbytes = (toLast - to) << 2;
+ while (to < toLast) {
+ /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
+ that evaulates its args more than once */
+ cpswapl(*from, *to);
+ from++;
+ to++;
+ }
+ (void)WriteToClient (pClient, nbytes, (char *) pbufT);
+ }
+
+ if (pbufT != tmpbuf)
+ DEALLOCATE_LOCAL ((char *) pbufT);
+}
+
+void
+CopySwap16Write(pClient, size, pbuf)
+ ClientPtr pClient;
+ int size; /* in bytes */
+ short *pbuf;
+{
+ int bufsize = size;
+ short *pbufT;
+ register short *from, *to, *fromLast, *toLast;
+ short tmpbuf[2];
+
+ /* Allocate as big a buffer as we can... */
+ while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize)))
+ {
+ bufsize >>= 1;
+ if (bufsize == 4)
+ {
+ pbufT = tmpbuf;
+ break;
+ }
+ }
+
+ /* convert lengths from # of bytes to # of shorts */
+ size >>= 1;
+ bufsize >>= 1;
+
+ from = pbuf;
+ fromLast = from + size;
+ while (from < fromLast) {
+ int nbytes;
+ to = pbufT;
+ toLast = to + min (bufsize, fromLast - from);
+ nbytes = (toLast - to) << 1;
+ while (to < toLast) {
+ /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
+ that evaulates its args more than once */
+ cpswaps(*from, *to);
+ from++;
+ to++;
+ }
+ (void)WriteToClient (pClient, nbytes, (char *) pbufT);
+ }
+
+ if (pbufT != tmpbuf)
+ DEALLOCATE_LOCAL ((char *) pbufT);
+}
+
+
+/* Extra-small reply */
+void
+SGenericReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGenericReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+/* Extra-large reply */
+void
+SGetWindowAttributesReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetWindowAttributesReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->visualID, n);
+ swaps(&pRep->class, n);
+ swapl(&pRep->backingBitPlanes, n);
+ swapl(&pRep->backingPixel, n);
+ swapl(&pRep->colormap, n);
+ swapl(&pRep->allEventMasks, n);
+ swapl(&pRep->yourEventMask, n);
+ swaps(&pRep->doNotPropagateMask, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetGeometryReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetGeometryReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->root, n);
+ swaps(&pRep->x, n);
+ swaps(&pRep->y, n);
+ swaps(&pRep->width, n);
+ swaps(&pRep->height, n);
+ swaps(&pRep->borderWidth, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SQueryTreeReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryTreeReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->root, n);
+ swapl(&pRep->parent, n);
+ swaps(&pRep->nChildren, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SInternAtomReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xInternAtomReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->atom, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetAtomNameReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetAtomNameReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nameLength, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+
+void
+SGetPropertyReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetPropertyReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->propertyType, n);
+ swapl(&pRep->bytesAfter, n);
+ swapl(&pRep->nItems, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SListPropertiesReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListPropertiesReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nProperties, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetSelectionOwnerReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetSelectionOwnerReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->owner, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+
+void
+SQueryPointerReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryPointerReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->root, n);
+ swapl(&pRep->child, n);
+ swaps(&pRep->rootX, n);
+ swaps(&pRep->rootY, n);
+ swaps(&pRep->winX, n);
+ swaps(&pRep->winY, n);
+ swaps(&pRep->mask, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SwapTimecoord(pCoord)
+ xTimecoord *pCoord;
+{
+ register char n;
+
+ swapl(&pCoord->time, n);
+ swaps(&pCoord->x, n);
+ swaps(&pCoord->y, n);
+}
+
+void
+SwapTimeCoordWrite(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xTimecoord *pRep;
+{
+ int i, n;
+ xTimecoord *pRepT;
+
+ n = size / sizeof(xTimecoord);
+ pRepT = pRep;
+ for(i = 0; i < n; i++)
+ {
+ SwapTimecoord(pRepT);
+ pRepT++;
+ }
+ (void)WriteToClient(pClient, size, (char *) pRep);
+
+}
+void
+SGetMotionEventsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetMotionEventsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->nEvents, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+STranslateCoordsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xTranslateCoordsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->child, n);
+ swaps(&pRep->dstX, n);
+ swaps(&pRep->dstY, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetInputFocusReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetInputFocusReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->focus, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+/* extra long reply */
+void
+SQueryKeymapReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryKeymapReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+#ifndef LBX
+static
+#endif
+void
+SwapCharInfo(pInfo)
+ xCharInfo *pInfo;
+{
+ register char n;
+
+ swaps(&pInfo->leftSideBearing, n);
+ swaps(&pInfo->rightSideBearing, n);
+ swaps(&pInfo->characterWidth, n);
+ swaps(&pInfo->ascent, n);
+ swaps(&pInfo->descent, n);
+ swaps(&pInfo->attributes, n);
+}
+
+static void
+SwapFontInfo(pr)
+ xQueryFontReply *pr;
+{
+ register char n;
+
+ swaps(&pr->minCharOrByte2, n);
+ swaps(&pr->maxCharOrByte2, n);
+ swaps(&pr->defaultChar, n);
+ swaps(&pr->nFontProps, n);
+ swaps(&pr->fontAscent, n);
+ swaps(&pr->fontDescent, n);
+ SwapCharInfo( &pr->minBounds);
+ SwapCharInfo( &pr->maxBounds);
+ swapl(&pr->nCharInfos, n);
+}
+
+#ifndef LBX
+static
+#endif
+void
+SwapFont( pr, hasGlyphs)
+ xQueryFontReply * pr;
+ Bool hasGlyphs;
+{
+ unsigned i;
+ xCharInfo * pxci;
+ unsigned nchars, nprops;
+ char *pby;
+ register char n;
+
+ swaps(&pr->sequenceNumber, n);
+ swapl(&pr->length, n);
+ nchars = pr->nCharInfos;
+ nprops = pr->nFontProps;
+ SwapFontInfo(pr);
+ pby = (char *) &pr[1];
+ /* Font properties are an atom and either an int32 or a CARD32, so
+ * they are always 2 4 byte values */
+ for(i = 0; i < nprops; i++)
+ {
+ swapl(pby, n);
+ pby += 4;
+ swapl(pby, n);
+ pby += 4;
+ }
+ if (hasGlyphs)
+ {
+ pxci = (xCharInfo *)pby;
+ for(i = 0; i< nchars; i++, pxci++)
+ SwapCharInfo(pxci);
+ }
+}
+
+void
+SQueryFontReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryFontReply *pRep;
+{
+ SwapFont(pRep, TRUE);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SQueryTextExtentsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryTextExtentsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->fontAscent, n);
+ swaps(&pRep->fontDescent, n);
+ swaps(&pRep->overallAscent, n);
+ swaps(&pRep->overallDescent, n);
+ swapl(&pRep->overallWidth, n);
+ swapl(&pRep->overallLeft, n);
+ swapl(&pRep->overallRight, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SListFontsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListFontsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nFonts, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SListFontsWithInfoReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListFontsWithInfoReply *pRep;
+{
+ SwapFont((xQueryFontReply *)pRep, FALSE);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetFontPathReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetFontPathReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nPaths, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetImageReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetImageReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->visual, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+ /* Fortunately, image doesn't need swapping */
+}
+
+void
+SListInstalledColormapsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListInstalledColormapsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nColormaps, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SAllocColorReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xAllocColorReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->red, n);
+ swaps(&pRep->green, n);
+ swaps(&pRep->blue, n);
+ swapl(&pRep->pixel, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SAllocNamedColorReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xAllocNamedColorReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->pixel, n);
+ swaps(&pRep->exactRed, n);
+ swaps(&pRep->exactGreen, n);
+ swaps(&pRep->exactBlue, n);
+ swaps(&pRep->screenRed, n);
+ swaps(&pRep->screenGreen, n);
+ swaps(&pRep->screenBlue, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SAllocColorCellsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xAllocColorCellsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nPixels, n);
+ swaps(&pRep->nMasks, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+
+void
+SAllocColorPlanesReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xAllocColorPlanesReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nPixels, n);
+ swapl(&pRep->redMask, n);
+ swapl(&pRep->greenMask, n);
+ swapl(&pRep->blueMask, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SwapRGB(prgb)
+ xrgb *prgb;
+{
+ register char n;
+
+ swaps(&prgb->red, n);
+ swaps(&prgb->green, n);
+ swaps(&prgb->blue, n);
+}
+
+void
+SQColorsExtend(pClient, size, prgb)
+ ClientPtr pClient;
+ int size;
+ xrgb *prgb;
+{
+ int i, n;
+ xrgb *prgbT;
+
+ n = size / sizeof(xrgb);
+ prgbT = prgb;
+ for(i = 0; i < n; i++)
+ {
+ SwapRGB(prgbT);
+ prgbT++;
+ }
+ (void)WriteToClient(pClient, size, (char *) prgb);
+}
+
+void
+SQueryColorsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryColorsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nColors, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SLookupColorReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xLookupColorReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->exactRed, n);
+ swaps(&pRep->exactGreen, n);
+ swaps(&pRep->exactBlue, n);
+ swaps(&pRep->screenRed, n);
+ swaps(&pRep->screenGreen, n);
+ swaps(&pRep->screenBlue, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SQueryBestSizeReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xQueryBestSizeReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->width, n);
+ swaps(&pRep->height, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SListExtensionsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListExtensionsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetKeyboardMappingReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetKeyboardMappingReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetPointerMappingReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetPointerMappingReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetModifierMappingReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetModifierMappingReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetKeyboardControlReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetKeyboardControlReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->ledMask, n);
+ swaps(&pRep->bellPitch, n);
+ swaps(&pRep->bellDuration, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetPointerControlReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetPointerControlReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->accelNumerator, n);
+ swaps(&pRep->accelDenominator, n);
+ swaps(&pRep->threshold, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SGetScreenSaverReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xGetScreenSaverReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->timeout, n);
+ swaps(&pRep->interval, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+void
+SLHostsExtend(pClient, size, buf)
+ ClientPtr pClient;
+ int size;
+ char *buf;
+{
+ char *bufT = buf;
+ char *endbuf = buf + size;
+ while (bufT < endbuf) {
+ xHostEntry *host = (xHostEntry *) bufT;
+ int len = host->length;
+ register char n;
+ swaps (&host->length, n);
+ bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2);
+ }
+ (void)WriteToClient (pClient, size, buf);
+}
+
+void
+SListHostsReply(pClient, size, pRep)
+ ClientPtr pClient;
+ int size;
+ xListHostsReply *pRep;
+{
+ register char n;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swaps(&pRep->nHosts, n);
+ (void)WriteToClient(pClient, size, (char *) pRep);
+}
+
+
+
+void
+SErrorEvent(from, to)
+ xError *from, *to;
+{
+ to->type = X_Error;
+ to->errorCode = from->errorCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->resourceID, to->resourceID);
+ cpswaps(from->minorCode, to->minorCode);
+ to->majorCode = from->majorCode;
+}
+
+void
+SKeyButtonPtrEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.keyButtonPointer.time,
+ to->u.keyButtonPointer.time);
+ cpswapl(from->u.keyButtonPointer.root,
+ to->u.keyButtonPointer.root);
+ cpswapl(from->u.keyButtonPointer.event,
+ to->u.keyButtonPointer.event);
+ cpswapl(from->u.keyButtonPointer.child,
+ to->u.keyButtonPointer.child);
+ cpswaps(from->u.keyButtonPointer.rootX,
+ to->u.keyButtonPointer.rootX);
+ cpswaps(from->u.keyButtonPointer.rootY,
+ to->u.keyButtonPointer.rootY);
+ cpswaps(from->u.keyButtonPointer.eventX,
+ to->u.keyButtonPointer.eventX);
+ cpswaps(from->u.keyButtonPointer.eventY,
+ to->u.keyButtonPointer.eventY);
+ cpswaps(from->u.keyButtonPointer.state,
+ to->u.keyButtonPointer.state);
+ to->u.keyButtonPointer.sameScreen =
+ from->u.keyButtonPointer.sameScreen;
+}
+
+void
+SEnterLeaveEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.enterLeave.time, to->u.enterLeave.time);
+ cpswapl(from->u.enterLeave.root, to->u.enterLeave.root);
+ cpswapl(from->u.enterLeave.event, to->u.enterLeave.event);
+ cpswapl(from->u.enterLeave.child, to->u.enterLeave.child);
+ cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX);
+ cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY);
+ cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX);
+ cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY);
+ cpswaps(from->u.enterLeave.state, to->u.enterLeave.state);
+ to->u.enterLeave.mode = from->u.enterLeave.mode;
+ to->u.enterLeave.flags = from->u.enterLeave.flags;
+}
+
+void
+SFocusEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.focus.window, to->u.focus.window);
+ to->u.focus.mode = from->u.focus.mode;
+}
+
+void
+SExposeEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.expose.window, to->u.expose.window);
+ cpswaps(from->u.expose.x, to->u.expose.x);
+ cpswaps(from->u.expose.y, to->u.expose.y);
+ cpswaps(from->u.expose.width, to->u.expose.width);
+ cpswaps(from->u.expose.height, to->u.expose.height);
+ cpswaps(from->u.expose.count, to->u.expose.count);
+}
+
+void
+SGraphicsExposureEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.graphicsExposure.drawable,
+ to->u.graphicsExposure.drawable);
+ cpswaps(from->u.graphicsExposure.x,
+ to->u.graphicsExposure.x);
+ cpswaps(from->u.graphicsExposure.y,
+ to->u.graphicsExposure.y);
+ cpswaps(from->u.graphicsExposure.width,
+ to->u.graphicsExposure.width);
+ cpswaps(from->u.graphicsExposure.height,
+ to->u.graphicsExposure.height);
+ cpswaps(from->u.graphicsExposure.minorEvent,
+ to->u.graphicsExposure.minorEvent);
+ cpswaps(from->u.graphicsExposure.count,
+ to->u.graphicsExposure.count);
+ to->u.graphicsExposure.majorEvent =
+ from->u.graphicsExposure.majorEvent;
+}
+
+void
+SNoExposureEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable);
+ cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent);
+ to->u.noExposure.majorEvent = from->u.noExposure.majorEvent;
+}
+
+void
+SVisibilityEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.visibility.window, to->u.visibility.window);
+ to->u.visibility.state = from->u.visibility.state;
+}
+
+void
+SCreateNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.createNotify.window, to->u.createNotify.window);
+ cpswapl(from->u.createNotify.parent, to->u.createNotify.parent);
+ cpswaps(from->u.createNotify.x, to->u.createNotify.x);
+ cpswaps(from->u.createNotify.y, to->u.createNotify.y);
+ cpswaps(from->u.createNotify.width, to->u.createNotify.width);
+ cpswaps(from->u.createNotify.height, to->u.createNotify.height);
+ cpswaps(from->u.createNotify.borderWidth,
+ to->u.createNotify.borderWidth);
+ to->u.createNotify.override = from->u.createNotify.override;
+}
+
+void
+SDestroyNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event);
+ cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window);
+}
+
+void
+SUnmapNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event);
+ cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window);
+ to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure;
+}
+
+void
+SMapNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.mapNotify.event, to->u.mapNotify.event);
+ cpswapl(from->u.mapNotify.window, to->u.mapNotify.window);
+ to->u.mapNotify.override = from->u.mapNotify.override;
+}
+
+void
+SMapRequestEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent);
+ cpswapl(from->u.mapRequest.window, to->u.mapRequest.window);
+}
+
+void
+SReparentEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.reparent.event, to->u.reparent.event);
+ cpswapl(from->u.reparent.window, to->u.reparent.window);
+ cpswapl(from->u.reparent.parent, to->u.reparent.parent);
+ cpswaps(from->u.reparent.x, to->u.reparent.x);
+ cpswaps(from->u.reparent.y, to->u.reparent.y);
+ to->u.reparent.override = from->u.reparent.override;
+}
+
+void
+SConfigureNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.configureNotify.event,
+ to->u.configureNotify.event);
+ cpswapl(from->u.configureNotify.window,
+ to->u.configureNotify.window);
+ cpswapl(from->u.configureNotify.aboveSibling,
+ to->u.configureNotify.aboveSibling);
+ cpswaps(from->u.configureNotify.x, to->u.configureNotify.x);
+ cpswaps(from->u.configureNotify.y, to->u.configureNotify.y);
+ cpswaps(from->u.configureNotify.width, to->u.configureNotify.width);
+ cpswaps(from->u.configureNotify.height,
+ to->u.configureNotify.height);
+ cpswaps(from->u.configureNotify.borderWidth,
+ to->u.configureNotify.borderWidth);
+ to->u.configureNotify.override = from->u.configureNotify.override;
+}
+
+void
+SConfigureRequestEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail; /* actually stack-mode */
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.configureRequest.parent,
+ to->u.configureRequest.parent);
+ cpswapl(from->u.configureRequest.window,
+ to->u.configureRequest.window);
+ cpswapl(from->u.configureRequest.sibling,
+ to->u.configureRequest.sibling);
+ cpswaps(from->u.configureRequest.x, to->u.configureRequest.x);
+ cpswaps(from->u.configureRequest.y, to->u.configureRequest.y);
+ cpswaps(from->u.configureRequest.width,
+ to->u.configureRequest.width);
+ cpswaps(from->u.configureRequest.height,
+ to->u.configureRequest.height);
+ cpswaps(from->u.configureRequest.borderWidth,
+ to->u.configureRequest.borderWidth);
+ cpswaps(from->u.configureRequest.valueMask,
+ to->u.configureRequest.valueMask);
+}
+
+
+void
+SGravityEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.gravity.event, to->u.gravity.event);
+ cpswapl(from->u.gravity.window, to->u.gravity.window);
+ cpswaps(from->u.gravity.x, to->u.gravity.x);
+ cpswaps(from->u.gravity.y, to->u.gravity.y);
+}
+
+void
+SResizeRequestEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window);
+ cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width);
+ cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height);
+}
+
+void
+SCirculateEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.circulate.event, to->u.circulate.event);
+ cpswapl(from->u.circulate.window, to->u.circulate.window);
+ cpswapl(from->u.circulate.parent, to->u.circulate.parent);
+ to->u.circulate.place = from->u.circulate.place;
+}
+
+void
+SPropertyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.property.window, to->u.property.window);
+ cpswapl(from->u.property.atom, to->u.property.atom);
+ cpswapl(from->u.property.time, to->u.property.time);
+ to->u.property.state = from->u.property.state;
+}
+
+void
+SSelectionClearEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.selectionClear.time, to->u.selectionClear.time);
+ cpswapl(from->u.selectionClear.window, to->u.selectionClear.window);
+ cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom);
+}
+
+void
+SSelectionRequestEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time);
+ cpswapl(from->u.selectionRequest.owner,
+ to->u.selectionRequest.owner);
+ cpswapl(from->u.selectionRequest.requestor,
+ to->u.selectionRequest.requestor);
+ cpswapl(from->u.selectionRequest.selection,
+ to->u.selectionRequest.selection);
+ cpswapl(from->u.selectionRequest.target,
+ to->u.selectionRequest.target);
+ cpswapl(from->u.selectionRequest.property,
+ to->u.selectionRequest.property);
+}
+
+void
+SSelectionNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time);
+ cpswapl(from->u.selectionNotify.requestor,
+ to->u.selectionNotify.requestor);
+ cpswapl(from->u.selectionNotify.selection,
+ to->u.selectionNotify.selection);
+ cpswapl(from->u.selectionNotify.target,
+ to->u.selectionNotify.target);
+ cpswapl(from->u.selectionNotify.property,
+ to->u.selectionNotify.property);
+}
+
+void
+SColormapEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.colormap.window, to->u.colormap.window);
+ cpswapl(from->u.colormap.colormap, to->u.colormap.colormap);
+ to->u.colormap.new = from->u.colormap.new;
+ to->u.colormap.state = from->u.colormap.state;
+}
+
+void
+SMappingEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ to->u.mappingNotify.request = from->u.mappingNotify.request;
+ to->u.mappingNotify.firstKeyCode =
+ from->u.mappingNotify.firstKeyCode;
+ to->u.mappingNotify.count = from->u.mappingNotify.count;
+}
+
+void
+SClientMessageEvent(from, to)
+ xEvent *from, *to;
+{
+ to->u.u.type = from->u.u.type;
+ to->u.u.detail = from->u.u.detail; /* actually format */
+ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
+ cpswapl(from->u.clientMessage.window, to->u.clientMessage.window);
+ cpswapl(from->u.clientMessage.u.l.type,
+ to->u.clientMessage.u.l.type);
+ switch (from->u.u.detail) {
+ case 8:
+ memmove(to->u.clientMessage.u.b.bytes,
+ from->u.clientMessage.u.b.bytes,20);
+ break;
+ case 16:
+ cpswaps(from->u.clientMessage.u.s.shorts0,
+ to->u.clientMessage.u.s.shorts0);
+ cpswaps(from->u.clientMessage.u.s.shorts1,
+ to->u.clientMessage.u.s.shorts1);
+ cpswaps(from->u.clientMessage.u.s.shorts2,
+ to->u.clientMessage.u.s.shorts2);
+ cpswaps(from->u.clientMessage.u.s.shorts3,
+ to->u.clientMessage.u.s.shorts3);
+ cpswaps(from->u.clientMessage.u.s.shorts4,
+ to->u.clientMessage.u.s.shorts4);
+ cpswaps(from->u.clientMessage.u.s.shorts5,
+ to->u.clientMessage.u.s.shorts5);
+ cpswaps(from->u.clientMessage.u.s.shorts6,
+ to->u.clientMessage.u.s.shorts6);
+ cpswaps(from->u.clientMessage.u.s.shorts7,
+ to->u.clientMessage.u.s.shorts7);
+ cpswaps(from->u.clientMessage.u.s.shorts8,
+ to->u.clientMessage.u.s.shorts8);
+ cpswaps(from->u.clientMessage.u.s.shorts9,
+ to->u.clientMessage.u.s.shorts9);
+ break;
+ case 32:
+ cpswapl(from->u.clientMessage.u.l.longs0,
+ to->u.clientMessage.u.l.longs0);
+ cpswapl(from->u.clientMessage.u.l.longs1,
+ to->u.clientMessage.u.l.longs1);
+ cpswapl(from->u.clientMessage.u.l.longs2,
+ to->u.clientMessage.u.l.longs2);
+ cpswapl(from->u.clientMessage.u.l.longs3,
+ to->u.clientMessage.u.l.longs3);
+ cpswapl(from->u.clientMessage.u.l.longs4,
+ to->u.clientMessage.u.l.longs4);
+ break;
+ }
+}
+
+void
+SKeymapNotifyEvent(from, to)
+ xEvent *from, *to;
+{
+ /* Keymap notify events are special; they have no
+ sequence number field, and contain entirely 8-bit data */
+ *to = *from;
+}
+
+void
+SwapConnSetupInfo(pInfo, pInfoTBase)
+ char *pInfo;
+ char *pInfoTBase;
+{
+ int i, j, k;
+ ScreenPtr pScreen;
+ DepthPtr pDepth;
+ char *pInfoT;
+ xConnSetup *pConnSetup = (xConnSetup *)pInfo;
+ int numScreens;
+
+ pInfoT = pInfoTBase;
+ SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
+ pInfo += sizeof(xConnSetup);
+ pInfoT += sizeof(xConnSetup);
+
+ /* Copy the vendor string */
+ i = (pConnSetup->nbytesVendor + 3) & ~3;
+ memmove(pInfoT, pInfo, i);
+ pInfo += i;
+ pInfoT += i;
+
+ /* The Pixmap formats don't need to be swapped, just copied. */
+ i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
+ memmove(pInfoT, pInfo, i);
+ pInfo += i;
+ pInfoT += i;
+
+#ifndef PANORAMIX
+ numScreens = screenInfo.numScreens;
+#else
+ if (noPanoramiXExtension)
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = pConnSetup->numRoots;
+#endif
+
+ for(i = 0; i < numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
+ pInfo += sizeof(xWindowRoot);
+ pInfoT += sizeof(xWindowRoot);
+ pDepth = pScreen->allowedDepths;
+ for(j = 0; j < pScreen->numDepths; j++, pDepth++)
+ {
+ ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
+ cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
+ pInfo += sizeof(xDepth);
+ pInfoT += sizeof(xDepth);
+ for(k = 0; k < pDepth->numVids; k++)
+ {
+ SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
+ pInfo += sizeof(xVisualType);
+ pInfoT += sizeof(xVisualType);
+ }
+ }
+ }
+}
+
+
+void
+WriteSConnectionInfo(pClient, size, pInfo)
+ ClientPtr pClient;
+ unsigned long size;
+ char *pInfo;
+{
+ char *pInfoTBase;
+
+ pInfoTBase = (char *) ALLOCATE_LOCAL(size);
+ if (!pInfoTBase)
+ {
+ pClient->noClientException = -1;
+ return;
+ }
+ SwapConnSetupInfo(pInfo, pInfoTBase);
+ (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
+ DEALLOCATE_LOCAL(pInfoTBase);
+}
+
+void
+SwapConnSetup(pConnSetup, pConnSetupT)
+ xConnSetup *pConnSetup, *pConnSetupT;
+{
+ cpswapl(pConnSetup->release, pConnSetupT->release);
+ cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
+ cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
+ cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
+ cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
+ cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
+ pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
+ pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
+ pConnSetupT->numRoots = pConnSetup->numRoots;
+ pConnSetupT->numFormats = pConnSetup->numFormats;
+ pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
+ pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
+ pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
+ pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
+}
+
+void
+SwapWinRoot(pRoot, pRootT)
+ xWindowRoot *pRoot, *pRootT;
+{
+ cpswapl(pRoot->windowId, pRootT->windowId);
+ cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
+ cpswapl(pRoot->whitePixel, pRootT->whitePixel);
+ cpswapl(pRoot->blackPixel, pRootT->blackPixel);
+ cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
+ cpswaps(pRoot->pixWidth, pRootT->pixWidth);
+ cpswaps(pRoot->pixHeight, pRootT->pixHeight);
+ cpswaps(pRoot->mmWidth, pRootT->mmWidth);
+ cpswaps(pRoot->mmHeight, pRootT->mmHeight);
+ cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
+ cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
+ cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
+ pRootT->backingStore = pRoot->backingStore;
+ pRootT->saveUnders = pRoot->saveUnders;
+ pRootT->rootDepth = pRoot->rootDepth;
+ pRootT->nDepths = pRoot->nDepths;
+}
+
+void
+SwapVisual(pVis, pVisT)
+ xVisualType *pVis, *pVisT;
+{
+ cpswapl(pVis->visualID, pVisT->visualID);
+ pVisT->class = pVis->class;
+ pVisT->bitsPerRGB = pVis->bitsPerRGB;
+ cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
+ cpswapl(pVis->redMask, pVisT->redMask);
+ cpswapl(pVis->greenMask, pVisT->greenMask);
+ cpswapl(pVis->blueMask, pVisT->blueMask);
+}
+
+void
+SwapConnSetupPrefix(pcspFrom, pcspTo)
+ xConnSetupPrefix *pcspFrom;
+ xConnSetupPrefix *pcspTo;
+{
+ pcspTo->success = pcspFrom->success;
+ pcspTo->lengthReason = pcspFrom->lengthReason;
+ cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion);
+ cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion);
+ cpswaps(pcspFrom->length, pcspTo->length);
+}
+
+void
+WriteSConnSetupPrefix(pClient, pcsp)
+ ClientPtr pClient;
+ xConnSetupPrefix *pcsp;
+{
+ xConnSetupPrefix cspT;
+
+ SwapConnSetupPrefix(pcsp, &cspT);
+ (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
+}
diff --git a/xc/programs/Xserver/dix/swapreq.c b/xc/programs/Xserver/dix/swapreq.c
new file mode 100644
index 000000000..abe6b280d
--- /dev/null
+++ b/xc/programs/Xserver/dix/swapreq.c
@@ -0,0 +1,1171 @@
+/* $XFree86: xc/programs/Xserver/dix/swapreq.c,v 3.2 1998/10/04 09:38:15 dawes Exp $ */
+/************************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/* $TOG: swapreq.c /main/20 1998/02/09 14:20:46 kaleb $ */
+
+#include "X.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "Xprotostr.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h" /* for SendEvent */
+#include "swapreq.h"
+
+extern int (* ProcVector[256]) ();
+
+/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
+
+/* Byte swap a list of longs */
+
+void
+SwapLongs (list, count)
+ register CARD32 *list;
+ register unsigned long count;
+{
+ register char n;
+
+ while (count >= 8) {
+ swapl(list+0, n);
+ swapl(list+1, n);
+ swapl(list+2, n);
+ swapl(list+3, n);
+ swapl(list+4, n);
+ swapl(list+5, n);
+ swapl(list+6, n);
+ swapl(list+7, n);
+ list += 8;
+ count -= 8;
+ }
+ if (count != 0) {
+ do {
+ swapl(list, n);
+ list++;
+ } while (--count != 0);
+ }
+}
+
+/* Byte swap a list of shorts */
+
+void
+SwapShorts (list, count)
+ register short *list;
+ register unsigned long count;
+{
+ register char n;
+
+ while (count >= 16) {
+ swaps(list+0, n);
+ swaps(list+1, n);
+ swaps(list+2, n);
+ swaps(list+3, n);
+ swaps(list+4, n);
+ swaps(list+5, n);
+ swaps(list+6, n);
+ swaps(list+7, n);
+ swaps(list+8, n);
+ swaps(list+9, n);
+ swaps(list+10, n);
+ swaps(list+11, n);
+ swaps(list+12, n);
+ swaps(list+13, n);
+ swaps(list+14, n);
+ swaps(list+15, n);
+ list += 16;
+ count -= 16;
+ }
+ if (count != 0) {
+ do {
+ swaps(list, n);
+ list++;
+ } while (--count != 0);
+ }
+}
+
+/* The following is used for all requests that have
+ no fields to be swapped (except "length") */
+int
+SProcSimpleReq(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xReq);
+ swaps(&stuff->length, n);
+ return(*ProcVector[stuff->reqType])(client);
+}
+
+/* The following is used for all requests that have
+ only a single 32-bit field to be swapped, coming
+ right after the "length" field */
+int
+SProcResourceReq(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xResourceReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */
+ swapl(&stuff->id, n);
+ return(*ProcVector[stuff->reqType])(client);
+}
+
+int
+SProcCreateWindow(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xCreateWindowReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
+ swapl(&stuff->wid, n);
+ swapl(&stuff->parent, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swaps(&stuff->borderWidth, n);
+ swaps(&stuff->class, n);
+ swapl(&stuff->visual, n);
+ swapl(&stuff->mask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_CreateWindow])(client));
+}
+
+int
+SProcChangeWindowAttributes(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xChangeWindowAttributesReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->valueMask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_ChangeWindowAttributes])(client));
+}
+
+int
+SProcReparentWindow(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xReparentWindowReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xReparentWindowReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->parent, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return((* ProcVector[X_ReparentWindow])(client));
+}
+
+int
+SProcConfigureWindow(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xConfigureWindowReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
+ swapl(&stuff->window, n);
+ swaps(&stuff->mask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_ConfigureWindow])(client));
+
+}
+
+
+int
+SProcInternAtom(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xInternAtomReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xInternAtomReq);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_InternAtom])(client));
+}
+
+int
+SProcChangeProperty(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangePropertyReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->property, n);
+ swapl(&stuff->type, n);
+ swapl(&stuff->nUnits, n);
+ switch ( stuff->format ) {
+ case 8 :
+ break;
+ case 16:
+ SwapRestS(stuff);
+ break;
+ case 32:
+ SwapRestL(stuff);
+ break;
+ }
+ return((* ProcVector[X_ChangeProperty])(client));
+}
+
+int
+SProcDeleteProperty(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xDeletePropertyReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDeletePropertyReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->property, n);
+ return((* ProcVector[X_DeleteProperty])(client));
+
+}
+
+int
+SProcGetProperty(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGetPropertyReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetPropertyReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->property, n);
+ swapl(&stuff->type, n);
+ swapl(&stuff->longOffset, n);
+ swapl(&stuff->longLength, n);
+ return((* ProcVector[X_GetProperty])(client));
+}
+
+int
+SProcSetSelectionOwner(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetSelectionOwnerReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->selection, n);
+ swapl(&stuff->time, n);
+ return((* ProcVector[X_SetSelectionOwner])(client));
+}
+
+int
+SProcConvertSelection(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xConvertSelectionReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xConvertSelectionReq);
+ swapl(&stuff->requestor, n);
+ swapl(&stuff->selection, n);
+ swapl(&stuff->target, n);
+ swapl(&stuff->property, n);
+ swapl(&stuff->time, n);
+ return((* ProcVector[X_ConvertSelection])(client));
+}
+
+int
+SProcSendEvent(client)
+ register ClientPtr client;
+{
+ register char n;
+ xEvent eventT;
+ EventSwapPtr proc;
+ REQUEST(xSendEventReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSendEventReq);
+ swapl(&stuff->destination, n);
+ swapl(&stuff->eventMask, n);
+
+ /* Swap event */
+ proc = EventSwapVector[stuff->event.u.u.type & 0177];
+ if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
+ return (BadValue);
+ (*proc)(&stuff->event, &eventT);
+ stuff->event = eventT;
+
+ return((* ProcVector[X_SendEvent])(client));
+}
+
+int
+SProcGrabPointer(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGrabPointerReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGrabPointerReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->eventMask, n);
+ swapl(&stuff->confineTo, n);
+ swapl(&stuff->cursor, n);
+ swapl(&stuff->time, n);
+ return((* ProcVector[X_GrabPointer])(client));
+}
+
+int
+SProcGrabButton(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGrabButtonReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGrabButtonReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->eventMask, n);
+ swapl(&stuff->confineTo, n);
+ swapl(&stuff->cursor, n);
+ swaps(&stuff->modifiers, n);
+ return((* ProcVector[X_GrabButton])(client));
+}
+
+int
+SProcUngrabButton(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xUngrabButtonReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xUngrabButtonReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ return((* ProcVector[X_UngrabButton])(client));
+}
+
+int
+SProcChangeActivePointerGrab(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangeActivePointerGrabReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
+ swapl(&stuff->cursor, n);
+ swapl(&stuff->time, n);
+ swaps(&stuff->eventMask, n);
+ return((* ProcVector[X_ChangeActivePointerGrab])(client));
+}
+
+int
+SProcGrabKeyboard(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGrabKeyboardReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGrabKeyboardReq);
+ swapl(&stuff->grabWindow, n);
+ swapl(&stuff->time, n);
+ return((* ProcVector[X_GrabKeyboard])(client));
+}
+
+int
+SProcGrabKey(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGrabKeyReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGrabKeyReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ return((* ProcVector[X_GrabKey])(client));
+}
+
+int
+SProcUngrabKey(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xUngrabKeyReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xUngrabKeyReq);
+ swapl(&stuff->grabWindow, n);
+ swaps(&stuff->modifiers, n);
+ return((* ProcVector[X_UngrabKey])(client));
+}
+
+int
+SProcGetMotionEvents(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGetMotionEventsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetMotionEventsReq);
+ swapl(&stuff->window, n);
+ swapl(&stuff->start, n);
+ swapl(&stuff->stop, n);
+ return((* ProcVector[X_GetMotionEvents])(client));
+}
+
+int
+SProcTranslateCoords(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xTranslateCoordsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xTranslateCoordsReq);
+ swapl(&stuff->srcWid, n);
+ swapl(&stuff->dstWid, n);
+ swaps(&stuff->srcX, n);
+ swaps(&stuff->srcY, n);
+ return((* ProcVector[X_TranslateCoords])(client));
+}
+
+int
+SProcWarpPointer(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xWarpPointerReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xWarpPointerReq);
+ swapl(&stuff->srcWid, n);
+ swapl(&stuff->dstWid, n);
+ swaps(&stuff->srcX, n);
+ swaps(&stuff->srcY, n);
+ swaps(&stuff->srcWidth, n);
+ swaps(&stuff->srcHeight, n);
+ swaps(&stuff->dstX, n);
+ swaps(&stuff->dstY, n);
+ return((* ProcVector[X_WarpPointer])(client));
+}
+
+int
+SProcSetInputFocus(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetInputFocusReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSetInputFocusReq);
+ swapl(&stuff->focus, n);
+ swapl(&stuff->time, n);
+ return((* ProcVector[X_SetInputFocus])(client));
+}
+
+int
+SProcOpenFont(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xOpenFontReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xOpenFontReq);
+ swapl(&stuff->fid, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_OpenFont])(client));
+}
+
+int
+SProcListFonts(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xListFontsReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xListFontsReq);
+ swaps(&stuff->maxNames, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_ListFonts])(client));
+}
+
+int
+SProcListFontsWithInfo(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xListFontsWithInfoReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
+ swaps(&stuff->maxNames, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_ListFontsWithInfo])(client));
+}
+
+int
+SProcSetFontPath(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetFontPathReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
+ swaps(&stuff->nFonts, n);
+ return((* ProcVector[X_SetFontPath])(client));
+}
+
+int
+SProcCreatePixmap(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCreatePixmapReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCreatePixmapReq);
+ swapl(&stuff->pid, n);
+ swapl(&stuff->drawable, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ return((* ProcVector[X_CreatePixmap])(client));
+}
+
+int
+SProcCreateGC(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCreateGCReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xCreateGCReq);
+ swapl(&stuff->gc, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->mask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_CreateGC])(client));
+}
+
+int
+SProcChangeGC(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangeGCReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeGCReq);
+ swapl(&stuff->gc, n);
+ swapl(&stuff->mask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_ChangeGC])(client));
+}
+
+int
+SProcCopyGC(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCopyGCReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCopyGCReq);
+ swapl(&stuff->srcGC, n);
+ swapl(&stuff->dstGC, n);
+ swapl(&stuff->mask, n);
+ return((* ProcVector[X_CopyGC])(client));
+}
+
+int
+SProcSetDashes(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetDashesReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSetDashesReq);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->dashOffset, n);
+ swaps(&stuff->nDashes, n);
+ return((* ProcVector[X_SetDashes])(client));
+
+}
+
+int
+SProcSetClipRectangles(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetClipRectanglesReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->xOrigin, n);
+ swaps(&stuff->yOrigin, n);
+ SwapRestS(stuff);
+ return((* ProcVector[X_SetClipRectangles])(client));
+}
+
+int
+SProcClearToBackground(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xClearAreaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xClearAreaReq);
+ swapl(&stuff->window, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ return((* ProcVector[X_ClearArea])(client));
+}
+
+int
+SProcCopyArea(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCopyAreaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCopyAreaReq);
+ swapl(&stuff->srcDrawable, n);
+ swapl(&stuff->dstDrawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->srcX, n);
+ swaps(&stuff->srcY, n);
+ swaps(&stuff->dstX, n);
+ swaps(&stuff->dstY, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ return((* ProcVector[X_CopyArea])(client));
+}
+
+int
+SProcCopyPlane(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCopyPlaneReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCopyPlaneReq);
+ swapl(&stuff->srcDrawable, n);
+ swapl(&stuff->dstDrawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->srcX, n);
+ swaps(&stuff->srcY, n);
+ swaps(&stuff->dstX, n);
+ swaps(&stuff->dstY, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swapl(&stuff->bitPlane, n);
+ return((* ProcVector[X_CopyPlane])(client));
+}
+
+/* The following routine is used for all Poly drawing requests
+ (except FillPoly, which uses a different request format) */
+int
+SProcPoly(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xPolyPointReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xPolyPointReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ SwapRestS(stuff);
+ return((* ProcVector[stuff->reqType])(client));
+}
+
+/* cannot use SProcPoly for this one, because xFillPolyReq
+ is longer than xPolyPointReq, and we don't want to swap
+ the difference as shorts! */
+int
+SProcFillPoly(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xFillPolyReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xFillPolyReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ SwapRestS(stuff);
+ return((* ProcVector[X_FillPoly])(client));
+}
+
+int
+SProcPutImage(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xPutImageReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xPutImageReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swaps(&stuff->dstX, n);
+ swaps(&stuff->dstY, n);
+ /* Image should already be swapped */
+ return((* ProcVector[X_PutImage])(client));
+
+}
+
+int
+SProcGetImage(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xGetImageReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xGetImageReq);
+ swapl(&stuff->drawable, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swapl(&stuff->planeMask, n);
+ return((* ProcVector[X_GetImage])(client));
+}
+
+/* ProcPolyText used for both PolyText8 and PolyText16 */
+
+int
+SProcPolyText(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xPolyTextReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return((* ProcVector[stuff->reqType])(client));
+}
+
+/* ProcImageText used for both ImageText8 and ImageText16 */
+
+int
+SProcImageText(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xImageTextReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xImageTextReq);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->gc, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return((* ProcVector[stuff->reqType])(client));
+}
+
+int
+SProcCreateColormap(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCreateColormapReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCreateColormapReq);
+ swapl(&stuff->mid, n);
+ swapl(&stuff->window, n);
+ swapl(&stuff->visual, n);
+ return((* ProcVector[X_CreateColormap])(client));
+}
+
+
+int
+SProcCopyColormapAndFree(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCopyColormapAndFreeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
+ swapl(&stuff->mid, n);
+ swapl(&stuff->srcCmap, n);
+ return((* ProcVector[X_CopyColormapAndFree])(client));
+
+}
+
+int
+SProcAllocColor (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xAllocColorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xAllocColorReq);
+ swapl(&stuff->cmap, n);
+ swaps(&stuff->red, n);
+ swaps(&stuff->green, n);
+ swaps(&stuff->blue, n);
+ return((* ProcVector[X_AllocColor])(client));
+}
+
+int
+SProcAllocNamedColor (client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xAllocNamedColorReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq);
+ swapl(&stuff->cmap, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_AllocNamedColor])(client));
+}
+
+int
+SProcAllocColorCells (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xAllocColorCellsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xAllocColorCellsReq);
+ swapl(&stuff->cmap, n);
+ swaps(&stuff->colors, n);
+ swaps(&stuff->planes, n);
+ return((* ProcVector[X_AllocColorCells])(client));
+}
+
+int
+SProcAllocColorPlanes(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xAllocColorPlanesReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
+ swapl(&stuff->cmap, n);
+ swaps(&stuff->colors, n);
+ swaps(&stuff->red, n);
+ swaps(&stuff->green, n);
+ swaps(&stuff->blue, n);
+ return((* ProcVector[X_AllocColorPlanes])(client));
+}
+
+int
+SProcFreeColors (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xFreeColorsReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
+ swapl(&stuff->cmap, n);
+ swapl(&stuff->planeMask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_FreeColors])(client));
+
+}
+
+void
+SwapColorItem(pItem)
+ xColorItem *pItem;
+{
+ register char n;
+
+ swapl(&pItem->pixel, n);
+ swaps(&pItem->red, n);
+ swaps(&pItem->green, n);
+ swaps(&pItem->blue, n);
+}
+
+int
+SProcStoreColors (client)
+ register ClientPtr client;
+{
+ register char n;
+ long count;
+ xColorItem *pItem;
+
+ REQUEST(xStoreColorsReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
+ swapl(&stuff->cmap, n);
+ pItem = (xColorItem *) &stuff[1];
+ for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
+ SwapColorItem(pItem++);
+ return((* ProcVector[X_StoreColors])(client));
+}
+
+int
+SProcStoreNamedColor (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xStoreNamedColorReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq);
+ swapl(&stuff->cmap, n);
+ swapl(&stuff->pixel, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_StoreNamedColor])(client));
+}
+
+int
+SProcQueryColors(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xQueryColorsReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
+ swapl(&stuff->cmap, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_QueryColors])(client));
+}
+
+int
+SProcLookupColor(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xLookupColorReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xLookupColorReq);
+ swapl(&stuff->cmap, n);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_LookupColor])(client));
+}
+
+int
+SProcCreateCursor( client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCreateCursorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCreateCursorReq);
+ swapl(&stuff->cid, n);
+ swapl(&stuff->source, n);
+ swapl(&stuff->mask, n);
+ swaps(&stuff->foreRed, n);
+ swaps(&stuff->foreGreen, n);
+ swaps(&stuff->foreBlue, n);
+ swaps(&stuff->backRed, n);
+ swaps(&stuff->backGreen, n);
+ swaps(&stuff->backBlue, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ return((* ProcVector[X_CreateCursor])(client));
+}
+
+int
+SProcCreateGlyphCursor( client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xCreateGlyphCursorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
+ swapl(&stuff->cid, n);
+ swapl(&stuff->source, n);
+ swapl(&stuff->mask, n);
+ swaps(&stuff->sourceChar, n);
+ swaps(&stuff->maskChar, n);
+ swaps(&stuff->foreRed, n);
+ swaps(&stuff->foreGreen, n);
+ swaps(&stuff->foreBlue, n);
+ swaps(&stuff->backRed, n);
+ swaps(&stuff->backGreen, n);
+ swaps(&stuff->backBlue, n);
+ return((* ProcVector[X_CreateGlyphCursor])(client));
+}
+
+
+int
+SProcRecolorCursor(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xRecolorCursorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecolorCursorReq);
+ swapl(&stuff->cursor, n);
+ swaps(&stuff->foreRed, n);
+ swaps(&stuff->foreGreen, n);
+ swaps(&stuff->foreBlue, n);
+ swaps(&stuff->backRed, n);
+ swaps(&stuff->backGreen, n);
+ swaps(&stuff->backBlue, n);
+ return((* ProcVector[X_RecolorCursor])(client));
+}
+
+int
+SProcQueryBestSize (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xQueryBestSizeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xQueryBestSizeReq);
+ swapl(&stuff->drawable, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ return((* ProcVector[X_QueryBestSize])(client));
+
+}
+
+int
+SProcQueryExtension (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xQueryExtensionReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
+ swaps(&stuff->nbytes, n);
+ return((* ProcVector[X_QueryExtension])(client));
+}
+
+int
+SProcChangeKeyboardMapping (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangeKeyboardMappingReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
+ SwapRestL(stuff);
+ return((* ProcVector[X_ChangeKeyboardMapping])(client));
+}
+
+
+int
+SProcChangeKeyboardControl (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangeKeyboardControlReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+ swapl(&stuff->mask, n);
+ SwapRestL(stuff);
+ return((* ProcVector[X_ChangeKeyboardControl])(client));
+}
+
+int
+SProcChangePointerControl (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xChangePointerControlReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xChangePointerControlReq);
+ swaps(&stuff->accelNum, n);
+ swaps(&stuff->accelDenum, n);
+ swaps(&stuff->threshold, n);
+ return((* ProcVector[X_ChangePointerControl])(client));
+}
+
+
+int
+SProcSetScreenSaver (client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xSetScreenSaverReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSetScreenSaverReq);
+ swaps(&stuff->timeout, n);
+ swaps(&stuff->interval, n);
+ return((* ProcVector[X_SetScreenSaver])(client));
+}
+
+int
+SProcChangeHosts(client)
+ register ClientPtr client;
+{
+ register char n;
+
+ REQUEST(xChangeHostsReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xChangeHostsReq);
+ swaps(&stuff->hostLength, n);
+ return((* ProcVector[X_ChangeHosts])(client));
+
+}
+
+int SProcRotateProperties(client)
+ register ClientPtr client;
+{
+ register char n;
+ REQUEST(xRotatePropertiesReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq);
+ swapl(&stuff->window, n);
+ swaps(&stuff->nAtoms, n);
+ swaps(&stuff->nPositions, n);
+ SwapRestL(stuff);
+ return ((* ProcVector[X_RotateProperties])(client));
+}
+
+/*ARGSUSED*/
+int
+SProcNoOperation(client)
+ ClientPtr client;
+{
+ register char n;
+ REQUEST(xReq);
+ swaps(&stuff->length, n);
+ return ((* ProcVector[X_NoOperation])(client));
+}
+
+void
+SwapConnClientPrefix(pCCP)
+ xConnClientPrefix *pCCP;
+{
+ register char n;
+
+ swaps(&pCCP->majorVersion, n);
+ swaps(&pCCP->minorVersion, n);
+ swaps(&pCCP->nbytesAuthProto, n);
+ swaps(&pCCP->nbytesAuthString, n);
+}
diff --git a/xc/programs/Xserver/dix/tables.c b/xc/programs/Xserver/dix/tables.c
new file mode 100644
index 000000000..e524f3593
--- /dev/null
+++ b/xc/programs/Xserver/dix/tables.c
@@ -0,0 +1,526 @@
+/* $XFree86: xc/programs/Xserver/dix/tables.c,v 3.2 1998/10/04 09:38:16 dawes Exp $ */
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: tables.c /main/15 1998/02/09 14:20:53 kaleb $ */
+
+#include "X.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "windowstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
+
+#ifdef K5AUTH
+extern int
+ k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
+#endif
+
+int (* InitialVector[3]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
+{
+ 0,
+ ProcInitialConnection,
+ ProcEstablishConnection
+};
+
+int (* ProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
+{
+ ProcBadRequest,
+ ProcCreateWindow,
+ ProcChangeWindowAttributes,
+ ProcGetWindowAttributes,
+ ProcDestroyWindow,
+ ProcDestroySubwindows, /* 5 */
+ ProcChangeSaveSet,
+ ProcReparentWindow,
+ ProcMapWindow,
+ ProcMapSubwindows,
+ ProcUnmapWindow, /* 10 */
+ ProcUnmapSubwindows,
+ ProcConfigureWindow,
+ ProcCirculateWindow,
+ ProcGetGeometry,
+ ProcQueryTree, /* 15 */
+ ProcInternAtom,
+ ProcGetAtomName,
+ ProcChangeProperty,
+ ProcDeleteProperty,
+ ProcGetProperty, /* 20 */
+ ProcListProperties,
+ ProcSetSelectionOwner,
+ ProcGetSelectionOwner,
+ ProcConvertSelection,
+ ProcSendEvent, /* 25 */
+ ProcGrabPointer,
+ ProcUngrabPointer,
+ ProcGrabButton,
+ ProcUngrabButton,
+ ProcChangeActivePointerGrab, /* 30 */
+ ProcGrabKeyboard,
+ ProcUngrabKeyboard,
+ ProcGrabKey,
+ ProcUngrabKey,
+ ProcAllowEvents, /* 35 */
+ ProcGrabServer,
+ ProcUngrabServer,
+ ProcQueryPointer,
+ ProcGetMotionEvents,
+ ProcTranslateCoords, /* 40 */
+ ProcWarpPointer,
+ ProcSetInputFocus,
+ ProcGetInputFocus,
+ ProcQueryKeymap,
+ ProcOpenFont, /* 45 */
+ ProcCloseFont,
+ ProcQueryFont,
+ ProcQueryTextExtents,
+ ProcListFonts,
+ ProcListFontsWithInfo, /* 50 */
+ ProcSetFontPath,
+ ProcGetFontPath,
+ ProcCreatePixmap,
+ ProcFreePixmap,
+ ProcCreateGC, /* 55 */
+ ProcChangeGC,
+ ProcCopyGC,
+ ProcSetDashes,
+ ProcSetClipRectangles,
+ ProcFreeGC, /* 60 */
+ ProcClearToBackground,
+ ProcCopyArea,
+ ProcCopyPlane,
+ ProcPolyPoint,
+ ProcPolyLine, /* 65 */
+ ProcPolySegment,
+ ProcPolyRectangle,
+ ProcPolyArc,
+ ProcFillPoly,
+ ProcPolyFillRectangle, /* 70 */
+ ProcPolyFillArc,
+ ProcPutImage,
+ ProcGetImage,
+ ProcPolyText,
+ ProcPolyText, /* 75 */
+ ProcImageText8,
+ ProcImageText16,
+ ProcCreateColormap,
+ ProcFreeColormap,
+ ProcCopyColormapAndFree, /* 80 */
+ ProcInstallColormap,
+ ProcUninstallColormap,
+ ProcListInstalledColormaps,
+ ProcAllocColor,
+ ProcAllocNamedColor, /* 85 */
+ ProcAllocColorCells,
+ ProcAllocColorPlanes,
+ ProcFreeColors,
+ ProcStoreColors,
+ ProcStoreNamedColor, /* 90 */
+ ProcQueryColors,
+ ProcLookupColor,
+ ProcCreateCursor,
+ ProcCreateGlyphCursor,
+ ProcFreeCursor, /* 95 */
+ ProcRecolorCursor,
+ ProcQueryBestSize,
+ ProcQueryExtension,
+ ProcListExtensions,
+ ProcChangeKeyboardMapping, /* 100 */
+ ProcGetKeyboardMapping,
+ ProcChangeKeyboardControl,
+ ProcGetKeyboardControl,
+ ProcBell,
+ ProcChangePointerControl, /* 105 */
+ ProcGetPointerControl,
+ ProcSetScreenSaver,
+ ProcGetScreenSaver,
+ ProcChangeHosts,
+ ProcListHosts, /* 110 */
+ ProcChangeAccessControl,
+ ProcChangeCloseDownMode,
+ ProcKillClient,
+ ProcRotateProperties,
+ ProcForceScreenSaver, /* 115 */
+ ProcSetPointerMapping,
+ ProcGetPointerMapping,
+ ProcSetModifierMapping,
+ ProcGetModifierMapping,
+ 0, /* 120 */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* 125 */
+ 0,
+ ProcNoOperation
+};
+
+int (* SwappedProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
+{
+ ProcBadRequest,
+ SProcCreateWindow,
+ SProcChangeWindowAttributes,
+ SProcResourceReq, /* GetWindowAttributes */
+ SProcResourceReq, /* DestroyWindow */
+ SProcResourceReq, /* 5 DestroySubwindows */
+ SProcResourceReq, /* SProcChangeSaveSet, */
+ SProcReparentWindow,
+ SProcResourceReq, /* MapWindow */
+ SProcResourceReq, /* MapSubwindows */
+ SProcResourceReq, /* 10 UnmapWindow */
+ SProcResourceReq, /* UnmapSubwindows */
+ SProcConfigureWindow,
+ SProcResourceReq, /* SProcCirculateWindow, */
+ SProcResourceReq, /* GetGeometry */
+ SProcResourceReq, /* 15 QueryTree */
+ SProcInternAtom,
+ SProcResourceReq, /* SProcGetAtomName, */
+ SProcChangeProperty,
+ SProcDeleteProperty,
+ SProcGetProperty, /* 20 */
+ SProcResourceReq, /* SProcListProperties, */
+ SProcSetSelectionOwner,
+ SProcResourceReq, /* SProcGetSelectionOwner, */
+ SProcConvertSelection,
+ SProcSendEvent, /* 25 */
+ SProcGrabPointer,
+ SProcResourceReq, /* SProcUngrabPointer, */
+ SProcGrabButton,
+ SProcUngrabButton,
+ SProcChangeActivePointerGrab, /* 30 */
+ SProcGrabKeyboard,
+ SProcResourceReq, /* SProcUngrabKeyboard, */
+ SProcGrabKey,
+ SProcUngrabKey,
+ SProcResourceReq, /* 35 SProcAllowEvents, */
+ SProcSimpleReq, /* SProcGrabServer, */
+ SProcSimpleReq, /* SProcUngrabServer, */
+ SProcResourceReq, /* SProcQueryPointer, */
+ SProcGetMotionEvents,
+ SProcTranslateCoords, /*40 */
+ SProcWarpPointer,
+ SProcSetInputFocus,
+ SProcSimpleReq, /* SProcGetInputFocus, */
+ SProcSimpleReq, /* QueryKeymap, */
+ SProcOpenFont, /* 45 */
+ SProcResourceReq, /* SProcCloseFont, */
+ SProcResourceReq, /* SProcQueryFont, */
+ SProcResourceReq, /* SProcQueryTextExtents, */
+ SProcListFonts,
+ SProcListFontsWithInfo, /* 50 */
+ SProcSetFontPath,
+ SProcSimpleReq, /* GetFontPath, */
+ SProcCreatePixmap,
+ SProcResourceReq, /* SProcFreePixmap, */
+ SProcCreateGC, /* 55 */
+ SProcChangeGC,
+ SProcCopyGC,
+ SProcSetDashes,
+ SProcSetClipRectangles,
+ SProcResourceReq, /* 60 SProcFreeGC, */
+ SProcClearToBackground,
+ SProcCopyArea,
+ SProcCopyPlane,
+ SProcPoly, /* PolyPoint, */
+ SProcPoly, /* 65 PolyLine */
+ SProcPoly, /* PolySegment, */
+ SProcPoly, /* PolyRectangle, */
+ SProcPoly, /* PolyArc, */
+ SProcFillPoly,
+ SProcPoly, /* 70 PolyFillRectangle */
+ SProcPoly, /* PolyFillArc, */
+ SProcPutImage,
+ SProcGetImage,
+ SProcPolyText,
+ SProcPolyText, /* 75 */
+ SProcImageText,
+ SProcImageText,
+ SProcCreateColormap,
+ SProcResourceReq, /* SProcFreeColormap, */
+ SProcCopyColormapAndFree, /* 80 */
+ SProcResourceReq, /* SProcInstallColormap, */
+ SProcResourceReq, /* SProcUninstallColormap, */
+ SProcResourceReq, /* SProcListInstalledColormaps, */
+ SProcAllocColor,
+ SProcAllocNamedColor, /* 85 */
+ SProcAllocColorCells,
+ SProcAllocColorPlanes,
+ SProcFreeColors,
+ SProcStoreColors,
+ SProcStoreNamedColor, /* 90 */
+ SProcQueryColors,
+ SProcLookupColor,
+ SProcCreateCursor,
+ SProcCreateGlyphCursor,
+ SProcResourceReq, /* 95 SProcFreeCursor, */
+ SProcRecolorCursor,
+ SProcQueryBestSize,
+ SProcQueryExtension,
+ SProcSimpleReq, /* ListExtensions, */
+ SProcChangeKeyboardMapping, /* 100 */
+ SProcSimpleReq, /* GetKeyboardMapping, */
+ SProcChangeKeyboardControl,
+ SProcSimpleReq, /* GetKeyboardControl, */
+ SProcSimpleReq, /* Bell, */
+ SProcChangePointerControl, /* 105 */
+ SProcSimpleReq, /* GetPointerControl, */
+ SProcSetScreenSaver,
+ SProcSimpleReq, /* GetScreenSaver, */
+ SProcChangeHosts,
+ SProcSimpleReq, /* 110 ListHosts, */
+ SProcSimpleReq, /* SProcChangeAccessControl, */
+ SProcSimpleReq, /* SProcChangeCloseDownMode, */
+ SProcResourceReq, /* SProcKillClient, */
+ SProcRotateProperties,
+ SProcSimpleReq, /* 115 ForceScreenSaver */
+ SProcSimpleReq, /* SetPointerMapping, */
+ SProcSimpleReq, /* GetPointerMapping, */
+ SProcSimpleReq, /* SetModifierMapping, */
+ SProcSimpleReq, /* GetModifierMapping, */
+ 0, /* 120 */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* 125 */
+ 0,
+ SProcNoOperation
+};
+
+EventSwapPtr EventSwapVector[128] =
+{
+ (EventSwapPtr)SErrorEvent,
+ NotImplemented,
+ SKeyButtonPtrEvent,
+ SKeyButtonPtrEvent,
+ SKeyButtonPtrEvent,
+ SKeyButtonPtrEvent, /* 5 */
+ SKeyButtonPtrEvent,
+ SEnterLeaveEvent,
+ SEnterLeaveEvent,
+ SFocusEvent,
+ SFocusEvent, /* 10 */
+ SKeymapNotifyEvent,
+ SExposeEvent,
+ SGraphicsExposureEvent,
+ SNoExposureEvent,
+ SVisibilityEvent, /* 15 */
+ SCreateNotifyEvent,
+ SDestroyNotifyEvent,
+ SUnmapNotifyEvent,
+ SMapNotifyEvent,
+ SMapRequestEvent, /* 20 */
+ SReparentEvent,
+ SConfigureNotifyEvent,
+ SConfigureRequestEvent,
+ SGravityEvent,
+ SResizeRequestEvent, /* 25 */
+ SCirculateEvent,
+ SCirculateEvent,
+ SPropertyEvent,
+ SSelectionClearEvent,
+ SSelectionRequestEvent, /* 30 */
+ SSelectionNotifyEvent,
+ SColormapEvent,
+ SClientMessageEvent,
+ SMappingEvent,
+};
+
+
+ReplySwapPtr ReplySwapVector[256] =
+{
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetWindowAttributesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 5 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 10 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetGeometryReply,
+ (ReplySwapPtr)SQueryTreeReply, /* 15 */
+ (ReplySwapPtr)SInternAtomReply,
+ (ReplySwapPtr)SGetAtomNameReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetPropertyReply, /* 20 */
+ (ReplySwapPtr)SListPropertiesReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetSelectionOwnerReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 25 */
+ (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 30 */
+ (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 35 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryPointerReply,
+ (ReplySwapPtr)SGetMotionEventsReply,
+ (ReplySwapPtr)STranslateCoordsReply, /* 40 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetInputFocusReply,
+ (ReplySwapPtr)SQueryKeymapReply,
+ ReplyNotSwappd, /* 45 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryFontReply,
+ (ReplySwapPtr)SQueryTextExtentsReply,
+ (ReplySwapPtr)SListFontsReply,
+ (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetFontPathReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 55 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 60 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 65 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 70 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetImageReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 75 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 80 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListInstalledColormapsReply,
+ (ReplySwapPtr)SAllocColorReply,
+ (ReplySwapPtr)SAllocNamedColorReply, /* 85 */
+ (ReplySwapPtr)SAllocColorCellsReply,
+ (ReplySwapPtr)SAllocColorPlanesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 90 */
+ (ReplySwapPtr)SQueryColorsReply,
+ (ReplySwapPtr)SLookupColorReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 95 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryBestSizeReply,
+ (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */
+ (ReplySwapPtr)SListExtensionsReply,
+ ReplyNotSwappd, /* 100 */
+ (ReplySwapPtr)SGetKeyboardMappingReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetKeyboardControlReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 105 */
+ (ReplySwapPtr)SGetPointerControlReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetScreenSaverReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListHostsReply, /* 110 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 115 */
+ (ReplySwapPtr)SGenericReply, /* SetPointerMapping */
+ (ReplySwapPtr)SGetPointerMappingReply,
+ (ReplySwapPtr)SGenericReply, /* SetModifierMapping */
+ (ReplySwapPtr)SGetModifierMappingReply, /* 119 */
+ ReplyNotSwappd, /* 120 */
+ ReplyNotSwappd, /* 121 */
+ ReplyNotSwappd, /* 122 */
+ ReplyNotSwappd, /* 123 */
+ ReplyNotSwappd, /* 124 */
+ ReplyNotSwappd, /* 125 */
+ ReplyNotSwappd, /* 126 */
+ ReplyNotSwappd, /* NoOperation */
+ ReplyNotSwappd
+};
+
+#ifdef K5AUTH
+int (*k5_Vector[256])() =
+{
+ k5_bad,
+ k5_stage1,
+ k5_bad,
+ k5_stage3
+};
+#endif
diff --git a/xc/programs/Xserver/dix/window.c b/xc/programs/Xserver/dix/window.c
new file mode 100644
index 000000000..686b261ee
--- /dev/null
+++ b/xc/programs/Xserver/dix/window.c
@@ -0,0 +1,3916 @@
+/* $TOG: window.c /main/215 1998/04/22 16:33:01 msr $ */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/window.c,v 3.13 1999/05/23 06:33:37 dawes Exp $ */
+
+#include "misc.h"
+#include "scrnintstr.h"
+#include "os.h"
+#include "regionstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "input.h"
+#include "resource.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "servermd.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#else
+#include "dixevents.h"
+#endif
+#include "globals.h"
+
+#ifdef XAPPGROUP
+#include "Xagsrv.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
+extern Bool permitOldBugs;
+
+#if defined(NEED_SCREEN_REGIONS)
+#define REGION_PTR(pScreen,pWin) \
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+#else
+#define REGION_PTR(pScreen,pWin) /* nothing */
+#endif
+
+/******
+ * Window stuff for server
+ *
+ * CreateRootWindow, CreateWindow, ChangeWindowAttributes,
+ * GetWindowAttributes, DeleteWindow, DestroySubWindows,
+ * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows,
+ * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow,
+ *
+ ******/
+
+static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
+static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
+
+int screenIsSaved = SCREEN_SAVER_OFF;
+
+ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
+
+extern WindowPtr *WindowTable;
+
+#if 0
+extern void DeleteWindowFromAnyEvents();
+extern Mask EventMaskForClient();
+extern void WindowHasNewCursor();
+extern void RecalculateDeliverableEvents();
+#endif
+extern int rand();
+
+static Bool TileScreenSaver(
+#if NeedFunctionPrototypes
+ int /*i*/,
+ int /*kind*/
+#endif
+);
+
+
+#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
+ CWDontPropagate | CWOverrideRedirect | CWCursor )
+
+#define BOXES_OVERLAP(b1, b2) \
+ (!( ((b1)->x2 <= (b2)->x1) || \
+ ( ((b1)->x1 >= (b2)->x2)) || \
+ ( ((b1)->y2 <= (b2)->y1)) || \
+ ( ((b1)->y1 >= (b2)->y2)) ) )
+
+#define RedirectSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureRedirectMask)
+
+#define SubSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
+
+#define StrSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
+
+#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
+
+
+int numSaveUndersViewable = 0;
+int deltaSaveUndersViewable = 0;
+
+#ifdef DEBUG
+/******
+ * PrintWindowTree
+ * For debugging only
+ ******/
+
+int
+PrintChildren(p1, indent)
+ WindowPtr p1;
+ int indent;
+{
+ WindowPtr p2;
+ int i;
+
+ while (p1)
+ {
+ p2 = p1->firstChild;
+ for (i=0; i<indent; i++) ErrorF( " ");
+ ErrorF( "%x\n", p1->drawable.id);
+ miPrintRegion(&p1->clipList);
+ PrintChildren(p2, indent+4);
+ p1 = p1->nextSib;
+ }
+}
+
+PrintWindowTree()
+{
+ int i;
+ WindowPtr pWin, p1;
+
+ for (i=0; i<screenInfo.numScreens; i++)
+ {
+ ErrorF( "WINDOW %d\n", i);
+ pWin = WindowTable[i];
+ miPrintRegion(&pWin->clipList);
+ p1 = pWin->firstChild;
+ PrintChildren(p1, 4);
+ }
+}
+#endif
+
+#ifdef PANORAMIX
+Bool
+PanoramiXWindowOffScreen(pWin,w, h)
+ register WindowPtr pWin;
+ unsigned short w, h;
+{
+ int Scr;
+
+ Scr = (pWin->drawable.pScreen)->myNum;
+
+ if ((pWin->drawable.x < 0) &&
+ ((pWin->drawable.x + w) < 0))
+ return TRUE;
+ if ((pWin->drawable.x > panoramiXdataPtr[Scr].width) &&
+ ((pWin->drawable.x + w) > panoramiXdataPtr[Scr].width))
+ return TRUE;
+ if ((pWin->drawable.y < 0) &&
+ ((pWin->drawable.y + h) < 0))
+ return TRUE;
+ if ((pWin->drawable.y > panoramiXdataPtr[Scr].height) &&
+ ((pWin->drawable.y + h) > panoramiXdataPtr[Scr].height) )
+ return TRUE;
+
+ return FALSE;
+}
+#endif
+
+int
+TraverseTree(pWin, func, data)
+ register WindowPtr pWin;
+ VisitWindowProcPtr func;
+ pointer data;
+{
+ register int result;
+ register WindowPtr pChild;
+
+ if (!(pChild = pWin))
+ return(WT_NOMATCH);
+ while (1)
+ {
+ result = (* func)(pChild, data);
+ if (result == WT_STOPWALKING)
+ return(WT_STOPWALKING);
+ if ((result == WT_WALKCHILDREN) && pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return(WT_NOMATCH);
+}
+
+/*****
+ * WalkTree
+ * Walk the window tree, for SCREEN, preforming FUNC(pWin, data) on
+ * each window. If FUNC returns WT_WALKCHILDREN, traverse the children,
+ * if it returns WT_DONTWALKCHILDREN, dont. If it returns WT_STOPWALKING
+ * exit WalkTree. Does depth-first traverse.
+ *****/
+
+int
+WalkTree(pScreen, func, data)
+ ScreenPtr pScreen;
+ VisitWindowProcPtr func;
+ pointer data;
+{
+ return(TraverseTree(WindowTable[pScreen->myNum], func, data));
+}
+
+/* hack for forcing backing store on all windows */
+int defaultBackingStore = NotUseful;
+/* hack to force no backing store */
+Bool disableBackingStore = FALSE;
+Bool enableBackingStore = FALSE;
+/* hack to force no save unders */
+Bool disableSaveUnders = FALSE;
+
+static void
+#if NeedFunctionPrototypes
+SetWindowToDefaults(register WindowPtr pWin)
+#else
+SetWindowToDefaults(pWin)
+ register WindowPtr pWin;
+#endif
+{
+ pWin->prevSib = NullWindow;
+ pWin->firstChild = NullWindow;
+ pWin->lastChild = NullWindow;
+
+ pWin->valdata = (ValidatePtr)NULL;
+ pWin->optional = (WindowOptPtr)NULL;
+ pWin->cursorIsNone = TRUE;
+
+ pWin->backingStore = NotUseful;
+ pWin->DIXsaveUnder = FALSE;
+ pWin->backStorage = (pointer) NULL;
+
+ pWin->mapped = FALSE; /* off */
+ pWin->realized = FALSE; /* off */
+ pWin->viewable = FALSE;
+ pWin->visibility = VisibilityNotViewable;
+ pWin->overrideRedirect = FALSE;
+ pWin->saveUnder = FALSE;
+
+ pWin->bitGravity = ForgetGravity;
+ pWin->winGravity = NorthWestGravity;
+
+ pWin->eventMask = 0;
+ pWin->deliverableEvents = 0;
+ pWin->dontPropagate = 0;
+ pWin->forcedBS = FALSE;
+#ifdef NEED_DBE_BUF_BITS
+ pWin->srcBuffer = DBE_FRONT_BUFFER;
+ pWin->dstBuffer = DBE_FRONT_BUFFER;
+#endif
+}
+
+static void
+#if NeedFunctionPrototypes
+MakeRootTile(WindowPtr pWin)
+#else
+MakeRootTile(pWin)
+ WindowPtr pWin;
+#endif
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ GCPtr pGC;
+ unsigned char back[128];
+ int len = BitmapBytePad(sizeof(long));
+ register unsigned char *from, *to;
+ register int i, j;
+
+ pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, len, 4,
+ pScreen->rootDepth);
+
+ pWin->backgroundState = BackgroundPixmap;
+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
+ if (!pWin->background.pixmap || !pGC)
+ FatalError("cound not create root tile");
+
+ {
+ CARD32 attributes[2];
+
+ attributes[0] = pScreen->whitePixel;
+ attributes[1] = pScreen->blackPixel;
+
+ (void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
+ }
+
+ ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
+
+ from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
+ to = back;
+
+ for (i = 4; i > 0; i--, from++)
+ for (j = len; j > 0; j--)
+ *to++ = *from;
+
+ (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
+ 0, 0, len, 4, 0, XYBitmap, (char *)back);
+
+ FreeScratchGC(pGC);
+
+}
+
+WindowPtr
+AllocateWindow(pScreen)
+ ScreenPtr pScreen;
+{
+ WindowPtr pWin;
+ register char *ptr;
+ register DevUnion *ppriv;
+ register unsigned *sizes;
+ register unsigned size;
+ register int i;
+
+ pWin = (WindowPtr)xalloc(pScreen->totalWindowSize);
+ if (pWin)
+ {
+ ppriv = (DevUnion *)(pWin + 1);
+ pWin->devPrivates = ppriv;
+ sizes = pScreen->WindowPrivateSizes;
+ ptr = (char *)(ppriv + pScreen->WindowPrivateLen);
+ for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ( (size = *sizes) )
+ {
+ ppriv->ptr = (pointer)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (pointer)NULL;
+ }
+ }
+ return pWin;
+}
+
+/*****
+ * CreateRootWindow
+ * Makes a window at initialization time for specified screen
+ *****/
+
+Bool
+CreateRootWindow(pScreen)
+ ScreenPtr pScreen;
+{
+ WindowPtr pWin;
+ BoxRec box;
+ PixmapFormatRec *format;
+
+ pWin = AllocateWindow(pScreen);
+ if (!pWin)
+ return FALSE;
+
+ savedScreenInfo[pScreen->myNum].pWindow = NULL;
+ savedScreenInfo[pScreen->myNum].wid = FakeClientID(0);
+ savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
+ screenIsSaved = SCREEN_SAVER_OFF;
+
+ WindowTable[pScreen->myNum] = pWin;
+
+ pWin->drawable.pScreen = pScreen;
+ pWin->drawable.type = DRAWABLE_WINDOW;
+
+ pWin->drawable.depth = pScreen->rootDepth;
+ for (format = screenInfo.formats;
+ format->depth != pScreen->rootDepth;
+ format++)
+ ;
+ pWin->drawable.bitsPerPixel = format->bitsPerPixel;
+
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pWin->parent = NullWindow;
+ SetWindowToDefaults(pWin);
+
+ pWin->optional = (WindowOptRec *) xalloc (sizeof (WindowOptRec));
+ if (!pWin->optional)
+ return FALSE;
+
+ pWin->optional->dontPropagateMask = 0;
+ pWin->optional->otherEventMasks = 0;
+ pWin->optional->otherClients = NULL;
+ pWin->optional->passiveGrabs = NULL;
+ pWin->optional->userProps = NULL;
+ pWin->optional->backingBitPlanes = ~0L;
+ pWin->optional->backingPixel = 0;
+#ifdef SHAPE
+ pWin->optional->boundingShape = NULL;
+ pWin->optional->clipShape = NULL;
+#endif
+#ifdef XINPUT
+ pWin->optional->inputMasks = NULL;
+#endif
+ pWin->optional->colormap = pScreen->defColormap;
+ pWin->optional->visual = pScreen->rootVisual;
+
+ pWin->nextSib = NullWindow;
+
+ pWin->drawable.id = FakeClientID(0);
+
+ pWin->origin.x = pWin->origin.y = 0;
+ pWin->drawable.height = pScreen->height;
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.x = pWin->drawable.y = 0;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT(pScreen, &pWin->clipList, &box, 1);
+ REGION_INIT(pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT(pScreen, &pWin->borderSize, &box, 1);
+ REGION_INIT(pScreen, &pWin->borderClip, &box, 1);
+
+ pWin->drawable.class = InputOutput;
+ pWin->optional->visual = pScreen->rootVisual;
+
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = pScreen->whitePixel;
+
+ pWin->borderIsPixel = TRUE;
+ pWin->border.pixel = pScreen->blackPixel;
+ pWin->borderWidth = 0;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
+ return FALSE;
+
+ if (disableBackingStore)
+ pScreen->backingStoreSupport = NotUseful;
+ if (enableBackingStore)
+ pScreen->backingStoreSupport = Always;
+
+#ifdef DO_SAVE_UNDERS
+ if ((pScreen->backingStoreSupport != NotUseful) &&
+ (pScreen->saveUnderSupport == NotUseful))
+ {
+ /*
+ * If the screen has backing-store but no save-unders, let the
+ * clients know we can support save-unders using backing-store.
+ */
+ pScreen->saveUnderSupport = USE_DIX_SAVE_UNDERS;
+ }
+#endif /* DO_SAVE_UNDERS */
+
+ if (disableSaveUnders)
+ pScreen->saveUnderSupport = NotUseful;
+
+ return TRUE;
+}
+
+void
+InitRootWindow(pWin)
+ WindowPtr pWin;
+{
+ ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
+ if (!(*pScreen->CreateWindow)(pWin))
+ return; /* XXX */
+ (*pScreen->PositionWindow)(pWin, 0, 0);
+
+ pWin->cursorIsNone = FALSE;
+ pWin->optional->cursor = rootCursor;
+ rootCursor->refcnt++;
+ MakeRootTile(pWin);
+ pWin->backingStore = defaultBackingStore;
+ pWin->forcedBS = (defaultBackingStore != NotUseful);
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->ChangeWindowAttributes)(pWin,
+ CWBackPixmap|CWBorderPixel|CWCursor|CWBackingStore);
+
+ MapWindow(pWin, serverClient);
+}
+
+/* Set the region to the intersection of the rectangle and the
+ * window's winSize. The window is typically the parent of the
+ * window from which the region came.
+ */
+
+void
+ClippedRegionFromBox(pWin, Rgn, x, y, w, h)
+ register WindowPtr pWin;
+ RegionPtr Rgn;
+ register int x, y;
+ int w, h;
+{
+ REGION_PTR(pScreen, pWin)
+ BoxRec box;
+
+ box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
+ /* we do these calculations to avoid overflows */
+ if (x > box.x1)
+ box.x1 = x;
+ if (y > box.y1)
+ box.y1 = y;
+ x += w;
+ if (x < box.x2)
+ box.x2 = x;
+ y += h;
+ if (y < box.y2)
+ box.y2 = y;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ REGION_RESET(pScreen, Rgn, &box);
+ REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize);
+}
+
+/* Set the region to the intersection of the rectangle and the
+ * PanoramiX window size. The window is typically the parent of the
+ * window from which the region came.
+ */
+
+#ifdef PANORAMIX
+void
+PanoramiXClippedRegion(pWin, Rgn, x, y, w, h)
+ register WindowPtr pWin;
+ RegionPtr Rgn;
+ register int x, y;
+ int w, h;
+{
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+ BoxRec box;
+
+ box = *(REGION_EXTENTS(pScreen, &PanoramiXScreenRegion[pScreen->myNum]));
+
+ /* we do these calculations to avoid overflows */
+ if (x > box.x1)
+ box.x1 = x;
+ if (y > box.y1)
+ box.y1 = y;
+ x += w;
+ if (x < box.x2)
+ box.x2 = x;
+ y += h;
+ if (y < box.y2)
+ box.y2 = y;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ REGION_RESET(pScreen, Rgn, &box);
+ REGION_INTERSECT(pScreen, Rgn, Rgn, &PanoramiXScreenRegion[pScreen->myNum]);
+}
+#endif
+
+WindowPtr
+RealChildHead(pWin)
+ register WindowPtr pWin;
+{
+ if (!pWin->parent &&
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow (pWin->drawable.pScreen->myNum)))
+ return (pWin->firstChild);
+ else
+ return (NullWindow);
+}
+
+/*****
+ * CreateWindow
+ * Makes a window in response to client request
+ *****/
+
+WindowPtr
+CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist,
+ depth, client, visual, error)
+ Window wid;
+ register WindowPtr pParent;
+ int x,y;
+ unsigned int w, h, bw;
+ unsigned int class;
+ register Mask vmask;
+ XID *vlist;
+ int depth;
+ ClientPtr client;
+ VisualID visual;
+ int *error;
+{
+ register WindowPtr pWin;
+ WindowPtr pHead;
+ register ScreenPtr pScreen;
+ xEvent event;
+ int idepth, ivisual;
+ Bool fOK;
+ DepthPtr pDepth;
+ PixmapFormatRec *format;
+ register WindowOptPtr ancwopt;
+
+ if (class == CopyFromParent)
+ class = pParent->drawable.class;
+
+ if ((class != InputOutput) && (class != InputOnly))
+ {
+ *error = BadValue;
+ client->errorValue = class;
+ return NullWindow;
+ }
+
+ if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ if ((class == InputOnly) && ((bw != 0) || (depth != 0)))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ pScreen = pParent->drawable.pScreen;
+ if ((class == InputOutput) && (depth == 0))
+ depth = pParent->drawable.depth;
+ ancwopt = pParent->optional;
+ if (!ancwopt)
+ ancwopt = FindWindowWithOptional(pParent)->optional;
+ if (visual == CopyFromParent) {
+#ifdef XAPPGROUP
+ VisualID ag_visual;
+
+ if (client->appgroup && !pParent->parent &&
+ (ag_visual = XagRootVisual (client)))
+ visual = ag_visual;
+ else
+#endif
+ visual = ancwopt->visual;
+ }
+
+ /* Find out if the depth and visual are acceptable for this Screen */
+ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
+ {
+ fOK = FALSE;
+ for(idepth = 0; idepth < pScreen->numDepths; idepth++)
+ {
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
+ if ((depth == pDepth->depth) || (depth == 0))
+ {
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
+ {
+ if (visual == pDepth->vids[ivisual])
+ {
+ fOK = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (fOK == FALSE)
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+ }
+
+ if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
+ (class != InputOnly) &&
+ (depth != pParent->drawable.depth))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ if (((vmask & CWColormap) == 0) &&
+ (class != InputOnly) &&
+ ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ pWin = AllocateWindow(pScreen);
+ if (!pWin)
+ {
+ *error = BadAlloc;
+ return NullWindow;
+ }
+ pWin->drawable = pParent->drawable;
+ pWin->drawable.depth = depth;
+ if (depth == pParent->drawable.depth)
+ pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
+ else
+ {
+ for (format = screenInfo.formats; format->depth != depth; format++)
+ ;
+ pWin->drawable.bitsPerPixel = format->bitsPerPixel;
+ }
+ if (class == InputOnly)
+ pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pWin->drawable.id = wid;
+ pWin->drawable.class = class;
+
+ pWin->parent = pParent;
+ SetWindowToDefaults(pWin);
+
+ if (visual != ancwopt->visual)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ xfree (pWin);
+ *error = BadAlloc;
+ return NullWindow;
+ }
+ pWin->optional->visual = visual;
+ pWin->optional->colormap = None;
+ }
+
+ pWin->borderWidth = bw;
+#ifdef XCSECURITY
+ /* can't let untrusted clients have background None windows;
+ * they make it too easy to steal window contents
+ */
+ if (client->trustLevel != XSecurityClientTrusted)
+ {
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = 0;
+ }
+ else
+#endif
+ pWin->backgroundState = None;
+
+ pWin->borderIsPixel = pParent->borderIsPixel;
+ pWin->border = pParent->border;
+ if (pWin->borderIsPixel == FALSE)
+ pWin->border.pixmap->refcnt++;
+
+ pWin->origin.x = x + (int)bw;
+ pWin->origin.y = y + (int)bw;
+ pWin->drawable.width = w;
+ pWin->drawable.height = h;
+ pWin->drawable.x = pParent->drawable.x + x + (int)bw;
+ pWin->drawable.y = pParent->drawable.y + y + (int)bw;
+
+ /* set up clip list correctly for unobscured WindowPtr */
+ REGION_INIT(pScreen, &pWin->clipList, NullBox, 1);
+ REGION_INIT(pScreen, &pWin->borderClip, NullBox, 1);
+ REGION_INIT(pScreen, &pWin->winSize, NullBox, 1);
+ REGION_INIT(pScreen, &pWin->borderSize, NullBox, 1);
+
+ pHead = RealChildHead(pParent);
+ if (pHead)
+ {
+ pWin->nextSib = pHead->nextSib;
+ if (pHead->nextSib)
+ pHead->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pHead->nextSib = pWin;
+ pWin->prevSib = pHead;
+ }
+ else
+ {
+ pWin->nextSib = pParent->firstChild;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
+ }
+
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
+
+ /* We SHOULD check for an error value here XXX */
+ if (!(*pScreen->CreateWindow)(pWin))
+ {
+ *error = BadAlloc;
+ DeleteWindow(pWin, None);
+ return NullWindow;
+ }
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+
+ if (!(vmask & CWEventMask))
+ RecalculateDeliverableEvents(pWin);
+
+ if (vmask)
+ *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin));
+ else
+ *error = Success;
+
+ if (*error != Success)
+ {
+ DeleteWindow(pWin, None);
+ return NullWindow;
+ }
+ if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful))
+ {
+ XID value = defaultBackingStore;
+ (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin));
+ pWin->forcedBS = TRUE;
+ }
+
+ if (SubSend(pParent))
+ {
+ event.u.u.type = CreateNotify;
+ event.u.createNotify.window = wid;
+ event.u.createNotify.parent = pParent->drawable.id;
+ event.u.createNotify.x = x;
+ event.u.createNotify.y = y;
+ event.u.createNotify.width = w;
+ event.u.createNotify.height = h;
+ event.u.createNotify.borderWidth = bw;
+ event.u.createNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pParent, &event, 1, NullWindow);
+ }
+
+ return pWin;
+}
+
+static void
+#if NeedFunctionPrototypes
+FreeWindowResources(register WindowPtr pWin)
+#else
+FreeWindowResources(pWin)
+ register WindowPtr pWin;
+#endif
+{
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DeleteWindowFromAnySaveSet(pWin);
+ DeleteWindowFromAnySelections(pWin);
+ DeleteWindowFromAnyEvents(pWin, TRUE);
+ REGION_UNINIT(pScreen, &pWin->clipList);
+ REGION_UNINIT(pScreen, &pWin->winSize);
+ REGION_UNINIT(pScreen, &pWin->borderClip);
+ REGION_UNINIT(pScreen, &pWin->borderSize);
+#ifdef SHAPE
+ if (wBoundingShape (pWin))
+ REGION_DESTROY(pScreen, wBoundingShape (pWin));
+ if (wClipShape (pWin))
+ REGION_DESTROY(pScreen, wClipShape (pWin));
+#endif
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+
+ DeleteAllWindowProperties(pWin);
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->DestroyWindow)(pWin);
+ DisposeWindowOptional (pWin);
+}
+
+static void
+#if NeedFunctionPrototypes
+CrushTree(WindowPtr pWin)
+#else
+CrushTree(pWin)
+ WindowPtr pWin;
+#endif
+{
+ register WindowPtr pChild, pSib, pParent;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ xEvent event;
+
+ if (!(pChild = pWin->firstChild))
+ return;
+ UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow;
+ while (1)
+ {
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (1)
+ {
+ pParent = pChild->parent;
+ if (SubStrSend(pChild, pParent))
+ {
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pChild->drawable.id;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ FreeResource(pChild->drawable.id, RT_WINDOW);
+ pSib = pChild->nextSib;
+#ifdef DO_SAVE_UNDERS
+ if (pChild->saveUnder && pChild->viewable)
+ deltaSaveUndersViewable--;
+#endif
+ pChild->viewable = FALSE;
+ if (pChild->realized)
+ {
+ pChild->realized = FALSE;
+ (*UnrealizeWindow)(pChild);
+ }
+ FreeWindowResources(pChild);
+ xfree(pChild);
+ if ( (pChild = pSib) )
+ break;
+ pChild = pParent;
+ pChild->firstChild = NullWindow;
+ pChild->lastChild = NullWindow;
+ if (pChild == pWin)
+ return;
+ }
+ }
+}
+
+/*****
+ * DeleteWindow
+ * Deletes child of window then window itself
+ * If wid is None, don't send any events
+ *****/
+
+/*ARGSUSED*/
+int
+DeleteWindow(value, wid)
+ pointer value;
+ XID wid;
+ {
+ register WindowPtr pParent;
+ register WindowPtr pWin = (WindowPtr)value;
+ xEvent event;
+
+ UnmapWindow(pWin, FALSE);
+
+ CrushTree(pWin);
+
+ pParent = pWin->parent;
+ if (wid && pParent && SubStrSend(pWin, pParent))
+ {
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pWin->drawable.id;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ FreeWindowResources(pWin);
+ if (pParent)
+ {
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ }
+ xfree(pWin);
+ return Success;
+}
+
+/*ARGSUSED*/
+void
+DestroySubwindows(pWin, client)
+ register WindowPtr pWin;
+ ClientPtr client;
+{
+ /* XXX
+ * The protocol is quite clear that each window should be
+ * destroyed in turn, however, unmapping all of the first
+ * eliminates most of the calls to ValidateTree. So,
+ * this implementation is incorrect in that all of the
+ * UnmapNotifies occur before all of the DestroyNotifies.
+ * If you care, simply delete the call to UnmapSubwindows.
+ */
+ UnmapSubwindows(pWin);
+ while (pWin->lastChild)
+ FreeResource(pWin->lastChild->drawable.id, RT_NONE);
+}
+
+#define DeviceEventMasks (KeyPressMask | KeyReleaseMask | ButtonPressMask | \
+ ButtonReleaseMask | PointerMotionMask)
+
+/*****
+ * ChangeWindowAttributes
+ *
+ * The value-mask specifies which attributes are to be changed; the
+ * value-list contains one value for each one bit in the mask, from least
+ * to most significant bit in the mask.
+ *****/
+
+int
+ChangeWindowAttributes(pWin, vmask, vlist, client)
+ register WindowPtr pWin;
+ Mask vmask;
+ XID *vlist;
+ ClientPtr client;
+{
+ register Mask index2;
+ register XID *pVlist;
+ PixmapPtr pPixmap;
+ Pixmap pixID;
+ CursorPtr pCursor, pOldCursor;
+ Cursor cursorID;
+ WindowPtr pChild;
+ Colormap cmap;
+ ColormapPtr pCmap;
+ xEvent xE;
+ int result;
+ register ScreenPtr pScreen;
+ Mask vmaskCopy = 0;
+ register Mask tmask;
+ unsigned int val;
+ int error;
+ Bool checkOptional = FALSE;
+ Bool borderRelative = FALSE;
+ WindowPtr pLayerWin;
+
+ if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+
+ error = Success;
+ pScreen = pWin->drawable.pScreen;
+ pVlist = vlist;
+ tmask = vmask;
+ while (tmask)
+ {
+ index2 = (Mask) lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
+ {
+ case CWBackPixmap:
+ pixID = (Pixmap )*pVlist;
+ pVlist++;
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pixID == None)
+ {
+#ifdef XCSECURITY
+ /* can't let untrusted clients have background None windows */
+ if (client->trustLevel == XSecurityClientTrusted)
+ {
+#endif
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ if (!pWin->parent)
+ MakeRootTile(pWin);
+ else
+ pWin->backgroundState = None;
+#ifdef XCSECURITY
+ }
+ else
+ { /* didn't change the background to None, so don't tell ddx */
+ index2 = 0;
+ }
+#endif
+ }
+ else if (pixID == ParentRelative)
+ {
+ if (pWin->parent &&
+ pWin->drawable.depth != pWin->parent->drawable.depth)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ if (!pWin->parent)
+ MakeRootTile(pWin);
+ else
+ pWin->backgroundState = ParentRelative;
+ borderRelative = TRUE;
+ /* Note that the parent's backgroundTile's refcnt is NOT
+ * incremented. */
+ }
+ else
+ {
+ pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
+ RT_PIXMAP, SecurityReadAccess);
+ if (pPixmap != (PixmapPtr) NULL)
+ {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixmap;
+ pWin->background.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else
+ {
+ error = BadPixmap;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBackPixel:
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = (CARD32 ) *pVlist;
+ /* background pixel overrides background pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBackPixmap;
+ pVlist++;
+ break;
+ case CWBorderPixmap:
+ pixID = (Pixmap ) *pVlist;
+ pVlist++;
+ if (pixID == CopyFromParent)
+ {
+ if (!pWin->parent ||
+ (pWin->drawable.depth != pWin->parent->drawable.depth))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->border = pWin->parent->border;
+ if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE)
+ {
+ index2 = CWBorderPixel;
+ }
+ else
+ {
+ pWin->parent->border.pixmap->refcnt++;
+ }
+ }
+ else
+ {
+ pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,
+ RT_PIXMAP, SecurityReadAccess);
+ if (pPixmap)
+ {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->borderIsPixel = FALSE;
+ pWin->border.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else
+ {
+ error = BadPixmap;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBorderPixel:
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->borderIsPixel = TRUE;
+ pWin->border.pixel = (CARD32) *pVlist;
+ /* border pixel overrides border pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBorderPixmap;
+ pVlist++;
+ break;
+ case CWBitGravity:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if (val > StaticGravity)
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->bitGravity = val;
+ break;
+ case CWWinGravity:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if (val > StaticGravity)
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->winGravity = val;
+ break;
+ case CWBackingStore:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->backingStore = val;
+ pWin->forcedBS = FALSE;
+ break;
+ case CWBackingPlanes:
+ if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingBitPlanes = (CARD32) *pVlist;
+ if ((CARD32)*pVlist == (CARD32)~0L)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWBackingPixel:
+ if (pWin->optional || (CARD32) *pVlist) {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingPixel = (CARD32) *pVlist;
+ if (!*pVlist)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWSaveUnder:
+ val = (BOOL) *pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+#ifdef DO_SAVE_UNDERS
+ if (pWin->parent && (pWin->saveUnder != val) && (pWin->viewable) &&
+ DO_SAVE_UNDERS(pWin))
+ {
+ /*
+ * Re-check all siblings and inferiors for obscurity or
+ * exposition (hee hee).
+ */
+ if (pWin->saveUnder)
+ deltaSaveUndersViewable--;
+ else
+ deltaSaveUndersViewable++;
+ pWin->saveUnder = val;
+
+ if (pWin->firstChild)
+ {
+ pLayerWin = (*pScreen->GetLayerWindow)(pWin);
+ if ((*pScreen->ChangeSaveUnder)(pLayerWin->parent, pWin->nextSib))
+ (*pScreen->PostChangeSaveUnder)(pLayerWin->parent,
+ pWin->nextSib);
+ }
+ else
+ {
+ if ((*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib))
+ (*pScreen->PostChangeSaveUnder)(pWin,
+ pWin->nextSib);
+ }
+ }
+ else
+ {
+ /* If we're changing the saveUnder attribute of the root
+ * window, all we do is set pWin->saveUnder so that
+ * GetWindowAttributes returns the right value. We don't
+ * do the "normal" save-under processing (as above).
+ * Hope that doesn't cause any problems.
+ */
+ pWin->saveUnder = val;
+ }
+#else
+ pWin->saveUnder = val;
+#endif /* DO_SAVE_UNDERS */
+ break;
+ case CWEventMask:
+ result = EventSelectForWindow(pWin, client, (Mask )*pVlist);
+ if (result)
+ {
+ error = result;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWDontPropagate:
+ result = EventSuppressForWindow(pWin, client, (Mask )*pVlist,
+ &checkOptional);
+ if (result)
+ {
+ error = result;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWOverrideRedirect:
+ val = (BOOL ) *pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->overrideRedirect = val;
+ break;
+ case CWColormap:
+ cmap = (Colormap) *pVlist;
+ pVlist++;
+ if (cmap == CopyFromParent)
+ {
+#ifdef XAPPGROUP
+ Colormap ag_colormap;
+ ClientPtr win_owner;
+
+ /*
+ * win_owner == client for CreateWindow, other clients
+ * can ChangeWindowAttributes
+ */
+ win_owner = clients[CLIENT_ID(pWin->drawable.id)];
+
+ if ( win_owner && win_owner->appgroup &&
+ !pWin->parent->parent &&
+ (ag_colormap = XagDefaultColormap (win_owner)))
+ cmap = ag_colormap;
+ else
+#endif
+ if (pWin->parent &&
+ (!pWin->optional ||
+ pWin->optional->visual == wVisual (pWin->parent)))
+ {
+ cmap = wColormap (pWin->parent);
+ }
+ else
+ cmap = None;
+ }
+ if (cmap == None)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap,
+ RT_COLORMAP, SecurityReadAccess);
+ if (!pCmap)
+ {
+ error = BadColor;
+ client->errorValue = cmap;
+ goto PatchUp;
+ }
+ if (pCmap->pVisual->vid != wVisual (pWin) ||
+ pCmap->pScreen != pScreen)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (cmap != wColormap (pWin))
+ {
+ if (!pWin->optional)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && cmap == wColormap (pWin->parent))
+ checkOptional = TRUE;
+
+ /*
+ * propagate the original colormap to any children
+ * inheriting it
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (!pChild->optional && !MakeWindowOptional (pChild))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pWin->optional->colormap = cmap;
+
+ /*
+ * check on any children now matching the new colormap
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (pChild->optional->colormap == cmap)
+ CheckWindowOptionalNeed (pChild);
+ }
+
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pWin->drawable.id;
+ xE.u.colormap.colormap = cmap;
+ xE.u.colormap.new = xTrue;
+ xE.u.colormap.state = IsMapInstalled(cmap, pWin);
+ DeliverEvents(pWin, &xE, 1, NullWindow);
+ }
+ break;
+ case CWCursor:
+ cursorID = (Cursor ) *pVlist;
+ pVlist++;
+ /*
+ * install the new
+ */
+ if ( cursorID == None)
+ {
+ if (pWin == WindowTable[pWin->drawable.pScreen->myNum])
+ pCursor = rootCursor;
+ else
+ pCursor = (CursorPtr) None;
+ }
+ else
+ {
+ pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID,
+ RT_CURSOR, SecurityReadAccess);
+ if (!pCursor)
+ {
+ error = BadCursor;
+ client->errorValue = cursorID;
+ goto PatchUp;
+ }
+ }
+
+ if (pCursor != wCursor (pWin))
+ {
+ /*
+ * patch up child windows so they don't lose cursors.
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (!pChild->optional && !pChild->cursorIsNone &&
+ !MakeWindowOptional (pChild))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pOldCursor = 0;
+ if (pCursor == (CursorPtr) None)
+ {
+ pWin->cursorIsNone = TRUE;
+ if (pWin->optional)
+ {
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = (CursorPtr) None;
+ checkOptional = TRUE;
+ }
+ } else {
+ if (!pWin->optional)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && pCursor == wCursor (pWin->parent))
+ checkOptional = TRUE;
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = pCursor;
+ pCursor->refcnt++;
+ pWin->cursorIsNone = FALSE;
+ /*
+ * check on any children now matching the new cursor
+ */
+
+ for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (pChild->optional &&
+ (pChild->optional->cursor == pCursor))
+ CheckWindowOptionalNeed (pChild);
+ }
+ }
+
+ if (pWin->realized)
+ WindowHasNewCursor( pWin);
+
+ /* Can't free cursor until here - old cursor
+ * is needed in WindowHasNewCursor
+ */
+ if (pOldCursor)
+ FreeCursor (pOldCursor, (Cursor)0);
+ }
+ break;
+ default:
+ error = BadValue;
+ client->errorValue = vmask;
+ goto PatchUp;
+ }
+ vmaskCopy |= index2;
+ }
+PatchUp:
+ if (checkOptional)
+ CheckWindowOptionalNeed (pWin);
+
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy);
+
+ /*
+ If the border contents have changed, redraw the border.
+ Note that this has to be done AFTER pScreen->ChangeWindowAttributes
+ for the tile to be rotated, and the correct function selected.
+ */
+ if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)
+ && pWin->viewable && HasBorder (pWin))
+ {
+ RegionRec exposed;
+
+ REGION_INIT(pScreen, &exposed, NullBox, 0);
+ REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize);
+ (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER);
+ REGION_UNINIT(pScreen, &exposed);
+ }
+ return error;
+}
+
+
+/*****
+ * GetWindowAttributes
+ * Notice that this is different than ChangeWindowAttributes
+ *****/
+
+void
+GetWindowAttributes(pWin, client, wa)
+ register WindowPtr pWin;
+ ClientPtr client;
+ xGetWindowAttributesReply *wa;
+{
+ wa->type = X_Reply;
+ wa->bitGravity = pWin->bitGravity;
+ wa->winGravity = pWin->winGravity;
+ if (pWin->forcedBS && pWin->backingStore != Always)
+ wa->backingStore = NotUseful;
+ else
+ wa->backingStore = pWin->backingStore;
+ wa->length = (sizeof(xGetWindowAttributesReply) -
+ sizeof(xGenericReply)) >> 2;
+ wa->sequenceNumber = client->sequence;
+ wa->backingBitPlanes = wBackingBitPlanes (pWin);
+ wa->backingPixel = wBackingPixel (pWin);
+ wa->saveUnder = (BOOL)pWin->saveUnder;
+ wa->override = pWin->overrideRedirect;
+ if (!pWin->mapped)
+ wa->mapState = IsUnmapped;
+ else if (pWin->realized)
+ wa->mapState = IsViewable;
+ else
+ wa->mapState = IsUnviewable;
+
+ wa->colormap = wColormap (pWin);
+ wa->mapInstalled = (wa->colormap == None) ? xFalse
+ : IsMapInstalled(wa->colormap, pWin);
+
+ wa->yourEventMask = EventMaskForClient(pWin, client);
+ wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin);
+ wa->doNotPropagateMask = wDontPropagateMask (pWin);
+ wa->class = pWin->drawable.class;
+ wa->visualID = wVisual (pWin);
+}
+
+
+WindowPtr
+MoveWindowInStack(pWin, pNextSib)
+ register WindowPtr pWin, pNextSib;
+{
+ register WindowPtr pParent = pWin->parent;
+ WindowPtr pFirstChange = pWin; /* highest window where list changes */
+
+ if (pWin->nextSib != pNextSib)
+ {
+ if (!pNextSib) /* move to bottom */
+ {
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL
+ * and pWin->nextSib != pNextSib
+ * therefore pWin->nextSib != NULL */
+ pFirstChange = pWin->nextSib;
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pParent->lastChild->nextSib = pWin;
+ pWin->prevSib = pParent->lastChild;
+ pWin->nextSib = NullWindow;
+ pParent->lastChild = pWin;
+ }
+ else if (pParent->firstChild == pNextSib) /* move to top */
+ {
+ pFirstChange = pWin;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = (WindowPtr ) NULL;
+ pNextSib->prevSib = pWin;
+ pParent->firstChild = pWin;
+ }
+ else /* move in middle of list */
+ {
+ WindowPtr pOldNext = pWin->nextSib;
+
+ pFirstChange = NullWindow;
+ if (pParent->firstChild == pWin)
+ pFirstChange = pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin) {
+ pFirstChange = pWin;
+ pParent->lastChild = pWin->prevSib;
+ }
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pNextSib;
+ pWin->prevSib = pNextSib->prevSib;
+ if (pNextSib->prevSib)
+ pNextSib->prevSib->nextSib = pWin;
+ pNextSib->prevSib = pWin;
+ if (!pFirstChange) { /* do we know it yet? */
+ pFirstChange = pParent->firstChild; /* no, search from top */
+ while ((pFirstChange != pWin) && (pFirstChange != pOldNext))
+ pFirstChange = pFirstChange->nextSib;
+ }
+ }
+ }
+
+ return( pFirstChange );
+}
+
+RegionPtr
+CreateUnclippedWinSize (pWin)
+ register WindowPtr pWin;
+{
+ RegionPtr pRgn;
+ BoxRec box;
+
+ box.x1 = pWin->drawable.x;
+ box.y1 = pWin->drawable.y;
+ box.x2 = pWin->drawable.x + (int) pWin->drawable.width;
+ box.y2 = pWin->drawable.y + (int) pWin->drawable.height;
+ pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
+#ifdef SHAPE
+ if (wBoundingShape (pWin) || wClipShape (pWin)) {
+ REGION_PTR(pScreen, pWin)
+
+ REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
+ - pWin->drawable.y);
+ if (wBoundingShape (pWin))
+ REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin));
+ if (wClipShape (pWin))
+ REGION_INTERSECT(pScreen, pRgn, pRgn, wClipShape (pWin));
+ REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y);
+ }
+#endif
+ return pRgn;
+}
+
+void
+SetWinSize (pWin)
+ register WindowPtr pWin;
+{
+ ClippedRegionFromBox(pWin->parent, &pWin->winSize,
+ pWin->drawable.x, pWin->drawable.y,
+ (int)pWin->drawable.width,
+ (int)pWin->drawable.height);
+#ifdef SHAPE
+ if (wBoundingShape (pWin) || wClipShape (pWin)) {
+ REGION_PTR(pScreen, pWin)
+
+ REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
+ - pWin->drawable.y);
+ if (wBoundingShape (pWin))
+ REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
+ wBoundingShape (pWin));
+ if (wClipShape (pWin))
+ REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
+ wClipShape (pWin));
+ REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x,
+ pWin->drawable.y);
+ }
+#endif
+}
+
+void
+SetBorderSize (pWin)
+ register WindowPtr pWin;
+{
+ int bw;
+
+ if (HasBorder (pWin)) {
+ bw = wBorderWidth (pWin);
+ ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
+ pWin->drawable.x - bw, pWin->drawable.y - bw,
+ (int)(pWin->drawable.width + (bw<<1)),
+ (int)(pWin->drawable.height + (bw<<1)));
+#ifdef SHAPE
+ if (wBoundingShape (pWin)) {
+ REGION_PTR(pScreen, pWin)
+
+ REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
+ - pWin->drawable.y);
+ REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize,
+ wBoundingShape (pWin));
+ REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x,
+ pWin->drawable.y);
+ REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize,
+ &pWin->winSize);
+ }
+#endif
+ } else {
+ REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize,
+ &pWin->winSize);
+ }
+}
+
+void
+GravityTranslate (x, y, oldx, oldy, dw, dh, gravity, destx, desty)
+ register int x, y; /* new window position */
+ int oldx, oldy; /* old window position */
+ int dw, dh;
+ unsigned gravity;
+ register int *destx, *desty; /* position relative to gravity */
+{
+ switch (gravity) {
+ case NorthGravity:
+ *destx = x + dw / 2;
+ *desty = y;
+ break;
+ case NorthEastGravity:
+ *destx = x + dw;
+ *desty = y;
+ break;
+ case WestGravity:
+ *destx = x;
+ *desty = y + dh / 2;
+ break;
+ case CenterGravity:
+ *destx = x + dw / 2;
+ *desty = y + dh / 2;
+ break;
+ case EastGravity:
+ *destx = x + dw;
+ *desty = y + dh / 2;
+ break;
+ case SouthWestGravity:
+ *destx = x;
+ *desty = y + dh;
+ break;
+ case SouthGravity:
+ *destx = x + dw / 2;
+ *desty = y + dh;
+ break;
+ case SouthEastGravity:
+ *destx = x + dw;
+ *desty = y + dh;
+ break;
+ case StaticGravity:
+ *destx = oldx;
+ *desty = oldy;
+ break;
+ default:
+ *destx = x;
+ *desty = y;
+ break;
+ }
+}
+
+/* XXX need to retile border on each window with ParentRelative origin */
+void
+ResizeChildrenWinSize(pWin, dx, dy, dw, dh)
+ register WindowPtr pWin;
+ int dx, dy, dw, dh;
+{
+ register ScreenPtr pScreen;
+ register WindowPtr pSib, pChild;
+ Bool resized = (dw || dh);
+
+ pScreen = pWin->drawable.pScreen;
+
+ for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib)
+ {
+ if (resized && (pSib->winGravity > NorthWestGravity))
+ {
+ int cwsx, cwsy;
+
+ cwsx = pSib->origin.x;
+ cwsy = pSib->origin.y;
+ GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
+ pSib->winGravity, &cwsx, &cwsy);
+ if (cwsx != pSib->origin.x || cwsy != pSib->origin.y)
+ {
+ xEvent event;
+
+ event.u.u.type = GravityNotify;
+ event.u.gravity.window = pSib->drawable.id;
+ event.u.gravity.x = cwsx - wBorderWidth (pSib);
+ event.u.gravity.y = cwsy - wBorderWidth (pSib);
+ DeliverEvents (pSib, &event, 1, NullWindow);
+ pSib->origin.x = cwsx;
+ pSib->origin.y = cwsy;
+ }
+ }
+ pSib->drawable.x = pWin->drawable.x + pSib->origin.x;
+ pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
+ SetWinSize (pSib);
+ SetBorderSize (pSib);
+ (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+ if ( (pChild = pSib->firstChild) )
+ {
+ while (1)
+ {
+ pChild->drawable.x = pChild->parent->drawable.x +
+ pChild->origin.x;
+ pChild->drawable.y = pChild->parent->drawable.y +
+ pChild->origin.y;
+ SetWinSize (pChild);
+ SetBorderSize (pChild);
+ (*pScreen->PositionWindow)(pChild,
+ pChild->drawable.x, pChild->drawable.y);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pSib))
+ pChild = pChild->parent;
+ if (pChild == pSib)
+ break;
+ pChild = pChild->nextSib;
+ }
+ }
+ }
+}
+
+#define GET_INT16(m, f) \
+ if (m & mask) \
+ { \
+ f = (INT16) *pVlist;\
+ pVlist++; \
+ }
+#define GET_CARD16(m, f) \
+ if (m & mask) \
+ { \
+ f = (CARD16) *pVlist;\
+ pVlist++;\
+ }
+
+#define GET_CARD8(m, f) \
+ if (m & mask) \
+ { \
+ f = (CARD8) *pVlist;\
+ pVlist++;\
+ }
+
+#define ChangeMask ((Mask)(CWX | CWY | CWWidth | CWHeight))
+
+#define IllegalInputOnlyConfigureMask (CWBorderWidth)
+
+/*
+ * IsSiblingAboveMe
+ * returns Above if pSib above pMe in stack or Below otherwise
+ */
+
+static int
+#if NeedFunctionPrototypes
+IsSiblingAboveMe(
+ register WindowPtr pMe,
+ register WindowPtr pSib)
+#else
+IsSiblingAboveMe(pMe, pSib)
+ register WindowPtr pMe, pSib;
+#endif
+{
+ register WindowPtr pWin;
+
+ pWin = pMe->parent->firstChild;
+ while (pWin)
+ {
+ if (pWin == pSib)
+ return(Above);
+ else if (pWin == pMe)
+ return(Below);
+ pWin = pWin->nextSib;
+ }
+ return(Below);
+}
+
+static BoxPtr
+#if NeedFunctionPrototypes
+WindowExtents(
+ register WindowPtr pWin,
+ register BoxPtr pBox)
+#else
+WindowExtents(pWin, pBox)
+ register WindowPtr pWin;
+ register BoxPtr pBox;
+#endif
+{
+ pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
+ pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
+ pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width
+ + wBorderWidth (pWin);
+ pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height
+ + wBorderWidth (pWin);
+ return(pBox);
+}
+
+#ifdef SHAPE
+#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
+
+static RegionPtr
+#if NeedFunctionPrototypes
+MakeBoundingRegion (
+ register WindowPtr pWin,
+ BoxPtr pBox)
+#else
+MakeBoundingRegion (pWin, pBox)
+ register WindowPtr pWin;
+ BoxPtr pBox;
+#endif
+{
+ RegionPtr pRgn;
+ REGION_PTR(pScreen, pWin)
+
+ pRgn = REGION_CREATE(pScreen, pBox, 1);
+ if (wBoundingShape (pWin)) {
+ REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x,
+ -pWin->origin.y);
+ REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin));
+ REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x,
+ pWin->origin.y);
+ }
+ return pRgn;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+ShapeOverlap (
+ WindowPtr pWin,
+ BoxPtr pWinBox,
+ WindowPtr pSib,
+ BoxPtr pSibBox)
+#else
+ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
+ WindowPtr pWin, pSib;
+ BoxPtr pWinBox, pSibBox;
+#endif
+{
+ RegionPtr pWinRgn, pSibRgn;
+ register ScreenPtr pScreen;
+ Bool ret;
+
+ if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib))
+ return TRUE;
+ pScreen = pWin->drawable.pScreen;
+ pWinRgn = MakeBoundingRegion (pWin, pWinBox);
+ pSibRgn = MakeBoundingRegion (pSib, pSibBox);
+ REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn);
+ ret = REGION_NOTEMPTY(pScreen, pWinRgn);
+ REGION_DESTROY(pScreen, pWinRgn);
+ REGION_DESTROY(pScreen, pSibRgn);
+ return ret;
+}
+#endif
+
+static Bool
+#if NeedFunctionPrototypes
+AnyWindowOverlapsMe(
+ WindowPtr pWin,
+ WindowPtr pHead,
+ register BoxPtr box)
+#else
+AnyWindowOverlapsMe(pWin, pHead, box)
+ WindowPtr pWin, pHead;
+ register BoxPtr box;
+#endif
+{
+ register WindowPtr pSib;
+ BoxRec sboxrec;
+ register BoxPtr sbox;
+
+ for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib)
+ {
+ if (pSib->mapped)
+ {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+#ifdef SHAPE
+ && ShapeOverlap (pWin, box, pSib, sbox)
+#endif
+ )
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+}
+
+static Bool
+#if NeedFunctionPrototypes
+IOverlapAnyWindow(
+ WindowPtr pWin,
+ register BoxPtr box)
+#else
+IOverlapAnyWindow(pWin, box)
+ WindowPtr pWin;
+ register BoxPtr box;
+#endif
+{
+ register WindowPtr pSib;
+ BoxRec sboxrec;
+ register BoxPtr sbox;
+
+ for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib)
+ {
+ if (pSib->mapped)
+ {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+#ifdef SHAPE
+ && ShapeOverlap (pWin, box, pSib, sbox)
+#endif
+ )
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+}
+
+/*
+ * WhereDoIGoInTheStack()
+ * Given pWin and pSib and the relationshipe smode, return
+ * the window that pWin should go ABOVE.
+ * If a pSib is specified:
+ * Above: pWin is placed just above pSib
+ * Below: pWin is placed just below pSib
+ * TopIf: if pSib occludes pWin, then pWin is placed
+ * at the top of the stack
+ * BottomIf: if pWin occludes pSib, then pWin is
+ * placed at the bottom of the stack
+ * Opposite: if pSib occludes pWin, then pWin is placed at the
+ * top of the stack, else if pWin occludes pSib, then
+ * pWin is placed at the bottom of the stack
+ *
+ * If pSib is NULL:
+ * Above: pWin is placed at the top of the stack
+ * Below: pWin is placed at the bottom of the stack
+ * TopIf: if any sibling occludes pWin, then pWin is placed at
+ * the top of the stack
+ * BottomIf: if pWin occludes any sibline, then pWin is placed at
+ * the bottom of the stack
+ * Opposite: if any sibling occludes pWin, then pWin is placed at
+ * the top of the stack, else if pWin occludes any
+ * sibling, then pWin is placed at the bottom of the stack
+ *
+ */
+
+static WindowPtr
+#if NeedFunctionPrototypes
+WhereDoIGoInTheStack(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ short x,
+ short y,
+ unsigned short w,
+ unsigned short h,
+ int smode)
+#else
+WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
+ register WindowPtr pWin, pSib;
+ short x, y;
+ unsigned short w, h;
+ int smode;
+#endif
+{
+ BoxRec box;
+ register ScreenPtr pScreen;
+ WindowPtr pHead, pFirst;
+
+ if ((pWin == pWin->parent->firstChild) &&
+ (pWin == pWin->parent->lastChild))
+ return((WindowPtr ) NULL);
+ pHead = RealChildHead(pWin->parent);
+ pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild;
+ pScreen = pWin->drawable.pScreen;
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + (int)w;
+ box.y2 = y + (int)h;
+ switch (smode)
+ {
+ case Above:
+ if (pSib)
+ return(pSib);
+ else if (pWin == pFirst)
+ return(pWin->nextSib);
+ else
+ return(pFirst);
+ case Below:
+ if (pSib)
+ if (pSib->nextSib != pWin)
+ return(pSib->nextSib);
+ else
+ return(pWin->nextSib);
+ else
+ return NullWindow;
+ case TopIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if ((IsSiblingAboveMe(pWin, pSib) == Above) &&
+ (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
+ return(pFirst);
+ else
+ return(pWin->nextSib);
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box))
+ return(pFirst);
+ else
+ return(pWin->nextSib);
+ case BottomIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if ((IsSiblingAboveMe(pWin, pSib) == Below) &&
+ (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
+ return NullWindow;
+ else
+ return(pWin->nextSib);
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return(pWin->nextSib);
+ case Opposite:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)
+ {
+ if (IsSiblingAboveMe(pWin, pSib) == Above)
+ return(pFirst);
+ else
+ return NullWindow;
+ }
+ else
+ return(pWin->nextSib);
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box))
+ {
+ /* If I'm occluded, I can't possibly be the first child
+ * if (pWin == pWin->parent->firstChild)
+ * return pWin->nextSib;
+ */
+ return(pFirst);
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return pWin->nextSib;
+ default:
+ {
+ ErrorF("Internal error in ConfigureWindow, smode == %d\n",smode );
+ return pWin->nextSib;
+ }
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+ReflectStackChange(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ VTKind kind)
+#else
+ReflectStackChange(pWin, pSib, kind)
+ register WindowPtr pWin, pSib;
+ VTKind kind;
+#endif
+{
+/* Note that pSib might be NULL */
+
+ Bool WasViewable = (Bool)pWin->viewable;
+ WindowPtr pParent;
+ Bool anyMarked;
+ WindowPtr pFirstChange;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ /* if this is a root window, can't be restacked */
+ if (!(pParent = pWin->parent))
+ return ;
+
+ pFirstChange = MoveWindowInStack(pWin, pSib);
+
+ if (WasViewable)
+ {
+ anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
+ &pLayerWin);
+ if (pLayerWin != pWin) pFirstChange = pLayerWin;
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange);
+ }
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pWin->drawable.pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+}
+
+/*****
+ * ConfigureWindow
+ *****/
+
+int
+ConfigureWindow(pWin, mask, vlist, client)
+ register WindowPtr pWin;
+ register Mask mask;
+ XID *vlist;
+ ClientPtr client;
+{
+#define RESTACK_WIN 0
+#define MOVE_WIN 1
+#define RESIZE_WIN 2
+#define REBORDER_WIN 3
+ register WindowPtr pSib = NullWindow;
+ register WindowPtr pParent = pWin->parent;
+ Window sibwid;
+ Mask index2, tmask;
+ register XID *pVlist;
+ short x, y, beforeX, beforeY;
+ unsigned short w = pWin->drawable.width,
+ h = pWin->drawable.height,
+ bw = pWin->borderWidth;
+ int action, smode = Above;
+#ifdef XAPPGROUP
+ ClientPtr win_owner;
+ ClientPtr ag_leader = NULL;
+#endif
+ xEvent event;
+
+ if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
+ return(BadMatch);
+
+ if ((mask & CWSibling) && !(mask & CWStackMode))
+ return(BadMatch);
+
+ pVlist = vlist;
+
+ if (pParent)
+ {
+ x = pWin->drawable.x - pParent->drawable.x - (int)bw;
+ y = pWin->drawable.y - pParent->drawable.y - (int)bw;
+ }
+ else
+ {
+ x = pWin->drawable.x;
+ y = pWin->drawable.y;
+ }
+ beforeX = x;
+ beforeY = y;
+ action = RESTACK_WIN;
+ if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth))))
+ {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ action = MOVE_WIN;
+ }
+ /* or should be resized */
+ else if (mask & (CWX | CWY | CWWidth | CWHeight))
+ {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ GET_CARD16(CWWidth, w);
+ GET_CARD16 (CWHeight, h);
+ if (!w || !h)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ action = RESIZE_WIN;
+ }
+ tmask = mask & ~ChangeMask;
+ while (tmask)
+ {
+ index2 = (Mask)lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
+ {
+ case CWBorderWidth:
+ GET_CARD16(CWBorderWidth, bw);
+ break;
+ case CWSibling:
+ sibwid = (Window ) *pVlist;
+ pVlist++;
+ pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid,
+ RT_WINDOW, SecurityReadAccess);
+ if (!pSib)
+ {
+ client->errorValue = sibwid;
+ return(BadWindow);
+ }
+ if (pSib->parent != pParent)
+ return(BadMatch);
+ if (pSib == pWin)
+ return(BadMatch);
+ break;
+ case CWStackMode:
+ GET_CARD8(CWStackMode, smode);
+ if ((smode != TopIf) && (smode != BottomIf) &&
+ (smode != Opposite) && (smode != Above) && (smode != Below))
+ {
+ client->errorValue = smode;
+ return(BadValue);
+ }
+ break;
+ default:
+ client->errorValue = mask;
+ return(BadValue);
+ }
+ }
+ /* root really can't be reconfigured, so just return */
+ if (!pParent)
+ return Success;
+
+ /* Figure out if the window should be moved. Doesnt
+ make the changes to the window if event sent */
+
+ if (mask & CWStackMode)
+ pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
+ pParent->drawable.y + y,
+ w + (bw << 1), h + (bw << 1), smode);
+ else
+ pSib = pWin->nextSib;
+
+#ifdef XAPPGROUP
+ win_owner = clients[CLIENT_ID(pWin->drawable.id)];
+ ag_leader = XagLeader (win_owner);
+#endif
+
+ if ((!pWin->overrideRedirect) &&
+ (RedirectSend(pParent)
+#ifdef XAPPGROUP
+ || (win_owner->appgroup && ag_leader &&
+ XagIsControlledRoot (client, pParent))
+#endif
+ ))
+ {
+ event.u.u.type = ConfigureRequest;
+ event.u.configureRequest.window = pWin->drawable.id;
+ if (mask & CWSibling)
+ event.u.configureRequest.sibling = sibwid;
+ else
+ event.u.configureRequest.sibling = None;
+ if (mask & CWStackMode)
+ event.u.u.detail = smode;
+ else
+ event.u.u.detail = Above;
+ event.u.configureRequest.x = x;
+ event.u.configureRequest.y = y;
+ event.u.configureRequest.width = w;
+ event.u.configureRequest.height = h;
+ event.u.configureRequest.borderWidth = bw;
+ event.u.configureRequest.valueMask = mask;
+#ifdef XAPPGROUP
+ /* make sure if the ag_leader maps the window it goes to the wm */
+ if (ag_leader && ag_leader != client &&
+ XagIsControlledRoot (client, pParent)) {
+ event.u.configureRequest.parent = XagId (win_owner);
+ (void) TryClientEvents (ag_leader, &event, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ return Success;
+ }
+#endif
+ event.u.configureRequest.parent = pParent->drawable.id;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+ if (action == RESIZE_WIN)
+ {
+ Bool size_change = (w != pWin->drawable.width)
+ || (h != pWin->drawable.height);
+ if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
+ {
+ xEvent eventT;
+ eventT.u.u.type = ResizeRequest;
+ eventT.u.resizeRequest.window = pWin->drawable.id;
+ eventT.u.resizeRequest.width = w;
+ eventT.u.resizeRequest.height = h;
+ if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
+ ResizeRedirectMask, client) == 1)
+ {
+ /* if event is delivered, leave the actual size alone. */
+ w = pWin->drawable.width;
+ h = pWin->drawable.height;
+ size_change = FALSE;
+ }
+ }
+ if (!size_change)
+ {
+ if (mask & (CWX | CWY))
+ action = MOVE_WIN;
+ else if (mask & (CWStackMode | CWBorderWidth))
+ action = RESTACK_WIN;
+ else /* really nothing to do */
+ return(Success) ;
+ }
+ }
+
+ if (action == RESIZE_WIN)
+ /* we've already checked whether there's really a size change */
+ goto ActuallyDoSomething;
+ if ((mask & CWX) && (x != beforeX))
+ goto ActuallyDoSomething;
+ if ((mask & CWY) && (y != beforeY))
+ goto ActuallyDoSomething;
+ if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin)))
+ goto ActuallyDoSomething;
+ if (mask & CWStackMode)
+ {
+ if (pWin->nextSib != pSib)
+ goto ActuallyDoSomething;
+ }
+ return(Success);
+
+ActuallyDoSomething:
+ if (SubStrSend(pWin, pParent))
+ {
+ event.u.u.type = ConfigureNotify;
+ event.u.configureNotify.window = pWin->drawable.id;
+ if (pSib)
+ event.u.configureNotify.aboveSibling = pSib->drawable.id;
+ else
+ event.u.configureNotify.aboveSibling = None;
+ event.u.configureNotify.x = x;
+ event.u.configureNotify.y = y;
+ event.u.configureNotify.width = w;
+ event.u.configureNotify.height = h;
+ event.u.configureNotify.borderWidth = bw;
+ event.u.configureNotify.override = pWin->overrideRedirect;
+#ifdef PANORAMIX
+ /* In the case where a window is split between one
+ or more screen, a ConfigureNotify event will be written
+ to the client describing the section of the window
+ which is changed per screen. This causes a failure
+ in the vsw test CH03/mvrszwdw because the test is
+ not properly written and expects 1 event and fails
+ when it reads more than 1 event when the window is
+ split. The server is in fact doing the expected and
+ correct behavior. -mad 10/11/96
+ */
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXWindowOffScreen(pWin, w, h))
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }else
+ DeliverEvents(pWin, &event, 1, NullWindow);
+#else
+ DeliverEvents(pWin, &event, 1, NullWindow);
+#endif
+ }
+ if (mask & CWBorderWidth)
+ {
+ if (action == RESTACK_WIN)
+ {
+ action = MOVE_WIN;
+ pWin->borderWidth = bw;
+ }
+ else if ((action == MOVE_WIN) &&
+ (beforeX + wBorderWidth (pWin) == x + (int)bw) &&
+ (beforeY + wBorderWidth (pWin) == y + (int)bw))
+ {
+ action = REBORDER_WIN;
+ (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw);
+ }
+ else
+ pWin->borderWidth = bw;
+ }
+ if (action == MOVE_WIN)
+ (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib,
+ (mask & CWBorderWidth) ? VTOther : VTMove);
+ else if (action == RESIZE_WIN)
+ (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
+ else if (mask & CWStackMode)
+ ReflectStackChange(pWin, pSib, VTOther);
+
+ if (action != RESTACK_WIN)
+ CheckCursorConfinement(pWin);
+
+ return(Success);
+#undef RESTACK_WIN
+#undef MOVE_WIN
+#undef RESIZE_WIN
+#undef REBORDER_WIN
+}
+
+
+/******
+ *
+ * CirculateWindow
+ * For RaiseLowest, raises the lowest mapped child (if any) that is
+ * obscured by another child to the top of the stack. For LowerHighest,
+ * lowers the highest mapped child (if any) that is obscuring another
+ * child to the bottom of the stack. Exposure processing is performed
+ *
+ ******/
+
+int
+CirculateWindow(pParent, direction, client)
+ WindowPtr pParent;
+ int direction;
+ ClientPtr client;
+{
+ register WindowPtr pWin, pHead, pFirst;
+ xEvent event;
+ BoxRec box;
+
+ pHead = RealChildHead(pParent);
+ pFirst = pHead ? pHead->nextSib : pParent->firstChild;
+ if (direction == RaiseLowest)
+ {
+ for (pWin = pParent->lastChild;
+ (pWin != pHead) &&
+ !(pWin->mapped &&
+ AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box)));
+ pWin = pWin->prevSib) ;
+ if (pWin == pHead)
+ return Success;
+ }
+ else
+ {
+ for (pWin = pFirst;
+ pWin &&
+ !(pWin->mapped &&
+ IOverlapAnyWindow(pWin, WindowExtents(pWin, &box)));
+ pWin = pWin->nextSib) ;
+ if (!pWin)
+ return Success;
+ }
+
+ event.u.circulate.window = pWin->drawable.id;
+ event.u.circulate.parent = pParent->drawable.id;
+ event.u.circulate.event = pParent->drawable.id;
+ if (direction == RaiseLowest)
+ event.u.circulate.place = PlaceOnTop;
+ else
+ event.u.circulate.place = PlaceOnBottom;
+
+ if (RedirectSend(pParent))
+ {
+ event.u.u.type = CirculateRequest;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+
+ event.u.u.type = CirculateNotify;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ ReflectStackChange(pWin,
+ (direction == RaiseLowest) ? pFirst : NullWindow,
+ VTStack);
+
+ return(Success);
+}
+
+static int
+#if NeedFunctionPrototypes
+CompareWIDs(
+ WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
+#else
+CompareWIDs(pWin, value)
+ WindowPtr pWin;
+ pointer value; /* must conform to VisitWindowProcPtr */
+#endif
+{
+ Window *wid = (Window *)value;
+
+ if (pWin->drawable.id == *wid)
+ return(WT_STOPWALKING);
+ else
+ return(WT_WALKCHILDREN);
+}
+
+/*****
+ * ReparentWindow
+ *****/
+
+int
+ReparentWindow(pWin, pParent, x, y, client)
+ register WindowPtr pWin, pParent;
+ int x,y;
+ ClientPtr client;
+{
+ WindowPtr pPrev, pPriorParent;
+ Bool WasMapped = (Bool)(pWin->mapped);
+ xEvent event;
+ int bw = wBorderWidth (pWin);
+ register ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
+ if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING)
+ return(BadMatch);
+ if (!MakeWindowOptional(pWin))
+ return(BadAlloc);
+
+ if (WasMapped)
+ UnmapWindow(pWin, FALSE);
+
+ event.u.u.type = ReparentNotify;
+ event.u.reparent.window = pWin->drawable.id;
+ event.u.reparent.parent = pParent->drawable.id;
+ event.u.reparent.x = x;
+ event.u.reparent.y = y;
+ event.u.reparent.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, pParent);
+
+ /* take out of sibling chain */
+
+ pPriorParent = pPrev = pWin->parent;
+ if (pPrev->firstChild == pWin)
+ pPrev->firstChild = pWin->nextSib;
+ if (pPrev->lastChild == pWin)
+ pPrev->lastChild = pWin->prevSib;
+
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+
+ /* insert at begining of pParent */
+ pWin->parent = pParent;
+ pPrev = RealChildHead(pParent);
+ if (pPrev)
+ {
+ pWin->nextSib = pPrev->nextSib;
+ if (pPrev->nextSib)
+ pPrev->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pPrev->nextSib = pWin;
+ pWin->prevSib = pPrev;
+ }
+ else
+ {
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = NullWindow;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
+ }
+
+ pWin->origin.x = x + bw;
+ pWin->origin.y = y + bw;
+ pWin->drawable.x = x + bw + pParent->drawable.x;
+ pWin->drawable.y = y + bw + pParent->drawable.y;
+
+ /* clip to parent */
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
+
+ if (pScreen->ReparentWindow)
+ (*pScreen->ReparentWindow)(pWin, pPriorParent);
+ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+ CheckWindowOptionalNeed(pWin);
+
+ if (WasMapped)
+ MapWindow(pWin, client);
+ RecalculateDeliverableEvents(pWin);
+ return(Success);
+}
+
+static void
+#if NeedFunctionPrototypes
+RealizeTree(WindowPtr pWin)
+#else
+RealizeTree(pWin)
+ WindowPtr pWin;
+#endif
+{
+ register WindowPtr pChild;
+ RealizeWindowProcPtr Realize;
+
+ Realize = pWin->drawable.pScreen->RealizeWindow;
+ pChild = pWin;
+ while (1)
+ {
+ if (pChild->mapped)
+ {
+ pChild->realized = TRUE;
+#ifdef DO_SAVE_UNDERS
+ if (pChild->saveUnder)
+ deltaSaveUndersViewable++;
+#endif
+ pChild->viewable = (pChild->drawable.class == InputOutput);
+ (* Realize)(pChild);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
+ }
+}
+
+/*****
+ * MapWindow
+ * If some other client has selected SubStructureReDirect on the parent
+ * and override-redirect is xFalse, then a MapRequest event is generated,
+ * but the window remains unmapped. Otherwise, the window is mapped and a
+ * MapNotify event is generated.
+ *****/
+
+int
+MapWindow(pWin, client)
+ register WindowPtr pWin;
+ ClientPtr client;
+{
+ register ScreenPtr pScreen;
+
+ register WindowPtr pParent;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+
+ if (pWin->mapped)
+ return(Success);
+
+#ifdef XCSECURITY
+ /* don't let an untrusted client map a child-of-trusted-window, InputOnly
+ * window; too easy to steal device input
+ */
+ if ( (client->trustLevel != XSecurityClientTrusted) &&
+ (pWin->drawable.class == InputOnly) &&
+ (wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) )
+ return Success;
+#endif
+
+ pScreen = pWin->drawable.pScreen;
+ if ( (pParent = pWin->parent) )
+ {
+ xEvent event;
+ Bool anyMarked;
+#ifdef XAPPGROUP
+ ClientPtr win_owner = clients[CLIENT_ID(pWin->drawable.id)];
+ ClientPtr ag_leader = XagLeader (win_owner);
+#endif
+
+ if ((!pWin->overrideRedirect) &&
+ (RedirectSend(pParent)
+#ifdef XAPPGROUP
+ || (win_owner->appgroup && ag_leader &&
+ XagIsControlledRoot (client, pParent))
+#endif
+ ))
+ {
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+#ifdef XAPPGROUP
+ /* make sure if the ag_leader maps the window it goes to the wm */
+ if (ag_leader && ag_leader != client &&
+ XagIsControlledRoot (client, pParent)) {
+ event.u.mapRequest.parent = XagId (win_owner);
+ (void) TryClientEvents (ag_leader, &event, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ return Success;
+ }
+#endif
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+
+ pWin->mapped = TRUE;
+ if (SubStrSend(pWin, pParent))
+ {
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pParent->realized)
+ return(Success);
+ RealizeTree(pWin);
+ if (pWin->viewable)
+ {
+ anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ &pLayerWin);
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib);
+ }
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
+ }
+ WindowsRestructured ();
+ }
+ else
+ {
+ RegionRec temp;
+
+ pWin->mapped = TRUE;
+ pWin->realized = TRUE; /* for roots */
+ pWin->viewable = pWin->drawable.class == InputOutput;
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->RealizeWindow)(pWin);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pWin, 0, 0);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
+ REGION_INIT(pScreen, &temp, NullBox, 0);
+ REGION_COPY(pScreen, &temp, &pWin->clipList);
+ (*pScreen->WindowExposures) (pWin, &temp, NullRegion);
+ REGION_UNINIT(pScreen, &temp);
+ }
+
+ return(Success);
+}
+
+
+/*****
+ * MapSubwindows
+ * Performs a MapWindow all unmapped children of the window, in top
+ * to bottom stacking order.
+ *****/
+
+void
+MapSubwindows(pParent, client)
+ register WindowPtr pParent;
+ ClientPtr client;
+{
+ register WindowPtr pWin;
+ WindowPtr pFirstMapped = NullWindow;
+#ifdef DO_SAVE_UNDERS
+ WindowPtr pFirstSaveUndered = NullWindow;
+#endif
+ register ScreenPtr pScreen;
+ register Mask parentRedirect;
+ register Mask parentNotify;
+ xEvent event;
+ Bool anyMarked;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+
+ pScreen = pParent->drawable.pScreen;
+ parentRedirect = RedirectSend(pParent);
+ parentNotify = SubSend(pParent);
+ anyMarked = FALSE;
+ for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib)
+ {
+ if (!pWin->mapped)
+ {
+ if (parentRedirect && !pWin->overrideRedirect)
+ {
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ continue;
+ }
+
+ pWin->mapped = TRUE;
+ if (parentNotify || StrSend(pWin))
+ {
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pFirstMapped)
+ pFirstMapped = pWin;
+ if (pParent->realized)
+ {
+ RealizeTree(pWin);
+ if (pWin->viewable)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ (WindowPtr *)NULL);
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = TRUE;
+ }
+#endif /* DO_SAVE_UNDERS */
+ }
+ }
+ }
+ }
+
+ if (pFirstMapped)
+ {
+ pLayerWin = (*pScreen->GetLayerWindow)(pParent);
+ if (pLayerWin->parent != pParent) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin,
+ pLayerWin,
+ (WindowPtr *)NULL);
+ pFirstMapped = pLayerWin;
+ }
+ if (anyMarked)
+ {
+#ifdef DO_SAVE_UNDERS
+ if (pLayerWin->parent != pParent)
+ {
+ if (dosave || (DO_SAVE_UNDERS(pLayerWin)))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin,
+ pLayerWin);
+ }
+ }
+ else if (dosave)
+ {
+ dosave = FALSE;
+ for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib)
+ {
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave |= (*pScreen->ChangeSaveUnder)(pWin,
+ pWin->nextSib);
+ if (dosave && !pFirstSaveUndered)
+ pFirstSaveUndered = pWin;
+ }
+ }
+ }
+#endif /* DO_SAVE_UNDERS */
+ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin,
+ pFirstSaveUndered->nextSib);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped,
+ VTMap);
+ WindowsRestructured ();
+ }
+}
+
+static void
+#if NeedFunctionPrototypes
+UnrealizeTree(
+ WindowPtr pWin,
+ Bool fromConfigure)
+#else
+UnrealizeTree(pWin, fromConfigure)
+ WindowPtr pWin;
+ Bool fromConfigure;
+#endif
+{
+ register WindowPtr pChild;
+ UnrealizeWindowProcPtr Unrealize;
+ MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
+
+ Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
+ MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
+ pChild = pWin;
+ while (1)
+ {
+ if (pChild->realized)
+ {
+ pChild->realized = FALSE;
+ pChild->visibility = VisibilityNotViewable;
+ (* Unrealize)(pChild);
+ DeleteWindowFromAnyEvents(pChild, FALSE);
+ if (pChild->viewable)
+ {
+#ifdef DO_SAVE_UNDERS
+ if (pChild->saveUnder)
+ deltaSaveUndersViewable--;
+#endif
+ pChild->viewable = FALSE;
+ if (pChild->backStorage)
+ (*pChild->drawable.pScreen->SaveDoomedAreas)(
+ pChild, &pChild->clipList, 0, 0);
+ (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
+ }
+}
+
+/*****
+ * UnmapWindow
+ * If the window is already unmapped, this request has no effect.
+ * Otherwise, the window is unmapped and an UnMapNotify event is
+ * generated. Cannot unmap a root window.
+ *****/
+
+int
+UnmapWindow(pWin, fromConfigure)
+ register WindowPtr pWin;
+ Bool fromConfigure;
+{
+ register WindowPtr pParent;
+ xEvent event;
+ Bool wasRealized = (Bool)pWin->realized;
+ Bool wasViewable = (Bool)pWin->viewable;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pLayerWin = pWin;
+
+ if ((!pWin->mapped) || (!(pParent = pWin->parent)))
+ return(Success);
+ if (SubStrSend(pWin, pParent))
+ {
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pWin->drawable.id;
+ event.u.unmapNotify.fromConfigure = fromConfigure;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+ if (wasViewable && !fromConfigure)
+ {
+ pWin->valdata = UnmapValData;
+ (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin);
+ (*pScreen->MarkWindow)(pLayerWin->parent);
+ }
+ pWin->mapped = FALSE;
+ if (wasRealized)
+ UnrealizeTree(pWin, fromConfigure);
+ if (wasViewable)
+ {
+ if (!fromConfigure)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib) )
+ {
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib);
+ }
+ }
+ pWin->DIXsaveUnder = FALSE;
+#endif /* DO_SAVE_UNDERS */
+ if (!fromConfigure && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap);
+ }
+ if (wasRealized && !fromConfigure)
+ WindowsRestructured ();
+ return(Success);
+}
+
+/*****
+ * UnmapSubwindows
+ * Performs an UnmapWindow request with the specified mode on all mapped
+ * children of the window, in bottom to top stacking order.
+ *****/
+
+void
+UnmapSubwindows(pWin)
+ register WindowPtr pWin;
+{
+ register WindowPtr pChild, pHead;
+ xEvent event;
+ Bool wasRealized = (Bool)pWin->realized;
+ Bool wasViewable = (Bool)pWin->viewable;
+ Bool anyMarked = FALSE;
+ Mask parentNotify;
+ WindowPtr pLayerWin;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (!pWin->firstChild)
+ return;
+ parentNotify = SubSend(pWin);
+ pHead = RealChildHead(pWin);
+
+ if (wasViewable)
+ pLayerWin = (*pScreen->GetLayerWindow)(pWin);
+
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ {
+ if (pChild->mapped)
+ {
+ if (parentNotify || StrSend(pChild))
+ {
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pChild->drawable.id;
+ event.u.unmapNotify.fromConfigure = xFalse;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ if (pChild->viewable)
+ {
+ pChild->valdata = UnmapValData;
+ anyMarked = TRUE;
+ }
+ pChild->mapped = FALSE;
+ if (pChild->realized)
+ UnrealizeTree(pChild, FALSE);
+ if (wasViewable)
+ {
+#ifdef DO_SAVE_UNDERS
+ pChild->DIXsaveUnder = FALSE;
+#endif /* DO_SAVE_UNDERS */
+ if (pChild->backStorage)
+ (*pScreen->SaveDoomedAreas)(
+ pChild, &pChild->clipList, 0, 0);
+ }
+ }
+ }
+ if (wasViewable)
+ {
+ if (anyMarked)
+ {
+ if (pLayerWin->parent == pWin)
+ (*pScreen->MarkWindow)(pWin);
+ else
+ {
+ WindowPtr ptmp;
+ (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
+ (WindowPtr *)NULL);
+ (*pScreen->MarkWindow)(pLayerWin->parent);
+
+ /* Windows between pWin and pLayerWin may not have been marked */
+ ptmp = pWin;
+
+ while (ptmp != pLayerWin->parent)
+ {
+ (*pScreen->MarkWindow)(ptmp);
+ ptmp = ptmp->parent;
+ }
+ pHead = pWin->firstChild;
+ }
+ (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin))
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
+ }
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap);
+ }
+ if (wasRealized)
+ WindowsRestructured ();
+}
+
+
+void
+HandleSaveSet(client)
+ register ClientPtr client;
+{
+ register WindowPtr pParent, pWin;
+ register int j;
+
+ for (j=0; j<client->numSaved; j++)
+ {
+ pWin = (WindowPtr)client->saveSet[j];
+ pParent = pWin->parent;
+ while (pParent && (wClient (pParent) == client))
+ pParent = pParent->parent;
+ if (pParent)
+ {
+ if (pParent != pWin->parent)
+ {
+ ReparentWindow(pWin, pParent,
+ pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x,
+ pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y,
+ client);
+ if(!pWin->realized && pWin->mapped)
+ pWin->mapped = FALSE;
+ }
+ MapWindow(pWin, client);
+ }
+ }
+ xfree(client->saveSet);
+ client->numSaved = 0;
+ client->saveSet = (pointer *)NULL;
+}
+
+Bool
+VisibleBoundingBoxFromPoint(pWin, x, y, box)
+ register WindowPtr pWin;
+ int x, y; /* in root */
+ BoxPtr box; /* "return" value */
+{
+ if (!pWin->realized)
+ return (FALSE);
+ if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box))
+ return(TRUE);
+ return(FALSE);
+}
+
+Bool
+PointInWindowIsVisible(pWin, x, y)
+ register WindowPtr pWin;
+ int x, y; /* in root */
+{
+ BoxRec box;
+
+ if (!pWin->realized)
+ return (FALSE);
+ if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip,
+ x, y, &box))
+ return(TRUE);
+ return(FALSE);
+}
+
+
+RegionPtr
+NotClippedByChildren(pWin)
+ register WindowPtr pWin;
+{
+ register ScreenPtr pScreen;
+ RegionPtr pReg;
+
+ pScreen = pWin->drawable.pScreen;
+ pReg = REGION_CREATE(pScreen, NullBox, 1);
+ if (pWin->parent ||
+ screenIsSaved != SCREEN_SAVER_ON ||
+ !HasSaverWindow (pWin->drawable.pScreen->myNum))
+ {
+ REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize);
+ }
+ return(pReg);
+}
+
+
+void
+SendVisibilityNotify(pWin)
+ WindowPtr pWin;
+{
+ xEvent event;
+ event.u.u.type = VisibilityNotify;
+ event.u.visibility.window = pWin->drawable.id;
+ event.u.visibility.state = pWin->visibility;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+}
+
+
+#define RANDOM_WIDTH 32
+
+#ifndef NOLOGOHACK
+extern int logoScreenSaver;
+static void DrawLogo(
+#if NeedFunctionPrototypes
+ WindowPtr /*pWin*/
+#endif
+);
+#endif
+
+void
+SaveScreens(on, mode)
+ int on;
+ int mode;
+{
+ int i;
+ int what;
+ int type;
+
+ if (on == SCREEN_SAVER_FORCER)
+ {
+ UpdateCurrentTimeIf();
+ lastDeviceEventTime = currentTime;
+ if (mode == ScreenSaverReset)
+ what = SCREEN_SAVER_OFF;
+ else
+ what = SCREEN_SAVER_ON;
+ type = what;
+ }
+ else
+ {
+ what = on;
+ type = what;
+ if (what == screenIsSaved)
+ type = SCREEN_SAVER_CYCLE;
+ }
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ if (on == SCREEN_SAVER_FORCER)
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on);
+ if (savedScreenInfo[i].ExternalScreenSaver)
+ {
+ if ((*savedScreenInfo[i].ExternalScreenSaver)
+ (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
+ continue;
+ }
+ if (type == screenIsSaved)
+ continue;
+ switch (type) {
+ case SCREEN_SAVER_OFF:
+ if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ {
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
+ what);
+ }
+ else if (HasSaverWindow (i))
+ {
+ savedScreenInfo[i].pWindow = NullWindow;
+ FreeResource(savedScreenInfo[i].wid, RT_NONE);
+ }
+ break;
+ case SCREEN_SAVER_CYCLE:
+ if (savedScreenInfo[i].blanked == SCREEN_IS_TILED)
+ {
+ WindowPtr pWin = savedScreenInfo[i].pWindow;
+ /* make it look like screen saver is off, so that
+ * NotClippedByChildren will compute a clip list
+ * for the root window, so miPaintWindow works
+ */
+ screenIsSaved = SCREEN_SAVER_OFF;
+#ifndef NOLOGOHACK
+ if (logoScreenSaver)
+ (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE);
+#endif
+ (*pWin->drawable.pScreen->MoveWindow)(pWin,
+ (short)(-(rand() % RANDOM_WIDTH)),
+ (short)(-(rand() % RANDOM_WIDTH)),
+ pWin->nextSib, VTMove);
+#ifndef NOLOGOHACK
+ if (logoScreenSaver)
+ DrawLogo(pWin);
+#endif
+ screenIsSaved = SCREEN_SAVER_ON;
+ }
+ break;
+ case SCREEN_SAVER_ON:
+ if (ScreenSaverBlanking != DontPreferBlanking)
+ {
+ if ((* screenInfo.screens[i]->SaveScreen)
+ (screenInfo.screens[i], what))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_BLANKED;
+ continue;
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(i, SCREEN_IS_BLACK))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_BLACK;
+ continue;
+ }
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(i, SCREEN_IS_TILED))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_TILED;
+ }
+ else
+ savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED;
+ break;
+ }
+ }
+ screenIsSaved = what;
+}
+
+static Bool
+#if NeedFunctionPrototypes
+TileScreenSaver(int i, int kind)
+#else
+TileScreenSaver(i, kind)
+ int i;
+ int kind;
+#endif
+{
+ int j;
+ int result;
+ XID attributes[3];
+ Mask mask;
+ WindowPtr pWin;
+ CursorMetricRec cm;
+ unsigned char *srcbits, *mskbits;
+ CursorPtr cursor;
+ XID cursorID;
+ int attri;
+
+ mask = 0;
+ attri = 0;
+ switch (kind) {
+ case SCREEN_IS_TILED:
+ switch (WindowTable[i]->backgroundState) {
+ case BackgroundPixel:
+ attributes[attri++] = WindowTable[i]->background.pixel;
+ mask |= CWBackPixel;
+ break;
+ case BackgroundPixmap:
+ attributes[attri++] = None;
+ mask |= CWBackPixmap;
+ break;
+ default:
+ break;
+ }
+ break;
+ case SCREEN_IS_BLACK:
+ attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel;
+ mask |= CWBackPixel;
+ break;
+ }
+ mask |= CWOverrideRedirect;
+ attributes[attri++] = xTrue;
+
+ /*
+ * create a blank cursor
+ */
+
+ cm.width=16;
+ cm.height=16;
+ cm.xhot=8;
+ cm.yhot=8;
+ srcbits = (unsigned char *)xalloc( BitmapBytePad(32)*16);
+ mskbits = (unsigned char *)xalloc( BitmapBytePad(32)*16);
+ if (!srcbits || !mskbits)
+ {
+ xfree(srcbits);
+ xfree(mskbits);
+ cursor = 0;
+ }
+ else
+ {
+ for (j=0; j<BitmapBytePad(32)*16; j++)
+ srcbits[j] = mskbits[j] = 0x0;
+ cursor = AllocCursor(srcbits, mskbits, &cm, 0, 0, 0, 0, 0, 0);
+ if (cursor)
+ {
+ cursorID = FakeClientID(0);
+ if (AddResource (cursorID, RT_CURSOR, (pointer) cursor))
+ {
+ attributes[attri] = cursorID;
+ mask |= CWCursor;
+ }
+ else
+ cursor = 0;
+ }
+ else
+ {
+ xfree (srcbits);
+ xfree (mskbits);
+ }
+ }
+
+ pWin = savedScreenInfo[i].pWindow =
+ CreateWindow(savedScreenInfo[i].wid,
+ WindowTable[i],
+ -RANDOM_WIDTH, -RANDOM_WIDTH,
+ (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
+ (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
+ 0, InputOutput, mask, attributes, 0, serverClient,
+ wVisual (WindowTable[i]), &result);
+
+ if (cursor)
+ FreeResource (cursorID, RT_NONE);
+
+ if (!pWin)
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW,
+ (pointer)savedScreenInfo[i].pWindow))
+ return FALSE;
+
+ if (mask & CWBackPixmap)
+ {
+ MakeRootTile (pWin);
+ (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap);
+ }
+ MapWindow(pWin, serverClient);
+#ifndef NOLOGOHACK
+ if (kind == SCREEN_IS_TILED && logoScreenSaver)
+ DrawLogo(pWin);
+#endif
+ return TRUE;
+}
+
+/*
+ * FindWindowWithOptional
+ *
+ * search ancestors of the given window for an entry containing
+ * a WindowOpt structure. Assumptions: some parent will
+ * contain the structure.
+ */
+
+WindowPtr
+FindWindowWithOptional (w)
+ register WindowPtr w;
+{
+ do
+ w = w->parent;
+ while (!w->optional);
+ return w;
+}
+
+/*
+ * CheckWindowOptionalNeed
+ *
+ * check each optional entry in the given window to see if
+ * the value is satisfied by the default rules. If so,
+ * release the optional record
+ */
+
+void
+CheckWindowOptionalNeed (w)
+ register WindowPtr w;
+{
+ register WindowOptPtr optional;
+ register WindowOptPtr parentOptional;
+
+ if (!w->parent)
+ return;
+ optional = w->optional;
+ if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate])
+ return;
+ if (optional->otherEventMasks != 0)
+ return;
+ if (optional->otherClients != NULL)
+ return;
+ if (optional->passiveGrabs != NULL)
+ return;
+ if (optional->userProps != NULL)
+ return;
+ if (optional->backingBitPlanes != ~0L)
+ return;
+ if (optional->backingPixel != 0)
+ return;
+#ifdef SHAPE
+ if (optional->boundingShape != NULL)
+ return;
+ if (optional->clipShape != NULL)
+ return;
+#endif
+#ifdef XINPUT
+ if (optional->inputMasks != NULL)
+ return;
+#endif
+ parentOptional = FindWindowWithOptional(w)->optional;
+ if (optional->visual != parentOptional->visual)
+ return;
+ if (optional->cursor != None &&
+ (optional->cursor != parentOptional->cursor ||
+ w->parent->cursorIsNone))
+ return;
+ if (optional->colormap != parentOptional->colormap)
+ return;
+ DisposeWindowOptional (w);
+}
+
+/*
+ * MakeWindowOptional
+ *
+ * create an optional record and initialize it with the default
+ * values.
+ */
+
+Bool
+MakeWindowOptional (pWin)
+ register WindowPtr pWin;
+{
+ register WindowOptPtr optional;
+ register WindowOptPtr parentOptional;
+
+ if (pWin->optional)
+ return TRUE;
+ optional = (WindowOptPtr) xalloc (sizeof (WindowOptRec));
+ if (!optional)
+ return FALSE;
+ optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
+ optional->otherEventMasks = 0;
+ optional->otherClients = NULL;
+ optional->passiveGrabs = NULL;
+ optional->userProps = NULL;
+ optional->backingBitPlanes = ~0L;
+ optional->backingPixel = 0;
+#ifdef SHAPE
+ optional->boundingShape = NULL;
+ optional->clipShape = NULL;
+#endif
+#ifdef XINPUT
+ optional->inputMasks = NULL;
+#endif
+ parentOptional = FindWindowWithOptional(pWin)->optional;
+ optional->visual = parentOptional->visual;
+ if (!pWin->cursorIsNone)
+ {
+ optional->cursor = parentOptional->cursor;
+ optional->cursor->refcnt++;
+ }
+ else
+ {
+ optional->cursor = None;
+ }
+ optional->colormap = parentOptional->colormap;
+ pWin->optional = optional;
+ return TRUE;
+}
+
+void
+DisposeWindowOptional (pWin)
+ register WindowPtr pWin;
+{
+ if (!pWin->optional)
+ return;
+ /*
+ * everything is peachy. Delete the optional record
+ * and clean up
+ */
+ if (pWin->cursorIsNone == FALSE)
+ FreeCursor (pWin->optional->cursor, (Cursor)0);
+ pWin->cursorIsNone = TRUE;
+ xfree (pWin->optional);
+ pWin->optional = NULL;
+}
+
+#ifndef NOLOGOHACK
+static void
+#if NeedFunctionPrototypes
+DrawLogo(WindowPtr pWin)
+#else
+DrawLogo(pWin)
+ WindowPtr pWin;
+#endif
+{
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ int x, y;
+ unsigned int width, height, size;
+ GC *pGC;
+ int thin, gap, d31;
+ DDXPointRec poly[4];
+ ChangeGCVal fore[2], back[2];
+ xrgb rgb[2];
+ BITS32 fmask, bmask;
+ ColormapPtr cmap;
+
+ pDraw = (DrawablePtr)pWin;
+ pScreen = pDraw->pScreen;
+ x = -pWin->origin.x;
+ y = -pWin->origin.y;
+ width = pScreen->width;
+ height = pScreen->height;
+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
+ if (!pGC)
+ return;
+
+ if ((rand() % 100) <= 17) /* make the probability for white fairly low */
+ fore[0].val = pScreen->whitePixel;
+ else
+ fore[0].val = pScreen->blackPixel;
+ if ((pWin->backgroundState == BackgroundPixel) &&
+ (cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) {
+ Pixel querypixels[2];
+
+ querypixels[0] = fore[0].val;
+ querypixels[1] = pWin->background.pixel;
+ QueryColors(cmap, 2, querypixels, rgb);
+ if ((rgb[0].red == rgb[1].red) &&
+ (rgb[0].green == rgb[1].green) &&
+ (rgb[0].blue == rgb[1].blue)) {
+ if (fore[0].val == pScreen->blackPixel)
+ fore[0].val = pScreen->whitePixel;
+ else
+ fore[0].val = pScreen->blackPixel;
+ }
+ }
+ fore[1].val = FillSolid;
+ fmask = GCForeground|GCFillStyle;
+ if (pWin->backgroundState == BackgroundPixel) {
+ back[0].val = pWin->background.pixel;
+ back[1].val = FillSolid;
+ bmask = GCForeground|GCFillStyle;
+ } else {
+ back[0].val = 0;
+ back[1].val = 0;
+ dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin,
+ NULL, back);
+ back[0].val = FillTiled;
+ back[1].ptr = pWin->background.pixmap;
+ bmask = GCFillStyle|GCTile;
+ }
+
+ /* should be the same as the reference function XmuDrawLogo() */
+
+ size = width;
+ if (height < width)
+ size = height;
+ size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH);
+ size &= ~1;
+ x += rand() % (width - size);
+ y += rand() % (height - size);
+
+/*
+ * Draw what will be the thin strokes.
+ *
+ * -----
+ * / /
+ * / /
+ * / /
+ * / /
+ * /____/
+ * d
+ *
+ * Point d is 9/44 (~1/5) of the way across.
+ */
+
+ thin = (size / 11);
+ if (thin < 1) thin = 1;
+ gap = (thin+3) / 4;
+ d31 = thin + thin + gap;
+ poly[0].x = x + size; poly[0].y = y;
+ poly[1].x = x + size-d31; poly[1].y = y;
+ poly[2].x = x + 0; poly[2].y = y + size;
+ poly[3].x = x + d31; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase area not needed for lower thin stroke.
+ *
+ * ------
+ * / /
+ * / __ /
+ * / / /
+ * / / /
+ * /__/__/
+ */
+
+ poly[0].x = x + d31/2; poly[0].y = y + size;
+ poly[1].x = x + size / 2; poly[1].y = y + size/2;
+ poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2;
+ poly[3].x = x + d31; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase area not needed for upper thin stroke.
+ *
+ * ------
+ * / / /
+ * /--/ /
+ * / /
+ * / /
+ * /_____/
+ */
+
+ poly[0].x = x + size - d31/2; poly[0].y = y;
+ poly[1].x = x + size / 2; poly[1].y = y + size/2;
+ poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2;
+ poly[3].x = x + size - d31; poly[3].y = y;
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Draw thick stroke.
+ * Point b is 1/4 of the way across.
+ *
+ * b
+ * -----
+ * \ \
+ * \ \
+ * \ \
+ * \ \
+ * \____\
+ */
+
+ poly[0].x = x; poly[0].y = y;
+ poly[1].x = x + size/4; poly[1].y = y;
+ poly[2].x = x + size; poly[2].y = y + size;
+ poly[3].x = x + size - size/4; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase to create gap.
+ *
+ * /
+ * /
+ * /
+ * /
+ * /
+ */
+
+ poly[0].x = x + size- thin; poly[0].y = y;
+ poly[1].x = x + size-( thin+gap); poly[1].y = y;
+ poly[2].x = x + thin; poly[2].y = y + size;
+ poly[3].x = x + thin + gap; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+ FreeScratchGC(pGC);
+}
+
+#endif
diff --git a/xc/programs/Xserver/dix/xpstubs.c b/xc/programs/Xserver/dix/xpstubs.c
new file mode 100644
index 000000000..209e88c3e
--- /dev/null
+++ b/xc/programs/Xserver/dix/xpstubs.c
@@ -0,0 +1,41 @@
+/*
+Copyright 1996, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+*/
+
+/* $TOG: xpstubs.c /main/2 1998/02/09 14:21:15 kaleb $ */
+
+#include "misc.h"
+#include "font.h"
+
+Bool
+XpClientIsBitmapClient(client)
+ ClientPtr client;
+{
+ return TRUE;
+}
+
+Bool
+XpClientIsPrintClient(client, fpe)
+ ClientPtr client;
+ FontPathElementPtr fpe;
+{
+ return FALSE;
+}
diff --git a/xc/programs/Xserver/glxStub/Imakefile b/xc/programs/Xserver/glxStub/Imakefile
new file mode 100644
index 000000000..4a52c456f
--- /dev/null
+++ b/xc/programs/Xserver/glxStub/Imakefile
@@ -0,0 +1,19 @@
+XCOMM $XFree86: xc/programs/Xserver/glxStub/Imakefile,v 1.5 1999/04/17 09:08:28 dawes Exp $
+
+
+
+#include <Server.tmpl>
+
+SRCS = glxstub.c
+
+OBJS = glxstub.o
+
+INCLUDES = -I../include -I$(XINCLUDESRC) -I$(SERVERSRC)/include
+
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(ServerGlx,$(OBJS))
+LintLibraryTarget(ServerGlx,$(SRCS))
+NormalLintTarget($(SRCS))
+
+DependTarget()
diff --git a/xc/programs/Xserver/glxStub/glxstub.c b/xc/programs/Xserver/glxStub/glxstub.c
new file mode 100644
index 000000000..4fc46b78b
--- /dev/null
+++ b/xc/programs/Xserver/glxStub/glxstub.c
@@ -0,0 +1,55 @@
+/* $XFree86: xc/programs/Xserver/glxStub/glxstub.c,v 1.4 1997/05/03 09:15:55 dawes Exp $ */
+
+/*
+ * Copyright 1997 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include "X.h"
+#include "misc.h"
+#include "dixstruct.h"
+
+/*
+ * Stubs for systems that don't support loadable modules.
+ * This allows the server to be relinked via the linkkit with
+ * compatible implementations of the GLX protocol.
+ */
+
+void
+GlxExtensionInit(INITARGS)
+{
+ ErrorF("GLX extension library not linked, use linkkit\n");
+}
+
+int
+GlxInitVisuals (
+#if NeedFunctionPrototypes
+ VisualPtr * visualp,
+ DepthPtr * depthp,
+ int * nvisualp,
+ int * ndepthp,
+ int * rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB
+#endif
+) {}
+
diff --git a/xc/programs/Xserver/hw/Imakefile b/xc/programs/Xserver/hw/Imakefile
new file mode 100644
index 000000000..038ecf546
--- /dev/null
+++ b/xc/programs/Xserver/hw/Imakefile
@@ -0,0 +1,22 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/12/02 10:20:16 lehors $
+XCOMM This is only used on NT where we do not know how to jump over this dir
+
+#ifdef Win32Architecture
+
+#define IHaveSubdirs
+#define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)"
+
+#if XnestServer
+XNESTDIR = xnest
+#endif
+
+#if XVirtualFramebufferServer
+XVFBDIR = vfb
+#endif
+
+SUBDIRS= $(XNESTDIR) $(XVFBDIR)
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+
+#endif
diff --git a/xc/programs/Xserver/hw/dec/ws/Imakefile b/xc/programs/Xserver/hw/dec/ws/Imakefile
new file mode 100644
index 000000000..bd6f43a85
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/Imakefile
@@ -0,0 +1,37 @@
+XCOMM $XConsortium: Imakefile /main/13 1996/09/28 17:12:22 rws $
+#include <Server.tmpl>
+
+XCOMM
+XCOMM Only color frame buffers are currently supported
+XCOMM
+XCOMM ACC=acc_2da
+XCOMM ACC=acc_3d
+ACC=acc_none
+
+#if BuildXInputExt
+XISRC = ext_device.c
+XIOBJ = ext_device.o
+#endif
+
+SRCS = init.c ws_io.c ws_color.c cfbinit.c $(XISRC) $(ACC).c mdepthinit.c
+OFILES = init.o mdepthinit.o sdepthinit.o
+
+OBJS = ws_io.o ws_color.o cfbinit.o $(XIOBJ) $(ACC).o
+INCLUDES = -I../../../mfb -I../../../mi -I../../../include -I$(XINCLUDESRC) \
+ -I$(EXTINCSRC) -I$(FONTINCSRC)
+LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/llib-los.ln \
+ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln
+
+all:: $(OFILES)
+
+NormalLibraryObjectRule()
+NormalLintTarget($(SRCS))
+
+lintlib:
+
+NormalLibraryTarget(dec,$(OBJS))
+
+ObjectFromSpecialSource(sdepthinit,mdepthinit,-DSINGLEDEPTH)
+
+DependTarget()
+InstallManPage(Xdec,$(MANDIR))
diff --git a/xc/programs/Xserver/hw/dec/ws/Xdec.man b/xc/programs/Xserver/hw/dec/ws/Xdec.man
new file mode 100644
index 000000000..fa260e1bb
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/Xdec.man
@@ -0,0 +1,284 @@
+.\" $TOG: Xdec.man /main/9 1998/02/10 12:45:43 kaleb $
+.\" Copyright 1991 Digital Equipment Corporation
+.\" Copyright 1993, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.TH XDEC 1 "Release 6.4" "X Version 11"
+.SH Name
+Xdec \- X server for Digital RISC machines
+.SH Syntax
+.B Xdec
+[
+.I options
+]
+.SH Description
+.NXR "Xdec command to start X server"
+.NXR "X server"
+.NXR "X Window System"
+.NXR "X Window System" "starting the server"
+.NXR "Starting the server in the X Window System"
+.NXM "Starting the server in the X Window System"
+.PP
+The
+.PN Xdec
+command starts the X server. The
+.PN Xdec
+command supports the following hardware configurations:
+.nf
+
+ DECstation 2100 Monochrome or Color Workstations
+ DECstation 3100 Monochrome or Color Workstations
+ DECstation 5000/100/200 CX or MX Single or Multiscreen Workstations
+.fi
+.PP
+This server should run on reasonable one
+bit or eight bit Ultrix/RISC TURBOchannel displays of any resolution, if
+correct device driver support is present.
+The server queries the device driver interface to determine if a
+suitable display device is installed, and if so, configures the server
+appropriately.
+.LP
+The command that executes the server is specified together with its
+command line options in the
+.PN /etc/ttys
+file or using xdm(1) and, therefore, is automatically run when your system is
+started in multiuser mode.
+.\"Use the
+.\".PN xset
+.\".B \-q
+.\"command to query the server for the options that are currently set.
+Optionally, you can create an
+.PN /etc/screens
+file containing device-dependent command line
+options (separated by spaces) and use it to start the server.
+Command line options specified in the
+command starting the X server override those specified in the
+.PN /etc/screens
+file.
+.PP
+Start the server in bug compatibility mode (with the \fBbc\fP
+option) to remain bug-for-bug compatible with previous releases of the server.
+.SH Options
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXdec\fP accepts the following
+device-dependent, vendor-specific options.
+When the server is run on multiscreen capable platforms, selected
+device-dependent options take an optional screen-specification argument.
+Omitting the screen-specification argument defines the parameter for all
+available screens.
+.IP "\fB\-btn\fP \fInum\fP" 20
+Specifies the number of buttons on the pointer device. The default is three
+for a mouse device and four for a tablet device.
+.IP "\fB\-bp\fP[\fIscreen\fP] \fIcolor\fP" 20
+Sets the color of black pixels for the screen.
+The \fIcolor\fP argument can be a named color from the
+.PN rgb
+database or a number sign (\fC#\fP) followed by a hexidecimal number.
+.IP "\fB\-class\fP[\fIscreen\fP] \fIvisual class\fP" 20
+Sets the visual class for the root window of the screen. Possible values
+are
+.PN StaticGray ,
+.PN StaticColor ,
+.PN PseudoColor ,
+.PN GrayScale ,
+and
+.PN TrueColor .
+.\" .PN DirectColor .
+.IP "\fB\-dpi\fP[\fIscreen\fP] \fInum\fP" 20
+Sets the dots per inch for the x and y coordinates.
+.IP "\fB\-dpix\fP[\fIscreen\fP] \fInum\fP" 20
+Sets the dots per inch for the x coordinates.
+.IP "\fB\-dpiy\fP[\fIscreen\fP] \fInum\fP" 20
+Sets the dots per inch for the y coordinates.
+.LP
+By default on multiscreen systems, the server presumes the
+left hand most screen is screen zero, screen one to its right, screen
+two yet further to its right, and so on.
+The cursor will track from the
+right hand edge of screen zero to the left hand edge of screen one,
+from the right hand edge of screen one to the left hand edge of screen two.
+This arrangement can be modified in various ways, to support
+other physical arrangements of monitors.
+.IP "\fB\-edge_bottom\fP\fIscr1\fP \fIscr2\fP" 20
+Attaches the bottom edge of the screen specified by \fIscr1\fP to the
+screen specified by \fIscr2\fP.
+.IP "\fB\-edge_left\fP\fIscr1\fP \fIscr2\fP" 20
+Attaches the left edge of the screen specified by \fIscr1\fP to the
+screen specified by \fIscr2\fP.
+.IP "\fB\-edge_right\fP\fIscr1\fP \fIscr2\fP" 20
+Attaches the right edge of the screen specified by \fIscr1\fP to the
+screen specified by \fIscr2\fP.
+.IP "\fB\-edge_top\fP\fIscr1\fP \fIscr2\fP" 20
+Attaches the top edge of the screen specified by \fIscr1\fP to the
+screen specified by \fIscr2\fP.
+.IP "\fB\-wp\fP[\fIscreen\fP] \fIcolor\fP" 20
+Sets the color of white pixels for the screen. The syntax for \fIcolor\fP
+is the same as for the argument to the \fB\-bp\fP option.
+.IP "\fB\-tb\fP \fIn\fP" 20
+Opens
+.PN /dev/tty0\fIn\fP
+\fRfor graphics tablet communications.
+.IP "\fB\-pcm\fP \fIn\fP" 20
+\fROpens
+.PN /dev/tty0\fIn\fP
+\fRfor Protocol Control Module (PCM) communications.
+The two free serial ports on the DECstation correspond to
+.PN /dev/tty00
+and
+.PN /dev/tty01 .
+Dial boxes and button boxes must be connected through these two ports.
+.SH Restrictions
+If options not listed in this reference page are
+used, the server may fail. Using invalid options for the X server
+in the
+.PN /etc/ttys
+file may cause the workstation to behave as if the
+X server is hung.
+.PP
+Multiscreen configurations can contain either two- or three-color frame
+buffer display devices or monochrome frame buffer display devices.
+.PP
+Color and monochrome frame buffer display devices
+can be installed in the same workstation, however applications
+built before X11 release 5 may become confused due to poor initial design
+of resource files.
+.PP
+To connect two screens, two command line options must be
+issued. Attaching two screens using only one
+.PN -edge_
+argument produces a one-way mouse-travel path.
+You can create a wrap-around mouse path by attaching
+noncontiguous screen edges.
+The
+.PN -edge_
+arguments are disabled on single screen systems.
+.PP
+Nonsensical screen connections are not allowed; the top edge of a
+particular screen must be connected with the bottom edge of
+another screen, and the right edge of a particular screen
+must be connected with the left edge of another screen.
+Left and right edges cannot be connected to top or bottom
+edges.
+.SH Examples
+The following example specifies that screen
+.PN 0
+has a resolution of
+100x100 dots
+per inch and screen
+.PN 1
+has a resolution of 75x70 dots per inch:
+.EX
+Xdec -dpi0 100 -dpix1 75 -dpiy1 70
+.EE
+.PP
+If no screen is specified, the value specified is used
+for all screens. If the screen resolution is not specified using
+command line options, a default value
+based on pixel dimensions and screen size is calculated for
+each screen.
+.PP
+The following example specifies that black pixels on screen
+.PN 1
+have the hexadecimal value 3a009e005c0 prefixed with a
+number sign (\fC#\fP) and white pixels on screen
+.PN 1
+are color "wheat" from the X rgb color database.
+.EX
+Xdec -bp1 #3a009e005c0 -wp1 wheat
+.EE
+For monochrome display devices, values of 0 and 1
+are the only valid pixel colors.
+.PP
+To specify the default visual class
+of a root window on a particular screen, append the screen
+number (\fC0\fP, \fC1\fP, or \fC2\fP) to the
+.PN \-class
+command line option. Possible visual classes are:
+StaticGray, StaticColor, PseudoColor, GrayScale, and TrueColor.
+The following example specifies that the screen
+.PN 0
+root window is a TrueColor visual, and the screen
+.PN 1
+root window is a PseudoColor visual.
+.EX
+Xdec -class0 TrueColor -class1 PseudoColor
+.EE
+.PP
+The following example attaches screen
+.PN 1
+above screen
+.PN 0
+and screen
+.PN 2
+to the right of screen
+.PN 0
+(an L-shaped configuration):
+.EX
+Xdec -edge_top0 1 -edge_bottom1 0 -edge_right0 2 -edge_left2 0
+.EE
+.PP
+The following example is identical to the default state (a
+horizontal line) with the addition of a wraparound from
+screen
+.PN 0
+to screen
+.PN 2 :
+.EX
+Xdec -edge_left0 2 -edge_right0 1 -edge_left1 0 -edge_right1 2 \e
+-edge_left2 1 -edge_right2 0
+.EE
+.SH Files
+.PN \&~/.Xdefaults
+.br
+.PN /etc/ttys
+.br
+.PN /etc/screens
+.SH See Also
+X(1X), xdm(1), Xserver(1)
+.\"XServer(1X)
+.\"bitmap(1X),
+.\"keycomp(1X),
+.\"dxcalc(1X),
+.\"dxcalendar(1X),
+.\"dxcardfiler(1X)
+.\"dxclock(1X),
+.\"dxmail(1X),
+.\"dxnotepad(1X),
+.\"dxterm(1X),
+.\"dxwm(1X),
+.\"uwm(1X),
+.\"xedit(1X),
+.\"xfd(1X),
+.\"xhost(1X),
+.\"xload(1X),
+.\"xmh(1X),
+.\"xset(1X),
+.\"xsetroot(1X),
+.\"xwininfo(1X)
+.br
+\fIX Window System: The Complete Reference to Xlib, X Protocol,
+ICCCM, XLFD,\fP by Robert W. Scheifler and James Gettys,
+Second Edition, Digital Press, 1990
+.br
+"X Window System Toolkit: The Complete Programmer's Guide
+and Specification, by Paul J. Asente and Ralph R. Swick,
+Digital Press, 1990
+.br
+\fIOSF/MOTIF Programmer's Guide and OSF/MOTIF Reference
+Guide,\fP Open Software Foundation, Prentice-Hall, 1990
diff --git a/xc/programs/Xserver/hw/dec/ws/acc_2da.c b/xc/programs/Xserver/hw/dec/ws/acc_2da.c
new file mode 100644
index 000000000..61e7eafcd
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/acc_2da.c
@@ -0,0 +1,68 @@
+/* $TOG: acc_2da.c /main/4 1998/02/10 12:44:34 kaleb $ */
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+
+#include "X.h"
+#include "Xproto.h"
+
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "input.h"
+#include <sys/workstation.h>
+#include "ws.h"
+
+Bool pxInitProc();
+
+wsAcceleratorTypes types[] = {
+ {"PMAG-CA ", pxInitProc },
+};
+
+int num_accelerator_types = sizeof (types) / sizeof (wsAcceleratorTypes);
diff --git a/xc/programs/Xserver/hw/dec/ws/acc_3d.c b/xc/programs/Xserver/hw/dec/ws/acc_3d.c
new file mode 100644
index 000000000..c8d6b4041
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/acc_3d.c
@@ -0,0 +1,70 @@
+/* $TOG: acc_3d.c /main/4 1998/02/10 12:44:39 kaleb $ */
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+
+#include "X.h"
+#include "Xproto.h"
+
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "input.h"
+#include <sys/workstation.h>
+#include "ws.h"
+
+Bool pxInitProc();
+
+wsAcceleratorTypes types[] = {
+ {"PMAG-DA ", pxInitProc },
+ {"PMAG-FA ", pxInitProc },
+ {"PMAG-CA ", pxInitProc },
+};
+
+int num_accelerator_types = sizeof (types) / sizeof (wsAcceleratorTypes);
diff --git a/xc/programs/Xserver/hw/dec/ws/acc_none.c b/xc/programs/Xserver/hw/dec/ws/acc_none.c
new file mode 100644
index 000000000..f7341570e
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/acc_none.c
@@ -0,0 +1,74 @@
+/* $TOG: acc_none.c /main/5 1998/02/10 12:44:46 kaleb $ */
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+
+#include "X.h"
+#include "Xproto.h"
+
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "input.h"
+#include <sys/workstation.h>
+#include "ws.h"
+
+Bool pxInitProc();
+#ifdef XV
+Bool ropInitProc();
+#endif
+
+wsAcceleratorTypes types[] = {
+#ifdef XV
+ {"PMAG-JA ", ropInitProc},
+#endif
+ {"", NULL},
+};
+
+int num_accelerator_types = sizeof (types) / sizeof (wsAcceleratorTypes);
diff --git a/xc/programs/Xserver/hw/dec/ws/cfbinit.c b/xc/programs/Xserver/hw/dec/ws/cfbinit.c
new file mode 100644
index 000000000..2740f43eb
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/cfbinit.c
@@ -0,0 +1,487 @@
+/* $TOG: cfbinit.c /main/14 1998/03/17 17:41:19 kaleb $ */
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/*
+ Todo.
+ -----
+ **** Fix plane mask handling. The screen devprivate should have
+ a hardware specific planemask setting proc. For now, since
+ pmax is the only machine with a plane mask, so keep it global
+ for now.
+*/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+
+
+#include "misc.h"
+#include "X.h"
+#include "scrnintstr.h"
+#include "pixmap.h"
+#include "input.h"
+#include "cursorstr.h"
+#include "regionstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+
+#include <sys/workstation.h>
+#include <sys/inputdevice.h>
+#include "ws.h"
+
+#include "mfb.h"
+#include "mibstore.h"
+
+extern int wsScreenPrivateIndex;
+extern CARD32 lastEventTime;
+extern int defaultColorVisualClass;
+void wsQueryBestSize();
+Bool wsRealizeCursor();
+Bool wsUnrealizeCursor();
+Bool wsDisplayCursor();
+void wsRecolorCursor();
+void wsCursorControl();
+Bool wsSetCursorPosition();
+void wsCursorLimits();
+void wsConstrainCursor();
+void wsPointerNonInterestBox();
+void wsChangeKeyboardControl();
+void wsChangePointerControl();
+void wsClick();
+
+extern ws_event_queue *queue;
+#undef VSYNCFIXED
+#ifdef VSYNCFIXED
+#define CURRENT_TIME queue->time
+#else
+#define CURRENT_TIME GetTimeInMillis()
+#endif
+
+extern int wsScreenInit();
+extern void miRecolorCursor();
+extern void NewCurrentScreen();
+extern int wsFd;
+extern ws_screen_descriptor screenDesc[];
+static ws_depth_descriptor depthDesc[MAXSCREENS];
+static mapped[MAXSCREENS];
+char *planemask_addr;
+
+/*
+ * XXX this needs to get fixed to accept a screen!!! jmg
+ */
+unsigned int
+cfbpmaxSetPlaneMask(planemask, pScreen)
+ unsigned int planemask;
+ ScreenPtr *pScreen;
+{
+ static unsigned int currentmask = ~0;
+ unsigned int result = currentmask;
+ if(planemask_addr == 0)
+ {
+ currentmask = planemask;
+ }
+ else
+ {
+ *planemask_addr = currentmask = planemask;
+
+ }
+ return result;
+}
+
+
+void
+wsQueryBestSize16(class, pwidth, pheight, pScr)
+ int class;
+ unsigned short *pwidth;
+ unsigned short *pheight;
+ ScreenPtr pScr;
+{
+ unsigned width, test;
+
+ if (*pwidth > 0)
+ {
+ switch(class)
+ {
+ case CursorShape:
+ *pwidth = 16;
+ *pheight = 16;
+ break;
+ default:
+ mfbQueryBestSize(class, pwidth, pheight, pScr);
+ break;
+ }
+ }
+}
+
+
+void
+wsQueryBestSize64(class, pwidth, pheight, pScr)
+ int class;
+ unsigned short *pwidth;
+ unsigned short *pheight;
+ ScreenPtr pScr;
+{
+ unsigned width, test;
+
+ if (*pwidth > 0)
+ {
+ switch(class)
+ {
+ case CursorShape:
+ *pwidth = 64;
+ *pheight = 64;
+ break;
+ default:
+ mfbQueryBestSize(class, pwidth, pheight, pScr);
+ break;
+ }
+ }
+}
+
+Bool
+wsScreenClose(index, pScreen)
+ int index;
+ ScreenPtr pScreen;
+{
+ wsScreenPrivate *wsp = (wsScreenPrivate *)
+ pScreen->devPrivates[wsScreenPrivateIndex].ptr;
+
+ pScreen->CloseScreen = wsp->CloseScreen;
+ Xfree(wsp);
+ return (*pScreen->CloseScreen) (index, pScreen);
+}
+
+
+static void
+colorNameToColor( pname, pred, pgreen, pblue)
+ char * pname;
+ unsigned short * pred;
+ unsigned short * pgreen;
+ unsigned short * pblue;
+{
+ if ( *pname == '#')
+ {
+ pname++; /* skip over # */
+ sscanf( pname, "%2x", pred);
+ *pred <<= 8;
+
+ pname += 2;
+ sscanf( pname, "%2x", pgreen);
+ *pgreen <<= 8;
+
+ pname += 2;
+ sscanf( pname, "%2x", pblue);
+ *pblue <<= 8;
+ }
+ else /* named color */
+ {
+ OsLookupColor( 0 /*"screen", not used*/, pname, strlen( pname),
+ pred, pgreen, pblue);
+ }
+}
+
+#ifndef LOWMEMFTPT
+extern Bool mfbScreenInit (), mcfbScreenInit(), cfbScreenInit();
+#else
+extern Bool mcfbScreenInit(), cfbScreenInit();
+#endif /* ifndef LOWMEMFTPT */
+extern Bool cfb16ScreenInit(), cfb32ScreenInit();
+
+Bool
+fbInitProc(index, pScreen, argc, argv)
+ int index;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+ int dpix, dpiy, i;
+ static int mapOnce = FALSE;
+ wsScreenPrivate *wsp;
+ int depthIndex;
+ Bool (*screenInit)();
+ ws_depth_descriptor *dd;
+ ws_visual_descriptor vd;
+ static ws_map_control mc;
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+#ifdef __alpha
+ Pixel blackPixel, whitePixel;
+#endif
+/* for initializing color map entries */
+ unsigned short blackred = 0x0000;
+ unsigned short blackgreen = 0x0000;
+ unsigned short blackblue = 0x0000;
+
+ unsigned short whitered = 0xffff;
+ unsigned short whitegreen = 0xffff;
+ unsigned short whiteblue = 0xffff;
+
+ lastEventTime = CURRENT_TIME;
+
+ wsp = (wsScreenPrivate *) Xalloc(sizeof(wsScreenPrivate));
+ wsp->pInstalledMap = NOMAPYET;
+ pScreen->devPrivates[wsScreenPrivateIndex].ptr = (pointer) wsp;
+
+ wsp->screenDesc = &screenDesc[index];
+ wsp->args = &screenArgs[index];
+
+ /* since driver does not support unmap (yet), only map screen once */
+ if (! mapped[index]) {
+ depthDesc[index].screen = screenDesc[index].screen;
+ depthIndex = -1;
+ for (i = 0; i < wsp->screenDesc->allowed_depths; i++)
+ {
+ extern int forceDepth;
+
+ depthDesc[index].which_depth = i;
+ if (ioctl(wsFd, GET_DEPTH_INFO, &depthDesc[index]) == -1) {
+ ErrorF("GET_DEPTH_INFO failed");
+ exit (1);
+ }
+ if (forceDepth)
+ depthDesc[index].depth = forceDepth;
+ switch (depthDesc[index].bits_per_pixel) {
+ case 1:
+ case 8:
+ case 16:
+ case 32:
+ break;
+ default:
+ continue;
+ }
+ depthIndex = i;
+ }
+ if (depthIndex == -1) return FALSE;
+
+ mc.screen = screenDesc[index].screen;
+ mc.which_depth = depthIndex;
+ mc.map_unmap = MAP_SCREEN;
+ if (ioctl(wsFd, MAP_SCREEN_AT_DEPTH, &mc) == -1) {
+ ErrorF("MAP_SCREEN_AT_DEPTH failed");
+ free ((char *) wsp);
+ return FALSE;
+ }
+ /*
+ * reget the depth desc. It now contains the user-mapped bitmap
+ * addr.
+ */
+ if (ioctl(wsFd, GET_DEPTH_INFO, &depthDesc[index]) == -1)
+ {
+ ErrorF("GET_DEPTH_INFO failed");
+ return FALSE;
+ }
+ if (forceDepth)
+ depthDesc[index].depth = forceDepth;
+ mapped[index] = TRUE;
+ }
+
+ /* ws routines knows how to initialize many functions, so call init. */
+ if (wsScreenInit(index, pScreen, argc, argv) == -1)
+ return FALSE;
+
+ dd = &depthDesc[index];
+
+ if (index > 0)
+ wsCursorControl(index, CURSOR_OFF);
+ wsScreens[index] = pScreen;
+
+/*
+ * this is really dumb. The driver has the screen geometry in mm.
+ * The screen wants it stored as mm, but the damn interface passes
+ * inches. mm => inches => mm. What a waste. Should we change cfbscrinit.c?
+ * -jmg.
+ */
+
+ if (screenArgs[index].flags & ARG_DPIX)
+ dpix = screenArgs[index].dpix;
+ else
+ dpix = (wsp->screenDesc->width * 254 +
+ wsp->screenDesc->monitor_type.mm_width * 5) /
+ (wsp->screenDesc->monitor_type.mm_width * 10);
+
+ if (screenArgs[index].flags & ARG_DPIY)
+ dpiy = screenArgs[index].dpiy;
+ else
+ dpiy = (wsp->screenDesc->height * 254 +
+ wsp->screenDesc->monitor_type.mm_height * 5) /
+ (wsp->screenDesc->monitor_type.mm_height * 10);
+
+ vd.screen = screenDesc[index].screen;
+ vd.which_visual = 0; /* jmg ? */
+ if (ioctl(wsFd, GET_VISUAL_INFO, &vd) == -1)
+ {
+ ErrorF("GET_VISUAL_INFO failed");
+ return FALSE;
+ }
+
+ defaultColorVisualClass = vd.screen_class;
+ if(screenArgs[index].flags & ARG_CLASS)
+ defaultColorVisualClass = screenArgs[index].class;
+
+ /* Might want to make this table driven - jmg */
+
+ switch (dd->bits_per_pixel)
+ {
+#ifndef LOWMEMFTPT
+ case 1:
+ screenInit = mfbScreenInit;
+ break;
+#else
+ case 1:
+#endif /* ifndef LOWMEMFTPT */
+ case 8:
+ case 16:
+ case 32:
+ screenInit = mcfbScreenInit;
+ break;
+ }
+ if (dd->depth == 1)
+ {
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ if(screenArgs[index].flags & ARG_BLACKVALUE)
+ if((i = atoi(screenArgs[index].blackValue)) == 0 || i == 1)
+ pScreen->blackPixel = i;
+ else
+ wsPixelError(index);
+
+ if(screenArgs[index].flags & ARG_WHITEVALUE)
+ if((i = atoi(screenArgs[index].whiteValue)) == 0 || i == 1)
+ pScreen->whitePixel = i;
+ else
+ wsPixelError(index);
+ }
+ else
+ {
+ if(screenArgs[index].flags & ARG_BLACKVALUE)
+ colorNameToColor(screenArgs[index].blackValue, &blackred,
+ &blackgreen, &blackblue);
+
+ if(screenArgs[index].flags & ARG_WHITEVALUE)
+ colorNameToColor(screenArgs[index].whiteValue, &whitered,
+ &whitegreen, &whiteblue);
+
+ }
+
+#ifdef ultrix
+#define FB_BITS dd->pixmap
+#else
+#define FB_BITS dd->plane_mask
+#endif
+
+ if (!(*screenInit) (pScreen, FB_BITS,
+ dd->fb_width, dd->fb_height,
+ dpix, dpiy, dd->fb_width, dd->bits_per_pixel, dd->depth))
+ {
+ return FALSE;
+ }
+
+ miInitializeBackingStore(pScreen);
+
+ if (dd->depth == 1)
+ {
+#ifndef LOWMEMFTPT
+ mfbCreateDefColormap(pScreen);
+#else
+ cfbCreateDefColormap(pScreen);
+#endif /* ifndef LOWMEMFTPT */
+ }
+ else
+ {
+ /* copy of cfbCreateDefColormap, except variable colors */
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++)
+ ;
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0)
+ != Success)
+ return FALSE;
+#ifndef __alpha
+ if ((AllocColor(pCmap, &whitered, &whitegreen, &whiteblue,
+ &(pScreen->whitePixel), 0) != Success) ||
+ (AllocColor(pCmap, &blackred, &blackgreen, &blackblue,
+ &(pScreen->blackPixel), 0) != Success))
+ {
+ return FALSE;
+ }
+#else
+ /*
+ * It could be argued that this is unnecessary because the DEC
+ * is little-endian and you get what you need, but it does
+ * eliminate a warning from the compiler.
+ */
+ whitePixel = blackPixel = 0;
+ if ((AllocColor(pCmap, &whitered, &whitegreen, &whiteblue,
+ &whitePixel, 0) != Success) ||
+ (AllocColor(pCmap, &blackred, &blackgreen, &blackblue,
+ &blackPixel, 0) != Success))
+ {
+ return FALSE;
+ }
+ else
+ {
+ pScreen->whitePixel = whitePixel;
+ pScreen->blackPixel = blackPixel;
+ }
+#endif
+ (*pScreen->InstallColormap)(pCmap);
+ }
+ planemask_addr = dd->plane_mask;
+
+ /* Wrap screen close routine to avoid memory leak */
+ wsp->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = wsScreenClose;
+
+ if(wsp->screenDesc->cursor_width == 64)
+ pScreen->QueryBestSize = wsQueryBestSize64;
+ else
+ pScreen->QueryBestSize = wsQueryBestSize16;
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/dec/ws/ext_device.c b/xc/programs/Xserver/hw/dec/ws/ext_device.c
new file mode 100644
index 000000000..cdba79b2a
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/ext_device.c
@@ -0,0 +1,528 @@
+/***********************************************************
+
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/*
+ * This file holds the hook routines for adding extension input devices.
+ *
+ * Jeffrey Hsu, Digital Equipment Corporation,
+ *
+ */
+
+/* $TOG: ext_device.c /main/4 1998/02/10 12:44:58 kaleb $ */
+
+#ifdef XINPUT
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <sys/devio.h>
+
+#include "misc.h"
+#include "X.h"
+#define NEED_EVENTS
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "pixmap.h"
+#include "input.h"
+#include "cursorstr.h"
+#include "regionstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include <sys/workstation.h>
+#include <sys/inputdevice.h>
+#include <sys/wsdevice.h>
+#include "ws.h"
+
+#include <sys/tablet.h>
+#include <sys/pcm.h>
+#include <sys/termio.h>
+
+#include "XI.h" /* for Absolute and Relative #define */
+#include "XIproto.h" /* for deviceKeyButtonPointer */
+
+/* XXX copied from ws_io.c, get it into some header file somewhere */
+#define MOTION_BUFFER_SIZE 100
+extern int wsGetMotionEvents();
+
+extern Bool commandLinePairMatch(); /* secret function */
+
+extern int DeviceButtonPress, DeviceButtonRelease, DeviceButtonRelease,
+ DeviceMotionNotify, ProximityIn, ProximityOut, DeviceValuator;
+
+static DevicePtr wsTablet, wsButtonBox, wsDialBox;
+
+static void wsButtonBoxControl(), wsDialBoxControl();
+static int wsButtonBoxProc(), wsDialBoxProc(), wsTabletProc();
+
+int tbFd; /* tablet file descriptor */
+int pcmFd;
+
+/* return TRUE if recognized device type */
+Bool
+ExtProcessInputEvents(x, e)
+xEvent *x;
+ws_event *e;
+{
+
+ /*
+ * X Input Extension events can have more than one event structure per
+ * device event
+ */
+ xEvent eventarray[3]; /* make this 3 until some device needs more */
+ deviceValuator *vev;
+ deviceValuator valuatorevent;
+ int eventcount;
+
+ deviceKeyButtonPointer *inputEv = (deviceKeyButtonPointer *) x;
+ tablet_event *tabev = (tablet_event *) e;
+ dial_event *dialev = (dial_event *) e;
+
+ switch (e->device_type) {
+ case STABLET_DEVICE:
+ switch (e->type) {
+ case BUTTON_DOWN_TYPE:
+ x->u.u.type = DeviceButtonPress;
+ break;
+ case BUTTON_UP_TYPE:
+ x->u.u.type = DeviceButtonRelease;
+ break;
+ case MOTION_TYPE:
+ x->u.u.type = DeviceMotionNotify;
+ break;
+ case PROXIMITY_IN:
+ x->u.u.type = ProximityIn;
+ break;
+ case PROXIMITY_OUT:
+ x->u.u.type = ProximityOut;
+ break;
+ default:
+ printf("Unknown tablet event = %d\n", e->type);
+ return(TRUE);
+ }
+ vev = (deviceValuator *) &eventarray[1];
+ vev->type = DeviceValuator;
+ vev->num_valuators = 2;
+ vev->first_valuator = 0;
+ vev->valuator0 = tabev->axis_data[0];
+ vev->valuator1 = tabev->axis_data[1];
+ vev->device_state = e->e.pointer.buttons;
+ vev->deviceid = e->device;
+ eventcount = 2;
+ inputEv->deviceid = e->device | MORE_EVENTS;
+ eventarray[0] = *x;
+ (*wsTablet->processInputProc) (eventarray, wsTablet, eventcount);
+ break;
+ case BUTTONBOX_DEVICE:
+ switch (e->type) {
+ case BUTTON_DOWN_TYPE:
+ x->u.u.type = DeviceButtonPress;
+ break;
+ case BUTTON_UP_TYPE:
+ x->u.u.type = DeviceButtonRelease;
+ break;
+ default:
+ printf("Unknown button box event = %d\n", e->type);
+ return(TRUE);
+ }
+ (*wsButtonBox->processInputProc) (x, wsButtonBox, 1);
+ break;
+ case KNOBBOX_DEVICE:
+ switch (e->type) {
+ case MOTION_TYPE:
+ x->u.u.type = DeviceMotionNotify;
+ break;
+ default:
+ printf("Unknown dial box event = %d\n", e->type);
+ return(TRUE);
+ }
+
+ vev = (deviceValuator *) &eventarray[1];
+ vev->type = DeviceValuator;
+ vev->num_valuators = 6;
+ vev->first_valuator = 0;
+ vev->valuator0 = dialev->axis_data[0];
+ vev->valuator1 = dialev->axis_data[1];
+ vev->valuator2 = dialev->axis_data[2];
+ vev->valuator3 = dialev->axis_data[3];
+ vev->valuator4 = dialev->axis_data[4];
+ vev->valuator5 = dialev->axis_data[5];
+ vev->device_state = e->e.pointer.buttons;
+ vev->deviceid = e->device;
+
+ vev = (deviceValuator *) &eventarray[2];
+ vev->type = DeviceValuator;
+ vev->num_valuators = 2;
+ vev->first_valuator = 6;
+ vev->valuator0 = dialev->axis_data[6];
+ vev->valuator1 = dialev->axis_data[7];
+ vev->device_state = e->e.pointer.buttons;
+ vev->deviceid = e->device;
+
+ eventcount = 3;
+ inputEv->deviceid = e->device;
+ eventarray[0] = *x;
+ (*wsDialBox->processInputProc) (eventarray, wsDialBox, eventcount);
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int
+ExtddxProcessArgument (argc, argv, i)
+register int argc;
+register char *argv[];
+register int i;
+{
+
+ int argind=i;
+ int skip = 0;
+
+ if (strcmp(argv[argind], "-tb") == 0) {
+ if (++argind < argc) {
+ /* defer processing to InitInput */
+ /* should think up cleaner solution XXX */
+ skip = 2;
+ }
+ else return 0;
+ } else if (strcmp(argv[argind], "-pcm") == 0) {
+ if (++argind < argc) {
+ /* defer processing to InitInput */
+ /* should think up cleaner solution XXX */
+ skip = 2;
+ }
+ else return 0;
+ }
+
+ return skip;
+
+}
+
+void
+ExtddxUseMsg()
+{
+ ErrorF("-tb <tty number n> open /dev/tty0n for tablet\n");
+ ErrorF("-pcm <tty number n> open /dev/tty0n for pcm\n");
+}
+
+void
+ExtInitInput(argc, argv)
+{
+
+ DevicePtr t;
+ char *tabletline, buf[256], *pcmline;
+ int linenumber;
+ int i;
+ struct termio termio;
+
+ if (commandLinePairMatch( argc, argv, "-tb", &tabletline)) {
+ sscanf(tabletline, "%d", &linenumber);
+ sprintf(buf, "/dev/tty0%d", linenumber);
+ if ((tbFd = open(buf, O_RDWR, 0)) < 0) {
+ Error("couldn't open device");
+ return;
+ }
+
+ if (ioctl(tbFd, TCGETA, &termio) < 0) {
+ Error("TCGETA");
+ return;
+ }
+
+ /* someday I will do this in the line discpline open XXX */
+ termio.c_cflag = (B4800 | PARENB | PARODD | CREAD | CS8);
+ termio.c_iflag &= ~ISTRIP;
+
+ if (ioctl(tbFd, TCSETA, &termio) < 0) {
+ Error("TCSETA");
+ return;
+ }
+
+ i = TABLDISC;
+ if (ioctl(tbFd, TIOCSETD, &i) < 0) {
+ Error("couldn't set line discipline");
+ return;
+ }
+
+ i = 0;
+ if (ioctl(tbFd, BIOSTYPE, &i) < 0) {
+ Error("couldn't set line discipline");
+ return;
+ }
+
+ t = AddInputDevice(wsTabletProc, TRUE);
+
+ RegisterOtherDevice(t);
+
+ }
+
+ if (commandLinePairMatch( argc, argv, "-pcm", &pcmline)) {
+ sscanf(pcmline, "%d", &linenumber);
+ sprintf(buf, "/dev/tty0%d", linenumber);
+ if ((pcmFd = open(buf, O_RDWR, 0)) < 0) {
+ Error("couldn't open device");
+ return;
+ }
+
+ if (ioctl(pcmFd, TCGETA, &termio) < 0) {
+ Error("TCGETA");
+ return;
+ }
+
+ /* someday I will do this in the line discpline open XXX */
+ termio.c_cflag = (B9600 | CREAD | CS8 | CLOCAL);
+ termio.c_iflag &= ~ISTRIP;
+ termio.c_iflag |= IXOFF;
+
+ if (ioctl(pcmFd, TCSETA, &termio) < 0) {
+ Error("TCSETA");
+ return;
+ }
+
+ i = PCMDISC;
+ if (ioctl(pcmFd, TIOCSETD, &i) < 0) {
+ Error("couldn't set line discipline");
+ return;
+ }
+
+ t = AddInputDevice(wsButtonBoxProc, TRUE);
+ RegisterOtherDevice(t);
+
+ t = AddInputDevice(wsDialBoxProc, TRUE);
+ RegisterOtherDevice(t);
+ }
+
+}
+
+void
+ExtInitOutput(screenInfo, argc, argv)
+ScreenInfo *screenInfo;
+int argc;
+char **argv;
+{
+/* nothing to do yet */
+}
+
+static void
+wsButtonBoxControl(device, ctrl)
+DevicePtr device;
+LedCtrl *ctrl;
+{
+ int mask = ctrl->led_values;
+
+ if (ioctl(pcmFd, PIOSETLED, &mask) < 0) {
+ Error("wsButtonBoxControl");
+ }
+}
+
+static int
+wsButtonBoxProc(pDev, onoff, argc, argv)
+DevicePtr pDev;
+int onoff, argc;
+char *argv[];
+{
+ BYTE map[33];
+
+ int i;
+ Atom typeatom;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ wsButtonBox = pDev;
+ for (i=1; i<=32; i++)
+ map[i] = i;
+ InitButtonClassDeviceStruct(pDev, 32, map);
+ InitLedFeedbackClassDeviceStruct(pDev, wsButtonBoxControl);
+ InitFocusClassDeviceStruct(pDev);
+ typeatom = MakeAtom("BUTTONBOX", 9, FALSE);
+ AssignTypeAndName(pDev, typeatom, "BUTTONBOX");
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+ case DEVICE_CLOSE:
+ if (pcmFd) {
+ close(pcmFd);
+ pcmFd = 0;
+ }
+ break;
+ }
+ return Success;
+}
+
+static void
+wsDialBoxControl(device, ctrl)
+DevicePtr device;
+PtrCtrl *ctrl;
+{
+ struct dial_control control;
+
+ control.smoothing = ctrl->num / ctrl->den;
+ control.threshold = ctrl->threshold;
+
+ /*
+ InitPtrFeedbackClassDeviceStruct should not call the control
+ routine for extension devices with defaultPointerControl values,
+ which may be wrong, don't think there is a fix, so live w/ it
+ */
+
+ /* hardware should not freak out when given a threshold of 0
+ and a smoothing factor of 0 */
+ if (!control.smoothing)
+ control.smoothing = 1;
+ if (!control.threshold)
+ control.threshold = 1;
+
+ if (ioctl(pcmFd, PIOSETKNOB, &control) < 0) {
+ Error("wsDialBoxControl");
+ }
+}
+
+static int
+wsDialBoxProc(pDev, onoff, argc, argv)
+DevicePtr pDev;
+int onoff, argc;
+char *argv[];
+{
+ Atom typeatom;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ wsDialBox = pDev;
+ InitValuatorClassDeviceStruct(pDev, 8, wsGetMotionEvents,
+ MOTION_BUFFER_SIZE, Relative);
+ InitValuatorAxisStruct(pDev, 0, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 1, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 2, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 3, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 4, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 5, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 6, -32768, 32767, 1);
+ InitValuatorAxisStruct(pDev, 7, -32768, 32767, 1);
+ InitPtrFeedbackClassDeviceStruct(pDev, wsDialBoxControl);
+ InitFocusClassDeviceStruct(pDev);
+ typeatom = MakeAtom("KNOB_BOX", 8, FALSE);
+ AssignTypeAndName(pDev, typeatom, "KNOB_BOX");
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+ case DEVICE_CLOSE:
+ if (pcmFd) {
+ close(pcmFd);
+ pcmFd = 0;
+ }
+ break;
+ }
+ return Success;
+}
+
+static int
+wsTabletProc(pDev, onoff, argc, argv)
+DevicePtr pDev;
+int onoff, argc;
+char *argv[];
+{
+
+ BYTE map[5];
+ Atom typeatom;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ wsTablet = pDev;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ map[4] = 4;
+ /* InitPointerDeviceStruct(
+ pDev, map, 4, wsGetMotionEvents,
+ wsChangeTabletControl, MOTION_BUFFER_SIZE); */
+ InitButtonClassDeviceStruct(pDev, 4, map);
+ InitValuatorClassDeviceStruct(pDev, 2, wsGetMotionEvents,
+ MOTION_BUFFER_SIZE, Absolute);
+ InitValuatorAxisStruct(pDev, 0, 0, 2199, 7874);
+ InitValuatorAxisStruct(pDev, 1, 0, 2199, 7874);
+ /* 200 * 39.37 XXX */
+/* InitPtrFeedbackClassDeviceStruct(pDev, wsTabletControl); */
+ InitProximityClassDeviceStruct(pDev);
+ InitFocusClassDeviceStruct(pDev);
+ typeatom = MakeAtom("TABLET", 6, FALSE);
+ AssignTypeAndName(pDev, typeatom, "TABLET");
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+/* only need to select off mouse file descriptor */
+/* AddEnabledDevice(tbFd); */
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+/* RemoveEnabledDevice(tbFd); */
+ break;
+ case DEVICE_CLOSE:
+ close(tbFd);
+ break;
+ }
+ return Success;
+}
+
+#ifdef notdef
+void
+wsChangeTabletControl(device, ctrl)
+ DevicePtr device;
+ TabletCtrl *ctrl;
+{
+/* XXX */
+}
+#endif
+#endif
diff --git a/xc/programs/Xserver/hw/dec/ws/init.c b/xc/programs/Xserver/hw/dec/ws/init.c
new file mode 100644
index 000000000..ea9239769
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/init.c
@@ -0,0 +1,306 @@
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: init.c /main/14 1998/03/17 16:39:04 kaleb $ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+
+#include "X.h"
+
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "input.h"
+/* XXX */
+#include <sys/workstation.h>
+#ifdef __alpha
+#include <machine/hal_sysinfo.h>
+#endif
+#include <sys/inputdevice.h>
+#include "ws.h"
+
+extern int wsMouseProc();
+extern int wsKeybdProc();
+extern void wsClick();
+extern void wsChangePointerControl();
+extern void mcfbFillInMissingPixmapDepths();
+
+extern KeybdCtrl defaultKeyboardControl;
+ws_event_queue *queue;
+
+static int NumFormats;
+static int bitsPerDepth[33];
+
+Bool fbInitProc();
+extern int num_accelerator_types;
+
+extern wsAcceleratorTypes types[];
+
+ws_screen_descriptor screenDesc[MAXSCREENS];
+
+Bool
+commandLineMatch( argc, argv, pat, pmatch)
+ int argc; /* may NOT be changed */
+ char * argv[]; /* may NOT be changed */
+ char * pat;
+{
+ int ic;
+
+ for ( ic=0; ic<argc; ic++)
+ if ( strcmp( argv[ic], pat) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+Bool
+commandLinePairMatch( argc, argv, pat, pmatch)
+ int argc; /* may NOT be changed */
+ char * argv[]; /* may NOT be changed */
+ char * pat;
+ char ** pmatch; /* RETURN */
+{
+ register int ic;
+
+ for ( ic=0; ic<argc; ic++)
+ if ( strcmp( argv[ic], pat) == 0) {
+ *pmatch = argv[ ic+1];
+ return TRUE;
+ }
+ return FALSE;
+}
+
+ws_descriptor wsinfo;
+int wsFd;
+int ws_cpu;
+int forceDepth;
+
+int wsScreenPrivateIndex;
+/* the following filth is forced by a broken dix interface */
+
+#ifndef PRINT_ONLY_SERVER
+void
+InitOutput(screenInfo, argc, argv)
+ ScreenInfo *screenInfo;
+ int argc;
+ char **argv;
+{
+ int i, j;
+ int si = 0;
+ static int inited = FALSE;
+
+ if (!inited) {
+ char *forceD;
+ ws_keyboard_control control;
+ struct stat statbuf;
+ inited = TRUE;
+ if (!stat("/dev/ws0", &statbuf)) {
+ if ((wsFd = open("/dev/ws0", O_RDWR, 0)) < 0) {
+ ErrorF("couldn't open device /dev/ws0\n");
+ exit (1);
+ }
+ } else {
+ if ((wsFd = open("/dev/mouse", O_RDWR, 0)) < 0) {
+ ErrorF("couldn't open device /dev/mouse\n");
+ exit (1);
+ }
+ }
+ if (ioctl (wsFd, GET_WORKSTATION_INFO, &wsinfo) != 0) {
+ FatalError("GET_WORKSTATION_INFO failed, errno %d (%s)\n",
+ errno, strerror(errno));
+ }
+ control.device_number = wsinfo.console_keyboard;
+ if (ioctl(wsFd, GET_KEYBOARD_CONTROL, &control) == -1) {
+ FatalError("GET_KEYBOARD_CONTROL failed, errno %d (%s)\n",
+ errno, strerror(errno));
+ }
+ memmove(defaultKeyboardControl.autoRepeats, control.autorepeats, 32);
+
+ /* turn off cursors on additional screens initially */
+/*
+ * jmg - have to do a lot of other stuff here dealing with visuals
+ * and depths
+ */
+ /*
+ * deal with arguments. Note we don't bother until we've successfully
+ * opened the device.
+ */
+
+ if (commandLinePairMatch( argc, argv, "-forceDepth", &forceD))
+ sscanf ( forceD, "%d", &forceDepth);
+ }
+ for (i = 1; i <= 32; i++)
+ bitsPerDepth[i] = 0;
+
+ for (i = 0; i < wsinfo.num_screens_exist; i++)
+ {
+ ws_screen_descriptor screeninfo;
+ ws_depth_descriptor depthinfo;
+
+ screeninfo.screen = i;
+ ioctl (wsFd, GET_SCREEN_INFO, &screeninfo);
+ for (j = 0; j < screeninfo.allowed_depths; j++)
+ {
+ depthinfo.screen = i;
+ depthinfo.which_depth = j;
+ ioctl (wsFd, GET_DEPTH_INFO, &depthinfo);
+ if (forceDepth)
+ depthinfo.depth = forceDepth;
+ if (bitsPerDepth[depthinfo.depth] &&
+ bitsPerDepth[depthinfo.depth] != depthinfo.bits_per_pixel)
+ {
+ FatalError ("Screens with mismatching bpp for depth %d\n",
+ depthinfo.depth);
+ }
+ bitsPerDepth[depthinfo.depth] = depthinfo.bits_per_pixel;
+ }
+ }
+ if (!bitsPerDepth[1])
+ bitsPerDepth[1] = 1;
+
+ mcfbFillInMissingPixmapDepths(bitsPerDepth);
+
+ NumFormats = 0;
+ for (i = 1; i <= 32; i++)
+ {
+ if (j = bitsPerDepth[i]) {
+ if (NumFormats >= MAXFORMATS)
+ FatalError ("MAXFORMATS is too small for this machine\n");
+ screenInfo->formats[NumFormats].depth = i;
+ screenInfo->formats[NumFormats].bitsPerPixel = j;
+ screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+ NumFormats++;
+ }
+ }
+
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NumFormats;
+
+ wsScreenPrivateIndex = AllocateScreenPrivateIndex();
+#ifdef __alpha
+ if (getsysinfo(GSI_CPU, (caddr_t)&ws_cpu, sizeof(ws_cpu), 0, 0) == -1) {
+ fprintf(stderr,"INIT: cannot get cputype.\n");
+ exit(1);
+ }
+#else
+ ws_cpu = wsinfo.cpu;
+#endif
+ for(i = 0; i < wsinfo.num_screens_exist; i++) {
+ int j, DECaccelerator = FALSE;
+ screenDesc[si].screen = i;
+ if (ioctl(wsFd, GET_SCREEN_INFO, &screenDesc[si]) == -1) {
+ FatalError("GET_SCREEN_INFO failed, errno %d (%s)\n",
+ errno, strerror(errno));
+ }
+ if (si >= MAXSCREENS) {
+ ErrorF ("Server configured for %d screens, can't configure screen %d\n", MAXSCREENS, si);
+ break;
+ }
+ for (j = 0; j < num_accelerator_types; j++) {
+ if (strcmp (screenDesc[si].moduleID, types[j].moduleID) == 0) {
+ DECaccelerator = TRUE;
+ break;
+ }
+ }
+ if(DECaccelerator)
+ j = AddScreen(types[j].createProc, argc, argv);
+ else
+ j = AddScreen(fbInitProc, argc, argv);
+ /*
+ * AddScreen either returns -1 (error) or # of screens installed
+ * (current index). screenDesc[] is exactly parallel to
+ * screenInfo.screens[] since the initProc() arg will be called
+ * with AddScreen's index, which in turn gets used for screenDesc[].
+ */
+ if (j == -1) {
+ ErrorF("Could not AddScreen, ID = %s\n",
+ screenDesc[si].moduleID);
+ } else
+ si = j+1;
+ }
+#ifdef XINPUT
+ ExtInitOutput(screenInfo, argc, argv);
+#endif
+}
+
+
+
+void
+InitInput(argc, argv)
+ int argc;
+ char *argv[];
+{
+ DevicePtr p, k;
+ static int inited = FALSE;
+
+ p = AddInputDevice(wsMouseProc, TRUE);
+
+ k = AddInputDevice(wsKeybdProc, TRUE);
+
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+
+#ifdef XINPUT
+ ExtInitInput(argc, argv);
+#endif
+
+ if (!inited) {
+ inited = TRUE;
+ if (ioctl(wsFd, GET_AND_MAP_EVENT_QUEUE, &queue) == -1) {
+ FatalError("GET_AND_MAP_EVENT_QUEUE failed, errno %d (%s)\n",
+ errno, strerror(errno));
+ }
+ }
+ SetTimeSinceLastInputEvent ();
+}
+#endif /* PRINT_ONLY_SERVER */
+
diff --git a/xc/programs/Xserver/hw/dec/ws/keynames.h b/xc/programs/Xserver/hw/dec/ws/keynames.h
new file mode 100644
index 000000000..73c1c6824
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/keynames.h
@@ -0,0 +1,164 @@
+/* $TOG: keynames.h /main/4 1998/02/10 12:45:11 kaleb $ */
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* Keycodes for lk201 and lk401 keyboards used by code in ws_io.c
+ that loads default keysym values from a file.
+*/
+
+#define MIN_LK201_KEY 86
+#define MAX_LK201_KEY 251
+#define LK201_GLYPHS_PER_KEY 2
+
+/* the keys themselves */
+
+#define KEY_F1 86
+#define KEY_F2 87
+#define KEY_F3 88
+#define KEY_F4 89
+#define KEY_F5 90
+#define KEY_F6 100
+#define KEY_F7 101
+#define KEY_F8 102
+#define KEY_F9 103
+#define KEY_F10 104
+#define KEY_F11 113
+#define KEY_F12 114
+#define KEY_F13 115
+#define KEY_F14 116
+#define KEY_HELP 124
+#define KEY_MENU 125
+#define KEY_F17 128
+#define KEY_F18 129
+#define KEY_F19 130
+#define KEY_F20 131
+#define KEY_FIND 138
+#define KEY_INSERT_HERE 139
+#define KEY_REMOVE 140
+#define KEY_SELECT 141
+#define KEY_PREV_SCREEN 142
+#define KEY_NEXT_SCREEN 143
+#define KEY_KP_0 146 /* key pad */
+#define KEY_KP_PERIOD 148 /* key pad */
+#define KEY_KP_ENTER 149 /* key pad */
+#define KEY_KP_1 150 /* key pad */
+#define KEY_KP_2 151 /* key pad */
+#define KEY_KP_3 152 /* key pad */
+#define KEY_KP_4 153 /* key pad */
+#define KEY_KP_5 154 /* key pad */
+#define KEY_KP_6 155 /* key pad */
+#define KEY_KP_COMMA 156 /* key pad */
+#define KEY_KP_7 157 /* key pad */
+#define KEY_KP_8 158 /* key pad */
+#define KEY_KP_9 159 /* key pad */
+#define KEY_KP_HYPHEN 160
+#define KEY_KP_PF1 161
+#define KEY_KP_PF2 162
+#define KEY_KP_PF3 163
+#define KEY_KP_PF4 164
+#define KEY_LEFT 167
+#define KEY_RIGHT 168
+#define KEY_DOWN 169
+#define KEY_UP 170
+#define KEY_SHIFT_R 171 /* LK401 */
+#define KEY_ALT_L 172 /* LK401 */
+#define KEY_COMPOSE_R 173 /* LK401 */
+#define KEY_SHIFT 174
+#define KEY_SHIFT_L 174
+#define KEY_CTRL 175
+#define KEY_LOCK 176
+#define KEY_COMPOSE 177
+#define KEY_APPLE 177
+#define KEY_META 177
+#define KEY_ALT_R 178 /* LK401 */
+#define KEY_DELETE 188
+#define KEY_RETURN 189
+#define KEY_TAB 190
+#define KEY_TILDE 191
+#define KEY_TR_1 192 /* Top Row */
+#define KEY_Q 193
+#define KEY_A 194
+#define KEY_Z 195
+#define KEY_TR_2 197
+#define KEY_W 198
+#define KEY_S 199
+#define KEY_X 200
+#define KEY_LANGLE_RANGLE 201 /* xxx */
+#define KEY_TR_3 203
+#define KEY_E 204
+#define KEY_D 205
+#define KEY_C 206
+#define KEY_TR_4 208
+#define KEY_R 209
+#define KEY_F 210
+#define KEY_V 211
+#define KEY_SPACE 212
+#define KEY_TR_5 214
+#define KEY_T 215
+#define KEY_G 216
+#define KEY_B 217
+#define KEY_TR_6 219
+#define KEY_Y 220
+#define KEY_H 221
+#define KEY_N 222
+#define KEY_TR_7 224
+#define KEY_U 225
+#define KEY_J 226
+#define KEY_M 227
+#define KEY_TR_8 229
+#define KEY_I 230
+#define KEY_K 231
+#define KEY_COMMA 232 /* xxx */
+#define KEY_TR_9 234
+#define KEY_O 235
+#define KEY_L 236
+#define KEY_PERIOD 237 /* xxx */
+#define KEY_TR_0 239
+#define KEY_P 240
+#define KEY_SEMICOLON 242 /* xxx */
+#define KEY_QMARK 243
+#define KEY_PLUS 245 /* xxx */
+#define KEY_RBRACE 246
+#define KEY_VBAR 247 /* xxx */
+#define KEY_UBAR 249 /* xxx */
+#define KEY_LBRACE 250
+#define KEY_QUOTE 251
diff --git a/xc/programs/Xserver/hw/dec/ws/mdepthinit.c b/xc/programs/Xserver/hw/dec/ws/mdepthinit.c
new file mode 100644
index 000000000..d6aabaec6
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/mdepthinit.c
@@ -0,0 +1,270 @@
+/* $TOG: mdepthinit.c /main/10 1998/03/17 16:39:08 kaleb $ */
+/*
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/* $XFree86: xc/programs/Xserver/hw/dec/ws/mdepthinit.c,v 1.5 1999/01/31 12:21:43 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "gcstruct.h"
+#include "mibstore.h"
+
+extern int defaultColorVisualClass;
+
+#ifndef SINGLEDEPTH
+
+Bool
+mcfbCreateGC(pGC)
+ GCPtr pGC;
+{
+ switch (BitsPerPixel(pGC->depth)) {
+ case 1:
+ return mfbCreateGC (pGC);
+ case 8:
+ return cfbCreateGC (pGC);
+ case 16:
+ return cfb16CreateGC (pGC);
+ case 32:
+ return cfb32CreateGC (pGC);
+ }
+ return FALSE;
+}
+
+void
+mcfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pdstStart; /* where to put the bits */
+{
+ switch (BitsPerPixel(pDrawable->depth)) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+void
+mcfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (BitsPerPixel(pDrawable->depth))
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+Bool
+mcfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int depth; /* depth of root */
+ int bpp; /* bits per pixel of root */
+{
+ extern int cfbWindowPrivateIndex;
+ extern int cfbGCPrivateIndex;
+
+ switch (bpp) {
+#ifdef LOWMEMFTPT
+ case 1:
+#endif
+ case 8:
+ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 16:
+ cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 32:
+ cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ default:
+ return FALSE;
+ }
+ pScreen->CreateGC = mcfbCreateGC;
+ pScreen->GetImage = mcfbGetImage;
+ pScreen->GetSpans = mcfbGetSpans;
+ return TRUE;
+}
+
+extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex;
+
+Bool
+mcfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ int i;
+ pointer oldDevPrivate;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ VisualID defaultVisual;
+ int rootdepth;
+ extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec;
+ extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen();
+
+ rootdepth = depth;
+ if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual, 1 << (bpp - 1), 8))
+ return FALSE;
+ rootdepth = depth;
+ oldDevPrivate = pScreen->devPrivate;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ switch(bpp)
+ {
+#ifdef LOWMEMFTPT
+ case 1:
+#endif
+ case 8:
+ pScreen->CloseScreen = cfbCloseScreen;
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ break;
+ case 16:
+ pScreen->CloseScreen = cfb16CloseScreen;
+ pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb16BSFuncRec;
+ break;
+ case 32:
+ pScreen->CloseScreen = cfb32CloseScreen;
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr = pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb32BSFuncRec;
+ break;
+ }
+ return TRUE;
+}
+
+
+/* dts * (inch/dot) * (25.4 mm / inch) = mm */
+
+Bool
+mcfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ if (!mcfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth))
+ return FALSE;
+ return mcfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth);
+}
+
+void
+mcfbFillInMissingPixmapDepths(bitsPerDepth)
+ int *bitsPerDepth;
+{
+ int i, j;
+
+ j = 0;
+ for (i = 1; i <= 32; i++)
+ {
+ if (bitsPerDepth[i])
+ j |= 1 << (bitsPerDepth[i] - 1);
+ }
+ if (!(j & (1 << 3)))
+ bitsPerDepth[4] = 8;
+ if (!(j & (1 << 7)))
+ bitsPerDepth[8] = 8;
+ if (!(j & (1 << 15)))
+ bitsPerDepth[12] = 32;
+ if (!(j & (1 << 23)))
+ bitsPerDepth[24] = 32;
+ if (!(j & (1 << 31)))
+ bitsPerDepth[32] = 32;
+}
+
+#else /* SINGLEDEPTH */
+
+/* stuff for 8-bit only server */
+
+Bool
+mcfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp, depth)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+{
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp, depth);
+}
+
+void
+mcfbFillInMissingPixmapDepths(bitsPerDepth)
+ int *bitsPerDepth;
+{
+ /* This does something useful in the multidepth case. We don't
+ * do anything in the single depth case, but we still have to provide
+ * the function for linking.
+ */
+}
+
+#endif /* SINGLEDEPTH */
diff --git a/xc/programs/Xserver/hw/dec/ws/ws.h b/xc/programs/Xserver/hw/dec/ws/ws.h
new file mode 100644
index 000000000..cf30dc085
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/ws.h
@@ -0,0 +1,163 @@
+/************************************************************************
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: ws.h /main/6 1998/02/10 12:45:22 kaleb $ */
+
+#ifndef NO_DEC_VALUE_ADDED
+#define SCREENW6 640
+#define SCREENW8 800
+#define SCREENW10 1024
+#define SCREENW12 1280
+
+#define SCREENH6 480
+#define SCREENH8 600
+#define SCREENH10 768
+#define SCREENH12 1024
+
+
+#define DEF_SCREEN_WIDTH 1024;
+#define DEF_SCREEN_HEIGHT 768;
+#endif
+
+#define NOMAPYET (ColormapPtr) 1
+
+#define ARG_DPIX (1 << 0)
+#define ARG_DPIY (1 << 1)
+#define ARG_DPI (1 << 2)
+#define ARG_BLACKVALUE (1 << 3)
+#define ARG_WHITEVALUE (1 << 4)
+#define ARG_CLASS (1 << 5)
+#define ARG_EDGE_L (1 << 6)
+#define ARG_EDGE_R (1 << 7)
+#define ARG_EDGE_T (1 << 8)
+#define ARG_EDGE_B (1 << 9)
+#define ARG_MONITOR (1 << 10)
+#define ARG_DEPTH (1 << 11)
+#ifndef NO_DEC_VALUE_ADDED
+#define ARG_TXXORFIX (1 << 12) /* for TX */
+#define ARG_TXBANKSW (1 << 13) /* for TX */
+#define ARG_TXRVISUAL (1 << 14) /* for TX */
+#define ARG_SCREEN (1 << 15) /* */
+#define ARG_VSYNC (1 << 16) /* */
+#endif
+
+typedef struct {
+ int flags;
+ int dpix;
+ int dpiy;
+ int dpi;
+ int class;
+ char *blackValue;
+ char *whiteValue;
+ int edge_left;
+ int edge_right;
+ int edge_top;
+ int edge_bottom;
+ ws_monitor monitor;
+ int depth;
+#ifndef NO_DEC_VALUE_ADDED
+ int txXorFix; /* for TX */
+ int txBankSwitch; /* for TX */
+ int txRootDepth; /* for TX */
+ int txRootClass; /* for TX */
+ int screenHeight; /* */
+ int screenWidth; /* */
+ int screenVsync;
+#endif
+} ScreenArgsRec;
+
+typedef struct {
+ unsigned int currentmask; /* saved plane mask */
+ BoxPtr cursorConstraint;
+ ws_screen_descriptor *screenDesc;
+ ColormapPtr pInstalledMap;
+ ScreenArgsRec *args;
+ Bool (*CloseScreen)();
+#ifndef NO_DEC_VALUE_ADDED
+ void (*CursorControl)();
+#endif
+} wsScreenPrivate;
+
+typedef struct {
+ char *moduleID; /* graphic module ID */
+ Bool (*createProc)(); /* create procedure for this hardware type */
+} wsAcceleratorTypes;
+
+extern void wsStoreColors();
+extern void wsInstallColormap();
+extern void wsUninstallColormap();
+extern int wsListInstalledColormaps();
+extern int wsScreenPrivateIndex;
+extern Bool wsSaveScreen();
+extern int dpix, dpiy, dpi;
+#ifndef NO_DEC_VALUE_ADDED
+extern void wsMakeScreenOnly();
+extern void wsInputOutputFinish();
+extern int wsRemapPhysToLogScreens;
+extern void wsEnableScreen();
+extern void wsDisableScreen();
+extern int wsPhysScreenNum();
+extern void wsRegisterAbortProc();
+extern void wsRegisterGiveUpProc();
+extern wsScreenPrivate * wsAllocScreenInfo();
+extern int wsDisabledScreens[];
+extern int wsOnlyScreen;
+extern int wsPhysToLogScreens[];
+extern int screenHeight, screenWidth;
+#endif
+
+extern ScreenArgsRec screenArgs[];
+
+extern ScreenPtr wsScreens[];
+extern int class;
+extern int forceDepth;
+extern int fdPM; /* this is the file descriptor for screen so
+ can do IOCTL to colormap */
+extern int ws_cpu;
+
+#ifndef NO_DEC_VALUE_ADDED
+#define WSP_PTR(pScr) \
+ ((wsScreenPrivate*)(pScr)->devPrivates[wsScreenPrivateIndex].ptr)
+#define WS_SCREEN(pScr) (WSP_PTR(pScr)->screenDesc->screen)
+#define wspCursorControl(psn, control) \
+ if (psn >= 0) (*WSP_PTR(wsScreens[psn])->CursorControl)(psn, control)
+#endif
+
diff --git a/xc/programs/Xserver/hw/dec/ws/ws_color.c b/xc/programs/Xserver/hw/dec/ws/ws_color.c
new file mode 100644
index 000000000..276210507
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/ws_color.c
@@ -0,0 +1,212 @@
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $TOG: ws_color.c /main/9 1998/03/17 16:39:12 kaleb $ */
+
+/*
+ * ws_color.c - device specific color routines, stored in screen
+ *
+ * Author: Jim Gettys
+ * Digital Equipment Corporation
+ * Cambridge Research Laboratory
+ * Date: Sat January 24 1990
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <errno.h>
+#include <sys/devio.h>
+#include "X.h" /* required for DoRed ... */
+#include "Xproto.h" /* required for xColorItem */
+
+#include "misc.h" /* required for colormapst.h */
+#include "resource.h"
+#include "scrnintstr.h"
+#include "colormapst.h"
+/* XXX */
+#include <sys/workstation.h>
+
+#include "ws.h"
+
+
+
+/* these next two are DIX routines */
+extern int TellLostMap();
+extern int TellGainedMap();
+
+extern int wsFd;
+extern ws_screen_descriptor screenDesc[];
+
+void
+wsStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ xColorItem directDefs[256];
+ ws_color_cell cell;
+ ws_color_map_data cd;
+ wsScreenPrivate *pPrivScreen = (wsScreenPrivate *)
+ pmap->pScreen->devPrivates[wsScreenPrivateIndex].ptr;
+ if (pmap != pPrivScreen->pInstalledMap) return;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ {
+ ndef = cfbExpandDirectColors (pmap, ndef, pdefs, directDefs);
+ pdefs = directDefs;
+ }
+ cd.screen = screenDesc[pmap->pScreen->myNum].screen;
+ cd.map = 0; /* only one... */
+ cd.start = 0;
+ cd.ncells = ndef;
+ /*
+ * we will be evil, and note that the server and driver use the same
+ * structure.
+ */
+ cd.cells = (ws_color_cell *)pdefs;
+ if (ioctl(wsFd, WRITE_COLOR_MAP, &cd) == -1) {
+ ErrorF("error writing color map\n");
+ return;
+ }
+}
+
+#define _DUPRGB(C,V) ( (( (C) << (V)->offsetRed ) & (V)->redMask )\
+ |(( (C) << (V)->offsetGreen ) & (V)->greenMask)\
+ |(( (C) << (V)->offsetBlue ) & (V)->blueMask ) )
+
+void
+wsInstallColormap(pcmap)
+ ColormapPtr pcmap;
+{
+ int entries = pcmap->pVisual->ColormapEntries;
+ Pixel * ppix;
+ xrgb * prgb;
+ xColorItem *defs;
+ int i,j;
+ wsScreenPrivate *pPrivScreen = (wsScreenPrivate *)
+ pcmap->pScreen->devPrivates[wsScreenPrivateIndex].ptr;
+
+ if (pcmap == pPrivScreen->pInstalledMap) return;
+ if ( pPrivScreen->pInstalledMap != NOMAPYET)
+ WalkTree( pcmap->pScreen, TellLostMap,
+ &pPrivScreen->pInstalledMap->mid);
+
+ pPrivScreen->pInstalledMap = pcmap;
+
+ /* if Turbochannel mfb (2 entry StaticGray), do not store any colors */
+ if ((int) pcmap->devPriv != 2) {
+
+ /* If we have an 8 entry TrueColor map, then get all 256 pixel
+ values so we can fake a TrueColor visual with an undecomposed
+ hardware colormap (ie. devPriv == 0).
+ */
+ if (pcmap->devPriv == 0 && pcmap->class == TrueColor && entries == 8) {
+ entries = 256;
+ }
+
+ ppix = (Pixel *)ALLOCATE_LOCAL( entries * sizeof(Pixel));
+ prgb = (xrgb *)ALLOCATE_LOCAL( entries * sizeof(xrgb));
+ defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem));
+
+ /* devPriv == 1 means decomposed hardware colormap */
+ if (((int) pcmap->devPriv == 1
+ && ((pcmap->class | DynamicClass) == DirectColor)) &&
+ (pcmap->pScreen->rootDepth == 12))
+ for( i = 0; i < entries; i++)
+ ppix[i] = _DUPRGB( i, pcmap->pVisual);
+ else
+ for ( i=0; i<entries; i++) ppix[i] = i;
+
+ QueryColors( pcmap, entries, ppix, prgb);
+
+ for ( i=0; i<entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+
+ wsStoreColors( pcmap, entries, defs);
+
+ DEALLOCATE_LOCAL(ppix);
+ DEALLOCATE_LOCAL(prgb);
+ DEALLOCATE_LOCAL(defs);
+ }
+ WalkTree(pcmap->pScreen, TellGainedMap, &pcmap->mid);
+}
+
+
+void
+wsUninstallColormap(pcmap)
+ ColormapPtr pcmap;
+{
+ /* Replace installed colormap with default colormap */
+
+ ColormapPtr defColormap;
+ wsScreenPrivate *pPrivScreen = (wsScreenPrivate *)
+ pcmap->pScreen->devPrivates[wsScreenPrivateIndex].ptr;
+
+ if ( pcmap != pPrivScreen->pInstalledMap) return;
+
+ defColormap = (ColormapPtr) LookupIDByType( pcmap->pScreen->defColormap,
+ RT_COLORMAP);
+
+ if (defColormap == pPrivScreen->pInstalledMap) return;
+
+ (*pcmap->pScreen->InstallColormap) (defColormap);
+}
+
+int
+wsListInstalledColormaps( pscr, pcmaps)
+ ScreenPtr pscr;
+ Colormap * pcmaps;
+{
+ wsScreenPrivate *pPrivScreen = (wsScreenPrivate *)
+ pscr->devPrivates[wsScreenPrivateIndex].ptr;
+ *pcmaps = pPrivScreen->pInstalledMap->mid;
+ return 1;
+}
+
diff --git a/xc/programs/Xserver/hw/dec/ws/ws_io.c b/xc/programs/Xserver/hw/dec/ws/ws_io.c
new file mode 100644
index 000000000..053a75747
--- /dev/null
+++ b/xc/programs/Xserver/hw/dec/ws/ws_io.c
@@ -0,0 +1,1607 @@
+/***********************************************************
+
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: ws_io.c /main/22 1998/02/27 10:30:37 kaleb $ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <sys/devio.h>
+#define NEED_EVENTS
+#include "misc.h"
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "pixmap.h"
+#include "inputstr.h"
+#include "cursorstr.h"
+#include "regionstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+#include "servermd.h"
+#include <sys/workstation.h>
+#include <sys/inputdevice.h>
+#include <sys/wsdevice.h>
+#include "ws.h"
+#include "keynames.h"
+#ifdef XKB
+#include "XKBsrv.h"
+#ifdef __alpha
+#include <alpha/hal_sysinfo.h> /* for GSI_KEYBOARD */
+#endif
+#endif
+
+#include "mi.h"
+
+#define MOTION_BUFFER_SIZE 100
+
+extern ws_descriptor wsinfo;
+void wsCursorControl();
+static Bool wsDisplayCursor();
+static Bool wsSetCursorPosition();
+
+extern ws_screen_descriptor screenDesc[];
+extern int wsFd;
+int rememberedScreen;
+static int shiftLock;
+static short lockLed;
+ScreenPtr wsScreens[MAXSCREENS];
+ScreenArgsRec screenArgs[MAXSCREENS];
+static DevicePtr wsPointer;
+static DevicePtr wsKeyboard;
+char *blackValue, *whiteValue;
+extern ws_event_queue *queue;
+CARD32 lastEventTime;
+int wsNumButtons = -1;
+static Bool cursorConfined = FALSE;
+
+#define MAX_LED 3 /* only 3 LED's can be set by user; Lock LED
+ is controlled by server */
+
+#define VSYNCFIXED
+#ifdef VSYNCFIXED
+#define CURRENT_TIME queue->time
+#else
+#define CURRENT_TIME GetTimeInMillis()
+#endif
+
+#define NoSuchClass -1
+
+static int
+ParseClass(className)
+ char * className;
+{
+ static char *names[] = {
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor"};
+ /*
+ * only the ones we support and must be in order from X.h, since
+ * return value depends on index into array.
+ */
+ int i;
+ for (i = 0; i < sizeof(names)/sizeof(char *); i++)
+ {
+ if (strcmp(names[i], className) == 0)
+ return i;
+ }
+ return NoSuchClass;
+}
+
+/* SaveScreen does blanking, so no need to worry about the interval timer */
+
+Bool
+wsSaveScreen(pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+{
+ ws_video_control vc;
+ vc.screen = screenDesc[pScreen->myNum].screen;
+
+ if (on == SCREEN_SAVER_FORCER) {
+ lastEventTime = CURRENT_TIME;
+ } else if (on == SCREEN_SAVER_ON) {
+ vc.control = SCREEN_OFF;
+ if (ioctl(wsFd, VIDEO_ON_OFF, &vc) < 0)
+ ErrorF("VIDEO_ON_OFF: failed to turn screen off.\n");
+ } else {
+ vc.control = SCREEN_ON;
+ if (ioctl(wsFd, VIDEO_ON_OFF, &vc) < 0)
+ ErrorF("VIDEO_ON_OFF: failed to turn screen on.\n");
+ }
+ return TRUE;
+}
+
+
+wsPixelError(index)
+int index;
+{
+ ErrorF("Only 0 through 255 are acceptable pixels for device %d\n", index);
+}
+
+void
+wsClick(click)
+ int click;
+{
+ ws_keyboard_control control;
+ control.device_number = wsinfo.console_keyboard;
+ control.flags = WSKBKeyClickPercent;
+ control.click = click;
+ if (ioctl (wsFd, SET_KEYBOARD_CONTROL, &control) == -1)
+ printf ("couldn't set click\n");
+ return;
+}
+
+static void
+wsChangeKeyboardControl(device, ctrl)
+ DeviceIntPtr device;
+ KeybdCtrl *ctrl;
+{
+ int i;
+ ws_keyboard_control control;
+ control.device_number = wsinfo.console_keyboard;
+ control.flags = 0;
+
+ /*
+ * even though some of these are not implemented on the lk201/lk401,
+ * we should pass these to the driver, as other hardware may not
+ * lose so badly. The new driver does do auto-repeat and up down
+ * properly, however.
+ */
+ control.flags |= WSKBKeyClickPercent| WSKBBellPercent | WSKBBellPitch |
+ WSKBBellDuration | WSKBAutoRepeatMode | WSKBAutoRepeats | WSKBLed;
+ control.click = ctrl->click;
+ control.bell = ctrl->bell;
+ control.bell_pitch = ctrl->bell_pitch;
+ control.bell_duration = ctrl->bell_duration;
+ control.auto_repeat = ctrl->autoRepeat;
+ control.leds = ctrl->leds;
+ /*
+ * XXX a crock, but to have a byte interface would have implied the
+ * driver did alot more work at interrupt time, so we made it 32 bits wide.
+ */
+ memmove(control.autorepeats, ctrl->autoRepeats, 32);
+#ifdef notdef
+ /* LEDs */
+ for (i=1; i<=MAX_LED; i++)
+ ChangeLED(i, (ctrl->leds & (1 << (i-1))));
+#endif
+ if (ioctl (wsFd, SET_KEYBOARD_CONTROL, &control) == -1)
+ ErrorF ("couldn't set global autorepeat\n");
+ return;
+
+}
+
+static void
+wsBell(loud, pDevice, ctrl, fbclass)
+ int loud;
+ DeviceIntPtr pDevice;
+ pointer ctrl;
+ int fbclass;
+{
+ ws_keyboard_control control;
+ control.device_number = wsinfo.console_keyboard;
+ control.flags = WSKBBellPercent;
+ control.bell = loud;
+ ioctl(wsFd, SET_KEYBOARD_CONTROL, &control);
+
+ ioctl(wsFd, RING_KEYBOARD_BELL, &wsinfo.console_keyboard);
+}
+
+/*
+ * These serve protocol requests, setting/getting acceleration and threshold.
+ * X10 analog is "SetMouseCharacteristics".
+ */
+void
+wsChangePointerControl(device, ctrl)
+ DeviceIntPtr device;
+ PtrCtrl *ctrl;
+{
+ ws_pointer_control pc;
+ pc.device_number = wsinfo.console_pointer;
+ pc.numerator = ctrl->num;
+ pc.denominator = ctrl->den;
+ pc.threshold = ctrl->threshold;
+ if (ioctl (wsFd, SET_POINTER_CONTROL, &pc) == -1) {
+ ErrorF ("error setting mouse properties\n");
+ }
+}
+
+int
+wsGetMotionEvents(pDevice, buff, start, stop, pScr)
+ DeviceIntPtr pDevice;
+ xTimecoord *buff;
+ unsigned long start, stop;
+ ScreenPtr pScr;
+{
+ register int i; /* Number of events left to process in ring */
+ ws_motion_buffer *mb = queue->mb;
+ register ws_motion_history *mh = mb->motion; /*Beginning of ring storage*/
+ int count; /* Number of events that match conditions */
+ CARD32 temptime;
+
+ /* Loop through entire ring buffer. Technically, the driver may not have
+ actually queued this many motion events, but since they are initialized
+ to time 0 the non-events shouldn't match. If the mouse isn't moved for
+ 25 days after startup this could be a problem...but who cares? */
+ count = 0;
+ for (i = mb->size; i != 0; i--) {
+ temptime = mh->time;
+ if (start <= temptime && temptime <= stop) {
+ buff[count].time = temptime;
+ buff[count].x = mh->axis[0];
+ buff[count].y = mh->axis[1];
+ if (temptime == mh->time) count++; /* paranoid */
+ }
+ mh = (ws_motion_history *) ((char*)mh + mb->entry_size);
+ }
+ return count;
+}
+
+int
+wsMouseProc(pDev, onoff, argc, argv)
+ DevicePtr pDev;
+ int onoff, argc;
+ char *argv[];
+{
+ int i, numButtons;
+ BYTE map[6];
+ ws_hardware_type wht;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ wht.device_number = wsinfo.console_pointer;
+ ioctl(wsFd, GET_DEVICE_TYPE, &wht);
+ wsPointer = pDev;
+ pDev->devicePrivate = (pointer) &queue;
+ map[1] = 1; /* worst case is 5 buttons - jmg */
+ map[2] = 2;
+ map[3] = 3;
+ map[4] = 4;
+ map[5] = 5;
+ if(wsNumButtons == -1) {
+#ifndef VSXXX
+ numButtons = wht.buttons; /* believe the Kernel :-) */
+#else
+ if(wht.hardware_type == VSXXX)
+ numButtons = 3;
+ else
+ numButtons = 4;
+#endif
+ }
+ else
+ numButtons = wsNumButtons;
+ InitPointerDeviceStruct(
+ wsPointer, map, numButtons, wsGetMotionEvents,
+ wsChangePointerControl, MOTION_BUFFER_SIZE);
+ SetInputCheck((HWEventQueuePtr)&queue->head,
+ (HWEventQueuePtr)&queue->tail);
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ AddEnabledDevice(wsFd);
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ RemoveEnabledDevice(wsFd);
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+/* since this driver does up/down autorepeat right, any key can be a modifier*/
+/*ARGSUSED*/
+Bool
+LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return TRUE;
+}
+
+#ifdef XKB
+static char *languages[] = {
+ "danish", /* 30 Dansk */
+ "german", /* 32 Deutsch */
+ "swiss_german", /* 34 Deutsch(Schweiz) */
+ "us", /* 36 English(American) */
+ "uk", /* 38 English(British/Irish) */
+ "spanish", /* 3a Espanol */
+ "french", /* 3c Francais */
+ "canadian_french", /* 3e Francais(Canadien) */
+ "swiss_french", /* 40 Francais(SuisseRomande) */
+ "italian", /* 42 Italiano */
+ "dutch", /* 44 Nederlands */
+ "norwegian", /* 46 Norsk */
+ "portuguese", /* 48 Portugues */
+ "finnish", /* 4a Suomi */
+ "swedish", /* 4c Svenska */
+ "flemish" /* 4e Vlaams */
+};
+
+#define ENGLISH_AMERICAN 3 /* languages[3] = us, hardcoded fallback */
+#endif /* XKB */
+
+int
+wsKeybdProc(pDev, onoff, argc, argv)
+ DevicePtr pDev;
+ int onoff, argc;
+ char *argv[];
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+/* Note that keyclick is off by default. The QDSS MIT server sets it
+ to 20 */
+ wsKeyboard = pDev;
+ GetKeyboardMappings( &keySyms, modMap);
+#if defined(XKB) && defined(__alpha)
+ if (!noXkbExtension)
+ {
+ XkbComponentNamesRec names;
+ char keyboard[8];
+ char lang[4];
+ char keymapname[80];
+ unsigned int langindex;
+ char *p;
+ int i;
+
+ /* Set the default keymap based on the console's language
+ * environment variable.
+ */
+ lang[0] = '\0';
+ if (-1 == getsysinfo(GSI_PROM_ENV, lang, sizeof(lang), 0,
+ "language"))
+ lang[0] = '\0';
+
+ /* Find the class of keyboard being used.
+ */
+ keyboard[0] = '\0';
+ if (-1 == getsysinfo(GSI_KEYBOARD, keyboard, sizeof(keyboard),
+ 0, NULL))
+ keyboard[0] = '\0';
+
+ /* Now put together the keymap name: digital/lang(kbtype)
+ * Eventually, we'll consult a file to find the keymap
+ * name based on the keyboard class and language, and all
+ * the code below will be a fallback in case nothing was
+ * found in the file. For now, just rely on the fallback
+ * code.
+ *
+ * All of our keymap names start with "digital/", so ...
+ */
+ keymapname[0] = '\0';
+ strcat(keymapname, "digital/");
+
+ /* Next you tack on the language. If we don't understand
+ * what getsysinfo returned, use the fallback.
+ */
+ langindex = ((unsigned)lang[0] - MIN_LANG_CODE) / 2;
+ if (langindex >= sizeof(languages) / sizeof(char *))
+ langindex = ENGLISH_AMERICAN;
+ strcat(keymapname, languages[langindex]);
+
+ /* Lastly you append the keyboard type. Convert it to lower
+ * case first. Funky special case: for non-us keyboards,
+ * change "lk443" to "lk444". (Why not just name the
+ * keymap files consistently?)
+ */
+
+ i = strlen(keymapname);
+ keymapname[i++] = '(';
+ for (p = keyboard; *p; p++) {
+ keymapname[i++] = tolower(*p);
+ }
+ if (!strcmp("LK443", keyboard) &&
+ langindex != ENGLISH_AMERICAN) {
+ keymapname[i-1] = '4';
+ }
+ keymapname[i++] = ')';
+ keymapname[i++] = '\0';
+#ifdef DEBUG
+ ErrorF("keymap name is %s\n", keymapname);
+#endif
+ names.keymap= keymapname;
+
+ /* the chosen keymap file specifies all of these */
+
+ names.keycodes= NULL;
+ names.types= NULL;
+ names.compat= NULL;
+ names.symbols= NULL;
+ names.geometry= NULL;
+ XkbInitKeyboardDeviceStruct((DeviceIntPtr)wsKeyboard,
+ &names, &keySyms, modMap, wsBell,
+ wsChangeKeyboardControl);
+ }
+ else
+#endif /* XKB */
+ InitKeyboardDeviceStruct(
+ wsKeyboard, &keySyms, modMap, wsBell,
+ wsChangeKeyboardControl);
+
+ /* Free the key sym mapping space allocated by GetKeyboardMappings. */
+ Xfree(keySyms.map);
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ AddEnabledDevice(wsFd);
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ RemoveEnabledDevice(wsFd);
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+extern int screenIsSaved;
+static CursorPtr currentCursor;
+
+
+/* The code below is for backward compatibility with DEC R3 servers.
+ * Load the keyboard map pointed to by the file "/usr/lib/X11/keymap_default"
+ */
+
+#define FileNameLength 256
+#define MaxLineLength 256
+
+
+KeySym *LoadKeymap();
+
+/*
+ * Load the default keymap file.
+ */
+
+int GetDefaultMap(ks)
+ KeySymsPtr ks;
+{
+ char keymap_name[FileNameLength];
+ KeySym *keymap_pointer;
+ int keymap_width;
+ int keymap_loaded = FALSE;
+
+ if (GetKeymapName (keymap_name)==TRUE) {
+ if ((keymap_pointer = LoadKeymap (keymap_name, MIN_LK201_KEY,
+ MAX_LK201_KEY, &keymap_width)) !=NULL) {
+ ks->minKeyCode = MIN_LK201_KEY;
+ ks->maxKeyCode = MAX_LK201_KEY;
+ ks->mapWidth = keymap_width;
+ ks->map = keymap_pointer;
+ keymap_loaded=TRUE;
+ }
+ }
+ return (keymap_loaded);
+}
+
+
+/*
+ * Check for keymap type file "/usr/lib/X11/keymap_default"
+ */
+
+int GetKeymapName (name_return)
+ char *name_return;
+{
+ char *filename = "/usr/lib/X11/keymap_default";
+ int fd;
+ int len;
+
+ if ((fd = open(filename, O_RDONLY)) == -1)
+ return (FALSE);
+ len = strlen(filename);
+ strcpy(name_return, filename);
+ name_return[len] = '\0';
+ return (TRUE);
+}
+
+
+#define EndLine(c) (((c)=='!' || (c) =='\n' || (c) == '\0') ? TRUE : FALSE )
+
+/*
+ * load the keymap file into keysym table
+ */
+
+KeySym *LoadKeymap(keymap_name, minkc, maxkc, return_ks_per_kc)
+ char *keymap_name;
+ KeyCode minkc;
+ KeyCode maxkc;
+ int *return_ks_per_kc;
+{
+ FILE *fp;
+ KeySym *keymap = NULL;
+ char line[MaxLineLength];
+
+ if ((fp=fopen (keymap_name, "r")) == NULL)
+ return ( (KeySym *) NULL);
+
+ while (fgets (line, MaxLineLength, fp) != NULL) {
+ if (AddLineToKeymap (line, &keymap, minkc, maxkc, return_ks_per_kc)
+ ==FALSE) {
+ fclose (fp);
+ if (keymap != NULL) Xfree (keymap);
+ return ( (KeySym *)NULL);
+ }
+ }
+ fclose (fp);
+ return ( keymap );
+}
+
+
+/*
+ * decode keycode, and keysyms from line, allocate keymap first time round.
+ */
+
+int AddLineToKeymap (line, keymap, minkc, maxkc, return_ncols)
+ char *line;
+ KeySym **keymap;
+ KeyCode minkc;
+ KeyCode maxkc;
+ int *return_ncols;
+{
+ int pos;
+ KeyCode kc;
+ KeySym *offset;
+ KeySym ks;
+ int ncols;
+ int col;
+ int map_size;
+ int i;
+
+ if (isspace(line[0]) || line[0] == '!' || line[0] == '\n' || line[0] == '\0')
+ return (TRUE); /* ignore blank lines and comments */
+
+ if ( *keymap ==NULL) {
+ pos=0;
+ if ((kc=GetToken (line, &pos)) == -1) return (FALSE);
+ ncols=0;
+ while (GetToken (line, &pos) != -1)
+ ncols++;
+ if (ncols < 2) ncols = 2;
+ (*return_ncols) = ncols;
+ map_size = (maxkc-minkc+1) * ncols;
+ (*keymap) = (KeySym *) Xalloc ( map_size * sizeof (KeySym));
+ for (i = 0; i < map_size; i++)
+ (*keymap)[i] = NoSymbol;
+
+ }
+ pos = 0;
+ if ((kc=GetToken (line, &pos)) == -1) return (FALSE);
+ if ( kc < minkc || kc > maxkc ) return (FALSE);
+ offset = (*keymap) + (kc-minkc)* (*return_ncols);
+ col=0;
+ while (col < (*return_ncols) && ((ks=GetToken (line, &pos)) != -1)) {
+ *(offset + col) = ks;
+ col+=1;
+ }
+ return (TRUE);
+}
+
+/*
+ * return hex value of next item on line (current position held in 'pos')
+ */
+
+int GetToken (line, pos)
+ char *line;
+ int *pos;
+{
+ int start;
+
+ if (EndLine(line[*pos]) == TRUE) return (-1);
+ while (isspace(line[*pos]) || EndLine(line[*pos])) {
+ if (EndLine(line[*pos]) == TRUE)
+ return (-1);
+ (*pos)++;
+ }
+ start = *pos;
+ while (!isspace (line[*pos]) && !EndLine (line[*pos])) {
+ (*pos)++;
+ }
+ return (StringToHex(&line[start], (*pos)-start));
+}
+
+
+/*
+ * convert null terminated hexadecimal string to integer
+ * return 'value', or '-1' on error
+ */
+
+int StringToHex (str,nbytes)
+ char *str;
+ int nbytes;
+{
+ int i;
+ int digit;
+ int scale = 1;
+ long value = 0;
+
+ for (i=nbytes-1;i>=0;i--) {
+ if (!isxdigit(str[i])) return (-1);
+ if (isdigit(str[i]))
+ digit=str[i]-'0';
+ else
+ digit=toupper(str[i])-'A'+10;
+ value+=(digit*scale);
+ scale*=16;
+ }
+ return(value);
+}
+
+#undef EndLine
+#undef MaxLineLength
+#undef FileNameLength
+
+
+Bool GetKeyboardMappings(pKeySyms, pModMap)
+ KeySymsPtr pKeySyms;
+ CARD8 *pModMap;
+{
+ int i;
+ ws_keyboard_definition def;
+ KeySym *map;
+ KeySym rawsyms[256]; /* more than we'll ever need! */
+ unsigned char rawcodes[256]; /* more than we'll ever need! */
+ ws_keycode_modifiers mods[32]; /* more than we'll ever need! */
+ ws_keysyms_and_modifiers km;
+ int min_keycode = 256, max_keycode = 0;
+
+ def.device_number = wsinfo.console_keyboard;
+ if (ioctl (wsFd, GET_KEYBOARD_DEFINITION, &def) == -1) {
+ ErrorF ("error getting keyboard definition\n");
+ }
+ lockLed = def.lock_key_led;
+
+ /* If it exists, load special keysym map from file instead of driver.
+ This is for backward compatibility with the i18n stuff from the
+ DEC R3 servers.
+ */
+ if (GetDefaultMap(pKeySyms) == TRUE) {
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+ pModMap[ KEY_LOCK ] = LockMask;
+ pModMap[ KEY_SHIFT ] = ShiftMask;
+ pModMap[ KEY_SHIFT_R ] = ShiftMask;
+ pModMap[ KEY_CTRL ] = ControlMask;
+ pModMap[ KEY_COMPOSE ] = Mod1Mask;
+ pModMap[ KEY_COMPOSE_R ] = Mod1Mask;
+ pModMap[ KEY_ALT_L ] = Mod2Mask;
+ pModMap[ KEY_ALT_R ] = Mod2Mask;
+ return (TRUE);
+ }
+
+ km.device_number = wsinfo.console_keyboard;
+ km.modifiers = mods;
+ *((KeySym **)(&km.keysyms)) = rawsyms; /* XXX bad type in inputdevice.h */
+ km.keycodes = rawcodes;
+ if (ioctl (wsFd, GET_KEYSYMS_AND_MODIFIERS, &km) == -1) {
+ ErrorF ("error getting keysyms and modifiers\n");
+ }
+
+#define KEYCODE(i) ((i) >> 24))
+ for (i = 0; i < def.keysyms_present; i++) {
+ if (rawcodes[i] > max_keycode) max_keycode = rawcodes[i];
+ if (rawcodes[i] < min_keycode) min_keycode = rawcodes[i];
+ }
+
+ map = (KeySym *)Xalloc(sizeof(KeySym) *
+ (MAP_LENGTH * def.keysyms_per_keycode));
+ if (!map)
+ return FALSE;
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ /* first set up modifier keys */
+ for (i = 0; i < def.modifier_keycode_count; i++)
+ pModMap[mods[i].keycode] = mods[i].modbits;
+
+ /* initialize the keysym array */
+ for (i = 0; i < (MAP_LENGTH * def.keysyms_per_keycode); i++)
+ map[i] = NoSymbol;
+ pKeySyms->minKeyCode = min_keycode;
+ pKeySyms->maxKeyCode = max_keycode;
+ pKeySyms->mapWidth = def.keysyms_per_keycode;
+ pKeySyms->map = map;
+#define INDEX(in) ((in - min_keycode) * def.keysyms_per_keycode)
+ for (i = 0; i < def.keysyms_present; i++) {
+ register int j;
+ for (j = 0; j < def.keysyms_per_keycode; j++) {
+ if (map[INDEX(rawcodes[i]) + j] == NoSymbol) {
+ map[INDEX(rawcodes[i]) + j] = rawsyms[i];
+ break;
+ }
+ }
+ }
+#undef INDEX
+ return TRUE;
+}
+
+
+void
+SetLockLED (on)
+ Bool on;
+{
+ ws_keyboard_control kc;
+ kc.flags = WSKBLed;
+ kc.device_number = wsinfo.console_keyboard;
+ if (ioctl (wsFd, GET_KEYBOARD_CONTROL, &kc) == -1) {
+ ErrorF ("error getting keyboard control\n");
+ }
+ if(on)
+ kc.leds |= 1 << (lockLed -1);
+ else
+ kc.leds &= ~(1 << (lockLed -1));
+ kc.flags = WSKBLed;
+ if (ioctl (wsFd, SET_KEYBOARD_CONTROL, &kc) == -1) {
+ ErrorF ("error setting keyboard control\n");
+ }
+}
+
+/*
+ * The driver has been set up to put events in the queue that are identical
+ * in shape to the events that the DDX layer has to deliver to ProcessInput
+ * in DIX.
+ */
+void
+ProcessInputEvents()
+{
+ xEvent x;
+ register ws_event *e;
+ ws_event etmp;
+ int screen;
+ DeviceIntPtr dev = (DeviceIntPtr) wsKeyboard;
+
+ e = &etmp;
+ while (queue->head != queue->tail) {
+ /* The events should be popped off the queue before they
+ * are processed. This bug surfaced because XKB indirectly
+ * turned ProcessInputEvents into a recursive routine.
+ */
+ memmove(&etmp,
+#ifdef __alpha
+ (caddr_t)(queue->events) + queue->event_size * queue->head,
+#else
+ (int)(queue->events) + queue->event_size * queue->head,
+#endif
+ queue->event_size);
+
+ if (queue->head >= queue->size - 1)
+ queue->head = 0;
+ else
+ ++queue->head;
+
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ if(e->screen != rememberedScreen)
+ {
+ ScreenPtr pScreen;
+ int x, y;
+
+ if (cursorConfined)
+ {
+ /* OS doesn't work right -- we have to confine here */
+ GetSpritePosition (&x, &y);
+ pScreen = wsScreens[rememberedScreen];
+ (void) wsSetCursorPosition (pScreen, x, y, FALSE);
+ wsCursorControl(e->screen, CURSOR_OFF);
+ wsCursorControl(rememberedScreen, CURSOR_ON);
+ if (currentCursor)
+ wsDisplayCursor(pScreen, currentCursor);
+ }
+ else
+ {
+ /* assumption -- this is a motion event */
+ wsCursorControl(rememberedScreen, CURSOR_OFF);
+ wsCursorControl(e->screen, CURSOR_ON);
+ rememberedScreen = e->screen;
+ pScreen = wsScreens[e->screen];
+ if (currentCursor)
+ wsDisplayCursor (pScreen, currentCursor);
+ x = e->e.key.x;
+ y = e->e.key.y;
+ NewCurrentScreen(pScreen, x, y);
+ }
+ continue;
+ }
+
+ x.u.keyButtonPointer.rootX = e->e.key.x;
+ x.u.keyButtonPointer.rootY = e->e.key.y;
+ x.u.keyButtonPointer.time = lastEventTime = e->time;
+ x.u.u.detail = e->e.key.key;
+
+ switch (e->device_type) {
+ case KEYBOARD_DEVICE:
+ switch (e->type) {
+ case BUTTON_DOWN_TYPE:
+ x.u.u.type = KeyPress;
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ /* if key is a lock modifier then ... */
+ if (dev->key->modifierMap[e->e.key.key] & LockMask){
+ if (shiftLock) {
+ x.u.u.type = KeyRelease;
+ SetLockLED (FALSE);
+ shiftLock = FALSE;
+ } else {
+ x.u.u.type = KeyPress;
+ SetLockLED (TRUE);
+ shiftLock = TRUE;
+ }
+ }
+ }
+ (*wsKeyboard->processInputProc) (&x, dev, 1);
+ break;
+ case BUTTON_UP_TYPE:
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ /* if key is a lock modifier then ignore */
+ if (dev->key->modifierMap[e->e.key.key] & LockMask)
+ break;
+ }
+ x.u.u.type = KeyRelease;
+ (*wsKeyboard->processInputProc) (&x, dev, 1);
+ break;
+ default: /* hopefully BUTTON_RAW_TYPE */
+ break;
+ }
+ break;
+ case MOUSE_DEVICE:
+ /* someday tablet will be handled differently than a mouse */
+ case TABLET_DEVICE:
+ switch (e->type) {
+ case BUTTON_DOWN_TYPE:
+ x.u.u.type = ButtonPress;
+ break;
+ case BUTTON_UP_TYPE:
+ x.u.u.type = ButtonRelease;
+ break;
+ case MOTION_TYPE:
+ x.u.u.type = MotionNotify;
+ break;
+ default:
+#ifdef DEBUG
+ printf("Unknown mouse or tablet event = %d\n",
+ e->type);
+#endif
+ continue;
+ }
+ (*wsPointer->processInputProc)
+ (&x, (DeviceIntPtr) wsPointer, 1);
+ break;
+ /* new input devices go here (or are ignored) */
+ default:
+#ifdef XINPUT
+ if (!ExtProcessInputEvents(&x, e))
+# ifdef DEBUG
+ printf("Unknown device type = %d\n",e->device_type);
+# else
+ ; /* do nothing */
+# endif
+#else
+# ifdef DEBUG
+ printf("Unknown device type = %d\n",e->device_type);
+# endif
+#endif
+ break;
+ }
+ }
+}
+
+CARD32
+GetTimeInMillis()
+{
+ struct timeval tp;
+#ifdef VSYNCFIXED
+ if (queue)
+ return queue->time;
+#endif
+ gettimeofday(&tp, 0);
+ return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}
+
+TimeSinceLastInputEvent()
+{
+ if (lastEventTime == 0)
+ lastEventTime = CURRENT_TIME;
+ return CURRENT_TIME - lastEventTime;
+}
+
+SetTimeSinceLastInputEvent ()
+{
+ lastEventTime = CURRENT_TIME;
+}
+
+/*
+ * set the bounds in the device for this particular cursor
+ */
+static void
+wsConstrainCursor( pScr, pBox)
+ ScreenPtr pScr;
+ BoxPtr pBox;
+{
+ ws_pointer_box wsbox;
+ wsbox.screen = screenDesc[pScr->myNum].screen;
+ wsbox.enable = PointerConfinedToScreen();
+ cursorConfined = wsbox.enable;
+ wsbox.device_number = wsinfo.console_pointer;
+ wsbox.box.bottom = pBox->y2;
+ wsbox.box.right = pBox->x2;
+ wsbox.box.top = pBox->y1;
+ wsbox.box.left = pBox->x1;
+
+ if (ioctl(wsFd, SET_POINTER_BOX, &wsbox) == -1)
+ ErrorF("SET_POINTER_BOX: failed to set pointer box.\n");
+}
+
+static Bool
+wsSetCursorPosition( pScr, newx, newy, generateEvent)
+ ScreenPtr pScr;
+ unsigned int newx;
+ unsigned int newy;
+ Bool generateEvent;
+{
+ ws_pointer_position pos;
+ xEvent motion;
+
+ pos.screen = screenDesc[pScr->myNum].screen;
+ pos.device_number = wsinfo.console_pointer;
+ pos.x = newx;
+ pos.y = newy;
+
+ /* if this is on a different screen, then we need to switch... */
+ if (pos.screen != rememberedScreen) {
+ wsCursorControl(rememberedScreen, CURSOR_OFF);
+ wsCursorControl(pos.screen, CURSOR_ON);
+ rememberedScreen = pos.screen;
+ }
+ if (ioctl (wsFd, SET_POINTER_POSITION, &pos) == -1) {
+ ErrorF ("error warping cursor\n");
+ return FALSE;
+ }
+
+ if (generateEvent) {
+ if (queue->head != queue->tail)
+ ProcessInputEvents ();
+ motion.u.keyButtonPointer.rootX = newx;
+ motion.u.keyButtonPointer.rootY = newy;
+ motion.u.keyButtonPointer.time = currentTime.milliseconds;
+ motion.u.u.type = MotionNotify;
+ (wsPointer->processInputProc)(&motion, (DeviceIntPtr) wsPointer, 1);
+ }
+ return TRUE;
+}
+
+static Bool
+wsDisplayCursor( pScr, pCurs)
+ ScreenPtr pScr;
+ CursorPtr pCurs;
+{
+ ws_cursor_data cd;
+ ws_cursor_color cc;
+#ifdef __alpha
+ unsigned int sourcebits[1024], maskbits[1024];
+ unsigned char *pSrc, *pDst;
+ int i;
+ int widthBytesLineSrc, widthBytesLineDest;
+#endif
+ cd.screen = screenDesc[pScr->myNum].screen;
+ cd.width = pCurs->bits->width;
+ cd.height = pCurs->bits->height;
+ cd.x_hot = pCurs->bits->xhot;
+ cd.y_hot = pCurs->bits->yhot;
+#ifdef __alpha
+ /*
+ * convert from an image padded on 8-byte boundaries to an
+ * image padded on 4-byte boundaries for the hardware
+ */
+ widthBytesLineSrc = BitmapBytePad (pCurs->bits->width);
+ widthBytesLineDest = BitmapBytePadProto (pCurs->bits->width);
+
+ pSrc = (unsigned char*) pCurs->bits->source;
+ pDst = (unsigned char*) sourcebits;
+ for (i = 0; i < pCurs->bits->height;
+ i++, pSrc += widthBytesLineSrc, pDst += widthBytesLineDest)
+ memmove((void*) pDst, (void*)pSrc, widthBytesLineDest);
+ cd.cursor = sourcebits;
+ pSrc = (unsigned char*) pCurs->bits->mask;
+ pDst = (unsigned char*) maskbits;
+ for (i = 0; i < pCurs->bits->height;
+ i++, pSrc += widthBytesLineSrc, pDst += widthBytesLineDest)
+ memmove((void*) pDst, (void*)pSrc, widthBytesLineDest);
+ cd.mask = maskbits;
+#else
+ cd.cursor = (unsigned int *) pCurs->bits->source;
+ cd.mask = (unsigned int *) pCurs->bits->mask;
+#endif
+ if ( ioctl( wsFd, LOAD_CURSOR, &cd) == -1) {
+ ErrorF( "error loading bits of new cursor\n");
+ return FALSE;
+ }
+ cc.screen = screenDesc[pScr->myNum].screen;
+ cc.background.red = pCurs->backRed;
+ cc.background.green = pCurs->backGreen;
+ cc.background.blue = pCurs->backBlue;
+ cc.foreground.red = pCurs->foreRed;
+ cc.foreground.green = pCurs->foreGreen;
+ cc.foreground.blue = pCurs->foreBlue;
+ if ( ioctl(wsFd, RECOLOR_CURSOR, &cc) == -1) {
+ ErrorF( "error writing colors of new cursor\n");
+ return FALSE;
+ }
+ currentCursor = pCurs;
+ return (TRUE);
+}
+
+void
+wsCursorControl(screen, control)
+ int screen;
+ int control;
+{
+ ws_cursor_control cc;
+ cc.screen = screenDesc[screen].screen;
+ cc.control = control;
+ if (ioctl(wsFd, CURSOR_ON_OFF, &cc) == -1) {
+ ErrorF( "error enabling/disabling cursor\n");
+ }
+ return;
+}
+static void
+wsRecolorCursor (pScr, pCurs, displayed)
+ ScreenPtr pScr;
+ CursorPtr pCurs;
+ Bool displayed;
+{
+ ws_cursor_color cc;
+ if (!displayed)
+ return;
+ cc.screen = screenDesc[pScr->myNum].screen;
+ cc.background.red = pCurs->backRed;
+ cc.background.green = pCurs->backGreen;
+ cc.background.blue = pCurs->backBlue;
+ cc.foreground.red = pCurs->foreRed;
+ cc.foreground.green = pCurs->foreGreen;
+ cc.foreground.blue = pCurs->foreBlue;
+ if ( ioctl(wsFd, RECOLOR_CURSOR, &cc) == -1) {
+ ErrorF( "error writing colors of new cursor\n");
+ }
+}
+
+static Bool
+wsRealizeCursor( pScr, pCurs)
+ ScreenPtr pScr;
+ CursorPtr pCurs; /* The new driver makes this easy */
+{
+ return TRUE;
+}
+
+static Bool
+wsUnrealizeCursor( pScr, pCurs)
+ ScreenPtr pScr;
+ CursorPtr pCurs;
+{
+ if (pCurs == currentCursor)
+ currentCursor = 0;
+ return TRUE;
+}
+
+static void
+wsCursorLimits( pScr, pCurs, pHotBox, pPhysBox)
+ ScreenPtr pScr;
+ CursorPtr pCurs;
+ BoxPtr pHotBox;
+ BoxPtr pPhysBox; /* return value */
+{
+ wsScreenPrivate *wsp = (wsScreenPrivate *)
+ pScr->devPrivates[wsScreenPrivateIndex].ptr;
+ pPhysBox->x1 = max( pHotBox->x1, 0);
+ pPhysBox->y1 = max( pHotBox->y1, 0);
+ pPhysBox->x2 = min( pHotBox->x2, wsp->screenDesc->width - 1);
+ pPhysBox->y2 = min( pHotBox->y2, wsp->screenDesc->height - 1);
+}
+
+void
+wsPointerNonInterestBox( pScr, pBox)
+ ScreenPtr pScr;
+ BoxPtr pBox;
+{
+ ws_pointer_box wsbox;
+ wsbox.screen = screenDesc[pScr->myNum].screen;
+ wsbox.device_number = wsinfo.console_pointer;
+ wsbox.enable = TRUE;
+ wsbox.box.top = pBox->x1;
+ wsbox.box.bottom = pBox->x2;
+ wsbox.box.left = pBox->y1;
+ wsbox.box.right = pBox->y2;;
+ if (ioctl(wsFd, SET_ESCAPE_BOX, wsbox) == -1)
+ ErrorF("SET_ESCAPE_BOX: failed to set non interest box.\n");
+}
+/*
+ * DDX - specific abort routine. Called by AbortServer().
+ */
+void
+AbortDDX()
+{
+}
+
+/* Called by GiveUp(). */
+void
+ddxGiveUp()
+{
+}
+
+int
+ArgMatch(arg, template, screen)
+ char *arg;
+ char *template;
+ int *screen;
+{
+ int tlen = strlen(template);
+ char next = *(arg + tlen);
+ if(strncmp(arg, template, tlen) == 0) {
+ if(tlen == strlen(arg)) {
+ /* exact match - applies to all screens */
+ *screen = -1;
+ return TRUE;
+ }
+ if(isdigit(next)) {
+ /* parse off screen number */
+ *screen = atoi(arg + tlen);
+ if(*screen < MAXSCREENS)
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ /* non-digit stuff at end of arg. not ours. */
+ return FALSE;
+ }
+ else
+ return FALSE;
+}
+
+
+int
+ddxProcessArgument (argc, argv, i)
+ register int argc;
+ register char *argv[];
+ register int i;
+{
+ int argind=i;
+ int skip;
+ static int Once=0;
+ void ddxUseMsg();
+ int screen;
+
+ skip = 0;
+ if (!Once) {
+ blackValue = NULL;
+ whiteValue = NULL;
+ Once = 1;
+ }
+ if (ArgMatch( argv[argind], "-dpix", &screen)) {
+ if (++argind < argc) {
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= ARG_DPIX;
+ screenArgs[i].dpix = atoi(argv[argind]);
+ }
+ }
+ else {
+ screenArgs[screen].flags |= ARG_DPIX;
+ screenArgs[screen].dpix = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0; /* failed to parse */
+ }
+ else if (ArgMatch( argv[argind], "-dpiy", &screen)) {
+ if (++argind < argc) {
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= ARG_DPIY;
+ screenArgs[i].dpiy = atoi(argv[argind]);
+ }
+ }
+ else {
+ screenArgs[screen].flags |= ARG_DPIY;
+ screenArgs[screen].dpiy = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch( argv[argind], "-dpi", &screen)) {
+ if (++argind < argc) {
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= (ARG_DPI | ARG_DPIX | ARG_DPIY) ;
+ screenArgs[i].dpi = screenArgs[i].dpix =
+ screenArgs[i].dpiy = atoi(argv[argind]);
+ }
+ }
+ else {
+ screenArgs[screen].flags |= (ARG_DPI | ARG_DPIX | ARG_DPIY);
+ screenArgs[screen].dpi = screenArgs[screen].dpix =
+ screenArgs[screen].dpiy = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if(ArgMatch( argv[argind], "-bp", &screen)) {
+ if (++argind < argc) {
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= ARG_BLACKVALUE;
+ screenArgs[i].blackValue = argv[argind];
+ }
+ }
+ else {
+ screenArgs[screen].flags |= ARG_BLACKVALUE;
+ screenArgs[screen].blackValue = argv[argind];
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch( argv[argind], "-wp", &screen)) {
+ if (++argind < argc) {
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= ARG_WHITEVALUE;
+ screenArgs[i].whiteValue = argv[argind];
+ }
+ }
+ else {
+ screenArgs[screen].flags |= ARG_WHITEVALUE;
+ screenArgs[screen].whiteValue = argv[argind];
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch(argv[argind], "-class", &screen)) {
+ if(++argind < argc) {
+ int class = ParseClass(argv[argind]);
+ if (class == NoSuchClass)
+ return 0;
+ if(screen == -1) {
+ for(i = 0; i < MAXSCREENS; i++) {
+ screenArgs[i].flags |= ARG_CLASS;
+ screenArgs[i].class = class;
+ }
+ }
+ else {
+ screenArgs[screen].flags |= ARG_CLASS;
+ screenArgs[screen].class = class;
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch(argv[argind], "-edge_left", &screen)) {
+ if(++argind < argc) {
+ if(screen == -1) {
+ return 0;
+ }
+ else {
+ screenArgs[screen].flags |= ARG_EDGE_L;
+ screenArgs[screen].edge_left = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch(argv[argind], "-edge_right", &screen)) {
+ if(++argind < argc) {
+ if(screen == -1) {
+ return 0;
+ }
+ else {
+ screenArgs[screen].flags |= ARG_EDGE_R;
+ screenArgs[screen].edge_right = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch(argv[argind], "-edge_top", &screen)) {
+ if(++argind < argc) {
+ if(screen == -1) {
+ return 0;
+ }
+ else {
+ screenArgs[screen].flags |= ARG_EDGE_T;
+ screenArgs[screen].edge_top = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+ else if (ArgMatch(argv[argind], "-edge_bottom", &screen)) {
+ if(++argind < argc) {
+ if(screen == -1) {
+ return 0;
+ }
+ else {
+ screenArgs[screen].flags |= ARG_EDGE_B;
+ screenArgs[screen].edge_bottom = atoi(argv[argind]);
+ }
+ skip = 2;
+ }
+ else return 0;
+ }
+
+ else if (ArgMatch(argv[argind], "-monitor", &screen)) {
+ if(++argind + 4 < argc) {
+ if(strlen(argv[argind]) == 5) {
+ strcpy(screenArgs[screen].monitor.type, argv[argind++]);
+ screenArgs[screen].monitor.mm_width = atoi(argv[argind++]);
+ screenArgs[screen].monitor.mm_height = atoi(argv[argind++]);
+ screenArgs[screen].monitor.color_or_mono =atoi(argv[argind++]);
+ screenArgs[screen].monitor.phosphor_type =atoi(argv[argind++]);
+ screenArgs[screen].flags |= ARG_MONITOR;
+ skip = 6;
+ }
+ else return 0;
+ }
+ else return 0;
+ }
+ else if (strcmp( argv[argind], "-btn") == 0)
+ {
+ if (++argind < argc)
+ {
+ wsNumButtons = atoi(argv[argind]);
+ skip = 2;
+ if(wsNumButtons < 1 || wsNumButtons > 5)
+ return 0;
+ }
+ else return 0;
+ }
+ else if (strcmp( argv[argind], "-forceDepth") == 0)
+ {
+ if (++argind < argc) {
+ forceDepth = atoi (argv[argind]);
+ skip = 2;
+ }
+ }
+
+#ifdef XINPUT
+ else
+ skip = ExtddxProcessArgument(argc, argv, argind);
+#endif
+
+ return skip;
+}
+
+initEdgeAttachments(index)
+ int index;
+{
+ ws_edge_connection wec;
+ ScreenArgsRec *args = &screenArgs[index];
+ int mask = args->flags;
+ wec.screen = index;
+ if(mask & ARG_EDGE_L)
+ wec.adj_screens.left = args->edge_left;
+ else
+ wec.adj_screens.left = index - 1;
+ if(mask & ARG_EDGE_R)
+ wec.adj_screens.right = args->edge_right;
+ else
+ if(index + 1 < wsinfo.num_screens_exist)
+ wec.adj_screens.right = index + 1;
+ else
+ wec.adj_screens.right = -1;
+ if(mask & ARG_EDGE_T)
+ wec.adj_screens.top = args->edge_top;
+ else
+ wec.adj_screens.top = -1;
+ if(mask & ARG_EDGE_B)
+ wec.adj_screens.bottom = args->edge_bottom;
+ else
+ wec.adj_screens.bottom = -1;
+ if (ioctl(wsFd, SET_EDGE_CONNECTION, &wec) == -1)
+ ErrorF("SET_EDGE_CONNECTION, failed to set edge attachment.\n");
+
+}
+
+#define ARGFILE "/etc/screens"
+
+void getFileArguments()
+{
+ FILE *f = fopen(ARGFILE, "r");
+ if(f) {
+ struct stat stats;
+ if(stat(ARGFILE, &stats) == 0) {
+ int i, argcount = 0, skip;
+ char *ptr, *buf = (char *)Xalloc(stats.st_size);
+ char **arguments;
+ while(EOF != fscanf(f, "%s", buf)) argcount++;
+ arguments = (char **) Xalloc(argcount * sizeof(char *));
+ rewind(f);
+ for(ptr = buf, i = 0; i < argcount; i++) {
+ arguments[i] = ptr;
+ fscanf(f, "%s", ptr);
+ ptr += strlen(arguments[i]) + 1;
+ }
+ fclose(f);
+ for(i = 0; i < argcount; i++)
+ if(skip = ddxProcessArgument(argcount, arguments, i))
+ i += (skip - 1);
+ Xfree(arguments);
+ Xfree(buf);
+ }
+ }
+}
+
+
+void
+ddxUseMsg()
+{
+ ErrorF ("\n");
+ ErrorF ("\n");
+ ErrorF ("Device Dependent Usage\n");
+ ErrorF ("Note - most ddx arguments can take an optional screen number ``s''\n");
+ ErrorF ("\n");
+ ErrorF ("-btn <n> Number of buttons on pointer device\n");
+ ErrorF ("-dpix[s] <n> Dots per inch, x coordinate\n");
+ ErrorF ("-dpiy[s] <n> Dots per inch, y coordinate\n");
+ ErrorF ("-dpi[s] <n> Dots per inch, x and y coordinates\n");
+ ErrorF (" (overrides -dpix and -dpiy above)\n");
+ ErrorF ("-bp[s] #XXX color for BlackPixel for screen\n");
+ ErrorF ("-wp[s] #XXX color for WhitePixel for screen\n");
+ ErrorF ("-class[s] <classname> type of Visual for root window\n");
+ ErrorF (" one of StaticGray, StaticColor, PseudoColor,\n");
+ ErrorF (" GrayScale, or even TrueColor!\n");
+ ErrorF ("-edge_left<s1> <s2> Attach left edge of screen s1 to screen s2\n");
+ ErrorF ("-edge_right<s1> <s2> Attach right edge of screen s1 to screen s2\n");
+ ErrorF ("-edge_top<s1> <s2> Attach top edge of screen s1 to screen s2\n");
+ ErrorF ("-edge_bottom<s1> <s2> Attach bottom edge of screen s1 to screen s2\n");
+
+#ifdef XINPUT
+ ExtddxUseMsg();
+#endif
+}
+
+/* ARGSUSED */
+int wsScreenInit(index, pScreen, argc, argv)
+ int index;
+ register ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+
+ pScreen->SaveScreen = wsSaveScreen;
+ pScreen->RealizeCursor = wsRealizeCursor;
+ pScreen->UnrealizeCursor = wsUnrealizeCursor;
+ pScreen->DisplayCursor = wsDisplayCursor;
+ pScreen->SetCursorPosition = wsSetCursorPosition;
+ pScreen->CursorLimits = wsCursorLimits;
+ pScreen->PointerNonInterestBox = wsPointerNonInterestBox;
+ pScreen->ConstrainCursor = wsConstrainCursor;
+ pScreen->RecolorCursor = wsRecolorCursor;
+ pScreen->StoreColors = wsStoreColors;
+ pScreen->InstallColormap = wsInstallColormap;
+ pScreen->UninstallColormap = wsUninstallColormap;
+ pScreen->ListInstalledColormaps = wsListInstalledColormaps;
+
+ initEdgeAttachments(index);
+ if(screenArgs[index].flags & ARG_MONITOR) {
+ ws_monitor_type wmt;
+ wmt.screen = index;
+ wmt.monitor_type = screenArgs[index].monitor;
+ if (ioctl(wsFd, SET_MONITOR_TYPE, &wmt) == -1)
+ ErrorF("SET_MONITOR_TYPE, failed to set monitor type.\n");
+ }
+ wsSaveScreen(pScreen, SCREEN_SAVER_OFF);
+ return index;
+}
+
+#ifdef DPMSExtension
+extern CARD16 DPMSPowerLevel;
+
+void DPMSSet(level)
+ int level;
+{
+ ws_power_mgt pwr;
+ int i;
+
+ for (i = 0; i < screenInfo.numVideoScreens; i++)
+ {
+ pwr.screen = WS_SCREEN(screenInfo.screens[i]);
+ pwr.state = 1;
+ pwr.level = level;
+ ioctl(wsFd, SET_POWER_LEVEL, &pwr);
+ }
+ DPMSPowerLevel = level;
+}
+
+int DPMSGet(level)
+ int* level;
+{
+ ws_power_mgt pwr;
+ int i;
+
+ for (i = 0; i < screenInfo.numVideoScreens; i++)
+ {
+ if (ioctl(wsFd, GET_POWER_LEVEL, &pwr) != DPMS_NOT_SUPPORTED)
+ return (CARD16)pwr.level;
+ }
+ return (CARD16)-1;
+}
+
+Bool DPMSSupported()
+{
+ ws_power_mgt pwr;
+ int i;
+ int supported = 0;
+
+ /* for the purposes of this extension, we will say that we support
+ DPMS if any of the screens support it, and leave it to the driver
+ to decide on a screen by screen basis. */
+
+ for (i = 0; i < screenInfo.numVideoScreens; i++)
+ {
+ supported = ioctl(wsFd, GET_POWER_LEVEL, &pwr);
+ if (supported != DPMS_NOT_SUPPORTED)
+ return TRUE;
+ }
+ return FALSE; /* didn't see any that work! */
+}
+#endif
diff --git a/xc/programs/Xserver/hw/hp/Imakefile b/xc/programs/Xserver/hw/hp/Imakefile
new file mode 100644
index 000000000..0b47fb63e
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/Imakefile
@@ -0,0 +1,45 @@
+XCOMM $XConsortium: Imakefile /main/9 1996/09/28 17:12:28 rws $
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+SUBDIRS=ngle input
+
+SRCS = \
+ ddx_info.c \
+ hpCursorUtils.c \
+ hpInit.c
+
+OBJS = \
+ ddx_info.o \
+ hpCursorUtils.o \
+ hpInit.o \
+ ngle/ngle.o \
+ input/libhp.a
+
+LOBJS = \
+ ddx_info.ln \
+ hpCursorUtils.ln \
+ hpInit.ln
+
+DEFINES = $(ANSI_DEFINES) -DOSMAJORVERSION=OSMajorVersion
+
+LIB_DEFINES = -DLIBDIR=\"$(LIBDIR)\"
+
+INCLUDES = -I. -I./include -I./input -I../../mfb -I../../cfb -I../../mi \
+ -I../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(FONTINCSRC)
+
+LINTLIBS = ../../dix/llib-ldix.ln ../../os/4.2bsd/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln
+
+all::
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+
+NormalLibraryObjectRule()
+NormalRelocatableTarget(hp,$(OBJS))
+SpecialCObjectRule(hpInit,$(ICONFIGFILES),$(LIB_DEFINES))
+DependTarget()
+InstallManPage(Xhp,$(MANDIR))
+
diff --git a/xc/programs/Xserver/hw/hp/Xhp.man b/xc/programs/Xserver/hw/hp/Xhp.man
new file mode 100644
index 000000000..d9fa27e27
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/Xhp.man
@@ -0,0 +1,136 @@
+.\" $TOG: Xhp.man /main/6 1998/02/10 13:10:34 kaleb $
+.\" Copyright 1994 Hewlett-Packard Company
+.\" Copyright 1994, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall not
+.\" be used in advertising or otherwise to promote the sale, use or other
+.\" dealing in this Software without prior written authorization from the
+.\" The Open Group.
+.\"
+.\" HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable
+.\" for errors contained herein or direct, indirect, special, incidental or
+.\" consequential damages in connection with the furnishing, performance, or
+.\" use of this material.
+.TH Xhp 1 "Release 6.4" "X Version 11"
+.SH NAME
+Xhp \- cfb-based X window system server for Hewlett-Packard workstations
+.SH SYNOPSIS
+.PP
+This cfb-based X server implementation is contributed by Hewlett-Packard
+as a sample implementation for HP workstations. Its performance on HP
+workstations will be inferior to the product X servers available from
+Hewlett-Packard. Not all graphics display devices available from
+Hewlett-Packard are supported by this implementation.
+.PP
+.SH "SUPPORTED GRAPHICS DEVICES"
+.PP
+Please refer to the HP catalog or to the apropriate data sheets
+for the displays. The data that follows relates the use of the
+product names with their official HP product numbers.
+.PP
+The following graphics display devices are supported by this implementation:
+.sp
+.TP
+.I HPA4070A
+This graphics device, known as "HCRX", is a 1280x1024 color device that has
+8 planes.
+.TP
+.I HPA4071A
+This graphics device, known as "HCRX24", is a 1280x1024 color device that has
+24 planes. It is optionally available with a hardware accelerator, in which
+case the product number is HPA4071A_Z.
+.TP
+.I HPA1659A
+This graphics device, known as "CRX", is a 1280x1024 color device that has
+8 planes.
+.TP
+.I HPA1439A
+This graphics device, known as "CRX24", is a 1280x1024 color device that has
+24 planes. It is optionally available with a hardware accelerator.
+.TP
+.I HPA1924A
+This graphics device, known as "GRX" is a 1280x1024 grayscale device that has
+8 planes.
+.TP
+.I HPA2269A
+This graphics device, known as "Dual CRX" is a 1280x1024 color device that has
+8 planes. It implements support for two displays on a single graphics card.
+.TP
+.I HP710C
+This graphics device is the internal graphics support optionally available on
+the HP9000s710 SPU. It supports 1280x1024 color displays and has 8 planes.
+.TP
+.I HP710G
+This graphics device is the internal graphics support optionally available on
+the HP9000s710 SPU. It supports 1280x1024 grayscale displays and has 8 planes.
+.TP
+.I HP710L
+This graphics device is the internal graphics support optionally available on
+the HP9000s710 SPU. It supports 1024x768 color displays and has 8 planes.
+.TP
+.I HP712
+This graphics device is the internal graphics support available on
+the HP9000s712 SPU. It supports 640x480, 1024x768 or 1280x1024 color displays
+and has 8 planes.
+.PP
+.SH "MULTIPLE SCREEN SUPPORT"
+.PP
+This Xhp X11 sample server supports multiple physical screens connected to a
+single X server. To use this feature, you must have an SPU that allows
+the installation of a second graphics display card. The file
+$(LIBDIR)/X*screens is read by the X11 server
+to determine information about the system screen configuration.
+You must modify this file to add information for the second graphics display.
+.sp
+$(LIBDIR) is /usr/X11R6/lib/X11 by default.
+.sp
+For a complete description of the X*screens file, refer to the HP-UX manuals,
+or view the sample file in $(LIBDIR).
+.SH "24 PLANE SUPPORT FOR HCRX24 AND CRX24"
+.PP
+This Xhp X11 sample server supports two modes for the HCRX24 and CRX24 display
+hardware: 8 plane and 24 plane, with 8 plane being the default.
+To run the server in 24 plane mode, you must add a depth parameter to
+the X*screens file. For example:
+.sp
+/dev/crt depth 24
+.sp
+.PP
+In depth 24 mode, the default visual type is DirectColor.
+.PP
+.SH "KEYMAP FILE"
+.PP
+This Xhp server loads a keymap that is appropriate for the attached keyboard
+from the XHPKeymaps file, which resides in $(LIBDIR). The XHPKeymaps file
+supplied with this Xhp server is a minimal file that supports US English,
+French, Spanish, German, and Japanese JIS keyboards. If you have some other
+keyboard, the appropriate keymap may not be contained in the XHPKeymaps file.
+In this case, if you have access to the Hewlett-Packard product X server, you
+can copy its keymap file (found in /usr/lib/X11/XHPKeymaps) to $(LIBDIR).
+.SH "FAST SCROLLING OPTION"
+.PP
+Since scrolling speed is especially slow on this server compared
+to HP's product server, we have supplied fast scrolling support,
+using a .o to link into the server. Using HP's fast scrolling
+is optional. To enable the fast scrolling, set the token
+"HPFastScrolling" to TRUE in the config/hp.cf file. If you want
+to use the CFB scrolling module, simply remove the define in
+config/hp.cf, remake the Makefiles, and recompile.
+.SH TRADEMARKS
+.PP
+X Window System is a trademark of The Open Group, Inc.
diff --git a/xc/programs/Xserver/hw/hp/ddx_info.c b/xc/programs/Xserver/hw/hp/ddx_info.c
new file mode 100644
index 000000000..dd8d77404
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ddx_info.c
@@ -0,0 +1,169 @@
+/* $TOG: ddx_info.c /main/4 1997/07/17 21:20:02 kaleb $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+ * RESTRICTED RIGHTS LEGEND
+ * Use, duplication, or disclosure by the U.S. Government is subject to
+ * restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
+ * Technical Data and Computer Software clause in DFARS 252.227-7013.
+ *
+ * Hewlett-Packard Company
+ * 3000 Hanover Street
+ * Palo Alto, CA 94304 U.S.A.
+ *
+ * Rights for non-DOD U.S. Government Departments and Agencies are as set
+ * forth in FAR 52.227-19(c)(1,2).
+ *
+ *************************************************************************/
+
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/framebuf.h>
+#include <fcntl.h>
+
+#include <X.h>
+#include <Xproto.h>
+#include <scrnintstr.h>
+#include <pixmapstr.h>
+#include <resource.h>
+#include <misc.h>
+#include <mi.h>
+#include <servermd.h>
+#include <windowstr.h>
+#include <colormap.h>
+
+#include "hppriv.h"
+
+#if defined(__hp9000s700) || defined(__hp9000s300)
+/* Until <graphics.h> (s400) and <framebuf.h> (s700) are updated,
+ * define graphics IDs returned by ioctl(GCDESCRIBE). On both
+ * platforms, this ID equals the upper 4 bytes of the STI ROM ID.
+ *
+ * (s400 won't support 24-plane color (Rattler); that's handled below).
+ */
+/* Until <framebuf.h> (s700) is updated */
+# ifndef S9000_ID_A1659A /* CRX (8-plane Color) */
+# define S9000_ID_A1659A 0x26D1482A
+# endif
+# ifndef S9000_ID_A1924A /* GRX (Gray Scale) */
+# define S9000_ID_A1924A 0x26D1488C
+# endif
+# ifndef S9000_ID_A1439A /* CRX+ (24-plane Color */
+# define S9000_ID_A1439A 0x26D148EE
+# endif
+# ifndef S9000_ID_TIMBER /* Bushmaster (710) Graphics */
+# define S9000_ID_TIMBER 0x27F12392
+# endif
+# ifndef S9000_ID_TOMCAT /* 2-headed ELK; sorry, no P/N yet */
+# define S9000_ID_TOMCAT 0x27FCCB6D
+# endif
+# ifndef S9000_ID_ARTIST /* Artist 712/715 mother board graphics */
+# define S9000_ID_ARTIST 0x2B4DED6D
+# endif
+# ifndef S9000_ID_HCRX /* Hyperdrive A4071A */
+# define S9000_ID_HCRX 0x2BCB015A
+# endif
+#endif
+
+/* Declare the external initialization functions */
+
+extern Bool ngleScreenInit();
+
+
+ /* --------------------- ddx_driver_info -------------------------- */
+ /* This is an inital entry point into the hpux ddx drivers. This
+ procedure is called to determine if ddx driver support exists
+ for a given display and configuration. The display and
+ configuration are defined by the hp private structure passed
+ into this routine. A null pointer is returned if no ddx driver
+ support is available. If a ddx driver does exist to support the
+ given configuration, then a pointer to the driver's initialization
+ routine, which is later called by InitOutput(), routine is
+ returned.
+ */
+
+Bool (*ddx_driver_info( php))()
+ hpPrivPtr php;
+{
+ struct stat statInfo;
+ int result;
+ crt_frame_buffer_t desc;
+ char *map_origin = NULL;
+ Bool (*return_value)();
+
+
+ /* Stat the file descriptor to see if the device file exists: */
+ if((result = stat( php->StandardDevice, &statInfo)) < 0)
+ {
+ return(NULL);
+ }
+
+ /* Stat the file descriptor to see if the device exists: */
+ if(!( statInfo.st_mode & S_IFCHR))
+ {
+ return(NULL);
+ }
+
+ /* Let's open the device: */
+ if(( php->StandardFd = open(php->StandardDevice, O_RDWR)) < 0)
+ {
+ return(NULL);
+ }
+
+ /* Map the device: */
+ if( ioctl( php->StandardFd, GCMAP, &map_origin) < 0)
+ {
+ close(php->StandardFd);
+ return(NULL);
+ }
+
+ /* Does the kernel know what's out there?: */
+ if( ioctl( php->StandardFd, GCDESCRIBE, &desc) < 0)
+ {
+ ioctl(php->StandardFd, GCUNMAP, &map_origin );
+ close(php->StandardFd );
+ return(NULL);
+ }
+
+ /* Let's give the driver a chance to look at the device: */
+ switch(desc.crt_id)
+ {
+ /* Devices supported on s700 */
+#ifdef S9000_ID_A1924A
+ case S9000_ID_A1924A: /* GRX (8-plane Gray Scale) */
+#endif
+ case S9000_ID_A1659A: /* CRX (8-plane Color) */
+#ifdef S9000_ID_TOMCAT
+ case S9000_ID_TOMCAT: /* 2-Headed CRX */
+#endif
+#ifdef S9000_ID_TIMBER
+ case S9000_ID_TIMBER: /* Bushmaster (710) Graphics */
+#endif
+ case S9000_ID_A1439A: /* CRX24 (24-plane Color) */
+#ifdef S9000_ID_ARTIST
+ case S9000_ID_ARTIST: /* 712 (8-plane Color) Graphics */
+#endif
+#ifdef S9000_ID_HCRX
+ case S9000_ID_HCRX: /* Hyperdrive (8 or 24 plane) */
+#endif
+
+ return_value = ngleScreenInit;
+ break;
+
+ default:
+ return_value = NULL;
+ break;
+ }
+
+ /* We've got our info, so lets close things down so the driver can
+ * re-open them:
+ */
+ ioctl(php->StandardFd, GCUNMAP, &map_origin);
+ close(php->StandardFd );
+
+ return(return_value);
+}
diff --git a/xc/programs/Xserver/hw/hp/hpCursorUtils.c b/xc/programs/Xserver/hw/hp/hpCursorUtils.c
new file mode 100644
index 000000000..9ffec9572
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/hpCursorUtils.c
@@ -0,0 +1,145 @@
+/* $TOG: hpCursorUtils.c /main/4 1998/02/10 13:10:25 kaleb $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+ * RESTRICTED RIGHTS LEGEND
+ * Use, duplication, or disclosure by the U.S. Government is subject to
+ * restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
+ * Technical Data and Computer Software clause in DFARS 252.227-7013.
+ *
+ * Hewlett-Packard Company
+ * 3000 Hanover Street
+ * Palo Alto, CA 94304 U.S.A.
+ *
+ * Rights for non-DOD U.S. Government Departments and Agencies are as set
+ * forth in FAR 52.227-19(c)(1,2).
+ *
+ *************************************************************************/
+
+/*''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Copyright 1988 by Hewlett-Packard Company
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard,
+ Massachusetts
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the names of
+Hewlett-Packard or Digital not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987, 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*/
+
+
+#include "hpext.h"
+#include "hildef.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "regionstr.h"
+#include "inputstr.h"
+#include "opaque.h"
+#include "hppriv.h"
+
+extern int hpActiveScreen; /* Stacked mode, >1 head */
+extern WindowPtr *WindowTable; /* Defined by DIX */
+
+static CursorPtr currentCursors[MAXSCREENS];
+
+void hpBlottoCursors()
+{
+ int j;
+ for (j = MAXSCREENS; j--; ) currentCursors[j] = NULL;
+}
+
+/************************************************************
+ * hpCursorLimits
+ * Return a box within which the given cursor may move on the given
+ * screen. We assume that the HotBox is actually on the given screen,
+ * since dix knows that size.
+ *
+ * Results:
+ * A box for the hot spot corner of the cursor.
+ ************************************************************/
+
+void
+hpCursorLimits( pScreen, pCursor, pHotBox, pResultBox)
+ScreenPtr pScreen; /* Screen on which limits are desired */
+CursorPtr pCursor; /* Cursor whose limits are desired */
+BoxPtr pHotBox; /* Limits for pCursor's hot point */
+BoxPtr pResultBox; /* RETURN: limits for hot spot */
+{
+ *pResultBox = *pHotBox;
+ pResultBox->x2 = min(pResultBox->x2,pScreen->width);
+ pResultBox->y2 = min(pResultBox->y2,pScreen->height);
+}
+
+/************************************************************
+ *
+ * hpSetCursorPosition
+ *
+ * This routine is called from DIX when the X11 sprite/cursor is warped.
+ *
+ ************************************************************/
+
+Bool
+hpSetCursorPosition(pScreen, xhot, yhot, generateEvent)
+ScreenPtr pScreen;
+short xhot;
+short yhot;
+Bool generateEvent;
+{
+ HPInputDevice *InDev; /* Input device structure */
+ hpPrivPtr php; /* XOS private structure */
+
+ php = (hpPrivPtr) pScreen->devPrivate;
+
+ /* Must Update the Input Driver's Variables: */
+ InDev = GET_HPINPUTDEVICE((DeviceIntPtr)LookupPointerDevice());
+ InDev->pScreen = pScreen;
+ InDev->coords[0] = xhot;
+ InDev->coords[1] = yhot;
+
+ /* Do the move now */
+ (*php->MoveMouse)(pScreen, xhot, yhot, 0);
+
+ if (generateEvent)
+ {
+ queue_motion_event(InDev); /* Enqueue motion event, in x_hil.c */
+ isItTimeToYield++; /* Insures client get the event! */
+ }
+
+ return(TRUE);
+
+} /* hpSetCursorPosition() */
diff --git a/xc/programs/Xserver/hw/hp/hpInit.c b/xc/programs/Xserver/hw/hp/hpInit.c
new file mode 100644
index 000000000..544b0d1c6
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/hpInit.c
@@ -0,0 +1,804 @@
+/* $TOG: hpInit.c /main/6 1997/11/12 14:38:12 kaleb $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+ * RESTRICTED RIGHTS LEGEND
+ * Use, duplication, or disclosure by the U.S. Government is subject to
+ * restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
+ * Technical Data and Computer Software clause in DFARS 252.227-7013.
+ *
+ * Hewlett-Packard Company
+ * 3000 Hanover Street
+ * Palo Alto, CA 94304 U.S.A.
+ *
+ * Rights for non-DOD U.S. Government Departments and Agencies are as set
+ * forth in FAR 52.227-19(c)(1,2).
+ *
+ *************************************************************************/
+
+#include "X.h"
+#include "Xproto.h"
+#include <servermd.h>
+
+#include "screenint.h"
+#include "input.h"
+#include "cursor.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+
+#include "screentab.h"
+#include "gcstruct.h"
+#include "errno.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+#include "hppriv.h"
+#include "XHPproto.h"
+
+#ifndef LIBDIR
+#if OSMAJORVERSION >= 10
+#define LIBDIR "/etc/X11"
+#else
+#define LIBDIR "/usr/lib/X11"
+#endif
+#endif
+
+extern char *display; /* display number as a string */
+extern unsigned char *get_display_address();
+
+extern void Xfree();
+
+extern char *getenv(); /* for reading SB_DISPLAY_ADDR env var */
+extern long strtol();
+
+static void ParseXnScreensFile();
+static void ResetFields();
+static void FirstTimeInitialization( );
+static int ParseNextScreen( );
+static char yygetc();
+static void ReadToNextWhiteSpace();
+static void SyntaxError();
+void Exit();
+
+static int NumScreens; /* number of screens found */
+
+PixmapFormatRec formats[] = {
+ 1, 1, BITMAP_SCANLINE_PAD, /* 1-bit deep for all */
+ 8, 8, BITMAP_SCANLINE_PAD, /* 8-bit deep for most color displays */
+ 24, 32, BITMAP_SCANLINE_PAD, /* 24-bit deep display */
+};
+#define NUMFORMATS (sizeof formats)/(sizeof formats[0])
+#define NUM_DEPTHS 16
+
+static hpPrivPtr AllocateDataStructures();
+
+int LineNumber = 1;
+
+
+/*
+ * parameters defining the reserved word return values
+ */
+#define DEPTH 1
+#define DRIVERNAME 2
+#define DOUBLEBUFFER 3
+#define MONITORSIZE 4
+
+/*
+ * parameters defining the return status from GetToken().
+ */
+#define END_OF_LINE 1
+#define ID 2
+#define INTEGER 3
+#define RESERVED_WORD 4
+
+/*
+ * reserved word table for parsing X*screens file
+ */
+static struct token {
+ char name[16];
+ int rvalue;
+} tks [] = {
+ "depth", DEPTH,
+ "drivername", DRIVERNAME,
+ "doublebuffer", DOUBLEBUFFER,
+ "monitorsize", MONITORSIZE,
+ "", NULL,
+};
+
+/************************************************************
+ * InitOutput --
+ * This routine is called from main() during the server
+ * startup initialization, and when the server is to be reset.
+ * The routine does the device dependent initialization for
+ * all of the screens this server is configured to support.
+ *
+ * Results:
+ * The array of ScreenRec pointers referenced by
+ * pScreenInfo->screen are allocated and initialized.
+ * The X*screens file is parsed and checked for
+ * validity with reference to the particular screen
+ * hardware.
+ *
+ ************************************************************/
+
+extern int hpActiveScreen; /* active screen ndx (Zaphod), in x_hil.c */
+
+Bool (*ddx_driver_info())();
+Bool (*ddxScreenInitPointer[MAXSCREENS])();
+
+void
+InitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ int i;
+
+ static int firstTime = 1;
+
+ /* Reset some cursor stuff to avoid massive confusion at server
+ * reset time.
+ */
+ hpActiveScreen = 0;
+ hpBlottoCursors();
+
+ FirstTimeInitialization( pScreenInfo, argc, argv);
+
+ /*************************
+ Set up signal handling
+ **/
+ OsSignal (SIGPIPE, SIG_IGN);
+ OsSignal (SIGHUP, AutoResetServer);
+ OsSignal (SIGINT, GiveUp);
+ OsSignal (SIGTERM, GiveUp);
+}
+
+hpPrivPtr hpPrivates[MAXSCREENS];
+int hpNumScreens;
+
+/************************************************************
+ * FirstTimeInitialization
+ *
+ * This routine handles the first time initialization
+ * duties.
+ *
+ ************************************************************/
+
+static void
+FirstTimeInitialization( pScreenInfo, argc, argv)
+ScreenInfo *pScreenInfo;
+int argc;
+char **argv;
+{
+ int i;
+
+ ParseXnScreensFile( pScreenInfo );
+
+ /*
+ * Add check of device independent screen conditions -kam 9/13
+ */
+
+ if(hpNumScreens > MAXSCREENS)
+ {
+ ErrorF("Number of screens requested exceeds allowable limit of %d screens.\n", MAXSCREENS);
+ ErrorF("Please reduce the number of requested screens in your ");
+ ErrorF("'%s/X%sscreens' file.\n", LIBDIR, display);
+ ErrorF("Server exiting...\n");
+ Exit(UNABLE_TO_INITIALIZE_THE_DISPLAY);
+ }
+
+ for(i = 0; i < hpNumScreens; i++)
+ {
+ ddxScreenInitPointer[i] = ddx_driver_info(hpPrivates[i]);
+ }
+
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+
+
+
+ for ( i = 0; i < NUMFORMATS; i++)
+ {
+ pScreenInfo->formats[i] = formats[i];
+ }
+
+ /*
+ * call the AddScreen function in dix/main.c
+ * This routine will fiddle with the pixmap formats, and
+ * then call ngleScreenInit to initialize the screen.
+ *
+ * WARNING: AddScreen has a bogosity(!) in that it uses the
+ * value of pScreenInfo.numScreens to determine which
+ * &pScreenInfo.screen[ i ] to pass to ngleScreenInit.
+ * Therefore the value of pScreenInfo.numScreens is manipulated
+ * here as a work around. ( Do we really HAVE TO call AddScreen? ).
+ */
+
+ do
+ {
+ if (-1 == AddScreen(ddxScreenInitPointer[pScreenInfo->numScreens],
+ argc,argv))
+ FatalError("Could not add screen.\n");
+
+ } while ( pScreenInfo->numScreens != hpNumScreens );
+
+ return;
+}
+
+
+/************************************************************
+ * ParseXnscreensFile
+ *
+ * This routine parses the X*screens file.
+ * where * refers to the display number of this server.
+ *
+ * 1) If no X*screens file exists, just set up the defaults
+ * and return.
+ * 2) Each non-comment line in the X*screens file gives a
+ * definition for a screen.
+ *
+ *
+ ************************************************************/
+
+static void
+ParseXnScreensFile( pScreenInfo )
+ScreenInfo * pScreenInfo;
+{
+ int fd;
+ int i;
+ char filename[MAX_PATH_NAME];
+ FILE *str;
+ int status;
+ hpPrivPtr phpPriv;
+ int index;
+
+ hpNumScreens = 0;
+
+ phpPriv = AllocateDataStructures();
+ hpPrivates[hpNumScreens] = phpPriv;
+
+ sprintf( filename, "%s/X%sscreens", LIBDIR, display );
+ str = fopen( filename, "r");
+ if (str == NULL) FatalError("Cannot open the %s file.\n", filename);
+
+ status = ParseNextScreen( phpPriv, filename, str );
+ /*
+ * if status is -1, then the ParseNextScreen routine
+ * could not find ANY useful information in the
+ * Xnscreens file, so just setup the default
+ */
+ if ( status == -1 )
+ FatalError(
+ "No valid information exists in your %s/Xnscreens file.\n", LIBDIR);
+ /*
+ *
+ */
+ for (;;)
+ {
+ phpPriv = AllocateDataStructures ();
+ hpNumScreens++;
+ status = ParseNextScreen( phpPriv, filename, str );
+ /*
+ * status of 1 indicates end of file.
+ */
+ if ( ( status == 1 ) || ( status == -1 ) )
+ {
+ Xfree(phpPriv);
+ break;
+ }
+ hpPrivates[hpNumScreens] = phpPriv;
+ }
+
+ fclose( str );
+}
+
+/************************************************************
+ * ParseNextScreen
+ *
+ * This routine is responsible for parsing one line of the
+ * X*screens file. It loops until it can return valid
+ * information from one line of the X*screens file, or
+ * until EOF is encountered. The actual parsing of a
+ * line in the file is performed here. If a syntax error
+ * is encountered, the routine throws away the line, and
+ * tries to parse the next line.
+ *
+ * RETURNED VALUES: 0 if valid value filled out in *pScrPriv
+ * 1 if EOF encountered
+ * -1 if no valid entries (at all) found
+ *
+ * EXTERNAL VARIABLES:
+ * display - set in main.c, points to string giving
+ * display number for this server.
+ ************************************************************/
+
+static
+ParseNextScreen( phpPriv, filename, str )
+hpPrivPtr phpPriv;
+char * filename;
+FILE * str;
+{
+ int i;
+ int status;
+ char string[MAX_PATH_NAME];
+ int Error = 0;
+
+ /*
+ * loop until we get a valid screen line, or until
+ * EOF is seen.
+ */
+ while ( 1 )
+ {
+ ResetFields( phpPriv );
+ /*
+ * first field must be a "/dev/crt" type field.
+ * read until we get an IDENTIFIER
+ */
+ for (;;)
+ {
+ status = GetToken( str, filename, &i, string, MAX_PATH_NAME );
+ if (status == -1 )
+ return( -1 );
+ if ( status != ID )
+ {
+ if ( status == END_OF_LINE )
+ continue;
+ else
+ {
+ SyntaxError( str, filename );
+ Error = 1;
+ }
+ }
+ break;
+ }
+ if ( Error )
+ {
+ Error = 0;
+ continue;
+ }
+ /*
+ * Hokay, we have an IDENTIFIER. This *should*
+ * be a device, however it is not checked for validity
+ * here.
+ */
+
+ strncpy( phpPriv->StandardDevice, string, MAX_PATH_NAME );
+ phpPriv->LineNumber = LineNumber;
+ /*
+ * now parse for reserved words until we see an
+ * IDENTIFIER or END_OF_LINE
+ */
+ while ( 1 )
+ {
+ status = GetToken( str, filename, &i, string, MAX_PATH_NAME );
+ switch( status )
+ {
+ case -1:
+ return( 1 );
+ case END_OF_LINE:
+ return( 0 );
+ break;
+
+ case RESERVED_WORD:
+ switch( i )
+ {
+ case MONITORSIZE:
+ if ( GetANumber( str, filename, &i ) == -1 )
+ {
+ Error = 1;
+ break;
+ }
+ phpPriv->MonitorDiagonal = i;
+ break;
+ case DEPTH:
+ if ( GetANumber (str, filename, &i ) == -1 )
+ {
+ Error = 1;
+ break;
+ }
+ phpPriv->depth = i;
+ break;
+ }
+ /*
+ * end of switch on result from GetToken
+ */
+ break;
+
+ default:
+ FatalError( "An error occurred while processing %s/X*screens.",
+ LIBDIR);
+ }
+ if ( Error )
+ break;
+ }
+ /*
+ * OK, now we either have satisfactorily parsed
+ * the primary screen device AND we have a valid secondary
+ * screen device, OR we have an error.
+ */
+ if ( Error )
+ {
+ Error = 0;
+ continue;
+ }
+ }
+}
+
+/************************************************************
+ * AllocateDataStructures
+ *
+ * Allocate the hp private data structures
+ ************************************************************/
+
+static hpPrivPtr
+AllocateDataStructures()
+{
+ hpPrivPtr phpPriv;
+
+ phpPriv = (hpPrivPtr) Xcalloc( sizeof( hpPriv ));
+
+ if ( phpPriv == NULL )
+ {
+ FatalError("Cannot allocate enough memory for internal use--sorry");
+ }
+
+ return( phpPriv );
+}
+
+/************************************************************
+ * GetANumber
+ *
+ ************************************************************/
+
+int
+GetANumber( str, filename, pInt )
+FILE * str;
+char * filename;
+int * pInt;
+{
+ int status;
+ int i;
+ char string[MAX_PATH_NAME];
+
+ status = GetToken( str, filename, &i, string, MAX_PATH_NAME );
+ if (status == -1 )
+ {
+ SyntaxError( str, filename );
+ return( -1 ); /* kam 9/13 */
+ }
+ if ( status != INTEGER )
+ {
+ SyntaxError( str, filename );
+ return( -1 ); /* kam 9/13 */
+ }
+ *pInt = i;
+ return( 0 );
+}
+
+/************************************************************
+ * GetToken
+ * This routine scans the X*screens file as given
+ * by fd for the next token.
+ *
+ * RETURNED VALUES:
+ * INTEGER if an integer is seen
+ * ID if an identifier is seen
+ * STRING if a device pathname is seen
+ * -1 if EOF is seen
+ *
+ * strptr used to fill pathname when STRING returned
+ * iptr used to fill id number when ID returned
+ * iptr used to fill integer when INTEGER returned
+ *
+ *
+ ************************************************************/
+int
+GetToken( FileStream, FileName, iptr, strptr, MaxStrLen )
+FILE * FileStream;
+char * FileName;
+int * iptr;
+char * strptr;
+int MaxStrLen;
+{
+ char c;
+ int i;
+ char nextid[MAX_PATH_NAME];
+ struct token *t;
+ char *cp;
+
+ for (;;) {
+ c = yygetc( FileStream );
+ if (c == '\n')
+ return( END_OF_LINE );
+ if ( isspace( c ))
+ continue;
+ if (c == EOF)
+ return(-1);
+ if (isdigit(c))
+ {
+ i = 1;
+ nextid[0] = c;
+ while ( isdigit( c = yygetc( FileStream ) )
+ || ( c == 'x') || (c == 'X' ))
+ nextid[i++] = c;
+ nextid[i] = 0;
+ *iptr = atoi( nextid );
+ ungetc( c, FileStream );
+ if ( c == '\n' )
+ LineNumber--;
+ return( INTEGER );
+ }
+ else if ( ! isspace ( c ))
+ {
+ nextid[0] = c;
+ for (i = 1; i < MaxStrLen; i++)
+ {
+ if ( !isspace( c = yygetc( FileStream )))
+ {
+ nextid[i] = c;
+ }
+ else
+ {
+ ungetc(c, FileStream);
+ if ( c == '\n' )
+ LineNumber--;
+ nextid[i] = 0;
+ /*
+ * search for the identifier
+ * in the reserved word table.
+ */
+ for (t = tks; t->rvalue; t++)
+ {
+ if ( strcmp(nextid, t->name) == 0 ) {
+ *iptr = t->rvalue;
+ return( RESERVED_WORD );
+ }
+ }
+ strncpy( strptr, nextid, MaxStrLen );
+ return( ID );
+ }
+ }
+ /*
+ * error, string is too long
+ */
+ErrorF( "String is too long in file %s on line %d. Ignoring the line...\n",
+ FileName, LineNumber );
+ ReadToNextWhiteSpace( FileStream);
+ return( GetToken( FileStream, FileName, iptr, strptr, MaxStrLen ));
+
+ }
+ else
+ {
+ErrorF( "Syntax error in file %s on line %d. Ignoring the line...\n",
+ FileName, LineNumber );
+ ReadToNextWhiteSpace( FileStream);
+ return( GetToken( FileStream, FileName, iptr, strptr, MaxStrLen ));
+ }
+ }
+}
+/************************************************************
+ * ResetFields
+ * This routine clears out fields in the hpPriv structure.
+ * This makes sure that any previous settings are cleared if we hit
+ * a syntax error.
+ *
+ ************************************************************/
+
+static void
+ResetFields( phpPriv )
+hpPrivPtr phpPriv;
+{
+ phpPriv->StandardDevice[0] = 0;
+ phpPriv->StandardDriver[0] = 0;
+ phpPriv->StandardNumDepths = 0;
+ phpPriv->StandardDoubleBuffer = 0;
+ phpPriv->StandardDoubleBufferDepth = 0;
+
+ phpPriv->MonitorDiagonal = 0;
+ phpPriv->depth = 8;
+
+}
+/************************************************************
+ * SyntaxError
+ * This routine reports a syntax error regarding the
+ * X*screens file, and then skips over the rest of the
+ * current line.
+ *
+ ************************************************************/
+
+static void
+SyntaxError( FileStream, filename )
+FILE * FileStream;
+char * filename;
+{
+ int i;
+ char Dummy[MAX_PATH_NAME];
+ int status;
+
+ ErrorF( "Syntax error in file %s on line %d. Ignoring the line...\n",
+ filename, LineNumber );
+ do {
+ status = GetToken( FileStream, filename, &i, Dummy, MAX_PATH_NAME );
+ if ( status == -1 )
+ return;
+ } while ( status != END_OF_LINE );
+}
+
+/************************************************************
+ * ReadToNextWhiteSpace
+ * This routine reads characters from the Xnscreens file
+ * until the next whitespace character is reached.
+ * Retain an end of line for parsing purposes if one
+ * is encounterd.
+ *
+ ************************************************************/
+
+static void
+ReadToNextWhiteSpace( FileStream )
+FILE * FileStream;
+{
+ char c;
+
+ while (( c = yygetc( FileStream )) != EOF )
+ {
+ if ( (c == ' ' ) || ( c == '\t') )
+ return;
+ if ( c == '\n' )
+ {
+ ungetc(c, FileStream);
+ LineNumber--;
+ return;
+ }
+ }
+}
+
+/************************************************************
+ * yygetc
+ * This routine reads characters from the Xnscreens file.
+ * The routine skips over comments ( begin with a # and go to
+ * the end of the line ).
+ *
+ * RETURNED VALUES: returns the next character in the file.
+ *
+ * SIDE EFFECTS: LineNumber is updated
+ ************************************************************/
+static char
+yygetc( FileStream )
+FILE *FileStream;
+{
+ char c;
+
+ if ((c = fgetc( FileStream )) == EOF)
+ return((char)EOF);
+ if (c == '\n') {
+ LineNumber++;
+ return(c);
+ }
+ else if ( c == '#' )
+ {
+ while ( c == '#' )
+ {
+ while (( c = fgetc( FileStream )) != EOF)
+ {
+ if (c != '\n')
+ continue;
+ else
+ {
+ LineNumber++;
+ return( c );
+ }
+ }
+ }
+ }
+ return(c);
+}
+
+/****************************************
+* ddxUseMsg()
+*
+* Called my usemsg from os/utils/c
+*
+*****************************************/
+
+void ddxUseMsg()
+{
+ /* Right now, let's just do nothing */
+}
+
+void Exit (code)
+ int code;
+{
+ exit (code);
+}
+
+void AbortDDX ()
+{
+}
+
+/*****************************************************
+ The main exit point for the server.
+ - throws us here when the user [Shift][CTRL][Reset]s.
+ - also come here upon kill -1 or kill -2 to the server
+***/
+void ddxGiveUp() /* Called by GiveUp() */
+{
+ /* soft reset the ITE by writing ESC-g to standard error */
+ write(2, "\033g", 2);
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+
+{
+ return(0);
+}
+
+
+/**************************************************************
+ *
+ * ErrorLine(phpPriv)
+ *
+ * This routine prints out a message that an error occurred on a
+ * particular line in the Xnscreens file. It does not print the
+ * error message, just the line number and the screen file name.
+ *
+ * Parameters:
+ *
+ * A pointer to an hpPrivRec
+ *
+ * Return Value:
+ * None.
+ *
+ ***************************************************************/
+
+void
+ErrorLine(phpPriv)
+
+hpPrivPtr phpPriv;
+
+{
+
+ ErrorF("Error in line %d of your %s/X%sscreens file.\n",
+ phpPriv->LineNumber, LIBDIR, display);
+ return;
+
+}
+
+#ifdef DPMSExtension
+/**************************************************************
+ * DPMSSet(), DPMSGet(), DPMSSupported()
+ *
+ * stubs
+ *
+ ***************************************************************/
+
+void DPMSSet (level)
+ int level;
+{
+}
+
+int DPMSGet (level)
+ int* level;
+{
+ return -1;
+}
+
+Bool DPMSSupported ()
+{
+ return FALSE;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/hp/include/XHPproto.h b/xc/programs/Xserver/hw/hp/include/XHPproto.h
new file mode 100644
index 000000000..448e25ab7
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/include/XHPproto.h
@@ -0,0 +1,216 @@
+/* $XConsortium: XHPproto.h,v 1.2 95/01/24 01:46:26 dpw Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+ HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *************************************************************************/
+#ifndef XHPPROTO_H
+#define XHPPROTO_H
+
+/* Definitions for HP extensions used by the server and C bindings*/
+
+#ifndef XMD_H
+#include "Xmd.h"
+#endif
+
+/* detailed device information */
+
+#define NO_DEVICE 0x00
+#define HP_ITF_KBD 0x01
+#define PC101_KBD 0x02
+#define IBM3270_KBD 0x03
+#define LK201_KBD 0x04
+#define LK401_KBD 0x05
+#define UNIX_KBD 0x06
+#define SUN3_KBD 0x07
+#define SUN4_KBD 0x08
+
+#define HP_HIL 0x40
+#define PS2 0x80
+#define SERIAL 0xC0
+
+#define ALLWINDOWS -1
+
+#define STDEVENTS -1
+#define EXTEVENTS 0
+#define CORE_EVENTS 64
+
+#define REPEAT_30 0
+#define REPEAT_60 1
+
+#define OFF (0L << 0)
+#define ON (1L << 0)
+#define RELATIVE (0L << 1)
+#define ABSOLUTE (1L << 1)
+#define SYSTEM_EVENTS (0L << 2)
+#define DEVICE_EVENTS (1L << 2)
+
+/* HP devices */
+
+#define XPOINTER 0
+#define XKEYBOARD 1
+#define XOTHER 2
+
+#define NUM_DEV_TYPES 19
+
+#if defined(__hp9000s300) || defined(__hp9000s700)
+#define MAX_POSITIONS 7
+#define MAX_LOGICAL_DEVS 9
+#else
+#define MAX_POSITIONS 28
+#define MAX_LOGICAL_DEVS 30
+#endif
+
+#define NULL_DEVICE 0
+#define MOUSE 1
+#define TABLET 2
+#define KEYBOARD 3
+#define QUADRATURE 4
+#define TOUCHSCREEN 5
+#define TOUCHPAD 6
+#define BUTTONBOX 7
+#define BARCODE 8
+#define ONE_KNOB 9
+#define TRACKBALL 10
+#define KEYPAD 11
+#define NINE_KNOB 12
+#define ID_MODULE 13
+#define VCD_8_DIALBOX 14
+#define MMII_1812_TABLET 15
+#define SS_SPACEBALL 16
+#define APOLLO_LPFK 17
+#define MMII_1201_TABLET 18
+
+#define DVKeyClickPercent (1L<<0)
+#define DVBellPercent (1L<<1)
+#define DVBellPitch (1L<<2)
+#define DVBellDuration (1L<<3)
+#define DVLed (1L<<4)
+#define DVLedMode (1L<<5)
+#define DVKey (1L<<6)
+#define DVAutoRepeatMode (1L<<7)
+#define DVAccelNum (1L<<8)
+#define DVAccelDenom (1L<<9)
+#define DVThreshold (1L<<10)
+
+/*
+ * Display modes, needed by both server and clients.
+ *
+ *
+ */
+
+#define OVERLAY_MODE 0x1
+#define IMAGE_MODE 0x2
+#define STACKED_MODE 0x3
+#define STACKED_MODE_FIRST_SCREEN 0x3
+#define STACKED_MODE_SECOND_SCREEN 0x33
+#define COMBINED_MODE 0x4
+
+#define XHPOVERLAY_MODE OVERLAY_MODE
+#define XHPIMAGE_MODE IMAGE_MODE
+#define XHPSTACKED_SCREENS_MODE STACKED_MODE
+#define XHPCOMBINED_MODE COMBINED_MODE
+
+/*
+ * Server exit error codes
+ *
+ */
+#define NORMAL_TERMINATION 0
+#define UNABLE_TO_INITIALIZE_THE_DISPLAY 1
+#define INCORRECT_SB_DISPLAY_ADDR_ENVIRONMENT_VAR 2
+#define INCORRECT_GRM_SIZE_ENVIRONMENT_VAR 3
+#define UNABLE_TO_STARTUP_OR_CONNECT_TO_THE_GRM 4
+#define DISPLAY_TYPE_UNKNOWN_TO_SERVER 5
+#define DOUBLE_BUFFERING_NOT_SUPPORTED 6
+#define DOUBLE_BUFFERING_HARDWARE_NOT_PRESENT 7
+#define CANNOT_SUPPORT_DEPTHS_OPTION_ON_THIS_DISPLAY 8
+#define UNSUPPORTED_DEPTH_SPECIFIED 9
+#define HARDWARE_AT_THIS_DEPTH_NOT_PRESENT 10
+#define DUPLICATE_DEVICE_ENTRY_IN_FILE 11
+#define CANNOT_GET_DRIVER_INFO 12
+#define COMBINED_MODE_NOT_STACKED_SCREENS_MODE 13
+#define TWO_TIMES_COMBINED_MODE 14
+#define SECONDARY_DIFFERENT_FROM_PRIMARY 15
+
+
+ /* Vendor Release Numbering scheme.
+ * The new scheme is needed so that clients can better tell what
+ * server they are running against.
+ * Format of the Vendor Release Number:
+ * aabbppp
+ * aa : MIT release. Currently 5: Release 5 of X11
+ * bb : An HP major release number. Increments at each major
+ * release of the server.
+ * ppp: Server patch level. Starts at 0, increments every
+ * release of a patched server.
+ *
+ * Numbers to update and when:
+ * VR_MIT_RELEASE : For example, X11 R5, this number is 5.
+ * VR_HP_RELEASE : What we used to use for Vendor Release
+ * Numbers. When a "new" server is release, increment
+ * this number, create a new constant that can be used by
+ * libraries and zero out HP_PATCH_LEVEL.
+ * VR_HP_PATCH_LEVEL : When a patch server is released, increment
+ * this number and leave the others the same.
+ *
+ * Notes:
+ * It is important that HP_VENDOR_RELEASE_NUMBER always increase
+ * when it changes.
+ */
+
+
+ /* Server major release numbers: */
+#define NEXTTRACK_SERVER 0 /* HP-UX 6.2 */
+#define MERGE_SERVER 1 /* HP-UX 6.5 */
+#define REL_70_SERVER 2 /* HP-UX 7.0 */
+#define REL_701_SERVER 3 /* HP-UX 7.05 */
+#define REL_80_SERVER 4 /* HP-UX 8.0 */
+#define REL_807_SERVER 5 /* HP-UX 8.07 (IF2) */
+#define REL_90_SERVER 6 /* HP-UX 9.0 R5 */
+#define REL_903_SERVER 7 /* HP-UX 9.03 R5 */
+#define REL_905_SERVER 8 /* HP-UX 9.05 R5 */
+#define REL_100_SERVER 9 /* HP-UX 10.0 R5 */
+
+
+#define VR_MIT_RELEASE 5
+#ifdef hpV4
+#define VR_HP_RELEASE REL_100_SERVER
+#else
+#define VR_HP_RELEASE REL_905_SERVER
+#endif /* hpV4 */
+#define VR_HP_PATCH_LEVEL 0
+
+#define HP_VRN(mit_release, hp_release, hp_patch_level) \
+ ( (mit_release * 100000) + (hp_release * 1000) + (hp_patch_level) )
+
+#define HP_VENDOR_RELEASE_NUMBER \
+ HP_VRN(VR_MIT_RELEASE, VR_HP_RELEASE, VR_HP_PATCH_LEVEL)
+
+
+ /* And now, some constants that can be used by libraries to check
+ * the release (for example, with a call to CheckHpExtInit()):
+ * Note:
+ * From here (9.0) on out, you (library writers) should be using
+ * these constants.
+ */
+#define VREL_90_SERVER HP_VRN(5, REL_90_SERVER, 0) /* HP-UX 9.0 R5 */
+#define VREL_903_SERVER HP_VRN(5, REL_903_SERVER, 0) /* HP-UX 9.03 R5 */
+
+#endif
diff --git a/xc/programs/Xserver/hw/hp/include/hppriv.h b/xc/programs/Xserver/hw/hp/include/hppriv.h
new file mode 100644
index 000000000..d0e58860e
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/include/hppriv.h
@@ -0,0 +1,111 @@
+/* $TOG: hppriv.h /main/3 1998/02/10 13:10:38 kaleb $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+ * RESTRICTED RIGHTS LEGEND
+ * Use, duplication, or disclosure by the U.S. Government is subject to
+ * restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
+ * Technical Data and Computer Software clause in DFARS 252.227-7013.
+ *
+ * Hewlett-Packard Company
+ * 3000 Hanover Street
+ * Palo Alto, CA 94304 U.S.A.
+ *
+ * Rights for non-DOD U.S. Government Departments and Agencies are as set
+ * forth in FAR 52.227-19(c)(1,2).
+ *
+ *************************************************************************/
+
+/*
+
+Copyright 1987, 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard,
+ Massachusetts
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the names of
+Hewlett-Packard or Digital not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+*/
+
+
+/*
+ * Number of depths that we can possible have on our hardware per
+ * screen in the foreseeable future
+ */
+
+#ifndef MAX_PATH_NAME
+#define MAX_PATH_NAME 256
+#endif /* MAX_PATH_NAME */
+
+#define MAX_DRIVER_NAME 32
+#define MAX_DEPTHS 16
+
+
+/* private field for XOS displays */
+typedef struct _hpPriv {
+
+ /* Start up information from X*screens file */
+ char StandardDevice[MAX_PATH_NAME];
+ char StandardDriver[MAX_DRIVER_NAME];
+ int StandardFd;
+ int StandardNumDepths;
+ int StandardDepths[ MAX_DEPTHS ];
+ Bool StandardDoubleBuffer;
+ int StandardDoubleBufferDepth;
+ int LineNumber;
+ int MonitorDiagonal; /* in units of .001 inches */
+ int depth; /* Device depth. Defaults to 8, */
+ /* can be set via Xnscreens file */
+
+ /* Hooks for the input driver to communicate with the output driver */
+ void (*MoveMouse)();
+ void (*CursorOff)();
+ void (*ChangeScreen)();
+ Bool isSaved;
+} hpPriv;
+
+typedef hpPriv *hpPrivPtr;
diff --git a/xc/programs/Xserver/hw/hp/input/Imakefile b/xc/programs/Xserver/hw/hp/input/Imakefile
new file mode 100644
index 000000000..d9f6a9663
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/Imakefile
@@ -0,0 +1,69 @@
+XCOMM $XConsortium: Imakefile /main/7 1996/09/28 17:12:35 rws $
+#include <Server.tmpl>
+
+#define IHaveSubdirs
+
+SUBDIRS=drivers
+
+SRCS1 = \
+ hpKeyMap.c \
+ x_hil.c \
+ x_hilinit.c \
+ xtest1imp.c \
+ getkeysym.c
+
+
+SRCS2 = \
+ cr16.s \
+ get_tv.c
+
+
+NONHILOBJS = \
+ hpKeyMap.o \
+ xtest1imp.o \
+ getkeysym.o
+
+
+NONHILOBJS2 = \
+ cr16.o \
+ get_tv.o
+
+
+SRCS = $(SRCS1) $(SRCS2)
+
+
+HILOBJS = \
+ x_hil.o \
+ x_hilinit.o
+
+OBJS = $(NONHILOBJS) $(NONHILOBJS2) $(HILOBJS)
+
+LOBJS = \
+ hpKeyMap.ln \
+ x_hil.ln \
+ x_hilinit.ln \
+ xtest1imp.ln \
+ getkeysym.ln
+
+ DEFINES = ExtensionOSDefines -DOSMAJORVERSION=OSMajorVersion
+ LIB_DEFINES = -DLIBDIR=\"$(LIBDIR)\"
+ INCLUDES = -I. -I.. -I../include -I../../../include -I./X11 \
+ -I../../../cfb -I../../../mfb -I../../../mi \
+ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I./drivers
+ LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/hpux/llib-los.ln
+
+all::
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(hp,$(OBJS))
+
+SpecialCObjectRule(x_hilinit,$(ICONFIGFILES),$(LIB_DEFINES))
+SpecialCObjectRule(x_hil,$(ICONFIGFILES),$(LIB_DEFINES))
+SpecialCObjectRule(getkeysym,$(ICONFIGFILES),$(LIB_DEFINES))
+DependTarget()
+
+LintLibraryTarget(hp,$(SRCS1))
+NormalLintTarget($(SRCS1))
diff --git a/xc/programs/Xserver/hw/hp/input/X11/XHPlib.h b/xc/programs/Xserver/hw/hp/input/X11/XHPlib.h
new file mode 100644
index 000000000..2684b8853
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/X11/XHPlib.h
@@ -0,0 +1,757 @@
+/* $XConsortium: XHPlib.h /main/4 1996/12/04 10:23:16 lehors $ */
+/************************************************************
+Copyright (c) 1992 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifndef XHPLIB_H
+#define XHPLIB_H
+
+/* Definitions used by Xlib and the client */
+
+#include "XHPproto.h"
+
+#ifndef _XLIB_H_
+#include <X11/Xlib.h>
+#endif
+#ifndef _XUTIL_H_
+#include <X11/Xutil.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GENERAL_PROMPT 0
+#define PROMPT_1 1
+#define PROMPT_2 2
+#define PROMPT_3 3
+#define PROMPT_4 4
+#define PROMPT_5 5
+#define PROMPT_6 6
+#define PROMPT_7 7
+
+#define GENERAL_ACKNOWLEDGE 0
+#define ACKNOWLEDGE_1 1
+#define ACKNOWLEDGE_2 2
+#define ACKNOWLEDGE_3 3
+#define ACKNOWLEDGE_4 4
+#define ACKNOWLEDGE_5 5
+#define ACKNOWLEDGE_6 6
+#define ACKNOWLEDGE_7 7
+
+#define HPDeviceKeyPressreq 1
+#define HPDeviceKeyReleasereq 2
+#define HPDeviceButtonPressreq 3
+#define HPDeviceButtonReleasereq 4
+#define HPDeviceMotionNotifyreq 5
+#define HPDeviceFocusInreq 6
+#define HPDeviceFocusOutreq 7
+#define HPProximityInreq 8
+#define HPProximityOutreq 9
+#define HPDeviceKeymapNotifyreq 10
+#define HPDeviceMappingNotifyreq 11
+
+extern int HPDeviceKeyPress;
+extern int HPDeviceKeyRelease;
+extern int HPDeviceButtonPress;
+extern int HPDeviceButtonRelease;
+extern int HPDeviceMotionNotify;
+extern int HPDeviceFocusIn;
+extern int HPDeviceFocusOut;
+extern int HPProximityIn;
+extern int HPProximityOut;
+extern int HPDeviceKeymapNotify;
+extern int HPDeviceMappingNotify;
+
+typedef int (*PtrFuncInt) ();
+
+typedef unsigned long XHPFilterId;
+
+/* structure used to split events queue between drivers and client */
+
+typedef struct _XHProutines *_XHPrtnptr;
+
+typedef struct _XHProutines
+ {
+ Display *display;
+ XHPFilterId id;
+ Window window;
+ Mask std_filtermask;
+ Mask std_clientmask;
+ Mask ext_filtermask[MAX_LOGICAL_DEVS];
+ Mask ext_clientmask[MAX_LOGICAL_DEVS];
+ int (*callback) ();
+ int state_info;
+ _XHPrtnptr next;
+ } XHProutines;
+
+typedef struct
+ {
+ XKeyEvent ev;
+ XID deviceid;
+ } XHPDeviceKeyEvent;
+
+/***************************************************************
+ *
+ * The location of the X pointer is reported in the coordinate
+ * fields of the ev member. The location of the device
+ * is determined from the previous DeviceMotionNotify event.
+ *
+ */
+
+typedef struct {
+ XButtonEvent ev;
+ XID deviceid;
+ } XHPDeviceButtonEvent;
+
+/***************************************************************
+ *
+ * The ax_num and ax_val fields contain the data reported by the
+ * device. The values may be absolute or relative. Any axis
+ * whose value changes will be reported.
+ *
+ */
+
+typedef struct
+ {
+ int ax_num;
+ int ax_val;
+ } XHPAxis_data;
+
+/****************************************************************************
+ *
+ * Bug fix for alignment problem on s700/ s800.
+ *
+ * XHPDeviceMotionEvent embeds an XMotionEvent struct. The XMotionEvent
+ * struct contains a char followed by an int. 68k CPUs add one byte of
+ * padding to align the int on a 16-bit boundary. PA-RISC CPUs add three
+ * bytes of padding to align the int on a 32-bit boudary. The result is
+ * that XMotionEvent structs are 58 bytes on 68k CPUs and 60 bytes on
+ * PA-RISC CPUs.
+ *
+ * The size is critical because the XHPScreen_events routine assumes that all
+ * HP input extension events contain a device id in bytes 60 - 63.
+ *
+ * The right way to fix this would be to define a 60-byte
+ * array and make it a union with the ev field, but this would break existing
+ * clients that reference this field.
+ *
+ * Instead we will ifdef the struct to make the padding come out right.
+ * A side effect of this is that on machines with 32-bit alignment, there's
+ * only room for 3 elements in the data array field, since the total XEvent
+ * size is 96 bytes. This is probably ok, since no HP input devices report more
+ * than 3 axes of motion. We will leave the s300 definition at 4 elements,
+ * since it was originally defined that way. We will also put in code to
+ * cause a compiler error for undefined machines.
+ *
+ * Mea culpa, ---gms
+ */
+
+typedef struct
+ {
+#if defined(__hp9000s300) || defined(__apollo) /* 68k aligns to 16 bits */
+ XMotionEvent ev;
+ char pad;
+ unsigned char axes_count;
+ XID deviceid;
+ XHPAxis_data data[4];
+#else
+#if defined(__hp9000s800) || defined(__hp9000s700) /* 32-bit alignment */
+ XMotionEvent ev;
+ XID deviceid;
+ XHPAxis_data data[3];
+ unsigned char axes_count;
+#else
+#if defined(__hp_osf) && defined(__mc68000)
+ XMotionEvent ev;
+ char pad;
+ unsigned char axes_count;
+ XID deviceid;
+ XHPAxis_data data[4];
+#else
+#if defined(__hp_osf) && defined(__pa_risc)
+ XMotionEvent ev;
+ XID deviceid;
+ XHPAxis_data data[3];
+ unsigned char axes_count;
+#else
+This is a bogus line to force a compiler error on undefined machines - gms.
+#endif
+#endif
+#endif
+#endif
+ } XHPDeviceMotionEvent;
+
+typedef struct
+ {
+ XFocusChangeEvent ev;
+ char pad[32];
+ XID deviceid;
+ char pad1[2];
+ } XHPDeviceFocusChangeEvent;
+
+typedef struct
+ {
+ XMappingEvent ev;
+ char pad[28];
+ XID deviceid;
+ char pad1[2];
+ } XHPDeviceMappingEvent;
+
+typedef struct
+ {
+ int type; /* ProximityIn or ProximityOut */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window of event */
+ Window root; /* root window that the event occured on */
+ Window subwindow; /* child window */
+ Time time; /* milliseconds */
+ int x, y; /* pointer x, y coordinates in event window */
+ int x_root, y_root; /* coordinates relative to root */
+ unsigned int state; /* key or button mask */
+ Bool same_screen; /* same screen flag */
+ char pad[4];
+ XID deviceid;
+ char pad1[2];
+ } XHPProximityNotifyEvent;
+typedef XHPProximityNotifyEvent XHPProximityInEvent;
+typedef XHPProximityNotifyEvent XHPProximityOutEvent;
+
+/* generated on EnterWindow and FocusIn when KeyMapState selected */
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window;
+ char key_vector[32];
+ char pad[8];
+ XID deviceid;
+} XHPDeviceKeymapEvent;
+
+typedef struct
+ {
+ char pad[60];
+ XID deviceid;
+ } XHP_AnyEvent;
+
+typedef struct
+ {
+ unsigned int resolution;
+ unsigned short min_val;
+ unsigned short max_val;
+ } XHPaxis_info;
+
+typedef struct
+ {
+ XID x_id;
+ char *name;
+ XHPaxis_info *axes;
+ unsigned short type;
+ unsigned short min_keycode;
+ unsigned short max_keycode;
+ unsigned char hil_id;
+ unsigned char mode;
+ unsigned char num_axes;
+ unsigned char num_buttons;
+ unsigned char num_keys;
+ unsigned char io_byte;
+ unsigned short detailed_id;
+ unsigned char pad[6];
+ } XHPDeviceList;
+
+typedef struct {
+ int key_click_percent;
+ int bell_percent;
+ int bell_pitch;
+ int bell_duration;
+ int led;
+ int led_mode;
+ int key;
+ int auto_repeat_mode; /* On, Off, Default */
+ int accelNumerator;
+ int accelDenominator;
+ int threshold;
+} XHPDeviceControl;
+
+/* Data structure for XHPGetDeviceControl */
+
+typedef struct {
+ int key_click_percent;
+ int bell_percent;
+ unsigned int bell_pitch, bell_duration;
+ unsigned long led_mask;
+ int global_auto_repeat;
+ int accelNumerator;
+ int accelDenominator;
+ int threshold;
+ char auto_repeats[32];
+} XHPDeviceState;
+
+typedef struct {
+ Time time;
+ unsigned short *data;
+} XHPTimeCoord;
+
+
+/* This structure is used to pass Nlio ioctl style commands
+ * to the Nlio server */
+
+#define XNHPNlioctl "HPNlioctl"
+
+typedef struct {
+ int cmd;
+ XPointer arg;
+ int ret;
+} XhpNlioCmd;
+
+/* These are the structures used for the XHPNlioctl call */
+
+typedef struct {
+ int flags;
+ KeySym invoke_nlio;
+ KeySym terminate_nlio;
+ KeySym set_alternate;
+ KeySym unset_alternate;
+} K16_state;
+
+/* These are the commands for the XHPNlioctl call */
+#include <sys/ioctl.h>
+#define K16_FOCUS_IN _IO('X', 100)
+#define K16_FOCUS_OUT _IO('X', 101)
+
+#define K16_EXEC_PROC 1
+#define K16_KILL_PROC 2
+#define K16_GET_STATEKEYS 3
+#define K16_SET_STATEKEYS 4
+#define K16_ALT_ON 5
+#define K16_NLIO_ON 6
+#define K16_IS_PROC 7
+#define K16_GET_ENCODING 8
+#define K16_SET_ENCODING 9
+
+#define K16_NLIOSTATE 1
+#define K16_ALTSTATE 2
+
+ /* The following block of defines are required for XHPSetKeyboardMapping,
+ * the server and other things that use XHPKeymaps.
+ */
+#ifdef hpV4
+#define DEF_DIRECTORY "/etc/X11/"
+#else
+#define DEF_DIRECTORY "/usr/lib/X11/"
+#endif /* hpV4 */
+
+#define SHL_DIRECTORY "/usr/lib/X11/"
+#define DEF_FILENAME "XHPKeymaps"
+
+#define VERIFY_MAGIC "HPKeyMap Rev 1.0"
+#define MAGIC_SIZE 20 /* sizeof(VERIFY_MAGIC) + some slop */
+
+struct XHP_keymap_header {
+ int kbd;
+ int offset;
+ int size;
+};
+
+#define HPK_KEYDEVICE_NAME_TABLE_ID 19998
+#define HPK_MODMAP_TABLE_ID 19999
+#define HPK_FIRST_RESERVED_ID 20000
+
+typedef struct
+{
+ int keydevice_id, min_keycode, max_keycode, columns;
+ char *name, *modmap_name;
+} HPKKeyDeviceInfo;
+
+#define MODMAP_SIZE 256 /* aka MAP_LENGTH in server/include/input.h */
+
+typedef struct
+{
+ char *modmap_name;
+ CARD8 modmap[MODMAP_SIZE];
+} HPKModMap;
+
+
+/* Error values returned by XHPSetKeyboardMapping */
+
+#define XHPKB_NOKEYFILE 1
+#define XHPKB_BADMAGIC 2
+#define XHPKB_BADKBID 3
+#define XHPKB_NONHPINPUTDEV 4
+#define XHPKB_NOMEM 5
+
+/* In the following list, several of the constants have duplicate names.
+ The duplicate names were added to provide a consistent name for the
+ tokens (i.e. each name represents a language). The original version
+ mixed country names and language names. */
+
+#define KB_US_English 0 /* For use with HP46021A */
+#define KB_Latin_Spanish 1 /* For use with HP46021AM */
+#define KB_Katakana 2 /* For use with HP46021AJ */
+#define KB_Danish 3 /* For use with HP46021AY */
+#define KB_French 4 /* For use with HP46021AF */
+#define KB_Norwegian 5 /* For use with HP46021AN */
+#define KB_Swiss_German 6 /* For use with HP46020AP
+ : HIL-ID(lower 5 bits)=19h */
+#define KB_Canada_French 7 /* For use with HP46021AC */
+#define KB_UK_English 8 /* For use with HP46021AU */
+#define KB_Finnish 9 /* For use with HP46021AX */
+#define KB_Belgian 10 /* For use with HP46021AW */
+#define KB_Swiss_German2 11 /* For use with HP46021AP */
+#define KB_Euro_Spanish 12 /* For use with HP46021AE */
+#define KB_Swiss_French2 13 /* For use with HP46021AQ */
+#define KB_T_Chinese 14 /* Trad. Chinese (ROC): For HP46021W#ZAA */
+#define KB_S_Chinese 15 /* Simp. Chinese (PROC): For HP40621W#ZAC */
+#define KB_German 16 /* For use with HP46021AD */
+#define KB_Swedish 17 /* For use with HP46021AS */
+#define KB_Dutch 18 /* For use with HP46021AH */
+#define KB_Korean 19 /* Korean: For HP40621W#ZAB */
+#define KB_Italian 20 /* For use with HP46021AZ */
+#define KB_Canada_English 21 /* For use with HP46021AL */
+#define KB_Swiss_French 22 /* For use with HP46020AQ
+ : HIL-ID(lower 5 bits)=03h */
+#define KB_Japanese 23 /* For use with HP46021W#ZAL */
+
+ /* ITF ethereal keyboards */
+#define KB_Hebrew 100 /* Hebrew Keymap - NO KEYBOARD */
+#define KB_Cyrillic 101 /* Cyrillic Keymap - NO KEYBOARD */
+#define KB_Czech 102 /* Czech Keymap - NO KEYBOARD */
+#define KB_Hungarian 103 /* Hungarian Keymap - NO KEYBOARD */
+#define KB_SerboCroatian 104 /* SerboCroatian Keymap - NO KEYBOARD */
+#define KB_Polish 105 /* Polish Keymap - NO KEYBOARD */
+#define KB_Romanian 106 /* Romanian Keymap - NO KEYBOARD */
+#define KB_Rumanian 106 /* alternate spelling */
+#define KB_Turkish 107 /* Turkey Keymap - NO KEYBOARD */
+#define KB_Greek 108 /* Greek Keymap - NO KEYBOARD */
+#define KB_Arabic 109 /* Arabic Keymap - NO KEYBOARD */
+
+
+ /* PS2 ethereal keyboards (which may never exist) */
+#define KB_PS2_Hebrew 150 /* Hebrew Keymap - NO KEYBOARD */
+#define KB_PS2_Cyrillic 151 /* Cyrillic Keymap - NO KEYBOARD */
+#define KB_PS2_Czech 152 /* Czech Keymap - NO KEYBOARD */
+#define KB_PS2_Hungarian 153 /* Hungarian Keymap - NO KEYBOARD */
+#define KB_PS2_SerboCroatian 154 /* SerboCroatian Keymap - NO KEYBOARD */
+#define KB_PS2_Polish 155 /* Polish Keymap - NO KEYBOARD */
+#define KB_PS2_Romanian 156 /* Romanian Keymap - NO KEYBOARD */
+#define KB_PS2_Rumanian 156 /* alternate spelling */
+#define KB_PS2_Turkish 157 /* Turkey Keymap - NO KEYBOARD */
+#define KB_PS2_Greek 158 /* Greek Keymap - NO KEYBOARD */
+#define KB_PS2_Arabic 159 /* Arabic Keymap - NO KEYBOARD */
+
+/* ******************** HP hil PS2 keyboards *************** */
+
+#define KB_PS2_US_English 60
+#define KB_PS2_Latin_Spanish 61
+#define KB_PS2_Katakana 62
+#define KB_PS2_Danish 63
+#define KB_PS2_French 64
+#define KB_PS2_Norwegian 65
+#define KB_PS2_Swiss_German 66
+#define KB_PS2_Canada_French 67
+#define KB_PS2_UK_English 68
+#define KB_PS2_Finnish 69
+#define KB_PS2_Belgian 70
+#define KB_PS2_Swiss_German2 71
+#define KB_PS2_Euro_Spanish 72
+#define KB_PS2_Swiss_French2 73
+#define KB_PS2_T_Chinese 74
+#define KB_PS2_S_Chinese 75
+#define KB_PS2_German 76
+#define KB_PS2_Swedish 77
+#define KB_PS2_Dutch 78
+#define KB_PS2_Korean 79
+#define KB_PS2_Italian 80
+#define KB_PS2_Canada_English 84
+#define KB_PS2_Swiss_French 88
+#define KB_PS2_Japanese 89
+#define KB_JIS_Japanese 90
+
+#define KB_NULL 201 /* Device that needs a null keymap, modmap */
+#define KB_BUTTON_BOX 202 /* HP button box(es) */
+#define KB_BARCODE_WAND 203 /* HP barcode reader */
+
+#define KB_HPUNSUPP -1 /* For unsupported HP keyboards */
+#define KB_NONHP -2 /* For non-HP keyboards (for internal use) */
+
+typedef int KEYBOARD_ID;
+
+/* Function definitions for clients. */
+
+Status XHPSetKeyboardMapping();
+
+/* End of entries required for XHPSetKeyboardMapping. */
+
+typedef struct {
+ unsigned char * iso7to8;
+ unsigned char * iso8to7;
+ char ** mute8to7;
+ unsigned int mutekey;
+} _XHP_transptrs;
+
+#define _XHP_ISO7To8(status,index) \
+ ((_XHP_transptrs *) ((status)->compose_ptr)) -> iso7to8 [index]
+
+#define _XHP_ISO8To7(status,index) \
+ ((_XHP_transptrs *) ((status)->compose_ptr)) -> iso8to7 [index]
+
+#define _XHP_MUTE8To7(status,index) \
+ ((_XHP_transptrs *) ((status)->compose_ptr)) -> mute8to7[index-128]
+
+#define XHPInputInit(dpy,status) XHPNlioctl(dpy,status,K16_EXEC_PROC)
+
+#define XHPSetKbdMapInit(dpy,kbd,frc,status) \
+ { \
+ XHPNlioctl(dpy,status,K16_KILL_PROC); \
+ XHPSetKeyboardMapping(dpy,kbd,frc); \
+ XHPNlioctl(dpy,status,K16_EXEC_PROC); \
+ }
+
+/* These are the tags in the compose structure for the different convert
+ * routines
+ */
+
+#define _XHP_INP_NLIO 0x81000000
+#define _XHP_INP_ROM8 0x82000000
+#define _XHP_INP_7SUB 0x84000000
+
+/* Function definitions for client programs */
+
+PtrFuncInt XHPSetErrorHandler();
+XFontStruct *XHPGet16bitMixedFontStruct();
+
+extern PtrFuncInt XHPGetEurasianCvt(
+ Display *dpy) ;
+extern int XGetHpKeyboardId(
+ register Display *dpy,
+ unsigned char *kbd_id) ;
+extern int XHPAcknowledge(
+ register Display *dpy,
+ XID device,
+ int ack) ;
+extern int XHPDeviceAutoRepeatOff(
+ register Display *dpy,
+ XID device) ;
+extern int XHPDeviceAutoRepeatOn(
+ register Display *dpy,
+ XID device,
+ int rate) ;
+extern int XHPChangeDeviceControl(
+ register Display *dpy,
+ XID deviceid,
+ unsigned long mask,
+ XHPDeviceControl *vlist) ;
+extern int XHPChangeDeviceKeyMapping(
+ register Display *dpy,
+ XID deviceid,
+ int first,
+ int syms_per_code,
+ KeySym *keysyms,
+ int count) ;
+extern int XHPDisableReset(
+ register Display *dpy );
+extern int XHPDisableReset(
+ register Display *dpy );
+extern int XHPFreeDeviceList(
+ XHPDeviceList *list) ;
+extern XHPTimeCoord * XHPGetDeviceMotionEvents(
+ register Display *dpy,
+ XID deviceid,
+ Window window,
+ Time start,
+ Time stop,
+ int *nEvents) ;
+extern KeySym * XHPGetDeviceKeyMapping(
+ register Display *dpy,
+ XID deviceid,
+ KeyCode first,
+ int keycount,
+ int *syms_per_code) ;
+extern XModifierKeymap * XHPGetDeviceModifierMapping(
+ register Display *dpy,
+ XID deviceid) ;
+extern int XHPGetServerMode(
+ register Display *dpy,
+ register int screen) ;
+extern int XHPGrabDeviceButton(
+ register Display *dpy,
+ XID device,
+ unsigned int button,
+ unsigned int modifiers,
+ Window grab_window,
+ Bool owner_events,
+ unsigned int event_mask,
+ int pointer_mode,
+ int keyboard_mode) ;
+extern int XHPGrabDeviceKey(
+ register Display *dpy,
+ XID device,
+ unsigned int key,
+ unsigned int modifiers,
+ Window grab_window,
+ Bool owner_events,
+ int pointer_mode,
+ int keyboard_mode) ;
+extern int XHPGrabReset(
+ register Display *dpy,
+ Atom *type) ;
+extern int XHPGrabDevice(
+ register Display *dpy,
+ XID id,
+ Window window,
+ Bool ownerEvents,
+ int pointer_mode,
+ int device_mode,
+ Time time) ;
+extern int XHPGetCurrentDeviceMask(
+ register Display *dpy,
+ Window w,
+ XID device,
+ Mask *mask) ;
+extern int XHPGetExtEventMask(
+ register Display *dpy,
+ long evconst,
+ int *type,
+ Mask *mask) ;
+extern int XHPGetDeviceFocus(
+ register Display *dpy,
+ XID deviceid,
+ Window *focus,
+ int *revert_to) ;
+extern int XHPGetDeviceControl(
+ register Display *dpy,
+ XID deviceid,
+ XHPDeviceState *values) ;
+extern XHPDeviceList * XHPListInputDevices(
+ register Display *dpy,
+ int *ndevices) ;
+extern int XHPPrompt(
+ register Display *dpy,
+ XID device,
+ int prompt) ;
+extern XHPFilterId XHPRegisterEventFilter(
+ register Display *dpy,
+ Window window,
+ int device,
+ Mask mask,
+ int (*routine)(),
+ int state_info) ;
+extern int XHPSetInputDevice(
+ register Display *dpy,
+ register XID id,
+ register int mode) ;
+extern int XHPSelectExtensionEvent(
+ register Display *dpy,
+ Window w,
+ XID device,
+ Mask mask) ;
+extern int XHPUngrabDevice(
+ register Display *dpy,
+ XID device,
+ Time time) ;
+extern int XHPUngrabDeviceButton(
+ register Display *dpy,
+ XID device,
+ unsigned int button,
+ unsigned int modifiers,
+ Window grab_window) ;
+extern int XHPUngrabDeviceKey(
+ register Display *dpy,
+ XID device,
+ unsigned int key,
+ unsigned int modifiers,
+ Window grab_window) ;
+extern int XHPSetDeviceFocus(
+ register Display *dpy,
+ XID deviceid,
+ Window focus,
+ int revert_to,
+ Time time) ;
+extern int XHPSetDeviceModifierMapping(
+ register Display *dpy,
+ XID deviceid,
+ XModifierKeymap *modmap) ;
+extern Cursor XHPGetWindowCursor(
+ register Display *dpy,
+ Window window) ;
+extern int XHPConvertLookup(
+ register XKeyEvent *event,
+ char *buffer,
+ int nbytes,
+ KeySym *keysym,
+ XComposeStatus *status,
+ int (*convert_routine)()) ;
+extern int input_isolatin1(
+ KeySym keysym,
+ int modifiers,
+ char *buffer_return,
+ int bytes_buffer,
+ XComposeStatus *status_in_out) ;
+extern KEYBOARD_ID XHPGetKeyboardID(
+ Display *dpy) ;
+extern void XHPUpdateKIDList(
+ Display *dpy,
+ KEYBOARD_ID kbd_id) ;
+extern KEYBOARD_ID XHPGetCvtLang(
+ Display *dpy) ;
+extern KEYBOARD_ID XHPGetHILandCvt(
+ Display *dpy) ;
+extern int _XHPInitKbdState(
+ Display *dpy) ;
+extern int _XHP_alt_on(
+ Display *dpy) ;
+extern void _XHP_GetAltKeys(
+ Display *dpy,
+ K16_state *state) ;
+extern void _XHP_SetAltKeys(
+ Display *dpy,
+ K16_state *state) ;
+extern int _XHPIgnoreLang(
+ int value) ;
+extern int XHPInputRoman8(
+ Display *display,
+ KeySym *keysym,
+ int modifiers,
+ unsigned char *buffer_return,
+ int bytes_buffer,
+ register XComposeStatus *status_in_out) ;
+extern int XHPInputLatin1(
+ Display *display,
+ register KeySym *keysym,
+ int modifiers,
+ unsigned char *buffer_return,
+ int bytes_buffer,
+ register XComposeStatus *status_in_out) ;
+extern int XHPInputISO8859_8(
+ Display *display,
+ KeySym *keysym,
+ unsigned int modifiers,
+ char *buffer_return,
+ int bytes_buffer,
+ XComposeStatus *status_in_out) ;
+#ifdef __cplusplus
+} /* Close scope of 'extern "C"' declaration that encloses file */
+#endif /* __cplusplus */
+#endif /* XHPLIB_H */
diff --git a/xc/programs/Xserver/hw/hp/input/cr16.s b/xc/programs/Xserver/hw/hp/input/cr16.s
new file mode 100644
index 000000000..a367a7980
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/cr16.s
@@ -0,0 +1,12 @@
+; $XConsortium: cr16.s,v 1.2 95/06/15 15:25:19 dpw Exp $
+ .SPACE $TEXT$
+ .SUBSPA $CODE$
+ .export cr16
+ .PROC
+ .CALLINFO
+ .ENTRY
+cr16
+ bv (%rp)
+ mfctl 16,%ret0
+ .EXIT
+ .PROCEND
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/Imakefile b/xc/programs/Xserver/hw/hp/input/drivers/Imakefile
new file mode 100644
index 000000000..e87ed43f9
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/Imakefile
@@ -0,0 +1,36 @@
+XCOMM $XConsortium: Imakefile /main/5 1996/12/26 09:00:56 kaleb $
+
+#include <Server.tmpl>
+
+.c.o:
+ $(RM) $@
+ $(CC) -c $(CFLAGS) $(PICFLAGS) $*.c
+
+DRVRLIBDIR = $(LIBDIR)/extensions
+PICFLAGS = PositionIndependentCFlags
+SRCS = hp7lc2k.c hp7lc2m.c hil_driver.c
+INCLUDES = -I. -I.. -I../../../../../../include \
+ -I../../../../../../include/extensions
+
+#define DriverTarget(name) @@\
+AllTarget(name.sl) @@\
+ @@\
+name.sl: name.o @@\
+ $(RM) $@~ @@\
+ $(LD) -o $@~ -b name.o @@\
+ chmod a-w $@~ @@\
+ $(RM) $@ @@\
+ $(MV) $@~ $@ @@\
+ @@\
+InstallTarget(install,name.sl,$(INSTPGMFLAGS),$(DRVRLIBDIR)) @@\
+InstallTarget(install,XHPKeymaps,$(INSTPGMFLAGS),$(LIBDIR)) @@\
+InstallTarget(install,X0screens,$(INSTPGMFLAGS),$(LIBDIR)) @@\
+ @@\
+clean:: @@\
+ $(RM) name.sl
+
+DriverTarget(hp7lc2k)
+DriverTarget(hp7lc2m)
+DriverTarget(hil_driver)
+
+DependTarget()
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/X0screens b/xc/programs/Xserver/hw/hp/input/drivers/X0screens
new file mode 100644
index 000000000..793b022f0
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/X0screens
@@ -0,0 +1,3 @@
+# $XConsortium: X0screens,v 1.1 95/01/23 21:56:39 dpw Exp $
+
+/dev/crt
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps b/xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps
new file mode 100644
index 000000000..6b0aeb9f6
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/XHPKeymaps
Binary files differ
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/hil_driver.c b/xc/programs/Xserver/hw/hp/input/drivers/hil_driver.c
new file mode 100644
index 000000000..0ee8a6559
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/hil_driver.c
@@ -0,0 +1,3584 @@
+/* $XConsortium: hil_driver.c,v 1.2 95/01/25 17:24:43 gildea Exp $ */
+/************************************************************
+
+Copyright (c) 1993 by Hewlett-Packard Company, Palo Alto, California
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+/*
+cc -DTEST -g hil_driver.c -Aa -D_HPUX_SOURCE -I.. -I/usr/include/X11R5/X11 -I/usr/include/X11R5/X11/extensions
+
+cc +z -c -O hil_driver.c -Aa -D_HPUX_SOURCE -I.. -I/usr/include/X11R5/X11 -I/usr/include/X11R5/X11/extensions
+ld -b hil_driver.o -o hil_driver.sl
+cp hil_driver.sl /usr/lib/X11/extensions
+
+In /etc/X11/X0devices:
+ first NULL keyboard
+ Begin_Device_Description
+ name hil_driver.sl
+ use keyboard
+ path keyboard
+ End_Device_Description
+
+ Begin_Device_Description
+ name hil_driver.sl
+ use pointer
+ path mouse
+ End_Device_Description
+
+ */
+
+static char what[] = "@(#)hil_driver : HIL device driver for X v1.0";
+#define WHAT (&what[4])
+
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/hilioctl.h>
+#include "x_serialdrv.h"
+#include "X.h"
+#include "XI.h"
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+#define XOTHER 2 /* not defined in XI.h */
+#define XEXTENSION 3 /* not defined in XI.h */
+
+#define XPTR_USE (1<<XPOINTER)
+#define XKBD_USE (1<<XKEYBOARD)
+#define XOTH_USE (1<<XOTHER)
+#define XEXT_USE (1<<XEXTENSION)
+#define EXPLICIT 0x80
+
+
+/* ******************************************************************** */
+/* ******************* Misc Routines and Constants ******************** */
+/* ******************************************************************** */
+
+static int imin(a,b) register int a,b; { return (a < b) ? a : b; }
+static int imax(a,b) register int a,b; { return (a > b) ? a : b; }
+
+static void uppercase(str) char *str; /* convert str to upper case */
+ { for (; *str; str++) *str = toupper(*str); }
+
+#define NITEMS(array) (sizeof(array)/sizeof(array[0]))
+
+static int remap[] = {0,1,4,5,2,3,6,7,8,9,10,11,12,13,14,15};
+
+static char *h_position[] =
+{
+ "FIRST",
+ "SECOND",
+ "THIRD",
+ "FOURTH",
+ "FIFTH",
+ "SIXTH",
+ "SEVENTH",
+ "EIGHTH",
+ "NINTH",
+ "TENTH",
+ "ELEVENTH",
+ "TWELFTH",
+ "THIRTEENTH",
+ "FOURTEENTH",
+ "FIFTEENTH",
+ "SIXTEENTH",
+ "SEVENTEENTH",
+ "EIGHTEENTH",
+ "NINETEENTH",
+ "TWENTIETH",
+ "LAST"
+};
+
+/* ******************************************************************** */
+/* ************************** HIL Constants *************************** */
+/* ******************************************************************** */
+
+typedef struct
+{
+ int hil_id_low, hil_id_high;
+ char *X_name;
+ int dev_type, x_type;
+ int (*read_device)();
+ int reverse_y_axes;
+ int (*write_device)();
+} HIL_DeviceType;
+
+#define NULL_DEVICE 0
+#define MOUSE 1
+#define TABLET 2
+#define KEYBOARD 3
+#define QUADRATURE 4
+#define TOUCHSCREEN 5
+#define TOUCHPAD 6
+#define BUTTONBOX 7
+#define BARCODE 8
+#define ONE_KNOB 9
+#define TRACKBALL 10
+#define KEYPAD 11
+#define NINE_KNOB 12
+#define ID_MODULE 13
+
+#ifdef DEBUG
+#define ONE_AXIS 14
+#define NO_IOB_REL 15
+#define ERROR_DEVICE 16
+#define NO_AXES 17
+#define THREE_AXES 18
+#define XI_ONE_AXIS "ONE_AXIS"
+#define XI_NO_IOB_REL "NO_IOB_REL"
+#define XI_ERROR_DEVICE "ERROR_DEVICE"
+#define XI_NO_AXES "NO_AXES"
+#define XI_THREE_AXES "THREE_AXES"
+#endif /* DEBUG */
+
+
+#define NINE_KNOB_ID 0x61
+#define QUAD_ID 0x62 /* one of the quadrature ids */
+
+static int
+ read_keyboard(), read_nothing(), read_mouse(), read_barcode(),
+ write_keyboard(), write_nothing();
+
+ /* Notes:
+ * Only support button boxes with HIL ids of 0x30. Ignore the
+ * rest of them because I don't think they exist.
+ */
+static HIL_DeviceType devices[] =
+{
+ { /* !!!??? */ /* This MUST remain the first device in this list! */
+ -1,-1, "NULL", NULL_DEVICE, XOTHER,
+ read_nothing, FALSE, write_nothing,
+ },
+ {
+ 0x30,0x30, XI_BUTTONBOX, BUTTONBOX, KEYBOARD,
+ read_keyboard, TRUE, write_keyboard,
+ },
+ {
+ 0x34,0x34, XI_ID_MODULE, ID_MODULE, KEYBOARD,
+ read_nothing, FALSE, write_nothing,
+ },
+ {
+ 0x5c,0x5f, XI_BARCODE, BARCODE, KEYBOARD,
+ read_barcode, FALSE, write_nothing,
+ },
+ {
+ 0x60,0x60, XI_ONE_KNOB, ONE_KNOB, MOUSE,
+ read_mouse, FALSE, write_nothing,
+ },
+ {
+ 0x61,0x61, XI_NINE_KNOB, NINE_KNOB, MOUSE,
+ read_mouse, FALSE, write_nothing,
+ },
+ {
+ 0x62,0x67, XI_QUADRATURE, QUADRATURE, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x68,0x6b, XI_MOUSE, MOUSE, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x6c,0x6f, XI_TRACKBALL, TRACKBALL, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+#ifdef DEBUG
+ {
+ 0x70,0x70, XI_ONE_AXIS, ONE_AXIS, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x71,0x71, XI_NO_IOB_REL, NO_IOB_REL, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x72,0x72, XI_MOUSE, MOUSE, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x73,0x73, XI_ERROR_DEVICE, ERROR_DEVICE, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x74,0x74, XI_NO_AXES, NO_AXES, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+ {
+ 0x75,0x75, XI_THREE_AXES, THREE_AXES, MOUSE,
+ read_mouse, TRUE, write_nothing,
+ },
+#endif /* DEBUG */
+ {
+ 0x8c,0x8f, XI_TOUCHSCREEN, TOUCHSCREEN, MOUSE,
+ read_mouse, FALSE, write_nothing,
+ },
+ {
+ 0x90,0x97, XI_TABLET, TABLET, MOUSE,
+ read_mouse, FALSE, write_nothing,
+ },
+ {
+ 0xC0,0xDF, XI_KEYBOARD, KEYBOARD, KEYBOARD,
+ read_keyboard, FALSE, write_keyboard,
+ },
+};
+
+
+ /* HIL Poll Header bits: */
+#define KEY_DATA_MASK 0x70
+#define MOTION_MASK 0x0F /* !!!??? 0x3??? */
+#define MOTION_Y 0x02 /* Axes Y reporting */
+#define MOTION_XY 0x02 /* Axes X and Y reporting */
+#define MOTION_XYZ 0x03 /* Axes X, Y and Z reporting */
+
+#define KEY_DOWN(key) ((key) & ~1)
+#define KEY_UP(key) ((key) | 1)
+#define KEY_IS_DOWN(key) (0 == ((key) & 1)) /* down is even */
+#define KEY_IS_UP(key) !KEY_IS_DOWN(key)
+
+#define BUTTON_BASE 0x80 /* buttons are keys 0x80 - 0x8D */
+#define BUTTON_MAX 0x8D /* buttons are keys 0x80 - 0x8D */
+#define BUTTON_DOWN(button) KEY_DOWN(button) /* same as keys */
+#define BUTTON_UP(button) KEY_UP(button) /* same as keys */
+#define BUTTON_IS_DOWN(button) KEY_IS_DOWN(button) /* same as keys */
+#define BUTTON_IS_UP(button) KEY_IS_UP(button) /* same as keys */
+#define NEXT_BUTTON(button) (BUTTON_DOWN(button) + 2)
+#define REDUCE_BUTTON(button) ((button) / 2)
+#define EXPAND_BUTTON(button) ((button) * 2)
+#define HIL_TO_BUTTON(hil,type,buttons) ((type==TABLET && buttons==4) ? \
+ remap[((hil) - BUTTON_BASE)] : ((hil) - BUTTON_BASE))
+#define PROXIMITY_IN 0x0E /* Actually 0x8E */
+#define PROXIMITY_OUT 0x0F /* Actually 0x8F */
+#define BUTTON_BIT(button) (1 << REDUCE_BUTTON(button))
+#define BUTTON_IS_LATCHED(d,button) (d->kb_latched & (BUTTON_BIT(button)))
+#define BUTTON_IS_IGNORED(d,button) (d->kb_ignore & (BUTTON_BIT(button)))
+#define IGNORE_BUTTON(d,button) (d->kb_ignore |= (BUTTON_BIT(button)))
+#define UNIGNORE_BUTTON(d,button) (d->kb_ignore &= ~(BUTTON_BIT(button)))
+
+
+#define HIL_ABSOLUTE 0x40 /* Device has absolute positioning data */
+#define HIL_16_BITS 0x20 /* Device has position data 16 bit accuracy */
+#define HIL_IOB 0x10 /* Device has I/O description byte */
+#define HIL_NUM_AXES 0x03 /* Number of axes supported */
+
+#define HAS_LEDS 0xf0 /* Device has leds */
+#define HILIOB_PAA 0x80 /* Device supports prompt and acknowledge */
+#define HILIOB_NPA 0x70 /* Number of prompts & acknowledges supported */
+#define HILIOB_PIO 0x08 /* Device supports Proximity In/Out */
+#define HILIOB_BUTTONS 0x07 /* Number of buttons on device */
+#define HP_HIL 0x40
+#define HP_ITF_KBD 0x01
+#define PC101_KBD 0x02
+
+
+/* ******************************************************************** */
+/* ****************** Convert HIL ID to Keymap Name ******************* */
+/* ******************************************************************** */
+
+ /*
+ * Notes:
+ * See the manual on using hp-hil devices with HP-UX for the keyboard
+ * nationality codes; they are the low order 6 bits of the device
+ * id; 0x1f is United States, so we'll subtract from 0x1f to give
+ * the U.S. a keyId of zero; The PS2 keyboards have hil ids E0-FF.
+ * 6 bits == a max of 64 different keyboards. 32 extended and 32 PS2.
+ * George says to use 7 bits: HIL ids in the range A0-FF.
+ * A0-BF Compressed keyboard. Not used (yet).
+ * C0-DF Extended (ITF) keyboard
+ */
+static char *hil_id_to_keymap(hil_id, might_be_PS2) int hil_id, might_be_PS2;
+{
+ static char *base_table[] =
+ {
+ "31", /* HIL=00h Undefined keyboard */
+ "HIL_JIS", /* HIL=01h Undefined keyboard */
+ "Japanese", /* HIL=02h */
+ "Swiss_French", /* HIL=03h */
+ "29", /* HIL=04h No keysym support for Portugues */
+ "28", /* HIL=05h No keysym support for Arabic */
+ "27", /* HIL=06h No keysym support for Hebrew */
+ "Canada_English", /* HIL=07h */
+ "26", /* HIL=08h No keysym support for Turkish */
+ "25", /* HIL=09h No keysym support for Greek */
+ "24", /* HIL=0Ah No keysym support for Thai */
+ "Italian", /* HIL=0Bh */
+ "Korean", /* HIL=0Ch */
+ "Dutch", /* HIL=0Dh */
+ "Swedish", /* HIL=0Eh */
+ "German", /* HIL=0Fh */
+ "S_Chinese", /* HIL=10h */
+ "T_Chinese", /* HIL=11h */
+ "Swiss_French2", /* HIL=12h */
+ "Euro_Spanish", /* HIL=13h */
+ "Swiss_German2", /* HIL=14h */
+ "Belgian", /* HIL=15h */
+ "Finnish", /* HIL=16h */
+ "UK_English", /* HIL=17h */
+ "Canada_French", /* HIL=18h */
+ "Swiss_German", /* HIL=19h */
+ "Norwegian", /* HIL=1Ah */
+ "French", /* HIL=1Bh */
+ "Danish", /* HIL=1Ch */
+ "Katakana", /* HIL=1Dh */
+ "Latin_Spanish", /* HIL=1Eh */
+ "US_English", /* HIL=1Fh */
+ };
+
+ if (hil_id == 0x30) return "HP46086A_Button_Box";
+
+ if (hil_id == 0x5c) return "ITF_US_English"; /* Barcode reader */
+
+ if (hil_id == 0x34) return "ITF_US_English"; /* ID Module */
+
+ if (0xC0 <= hil_id && hil_id <= 0xDF) /* Keyboard: 0xC0 - 0xDF */
+ {
+ static char buf[32];
+
+ if (might_be_PS2) strcpy(buf, "PS2_");
+ else strcpy(buf, "ITF_");
+ strcat(buf, base_table[hil_id & 0x1f]); /* 0 - 31 */
+ return buf;
+ }
+
+ /* A device that is not a key device, is unknown or not yet supported
+ * (such as a nonkbd device (like the ID module)) or Standard or
+ * Compressed keyboards.
+ */
+ return "";
+}
+
+/* ******************************************************************** */
+/* ************************ General HIL stuff ************************* */
+/* ******************************************************************** */
+
+#define MAX_HIL_BUTTONS 7
+
+typedef struct
+{
+ /* Stuff for all devices */
+ HIL_DeviceType *device;
+ char
+ long_name[50], /* eg FIRST_KEYBOARD, SECOND_POINTER, etc */
+ keymap[30], /* "" or the keymap name */
+ file_name[100]; /* "/dev/hil1", "/tmp/foo", etc */
+ int
+ fd, /* File descriptor */
+ hil_id, use_as,
+ data_size, /* DATA_IS_16_BITS, etc */
+ num_axes, /* number of axes (motion only) */
+ error; /* for device specific error handling */
+ unsigned char
+ *ptr; /* for whatever */
+
+ /* Motion device specific stuff */
+ int
+ res_x, res_y, /* counts / meter for x and y axis */
+ max_x, max_y, /* maximum x and y value */
+ latching_enabled, /* 0 if not enabled */
+ latching_on, /* 0 if not on */
+ chording_interval, /* 0 if not chording */
+ /* Button chording state variables*/
+ chorded_button_up,
+ ignore_button1, ignore_button2;
+ char
+ kb_latched,
+ kb_ignore,
+ ignored_buttons, /* bit 1 for ignore_button1, etc */
+ button_down[MAX_HIL_BUTTONS]; /* TRUE if button n is down */
+
+ unsigned char
+ device_exists, /* TRUE if device exists and is openable */
+ flags, /* device characteristics */
+ iob, /* I/O descriptor Byte */
+ num_buttons, /* count of physical buttons */
+ num_keys, /* number of keys */
+ num_leds; /* number of leds */
+} HIL_Device;
+
+
+ /*
+ * Notes:
+ * The nine knob box has the same HIL id as the quadrature port.
+ * The nine knob box is 3 HIL devices, each with 3 axes of motion.
+ */
+static int stat_device(ptr, fd) HIL_Device *ptr;
+{
+ unsigned char describe[32];
+ int i, id, num_axes;
+
+ memset(ptr, 0, sizeof(HIL_Device)); /* */
+
+ if (-1 == ioctl(fd, HILID, describe)) /* hopefully the NULL device */
+ return FALSE;
+
+ id = describe[0];
+#if 0
+ printf("fd is %d errno is %d id is %x\n", fd, errno, id); /* */
+#endif
+
+ num_axes = (describe[1] & HIL_NUM_AXES);
+ if (id == NINE_KNOB_ID && num_axes != 3) id = QUAD_ID;
+
+ for (i = 0; i < NITEMS(devices); i++)
+ {
+ HIL_DeviceType *device = &devices[i];
+ int iob;
+
+ if (id < device->hil_id_low || device->hil_id_high < id) continue;
+
+ ptr->device = device;
+
+ ptr->hil_id = id;
+ ptr->flags = describe[1];
+ ptr->num_axes = num_axes;
+
+ ptr->data_size = DATA_IS_8_BITS;
+
+ iob = 0;
+
+ /* If # of axes (of motion) indicate it is a positional device then
+ * gather resolution.
+ * If 16 bits of information are reported, resolution is in
+ * counts/cm. In this case, convert to counts/meter.
+ */
+ if (num_axes)
+ {
+ int lo_resol = describe[2], hi_resol = describe[3];
+
+ ptr->res_x = ptr->res_y = ((hi_resol << 8) + lo_resol);
+
+ if (ptr->flags & HIL_16_BITS)
+ {
+ ptr->data_size = DATA_IS_16_BITS;
+ ptr->res_x = ptr->res_y = (ptr->res_x * 100);
+ }
+
+ /* If it is an absolute device, gather size */
+ if (ptr->flags & HIL_ABSOLUTE)
+ {
+ switch(num_axes)
+ {
+ case 2:
+ ptr->max_y = (int)describe[6] | ((int)describe[7] << 8);
+ /* FALLTHOUGH */
+ case 1:
+ ptr->max_x = (int)describe[4] | ((int)describe[5] << 8);
+ }
+ iob = describe[4 + 2 * num_axes];
+ }
+ else
+ {
+ if (ptr->flags & HIL_IOB) iob = describe[4];
+ }
+ }
+ else /* Not a motion device */
+ {
+ if (ptr->flags & HIL_IOB) iob = describe[2];
+ ptr->res_x = ptr->res_y = 0;
+ }
+
+ ptr->iob = iob;
+
+ if (iob & HILIOB_BUTTONS)
+ {
+ ptr->num_buttons = (iob & HILIOB_BUTTONS);
+ }
+
+ if (iob & HAS_LEDS)
+ ptr->num_leds = imax(1, ((iob & HILIOB_NPA) >> 4));
+
+ strcpy(ptr->keymap, hil_id_to_keymap(id, (3 == ptr->num_leds)));
+
+ break;
+ }
+ return TRUE;
+}
+
+static int open_device(name) char *name;
+{
+ return open(name, O_RDWR | O_NDELAY);
+}
+
+static char hil_file_base_name[256] = "/dev/hil";
+
+static int hil_open(n) /* n in (1,7) */
+{
+ char name[128];
+
+ sprintf(name, "%s%d", hil_file_base_name, n);
+ return open_device(name);
+}
+
+ /* hil1 .. hil7 + a bunch of XOTHER devices */
+#define MAX_HIL_DEVICES 20
+static HIL_Device loop_device_list[MAX_HIL_DEVICES];
+
+static HIL_Device *next_device(reset)
+{
+ static int z;
+
+ if (reset) { z = 0; return NULL; }
+ if (z == MAX_HIL_DEVICES) return NULL;
+ return &loop_device_list[z++];
+}
+
+ /* Figure out the long name of all the devices on the loop. This is for
+ * the list devices extension.
+ * Format:
+ * nth_name
+ * where:
+ * nth is 0 .. 6 for FIRST, SECOND, ... SEVENTH
+ * name is KEYBOARD, MOUSE, BARCODE, etc
+ * Notes:
+ * Do this after catalog_loop().
+ */
+static void make_name(long_name, nth, x_name) char *long_name, *x_name;
+{
+ strcat(strcat(strcpy(long_name, h_position[nth]), "_"), x_name);
+}
+
+static void name_loop()
+{
+ int nth, hil, i;
+
+ for (hil = 0; hil < NITEMS(loop_device_list); hil++)
+ {
+ HIL_Device *ptr = &loop_device_list[hil];
+
+ nth = 0;
+ if (ptr->device_exists)
+ {
+ for (i = 0; i < hil; i++)
+ if ( loop_device_list[i].device_exists &&
+ (loop_device_list[i].device->dev_type == ptr->device->dev_type))
+ {
+ nth++;
+ }
+ make_name(ptr->long_name, nth, ptr->device->X_name);
+ }
+ }
+}
+
+ /* The HIL loop is cataloged every time configure() is called. This is
+ * because I can't tell if the loop has changed. This is probably
+ * only a problem for people using the HP Input Extension - somebody
+ * writing a client using the extension might be pluging and unpluging
+ * devices and running their client. If I didn't catalog, they would
+ * have to restart the X server. Note that changing one of the core
+ * devices (while X is running) or moving it around the loop is likely
+ * to hose X.
+ * If a device is open, assume it is OK (ie don't recatalog it).
+ * This should be quick - only have to open(), read(small amount of
+ * data), close() and look at data.
+ */
+static void catalog_loop()
+{
+ HIL_Device *ptr;
+ int fd, id, hil, i;
+
+ ptr = loop_device_list;
+ for (hil = 1; hil <= 7; hil++, ptr++)
+ {
+ if (ptr->device_exists && ptr->fd != -1) continue;
+
+ fd = hil_open(hil);
+ if (fd == -1) continue; /* Couldn't open that device */
+
+ if (stat_device(ptr, fd))
+ {
+ sprintf(ptr->file_name, "%s%d", hil_file_base_name, hil);
+ ptr->fd = -1;
+ ptr->device_exists = TRUE;
+ }
+ close(fd);
+ }
+}
+
+ /*
+ * Input:
+ * path: Device file name. Eg "/dev/hil8"
+ * null_device: TRUE if this is the null device, ie if path is
+ * "/dev/null" ie "first NULL keyboard"
+ * use_as: XKEYBOARD, XPOINTER or XOTHER
+ * Notes:
+ * Always need to stat the device because stat_device() resets things.
+ */
+static HIL_Device *add_device(path, null_device, use_as) char *path;
+{
+ HIL_Device *ptr, *qtr;
+ int fd, n, device_exists;
+
+ ptr = NULL;
+ for (n = 7; n < NITEMS(loop_device_list); n++)
+ {
+ qtr = &loop_device_list[n];
+ device_exists = qtr->device_exists;
+ if (!device_exists || (device_exists && qtr->fd == -1))
+ {
+ ptr = qtr;
+ break;
+ }
+ }
+
+ if (!ptr) return NULL; /* no open slots */
+
+ if (-1 == (fd = open_device(path))) return NULL;
+ if (!stat_device(ptr, fd) && !null_device)
+ {
+ close(fd);
+ return NULL;
+ }
+ ptr->fd = fd;
+ ptr->device_exists = TRUE;
+ ptr->use_as |= use_as;
+ strcpy(ptr->file_name, path);
+
+ return ptr;
+}
+
+static HIL_Device *find_null_device(use_as) /* and open it */
+{
+ HIL_Device *ptr = &loop_device_list[0];
+ int hil, fd;
+
+ for (hil = 0; hil < NITEMS(loop_device_list); hil++, ptr++)
+ if (ptr->device_exists && ptr->device->dev_type == NULL_DEVICE)
+ {
+ ptr->use_as |= use_as;
+ if (ptr->fd == -1 && (fd = open_device("/dev/null")) != -1)
+ ptr->fd = fd;
+ return ptr;
+ }
+ return NULL;
+}
+
+ /* Input:
+ * type: KEYBOARD, BARCODE, MOUSE, etc
+ * which: 1 ... 7 for FIRST, SECOND ... Find the nth device of type.
+ * Notes:
+ * If which is out of range (ie, bigger than last device of type), the
+ * last device of type is used.
+ */
+static HIL_Device *find_device_by_type(type, which, use_as, x, in_use) /* and open it */
+{
+ HIL_Device *savptr = NULL, *ptr = &loop_device_list[0];
+ int hil, savhil, fd, find_type;
+
+ for (hil = 0; hil < NITEMS(loop_device_list); hil++, ptr++)
+ {
+ int count = 0;
+
+ if (!ptr->device_exists)
+ continue;
+ if (x)
+ find_type = ptr->device->x_type;
+ else
+ find_type = ptr->device->dev_type;
+
+ if (find_type == type)
+ {
+ count++;
+ if (!in_use && ptr->use_as)
+ continue;
+ savptr = ptr;
+ savhil = hil + 1;
+ if (count == which) break;
+ }
+ }
+
+ /* Opening the device for the first time? */
+ if (savptr && savptr->fd == -1 && (fd = open_device(savptr->file_name)) != -1)
+ {
+ savptr->fd = fd;
+ savptr->use_as = use_as;
+ return savptr;
+ }
+
+ /* Opening the device for the nth time? */
+ if (savptr && savptr->fd != -1)
+ {
+ savptr->use_as |= use_as;
+ return savptr;
+ }
+
+ return NULL;
+}
+
+static HIL_Device *use_device_n(n, use_as) /* n in [1,7] */
+{
+ HIL_Device *ptr = &loop_device_list[n - 1];
+ int fd;
+
+ if (ptr->device_exists && ptr->fd == -1 && (fd = hil_open(n)) != -1)
+ {
+ ptr->fd = fd;
+ ptr->use_as |= use_as;
+ return ptr;
+ }
+ return NULL;
+}
+
+static HIL_Device *find_device_by_fd(fd)
+{
+ HIL_Device *ptr = loop_device_list;
+ int hil;
+
+ for (hil = NITEMS(loop_device_list); hil--; ptr++)
+ if (ptr->fd == fd) return ptr;
+
+ return NULL;
+}
+
+static HIL_Device *find_device_by_use(use_as)
+{
+ HIL_Device *ptr = loop_device_list;
+ int hil;
+
+ for (hil = NITEMS(loop_device_list); hil--; ptr++)
+ if (ptr->use_as & use_as) return ptr;
+
+ return NULL;
+}
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to close an input device.
+ *
+ */
+static int close_device(fd) int fd;
+{
+ HIL_Device *ptr;
+ int i;
+
+ if (!(ptr = find_device_by_fd(fd))) /* !!! I hope this never happens! */
+ return CLOSE_SUCCESS;
+
+ close(fd);
+ ptr->fd = -1;
+
+ return CLOSE_SUCCESS;
+}
+
+/* ******************************************************************** */
+/* ************************* Read HIL Devices ************************* */
+/* ******************************************************************** */
+
+typedef struct
+{
+ unsigned char len;
+ unsigned char timestamp[4];
+ unsigned char poll_hdr;
+ unsigned char data[20];
+} HilPacket;
+
+#define MAX_PACKET_SIZE sizeof(HilPacket) /* bytes */
+
+#define BUFFER_SIZE 600 /* Must be bigger than a (single) HIL packet */
+#define MAX_RETRIES 10
+
+static unsigned char hil_buffer[BUFFER_SIZE];
+static int data_start, bytes_left;
+
+static int read_hil(fd, force_read)
+{
+ if (fd == -1) return bytes_left; /* buffer check */
+ if (!force_read && bytes_left) return TRUE; /* got data in buffer */
+
+ /* buffer empty or not enough data in buffer */
+ {
+ int n;
+
+ if (bytes_left == 0) data_start = 0;
+
+ n = read(fd, hil_buffer + data_start + bytes_left,
+ BUFFER_SIZE - bytes_left);
+ /* !!! error check */
+ bytes_left += n;
+ }
+
+ return bytes_left;
+}
+
+ /* Read (at least) enough data to fill a packet.
+ * Returns:
+ * 0 : No can do.
+ * n : packet size
+ */
+static int read_packet(fd)
+{
+ int packet_size;
+
+ read_hil(fd,FALSE);
+ if (bytes_left == 0) return 0; /* no packet available */
+
+ packet_size = hil_buffer[data_start];
+/* if (packet_size > MAX_PACKET_SIZE) ???
+/* error check size!!! */
+ if (packet_size <= bytes_left) return packet_size;
+
+ if (fd == -1) return 0;
+
+ /* Don't have a complete packet */
+ {
+ int i;
+
+ if (BUFFER_SIZE < (data_start + packet_size))
+ { /* packet won't fit in buffer */
+ memcpy(hil_buffer, hil_buffer + data_start, bytes_left);
+ data_start = 0;
+ }
+ for (i = MAX_RETRIES; i--; )
+ {
+ if (!read_hil(fd, TRUE)) return 0; /* !!!??? */
+ if (packet_size <= bytes_left) /* got (at least) the complete packet */
+ return packet_size;
+ /* !!! sleep??? */
+ }
+ }
+ /* !!! big bad errors! */
+ return 0;
+}
+
+static HilPacket a_packet;
+static int packet_waiting = FALSE;
+
+static void pop_packet() { packet_waiting = FALSE; }
+
+static void *get_packet(fd)
+{
+ if (!packet_waiting)
+ {
+ int packet_size;
+
+ if (!(packet_size = read_packet(fd))) return NULL;
+/* !!! ick - two data copies */
+ memcpy(&a_packet, hil_buffer + data_start, packet_size);
+ data_start += packet_size; bytes_left -= packet_size;
+ packet_waiting = TRUE;
+ }
+ return &a_packet;
+}
+
+ /* Look though the buffered HIL packets looking for a button down. If a
+ * button down is found, all the packets before it are thrown away.
+ * This is used for button chording. Motion devices can send different
+ * kinds of events in a single packet and there can be many motion
+ * events between button presses (even if the user is trying to hold
+ * still) - the tablet is especially bad in this reguard.
+ * Notes:
+ * This routine has its fingers in too many things. It has to know
+ * too much about HIL packets.
+ * Input:
+ * device : The motion device that has buffered data.
+ * b1, b2: Buttons to look for.
+ * button : Pointer to int to be filled in if a button is found.
+ * Output:
+ * button
+ * The current packet is the button if TRUE returned, else unknown.
+ * Returns:
+ * TRUE : If a button down is found.
+ */
+static int look_for_button(device, b1, b2, button)
+ HIL_Device *device;
+ int b1, b2, *button;
+{
+ int poll_hdr, b, z, n, save_data_start, save_bytes_left;
+
+ save_data_start = data_start;
+ save_bytes_left = bytes_left;
+
+ n = 1 + (device->data_size == DATA_IS_16_BITS);
+
+ while (TRUE)
+ {
+ if (!get_packet(-1)) break; /* incomplete packet */
+ pop_packet();
+
+ poll_hdr = a_packet.poll_hdr;
+ if (0 == (poll_hdr & KEY_DATA_MASK)) continue; /* not a button */
+
+ z = 0;
+ if (poll_hdr & MOTION_MASK) /* motion AND key data in one packet */
+ {
+ if (poll_hdr & MOTION_XYZ) z += n; /* X axes */
+ if (poll_hdr & MOTION_Y) z += n; /* Y axes */
+ if ((poll_hdr & MOTION_XYZ) == MOTION_XYZ) z += n; /* Z axes */
+ }
+
+ b = HIL_TO_BUTTON(a_packet.data[z], device->device->dev_type,
+ device->num_buttons);
+ if (BUTTON_IS_UP(b)) break;
+ if (BUTTON_MAX < a_packet.data[z]) break; /* probably proximity */
+
+ b = REDUCE_BUTTON(b);
+#if 1
+ *button = b;
+ if (b == b1 || b == b2)
+ return TRUE;
+#else
+ if (b == b1 || b == b2)
+ {
+ *button = b;
+ return TRUE;
+ }
+#endif
+
+ break; /* wrong button, bail */
+ }
+
+ /* No button down in buffer, restore buffer */
+ data_start = save_data_start;
+ bytes_left = save_bytes_left;
+
+ return FALSE;
+}
+
+
+/* ******************************************************************** */
+/* ****************** General HIL Turn Things On/Off ****************** */
+/* ******************************************************************** */
+
+ /* Turn on or off LEDs.
+ * Input:
+ * fd : File descriptor of the HIL device.
+ * led: LED to turn on or off:
+ * 0 : general prompt.
+ * 1 : LED 1.
+ * etc
+ * on : TRUE if turn on the LED.
+ */
+ int
+ led_on[] = { HILP, HILP1, HILP2, HILP3, HILP4, HILP5, HILP6, HILP7 },
+ led_off[] = { HILA, HILA1, HILA2, HILA3, HILA4, HILA5, HILA6, HILA7 };
+static void set_LED(fd, led, on)
+{
+
+ if (0 <= led && led <= 7)
+ if (on) ioctl(fd, led_on [led], (char *)NULL);
+ else ioctl(fd, led_off[led], (char *)NULL);
+}
+
+ /* HILER1 == Key repeat every 1/30 sec
+ * HILER2 == Key repeat every 1/60 sec
+ */
+static void set_autorepeat(fd, mode)
+{
+ switch (mode)
+ {
+ case AutoRepeatModeOff:
+ ioctl(fd, HILDKR, (char *)NULL);
+ break;
+ case AutoRepeatModeOn:
+ case AutoRepeatModeDefault:
+ ioctl(fd, HILER2, (char *)NULL);
+ break;
+ default:
+ ioctl(fd, HILER1, (char *)NULL);
+ break;
+ }
+}
+
+/* ******************************************************************** */
+/* ************************* Button Chording ************************** */
+/* ******************************************************************** */
+
+/* Button chording can allow a N button device generate 2N-1 buttons.
+ * Buttons are numbered 0,1, ...
+ * Simultaneously pressing buttons A and B (where A in [1,N) and B == A+1),
+ * generates button N+A.
+ * Only a total of 5 buttons are supported. This is because of motion
+ * events and other things that George knows more about.
+ * If the device has 4 buttons, only buttons 0 and 1 can chord.
+ * If the device has 5 or more buttons, no chording is possible. Because of
+ * the max number of buttons.
+ * Only chord adjacent buttons ie don't chord buttons 0 and 3. My guess is
+ * this is historical and with 5 buttons, you don't need all those
+ * chordings.
+ * Algorithm:
+ * if num_buttons > 4, no chording, done.
+ * if num_buttons <= 3, Z = [0,2]
+ * if num_buttons == 4, Z = [0,1]
+ * Button in Z is pressed. X = button.
+ * Wait E seconds (E is passed in). Don't just wait for the device to
+ * send data within E seconds. This is in case the device sends (for
+ * example) motion data before the other button.
+ * Look though the data to see if there is a button (Y):
+ * No: Send button X.
+ * Yes:
+ * If new button (Y) is (X+1 or X-1) and Y != 3:
+ * Yes:
+ * Send button (N - 1) + (X + Y + 1)/2.
+ * (N - 1) because buttons start at zero.
+ * Discard the motion events between the buttons.
+ * No:
+ * Send X, and process the other data "normally".
+ * Notes:
+ * The hard part is keeping track of the ups and downs and keeping things
+ * in sync.
+ * If the chording interval is long, it is possible for the buffer in the
+ * HIL device (or kernel) to overflow while waiting. Too bad.
+ */
+
+#define MAX_X_BUTTONS 5
+#define MAX_BUTTONS_FOR_CHORDING 4
+
+ /* Process a button, chording if chording turned on.
+ * Input:
+ * button : reduced button.
+ * Returns:
+ * TRUE : Button chorded
+ */
+static int chord_button(device, button,
+ chorded_button, ignore_button1, ignore_button2)
+ HIL_Device *device;
+ int *chorded_button, *ignore_button1, *ignore_button2;
+{
+ int x,y,ret, max_b;
+
+ if (!device->chording_interval) return FALSE;
+
+ max_b = 3;
+ if (3 < device->num_buttons) max_b = 1;
+
+ x = REDUCE_BUTTON(button);
+ if (
+ BUTTON_IS_DOWN(button) &&
+ device->chording_interval &&
+ 0 <= x && x <= max_b)
+ {
+ int x1;
+ struct timeval timeout;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = device->chording_interval * 1000;
+ select(0, (int *)NULL, (int *)NULL, (int *)NULL, &timeout);
+
+ /* No response in allotted time */
+ if (!read_hil(device->fd, FALSE)) return 0;
+
+ if (3 == (x1 = x + 1)) x1 = 100;
+ /* No button => not a chording combination */
+ ret = look_for_button(device, x - 1, x1, &y);
+#if 1
+ if (device->latching_enabled)
+ {
+ if (!ret &&
+ (x == 0 && look_for_button(device, 100,2,&y)) ||
+ (x == 2 && look_for_button(device, 100,0,&y)))
+ {
+ device->latching_on = ~device->latching_on;
+ if (device->latching_on)
+ device->kb_latched = 0xff;
+ else
+ device->kb_latched = 0;
+ *chorded_button = -1;
+ pop_packet();
+ *ignore_button1 = BUTTON_UP(EXPAND_BUTTON(x));
+ *ignore_button2 = BUTTON_UP(EXPAND_BUTTON(y));
+ return TRUE;
+ }
+ }
+
+ if (!ret) return FALSE;
+#else
+ if (!ret) return FALSE;
+#endif
+ *chorded_button = EXPAND_BUTTON(device->num_buttons - 1 + (x + y + 1)/2);
+ pop_packet();
+ *ignore_button1 = BUTTON_UP(EXPAND_BUTTON(x));
+ *ignore_button2 = BUTTON_UP(EXPAND_BUTTON(y));
+ return TRUE;
+ }
+ return FALSE; /* Not a chording button */
+}
+
+/* ******************************************************************** */
+/* **************************** Read Mouse **************************** */
+/* ******************************************************************** */
+
+static int find_button_down(), ignore_check(), error_check_button();
+static void set_button_down();
+
+static int get_data(data, two_bytes) unsigned char *data;
+{
+ int z;
+
+ z = data[0];
+ if (two_bytes) z |= (data[1] << 8);
+
+ return z;
+}
+
+static void put_data(z, data, two_bytes) unsigned char *data;
+{
+ data[0] = z; /* the lower byte */
+ if (two_bytes) data[1] = (z >> 8);
+}
+
+#define APPEND_DATA(type, z) \
+ *data_type |= (type); \
+ put_data((z), &data[num_bytes], two_bytes); \
+ num_bytes += step; \
+ *pending = num_bytes;
+
+
+ /* Read from a motion device: motion and button presses.
+ * Mouse, Nine Knob box, Tablet.
+ * Handles absolute devices, 1 and 2 byte data.
+ * Notes:
+ * Mice need to have the Y axes motion data negated so the sprite
+ * moves when the mouse moves up. Tablets and the nine knob box
+ * don't.
+ * I really hate having to keep so much state information for chording
+ * but I think I have to: If you chord two buttons and then
+ * repeatedly press one while keeping the other pressed, you need a
+ * lot of state info to keep track.
+ * Can only chord one button pair at a time. This means that holding
+ * down the middle button, then pressing the buttons to the right
+ * and left of it (while holding down the middle button) will only
+ * chord one of the pairs.
+ * Motion devices can generate a LOT of motion data quickly. For
+ * example, if the X server takes a long time to render something
+ * (like a wide dashed line) and you are moving the mouse around,
+ * the HIL buffer (in the kernel) can overflow and data will be
+ * lost. This is more-or-less OK (can't do anything about it)
+ * except in the case where a button was down (before the overflow)
+ * and then went up after the overflow. In this case, a button up
+ * will never be generated. To check for this, when there is a
+ * button down, check to see if the button is already down and if it
+ * is, generate ups for all down buttons. The server sends
+ * extraneous ups to clients but I hope that doesn't cause problems
+ * because it is quite painful to track chording in this case.
+ */
+static int read_mouse(mouse, data, data_type, pending)
+ HIL_Device *mouse;
+ unsigned char *data, *data_type;
+ int *pending;
+{
+ int poll_hdr, num_bytes, two_bytes, step;
+
+ if (!get_packet(mouse->fd))
+ {
+ *pending = 0;
+ return READ_FAILURE;
+ }
+
+ two_bytes = (mouse->data_size == DATA_IS_16_BITS);
+ step = 1 + two_bytes;
+ num_bytes = 0;
+
+ if (mouse->error) /* Buffer overflow, sending button ups */
+ {
+ int button;
+
+ button = find_button_down(mouse, -1);
+ if (button == -1) /* No downs left */
+ {
+ mouse->error = FALSE;
+
+ *pending = 0;
+ return READ_SUCCESS;
+ }
+
+ set_button_down(mouse, button, FALSE);
+ button = BUTTON_UP(button);
+ APPEND_DATA(BUTTON_DATA, button);
+ return READ_SUCCESS;
+ }
+
+ poll_hdr = a_packet.poll_hdr;
+
+ if (poll_hdr & MOTION_MASK) /* mouse movement */
+ {
+ int motion;
+
+ *data_type |= MOTION_DATA;
+
+ if (poll_hdr & MOTION_XYZ) /* X axes */
+ {
+ motion = get_data(&a_packet.data[num_bytes], two_bytes);
+ put_data(motion, &data[num_bytes], two_bytes);
+ num_bytes += step;
+ }
+ if (poll_hdr & MOTION_Y) /* Y axes */
+ {
+ motion = get_data(&a_packet.data[num_bytes], two_bytes);
+
+ if (mouse->device->reverse_y_axes) motion = -motion;
+
+ put_data(motion, &data[num_bytes], two_bytes);
+ num_bytes += step;
+ }
+ if ((poll_hdr & MOTION_XYZ) == MOTION_XYZ) /* Z axes */
+ {
+ motion = get_data(&a_packet.data[num_bytes], two_bytes);
+ put_data(motion, &data[num_bytes], two_bytes);
+ num_bytes += step;
+ }
+ }
+
+ if (poll_hdr & KEY_DATA_MASK) /* button press */
+ {
+ int button;
+
+ pop_packet();
+
+ button = HIL_TO_BUTTON(a_packet.data[num_bytes], mouse->device->dev_type,
+ mouse->num_buttons);
+
+ if (button == PROXIMITY_IN || button == PROXIMITY_OUT)
+ {
+ *data_type |= PROXIMITY_DATA;
+
+ put_data(
+ ((button == PROXIMITY_IN) ? IN_PROXIMITY : OUT_OF_PROXIMITY),
+ &data[num_bytes], two_bytes);
+ num_bytes += step;
+ }
+ else /* Must? be a "regular" button */
+ {
+ if (1) /*!error_check_button(mouse, button))*/
+ {
+ if (mouse->chorded_button_up) /* Button chord in progress */
+ {
+ if (BUTTON_IS_UP(button))
+ {
+ button = ignore_check(mouse, button, mouse->ignore_button1, 0x1);
+ button = ignore_check(mouse, button, mouse->ignore_button2, 0x2);
+ if (0x3 == mouse->ignored_buttons)
+ {
+ button = mouse->chorded_button_up;
+ mouse->chorded_button_up = 0; /* turn off chord */
+ }
+ }
+ }
+ else /* not chording */
+ if (chord_button(mouse, button, &button,
+ &mouse->ignore_button1, &mouse->ignore_button2))
+ {
+ if (button == -1)
+ {
+ mouse->chorded_button_up = -1;
+ num_bytes = 0;
+ }
+ else
+ mouse->chorded_button_up = BUTTON_UP(button);
+ mouse->ignored_buttons = 0;
+ set_button_down(mouse, mouse->ignore_button1, TRUE);
+ set_button_down(mouse, mouse->ignore_button2, TRUE);
+ }
+
+ if (mouse->num_buttons==2 && button>=0 && button <=15)
+ button = remap[button];
+
+ if (button != -1 && !BUTTON_IS_IGNORED(mouse, button))
+ {
+ APPEND_DATA(BUTTON_DATA, button);
+ set_button_down(mouse, button, BUTTON_IS_DOWN(button));
+ }
+ }
+
+ if (button != -1)
+ {
+ if (BUTTON_IS_LATCHED(mouse, button))
+ if (BUTTON_IS_IGNORED(mouse, button))
+ {
+ if (BUTTON_IS_DOWN(button))
+ UNIGNORE_BUTTON(mouse, button);
+ }
+ else if (BUTTON_IS_DOWN(button))
+ IGNORE_BUTTON(mouse, button);
+ }
+ }
+ }
+
+ pop_packet();
+
+ *pending = num_bytes; /* might be zero in case of chording or error */
+ return READ_SUCCESS;
+}
+
+static int ignore_check(mouse, button, ignore_button, ignored_button_bit)
+ HIL_Device *mouse;
+ int button, ignore_button, ignored_button_bit;
+{
+ if (button == ignore_button)
+ {
+ if (0 == (mouse->ignored_buttons & ignored_button_bit))
+ {
+ mouse->ignored_buttons |= ignored_button_bit;
+ set_button_down(mouse, button, FALSE);
+ return -1; /* ignore this button */
+ }
+ }
+ return button;
+}
+
+static void set_button_down(mouse, button, state) HIL_Device *mouse;
+{
+ mouse->button_down[REDUCE_BUTTON(button)] = state;
+}
+
+static int find_button_down(mouse, button) HIL_Device *mouse;
+{
+ int b, z;
+
+ if (-1 != button)
+ {
+ b = REDUCE_BUTTON(button);
+ z = mouse->button_down[b];
+ }
+ else
+ for (b = 0; b < MAX_HIL_BUTTONS; b++)
+ if (z = mouse->button_down[b]) break;
+
+ if (z) return EXPAND_BUTTON(b);
+
+ return -1;
+}
+
+ /* Notes:
+ * If there is an error (because there is a down for a button that is
+ * already down), turn off that button so I don't send two ups (got
+ * a down so will get an up).
+ * Turn off chording.
+ * Trying not to send extraneous ups when chording is just too painful
+ * to worry about. The client will just have to live with extra
+ * ups.
+ */
+static int error_check_button(mouse, button) HIL_Device *mouse;
+{
+ if (BUTTON_IS_DOWN(button)) /* error check */
+ {
+ if (-1 != find_button_down(mouse,button))
+ {
+ mouse->error = TRUE;
+ mouse->chorded_button_up = 0; /* turn off chording */
+ set_button_down(mouse, button, FALSE);
+ return TRUE;
+ }
+ }
+ return FALSE; /* no problem */
+}
+
+/* ******************************************************************** */
+/* ***************************** Nothing ****************************** */
+/* ******************************************************************** */
+
+static int read_nothing(device, data, data_type, pending)
+ HIL_Device *device;
+ unsigned char *data, *data_type;
+ int *pending;
+{
+ *pending = 0;
+ return READ_FAILURE;
+}
+
+static int write_nothing(device, request, data)
+ HIL_Device *device;
+ int request;
+ char *data;
+{
+ return WRITE_FAILURE;
+}
+
+/* ******************************************************************** */
+/* ************************** Read Keyboard *************************** */
+/* ******************************************************************** */
+
+#define REPEAT_CURSOR 0x02
+
+#define ARROW_LEFT 0xf8
+#define ARROW_DOWN 0xfa
+#define ARROW_UP 0xfc
+#define ARROW_RIGHT 0xfe
+
+static int last_key; /* for arrow auto repeat */
+
+static int read_keyboard(keyboard, data, data_type, pending)
+ HIL_Device *keyboard;
+ unsigned char *data, *data_type;
+ int *pending;
+{
+ if (get_packet(keyboard->fd))
+ {
+ int poll_hdr = a_packet.poll_hdr;
+
+ pop_packet();
+
+ if (poll_hdr & KEY_DATA_MASK) /* button press */
+ {
+ int key;
+
+ key = a_packet.data[0];
+
+ if (key == REPEAT_CURSOR) key = last_key;
+ if (KEY_IS_DOWN(key)) last_key = key;
+
+ *pending = 1;
+ *data_type = KEY_DATA;
+ *data = key;
+
+ return READ_SUCCESS;
+ }
+ }
+
+ *pending = 0;
+ return READ_FAILURE;
+}
+
+/* ******************************************************************** */
+/* *************************** Bell/Beeper **************************** */
+/* ******************************************************************** */
+
+static unsigned char bell_data[4];
+
+static int bell_percent, bell_pitch, bell_duration, beeper_fd = -1;
+
+#define BEEPER_DEVICE "/dev/rhil"
+
+static void close_beeper()
+{
+ if (beeper_fd != -1) close(beeper_fd);
+ beeper_fd = -1;
+}
+
+static void open_beeper()
+{
+ if (beeper_fd > 0)
+ close_beeper();
+ if ((beeper_fd = open(BEEPER_DEVICE,O_RDWR)) < 0)
+ ; /* Don't complain, because we might be on a non-HIL machine */
+ /* and be using this driver to support NULL input devices */
+#if 0
+ fprintf(stderr, "Unable to open beeper device \"%s\".\n",BEEPER_DEVICE);
+#endif
+}
+
+/*
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; File: beeper.c
+; SCCS: %A% %G% %U%
+; Description: Access Gator/Bobcat beeper
+; Author: Andreas Paepcke, HPLabs/ATL
+; Created: 2-Aug-85
+; Modified: Thu Oct 15 12:53:00 1987 (Don Bennett) bennett@hpldpb
+; George and Craig
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+*/
+
+/*
+ We offer three voices and a noise source. Each sound is controllable
+ in pitch, volume and duration. Pitch goes from 0 to 1023, volume
+ goes from 0 to 15, duration is between 0 and 255 10msec intervals. A
+ duration of 0 turns the voice on continuously. A volume of 0 turns
+ it off.
+
+ The manufacturing specs give details on the programming interface.
+ Here is a summary:
+
+ The beeper is accessed through ioctl calls. The request argument is
+ either "Send data to beeper" or "Read voice values from beeper". The
+ argument is a pointer to a 4 byte buffer. These four bytes are
+ defined here.
+
+ R0-R3: Register address field. In the order R2, R1, R0:
+
+ 0 0 0: Voice 1 frequency
+ 0 0 1: Voice 1 attenuation
+ 0 1 0: Voice 2 frequency
+ 0 1 1: Voice 2 attenuation
+ 1 0 0: Voice 3 frequency
+ 1 0 1: Voice 3 attenuation
+ 1 1 0: Noise control
+ 1 1 1: Noise attentuation
+
+ F0-F9: 10 bits pitch
+ A0-A3: Attenuation
+ D0-D7: Duration in 10msec's
+
+ The placement of data in the buffer is a bit screwy:
+
+ Byte 0 (Frequency 1): 1 R2 R1 R0 F3 F2 F1 F0 LSB
+ Byte 1 (Frequency 2): 0 0 F9 F8 F7 F6 F5 F4
+ Byte 2 (Attenuator) : 1 R2 R1 R0 A3 A2 A1 A0
+ Byte 3 (Duration) : D7 D6 D5 D4 D3 D2 D1 D0
+
+ The volume is inversely proportional to the attenuation. In order to
+ provide rising numbers for rising loudness to the user, we expect a
+ volume and modify to get the attenuation. The same goes for the
+ pitch. In order to calculate frequency of the pitch, use:
+
+ 83333/(1023-pitch)
+
+ It is possible at any time to request the time any voice has left to
+ run. This is done by:
+
+ F4: Read voice1 timer
+ F5: Read voice2 timer
+ F6: Read voice3 timer
+ F7: Read voice4 timer (noise)
+
+ Noise is generated using a shift register. The following controls are
+ possible for noise:
+
+ - Attenuation
+ - Duration
+ - Periodic or white noise
+ - 3 shift rates or output of voice 4 as shift rate
+
+ Bytes 0 and 1 of the data buffer must both have identical contents to
+ control the noise. Attenuation and duration are as in the other
+ voices. Bytes 0 and 1 should look like this:
+
+ 1 R2 R1 R0 0 FB NF1 NF0 LSB
+
+ R2, R1 and R0 must be 1, 1 and 0. If FB is 0, periodic noise is
+ generated. If FB is 1, white noise is produced.
+
+ NF1 and NF2 control the shift rate of the noise generator:
+
+ NF1 NF2 Shift Rate
+ --------------------------
+ 0 0 M/64
+ 0 1 M/128
+ 1 0 M/256
+ 1 1 Uses tone generator 3 output
+
+ M is related to the clock rate.
+
+ The voice start routines return 0 if all is well, -1 if we had trouble
+ accessing the device file for the beeper and -2 if given parameters
+ were out of range.
+*/
+
+#define ALL_OK 0
+#define ACCESS_PROBLEM -1
+#define BAD_RANGE -2
+
+#define VOICE1_FREQ_REG 0x80 /* Top nibbles for byte0 for all voices: */
+#define VOICE2_FREQ_REG 0xA0
+#define VOICE3_FREQ_REG 0xC0
+#define NOISE_FREQ_REG 0xE0
+
+#define VOICE1_VOL_REG 0x90 /* Top nibbles for byte2 for all voices: */
+#define VOICE2_VOL_REG 0xB0
+#define VOICE3_VOL_REG 0xD0
+#define NOISE_VOL_REG 0xF0
+
+#define MIN_VOICE 1 /* Legal ranges for parms from user: */
+#define MAX_VOICE 3
+#define MIN_PITCH 0
+#define MAX_PITCH 1023
+#define MIN_DURATION 0
+#define MAX_DURATION 255
+#define MIN_VOLUME 0
+#define MAX_VOLUME 15
+#define MIN_TYPE 0
+#define MAX_TYPE 1
+#define MIN_RATE 0
+#define MAX_RATE 3
+
+static void set_bell_attributes(volume, pitch, duration)
+{
+ int attenuation, loud;
+
+ /* Map input range of 0 - 100 to hardware attenuation range of 15 -
+ * 0 we use a temp variable (loud) because of C's penchant for
+ * strange orders of evaluation ie to force the multiply before the
+ * divide.
+ */
+ volume = imin(volume,100);
+ loud = volume * MAX_VOLUME;
+ attenuation = (char) MAX_VOLUME - loud / 100;
+
+ duration = duration / 10;
+ pitch = (pitch == 0) ? 1023 : (83333 / pitch);
+ pitch = imax(imin(pitch, 1023), 0);
+
+ bell_data[0] = (VOICE1_FREQ_REG | (pitch & 0x0f));
+ bell_data[1] = (0x03f & (pitch >> 4));
+ bell_data[2] = (VOICE1_VOL_REG | attenuation);
+ bell_data[3] = imax(duration, 1);
+}
+
+
+ /* We formerly used all three voices to get a reasonably loud volume.
+ * However, s700 audio hardware support tries to emulate the EFTSBP
+ * ioctl, and has only one voice. The result is that distinct beeps
+ * (usually two) are heard if the duration is 100ms or less. To avoid
+ * this, we will use only one voice.
+ */
+static void ding(click, percent)
+{
+ int pitch;
+ unsigned char buffer[4];
+
+ if (beeper_fd < 0) return;
+ if (!click)
+ {
+ ioctl(beeper_fd, EFTSBP, bell_data);
+ return;
+ }
+
+ click = (int)((double)(percent) * 15.0 / 100.0);
+
+ click = MAX_VOLUME - click;
+ pitch = MAX_PITCH - 800;
+ buffer[0] = VOICE2_FREQ_REG | (pitch & 0x0000000f);
+ buffer[2] = VOICE2_VOL_REG | (percent & 0x0000000f);
+ /* The high 6 bits of the pitch go into byte 1: */
+ buffer[1] = 0x0000003f & (pitch >> 4);
+ buffer[3] = 1;
+ ioctl(beeper_fd,EFTSBP,buffer);
+ return;
+}
+
+/* ******************************************************************** */
+/* ************************** Write Keyboard ************************** */
+/* ******************************************************************** */
+
+/* !!!!!!!!!!!!!!!
+ * keyclick - in server or here?
+ * if key autorepeats but autorepeat is turned off for that key, don't click
+ * ie down == last key && autorepeat on for key && keyclick on => click
+ * only click for downs
+ */
+
+static int write_keyboard(keyboard,request,data)
+ HIL_Device *keyboard;
+ int request;
+ char *data;
+{
+ int fd = keyboard->fd;
+
+/*fprintf(stderr,"write keyboard, request is %d\n",request); /* */
+ switch (request)
+ {
+ case _XChangeFeedbackControl:
+ {
+ HPKeyboardFeedbackControl *kctrl = (HPKeyboardFeedbackControl *)data;
+
+ if (kctrl->class == KbdFeedbackClass)
+ {
+ int mask = kctrl->leds;
+
+ if (keyboard->device->reverse_y_axes) /* its a button box */
+ {
+ set_LED(fd, 0, mask & 1);
+ }
+ else /* a keyboard */
+ {
+ set_LED(fd, 1, mask & SCROLLLOCK_LED);
+ set_LED(fd, 2, mask & NUMLOCK_LED);
+ set_LED(fd, 3, mask & CAPSLOCK_LED);
+ }
+
+ set_autorepeat(fd, kctrl->autoRepeat);
+
+ set_bell_attributes(
+ kctrl->bell_percent, kctrl->bell_pitch, kctrl->bell_duration);
+
+ return WRITE_SUCCESS;
+ }
+ break;
+ }
+ case _XBell:
+ {
+ HPKeyboardFeedbackControl *kctrl = (HPKeyboardFeedbackControl *)data;
+
+ if (kctrl->click)
+ ding(TRUE, kctrl->click);
+ else
+ ding(FALSE, kctrl->bell_percent);
+ return WRITE_SUCCESS;
+ }
+ case _XSetDeviceValuators:
+ case _XChangeDeviceControl:
+ case _XSetDeviceMode:
+ default:
+ break;
+ }
+ return WRITE_FAILURE;
+}
+
+/* ******************************************************************** */
+/* ************************** BarCode Reader ************************** */
+/* ******************************************************************** */
+
+static unsigned char ascii_to_code[128][7] =
+{
+ {0x0c,0x0a,0x7a,0x7b,0x0b,0x0d,0}, /* 0x00 : cntl - @ */
+ {0x0c,0x5a,0x5b,0x0d,0,0,0}, /* 0x01 : cntl - a */
+ {0x0c,0x30,0x31,0x0d,0,0,0}, /* 0x02 : cntl - b */
+ {0x0c,0x34,0x35,0x0d,0,0,0}, /* 0x03 : cntl - c */
+ {0x0c,0x56,0x57,0x0d,0,0,0}, /* 0x04 : cntl - d */
+ {0x0c,0x68,0x69,0x0d,0,0,0}, /* 0x05 : cntl - e */
+ {0x0c,0x54,0x55,0x0d,0,0,0}, /* 0x06 : cntl - f */
+ {0x0c,0x52,0x53,0x0d,0,0,0}, /* 0x07 : cntl - g */
+ {0x0c,0x50,0x51,0x0d,0,0,0}, /* 0x08 : cntl - h */
+ {0x0c,0xc0,0xc1,0x0d,0,0,0}, /* 0x09 : cntl - i */
+ {0x0c,0xd0,0xd1,0x0d,0,0,0}, /* 0x0a : cntl - j */
+ {0x0c,0xd2,0xd3,0x0d,0,0,0}, /* 0x0b : cntl - k */
+ {0x0c,0xd4,0xd5,0x0d,0,0,0}, /* 0x0c : cntl - l */
+ {0x0c,0xe0,0xe1,0x0d,0,0,0}, /* 0x0d : cntl - m */
+ {0x0c,0xf0,0xf1,0x0d,0,0,0}, /* 0x0e : cntl - n */
+ {0x0c,0xc2,0xc3,0x0d,0,0,0}, /* 0x0f : cntl - o */
+ {0x0c,0xc4,0xc5,0x0d,0,0,0}, /* 0x10 : cntl - p */
+ {0x0c,0x6c,0x6d,0x0d,0,0,0}, /* 0x11 : cntl - q */
+ {0x0c,0x66,0x67,0x0d,0,0,0}, /* 0x12 : cntl - r */
+ {0x0c,0x58,0x59,0x0d,0,0,0}, /* 0x13 : cntl - s */
+ {0x0c,0x64,0x65,0x0d,0,0,0}, /* 0x14 : cntl - t */
+ {0x0c,0x60,0x61,0x0d,0,0,0}, /* 0x15 : cntl - u */
+ {0x0c,0x32,0x33,0x0d,0,0,0}, /* 0x16 : cntl - v */
+ {0x0c,0x6a,0x6b,0x0d,0,0,0}, /* 0x17 : cntl - w */
+ {0x0c,0x36,0x37,0x0d,0,0,0}, /* 0x18 : cntl - x */
+ {0x0c,0x62,0x63,0x0d,0,0,0}, /* 0x19 : cntl - y */
+ {0x0c,0x38,0x39,0x0d,0,0,0}, /* 0x1a : cntl - z */
+ {0x0c,0xc6,0xc7,0x0d,0,0,0}, /* 0x1b : cntl - [ */
+ {0x0c,0xca,0xcb,0x0d,0,0,0}, /* 0x1c : cntl - \ */
+ {0x0c,0xc8,0xc9,0x0d,0,0,0}, /* 0x1d : cntl - ] */
+ {0x0c,0x0a,0x72,0x73,0x0b,0x0d,0}, /* 0x1e : cntl - ^ */
+ {0x0c,0x0a,0xb6,0xb7,0x0b,0x0d,0}, /* 0x1f : cntl - _ */
+ {0xf2,0xf3,0,0,0,0,0}, /* 0x20 : space */
+ {0x0a,0x7c,0x7d,0x0b,0,0,0}, /* 0x21 : ! */
+ {0x0a,0xd8,0xd9,0x0b,0,0,0}, /* 0x22 : " */
+ {0x0a,0x78,0x79,0x0b,0,0,0}, /* 0x23 : # */
+ {0x0a,0x76,0x77,0x0b,0,0,0}, /* 0x24 : $ */
+ {0x0a,0x74,0x75,0x0b,0,0,0}, /* 0x25 : % */
+ {0x0a,0x70,0x71,0x0b,0,0,0}, /* 0x26 : & */
+ {0xd8,0xd9,0,0,0,0,0}, /* 0x27 : ' */
+ {0x0a,0xb2,0xb3,0x0b,0,0,0}, /* 0x28 : ( */
+ {0x0a,0xb4,0xb5,0x0b,0,0,0}, /* 0x29 : ) */
+ {0x0a,0xb0,0xb1,0x0b,0,0,0}, /* 0x2a : * */
+ {0x0a,0xb8,0xb9,0x0b,0,0,0}, /* 0x2b : + */
+ {0xe2,0xe3,0,0,0,0,0}, /* 0x2c : , */
+ {0xb6,0xb7,0,0,0,0,0}, /* 0x2d : - */
+ {0xe4,0xe5,0,0,0,0,0}, /* 0x2e : . */
+ {0xe6,0xe7,0,0,0,0,0}, /* 0x2f : / */
+ {0xb4,0xb5,0,0,0,0,0}, /* 0x30 : 0 */
+ {0x7c,0x7d,0,0,0,0,0}, /* 0x31 : 1 */
+ {0x7a,0x7b,0,0,0,0,0}, /* 0x32 : 2 */
+ {0x78,0x79,0,0,0,0,0}, /* 0x33 : 3 */
+ {0x76,0x77,0,0,0,0,0}, /* 0x34 : 4 */
+ {0x74,0x75,0,0,0,0,0}, /* 0x35 : 5 */
+ {0x72,0x73,0,0,0,0,0}, /* 0x36 : 6 */
+ {0x70,0x71,0,0,0,0,0}, /* 0x37 : 7 */
+ {0xb0,0xb1,0,0,0,0,0}, /* 0x38 : 8 */
+ {0xb2,0xb3,0,0,0,0,0}, /* 0x39 : 9 */
+ {0x0a,0xd6,0xd7,0x0b,0,0,0}, /* 0x3a : : */
+ {0xd6,0xd7,0,0,0,0,0}, /* 0x3b : ; */
+ {0x0a,0xe2,0xe3,0x0b,0,0,0}, /* 0x3c : < */
+ {0xb8,0xb9,0,0,0,0,0}, /* 0x3d : = */
+ {0x0a,0xe4,0xe5,0x0b,0,0,0}, /* 0x3e : > */
+ {0x0a,0xe6,0xe7,0x0b,0,0,0}, /* 0x3f : ? */
+ {0x0a,0x7a,0x7b,0x0b,0,0,0}, /* 0x40 : @ */
+ {0x0a,0x5a,0x5b,0x0b,0,0,0}, /* 0x41 : A */
+ {0x0a,0x30,0x31,0x0b,0,0,0}, /* 0x42 : B */
+ {0x0a,0x34,0x35,0x0b,0,0,0}, /* 0x43 : C */
+ {0x0a,0x56,0x57,0x0b,0,0,0}, /* 0x44 : D */
+ {0x0a,0x68,0x69,0x0b,0,0,0}, /* 0x45 : E */
+ {0x0a,0x54,0x55,0x0b,0,0,0}, /* 0x46 : F */
+ {0x0a,0x52,0x53,0x0b,0,0,0}, /* 0x47 : G */
+ {0x0a,0x50,0x51,0x0b,0,0,0}, /* 0x48 : H */
+ {0x0a,0xc0,0xc1,0x0b,0,0,0}, /* 0x49 : I */
+ {0x0a,0xd0,0xd1,0x0b,0,0,0}, /* 0x4a : J */
+ {0x0a,0xd2,0xd3,0x0b,0,0,0}, /* 0x4b : K */
+ {0x0a,0xd4,0xd5,0x0b,0,0,0}, /* 0x4c : L */
+ {0x0a,0xe0,0xe1,0x0b,0,0,0}, /* 0x4d : M */
+ {0x0a,0xf0,0xf1,0x0b,0,0,0}, /* 0x4e : N */
+ {0x0a,0xc2,0xc3,0x0b,0,0,0}, /* 0x4f : O */
+ {0x0a,0xc4,0xc5,0x0b,0,0,0}, /* 0x50 : P */
+ {0x0a,0x6c,0x6d,0x0b,0,0,0}, /* 0x51 : Q */
+ {0x0a,0x66,0x67,0x0b,0,0,0}, /* 0x52 : R */
+ {0x0a,0x58,0x59,0x0b,0,0,0}, /* 0x53 : S */
+ {0x0a,0x64,0x65,0x0b,0,0,0}, /* 0x54 : T */
+ {0x0a,0x60,0x61,0x0b,0,0,0}, /* 0x55 : U */
+ {0x0a,0x32,0x33,0x0b,0,0,0}, /* 0x56 : V */
+ {0x0a,0x6a,0x6b,0x0b,0,0,0}, /* 0x57 : W */
+ {0x0a,0x36,0x37,0x0b,0,0,0}, /* 0x58 : X */
+ {0x0a,0x62,0x63,0x0b,0,0,0}, /* 0x59 : Y */
+ {0x0a,0x38,0x39,0x0b,0,0,0}, /* 0x5a : Z */
+ {0xc6,0xc7,0,0,0,0,0}, /* 0x5b : [ */
+ {0xca,0xcb,0,0,0,0,0}, /* 0x5c : \ */
+ {0xc8,0xc9,0,0,0,0,0}, /* 0x5d : ] */
+ {0x0a,0x72,0x73,0x0b,0,0,0}, /* 0x5e : ^ */
+ {0x0a,0xb6,0xb7,0x0b,0,0,0}, /* 0x5f : _ */
+ {0x7e,0x7f,0,0,0,0,0}, /* 0x60 : ` */
+ {0x5a,0x5b,0,0,0,0,0}, /* 0x61 : a */
+ {0x30,0x31,0,0,0,0,0}, /* 0x62 : b */
+ {0x34,0x35,0,0,0,0,0}, /* 0x63 : c */
+ {0x56,0x57,0,0,0,0,0}, /* 0x64 : d */
+ {0x68,0x69,0,0,0,0,0}, /* 0x65 : e */
+ {0x54,0x55,0,0,0,0,0}, /* 0x66 : f */
+ {0x52,0x53,0,0,0,0,0}, /* 0x67 : g */
+ {0x50,0x51,0,0,0,0,0}, /* 0x68 : h */
+ {0xc0,0xc1,0,0,0,0,0}, /* 0x69 : i */
+ {0xd0,0xd1,0,0,0,0,0}, /* 0x6a : j */
+ {0xd2,0xd3,0,0,0,0,0}, /* 0x6b : k */
+ {0xd4,0xd5,0,0,0,0,0}, /* 0x6c : l */
+ {0xe0,0xe1,0,0,0,0,0}, /* 0x6d : m */
+ {0xf0,0xf1,0,0,0,0,0}, /* 0x6e : n */
+ {0xc2,0xc3,0,0,0,0,0}, /* 0x6f : o */
+ {0xc4,0xc5,0,0,0,0,0}, /* 0x70 : p */
+ {0x6c,0x6d,0,0,0,0,0}, /* 0x71 : q */
+ {0x66,0x67,0,0,0,0,0}, /* 0x72 : r */
+ {0x58,0x59,0,0,0,0,0}, /* 0x73 : s */
+ {0x64,0x65,0,0,0,0,0}, /* 0x74 : t */
+ {0x60,0x61,0,0,0,0,0}, /* 0x75 : u */
+ {0x32,0x33,0,0,0,0,0}, /* 0x76 : v */
+ {0x6a,0x6b,0,0,0,0,0}, /* 0x77 : w */
+ {0x36,0x37,0,0,0,0,0}, /* 0x78 : x */
+ {0x62,0x63,0,0,0,0,0}, /* 0x79 : y */
+ {0x38,0x39,0,0,0,0,0}, /* 0x7a : z */
+ {0x0a,0xc6,0xc7,0x0b,0,0,0}, /* 0x7b : { */
+ {0x0a,0xca,0xcb,0x0b,0,0,0}, /* 0x7c : | */
+ {0x0a,0xc6,0xc9,0x0b,0,0,0}, /* 0x7d : } */
+ {0x0a,0x7e,0x7f,0x0b,0,0,0}, /* 0x7e : ~ */
+ {0x0a,0x3e,0x3f,0x0b,0,0,0}, /* 0x7f : delete */
+};
+
+
+static int read_barcode(device, data, data_type, pending)
+ HIL_Device *device;
+ unsigned char *data, *data_type;
+ int *pending;
+{
+ unsigned char *ptr;
+
+ ptr = device->ptr;
+
+ if (ptr) /* In the middle of process data */
+ {
+ if (!*ptr)
+ {
+ device->ptr = NULL;
+ return READ_SUCCESS;
+ }
+
+ *pending = 1;
+ *data_type = KEY_DATA;
+ *data = *ptr++;
+
+ device->ptr = ptr;
+
+ return READ_SUCCESS;
+ }
+
+ if (get_packet(device->fd))
+ {
+ int poll_hdr = a_packet.poll_hdr;
+
+ pop_packet();
+
+ if (poll_hdr & KEY_DATA_MASK)
+ {
+ device->ptr = ascii_to_code[a_packet.data[0]];
+ return read_barcode(device, data, data_type, pending);
+ }
+ }
+
+ *pending = 0;
+ return READ_FAILURE;
+}
+
+/* ******************************************************************** */
+/* ************************* Parse X*devices ************************** */
+/* ******************************************************************** */
+
+/*
+ X*devices:
+ position device_name X_use
+ eg:
+ first keyboard keyboard
+ first mouse pointer
+ first tablet other
+
+ path X_use
+ eg:
+ /dev/hil3 keyboard
+ /tmp/foo pointer
+ /dev/hil7 other
+
+ path hil_path
+ Use path instead of "/dev/hil".
+ */
+
+
+
+static int parse_1_parm(use, use_as) char *use; int *use_as;
+{
+ if (0 == strcmp(use, "POINTER")) *use_as = XPTR_USE;
+ else if (0 == strcmp(use, "KEYBOARD")) *use_as = XKBD_USE;
+ else if (0 == strcmp(use, "OTHER")) *use_as = XOTH_USE;
+ else
+ {
+ fprintf(stderr,
+ "Bad device use \"%s\" in X*devices file, entry skipped.\n", use);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/***********************************************************************
+ *
+ * This routine is invoked when two parameters are specified.
+ * Either they are a device path and intended use, or a device loop path.
+ */
+
+static int parse_2_parms(dev, use, use_as)
+ char *dev, *use;
+ int *use_as;
+ {
+ uppercase(use);
+
+ if (0 == strcmp (use,"HIL_PATH"))
+ {
+ strcpy (hil_file_base_name,dev);
+ return FALSE; /* Fake out configure() */
+ }
+
+ return parse_1_parm(use, use_as);
+ }
+
+ /* Parse lines with 3 parameters, such as:
+ * first keyboard keyboard
+ * Params are a position, a device type, and its intended use.
+ * Input:
+ * pos : first param
+ * x_name : second param
+ * use : third param
+ * ipos :
+ * itype : dev_type
+ * use_as : Pointer to int, filled in with what third parm is.
+ * Returns:
+ */
+static int parse_three_parms(pos, x_name, use, ipos, itype, use_as)
+ char *pos, *x_name, *use;
+ int *ipos, *itype, *use_as;
+{
+ int i;
+
+ uppercase(pos);
+ uppercase(use);
+
+ for (i=0; i<NITEMS(h_position); i++)
+ if (0 == strcmp(h_position[i], pos))
+ {
+ *ipos = i + 1; /* h_position[0] = "FIRST" == 1 */
+ break;
+ }
+
+ if (i >= 7) /* failed, skip this entry */
+ {
+ fprintf(stderr,
+ "Bad ordinal \"%s\" in X*devices file, entry skipped.\n",
+ pos);
+ return FALSE;
+ }
+
+ uppercase(x_name);
+
+ for (i=0; i<NITEMS(devices); i++)
+ if (0 == strcmp(devices[i].X_name,x_name))
+ {
+ *itype = devices[i].dev_type;
+ break;
+ }
+
+ if (i == NITEMS(devices)) /* failed, skip this entry */
+ {
+ fprintf(stderr,
+ "Bad device type \"%s\" in X*devices file, entry skipped.\n",
+ x_name);
+ return FALSE;
+ }
+
+ return parse_1_parm(use, use_as);
+}
+
+ /*
+ * Formats:
+ * |#comment
+ * | #comment
+ * |word [#comment]
+ * | word [#comment]
+ * |word word [#comment]
+ * |word word word [#comment]
+ * |word word word word [#comment]
+ */
+static int process_path(path, itype, ipos, parm1, use_as)
+ char *path, *parm1;
+ int *ipos, *itype, *use_as;
+{
+ int parms;
+ char parm2[256], parm3[256];
+
+ parm1[0] = parm2[0] = parm3[0] = '\0';
+
+ parms = sscanf(path, "%s%s%s", parm1, parm2, parm3);
+
+ if (*parm1 == '#') return FALSE; /* comment line */
+ else if (*parm2 == '#') parms = 1; /* error */
+ else if (*parm3 == '#') parms = 2;
+
+ if (2 == parms) /* device name specified */
+ return parse_2_parms (parm1, parm2, use_as);
+ if (3 == parms)
+ return parse_three_parms (parm1, parm2, parm3, ipos, itype, use_as);
+
+ fprintf(stderr,
+ "Bad line in X*devices file, entry skipped:\n %s", path);
+
+ return FALSE;
+}
+
+#define MAX_X0devices 20
+typedef struct
+{
+ int live, dev_type, position, use_as, a_path;
+ char path[256];
+} X0Device;
+
+static void set_X0device(ptr, type, position, use_as, path)
+ X0Device *ptr; char *path;
+{
+ ptr->live = TRUE;
+ ptr->dev_type = type;
+ ptr->position = position;
+ ptr->use_as |= use_as;
+ if (use_as == XKBD_USE || use_as == XPTR_USE)
+ ptr->use_as |= EXPLICIT;
+ if (type == -1) /* 2 params, ie got a path */
+ {
+ ptr->a_path = TRUE;
+ strcpy(ptr->path, path);
+ }
+}
+
+static void pick_default_device(live, type, use_as, x, in_use)
+{
+
+ if (live) return; /* device specified, no need to pick a default */
+ /* return last device of type */
+ find_device_by_type(type, 100, use_as, x, in_use);
+ /* else no default */
+}
+
+static HIL_Device *do_path(path, use_as) char *path;
+{ /* "/dev/hil3 keyboard" or "/tmp/keys keyboard" */
+ int nth, len;
+
+ len = strlen(hil_file_base_name);
+
+ /* if "/dev/hilx", use existing loop stuff */
+ nth = path[len] - '0'; /* '1' => 0x1 */
+ if (
+ (len + 1) == strlen(path) &&
+ (0 == strncmp(path, hil_file_base_name, len)) &&
+ (1 <= nth && nth <= 7))
+ {
+ return use_device_n(nth, use_as);
+ }
+ /* "/tmp/keys" or "/dev/HIL" or "/dev/hil8" */
+ return add_device(path, FALSE, use_as);
+}
+
+#define RECYCLE_CMD "X*devices:Recycle"
+
+static int process_X0devices(d) HPInputDeviceHeader *d;
+{
+ FILE *fptr;
+ char *path;
+ int n, use_as;
+ X0Device X0devices[MAX_X0devices], *ptr;
+
+ path = d->path + sizeof(RECYCLE_CMD);
+ memset(X0devices, 0, sizeof(X0devices));
+ memset(loop_device_list, 0, sizeof(loop_device_list));
+
+ if (fptr = fopen(path, "r"))
+ {
+ char buf[256], word[256], *keyword;
+ int num_X0devices = 2, ignoring, itype, ipos;
+
+ buf[0] = '\0';
+ ignoring = FALSE; keyword = "BEGIN_DEVICE_DESCRIPTION";
+
+ while (fgets(buf, 250, fptr))
+ {
+ if (*buf == '#' || *buf == '\n') continue; /* quick speed ups */
+
+ if (1 == sscanf(buf, "%s", word))
+ {
+ uppercase(word);
+ if (0 == strcmp(keyword, word))
+ {
+ keyword = ignoring ?
+ "BEGIN_DEVICE_DESCRIPTION" : "END_DEVICE_DESCRIPTION";
+ ignoring = !ignoring;
+ continue;
+ }
+ }
+
+ itype = -1;
+ if (ignoring || !process_path(buf, &itype, &ipos, word, &use_as))
+ continue;
+
+ switch(use_as)
+ {
+ case XKBD_USE: n = XKEYBOARD; break;
+ case XPTR_USE: n = XPOINTER; break;
+ case XOTH_USE:
+ if (MAX_X0devices == num_X0devices)
+ {
+ fprintf(stderr, "Too many \"other\" devices in X*devices\n");
+ continue;
+ }
+ n = num_X0devices++;
+ break;
+ }
+ set_X0device(&X0devices[n], itype, ipos, use_as, word);
+ }
+
+ fclose(fptr);
+ }
+
+ catalog_loop();
+
+ for (n = MAX_X0devices, ptr = X0devices; n--; ptr++)
+ {
+ if (!ptr->live) continue;
+ if (ptr->a_path) do_path(ptr->path, ptr->use_as);
+ else
+ {
+ if (ptr->dev_type == NULL_DEVICE)
+ {
+ HIL_Device *device;
+
+ if (find_null_device(ptr->use_as) == NULL)
+ if (device = add_device("/dev/null", TRUE, ptr->use_as))
+ device->device = &devices[0];
+ }
+ else
+ find_device_by_type(ptr->dev_type, ptr->position, ptr->use_as, FALSE, TRUE);
+ }
+ }
+
+ pick_default_device(X0devices[XKEYBOARD].live, KEYBOARD, XKBD_USE, FALSE, FALSE);
+ if (!find_device_by_use(XKBD_USE)) /* still no keyboard */
+ pick_default_device(FALSE, KEYBOARD, XKBD_USE, TRUE, FALSE);
+ if (!find_device_by_use(XKBD_USE)) /* still no keyboard */
+ pick_default_device(X0devices[XKEYBOARD].live, KEYBOARD, XKBD_USE, FALSE, TRUE);
+ if (!find_device_by_use(XKBD_USE)) /* still no keyboard */
+ pick_default_device(FALSE, KEYBOARD, XKBD_USE, TRUE, TRUE);
+
+ pick_default_device(X0devices[XPOINTER].live, MOUSE, XPTR_USE, FALSE, FALSE);
+ if (!find_device_by_use(XPTR_USE)) /* still no pointer */
+ pick_default_device(FALSE, MOUSE, XPTR_USE, TRUE, FALSE);
+ if (!find_device_by_use(XPTR_USE)) /* still no pointer */
+ pick_default_device(X0devices[XPOINTER].live, MOUSE, XPTR_USE, FALSE, TRUE);
+ if (!find_device_by_use(XPTR_USE)) /* still no pointer */
+ pick_default_device(FALSE, MOUSE, XPTR_USE, TRUE, TRUE);
+ if (!find_device_by_use(XPTR_USE)) /* still no pointer */
+ { /* use X keyboard (if it exists) */
+ HIL_Device *device;
+ if ((device = find_device_by_use(XKBD_USE)) &&
+ device->device->dev_type != NULL_DEVICE)
+ device->use_as |= XPTR_USE;
+ }
+
+ name_loop();
+
+ if (X0devices[XPOINTER].position == 1 && /* position is "FIRST" */
+ X0devices[XPOINTER].dev_type == KEYBOARD) /* type is KEYBOARD */
+ d->reserved[3] = 1;
+
+ return TRUE;
+}
+
+/* ******************************************************************** */
+/* ************************ X Server Interface ************************ */
+/* ******************************************************************** */
+
+#define PARSE_KEYWORD "X*devices:"
+
+ /*
+ * Notes:
+ * The "path" is passed in unchanged from X0devices. I overload this:
+ * <device_name>
+ * <device_name>:<keymap_name>
+ * you_pick
+ * you_pick:<keymap_name>
+ */
+static int configure(d) HPInputDeviceHeader *d;
+{
+ HIL_Device *ptr;
+
+ if (0 == strncmp(d->path, RECYCLE_CMD, sizeof(RECYCLE_CMD) - 1))
+ {
+ open_beeper();
+ process_X0devices(d);
+ next_device(TRUE);
+
+ return INIT_SUCCESS;
+ }
+ else if (0 == strcmp(d->path, PARSE_KEYWORD))
+ {
+ while ((ptr = next_device(FALSE)) && !ptr->device_exists) ;
+ if (!ptr) return INIT_FAILURE;
+ strcpy(d->path,ptr->file_name);
+ }
+ else
+ {
+ char *path, dev_path[255];
+ int i, fd, ipos, itype, use_as;
+
+ catalog_loop();
+
+ ptr = do_path(d->path, XEXT_USE);
+
+ if (!ptr) return INIT_FAILURE;
+
+ ptr->use_as &= ~EXPLICIT;
+
+ name_loop();
+
+#ifdef VERBOSE
+printf("Configure: %d \"%s\" %s %d %s\n",
+ ptr->fd, path, ptr->keymap, d->button_chording, ptr->long_name); /* */
+#endif /* VERBOSE */
+ }
+
+ d->min_kcode = (ptr->hil_id == QUAD_ID ? NINE_KNOB_ID : ptr->hil_id);
+ d->max_kcode = ptr->iob;
+ ptr->latching_enabled = d->reserved[0];
+ d->reserved[0] = HP_HIL;
+ d->reserved[1] = ptr->device->dev_type;
+ if (ptr->use_as & XKBD_USE || ptr->use_as & XPTR_USE)
+ ptr->use_as &= (XKBD_USE | XPTR_USE | EXPLICIT);
+ d->reserved[2] = ptr->use_as;
+ d->x_name = ptr->long_name;
+ d->file_ds = ptr->fd;
+ switch (ptr->device->x_type)
+ {
+ case KEYBOARD:
+ if (ptr->iob & HILIOB_NPA)
+ d->reserved[0] |= PC101_KBD;
+ else
+ d->reserved[0] |= HP_ITF_KBD;
+ set_autorepeat(ptr->fd, AutoRepeatModeOn);
+
+ d->keymap_name = ptr->keymap;
+ d->flags = DATA_IS_8_BITS;
+ d->num_keys = 1;
+
+ d->num_ledf = 1; /* number of led feedbacks */
+ d->ledf = &ptr->num_leds; /* number of leds */
+
+ d->reset = 0xf; /* Reset keycode on HIL keyboards*/
+ d->reset_mods = (ShiftMask | ControlMask); /* Shift Control */
+
+ break;
+ case MOUSE:
+ d->keymap_name = ptr->keymap;
+ d->flags = ptr->data_size;
+ if (ptr->flags & HIL_ABSOLUTE)
+ d->flags |= (ABSOLUTE_DATA | REPORTS_PROXIMITY);
+ d->num_keys = 0;
+ d->ax_num = ptr->num_axes;
+
+ ptr->error = 0;
+ ptr->chorded_button_up = 0;
+
+ {
+ int buttons = ptr->num_buttons;
+
+ if (1 < buttons && buttons <= MAX_BUTTONS_FOR_CHORDING)/* we can chord*/
+ {
+ if (buttons==2 && d->button_chording==0)
+ d->button_chording=100;
+ ptr->chording_interval = d->button_chording;
+ if (d->button_chording) buttons = (2 * buttons - 1);
+ }
+ if (MAX_X_BUTTONS < buttons) buttons = MAX_X_BUTTONS;
+ d->num_buttons = buttons;
+ }
+
+ d->num_keys = 0; /* no keys */
+ d->resolution = ptr->res_x / 100; /* resolution in counts/cm */
+ d->max_x = ptr->max_x; /* maximum x value in counts */
+ d->max_y = ptr->max_y; /* maximum y value in counts */
+
+ break;
+ case XOTHER: /* !!!??? the NULL device */
+ d->ax_num = 2;
+ d->max_x = d->max_y = 1000;
+/* d->res_x = d->res_y = 1000; /* */
+ d->resolution = 10;
+ d->num_keys = 1;
+ d->num_buttons = 3;
+ d->min_kcode = 0xd5;
+ d->keymap_name = "ITF_US_English";
+ break;
+ default: return INIT_FAILURE;
+ }
+
+ return INIT_SUCCESS;
+}
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to read from the device driver.
+ *
+ */
+
+static int read_device(fd, data, data_type, pending)
+ int fd, *pending;
+ unsigned char *data, *data_type;
+{
+ HIL_Device *device;
+
+ device = find_device_by_fd(fd);
+
+/*fprintf(stderr,"read_device(%d)\n", fd); /* */
+
+ if (device)
+ return device->device->read_device(device, data, data_type, pending);
+
+ *pending = 0;
+ return READ_FAILURE;
+}
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to write to the device driver.
+ *
+ */
+
+static int write_to_device(fd, request, data)
+ int fd, request;
+ char *data;
+{
+ HIL_Device *device;
+
+ device = find_device_by_fd(fd);
+
+/*fprintf(stderr,"write_device(%d)\n", fd); /* */
+
+ if (device) return device->device->write_device(device, request, data);
+
+ return WRITE_FAILURE;
+}
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to initialize the device driver.
+ *
+ */
+
+int hil_driver_Init(serialproc) SerialProcs *serialproc;
+{
+ serialproc->configure = configure;
+ serialproc->read = read_device;
+ serialproc->write = write_to_device;
+ serialproc->close = close_device;
+
+ return INIT_SUCCESS;
+}
+
+#ifdef TEST
+
+/* ******************************************************************** */
+/* ***************************** TESTing ****************************** */
+/* ******************************************************************** */
+
+void read_dump(device) HIL_Device *device;
+{
+ unsigned char data[20], data_type = 0;
+ int pending;
+
+ if (!device) return;
+
+ while (READ_SUCCESS == read_device(device->fd, &data, &data_type, &pending))
+ {
+ int i;
+
+if (pending == 0) continue;
+ printf("%d %d ", device->fd, pending);
+ if (data_type & MOTION_DATA) printf("Motion ");
+ if (data_type & PROXIMITY_DATA) printf("Proximity ");
+ if (data_type & BUTTON_DATA) printf("Button ");
+ if (data_type & KEY_DATA) printf("Key ");
+ printf(": ");
+ switch (device->data_size)
+ {
+ case DATA_IS_8_BITS:
+ for (i = 0; i < pending; i++) printf("%x ", data[i]);
+ break;
+ case DATA_IS_16_BITS:
+ for (i = 0; i < pending; i += 2)
+ printf("%x ", get_data(data + i, TRUE));
+ break;
+ default:
+ printf("read_dump(): Unknown data size: %d", device->data_size);
+ break;
+ }
+ printf("\n");
+ data_type = 0;
+ }
+}
+
+main()
+{
+ HPInputDeviceHeader d;
+ HIL_Device *keyboard = NULL, *mouse = NULL;
+ int s;
+
+#if 1
+ strcpy(d.path,"X*devices:Recycle:/etc/X11/X0devices");
+ configure(&d);
+ strcpy(d.path,"X*devices:");
+ while(INIT_SUCCESS == configure(&d))
+ {
+ if (d.file_ds != -1)
+ {
+ HIL_Device *ptr;
+
+ ptr = find_device_by_fd(d.file_ds);
+ switch (ptr->device->x_type)
+ {
+ case KEYBOARD: keyboard = ptr; break;
+ case MOUSE: mouse = ptr; break;
+ }
+ }
+ strcpy(d.path,"X*devices:");
+ }
+#else
+ strcpy(d.path,"second keyboard keyboard"); /* */
+/* strcpy(d.path,"third keyboard keyboard"); /* */
+/* strcpy(d.path,"last keyboard keyboard"); /* */
+/* strcpy(d.path,"/dev/hil4 keyboard"); /* */
+ s = configure(&d);
+ if (s == INIT_SUCCESS) keyboard = find_device_by_fd(d.file_ds);
+ else fprintf(stderr,"Couldn't find a keyboard\n");
+
+ strcpy(d.path,"first mouse pointer");
+ d.button_chording = 100;
+ s = configure(&d);
+ if (s == INIT_SUCCESS) mouse = find_device_by_fd(d.file_ds);
+ else fprintf(stderr,"Couldn't find a mouse\n");
+#endif
+
+ while (1)
+ {
+ read_dump(keyboard);
+ read_dump(mouse);
+ }
+}
+
+#endif /* TEST */
+#ifdef DEBUG
+#include <signal.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/termio.h>
+#include <sys/ptyio.h>
+#include <sys/hilioctl.h>
+#include "HilCmds.h"
+#include "HilData.h"
+
+#define max( a, b ) (( a > b ) ? a : b )
+#define min( a, b ) (( a > b ) ? b : a )
+
+int BaseFiledescriptor = 99;
+int MaxOpen;
+int SelectMask;
+void SignalHandler();
+void CloseAllHilDevices();
+void HandshakeDevice();
+#define HOSTBUFFERSIZE 1024
+char Hostname[ HOSTBUFFERSIZE ];
+#define PTY_DIR "/tmp/"
+#define NUM_DEVS 9
+
+/*
+ * the following strings are returned by the HIL driver
+ * describing the associated HIL device in reponse to
+ * an HILID ioctl
+ */
+unsigned char three_axes[11] =
+ { 0x75,0x13,0x61,0x0F,0x03, 0, 0, 0, 0, 0, 0 };
+unsigned char no_axes[11] =
+ { 0x74,0x00, 0x0b, 0, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char error_device[11] =
+ { 0x73,0x00, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char no_iob_rel[11] =
+ { 0x71,0x01, 0x90, 0x01, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char one_axis[11] =
+ { 0x70,0x41, 0x90, 0x01, 0x03, 0x04, 0x03, 0, 0, 0, 0 };
+unsigned char pc_keyboard[11] =
+ { 0xde,0x10, 0x30, 0, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char us_keyboard[11] =
+ { 0xdf, 0,0xc2, 0, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char asize_tablet[11] =
+ { 0x93,0x72,0x90,0x01,0x80,0x2e,0xd4,0x21,0x0c, 0, 0 };
+unsigned char bsize_tablet[11] =
+ { 0x94,0x72,0x90,0x01,0x90,0x43,0xd4,0x2e,0x0b, 0, 0 };
+unsigned char three_button_mouse[11] =
+ { 0x72,0x12,0xC2,0x1E,0x03,0x43, 0, 0, 0, 0, 0 };
+unsigned char two_button_mouse[11] =
+ { 0x68,0x12,0xC2,0x1E,0x02,0x43, 0, 0, 0, 0, 0 };
+unsigned char buttonbox[11]=
+ { 0x30,0x10,0x80,0x1E,0x00, 0, 0, 0, 0, 0, 0 };
+unsigned char id_module[11]=
+ { 0x34,0x10,0x00,0x00,0x00, 0, 0, 0, 0, 0, 0 };
+unsigned char nineknobbox[11] =
+ { 0x61,0x13,0x61,0x0F,0x00, 0, 0, 0, 0, 0, 0 };
+unsigned char oneknobbox[11] =
+ { 0x60,0x11,0x61,0x0F,0x00, 0, 0, 0, 0, 0, 0 };
+unsigned char barcode[11] =
+ { 0x5c,0,0x80, 0, 0, 0, 0, 0, 0, 0, 0 };
+unsigned char quadrature[11] =
+ { 0x61,0x12,0x61,0x0f,0x03,0x43, 0, 0, 0, 0, 0 };
+unsigned char touchscreen[11] =
+ { 0x8c,0x52,0x0a,0x01,0x38,0,0x2a,0,0x08, 0, 0 };
+unsigned char bogus[11]=
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+struct HilDeviceInfo {
+ int id;
+ char * name;
+ unsigned char * pHilIdString;
+ unsigned char num_keys;
+ unsigned char min_kcode;
+ unsigned char max_kcode;
+};
+struct HilDeviceInfo DeviceTable[] = {
+ { X_BUTTONBOX, "BUTTONBOX", buttonbox, 32,8,39 },
+ { X_ID_MODULE, "ID_MODULE", id_module, 0,0,0 },
+ { X_BARCODE, "BARCODE", barcode, 109,8,135 },
+ { X_NO_AXES, "NO_AXES", no_axes, 0,0,0 },
+ { X_THREE_AXES, "THREE_AXES", three_axes, 0,0,0 },
+ { X_ONE_AXIS, "ONE_AXIS", one_axis, 0,0,0 },
+ { X_NO_IOB_REL, "NO_IOB_REL", no_iob_rel, 0,0,0 },
+ { X_ERROR_DEVICE,"ERROR_DEVICE", error_device, 0,0,0 },
+ { X_ONE_KNOB, "ONE_KNOB", oneknobbox, 0,0,0 },
+ { X_NINE_KNOB, "NINE_KNOB", nineknobbox, 0,0,0 },
+ { X_QUADRATURE, "QUADRATURE", quadrature, 0,0,0 },
+ { X_MOUSE_2B, "MOUSE", two_button_mouse, 0,0,0 },
+ { X_MOUSE_3B, "MOUSE", three_button_mouse, 0,0,0 },
+ { X_TOUCHSCREEN, "TOUCHSCREEN", touchscreen, 0,0,0 },
+ { X_TABLET_ASIZE,"TABLET_ASIZE", asize_tablet, 0,0,0 },
+ { X_TABLET_BSIZE,"TABLET_BSIZE", bsize_tablet, 0,0,0 },
+ { X_KB_US, "KEYBOARD", us_keyboard,109,8,135 },
+ { X_KB_PC, "KEYBOARD", pc_keyboard,109,8,135 },
+ { 0x00, "NULL", bogus, 0,0,0 }
+};
+
+struct HilLoopInfo {
+#define MAXNAMLEN 1024
+ char PtyName[MAXNAMLEN]; /* device name to link the pty to */
+ char SlaveName[MAXNAMLEN]; /* pty slave name */
+ int Pty; /* fd of master side of device pty */
+ int PtyMask; /* select mask for same */
+ int PtyCount; /* number of bytes written to pty */
+ struct HilDeviceInfo *pHilDeviceInfo;
+ struct HilCommandLog *pNext;
+ struct HilCommandLog *pLast;
+} hil[NUM_DEVS];
+
+struct HilCommandLog {
+ int Command;
+ struct HilCommandLog *pNext;
+};
+
+unsigned char tcget_info[17] =
+ { 0,0,0,0,0x09,0x67,0,0,0,0x7f,0x1c,0x23,0x40,0x04,0,0,0 };
+
+/***********************************************************
+ *
+ * Main entry point. This program will fork into two processes.
+ * The first is a test program that will invoke the entry points
+ * provided by this input device driver. The second is a daemon
+ * that will handle ioctls from the driver.
+ *
+ * Functionality to be tested:
+ *
+ * driver initialization entry point
+ *
+ * - touch test
+ *
+ * configuration entry point
+ *
+ * - default configuration with no X*devices specification
+ * - only a non-keyboard key device
+ * - only a keyboard
+ * - keyboard and mouse
+ * - non-keyboard key device and mouse
+ * - keyboard and non-mouse pointer
+ * - multiple keyboards and mouse
+ * - multiple key devices and mouse
+ * - keyboard and multiple pointing devices
+ * - multiple key devices and multiple pointing devices
+ * - maximum number of input devices
+ * - configuration with an X0devices file
+ * - non-default keyboard device
+ * - non-default pointer device
+ * - null keyboard and null pointer
+ * - null keyboard and mouse
+ * - keyboard and null mouse
+ * - specify "other" devices
+ * - specify non-default ordinal
+ * - specify invalid ordinal
+ * - specify invalid device
+ * - specify invalid use
+ * - specify too many input devices
+ * - specify too many input parameters
+ * - specify not enough input parameters
+ *
+ * read entry point
+ *
+ * - read keyboard data
+ * - read buttonbox data
+ * - read barcode data
+ * - read mouse motion/button data
+ * - read tablet motion/button data
+ * - read nine-knob motion data
+ * - button chording
+ *
+ * write entry point
+ *
+ * - turn on LEDS
+ * - turn autorepeat on/off
+ * - turn keyclick on/off
+ * - sound the bell
+ *
+ * close entry point
+ *
+ * - touch test
+ *
+ ***********************************************************/
+main(argc,argv)
+ char *argv[];
+ int argc;
+ {
+ int i, pid;
+
+ for (i=0; i<NUM_TEST_CASES; i++)
+ {
+ if ((pid = fork()) == 0) /* This is the child process */
+#if 0
+ if (argc > 1)
+#endif
+ {
+ do_child_process(i);
+ exit(0);
+ }
+ else
+ {
+ usleep(50000, 0, NULL);
+ do_parent_process(i);
+ waitpid (pid, NULL, 0);
+ }
+ }
+ }
+
+/***********************************************************
+ * do_child_process
+ *
+ * This is the process that handles ioctls from the driver.
+ * It sets up an array of input devices that will be listed
+ * by the driver. How they are used will be determined by
+ * the information in the X*devices file.
+ *
+ */
+
+do_child_process(i)
+ int i;
+ {
+
+ signal( SIGINT, SignalHandler );
+ signal( SIGHUP, SignalHandler );
+ signal( SIGTERM, SignalHandler );
+ gethostname( Hostname, HOSTBUFFERSIZE );
+
+ SetupHILDevices (tc[i].devs);
+
+ /*
+ * loop, servicing the ptys when they so indicate via the select mask.
+ */
+
+ for ( ;; )
+ {
+ int j, ret;
+ int ExceptionMask = SelectMask;
+
+ ret = select( MaxOpen + 1, NULL, NULL, &ExceptionMask, 0 );
+
+ /*
+ * if the pty's emulating the HIL devices need
+ * to be serviced, then handshake them.
+ */
+ if ( ExceptionMask )
+ {
+ for ( j = 0; j < 32; j++ )
+ {
+ if ( ExceptionMask & 1 )
+ HandshakeDevice( j - BaseFiledescriptor );
+ ExceptionMask >>= 1;
+ }
+ }
+ }
+ }
+
+/***********************************************************
+ * do_parent_process
+ *
+ * This is the parent process. It performs the following functions:
+ * - Set up the X0devices file to read from the daemon ptys
+ * - Invoke the driver initialiation and device initialization routines.
+ * - Invoke the read routines to read data from the test input devices.
+ */
+
+struct mydata
+ {
+ int valid;
+ int type;
+ } ;
+
+#define TPSENDD _IOW('Z', 1, struct mydata)
+#define TPSTOPIT _IO('Z', 2)
+
+do_parent_process(i)
+ int i;
+ {
+ int status, fd, count;
+ char buffer[128];
+ SerialProcs s;
+ HPInputDeviceHeader d[10], *dptr = d;
+ HIL_Device *lptr;
+ HPKeyboardFeedbackControl kctl;
+ char TruncHost[1024];
+
+ gethostname( Hostname, HOSTBUFFERSIZE );
+ strcpy (TruncHost, Hostname);
+ strtok (TruncHost, ".");
+
+ for (count=0; count<9; count++)
+ {
+ d[count].path[0]='\0';
+ d[count].button_chording = 100;
+ }
+ fd = creat("./X0devices.test", 0777);
+ sprintf (buffer,"/tmp/%s:hil hil_path\n",TruncHost);
+ write (fd, buffer,strlen(buffer));
+ if (strlen(tc[i].devices_file))
+ write (fd, tc[i].devices_file, strlen(tc[i].devices_file));
+ else
+ {
+ sprintf (buffer,"/tmp/%s:hil7 other\n",TruncHost);
+ write (fd, buffer,strlen(buffer));
+ }
+ close(fd);
+
+ if ((status = hil_driver_Init(&s)) != INIT_SUCCESS)
+ {
+ printf("Driver initialization failure: %x\n",status);
+ CloseAllHilDevices();
+ exit(1);
+ }
+
+ strcpy(d[0].path,"X*devices:Recycle:./X0devices.foobar");
+ status = (*(s.configure)) (d);
+ for (lptr=loop_device_list,count=0; count<10; count++,lptr++)
+ if (lptr->fd > 0)
+ (*(s.close)) (lptr->fd);
+ fd = creat("./X0devices.empty", 0777);
+ close(fd);
+ strcpy(d[0].path,"X*devices:Recycle:./X0devices.empty");
+ status = (*(s.configure)) (d);
+ for (lptr=loop_device_list,count=0; count<10; count++,lptr++)
+ if (lptr->fd > 0)
+ (*(s.close)) (lptr->fd);
+ test_configure_entry_point(&s, d, i);
+ for (dptr=d,i=0; i<10; i++,dptr++)
+ {
+ unsigned char device_type = dptr->min_kcode;
+ if (dptr->file_ds > 0 || *dptr->path=='\0')
+ continue;
+ if (device_type == X_NINE_KNOB)
+ dptr->button_chording = 0;
+ if ((status = (*(s.configure)) (dptr)) != INIT_SUCCESS)
+ {
+ printf("Device '%s' initialization failure status: %x\n",
+ dptr->path, status);
+ CloseAllHilDevices();
+ exit(1);
+ }
+ }
+ for (dptr=d,i=0; i<10; i++,dptr++)
+ {
+ if (dptr->file_ds <= 0 || *dptr->path=='\0')
+ continue;
+ if (strcmp(dptr->x_name, "FIRST_NULL")!=0)
+ test_read_entry_point(&s, dptr);
+ if (i==0)
+ {fd = beeper_fd; beeper_fd=-1;}
+ test_write_entry_point(&s, dptr);
+ if (i==0)
+ beeper_fd = fd;
+ if (strcmp(dptr->x_name, "FIRST_NULL")!=0)
+ test_read_entry_point(&s, dptr);
+ }
+ for (dptr=d,i=0; i<10; i++,dptr++)
+ if (dptr->file_ds > 0)
+ ioctl(dptr->file_ds, TPSTOPIT, buffer); /* terminate child */
+ for (dptr=d,i=0; i<10; i++,dptr++)
+ {
+ if (dptr->file_ds <= 0)
+ continue;
+ if ((status = (*(s.close)) (dptr->file_ds)) != CLOSE_SUCCESS)
+ {
+ printf("Device '%s' close failure status: %x\n",dptr->path, status);
+ CloseAllHilDevices();
+ exit(1);
+ }
+ }
+ close_beeper();
+ close_beeper();
+ }
+
+/***********************************************************
+ * test_configure_entry_point
+ *
+ * Test the configure() entry point of the HIL device driver.
+ */
+
+test_configure_entry_point(s, dptr, i)
+ SerialProcs *s;
+ HPInputDeviceHeader *dptr;
+ {
+ int fail, status;
+ ExpectedData *expected = tc[i].expect;
+
+ strcpy(dptr->path,"X*devices:Recycle:./X0devices.test");
+ if ((status = (*(s->configure)) (dptr)) != INIT_SUCCESS)
+ {
+ printf("Device '%s' initialization failure status: %x\n",
+ dptr->path, status);
+ CloseAllHilDevices();
+ exit(1);
+ }
+ strcpy(dptr->path,"X*devices:");
+ fail=0;
+ while ((status = (*(s->configure)) (dptr)) == INIT_SUCCESS)
+ {
+ if (strcmp (dptr->x_name, expected->name)!=0 ||
+ dptr->file_ds != expected->fd ||
+ dptr->reserved[2] != expected->use)
+ {
+ printf ("expected data did not match\n");
+ printf ("a=%s e=%s a=%d e=%d a=%d e=%d\n",
+ dptr->x_name, expected->name,
+ dptr->file_ds, expected->fd, dptr->reserved[2], expected->use);
+#ifdef VERBOSE
+ printf("Found: %s, fd: %d, use as: %d, path: %s\n",
+ dptr->x_name, dptr->file_ds, dptr->reserved[2], dptr->path);
+#endif /* VERBOSE */
+ fail++;
+ }
+#ifdef VERBOSE
+ else
+ printf("Found: %s, fd: %d, use as: %d, path: %s\n",
+ dptr->x_name, dptr->file_ds, dptr->reserved[2], dptr->path);
+#endif /* VERBOSE */
+ expected++;
+ dptr++;
+ strcpy(dptr->path,"X*devices:");
+ }
+ *dptr->path = '\0';
+ if (fail==0)
+ {
+ printf("Test case %d succeeded:\n%s\n",i,tc[i].message);
+ }
+ else
+ printf("Test case %d failed: \n%s\n",i,tc[i].message);
+ }
+
+/***********************************************************
+ * find_valid_data
+ *
+ * Validate the data returned by the read routine.
+ */
+
+struct valid *find_valid_data(device_type)
+ {
+ struct valid *v = NULL;
+
+ for (v=all_valid; (v->id != 0 && v->id != device_type); v++)
+ ;
+ return v;
+ }
+
+/***********************************************************
+ * test_read_entry_point
+ *
+ * Test the read() entry point of the HIL device driver.
+ */
+
+test_read_entry_point(s, d)
+ SerialProcs *s;
+ HPInputDeviceHeader *d;
+ {
+ int i, size, ndx, ret, status, nbytes=0, count=0, mask;
+ unsigned char buf[128];
+ unsigned char data_type=0, device_type = d->min_kcode;
+ struct valid *v = find_valid_data(device_type);
+
+ generate_test_data (d->file_ds, FALSE, device_type);
+ status = (*(s->read)) (d->file_ds, buf, &data_type, &nbytes);
+ if (status != READ_FAILURE)
+ if (device_type == X_KB_US || device_type == X_BUTTONBOX)
+ printf("No READ_FAILURE w/bogus data for device %s\n",d->x_name);
+ else if (nbytes != 0)
+ printf("No READ_FAILURE w/bogus data for device %s\n",d->x_name);
+ (*(s->close)) (d->file_ds);
+ status = (*(s->read)) (d->file_ds, buf, &data_type, &nbytes);
+ (*(s->configure)) (d);
+ generate_test_data (d->file_ds, TRUE, device_type);
+ mask = 1 << d->file_ds;
+ ndx = 0;
+ while ((ret = usleep (1000, (d->file_ds + 1), &mask)) > 0)
+ while ((ret = (*(s->read)) (d->file_ds, buf, &data_type, &nbytes))==READ_SUCCESS)
+ {
+ if (nbytes == 0)
+ continue;
+ size = v->size ? v->size : v->vdata[ndx++];
+
+ if (!(data_type & v->dtype) || nbytes != size ||
+ !validate_data (buf, &v->vdata[ndx], nbytes))
+ {
+ printf("Invalid data: type = %x (%x), size = %d (%d) data = ",
+ data_type, v->dtype, nbytes, size);
+ for (i=0; i<nbytes; i++)
+ printf ("%x (%x) ", buf[i], v->vdata[ndx+i]);
+ printf ("\n");
+ }
+#ifdef VERBOSE
+ else
+ printf("data matched\n");
+#endif /* VERBOSE */
+ count++;
+ ndx += nbytes;
+ data_type = nbytes = buf[0] = 0;
+ }
+ }
+
+/***********************************************************
+ * validate_data
+ *
+ * Validate the data returned by the read routine.
+ */
+
+validate_data (actual, expected, size)
+ unsigned char *actual, *expected;
+ {
+ int i;
+
+ for (i=0; i<size; i++)
+ if (*actual != *expected)
+ return 0;
+ return 1;
+ }
+
+/***********************************************************
+ * generate_test_data
+ *
+ * Cause the child process to generate test data.
+ */
+
+generate_test_data (fd, valid, data_type)
+ char data_type;
+ {
+
+ struct mydata foo;
+
+ foo.type = data_type;
+ foo.valid = valid;
+
+ ioctl(fd, TPSENDD, &foo);
+ usleep(50000, 0, NULL);
+ }
+
+
+/***********************************************************
+ * test_write_entry_point
+ *
+ * Test the write() entry point of the HIL device driver.
+ */
+
+test_write_entry_point(s, dptr)
+ SerialProcs *s;
+ HPInputDeviceHeader *dptr;
+ {
+ int status;
+ HPKeyboardFeedbackControl kctl;
+ HPPointerFeedbackControl pctl;
+ HPBell bctl;
+ HPValuatorControl vctl;
+ HPResolutionControl rctl;
+
+ /* Test XChangeFeedbackControl */
+
+ kctl.class = 0xff;
+ kctl.bell_percent = 100;
+ kctl.bell_pitch = 0;
+ kctl.bell_duration = 400;
+ kctl.leds = -1;
+ kctl.autoRepeat = AutoRepeatModeOff;
+ status = (*(s->write)) (dptr->file_ds, _XChangeFeedbackControl, &kctl);
+ kctl.class = KbdFeedbackClass;
+
+ kctl.class = KbdFeedbackClass;
+ kctl.click = 100;
+ status = (*(s->write)) (dptr->file_ds, _XChangeFeedbackControl, &kctl);
+ kctl.bell_pitch = 100;
+ kctl.autoRepeat = AutoRepeatModeDefault;
+ kctl.leds = 0;
+ status = (*(s->write)) (dptr->file_ds, _XChangeFeedbackControl, &kctl);
+ kctl.autoRepeat = AutoRepeatModeOn;
+ status = (*(s->write)) (dptr->file_ds, _XChangeFeedbackControl, &kctl);
+ kctl.autoRepeat = -2;
+ status = (*(s->write)) (dptr->file_ds, _XChangeFeedbackControl, &kctl);
+
+ /* Test XBell */
+
+ bctl.class = BellFeedbackClass;
+ bctl.bell_percent = 100;
+ status = (*(s->write)) (dptr->file_ds, _XBell, &bctl);
+ kctl.click = 0;
+ status = (*(s->write)) (dptr->file_ds, _XBell, &kctl);
+
+ /* Test XSetDeviceValuators */
+
+ vctl.first_valuator = 0;
+ vctl.num_valuators = 0;
+ vctl.valuators = NULL;
+ status = (*(s->write)) (dptr->file_ds, _XSetDeviceValuators, &vctl);
+
+ /* Test XChangeDeviceControl */
+
+ rctl.first_valuator = 0;
+ rctl.num_valuators = 0;
+ rctl.resolutions = NULL;
+ status = (*(s->write)) (dptr->file_ds, _XChangeDeviceControl, &rctl);
+
+ /* Test XSetDeviceMode */
+
+ status = (*(s->write)) (dptr->file_ds, _XSetDeviceMode, Absolute);
+ status = (*(s->write)) (dptr->file_ds, _XSetDeviceMode, Relative);
+ (*(s->close)) (dptr->file_ds);
+ status = (*(s->write)) (dptr->file_ds, _XSetDeviceMode, Relative);
+ (*(s->configure)) (dptr);
+
+ status = (*(s->write)) (dptr->file_ds, -1, &kctl);
+ }
+
+/***********************************************************
+ * GetPty
+ *
+ * Search through all of the ptys looking for one that
+ * can be opened on the master side. Return when one
+ * is successfully opened.
+ *
+ * On the master side, ptys have names in the range
+ * /dev/ptyp0 ... /dev/ptyvf. The last digit varies from
+ * 0 ... f, and the last alphabetic character varies from
+ * p ... v. Therefore, there are 16 * 7 = 112 ptys.
+ *
+ * The names on the slave side are the same as the master
+ * side, except that they are /dev/tty rather than /dev/pty.
+ ***********************************************************/
+
+#define NUMPTYS 112
+
+int
+GetPty(SlaveName)
+char * SlaveName;
+{
+ int NextPty = 0;
+ char MasterName[50];
+ int Fd;
+
+ for (NextPty=0; NextPty<NUMPTYS; NextPty++)
+ {
+ sprintf (SlaveName,"/dev/pty/tty%c%x",NextPty/16+'p',NextPty%16);
+ sprintf (MasterName,"/dev/ptym/pty%c%x",NextPty/16+'p',NextPty%16);
+ if (( Fd = open(MasterName,O_RDWR | O_NDELAY )) != -1)
+ {
+ SelectMask |= 1 << Fd;
+ MaxOpen = max( MaxOpen, Fd );
+ BaseFiledescriptor = min( BaseFiledescriptor, Fd );
+ return (Fd);
+ }
+ }
+ printf( "GetPty: cannot open any of the pty's.\n");
+ exit( 1 );
+}
+
+
+/***********************************************************
+ * SetupDevice
+ *
+ * This routine finds an available pty, then links
+ * the pty symbolically to an X0devices name in /tmp.
+ *
+ * The name is created in /tmp, using the hostname and the number
+ * of the HIL device being emulated.
+ ***********************************************************/
+
+void
+SetupDevice( hilnum )
+int hilnum;
+{
+ int rc;
+ struct request_info iostuff;
+ char TruncHost[1024];
+
+ strcpy (TruncHost, Hostname);
+ strtok (TruncHost, ".");
+ sprintf( hil[hilnum].PtyName, "%s%s:hil%d", PTY_DIR, TruncHost, hilnum+1 );
+ /*
+ * Find an available pty
+ */
+ hil[hilnum].Pty = GetPty (hil[hilnum].SlaveName);
+
+ /* Trap ioctls on pty. These are HILID, HILDKR and HILER1 */
+
+ rc = 1; /* Trap ioctls on pty */
+ if ( ioctl( hil[hilnum].Pty, TIOCTRAP, &rc) == -1)
+ {
+ perror( "SetupDevice: couldn't TIOCTRP pty");
+ exit( 1 );
+ }
+
+ rc = 1; /* Disable termio processing */
+ if ( ioctl( hil[hilnum].Pty, TIOCTTY, &rc) == -1)
+ {
+ perror( "SetupDevice: couldn't TIOCTTY pty");
+ exit( 1 );
+ }
+
+ /*
+ * block client signals while the ioctl is being handled
+ */
+ if (ioctl( hil[hilnum].Pty, TIOCSIGMODE, TIOCSIGBLOCK) == -1)
+ {
+ perror( "SetupDevice: couldn't TIOCSIGBLOCK pty");
+ exit( 1 );
+ }
+ /*
+ * clean up any old symlinks and link to our pty
+ */
+ unlink( hil[hilnum].PtyName);
+ if ( symlink (hil[hilnum].SlaveName, hil[hilnum].PtyName ))
+ {
+ perror( "SetupDevice: couldn't link pty");
+ printf( "SetupDevice: ln %s %s\n",
+ hil[hilnum].SlaveName, hil[hilnum].PtyName);
+ exit( 1 );
+ }
+}
+
+struct HilDeviceInfo * FindHilInfo();
+
+/***********************************************************
+ * FindHilInfo
+ *
+ * Search the HIL device information table for
+ * information about the given device type.
+ *
+ ***********************************************************/
+struct HilDeviceInfo *
+FindHilInfo( Type )
+unsigned char Type;
+{
+ struct HilDeviceInfo * pInfo = DeviceTable;
+
+ while ( pInfo->id != 0 )
+ {
+ if ( pInfo->id == Type )
+ return( pInfo );
+ pInfo++;
+ }
+ printf( "Hil.c: FindHilInfo: requested type %x not in DeviceTable.\n", Type);
+ exit( 1 );
+}
+
+/***********************************************************
+ * SetupHILDevices
+ *
+ * Loop through the array that defines the
+ * HIL devices to be emulated. For each device,
+ * obtain a pty to use to emulate the device.
+ * Then associate a HIL device information table entry with
+ * the HIL loop position.
+ *
+ ***********************************************************/
+
+SetupHILDevices( LoopDefinitionArray )
+unsigned char LoopDefinitionArray[];
+{
+ int i;
+ int Type;
+ for ( i = 0; i < NUM_DEVS; i++ )
+ {
+ Type = LoopDefinitionArray[i];
+ if ( Type == 0 )
+ break;
+ SetupDevice( i );
+ hil[i].pHilDeviceInfo = FindHilInfo( Type );
+ }
+}
+
+/***********************************************************
+ * LogHilCommand
+ *
+ * Log the command for the particular device.
+ * This log can later be scanned to see if a particular
+ * command was sent by the server.
+ *
+ * The log is kept in a singly linked list. The
+ * initial pointer to the list is indexed by the hil number,
+ * so as to keep the logs for the devices distinct.
+ *
+ ***********************************************************/
+
+LogHilCommand( hilnum, Command )
+int hilnum;
+int Command;
+{
+ if ( hil[ hilnum ].pLast == NULL )
+ {
+ hil[ hilnum ].pLast = ( struct HilCommandLog * )
+ malloc( sizeof( struct HilCommandLog ));
+ hil[ hilnum ].pLast->pNext = 0;
+ hil[ hilnum ].pLast->Command = Command;
+
+ hil[ hilnum ].pNext = hil[ hilnum ].pLast;
+ }
+ else
+ {
+ struct HilCommandLog * pTemp;
+
+ pTemp = hil[ hilnum ].pLast;
+ hil[ hilnum ].pLast = ( struct HilCommandLog * )
+ malloc( sizeof( struct HilCommandLog ));
+ hil[ hilnum ].pLast->Command = Command;
+ hil[ hilnum ].pLast->pNext = 0;
+ pTemp->pNext = hil[ hilnum ].pLast;
+ }
+}
+
+/*************************************************************
+ * PrintHilCommand
+ *
+ * This function prints the mnemonic for an HIL command
+ * or the several standard PTY commands.
+ *
+ *************************************************************/
+
+void
+PrintHilCommand( hilnum, cmd )
+int hilnum;
+int cmd;
+{
+ struct _hilCommands *hp;
+
+ for ( hp = hilArray; hp->HilCommand; hp++ )
+ {
+ if ( hp->HilCommand == cmd )
+ {
+ printf("hil: %d command: 0x%4X %s\n",
+ hilnum, cmd, hp->HilCommandName );
+ break;
+ }
+ }
+ if ( hp->HilCommand == 0 )
+ printf("hil: %d command: 0x%4X %s\n", hilnum, cmd, "UNKNOWN" );
+
+}
+
+/***********************************************************
+ * HandShakeDevice
+ *
+ * Handle an ioctl request from the driver.
+ * Use ioctl to send back the correct data.
+ *
+ ***********************************************************/
+
+struct mydata foo;
+
+void
+HandshakeDevice( hilnum )
+int hilnum;
+{
+ struct request_info iostuff;
+ unsigned char * pIdInfo;
+ /*
+ * find out what the HIL request is
+ */
+ ioctl (hil[hilnum].Pty, TIOCREQGET, &iostuff);
+
+ /*PrintHilCommand( hilnum, iostuff.request ); */
+ LogHilCommand( hilnum, iostuff.request );
+
+ switch( iostuff.request )
+ {
+ case HILID:
+
+ if (iostuff.argset == 0 )
+ {
+ printf( "HandshakeDevice: argset is zero on HILID.\n");
+ exit( 1 );
+ }
+
+ if (hil[hilnum].pHilDeviceInfo->id == X_ERROR_DEVICE)
+ iostuff.return_value = -1;
+ pIdInfo = hil[ hilnum ].pHilDeviceInfo->pHilIdString;
+ ioctl (hil[hilnum].Pty, iostuff.argset, pIdInfo );
+
+
+ break;
+ case TCGETA:
+
+ if (iostuff.argset == 0 )
+ {
+ printf( "HandshakeDevice: argset is zero on TCGETA.\n");
+ exit( 1 );
+ }
+
+ ioctl (hil[hilnum].Pty, iostuff.argset, tcget_info );
+ break;
+ case TIOCOPEN:
+ case TIOCCLOSE:
+ case HILER1:
+ case HILER2:
+ case HILDKR:
+ case HILP:
+ case HILP1:
+ case HILP2:
+ case HILP3:
+ case HILP4:
+ case HILP5:
+ case HILP6:
+ case HILP7:
+ case HILA:
+ case HILA1:
+ case HILA2:
+ case HILA3:
+ case HILA4:
+ case HILA5:
+ case HILA6:
+ case HILA7:
+ break;
+ case TPSENDD:
+ ioctl (hil[hilnum].Pty, iostuff.argget, &foo);
+ send_test_data (hil[hilnum].Pty, foo.valid, foo.type);
+ break;
+ case TPSTOPIT:
+ CloseAllHilDevices();
+ exit(1);
+ break;
+ default:
+ printf( "HandshakeDevice: default command %x.\n",iostuff.request);
+ }
+ if (ioctl (hil[hilnum].Pty, TIOCREQSET, &iostuff) < 0 )
+ {
+ perror( "HandshakeDevice: error on TIOCREQSET" );
+ printf( "HandshakeDevice: errno %d\n", errno);
+ exit( 1 );
+ }
+}
+
+/***********************************************************
+ * CloseAllHilDevices
+ *
+ * This routine closes all the opened HIL devices
+ ***********************************************************/
+
+void
+CloseAllHilDevices()
+{
+ int i;
+
+ for ( i = 0; i < NUM_DEVS; i++ )
+ if ( hil[ i ].Pty )
+ {
+ close( hil[ i ].Pty );
+ hil[ i ].Pty = 0;
+ unlink( hil[ i ].PtyName);
+ }
+}
+
+/*************************************************************
+ * SignalHandler
+ *
+ * Handle receipt of a signal. In current use, this generally
+ * means that this process has been hit by kfork. Kfork
+ * sends SIGTERM by default.
+ *
+ * ACTION: try to shut down the server, if it is connected,
+ * by sending control-shift-reset. Then close all the pty's,
+ * unlink them, shutdown and close the sockets, and exit
+ * gracefully.
+ *************************************************************/
+
+void
+SignalHandler()
+{
+ CloseAllHilDevices();
+ exit( 0 );
+}
+
+/*
+ * int usleep(unsigned long microseconds, int nfds, int *readmask)
+ * This is a microsecond "sleep" routine. It uses the select(2) system
+ * call to delay for the desired number of micro-seconds.
+ *
+ * Arguments:
+ * unsigned long microseconds Number of microseconds to pause.
+ *
+ * Return value:
+ * int 0 on successful completion, -1 otherwise.
+ *
+ * Side effects:
+ * Program pause based upon argument value.
+ *
+ * Calls:
+ * select(2).
+ */
+int
+usleep(microseconds, nfds, readmask)
+register unsigned long microseconds;
+register int nfds, *readmask;
+
+{
+ register unsigned int seconds, usec;
+ int writefds, exceptfds;
+ struct timeval timer;
+
+ writefds = exceptfds = 0;
+
+ /* Convert to values select() understands */
+ seconds = microseconds / (unsigned long)1000000;
+ usec = microseconds % (unsigned long)1000000;
+
+ timer.tv_sec = seconds;
+ timer.tv_usec = usec;
+
+ return (select(nfds, readmask, &writefds, &exceptfds, &timer));
+}
+
+send_test_data (pty, valid, type)
+ unsigned char type;
+ {
+ switch (type)
+ {
+ case X_KB_US:
+ if (valid)
+ write(pty, valid_key_data, sizeof(valid_key_data));
+ else
+ write(pty, bogus_key_data, sizeof(bogus_key_data));
+ break;
+ case X_MOUSE_3B:
+ if (valid)
+ write(pty, valid_mouse_data, sizeof(valid_mouse_data));
+ else
+ write(pty, bogus_mouse_data, sizeof(bogus_mouse_data));
+ break;
+ case X_MOUSE_2B:
+ if (valid)
+ write(pty, valid_mouse_data2, sizeof(valid_mouse_data2));
+ else
+ write(pty, bogus_mouse_data2, sizeof(bogus_mouse_data2));
+ break;
+ case X_TABLET_ASIZE:
+ case X_TABLET_BSIZE:
+ if (valid)
+ write(pty, valid_tablet_data, sizeof(valid_tablet_data));
+ else
+ write(pty, bogus_tablet_data, sizeof(bogus_tablet_data));
+ break;
+ case X_QUADRATURE:
+ if (valid)
+ write(pty, valid_quad_data, sizeof(valid_quad_data));
+ else
+ write(pty, bogus_quad_data, sizeof(bogus_quad_data));
+ break;
+ case X_TOUCHSCREEN:
+ if (valid)
+ write(pty, valid_mouse_data, sizeof(valid_mouse_data));
+ else
+ write(pty, bogus_mouse_data, sizeof(bogus_mouse_data));
+ break;
+ case X_BARCODE:
+ if (valid)
+ write(pty, valid_barcode_data, sizeof(valid_barcode_data));
+ else
+ write(pty, bogus_barcode_data, sizeof(bogus_barcode_data));
+ break;
+ case X_NINE_KNOB:
+ if (valid)
+ write(pty, valid_9knob_data, sizeof(valid_9knob_data));
+ else
+ write(pty, bogus_9knob_data, sizeof(bogus_9knob_data));
+ break;
+ case X_ONE_KNOB:
+ if (valid)
+ write(pty, valid_1knob_data, sizeof(valid_1knob_data));
+ else
+ write(pty, bogus_1knob_data, sizeof(bogus_1knob_data));
+ break;
+ case X_ONE_AXIS:
+ if (valid)
+ write(pty, valid_one_axes_data, sizeof(valid_one_axes_data));
+ else
+ write(pty, bogus_one_axes_data, sizeof(bogus_one_axes_data));
+ break;
+ case X_NO_AXES:
+ if (valid)
+ write(pty, valid_no_axes_data, sizeof(valid_no_axes_data));
+ else
+ write(pty, bogus_no_axes_data, sizeof(bogus_no_axes_data));
+ break;
+ case X_THREE_AXES:
+ if (valid)
+ write(pty, valid_three_axes_data, sizeof(valid_three_axes_data));
+ else
+ write(pty, bogus_three_axes_data, sizeof(bogus_three_axes_data));
+ break;
+ }
+ }
+#endif /* DEBUG */
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2k.c b/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2k.c
new file mode 100644
index 000000000..92c8c0bb7
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2k.c
@@ -0,0 +1,406 @@
+/* $XConsortium: hp7lc2k.c /main/2 1996/12/04 10:23:28 lehors $ */
+/************************************************************
+
+Copyright (c) 1993 by Hewlett-Packard Company, Palo Alto, California
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "ps2io.h"
+#include <X11/X.h>
+#include <X11/extensions/XI.h>
+#include "x_serialdrv.h"
+
+/**************************************************************************
+ *
+ * hp7lc2k.c - X server input device driver.
+ *
+ * This driver provides support for PS2 keyboards attached to an HP9000700LC2
+ * via the internal mini-DIN interface.
+ *
+ * The HP-UX 9.03 operating system is required by this driver.
+ *
+ * If another device is used as the X keyboard, the PS2 keyboard attached to
+ * the mini-DIN interface can be accessed via the X input device extension
+ * by adding the following lines to the /usr/lib/X11/X0devices file:
+ *
+ * Begin_Device_Description
+ * Name hp7lc2k.sl # PS2 DIN keyboard via mini-DIN interface
+ * Use Extension # access via input extension
+ * Path /dev/ps2kbd # use device special file /dev/ps2kbd
+ * End_Device_Description
+ *
+ * For documentation on using serial input devices with X, please refer
+ * to the manual "Using the X Window System", Chapter 3 "Preliminary
+ * Configuration", in the section titled "Using Special Input Devices".
+ *
+ * Sample entries for the /usr/lib/X11/X*devices file can be found in
+ * /etc/newconfig/X0devices.
+ *
+ */
+
+#define BUFRSIZ 2048
+#define READSIZ 2000
+
+static int hp7lc2k_left=READSIZ, hp7lc2k_datacnt=0;
+static unsigned char hp7lc2k_buf[BUFRSIZ];
+static unsigned char *hp7lc2k_data_ptr = hp7lc2k_buf;
+typedef struct ps2_4 ps2_buffer_t;
+
+/**************************************************************************
+ *
+ * Configure the PS/2 keyboard. Use scancode set 3, Turn indicator LEDs
+ * off, set all keys to typematic make/break, and set autorepeat to ~30/sec
+ * and delay to 250 mSec.
+ */
+
+static int
+keybd_configure (
+ int fd)
+ {
+ ps2_buffer_t kbdbuf;
+
+ /* use scancode set 3 */
+
+ kbdbuf.b[0] = SCANCODE_3;
+ ioctl (fd, PS2_SCANCODE, &kbdbuf);
+
+ /* turn LEDs off */
+
+ kbdbuf.b[0] = 0;
+ ioctl (fd, PS2_INDICATORS, &kbdbuf);
+
+ /* set all keys to typematic and make/break */
+
+ ioctl (fd, PS2_ALL_TMAT_MKBRK, &kbdbuf);
+
+ /* set the autorepeat rate to the maximum (~30/sec) and the delay to the
+ minimum (250ms) */
+
+ kbdbuf.b[0] = 0x00;
+ ioctl (fd, PS2_RATEDELAY, &kbdbuf);
+
+ } /* end keybd_configure() */
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to open and configure the device.
+ * It is passed a pointer to an HPDeviceHeader struct (defined in
+ * x_serialdrv.h). That struct points to the path name of the device file
+ * to which the input device is connected. The path is specified in the
+ * X*devices configuration file described above.
+ *
+ * This routine must open the device file and configure the serial port.
+ * It must initialize fields in the HPInputDeviceHeader struct including
+ * the device file descriptor, name by which the device will be known to
+ * X, the number of keys, buttons, and axes on the device, the keymap name
+ * and file, if the device has keys, and a flags field that specifies the
+ * size of the data returned by the device. See the serial input device
+ * specification described above for more details.
+ *
+ */
+
+static int
+hp7lc2kconfigure (
+ HPInputDeviceHeader *d)
+ {
+ int ret;
+ ps2_buffer_t kbdbuf;
+ static unsigned char num_leds=3;
+ static char hp7lc2k_namebuf[128];
+ FILE *fp;
+
+ d->file_ds = open (d->path, O_RDWR | O_NDELAY);/* non-block read */
+ if (d->file_ds < 0)
+ return(INIT_FAILURE);
+
+ keybd_configure (d->file_ds);
+
+ /* get the keyboard nationality, or default to US_English */
+
+ d->keymap_name = "PS2_DIN_US_English"; /* default keymap name */
+ fp = fopen (X_KEYMAP_NAME, "r"); /* defined by x_serialdrv.h */
+ if (fp && fscanf (fp, "%s", hp7lc2k_namebuf))
+ d->keymap_name = hp7lc2k_namebuf;/* international keymap name */
+ fclose(fp);
+
+ d->x_name = "PS2_DIN_KEYBOARD"; /* device name for X server*/
+ d->keymap_file = ""; /* keymap file for X server*/
+ d->flags = DATA_IS_16_BITS; /* size of data for device */
+ d->num_keys = 101; /* tell server we have keys*/
+ d->min_kcode = 0; /* server gets from keymap */
+ d->max_kcode = 0; /* server gets from keymap */
+ d->num_ledf = 1; /* number of led feedbacks */
+ d->ledf = &num_leds; /* number of leds */
+ d->reset = 107; /* X server reset keycode */
+ d->reset_mods = ShiftMask | ControlMask; /* X server reset modifiers*/
+
+ return (INIT_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * Get more data and crunch the buffer if we're getting near the end.
+ *
+ */
+
+static int get_more_data(
+ int fd)
+ {
+ int count;
+
+ /* If we don't already have at least 1 byte of data,
+ * we need to read some. If we're getting near the end
+ * of the buffer, copy the leftover data to the beginning
+ * of the buffer.
+ */
+
+ if (hp7lc2k_data_ptr - hp7lc2k_buf > hp7lc2k_datacnt)
+ {
+ bcopy (hp7lc2k_data_ptr, hp7lc2k_buf, hp7lc2k_datacnt);
+ hp7lc2k_data_ptr = hp7lc2k_buf;
+ hp7lc2k_left = READSIZ - hp7lc2k_datacnt;
+ }
+ count = read (fd, hp7lc2k_data_ptr + hp7lc2k_datacnt, hp7lc2k_left);
+
+ if (count >0)
+ {
+ hp7lc2k_datacnt += count;
+ hp7lc2k_left -= count;
+ }
+
+ if (hp7lc2k_datacnt < 1)
+ return(READ_FAILURE);
+
+ return(READ_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This entry point is called when the X server detects that there is data
+ * available to be read from the device. This routine will be called
+ * repeatedly until it returns READ_FAILURE. It is expected to return
+ * one "event" for each successful call. An "event" is one key press or
+ * release, one button press or release, one change in axis data, or one
+ * change of proximity state. One change in axis data can be reported
+ * along with a button or proximity change.
+ *
+ */
+
+static int
+hp7lc2kread (
+ int fd, unsigned char *data, unsigned char *data_type, int *pending)
+ {
+ struct timeval timeout;
+ unsigned short code, keycode;
+ int count;
+
+ get_more_data(fd);
+ if (hp7lc2k_datacnt < 1)
+ return(READ_FAILURE);
+
+ /* PS2 keyboards return 1-byte scancode for keypresses, and a 1 byte
+ * constant followed by that same scancode for keyreleases.
+ * The X server expects key releases to have the value of the
+ * key press + 1, so we must multiply key codes by 2, and add 1 to the
+ * key releases.
+ *
+ * The minimum key code returned by the kernel is 7, but the minimum
+ * expected by the keymap is 16. Since the X server will also add 8 to
+ * the keycode after dividing by 2, to avoid the codes reserved by X for
+ * mouse buttons, we must add 1 before multiplying.
+ */
+
+ if (*hp7lc2k_data_ptr == 0xF0) { /* this is a key release */
+ if (hp7lc2k_datacnt == 1){ /* code hasn't arrived */
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 25000; /* wait interval */
+ select(0, (int *)NULL, (int *)NULL, (int *)NULL, &timeout);
+ get_more_data(fd);
+ if (hp7lc2k_datacnt < 1)
+ return(READ_FAILURE);
+ }
+ code = *(hp7lc2k_data_ptr+1); /* keycode is second byte */
+ keycode = (code + 1) * 2 + 1; /* add 1, double it, add 1 */
+ hp7lc2k_datacnt-=2;
+ hp7lc2k_data_ptr+=2;
+ }
+ else {
+ code = *hp7lc2k_data_ptr;
+ keycode = (code + 1) * 2; /* add 1, double it */
+ hp7lc2k_datacnt-=1;
+ hp7lc2k_data_ptr+=1;
+ }
+
+ if (code == 0xAA) { /* keyboard has reset itself */
+ keybd_configure (fd); /* reconfigure the keyboard */
+ hp7lc2k_datacnt=0; /* reset the data count */
+ hp7lc2k_data_ptr = hp7lc2k_buf; /* reset the data pointer */
+ return(READ_FAILURE);
+ }
+ *data++ = keycode;
+ *data = keycode >> 8;
+ *data_type = KEY_DATA; /* tell X it's key data */
+ *pending = 2; /* two bytes are returned */
+ return(READ_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to write to the keyboard.
+ * It is called when an X request is made that causes a write to an input
+ * device.
+ *
+ * See the file x_serialdrv.h for the format of the data for each request.
+ *
+ * The only one we will support is _XChangeFeedbackControl, which is used
+ * to turn on LEDs.
+ *
+ */
+
+static int
+hp7lc2kwrite (
+ int fd, int request, char *data)
+ {
+ int i;
+ HPKeyboardFeedbackControl *ctrl;
+ ps2_buffer_t kbdbuf;
+
+ switch (request)
+ {
+ case _XChangeFeedbackControl:
+ ctrl = (HPKeyboardFeedbackControl *) data;
+
+ if (ctrl->class != KbdFeedbackClass)
+ return(WRITE_FAILURE);
+ kbdbuf.b[0] = 0;
+ if (ctrl->leds & SCROLLLOCK_LED) {
+ kbdbuf.b[0] |= SCROLL_LED;
+ }
+ if (ctrl->leds & NUMLOCK_LED) {
+ kbdbuf.b[0] |= NUM_LED;
+ }
+ if (ctrl->leds & CAPSLOCK_LED) {
+ kbdbuf.b[0] |= CAPS_LED;
+ }
+ ioctl (fd, PS2_INDICATORS, &kbdbuf);
+
+ if (ctrl->autoRepeat == AutoRepeatModeOff)
+ ioctl (fd, PS2_ALL_MKBRK, &kbdbuf);
+ else
+ ioctl (fd, PS2_ALL_TMAT_MKBRK, &kbdbuf);
+ break;
+ case _XSetDeviceValuators:
+ case _XChangeDeviceControl:
+ case _XSetDeviceMode:
+ default:
+ return(WRITE_FAILURE);
+ break;
+ }
+ return(WRITE_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to close an input device.
+ *
+ */
+
+static int
+hp7lc2kclose (
+ int fd)
+ {
+ close (fd);
+ return (CLOSE_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This routine is called to initialize the entry point vector for this
+ * serial input device driver.
+ *
+ */
+
+int
+hp7lc2k_Init(
+ SerialProcs *serialproc)
+ {
+ serialproc->configure = hp7lc2kconfigure;/* routine to init device */
+ serialproc->read = hp7lc2kread; /* routine to read from dev */
+ serialproc->write = hp7lc2kwrite; /* routine to write to dev */
+ serialproc->close = hp7lc2kclose; /* routine to close device */
+ return INIT_SUCCESS; /* indicate success */
+ }
+
+#ifdef DEBUG
+main()
+ {
+ int fd;
+
+ makedata(); /* make the test data */
+ fd = open ("data", O_RDWR);
+ process_test_data(fd);
+ close(fd);
+ }
+
+/* The PS2 keyboard returns one byte per key press and two bytes per key release.
+ * The keycode is the same in each case.
+ *
+ * Byte 0:
+ * scancode for key press, 0xF0 for key release.
+ * Byte 1:
+ * scancode for key release.
+ */
+
+makedata ()
+ {
+ int i, fd;
+ unsigned char buf[3];
+
+ fd = creat("data", 0777);
+ for (i=7; i<256; i++)
+ {
+ buf[0]=i;
+ buf[1]=0xF0;
+ buf[2]=i;
+ write (fd,buf,3);
+ }
+ close(fd);
+ }
+
+process_test_data(fd)
+ {
+ unsigned char data[32], data_type;
+ int pending;
+
+ hp7lc2kread (fd, data, &data_type, &pending);
+ while (pending > 0)
+ {
+ printf ("%d bytes returned, type is %x, data is %x %x\n", pending, data_type,
+ data[0], data[1]);
+ pending = 0;
+ data[0] = data[1] = 0;
+ hp7lc2kread (fd, data, &data_type, &pending);
+ }
+ }
+#endif /* DEBUG */
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2m.c b/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2m.c
new file mode 100644
index 000000000..52709a1ec
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/hp7lc2m.c
@@ -0,0 +1,934 @@
+/* $XConsortium: hp7lc2m.c /main/2 1996/12/04 10:23:42 lehors $ */
+/************************************************************
+
+Copyright (c) 1992 by Hewlett-Packard Company, Palo Alto, California
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "ps2io.h"
+#include <X11/extensions/XI.h>
+#include "x_serialdrv.h"
+
+/**************************************************************************
+ *
+ * hp7lc2m.c - X server input device driver.
+ *
+ * This driver provides support for PS2 mice attached to an HP9000700LC2
+ * via the internal mini-DIN interface.
+ *
+ * The HP-UX 9.03 operating system is required by this driver.
+ *
+ * If another device is used as the X pointer, the PS2 mouse attached to
+ * the mini-DIN interface can be accessed via the X input device extension
+ * by adding the following lines to the /usr/lib/X11/X0devices file:
+ *
+ * Begin_Device_Description
+ * Name hp7lc2m.sl # PS2 DIN keyboard via mini-DIN interface
+ * Use Extension # access via input extension
+ * Path /dev/ps2mouse # use device special file /dev/ps2mouse
+ * End_Device_Description
+ *
+ * For documentation on using serial input devices with X, please refer
+ * to the manual "Using the X Window System", Chapter 3 "Preliminary
+ * Configuration", in the section titled "Using Special Input Devices".
+ *
+ * Sample entries for the /usr/lib/X11/X*devices file can be found in
+ * /etc/newconfig/X0devices.
+ *
+ */
+
+#define BUFRSIZ 2048
+#define READSIZ 2000
+#define PKT_SIZ 3
+#define BUTTON1_AND_2 0x05
+#define BUTTON2_AND_3 0x06
+#define BUTTON1_AND_3 0x03
+#define BUTTON_BITS 0x07
+#define ONE_BUTTON_DOWN -1
+#define ILLEGAL_COMBO -2
+
+static int hp7lc2m_left=READSIZ, hp7lc2m_datacnt=0;
+static unsigned char hp7lc2m_buf[BUFRSIZ];
+static unsigned char *hp7lc2m_data_ptr = hp7lc2m_buf;
+static unsigned int hp7lc2m_buttonmask;
+static unsigned int hp7lc2m_chording_button = 0;
+static unsigned int hp7lc2m_chording_interval = 0;
+static int process_button(), do_button_chording(), get_more_data(), check_combo ();
+typedef struct ps2_4 ps2_buffer_t;
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to open and configure the device.
+ * It is passed a pointer to an HPDeviceHeader struct (defined in
+ * x_serialdrv.h). That struct points to the path name of the device file
+ * to which the input device is connected. The path is specified in the
+ * X*devices configuration file described above.
+ *
+ * This routine must open the device file and configure the serial port.
+ * It must initialize fields in the HPInputDeviceHeader struct including
+ * the device file descriptor, name by which the device will be known to
+ * X, the number of keys, buttons, and axes on the device, the keymap name
+ * and file, if the device has keys, and a flags field that specifies the
+ * size of the data returned by the device. See the serial input device
+ * specification described above for more details.
+ *
+ */
+
+static int
+hp7lc2mconfigure (
+ HPInputDeviceHeader *d)
+ {
+ int ret;
+ ps2_buffer_t mousebuf;
+
+ d->file_ds = open (d->path, O_RDWR | O_NDELAY);/* non-block read */
+ if (d->file_ds < 0)
+ return(INIT_FAILURE);
+
+ if (d->button_chording)
+ hp7lc2m_chording_interval = d->button_chording;
+
+ /* set the sample rate to 100 reports/second max */
+
+ ioctl (d->file_ds, PS2_DISABLE);
+ ioctl (d->file_ds, PS2_RESET);
+ mousebuf.b[0] = SAMPLE_60;
+ ioctl (d->file_ds, PS2_SAMPLERATE, &mousebuf);
+
+ /* put the mouse into stream mode */
+
+ mousebuf.b[0] = 0;
+ ioctl (d->file_ds, PS2_STREAMMODE, &mousebuf);
+
+ /* set the mouse resolution to 8 counts/mm */
+
+ mousebuf.b[0] = RES_4;
+ ioctl (d->file_ds, PS2_RESOLUTION, &mousebuf);
+ ioctl (d->file_ds, PS2_ENABLE);
+
+ d->x_name = "PS2_DIN_MOUSE"; /* device name for X server*/
+ d->flags = DATA_IS_8_BITS; /* size of data for device */
+ d->ax_num = 2; /* two axes of motion */
+ if (d->button_chording)
+ d->num_buttons = 5; /* emulate 5 buttons */
+ else
+ d->num_buttons = 3; /* support 3 buttons */
+ d->num_keys =0; /* no keys */
+ d->resolution = 80; /* resolution in counts/cm */
+ d->max_x = 255; /* maximum x value in counts */
+ d->max_y = 255; /* maximum y value in counts */
+
+ return (INIT_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This entry point is called when the X server detects that there is data
+ * available to be read from the device. This routine will be called
+ * repeatedly until it returns READ_FAILURE. It is expected to return
+ * one "event" for each successful call. An "event" is one key press or
+ * release, one button press or release, one change in axis data, or one
+ * change of proximity state. One change in axis data can be reported
+ * along with a button or proximity change.
+ *
+ */
+
+static int
+hp7lc2mread (
+ int fd, unsigned char *data, unsigned char *data_type, int *pending)
+ {
+ int button, data_read=0;
+ unsigned int buttonmask;
+ int count, x, y;
+
+ /* If we don't already have at least PKT_SIZ bytes of data,
+ * we need to read some. If we're getting near the end
+ * of the buffer, copy the leftover data to the beginning
+ * of the buffer.
+ */
+
+ if (hp7lc2m_datacnt < PKT_SIZ && (get_more_data (fd) == READ_FAILURE))
+ return(READ_FAILURE);
+
+ /* The PS2 mouse returns PKT_SIZ bytes for each movement of the mouse or
+ * button press or release. The format of the bytes is as follows:
+ *
+ * Byte 0:
+ * Bit 7 Y data overflow (1 = overflow)
+ * Bit 6 X data overflow (1 = overflow)
+ * Bit 5 Y data sign (1 = negative)
+ * Bit 4 X data sign (1 = negative)
+ * Bit 3 Not used (always 1)
+ * Bit 2 Center button (1 = depressed)
+ * Bit 1 Right button (1 = depressed)
+ * Bit 0 Left button (1 = depressed)
+ * Byte 1:
+ * X coordinate data byte (2's compliment)
+ * Byte 2:
+ * Y coordinate data byte (2's compliment)
+ */
+
+ x = (int) hp7lc2m_data_ptr[1];
+ y = -((int) hp7lc2m_data_ptr[2]);
+
+ if (x!=0 || y != 0) {
+ *data_type |= MOTION_DATA;
+ data[0] = x;
+ data[1] = y;
+ data_read = 2;
+ hp7lc2m_data_ptr[1] = 0; /* clear motion for reprocessing case */
+ hp7lc2m_data_ptr[2] = 0; /* clear data for reprocessing case */
+ }
+
+ /* Check to see if a button has changed state */
+ buttonmask = (u_char) (hp7lc2m_data_ptr[0] & BUTTON_BITS);
+ if (buttonmask != hp7lc2m_buttonmask) {
+ if (hp7lc2m_chording_interval) {
+ if ((button = do_button_chording(fd, &buttonmask))>=0) {
+ *data_type |= BUTTON_DATA;
+ data[data_read++] = button;
+ }
+ }
+ else {
+ button = process_button(buttonmask);
+ *data_type |= BUTTON_DATA;
+ data[data_read++] = button;
+ }
+ }
+ if (hp7lc2m_buttonmask == buttonmask) /* no leftover buttons */
+ {
+ hp7lc2m_datacnt -= PKT_SIZ;
+ hp7lc2m_data_ptr += PKT_SIZ;
+ }
+ *pending += data_read;
+ return(READ_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * Process a button from the current data packet.
+ *
+ */
+
+#define hp7lc2_BUTTON1 0x01
+#define hp7lc2_BUTTON2 0x04
+#define hp7lc2_BUTTON3 0x02
+#define NUM_BUTTONS 3
+
+static int process_button(
+ unsigned int buttonmask)
+ {
+ int i, button, bit, down, up;
+
+ button = 1;
+ up = ~buttonmask & hp7lc2m_buttonmask;
+ for (i=0; i<NUM_BUTTONS; i++)
+ {
+ bit = (1 << i);
+ if (bit & up)
+ {
+ switch (bit)
+ {
+ case hp7lc2_BUTTON3:
+ button += 2;
+ case hp7lc2_BUTTON2:
+ button += 2;
+ break;
+ }
+ hp7lc2m_buttonmask = (hp7lc2m_buttonmask & ~bit);
+ return(button);
+ }
+ }
+
+ down = buttonmask & ~hp7lc2m_buttonmask;
+ button = 0;
+ for (i=0; i<NUM_BUTTONS; i++)
+ {
+ bit = (1 << i);
+ if (bit & down)
+ {
+ switch (bit)
+ {
+ case hp7lc2_BUTTON3:
+ button += 2;
+ case hp7lc2_BUTTON2:
+ button += 2;
+ break;
+ }
+ hp7lc2m_buttonmask = (hp7lc2m_buttonmask | bit);
+ return(button);
+ }
+ }
+ }
+
+/**************************************************************************
+ *
+ * Get more data and crunch the buffer if we're getting near the end.
+ *
+ */
+
+static int get_more_data(
+ int fd)
+ {
+ int count;
+
+ if (hp7lc2m_data_ptr - hp7lc2m_buf > hp7lc2m_datacnt)
+ {
+ bcopy (hp7lc2m_data_ptr, hp7lc2m_buf, hp7lc2m_datacnt);
+ hp7lc2m_data_ptr = hp7lc2m_buf;
+ hp7lc2m_left = READSIZ - hp7lc2m_datacnt;
+ }
+ count = read (fd, hp7lc2m_data_ptr + hp7lc2m_datacnt, hp7lc2m_left);
+
+ if (count >0)
+ {
+ hp7lc2m_datacnt += count;
+ hp7lc2m_left -= count;
+ }
+
+ if (hp7lc2m_datacnt < PKT_SIZ)
+ return(READ_FAILURE);
+
+ return(READ_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * Handle button chording.
+ *
+ */
+
+#define BUTTON1_DOWN 0
+#define BUTTON1_UP 1
+#define BUTTON2_DOWN 2
+#define BUTTON2_UP 3
+#define BUTTON3_DOWN 4
+#define BUTTON3_UP 5
+#define BUTTON4_DOWN 6
+#define BUTTON4_UP 7
+#define BUTTON5_DOWN 8
+#define BUTTON5_UP 9
+
+int ignore1, ignore2, ignorecnt;
+
+static int do_button_chording(
+ int fd,
+ unsigned int *buttonmask)
+ {
+ int button, ret;
+ unsigned char *tptr;
+ unsigned int tmask;
+ struct timeval timeout;
+
+ if (hp7lc2m_chording_button) /* waiting for chorded button up */
+ {
+ button = process_button(*buttonmask); /* process one button */
+ if (button % 2) /* odd number means button up */
+ if (button == ignore1) /* up transition of chorded pair */
+ {
+ ignore1= -1; ignorecnt--; /* dont ignore it next time */
+ if (ignorecnt == 0) /* done ignoring buttons */
+ {
+ button = hp7lc2m_chording_button; /* send chorded up */
+ hp7lc2m_chording_button = 0; /* clear saved button */
+ return(button); /* return chorded button */
+ }
+ else
+ return(-1); /* we ignored this one */
+ }
+ else if (button == ignore2) /* other button of chorded pair */
+ {
+ ignore2= -1; ignorecnt--;/* dont ignore it next time */
+ if (ignorecnt == 0) /* done ignoring buttons */
+ {
+ button = hp7lc2m_chording_button; /* send chorded up */
+ hp7lc2m_chording_button = 0; /* clear saved button */
+ return(button); /* return chorded button */
+ }
+ else
+ return(-1); /* we ignored this one */
+ }
+ else
+ return(button); /* not a button to ignore */
+ else
+ return(button); /* button down - dont ignore */
+ }
+ else if (hp7lc2m_buttonmask==0) /* check if chording necessary */
+ {
+ ret = check_combo (*buttonmask);
+ if (ret == ILLEGAL_COMBO) /* illegal combination */
+ return (process_button(*buttonmask)); /* process a button */
+ else if (ret != ONE_BUTTON_DOWN)/* we already chorded */
+ return (ret); /* return chorded button */
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = hp7lc2m_chording_interval * 1000; /* wait interval */
+ select(0, (int *)NULL, (int *)NULL, (int *)NULL, &timeout);
+ get_more_data(fd);
+
+ for (tptr=hp7lc2m_data_ptr+PKT_SIZ;
+ tptr<hp7lc2m_data_ptr+hp7lc2m_datacnt;
+ tptr +=PKT_SIZ)
+ {
+#ifdef DEBUG
+ if (tptr > (hp7lc2m_data_ptr + (3 * PKT_SIZ)))
+ break;
+#endif
+ tmask = (u_char) (*tptr & BUTTON_BITS);
+ if (tmask != *buttonmask) /* a button changed */
+ {
+ if (!(tmask & *buttonmask)) /* a button went up */
+ return (process_button(*buttonmask));
+ if ((ret = check_combo (tmask)) > 0)
+ {
+ if (tmask == hp7lc2m_buttonmask)
+ *buttonmask = hp7lc2m_buttonmask;
+ hp7lc2m_datacnt -= (tptr - hp7lc2m_data_ptr);
+ hp7lc2m_data_ptr = tptr;
+ return (ret);
+ }
+ else
+ return (process_button(*buttonmask));
+ }
+ }
+ return (process_button(*buttonmask));
+ }
+ else /* can't chord - button already down */
+ {
+ return (process_button(*buttonmask));
+ }
+ }
+
+/**************************************************************************
+ *
+ * Check to see if the current data packet indicates more than one button
+ * is down. If so, it is either a valid chording combingation or an
+ * illegal chording combination. If valid, remember which buttons we
+ * need to ignore the first time they go up. If invalid, we won't do
+ * button chording. If only one button is down, we need more data.
+ */
+
+static int check_combo (
+ int buttonmask)
+ {
+ if ((buttonmask & BUTTON1_AND_3) == BUTTON1_AND_3) /* illegal combo */
+ return (ILLEGAL_COMBO);
+ else if ((buttonmask & BUTTON1_AND_2) == BUTTON1_AND_2)
+ {
+ process_button(buttonmask); /* eat one button */
+ process_button(buttonmask); /* eat the other button */
+ hp7lc2m_chording_button = BUTTON4_UP; /* save for up transition */
+ ignore1 = BUTTON1_UP; /* ignore each button up */
+ ignore2 = BUTTON2_UP;
+ ignorecnt = 2;
+ return (BUTTON4_DOWN); /* send the chorded down */
+ }
+ else if ((buttonmask & BUTTON2_AND_3) == BUTTON2_AND_3)
+ {
+ process_button(buttonmask);
+ process_button(buttonmask);
+ hp7lc2m_chording_button = BUTTON5_UP;
+ ignore2 = BUTTON2_UP;
+ ignore1 = BUTTON3_UP;
+ ignorecnt = 2;
+ return (BUTTON5_DOWN);
+ }
+ else
+ return (ONE_BUTTON_DOWN); /* only one button - need more data */
+ }
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to write to the mouse.
+ * It is called when an X request is made that causes a write to an
+ * input device. No requests are supported here.
+ *
+ * See the file x_serialdrv.h for the format of the data for each request.
+ *
+ */
+
+static int
+hp7lc2mwrite (
+ int fd, int request, char *data)
+ {
+ int i;
+ HPPointerFeedbackControl *ctrl;
+ ps2_buffer_t mousebuf;
+
+ switch (request)
+ {
+ case _XChangeFeedbackControl:
+ ctrl = (HPPointerFeedbackControl *) data;
+
+ if (ctrl->class != PtrFeedbackClass)
+ return(WRITE_FAILURE);
+ break;
+ case _XSetDeviceValuators:
+ case _XChangeDeviceControl:
+ case _XSetDeviceMode:
+ default:
+ return(WRITE_FAILURE);
+ break;
+ }
+ return(WRITE_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This routine is called by the X server to close an input device.
+ *
+ */
+
+static int
+hp7lc2mclose (
+ int fd)
+ {
+ close (fd);
+ return (CLOSE_SUCCESS);
+ }
+
+/**************************************************************************
+ *
+ * This routine is called to initialize the entry point vector for this
+ * serial input device driver.
+ *
+ */
+
+int
+hp7lc2m_Init(
+ SerialProcs *serialproc)
+ {
+ serialproc->configure = hp7lc2mconfigure;/* routine to init device */
+ serialproc->read = hp7lc2mread; /* routine to read from dev */
+ serialproc->write = hp7lc2mwrite; /* routine to write to dev */
+ serialproc->close = hp7lc2mclose; /* routine to close device */
+ return INIT_SUCCESS; /* indicate success */
+ }
+
+#ifdef DEBUG
+char expected_button1[]= {
+0,1,0,2,1,3,0,2,3,1,0,2,1,3,0,4,5,1,0,4,1,5,0,4,2,1,5,3, /* test case 1 */
+4,5,4,2,5,3,4,2,3,5,4,2,5,3,4,2,3,5,4,0,2,5,1,3, /* test case 2 */
+2,3,2,0,1,0,1,0,1,4,5,4,5,3,0,4,1,5, /* test case 3 */
+0,4,1,5,0,4,1,5,2,3,0,4,1,5, /* test case 4 */
+0,2,1,3,0,2,1,3,4,5, /* test case 5 */
+4,2,5,3,4,2,5,3, /* test case 6 */
+0,4,2,1,5,3,0,4,2,5,1,4,3,0,2,5,1,4,3,0,2,1,5,3,0,4,1,5, /* test case 7 */
+2,3,0,1,4,2,5,3,0,1,4,2,5,3,
+
+0,2,3,1,4,2,3,5,0,4,5,1,0,4,2,3,5,1,0,2,1,3,4,2,5,3,0,4, /* miscellaneous */
+2,1,5,3,0,2,1,4,3,0,1,5,2,3,4,2,0,1,0,1,0,1,5,3,0,1,4,2,
+5,3,0,1,4,2,5,3,2,3,0,4,1,5,4,5,0,2,1,3,4,5,0,1,2,3};
+
+char expected_button2[]= {
+0,1,6,7,6,7,6,7,0,4,5,1,0,4,1,5,0,4,2,1,5,3, /* test case 1 */
+4,5,8,9,8,9,8,9,8,9,4,0,2,5,1,3, /* test case 2 */
+2,3,6,0,1,0,1,4,5,4,5,7,0,4,1,5, /* test case 3 */
+0,4,1,5,0,4,1,5,2,3,0,4,1,5, /* test case 4 */
+6,7,6,7,4,5, /* test case 5 */
+8,9,8,9, /* test case 6 */
+0,4,2,1,5,3,0,4,2,5,1,4,3,0,2,5,1,4,3,0,2,1,5,3,0,4,1,5, /* test case 7 */
+2,3,0,1,8,9,0,1,8,9,
+
+6,7,8,9,0,4,5,1,0,4,2,3,5,1,6,7,8,9,0,4,2,1,5,3,6,4,7,0,/* miscellaneous */
+1,5,2,3,8,0,1,0,1,0,1,9,0,1,8,9,0,1,8,9,2,3,0,4,1,5,4,5,6,7,4,5,0,1,2,3};
+
+char testdata[][3] = {
+ /* Case 1: left button goes down */
+ /* remains down */
+ /* goes up */
+ /* becomes chorded */
+ /* becomes non-chordable */
+{0x08,1,1}, /* no buttons down */
+{0x08,1,1}, /* no buttons down */
+{0x09,1,1}, /* left button down 0 0 */
+{0x09,1,1}, /* left button down */
+{0x08,1,1}, /* no buttons down 1 1 */
+
+{0x09,1,1}, /* left button down 0 */
+{0x09,1,1}, /* left button down */
+{0x0d,1,1}, /* left and center 2 6 */
+{0x0d,1,1}, /* left and center */
+{0x08,1,1}, /* no buttons down 1 */
+ /* 3 7 */
+{0x09,1,1}, /* left button down 0 */
+{0x0d,1,1}, /* left and center 2 6 */
+{0x09,1,1}, /* left button down 3 */
+{0x08,1,1}, /* no buttons down 1 7 */
+{0x09,1,1}, /* left button down 0 */
+{0x0d,1,1}, /* left and center 2 6 */
+{0x0c,1,1}, /* center button down 1 */
+{0x08,1,1}, /* no buttons down 3 7 */
+{0x09,1,1}, /* left button down 0 */
+{0x0b,1,1}, /* left and right 4 0 */
+ /* 4 */
+{0x09,1,1}, /* left button down 5 5 */
+{0x08,1,1}, /* no buttons down 1 1 */
+{0x09,1,1}, /* left button down 0 */
+{0x0b,1,1}, /* left and right 4 0 */
+ /* 4 */
+{0x0a,1,1}, /* right button down 1 1 */
+{0x08,1,1}, /* no buttons down 5 5 */
+{0x09,1,1}, /* left button down 0 */
+{0x0f,1,1}, /* all buttons 4 0 */
+ /* 2 4 */
+ /* 2 */
+{0x0e,1,1}, /* right and center 1 1 */
+{0x08,1,1}, /* no buttons down 5 5 */
+ /* 3 3 */
+
+
+ /* Case 2: right button goes down */
+ /* remains down */
+ /* goes up */
+ /* becomes chorded */
+ /* becomes non-chordable */
+{0x08,1,1}, /* no buttons down */
+{0x08,1,1}, /* no buttons down */
+{0x0a,1,1}, /* right button down 4 4 */
+{0x0a,1,1}, /* right button down */
+{0x08,1,1}, /* no buttons down 5 5 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0e,1,1}, /* right and center 2 8 */
+{0x0e,1,1}, /* right and center */
+{0x08,1,1}, /* no buttons down 5 */
+ /* 3 9 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0e,1,1}, /* right and center 2 8 */
+{0x0a,1,1}, /* right button down 3 */
+{0x08,1,1}, /* no buttons down 5 9 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0e,1,1}, /* right and center 2 8 */
+{0x0c,1,1}, /* center button down 5 */
+{0x08,1,1}, /* no buttons down 3 9 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0e,1,1}, /* right and center 2 8 */
+{0x0a,1,1}, /* right button down 3 */
+{0x08,1,1}, /* no buttons down 5 9 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0f,1,1}, /* all buttons 0 4 */
+ /* 2 0 */
+ /* 2 */
+{0x0d,1,1}, /* left and center 5 5 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 3 3 */
+
+
+ /* Case 3: center button goes down */
+ /* remains down */
+ /* goes up */
+ /* becomes chorded */
+ /* becomes non-chordable */
+{0x0c,1,1}, /* center button down 2 2 */
+{0x0c,1,1}, /* center button down */
+{0x08,1,1}, /* no buttons down 3 3 */
+{0x0c,1,1}, /* center button down 2 */
+{0x0d,1,1}, /* left and center 0 6 */
+{0x0d,1,1}, /* left and center */
+{0x0c,1,1}, /* center button down 1 */
+{0x0d,1,1}, /* left and center 0 0 */
+{0x0c,1,1}, /* center button down 1 1 */
+{0x0d,1,1}, /* left and center 0 0 */
+{0x0e,1,1}, /* right and center 1 1 */
+ /* 4 4 */
+{0x0c,1,1}, /* center button down 5 5 */
+{0x0e,1,1}, /* right and center 4 4 */
+{0x08,1,1}, /* no buttons down 5 5 */
+ /* 3 3 */
+{0x0b,1,1}, /* left and right 4 4 */
+ /* 0 0 */
+{0x08,1,1}, /* no buttons down 5 5 */
+ /* 1 1 */
+
+ /* Case 4: left and right go down */
+{0x0b,1,1}, /* left and right 0 0 */
+ /* 4 4 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+{0x0b,1,1}, /* left and right 0 0 */
+ /* 4 4 */
+{0x0c,1,1}, /* center button down 1 1 */
+ /* 5 5 */
+ /* 2 2 */
+{0x0b,1,1}, /* left and right 3 3 */
+ /* 0 0 */
+ /* 4 4 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+
+ /* Case 5: left and center go down */
+{0x08,1,1}, /* no buttons down */
+{0x0d,1,1}, /* left and center 0 */
+ /* 2 6 */
+{0x08,1,1}, /* no buttons down 1 7 */
+ /* 3 */
+{0x0d,1,1}, /* left and center 0 6 */
+ /* 2 */
+{0x0a,1,1}, /* right button down 1 7 */
+ /* 3 4 */
+ /* 4 */
+{0x08,1,1}, /* no buttons down 5 5 */
+
+
+
+ /* Case 6: right and center go down */
+{0x0e,1,1}, /* right and center 4 */
+ /* 2 8 */
+{0x08,1,1}, /* no buttons down 5 9 */
+ /* 3 */
+{0x0e,1,1}, /* right and center 4 8 */
+ /* 2 */
+{0x08,1,1}, /* no buttons down 5 9 */
+ /* 3 */
+{0x08,1,1}, /* no buttons down */
+
+
+ /* Case 7: all buttons go down */
+{0x0f,1,1}, /* all buttons 0 0 */
+ /* 4 4 */
+ /* 2 2 */
+{0x0f,1,1}, /* all buttons */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+ /* 3 3 */
+{0x0f,1,1}, /* all buttons 0 0 */
+ /* 4 4 */
+ /* 2 2 */
+{0x0d,1,1}, /* left and center 5 5 */
+{0x0e,1,1}, /* right and center 1 1 */
+ /* 4 4 */
+{0x0b,1,1}, /* left and right 3 3 */
+ /* 0 0 */
+{0x0f,1,1}, /* all buttons 2 2 */
+{0x0d,1,1}, /* left and center 5 5 */
+{0x0e,1,1}, /* right and center 1 1 */
+ /* 4 4 */
+{0x0b,1,1}, /* left and right 3 3 */
+ /* 0 0 */
+{0x0f,1,1}, /* all buttons 2 2 */
+{0x0c,1,1}, /* center button down 1 1 */
+ /* 5 5 */
+{0x0b,1,1}, /* left and right 3 3 */
+ /* 0 0 */
+ /* 4 4 */
+{0x0c,1,1}, /* center button down 1 1 */
+ /* 5 5 */
+ /* 2 2 */
+{0x08,1,1}, /* no buttons down 3 3 */
+{0x09,1,1}, /* left button down 0 */
+{0x0e,1,1}, /* right and center 1 0 */
+ /* 4 1 */
+ /* 2 8 */
+{0x09,1,1}, /* left button down 5 */
+ /* 3 9 */
+ /* 0 0 */
+{0x0e,1,1}, /* right and center 1 1 */
+ /* 4 */
+ /* 2 8 */
+{0x08,1,1}, /* no buttons down 5 */
+ /* 3 9 */
+
+
+ /* Case 8: miscellaneous tests */
+{0x09,1,1}, /* left button down 0 */
+{0x0d,1,1}, /* left and center 2 6 */
+{0x09,1,1}, /* left button down 3 */
+{0x08,1,1}, /* no buttons down 1 7 */
+
+{0x0a,1,1}, /* right button down 4 */
+{0x0a,1,1}, /* right button down */
+{0x0e,1,1}, /* right and center 2 8 */
+{0x0a,1,1}, /* right button down 3 */
+{0x08,1,1}, /* no buttons down 5 9 */
+
+{0x09,1,1}, /* left button down 0 0 */
+{0x0b,1,1}, /* left and right 4 4 */
+{0x09,1,1}, /* left button down 5 5 */
+{0x08,1,1}, /* no buttons down 1 1 */
+
+{0x09,1,1}, /* left button down 0 0 */
+{0x0b,1,1}, /* left and right 4 4 */
+{0x0f,1,1}, /* all buttons 2 2 */
+{0x0b,1,1}, /* left and right 3 3 */
+{0x09,1,1}, /* left button down 5 5 */
+{0x08,1,1}, /* no buttons down 1 1 */
+
+{0x09,1,1}, /* left button down 0 */
+{0x09,1,1}, /* left button down */
+{0x09,1,1}, /* left button down */
+{0x0d,1,1}, /* left and center 2 6 */
+{0x0d,1,1}, /* left and center */
+{0x08,1,1}, /* no buttons down 1 7 */
+ /* 3 */
+
+{0x0e,1,1}, /* right and center 4 8 */
+ /* 2 */
+{0x08,1,1}, /* no buttons down 5 9 */
+ /* 3 */
+
+{0x0f,1,1}, /* all buttons 0 0 */
+ /* 4 4 */
+ /* 2 2 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+ /* 3 3 */
+
+{0x0d,1,1}, /* left and center 0 */
+ /* 2 6 */
+{0x0e,1,1}, /* right and center 1 */
+ /* 4 4 */
+{0x0b,1,1}, /* left and right 3 7 */
+ /* 0 0 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+{0x0c,1,1}, /* center button down 2 2 */
+{0x08,1,1}, /* no buttons down 3 3 */
+
+{0x0e,1,1}, /* right and center 4 8 */
+ /* 2 */
+{0x0f,1,1}, /* all buttons 0 0 */
+{0x0e,1,1}, /* right and center 1 1 */
+{0x0f,1,1}, /* all buttons 0 0 */
+{0x0e,1,1}, /* right and center 1 1 */
+{0x0f,1,1}, /* all buttons 0 0 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 9 */
+ /* 3 */
+
+{0x09,1,1}, /* left button down 0 0 */
+{0x0e,1,1}, /* center, right down 1 1 */
+ /* 4 8 */
+ /* 2 */
+{0x09,1,1}, /* left button down 5 9 */
+ /* 3 0 */
+ /* 0 */
+{0x0e,1,1}, /* center, right down 1 1 */
+ /* 4 8 */
+ /* 2 */
+{0x08,1,1}, /* no buttons down 5 9 */
+ /* 3 */
+
+{0x0c,1,1}, /* center button down 2 2 */
+{0x0b,1,1}, /* left and right 3 0 */
+ /* 0 4 */
+ /* 4 3 */
+{0x08,1,1}, /* no buttons down 1 1 */
+ /* 5 5 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0d,1,1}, /* left and center 5 6 */
+ /* 0 */
+ /* 2 */
+{0x08,1,1}, /* no buttons down 1 7 */
+ /* 3 */
+{0x0a,1,1}, /* right button down 4 */
+{0x0a,1,1}, /* right button down */
+{0x0a,1,1}, /* right button down */
+{0x0a,1,1}, /* right button down 4 */
+{0x0a,1,1}, /* right button down */
+{0x08,1,1}, /* no buttons down 5 5 */
+{0x09,1,1}, /* left button down 0 */
+{0x09,1,1}, /* left button down */
+{0x09,1,1}, /* left button down */
+{0x09,1,1}, /* left button down 0 */
+{0x09,1,1}, /* left button down */
+{0x08,1,1}, /* no buttons down 1 1 */
+{0x0c,1,1}, /* center button down 2 */
+{0x0c,1,1}, /* center button down */
+{0x0c,1,1}, /* center button down */
+{0x0c,1,1}, /* center button down 2 */
+{0x0c,1,1}, /* center button down */
+{0x08,1,1}, /* no buttons down 3 3 */
+
+{0x00,1,1}}; /* terminate data */
+
+main ()
+ {
+ int fd;
+
+ makedata(); /* make the test data */
+ fd = open ("data", O_RDWR);
+ printf("Test case 1: no button chording\n");
+ process_test_data(fd, expected_button1);
+ close(fd);
+ fd = open ("data", O_RDWR);
+ hp7lc2m_chording_interval = 100;
+ printf("Test case 2: button chording enabled\n");
+ process_test_data(fd, expected_button2);
+ close(fd);
+ }
+
+process_test_data (fd, expected)
+ int fd;
+ char *expected;
+ {
+ int pending=0, ndx=0;
+ unsigned char buf[128], data_type=0;
+
+ buf[2] = 0;
+ while (hp7lc2mread (fd, buf, &data_type, &pending) == READ_SUCCESS)
+ {
+ if (data_type & MOTION_DATA)
+ ndx = 2;
+ if (data_type & BUTTON_DATA)
+ {
+ if (buf[ndx] != *expected)
+ printf ("Expected button %d received %d.\n",
+ *expected,buf[ndx]);
+ expected++;
+ }
+ data_type = 0;
+ buf[2]=0;
+ pending=0;
+ ndx = 0;
+ };
+ }
+
+/* The PS2 mouse returns PKT_SIZ bytes for each movement of the mouse or
+ * button press or release. The format of the bytes is as follows:
+ *
+ * Byte 0:
+ * Bit 7 Y data overflow (1 = overflow)
+ * Bit 6 X data overflow (1 = overflow)
+ * Bit 5 Y data sign (1 = negative)
+ * Bit 4 X data sign (1 = negative)
+ * Bit 3 Not used (always 1)
+ * Bit 2 Center button (1 = depressed)
+ * Bit 1 Right button (1 = depressed)
+ * Bit 0 Left button (1 = depressed)
+ * Byte 1:
+ * X coordinate data byte (2's compliment)
+ * Byte 2:
+ * Y coordinate data byte (2's compliment)
+ */
+
+makedata ()
+ {
+ int i, fd;
+
+ fd = creat("data", 0777);
+ while (testdata[i][0] != 0)
+ write (fd, testdata[i++], 3);
+ close(fd);
+ }
+#endif /* DEBUG */
diff --git a/xc/programs/Xserver/hw/hp/input/drivers/ps2io.h b/xc/programs/Xserver/hw/hp/input/drivers/ps2io.h
new file mode 100644
index 000000000..afbd2d2b7
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/drivers/ps2io.h
@@ -0,0 +1,113 @@
+/* $TOG: ps2io.h /main/3 1997/09/08 13:19:15 kaleb $ */
+
+#ifndef _SYS_PS2IO_INCLUDED /* allows multiple inclusion */
+#define _SYS_PS2IO_INCLUDED
+
+#ifndef _SYS_STDSYMS_INCLUDED
+#ifdef _KERNEL_BUILD
+# include "../h/stdsyms.h"
+#else /* ! _KERNEL_BUILD */
+# include <sys/stdsyms.h>
+#endif /* _KERNEL_BUILD */
+#endif /* _SYS_STDSYMS_INCLUDED */
+
+#ifdef _KERNEL_BUILD
+# include "../h/ioctl.h"
+#else /* ! _KERNEL_BUILD */
+# include <sys/ioctl.h>
+#endif /* _KERNEL_BUILD */
+
+struct ps2_4 {
+ unsigned char b[4];
+};
+
+/*
+ * Device ioctl() command defines
+ */
+
+#define PS2_INDICATORS _IOW('P', 0x01, struct ps2_4)
+#define PS2_IDENT _IOR('P', 0x02, struct ps2_4)
+#define PS2_SCANCODE _IOWR('P', 0x03, struct ps2_4)
+#define PS2_ENABLE _IO('P', 0x04)
+#define PS2_DISABLE _IO('P', 0x05)
+#define PS2_STREAMMODE _IO('P', 0x06)
+#define PS2_SAMPLERATE _IOW('P', 0x07, struct ps2_4)
+#define PS2_RESET _IOR('P', 0x08, struct ps2_4)
+#define PS2_RESOLUTION _IOW('P', 0x09, struct ps2_4)
+#define PS2_ALL_TMAT _IO('P', 0x0A)
+#define PS2_ALL_MKBRK _IO('P', 0x0B)
+#define PS2_ALL_TMAT_MKBRK _IO('P', 0x0C)
+#define PS2_ALL_MK _IO('P', 0x0D)
+#define PS2_KEY_MKBRK _IOW('P', 0x0E, struct ps2_4)
+#define PS2_KEY_MAKE _IOW('P', 0x0F, struct ps2_4)
+#define PS2_KEY_TMAT _IOW('P', 0x10, struct ps2_4)
+#define PS2_RATEDELAY _IOW('P', 0x11, struct ps2_4)
+
+#define PS2_PORTSTAT _IOR('P', 0x12, struct ps2_4)
+#define PS2_TEST _IOW('P', 0x13, char)
+#define PS2_SETDEFAULT _IO('P', 0x14)
+#define PS2_PROMPTMODE _IO('P', 0x15)
+#define PS2_REPORT _IOR('P', 0x16, struct ps2_4)
+#define PS2_STATUS _IOR('P', 0x17, struct ps2_4)
+#define PS2_2TO1_SCALING _IO('P', 0x18)
+#define PS2_1TO1_SCALING _IO('P', 0x19)
+
+#define PS2FAKE _IOW('P',0x0F,char) /* fake a character */
+
+/*
+#define _IOR('P',0x ,)
+ */
+
+/* Values for PS2_PORTSTAT first return byte */
+
+#define PS2_NONE 0
+#define PS2_MOUSE 1
+#define PS2_KEYBD 2
+#define PS2_UNKNOWN 3
+
+/* Bit mask values for ps2 devices */
+
+#define PS2_NONE_BIT 0x0001
+#define PS2_MOUSE_BIT 0x0002
+#define PS2_KEYBD_BIT 0x0004
+#define PS2_UNKNOWN_BIT 0x0008
+
+/* Bit mask values for PS2_PORTSTAT second return byte */
+
+#define INTERFACE_HAS_ITE 0x01
+#define PORT_HAS_FIRST_KEYBD 0x02
+#define PORT_HAS_FIRST_MOUSE 0x04
+
+/* values for PS2_SCANCODE */
+
+#define GET_SCANCODE 0x00
+#define SCANCODE_1 0x01
+#define SCANCODE_2 0x02
+#define SCANCODE_3 0x03
+
+/* values for PS2_SAMPLERATE */
+
+#define SAMPLE_10 0x0A
+#define SAMPLE_20 0x14
+#define SAMPLE_40 0x28
+#define SAMPLE_60 0x3C
+#define SAMPLE_80 0x50
+#define SAMPLE_100 0x64
+#define SAMPLE_200 0xC8
+
+/* values for PS2_INDICATORS */
+
+#define CAPS_LED 0x01
+#define NUM_LED 0x02
+#define SCROLL_LED 0x04
+
+/* values for PS2_RESOLUTION */
+/* (RES_3 is te default) Resolution in counts/mm */
+ /* 200 DPI 320 DPI */
+ /*--------- ------- */
+#define RES_1 0x00 /* 1 1 */
+#define RES_2 0x01 /* 2 3 */
+#define RES_3 0x02 /* 4 6 */
+#define RES_4 0x03 /* 8 12 */
+
+#endif /* _SYS_PS2IO_INCLUDED */
diff --git a/xc/programs/Xserver/hw/hp/input/get_tv.c b/xc/programs/Xserver/hw/hp/input/get_tv.c
new file mode 100644
index 000000000..8cc49e97f
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/get_tv.c
@@ -0,0 +1,199 @@
+/* $XConsortium: get_tv.c,v 1.1 93/08/08 12:58:41 rws Exp $ */
+
+/*
+
+Copyright (c) 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+/*
+ * An alternative to gettimeofday(2) that is about 50 times faster
+ * if used frequently. HP-PA specific.
+ * Dave Holt, GSY Performance, dah@cup.hp.com
+ */
+
+#include <time.h>
+#include <assert.h>
+
+#ifdef NOTDEFINED /* The following is not currently used. But
+ * I will leave it for possible future use.
+ * --kam 4/22/92
+ */
+
+#ifdef DEBUG
+#include <stdio.h>
+#else /* Not DEBUG. Don't bother with printf's. */
+#define printf(s, a)
+#endif /* DEBUG */
+
+#define MILLION 1000000
+#define BUNCH 8192 /* must be < 32767 */
+
+unsigned int cr16(); /* in cr16.s (assembly code) */
+static struct timeval slow_get_tv();
+void *malloc();
+static set_tix2usec();
+
+/* This initial value for last_tv forces initialization of tix2usec[]. */
+static struct timeval last_tv = {0, 2000000};
+static unsigned int last_tix;
+
+/*
+ * tix2usec[BUNCH] is a table built by set_tix2usec() which converts
+ * from CR16 ticks to microseconds:
+ * microseconds = tix2usec[ticks >> shift]
+ */
+static unsigned short *tix2usec;
+static int shift;
+
+struct timeval get_tv() /* the fast path */
+{
+ unsigned int tix, delta_tix;
+ long delta_usec;
+
+ tix = cr16();
+ delta_tix = tix - last_tix;
+ last_tix = tix;
+ if (delta_tix < BUNCH) { /* we can use the array */
+ delta_usec = tix2usec[delta_tix >> shift];
+ last_tv.tv_usec += delta_usec;
+ if (last_tv.tv_usec < MILLION) {
+ return(last_tv);
+ }
+ }
+ return(slow_get_tv());
+}
+
+static struct timeval slow_get_tv() /* the slow path */
+{
+ struct timezone tz;
+ static int first_time = 1;
+
+ if (first_time) {
+ set_tix2usec();
+ first_time = 0;
+ }
+ last_tix = cr16();
+ gettimeofday(&last_tv, &tz);
+ return(last_tv);
+}
+
+/*
+ * set_tix2usec() builds it by observing gettimeofday and CR16 over a
+ * reasonable period (~50ms).
+ */
+static set_tix2usec()
+{
+ struct timeval tv1, tv2;
+ struct timezone tz;
+ int i, tix_per_entry, delta_us;
+ unsigned int tix1, tix2, cr16(), delta_tix;
+ double tix_per_usec, usec_per_tix;
+
+ /* make sure the code is in memory before we time it */
+ tix1 = cr16();
+ gettimeofday(&tv1, &tz);
+
+ do {
+ tix1 = cr16();
+ gettimeofday(&tv1, &tz);
+ do {
+ tix2 = cr16();
+ gettimeofday(&tv2, &tz);
+ delta_us = (tv2.tv_sec - tv1.tv_sec) * MILLION +
+ (tv2.tv_usec - tv1.tv_usec);
+ delta_tix = tix2 - tix1;
+ } while (delta_us < 50000); /* loop for at least 50ms */
+ } while (tv2.tv_sec - tv1.tv_sec > 2); /* retry if delta is too big */
+
+ tix_per_usec = 1.0 * delta_tix / delta_us;
+ usec_per_tix = 1 / tix_per_usec;
+
+ /* Table should convert at least 10ms deltas. */
+ tix_per_entry = tix_per_usec * 10000 / BUNCH;
+ for (shift = 0;
+ (1 << shift) < tix_per_entry;
+ shift++) {
+ }
+
+ tix2usec = (unsigned short *) malloc(BUNCH * sizeof(unsigned short));
+ assert(tix2usec != NULL);
+
+ for (i = 0; i < BUNCH; i++) {
+ tix2usec[i] = i * (1 << shift) * usec_per_tix;
+ }
+
+ printf("tix_per_usec = %lf\n", tix_per_usec);
+ printf("shift = %d\n", shift);
+}
+
+#endif /* NOTDEFINED */
+
+
+void
+calibrate_cr16(TicksPerMilli)
+
+unsigned long *TicksPerMilli;
+
+{
+
+ struct timeval start, end;
+ register unsigned long cr_start, cr_end;
+ unsigned long total_ticks = 0, total_millis = 0;
+ int i, j;
+
+ for(i = 0; i < 6; i++)
+ {
+ cr_start = cr16();
+ gettimeofday(&start, NULL);
+
+ /* waste some time */
+ for(j=0; j< 200000; j++)
+ ;
+ cr_end = cr16();
+ gettimeofday(&end, NULL);
+
+ if(start.tv_usec > end.tv_usec)
+ {
+ end.tv_usec += 1000000;
+ end.tv_sec--;
+ }
+
+ /* if we have a rollover during all of this, toss this one. */
+
+ if(cr_end < cr_start)
+ {
+ i--;
+ }
+ else
+ {
+ total_millis += (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_usec - start.tv_usec) / 1000;
+ total_ticks += cr_end - cr_start;
+ }
+ }
+
+ *TicksPerMilli = total_ticks/total_millis;
+
+}
diff --git a/xc/programs/Xserver/hw/hp/input/getkeysym.c b/xc/programs/Xserver/hw/hp/input/getkeysym.c
new file mode 100644
index 000000000..69a11bfe7
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/getkeysym.c
@@ -0,0 +1,428 @@
+/* $XConsortium: getkeysym.c,v 1.7 95/01/24 02:45:23 dpw Exp $ */
+/*
+
+Copyright (c) 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef LIBDIR
+#if OSMAJORVERSION >= 10
+#define LIBDIR "/etc/X11"
+#else
+#define LIBDIR "/usr/lib/X11"
+#endif
+#endif
+
+#include <stdio.h>
+#include <X11/XHPlib.h>
+
+/*#include <X11/keysym.h>*/ /* gets sucked in by XHPlib.h */
+
+#define SUCCESS 0
+
+extern char *malloc();
+
+static FILE *keysym_file = NULL;
+static int num_headers = 0;
+static struct XHP_keymap_header *header_data = NULL;
+static int read_kd_name_table();
+static int read_modmap_table();
+
+#if 0 /* Not used any more */
+
+/* GetKeySyms() gets a key sym table from a file.
+ * This routine was copied and modified from XHPSetKeyboardMapping() in
+ * lib/Xhp/XHPSetKbd.c.
+
+ * The routine accepts two arguments: a keyboard id (specifying which
+ * keymap is to be loaded) and a pointer to a keysym array to be filled in.
+ * If the keyboard id is in the file, that keysym table is copied into the
+ * keysym array. Otherwise, an error is returned and nothing is copied.
+
+ * The routine returns zero if it succeeds. Otherwise, it returns a
+ * non-zero value specifying the type of error that occurred. The
+ * keyboard ID value (-2) is a special value used to specify a non-HP
+ * keyboard. The keyboard ID value (-1) is used to identify HP keyboards
+ * that are not supported by X (i.e. Arabic, Hebrew, Turkish, ...).
+
+ * The first time it is called, the routine opens the file
+ * "/usr/lib/X11/Xkeymaps", reading a header of the keysym tables it
+ * contains. The header contains a magic value for identification, and
+ * the ID, size, and offset of each keysym table in the file.
+ */
+
+Status GetKeySyms(kbd_id, keysyms)
+ KEYBOARD_ID kbd_id;
+ KeySym *keysyms;
+{
+ char magic[MAGIC_SIZE];
+ int header_size;
+ int index;
+ int n, return_code = SUCCESS;
+ char *name;
+ char filename[512];
+
+ /* If this is the first time this routine has been called, then open
+ * the keysym file, read the header, and verify the magic and read in
+ * the keysym table.
+ */
+
+ /* get the correct keymapfile name -- use environment variable if it is
+ * set else use default. If name starts with '/' it describes full path
+ * name, else it is relative to the default directory.
+ */
+
+ if ( ( name = (char *)getenv("XHPKEYMAPFILE") ) == NULL )
+ name = DEF_FILENAME;
+
+ if (name[0] != '/')
+ {
+ sprintf(filename, "%s/%s",LIBDIR,name);
+ }
+ else
+ strcpy(filename, name);
+
+ if ((keysym_file = fopen(filename,"r")) == NULL)
+ return(XHPKB_NOKEYFILE);
+
+ /* Read and verify the magic number */
+
+ fread(magic,MAGIC_SIZE,1,keysym_file);
+ if ((strcmp(magic,VERIFY_MAGIC)) != 0)
+ { return_code = XHPKB_BADMAGIC; goto done; }
+
+ /* Next read in the header size - it is in the next 4 bytes.
+ * Then read in the header table, which is found in the next
+ * header-size bytes of the file.
+ */
+
+ fread(&header_size,4,1,keysym_file);
+ if (!(header_data = (struct XHP_keymap_header *)malloc(header_size)))
+ { return_code = XHPKB_NOMEM; goto done; }
+ fread(header_data,header_size,1,keysym_file);
+
+ num_headers = header_size / sizeof(struct XHP_keymap_header);
+
+ /* Verify that a valid keyboard ID has been passed in. While you're
+ * at it, position the header_data pointer to the correct record.
+ */
+
+ for (index = 0; index < num_headers; index++)
+ {
+ if (kbd_id == header_data[index].kbd)
+ break;
+ }
+
+ if (index >= num_headers) /* It's an illegal keyboard ID */
+ { return_code = XHPKB_BADKBID; goto done; }
+
+ /* Copy the keysym table from the file into the keysyms array */
+
+ fseek(keysym_file, header_data[index].offset, 0);
+ fread((char *)keysyms, header_data[index].size, 1, keysym_file);
+
+done:
+ free((char *)header_data);
+ fclose(keysym_file);
+ return(return_code);
+}
+#endif
+
+
+ /* This next stuff supersedes the above stuff. It provides support for
+ * keydevice names and modmap names.
+ * Most of this code was taken from lib/Xhp/tools/cdkeymap.c (probably
+ * not called that anymore).
+ */
+
+static char *kd_name_heap = NULL, *modmap_name_heap = NULL;
+static int kd_names = 0, num_modmaps = 0,
+ num_keydevice_names = 0;
+static HPKKeyDeviceInfo *keydevice_name_table = NULL;
+static HPKModMap *modmap_table = NULL;
+
+
+ /*
+ * input:
+ * file_name: If not NULL, try and open "/usr/lib/X11/<file_name>".
+ * Notes:
+ * Sequence:
+ * if (!HPKsetup()) error_occured
+ * piddle with keymaps (other routines in here)
+ * HPKclean_up();
+ * You MUST call HPKclean_up() after calling HPKsetup() (no matter
+ * what HPKclean_up() returns). It resets state variables.
+ */
+int HPKsetup(file_name) char *file_name;
+{
+ char magic[MAGIC_SIZE];
+ int header_size;
+ char *name;
+ char filename[512];
+
+ /* If this is the first time this routine has been called, then open
+ * the keysym file, read the header, and verify the magic and read in
+ * the keysym table.
+ */
+
+ /* get the correct keymapfile name -- use environment variable if it is
+ * set else use default. If name starts with '/' it describes full path
+ * name, else it is relative to the default directory.
+ */
+ if (file_name) name = file_name;
+ else
+ if (NULL == (name = (char *)getenv("XHPKEYMAPFILE")))
+ name = DEF_FILENAME;
+
+ if (name[0] != '/')
+ {
+ sprintf(filename, "%s/%s",LIBDIR,name);
+ }
+ else strcpy(filename, name);
+
+ if (NULL == (keysym_file = fopen(filename,"r")))
+ return False;
+
+ /* Read and verify the magic number */
+
+ fread(magic,MAGIC_SIZE,1,keysym_file);
+ if ((strcmp(magic,VERIFY_MAGIC)) != 0) return False;
+
+ /* Next read in the header size - it is in the next 4 bytes.
+ * Then read in the header table, which is found in the next
+ * header-size bytes of the file.
+ */
+
+ fread(&header_size,4,1,keysym_file);
+ if (!(header_data = (struct XHP_keymap_header *)malloc(header_size)))
+ return False;
+ fread(header_data,header_size,1,keysym_file);
+
+ num_headers = header_size / sizeof(struct XHP_keymap_header);
+
+ read_kd_name_table();
+ read_modmap_table();
+
+ return True;
+}
+
+
+/* ******************************************************************** */
+/* ************************* Lookup Routines ************************** */
+/* ******************************************************************** */
+
+
+ /* Returns:
+ * NULL : id not found
+ * ptr : pointer into the header table
+ */
+static struct XHP_keymap_header *HPKlookup_kd_id(kd_id)
+{
+ int n;
+ struct XHP_keymap_header *ptr;
+
+ for (n = num_headers, ptr = header_data; n--; ptr++)
+ if (kd_id == ptr->kbd) return ptr;
+
+ return NULL;
+}
+
+ /* Returns:
+ * NULL : id not found
+ * ptr : pointer into name table
+ */
+HPKKeyDeviceInfo *HPKlookup_kd_by_id(kd_id)
+{
+ int n;
+ HPKKeyDeviceInfo *ptr;
+
+ for (n = num_keydevice_names, ptr = keydevice_name_table; n--; ptr++)
+ if (kd_id == ptr->keydevice_id) return ptr;
+
+ return NULL;
+}
+
+ /* Returns:
+ * NULL : modmap not found
+ * ptr : pointer into name table
+ */
+HPKModMap *HPKlookup_modmap(modmap_name) char *modmap_name;
+{
+ int n;
+ HPKModMap *ptr;
+
+ for (n = num_modmaps, ptr = modmap_table; n--; ptr++)
+ if (0 == strcmp(modmap_name, ptr->modmap_name)) return ptr;
+
+ return NULL;
+}
+
+ /* Returns:
+ * NULL : id not found
+ * ptr : pointer into name table
+ */
+HPKKeyDeviceInfo *HPKlookup_kd_by_name(kd_name) char *kd_name;
+{
+ int n;
+ HPKKeyDeviceInfo *ptr;
+
+ for (n = num_keydevice_names, ptr = keydevice_name_table; n--; ptr++)
+ if (0 == strcmp(kd_name, ptr->name)) return ptr;
+
+ return NULL;
+}
+
+
+/* ******************************************************************** */
+/* *************************** Read Tables **************************** */
+/* ******************************************************************** */
+
+static int read_kd_name_table()
+{
+ int a,b,c,d,e,f, n, z, kd_id;
+ HPKKeyDeviceInfo *kptr;
+ struct XHP_keymap_header *ptr;
+
+ if (!(ptr = HPKlookup_kd_id(HPK_KEYDEVICE_NAME_TABLE_ID))) return False;
+
+ fseek(keysym_file, ptr->offset, 0);
+
+ fread((char *)&num_keydevice_names, sizeof(int), 1, keysym_file);
+ n = num_keydevice_names;
+
+ fread((char *)&z, sizeof(int), 1, keysym_file); /* size of names table */
+
+ if (!(kd_name_heap = malloc(z)) ||
+ !(keydevice_name_table =
+ (HPKKeyDeviceInfo *)malloc(n*sizeof(HPKKeyDeviceInfo))))
+ {
+ num_keydevice_names = 0;
+ return False;
+ }
+
+ fread(kd_name_heap, z, 1, keysym_file); /* read the names */
+
+ for (kptr = keydevice_name_table; n--; kptr++) /* read the name table */
+ {
+ fread((char *)&a, sizeof(int), 1, keysym_file); /* kd name offset */
+ fread((char *)&b, sizeof(int), 1, keysym_file); /* key device id */
+ fread((char *)&c, sizeof(int), 1, keysym_file); /* modmap name offset */
+ fread((char *)&d, sizeof(int), 1, keysym_file); /* min keycode */
+ fread((char *)&e, sizeof(int), 1, keysym_file); /* max keycode */
+ fread((char *)&f, sizeof(int), 1, keysym_file); /* columns */
+
+ kptr->name = kd_name_heap + a;
+ kptr->keydevice_id = b;
+ kptr->modmap_name = kd_name_heap + c;
+ kptr->min_keycode = d;
+ kptr->max_keycode = e;
+ kptr->columns = f;
+ }
+
+ return True;
+}
+
+static int read_modmap_table()
+{
+ int n, a, z;
+ HPKModMap *mptr;
+ struct XHP_keymap_header *ptr;
+
+ if (!(ptr = HPKlookup_kd_id(HPK_MODMAP_TABLE_ID))) return False;
+
+ fseek(keysym_file, ptr->offset, 0);
+ fread((char *)&num_modmaps, sizeof(int), 1, keysym_file);
+
+ fread((char *)&z, sizeof(int), 1, keysym_file); /* name table size */
+
+ if (!(modmap_name_heap = malloc(z)) ||
+ !(modmap_table = (HPKModMap *)malloc(num_modmaps*sizeof(HPKModMap))))
+
+ {
+ num_modmaps = 0;
+ return False;
+ }
+
+ fread(modmap_name_heap, z,1, keysym_file); /* read the name table */
+
+ n = num_modmaps;
+ for (mptr = modmap_table; n--; mptr++) /* read & build the table */
+ {
+ fread((char *)&a, sizeof(int), 1, keysym_file); /* modmap name offset */
+ fread((char *)mptr->modmap, MODMAP_SIZE,1, keysym_file); /* modmap */
+
+ mptr->modmap_name = modmap_name_heap + a;
+ }
+
+ return True;
+}
+
+
+ /* Read a keytable.
+ * Input:
+ * kd_id: id of the keytable to read.
+ * keysyms: pointer to an area big enough to hold the keytable.
+ * Returns:
+ * TRUE: everything went as expected.
+ * FALSE: couldn't find id.
+ */
+int HPKread_keymap(kd_id, keysyms) KeySym *keysyms;
+{
+ struct XHP_keymap_header *ptr;
+
+ if (!(ptr = HPKlookup_kd_id(kd_id))) return False;
+
+ fseek(keysym_file, ptr->offset, 0);
+
+ fread((char *)keysyms, ptr->size, 1, keysym_file);
+
+ return True;
+}
+
+
+/* ******************************************************************** */
+/* ***************************** Clean Up ***************************** */
+/* ******************************************************************** */
+
+void HPKclean_up()
+{
+ if (keysym_file) fclose(keysym_file);
+ keysym_file = NULL;
+
+ if (header_data) free((char *)header_data);
+ header_data = NULL;
+
+ if (kd_name_heap) free((char *)kd_name_heap);
+ kd_name_heap = NULL;
+ if (keydevice_name_table) free((char *)keydevice_name_table);
+ keydevice_name_table = NULL;
+
+ if (modmap_name_heap) free((char *)modmap_name_heap);
+ modmap_name_heap = NULL;
+ if (modmap_table) free((char *)modmap_table);
+ modmap_table = NULL;
+
+
+ num_headers = kd_names = num_modmaps = num_keydevice_names = 0;
+}
diff --git a/xc/programs/Xserver/hw/hp/input/hildef.h b/xc/programs/Xserver/hw/hp/input/hildef.h
new file mode 100644
index 000000000..bd0aa4e38
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/hildef.h
@@ -0,0 +1,228 @@
+#ifndef HILDEF_H
+#define HILDEF_H
+/* $TOG: hildef.h /main/5 1998/02/10 13:10:59 kaleb $ */
+/*
+
+Copyright 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+Hewlett-Packard not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+/*
+** File: hildefs.h
+**
+** defines for hil devices to the X environment.
+**
+*/
+
+#include "x_serialdrv.h"
+#include "sys/param.h"
+#include "X.h"
+#include "scrnintstr.h"
+#include "misc.h"
+#include "dixstruct.h"
+
+/***************************************************************/
+/* KEEP THE FOLLOWING IN SYNC WITH THE DIX DEFINITION */
+/***************************************************************/
+
+#define MAXNAMLEN 255
+#define READ_SIZ 2000 /* leave room for partial packets*/
+#define BUF_SIZ 2048 /* size of static buffer to use */
+
+# define MAX_X_NAMELEN 64
+# define MAX_AXES 8
+# define ILLEGAL -1
+# define UP_MASK 1 << 0
+# define HIL_POLL_HDR_BITS 0xE3
+# define MOTION_MASK 0x0F
+# define KEY_DATA_MASK 0x70
+# define SET1_KEY_MASK 1 << 6
+# define PROXIMITY_IN 0x8e
+# define PROXIMITY_OUT 0x8f
+# define BUTTON_BASE 0x80
+# define BUTTON_1_OFFSET 0x7e
+
+
+#define VERTICAL 0
+#define HORIZONTAL 1
+#define MATRIX 2
+
+#define NOWRAP 0
+#define WRAP 1
+#define DEFAULT 2
+#define SAMESCREEN 3
+#define CHANGE_BY_TWO 4
+
+# define CHORDING_OFF 0
+# define CHORDING_ON 1
+# define CHORDING_DEFAULT 2
+
+# define LATCHING_OFF 0
+# define LATCHING_ON 1
+
+# define SCREEN_CHANGE_DEFAULT 255
+
+# define IS_SERIAL_DEVICE 0x40
+# define OPEN_THIS_DEVICE 0x20
+# define SECOND_LOGICAL_DEVICE 0x10
+# define MERGED_DEVICE 0x08
+
+# define DATA_SIZE_BITS 0x07
+
+#define HIL_ABSOLUTE 0x40 /* Device has absolute positioning data */
+#define HIL_16_BITS 0x20 /* Device has position data 16 bit accuracy */
+#define HIL_IOB 0x10 /* Device has I/O description byte */
+#define HIL_NUM_AXES 0x03 /* Number of axes supported */
+
+#define HAS_LEDS 0xf0 /* Device has leds */
+#define HILIOB_PAA 0x80 /* Device supports prompt and acknowledge */
+#define HILIOB_NPA 0x70 /* Number of prompts & acknowledges supported */
+#define HILIOB_PIO 0x08 /* Device supports Proximity In/Out */
+#define HILIOB_BUTTONS 0x07 /* Number of buttons on device */
+
+#define HILPRH_KEYSET 0x60 /* Keycode set bits */
+#define HILPRH_KEYSET1 0x40 /* Keycode set 1 data */
+
+#define NLOCK 3
+#define CAPSCODE 0x37
+#define KBSIZE 32 /* bytes to hold 256 bits (1 per key/button */
+#define ExpectUpKey(d,code) (d->kb_exp_up[code>>3] |= (1<<(code & 7)))
+#define DontExpectUpKey(d,code) (d->kb_exp_up[code>>3] &= ~(1<<(code & 7)))
+#define DeviceHasLeds(d) (d->iob & HILIOB_NPA)
+#define KeyHasLed(dev,d,cd) ((dev->key->modifierMap[cd] & d->led[0]) || \
+(dev->key->modifierMap[cd] & d->led[1]) || \
+(dev->key->modifierMap[cd] & d->led[2]) || \
+(dev->key->modifierMap[cd] & d->led[3]))
+
+#define UpIsExpected(d,code) (d->kb_exp_up[code>>3] & (1<<(code & 7)))
+#define KeyIsIgnored(d,code) (d->kb_ignore[code>>3] & (1<<(code & 7)))
+#define IgnoreKey(d,code) (d->kb_ignore[code>>3] |= (1<<(code & 7)))
+#define UnignoreKey(d,code) (d->kb_ignore[code>>3] &= ~(1<<(code & 7)))
+
+#define KeyDownEvent(ev) (ev->u.u.type==KeyPress | ev->u.u.type==DeviceKeyPress)
+#define ButtonDownEvent(ev) (ev->u.u.type==ButtonPress | \
+ ev->u.u.type==DeviceButtonPress)
+#define KeyUpEvent(ev) (ev->u.u.type==KeyRelease | \
+ ev->u.u.type==DeviceKeyRelease)
+
+#define ITF_KATAKANA 0xdd
+#define ITF_JAPANESE 0xc2
+#define PS2_HIL_JIS 0xc1
+#define PS2_DIN_JIS "PS2_DIN_JIS"
+#define IsLockKey(dev,code) (dev->key->modifierMap[code] & LockMask ? \
+ LockMapIndex : 0)
+#define IsMod2Key(dev,code) (dev->key->modifierMap[code] & Mod2Mask ? \
+ Mod2MapIndex : 0)
+#define IsJapaneseEnv(pHP) (pHP->id == ITF_KATAKANA || \
+ pHP->id == ITF_JAPANESE || \
+ pHP->id == PS2_HIL_JIS || \
+ !strcmp(pHP->d.keymap_name, PS2_DIN_JIS))
+
+#define IsToggleKey(dev,pHP,code) (IsLockKey(dev,code))
+
+/* This is the Kana Lock solution that APPO initially wanted.
+#define IsToggleKey(dev,pHP,code) (IsLockKey(dev,code) || \
+ (IsJapaneseEnv(pHP) && IsMod2Key(dev,code)))
+*/
+
+#define KeyIsDown(dev, code) (dev->key && \
+ (dev->key->down[code >> 3] & (1 << (code & 7))))
+#define KeyIsRepeating(dev, code) (dev->kbdfeed && \
+ (dev->kbdfeed->ctrl.autoRepeats[code >> 3] & (1 << (code & 7))))
+
+typedef struct _DeviceClients *DeviceClientsPtr;
+
+typedef struct _DeviceClients {
+ DeviceClientsPtr next;
+ ClientPtr client; /* which client wants this device */
+ XID resource; /* id for putting into resource manager */
+ int mode;
+ int count; /* # of open requests for this client */
+} DeviceClients;
+
+typedef struct _indevices {
+ u_char id; /* device HIL id */
+ u_char iob; /* I/O descriptor Byte */
+ float scaleX; /* Tablet scaling */
+ float scaleY; /* Tablet scaling */
+ DeviceClientsPtr clients; /* clients using device */
+ ScreenPtr pScreen; /* Screen pointer is on */
+ int coords[MAX_AXES];/* current coords of device */
+ Atom x_atom; /* atom for x type */
+ u_int button_state; /* device button state */
+ int change_xmax;
+ int change_ymax;
+ int change_ymin;
+ int change_xmin;
+ short change_amt;
+ short id_detail;
+ u_char dev_type; /* HIL device type */
+ u_char sent_button; /* flag for button sent */
+ u_char ignoremask; /* for button emulation */
+ u_char savebutton; /* saved button */
+ char x_type; /* MOUSE or KEYBOARD */
+ u_char mode; /* abs or rel movement */
+ u_char use; /* device use */
+ u_char pad2; /* reserved */
+ u_char hpflags; /* hp-specific feature flags */
+ u_char led[NLOCK+1];
+ u_char kb_exp_up[KBSIZE];
+ u_char kb_ignore[KBSIZE];
+ char entry[MAX_NM];
+ char driver_name[MAX_NM]; /* filled in by X server */
+ int *dpmotionBuf;
+ int *dheadmotionBuf;
+ HPInputDeviceHeader d;
+ SerialProcs s;
+} HPInputDevice;
+
+
+struct dev_info {
+ unsigned int timestamp;
+ unsigned char poll_hdr;
+ unsigned char dev_data[36];
+ HPInputDevice *hil_dev;
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/hp/input/hpKeyMap.c b/xc/programs/Xserver/hw/hp/input/hpKeyMap.c
new file mode 100644
index 000000000..60e47b63a
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/hpKeyMap.c
@@ -0,0 +1,869 @@
+/* $TOG: hpKeyMap.c /main/5 1998/02/10 13:11:10 kaleb $ */
+/*
+
+Copyright 1986, 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#include "Xmd.h"
+#define XK_KATAKANA
+#include "keysym.h"
+#include "X.h" /* MUST come after above includes */
+#include "input.h"
+#include "HPkeysym.h"
+#include "ap_keysym.h"
+
+#include <XHPlib.h> /* for keymap ids */
+
+#define MIN_KEYCODE 8
+/* This file was composed from the X10 hil_keymap.h by
+ * Jack Palevich, HP-Labs
+ */
+
+static int try_and_load_maps();
+
+ /* A keymap filled with NoSymbol is all (1) columns.
+ * This will be used when the keyboard is unknown and is not in a
+ * reconized family.
+ * Notes:
+ * I know NoSymbol is 0 and won't ever change so I can sleeze and let
+ * the compiler initialize the table.
+ */
+static KeySym null_keymap[1 * 0x80];
+
+
+#if defined(__hpux) || defined(__hp_osf)
+static KeySym USASCIIMap[4*0x82] = {
+ /* code values in comments at line end are actual value reported on HIL.
+ REMEMBER, there is an offset of MIN_KEYCODE+2 applied to this table!
+ The PS2 keyboard table begins at offset 0, the 46021A table begins with
+ the third row. */
+ /* Extend Char Right -- a.k.a. Kanji? */
+ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, /* 0x00 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x01 */
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /* 0x02 */
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /* 0x03 */
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /* 0x4 */
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 0x5 */
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 0x6 */
+ XK_Break, XK_Reset, NoSymbol, NoSymbol, /* 0x7 */
+ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, /* 0x8 */
+ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, /* 0x9 */
+ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, /* 0xa */
+ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, /* 0xb */
+ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, /* 0xc */
+ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, /* 0xd */
+ XK_KP_Separator, NoSymbol, NoSymbol, NoSymbol, /* 0xe */
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 0xf */
+ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, /* 0x10 */
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 0x11 */
+ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, /* 0x12 */
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /* 0x13 */
+ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, /* 0x14 */
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 0x15 */
+ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, /* 0x16 */
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 0x17 */
+ XK_B, NoSymbol, XK_block, NoSymbol, /* 0x18 */
+ XK_V, NoSymbol, XK_section, NoSymbol, /* 0x19 */
+ XK_C, NoSymbol, XK_ccedilla, XK_Ccedilla, /* 0x1a */
+ XK_X, NoSymbol, XK_scaron, XK_Scaron, /* 0x1b */
+ XK_Z, NoSymbol, XK_paragraph, NoSymbol, /* 0x1c */
+/* Was Kanji Left.... */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x1d */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x1e */
+ XK_Escape, XK_Delete, NoSymbol, NoSymbol, /* 0x1f */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x20 */
+ XK_F10, XK_KP_F2, NoSymbol, NoSymbol, /* 0x21 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x22 */
+ XK_F11, XK_KP_F3, NoSymbol, NoSymbol, /* 0x23 */
+ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, /* 0x24 */
+ XK_F9, XK_KP_F1, NoSymbol, NoSymbol, /* 0x25 */
+ XK_KP_Tab, XK_KP_BackTab, NoSymbol, NoSymbol, /* 0x26 */
+ XK_F12, XK_KP_F4, NoSymbol, NoSymbol, /* 0x27 */
+ XK_H, NoSymbol, XK_yen, NoSymbol, /* 0x28 */
+ XK_G, NoSymbol, XK_currency, NoSymbol, /* 0x29 */
+ XK_F, NoSymbol, XK_guilder, NoSymbol, /* 0x2a */
+ XK_D, NoSymbol, XK_eth, XK_Eth, /* 0x2b */
+ XK_S, NoSymbol, XK_ssharp, NoSymbol, /* 0x2c */
+ XK_A, NoSymbol, XK_aring, XK_Aring, /* 0x2d */
+ XK_Mode_switch, NoSymbol, NoSymbol, XK_Mode_switch, /* 0x2e */
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 0x2f */
+ XK_U, NoSymbol, XK_mute_diaeresis,NoSymbol, /* 0x30 */
+ XK_Y, NoSymbol, XK_mute_asciicircum,NoSymbol, /* 0x31 */
+ XK_T, NoSymbol, XK_mute_grave, NoSymbol, /* 0x32 */
+ XK_R, NoSymbol, XK_mute_acute, NoSymbol, /* 0x33 */
+ XK_E, NoSymbol, XK_ae, XK_AE, /* 0x34 */
+ XK_W, NoSymbol, XK_asciitilde, NoSymbol, /* 0x35 */
+ XK_Q, NoSymbol, XK_periodcentered, NoSymbol, /* 0x36 */
+ XK_Tab, XK_BackTab, NoSymbol, NoSymbol, /* 0x37 */
+ XK_7, XK_ampersand, XK_backslash, NoSymbol, /* 0x38 */
+ XK_6, XK_asciicircum, XK_asciicircum, NoSymbol, /* 0x39 */
+ XK_5, XK_percent, XK_onehalf, NoSymbol, /* 0x3a */
+ XK_4, XK_dollar, XK_onequarter, XK_threequarters, /* 0x3b */
+ XK_3, XK_numbersign, XK_numbersign, NoSymbol, /* 0x3c */
+ XK_2, XK_at, XK_at, NoSymbol, /* 0x3d */
+ XK_1, XK_exclam, XK_exclamdown, NoSymbol, /* 0x3e */
+ XK_quoteleft, XK_asciitilde, XK_guillemotleft,XK_guillemotright,/* 0x3f */
+/* Was Mouse-L */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x40 */
+/* Was Mouse-M */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x41 */
+/* Was Mouse-R */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x42 */
+/* Was 4 button puck */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x43 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x44 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x45 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x46 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x47 */
+ XK_Menu, NoSymbol, NoSymbol, NoSymbol, /* 0x48 */
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 0x49 */
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 0x4a */
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 0x4b */
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 0x4c */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x4d */
+/* Was 'Stop' */
+ XK_Cancel, NoSymbol, NoSymbol, NoSymbol, /* 0x4e */
+/* Was 'Enter' */
+ XK_Execute, XK_Print, NoSymbol, NoSymbol, /* 0x4f */
+ XK_System, XK_User, NoSymbol, NoSymbol, /* 0x50 */
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 0x51 */
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 0x52 */
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 0x53 */
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 0x54 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x55 */
+ XK_ClearLine, NoSymbol, NoSymbol, NoSymbol, /* 0x56 */
+/* Was 'Clear Display' */
+ XK_Clear, NoSymbol, NoSymbol, NoSymbol, /* 0x57 */
+ XK_8, XK_asterisk, XK_bracketleft, XK_braceleft, /* 0x58 */
+ XK_9, XK_parenleft, XK_bracketright,XK_braceright, /* 0x59 */
+ XK_0, XK_parenright, XK_questiondown,NoSymbol, /* 0x5a */
+ XK_minus, XK_underscore, XK_longminus, XK_macron, /* 0x5b */
+ XK_equal, XK_plus, XK_plusminus, NoSymbol, /* 0x5c */
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 0x5d */
+ XK_InsertLine, NoSymbol, NoSymbol, NoSymbol, /* 0x5e */
+ XK_DeleteLine, NoSymbol, NoSymbol, NoSymbol, /* 0x5f */
+
+ XK_I, NoSymbol, XK_mute_asciitilde,NoSymbol, /* 0x60 */
+ XK_O, NoSymbol, XK_oslash, XK_Ooblique, /* 0x61 */
+ XK_P, NoSymbol, XK_thorn, XK_Thorn, /* 0x62 */
+ XK_bracketleft, XK_braceleft, XK_degree, NoSymbol, /* 0x63 */
+ XK_bracketright, XK_braceright, XK_brokenbar, NoSymbol, /* 0x64 */
+ XK_backslash, XK_bar, XK_mu, NoSymbol, /* 0x65 */
+
+ /* HP special might also be Insert */
+ XK_InsertChar, NoSymbol, NoSymbol, NoSymbol, /* 0x66 */
+ XK_DeleteChar, NoSymbol, NoSymbol, NoSymbol, /* 0x67 */
+ XK_J, NoSymbol, XK_dollar, NoSymbol, /* 0x68 */
+ XK_K, NoSymbol, XK_cent, NoSymbol, /* 0x69 */
+ XK_L, NoSymbol, XK_sterling, NoSymbol, /* 0x6a */
+ XK_semicolon, XK_colon, XK_lira, NoSymbol, /* 0x6b */
+ XK_quoteright, XK_quotedbl, XK_quoteleft, XK_quoteright, /* 0x6c */
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 0x6d */
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 0x6e */
+ /* Prev */
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 0x6f */
+
+ XK_M, NoSymbol, XK_masculine, NoSymbol, /* 0x70 */
+ XK_comma, XK_less, XK_less, NoSymbol, /* 0x71 */
+ XK_period, XK_greater, XK_greater, NoSymbol, /* 0x72 */
+ XK_slash, XK_question, XK_underscore, NoSymbol, /* 0x73 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x74 */
+ XK_Select, NoSymbol, NoSymbol, NoSymbol, /* 0x75 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x76 */
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* 0x77 */
+ XK_N, NoSymbol, XK_ordfeminine, NoSymbol, /* 0x78 */
+ /* "Space the final frontier..." */
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /* 0x79 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7a */
+ /* Kanji Right */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7b */
+
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 0x7c */
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 0x7d */
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 0x7e */
+ XK_Right, NoSymbol, NoSymbol, NoSymbol /* 0x7f */
+};
+
+
+
+ /* This routine converts a hil keyboard id to the X keyboard id used to
+ * look up the keyboard in the /usr/lib/X11/XHPKeymaps file.
+ * Notes:
+ * Modified from libXhp XHPGetHILandCvt().
+ * We used to just do some math to get the extended keyboard id but we
+ * got some signals crossed with the NLIO guys and some of the
+ * keyboards got misplaced in XHPKeymaps so we now have a look up
+ * table. For the PS2 keyboards, we still use math.
+ * See the manual on using hp-hil devices with HP-UX for the keyboard
+ * nationality codes; they are the low order 6 bits of the device
+ * id; 0x1f is United States, so we'll subtract from 0x1f to give
+ * the U.S. a keyId of zero; The PS2 keyboards have hil ids E0-FF.
+ * 6 bits == a max of 64 different keyboards. 32 extended and 32 PS2.
+ * George says to use 7 bits: HIL ids in the range A0-FF.
+ * A0-BF Compressed keyboard. Not used (yet).
+ * C0-DF Extended (ITF) keyboard
+ * E0-FF Standard keyboard. We change to be the PS2.
+ * Map extended keyboards to key ids 0-31. The unsupported keyboards
+ * are the ones with hard coded numbers.
+ * The apollo keyboards are 33-40 (I don't want to talk about it and
+ * hind sight is 20/20).
+ * Map PS2 keyboards to key ids 60-91.
+ * WARNING
+ * ONLY call this for HIL keyed devices. For other stuff (such as
+ * serial keyboards), use the named lookups.
+ * Input:
+ * hil_id:
+ * Returns:
+ * X keyboard id.
+ * If the hil_id is not a supported keyboard, return unsupported id.
+ * If the hil_id is not a keyboard, return KB_NULL.
+ */
+int hil_to_kbd_id(hil_id) int hil_id;
+{
+ int kbd_id;
+ static short int key_tab[] = {
+ 31, /* HIL=00h Undefined keyboard */
+ 30, /* HIL=01h Undefined keyboard */
+ KB_Japanese, /* HIL=02h */
+ KB_Swiss_French, /* HIL=03h */
+ 29, /* HIL=04h No keysym support for Portugues */
+ 28, /* HIL=05h No keysym support for Arabic */
+ 27, /* HIL=06h No keysym support for Hebrew */
+ KB_Canada_English, /* HIL=07h */
+ 26, /* HIL=08h No keysym support for Turkish */
+ 25, /* HIL=09h No keysym support for Greek */
+ 24, /* HIL=0Ah No keysym support for Thai */
+ KB_Italian, /* HIL=0Bh */
+ KB_Korean, /* HIL=0Ch */
+ KB_Dutch, /* HIL=0Dh */
+ KB_Swedish, /* HIL=0Eh */
+ KB_German, /* HIL=0Fh */
+ KB_S_Chinese, /* HIL=10h */
+ KB_T_Chinese, /* HIL=11h */
+ KB_Swiss_French2, /* HIL=12h */
+ KB_Euro_Spanish, /* HIL=13h */
+ KB_Swiss_German2, /* HIL=14h */
+ KB_Belgian, /* HIL=15h */
+ KB_Finnish, /* HIL=16h */
+ KB_UK_English, /* HIL=17h */
+ KB_Canada_French, /* HIL=18h */
+ KB_Swiss_German, /* HIL=19h */
+ KB_Norwegian, /* HIL=1Ah */
+ KB_French, /* HIL=1Bh */
+ KB_Danish, /* HIL=1Ch */
+ KB_Katakana, /* HIL=1Dh */
+ KB_Latin_Spanish, /* HIL=1Eh */
+ KB_US_English, /* HIL=1Fh */
+ };
+
+ if (hil_id == 0x30) return KB_BUTTON_BOX;
+
+ if (hil_id == 0x5c) return KB_US_English; /* Barcode reader */
+
+ if (0xE0 <= hil_id && hil_id <= 0xFF) /* PS2 keyboard: 0xE0 - 0xFF */
+ return (91 - (hil_id - 0xE0)); /* 60 - 91 */
+
+ if (0xC0 <= hil_id && hil_id <= 0xDF) /* ITF keyboard: 0xC0 - 0xDF */
+ return key_tab[hil_id & 0x1f]; /* 0 - 31 */
+
+ /* Something unknown or not yet supported (such as a nonkbd device (like
+ * the ID module)).
+ */
+ return KB_NULL;
+}
+
+#endif /* __hpux */
+
+#if __apollo
+#include "ap_keysym.h" /* for the apXK_ keysyms */
+
+static KeySym Apollo_NorthAmericanMap[] = {
+
+ /* code values in comments at line end are actual value reported on HIL.
+ REMEMBER, there is an offset of MIN_KEYCODE applied to this table! */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x00 */
+ XK_Select, XK_Insert, NoSymbol, NoSymbol, /* 0x01 */
+ apXK_LineDel, NoSymbol, NoSymbol, NoSymbol, /* 0x02 */
+ apXK_CharDel, NoSymbol, NoSymbol, NoSymbol, /* 0x03 */
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 0x04 */
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 0x05 */
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 0x06 */
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 0x07 */
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 0x08 */
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 0x09 */
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 0x0a */
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 0x0b */
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 0x0c */
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 0x0d */
+ XK_Redo, NoSymbol, NoSymbol, NoSymbol, /* 0x0e */
+ apXK_Read, NoSymbol, NoSymbol, NoSymbol, /* 0x0f */
+ apXK_Edit, apXK_Save, NoSymbol, NoSymbol, /* 0x10 */
+ apXK_Exit, XK_Cancel, NoSymbol, NoSymbol, /* 0x11 */
+ XK_Pause, XK_Help, NoSymbol, NoSymbol, /* 0x12 */
+ apXK_Copy, apXK_Cut, NoSymbol, NoSymbol, /* 0x13 */
+ apXK_Paste, XK_Undo, NoSymbol, NoSymbol, /* 0x14 */
+ apXK_Grow, apXK_Move, NoSymbol, NoSymbol, /* 0x15 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x16 */
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 0x17 */
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 0x18 */
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 0x19 */
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 0x1a */
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 0x1b */
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 0x1c */
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 0x1d */
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 0x1e */
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 0x1f */
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 0x20 */
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 0x21 */
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 0x22 */
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 0x23 */
+ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, /* 0x24 */
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 0x25 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x26 */
+ apXK_LeftBar, NoSymbol, NoSymbol, NoSymbol, /* 0x27 */
+ apXK_Cmd, apXK_Shell, NoSymbol, NoSymbol, /* 0x28 */
+ apXK_RightBar, NoSymbol, NoSymbol, NoSymbol, /* 0x29 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x2a */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x2b */
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 0x2c */
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 0x2d */
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 0x2e */
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 0x2f */
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 0x30 */
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 0x31 */
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 0x32 */
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 0x33 */
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 0x34 */
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 0x35 */
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 0x36 */
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 0x37 */
+ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, /* 0x38 */
+ XK_Mode_switch, NoSymbol, NoSymbol, NoSymbol, /* 0x39 */
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 0x3a */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x3b */
+ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, /* 0x3c */
+ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, /* 0x3d */
+ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, /* 0x3e */
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /* 0x3f */
+ apXK_LeftBox, NoSymbol, NoSymbol, NoSymbol, /* 0x40 */
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 0x41 */
+ apXK_RightBox, NoSymbol, NoSymbol, NoSymbol, /* 0x42 */
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 0x43 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x44 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x45 */
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 0x46 */
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 0x47 */
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 0x48 */
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 0x49 */
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 0x4a */
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 0x4b */
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 0x4c */
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 0x4d */
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 0x4e */
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 0x4f */
+ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, /* 0x50 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x51 */
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 0x52 */
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 0x53 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x54 */
+ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, /* 0x55 */
+ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, /* 0x56 */
+ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, /* 0x57 */
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 0x58 */
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 0x59 */
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* 0x5a */
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 0x5b */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5c */
+ apXK_Repeat, NoSymbol, NoSymbol, NoSymbol, /* 0x5d */
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 0x5e */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x5f */
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 0x60 */
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /* 0x61 */
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /* 0x62 */
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /* 0x63 */
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /* 0x64 */
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /* 0x65 */
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /* 0x66 */
+ XK_comma, XK_less, NoSymbol, NoSymbol, /* 0x67 */
+ XK_period, XK_greater, NoSymbol, NoSymbol, /* 0x68 */
+ XK_slash, XK_question, NoSymbol, NoSymbol, /* 0x69 */
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /* 0x6a */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x6b */
+ apXK_Pop, NoSymbol, NoSymbol, NoSymbol, /* 0x6c */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x6d */
+ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, /* 0x6e */
+ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, /* 0x6f */
+ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, /* 0x70 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x71 */
+ apXK_UpBox, NoSymbol, NoSymbol, NoSymbol, /* 0x72 */
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 0x73 */
+ apXK_DownBox, NoSymbol, NoSymbol, NoSymbol, /* 0x74 */
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 0x75 */
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /* 0x76 */
+ XK_Alt_R, NoSymbol, NoSymbol, NoSymbol, /* 0x77 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x78 */
+ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, /* 0x79 */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7a */
+ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, /* 0x7b */
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 0x7c */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7d */
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 0x7e */
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x7f */
+};
+#endif /* __apollo */
+
+static KeySym LPFKMap[] = {
+ XK_exclam, NoSymbol, NoSymbol, NoSymbol, /* 0x21 */
+ XK_quotedbl, NoSymbol, NoSymbol, NoSymbol, /* 0x22 */
+ XK_numbersign, NoSymbol, NoSymbol, NoSymbol, /* 0x23 */
+ XK_dollar, NoSymbol, NoSymbol, NoSymbol, /* 0x24 */
+ XK_percent, NoSymbol, NoSymbol, NoSymbol, /* 0x25 */
+ XK_ampersand, NoSymbol, NoSymbol, NoSymbol, /* 0x26 */
+ XK_quoteright, NoSymbol, NoSymbol, NoSymbol, /* 0x27 */
+ XK_parenleft, NoSymbol, NoSymbol, NoSymbol, /* 0x28 */
+ XK_parenright, NoSymbol, NoSymbol, NoSymbol, /* 0x29 */
+ XK_asterisk, NoSymbol, NoSymbol, NoSymbol, /* 0x2a */
+ XK_plus, NoSymbol, NoSymbol, NoSymbol, /* 0x2b */
+ XK_comma, NoSymbol, NoSymbol, NoSymbol, /* 0x2c */
+ XK_minus, NoSymbol, NoSymbol, NoSymbol, /* 0x2d */
+ XK_period, NoSymbol, NoSymbol, NoSymbol, /* 0x2e */
+ XK_slash, NoSymbol, NoSymbol, NoSymbol, /* 0x2f */
+ XK_0, NoSymbol, NoSymbol, NoSymbol, /* 0x30 */
+ XK_1, NoSymbol, NoSymbol, NoSymbol, /* 0x31 */
+ XK_2, NoSymbol, NoSymbol, NoSymbol, /* 0x32 */
+ XK_3, NoSymbol, NoSymbol, NoSymbol, /* 0x33 */
+ XK_4, NoSymbol, NoSymbol, NoSymbol, /* 0x34 */
+ XK_5, NoSymbol, NoSymbol, NoSymbol, /* 0x35 */
+ XK_6, NoSymbol, NoSymbol, NoSymbol, /* 0x36 */
+ XK_7, NoSymbol, NoSymbol, NoSymbol, /* 0x37 */
+ XK_8, NoSymbol, NoSymbol, NoSymbol, /* 0x38 */
+ XK_9, NoSymbol, NoSymbol, NoSymbol, /* 0x39 */
+ XK_colon, NoSymbol, NoSymbol, NoSymbol, /* 0x3a */
+ XK_semicolon, NoSymbol, NoSymbol, NoSymbol, /* 0x3b */
+ XK_less, NoSymbol, NoSymbol, NoSymbol, /* 0x3c */
+ XK_equal, NoSymbol, NoSymbol, NoSymbol, /* 0x3d */
+ XK_greater, NoSymbol, NoSymbol, NoSymbol, /* 0x3e */
+ XK_question, NoSymbol, NoSymbol, NoSymbol, /* 0x3f */
+ XK_at, NoSymbol, NoSymbol, NoSymbol, /* 0x40 */
+};
+
+KeySymsRec LPFKKeySyms = {LPFKMap, 0x21, 0x40, 4};
+
+ /* This structure has ONE default KeySymsRec per keyboard family per OS
+ * that is used in case we can't look up the correct one.
+ * Notes:
+ * All key maps SHOULD start at MIN_KEYCODE (aka 0) except HP-UX,
+ * where the exteneded keyboard keymaps start at 2 (because the
+ * extended keyboards didn't generate keycodes 0 and 1). The PS2
+ * keyboards generate keycodes starting at 0 so they need a
+ * different MIN_KEYCODE.
+ * These default keymaps are overwritten so they should contain at
+ * least enough entries so that the largest keytable will fit. In
+ * most cases this means that last entry is 0x7f and the keymap size
+ * is max-entries x width == 0x80 x 4.
+ */
+static KeySymsRec DefaultKeySyms[] = {
+ /* map name minKeyCode maxKC width */
+#if defined(__hpux) || defined(__hp_osf)
+ &USASCIIMap[8], (MIN_KEYCODE + 0x02), (MIN_KEYCODE + 0x7F), 4,
+ USASCIIMap, (MIN_KEYCODE), (MIN_KEYCODE + 0x7F), 4,
+ null_keymap, (MIN_KEYCODE), (MIN_KEYCODE + 0x7F), 1,
+#endif
+
+#if __apollo
+ Apollo_NorthAmericanMap, (MIN_KEYCODE), (MIN_KEYCODE + 0x7F), 4,
+#endif
+};
+
+ /* Convert a X keyboard ID into a family.
+ * Input: X keyboard ID
+ * Returns:
+ * 0 (ITF)
+ * 1 (PS2)
+ * 2 (null or unknown device)
+ * 0 Apollo
+ */
+static int kbd_family(key_id)
+{
+ int n;
+
+#if defined(__hpux) || defined(__hp_osf)
+ if ( 0 <= key_id && key_id <= 31) n = 0; /* ITF keyboard */
+ else
+ if (60 <= key_id && key_id <= 91) n = 1; /* PS2 keyboard */
+ else n = 2; /* KB_NULL */
+#endif
+
+#if __apollo
+ n = 0;
+#endif
+
+ return n;
+}
+
+ /* This routine is called to get a pointer to a KeySymRec so you can
+ * overwrite the key table with the correct one for the keyboard
+ * connected to the system.
+ */
+KeySymsRec *hpKeySyms(key_id)
+{
+ return &DefaultKeySyms[kbd_family(key_id)];
+}
+
+ /* This routine is called if the load-keytable-from-file routine fails
+ * and you need a default KeySymRec. I need this for HP-UX 'cause the
+ * extended and PS2 keyboards have different min keycodes and I want to
+ * use the US Ascii keymap as the default.
+ */
+KeySymsRec *hpDefaultKeySyms(key_id)
+{
+ return hpKeySyms(key_id);
+}
+
+
+/* ******************************************************************** */
+/* ************************* Modifier Tables ************************** */
+/* ******************************************************************** */
+
+#define cT (ControlMask)
+#define sH (ShiftMask)
+#define lK (LockMask)
+#define mT (Mod1Mask)
+
+ /* A modmap with no modifiers. To be used with null_keymap */
+static CARD8 null_modmap[MAP_LENGTH];
+
+
+ /* Shift table values up by 8. This offset is necessary to reserve
+ * codes for mouse buttons. Note last 8 entries of table are
+ * commented out to preserve length of table.
+ * Note: '#define MIN_KEYCODE 8' is above
+ */
+
+#if defined(__hpux) || defined(__hp_osf)
+
+ /* This table is for the HP hil extended keyboards.
+ * For the PS2 keyboards, the only difference is keycode 0. I used to
+ * use the same table for both keyboard types (since keycode 0 can't
+ * be generated by the extended keyboard) but that caused problems
+ * with xmodmap.
+ */
+static CARD8 hil_modmap[MAP_LENGTH] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, mT, mT, sH, sH, cT, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10-1f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, mT, lK,/* 20-2f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30-3f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-4f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */
+ 0, 0, 0, 0, 0, 0, 0, 0,/*0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */
+};
+
+ /* Same table as the hil_modmap but for PS2 keyboards. Only
+ * difference is keycode 0 is a control key.
+ */
+static CARD8 PS2_modmap[MAP_LENGTH] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ cT, 0, mT, mT, sH, sH, cT, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10-1f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, mT, lK,/* 20-2f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30-3f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-4f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */
+ 0, 0, 0, 0, 0, 0, 0, 0,/*0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */
+};
+
+#endif
+
+#ifdef __apollo
+
+ /* This table is for the Apollo NA and MN keyboards. */
+static CARD8 apollo_modmap[MAP_LENGTH] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10-1f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20-2f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, mT, 0, 0, 0, 0, 0, 0, /* 30-3f */
+ 0, 0, 0, cT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-4f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sH, 0, /* 50-5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sH, 0, 0, 0, 0, 0, /* 60-6f */
+ 0, 0, 0, 0, 0, mT, 0, mT, 0, 0, 0, 0, 0, 0, lK, 0, /* 70-7f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */
+ 0, 0, 0, 0, 0, 0, 0, 0,/*0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */
+};
+#endif
+
+ /* This routine returns the modifier map to be used with the keymap that
+ * has keyboard/(X id) kbd_id.
+ * Note: This is easy because each OS we support now only has one or
+ * two mod maps for all keyboards it supports.
+ */
+CARD8 *hpModMap(kbd_id)
+{
+#if defined(__hpux) || defined(__hp_osf)
+ switch (kbd_family(kbd_id))
+ {
+ case 0: return hil_modmap; /* Extended keyboard */
+ case 1: return PS2_modmap; /* PS2 keyboard */
+ case 2: return null_modmap; /* button box */
+ }
+#endif
+
+#ifdef __apollo
+ return apollo_modmap;
+#endif
+}
+
+
+/* ******************************************************************** */
+/* ********************************* ********************************* */
+/* ******************************************************************** */
+
+ /* Routines in getkeysym.c */
+extern HPKKeyDeviceInfo *HPKlookup_kd_by_id(), *HPKlookup_kd_by_name();
+extern HPKModMap *HPKlookup_modmap();
+
+
+ /* Empty space that can be filled in when I read keyboard info from a
+ * file. I don't think I can just overwrite (eg) the null_maps
+ * because if they change keyboards, recycle and then I can't find a
+ * map, the default won't work anymore.
+ */
+static KeySym tmp_keymap[8 * 256]; /* biggest keymap */
+static CARD8 tmp_modmap[MAP_LENGTH];
+
+static void maparoo(kptr, keysyms_rec, complain, modmap, default_modmap)
+ KeySymsRec *keysyms_rec;
+ HPKKeyDeviceInfo *kptr;
+ CARD8 **modmap, *default_modmap;
+{
+ CARD8 *the_modmap;
+ HPKModMap *mptr;
+
+ keysyms_rec->map = tmp_keymap;
+ keysyms_rec->minKeyCode = kptr->min_keycode;
+ keysyms_rec->maxKeyCode = kptr->max_keycode;
+ keysyms_rec->mapWidth = kptr->columns;
+
+ if (mptr = HPKlookup_modmap(kptr->modmap_name))
+ {
+ memcpy(tmp_modmap, mptr->modmap, MAP_LENGTH);
+ the_modmap = tmp_modmap;
+ }
+ else
+ {
+ if (complain)
+ ErrorF("Could not find modmap \"%s\"- using default (NULL map).\n",
+ kptr->modmap_name);
+ the_modmap = default_modmap;
+ }
+ *modmap = the_modmap;
+}
+
+ /*
+ * Input:
+ * keydevice_id: The keydevice ID. On HP-UX, this is the output of
+ * hil_to_kbd_id().
+ * keysyms_rec: Pointer to a KeySymsRec to fill in.
+ * modmap: Pointer to a pointer to a modmap.
+ * Output:
+ * keysyms_rec: FIlled in.
+ * modmap: points to a modmap to use with the keysyms_rec.
+ * Returns:
+ * TRUE : everything went as expected
+ * FALSE: Something went screwie, using default maps.
+ * Notes:
+ * Don't complain if can't load maps for the button box.
+ */
+int HPKget_maps_by_id(keydevice_id, keysyms_rec, modmap)
+ KeySymsRec *keysyms_rec; CARD8 **modmap;
+{
+ CARD8 *the_modmap;
+ HPKKeyDeviceInfo *kptr;
+ HPKModMap *mptr;
+
+ *keysyms_rec = *hpDefaultKeySyms(keydevice_id);
+ *modmap = hpModMap(keydevice_id);
+
+ if (keydevice_id == KB_NULL) return TRUE;
+
+ if (!HPKsetup((char *)NULL))
+ {
+ opps:
+ if (keydevice_id != KB_BUTTON_BOX)
+ ErrorF("Unable to load keymaps - using defaults.\n");
+ }
+ else
+ {
+ if (!HPKread_keymap(keydevice_id, tmp_keymap)) goto opps;
+
+ if (kptr = HPKlookup_kd_by_id(keydevice_id))
+ maparoo(kptr, keysyms_rec, False, modmap, hpModMap(keydevice_id));
+ }
+
+ HPKclean_up();
+
+ return TRUE;
+}
+
+
+extern char *getenv();
+
+ /*
+ * Input:
+ * keymap_file: Name of the file that contains keymaps. If NULL,
+ * only look in /usr/lib/X11/XHPKeymaps (the
+ * default) (can be overridden, see HPKsetup()). This
+ * can be filled in by the device driver if it (for some
+ * reason) doesn't want to use the default.
+ * keymap_name: Name of the keymap to load. Sometime like
+ * "button-box".
+ * keysyms_rec: Pointer to a KeySymsRec to fill in.
+ * modmap: Pointer to a pointer to a modmap.
+ * Output:
+ * keysyms_rec: FIlled in.
+ * modmap: points to a modmap to use with the keysyms_rec.
+ * Returns:
+ * TRUE : everything went as expected
+ * FALSE: Something went screwie, using null maps.
+ * Notes:
+ * There are four possible keymap files:
+ * - /usr/lib/X11/XHPKeymaps. This is the system default. It is
+ * supposed to remain untouched so that it can be overwritten by
+ * the system updates.
+ * - A file specified by the environment variable XHPKEYMAPFILE.
+ * This overrides XHPKeymaps.
+ * - A file specified by the device driver. For example, if a
+ * company writes a driver for xyz keyboard, they can ship a
+ * keymap without having to have the user modify XHPKeymaps.
+ * - /usr/lib/X11/XHPKeymaps.usr. This is the users "personal"
+ * keymap file. If they want to make changes to keymaps in
+ * XHPKeymaps, they should put the changed keymaps in
+ * XHPKeymaps.usr and leave XHPKeymaps unchanged.
+ * Here is the order in which keymap files are tried:
+ * If XHPKEYMAPFILE exists, use this load order:
+ * - The file specified by XHPKEYMAPFILE.
+ * - The user modifiable keymap file (XHPKeymaps.usr).
+ * - The drivers keymap file (if not NULL).
+ * If XHPKEYMAPFILE doesn't exist, use this order:
+ * - The user modifiable keymap file (XHPKeymaps.usr).
+ * - The drivers keymap file (if not NULL).
+ * - The default (system) keymap (/usr/lib/X11/XHPKeymaps).
+ */
+#define KEYMAP_ENV_VAR "XHPKEYMAPFILE"
+#define USERS_KEYMAP "XHPKeymaps.usr"
+int HPKget_kb_info_by_name(keymap_file, keymap_name, keysyms_rec, modmap)
+ char *keymap_file, *keymap_name; KeySymsRec *keysyms_rec; CARD8 **modmap;
+{
+ if (getenv(KEYMAP_ENV_VAR))
+ {
+ if (try_and_load_maps((char *)NULL, keymap_name, keysyms_rec, modmap) ||
+ try_and_load_maps(USERS_KEYMAP, keymap_name, keysyms_rec, modmap) ||
+ (keymap_file &&
+ try_and_load_maps(keymap_file, keymap_name, keysyms_rec, modmap)))
+ return TRUE;
+ }
+ else
+ {
+ if (try_and_load_maps(USERS_KEYMAP, keymap_name, keysyms_rec, modmap) ||
+ (keymap_file &&
+ try_and_load_maps(keymap_file, keymap_name, keysyms_rec, modmap)) ||
+ try_and_load_maps((char *)NULL, keymap_name, keysyms_rec, modmap))
+ return TRUE;
+ }
+
+ ErrorF("Unable to load keymap \"%s\" - using defaults (NULL maps).\n",
+ keymap_name);
+ *keysyms_rec = *hpDefaultKeySyms(KB_NULL);
+ *modmap = hpModMap(KB_NULL);
+
+ return FALSE;
+}
+
+static int try_and_load_maps(keymap_file, keymap_name, keysyms_rec, modmap)
+ char *keymap_file, *keymap_name; KeySymsRec *keysyms_rec; CARD8 **modmap;
+{
+ HPKKeyDeviceInfo *kptr;
+ int all_OK = TRUE;
+
+ if (!HPKsetup(keymap_file)) all_OK = FALSE;
+ else
+ {
+ if (!(kptr = HPKlookup_kd_by_name(keymap_name)) ||
+ !HPKread_keymap(kptr->keydevice_id, tmp_keymap))
+ all_OK = FALSE;
+ else
+ maparoo(kptr, keysyms_rec, True, modmap, null_modmap);
+ }
+
+ HPKclean_up();
+
+ return all_OK;
+}
diff --git a/xc/programs/Xserver/hw/hp/input/hpext.h b/xc/programs/Xserver/hw/hp/input/hpext.h
new file mode 100644
index 000000000..052621fd6
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/hpext.h
@@ -0,0 +1,881 @@
+/* $XConsortium: hpext.h /main/4 1996/01/22 18:29:38 gildea $ */
+
+/*
+
+Copyright (c) 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef HPEXT_H
+#define HPEXT_H
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "X.h"
+#include "XHPproto.h" /* server version definitions */
+#ifdef XINPUT
+#include "XIproto.h"
+#endif /* XINPUT */
+
+/* Definitions for HP extensions used by the server and Xlib */
+
+/*********************************************************
+ *
+ * number of hp events, errors, and extension name.
+ *
+ */
+
+#define HPEVENTS 12
+#define HPERRORS 3
+#define CLIENT_REQ 1
+#define HPNAME "HPExtension"
+#define MIN_EVENT_REQUEST 1
+#define MAX_EVENT_REQUEST 11
+
+/*********************************************************
+ *
+ * Protocol request constants
+ *
+ */
+
+#define X_GetHpKeyboardId 1 /* DO NOT CHANGE THIS LINE! */
+#define X_HPListInputDevices 2
+#define X_HPSetInputDevice 3
+#define X_HPGetExtEventMask 4
+#define X_HPGetDeviceFocus 5
+#define X_HPGetClipList 6
+#define X_HPGrabDevice 7
+#define X_HPSetDeviceFocus 8
+#define X_HPUnGrabDevice 9
+#define X_HPSelectExtensionEvent 10
+#define X_HPGetCurrentDeviceMask 11
+#define X_HPEnableReset 12
+#define X_HPDisableReset 13
+#define X_HPGetDeviceMotionEvents 14
+#define X_HPGrabDeviceButton 15
+#define X_HPUngrabDeviceButton 16
+#define X_HPGrabDeviceKey 17
+#define X_HPUngrabDeviceKey 18
+#define X_HPDeviceAutoRepeatOn 19
+#define X_HPDeviceAutoRepeatOff 20
+#define X_HPPrompt 21
+#define X_HPAcknowledge 22
+#define X_HPRegisterWindow 23
+#define X_HPUnRegisterWindow 24
+#define X_HPSynchronizeColorRange 25
+#define X_HPGetServerMode 26
+#define X_HPGetDeviceKeyMapping 27
+#define X_HPChangeDeviceKeyMapping 28
+#define X_HPGetDeviceModifierMapping 29
+#define X_HPSetDeviceModifierMapping 30
+#define X_HPGetDeviceControl 31
+#define X_HPChangeDeviceControl 32
+#define X_HPGetWindowCursor 33
+#define X_HPGrabReset 34
+#define X_HPSendDdxDriverMsg 35
+#define X_HPGetClipLists 36
+#define X_HPSSChange 37 /* Screen saver change */
+
+#define sz_xHPListInputDevicesReq 4
+#define sz_xHPListInputDevicesReply 32
+#define sz_xHPSetInputDeviceReq 12
+#define sz_xHPSetInputDeviceReply 32
+#define sz_xHPGetExtEventMaskReq 8
+#define sz_xHPGetExtEventMaskReply 32
+#define sz_xHPGetDeviceFocusReq 8
+#define sz_xHPGetDeviceFocusReply 32
+#define sz_xHPGetClipListReq 16
+#define sz_xHPGetClipListReply 32
+#define sz_xHPGrabDeviceReq 24
+#define sz_xHPGrabDeviceReply 32
+#define sz_xHPSetDeviceFocusReq 20
+#define sz_xHPUnGrabDeviceReq 12
+#define sz_xHPSelectExtensionEventReq 16
+#define sz_xHPGetCurrentDeviceMaskReq 12
+#define sz_xHPGetCurrentDeviceMaskReply 32
+#define sz_xHPEnableResetReq 4
+#define sz_xHPDisableResetReq 4
+#define sz_xHPGetDeviceMotionEventsReq 20
+#define sz_xHPGetDeviceMotionEventsReply 32
+#define sz_xHPGrabDeviceButtonReq 24
+#define sz_xHPUngrabDeviceButtonReq 16
+#define sz_xHPGrabDeviceKeyReq 20
+#define sz_xHPUngrabDeviceKeyReq 16
+#define sz_xHPDeviceAutoRepeatOnReq 12
+#define sz_xHPDeviceAutoRepeatOffReq 8
+#define sz_xHPPromptReq 12
+#define sz_xHPAcknowledgeReq 12
+#define sz_xHPRegisterWindowReq 16
+#define sz_xHPRegisterWindowReply 152
+#define sz_xHPSynchronizeColorRangeReq 16
+#define sz_xHPGetServerModeReq 8
+#define sz_xHPGetServerModeReply 32
+#define sz_xHPGetDeviceKeyMappingReq 12
+#define sz_xHPGetDeviceKeyMappingReply 32
+#define sz_xHPChangeDeviceKeyMappingReq 12
+#define sz_xHPGetDeviceModifierMappingReq 8
+#define sz_xHPGetDeviceModifierMappingReply 32
+#define sz_xHPSetDeviceModifierMappingReq 12
+#define sz_xHPSetDeviceModifierMappingReply 32
+#define sz_xHPGetDeviceControlReq 8
+#define sz_xHPGetDeviceControlReply 64
+#define sz_xHPChangeDeviceControlReq 12
+#define sz_xHPGetWindowCursorReq 8
+#define sz_xHPGetWindowCursorReply 32
+#define sz_xHPGrabResetReq 4
+#define sz_xHPGrabResetReply 32
+#define sz_xHPSendDdxDriverMsgReq 16
+#define sz_xHPSendDdxDriverMsgReply 32
+#define sz_xHPGetClipListsReq 16
+#define sz_xHPGetClipListsReply 32
+
+#define GET_HPINPUTDEVICE(pDev) \
+ ((HPInputDevice *) ((pDev)->public.devicePrivate))
+
+struct dev_select_info
+ {
+ Mask mask;
+ long type;
+ };
+
+/*********************************************************
+ *
+ * Protocol request and reply structures.
+ *
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPListInputDevices */
+ CARD16 length;
+} xHPListInputDevicesReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPListInputDevices */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 ndevices B32;
+ CARD32 t_axes B32;
+ CARD32 data02 B32;
+ CARD32 data03 B32;
+ CARD32 data04 B32;
+ CARD32 data05 B32;
+ } xHPListInputDevicesReply;
+
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPSetInputDevice */
+ CARD16 length;
+ XID deviceid;
+ CARD32 mode;
+} xHPSetInputDeviceReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPSetInputDevice */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 status B32;
+ CARD32 data01 B32;
+ CARD32 data02 B32;
+ CARD32 data03 B32;
+ CARD32 data04 B32;
+ CARD32 data05 B32;
+ } xHPSetInputDeviceReply;
+
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPGetExtEventMask */
+ CARD16 length;
+ CARD32 evconst;
+} xHPGetExtEventMaskReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetExtEventMask */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 mask B32;
+ CARD32 evtype B32;
+ CARD32 data01 B32;
+ CARD32 data02 B32;
+ CARD32 data03 B32;
+ CARD32 data04 B32;
+ } xHPGetExtEventMaskReply;
+
+typedef struct {
+ CARD8 reqType; /* always HpeqCode */
+ CARD8 hpReqType; /* always X_HPGetCurrentDeviceMask */
+ CARD16 length;
+ Window window B32;
+ XID deviceid;
+} xHPGetCurrentDeviceMaskReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetCurrentDeviceMask */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 mask B32;
+ CARD32 data01 B32;
+ CARD32 data02 B32;
+ CARD32 data03 B32;
+ CARD32 data04 B32;
+ CARD32 data05 B32;
+ } xHPGetCurrentDeviceMaskReply;
+
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPGetDeviceFocus */
+ CARD16 length;
+ XID deviceid;
+} xHPGetDeviceFocusReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetDeviceFocus */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 status B32;
+ CARD32 focus B32;
+ Window revertTo B32;
+ CARD32 data01 B32;
+ CARD32 data02 B32;
+ CARD32 data03 B32;
+ } xHPGetDeviceFocusReply;
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPSetDeviceFocus */
+ CARD16 length;
+ Window focus B32;
+ XID deviceid;
+ Time time B32;
+ CARD8 revertTo;
+ CARD8 pad00;
+ CARD16 pad01;
+} xHPSetDeviceFocusReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGrabDevice */
+ CARD16 length B16;
+ Window grabWindow B32;
+ Time time B32;
+ XID deviceid;
+ CARD32 eventMask B32;
+ BOOL ownerEvents;
+ CARD8 pad00;
+ CARD16 pad01 B16;
+} xHPGrabDeviceReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGrabDevice */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD32 status;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ } xHPGrabDeviceReply;
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPUnGrabDevice */
+ CARD16 length B16;
+ Time time B32;
+ XID deviceid;
+} xHPUnGrabDeviceReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPSelectExtensionEvent */
+ CARD16 length B16;
+ Window window B32;
+ CARD32 extensionMask B32;
+ XID deviceid;
+} xHPSelectExtensionEventReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPEnableReset */
+ CARD16 length B16;
+} xHPEnableResetReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPDisableReset */
+ CARD16 length B16;
+} xHPDisableResetReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGetDeviceMotionEvents*/
+ CARD16 length B16;
+ Window window B32;
+ Time start B32;
+ Time stop B32;
+ XID deviceid;
+} xHPGetDeviceMotionEventsReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetDeviceMotionEvents */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 nEvents B32;
+ INT16 axes B16;
+ CARD16 pad2 B16;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xHPGetDeviceMotionEventsReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGrabDeviceButton */
+ CARD16 length B16;
+ Window grabWindow B32;
+ XID deviceid;
+ CARD32 eventMask;
+ CARD16 modifiers B16;
+ BOOL ownerEvents;
+ CARD8 button;
+ BYTE pointerMode, keyboardMode;
+ CARD8 pad1, pad2;
+} xHPGrabDeviceButtonReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPUngrabDeviceButton */
+ CARD16 length B16;
+ Window grabWindow B32;
+ XID deviceid;
+ CARD16 modifiers B16;
+ CARD8 button;
+ CARD8 pad1;
+} xHPUngrabDeviceButtonReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGrabDeviceKey */
+ CARD16 length B16;
+ Window grabWindow B32;
+ XID deviceid;
+ CARD16 modifiers B16;
+ BOOL ownerEvents;
+ CARD8 key;
+ BYTE pointerMode, keyboardMode;
+ BYTE pad1, pad2;
+} xHPGrabDeviceKeyReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPUngrabDeviceKey */
+ CARD16 length B16;
+ Window grabWindow B32;
+ XID deviceid;
+ CARD16 modifiers B16;
+ CARD8 key;
+ CARD8 pad1;
+} xHPUngrabDeviceKeyReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPDeviceAutoRepeatOn */
+ CARD16 length B16;
+ XID deviceid;
+ INT32 rate;
+} xHPDeviceAutoRepeatOnReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPDeviceAutoRepeatOff */
+ CARD16 length B16;
+ XID deviceid;
+} xHPDeviceAutoRepeatOffReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPPrompt */
+ CARD16 length B16;
+ XID deviceid;
+ CARD8 prompt;
+ CARD8 pad1, pad2, pad3;
+} xHPPromptReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPAcknowledge */
+ CARD16 length B16;
+ XID deviceid;
+ CARD8 ack;
+ CARD8 pad1, pad2, pad3;
+} xHPAcknowledgeReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGetServerMode */
+ CARD16 length B16;
+ CARD32 screen B32;
+} xHPGetServerModeReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetServerMode */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 mode B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xHPGetServerModeReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGetDeviceKeyMapping */
+ CARD16 length B16;
+ XID deviceid;
+ KeyCode firstKeyCode;
+ CARD8 count;
+ CARD16 pad1 B16;
+} xHPGetDeviceKeyMappingReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetDeviceKeyMapping */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD8 keySymsPerKeyCode;
+ CARD8 pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xHPGetDeviceKeyMappingReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPChangeDeviceKeyMapping */
+ CARD16 length B16;
+ XID deviceid;
+ CARD8 keyCodes;
+ KeyCode firstKeyCode;
+ CARD8 keySymsPerKeyCode;
+ CARD8 pad1;
+} xHPChangeDeviceKeyMappingReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGetDeviceModifierMapping */
+ CARD16 length B16;
+ XID deviceid;
+} xHPGetDeviceModifierMappingReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetDeviceModifierMapping */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD8 numKeyPerModifier;
+ CARD8 pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xHPGetDeviceModifierMappingReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPSetDeviceModifierMapping */
+ CARD16 length B16;
+ CARD8 numKeyPerModifier;
+ CARD8 pad1;
+ CARD16 pad2 B16;
+ XID deviceid;
+} xHPSetDeviceModifierMappingReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPSetDeviceModifierMapping */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD8 success;
+ CARD8 pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xHPSetDeviceModifierMappingReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPGetDeviceControl */
+ CARD16 length B16;
+ XID deviceid;
+} xHPGetDeviceControlReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetDeviceControl */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL globalAutoRepeat;
+ CARD8 keyClickPercent;
+ CARD8 bellPercent;
+ CARD8 pad0;
+ CARD32 ledMask B32;
+ CARD16 bellPitch B16;
+ CARD16 bellDuration B16;
+ CARD16 accelNumerator B16;
+ CARD16 accelDenominator B16;
+ CARD16 threshold B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ BYTE map[32]; /* bit masks start here */
+} xHPGetDeviceControlReply;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_HPChangeDeviceControl */
+ CARD16 length B16;
+ XID deviceid;
+ CARD32 mask B32;
+} xHPChangeDeviceControlReq;
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 hpReqType; /* always X_GetWindowCursor */
+ CARD16 length B16;
+ Window window B32;
+} xHPGetWindowCursorReq;
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 hpRepType; /* always X_HPGetWindowCursor */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Cursor cursor B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xHPGetWindowCursorReply;
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPGetClipList */
+ CARD16 length;
+ CARD32 wid; /* window id */
+ CARD32 gcid; /* graphics context id */
+ CARD32 format; /* clip list format */
+} xHPGetClipListReq;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT16 x B16; /* x origin of window */
+ INT16 y B16; /* y origin of window */
+ CARD16 width B16; /* width of window */
+ CARD16 height B16; /* height of window */
+ CARD32 count B32; /* number of clipping rectanges */
+ CARD32 data03 B32;
+ CARD32 data04 B32;
+ CARD32 data05 B32;
+ } xHPGetClipListReply;
+
+/*
+ * X_HPRegisterWindow request/reply structures...
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* X_HPRegisterWindow or X_HPUnReg... */
+ CARD16 length;
+ CARD32 wid; /* window id */
+ CARD32 accelid; /* accelerated id */
+ CARD32 flags; /* flags */
+} xHPRegisterWindowReq;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT32 error B32; /* error status */
+ CARD32 flags B32; /* flags */
+ BYTE path[80]; /* length must >= cfbPrivScreen->path */
+ CARD32 depth B32; /* depth of window */
+ INT32 w_class B32; /* window GRM_ID class */
+ INT32 w_screen B32; /* window GRM_ID screen */
+ INT32 w_window B32; /* window GRM_ID window */
+ BYTE w_name[40]; /* window GRM_ID name */
+ } xHPRegisterWindowReply;
+
+/*
+ * X_HPSynchronizeColorRange Request structure (no reply)
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* X_HPRegisterWindow or X_HPUnReg... */
+ CARD16 length;
+ CARD32 cmap; /* Colormap ID of interest */
+ CARD32 start; /* Starting pixel if changes to cmap */
+ CARD32 ncolors; /* number of pixels changed */
+} xHPSynchronizeColorRangeReq;
+
+/*
+ * X_HPSendDdxDriverMsg Request structure (possible reply)
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* X_HPRegisterWindow or X_HPUnReg... */
+ CARD16 length;
+ Window window; /* window of interest */
+ INT32 nMsgBytes; /* Number of bytes in message */
+ INT32 needReply; /* whether or not a reply is forthcoming */
+} xHPSendDdxDriverMsgReq;
+
+typedef struct {
+ CARD8 type;
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT32 nRepBytes;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ } xHPSendDdxDriverMsgReply;
+
+/*
+ * XHPGetClipLists request (not to be confused with XHPGetClipList.
+ * This extension gets multiple clip lists)
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* always X_HPGetClipLists */
+ CARD16 length;
+ CARD32 wid; /* window id */
+ CARD32 gcid; /* graphics context id */
+ CARD32 nClipLists; /* number of clip lists requested */
+/* To be followed by 'nClipLists' CARD32 format longwords: */
+} xHPGetClipListsReq;
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT16 x B16; /* x origin of window */
+ INT16 y B16; /* y origin of window */
+ CARD16 width B16; /* width of window */
+ CARD16 height B16; /* height of window */
+ CARD32 count B32; /* number of clip lists */
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+/* To be followed by 'count' xHPGetClipListsReplyData structures: */
+} xHPGetClipListsReply;
+
+typedef struct {
+ CARD16 count B16; /* number of clip boxes */
+ CARD16 size B16; /* size of each clip box in bytes */
+/* To be followed by 'count * size' bytes: */
+} xHPGetClipListsReplyData;
+
+
+/* X_HPGrabReset Request structure */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* X_HPGrabReset */
+ CARD16 length;
+} xHPGrabResetReq;
+
+typedef struct {
+ CARD8 repType; /* always HpReqCode */
+ CARD8 hpRepType; /* X_HPGrabReset */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Atom evtype B32; /* event type to expect */
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ } xHPGrabResetReply;
+
+/* X_HPSSChange Request structures
+ * Notes:
+ * The sz_x numbers are sizeof(struct) padded to the to 4 bytes. This to
+ * make the X packets work correctly.
+ */
+
+typedef struct {
+ CARD8 reqType; /* always HpReqCode */
+ CARD8 hpReqType; /* X_HPSSChange */
+ CARD16 length;
+ CARD32 flags; /* stuff */
+ CARD32 wid; /* just in case */
+} xHPSSChangeReq;
+
+#define sz_xHPSSChangeReq 12
+
+typedef struct {
+ CARD8 repType; /* always HpReqCode */
+ CARD8 hpRepType; /* X_HPSSChange */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Atom evtype B32; /* event type to expect */
+ CARD32 flags B32; /* */
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ } xHPSSChangeReply;
+
+#define sz_xHPSSChangeReply 32
+
+/**********************************************************
+ *
+ * extension events.
+ *
+ */
+
+typedef struct
+ {
+ INT16 ax_num;
+ INT16 ax_val;
+ } XHPaxis_data;
+
+typedef struct
+ {
+ BYTE type;
+ BYTE count;
+ CARD16 sequencenumber B16;
+ XID deviceid;
+ CARD32 pad00 B32;
+ CARD32 pad01 B32;
+ CARD32 pad02 B32;
+ CARD32 pad03 B32;
+ CARD32 pad04 B32;
+ CARD32 pad05 B32;
+ } xAnyExtensionEvent;
+
+typedef struct
+ {
+ BYTE type;
+ BYTE ext_type;
+ CARD16 sequencenumber B16;
+ XID deviceid;
+ INT16 axes_count B16;
+ CARD16 pad00 B16;
+ XHPaxis_data data[4];
+ CARD32 pad01 B32;
+ } xHPExtensionEvent;
+
+typedef struct
+ {
+ xEvent b;
+ xAnyExtensionEvent x;
+ } xAnyEvent;
+
+typedef struct
+ {
+ xEvent b;
+#ifdef XINPUT
+ deviceValuator x;
+#else
+ xHPExtensionEvent x;
+#endif /* XINPUT */
+ } xHPEvent;
+
+typedef struct
+ {
+ BYTE type;
+ BYTE pad00;
+ CARD16 sequencenumber B16;
+ INT16 detail B16;
+ BYTE mode; /* really XMode */
+ BYTE pad1;
+ XID deviceid;
+ Window window B32;
+ CARD32 pad01 B32;
+ CARD32 pad02 B32;
+ CARD32 pad03 B32;
+ CARD32 pad04 B32;
+ } xHPdevicefocus;
+
+typedef struct
+ {
+ BYTE type;
+ BYTE pad00;
+ CARD16 sequencenumber B16;
+ CARD8 request;
+ KeyCode firstKeyCode;
+ CARD8 count;
+ BYTE pad1;
+ XID deviceid;
+ CARD32 pad01 B32;
+ CARD32 pad02 B32;
+ CARD32 pad03 B32;
+ CARD32 pad04 B32;
+ CARD32 pad05 B32;
+ } xHPDeviceMappingEvent;
+
+typedef struct
+ {
+ BYTE type;
+ BYTE deviceid;
+ BYTE map[30];
+ } xHPDeviceKeymapEvent;
+
+#endif
diff --git a/xc/programs/Xserver/hw/hp/input/hpkeys.h b/xc/programs/Xserver/hw/hp/input/hpkeys.h
new file mode 100644
index 000000000..810784c07
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/hpkeys.h
@@ -0,0 +1,251 @@
+#ifndef HPKEYS_H
+#define HPKEYS_H
+/* $TOG: hpkeys.h /main/3 1998/02/10 13:11:15 kaleb $ */
+/*
+
+Copyright 1986, 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+/***********************************************************************
+ *
+ * file: hpkeys.h
+ *
+ * contains key definitions and other static information used by x_hil.c
+ *
+ */
+
+#define DOWN 0
+#define LEFT 1
+#define RIGHT 2
+#define UP 3
+
+#ifdef __apollo
+u_char cursor_down = 0x7b;
+u_char cursor_left = 0x61;
+u_char cursor_right = 0x63;
+u_char cursor_up = 0x49;
+u_char button_1 = 0x44;
+u_char button_2 = 0x45;
+u_char button_3 = 0x46;
+u_char button_4 = 0x47;
+u_char button_5 = 0x5d;
+u_char button_6 = 0x00;
+u_char button_7 = 0x00;
+u_char button_8 = 0x00;
+#else
+u_char cursor_down = 0x1a;
+u_char cursor_left = 0x18;
+u_char cursor_right = 0x1c;
+u_char cursor_up = 0x12;
+u_char button_1 = 0x1d;
+u_char button_2 = 0x19;
+u_char button_3 = 0x1b;
+u_char button_4 = 0x1f;
+u_char button_5 = 0x15;
+u_char button_6 = 0x00;
+u_char button_7 = 0x00;
+u_char button_8 = 0x00;
+#endif
+
+u_short pointer_move = 10;
+u_short pointer_mod1_amt = 1;
+u_short pointer_mod2_amt = 40;
+u_short pointer_mod3_amt = 5;
+u_char pointer_amt_mods[3] = {0xff,0xff,0xff};
+u_char pointer_key_mods[3] = {0xff,0xff,0xff};
+u_char borrow_mode_mods[3] = {0x43,0x5e,0xff};
+#ifdef __apollo
+u_char borrow_mode = 0x15;
+u_char reset_mods[3] = {0x43,0x5e,0xff};
+u_char reset = 0x19;
+#endif
+#if defined(__hpux) || defined(__hp_osf)
+u_char reset_mods[3] = {0x06,0x05,0xff};
+u_char reset = 0x0f;
+#endif
+u_char screen_change_amt = SCREEN_CHANGE_DEFAULT;
+u_char ptr_button_map[] = {0,1,2,3,4,5,6,7,8};
+u_char button_latching = LATCHING_OFF;
+u_char button_chording = CHORDING_DEFAULT;
+u_char screen_orientation = HORIZONTAL;
+u_char screen_row_wrap = DEFAULT;
+u_char screen_col_wrap = DEFAULT;
+u_int tablet_xorigin = 0;
+u_int tablet_yorigin = 0;
+u_int tablet_width = 0;
+u_int tablet_height = 0;
+u_char isotropic_scaling = 0;
+
+u_char ascii_to_code [128][7] = {
+ {0x0c,0x0a,0x7a,0x7b,0x0b,0x0d,0}, /* cntl - @ */
+ {0x0c,0x5a,0x5b,0x0d,0,0,0}, /* cntl - a */
+ {0x0c,0x30,0x31,0x0d,0,0,0}, /* cntl - b */
+ {0x0c,0x34,0x35,0x0d,0,0,0}, /* cntl - c */
+ {0x0c,0x56,0x57,0x0d,0,0,0}, /* cntl - d */
+ {0x0c,0x68,0x69,0x0d,0,0,0}, /* cntl - e */
+ {0x0c,0x54,0x55,0x0d,0,0,0}, /* cntl - f */
+ {0x0c,0x52,0x53,0x0d,0,0,0}, /* cntl - g */
+ {0x0c,0x50,0x51,0x0d,0,0,0}, /* cntl - h */
+ {0x0c,0xc0,0xc1,0x0d,0,0,0}, /* cntl - i */
+ {0x0c,0xd0,0xd1,0x0d,0,0,0}, /* cntl - j */
+ {0x0c,0xd2,0xd3,0x0d,0,0,0}, /* cntl - k */
+ {0x0c,0xd4,0xd5,0x0d,0,0,0}, /* cntl - l */
+ {0x0c,0xe0,0xe1,0x0d,0,0,0}, /* cntl - m */
+ {0x0c,0xf0,0xf1,0x0d,0,0,0}, /* cntl - n */
+ {0x0c,0xc2,0xc3,0x0d,0,0,0}, /* cntl - o */
+ {0x0c,0xc4,0xc5,0x0d,0,0,0}, /* cntl - p */
+ {0x0c,0x6c,0x6d,0x0d,0,0,0}, /* cntl - q */
+ {0x0c,0x66,0x67,0x0d,0,0,0}, /* cntl - r */
+ {0x0c,0x58,0x59,0x0d,0,0,0}, /* cntl - s */
+ {0x0c,0x64,0x65,0x0d,0,0,0}, /* cntl - t */
+ {0x0c,0x60,0x61,0x0d,0,0,0}, /* cntl - u */
+ {0x0c,0x32,0x33,0x0d,0,0,0}, /* cntl - v */
+ {0x0c,0x6a,0x6b,0x0d,0,0,0}, /* cntl - w */
+ {0x0c,0x36,0x37,0x0d,0,0,0}, /* cntl - x */
+ {0x0c,0x62,0x63,0x0d,0,0,0}, /* cntl - y */
+ {0x0c,0x38,0x39,0x0d,0,0,0}, /* cntl - z */
+ {0x0c,0xc6,0xc7,0x0d,0,0,0}, /* cntl - [ */
+ {0x0c,0xca,0xcb,0x0d,0,0,0}, /* cntl - \ */
+ {0x0c,0xc8,0xc9,0x0d,0,0,0}, /* cntl - ] */
+ {0x0c,0x0a,0x72,0x73,0x0b,0x0d,0}, /* cntl - ^ */
+ {0x0c,0x0a,0xb6,0xb7,0x0b,0x0d,0}, /* cntl - _ */
+ {0xf2,0xf3,0,0,0,0,0}, /* space */
+ {0x0a,0x7c,0x7d,0x0b,0,0,0}, /* ! */
+ {0x0a,0xd8,0xd9,0x0b,0,0,0}, /* " */
+ {0x0a,0x78,0x79,0x0b,0,0,0}, /* # */
+ {0x0a,0x76,0x77,0x0b,0,0,0}, /* $ */
+ {0x0a,0x74,0x75,0x0b,0,0,0}, /* % */
+ {0x0a,0x70,0x71,0x0b,0,0,0}, /* & */
+ {0xd8,0xd9,0,0,0,0,0}, /* ' */
+ {0x0a,0xb2,0xb3,0x0b,0,0,0}, /* ( */
+ {0x0a,0xb4,0xb5,0x0b,0,0,0}, /* ) */
+ {0x0a,0xb0,0xb1,0x0b,0,0,0}, /* * */
+ {0x0a,0xb8,0xb9,0x0b,0,0,0}, /* + */
+ {0xe2,0xe3,0,0,0,0,0}, /* , */
+ {0xb6,0xb7,0,0,0,0,0}, /* - */
+ {0xe4,0xe5,0,0,0,0,0}, /* . */
+ {0xe6,0xe7,0,0,0,0,0}, /* / */
+ {0xb4,0xb5,0,0,0,0,0}, /* 0 */
+ {0x7c,0x7d,0,0,0,0,0}, /* 1 */
+ {0x7a,0x7b,0,0,0,0,0}, /* 2 */
+ {0x78,0x79,0,0,0,0,0}, /* 3 */
+ {0x76,0x77,0,0,0,0,0}, /* 4 */
+ {0x74,0x75,0,0,0,0,0}, /* 5 */
+ {0x72,0x73,0,0,0,0,0}, /* 6 */
+ {0x70,0x71,0,0,0,0,0}, /* 7 */
+ {0xb0,0xb1,0,0,0,0,0}, /* 8 */
+ {0xb2,0xb3,0,0,0,0,0}, /* 9 */
+ {0x0a,0xd6,0xd7,0x0b,0,0,0}, /* : */
+ {0xd6,0xd7,0,0,0,0,0}, /* ; */
+ {0x0a,0xe2,0xe3,0x0b,0,0,0}, /* < */
+ {0xb8,0xb9,0,0,0,0,0}, /* = */
+ {0x0a,0xe4,0xe5,0x0b,0,0,0}, /* > */
+ {0x0a,0xe6,0xe7,0x0b,0,0,0}, /* ? */
+ {0x0a,0x7a,0x7b,0x0b,0,0,0}, /* @ */
+ {0x0a,0x5a,0x5b,0x0b,0,0,0}, /* A */
+ {0x0a,0x30,0x31,0x0b,0,0,0}, /* B */
+ {0x0a,0x34,0x35,0x0b,0,0,0}, /* C */
+ {0x0a,0x56,0x57,0x0b,0,0,0}, /* D */
+ {0x0a,0x68,0x69,0x0b,0,0,0}, /* E */
+ {0x0a,0x54,0x55,0x0b,0,0,0}, /* F */
+ {0x0a,0x52,0x53,0x0b,0,0,0}, /* G */
+ {0x0a,0x50,0x51,0x0b,0,0,0}, /* H */
+ {0x0a,0xc0,0xc1,0x0b,0,0,0}, /* I */
+ {0x0a,0xd0,0xd1,0x0b,0,0,0}, /* J */
+ {0x0a,0xd2,0xd3,0x0b,0,0,0}, /* K */
+ {0x0a,0xd4,0xd5,0x0b,0,0,0}, /* L */
+ {0x0a,0xe0,0xe1,0x0b,0,0,0}, /* M */
+ {0x0a,0xf0,0xf1,0x0b,0,0,0}, /* N */
+ {0x0a,0xc2,0xc3,0x0b,0,0,0}, /* O */
+ {0x0a,0xc4,0xc5,0x0b,0,0,0}, /* P */
+ {0x0a,0x6c,0x6d,0x0b,0,0,0}, /* Q */
+ {0x0a,0x66,0x67,0x0b,0,0,0}, /* R */
+ {0x0a,0x58,0x59,0x0b,0,0,0}, /* S */
+ {0x0a,0x64,0x65,0x0b,0,0,0}, /* T */
+ {0x0a,0x60,0x61,0x0b,0,0,0}, /* U */
+ {0x0a,0x32,0x33,0x0b,0,0,0}, /* V */
+ {0x0a,0x6a,0x6b,0x0b,0,0,0}, /* W */
+ {0x0a,0x36,0x37,0x0b,0,0,0}, /* X */
+ {0x0a,0x62,0x63,0x0b,0,0,0}, /* Y */
+ {0x0a,0x38,0x39,0x0b,0,0,0}, /* Z */
+ {0xc6,0xc7,0,0,0,0,0}, /* [ */
+ {0xca,0xcb,0,0,0,0,0}, /* \ */
+ {0xc8,0xc9,0,0,0,0,0}, /* ] */
+ {0x0a,0x72,0x73,0x0b,0,0,0}, /* ^ */
+ {0x0a,0xb6,0xb7,0x0b,0,0,0}, /* _ */
+ {0x7e,0x7f,0,0,0,0,0}, /* ` */
+ {0x5a,0x5b,0,0,0,0,0}, /* a */
+ {0x30,0x31,0,0,0,0,0}, /* b */
+ {0x34,0x35,0,0,0,0,0}, /* c */
+ {0x56,0x57,0,0,0,0,0}, /* d */
+ {0x68,0x69,0,0,0,0,0}, /* e */
+ {0x54,0x55,0,0,0,0,0}, /* f */
+ {0x52,0x53,0,0,0,0,0}, /* g */
+ {0x50,0x51,0,0,0,0,0}, /* h */
+ {0xc0,0xc1,0,0,0,0,0}, /* i */
+ {0xd0,0xd1,0,0,0,0,0}, /* j */
+ {0xd2,0xd3,0,0,0,0,0}, /* k */
+ {0xd4,0xd5,0,0,0,0,0}, /* l */
+ {0xe0,0xe1,0,0,0,0,0}, /* m */
+ {0xf0,0xf1,0,0,0,0,0}, /* n */
+ {0xc2,0xc3,0,0,0,0,0}, /* o */
+ {0xc4,0xc5,0,0,0,0,0}, /* p */
+ {0x6c,0x6d,0,0,0,0,0}, /* q */
+ {0x66,0x67,0,0,0,0,0}, /* r */
+ {0x58,0x59,0,0,0,0,0}, /* s */
+ {0x64,0x65,0,0,0,0,0}, /* t */
+ {0x60,0x61,0,0,0,0,0}, /* u */
+ {0x32,0x33,0,0,0,0,0}, /* v */
+ {0x6a,0x6b,0,0,0,0,0}, /* w */
+ {0x36,0x37,0,0,0,0,0}, /* x */
+ {0x62,0x63,0,0,0,0,0}, /* y */
+ {0x38,0x39,0,0,0,0,0}, /* z */
+ {0x0a,0xc6,0xc7,0x0b,0,0,0}, /* { */
+ {0x0a,0xca,0xcb,0x0b,0,0,0}, /* | */
+ {0x0a,0xc6,0xc9,0x0b,0,0,0}, /* } */
+ {0x0a,0x7e,0x7f,0x0b,0,0,0}, /* ~ */
+ {0x0a,0x3e,0x3f,0x0b,0,0,0}}; /* delete */
+#endif
diff --git a/xc/programs/Xserver/hw/hp/input/screentab.h b/xc/programs/Xserver/hw/hp/input/screentab.h
new file mode 100644
index 000000000..7d2cf9654
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/screentab.h
@@ -0,0 +1,73 @@
+/* $TOG: screentab.h /main/5 1998/02/10 13:11:20 kaleb $ */
+/*
+
+Copyright 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+Hewlett-Packard not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+/*
+ * Header file which declares structures to initialize and close
+ * each type of screen supported by the X server.
+ *
+ */
+
+typedef struct {
+ char *productNumber;
+ char *productNickname;
+ Bool (*InfoScreen)();
+ Bool (*InitScreen)();
+ Bool (*CloseScreen)();
+ } ScreenTableRec;
+
+typedef ScreenTableRec ScreenTable[];
+
+typedef struct {
+ int position;
+ int left;
+ int right;
+ } MultiScreenRec;
+
+extern ScreenTable screenTable;
+
+extern MultiScreenRec multiScreenTable[];
diff --git a/xc/programs/Xserver/hw/hp/input/x_hil.c b/xc/programs/Xserver/hw/hp/input/x_hil.c
new file mode 100644
index 000000000..316f2fdec
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/x_hil.c
@@ -0,0 +1,1691 @@
+/* $TOG: x_hil.c /main/9 1998/02/10 13:11:38 kaleb $ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: ddx/hp/hp/x_hil.c
+** *
+** * Contents: Input event procedures for the
+** * X/Starbase Merged Server
+** *
+** * Created: 4/28/88
+** *
+** * Last Change: 12/05/88
+** *
+** * Last Release: IC2
+** *
+** * Revision: A.01.00
+** *
+** * Author: --gms
+** *
+** * Copyright: (c) 1988 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/hp/input/x_hil.c,v 3.1 1998/10/04 09:38:27 dawes Exp $ */
+
+/*
+
+Copyright 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+Hewlett-Packard not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#define NEED_EVENTS
+#include "X.h"
+#include "XI.h"
+#include "Xproto.h"
+#include "Xpoll.h"
+#include "hildef.h"
+#include "XHPproto.h"
+#include "x_hil.h"
+#include "x_serialdrv.h"
+#include "hpkeys.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include "hppriv.h"
+#include <sys/times.h>
+#include <sys/hilioctl.h>
+#ifdef XKB
+#include "XKBsrv.h"
+extern Bool noXkbExtension;
+#endif
+#ifdef XINPUT
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#endif
+
+#define FIRST_EXTENSION_EVENT 64
+#define MIN_KEYCODE 8
+
+#define ENQUEUE_EVENT(ev) \
+ {if (xE.b.u.u.type != 0) /* at least 1 motion event */ \
+ {ev = allocate_event();/* get current queue pointer*/ \
+ *ev = xE; /* copy from global struct */ \
+ xE = zxE;}} /* mark it as processed */
+
+#ifdef XTESTEXT1
+/*
+ * defined in xtestext1di.c
+ */
+extern int on_steal_input;
+extern int exclusive_steal;
+#endif /* XTESTEXT1 */
+
+/******************************************************************
+ *
+ * Externs and variables referenced from other files.
+ *
+ */
+
+extern char *mflg;
+xEvent *format_ev();
+xHPEvent xE, zxE;
+
+#ifdef XINPUT
+extern int DeviceMotionNotify;
+extern int DeviceKeyPress;
+extern int DeviceKeyRelease;
+extern int DeviceButtonPress;
+extern int DeviceButtonRelease;
+extern int DeviceValuator;
+extern int ProximityIn;
+extern int ProximityOut;
+#endif /* XINPUT */
+extern int axes_changed;
+extern int keyboard_click;
+extern int screenIsSaved;
+extern int x_axis, y_axis;
+extern int max_input_fd;
+extern HPInputDevice l_devs[MAX_LOGICAL_DEVS];
+extern HPInputDevice *hpKeyboard;
+extern HPInputDevice *hpPointer;
+extern HPInputDevice *hptablet_extension;
+extern WindowPtr *WindowTable;
+extern InputInfo inputInfo;
+extern DeviceIntPtr screen_change_dev;
+extern DeviceIntPtr tablet_extension_device;
+
+extern unsigned tablet_xorg;
+extern unsigned tablet_yorg;
+extern unsigned tablet_xlimit;
+extern unsigned tablet_ylimit;
+extern u_int tablet_width;
+
+static Bool in_tablet_extension = FALSE;
+static BoxRec LimitTheCursor;
+
+
+u_char pointer_amt_bits[3];
+u_char ptr_mods, mv_mods, rs_mods, bw_mods;
+Bool screen_was_changed = FALSE;
+Bool reset_enabled = TRUE;
+int hpActiveScreen = 0; /* active screen ndx (Zaphod) */
+int queue_events_free = MAX_EVENTS;
+int pending_index;
+int pending_bytes;
+float acceleration;
+int threshold;
+struct x11EventQueue *events_queue; /* pointer to events queue. */
+xHPEvent *allocate_event();
+struct dev_info hil_info; /* holds hil_data */
+
+/******************************************************************
+ *
+ * Variables global to this file.
+ *
+ */
+
+static DeviceIntPtr find_deviceintrec();
+static int process_inputs();
+static void process_serial_data();
+static check_subset_and_scale();
+static move_sprite();
+static send_motion();
+static send_button();
+static move_mouse();
+static u_char last_direction;
+static u_char last_key;
+static int k_down_flag[4];
+static int k_down_incx[4];
+static int k_down_incy[4];
+
+/****************************************************************************
+ *
+ * Process all available data from the input devices and put it on the server's
+ * internal events queue. When this routine is invoked, that queue is empty
+ * since the server empties it each time through its main dispatch loop.
+ *
+ * The server's internal queue can hold 256 events. If the server is busy for
+ * a long time, it is possible for the queue to fill up. In that case we
+ * can return with unread data, or data that is left in a global buffer.
+ * This routine must be prepared to handle such leftover data.
+ *
+ * After handling leftovers, this routine finds a file descriptor with data
+ * ready to be read and calls process_inputs to handle it.
+ *
+ */
+
+CheckInput (blockData, result, pReadmask)
+ pointer blockData;
+ int result;
+ pointer pReadmask;
+ {
+ fd_set* LastSelectMask = (fd_set*)pReadmask;
+ fd_set mask, checkmask;
+ extern fd_set EnabledDevices;
+ int i;
+ int checkfd = max_input_fd; /* max fd valid for input*/
+ int checkword = checkfd >> 5; /* max valid word of mask*/
+
+ if (result <= 0)
+ return;
+ XFD_ANDSET(&mask, LastSelectMask, &EnabledDevices);
+ if (!XFD_ANYSET(&mask))
+ return;
+
+ FD_ZERO(&checkmask);
+
+ FD_SET(checkfd, &checkmask); /* corresponding mask */
+
+ for (i=checkword; i>=0; i--) /* for all mask words */
+ {
+ while (mask.fds_bits[i] &&
+ checkmask.fds_bits[i]) /* while input available*/
+ {
+ if (mask.fds_bits[i] & checkmask.fds_bits[i]) /* current fd valid */
+ {
+ mask.fds_bits[i] &= ~checkmask.fds_bits[i];
+ process_inputs(checkfd); /* process its input */
+ }
+ checkfd--;
+ checkmask.fds_bits[i] = checkmask.fds_bits[i] >> 1;
+ }
+ if (i>0)
+ {
+ checkfd = (i-1) * 32 + 31;
+ FD_SET(checkfd, &checkmask); /* corresponding mask */
+ }
+ }
+ }
+
+/****************************************************************************
+ *
+ * Find the device data structure that matches the file descriptor from which
+ * data will be read. Read up to 2000 bytes (HIL driver buffer is only 512)
+ * from that file descriptor. From the data read, get 1 HIL data packet.
+ * That packet may contain up to 8 keycodes and 1 motion event. In the case
+ * of a barcode reader in ASCII mode, each keycode may generate up to 6
+ * X input events. The worst case is therefore 49 X events from 1 HIL data
+ * packet.
+ *
+ */
+
+static int process_inputs (file_ds)
+ int file_ds; /* file_ds to read from */
+ {
+ int i;
+ u_char *hil_ptr;
+ HPInputDevice *indevice = NULL;
+ DeviceIntPtr dev;
+ xHPEvent *xHP;
+ Bool done = FALSE;
+
+ for (i=0; i<MAX_LOGICAL_DEVS; i++)
+ {
+ if (file_ds == l_devs[i].d.file_ds)
+ {
+ indevice = &(l_devs[i]);
+ break;
+ }
+ }
+
+ dev = find_deviceintrec(indevice);
+
+ while (!done) /* data yet to be processed */
+ {
+ if (queue_events_free <= MAXHILEVENTS) /* no room on server queue */
+ return;
+ hil_ptr = (unsigned char *) &hil_info;/* place to copy packet to*/
+ done = get_serial_event (hil_ptr);
+ process_serial_data (dev, hil_info.hil_dev, &(hil_info));
+ }
+ if (xE.b.u.u.type != 0) /* at least 1 motion event */
+ {
+ xHP = allocate_event(); /* get current queue pointer*/
+ *xHP = xE; /* copy from global struct */
+ xE = zxE; /* mark it as processed */
+ }
+ }
+
+/***************************************************************************
+ *
+ * Given the HP device structure, find the DIX device structure that
+ * logically corresponds to it. There is a one-to-one correspondence,
+ * expect when the keyboard is also the X pointer, a tablet is subsetted,
+ * or an input device is merged with the X pointer or X keyboard.
+ *
+ * Callers: process_inputs(), read_shmhil().
+ *
+ */
+
+static
+DeviceIntPtr find_deviceintrec (indevice)
+ HPInputDevice *indevice;
+ {
+ PtrFeedbackPtr p;
+ DeviceIntPtr dev = NULL;
+
+ if (indevice != NULL)
+ {
+ hil_info.hil_dev = indevice; /* input device struct ptr */
+ if (hptablet_extension &&
+ indevice->d.file_ds==hptablet_extension->d.file_ds &&
+ in_tablet_extension)
+ {
+ hil_info.hil_dev = hptablet_extension;
+ dev = tablet_extension_device;
+ }
+ else if (indevice==hpKeyboard || (indevice->x_type==KEYBOARD &&
+ (indevice->hpflags & MERGED_DEVICE)))
+ dev = inputInfo.keyboard;
+ else if (indevice==hpPointer || (indevice->x_type==MOUSE &&
+ (indevice->hpflags & MERGED_DEVICE)))
+ dev = inputInfo.pointer;
+#ifdef XINPUT
+ else{
+ for (dev = inputInfo.devices;
+ dev && ((HPInputDevice *)dev->public.devicePrivate != indevice);
+ dev = dev->next)
+ ;
+ if (!dev)
+ FatalError ("X server couldn't find current input device - Aborting.\n");
+ }
+
+ p = dev->ptrfeed;
+ if (p != NULL)
+ {
+ threshold = p->ctrl.threshold;
+ acceleration = (float) p->ctrl.num / (float) p->ctrl.den;
+ }
+#endif /* XINPUT */
+ if (acceleration == 0)
+ acceleration = 1;
+ }
+ else
+ FatalError ("X server couldn't find current input device - Aborting.\n");
+ return (dev);
+ }
+
+/****************************************************************************
+ *
+ * process the serial data packet and generate X input events as needed.
+ *
+ */
+
+static u_int s_code[2];
+
+static void process_serial_data (dev, phys, info)
+ DeviceIntPtr dev;
+ HPInputDevice *phys;
+ struct dev_info *info;
+ {
+ xEvent *ev;
+ u_int *hil_code;
+ u_char type, kcode;
+
+ while (pending_index < pending_bytes )
+ {
+ if (info->poll_hdr & MOTION_DATA)
+ {
+ handle_motion_event (dev, phys, info);
+ if (pending_index >= pending_bytes)
+ return;
+ }
+
+ hil_code = s_code;
+
+ if (phys->hpflags & DATA_IS_8_BITS)
+ *hil_code = (info->dev_data)[pending_index++];
+ else if (phys->hpflags & DATA_IS_16_BITS)
+ {
+ *hil_code = ((info->dev_data)[pending_index+1] << 8) |
+ (info->dev_data)[pending_index];
+ pending_index += 2;
+ }
+ else if (phys->hpflags & DATA_IS_32_BITS)
+ {
+ *hil_code = ((info->dev_data)[pending_index+3] << 24) |
+ (info->dev_data)[pending_index+2] << 16 |
+ (info->dev_data)[pending_index+1] << 8 |
+ (info->dev_data)[pending_index];
+ pending_index += 4;
+ }
+ else
+ {
+ pending_index = pending_bytes;
+ return;
+ }
+
+ if (info->poll_hdr & KEY_DATA)
+ {
+ /* Check to see if this is a "down" keycode for a key that is
+ already down. If so, and autorepeat has been disabled for
+ this key, ignore the key and return.
+ */
+
+ kcode = (u_char) (*hil_code >> 1); /* same code up & down */
+ kcode += MIN_KEYCODE; /* avoid mouse codes. */
+
+ if (*hil_code & UP_MASK)
+ if (dev==inputInfo.keyboard || dev==inputInfo.pointer)
+ type = KeyRelease;
+ else
+ type = DeviceKeyRelease;
+ else
+ {
+ if (KeyIsDown(dev,kcode) && !KeyIsRepeating(dev,kcode))
+ return;
+ if (dev==inputInfo.keyboard || dev==inputInfo.pointer)
+ type = KeyPress;
+ else
+ type = DeviceKeyPress;
+ }
+
+ ev= format_ev (dev, type, kcode, info->timestamp, phys, NULL);
+ parse_keycode (dev, phys, ev);
+ }
+ else if (info->poll_hdr & BUTTON_DATA)
+ {
+
+ if (dev==inputInfo.pointer)
+ type = (*hil_code & UP_MASK) ? ButtonRelease : ButtonPress;
+ else
+ type = (*hil_code & UP_MASK) ? DeviceButtonRelease
+ : DeviceButtonPress;
+
+ ev= format_ev (dev, type,(*hil_code >>1) + 1,info->timestamp,phys,NULL);
+#ifdef XTESTEXT1
+ {
+ extern int on_steal_input; /* steal input mode is on. */
+ extern int exclusive_steal;
+
+ if (on_steal_input)
+ XTestStealKeyData(ev->u.u.detail, ev->u.u.type, MOUSE,
+ phys->coords[0], phys->coords[1]);
+
+ if (exclusive_steal)
+ deallocate_event(ev);
+ }
+#endif /* XTESTEXT1 */
+ }
+#ifdef XINPUT
+ else if (info->poll_hdr & PROXIMITY_DATA)
+ {
+ /* proximity HIL codes cause a different event type.
+ However, proximity is not reported for devices being
+ used as the X pointer, unless they have no buttons
+ (like a touchscreen), in which case the proximity is
+ treated as button 1.
+ */
+ if (dev!=inputInfo.pointer)
+ {
+ type = (*hil_code & UP_MASK) ? ProximityOut : ProximityIn;
+ ev= format_ev (dev, type, 0, info->timestamp, phys, NULL);
+ return;
+ }
+ else if (phys->d.num_buttons == 0)
+ {
+ type = (*hil_code & UP_MASK) ? ButtonRelease : ButtonPress;
+ ev= format_ev (dev, type, 1, info->timestamp, phys, NULL);
+ }
+ else
+ return; /* proximity not reported for X pointer */
+ }
+#endif /* XINPUT */
+ else
+ {
+ pending_index = pending_bytes;
+ return;
+ }
+ }
+ }
+
+/*******************************************************************
+ *
+ * handle_motion_event()
+ *
+ */
+
+handle_motion_event (dev, phys, info)
+ DeviceIntPtr dev;
+ HPInputDevice *phys;
+ struct dev_info *info;
+ {
+ int i, type, bytes_coord;
+ int tmp, coords[MAX_AXES];
+ char *sdata;
+ u_char *udata;
+ HPInputDevice *log;
+
+ if (dev==inputInfo.pointer)
+ {
+ type = MotionNotify;
+ log = hpPointer;
+ }
+ else
+ {
+ type = DeviceMotionNotify;
+ log = phys;
+ }
+ if (phys->hpflags & DATA_IS_32_BITS)
+ bytes_coord = 4;
+ else if (phys->hpflags & DATA_IS_16_BITS)
+ bytes_coord = 2;
+ else
+ bytes_coord = 1;
+
+ pending_index += phys->d.ax_num * bytes_coord;
+
+ if (phys->hpflags & ABSOLUTE_DATA) /* absolute device */
+ {
+ udata = info->dev_data;
+ for (i=0; i < (u_char) phys->d.ax_num; i++, udata+=bytes_coord)
+ if (bytes_coord == 1)
+ coords[i] = *udata;
+ else if (bytes_coord == 2)
+ coords[i] = *udata | *(udata+1) << 8;
+ else
+ coords[i] = *udata | (*(udata+1) << 8) | (*(udata+2) << 16) |
+ (*(udata+3) << 24);
+
+ if (!check_subset_and_scale (&dev, phys, &log, coords))
+ return;
+ }
+ else
+ {
+ sdata = (char *) info->dev_data;
+ for (i=0; i < (u_char) phys->d.ax_num; i++, sdata+=bytes_coord)
+ if (bytes_coord == 1)
+ coords[i] = *sdata;
+ else if (bytes_coord == 2)
+ coords[i] = *(sdata+1) << 8 | (*sdata & 0x0ff);
+ else
+ coords[i] = (*(sdata+3) << 24) | ((*(sdata+2) << 16) & 0x0ff)|
+ ((*(sdata+1) << 8) & 0xff) | (*sdata & 0x0ff);
+ }
+
+ if (phys==hpPointer && axes_changed)
+ {
+ tmp = coords[0];
+ coords[0] = coords[x_axis];
+ if (y_axis==0)
+ coords[1] = tmp;
+ else
+ coords[1] = coords[y_axis];
+ }
+ process_motion (dev, phys, log, coords, info->timestamp);
+ (void) format_ev (dev, type, 0, info->timestamp, log, &xE);
+ }
+
+/*******************************************************************
+ *
+ * check_subset_and_scale()
+ * all we care about is the x and y coordinates.
+ *
+ */
+
+static
+check_subset_and_scale (dev, phys, log, c)
+ DeviceIntPtr *dev;
+ HPInputDevice *phys;
+ HPInputDevice **log;
+ int c[];
+ {
+ extern u_char screen_change_amt;
+ int i, n_axes = phys->d.ax_num;
+
+ if (tablet_width && hptablet_extension)
+ if (c[0]< tablet_xorg || c[0] > tablet_xlimit ||
+ c[1]> tablet_yorg || c[1] < tablet_ylimit)
+ {
+ in_tablet_extension = TRUE;
+ *dev = tablet_extension_device;
+ *log = hptablet_extension;
+ }
+ else
+ {
+ in_tablet_extension = FALSE;
+ }
+
+ if (*log == hpPointer)
+ {
+ if (*dev == screen_change_dev)
+ c[0] = (float) (c[0]-tablet_xorg) * phys->scaleX-screen_change_amt;
+ else
+ c[0] = (float) (c[0]-tablet_xorg) * phys->scaleX;
+ c[1] = (*log)->pScreen->height -
+ ((float) (c[1]-tablet_ylimit) * phys->scaleY);
+ }
+ else
+ {
+ if (*dev == screen_change_dev)
+ c[0] -= screen_change_amt;
+ c[1] = phys->d.max_y - c[1]; /* Y-coord reversed.*/
+ }
+ if (c[0]==(*log)->coords[0] && c[1]==(*log)->coords[1])
+ return (FALSE);
+ for (i=0; i<n_axes; i++)
+ c[i] -= (*log)->coords[i];
+ return (TRUE);
+ }
+
+/****************************************************************************
+ *
+ * parse_keycode (dev, phys, ev, x_type)
+ * Parse keycode information.
+ * Buttons from a three-button mouse also end up here.
+ *
+ */
+
+#define FIX_LED_CTRL(dev, d, ev, index, led) \
+ {if (KeyUpEvent(ev) && dev->key->modifierKeyCount[index] <= 1) { \
+ d.leds &= ~led; \
+ dev->kbdfeed->ctrl.leds &= ~led; } \
+ else { \
+ d.leds |= led; \
+ dev->kbdfeed->ctrl.leds |= led; }}
+
+int parse_keycode (dev, phys, ev)
+ DeviceIntPtr dev;
+ HPInputDevice *phys;
+ xEvent *ev;
+ {
+#ifdef XTESTEXT1
+ extern u_char xtest_command_key; /* defined in xtestext1dd.c */
+#endif /* XTESTEXT1 */
+ u_char down_mods;
+ u_char key = ev->u.u.detail;
+
+ if (hpPointer->x_type == KEYBOARD)
+ if (hpKeyboard->hpflags & SECOND_LOGICAL_DEVICE &&
+ ((ev->u.keyButtonPointer.pad1==inputInfo.keyboard->id ||
+ ev->u.keyButtonPointer.pad1==inputInfo.pointer->id ) &&
+ move_sprite (dev, hpPointer, ev)))
+ return;
+ else
+ if (ev->u.keyButtonPointer.pad1==inputInfo.pointer->id &&
+ (move_sprite (dev, hpPointer, ev)))
+ return;
+
+ /* allow reset only from the X system keyboard,
+ and only if reset is enabled. */
+
+ if (key==reset && reset_enabled)
+ if ((hpKeyboard->hpflags & SECOND_LOGICAL_DEVICE &&
+ (ev->u.keyButtonPointer.pad1==inputInfo.keyboard->id ||
+ ev->u.keyButtonPointer.pad1==inputInfo.pointer->id)) ||
+ ev->u.keyButtonPointer.pad1==inputInfo.keyboard->id)
+ {
+ get_down_modifiers (inputInfo.keyboard, &down_mods);
+ if ((rs_mods & down_mods) == rs_mods)
+ GiveUp(0);
+ }
+
+ /* Special case handling for toggling keys. These are keys
+ that are bound to one of the X modifiers, and have been
+ made into toggling keys. This currently only includes Caps Lock.
+ If a key is pressed that is bound to a toggling key,
+ turn on the appropriate LED and treat the key as a toggle.
+ */
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+
+ if (IsToggleKey(dev, phys, key)) /* toggling key pressed */
+ {
+ if (KeyIsIgnored(phys,key))
+ {
+ if (KeyDownEvent(ev))
+ UnignoreKey(phys,key);
+ ExpectUpKey(phys,key); /* for handling autorepeat */
+ deallocate_event (ev);
+ return;
+ }
+ else if (KeyDownEvent(ev))
+ {
+ if (UpIsExpected(phys,key)) /* key is autorepeating */
+ {
+ deallocate_event (ev);
+ return;
+ }
+ IgnoreKey(phys,key);
+ }
+ else if (KeyUpEvent(ev))
+ DontExpectUpKey(phys,key);
+
+ if (DeviceHasLeds(phys))
+ {
+ int led, index;
+ HPKeyboardFeedbackControl d;
+
+ copy_kbd_ctrl_params (&d, &dev->kbdfeed->ctrl);
+ if (index = IsLockKey(dev, key))
+ FIX_LED_CTRL(dev, d, ev, index, CAPSLOCK_LED);
+
+ (*(phys->s.write)) (phys->d.file_ds, _XChangeFeedbackControl, &d);
+ }
+ }
+#ifdef XKB
+ }
+#endif
+
+#ifdef XTESTEXT1
+ if (on_steal_input)
+ {
+ XTestStealKeyData(key, ev->u.u.type, phys->x_type,
+ ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY);
+ if (exclusive_steal)
+ {
+ if (key != xtest_command_key)
+ deallocate_event (ev);
+ }
+ else if (key == xtest_command_key)
+ deallocate_event (ev);
+ }
+#endif /* XTESTEXT1 */
+ }
+
+/************************************************************************
+ *
+ * This routine checks to see if the key should be interpreted as a
+ * sprite movement or a button.
+ *
+ */
+
+static move_sprite (dev, phys, ev)
+ DeviceIntPtr dev;
+ HPInputDevice *phys;
+ xEvent *ev;
+ {
+ u_char down_mods;
+ u_char key = ev->u.u.detail;
+ u_char type = ev->u.u.type;
+ int inc;
+ Bool motion_mods;
+
+ get_down_modifiers (dev, &down_mods);
+ if (down_mods & (~ptr_mods & ~mv_mods))
+ motion_mods = FALSE;
+ else if ((down_mods & ptr_mods) == ptr_mods)
+ motion_mods = TRUE;
+ else
+ motion_mods = FALSE;
+
+ if (!(down_mods & mv_mods))
+ inc = pointer_move;
+ else if ((down_mods & mv_mods) == pointer_amt_bits[0])
+ inc = pointer_mod1_amt;
+ else if ((down_mods & mv_mods) == pointer_amt_bits[1])
+ inc = pointer_mod2_amt;
+ else if ((down_mods & mv_mods) == pointer_amt_bits[2])
+ inc = pointer_mod3_amt;
+ else
+ motion_mods = FALSE;
+
+ k_down_incy[DOWN] = inc;
+ k_down_incx[RIGHT] = inc;
+ k_down_incy[UP] = inc * -1;
+ k_down_incx[LEFT] = inc * -1;
+
+ if (key==cursor_down && type==KeyPress && motion_mods)
+ return (send_motion (phys, ev, 0, inc, DOWN));
+ else if (key==cursor_down && type==KeyRelease)
+ {
+ k_down_flag[DOWN] = 0;
+ return (1);
+ }
+ else if (key==cursor_left && type==KeyPress && motion_mods)
+ return (send_motion (phys, ev, inc * -1, 0, LEFT));
+ else if (key==cursor_left && type==KeyRelease)
+ {
+ k_down_flag[LEFT] = 0;
+ return (1);
+ }
+ else if (key==cursor_right && type==KeyPress && motion_mods)
+ return (send_motion (phys, ev, inc, 0, RIGHT));
+ else if (key==cursor_right && type==KeyRelease)
+ {
+ k_down_flag[RIGHT] = 0;
+ return (1);
+ }
+ else if (key==cursor_up && type==KeyPress && motion_mods)
+ return (send_motion (phys, ev, 0, inc * -1, UP));
+ else if (key==cursor_up && type==KeyRelease)
+ {
+ k_down_flag[UP] = 0;
+ return (1);
+ }
+ else
+ {
+ if (type==KeyPress)
+ type = ButtonPress;
+ if (type==KeyRelease)
+ type = ButtonRelease;
+
+ if (key == button_1)
+ return (send_button (ev, type, 1));
+ else if (key == button_2)
+ return (send_button (ev, type, 2));
+ else if (key == button_3)
+ return (send_button (ev, type, 3));
+ else if (key == button_4)
+ return (send_button (ev, type, 4));
+ else if (key == button_5)
+ return (send_button (ev, type, 5));
+ else if (key == button_6)
+ return (send_button (ev, type, 6));
+ else if (key == button_7)
+ return (send_button (ev, type, 7));
+ else if (key == button_8)
+ return (send_button (ev, type, 8));
+ }
+ return (0);
+ }
+
+/****************************************************************************
+ *
+ * Send motion information from the keyboard, when it is the pointer device.
+ *
+ */
+
+static send_motion (phys, ev, x, y, which)
+ HPInputDevice *phys;
+ xEvent *ev;
+ int x, y, which;
+ {
+ int coords[MAX_AXES];
+ unsigned int time;
+ int i;
+
+ for (i=0; i<4; i++)
+ if (i != which && k_down_flag[i] != 0)
+ {
+ x += k_down_incx[i];
+ y += k_down_incy[i];
+ }
+ coords[0] = x;
+ coords[1] = y;
+ k_down_flag[which] = 1;
+ time = ev->u.keyButtonPointer.time;
+ deallocate_event(ev);
+ process_motion (inputInfo.pointer, phys, hpPointer, coords, time);
+ ev = format_ev (inputInfo.pointer, MotionNotify, 0, time, hpPointer, &xE);
+ return (1);
+ }
+
+/****************************************************************************
+ *
+ * Send button information from the keyboard, when it is the pointer device.
+ *
+ */
+
+static send_button (ev, direction, bcode)
+ xEvent *ev;
+ u_char direction, bcode;
+ {
+
+ if (bcode == last_key && direction == last_direction)
+ deallocate_event(ev);
+ else
+ {
+ ev->u.u.type = direction;
+ ev->u.u.detail = bcode;
+ last_key = bcode;
+ last_direction = direction;
+#ifdef XTESTEXT1
+ if (on_steal_input)
+ XTestStealKeyData(ev->u.u.detail, ev->u.u.type, MOUSE,
+ ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY);
+#endif /* XTESTEXT1 */
+ }
+
+ return (1);
+ }
+
+/****************************************************************************
+ *
+ * process_motion (hil_info)
+ *
+ * This function may also be called from x_threebut.c and x_tablet.c.
+ * It requires the motion passed to be a relative amount.
+ * dev_hp and dev are the logical devices, phys is the actual device.
+ *
+ */
+
+#define DEF_ACCELERATION 1
+#define EDGE_L 1 << 0
+#define EDGE_R 1 << 1
+#define EDGE_T 1 << 2
+#define EDGE_B 1 << 3
+
+/*
+ * Use the change_xmax and change_amt from the physical device.
+ * This is needed for the case where an absolute device like a tablet
+ * has its input merged with a relative device like a mouse.
+ *
+ */
+
+#define OffRightEdge(log, phys) (log->coords[0] > (phys->change_xmax + \
+ (int) phys->change_amt) ? EDGE_R : 0)
+#define OffLeftEdge(log, phys) (log->coords[0] < (phys->change_xmin - \
+ (int) phys->change_amt) ? EDGE_L : 0)
+#define OffTopEdge(log, phys) (log->coords[1] < (phys->change_ymin - \
+ (int) phys->change_amt) ? EDGE_T : 0)
+#define OffBottomEdge(log, phys) (log->coords[1] > (phys->change_ymax + \
+ (int) phys->change_amt) ? EDGE_B : 0)
+
+process_motion (dev, phys, log, c, timestamp)
+ DeviceIntPtr dev;
+ HPInputDevice *phys, *log;
+ int c[];
+ unsigned int timestamp;
+ {
+ int i;
+ unsigned int state = 0;
+ extern int playback_on;
+ ScreenPtr newScreen = log->pScreen;
+
+ /* Compute x,y taking care of desired threshold and acceleration
+ * No acceleration if we're playing back a recorded test script.
+ * No acceleration for absolute pointing devices.
+ * No acceleration if we're using the default (1) acceleration.
+ */
+
+ if (!playback_on)
+ {
+ if (!(phys->hpflags & ABSOLUTE_DATA) &&
+ (acceleration != DEF_ACCELERATION))
+ {
+ for (i=0; i < (u_char) log->d.ax_num; i++)
+ if ( (c[i] - threshold) > 0)
+ c[i] = threshold + (c[i] - threshold) * acceleration;
+ else if ( (c[i] + threshold) < 0)
+ c[i] = (c[i] + threshold) * acceleration - threshold;
+ }
+ }
+
+ /*
+ * If this is the pointer or a device whose input is merged
+ * with the pointer, accumulate the motion and maintain a current position.
+ * If this is a relative device, save the current movement.
+ */
+
+ if (log == hpPointer || (phys->hpflags & ABSOLUTE_DATA))
+ for (i=0; i< (int) log->d.ax_num; i++)
+ log->coords[i] = log->coords[i] + c[i];
+ else
+ for (i=0; i< (u_char) log->d.ax_num; i++)
+ log->coords[i] = c[i];
+
+ /*
+ * Change the screen if we have more than one screen,
+ * and the screen change device has gone off one of the edges,
+ * and the device is not grabbed and confined.
+ */
+
+ if ( screenInfo.numScreens > 1 &&
+ dev->id == screen_change_dev->id &&
+ (!dev->grab || !dev->grab->confineTo))
+ {
+ if ((state=OffRightEdge(log,phys)) || (state=OffLeftEdge(log,phys)) ||
+ (state = OffTopEdge(log,phys)) || (state = OffBottomEdge(log,phys)))
+ {
+ if (!screen_was_changed)
+ change_the_screen (dev, phys, log, state, &newScreen);
+ }
+ else
+ /*
+ * Needed for the case where a tablet is the X pointer device.
+ * Once we change screens, we want to avoid immediately changing
+ * back. We change when we enter the screen change area and
+ * do not change again until after we have left it.
+ */
+ screen_was_changed = FALSE;
+ }
+ if (phys == hptablet_extension && phys->clients == NULL)
+ return;
+ /*
+ * Clip the cursor to stay within the bound of screen.
+ */
+ if (log == hpPointer)
+ {
+ log->coords[0] =
+ max( LimitTheCursor.x1, min( LimitTheCursor.x2,log->coords[0]));
+ log->coords[1] =
+ max( LimitTheCursor.y1, min( LimitTheCursor.y2,log->coords[1]));
+ }
+ move_mouse (log, timestamp);
+ }
+
+/****************************************************************************
+ *
+ * change_the_screen()
+ * We have more than one screen, and the screen_change_device has been moved
+ * off one of the edges. Change to another screen.
+ *
+ */
+
+#define INCREMENT_SCREEN_BY_ONE(p,l) (screenInfo.screens[(p->myNum+1) % \
+ screenInfo.numScreens])
+
+#define DECREMENT_SCREEN_BY_ONE(p,l) (p->myNum != 0 ? \
+ screenInfo.screens[p->myNum-1] : \
+ screenInfo.screens[screenInfo.numScreens - 1])
+
+#define INCREMENT_SCREEN_BY_TWO(p,l) (screenInfo.screens[(p->myNum+2) % \
+ screenInfo.numScreens])
+
+#define DECREMENT_SCREEN_BY_TWO(p,l) (p->myNum > 1 ? \
+ screenInfo.screens[p->myNum-2] : \
+ screenInfo.screens[p->myNum + screenInfo.numScreens - 2])
+
+change_the_screen (dev, phys, log, state, newScreen)
+ DeviceIntPtr dev;
+ HPInputDevice *phys, *log; /* logical device */
+ unsigned int state;
+ ScreenPtr *newScreen;
+ {
+ ScreenPtr oldScreen = log->pScreen;
+
+ if (screen_col_wrap == DEFAULT)
+ {
+ if (screen_orientation == VERTICAL)
+ screen_col_wrap = WRAP;
+ else
+ screen_col_wrap = NOWRAP;
+ }
+
+ if (screen_row_wrap == DEFAULT)
+ {
+ if (screen_orientation == HORIZONTAL)
+ screen_row_wrap = WRAP;
+ else
+ screen_row_wrap = NOWRAP;
+ }
+
+
+ switch (state)
+ {
+ case EDGE_L:
+ if (screen_row_wrap == NOWRAP &&
+ (screen_orientation == VERTICAL ||
+ (oldScreen->myNum == 0 ||
+ (oldScreen->myNum == 2 && screen_orientation == MATRIX ))))
+ return;
+
+ if (screen_orientation == VERTICAL)
+ {
+ if (screen_row_wrap == CHANGE_BY_TWO)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ }
+ else if (screen_orientation == HORIZONTAL)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else /* MATRIX */
+ {
+ if (oldScreen->myNum % 2)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else if (screen_row_wrap == WRAP)
+ {
+ if (!(screenInfo.numScreens == 3 && oldScreen->myNum == 2))
+ {
+ *newScreen = INCREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ }
+ else
+ break;
+ }
+
+ if (!(phys->hpflags & ABSOLUTE_DATA))
+ log->coords[0] += (oldScreen->width - log->change_xmin);
+ break;
+ case EDGE_R:
+ if (screen_row_wrap == NOWRAP &&
+ (screen_orientation == VERTICAL ||
+ (oldScreen->myNum == (screenInfo.numScreens-1) ||
+ (oldScreen->myNum == 1 && screen_orientation == MATRIX ))))
+ return;
+
+ if (screen_orientation == VERTICAL)
+ {
+ if (screen_row_wrap == CHANGE_BY_TWO)
+ {
+ *newScreen = INCREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ }
+ else if (screen_orientation == HORIZONTAL)
+ {
+ *newScreen = INCREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else /* MATRIX */
+ {
+ if (oldScreen->myNum % 2)
+ {
+ if (screen_row_wrap == WRAP)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else
+ break;
+ }
+ else if (!(screenInfo.numScreens == 3 && oldScreen->myNum == 2))
+ {
+ *newScreen = INCREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else if (screen_row_wrap != WRAP)
+ break;
+ }
+
+ if (!(phys->hpflags & ABSOLUTE_DATA))
+ log->coords[0] -= (oldScreen->width);
+ break;
+ case EDGE_T:
+ if (screen_col_wrap == NOWRAP &&
+ (screen_orientation == HORIZONTAL ||
+ (oldScreen->myNum == (screenInfo.numScreens-1) ||
+ (oldScreen->myNum == 2 && screen_orientation == MATRIX ))))
+ return;
+
+ if (screen_orientation == HORIZONTAL)
+ {
+ if (screen_col_wrap == CHANGE_BY_TWO)
+ {
+ *newScreen = INCREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ }
+ else if (screen_orientation == VERTICAL)
+ {
+ *newScreen = INCREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else /* MATRIX */
+ {
+ if (oldScreen->myNum >= 2)
+ {
+ if (screen_col_wrap == WRAP)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ else
+ break;
+ }
+ else if (!(screenInfo.numScreens == 3 && oldScreen->myNum == 1))
+ {
+ *newScreen = INCREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ else if (screen_col_wrap != WRAP)
+ break;
+ }
+
+ if (!(phys->hpflags & ABSOLUTE_DATA))
+ log->coords[1] += (oldScreen->height);
+ break;
+ case EDGE_B:
+ if (screen_col_wrap == NOWRAP &&
+ (screen_orientation == HORIZONTAL ||
+ (oldScreen->myNum == 0 ||
+ (oldScreen->myNum == 1 && screen_orientation == MATRIX))))
+ return;
+
+ if (screen_orientation == HORIZONTAL)
+ {
+ if (screen_col_wrap == CHANGE_BY_TWO)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ }
+ else if (screen_orientation == VERTICAL)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_ONE(oldScreen,log);
+ }
+ else /* MATRIX */
+ {
+ if (oldScreen->myNum >= 2)
+ {
+ *newScreen = DECREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ else if (screen_col_wrap == WRAP)
+ {
+ if (! (screenInfo.numScreens == 3 && oldScreen->myNum == 1))
+ {
+ *newScreen = INCREMENT_SCREEN_BY_TWO(oldScreen,log);
+ }
+ }
+ else
+ break;
+ }
+
+ if (!(phys->hpflags & ABSOLUTE_DATA))
+ log->coords[1] -= (oldScreen->height);
+ break;
+ }
+
+ hpMoveCursorToNewScreen(*newScreen, log);
+ }
+
+/****************************************************************************
+ *
+ * hpMoveCursorToNewScreen()
+ * Turn the cursor off on the old screen.
+ * Call the display driver ChangeScreen routine.
+ * This routine is also called from the display driver SetCursorPosition
+ * routine.
+ *
+ */
+
+#include <stdio.h>
+
+hpMoveCursorToNewScreen(newScreen, InDev)
+ ScreenPtr newScreen;
+ HPInputDevice *InDev;
+ {
+ WindowPtr pRootWin;
+ int tx, ty;
+ hpPrivPtr php = (hpPrivPtr) InDev->pScreen->devPrivate;
+
+ php->CursorOff (InDev->pScreen);
+ set_scale_and_screen_change (inputInfo.pointer, InDev, newScreen);
+ (*((hpPrivPtr)(newScreen->devPrivate))->ChangeScreen) (newScreen);
+ InDev->pScreen = newScreen;
+ if (InDev == hptablet_extension)
+ {
+ tx = InDev->coords[0] < tablet_xorg ? 0 : newScreen->width;
+ ty = (float) InDev->coords[1] * InDev->scaleY;
+ NewCurrentScreen(newScreen, tx, ty);
+ }
+ else
+ NewCurrentScreen(newScreen, InDev->coords[0], InDev->coords[1]);
+ hpActiveScreen = newScreen->myNum;
+ screen_was_changed = TRUE;
+
+ if (inputInfo.pointer->grab && inputInfo.pointer->grab->cursor)
+ newScreen->DisplayCursor(newScreen,inputInfo.pointer->grab->cursor);
+ else if (!(pRootWin = WindowTable[newScreen->myNum]))
+ newScreen->DisplayCursor(newScreen,(CursorPtr) NULL);
+ else
+ newScreen->DisplayCursor(newScreen,pRootWin->optional->cursor);
+ }
+
+/****************************************************************************
+ *
+ * move_mouse ()
+ * move the sprite, if the device is the pointer.
+ * Also move it if some other device is sending MotionNotify events.
+ * In any case, send a motion event to dix.
+ *
+ * This routine may also be called from xtest1dd.c
+ *
+ */
+
+static
+move_mouse (log, event_time)
+ HPInputDevice *log; /* logical device */
+ int event_time; /* event timestamp */
+ {
+ int i;
+ int axes = log->d.ax_num;
+
+ if (log == hpPointer)
+ (*log->pScreen->SetCursorPosition) (log->pScreen, log->coords[0], log->coords[1], FALSE);
+
+ *log->dpmotionBuf++ = event_time;
+ for (i=0; i<axes; i++)
+ *log->dpmotionBuf++ = log->coords[i];
+
+ if((log->dheadmotionBuf + 100 * (axes+1)) == log->dpmotionBuf)
+ log->dpmotionBuf = log->dheadmotionBuf;
+ }
+
+/**************************************************************************
+ *
+ * Called by: hpMouseProc during device initialization, process_motion
+ * whenever we change screens.
+ *
+ * This routine sets the scaling factor to be used for absolute pointing
+ * devices like graphics tablets. Input from these devices is scaled to
+ * the screen size. If we have a multi-screen environment, the scaling
+ * factor must be changed whenever the screen changes.
+ *
+ * This routine also sets the margin at the screen edge that will be used
+ * to change screens. For tablets, this is initially 0, allowing the
+ * entire tablet surface to be used by the application. If a tablet is
+ * the X pointer and a multi-screen environment is being used, the
+ * screen_change_amt variable should be initialized to some value (like 30)
+ * to define a area at the tablet edges that will cause the screen to change.
+ *
+ * Tablet subsetting adds more complications. The user can define a subset
+ * area that used as the X pointer, while the remainder of the tablet surface
+ * is treated as a second logical device. It is this second logical device
+ * that controls screen changes.
+ *
+ */
+set_scale_and_screen_change (dev,d,newScreen)
+ DeviceIntPtr dev;
+ HPInputDevice *d;
+ ScreenPtr newScreen;
+ {
+ int tmp, res_mm;
+
+ /* Absolute device: graphics tablet or touchscreen */
+
+ if (d->hpflags & ABSOLUTE_DATA)
+ {
+ res_mm = d->d.resolution / 1000;
+
+ /* Tablet subsetting enabled and this is the pointer region.
+ This is called only during initialization, since when
+ we change screens, the device is the second logical device. */
+
+ if (tablet_width && dev->id == inputInfo.pointer->id)
+ {
+ tablet_xorg = tablet_xorigin * res_mm;
+ tablet_xlimit = tablet_xorg + tablet_width * res_mm;
+ tmp = d->d.max_y - (tablet_yorigin * res_mm);
+ tablet_yorg = tmp > 0 ? tmp : 0;
+ tmp = tablet_yorg - (tablet_height * res_mm);
+ if (tmp > 0)
+ tablet_ylimit = tmp;
+ else
+ {
+ tablet_ylimit = 0;
+ tablet_height = tablet_yorg / res_mm;
+ if (!tablet_height)
+ tablet_height = 1;
+ }
+ d->scaleX = ((float) newScreen->width) /
+ ((float)tablet_width * res_mm );
+ d->scaleY = ((float) newScreen->height) /
+ ((float)tablet_height * res_mm );
+ d->change_xmin = 0;
+ d->change_xmax = newScreen->width;
+ d->change_amt = 0;
+ }
+ else
+
+ /* This code is called if we are initializing the second logical
+ device, or if tablet subsetting is not enabled. It is also
+ called when we are changing screens with a tablet as the X
+ pointer device.
+
+ */
+ {
+ /*
+ Set scale for the case where the tablet is the X pointer.
+ The scale is also returned to clients via XHPListInputDevices.
+ */
+ d->scaleX = ((float) (newScreen->width+2*screen_change_amt)) /
+ ((float)d->d.max_x);
+ d->scaleY = ((float)newScreen->height) /
+ ((float)d->d.max_y);
+ if (tablet_width)
+ {
+ /* If this is the second logical device, we must also
+ change the scale of the X pointer. Since input from
+ absolute extension devices is not scaled, the
+ screen change amounts units are tablet counts.
+ */
+ hpPointer->scaleX = ((float) newScreen->width) /
+ ((float)tablet_width * res_mm );
+ hpPointer->scaleY = ((float) newScreen->height) /
+ ((float)tablet_height * res_mm );
+ d->change_xmin = res_mm * screen_change_amt;
+ d->change_xmax = d->d.max_x - d->change_xmin;
+ d->change_ymin = res_mm * screen_change_amt;
+ d->change_ymax = d->d.max_y - d->change_xmin;
+ d->change_amt = 0;
+ }
+ else
+ /* The tablet is the X pointer. Screen change units
+ are in pixels, since the input will be scaled.
+ */
+ {
+ d->change_xmin = 1;
+ d->change_xmax = newScreen->width - 2;
+ d->change_ymin = 1;
+ d->change_ymax = newScreen->height - 2;
+ d->change_amt = 0;
+ }
+ }
+ }
+ else
+
+ /* This code is called when a relative device is initialized,
+ and when we are changing screens with a relative device.
+ These devices (mice, trackballs, dialboxes, spaceballs)
+ cause us to change screens by generating values that are
+ beyond the edge of the screen.
+ */
+
+ {
+ d->change_xmin = 0;
+ d->change_xmax = newScreen->width;
+ d->change_ymin = 0;
+ d->change_ymax = newScreen->height;
+ d->change_amt = screen_change_amt;
+ }
+ }
+
+/****************************************************************************
+ *
+ * queue_motion_event ()
+ * This is a convenience routine for xosSetCursorPosition.
+ * It is used to artifically generate a motion event when WarpPointer
+ * request is made.
+ *
+ */
+
+queue_motion_event (dev_p)
+ HPInputDevice *dev_p;
+ {
+ int i;
+ int axes = dev_p->d.ax_num;
+ extern TimeStamp currentTime;
+ int ev_time = currentTime.milliseconds;
+
+ *dev_p->dpmotionBuf++ = ev_time;
+ for (i=0; i<axes; i++)
+ *dev_p->dpmotionBuf++ = dev_p->coords[i];
+
+ if((dev_p->dheadmotionBuf + 100 * (axes+1)) == dev_p->dpmotionBuf)
+ dev_p->dpmotionBuf = dev_p->dheadmotionBuf;
+
+ (void) format_ev (inputInfo.pointer, MotionNotify, 0, ev_time, dev_p, NULL);
+ xE.b.u.u.type = 0;
+ }
+
+/****************************************************************************
+ *
+ * format_ev ( )
+ * format one or more key, button, motion or proximity xEvents.
+ * This routine assumes devices have less than 6 axes, or report only
+ * one axis per event.
+ */
+
+#define AXES_PER_EVENT 6
+
+xEvent *
+format_ev (dev, type, detail, event_time, log, event)
+ DeviceIntPtr dev;
+ u_char type;
+ u_char detail;
+ unsigned int event_time;
+ HPInputDevice *log;
+ xHPEvent *event;
+ {
+ int first_val = 0, val_data = 0;
+ int i, j;
+ int n_axes = log->d.ax_num;
+ INT32 *ip;
+ xEvent *ret = NULL;
+ Bool compressing = FALSE;
+
+ if (log->hpflags & NON_CONTIGUOUS_DATA)
+ for (j=0; j < (u_char) log->d.ax_num; j++)
+ if (log->coords[j]!=0)
+ {
+ first_val = j;
+ val_data = log->coords[j];
+ break;
+ }
+
+ for (i=0; (i==0 || i<n_axes); i+=AXES_PER_EVENT)
+ {
+ if (event==NULL)
+ {
+ ENQUEUE_EVENT(event);
+ event = allocate_event();
+ }
+ else if ((event->b.u.keyButtonPointer.pad1 & 0x7f) != dev->id ||
+ ((log->hpflags & NON_CONTIGUOUS_DATA) &&
+ event->x.first_valuator != first_val))
+ {
+ ENQUEUE_EVENT(event);
+ event = &xE;
+ }
+ else
+ compressing = TRUE;
+ if (!ret)
+ ret = (xEvent *) event;
+
+ event->b.u.u.type = type;
+ event->b.u.u.detail = detail;
+ event->b.u.keyButtonPointer.time = event_time;
+ event->b.u.keyButtonPointer.rootX = hpPointer->coords[0];
+ event->b.u.keyButtonPointer.rootY = hpPointer->coords[1];
+ event->b.u.keyButtonPointer.pad1 = dev->id;
+#ifdef XINPUT
+ if (type >= FIRST_EXTENSION_EVENT)
+ {
+ event->b.u.keyButtonPointer.pad1 |= MORE_EVENTS;
+ event->x.type = DeviceValuator;
+ event->x.deviceid = dev->id;
+
+ if (log->hpflags & NON_CONTIGUOUS_DATA)
+ {
+ event->x.num_valuators = 1;
+ event->x.first_valuator = first_val;
+ if (compressing && !(log->hpflags & ABSOLUTE_DATA))
+ event->x.valuator0 += val_data;
+ else
+ event->x.valuator0 = val_data;
+ return (ret);
+ }
+ else
+ {
+ event->x.num_valuators =
+ log->d.ax_num < AXES_PER_EVENT ?
+ log->d.ax_num : i==0 ? AXES_PER_EVENT:
+ log->d.ax_num - AXES_PER_EVENT;
+
+ event->x.first_valuator = i;
+ ip = &event->x.valuator0;
+ for (j=i; j<i+6; j++)
+ if ( j < (u_char) log->d.ax_num)
+ if (compressing &&
+ !(log->hpflags & ABSOLUTE_DATA))
+ *ip++ += log->coords[j];
+ else
+ *ip++ = log->coords[j];
+ else
+ *ip++ = 0;
+ event = NULL;
+ }
+ }
+#endif /* XINPUT */
+ }
+
+ return (ret);
+ }
+
+/********************************************************************
+ *
+ * ProcessInputEvents()
+ * This routine is invoked from the dispatcher to route events.
+ * It invokes the dix routines to do this.
+ *
+ */
+
+void ProcessInputEvents()
+ {
+ int id, i;
+ INT32 *ip;
+ int count;
+ xHPEvent *event;
+ DeviceIntPtr dev;
+ Bool checkedscreensave = FALSE;
+
+ while ( events_queue->head != events_queue->tail)
+ {
+ if (!checkedscreensave)
+ {
+ if (screenIsSaved==SCREEN_SAVER_ON)
+ SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+ checkedscreensave = TRUE;
+ }
+ event = &((events_queue->events)[(events_queue->head)]);
+
+ switch (event->b.u.u.type)
+ {
+ case KeyPress:
+ if (keyboard_click)
+ {
+ KeybdCtrl ctrl;
+ dev = (DeviceIntPtr) LookupKeyboardDevice ();
+ ctrl.click = dev->kbdfeed->ctrl.click;
+ ctrl.bell = 0;
+ hpBell(0, dev, &ctrl, 0);
+ }
+ case KeyRelease:
+ dev = (DeviceIntPtr) LookupKeyboardDevice ();
+ (*dev->public.processInputProc) ((xEventPtr) event, dev, 1);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ dev = (DeviceIntPtr) LookupPointerDevice ();
+ (*dev->public.processInputProc) ((xEventPtr) event, dev, 1);
+ break;
+ default:
+ #ifdef XINPUT
+ id = event->b.u.keyButtonPointer.pad1 & DEVICE_BITS;
+ if (!(event->b.u.keyButtonPointer.pad1 & MORE_EVENTS))
+ count=1;
+ else
+ count=2;
+ dev = LookupDeviceIntRec (id);
+ if (dev == NULL)
+ break;
+ if (event->b.u.u.type == DeviceKeyPress)
+ {
+ if (dev->kbdfeed && dev->kbdfeed->ctrl.click)
+ {
+ KeybdCtrl ctrl;
+ ctrl.click = dev->kbdfeed->ctrl.click;
+ ctrl.bell = 0;
+ hpBell(0, dev, &ctrl, 0);
+ }
+ }
+ else if (event->b.u.u.type == DeviceMotionNotify)
+ {
+ ip = &event->x.valuator0;
+ for (i=0; i < (u_char) event->x.num_valuators; i++)
+ dev->valuator->axisVal[i] = *(ip+i);
+ }
+ (*dev->public.processInputProc) ((xEventPtr) event, dev, count);
+#endif /* XINPUT */
+ break;
+ }
+
+ if (events_queue->head == WR_EVENTS)
+ events_queue->head = 0;
+ else
+ events_queue->head++;
+
+ }
+ queue_events_free = WR_EVENTS;
+ }
+
+Bool
+get_serial_event (hil_ptr)
+ struct dev_info *hil_ptr; /* holds hil_data */
+ {
+ HPInputDevice *d = hil_ptr->hil_dev;
+ int status;
+
+ hil_ptr->timestamp = GetTimeInMillis();
+ hil_ptr->poll_hdr = 0;
+ pending_index=0;
+ pending_bytes=0;
+ bzero (hil_ptr->dev_data, 36);
+ status = (*(d->s.read))
+ (d->d.file_ds, hil_ptr->dev_data, &hil_ptr->poll_hdr, &pending_bytes);
+ if (status==READ_SUCCESS)
+ return(FALSE);
+ else
+ return(TRUE);
+ }
+
+/************************************************************
+ * hpConstrainCursor
+ *
+ * This function simply sets the box to which the cursor
+ * is limited.
+ *
+ * A single BoxRec is used for recording the cursor limits,
+ * instead of one per screen. This is ok because DIX will
+ * call this routine to establish new limits anytime the
+ * cursor leaves one screen for another.
+ *
+ ************************************************************/
+
+void
+hpConstrainCursor (pScreen,pBox)
+ScreenPtr pScreen; /* Screen to which it should be constrained */
+BoxPtr pBox; /* Box in which... */
+{
+ HPInputDevice *d;
+
+ LimitTheCursor = *pBox;
+ d = GET_HPINPUTDEVICE (inputInfo.pointer);
+ if (d->pScreen !=pScreen)
+ hpMoveCursorToNewScreen(pScreen, d);
+}
diff --git a/xc/programs/Xserver/hw/hp/input/x_hil.h b/xc/programs/Xserver/hw/hp/input/x_hil.h
new file mode 100644
index 000000000..ab21d1ddf
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/x_hil.h
@@ -0,0 +1,93 @@
+#ifndef X_HIL_H
+#define X_HIL_H
+/* $TOG: x_hil.h /main/5 1998/02/10 13:11:44 kaleb $ */
+/*
+
+Copyright 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+Hewlett-Packard not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+#include "hpext.h"
+
+/* MAXHILEVENTS is the maximum number of X events that can
+ be put on the events queue as the result of reading a
+ single HIL data packet. The HIL definition is that
+ a packet may contain one motion event and up to 8 bytes
+ of key data. If the key device is a barcode reader in
+ ASCII mode, we translate each ASCII code into up to 6
+ keycodes. The maximum number of X events that can be
+ generated from a single HIL packet is therefore 49.
+
+ MAX_EVENTS is the size of the server's internal queue of
+ input events. X input is a two-step process, with the
+ first step consisting of reading input events from the
+ device and putting them on this internal queue. Later
+ in the dispatch loop, that queue is emptied and all the
+ events are routed by DIX to the appropriate clients.
+
+ The size of the event queue is not as large as the
+ theoretical maximum, but motion events are compressed
+ into a single event until a key or button is seen.
+
+ The worst at all reasonable case is alternating key and
+ motion data, which would result in less than 50 events.
+ A more reasonable guess is 20 events per device.
+ Our queue size therefore allows for the worst case on
+ 5 - 10 devices simultaneously.
+*/
+
+#define MAXHILEVENTS 49
+#define MOTION_BUFFER_SIZE 100
+#define MAX_EVENTS 256
+#define WR_EVENTS MAX_EVENTS-1
+
+struct x11EventQueue
+ {
+ xHPEvent *events;
+ int size;
+ int head;
+ int tail;
+ };
+
+#endif
diff --git a/xc/programs/Xserver/hw/hp/input/x_hilinit.c b/xc/programs/Xserver/hw/hp/input/x_hilinit.c
new file mode 100644
index 000000000..0f404c5dd
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/x_hilinit.c
@@ -0,0 +1,2385 @@
+/* $TOG: x_hilinit.c /main/10 1998/02/10 13:11:28 kaleb $ */
+/*
+
+Copyright 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1988 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that copyright notice and this permission
+notice appear in supporting documentation, and that the name of
+Hewlett-Packard not be used in advertising or publicity
+pertaining to distribution of the software without specific, written
+prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+/* $XFree86: xc/programs/Xserver/hw/hp/input/x_hilinit.c,v 3.3 1998/10/04 09:38:28 dawes Exp $ */
+
+#define NEED_EVENTS
+#define NITEMS(array) (sizeof(array)/sizeof(array[0]))
+#define BEEPER_DEVICE "/dev/rhil"
+#define UNINITIALIZED 1
+#define EXPLICIT 0x80
+#define XEXTENSION 3
+#define XPTR_USE (1 << XPOINTER)
+#define XKBD_USE (1 << XKEYBOARD)
+#define XOTH_USE (1 << XOTHER)
+#define XEXT_USE (1 << XEXTENSION)
+#define DIN_KBD_DRVR "hp7lc2k.sl"
+#define DIN_KBD_INIT "hp7lc2k_Init"
+#define DIN_KBD_PATH "/dev/ps2kbd"
+#define DIN_MOUSE_DRVR "hp7lc2m.sl"
+#define DIN_MOUSE_INIT "hp7lc2m_Init"
+#define DIN_MOUSE_PATH "/dev/ps2mouse"
+
+#ifndef LIBDIR
+#if OSMAJORVERSION >= 10
+#define LIBDIR "/etc/X11"
+#else
+#define LIBDIR "/usr/lib/X11"
+#endif
+#define DRVRLIBDIR "/usr/lib/X11/extensions"
+#endif
+
+#ifndef DRVRLIBDIR
+#define DRVRLIBDIR LIBDIR/**/"/extensions"
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <dl.h>
+#include <sys/fcntl.h>
+#include "ps2io.h"
+
+#include "X.h"
+#include "Xproto.h"
+#include "hildef.h"
+#include "XHPproto.h" /* extension constants */
+#include "XHPlib.h" /* DEFAULT_DIRECTORY */
+#include "x_hilinit.h"
+#include "x_hil.h"
+#include "x_serialdrv.h"
+#include "inputstr.h"
+#include "../../../os/osdep.h"
+
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#else
+#define Relative 0
+#define Absolute 1
+#endif /* XINPUT */
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#ifdef XKB
+#undef IsKeypadKey
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBsrv.h>
+#endif
+
+/******************************************************************
+ *
+ * Externs and global variables that may be referenced by other files.
+ *
+ */
+
+char *mflg="TRUE";
+HPInputDevice *hpKeyboard;
+HPInputDevice *hpPointer;
+HPInputDevice *hptablet_extension;
+
+#ifdef XINPUT
+extern int BadDevice;
+extern int BadMode;
+extern int IReqCode;
+extern int DeviceKeyPress;
+extern int DeviceKeyRelease;
+extern int DeviceButtonPress;
+extern int DeviceButtonRelease;
+extern int DeviceMotionNotify;
+XID hp_device_ids[MAX_DEVICES];
+XID x_device_ids[MAX_DEVICES];
+#endif /* XINPUT */
+
+extern u_char mv_mods, ptr_mods, rs_mods, bw_mods;
+extern u_char pointer_amt_bits[];
+extern char *display; /* display number as a string */
+extern int queue_events_free;
+extern struct x11EventQueue *events_queue;
+extern InputInfo inputInfo;
+
+int hpddxScreenPrivIndex;
+u_char identity_map[256];
+int axes_changed = FALSE;
+int keyboard_click;
+int allocated_dev_names = FALSE;
+int x_axis, y_axis;
+
+int otherndx;
+int max_input_fd;
+unsigned char xhp_kbdid;
+unsigned tablet_xlimit;
+unsigned tablet_ylimit;
+unsigned tablet_xorg;
+unsigned tablet_yorg;
+
+HPInputDevice l_devs[MAX_DEVICES];
+DeviceIntPtr tablet_extension_device;
+DeviceIntPtr screen_change_dev;
+
+int HPType;
+
+/******************************************************************
+ *
+ * Variables that are global to this file only.
+ *
+ */
+
+static DevicePtr hpAddInputDevice();
+static void RecordOpenRequest();
+static void SetInputDevice();
+static void mask_from_kcodes();
+
+void ProcessOtherEvent();
+
+static xHPEvent events_array[MAX_EVENTS]; /* input event buffer*/
+static struct x11EventQueue ev_queue;
+
+recalculate_x_name () {}
+
+void hpBell(percent, dev, ctrl, foo)
+ int percent, foo;
+ DeviceIntPtr dev;
+ KeybdCtrl *ctrl;
+{
+ HPKeyboardFeedbackControl dc;
+ HPInputDevice *d = GET_HPINPUTDEVICE ((DeviceIntPtr) dev);
+
+ dc.class = KbdFeedbackClass;
+ dc.bell_pitch = ctrl->bell_pitch;
+ dc.bell_duration = ctrl->bell_duration;
+
+ dc.bell_percent = percent;
+ if (!percent)
+ dc.click = ctrl->click;
+ else
+ dc.click = 0;
+ (*(d->s.write)) (d->d.file_ds, _XBell, &dc);
+}
+
+/****************************************************************************
+ *
+ * Procedures to control Integer and String feedbacks.
+ * These are not used by currently supported devices, but serial input devices
+ * could use them.
+ */
+
+static hpChangeIntegerControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ IntegerCtrl *ctrl;
+ {
+ HPIntegerFeedbackControl dc;
+ HPInputDevice *d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+
+ dc.class = IntegerFeedbackClass;
+ dc.resolution = ctrl->resolution;
+ dc.max_value = ctrl->max_value;
+ dc.integer_displayed = ctrl->integer_displayed;
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+static hpChangeStringControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ StringCtrl *ctrl;
+ {
+ HPStringFeedbackControl dc;
+ HPInputDevice *d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+
+ dc.class = StringFeedbackClass;
+ dc.max_symbols = ctrl->max_symbols;
+ dc.num_symbols_supported = ctrl->num_symbols_supported;
+ dc.num_symbols_displayed = ctrl->num_symbols_displayed;
+ dc.symbols_supported = (int *) ctrl->symbols_supported;
+ dc.symbols_displayed = (int *) ctrl->symbols_displayed;
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+static hpChangeBellControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ BellCtrl *ctrl;
+ {
+ HPBellFeedbackControl dc;
+ HPInputDevice *d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+
+ dc.class = BellFeedbackClass;
+ dc.percent = ctrl->percent;
+ dc.pitch = ctrl->pitch;
+ dc.duration = ctrl->duration;
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+/****************************************************************************
+ *
+ * Change acceleration & threshold.
+ * The DIX routine that handles the ChangePointerControl request has
+ * already validity checked the values and copied them into the
+ * DeviceIntRec. This routine just copies them into fields that are
+ * the same no matter what kind of device we're dealing with.
+ *
+ */
+
+static hpChangePointerControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ PtrCtrl *ctrl;
+ {
+ HPInputDevice *d;
+ HPPointerFeedbackControl dc;
+#ifdef XINPUT
+ PtrFeedbackPtr b;
+
+ /* Set the default initial acceleration to 1 if this isn't the X pointer */
+
+ if ((DeviceIntPtr) pDevice != inputInfo.pointer && !pDevice->on)
+ {
+ ctrl->num = 1;
+ ctrl->den = 1;
+ }
+
+ b = ((DeviceIntPtr) pDevice)->ptrfeed;
+
+ b->ctrl = *ctrl;
+#else
+ extern int threshold;
+ extern float acceleration;
+
+ threshold = ctrl->threshold;
+ acceleration = (float) ctrl->num / (float) ctrl->den;
+ if (acceleration <= 0)
+ acceleration = 1;
+#endif /* XINPUT */
+
+ d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+ dc.class = PtrFeedbackClass;
+ dc.num = ctrl->num;
+ dc.den = ctrl->den;
+ dc.threshold = ctrl->threshold;
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+/****************************************************************************
+ *
+ * The members of the ledCtrl structure have the following values:
+ *
+ * mask: 1 bit per LED.
+ * value: if mask set, turn it on or off.
+ *
+ */
+
+static hpChangeLedControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ LedCtrl *ctrl;
+ {
+ HPInputDevice *d;
+ HPLedFeedbackControl dc;
+
+ d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+ dc.class = LedFeedbackClass;
+ dc.led_values = ctrl->led_values;
+ dc.led_mask = ctrl->led_mask;
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+/****************************************************************************
+ *
+ * The members of the keybdCtrl structure have the following values:
+ *
+ * click: 0(off) - 100 (loud); -1 => default;
+ * bell: 0(off) - 100 (loud); -1 => default;
+ * bell_pitch: Pitch of the bell in Hz;-1 => default;
+ * bell_duration: in miliseconds; -1 => default;
+ *
+ * keyboard_click is checked whenever a key is pressed, in x_hil.c.
+ */
+
+static hpChangeKeyboardControl(pDevice, ctrl)
+ DevicePtr pDevice;
+ KeybdCtrl *ctrl;
+ {
+ HPInputDevice *d;
+ HPKeyboardFeedbackControl dc;
+
+ if (inputInfo.keyboard &&
+ ((DeviceIntPtr) pDevice)->id==inputInfo.keyboard->id)
+ keyboard_click = (int)((double)(ctrl->click) * 15.0 / 100.0);
+
+ d = GET_HPINPUTDEVICE ((DeviceIntPtr) pDevice);
+ copy_kbd_ctrl_params (&dc, ctrl);
+ (*(d->s.write)) (d->d.file_ds, _XChangeFeedbackControl, &dc);
+ }
+
+copy_kbd_ctrl_params (dctrl, ctrl)
+ HPKeyboardFeedbackControl *dctrl;
+ KeybdCtrl *ctrl;
+ {
+ dctrl->class = KbdFeedbackClass;
+ dctrl->click = ctrl->click;
+ dctrl->bell_percent = ctrl->bell;
+ dctrl->bell_pitch = ctrl->bell_pitch;
+ dctrl->bell_duration = ctrl->bell_duration;
+ dctrl->autoRepeat = ctrl->autoRepeat;
+ memmove(dctrl->autoRepeats, ctrl->autoRepeats, 32);
+ dctrl->leds = ctrl->leds;
+ }
+
+/****************************************************************************
+ *
+ * hpGetDeviceMotionEvents.
+ *
+ */
+static int hpGetDeviceMotionEvents (dev, coords, start, stop, pScreen)
+ DeviceIntPtr dev;
+ CARD32 start, stop;
+ xTimecoord *coords;
+ ScreenPtr pScreen;
+ {
+ HPInputDevice *pHP = (HPInputDevice *) dev->public.devicePrivate;
+ int i, evcount = 0;
+ int size = pHP->d.ax_num + 1;
+ int *first, *last, *curr;
+ int *buffp = (int *) coords;
+ int *pmBuf = pHP->dpmotionBuf;
+ int *hmBuf = pHP->dheadmotionBuf;
+
+ if (pmBuf == hmBuf)
+ {
+ if (*pmBuf == 0) /* no events yet */
+ {
+ return 0;
+ }
+ else
+ last = hmBuf + (99 * size);
+ }
+ else
+ last = pmBuf-size;
+
+ if (*pmBuf == 0) /* haven't wrapped yet */
+ first = hmBuf;
+ else
+ first = pmBuf;
+
+ if (start > *last) /* start time > last time */
+ return 0;
+ else
+ {
+ curr = first;
+ while (*curr < start)
+ {
+ curr += size;
+ if (curr == hmBuf+(100*size))
+ curr = hmBuf;
+ if (curr == first)
+ return 0;
+ }
+ while (*curr <= stop && *curr != 0)
+ {
+ if (dev == inputInfo.pointer) /*X pointer is 16 bits/axis */
+ {
+ *buffp++ = *curr++; /* copy the time */
+ *buffp++ = *curr << 16 | *(curr+1); /* copy data for 2 axes */
+ curr += 2;
+ }
+ else /* other devices are 32 bits */
+ for (i=0; i<size; i++)
+ *buffp++ = *curr++;
+ evcount++;
+ if (curr == hmBuf+(100*size))
+ curr = hmBuf;
+ if (curr == first)
+ break;
+ }
+ }
+ return (evcount);
+ }
+
+/****************************************************************************
+ *
+ * NOTE: The first parameter passed to this routine is really a DeviceIntPtr.
+ * The declaration used here works because the first element of the
+ * structure pointed to by the DeviceIntPtr is a DeviceRec.
+ *
+ */
+
+#define DIN_MINKEYCODE 16
+unsigned char DIN_AUTOREPEATS[] =
+{0xff,0xff,0xff,0xf3,0xfb,0xff,0xff,0xff,
+ 0xfb,0xff,0xff,0xff,0xf9,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
+
+#define HIL_MINKEYCODE 8
+#define HIL_MINKEYCODE2 10
+unsigned char HIL_AUTOREPEATS[] =
+{0x00,0x82,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
+
+extern Bool noXkbExtension;
+
+static Bool hpDeviceProc(pDev, onoff)
+ DevicePtr pDev;
+ int onoff;
+ {
+ KeySymsRec *key_syms, keysym_rec;
+ CARD8 *the_modmap;
+ DeviceIntPtr dev = (DeviceIntPtr) pDev;
+ HPInputDevice *pHP = (HPInputDevice *) pDev->devicePrivate;
+ HPInputDeviceHeader *pd = &pHP->d;
+ int i, j;
+ int mbufsiz =(pHP->d. ax_num * sizeof(int) + sizeof(Time)) *
+ MOTION_BUFFER_SIZE;
+ unsigned char *ptrf;
+ HPStrF *ptrs;
+ char *x_basename();
+#ifdef XINPUT
+ char *strchr();
+#endif /* XINPUT */
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ pDev->on = FALSE;
+ pHP->pScreen = screenInfo.screens[0];
+ AssignTypeAndName (pDev, pHP->x_atom, x_basename(pd->x_name));
+
+ if (pd->num_keys > 0)
+ {
+ if (!HPKget_kb_info_by_name(pd->keymap_file,
+ pd->keymap_name, &keysym_rec, &the_modmap))
+ FatalError ("Can't find a keymap in the %s/XHPKeymaps file for device %s.\n",
+ LIBDIR, pd->x_name);
+ key_syms = &keysym_rec;
+ if (dev->id == inputInfo.keyboard->id)
+ {
+ KeyCode tmp;
+ extern KeyCode xtest_command_key; /* see xtestext1dd.c */
+
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ InitKeyboardDeviceStruct(pDev, key_syms, the_modmap,
+ (BellProcPtr) hpBell,
+ (KbdCtrlProcPtr) hpChangeKeyboardControl);
+#ifdef XKB
+ } else {
+ XkbComponentNamesRec names;
+
+ names.keymap = NULL;
+ names.types = "types/complete";
+ names.compat = "compat/complete";
+ if ((pHP->id_detail & PS2_KEYBD) == PS2_KEYBD) {
+ names.keycodes = "keycodes/hp";
+ names.symbols = "symbols/us(pc101)";
+ names.geometry = "geometry/hp";
+ } else {
+ names.keycodes = "keycodes/hp(hil)";
+ names.symbols = "symbols/hp/us(hil)";
+ names.geometry = "geometry/hp(hil)";
+ };
+ XkbInitKeyboardDeviceStruct((DeviceIntPtr) pDev, &names,
+ key_syms, the_modmap, (BellProcPtr) hpBell,
+ (KbdCtrlProcPtr) hpChangeKeyboardControl);
+ }
+#endif
+
+
+ get_pointerkeys();
+ fix_modifierkeys();
+ if ((tmp=HPKeySymToKeyCode (dev, XK_F9)))
+ xtest_command_key = tmp;
+
+ }
+#ifdef XINPUT
+ else
+ {
+ InitKeyClassDeviceStruct (dev, key_syms, the_modmap);
+ InitKbdFeedbackClassDeviceStruct (dev,
+ (BellProcPtr) hpBell,
+ (KbdCtrlProcPtr) hpChangeKeyboardControl);
+ InitFocusClassDeviceStruct (dev);
+ }
+ if (dev->key->curKeySyms.minKeyCode==DIN_MINKEYCODE)
+ memmove(dev->kbdfeed->ctrl.autoRepeats, DIN_AUTOREPEATS, 32);
+ else if (dev->key->curKeySyms.minKeyCode==HIL_MINKEYCODE ||
+ dev->key->curKeySyms.minKeyCode==HIL_MINKEYCODE2)
+ memmove(dev->kbdfeed->ctrl.autoRepeats, HIL_AUTOREPEATS, 32);
+ }
+
+ for (j=0, ptrf=pd->feedbacks; j<pd->num_fdbk; j++,ptrf++)
+ if (*ptrf == IntegerFeedbackClass)
+ InitIntegerFeedbackClassDeviceStruct ( dev,
+ (IntegerCtrlProcPtr) hpChangeIntegerControl);
+ else if (*ptrf == BellFeedbackClass)
+ InitBellFeedbackClassDeviceStruct ( dev,
+ (BellProcPtr) hpBell,
+ (BellCtrlProcPtr) hpChangeBellControl);
+ else if (*ptrf == KbdFeedbackClass)
+ InitKbdFeedbackClassDeviceStruct( dev,
+ (BellProcPtr) hpBell,
+ (KbdCtrlProcPtr) hpChangeKeyboardControl);
+ else if (*ptrf == PtrFeedbackClass)
+ InitPtrFeedbackClassDeviceStruct( dev,
+ (PtrCtrlProcPtr) hpChangePointerControl);
+ for (j=0, ptrf=pd->ledf; j<pd->num_ledf; j++,ptrf++)
+ InitLedFeedbackClassDeviceStruct ( dev,
+ (LedCtrlProcPtr) hpChangeLedControl);
+ for (j=0, ptrs=pd->strf; j<pd->num_strf; j++, ptrs++)
+ InitStringFeedbackClassDeviceStruct ( dev,
+ (StringCtrlProcPtr) hpChangeStringControl,
+ ptrs->max_symbols,
+ ptrs->num_symbols_supported,
+ (KeySym *) ptrs->symbols_supported);
+#endif /* XINPUT */
+
+ if (pd->ax_num)
+ {
+ if (dev->id == inputInfo.pointer->id)
+ {
+ if (pHP->dev_type == NULL_DEVICE)
+ {
+ pHP->coords[0] = pHP->pScreen->width;
+ pHP->coords[1] = pHP->pScreen->height;
+ }
+ else
+ {
+ pHP->coords[0] = pHP->pScreen->width / 2;
+ pHP->coords[1] = pHP->pScreen->height / 2;
+ }
+ InitPointerDeviceStruct (pDev, ptr_button_map,
+ (pd->num_buttons ? pd->num_buttons : 3),
+ hpGetDeviceMotionEvents,
+ (PtrCtrlProcPtr) hpChangePointerControl,
+ MOTION_BUFFER_SIZE);
+ }
+#ifdef XINPUT
+ else
+ {
+ InitFocusClassDeviceStruct (dev);
+ if (pHP->iob & HILIOB_PIO)
+ InitProximityClassDeviceStruct (dev);
+ InitValuatorClassDeviceStruct (dev, pd->ax_num,
+ hpGetDeviceMotionEvents, 100,
+ (pHP->hpflags & ABSOLUTE_DATA)?1:0);
+ InitPtrFeedbackClassDeviceStruct (dev,
+ (PtrCtrlProcPtr) hpChangePointerControl);
+ }
+ InitValuatorAxisStruct (dev, 0, 0, (u_int) pd->max_x,
+ (u_int) pd->resolution, 0, (u_int) pd->resolution);
+ if (pd->ax_num > 1)
+ InitValuatorAxisStruct (dev, 1, 0, (u_int) pd->max_y,
+ (u_int) pd->resolution, 0, (u_int) pd->resolution);
+ if (dev->id != inputInfo.pointer->id)
+ for (i=2; i < (u_char) pd->ax_num; i++)
+ InitValuatorAxisStruct (dev, i, 0, (u_int) pd->max_x,
+ (u_int) pd->resolution, 0, (u_int) pd->resolution);
+
+ pHP->dpmotionBuf = (int *) Xalloc (mbufsiz);
+ memset (pHP->dpmotionBuf, 0, mbufsiz);
+ pHP->dheadmotionBuf = pHP->dpmotionBuf;
+ }
+
+ if (pd->num_buttons && dev->id != inputInfo.pointer->id)
+ InitButtonClassDeviceStruct(dev, pd->num_buttons, identity_map);
+#endif /* XINPUT */
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ if (pHP != NULL)
+ {
+ if (pHP->dev_type != NULL_DEVICE)
+ AddEnabledDevice (pd->file_ds);
+ if (pd->ax_num)
+ set_scale_and_screen_change (dev, pHP, pHP->pScreen);
+ }
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ if (dev->button) {
+ memset(dev->button->down, 0, DOWN_LENGTH);
+ dev->button->state = 0;
+ dev->button->buttonsDown = 0;
+ pHP->button_state = 0;
+ }
+ if (dev->key) {
+ memset(dev->key->down, 0, DOWN_LENGTH);
+ dev->key->state = 0;
+ dev->key->prev_state = 0;
+ }
+ if (dev->id != inputInfo.pointer->id &&
+ pd->file_ds == hpPointer->d.file_ds)
+ break;
+ if (pHP != NULL && pd->file_ds>= 0)
+ {
+ RemoveEnabledDevice(pd->file_ds);
+ close_device (pHP);
+ }
+ break;
+ case DEVICE_CLOSE:
+ if ( pHP != NULL && pd->file_ds >= 0)
+ {
+ RemoveEnabledDevice (pd->file_ds);
+ close_device (pHP);
+ }
+#ifdef XINPUT
+ if (pHP->dheadmotionBuf)
+ {
+ Xfree (pHP->dheadmotionBuf);
+ pHP->dheadmotionBuf = NULL;
+ pHP->dpmotionBuf = NULL;
+ }
+#endif /* XINPUT */
+ break;
+ }
+ return(Success);
+ }
+
+/****************************************************************************
+ *
+ * InitInput --
+ * Initialize pointer and keyboard devices.
+ *
+ */
+
+void InitInput(argc, argv)
+ int argc;
+ char **argv;
+ {
+ int i, j;
+ DeviceIntPtr x_init_device();
+ int CheckInput();
+
+ mflg = (char *)getenv("XHPPRINTDEBUGMSG");
+ max_input_fd = 0;
+ x_axis = 0;
+ y_axis = 1;
+ axes_changed = FALSE;
+ hpPointer = NULL;
+ hpKeyboard = NULL;
+ hptablet_extension = NULL;
+ tablet_width = 0;
+ otherndx = 2;
+ for (i=0; i<256; i++)
+ identity_map[i]=i;
+
+ RegisterBlockAndWakeupHandlers ((BlockHandlerProcPtr) NoopDDA,
+ (WakeupHandlerProcPtr) CheckInput, (pointer) NULL);
+ get_pointerkeys();
+ for (i=0; i<MAX_LOGICAL_DEVS; i++)
+ clear_device_private(&l_devs[i]);
+ init_dynamic_devs (l_devs); /* load input drivers. */
+
+ if (hpPointer->x_type == KEYBOARD)
+ {
+ hpPointer->d.num_buttons = 8;
+ hpPointer->d.ax_num = 2;
+ }
+
+ init_events_queue ( &ev_queue);
+ /*
+ * Now initialize the devices as far as X is concerned.
+ */
+
+ for (i=0, j=0; i<MAX_DEVICES && j < MAX_LOGICAL_DEVS; j++)
+ {
+ if (l_devs[j].id == 1 || /* inaccessible device*/
+ (l_devs[j].dev_type == NULL_DEVICE &&
+ !(l_devs[j].hpflags & OPEN_THIS_DEVICE)))
+ continue;
+ if (l_devs[j].d.file_ds != -1)
+ (void) x_init_device (&l_devs[j], TRUE);
+ else
+ (void) x_init_device (&l_devs[j], FALSE);
+ i++;
+ }
+ }
+
+HPInputDevice *next_device_private()
+ {
+ int i;
+ HPInputDevice *d = l_devs;
+
+ for (i=0; i<MAX_DEVICES; i++, d++)
+ if (d->id == 1)
+ return d;
+
+ for (i=0,--d; i<MAX_DEVICES; i++, d--)
+ if (d->d.file_ds <= 1 && d->driver_name[0] == '\0')
+ return d;
+
+ return NULL;
+ }
+
+/***********************************************************
+ *
+ * Set up the tablet for subsetting.
+ *
+ */
+fix_tablet_subsetting()
+ {
+ int i;
+ HPInputDevice *d;
+
+ if (hpPointer->d.x_name != NULL && !strstr (hpPointer->d.x_name, "TABLET"))
+ {
+ for (i=MAX_LOGICAL_DEVS-1; i>=0; i--)
+ if (l_devs[i].d.x_name != NULL &&
+ strstr(l_devs[i].d.x_name, "TABLET"))
+ break;
+ if (i>=0)
+ {
+ if (hpPointer->hpflags & SECOND_LOGICAL_DEVICE)
+ {
+ hpPointer->hpflags &= ~SECOND_LOGICAL_DEVICE;
+ hpPointer->d.file_ds = -1;
+ }
+ else
+ close_device(hpPointer);
+ hpPointer = &l_devs[i];
+ open_device(hpPointer);
+ }
+ else
+ return;
+ }
+ if (d = next_device_private())
+ {
+ *d = *hpPointer; /* will also be an extension device */
+ d->hpflags |= SECOND_LOGICAL_DEVICE;
+ }
+ }
+
+/***********************************************************
+ *
+ * Perform X initialization for the device.
+ *
+ */
+
+DeviceIntPtr
+x_init_device (dev, start_it)
+ HPInputDevice *dev;
+ Bool start_it;
+ {
+ DevicePtr pXDev;
+
+ pXDev = hpAddInputDevice(hpDeviceProc, start_it, dev);
+ if (dev==hpKeyboard)
+ {
+ RegisterKeyboardDevice(pXDev);
+ if (dev->dev_type == KEYBOARD)
+ xhp_kbdid = dev->id - 0xA0;
+ }
+ if (dev==hpPointer)
+ {
+ RegisterPointerDevice(pXDev);
+ if (dev->x_type == KEYBOARD)
+ InitKbdFeedbackClassDeviceStruct ((DeviceIntPtr) pXDev,
+ (BellProcPtr) hpBell,
+ (KbdCtrlProcPtr) hpChangeKeyboardControl);
+ screen_change_dev = (DeviceIntPtr) pXDev;
+ if (screen_change_amt == SCREEN_CHANGE_DEFAULT)
+ if (dev->hpflags & ABSOLUTE_DATA)
+ screen_change_amt = 0;
+ else
+ screen_change_amt = 30;
+ }
+#ifdef XINPUT
+ if (dev != hpPointer && dev != hpKeyboard)
+ {
+ RegisterOtherDevice(pXDev);
+ if (tablet_width && dev->d.file_ds==hpPointer->d.file_ds)
+ {
+ tablet_extension_device = (DeviceIntPtr) pXDev;
+ hptablet_extension = dev;
+ screen_change_dev = tablet_extension_device;
+ }
+ }
+#endif /* XINPUT */
+
+ return ((DeviceIntPtr) pXDev);
+ }
+
+/***********************************************************************
+ *
+ * Initialize default input devices.
+ * If this machine supports HIL, use the last keyboard and mouse.
+ * If none are present, use the last key and pointer device.
+ *
+ */
+
+clear_device_private(d)
+ HPInputDevice *d;
+ {
+
+ memset(d, 0, sizeof(HPInputDevice));
+ d->id = UNINITIALIZED;
+ d->d.keymap_name = "";
+ d->d.file_ds = -1;
+ d->driver_name[0] = '\0';
+ d->d.path[0] = '\0';
+ d->d.file_ds = HP_VENDOR_RELEASE_NUMBER;
+ d->d.button_chording = 0;
+ if (button_chording == CHORDING_ON)
+ {
+ d->d.button_chording = 100;
+ d->d.reserved[0] = button_latching;
+ }
+ }
+
+/****************************************************************************
+ *
+ * open_device opens one of the input devices.
+ * The path is filled in by device_files(), or is the default.
+ * If the open fails, it may be because the keyboard and pointer
+ * are the same device, and the device is already open.
+ *
+ */
+
+open_device (d)
+ HPInputDevice *d;
+ {
+
+ d->led[NLOCK] = LockMask;
+ d->d.reserved[0] = 0;
+ d->d.reserved[2] = 0;
+ d->d.file_ds = HP_VENDOR_RELEASE_NUMBER;
+ if (button_chording == CHORDING_ON)
+ {
+ d->d.button_chording = 100;
+ d->d.reserved[0] = button_latching;
+ }
+ if ((*(d->s.configure)) (&d->d) != INIT_SUCCESS)
+ return(-1);
+ init_device_private (d, FALSE);
+ return (d->d.file_ds);
+ }
+
+/* ******************************************************************** */
+/* ************************* Parse X*devices ************************** */
+/* ******************************************************************** */
+
+static struct _X_devices
+ {
+ char *x_name;
+ int dev_type;
+ } X_devices[] = {{XI_KEYBOARD, KEYBOARD},
+ {"NULL", NULL_DEVICE}};
+
+static char *h_position[] =
+{
+ "FIRST",
+ "SECOND",
+ "THIRD",
+ "FOURTH",
+ "FIFTH",
+ "SIXTH",
+ "SEVENTH"
+ };
+
+static void uppercase(str) char *str; /* convert str to upper case */
+ { for (; *str; str++) *str = toupper(*str); }
+
+
+/*
+ * Formats:
+ * |#comment
+ * | #comment
+ * |word [#comment]
+ * | word [#comment]
+ * |word word [#comment]
+ * |word word word [#comment]
+ * |word word word word [#comment]
+ */
+
+static int is_null_needed(null_needed, keyboard_is_pointer)
+ Bool *null_needed;
+ int *keyboard_is_pointer;
+ {
+ FILE *fp;
+ int i, parms, ipos, itype, use_as;
+ char fname[256], buf[256], pos[256], x_name[256], use[256];
+
+ sprintf(fname, "%s/X%sdevices",LIBDIR, display);
+ fp = fopen (fname, "r");
+ if (fp == NULL)
+ return;
+ while (fgets(buf,MAXNAMLEN+1,fp) != NULL)
+ {
+ buf[strlen(buf)-1] = pos[0] = x_name[0] = use[0] = '\0';
+
+ parms = sscanf(buf, "%s%s%s", pos, x_name, use);
+ if (parms != 3 || pos[0] == '#' || x_name[0] == '#' || use[0] == '#')
+ continue; /* blank or comment, skip it */
+ /* or not the syntax we want */
+
+ /* Parse lines with 3 parameters, such as:
+ * first keyboard pointer
+ * first null keyboard
+ * first null pointer
+ */
+
+ uppercase(pos);
+ for (i=0; i<NITEMS(h_position); i++)
+ if (0 == strcmp(h_position[i], pos))
+ {
+ ipos = i + 1; /* h_position[0] = "FIRST" == 1 */
+ break;
+ }
+ if (i >= 7) /* failed, skip this entry */
+ continue;
+
+ uppercase(x_name);
+ for (i=0; i<NITEMS(X_devices); i++)
+ if (0 == strcmp(X_devices[i].x_name,x_name))
+ {
+ itype = X_devices[i].dev_type;
+ break;
+ }
+ if (i == NITEMS(devices)) /* failed, skip this entry */
+ continue;
+
+ uppercase(use);
+ if (0 == strcmp(use, "POINTER")) use_as = XPTR_USE;
+ else if (0 == strcmp(use, "KEYBOARD")) use_as = XKBD_USE;
+ else if (0 == strcmp(use, "OTHER")) use_as = XOTH_USE;
+ else
+ continue;
+
+ if (itype == NULL_DEVICE && use_as == XKBD_USE)
+ *null_needed = TRUE;
+ if (itype == NULL_DEVICE && use_as == XPTR_USE)
+ *null_needed = TRUE;
+ if (itype == KEYBOARD && use_as == XPTR_USE)
+ *keyboard_is_pointer = TRUE;
+ }
+ fclose(fp);
+ }
+
+/********************************************************************
+ *
+ * check_for_duplicates().
+ *
+ * Check to see if a device that is already open has been specified.
+ *
+ */
+
+static Bool check_for_duplicates(d)
+ HPInputDevice *d;
+ {
+ int i;
+ HPInputDevice *tmp;
+
+ for (i=0,tmp=l_devs; i<NITEMS(l_devs); i++,tmp++)
+ if (strcmp(tmp->d.path, d->d.path)==0 && tmp->d.file_ds >= 0 &&
+ tmp->d.file_ds != HP_VENDOR_RELEASE_NUMBER)
+ {
+ if (strcmp(d->entry, DIN_KBD_INIT)==0 && (d->use & XPTR_USE))
+ {
+ *d = *tmp;
+ tmp->hpflags |= SECOND_LOGICAL_DEVICE;
+ hpPointer = d;
+ hpPointer->use = XPTR_USE;
+ return FALSE;
+ }
+ d->d.path[0] = '\0';
+ d->driver_name[0] = '\0';
+ d->entry[0] = '\0';
+ d->use = 0;
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+/********************************************************************
+ *
+ *
+ *
+ *
+ */
+
+get_next_device(fd, d)
+ FILE *fd;
+ HPInputDevice *d;
+ {
+ int len;
+ char buf[256], key[256], var[64];
+ char *fgets();
+ char pos[MAXNAMLEN+1];
+ int parms;
+
+ if (d->driver_name[0] != '\0')
+ return TRUE;
+ d->entry[0]='\0';
+ while (fgets(buf,MAXNAMLEN+1,fd) != NULL)
+ {
+ buf[strlen(buf)-1] = '\0';
+ pos[0] = '\0';
+
+ if ((sscanf(buf,"%s",pos) == EOF) || pos[0] == '#')
+ continue; /* blank or comment, skip it */
+
+ uppercase(pos);
+ if (strcmp (pos,"BEGIN_DEVICE_DESCRIPTION") != 0)
+ continue;
+
+ while (fgets(buf,256,fd) != NULL) {
+ if (((parms = sscanf(buf,"%s%s",key,var)) == EOF) || key[0] == '#')
+ continue; /* blank or comment, skip it */
+
+ uppercase(key);
+ if (parms == 1 && strcmp (key,"END_DEVICE_DESCRIPTION")==0)
+ return (check_for_duplicates(d));
+
+ if (strcmp(key,"PATH") == 0)
+ strcpy(d->d.path, var);
+ else if (strcmp(key,"NAME") == 0) {
+ sprintf(d->driver_name, "%s/%s", DRVRLIBDIR, var);
+ if (*d->entry == '\0') {
+ len = strcspn (var,".");
+ strncpy (d->entry, var, len);
+ d->entry[len] = '\0';
+ strcat (d->entry, "_Init");
+ }
+ }
+ else if (strcmp(key,"ENTRYPOINT") == 0)
+ strcpy(d->entry, var);
+ else if (strcmp(key,"USE") == 0) {
+ uppercase(var);
+ if (!strcmp(var,"POINTER"))
+ d->use = EXPLICIT | XPTR_USE;
+ else if (!strcmp(var,"KEYBOARD"))
+ d->use = EXPLICIT | XKBD_USE;
+ else if (!strcmp(var,"OTHER"))
+ d->use = XOTH_USE;
+ else /* assume used as extension device */
+ d->use = XEXT_USE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+/********************************************************************
+ *
+ * get_codes()
+ * Used to assign codes to keys used to move the pointer.
+ * Also to assign numbers to the amount to move the pointer.
+ * This routine uses the index into the file to determine the keycode.
+ * The down keycode is (index * 2), the up keycode is that plus 1.
+ * If the type is NUMBER, the key string is assumed to be an ascii
+ * representation of a number.
+ * This is used as the increment to move the pointer.
+ *
+ */
+
+static get_codes (key, code, type, makeupper)
+ char *key;
+ int *code;
+ int type;
+ Bool makeupper;
+ {
+ int i;
+
+ if (makeupper)
+ for (i=0; i<strlen(key); i++)
+ *(key+i) = toupper(*(key+i));
+
+ if (type == UCHAR_NUMBER || type == USHORT_NUMBER || type == UINT_NUMBER)
+ {
+ *code = atoi (key);
+ return (0);
+ }
+ else if (type == STRING)
+ for (i=0; i<MAX_STRINGS; i++)
+ if (strcmp (key, strings[i].string) == 0)
+ {
+ *code = strings[i].value;
+ return (0);
+ }
+ for (i=0; *keyset1[i].keystr; i++)
+ if (strcmp (key, keyset1[i].keystr) == 0)
+ break;
+ if (!inputInfo.keyboard)
+ return(0);
+ *code = HPKeySymToKeyCode(inputInfo.keyboard, keyset1[i].sym);
+ if (*code)
+ return(0);
+ return (-1);
+ }
+
+int
+HPKeySymToKeyCode (dev, sym)
+ DeviceIntPtr dev;
+ KeySym sym;
+{
+ int i;
+ register KeySym *syms;
+ KeySymsPtr rec;
+
+ rec = &dev->key->curKeySyms;
+ syms = rec->map;
+ for (i=0; i<rec->maxKeyCode - rec->minKeyCode + 1; i++)
+ {
+ if (*syms == sym)
+ return (i + rec->minKeyCode);
+ syms += rec->mapWidth;
+ }
+ return(0);
+}
+
+/********************************************************************
+ *
+ * get_vars()
+ * get the address of variables to contain keycodes for pointer functions.
+ *
+ */
+
+static get_vars (func, codevar, index)
+ char *func;
+ u_char **codevar;
+ int *index;
+ {
+ int i;
+
+ for (i=0; i<strlen(func); i++)
+ *(func+i) = toupper(*(func+i));
+
+ for (i=0; i<MAX_POINTER_FUNCS; i++)
+ if (strcmp (func, pointerfunc[i].name) == 0)
+ {
+ *codevar = pointerfunc[i].code;
+ *index = i;
+ return (0);
+ }
+ return (-1);
+ }
+
+/********************************************************************
+ *
+ * get_pointerkeys().
+ * This routine provides the ability to configure keyboard keys to
+ * move the pointer and act like buttons on the pointer device.
+ * The file processed is the X*pointerkeys file, which consists
+ * of pairs. The form is:
+ *
+ * function key, modifier, or value
+ *
+ * Look at the pointerfunc table in x_hilinit.h to understand this code.
+ * There are 3 types of assignment done:
+ * 1). keys - have both a down and an up code to assign.
+ * 2). modifiers - are a bit position in a mask.
+ * 3). values - are a single integer number.
+ * Possible errors:
+ * 1). only 1 of the pair was specified.
+ * 2). an invalid function was specified.
+ * 3). an invalid key or modifier was specified.
+ */
+
+get_pointerkeys()
+ {
+ char fname[MAXNAMLEN+1];
+ FILE *fp;
+ int len;
+ int cret;
+ int vret;
+ int ret2;
+ int index;
+ char buf[MAXNAMLEN+1];
+ char function[MAXNAMLEN+1];
+ char key[MAXNAMLEN+1];
+ char *fgets();
+ int code;
+ union
+ {
+ u_char *cptr;
+ u_short *sptr;
+ u_int *iptr;
+ } codevar;
+
+ button_3 = 0;
+ if (inputInfo.keyboard) {
+ get_codes ("KEYPAD_2", &code, KEY, FALSE);
+ cursor_down = (unsigned char) code;
+ get_codes ("KEYPAD_5", &code, KEY, FALSE);
+ cursor_up = (unsigned char) code;
+ get_codes ("KEYPAD_1", &code, KEY, FALSE);
+ cursor_left = (unsigned char) code;
+ get_codes ("KEYPAD_3", &code, KEY, FALSE);
+ cursor_right = (unsigned char) code;
+ get_codes ("KEYPAD_*", &code, KEY, FALSE);
+ button_1 = (unsigned char) code;
+ get_codes ("KEYPAD_/", &code, KEY, FALSE);
+ button_2 = (unsigned char) code;
+ get_codes ("KEYPAD_+", &code, KEY, FALSE);
+ button_3 = (unsigned char) code;
+ get_codes ("KEYPAD_-", &code, KEY, FALSE);
+ button_4 = (unsigned char) code;
+ get_codes ("KEYPAD_7", &code, KEY, FALSE);
+ button_5 = (unsigned char) code;
+ }
+ sprintf(fname, "%s/X%spointerkeys",LIBDIR, display);
+ fp = fopen ( fname, "r");
+ if (fp == NULL)
+ return;
+
+ while (fgets(buf,MAXNAMLEN+1,fp) != NULL)
+ {
+ ret2 = sscanf (buf,"%s%s",function,key);
+
+ /* comments begin with a '#'. Skip them. */
+
+ if (function[0] == '#') /* comment, skip it */
+ continue;
+
+ if (ret2 == 2) /* error if < 2 items */
+ {
+ vret = get_vars (function, &codevar, &index);
+ if (vret < 0) /* invalid function */
+ {
+ ErrorF ("Bad function \"%s\" skipped in X*pointerkeys file.\n",
+ function);
+ continue; /* error - skip this one*/
+ }
+ cret = get_codes (key, &code, pointerfunc[index].type, TRUE);
+ if (cret < 0 && /* not a key or modifier*/
+ pointerfunc[index].type == KEY) /* but must be */
+ {
+ ErrorF ("Bad key name \"%s\" skipped in X*pointerkeys file.\n",
+ key);
+ continue; /* error - skip this one*/
+ }
+
+ if (pointerfunc[index].type==MODIFIER) /* modifier - compute bit*/
+ *codevar.cptr = code - 8;
+ else if (pointerfunc[index].type==UINT_NUMBER)
+ *codevar.iptr = code; /* code for 16-bit number */
+ else if (pointerfunc[index].type==USHORT_NUMBER)
+ *codevar.sptr = code; /* code for 16-bit number */
+ else
+ *codevar.cptr = code; /* code for 8-bit key */
+ }
+ else
+ {
+ len = strlen(buf) - 1; /* fgets adds a newline */
+ buf[len] = '\0';
+ if (len > 0)
+ ErrorF ("Bad entry \"%s\" skipped in X*pointerkeys file.\n",
+ buf);
+ }
+ }
+
+ fclose (fp);
+ }
+
+/****************************************************************************
+ *
+ * hpAddInputDevice(deviceProc, autoStart, pHP)
+ * create an X input device, then assign pHP to it's devicePrivate field.
+ *
+ */
+
+static DevicePtr hpAddInputDevice(deviceProc, autoStart, pHP)
+ DeviceProc deviceProc;
+ Bool autoStart;
+ HPInputDevice *pHP;
+ {
+ DevicePtr pXDev;
+ int id;
+
+ if ((pXDev = AddInputDevice(deviceProc, autoStart)) == NULL)
+ FatalError ("Too many input devices - X server terminating!\n");
+#ifdef XINPUT
+ id = ((DeviceIntPtr) pXDev)->id;
+ if (pHP == hpPointer)
+ {
+ hp_device_ids[id] = XPOINTER;
+ x_device_ids[XPOINTER] = id;
+ }
+ else if (pHP == hpKeyboard)
+ {
+ hp_device_ids[id] = XKEYBOARD;
+ x_device_ids[XKEYBOARD] = id;
+ }
+ else
+ {
+ hp_device_ids[id] = otherndx;
+ x_device_ids[otherndx++] = id;
+ }
+#endif /* XINPUT */
+ pXDev->devicePrivate = (pointer) pHP;
+ return pXDev;
+ }
+
+/****************************************************************************
+ *
+ * We allow any keycode to be specified as a modifer, Even one that can't
+ * be generated by our keyboard.
+ *
+ */
+
+LegalModifier(key, dev)
+ unsigned int key;
+ DevicePtr dev;
+ {
+ return TRUE;
+ }
+
+/****************************************************************************
+ *
+ * close_device closes one of the input devices.
+ *
+ */
+
+close_device(d)
+ HPInputDevice *d;
+ {
+ int i, tmp_fd = d->d.file_ds;
+
+ (*(d->s.close)) (d->d.file_ds);
+ d->d.file_ds = -1;
+ if (tmp_fd == max_input_fd)
+ {
+ max_input_fd = 0;
+ for (i=0; i<MAX_LOGICAL_DEVS; i++)
+ if (l_devs[i].d.file_ds != HP_VENDOR_RELEASE_NUMBER &&
+ l_devs[i].d.file_ds > max_input_fd)
+ max_input_fd = l_devs[i].d.file_ds;
+ }
+ }
+
+/*****************************
+ *
+ * init_events_queue (queue)
+ *
+ */
+
+init_events_queue(queue)
+ struct x11EventQueue *queue;
+ {
+ queue->events = events_array;
+ queue->head = 0;
+ queue->tail = 0;
+ queue->size = MAX_EVENTS;
+ events_queue = queue;
+ }
+
+/*****************************************************************
+ *
+ * allocate_event ()
+ * allocates the next available event to the caller and increments
+ * the tail pointer of the events queue; sets queue_events_free as needed.
+ *
+ */
+
+xHPEvent *allocate_event ()
+ {
+ xHPEvent *event;
+
+ event = &( (events_queue->events)[events_queue->tail]);
+
+ if ( events_queue->tail == WR_EVENTS)
+ events_queue->tail = 0;
+ else (events_queue->tail)++;
+
+ queue_events_free--;
+ if (queue_events_free == 0)
+ ErrorF ("Server Internal events queue is full!!!\n");
+ return (event);
+ }
+
+deallocate_event (ev)
+ xHPEvent *ev;
+ {
+ xHPEvent *tmp, *tail, *last, *first;
+
+ tail = &( (events_queue->events)[events_queue->tail]);
+ last = &( (events_queue->events)[WR_EVENTS]);
+ first = &( (events_queue->events)[0]);
+
+ for (tmp=ev; tmp!=tail; tmp++)
+ if (tmp==last)
+ {
+ *tmp = *first;
+ tmp = first-1;
+ }
+ else
+ *tmp = *(tmp+1);
+
+ if (events_queue->tail == 0)
+ events_queue->tail = WR_EVENTS;
+ else
+ events_queue->tail--;
+ queue_events_free++;
+ }
+
+
+#ifdef XINPUT
+void
+AddOtherInputDevices ()
+ {
+ int i;
+ HPInputDevice *hp, *tmphp;
+ DeviceIntPtr dev;
+ Bool found;
+
+ for (i=0, hp=l_devs; i<MAX_LOGICAL_DEVS; hp++,i++)
+ {
+ found = FALSE;
+ for (dev=inputInfo.devices; dev; dev=dev->next)
+ {
+ tmphp = GET_HPINPUTDEVICE (dev);
+ if (hp == tmphp)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ for (dev=inputInfo.off_devices; found==FALSE && dev; dev=dev->next)
+ {
+ tmphp = GET_HPINPUTDEVICE (dev);
+ if (hp == tmphp)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ if (found == FALSE && hp->d.x_name != NULL &&
+ (strcmp (hp->d.path,"/dev/null") != 0))
+ {
+ dev = x_init_device (hp, TRUE);
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ }
+ }
+ }
+
+int
+ChangeKeyboardDevice (old_dev, new_dev)
+ DeviceIntPtr old_dev;
+ DeviceIntPtr new_dev;
+ {
+ CARD8 tmp;
+ HPInputDevice *old = GET_HPINPUTDEVICE (old_dev);
+ HPInputDevice *new = GET_HPINPUTDEVICE (new_dev);
+
+ if (old->hpflags & OPEN_THIS_DEVICE)
+ old->hpflags &= ~OPEN_THIS_DEVICE;
+ tmp = hp_device_ids[new_dev->id];
+ hp_device_ids[new_dev->id] = XKEYBOARD;
+ hp_device_ids[old_dev->id] = tmp;
+ x_device_ids[XKEYBOARD] = new_dev->id;
+ x_device_ids[tmp] = old_dev->id;
+ hpKeyboard = new;
+ return (Success);
+ }
+
+int
+#if NeedFunctionPrototypes
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+#else
+ChangePointerDevice (old_dev, new_dev, x, y)
+ DeviceIntPtr old_dev;
+ DeviceIntPtr new_dev;
+ unsigned char x,y;
+#endif
+ {
+ XID tmp;
+ HPInputDevice *old = GET_HPINPUTDEVICE (old_dev);
+ HPInputDevice *new = GET_HPINPUTDEVICE (new_dev);
+
+ if (new_dev == tablet_extension_device)
+ return (BadDevice);
+ x_axis = x;
+ y_axis = y;
+ if (x_axis != 0 || y_axis != 1)
+ axes_changed = TRUE;
+ else
+ axes_changed = FALSE;
+
+ new->coords[0] = old->coords[0];
+ new->coords[1] = old->coords[1];
+
+ if (old->hpflags & OPEN_THIS_DEVICE)
+ old->hpflags &= ~OPEN_THIS_DEVICE;
+
+ screen_change_dev = new_dev;
+ tmp = hp_device_ids[new_dev->id];
+ hp_device_ids[new_dev->id] = XPOINTER;
+ hp_device_ids[old_dev->id] = tmp;
+ x_device_ids[XPOINTER] = new_dev->id;
+ x_device_ids[tmp] = old_dev->id;
+ hpPointer = new;
+ InitFocusClassDeviceStruct(old_dev);
+ return (Success);
+ }
+
+/****************************************************************************
+ *
+ * Turn on a non-standard device.
+ *
+ */
+
+void
+OpenInputDevice (dev, client, status)
+ DeviceIntPtr dev;
+ ClientPtr client;
+ int *status;
+ {
+ int mode;
+ HPInputDevice *d;
+ DeviceClientsPtr tmp;
+
+ if (*status != Success) /* kludge - if not Success, */
+ mode = (*status >> 8); /* called from HPSetInputDevice */
+ else /* mode hidden in 2nd byte */
+ mode = DEVICE_EVENTS | ON;
+
+ *status = Success;
+
+ d = GET_HPINPUTDEVICE (dev);
+ if (d->d.file_ds == -1) /* device not yet open */
+ {
+ if (open_device (d) < 0) /* couldn't open device */
+ {
+ *status = BadDevice;
+ return;
+ }
+ }
+ else
+ {
+ for (tmp = (DeviceClientsPtr) d->clients; tmp!=NULL; tmp=tmp->next)
+ if (tmp->mode != mode)
+ {
+ *status = BadMode;
+ return;
+ }
+ }
+ SetInputDevice (d, mode);
+
+ dev->startup = 1;
+ RecordOpenRequest (client, d, dev->id, mode);
+ }
+
+/***********************************************************************
+ *
+ * Record a successful request from a client to open an input device.
+ *
+ */
+
+static void
+RecordOpenRequest (client, d, id, token)
+ register ClientPtr client;
+ HPInputDevice *d;
+ CARD8 id;
+ int token;
+ {
+ DeviceClientsPtr tmp;
+ DeviceClientsPtr new_client;
+
+ if (d->clients != NULL)
+ {
+ for (tmp = (DeviceClientsPtr) d->clients; tmp!=NULL; tmp=tmp->next)
+ if (tmp->client == client)
+ {
+ tmp->count++;
+ return;
+ }
+ else if (tmp->next == NULL)
+ break;
+
+ new_client = (DeviceClients *) Xalloc(sizeof(DeviceClients));
+ tmp->next = new_client;
+ }
+ else
+ {
+ new_client = (DeviceClients *) Xalloc(sizeof(DeviceClients));
+ d->clients = new_client;
+ }
+
+ memset ((char *) new_client, 0, sizeof (DeviceClients));
+ new_client->resource = FakeClientID(client->index);
+ new_client->client = client;
+ new_client->next = NULL;
+ new_client->count = 1;
+ new_client->mode = token;
+
+ AddResource(new_client->resource, HPType, (pointer) id);
+ }
+
+
+/***********************************************************************
+ *
+ * Turn off a device because a client died.
+ * Also called when a client closes a device.
+ *
+ */
+
+int HPShutDownDevice (deviceid, clientid)
+ CARD8 deviceid;
+ int clientid;
+ {
+ DeviceIntPtr dev = NULL;
+ DeviceClientsPtr tmp;
+ DeviceClientsPtr save;
+ HPInputDevice *d;
+
+ if (deviceid == inputInfo.pointer->id)
+ d = hpPointer;
+ else if (deviceid == inputInfo.keyboard->id)
+ d = hpKeyboard;
+ else
+ {
+ dev = LookupDeviceIntRec(deviceid);
+ if (dev == NULL)
+ return;
+ d = GET_HPINPUTDEVICE (dev);
+ }
+
+ if (d->clients != NULL)
+ {
+ tmp = (DeviceClientsPtr) d->clients;
+ if (tmp->resource == clientid)
+ {
+ d->clients = tmp->next;
+ Xfree (tmp);
+ }
+ else
+ for (save=tmp,tmp=tmp->next; tmp!=NULL; save=tmp, tmp=tmp->next)
+ {
+ if (tmp->resource == clientid)
+ {
+ save->next = tmp->next;
+ Xfree (tmp);
+ }
+ }
+ if (dev && d->clients == NULL)
+ {
+ if (!(d->hpflags & MERGED_DEVICE) ||
+ (d->hpflags & SECOND_LOGICAL_DEVICE))
+ DisableDevice(dev);
+ }
+ }
+ }
+
+/****************************************************************************
+ *
+ * Turn off an extension device.
+ * This code does not allow the keyboard or pointer to be turned off.
+ *
+ */
+
+void
+CloseInputDevice (dev, client)
+ DeviceIntPtr dev;
+ ClientPtr client;
+ {
+ HPInputDevice *d;
+ DeviceClientsPtr tmp;
+
+ d = GET_HPINPUTDEVICE (dev);
+
+ for (tmp= (DeviceClientsPtr) d->clients; tmp!=NULL; tmp=tmp->next)
+ if (tmp->client == client)
+ {
+ tmp->count--;
+ if (tmp->count == 0)
+ {
+ FreeResource(tmp->resource, RT_NONE);
+ return;
+ }
+ }
+ }
+
+/****************************************************************************
+ *
+ * Change the state of a non-standard device.
+ * Modes are:
+ * ON - turn the device on.
+ * OFF - turn the device off.
+ * SYSTEM_EVENTS - report the standard input events.
+ * DEVICE_EVENTS - report the extension input events.
+ *
+ */
+
+static void
+SetInputDevice (d, mode)
+ HPInputDevice *d;
+ int mode;
+ {
+
+ if ((mode & DEVICE_EVENTS) == DEVICE_EVENTS)
+ d->hpflags &= ~MERGED_DEVICE;
+ else
+ {
+ mode |= ABSOLUTE;
+ d->hpflags |= MERGED_DEVICE;
+ }
+
+ if ((mode & ABSOLUTE) == ABSOLUTE)
+ {
+ d->coords[0] = hpPointer->coords[0];
+ d->coords[1] = hpPointer->coords[1];
+ d->hpflags |= ABSOLUTE_DATA;
+ }
+ else
+ {
+ d->coords[0] = 0;
+ d->coords[1] = 0;
+ if (!(d->d.flags & ABSOLUTE_DATA))
+ d->hpflags &= ~ABSOLUTE_DATA;
+ }
+ }
+
+/****************************************************************************
+ *
+ * Change the mode of an extension device.
+ * This is for devices such as graphics tablets that can report either
+ * relative or absolute motion.
+ * We currently do not support this.
+ *
+ */
+
+int
+SetDeviceMode (client, dev, mode)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int mode;
+ {
+ HPInputDevice *d;
+
+ d = GET_HPINPUTDEVICE (dev);
+ if (d->dev_type == NULL_DEVICE)
+ return Success;
+ if ((*(d->s.write)) (d->d.file_ds, _XSetDeviceMode, &mode)==WRITE_SUCCESS)
+ return Success;
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Set the value of valuators on an extension device.
+ * This is needed for some devices that can report both
+ * relative and absolute motion. Some may require that the
+ * initial values be set when switching modes.
+ * We currently do not support this.
+ *
+ */
+
+int
+SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+ {
+ int i;
+ HPInputDevice *d;
+ HPResolutionControl ctrl;
+
+ d = GET_HPINPUTDEVICE (dev);
+ for (i=first_valuator; i<num_valuators; i++)
+ if (i>=0 && i < dev->valuator->numAxes)
+ dev->valuator->axisVal[i] = *(valuators+i);
+ if (d->dev_type == NULL_DEVICE)
+ return Success;
+ ctrl.first_valuator = first_valuator;
+ ctrl.num_valuators = num_valuators;
+ ctrl.resolutions = valuators;
+ if ((*(d->s.write)) (d->d.file_ds, _XSetDeviceValuators, &ctrl)==WRITE_SUCCESS)
+ return Success;
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Change the resolution of valuators on an extension device.
+ * This is needed for some devices that have multiple resolutions.
+ * We currently do not support this.
+ *
+ */
+
+int
+ChangeDeviceControl (client, dev, control)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ xDeviceCtl *control;
+ {
+ HPInputDevice *d;
+ xDeviceResolutionCtl *dctrl = (xDeviceResolutionCtl *) control;
+ HPResolutionControl c;
+
+ d = GET_HPINPUTDEVICE (dev);
+ if (d->dev_type == NULL_DEVICE)
+ return Success;
+ c.first_valuator = dctrl->first_valuator;
+ c.num_valuators = dctrl->num_valuators;
+ c.resolutions = (int *) (dctrl+1);
+ if ((*(d->s.write)) (d->d.file_ds, _XChangeDeviceControl, &c)==WRITE_SUCCESS)
+ return Success;
+ return BadMatch;
+ }
+#endif /* XINPUT */
+
+#define LEFT_SHIFT_CODE 0x05
+#define RIGHT_SHIFT_CODE 0x04
+#define LEFT_MOD1_CODE 0x03
+#define RIGHT_MOD1_CODE 0x02
+#define RIGHT_CONTROL_CODE 0x00
+#define LEFT_CONTROL_CODE 0x06
+
+#define LEFT_SHIFT_BIT 0x20
+#define RIGHT_SHIFT_BIT 0x10
+#define LEFT_MOD1_BIT 0x08
+#define RIGHT_MOD1_BIT 0x04
+#define RIGHT_CONTROL_BIT 0x01
+#define LEFT_CONTROL_BIT 0x40
+#define MAX_KEY_MODS 3
+
+fix_modifierkeys()
+ {
+ u_char tmp[3];
+
+ tmp[1] = 0xff;
+ tmp[2] = 0xff;
+ tmp[0] = pointer_amt_mods[0];
+ mask_from_kcodes (tmp, &pointer_amt_bits[0]);
+ tmp[0] = pointer_amt_mods[1];
+ mask_from_kcodes (tmp, &pointer_amt_bits[1]);
+ tmp[0] = pointer_amt_mods[2];
+ mask_from_kcodes (tmp, &pointer_amt_bits[2]);
+
+ mask_from_kcodes (pointer_key_mods, &ptr_mods);
+ mask_from_kcodes (pointer_amt_mods, &mv_mods);
+ mask_from_kcodes (reset_mods, &rs_mods);
+ mask_from_kcodes (borrow_mode_mods, &bw_mods);
+ mv_mods &= ~ptr_mods;
+ }
+
+static void
+mask_from_kcodes (src, dst)
+ u_char *src;
+ u_char *dst;
+ {
+ int i;
+ HPInputDevice *d;
+
+ d = GET_HPINPUTDEVICE (inputInfo.keyboard);
+ for (i=0; i<MAX_KEY_MODS; i++, src++)
+ if (*src != 0xff)
+ *dst |= inputInfo.keyboard->key->modifierMap[(*src+8)];
+ return;
+ }
+
+get_down_modifiers(dev, down_mods)
+ DeviceIntPtr dev;
+ unsigned char *down_mods;
+ {
+ u_char *kptr = dev->key->down;
+ HPInputDevice *d;
+
+ *down_mods = dev->key->state; /* get X modifier bits */
+ }
+
+/*****************************************************************************
+ *
+ * Dynamically load drivers to support input devices.
+ *
+ */
+
+#define DYNAMIC_DEVICE 0xffff
+#define HIL_DRIVER "hil_driver.sl"
+#define HILDRVR_ENTRY "hil_driver_Init"
+FILE *fp;
+
+init_dynamic_devs(devs)
+ HPInputDevice *devs;
+{
+ int i, keyboard_is_pointer = FALSE;
+ HPInputDevice *d;
+ Bool (*driverInit)() = NULL, null_needed = FALSE;
+ char fname[MAXNAMLEN];
+
+ /*
+ * Check the X*devices file for NULL device specifications. If they are
+ * specified, we need to load the HIL driver to support them.
+ *
+ */
+
+ is_null_needed(&null_needed, &keyboard_is_pointer);
+
+ /*
+ * See if we can access a DIN mouse and keyboard. If so, we need to load
+ * a driver to support them. The DIN devices will be used as the X pointer
+ * and keyboard unless some other device is explicitly specified.
+ *
+ */
+
+ find_din_kbd_use(keyboard_is_pointer);
+ find_din_mouse_use(&keyboard_is_pointer);
+
+ /*
+ * Check to see if this machine supports HIL devices.
+ * If so, load the driver and call it to process the X0devices file
+ * for old-style syntax.
+ */
+
+ sprintf(fname, "%s/X%sdevices",LIBDIR, display);
+ if (((fp = fopen(BEEPER_DEVICE,"r")) != NULL) || null_needed) {
+ fclose (fp);
+ d = next_device_private();
+ sprintf(d->driver_name, "%s/%s",DRVRLIBDIR,HIL_DRIVER);
+ sprintf(d->d.path,"X*devices:Recycle:%s",fname);
+ strcpy (d->entry, HILDRVR_ENTRY);
+
+ load_and_init_dev (d, &driverInit, TRUE);
+
+ /*
+ * The request to recycle the HIL input device state does not return
+ * a valid input device. It is normally reused, but not if there are
+ * no HIL input devices attached. Clear it to make sure it is treated
+ * as uninitialized.
+ */
+
+ clear_device_private(d);
+
+ if (d->d.reserved[3] && (!hpPointer || hpPointer->dev_type != KEYBOARD))
+ keyboard_is_pointer = TRUE;
+
+ for (i=0; i<MAX_DEVICES; i++) {
+ sprintf(d->d.path,"X*devices:");
+ if (load_and_init_dev (d, &driverInit, FALSE))
+ break;
+ if (!(d=next_device_private()))
+ break;
+ }
+ }
+
+ /*
+ * Now process the X*devices configuration file for new-style entries.
+ * These specify dynamically loaded input device drivers.
+ * If the system doesn't support HIL devices, get_next_device will
+ * return any explicitly specified dynamically loaded input devices.
+ */
+
+ fp = fopen ( fname, "r");
+ if (fp) {
+ if (d=next_device_private()) {
+ while (get_next_device (fp,d)) {
+ driverInit = NULL;
+ load_and_init_dev (d, &driverInit, TRUE);
+ if (!(d=next_device_private()))
+ break;
+ }
+ }
+ fclose(fp);
+ }
+
+ if (!hpPointer)
+ FatalError ("Couldn't open X pointer device! Is one attached?\n");
+ if (!hpKeyboard)
+ FatalError ("Couldn't open X keyboard! Is one attached?\n");
+ if (tablet_width)
+ fix_tablet_subsetting();
+}
+
+/*****************************************************************************
+ *
+ * Initialize the input device private structure.
+ *
+ */
+
+char *x_basename (name)
+ char *name;
+ {
+ int i;
+ char *nptr = strchr (name, '_');
+ char *ordinal[] = {"FIRST", "SECOND", "THIRD", "FOURTH",
+ "FIFTH", "SIXTH", "SEVENTH"};
+
+ if (!nptr)
+ return (name);
+
+ for (i=0; i<7; i++)
+ if (!strncmp(name, ordinal[i], strlen(ordinal[i])))
+ return(++nptr);
+ return (name);
+ }
+
+close_default_device (thisDev, otherDev)
+ HPInputDevice *thisDev, *otherDev;
+ {
+ int i, fd;
+
+ if (otherDev && (otherDev->d.file_ds != thisDev->d.file_ds))
+ {
+ thisDev->s.close(thisDev->d.file_ds);
+ for (i=0, fd=thisDev->d.file_ds; i<MAX_DEVICES; i++)
+ if (l_devs[i].d.file_ds == fd)
+ l_devs[i].d.file_ds = -1;
+ }
+ else
+ {
+ thisDev->id = UNINITIALIZED;
+ thisDev->driver_name[0] = '\0';
+ thisDev->d.x_name = NULL;
+ }
+ thisDev->d.file_ds = -1;
+ }
+
+init_device_private (d, close)
+ HPInputDevice *d;
+ Bool close;
+ {
+ int j, fd;
+ HPInputDeviceHeader *dh = &(d->d);
+ char *nptr;
+
+ if (dh->file_ds == HP_VENDOR_RELEASE_NUMBER)
+ {
+ clear_device_private (d);
+ return;
+ }
+ nptr = x_basename (dh->x_name);
+ d->x_atom = MakeAtom (nptr, strlen(nptr),0);
+ if (!d->x_atom)
+ d->x_atom = MakeAtom(nptr, strlen(nptr),1);
+ dh->resolution *= 100;
+ if (dh->num_keys)
+ d->x_type = KEYBOARD;
+ else if (dh->ax_num)
+ d->x_type = MOUSE;
+ else
+ d->x_type = XOTHER;
+ if (dh->num_ledf)
+ d->iob |= HAS_LEDS;
+ if (dh->flags & REPORTS_PROXIMITY)
+ d->iob = HILIOB_PIO;
+ d->hpflags = dh->flags & ~REPORTS_PROXIMITY;
+ if (dh->file_ds >= 0)
+ d->hpflags |= OPEN_THIS_DEVICE;
+ d->hpflags |= (dh->flags & DATA_SIZE_BITS);
+ d->id_detail = SERIAL;
+ d->dev_type = DYNAMIC_DEVICE;
+ d->id = 0;
+ if (d->d.reserved[0] & HP_HIL) {
+ d->id_detail = d->d.reserved[0];
+ d->id = d->d.min_kcode;
+ d->iob = d->d.max_kcode;
+ d->dev_type = d->d.reserved[1];
+ d->use = d->d.reserved[2];
+ }
+ if (hpPointer && ((d->use & XPTR_USE) && !(d->use & EXPLICIT)))
+ d->use &= ~XPTR_USE;
+ if (hpKeyboard && ((d->use & XKBD_USE) && !(d->use & EXPLICIT)))
+ d->use &= ~XKBD_USE;
+ if (!d->use)
+ d->use = XEXT_USE;
+
+ if (d->use & XPTR_USE)
+ {
+ if (hpPointer)
+ close_default_device (hpPointer, hpKeyboard);
+ hpPointer = d;
+ }
+ if (d->use & XKBD_USE)
+ {
+ HPInputDevice *d2;
+ if (d->use & XPTR_USE && (d2=next_device_private()))
+ {
+ *d2 = *d;
+ d->use = XKBD_USE;
+ d->hpflags |= SECOND_LOGICAL_DEVICE;
+ hpPointer = d2;
+ hpPointer->use = XPTR_USE;
+ }
+ if (hpKeyboard)
+ close_default_device (hpKeyboard, hpPointer);
+ hpKeyboard = d;
+ if (dh->reset)
+ {
+ reset = dh->reset;
+ rs_mods = dh->reset_mods;
+ }
+ }
+ if ((d->use & XEXT_USE) && close)
+ {
+ d->s.close(dh->file_ds);
+ dh->file_ds = -1;
+ }
+ if (d->use & XOTH_USE)
+ d->hpflags |= MERGED_DEVICE;
+ if (dh->file_ds > max_input_fd)
+ max_input_fd = dh->file_ds;
+}
+
+/******************************************************************************
+ *
+ * shl_driver_load() is passed the path of a shared library to load, and the
+ * name of an entry point to find. It loads the library and returns the
+ * entry point address.
+ */
+
+Bool (*shl_driver_load( driver_path, driver_init ))()
+char *driver_path, *driver_init;
+{
+ /*
+ * pfrb = pointer to a function returning a Bool
+ */
+ typedef Bool (*pfrb)();
+
+ shl_t ldr_module_id;
+ long ldr_module_entry=0;
+ int ret_val;
+ char *dummy_handle = NULL;
+#define ALL_SHLIBS_HANDLE &dummy_handle
+
+ /**********************************************************************
+ *
+ * If the driver entrypoint is already visible within the current program,
+ * skip the load and return the address of the routine we already have
+ * loaded.
+ *
+ */
+
+ ret_val = shl_findsym((shl_t *) PROG_HANDLE, driver_init,
+ TYPE_PROCEDURE, &ldr_module_entry );
+ if ( ! ret_val ) {
+ return( (pfrb) ldr_module_entry );
+ }
+
+ /*
+ * If the driver entrypoint is already visible within a shared library we
+ * are already accessing, skip the load and return the address.
+ */
+ ret_val = shl_findsym((shl_t *) ALL_SHLIBS_HANDLE, driver_init,
+ TYPE_PROCEDURE, &ldr_module_entry );
+ if ( ! ret_val ) {
+ return( (pfrb) ldr_module_entry );
+ }
+
+
+ /**********************************************************************
+ *
+ * Load driver into the current VA space.
+ */
+ ldr_module_id = shl_load( driver_path, (BIND_DEFERRED | BIND_VERBOSE), 0L );
+
+ if ( ldr_module_id == NULL )
+ FatalError ("X server failed to load shared library %s, errno is %d\n",
+ driver_path,errno);
+
+
+ /**********************************************************************
+ *
+ * Use the module ID to find the address of the requested entry point.
+ */
+
+ ret_val = shl_findsym( &ldr_module_id, driver_init, TYPE_PROCEDURE,
+ &ldr_module_entry );
+ if (ret_val && driver_init != NULL)
+ FatalError ("X server couldn't find entry point '%s' in library %s\n",
+ driver_init, driver_path);
+
+ return( (pfrb) ldr_module_entry );
+}
+
+/***********************************************************************
+ *
+ * din_mouse_present
+ *
+ */
+
+static Bool
+din_mouse_present()
+ {
+ int fd;
+ struct ps2_4 statbuf, idbuf;
+
+ fd = open("/dev/ps2mouse", O_RDWR);
+ if (fd < 0)
+ return FALSE;
+ ioctl (fd, PS2_PORTSTAT, &statbuf);
+ ioctl (fd, PS2_IDENT, &idbuf);
+ close (fd);
+ if (statbuf.b[0] != PS2_MOUSE || idbuf.b[0] != 0)
+ return FALSE;
+ return TRUE;
+ }
+
+/***********************************************************************
+ *
+ * find_din_mouse_use
+ *
+ */
+
+find_din_mouse_use(keyboard_is_pointer)
+ int *keyboard_is_pointer;
+ {
+ HPInputDevice *d;
+ Bool (*driverInit)() = NULL;
+
+ if (!din_mouse_present()) /* no DIN mouse attached */
+ {
+ if (!hpPointer || /* no HIL pointer device */
+ (hpPointer->dev_type != MOUSE && /* or it's not a motion device*/
+ !(hpPointer->use & EXPLICIT))) /* and not explicitly named */
+ *keyboard_is_pointer = TRUE;
+ return;
+ }
+
+ if (!(d=next_device_private())) /* too many devices */
+ return;
+
+ if ((hpPointer && hpPointer->use & EXPLICIT) || *keyboard_is_pointer)
+ d->use = XEXT_USE; /* explicit ptr specified */
+ else
+ d->use = XPTR_USE;
+
+ sprintf(d->driver_name, "%s/%s", DRVRLIBDIR, DIN_MOUSE_DRVR);
+ strcpy (d->entry, DIN_MOUSE_INIT);
+ strcpy (d->d.path, DIN_MOUSE_PATH);
+
+ load_and_init_dev (d, &driverInit, TRUE);
+ d->id_detail = PS2;
+ }
+
+/***********************************************************************
+ *
+ * din_kbd_present
+ *
+ */
+
+static Bool
+din_kbd_present()
+ {
+ int fd;
+ struct ps2_4 statbuf, idbuf;
+
+ fd = open("/dev/ps2kbd", O_RDWR);
+ if (fd < 0)
+ return FALSE;
+ ioctl (fd, PS2_PORTSTAT, &statbuf);
+ ioctl (fd, PS2_IDENT, &idbuf);
+ close (fd);
+ if (statbuf.b[0]!=PS2_KEYBD &&
+ idbuf.b[0]!=0xab && idbuf.b[1]!=0x83) /* no DIN kbd*/
+ return FALSE;
+ return TRUE;
+ }
+
+/***********************************************************************
+ *
+ * find_din_kbd_use
+ *
+ */
+
+find_din_kbd_use(keyboard_is_pointer)
+ int keyboard_is_pointer;
+ {
+ Bool (*driverInit)() = NULL;
+ HPInputDevice *d;
+
+ if (!din_kbd_present()) /* no DIN kbd */
+ return;
+
+ if (!(d=next_device_private())) /* too many devices */
+ return;
+
+ if (hpKeyboard && hpKeyboard->use & EXPLICIT) /* kbd explicitly spec'd */
+ d->use = XEXT_USE;
+ else
+ d->use = XKBD_USE;
+
+ if (keyboard_is_pointer)
+ d->use |= XPTR_USE;
+
+ sprintf(d->driver_name, "%s/%s", DRVRLIBDIR, DIN_KBD_DRVR);
+ strcpy (d->entry, DIN_KBD_INIT);
+ strcpy (d->d.path, DIN_KBD_PATH);
+
+ load_and_init_dev (d, &driverInit, TRUE);
+ d->id_detail = PS2 | PC101_KBD;
+ }
+
+/***********************************************************************
+ *
+ * load_and_init_dev
+ *
+ */
+
+load_and_init_dev (d, driverInit, fatal)
+ HPInputDevice *d;
+ Bool (**driverInit)();
+ Bool fatal;
+ {
+ int ret_val;
+ void *(*foo)();
+
+ if (! *driverInit)
+ *driverInit = shl_driver_load(d->driver_name, d->entry, &foo, "x");
+ ret_val = (**driverInit)(&(d->s)); /* Initialize driver. */
+ if (ret_val!=INIT_SUCCESS)
+ FatalError ("Couldn't initialize input device driver %s\n",
+ d->driver_name);
+ if ((*(d->s.configure)) (&(d->d))!=INIT_SUCCESS)
+ if (fatal)
+ FatalError ("Couldn't configure input device driver %s\n",
+ d->driver_name);
+ else
+ {
+ clear_device_private (d);
+ return 1;
+ }
+ init_device_private (d, TRUE);
+ return 0;
+ }
diff --git a/xc/programs/Xserver/hw/hp/input/x_hilinit.h b/xc/programs/Xserver/hw/hp/input/x_hilinit.h
new file mode 100644
index 000000000..ce9d344f8
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/x_hilinit.h
@@ -0,0 +1,460 @@
+#ifndef X_HILINIT_H
+#define X_HILINIT_H
+/* $TOG: x_hilinit.h /main/3 1998/02/10 13:11:34 kaleb $ */
+/*
+
+Copyright 1986, 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1986, 1987 by Hewlett-Packard Company
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+/**************************************************************************
+ *
+ * file: x_hilinit.h
+ *
+ * contains key definitions and other static information used by x_hilinit.c
+ *
+ */
+
+#define STARTUP 0
+#define MAX_STRINGS (sizeof (strings) / sizeof (struct str_table))
+#define MAX_DEV_TYPES (sizeof (devices) / sizeof (struct dev_table))
+#define MAX_POINTER_FUNCS (sizeof (pointerfunc) / sizeof (struct pointerfunc))
+#define QUAD_INDEX 8 /* index of quad entry in dev_table */
+#define NINE_KNOB_ID 0x61
+#define KEY 0
+#define UCHAR_NUMBER 1
+#define STRING 2
+#define MODIFIER 3
+#define USHORT_NUMBER 4
+#define UINT_NUMBER 5
+
+#include "keysym.h"
+#include "HPkeysym.h"
+#include "ap_keysym.h"
+
+struct opendevs
+ {
+ int type;
+ int pos;
+ int use;
+ char path[MAXNAMLEN+1];
+ char name[MAXNAMLEN+1];
+ char entry[MAXNAMLEN+1];
+ };
+
+struct dev_table
+ {
+ int lowid;
+ int highid;
+ int dev_type;
+ int x_type;
+ char *name;
+ unsigned char num_keys;
+ unsigned char min_kcode;
+ unsigned char max_kcode;
+ };
+
+struct dev_table devices[] =
+ {{0x00,0x1f,KEYPAD,KEYBOARD,"KEYPAD",0,0,0},
+ {0x2f,0x2f,APOLLO_LPFK,KEYBOARD,"LPFK-BUTTONBOX",33,64,32},
+ {0x30,0x33,BUTTONBOX,KEYBOARD,"BUTTONBOX",32,10,41},
+ {0x34,0x34,ID_MODULE,XOTHER,"ID_MODULE",0,0,0},
+ {0x35,0x3f,BUTTONBOX,KEYBOARD,"BUTTONBOX",32,10,41},
+ {0x5c,0x5f,BARCODE,KEYBOARD,"BARCODE",109,10,135},
+ {0x60,0x60,ONE_KNOB,MOUSE,"ONE_KNOB",0,0,0},
+ {0x61,0x61,NINE_KNOB,MOUSE,"NINE_KNOB",0,0,0},
+ {0x62,0x67,QUADRATURE,MOUSE,"QUADRATURE",0,0,0},
+ {0x68,0x6b,MOUSE,MOUSE,"MOUSE",0,0,0},
+ {0x6c,0x6f,TRACKBALL,MOUSE,"TRACKBALL",0,0,0},
+ {0x70,0x70,VCD_8_DIALBOX,MOUSE,"KNOB_BOX",0,0,0},
+ {0x71,0x71,SS_SPACEBALL,MOUSE,"SPACEBALL",0,0,0},
+ {0x88,0x8b,TOUCHPAD,MOUSE,"TOUCHPAD",0,0,0},
+ {0x8c,0x8f,TOUCHSCREEN,MOUSE,"TOUCHSCREEN",0,0,0},
+ {0x90,0x97,TABLET,MOUSE,"TABLET",0,0,0},
+ {0x98,0x98,MMII_1812_TABLET,MOUSE,"MMII-TABLET",0,0,0},
+ {0x99,0x99,MMII_1201_TABLET,MOUSE,"MMII-TABLET",0,0,0},
+ {0xA0,0xBF,KEYBOARD,KEYBOARD,"KEYBOARD",93,10,135},
+ {0xC0,0xDF,KEYBOARD,KEYBOARD,"KEYBOARD",109,10,135},
+ {0xE0,0xFF,KEYBOARD,KEYBOARD,"KEYBOARD",87,10,135},
+ {0x00,0x00,NULL_DEVICE,NULL_DEVICE,"NULL",0,0,0}};
+
+char *position[] =
+ {
+ "FIRST",
+ "SECOND",
+ "THIRD",
+ "FOURTH",
+ "FIFTH",
+ "SIXTH",
+ "SEVENTH"
+ };
+
+char *suffix[] =
+#if defined(__hp9000s300) || defined(__hp9000s700) || defined(__hp_osf)
+ {"1","2","3","4","5","6","7"};
+#else
+ {"0.1","0.2","0.3","0.4","0.5","0.6","0.7",
+ "1.1","1.2","1.3","1.4","1.5","1.6","1.7",
+ "2.1","2.2","2.3","2.4","2.5","2.6","2.7",
+ "3.1","3.2","3.3","3.4","3.5","3.6","3.7"};
+#endif /* __hp9000s300 or __hp9000s700 */
+
+extern u_char cursor_down;
+extern u_char cursor_left;
+extern u_char cursor_right;
+extern u_char cursor_up;
+extern u_char button_1;
+extern u_char button_2;
+extern u_char button_3;
+extern u_char button_4;
+extern u_char button_5;
+extern u_char button_6;
+extern u_char button_7;
+extern u_char button_8;
+
+extern u_char pointer_key_mods[3];
+extern u_char pointer_amt_mods[3];
+extern u_char reset_mods[3];
+extern u_char borrow_mode_mods[3];
+extern u_short pointer_move;
+extern u_short pointer_mod1_amt;
+extern u_short pointer_mod2_amt;
+extern u_short pointer_mod3_amt;
+extern u_char borrow_mode;
+extern u_char reset;
+extern u_char screen_change_amt;
+extern u_char button_chording;
+extern u_char button_latching;
+extern u_char ptr_button_map[];
+extern u_char isotropic_scaling;
+extern u_char screen_orientation;
+extern u_char screen_row_wrap;
+extern u_char screen_col_wrap;
+extern u_int tablet_xorigin;
+extern u_int tablet_yorigin;
+extern u_int tablet_width;
+extern u_int tablet_height;
+
+struct pointerfunc
+ {
+ char *name;
+ u_char *code;
+ int type;
+ };
+
+struct pointerfunc pointerfunc [] =
+ {{"POINTER_LEFT_KEY", &cursor_left, KEY},
+ {"POINTER_RIGHT_KEY", &cursor_right, KEY},
+ {"POINTER_UP_KEY", &cursor_up, KEY},
+ {"POINTER_DOWN_KEY", &cursor_down, KEY},
+ {"POINTER_KEY_MOD1", &pointer_key_mods[0], MODIFIER},
+ {"POINTER_KEY_MOD2", &pointer_key_mods[1], MODIFIER},
+ {"POINTER_KEY_MOD3", &pointer_key_mods[2], MODIFIER},
+ {"POINTER_BUTTON1_KEY", &button_1, KEY},
+ {"POINTER_BUTTON2_KEY", &button_2, KEY},
+ {"POINTER_BUTTON3_KEY", &button_3, KEY},
+ {"POINTER_BUTTON4_KEY", &button_4, KEY},
+ {"POINTER_BUTTON5_KEY", &button_5, KEY},
+ {"POINTER_BUTTON6_KEY", &button_6, KEY},
+ {"POINTER_BUTTON7_KEY", &button_7, KEY},
+ {"POINTER_BUTTON8_KEY", &button_8, KEY},
+ {"POINTER_MOVE", (u_char *) &pointer_move, USHORT_NUMBER},
+ {"POINTER_MOD1_AMT", (u_char *) &pointer_mod1_amt, USHORT_NUMBER},
+ {"POINTER_MOD2_AMT", (u_char *) &pointer_mod2_amt, USHORT_NUMBER},
+ {"POINTER_MOD3_AMT", (u_char *) &pointer_mod3_amt, USHORT_NUMBER},
+#ifdef __apollo
+ {"BORROW_MODE_KEY", &borrow_mode, KEY},
+ {"BORROW_MODE_MOD1_KEY", &borrow_mode_mods[0], MODIFIER},
+ {"BORROW_MODE_MOD2_KEY", &borrow_mode_mods[1], MODIFIER},
+#endif /* __apollo */
+ {"RESET", &reset, KEY},
+ {"RESET_MOD1", &reset_mods[0], MODIFIER},
+ {"RESET_MOD2", &reset_mods[1], MODIFIER},
+ {"RESET_MOD3", &reset_mods[2], MODIFIER},
+ {"POINTER_AMT_MOD1", &pointer_amt_mods[0], MODIFIER},
+ {"POINTER_AMT_MOD2", &pointer_amt_mods[1], MODIFIER},
+ {"POINTER_AMT_MOD3", &pointer_amt_mods[2], MODIFIER},
+ {"BUTTON_1_VALUE", &ptr_button_map[1], UCHAR_NUMBER},
+ {"BUTTON_2_VALUE", &ptr_button_map[2], UCHAR_NUMBER},
+ {"BUTTON_3_VALUE", &ptr_button_map[3], UCHAR_NUMBER},
+ {"BUTTON_4_VALUE", &ptr_button_map[4], UCHAR_NUMBER},
+ {"BUTTON_5_VALUE", &ptr_button_map[5], UCHAR_NUMBER},
+ {"BUTTON_6_VALUE", &ptr_button_map[6], UCHAR_NUMBER},
+ {"BUTTON_7_VALUE", &ptr_button_map[7], UCHAR_NUMBER},
+ {"BUTTON_8_VALUE", &ptr_button_map[8], UCHAR_NUMBER},
+ {"SCREEN_CHANGE_AMT", &screen_change_amt, UCHAR_NUMBER},
+ {"BUTTON_CHORDING", &button_chording, STRING},
+ {"BUTTON_LATCHING", &button_latching, STRING},
+ {"TABLET_SUBSET_XORIGIN", (u_char *) &tablet_xorigin, UINT_NUMBER},
+ {"TABLET_SUBSET_YORIGIN", (u_char *) &tablet_yorigin, UINT_NUMBER},
+ {"TABLET_SUBSET_WIDTH", (u_char *) &tablet_width, UINT_NUMBER},
+ {"TABLET_SUBSET_HEIGHT", (u_char *) &tablet_height, UINT_NUMBER},
+ {"ISOTROPIC_SCALING", &isotropic_scaling, STRING},
+ {"SCREEN_ORIENTATION", &screen_orientation, STRING},
+ {"SCREEN_ROW_WRAP", &screen_row_wrap, STRING},
+ {"SCREEN_COL_WRAP", &screen_col_wrap, STRING}};
+
+struct str_table
+ {
+ char *string;
+ u_char value;
+ } strings [] = {
+ {"OFF",CHORDING_OFF},
+ {"ON",CHORDING_ON},
+ {"DEFAULT",CHORDING_DEFAULT},
+ {"WRAP",WRAP},
+ {"NOWRAP",NOWRAP},
+ {"SAMESCREEN",SAMESCREEN},
+ {"CHANGE_BY_TWO",CHANGE_BY_TWO},
+ {"VERTICAL",VERTICAL},
+ {"HORIZONTAL",HORIZONTAL},
+ {"MATRIX",MATRIX}};
+
+struct _keyset1 {
+ char *keystr;
+ KeySym sym;
+ } keyset1[] = {
+ {"ALT_L", XK_Alt_L},
+ {"ALT_R", XK_Alt_R},
+ {"LEFT_CONTROL", XK_Control_L},
+ {"RIGHT_CONTROL", XK_Control_R},
+ {"RIGHT_EXTEND", XK_Meta_R},
+ {"LEFT_EXTEND", XK_Meta_L},
+ {"RIGHT_SHIFT", XK_Shift_R},
+ {"LEFT_SHIFT", XK_Shift_L},
+ {"CONTROL", XK_Control_L},
+ {"KEYPAD_4", XK_KP_4},
+ {"KEYPAD_8", XK_KP_8},
+ {"KEYPAD_5", XK_KP_5},
+ {"KEYPAD_9", XK_KP_9},
+ {"KEYPAD_6", XK_KP_6},
+ {"KEYPAD_7", XK_KP_7},
+ {"KEYPAD_COMMA", XK_KP_Separator},
+ {"KEYPAD_ENTER", XK_KP_Enter},
+ {"KEYPAD_1", XK_KP_1},
+ {"KEYPAD_/", XK_KP_Divide},
+ {"KEYPAD_2", XK_KP_2},
+ {"KEYPAD_+", XK_KP_Add},
+ {"KEYPAD_3", XK_KP_3},
+ {"KEYPAD_*", XK_KP_Multiply},
+ {"KEYPAD_0", XK_KP_0},
+ {"KEYPAD_-", XK_KP_Subtract},
+ {"BLANK_F10", XK_F10},
+ {"BLANK_F11", XK_F11},
+ {"KEYPAD_PERIOD", XK_KP_Decimal},
+ {"BLANK_F9", XK_F9},
+ {"KEYPAD_TAB", XK_KP_Tab},
+ {"BLANK_F12", XK_F12},
+ {"`", XK_quoteleft},
+ {"STOP", XK_Cancel},
+ {"ENTER", XK_Execute},
+ {"CLEAR_LINE", XK_ClearLine},
+ {"CLEAR_DISPLAY", XK_Clear},
+ {"-", XK_minus},
+ {"=", XK_equal},
+ {"INSERT_LINE", XK_InsertLine},
+ {"DELETE_LINE", XK_DeleteLine},
+ {"[", XK_bracketleft},
+ {"]", XK_bracketright},
+ {"\\", XK_backslash},
+ {"INSERT_CHAR", XK_InsertChar},
+ {"DELETE_CHAR", XK_DeleteChar},
+ {";", XK_semicolon},
+ {"'", XK_quoteright},
+ {"HOME_CURSOR", XK_Home},
+ {"PREV", XK_Prior},
+ {",", XK_comma},
+ {".", XK_period},
+ {"/", XK_slash},
+ {"SPACE_BAR", XK_space},
+ {".", XK_period},
+ {"CURSOR_LEFT", XK_Left},
+ {"CURSOR_DOWN", XK_Down},
+ {"CURSOR_UP", XK_Up},
+ {"CURSOR_RIGHT", XK_Right},
+ {"CONTROL_R", XK_Control_R},
+ {"META_R", XK_Meta_R},
+ {"META_L", XK_Meta_L},
+ {"SHIFT_R", XK_Shift_R},
+ {"SHIFT_L", XK_Shift_L},
+ {"CONTROL_L", XK_Control_L},
+ {"BREAK", XK_Break},
+ {"KP_4", XK_KP_4},
+ {"KP_8", XK_KP_8},
+ {"KP_5", XK_KP_5},
+ {"KP_9", XK_KP_9},
+ {"KP_6", XK_KP_6},
+ {"KP_7", XK_KP_7},
+ {"KP_SEPARATOR", XK_KP_Separator},
+ {"KP_ENTER", XK_KP_Enter},
+ {"KP_1", XK_KP_1},
+ {"KP_DIVIDE", XK_KP_Divide},
+ {"KP_2", XK_KP_2},
+ {"KP_ADD", XK_KP_Add},
+ {"KP_3", XK_KP_3},
+ {"KP_MULTIPLY", XK_KP_Multiply},
+ {"KP_0", XK_KP_0},
+ {"KP_SUBTRACT", XK_KP_Subtract},
+ {"B", XK_B},
+ {"V", XK_V},
+ {"C", XK_C},
+ {"X", XK_X},
+ {"Z", XK_Z},
+ {"ESCAPE", XK_Escape},
+ {"F10", XK_F10},
+ {"F11", XK_F11},
+ {"KP_DECIMAL", XK_KP_Decimal},
+ {"F9", XK_F9},
+ {"KP_TAB", XK_KP_Tab},
+ {"F12", XK_F12},
+ {"H", XK_H},
+ {"G", XK_G},
+ {"F", XK_F},
+ {"D", XK_D},
+ {"S", XK_S},
+ {"A", XK_A},
+ {"NOSYMBOL", 0},
+ {"CAPS_LOCK", XK_Caps_Lock},
+ {"U", XK_U},
+ {"Y", XK_Y},
+ {"T", XK_T},
+ {"R", XK_R},
+ {"E", XK_E},
+ {"W", XK_W},
+ {"Q", XK_Q},
+ {"TAB", XK_Tab},
+ {"7", XK_7},
+ {"6", XK_6},
+ {"5", XK_5},
+ {"4", XK_4},
+ {"3", XK_3},
+ {"2", XK_2},
+ {"1", XK_1},
+ {"QUOTELEFT", XK_quoteleft},
+ {"MENU", XK_Menu},
+ {"F4", XK_F4},
+ {"F3", XK_F3},
+ {"F2", XK_F2},
+ {"F1", XK_F1},
+ {"CANCEL", XK_Cancel},
+ {"EXECUTE", XK_Execute},
+ {"SYSTEM", XK_System},
+ {"F5", XK_F5},
+ {"F6", XK_F6},
+ {"F7", XK_F7},
+ {"F8", XK_F8},
+ {"CLEARLINE", XK_ClearLine},
+ {"CLEAR", XK_Clear},
+ {"8", XK_8},
+ {"9", XK_9},
+ {"0", XK_0},
+ {"MINUS", XK_minus},
+ {"EQUAL", XK_equal},
+ {"BACKSPACE", XK_BackSpace},
+ {"INSERTLINE", XK_InsertLine},
+ {"DELETELINE", XK_DeleteLine},
+ {"I", XK_I},
+ {"O", XK_O},
+ {"P", XK_P},
+ {"BRACKETLEFT", XK_bracketleft},
+ {"BRACKETRIGHT", XK_bracketright},
+ {"BACKSLASH", XK_backslash},
+ {"INSERTCHAR", XK_InsertChar},
+ {"DELETECHAR", XK_DeleteChar},
+ {"J", XK_J},
+ {"K", XK_K},
+ {"L", XK_L},
+ {"SEMICOLON", XK_semicolon},
+ {"QUOTERIGHT", XK_quoteright},
+ {"RETURN", XK_Return},
+ {"HOME", XK_Home},
+ {"PRIOR", XK_Prior},
+ {"M", XK_M},
+ {"COMMA", XK_comma},
+ {"PERIOD", XK_period},
+ {"SLASH", XK_slash},
+ {"SELECT", XK_Select},
+ {"NEXT", XK_Next},
+ {"N", XK_N},
+ {"SPACE", XK_space},
+ {"LEFT", XK_Left},
+ {"DOWN", XK_Down},
+ {"UP", XK_Up},
+ {"RIGHT", XK_Right},
+ {"GRAVE", XK_grave},
+ {"NUMBERSIGN", XK_numbersign},
+ {"KANJI", XK_Kanji},
+ {"GUILLEMOTLEFT", XK_guillemotleft},
+ {"EACUTE", XK_eacute},
+ {"PRINT", XK_Print},
+ {"ASCIICIRCUM", XK_asciicircum},
+ {"SCROLL_LOCK", XK_Scroll_Lock},
+ {"CEDILLA", XK_cedilla},
+ {"NUM_LOCK", XK_Num_Lock},
+#ifdef __apollo
+ {"APCHARDEL", apXK_CharDel},
+ {"REDO", XK_Redo},
+ {"APREAD", apXK_Read},
+ {"APEDIT", apXK_Edit},
+ {"APEXIT", apXK_Exit},
+ {"PAUSE", XK_Pause},
+ {"APCOPY", apXK_Copy},
+ {"APPASTE", apXK_Paste},
+ {"APGROW", apXK_Grow},
+ {"APLEFTBAR", apXK_LeftBar},
+ {"APCMD", apXK_Cmd},
+ {"APRIGHTBAR", apXK_RightBar},
+ {"DELETE", XK_Delete},
+ {"APLEFTBOX", apXK_LeftBox},
+ {"APRIGHTBOX", apXK_RightBox},
+ {"APOSTROPHE", XK_apostrophe},
+ {"APREPEAT", apXK_Repeat},
+ {"APPOP", apXK_Pop},
+ {"APUPBOX", apXK_UpBox},
+ {"APDOWNBOX", apXK_DownBox},
+#endif /* __apollo */
+ {"", 0}};
+
+#endif /* X_HILINIT_H */
diff --git a/xc/programs/Xserver/hw/hp/input/x_serialdrv.h b/xc/programs/Xserver/hw/hp/input/x_serialdrv.h
new file mode 100644
index 000000000..3f267f514
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/x_serialdrv.h
@@ -0,0 +1,185 @@
+/* $XConsortium: x_serialdrv.h,v 1.3 95/01/24 23:37:51 gildea Exp $ */
+/************************************************************
+Copyright (c) 1992 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+/***************************************************************************
+ *
+ * Constants and structs for dynamically loaded serial input device drivers.
+ *
+ */
+
+#ifndef _X_SERIALDRV_H_
+#define _X_SERIALDRV_H_
+#include <dl.h>
+
+#define X_KEYMAP_NAME "/etc/kbdlang"
+#define MIN_KEYCODE 8
+#define MAX_NM 64
+#define DATA_IS_8_BITS 0x01
+#define DATA_IS_16_BITS 0x02
+#define DATA_IS_32_BITS 0x04
+#define REPORTS_PROXIMITY 0x08
+#define ABSOLUTE_DATA 0x040
+#define NON_CONTIGUOUS_DATA 0x080
+#define FALSE 0
+#define TRUE 1
+#define KEY_DATA 0x01
+#define BUTTON_DATA 0x02
+#define PROXIMITY_DATA 0x04
+#define MOTION_DATA 0x08
+#define INIT_SUCCESS 0
+#define INIT_FAILURE 1
+#define READ_SUCCESS 0
+#define READ_FAILURE 1
+#define WRITE_SUCCESS 0
+#define WRITE_FAILURE 1
+#define CLOSE_SUCCESS 0
+#define IN_PROXIMITY 0
+#define OUT_OF_PROXIMITY 1
+
+#define SCROLLLOCK_LED (1 << 0)
+#define NUMLOCK_LED (1 << 1)
+#define CAPSLOCK_LED (1 << 2)
+
+#define _XSetDeviceMode 0
+#define _XSetDeviceValuators 1
+#define _XChangeDeviceControl 2
+#define _XChangeFeedbackControl 3
+#define _XChangeKeyboardControl 4
+#define _XChangePointerControl 5
+#define _XBell 6
+
+typedef struct {
+ int class;
+ int bell_percent;
+} HPBell;
+
+typedef struct {
+ int class;
+ int led_mask;
+ int led_values;
+} HPLedFeedbackControl;
+
+typedef struct {
+ int class;
+ int click;
+ int bell_percent;
+ int bell_pitch;
+ int bell_duration;
+ int autoRepeat;
+ unsigned char autoRepeats[32];
+ int leds;
+} HPKeyboardFeedbackControl;
+
+typedef struct {
+ int class;
+ int num;
+ int den;
+ int threshold;
+} HPPointerFeedbackControl;
+
+typedef struct {
+ int class;
+ int resolution;
+ int min_value;
+ int max_value;
+ int integer_displayed;
+} HPIntegerFeedbackControl;
+
+typedef struct {
+ int max_symbols;
+ int num_symbols_supported;
+ int *symbols_supported;
+} HPStrF;
+
+typedef struct {
+ int class;
+ int max_symbols;
+ int num_symbols_supported;
+ int num_symbols_displayed;
+ int *symbols_supported;
+ int *symbols_displayed;
+} HPStringFeedbackControl;
+
+typedef struct {
+ int class;
+ int percent;
+ int pitch;
+ int duration;
+} HPBellFeedbackControl;
+
+typedef struct {
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+} HPValuatorControl;
+
+typedef struct {
+ int *resolutions;
+ int first_valuator;
+ int num_valuators;
+} HPResolutionControl;
+
+typedef int (*pfrb)();
+typedef int (*ConfigureProc)();
+typedef int (*InitProc)();
+typedef int (*ReadProc)();
+typedef int (*WriteProc)();
+typedef int (*CloseProc)();
+
+typedef struct _SerialProcs
+ {
+ ConfigureProc configure; /* filled in by driver */
+ ReadProc read; /* filled in by driver */
+ WriteProc write; /* filled in by driver */
+ CloseProc close; /* filled in by driver */
+ } SerialProcs;
+
+typedef struct _HPInputDeviceHeader
+ {
+ char path[MAX_NM]; /* device path - filled in by X server */
+ char *x_name; /* device name */
+ char *keymap_name; /* keymap name, if device has keys */
+ char *keymap_file; /* keymap file, if device has keys */
+ int resolution; /* resolution in counts/cm */
+ int max_x; /* maximum x value in counts */
+ int max_y; /* maximum y value in counts */
+ int file_ds; /* file descriptor */
+ int num_fdbk; /* length of list that follows */
+ u_char *feedbacks; /* kbd, ptr, bell, and integer feedbacks*/
+ int num_ledf; /* length of list that follows */
+ u_char *ledf; /* led feedbacks */
+ int num_strf; /* length of list that follows */
+ HPStrF *strf; /* string feedbacks */
+ u_char flags; /* device characteristics */
+ u_char ax_num; /* number of axes */
+ u_char num_buttons; /* number of buttons */
+ u_char num_keys; /* number of keys */
+ u_char min_kcode; /* minimum keycode */
+ u_char max_kcode; /* maximum keycode */
+ u_char reset; /* keycode to cause X server reset */
+ u_char reset_mods; /* mask of modifiers for server reset */
+ u_char button_chording;/* interval (ms) if chording enabled */
+ u_char reserved[8]; /* reserved for future use */
+ }HPInputDeviceHeader;
+#endif /* _X_SERIALDRV_H_ */
diff --git a/xc/programs/Xserver/hw/hp/input/xtest1imp.c b/xc/programs/Xserver/hw/hp/input/xtest1imp.c
new file mode 100644
index 000000000..c2515cf2a
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/input/xtest1imp.c
@@ -0,0 +1,281 @@
+/* $TOG: xtest1imp.c /main/4 1998/02/10 13:11:24 kaleb $ */
+/*
+ * File: xtest1dd.c
+ *
+ * This file contains the device dependent parts of the input
+ * synthesis extension.
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the
+suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+/***************************************************************
+ * include files
+ ***************************************************************/
+
+#define NEED_EVENTS
+#define NEED_REPLIES
+
+#include <stdio.h>
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#define XTestSERVER_SIDE
+#include "xtestext1.h"
+/*
+ * the following include files are specific to HP's implementation
+ * of the extension. Your implementation may vary.
+ */
+#include "hildef.h"
+#include "hpext.h"
+#include "XHPproto.h"
+
+/*
+ * The following externs are specific to HP's implementation
+ * of the extension. Your implementation may vary.
+ */
+extern ScreenInfo screenInfo;
+extern InputInfo inputInfo;
+extern HPInputDevice *hpPointer, *hpKeyboard;
+
+/******************************************************************************
+ *
+ * XTestGetPointerPos
+ *
+ * Return the position of the mouse.
+ *
+ */
+void
+XTestGetPointerPos(fmousex, fmousey)
+ short *fmousex, *fmousey;
+ {
+ *fmousex = hpPointer->coords[0];
+ *fmousey = hpPointer->coords[1];
+ }
+
+/******************************************************************************
+ *
+ * XTestJumpPointer
+ *
+ * Tell the server to move the mouse.
+ *
+ * This is implementation-dependent. Your implementation may vary.
+ */
+void
+XTestJumpPointer(jx, jy, dev_type)
+/*
+ * the x and y position to move the mouse to
+ */
+int jx;
+int jy;
+/*
+ * which device is supposed to move (ignored)
+ */
+int dev_type;
+{
+ int xdiff, screensize;
+ ScreenPtr pScreen = hpPointer->pScreen;
+ xEvent *format_ev(), *ev;
+ extern xHPEvent xE;
+ int coords[MAX_AXES];
+
+ /*
+ * move the mouse.
+ * The kludge below is an attempt to make it possible to
+ * test stacked screens mode. Xtm records absolute screen
+ * positions, so we have trouble knowing whether or not the
+ * screen changed. We make an arbitrary assumption here that
+ * if we moved more than 500 pixels in the x direction that
+ * we must have wrapped from one screen to another. This is
+ * a fairly safe assumption unless someone set the mouse
+ * acceleration to some unreasonably large number.
+ *
+ * In any case, translate the absolute postions into a relative
+ * move from the current pointer position, and pass that
+ * relative move to process_motion.
+ */
+ xdiff = jx - hpPointer->coords[0];
+ if (abs(xdiff) > 500 && screenInfo.numScreens > 1)
+ {
+ if (xdiff > 0)
+ {
+ if (pScreen->myNum != 0)
+ screensize = screenInfo.screens[pScreen->myNum-1]->width;
+ else
+ screensize = screenInfo.screens[screenInfo.numScreens-1]->width;
+ xdiff -= screensize;
+ }
+ else
+ xdiff += pScreen->width;
+ }
+ coords[0] = xdiff;
+ coords[1] = jy - hpPointer->coords[1];
+ process_motion (inputInfo.pointer, hpPointer, hpPointer, coords);
+ ev = format_ev (inputInfo.pointer, MotionNotify, 0, GetTimeInMillis(), hpPointer, NULL);
+ ProcessInputEvents();
+}
+
+/******************************************************************************
+ *
+ * XTestGenerateEvent
+ *
+ * Send a key/button input action to the server to be processed.
+ *
+ * This is implementation-dependent. Your implementation may vary.
+ */
+void
+XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
+/*
+ * which device supposedly performed the action
+ */
+int dev_type;
+/*
+ * which key/button moved
+ */
+int keycode;
+/*
+ * whether the key/button was up or down
+ */
+int keystate;
+/*
+ * the x and y position of the locator when the action happenned
+ */
+int mousex;
+int mousey;
+{
+ DeviceIntPtr dev;
+ HPInputDevice *tmp_ptr;
+ xEvent *format_ev(), *ev;
+
+ /*
+ * the server expects to have the x and y position of the locator
+ * when the action happened placed in hpPointer.
+ */
+ if (dev_type == MOUSE)
+ {
+ dev = inputInfo.pointer;
+ hpPointer->coords[0] = mousex;
+ hpPointer->coords[1] = mousey;
+ tmp_ptr = hpPointer;
+ }
+ else
+ {
+ dev = inputInfo.keyboard;
+ hpPointer->coords[0] = mousex;
+ hpPointer->coords[1] = mousey;
+ tmp_ptr = hpKeyboard;
+ }
+ /*
+ * convert the keystate back into server-dependent state values
+ */
+ if (keycode < 8 )
+ {
+ /*
+ * if keycode < 8, this is really a button.
+ */
+ if (keystate == XTestKEY_UP)
+ {
+ keystate = ButtonRelease;
+ }
+ else
+ {
+ keystate = ButtonPress;
+ }
+ }
+ else
+ {
+ if (keystate == XTestKEY_UP)
+ {
+ keystate = KeyRelease;
+ }
+ else
+ {
+ keystate = KeyPress;
+ }
+ }
+ /*
+ * Tell the server to process all of the events in its input queue.
+ * This makes sure that there is room in the server's input queue
+ * for a key/button input event.
+ */
+ ProcessInputEvents();
+ /*
+ * put a key/button input action into the servers input event queue
+ */
+ ev = format_ev (dev, keystate, keycode, GetTimeInMillis(), tmp_ptr, NULL);
+ /*
+ * Tell the server to process all of the events in its input queue.
+ * This makes sure that key/button event we just put in the queue
+ * is processed immediately.
+ */
+ ProcessInputEvents();
+}
+
+/******************************************************************************
+ *
+ * check_for_motion_steal
+ *
+ * Called from xosMoveMouse.
+ */
+
+check_for_motion_steal (hotX, hotY)
+ register int hotX, hotY;
+ {
+#ifdef XTESTEXT1
+ extern int on_steal_input; /* defined in xtestext1di.c */
+ extern short xtest_mousex; /* defined in xtestext1di.c */
+ extern short xtest_mousey; /* defined in xtestext1di.c */
+
+ if ((on_steal_input) &&
+ ((hotX != xtest_mousex) || (hotY != xtest_mousey))) /* mouse moved */
+ {
+ XTestStealMotionData((hotX - xtest_mousex),
+ (hotY - xtest_mousey),
+ MOUSE,
+ xtest_mousex,
+ xtest_mousey);
+ }
+#endif /* XTESTEXT1 */
+ }
+
diff --git a/xc/programs/Xserver/hw/hp/ngle/Imakefile b/xc/programs/Xserver/hw/hp/ngle/Imakefile
new file mode 100644
index 000000000..267905027
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/Imakefile
@@ -0,0 +1,46 @@
+/* $XConsortium: Imakefile /main/7 1996/09/28 17:12:41 rws $ */
+#include <Server.tmpl>
+
+ORIG_SRCS = nglescreen.c \
+ nglecolormap.c \
+ nglecursor.c \
+ nglenoop.c \
+ hyperScrn.c
+
+ORIG_OBJS = nglescreen.o \
+ nglecolormap.o \
+ nglecursor.o \
+ nglenoop.o \
+ hyperScrn.o
+
+#ifdef HPFastScrolling
+SCROLLING_SRC = nglecopy.c \
+ ngleblt.c
+
+SCROLLING_OBJ = nglecopy.o \
+ ngleblt.o \
+ ngledoblt.o
+
+FAST_SCROLLING_DEFINES = -DHP_FAST_SCROLLING
+#endif
+
+SRCS = $(ORIG_SRCS) $(SCROLLING_SRC)
+
+OBJS = $(ORIG_OBJS) $(SCROLLING_OBJ)
+
+DEFINES = $(FAST_SCROLLING_DEFINES) ExtensionOSDefines
+
+INCLUDES = -I. -I.. -I../include -I../../../mfb -I../../../cfb -I../../../mi \
+ -I../../../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \
+ -I$(FONTINCSRC)
+
+LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/4.2bsd/llib-los.ln \
+ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln ../../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+NormalRelocatableTarget(ngle,$(OBJS))
+
+LinkFile(ngledoblt.o,ngledoblt.o.8.07)
+
+DependTarget()
diff --git a/xc/programs/Xserver/hw/hp/ngle/dregs.h b/xc/programs/Xserver/hw/hp/ngle/dregs.h
new file mode 100644
index 000000000..afbd308da
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/dregs.h
@@ -0,0 +1,123 @@
+/* $XConsortium: dregs.h,v 1.3 95/01/24 01:54:12 dpw Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+ HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *************************************************************************/
+
+typedef union {
+ long int lheight;
+ long int ly;
+ struct {
+ short int x;
+ short int y;
+ } xy;
+ struct {
+ short int width;
+ short int height;
+ } wh;
+ unsigned long int all;
+ struct {
+ unsigned short int high;
+ unsigned short int low;
+ } w;
+ struct {
+ char b0;
+ char b1;
+ char b2;
+ char b3;
+ } b;
+} dreg_cplx_t;
+
+
+typedef volatile struct {
+ long int pad1[70];
+ unsigned long int reg1;
+ long int pad2[193];
+ unsigned long int reg28;
+ long int pad24[23];
+ unsigned long int reg2;
+ long int pad3[7];
+ unsigned long int reg3;
+ long int pad4[63];
+ unsigned long int reg22;
+ long int pad5[7];
+ unsigned long int reg23;
+ long int pad6[15];
+ unsigned long int reg4;
+ long int pad7[39];
+ unsigned long int reg5;
+ long int pad8[87];
+ dreg_cplx_t reg6;
+ dreg_cplx_t reg7;
+ dreg_cplx_t reg24;
+ long int pad9[5];
+ unsigned long int reg8;
+ long int pad10[72];
+ dreg_cplx_t reg37;
+ long int pad13[47];
+ dreg_cplx_t reg9;
+ long int pad10a[62];
+ dreg_cplx_t reg25;
+ long int pad11[23871];
+ unsigned long int reg10;
+ unsigned long int reg11;
+ long int pad12[1];
+ unsigned long int reg12;
+ unsigned long int reg35;
+ unsigned long int reg36;
+ unsigned long int reg13;
+ dreg_cplx_t reg14;
+ long int pad15[499704];
+ dreg_cplx_t reg15;
+ dreg_cplx_t reg16;
+ dreg_cplx_t reg34;
+ long int pad17[61];
+ dreg_cplx_t reg17;
+ dreg_cplx_t reg18;
+ long int pad18[4];
+ unsigned long int reg26;
+ long int pad19[57];
+ dreg_cplx_t reg19;
+ long int pad20[1];
+ dreg_cplx_t reg20;
+ long int pad21[3];
+ dreg_cplx_t reg21;
+ long int pad22[59];
+ dreg_cplx_t reg27;
+ long int pad23[16189];
+ dreg_cplx_t reg29;
+ unsigned long int reg30;
+ unsigned long int reg31;
+ long int pad25[5];
+ unsigned long int reg38;
+ unsigned long int reg41;
+ unsigned long int reg42;
+ unsigned long int reg43;
+ unsigned long int reg44;
+ unsigned long int reg45;
+ long int pad26[1];
+ unsigned long int reg32;
+ unsigned long int reg33;
+ long int pad27[55];
+ unsigned long int reg39;
+ long int pad28[3];
+ unsigned long int reg40;
+} ngle_dregs_t;
diff --git a/xc/programs/Xserver/hw/hp/ngle/hyperScrn.c b/xc/programs/Xserver/hw/hp/ngle/hyperScrn.c
new file mode 100644
index 000000000..b4fba01ec
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/hyperScrn.c
@@ -0,0 +1,266 @@
+/* $XConsortium: hyperScrn.c,v 1.1 95/01/25 16:14:36 gildea Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains various global variables and routines concerning
+ * the Screen structure. This includes the ngleScreenInit routine.
+ *
+ ******************************************************************************/
+
+
+#include "ngle.h"
+
+Bool hyperResetPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 serverState);
+
+static void hyperUndoITE(
+ NgleScreenPrivPtr pScreenPriv);
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: hyperResetPlanes
+ *
+ * Description:
+ *
+ * This routine implements pNgleScreenInit->InitPlanes and
+ * pScreenPriv->ngleResetPlanes. It resets the image, overlay
+ * and attribute planes to a known state. This includes doing
+ * what is necessary to counteract what the ITE has done as well
+ * as supporting friendly boot operation.
+ *
+ * Assumptions:
+ *
+ * - default colormap has already been initialized and installed
+ * - fast-locking has been initialized.
+ *
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+Bool hyperResetPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 serverState)
+{
+ NgleHdwPtr pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+ Card32 controlPlaneReg;
+ Card32 planeEnableMask;
+
+
+ NGLE_LOCK(pScreenPriv);
+
+ if (IS_24_DEVICE(pScreenPriv))
+ if (pScreenPriv->devDepth == 24)
+ controlPlaneReg = 0x04000F00;
+ else
+ controlPlaneReg = 0x00000F00; /* 0x00000800 should be enought, but lets clear all 4 bits */
+ else
+ controlPlaneReg = 0x00000F00; /* 0x00000100 should be enought, but lets clear all 4 bits */
+
+ switch(serverState)
+ {
+ case SERVER_INIT:
+ /**************************************************
+ ** Need to clear screen
+ **************************************************/
+ if (IS_24_DEVICE(pScreenPriv))
+ ngleDepth24_ClearImagePlanes(pScreenPriv);
+ else
+ ngleDepth8_ClearImagePlanes(pScreenPriv);
+
+ /* Paint attribute planes for default case.
+ * On Hyperdrive, this means all windows using overlay cmap 0.
+ */
+ ngleResetAttrPlanes(pScreenPriv, controlPlaneReg);
+
+ /* Clear overlay planes:
+ *
+ * If on Hyperdrive and doing Friendly Boot, we want a smooth
+ * transition when VUE starts up. There are 3 cases to worry
+ * about: 1) If only the friendly boot slate is visible on the
+ * screen and ITE console messages are not, then we need to clear
+ * the text planes so that the ITE messages don't flash on screen.
+ * This will create a smooth transition when the vuelogin window
+ * appears. 2) If only ITE console messages are visible and the
+ * friendly boot slate is not, then we need to clear the planes
+ * containing the slate. 3) If both the friendly boot slate and
+ * ITE console messages are visible, then we don't need to bother
+ * clearing any of the overlay planes.
+ *
+ * Side note: The above is correct if the default visual is in
+ * the overlays. If the default visual is in the image planes,
+ * then clear all of the overlay planes to prevent color flashing
+ * of slate which will happen when smooth cmap is installed in
+ * overlays.
+ *
+ * STI uses the upper 5 overlay planes for the friendly boot slate
+ * and the lower 3 overlay planes for ITE console messages. These
+ * planes are enabled/disabled via the FDR register on Marathon.
+ */
+
+ if ( pScreenPriv->myNum == 0 && pScreenPriv->devDepth == 8 )
+ { /* isDefaultVisualInOverlays == TRUE */
+ SETUP_HW(pDregs); /* Wait for hw to be ready */
+ planeEnableMask = NGLE_READ32(pDregs->reg32);
+
+ if ((planeEnableMask & 0xffff0000) == 0xf8f80000)
+ {
+ /* only slate is visible so need to clear text planes */
+ ngleClearOverlayPlanes(pScreenPriv, 0x7, 0);
+ }
+ else if ((planeEnableMask & 0xffff0000) == 0x07070000)
+ {
+ /* only text is visible so need to clear slate planes */
+ ngleClearOverlayPlanes(pScreenPriv, 0xf8, 0);
+ }
+ /* else if ((planeEnableMask & 0xffff0000) == 0xffff0000) */
+ /* both slate and text are visible so clear isn't necessary */
+ }
+ else
+ {
+ /* Not in friendly boot mode and/or default visual is
+ * in image planes so clear all overlay planes
+ */
+ ngleClearOverlayPlanes(pScreenPriv, 0xff, 255);
+ }
+
+ /**************************************************
+ ** Also need to counteract ITE settings
+ **************************************************/
+ hyperUndoITE(pScreenPriv);
+ break;
+
+ case SERVER_EXIT:
+ /**************************************************
+ ** Need to clear screen
+ **************************************************/
+ if (IS_24_DEVICE(pScreenPriv))
+ ngleDepth24_ClearImagePlanes(pScreenPriv);
+ else
+ ngleDepth8_ClearImagePlanes(pScreenPriv);
+ ngleResetAttrPlanes(pScreenPriv, controlPlaneReg);
+ ngleClearOverlayPlanes(pScreenPriv, 0xff, 0);
+ break;
+
+ case SERVER_RECOVERY:
+ /**************************************************
+ ** Need to counteract ITE settings
+ **************************************************/
+ hyperUndoITE(pScreenPriv);
+
+ /**************************************************
+ * Reset attribute planes to known state
+ **************************************************/
+ ngleResetAttrPlanes(pScreenPriv, controlPlaneReg);
+ break;
+ }
+
+ NGLE_UNLOCK(pScreenPriv);
+
+ return(TRUE);
+
+} /* hyperResetPlanes */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: hyperUndoITE
+ *
+ * Description:
+ *
+ * This local routine counteracts what the ITE has done on
+ * Hyperdrive.
+ *
+ * STI uses the upper 5 overlay planes for the friendly boot slate
+ * and the lower 3 overlay planes for ITE console messages. These
+ * planes are enabled/disabled via the FDR register on Marathon.
+ *
+ * ITE has set transparency enable mask to a non-zero
+ * value. Make sure that it's set to zero. Method is per
+ * Curtis McAllister.
+ *
+ * Before clearing the transparency, write zeroes to the overlay
+ * planes (to avoid flashing display of colors that are no longer
+ * transparent).
+ *
+ * Assumptions:
+ *
+ * Assumes fast-locking has been initialized.
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+static void hyperUndoITE(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+ Int32 nFreeFifoSlots = 0;
+ Card32 fbAddr;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ NGLE_LOCK(pScreenPriv);
+
+
+ /**********************************************
+ * Display enable all overlay planes
+ **********************************************/
+
+ /*
+ * On Hyperdrive, plane enable done via FDR register on Marathon.
+ * Enable all planes (image and overlay).
+ */
+ GET_FIFO_SLOTS(nFreeFifoSlots,1);
+ NGLE_WRITE32(pDregs->reg32,0xffffffff);
+
+
+ /**********************************************
+ * Write overlay transparency mask so only entry 255 is transparent
+ **********************************************/
+
+ /* Hardware setup for full-depth write to "magic" location */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 7);
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA(IndexedDcd, Otc04, Ots08, AddrLong,
+ BAJustPoint(0), BINovly, BAIndexBase(0)));
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(
+ IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(FALSE),
+ DataDynamic, MaskOtc, BGx(FALSE), FGx(FALSE)));
+
+ /* Now prepare to write to the "magic" location */
+ fbAddr = (Card32) NGLE_LONG_FB_ADDRESS(0, 1532, 0);
+ NGLE_BINC_SET_DSTADDR(fbAddr);
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(0xffffff);
+ NGLE_BINC_SET_DSTMASK(~0UL);
+
+ /* Finally, write a zero to clear the mask */
+ NGLE_BINC_WRITE32(0);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+} /* hyperUndoITE */
diff --git a/xc/programs/Xserver/hw/hp/ngle/ngle.h b/xc/programs/Xserver/hw/hp/ngle/ngle.h
new file mode 100644
index 000000000..c8784baf0
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/ngle.h
@@ -0,0 +1,121 @@
+/* $XConsortium: ngle.h,v 1.3 95/01/24 01:55:45 dpw Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+#ifndef NGLE_H
+#define NGLE_H
+
+/* Rummor has it that NDEBUG is defined by default in X build environment.
+ * It is used to activate assert statements (see /usr/include/assert.h).
+ * Compiling with the preprocessor option -DNDEBUG (see cpp(1)), or with
+ * the preprocessor control statement #define NDEBUG ahead of the
+ * #include <assert.h> statement, stops assertions from being compiled
+ * into the program.
+ */
+
+#include <unistd.h> /* keys off _[POSIX|HPUX|XOPEN]_SOURCE */
+#include <stdlib.h> /* For prototype of getenv() */
+#include <stdio.h>
+#include <errno.h>
+#include <assert.h> /* For assert() statements */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <sys/framebuf.h>
+#include <fcntl.h>
+
+#include "X.h"
+#include "Xproto.h"
+
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "colormapst.h"
+#include "resource.h"
+#include "opaque.h"
+
+/* included for the mi private structure */
+#include "mibstorest.h"
+
+#ifndef Card32
+#define Card32 unsigned int
+#endif
+#ifndef Int32
+#define Int32 int
+#endif
+
+#ifndef Card16
+#define Card16 unsigned short
+#endif
+#ifndef Int16
+#define Int16 short
+#endif
+
+#ifndef Card8
+#define Card8 unsigned char
+#endif
+#ifndef Int8
+#define Int8 char
+#endif
+
+#include "ngleextern.h"
+#include "dregs.h"
+#include "ngledevrom.h"
+#include "nglehdw.h"
+#include "nglecursor.h"
+#include "nglecopy.h"
+#include "nglecolormap.h"
+#include "nglenoop.h"
+#include "hppriv.h"
+#include "nglescreen.h"
+
+
+# ifndef S9000_ID_TIMBER /* Bushmaster (710) Graphics */
+# define S9000_ID_TIMBER 0x27F12392
+# endif
+
+# ifndef S9000_ID_TOMCAT /* 2-headed ELK */
+# define S9000_ID_TOMCAT 0x27FCCB6D
+# endif
+
+# ifndef CRX24_OVERLAY_PLANES /* Overlay planes on CRX24 */
+# define CRX24_OVERLAY_PLANES 0x920825AA
+# endif
+
+# ifndef S9000_ID_ARTIST /* Artist (Gecko/712 & 715) Graphics */
+# define S9000_ID_ARTIST 0x2B4DED6D
+# endif
+
+# ifndef S9000_ID_HCRX /* hyperdrive Graphics */
+# define S9000_ID_HCRX 0x2BCB015A
+# endif
+
+#define hpGivingUp (dispatchException & DE_TERMINATE)
+
+#define MAX_BITS_PER_RGB 8 /* The maximum number of bits that any
+ of the DACs have on our hardware. */
+
+#endif /* NGLE_H */
diff --git a/xc/programs/Xserver/hw/hp/ngle/ngleblt.c b/xc/programs/Xserver/hw/hp/ngle/ngleblt.c
new file mode 100644
index 000000000..f47796239
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/ngleblt.c
@@ -0,0 +1,96 @@
+/* $XConsortium: ngleblt.c,v 1.1 93/08/08 12:56:35 rws Exp $ */
+
+/*
+****************************************************************************
+** DDX WINDOW ROUTINES
+**
+** (c) Copyright Hewlett-Packard Company, 1992.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+**
+****************************************************************************
+*/
+
+#include "ngle.h"
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleBitBlt
+ *
+ * Description:
+ *
+ * This is HP's version of the cfbDoBitBltCopy() routine. This enables
+ * fast scrolling.
+ *
+ ******************************************************************************/
+void ngleBitBlt (
+
+ DrawablePtr pSrcDraw,
+ DrawablePtr pDstDraw,
+ int alu,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planeMask)
+{
+ BoxPtr pbox;
+ int nbox;
+ NgleScreenPrivPtr pScreenPriv;
+ NgleHdwPtr pDregs;
+
+ /* get pointers so HP's private structures */
+ pScreenPriv = NGLE_SCREEN_PRIV(pDstDraw->pScreen);
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+
+ /* get a pointer and count of the boxes */
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ /* call the hardware blt routine for each box, but first set up the
+ * hardware
+ */
+ SETUP_COPYAREA(pDregs);
+
+ if (pScreenPriv->devDepth == 24)
+ /* do the if statement at this level for performance reasons */
+ {
+ while (nbox--)
+ {
+ ngleDepth24_CopyAreaFromToScreen(pSrcDraw, pDstDraw,
+ pptSrc->x, pptSrc->y, pbox, alu, planeMask);
+
+ pbox++;
+ pptSrc++;
+ }
+ }
+ else
+ {
+ while (nbox--)
+ {
+ ngleDepth8_CopyAreaFromToScreen(pSrcDraw, pDstDraw,
+ pptSrc->x, pptSrc->y, pbox, alu, planeMask);
+
+ pbox++;
+ pptSrc++;
+ }
+ }
+
+ /* Now restore the hardware state so the CFB driver can use it */
+ SETUP_FB(pDregs, pScreenPriv->deviceID,pScreenPriv->devDepth);
+}
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecolormap.c b/xc/programs/Xserver/hw/hp/ngle/nglecolormap.c
new file mode 100644
index 000000000..8918fae76
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecolormap.c
@@ -0,0 +1,795 @@
+/* $TOG: nglecolormap.c /main/3 1997/10/16 16:26:56 kaleb $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * DDX entry points relating to color for NGLE driver:
+ *
+ * ngleLoadCursorColormap()
+ * ngleCreateDefColormap()
+ * ngleCreateColormap()
+ * ngleInstallColormap()
+ * ngleStoreColors()
+ * ngleListInstalledColormaps()
+ * ngleUninstallColormap()
+ * ngleDestroyColormap()
+ *
+ ******************************************************************************/
+
+#include "ngle.h"
+
+extern NgleLutBltCtl setNgleLutBltCtl(
+ Card32 deviceID,
+ Int32 devDepth,
+ Card32 offsetWithinLut,
+ Card32 length); /* #entries to update */
+
+extern NgleLutBltCtl setHyperLutBltCtl(
+ Card32 deviceID,
+ Int32 devDepth,
+ Card32 offsetWithinLut,
+ Card32 length); /* #entries to update */
+
+/* Gray Scale support: calculate intensity from rgb using NTSC weights */
+#define CALCULATE_GRAYSCALE_INTENSITY(intensity, red8, grn8, blu8) \
+{ \
+ intensity = (Card8) \
+ ( (float) ((red8) & 0xff) * 0.30 \
+ + (float) ((grn8) & 0xff) * 0.59 \
+ + (float) ((blu8) & 0xff) * 0.11 \
+ ); \
+ intensity &= 0xff; \
+}
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleLoadCursorColormap()
+ *
+ * Description:
+ *
+ * This routine is called by ngleDisplayCursor and ngleRecolorCursor
+ * to load into the NGLE hardware the 2-entry colormap for cursors.
+ *
+ * This procedure is internal to the NGLE driver: it is not
+ * called from outside the driver, neither directly nor indirectly
+ * through a procedure table.
+ *
+ ******************************************************************************/
+
+void ngleLoadCursorColormap(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ Card32 color;
+ Card8 intensity;
+
+
+ /* Set up for drawing to the off-screen colormap table */
+ START_CURSOR_COLORMAP_ACCESS(pDregs);
+
+ /* X11 stores each R/G/B of a color in unsigned shorts (16 bits).
+ * Scale to 8 bits and place in lower 24 bits of color.
+ */
+ if (pScreenPriv->isGrayScale)
+ {
+ CALCULATE_GRAYSCALE_INTENSITY(intensity,
+ (pCursor->backRed >> 8),
+ (pCursor->backGreen >> 8),
+ (pCursor->backBlue >> 8));
+ /* Replicate intensity to red, green, and blue */
+ color = (Card32)
+ ( (intensity << 16)
+ | (intensity << 8)
+ | intensity
+ );
+ WRITE_CURSOR_COLOR(pDregs,color);
+
+ CALCULATE_GRAYSCALE_INTENSITY(intensity,
+ (pCursor->foreRed >> 8),
+ (pCursor->foreGreen >> 8),
+ (pCursor->foreBlue >> 8));
+ /* Replicate intensity to red, green, and blue */
+ color = (Card32)
+ ( (intensity << 16)
+ | (intensity << 8)
+ | intensity
+ );
+ WRITE_CURSOR_COLOR(pDregs,color);
+ }
+ else
+ {
+ color = ( ((Card32) (pCursor->backRed & 0xff00) << 8)
+ | (Card32) (pCursor->backGreen & 0xff00)
+ | (Card32) (pCursor->backBlue >> 8)
+ );
+ WRITE_CURSOR_COLOR(pDregs,color);
+
+ color = ( ((Card32) (pCursor->foreRed & 0xff00) << 8)
+ | (Card32) (pCursor->foreGreen & 0xff00)
+ | (Card32) (pCursor->foreBlue >> 8));
+ WRITE_CURSOR_COLOR(pDregs,color);
+ }
+
+ FINISH_CURSOR_COLORMAP_ACCESS(pDregs,pScreenPriv->deviceID,
+ pScreenPriv->devDepth);
+
+} /* ngleLoadCursorColormap() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleCreateDefColormap
+ *
+ * Description: Create a default colormap for the given screen's root window.
+ *
+ * Called by: DDX procedure ngleScreenInit
+ *
+ * Creates default colormap, initializes all of its entries,
+ * installs it into hardware, then points pScreen->defColormap to it.
+ *
+ ******************************************************************************/
+
+Bool
+ngleCreateDefColormap(
+ ScreenPtr pScreen)
+{
+ VisualPtr pVisual;
+ ColormapPtr pColormap;
+ unsigned short red_zero = 0, red_ones = ~0;
+ unsigned short green_zero = 0, green_ones = ~0;
+ unsigned short blue_zero = 0, blue_ones = ~0;
+
+ /* Scan the table of visuals for this screen, looking for the
+ * rootVisual.
+ */
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++)
+ ;
+
+ /* Create a colormap, not allocating (reserving) any entries. */
+ if (CreateColormap (pScreen->defColormap, pScreen, pVisual,
+ &pColormap, AllocNone, 0) != Success)
+ {
+ return FALSE;
+ }
+
+ /* Reserve entries for black and white */
+ if (AllocColor (pColormap, &red_zero, &green_zero, &blue_zero,
+ &(pScreen->blackPixel), 0)
+ || AllocColor(pColormap, &red_ones, &green_ones, &blue_ones,
+ &(pScreen->whitePixel), 0))
+ {
+ FatalError("Unable to reserve black and white pixels.\n");
+ }
+
+ /* Install initialized colormap as default into hardware. */
+ ngleInstallColormap(pColormap);
+
+ return(TRUE);
+} /* ngleCreateDefColormap() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleCreateColormap()
+ *
+ * Description: Perform device-specific initialization of new colormap.
+ *
+ * Entry: pmap points to the colormap in question
+ *
+ * Return Value: None
+ *
+ * Called by: DIX CreateColormap
+ *
+ ******************************************************************************/
+
+Bool
+ngleCreateColormap(
+ ColormapPtr pmap)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pmap->pScreen);
+ xColorItem localColor;
+ int i;
+ VisualPtr pVisual = pmap->pVisual;
+
+ localColor.flags = DoRed | DoGreen | DoBlue;
+
+ if (pVisual->class == DirectColor )
+ {
+ for (i = 0; i < pVisual->ColormapEntries; i++)
+ {
+ localColor.pixel = i << pVisual->offsetBlue
+ | i << pVisual->offsetGreen
+ | i << pVisual->offsetRed;
+
+ localColor.red = pmap->red[i].co.local.red = i << 8;
+ localColor.green = pmap->green[i].co.local.green = i << 8;
+ localColor.blue = pmap->blue[i].co.local.blue = i << 8;
+
+ ngleStoreColors(pmap, 1, &localColor);
+ }
+ }
+ else if (pVisual->class == PseudoColor )
+ {
+ if (pScreenPriv->isGrayScale)
+ {
+ for(i = 0; i < pVisual->ColormapEntries; i++)
+ {
+ localColor.pixel = i;
+ localColor.red = pmap->red[i].co.local.red = i << 8;
+ localColor.green = pmap->red[i].co.local.green = i << 8;
+ localColor.blue = pmap->red[i].co.local.blue = i << 8;
+
+ ngleStoreColors(pmap, 1, &localColor);
+ }
+ }
+ else
+ {
+ for(i = 0; i < pVisual->ColormapEntries; i++)
+ {
+ localColor.pixel = i;
+ localColor.red = pmap->red[i].co.local.red = (i & 0x7) << 13;
+ localColor.green = pmap->red[i].co.local.green = (i & 0x38) << 10;
+ localColor.blue = pmap->red[i].co.local.blue = (i & 0xc0) << 8;
+
+ ngleStoreColors(pmap, 1, &localColor);
+ }
+ }
+ }
+ else
+ {
+ ErrorF("ngleCreateColormap: Unsupported visual type\n");
+ }
+
+ return(TRUE);
+} /* ngleCreateColormap() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleInstallColormap()
+ *
+ * Description: Install given colormap into hardware.
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ * All clients requesting ColormapNotify are notified
+ * Colormap is installed into NGLE hardware
+ *
+ ******************************************************************************/
+
+void ngleInstallColormap(
+ ColormapPtr cmap)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(cmap->pScreen);
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ unsigned int i;
+ Card32 color;
+ int nColormapEntries = cmap->pVisual->ColormapEntries;
+ Card8 intensity;
+ unsigned short red, green, blue;
+
+
+ /* We do not need to install if this is the current map.
+ * it's already installed.
+ */
+ if (cmap == pScreenPriv->installedMap)
+ return;
+
+
+ /* If uninstalling an explicitly installed map, tell everybody */
+ if (pScreenPriv->installedMap)
+ {
+ WalkTree(pScreenPriv->installedMap->pScreen, TellLostMap,
+ (char *) &(pScreenPriv->installedMap->mid));
+ }
+
+ /* setup colormap hardware */
+ START_IMAGE_COLORMAP_ACCESS(pDregs);
+
+ /* Load each colormap entry into shadow RAM */
+
+ if (cmap->pVisual->class == DirectColor)
+ {
+ for (i=0; i < nColormapEntries; i++)
+ {
+ if (cmap->red[i].fShared)
+ red = cmap->red[i].co.shco.red->color;
+ else
+ red = cmap->red[i].co.local.red;
+
+ if (cmap->green[i].fShared)
+ green = cmap->green[i].co.shco.green->color;
+ else
+ green = cmap->green[i].co.local.green;
+
+ if (cmap->blue[i].fShared)
+ blue = cmap->blue[i].co.shco.blue->color;
+ else
+ blue = cmap->blue[i].co.local.blue;
+
+ if (!pScreenPriv->isGrayScale)
+ {
+ color = ( ((Card32) (red & 0xff00) << 8)
+ | (Card32) (green & 0xff00)
+ | ((Card32) (blue & 0xff00) >> 8)
+ );
+ }
+ else
+ { /* Gray Scale */
+ CALCULATE_GRAYSCALE_INTENSITY(intensity,
+ (red >> 8),
+ (green >> 8),
+ (blue >> 8));
+ color = intensity | (intensity << 8) | (intensity << 16);
+ }
+
+ pScreenPriv->hwColors[i] = color;
+
+ WRITE_IMAGE_COLOR(pDregs,i,color);
+ }
+ }
+ else /* PseudoColor */
+ {
+ for (i=0; i < nColormapEntries; i++)
+ {
+ if (cmap->red[i].fShared)
+ {
+ red = cmap->red[i].co.shco.red->color;
+ green = cmap->red[i].co.shco.green->color;
+ blue = cmap->red[i].co.shco.blue->color;
+ }
+ else if (cmap->red[i].refcnt != 0)
+ {
+ red = cmap->red[i].co.local.red;
+ green = cmap->red[i].co.local.green;
+ blue = cmap->red[i].co.local.blue;
+ }
+ else
+ {
+ /* take it apart, so it can be put together again */
+ red = (pScreenPriv->hwColors[i] & 0xff0000) >> 8;
+ green = (pScreenPriv->hwColors[i] & 0x00ff00);
+ blue = (pScreenPriv->hwColors[i] & 0x0000ff) << 8;
+ }
+
+ if (!pScreenPriv->isGrayScale)
+ {
+ color = ( ((Card32) (red & 0xff00) << 8)
+ | (Card32) (green & 0xff00)
+ | ((Card32) (blue & 0xff00) >> 8)
+ );
+ }
+ else
+ { /* Gray Scale */
+ CALCULATE_GRAYSCALE_INTENSITY(intensity,
+ (red >> 8),
+ (green >> 8),
+ (blue >> 8));
+ color = intensity | (intensity << 8) | (intensity << 16);
+ }
+
+ pScreenPriv->hwColors[i] = color;
+
+ WRITE_IMAGE_COLOR(pDregs,i,color);
+ }
+ }
+
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ NgleLutBltCtl lutBltCtl;
+
+ lutBltCtl = setHyperLutBltCtl(pScreenPriv->deviceID,
+ pScreenPriv->devDepth,
+ 0, /* Offset w/i LUT */
+ 256); /* Load entire LUT */
+ NGLE_BINC_SET_SRCADDR((Card32)
+ NGLE_LONG_FB_ADDRESS(0, 0x100, 0)); /* 0x100 is same as used in
+ * WRITE_IMAGE_COLOR() */
+ START_COLORMAPLOAD(lutBltCtl.all);
+ SETUP_FB(pDregs, pScreenPriv->deviceID, pScreenPriv->devDepth);
+ }
+ else
+ {
+ /* cleanup colormap hardware */
+ FINISH_IMAGE_COLORMAP_ACCESS(pDregs,pScreenPriv->deviceID,
+ pScreenPriv->devDepth);
+ }
+
+ pScreenPriv->installedMap = cmap;
+ WalkTree(cmap->pScreen, TellGainedMap, (char *) &(cmap->mid));
+
+} /* ngleInstallColormap() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleStoreColors()
+ *
+ * Description: Sets the pixels in pdefs into the specified map.
+ *
+ * If the colormap being updated has been loaded into the
+ * NGLE hardware, update there as well.
+ *
+ * Results:
+ * None
+ *
+ * Parameters:
+ * Colors in xColorItem *pDefs are Card16's (not Card8s);
+ * Must be shifted right 8 before loading into 8 bit DAC.
+ *
+ * Side Effects:
+ * Hardware updated if colormap loaded.
+ *
+ * Note on Gray Scale:
+ * Intensity calculation of using a RGB weighting of (.3,.59,.11)
+ * is the NTSC weighting formula.
+ *
+ ******************************************************************************/
+
+void
+ngleStoreColors(
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ Card32 index;
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pmap->pScreen);
+ short intensity; /* gray scale */
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ Card32 color;
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+
+
+ /* We do not need to update HW if this is not the current map.
+ */
+ if (pmap != pScreenPriv->installedMap)
+ return;
+
+ /* setup colormap hardware */
+ START_IMAGE_COLORMAP_ACCESS(pDregs);
+
+ if (pVisual->class == DirectColor)
+ {
+ for (i = 0; i < ndef; i++)
+ {
+ if ((pdefs+i)->flags & DoRed)
+ {
+ index = ((pdefs+i)->pixel & pVisual->redMask)
+ >> pVisual->offsetRed;
+ color = pScreenPriv->hwColors[index];
+ color = ((((pdefs+i)->red) << 8) & 0xff0000) | (color & 0xffff);
+ pScreenPriv->hwColors[index] = color;
+
+ WRITE_IMAGE_COLOR(pDregs, index, color);
+ }
+ if ((pdefs+i)->flags & DoGreen)
+ {
+ index = ((pdefs+i)->pixel & pVisual->greenMask)
+ >> pVisual->offsetGreen;
+ color = pScreenPriv->hwColors[index];
+ color = (((pdefs+i)->green) & 0xff00) | (color & 0xff00ff);
+ pScreenPriv->hwColors[index] = color;
+
+ WRITE_IMAGE_COLOR(pDregs, index, color);
+ }
+ if ((pdefs+i)->flags & DoBlue)
+ {
+ index = ((pdefs+i)->pixel & pVisual->blueMask)
+ >> pVisual->offsetBlue;
+ color = pScreenPriv->hwColors[index];
+ color = ((((pdefs+i)->blue) >> 8) & 0xff) | (color & 0xffff00);
+ pScreenPriv->hwColors[index] = color;
+
+ WRITE_IMAGE_COLOR(pDregs, index, color);
+ }
+ }
+ }
+ else /* PseudoColor */
+ {
+ while (ndef--)
+ {
+ index = pdefs->pixel&0xff;
+
+ if (!pScreenPriv->isGrayScale)
+ {
+ color = pScreenPriv->hwColors[index];
+
+ if( pdefs->flags & DoRed)
+ {
+ color = (((pdefs->red) << 8) & 0xff0000) | (color & 0xffff);
+ }
+ if( pdefs->flags & DoGreen)
+ {
+ color = ((pdefs->green) & 0xff00) | (color & 0xff00ff);
+ }
+ if( pdefs->flags & DoBlue)
+ {
+ color = (((pdefs->blue) >> 8) & 0xff) | (color & 0xffff00);
+ }
+ }
+ else
+ { /* Gray Scale */
+ if ((pdefs->flags & DoRed)
+ || (pdefs->flags & DoGreen)
+ || (pdefs->flags & DoBlue))
+ {
+ CALCULATE_GRAYSCALE_INTENSITY(intensity,
+ ((pdefs->red) >> 8),
+ ((pdefs->green) >> 8),
+ ((pdefs->blue) >> 8));
+
+ color = intensity | (intensity << 8) | (intensity << 16);
+ }
+ }
+
+ pScreenPriv->hwColors[index] = color;
+
+ WRITE_IMAGE_COLOR(pDregs,index,color);
+
+ pdefs++;
+ }
+ }
+
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ NgleLutBltCtl lutBltCtl;
+
+ lutBltCtl = setHyperLutBltCtl(pScreenPriv->deviceID,
+ pScreenPriv->devDepth,
+ 0, /* Offset w/i LUT */
+ 256); /* Load entire LUT */
+ NGLE_BINC_SET_SRCADDR((Card32)
+ NGLE_LONG_FB_ADDRESS(0, 0x100, 0)); /* 0x100 is same as used in
+ * WRITE_IMAGE_COLOR() */
+ START_COLORMAPLOAD(lutBltCtl.all);
+ SETUP_FB(pDregs, pScreenPriv->deviceID, pScreenPriv->devDepth);
+ }
+ else
+ {
+ /* cleanup colormap hardware */
+ FINISH_IMAGE_COLORMAP_ACCESS(pDregs,pScreenPriv->deviceID,
+ pScreenPriv->devDepth);
+ }
+
+} /* ngleStoreColors() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleListInstalledColormaps()
+ *
+ * Description: Fills in the list with the IDs of the installed maps.
+ *
+ * Results:
+ * Returns the number of IDs in the list
+ *
+ * Side Effects:
+ * None
+ *
+ ******************************************************************************/
+
+int
+ngleListInstalledColormaps(
+ ScreenPtr pScreen,
+ Colormap *pCmapList)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+
+ *pCmapList = pScreenPriv->installedMap->mid;
+ return (1);
+} /* ngleListInstalledColormaps() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleUninstallColormap()
+ *
+ * Description: If given colormap installed, uninstall it.
+ * If the colormap's visual is the default (root) visual,
+ * take care that _some_ colormap is installed:
+ * if cmap is default colormap, leave installed,
+ * else install default colormap.
+ * Caveat:
+ * It is possible to receive a request to uninstall a colormap that
+ * is not installed. In this case, ngleUninstallColormap will mark
+ * the colormap as uninstalled and return correctly.
+ *
+ * Results:
+ * None
+ *
+ * Side Effects:
+ * All clients requesting ColormapNotify are notified
+ *
+ ******************************************************************************/
+
+void
+ngleUninstallColormap( ColormapPtr cmap)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(cmap->pScreen);
+
+ if (cmap == pScreenPriv->installedMap)
+ {
+ Colormap defMapID = cmap->pScreen->defColormap;
+
+ /* Don't uninstall default colormap */
+ if (cmap->mid != defMapID)
+ {
+ ColormapPtr defMap =
+ (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
+
+ if (defMap)
+ ngleInstallColormap(defMap);
+ else
+ ErrorF("ngleUninstallColormap: ",
+ "Can't find default colormap\n");
+ }
+ }
+} /* ngleUninstallColormap() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleDestroyColormap()
+ *
+ * Description: Perform device-specific operations to destroy a colormap.
+ *
+ * Entry: pmap points to the colormap of interest.
+ *
+ * Return Value: none
+ *
+ * Called by: DIX DestroyColormap routine
+ *
+ ******************************************************************************/
+
+void
+ngleDestroyColormap(
+ ColormapPtr pmap
+)
+{
+ return;
+} /* ngleDestroyColormap */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleResolvePseudoColor()
+ *
+ * Description: Normalize colors to device.
+ *
+ ******************************************************************************/
+
+void
+ngleResolvePseudoColor(
+ Card16 *pRed,
+ Card16 *pGreen,
+ Card16 *pBlue,
+ VisualPtr pVisual)
+{
+ unsigned short mask;
+ unsigned short bits = pVisual->bitsPerRGBValue;
+ unsigned short mult = 0xffff / ((1 << bits) - 1);
+ unsigned short round = (1 << ( 16 - pVisual->bitsPerRGBValue))/ 2;
+
+
+ /*
+ * Now we need to figure out how many bits/rgb this visual
+ * (hardware) has and then normalize the request value to that.
+ */
+
+ mask = ((1 << bits) - 1) << (MAX_BITS_PER_RGB - bits);
+ *pRed = ((*pRed) - (*pRed >> pVisual->bitsPerRGBValue)) + round;
+ *pGreen = ((*pGreen) - (*pGreen >> pVisual->bitsPerRGBValue)) + round;
+ *pBlue = ((*pBlue) - (*pBlue >> pVisual->bitsPerRGBValue)) + round;
+
+ *pRed = mult * ((((*pRed) >> MAX_BITS_PER_RGB ) & mask) >>
+ (MAX_BITS_PER_RGB - bits));
+ *pGreen = mult * ((((*pGreen) >> MAX_BITS_PER_RGB ) & mask) >>
+ (MAX_BITS_PER_RGB - bits));
+ *pBlue = mult * ((((*pBlue) >> MAX_BITS_PER_RGB ) & mask) >>
+ (MAX_BITS_PER_RGB - bits));
+
+ return;
+
+} /* ngleResolvePseudoColor() */
+
+
+NgleLutBltCtl setNgleLutBltCtl(
+ Card32 deviceID,
+ Int32 devDepth,
+ Card32 offsetWithinLut,
+ Card32 length) /* #entries to update */
+{
+ NgleLutBltCtl lutBltCtl;
+
+ /* set enable, zero reserved fields */
+ lutBltCtl.all = 0x80000000;
+
+ lutBltCtl.fields.length = length;
+
+ if (deviceID == S9000_ID_A1439A) /* CRX24 */
+ {
+ if (devDepth == 8)
+ {
+ lutBltCtl.fields.lutType = NGLE_CMAP_OVERLAY_TYPE;
+ lutBltCtl.fields.lutOffset = 0;
+ }
+ else
+ {
+ lutBltCtl.fields.lutType = NGLE_CMAP_INDEXED0_TYPE;
+ lutBltCtl.fields.lutOffset = 0 * 256;
+ }
+ }
+ else if (deviceID == S9000_ID_ARTIST)
+ {
+ lutBltCtl.fields.lutType = NGLE_CMAP_INDEXED0_TYPE;
+ lutBltCtl.fields.lutOffset = 0 * 256;
+ }
+ else
+ {
+ lutBltCtl.fields.lutType = NGLE_CMAP_INDEXED0_TYPE;
+ lutBltCtl.fields.lutOffset = 0;
+ }
+
+ /* Offset points to start of LUT. Adjust for within LUT */
+ lutBltCtl.fields.lutOffset += offsetWithinLut;
+
+ return(lutBltCtl);
+
+} /* setNgleLutBltCtl() */
+
+NgleLutBltCtl setHyperLutBltCtl(
+ Card32 deviceID,
+ Int32 devDepth,
+ Card32 offsetWithinLut,
+ Card32 length) /* #entries to update */
+{
+ NgleLutBltCtl lutBltCtl;
+
+ /* set enable, zero reserved fields */
+ lutBltCtl.all = 0x80000000;
+
+ lutBltCtl.fields.length = length;
+ lutBltCtl.fields.lutType = HYPER_CMAP_TYPE;
+
+ /* Expect lutIndex to be 0 or 1 for image cmaps, 2 or 3 for overlay cmaps*/
+ if (devDepth == 8)
+ lutBltCtl.fields.lutOffset = 2 * 256;
+ else
+ lutBltCtl.fields.lutOffset = 0 * 256;
+
+ /* Offset points to start of LUT. Adjust for within LUT */
+ lutBltCtl.fields.lutOffset += offsetWithinLut;
+
+ return(lutBltCtl);
+
+} /* setHyperLutBltCtl() */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecolormap.h b/xc/programs/Xserver/hw/hp/ngle/nglecolormap.h
new file mode 100644
index 000000000..07c8e92c2
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecolormap.h
@@ -0,0 +1,84 @@
+/* $XConsortium: nglecolormap.h,v 1.2 95/01/24 02:02:01 dpw Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * Defines shared structure NgleDisplayRec as well as
+ * DDX-specific entry points relating to color for NGLE driver.
+ *
+ ******************************************************************************/
+
+#ifndef NGLECOLORMAP_H
+#define NGLECOLORMAP_H
+
+#define HYPER_CMAP_TYPE 0
+#define NGLE_CMAP_INDEXED0_TYPE 0
+#define NGLE_CMAP_OVERLAY_TYPE 3
+
+/* Typedef of LUT (Colormap) BLT Control Register */
+typedef union
+{ /* Note assumption that fields are packed left-to-right */
+ unsigned long all;
+ struct
+ {
+ unsigned enable : 1;
+ unsigned waitBlank : 1;
+ unsigned reserved1 : 4;
+ unsigned lutOffset : 10; /* Within destination LUT */
+ unsigned lutType : 2; /* Cursor, image, overlay */
+ unsigned reserved2 : 4;
+ unsigned length : 10;
+ } fields;
+} NgleLutBltCtl;
+
+extern void ngleInstallColormap(
+ ColormapPtr pColormap);
+
+extern void ngleUninstallColormap(
+ ColormapPtr pColormap);
+
+extern int ngleListInstalledColormaps(
+ ScreenPtr pScreen,
+ Colormap *pCmapList);
+
+extern void ngleStoreColors(
+ ColormapPtr pCmap,
+ int ndef,
+ xColorItem *pdefs);
+
+extern Bool ngleCreateColormap(
+ ColormapPtr pCmap);
+
+extern void ngleDestroyColormap(
+ ColormapPtr pCmap);
+
+extern void ngleResolvePseudoColor(
+ Card16 *pRed,
+ Card16 *pGreen,
+ Card16 *pBlue,
+ VisualPtr pVisual);
+
+
+#endif /* NGLECOLORMAP_H */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecopy.c b/xc/programs/Xserver/hw/hp/ngle/nglecopy.c
new file mode 100644
index 000000000..dae5c083d
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecopy.c
@@ -0,0 +1,154 @@
+/* $TOG: nglecopy.c /main/2 1997/11/11 15:45:45 msr $ */
+
+/*
+****************************************************************************
+** DDX WINDOW ROUTINES
+**
+** (c) Copyright Hewlett-Packard Company, 1992.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+**
+****************************************************************************
+*/
+
+#include "ngle.h"
+
+/* Extern decalarations for CFB routines */
+/* Depth 8 CFB functions */
+extern int cfbDoBitbltGeneral();
+extern int cfbDoBitbltCopy();
+extern int cfbDoBitbltXor();
+extern int cfbDoBitbltOr();
+extern RegionPtr cfbBitBlt();
+
+/* Depth 24 CFB functions */
+extern int cfb32DoBitbltGeneral();
+extern int cfb32DoBitbltCopy();
+extern int cfb32DoBitbltXor();
+extern int cfb32DoBitbltOr();
+extern RegionPtr cfb32BitBlt();
+
+/* Ngle routines */
+
+extern int ngleBitBlt();
+
+/***************************************************************************
+ *
+ * ngleCopyArea8()
+ *
+ * This routine is a replacement for cfbCopyArea(), to allow us to
+ * call our own block move routine when we are in the scrolling
+ * case.
+ *
+ ***************************************************************************
+ */
+
+RegionPtr ngleCopyArea8(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+{
+ int (*doBitBlt) ();
+
+ doBitBlt = cfbDoBitbltCopy;
+
+ if (( pSrcDrawable == pDstDrawable) &&
+ (pSrcDrawable->type == DRAWABLE_WINDOW) &&
+ (pDstDrawable->type == DRAWABLE_WINDOW))
+ {
+ doBitBlt = ngleBitBlt;
+ }
+
+ if (pGC->alu != GXcopy || (pGC->planemask & 0xff) != 0xff)
+ {
+ doBitBlt = cfbDoBitbltGeneral;
+ if ((pGC->planemask & 0xff) == 0xff)
+ {
+ switch (pGC->alu) {
+ case GXxor:
+ doBitBlt = cfbDoBitbltXor;
+ break;
+ case GXor:
+ doBitBlt = cfbDoBitbltOr;
+ break;
+ }
+ }
+ }
+
+ return cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0);
+}
+
+
+/***************************************************************************
+ *
+ * ngleCopyArea24()
+ *
+ * This routine is a replacement for cfb32CopyArea(), to allow us to
+ * call our own block move routine when we are in the scrolling
+ * case.
+ *
+ ***************************************************************************
+ */
+
+#ifndef LOWMEMFTPT
+
+RegionPtr ngleCopyArea24(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+{
+ int (*doBitBlt) ();
+
+ doBitBlt = cfb32DoBitbltCopy;
+
+ if (( pSrcDrawable == pDstDrawable) &&
+ (pSrcDrawable->type == DRAWABLE_WINDOW) &&
+ (pDstDrawable->type == DRAWABLE_WINDOW))
+ {
+ doBitBlt = ngleBitBlt;
+ }
+
+ if (pGC->alu != GXcopy || (pGC->planemask & 0xffffffff) != 0xffffffff)
+ {
+ doBitBlt = cfb32DoBitbltGeneral;
+ if ((pGC->planemask & 0xffffffff) == 0xffffffff)
+ {
+ switch (pGC->alu) {
+ case GXxor:
+ doBitBlt = cfb32DoBitbltXor;
+ break;
+ case GXor:
+ doBitBlt = cfb32DoBitbltOr;
+ break;
+ }
+ }
+ }
+
+ return cfb32BitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0);
+}
+
+#endif /* ifndef LOWMEMFTPT */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecopy.h b/xc/programs/Xserver/hw/hp/ngle/nglecopy.h
new file mode 100644
index 000000000..bf9641cdf
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecopy.h
@@ -0,0 +1,39 @@
+/* $XConsortium: nglecopy.h,v 1.1 93/08/08 12:57:01 rws Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+#ifndef NGLECOPY
+#define NGLECOPY
+
+/*
+ ******************************************************************************
+ **
+ ** Extern declarations
+ **
+ ******************************************************************************
+ */
+
+extern RegionPtr ngleCopyArea8();
+extern RegionPtr ngleCopyArea24();
+
+#endif /* NGLECOPY */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecursor.c b/xc/programs/Xserver/hw/hp/ngle/nglecursor.c
new file mode 100644
index 000000000..4813b3e01
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecursor.c
@@ -0,0 +1,1037 @@
+/* $XConsortium: nglecursor.c,v 1.3 95/01/24 02:05:50 dpw Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains various procedures that implement cursor
+ * functionality (for both sprites and echoes).
+ *
+ ******************************************************************************/
+
+#include "ngle.h"
+
+extern WindowPtr *WindowTable;
+extern int hpActiveScreen; /* input driver global */
+
+/* Defined in nglecolormap.c: */
+extern void ngleLoadCursorColormap(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: hyperInitSprite()
+ *
+ * Description:
+ *
+ * This routine is called at ScreenInit() time to initialize various
+ * cursor/sprite structures and the NGLE sprite code.
+ *
+ ******************************************************************************/
+
+Bool hyperInitSprite(
+ ScreenPtr pScreen)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ hpPrivPtr php = (hpPrivPtr)pScreen->devPrivate;
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ Int32 nScanlinesToZero;
+ Int32 curaddr;
+ Int32 nFreeFifoSlots = 0;
+
+ NGLE_LOCK(pScreenPriv);
+
+ /* Initialize the pScreen Cursor Procedure Pointers: */
+ pScreen->PointerNonInterestBox = ngleNoop;
+ pScreen->CursorLimits = hpCursorLimits;
+ pScreen->ConstrainCursor = hpConstrainCursor;
+ pScreen->DisplayCursor = hyperDisplayCursor;
+ pScreen->SetCursorPosition = hpSetCursorPosition;
+ pScreen->RealizeCursor = ngleNoopTrue;
+ pScreen->UnrealizeCursor = ngleNoopTrue;
+ pScreen->RecolorCursor = ngleRecolorCursor;
+
+
+ /* Initialize the Cursor Procedure Pointers: */
+ php->MoveMouse = ngleMoveSprite;
+ php->ChangeScreen = ngleChangeScreen;
+ php->CursorOff = ngleDisableSprite;
+
+ /* Initialize the pScreenPriv->sprite Structure: */
+ pScreenPriv->sprite.visible = FALSE;
+ pScreenPriv->sprite.x = (pScreenPriv->screenWidth >> 1);
+ pScreenPriv->sprite.y = (pScreenPriv->screenHeight >> 1);
+ pScreenPriv->sprite.width = 0;
+ pScreenPriv->sprite.height = 0;
+ pScreenPriv->sprite.pCursor = NULL;
+ pScreenPriv->sprite.firstCallTo_DisplayCursor = TRUE;
+ pScreenPriv->sprite.nTopPadLines = 0;
+ pScreenPriv->sprite.moveOnVBlank = FALSE;
+
+ /* Zero out cursor mask and data:
+ * Each load of cursor data/mask will write minimum necessary
+ * to overwrite previous cursor.
+ */
+ /* Zero out 64 bits (2 longs) in each mask scanline */
+ nScanlinesToZero = NGLE_MAX_SPRITE_SIZE;
+
+ /* to protect against VID bus data loss */
+ SETUP_HW(pDregs);
+
+ GET_FIFO_SLOTS(nFreeFifoSlots,2);
+ HYPER_GET_VID_BUS_ACCESS;
+
+ /* Write to mask area */
+ HYPER_SET_CURSOR_ADDRESS(0);
+ do
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA(0);
+ HYPER_WRITE_CURSOR_DATA(0);
+ } while (--nScanlinesToZero);
+
+ /* Zero out 64 bits (2 longs) in each data scanline */
+ nScanlinesToZero = NGLE_MAX_SPRITE_SIZE;
+ GET_FIFO_SLOTS(nFreeFifoSlots, 1);
+ HYPER_SET_CURSOR_ADDRESS(HYPER_CURSOR_DATA_BIT);
+ do
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA(0);
+ HYPER_WRITE_CURSOR_DATA(0);
+ } while (--nScanlinesToZero);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+ return(TRUE);
+
+} /* hyperInitSprite() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleInitSprite()
+ *
+ * Description:
+ *
+ * This routine is called at ScreenInit() time to initialize various
+ * cursor/sprite structures and the NGLE sprite code.
+ *
+ ******************************************************************************/
+
+Bool ngleInitSprite(pScreen)
+
+
+ ScreenPtr pScreen;
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ hpPrivPtr php = (hpPrivPtr)pScreen->devPrivate;
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ NgleDevRomDataPtr pDevRomData = pScreenPriv->pDevRomData;
+ Int32 nScanlinesToZero;
+
+
+ /* Initialize the pScreen Cursor Procedure Pointers: */
+ pScreen->PointerNonInterestBox = ngleNoop;
+ pScreen->CursorLimits = hpCursorLimits;
+ pScreen->ConstrainCursor = hpConstrainCursor;
+ pScreen->SetCursorPosition = hpSetCursorPosition;
+ pScreen->DisplayCursor = ngleDisplayCursor;
+ pScreen->RealizeCursor = ngleNoopTrue;
+ pScreen->UnrealizeCursor = ngleNoopTrue;
+ pScreen->RecolorCursor = ngleRecolorCursor;
+
+
+ /* Initialize the HP private Cursor Procedure Pointers: */
+ php->MoveMouse = ngleMoveSprite;
+ php->ChangeScreen = ngleChangeScreen;
+ php->CursorOff = ngleDisableSprite;
+
+ /* Initialize the pScreenPriv->sprite Structure: */
+ pScreenPriv->sprite.visible = FALSE;
+ pScreenPriv->sprite.x = (pScreenPriv->screenWidth >> 1);
+ pScreenPriv->sprite.y = (pScreenPriv->screenHeight >> 1);
+ pScreenPriv->sprite.width = 0;
+ pScreenPriv->sprite.height = 0;
+ pScreenPriv->sprite.pCursor = NULL;
+ pScreenPriv->sprite.firstCallTo_DisplayCursor = TRUE;
+ pScreenPriv->sprite.nTopPadLines = 0;
+ pScreenPriv->sprite.moveOnVBlank = FALSE;
+ GET_CURSOR_SPECS(pDregs,pScreenPriv);
+ pScreenPriv->sprite.pipelineDelay = pDevRomData->cursor_pipeline_delay;
+ pScreenPriv->sprite.videoInterleave = pDevRomData->video_interleaves;
+ if (pScreenPriv->deviceID == S9000_ID_A1439A)
+ {
+ pScreenPriv->sprite.pipelineDelay--;
+ }
+
+ /* Zero out 64 bits (2 longs) in each scanline */
+ START_CURSOR_MASK_ACCESS(pDregs);
+ nScanlinesToZero = NGLE_MAX_SPRITE_SIZE;
+ do
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ } while (--nScanlinesToZero);
+
+ /* Zero out 64 bits (2 longs) in each scanline */
+ START_CURSOR_DATA_ACCESS(pDregs);
+ nScanlinesToZero = NGLE_MAX_SPRITE_SIZE;
+ do
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ } while (--nScanlinesToZero);
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+ return(TRUE);
+
+} /* ngleInitSprite() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleUninitSprite()
+ *
+ * Description:
+ *
+ * This routine is called at CloseScreen() time to free various
+ * cursor/sprite structures and shutdown the NGLE sprite code.
+ *
+ ******************************************************************************/
+
+Bool ngleUninitSprite(pScreen)
+
+ ScreenPtr pScreen;
+{
+ hpPrivPtr php;
+
+ php = (hpPrivPtr)pScreen->devPrivate;
+ php->MoveMouse = ngleNoop;
+ php->CursorOff = ngleNoop;
+ php->ChangeScreen = ngleNoop;
+
+ return(TRUE);
+
+} /* ngleUninitSprite() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleDisableSprite()
+ *
+ * Description:
+ *
+ * This routine is called from the input driver to disable
+ * a screen's sprite (make it invisible) when the cursor/sprite moves
+ * to another screen when the server is in a multi-headed configuration.
+ * The sprite is re-enabled for a screen by a call to DisplayCursor().
+ *
+ ******************************************************************************/
+
+void ngleDisableSprite(pScreen)
+
+ ScreenPtr pScreen;
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+
+
+ if (pScreenPriv->sprite.visible)
+ {
+ pScreenPriv->sprite.visible == FALSE;
+ DISABLE_CURSOR(pScreenPriv);
+ }
+
+} /* ngleDisableSprite() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleChangeScreen()
+ *
+ * Description:
+ *
+ * This routine is intended to handle changing the current screen.
+ * pScreen points to new screen.
+ *
+ ******************************************************************************/
+
+void ngleChangeScreen(pScreen)
+
+ ScreenPtr pScreen;
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ WindowPtr pRootWindow = WindowTable[pScreen->myNum];
+
+ if (pScreenPriv->sprite.pCursor == NULL)
+ {
+ /* This should only occur once and only for screens 1 and above.
+ * Reason: server calls DisplayCursor during initialization,
+ * but before rootwindow (and default cursor) have been defined.
+ * So DisplayCursor exited at very top - before firstCall is set false.
+ */
+
+ /* Do load and enable cursor. */
+ (*pScreen->DisplayCursor)(pScreen, pRootWindow->optional->cursor);
+ }
+
+} /* ngleChangeScreen() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleDisplayCursor()
+ *
+ * Description:
+ *
+ * This routine is called by DIX (and the input driver)
+ * whenever the sprite/cursor is changed 1) from one "cursor" (i.e. image
+ * and mask bits, foreground and background color) to another 2) from one
+ * screen to another. This routine downloads the cursor image/mask and
+ * foreground and background colors to the hardware cursor.
+ *
+ ******************************************************************************/
+
+Bool ngleDisplayCursor(pScreen, pCursor)
+
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ hpPrivPtr php = (hpPrivPtr)pScreen->devPrivate;
+ WindowPtr pRootWindow;
+ NgleHdwPtr pDregs;
+ Card32 *pSrc;
+ Int32 nScanlines; /* loop variable */
+ Int32 heightPlus1;
+ Int32 sourceIncrement;
+ Int32 nScanlinesToZeroPlus1;
+ Int32 nOffscreenScanlines = 0;
+ Int32 x0, y0; /* Sprite origin (not hotspot) */
+ Int32 xHi, /* For cursor positioning */
+ xLo;
+ Int32 i;
+ Card32 srcMask;
+ Card32 cursorXYValue = 0;
+ int nTopPadLines = 0;
+ int nBotPadLines = 0;
+ Int32 hbp_times_vi;
+
+
+
+ /*
+ ***************************************************************************
+ ** We are called during initialization as a side effect of doing a change
+ ** screens to insure screen 0 is on top. At that time, there is no root
+ ** window so we should just abort and wait for a call that has a cursor
+ ** to display.
+ **
+ ** After the first time this routine is called (i.e. after the "side effect"
+ ** call), if pCursor is NULL it means that the input driver is
+ ** changing screens and wants this screen to use the same "cursor" (i.e.
+ ** image and mask bits, etc.) as the last time that the sprite was on
+ ** this screen. However, the second time that pScreen->DisplayCursor is
+ ** called, pCursor is NULL, but since there wasn't a previous cursor,
+ ** the driver should use the Root Window's cursor (which is the side
+ ** effect that the input driver and/or DIX wants to acheive).
+ ***************************************************************************
+ */
+ if (!(pRootWindow = WindowTable[pScreen->myNum]))
+ return(TRUE);
+
+ if (pScreenPriv->sprite.firstCallTo_DisplayCursor)
+ {
+ pScreenPriv->sprite.firstCallTo_DisplayCursor = FALSE;
+
+ if (pCursor == NULL)
+ pCursor = pRootWindow->optional->cursor;
+ }
+
+ /* Now if the cursor is still null, abort because we are using the
+ * same cursor as before:
+ */
+ if (pCursor == NULL)
+ return(FALSE);
+
+ /* Check for a valid sized cursor: */
+ if ((pCursor->bits->width > NGLE_MAX_SPRITE_SIZE) ||
+ (pCursor->bits->height > NGLE_MAX_SPRITE_SIZE))
+ return(FALSE); /* Cursor is TOO big */
+
+ if (pScreenPriv->sprite.visible == TRUE)
+ {
+ /**** Before loading the new image, mask, and colors into the hardware
+ **** cursor, turn it off so we don't get flicker:
+ ****/
+ DISABLE_CURSOR(pScreenPriv);
+ }
+
+ if ( (pScreenPriv->deviceID == S9000_ID_TIMBER)
+ || (pScreenPriv->deviceID == S9000_ID_A1439A))
+ {
+ int nPadLines = NGLE_MAX_SPRITE_SIZE - pCursor->bits->height;
+ if (nPadLines >= NTOPLINES_FOR_TIMBER)
+ {
+ nPadLines -= NTOPLINES_FOR_TIMBER;
+ /* Split extra lines between top and bottom */
+ nBotPadLines = nPadLines/2;
+ nTopPadLines = NTOPLINES_FOR_TIMBER + nPadLines - nBotPadLines;
+ }
+ else
+ {
+ nTopPadLines = nPadLines;
+ }
+ }
+ else
+ { /* ELK */
+ nTopPadLines = 0;
+ nBotPadLines = NGLE_MAX_SPRITE_SIZE - pCursor->bits->height;
+ }
+
+ /* Calculate cursor origin (not hotspot) and number of scanlines not
+ * actually displayed, including any padding scanlines at top.
+ */
+ x0 = pScreenPriv->sprite.x - pCursor->bits->xhot;
+ y0 = pScreenPriv->sprite.y
+ - (pCursor->bits->yhot + nTopPadLines);
+
+ /* If y0 is less than zero, some scanlines of cursor won't be displayed.
+ * This fudge factor will be used at cursor enable time.
+ */
+ if (y0 < 0)
+ {
+ nOffscreenScanlines = - y0;
+ y0 = 0;
+ }
+
+ pDregs = pScreenPriv->pDregs;
+
+ /* If cursor has changed, write the image, mask, and cursor colormap
+ * to the hardware cursor:
+ */
+ if ((pCursor != pScreenPriv->sprite.pCursor)
+ ||(pCursor->bits != pScreenPriv->sprite.pCursor->bits))
+ {
+ pScreenPriv->sprite.pCursor = pCursor;
+ heightPlus1 = pCursor->bits->height + 1;
+
+ if (pCursor->bits->width <= 32)
+ {
+ /* Form left justified mask of meaningful bits in cursor
+ * data and mask. Reason: old cursor may be larger and
+ * needs to be zeroed out, not left unchanged.
+ */
+ srcMask = 0xffffffffUL << (32 - pCursor->bits->width);
+
+ /* write cursor mask to HW */
+ START_CURSOR_MASK_ACCESS(pDregs);
+ pSrc = (Card32 *) pCursor->bits->mask;
+
+ nScanlines = nTopPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ nScanlines = heightPlus1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,(*pSrc++ & srcMask),0);
+ }
+
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ /* write cursor data to HW */
+ START_CURSOR_DATA_ACCESS(pDregs);
+ pSrc = (Card32 *) pCursor->bits->source;
+
+ nScanlines = nTopPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ nScanlines = heightPlus1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,(*pSrc++ & srcMask),0);
+ }
+
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+ }
+ else
+ { /* Width == 64 */
+
+ /* Form left justified mask of meaningful bits
+ * second word in cursor data and mask.
+ */
+ srcMask = 0xffffffffUL << (64 - pCursor->bits->width);
+
+ /* write cursor mask to HW */
+ START_CURSOR_MASK_ACCESS(pDregs);
+ pSrc = (Card32 *) pCursor->bits->mask;
+
+ nScanlines = nTopPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ nScanlines = heightPlus1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,(*pSrc++),(*pSrc++ & srcMask));
+ }
+
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ /* write cursor data to HW */
+ START_CURSOR_DATA_ACCESS(pDregs);
+ pSrc = (Card32 *) pCursor->bits->source;
+
+ nScanlines = nTopPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+
+ nScanlines = heightPlus1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,(*pSrc++),(*pSrc++ & srcMask));
+ }
+
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ WRITE_CURSOR_BITS(pDregs,0,0);
+ }
+ }
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+ /* Load the correct colors into the hardware cursor: */
+ ngleLoadCursorColormap(pScreen, pCursor);
+ }
+
+ /* Load cursor position into NGLE:
+ * X11 hotspot hasn't changed position, but NGLE stores
+ * origin of cursor, and relative distance between hotspot
+ * and origin may have changed.
+ */
+
+ /* Update cursor X/Y position register, which contains
+ * all cursor position information except the number
+ * of scanlines hidden.
+ */
+ if (pScreenPriv->deviceID != S9000_ID_ARTIST)
+ {
+ xHi = (x0 / pScreenPriv->sprite.videoInterleave)
+ + pScreenPriv->sprite.horizBackPorch
+ - pScreenPriv->sprite.pipelineDelay;
+ xLo = x0 % pScreenPriv->sprite.videoInterleave;
+ }
+ else
+ {
+ hbp_times_vi = (pScreenPriv->sprite.horizBackPorch *
+ pScreenPriv->sprite.videoInterleave);
+ xHi = ((x0 + hbp_times_vi) / pScreenPriv->sprite.videoInterleave)
+ - pScreenPriv->sprite.pipelineDelay;
+ xLo = (x0 + hbp_times_vi) % pScreenPriv->sprite.videoInterleave;
+ }
+
+ /* if y0 < 0, y0 has already been set to 0 above */
+ cursorXYValue =
+ ( (xHi << 19)
+ | (xLo << 16)
+ | (pScreenPriv->sprite.maxYLine - y0)
+ );
+
+ /* Update values maintained in pScreenPriv->sprite */
+ pScreenPriv->sprite.visible = TRUE;
+ pScreenPriv->sprite.width = pCursor->bits->width;
+ pScreenPriv->sprite.height = pCursor->bits->height;
+ pScreenPriv->sprite.nTopPadLines = nTopPadLines;
+
+ /* ENABLE_CURSOR macro uses value of sprite.moveOnVBlank
+ * in deciding whether to wait for vertical blank before moving
+ * cursor.
+ */
+ switch (pScreenPriv->moveCursorOnVBlank)
+ {
+ case CURSOR_AT_VBLANK_ALWAYS:
+ pScreenPriv->sprite.moveOnVBlank = TRUE;
+ break;
+
+ case CURSOR_AT_VBLANK_NEVER:
+ pScreenPriv->sprite.moveOnVBlank = FALSE;
+ break;
+
+ case CURSOR_AT_VBLANK_DRIVEROPTION:
+ if (( (pScreenPriv->deviceID == S9000_ID_TIMBER)
+ || (pScreenPriv->deviceID == S9000_ID_A1439A)
+ )
+ && (nTopPadLines < NTOPLINES_FOR_TIMBER))
+ {
+ pScreenPriv->sprite.moveOnVBlank = TRUE;
+ }
+ else
+ {
+ pScreenPriv->sprite.moveOnVBlank = FALSE;
+ }
+ break;
+ }
+
+ /**** Now, that we have loaded the correct bits into the hardware
+ **** cursor, turn it back on:
+ ****/
+
+ /* If cursor is at top of screen, hotspot may be displayed
+ * but origin is at (y<0). NGLE hardware stores this value
+ * in same register as cursor enable bit, so pass as parameter.
+ */
+ ENABLE_CURSOR(pScreenPriv, cursorXYValue, nOffscreenScanlines);
+
+ return(TRUE);
+
+} /* ngleDisplayCursor() */
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: hyperDisplayCursor()
+ *
+ * Description:
+ *
+ * This routine is called by DIX (and the input driver?)
+ * whenever the sprite/cursor is changed 1) from one "cursor" (i.e. image
+ * and mask bits, foreground and background color) to another 2) from one
+ * screen to another. This routine downloads the cursor image/mask and
+ * foreground and background colors to the hardware cursor.
+ *
+ * Cloned from ngleDisplayCursor to use new hyperdrive cursor model and
+ * to avoid ugly bug workarounds in ngle code.
+ *
+ ******************************************************************************/
+
+Bool hyperDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ NgleScreenPrivPtr pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ WindowPtr pRootWindow;
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ Card32 *pSrcStart;
+ Card32 *pSrc;
+ Int32 nScanlines; /* loop variable */
+ Int32 heightPlus1;
+ Int32 sourceIncrement;
+ Int32 x0, y0; /* Sprite origin (not hotspot) */
+ Int32 i;
+ Int32 curaddr;
+ Card32 srcMask;
+ Int32 nFreeFifoSlots = 0;
+ Card32 cursorXYValue = 0;
+ int nBotPadLines = 0;
+
+
+ /*
+ ***************************************************************************
+ ** We are called during initialization as a side effect of doing a change
+ ** screens to insure screen 0 is on top. At that time, there is no root
+ ** window so we should just abort and wait for a call that has a cursor
+ ** to display.
+ **
+ ** After the first time this routine is called (i.e. after the side effect
+ ** call), if pCursor is NULL it means that the Corvallis input driver is
+ ** changing screens and wants this screen to use the same "cursor" (i.e.
+ ** image and mask bits, etc.) as the last time that the sprite was on
+ ** this screen. However, the second time that pScreen->DisplayCursor is
+ ** called, pCursor is NULL, but since there wasn't a previous cursor,
+ ** the driver should use the Root Window's cursor (which is the side
+ ** effect that the input driver and/or DIX wants to acheive).
+ ***************************************************************************
+ */
+ if (!(pRootWindow = WindowTable[pScreen->myNum]))
+ return(TRUE);
+
+ if (pScreenPriv->sprite.firstCallTo_DisplayCursor)
+ {
+ pScreenPriv->sprite.firstCallTo_DisplayCursor = FALSE;
+
+ if (pCursor == NULL)
+ pCursor = pRootWindow->optional->cursor;
+ }
+
+ /* Now if the cursor is still null, abort because we are using the
+ * same cursor as before:
+ */
+
+ if (pCursor == NULL)
+ return(FALSE);
+
+ /* Check for a valid sized cursor: (hyper same as ngle) */
+ if ((pCursor->bits->width > NGLE_MAX_SPRITE_SIZE) ||
+ (pCursor->bits->height > NGLE_MAX_SPRITE_SIZE))
+ return(FALSE); /* Cursor is TOO big */
+
+ /* Lock the device: */
+ NGLE_LOCK(pScreenPriv);
+
+ /* to protect against VID bus data loss */
+ SETUP_HW(pDregs);
+
+ GET_FIFO_SLOTS(nFreeFifoSlots,2);
+ HYPER_GET_VID_BUS_ACCESS;
+ if (pScreenPriv->sprite.visible == TRUE)
+ {
+ /**** Before loading the new image, mask, and colors into the hardware
+ **** cursor, turn it off so we don't get flicker:
+ ****/
+ /* Accessing asynchronous register: no need to check FIFO */
+ HYPER_DISABLE_CURSOR(pScreenPriv);
+
+ }
+
+ /* Calculate cursor origin (not hotspot) and number of scanlines not
+ * actually displayed.
+ */
+
+ x0 = pScreenPriv->sprite.x - pCursor->bits->xhot;
+ y0 = pScreenPriv->sprite.y
+ - (pCursor->bits->yhot);
+ nBotPadLines = NGLE_MAX_SPRITE_SIZE - pCursor->bits->height;
+
+ /* If cursor has changed, write the image, mask, and cursor colormap
+ * to the hardware cursor:
+ */
+ if ((pCursor != pScreenPriv->sprite.pCursor)
+ ||(pCursor->bits != pScreenPriv->sprite.pCursor->bits))
+ {
+
+ pScreenPriv->sprite.pCursor = pCursor;
+
+ heightPlus1 = pCursor->bits->height + 1;
+
+ /* Start out writing the mask */
+ pSrcStart = (Card32 *) pCursor->bits->mask;
+ curaddr = 0; /* Mask Area */
+
+ /**** Write the image and mask to the hardware cursor: ****/
+ for (i = 0; i < 2; i++)
+ {
+ /* Source is long-aligned: */
+ assert((Card32) pSrcStart == ((Card32)(pSrcStart) >> 2) << 2);
+
+ /* Like all pixmaps created by NGLE DDX, each scanline
+ * of the source and mask pixmaps are padded on the right
+ * to a long-word boundary. For a NGLE sprite, this means
+ * the scanline is either 32 or 64 bits.
+ *
+ * Padding is NOT necessarily 0!
+ */
+
+ if (pCursor->bits->width <= 32)
+ {
+ pSrc = pSrcStart;
+
+ /* Form left justified mask of meaningful bits in cursor
+ * data and mask. Alas, masking is performed on CPU
+ * on source data rather than using the ELK mask
+ * register. Reason: old cursor may be larger and
+ * needs to be zeroed out, not left unchanged.
+ */
+ srcMask = 0xffffffffUL << (32 - pCursor->bits->width);
+
+ /* Ngle cares whether old cursor was small enough that */
+ /* we dont have to zero all 64 bits. Hyperdrive */
+ /* its a dont-care since you can either write the 0 or */
+ /* write the new address. */
+
+ nScanlines = heightPlus1;
+ GET_FIFO_SLOTS(nFreeFifoSlots, 1);
+ HYPER_SET_CURSOR_ADDRESS(curaddr);
+ while (--nScanlines)
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA((*pSrc++ & srcMask));
+ HYPER_WRITE_CURSOR_DATA(0);
+ }
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA(0);
+ HYPER_WRITE_CURSOR_DATA(0);
+ }
+ }
+ else
+ { /* Width == 64 */
+
+ /* Form left justified mask of meaningful bits
+ * second word in cursor data and mask.
+ */
+ srcMask = 0xffffffffUL << (64 - pCursor->bits->width);
+
+ /* Destination bitmap address already set to (0,0) */
+ pSrc = pSrcStart;
+
+ nScanlines = heightPlus1;
+ GET_FIFO_SLOTS(nFreeFifoSlots, 1);
+ HYPER_SET_CURSOR_ADDRESS(curaddr);
+ while (--nScanlines)
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA(*pSrc++);
+ HYPER_WRITE_CURSOR_DATA((*pSrc++ & srcMask));
+ }
+ nScanlines = nBotPadLines + 1;
+ while (--nScanlines)
+ {
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ HYPER_WRITE_CURSOR_DATA(0);
+ HYPER_WRITE_CURSOR_DATA(0);
+ }
+ }
+ /* Now do the data */
+ pSrcStart = (Card32 *) pCursor->bits->source;
+ curaddr = HYPER_CURSOR_DATA_BIT;
+ }
+
+ /* Load the correct colors into the hardware cursor: */
+ ngleLoadCursorColormap(pScreen, pCursor);
+ }
+
+ /* Load cursor position into NGLE:
+ * X11 hotspot hasn't changed position, but NGLE stores
+ * origin of cursor, and relative distance between hotspot
+ * and origin may have changed.
+ */
+
+ /* if y0 < 0, y0 has already been set to 0 above */
+ cursorXYValue = HYPER_CURSOR_XY(x0,y0);
+
+ /* Update values maintained in pScreenPriv->sprite */
+ pScreenPriv->sprite.visible = TRUE;
+ pScreenPriv->sprite.width = pCursor->bits->width;
+ pScreenPriv->sprite.height = pCursor->bits->height;
+
+ /**** Now, that we have loaded the correct bits into the hardware
+ **** cursor, turn it back on:
+ ****/
+
+ /* If cursor is at top of screen, hotspot may be displayed
+ * but origin is at (y<0). NGLE hardware stores this value
+ * in same register as cursor enable bit, so pass as parameter.
+ */
+ HYPER_ENABLE_CURSOR(pScreenPriv, cursorXYValue);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+ return(TRUE);
+
+} /* hyperDisplayCursor() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleRecolorCursor()
+ *
+ * Description:
+ *
+ * This routine is called from DIX whenever a color(s) for a "cursor"
+ * (i.e. image and mask bits, foreground and background color) change.
+ * Since this routine may be called for a "cursor" that isn't the
+ * current "sprite", care must be excercised before changing the colors
+ * in the hardware cursor.
+ *
+ ******************************************************************************/
+
+void ngleRecolorCursor(pScreen, pCursor, displayed)
+
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ Bool displayed;
+{
+ /* Since DisplayCursor updates the cursor foreground and background
+ * colors before displaying it, we only need to re-load the
+ * cursor colormap if the cursor changing colors is already being
+ * displayed.
+ */
+
+ if (displayed)
+ ngleLoadCursorColormap(pScreen, pCursor);
+
+} /* ngleRecolorCursor() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleMoveSprite()
+ *
+ * Description:
+ *
+ * This routine is called from the input driver whenever the
+ * pointer device (e.g. mouse) is moved.
+ *
+ ******************************************************************************/
+
+void ngleMoveSprite(pScreen, xhot, yhot, forceit)
+
+ ScreenPtr pScreen;
+ Int16 xhot,yhot;
+ Bool forceit;
+{
+ NgleScreenPrivPtr pScreenPriv;
+ CursorBitsPtr pCursorBits;
+ Int32 x0, y0;
+ Int32 nOffscreenScanlines = 0;
+ Int32 hbp_times_vi, /* For cursor positioning */
+ xHi,
+ xLo;
+ Card32 cursorXYValue = 0;
+ NgleHdwPtr pDregs;
+ Int32 nFreeFifoSlots = 0;
+
+#ifdef XTESTEXT1
+ extern Int32 on_steal_input; /* Defined in xtestext1di.c */
+
+ if (on_steal_input)
+ check_for_motion_steal(xhot, yhot); /* XTM */
+#endif /* XTESTEXT1 */
+
+ pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ pDregs = pScreenPriv->pDregs;
+
+ /* Only move if cursor defined and position changed.
+ *
+ * (Cursor should be defined before this procedure called,
+ * but one case may occur on multi-headed server when changing
+ * cursor to new screen)
+ */
+ if ((pScreenPriv->sprite.pCursor != NULL)
+ && ((xhot != pScreenPriv->sprite.x) || (yhot != pScreenPriv->sprite.y)))
+ {
+ /* Define local pointer to cursor xhot and yhot offsets */
+ pCursorBits = pScreenPriv->sprite.pCursor->bits;
+
+ pScreenPriv->sprite.x = xhot;
+ pScreenPriv->sprite.y = yhot;
+
+ if (pScreenPriv->sprite.visible)
+ {
+ /* Calculate cursor origin */
+ x0 = xhot - pCursorBits->xhot;
+ /* Not all cursors start at first scan line of cursor BINs
+ * (to work around hardware problem w/ghosting and tearing
+ * on Biff/Mojave-based graphics cards). Number of padding
+ * padding lines is set when cursor loaded.
+ */
+ y0 = yhot - pCursorBits->yhot - pScreenPriv->sprite.nTopPadLines;
+
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ { /* ie NGLE_II_HW_CURSOR */
+ cursorXYValue = HYPER_CURSOR_XY(x0,y0);
+ assert(pScreenPriv->sprite.visible == TRUE);
+
+ /* This test is an optimization for thunder */
+ if (HYPER_ACCEL_BUSY_DODGER_IDLE)
+ {
+ if (HYPER_ACCEL_BUSY_DODGER_IDLE)
+ {
+ /* FIFO slot not required for this write */
+ HYPER_CPC(pScreenPriv, cursorXYValue);
+ }
+ else
+ {
+ HYPER_FIFO_CP(pScreenPriv, cursorXYValue);
+ }
+ }
+ else
+ {
+ HYPER_FIFO_CP(pScreenPriv, cursorXYValue);
+ }
+ }
+ else
+ {
+ /* Calculate number of scanlines not displayed
+ * because cursor is partly off the top of the screen.
+ * (X11 requires hotspot to remain on-screen,
+ * but not the sprite origin).
+ */
+ if (y0 < 0)
+ {
+ nOffscreenScanlines = - y0;
+ y0 = 0;
+ }
+
+ /* Update cursor X/Y position register, which contains
+ * all cursor position information except the number
+ * of scanlines hidden.
+ */
+ hbp_times_vi = (pScreenPriv->sprite.horizBackPorch *
+ pScreenPriv->sprite.videoInterleave);
+ xHi = ((x0 + hbp_times_vi) / pScreenPriv->sprite.videoInterleave)
+ - pScreenPriv->sprite.pipelineDelay;
+ if (pScreenPriv->deviceID != S9000_ID_ARTIST)
+ xLo = x0 % pScreenPriv->sprite.videoInterleave;
+ else
+ xLo = (x0 + hbp_times_vi) % pScreenPriv->sprite.videoInterleave;
+
+ /* if y0 < 0, y0 has already been set to 0 above */
+ cursorXYValue =
+ ( (xHi << 19)
+ | (xLo << 16)
+ | (pScreenPriv->sprite.maxYLine - y0)
+ );
+
+ /* Now update number of cursor scan lines hidden.
+ * It's in same register as the enable cursor bit, and this macro
+ * also enables cursor, but this position cursor routine is only
+ * called if cursor is visible.
+ */
+ ENABLE_CURSOR(pScreenPriv, cursorXYValue, nOffscreenScanlines);
+ }
+ }
+ }
+} /* ngleMoveSprite() */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglecursor.h b/xc/programs/Xserver/hw/hp/ngle/nglecursor.h
new file mode 100644
index 000000000..58f22de72
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglecursor.h
@@ -0,0 +1,143 @@
+/* $XConsortium: nglecursor.h,v 1.2 95/01/24 02:07:13 dpw Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains various macros, typedefs and extern declarations
+ * concerning cursors (both sprites and echoes).
+ *
+ ******************************************************************************/
+
+#ifndef NGLECURSOR_H
+#define NGLECURSOR_H
+
+
+/* The following is the maximum width/height supported by the NGLE cursor
+ * hardware:
+ */
+#define NGLE_MAX_SPRITE_SIZE 64
+
+
+/*
+ ******************************************************************************
+ **
+ ** NGLE DDX Driver's Sprite Structure:
+ **
+ ******************************************************************************
+ */
+typedef struct _NgleSpriteRec
+{
+ /* The sprite's state - visible or not visible */
+ Int32 visible;
+
+ /* Location of the sprite's hotspot relative to the screen's origin: */
+ Int32 x;
+ Int32 y;
+
+ /* Pointer to currently installed cursor struct: */
+ CursorPtr pCursor;
+
+ /* See the comment fairly early on in ngleDisplayCursor: */
+ Int32 firstCallTo_DisplayCursor;
+
+ /* Hardware values that affect cursor positioning.
+ * Read in at X11 startup.
+ */
+ Card32 horizBackPorch;
+ Card32 maxYLine;
+ Card32 pipelineDelay;
+ Card32 videoInterleave;
+
+ /* Value of hardware register value written at cursor enable */
+ Card32 enabledCursorXYValue;
+
+ /* Save current cursor width and height. When new cursor requested,
+ * old cursor's structures (pointed to by pCursor above) may already
+ * have been de-allocated. Used to minimize scanlines that must be written.
+ */
+ Int32 height;
+ Int32 width;
+
+ /* Cursor Y position adjustment */
+ Int32 nTopPadLines;
+
+ /* Value related to nTopPadLines: should cursor only be moved
+ * while vertical blank is in progress?
+ *
+ * Set in ngleDisplayCursor() and used in ENABLE_CURSOR macro.
+ */
+ Bool moveOnVBlank;
+
+} NgleSpriteRec, *NgleSpritePtr;
+
+
+/*
+ ******************************************************************************
+ **
+ ** Macros to Access the NGLE DDX Driver's Sprite Structure:
+ **
+ ******************************************************************************
+ */
+
+#define NGLE_SPRITE_FROM_SCREEN(pScreen)\
+ (NGLE_SCREEN_PRIV(pScreen)->pSprite)
+
+#define NGLE_SPRITE_FROM_SCREEN_PRIV(pScreenPriv)\
+ ((pScreenPriv)->pSprite)
+
+
+/*
+ ******************************************************************************
+ **
+ ** NGLE DDX Driver's Cursor Internally-Visible Extern Declarations:
+ **
+ ******************************************************************************
+ */
+extern Bool ngleInitSprite();
+extern Bool hyperInitSprite();
+extern Bool ngleUninitSprite();
+
+extern void ngleDisableSprite();
+extern void ngleChangeScreen();
+
+extern Bool ngleDisplayCursor();
+extern Bool hyperDisplayCursor();
+extern void ngleRecolorCursor();
+
+extern Bool ngleSetCursorPosition();
+extern void ngleMoveSprite();
+
+/* Shared HP routines for the cursor: */
+extern void hpCursorLimits();
+extern void hpConstrainCursor();
+extern Bool hpSetCursorPosition();
+
+
+/* The number of scanlines that must be left blank in order to end the
+ * ghosting/tearing problem has been empirically determined to be 12.
+ */
+#define NTOPLINES_FOR_TIMBER 12
+
+#endif /* NGLECURSOR_H */
diff --git a/xc/programs/Xserver/hw/hp/ngle/ngledevrom.h b/xc/programs/Xserver/hw/hp/ngle/ngledevrom.h
new file mode 100644
index 000000000..c221bc373
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/ngledevrom.h
@@ -0,0 +1,79 @@
+/* $XConsortium: ngledevrom.h,v 1.1 93/08/08 12:57:21 rws Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * This header file contains the structure definition
+ * of this device-dependent ROM area, after values have
+ * been packed (actual ROM is only 1-byte wide, so each
+ * long only contains a byte of data).
+ *
+ ******************************************************************************/
+
+
+#ifndef DEVDEPROM_H
+#define DEVDEPROM_H
+
+/* On HP-UX ioctl(fildes, GCDESCRIBE returns pointer to device-dependent
+ * ROM area in crt_region[1]
+ */
+#define NGLEDEVDEPROM_CRT_REGION 1
+
+
+typedef char rom_byte_t;
+typedef short rom_short_t;
+typedef long rom_long_t;
+typedef void *rom_addr_t;
+
+typedef struct {
+ rom_long_t video_config_reg;
+ rom_long_t misc_video_start;
+ rom_long_t horiz_timing_fmt;
+ rom_long_t serr_timing_fmt;
+ rom_long_t vert_timing_fmt;
+ rom_long_t horiz_state;
+ rom_long_t vert_state;
+ rom_long_t vtg_state_elements;
+ rom_long_t pipeline_delay;
+ rom_long_t misc_video_end;
+ } video_setup_t;
+
+typedef struct {
+ rom_short_t sizeof_ngle_data;
+ rom_short_t x_size_visible; /* visible screen dim in pixels */
+ rom_short_t y_size_visible;
+
+ rom_short_t pad2[15];
+
+ rom_short_t cursor_pipeline_delay;
+ rom_short_t video_interleaves;
+
+ rom_long_t pad3[11];
+
+ } ngle_rom_t;
+
+typedef ngle_rom_t NgleDevRomDataRec;
+typedef ngle_rom_t *NgleDevRomDataPtr;
+#endif /* DEVDEPROM_H */
diff --git a/xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07 b/xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07
new file mode 100644
index 000000000..88972ebaa
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/ngledoblt.o.8.07
Binary files differ
diff --git a/xc/programs/Xserver/hw/hp/ngle/ngleextern.h b/xc/programs/Xserver/hw/hp/ngle/ngleextern.h
new file mode 100644
index 000000000..5a07303e6
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/ngleextern.h
@@ -0,0 +1,46 @@
+/* $XConsortium: ngleextern.h,v 1.1 93/08/08 12:57:27 rws Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains globally-visible extern declarations for the
+ * NGLE DDX Driver.
+ *
+ ******************************************************************************/
+
+#ifndef NGLEEXTERN
+#define NGLEEXTERN
+
+
+/*
+ ******************************************************************************
+ **
+ ** Extern declarations:
+ **
+ ******************************************************************************
+ */
+extern Bool ngleScreenInit();
+
+#endif /* NGLEEXTERN */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglehdw.h b/xc/programs/Xserver/hw/hp/ngle/nglehdw.h
new file mode 100644
index 000000000..74be49d58
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglehdw.h
@@ -0,0 +1,523 @@
+/* $XConsortium: nglehdw.h,v 1.3 95/01/24 01:58:28 dpw Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+ *
+ *************************************************************************/
+
+
+#ifndef NGLEHDW_H /*[ NGLEHDW_H */
+#define NGLEHDW_H
+
+/* Define pointer to NGLE registers */
+#ifndef DREGS_PTR
+#define DREGS_PTR pDregs
+#endif
+
+#define NGLE_LOCK(pScreenPriv)
+#define NGLE_UNLOCK(pScreenPriv)
+
+#define NGLE_READ32(source) ((long)(source))
+#define NGLE_WRITE32(dest, data) ((dest) = (long)(data))
+
+typedef ngle_dregs_t NgleHdwRec;
+typedef ngle_dregs_t *NgleHdwPtr;
+
+#define SETUP_HW(pDregs) \
+{ \
+ char stat; \
+ volatile char * pstat = &((pDregs)->reg15.b.b0); \
+ do { \
+ stat = *pstat; \
+ if (!stat) \
+ stat = *pstat; \
+ } while(stat); \
+}
+
+#define SETUP_FB(pDregs, ID, depth) \
+{ \
+ SETUP_HW(pDregs); \
+ switch (ID) \
+ { \
+ case S9000_ID_ARTIST: \
+ case S9000_ID_A1659A: \
+ (pDregs)->reg10 = 0x13601000; \
+ break; \
+ case S9000_ID_A1439A: \
+ if (depth == 24) \
+ (pDregs)->reg10 = 0xBBA0A000; \
+ else /* depth = 8 */ \
+ (pDregs)->reg10 = 0x13601000; \
+ break; \
+ case S9000_ID_HCRX: \
+ if (depth == 24) \
+ (pDregs)->reg10 = 0xBBA0A000; \
+ else /* depth = 8 */ \
+ (pDregs)->reg10 = 0x13602000; \
+ break; \
+ case S9000_ID_TIMBER: \
+ case CRX24_OVERLAY_PLANES: \
+ (pDregs)->reg10 = 0x13602000; \
+ break; \
+ } \
+ (pDregs)->reg14.all = 0x83000300; \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg16.b.b1 = 1; \
+}
+
+#ifdef HPUX_ANSIC_ACKNOWLEDGES_VOLATILE_STRUCTURE /* [ */
+#define GET_FIFO_SLOTS( cnt, numslots) \
+{ \
+ while (cnt < numslots) \
+ { \
+ cnt = DREGS_PTR->reg34.all; \
+ } \
+ cnt -= numslots; \
+}
+#else /* Compiler does not treat pDregs as volatile ][ use local volatile */
+#define GET_FIFO_SLOTS( cnt, numslots) \
+{ \
+ volatile unsigned long * pHwFifoFreeCnt = &(DREGS_PTR->reg34.all); \
+ while (cnt < numslots) \
+ { \
+ cnt = *pHwFifoFreeCnt; \
+ } \
+ cnt -= numslots; \
+}
+#endif /* Use local volatile ] */
+
+#define START_CURSOR_COLORMAP_ACCESS(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg10 = 0xBBE0F000; \
+ (pDregs)->reg14.all = 0x03000300; \
+ (pDregs)->reg13 = ~0; \
+ (pDregs)->reg3 = 0; \
+ (pDregs)->reg4 = 0; \
+ (pDregs)->reg4 = 0; \
+ }
+
+#define WRITE_CURSOR_COLOR(pDregs,color) { \
+ (pDregs)->reg4 = (color); \
+ }
+
+#define FINISH_CURSOR_COLORMAP_ACCESS(pDregs,ID,depth) { \
+ (pDregs)->reg2 = 0; \
+ if (ID == S9000_ID_ARTIST) \
+ (pDregs)->reg26 = 0x80008004; \
+ else \
+ (pDregs)->reg1 = 0x80008004; \
+ SETUP_FB(pDregs,ID,depth); \
+ }
+
+#define START_IMAGE_COLORMAP_ACCESS(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg10 = 0xBBE0F000; \
+ (pDregs)->reg14.all = 0x03000300; \
+ (pDregs)->reg13 = ~0; \
+ }
+
+#define WRITE_IMAGE_COLOR(pDregs, index, color) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg3 = ((0x100+index) << 2); \
+ (pDregs)->reg4 = (color); \
+ }
+
+#define FINISH_IMAGE_COLORMAP_ACCESS(pDregs, ID, depth) { \
+ (pDregs)->reg2 = 0x400; \
+ if (depth == 24) \
+ (pDregs)->reg1 = 0x83000100; \
+ else /* depth = 8 */ \
+ { \
+ if (ID == S9000_ID_ARTIST) \
+ (pDregs)->reg26 = 0x80000100; \
+ else \
+ (pDregs)->reg1 = 0x80000100; \
+ } \
+ SETUP_FB(pDregs, ID, depth); \
+ }
+
+#define GET_CURSOR_SPECS(pDregs,pScreenPriv) { \
+ Card32 activeLinesHi, activeLinesLo; \
+ \
+ if ((pScreenPriv)->deviceID != S9000_ID_ARTIST) \
+ (pScreenPriv)->sprite.horizBackPorch = (pDregs)->reg19.b.b1; \
+ else \
+ (pScreenPriv)->sprite.horizBackPorch = (pDregs)->reg19.b.b1 + \
+ (pDregs)->reg19.b.b2 + \
+ 2; \
+ activeLinesLo = (pDregs)->reg20.b.b0; \
+ activeLinesHi = ((pDregs)->reg21.b.b2) & 0xf; \
+ (pScreenPriv)->sprite.maxYLine = ((activeLinesHi << 8) \
+ |(activeLinesLo & 0xff)); \
+ }
+
+#define START_CURSOR_MASK_ACCESS(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg14.all = 0x00000300; \
+ (pDregs)->reg13 = ~0; \
+ (pDregs)->reg11 = 0x28A07000; \
+ (pDregs)->reg3 = 0; \
+ }
+
+#define START_CURSOR_DATA_ACCESS(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg14.all = 0x00000300; \
+ (pDregs)->reg11 = 0x28A06000; \
+ (pDregs)->reg3 = 0; \
+ }
+
+#define WRITE_CURSOR_BITS(pDregs,word1,word2) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg4 = (word1); \
+ (pDregs)->reg5 = (word2); \
+ }
+
+#define ENABLE_CURSOR(pScreenPriv, cursorXYValue, nOffscreenScanlines) { \
+ (pScreenPriv)->sprite.enabledCursorXYValue = (cursorXYValue);\
+ if ((pScreenPriv)->sprite.moveOnVBlank) { \
+ while (((pScreenPriv)->pDregs->reg21.all) & 0x00040000); \
+ while (!(((pScreenPriv)->pDregs->reg21.all) \
+ & 0x00040000)); \
+ } \
+ SETUP_HW(pScreenPriv->pDregs); \
+ (pScreenPriv)->pDregs->reg17.all = (cursorXYValue); \
+ (pScreenPriv)->pDregs->reg18.all = \
+ (0x80 | nOffscreenScanlines); \
+ }
+
+#define DISABLE_CURSOR(pScreenPriv) { \
+ volatile unsigned long *pDregsCursorXY = \
+ &((pScreenPriv)->pDregs->reg17.all); \
+ long enabledCursorValue = \
+ (pScreenPriv)->sprite.enabledCursorXYValue; \
+ \
+ SETUP_HW((pScreenPriv)->pDregs); \
+ if ((pScreenPriv)->deviceID != S9000_ID_ARTIST) \
+ *pDregsCursorXY = (enabledCursorValue & 0xe007ffff); \
+ else \
+ (pScreenPriv)->pDregs->reg18.all = \
+ (enabledCursorValue & 0x0000003f); \
+ }
+
+#define GET_ROMTABLE_INDEX(romTableIdx) { \
+ (romTableIdx) = pDregs->reg16.b.b3 - 1; \
+ }
+
+#define SETUP_RAMDAC(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *) (((Card32) pDregs) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *(pAuxControlSpace + (0x20>>2)) = 0x04000000; \
+ *(pAuxControlSpace + (0x28>>2)) = 0xff000000; \
+ }
+
+#define CRX24_SETUP_RAMDAC(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *) (((Card32) pDregs) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *(pAuxControlSpace) = 0x04000000; \
+ *(pAuxControlSpace+1) = 0x02000000; \
+ *(pAuxControlSpace+2) = 0xff000000; \
+ *(pAuxControlSpace) = 0x05000000; \
+ *(pAuxControlSpace+1) = 0x02000000; \
+ *(pAuxControlSpace+2) = 0x03000000; \
+ }
+
+#define HCRX_SETUP_RAMDAC(pDregs) { \
+ NGLE_WRITE32(pDregs->reg32,0xffffffff); \
+ }
+
+#define CRX24_SET_OVLY_MASK(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg11 = 0x13a02000; \
+ (pDregs)->reg14.all = 0x03000300; \
+ (pDregs)->reg3 = 0x000017f0; \
+ (pDregs)->reg13 = 0xffffffff; \
+ (pDregs)->reg22 = (long) (~0UL); \
+ (pDregs)->reg23 = 0x0; \
+ }
+
+
+#define ENABLE_DISPLAY(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *)(((Card32)(pDregs)) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *(pAuxControlSpace + (0x30>>2)) = 0x06000000; \
+ *(pAuxControlSpace + (0x38>>2)) = 0x43000000; \
+ }
+
+#define DISABLE_DISPLAY(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *)(((Card32)(pDregs)) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *(pAuxControlSpace + (0x30>>2)) = 0x06000000; \
+ *(pAuxControlSpace + (0x38>>2)) = 0x03000000; \
+ }
+
+#define CRX24_ENABLE_DISPLAY(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *)(((Card32)(pDregs)) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *pAuxControlSpace = 0x01000000; \
+ *(pAuxControlSpace+1) = 0x02000000; \
+ *(pAuxControlSpace+2) = 0x10000000; \
+ }
+
+#define CRX24_DISABLE_DISPLAY(pDregs) { \
+ volatile Card32 *pAuxControlSpace; \
+ \
+ pAuxControlSpace = (Card32 *)(((Card32)(pDregs)) + 0x1000); \
+ SETUP_HW(pDregs); \
+ *pAuxControlSpace = 0x01000000; \
+ *(pAuxControlSpace+1) = 0x02000000; \
+ *(pAuxControlSpace+2) = 0x30000000; \
+ }
+
+#define ARTIST_ENABLE_DISPLAY(pDregs) { \
+ volatile unsigned long *pDregsMiscVideo = \
+ &((pDregs)->reg21.all); \
+ volatile unsigned long *pDregsMiscCtl = \
+ &((pDregs)->reg27.all); \
+ \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg21.all = *pDregsMiscVideo | 0x0A000000; \
+ (pDregs)->reg27.all = *pDregsMiscCtl | 0x00800000; \
+ }
+
+#define ARTIST_DISABLE_DISPLAY(pDregs) { \
+ volatile unsigned long *pDregsMiscVideo = \
+ &((pDregs)->reg21.all); \
+ volatile unsigned long *pDregsMiscCtl = \
+ &((pDregs)->reg27.all); \
+ \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg21.all = *pDregsMiscVideo & ~0x0A000000; \
+ (pDregs)->reg27.all = *pDregsMiscCtl & ~0x00800000; \
+ }
+
+#define HYPER_CONFIG_PLANES_24 0x00000100
+#define IS_24_DEVICE(pScreenPriv) \
+ (pScreenPriv->deviceSpecificConfig & HYPER_CONFIG_PLANES_24)
+
+#define IS_888_DEVICE(pScreenPriv) (!(IS_24_DEVICE(pScreenPriv)))
+
+#define HYPER_CURSOR_DATA_BIT 0x80
+#define HYPER_CURSOR_ENABLE_BIT 0x80000000
+
+#define HYPER_SET_CURSOR_ADDRESS(value) \
+ NGLE_WRITE32(DREGS_PTR->reg30, (value))
+
+#define HYPER_WRITE_CURSOR_DATA(value) \
+ NGLE_WRITE32(DREGS_PTR->reg31, (value))
+
+#define HYPER_CURSOR_XY(x,y) \
+ (((x<0)?(((-x & 0xfff) | 0x1000)<<16):((x & 0xfff)<<16)) | \
+ ((y<0)?((-y & 0xfff) | 0x1000):(y & 0x1fff)));
+
+#define HYPER_ENABLE_CURSOR(pScreenPriv, hypCursorXYValue) \
+{ \
+ /* Only called if cursor is visible */ \
+ assert(pScreenPriv->sprite.visible == TRUE); \
+ \
+ /* Save value written for use by disable cursor */\
+ pScreenPriv->sprite.enabledCursorXYValue = (hypCursorXYValue);\
+ NGLE_WRITE32(pScreenPriv->pDregs->reg29.all, (hypCursorXYValue) | \
+ HYPER_CURSOR_ENABLE_BIT); \
+ \
+}
+
+#define HYPER_DISABLE_CURSOR(pScreenPriv) \
+{ \
+ long enabledCursorValue = pScreenPriv->sprite.enabledCursorXYValue; \
+ \
+ NGLE_WRITE32(pScreenPriv->pDregs->reg29.all, (enabledCursorValue & \
+ ~(HYPER_CURSOR_ENABLE_BIT))); \
+}
+
+/* Macros for controlling cursor position, used in ngleMoveSprite() */
+#define HYPER_ACCEL_BUSY_DODGER_IDLE \
+ ((NGLE_READ32(DREGS_PTR->reg15.all) & 0xc001000) == 0x00010000)
+
+ /* not FIFO paced */
+#define HYPER_CPC(pScreenPriv,bifCursorXYValue) \
+ pScreenPriv->sprite.enabledCursorXYValue = (bifCursorXYValue); \
+ NGLE_WRITE32(DREGS_PTR->reg17.all, \
+ (bifCursorXYValue) | HYPER_CURSOR_ENABLE_BIT);
+
+ /* FIFO paced */
+#define HYPER_FIFO_CP(pScreenPriv,hypCursorXYValue) \
+ GET_FIFO_SLOTS(nFreeFifoSlots,2); \
+ HYPER_GET_VID_BUS_ACCESS; \
+ HYPER_ENABLE_CURSOR(pScreenPriv, hypCursorXYValue);
+
+#define HYPER_GET_VID_BUS_ACCESS \
+ NGLE_WRITE32(DREGS_PTR->reg28,0);
+
+#define HYPER_ENABLE_DISPLAY(pDregs) \
+{ \
+ volatile unsigned long *pDregsHypMiscVideo = \
+ &((pDregs)->reg33); \
+ \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg33 = *pDregsHypMiscVideo | 0x0A000000; \
+}
+
+#define HYPER_DISABLE_DISPLAY(pDregs) \
+{ \
+ volatile unsigned long *pDregsHypMiscVideo = \
+ &((pDregs)->reg33); \
+ \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg33 = *pDregsHypMiscVideo & ~0x0A000000; \
+}
+
+/* define the various BufferNumber used by SETUP_ATTR_ACCESS */
+#define BUFF0_CMAP0 0x00001e02
+#define BUFF1_CMAP0 0x02001e02
+#define BUFF1_CMAP3 0x0c001e02
+#define ARTIST_CMAP0 0x00000102
+#define HYPER_CMAP8 0x00000100
+#define HYPER_CMAP24 0x00000800
+
+#define SETUP_ATTR_ACCESS(pDregs,BufferNumber) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg11 = 0x2EA0D000; \
+ (pDregs)->reg14.all = 0x23000302; \
+ (pDregs)->reg12 = (BufferNumber); \
+ (pDregs)->reg8 = 0xffffffff; \
+ }
+
+#define SET_ATTR_SIZE(pDregs,Width,Height) { \
+ (pDregs)->reg6.all = 0; \
+ (pDregs)->reg9.all = (Card32)(((Width)<<16)|(Height)); \
+ (pDregs)->reg6.all = 0x05000000; \
+ (pDregs)->reg9.all = 0x00040001; \
+ }
+
+#define FINISH_ATTR_ACCESS(pDregs) { \
+ SETUP_HW(pDregs); \
+ (pDregs)->reg12 = 0; \
+ }
+
+#define SETUP_COPYAREA(pDregs) \
+ (pDregs)->reg16.b.b1 = 0;
+
+#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */
+#define Otc04 2 /* Pixels in each longword transfer (4) */
+#define Otc32 5 /* Pixels in each longword transfer (32) */
+#define Ots08 3 /* Each pixel is size (8)d transfer (1) */
+#define OtsIndirect 6 /* Each bit goes through FG/BG color(8) */
+#define AddrLong 5 /* FB address is Long aligned (pixel) */
+#define BINovly 0x2 /* 8 bit overlay */
+#define BINapp0I 0x0 /* Application Buffer 0, Indexed */
+#define BINapp1I 0x1 /* Application Buffer 1, Indexed */
+#define BINapp0F8 0xa /* Application Buffer 0, Fractional 8-8-8 */
+#define BINattr 0xd /* Attribute Bitmap */
+#define RopSrc 0x3
+#define BitmapExtent08 3 /* Each write hits ( 8) bits in depth */
+#define BitmapExtent32 5 /* Each write hits (32) bits in depth */
+#define DataDynamic 0 /* Data register reloaded by direct access */
+#define MaskDynamic 1 /* Mask register reloaded by direct access */
+#define MaskOtc 0 /* Mask contains Object Count valid bits */
+
+#define MaskAddrOffset(offset) (offset)
+#define StaticReg(en) (en)
+#define BGx(en) (en)
+#define FGx(en) (en)
+
+#define BAJustPoint(offset) (offset)
+#define BAIndexBase(base) (base)
+#define BA(F,C,S,A,J,B,I) \
+ (((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+
+#define IBOvals(R,M,X,S,D,L,B,F) \
+ (((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+
+#define NGLE_QUICK_SET_IMAGE_BITMAP_OP(val) \
+ NGLE_WRITE32(DREGS_PTR->reg14.all, val)
+
+#define NGLE_QUICK_SET_DST_BM_ACCESS(val) \
+ NGLE_WRITE32(DREGS_PTR->reg11, val)
+
+#define NGLE_QUICK_SET_CTL_PLN_REG(val) \
+ NGLE_WRITE32(DREGS_PTR->reg12, val)
+
+#define NGLE_REALLY_SET_IMAGE_PLANEMASK(plnmsk32) \
+ NGLE_WRITE32(DREGS_PTR->reg13, plnmsk32)
+
+#define NGLE_REALLY_SET_IMAGE_FG_COLOR(fg32) \
+ NGLE_WRITE32(DREGS_PTR->reg35,fg32)
+
+#define NGLE_LONG_FB_ADDRESS(fbaddrbase, x, y) (void *) ( \
+ (unsigned long) (fbaddrbase) + \
+ ( \
+ (unsigned int) ( (y) << 13 ) | \
+ (unsigned int) ( (x) << 2 ) \
+ ) \
+ )
+
+#define NGLE_BINC_SET_DSTADDR(addr) \
+ NGLE_WRITE32(DREGS_PTR->reg3, (addr))
+
+#define NGLE_BINC_SET_SRCADDR(addr) \
+ NGLE_WRITE32(DREGS_PTR->reg2, (addr))
+
+#define NGLE_BINC_SET_DSTMASK(mask) \
+ NGLE_WRITE32(DREGS_PTR->reg22, (mask))
+
+#define NGLE_BINC_WRITE32(data32) \
+ NGLE_WRITE32(DREGS_PTR->reg23, (data32))
+
+#define NGLE_MFGP_REGISTER_TYPE dreg_cplx_t
+#define NGLE_MFGP_REGISTER_TYPE_ASLONG(ngleMfgpReg) ngleMfgpReg.all
+
+#define NGLE_SET_TRANSFERDATA(trandata32) \
+ NGLE_WRITE32(DREGS_PTR->reg8, (trandata32))
+
+#define HYPER_SET_LENXY_START_FAST_RECFILL(value) \
+ NGLE_WRITE32(DREGS_PTR->reg37.all, (value))
+
+#define NGLE_SET_LENXY_START_RECFILL(lenxy32) \
+ NGLE_WRITE32(DREGS_PTR->reg9.all, (lenxy32))
+
+#define SET_LENXY_START_RECFILL(lenxy32) \
+ NGLE_SET_LENXY_START_RECFILL(NGLE_MFGP_REGISTER_TYPE_ASLONG(lenxy32))
+
+#define NGLE_SET_SCOREBOARD_OVERRIDE(data32)
+/*
+ NGLE_WRITE32(DREGS_PTR->bifSBO, data32)
+*/
+#define NGLE_SET_DSTXY(xy32) \
+ NGLE_WRITE32(DREGS_PTR->reg6.all, (xy32))
+
+#define PACK_2CARD16(dest32, highcard16, lowcard16) \
+ dest32.w.high = (highcard16); \
+ dest32.w.low = (lowcard16);
+
+#define START_COLORMAPLOAD(cmapBltCtlData32) \
+ NGLE_WRITE32(pDregs->reg38, (cmapBltCtlData32))
+
+#endif /* NGLEHDW_H ]*/
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglenoop.c b/xc/programs/Xserver/hw/hp/ngle/nglenoop.c
new file mode 100644
index 000000000..d65e035bd
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglenoop.c
@@ -0,0 +1,68 @@
+/* $XConsortium: nglenoop.c,v 1.1 93/08/08 12:57:40 rws Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *
+ *************************************************************************/
+
+/* This file contains stub procedures that do nothing or very little. */
+
+#ifndef MISC_H
+#include "misc.h"
+#endif /* MISC_H */
+#include "nglenoop.h"
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleNoop()
+ *
+ * Description:
+ *
+ * This routine does nothing. It is useful for stubbing out a procedure
+ * pointer for a procedure that doesn't return anything.
+ *
+ ******************************************************************************/
+
+void ngleNoop()
+{
+} /* ngleNoop() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleNoopTrue()
+ *
+ * Description:
+ *
+ * This routine just returns TRUE. It is useful for stubbing out a
+ * procedure pointer for a procedure that returns a boolean value
+ * where that value should be returned as TRUE.
+ *
+ ******************************************************************************/
+
+Bool ngleNoopTrue()
+{
+ return(TRUE);
+} /* ngleNoopTrue() */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglenoop.h b/xc/programs/Xserver/hw/hp/ngle/nglenoop.h
new file mode 100644
index 000000000..0133b9279
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglenoop.h
@@ -0,0 +1,36 @@
+/* $XConsortium: nglenoop.h,v 1.1 93/08/08 12:57:46 rws Exp $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *
+ *************************************************************************/
+
+
+/*
+ ******************************************************************************
+ **
+ ** Extern declarations for Sprite Noop/stub procedures:
+ **
+ ******************************************************************************
+ */
+
+extern void ngleNoop();
+extern Bool ngleNoopTrue();
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglescreen.c b/xc/programs/Xserver/hw/hp/ngle/nglescreen.c
new file mode 100644
index 000000000..5fa420269
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglescreen.c
@@ -0,0 +1,2095 @@
+/* $TOG: nglescreen.c /main/4 1997/11/11 15:45:50 msr $ */
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *
+ *************************************************************************/
+
+/* $XFree86: xc/programs/Xserver/hw/hp/ngle/nglescreen.c,v 1.3 1998/10/04 09:38:31 dawes Exp $ */
+
+/******************************************************************************
+ *
+ * This file contains various global variables and routines concerning
+ * the Screen structure. This includes the ngleScreenInit routine.
+ *
+ ******************************************************************************/
+
+
+#include "ngle.h"
+
+#define DEFAULT_CRX_MONITOR_DIAGONAL 19 /* inches */
+#define LOWRES_CRX_MONITOR_DIAGONAL 16 /* inches */
+
+#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES 4
+#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE 8
+#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE 10
+#define HYPERBOWL_MODE2_8_24 15
+
+/* Can this graphics device be an ITE console?
+ * Most all NGLE graphics devices can be.
+ * The sole exception at this point (May'91) is the right-head of
+ * the Dual CRX card; only the left head can be an ITE console.
+ *
+ * The answer to this question is used to determine
+ * whether to issue ioctl(GCON) at startup and ioctl(GCTERM)
+ * at server exit (only should be done if ITE may be present).
+ *
+ * Answer is encoded in bit 2 of device file's minor number.
+ *
+ */
+#define IS_NOT_FIRST_HEAD_ON_THIS_SGC_SLOT(devMinorNumber) \
+ (devMinorNumber & 0x00000004)
+
+
+
+/******************************************************************************
+ *
+ * Extern and Forward Declarations:
+ *
+ ******************************************************************************/
+
+extern double sqrt(double);
+extern int monitorResolution;
+extern int cfbScreenPrivateIndex;
+extern int cfb32ScreenPrivateIndex;
+
+#ifdef HP_FAST_SCROLLING
+/* The following are the extern declarations for the GCOps tables that
+ * CFB sets up and uses. If CFB changes the GCOps tables it uses, or
+ * adds any, this driver will also have to mirror those changes.
+ */
+extern GCOps cfbTEOps1Rect;
+extern GCOps cfbNonTEOps1Rect;
+extern GCOps cfbTEOps;
+extern GCOps cfbNonTEOps;
+
+extern GCOps cfb32TEOps1Rect;
+extern GCOps cfb32NonTEOps1Rect;
+extern GCOps cfb32TEOps;
+extern GCOps cfb32NonTEOps;
+#endif
+
+
+extern Bool (*ddxScreenInitPointer[])();
+extern hpPrivPtr hpPrivates[MAXSCREENS];
+extern Bool hyperResetPlanes();
+
+Int32 ngleScreenPrivIndex = 0;
+
+/* FORWARD (procedures defined below in this file) */
+
+static void hyperSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv);
+
+static void rattlerSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv);
+
+static void ngleSetupAttrPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 BufferNumber);
+
+static void elkSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv);
+
+static Bool ngleClearScreen(
+ ScreenPtr pScreen);
+
+static Bool ngleSaveScreen(
+ ScreenPtr pScreen,
+ Bool on);
+
+static void ngleBlankOrUnblankScreen(
+ NgleScreenPrivPtr pScreenPriv,
+ Bool doBlank);
+
+static Bool ngleCloseScreen();
+
+static void nglePolyPaintAttr(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 ctlPlaneReg,
+ Int32 nBoxes,
+ BoxPtr pBoxes);
+
+/* OWN */
+
+static Card32 ngleScreenPrivGeneration = 0;
+static Card32 cfbDualHeadBug = 0;
+static Int32 cfbFirstIndex = 0;
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: duplicateDeviceFileInScreensFile()
+ *
+ * Description: check if device file number of this screen has already
+ * been opened by this server.
+ *
+ * The least significant bit is masked before checking for duplicates
+ * because:
+ * - This bit is used to distingish overlay from image plane sets.
+ * (Odd == overlay, by the way).
+ *
+ ******************************************************************************/
+
+static Bool duplicateDeviceFileInScreensFile(
+ int myIndex,
+ int myMajorAndMinorDeviceNumber,
+ int *duplicateLine)
+{
+ int i;
+ hpPrivPtr php;
+ struct stat statInfo;
+
+ if (myIndex == 0)
+ {
+ return(FALSE);
+ }
+ else
+ {
+ for (i = 0; i < myIndex; i++)
+ {
+
+ if (ddxScreenInitPointer[i] && (i != myIndex)) /* DDX screen */
+ {
+ php = hpPrivates[i];
+ if(stat(php->StandardDevice,&statInfo) < 0) continue;
+
+ if ((statInfo.st_rdev & 0xfffffffe)
+ == (myMajorAndMinorDeviceNumber & 0xfffffffe))
+ {
+ *duplicateLine = (hpPrivates[myIndex])->LineNumber;
+ return (TRUE);
+ }
+ }
+ }
+ return(FALSE);
+ }
+} /* duplicateDeviceFileInScreensFile() */
+
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: calculateDPI
+ *
+ * Description: Returns the value to use for dpi for this monitor.
+ *
+ ******************************************************************************
+ */
+
+static int calculateDPI(
+ int xsize, int ysize,
+ int diagonal_length)
+{
+ static int old_diagonal_length = 0;
+ int dpi = 0;
+ double f_diagonal_length = 1.0;
+ double f_num_diagonal_pix;
+
+ f_num_diagonal_pix = sqrt((double)((xsize * xsize + ysize * ysize)));
+
+ if (diagonal_length < 0)
+ {
+ FatalError("Incorrect monitor size specified in your /user/lib/X11/Xnscreens file.\n");
+ }
+ if (diagonal_length == 0)
+ /* either first time (use default value) OR subsequent call
+ (use old value) */
+ {
+ if (!(old_diagonal_length))
+ /* first time */
+ {
+ diagonal_length = DEFAULT_CRX_MONITOR_DIAGONAL;
+ }
+ else
+ /* second or subsequent use */
+ {
+ diagonal_length = old_diagonal_length;
+ }
+ }
+ if(monitorResolution != 0)
+ dpi = monitorResolution;
+ else
+ if ((diagonal_length > 0) && (diagonal_length <= 100))
+ /* assume it's inches -- subtract 1 inch */
+ {
+ dpi = (int)(f_num_diagonal_pix / (((double)diagonal_length) - 1.0));
+ /* along the diagonal */
+ }
+ else if ((diagonal_length > 100) && (diagonal_length <= 1000))
+ {
+ /* assume it's millimeters -- subtract 25.4 mm */
+
+ f_diagonal_length = (double)(diagonal_length - 25.4);
+
+ dpi = (int)((f_num_diagonal_pix / f_diagonal_length) * 25.4);
+
+ }
+ else
+ {
+ FatalError("Incorrect monitor size specified in your /user/lib/X11/Xnscreens file.\n");
+ }
+
+ old_diagonal_length = diagonal_length;
+ return(dpi);
+} /* calculateDPI */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: ngleGetDeviceRomData()
+ *
+ * Description: Return pointer to in-memory structure holding
+ * ELK device-dependent ROM values.
+ *
+ ******************************************************************************/
+
+static NgleDevRomDataPtr ngleGetDeviceRomData(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ crt_frame_buffer_t gcDescribe;
+ Card32 *pBytePerLongDevDepData;/* data byte == LSB */
+ Card32 *pRomTable;
+ NgleDevRomDataPtr pPackedDevRomData;
+ Int32 sizePackedDevRomData = sizeof(NgleDevRomDataRec);
+ Card8 *pCard8;
+ Int32 i;
+ Card8 *mapOrigin = (Card8 *) NULL;
+ Int32 fildes = pScreenPriv->fildes;
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+ Int32 romTableIdx;
+
+
+ /* Allocate space for packed structure */
+ pPackedDevRomData = (NgleDevRomDataPtr) Xcalloc(sizePackedDevRomData);
+
+ /* Get information about the device from the kernel: */
+ if (ioctl(fildes, GCDESCRIBE, &gcDescribe) == -1)
+ {
+ /* 3rd parm is dontcare on s700, ptr to 0 on s400 */
+ ioctl(fildes, GCUNMAP, &mapOrigin);
+ close(fildes);
+ FatalError("File %s: unable to get kernel description of display.\n",
+ __FILE__);
+ }
+
+ SETUP_HW(pDregs);
+
+ if (pScreenPriv->deviceID == S9000_ID_ARTIST)
+ {
+ pPackedDevRomData->cursor_pipeline_delay = 4;
+ pPackedDevRomData->video_interleaves = 4;
+ }
+ else
+ {
+ /* Get pointer to unpacked byte/long data in ROM */
+ pBytePerLongDevDepData = (Card32 *)
+ gcDescribe.crt_region[NGLEDEVDEPROM_CRT_REGION];
+
+ /* Tomcat supports several resolutions: 1280x1024, 1024x768, 640x480.
+ * This code reads the index into a device dependent ROM array
+ * containing the device's currently selected resolution.
+ */
+ if (pScreenPriv->deviceID == S9000_ID_TOMCAT)
+ {
+ /* jump to the correct ROM table */
+ GET_ROMTABLE_INDEX(romTableIdx);
+ while (romTableIdx > 0)
+ {
+ pCard8 = (Card8 *) pPackedDevRomData;
+ pRomTable = pBytePerLongDevDepData;
+ /* Pack every fourth byte from ROM into structure */
+ for (i = 0; i < sizePackedDevRomData; i++)
+ {
+ *pCard8++ = (Card8) (*pRomTable++);
+ }
+
+ pBytePerLongDevDepData = (Card32 *)
+ ((Card8 *) pBytePerLongDevDepData +
+ pPackedDevRomData->sizeof_ngle_data);
+
+ romTableIdx--;
+ }
+ }
+
+ pCard8 = (Card8 *) pPackedDevRomData;
+
+ /* Pack every fourth byte from ROM into structure */
+ for (i = 0; i < sizePackedDevRomData; i++)
+ {
+ *pCard8++ = (Card8) (*pBytePerLongDevDepData++);
+ }
+ }
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+ return(pPackedDevRomData);
+} /* ngleGetDeviceRomData() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: stringContainsString
+ *
+ * Description: Does string in parm1 contain string in parm2?
+ *
+ * Limitations:
+ * Case-sensitive
+ *
+ ******************************************************************************/
+
+static Bool stringContainsString(
+ char *pString,
+ char *pSubString)
+{
+ char *pCurPos = pString;
+ int len = strlen(pSubString);
+
+ while (pCurPos = (char *) strchr(pCurPos, pSubString[0]))
+ {
+ if (bcmp(pCurPos, pSubString, len) == 0)
+ return(TRUE);
+ else
+ pCurPos++;
+ }
+ return(FALSE);
+} /* stringContainsString */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: firstScreenOpenedOnThisSgcSlot()
+ *
+ * Description:
+ *
+ * Given the possibility of 2 heads on a Dual CRX being controlled
+ * by a single X server, is this screen the first screen on this
+ * SGC slot to be opened?
+ *
+ * Assumption:
+ * Procedure is actually used to determined whether this screen
+ * will be the LAST to CLOSE. This is valid assumption because
+ * Server closes devices in reverse order in which they were
+ * opened (first device opened is last device closed).
+ *
+ * So to restate: X server first opens device at index 0 and increments
+ * index. It closes highest numbered indexed device first and decrements,
+ * closing device at index 0 last.
+ *
+ * Limitations:
+ * Does NOT check for identical minor numbers (i.e, same device is
+ * listed more than once in X*screens file).
+ *
+ ******************************************************************************/
+
+static Bool firstScreenOpenedOnThisSgcSlot(
+ Int32 index, /* IN Current screen index */
+ dev_t devMinorNumber) /* IN of current device */
+{
+ int i;
+ hpPrivPtr php;
+ struct stat statInfo;
+
+ if (index == 0)
+ {
+ return(TRUE);
+ }
+ else
+ {
+ for (i = 0; i < index; i++)
+ {
+
+ if (ddxScreenInitPointer[i] && (i != index)) /* DDX screen */
+ {
+ php = hpPrivates[i];
+ if(stat(php->StandardDevice,&statInfo) < 0) continue;
+
+ /* Dual CRX convention: use bit 2 to indicate which head.
+ * And don't bother checking bit 0 and bit 1, which
+ * should always be zero for Dual CRX.
+ */
+ if ((statInfo.st_rdev&0xfffffff8)==(devMinorNumber&0xfffffff8))
+ {
+ return (FALSE);
+ }
+ }
+ }
+ return(TRUE);
+ }
+} /* firstScreenOpenedOnThisSgcSlot */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleScreenInit()
+ *
+ * Description:
+ *
+ * This routine implements pScreen->ScreenInit for the NGLE DDX Driver.
+ *
+ ******************************************************************************/
+
+Bool ngleScreenInit(
+ Int32 index,
+ ScreenPtr pScreen,
+ Int32 argc,
+ char **argv)
+{
+
+ NgleScreenPrivPtr pScreenPriv;
+ NgleHdwPtr pDregs;
+ struct stat statInfo;
+ hpPrivPtr php;
+ int duplicateLine;
+ int fildes;
+ unsigned char *mapOrigin;
+ Card8 *fbaddr;
+ crt_frame_buffer_t gcDescribe;
+ char *grayscaleEnvar = (char *) 0;
+ char *moveCursorEnvar = (char *) 0;
+ int monitorDiagonal = DEFAULT_CRX_MONITOR_DIAGONAL;
+ int dpi;
+ NgleDevRomDataPtr pDevRomData;
+ VisualPtr pVisuals;
+ int i;
+
+
+ /*
+ **************************************************************************
+ **
+ ** Allocate and Start Initializing the pScreenPriv Structure:
+ **
+ **************************************************************************
+ */
+
+ /* Allocate the private index for screen. */
+ if (ngleScreenPrivGeneration != serverGeneration)
+ {
+ if ((ngleScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
+ return(FALSE);
+ ngleScreenPrivGeneration = serverGeneration;
+ }
+
+ /* Allocate the screen private structure (pScreenPriv), zero it (just
+ * in case), point pScreen to it, and point it towards pScreen):
+ */
+ if (!(pScreenPriv = (NgleScreenPrivPtr) Xalloc(sizeof(NgleScreenPrivRec))))
+ return(FALSE);
+ bzero((char *) pScreenPriv, sizeof(NgleScreenPrivRec));
+ pScreen->devPrivates[ngleScreenPrivIndex].ptr = (pointer) pScreenPriv;
+
+ /* Initialize the HP Private Structure: */
+ php = (hpPrivPtr) hpPrivates[pScreen->myNum];
+ pScreen->devPrivate = (pointer) php;
+
+ pScreenPriv->pScreen = pScreen;
+ pScreenPriv->myNum = index;
+
+
+ /*
+ **************************************************************************
+ **
+ ** Open, Map, Init and Get Information about the Device:
+ **
+ ** Obtain values for these pScreenPriv fields via ioctl() calls:
+ ** - fildes (from open of device file)
+ ** - deviceID (from ioctl(GCDESCRIBE.crt_id)
+ ** - pDregs (from ioctl(GCDESCRIBE.crt_control_base)
+ ** - fbaddr (from ioctl(GCDESCRIBE.crt_frame_base)
+ **
+ **************************************************************************
+ */
+
+ /* Stat the file descriptor to see if the device exists: */
+ if(stat(php->StandardDevice, &statInfo) < 0)
+ {
+ char errorString[80];
+
+ FatalError("Unable to stat() device file \"%s\"!\n", php->StandardDevice);
+ }
+
+ /* Check for duplicate entries for the same device file */
+ if (duplicateDeviceFileInScreensFile(index, statInfo.st_rdev,
+ &duplicateLine))
+ {
+ ErrorLine(php);
+ ErrorF("Duplicate device entry in line %d.\n", duplicateLine);
+ FatalError("Cannot continue...\n");
+ }
+
+ /* Open the device file: */
+ if((fildes = open(php->StandardDevice, O_RDWR)) == -1)
+ {
+ FatalError("Unable to open() device file \"%s\"!\n", php->StandardDevice);
+ }
+ pScreenPriv->fildes = fildes;
+
+ mapOrigin = (Card8 *) NULL;
+
+ /* Map the framebuffer.
+ *
+ * Note that a given process can call GCMAP for the same SGC slot
+ * more than once without error (can occur with server mapping
+ * both heads of a DualCRX).
+ */
+ if (ioctl(fildes, GCMAP, &mapOrigin) == -1)
+ {
+ close(fildes);
+ FatalError("Unable to map graphics display into user space!\n");
+ }
+
+ /* Get information about the device from the kernel: */
+ if (ioctl(fildes, GCDESCRIBE, &gcDescribe) == -1)
+ {
+ ioctl(fildes, GCUNMAP, &mapOrigin);
+ close(fildes);
+ FatalError("Unable to get kernel description of display!\n");
+ }
+
+ /* Reject any device not in the NGLE family */
+ if ( (gcDescribe.crt_id != S9000_ID_A1659A) /* CRX */
+ && (gcDescribe.crt_id != S9000_ID_ELM) /* GRX */
+ && (gcDescribe.crt_id != S9000_ID_TIMBER) /* 710 Any */
+ && (gcDescribe.crt_id != S9000_ID_TOMCAT) /* Dual CRX */
+ && (gcDescribe.crt_id != S9000_ID_A1439A) /* CRX24 */
+ && (gcDescribe.crt_id != S9000_ID_ARTIST) /* Artist */
+ && (gcDescribe.crt_id != S9000_ID_HCRX) /* Hyperdrive */
+ )
+ {
+ ioctl(fildes, GCUNMAP, &mapOrigin);
+ close(fildes);
+ FatalError(
+ "Graphics device has a unrecognized graphics crt_id of 0x%08x!\n",
+ gcDescribe.crt_id);
+ }
+
+ /* Get some values from the gcDescribe structure:
+ * gcDescribe.crt_id:
+ * on s700, will equal 4 most significant bytes of graphics ID
+ * stored in Standard Text Interface ROM
+ * (offsets 0x0013, 0x0017, 0x001b, 0x001f of STI ROM).
+ * gcDescribe.crt_control_base:
+ * on all hpux systems, will point to start of control register
+ * space, skipping over 1MB of ROM space.
+ * gcDescribe.crt_frame_base:
+ * on all hpux systems, will point to start of framebuffer,
+ * offset 16MB from start of NGLE address space.
+ *
+ * For 2-headed devices such as Dual CRX, these pDregs and fbaddr
+ * settings will be overridden in the device-specific processing
+ * below (addresses of 2nd "right" head returned as crt_regions).
+ */
+ pScreenPriv->deviceID = gcDescribe.crt_id;
+ pScreenPriv->pDregs = pDregs
+ = (NgleHdwPtr) gcDescribe.crt_control_base;
+ pScreenPriv->fbaddr = (pointer) gcDescribe.crt_frame_base;
+ pScreenPriv->devWidth = gcDescribe.crt_total_x;
+ pScreenPriv->screenWidth = gcDescribe.crt_x;
+ pScreenPriv->screenHeight = gcDescribe.crt_y;
+
+ for (i=0; i < CRT_MAX_REGIONS; i++)
+ {
+ pScreenPriv->crt_region[i] = gcDescribe.crt_region[i];
+ }
+
+ /* Set the device frame buffer depth. The default depth is set to
+ * 8, but can be changed by setting the depth parameter in the
+ * Xnscreens file. Currently, we only support depth 24 on CRX24 & HCRX24,
+ * and depth 8 on the remaining displays.
+ */
+
+ if ((pScreenPriv->deviceID == S9000_ID_A1439A) ||
+ (pScreenPriv->deviceID == S9000_ID_HCRX))
+ pScreenPriv->devDepth = php->depth;
+ else
+ pScreenPriv->devDepth = 8;
+
+ if (pScreenPriv->deviceID == S9000_ID_TOMCAT)
+ {
+ /* If second "right" device, grab addresses of frame buffer
+ * and control space from crt_regions rather than the
+ * typical crt_frame_base and crt_control_base.
+ *
+ * Convention: bit 2 (third least significant bit) of
+ * device file's minor number == 1 indicates right device.
+ */
+ if (IS_NOT_FIRST_HEAD_ON_THIS_SGC_SLOT(statInfo.st_rdev))
+ {
+ pScreenPriv->pDregs
+ = pDregs
+ = (NgleHdwPtr) gcDescribe.crt_region[3];
+ pScreenPriv->fbaddr
+ = (pointer) gcDescribe.crt_region[2];
+ }
+ }
+
+
+ /* Graphics devices will typically call ioctl(CGUNMAP) at screen close.
+ *
+ * Exception: the second device on a Tomcat (Dual CRX),
+ * where "second" means that the other head on the same Dual CRX
+ * appears before it in the X*screens file.
+ *
+ * Set typical value here and allow overriding in device-specific
+ * processing below.
+ */
+ pScreenPriv->lastDeviceOnThisSgcToClose = TRUE;
+
+
+ /*
+ **************************************************************************
+ **
+ ** Device Dependent Initializations
+ **
+ **************************************************************************
+ */
+
+ pScreenPriv->pDevRomData = ngleGetDeviceRomData(pScreenPriv);
+
+ /* Device-specific settings */
+ switch (pScreenPriv->deviceID)
+ {
+ case S9000_ID_ELM: /* A1924 Gray-Scale GRX */
+
+ pScreenPriv->isGrayScale = TRUE;
+
+ /* Since A1924 is a grayscale CRX and the grayscale variable
+ * has just been set, set device ID
+ * to that of CRX so that the rest of the driver may
+ * appropriately consider this to be a CRX.
+ */
+ pScreenPriv->deviceID = S9000_ID_A1659A;
+ break;
+
+ case S9000_ID_HCRX: /* Hyperdrive */
+ /* Hyperdrive doesn't use STI ROM info so don't bother reading it */
+ pScreenPriv->pDevRomData = NULL; /* #### strange #### */
+ NGLE_LOCK(pScreenPriv);
+ {
+ CARD32 *sti_rom_address;
+ CARD32 temp;
+ /*
+ * In order to read the Hyperdrive configuration bits, we need to
+ * read the STI ROM. But, the STI ROM is not always mapped into
+ * the STI ROM space. Sometimes the STI ROM is mapped into the
+ * BOOT ROM space. To find the true STI ROM space, we need to
+ * look at the crt_region array in the gcDescribe structure.
+ * The STI ROM address will either be in entry 0 or entry 1.
+ * If entry 0 is mapped into the same space as the control space,
+ * then this is the true STI ROM space. If entry 0 is in another
+ * space, then entry 1 has the true STI ROM space. The space bits
+ * of the address are the upper 6 bits of the address. For example,
+ * if the address is 0xf4100000, then the space is 0xf4000000.
+ */
+ if (((CARD32) pScreenPriv->pDregs & 0xfc000000) ==
+ ((CARD32) pScreenPriv->crt_region[0] & 0xfc000000))
+ {
+ sti_rom_address = (CARD32 *) pScreenPriv->crt_region[0];
+ }
+ else
+ {
+ sti_rom_address = (CARD32 *) pScreenPriv->crt_region[1];
+ }
+
+ /*
+ * Ok, grab the configuration bits from the hardware. These bits
+ * come from Dodger and are added to any data read from the STI ROM.
+ * When reading the STI ROM, we need to avoid a potential race
+ * condition by doing a couple of things. We first need to read
+ * some unbuffered register like BIFF status. Next we need to wait
+ * for Dodger to go not busy. Then we can safely read the STI ROM.
+ */
+ temp = NGLE_READ32(pDregs->reg15.all);
+ SETUP_HW(pDregs);
+ pScreenPriv->deviceSpecificConfig = *sti_rom_address;
+ }
+ NGLE_UNLOCK(pScreenPriv);
+
+ pScreenPriv->isGrayScale = FALSE; /* No grayscale version */
+ break;
+
+ case S9000_ID_ARTIST: /* Artist */
+ case S9000_ID_A1439A: /* CRX24 */
+ case S9000_ID_A1659A: /* CRX */
+
+ pScreenPriv->isGrayScale = FALSE; /* No grayscale version */
+ break;
+
+ case S9000_ID_TIMBER: /* HP9000/710 Graphics */
+ /* There are 3 configurations, all with the
+ * same Graphics ID:
+ * - 1280x1024 Color
+ * - 1280x1024 Grayscale
+ * - 1024x768 Color.
+ * The difference in color resolutions is handled simply
+ * by using the width/height values in gcDescribe.
+ * Color vs. Grayscale is handled by placing the
+ * word "GRAYSCALE" in the crt_name returned in gcDescribe
+ * for grayscale Timber graphics devices.
+ */
+ /* Be color unless grayscale indicated in crt_name
+ */
+ if ( stringContainsString(gcDescribe.crt_name, "GRAYSCALE")
+ || stringContainsString(gcDescribe.crt_name, "Grayscale")
+ || stringContainsString(gcDescribe.crt_name, "grayscale"))
+ {
+ pScreenPriv->isGrayScale = TRUE;
+ }
+ else
+ {
+ pScreenPriv->isGrayScale = FALSE;
+ }
+ break;
+
+ case S9000_ID_TOMCAT: /* Dual CRX */
+
+ pScreenPriv->isGrayScale = FALSE;
+
+ /* If not the head first appearing in X*screens file:
+ * - set variable so ioctl(GCUNMAP) is not called at exit.
+ * - Initialize related screen pointers for this 2nd
+ * screen AND for related screen opened earlier.
+ */
+ if (!firstScreenOpenedOnThisSgcSlot(
+ index, statInfo.st_rdev))
+ {
+ pScreenPriv->lastDeviceOnThisSgcToClose = FALSE;
+ }
+
+ /* Dual CRX supports several resolutions: 1280x1024, 1024x768, 640x480.
+ * This code reads the BIFF scratch register to get the index into a
+ * device dependent ROM array containing the device's currently
+ * selected resolution.
+ */
+ pScreenPriv->screenWidth = pScreenPriv->pDevRomData->x_size_visible ;
+ pScreenPriv->screenHeight = pScreenPriv->pDevRomData->y_size_visible;
+
+ /* Since Tomcat is a 2-headed CRX and all Tomcat-specific
+ * processing has just been completed, set the device ID
+ * to that of CRX so that the rest of the driver may
+ * appropriately consider this to be a CRX.
+ */
+ pScreenPriv->deviceID = S9000_ID_A1659A;
+ break;
+
+ default:
+ FatalError("Undefined device id!\n");
+ break;
+ } /* switch (pScreenPriv->deviceID) */
+
+
+ /*
+ **************************************************************************
+ **
+ ** Perform ioctl() initialization of graphics device.
+ **
+ **************************************************************************
+ */
+
+ ioctl(fildes, GCSTATIC_CMAP, &mapOrigin);
+
+
+ /**************************************************************************
+ **
+ ** Set up the Ngle hardware in a byte-per-pixel mode.
+ **
+ **************************************************************************
+ */
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+
+ /**************************************************************************
+ **
+ ** Set up screen dimensions. These values are needed to pass
+ ** to cfbScreenInit().
+ **
+ **************************************************************************
+ */
+
+ /* Use the hp procedure to define the screen width and height,
+ * using the screen's diagonal, which defaults to 19" for CRX
+ * but may be overridden in the X*screens file "monitorsize <n>"
+ * parameter (in which case php->MonitorDiagonal is non-zero).
+ */
+ if (php->MonitorDiagonal != 0)
+ monitorDiagonal = php->MonitorDiagonal;
+ else
+ { /* A 1024x768 CRX (with same ID) may be offered.
+ * It will use 16" monitor. The following rule assumes
+ * that higher resolution versions will use 19" monitor
+ * (Currently the case with CRX and CRX24).
+ */
+ if (pScreenPriv->screenWidth <= 1024)
+ {
+ monitorDiagonal = LOWRES_CRX_MONITOR_DIAGONAL; /* 16 inches */
+ }
+ else
+ {
+ monitorDiagonal = DEFAULT_CRX_MONITOR_DIAGONAL; /* 19 inches */
+ }
+ }
+
+ dpi = calculateDPI( pScreenPriv->screenWidth, pScreenPriv->screenHeight,
+ monitorDiagonal);
+
+
+#ifdef HP_FAST_SCROLLING
+ /*
+ **************************************************************************
+ **
+ ** Change the CFB GCOpts tables to use our CopyArea routine
+ ** instead of the CFB version. Do this before calling and
+ ** CFB initialization code.
+ **
+ ** Note: If in the future, CFB adds / deletes / changes GCOpts
+ ** tables, respective changes will have to be made in this
+ ** code also.
+ **
+ **************************************************************************
+ */
+
+ cfbTEOps1Rect.CopyArea = ngleCopyArea8;
+ cfbNonTEOps1Rect.CopyArea = ngleCopyArea8;
+ cfbTEOps.CopyArea = ngleCopyArea8;
+ cfbNonTEOps.CopyArea = ngleCopyArea8;
+
+#ifndef LOWMEMFTPT
+ cfb32TEOps1Rect.CopyArea = ngleCopyArea24;
+ cfb32NonTEOps1Rect.CopyArea = ngleCopyArea24;
+ cfb32TEOps.CopyArea = ngleCopyArea24;
+ cfb32NonTEOps.CopyArea = ngleCopyArea24;
+#endif /* ifndef LOWMEMFTPT */
+#endif
+
+
+ /*
+ **************************************************************************
+ **
+ ** 11. Call pNgleScreenInit->InitMiscConfig to perform
+ ** device-dependent configuration and initialization
+ ** that does not change the hardware state.
+ **
+ ** FIRST READ-ONLY ACCESS TO HARDWARE BY SERVER
+ ** (not counting indirect access via kernel ioctl calls)
+ **************************************************************************
+ */
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ Card32 hyperbowl;
+ Int32 nFreeFifoSlots = 0;
+
+ /* Initialize Hyperbowl registers */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 7);
+ if (IS_24_DEVICE(pScreenPriv))
+ {
+ if (pScreenPriv->devDepth == 24)
+ hyperbowl = HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE;
+ else
+ hyperbowl = HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE;
+
+ /* First write to Hyperbowl must happen twice (bug) */
+ NGLE_WRITE32(pDregs->reg40, hyperbowl);
+ NGLE_WRITE32(pDregs->reg40, hyperbowl);
+
+ NGLE_WRITE32(pDregs->reg39, HYPERBOWL_MODE2_8_24);
+
+ NGLE_WRITE32(pDregs->reg42, 0x014c0148); /* Set lut 0 to be the direct color */
+ NGLE_WRITE32(pDregs->reg43, 0x404c4048);
+ NGLE_WRITE32(pDregs->reg44, 0x034c0348);
+ NGLE_WRITE32(pDregs->reg45, 0x444c4448);
+ }
+ else
+ {
+ hyperbowl = HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES;
+
+ /* First write to Hyperbowl must happen twice (bug) */
+ NGLE_WRITE32(pDregs->reg40, hyperbowl);
+ NGLE_WRITE32(pDregs->reg40, hyperbowl);
+
+ NGLE_WRITE32(pDregs->reg42, 0);
+ NGLE_WRITE32(pDregs->reg43, 0);
+ NGLE_WRITE32(pDregs->reg44, 0);
+ NGLE_WRITE32(pDregs->reg45, 0x444c4048);
+ }
+ }
+
+
+ /*
+ **************************************************************************
+ **
+ ** Call CFB routines to begin setting up of screen and
+ ** visual default values.
+ **
+ ** Call cfbScreenInit() to set up default pScreen values, but
+ ** first call cfbSetVisualTypes to only support a subset of the
+ ** possible visuals.
+ **
+ **************************************************************************
+ */
+
+#ifndef LOWMEMFTPT
+ if (pScreenPriv->devDepth == 8)
+#endif /* ifndef LOWMEMFTPT */
+ /* only support PseudoColor */
+ {
+ cfbSetVisualTypes (8, 1<<PseudoColor, 8);
+
+ cfbScreenInit(pScreen, pScreenPriv->fbaddr, pScreenPriv->screenWidth,
+ pScreenPriv->screenHeight, dpi, dpi,
+ pScreenPriv->devWidth);
+ }
+
+#ifndef LOWMEMFTPT
+ else /* depth = 24 */
+ /* only support Directcolor */
+ {
+ cfbSetVisualTypes (24, 1<<DirectColor, 8);
+
+ cfb32ScreenInit(pScreen, pScreenPriv->fbaddr, pScreenPriv->screenWidth,
+ pScreenPriv->screenHeight, dpi, dpi,
+ pScreenPriv->devWidth);
+ }
+
+#endif /* ifndef LOWMEMFTPT */
+
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * The following section of code is to correct a bug in the MIT-provided
+ * visual initialization code. CFB assumes that for a depth 24 display,
+ * all hardware writes the bits to the frame buffer in the blue - green -
+ * red order. For HP's Ngle family of depth 24 displays, we write
+ * them in RGB order, not GBR order. To correct this problem, I will
+ * change the affected values of the visual records to the correct
+ * values.
+ */
+
+ pVisuals = pScreen->visuals;
+ for (i = 1; i <= pScreen->numVisuals ; i++ )
+ {
+ if ((pVisuals->class == DirectColor) && (pVisuals->nplanes == 24))
+ {
+ /* correct the RGB masks and offsets that were set by */
+ /* cfbScreenInit(). */
+ pVisuals->redMask = 0xff0000;
+ pVisuals->greenMask = 0xff00;
+ pVisuals->blueMask = 0xff;
+ pVisuals->offsetRed = 16;
+ pVisuals->offsetGreen = 8;
+ pVisuals->offsetBlue = 0;
+ }
+ pVisuals++;
+ }
+
+
+ /*
+ * This section of code is to correct a bug in the CFB
+ * implementation of dual head support.
+ */
+
+ if (cfbDualHeadBug != serverGeneration)
+ {
+#ifndef LOWMEMFTPT
+ if (pScreenPriv->devDepth == 8)
+#endif /* ifndef LOWMEMFTPT */
+ cfbFirstIndex = cfbScreenPrivateIndex;
+#ifndef LOWMEMFTPT
+ else
+ cfbFirstIndex = cfb32ScreenPrivateIndex;
+#endif /* ifndef LOWMEMFTPT */
+
+ cfbDualHeadBug = serverGeneration;
+ }
+ else
+ {
+#ifndef LOWMEMFTPT
+ if (pScreenPriv->devDepth == 8)
+#endif /* ifndef LOWMEMFTPT */
+ pScreen->devPrivates[cfbFirstIndex].ptr =
+ pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
+#ifndef LOWMEMFTPT
+ else
+ pScreen->devPrivates[cfbFirstIndex].ptr =
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr;
+#endif /* ifndef LOWMEMFTPT */
+
+#ifndef LOWMEMFTPT
+ cfbScreenPrivateIndex = cfb32ScreenPrivateIndex = cfbFirstIndex;
+#else
+ cfbScreenPrivateIndex = cfbFirstIndex;
+#endif /* ifndef LOWMEMFTPT */
+ }
+
+
+ /*
+ **************************************************************************
+ **
+ ** Fill in Many of the pScreen Procedure Pointers and Values:
+ **
+ **************************************************************************
+ */
+
+ /**** Random screen procedures: ****/
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = ngleCloseScreen;
+ pScreen->SaveScreen = ngleSaveScreen;
+
+ /**** Colormap Procedures: ****/
+ pScreen->CreateColormap = ngleCreateColormap;
+ pScreen->DestroyColormap = ngleDestroyColormap;
+ pScreen->InstallColormap = ngleInstallColormap;
+ pScreen->UninstallColormap = ngleUninstallColormap;
+ pScreen->ListInstalledColormaps = ngleListInstalledColormaps;
+ pScreen->StoreColors = ngleStoreColors;
+ pScreen->ResolveColor = ngleResolvePseudoColor;
+
+
+ /*
+ **************************************************************************
+ **
+ ** Set White and Black Pixel.
+ **
+ **************************************************************************
+ */
+
+ /* Set the pixel index for the default black pixel and white pixel.
+ * Used to be always 0 and 1, respectively, but with gray scale
+ * default colormap ramping from 1 to 255, it made sense to make
+ * 255 the white pixel.
+ */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ if (pScreenPriv->isGrayScale)
+ {
+ pScreen->whitePixel = 255;
+ }
+ else if (pScreenPriv->devDepth == 24)
+ {
+ pScreen->blackPixel = 0x000000;
+ pScreen->whitePixel = 0xffffff;
+ }
+
+
+ /*
+ **************************************************************************
+ **
+ ** Fill in Many Parts of the Screen Private Structure that
+ ** haven't been filled in yet:
+ **
+ **************************************************************************
+ */
+
+ /* Allow user to override driver control over whether
+ * cursors are moved only during vertical blank.
+ */
+ pScreenPriv->moveCursorOnVBlank = CURSOR_AT_VBLANK_DRIVEROPTION;
+
+ moveCursorEnvar = getenv("HPGCRX_MOVE_CURSOR_ON_VBLANK");
+ if ( (strcmp(moveCursorEnvar, "FALSE") == 0)
+ || (strcmp(moveCursorEnvar, "False") == 0)
+ || (strcmp(moveCursorEnvar, "false") == 0)
+ || (strcmp(moveCursorEnvar, "0") == 0))
+ {
+ pScreenPriv->moveCursorOnVBlank = CURSOR_AT_VBLANK_NEVER;
+ }
+ else
+ {
+ if ( (strcmp(moveCursorEnvar,"TRUE") == 0)
+ || (strcmp(moveCursorEnvar,"True") == 0)
+ || (strcmp(moveCursorEnvar,"true") == 0)
+ || (strcmp(moveCursorEnvar,"1") == 0))
+ {
+ pScreenPriv->moveCursorOnVBlank = CURSOR_AT_VBLANK_ALWAYS;
+ }
+ }
+
+
+ /*
+ **************************************************************************
+ **
+ ** Initialize the Colormap Structures and Code:
+ **
+ ** Causes default colormap to be loaded into hardware,
+ ** so must follow general hardware setup.
+ **
+ **************************************************************************
+ */
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ ngleCreateDefColormap(pScreen);
+
+
+ /*
+ **************************************************************************
+ **
+ ** Initialize the Cursor (Sprite and Echo) Structures, Code,
+ ** and pScreen procedure pointers for cursors:
+ **
+ **************************************************************************
+ */
+
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ hyperInitSprite(pScreen);
+ }
+ else
+ {
+ ngleInitSprite(pScreen);
+ }
+
+ /*
+ **************************************************************************
+ **
+ ** 20. Call hyperResetPlanes() to initialize the image,
+ ** overlay and attribute planes. This includes doing what is
+ ** necessary to counteract what the ITE has done
+ **
+ **************************************************************************
+ */
+
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ hyperResetPlanes(pScreenPriv, SERVER_INIT);
+ }
+
+ /* Initialize the non HCRX image planes. */
+
+ /* On CRX24, ITE has set up overlay planes to be 3-plane
+ * device. Set up overlays to be 8 planes and write all
+ * pixels to transparent. Then set up the framebuffer colormap
+ * to use all 8 bits.
+ *
+ * On CRX, set up the framebuffer colormap to use
+ * all 8 bits.
+ */
+
+ else if (pScreenPriv->deviceID == S9000_ID_A1439A) /* CRX24 */
+ {
+ rattlerSetupPlanes(pScreenPriv);
+ }
+ else if ((pScreenPriv->deviceID == S9000_ID_A1659A) || /* CRX or GRX */
+ (pScreenPriv->deviceID == S9000_ID_ARTIST) /* Artist */
+ )
+ {
+ elkSetupPlanes(pScreenPriv);
+ }
+
+ /* Clear attribute planes on non HCRX devices.
+ */
+ if ((pScreenPriv->deviceID == S9000_ID_A1659A) || /* CRX or GRX */
+ (pScreenPriv->deviceID == S9000_ID_A1439A) || /* CRX24 */
+ (pScreenPriv->deviceID == S9000_ID_ARTIST) /* Artist */
+ )
+ {
+ if (pScreenPriv->devDepth == 24)
+ ngleSetupAttrPlanes(pScreenPriv, BUFF1_CMAP3);
+ else /* depth = 8 */
+ if (pScreenPriv->deviceID == S9000_ID_ARTIST)
+ ngleSetupAttrPlanes(pScreenPriv, ARTIST_CMAP0);
+ else
+ ngleSetupAttrPlanes(pScreenPriv, BUFF1_CMAP0);
+ }
+
+ /*
+ **************************************************************************
+ **
+ ** Initialize screen saver:
+ **
+ **************************************************************************
+ */
+
+ /* Make sure video blank enable is turned off. Could happen in
+ * rare case: kill -9 of blanked X server (ngleCloseScreen
+ * code not executed).
+ */
+ ngleBlankOrUnblankScreen(pScreenPriv, SCREEN_SAVER_OFF);
+
+
+ /*
+ **************************************************************************
+ **
+ ** Put the Ngle hardware into a byte-per-pixel state:
+ **
+ **************************************************************************
+ */
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+
+ /*
+ **************************************************************************
+ **
+ ** If we got to here, ngleScreenInit() was successful and we
+ ** should return TRUE:
+ **
+ **************************************************************************
+ */
+ return(TRUE);
+
+} /* ngleScreenInit() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: elkSetupPlanes
+ *
+ ******************************************************************************/
+
+static void elkSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ /**********************************************
+ * Write RAMDAC pixel read mask register so all overlay
+ * planes are display-enabled. (CRX uses Bt458 pixel
+ * read mask register).
+ **********************************************/
+ SETUP_RAMDAC(pDregs);
+
+ SETUP_FB(pDregs, pScreenPriv->deviceID, pScreenPriv->devDepth);
+
+} /* elkSetupPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: rattlerSetupPlanes
+ *
+ ******************************************************************************/
+
+static void rattlerSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+ Int32 x, y;
+ Card32 *bits;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ /**********************************************
+ * Write RAMDAC pixel read mask register so all overlay
+ * planes are display-enabled. (CRX24 uses Bt462 pixel
+ * read mask register for overlay planes, not image planes).
+ **********************************************/
+ CRX24_SETUP_RAMDAC(pDregs);
+
+ SETUP_FB(pDregs, CRX24_OVERLAY_PLANES, pScreenPriv->devDepth);
+
+ for (y=0; y < pScreenPriv->screenHeight; y++)
+ {
+ bits = (Card32 *) ((char *)pScreenPriv->fbaddr + y *
+ pScreenPriv->devWidth);
+ x = pScreenPriv->screenWidth >> 2;
+ do
+ {
+ *bits++ = 0xffffffff;
+ } while (x--);
+ }
+
+ CRX24_SET_OVLY_MASK(pDregs);
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+} /* rattlerSetupPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: hyperSetupPlanes
+ *
+ ******************************************************************************/
+
+static void hyperSetupPlanes(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+ Int32 x, y;
+ Card32 *bits;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ /**************************************************
+ ** Need to clear screen
+ **************************************************/
+/*
+ if (IS_24_DEVICE(pScreenPriv))
+ ngleDepth24_ClearImagePlanes(pScreenPriv);
+ else
+ ngleDepth8_ClearImagePlanes(pScreenPriv);
+
+*/
+ /**********************************************
+ * Write RAMDAC pixel read mask register so all overlay
+ * planes are display-enabled. (CRX24 uses Bt462 pixel
+ * read mask register for overlay planes, not image planes).
+ **********************************************/
+ HCRX_SETUP_RAMDAC(pDregs);
+
+
+ SETUP_FB(pDregs, S9000_ID_HCRX, pScreenPriv->devDepth);
+
+ for (y=0; y < pScreenPriv->screenHeight; y++)
+ {
+ bits = (Card32 *) ((char *)pScreenPriv->fbaddr + y *
+ pScreenPriv->devWidth);
+ x = pScreenPriv->screenWidth >> 2;
+ do
+ {
+ *bits++ = 0xffffffff;
+ } while (x--);
+ }
+
+ CRX24_SET_OVLY_MASK(pDregs);
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+} /* hyperSetupPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: ngleSetupAttrPlanes
+ *
+ ******************************************************************************/
+
+static void ngleSetupAttrPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 BufferNumber)
+{
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+
+ SETUP_ATTR_ACCESS(pDregs, BufferNumber);
+
+ SET_ATTR_SIZE(pDregs, pScreenPriv->screenWidth, pScreenPriv->screenHeight);
+
+ FINISH_ATTR_ACCESS(pDregs);
+
+ SETUP_FB(pDregs, pScreenPriv->deviceID, pScreenPriv->devDepth);
+
+} /* ngleSetupAttrPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleClearScreen()
+ *
+ * Description:
+ *
+ * This local routine clears the screen to all zeroes.
+ * (this is not speed-critical routine - used only at server exit)
+ * Slow but thorough technique: clear both application buffers
+ * and for Ratter, overlay planes as well.
+ *
+ ******************************************************************************/
+
+static Bool ngleClearScreen(
+ ScreenPtr pScreen)
+{
+ NgleScreenPrivPtr pScreenPriv;
+ Int32 x, y;
+ Card32 *bits;
+
+ pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+
+ if (pScreenPriv->devDepth == 24) /* depth 24 - need different writes */
+ {
+ for(y=0; y<pScreenPriv->screenHeight; y++)
+ {
+ bits = (Card32 *)((char *)pScreenPriv->fbaddr +
+ (y * pScreenPriv->devWidth * 4));
+ x = pScreenPriv->screenWidth;
+ do {
+ *bits++ = 0;
+ } while(--x);
+ }
+ }
+ else /* depth 8 */
+ {
+ for(y=0; y<pScreenPriv->screenHeight; y++)
+ {
+ bits = (Card32 *)((char *)pScreenPriv->fbaddr + y * pScreenPriv->devWidth);
+ x = pScreenPriv->screenWidth >> 2;
+ do {
+ *bits++ = 0;
+ } while(--x);
+ }
+ }
+
+ /* Clear attribute planes on Hyperdrive, Artist, CRX, CRX24 and GRX devices.
+ */
+ if ((pScreenPriv->deviceID == S9000_ID_A1659A) || /* CRX or GRX */
+ (pScreenPriv->deviceID == S9000_ID_A1439A) || /* CRX24 */
+ (pScreenPriv->deviceID == S9000_ID_ARTIST) || /* Artist */
+ (pScreenPriv->deviceID == S9000_ID_HCRX) /* Hyperdrive */
+ )
+ {
+ ngleSetupAttrPlanes(pScreenPriv, BUFF0_CMAP0);
+ }
+} /* ngleClearScreen() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleBlankOrUnblankScreen
+ *
+ * Description:
+ *
+ * This routine is intended to be called by pScreen->SaveScreen
+ * (a DDX entry point), as well as at server entry and exit.
+ *
+ * Video for pScreen is turned on or off, depending on 2nd parameter.
+ *
+ ******************************************************************************/
+
+static void ngleBlankOrUnblankScreen(
+ NgleScreenPrivPtr pScreenPriv,
+ Bool blankOrUnblank)
+{
+ NgleHdwPtr pDregs = pScreenPriv->pDregs;
+
+
+ if (blankOrUnblank == SCREEN_SAVER_ON)
+ {
+ /* Turn on screen blanking (i.e. blank the screen) */
+
+ /* Disable cursor */
+ ngleDisableSprite(pScreenPriv->pScreen);
+
+ /* Disable image display by enabling display of
+ * color 0 of the cursor. Action accomplished
+ * by writing commands to AUX interface. Since
+ * CRX24 and CRX/Timber/Tomcat use different
+ * Brooktree DAC parts, the commands written vary.
+ */
+ if (pScreenPriv->deviceID == S9000_ID_A1439A)
+ { /* CRX24 */
+
+ CRX24_DISABLE_DISPLAY(pDregs);
+ }
+ else if (pScreenPriv->deviceID == S9000_ID_ARTIST)
+ {
+ ARTIST_DISABLE_DISPLAY(pDregs);
+ }
+ else if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ HYPER_DISABLE_DISPLAY(pDregs);
+ }
+ else
+ { /* CRX and like elk */
+ DISABLE_DISPLAY(pDregs);
+ }
+ }
+ else /* if (blankOrUnblank == SCREEN_SAVER_OFF) */
+ { /* Turn off screen blanking */
+
+ /* If the cursor is on this screen, display it.
+ * An HP input procedure (hp/hp/x_hil.c:process_motion())
+ * maintains a variable indicating which screen has the cursor.
+ */
+ extern int hpActiveScreen; /* active screen index in x_hil.c */
+ if (pScreenPriv->myNum == hpActiveScreen)
+ {
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ hyperDisplayCursor(pScreenPriv->pScreen,
+ pScreenPriv->sprite.pCursor);
+ }
+ else
+ {
+ ngleDisplayCursor(pScreenPriv->pScreen,
+ pScreenPriv->sprite.pCursor);
+ }
+ }
+
+ /* Enable image display by disabling display of
+ * color 0 of the cursor.
+ */
+ if (pScreenPriv->deviceID == S9000_ID_A1439A)
+ { /* CRX24 */
+ CRX24_ENABLE_DISPLAY(pDregs);
+ }
+ else if (pScreenPriv->deviceID == S9000_ID_ARTIST)
+ {
+ ARTIST_ENABLE_DISPLAY(pDregs);
+ }
+ else if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ HYPER_ENABLE_DISPLAY(pDregs);
+ }
+ else
+ { /* CRX and like elk */
+ ENABLE_DISPLAY(pDregs);
+ }
+ }
+
+ SETUP_FB(pDregs,pScreenPriv->deviceID,pScreenPriv->devDepth);
+
+} /* ngleBlankOrUnblankScreen() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleSaveScreen()
+ *
+ * Description:
+ *
+ * This routine is intended to implement pScreen->SaveScreen,
+ * a DDX entry point. Video for pScreen is turned on or off,
+ * depending on parameter "on".
+ *
+ * A lower-level procedure is called to actually perform
+ * the blanking or unblanking.
+ *
+ ******************************************************************************/
+
+static Bool ngleSaveScreen(
+ ScreenPtr pScreen,
+ Bool on)
+{
+ hpPrivPtr php;
+ NgleScreenPrivPtr pScreenPriv;
+
+
+ pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ php = (hpPrivPtr)pScreen->devPrivate;
+
+ if (on == SCREEN_SAVER_ON)
+ { /* Blank screen */
+
+ if (php->isSaved) return(TRUE);
+ php->isSaved = TRUE;
+
+ ngleBlankOrUnblankScreen(pScreenPriv, SCREEN_SAVER_ON);
+ }
+ else
+ { /* Uninstall the screen saver: */
+
+ if (!php->isSaved) return(TRUE);
+ php->isSaved = FALSE;
+
+ ngleBlankOrUnblankScreen(pScreenPriv, SCREEN_SAVER_OFF);
+ }
+
+ return(TRUE);
+
+} /* ngleSaveScreen() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleCloseScreen()
+ *
+ * Description:
+ *
+ * This routine implements pScreen->CloseScreen for the NGLE DDX Driver.
+ *
+ ******************************************************************************/
+
+static Bool ngleCloseScreen(index, pScreen)
+
+ Int32 index; /* Screen index */
+ ScreenPtr pScreen; /* Pointer to screen */
+{
+ NgleScreenPrivPtr pScreenPriv;
+ hpPrivPtr php;
+ Card8 *mapOrigin;
+ Int32 retVal;
+
+
+ pScreenPriv = NGLE_SCREEN_PRIV(pScreen);
+ php = (hpPrivPtr)pScreen->devPrivate;
+
+ /* If exiting rather than just resetting, remove cursor and clear */
+ if (hpGivingUp)
+ {
+ (*php->CursorOff)(pScreen);
+ if (pScreenPriv->deviceID == S9000_ID_HCRX)
+ {
+ hyperResetPlanes(pScreenPriv, SERVER_EXIT);
+ }
+ else
+ {
+ ngleClearScreen(pScreen);
+ }
+ }
+
+ /* Turn off screen saver (if on) */
+ ngleSaveScreen(pScreen, SCREEN_SAVER_OFF);
+
+ /* Allow ITE to change the colormap */
+ ioctl(pScreenPriv->fildes, GCVARIABLE_CMAP, &mapOrigin);
+
+ /* Use new and improved ITE soft reset which is almost
+ * finished but doesn't have a header file yet
+ *
+ * Only issue at server exit, not server recycle.
+ *
+ * For multi-headed device (Tomcat), only issue if left head
+ * (which is only head that can be an ITE console on Tomcat).
+ */
+#define GCTERM _IOWR('G',20,int)
+ if ((hpGivingUp) &&
+ (!IS_NOT_FIRST_HEAD_ON_THIS_SGC_SLOT(pScreenPriv->dev_sc)))
+ {
+ int garbage=0;
+ ioctl(pScreenPriv->fildes, GCTERM, &garbage);
+ }
+
+
+ /* Release NGLE control space */
+ mapOrigin = (Card8 *) 0;
+
+ /* If a multi-headed device, only unmap framebuffer if
+ * last device on the SGC card to close.
+ */
+ if (pScreenPriv->lastDeviceOnThisSgcToClose)
+ {
+ if (ioctl(pScreenPriv->fildes, GCUNMAP, &mapOrigin) < 0)
+ return(FALSE);
+ }
+
+ /* Free data structures */
+ ngleUninitSprite(pScreen);
+ Xfree(hpPrivates[index]);
+
+ close(pScreenPriv->fildes);
+
+ /* Free NGLE private structure */
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ Xfree(pScreenPriv);
+
+ return (*pScreen->CloseScreen)(index, pScreen);
+
+} /* ngleCloseScreen() */
+
+
+/******************************************************************************
+ *
+ * And now for some new routines to handle HCRX8 and HCRX24
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleDepth8_ClearImagePlanes()
+ *
+ * Description:
+ *
+ * This routine clears the image planes for depth 8 devices.
+ *
+ * Assumptions:
+ * Assumptions fast-locking has been initialized.
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+void ngleDepth8_ClearImagePlanes(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+ NGLE_MFGP_REGISTER_TYPE packedLenXY;
+ NGLE_MFGP_REGISTER_TYPE packedDstXY;
+ Int32 nFreeFifoSlots = 0;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ NGLE_LOCK(pScreenPriv);
+
+ /* Common Hardware setup */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 5);
+
+ /* Re-use dstX/Y and transfer data for multiple recfills. */
+ NGLE_SET_SCOREBOARD_OVERRIDE(0x30003);
+ NGLE_SET_TRANSFERDATA(0xffffffff); /* Write foreground color */
+
+ NGLE_REALLY_SET_IMAGE_FG_COLOR(0);
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(0xff);
+
+ PACK_2CARD16(packedDstXY, 0, 0);
+ PACK_2CARD16(packedLenXY, pScreenPriv->screenWidth,
+ pScreenPriv->screenHeight);
+ NGLE_SET_DSTXY(NGLE_MFGP_REGISTER_TYPE_ASLONG(packedDstXY));
+
+ /* Device-specific image buffer clear */
+ switch(pScreenPriv->deviceID)
+ {
+ case S9000_ID_ARTIST:
+ /* Write zeroes to buffer */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 3);
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(
+ IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(FALSE),
+ DataDynamic, MaskOtc, BGx(FALSE), FGx(FALSE)));
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp0I, BAIndexBase(0)));
+ SET_LENXY_START_RECFILL(packedLenXY);
+ break;
+
+ case S9000_ID_A1659A: /* ELK_DEVICE_ID */
+ /* Write zeroes to buffer 0 */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 3);
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(
+ IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(FALSE),
+ DataDynamic, MaskOtc, BGx(FALSE), FGx(FALSE)));
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp0I, BAIndexBase(0)));
+ SET_LENXY_START_RECFILL(packedLenXY);
+
+ /* Write zeroes to buffer 1 */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp1I, BAIndexBase(0)));
+ SET_LENXY_START_RECFILL(packedLenXY);
+ break;
+
+ case S9000_ID_HCRX:
+ /* Write zeroes to buffer 0 */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 3);
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(FALSE),
+ MaskDynamic, MaskOtc,
+ BGx(TRUE), FGx(FALSE)));
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp0I, BAIndexBase(0)));
+ HYPER_SET_LENXY_START_FAST_RECFILL(packedLenXY.all);
+
+ /* Write zeroes to buffer 1 */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp1I, BAIndexBase(0)));
+ HYPER_SET_LENXY_START_FAST_RECFILL(packedLenXY.all);
+ break;
+
+ /* There is no default */
+ } /* Device-specific image buffer clear */
+
+ NGLE_UNLOCK(pScreenPriv);
+
+} /* ngleDepth8_ClearImagePlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Utility Procedure: ngleDepth24_ClearImagePlanes
+ *
+ * Description:
+ *
+ * This routine clears all 24 image planes to zeroes.
+ *
+ * Assumptions:
+ * Assumptions fast-locking has been initialized.
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+void ngleDepth24_ClearImagePlanes(
+ NgleScreenPrivPtr pScreenPriv)
+{
+ NgleHdwPtr pDregs;
+ NGLE_MFGP_REGISTER_TYPE packedLenXY;
+ NGLE_MFGP_REGISTER_TYPE packedDstXY;
+ Int32 nFreeFifoSlots = 0;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ NGLE_LOCK(pScreenPriv);
+
+ /* Hardware setup */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 8);
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA(IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINapp0F8, BAIndexBase(0)));
+ NGLE_SET_SCOREBOARD_OVERRIDE(0);
+ NGLE_SET_TRANSFERDATA(0xffffffff); /* Write foreground color */
+
+ NGLE_REALLY_SET_IMAGE_FG_COLOR(0); /* load with zero */
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(0xffffff);
+
+ PACK_2CARD16(packedDstXY, 0, 0);
+ PACK_2CARD16(packedLenXY, pScreenPriv->screenWidth,
+ pScreenPriv->screenHeight);
+ NGLE_SET_DSTXY(NGLE_MFGP_REGISTER_TYPE_ASLONG(packedDstXY));
+
+ /* Write zeroes to all 24 planes of image buffer */
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent32, StaticReg(FALSE),
+ DataDynamic, MaskOtc, BGx(FALSE), FGx(FALSE)));
+ SET_LENXY_START_RECFILL(packedLenXY);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+} /* ngleDepth24_ClearImagePlanes */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleClearOverlayPlanes()
+ *
+ * Description:
+ *
+ * This routine "clears" the overlay planes to the pased in value.
+ *
+ * Assumptions:
+ * Assumptions fast-locking has been initialized.
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+void ngleClearOverlayPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 planeMask,
+ Card32 planeData)
+{
+ NgleHdwPtr pDregs;
+ NGLE_MFGP_REGISTER_TYPE packedLenXY;
+ NGLE_MFGP_REGISTER_TYPE packedDstXY;
+ Int32 nFreeFifoSlots = 0;
+
+ pDregs = (NgleHdwPtr) pScreenPriv->pDregs;
+
+ NGLE_LOCK(pScreenPriv);
+
+ /* Hardware setup */
+ GET_FIFO_SLOTS(nFreeFifoSlots, 8);
+ NGLE_QUICK_SET_DST_BM_ACCESS(
+ BA( IndexedDcd, Otc32, OtsIndirect, AddrLong,
+ BAJustPoint(0), BINovly, BAIndexBase(0)));
+ NGLE_SET_SCOREBOARD_OVERRIDE(0);
+ NGLE_SET_TRANSFERDATA(0xffffffff); /* Write foreground color */
+
+ NGLE_REALLY_SET_IMAGE_FG_COLOR(planeData); /* fill with input data value */
+ NGLE_REALLY_SET_IMAGE_PLANEMASK(planeMask);
+
+ PACK_2CARD16(packedDstXY, 0, 0);
+ PACK_2CARD16(packedLenXY, pScreenPriv->screenWidth,
+ pScreenPriv->screenHeight);
+ NGLE_SET_DSTXY(NGLE_MFGP_REGISTER_TYPE_ASLONG(packedDstXY));
+
+ /* Write zeroes to overlay planes. */
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(
+ IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(FALSE),
+ DataDynamic, MaskOtc, BGx(FALSE), FGx(FALSE)));
+ SET_LENXY_START_RECFILL(packedLenXY);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+} /* ngleClearOverlayPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: ngleResetAttrPlanes()
+ *
+ * Description:
+ *
+ * This routine resets the attribute planes to an initial state.
+ *
+ * Assumptions:
+ * Assumptions fast-locking has been initialized.
+ * Does not assume a lock is in effect.
+ *
+ ******************************************************************************/
+
+void ngleResetAttrPlanes(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 controlPlaneReg)
+{
+ BoxRec box;
+
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreenPriv->screenWidth;
+ box.y2 = pScreenPriv->screenHeight;
+ nglePolyPaintAttr(pScreenPriv, controlPlaneReg, 1, &box);
+
+} /* ngleResetAttrPlanes() */
+
+
+
+/******************************************************************************
+ *
+ * NGLE DDX Procedure: nglePolyPaintAttr()
+ *
+ * Description:
+ *
+ * This routine is called by other NGLE DDX driver routines to perform
+ * a series of solid color, rectangle fills of the attribute plane(s).
+ *
+ * Useful comments about attribute painting:
+ *
+ * The Control Plane Register (CPR) is the equivalent of
+ * foreground and background pixel registers for the attribute
+ * planes.
+ *
+ * The most significant byte (CFC: Control Foreground Color)
+ * determines what's written if the foreground color is written
+ * to the attribute planes.
+ *
+ * The next most significant byte (CBC: Control Background
+ * Color) determines what's written if a zero is written.
+ *
+ * The third byte (CPM: Control Plane Mask Byte) indicates
+ * which group of planes is active.
+ *
+ * Control Bitmap Operation (CBO) determines whether foreground
+ * or background color is transparent or opaque. Here, we
+ * choose opaque for foreground and background (the latter is a
+ * don't-care).
+ *
+ * The ctlPlaneReg parameter which is passed into this routine
+ * represents the value to be loaded into the CPR. The CPR
+ * value is device specific, as each device has its own
+ * particular mapping of bits in the CPR fields to the devices
+ * attribute planes. But, the CPR register appears at the same
+ * address in each of the devices control register space.
+ * Therefore, each device can use this common routine to paint
+ * attribute planes.
+ *
+ ******************************************************************************/
+
+static void nglePolyPaintAttr(
+ NgleScreenPrivPtr pScreenPriv,
+ Card32 ctlPlaneReg,
+ Int32 nBoxes,
+ BoxPtr pBoxes)
+{
+ Int32 nFreeFifoSlots = 0;
+/*## For now, treat as 32-bit integers so that we don't have to unpack: ##*/
+/*## Int16 *pBox;##*/
+ Int32 *pBox;
+ NgleHdwPtr pDregs;
+ NGLE_MFGP_REGISTER_TYPE packedDstXY;
+ NGLE_MFGP_REGISTER_TYPE packedLenXY;
+
+
+ /* Return early if there's nothing to do: */
+ if (nBoxes <= 0)
+ return;
+
+ pDregs = pScreenPriv->pDregs;
+ NGLE_LOCK(pScreenPriv);
+
+
+ /*
+ **************************************************************************
+ **
+ ** Paint the Boxes in the Attribute Planes:
+ **
+ **************************************************************************
+ */
+
+ GET_FIFO_SLOTS(nFreeFifoSlots, 4);
+ NGLE_QUICK_SET_DST_BM_ACCESS(BA(IndexedDcd, Otc32, OtsIndirect,
+ AddrLong, BAJustPoint(0),
+ BINattr, BAIndexBase(0)));
+ NGLE_QUICK_SET_CTL_PLN_REG(ctlPlaneReg);
+ NGLE_SET_TRANSFERDATA(0xffffffff);
+
+ /* Loop on boxes: */
+ pBox = (Int32 *) pBoxes;
+ NGLE_QUICK_SET_IMAGE_BITMAP_OP(IBOvals(RopSrc, MaskAddrOffset(0),
+ BitmapExtent08, StaticReg(TRUE),
+ DataDynamic, MaskOtc,
+ BGx(TRUE), FGx(FALSE)));
+ do
+ {
+ packedDstXY.all = *pBox++;
+ packedLenXY.all = (*pBox++) - packedDstXY.all;
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ NGLE_SET_DSTXY(NGLE_MFGP_REGISTER_TYPE_ASLONG(packedDstXY));
+ SET_LENXY_START_RECFILL(packedLenXY);
+ } while (--nBoxes > 0);
+
+
+ /*
+ **************************************************************************
+ **
+ ** In order to work around an ELK hardware problem (Buffy doesn't
+ ** always flush it's buffers when writing to the attribute
+ ** planes), at least 4 pixels must be written to the attribute
+ ** planes starting at (X == 1280) and (Y != to the last Y written
+ ** by BIF):
+ **
+ **************************************************************************
+ */
+
+ if (pScreenPriv->deviceID == S9000_ID_A1659A) /* ELK_DEVICE_ID */
+ {
+ /*## NOTE: This may cause problems on a 2K-wide device: ##*/
+ if (packedLenXY.xy.y > 0)
+ {
+ /* It's safe to use scanline zero: */
+ PACK_2CARD16(packedDstXY, 1280, 0);
+ }
+ else
+ {
+ /* Must generate a safe scanline: */
+ if (packedDstXY.xy.y > 0)
+ {
+ PACK_2CARD16(packedDstXY, 1280, 0);
+ }
+ else
+ {
+ PACK_2CARD16(packedDstXY, 1280, 1);
+ }
+ }
+
+ GET_FIFO_SLOTS(nFreeFifoSlots, 2);
+ NGLE_SET_DSTXY(NGLE_MFGP_REGISTER_TYPE_ASLONG(packedDstXY));
+ PACK_2CARD16(packedLenXY, 4, 1);
+ SET_LENXY_START_RECFILL(packedLenXY);
+ } /* ELK Hardware Kludge */
+
+
+ /**** Finally, set the Control Plane Register back to zero: ****/
+ GET_FIFO_SLOTS(nFreeFifoSlots, 1);
+ NGLE_QUICK_SET_CTL_PLN_REG(0);
+
+ NGLE_UNLOCK(pScreenPriv);
+
+} /* nglePolyPaintAttr() */
diff --git a/xc/programs/Xserver/hw/hp/ngle/nglescreen.h b/xc/programs/Xserver/hw/hp/ngle/nglescreen.h
new file mode 100644
index 000000000..e8ac1d817
--- /dev/null
+++ b/xc/programs/Xserver/hw/hp/ngle/nglescreen.h
@@ -0,0 +1,138 @@
+/* $XConsortium: nglescreen.h,v 1.2 95/01/24 02:10:27 dpw Exp $ */
+
+/*************************************************************************
+ *
+ * (c)Copyright 1992 Hewlett-Packard Co., All Rights Reserved.
+ *
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+ *
+ *************************************************************************/
+
+/* $XFree86: xc/programs/Xserver/hw/hp/ngle/nglescreen.h,v 1.2 1998/06/27 12:53:51 hohndel Exp $ */
+
+/******************************************************************************
+ *
+ * This file contains various macros, typedefs and extern declarations
+ * concerning the Screen structure.
+ *
+ ******************************************************************************/
+
+#ifndef NGLESCREEN
+#define NGLESCREEN
+
+
+/*
+ ******************************************************************************
+ **
+ ** NGLE DDX Driver's Screen Private Structure:
+ **
+ ******************************************************************************
+ */
+
+typedef struct _NgleScreenPrivRec
+{
+ /**** High-Level information about the screen/device: ****/
+ ScreenPtr pScreen; /* Pointer to DIX structure */
+ Int32 myNum; /* The number of this screen */
+ Int32 fildes; /* Unix fildes of device file */
+ dev_t dev_sc; /* Device file's minor number */
+
+ Card32 deviceID; /* Is this an Elk or Rattler */
+ NgleHdwPtr pDregs; /* Pointer to the hardware */
+ pointer fbaddr; /* Pointer to the framebuffer */
+ char *crt_region[CRT_MAX_REGIONS]; /* Other regions
+ * associated with frame buffer
+ * that might be mapped in.
+ * Obtained from GCDESCRIBE.
+ */
+ NgleDevRomDataPtr pDevRomData; /* Pointer to the ROM */
+ Bool isGrayScale; /* GRX (Not color device) */
+
+ /**** Device sizes: ****/
+ Int32 devWidth; /* Raw width, for addr calc's */
+ Int32 devDepth; /* Depth of device # of planes */
+ Int32 screenWidth; /* Visible resolution: width */
+ Int32 screenHeight; /* Visible resolution: height */
+
+ /**** X11 sprite information: ****/
+ NgleSpriteRec sprite;
+
+ /**** Installed-in-Hardware Colormap Information: ****/
+ ColormapPtr installedMap; /* ptr to DIX colormap
+ * currently installed */
+ Card32 hwColors[256]; /* Copy of installed map */
+
+ /**** Miscellaneous information: ****/
+ /* Allow user to require that cursor updates wait for vertical blanking
+ */
+ Int32 moveCursorOnVBlank;
+
+ /* Added for X server controlling both heads of Tomcat (2-headed ELK):
+ * on server exit, only unmap the framebuffer and control space
+ * if the "last" head on the Tomcat for this server.
+ */
+ Bool lastDeviceOnThisSgcToClose;
+
+ /* Hyperdrive (and probably other future devices) has configuration bits */
+ /* to tell frame buffer depth (8:88 or 8:24) and accelerator present
+ */
+ unsigned Int32 deviceSpecificConfig;
+
+ /*
+ * Pointers to various functions returned from cfbScreenInit(),
+ * used for wrapper routines.
+ */
+ CloseScreenProcPtr CloseScreen;
+ CreateGCProcPtr CreateGC;
+
+} NgleScreenPrivRec, *NgleScreenPrivPtr;
+
+
+/*
+ ******************************************************************************
+ **
+ ** Macros to Access the NGLE DDX Driver's Screen Private Structure:
+ **
+ ******************************************************************************
+ */
+
+extern Int32 ngleScreenPrivIndex;
+#define NGLE_SCREEN_PRIV(pScreen)\
+ ((NgleScreenPrivPtr) ((pScreen)->devPrivates[ngleScreenPrivIndex].ptr))
+
+
+/*
+ ******************************************************************************
+ **
+ ** Values for pScreenPriv->moveCursorOnVBlank:
+ ** Should cursor be moved only during vertical blank?
+ **
+ ******************************************************************************
+ */
+#define CURSOR_AT_VBLANK_ALWAYS 1
+#define CURSOR_AT_VBLANK_DRIVEROPTION 0
+#define CURSOR_AT_VBLANK_NEVER -1
+
+/* Server state values used by hyperResetPlanes() */
+#define SERVER_INIT 1
+#define SERVER_EXIT 2
+#define SERVER_RECOVERY 3
+
+
+#endif /* NGLESCREEN */
diff --git a/xc/programs/Xserver/hw/sun/Imakefile b/xc/programs/Xserver/hw/sun/Imakefile
new file mode 100644
index 000000000..effef3ee4
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/Imakefile
@@ -0,0 +1,80 @@
+XCOMM $TOG: Imakefile /main/48 1997/11/13 15:48:43 msr $
+#include <Server.tmpl>
+
+SRCS1 = sunInit.c \
+ sunCfb.c \
+ sunCfb24.c \
+ sunCursor.c \
+ sunFbs.c \
+ sunIo.c \
+ sunKbd.c \
+ sunMfb.c \
+ sunMouse.c\
+ sunKeyMap.c
+
+#if BuildLowMem
+SRCS2 =
+#else
+SRCS2 = sunGX.c
+#endif
+
+SRCS = $(SRCS1) $(SRCS2) kbd_mode.c constype.c
+
+#ifdef i386Architecture
+OFILES = sunInit.o
+#else
+OFILES = sunInit.o sunInitMono.o sunInExMono.o sunInitMulti.o
+#endif
+
+OBJS1 = sunCfb.o \
+ sunCfb24.o \
+ sunCursor.o \
+ sunFbs.o \
+ sunIo.o \
+ sunKbd.o \
+ sunMfb.o \
+ sunMouse.o \
+ sunKeyMap.o
+
+#if BuildLowMem
+OBJS2 =
+#else
+OBJS2 = sunGX.o
+#endif
+
+OBJS = $(OBJS1) $(OBJS2)
+
+ INCLUDES = -I. -I../.. -I../../mi -I../../mfb -I../../cfb -I../../cfb32 \
+ -I../../include -I$(XINCLUDESRC) -I$(FONTINCSRC)
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+all:: $(OFILES) kbd_mode constype
+
+lintlib:
+
+NormalLibraryTarget(sun,$(OBJS))
+NormalLintTarget($(SRCS1))
+
+#ifndef i386Architecture
+sunInExMono.o: $(ICONFIGFILES)
+ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,$(EXT_DEFINES) -UPEXEXT)
+ObjectFromSpecialSource(sunInitMono,sunInit,-DSUNMAXDEPTH=1)
+ObjectFromSpecialSource(sunInitMulti,sunInit,-DSUNMAXDEPTH=32)
+#endif
+
+SingleProgramTarget(kbd_mode, kbd_mode.o,,)
+SingleProgramTarget(constype, constype.o,,)
+InstallProgram(kbd_mode,$(BINDIR))
+InstallProgram(constype,$(BINDIR))
+InstallManPage(kbd_mode,$(MANDIR))
+InstallManPage(constype,$(MANDIR))
+InstallManPage(Xsun,$(MANDIR))
+#ifndef i386Architecture
+InstallManPageAliases(Xsun,$(MANDIR),XsunMono)
+InstallManPageAliases(Xsun,$(MANDIR),Xsun24)
+#endif
+
+DependTarget()
diff --git a/xc/programs/Xserver/hw/sun/README b/xc/programs/Xserver/hw/sun/README
new file mode 100644
index 000000000..87ba53584
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/README
@@ -0,0 +1,118 @@
+A joint production of:
+
+ Adam de Boor University of California, Berkeley
+
+ David Rosenthal
+ Stuart Marks
+ Robin Schaufler
+ Mike Schwartz
+ Frances Ho
+ Geoff Lee
+ Mark Opperman Sun Microsystems
+
+ Bob Scheifler MIT Laboratory for Computer Science
+ Keith Packard
+
+This version of the Sun X11 drivers uses ../mi, ../mfb and ../cfb to support
+the following configurations:
+
+ Sun/2 bw2 cg2/3/5
+ Sun/3 bw2 cg2/3/4/5
+ Sun/4 bw2 cg2/4
+ SPARCstation cg3/6
+ Sun/386i mono color
+
+The following configurations are NOT supported:
+
+ Sun/1 bw1 cg1 (requires separate port)
+ Sun/2 gp (use /dev/cgtwo0)
+ Sun/3 gp (use /dev/cgtwo0)
+ Sun/4 gp (use /dev/cgtwo0)
+
+The mfb and cfb code has been substantially tuned for 1- and 8-bit framebuffers
+(with code for both fast and slow cpu-to-memory ratios). It installs and runs
+on these configurations under SunOS 3.2, 3.4, and 4.0. However, we must stress
+that it is completely unsupported, and if you have problems installing or using
+it you are on your own.
+
+
+Things to check before building:
+
+1) config/sun.cf - set the SunOSMajorVersion and SunOSMinorVersion
+ parameters to the right values.
+
+2) config/Project.tmpl - check LIBDIR, FONTDIR, etc.; set
+ define LibDir, FontDir, etc. in site.def as required.
+
+
+
+Then build the system by:
+
+1) Go for it. In the top-level directory, type
+
+ make World
+
+ This takes about forty minutes on a 4/260, and somewhat longer
+ on other Suns.
+
+
+2) Go for it. In the top-level directory, type
+
+ make install
+
+ Otherwise, you'll want to create a bunch of symbolic links to
+ the various executables and data files scattered throughout
+ the hierarchy.
+
+
+
+3) On the console, or from an rlogin connection, put whatever you
+ chose for BINDIR (in Imake.tmpl) in your search path, and then
+ start the server:
+
+ xinit
+ or
+ xinit -- -dev /dev/??? [see below]
+
+ If it's from the console, you probably want to redirect the
+ output thus:
+
+ xinit >& /tmp/x11.out
+
+4) xinit should start up an xterm window that acts as a console. When
+ this xterm terminates, the xinit will kill the server. You can also
+ start up client programs from a terminal or rlogin, but you must
+ first set the DISPLAY environment variable:
+
+ setenv DISPLAY unix:0
+ xterm &
+
+
+5) Make sure that you have special devices in /dev for the appropriate
+ framebuffer. See the manual page for Xsun for details or run the
+ constype program. VME systems require special .o files when more
+ than one of a particular frame buffer type is installed.
+
+
+6) In general, Xsun auto-configures to use all the available framebuffers
+ (see the Xsun manual page). In some circumstances, you may need to
+ use the -dev switch on the command line to specify a specific device
+ to use. In particular, on the GP, GP+, and GP2, you'll need to
+ specify -dev /dev/cgtwo0 your xdm Xservers file or your xinit script.
+
+
+7) To shut the server down, send it a Hangup or Terminate signal.
+
+
+8) If X crashes, it will leave the keyboard in a funny state. There is a
+ program called "kbd_mode" that will reset the mode of the keyboard.
+ "kbd_mode -a" is the appropriate setting for the bare console, and
+ "kbd_mode -e" is the appropriate setting for running with SunWindows.
+ You may have to issue this command from a terminal or from an rlogin
+ connection. If you run from the bare console, you can give the
+ command
+
+ xinit ; kbd_mode -a
+
+ so that the keyboard mode will ALWAYS be set properly when the server
+ terminates.
diff --git a/xc/programs/Xserver/hw/sun/Xsun.man b/xc/programs/Xserver/hw/sun/Xsun.man
new file mode 100644
index 000000000..2b6f36135
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/Xsun.man
@@ -0,0 +1,169 @@
+.\" $TOG: Xsun.man /main/29 1998/02/10 13:17:41 kaleb $
+.\" Copyright 1988 Sun Microsystems, Inc.
+.\" Copyright 1993, 1994, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.TH XSUN 1 "Release 6.4" "X Version 11"
+.SH NAME
+Xsun, XsunMono, Xsun24 \- Sun server for X Version 11
+.SH SYNOPSIS
+.B Xsun
+[ option ] ...
+.SH DESCRIPTION
+.I Xsun
+is the server for Version 11 of the X window system on Sun hardware.
+It will normally be started by the \fIxdm(1)\fP daemon or by a script
+that runs the program \fIxinit(1)\fP.
+.SH CONFIGURATIONS
+.PP
+.I XsunMono
+supports the BW2 monochrome frame buffer.
+.I Xsun
+supports the CG2, CG3, CG4, and CG6 8-bit color frame buffers in
+addition to the BW2 monochrome frame buffer. On Solaris 2.5 it also
+supports the TCX as an 8-bit color frame buffer.
+.I Xsun24
+supports the cgeight 24-bit color frame buffer in addition to the
+8-bit color and monochrome frame buffers that
+.I Xsun
+supports.
+.PP
+If specific framebuffer device files aren't specified on the command
+line with the \fI\-dev\fP switch or in the \fIXDEVICE\fP environment
+variable, the server will search for all installed frame buffers and
+will use all those that it finds.
+.PP
+Finally, if no specific framebuffers are found, the generic framebuffer
+interface \fI/dev/fb\fP is used.
+.PP
+.SH KEYBOARDS
+.PP
+Xsun, Xsun24, and XsunMono support the Type-2, Type-3, and many variations
+of the Type-4 and Type-5 keyboards.
+.PP
+Type-4 and Type-5 keyboards feature a key labeled \fIAltGraph\fP which
+is a mode-shift key. The mode-shift key is used to generate the symbols
+painted on the fronts of the keys. The mode-shift key works exactly like
+the \fIShift\fP, \fIControl\fP, \fIAlt\fP, and \fI<Meta>\fP keys.
+.PP
+The ten function keys on the left side of the Type-5 keyboard may be
+considered as having L1..L10 painted on their fronts. Shift-AltGraph
+will cause different keysyms to be generated for some keys, e.g. the
+Type-5 \fISysRq\fP key.
+.PP
+For compatibility with Sun's X11/NeWS server, the F11 and F12 keys may
+be made to generate the equivalent X11/NeWS keysyms by using mode-switch.
+.PP
+For backwards compatibility, the normal and mode-shifted keysyms for
+the ten function keys on the left side of Type-4 and Type-5 keyboards
+may be swapped via command line option. See \fI-swapLkeys\fP.
+.PP
+The X LEDs 1..4 correspond to the NumLock, ScrollLock, Compose, and
+CapsLock LEDs respectively. Pressing the key once turns the corresponding
+LED on. Pressing the key again turns the LED off. Turning an LED on or
+off with e.g. 'xset [-]led [1234]' is equivalent to pressing the
+corresponding key.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXsun\fP accepts the following command line switches:
+.TP 8
+.B "\-ar1 \fImilliseconds\fP"
+This option specifies amount of time in milliseconds before which a
+pressed key should begin to autorepeat.
+.TP 8
+.B "\-ar2 \fImilliseconds\fP"
+This option specifies the interval in milliseconds between autorepeats
+of pressed keys.
+.TP 8
+.B \-swapLkeys
+Swaps the normal keysyms for the function keys on the left side of
+Type-4 and Type-5 keyboards with the alternate keysyms, i.e. the keysyms
+painted on the front of the keys.
+.TP 8
+.B \-flipPixels
+The normal pixel values for white and black are 0 and 1 respectively.
+When -flipPixels is specified these values are reversed.
+.TP 8
+.B \-mono
+When used with the \fBcgtwo\fP, this option indicates that the server
+should emulate a monochrome framebuffer instead of the normal color
+framebuffer. When used with the \fBcgfour\fP, this option indicates
+that the monochrome screen should be numbered 0 and the color screen
+numbered 1 (instead of the other way around).
+.TP 8
+.B \-zaphod
+This option disables switching between screens by sliding the mouse off
+the left or right edges. With this disabled, a window manager function
+must be used to switch between screens.
+.TP 8
+.B \-debug
+This option indicates that the server is being run from a debugger, and
+that it should \fBnot\fP put its standard input, output and error files
+into non-blocking mode.
+.TP 8
+.B "\-dev \fIfilename[:filename]...\fP"
+This option specifies the colon separated names of the framebuffer device
+files to be used.
+.TP 8
+.B "\-fbinfo
+This option indicates that the server should enumerate the available
+frame buffers that it will use.
+.SH ENVIRONMENT
+.TP 8
+\fBXDEVICE\fP
+If present, and if no explicit \fB-dev\fP options are given, specifies
+the (colon separated) list of display devices to use.
+.SH "SEE ALSO"
+.PP
+X(1), Xserver(1), xdm(1), xinit(1)
+.SH BUGS
+The auto-configuration depends on there being appropriate special files
+in the
+.I /dev
+directory for the framebuffers which are to be used. Extra entries can
+confuse the server. For example, the X/160C in fact has the hardware
+for a monochrome
+.B bwtwo0
+on the CPU board. So if
+.I /dev
+has a special file for
+.IR /dev/bwtwo0 ,
+the server will use it, even though there is no monitor attached to the
+monochrome framebuffer.
+The server will appear to start, but not to paint a cursor, because the
+cursor is on the monochrome frame buffer. The solution is to remove the
+.I /dev
+entries for any device you don't have a monitor for.
+.PP
+There is a bug in pre-FCS operating systems for the Sun-4 which causes
+the server to crash driving a \fBcgtwo\fP.
+.PP
+.SH AUTHORS
+.TP 8
+U. C. Berkeley
+Adam de Boor.
+.TP 8
+Sun Microsystems
+David Rosenthal, Stuart Marks, Robin Schaufler, Mike Schwartz,
+Frances Ho, Geoff Lee, and Mark Opperman.
+.TP 8
+MIT Laboratory for Computer Science
+.br
+Bob Scheifler, Keith Packard, Kaleb Keithley
diff --git a/xc/programs/Xserver/hw/sun/circleset.h b/xc/programs/Xserver/hw/sun/circleset.h
new file mode 100644
index 000000000..c2c38e402
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/circleset.h
@@ -0,0 +1,136 @@
+#ifdef DO_FILLED_ARCS
+static unsigned short filled_arcs[16][16] = {
+{ /* 1 */
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 2 */
+B(0x4000),B(0xc000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 3 */
+B(0x0000),B(0x6000),B(0x6000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 4 */
+B(0x2000),B(0x7000),B(0xf000),B(0x7000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 5 */
+B(0x0000),B(0x7800),B(0x7800),B(0x7800),B(0x7800),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 6 */
+B(0x1000),B(0x7c00),B(0x7c00),B(0xfc00),B(0x7c00),B(0x7c00),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 7 */
+B(0x0000),B(0x3c00),B(0x7e00),B(0x7e00),B(0x7e00),B(0x7e00),B(0x3c00),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 8 */
+B(0x0800),B(0x3e00),B(0x7f00),B(0x7f00),B(0xff00),B(0x7f00),B(0x7f00),B(0x3e00),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 9 */
+B(0x0000),B(0x3f00),B(0x7f80),B(0x7f80),B(0x7f80),B(0x7f80),B(0x7f80),B(0x7f80),
+B(0x3f00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 10 */
+B(0x0400),B(0x3f00),B(0x7f80),B(0x7fc0),B(0x7fc0),B(0xffc0),B(0x7fc0),B(0x7fc0),
+B(0x7f80),B(0x3f00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 11 */
+B(0x0000),B(0x1f80),B(0x3fc0),B(0x7fe0),B(0x7fe0),B(0x7fe0),B(0x7fe0),B(0x7fe0),
+B(0x7fe0),B(0x3fc0),B(0x1f80),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 12 */
+B(0x0200),B(0x1fc0),B(0x3fe0),B(0x7ff0),B(0x7ff0),B(0x7ff0),B(0xfff0),B(0x7ff0),
+B(0x7ff0),B(0x7ff0),B(0x3fe0),B(0x1fc0),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 13 */
+B(0x0000),B(0x0fc0),B(0x3ff0),B(0x3ff0),B(0x7ff8),B(0x7ff8),B(0x7ff8),B(0x7ff8),
+B(0x7ff8),B(0x7ff8),B(0x3ff0),B(0x3ff0),B(0x0fc0),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 14 */
+B(0x0100),B(0x0fe0),B(0x1ff0),B(0x3ff8),B(0x7ffc),B(0x7ffc),B(0x7ffc),B(0xfffc),
+B(0x7ffc),B(0x7ffc),B(0x7ffc),B(0x3ff8),B(0x1ff0),B(0x0fe0),B(0x0000),B(0x0000),
+},
+{ /* 15 */
+B(0x0000),B(0x0ff0),B(0x1ff8),B(0x3ffc),B(0x7ffe),B(0x7ffe),B(0x7ffe),B(0x7ffe),
+B(0x7ffe),B(0x7ffe),B(0x7ffe),B(0x7ffe),B(0x3ffc),B(0x1ff8),B(0x0ff0),B(0x0000),
+},
+{ /* 16 */
+B(0x0080),B(0x07f0),B(0x1ffc),B(0x3ffe),B(0x3ffe),B(0x7fff),B(0x7fff),B(0x7fff),
+B(0xffff),B(0x7fff),B(0x7fff),B(0x7fff),B(0x3ffe),B(0x3ffe),B(0x1ffc),B(0x07f0),
+},
+};
+#endif /* DO_FILLED_ARCS */
+#ifdef DO_OUTLINE_ARCS
+static unsigned short outline0_arcs[16][16] = {
+{ /* 1 */
+B(0xc000),B(0xc000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 2 */
+B(0xe000),B(0xa000),B(0xe000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 3 */
+B(0x6000),B(0x9000),B(0x9000),B(0x6000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 4 */
+B(0x7000),B(0x8800),B(0x8800),B(0x8800),B(0x7000),B(0x0000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 5 */
+B(0x3000),B(0x4800),B(0x8400),B(0x8400),B(0x4800),B(0x3000),B(0x0000),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 6 */
+B(0x3800),B(0x4400),B(0x8200),B(0x8200),B(0x8200),B(0x4400),B(0x3800),B(0x0000),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 7 */
+B(0x3c00),B(0x4200),B(0x8100),B(0x8100),B(0x8100),B(0x8100),B(0x4200),B(0x3c00),
+B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 8 */
+B(0x1c00),B(0x6300),B(0x4100),B(0x8080),B(0x8080),B(0x8080),B(0x4100),B(0x6300),
+B(0x1c00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 9 */
+B(0x1e00),B(0x2100),B(0x4080),B(0x8040),B(0x8040),B(0x8040),B(0x8040),B(0x4080),
+B(0x2100),B(0x1e00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 10 */
+B(0x1f00),B(0x2080),B(0x4040),B(0x8020),B(0x8020),B(0x8020),B(0x8020),B(0x8020),
+B(0x4040),B(0x2080),B(0x1f00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 11 */
+B(0x0f00),B(0x30c0),B(0x4020),B(0x4020),B(0x8010),B(0x8010),B(0x8010),B(0x8010),
+B(0x4020),B(0x4020),B(0x30c0),B(0x0f00),B(0x0000),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 12 */
+B(0x0f80),B(0x1040),B(0x2020),B(0x4010),B(0x8008),B(0x8008),B(0x8008),B(0x8008),
+B(0x8008),B(0x4010),B(0x2020),B(0x1040),B(0x0f80),B(0x0000),B(0x0000),B(0x0000),
+},
+{ /* 13 */
+B(0x0780),B(0x1860),B(0x2010),B(0x4008),B(0x8004),B(0x8004),B(0x8004),B(0x8004),
+B(0x8004),B(0x8004),B(0x4008),B(0x2010),B(0x1860),B(0x0780),B(0x0000),B(0x0000),
+},
+{ /* 14 */
+B(0x07c0),B(0x1830),B(0x2008),B(0x4004),B(0x4004),B(0x8002),B(0x8002),B(0x8002),
+B(0x8002),B(0x8002),B(0x4004),B(0x4004),B(0x2008),B(0x1830),B(0x07c0),B(0x0000),
+},
+{ /* 15 */
+B(0x07e0),B(0x0810),B(0x300c),B(0x4002),B(0x4002),B(0x8001),B(0x8001),B(0x8001),
+B(0x8001),B(0x8001),B(0x8001),B(0x4002),B(0x4002),B(0x300c),B(0x0810),B(0x07e0),
+},
+{ /* 16 */
+B(0x03e0),B(0x0c18),B(0x1004),B(0x2002),B(0x4001),B(0x4001),B(0x8000),B(0x8000),
+B(0x8000),B(0x8000),B(0x8000),B(0x4001),B(0x4001),B(0x2002),B(0x1004),B(0x0c18),
+},
+};
+#endif /* DO_OUTLINE_ARCS */
diff --git a/xc/programs/Xserver/hw/sun/constype.c b/xc/programs/Xserver/hw/sun/constype.c
new file mode 100644
index 000000000..bc75af9ce
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/constype.c
@@ -0,0 +1,180 @@
+/*
+ * $XConsortium: constype.c /main/9 1996/10/31 14:23:42 kaleb $
+ * $XFree86: xc/programs/Xserver/hw/sun/constype.c,v 3.4 1996/12/23 06:30:11 dawes Exp $
+ *
+ * consoletype - utility to print out string identifying Sun console type
+ *
+ * Copyright 1988 SRI
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SRI not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SRI makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * Author: Doug Moran, SRI
+ */
+
+/*
+SUN-SPOTS DIGEST Thursday, 17 March 1988 Volume 6 : Issue 31
+
+Date: Wed, 2 Mar 88 14:50:26 PST
+From: Doug Moran <moran@ai.sri.com>
+Subject: Program to determine console type
+
+There have been several requests in this digest for programs to determine
+the type of the console. Below is a program that I wrote to produce an
+identifying string (I start suntools in my .login file and use this pgm to
+determine which arguments to use).
+
+Caveat: my cluster has only a few of these monitor types, so the pgm has
+not been fully tested.
+
+Note on coding style: the function wu_fbid is actually located in a local
+library, accounting for what otherwise might appear to be a strange coding
+style.
+*/
+#include <stdio.h>
+#if defined(SVR4) || defined(__bsdi__)
+#include <string.h>
+#else
+/* NetBSD seemingly still uses <strings.h> and naturally SunOS does */
+#include <strings.h>
+#endif
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int fbtype = -1;
+ char *fbname, *dev;
+ int print_num = 0;
+ int error;
+
+ if (argc > 1 && argv[1][0] == '/') {
+ dev = argv[1];
+ argc--; argv++;
+ } else
+ dev = "/dev/fb";
+ error = wu_fbid(dev, &fbname, &fbtype );
+ if (argc > 1 && strncmp (argv[1], "-num", strlen(argv[1])) == 0)
+ print_num = 1;
+
+ printf ("%s", fbname ? fbname : "tty");
+ if (print_num) {
+ printf (" %d", fbtype);
+ }
+ putchar ('\n');
+ return error;
+}
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#if defined(SVR4) || defined(__bsdi__)
+#include <fcntl.h>
+#include <sys/fbio.h>
+#else
+#ifndef CSRG_BASED
+#include <sun/fbio.h>
+#else
+#include <machine/fbio.h>
+#endif
+#endif
+
+/* Sun doesn't see fit to update <sys/fbio.h> to reflect the addition
+ * of the TCX
+ */
+#define XFBTYPE_TCX 21
+#define XFBTYPE_LASTPLUSONE 22
+
+/* decoding as of Release 3.4 : fbio.h 1.3 87/01/09 SMI */
+ /* the convention for entries in this table is to translate the
+ * macros for frame buffer codes (in <sun/fbio.h>) to short names
+ * thus:
+ * FBTYPE_SUNxBW becomes bwx
+ * FBTYPE_SUNxCOLOR becomes cgx
+ * FBTYPE_SUNxGP becomes gpx
+ * FBTYPE_NOTSUN[1-9] becomes ns[A-J]
+ */
+static char *decode_fb[] = {
+ "bw1", "cg1",
+ "bw2", "cg2",
+ "gp2",
+ "bw3", "cg3",
+ "cg8", "cg4",
+ "nsA", "nsB", "nsC",
+#ifdef FBTYPE_SUNFAST_COLOR
+ "gx/cg6",
+#endif
+#ifdef FBTYPE_SUNROP_COLOR
+ "rop",
+#endif
+#ifdef FBTYPE_SUNFB_VIDEO
+ "vid",
+#endif
+#ifdef FBTYPE_SUNGIFB
+ "gifb",
+#endif
+#ifdef FBTYPE_SUNGPLAS
+ "plas",
+#endif
+#ifdef FBTYPE_SUNGP3
+ "gp3/cg12",
+#endif
+#ifdef FBTYPE_SUNGT
+ "gt",
+#endif
+#ifdef FBTYPE_SUNLEO
+ "leo/zx",
+#endif
+#ifdef FBTYPE_MDICOLOR
+ "mdi/cg14",
+#endif
+ };
+
+int wu_fbid(devname, fbname, fbtype)
+ char* devname;
+ char** fbname;
+ int* fbtype;
+{
+ struct fbgattr fbattr;
+ int fd, ioctl_ret;
+ if ( (fd = open(devname, O_RDWR, 0)) == -1 ) {
+ *fbname = "unable to open fb";
+ return 2;
+ }
+ /* FBIOGATTR fails for early frame buffer types */
+ if (ioctl_ret = ioctl(fd,FBIOGATTR,&fbattr)) { /*success=>0(false)*/
+ ioctl_ret = ioctl(fd, FBIOGTYPE, &fbattr.fbtype);
+ }
+ close(fd);
+ if ( ioctl_ret == -1 ) {
+ *fbname = "ioctl on fb failed";
+ return 2;
+ }
+ *fbtype = fbattr.fbtype.fb_type;
+ /* The binary is obsolete and needs to be re-compiled:
+ * the ioctl returned a value beyond what was possible
+ * when the program was compiled */
+ if (fbattr.fbtype.fb_type>=FBTYPE_LASTPLUSONE) {
+ if (fbattr.fbtype.fb_type == XFBTYPE_TCX) {
+ *fbname = "tcx";
+ return 0;
+ } else {
+ *fbname = "unk";
+ return 1;
+ }
+ }
+ /* The source is obsolete. The table "decode_fb" does not
+ * have entries for some of the values returned by the ioctl.
+ * Compare <sun/fbio.h> to the entries in "decode_fb" */
+ if ( decode_fb[fbattr.fbtype.fb_type] == NULL ) {
+ *fbname = "unk";
+ return 1;
+ }
+ *fbname = decode_fb[fbattr.fbtype.fb_type];
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/sun/constype.man b/xc/programs/Xserver/hw/sun/constype.man
new file mode 100644
index 000000000..511dc9565
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/constype.man
@@ -0,0 +1,55 @@
+.\" $TOG: constype.man /main/13 1997/11/04 21:19:39 kaleb $
+.TH CONSTYPE 1 "Release 6.4" "X Version 11"
+.SH NAME
+constype \- print type of Sun console
+.SH SYNOPSIS
+.B "constype"
+[
+.I device_name
+] [
+.B \-num
+]
+.SH DESCRIPTION
+The
+.I constype
+program
+writes on the standard output the Sun code for the type of display
+that the console is.
+The types output include these:
+.sp 2
+.in +0.5i
+.nf
+bw? Black and White, where ? is 1-4. (eg) 3-50s are bw2
+cg? Colour Graphics display, where ? is 1-4
+gp? Optional Graphics Processor board, where ? is 1-2
+ns? Not Sun display \(em where ? is A-J
+.fi
+.in -0.5i
+.sp 2
+This is useful in determining startup values and defaults for window
+systems.
+.LP
+The
+.I device_name
+argument, if given, is the device to examine.
+If not given,
+.I /dev/fb
+is used.
+.LP
+The
+.B \-num
+option causes
+.I constype
+to follow the type keyword with the numeric value of that type,
+as returned by the FBIOGATTR or FBIOGTYPE ioctl and defined in fbio.h.
+This is useful if the type is not recognized by the program.
+.SH "EXIT STATUS"
+The program exits with status 0 if it identified a known console type,
+1 if the type was unknown, and 2 if the device could not be opened or
+another error occurred.
+.SH BUGS
+Not tested on all monitor types
+.SH COPYRIGHT
+Copyright 1988, SRI
+.SH AUTHOR
+Doug Moran <moran@ai.sri.com>
diff --git a/xc/programs/Xserver/hw/sun/kbd_mode.c b/xc/programs/Xserver/hw/sun/kbd_mode.c
new file mode 100644
index 000000000..2206ee779
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/kbd_mode.c
@@ -0,0 +1,151 @@
+/* $TOG: kbd_mode.c /main/14 1998/02/10 13:16:06 kaleb $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/sun/kbd_mode.c,v 3.6 1998/10/04 09:38:33 dawes Exp $ */
+
+#ifndef lint
+static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
+#endif
+
+/*
+ * Copyright 1986 by Sun Microsystems, Inc.
+ *
+ * kbd_mode: set keyboard encoding mode
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#if defined(SVR4) || defined(__bsdi_)
+#include <fcntl.h>
+#ifndef __bsdi__
+#include <sys/kbio.h>
+#include <sys/kbd.h>
+#else
+#include <unistd.h>
+#include </sys/sparc/dev/kbio.h>
+#include </sys/sparc/dev/kbd.h>
+#endif
+#else
+#ifndef CSRG_BASED
+#include <sundev/kbio.h>
+#include <sundev/kbd.h>
+#else
+#include <machine/kbio.h>
+#include <machine/kbd.h>
+#endif
+#endif
+#include <stdio.h>
+
+static void die(), usage();
+static int kbd_fd;
+
+main(argc, argv)
+ int argc;
+ char** argv;
+{
+ int code, translate, direct = -1;
+ char led;
+ int click;
+
+ if ((kbd_fd = open("/dev/kbd", O_RDONLY, 0)) < 0) {
+ die("Couldn't open /dev/kbd");
+ }
+ argc--; argv++;
+ if (argc-- && **argv == '-') {
+ code = *(++*argv);
+ } else {
+ usage();
+ }
+ switch (code) {
+ case 'a':
+ case 'A':
+ translate = TR_ASCII;
+ direct = 0;
+ break;
+ case 'e':
+ case 'E':
+ translate = TR_EVENT;
+ break;
+ case 'n':
+ case 'N':
+ translate = TR_NONE;
+ break;
+ case 'u':
+ case 'U':
+ translate = TR_UNTRANS_EVENT;
+ break;
+ default:
+ usage();
+ }
+#ifdef KIOCSLED
+ led = 0;
+ if (ioctl(kbd_fd, KIOCSLED, &led))
+ die("Couldn't set LEDs");
+#endif
+#ifdef KIOCCMD
+ click = KBD_CMD_NOCLICK;
+ if (ioctl(kbd_fd, KIOCCMD, &click))
+ die("Couldn't set click");
+#endif
+ if (ioctl(kbd_fd, KIOCTRANS, (caddr_t) &translate))
+ die("Couldn't set translation");
+ if (direct != -1 && ioctl(kbd_fd, KIOCSDIRECT, (caddr_t) &direct))
+ die("Couldn't set redirect");
+ return 0;
+}
+
+static void
+die(msg)
+ char *msg;
+{
+ fprintf(stderr, "%s\n", msg);
+ exit(1);
+}
+
+static void
+usage()
+{
+ int translate;
+
+ if (ioctl(kbd_fd, KIOCGTRANS, (caddr_t) &translate)) {
+ die("Couldn't inquire current translation");
+ }
+ fprintf(stderr, "kbd_mode {-a | -e | -n | -u }\n");
+ fprintf(stderr, "\tfor ascii, encoded (normal) SunView events,\n");
+ fprintf(stderr, " \tnon-encoded, or unencoded SunView events, resp.\n");
+ fprintf(stderr, "Current mode is %s.\n",
+ ( translate == 0 ? "n (non-translated bytes)" :
+ ( translate == 1 ? "a (ascii bytes)" :
+ ( translate == 2 ? "e (encoded events)" :
+ /* translate == 3 */ "u (unencoded events)"))));
+ exit(1);
+}
+
+
diff --git a/xc/programs/Xserver/hw/sun/kbd_mode.man b/xc/programs/Xserver/hw/sun/kbd_mode.man
new file mode 100644
index 000000000..a24e66f39
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/kbd_mode.man
@@ -0,0 +1,46 @@
+.\" $TOG: kbd_mode.man /main/14 1998/02/10 13:16:10 kaleb $
+.\" Copyright 1987 Sun Microsystems, Inc.
+.\" Copyright 1993, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.TH KBD_MODE 1 "Release 6.4" "X Version 11"
+.SH NAME
+kbd_mode \- recover the Sun console keyboard
+.SH SYNOPSIS
+.B kbd_mode
+[ -a -e -n -u ]
+.SH DESCRIPTION
+.I Kbd_mode
+resets the Sun console keyboard to a rational state.
+.SH OPTIONS
+The following options are supported, see \fIkb(4S)\fP for details:
+.TP 8
+.B \-a
+Causes ASCII to be reported.
+.TP 8
+.B \-e
+Causes \fIFirm_events\fP to be reported.
+.TP 8
+.B \-n
+Causes up/down key codes to be reported.
+.TP 8
+.B \-u
+Causes undecoded keyboard values to be reported.
+.SH SEE ALSO
+kb(4S)
diff --git a/xc/programs/Xserver/hw/sun/sun.h b/xc/programs/Xserver/hw/sun/sun.h
new file mode 100644
index 000000000..d501eae0c
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sun.h
@@ -0,0 +1,498 @@
+
+/* $TOG: sun.h /main/61 1997/10/16 16:27:01 kaleb $ */
+
+/*-
+ * Copyright (c) 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sun.h,v 3.7 1998/06/27 12:53:52 hohndel Exp $ */
+
+#ifndef _SUN_H_
+#define _SUN_H_
+
+/* X headers */
+#include "Xos.h"
+#undef index /* don't mangle silly Sun structure member names */
+#include "X.h"
+#include "Xproto.h"
+
+/* general system headers */
+#ifndef NOSTDHDRS
+# include <stdlib.h>
+#else
+# include <malloc.h>
+extern char *getenv();
+#endif
+
+/* system headers common to both SunOS and Solaris */
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/filio.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+
+#ifdef SVR4
+# ifdef X_POSIX_C_SOURCE
+# define _POSIX_C_SOURCE X_POSIX_C_SOURCE
+# include <signal.h>
+# undef _POSIX_C_SOURCE
+# else
+# define _POSIX_SOURCE
+# include <signal.h>
+# undef _POSIX_SOURCE
+# endif
+#endif
+
+#include <fcntl.h>
+
+#ifndef __bsdi_
+# ifndef CSRG_BASED
+# ifndef i386
+# include <poll.h>
+# else
+# include <sys/poll.h>
+# endif
+# endif
+#else
+# include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <memory.h>
+
+#ifdef X_NOT_STDC_ENV
+extern int errno;
+#endif
+
+/*
+ * Sun specific headers Sun moved in Solaris, and are different for NetBSD.
+ *
+ * Even if only needed by one source file, I have put them here
+ * to simplify finding them...
+ */
+#ifdef SVR4
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
+# include <sys/msio.h>
+# include <sys/vuid_event.h>
+# include <sys/memreg.h>
+# include <stropts.h>
+# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
+#else
+# ifndef CSRG_BASED
+# include <sun/fbio.h>
+# include <sundev/kbd.h>
+# include <sundev/kbio.h>
+# include <sundev/msio.h>
+# include <sundev/vuid_event.h>
+# include <pixrect/pixrect.h>
+# include <pixrect/memreg.h>
+extern int ioctl();
+extern int getrlimit();
+extern int setrlimit();
+extern int getpagesize();
+# else
+# ifdef CSRG_BASED
+# include <machine/fbio.h>
+# include <machine/kbd.h>
+# include <machine/kbio.h>
+# include <machine/vuid_event.h>
+# endif
+# ifdef __bsdi__
+# include <sys/fbio.h>
+# include </sys/sparc/dev/kbd.h>
+# include </sys/sparc/dev/kbio.h>
+# include </sys/sparc/dev/vuid_event.h>
+# endif
+# endif
+#endif
+
+/*
+ * Sun doesn't see fit to add the TCX to <sys/fbio.h>
+ */
+#ifndef SVR4
+/* On SunOS 4.1.x the TCX pretends to be a CG3 */
+#define XFBTYPE_LASTPLUSONE FBTYPE_LASTPLUSONE
+#else
+#define XFBTYPE_TCX 21
+#define XFBTYPE_LASTPLUSONE 22
+#endif
+
+extern int gettimeofday();
+
+/*
+ * Server specific headers
+ */
+#include "misc.h"
+#undef abs /* don't munge function prototypes in headers, sigh */
+#include "scrnintstr.h"
+#ifdef NEED_EVENTS
+# include "inputstr.h"
+#endif
+#include "input.h"
+#include "colormapst.h"
+#include "colormap.h"
+#include "cursorstr.h"
+#include "cursor.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "opaque.h"
+#include "resource.h"
+#include "servermd.h"
+#include "windowstr.h"
+
+/*
+ * ddx specific headers
+ */
+#ifndef PSZ
+#define PSZ 8
+#endif
+
+#include "mi/mibstore.h"
+#include "mi/mipointer.h"
+
+extern int monitorResolution;
+
+
+/* Frame buffer devices */
+#ifdef SVR4
+# define CGTWO0DEV "/dev/fbs/cgtwo0"
+# define CGTWO1DEV "/dev/fbs/cgtwo1"
+# define CGTWO2DEV "/dev/fbs/cgtwo2"
+# define CGTWO3DEV "/dev/fbs/cgtwo3"
+# define CGTHREE0DEV "/dev/fbs/cgthree0"
+# define CGTHREE1DEV "/dev/fbs/cgthree1"
+# define CGTHREE2DEV "/dev/fbs/cgthree2"
+# define CGTHREE3DEV "/dev/fbs/cgthree3"
+# define CGFOUR0DEV "/dev/fbs/cgfour0"
+# define CGSIX0DEV "/dev/fbs/cgsix0"
+# define CGSIX1DEV "/dev/fbs/cgsix1"
+# define CGSIX2DEV "/dev/fbs/cgsix2"
+# define CGSIX3DEV "/dev/fbs/cgsix3"
+# define BWTWO0DEV "/dev/fbs/bwtwo0"
+# define BWTWO1DEV "/dev/fbs/bwtwo1"
+# define BWTWO2DEV "/dev/fbs/bwtwo2"
+# define BWTWO3DEV "/dev/fbs/bwtwo3"
+# define CGEIGHT0DEV "/dev/fbs/cgeight0"
+# define TCX0DEV "/dev/fbs/tcx0"
+#else
+# define CGTWO0DEV "/dev/cgtwo0"
+# define CGTWO1DEV "/dev/cgtwo1"
+# define CGTWO2DEV "/dev/cgtwo2"
+# define CGTWO3DEV "/dev/cgtwo3"
+# define CGTHREE0DEV "/dev/cgthree0"
+# define CGTHREE1DEV "/dev/cgthree1"
+# define CGTHREE2DEV "/dev/cgthree2"
+# define CGTHREE3DEV "/dev/cgthree3"
+# define CGFOUR0DEV "/dev/cgfour0"
+# define CGSIX0DEV "/dev/cgsix0"
+# define CGSIX1DEV "/dev/cgsix1"
+# define CGSIX2DEV "/dev/cgsix2"
+# define CGSIX3DEV "/dev/cgsix3"
+# define BWTWO0DEV "/dev/bwtwo0"
+# define BWTWO1DEV "/dev/bwtwo1"
+# define BWTWO2DEV "/dev/bwtwo2"
+# define BWTWO3DEV "/dev/bwtwo3"
+# define CGEIGHT0DEV "/dev/cgeight0"
+#endif
+
+/*
+ * MAXEVENTS is the maximum number of events the mouse and keyboard functions
+ * will read on a given call to their GetEvents vectors.
+ */
+#define MAXEVENTS 32
+
+/*
+ * Data private to any sun keyboard.
+ */
+typedef struct {
+ int fd;
+ int type; /* Type of keyboard */
+ int layout; /* The layout of the keyboard */
+ int click; /* kbd click save state */
+ Leds leds; /* last known LED state */
+} sunKbdPrivRec, *sunKbdPrivPtr;
+
+extern sunKbdPrivRec sunKbdPriv;
+
+/*
+ * Data private to any sun pointer device.
+ */
+typedef struct {
+ int fd;
+ int bmask; /* last known button state */
+} sunPtrPrivRec, *sunPtrPrivPtr;
+
+extern sunPtrPrivRec sunPtrPriv;
+
+typedef struct {
+ BYTE key;
+ CARD8 modifiers;
+} SunModmapRec;
+
+typedef struct {
+ int width, height;
+ Bool has_cursor;
+ CursorPtr pCursor; /* current cursor */
+} sunCursorRec, *sunCursorPtr;
+
+typedef struct {
+ ColormapPtr installedMap;
+ CloseScreenProcPtr CloseScreen;
+ void (*UpdateColormap)();
+ void (*GetColormap)();
+ sunCursorRec hardwareCursor;
+ Bool hasHardwareCursor;
+} sunScreenRec, *sunScreenPtr;
+
+#define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
+#define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s)
+
+typedef struct {
+ unsigned char* fb; /* Frame buffer itself */
+ int fd; /* frame buffer for ioctl()s, */
+ struct fbtype info; /* Frame buffer characteristics */
+ void (*EnterLeave)();/* screen switch */
+ unsigned char* fbPriv; /* fbattr stuff, for the real type */
+} fbFd;
+
+typedef Bool (*sunFbInitProc)(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+
+typedef struct {
+ sunFbInitProc init; /* init procedure for this fb */
+ char* name; /* /usr/include/fbio names */
+} sunFbDataRec;
+
+#ifdef XKB
+extern Bool noXkbExtension;
+#endif
+
+extern Bool sunAutoRepeatHandlersInstalled;
+extern long sunAutoRepeatInitiate;
+extern long sunAutoRepeatDelay;
+extern sunFbDataRec sunFbData[];
+extern fbFd sunFbs[];
+extern Bool sunSwapLkeys;
+extern Bool sunFlipPixels;
+extern Bool sunActiveZaphod;
+extern Bool sunFbInfo;
+extern Bool sunCG4Frob;
+extern Bool sunNoGX;
+extern int sunScreenIndex;
+extern int* sunProtected;
+
+extern Bool sunCursorInitialize(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern void sunDisableCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern int sunChangeKbdTranslation(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* makeTranslated */
+#endif
+);
+
+extern void sunNonBlockConsoleOff(
+#if NeedFunctionPrototypes
+#if defined(SVR4) || defined(CSRG_BASED)
+ void
+#else
+ char* /* arg */
+#endif
+#endif
+);
+
+extern void sunEnqueueEvents(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern int sunGXInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ fbFd* /* fb */
+#endif
+);
+
+extern Bool sunSaveScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ int /* on */
+#endif
+);
+
+extern Bool sunScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern pointer sunMemoryMap(
+#if NeedFunctionPrototypes
+ size_t /* len */,
+ off_t /* off */,
+ int /* fd */
+#endif
+);
+
+extern Bool sunScreenAllocate(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern Bool sunInitCommon(
+#if NeedFunctionPrototypes
+ int /* scrn */,
+ ScreenPtr /* pScrn */,
+ off_t /* offset */,
+ Bool (* /* init1 */)(),
+ void (* /* init2 */)(),
+ Bool (* /* cr_cm */)(),
+ Bool (* /* save */)(),
+ int /* fb_off */
+#endif
+);
+
+extern Firm_event* sunKbdGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* on */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern Firm_event* sunMouseGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* on */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern void sunKbdEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+extern void sunMouseEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+extern int sunKbdProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pKeyboard */,
+ int /* what */
+#endif
+);
+
+extern int sunMouseProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pMouse */,
+ int /* what */
+#endif
+);
+
+extern void sunKbdWait(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+/*-
+ * TVTOMILLI(tv)
+ * Given a struct timeval, convert its time into milliseconds...
+ */
+#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000))
+
+extern Bool sunCfbSetupScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbFinishScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern void sunInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern void sunUninstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern int sunListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ Colormap* /* pCmapList */
+#endif
+);
+
+#endif
diff --git a/xc/programs/Xserver/hw/sun/sunCfb.c b/xc/programs/Xserver/hw/sun/sunCfb.c
new file mode 100644
index 000000000..3b8b034b9
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunCfb.c
@@ -0,0 +1,519 @@
+
+/* $TOG: sunCfb.c /main/23 1998/02/10 13:16:19 kaleb $ */
+
+/*
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sunCfb.c,v 3.10 1998/10/04 09:38:34 dawes Exp $ */
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#include "sun.h"
+#include "cfb/cfb.h"
+#include "mi/miline.h"
+
+#define GXZEROLINEBIAS (OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6)
+
+static void CGUpdateColormap(pScreen, dex, count, rmap, gmap, bmap)
+ ScreenPtr pScreen;
+ int dex, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ struct fbcmap sunCmap;
+
+ sunCmap.index = dex;
+ sunCmap.count = count;
+ sunCmap.red = &rmap[dex];
+ sunCmap.green = &gmap[dex];
+ sunCmap.blue = &bmap[dex];
+
+ if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) < 0) {
+ Error("CGUpdateColormap");
+ FatalError( "CGUpdateColormap: FBIOPUTCMAP failed\n" );
+ }
+}
+
+static void CGGetColormap(pScreen, dex, count, rmap, gmap, bmap)
+ ScreenPtr pScreen;
+ int dex, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ struct fbcmap sunCmap;
+
+ sunCmap.index = dex;
+ sunCmap.count = count;
+ sunCmap.red = &rmap[dex];
+ sunCmap.green = &gmap[dex];
+ sunCmap.blue = &bmap[dex];
+
+ if (ioctl(sunFbs[pScreen->myNum].fd, FBIOGETCMAP, &sunCmap) < 0) {
+ Error("CGGetColormap");
+ FatalError( "CGGetColormap: FBIOGETCMAP failed\n" );
+ }
+}
+
+void sunInstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ register int i;
+ register Entry *pent;
+ register VisualPtr pVisual = cmap->pVisual;
+ u_char rmap[256], gmap[256], bmap[256];
+ unsigned long rMask, gMask, bMask;
+ int oRed, oGreen, oBlue;
+
+ if (cmap == pPrivate->installedMap)
+ return;
+ if (pPrivate->installedMap)
+ WalkTree(pPrivate->installedMap->pScreen, TellLostMap,
+ (pointer) &(pPrivate->installedMap->mid));
+ if ((pVisual->class | DynamicClass) == DirectColor) {
+ if (pVisual->ColormapEntries < 256) {
+ rMask = pVisual->redMask;
+ gMask = pVisual->greenMask;
+ bMask = pVisual->blueMask;
+ oRed = pVisual->offsetRed;
+ oGreen = pVisual->offsetGreen;
+ oBlue = pVisual->offsetBlue;
+ } else {
+ rMask = gMask = bMask = 255;
+ oRed = oGreen = oBlue = 0;
+ }
+ for (i = 0; i < 256; i++) {
+ rmap[i] = cmap->red[(i & rMask) >> oRed].co.local.red >> 8;
+ gmap[i] = cmap->green[(i & gMask) >> oGreen].co.local.green >> 8;
+ bmap[i] = cmap->blue[(i & bMask) >> oBlue].co.local.blue >> 8;
+ }
+ } else {
+ (*pPrivate->GetColormap) (cmap->pScreen, 0, 256, rmap, gmap, bmap);
+ for (i = 0, pent = cmap->red;
+ i < pVisual->ColormapEntries;
+ i++, pent++) {
+ if (pent->fShared) {
+ rmap[i] = pent->co.shco.red->color >> 8;
+ gmap[i] = pent->co.shco.green->color >> 8;
+ bmap[i] = pent->co.shco.blue->color >> 8;
+ }
+ else if (pent->refcnt != 0) {
+ rmap[i] = pent->co.local.red >> 8;
+ gmap[i] = pent->co.local.green >> 8;
+ bmap[i] = pent->co.local.blue >> 8;
+ }
+ }
+ }
+ pPrivate->installedMap = cmap;
+ (*pPrivate->UpdateColormap) (cmap->pScreen, 0, 256, rmap, gmap, bmap);
+ WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid));
+}
+
+void sunUninstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ if (cmap == pPrivate->installedMap) {
+ Colormap defMapID = cmap->pScreen->defColormap;
+
+ if (cmap->mid != defMapID) {
+ ColormapPtr defMap = (ColormapPtr) LookupIDByType(defMapID,
+ RT_COLORMAP);
+
+ if (defMap)
+ (*cmap->pScreen->InstallColormap)(defMap);
+ else
+ ErrorF("sunFbs: Can't find default colormap\n");
+ }
+ }
+}
+
+int sunListInstalledColormaps(pScreen, pCmapList)
+ ScreenPtr pScreen;
+ Colormap *pCmapList;
+{
+ SetupScreen(pScreen);
+ *pCmapList = pPrivate->installedMap->mid;
+ return (1);
+}
+
+static void CGStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ SetupScreen(pmap->pScreen);
+ u_char rmap[256], gmap[256], bmap[256];
+ xColorItem expanddefs[256];
+ register int i;
+
+ if (pPrivate->installedMap != NULL && pPrivate->installedMap != pmap)
+ return;
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
+ ndef = cfbExpandDirectColors(pmap, ndef, pdefs, expanddefs);
+ pdefs = expanddefs;
+ }
+ while (ndef--) {
+ i = pdefs->pixel;
+ rmap[i] = pdefs->red >> 8;
+ gmap[i] = pdefs->green >> 8;
+ bmap[i] = pdefs->blue >> 8;
+ (*pPrivate->UpdateColormap) (pmap->pScreen, i, 1, rmap, gmap, bmap);
+ pdefs++;
+ }
+}
+
+static void CGScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+#ifndef STATIC_COLOR /* { */
+ SetupScreen (pScreen);
+ pScreen->InstallColormap = sunInstallColormap;
+ pScreen->UninstallColormap = sunUninstallColormap;
+ pScreen->ListInstalledColormaps = sunListInstalledColormaps;
+ pScreen->StoreColors = CGStoreColors;
+ pPrivate->UpdateColormap = CGUpdateColormap;
+ pPrivate->GetColormap = CGGetColormap;
+ if (sunFlipPixels) {
+ Pixel pixel = pScreen->whitePixel;
+ pScreen->whitePixel = pScreen->blackPixel;
+ pScreen->blackPixel = pixel;
+ }
+#endif /* } */
+}
+
+static void checkMono (argc, argv)
+ int argc;
+ char** argv;
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-mono") == 0)
+ ErrorF ("-mono not appropriate for CG3/CG4/CG6\n");
+}
+
+/*
+ * CG3_MMAP_OFFSET is #defined in <pixrect/cg3var.h> or <sys/cg3var.h>
+ * on SunOS and Solaris respectively. Under Solaris, cg3var.h
+ * #includes a non-existent file, and causes the make to abort. Other
+ * systems may not have cg3var.h at all. Since all cg3var.h is needed
+ * for is this one #define, we'll just #define it here and let it go at that.
+ */
+
+#define CG3_MMAP_OFFSET 0x04000000
+
+Bool sunCG3Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ checkMono (argc, argv);
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ return sunInitCommon (screen, pScreen, (off_t) CG3_MMAP_OFFSET,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, 0);
+}
+
+Bool sunTCXInit (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ checkMono (argc, argv);
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ return sunInitCommon (screen, pScreen, (off_t) 0,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, 0);
+}
+
+#if !defined(i386) && !defined(__bsdi__) /* { */
+
+#ifdef SVR4 /* { */
+#include <sys/cg2reg.h>
+#else
+#ifndef CSRG_BASED /* { */
+#include <pixrect/cg2reg.h>
+#else
+#if defined(__sparc__) || defined(__sparc) /* { */
+#include <machine/cgtworeg.h>
+#else
+#include <machine/cg2reg.h>
+#endif /* } */
+#endif /* } */
+#endif /* } */
+
+typedef struct {
+ struct cg2memfb mem;
+ struct cg2fb regs;
+} *CG2Ptr;
+
+static void CG2UpdateColormap(pScreen, index, count, rmap, gmap,bmap)
+ ScreenPtr pScreen;
+ int index, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb;
+#if __STDC__
+ volatile
+#endif
+ struct cg2statusreg *regp = &fb->regs.status.reg;
+
+ regp->update_cmap = 0;
+ while (count--) {
+ fb->regs.redmap[index] = rmap[index];
+ fb->regs.greenmap[index] = gmap[index];
+ fb->regs.bluemap[index] = bmap[index];
+ index++;
+ }
+ regp->update_cmap = 1;
+}
+
+static void CG2GetColormap(pScreen, index, count, rmap, gmap,bmap)
+ ScreenPtr pScreen;
+ int index, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb;
+
+ /* I don't even know if this works */
+ while (count--) {
+ rmap[index] = fb->regs.redmap[index];
+ gmap[index] = fb->regs.greenmap[index];
+ bmap[index] = fb->regs.bluemap[index];
+ index++;
+ }
+}
+
+static Bool CG2SaveScreen (pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+{
+ CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb;
+#if __STDC__
+ volatile
+#endif
+ struct cg2statusreg *regp = &fb->regs.status.reg;
+
+ if (on != SCREEN_SAVER_FORCER)
+ regp->video_enab = (on == SCREEN_SAVER_ON) ? 0 : 1;
+}
+
+static void CG2ScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+ CGScreenInit (pScreen);
+ pPrivate->UpdateColormap = CG2UpdateColormap;
+ pPrivate->GetColormap = CG2GetColormap;
+}
+
+Bool sunCG2Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ sunScreenPtr pPrivate;
+ int i;
+ Bool ret;
+ Bool mono = FALSE;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-mono") == 0)
+ mono = TRUE;
+
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ pScreen->SaveScreen = CG2SaveScreen;
+#ifndef LOWMEMFTPT
+ if (mono) {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ ret = sunInitCommon (screen, pScreen, (off_t) 0,
+ mfbScreenInit, NULL,
+ mfbCreateDefColormap, CG2SaveScreen, 0);
+ ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 1;
+ } else {
+#endif /* ifndef LOWMEMFTPT */
+ ret = sunInitCommon (screen, pScreen, (off_t) 0,
+ sunCfbScreenInit, CG2ScreenInit,
+ cfbCreateDefColormap, CG2SaveScreen,
+ (int) &((struct cg2memfb *) 0)->pixplane);
+ ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 0xFF;
+#ifndef LOWMEMFTPT
+ }
+#endif /* ifndef LOWMEMFTPT */
+ return ret;
+}
+
+#define CG4_HEIGHT 900
+#define CG4_WIDTH 1152
+
+#define CG4_MELEN (128*1024)
+
+typedef struct {
+ u_char mpixel[CG4_MELEN]; /* bit-per-pixel memory */
+ u_char epixel[CG4_MELEN]; /* enable plane */
+ u_char cpixel[CG4_HEIGHT][CG4_WIDTH]; /* byte-per-pixel memory */
+} *CG4Ptr;
+
+static void CG4Switch (pScreen, select)
+ ScreenPtr pScreen;
+ int select;
+{
+ CG4Ptr fb = (CG4Ptr) sunFbs[pScreen->myNum].fb;
+
+ (void) memset ((char *)fb->epixel, select ? ~0 : 0, CG4_MELEN);
+}
+
+Bool sunCG4Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ checkMono (argc, argv);
+ if (sunCG4Frob)
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ else
+ sunFbs[screen].EnterLeave = CG4Switch;
+ return sunInitCommon (screen, pScreen, (off_t) 0,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, (int) ((CG4Ptr) 0)->cpixel);
+}
+
+#ifdef FBTYPE_SUNFAST_COLOR /* { */
+
+#define CG6_MMAP_OFFSET 0x70000000
+#define CG6_IMAGE_OFFSET 0x16000
+
+Bool sunCG6Init (screen, pScreen, argc, argv)
+ int screen; /* The index of pScreen in the ScreenInfo */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ pointer fb;
+
+ checkMono (argc, argv);
+ if (!sunScreenAllocate (pScreen))
+ return FALSE;
+ if (!sunFbs[screen].fb) {
+/* Sun's VME, Sbus, and SVR4 drivers all return different values */
+#define FBSIZE (size_t) sunFbs[screen].info.fb_width * \
+ sunFbs[screen].info.fb_height + CG6_IMAGE_OFFSET
+ if ((fb = sunMemoryMap (FBSIZE,
+ (off_t) CG6_MMAP_OFFSET,
+ sunFbs[screen].fd)) == NULL)
+ return FALSE;
+ sunFbs[screen].fb = fb;
+#undef FBSIZE
+ }
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ if (!sunCfbSetupScreen (pScreen,
+ sunFbs[screen].fb + CG6_IMAGE_OFFSET,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+#ifndef LOWMEMFTPT
+ if (sunNoGX == FALSE) {
+ if (!sunGXInit (pScreen, &sunFbs[screen]))
+ return FALSE;
+ }
+#endif /* ifndef LOWMEMFTPT */
+ if (!sunCfbFinishScreenInit(pScreen,
+ sunFbs[screen].fb + CG6_IMAGE_OFFSET,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+ if (sunNoGX == FALSE) {
+ miSetZeroLineBias(pScreen, GXZEROLINEBIAS);
+ }
+ miInitializeBackingStore(pScreen);
+ CGScreenInit (pScreen);
+ if (!sunScreenInit (pScreen))
+ return FALSE;
+ sunSaveScreen (pScreen, SCREEN_SAVER_OFF);
+ return cfbCreateDefColormap(pScreen);
+}
+#endif /* } */
+#endif /* } */
diff --git a/xc/programs/Xserver/hw/sun/sunCfb24.c b/xc/programs/Xserver/hw/sun/sunCfb24.c
new file mode 100644
index 000000000..e92ab4075
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunCfb24.c
@@ -0,0 +1,136 @@
+
+/* $TOG: sunCfb24.c /main/4 1998/02/10 13:16:15 kaleb $ */
+
+/*
+
+Copyright 1994, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * The CG8 is similar to the CG4 in that it has a mono plane, an enable
+ * plane, and a color plane. While the CG4 only has an 8-bit color
+ * plane the CG8 has a 24-bit color plane.
+ *
+ * If you have a CG4 you know that you can switch between the mono and
+ * the color screens merely by dragging the pointer off the edge of the
+ * screen, causing the other screen to be switched in. However this is
+ * the cause of some consternation on the part of those people who have
+ * both a CG4 and another frame buffer.
+ *
+ * Because of this problem, and some other considerations, I have chosen
+ * to ignore the mono plane of the CG8 in this code.
+ */
+
+#define PSZ 32
+#include "sun.h"
+#include "cfb/cfb.h"
+
+#define PIXPG_24BIT_COLOR 5
+#define PIXPG_24BIT_COLOR_INDEX (PIXPG_24BIT_COLOR << 25)
+#define PR_FORCE_UPDATE (1 << 24)
+
+static void CG24UpdateColormap(pScreen, index, count, rmap, gmap, bmap)
+ ScreenPtr pScreen;
+ int index, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ struct fbcmap sunCmap;
+
+ sunCmap.index = index | PIXPG_24BIT_COLOR_INDEX | PR_FORCE_UPDATE;
+ sunCmap.count = count;
+ sunCmap.red = &rmap[index];
+ sunCmap.green = &gmap[index];
+ sunCmap.blue = &bmap[index];
+
+ if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) == -1)
+ FatalError( "CG24UpdateColormap: FBIOPUTCMAP failed\n");
+}
+
+static void CG24StoreColors (pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem* pdefs;
+{
+ struct fbcmap cmap;
+ u_char rmap[256], gmap[256], bmap[256];
+ SetupScreen (pmap->pScreen);
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+
+ if (pPrivate->installedMap != NULL && pPrivate->installedMap != pmap)
+ return;
+ for (i = 0; i < 256; i++) {
+ rmap[i] = pmap->red[i].co.local.red >> 8;
+ gmap[i] = pmap->green[i].co.local.green >> 8;
+ bmap[i] = pmap->blue[i].co.local.blue >> 8;
+ }
+ while (ndef--) {
+ i = pdefs->pixel;
+ if (pdefs->flags & DoRed)
+ rmap[(i & pVisual->redMask) >> pVisual->offsetRed] = (pdefs->red >> 8);
+ if (pdefs->flags & DoGreen)
+ gmap[(i & pVisual->greenMask) >> pVisual->offsetGreen] = (pdefs->green >> 8);
+ if (pdefs->flags & DoBlue)
+ bmap[(i & pVisual->blueMask) >> pVisual->offsetBlue] = (pdefs->blue >> 8);
+ pdefs++;
+ }
+ CG24UpdateColormap (pmap->pScreen, 0, 256, rmap, gmap, bmap);
+}
+
+#define CG8_COLOR_OFFSET 0x40000
+
+static void CG24ScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+#ifndef STATIC_COLOR
+ SetupScreen (pScreen);
+#endif
+ int i;
+
+ /* Make sure the overlay plane is disabled */
+ for (i = 0; i < CG8_COLOR_OFFSET; i++)
+ sunFbs[pScreen->myNum].fb[i] = 0;
+
+#ifndef STATIC_COLOR
+ pScreen->InstallColormap = sunInstallColormap;
+ pScreen->UninstallColormap = sunUninstallColormap;
+ pScreen->ListInstalledColormaps = sunListInstalledColormaps;
+ pScreen->StoreColors = CG24StoreColors;
+ pPrivate->UpdateColormap = CG24UpdateColormap;
+ if (sunFlipPixels) {
+ Pixel pixel = pScreen->whitePixel;
+ pScreen->whitePixel = pScreen->blackPixel;
+ pScreen->blackPixel = pixel;
+ }
+#endif
+}
+
+Bool sunCG8Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ return sunInitCommon (screen, pScreen, (off_t) 0,
+ cfb32ScreenInit, CG24ScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, CG8_COLOR_OFFSET);
+}
+
diff --git a/xc/programs/Xserver/hw/sun/sunCursor.c b/xc/programs/Xserver/hw/sun/sunCursor.c
new file mode 100644
index 000000000..aa04ec4df
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunCursor.c
@@ -0,0 +1,296 @@
+/* $TOG: sunCursor.c /main/45 1998/02/10 13:16:24 kaleb $ */
+/*
+
+Copyright 1988 Sun Microsystems, Inc.
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/hw/sun/sunCursor.c,v 3.1 1998/10/04 09:38:35 dawes Exp $ */
+
+/*-
+ * sunCursor.c --
+ * Functions for maintaining the Sun software cursor...
+ *
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+#ifdef FBIOGCURMAX /* has hardware cursor kernel support */
+
+#define GetCursorPrivate(s) (&(GetScreenPrivate(s)->hardwareCursor))
+#define SetupCursor(s) sunCursorPtr pCurPriv = GetCursorPrivate(s)
+
+static void sunLoadCursor();
+
+static Bool
+sunRealizeCursor (pScreen, pCursor)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ SetupCursor(pScreen);
+ int x, y;
+
+ /* miRecolorCursor does this */
+ if (pCurPriv->pCursor == pCursor)
+ {
+ miPointerPosition (&x, &y);
+ sunLoadCursor (pScreen, pCursor, x, y);
+ }
+ return TRUE;
+}
+
+static Bool
+sunUnrealizeCursor (pScreen, pCursor)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ return TRUE;
+}
+
+static void
+sunCursorRepad (pScreen, bits, src_bits, dst_bits, ptSrc, w, h)
+ ScreenPtr pScreen;
+ CursorBitsPtr bits;
+ unsigned char *src_bits, *dst_bits;
+ DDXPointPtr ptSrc;
+ int w, h;
+{
+ SetupCursor(pScreen);
+ PixmapPtr src, dst;
+ BoxRec box;
+ RegionRec rgnDst;
+#ifndef LOWMEMFTPT
+ extern int mfbDoBitblt();
+#else
+ extern int cfbDoBitblt();
+#endif /* ifndef LOWMEMFTPT */
+
+ if (!(src = GetScratchPixmapHeader(pScreen, bits->width, bits->height,
+ /*bpp*/ 1, /*depth*/ 1,
+ PixmapBytePad(bits->width,1), src_bits)))
+ return;
+ if (!(dst = GetScratchPixmapHeader(pScreen, w, h, /*bpp*/ 1, /*depth*/ 1,
+ PixmapBytePad(w,1), dst_bits)))
+ {
+ FreeScratchPixmapHeader(src);
+ return;
+ }
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+#ifndef LOWMEMFTPT
+ mfbDoBitblt(src, dst, GXcopy, &rgnDst, ptSrc);
+#else
+ cfbDoBitblt(src, dst, GXcopy, &rgnDst, ptSrc, 0xFFFFFFFF);
+#endif /* ifndef LOWMEMFTPT */
+ REGION_UNINIT(pScreen, &rgnDst);
+ FreeScratchPixmapHeader(src);
+ FreeScratchPixmapHeader(dst);
+}
+
+static void
+sunLoadCursor (pScreen, pCursor, x, y)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ int x, y;
+{
+ SetupCursor(pScreen);
+ struct fbcursor fbcursor;
+ int w, h;
+ unsigned char r[2], g[2], b[2];
+ DDXPointRec ptSrc;
+ unsigned char source_temp[1024], mask_temp[1024];
+
+ fbcursor.set = FB_CUR_SETALL;
+ fbcursor.enable = 1;
+ fbcursor.pos.x = x;
+ fbcursor.pos.y = y;
+ fbcursor.hot.x = pCursor->bits->xhot;
+ fbcursor.hot.y = pCursor->bits->yhot;
+ r[0] = pCursor->backRed >> 8;
+ g[0] = pCursor->backGreen >> 8;
+ b[0] = pCursor->backBlue >> 8;
+ r[1] = pCursor->foreRed >> 8;
+ g[1] = pCursor->foreGreen >> 8;
+ b[1] = pCursor->foreBlue >> 8;
+ fbcursor.cmap.index = 0;
+ fbcursor.cmap.count = 2;
+ fbcursor.cmap.red = r;
+ fbcursor.cmap.green = g;
+ fbcursor.cmap.blue = b;
+ fbcursor.image = (char *) pCursor->bits->source;
+ fbcursor.mask = (char *) pCursor->bits->mask;
+ w = pCursor->bits->width;
+ h = pCursor->bits->height;
+ if (w > pCurPriv->width || h > pCurPriv->height) {
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ if (w > pCurPriv->width)
+ w = pCurPriv->width;
+ if (h > pCurPriv->height)
+ h = pCurPriv->height;
+ sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->source,
+ source_temp, &ptSrc, w, h);
+ sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->mask,
+ mask_temp, &ptSrc, w, h);
+ fbcursor.image = (char *) source_temp;
+ fbcursor.mask = (char *) mask_temp;
+ }
+ fbcursor.size.x = w;
+ fbcursor.size.y = h;
+#ifndef Lynx
+ (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor);
+#else
+ (void) sunIoctl (&sunFbs[pScreen->myNum], FBIOSCURSOR, &fbcursor);
+#endif
+}
+
+static void
+sunSetCursor (pScreen, pCursor, x, y)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ int x, y;
+{
+ SetupCursor(pScreen);
+
+ if (pCursor)
+ sunLoadCursor (pScreen, pCursor, x, y);
+ else
+ sunDisableCursor (pScreen);
+ pCurPriv->pCursor = pCursor;
+}
+
+static void
+sunMoveCursor (pScreen, x, y)
+ ScreenPtr pScreen;
+ int x, y;
+{
+ SetupCursor(pScreen);
+ struct fbcurpos pos;
+
+ pos.x = x;
+ pos.y = y;
+#ifndef Lynx
+ ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURPOS, &pos);
+#else
+ sunIoctl (&sunFbs[pScreen->myNum], FBIOSCURPOS, &pos);
+#endif
+}
+
+miPointerSpriteFuncRec sunPointerSpriteFuncs = {
+ sunRealizeCursor,
+ sunUnrealizeCursor,
+ sunSetCursor,
+ sunMoveCursor,
+};
+
+static void
+sunQueryBestSize (class, pwidth, pheight, pScreen)
+ int class;
+ unsigned short *pwidth, *pheight;
+ ScreenPtr pScreen;
+{
+ SetupCursor (pScreen);
+
+ switch (class)
+ {
+ case CursorShape:
+ if (*pwidth > pCurPriv->width)
+ *pwidth = pCurPriv->width;
+ if (*pheight > pCurPriv->height)
+ *pheight = pCurPriv->height;
+ if (*pwidth > pScreen->width)
+ *pwidth = pScreen->width;
+ if (*pheight > pScreen->height)
+ *pheight = pScreen->height;
+ break;
+ default:
+ mfbQueryBestSize (class, pwidth, pheight, pScreen);
+ break;
+ }
+}
+
+extern miPointerScreenFuncRec sunPointerScreenFuncs;
+
+#endif
+
+#if NeedFunctionPrototypes
+Bool sunCursorInitialize (
+ ScreenPtr pScreen)
+#else
+Bool sunCursorInitialize (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+#ifdef FBIOGCURMAX
+ SetupCursor (pScreen);
+ struct fbcurpos maxsize;
+
+ pCurPriv->has_cursor = FALSE;
+#ifndef Lynx
+ if (ioctl (sunFbs[pScreen->myNum].fd, FBIOGCURMAX, &maxsize) == -1)
+#else
+ if (sunIoctl (&sunFbs[pScreen->myNum], FBIOGCURMAX, &maxsize) == -1)
+#endif
+ return FALSE;
+ pCurPriv->width = maxsize.x;
+ pCurPriv->height= maxsize.y;
+ pScreen->QueryBestSize = sunQueryBestSize;
+ miPointerInitialize (pScreen,
+ &sunPointerSpriteFuncs,
+ &sunPointerScreenFuncs,
+ FALSE);
+ pCurPriv->has_cursor = TRUE;
+ pCurPriv->pCursor = NULL;
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+#if NeedFunctionPrototypes
+void sunDisableCursor (
+ ScreenPtr pScreen)
+#else
+void sunDisableCursor (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+#ifdef FBIOGCURMAX
+ SetupCursor (pScreen);
+ struct fbcursor fbcursor;
+
+ if (pCurPriv->has_cursor)
+ {
+ fbcursor.set = FB_CUR_SETCUR;
+ fbcursor.enable = 0;
+#ifndef Lynx
+ (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor);
+#else
+ (void) sunIoctl (&sunFbs[pScreen->myNum], FBIOSCURSOR, &fbcursor);
+#endif
+ pCurPriv->pCursor = NULL;
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/hw/sun/sunFbs.c b/xc/programs/Xserver/hw/sun/sunFbs.c
new file mode 100644
index 000000000..746213f03
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunFbs.c
@@ -0,0 +1,288 @@
+
+/* $TOG: sunFbs.c /main/10 1998/02/10 13:16:29 kaleb $ */
+
+/*
+Copyright 1990, 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sunFbs.c,v 1.3 1998/10/04 09:38:35 dawes Exp $ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+#include "sun.h"
+#include <sys/mman.h>
+
+int sunScreenIndex;
+
+static unsigned long generation = 0;
+
+#if NeedFunctionPrototypes
+pointer sunMemoryMap (
+ size_t len,
+ off_t off,
+ int fd)
+#else
+pointer sunMemoryMap (len, off, fd)
+ size_t len;
+ off_t off;
+ int fd;
+#endif
+{
+ int pagemask, mapsize;
+ caddr_t addr;
+ pointer mapaddr;
+
+#ifdef SVR4
+ pagemask = sysconf(_SC_PAGESIZE) - 1;
+#else
+ pagemask = getpagesize() - 1;
+#endif
+ mapsize = ((int) len + pagemask) & ~pagemask;
+ addr = 0;
+
+#if !defined(__bsdi__) && !defined(_MAP_NEW)
+ if ((addr = (caddr_t) valloc (mapsize)) == NULL) {
+ Error ("Couldn't allocate frame buffer memory");
+ (void) close (fd);
+ return NULL;
+ }
+#endif
+
+ /*
+ * try and make it private first, that way once we get it, an
+ * interloper, e.g. another server, can't get this frame buffer,
+ * and if another server already has it, this one won't.
+ */
+ if ((int)(mapaddr = (pointer) mmap (addr,
+ mapsize,
+ PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ fd, off)) == -1)
+ mapaddr = (pointer) mmap (addr,
+ mapsize,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, off);
+ if (mapaddr == (pointer) -1) {
+ Error ("mapping frame buffer memory");
+ (void) close (fd);
+ mapaddr = (pointer) NULL;
+ }
+ return mapaddr;
+}
+
+#if NeedFunctionPrototypes
+Bool sunScreenAllocate (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenAllocate (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ sunScreenPtr pPrivate;
+ extern int AllocateScreenPrivateIndex();
+
+ if (generation != serverGeneration)
+ {
+ sunScreenIndex = AllocateScreenPrivateIndex();
+ if (sunScreenIndex < 0)
+ return FALSE;
+ generation = serverGeneration;
+ }
+ pPrivate = (sunScreenPtr) xalloc (sizeof (sunScreenRec));
+ if (!pPrivate)
+ return FALSE;
+
+ pScreen->devPrivates[sunScreenIndex].ptr = (pointer) pPrivate;
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunSaveScreen (
+ ScreenPtr pScreen,
+ int on)
+#else
+Bool sunSaveScreen (pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+#endif
+{
+ int state;
+
+ if (on != SCREEN_SAVER_FORCER)
+ {
+ if (on == SCREEN_SAVER_ON)
+ state = 0;
+ else
+ state = 1;
+ (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
+ }
+ return( TRUE );
+}
+
+static Bool closeScreen (i, pScreen)
+ int i;
+ ScreenPtr pScreen;
+{
+ SetupScreen(pScreen);
+ Bool ret;
+
+ (void) OsSignal (SIGIO, SIG_IGN);
+ sunDisableCursor (pScreen);
+ pScreen->CloseScreen = pPrivate->CloseScreen;
+ ret = (*pScreen->CloseScreen) (i, pScreen);
+ (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ xfree ((pointer) pPrivate);
+ return ret;
+}
+
+#if NeedFunctionPrototypes
+Bool sunScreenInit (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenInit (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ SetupScreen(pScreen);
+ extern void sunBlockHandler();
+ extern void sunWakeupHandler();
+ static ScreenPtr autoRepeatScreen;
+ extern miPointerScreenFuncRec sunPointerScreenFuncs;
+
+ pPrivate->installedMap = 0;
+ pPrivate->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = closeScreen;
+ pScreen->SaveScreen = sunSaveScreen;
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ /*
+ * Block/Unblock handlers
+ */
+ if (sunAutoRepeatHandlersInstalled == FALSE) {
+ autoRepeatScreen = pScreen;
+ sunAutoRepeatHandlersInstalled = TRUE;
+ }
+
+ if (pScreen == autoRepeatScreen) {
+ pScreen->BlockHandler = sunBlockHandler;
+ pScreen->WakeupHandler = sunWakeupHandler;
+ }
+#ifdef XKB
+ }
+#endif
+ if (!sunCursorInitialize (pScreen))
+ miDCInitialize (pScreen, &sunPointerScreenFuncs);
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunInitCommon (
+ int scrn,
+ ScreenPtr pScrn,
+ off_t offset,
+ Bool (*init1)(),
+ void (*init2)(),
+ Bool (*cr_cm)(),
+ Bool (*save)(),
+ int fb_off)
+#else
+Bool sunInitCommon (scrn, pScrn, offset, init1, init2, cr_cm, save, fb_off)
+ int scrn;
+ ScreenPtr pScrn;
+ off_t offset;
+ Bool (*init1)();
+ void (*init2)();
+ Bool (*cr_cm)();
+ Bool (*save)();
+ int fb_off;
+#endif
+{
+ unsigned char* fb = sunFbs[scrn].fb;
+
+ if (!sunScreenAllocate (pScrn))
+ return FALSE;
+ if (!fb) {
+ if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size,
+ offset,
+ sunFbs[scrn].fd)) == NULL)
+ return FALSE;
+ sunFbs[scrn].fb = fb;
+ }
+ /* mfbScreenInit() or cfbScreenInit() */
+ if (!(*init1)(pScrn, fb + fb_off,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_depth))
+ return FALSE;
+ miInitializeBackingStore(pScrn);
+ /* sunCGScreenInit() if cfb... */
+ if (init2)
+ (*init2)(pScrn);
+ if (!sunScreenInit(pScrn))
+ return FALSE;
+ (void) (*save) (pScrn, SCREEN_SAVER_OFF);
+ return (*cr_cm)(pScrn);
+}
+
diff --git a/xc/programs/Xserver/hw/sun/sunGX.c b/xc/programs/Xserver/hw/sun/sunGX.c
new file mode 100644
index 000000000..7e6b6f7f1
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunGX.c
@@ -0,0 +1,2909 @@
+#ifndef lint
+static char *rid="$TOG: sunGX.c /main/28 1998/02/10 13:16:33 kaleb $";
+#endif /* lint */
+/*
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sunGX.c,v 1.3 1998/10/04 09:38:36 dawes Exp $ */
+
+#include "sun.h"
+
+#include "Xmd.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "cfb/cfb.h"
+#include "cfb/cfbmskbits.h"
+#include "cfb/cfb8bit.h"
+#include "fastblt.h"
+#include "mergerop.h"
+#include "sunGX.h"
+#include "migc.h"
+
+#define sunGXFillSpan(gx,y,x1,x2,r) {\
+ (gx)->apointy = (y); \
+ (gx)->apointx = (x1); \
+ (gx)->arectx = (x2); \
+ GXDrawDone(gx,r); \
+}
+
+#define GXSetClip(gx,pbox) {\
+ (gx)->clipminx = (pbox)->x1; \
+ (gx)->clipminy = (pbox)->y1; \
+ (gx)->clipmaxx = (pbox)->x2 - 1; \
+ (gx)->clipmaxy = (pbox)->y2 - 1; \
+}
+
+#define GXSetOff(gx,x,y) {\
+ (gx)->offx = (x); \
+ (gx)->offy = (y); \
+}
+
+#define GXResetClip(gx,pScreen) { \
+ (gx)->clipminx = 0; \
+ (gx)->clipminy = 0; \
+ (gx)->clipmaxx = (pScreen)->width - 1; \
+ (gx)->clipmaxy = (pScreen)->height - 1; \
+}
+
+#define GXResetOff(gx) {\
+ (gx)->offx = 0; \
+ (gx)->offy = 0; \
+}
+
+#define sunGXGetAddrRange(pDrawable,extents,base,lo,hi) {\
+ int __x__; \
+ cfbGetWindowByteWidthAndPointer((WindowPtr)pDrawable,__x__,base); \
+ lo = (base) + WIDTH_MUL((extents)->y1) + (extents)->x1; \
+ hi = (base) + WIDTH_MUL((extents)->y2 - 1) + (extents)->x2 - 1; \
+ (base) = (base) + WIDTH_MUL(pDrawable->y) + pDrawable->x; \
+}
+
+/*
+ rop_tables
+ ==========
+ lookup tables for GX raster ops, with the plane_mask,pixel_mask,pattern_mask
+ ,attrib_sel, polygon_draw,raster_mode encoded into the top half.
+ There is a lookup table for each commonly used combination.
+*/
+
+/* rops for bit blit / copy area
+ with:
+ Plane Mask - use plane mask reg.
+ Pixel Mask - use all ones.
+ Patt Mask - use all ones.
+*/
+
+#define POLY_O GX_POLYG_OVERLAP
+#define POLY_N GX_POLYG_NONOVERLAP
+
+#define ROP_STANDARD (GX_PLANE_MASK |\
+ GX_PIXEL_ONES |\
+ GX_ATTR_SUPP |\
+ GX_RAST_BOOL |\
+ GX_PLOT_PLOT)
+
+/* fg = don't care bg = don't care */
+
+#define ROP_BLIT(O,I) (ROP_STANDARD | \
+ GX_PATTERN_ONES |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(O) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(O) |\
+ GX_ROP_01_1(I) |\
+ GX_ROP_01_0(O) |\
+ GX_ROP_00_1(I) |\
+ GX_ROP_00_0(O))
+
+/* fg = fgPixel bg = don't care */
+
+#define ROP_FILL(O,I) (ROP_STANDARD | \
+ GX_PATTERN_ONES |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(I) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(I) | \
+ GX_ROP_01_1(O) |\
+ GX_ROP_01_0(O) |\
+ GX_ROP_00_1(O) |\
+ GX_ROP_00_0(O))
+
+/* fg = fgPixel bg = don't care */
+
+#define ROP_STIP(O,I) (ROP_STANDARD |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(GX_ROP_NOOP) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(GX_ROP_NOOP) | \
+ GX_ROP_01_1(O) |\
+ GX_ROP_01_0(GX_ROP_NOOP) |\
+ GX_ROP_00_1(O) |\
+ GX_ROP_00_0(GX_ROP_NOOP))
+
+/* fg = fgPixel bg = bgPixel */
+
+#define ROP_OSTP(O,I) (ROP_STANDARD |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(I) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(O) |\
+ GX_ROP_01_1(O) |\
+ GX_ROP_01_0(I) |\
+ GX_ROP_00_1(O) |\
+ GX_ROP_00_0(O))
+
+#define ROP_ITXT(O,I) (ROP_STANDARD |\
+ GX_PATTERN_ONES |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(I) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(O) |\
+ GX_ROP_01_1(O) |\
+ GX_ROP_01_0(I) |\
+ GX_ROP_00_1(O) |\
+ GX_ROP_00_0(O))
+
+#define ROP_PTXT(O,I) (ROP_STANDARD |\
+ GX_PATTERN_ONES |\
+ GX_ROP_11_1(I) |\
+ GX_ROP_11_0(GX_ROP_NOOP) |\
+ GX_ROP_10_1(I) |\
+ GX_ROP_10_0(GX_ROP_NOOP) | \
+ GX_ROP_01_1(O) |\
+ GX_ROP_01_0(GX_ROP_NOOP) |\
+ GX_ROP_00_1(O) |\
+ GX_ROP_00_0(GX_ROP_NOOP))
+
+static Uint gx_blit_rop_table[16]={
+ ROP_BLIT(GX_ROP_CLEAR, GX_ROP_CLEAR), /* GXclear */
+ ROP_BLIT(GX_ROP_CLEAR, GX_ROP_NOOP), /* GXand */
+ ROP_BLIT(GX_ROP_CLEAR, GX_ROP_INVERT), /* GXandReverse */
+ ROP_BLIT(GX_ROP_CLEAR, GX_ROP_SET), /* GXcopy */
+ ROP_BLIT(GX_ROP_NOOP, GX_ROP_CLEAR), /* GXandInverted */
+ ROP_BLIT(GX_ROP_NOOP, GX_ROP_NOOP), /* GXnoop */
+ ROP_BLIT(GX_ROP_NOOP, GX_ROP_INVERT), /* GXxor */
+ ROP_BLIT(GX_ROP_NOOP, GX_ROP_SET), /* GXor */
+ ROP_BLIT(GX_ROP_INVERT, GX_ROP_CLEAR), /* GXnor */
+ ROP_BLIT(GX_ROP_INVERT, GX_ROP_NOOP), /* GXequiv */
+ ROP_BLIT(GX_ROP_INVERT, GX_ROP_INVERT), /* GXinvert */
+ ROP_BLIT(GX_ROP_INVERT, GX_ROP_SET), /* GXorReverse */
+ ROP_BLIT(GX_ROP_SET, GX_ROP_CLEAR), /* GXcopyInverted */
+ ROP_BLIT(GX_ROP_SET, GX_ROP_NOOP), /* GXorInverted */
+ ROP_BLIT(GX_ROP_SET, GX_ROP_INVERT), /* GXnand */
+ ROP_BLIT(GX_ROP_SET, GX_ROP_SET), /* GXset */
+};
+
+/* rops for solid drawing
+ with:
+ Plane Mask - use plane mask reg.
+ Pixel Mask - use all ones.
+ Patt Mask - use all ones.
+*/
+
+static Uint gx_solid_rop_table[16]={
+ ROP_FILL(GX_ROP_CLEAR, GX_ROP_CLEAR), /* GXclear */
+ ROP_FILL(GX_ROP_CLEAR, GX_ROP_NOOP), /* GXand */
+ ROP_FILL(GX_ROP_CLEAR, GX_ROP_INVERT), /* GXandReverse */
+ ROP_FILL(GX_ROP_CLEAR, GX_ROP_SET), /* GXcopy */
+ ROP_FILL(GX_ROP_NOOP, GX_ROP_CLEAR), /* GXandInverted */
+ ROP_FILL(GX_ROP_NOOP, GX_ROP_NOOP), /* GXnoop */
+ ROP_FILL(GX_ROP_NOOP, GX_ROP_INVERT), /* GXxor */
+ ROP_FILL(GX_ROP_NOOP, GX_ROP_SET), /* GXor */
+ ROP_FILL(GX_ROP_INVERT, GX_ROP_CLEAR), /* GXnor */
+ ROP_FILL(GX_ROP_INVERT, GX_ROP_NOOP), /* GXequiv */
+ ROP_FILL(GX_ROP_INVERT, GX_ROP_INVERT), /* GXinvert */
+ ROP_FILL(GX_ROP_INVERT, GX_ROP_SET), /* GXorReverse */
+ ROP_FILL(GX_ROP_SET, GX_ROP_CLEAR), /* GXcopyInverted */
+ ROP_FILL(GX_ROP_SET, GX_ROP_NOOP), /* GXorInverted */
+ ROP_FILL(GX_ROP_SET, GX_ROP_INVERT), /* GXnand */
+ ROP_FILL(GX_ROP_SET, GX_ROP_SET), /* GXset */
+};
+
+static Uint gx_stipple_rop_table[16]={
+ ROP_STIP(GX_ROP_CLEAR, GX_ROP_CLEAR), /* GXclear */
+ ROP_STIP(GX_ROP_CLEAR, GX_ROP_NOOP), /* GXand */
+ ROP_STIP(GX_ROP_CLEAR, GX_ROP_INVERT), /* GXandReverse */
+ ROP_STIP(GX_ROP_CLEAR, GX_ROP_SET), /* GXcopy */
+ ROP_STIP(GX_ROP_NOOP, GX_ROP_CLEAR), /* GXandInverted */
+ ROP_STIP(GX_ROP_NOOP, GX_ROP_NOOP), /* GXnoop */
+ ROP_STIP(GX_ROP_NOOP, GX_ROP_INVERT), /* GXxor */
+ ROP_STIP(GX_ROP_NOOP, GX_ROP_SET), /* GXor */
+ ROP_STIP(GX_ROP_INVERT, GX_ROP_CLEAR), /* GXnor */
+ ROP_STIP(GX_ROP_INVERT, GX_ROP_NOOP), /* GXequiv */
+ ROP_STIP(GX_ROP_INVERT, GX_ROP_INVERT), /* GXinvert */
+ ROP_STIP(GX_ROP_INVERT, GX_ROP_SET), /* GXorReverse */
+ ROP_STIP(GX_ROP_SET, GX_ROP_CLEAR), /* GXcopyInverted */
+ ROP_STIP(GX_ROP_SET, GX_ROP_NOOP), /* GXorInverted */
+ ROP_STIP(GX_ROP_SET, GX_ROP_INVERT), /* GXnand */
+ ROP_STIP(GX_ROP_SET, GX_ROP_SET), /* GXset */
+};
+
+static Uint gx_opaque_stipple_rop_table[16]={
+ ROP_OSTP(GX_ROP_CLEAR, GX_ROP_CLEAR), /* GXclear */
+ ROP_OSTP(GX_ROP_CLEAR, GX_ROP_NOOP), /* GXand */
+ ROP_OSTP(GX_ROP_CLEAR, GX_ROP_INVERT), /* GXandReverse */
+ ROP_OSTP(GX_ROP_CLEAR, GX_ROP_SET), /* GXcopy */
+ ROP_OSTP(GX_ROP_NOOP, GX_ROP_CLEAR), /* GXandInverted */
+ ROP_OSTP(GX_ROP_NOOP, GX_ROP_NOOP), /* GXnoop */
+ ROP_OSTP(GX_ROP_NOOP, GX_ROP_INVERT), /* GXxor */
+ ROP_OSTP(GX_ROP_NOOP, GX_ROP_SET), /* GXor */
+ ROP_OSTP(GX_ROP_INVERT, GX_ROP_CLEAR), /* GXnor */
+ ROP_OSTP(GX_ROP_INVERT, GX_ROP_NOOP), /* GXequiv */
+ ROP_OSTP(GX_ROP_INVERT, GX_ROP_INVERT), /* GXinvert */
+ ROP_OSTP(GX_ROP_INVERT, GX_ROP_SET), /* GXorReverse */
+ ROP_OSTP(GX_ROP_SET, GX_ROP_CLEAR), /* GXcopyInverted */
+ ROP_OSTP(GX_ROP_SET, GX_ROP_NOOP), /* GXorInverted */
+ ROP_OSTP(GX_ROP_SET, GX_ROP_INVERT), /* GXnand */
+ ROP_OSTP(GX_ROP_SET, GX_ROP_SET), /* GXset */
+};
+
+int sunGXScreenPrivateIndex;
+int sunGXGCPrivateIndex;
+int sunGXWindowPrivateIndex;
+int sunGXGeneration;
+
+/*
+ sunGXDoBitBlt
+ =============
+ Bit Blit for all window to window blits.
+*/
+static void
+sunGXDoBitblt(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrc, pDst;
+ int alu;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pSrc->pScreen);
+ register long r;
+ register BoxPtr pboxTmp;
+ register DDXPointPtr pptTmp;
+ register int nbox;
+ BoxPtr pboxNext,pboxBase,pbox;
+
+ /* setup GX ( need fg of 0xff for blits ) */
+ GXBlitInit(gx,gx_blit_rop_table[alu]|POLY_O,planemask);
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ /* need to blit rectangles in different orders, depending on the direction of copy
+ so that an area isnt overwritten before it is blitted */
+ if( (pptSrc->y < pbox->y1) && (nbox > 1) ){
+
+ if( (pptSrc->x < pbox->x1) && (nbox > 1) ){
+
+ /* reverse order of bands and rects in each band */
+ pboxTmp=pbox+nbox;
+ pptTmp=pptSrc+nbox;
+
+ while (nbox--){
+ pboxTmp--;
+ pptTmp--;
+ gx->x0=pptTmp->x;
+ gx->y0=pptTmp->y;
+ gx->x1=pptTmp->x+(pboxTmp->x2-pboxTmp->x1)-1;
+ gx->y1=pptTmp->y+(pboxTmp->y2-pboxTmp->y1)-1;
+ gx->x2=pboxTmp->x1;
+ gx->y2=pboxTmp->y1;
+ gx->x3=pboxTmp->x2-1;
+ gx->y3=pboxTmp->y2-1;
+ GXBlitDone(gx,r);
+ }
+ }
+ else{
+
+ /* keep ordering in each band, reverse order of bands */
+ pboxBase = pboxNext = pbox+nbox-1;
+
+ while (pboxBase >= pbox){ /* for each band */
+
+ /* find first box in band */
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+
+ pboxTmp = pboxNext+1; /* first box in band */
+ pptTmp = pptSrc + (pboxTmp - pbox); /* first point in band */
+
+ while (pboxTmp <= pboxBase){ /* for each box in band */
+ gx->x0=pptTmp->x;
+ gx->y0=pptTmp->y;
+ gx->x1=pptTmp->x+(pboxTmp->x2-pboxTmp->x1)-1;
+ gx->y1=pptTmp->y+(pboxTmp->y2-pboxTmp->y1)-1;
+ gx->x2=pboxTmp->x1;
+ gx->y2=pboxTmp->y1;
+ gx->x3=pboxTmp->x2-1;
+ gx->y3=pboxTmp->y2-1;
+ ++pboxTmp;
+ ++pptTmp;
+ GXBlitDone(gx,r);
+ }
+ pboxBase = pboxNext;
+ }
+ }
+ }
+ else{
+
+ if( (pptSrc->x < pbox->x1) && (nbox > 1) ){
+
+ /* reverse order of rects in each band */
+ pboxBase = pboxNext = pbox;
+
+ while (pboxBase < pbox+nbox){ /* for each band */
+
+ /* find last box in band */
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+
+ pboxTmp = pboxNext; /* last box in band */
+ pptTmp = pptSrc + (pboxTmp - pbox); /* last point in band */
+
+ while (pboxTmp != pboxBase){ /* for each box in band */
+ --pboxTmp;
+ --pptTmp;
+ gx->x0=pptTmp->x;
+ gx->y0=pptTmp->y;
+ gx->x1=pptTmp->x+(pboxTmp->x2-pboxTmp->x1)-1;
+ gx->y1=pptTmp->y+(pboxTmp->y2-pboxTmp->y1)-1;
+ gx->x2=pboxTmp->x1;
+ gx->y2=pboxTmp->y1;
+ gx->x3=pboxTmp->x2-1;
+ gx->y3=pboxTmp->y2-1;
+ GXBlitDone(gx,r);
+ }
+ pboxBase = pboxNext;
+ }
+ }
+ else{
+
+ /* dont need to change order of anything */
+ pptTmp=pptSrc;
+ pboxTmp=pbox;
+
+ while(nbox--){
+ gx->x0=pptTmp->x;
+ gx->y0=pptTmp->y;
+ gx->x1=pptTmp->x+(pboxTmp->x2-pboxTmp->x1)-1;
+ gx->y1=pptTmp->y+(pboxTmp->y2-pboxTmp->y1)-1;
+ gx->x2=pboxTmp->x1;
+ gx->y2=pboxTmp->y1;
+ gx->x3=pboxTmp->x2-1;
+ gx->y3=pboxTmp->y2-1;
+ pboxTmp++;
+ pptTmp++;
+ GXBlitDone(gx,r);
+ }
+ }
+ }
+ GXWait(gx,r);
+}
+
+RegionPtr
+sunGXCopyArea(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty)
+ register DrawablePtr pSrcDrawable;
+ register DrawablePtr pDstDrawable;
+ GC *pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+{
+ if (pSrcDrawable->type != DRAWABLE_WINDOW)
+ return cfbCopyArea (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ return cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, sunGXDoBitblt, 0);
+}
+
+static unsigned long copyPlaneFG, copyPlaneBG;
+
+static void
+sunGXCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+ unsigned long bitPlane;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDstDrawable->pScreen);
+ int srcx, srcy, dstx, dsty, width, height;
+ int dstLastx, dstRightx;
+ int xoffSrc, widthSrc, widthRest;
+ int widthLast;
+ unsigned long *psrcBase, *psrcLine, *psrc;
+ unsigned long bits, tmp, lastTmp;
+ register int leftShift, rightShift;
+ register int nl, nlMiddle;
+ int nbox;
+ BoxPtr pbox;
+ register int r;
+
+ GXDrawInit (gx, copyPlaneFG,
+ gx_opaque_stipple_rop_table[rop]|GX_PATTERN_ONES,
+ planemask);
+ gx->bg = copyPlaneBG;
+ gx->mode = GX_BLIT_NOSRC | GX_MODE_COLOR1;
+
+ cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ gx->incx = 32;
+ gx->incy = 0;
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ dstLastx = pbox->x2;
+ width = dstLastx - dstx;
+ height = pbox->y2 - dsty;
+ pbox++;
+ pptSrc++;
+ if (!width)
+ continue;
+ psrc = psrcBase + srcy * widthSrc + (srcx >> 5);
+ dstLastx--;
+ dstRightx = dstx + 31;
+ nlMiddle = (width + 31) >> 5;
+ widthLast = width & 31;
+ xoffSrc = srcx & 0x1f;
+ leftShift = xoffSrc;
+ rightShift = 32 - leftShift;
+ widthRest = widthSrc - nlMiddle;
+ if (widthLast)
+ nlMiddle--;
+ if (leftShift == 0)
+ {
+ while (height--)
+ {
+ gx->x0 = dstx;
+ gx->x1 = dstRightx;
+ gx->y0 = dsty++;
+ nl = nlMiddle;
+ while (nl--)
+ gx->font = *psrc++;
+ if (widthLast)
+ {
+ gx->x1 = dstLastx;
+ gx->font = *psrc++;
+ }
+ psrc += widthRest;
+ }
+ }
+ else
+ {
+ widthRest--;
+ while (height--)
+ {
+ gx->x0 = dstx;
+ gx->x1 = dstRightx;
+ gx->y0 = dsty++;
+ bits = *psrc++;
+ nl = nlMiddle;
+ while (nl--)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ tmp |= BitRight(bits, rightShift);
+ gx->font = tmp;
+ }
+ if (widthLast)
+ {
+ tmp = BitLeft(bits, leftShift);
+ bits = *psrc++;
+ tmp |= BitRight(bits, rightShift);
+ gx->x1 = dstLastx;
+ gx->font = tmp;
+ }
+ psrc += widthRest;
+ }
+ }
+ }
+ GXWait (gx, r);
+ gx->incx = 0;
+ gx->incy = 0;
+ gx->mode = GX_BLIT_SRC | GX_MODE_COLOR8;
+}
+
+RegionPtr sunGXCopyPlane(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ GCPtr pGC;
+ int srcx, srcy;
+ int width, height;
+ int dstx, dsty;
+ unsigned long bitPlane;
+{
+ RegionPtr ret;
+ int (*doBitBlt)();
+
+ if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8)
+ {
+ if (bitPlane == 1)
+ {
+ copyPlaneFG = pGC->fgPixel;
+ copyPlaneBG = pGC->bgPixel;
+ ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, sunGXCopyPlane1to8, bitPlane);
+ }
+ else
+ ret = miHandleExposures (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ }
+ else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 1)
+ {
+ extern int InverseAlu[16];
+ int oldalu;
+
+ oldalu = pGC->alu;
+ if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1)
+ pGC->alu = InverseAlu[pGC->alu];
+ else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
+ pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
+ ret = cfbBitBlt (pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty, cfbCopyPlane8to1, bitPlane);
+ pGC->alu = oldalu;
+ }
+ else
+ {
+ PixmapPtr pBitmap;
+ ScreenPtr pScreen = pSrcDrawable->pScreen;
+ GCPtr pGC1;
+ unsigned long fg, bg;
+
+ pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1);
+ if (!pBitmap)
+ return NULL;
+ pGC1 = GetScratchGC (1, pScreen);
+ if (!pGC1)
+ {
+ (*pScreen->DestroyPixmap) (pBitmap);
+ return NULL;
+ }
+ /*
+ * don't need to set pGC->fgPixel,bgPixel as copyPlane8to1
+ * ignores pixel values, expecting the rop to "do the
+ * right thing", which GXcopy will.
+ */
+ ValidateGC ((DrawablePtr) pBitmap, pGC1);
+ /* no exposures here, scratch GC's don't get graphics expose */
+ (void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap,
+ pGC1, srcx, srcy, width, height, 0, 0, cfbCopyPlane8to1, bitPlane);
+ copyPlaneFG = pGC->fgPixel;
+ copyPlaneBG = pGC->bgPixel;
+ (void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC,
+ 0, 0, width, height, dstx, dsty, sunGXCopyPlane1to8, 1);
+ FreeScratchGC (pGC1);
+ (*pScreen->DestroyPixmap) (pBitmap);
+ /* compute resultant exposures */
+ ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+ }
+ return ret;
+}
+
+void
+sunGXFillRectAll (pDrawable, pGC, nBox, pBox)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nBox;
+ BoxPtr pBox;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ register sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ register int r;
+
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_N,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ while (nBox--) {
+ gx->arecty = pBox->y1;
+ gx->arectx = pBox->x1;
+ gx->arecty = pBox->y2;
+ gx->arectx = pBox->x2;
+ pBox++;
+ GXDrawDone(gx,r);
+ }
+ GXWait(gx,r);
+}
+
+#define NUM_STACK_RECTS 1024
+
+void
+sunGXPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int nrectFill; /* number of rectangles to fill */
+ xRectangle *prectInit; /* Pointer to first rectangle to fill */
+{
+ xRectangle *prect;
+ RegionPtr prgnClip;
+ register BoxPtr pbox;
+ register BoxPtr pboxClipped;
+ BoxPtr pboxClippedBase;
+ BoxPtr pextent;
+ BoxRec stackRects[NUM_STACK_RECTS];
+ int numRects;
+ int n;
+ int xorg, yorg;
+
+ prgnClip = pGC->pCompositeClip;
+ prect = prectInit;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (xorg || yorg)
+ {
+ prect = prectInit;
+ n = nrectFill;
+ while(n--)
+ {
+ prect->x += xorg;
+ prect->y += yorg;
+ prect++;
+ }
+ }
+
+ prect = prectInit;
+
+ numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
+ if (numRects > NUM_STACK_RECTS)
+ {
+ pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+ if (!pboxClippedBase)
+ return;
+ }
+ else
+ pboxClippedBase = stackRects;
+
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1)
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_RECTS(prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ if ((pboxClipped->x1 = prect->x) < x1)
+ pboxClipped->x1 = x1;
+
+ if ((pboxClipped->y1 = prect->y) < y1)
+ pboxClipped->y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ pboxClipped->x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ pboxClipped->y2 = by2;
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2))
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ else
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ BoxRec box;
+
+ if ((box.x1 = prect->x) < x1)
+ box.x1 = x1;
+
+ if ((box.y1 = prect->y) < y1)
+ box.y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ box.x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ box.y2 = by2;
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--)
+ {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2)
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+ if (pboxClipped != pboxClippedBase)
+ sunGXFillRectAll(pDrawable, pGC,
+ pboxClipped-pboxClippedBase, pboxClippedBase);
+ if (pboxClippedBase != stackRects)
+ DEALLOCATE_LOCAL(pboxClippedBase);
+}
+
+void
+sunGXFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int n; /* number of spans to fill */
+ DDXPointPtr ppt; /* pointer to list of start points */
+ int *pwidth; /* pointer to list of n widths */
+ int fSorted;
+{
+ int x, y;
+ int width;
+ /* next three parameters are post-clip */
+ int nTmp;
+ int *pwidthFree;/* copies of the pointers to free */
+ DDXPointPtr pptFree;
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
+ register sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ register int r;
+ BoxPtr extents;
+
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask)
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ if (devPriv->oneRect)
+ {
+ extents = &pGC->pCompositeClip->extents;
+ GXSetClip (gx, extents);
+ }
+ else
+ {
+ nTmp = n * miFindMaxBand(pGC->pCompositeClip);
+ pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
+ pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
+ if(!pptFree || !pwidthFree)
+ {
+ if (pptFree) DEALLOCATE_LOCAL(pptFree);
+ if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+ return;
+ }
+ n = miClipSpans(pGC->pCompositeClip, ppt, pwidth, n,
+ pptFree, pwidthFree, fSorted);
+ pwidth = pwidthFree;
+ ppt = pptFree;
+ }
+ while (n--)
+ {
+ x = ppt->x;
+ y = ppt->y;
+ ppt++;
+ width = *pwidth++;
+ if (width)
+ {
+ sunGXFillSpan(gx,y,x,x + width - 1,r);
+ }
+ }
+ GXWait(gx,r);
+ if (devPriv->oneRect)
+ {
+ GXResetClip (gx, pDrawable->pScreen);
+ }
+ else
+ {
+ DEALLOCATE_LOCAL(pptFree);
+ DEALLOCATE_LOCAL(pwidthFree);
+ }
+}
+
+#ifdef NOTDEF
+/* cfb is faster for dots */
+void
+sunGXPolyPoint(pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int npt;
+ xPoint *pptInit;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ RegionPtr cclip;
+ int nbox;
+ register int i;
+ register BoxPtr pbox;
+ cfbPrivGCPtr devPriv;
+ xPoint *ppt;
+ int x, y;
+ int r;
+ int off;
+
+ devPriv = (cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr);
+ if (devPriv->rop == GXnoop)
+ return;
+ cclip = pGC->pCompositeClip;
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu],pGC->planemask);
+ gx->offx = pDrawable->x;
+ gx->offy = pDrawable->y;
+ for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip);
+ --nbox >= 0;
+ pbox++)
+ {
+ sunGXSetClip(gx,pbox);
+ if (mode != CoordModeOrigin)
+ {
+ x = 0;
+ y = 0;
+ for (ppt = pptInit, i = npt; --i >= 0;)
+ {
+ gx->apointy = y += ppt->y;
+ gx->apointx = x += ppt->x;
+ ++ppt;
+ GXDrawDone(gx,r);
+ }
+ }
+ else
+ {
+ for (ppt = pptInit, i = npt; --i >= 0;)
+ {
+ gx->apointy = ppt->y;
+ gx->apointx = ppt->x;
+ ++ppt;
+ GXDrawDone(gx,r);
+ }
+ }
+ }
+ GXWait(gx,r);
+ GXResetOff (gx);
+ GXResetClip(gx,pDrawable->pScreen);
+}
+#endif
+
+#include "mifillarc.h"
+
+#define FILLSPAN(gx,y,x1,x2,r) {\
+ if (x2 >= x1) {\
+ sunGXFillSpan(gx,y,x1,x2,r) \
+ } \
+}
+
+#define FILLSLICESPANS(flip,y) \
+ if (!flip) \
+ { \
+ FILLSPAN(gx,y,xl,xr,r) \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ FILLSPAN(gx, y, xc, xr, r) \
+ xc += slw - 1; \
+ FILLSPAN(gx, y, xl, xc, r) \
+ }
+
+static void
+sunGXFillEllipse (pDraw, gx, arc)
+ DrawablePtr pDraw;
+ sunGXPtr gx;
+ xArc *arc;
+{
+ int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ int y_top, y_bot;
+ miFillArcRec info;
+ register int xpos;
+ int r;
+ int slw;
+
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ y_top = yorg - y;
+ y_bot = yorg + y + dy;
+ while (y)
+ {
+ y_top++;
+ y_bot--;
+ MIFILLARCSTEP(slw);
+ if (!slw)
+ continue;
+ xpos = xorg - x;
+ sunGXFillSpan (gx,y_top,xpos,xpos+slw - 1,r);
+ if (miFillArcLower(slw))
+ sunGXFillSpan (gx,y_bot,xpos,xpos+slw - 1,r);
+ }
+}
+
+
+static void
+sunGXFillArcSlice (pDraw, pGC, gx, arc)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ sunGXPtr gx;
+ xArc *arc;
+{
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int xl, xr, xc;
+ int y_top, y_bot;
+ int r;
+
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ y_top = yorg - y;
+ y_bot = yorg + y + dy;
+ while (y > 0)
+ {
+ y_top++;
+ y_bot--;
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice))
+ {
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_top, y_top);
+ }
+ if (miFillSliceLower(slice))
+ {
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_bot, y_bot);
+ }
+ }
+}
+
+#define FAST_CIRCLES
+#ifdef FAST_CIRCLES
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#define Bits32(v) (v)
+#define Bits16(v) (v)
+#define Bits8(v) (v)
+#else
+#define FlipBits2(a) ((((a) & 0x1) << 1) | (((a) & 0x2) >> 1))
+#define FlipBits4(a) ((FlipBits2(a) << 2) | FlipBits2(a >> 2))
+#define FlipBits8(a) ((FlipBits4(a) << 4) | FlipBits4(a >> 4))
+#define FlipBits16(a) ((FlipBits8(a) << 8) | FlipBits8(a >> 8))
+#define FlipBits32(a) ((FlipBits16(a) << 16) | FlipBits16(a >> 16))
+#define Bits32(v) FlipBits32(v)
+#define Bits16(v) FlipBits16(v)
+#define Bits8(v) FlipBits8(v)
+#endif
+
+#define B(x) Bits16(x)
+#define DO_FILLED_ARCS
+#include "circleset.h"
+#undef B
+#undef Bits8
+#undef Bits16
+#undef Bits32
+#define UNSET_CIRCLE if (old_width) \
+ { \
+ gx->alu = gx_solid_rop_table[pGC->alu]; \
+ old_width = -old_width; \
+ }
+
+#else
+#define UNSET_CIRCLE
+#endif
+
+void
+sunGXPolyFillArc (pDraw, pGC, narcs, parcs)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ register xArc *arc;
+ register int i;
+ int x, y;
+ BoxRec box;
+ BoxPtr extents;
+ RegionPtr cclip;
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDraw->pScreen);
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ cfbPrivGCPtr devPriv;
+ register int r;
+#ifdef FAST_CIRCLES
+ int old_width = 0;
+#endif
+
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ devPriv = (cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr);
+ cclip = pGC->pCompositeClip;
+ GXSetOff(gx,pDraw->x,pDraw->y)
+ if (devPriv->oneRect) {
+ extents = &cclip->extents;
+ GXSetClip(gx,extents);
+ }
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc))
+ {
+ x = arc->x;
+ y = arc->y;
+ if (!devPriv->oneRect)
+ {
+ box.x1 = x + pDraw->x;
+ box.y1 = y + pDraw->y;
+ box.x2 = box.x1 + (int)arc->width + 1;
+ box.y2 = box.y1 + (int)arc->height + 1;
+ }
+ if (devPriv->oneRect ||
+ RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
+ {
+ if ((arc->angle2 >= FULLCIRCLE) ||
+ (arc->angle2 <= -FULLCIRCLE))
+ {
+#ifdef FAST_CIRCLES
+/* who really needs fast filled circles? */
+ if (arc->width == arc->height && arc->width <= 16 &&
+ !gxPriv->stipple)
+ {
+ int offx, offy;
+ if (arc->width != old_width)
+ {
+ int i;
+ Uint *sp;
+ VUint *dp;
+
+ if (old_width != -arc->width)
+ {
+ sp = (Uint *) filled_arcs[arc->width-1];
+ dp = gx->pattern;
+ i = 8;
+ while (i--)
+ dp[i] = sp[i];
+ }
+ gx->alu = gx_stipple_rop_table[pGC->alu]|GX_PATTERN_MASK;
+ old_width = arc->width;
+ }
+ offx = 16 - (x + pDraw->x) & 0xf;
+ offy = 16 - (y + pDraw->y) & 0xf;
+ gx->patalign = (offx << 16) | offy;
+ gx->arecty = y;
+ gx->arectx = x;
+ gx->arecty = y + old_width-1;
+ gx->arectx = x + old_width-1;
+ GXDrawDone (gx, r);
+ }
+ else
+#endif
+ {
+ UNSET_CIRCLE
+ sunGXFillEllipse (pDraw, gx, arc);
+ }
+ }
+ else
+ {
+ UNSET_CIRCLE
+ sunGXFillArcSlice (pDraw, pGC, gx, arc);
+ }
+ continue;
+ }
+ }
+ UNSET_CIRCLE
+ GXWait (gx,r);
+ GXResetOff (gx);
+ if (devPriv->oneRect)
+ GXResetClip (gx, pDraw->pScreen);
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ GXSetOff (gx, pDraw->x, pDraw->y);
+ if (devPriv->oneRect)
+ GXSetClip (gx, extents);
+ }
+ GXWait (gx, r);
+ GXResetOff (gx);
+ if (devPriv->oneRect)
+ GXResetClip (gx, pDraw->pScreen);
+}
+
+void
+sunGXFillPoly1Rect (pDrawable, pGC, shape, mode, count, ptsIn)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int count;
+ DDXPointPtr ptsIn;
+{
+ int c;
+ BoxPtr extents;
+ int *endp;
+ int x1, x2, x3, x4;
+ int y1, y2, y3, y4;
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ int r;
+ typedef struct {
+ Uint x;
+ Uint y;
+ Uint z;
+ } GXPointRec, *GXPointPtr;
+ GXPointPtr tri, qua;
+
+ if (count < 3)
+ return;
+ if (shape != Convex && count > 4)
+ {
+ miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_N,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ extents = &pGC->pCompositeClip->extents;
+ GXSetOff(gx,pDrawable->x, pDrawable->y);
+ GXSetClip(gx,extents);
+ if (mode == CoordModeOrigin)
+ {
+ tri = (GXPointPtr) &gx->atrix;
+ qua = (GXPointPtr) &gx->aquadx;
+ }
+ else
+ {
+ tri = (GXPointPtr) &gx->rtrix;
+ qua = (GXPointPtr) &gx->rquadx;
+ }
+ if (count == 3) {
+ gx->apointy = ptsIn[0].y;
+ gx->apointx = ptsIn[0].x;
+ tri->y = ptsIn[1].y;
+ tri->x = ptsIn[1].x;
+ tri->y = ptsIn[2].y;
+ tri->x = ptsIn[2].x;
+ GXDrawDone (gx, r);
+ }
+ else if (count == 4)
+ {
+ gx->apointy = ptsIn[0].y;
+ gx->apointx = ptsIn[0].x;
+ qua->y = ptsIn[1].y;
+ qua->x = ptsIn[1].x;
+ qua->y = ptsIn[2].y;
+ qua->x = ptsIn[2].x;
+ qua->y = ptsIn[3].y;
+ qua->x = ptsIn[3].x;
+ GXDrawDone (gx, r);
+ if (r < 0 && shape != Convex)
+ {
+ GXWait(gx,r);
+ GXResetOff(gx);
+ GXResetClip(gx,pDrawable->pScreen);
+ miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+ }
+ else
+ {
+ y1 = ptsIn[0].y;
+ x1 = ptsIn[0].x;
+ y2 = ptsIn[1].y;
+ x2 = ptsIn[1].x;
+ count -= 2;
+ ptsIn += 2;
+ while (count) {
+ x3 = ptsIn->x;
+ y3 = ptsIn->y;
+ ptsIn++;
+ count--;
+ gx->apointy = y1;
+ gx->apointx = x1;
+ if (count == 0) {
+ tri->y = y2;
+ tri->x = x2;
+ tri->y = y3;
+ tri->x = x3;
+ }
+ else
+ {
+ y4 = ptsIn->y;
+ x4 = ptsIn->x;
+ ptsIn++;
+ count--;
+ qua->y = y2;
+ qua->x = x2;
+ qua->y = y3;
+ qua->x = x3;
+ qua->y = y4;
+ qua->x = x4;
+ if (mode == CoordModeOrigin)
+ {
+ x2 = x4;
+ y2 = y4;
+ }
+ else
+ {
+ x2 = x2 + x3 + x4;
+ y2 = y2 + y3 + y4;
+ }
+ }
+ GXDrawDone (gx, r);
+ }
+ }
+ GXWait(gx,r);
+ GXResetOff(gx);
+ GXResetClip(gx,pDrawable->pScreen);
+}
+
+/*
+ * Note that the GX does not allow CapNotLast, so the code fakes it. This is
+ * expensive to do as the GX is asynchronous and must be synced with GXWait
+ * before fetching and storing the final line point. If only the hardware was
+ * designed for X.
+ */
+
+/* hard code the screen width; otherwise we'd have to check or mul */
+
+#define WIDTH_MUL(y) (((y) << 10) + ((y) << 7))
+#define GX_WIDTH 1152
+#define WID_OK(s) ((s)->width == GX_WIDTH)
+
+void
+sunGXPolySeg1Rect (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ xSegment *pSeg;
+{
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ BoxPtr extents;
+ int x, y;
+ int r;
+ unsigned char *baseAddr, *loAddr, *hiAddr, *saveAddr = 0, save;
+
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ GXSetOff (gx, pDrawable->x, pDrawable->y);
+
+ extents = &pGC->pCompositeClip->extents;
+ GXSetClip (gx, extents);
+ if (pGC->capStyle == CapNotLast)
+ {
+ sunGXGetAddrRange(pDrawable,extents,baseAddr,loAddr,hiAddr);
+ while (nseg--)
+ {
+ gx->aliney = pSeg->y1;
+ gx->alinex = pSeg->x1;
+ y = pSeg->y2;
+ x = pSeg->x2;
+ saveAddr = baseAddr + WIDTH_MUL(y) + x;
+ if (saveAddr < loAddr || hiAddr < saveAddr)
+ saveAddr = 0;
+ else
+ save = *saveAddr;
+ gx->aliney = y;
+ gx->alinex = x;
+ GXDrawDone (gx, r);
+ if (saveAddr)
+ {
+ GXWait(gx,r);
+ *saveAddr = save;
+ }
+ pSeg++;
+ }
+ }
+ else
+ {
+ while (nseg--)
+ {
+ gx->aliney = pSeg->y1;
+ gx->alinex = pSeg->x1;
+ gx->aliney = pSeg->y2;
+ gx->alinex = pSeg->x2;
+ pSeg++;
+ GXDrawDone (gx, r);
+ }
+ }
+ GXWait (gx, r);
+ GXResetOff (gx);
+ GXResetClip (gx, pDrawable->pScreen);
+}
+
+void
+sunGXPolylines1Rect (pDrawable, pGC, mode, npt, ppt)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int npt;
+ DDXPointPtr ppt;
+{
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ BoxPtr extents;
+ unsigned char *baseAddr, *loAddr, *hiAddr, *saveAddr, save;
+ int r;
+ Bool careful;
+ Bool capNotLast;
+
+ if (!--npt)
+ return;
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ careful = ((pGC->alu & 0xc) == 0x8 || (pGC->alu & 0x3) == 0x2);
+ capNotLast = pGC->capStyle == CapNotLast;
+
+ extents = &pGC->pCompositeClip->extents;
+ GXSetOff (gx, pDrawable->x, pDrawable->y);
+ GXSetClip (gx, extents);
+ if (careful)
+ {
+ int x, y;
+ sunGXGetAddrRange (pDrawable, extents, baseAddr, loAddr, hiAddr);
+ gx->apointy = y = ppt->y;
+ gx->apointx = x = ppt->x;
+ ppt++;
+ while (npt--)
+ {
+ if (mode == CoordModeOrigin)
+ {
+ y = ppt->y;
+ x = ppt->x;
+ }
+ else
+ {
+ y += ppt->y;
+ x += ppt->x;
+ }
+ ppt++;
+ saveAddr = baseAddr + WIDTH_MUL(y) + x;
+ if (saveAddr < loAddr || hiAddr < saveAddr)
+ saveAddr = 0;
+ else
+ save = *saveAddr;
+ gx->aliney = y;
+ gx->alinex = x;
+ GXDrawDone (gx, r);
+ if (saveAddr)
+ {
+ GXWait(gx,r);
+ *saveAddr = save;
+ }
+ }
+ GXWait(gx,r);
+ }
+ else
+ {
+ int x, y;
+ if (capNotLast)
+ {
+ x = y = 0;
+ npt--;
+ }
+ if (mode == CoordModeOrigin)
+ {
+ gx->apointy = ppt->y;
+ gx->apointx = ppt->x;
+ ppt++;
+ while (npt--)
+ {
+ gx->aliney = ppt->y;
+ gx->alinex = ppt->x;
+ ++ppt;
+ GXDrawDone(gx,r);
+ }
+ }
+ else
+ {
+ y = gx->apointy = ppt->y;
+ x = gx->apointx = ppt->x;
+ ppt++;
+ while (npt--)
+ {
+ y += gx->rliney = ppt->y;
+ x += gx->rlinex = ppt->x;
+ ++ppt;
+ GXDrawDone(gx,r);
+ }
+ }
+ if (capNotLast)
+ {
+ sunGXGetAddrRange (pDrawable, extents, baseAddr, loAddr, hiAddr);
+ x += ppt->x;
+ y += ppt->y;
+ saveAddr = baseAddr + WIDTH_MUL(y) + x;
+ if (saveAddr < loAddr || hiAddr < saveAddr)
+ saveAddr = 0;
+ else
+ save = *saveAddr;
+ gx->aliney = y;
+ gx->alinex = x;
+ GXDrawDone(gx,r);
+ GXWait(gx,r);
+ if (saveAddr)
+ *saveAddr = save;
+ }
+ else
+ {
+ GXWait(gx,r);
+ }
+ }
+ GXResetOff (gx);
+ GXResetClip (gx, pDrawable->pScreen);
+}
+
+void
+sunGXPolyFillRect1Rect (pDrawable, pGC, nrect, prect)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nrect;
+ xRectangle *prect;
+{
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ BoxPtr extents = &pGC->pCompositeClip->extents;
+ int r;
+ int x, y;
+
+ GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_N,pGC->planemask);
+ if (gxPriv->stipple)
+ GXStippleInit(gx,gxPriv->stipple);
+ GXSetOff (gx, pDrawable->x, pDrawable->y);
+ GXSetClip (gx, extents);
+ while (nrect--)
+ {
+ gx->arecty = y = prect->y;
+ gx->arectx = x = prect->x;
+ gx->arecty = y + (int) prect->height;
+ gx->arectx = x + (int) prect->width;
+ prect++;
+ GXDrawDone (gx, r);
+ }
+ GXWait (gx, r);
+ GXResetOff (gx);
+ GXResetClip (gx, pDrawable->pScreen);
+}
+
+static void
+sunGXPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase;
+{
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ int h;
+ int w;
+ CharInfoPtr pci;
+ unsigned long *bits;
+ register int r;
+ RegionPtr clip;
+ BoxPtr extents;
+ BoxRec box;
+
+ clip = pGC->pCompositeClip;
+ extents = &clip->extents;
+
+ if (REGION_NUM_RECTS(clip) == 1)
+ {
+ GXSetClip (gx, extents);
+ }
+ else
+ {
+ /* compute an approximate (but covering) bounding box */
+ box.x1 = 0;
+ if ((ppci[0]->metrics.leftSideBearing < 0))
+ box.x1 = ppci[0]->metrics.leftSideBearing;
+ h = nglyph - 1;
+ w = ppci[h]->metrics.rightSideBearing;
+ while (--h >= 0)
+ w += ppci[h]->metrics.characterWidth;
+ box.x2 = w;
+ box.y1 = -FONTMAXBOUNDS(pGC->font,ascent);
+ box.y2 = FONTMAXBOUNDS(pGC->font,descent);
+
+ box.x1 += pDrawable->x + x;
+ box.x2 += pDrawable->x + x;
+ box.y1 += pDrawable->y + y;
+ box.y2 += pDrawable->y + y;
+
+ switch (RECT_IN_REGION(pGC->pScreen, clip, &box))
+ {
+ case rgnPART:
+ cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ case rgnOUT:
+ return;
+ }
+ }
+
+ GXDrawInit (gx, pGC->fgPixel,
+ gx_stipple_rop_table[pGC->alu]|GX_PATTERN_ONES|POLY_N,
+ pGC->planemask);
+ gx->mode = GX_BLIT_NOSRC | GX_MODE_COLOR1;
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ while (nglyph--)
+ {
+ pci = *ppci++;
+ gx->incx = 0;
+ gx->incy = 1;
+ gx->x0 = x + pci->metrics.leftSideBearing;
+ gx->x1 = (x + pci->metrics.rightSideBearing) - 1;
+ gx->y0 = y - pci->metrics.ascent;
+ h = pci->metrics.ascent + pci->metrics.descent;
+ bits = (unsigned long *) pci->bits;
+ while (h--) {
+ gx->font = *bits++;
+ }
+ x += pci->metrics.characterWidth;
+ }
+ GXWait (gx, r);
+ gx->mode = GX_BLIT_SRC | GX_MODE_COLOR8;
+ GXResetClip (gx, pDrawable->pScreen);
+}
+
+static void
+sunGXTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ int h, hTmp;
+ int w;
+ FontPtr pfont = pGC->font;
+ register int r;
+ unsigned long *char1, *char2, *char3, *char4;
+ int widthGlyphs, widthGlyph;
+ BoxRec bbox;
+ BoxPtr extents;
+ RegionPtr clip;
+ unsigned long rop;
+
+ widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
+ h = FONTASCENT(pfont) + FONTDESCENT(pfont);
+ clip = pGC->pCompositeClip;
+ extents = &clip->extents;
+
+ if (REGION_NUM_RECTS(clip) == 1)
+ {
+ GXSetClip (gx, extents);
+ }
+ else
+ {
+ bbox.x1 = x + pDrawable->x;
+ bbox.x2 = bbox.x1 + (widthGlyph * nglyph);
+ bbox.y1 = y + pDrawable->y - FONTASCENT(pfont);
+ bbox.y2 = bbox.y1 + h;
+
+ switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox))
+ {
+ case rgnPART:
+ if (pglyphBase)
+ cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, NULL);
+ else
+ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ case rgnOUT:
+ return;
+ }
+ }
+
+ rop = gx_opaque_stipple_rop_table[GXcopy] | GX_PATTERN_ONES;
+ if (pglyphBase)
+ rop = gx_stipple_rop_table[pGC->alu] | GX_PATTERN_ONES;
+ GXDrawInit (gx, pGC->fgPixel, rop, pGC->planemask);
+ gx->bg = pGC->bgPixel;
+ gx->mode = GX_BLIT_NOSRC | GX_MODE_COLOR1;
+
+ y = y + pDrawable->y - FONTASCENT(pfont);
+ x += pDrawable->x;
+
+#define LoopIt(count, w, loadup, fetch) \
+ while (nglyph >= count) \
+ { \
+ nglyph -= count; \
+ gx->incx = 0; \
+ gx->incy = 1; \
+ gx->x0 = x; \
+ gx->x1 = (x += w) - 1; \
+ gx->y0 = y; \
+ loadup \
+ hTmp = h; \
+ while (hTmp--) \
+ gx->font = fetch; \
+ }
+
+ if (widthGlyph <= 8)
+ {
+ widthGlyphs = widthGlyph << 2;
+ LoopIt(4, widthGlyphs,
+ char1 = (unsigned long *) (*ppci++)->bits;
+ char2 = (unsigned long *) (*ppci++)->bits;
+ char3 = (unsigned long *) (*ppci++)->bits;
+ char4 = (unsigned long *) (*ppci++)->bits;,
+ (*char1++ | ((*char2++ | ((*char3++ | (*char4++
+ >> widthGlyph))
+ >> widthGlyph))
+ >> widthGlyph)))
+ }
+ else if (widthGlyph <= 10)
+ {
+ widthGlyphs = (widthGlyph << 1) + widthGlyph;
+ LoopIt(3, widthGlyphs,
+ char1 = (unsigned long *) (*ppci++)->bits;
+ char2 = (unsigned long *) (*ppci++)->bits;
+ char3 = (unsigned long *) (*ppci++)->bits;,
+ (*char1++ | ((*char2++ | (*char3++ >> widthGlyph)) >> widthGlyph)))
+ }
+ else if (widthGlyph <= 16)
+ {
+ widthGlyphs = widthGlyph << 1;
+ LoopIt(2, widthGlyphs,
+ char1 = (unsigned long *) (*ppci++)->bits;
+ char2 = (unsigned long *) (*ppci++)->bits;,
+ (*char1++ | (*char2++ >> widthGlyph)))
+ }
+ while (nglyph--) {
+ gx->incx = 0;
+ gx->incy = 1;
+ gx->x0 = x;
+ gx->x1 = (x += widthGlyph) - 1;
+ gx->y0 = y;
+ char1 = (unsigned long *) (*ppci++)->bits;
+ hTmp = h;
+ while (hTmp--)
+ gx->font = *char1++;
+ }
+ gx->incx = 0;
+ gx->incy = 0;
+ GXWait (gx, r);
+ gx->mode = GX_BLIT_SRC | GX_MODE_COLOR8;
+ GXResetClip (gx, pDrawable->pScreen);
+}
+
+static void
+sunGXPolyTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ sunGXTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (char *) 1);
+}
+
+static void
+sunGXFillBoxSolid (pDrawable, nBox, pBox, pixel)
+ DrawablePtr pDrawable;
+ int nBox;
+ BoxPtr pBox;
+ unsigned long pixel;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ register int r;
+
+ GXDrawInit(gx,pixel,gx_solid_rop_table[GXcopy]|POLY_N,~0);
+ while (nBox--) {
+ gx->arecty = pBox->y1;
+ gx->arectx = pBox->x1;
+ gx->arecty = pBox->y2;
+ gx->arectx = pBox->x2;
+ pBox++;
+ GXDrawDone(gx,r);
+ }
+ GXWait(gx,r);
+}
+
+void
+sunGXFillBoxStipple (pDrawable, nBox, pBox, stipple)
+ DrawablePtr pDrawable;
+ int nBox;
+ BoxPtr pBox;
+ sunGXStipplePtr stipple;
+{
+ register sunGXPtr gx = sunGXGetScreenPrivate (pDrawable->pScreen);
+ register int r;
+ int patx, paty;
+
+ patx = 16 - (pDrawable->x & 0xf);
+ paty = 16 - (pDrawable->y & 0xf);
+ stipple->patalign = (patx << 16) | paty;
+ GXDrawInit(gx,0,gx_solid_rop_table[GXcopy]|POLY_N,~0);
+ GXStippleInit(gx, stipple);
+ while (nBox--) {
+ gx->arecty = pBox->y1;
+ gx->arectx = pBox->x1;
+ gx->arecty = pBox->y2;
+ gx->arectx = pBox->x2;
+ pBox++;
+ GXDrawDone(gx,r);
+ }
+ GXWait(gx,r);
+}
+
+sunGXCheckTile (pPixmap, stipple)
+ PixmapPtr pPixmap;
+ sunGXStipplePtr stipple;
+{
+ unsigned short *sbits;
+ unsigned int fg = (unsigned int)~0, bg = (unsigned int)~0;
+ unsigned char *tilebitsLine, *tilebits, tilebit;
+ unsigned short sbit, mask;
+ int nbwidth;
+ int h, w;
+ int x, y;
+ int s_y, s_x;
+
+ h = pPixmap->drawable.height;
+ if (h > 16 || (h & (h - 1)))
+ return FALSE;
+ w = pPixmap->drawable.width;
+ if (w > 16 || (w & (w - 1)))
+ return FALSE;
+ sbits = (unsigned short *) stipple->bits;
+ tilebitsLine = (unsigned char *) pPixmap->devPrivate.ptr;
+ nbwidth = pPixmap->devKind;
+ for (y = 0; y < h; y++) {
+ tilebits = tilebitsLine;
+ tilebitsLine += nbwidth;
+ sbit = 0;
+ mask = 1 << 15;
+ for (x = 0; x < w; x++)
+ {
+ tilebit = *tilebits++;
+ if (tilebit == fg)
+ sbit |= mask;
+ else if (tilebit != bg)
+ {
+ if (fg == ~0)
+ {
+ fg = tilebit;
+ sbit |= mask;
+ }
+ else if (bg == ~0)
+ {
+ bg = tilebit;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ mask >>= 1;
+ }
+ for (s_x = w; s_x < 16; s_x <<= 1)
+ sbit = sbit | (sbit >> s_x);
+ for (s_y = y; s_y < 16; s_y += h)
+ sbits[s_y] = sbit;
+ }
+ stipple->fore = fg;
+ stipple->back = bg;
+ return TRUE;
+}
+
+sunGXCheckStipple (pPixmap, stipple)
+ PixmapPtr pPixmap;
+ sunGXStipplePtr stipple;
+{
+ unsigned short *sbits;
+ unsigned long *stippleBits;
+ unsigned long sbit, mask;
+ int h, w;
+ int y;
+ int s_y, s_x;
+
+ h = pPixmap->drawable.height;
+ if (h > 16 || (h & (h - 1)))
+ return FALSE;
+ w = pPixmap->drawable.width;
+ if (w > 16 || (w & (w - 1)))
+ return FALSE;
+ sbits = (unsigned short *) stipple->bits;
+ stippleBits = (unsigned long *) pPixmap->devPrivate.ptr;
+ mask = ((1 << w) - 1) << (16 - w);
+ for (y = 0; y < h; y++) {
+ sbit = (*stippleBits++ >> 16) & mask;
+ for (s_x = w; s_x < 16; s_x <<= 1)
+ sbit = sbit | (sbit >> s_x);
+ for (s_y = y; s_y < 16; s_y += h)
+ sbits[s_y] = sbit;
+ }
+ return TRUE;
+}
+
+/* cache one stipple; figuring out if we can use the stipple is as hard as
+ * computing it, so we just use this one and leave it here if it
+ * can't be used this time
+ */
+
+static sunGXStipplePtr tmpStipple;
+
+sunGXCheckFill (pGC, pDrawable)
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+{
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+ sunGXStipplePtr stipple;
+ Uint alu;
+ int xrot, yrot;
+
+ if (pGC->fillStyle == FillSolid)
+ {
+ if (gxPriv->stipple)
+ {
+ xfree (gxPriv->stipple);
+ gxPriv->stipple = 0;
+ }
+ return TRUE;
+ }
+ if (!(stipple = gxPriv->stipple))
+ {
+ if (!tmpStipple)
+ {
+ tmpStipple = (sunGXStipplePtr) xalloc (sizeof *tmpStipple);
+ if (!tmpStipple)
+ return FALSE;
+ }
+ stipple = tmpStipple;
+ }
+ alu = gx_opaque_stipple_rop_table[pGC->alu]|GX_PATTERN_MASK;
+ switch (pGC->fillStyle) {
+ case FillTiled:
+ if (!sunGXCheckTile (pGC->tile.pixmap, stipple))
+ {
+ if (gxPriv->stipple)
+ {
+ xfree (gxPriv->stipple);
+ gxPriv->stipple = 0;
+ }
+ return FALSE;
+ }
+ break;
+ case FillStippled:
+ alu = gx_stipple_rop_table[pGC->alu]|GX_PATTERN_MASK;
+ case FillOpaqueStippled:
+ if (!sunGXCheckStipple (pGC->stipple, stipple))
+ {
+ if (gxPriv->stipple)
+ {
+ xfree (gxPriv->stipple);
+ gxPriv->stipple = 0;
+ }
+ return FALSE;
+ }
+ stipple->fore = pGC->fgPixel;
+ stipple->back = pGC->bgPixel;
+ break;
+ }
+ xrot = (pGC->patOrg.x + pDrawable->x) & 0xf;
+ yrot = (pGC->patOrg.y + pDrawable->y) & 0xf;
+/*
+ stipple->patalign = ((16 - (xrot & 0xf)) << 16) | (16 - (yrot & 0xf));
+*/
+ xrot = 16 - xrot;
+ yrot = 16 - yrot;
+ stipple->patalign = (xrot << 16) | yrot;
+ stipple->alu = alu;
+ gxPriv->stipple = stipple;
+ if (stipple == tmpStipple)
+ tmpStipple = 0;
+ return TRUE;
+}
+
+void sunGXValidateGC ();
+void sunGXDestroyGC ();
+
+GCFuncs sunGXGCFuncs = {
+ sunGXValidateGC,
+ miChangeGC,
+ miCopyGC,
+ sunGXDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip
+};
+
+GCOps sunGXTEOps1Rect = {
+ sunGXFillSpans,
+ cfbSetSpans,
+ cfbPutImage,
+ sunGXCopyArea,
+ sunGXCopyPlane,
+ cfbPolyPoint,
+ sunGXPolylines1Rect,
+ sunGXPolySeg1Rect,
+ miPolyRectangle,
+ cfbZeroPolyArcSS8Copy,
+ sunGXFillPoly1Rect,
+ sunGXPolyFillRect1Rect,
+ sunGXPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ sunGXTEGlyphBlt,
+ sunGXPolyTEGlyphBlt,
+ cfbPushPixels8
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps sunGXTEOps = {
+ sunGXFillSpans,
+ cfbSetSpans,
+ cfbPutImage,
+ sunGXCopyArea,
+ sunGXCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+ cfbZeroPolyArcSS8Copy,
+ miFillPolygon,
+ sunGXPolyFillRect,
+ sunGXPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ sunGXTEGlyphBlt,
+ sunGXPolyTEGlyphBlt,
+ cfbPushPixels8
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps sunGXNonTEOps1Rect = {
+ sunGXFillSpans,
+ cfbSetSpans,
+ cfbPutImage,
+ sunGXCopyArea,
+ sunGXCopyPlane,
+ cfbPolyPoint,
+ sunGXPolylines1Rect,
+ sunGXPolySeg1Rect,
+ miPolyRectangle,
+ cfbZeroPolyArcSS8Copy,
+ sunGXFillPoly1Rect,
+ sunGXPolyFillRect1Rect,
+ sunGXPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ miImageGlyphBlt,
+ sunGXPolyGlyphBlt,
+ cfbPushPixels8
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+GCOps sunGXNonTEOps = {
+ sunGXFillSpans,
+ cfbSetSpans,
+ cfbPutImage,
+ sunGXCopyArea,
+ sunGXCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+ cfbZeroPolyArcSS8Copy,
+ miFillPolygon,
+ sunGXPolyFillRect,
+ sunGXPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ miImageGlyphBlt,
+ sunGXPolyGlyphBlt,
+ cfbPushPixels8
+#ifdef NEED_LINEHELPER
+ ,NULL
+#endif
+};
+
+#define FONTWIDTH(font) (FONTMAXBOUNDS(font,rightSideBearing) - \
+ FONTMINBOUNDS(font,leftSideBearing))
+
+GCOps *
+sunGXMatchCommon (pGC, devPriv)
+ GCPtr pGC;
+ cfbPrivGCPtr devPriv;
+{
+ if (pGC->lineWidth != 0)
+ return 0;
+ if (pGC->lineStyle != LineSolid)
+ return 0;
+ if (pGC->fillStyle != FillSolid)
+ return 0;
+ if (devPriv->rop != GXcopy)
+ return 0;
+ if (!WID_OK(pGC->pScreen))
+ return 0;
+ if (pGC->font &&
+ FONTWIDTH (pGC->font) <= 32 &&
+ FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
+ {
+ if (TERMINALFONT(pGC->font))
+ if (devPriv->oneRect)
+ return &sunGXTEOps1Rect;
+ else
+ return &sunGXTEOps;
+ else
+ if (devPriv->oneRect)
+ return &sunGXNonTEOps1Rect;
+ else
+ return &sunGXNonTEOps;
+ }
+ return 0;
+}
+
+void
+sunGXValidateGC (pGC, changes, pDrawable)
+ GCPtr pGC;
+ Mask changes;
+ DrawablePtr pDrawable;
+{
+ int mask; /* stateChanges */
+ int index; /* used for stepping through bitfields */
+ int new_rrop;
+ int new_line, new_text, new_fillspans, new_fillarea;
+ int new_rotate;
+ int xrot, yrot;
+ /* flags for changing the proc vector */
+ cfbPrivGCPtr devPriv;
+ sunGXPrivGCPtr gxPriv;
+ int oneRect;
+ int canGX;
+ int widOK;
+
+ gxPriv = sunGXGetGCPrivate (pGC);
+ widOK = WID_OK(pGC->pScreen);
+ if (pDrawable->type != DRAWABLE_WINDOW)
+ {
+ if (gxPriv->type == DRAWABLE_WINDOW)
+ {
+ extern GCOps cfbNonTEOps;
+
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = &cfbNonTEOps;
+ changes = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = changes;
+ gxPriv->type = pDrawable->type;
+ }
+ cfbValidateGC (pGC, changes, pDrawable);
+ return;
+ }
+ if (gxPriv->type != DRAWABLE_WINDOW)
+ {
+ changes = (1 << GCLastBit+1) - 1;
+ gxPriv->type = DRAWABLE_WINDOW;
+ }
+
+ new_rotate = pGC->lastWinOrg.x != pDrawable->x ||
+ pGC->lastWinOrg.y != pDrawable->y;
+
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+
+ devPriv = ((cfbPrivGCPtr) (pGC->devPrivates[cfbGCPrivateIndex].ptr));
+
+ new_rrop = FALSE;
+ new_line = FALSE;
+ new_text = FALSE;
+ new_fillspans = FALSE;
+ new_fillarea = FALSE;
+
+ /*
+ * if the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last validation
+ * we need to recompute the composite clip
+ */
+
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ miComputeCompositeClip(pGC, pDrawable);
+ oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
+ if (oneRect != devPriv->oneRect)
+ {
+ new_line = TRUE;
+ new_fillarea = TRUE;
+ devPriv->oneRect = oneRect;
+ }
+ }
+
+ mask = changes;
+ while (mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+
+ /*
+ * this switch acculmulates a list of which procedures might have
+ * to change due to changes in the GC. in some cases (e.g.
+ * changing one 16 bit tile for another) we might not really need
+ * a change, but the code is being paranoid. this sort of batching
+ * wins if, for example, the alu and the font have been changed,
+ * or any other pair of items that both change the same thing.
+ */
+ switch (index) {
+ case GCFunction:
+ case GCForeground:
+ new_rrop = TRUE;
+ break;
+ case GCPlaneMask:
+ new_rrop = TRUE;
+ new_text = TRUE;
+ break;
+ case GCBackground:
+ break;
+ case GCLineStyle:
+ case GCLineWidth:
+ new_line = TRUE;
+ break;
+ case GCCapStyle:
+ break;
+ case GCJoinStyle:
+ break;
+ case GCFillStyle:
+ new_text = TRUE;
+ new_fillspans = TRUE;
+ new_line = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCFillRule:
+ break;
+ case GCTile:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+
+ case GCStipple:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+
+ case GCTileStipXOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCTileStipYOrigin:
+ new_rotate = TRUE;
+ break;
+
+ case GCFont:
+ new_text = TRUE;
+ break;
+ case GCSubwindowMode:
+ break;
+ case GCGraphicsExposures:
+ break;
+ case GCClipXOrigin:
+ break;
+ case GCClipYOrigin:
+ break;
+ case GCClipMask:
+ break;
+ case GCDashOffset:
+ break;
+ case GCDashList:
+ break;
+ case GCArcMode:
+ break;
+ default:
+ break;
+ }
+ }
+
+ /*
+ * If the drawable has changed, check its depth & ensure suitable
+ * entries are in the proc vector.
+ */
+ if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) {
+ new_fillspans = TRUE; /* deal with FillSpans later */
+ }
+
+ if ((new_rotate || new_fillspans))
+ {
+ Bool new_pix = FALSE;
+ xrot = pGC->patOrg.x + pDrawable->x;
+ yrot = pGC->patOrg.y + pDrawable->y;
+
+ if (!sunGXCheckFill (pGC, pDrawable))
+ {
+ switch (pGC->fillStyle)
+ {
+ case FillTiled:
+ if (!pGC->tileIsPixel)
+ {
+ int width = pGC->tile.pixmap->drawable.width * PSZ;
+
+ if ((width <= 32) && !(width & (width - 1)))
+ {
+ cfbCopyRotatePixmap(pGC->tile.pixmap,
+ &pGC->pRotatedPixmap,
+ xrot, yrot);
+ new_pix = TRUE;
+ }
+ }
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ {
+ int width = pGC->stipple->drawable.width;
+
+ if ((width <= 32) && !(width & (width - 1)))
+ {
+ mfbCopyRotatePixmap(pGC->stipple,
+ &pGC->pRotatedPixmap, xrot, yrot);
+ new_pix = TRUE;
+ }
+ }
+ break;
+ }
+ }
+ if (!new_pix && pGC->pRotatedPixmap)
+ {
+ cfbDestroyPixmap(pGC->pRotatedPixmap);
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
+ }
+ }
+
+ if (new_rrop)
+ {
+ int old_rrop;
+
+ if (gxPriv->stipple)
+ {
+ if (pGC->fillStyle == FillStippled)
+ gxPriv->stipple->alu = gx_stipple_rop_table[pGC->alu]|GX_PATTERN_MASK;
+ else
+ gxPriv->stipple->alu = gx_opaque_stipple_rop_table[pGC->alu]|GX_PATTERN_MASK;
+ if (pGC->fillStyle != FillTiled)
+ {
+ gxPriv->stipple->fore = pGC->fgPixel;
+ gxPriv->stipple->back = pGC->bgPixel;
+ }
+ }
+ old_rrop = devPriv->rop;
+ devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
+ pGC->planemask,
+ &devPriv->and, &devPriv->xor);
+ if (old_rrop == devPriv->rop)
+ new_rrop = FALSE;
+ else
+ {
+ new_line = TRUE;
+ new_text = TRUE;
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ }
+ }
+
+ if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
+ {
+ GCOps *newops;
+
+ if (newops = sunGXMatchCommon (pGC, devPriv))
+ {
+ if (pGC->ops->devPrivate.val)
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = newops;
+ new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
+ }
+ else
+ {
+ if (!pGC->ops->devPrivate.val)
+ {
+ pGC->ops = miCreateGCOps (pGC->ops);
+ pGC->ops->devPrivate.val = 1;
+ }
+ }
+ }
+
+ canGX = pGC->fillStyle == FillSolid || gxPriv->stipple;
+
+ /* deal with the changes we've collected */
+ if (new_line)
+ {
+ pGC->ops->FillPolygon = miFillPolygon;
+ if (devPriv->oneRect && canGX)
+ pGC->ops->FillPolygon = sunGXFillPoly1Rect;
+ if (pGC->lineWidth == 0)
+ {
+ if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
+ {
+ switch (devPriv->rop)
+ {
+ case GXxor:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
+ break;
+ case GXcopy:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
+ break;
+ default:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
+ break;
+ }
+ }
+ else
+ pGC->ops->PolyArc = miZeroPolyArc;
+ }
+ else
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ switch (pGC->lineStyle)
+ {
+ case LineSolid:
+ if(pGC->lineWidth == 0)
+ {
+ if (devPriv->oneRect && canGX && widOK)
+ {
+ pGC->ops->PolySegment = sunGXPolySeg1Rect;
+ pGC->ops->Polylines = sunGXPolylines1Rect;
+ }
+ else if (pGC->fillStyle == FillSolid)
+ {
+ if (devPriv->oneRect)
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ }
+ else
+ {
+ pGC->ops->Polylines = cfbLineSS;
+ pGC->ops->PolySegment = cfbSegmentSS;
+ }
+ }
+ else
+ pGC->ops->Polylines = miZeroLine;
+ }
+ else
+ pGC->ops->Polylines = miWideLine;
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
+ {
+ pGC->ops->Polylines = cfbLineSD;
+ pGC->ops->PolySegment = cfbSegmentSD;
+ } else
+ pGC->ops->Polylines = miWideDash;
+ break;
+ }
+ }
+
+ if (new_text && (pGC->font))
+ {
+ if (FONTWIDTH(pGC->font) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)
+ {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ else
+ {
+ if (pGC->fillStyle == FillSolid)
+ {
+ if (TERMINALFONT (pGC->font))
+ pGC->ops->PolyGlyphBlt = sunGXPolyTEGlyphBlt;
+ else
+ pGC->ops->PolyGlyphBlt = sunGXPolyGlyphBlt;
+ }
+ else
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ /* special case ImageGlyphBlt for terminal emulator fonts */
+ if (TERMINALFONT(pGC->font))
+ pGC->ops->ImageGlyphBlt = sunGXTEGlyphBlt;
+ else
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ }
+
+
+ if (new_fillspans) {
+ if (canGX)
+ pGC->ops->FillSpans = sunGXFillSpans;
+ else switch (pGC->fillStyle) {
+ case FillTiled:
+ if (pGC->pRotatedPixmap)
+ {
+ if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
+ pGC->ops->FillSpans = cfbTile32FSCopy;
+ else
+ pGC->ops->FillSpans = cfbTile32FSGeneral;
+ }
+ else
+ pGC->ops->FillSpans = cfbUnnaturalTileFS;
+ break;
+ case FillStippled:
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = cfb8Stipple32FS;
+ else
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ case FillOpaqueStippled:
+ if (pGC->pRotatedPixmap)
+ pGC->ops->FillSpans = cfb8OpaqueStipple32FS;
+ else
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ default:
+ FatalError("cfbValidateGC: illegal fillStyle\n");
+ }
+ } /* end of new_fillspans */
+
+ if (new_fillarea) {
+ pGC->ops->PolyFillRect = cfbPolyFillRect;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ if (canGX)
+ {
+ pGC->ops->PolyFillArc = sunGXPolyFillArc;
+ pGC->ops->PolyFillRect = sunGXPolyFillRect;
+ if (devPriv->oneRect)
+ pGC->ops->PolyFillRect = sunGXPolyFillRect1Rect;
+ }
+ pGC->ops->PushPixels = mfbPushPixels;
+ if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
+ pGC->ops->PushPixels = cfbPushPixels8;
+ }
+}
+
+void
+sunGXDestroyGC (pGC)
+ GCPtr pGC;
+{
+ sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+
+ if (gxPriv->stipple)
+ xfree (gxPriv->stipple);
+ miDestroyGC (pGC);
+}
+
+sunGXCreateGC (pGC)
+ GCPtr pGC;
+{
+ sunGXPrivGCPtr gxPriv;
+ if (pGC->depth == 1)
+ return mfbCreateGC (pGC);
+ if (!cfbCreateGC (pGC))
+ return FALSE;
+ pGC->ops = &sunGXNonTEOps;
+ pGC->funcs = &sunGXGCFuncs;
+ gxPriv = sunGXGetGCPrivate(pGC);
+ gxPriv->type = DRAWABLE_WINDOW;
+ gxPriv->stipple = 0;
+ return TRUE;
+}
+
+Bool
+sunGXCreateWindow (pWin)
+ WindowPtr pWin;
+{
+ if (!cfbCreateWindow (pWin))
+ return FALSE;
+ pWin->devPrivates[sunGXWindowPrivateIndex].ptr = 0;
+ return TRUE;
+}
+
+Bool
+sunGXDestroyWindow (pWin)
+ WindowPtr pWin;
+{
+ sunGXStipplePtr stipple;
+ if (stipple = sunGXGetWindowPrivate(pWin))
+ xfree (stipple);
+ return cfbDestroyWindow (pWin);
+}
+
+sunGXChangeWindowAttributes (pWin, mask)
+ WindowPtr pWin;
+ Mask mask;
+{
+ sunGXStipplePtr stipple;
+ Mask index;
+ WindowPtr pBgWin;
+ register cfbPrivWin *pPrivWin;
+ int width;
+
+ pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr);
+ /*
+ * When background state changes from ParentRelative and
+ * we had previously rotated the fast border pixmap to match
+ * the parent relative origin, rerotate to match window
+ */
+ if (mask & (CWBackPixmap | CWBackPixel) &&
+ pWin->backgroundState != ParentRelative &&
+ pPrivWin->fastBorder &&
+ (pPrivWin->oldRotate.x != pWin->drawable.x ||
+ pPrivWin->oldRotate.y != pWin->drawable.y))
+ {
+ cfbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pWin->drawable.y - pPrivWin->oldRotate.y);
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ while (mask)
+ {
+ index = lowbit(mask);
+ mask &= ~index;
+ switch (index)
+ {
+ case CWBackPixmap:
+ stipple = sunGXGetWindowPrivate(pWin);
+ if (pWin->backgroundState == None ||
+ pWin->backgroundState == ParentRelative)
+ {
+ pPrivWin->fastBackground = FALSE;
+ if (stipple)
+ {
+ xfree (stipple);
+ sunGXSetWindowPrivate(pWin,0);
+ }
+ /* Rotate border to match parent origin */
+ if (pWin->backgroundState == ParentRelative &&
+ pPrivWin->pRotatedBorder)
+ {
+ for (pBgWin = pWin->parent;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ cfbXRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x - pPrivWin->oldRotate.x);
+ cfbYRotatePixmap(pPrivWin->pRotatedBorder,
+ pBgWin->drawable.y - pPrivWin->oldRotate.y);
+ }
+
+ break;
+ }
+ if (!stipple)
+ {
+ if (!tmpStipple)
+ tmpStipple = (sunGXStipplePtr) xalloc (sizeof *tmpStipple);
+ stipple = tmpStipple;
+ }
+ if (stipple && sunGXCheckTile (pWin->background.pixmap, stipple))
+ {
+ stipple->alu = gx_opaque_stipple_rop_table[GXcopy]|GX_PATTERN_MASK;
+ pPrivWin->fastBackground = FALSE;
+ if (stipple == tmpStipple)
+ {
+ sunGXSetWindowPrivate(pWin, stipple);
+ tmpStipple = 0;
+ }
+ break;
+ }
+ if (stipple = sunGXGetWindowPrivate(pWin))
+ {
+ xfree (stipple);
+ sunGXSetWindowPrivate(pWin,0);
+ }
+ if (((width = (pWin->background.pixmap->drawable.width * PSZ)) <= 32) &&
+ !(width & (width - 1)))
+ {
+ cfbCopyRotatePixmap(pWin->background.pixmap,
+ &pPrivWin->pRotatedBackground,
+ pWin->drawable.x,
+ pWin->drawable.y);
+ if (pPrivWin->pRotatedBackground)
+ {
+ pPrivWin->fastBackground = TRUE;
+ pPrivWin->oldRotate.x = pWin->drawable.x;
+ pPrivWin->oldRotate.y = pWin->drawable.y;
+ }
+ else
+ {
+ pPrivWin->fastBackground = FALSE;
+ }
+ break;
+ }
+ pPrivWin->fastBackground = FALSE;
+ break;
+
+ case CWBackPixel:
+ pPrivWin->fastBackground = FALSE;
+ break;
+
+ case CWBorderPixmap:
+ /* don't bother with accelerator for border tiles (just lazy) */
+ if (((width = (pWin->border.pixmap->drawable.width * PSZ)) <= 32) &&
+ !(width & (width - 1)))
+ {
+ for (pBgWin = pWin;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+ cfbCopyRotatePixmap(pWin->border.pixmap,
+ &pPrivWin->pRotatedBorder,
+ pBgWin->drawable.x,
+ pBgWin->drawable.y);
+ if (pPrivWin->pRotatedBorder)
+ {
+ pPrivWin->fastBorder = TRUE;
+ pPrivWin->oldRotate.x = pBgWin->drawable.x;
+ pPrivWin->oldRotate.y = pBgWin->drawable.y;
+ }
+ else
+ {
+ pPrivWin->fastBorder = TRUE;
+ }
+ }
+ else
+ {
+ pPrivWin->fastBorder = FALSE;
+ }
+ break;
+ case CWBorderPixel:
+ pPrivWin->fastBorder = FALSE;
+ break;
+ }
+ }
+ return (TRUE);
+}
+
+void
+sunGXPaintWindow(pWin, pRegion, what)
+ WindowPtr pWin;
+ RegionPtr pRegion;
+ int what;
+{
+ register cfbPrivWin *pPrivWin;
+ sunGXStipplePtr stipple;
+ WindowPtr pBgWin;
+ pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr);
+
+ switch (what) {
+ case PW_BACKGROUND:
+ stipple = sunGXGetWindowPrivate(pWin);
+ switch (pWin->backgroundState) {
+ case None:
+ return;
+ case ParentRelative:
+ do {
+ pWin = pWin->parent;
+ } while (pWin->backgroundState == ParentRelative);
+ (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
+ what);
+ return;
+ case BackgroundPixmap:
+ if (stipple)
+ {
+ sunGXFillBoxStipple ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ stipple);
+ }
+ else if (pPrivWin->fastBackground)
+ {
+ cfbFillBoxTile32 ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pPrivWin->pRotatedBackground);
+ }
+ else
+ {
+ cfbFillBoxTileOdd ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->background.pixmap,
+ (int) pWin->drawable.x, (int) pWin->drawable.y);
+ }
+ return;
+ case BackgroundPixel:
+ sunGXFillBoxSolid((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->background.pixel);
+ return;
+ }
+ break;
+ case PW_BORDER:
+ if (pWin->borderIsPixel)
+ {
+ sunGXFillBoxSolid((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->border.pixel);
+ return;
+ }
+ else if (pPrivWin->fastBorder)
+ {
+ cfbFillBoxTile32 ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pPrivWin->pRotatedBorder);
+ return;
+ }
+ else
+ {
+ for (pBgWin = pWin;
+ pBgWin->backgroundState == ParentRelative;
+ pBgWin = pBgWin->parent);
+
+ cfbFillBoxTileOdd ((DrawablePtr)pWin,
+ (int)REGION_NUM_RECTS(pRegion),
+ REGION_RECTS(pRegion),
+ pWin->border.pixmap,
+ (int) pBgWin->drawable.x,
+ (int) pBgWin->drawable.y);
+ return;
+ }
+ break;
+ }
+}
+
+void
+sunGXCopyWindow(pWin, ptOldOrg, prgnSrc)
+ WindowPtr pWin;
+ DDXPointRec ptOldOrg;
+ RegionPtr prgnSrc;
+{
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ RegionPtr prgnDst;
+ register BoxPtr pbox;
+ register int dx, dy;
+ register int i, nbox;
+ WindowPtr pwinRoot;
+ extern WindowPtr *WindowTable;
+
+ pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+
+ prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+ if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+ return;
+ ppt = pptSrc;
+
+ for (i = nbox; --i >= 0; ppt++, pbox++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ sunGXDoBitblt ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ GXcopy, prgnDst, pptSrc, ~0L);
+ DEALLOCATE_LOCAL(pptSrc);
+ REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
+}
+
+#if NeedFunctionPrototypes
+sunGXInit (
+ ScreenPtr pScreen,
+ fbFd *fb)
+#else
+sunGXInit (pScreen, fb)
+ ScreenPtr pScreen;
+ fbFd *fb;
+#endif
+{
+ sunGXPtr gx;
+ Uint mode;
+ register long r;
+
+ if (serverGeneration != sunGXGeneration)
+ {
+ sunGXScreenPrivateIndex = AllocateScreenPrivateIndex();
+ if (sunGXScreenPrivateIndex == -1)
+ return FALSE;
+ sunGXGCPrivateIndex = AllocateGCPrivateIndex ();
+ sunGXWindowPrivateIndex = AllocateWindowPrivateIndex ();
+ sunGXGeneration = serverGeneration;
+ }
+ if (!AllocateGCPrivate(pScreen, sunGXGCPrivateIndex, sizeof (sunGXPrivGCRec)))
+ return FALSE;
+ if (!AllocateWindowPrivate(pScreen, sunGXWindowPrivateIndex, 0))
+ return FALSE;
+ gx = (sunGXPtr) fb->fb;
+ mode = gx->mode;
+ GXWait(gx,r);
+ mode &= ~( GX_BLIT_ALL |
+ GX_MODE_ALL |
+ GX_DRAW_ALL |
+ GX_BWRITE0_ALL |
+ GX_BWRITE1_ALL |
+ GX_BREAD_ALL |
+ GX_BDISP_ALL);
+ mode |= GX_BLIT_SRC |
+ GX_MODE_COLOR8 |
+ GX_DRAW_RENDER |
+ GX_BWRITE0_ENABLE |
+ GX_BWRITE1_DISABLE |
+ GX_BREAD_0 |
+ GX_BDISP_0;
+ gx->mode = mode;
+ gx->clip = 0;
+ gx->offx = 0;
+ gx->offy = 0;
+ gx->clipminx = 0;
+ gx->clipminy = 0;
+ gx->clipmaxx = fb->info.fb_width - 1;
+ gx->clipmaxy = fb->info.fb_height - 1;
+ pScreen->devPrivates[sunGXScreenPrivateIndex].ptr = (pointer) gx;
+ /*
+ * Replace various screen functions
+ */
+ pScreen->CreateGC = sunGXCreateGC;
+ pScreen->CreateWindow = sunGXCreateWindow;
+ pScreen->ChangeWindowAttributes = sunGXChangeWindowAttributes;
+ pScreen->DestroyWindow = sunGXDestroyWindow;
+ pScreen->PaintWindowBackground = sunGXPaintWindow;
+ pScreen->PaintWindowBorder = sunGXPaintWindow;
+ pScreen->CopyWindow = sunGXCopyWindow;
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/sun/sunGX.h b/xc/programs/Xserver/hw/sun/sunGX.h
new file mode 100644
index 000000000..cc6a3b297
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunGX.h
@@ -0,0 +1,237 @@
+/*
+ * $TOG: sunGX.h /main/5 1998/02/10 13:16:42 kaleb $
+ *
+Copyright 1991, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+typedef unsigned int Uint;
+#if __STDC__
+typedef volatile Uint VUint;
+#else
+typedef Uint VUint;
+#endif
+
+/* modes */
+#define GX_INDEX(n) ((n) << 4)
+#define GX_INDEX_ALL 0x00000030
+#define GX_INDEX_MOD 0x00000040
+#define GX_BDISP_0 0x00000080
+#define GX_BDISP_1 0x00000100
+#define GX_BDISP_ALL 0x00000180
+#define GX_BREAD_0 0x00000200
+#define GX_BREAD_1 0x00000400
+#define GX_BREAD_ALL 0x00000600
+#define GX_BWRITE1_ENABLE 0x00000800
+#define GX_BWRITE1_DISABLE 0x00001000
+#define GX_BWRITE1_ALL 0x00001800
+#define GX_BWRITE0_ENABLE 0x00002000
+#define GX_BWRITE0_DISABLE 0x00004000
+#define GX_BWRITE0_ALL 0x00006000
+#define GX_DRAW_RENDER 0x00008000
+#define GX_DRAW_PICK 0x00010000
+#define GX_DRAW_ALL 0x00018000
+#define GX_MODE_COLOR8 0x00020000
+#define GX_MODE_COLOR1 0x00040000
+#define GX_MODE_HRMONO 0x00060000
+#define GX_MODE_ALL 0x00060000
+#define GX_VBLANK 0x00080000
+#define GX_BLIT_NOSRC 0x00100000
+#define GX_BLIT_SRC 0x00200000
+#define GX_BLIT_ALL 0x00300000
+
+/* rasterops */
+#define GX_ROP_CLEAR 0x0
+#define GX_ROP_INVERT 0x1
+#define GX_ROP_NOOP 0x2
+#define GX_ROP_SET 0x3
+
+#define GX_ROP_00_0(rop) ((rop) << 0)
+#define GX_ROP_00_1(rop) ((rop) << 2)
+#define GX_ROP_01_0(rop) ((rop) << 4)
+#define GX_ROP_01_1(rop) ((rop) << 6)
+#define GX_ROP_10_0(rop) ((rop) << 8)
+#define GX_ROP_10_1(rop) ((rop) << 10)
+#define GX_ROP_11_0(rop) ((rop) << 12)
+#define GX_ROP_11_1(rop) ((rop) << 14)
+#define GX_PLOT_PLOT 0x00000000
+#define GX_PLOT_UNPLOT 0x00020000
+#define GX_RAST_BOOL 0x00000000
+#define GX_RAST_LINEAR 0x00040000
+#define GX_ATTR_UNSUPP 0x00400000
+#define GX_ATTR_SUPP 0x00800000
+#define GX_POLYG_OVERLAP 0x01000000
+#define GX_POLYG_NONOVERLAP 0x02000000
+#define GX_PATTERN_ZEROS 0x04000000
+#define GX_PATTERN_ONES 0x08000000
+#define GX_PATTERN_MASK 0x0c000000
+#define GX_PIXEL_ZEROS 0x10000000
+#define GX_PIXEL_ONES 0x20000000
+#define GX_PIXEL_MASK 0x30000000
+#define GX_PLANE_ZEROS 0x40000000
+#define GX_PLANE_ONES 0x80000000
+#define GX_PLANE_MASK 0xc0000000
+
+typedef struct _sunGX {
+ Uint junk0[1];
+ VUint mode;
+ VUint clip;
+ Uint junk1[1];
+ VUint s;
+ VUint draw;
+ VUint blit;
+ VUint font;
+ Uint junk2[24];
+ VUint x0, y0, z0, color0;
+ VUint x1, y1, z1, color1;
+ VUint x2, y2, z2, color2;
+ VUint x3, y3, z3, color3;
+ VUint offx, offy;
+ Uint junk3[2];
+ VUint incx, incy;
+ Uint junk4[2];
+ VUint clipminx, clipminy;
+ Uint junk5[2];
+ VUint clipmaxx, clipmaxy;
+ Uint junk6[2];
+ VUint fg;
+ VUint bg;
+ VUint alu;
+ VUint pm;
+ VUint pixelm;
+ Uint junk7[2];
+ VUint patalign;
+ VUint pattern[8];
+ Uint junk8[432];
+ VUint apointx, apointy, apointz;
+ Uint junk9[1];
+ VUint rpointx, rpointy, rpointz;
+ Uint junk10[5];
+ VUint pointr, pointg, pointb, pointa;
+ VUint alinex, aliney, alinez;
+ Uint junk11[1];
+ VUint rlinex, rliney, rlinez;
+ Uint junk12[5];
+ VUint liner, lineg, lineb, linea;
+ VUint atrix, atriy, atriz;
+ Uint junk13[1];
+ VUint rtrix, rtriy, rtriz;
+ Uint junk14[5];
+ VUint trir, trig, trib, tria;
+ VUint aquadx, aquady, aquadz;
+ Uint junk15[1];
+ VUint rquadx, rquady, rquadz;
+ Uint junk16[5];
+ VUint quadr, quadg, quadb, quada;
+ VUint arectx, arecty, arectz;
+ Uint junk17[1];
+ VUint rrectx, rrecty, rrectz;
+ Uint junk18[5];
+ VUint rectr, rectg, rectb, recta;
+} sunGX, *sunGXPtr;
+
+/* Macros */
+
+#define GX_ROP_USE_PIXELMASK 0x30000000
+
+#define GX_BLT_INPROGRESS 0x20000000
+
+#define GX_INPROGRESS 0x10000000
+#define GX_FULL 0x20000000
+
+#define GXWait(gx,r)\
+ do\
+ (r) = (int) (gx)->s; \
+ while ((r) & GX_INPROGRESS)
+
+#define GXDrawDone(gx,r) \
+ do \
+ (r) = (int) (gx)->draw; \
+ while ((r) < 0 && ((r) & GX_FULL))
+
+#define GXBlitDone(gx,r)\
+ do\
+ (r)= (int) (gx)->blit; \
+ while ((r) < 0 && ((r) & GX_BLT_INPROGRESS))
+
+#define GXBlitInit(gx,rop,pmsk) {\
+ gx->fg = 0xff;\
+ gx->bg = 0x00;\
+ gx->pixelm = ~0;\
+ gx->s = 0;\
+ gx->alu = rop;\
+ gx->pm = pmsk;\
+ gx->clip = 0;\
+}
+
+#define GXDrawInit(gx,fore,rop,pmsk) {\
+ gx->fg = fore;\
+ gx->bg = 0x00; \
+ gx->pixelm = ~0; \
+ gx->s = 0; \
+ gx->alu = rop; \
+ gx->pm = pmsk; \
+ gx->clip = 0;\
+}
+
+#define GXStippleInit(gx,stipple) {\
+ int _i; \
+ Uint *sp; \
+ VUint *dp; \
+ _i = 8; \
+ sp = stipple->bits; \
+ dp = gx->pattern; \
+ while (_i--) { \
+ dp[_i] = sp[_i]; \
+ } \
+ gx->fg = stipple->fore; \
+ gx->bg = stipple->back; \
+ gx->patalign = stipple->patalign; \
+ gx->alu = stipple->alu; \
+}
+
+extern int sunGXScreenPrivateIndex;
+extern int sunGXGCPrivateIndex;
+extern int sunGXWindowPrivateIndex;
+
+#define sunGXGetScreenPrivate(s) ((sunGXPtr) \
+ (s)->devPrivates[sunGXScreenPrivateIndex].ptr)
+
+typedef struct _sunGXStipple {
+ Uint fore, back;
+ Uint patalign;
+ Uint alu;
+ Uint bits[8]; /* actually 16 shorts */
+} sunGXStippleRec, *sunGXStipplePtr;
+
+typedef struct _sunGXPrivGC {
+ int type;
+ sunGXStipplePtr stipple;
+} sunGXPrivGCRec, *sunGXPrivGCPtr;
+
+#define sunGXGetGCPrivate(g) ((sunGXPrivGCPtr) \
+ (g)->devPrivates[sunGXGCPrivateIndex].ptr)
+
+#define sunGXGetWindowPrivate(w) ((sunGXStipplePtr) \
+ (w)->devPrivates[sunGXWindowPrivateIndex].ptr)
+
+#define sunGXSetWindowPrivate(w,p) (\
+ (w)->devPrivates[sunGXWindowPrivateIndex].ptr = (pointer) p)
+
diff --git a/xc/programs/Xserver/hw/sun/sunInit.c b/xc/programs/Xserver/hw/sun/sunInit.c
new file mode 100644
index 000000000..7ad99baa5
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunInit.c
@@ -0,0 +1,948 @@
+/* $TOG: sunInit.c /main/81 1998/02/10 13:16:47 kaleb $ */
+/*
+ * sunInit.c --
+ * Initialization functions for screen/keyboard/mouse, etc.
+ *
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/sun/sunInit.c,v 3.7 1998/10/04 09:38:36 dawes Exp $ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*******************************************************/
+
+#include "sun.h"
+#include "gcstruct.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "cfb.h"
+
+/* maximum pixmap depth */
+#ifndef SUNMAXDEPTH
+#define SUNMAXDEPTH 8
+#endif
+
+#ifdef i386 /* { */
+#define BW2I NULL
+#else /* }{ */
+extern Bool sunBW2Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define BW2I sunBW2Init
+#endif /* } */
+
+#ifdef LOWMEMFTPT
+#define BW2I NULL
+#endif /* ifdef LOWMEMFTPT */
+
+#if SUNMAXDEPTH == 1 /* { */
+#define CG2I NULL
+#define CG3I NULL
+#define CG4I NULL
+#define CG6I NULL
+#define CG8I NULL
+#define TCXI NULL
+#else /* }{ */
+extern Bool sunCG3Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG3I sunCG3Init
+#if defined(i386) || defined(__bsdi__) /* { */
+#define CG2I NULL
+#define CG4I NULL
+#else /* }{ */
+extern Bool sunCG2Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG2I sunCG2Init
+extern Bool sunCG4Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG4I sunCG4Init
+#endif /* } */
+#ifdef FBTYPE_SUNFAST_COLOR /* { */
+extern Bool sunCG6Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG6I sunCG6Init
+#else /* }{ */
+#define CG6I NULL
+#endif /* } */
+#ifdef XFBTYPE_TCX /* { */
+extern Bool sunTCXInit(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define TCXI sunTCXInit
+#else /* }{ */
+#define TCXI NULL
+#endif /* } */
+#if SUNMAXDEPTH > 8 /* { */
+#ifdef FBTYPE_MEMCOLOR /* { */
+extern Bool sunCG8Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG8I sunCG8Init
+#else /* }{ */
+#define CG8I NULL
+#endif /* } */
+#else /* }{ */
+#define CG8I NULL
+#endif /* } */
+
+#endif /* } */
+
+extern KeySymsRec sunKeySyms[];
+extern SunModmapRec *sunModMaps[];
+extern int sunMaxLayout;
+extern KeySym* sunType4KeyMaps[];
+extern SunModmapRec* sunType4ModMaps[];
+
+static Bool sunDevsInited = FALSE;
+
+Bool sunAutoRepeatHandlersInstalled; /* FALSE each time InitOutput called */
+Bool sunSwapLkeys = FALSE;
+Bool sunFlipPixels = FALSE;
+Bool sunFbInfo = FALSE;
+Bool sunCG4Frob = FALSE;
+Bool sunNoGX = FALSE;
+
+sunKbdPrivRec sunKbdPriv = {
+ -1, /* fd */
+ -1, /* type */
+ -1, /* layout */
+ 0, /* click */
+ (Leds)0, /* leds */
+};
+
+sunPtrPrivRec sunPtrPriv = {
+ -1, /* fd */
+ 0 /* Current button state */
+};
+
+/*
+ * The name member in the following table corresponds to the
+ * FBTYPE_* macros defined in /usr/include/sun/fbio.h file
+ */
+sunFbDataRec sunFbData[XFBTYPE_LASTPLUSONE] = {
+ { NULL, "SUN1BW (bw1)" },
+ { NULL, "SUN1COLOR (cg1)" },
+ { BW2I, "SUN2BW (bw2)" },
+ { CG2I, "SUN2COLOR (cg2)" },
+ { NULL, "SUN2GP (gp1/gp2)" },
+ { NULL, "SUN5COLOR (cg5/386i accel)" },
+ { CG3I, "SUN3COLOR (cg3)" },
+ { CG8I, "MEMCOLOR (cg8)" },
+ { CG4I, "SUN4COLOR (cg4)" },
+ { NULL, "NOTSUN1" },
+ { NULL, "NOTSUN2" },
+ { NULL, "NOTSUN3" }
+#ifndef i386 /* { */
+ ,{ CG6I, "SUNFAST_COLOR (cg6/gx)" },
+ { NULL, "SUNROP_COLOR (cg9)" },
+ { NULL, "SUNFB_VIDEO" },
+ { NULL, "SUNGIFB" },
+ { NULL, "SUNPLAS" },
+#ifdef FBTYPE_SUNGP3
+ { NULL, "SUNGP3 (cg12/gs)" },
+#endif
+#ifdef FBTYPE_SUNGT
+ { NULL, "SUNGT (gt)" },
+#endif
+#ifdef FBTYPE_SUNLEO
+ { NULL, "SUNLEO (zx)" },
+#endif
+#ifdef FBTYPE_MDICOLOR
+ { NULL, "MDICOLOR (cgfourteen)" },
+#endif
+#ifdef XFBTYPE_TCX
+ { TCXI, "TCX (tcx)" },
+#endif
+#endif /* } */
+};
+
+/*
+ * a list of devices to try if there is no environment or command
+ * line list of devices
+ */
+#if SUNMAXDEPTH == 1 /* { */
+static char *fallbackList[] = {
+ BWTWO0DEV, BWTWO1DEV, BWTWO2DEV
+};
+#else /* }{ */
+static char *fallbackList[] = {
+#ifndef i386 /* { */
+ CGTWO0DEV, CGTWO1DEV, CGTWO2DEV,
+#if (MAXSCREENS == 4)
+ CGTWO3DEV,
+#endif
+#endif /* } */
+ CGTHREE0DEV,
+#ifndef i386 /* { */
+ CGTHREE1DEV, CGTHREE2DEV,
+#if (MAXSCREENS == 4)
+ CGTHREE3DEV,
+#endif
+#endif /* } */
+#ifdef FBTYPE_SUNFAST_COLOR /* { */
+ CGSIX0DEV, CGSIX1DEV, CGSIX2DEV,
+#if (MAXSCREENS == 4)
+ CGSIX3DEV,
+#endif
+#endif /* } */
+#ifndef i386 /* { */
+ CGFOUR0DEV, BWTWO0DEV, BWTWO1DEV, BWTWO2DEV,
+#if (MAXSCREENS == 4)
+ BWTWO3DEV,
+#endif
+#endif /* } */
+#if SUNMAXDEPTH > 8 /* { */
+ CGEIGHT0DEV,
+#if 0
+#ifdef XFBTYPE_TCX
+ TCX0DEV,
+#endif
+#endif
+#endif /* } */
+ "/dev/fb"
+};
+#endif /* } */
+
+#define FALLBACK_LIST_LEN sizeof fallbackList / sizeof fallbackList[0]
+
+fbFd sunFbs[MAXSCREENS];
+
+static PixmapFormatRec formats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD } /* 1-bit deep */
+#if SUNMAXDEPTH > 1
+ ,{ 8, 8, BITMAP_SCANLINE_PAD} /* 8-bit deep */
+#if SUNMAXDEPTH > 8
+ ,{ 12, 24, BITMAP_SCANLINE_PAD } /* 12-bit deep */
+ ,{ 24, 32, BITMAP_SCANLINE_PAD } /* 24-bit deep */
+#endif
+#endif
+};
+#define NUMFORMATS (sizeof formats)/(sizeof formats[0])
+
+/*
+ * OpenFrameBuffer --
+ * Open a frame buffer according to several rules.
+ * Find the device to use by looking in the sunFbData table,
+ * an XDEVICE envariable, a -dev switch or using /dev/fb if trying
+ * to open screen 0 and all else has failed.
+ *
+ * Results:
+ * The fd of the framebuffer.
+ */
+static int OpenFrameBuffer(device, screen)
+ char *device; /* e.g. "/dev/cgtwo0" */
+ int screen; /* what screen am I going to be */
+{
+ int ret = TRUE;
+ struct fbgattr *fbattr;
+ static int devFbUsed;
+
+ sunFbs[screen].fd = -1;
+ if (strcmp (device, "/dev/fb") == 0 && devFbUsed)
+ return FALSE;
+ if (access (device, R_OK | W_OK) == -1)
+ return FALSE;
+ if ((sunFbs[screen].fd = open(device, O_RDWR, 0)) == -1)
+ ret = FALSE;
+ else {
+ fbattr = (struct fbgattr *) xalloc (sizeof (struct fbgattr));
+ if (ioctl(sunFbs[screen].fd, FBIOGATTR, fbattr) == -1) {
+ /*
+ This is probably a bwtwo; the $64,000 question is:
+ is it the mono plane of a cgfour, or is it really a
+ real bwtwo? If there is only a cgfour in the box or
+ only a bwtwo in the box, then it isn't a problem. If
+ it's a 3/60, which has a bwtwo on the mother board *and*
+ a cgfour, then things get tricky because there's no way
+ to tell if the bwtwo is really being emulated by the cgfour.
+ */
+ xfree (fbattr);
+ fbattr = NULL;
+ if (ioctl(sunFbs[screen].fd, FBIOGTYPE, &sunFbs[screen].info) == -1) {
+ Error("unable to get frame buffer attributes");
+ (void) close(sunFbs[screen].fd);
+ sunFbs[screen].fd = -1;
+ ret = FALSE;
+ }
+ }
+ if (ret) {
+ devFbUsed = TRUE;
+ if (fbattr)
+ sunFbs[screen].info = fbattr->fbtype;
+ sunFbs[screen].fbPriv = (pointer) fbattr;
+ if (fbattr &&
+ fbattr->fbtype.fb_type < XFBTYPE_LASTPLUSONE &&
+ !sunFbData[fbattr->fbtype.fb_type].init) {
+ int _i;
+ ret = FALSE;
+ for (_i = 0; _i < FB_ATTR_NEMUTYPES; _i++) {
+ if (sunFbData[fbattr->emu_types[_i]].init) {
+ sunFbs[screen].info.fb_type = fbattr->emu_types[_i];
+ ret = TRUE;
+ if (sunFbInfo)
+ ErrorF ("%s is emulating a %s\n", device,
+ sunFbData[fbattr->fbtype.fb_type].name);
+ break;
+ }
+ }
+ }
+ if (sunFbInfo)
+ ErrorF ("%s is really a %s\n", device,
+ sunFbData[fbattr ? fbattr->fbtype.fb_type : sunFbs[screen].info.fb_type].name);
+ }
+ }
+ if (!ret)
+ sunFbs[screen].fd = -1;
+ return ret;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * SigIOHandler --
+ * Signal handler for SIGIO - input is available.
+ *
+ * Results:
+ * sunSigIO is set - ProcessInputEvents() will be called soon.
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+static void SigIOHandler(sig)
+ int sig;
+{
+ int olderrno = errno;
+ sunEnqueueEvents ();
+ errno = olderrno;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunNonBlockConsoleOff --
+ * Turn non-blocking mode on the console off, so you don't get logged
+ * out when the server exits.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+void sunNonBlockConsoleOff(
+#if NeedFunctionPrototypes
+#if defined(SVR4) || defined(CSRG_BASED)
+ void
+#else
+ char* arg
+#endif
+#endif
+)
+{
+ register int i;
+
+ i = fcntl(2, F_GETFL, 0);
+ if (i >= 0)
+ (void) fcntl(2, F_SETFL, i & ~FNDELAY);
+}
+
+static char** GetDeviceList (argc, argv)
+ int argc;
+ char **argv;
+{
+ int i;
+ char *envList = NULL;
+ char *cmdList = NULL;
+ char **deviceList = (char **)NULL;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-dev") == 0 && i+1 < argc) {
+ cmdList = argv[i + 1];
+ break;
+ }
+ if (!cmdList)
+ envList = getenv ("XDEVICE");
+
+ if (cmdList || envList) {
+ char *_tmpa;
+ char *_tmpb;
+ int _i1;
+ deviceList = (char **) xalloc ((MAXSCREENS + 1) * sizeof (char *));
+ _tmpa = (cmdList) ? cmdList : envList;
+ for (_i1 = 0; _i1 < MAXSCREENS; _i1++) {
+ _tmpb = strtok (_tmpa, ":");
+ if (_tmpb)
+ deviceList[_i1] = _tmpb;
+ else
+ deviceList[_i1] = NULL;
+ _tmpa = NULL;
+ }
+ deviceList[MAXSCREENS] = NULL;
+ }
+ if (!deviceList) {
+ /* no environment and no cmdline, so default */
+ deviceList =
+ (char **) xalloc ((FALLBACK_LIST_LEN + 1) * sizeof (char *));
+ for (i = 0; i < FALLBACK_LIST_LEN; i++)
+ deviceList[i] = fallbackList[i];
+ deviceList[FALLBACK_LIST_LEN] = NULL;
+ }
+ return deviceList;
+}
+
+static void getKbdType()
+{
+/*
+ * The Sun 386i has system include files that preclude this pre SunOS 4.1
+ * test for the presence of a type 4 keyboard however it really doesn't
+ * matter since no 386i has ever been shipped with a type 3 keyboard.
+ * SunOS 4.1 no longer needs this kludge.
+ */
+#if !defined(i386) && !defined(KIOCGKEY)
+#define TYPE4KEYBOARDOVERRIDE
+#endif
+
+ int ii;
+
+ for (ii = 0; ii < 3; ii++) {
+ sunKbdWait();
+ (void) ioctl (sunKbdPriv.fd, KIOCTYPE, &sunKbdPriv.type);
+#ifdef TYPE4KEYBOARDOVERRIDE
+ /*
+ * Magic. Look for a key which is non-existent on a real type
+ * 3 keyboard but does exist on a type 4 keyboard.
+ */
+ if (sunKbdPriv.type == KB_SUN3) {
+ struct kiockeymap key;
+
+ key.kio_tablemask = 0;
+ key.kio_station = 118;
+ if (ioctl(sunKbdPriv.fd, KIOCGKEY, &key) == -1) {
+ Error( "ioctl KIOCGKEY" );
+ FatalError("Can't KIOCGKEY on fd %d\n", sunKbdPriv.fd);
+ }
+ if (key.kio_entry != HOLE)
+ sunKbdPriv.type = KB_SUN4;
+ }
+#endif
+ switch (sunKbdPriv.type) {
+ case KB_SUN2:
+ case KB_SUN3:
+ case KB_SUN4: return;
+ default:
+ sunChangeKbdTranslation(sunKbdPriv.fd, FALSE);
+ continue;
+ }
+ }
+ FatalError ("Unsupported keyboard type %d\n", sunKbdPriv.type);
+}
+
+void OsVendorInit(
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ static int inited;
+ if (!inited) {
+#ifndef i386
+ struct rlimit rl;
+
+ /*
+ * one per client, one per screen, one per listen endpoint,
+ * keyboard, mouse, and stderr
+ */
+ int maxfds = MAXCLIENTS + MAXSCREENS + 5;
+
+ if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
+ rl.rlim_cur = maxfds < rl.rlim_max ? maxfds : rl.rlim_max;
+ (void) setrlimit (RLIMIT_NOFILE, &rl);
+ }
+#endif
+ sunKbdPriv.fd = open ("/dev/kbd", O_RDWR, 0);
+ if (sunKbdPriv.fd < 0)
+ FatalError ("Cannot open /dev/kbd, error %d\n", errno);
+ sunPtrPriv.fd = open ("/dev/mouse", O_RDWR, 0);
+ if (sunPtrPriv.fd < 0)
+ FatalError ("Cannot open /dev/mouse, error %d\n", errno);
+ getKbdType ();
+ if (sunKbdPriv.type == KB_SUN4) {
+ (void) ioctl (sunKbdPriv.fd, KIOCLAYOUT, &sunKbdPriv.layout);
+ if (sunKbdPriv.layout < 0 ||
+ sunKbdPriv.layout > sunMaxLayout ||
+ sunType4KeyMaps[sunKbdPriv.layout] == NULL)
+ FatalError ("Unsupported keyboard type 4 layout %d\n",
+ sunKbdPriv.layout);
+ sunKeySyms[KB_SUN4].map = sunType4KeyMaps[sunKbdPriv.layout];
+ sunModMaps[KB_SUN4] = sunType4ModMaps[sunKbdPriv.layout];
+ }
+ inited = 1;
+ }
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitOutput --
+ * Initialize screenInfo for all actually accessible framebuffers.
+ * The
+ *
+ * Results:
+ * screenInfo init proc field set
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+
+void InitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ int i, scr;
+ int nonBlockConsole = 0;
+ char **devList;
+ static int setup_on_exit = 0;
+ extern Bool RunFromSmartParent;
+
+ if (!monitorResolution)
+ monitorResolution = 90;
+ if (RunFromSmartParent)
+ nonBlockConsole = 1;
+ for (i = 1; i < argc; i++) {
+ if (!strcmp(argv[i],"-debug"))
+ nonBlockConsole = 0;
+ }
+
+ /*
+ * Writes to /dev/console can block - causing an
+ * excess of error messages to hang the server in
+ * deadlock. So.......
+ */
+ if (nonBlockConsole) {
+ if (!setup_on_exit) {
+#if defined(SVR4) || defined(CSRG_BASED)
+ if (atexit(sunNonBlockConsoleOff))
+#else
+ if (on_exit(sunNonBlockConsoleOff, (char *)0))
+#endif
+ ErrorF("InitOutput: can't register NBIO exit handler\n");
+
+ setup_on_exit = 1;
+ }
+ i = fcntl(2, F_GETFL, 0);
+ if (i >= 0)
+ i = fcntl(2, F_SETFL, i | FNDELAY);
+ if (i < 0) {
+ Error("fcntl");
+ ErrorF("InitOutput: can't put stderr in non-block mode\n");
+ }
+ }
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+ for (i=0; i< NUMFORMATS; i++)
+ pScreenInfo->formats[i] = formats[i];
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ sunAutoRepeatHandlersInstalled = FALSE;
+ if (!sunDevsInited) {
+ /* first time ever */
+ for (scr = 0; scr < MAXSCREENS; scr++)
+ sunFbs[scr].fd = -1;
+ devList = GetDeviceList (argc, argv);
+ for (i = 0, scr = 0; devList[i] != NULL && scr < MAXSCREENS; i++)
+ if (OpenFrameBuffer (devList[i], scr))
+ scr++;
+ sunDevsInited = TRUE;
+ xfree (devList);
+ }
+ for (scr = 0; scr < MAXSCREENS; scr++)
+ if (sunFbs[scr].fd != -1)
+ (void) AddScreen (sunFbData[sunFbs[scr].info.fb_type].init,
+ argc, argv);
+ (void) OsSignal(SIGWINCH, SIG_IGN);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitInput --
+ * Initialize all supported input devices...what else is there
+ * besides pointer and keyboard?
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Two DeviceRec's are allocated and registered as the system pointer
+ * and keyboard devices.
+ *
+ *-----------------------------------------------------------------------
+ */
+void InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ DevicePtr p, k;
+ extern Bool mieqInit();
+
+ p = AddInputDevice(sunMouseProc, TRUE);
+ k = AddInputDevice(sunKbdProc, TRUE);
+ if (!p || !k)
+ FatalError("failed to create input devices in InitInput");
+
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+ miRegisterPointerDevice(screenInfo.screens[0], p);
+ (void) mieqInit (k, p);
+#define SET_FLOW(fd) fcntl(fd, F_SETFL, FNDELAY | FASYNC)
+#ifdef SVR4
+ (void) OsSignal(SIGPOLL, SigIOHandler);
+#define WANT_SIGNALS(fd) ioctl(fd, I_SETSIG, S_INPUT | S_HIPRI)
+#else
+ (void) OsSignal(SIGIO, SigIOHandler);
+#define WANT_SIGNALS(fd) fcntl(fd, F_SETOWN, getpid())
+#endif
+ if (sunKbdPriv.fd >= 0) {
+ if (SET_FLOW(sunKbdPriv.fd) == -1 || WANT_SIGNALS(sunKbdPriv.fd) == -1) {
+ (void) close (sunKbdPriv.fd);
+ sunKbdPriv.fd = -1;
+ FatalError("Async kbd I/O failed in InitInput");
+ }
+ }
+ if (sunPtrPriv.fd >= 0) {
+ if (SET_FLOW(sunPtrPriv.fd) == -1 || WANT_SIGNALS(sunPtrPriv.fd) == -1) {
+ (void) close (sunPtrPriv.fd);
+ sunPtrPriv.fd = -1;
+ FatalError("Async mouse I/O failed in InitInput");
+ }
+ }
+}
+
+
+#if SUNMAXDEPTH == 8
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+
+#else /* SUNMAXDEPTH != 8 */
+#if SUNMAXDEPTH == 32
+
+static Bool
+sunCfbCreateGC(pGC)
+ GCPtr pGC;
+{
+ if (pGC->depth == 1)
+ {
+ return mfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 8)
+ {
+ return cfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 16)
+ {
+ return cfb16CreateGC (pGC);
+ }
+ else if (pGC->depth <= 32)
+ {
+ return cfb32CreateGC (pGC);
+ }
+ return FALSE;
+}
+
+static void
+sunCfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pdstStart; /* where to put the bits */
+{
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+static void
+sunCfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (pDrawable->bitsPerPixel)
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ int ret;
+
+ switch (bpp) {
+ case 8:
+ ret = cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 16:
+ ret = cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 32:
+ ret = cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ default:
+ return FALSE;
+ }
+ pScreen->CreateGC = sunCfbCreateGC;
+ pScreen->GetImage = sunCfbGetImage;
+ pScreen->GetSpans = sunCfbGetSpans;
+ return ret;
+}
+
+extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec;
+extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex;
+extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen();
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ pointer oldDevPrivate;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ VisualID defaultVisual;
+ int rootdepth = 0;
+
+ if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths,
+ &rootdepth, &defaultVisual, 1 << (bpp - 1), 8))
+ return FALSE;
+ oldDevPrivate = pScreen->devPrivate;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ switch (bpp)
+ {
+ case 8:
+ pScreen->CloseScreen = cfbCloseScreen;
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ break;
+ case 16:
+ pScreen->CloseScreen = cfb16CloseScreen;
+ pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb16BSFuncRec;
+ break;
+ case 32:
+ pScreen->CloseScreen = cfb32CloseScreen;
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb32BSFuncRec;
+ break;
+ }
+ return TRUE;
+}
+
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ if (!sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
+ return sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix,
+ dpiy, width, bpp);
+}
+
+#endif /* SUNMAXDEPTH == 32 */
+#endif /* SUNMAXDEPTH */
+
+#ifdef DPMSExtension
+/**************************************************************
+ * DPMSSet(), DPMSGet(), DPMSSupported()
+ *
+ * stubs
+ *
+ ***************************************************************/
+
+void DPMSSet (level)
+ int level;
+{
+}
+
+int DPMSGet (level)
+ int* level;
+{
+ return -1;
+}
+
+Bool DPMSSupported ()
+{
+ return FALSE;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/sun/sunIo.c b/xc/programs/Xserver/hw/sun/sunIo.c
new file mode 100644
index 000000000..2d8692643
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunIo.c
@@ -0,0 +1,294 @@
+/* $TOG: sunIo.c /main/50 1998/02/10 13:16:53 kaleb $ */
+/*-
+ * sunIo.c --
+ * Functions to handle input from the keyboard and mouse.
+ *
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/sun/sunIo.c,v 3.4 1998/10/04 09:38:37 dawes Exp $ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#define NEED_EVENTS
+#include "sun.h"
+
+/*-
+ *-----------------------------------------------------------------------
+ * ProcessInputEvents --
+ * Retrieve all waiting input events and pass them to DIX in their
+ * correct chronological order. Only reads from the system pointer
+ * and keyboard.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Events are passed to the DIX layer.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+ProcessInputEvents ()
+{
+ (void) mieqProcessInputEvents ();
+ miPointerUpdate ();
+}
+
+/*
+ *-----------------------------------------------------------------------
+ * sunEnqueueEvents
+ * When a SIGIO is received, read device hard events and
+ * enqueue them using the mi event queue
+ */
+
+void sunEnqueueEvents (
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ Firm_event *ptrEvents, /* Current pointer event */
+ *kbdEvents; /* Current keyboard event */
+ int numPtrEvents, /* Number of remaining pointer events */
+ numKbdEvents; /* Number of remaining keyboard events */
+ int nPE, /* Original number of pointer events */
+ nKE; /* Original number of keyboard events */
+ Bool PtrAgain, /* need to (re)read */
+ KbdAgain; /* need to (re)read */
+ DeviceIntPtr pPointer;
+ DeviceIntPtr pKeyboard;
+ sunKbdPrivPtr kbdPriv;
+ sunPtrPrivPtr ptrPriv;
+
+ pPointer = (DeviceIntPtr)LookupPointerDevice();
+ pKeyboard = (DeviceIntPtr)LookupKeyboardDevice();
+ ptrPriv = (sunPtrPrivPtr) pPointer->public.devicePrivate;
+ kbdPriv = (sunKbdPrivPtr) pKeyboard->public.devicePrivate;
+ if (!pPointer->public.on || !pKeyboard->public.on)
+ return;
+
+ numPtrEvents = 0;
+ PtrAgain = TRUE;
+ numKbdEvents = 0;
+ KbdAgain = TRUE;
+
+ /*
+ * So long as one event from either device remains unprocess, we loop:
+ * Take the oldest remaining event and pass it to the proper module
+ * for processing. The DDXEvent will be sent to ProcessInput by the
+ * function called.
+ */
+ while (1) {
+ /*
+ * Get events from both the pointer and the keyboard, storing the number
+ * of events gotten in nPE and nKE and keeping the start of both arrays
+ * in pE and kE
+ */
+ if ((numPtrEvents == 0) && PtrAgain) {
+ ptrEvents = sunMouseGetEvents (ptrPriv->fd, pPointer->public.on,
+ &nPE, &PtrAgain);
+ numPtrEvents = nPE;
+ }
+ if ((numKbdEvents == 0) && KbdAgain) {
+ kbdEvents = sunKbdGetEvents (kbdPriv->fd, pKeyboard->public.on,
+ &nKE, &KbdAgain);
+ numKbdEvents = nKE;
+ }
+ if ((numPtrEvents == 0) && (numKbdEvents == 0))
+ break;
+ if (numPtrEvents && numKbdEvents) {
+ if (timercmp (&kbdEvents->time, &ptrEvents->time, <)) {
+ sunKbdEnqueueEvent (pKeyboard, kbdEvents);
+ numKbdEvents--;
+ kbdEvents++;
+ } else {
+ sunMouseEnqueueEvent (pPointer, ptrEvents);
+ numPtrEvents--;
+ ptrEvents++;
+ }
+ } else if (numKbdEvents) {
+ sunKbdEnqueueEvent (pKeyboard, kbdEvents);
+ numKbdEvents--;
+ kbdEvents++;
+ } else {
+ sunMouseEnqueueEvent (pPointer, ptrEvents);
+ numPtrEvents--;
+ ptrEvents++;
+ }
+ }
+}
+
+/*
+ * DDX - specific abort routine. Called by AbortServer().
+ */
+void AbortDDX()
+{
+ int i;
+ ScreenPtr pScreen;
+ DevicePtr devPtr;
+
+#ifdef SVR4
+ (void) OsSignal (SIGPOLL, SIG_IGN);
+#else
+ (void) OsSignal (SIGIO, SIG_IGN);
+#endif
+ devPtr = LookupKeyboardDevice();
+ if (devPtr)
+ (void) sunChangeKbdTranslation (((sunKbdPrivPtr)(devPtr->devicePrivate))->fd, FALSE);
+#if defined(SVR4) || defined(CSRG_BASED)
+ sunNonBlockConsoleOff ();
+#else
+ sunNonBlockConsoleOff (NULL);
+#endif
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ sunDisableCursor (pScreen);
+ }
+}
+
+/* Called by GiveUp(). */
+void
+ddxGiveUp()
+{
+ AbortDDX ();
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+{
+ extern void UseMsg();
+
+#ifdef XKB
+ int noxkb = 0, n;
+ /*
+ * peek in argv and see if -kb because noXkbExtension won't
+ * get set until too late to useful here.
+ */
+ for (n = 1; n < argc; n++)
+ if (strcmp (argv[n], "-kb") == 0)
+ noxkb = 1;
+
+ if (noxkb)
+#endif
+ if (strcmp (argv[i], "-ar1") == 0) { /* -ar1 int */
+ if (++i >= argc) UseMsg ();
+ sunAutoRepeatInitiate = 1000 * (long)atoi(argv[i]); /* cvt to usec */
+ if (sunAutoRepeatInitiate > 1000000)
+ sunAutoRepeatInitiate = 999000;
+ return 2;
+ }
+#ifdef XKB
+ if (noxkb)
+#endif
+ if (strcmp (argv[i], "-ar2") == 0) { /* -ar2 int */
+ if (++i >= argc) UseMsg ();
+ sunAutoRepeatDelay = 1000 * (long)atoi(argv[i]); /* cvt to usec */
+ if (sunAutoRepeatDelay > 1000000)
+ sunAutoRepeatDelay = 999000;
+ return 2;
+ }
+ if (strcmp (argv[i], "-swapLkeys") == 0) { /* -swapLkeys */
+ sunSwapLkeys = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-debug") == 0) { /* -debug */
+ return 1;
+ }
+ if (strcmp (argv[i], "-dev") == 0) { /* -dev /dev/mumble */
+ if (++i >= argc) UseMsg ();
+ return 2;
+ }
+ if (strcmp (argv[i], "-mono") == 0) { /* -mono */
+ return 1;
+ }
+ if (strcmp (argv[i], "-zaphod") == 0) { /* -zaphod */
+ sunActiveZaphod = FALSE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-flipPixels") == 0) { /* -flipPixels */
+ sunFlipPixels = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-fbinfo") == 0) { /* -fbinfo */
+ sunFbInfo = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-kbd") == 0) { /* -kbd */
+ if (++i >= argc) UseMsg();
+ return 2;
+ }
+ if (strcmp (argv[i], "-protect") == 0) { /* -protect */
+ if (++i >= argc) UseMsg();
+ return 2;
+ }
+ if (strcmp (argv[i], "-cg4frob") == 0) {
+ sunCG4Frob = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-noGX") == 0) {
+ sunNoGX = TRUE;
+ return 1;
+ }
+ return 0;
+}
+
+void
+ddxUseMsg()
+{
+#ifndef XKB
+ ErrorF("-ar1 int set autorepeat initiate time\n");
+ ErrorF("-ar2 int set autorepeat interval time\n");
+#endif
+ ErrorF("-swapLkeys swap keysyms on L1..L10\n");
+ ErrorF("-debug disable non-blocking console mode\n");
+ ErrorF("-dev fn[:fn][:fn] name of device[s] to open\n");
+ ErrorF("-mono force monochrome-only screen\n");
+ ErrorF("-zaphod disable active Zaphod mode\n");
+ ErrorF("-fbinfo tell more about the found frame buffer(s)\n");
+#ifdef UNDOCUMENTED
+ ErrorF("-cg4frob don't use the mono plane of the cgfour\n");
+ ErrorF("-noGX treat the GX as a dumb frame buffer\n");
+#endif
+}
diff --git a/xc/programs/Xserver/hw/sun/sunKbd.c b/xc/programs/Xserver/hw/sun/sunKbd.c
new file mode 100644
index 000000000..65d57820c
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunKbd.c
@@ -0,0 +1,1116 @@
+/* $TOG: sunKbd.c /main/78 1998/02/10 13:16:57 kaleb $ */
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/sun/sunKbd.c,v 1.4 1998/12/20 11:57:33 dawes Exp $ */
+
+#define NEED_EVENTS
+#include "sun.h"
+#include "keysym.h"
+#include "Sunkeysym.h"
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBsrv.h>
+#endif
+
+#define SUN_LED_MASK 0x0f
+#define MIN_KEYCODE 7 /* necessary to avoid the mouse buttons */
+#define MAX_KEYCODE 255 /* limited by the protocol */
+#ifndef KB_SUN4
+#define KB_SUN4 4
+#endif
+
+#define AUTOREPEAT_INITIATE 400
+#define AUTOREPEAT_DELAY 50
+
+#define tvminus(tv, tv1, tv2) /* tv = tv1 - tv2 */ \
+ if ((tv1).tv_usec < (tv2).tv_usec) { \
+ (tv1).tv_usec += 1000000; \
+ (tv1).tv_sec -= 1; \
+ } \
+ (tv).tv_usec = (tv1).tv_usec - (tv2).tv_usec; \
+ (tv).tv_sec = (tv1).tv_sec - (tv2).tv_sec;
+
+#define tvplus(tv, tv1, tv2) /* tv = tv1 + tv2 */ \
+ (tv).tv_sec = (tv1).tv_sec + (tv2).tv_sec; \
+ (tv).tv_usec = (tv1).tv_usec + (tv2).tv_usec; \
+ if ((tv).tv_usec > 1000000) { \
+ (tv).tv_usec -= 1000000; \
+ (tv).tv_sec += 1; \
+ }
+
+extern KeySymsRec sunKeySyms[];
+extern SunModmapRec* sunModMaps[];
+
+long sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE;
+long sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY;
+
+static int autoRepeatKeyDown = 0;
+static int autoRepeatReady;
+static int autoRepeatFirst;
+static struct timeval autoRepeatLastKeyDownTv;
+static struct timeval autoRepeatDeltaTv;
+
+void sunKbdWait()
+{
+ static struct timeval lastChngKbdTransTv;
+ struct timeval tv;
+ struct timeval lastChngKbdDeltaTv;
+ unsigned int lastChngKbdDelta;
+
+ X_GETTIMEOFDAY(&tv);
+ if (!lastChngKbdTransTv.tv_sec)
+ lastChngKbdTransTv = tv;
+ tvminus(lastChngKbdDeltaTv, tv, lastChngKbdTransTv);
+ lastChngKbdDelta = TVTOMILLI(lastChngKbdDeltaTv);
+ if (lastChngKbdDelta < 750) {
+ unsigned wait;
+ /*
+ * We need to guarantee at least 750 milliseconds between
+ * calls to KIOCTRANS. YUCK!
+ */
+ wait = (750L - lastChngKbdDelta) * 1000L;
+ usleep (wait);
+ X_GETTIMEOFDAY(&tv);
+ }
+ lastChngKbdTransTv = tv;
+}
+
+static void SwapLKeys(keysyms)
+ KeySymsRec* keysyms;
+{
+ unsigned int i;
+ KeySym k;
+
+ for (i = 2; i < keysyms->maxKeyCode * keysyms->mapWidth; i++)
+ if (keysyms->map[i] == XK_L1 ||
+ keysyms->map[i] == XK_L2 ||
+ keysyms->map[i] == XK_L3 ||
+ keysyms->map[i] == XK_L4 ||
+ keysyms->map[i] == XK_L5 ||
+ keysyms->map[i] == XK_L6 ||
+ keysyms->map[i] == XK_L7 ||
+ keysyms->map[i] == XK_L8 ||
+ keysyms->map[i] == XK_L9 ||
+ keysyms->map[i] == XK_L10) {
+ /* yes, I could have done a clever two line swap! */
+ k = keysyms->map[i - 2];
+ keysyms->map[i - 2] = keysyms->map[i];
+ keysyms->map[i] = k;
+ }
+}
+
+static void SetLights (ctrl, fd)
+ KeybdCtrl* ctrl;
+ int fd;
+{
+#ifdef KIOCSLED
+ static unsigned char led_tab[16] = {
+ 0,
+ LED_NUM_LOCK,
+ LED_SCROLL_LOCK,
+ LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_COMPOSE,
+ LED_COMPOSE | LED_NUM_LOCK,
+ LED_COMPOSE | LED_SCROLL_LOCK,
+ LED_COMPOSE | LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK,
+ LED_CAPS_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_SCROLL_LOCK,
+ LED_CAPS_LOCK | LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_SCROLL_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_SCROLL_LOCK | LED_NUM_LOCK
+ };
+ if (ioctl (fd, KIOCSLED, (caddr_t)&led_tab[ctrl->leds & 0x0f]) == -1)
+ Error("Failed to set keyboard lights");
+#endif
+}
+
+
+static void ModLight (device, on, led)
+ DeviceIntPtr device;
+ Bool on;
+ int led;
+{
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if(on) {
+ ctrl->leds |= led;
+ pPriv->leds |= led;
+ } else {
+ ctrl->leds &= ~led;
+ pPriv->leds &= ~led;
+ }
+ SetLights (ctrl, pPriv->fd);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunBell --
+ * Ring the terminal/keyboard bell
+ *
+ * Results:
+ * Ring the keyboard bell for an amount of time proportional to
+ * "loudness."
+ *
+ * Side Effects:
+ * None, really...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void bell (
+ int fd,
+ int duration)
+#else
+static void bell (fd, duration)
+ int fd;
+ int duration;
+#endif
+{
+ int kbdCmd; /* Command to give keyboard */
+
+ kbdCmd = KBD_CMD_BELL;
+ if (ioctl (fd, KIOCCMD, &kbdCmd) == -1) {
+ Error("Failed to activate bell");
+ return;
+ }
+ if (duration) usleep (duration);
+ kbdCmd = KBD_CMD_NOBELL;
+ if (ioctl (fd, KIOCCMD, &kbdCmd) == -1)
+ Error ("Failed to deactivate bell");
+}
+
+#if NeedFunctionPrototypes
+static void sunBell (
+ int percent,
+ DeviceIntPtr device,
+ pointer ctrl,
+ int unused)
+#else
+static void sunBell (percent, device, ctrl, unused)
+ int percent; /* Percentage of full volume */
+ DeviceIntPtr device; /* Keyboard to ring */
+ pointer ctrl;
+ int unused;
+#endif
+{
+ KeybdCtrl* kctrl = (KeybdCtrl*) ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (percent == 0 || kctrl->bell == 0)
+ return;
+
+ bell (pPriv->fd, kctrl->bell_duration * 1000);
+}
+
+static void sunEnqueueEvent (xE)
+ xEvent* xE;
+{
+#ifndef i386
+ sigset_t holdmask;
+
+#ifdef SVR4
+ (void) sigaddset (&holdmask, SIGPOLL);
+#else
+ (void) sigaddset (&holdmask, SIGIO);
+#endif
+ (void) sigprocmask (SIG_BLOCK, &holdmask, (sigset_t*)NULL);
+ mieqEnqueue (xE);
+ (void) sigprocmask (SIG_UNBLOCK, &holdmask, (sigset_t*)NULL);
+#else
+ int oldmask = sigblock (sigmask (SIGIO));
+
+ mieqEnqueue (xE);
+ sigsetmask (oldmask);
+#endif
+}
+
+
+#define XLED_NUM_LOCK 0x1
+#define XLED_COMPOSE 0x4
+#define XLED_SCROLL_LOCK 0x2
+#define XLED_CAPS_LOCK 0x8
+
+static KeyCode LookupKeyCode (keysym, keysymsrec)
+ KeySym keysym;
+ KeySymsPtr keysymsrec;
+{
+ KeyCode i;
+ int ii, index = 0;
+
+ for (i = keysymsrec->minKeyCode; i < keysymsrec->maxKeyCode; i++)
+ for (ii = 0; ii < keysymsrec->mapWidth; ii++)
+ if (keysymsrec->map[index++] == keysym)
+ return i;
+}
+
+static void pseudoKey(device, down, keycode)
+ DeviceIntPtr device;
+ Bool down;
+ KeyCode keycode;
+{
+ int bit;
+ CARD8 modifiers;
+ CARD16 mask;
+ BYTE* kptr;
+
+ kptr = &device->key->down[keycode >> 3];
+ bit = 1 << (keycode & 7);
+ modifiers = device->key->modifierMap[keycode];
+ if (down) {
+ /* fool dix into thinking this key is now "down" */
+ int i;
+ *kptr |= bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ device->key->modifierKeyCount[i]++;
+ device->key->state += mask;
+ modifiers &= ~mask;
+ }
+ } else {
+ /* fool dix into thinking this key is now "up" */
+ if (*kptr & bit) {
+ int i;
+ *kptr &= ~bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ if (--device->key->modifierKeyCount[i] <= 0) {
+ device->key->state &= ~mask;
+ device->key->modifierKeyCount[i] = 0;
+ }
+ modifiers &= ~mask;
+ }
+ }
+ }
+}
+
+static void DoLEDs(device, ctrl, pPriv)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+ sunKbdPrivPtr pPriv;
+{
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if ((ctrl->leds & XLED_CAPS_LOCK) && !(pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_CAPS_LOCK) && (pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_NUM_LOCK) && !(pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_NUM_LOCK) && (pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_SCROLL_LOCK) && !(pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_SCROLL_LOCK) && (pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_COMPOSE) && !(pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_COMPOSE) && (pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+#ifdef XKB
+ }
+#endif
+ pPriv->leds = ctrl->leds & 0x0f;
+ SetLights (ctrl, pPriv->fd);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdCtrl --
+ * Alter some of the keyboard control parameters
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Some...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void sunKbdCtrl (
+ DeviceIntPtr device,
+ KeybdCtrl* ctrl)
+#else
+static void sunKbdCtrl (device, ctrl)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+#endif
+{
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (pPriv->fd < 0) return;
+
+ if (ctrl->click != pPriv->click) {
+ int kbdClickCmd;
+
+ pPriv->click = ctrl->click;
+ kbdClickCmd = pPriv->click ? KBD_CMD_CLICK : KBD_CMD_NOCLICK;
+ if (ioctl (pPriv->fd, KIOCCMD, &kbdClickCmd) == -1)
+ Error("Failed to set keyclick");
+ }
+ if (pPriv->type == KB_SUN4 && pPriv->leds != ctrl->leds & 0x0f)
+ DoLEDs(device, ctrl, pPriv);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunInitKbdNames --
+ * Handle the XKB initialization
+ *
+ * Results:
+ * None.
+ *
+ * Comments:
+ * This function needs considerable work, in conjunctions with
+ * the need to add geometry descriptions of Sun Keyboards.
+ * It would also be nice to have #defines for all the keyboard
+ * layouts so that we don't have to have these hard-coded
+ * numbers.
+ *
+ *-----------------------------------------------------------------------
+ */
+#ifdef XKB
+#if NeedFunctionPrototypes
+static void sunInitKbdNames (
+ XkbComponentNamesRec* names,
+ sunKbdPrivPtr pKbd)
+#else
+static void sunInitKbdNames (names, pKbd)
+ XkbComponentNamesRec* names;
+ sunKbdPrivPtr pKbd;
+#endif
+{
+#ifndef XKBBUFSIZE
+#define XKBBUFSIZE 64
+#endif
+ static char keycodesbuf[XKBBUFSIZE];
+ static char geometrybuf[XKBBUFSIZE];
+ static char symbolsbuf[XKBBUFSIZE];
+
+ names->keymap = NULL;
+ names->compat = "compat/complete";
+ names->types = "types/complete";
+ names->keycodes = keycodesbuf;
+ names->geometry = geometrybuf;
+ names->symbols = symbolsbuf;
+ (void) strcpy (keycodesbuf, "keycodes/");
+ (void) strcpy (geometrybuf, "geometry/");
+ (void) strcpy (symbolsbuf, "symbols/");
+
+ /* keycodes & geometry */
+ switch (pKbd->type) {
+ case KB_SUN2:
+ (void) strcat (names->keycodes, "sun(type2)");
+ (void) strcat (names->geometry, "sun(type2)");
+ (void) strcat (names->symbols, "us(sun2)");
+ break;
+ case KB_SUN3:
+ (void) strcat (names->keycodes, "sun(type3)");
+ (void) strcat (names->geometry, "sun(type3)");
+ (void) strcat (names->symbols, "us(sun3)");
+ break;
+ case KB_SUN4:
+ /* First, catch "fully known" models */
+ switch (pKbd->layout) {
+ case 11: /* type4, Sweden */
+ (void) strcat (names->geometry, "sun(type4_se)");
+ (void) strcat (names->keycodes,
+ "sun(type4_se_swapctl)");
+ (void) strcat (names->symbols,
+ "sun/se(sun4)+se(fixdollar)");
+ return;
+ break;
+ case 43: /* type5/5c, Sweden */
+ (void) strcat (names->geometry, "sun(type5c_se)");
+ (void) strcat (names->keycodes, "sun(type5_se)");
+ (void) strcat (names->symbols,
+ "sun/se(sun5)+se(fixdollar)");
+ return;
+ break;
+ case 90: /* "Compact 1", Sweden (???) */
+ break; /* No specific mapping, yet */
+ default:
+ break;
+ }
+
+ if (pKbd->layout == 19) {
+ (void) strcat (names->keycodes, "sun(US101A)");
+ (void) strcat (names->geometry, "pc101-NG"); /* XXX */
+ (void) strcat (names->symbols, "us(pc101)");
+ } else if (pKbd->layout < 33) {
+ (void) strcat (names->keycodes, "sun(type4)");
+ (void) strcat (names->geometry, "sun(type4)");
+ if (sunSwapLkeys)
+ (void) strcat (names->symbols, "sun/us(sun4ol)");
+ else
+ (void) strcat (names->symbols, "sun/us(sun4)");
+ } else {
+ (void) strcat (names->keycodes, "sun(type5)");
+
+ switch (pKbd->layout) {
+ case 33: case 80: /* U.S. */
+ case 47: case 94: /* Korea */
+ case 48: case 95: /* Taiwan */
+ case 49: case 96: /* Japan */
+ (void) strcat (names->geometry, "sun(type5)");
+ break;
+ case 34: case 81: /* U.S. Unix */
+ (void) strcat (names->geometry, "sun(type5unix)");
+ break;
+ default:
+ (void) strcat (names->geometry, "sun(type5euro)");
+ }
+
+ if (sunSwapLkeys)
+ (void) strcat (names->symbols, "sun/us(sun5ol)");
+ else
+ (void) strcat (names->symbols, "sun/us(sun5)");
+ }
+ break;
+ default:
+ names->keycodes = names->geometry = NULL;
+ break;
+ }
+
+ /* extra symbols */
+
+ if (pKbd->type == KB_SUN4) {
+ switch (pKbd->layout) {
+ case 4: case 36: case 83:
+ case 5: case 37: case 84:
+ case 6: case 38: case 85:
+ case 8: case 40: case 87:
+ case 9: case 41: case 88:
+ case 10: case 42: case 89:
+/* case 11: case 43: case 90: */ /* handled earlier */
+ case 12: case 44: case 91:
+ case 13: case 45: case 92:
+ case 14: case 46: case 93:
+ (void) strcat (names->symbols, "+iso9995-3(basic)"); break;
+ }
+ }
+
+ if (pKbd->type == KB_SUN4) {
+ switch (pKbd->layout) {
+ case 0: case 1: case 33: case 34: case 80: case 81:
+ break;
+ case 3:
+ (void) strcat (names->symbols, "+ca"); break;
+ case 4: case 36: case 83:
+ (void) strcat (names->symbols, "+dk"); break;
+ case 5: case 37: case 84:
+ (void) strcat (names->symbols, "+de"); break;
+ case 6: case 38: case 85:
+ (void) strcat (names->symbols, "+it"); break;
+ case 8: case 40: case 87:
+ (void) strcat (names->symbols, "+no"); break;
+ case 9: case 41: case 88:
+ (void) strcat (names->symbols, "+pt"); break;
+ case 10: case 42: case 89:
+ (void) strcat (names->symbols, "+es"); break;
+ /* case 11: case 43: */ /* handled earlier */
+ case 90:
+ (void) strcat (names->symbols, "+se"); break;
+ case 12: case 44: case 91:
+ (void) strcat (names->symbols, "+fr_CH"); break;
+ case 13: case 45: case 92:
+ (void) strcat (names->symbols, "+de_CH"); break;
+ case 14: case 46: case 93:
+ (void) strcat (names->symbols, "+gb"); break; /* s/b en_UK */
+ case 52:
+ (void) strcat (names->symbols, "+pl"); break;
+ case 53:
+ (void) strcat (names->symbols, "+cs"); break;
+ case 54:
+ (void) strcat (names->symbols, "+ru"); break;
+#if 0
+ /* don't have symbols defined for these yet, let them default */
+ case 2:
+ (void) strcat (names->symbols, "+fr_BE"); break;
+ case 7: case 39: case 86:
+ (void) strcat (names->symbols, "+nl"); break;
+ case 50: case 97:
+ (void) strcat (names->symbols, "+fr_CA"); break;
+ case 16: case 47: case 94:
+ (void) strcat (names->symbols, "+ko"); break;
+ case 17: case 48: case 95:
+ (void) strcat (names->symbols, "+tw"); break;
+ case 32: case 49: case 96:
+ (void) strcat (names->symbols, "+jp"); break;
+ case 51:
+ (void) strcat (names->symbols, "+hu"); break;
+#endif
+ /*
+ * by setting the symbols to NULL XKB will use the symbols in
+ * the "default" keymap.
+ */
+ default:
+ names->symbols = NULL; return; break;
+ }
+ }
+}
+#endif /* XKB */
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdProc --
+ * Handle the initialization, etc. of a keyboard.
+ *
+ * Results:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+int sunKbdProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunKbdProc (device, what)
+ DeviceIntPtr device; /* Keyboard to manipulate */
+ int what; /* What to do to it */
+#endif
+{
+ int i;
+ DevicePtr pKeyboard = (DevicePtr) device;
+ sunKbdPrivPtr pPriv;
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
+
+ static CARD8 *workingModMap = NULL;
+ static KeySymsRec *workingKeySyms;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pKeyboard != LookupKeyboardDevice()) {
+ ErrorF ("Cannot open non-system keyboard\n");
+ return (!Success);
+ }
+
+ if (!workingKeySyms) {
+ workingKeySyms = &sunKeySyms[sunKbdPriv.type];
+
+ if (sunKbdPriv.type == KB_SUN4 && sunSwapLkeys)
+ SwapLKeys(workingKeySyms);
+
+ if (workingKeySyms->minKeyCode < MIN_KEYCODE) {
+ workingKeySyms->minKeyCode += MIN_KEYCODE;
+ workingKeySyms->maxKeyCode += MIN_KEYCODE;
+ }
+ if (workingKeySyms->maxKeyCode > MAX_KEYCODE)
+ workingKeySyms->maxKeyCode = MAX_KEYCODE;
+ }
+
+ if (!workingModMap) {
+ workingModMap=(CARD8 *)xalloc(MAP_LENGTH);
+ (void) memset(workingModMap, 0, MAP_LENGTH);
+ for(i=0; sunModMaps[sunKbdPriv.type][i].key != 0; i++)
+ workingModMap[sunModMaps[sunKbdPriv.type][i].key + MIN_KEYCODE] =
+ sunModMaps[sunKbdPriv.type][i].modifiers;
+ }
+
+ (void) memset ((void *) defaultKeyboardControl.autoRepeats,
+ ~0, sizeof defaultKeyboardControl.autoRepeats);
+
+#ifdef XKB
+ if (noXkbExtension) {
+ sunAutoRepeatInitiate = XkbDfltRepeatDelay * 1000;
+ sunAutoRepeatDelay = XkbDfltRepeatInterval * 1000;
+#endif
+ autoRepeatKeyDown = 0;
+#ifdef XKB
+ }
+#endif
+ pKeyboard->devicePrivate = (pointer)&sunKbdPriv;
+ pKeyboard->on = FALSE;
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ InitKeyboardDeviceStruct(pKeyboard,
+ workingKeySyms, workingModMap,
+ sunBell, sunKbdCtrl);
+#ifdef XKB
+ } else {
+ XkbComponentNamesRec names;
+ sunInitKbdNames (&names, &sunKbdPriv);
+ XkbInitKeyboardDeviceStruct((DeviceIntPtr) pKeyboard, &names,
+ workingKeySyms, workingModMap,
+ sunBell, sunKbdCtrl);
+ }
+#endif
+ break;
+
+ case DEVICE_ON:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ /*
+ * Set the keyboard into "direct" mode and turn on
+ * event translation.
+ */
+ if (sunChangeKbdTranslation(pPriv->fd,TRUE) == -1)
+ FatalError("Can't set keyboard translation\n");
+ (void) AddEnabledDevice(pPriv->fd);
+ pKeyboard->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ if (pPriv->type == KB_SUN4) {
+ /* dumb bug in Sun's keyboard! Turn off LEDS before resetting */
+ pPriv->leds = 0;
+ ctrl->leds = 0;
+ SetLights(ctrl, pPriv->fd);
+ }
+ /*
+ * Restore original keyboard directness and translation.
+ */
+ if (sunChangeKbdTranslation(pPriv->fd,FALSE) == -1)
+ FatalError("Can't reset keyboard translation\n");
+ RemoveEnabledDevice(pPriv->fd);
+ pKeyboard->on = FALSE;
+ break;
+ default:
+ FatalError("Unknown keyboard operation\n");
+ }
+ return Success;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdGetEvents --
+ * Return the events waiting in the wings for the given keyboard.
+ *
+ * Results:
+ * A pointer to an array of Firm_events or (Firm_event *)0 if no events
+ * The number of events contained in the array.
+ * A boolean as to whether more events might be available.
+ *
+ * Side Effects:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+Firm_event* sunKbdGetEvents (
+ int fd,
+ Bool on,
+ int* pNumEvents,
+ Bool* pAgain)
+#else
+Firm_event* sunKbdGetEvents (fd, on, pNumEvents, pAgain)
+ int fd;
+ Bool on;
+ int* pNumEvents;
+ Bool* pAgain;
+#endif
+{
+ int nBytes; /* number of bytes of events available. */
+ static Firm_event evBuf[MAXEVENTS]; /* Buffer for Firm_events */
+
+ if ((nBytes = read (fd, evBuf, sizeof(evBuf))) == -1) {
+ if (errno == EWOULDBLOCK) {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ } else {
+ Error ("Reading keyboard");
+ FatalError ("Could not read the keyboard");
+ }
+ } else {
+ if (on) {
+ *pNumEvents = nBytes / sizeof (Firm_event);
+ *pAgain = (nBytes == sizeof (evBuf));
+ } else {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ }
+ }
+ return evBuf;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdEnqueueEvent --
+ *
+ *-----------------------------------------------------------------------
+ */
+static xEvent autoRepeatEvent;
+static int composeCount;
+
+static Bool DoSpecialKeys(device, xE, fe)
+ DeviceIntPtr device;
+ xEvent* xE;
+ Firm_event* fe;
+{
+ int shift_index, map_index, bit;
+ KeySym ksym;
+ BYTE* kptr;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr)device->public.devicePrivate;
+ BYTE keycode = xE->u.u.detail;
+ CARD8 keyModifiers = device->key->modifierMap[keycode];
+
+ /* look up the present idea of the keysym */
+ shift_index = 0;
+ if (device->key->state & ShiftMask)
+ shift_index ^= 1;
+ if (device->key->state & LockMask)
+ shift_index ^= 1;
+ map_index = (fe->id - 1) * device->key->curKeySyms.mapWidth;
+ ksym = device->key->curKeySyms.map[shift_index + map_index];
+ if (ksym == NoSymbol)
+ ksym = device->key->curKeySyms.map[map_index];
+
+ /*
+ * Toggle functionality is hardcoded. This is achieved by always
+ * discarding KeyReleases on these keys, and converting every other
+ * KeyPress into a KeyRelease.
+ */
+ if (xE->u.u.type == KeyRelease
+ && (ksym == XK_Num_Lock
+ || ksym == XK_Scroll_Lock
+ || ksym == SunXK_Compose
+ || (keyModifiers & LockMask)))
+ return TRUE;
+
+ kptr = &device->key->down[keycode >> 3];
+ bit = 1 << (keycode & 7);
+ if ((*kptr & bit) &&
+ (ksym == XK_Num_Lock || ksym == XK_Scroll_Lock ||
+ ksym == SunXK_Compose || (keyModifiers & LockMask)))
+ xE->u.u.type = KeyRelease;
+
+ if (pPriv->type == KB_SUN4) {
+ if (ksym == XK_Num_Lock) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_NUM_LOCK);
+ } else if (ksym == XK_Scroll_Lock) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_SCROLL_LOCK);
+ } else if (ksym == SunXK_Compose) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_COMPOSE);
+ if (xE->u.u.type == KeyPress) composeCount = 2;
+ else composeCount = 0;
+ } else if (keyModifiers & LockMask) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_CAPS_LOCK);
+ }
+ if (xE->u.u.type == KeyRelease) {
+ if (composeCount > 0 && --composeCount == 0) {
+ pseudoKey(device, FALSE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+ ModLight (device, FALSE, XLED_COMPOSE);
+ }
+ }
+ }
+
+ if ((xE->u.u.type == KeyPress) && (keyModifiers == 0)) {
+ /* initialize new AutoRepeater event & mark AutoRepeater on */
+ autoRepeatEvent = *xE;
+ autoRepeatFirst = TRUE;
+ autoRepeatKeyDown++;
+ autoRepeatLastKeyDownTv = fe->time;
+ }
+ return FALSE;
+}
+
+#if NeedFunctionPrototypes
+void sunKbdEnqueueEvent (
+ DeviceIntPtr device,
+ Firm_event *fe)
+#else
+void sunKbdEnqueueEvent (device, fe)
+ DeviceIntPtr device;
+ Firm_event *fe;
+#endif
+{
+ xEvent xE;
+ BYTE keycode;
+ CARD8 keyModifiers;
+
+ keycode = (fe->id & 0x7f) + MIN_KEYCODE;
+
+ keyModifiers = device->key->modifierMap[keycode];
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if (autoRepeatKeyDown && (keyModifiers == 0) &&
+ ((fe->value == VKEY_DOWN) || (keycode == autoRepeatEvent.u.u.detail))) {
+ /*
+ * Kill AutoRepeater on any real non-modifier key down, or auto key up
+ */
+ autoRepeatKeyDown = 0;
+ }
+#ifdef XKB
+ }
+#endif
+ xE.u.keyButtonPointer.time = TVTOMILLI(fe->time);
+ xE.u.u.type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress);
+ xE.u.u.detail = keycode;
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if (DoSpecialKeys(device, &xE, fe))
+ return;
+#ifdef XKB
+ }
+#endif /* ! XKB */
+ mieqEnqueue (&xE);
+}
+
+void sunEnqueueAutoRepeat ()
+{
+ int delta;
+ int i, mask;
+ DeviceIntPtr device = (DeviceIntPtr)LookupKeyboardDevice();
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+ i=(autoRepeatEvent.u.u.detail >> 3);
+ mask=(1 << (autoRepeatEvent.u.u.detail & 7));
+ if (!(ctrl->autoRepeats[i] & mask)) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+
+ /*
+ * Generate auto repeat event. XXX one for now.
+ * Update time & pointer location of saved KeyPress event.
+ */
+
+ delta = TVTOMILLI(autoRepeatDeltaTv);
+ autoRepeatFirst = FALSE;
+
+ /*
+ * Fake a key up event and a key down event
+ * for the last key pressed.
+ */
+ autoRepeatEvent.u.keyButtonPointer.time += delta;
+ autoRepeatEvent.u.u.type = KeyRelease;
+
+ /*
+ * hold off any more inputs while we get these safely queued up
+ * further SIGIO are
+ */
+ sunEnqueueEvent (&autoRepeatEvent);
+ autoRepeatEvent.u.u.type = KeyPress;
+ sunEnqueueEvent (&autoRepeatEvent);
+ if (ctrl->click) bell (pPriv->fd, 0);
+
+ /* Update time of last key down */
+ tvplus(autoRepeatLastKeyDownTv, autoRepeatLastKeyDownTv,
+ autoRepeatDeltaTv);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunChangeKbdTranslation
+ * Makes operating system calls to set keyboard translation
+ * and direction on or off.
+ *
+ * Results:
+ * -1 if failure, else 0.
+ *
+ * Side Effects:
+ * Changes kernel management of keyboard.
+ *
+ *-----------------------------------------------------------------------
+ */
+#if NeedFunctionPrototypes
+int sunChangeKbdTranslation(
+ int fd,
+ Bool makeTranslated)
+
+#else
+int sunChangeKbdTranslation(fd, makeTranslated)
+ int fd;
+ Bool makeTranslated;
+#endif
+{
+ int tmp;
+#ifndef i386 /* { */
+ sigset_t hold_mask, old_mask;
+#else /* }{ */
+ int old_mask;
+#endif /* } */
+ int toread;
+ char junk[8192];
+
+#ifndef i386 /* { */
+ (void) sigfillset(&hold_mask);
+ (void) sigprocmask(SIG_BLOCK, &hold_mask, &old_mask);
+#else /* }{ */
+ old_mask = sigblock (~0);
+#endif /* } */
+ sunKbdWait();
+ if (makeTranslated) {
+ /*
+ * Next set the keyboard into "direct" mode and turn on
+ * event translation. If either of these fails, we can't go
+ * on.
+ */
+ tmp = 1;
+ if (ioctl (fd, KIOCSDIRECT, &tmp) == -1) {
+ Error ("Setting keyboard direct mode");
+ return -1;
+ }
+ tmp = TR_UNTRANS_EVENT;
+ if (ioctl (fd, KIOCTRANS, &tmp) == -1) {
+ Error ("Setting keyboard translation");
+ ErrorF ("sunChangeKbdTranslation: kbdFd=%d\n", fd);
+ return -1;
+ }
+ } else {
+ /*
+ * Next set the keyboard into "indirect" mode and turn off
+ * event translation.
+ */
+ tmp = 0;
+ (void)ioctl (fd, KIOCSDIRECT, &tmp);
+ tmp = TR_ASCII;
+ (void)ioctl (fd, KIOCTRANS, &tmp);
+ }
+ if (ioctl (fd, FIONREAD, &toread) != -1 && toread > 0) {
+ while (toread) {
+ tmp = toread;
+ if (toread > sizeof (junk))
+ tmp = sizeof (junk);
+ (void) read (fd, junk, tmp);
+ toread -= tmp;
+ }
+ }
+#ifndef i386 /* { */
+ (void) sigprocmask(SIG_SETMASK, &old_mask, (sigset_t *)NULL);
+#else /* }{ */
+ sigsetmask (old_mask);
+#endif /* } */
+ return 0;
+}
+
+/*ARGSUSED*/
+Bool LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void sunBlockHandler(nscreen, pbdata, pptv, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ struct timeval **pptv;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ static struct timeval artv = { 0, 0 }; /* autorepeat timeval */
+
+ if (!autoRepeatKeyDown)
+ return;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatFirst == TRUE)
+ artv.tv_usec = sunAutoRepeatInitiate;
+ else
+ artv.tv_usec = sunAutoRepeatDelay;
+ *pptv = &artv;
+
+}
+
+/*ARGSUSED*/
+void sunWakeupHandler(nscreen, pbdata, err, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ unsigned long err;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ struct timeval tv;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatKeyDown) {
+ X_GETTIMEOFDAY(&tv);
+ tvminus(autoRepeatDeltaTv, tv, autoRepeatLastKeyDownTv);
+ if (autoRepeatDeltaTv.tv_sec > 0 ||
+ (!autoRepeatFirst && autoRepeatDeltaTv.tv_usec >
+ sunAutoRepeatDelay) ||
+ (autoRepeatDeltaTv.tv_usec >
+ sunAutoRepeatInitiate))
+ autoRepeatReady++;
+ }
+
+ if (autoRepeatReady)
+ {
+ sunEnqueueAutoRepeat ();
+ autoRepeatReady = 0;
+ }
+}
diff --git a/xc/programs/Xserver/hw/sun/sunKeyMap.c b/xc/programs/Xserver/hw/sun/sunKeyMap.c
new file mode 100644
index 000000000..f203c0dd4
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunKeyMap.c
@@ -0,0 +1,5797 @@
+/* $TOG: sunKeyMap.c /main/33 1998/02/10 13:17:03 kaleb $ */
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/sun/sunKeyMap.c,v 1.2 1998/12/20 11:57:34 dawes Exp $ */
+
+#include "sun.h"
+#define XK_KATAKANA
+#include "keysym.h"
+#include "Sunkeysym.h"
+
+/*
+ By default all keyboards are hardcoded on the theory that people
+ might remove /usr/openwin making it impossible to parse the files
+ in /usr/openwin/share/etc/keytables.
+*/
+#define CAN4
+#define CANFR5
+#define DEN4
+#define DEN5
+#define FR5
+#define FRBE4
+#define GER4
+#define GER5
+#define ITALY4
+#define ITALY5
+#define JAPAN4
+#define JAPAN5
+#define KOREA4
+#define KOREA5
+#define NETH4
+#define NETH5
+#define NORW4
+#define NORW5
+#define PORT4
+#define PORT5
+#define SPAIN5
+#define SPAINLATAM4
+#define SWED5
+#define SWEDFIN4
+#define SWFR4
+#define SWFR5
+#define SWGE4
+#define SWGE5
+#define TAI4
+#define TAI5
+#define UK4
+#define UK5
+#define US101A
+#define US2
+#define US3
+#define US4
+#define US5
+#define US_UNIX5
+
+/*
+ * XXX - Its not clear what to map these to for now.
+ * keysyms.h doesn't define enough function key names.
+ */
+
+#ifndef XK_L1
+#define XK_L1 XK_Cancel
+#define XK_L2 XK_Redo
+#define XK_R1 NoSymbol
+#define XK_R2 NoSymbol
+#define XK_R3 NoSymbol
+#define XK_L3 XK_Menu
+#define XK_L4 XK_Undo
+#define XK_R4 NoSymbol
+#define XK_R5 NoSymbol
+#define XK_R6 NoSymbol
+#define XK_L5 XK_Insert
+#define XK_L6 XK_Select
+#define XK_R7 NoSymbol
+#define XK_R8 XK_Up
+#define XK_R9 NoSymbol
+#define XK_L7 XK_Execute
+#define XK_L8 XK_Print
+#define XK_R10 XK_Left
+#define XK_R11 XK_Home
+#define XK_R12 XK_Right
+#define XK_L9 XK_Find
+#define XK_L10 XK_Help
+#define XK_R13 NoSymbol
+#define XK_R14 XK_Down
+#define XK_R15 NoSymbol
+#endif
+
+/* twm and Motif have hard-coded dependencies on Meta being Mod1 :-( */
+#if 0
+/* This set has optimal characteristics for use in the Toolkit... */
+#define Meta_Mask Mod1Mask
+#define Mode_switch_Mask Mod2Mask
+#define Num_Lock_Mask Mod3Mask
+#define Alt_Mask Mod4Mask
+#else
+/* but this set is compatible with what we shipped in R6. */
+#define Meta_Mask Mod1Mask
+#define Mode_switch_Mask Mod2Mask
+#define Alt_Mask Mod3Mask
+#define Num_Lock_Mask Mod4Mask
+#endif
+
+#ifdef US2
+
+static KeySym US2Keymap[] = {
+ XK_L1, NoSymbol, /* 0x1 */
+ NoSymbol, NoSymbol, /* 0x2 */
+ XK_L2, NoSymbol, /* 0x3 */
+ NoSymbol, NoSymbol, /* 0x4 */
+ XK_F1, NoSymbol, /* 0x5 */
+ XK_F2, NoSymbol, /* 0x6 */
+ NoSymbol, NoSymbol, /* 0x7 */
+ XK_F3, NoSymbol, /* 0x8 */
+ NoSymbol, NoSymbol, /* 0x9 */
+ XK_F4, NoSymbol, /* 0xa */
+ NoSymbol, NoSymbol, /* 0xb */
+ XK_F5, NoSymbol, /* 0xc */
+ NoSymbol, NoSymbol, /* 0xd */
+ XK_F6, NoSymbol, /* 0xe */
+ NoSymbol, NoSymbol, /* 0xf */
+ XK_F7, NoSymbol, /* 0x10 */
+ XK_F8, NoSymbol, /* 0x11 */
+ XK_F9, NoSymbol, /* 0x12 */
+ XK_Break, NoSymbol, /* 0x13 */
+ NoSymbol, NoSymbol, /* 0x14 */
+ XK_R1, NoSymbol, /* 0x15 */
+ XK_R2, NoSymbol, /* 0x16 */
+ XK_R3, NoSymbol, /* 0x17 */
+ NoSymbol, NoSymbol, /* 0x18 */
+ XK_L3, NoSymbol, /* 0x19 */
+ XK_L4, NoSymbol, /* 0x1a */
+ NoSymbol, NoSymbol, /* 0x1b */
+ NoSymbol, NoSymbol, /* 0x1c */
+ XK_Escape, NoSymbol, /* 0x1d */
+ XK_1, XK_exclam, /* 0x1e */
+ XK_2, XK_at, /* 0x1f */
+ XK_3, XK_numbersign, /* 0x20 */
+ XK_4, XK_dollar, /* 0x21 */
+ XK_5, XK_percent, /* 0x22 */
+ XK_6, XK_asciicircum, /* 0x23 */
+ XK_7, XK_ampersand, /* 0x24 */
+ XK_8, XK_asterisk, /* 0x25 */
+ XK_9, XK_parenleft, /* 0x26 */
+ XK_0, XK_parenright, /* 0x27 */
+ XK_minus, XK_underscore, /* 0x28 */
+ XK_equal, XK_plus, /* 0x29 */
+ XK_grave, XK_asciitilde, /* 0x2a */
+ XK_BackSpace, NoSymbol, /* 0x2b */
+ NoSymbol, NoSymbol, /* 0x2c */
+ XK_R4, NoSymbol, /* 0x2d */
+ XK_R5, NoSymbol, /* 0x2e */
+ XK_R6, NoSymbol, /* 0x2f */
+ NoSymbol, NoSymbol, /* 0x30 */
+ XK_L5, NoSymbol, /* 0x31 */
+ NoSymbol, NoSymbol, /* 0x32 */
+ XK_L6, NoSymbol, /* 0x33 */
+ NoSymbol, NoSymbol, /* 0x34 */
+ XK_Tab, NoSymbol, /* 0x35 */
+ XK_Q, NoSymbol, /* 0x36 */
+ XK_W, NoSymbol, /* 0x37 */
+ XK_E, NoSymbol, /* 0x38 */
+ XK_R, NoSymbol, /* 0x39 */
+ XK_T, NoSymbol, /* 0x3a */
+ XK_Y, NoSymbol, /* 0x3b */
+ XK_U, NoSymbol, /* 0x3c */
+ XK_I, NoSymbol, /* 0x3d */
+ XK_O, NoSymbol, /* 0x3e */
+ XK_P, NoSymbol, /* 0x3f */
+ XK_bracketleft, XK_braceleft, /* 0x40 */
+ XK_bracketright, XK_braceright, /* 0x41 */
+ XK_Delete, NoSymbol, /* 0x42 */
+ NoSymbol, NoSymbol, /* 0x43 */
+ XK_R7, NoSymbol, /* 0x44 */
+ XK_Up, XK_R8, /* 0x45 */
+ XK_R9, NoSymbol, /* 0x46 */
+ NoSymbol, NoSymbol, /* 0x47 */
+ XK_L7, NoSymbol, /* 0x48 */
+ XK_L8, NoSymbol, /* 0x49 */
+ NoSymbol, NoSymbol, /* 0x4a */
+ NoSymbol, NoSymbol, /* 0x4b */
+ XK_Control_L, NoSymbol, /* 0x4c */
+ XK_A, NoSymbol, /* 0x4d */
+ XK_S, NoSymbol, /* 0x4e */
+ XK_D, NoSymbol, /* 0x4f */
+ XK_F, NoSymbol, /* 0x50 */
+ XK_G, NoSymbol, /* 0x51 */
+ XK_H, NoSymbol, /* 0x52 */
+ XK_J, NoSymbol, /* 0x53 */
+ XK_K, NoSymbol, /* 0x54 */
+ XK_L, NoSymbol, /* 0x55 */
+ XK_semicolon, XK_colon, /* 0x56 */
+ XK_apostrophe, XK_quotedbl, /* 0x57 */
+ XK_backslash, XK_bar, /* 0x58 */
+ XK_Return, NoSymbol, /* 0x59 */
+ NoSymbol, NoSymbol, /* 0x5a */
+ XK_Left, XK_R10, /* 0x5b */
+ XK_R11, NoSymbol, /* 0x5c */
+ XK_Right, XK_R12, /* 0x5d */
+ NoSymbol, NoSymbol, /* 0x5e */
+ XK_L9, NoSymbol, /* 0x5f */
+ NoSymbol, NoSymbol, /* 0x60 */
+ XK_L10, NoSymbol, /* 0x61 */
+ NoSymbol, NoSymbol, /* 0x62 */
+ XK_Shift_L, NoSymbol, /* 0x63 */
+ XK_Z, NoSymbol, /* 0x64 */
+ XK_X, NoSymbol, /* 0x65 */
+ XK_C, NoSymbol, /* 0x66 */
+ XK_V, NoSymbol, /* 0x67 */
+ XK_B, NoSymbol, /* 0x68 */
+ XK_N, NoSymbol, /* 0x69 */
+ XK_M, NoSymbol, /* 0x6a */
+ XK_comma, XK_less, /* 0x6b */
+ XK_period, XK_greater, /* 0x6c */
+ XK_slash, XK_question, /* 0x6d */
+ XK_Shift_R, NoSymbol, /* 0x6e */
+ XK_Linefeed, NoSymbol, /* 0x6f */
+ XK_R13, NoSymbol, /* 0x70 */
+ XK_Down, XK_R14, /* 0x71 */
+ XK_R15, NoSymbol, /* 0x72 */
+ NoSymbol, NoSymbol, /* 0x73 */
+ NoSymbol, NoSymbol, /* 0x74 */
+ NoSymbol, NoSymbol, /* 0x75 */
+ NoSymbol, NoSymbol, /* 0x76 */
+ NoSymbol, NoSymbol, /* 0x77 */
+ XK_Meta_L, NoSymbol, /* 0x78 */
+ XK_space, NoSymbol, /* 0x79 */
+ XK_Meta_R, NoSymbol, /* 0x7a */
+ NoSymbol, NoSymbol, /* 0x7b */
+ NoSymbol, NoSymbol, /* 0x7c */
+ NoSymbol, NoSymbol, /* 0x7d */
+ NoSymbol, NoSymbol, /* 0x7e */
+ NoSymbol, NoSymbol, /* 0x7f */
+};
+
+static SunModmapRec US2Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 0, 0
+};
+
+#else
+
+#define US2Keymap NULL
+#define US2Modmap NULL
+
+#endif /* US2 */
+
+#ifdef US3
+
+static KeySym US3Keymap[] = {
+ XK_L1, NoSymbol, /* 0x1 */
+ NoSymbol, NoSymbol, /* 0x2 */
+ XK_L2, NoSymbol, /* 0x3 */
+ NoSymbol, NoSymbol, /* 0x4 */
+ XK_F1, NoSymbol, /* 0x5 */
+ XK_F2, NoSymbol, /* 0x6 */
+ NoSymbol, NoSymbol, /* 0x7 */
+ XK_F3, NoSymbol, /* 0x8 */
+ NoSymbol, NoSymbol, /* 0x9 */
+ XK_F4, NoSymbol, /* 0xa */
+ NoSymbol, NoSymbol, /* 0xb */
+ XK_F5, NoSymbol, /* 0xc */
+ NoSymbol, NoSymbol, /* 0xd */
+ XK_F6, NoSymbol, /* 0xe */
+ NoSymbol, NoSymbol, /* 0xf */
+ XK_F7, NoSymbol, /* 0x10 */
+ XK_F8, NoSymbol, /* 0x11 */
+ XK_F9, NoSymbol, /* 0x12 */
+ XK_Alt_R, NoSymbol, /* 0x13 */
+ NoSymbol, NoSymbol, /* 0x14 */
+ XK_R1, NoSymbol, /* 0x15 */
+ XK_R2, NoSymbol, /* 0x16 */
+ XK_R3, NoSymbol, /* 0x17 */
+ NoSymbol, NoSymbol, /* 0x18 */
+ XK_L3, NoSymbol, /* 0x19 */
+ XK_L4, NoSymbol, /* 0x1a */
+ NoSymbol, NoSymbol, /* 0x1b */
+ NoSymbol, NoSymbol, /* 0x1c */
+ XK_Escape, NoSymbol, /* 0x1d */
+ XK_1, XK_exclam, /* 0x1e */
+ XK_2, XK_at, /* 0x1f */
+ XK_3, XK_numbersign, /* 0x20 */
+ XK_4, XK_dollar, /* 0x21 */
+ XK_5, XK_percent, /* 0x22 */
+ XK_6, XK_asciicircum, /* 0x23 */
+ XK_7, XK_ampersand, /* 0x24 */
+ XK_8, XK_asterisk, /* 0x25 */
+ XK_9, XK_parenleft, /* 0x26 */
+ XK_0, XK_parenright, /* 0x27 */
+ XK_minus, XK_underscore, /* 0x28 */
+ XK_equal, XK_plus, /* 0x29 */
+ XK_grave, XK_asciitilde, /* 0x2a */
+ XK_BackSpace, NoSymbol, /* 0x2b */
+ NoSymbol, NoSymbol, /* 0x2c */
+ XK_R4, NoSymbol, /* 0x2d */
+ XK_R5, NoSymbol, /* 0x2e */
+ XK_R6, NoSymbol, /* 0x2f */
+ NoSymbol, NoSymbol, /* 0x30 */
+ XK_L5, NoSymbol, /* 0x31 */
+ NoSymbol, NoSymbol, /* 0x32 */
+ XK_L6, NoSymbol, /* 0x33 */
+ NoSymbol, NoSymbol, /* 0x34 */
+ XK_Tab, NoSymbol, /* 0x35 */
+ XK_Q, NoSymbol, /* 0x36 */
+ XK_W, NoSymbol, /* 0x37 */
+ XK_E, NoSymbol, /* 0x38 */
+ XK_R, NoSymbol, /* 0x39 */
+ XK_T, NoSymbol, /* 0x3a */
+ XK_Y, NoSymbol, /* 0x3b */
+ XK_U, NoSymbol, /* 0x3c */
+ XK_I, NoSymbol, /* 0x3d */
+ XK_O, NoSymbol, /* 0x3e */
+ XK_P, NoSymbol, /* 0x3f */
+ XK_bracketleft, XK_braceleft, /* 0x40 */
+ XK_bracketright, XK_braceright, /* 0x41 */
+ XK_Delete, NoSymbol, /* 0x42 */
+ NoSymbol, NoSymbol, /* 0x43 */
+ XK_R7, NoSymbol, /* 0x44 */
+ XK_Up, XK_R8, /* 0x45 */
+ XK_R9, NoSymbol, /* 0x46 */
+ NoSymbol, NoSymbol, /* 0x47 */
+ XK_L7, NoSymbol, /* 0x48 */
+ XK_L8, NoSymbol, /* 0x49 */
+ NoSymbol, NoSymbol, /* 0x4a */
+ NoSymbol, NoSymbol, /* 0x4b */
+ XK_Control_L, NoSymbol, /* 0x4c */
+ XK_A, NoSymbol, /* 0x4d */
+ XK_S, NoSymbol, /* 0x4e */
+ XK_D, NoSymbol, /* 0x4f */
+ XK_F, NoSymbol, /* 0x50 */
+ XK_G, NoSymbol, /* 0x51 */
+ XK_H, NoSymbol, /* 0x52 */
+ XK_J, NoSymbol, /* 0x53 */
+ XK_K, NoSymbol, /* 0x54 */
+ XK_L, NoSymbol, /* 0x55 */
+ XK_semicolon, XK_colon, /* 0x56 */
+ XK_apostrophe, XK_quotedbl, /* 0x57 */
+ XK_backslash, XK_bar, /* 0x58 */
+ XK_Return, NoSymbol, /* 0x59 */
+ NoSymbol, NoSymbol, /* 0x5a */
+ XK_Left, XK_R10, /* 0x5b */
+ XK_R11, NoSymbol, /* 0x5c */
+ XK_Right, XK_R12, /* 0x5d */
+ NoSymbol, NoSymbol, /* 0x5e */
+ XK_L9, NoSymbol, /* 0x5f */
+ NoSymbol, NoSymbol, /* 0x60 */
+ XK_L10, NoSymbol, /* 0x61 */
+ NoSymbol, NoSymbol, /* 0x62 */
+ XK_Shift_L, NoSymbol, /* 0x63 */
+ XK_Z, NoSymbol, /* 0x64 */
+ XK_X, NoSymbol, /* 0x65 */
+ XK_C, NoSymbol, /* 0x66 */
+ XK_V, NoSymbol, /* 0x67 */
+ XK_B, NoSymbol, /* 0x68 */
+ XK_N, NoSymbol, /* 0x69 */
+ XK_M, NoSymbol, /* 0x6a */
+ XK_comma, XK_less, /* 0x6b */
+ XK_period, XK_greater, /* 0x6c */
+ XK_slash, XK_question, /* 0x6d */
+ XK_Shift_R, NoSymbol, /* 0x6e */
+ XK_Linefeed, NoSymbol, /* 0x6f */
+ XK_R13, NoSymbol, /* 0x70 */
+ XK_Down, XK_R14, /* 0x71 */
+ XK_R15, NoSymbol, /* 0x72 */
+ NoSymbol, NoSymbol, /* 0x73 */
+ NoSymbol, NoSymbol, /* 0x74 */
+ NoSymbol, NoSymbol, /* 0x75 */
+ NoSymbol, NoSymbol, /* 0x76 */
+ XK_Caps_Lock, NoSymbol, /* 0x77 */
+ XK_Meta_L, NoSymbol, /* 0x78 */
+ XK_space, NoSymbol, /* 0x79 */
+ XK_Meta_R, NoSymbol, /* 0x7a */
+ NoSymbol, NoSymbol, /* 0x7b */
+ NoSymbol, NoSymbol, /* 0x7c */
+ NoSymbol, NoSymbol, /* 0x7d */
+ NoSymbol, NoSymbol, /* 0x7e */
+ NoSymbol, NoSymbol, /* 0x7f */
+};
+
+static SunModmapRec US3Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, ControlMask,
+ 119, LockMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 0, 0
+};
+
+#else
+
+#define US3Keymap NULL
+#define US3Modmap NULL
+
+#endif /* US3 */
+
+KeySymsRec sunKeySyms[] = {
+ /* map minKeyCode maxKC width */
+ (KeySym *)NULL, 0, 0, 0,
+ (KeySym *)NULL, 0, 0, 0,
+ US2Keymap, 1, 0x7a, 2,
+ US3Keymap, 1, 0x7a, 2,
+ (KeySym *)NULL, 1, 0x7d, 4,
+};
+
+SunModmapRec *sunModMaps[] = {
+ NULL,
+ NULL,
+ US2Modmap,
+ US3Modmap,
+ NULL
+};
+
+static SunModmapRec Generic5Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 119, LockMask,
+ 76, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 13, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#if defined(DEN4) || defined(SWEDFIN4) || defined(SWFR4) || defined(SWGE4)
+
+static SunModmapRec DenSwedFinSw4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, LockMask,
+ 119, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 67, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#endif
+
+#if defined(FRBE4) || defined(NETH4)
+
+static SunModmapRec FrBeNeth4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 13, LockMask,
+ 76, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 119, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#endif
+
+#if defined(ITALY4) || defined(NORW4) || defined(PORT4) || defined(SPAINLATAM4)
+
+static SunModmapRec ItNorPortSp4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, LockMask,
+ 119, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 13, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#endif
+
+#ifdef CAN4
+
+static KeySym Canada4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 9*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 11*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_degree, NoSymbol, XK_notsign, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_question, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_parenright, XK_braceright, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, XK_bar, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_Agrave, NoSymbol, XK_grave, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, XK_KP_Equal, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, XK_KP_Divide, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, XK_KP_Multiply, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Circum,SunXK_FA_Diaeresis,XK_asciicircum,NoSymbol, /* 64*/
+ XK_Ccedilla, NoSymbol, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, XK_Prior, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_Egrave, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, XK_guillemotleft,NoSymbol, /*100*/
+ XK_X, NoSymbol, XK_guillemotright,NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_apostrophe, XK_less, NoSymbol, /*107*/
+ XK_period, NoSymbol, XK_greater, NoSymbol, /*108*/
+ XK_Eacute, NoSymbol, XK_slash, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_Ugrave, NoSymbol, XK_backslash, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+static SunModmapRec Canada4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, LockMask,
+ 13, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 119, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#else
+
+#define Canada4Keymap NULL
+#define Canada4Modmap NULL
+
+#endif /* CANADA4 */
+
+#ifdef CANFR5
+
+static KeySym CanadaFr5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, XK_Break, XK_R1, XK_R1, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, XK_R3, XK_R3, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_plusminus, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_cent, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_currency, NoSymbol, /* 34*/
+ XK_6, XK_question, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, XK_bracketleft, NoSymbol, /* 38*/
+ XK_0, XK_parenright, XK_bracketright,NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, XK_notsign, NoSymbol, /* 41*/
+ XK_slash, XK_backslash, XK_bar, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, XK_R5, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, XK_R6, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift,NoSymbol,NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, XK_paragraph, NoSymbol, /* 63*/
+ SunXK_FA_Circum,SunXK_FA_Diaeresis,SunXK_FA_Grave,NoSymbol, /* 64*/
+ XK_Ccedilla, NoSymbol, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, XK_R4, XK_R4, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, XK_degree, NoSymbol, /* 86*/
+ XK_Egrave, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_Agrave, NoSymbol, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, XK_guillemotleft,NoSymbol, /*100*/
+ XK_X, NoSymbol, XK_guillemotright,NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_quoteright, XK_less, NoSymbol, /*107*/
+ XK_period, XK_quotedbl, XK_greater, NoSymbol, /*108*/
+ XK_Eacute, NoSymbol, XK_quoteleft, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_Uacute, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define CanadaFr5Modmap Generic5Modmap
+
+#else
+
+#define CanadaFr5Keymap NULL
+#define CanadaFr5Modmap NULL
+
+#endif /* CANFR5 */
+
+
+#ifdef DEN4
+
+static KeySym Denmark4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_asciitilde, XK_asciicircum, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, XK_R1, XK_Pause, NoSymbol, /* 21*/
+ XK_Print, XK_R2, XK_Print, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, NoSymbol, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, XK_bar, NoSymbol, /* 41*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,SunXK_FA_Tilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_AE, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Ooblique, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_onehalf, XK_section, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_backslash, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Denmark4Modmap DenSwedFinSw4Modmap
+
+#else
+
+#define Denmark4Keymap NULL
+#define Denmark4Modmap NULL
+
+#endif /* DENMARK4 */
+
+
+#ifdef DEN5
+
+static KeySym Denmark5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_asciicircum, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, NoSymbol, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, XK_bar, NoSymbol, /* 41*/
+ XK_onehalf, XK_section, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,SunXK_FA_Tilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_AE, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Ooblique, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_backslash, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Denmark5Modmap Generic5Modmap
+
+#else
+
+#define Denmark5Keymap NULL
+#define Denmark5Modmap NULL
+
+#endif /* DEN5 */
+
+
+#ifdef FR5
+
+static KeySym France5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_ampersand, XK_1, NoSymbol, NoSymbol, /* 30*/
+ XK_eacute, XK_2, XK_asciitilde, NoSymbol, /* 31*/
+ XK_quotedbl, XK_3, XK_numbersign, NoSymbol, /* 32*/
+ XK_apostrophe, XK_4, XK_braceleft, NoSymbol, /* 33*/
+ XK_parenleft, XK_5, XK_bracketleft, NoSymbol, /* 34*/
+ XK_minus, XK_6, XK_bar, NoSymbol, /* 35*/
+ XK_egrave, XK_7, XK_grave, NoSymbol, /* 36*/
+ XK_underscore, XK_8, XK_backslash, NoSymbol, /* 37*/
+ XK_ccedilla, XK_9, XK_asciicircum, NoSymbol, /* 38*/
+ XK_agrave, XK_0, XK_at, NoSymbol, /* 39*/
+ XK_parenright, XK_degree, XK_bracketright,NoSymbol, /* 40*/
+ XK_equal, XK_plus, XK_braceright, NoSymbol, /* 41*/
+ XK_twosuperior, NoSymbol, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Circum,SunXK_FA_Diaeresis,NoSymbol, NoSymbol, /* 64*/
+ XK_dollar, XK_sterling, XK_currency, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_ugrave, XK_percent, NoSymbol, NoSymbol, /* 87*/
+ XK_asterisk, XK_mu, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_comma, XK_question, NoSymbol, NoSymbol, /*106*/
+ XK_semicolon, XK_period, NoSymbol, NoSymbol, /*107*/
+ XK_colon, XK_slash, NoSymbol, NoSymbol, /*108*/
+ XK_exclam, XK_section, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, XK_Next, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define France5Modmap Generic5Modmap
+
+#else
+
+#define France5Keymap NULL
+#define France5Modmap NULL
+
+#endif /* FRANCE5 */
+
+
+#ifdef FRBE4
+
+static KeySym FranceBelg4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_bracketright,XK_braceright, XK_guillemotright,NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_ampersand, XK_1, NoSymbol, NoSymbol, /* 30*/
+ XK_eacute, XK_2, XK_twosuperior, NoSymbol, /* 31*/
+ XK_quotedbl, XK_3, XK_threesuperior,NoSymbol, /* 32*/
+ XK_apostrophe, XK_4, XK_acute, NoSymbol, /* 33*/
+ XK_parenleft, XK_5, NoSymbol, NoSymbol, /* 34*/
+ XK_section, XK_6, XK_asciicircum, NoSymbol, /* 35*/
+ XK_egrave, XK_7, NoSymbol, NoSymbol, /* 36*/
+ XK_exclam, XK_8, XK_sterling, NoSymbol, /* 37*/
+ XK_ccedilla, XK_9, XK_backslash, NoSymbol, /* 38*/
+ XK_agrave, XK_0, NoSymbol, NoSymbol, /* 39*/
+ XK_parenright, XK_degree, XK_asciitilde, NoSymbol, /* 40*/
+ XK_minus, XK_underscore, XK_numbersign, NoSymbol, /* 41*/
+ XK_asterisk, XK_bar, XK_currency, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, XK_KP_Equal, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, XK_KP_Divide, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, XK_KP_Multiply, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Circum,SunXK_FA_Diaeresis,NoSymbol, NoSymbol, /* 64*/
+ XK_grave, XK_dollar, XK_at, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, XK_KP_Subtract, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /* 86*/
+ XK_ugrave, XK_percent, NoSymbol, NoSymbol, /* 87*/
+ XK_bracketleft, XK_braceleft, XK_guillemotleft,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, XK_KP_Enter, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_comma, XK_question, NoSymbol, NoSymbol, /*106*/
+ XK_semicolon, XK_period, NoSymbol, NoSymbol, /*107*/
+ XK_colon, XK_slash, NoSymbol, NoSymbol, /*108*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, XK_KP_Add, NoSymbol, NoSymbol, /*125*/
+};
+
+#define FranceBelg4Modmap FrBeNeth4Modmap
+
+#else
+
+#define FranceBelg4Keymap NULL
+#define FranceBelg4Modmap NULL
+
+#endif /* FRANCEBELG4 */
+
+
+#ifdef GER4
+
+static KeySym Germany4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ XK_Alt_R, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_bracketright,XK_braceright,XK_guillemotright,NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Scroll_Lock, NoSymbol, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_twosuperior, NoSymbol, /* 31*/
+ XK_3, XK_section, XK_threesuperior,NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_degree, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_grave, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_apostrophe, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_bar, NoSymbol, /* 39*/
+ XK_ssharp, XK_question, XK_backslash, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_numbersign, XK_asciicircum, XK_at, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Delete, XK_KP_Decimal, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Udiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, XK_KP_Subtract, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Odiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Adiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_bracketleft, XK_braceleft, XK_guillemotleft,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+static SunModmapRec Germany4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 76, LockMask,
+ 119, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 19, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 13, Alt_Mask,
+ 0, 0
+};
+
+#else
+
+#define Germany4Keymap NULL
+#define Germany4Modmap NULL
+
+#endif /* GERMANY4 */
+
+
+#ifdef GER5
+
+static KeySym Germany5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_twosuperior, NoSymbol, /* 31*/
+ XK_3, XK_section, XK_threesuperior,NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_ssharp, XK_question, XK_backslash, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_asciicircum, XK_degree, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Separator,NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_q, XK_Q, XK_at, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Udiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Odiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Adiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_numbersign, XK_apostrophe, XK_grave, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_m, XK_M, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_bar, NoSymbol, /*124*/
+ XK_KP_Add, XK_KP_Add, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Germany5Modmap Generic5Modmap
+
+#else
+
+#define Germany5Keymap NULL
+#define Germany5Modmap NULL
+
+#endif /* GERMANY5 */
+
+
+#ifdef ITALY4
+
+static KeySym Italy4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_bracketright,XK_braceright, XK_guillemotright,NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_twosuperior, NoSymbol, /* 31*/
+ XK_3, XK_sterling, XK_threesuperior,NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_notsign, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_backslash, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_bar, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_igrave, XK_asciicircum, NoSymbol, NoSymbol, /* 41*/
+ XK_ugrave, XK_section, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_egrave, XK_eacute, NoSymbol, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_ograve, XK_ccedilla, XK_at, NoSymbol, /* 86*/
+ XK_agrave, XK_degree, XK_numbersign, NoSymbol, /* 87*/
+ XK_bracketleft, XK_braceleft, XK_guillemotleft,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R4, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R5, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R6, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Italy4Modmap ItNorPortSp4Modmap
+
+#else
+
+#define Italy4Keymap NULL
+#define Italy4Modmap NULL
+
+#endif /* ITALY4 */
+
+
+#ifdef ITALY5
+
+static KeySym Italy5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, XK_Break, NoSymbol, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_sterling, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_braceleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_braceright, NoSymbol, /* 38*/
+ XK_0, XK_equal, NoSymbol, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_igrave, XK_asciicircum, NoSymbol, NoSymbol, /* 41*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, XK_KP_Divide, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, XK_KP_Multiply, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_egrave, XK_eacute, XK_bracketleft, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_bracketright,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_ograve, XK_ccedilla, XK_at, NoSymbol, /* 86*/
+ XK_agrave, XK_degree, XK_numbersign, NoSymbol, /* 87*/
+ XK_ugrave, XK_section, XK_asciitilde, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, XK_KP_Enter, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, XK_KP_Add, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Italy5Modmap Generic5Modmap
+
+#else
+
+#define Italy5Keymap NULL
+#define Italy5Modmap NULL
+
+#endif /* ITALY5 */
+
+
+#ifdef JAPAN4
+
+static KeySym Japan4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_kana_NU, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_kana_FU, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_kana_A, XK_kana_a, /* 32*/
+ XK_4, XK_dollar, XK_kana_U, XK_kana_u, /* 33*/
+ XK_5, XK_percent, XK_kana_E, XK_kana_e, /* 34*/
+ XK_6, XK_ampersand, XK_kana_O, XK_kana_o, /* 35*/
+ XK_7, XK_apostrophe, XK_kana_YA, XK_kana_ya, /* 36*/
+ XK_8, XK_parenleft, XK_kana_YU, XK_kana_yu, /* 37*/
+ XK_9, XK_parenright, XK_kana_YO, XK_kana_yo, /* 38*/
+ XK_0, XK_0, XK_kana_WA, XK_kana_WO, /* 39*/
+ XK_minus, XK_equal, XK_kana_HO, NoSymbol, /* 40*/
+ XK_asciicircum, XK_asciitilde, XK_kana_HE, NoSymbol, /* 41*/
+ XK_bracketright,XK_braceright, XK_kana_MU, XK_kana_closingbracket, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_q, XK_Q, XK_kana_TA, NoSymbol, /* 54*/
+ XK_w, XK_W, XK_kana_TE, NoSymbol, /* 55*/
+ XK_e, XK_E, XK_kana_I, XK_kana_i, /* 56*/
+ XK_r, XK_R, XK_kana_SU, NoSymbol, /* 57*/
+ XK_t, XK_T, XK_kana_KA, NoSymbol, /* 58*/
+ XK_y, XK_Y, XK_kana_N, NoSymbol, /* 59*/
+ XK_u, XK_U, XK_kana_NA, NoSymbol, /* 60*/
+ XK_i, XK_I, XK_kana_NI, NoSymbol, /* 61*/
+ XK_o, XK_O, XK_kana_RA, NoSymbol, /* 62*/
+ XK_p, XK_P, XK_kana_SE, NoSymbol, /* 63*/
+ XK_at, XK_grave, XK_voicedsound, NoSymbol, /* 64*/
+ XK_bracketleft, XK_braceleft, XK_semivoicedsound,XK_kana_openingbracket, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, XK_KP_Subtract, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_a, XK_A, XK_kana_CHI, NoSymbol, /* 77*/
+ XK_s, XK_S, XK_kana_TO, NoSymbol, /* 78*/
+ XK_d, XK_D, XK_kana_SHI, NoSymbol, /* 79*/
+ XK_f, XK_F, XK_kana_HA, NoSymbol, /* 80*/
+ XK_g, XK_G, XK_kana_KI, NoSymbol, /* 81*/
+ XK_h, XK_H, XK_kana_KU, NoSymbol, /* 82*/
+ XK_j, XK_J, XK_kana_MA, NoSymbol, /* 83*/
+ XK_k, XK_K, XK_kana_NO, NoSymbol, /* 84*/
+ XK_l, XK_L, XK_kana_RI, NoSymbol, /* 85*/
+ XK_semicolon, XK_plus, XK_kana_RE, NoSymbol, /* 86*/
+ XK_colon, XK_asterisk, XK_kana_KE, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, XK_prolongedsound,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_z, XK_Z, XK_kana_TSU, XK_kana_tsu, /*100*/
+ XK_x, XK_X, XK_kana_SA, NoSymbol, /*101*/
+ XK_c, XK_C, XK_kana_SO, NoSymbol, /*102*/
+ XK_v, XK_V, XK_kana_HI, NoSymbol, /*103*/
+ XK_b, XK_B, XK_kana_KO, NoSymbol, /*104*/
+ XK_n, XK_N, XK_kana_MI, NoSymbol, /*105*/
+ XK_m, XK_M, XK_kana_MO, NoSymbol, /*106*/
+ XK_comma, XK_less, XK_kana_NE, XK_kana_comma, /*107*/
+ XK_period, XK_greater, XK_kana_RU, XK_kana_fullstop, /*108*/
+ XK_slash, XK_question, XK_kana_ME, XK_kana_conjunctive, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_backslash, XK_underscore, XK_kana_RO, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ XK_Execute, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ XK_Kanji, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ XK_Henkan_Mode, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, XK_KP_Add, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Japan4Modmap Generic5Modmap
+
+#else
+
+#define Japan4Keymap NULL
+#define Japan4Modmap NULL
+
+#endif /* JAPAN4 */
+
+
+#ifdef JAPAN5
+
+static KeySym Japan5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_kana_NU, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_kana_FU, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_kana_A, XK_kana_a, /* 32*/
+ XK_4, XK_dollar, XK_kana_U, XK_kana_u, /* 33*/
+ XK_5, XK_percent, XK_kana_E, XK_kana_e, /* 34*/
+ XK_6, XK_ampersand, XK_kana_O, XK_kana_o, /* 35*/
+ XK_7, XK_apostrophe, XK_kana_YA, XK_kana_ya, /* 36*/
+ XK_8, XK_parenleft, XK_kana_YU, XK_kana_yu, /* 37*/
+ XK_9, XK_parenright, XK_kana_YO, XK_kana_yo, /* 38*/
+ XK_0, XK_0, XK_kana_WA, XK_kana_WO, /* 39*/
+ XK_minus, XK_equal, XK_kana_HO, NoSymbol, /* 40*/
+ XK_asciicircum, XK_asciitilde, XK_kana_HE, NoSymbol, /* 41*/
+ XK_backslash, XK_bar, XK_prolongedsound,NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_q, XK_Q, XK_kana_TA, NoSymbol, /* 54*/
+ XK_w, XK_W, XK_kana_TE, NoSymbol, /* 55*/
+ XK_e, XK_E, XK_kana_I, XK_kana_i, /* 56*/
+ XK_r, XK_R, XK_kana_SU, NoSymbol, /* 57*/
+ XK_t, XK_T, XK_kana_KA, NoSymbol, /* 58*/
+ XK_y, XK_Y, XK_kana_N, NoSymbol, /* 59*/
+ XK_u, XK_U, XK_kana_NA, NoSymbol, /* 60*/
+ XK_i, XK_I, XK_kana_NI, NoSymbol, /* 61*/
+ XK_o, XK_O, XK_kana_RA, NoSymbol, /* 62*/
+ XK_p, XK_P, XK_kana_SE, NoSymbol, /* 63*/
+ XK_at, XK_grave, XK_voicedsound, NoSymbol, /* 64*/
+ XK_bracketleft, XK_braceleft, XK_semivoicedsound,XK_kana_openingbracket, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_a, XK_A, XK_kana_CHI, NoSymbol, /* 77*/
+ XK_s, XK_S, XK_kana_TO, NoSymbol, /* 78*/
+ XK_d, XK_D, XK_kana_SHI, NoSymbol, /* 79*/
+ XK_f, XK_F, XK_kana_HA, NoSymbol, /* 80*/
+ XK_g, XK_G, XK_kana_KI, NoSymbol, /* 81*/
+ XK_h, XK_H, XK_kana_KU, NoSymbol, /* 82*/
+ XK_j, XK_J, XK_kana_MA, NoSymbol, /* 83*/
+ XK_k, XK_K, XK_kana_NO, NoSymbol, /* 84*/
+ XK_l, XK_L, XK_kana_RI, NoSymbol, /* 85*/
+ XK_semicolon, XK_plus, XK_kana_RE, NoSymbol, /* 86*/
+ XK_colon, XK_asterisk, XK_kana_KE, NoSymbol, /* 87*/
+ XK_bracketright,XK_braceright, XK_kana_MU, XK_kana_closingbracket, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_z, XK_Z, XK_kana_TSU, XK_kana_tsu, /*100*/
+ XK_x, XK_X, XK_kana_SA, NoSymbol, /*101*/
+ XK_c, XK_C, XK_kana_SO, NoSymbol, /*102*/
+ XK_v, XK_V, XK_kana_HI, NoSymbol, /*103*/
+ XK_b, XK_B, XK_kana_KO, NoSymbol, /*104*/
+ XK_n, XK_N, XK_kana_MI, NoSymbol, /*105*/
+ XK_m, XK_M, XK_kana_MO, NoSymbol, /*106*/
+ XK_comma, XK_less, XK_kana_NE, XK_kana_comma, /*107*/
+ XK_period, XK_greater, XK_kana_RU, XK_kana_fullstop, /*108*/
+ XK_slash, XK_question, XK_kana_ME, XK_kana_conjunctive, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_backslash, XK_underscore, XK_kana_RO, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ XK_Execute, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ XK_Kanji, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ XK_Henkan_Mode, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, XK_KP_Add, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Japan5Modmap Generic5Modmap
+
+#else
+
+#define Japan5Keymap NULL
+#define Japan5Modmap NULL
+
+#endif /* JAPAN5 */
+
+
+#ifdef KOREA4
+
+static KeySym Korea4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, NoSymbol, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, XK_brokenbar, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+static SunModmapRec Korea4Modmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 119, LockMask,
+ 76, ControlMask,
+ 120, Meta_Mask,
+ 122, Meta_Mask,
+ 111, Mode_switch_Mask,
+ 98, Num_Lock_Mask,
+ 19, Alt_Mask,
+ 0, 0
+};
+
+#else
+
+#define Korea4Keymap NULL
+#define Korea4Modmap NULL
+
+#endif /* KOREA4 */
+
+
+#ifdef KOREA5
+
+static KeySym Korea5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, NoSymbol, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, XK_brokenbar, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Korea5Modmap Generic5Modmap
+
+#else
+
+#define Korea5Keymap NULL
+#define Korea5Modmap NULL
+
+#endif /* KOREA5 */
+
+
+#ifdef NETH4
+
+static KeySym Netherland4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_onesuperior, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_twosuperior, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_threesuperior,NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_onequarter, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_onehalf, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_threequarters,NoSymbol, /* 35*/
+ XK_7, XK_underscore, XK_sterling, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_braceleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_braceright, NoSymbol, /* 38*/
+ XK_0, XK_apostrophe, XK_grave, NoSymbol, /* 39*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /* 40*/
+ XK_degree, SunXK_FA_Tilde, SunXK_FA_Cedilla,NoSymbol, /* 41*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Diaeresis,XK_asciicircum,SunXK_FA_Circum,NoSymbol, /* 64*/
+ XK_asterisk, XK_brokenbar, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, XK_ssharp, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_plus, XK_plusminus, NoSymbol, NoSymbol, /* 86*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 87*/
+ XK_at, XK_section, XK_notsign, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, XK_guillemotleft,NoSymbol, /*100*/
+ XK_X, NoSymbol, XK_guillemotright,NoSymbol, /*101*/
+ XK_C, NoSymbol, XK_cent, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_equal, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_bracketright,XK_bracketleft, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Netherland4Modmap FrBeNeth4Modmap
+
+#else
+
+#define Netherland4Keymap NULL
+#define Netherland4Modmap NULL
+
+#endif /* NETHERLAND4 */
+
+
+#ifdef NETH5
+
+static KeySym Netherland5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_onesuperior, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_twosuperior, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_threesuperior,NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_onequarter, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_onehalf, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_threequarters,NoSymbol, /* 35*/
+ XK_7, XK_underscore, XK_sterling, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_braceleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_braceright, NoSymbol, /* 38*/
+ XK_0, XK_apostrophe, XK_grave, NoSymbol, /* 39*/
+ XK_slash, XK_question, XK_backslash, NoSymbol, /* 40*/
+ XK_degree, SunXK_FA_Tilde, SunXK_FA_Cedilla,NoSymbol, /* 41*/
+ XK_at, XK_section, XK_notsign, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Separator,NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,NoSymbol, NoSymbol, /* 64*/
+ XK_asterisk, XK_bar, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, XK_ssharp, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_plus, XK_plusminus, NoSymbol, NoSymbol, /* 86*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 87*/
+ XK_less, XK_greater, XK_asciicircum, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_z, XK_Z, XK_guillemotleft,NoSymbol, /*100*/
+ XK_x, XK_X, XK_guillemotright,NoSymbol, /*101*/
+ XK_c, XK_C, XK_cent, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_m, XK_M, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, XK_periodcentered,NoSymbol, /*108*/
+ XK_minus, XK_equal, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_bracketright,XK_bracketleft, XK_brokenbar, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Netherland5Modmap Generic5Modmap
+
+#else
+
+#define Netherland5Keymap NULL
+#define Netherland5Modmap NULL
+
+#endif /* NETHERLAND5 */
+
+
+#ifdef NORW4
+
+static KeySym Norway4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_asciitilde, XK_asciicircum, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, NoSymbol, NoSymbol, /* 40*/
+ XK_backslash, SunXK_FA_Grave, SunXK_FA_Acute, NoSymbol, /* 41*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,SunXK_FA_Tilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ooblique, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_AE, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_bar, XK_section, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Norway4Modmap ItNorPortSp4Modmap
+
+#else
+
+#define Norway4Keymap NULL
+#define Norway4Modmap NULL
+
+#endif /* NORWAY4 */
+
+
+#ifdef NORW5
+
+static KeySym Norway5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_asciicircum, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, NoSymbol, NoSymbol, /* 40*/
+ XK_backslash, SunXK_FA_Grave, SunXK_FA_Acute, NoSymbol, /* 41*/
+ XK_bar, XK_section, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Separator,NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,SunXK_FA_Tilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ooblique, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_AE, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Norway5Modmap Generic5Modmap
+
+#else
+
+#define Norway5Keymap NULL
+#define Norway5Modmap NULL
+
+#endif /* NORWAY5 */
+
+
+#ifdef PORT4
+
+static KeySym Portugal4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_bracketright,XK_braceright, XK_guillemotright,NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, XK_Break, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_section, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_notsign, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_backslash, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_bar, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_exclamdown, XK_questiondown,NoSymbol, NoSymbol, /* 41*/
+ SunXK_FA_Tilde, SunXK_FA_Circum,XK_asciicircum, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Diaeresis,XK_asterisk, XK_plus, NoSymbol, /* 64*/
+ SunXK_FA_Acute, SunXK_FA_Grave, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ccedilla, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_masculine, XK_ordfeminine, NoSymbol, NoSymbol, /* 87*/
+ XK_bracketleft, XK_braceleft, XK_guillemotleft,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Portugal4Modmap ItNorPortSp4Modmap
+
+#else
+
+#define Portugal4Keymap NULL
+#define Portugal4Modmap NULL
+
+#endif /* PORTUGAL4 */
+
+
+#ifdef PORT5
+
+static KeySym Portugal5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_section, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_asciicircum, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_guillemotleft,XK_guillemotright,NoSymbol, NoSymbol, /* 41*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_plus, XK_asterisk, SunXK_FA_Diaeresis,NoSymbol, /* 64*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ccedilla, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_masculine, XK_ordfeminine, NoSymbol, NoSymbol, /* 87*/
+ SunXK_FA_Tilde, SunXK_FA_Circum,NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Portugal5Modmap Generic5Modmap
+
+#else
+
+#define Portugal5Keymap NULL
+#define Portugal5Modmap NULL
+
+#endif /* PORTUGAL5 */
+
+
+#ifdef SPAIN5
+
+static KeySym Spain5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_bar, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_periodcentered,XK_numbersign,NoSymbol, /* 32*/
+ XK_4, XK_dollar, XK_asciicircum, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_notsign, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_equal, NoSymbol, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_exclamdown, XK_questiondown,NoSymbol, NoSymbol, /* 41*/
+ XK_masculine, XK_ordfeminine, XK_backslash, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Grave, SunXK_FA_Circum,XK_bracketleft, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_bracketright,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ntilde, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ SunXK_FA_Acute, SunXK_FA_Diaeresis,XK_braceleft,NoSymbol, /* 87*/
+ XK_ccedilla, XK_Ccedilla, XK_braceright, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Spain5Modmap Generic5Modmap
+
+#else
+
+#define Spain5Keymap NULL
+#define Spain5Modmap NULL
+
+#endif /* SPAIN5 */
+
+
+#ifdef SPAINLATAM4
+
+static KeySym SpainLatAm4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_bracketright,XK_braceright, XK_guillemotright,NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Scroll_Lock, NoSymbol, XK_R3, XK_Break, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_periodcentered,XK_numbersign,NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_degree, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_notsign, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_backslash, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_bar, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ XK_exclamdown, XK_questiondown,NoSymbol, NoSymbol, /* 41*/
+ XK_Ccedilla, NoSymbol, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, XK_masculine, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ SunXK_FA_Grave, SunXK_FA_Circum,XK_asciicircum, NoSymbol, /* 64*/
+ XK_plus, XK_asterisk, XK_asciitilde, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, XK_ordfeminine, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Ntilde, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ SunXK_FA_Acute, SunXK_FA_Diaeresis,NoSymbol, NoSymbol, /* 87*/
+ XK_bracketleft, XK_braceleft, XK_guillemotleft,NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SpainLatAm4Modmap ItNorPortSp4Modmap
+
+#else
+
+#define SpainLatAm4Keymap NULL
+#define SpainLatAm4Modmap NULL
+
+#endif /* SPAINLATAM4 */
+
+
+#ifdef SWED5
+
+static KeySym Sweden5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, XK_backslash, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_section, XK_onehalf, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Separator,NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,XK_asciicircum,XK_asciitilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Odiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Adiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_bar, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Sweden5Modmap Generic5Modmap
+
+#else
+
+#define Sweden5Keymap NULL
+#define Sweden5Modmap NULL
+
+#endif /* SWEDEN5 */
+
+
+#ifdef SWEDFIN4
+
+static KeySym SwedenFin4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_asciitilde, XK_asciicircum, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, XK_sterling, NoSymbol, /* 32*/
+ XK_4, XK_currency, XK_dollar, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_braceleft, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_bracketleft, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_bracketright,NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_braceright, NoSymbol, /* 39*/
+ XK_plus, XK_question, XK_backslash, NoSymbol, /* 40*/
+ SunXK_FA_Acute, SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_apostrophe, XK_asterisk, XK_grave, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_Aring, NoSymbol, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Circum,SunXK_FA_Tilde,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R8, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_Odiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 86*/
+ XK_Adiaeresis, NoSymbol, NoSymbol, NoSymbol, /* 87*/
+ XK_section, XK_onehalf, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_bar, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SwedenFin4Modmap DenSwedFinSw4Modmap
+
+#else
+
+#define SwedenFin4Keymap NULL
+#define SwedenFin4Modmap NULL
+
+#endif /* SWEDENFIN4 */
+
+
+#ifdef SWFR4
+
+static KeySym SwissFr4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_greater, XK_braceright, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_plus, XK_exclam, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_asterisk, XK_numbersign, NoSymbol, /* 32*/
+ XK_4, XK_ccedilla, XK_cent, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_section, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_bar, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_degree, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_backslash, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_asciicircum, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ SunXK_FA_Circum,SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_dollar, SunXK_FA_Tilde, XK_sterling, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_egrave, XK_udiaeresis, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Acute,NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_eacute, XK_odiaeresis, NoSymbol, NoSymbol, /* 86*/
+ XK_agrave, XK_adiaeresis, NoSymbol, NoSymbol, /* 87*/
+ XK_less, XK_braceleft, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_bracketright,XK_bracketleft, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SwissFr4Modmap DenSwedFinSw4Modmap
+
+#else
+
+#define SwissFr4Keymap NULL
+#define SwissFr4Modmap NULL
+
+#endif /* SWFR4 */
+
+
+#ifdef SWFR5
+
+static KeySym SwissFr5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_plus, XK_bar, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_asterisk, XK_numbersign, NoSymbol, /* 32*/
+ XK_4, XK_ccedilla, XK_asciicircum, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_grave, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, SunXK_FA_Acute, NoSymbol, /* 40*/
+ SunXK_FA_Circum,SunXK_FA_Grave, SunXK_FA_Tilde, NoSymbol, /* 41*/
+ XK_section, XK_degree, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_egrave, XK_udiaeresis, XK_bracketleft, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,XK_exclam, XK_bracketright,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_eacute, XK_odiaeresis, NoSymbol, NoSymbol, /* 86*/
+ XK_agrave, XK_adiaeresis, XK_braceleft, NoSymbol, /* 87*/
+ XK_dollar, XK_sterling, XK_braceright, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_backslash, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SwissFr5Modmap Generic5Modmap
+
+#else
+
+#define SwissFr5Keymap NULL
+#define SwissFr5Modmap NULL
+
+#endif /* SWFR5 */
+
+
+#ifdef SWGE4
+
+static KeySym SwissGe4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ XK_greater, XK_braceright, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_plus, XK_exclam, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_asterisk, XK_numbersign, NoSymbol, /* 32*/
+ XK_4, XK_ccedilla, XK_cent, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, XK_section, NoSymbol, /* 35*/
+ XK_7, XK_slash, XK_bar, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, XK_degree, NoSymbol, /* 37*/
+ XK_9, XK_parenright, XK_backslash, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_asciicircum, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, XK_grave, NoSymbol, /* 40*/
+ SunXK_FA_Circum,SunXK_FA_Grave, NoSymbol, NoSymbol, /* 41*/
+ XK_dollar, SunXK_FA_Tilde, XK_sterling, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_udiaeresis, XK_egrave, NoSymbol, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,SunXK_FA_Acute,NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_odiaeresis, XK_eacute, NoSymbol, NoSymbol, /* 86*/
+ XK_adiaeresis, XK_agrave, NoSymbol, NoSymbol, /* 87*/
+ XK_less, XK_braceleft, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, XK_mu, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_bracketright,XK_bracketleft, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SwissGe4Modmap DenSwedFinSw4Modmap
+
+#else
+
+#define SwissGe4Keymap NULL
+#define SwissGe4Modmap NULL
+
+#endif /* SWISSGE4 */
+
+
+#ifdef SWGE5
+
+static KeySym SwissGe5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_plus, XK_bar, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, XK_at, NoSymbol, /* 31*/
+ XK_3, XK_asterisk, XK_numbersign, NoSymbol, /* 32*/
+ XK_4, XK_ccedilla, XK_asciicircum, NoSymbol, /* 33*/
+ XK_5, XK_percent, XK_asciitilde, NoSymbol, /* 34*/
+ XK_6, XK_ampersand, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_slash, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_parenleft, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenright, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_equal, XK_grave, NoSymbol, /* 39*/
+ XK_apostrophe, XK_question, SunXK_FA_Acute, NoSymbol, /* 40*/
+ SunXK_FA_Circum,SunXK_FA_Grave, SunXK_FA_Tilde, NoSymbol, /* 41*/
+ XK_section, XK_degree, NoSymbol, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_udiaeresis, XK_egrave, XK_bracketleft, NoSymbol, /* 64*/
+ SunXK_FA_Diaeresis,XK_exclam, XK_bracketright,NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_odiaeresis, XK_eacute, NoSymbol, NoSymbol, /* 86*/
+ XK_adiaeresis, XK_agrave, XK_braceleft, NoSymbol, /* 87*/
+ XK_dollar, XK_sterling, XK_braceright, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_semicolon, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_colon, NoSymbol, NoSymbol, /*108*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_less, XK_greater, XK_backslash, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define SwissGe5Modmap Generic5Modmap
+
+#else
+
+#define SwissGe5Keymap NULL
+#define SwissGe5Modmap NULL
+
+#endif /* SWITZER_GE5 */
+
+
+#ifdef TAI4
+
+static KeySym Taiwan4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, NoSymbol, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, XK_brokenbar, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Taiwan4Modmap Generic5Modmap
+
+#else
+
+#define Taiwan4Keymap NULL
+#define Taiwan4Modmap NULL
+
+#endif /* TAIWAN4 */
+
+
+#ifdef TAI5
+
+static KeySym Taiwan5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, NoSymbol, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, XK_brokenbar, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define Taiwan5Modmap Generic5Modmap
+
+#else
+
+#define Taiwan5Keymap NULL
+#define Taiwan5Modmap NULL
+
+#endif /* TAIWAN5 */
+
+
+#ifdef UK4
+
+static KeySym UK4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, XK_brokenbar, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_sterling, XK_numbersign, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, XK_notsign, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, XK_acute, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define UK4Modmap Generic5Modmap
+
+#else
+
+#define UK4Keymap NULL
+#define UK4Modmap NULL
+
+#endif /* UK4 */
+
+
+#ifdef UK5
+
+static KeySym UK5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_quotedbl, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_sterling, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_notsign, XK_brokenbar, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_at, XK_acute, NoSymbol, /* 87*/
+ XK_numbersign, XK_asciitilde, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define UK5Modmap Generic5Modmap
+
+#else
+
+#define UK5Keymap NULL
+#define UK5Modmap NULL
+
+#endif /* UK5 */
+
+
+#ifdef US101A
+
+static KeySym US101AKeymap[] = {
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 25*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 72*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, XK_acute, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+static SunModmapRec US101AModmap[] = {
+ 99, ShiftMask,
+ 110, ShiftMask,
+ 119, LockMask,
+ 76, ControlMask,
+ 122, Meta_Mask,
+ 98, Num_Lock_Mask,
+ 120, Alt_Mask,
+ 0, 0
+};
+
+#else
+
+#define US101AKeymap NULL
+#define US101AModmap NULL
+
+#endif /* US101A */
+
+
+#ifdef US4
+
+static KeySym US4Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_R1, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_R2, NoSymbol, /* 22*/
+ XK_Break, XK_Scroll_Lock, XK_R3, NoSymbol, /* 23*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ XK_KP_Equal, NoSymbol, XK_R4, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, XK_R5, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, XK_R6, NoSymbol, /* 47*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, XK_R7, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, XK_R8, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, XK_R9, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, XK_acute, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, XK_R10, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, XK_R11, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, XK_R12, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ XK_Linefeed, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, XK_R13, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, XK_R14, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, XK_R15, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, XK_Help, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define US4Modmap Generic5Modmap
+
+#else
+
+#define US4Keymap NULL
+#define US4Modmap NULL
+
+#endif /* US4 */
+
+
+#ifdef US5
+
+static KeySym US5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, XK_acute, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define US5Modmap Generic5Modmap
+
+#else
+
+#define US5Keymap NULL
+#define US5Modmap NULL
+
+#endif /* US5 */
+
+#ifdef US_UNIX5
+
+static KeySym US_UNIX5Keymap[] = {
+ SunXK_Stop, NoSymbol, XK_L1, NoSymbol, /* 1*/
+ SunXK_AudioLowerVolume,SunXK_VideoLowerBrightness,NoSymbol, NoSymbol, /* 2*/
+ SunXK_Again, NoSymbol, XK_L2, NoSymbol, /* 3*/
+ SunXK_AudioRaiseVolume,SunXK_VideoRaiseBrightness,NoSymbol, NoSymbol, /* 4*/
+ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* 5*/
+ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* 6*/
+ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* 7*/
+ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* 8*/
+ XK_F11, NoSymbol, SunXK_F36, NoSymbol, /* 9*/
+ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* 10*/
+ XK_F12, NoSymbol, SunXK_F37, NoSymbol, /* 11*/
+ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* 12*/
+ SunXK_AltGraph, NoSymbol, NoSymbol, NoSymbol, /* 13*/
+ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* 14*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 15*/
+ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* 16*/
+ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* 17*/
+ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* 18*/
+ XK_Alt_L, NoSymbol, NoSymbol, NoSymbol, /* 19*/
+ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* 20*/
+ XK_Pause, NoSymbol, XK_Break, NoSymbol, /* 21*/
+ XK_Print, NoSymbol, XK_Sys_Req, SunXK_Sys_Req, /* 22*/
+ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* 23*/
+ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* 24*/
+ SunXK_Props, NoSymbol, XK_L3, NoSymbol, /* 25*/
+ SunXK_Undo, NoSymbol, XK_L4, NoSymbol, /* 26*/
+ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* 27*/
+ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* 28*/
+ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* 29*/
+ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 30*/
+ XK_2, XK_at, NoSymbol, NoSymbol, /* 31*/
+ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 32*/
+ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 33*/
+ XK_5, XK_percent, NoSymbol, NoSymbol, /* 34*/
+ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 35*/
+ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 36*/
+ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 37*/
+ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 38*/
+ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 39*/
+ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 40*/
+ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 41*/
+ XK_grave, XK_asciitilde, XK_acute, NoSymbol, /* 42*/
+ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* 43*/
+ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* 44*/
+ SunXK_AudioMute,SunXK_VideoDegauss,NoSymbol, NoSymbol, /* 45*/
+ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* 46*/
+ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* 47*/
+ SunXK_PowerSwitch,SunXK_PowerSwitchShift, NoSymbol, NoSymbol, /* 48*/
+ SunXK_Front, NoSymbol, XK_L5, NoSymbol, /* 49*/
+ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, /* 50*/
+ SunXK_Copy, NoSymbol, XK_L6, NoSymbol, /* 51*/
+ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* 52*/
+ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* 53*/
+ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 54*/
+ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 55*/
+ XK_E, NoSymbol, NoSymbol, NoSymbol, /* 56*/
+ XK_R, NoSymbol, NoSymbol, NoSymbol, /* 57*/
+ XK_T, NoSymbol, NoSymbol, NoSymbol, /* 58*/
+ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* 59*/
+ XK_U, NoSymbol, NoSymbol, NoSymbol, /* 60*/
+ XK_I, NoSymbol, NoSymbol, NoSymbol, /* 61*/
+ XK_O, NoSymbol, NoSymbol, NoSymbol, /* 62*/
+ XK_P, NoSymbol, NoSymbol, NoSymbol, /* 63*/
+ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* 64*/
+ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, /* 65*/
+ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* 66*/
+ SunXK_Compose, NoSymbol, NoSymbol, NoSymbol, /* 67*/
+ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* 68*/
+ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* 69*/
+ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, /* 70*/
+ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* 71*/
+ SunXK_Open, NoSymbol, XK_L7, NoSymbol, /* 72*/
+ SunXK_Paste, NoSymbol, XK_L8, NoSymbol, /* 73*/
+ XK_End, NoSymbol, NoSymbol, NoSymbol, /* 74*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 75*/
+ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* 76*/
+ XK_A, NoSymbol, NoSymbol, NoSymbol, /* 77*/
+ XK_S, NoSymbol, NoSymbol, NoSymbol, /* 78*/
+ XK_D, NoSymbol, NoSymbol, NoSymbol, /* 79*/
+ XK_F, NoSymbol, NoSymbol, NoSymbol, /* 80*/
+ XK_G, NoSymbol, NoSymbol, NoSymbol, /* 81*/
+ XK_H, NoSymbol, NoSymbol, NoSymbol, /* 82*/
+ XK_J, NoSymbol, NoSymbol, NoSymbol, /* 83*/
+ XK_K, NoSymbol, NoSymbol, NoSymbol, /* 84*/
+ XK_L, NoSymbol, NoSymbol, NoSymbol, /* 85*/
+ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* 86*/
+ XK_apostrophe, XK_quotedbl, XK_acute, NoSymbol, /* 87*/
+ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 88*/
+ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* 89*/
+ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, /* 90*/
+ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* 91*/
+ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 92*/
+ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, /* 93*/
+ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* 94*/
+ SunXK_Find, NoSymbol, XK_L9, NoSymbol, /* 95*/
+ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* 96*/
+ SunXK_Cut, NoSymbol, XK_L10, NoSymbol, /* 97*/
+ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* 98*/
+ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* 99*/
+ XK_Z, NoSymbol, NoSymbol, NoSymbol, /*100*/
+ XK_X, NoSymbol, NoSymbol, NoSymbol, /*101*/
+ XK_C, NoSymbol, NoSymbol, NoSymbol, /*102*/
+ XK_V, NoSymbol, NoSymbol, NoSymbol, /*103*/
+ XK_B, NoSymbol, NoSymbol, NoSymbol, /*104*/
+ XK_N, NoSymbol, NoSymbol, NoSymbol, /*105*/
+ XK_M, NoSymbol, NoSymbol, NoSymbol, /*106*/
+ XK_comma, XK_less, NoSymbol, NoSymbol, /*107*/
+ XK_period, XK_greater, NoSymbol, NoSymbol, /*108*/
+ XK_slash, XK_question, NoSymbol, NoSymbol, /*109*/
+ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /*110*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*111*/
+ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /*112*/
+ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /*113*/
+ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, /*114*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*115*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*116*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*117*/
+ XK_Help, NoSymbol, NoSymbol, NoSymbol, /*118*/
+ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /*119*/
+ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /*120*/
+ XK_space, NoSymbol, NoSymbol, NoSymbol, /*121*/
+ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /*122*/
+ XK_Next, NoSymbol, NoSymbol, NoSymbol, /*123*/
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*124*/
+ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /*125*/
+};
+
+#define US_UNIX5Modmap Generic5Modmap
+
+#else
+
+#define US_UNIX5Keymap NULL
+#define US_UNIX5Modmap NULL
+
+#endif /* US_UNIX5 */
+
+KeySym *sunType4KeyMaps[] = {
+ US4Keymap, /* 0 */
+ US4Keymap, /* 1 */
+ FranceBelg4Keymap, /* 2 */
+ Canada4Keymap, /* 3 */
+ Denmark4Keymap, /* 4 */
+ Germany4Keymap, /* 5 */
+ Italy4Keymap, /* 6 */
+ Netherland4Keymap, /* 7 */
+ Norway4Keymap, /* 8 */
+ Portugal4Keymap, /* 9 */
+ SpainLatAm4Keymap, /* 10 */
+ SwedenFin4Keymap, /* 11 */
+ SwissFr4Keymap, /* 12 */
+ SwissGe4Keymap, /* 13 */
+ UK4Keymap, /* 14 */
+ NULL, /* 15 */
+ Korea4Keymap, /* 16 */
+ Taiwan4Keymap, /* 17 */
+ NULL, /* 18 */
+ US101AKeymap, /* 19 */
+ NULL, /* 20 */
+ NULL, /* 21 */
+ NULL, /* 22 */
+ NULL, /* 23 */
+ NULL, /* 24 */
+ NULL, /* 25 */
+ NULL, /* 26 */
+ NULL, /* 27 */
+ NULL, /* 28 */
+ NULL, /* 29 */
+ NULL, /* 30 */
+ NULL, /* 31 */
+ Japan4Keymap, /* 32 */
+ US5Keymap, /* 33 */
+ US_UNIX5Keymap, /* 34 */
+ France5Keymap, /* 35 */
+ Denmark5Keymap, /* 36 */
+ Germany5Keymap, /* 37 */
+ Italy5Keymap, /* 38 */
+ Netherland5Keymap, /* 39 */
+ Norway5Keymap, /* 40 */
+ Portugal5Keymap, /* 41 */
+ Spain5Keymap, /* 42 */
+ Sweden5Keymap, /* 43 */
+ SwissFr5Keymap, /* 44 */
+ SwissGe5Keymap, /* 45 */
+ UK5Keymap, /* 46 */
+ Korea5Keymap, /* 47 */
+ Taiwan5Keymap, /* 48 */
+ Japan5Keymap, /* 49 */
+ CanadaFr5Keymap, /* 50 */
+ NULL, /* Hungary5 */ /* 51 */
+ NULL, /* Poland5 */ /* 52 */
+ NULL, /* Czech5 */ /* 53 */
+ NULL, /* Russia5 */ /* 54 */
+ NULL, /* 55 */
+ NULL, /* 56 */
+ NULL, /* 57 */
+ NULL, /* 58 */
+ NULL, /* 59 */
+ NULL, /* 60 */
+ NULL, /* 61 */
+ NULL, /* 62 */
+ NULL, /* CanadaFr5+ */ /* 63 */
+ NULL, /* 64 */
+ NULL, /* 65 */
+ NULL, /* 66 */
+ NULL, /* 67 */
+ NULL, /* 68 */
+ NULL, /* 69 */
+ NULL, /* 70 */
+ NULL, /* 71 */
+ NULL, /* 72 */
+ NULL, /* 73 */
+ NULL, /* 74 */
+ NULL, /* 75 */
+ NULL, /* 76 */
+ NULL, /* 77 */
+ NULL, /* 78 */
+ NULL, /* 79 */
+/*
+ * We're punting on SPARC Voyager support for now. The OpenLook server
+ * apparently adds special semantics to Num_Lock, which requires indexing
+ * into column 5 of the keymap, which isn't handled by the core protocol
+ * at all, (it is in XKB.) We could do some tricky remapping, sort of
+ * like what the PC ddxen need to do to deal with funky PC keyboards; but
+ * for now we'll just pretend that Voyager (Hobo) keyboards are the same
+ * as the equivalent Sun5 keyboard.
+ */
+ US5Keymap, /* 80 */
+ US_UNIX5Keymap, /* 81 */
+ France5Keymap, /* 82 */
+ Denmark5Keymap, /* 83 */
+ Germany5Keymap, /* 84 */
+ Italy5Keymap, /* 85 */
+ Netherland5Keymap, /* 86 */
+ Norway5Keymap, /* 87 */
+ Portugal5Keymap, /* 88 */
+ Spain5Keymap, /* 89 */
+ Sweden5Keymap, /* 90 */
+ SwissFr5Keymap, /* 91 */
+ SwissGe5Keymap, /* 92 */
+ UK5Keymap, /* 93 */
+ Korea5Keymap, /* 94 */
+ Taiwan5Keymap, /* 95 */
+ Japan5Keymap, /* 96 */
+ CanadaFr5Keymap, /* 97 */
+};
+
+int sunMaxLayout = sizeof sunType4KeyMaps / sizeof sunType4KeyMaps[0];
+
+SunModmapRec *sunType4ModMaps[] = {
+ US4Modmap, /* 0 */
+ US4Modmap, /* 1 */
+ FranceBelg4Modmap, /* 2 */
+ Canada4Modmap, /* 3 */
+ Denmark4Modmap, /* 4 */
+ Germany4Modmap, /* 5 */
+ Italy4Modmap, /* 6 */
+ Netherland4Modmap, /* 7 */
+ Norway4Modmap, /* 8 */
+ Portugal4Modmap, /* 9 */
+ SpainLatAm4Modmap, /* 10 */
+ SwedenFin4Modmap, /* 11 */
+ SwissFr4Modmap, /* 12 */
+ SwissGe4Modmap, /* 13 */
+ UK4Modmap, /* 14 */
+ NULL, /* 15 */
+ Korea4Modmap, /* 16 */
+ Taiwan4Modmap, /* 17 */
+ NULL, /* 18 */
+ US101AModmap, /* 19 */
+ NULL, /* 20 */
+ NULL, /* 21 */
+ NULL, /* 22 */
+ NULL, /* 23 */
+ NULL, /* 24 */
+ NULL, /* 25 */
+ NULL, /* 26 */
+ NULL, /* 27 */
+ NULL, /* 28 */
+ NULL, /* 29 */
+ NULL, /* 30 */
+ NULL, /* 31 */
+ Japan4Modmap, /* 32 */
+ US5Modmap, /* 33 */
+ US_UNIX5Modmap, /* 34 */
+ France5Modmap, /* 35 */
+ Denmark5Modmap, /* 36 */
+ Germany5Modmap, /* 37 */
+ Italy5Modmap, /* 38 */
+ Netherland5Modmap, /* 39 */
+ Norway5Modmap, /* 40 */
+ Portugal5Modmap, /* 41 */
+ Spain5Modmap, /* 42 */
+ Sweden5Modmap, /* 43 */
+ SwissFr5Modmap, /* 44 */
+ SwissGe5Modmap, /* 45 */
+ UK5Modmap, /* 46 */
+ Korea5Modmap, /* 47 */
+ Taiwan5Modmap, /* 48 */
+ Japan5Modmap, /* 49 */
+ CanadaFr5Modmap, /* 50 */
+ NULL, /* Hungary5 */ /* 51 */
+ NULL, /* Poland5 */ /* 52 */
+ NULL, /* Czech5 */ /* 53 */
+ NULL, /* Russia5 */ /* 54 */
+ NULL, /* 55 */
+ NULL, /* 56 */
+ NULL, /* 57 */
+ NULL, /* 58 */
+ NULL, /* 59 */
+ NULL, /* 60 */
+ NULL, /* 61 */
+ NULL, /* 62 */
+ NULL, /* CanadaFr5+ */ /* 63 */
+ NULL, /* 64 */
+ NULL, /* 65 */
+ NULL, /* 66 */
+ NULL, /* 67 */
+ NULL, /* 68 */
+ NULL, /* 69 */
+ NULL, /* 70 */
+ NULL, /* 71 */
+ NULL, /* 72 */
+ NULL, /* 73 */
+ NULL, /* 74 */
+ NULL, /* 75 */
+ NULL, /* 76 */
+ NULL, /* 77 */
+ NULL, /* 78 */
+ NULL, /* 79 */
+ US5Modmap, /* 80 */
+ US_UNIX5Modmap, /* 81 */
+ France5Modmap, /* 82 */
+ Denmark5Modmap, /* 83 */
+ Germany5Modmap, /* 84 */
+ Italy5Modmap, /* 85 */
+ Netherland5Modmap, /* 86 */
+ Norway5Modmap, /* 87 */
+ Portugal5Modmap, /* 88 */
+ Spain5Modmap, /* 89 */
+ Sweden5Modmap, /* 90 */
+ SwissFr5Modmap, /* 91 */
+ SwissGe5Modmap, /* 92 */
+ UK5Modmap, /* 93 */
+ Korea5Modmap, /* 94 */
+ Taiwan5Modmap, /* 95 */
+ Japan5Modmap, /* 96 */
+ CanadaFr5Modmap, /* 97 */
+};
diff --git a/xc/programs/Xserver/hw/sun/sunMfb.c b/xc/programs/Xserver/hw/sun/sunMfb.c
new file mode 100644
index 000000000..88aa77305
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunMfb.c
@@ -0,0 +1,104 @@
+
+/* $TOG: sunMfb.c /main/6 1998/02/10 13:17:17 kaleb $ */
+
+/*
+Copyright 1990, 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+/* $XFree86: xc/programs/Xserver/hw/sun/sunMfb.c,v 3.2 1998/10/04 09:38:38 dawes Exp $ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#include "sun.h"
+#include "mfb.h"
+
+Bool sunBW2Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ if (sunFlipPixels) {
+ pScreen->whitePixel = 1;
+ pScreen->blackPixel = 0;
+ } else {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ }
+ return sunInitCommon (screen, pScreen, (off_t) 0,
+ mfbScreenInit, NULL,
+ mfbCreateDefColormap, sunSaveScreen, 0);
+}
+
diff --git a/xc/programs/Xserver/hw/sun/sunMouse.c b/xc/programs/Xserver/hw/sun/sunMouse.c
new file mode 100644
index 000000000..2ac0329b5
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunMouse.c
@@ -0,0 +1,424 @@
+/* $TOG: sunMouse.c /main/37 1998/02/10 13:17:21 kaleb $ */
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+Bool sunActiveZaphod = TRUE;
+
+static Bool sunCursorOffScreen();
+static void sunCrossScreen();
+static void sunWarpCursor();
+
+miPointerScreenFuncRec sunPointerScreenFuncs = {
+ sunCursorOffScreen,
+ sunCrossScreen,
+ sunWarpCursor,
+};
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseCtrl --
+ * Alter the control parameters for the mouse. Since acceleration
+ * etc. is done from the PtrCtrl record in the mouse's device record,
+ * there's nothing to do here.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+static
+#if NeedFunctionPrototypes
+void sunMouseCtrl (
+ DeviceIntPtr device,
+ PtrCtrl* ctrl)
+#else
+void sunMouseCtrl (device, ctrl)
+ DeviceIntPtr device;
+ PtrCtrl* ctrl;
+#endif
+{
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseProc --
+ * Handle the initialization, etc. of a mouse
+ *
+ * Results:
+ * none.
+ *
+ * Side Effects:
+ *
+ * Note:
+ * When using sunwindows, all input comes off a single fd, stored in the
+ * global windowFd. Therefore, only one device should be enabled and
+ * disabled, even though the application still sees both mouse and
+ * keyboard. We have arbitrarily chosen to enable and disable windowFd
+ * in the keyboard routine sunKbdProc rather than in sunMouseProc.
+ *
+ *-----------------------------------------------------------------------
+ */
+#if NeedFunctionPrototypes
+int sunMouseProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunMouseProc (device, what)
+ DeviceIntPtr device; /* Mouse to play with */
+ int what; /* What to do with it */
+#endif
+{
+ DevicePtr pMouse = (DevicePtr) device;
+ int format;
+ static int oformat;
+ BYTE map[4];
+ char *dev;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pMouse != LookupPointerDevice()) {
+ ErrorF ("Cannot open non-system mouse");
+ return !Success;
+ }
+ if (sunPtrPriv.fd == -1)
+ return !Success;
+ pMouse->devicePrivate = (pointer) &sunPtrPriv;
+ pMouse->on = FALSE;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ InitPointerDeviceStruct(
+ pMouse, map, 3, miPointerGetMotionEvents,
+ sunMouseCtrl, miPointerGetMotionBufferSize());
+ break;
+
+ case DEVICE_ON:
+ if (ioctl (sunPtrPriv.fd, VUIDGFORMAT, &oformat) == -1) {
+ Error ("sunMouseProc ioctl VUIDGFORMAT");
+ return !Success;
+ }
+ format = VUID_FIRM_EVENT;
+ if (ioctl (sunPtrPriv.fd, VUIDSFORMAT, &format) == -1) {
+ Error ("sunMouseProc ioctl VUIDSFORMAT");
+ return !Success;
+ }
+ sunPtrPriv.bmask = 0;
+ AddEnabledDevice (sunPtrPriv.fd);
+ pMouse->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ pMouse->on = FALSE;
+ if (ioctl (sunPtrPriv.fd, VUIDSFORMAT, &oformat) == -1)
+ Error ("sunMouseProc ioctl VUIDSFORMAT");
+ break;
+
+ case DEVICE_OFF:
+ pMouse->on = FALSE;
+ RemoveEnabledDevice (sunPtrPriv.fd);
+ break;
+ }
+ return Success;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseGetEvents --
+ * Return the events waiting in the wings for the given mouse.
+ *
+ * Results:
+ * A pointer to an array of Firm_events or (Firm_event *)0 if no events
+ * The number of events contained in the array.
+ * A boolean as to whether more events might be available.
+ *
+ * Side Effects:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+Firm_event* sunMouseGetEvents (
+ int fd,
+ Bool on,
+ int* pNumEvents,
+ Bool* pAgain)
+#else
+Firm_event* sunMouseGetEvents (fd, on, pNumEvents, pAgain)
+ int fd;
+ Bool on;
+ int* pNumEvents;
+ Bool* pAgain;
+#endif
+{
+ int nBytes; /* number of bytes of events available. */
+ static Firm_event evBuf[MAXEVENTS]; /* Buffer for Firm_events */
+
+ if ((nBytes = read (fd, (char *)evBuf, sizeof(evBuf))) == -1) {
+ if (errno == EWOULDBLOCK) {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ } else {
+ Error ("sunMouseGetEvents read");
+ FatalError ("Could not read from mouse");
+ }
+ } else {
+ if (on) {
+ *pNumEvents = nBytes / sizeof (Firm_event);
+ *pAgain = (nBytes == sizeof (evBuf));
+ } else {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ }
+ }
+ return evBuf;
+}
+
+
+/*-
+ *-----------------------------------------------------------------------
+ * MouseAccelerate --
+ * Given a delta and a mouse, return the acceleration of the delta.
+ *
+ * Results:
+ * The corrected delta
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+static short
+MouseAccelerate (device, delta)
+ DeviceIntPtr device;
+ int delta;
+{
+ int sgn = sign(delta);
+ PtrCtrl *pCtrl;
+ short ret;
+
+ delta = abs(delta);
+ pCtrl = &device->ptrfeed->ctrl;
+ if (delta > pCtrl->threshold) {
+ ret =
+ (short) sgn *
+ (pCtrl->threshold + ((delta - pCtrl->threshold) * pCtrl->num) /
+ pCtrl->den);
+ } else {
+ ret = (short) sgn * delta;
+ }
+ return ret;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseEnqueueEvent --
+ * Given a Firm_event for a mouse, pass it off the the dix layer
+ * properly converted...
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * The cursor may be redrawn...? devPrivate/x/y will be altered.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+void sunMouseEnqueueEvent (
+ DeviceIntPtr device,
+ Firm_event *fe)
+#else
+void sunMouseEnqueueEvent (device, fe)
+ DeviceIntPtr device; /* Mouse from which the event came */
+ Firm_event *fe; /* Event to process */
+#endif
+{
+ xEvent xE;
+ sunPtrPrivPtr pPriv; /* Private data for pointer */
+ int bmask; /* Temporary button mask */
+ unsigned long time;
+ int x, y;
+
+ pPriv = (sunPtrPrivPtr)device->public.devicePrivate;
+
+ time = xE.u.keyButtonPointer.time = TVTOMILLI(fe->time);
+
+ switch (fe->id) {
+ case MS_LEFT:
+ case MS_MIDDLE:
+ case MS_RIGHT:
+ /*
+ * A button changed state. Sometimes we will get two events
+ * for a single state change. Should we get a button event which
+ * reflects the current state of affairs, that event is discarded.
+ *
+ * Mouse buttons start at 1.
+ */
+ xE.u.u.detail = (fe->id - MS_LEFT) + 1;
+ bmask = 1 << xE.u.u.detail;
+ if (fe->value == VKEY_UP) {
+ if (pPriv->bmask & bmask) {
+ xE.u.u.type = ButtonRelease;
+ pPriv->bmask &= ~bmask;
+ } else {
+ return;
+ }
+ } else {
+ if ((pPriv->bmask & bmask) == 0) {
+ xE.u.u.type = ButtonPress;
+ pPriv->bmask |= bmask;
+ } else {
+ return;
+ }
+ }
+ mieqEnqueue (&xE);
+ break;
+ case LOC_X_DELTA:
+ miPointerDeltaCursor (MouseAccelerate(device,fe->value),0,time);
+ break;
+ case LOC_Y_DELTA:
+ /*
+ * For some reason, motion up generates a positive y delta
+ * and motion down a negative delta, so we must subtract
+ * here instead of add...
+ */
+ miPointerDeltaCursor (0,-MouseAccelerate(device,fe->value),time);
+ break;
+ case LOC_X_ABSOLUTE:
+ miPointerPosition (&x, &y);
+ miPointerAbsoluteCursor (fe->value, y, time);
+ break;
+ case LOC_Y_ABSOLUTE:
+ miPointerPosition (&x, &y);
+ miPointerAbsoluteCursor (x, fe->value, time);
+ break;
+ default:
+ FatalError ("sunMouseEnqueueEvent: unrecognized id\n");
+ break;
+ }
+}
+
+/*ARGSUSED*/
+static Bool
+sunCursorOffScreen (pScreen, x, y)
+ ScreenPtr *pScreen;
+ int *x, *y;
+{
+ int index, ret = FALSE;
+ extern Bool PointerConfinedToScreen();
+
+ if (PointerConfinedToScreen()) return TRUE;
+ /*
+ * Active Zaphod implementation:
+ * increment or decrement the current screen
+ * if the x is to the right or the left of
+ * the current screen.
+ */
+ if (sunActiveZaphod &&
+ screenInfo.numScreens > 1 && (*x >= (*pScreen)->width || *x < 0)) {
+ index = (*pScreen)->myNum;
+ if (*x < 0) {
+ index = (index ? index : screenInfo.numScreens) - 1;
+ *pScreen = screenInfo.screens[index];
+ *x += (*pScreen)->width;
+ } else {
+ *x -= (*pScreen)->width;
+ index = (index + 1) % screenInfo.numScreens;
+ *pScreen = screenInfo.screens[index];
+ }
+ ret = TRUE;
+ }
+ return ret;
+}
+
+static void
+sunCrossScreen (pScreen, entering)
+ ScreenPtr pScreen;
+ Bool entering;
+{
+ if (sunFbs[pScreen->myNum].EnterLeave)
+ (*sunFbs[pScreen->myNum].EnterLeave) (pScreen, entering ? 0 : 1);
+}
+
+static void
+sunWarpCursor (pScreen, x, y)
+ ScreenPtr pScreen;
+ int x, y;
+{
+#ifndef i386
+ sigset_t newsigmask;
+
+ (void) sigemptyset (&newsigmask);
+#ifdef SVR4
+ (void) sigaddset (&newsigmask, SIGPOLL);
+#else
+ (void) sigaddset (&newsigmask, SIGIO);
+#endif
+ (void) sigprocmask (SIG_BLOCK, &newsigmask, (sigset_t *)NULL);
+ miPointerWarpCursor (pScreen, x, y);
+ (void) sigprocmask (SIG_UNBLOCK, &newsigmask, (sigset_t *)NULL);
+#else
+ int oldmask;
+
+ oldmask = sigblock (sigmask (SIGIO));
+ miPointerWarpCursor (pScreen, x, y);
+ sigsetmask (oldmask);
+#endif
+}
diff --git a/xc/programs/Xserver/hw/sun/sunMultiDepth.c b/xc/programs/Xserver/hw/sun/sunMultiDepth.c
new file mode 100644
index 000000000..b27e46067
--- /dev/null
+++ b/xc/programs/Xserver/hw/sun/sunMultiDepth.c
@@ -0,0 +1,273 @@
+/* $TOG: sunMultiDepth.c /main/3 1998/02/10 13:17:26 kaleb $ */
+/*
+
+Copyright 1992, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/* $XFree86: xc/programs/Xserver/hw/sun/sunMultiDepth.c,v 1.4 1998/10/04 09:38:39 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "gcstruct.h"
+#include "mibstore.h"
+
+#ifndef SINGLEDEPTH
+
+static Bool
+sunCfbCreateGC(pGC)
+ GCPtr pGC;
+{
+ if (pGC->depth == 1)
+ {
+ return mfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 8)
+ {
+ return cfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 16)
+ {
+ return cfb16CreateGC (pGC);
+ }
+ else if (pGC->depth <= 32)
+ {
+ return cfb32CreateGC (pGC);
+ }
+ return FALSE;
+}
+
+static void
+sunCfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pdstStart; /* where to put the bits */
+{
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+static void
+sunCfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (pDrawable->bitsPerPixel)
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ extern int cfbWindowPrivateIndex;
+ extern int cfbGCPrivateIndex;
+ int ret;
+
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ sunRegisterPixmapFormat( /* depth */ 12, /* bits per pixel */ 16);
+ sunRegisterPixmapFormat( /* depth */ 24, /* bits per pixel */ 32);
+
+ switch (bpp) {
+ case 8:
+ ret = cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 16:
+ ret = cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 32:
+ ret = cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ default:
+ return FALSE;
+ }
+ pScreen->CreateGC = sunCfbCreateGC;
+ pScreen->GetImage = sunCfbGetImage;
+ pScreen->GetSpans = sunCfbGetSpans;
+ return ret;
+}
+
+extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec;
+extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex;
+extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen();
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ int i;
+ pointer oldDevPrivate;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ VisualID defaultVisual;
+ int rootdepth;
+
+ if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths,
+ &rootdepth, &defaultVisual, 1 << (bpp - 1), 8))
+ return FALSE;
+ oldDevPrivate = pScreen->devPrivate;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ switch (bpp)
+ {
+ case 8:
+ pScreen->CloseScreen = cfbCloseScreen;
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ break;
+ case 16:
+ pScreen->CloseScreen = cfb16CloseScreen;
+ pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb16BSFuncRec;
+ break;
+ case 32:
+ pScreen->CloseScreen = cfb32CloseScreen;
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb32BSFuncRec;
+ break;
+ }
+ return TRUE;
+}
+
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ if (!sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
+ return sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix,
+ dpiy, width, bpp);
+}
+
+
+#else /* SINGLEDEPTH */
+
+/* stuff for 8-bit only server */
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ sunRegisterPixmapFormat( /* depth */ 1, /* bits per pixel */ 1);
+ sunRegisterPixmapFormat( /* depth */ 8, /* bits per pixel */ 8);
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+
+#endif /* SINGLEDEPTH */
diff --git a/xc/programs/Xserver/hw/sunAmoeba/Imakefile b/xc/programs/Xserver/hw/sunAmoeba/Imakefile
new file mode 100644
index 000000000..b6ad97b9a
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/Imakefile
@@ -0,0 +1,56 @@
+XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:13:18 rws $
+#include <Server.tmpl>
+
+SRCS1 = sunAmInit.c \
+ sunCfb.c \
+ sunCursor.c \
+ sunFbs.c \
+ sunAmIo.c \
+ sunAmKbd.c \
+ sunMfb.c \
+ sunAmMouse.c\
+ sunGX.c \
+ sunKeyMap.c \
+ sunAmScreen.c \
+ sunAmProbe.c
+
+SRCS = $(SRCS1)
+
+OFILES = sunInitColor.o sunInitMono.o sunInExMono.o
+
+OBJS = sunCfb.o \
+ sunCursor.o \
+ sunFbs.o \
+ sunAmIo.o \
+ sunAmKbd.o \
+ sunMfb.o \
+ sunAmMouse.o \
+ sunGX.o \
+ sunKeyMap.o \
+ sunAmScreen.o \
+ sunAmProbe.o
+
+ INCLUDES = -I. -I../sun -I../.. -I../../mi -I../../mfb -I../../cfb \
+ -I../../include -I$(XINCLUDESRC) -I$(FONTINCSRC)
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+all:: $(OFILES)
+
+lintlib:
+
+NormalLibraryTarget(sun,$(OBJS))
+NormalLintTarget($(SRCS1))
+
+sunInExMono.o: $(ICONFIGFILES)
+ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,-UPEXEXT)
+ObjectFromSpecialSource(sunInitMono,sunAmInit,-DSUNMAXDEPTH=1)
+ObjectFromSpecialSource(sunInitColor,sunAmInit,-DSUNMAXDEPTH=8)
+
+ObjectFromSpecialSource(sunGX,../sun/sunGX,/**/)
+ObjectFromSpecialSource(sunKeyMap,../sun/sunKeyMap,/**/)
+ObjectFromSpecialSource(sunMfb,../sun/sunMfb,/**/)
+
+DependTarget()
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sun.h b/xc/programs/Xserver/hw/sunAmoeba/sun.h
new file mode 100644
index 000000000..c53559765
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sun.h
@@ -0,0 +1,480 @@
+
+/* $XConsortium: sun.h /main/3 1996/10/31 14:15:43 kaleb $ */
+
+/*-
+ * Copyright (c) 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sun.h,v 1.2 1998/06/27 12:53:54 hohndel Exp $ */
+
+#ifndef _SUN_H_
+#define _SUN_H_
+
+/* X headers */
+#include "Xos.h"
+#undef index /* don't mangle silly Sun structure member names */
+#include "X.h"
+#include "Xproto.h"
+
+/* general system headers */
+#ifndef NOSTDHDRS
+# include <stdlib.h>
+#else
+# include <malloc.h>
+extern char *getenv();
+#endif
+
+/* system headers common to both SunOS and Solaris */
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/filio.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#ifdef SVR4
+#ifdef X_POSIX_C_SOURCE
+#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
+#include <signal.h>
+#undef _POSIX_C_SOURCE
+#else
+#define _POSIX_SOURCE
+#include <signal.h>
+#undef _POSIX_SOURCE
+#endif
+#endif
+#include <fcntl.h>
+#ifndef i386
+# include <poll.h>
+#else
+# include <sys/poll.h>
+#endif
+#include <errno.h>
+#ifndef AMOEBA
+#include <memory.h>
+#else
+#include <stdlib.h>
+#endif
+
+#ifdef X_NOT_STDC_ENV
+extern int errno;
+#endif
+
+#ifndef AMOEBA
+/*
+ * Sun specific headers Sun moved in Solaris.
+ *
+ * Even if only needed by one source file, I have put them here
+ * to simplify finding them...
+ */
+#ifdef SVR4
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
+# include <sys/msio.h>
+# include <sys/vuid_event.h>
+# include <sys/memreg.h>
+# include <stropts.h>
+# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
+# define GETTIMEOFDAY(x) gettimeofday(x)
+#else
+# include <sun/fbio.h>
+# include <sundev/kbd.h>
+# include <sundev/kbio.h>
+# include <sundev/msio.h>
+# include <sundev/vuid_event.h>
+# include <pixrect/pixrect.h>
+# include <pixrect/memreg.h>
+# define GETTIMEOFDAY(x) gettimeofday(x, NULL);
+extern int ioctl();
+extern int getrlimit();
+extern int setrlimit();
+extern int getpagesize();
+#endif
+#else /* AMOEBA */
+#define NBBY 8
+
+#include <pixrect/pixrect.h>
+#include <pixrect/memreg.h>
+#include <sun/fbio.h>
+#endif /* AMOEBA */
+extern int gettimeofday();
+
+/*
+ * Server specific headers
+ */
+#include "misc.h"
+#undef abs /* don't munge function prototypes in headers, sigh */
+#undef fabs
+#include "scrnintstr.h"
+#ifdef NEED_EVENTS
+# include "inputstr.h"
+#endif
+#include "input.h"
+#include "colormapst.h"
+#include "colormap.h"
+#include "cursorstr.h"
+#include "cursor.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "opaque.h"
+#include "resource.h"
+#include "servermd.h"
+#include "windowstr.h"
+
+/*
+ * ddx specific headers
+ */
+#ifndef PSZ
+#define PSZ 8
+#endif
+
+#include "mi/mibstore.h"
+#include "mi/mipointer.h"
+
+extern int monitorResolution;
+
+
+/* Frame buffer devices */
+#ifdef SVR4
+# define CGTWO0DEV "/dev/fbs/cgtwo0"
+# define CGTWO1DEV "/dev/fbs/cgtwo1"
+# define CGTWO2DEV "/dev/fbs/cgtwo2"
+# define CGTWO3DEV "/dev/fbs/cgtwo3"
+# define CGTHREE0DEV "/dev/fbs/cgthree0"
+# define CGTHREE1DEV "/dev/fbs/cgthree1"
+# define CGTHREE2DEV "/dev/fbs/cgthree2"
+# define CGTHREE3DEV "/dev/fbs/cgthree3"
+# define CGFOUR0DEV "/dev/fbs/cgfour0"
+# define CGSIX0DEV "/dev/fbs/cgsix0"
+# define CGSIX1DEV "/dev/fbs/cgsix1"
+# define CGSIX2DEV "/dev/fbs/cgsix2"
+# define CGSIX3DEV "/dev/fbs/cgsix3"
+# define BWTWO0DEV "/dev/fbs/bwtwo0"
+# define BWTWO1DEV "/dev/fbs/bwtwo1"
+# define BWTWO2DEV "/dev/fbs/bwtwo2"
+# define BWTWO3DEV "/dev/fbs/bwtwo3"
+# define CGEIGHT0DEV "/dev/fbs/cgeight0"
+#else
+# define CGTWO0DEV "/dev/cgtwo0"
+# define CGTWO1DEV "/dev/cgtwo1"
+# define CGTWO2DEV "/dev/cgtwo2"
+# define CGTWO3DEV "/dev/cgtwo3"
+# define CGTHREE0DEV "/dev/cgthree0"
+# define CGTHREE1DEV "/dev/cgthree1"
+# define CGTHREE2DEV "/dev/cgthree2"
+# define CGTHREE3DEV "/dev/cgthree3"
+# define CGFOUR0DEV "/dev/cgfour0"
+# define CGSIX0DEV "/dev/cgsix0"
+# define CGSIX1DEV "/dev/cgsix1"
+# define CGSIX2DEV "/dev/cgsix2"
+# define CGSIX3DEV "/dev/cgsix3"
+# define BWTWO0DEV "/dev/bwtwo0"
+# define BWTWO1DEV "/dev/bwtwo1"
+# define BWTWO2DEV "/dev/bwtwo2"
+# define BWTWO3DEV "/dev/bwtwo3"
+# define CGEIGHT0DEV "/dev/cgeight0"
+#endif
+
+/*
+ * MAXEVENTS is the maximum number of events the mouse and keyboard functions
+ * will read on a given call to their GetEvents vectors.
+ */
+#define MAXEVENTS 32
+
+/*
+ * Data private to any sun keyboard.
+ */
+typedef struct {
+ int fd;
+ int type; /* Type of keyboard */
+ int layout; /* The layout of the keyboard */
+ int click; /* kbd click save state */
+ Leds leds; /* last known LED state */
+} sunKbdPrivRec, *sunKbdPrivPtr;
+
+extern sunKbdPrivRec sunKbdPriv;
+
+/*
+ * Data private to any sun pointer device.
+ */
+typedef struct {
+ int fd;
+ int bmask; /* last known button state */
+#ifdef AMOEBA
+ int dx, dy; /* current coordinates of pointer */
+ Bool mouseMoved;
+#endif
+} sunPtrPrivRec, *sunPtrPrivPtr;
+
+extern sunPtrPrivRec sunPtrPriv;
+
+typedef struct {
+ BYTE key;
+ CARD8 modifiers;
+} SunModmapRec;
+
+typedef struct {
+ int width, height;
+ Bool has_cursor;
+ CursorPtr pCursor; /* current cursor */
+} sunCursorRec, *sunCursorPtr;
+
+typedef struct {
+ ColormapPtr installedMap;
+ CloseScreenProcPtr CloseScreen;
+ void (*UpdateColormap)();
+ sunCursorRec hardwareCursor;
+ Bool hasHardwareCursor;
+} sunScreenRec, *sunScreenPtr;
+
+#define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
+#define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s)
+
+typedef struct {
+ unsigned char* fb; /* Frame buffer itself */
+ int fd; /* frame buffer for ioctl()s, */
+ struct fbtype info; /* Frame buffer characteristics */
+ void (*EnterLeave)();/* screen switch */
+ unsigned char* fbPriv; /* fbattr stuff, for the real type */
+} fbFd;
+
+typedef Bool (*sunFbInitProc)(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+
+typedef struct {
+ sunFbInitProc init; /* init procedure for this fb */
+ char* name; /* /usr/include/fbio names */
+#ifdef AMOEBA
+ Bool (*probeProc)(); /* probe procedure for this fb */
+#endif
+} sunFbDataRec;
+
+#ifndef XKB
+extern Bool sunAutoRepeatHandlersInstalled;
+extern long sunAutoRepeatInitiate;
+extern long sunAutoRepeatDelay;
+#endif
+extern sunFbDataRec sunFbData[];
+extern fbFd sunFbs[];
+extern Bool sunSwapLkeys;
+extern Bool sunFlipPixels;
+extern Bool sunActiveZaphod;
+extern Bool sunFbInfo;
+extern Bool sunCG4Frob;
+extern int sunScreenIndex;
+extern int* sunProtected;
+
+extern Bool sunCursorInitialize(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern void sunDisableCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern int sunChangeKbdTranslation(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* makeTranslated */
+#endif
+);
+
+extern void sunNonBlockConsoleOff(
+#if NeedFunctionPrototypes
+#ifdef SVR4
+ void
+#else
+ char* /* arg */
+#endif
+#endif
+);
+
+extern void sunEnqueueEvents(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern int sunGXInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ fbFd* /* fb */
+#endif
+);
+
+extern Bool sunSaveScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ int /* on */
+#endif
+);
+
+extern Bool sunScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern pointer sunMemoryMap(
+#if NeedFunctionPrototypes
+ size_t /* len */,
+ off_t /* off */,
+ int /* fd */
+#endif
+);
+
+extern Bool sunScreenAllocate(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern Bool sunInitCommon(
+#if NeedFunctionPrototypes
+ int /* scrn */,
+ ScreenPtr /* pScrn */,
+ off_t /* offset */,
+ Bool (* /* init1 */)(),
+ void (* /* init2 */)(),
+ Bool (* /* cr_cm */)(),
+ Bool (* /* save */)(),
+ int /* fb_off */
+#endif
+);
+
+#ifndef AMOEBA
+
+extern Firm_event* sunKbdGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern Firm_event* sunMouseGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern void sunKbdEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+extern void sunMouseEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+#endif /* AMOEBA */
+
+extern int sunKbdProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pKeyboard */,
+ int /* what */
+#endif
+);
+
+extern int sunMouseProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pMouse */,
+ int /* what */
+#endif
+);
+
+extern void sunKbdWait(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+/*-
+ * TVTOMILLI(tv)
+ * Given a struct timeval, convert its time into milliseconds...
+ */
+#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000))
+
+extern Bool sunCfbSetupScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbFinishScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern void sunInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern void sunUninstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern int sunListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ Colormap* /* pCmapList */
+#endif
+);
+
+#endif
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c
new file mode 100644
index 000000000..71357c489
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c
@@ -0,0 +1,468 @@
+/* $TOG: sunAmInit.c /main/4 1998/02/10 13:17:32 kaleb $ */
+/*
+ * sunAmInit.c --
+ * Amoeba implementation of initialization functions
+ * for screen/keyboard/mouse, etc.
+ *
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1994 by the Vrije Universiteit, Amsterdam.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * and the Vrije Universiteit make no representations about
+ * the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c,v 1.5 1998/10/04 09:38:41 dawes Exp $ */
+
+/* This file was partly derived from sunInit.c (5.49 94/02/21 10:21:02) */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*******************************************************/
+
+#include "sun.h"
+#include "gcstruct.h"
+#include "mibstore.h"
+
+Bool sunAutoRepeatHandlersInstalled; /* FALSE each time InitOutput called */
+Bool sunSwapLkeys = FALSE;
+Bool sunFlipPixels = FALSE;
+Bool sunFbInfo = FALSE;
+Bool sunCG4Frob = FALSE;
+
+/* maximum pixmap depth */
+#ifndef SUNMAXDEPTH
+#define SUNMAXDEPTH 8
+#endif
+
+typedef Bool initfunc (
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+
+extern initfunc sunBW2Init;
+extern initfunc sunCG6Init;
+extern initfunc sunCG3Init;
+
+extern Bool sunBW2Probe();
+extern Bool sunCG3CProbe();
+extern Bool sunCG6CProbe();
+
+sunFbDataRec sunFbData[] = {
+ sunBW2Init, "bwtwo0", sunBW2Probe,
+#if SUNMAXDEPTH > 1
+ sunCG6Init, "cgsix0", sunCG6CProbe,
+ sunCG3Init, "cgthree0", sunCG3CProbe,
+#endif
+};
+
+#define NUMSCREENS (sizeof(sunFbData)/sizeof(sunFbData[0]))
+
+fbFd sunFbs[MAXSCREENS];
+
+static PixmapFormatRec formats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD } /* 1-bit deep */
+#if SUNMAXDEPTH > 1
+ ,{ 8, 8, BITMAP_SCANLINE_PAD} /* 8-bit deep */
+#if SUNMAXDEPTH > 8
+ ,{ 12, 24, BITMAP_SCANLINE_PAD } /* 12-bit deep */
+ ,{ 24, 32, BITMAP_SCANLINE_PAD } /* 24-bit deep */
+#endif
+#endif
+};
+#define NUMFORMATS (sizeof formats)/(sizeof formats[0])
+
+void OsVendorInit(
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ /* nothing special to do for Amoeba */
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitOutput --
+ * Initialize screenInfo for all actually accessible framebuffers.
+ * The
+ *
+ * Results:
+ * screenInfo init proc field set
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+
+void InitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ static Bool sunDevsInited = FALSE;
+ static int screen_type[MAXSCREENS];
+ static int nscreens;
+ int i, scr;
+
+ if (!monitorResolution)
+ monitorResolution = 90;
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+ for (i=0; i< NUMFORMATS; i++)
+ pScreenInfo->formats[i] = formats[i];
+ sunAutoRepeatHandlersInstalled = FALSE;
+
+ if (!sunDevsInited) {
+ /* first time ever */
+ nscreens = 0;
+ for (i = 0;
+ sunFbData[i].probeProc != NULL && nscreens < NUMSCREENS;
+ i++)
+ {
+ if ((*sunFbData[i].probeProc)(pScreenInfo, nscreens,
+ sunFbData[i].name, argc, argv))
+ {
+ printf("Found screen %s (%d)\n", sunFbData[i].name, i);
+ screen_type[nscreens] = i;
+ nscreens++;
+ break; /* we only support one screen, currently */
+ }
+ }
+ sunDevsInited = TRUE;
+ }
+
+ for (scr = 0; scr < nscreens; scr++) {
+ if (AddScreen (sunFbData[screen_type[scr]].init, argc, argv) < 0) {
+ extern void AbortDDX();
+
+ FatalError("AddScreen failed");
+ AbortDDX(); /* forcing loader not to ignore SunIo.o */
+ }
+ }
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitInput --
+ * Initialize all supported input devices...what else is there
+ * besides pointer and keyboard?
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Two DeviceRec's are allocated and registered as the system pointer
+ * and keyboard devices.
+ *
+ *-----------------------------------------------------------------------
+ */
+void InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ int i;
+ DevicePtr p, k;
+ extern Bool mieqInit();
+
+ p = AddInputDevice(sunMouseProc, TRUE);
+ k = AddInputDevice(sunKbdProc, TRUE);
+ if (!p || !k)
+ FatalError("failed to create input devices in InitInput");
+
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+ miRegisterPointerDevice(screenInfo.screens[0], p);
+ (void) mieqInit (k, p);
+}
+
+
+/* The rest of this file is identical to the code in sunInit.c */
+
+#if SUNMAXDEPTH == 8
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+
+#else /* SUNMAXDEPTH != 8 */
+#if SUNMAXDEPTH == 32
+
+static Bool
+sunCfbCreateGC(pGC)
+ GCPtr pGC;
+{
+ if (pGC->depth == 1)
+ {
+ return mfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 8)
+ {
+ return cfbCreateGC (pGC);
+ }
+ else if (pGC->depth <= 16)
+ {
+ return cfb16CreateGC (pGC);
+ }
+ else if (pGC->depth <= 32)
+ {
+ return cfb32CreateGC (pGC);
+ }
+ return FALSE;
+}
+
+static void
+sunCfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pdstStart; /* where to put the bits */
+{
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+static void
+sunCfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (pDrawable->bitsPerPixel)
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ extern int cfbWindowPrivateIndex;
+ extern int cfbGCPrivateIndex;
+ int ret;
+
+ switch (bpp) {
+ case 8:
+ ret = cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 16:
+ ret = cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ case 32:
+ ret = cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+ break;
+ default:
+ return FALSE;
+ }
+ pScreen->CreateGC = sunCfbCreateGC;
+ pScreen->GetImage = sunCfbGetImage;
+ pScreen->GetSpans = sunCfbGetSpans;
+ return ret;
+}
+
+extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec;
+extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex;
+extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen();
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ int i;
+ pointer oldDevPrivate;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ VisualID defaultVisual;
+ int rootdepth = 0;
+
+ if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths,
+ &rootdepth, &defaultVisual, 1 << (bpp - 1), 8))
+ return FALSE;
+ oldDevPrivate = pScreen->devPrivate;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+ switch (bpp)
+ {
+ case 8:
+ pScreen->CloseScreen = cfbCloseScreen;
+ pScreen->BackingStoreFuncs = cfbBSFuncRec;
+ break;
+ case 16:
+ pScreen->CloseScreen = cfb16CloseScreen;
+ pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb16BSFuncRec;
+ break;
+ case 32:
+ pScreen->CloseScreen = cfb32CloseScreen;
+ pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr =
+ pScreen->devPrivate;
+ pScreen->devPrivate = oldDevPrivate;
+ pScreen->BackingStoreFuncs = cfb32BSFuncRec;
+ break;
+ }
+ return TRUE;
+}
+
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp;
+{
+ if (!sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width, bpp))
+ return FALSE;
+ return sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix,
+ dpiy, width, bpp);
+}
+
+#endif /* SUNMAXDEPTH == 32 */
+#endif /* SUNMAXDEPTH */
+
+#ifdef XDPMS
+/**************************************************************
+ * DPMSSet(), DPMSGet(), DPMSSupported()
+ *
+ * stubs
+ *
+ ***************************************************************/
+
+void DPMSSet (level)
+ int level;
+{
+}
+
+int DPMSGet (level)
+ int* level;
+{
+ return -1;
+}
+
+Bool DPMSSupported ()
+{
+ return FALSE;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c
new file mode 100644
index 000000000..6624d6ff9
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c
@@ -0,0 +1,175 @@
+/* $XConsortium: sunAmIo.c,v 1.1 94/04/01 17:54:49 dpw Exp $ */
+/*-
+ * sunAmIo.c --
+ * Amoeba implementation of functions to handle input from
+ * the keyboard and mouse.
+ *
+ * Copyright (c) 1994 by the Vrije Universiteit, Amsterdam
+ * Copyright (c) 1994 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The Vrije Universiteit and
+ * the University of California make no representations about
+ * the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+#include "amoeba.h"
+#include "server/iop/iop.h"
+
+static int lastEventTime;
+
+int
+TimeSinceLastInputEvent()
+{
+ /* Return the time in milliseconds since there last was any input */
+ register long now;
+
+ now = GetTimeInMillis();
+ if (lastEventTime == 0)
+ lastEventTime = now;
+ return (now - lastEventTime);
+}
+
+void
+SetTimeSinceLastInputEvent()
+{
+ lastEventTime = GetTimeInMillis();
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * ProcessInputEvents --
+ * Retrieve all waiting input events and pass them to DIX in their
+ * correct chronological order. Only reads from the system pointer
+ * and keyboard.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Events are passed to the DIX layer.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+ProcessInputEvents ()
+{
+ DevicePtr pPointer;
+ DevicePtr pKeyboard;
+ register sunPtrPrivPtr ptrPriv;
+ register sunKbdPrivPtr kbdPriv;
+ int i;
+ register IOPEvent *e, *elast;
+ IOPEvent events[MAXEVENTS];
+ xEvent x;
+ static int firsttime = TRUE;
+
+ pPointer = LookupPointerDevice();
+ pKeyboard = LookupKeyboardDevice();
+ ptrPriv = (sunPtrPrivPtr)pPointer->devicePrivate;
+ kbdPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+
+ while ((i = AmoebaGetEvents(events, MAXEVENTS)) > 0) {
+ for (e = &events[0], elast = &events[i]; e < elast; e++) {
+ x.u.keyButtonPointer.time = lastEventTime = e->time;
+ switch (e->type) {
+ case EV_PointerDelta:
+ x.u.u.type = MotionNotify;
+ x.u.keyButtonPointer.rootX = e->x;
+ x.u.keyButtonPointer.rootY = e->y;
+ sunMouseProcessEvent(pPointer, &x);
+ break;
+ case EV_ButtonPress:
+ x.u.u.type = ButtonPress;
+ x.u.u.detail = e->keyorbut;
+ sunMouseProcessEvent(pPointer, &x);
+ break;
+ case EV_ButtonRelease:
+ x.u.u.type = ButtonRelease;
+ x.u.u.detail = e->keyorbut;
+ sunMouseProcessEvent(pPointer, &x);
+ break;
+ case EV_KeyPressEvent:
+ /* device dependent code goes here */
+ x.u.u.type = KeyPress;
+ x.u.u.detail = e->keyorbut;
+ sunKbdProcessEvent(pKeyboard, &x);
+ break;
+ case EV_KeyReleaseEvent:
+ x.u.u.type = KeyRelease;
+ x.u.u.detail = e->keyorbut;
+ sunKbdProcessEvent(pKeyboard, &x);
+ /* device dependent code goes here */
+ break;
+ default:
+ /* this shouldn't happen */
+ ErrorF("stray event %d (%d,%d) %x\n",
+ e->type, e->x, e->y, e->keyorbut);
+ break;
+ }
+ }
+
+ sunMouseDoneEvents(pPointer, TRUE);
+ }
+
+ mieqProcessInputEvents();
+ miPointerUpdate();
+}
+
+/*
+ * DDX - specific abort routine. Called by AbortServer().
+ */
+void AbortDDX()
+{
+ int i;
+ ScreenPtr pScreen;
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ sunDisableCursor (pScreen);
+ }
+}
+
+/* Called by GiveUp(). */
+void
+ddxGiveUp()
+{
+ AbortDDX ();
+}
+
+void
+ddxUseMsg()
+{
+ ErrorF("-swapLkeys swap keysyms on L1..L10\n");
+ ErrorF("-mono force monochrome-only screen\n");
+ ErrorF("-flipPixels flip black and white pixels\n");
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+{
+ if (strcmp (argv[i], "-swapLkeys") == 0) { /* -swapLkeys */
+ sunSwapLkeys = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-mono") == 0) { /* -mono */
+ return 1;
+ }
+ if (strcmp (argv[i], "-flipPixels") == 0) { /* -flipPixels */
+ sunFlipPixels = TRUE;
+ return 1;
+ }
+ return 0;
+}
+
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c
new file mode 100644
index 000000000..ca0d9a051
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c
@@ -0,0 +1,630 @@
+/* $TOG: sunAmKbd.c /main/3 1998/02/10 13:17:46 kaleb $ */
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* This is a modified version of sunKbd.c (version 5.39 94/02/23 15:55:52),
+ * making it work for Amoeba.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#define NEED_EVENTS
+#include "sun.h"
+#include "keysym.h"
+#include "Sunkeysym.h"
+
+#include <amoeba.h>
+#include <cmdreg.h>
+#include <stdcom.h>
+#include <stderr.h>
+#include <server/iop/iop.h>
+
+extern capability iopcap;
+
+#define SUN_LED_MASK 0x0f
+#define MIN_KEYCODE 8 /* necessary to avoid the mouse buttons */
+#define MAX_KEYCODE 255 /* limited by the protocol */
+#ifndef KB_SUN4
+#define KB_SUN4 4
+#endif
+
+#define AUTOREPEAT_INITIATE 200
+#define AUTOREPEAT_DELAY 50
+
+extern KeySymsRec sunKeySyms[];
+extern SunModmapRec *sunModMaps[];
+extern int sunMaxLayout;
+extern KeySym *sunType4KeyMaps[];
+extern SunModmapRec *sunType4ModMaps[];
+
+long sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE;
+long sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY;
+
+static int autoRepeatKeyDown = 0;
+static int autoRepeatReady;
+static int autoRepeatFirst;
+long autoRepeatLastKeyDown;
+long autoRepeatDelta;
+
+static sunKbdPrivRec sysKbPriv = {
+ -1, /* Type */
+ -1, /* Layout */
+ 0, /* click */
+ (Leds)0 /* leds */
+};
+
+static void SwapKeys(keysyms)
+ KeySymsRec* keysyms;
+{
+ unsigned int i;
+ KeySym k;
+
+ for (i = 2; i < keysyms->maxKeyCode * keysyms->mapWidth; i++)
+ if (keysyms->map[i] == XK_L1 ||
+ keysyms->map[i] == XK_L2 ||
+ keysyms->map[i] == XK_L3 ||
+ keysyms->map[i] == XK_L4 ||
+ keysyms->map[i] == XK_L5 ||
+ keysyms->map[i] == XK_L6 ||
+ keysyms->map[i] == XK_L7 ||
+ keysyms->map[i] == XK_L8 ||
+ keysyms->map[i] == XK_L9 ||
+ keysyms->map[i] == XK_L10) {
+ /* yes, I could have done a clever two line swap! */
+ k = keysyms->map[i - 2];
+ keysyms->map[i - 2] = keysyms->map[i];
+ keysyms->map[i] = k;
+ }
+}
+
+static void SetLights (ctrl)
+ KeybdCtrl* ctrl;
+{
+ /* TODO */
+}
+
+
+static void ModLight (device, on, led)
+ DeviceIntPtr device;
+ Bool on;
+ int led;
+{
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if(on) {
+ ctrl->leds |= led;
+ pPriv->leds |= led;
+ } else {
+ ctrl->leds &= ~led;
+ pPriv->leds &= ~led;
+ }
+ SetLights (ctrl);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunBell --
+ * Ring the terminal/keyboard bell
+ *
+ * Results:
+ * Ring the keyboard bell for an amount of time proportional to
+ * "loudness."
+ *
+ * Side Effects:
+ * None, really...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void sunBell (
+ int percent,
+ DeviceIntPtr device,
+ pointer ctrl,
+ int unused)
+#else
+static void sunBell (percent, device, ctrl, unused)
+ int percent; /* Percentage of full volume */
+ DeviceIntPtr device; /* Keyboard to ring */
+ pointer ctrl;
+ int unused;
+#endif
+{
+ int kbdCmd; /* Command to give keyboard */
+ KeybdCtrl* kctrl = (KeybdCtrl*) ctrl;
+
+ if (percent == 0 || kctrl->bell == 0)
+ return;
+
+ (void) iop_ringbell(&iopcap, percent,
+ kctrl->bell_pitch, kctrl->bell_duration);
+}
+
+
+static void EnqueueEvent (xE)
+ xEvent* xE;
+{
+ mieqEnqueue (xE);
+}
+
+#define XLED_NUM_LOCK 0x1
+#define XLED_COMPOSE 0x4
+#define XLED_SCROLL_LOCK 0x2
+#define XLED_CAPS_LOCK 0x8
+
+static KeyCode LookupKeyCode (keysym, keysymsrec)
+ KeySym keysym;
+ KeySymsPtr keysymsrec;
+{
+ KeyCode i;
+ int ii, index = 0;
+
+ for (i = keysymsrec->minKeyCode; i < keysymsrec->maxKeyCode; i++)
+ for (ii = 0; ii < keysymsrec->mapWidth; ii++)
+ if (keysymsrec->map[index++] == keysym)
+ return i;
+}
+
+static void pseudoKey(device, down, keycode)
+ DeviceIntPtr device;
+ Bool down;
+ KeyCode keycode;
+{
+ int bit;
+ CARD8 modifiers;
+ CARD16 mask;
+ BYTE* kptr;
+
+ kptr = &device->key->down[keycode >> 3];
+ bit = 1 << (keycode & 7);
+ modifiers = device->key->modifierMap[keycode];
+ if (down) {
+ /* fool dix into thinking this key is now "down" */
+ int i;
+ *kptr |= bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ device->key->modifierKeyCount[i]++;
+ device->key->state += mask;
+ modifiers &= ~mask;
+ }
+ } else {
+ /* fool dix into thinking this key is now "up" */
+ if (*kptr & bit) {
+ int i;
+ *kptr &= ~bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ if (--device->key->modifierKeyCount[i] <= 0) {
+ device->key->state &= ~mask;
+ device->key->modifierKeyCount[i] = 0;
+ }
+ modifiers &= ~mask;
+ }
+ }
+ }
+}
+
+static void DoLEDs(device, ctrl, pPriv)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+ sunKbdPrivPtr pPriv;
+{
+ if ((ctrl->leds & XLED_CAPS_LOCK) && !(pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_CAPS_LOCK) && (pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_NUM_LOCK) && !(pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_NUM_LOCK) && (pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_SCROLL_LOCK) && !(pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_SCROLL_LOCK) && (pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_COMPOSE) && !(pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_COMPOSE) && (pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+
+ pPriv->leds = ctrl->leds & 0x0f;
+ SetLights (ctrl);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdCtrl --
+ * Alter some of the keyboard control parameters
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Some...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void sunKbdCtrl (
+ DeviceIntPtr device,
+ KeybdCtrl* ctrl)
+#else
+static void sunKbdCtrl (device, ctrl)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+#endif
+{
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (ctrl->click != pPriv->click) {
+ pPriv->click = ctrl->click;
+ (void) iop_keyclick(&iopcap, ctrl->click);
+ }
+ if (pPriv->type == KB_SUN4 && pPriv->leds != ctrl->leds & 0x0f)
+ DoLEDs(device, ctrl, pPriv);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdProc --
+ * Handle the initialization, etc. of a keyboard.
+ *
+ * Results:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+int sunKbdProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunKbdProc (device, what)
+ DeviceIntPtr device; /* Keyboard to manipulate */
+ int what; /* What to do to it */
+#endif
+{
+ int i;
+ DevicePtr pKeyboard = (DevicePtr) device;
+ sunKbdPrivPtr pPriv;
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+
+ static CARD8 *workingModMap = NULL;
+ static KeySymsRec *workingKeySyms;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pKeyboard != LookupKeyboardDevice()) {
+ ErrorF ("Cannot open non-system keyboard\n");
+ return (!Success);
+ }
+
+ /*
+ * First open and find the current state of the keyboard.
+ */
+ if (!workingKeySyms) {
+ errstat err;
+
+ if ((err = iop_kbdtype(&iopcap, &sysKbPriv.type)) != STD_OK) {
+ ErrorF("Xsun: iop_kbdtype failed: %s\n", err_why(err));
+ FatalError("Cannot get keyboard type\n");
+ }
+ if (sysKbPriv.type == KB_SUN4) {
+ /* TODO: we also need to get the layout from iop_kbdtype.
+ * For now we'll just assume layout 0 by default.
+ */
+ sysKbPriv.layout = 0;
+ sunKeySyms[KB_SUN4].map = sunType4KeyMaps[sysKbPriv.layout];
+ sunModMaps[KB_SUN4] = sunType4ModMaps[sysKbPriv.layout];
+ }
+
+ if (sysKbPriv.type < 0 || sysKbPriv.type > KB_SUN4 ||
+ sunKeySyms[sysKbPriv.type].map == NULL)
+ {
+ FatalError("Unsupported keyboard type %d\n",sysKbPriv.type);
+ }
+
+ /*
+ * Perform final initialization of the system private keyboard
+ * structure and fill in various slots in the device record
+ * itself which couldn't be filled in before.
+ */
+ (void) memset ((void *) defaultKeyboardControl.autoRepeats,
+ ~0, sizeof defaultKeyboardControl.autoRepeats);
+ autoRepeatKeyDown = 0;
+ /*
+ * Initialize the keysym map
+ */
+ workingKeySyms = &sunKeySyms[sysKbPriv.type];
+
+ /*
+ * Create and initialize the modifier map.
+ */
+ if (!workingModMap) {
+ workingModMap=(CARD8 *)xalloc(MAP_LENGTH);
+ (void) memset(workingModMap, 0, MAP_LENGTH);
+ for(i=0; sunModMaps[sysKbPriv.type][i].key != 0; i++)
+ workingModMap[sunModMaps[sysKbPriv.type][i].key + MIN_KEYCODE] =
+ sunModMaps[sysKbPriv.type][i].modifiers;
+ }
+
+ if (sysKbPriv.type == KB_SUN4 && sunSwapLkeys)
+ SwapKeys(workingKeySyms);
+ /*
+ * ensure that the keycodes on the wire are >= MIN_KEYCODE
+ * and <= MAX_KEYCODE
+ */
+ if (workingKeySyms->minKeyCode < MIN_KEYCODE) {
+ workingKeySyms->minKeyCode += MIN_KEYCODE;
+ workingKeySyms->maxKeyCode += MIN_KEYCODE;
+ }
+ if (workingKeySyms->maxKeyCode > MAX_KEYCODE)
+ workingKeySyms->maxKeyCode = MAX_KEYCODE;
+ }
+ pKeyboard->devicePrivate = (pointer)&sysKbPriv;
+ pKeyboard->on = FALSE;
+
+ InitKeyboardDeviceStruct(pKeyboard,
+ workingKeySyms, workingModMap,
+ sunBell, sunKbdCtrl);
+ break;
+
+ case DEVICE_ON:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ pKeyboard->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ if (pPriv->type == KB_SUN4) {
+ /* dumb bug in Sun's keyboard! Turn off LEDS before resetting */
+ pPriv->leds = 0;
+ ctrl->leds = 0;
+ SetLights(ctrl);
+ }
+ pKeyboard->on = FALSE;
+ break;
+ default:
+ FatalError("Unknown keyboard operation\n");
+ }
+ return Success;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdEnqueueEvent --
+ *
+ *-----------------------------------------------------------------------
+ */
+static xEvent autoRepeatEvent;
+
+static Bool DoSpecialKeys(device, xE)
+ DeviceIntPtr device;
+ xEvent* xE;
+{
+ int shift_index, map_index, bit;
+ KeySym ksym;
+ BYTE* kptr;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr)device->public.devicePrivate;
+ BYTE keycode = xE->u.u.detail;
+ CARD8 keyModifiers = device->key->modifierMap[keycode];
+
+ /* look up the present idea of the keysym */
+ shift_index = 0;
+ if (device->key->state & ShiftMask)
+ shift_index ^= 1;
+ if (device->key->state & LockMask)
+ shift_index ^= 1;
+ /* TODO: find out how to get a map_index under Amoeba.
+ * For now just ignore special keys.
+ */
+ ksym = 0;
+
+ if (ksym == XK_Num_Lock) {
+ if (pPriv->type == KB_SUN4)
+ ModLight (device, xE->u.u.type == KeyPress, XLED_NUM_LOCK);
+ } else if (ksym == XK_Scroll_Lock) {
+ if (pPriv->type == KB_SUN4)
+ ModLight (device, xE->u.u.type == KeyPress, XLED_SCROLL_LOCK);
+ } else if (ksym == SunXK_Compose) {
+ if (pPriv->type == KB_SUN4)
+ ModLight (device, xE->u.u.type == KeyPress, XLED_COMPOSE);
+ } else if (keyModifiers & LockMask) {
+ if (pPriv->type == KB_SUN4)
+ ModLight (device, xE->u.u.type == KeyPress, XLED_CAPS_LOCK);
+ } else if ((xE->u.u.type == KeyPress) && (keyModifiers == 0)) {
+ /* initialize new AutoRepeater event & mark AutoRepeater on */
+ autoRepeatEvent = *xE;
+ autoRepeatFirst = TRUE;
+ autoRepeatKeyDown++;
+ autoRepeatLastKeyDown = GetTimeInMillis();
+ }
+ return FALSE;
+}
+
+
+void
+sunKbdProcessEvent(device, xeva)
+ DeviceIntPtr device;
+ xEvent *xeva;
+{
+ xEvent xE;
+ BYTE keycode;
+ CARD8 keyModifiers;
+
+ xE = *xeva;
+ xE.u.u.detail &= 0x7f;
+ xE.u.u.detail += MIN_KEYCODE;
+ keycode = xE.u.u.detail;
+ keyModifiers = device->key->modifierMap[keycode];
+ if (autoRepeatKeyDown && (keyModifiers == 0) &&
+ (xE.u.u.type == KeyPress || (keycode == autoRepeatEvent.u.u.detail))) {
+ /*
+ * Kill AutoRepeater on any real non-modifier key down, or auto key up
+ */
+ autoRepeatKeyDown = 0;
+ }
+ if (DoSpecialKeys(device, &xE))
+ return;
+ mieqEnqueue (&xE);
+}
+
+void sunEnqueueAutoRepeat ()
+{
+ int delta;
+ int i, mask;
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+ i=(autoRepeatEvent.u.u.detail >> 3);
+ mask=(1 << (autoRepeatEvent.u.u.detail & 7));
+ if (!(ctrl->autoRepeats[i] & mask)) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+
+ /*
+ * Generate auto repeat event. XXX one for now.
+ * Update time & pointer location of saved KeyPress event.
+ */
+
+ delta = autoRepeatDelta;
+ autoRepeatFirst = FALSE;
+
+ /*
+ * Fake a key up event and a key down event
+ * for the last key pressed.
+ */
+ autoRepeatEvent.u.keyButtonPointer.time += delta;
+ autoRepeatEvent.u.u.type = KeyRelease;
+
+ EnqueueEvent (&autoRepeatEvent);
+ autoRepeatEvent.u.u.type = KeyPress;
+ EnqueueEvent (&autoRepeatEvent);
+
+ /* Update time of last key down */
+ autoRepeatLastKeyDown += autoRepeatDelta;
+}
+
+/*ARGSUSED*/
+Bool LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void sunBlockHandler(nscreen, pbdata, pptv, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ struct timeval **pptv;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ static struct timeval artv = { 0, 0 }; /* autorepeat timeval */
+
+ if (!autoRepeatKeyDown)
+ return;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatFirst == TRUE)
+ artv.tv_usec = sunAutoRepeatInitiate;
+ else
+ artv.tv_usec = sunAutoRepeatDelay;
+ *pptv = &artv;
+
+}
+
+/*ARGSUSED*/
+void sunWakeupHandler(nscreen, pbdata, err, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ unsigned long err;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ struct timeval tv;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatKeyDown) {
+ register long tv = GetTimeInMillis();
+
+ autoRepeatDelta = tv - autoRepeatLastKeyDown;
+ if ((!autoRepeatFirst && (autoRepeatDelta > (sunAutoRepeatDelay/1000)))
+ || (autoRepeatDelta > (sunAutoRepeatInitiate/1000)))
+ {
+ autoRepeatReady++;
+ }
+ }
+
+ if (autoRepeatReady)
+ {
+ sunEnqueueAutoRepeat ();
+ autoRepeatReady = 0;
+ }
+}
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c
new file mode 100644
index 000000000..872c9dead
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c
@@ -0,0 +1,323 @@
+/* $TOG: sunAmMouse.c /main/3 1998/02/10 13:17:51 kaleb $ */
+
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* This is a modified version of sunMouse.c, making it work for Amoeba */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+Bool sunActiveZaphod = TRUE;
+
+static Bool sunCursorOffScreen();
+static void sunCrossScreen();
+static void sunWarpCursor();
+
+miPointerScreenFuncRec sunPointerScreenFuncs = {
+ sunCursorOffScreen,
+ sunCrossScreen,
+ sunWarpCursor,
+};
+
+static sunPtrPrivRec sysMousePriv = {
+ 0,
+ 0, /* Current button state */
+ 0,
+ 0,
+ 0
+};
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseCtrl --
+ * Alter the control parameters for the mouse. Since acceleration
+ * etc. is done from the PtrCtrl record in the mouse's device record,
+ * there's nothing to do here.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+static
+#if NeedFunctionPrototypes
+void sunMouseCtrl (
+ DeviceIntPtr device,
+ PtrCtrl* ctrl)
+#else
+void sunMouseCtrl (device, ctrl)
+ DeviceIntPtr device;
+ PtrCtrl* ctrl;
+#endif
+{
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseProc --
+ * Handle the initialization, etc. of a mouse
+ *
+ * Results:
+ * none.
+ *
+ * Side Effects:
+ *
+ * Note:
+ * When using sunwindows, all input comes off a single fd, stored in the
+ * global windowFd. Therefore, only one device should be enabled and
+ * disabled, even though the application still sees both mouse and
+ * keyboard. We have arbitrarily chosen to enable and disable windowFd
+ * in the keyboard routine sunKbdProc rather than in sunMouseProc.
+ *
+ *-----------------------------------------------------------------------
+ */
+#if NeedFunctionPrototypes
+int sunMouseProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunMouseProc (device, what)
+ DeviceIntPtr device; /* Mouse to play with */
+ int what; /* What to do with it */
+#endif
+{
+ DevicePtr pMouse = (DevicePtr) device;
+ int format;
+ static int oformat;
+ BYTE map[4];
+ char *dev;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pMouse != LookupPointerDevice()) {
+ ErrorF ("Cannot open non-system mouse");
+ return !Success;
+ }
+ pMouse->devicePrivate = (pointer) &sysMousePriv;
+ pMouse->on = FALSE;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ InitPointerDeviceStruct(
+ pMouse, map, 3, miPointerGetMotionEvents,
+ sunMouseCtrl, miPointerGetMotionBufferSize());
+ break;
+
+ case DEVICE_ON:
+ pMouse->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ break;
+
+ case DEVICE_OFF:
+ pMouse->on = FALSE;
+ break;
+ }
+ return Success;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * MouseAccelerate --
+ * Given a delta and a mouse, return the acceleration of the delta.
+ *
+ * Results:
+ * The corrected delta
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+static short
+MouseAccelerate (device, delta)
+ DeviceIntPtr device;
+ int delta;
+{
+ int sgn = sign(delta);
+ PtrCtrl *pCtrl;
+ short ret;
+
+ delta = abs(delta);
+ pCtrl = &device->ptrfeed->ctrl;
+ if (delta > pCtrl->threshold) {
+ ret =
+ (short) sgn *
+ (pCtrl->threshold + ((delta - pCtrl->threshold) * pCtrl->num) /
+ pCtrl->den);
+ } else {
+ ret = (short) sgn * delta;
+ }
+ return ret;
+}
+
+/*
+ * Given an xEvent for a mouse, pass it off the the dix layer
+ * properly converted ...
+ */
+void
+sunMouseProcessEvent(pMouse, xeva)
+ DevicePtr pMouse; /* mouse from which the event came */
+ xEvent *xeva;
+{
+ int index; /* screen index */
+ xEvent xE;
+ sunPtrPrivPtr pPriv; /* private data for pointer */
+ register int bmask; /* temporary button mask */
+ int x,y;
+
+ xE = *xeva;
+ pPriv = (sunPtrPrivPtr)pMouse->devicePrivate;
+
+ bmask = pPriv->bmask;
+ switch (xE.u.u.type) {
+ case ButtonRelease:
+ if (!(bmask & (1 << xE.u.u.detail))) {
+ /* This may happen when the server starts up; ignore it */
+ /* ErrorF("Xsun: Ignoring spurious button release\n"); */
+ return;
+ }
+ pPriv->bmask &= ~(1<<xE.u.u.detail);
+ break;
+ case ButtonPress:
+ if ((bmask & (1 << xE.u.u.detail))) {
+ ErrorF("Xsun: Ignoring spurious button press\n");
+ return;
+ }
+ pPriv->bmask |= (1<<xE.u.u.detail);
+ break;
+ case MotionNotify:
+ /*
+ * When we detect a change in the mouse coordinates, we call
+ * the cursor module to move the cursor. It has the option of
+ * simply removing the cursor or just shifting it a bit.
+ * If it is removed, DIX will restore it before we goes to sleep...
+ *
+ * What should be done if it goes off the screen? Move to another
+ * screen? For now, we just force the pointer to stay on the
+ * screen...
+ */
+ pPriv->dx += MouseAccelerate(pMouse, xE.u.keyButtonPointer.rootX);
+ pPriv->dy += MouseAccelerate(pMouse, xE.u.keyButtonPointer.rootY);
+ pPriv->mouseMoved = TRUE;
+ return;
+ default:
+ FatalError("sunMouseProcessEvent: unrecognized id\n");
+ break;
+ }
+
+ miPointerPosition(&x, &y);
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+ mieqEnqueue(&xE);
+}
+
+/*
+ * Finish off any mouse motions we haven't done yet
+ */
+/*ARGSUSED*/
+void
+sunMouseDoneEvents(pMouse,final)
+ DevicePtr pMouse;
+ Bool final;
+{
+ sunPtrPrivPtr pPriv;
+ xEvent xE;
+ int dx, dy;
+
+ pPriv = (sunPtrPrivPtr) pMouse->devicePrivate;
+
+ if (pPriv->mouseMoved) {
+ dx = pPriv->dx;
+ dy = pPriv->dy;
+ pPriv->dx = pPriv->dy = 0;
+ pPriv->mouseMoved = FALSE;
+ miPointerDeltaCursor(dx, dy, TimeSinceLastInputEvent());
+ }
+}
+
+/*ARGSUSED*/
+static Bool
+sunCursorOffScreen (pScreen, x, y)
+ ScreenPtr *pScreen;
+ int *x, *y;
+{
+ extern Bool PointerConfinedToScreen();
+
+ if (PointerConfinedToScreen()) return TRUE;
+
+ /* since we support only one screen anyway: */
+ return FALSE;
+}
+
+static void
+sunCrossScreen (pScreen, entering)
+ ScreenPtr pScreen;
+ Bool entering;
+{
+ if (sunFbs[pScreen->myNum].EnterLeave)
+ (*sunFbs[pScreen->myNum].EnterLeave) (pScreen, entering ? 0 : 1);
+}
+
+static void
+sunWarpCursor (pScreen, x, y)
+ ScreenPtr pScreen;
+ int x, y;
+{
+ miPointerWarpCursor (pScreen, x, y);
+}
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c
new file mode 100644
index 000000000..fee016800
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c
@@ -0,0 +1,238 @@
+/* $TOG: sunAmProbe.c /main/3 1998/02/10 13:17:55 kaleb $ */
+/*-
+ * sunAmProbe.c:
+ * Amoeba implementation of functions to probe and map in the
+ * frame buffer of several supported video cards (CG6, CG3, BW2).
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#include "sun.h"
+
+#include <pixrect/memreg.h>
+#include "colormap.h"
+#include "colormapst.h"
+#include "resource.h"
+#include <cfb.h>
+#include <sundev/bw2reg.h>
+
+#include <amoeba.h>
+#include <cmdreg.h>
+#include <stderr.h>
+#include <machdep.h>
+#include <proc.h>
+#include <server/iop/iop.h>
+#include <ampolicy.h>
+
+extern bufptr sunMapAmoebaScreen();
+extern int sunAmoebaScreen();
+
+/*
+ * Code partly derived from the X11R5 version of sunCG6C.c:
+ */
+
+#ifdef FBTYPE_SUNFAST_COLOR
+
+#define CG6_VBASE 0x70000000
+
+#define CG6_IMAGE(fb) ((caddr_t)(&(fb)->cpixel))
+#define CG6_IMAGEOFF ((off_t)0x16000)
+#define CG6_GXOFF ((off_t)0)
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunCG6Probe --
+ * Attempt to find and initialize a cg6 framebuffer
+ *
+ * Results:
+ * TRUE if everything went ok. FALSE if not.
+ *
+ * Side Effects:
+ * Memory is allocated for the frame buffer and the buffer is mapped.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+Bool
+sunCG6CProbe (pScreenInfo, index, fbNum, argc, argv)
+ ScreenInfo *pScreenInfo; /* The screenInfo struct */
+ int index; /* The index of pScreen in the ScreenInfo */
+ int fbNum; /* Index into the sunFbData array */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ IOPFrameBufferInfo screen;
+ pointer fb;
+ int imagelen;
+ int offset;
+
+ if (sunAmoebaScreen(&screen, "cgsix", 8) == 0)
+ return FALSE;
+ /* We have a little problem with Amoeba. The CG6_IMAGEOFF = 0x16000
+ * means that the start of the hardware segment is not click-aligned.
+ * Therefore we round it up to a multiple of the pagesize and add that
+ * extra bit to fb to make it point to the right part of the hardware
+ */
+ offset = (CG6_IMAGEOFF + CLICKSIZE - 1) & ~(CLICKSIZE - 1);
+ imagelen = offset + screen.width * screen.height;
+ fb = (pointer) sunMapAmoebaScreen(&screen.fb, imagelen);
+ if (fb == NULL) {
+ Error("Mapping cg6c: sunMapAmoebaScreen failed");
+ return FALSE;
+ }
+ /* Move the pointer up to where the hardware begins */
+ fb += offset - CG6_IMAGEOFF;
+
+ sunFbs[index].fd = -1; /* we never use this but we set it from paranoia */
+ sunFbs[index].fb = fb;
+ sunFbs[index].info.fb_width = screen.width;
+ sunFbs[index].info.fb_height = screen.height;
+ sunFbs[index].info.fb_depth = screen.depth;
+ sunFbs[index].EnterLeave = NULL;
+ return TRUE;
+}
+
+#endif /* FBTYPE_SUNFAST_COLOR */
+
+/*
+ * Code derived from the X11R5 version of sunCG3C.c:
+ */
+
+#define CG3A_HEIGHT 900
+#define CG3A_WIDTH 1152
+#define CG3B_HEIGHT 768
+#define CG3B_WIDTH 1024
+
+typedef struct cg3ac {
+#ifdef sparc
+ u_char mpixel[128*1024]; /* bit-per-pixel memory */
+ u_char epixel[128*1024]; /* enable plane */
+#endif
+ u_char cpixel[CG3A_HEIGHT][CG3A_WIDTH]; /* byte-per-pixel memory */
+} CG3AC, CG3ACRec, *CG3ACPtr;
+
+typedef struct cg3bc {
+#ifdef sparc
+ u_char mpixel[128*1024]; /* bit-per-pixel memory */
+ u_char epixel[128*1024]; /* enable plane */
+#endif
+ u_char cpixel[CG3B_HEIGHT][CG3B_WIDTH]; /* byte-per-pixel memory */
+} CG3BC, CG3BCRec, *CG3BCPtr;
+
+#define CG3AC_IMAGE(fb) ((caddr_t)((fb)->cpixel))
+#define CG3AC_IMAGELEN (((sizeof (CG3AC) + 4095)/4096)*4096)
+#define CG3BC_IMAGE(fb) ((caddr_t)((fb)->cpixel))
+#define CG3BC_IMAGELEN (((sizeof (CG3BC) + 4095)/4096)*4096)
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunCG3CProbe --
+ * Attempt to find and initialize a cg3 framebuffer
+ *
+ * Results:
+ * TRUE if everything went ok. FALSE if not.
+ *
+ * Side Effects:
+ * Memory is allocated for the frame buffer and the buffer is mapped.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+/*ARGSUSED*/
+Bool
+sunCG3CProbe (pScreenInfo, index, fbNum, argc, argv)
+ ScreenInfo *pScreenInfo; /* The screenInfo struct */
+ int index; /* The index of pScreen in the ScreenInfo */
+ int fbNum; /* Index into the sunFbData array */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ IOPFrameBufferInfo screen;
+ CG3ACPtr CG3ACfb;
+ CG3BCPtr CG3BCfb;
+ pointer fb;
+
+ if (sunAmoebaScreen(&screen, "cgthree", 8) == 0)
+ return FALSE;
+ if (screen.width == CG3A_WIDTH) {
+ CG3ACfb = (CG3ACPtr) sunMapAmoebaScreen(&screen.fb, CG3AC_IMAGELEN);
+ if (CG3ACfb == NULL)
+ return FALSE;
+ fb = (pointer) CG3AC_IMAGE(CG3ACfb);
+ }
+ else if (screen.width == CG3B_WIDTH) {
+ CG3BCfb = (CG3BCPtr) sunMapAmoebaScreen(&screen.fb, CG3BC_IMAGELEN);
+ if (CG3BCfb == NULL)
+ return FALSE;
+ fb = (pointer) CG3BC_IMAGE(CG3BCfb);
+ }
+ else {
+ Error("Mapping cg3c: unexpected width");
+ return FALSE;
+ }
+
+ sunFbs[index].fd = -1; /* we never use this but we set it from paranoia */
+ sunFbs[index].fb = fb;
+ sunFbs[index].info.fb_width = screen.width;
+ sunFbs[index].info.fb_height = screen.height;
+ sunFbs[index].info.fb_depth = screen.depth;
+ sunFbs[index].EnterLeave = NULL;
+ return TRUE;
+}
+
+/* Code derived from sunMfb.c, 1.3 94/02/01 11:02:34 kaleb: */
+
+typedef struct bw2 {
+ u_char image[BW2_FBSIZE]; /* Pixel buffer */
+} BW2, BW2Rec, *BW2Ptr;
+
+Bool
+sunBW2Probe(pScreenInfo, index, fbNum, argc, argv)
+ ScreenInfo *pScreenInfo; /* The screenInfo struct */
+ int index; /* The index of pScreen in the ScreenInfo */
+ int fbNum; /* Index into the sunFbData array */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ IOPFrameBufferInfo screen;
+ BW2Ptr BW2fb; /* Place the bitmap is mapped in addr space */
+
+ if (sunAmoebaScreen(&screen, "bwtwo", 1) == 0)
+ return FALSE;
+ BW2fb = (BW2Ptr) sunMapAmoebaScreen(&screen.fb,
+ screen.stride * screen.height / 8);
+ if (BW2fb == NULL)
+ return FALSE;
+ sunFbs[index].fb = (pointer)BW2fb;
+ sunFbs[index].info.fb_width = screen.width;
+ sunFbs[index].info.fb_height = screen.height;
+ sunFbs[index].EnterLeave = NULL;
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c
new file mode 100644
index 000000000..35a8c5a2f
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c
@@ -0,0 +1,88 @@
+/* $XConsortium: sunAmScreen.c,v 1.1 94/04/01 17:55:13 dpw Exp $ */
+/*
+ * Copyright 1993 Vrije Universiteit, The Netherlands
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the Vrije Universiteit not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The Vrije Universiteit makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * THE VRIJE UNIVERSITEIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE VRIJE UNIVERSITEIT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This is the code that Amoeba uses to probe and map in a sun bitmap display.
+ */
+
+#include "sun.h"
+
+#include "amoeba.h"
+#include "cmdreg.h"
+#include "stderr.h"
+#include "ampolicy.h"
+#include "proc.h"
+#include "server/iop/iop.h"
+
+bufptr
+sunMapAmoebaScreen(cap, nbytes)
+ capability *cap;
+ int nbytes;
+{
+ static char *addr;
+ segid seg;
+ char *findhole();
+
+ if (addr) return addr;
+
+ /* First find a place to map in the segment: */
+ addr = findhole(nbytes);
+ seg = seg_map(cap, addr, nbytes, MAP_TYPEDATA|MAP_READWRITE|MAP_INPLACE);
+ if (seg < 0) {
+ ErrorF("Xsun: map_segment(bitmap) %x %x: %s\n",
+ addr, nbytes, err_why(ERR_CONVERT(seg)));
+ return NULL;
+ }
+
+ return addr;
+}
+
+extern capability iopcap;
+
+int
+sunAmoebaScreen(screen, name, depth)
+ IOPFrameBufferInfo *screen;
+ char *name; /* The name of the device we want to find */
+ unsigned short depth; /* framebuffer depth we expect to find */
+{
+ errstat err;
+
+ if ((err = iop_framebufferinfo(&iopcap, screen)) != STD_OK) {
+ ErrorF("Xsun: get frame buffer info failed: %s\n", err_why(err));
+ return 0;
+ }
+
+ if (screen->xmm <= 0 || screen->ymm <= 0) {
+ ErrorF("X or Y dimensions of screen <= 0\n");
+ return 0;
+ }
+ if (screen->depth != depth ||
+ strncmp(name, screen->name, IOPNAMELEN) != 0) {
+ return 0;
+ }
+
+ /* printf("Screen information: width %d, height %d, stride %d\n",
+ screen->width, screen->height, screen->stride); */
+
+ return 1;
+}
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c b/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c
new file mode 100644
index 000000000..c2d5d38d9
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c
@@ -0,0 +1,471 @@
+
+/* $TOG: sunCfb.c /main/3 1998/02/10 13:18:04 kaleb $ */
+
+/*
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunCfb.c,v 1.3 1998/10/04 09:38:42 dawes Exp $ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#include "sun.h"
+#include "cfb/cfb.h"
+#ifdef AMOEBA
+#include "amoeba.h"
+#include "cmdreg.h"
+#include "stderr.h"
+#include "server/iop/colourmap.h"
+#include "server/iop/iop.h"
+#endif /* AMOEBA */
+
+static void CGUpdateColormap(pScreen, dex, count, rmap, gmap, bmap)
+ ScreenPtr pScreen;
+ int dex, count;
+ u_char *rmap, *gmap, *bmap;
+{
+#ifndef AMOEBA
+ struct fbcmap sunCmap;
+
+ sunCmap.index = dex;
+ sunCmap.count = count;
+ sunCmap.red = &rmap[dex];
+ sunCmap.green = &gmap[dex];
+ sunCmap.blue = &bmap[dex];
+
+ if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) < 0) {
+ Error("CGUpdateColormap");
+ FatalError( "CGUpdateColormap: FBIOPUTCMAP failed\n" );
+ }
+#else
+ extern capability iopcap;
+ colour_map sunCmap;
+ errstat err;
+
+ sunCmap.c_index = dex;
+ sunCmap.c_count = count;
+ sunCmap.c_red = &rmap[dex];
+ sunCmap.c_green = &gmap[dex];
+ sunCmap.c_blue = &bmap[dex];
+
+ if ((err = iop_setcmap(&iopcap, &sunCmap)) != STD_OK) {
+ ErrorF("Xsun: iop_setcmap failed: %s\n", err_why(err));
+ FatalError( "sunCGUpdateColormap: failed\n" );
+ }
+#endif
+}
+
+void sunInstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ register int i;
+ register Entry *pent;
+ register VisualPtr pVisual = cmap->pVisual;
+ u_char rmap[256], gmap[256], bmap[256];
+
+ if (cmap == pPrivate->installedMap)
+ return;
+ if (pPrivate->installedMap)
+ WalkTree(pPrivate->installedMap->pScreen, TellLostMap,
+ (pointer) &(pPrivate->installedMap->mid));
+ if ((pVisual->class | DynamicClass) == DirectColor) {
+ for (i = 0; i < 256; i++) {
+ rmap[i] = cmap->red[i].co.local.red >> 8;
+ gmap[i] = cmap->green[i].co.local.green >> 8;
+ bmap[i] = cmap->blue[i].co.local.blue >> 8;
+ }
+ } else {
+ for (i = 0, pent = cmap->red;
+ i < pVisual->ColormapEntries;
+ i++, pent++) {
+ if (pent->fShared) {
+ rmap[i] = pent->co.shco.red->color >> 8;
+ gmap[i] = pent->co.shco.green->color >> 8;
+ bmap[i] = pent->co.shco.blue->color >> 8;
+ }
+ else {
+ rmap[i] = pent->co.local.red >> 8;
+ gmap[i] = pent->co.local.green >> 8;
+ bmap[i] = pent->co.local.blue >> 8;
+ }
+ }
+ }
+ pPrivate->installedMap = cmap;
+ (*pPrivate->UpdateColormap) (cmap->pScreen, 0, 256, rmap, gmap, bmap);
+ WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid));
+}
+
+void sunUninstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ if (cmap == pPrivate->installedMap) {
+ Colormap defMapID = cmap->pScreen->defColormap;
+
+ if (cmap->mid != defMapID) {
+ ColormapPtr defMap = (ColormapPtr) LookupIDByType(defMapID,
+ RT_COLORMAP);
+
+ if (defMap)
+ (*cmap->pScreen->InstallColormap)(defMap);
+ else
+ ErrorF("sunFbs: Can't find default colormap\n");
+ }
+ }
+}
+
+int sunListInstalledColormaps(pScreen, pCmapList)
+ ScreenPtr pScreen;
+ Colormap *pCmapList;
+{
+ SetupScreen(pScreen);
+ *pCmapList = pPrivate->installedMap->mid;
+ return (1);
+}
+
+static void CGStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ SetupScreen(pmap->pScreen);
+ u_char rmap[256], gmap[256], bmap[256];
+ xColorItem expanddefs[256];
+ register int i;
+
+ if (pPrivate->installedMap != NULL && pPrivate->installedMap != pmap)
+ return;
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
+ ndef = cfbExpandDirectColors(pmap, ndef, pdefs, expanddefs);
+ pdefs = expanddefs;
+ }
+ while (ndef--) {
+ i = pdefs->pixel;
+ rmap[i] = pdefs->red >> 8;
+ gmap[i] = pdefs->green >> 8;
+ bmap[i] = pdefs->blue >> 8;
+ (*pPrivate->UpdateColormap) (pmap->pScreen, i, 1, rmap, gmap, bmap);
+ pdefs++;
+ }
+}
+
+static void CGScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+#ifndef STATIC_COLOR /* { */
+ SetupScreen (pScreen);
+ pScreen->InstallColormap = sunInstallColormap;
+ pScreen->UninstallColormap = sunUninstallColormap;
+ pScreen->ListInstalledColormaps = sunListInstalledColormaps;
+ pScreen->StoreColors = CGStoreColors;
+ pPrivate->UpdateColormap = CGUpdateColormap;
+ if (sunFlipPixels) {
+ Pixel pixel = pScreen->whitePixel;
+ pScreen->whitePixel = pScreen->blackPixel;
+ pScreen->blackPixel = pixel;
+ }
+#endif /* } */
+}
+
+static void checkMono (argc, argv)
+ int argc;
+ char** argv;
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-mono") == 0)
+ ErrorF ("-mono not appropriate for CG3/CG4/CG6\n");
+}
+
+/*
+ * CG3_MMAP_OFFSET is #defined in <pixrect/cg3var.h> or <sys/cg3var.h>
+ * on SunOS and Solaris respectively. Under Solaris, cg3var.h
+ * #includes a non-existent file, and causes the make to abort. Since all
+ * cg3var.h is needed for is this one #define, we'll just #define it here
+ * and let it go at that.
+ */
+
+#ifdef SVR4
+#define CG3_MMAP_OFFSET 0x04000000
+#else
+#include <pixrect/cg3var.h>
+#endif
+
+Bool sunCG3Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ checkMono (argc, argv);
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ return sunInitCommon (screen, pScreen, (off_t) CG3_MMAP_OFFSET,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, 0);
+}
+
+#ifndef i386 /* { */
+
+#ifdef SVR4
+#include <sys/cg2reg.h>
+#else
+#include <pixrect/cg2reg.h>
+#endif
+
+typedef struct {
+ struct cg2memfb mem;
+ struct cg2fb regs;
+} *CG2Ptr;
+
+static void CG2UpdateColormap(pScreen, index, count, rmap, gmap,bmap)
+ ScreenPtr pScreen;
+ int index, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb;
+#if __STDC__
+ volatile
+#endif
+ struct cg2statusreg *regp = &fb->regs.status.reg;
+
+ regp->update_cmap = 0;
+ while (count--) {
+ fb->regs.redmap[index] = rmap[index];
+ fb->regs.greenmap[index] = gmap[index];
+ fb->regs.bluemap[index] = bmap[index];
+ index++;
+ }
+ regp->update_cmap = 1;
+}
+
+static Bool CG2SaveScreen (pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+{
+ CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb;
+#if __STDC__
+ volatile
+#endif
+ struct cg2statusreg *regp = &fb->regs.status.reg;
+
+ if (on != SCREEN_SAVER_FORCER)
+ regp->video_enab = (on == SCREEN_SAVER_ON) ? 0 : 1;
+}
+
+static void CG2ScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+ CGScreenInit (pScreen);
+ pPrivate->UpdateColormap = CG2UpdateColormap;
+}
+
+Bool sunCG2Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ sunScreenPtr pPrivate;
+ int i;
+ Bool ret;
+ Bool mono = FALSE;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-mono") == 0)
+ mono = TRUE;
+
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ pScreen->SaveScreen = CG2SaveScreen;
+ if (mono) {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ ret = sunInitCommon (screen, pScreen, (off_t) 0,
+ mfbScreenInit, NULL,
+ mfbCreateDefColormap, CG2SaveScreen, 0);
+ ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 1;
+ } else {
+ ret = sunInitCommon (screen, pScreen, (off_t) 0,
+ sunCfbScreenInit, CG2ScreenInit,
+ cfbCreateDefColormap, CG2SaveScreen,
+ (int) &((struct cg2memfb *) 0)->pixplane);
+ ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 0xFF;
+ }
+ return ret;
+}
+
+#ifdef SVR4
+#include <sys/cg4reg.h>
+#else
+#include <sundev/cg4reg.h>
+#endif
+
+#define CG4_HEIGHT 900
+#define CG4_WIDTH 1152
+
+#define CG4_MELEN (128*1024)
+
+typedef struct {
+ u_char mpixel[CG4_MELEN]; /* bit-per-pixel memory */
+ u_char epixel[CG4_MELEN]; /* enable plane */
+ u_char cpixel[CG4_HEIGHT][CG4_WIDTH]; /* byte-per-pixel memory */
+} *CG4Ptr;
+
+static void CG4Switch (pScreen, select)
+ ScreenPtr pScreen;
+ int select;
+{
+ CG4Ptr fb = (CG4Ptr) sunFbs[pScreen->myNum].fb;
+
+ (void) memset ((char *)fb->epixel, select ? ~0 : 0, CG4_MELEN);
+}
+
+Bool sunCG4Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ checkMono (argc, argv);
+ if (sunCG4Frob)
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ else
+ sunFbs[screen].EnterLeave = CG4Switch;
+ return sunInitCommon (screen, pScreen, (off_t) 0,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, (int) ((CG4Ptr) 0)->cpixel);
+}
+
+#ifdef FBTYPE_SUNFAST_COLOR /* { */
+
+#define CG6_MMAP_OFFSET 0x70000000
+#define CG6_IMAGE_OFFSET 0x16000
+
+Bool sunCG6Init (screen, pScreen, argc, argv)
+ int screen; /* The index of pScreen in the ScreenInfo */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ pointer fb;
+
+ checkMono (argc, argv);
+ if (!sunScreenAllocate (pScreen))
+ return FALSE;
+#ifndef AMOEBA
+ if (!sunFbs[screen].fb) {
+/* Sun's VME, Sbus, and SVR4 drivers all return different values */
+#define FBSIZE (size_t) sunFbs[screen].info.fb_width * \
+ sunFbs[screen].info.fb_height + CG6_IMAGE_OFFSET
+ if ((fb = sunMemoryMap (FBSIZE,
+ (off_t) CG6_MMAP_OFFSET,
+ sunFbs[screen].fd)) == NULL)
+ return FALSE;
+ sunFbs[screen].fb = fb;
+#undef FBSIZE
+ }
+#endif
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ if (!sunCfbSetupScreen (pScreen,
+ sunFbs[screen].fb + CG6_IMAGE_OFFSET,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+#ifndef AMOEBA
+ if (!sunGXInit (pScreen, &sunFbs[screen]))
+ return FALSE;
+#endif
+ if (!sunCfbFinishScreenInit(pScreen,
+ sunFbs[screen].fb + CG6_IMAGE_OFFSET,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+ miInitializeBackingStore(pScreen);
+ CGScreenInit (pScreen);
+ if (!sunScreenInit (pScreen))
+ return FALSE;
+ sunSaveScreen (pScreen, SCREEN_SAVER_OFF);
+ return cfbCreateDefColormap(pScreen);
+}
+#endif /* } */
+#endif /* } */
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c b/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c
new file mode 100644
index 000000000..37cd223fb
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c
@@ -0,0 +1,250 @@
+/* $XConsortium: sunCursor.c,v 5.17 94/04/01 17:55:24 dpw Exp $ */
+/*-
+ * sunCursor.c --
+ * Functions for maintaining the Sun software cursor...
+ *
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+#ifdef AMOEBA
+#undef FBIOGCURMAX /* software cursor only, currently */
+#endif
+
+#ifdef FBIOGCURMAX /* has hardware cursor kernel support */
+
+#define GetCursorPrivate(s) (&(GetScreenPrivate(s)->hardwareCursor))
+#define SetupCursor(s) sunCursorPtr pCurPriv = GetCursorPrivate(s)
+
+static void sunLoadCursor();
+
+static Bool
+sunRealizeCursor (pScreen, pCursor)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ SetupCursor(pScreen);
+ int x, y;
+
+ /* miRecolorCursor does this */
+ if (pCurPriv->pCursor == pCursor)
+ {
+ miPointerPosition (&x, &y);
+ sunLoadCursor (pScreen, pCursor, x, y);
+ }
+ return TRUE;
+}
+
+static Bool
+sunUnrealizeCursor (pScreen, pCursor)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+{
+ return TRUE;
+}
+
+static void
+sunCursorRepad (pScreen, bits, src_bits, dst_bits, ptSrc, w, h)
+ ScreenPtr pScreen;
+ CursorBitsPtr bits;
+ unsigned char *src_bits, *dst_bits;
+ DDXPointPtr ptSrc;
+ int w, h;
+{
+ SetupCursor(pScreen);
+ PixmapPtr src, dst;
+ BoxRec box;
+ RegionRec rgnDst;
+ extern int mfbDoBitblt();
+
+ if (!(src = GetScratchPixmapHeader(pScreen, bits->width, bits->height,
+ /*bpp*/ 1, /*depth*/ 1,
+ PixmapBytePad(bits->width,1), src_bits)))
+ return;
+ if (!(dst = GetScratchPixmapHeader(pScreen, w, h, /*bpp*/ 1, /*depth*/ 1,
+ PixmapBytePad(w,1), dst_bits)))
+ {
+ FreeScratchPixmapHeader(src);
+ return;
+ }
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+ mfbDoBitblt(src, dst, GXcopy, &rgnDst, ptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+ FreeScratchPixmapHeader(src);
+ FreeScratchPixmapHeader(dst);
+}
+
+static void
+sunLoadCursor (pScreen, pCursor, x, y)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ int x, y;
+{
+ SetupCursor(pScreen);
+ struct fbcursor fbcursor;
+ int w, h;
+ unsigned char r[2], g[2], b[2];
+ DDXPointRec ptSrc;
+ unsigned char source_temp[1024], mask_temp[1024];
+
+ fbcursor.set = FB_CUR_SETALL;
+ fbcursor.enable = 1;
+ fbcursor.pos.x = x;
+ fbcursor.pos.y = y;
+ fbcursor.hot.x = pCursor->bits->xhot;
+ fbcursor.hot.y = pCursor->bits->yhot;
+ r[0] = pCursor->backRed >> 8;
+ g[0] = pCursor->backGreen >> 8;
+ b[0] = pCursor->backBlue >> 8;
+ r[1] = pCursor->foreRed >> 8;
+ g[1] = pCursor->foreGreen >> 8;
+ b[1] = pCursor->foreBlue >> 8;
+ fbcursor.cmap.index = 0;
+ fbcursor.cmap.count = 2;
+ fbcursor.cmap.red = r;
+ fbcursor.cmap.green = g;
+ fbcursor.cmap.blue = b;
+ fbcursor.image = (char *) pCursor->bits->source;
+ fbcursor.mask = (char *) pCursor->bits->mask;
+ w = pCursor->bits->width;
+ h = pCursor->bits->height;
+ if (w > pCurPriv->width || h > pCurPriv->height) {
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ if (w > pCurPriv->width)
+ w = pCurPriv->width;
+ if (h > pCurPriv->height)
+ h = pCurPriv->height;
+ sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->source,
+ source_temp, &ptSrc, w, h);
+ sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->mask,
+ mask_temp, &ptSrc, w, h);
+ fbcursor.image = (char *) source_temp;
+ fbcursor.mask = (char *) mask_temp;
+ }
+ fbcursor.size.x = w;
+ fbcursor.size.y = h;
+ (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor);
+}
+
+static void
+sunSetCursor (pScreen, pCursor, x, y)
+ ScreenPtr pScreen;
+ CursorPtr pCursor;
+ int x, y;
+{
+ SetupCursor(pScreen);
+
+ if (pCursor)
+ sunLoadCursor (pScreen, pCursor, x, y);
+ else
+ sunDisableCursor (pScreen);
+ pCurPriv->pCursor = pCursor;
+}
+
+static void
+sunMoveCursor (pScreen, x, y)
+ ScreenPtr pScreen;
+ int x, y;
+{
+ SetupCursor(pScreen);
+ struct fbcurpos pos;
+
+ pos.x = x;
+ pos.y = y;
+ ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURPOS, &pos);
+}
+
+miPointerSpriteFuncRec sunPointerSpriteFuncs = {
+ sunRealizeCursor,
+ sunUnrealizeCursor,
+ sunSetCursor,
+ sunMoveCursor,
+};
+
+static void
+sunQueryBestSize (class, pwidth, pheight, pScreen)
+ int class;
+ unsigned short *pwidth, *pheight;
+ ScreenPtr pScreen;
+{
+ SetupCursor (pScreen);
+
+ switch (class)
+ {
+ case CursorShape:
+ if (*pwidth > pCurPriv->width)
+ *pwidth = pCurPriv->width;
+ if (*pheight > pCurPriv->height)
+ *pheight = pCurPriv->height;
+ if (*pwidth > pScreen->width)
+ *pwidth = pScreen->width;
+ if (*pheight > pScreen->height)
+ *pheight = pScreen->height;
+ break;
+ default:
+ mfbQueryBestSize (class, pwidth, pheight, pScreen);
+ break;
+ }
+}
+
+extern miPointerScreenFuncRec sunPointerScreenFuncs;
+
+#endif
+
+#if NeedFunctionPrototypes
+Bool sunCursorInitialize (
+ ScreenPtr pScreen)
+#else
+Bool sunCursorInitialize (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+#ifdef FBIOGCURMAX
+ SetupCursor (pScreen);
+ struct fbcurpos maxsize;
+
+ pCurPriv->has_cursor = FALSE;
+ if (ioctl (sunFbs[pScreen->myNum].fd, FBIOGCURMAX, &maxsize) == -1)
+ return FALSE;
+ pCurPriv->width = maxsize.x;
+ pCurPriv->height= maxsize.y;
+ pScreen->QueryBestSize = sunQueryBestSize;
+ miPointerInitialize (pScreen,
+ &sunPointerSpriteFuncs,
+ &sunPointerScreenFuncs,
+ FALSE);
+ pCurPriv->has_cursor = TRUE;
+ pCurPriv->pCursor = NULL;
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+#if NeedFunctionPrototypes
+void sunDisableCursor (
+ ScreenPtr pScreen)
+#else
+void sunDisableCursor (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+#ifdef FBIOGCURMAX
+ SetupCursor (pScreen);
+ struct fbcursor fbcursor;
+
+ if (pCurPriv->has_cursor)
+ {
+ fbcursor.set = FB_CUR_SETCUR;
+ fbcursor.enable = 0;
+ (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor);
+ pCurPriv->pCursor = NULL;
+ }
+#endif
+}
diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c b/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c
new file mode 100644
index 000000000..29bbd63b9
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c
@@ -0,0 +1,304 @@
+
+/* $TOG: sunFbs.c /main/3 1998/02/10 13:18:13 kaleb $ */
+
+/*
+Copyright 1990, 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunFbs.c,v 1.3 1998/10/04 09:38:42 dawes Exp $ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+#include "sun.h"
+#include <sys/mman.h>
+
+int sunScreenIndex;
+
+static unsigned long generation = 0;
+
+#ifndef AMOEBA
+
+#if NeedFunctionPrototypes
+pointer sunMemoryMap (
+ size_t len,
+ off_t off,
+ int fd)
+#else
+pointer sunMemoryMap (len, off, fd)
+ size_t len;
+ off_t off;
+ int fd;
+#endif
+{
+ int pagemask, mapsize;
+ caddr_t addr;
+ pointer mapaddr;
+
+#ifdef SVR4
+ pagemask = sysconf(_SC_PAGESIZE) - 1;
+#else
+ pagemask = getpagesize() - 1;
+#endif
+ mapsize = ((int) len + pagemask) & ~pagemask;
+ addr = 0;
+
+#ifndef _MAP_NEW
+ if ((addr = (caddr_t) valloc (mapsize)) == NULL) {
+ Error ("Couldn't allocate frame buffer memory");
+ (void) close (fd);
+ return NULL;
+ }
+#endif
+
+ /*
+ * try and make it private first, that way once we get it, an
+ * interloper, e.g. another server, can't get this frame buffer,
+ * and if another server already has it, this one won't.
+ */
+ if ((int)(mapaddr = (pointer) mmap (addr,
+ mapsize,
+ PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ fd, off)) == -1)
+ mapaddr = (pointer) mmap (addr,
+ mapsize,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, off);
+ if (mapaddr == (pointer) -1) {
+ Error ("mapping frame buffer memory");
+ (void) close (fd);
+ mapaddr = (pointer) NULL;
+ }
+ return mapaddr;
+}
+
+#endif /* AMOEBA */
+
+#if NeedFunctionPrototypes
+Bool sunScreenAllocate (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenAllocate (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ sunScreenPtr pPrivate;
+ extern int AllocateScreenPrivateIndex();
+
+ if (generation != serverGeneration)
+ {
+ sunScreenIndex = AllocateScreenPrivateIndex();
+ if (sunScreenIndex < 0)
+ return FALSE;
+ generation = serverGeneration;
+ }
+ pPrivate = (sunScreenPtr) xalloc (sizeof (sunScreenRec));
+ if (!pPrivate)
+ return FALSE;
+
+ pScreen->devPrivates[sunScreenIndex].ptr = (pointer) pPrivate;
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunSaveScreen (
+ ScreenPtr pScreen,
+ int on)
+#else
+Bool sunSaveScreen (pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+#endif
+{
+#ifndef AMOEBA
+ int state;
+
+ if (on != SCREEN_SAVER_FORCER)
+ {
+ if (on == SCREEN_SAVER_ON)
+ state = 0;
+ else
+ state = 1;
+ (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
+ }
+ return( TRUE );
+#else
+ if (on != SCREEN_SAVER_ON) {
+ SetTimeSinceLastInputEvent();
+ return TRUE;
+ } else {
+ /* Return false to force screen saving in software */
+ return FALSE;
+ }
+#endif
+}
+
+static Bool closeScreen (i, pScreen)
+ int i;
+ ScreenPtr pScreen;
+{
+ SetupScreen(pScreen);
+ Bool ret;
+
+#ifndef AMOEBA
+ (void) OsSignal (SIGIO, SIG_IGN);
+#endif
+ sunDisableCursor (pScreen);
+ pScreen->CloseScreen = pPrivate->CloseScreen;
+ ret = (*pScreen->CloseScreen) (i, pScreen);
+ (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ xfree ((pointer) pPrivate);
+ return ret;
+}
+
+#if NeedFunctionPrototypes
+Bool sunScreenInit (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenInit (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ SetupScreen(pScreen);
+#ifndef XKB
+ extern void sunBlockHandler();
+ extern void sunWakeupHandler();
+ static ScreenPtr autoRepeatScreen;
+#endif
+ extern miPointerScreenFuncRec sunPointerScreenFuncs;
+
+ pPrivate->installedMap = 0;
+ pPrivate->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = closeScreen;
+ pScreen->SaveScreen = sunSaveScreen;
+#ifndef XKB
+ /*
+ * Block/Unblock handlers
+ */
+ if (sunAutoRepeatHandlersInstalled == FALSE) {
+ autoRepeatScreen = pScreen;
+ sunAutoRepeatHandlersInstalled = TRUE;
+ }
+
+ if (pScreen == autoRepeatScreen) {
+ pScreen->BlockHandler = sunBlockHandler;
+ pScreen->WakeupHandler = sunWakeupHandler;
+ }
+#endif
+ if (!sunCursorInitialize (pScreen))
+ miDCInitialize (pScreen, &sunPointerScreenFuncs);
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunInitCommon (
+ int scrn,
+ ScreenPtr pScrn,
+ off_t offset,
+ Bool (*init1)(),
+ void (*init2)(),
+ Bool (*cr_cm)(),
+ Bool (*save)(),
+ int fb_off)
+#else
+Bool sunInitCommon (scrn, pScrn, offset, init1, init2, cr_cm, save, fb_off)
+ int scrn;
+ ScreenPtr pScrn;
+ off_t offset;
+ Bool (*init1)();
+ void (*init2)();
+ Bool (*cr_cm)();
+ Bool (*save)();
+ int fb_off;
+#endif
+{
+ unsigned char* fb = sunFbs[scrn].fb;
+
+ if (!sunScreenAllocate (pScrn))
+ return FALSE;
+#ifndef AMOEBA
+ if (!fb) {
+ if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size,
+ offset,
+ sunFbs[scrn].fd)) == NULL)
+ return FALSE;
+ sunFbs[scrn].fb = fb;
+ }
+#endif
+ /* mfbScreenInit() or cfbScreenInit() */
+ if (!(*init1)(pScrn, fb + fb_off,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_depth))
+ return FALSE;
+ miInitializeBackingStore(pScrn);
+ /* sunCGScreenInit() if cfb... */
+ if (init2)
+ (*init2)(pScrn);
+ if (!sunScreenInit(pScrn))
+ return FALSE;
+ (void) (*save) (pScrn, SCREEN_SAVER_OFF);
+ return (*cr_cm)(pScrn);
+}
+
diff --git a/xc/programs/Xserver/hw/sunLynx/Imakefile b/xc/programs/Xserver/hw/sunLynx/Imakefile
new file mode 100644
index 000000000..e1ce09829
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/Imakefile
@@ -0,0 +1,77 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/10/31 14:20:29 kaleb $
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/sunLynx/Imakefile,v 3.1 1996/12/27 06:51:30 dawes Exp $
+#include <Server.tmpl>
+
+SRCS1 = sunLyInit.c \
+ sunLyIo.c \
+ sunLyUtil.c \
+ sunLyMouse.c\
+ sunLyCfb.c \
+ sunLyFbs.c \
+ sunLyKbd.c \
+ sunCursor.c \
+ sunMfb.c \
+ sunGX.c \
+ sunKeyMap.c
+
+XCOMM SRCS = $(SRCS1) kbd_mode.c constype.c
+SRCS = $(SRCS1)
+
+#if XsunLynxMonoServer
+OFILES = sunInitMono.o sunInExMono.o
+#endif
+
+OBJS = sunLyInit.o \
+ sunLyIo.o \
+ sunLyUtil.o \
+ sunLyMouse.o\
+ sunLyCfb.o \
+ sunLyFbs.o \
+ sunLyKbd.o \
+ sunCursor.o \
+ sunMfb.o \
+ sunGX.o \
+ sunKeyMap.o
+
+ INCLUDES = -I. -I../.. -I../../mi -I../../mfb -I../../cfb -I../../cfb32 \
+ -I../../include -I../../os -I$(XINCLUDESRC) -I$(FONTINCSRC)
+ LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln
+
+NormalLibraryObjectRule()
+
+XCOMM all:: $(OFILES) kbd_mode constype
+all:: $(OFILES)
+
+lintlib:
+
+NormalLibraryTarget(sun,$(OBJS))
+NormalLintTarget($(SRCS1))
+
+sunInExMono.o: $(ICONFIGFILES)
+ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,$(EXT_DEFINES) -UXIEEXT -UPEXEXT -UXF86VIDMODE)
+ObjectFromSpecialSource(sunInitMono,sunLyInit,-DSUNMAXDEPTH=1)
+
+#if 0
+SingleProgramTarget(kbd_mode, kbd_mode.o,,)
+SingleProgramTarget(constype, constype.o,,)
+InstallProgram(kbd_mode,$(BINDIR))
+InstallProgram(constype,$(BINDIR))
+InstallManPage(kbd_mode,$(MANDIR))
+InstallManPage(constype,$(MANDIR))
+InstallManPage(Xsun,$(MANDIR))
+InstallManPageAliases(Xsun,$(MANDIR),XsunMono)
+#endif
+
+LinkSourceFile(sunGX.h,../sun)
+LinkSourceFile(circleset.h,../sun)
+ObjectFromSpecialSource(sunKeyMap,../sun/sunKeyMap,/**/)
+ObjectFromSpecialSource(sunMfb,../sun/sunMfb,/**/)
+ObjectFromSpecialSource(sunGX,../sun/sunGX,/**/)
+ObjectFromSpecialSource(sunCursor,../sun/sunCursor,/**/)
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/hw/sunLynx/btreg.h b/xc/programs/Xserver/hw/sunLynx/btreg.h
new file mode 100644
index 000000000..e73456bc4
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/btreg.h
@@ -0,0 +1,85 @@
+/* $XConsortium: btreg.h /main/1 1996/10/31 14:20:32 kaleb $ */
+
+
+
+/* $NetBSD: btreg.h,v 1.2 1994/11/20 20:51:55 deraadt Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/btreg.h,v 3.1 1996/12/27 06:51:31 dawes Exp $ */
+
+/*
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)btreg.h 8.2 (Berkeley) 1/21/94
+ */
+
+/*
+ * Several Sun color frame buffers use some kind of Brooktree video
+ * DAC (e.g., the Bt458, -- in any case, Brooktree make the only
+ * decent color frame buffer chips).
+ *
+ * Color map control on these is a bit funky in a SPARCstation.
+ * To update the color map one would normally do byte writes, but
+ * the hardware takes longword writes. Since there are three
+ * registers for each color map entry (R, then G, then B), we have
+ * to set color 1 with a write to address 0 (setting 0's R/G/B and
+ * color 1's R) followed by a second write to address 1 (setting
+ * color 1's G/B and color 2's R/G). Software must therefore keep
+ * a copy of the current map.
+ *
+ * The colormap address register increments automatically, so the
+ * above write is done as:
+ *
+ * bt->bt_addr = 0;
+ * bt->bt_cmap = R0G0B0R1;
+ * bt->bt_cmap = G1B1R2G2;
+ * ...
+ *
+ * Yow!
+ *
+ * Bonus complication: on the cg6, only the top 8 bits of each 32 bit
+ * register matter, even though the cg3 takes all the bits from all
+ * bytes written to it.
+ */
+struct bt_regs {
+ u_int bt_addr; /* map address register */
+ u_int bt_cmap; /* colormap data register */
+ u_int bt_ctrl; /* control register */
+ u_int bt_omap; /* overlay (cursor) map register */
+};
diff --git a/xc/programs/Xserver/hw/sunLynx/btvar.h b/xc/programs/Xserver/hw/sunLynx/btvar.h
new file mode 100644
index 000000000..2beb9d2b3
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/btvar.h
@@ -0,0 +1,78 @@
+/* $XConsortium: btvar.h /main/1 1996/10/31 14:20:34 kaleb $ */
+
+
+
+/* $NetBSD: btvar.h,v 1.2 1994/11/20 20:51:56 deraadt Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/btvar.h,v 3.1 1996/12/27 06:51:32 dawes Exp $ */
+
+/*
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)btvar.h 8.2 (Berkeley) 1/21/94
+ */
+
+/*
+ * Brooktree color frame buffer state variables (see btreg.h).
+ *
+ * Unfortunately, remarkably little code can be shared between the
+ * cg3 and cg6 drivers here, as the cg3 registers do longword-ops
+ * `as expected', but the cg6 ones use only the upper byte.
+ *
+ * Still, the software color map manipulation is not completely trivial.
+ */
+union bt_cmap {
+ u_char cm_map[256][3]; /* 256 R/G/B entries */
+ u_int cm_chip[256 * 3 / 4]; /* the way the chip gets loaded */
+};
+
+/*
+ * Routines in bt_subr.c.
+ */
+int bt_getcmap __P((struct fbcmap *, union bt_cmap *, int));
+int bt_putcmap __P((struct fbcmap *, union bt_cmap *, int));
+
+/*
+ * Compute (x / 4) * 3 and (x / 4) * 4. These are used in turning
+ * RGB indices (which are in multiples of three) into `chip RGB' values
+ * (which are in multiples of four).
+ */
+#define BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2)) /* (x / 4) * 3 */
+#define BT_D4M4(x) ((x) & ~3) /* (x / 4) * 4 */
diff --git a/xc/programs/Xserver/hw/sunLynx/cgsixreg.h b/xc/programs/Xserver/hw/sunLynx/cgsixreg.h
new file mode 100644
index 000000000..d64f26f81
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/cgsixreg.h
@@ -0,0 +1,210 @@
+/* $XConsortium: cgsixreg.h /main/1 1996/10/31 14:20:36 kaleb $ */
+
+
+
+/* $NetBSD: cgsixreg.h,v 1.3 1994/11/20 20:52:00 deraadt Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/cgsixreg.h,v 3.1 1996/12/27 06:51:33 dawes Exp $ */
+
+/*
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)cgsixreg.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * CG6 display registers. (Note, I got tired of writing `cgsix' about
+ * halfway through and changed everything to cg6, but I probably missed
+ * some. Unfortunately, the way config works, we need to spell out `six'
+ * in some places anyway.)
+ *
+ * The cg6 is a complicated beastie. We have been unable to extract any
+ * documentation and most of the following are guesses based on a limited
+ * amount of reverse engineering.
+ *
+ * A cg6 is composed of numerous groups of control registers, all with TLAs:
+ * FBC - frame buffer control?
+ * FHC - fbc hardware configuration / control? register (32 bits)
+ * DHC - ???
+ * TEC - transform engine control?
+ * THC - TEC Hardware Configuration
+ * ROM - a 64Kbyte ROM with who knows what in it.
+ * colormap - see below
+ * frame buffer memory (video RAM)
+ * possible other stuff
+ *
+ * Like the cg3, the cg6 uses a Brooktree Video DAC (see btreg.h).
+ *
+ * Various revisions of the cgsix have various hardware bugs. So far,
+ * we have only seen rev 1 & 2.
+ */
+
+/* bits in FHC register */
+#define FHC_FBID_MASK 0xff000000 /* bits 24..31 are frame buffer ID */
+#define FHC_FBID_SHIFT 24
+#define FHC_REV_MASK 0x00f00000 /* bits 20..23 are revision */
+#define FHC_REV_SHIFT 20
+#define FHC_FROP_DISABLE 0x00080000 /* disable fast/font? rasterops */
+#define FHC_ROW_DISABLE 0x00040000 /* ??? */
+#define FHC_SRC_DISABLE 0x00020000 /* ??? */
+#define FHC_DST_DISABLE 0x00010000 /* disable destination cache */
+#define FHC_RESET 0x00008000 /* ??? */
+#define FHC_XXX0 0x00004000 /* ??? */
+#define FHC_LEBO 0x00002000 /* set little endian byte order? */
+#define FHC_RES_MASK 0x00001800 /* bits 11&12 are resolution */
+#define FHC_RES_1024 0x00000000 /* res = 1024x768 */
+#define FHC_RES_1152 0x00000800 /* res = 1152x900 */
+#define FHC_RES_1280 0x00001000 /* res = 1280x1024 */
+#define FHC_RES_1600 0x00001800 /* res = 1600x1200 */
+#define FHC_CPU_MASK 0x00000600 /* bits 9&10 are cpu type */
+#define FHC_CPU_SPARC 0x00000000 /* cpu = sparc */
+#define FHC_CPU_68020 0x00000200 /* cpu = 68020 */
+#define FHC_CPU_386 0x00000400 /* cpu = 80386 */
+#define FHC_CPU_XXX 0x00000600 /* ??? */
+#define FHC_TEST 0x00000100 /* ??? test window ??? */
+#define FHC_TESTX_MASK 0x000000f0 /* bits 4..7 are test window X */
+#define FHC_TESTX_SHIFT 4
+#define FHC_TESTY_MASK 0x0000000f /* bits 0..3 are test window Y */
+#define FHC_TESTY_SHIFT 0
+
+/*
+ * The layout of the THC.
+ */
+struct cg6_thc {
+ u_int thc_xxx0[512]; /* ??? */
+ u_int thc_hsync1; /* horizontal sync timing */
+ u_int thc_hsync2; /* more hsync timing */
+ u_int thc_hsync3; /* yet more hsync timing */
+ u_int thc_vsync1; /* vertical sync timing */
+ u_int thc_vsync2; /* only two of these */
+ u_int thc_refresh; /* refresh counter */
+ u_int thc_misc; /* miscellaneous control & status */
+ u_int thc_xxx1[56]; /* ??? */
+ u_int thc_cursxy; /* cursor x,y position (16 bits each) */
+ u_int thc_cursmask[32]; /* cursor mask bits */
+ u_int thc_cursbits[32]; /* what to show where mask enabled */
+};
+
+/* bits in thc_misc */
+#define THC_MISC_XXX0 0xfff00000 /* unused */
+#define THC_MISC_REVMASK 0x000f0000 /* cg6 revision? */
+#define THC_MISC_REVSHIFT 16
+#define THC_MISC_XXX1 0x0000e000 /* unused */
+#define THC_MISC_RESET 0x00001000 /* ??? */
+#define THC_MISC_XXX2 0x00000800 /* unused */
+#define THC_MISC_VIDEN 0x00000400 /* video enable */
+#define THC_MISC_SYNC 0x00000200 /* not sure what ... */
+#define THC_MISC_VSYNC 0x00000100 /* ... these really are */
+#define THC_MISC_SYNCEN 0x00000080 /* sync enable */
+#define THC_MISC_CURSRES 0x00000040 /* cursor resolution */
+#define THC_MISC_INTEN 0x00000020 /* v.retrace intr enable */
+#define THC_MISC_INTR 0x00000010 /* intr pending / ack bit */
+#define THC_MISC_XXX 0x0000000f /* ??? */
+
+/* cursor x / y position value for `off' */
+#define THC_CURSOFF (65536-32) /* i.e., USHRT_MAX+1-32 */
+
+/*
+ * Partial description of TEC (needed to get around FHC rev 1 bugs).
+ */
+struct cg6_tec_xxx {
+ u_int tec_mv; /* matrix stuff */
+ u_int tec_clip; /* clipping stuff */
+ u_int tec_vdc; /* ??? */
+};
+
+/*
+ * This structure exists only to compute the layout of the CG6
+ * hardware. Each of the individual substructures lives on a
+ * separate `page' (where a `page' is at least 4K), and many are
+ * very far apart. We avoid large offsets (which make for lousy
+ * code) by using pointers to the individual interesting pieces,
+ * and map them in independently (to avoid using up PTEs unnecessarily).
+ */
+struct cg6_layout {
+ /* ROM at 0 */
+ union {
+ long un_id; /* ID = ?? */
+ char un_rom[65536]; /* 64K rom */
+ char un_pad[0x200000];
+ } cg6_rom_un;
+
+ /* Brooktree DAC at 0x200000 */
+ union {
+ struct bt_regs un_btregs;
+ char un_pad[0x040000];
+ } cg6_bt_un;
+
+ /* DHC, whatever that is, at 0x240000 */
+ union {
+ char un_pad[0x40000];
+ } cg6_dhc_un;
+
+ /* ALT, whatever that is, at 0x280000 */
+ union {
+ char un_pad[0x80000];
+ } cg6_alt_un;
+
+ /* FHC register at 0x300000 */
+ union {
+ int un_fhc;
+ char un_pad[0x1000];
+ } cg6_fhc_un;
+
+ /* THC at 0x301000 */
+ union {
+ struct cg6_thc un_thc;
+ char un_pad[0x400000 - 0x1000];
+ } cg6_thc_un;
+
+ /* FBC at 0x700000 */
+ union {
+ char un_pad[0x1000];
+ } cg6_fbc_un;
+
+ /* TEC at 0x701000 */
+ union {
+ char un_pad[0x100000 - 0x1000];
+ struct cg6_tec_xxx un_tec;
+ } cg6_tec_un;
+
+ /* Video RAM at 0x800000 */
+ char cg6_ram[1024 * 1024]; /* approx.? */
+};
diff --git a/xc/programs/Xserver/hw/sunLynx/fbio.h b/xc/programs/Xserver/hw/sunLynx/fbio.h
new file mode 100644
index 000000000..cd991f590
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/fbio.h
@@ -0,0 +1,190 @@
+/* $XConsortium: fbio.h /main/1 1996/10/31 14:20:38 kaleb $ */
+
+
+
+/* $NetBSD: fbio.h,v 1.3 1994/11/20 20:53:03 deraadt Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/fbio.h,v 3.1 1996/12/27 06:51:34 dawes Exp $ */
+
+/*
+ * Copyright (c) 1992 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software developed by the Computer Systems
+ * Engineering group at Lawrence Berkeley Laboratory under DARPA
+ * contract BG 91-66 and contributed to Berkeley.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fbio.h 7.2 (Berkeley) 4/1/92
+ */
+
+/*
+ * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
+ */
+
+/*
+ * Frame buffer type codes.
+ */
+#define FBTYPE_SUN1BW 0 /* multibus mono */
+#define FBTYPE_SUN1COLOR 1 /* multibus color */
+#define FBTYPE_SUN2BW 2 /* memory mono */
+#define FBTYPE_SUN2COLOR 3 /* color w/rasterop chips */
+#define FBTYPE_SUN2GP 4 /* GP1/GP2 */
+#define FBTYPE_SUN5COLOR 5 /* RoadRunner accelerator */
+#define FBTYPE_SUN3COLOR 6 /* memory color */
+#define FBTYPE_MEMCOLOR 7 /* memory 24-bit */
+#define FBTYPE_SUN4COLOR 8 /* memory color w/overlay */
+
+#define FBTYPE_NOTSUN1 9 /* reserved for customer */
+#define FBTYPE_NOTSUN2 10 /* reserved for customer */
+#define FBTYPE_NOTSUN3 11 /* reserved for customer */
+
+#define FBTYPE_SUNFAST_COLOR 12 /* accelerated 8bit */
+#define FBTYPE_SUNROP_COLOR 13 /* MEMCOLOR with rop h/w */
+#define FBTYPE_SUNFB_VIDEO 14 /* Simple video mixing */
+#define FBTYPE_RESERVED5 15 /* reserved, do not use */
+#define FBTYPE_RESERVED4 16 /* reserved, do not use */
+#define FBTYPE_RESERVED3 17 /* reserved, do not use */
+#define FBTYPE_RESERVED2 18 /* reserved, do not use */
+#define FBTYPE_RESERVED1 19 /* reserved, do not use */
+
+#define FBTYPE_LASTPLUSONE 20 /* max number of fbs (change as add) */
+
+/*
+ * Frame buffer descriptor as returned by FBIOGTYPE.
+ */
+struct fbtype {
+ int fb_type; /* as defined above */
+ int fb_height; /* in pixels */
+ int fb_width; /* in pixels */
+ int fb_depth; /* bits per pixel */
+ int fb_cmsize; /* size of color map (entries) */
+ int fb_size; /* total size in bytes */
+};
+#define FBIOGTYPE _IOR('F', 0, struct fbtype)
+
+#ifdef notdef
+/*
+ * General purpose structure for passing info in and out of frame buffers
+ * (used for gp1) -- unsupported.
+ */
+struct fbinfo {
+ int fb_physaddr; /* physical frame buffer address */
+ int fb_hwwidth; /* fb board width */
+ int fb_hwheight; /* fb board height */
+ int fb_addrdelta; /* phys addr diff between boards */
+ u_char *fb_ropaddr; /* fb virtual addr */
+ int fb_unit; /* minor devnum of fb */
+};
+#define FBIOGINFO _IOR('F', 2, struct fbinfo)
+#endif
+
+/*
+ * Color map I/O.
+ */
+struct fbcmap {
+ int index; /* first element (0 origin) */
+ int count; /* number of elements */
+ u_char *red; /* red color map elements */
+ u_char *green; /* green color map elements */
+ u_char *blue; /* blue color map elements */
+};
+#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
+#define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
+
+/*
+ * Set/get attributes.
+ */
+#define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */
+#define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */
+
+struct fbsattr {
+ int flags; /* flags; see below */
+ int emu_type; /* emulation type (-1 if unused) */
+ int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */
+};
+#define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */
+#define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */
+
+struct fbgattr {
+ int real_type; /* real device type */
+ int owner; /* PID of owner, 0 if myself */
+ struct fbtype fbtype; /* fbtype info for real device */
+ struct fbsattr sattr; /* see above */
+ int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */
+ /* (-1 if unused) */
+};
+/* FBIOSATTR _IOW('F', 5, struct fbsattr) -- unsupported */
+#define FBIOGATTR _IOR('F', 6, struct fbgattr)
+
+/*
+ * Video control.
+ */
+#define FBVIDEO_OFF 0
+#define FBVIDEO_ON 1
+
+#define FBIOSVIDEO _IOW('F', 7, int)
+#define FBIOGVIDEO _IOR('F', 8, int)
+
+/*
+ * hardware cursor control
+ */
+struct fbcurpos {
+ short x;
+ short y;
+};
+
+#define FB_CUR_SETCUR 0x01
+#define FB_CUR_SETPOS 0x02
+#define FB_CUR_SETHOT 0x04
+#define FB_CUR_SETCMAP 0x08
+#define FB_CUR_SETSHAPE 0x10
+#define FB_CUR_SETALL 0x1F
+
+struct fbcursor {
+ short set; /* what to set */
+ short enable; /* enable/disable cursor */
+ struct fbcurpos pos; /* cursor's position */
+ struct fbcurpos hot; /* cursor's hot spot */
+ struct fbcmap cmap; /* color map info */
+ struct fbcurpos size; /* cursor's bit map size */
+ char *image; /* cursor's image bits */
+ char *mask; /* cursor's mask bits */
+};
+
+/* set/get cursor attributes/shape */
+#define FBIOSCURSOR _IOW('F', 24, struct fbcursor)
+#define FBIOGCURSOR _IOWR('F', 25, struct fbcursor)
+
+/* set/get cursor position */
+#define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
+#define FBIOGCURPOS _IOW('F', 27, struct fbcurpos)
+
+/* get max cursor size */
+#define FBIOGCURMAX _IOR('F', 28, struct fbcurpos)
diff --git a/xc/programs/Xserver/hw/sunLynx/patch.Console b/xc/programs/Xserver/hw/sunLynx/patch.Console
new file mode 100644
index 000000000..58a2d80f3
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/patch.Console
@@ -0,0 +1,428 @@
+diff -crP /cdrom/usr/include/kbd.h /usr/include/kbd.h
+*** /cdrom/usr/include/kbd.h Wed Dec 31 16:00:00 1969
+--- /usr/include/kbd.h Sun May 11 23:22:45 1997
+***************
+*** 0 ****
+--- 1,90 ----
++ /* $NetBSD: kbd.h,v 1.4 1995/07/06 05:36:29 pk Exp $ */
++
++ /*
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * This software was developed by the Computer Systems Engineering group
++ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
++ * contributed to Berkeley.
++ *
++ * All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Lawrence Berkeley Laboratory.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)kbd.h 8.1 (Berkeley) 6/11/93
++ */
++
++ /*
++ * Keyboard `registers'. (This should be called kbd_reg.h but we need to
++ * be compatible.)
++ */
++
++ /*
++ * Control codes sent from type 2, 3, and 4 keyboards.
++ *
++ * Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not.
++ * KBD_IDLE does not take the place of any `up' transitions (it merely occurs
++ * after them).
++ */
++ #define KBD_RESET 0xff /* keyboard `reset' response */
++ #define KBD_IDLE 0x7f /* keyboard `all keys are up' code */
++ #define KBD_LAYOUT 0xfe /* keyboard `get layout' response */
++
++ /* Keyboard IDs */
++ #define KB_SUN2 2 /* type 2 keyboard */
++ #define KB_SUN3 3 /* type 3 keyboard */
++ #define KB_SUN4 4 /* type 4 keyboard */
++
++ /* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */
++ #define KBD_KEYMASK 0x7f /* keyboard key mask */
++ #define KBD_UP 0x80 /* keyboard `up' transition */
++
++ /* Keyboard codes needed to recognize the L1-A sequence */
++ #define KBD_L1 1 /* keyboard code for `L1' key */
++ #define KBD_A 77 /* keyboard code for `A' key */
++
++ /* Control codes sent to the various keyboards */
++ #define KBD_CMD_RESET 1 /* reset keyboard */
++ #define KBD_CMD_BELL 2 /* turn bell on */
++ #define KBD_CMD_NOBELL 3 /* turn bell off */
++ #define KBD_CMD_CLICK 10 /* turn keyclick on */
++ #define KBD_CMD_NOCLICK 11 /* turn keyclick off */
++ #define KBD_CMD_SETLED 14 /* set LED state (type 4 kbd) */
++ #define KBD_CMD_GLAYOUT 15 /* get DIP switch (type 4 kbd) */
++
++ #define LED_NUM_LOCK 0x1
++ #if !defined(Lynx) || !defined(LED_COMPOSE)
++ #define LED_COMPOSE 0x2
++ #endif
++ #define LED_SCROLL_LOCK 0x4
++ #define LED_CAPS_LOCK 0x8
+diff -crP /cdrom/usr/include/kbio.h /usr/include/kbio.h
+*** /cdrom/usr/include/kbio.h Wed Dec 31 16:00:00 1969
+--- /usr/include/kbio.h Sun May 11 23:22:46 1997
+***************
+*** 0 ****
+--- 1,115 ----
++ /* $NetBSD: kbio.h,v 1.4 1995/05/10 16:07:27 pk Exp $ */
++
++ /*
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * This software was developed by the Computer Systems Engineering group
++ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
++ * contributed to Berkeley.
++ *
++ * All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Lawrence Berkeley Laboratory.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)kbio.h 8.1 (Berkeley) 6/11/93
++ */
++
++ /*
++ * The following is a minimal emulation of Sun's `kio' structures
++ * and related operations necessary to make X11 happy (i.e., make it
++ * compile, and make old X11 binaries run).
++ */
++
++ /*
++ * The kiockey structure apparently gets and/or sets keyboard mappings.
++ * It seems to be kind of useless, but X11 uses it (according to the
++ * comments) to figure out when a Sun 386i has a type-4 keyboard but
++ * claims to have a type-3 keyboard. We need just enough to cause the
++ * appropriate ioctl to return the appropriate magic value.
++ *
++ * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
++ * is for; X sets it before the call, so it is not an output, but we do not
++ * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
++ * keys to the console or to X; we just send them to X whenever the keyboard
++ * is open at all. (XXX may need to change this later)
++ *
++ * Keyboard commands and types are defined in kbd.h as they are actually
++ * real hardware commands and type numbers.
++ */
++ struct okiockey { /* Out-dated key translation structure */
++ int kio_tablemask; /* whatever */
++ u_char kio_station; /* key number */
++ u_char kio_entry; /* HOLE if not present */
++ char kio_text[10]; /* the silly escape sequences (unsupported) */
++ };
++
++ struct kiockey {
++ int kio_tablemask; /* whatever */
++ u_char kio_station; /* key number */
++ u_short kio_entry; /* HOLE if not present */
++ char kio_text[10]; /* the silly escape sequences (unsupported) */
++ };
++
++ /*
++ * Values for kio_tablemask. These determine which table to read/modify
++ * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
++ * tables.
++ */
++ #define KIOC_NOMASK 0x0
++ #define KIOC_CAPSMASK 0x1
++ #define KIOC_SHIFTMASK 0xe
++ #define KIOC_CTRLMASK 0x30
++ #define KIOC_ALTGMASK 0x200
++ #define KIOC_NUMLMASK 0x800
++
++ #define HOLE 0x302 /* value for kio_entry to say `really type 3' */
++
++ #define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
++ /* (we only accept TR_UNTRANS_EVENT) */
++ #define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
++ #define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
++ #define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
++ #define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
++ #define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
++ #define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
++ #ifndef Lynx
++ #define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
++ #endif
++ #define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
++ #define KIOCSLED _IOW('k', 14, char) /* set LED state */
++ #define KIOCGLED _IOR('k', 15, char) /* get LED state */
++
++ #define TR_NONE 0 /* X compat, unsupported */
++ #define TR_ASCII 1 /* X compat, unsupported */
++ #define TR_EVENT 2 /* X compat, unsupported */
++ #define TR_UNTRANS_EVENT 3
+diff -crP /cdrom/sys/drivers/console/Makefile /sys/drivers/console/Makefile
+*** /cdrom/sys/drivers/console/Makefile Sun Feb 9 04:43:06 1997
+--- /sys/drivers/console/Makefile Sun May 11 23:24:04 1997
+***************
+*** 24,30 ****
+
+ LIBRARY= drivers
+
+! SPECIAL_CFLAGS=-DMOUSESUPPORT
+
+ include ../../OBJ_RULES
+
+--- 24,30 ----
+
+ LIBRARY= drivers
+
+! SPECIAL_CFLAGS=-DMOUSESUPPORT -DXSERVERSUPPORT
+
+ include ../../OBJ_RULES
+
+diff -crP /cdrom/sys/drivers/console/atc.h /sys/drivers/console/atc.h
+*** /cdrom/sys/drivers/console/atc.h Sun Feb 9 04:43:06 1997
+--- /sys/drivers/console/atc.h Sun May 11 23:22:46 1997
+***************
+*** 108,113 ****
+--- 108,119 ----
+ #ifdef MOUSESUPPORT
+ struct ttystatics mousechannel;
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ int kbd_pending;
++ int kbd_id; /* keyboard type */
++ int kbd_layout; /* layout on type 4 */
++ int kbd_click; /* kbd click on? */
++ #endif
+ };
+
+ struct kbd_registers_type {
+diff -crP /cdrom/sys/drivers/console/atcdrvr.c /sys/drivers/console/atcdrvr.c
+*** /cdrom/sys/drivers/console/atcdrvr.c Sun Feb 9 04:43:06 1997
+--- /sys/drivers/console/atcdrvr.c Sun May 11 23:25:15 1997
+***************
+*** 38,43 ****
+--- 38,47 ----
+ #ifdef MOUSESUPPORT
+ #include "am8530.h"
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++ #endif
+
+ char *screen_address; /* is this supposed to be in the driver info? */
+
+***************
+*** 305,310 ****
+--- 309,318 ----
+ int m;
+ int ps;
+ extern int set_kb_lights();
++ #ifdef XSERVERSUPPORT
++ extern int kbd_docmd();
++ int err;
++ #endif
+
+ if (!atc_flag){ pseterr(EIO); return(SYSERR);}
+ #ifdef MOUSESUPPORT
+***************
+*** 354,365 ****
+--- 362,398 ----
+ #ifdef TIOLED
+ case TIOLED:
+ #endif
++ #ifdef XSERVERSUPPORT
++ case KIOCSLED:
++ #endif
+ h->curled = *arg;
+ if (h->ledstate == -1) {
+ if (timeout(set_kb_lights,h,1) != -1)
+ h->ledstate = 0;
+ }
+ return 0;
++ #ifdef XSERVERSUPPORT
++ case KIOCTYPE:
++ if (wbounds(arg) < sizeof(int)) {
++ pseterr(EFAULT);
++ return SYSERR;
++ }
++ *(int *)arg = h->kbd_id;
++ return OK;
++ case KIOCLAYOUT:
++ if (wbounds(arg) < sizeof(int)) {
++ pseterr(EFAULT);
++ return SYSERR;
++ }
++ *(int *)arg = h->kbd_layout;
++ return OK;
++ case KIOCCMD:
++ if (err = kbd_docmd(h, *(int *)arg)) {
++ pseterr(err);
++ return SYSERR;
++ }
++ return OK;
++ #endif
+ case VT_OPENQRY:
+ if (h->multimode == SCM_ONE) {
+ if (!(h->open & 1)) {
+***************
+*** 578,583 ****
+--- 611,622 ----
+ h->open = 0;
+ h->break_code = 0;
+ h->info = info;
++ #ifdef XSERVERSUPPORT
++ h->kbd_pending = 0;
++ h->kbd_id = KB_SUN4; /* query KBD later.... */
++ h->kbd_layout = 0; /* US_ASCII */
++ h->kbd_click = 0; /* silent movie */
++ #endif
+ #ifdef MOUSESUPPORT
+ tmgr_install(&h->mousechannel, &info->sg, 0, mouse_xmit_ena, h);
+ #endif /* MOUSESUPPORT */
+diff -crP /cdrom/sys/drivers/console/atkey.c /sys/drivers/console/atkey.c
+*** /cdrom/sys/drivers/console/atkey.c Sun Feb 9 04:43:07 1997
+--- /sys/drivers/console/atkey.c Sun May 11 23:22:46 1997
+***************
+*** 26,31 ****
+--- 26,35 ----
+ #ifdef MOUSESUPPORT
+ #include "am8530.h"
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++ #endif
+
+ #define NOTHING_USEFUL -1
+ #define FILL NOTHING_USEFUL
+diff -crP /cdrom/sys/drivers/console/atutils.c /sys/drivers/console/atutils.c
+*** /cdrom/sys/drivers/console/atutils.c Sun Feb 9 04:43:07 1997
+--- /sys/drivers/console/atutils.c Sun May 11 23:22:46 1997
+***************
+*** 361,367 ****
+ }
+
+
+! static int byte_to_keyboard(byt)
+ unsigned char byt;
+ {
+ int i;
+--- 361,370 ----
+ }
+
+
+! #ifndef XSERVERSUPPORT
+! static
+! #endif
+! int byte_to_keyboard(byt)
+ unsigned char byt;
+ {
+ int i;
+***************
+*** 400,402 ****
+--- 403,449 ----
+ break;
+ }
+ }
++
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++
++ /*
++ * Execute a keyboard command; return 0 on success.
++ */
++ kbd_docmd(h, cmd)
++ register struct kdhglobals *h;
++ int cmd;
++ {
++ switch (cmd) {
++
++ case KBD_CMD_BELL:
++ case KBD_CMD_NOBELL:
++ /* Supported by type 2, 3, and 4 keyboards */
++ break;
++
++ case KBD_CMD_CLICK:
++ /* Unsupported by type 2 keyboards */
++ if (h->kbd_id != KB_SUN2) {
++ h->kbd_click = 1;
++ break;
++ }
++ return (EINVAL);
++
++ case KBD_CMD_NOCLICK:
++ /* Unsupported by type 2 keyboards */
++ if (h->kbd_id != KB_SUN2) {
++ h->kbd_click = 0;
++ break;
++ }
++ return (EINVAL);
++
++ default:
++ return (EINVAL); /* ENOTTY? EOPNOTSUPP? */
++ }
++
++ if (timeout(byte_to_keyboard, cmd, 1) < 0)
++ return (ENOSPC); /* ERESTART? */
++ return (0);
++ }
++ #endif
diff --git a/xc/programs/Xserver/hw/sunLynx/patch.Console-2.4.0 b/xc/programs/Xserver/hw/sunLynx/patch.Console-2.4.0
new file mode 100644
index 000000000..41e2d10c3
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/patch.Console-2.4.0
@@ -0,0 +1,493 @@
+diff -cPr --exclude-from=Excl.include /mnt/DEV_OS.microSPARC/usr/include/kbd.h /usr/include/kbd.h
+*** /mnt/DEV_OS.microSPARC/usr/include/kbd.h
+--- /usr/include/kbd.h Wed Jul 24 09:37:49 1996
+***************
+*** 0 ****
+--- 1,90 ----
++ /* $NetBSD: kbd.h,v 1.4 1995/07/06 05:36:29 pk Exp $ */
++
++ /*
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * This software was developed by the Computer Systems Engineering group
++ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
++ * contributed to Berkeley.
++ *
++ * All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Lawrence Berkeley Laboratory.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)kbd.h 8.1 (Berkeley) 6/11/93
++ */
++
++ /*
++ * Keyboard `registers'. (This should be called kbd_reg.h but we need to
++ * be compatible.)
++ */
++
++ /*
++ * Control codes sent from type 2, 3, and 4 keyboards.
++ *
++ * Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not.
++ * KBD_IDLE does not take the place of any `up' transitions (it merely occurs
++ * after them).
++ */
++ #define KBD_RESET 0xff /* keyboard `reset' response */
++ #define KBD_IDLE 0x7f /* keyboard `all keys are up' code */
++ #define KBD_LAYOUT 0xfe /* keyboard `get layout' response */
++
++ /* Keyboard IDs */
++ #define KB_SUN2 2 /* type 2 keyboard */
++ #define KB_SUN3 3 /* type 3 keyboard */
++ #define KB_SUN4 4 /* type 4 keyboard */
++
++ /* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */
++ #define KBD_KEYMASK 0x7f /* keyboard key mask */
++ #define KBD_UP 0x80 /* keyboard `up' transition */
++
++ /* Keyboard codes needed to recognize the L1-A sequence */
++ #define KBD_L1 1 /* keyboard code for `L1' key */
++ #define KBD_A 77 /* keyboard code for `A' key */
++
++ /* Control codes sent to the various keyboards */
++ #define KBD_CMD_RESET 1 /* reset keyboard */
++ #define KBD_CMD_BELL 2 /* turn bell on */
++ #define KBD_CMD_NOBELL 3 /* turn bell off */
++ #define KBD_CMD_CLICK 10 /* turn keyclick on */
++ #define KBD_CMD_NOCLICK 11 /* turn keyclick off */
++ #define KBD_CMD_SETLED 14 /* set LED state (type 4 kbd) */
++ #define KBD_CMD_GLAYOUT 15 /* get DIP switch (type 4 kbd) */
++
++ #define LED_NUM_LOCK 0x1
++ #if !defined(Lynx) || !defined(LED_COMPOSE)
++ #define LED_COMPOSE 0x2
++ #endif
++ #define LED_SCROLL_LOCK 0x4
++ #define LED_CAPS_LOCK 0x8
+diff -cPr --exclude-from=Excl.include /mnt/DEV_OS.microSPARC/usr/include/kbio.h /usr/include/kbio.h
+*** /mnt/DEV_OS.microSPARC/usr/include/kbio.h
+--- /usr/include/kbio.h Wed Aug 14 16:29:26 1996
+***************
+*** 0 ****
+--- 1,115 ----
++ /* $NetBSD: kbio.h,v 1.4 1995/05/10 16:07:27 pk Exp $ */
++
++ /*
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * This software was developed by the Computer Systems Engineering group
++ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
++ * contributed to Berkeley.
++ *
++ * All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Lawrence Berkeley Laboratory.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)kbio.h 8.1 (Berkeley) 6/11/93
++ */
++
++ /*
++ * The following is a minimal emulation of Sun's `kio' structures
++ * and related operations necessary to make X11 happy (i.e., make it
++ * compile, and make old X11 binaries run).
++ */
++
++ /*
++ * The kiockey structure apparently gets and/or sets keyboard mappings.
++ * It seems to be kind of useless, but X11 uses it (according to the
++ * comments) to figure out when a Sun 386i has a type-4 keyboard but
++ * claims to have a type-3 keyboard. We need just enough to cause the
++ * appropriate ioctl to return the appropriate magic value.
++ *
++ * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
++ * is for; X sets it before the call, so it is not an output, but we do not
++ * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
++ * keys to the console or to X; we just send them to X whenever the keyboard
++ * is open at all. (XXX may need to change this later)
++ *
++ * Keyboard commands and types are defined in kbd.h as they are actually
++ * real hardware commands and type numbers.
++ */
++ struct okiockey { /* Out-dated key translation structure */
++ int kio_tablemask; /* whatever */
++ u_char kio_station; /* key number */
++ u_char kio_entry; /* HOLE if not present */
++ char kio_text[10]; /* the silly escape sequences (unsupported) */
++ };
++
++ struct kiockey {
++ int kio_tablemask; /* whatever */
++ u_char kio_station; /* key number */
++ u_short kio_entry; /* HOLE if not present */
++ char kio_text[10]; /* the silly escape sequences (unsupported) */
++ };
++
++ /*
++ * Values for kio_tablemask. These determine which table to read/modify
++ * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
++ * tables.
++ */
++ #define KIOC_NOMASK 0x0
++ #define KIOC_CAPSMASK 0x1
++ #define KIOC_SHIFTMASK 0xe
++ #define KIOC_CTRLMASK 0x30
++ #define KIOC_ALTGMASK 0x200
++ #define KIOC_NUMLMASK 0x800
++
++ #define HOLE 0x302 /* value for kio_entry to say `really type 3' */
++
++ #define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
++ /* (we only accept TR_UNTRANS_EVENT) */
++ #define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
++ #define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
++ #define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
++ #define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
++ #define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
++ #define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
++ #ifndef Lynx
++ #define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
++ #endif
++ #define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
++ #define KIOCSLED _IOW('k', 14, char) /* set LED state */
++ #define KIOCGLED _IOR('k', 15, char) /* get LED state */
++
++ #define TR_NONE 0 /* X compat, unsupported */
++ #define TR_ASCII 1 /* X compat, unsupported */
++ #define TR_EVENT 2 /* X compat, unsupported */
++ #define TR_UNTRANS_EVENT 3
+diff -cPr --exclude=*.[oa] /mnt/DEV_OS.microSPARC/sys/drivers/console/Makefile sys/drivers/console/Makefile
+*** /mnt/DEV_OS.microSPARC/sys/drivers/console/Makefile Fri Apr 26 23:27:51 1996
+--- sys/drivers/console/Makefile Fri Aug 2 09:03:05 1996
+***************
+*** 31,37 ****
+ # (keyboard) duart. The mouse is attached to this port. It must be
+ # defined for the X server to work.
+ #
+! SPECIAL_CFLAGS = -DMOUSESUPPORT -O
+
+ FILES = atcdrvr.xxx gfont.xxx atkey.xxx atbeep.xxx atterm.xxx atutils.xxx
+ HFILES =
+--- 31,37 ----
+ # (keyboard) duart. The mouse is attached to this port. It must be
+ # defined for the X server to work.
+ #
+! SPECIAL_CFLAGS = -DMOUSESUPPORT -DXSERVERSUPPORT -O
+
+ FILES = atcdrvr.xxx gfont.xxx atkey.xxx atbeep.xxx atterm.xxx atutils.xxx
+ HFILES =
+***************
+*** 117,122 ****
+--- 117,130 ----
+
+ # Just Do It.
+ FORCE:
++
++ atkey.kdb.o : atkey.c
++ $(KERN_CC) -c -o atkey.kdb.o $(SPECIAL_CFLAGS) $(KERN_CFLAGS) \
++ $(SPECIAL_INCLUDES) $(KERN_INCLUDES) -DSKDB atkey.c
++
++ atkey.nokdb.o : atkey.c
++ $(KERN_CC) -c -o atkey.kdb.o $(SPECIAL_CFLAGS) $(KERN_CFLAGS) \
++ $(SPECIAL_INCLUDES) $(KERN_INCLUDES) atkey.c
+
+ # Dependencies as of 5/20/1992
+
+diff -cPr --exclude=*.[oa] /mnt/DEV_OS.microSPARC/sys/drivers/console/atc.h sys/drivers/console/atc.h
+*** /mnt/DEV_OS.microSPARC/sys/drivers/console/atc.h Fri Apr 26 23:27:51 1996
+--- sys/drivers/console/atc.h Wed Jul 24 11:49:21 1996
+***************
+*** 191,196 ****
+--- 191,202 ----
+ #ifdef MOUSESUPPORT
+ struct ttystatics mousechannel;
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ int kbd_pending;
++ int kbd_id; /* keyboard type */
++ int kbd_layout; /* layout on type 4 */
++ int kbd_click; /* kbd click on? */
++ #endif
+ };
+
+ struct kbd_registers_type {
+diff -cPr --exclude=*.[oa] /mnt/DEV_OS.microSPARC/sys/drivers/console/atcdrvr.c sys/drivers/console/atcdrvr.c
+*** /mnt/DEV_OS.microSPARC/sys/drivers/console/atcdrvr.c Fri Apr 26 23:27:51 1996
+--- sys/drivers/console/atcdrvr.c Wed Aug 14 16:28:23 1996
+***************
+*** 270,275 ****
+--- 270,279 ----
+ #ifdef MOUSESUPPORT
+ #include "am8530.h"
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++ #endif
+
+ char *screen_address; /* is this supposed to be in the driver info? */
+
+***************
+*** 537,542 ****
+--- 541,550 ----
+ int m;
+ int ps;
+ extern int set_kb_lights();
++ #ifdef XSERVERSUPPORT
++ extern int kbd_docmd();
++ int err;
++ #endif
+
+ if (!atc_flag){ pseterr(EIO); return(SYSERR);}
+ #ifdef MOUSESUPPORT
+***************
+*** 586,597 ****
+ #ifdef TIOLED
+ case TIOLED:
+ #endif
+ h->curled = *arg;
+ if (h->ledstate == -1) {
+ if (timeout(set_kb_lights,h,1) != -1)
+ h->ledstate = 0;
+ }
+! break;
+ case VT_OPENQRY:
+ if (h->multimode == SCM_ONE) {
+ if (!(h->open & 1)) {
+--- 594,630 ----
+ #ifdef TIOLED
+ case TIOLED:
+ #endif
++ #ifdef XSERVERSUPPORT
++ case KIOCSLED:
++ #endif
+ h->curled = *arg;
+ if (h->ledstate == -1) {
+ if (timeout(set_kb_lights,h,1) != -1)
+ h->ledstate = 0;
+ }
+! return OK;
+! #ifdef XSERVERSUPPORT
+! case KIOCTYPE:
+! if (wbounds(arg) < sizeof(int)) {
+! pseterr(EFAULT);
+! return SYSERR;
+! }
+! *(int *)arg = h->kbd_id;
+! return OK;
+! case KIOCLAYOUT:
+! if (wbounds(arg) < sizeof(int)) {
+! pseterr(EFAULT);
+! return SYSERR;
+! }
+! *(int *)arg = h->kbd_layout;
+! return OK;
+! case KIOCCMD:
+! if (err = kbd_docmd(h, *(int *)arg)) {
+! pseterr(err);
+! return SYSERR;
+! }
+! return OK;
+! #endif
+ case VT_OPENQRY:
+ if (h->multimode == SCM_ONE) {
+ if (!(h->open & 1)) {
+***************
+*** 810,815 ****
+--- 843,854 ----
+ h->open = 0;
+ h->break_code = 0;
+ h->info = info;
++ #ifdef XSERVERSUPPORT
++ h->kbd_pending = 0;
++ h->kbd_id = KB_SUN4; /* query KBD later.... */
++ h->kbd_layout = 0; /* US_ASCII */
++ h->kbd_click = 0; /* silent movie */
++ #endif
+ #ifdef MOUSESUPPORT
+ tmgr_install(&h->mousechannel, &info->sg, 0, mouse_xmit_ena, h);
+ #endif /* MOUSESUPPORT */
+diff -cPr --exclude=*.[oa] /mnt/DEV_OS.microSPARC/sys/drivers/console/atkey.c sys/drivers/console/atkey.c
+*** /mnt/DEV_OS.microSPARC/sys/drivers/console/atkey.c Fri Apr 26 23:27:51 1996
+--- sys/drivers/console/atkey.c Mon Sep 23 09:19:36 1996
+***************
+*** 162,167 ****
+--- 162,171 ----
+ #ifdef MOUSESUPPORT
+ #include "am8530.h"
+ #endif /* MOUSESUPPORT */
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++ #endif
+
+ #define NOTHING_USEFUL -1
+ #define FILL NOTHING_USEFUL
+***************
+*** 474,480 ****
+ #undef DEBUG
+
+ j = *(volatile unsigned char *)KV_KBD_DATA;
+!
+ /* Do the quick scan mode check first. If scanning, stuff and exit */
+ screen_num = (h->g - &h->screen[0]);
+ if (h->screen[screen_num].scan_mode) {
+--- 478,503 ----
+ #undef DEBUG
+
+ j = *(volatile unsigned char *)KV_KBD_DATA;
+! #ifdef XSERVERSUPPORT
+! if (h->kbd_pending == KBD_RESET) {
+! h->kbd_pending = 0;
+! h->kbd_id = j;
+! if (j == KB_SUN4) {
+! extern int byte_to_keyboard();
+! timeout(byte_to_keyboard, KBD_CMD_GLAYOUT, 1);
+! }
+! goto EOIandExit;
+! }
+! if (h->kbd_pending == KBD_LAYOUT) {
+! h->kbd_pending = 0;
+! h->kbd_layout = j;
+! goto EOIandExit;
+! }
+! if (j == KBD_RESET || j == KBD_LAYOUT) {
+! h->kbd_pending = j;
+! goto EOIandExit;
+! }
+! #endif
+ /* Do the quick scan mode check first. If scanning, stuff and exit */
+ screen_num = (h->g - &h->screen[0]);
+ if (h->screen[screen_num].scan_mode) {
+diff -cPr --exclude=*.[oa] /mnt/DEV_OS.microSPARC/sys/drivers/console/atutils.c sys/drivers/console/atutils.c
+*** /mnt/DEV_OS.microSPARC/sys/drivers/console/atutils.c Fri Apr 26 23:27:51 1996
+--- sys/drivers/console/atutils.c Tue Aug 13 11:54:38 1996
+***************
+*** 456,462 ****
+ }
+
+
+! static int byte_to_keyboard(byt)
+ unsigned char byt;
+ {
+ int i;
+--- 456,465 ----
+ }
+
+
+! #ifndef XSERVERSUPPORT
+! static
+! #endif
+! int byte_to_keyboard(byt)
+ unsigned char byt;
+ {
+ int i;
+***************
+*** 495,497 ****
+--- 498,544 ----
+ break;
+ }
+ }
++
++ #ifdef XSERVERSUPPORT
++ #include <kbd.h>
++ #include <kbio.h>
++
++ /*
++ * Execute a keyboard command; return 0 on success.
++ */
++ kbd_docmd(h, cmd)
++ register struct kdhglobals *h;
++ int cmd;
++ {
++ switch (cmd) {
++
++ case KBD_CMD_BELL:
++ case KBD_CMD_NOBELL:
++ /* Supported by type 2, 3, and 4 keyboards */
++ break;
++
++ case KBD_CMD_CLICK:
++ /* Unsupported by type 2 keyboards */
++ if (h->kbd_id != KB_SUN2) {
++ h->kbd_click = 1;
++ break;
++ }
++ return (EINVAL);
++
++ case KBD_CMD_NOCLICK:
++ /* Unsupported by type 2 keyboards */
++ if (h->kbd_id != KB_SUN2) {
++ h->kbd_click = 0;
++ break;
++ }
++ return (EINVAL);
++
++ default:
++ return (EINVAL); /* ENOTTY? EOPNOTSUPP? */
++ }
++
++ if (timeout(byte_to_keyboard, cmd, 1) < 0)
++ return (ENOSPC); /* ERESTART? */
++ return (0);
++ }
++ #endif
diff --git a/xc/programs/Xserver/hw/sunLynx/sun.h b/xc/programs/Xserver/hw/sunLynx/sun.h
new file mode 100644
index 000000000..a299eee00
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sun.h
@@ -0,0 +1,547 @@
+/* $XConsortium: sun.h /main/1 1996/10/31 14:20:43 kaleb $ */
+
+
+
+/* This is sun.h modified for LynxOS */
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sun.h,v 3.5 1998/06/27 12:53:56 hohndel Exp $ */
+
+/*-
+ * Copyright (c) 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+#ifndef _SUN_H_
+#define _SUN_H_
+
+/* X headers */
+#include "Xos.h"
+#undef index /* don't mangle silly Sun structure member names */
+#include "X.h"
+#include "Xproto.h"
+
+/* general system headers */
+#ifndef NOSTDHDRS
+# include <stdlib.h>
+#else
+# include <malloc.h>
+extern char *getenv();
+#endif
+
+/* system headers common to both SunOS and Solaris */
+#include <sys/param.h>
+#include <sys/file.h>
+#ifndef Lynx
+# include <sys/filio.h>
+#else
+# include <sys/termio.h> /* include this before ioctl.h ... */
+#endif
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+
+#ifdef SVR4
+# ifdef X_POSIX_C_SOURCE
+# define _POSIX_C_SOURCE X_POSIX_C_SOURCE
+# include <signal.h>
+# undef _POSIX_C_SOURCE
+# else
+# define _POSIX_SOURCE
+# include <signal.h>
+# undef _POSIX_SOURCE
+# endif
+#endif
+
+#include <fcntl.h>
+
+#ifndef __bsdi__
+# if !defined(__NetBSD__) && !defined(__OpenBSD__)
+# ifndef Lynx
+# ifndef i386
+# include <poll.h>
+# else
+# include <sys/poll.h>
+# endif
+# endif
+# endif
+#else
+# include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <memory.h>
+
+#ifdef X_NOT_STDC_ENV
+extern int errno;
+#endif
+
+/*
+ * Sun specific headers Sun moved in Solaris, and are different for NetBSD.
+ *
+ * Even if only needed by one source file, I have put them here
+ * to simplify finding them...
+ */
+#ifdef SVR4
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
+# include <sys/msio.h>
+# include <sys/vuid_event.h>
+# include <sys/memreg.h>
+# include <stropts.h>
+# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
+#else
+# if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx)
+# include <sun/fbio.h>
+# include <sundev/kbd.h>
+# include <sundev/kbio.h>
+# include <sundev/msio.h>
+# include <sundev/vuid_event.h>
+# include <pixrect/pixrect.h>
+# include <pixrect/memreg.h>
+extern int ioctl();
+extern int getrlimit();
+extern int setrlimit();
+extern int getpagesize();
+# else
+# if defined (__NetBSD__) || defined (__OpenBSD__)
+# include <machine/fbio.h>
+# include <machine/kbd.h>
+# include <machine/kbio.h>
+# include <machine/vuid_event.h>
+# endif
+# ifdef __bsdi__
+# include <sys/fbio.h>
+# include </sys/sparc/dev/kbd.h>
+# include </sys/sparc/dev/kbio.h>
+# include </sys/sparc/dev/vuid_event.h>
+# endif
+# ifdef Lynx
+# ifndef __P
+# define __P(x) x
+# endif
+# include <signal.h>
+# ifdef PATCHED_CONSOLE
+# include <kbio.h>
+# include <kbd.h>
+# else
+# define KB_SUN2 2 /* type 2 keyboard */
+# define KB_SUN3 3 /* type 3 keyboard */
+# define KB_SUN4 4 /* type 4 keyboard */
+# define KIOCSLED TIOCLED
+# define LED_NUM_LOCK NUM_LOCK
+# define LED_SCROLL_LOCK SCROL_LOCK
+# define LED_CAPS_LOCK CAPS_LOCK
+# define LED_COMPOSE COMPOSE_LED
+# endif
+# include <smem.h>
+# include "fbio.h"
+# include "vuid_event.h"
+# define FBIORESET _IO('F', 29)
+# endif
+# endif
+#endif
+extern int gettimeofday();
+
+/*
+ * Server specific headers
+ */
+#include "misc.h"
+#undef abs /* don't munge function prototypes in headers, sigh */
+#include "scrnintstr.h"
+#ifdef NEED_EVENTS
+# include "inputstr.h"
+#endif
+#include "input.h"
+#include "colormapst.h"
+#include "colormap.h"
+#include "cursorstr.h"
+#include "cursor.h"
+#include "dixstruct.h"
+#include "dix.h"
+#include "opaque.h"
+#include "resource.h"
+#include "servermd.h"
+#include "windowstr.h"
+
+/*
+ * ddx specific headers
+ */
+#ifndef PSZ
+#define PSZ 8
+#endif
+
+#include "mi/mibstore.h"
+#include "mi/mipointer.h"
+
+extern int monitorResolution;
+
+
+/* Frame buffer devices */
+#ifdef SVR4
+# define CGTWO0DEV "/dev/fbs/cgtwo0"
+# define CGTWO1DEV "/dev/fbs/cgtwo1"
+# define CGTWO2DEV "/dev/fbs/cgtwo2"
+# define CGTWO3DEV "/dev/fbs/cgtwo3"
+# define CGTHREE0DEV "/dev/fbs/cgthree0"
+# define CGTHREE1DEV "/dev/fbs/cgthree1"
+# define CGTHREE2DEV "/dev/fbs/cgthree2"
+# define CGTHREE3DEV "/dev/fbs/cgthree3"
+# define CGFOUR0DEV "/dev/fbs/cgfour0"
+# define CGSIX0DEV "/dev/fbs/cgsix0"
+# define CGSIX1DEV "/dev/fbs/cgsix1"
+# define CGSIX2DEV "/dev/fbs/cgsix2"
+# define CGSIX3DEV "/dev/fbs/cgsix3"
+# define BWTWO0DEV "/dev/fbs/bwtwo0"
+# define BWTWO1DEV "/dev/fbs/bwtwo1"
+# define BWTWO2DEV "/dev/fbs/bwtwo2"
+# define BWTWO3DEV "/dev/fbs/bwtwo3"
+# define CGEIGHT0DEV "/dev/fbs/cgeight0"
+#else
+# define CGTWO0DEV "/dev/cgtwo0"
+# define CGTWO1DEV "/dev/cgtwo1"
+# define CGTWO2DEV "/dev/cgtwo2"
+# define CGTWO3DEV "/dev/cgtwo3"
+# define CGTHREE0DEV "/dev/cgthree0"
+# define CGTHREE1DEV "/dev/cgthree1"
+# define CGTHREE2DEV "/dev/cgthree2"
+# define CGTHREE3DEV "/dev/cgthree3"
+# define CGFOUR0DEV "/dev/cgfour0"
+# define CGSIX0DEV "/dev/cgsix0"
+# define CGSIX1DEV "/dev/cgsix1"
+# define CGSIX2DEV "/dev/cgsix2"
+# define CGSIX3DEV "/dev/cgsix3"
+# define BWTWO0DEV "/dev/bwtwo0"
+# define BWTWO1DEV "/dev/bwtwo1"
+# define BWTWO2DEV "/dev/bwtwo2"
+# define BWTWO3DEV "/dev/bwtwo3"
+# define CGEIGHT0DEV "/dev/cgeight0"
+#endif
+
+/*
+ * MAXEVENTS is the maximum number of events the mouse and keyboard functions
+ * will read on a given call to their GetEvents vectors.
+ */
+#ifndef Lynx
+#define MAXEVENTS 32
+#else
+/* currently our mouse stuff is pretty naive, so we need a lot of events */
+#define MAXEVENTS 256
+#endif
+
+/*
+ * Data private to any sun keyboard.
+ */
+typedef struct {
+ int fd;
+ int type; /* Type of keyboard */
+ int layout; /* The layout of the keyboard */
+ int click; /* kbd click save state */
+ Leds leds; /* last known LED state */
+} sunKbdPrivRec, *sunKbdPrivPtr;
+
+extern sunKbdPrivRec sunKbdPriv;
+
+/*
+ * Data private to any sun pointer device.
+ */
+typedef struct {
+ int fd;
+ int bmask; /* last known button state */
+} sunPtrPrivRec, *sunPtrPrivPtr;
+
+extern sunPtrPrivRec sunPtrPriv;
+
+typedef struct {
+ BYTE key;
+ CARD8 modifiers;
+} SunModmapRec;
+
+typedef struct {
+ int width, height;
+ Bool has_cursor;
+ CursorPtr pCursor; /* current cursor */
+} sunCursorRec, *sunCursorPtr;
+
+typedef struct {
+ ColormapPtr installedMap;
+ CloseScreenProcPtr CloseScreen;
+ void (*UpdateColormap)();
+ sunCursorRec hardwareCursor;
+ Bool hasHardwareCursor;
+} sunScreenRec, *sunScreenPtr;
+
+#define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
+#define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s)
+
+typedef struct {
+#ifndef Lynx
+ unsigned char* fb; /* Frame buffer itself */
+#else
+ unsigned char* fbuf; /* Frame buffer itself */
+ void* ramdac; /* Color LookUp table */
+ void* fb; /* GX FB control registers:
+ * sunGX.c relies on this name
+ */
+ void* tec; /* GX TEC registers */
+ void* thc; /* GX THC registers */
+ void* fhc; /* GX FHC registers */
+#endif
+ int fd; /* frame buffer for ioctl()s, */
+ struct fbtype info; /* Frame buffer characteristics */
+ void (*EnterLeave)();/* screen switch */
+ unsigned char* fbPriv; /* fbattr stuff, for the real type */
+} fbFd;
+
+typedef Bool (*sunFbInitProc)(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+
+typedef struct {
+ sunFbInitProc init; /* init procedure for this fb */
+ char* name; /* /usr/include/fbio names */
+} sunFbDataRec;
+
+#ifdef XKB
+extern Bool noXkbExtension;
+#endif
+
+extern Bool sunAutoRepeatHandlersInstalled;
+extern long sunAutoRepeatInitiate;
+extern long sunAutoRepeatDelay;
+extern sunFbDataRec sunFbData[];
+extern fbFd sunFbs[];
+extern Bool sunSwapLkeys;
+extern Bool sunFlipPixels;
+extern Bool sunActiveZaphod;
+extern Bool sunFbInfo;
+extern Bool sunCG4Frob;
+extern Bool sunNoGX;
+extern int sunScreenIndex;
+extern int* sunProtected;
+
+extern Bool sunCursorInitialize(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern void sunDisableCursor(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern int sunChangeKbdTranslation(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* makeTranslated */
+#endif
+);
+
+extern void sunNonBlockConsoleOff(
+#if NeedFunctionPrototypes
+#if defined(SVR4) || defined(CSRG_BASED) || defined(Lynx)
+ void
+#else
+ char* /* arg */
+#endif
+#endif
+);
+
+extern void sunEnqueueEvents(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void sunEnqueueKbdEvents(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern void sunEnqueueMseEvents(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+extern int sunGXInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ fbFd* /* fb */
+#endif
+);
+
+extern Bool sunSaveScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ int /* on */
+#endif
+);
+
+extern Bool sunScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern pointer sunMemoryMap(
+#if NeedFunctionPrototypes
+ size_t /* len */,
+ off_t /* off */,
+ int /* fd */
+#ifdef Lynx
+ , char * /* name */
+#endif
+#endif
+);
+
+extern Bool sunScreenAllocate(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */
+#endif
+);
+
+extern Bool sunInitCommon(
+#if NeedFunctionPrototypes
+ int /* scrn */,
+ ScreenPtr /* pScrn */,
+ off_t /* offset */,
+ Bool (* /* init1 */)(),
+ void (* /* init2 */)(),
+ Bool (* /* cr_cm */)(),
+ Bool (* /* save */)(),
+ int /* fb_off */
+#endif
+);
+
+extern Firm_event* sunKbdGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* on */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern Firm_event* sunMouseGetEvents(
+#if NeedFunctionPrototypes
+ int /* fd */,
+ Bool /* on */,
+ int* /* pNumEvents */,
+ Bool* /* pAgain */
+#endif
+);
+
+extern void sunKbdEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+extern void sunMouseEnqueueEvent(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* device */,
+ Firm_event* /* fe */
+#endif
+);
+
+extern int sunKbdProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pKeyboard */,
+ int /* what */
+#endif
+);
+
+extern int sunMouseProc(
+#if NeedFunctionPrototypes
+ DeviceIntPtr /* pMouse */,
+ int /* what */
+#endif
+);
+
+extern void sunKbdWait(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+/*-
+ * TVTOMILLI(tv)
+ * Given a struct timeval, convert its time into milliseconds...
+ */
+#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000))
+
+extern Bool sunCfbSetupScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbFinishScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern Bool sunCfbScreenInit(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ pointer /* pbits */, /* pointer to screen bitmap */
+ int /* xsize */, /* in pixels */
+ int /* ysize */,
+ int /* dpix */, /* dots per inch */
+ int /* dpiy */, /* dots per inch */
+ int /* width */, /* pixel width of frame buffer */
+ int /* bpp */ /* bits per pixel of root */
+#endif
+);
+
+extern void sunInstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern void sunUninstallColormap(
+#if NeedFunctionPrototypes
+ ColormapPtr /* cmap */
+#endif
+);
+
+extern int sunListInstalledColormaps(
+#if NeedFunctionPrototypes
+ ScreenPtr /* pScreen */,
+ Colormap* /* pCmapList */
+#endif
+);
+
+#endif
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyCfb.c b/xc/programs/Xserver/hw/sunLynx/sunLyCfb.c
new file mode 100644
index 000000000..daf375fd2
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyCfb.c
@@ -0,0 +1,372 @@
+/* $TOG: sunLyCfb.c /main/2 1998/02/10 13:22:34 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyCfb.c,v 3.3 1998/10/04 09:38:46 dawes Exp $ */
+
+/*
+ * This is sunCfb.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+Copyright 1990, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#include "sun.h"
+#include "cfb/cfb.h"
+#include "mi/miline.h"
+
+#define GXZEROLINEBIAS (OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6)
+
+static void CGUpdateColormap(pScreen, dex, count, rmap, gmap, bmap)
+ ScreenPtr pScreen;
+ int dex, count;
+ u_char *rmap, *gmap, *bmap;
+{
+ struct fbcmap sunCmap;
+
+ sunCmap.index = dex;
+ sunCmap.count = count;
+ sunCmap.red = &rmap[dex];
+ sunCmap.green = &gmap[dex];
+ sunCmap.blue = &bmap[dex];
+
+ if (sunIoctl(&sunFbs[pScreen->myNum], FBIOPUTCMAP, &sunCmap) < 0) {
+ Error("CGUpdateColormap");
+ FatalError( "CGUpdateColormap: FBIOPUTCMAP failed\n" );
+ }
+}
+
+void sunInstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ register int i;
+ register Entry *pent;
+ register VisualPtr pVisual = cmap->pVisual;
+ u_char rmap[256], gmap[256], bmap[256];
+ unsigned long rMask, gMask, bMask;
+ int oRed, oGreen, oBlue;
+
+ if (cmap == pPrivate->installedMap)
+ return;
+ if (pPrivate->installedMap)
+ WalkTree(pPrivate->installedMap->pScreen, TellLostMap,
+ (pointer) &(pPrivate->installedMap->mid));
+ if ((pVisual->class | DynamicClass) == DirectColor) {
+ if (pVisual->ColormapEntries < 256) {
+ rMask = pVisual->redMask;
+ gMask = pVisual->greenMask;
+ bMask = pVisual->blueMask;
+ oRed = pVisual->offsetRed;
+ oGreen = pVisual->offsetGreen;
+ oBlue = pVisual->offsetBlue;
+ } else {
+ rMask = gMask = bMask = 255;
+ oRed = oGreen = oBlue = 0;
+ }
+ for (i = 0; i < 256; i++) {
+ rmap[i] = cmap->red[(i & rMask) >> oRed].co.local.red >> 8;
+ gmap[i] = cmap->green[(i & gMask) >> oGreen].co.local.green >> 8;
+ bmap[i] = cmap->blue[(i & bMask) >> oBlue].co.local.blue >> 8;
+ }
+ } else {
+ for (i = 0, pent = cmap->red;
+ i < pVisual->ColormapEntries;
+ i++, pent++) {
+ if (pent->fShared) {
+ rmap[i] = pent->co.shco.red->color >> 8;
+ gmap[i] = pent->co.shco.green->color >> 8;
+ bmap[i] = pent->co.shco.blue->color >> 8;
+ }
+ else {
+ rmap[i] = pent->co.local.red >> 8;
+ gmap[i] = pent->co.local.green >> 8;
+ bmap[i] = pent->co.local.blue >> 8;
+ }
+ }
+ }
+ pPrivate->installedMap = cmap;
+ (*pPrivate->UpdateColormap) (cmap->pScreen, 0, 256, rmap, gmap, bmap);
+ WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid));
+}
+
+void sunUninstallColormap(cmap)
+ ColormapPtr cmap;
+{
+ SetupScreen(cmap->pScreen);
+ if (cmap == pPrivate->installedMap) {
+ Colormap defMapID = cmap->pScreen->defColormap;
+
+ if (cmap->mid != defMapID) {
+ ColormapPtr defMap = (ColormapPtr) LookupIDByType(defMapID,
+ RT_COLORMAP);
+
+ if (defMap)
+ (*cmap->pScreen->InstallColormap)(defMap);
+ else
+ ErrorF("sunFbs: Can't find default colormap\n");
+ }
+ }
+}
+
+int sunListInstalledColormaps(pScreen, pCmapList)
+ ScreenPtr pScreen;
+ Colormap *pCmapList;
+{
+ SetupScreen(pScreen);
+ *pCmapList = pPrivate->installedMap->mid;
+ return (1);
+}
+
+static void CGStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ SetupScreen(pmap->pScreen);
+ u_char rmap[256], gmap[256], bmap[256];
+ xColorItem expanddefs[256];
+ register int i;
+
+ if (pPrivate->installedMap != NULL && pPrivate->installedMap != pmap)
+ return;
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
+ ndef = cfbExpandDirectColors(pmap, ndef, pdefs, expanddefs);
+ pdefs = expanddefs;
+ }
+ while (ndef--) {
+ i = pdefs->pixel;
+ rmap[i] = pdefs->red >> 8;
+ gmap[i] = pdefs->green >> 8;
+ bmap[i] = pdefs->blue >> 8;
+ (*pPrivate->UpdateColormap) (pmap->pScreen, i, 1, rmap, gmap, bmap);
+ pdefs++;
+ }
+}
+
+static void CGScreenInit (pScreen)
+ ScreenPtr pScreen;
+{
+#ifndef STATIC_COLOR /* { */
+ SetupScreen (pScreen);
+ pScreen->InstallColormap = sunInstallColormap;
+ pScreen->UninstallColormap = sunUninstallColormap;
+ pScreen->ListInstalledColormaps = sunListInstalledColormaps;
+ pScreen->StoreColors = CGStoreColors;
+ pPrivate->UpdateColormap = CGUpdateColormap;
+ if (sunFlipPixels) {
+ Pixel pixel = pScreen->whitePixel;
+ pScreen->whitePixel = pScreen->blackPixel;
+ pScreen->blackPixel = pixel;
+ }
+#endif /* } */
+}
+
+static void checkMono (argc, argv)
+ int argc;
+ char** argv;
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-mono") == 0)
+ ErrorF ("-mono not appropriate for CG3/CG6\n");
+}
+
+Bool sunCG3Init (screen, pScreen, argc, argv)
+ int screen; /* what screen am I going to be */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char **argv; /* The arguments themselves. Don't change! */
+{
+ unsigned long addr;
+
+ checkMono (argc, argv);
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ if (ioctl(sunFbs[screen].fd, TIO_QUERYLOC, &addr) < 0) {
+ perror("TIO_QUERYLOC");
+ FatalError("%s:%d can't query FB addr sunFbs[%d].fd=%d\n",
+ __FILE__, __LINE__, screen, sunFbs[screen]);
+ }
+ return sunInitCommon (screen, pScreen, (off_t) addr,
+ sunCfbScreenInit, CGScreenInit,
+ cfbCreateDefColormap, sunSaveScreen, 0);
+}
+
+Bool sunCG6Init (screen, pScreen, argc, argv)
+ int screen; /* The index of pScreen in the ScreenInfo */
+ ScreenPtr pScreen; /* The Screen to initialize */
+ int argc; /* The number of the Server's arguments. */
+ char** argv; /* The arguments themselves. Don't change! */
+{
+ unsigned long dacoffset;
+ unsigned long addr;
+ pointer fbc;
+ pointer fhc;
+ pointer fb;
+
+ checkMono (argc, argv);
+ if (!sunScreenAllocate (pScreen))
+ return FALSE;
+ if (!sunFbs[screen].fbuf) {
+ if (ioctl(sunFbs[screen].fd, TIO_QUERYLOC, &addr) < 0) {
+ perror("TIO_QUERYLOC");
+ FatalError("%s:%d can't query FB addr sunFbs[%d].fd=%d\n",
+ __FILE__, __LINE__, screen, sunFbs[screen]);
+ }
+ if ((fb = sunMemoryMap(0x00100000, (off_t) addr + 0x00800000UL,
+ sunFbs[screen].fd, "FB")) == NULL)
+ return FALSE;
+
+ if ((fbc = sunMemoryMap(0x2000, (off_t) addr + 0x00700000UL,
+ sunFbs[screen].fd, "FBC_TEC")) == NULL)
+ return FALSE;
+
+ if ((fhc = sunMemoryMap(0x2000, (off_t) addr + 0x00300000UL,
+ sunFbs[screen].fd, "FHC_THC")) == NULL)
+ return FALSE;
+
+ sunFbs[screen].fhc = fhc;
+ sunFbs[screen].thc = (char *)fhc + 0x1000;
+ sunFbs[screen].fb = fbc;
+ sunFbs[screen].tec = (char *)fbc + 0x1000;
+ sunFbs[screen].fbuf = fb;
+
+ if (ioctl(sunFbs[screen].fd, TIO_QUERYRAMDAC, &dacoffset) < 0)
+ FatalError("can't query DAC addr\n");
+ if ((sunFbs[screen].ramdac =
+ sunMemoryMap((size_t) sunFbs[screen].info.fb_cmsize * 3,
+ (unsigned long)addr + dacoffset,
+ sunFbs[screen].fd, "DAC")) == NULL)
+ return FALSE;
+ }
+
+ sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+ if (!sunCfbSetupScreen (pScreen,
+ sunFbs[screen].fbuf,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+ if (sunNoGX == FALSE) {
+ /* cleanup CG& hardware state */
+ if (sunIoctl(&sunFbs[screen], FBIORESET, 0) < 0)
+ perror("FBIORESET");
+ if (!sunGXInit (pScreen, &sunFbs[screen]))
+ return FALSE;
+ }
+ if (!sunCfbFinishScreenInit(pScreen,
+ sunFbs[screen].fbuf,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[screen].info.fb_width,
+ sunFbs[screen].info.fb_depth))
+ return FALSE;
+ miInitializeBackingStore(pScreen);
+ if (sunNoGX == FALSE) {
+ miSetZeroLineBias(pScreen, GXZEROLINEBIAS);
+ }
+ CGScreenInit (pScreen);
+ if (!sunScreenInit (pScreen))
+ return FALSE;
+ sunSaveScreen (pScreen, SCREEN_SAVER_OFF);
+ return cfbCreateDefColormap(pScreen);
+}
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyFbs.c b/xc/programs/Xserver/hw/sunLynx/sunLyFbs.c
new file mode 100644
index 000000000..bae91d54e
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyFbs.c
@@ -0,0 +1,328 @@
+/* $TOG: sunLyFbs.c /main/2 1998/02/10 13:22:39 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyFbs.c,v 3.4 1998/10/04 09:38:46 dawes Exp $ */
+
+/*
+ * This is sunFbs.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+Copyright 1990, 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ * Copyright 1987 by Adam de Boor, UC Berkeley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/****************************************************************/
+/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */
+/****************************************************************/
+
+#include "sun.h"
+#include <smem.h>
+
+int sunScreenIndex;
+
+static unsigned long generation = 0;
+
+#if NeedFunctionPrototypes
+pointer sunMemoryMap (
+ size_t len,
+ off_t off,
+ int fd,
+ char *name
+ )
+#else
+pointer sunMemoryMap (len, off, fd, name)
+ size_t len;
+ off_t off;
+ int fd;
+ char *name;
+#endif
+{
+ int pagemask, mapsize;
+ caddr_t addr;
+ pointer mapaddr;
+
+ pagemask = getpagesize() - 1;
+ mapsize = ((int) len + pagemask) & ~pagemask;
+ addr = 0;
+
+ mapaddr = smem_create(name, (char *)off, mapsize, SM_READ|SM_WRITE);
+ if (mapaddr == (pointer) -1) {
+ Error ("mapping frame buffer memory");
+ (void) close (fd);
+ mapaddr = (pointer) NULL;
+ }
+ return mapaddr;
+}
+
+#if NeedFunctionPrototypes
+Bool sunScreenAllocate (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenAllocate (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ sunScreenPtr pPrivate;
+ extern int AllocateScreenPrivateIndex();
+
+ if (generation != serverGeneration)
+ {
+ sunScreenIndex = AllocateScreenPrivateIndex();
+ if (sunScreenIndex < 0)
+ return FALSE;
+ generation = serverGeneration;
+ }
+ pPrivate = (sunScreenPtr) xalloc (sizeof (sunScreenRec));
+ if (!pPrivate)
+ return FALSE;
+
+ pScreen->devPrivates[sunScreenIndex].ptr = (pointer) pPrivate;
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunSaveScreen (
+ ScreenPtr pScreen,
+ int on)
+#else
+Bool sunSaveScreen (pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+#endif
+{
+ int state;
+
+ if (on != SCREEN_SAVER_FORCER)
+ {
+ if (on == SCREEN_SAVER_ON)
+ state = 0;
+ else
+ state = 1;
+ (void) sunIoctl(&sunFbs[pScreen->myNum], FBIOSVIDEO, &state);
+ }
+ return( TRUE );
+}
+
+static Bool closeScreen (i, pScreen)
+ int i;
+ ScreenPtr pScreen;
+{
+ SetupScreen(pScreen);
+ Bool ret;
+ struct fbcmap sunCmap;
+ unsigned char color;
+
+ (void) OsSignal (SIGIO, SIG_IGN);
+ sunDisableCursor (pScreen);
+ pScreen->CloseScreen = pPrivate->CloseScreen;
+ ret = (*pScreen->CloseScreen) (i, pScreen);
+ (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ /* probably this doesn't belong here: restore black&white cmap */
+ sunCmap.count = 1;
+ sunCmap.index = 0;
+ sunCmap.red = sunCmap.green = sunCmap.blue = &color;
+ color = 0xff;
+ (void) sunIoctl(&sunFbs[pScreen->myNum], FBIOPUTCMAP, &sunCmap);
+ sunCmap.index = 0xff;
+ color = 0;
+ (void) sunIoctl(&sunFbs[pScreen->myNum], FBIOPUTCMAP, &sunCmap);
+ xfree ((pointer) pPrivate);
+ return ret;
+}
+
+#if NeedFunctionPrototypes
+Bool sunScreenInit (
+ ScreenPtr pScreen)
+#else
+Bool sunScreenInit (pScreen)
+ ScreenPtr pScreen;
+#endif
+{
+ SetupScreen(pScreen);
+ extern void sunBlockHandler();
+ extern void sunWakeupHandler();
+ static ScreenPtr autoRepeatScreen;
+ extern miPointerScreenFuncRec sunPointerScreenFuncs;
+
+ pPrivate->installedMap = 0;
+ pPrivate->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = closeScreen;
+ pScreen->SaveScreen = sunSaveScreen;
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ /*
+ * Block/Unblock handlers
+ */
+ if (sunAutoRepeatHandlersInstalled == FALSE) {
+ autoRepeatScreen = pScreen;
+ sunAutoRepeatHandlersInstalled = TRUE;
+ }
+
+ if (pScreen == autoRepeatScreen) {
+ pScreen->BlockHandler = sunBlockHandler;
+ pScreen->WakeupHandler = sunWakeupHandler;
+ }
+#ifdef XKB
+ } else {
+ /* this works around a weird behaviour on LynxOS 2.4.0:
+ * usually we have no problems using true SIGIO driven mouse input
+ * as it is used on the other UN*X Suns. On LynxOS we have a
+ * strange behaviour upon the very first server startup after a
+ * reboot. We won't get SIGIOs from the mouse device. The mouse
+ * will only move if we get SIGIOs from the keyboard.
+ * The solution (for now) is to use a WakeupHandler and
+ * poll the mouse file descriptor.
+ */
+ pScreen->WakeupHandler = sunWakeupHandler;
+ }
+#endif
+ if (!sunCursorInitialize (pScreen))
+ miDCInitialize (pScreen, &sunPointerScreenFuncs);
+ return TRUE;
+}
+
+#if NeedFunctionPrototypes
+Bool sunInitCommon (
+ int scrn,
+ ScreenPtr pScrn,
+ off_t offset,
+ Bool (*init1)(),
+ void (*init2)(),
+ Bool (*cr_cm)(),
+ Bool (*save)(),
+ int fb_off)
+#else
+Bool sunInitCommon (scrn, pScrn, offset, init1, init2, cr_cm, save, fb_off)
+ int scrn;
+ ScreenPtr pScrn;
+ off_t offset;
+ Bool (*init1)();
+ void (*init2)();
+ Bool (*cr_cm)();
+ Bool (*save)();
+ int fb_off;
+#endif
+{
+ unsigned char* fb = sunFbs[scrn].fbuf;
+ unsigned char* dac = sunFbs[scrn].ramdac;
+
+ if (!sunScreenAllocate (pScrn))
+ return FALSE;
+ if (!fb) {
+ if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size,
+ (unsigned long)offset + 0x00800000UL,
+ sunFbs[scrn].fd, "FB")) == NULL)
+ return FALSE;
+ sunFbs[scrn].fbuf = fb;
+ if (!dac)
+ {
+ unsigned long dacoffset;
+
+ if (ioctl(sunFbs[scrn].fd, TIO_QUERYRAMDAC, &dacoffset) < 0)
+ FatalError("can't query DAC addr\n");
+ if ((dac = sunMemoryMap((size_t) sunFbs[scrn].info.fb_cmsize * 3,
+ (unsigned long)offset + dacoffset,
+ sunFbs[scrn].fd, "DAC")) == NULL)
+ return FALSE;
+
+ sunFbs[scrn].ramdac = dac;
+ }
+ }
+ /* mfbScreenInit() or cfbScreenInit() */
+ if (!(*init1)(pScrn, fb + fb_off,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_height,
+ monitorResolution, monitorResolution,
+ sunFbs[scrn].info.fb_width,
+ sunFbs[scrn].info.fb_depth))
+ return FALSE;
+ miInitializeBackingStore(pScrn);
+ /* sunCGScreenInit() if cfb... */
+ if (init2)
+ (*init2)(pScrn);
+ if (!sunScreenInit(pScrn))
+ return FALSE;
+ (void) (*save) (pScrn, SCREEN_SAVER_OFF);
+ return (*cr_cm)(pScrn);
+}
+
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyInit.c b/xc/programs/Xserver/hw/sunLynx/sunLyInit.c
new file mode 100644
index 000000000..6f58aa548
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyInit.c
@@ -0,0 +1,659 @@
+/* $TOG: sunLyInit.c /main/3 1998/02/10 13:22:44 kaleb $ */
+
+/*
+ * This is sunInit.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyInit.c,v 3.7 1999/04/04 08:46:06 dawes Exp $ */
+
+/*
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ *
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+*******************************************************/
+
+#include "sun.h"
+#include "gcstruct.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "cfb.h"
+
+Bool onConsole = FALSE; /* wether stdin is /dev/con */
+
+/* maximum pixmap depth */
+#ifndef SUNMAXDEPTH
+#define SUNMAXDEPTH 8
+#endif
+
+extern Bool sunBW2Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define BW2I sunBW2Init
+#if SUNMAXDEPTH == 1 /* { */
+#define CG3I NULL
+#define CG6I NULL
+#else /* }{ */
+extern Bool sunCG3Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG3I sunCG3Init
+#ifdef FBTYPE_SUNFAST_COLOR /* { */
+extern Bool sunCG6Init(
+#if NeedFunctionPrototypes
+ int /* screen */,
+ ScreenPtr /* pScreen */,
+ int /* argc */,
+ char** /* argv */
+#endif
+);
+#define CG6I sunCG6Init
+#else /* }{ */
+#define CG6I NULL
+#endif /* } */
+#endif /* } */
+
+extern KeySymsRec sunKeySyms[];
+extern SunModmapRec *sunModMaps[];
+extern int sunMaxLayout;
+extern KeySym* sunType4KeyMaps[];
+extern SunModmapRec* sunType4ModMaps[];
+
+static Bool sunDevsInited = FALSE;
+
+Bool sunAutoRepeatHandlersInstalled; /* FALSE each time InitOutput called */
+Bool sunSwapLkeys = FALSE;
+Bool sunFlipPixels = FALSE;
+Bool sunFbInfo = FALSE;
+Bool sunCG4Frob = FALSE;
+Bool sunNoGX = FALSE;
+
+sunKbdPrivRec sunKbdPriv = {
+ -1, /* fd */
+ -1, /* type */
+ -1, /* layout */
+ 0, /* click */
+ (Leds)0, /* leds */
+};
+
+sunPtrPrivRec sunPtrPriv = {
+ -1, /* fd */
+ 0 /* Current button state */
+};
+
+/*
+ * The name member in the following table corresponds to the
+ * FBTYPE_* macros defined in /usr/include/sun/fbio.h file
+ */
+sunFbDataRec sunFbData[FBTYPE_LASTPLUSONE] = {
+ { NULL, "SUN1BW (bw1)" },
+ { NULL, "SUN1COLOR (cg1)" },
+ { BW2I, "SUN2BW (bw2)" },
+ { NULL, "SUN2COLOR (cg2)" },
+ { NULL, "SUN2GP (gp1/gp2)" },
+ { NULL, "SUN5COLOR (cg5/386i accel)" },
+ { CG3I, "SUN3COLOR (cg3)" },
+ { NULL, "MEMCOLOR (cg8)" },
+ { NULL, "SUN4COLOR (cg4)" },
+ { NULL, "NOTSUN1" },
+ { NULL, "NOTSUN2" },
+ { NULL, "NOTSUN3" },
+ { CG6I, "SUNFAST_COLOR (cg6/gx)" }, /* last we need */
+};
+
+/*
+ * a list of devices to try if there is no environment or command
+ * line list of devices
+ */
+#if SUNMAXDEPTH == 1 /* { */
+static char *fallbackList[] = {
+ "/dev/bwtwo",
+};
+#else /* }{ */
+static char *fallbackList[] = {
+ "/dev/bwtwo", "/dev/cgthree", "/dev/cgsix",
+};
+#endif /* } */
+
+#define FALLBACK_LIST_LEN sizeof fallbackList / sizeof fallbackList[0]
+
+fbFd sunFbs[MAXSCREENS];
+
+static PixmapFormatRec formats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD } /* 1-bit deep */
+#if SUNMAXDEPTH > 1
+ ,{ 8, 8, BITMAP_SCANLINE_PAD} /* 8-bit deep */
+#endif
+};
+#define NUMFORMATS (sizeof formats)/(sizeof formats[0])
+
+/*
+ * OpenFrameBuffer --
+ * Open a frame buffer according to several rules.
+ * Find the device to use by looking in the sunFbData table,
+ * an XDEVICE envariable, a -dev switch or using /dev/fb if trying
+ * to open screen 0 and all else has failed.
+ *
+ * Results:
+ * The fd of the framebuffer.
+ */
+static int OpenFrameBuffer(device, screen)
+ char *device; /* e.g. "/dev/cgtwo0" */
+ int screen; /* what screen am I going to be */
+{
+ int ret;
+ unsigned long dacoffset;
+ struct fbgattr *fbattr = NULL;
+ static int devFbUsed;
+ static struct fbgattr bw2 = {
+ 0, 0,
+ { FBTYPE_SUN2BW, 900, 1152, 1, 0, 0x00100000 },
+ { 0, -1},
+ -1
+ };
+ static struct fbgattr cg3 = {
+ 0, 0,
+ { FBTYPE_SUN3COLOR, 900, 1152, 8, 256, 0x00100000 },
+ { 0, -1},
+ -1
+ };
+ static struct fbgattr cg6 = {
+ 0, 0,
+ { FBTYPE_SUNFAST_COLOR, 900, 1152, 8, 256, 0x00100000 },
+ { 0, -1},
+ -1
+ };
+
+
+ sunFbs[screen].fd = sunKbdPriv.fd; /* /dev/con or /dev/kbd */
+ devFbUsed = TRUE;
+ /* apply some magic to work out what we're running on.
+ * why couldn't they just spend some time on a little
+ * FBIOGATTR ioctl()
+ */
+
+ ret = FALSE;
+ if (ioctl(sunFbs[screen].fd, TIO_QUERYRAMDAC, &dacoffset) < 0)
+ FatalError("can't query DAC addr\n");
+ if (dacoffset == 0x400000) {
+ if (strcmp(device, "/dev/cgthree") == 0)
+ fbattr = &cg3;
+ }
+ else if (dacoffset == 0x200000) {
+ if (strcmp(device, "/dev/cgsix") == 0)
+ fbattr = &cg6;
+ }
+#ifdef PATCHED_CONSOLE
+ else if (dacoffset == 0) {
+ if (strcmp(device, "/dev/bw2") == 0)
+ fbattr = &bw2;
+ }
+#endif
+ else
+ ErrorF("bogus DAC addr 0x%x, maybe it's the silly BWTWO bug\n", dacoffset);
+
+ if (fbattr) {
+ ret = TRUE;
+ sunFbs[screen].info = fbattr->fbtype;
+ }
+ sunFbs[screen].fbPriv = (pointer) fbattr;
+ if (fbattr && fbattr->fbtype.fb_type < FBTYPE_LASTPLUSONE &&
+ !sunFbData[fbattr->fbtype.fb_type].init) {
+ int _i;
+
+ ret = FALSE;
+ for (_i = 0; _i < FB_ATTR_NEMUTYPES; _i++) {
+ if (sunFbData[fbattr->emu_types[_i]].init) {
+ sunFbs[screen].info.fb_type = fbattr->emu_types[_i];
+ ret = TRUE;
+ if (sunFbInfo)
+ ErrorF ("%s is emulating a %s\n", device,
+ sunFbData[fbattr->fbtype.fb_type].name);
+ break;
+ }
+ }
+ }
+ if (sunFbInfo)
+ ErrorF ("%s is really a %s\n", device,
+ sunFbData[fbattr ? fbattr->fbtype.fb_type : sunFbs[screen].info.fb_type].name);
+ if (!ret)
+ sunFbs[screen].fd = -1;
+ return ret;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * SigIOHandler --
+ * Signal handler for SIGIO - input is available.
+ *
+ * Results:
+ * sunSigIO is set - ProcessInputEvents() will be called soon.
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+/*static*/ void SigIOHandler(sig)
+ int sig;
+{
+ int olderrno = errno;
+ sunEnqueueEvents();
+ errno = olderrno;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunNonBlockConsoleOff --
+ * Turn non-blocking mode on the console off, so you don't get logged
+ * out when the server exits.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+void sunNonBlockConsoleOff(
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ int i;
+
+#if 0
+ if (sunKbdPriv.fd >= 0)
+ {
+ i = fcntl(sunKbdPriv.fd, F_GETFL, 0);
+ if (i >= 0 && (i & FNDELAY)) {
+ (void) fcntl(sunKbdPriv.fd, F_SETFL, i & ~FNDELAY);
+ }
+ }
+#endif
+ for (i = 0; i < MAXSCREENS; i++) {
+ if (sunFbs[i].fbuf) {
+ smem_create(NULL, (char*)sunFbs[i].fbuf, 0, SM_DETACH);
+ smem_remove("FB");
+ sunFbs[i].fbuf = NULL;
+ }
+ if (sunFbs[i].ramdac) {
+ smem_create(NULL, (char*)sunFbs[i].ramdac, 0, SM_DETACH);
+ smem_remove("DAC");
+ sunFbs[i].ramdac = NULL;
+ }
+ if (sunFbs[i].fhc) {
+ smem_create(NULL, (char*)sunFbs[i].fhc, 0, SM_DETACH);
+ smem_remove("FHC_THC");
+ sunFbs[i].fhc = NULL;
+ sunFbs[i].thc = NULL;
+ }
+ if (sunFbs[i].fb) {
+ smem_create(NULL, (char*)sunFbs[i].fb, 0, SM_DETACH);
+ smem_remove("FBC_TEC");
+ sunFbs[i].fb = NULL;
+ sunFbs[i].tec = NULL;
+ }
+ }
+}
+
+static char** GetDeviceList (argc, argv)
+ int argc;
+ char **argv;
+{
+ int i;
+ char *envList = NULL;
+ char *cmdList = NULL;
+ char **deviceList = (char **)NULL;
+
+ for (i = 1; i < argc; i++)
+ if (strcmp (argv[i], "-dev") == 0 && i+1 < argc) {
+ cmdList = argv[i + 1];
+ break;
+ }
+ if (!cmdList)
+ envList = getenv ("XDEVICE");
+
+ if (cmdList || envList) {
+ char *_tmpa;
+ char *_tmpb;
+ int _i1;
+ deviceList = (char **) xalloc ((MAXSCREENS + 1) * sizeof (char *));
+ _tmpa = (cmdList) ? cmdList : envList;
+ for (_i1 = 0; _i1 < MAXSCREENS; _i1++) {
+ _tmpb = strtok (_tmpa, ":");
+ if (_tmpb)
+ deviceList[_i1] = _tmpb;
+ else
+ deviceList[_i1] = NULL;
+ _tmpa = NULL;
+ }
+ deviceList[MAXSCREENS] = NULL;
+ }
+ if (!deviceList) {
+ /* no environment and no cmdline, so default */
+ deviceList =
+ (char **) xalloc ((FALLBACK_LIST_LEN + 1) * sizeof (char *));
+ for (i = 0; i < FALLBACK_LIST_LEN; i++)
+ deviceList[i] = fallbackList[i];
+ deviceList[FALLBACK_LIST_LEN] = NULL;
+ }
+ return deviceList;
+}
+
+static void getKbdType()
+{
+#if defined(PATCHED_CONSOLE)
+ int ii;
+
+ for (ii = 0; ii < 3; ii++) {
+#if 0
+ sunKbdWait();
+#endif
+ if (ioctl (sunKbdPriv.fd, KIOCTYPE, &sunKbdPriv.type) < 0 && errno == EINVAL) {
+ ErrorF("failed to get keyboard type, maybe wrong console driver:");
+ ErrorF(" assuming Type 4 keyboard\n");
+ sunKbdPriv.type = KB_SUN4;
+ return;
+ }
+ switch (sunKbdPriv.type) {
+ case KB_SUN2:
+ case KB_SUN3:
+ case KB_SUN4:
+ return;
+ default:
+ sunChangeKbdTranslation(sunKbdPriv.fd, FALSE);
+ continue;
+ }
+ }
+ FatalError ("Unsupported keyboard type %d\n", sunKbdPriv.type);
+#else
+ sunKbdPriv.type = KB_SUN4;
+#endif
+}
+
+void OsVendorInit(
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ static int inited;
+ if (!inited) {
+ /* weird hack to prevent logout on X server shutdown */
+ if (onConsole)
+ sunKbdPriv.fd = open ("/dev/con", O_RDWR, 0);
+ else
+ sunKbdPriv.fd = open ("/dev/kbd", O_RDWR, 0);
+ sunPtrPriv.fd = open ("/dev/mouse", O_RDWR, 0);
+
+ getKbdType ();
+ if (sunKbdPriv.type == KB_SUN4) {
+#if defined(PATCHED_CONSOLE)
+ if ( ioctl (sunKbdPriv.fd, KIOCLAYOUT, &sunKbdPriv.layout) < 0 && errno == EINVAL) {
+ ErrorF("failed to get keyboard layout, maybe wrong console driver:");
+ ErrorF(" assuming layout 0\n");
+ sunKbdPriv.layout = 0;
+ }
+ if (sunKbdPriv.layout < 0 ||
+ sunKbdPriv.layout > sunMaxLayout ||
+ sunType4KeyMaps[sunKbdPriv.layout] == NULL)
+ FatalError ("Unsupported keyboard type 4 layout %d\n",
+ sunKbdPriv.layout);
+#else
+ sunKbdPriv.layout = 0; /* default: Type 4 */
+#endif
+ sunKeySyms[KB_SUN4].map = sunType4KeyMaps[sunKbdPriv.layout];
+ sunModMaps[KB_SUN4] = sunType4ModMaps[sunKbdPriv.layout];
+ }
+ inited = 1;
+ }
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitOutput --
+ * Initialize screenInfo for all actually accessible framebuffers.
+ * The
+ *
+ * Results:
+ * screenInfo init proc field set
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+
+void InitOutput(pScreenInfo, argc, argv)
+ ScreenInfo *pScreenInfo;
+ int argc;
+ char **argv;
+{
+ int i, scr;
+ char **devList;
+ static int setup_on_exit = 0;
+ extern Bool RunFromSmartParent;
+
+ if (!monitorResolution)
+ monitorResolution = 90;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+ for (i=0; i< NUMFORMATS; i++)
+ pScreenInfo->formats[i] = formats[i];
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ sunAutoRepeatHandlersInstalled = FALSE;
+ if (!sunDevsInited) {
+ /* first time ever */
+ for (scr = 0; scr < MAXSCREENS; scr++)
+ sunFbs[scr].fd = -1;
+ devList = GetDeviceList (argc, argv);
+ for (i = 0, scr = 0; devList[i] != NULL && scr < MAXSCREENS; i++)
+ if (OpenFrameBuffer (devList[i], scr))
+ scr++;
+ sunDevsInited = TRUE;
+ xfree (devList);
+ }
+ for (scr = 0; scr < MAXSCREENS; scr++)
+ if (sunFbs[scr].fd != -1)
+ (void) AddScreen (sunFbData[sunFbs[scr].info.fb_type].init,
+ argc, argv);
+ (void) OsSignal(SIGWINCH, SIG_IGN);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitInput --
+ * Initialize all supported input devices...what else is there
+ * besides pointer and keyboard?
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Two DeviceRec's are allocated and registered as the system pointer
+ * and keyboard devices.
+ *
+ *-----------------------------------------------------------------------
+ */
+void InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ DevicePtr p, k;
+ extern Bool mieqInit();
+
+ k = AddInputDevice(sunKbdProc, TRUE);
+ p = AddInputDevice(sunMouseProc, TRUE);
+ if (!p || !k)
+ FatalError("failed to create input devices in InitInput");
+
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+ miRegisterPointerDevice(screenInfo.screens[0], p);
+ (void) mieqInit (k, p);
+
+#define SET_FLOW(fd) fcntl(fd, F_SETFL, FASYNC)
+ (void) OsSignal(SIGIO, SigIOHandler);
+#define WANT_SIGNALS(fd) fcntl(fd, F_SETOWN, getpid())
+ if (sunKbdPriv.fd >= 0) {
+ if (SET_FLOW(sunKbdPriv.fd) == -1 || WANT_SIGNALS(sunKbdPriv.fd) == -1) {
+ (void) close (sunKbdPriv.fd);
+ sunKbdPriv.fd = -1;
+ FatalError("Async kbd I/O failed in InitInput");
+ }
+ }
+ /* SIGIO doesn't work reliable for the mouse device,
+ * esp. for the first server after a reboot. We enable it
+ * anyway, gives smoother movements
+ */
+ if (sunPtrPriv.fd >= 0) {
+ if (SET_FLOW(sunPtrPriv.fd) == -1 || WANT_SIGNALS(sunPtrPriv.fd) == -1) {
+ (void) close (sunPtrPriv.fd);
+ sunPtrPriv.fd = -1;
+ FatalError("ASYNC mouse I/O failed in InitInput");
+ }
+ }
+}
+
+
+#if SUNMAXDEPTH == 8
+
+Bool
+sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
+ width);
+}
+
+Bool
+sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)
+ register ScreenPtr pScreen;
+ pointer pbits; /* pointer to screen bitmap */
+ int xsize, ysize; /* in pixels */
+ int dpix, dpiy; /* dots per inch */
+ int width; /* pixel width of frame buffer */
+ int bpp; /* bits per pixel of root */
+{
+ return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
+}
+#endif /* SUNMAXDEPTH */
+
+#ifdef DPMSExtension
+/**************************************************************
+ * DPMSSet(), DPMSGet(), DPMSSupported()
+ *
+ * stubs
+ *
+ ***************************************************************/
+
+void DPMSSet (level)
+ int level;
+{
+}
+
+int DPMSGet (level)
+ int* level;
+{
+ return -1;
+}
+
+Bool DPMSSupported ()
+{
+ return FALSE;
+}
+#endif
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyIo.c b/xc/programs/Xserver/hw/sunLynx/sunLyIo.c
new file mode 100644
index 000000000..7fc70c14b
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyIo.c
@@ -0,0 +1,394 @@
+/* $TOG: sunLyIo.c /main/2 1998/02/10 13:22:50 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyIo.c,v 3.3 1998/10/04 09:38:47 dawes Exp $ */
+
+/*-
+ * This is sunIo.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+ /*
+ *
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ *
+ *
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#define NEED_EVENTS
+#include "sun.h"
+#include <stat.h>
+
+/*-
+ *-----------------------------------------------------------------------
+ * ProcessInputEvents --
+ * Retrieve all waiting input events and pass them to DIX in their
+ * correct chronological order. Only reads from the system pointer
+ * and keyboard.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Events are passed to the DIX layer.
+ *
+ *-----------------------------------------------------------------------
+ */
+void
+ProcessInputEvents ()
+{
+ (void) mieqProcessInputEvents ();
+ miPointerUpdate ();
+}
+
+/*
+ *-----------------------------------------------------------------------
+ * sunEnqueueEvents
+ * When a SIGIO is received, read device hard events and
+ * enqueue them using the mi event queue
+ */
+
+void sunEnqueueEvents (
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ Firm_event *ptrEvents, /* Current pointer event */
+ *kbdEvents; /* Current keyboard event */
+ int numPtrEvents, /* Number of remaining pointer events */
+ numKbdEvents; /* Number of remaining keyboard events */
+ int nPE, /* Original number of pointer events */
+ nKE; /* Original number of keyboard events */
+ Bool PtrAgain, /* need to (re)read */
+ KbdAgain; /* need to (re)read */
+ DeviceIntPtr pPointer;
+ DeviceIntPtr pKeyboard;
+ sunKbdPrivPtr kbdPriv;
+ sunPtrPrivPtr ptrPriv;
+
+ pPointer = (DeviceIntPtr)LookupPointerDevice();
+ pKeyboard = (DeviceIntPtr)LookupKeyboardDevice();
+ ptrPriv = (sunPtrPrivPtr) pPointer->public.devicePrivate;
+ kbdPriv = (sunKbdPrivPtr) pKeyboard->public.devicePrivate;
+ if (!pPointer->public.on || !pKeyboard->public.on)
+ return;
+
+ numPtrEvents = 0;
+ PtrAgain = TRUE;
+ numKbdEvents = 0;
+ KbdAgain = TRUE;
+
+ /*
+ * So long as one event from either device remains unprocess, we loop:
+ * Take the oldest remaining event and pass it to the proper module
+ * for processing. The DDXEvent will be sent to ProcessInput by the
+ * function called.
+ */
+ while (1) {
+ /*
+ * Get events from both the pointer and the keyboard, storing the number
+ * of events gotten in nPE and nKE and keeping the start of both arrays
+ * in pE and kE
+ */
+ if ((numPtrEvents == 0) && PtrAgain) {
+ ptrEvents = sunMouseGetEvents (ptrPriv->fd, pPointer->public.on,
+ &nPE, &PtrAgain);
+ numPtrEvents = nPE;
+ }
+ if ((numKbdEvents == 0) && KbdAgain) {
+ kbdEvents = sunKbdGetEvents (kbdPriv->fd, pKeyboard->public.on,
+ &nKE, &KbdAgain);
+ numKbdEvents = nKE;
+ }
+ if ((numPtrEvents == 0) && (numKbdEvents == 0))
+ break;
+ if (numPtrEvents && numKbdEvents) {
+ if (timercmp (&kbdEvents->time, &ptrEvents->time, <)) {
+ sunKbdEnqueueEvent (pKeyboard, kbdEvents);
+ numKbdEvents--;
+ kbdEvents++;
+ } else {
+ sunMouseEnqueueEvent (pPointer, ptrEvents);
+ numPtrEvents--;
+ ptrEvents++;
+ }
+ } else if (numKbdEvents) {
+ sunKbdEnqueueEvent (pKeyboard, kbdEvents);
+ numKbdEvents--;
+ kbdEvents++;
+ } else {
+ sunMouseEnqueueEvent (pPointer, ptrEvents);
+ numPtrEvents--;
+ ptrEvents++;
+ }
+ }
+}
+
+void sunEnqueueKbdEvents (
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ Firm_event *kbdEvents; /* Current keyboard event */
+ int numKbdEvents; /* Number of remaining keyboard events */
+ int nKE; /* Original number of keyboard events */
+ Bool KbdAgain; /* need to (re)read */
+ DeviceIntPtr pKeyboard;
+ sunKbdPrivPtr kbdPriv;
+
+ pKeyboard = (DeviceIntPtr)LookupKeyboardDevice();
+ kbdPriv = (sunKbdPrivPtr) pKeyboard->public.devicePrivate;
+ if (!pKeyboard->public.on)
+ return;
+
+ numKbdEvents = 0;
+ KbdAgain = TRUE;
+
+ /*
+ * So long as one event from the device remains unprocess, we loop:
+ * Take the oldest remaining event and pass it to the proper module
+ * for processing. The DDXEvent will be sent to ProcessInput by the
+ * function called.
+ */
+ while (1) {
+ /*
+ * Get events from both the keyboard, storing the number
+ * of events gotten in nKE and keeping the start of the array
+ * in kE
+ */
+ if ((numKbdEvents == 0) && KbdAgain) {
+ kbdEvents = sunKbdGetEvents (kbdPriv->fd, pKeyboard->public.on,
+ &nKE, &KbdAgain);
+ numKbdEvents = nKE;
+ }
+ if (numKbdEvents == 0)
+ break;
+ sunKbdEnqueueEvent (pKeyboard, kbdEvents);
+ numKbdEvents--;
+ kbdEvents++;
+ }
+}
+
+void sunEnqueueMseEvents (
+#if NeedFunctionPrototypes
+ void
+#endif
+)
+{
+ Firm_event *ptrEvents; /* Current pointer event */
+ int numPtrEvents; /* Number of remaining pointer events */
+ int nPE; /* Original number of pointer events */
+ Bool PtrAgain; /* need to (re)read */
+ DeviceIntPtr pPointer;
+ sunPtrPrivPtr ptrPriv;
+
+ pPointer = (DeviceIntPtr)LookupPointerDevice();
+ ptrPriv = (sunPtrPrivPtr) pPointer->public.devicePrivate;
+ if (!pPointer->public.on)
+ return;
+
+ numPtrEvents = 0;
+ PtrAgain = TRUE;
+
+ /*
+ * So long as one events from the device remain unprocess, we loop:
+ * Take the oldest remaining event and pass it to the proper module
+ * for processing. The DDXEvent will be sent to ProcessInput by the
+ * function called.
+ */
+ while (1) {
+ /*
+ * Get events from the pointer, storing the number
+ * of events gotten in nPE and keeping the start of the arrays
+ * in pE
+ */
+ if ((numPtrEvents == 0) && PtrAgain) {
+ ptrEvents = sunMouseGetEvents (ptrPriv->fd, pPointer->public.on,
+ &nPE, &PtrAgain);
+ numPtrEvents = nPE;
+ }
+ if (numPtrEvents == 0)
+ break;
+
+ sunMouseEnqueueEvent (pPointer, ptrEvents);
+ numPtrEvents--;
+ ptrEvents++;
+ }
+}
+
+/*
+ * DDX - specific abort routine. Called by AbortServer().
+ */
+void AbortDDX()
+{
+ int i;
+ ScreenPtr pScreen;
+ DevicePtr devPtr;
+
+ (void) OsSignal (SIGIO, SIG_IGN);
+ if (sunKbdPriv.fd != -1) {
+ if (devPtr = LookupKeyboardDevice())
+ (void) sunChangeKbdTranslation (((sunKbdPrivPtr)(devPtr->devicePrivate))->fd, FALSE);
+ }
+ sunNonBlockConsoleOff ();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ pScreen = screenInfo.screens[i];
+ (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
+ sunDisableCursor (pScreen);
+ }
+}
+
+/* Called by GiveUp(). */
+void
+ddxGiveUp()
+{
+ AbortDDX ();
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+{
+ extern void UseMsg();
+ extern Bool onConsole;
+ struct stat s0, scon;
+
+ if (fstat(0, &s0) != -1 && stat("/dev/con", &scon) != -1)
+ onConsole = !memcmp(&s0, &scon, sizeof(s0));
+
+#ifndef XKB
+ if (strcmp (argv[i], "-ar1") == 0) { /* -ar1 int */
+ if (++i >= argc) UseMsg ();
+ sunAutoRepeatInitiate = 1000 * (long)atoi(argv[i]);
+ if (sunAutoRepeatInitiate > 1000000)
+ sunAutoRepeatInitiate = 999000;
+ return 2;
+ }
+ if (strcmp (argv[i], "-ar2") == 0) { /* -ar2 int */
+ if (++i >= argc) UseMsg ();
+ sunAutoRepeatDelay = 1000 * (long)atoi(argv[i]);
+ if (sunAutoRepeatDelay > 1000000)
+ sunAutoRepeatDelay = 999000;
+ return 2;
+ }
+#endif
+ if (strcmp (argv[i], "-swapLkeys") == 0) { /* -swapLkeys */
+ sunSwapLkeys = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-debug") == 0) { /* -debug */
+ return 1;
+ }
+ if (strcmp (argv[i], "-dev") == 0) { /* -dev /dev/mumble */
+ if (++i >= argc) UseMsg ();
+ return 2;
+ }
+ if (strcmp (argv[i], "-mono") == 0) { /* -mono */
+ return 1;
+ }
+ if (strcmp (argv[i], "-zaphod") == 0) { /* -zaphod */
+ sunActiveZaphod = FALSE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-flipPixels") == 0) { /* -flipPixels */
+ sunFlipPixels = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-fbinfo") == 0) { /* -fbinfo */
+ sunFbInfo = TRUE;
+ return 1;
+ }
+ if (strcmp (argv[i], "-kbd") == 0) { /* -kbd */
+ if (++i >= argc) UseMsg();
+ return 2;
+ }
+ if (strcmp (argv[i], "-protect") == 0) { /* -protect */
+ if (++i >= argc) UseMsg();
+ return 2;
+ }
+ if (strcmp (argv[i], "-noGX") == 0) {
+ sunNoGX = TRUE;
+ return 1;
+ }
+ return 0;
+}
+
+void
+ddxUseMsg()
+{
+#ifndef XKB
+ ErrorF("-ar1 int set autorepeat initiate time\n");
+ ErrorF("-ar2 int set autorepeat interval time\n");
+#endif
+ ErrorF("-swapLkeys swap keysyms on L1..L10\n");
+ ErrorF("-debug disable non-blocking console mode\n");
+ ErrorF("-dev fn[:fn][:fn] name of device[s] to open\n");
+ ErrorF("-mono force monochrome-only screen\n");
+ ErrorF("-zaphod disable active Zaphod mode\n");
+ ErrorF("-fbinfo tell more about the found frame buffer(s)\n");
+#ifdef UNDOCUMENTED
+ ErrorF("-noGX treat the GX as a dumb frame buffer\n");
+#endif
+}
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyKbd.c b/xc/programs/Xserver/hw/sunLynx/sunLyKbd.c
new file mode 100644
index 000000000..11440b1ba
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyKbd.c
@@ -0,0 +1,1137 @@
+/* $TOG: sunLyKbd.c /main/2 1998/02/10 13:22:54 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyKbd.c,v 3.4 1998/10/04 09:38:48 dawes Exp $ */
+
+/*
+ * This is sunKbd.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#define NEED_EVENTS
+#include "sun.h"
+#include "keysym.h"
+#include "Sunkeysym.h"
+#include "osdep.h"
+
+#include "Xpoll.h"
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBsrv.h>
+#endif
+
+#define SUN_LED_MASK 0x0f
+#define MIN_KEYCODE 7 /* necessary to avoid the mouse buttons */
+#define MAX_KEYCODE 255 /* limited by the protocol */
+#ifndef KB_SUN4
+#define KB_SUN4 4
+#endif
+
+#define AUTOREPEAT_INITIATE 400
+#define AUTOREPEAT_DELAY 50
+
+#define tvminus(tv, tv1, tv2) /* tv = tv1 - tv2 */ \
+ if ((tv1).tv_usec < (tv2).tv_usec) { \
+ (tv1).tv_usec += 1000000; \
+ (tv1).tv_sec -= 1; \
+ } \
+ (tv).tv_usec = (tv1).tv_usec - (tv2).tv_usec; \
+ (tv).tv_sec = (tv1).tv_sec - (tv2).tv_sec;
+
+#define tvplus(tv, tv1, tv2) /* tv = tv1 + tv2 */ \
+ (tv).tv_sec = (tv1).tv_sec + (tv2).tv_sec; \
+ (tv).tv_usec = (tv1).tv_usec + (tv2).tv_usec; \
+ if ((tv).tv_usec > 1000000) { \
+ (tv).tv_usec -= 1000000; \
+ (tv).tv_sec += 1; \
+ }
+
+extern KeySymsRec sunKeySyms[];
+extern SunModmapRec* sunModMaps[];
+
+long sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE;
+long sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY;
+
+static int autoRepeatKeyDown = 0;
+static int autoRepeatReady;
+static int autoRepeatFirst;
+static struct timeval autoRepeatLastKeyDownTv;
+static struct timeval autoRepeatDeltaTv;
+
+void sunKbdWait()
+{
+ static struct timeval lastChngKbdTransTv;
+ struct timeval tv;
+ struct timeval lastChngKbdDeltaTv;
+ unsigned int lastChngKbdDelta;
+
+ X_GETTIMEOFDAY(&tv);
+ if (!lastChngKbdTransTv.tv_sec)
+ lastChngKbdTransTv = tv;
+ tvminus(lastChngKbdDeltaTv, tv, lastChngKbdTransTv);
+ lastChngKbdDelta = TVTOMILLI(lastChngKbdDeltaTv);
+ if (lastChngKbdDelta < 750) {
+ unsigned wait;
+ /*
+ * We need to guarantee at least 750 milliseconds between
+ * calls to KIOCTRANS. YUCK!
+ */
+ wait = (750L - lastChngKbdDelta) * 1000L;
+ usleep (wait);
+ X_GETTIMEOFDAY(&tv);
+ }
+ lastChngKbdTransTv = tv;
+}
+
+static void SwapLKeys(keysyms)
+ KeySymsRec* keysyms;
+{
+ unsigned int i;
+ KeySym k;
+
+ for (i = 2; i < keysyms->maxKeyCode * keysyms->mapWidth; i++)
+ if (keysyms->map[i] == XK_L1 ||
+ keysyms->map[i] == XK_L2 ||
+ keysyms->map[i] == XK_L3 ||
+ keysyms->map[i] == XK_L4 ||
+ keysyms->map[i] == XK_L5 ||
+ keysyms->map[i] == XK_L6 ||
+ keysyms->map[i] == XK_L7 ||
+ keysyms->map[i] == XK_L8 ||
+ keysyms->map[i] == XK_L9 ||
+ keysyms->map[i] == XK_L10) {
+ /* yes, I could have done a clever two line swap! */
+ k = keysyms->map[i - 2];
+ keysyms->map[i - 2] = keysyms->map[i];
+ keysyms->map[i] = k;
+ }
+}
+
+static void SetLights (ctrl, fd)
+ KeybdCtrl* ctrl;
+ int fd;
+{
+#ifdef KIOCSLED
+ static unsigned char led_tab[16] = {
+ 0,
+ LED_NUM_LOCK,
+ LED_SCROLL_LOCK,
+ LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_COMPOSE,
+ LED_COMPOSE | LED_NUM_LOCK,
+ LED_COMPOSE | LED_SCROLL_LOCK,
+ LED_COMPOSE | LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK,
+ LED_CAPS_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_SCROLL_LOCK,
+ LED_CAPS_LOCK | LED_SCROLL_LOCK | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_NUM_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_SCROLL_LOCK,
+ LED_CAPS_LOCK | LED_COMPOSE | LED_SCROLL_LOCK | LED_NUM_LOCK
+ };
+ if (ioctl (fd, KIOCSLED, (caddr_t)&led_tab[ctrl->leds & 0x0f]) == -1)
+#if defined(PATCHED_CONSOLE)
+ Error("Failed to set keyboard lights");
+#else
+ ; /* silly driver bug always returns error */
+#endif
+#endif
+}
+
+
+static void ModLight (device, on, led)
+ DeviceIntPtr device;
+ Bool on;
+ int led;
+{
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if(on) {
+ ctrl->leds |= led;
+ pPriv->leds |= led;
+ } else {
+ ctrl->leds &= ~led;
+ pPriv->leds &= ~led;
+ }
+ SetLights (ctrl, pPriv->fd);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunBell --
+ * Ring the terminal/keyboard bell
+ *
+ * Results:
+ * Ring the keyboard bell for an amount of time proportional to
+ * "loudness."
+ *
+ * Side Effects:
+ * None, really...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void bell (
+ int fd,
+ int duration)
+#else
+static void bell (fd, duration)
+ int fd;
+ int duration;
+#endif
+{
+#if defined(PATCHED_CONSOLE)
+ int kbdCmd; /* Command to give keyboard */
+
+ kbdCmd = KBD_CMD_BELL;
+ if (ioctl (fd, KIOCCMD, &kbdCmd) == -1) {
+ Error("Failed to activate bell");
+ return;
+ }
+ if (duration) usleep (duration);
+ kbdCmd = KBD_CMD_NOBELL;
+ if (ioctl (fd, KIOCCMD, &kbdCmd) == -1)
+ Error ("Failed to deactivate bell");
+#endif
+}
+
+#if NeedFunctionPrototypes
+static void sunBell (
+ int percent,
+ DeviceIntPtr device,
+ pointer ctrl,
+ int unused)
+#else
+static void sunBell (percent, device, ctrl, unused)
+ int percent; /* Percentage of full volume */
+ DeviceIntPtr device; /* Keyboard to ring */
+ pointer ctrl;
+ int unused;
+#endif
+{
+ KeybdCtrl* kctrl = (KeybdCtrl*) ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (percent == 0 || kctrl->bell == 0)
+ return;
+
+ bell (pPriv->fd, kctrl->bell_duration * 1000);
+}
+
+static void sunEnqueueEvent (xE)
+ xEvent* xE;
+{
+ sigset_t holdmask;
+
+ (void) sigaddset (&holdmask, SIGIO);
+ (void) sigprocmask (SIG_BLOCK, &holdmask, (sigset_t*)NULL);
+ mieqEnqueue (xE);
+ (void) sigprocmask (SIG_UNBLOCK, &holdmask, (sigset_t*)NULL);
+}
+
+
+#define XLED_NUM_LOCK 0x1
+#define XLED_COMPOSE 0x4
+#define XLED_SCROLL_LOCK 0x2
+#define XLED_CAPS_LOCK 0x8
+
+static KeyCode LookupKeyCode (keysym, keysymsrec)
+ KeySym keysym;
+ KeySymsPtr keysymsrec;
+{
+ KeyCode i;
+ int ii, index = 0;
+
+ for (i = keysymsrec->minKeyCode; i < keysymsrec->maxKeyCode; i++)
+ for (ii = 0; ii < keysymsrec->mapWidth; ii++)
+ if (keysymsrec->map[index++] == keysym)
+ return i;
+}
+
+static void pseudoKey(device, down, keycode)
+ DeviceIntPtr device;
+ Bool down;
+ KeyCode keycode;
+{
+ int bit;
+ CARD8 modifiers;
+ CARD16 mask;
+ BYTE* kptr;
+
+ kptr = &device->key->down[keycode >> 3];
+ bit = 1 << (keycode & 7);
+ modifiers = device->key->modifierMap[keycode];
+ if (down) {
+ /* fool dix into thinking this key is now "down" */
+ int i;
+ *kptr |= bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ device->key->modifierKeyCount[i]++;
+ device->key->state += mask;
+ modifiers &= ~mask;
+ }
+ } else {
+ /* fool dix into thinking this key is now "up" */
+ if (*kptr & bit) {
+ int i;
+ *kptr &= ~bit;
+ device->key->prev_state = device->key->state;
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ if (mask & modifiers) {
+ if (--device->key->modifierKeyCount[i] <= 0) {
+ device->key->state &= ~mask;
+ device->key->modifierKeyCount[i] = 0;
+ }
+ modifiers &= ~mask;
+ }
+ }
+ }
+}
+
+static void DoLEDs(device, ctrl, pPriv)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+ sunKbdPrivPtr pPriv;
+{
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if ((ctrl->leds & XLED_CAPS_LOCK) && !(pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_CAPS_LOCK) && (pPriv->leds & XLED_CAPS_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_NUM_LOCK) && !(pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_NUM_LOCK) && (pPriv->leds & XLED_NUM_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_SCROLL_LOCK) && !(pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_SCROLL_LOCK) && (pPriv->leds & XLED_SCROLL_LOCK))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms));
+
+ if ((ctrl->leds & XLED_COMPOSE) && !(pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, TRUE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+
+ if (!(ctrl->leds & XLED_COMPOSE) && (pPriv->leds & XLED_COMPOSE))
+ pseudoKey(device, FALSE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+#ifdef XKB
+ }
+#endif
+ pPriv->leds = ctrl->leds & 0x0f;
+ SetLights (ctrl, pPriv->fd);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdCtrl --
+ * Alter some of the keyboard control parameters
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * Some...
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+static void sunKbdCtrl (
+ DeviceIntPtr device,
+ KeybdCtrl* ctrl)
+#else
+static void sunKbdCtrl (device, ctrl)
+ DeviceIntPtr device; /* Keyboard to alter */
+ KeybdCtrl* ctrl;
+#endif
+{
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (pPriv->fd < 0) return;
+
+ if (ctrl->click != pPriv->click) {
+ int kbdClickCmd;
+
+ pPriv->click = ctrl->click;
+#if defined(PATCHED_CONSOLE)
+ kbdClickCmd = pPriv->click ? KBD_CMD_CLICK : KBD_CMD_NOCLICK;
+ if (ioctl (pPriv->fd, KIOCCMD, &kbdClickCmd) == -1)
+ Error("Failed to set keyclick");
+#endif
+ }
+ if (pPriv->type == KB_SUN4 && pPriv->leds != ctrl->leds & 0x0f)
+ DoLEDs(device, ctrl, pPriv);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunInitKbdNames --
+ * Handle the XKB initialization
+ *
+ * Results:
+ * None.
+ *
+ * Comments:
+ * This function needs considerable work, in conjunctions with
+ * the need to add geometry descriptions of Sun Keyboards.
+ * It would also be nice to have #defines for all the keyboard
+ * layouts so that we don't have to have these hard-coded
+ * numbers.
+ *
+ *-----------------------------------------------------------------------
+ */
+#ifdef XKB
+#if NeedFunctionPrototypes
+static void sunInitKbdNames (
+ XkbComponentNamesRec* names,
+ sunKbdPrivPtr pKbd)
+#else
+static void sunInitKbdNames (names, pKbd)
+ XkbComponentNamesRec* names;
+ sunKbdPrivPtr pKbd;
+#endif
+{
+#ifndef XKBBUFSIZE
+#define XKBBUFSIZE 64
+#endif
+ static char keycodesbuf[XKBBUFSIZE];
+ static char geometrybuf[XKBBUFSIZE];
+ static char symbolsbuf[XKBBUFSIZE];
+
+ names->keymap = NULL;
+ names->compat = "compat/complete";
+ names->types = "types/complete";
+ names->keycodes = keycodesbuf;
+ names->geometry = geometrybuf;
+ names->symbols = symbolsbuf;
+ (void) strcpy (keycodesbuf, "keycodes/");
+ (void) strcpy (geometrybuf, "geometry/");
+ (void) strcpy (symbolsbuf, "symbols/");
+
+ /* keycodes & geometry */
+ switch (pKbd->type) {
+ case KB_SUN2:
+ (void) strcat (names->keycodes, "sun(type2)");
+ (void) strcat (names->geometry, "sun(type2)");
+ (void) strcat (names->symbols, "us(sun2)");
+ break;
+ case KB_SUN3:
+ (void) strcat (names->keycodes, "sun(type3)");
+ (void) strcat (names->geometry, "sun(type3)");
+ (void) strcat (names->symbols, "us(sun3)");
+ break;
+ case KB_SUN4:
+ if (pKbd->layout == 19) {
+ (void) strcat (names->keycodes, "sun(US101A)");
+ (void) strcat (names->geometry, "pc101-NG"); /* XXX */
+ (void) strcat (names->symbols, "us(pc101)");
+ } else if (pKbd->layout < 33) {
+ (void) strcat (names->keycodes, "sun(type4)");
+ (void) strcat (names->geometry, "sun(type4)");
+ if (sunSwapLkeys)
+ (void) strcat (names->symbols, "sun/us(sun4ol)");
+ else
+ (void) strcat (names->symbols, "sun/us(sun4)");
+ } else {
+ (void) strcat (names->keycodes, "sun(type5)");
+ if (pKbd->layout == 34 || pKbd->layout == 81)
+ (void) strcat (names->geometry, "sun(type5unix)");
+ else
+ (void) strcat (names->geometry, "sun(type5)");
+ if (sunSwapLkeys)
+ (void) strcat (names->symbols, "sun/us(sun5ol)");
+ else
+ (void) strcat (names->symbols, "sun/us(sun5)");
+ }
+ break;
+ default:
+ names->keycodes = names->geometry = NULL;
+ break;
+ }
+
+ /* extra symbols */
+ if (pKbd->type == KB_SUN4) {
+ switch (pKbd->layout) {
+ case 0: case 1: case 33: case 34: case 80: case 81:
+ break;
+ case 3:
+ (void) strcat (names->symbols, "+ca"); break;
+ case 4: case 36: case 83:
+ (void) strcat (names->symbols, "+dk"); break;
+ case 5: case 37: case 84:
+ (void) strcat (names->symbols, "+de"); break;
+ case 6: case 38: case 85:
+ (void) strcat (names->symbols, "+it"); break;
+ case 8: case 40: case 87:
+ (void) strcat (names->symbols, "+no"); break;
+ case 9: case 41: case 88:
+ (void) strcat (names->symbols, "+pt"); break;
+ case 10: case 42: case 89:
+ (void) strcat (names->symbols, "+es"); break;
+ case 11: case 43: case 90:
+ (void) strcat (names->symbols, "+se"); break;
+ case 12: case 44: case 91:
+ (void) strcat (names->symbols, "+fr_CH"); break;
+ case 13: case 45: case 92:
+ (void) strcat (names->symbols, "+de_CH"); break;
+ case 14: case 46: case 93:
+ (void) strcat (names->symbols, "+gb"); break; /* s/b en_UK */
+ case 52:
+ (void) strcat (names->symbols, "+pl"); break;
+ case 53:
+ (void) strcat (names->symbols, "+cs"); break;
+ case 54:
+ (void) strcat (names->symbols, "+ru"); break;
+#if 0
+ /* don't have symbols defined for these yet, let them default */
+ case 2:
+ (void) strcat (names->symbols, "+fr_BE"); break;
+ case 7: case 39: case 86:
+ (void) strcat (names->symbols, "+nl"); break;
+ case 50: case 97:
+ (void) strcat (names->symbols, "+fr_CA"); break;
+ case 16: case 47: case 94:
+ (void) strcat (names->symbols, "+ko"); break;
+ case 17: case 48: case 95:
+ (void) strcat (names->symbols, "+tw"); break;
+ case 32: case 49: case 96:
+ (void) strcat (names->symbols, "+jp"); break;
+ case 51:
+ (void) strcat (names->symbols, "+hu"); break;
+#endif
+ /*
+ * by setting the symbols to NULL XKB will use the symbols in
+ * the "default" keymap.
+ */
+ default:
+ names->symbols = NULL; return; break;
+ }
+ }
+}
+#endif /* XKB */
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdProc --
+ * Handle the initialization, etc. of a keyboard.
+ *
+ * Results:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+int sunKbdProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunKbdProc (device, what)
+ DeviceIntPtr device; /* Keyboard to manipulate */
+ int what; /* What to do to it */
+#endif
+{
+ static int once;
+ static struct termio kbdtty;
+ struct termio tty;
+ int i;
+ DevicePtr pKeyboard = (DevicePtr) device;
+ sunKbdPrivPtr pPriv;
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
+
+ static CARD8 *workingModMap = NULL;
+ static KeySymsRec *workingKeySyms;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pKeyboard != LookupKeyboardDevice()) {
+ ErrorF ("Cannot open non-system keyboard\n");
+ return (!Success);
+ }
+
+ if (!workingKeySyms) {
+ workingKeySyms = &sunKeySyms[sunKbdPriv.type];
+
+ if (sunKbdPriv.type == KB_SUN4 && sunSwapLkeys)
+ SwapLKeys(workingKeySyms);
+
+ if (workingKeySyms->minKeyCode < MIN_KEYCODE) {
+ workingKeySyms->minKeyCode += MIN_KEYCODE;
+ workingKeySyms->maxKeyCode += MIN_KEYCODE;
+ }
+ if (workingKeySyms->maxKeyCode > MAX_KEYCODE)
+ workingKeySyms->maxKeyCode = MAX_KEYCODE;
+ }
+
+ if (!workingModMap) {
+ workingModMap=(CARD8 *)xalloc(MAP_LENGTH);
+ (void) memset(workingModMap, 0, MAP_LENGTH);
+ for(i=0; sunModMaps[sunKbdPriv.type][i].key != 0; i++)
+ workingModMap[sunModMaps[sunKbdPriv.type][i].key + MIN_KEYCODE] =
+ sunModMaps[sunKbdPriv.type][i].modifiers;
+ }
+
+ (void) memset ((void *) defaultKeyboardControl.autoRepeats,
+ ~0, sizeof defaultKeyboardControl.autoRepeats);
+
+#ifdef XKB
+ if (noXkbExtension) {
+ sunAutoRepeatInitiate = XkbDfltRepeatDelay * 1000;
+ sunAutoRepeatDelay = XkbDfltRepeatInterval * 1000;
+#endif
+ autoRepeatKeyDown = 0;
+#ifdef XKB
+ }
+#endif
+ pKeyboard->devicePrivate = (pointer)&sunKbdPriv;
+ pKeyboard->on = FALSE;
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ InitKeyboardDeviceStruct(pKeyboard,
+ workingKeySyms, workingModMap,
+ sunBell, sunKbdCtrl);
+#ifdef XKB
+ } else {
+ XkbComponentNamesRec names;
+ sunInitKbdNames (&names, &sunKbdPriv);
+ XkbInitKeyboardDeviceStruct((DeviceIntPtr) pKeyboard, &names,
+ workingKeySyms, workingModMap,
+ sunBell, sunKbdCtrl);
+ }
+#endif
+ break;
+
+ case DEVICE_ON:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ /*
+ * Set the keyboard into "direct" mode and turn on
+ * event translation.
+ */
+ if (sunChangeKbdTranslation(pPriv->fd, TRUE) == -1)
+ FatalError("Can't set keyboard translation\n");
+ /*
+ * for LynxOS, save current termio setting and
+ * set the keyboard into raw mode
+ */
+ if (!once)
+ {
+ ioctl(pPriv->fd, TCGETA, &kbdtty);
+ once = 1;
+ }
+ tty = kbdtty;
+ tty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ tty.c_oflag = 0;
+ tty.c_cflag = CREAD | CS8;
+ tty.c_lflag = 0;
+ tty.c_cc[VTIME] = 0;
+ tty.c_cc[VMIN] = 0;
+ if (ioctl(pPriv->fd, TCSETAW, &tty) < 0)
+ perror("ioctl TCSETAW");
+ (void) AddEnabledDevice(pPriv->fd);
+ pKeyboard->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate;
+ if (pPriv->type == KB_SUN4) {
+ /* dumb bug in Sun's keyboard! Turn off LEDS before resetting */
+ pPriv->leds = 0;
+ ctrl->leds = 0;
+ SetLights(ctrl, pPriv->fd);
+ }
+ /*
+ * Restore original keyboard directness and translation.
+ */
+ if (sunChangeKbdTranslation(pPriv->fd,FALSE) == -1)
+ FatalError("Can't reset keyboard translation\n");
+ /* restore saved termio setting */
+ if (ioctl(pPriv->fd, TCSETAW, &kbdtty) < 0)
+ perror("ioctl TCSETAW");
+ pKeyboard->on = FALSE;
+ RemoveEnabledDevice(pPriv->fd);
+ break;
+ default:
+ FatalError("Unknown keyboard operation\n");
+ }
+ return Success;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdGetEvents --
+ * Return the events waiting in the wings for the given keyboard.
+ *
+ * Results:
+ * A pointer to an array of Firm_events or (Firm_event *)0 if no events
+ * The number of events contained in the array.
+ * A boolean as to whether more events might be available.
+ *
+ * Side Effects:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+Firm_event* sunKbdGetEvents (
+ int fd,
+ Bool on,
+ int* pNumEvents,
+ Bool* pAgain)
+#else
+Firm_event* sunKbdGetEvents (fd, on, pNumEvents, pAgain)
+ int fd;
+ Bool on;
+ int* pNumEvents;
+ Bool* pAgain;
+#endif
+{
+ int nBytes; /* number of bytes of events available. */
+ static Firm_event evBuf[MAXEVENTS]; /* Buffer for Firm_events */
+
+ char buf[64];
+
+ if ((nBytes = read(fd, buf, sizeof(buf))) == -1) {
+ if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
+ {
+ *pNumEvents = 0;
+ if (errno == EINTR)
+ *pAgain = TRUE;
+ else
+ *pAgain = FALSE;
+ } else {
+ Error ("Reading keyboard");
+ FatalError ("Could not read the keyboard");
+ }
+ } else {
+ int i;
+ struct timeval now;
+
+ if (on) {
+ X_GETTIMEOFDAY(&now);
+ *pNumEvents = nBytes;
+ *pAgain = (nBytes == sizeof(buf)); /* very unlikely... */
+ for (i = 0; i < nBytes; i++)
+ {
+ evBuf[i].id = buf[i] & 0x7f;
+ evBuf[i].value = (buf[i] & 0x80) ? VKEY_UP : VKEY_DOWN;
+ evBuf[i].time = now;
+ }
+ } else {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ }
+ }
+ return evBuf;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunKbdEnqueueEvent --
+ *
+ *-----------------------------------------------------------------------
+ */
+static xEvent autoRepeatEvent;
+static int composeCount;
+
+static Bool DoSpecialKeys(device, xE, fe)
+ DeviceIntPtr device;
+ xEvent* xE;
+ Firm_event* fe;
+{
+ int shift_index, map_index, bit;
+ KeySym ksym;
+ BYTE* kptr;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr)device->public.devicePrivate;
+ BYTE keycode = xE->u.u.detail;
+ CARD8 keyModifiers = device->key->modifierMap[keycode];
+
+ /* look up the present idea of the keysym */
+ shift_index = 0;
+ if (device->key->state & ShiftMask)
+ shift_index ^= 1;
+ if (device->key->state & LockMask)
+ shift_index ^= 1;
+ map_index = (fe->id - 1) * device->key->curKeySyms.mapWidth;
+ ksym = device->key->curKeySyms.map[shift_index + map_index];
+ if (ksym == NoSymbol)
+ ksym = device->key->curKeySyms.map[map_index];
+
+ /*
+ * Toggle functionality is hardcoded. This is achieved by always
+ * discarding KeyReleases on these keys, and converting every other
+ * KeyPress into a KeyRelease.
+ */
+ if (xE->u.u.type == KeyRelease
+ && (ksym == XK_Num_Lock
+ || ksym == XK_Scroll_Lock
+ || ksym == SunXK_Compose
+ || (keyModifiers & LockMask)))
+ return TRUE;
+
+ kptr = &device->key->down[keycode >> 3];
+ bit = 1 << (keycode & 7);
+ if ((*kptr & bit) &&
+ (ksym == XK_Num_Lock || ksym == XK_Scroll_Lock ||
+ ksym == SunXK_Compose || (keyModifiers & LockMask)))
+ xE->u.u.type = KeyRelease;
+
+ if (pPriv->type == KB_SUN4) {
+ if (ksym == XK_Num_Lock) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_NUM_LOCK);
+ } else if (ksym == XK_Scroll_Lock) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_SCROLL_LOCK);
+ } else if (ksym == SunXK_Compose) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_COMPOSE);
+ if (xE->u.u.type == KeyPress) composeCount = 2;
+ else composeCount = 0;
+ } else if (keyModifiers & LockMask) {
+ ModLight (device, xE->u.u.type == KeyPress, XLED_CAPS_LOCK);
+ }
+ if (xE->u.u.type == KeyRelease) {
+ if (composeCount > 0 && --composeCount == 0) {
+ pseudoKey(device, FALSE,
+ LookupKeyCode(SunXK_Compose, &device->key->curKeySyms));
+ ModLight (device, FALSE, XLED_COMPOSE);
+ }
+ }
+ }
+
+ if ((xE->u.u.type == KeyPress) && (keyModifiers == 0)) {
+ /* initialize new AutoRepeater event & mark AutoRepeater on */
+ autoRepeatEvent = *xE;
+ autoRepeatFirst = TRUE;
+ autoRepeatKeyDown++;
+ autoRepeatLastKeyDownTv = fe->time;
+ }
+ return FALSE;
+}
+
+#if NeedFunctionPrototypes
+void sunKbdEnqueueEvent (
+ DeviceIntPtr device,
+ Firm_event *fe)
+#else
+void sunKbdEnqueueEvent (device, fe)
+ DeviceIntPtr device;
+ Firm_event *fe;
+#endif
+{
+ xEvent xE;
+ BYTE keycode;
+ CARD8 keyModifiers;
+
+ keycode = (fe->id & 0x7f) + MIN_KEYCODE;
+
+ keyModifiers = device->key->modifierMap[keycode];
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if (autoRepeatKeyDown && (keyModifiers == 0) &&
+ ((fe->value == VKEY_DOWN) || (keycode == autoRepeatEvent.u.u.detail))) {
+ /*
+ * Kill AutoRepeater on any real non-modifier key down, or auto key up
+ */
+ autoRepeatKeyDown = 0;
+ }
+#ifdef XKB
+ }
+#endif
+ xE.u.keyButtonPointer.time = TVTOMILLI(fe->time);
+ xE.u.u.type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress);
+ xE.u.u.detail = keycode;
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if (DoSpecialKeys(device, &xE, fe))
+ return;
+#ifdef XKB
+ }
+#endif /* ! XKB */
+ mieqEnqueue (&xE);
+}
+
+void sunEnqueueAutoRepeat ()
+{
+ int delta;
+ int i, mask;
+ DeviceIntPtr device = (DeviceIntPtr)LookupKeyboardDevice();
+ KeybdCtrl* ctrl = &device->kbdfeed->ctrl;
+ sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+ i=(autoRepeatEvent.u.u.detail >> 3);
+ mask=(1 << (autoRepeatEvent.u.u.detail & 7));
+ if (!(ctrl->autoRepeats[i] & mask)) {
+ autoRepeatKeyDown = 0;
+ return;
+ }
+
+ /*
+ * Generate auto repeat event. XXX one for now.
+ * Update time & pointer location of saved KeyPress event.
+ */
+
+ delta = TVTOMILLI(autoRepeatDeltaTv);
+ autoRepeatFirst = FALSE;
+
+ /*
+ * Fake a key up event and a key down event
+ * for the last key pressed.
+ */
+ autoRepeatEvent.u.keyButtonPointer.time += delta;
+ autoRepeatEvent.u.u.type = KeyRelease;
+
+ /*
+ * hold off any more inputs while we get these safely queued up
+ * further SIGIO are
+ */
+ sunEnqueueEvent (&autoRepeatEvent);
+ autoRepeatEvent.u.u.type = KeyPress;
+ sunEnqueueEvent (&autoRepeatEvent);
+ if (ctrl->click) bell (pPriv->fd, 0);
+
+ /* Update time of last key down */
+ tvplus(autoRepeatLastKeyDownTv, autoRepeatLastKeyDownTv,
+ autoRepeatDeltaTv);
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunChangeKbdTranslation
+ * Makes operating system calls to set keyboard translation
+ * and direction on or off.
+ *
+ * Results:
+ * -1 if failure, else 0.
+ *
+ * Side Effects:
+ * Changes kernel management of keyboard.
+ *
+ *-----------------------------------------------------------------------
+ */
+#if NeedFunctionPrototypes
+int sunChangeKbdTranslation(
+ int fd,
+ Bool makeTranslated)
+
+#else
+int sunChangeKbdTranslation(fd, makeTranslated)
+ int fd;
+ Bool makeTranslated;
+#endif
+{
+ int tmp;
+ sigset_t hold_mask, old_mask;
+ int toread;
+ char junk[8192];
+
+ (void) sigfillset(&hold_mask);
+ (void) sigprocmask(SIG_BLOCK, &hold_mask, &old_mask);
+ if (makeTranslated) {
+ if (ioctl (fd, TIO_ENSCANMODE, &tmp) == -1) {
+ Error ("Setting keyboard translation TIO_ENSCANMODE");
+ ErrorF ("sunChangeKbdTranslation: kbdFd=%d\n", fd);
+ return -1;
+ }
+ } else {
+ if (ioctl (fd, TIO_DISSCANMODE, &tmp) == -1) {
+ Error ("Setting keyboard translation TIO_DISSCANMODE");
+ ErrorF ("sunChangeKbdTranslation: kbdFd=%d\n", fd);
+ }
+ }
+ if (ioctl (fd, FIONREAD, &toread) != -1 && toread > 0) {
+ while (toread) {
+ tmp = toread;
+ if (toread > sizeof (junk))
+ tmp = sizeof (junk);
+ (void) read (fd, junk, tmp);
+ toread -= tmp;
+ }
+ }
+ (void) sigprocmask(SIG_SETMASK, &old_mask, (sigset_t *)NULL);
+ return 0;
+}
+
+/*ARGSUSED*/
+Bool LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void sunBlockHandler(nscreen, pbdata, pptv, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ struct timeval **pptv;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ static struct timeval artv = { 0, 0 }; /* autorepeat timeval */
+
+ if (!autoRepeatKeyDown)
+ return;
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatFirst == TRUE)
+ artv.tv_usec = sunAutoRepeatInitiate;
+ else
+ artv.tv_usec = sunAutoRepeatDelay;
+ *pptv = &artv;
+
+}
+
+/*ARGSUSED*/
+void sunWakeupHandler(nscreen, pbdata, err, pReadmask)
+ int nscreen;
+ pointer pbdata;
+ unsigned long err;
+ pointer pReadmask;
+{
+ KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl;
+ struct timeval tv;
+
+ /* this works around a weird behaviour on LynxOS 2.4.0:
+ * usually we have no problems using true SIGIO driven mouse input
+ * as it is used on the other UN*X Suns. On LynxOS we have a
+ * strange behaviour upon the very first server startup after a
+ * reboot. We won't get SIGIOs from the mouse device. The mouse
+ * will only move if we get SIGIOs from the keyboard.
+ * The solution (for now) is to use an additional WakeupHandler and
+ * poll the mouse file descriptor.
+ */
+ struct fd_set devicesWithInput;
+ struct fd_set device;
+ extern struct fd_set EnabledDevices;
+
+ XFD_ANDSET(&devicesWithInput, ((struct fd_set *) pReadmask), &EnabledDevices);
+
+ FD_ZERO(&device);
+ FD_SET(sunPtrPriv.fd, &device);
+ XFD_ANDSET(&device, &device, &devicesWithInput);
+ if (XFD_ANYSET(&device)) {
+ sigset_t newsigmask;
+
+ (void) sigemptyset (&newsigmask);
+ (void) sigaddset (&newsigmask, SIGIO);
+ (void) sigprocmask (SIG_BLOCK, &newsigmask, (sigset_t *)NULL);
+ sunEnqueueMseEvents();
+ (void) sigprocmask (SIG_UNBLOCK, &newsigmask, (sigset_t *)NULL);
+ }
+
+#ifdef XKB
+ if (!noXkbExtension)
+ return;
+#endif
+
+ if (ctrl->autoRepeat != AutoRepeatModeOn)
+ return;
+
+ if (autoRepeatKeyDown) {
+ X_GETTIMEOFDAY(&tv);
+ tvminus(autoRepeatDeltaTv, tv, autoRepeatLastKeyDownTv);
+ if (autoRepeatDeltaTv.tv_sec > 0 ||
+ (!autoRepeatFirst && autoRepeatDeltaTv.tv_usec >
+ sunAutoRepeatDelay) ||
+ (autoRepeatDeltaTv.tv_usec >
+ sunAutoRepeatInitiate))
+ autoRepeatReady++;
+ }
+
+ if (autoRepeatReady)
+ {
+ sunEnqueueAutoRepeat ();
+ autoRepeatReady = 0;
+ }
+}
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyMouse.c b/xc/programs/Xserver/hw/sunLynx/sunLyMouse.c
new file mode 100644
index 000000000..a7c29c267
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyMouse.c
@@ -0,0 +1,679 @@
+/* $TOG: sunLyMouse.c /main/2 1998/02/10 13:22:59 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyMouse.c,v 3.2 1998/10/04 09:38:48 dawes Exp $ */
+
+/*
+ * This is sunMouse.c modified for LynxOS
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*-
+ * Copyright 1987 by the Regents of the University of California
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. The University of California
+ * makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without
+ * express or implied warranty.
+ */
+
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/*
+ * Copyright 1991, 1992, 1993 Kaleb S. Keithley
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies. Kaleb S. Keithley makes no
+ * representations about the suitability of this software for
+ * any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+#define NEED_EVENTS
+#include "sun.h"
+
+Bool sunActiveZaphod = TRUE;
+
+static Bool sunCursorOffScreen();
+static void sunCrossScreen();
+static void sunWarpCursor();
+
+miPointerScreenFuncRec sunPointerScreenFuncs = {
+ sunCursorOffScreen,
+ sunCrossScreen,
+ sunWarpCursor,
+};
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseCtrl --
+ * Alter the control parameters for the mouse. Since acceleration
+ * etc. is done from the PtrCtrl record in the mouse's device record,
+ * there's nothing to do here.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+static
+#if NeedFunctionPrototypes
+void sunMouseCtrl (
+ DeviceIntPtr device,
+ PtrCtrl* ctrl)
+#else
+void sunMouseCtrl (device, ctrl)
+ DeviceIntPtr device;
+ PtrCtrl* ctrl;
+#endif
+{
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseProc --
+ * Handle the initialization, etc. of a mouse
+ *
+ * Results:
+ * none.
+ *
+ * Side Effects:
+ *
+ * Note:
+ * When using sunwindows, all input comes off a single fd, stored in the
+ * global windowFd. Therefore, only one device should be enabled and
+ * disabled, even though the application still sees both mouse and
+ * keyboard. We have arbitrarily chosen to enable and disable windowFd
+ * in the keyboard routine sunKbdProc rather than in sunMouseProc.
+ *
+ *-----------------------------------------------------------------------
+ */
+#if NeedFunctionPrototypes
+int sunMouseProc (
+ DeviceIntPtr device,
+ int what)
+#else
+int sunMouseProc (device, what)
+ DeviceIntPtr device; /* Mouse to play with */
+ int what; /* What to do with it */
+#endif
+{
+ struct termio tty;
+ DevicePtr pMouse = (DevicePtr) device;
+ int format;
+ static int oformat;
+ BYTE map[4];
+ char *dev;
+
+ switch (what) {
+ case DEVICE_INIT:
+ if (pMouse != LookupPointerDevice()) {
+ ErrorF ("Cannot open non-system mouse");
+ return !Success;
+ }
+ if (sunPtrPriv.fd == -1)
+ return !Success;
+ pMouse->devicePrivate = (pointer) &sunPtrPriv;
+ pMouse->on = FALSE;
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ InitPointerDeviceStruct(
+ pMouse, map, 3, miPointerGetMotionEvents,
+ sunMouseCtrl, miPointerGetMotionBufferSize());
+ break;
+
+ case DEVICE_ON:
+ /* set mouse to raw mode */
+ if (ioctl(sunPtrPriv.fd, TCGETA, &tty) != -1) {
+ tty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ tty.c_oflag = 0;
+ tty.c_cflag = CREAD | CS8;
+ tty.c_lflag = 0;
+ tty.c_line = 0;
+ tty.c_cc[VTIME] = 0;
+ tty.c_cc[VMIN] = 0;
+ if (ioctl(sunPtrPriv.fd, TCSETAW, &tty) < 0)
+ perror("ioctl TCSETAW");
+ } else
+ perror("ioctl TCGETA");
+ sunPtrPriv.bmask = 0;
+ AddEnabledDevice (sunPtrPriv.fd);
+ pMouse->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+ pMouse->on = FALSE;
+ break;
+
+ case DEVICE_OFF:
+ pMouse->on = FALSE;
+ RemoveEnabledDevice (sunPtrPriv.fd);
+ break;
+ }
+ return Success;
+}
+
+/* mouse protocol code from XFree86 */
+
+#define P_MS 0 /* Microsoft */
+#define P_MSC 1 /* Mouse Systems Corp */
+#define P_MM 2 /* MMseries */
+#define P_LOGI 3 /* Logitech */
+#define P_BM 4 /* BusMouse ??? */
+#define P_LOGIMAN 5 /* MouseMan / TrackMan
+ [CHRIS-211092] */
+#define P_PS2 6 /* PS/2 mouse */
+#define P_MMHIT 7 /* MM_HitTab */
+
+static int
+xf86MouseProtocol(rBuf, nBytes, evBuf)
+ unsigned char *rBuf;
+ int nBytes;
+ Firm_event evBuf[];
+{
+ int i, buttons, dx, dy;
+ static int pBufP = 0;
+ static unsigned char pBuf[8];
+ static int lastButtons;
+ int change;
+ int numEvents = 0;
+
+ const int mseType = P_MSC;
+ const int chordMiddle = 0;
+
+ static unsigned char proto[8][5] = {
+ /* hd_mask hd_id dp_mask dp_id nobytes */
+ { 0x40, 0x40, 0x40, 0x00, 3 }, /* MicroSoft */
+ { 0xf8, 0x80, 0x00, 0x00, 5 }, /* MouseSystems */
+ { 0xe0, 0x80, 0x80, 0x00, 3 }, /* MMSeries */
+ { 0xe0, 0x80, 0x80, 0x00, 3 }, /* Logitech */
+ { 0xf8, 0x80, 0x00, 0x00, 5 }, /* BusMouse */
+ { 0x40, 0x40, 0x40, 0x00, 3 }, /* MouseMan
+ [CHRIS-211092] */
+ { 0xc0, 0x00, 0x00, 0x00, 3 }, /* PS/2 mouse */
+ { 0xe0, 0x80, 0x80, 0x00, 3 }, /* MM_HitTablet */
+ };
+
+ for ( i=0; i < nBytes; i++) {
+ /*
+ * Hack for resyncing: We check here for a package that is:
+ * a) illegal (detected by wrong data-package header)
+ * b) invalid (0x80 == -128 and that might be wrong for MouseSystems)
+ * c) bad header-package
+ *
+ * NOTE: b) is a voilation of the MouseSystems-Protocol, since values of
+ * -128 are allowed, but since they are very seldom we can easily
+ * use them as package-header with no button pressed.
+ * NOTE/2: On a PS/2 mouse any byte is valid as a data byte. Furthermore,
+ * 0x80 is not valid as a header byte. For a PS/2 mouse we skip
+ * checking data bytes.
+ * For resyncing a PS/2 mouse we require the two most significant
+ * bits in the header byte to be 0. These are the overflow bits,
+ * and in case of an overflow we actually lose sync. Overflows
+ * are very rare, however, and we quickly gain sync again after
+ * an overflow condition. This is the best we can do. (Actually,
+ * we could use bit 0x08 in the header byte for resyncing, since
+ * that bit is supposed to be always on, but nobody told
+ * Microsoft...)
+ */
+ if (pBufP != 0 && mseType != P_PS2 &&
+ ((rBuf[i] & proto[mseType][2]) != proto[mseType][3]
+ || rBuf[i] == 0x80))
+ {
+ pBufP = 0; /* skip package */
+ }
+
+ if (pBufP == 0 &&
+ (rBuf[i] & proto[mseType][0]) != proto[mseType][1])
+ {
+ /*
+ * Hack for Logitech MouseMan Mouse - Middle button
+ *
+ * Unfortunately this mouse has variable length packets: the standard
+ * Microsoft 3 byte packet plus an optional 4th byte whenever the
+ * middle button status changes.
+ *
+ * We have already processed the standard packet with the movement
+ * and button info. Now post an event message with the old status
+ * of the left and right buttons and the updated middle button.
+ */
+
+ /*
+ * Even worse, different MouseMen and TrackMen differ in the 4th
+ * byte: some will send 0x00/0x20, others 0x01/0x21, or even
+ * 0x02/0x22, so I have to strip off the lower bits. [CHRIS-211092]
+ */
+ if ((mseType == P_MS || mseType == P_LOGIMAN)
+ && (char)(rBuf[i] & ~0x23) == 0)
+ {
+ buttons = ((int)(rBuf[i] & 0x20) >> 4)
+ | (lastButtons & 0x05);
+
+ change = buttons ^ lastButtons;
+ /* a little naive, but sufficient for now */
+ if (change & 4)
+ {
+ evBuf[numEvents].id = MS_LEFT;
+ evBuf[numEvents].value = (buttons & 4) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ if (change & 2)
+ {
+ evBuf[numEvents].id = MS_MIDDLE;
+ evBuf[numEvents].value = (buttons & 2) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ if (change & 1)
+ {
+ evBuf[numEvents].id = MS_RIGHT;
+ evBuf[numEvents].value = (buttons & 1) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ lastButtons = buttons;
+ }
+
+ continue; /* skip package */
+ }
+
+
+ pBuf[pBufP++] = rBuf[i];
+ if (pBufP != proto[mseType][4]) continue;
+
+
+ /*
+ * assembly full package
+ */
+ switch(mseType) {
+
+ case P_LOGIMAN: /* MouseMan / TrackMan [CHRIS-211092] */
+ case P_MS: /* Microsoft */
+ if (chordMiddle)
+ buttons = (((int) pBuf[0] & 0x30) == 0x30) ? 2 :
+ ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4);
+ else {
+ buttons = (lastButtons & 2)
+ | ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4);
+ }
+ dx = (char)((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F);
+ dy = (char)((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F);
+ break;
+
+ case P_MSC: /* Mouse Systems Corp */
+ buttons = (~pBuf[0]) & 0x07;
+ dx = (char)(pBuf[1]) + (char)(pBuf[3]);
+ dy = - ((char)(pBuf[2]) + (char)(pBuf[4]));
+ break;
+
+
+ case P_MMHIT: /* MM_HitTablet */
+ buttons = pBuf[0] & 0x07;
+ if (buttons != 0)
+ buttons = 1 << (buttons - 1);
+ dx = (pBuf[0] & 0x10) ? pBuf[1] : - pBuf[1];
+ dy = (pBuf[0] & 0x08) ? - pBuf[2] : pBuf[2];
+ break;
+
+ case P_MM: /* MM Series */
+ case P_LOGI: /* Logitech Mice */
+ buttons = pBuf[0] & 0x07;
+ dx = (pBuf[0] & 0x10) ? pBuf[1] : - pBuf[1];
+ dy = (pBuf[0] & 0x08) ? - pBuf[2] : pBuf[2];
+ break;
+
+ case P_BM: /* BusMouse */
+ buttons = (~pBuf[0]) & 0x07;
+ dx = pBuf[1];
+ dy = - pBuf[2];
+ break;
+
+ case P_PS2: /* PS/2 mouse */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2; /* Left */
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ break;
+ }
+
+ /* a little naive, but sufficient for now */
+ change = buttons ^ lastButtons;
+ if (change & 4)
+ {
+ evBuf[numEvents].id = MS_LEFT;
+ evBuf[numEvents].value = (buttons & 4) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ if (change & 2)
+ {
+ evBuf[numEvents].id = MS_MIDDLE;
+ evBuf[numEvents].value = (buttons & 2) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ if (change & 1)
+ {
+ evBuf[numEvents].id = MS_RIGHT;
+ evBuf[numEvents].value = (buttons & 1) ? VKEY_DOWN : VKEY_UP;
+ ++numEvents;
+ }
+ lastButtons = buttons;
+
+ if (dx)
+ {
+ evBuf[numEvents].id = LOC_X_DELTA;
+ evBuf[numEvents].value = dx;
+ ++numEvents;
+ }
+ if (dy)
+ {
+ evBuf[numEvents].id = LOC_Y_DELTA;
+ evBuf[numEvents].value = -dy;
+ ++numEvents;
+ }
+ pBufP = 0;
+ }
+ return numEvents;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseGetEvents --
+ * Return the events waiting in the wings for the given mouse.
+ *
+ * Results:
+ * A pointer to an array of Firm_events or (Firm_event *)0 if no events
+ * The number of events contained in the array.
+ * A boolean as to whether more events might be available.
+ *
+ * Side Effects:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+Firm_event* sunMouseGetEvents (
+ int fd,
+ Bool on,
+ int* pNumEvents,
+ Bool* pAgain)
+#else
+Firm_event* sunMouseGetEvents (fd, on, pNumEvents, pAgain)
+ int fd;
+ Bool on;
+ int* pNumEvents;
+ Bool* pAgain;
+#endif
+{
+ static Firm_event evBuf[MAXEVENTS]; /* Buffer for Firm_events */
+ int nBytes; /* number of bytes available. */
+ char buf[8];
+
+ if ((nBytes = read(fd, buf, sizeof(buf))) == -1) {
+ if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) {
+ *pNumEvents = 0;
+ if (errno == EINTR)
+ *pAgain = TRUE;
+ else
+ *pAgain = FALSE;
+ } else {
+ Error ("sunMouseGetEvents read");
+ FatalError ("Could not read from mouse");
+ }
+ } else {
+ if (on) {
+ *pAgain = (nBytes == sizeof(buf)); /* very unlikely... */
+ if (*pNumEvents = xf86MouseProtocol(buf, nBytes, evBuf))
+ {
+ struct timeval now;
+ int i;
+
+ X_GETTIMEOFDAY(&now);
+ for (i=0;i<*pNumEvents;i++)
+ evBuf[i].time = now;
+ }
+ } else {
+ *pNumEvents = 0;
+ *pAgain = FALSE;
+ }
+ }
+ return evBuf;
+}
+
+
+/*-
+ *-----------------------------------------------------------------------
+ * MouseAccelerate --
+ * Given a delta and a mouse, return the acceleration of the delta.
+ *
+ * Results:
+ * The corrected delta
+ *
+ * Side Effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------
+ */
+static short
+MouseAccelerate (device, delta)
+ DeviceIntPtr device;
+ int delta;
+{
+ int sgn = sign(delta);
+ PtrCtrl *pCtrl;
+ short ret;
+
+ delta = abs(delta);
+ pCtrl = &device->ptrfeed->ctrl;
+ if (delta > pCtrl->threshold) {
+ ret =
+ (short) sgn *
+ (pCtrl->threshold + ((delta - pCtrl->threshold) * pCtrl->num) /
+ pCtrl->den);
+ } else {
+ ret = (short) sgn * delta;
+ }
+ return ret;
+}
+
+/*-
+ *-----------------------------------------------------------------------
+ * sunMouseEnqueueEvent --
+ * Given a Firm_event for a mouse, pass it off the the dix layer
+ * properly converted...
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * The cursor may be redrawn...? devPrivate/x/y will be altered.
+ *
+ *-----------------------------------------------------------------------
+ */
+
+#if NeedFunctionPrototypes
+void sunMouseEnqueueEvent (
+ DeviceIntPtr device,
+ Firm_event *fe)
+#else
+void sunMouseEnqueueEvent (device, fe)
+ DeviceIntPtr device; /* Mouse from which the event came */
+ Firm_event *fe; /* Event to process */
+#endif
+{
+ xEvent xE;
+ sunPtrPrivPtr pPriv; /* Private data for pointer */
+ int bmask; /* Temporary button mask */
+ unsigned long time;
+ int x, y;
+
+ pPriv = (sunPtrPrivPtr)device->public.devicePrivate;
+
+ time = xE.u.keyButtonPointer.time = TVTOMILLI(fe->time);
+
+ switch (fe->id) {
+ case MS_LEFT:
+ case MS_MIDDLE:
+ case MS_RIGHT:
+ /*
+ * A button changed state. Sometimes we will get two events
+ * for a single state change. Should we get a button event which
+ * reflects the current state of affairs, that event is discarded.
+ *
+ * Mouse buttons start at 1.
+ */
+ xE.u.u.detail = (fe->id - MS_LEFT) + 1;
+ bmask = 1 << xE.u.u.detail;
+ if (fe->value == VKEY_UP) {
+ if (pPriv->bmask & bmask) {
+ xE.u.u.type = ButtonRelease;
+ pPriv->bmask &= ~bmask;
+ } else {
+ return;
+ }
+ } else {
+ if ((pPriv->bmask & bmask) == 0) {
+ xE.u.u.type = ButtonPress;
+ pPriv->bmask |= bmask;
+ } else {
+ return;
+ }
+ }
+ mieqEnqueue (&xE);
+ break;
+ case LOC_X_DELTA:
+ miPointerDeltaCursor (MouseAccelerate(device,fe->value),0,time);
+ break;
+ case LOC_Y_DELTA:
+ /*
+ * For some reason, motion up generates a positive y delta
+ * and motion down a negative delta, so we must subtract
+ * here instead of add...
+ */
+ miPointerDeltaCursor (0,-MouseAccelerate(device,fe->value),time);
+ break;
+ case LOC_X_ABSOLUTE:
+ miPointerPosition (&x, &y);
+ miPointerAbsoluteCursor (fe->value, y, time);
+ break;
+ case LOC_Y_ABSOLUTE:
+ miPointerPosition (&x, &y);
+ miPointerAbsoluteCursor (x, fe->value, time);
+ break;
+ default:
+ FatalError ("sunMouseEnqueueEvent: unrecognized id\n");
+ break;
+ }
+}
+
+/*ARGSUSED*/
+static Bool
+sunCursorOffScreen (pScreen, x, y)
+ ScreenPtr *pScreen;
+ int *x, *y;
+{
+ int index, ret = FALSE;
+ extern Bool PointerConfinedToScreen();
+
+ if (PointerConfinedToScreen()) return TRUE;
+ /*
+ * Active Zaphod implementation:
+ * increment or decrement the current screen
+ * if the x is to the right or the left of
+ * the current screen.
+ */
+ if (sunActiveZaphod &&
+ screenInfo.numScreens > 1 && (*x >= (*pScreen)->width || *x < 0)) {
+ index = (*pScreen)->myNum;
+ if (*x < 0) {
+ index = (index ? index : screenInfo.numScreens) - 1;
+ *pScreen = screenInfo.screens[index];
+ *x += (*pScreen)->width;
+ } else {
+ *x -= (*pScreen)->width;
+ index = (index + 1) % screenInfo.numScreens;
+ *pScreen = screenInfo.screens[index];
+ }
+ ret = TRUE;
+ }
+ return ret;
+}
+
+static void
+sunCrossScreen (pScreen, entering)
+ ScreenPtr pScreen;
+ Bool entering;
+{
+ if (sunFbs[pScreen->myNum].EnterLeave)
+ (*sunFbs[pScreen->myNum].EnterLeave) (pScreen, entering ? 0 : 1);
+}
+
+static void
+sunWarpCursor (pScreen, x, y)
+ ScreenPtr pScreen;
+ int x, y;
+{
+ sigset_t newsigmask;
+
+ (void) sigemptyset (&newsigmask);
+ (void) sigaddset (&newsigmask, SIGIO);
+ (void) sigprocmask (SIG_BLOCK, &newsigmask, (sigset_t *)NULL);
+ miPointerWarpCursor (pScreen, x, y);
+ (void) sigprocmask (SIG_UNBLOCK, &newsigmask, (sigset_t *)NULL);
+}
diff --git a/xc/programs/Xserver/hw/sunLynx/sunLyUtil.c b/xc/programs/Xserver/hw/sunLynx/sunLyUtil.c
new file mode 100644
index 000000000..41404e297
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/sunLyUtil.c
@@ -0,0 +1,513 @@
+/* $XConsortium: sunLyUtil.c /main/1 1996/10/31 14:21:00 kaleb $ */
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/sunLyUtil.c,v 3.1 1996/12/27 06:51:42 dawes Exp $ */
+
+/*
+ * CG3 and CG6 utility functions for LynxOS, derived from NetBSD
+ * Copyright 1996 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/* $NetBSD: bt_subr.c,v 1.4 1994/11/20 20:51:54 deraadt Exp $ */
+
+/*
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)bt_subr.c 8.2 (Berkeley) 1/21/94
+ */
+
+/* adaption for LynxOS microSPARC 2.4.0 and X11R6[.1]
+ * Copyright 1996 by Thomas Mueller <tm@systrix.de>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "sun.h"
+#include "btreg.h"
+#include "btvar.h"
+#include "cgsixreg.h"
+#define useracc(a,b,c) (1)
+
+/*
+ * Common code for dealing with Brooktree video DACs.
+ * (Contains some software-only code as well, since the colormap
+ * ioctls are shared between the cgthree and cgsix drivers.)
+ */
+
+/*
+ * Implement an FBIOGETCMAP-like ioctl.
+ */
+int
+bt_getcmap(struct fbcmap *p, union bt_cmap *cm, int cmsize)
+{
+ u_int i;
+ u_int start;
+ u_int count;
+ u_char *cp;
+
+ start = p->index;
+ count = p->count;
+ if (start >= cmsize || start + count > cmsize)
+ return (EINVAL);
+ if (!useracc(p->red, count, B_WRITE) ||
+ !useracc(p->green, count, B_WRITE) ||
+ !useracc(p->blue, count, B_WRITE))
+ return (EFAULT);
+ for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 3, i++) {
+ p->red[i] = cp[0];
+ p->green[i] = cp[1];
+ p->blue[i] = cp[2];
+ }
+ return (0);
+}
+
+/*
+ * Implement the software portion of an FBIOPUTCMAP-like ioctl.
+ */
+int
+bt_putcmap(struct fbcmap *p, union bt_cmap *cm, int cmsize)
+{
+ u_int i;
+ int start;
+ int count;
+ u_char *cp;
+
+ start = p->index;
+ count = p->count;
+ if (start >= cmsize || start + count > cmsize)
+ return (EINVAL);
+ if (!useracc(p->red, count, B_READ) ||
+ !useracc(p->green, count, B_READ) ||
+ !useracc(p->blue, count, B_READ))
+ return (EFAULT);
+ for (cp = &cm->cm_map[start][0], i = 0; i < count; cp += 3, i++) {
+ cp[0] = p->red[i];
+ cp[1] = p->green[i];
+ cp[2] = p->blue[i];
+ }
+ return (0);
+}
+
+union cursor_cmap { /* colormap, like bt_cmap, but tiny */
+ u_char cm_map[2][3]; /* 2 R/G/B entries */
+ u_int cm_chip[2]; /* 2 chip equivalents */
+};
+
+struct cg6_cursor { /* cg6 hardware cursor status */
+ short cc_enable; /* cursor is enabled */
+ struct fbcurpos cc_pos; /* position */
+ struct fbcurpos cc_hot; /* hot-spot */
+ struct fbcurpos cc_size; /* size of mask & image fields */
+ u_int cc_bits[2][32]; /* space for mask & image bits */
+ union cursor_cmap cc_color; /* cursor colormap */
+};
+
+static union bt_cmap sc_cmap; /* local copy of LUT */
+static int blanked = 1; /* to jump-start it ... */
+static struct cg6_cursor sc_cursor; /* cursor info */
+
+/*
+ * Clean up hardware state (e.g., after bootup or after X crashes).
+ */
+static void
+cg6_reset(fbFd * fb)
+{
+ volatile struct cg6_tec_xxx *tec;
+ int fhc;
+ short fhcrev;
+ volatile struct bt_regs *bt;
+
+ /* hide the cursor, just in case */
+ ((volatile struct cg6_thc *) (fb->thc))->thc_cursxy =
+ (THC_CURSOFF << 16) | THC_CURSOFF;
+
+ /* turn off frobs in transform engine (makes X11 work) */
+ tec = fb->tec;
+ tec->tec_mv = 0;
+ tec->tec_clip = 0;
+ tec->tec_vdc = 0;
+
+ /* take care of hardware bugs in old revisions */
+ fhcrev = (*(int *) fb->fhc >> FHC_REV_SHIFT) &
+ (FHC_REV_MASK >> FHC_REV_SHIFT);
+ if (fhcrev < 5) {
+ /*
+ * Keep current resolution; set cpu to 68020, set test
+ * window (size 1Kx1K), and for rev 1, disable dest cache.
+ */
+ fhc = (*(int *) fb->fhc & FHC_RES_MASK) | FHC_CPU_68020 |
+ FHC_TEST |
+ (11 << FHC_TESTX_SHIFT) | (11 << FHC_TESTY_SHIFT);
+ if (fhcrev < 2)
+ fhc |= FHC_DST_DISABLE;
+ *(int *) fb->fhc = fhc;
+ }
+ /* Enable cursor in Brooktree DAC. */
+ bt = fb->ramdac;
+ bt->bt_addr = 0x06 << 24;
+ bt->bt_ctrl |= 0x03 << 24;
+}
+
+static void
+cg6_loadcursor(fbFd * fb)
+{
+ volatile struct cg6_thc *thc;
+ u_int edgemask;
+ u_int m;
+ int i;
+
+ /*
+ * Keep the top size.x bits. Here we *throw out* the top
+ * size.x bits from an all-one-bits word, introducing zeros in
+ * the top size.x bits, then invert all the bits to get what
+ * we really wanted as our mask. But this fails if size.x is
+ * 32---a sparc uses only the low 5 bits of the shift count---
+ * so we have to special case that.
+ */
+ edgemask = ~0;
+ if (sc_cursor.cc_size.x < 32)
+ edgemask = ~(edgemask >> sc_cursor.cc_size.x);
+ thc = (volatile struct cg6_thc *) fb->thc;
+ for (i = 0; i < 32; i++) {
+ m = sc_cursor.cc_bits[0][i] & edgemask;
+ thc->thc_cursmask[i] = m;
+ thc->thc_cursbits[i] = m & sc_cursor.cc_bits[1][i];
+ }
+}
+
+static void
+cg6_setcursor(fbFd * fb)
+{
+ /* we need to subtract the hot-spot value here */
+#define COORD(f) (sc_cursor.cc_pos.f - sc_cursor.cc_hot.f)
+ ((volatile struct cg6_thc *) (fb->thc))->thc_cursxy = sc_cursor.cc_enable ?
+ ((COORD(x) << 16) | (COORD(y) & 0xffff)) :
+ (THC_CURSOFF << 16) | THC_CURSOFF;
+#undef COORD
+}
+
+/*
+ * Load the cursor (overlay `foreground' and `background') colors.
+ */
+static void
+cg6_loadomap(fbFd * fb)
+{
+ volatile struct bt_regs *bt;
+ u_int i;
+
+ bt = (volatile struct bt_regs *) fb->ramdac;
+ bt->bt_addr = 0x01 << 24; /* set background color */
+ i = sc_cursor.cc_color.cm_chip[0];
+ bt->bt_omap = i; /* R */
+ bt->bt_omap = i << 8; /* G */
+ bt->bt_omap = i << 16; /* B */
+
+ bt->bt_addr = 0x03 << 24; /* set foreground color */
+ bt->bt_omap = i << 24; /* R */
+ i = sc_cursor.cc_color.cm_chip[1];
+ bt->bt_omap = i; /* G */
+ bt->bt_omap = i << 8; /* B */
+}
+
+/*
+ * Load a subset of the current (new) colormap into the color DAC.
+ */
+static void
+cg6_loadcmap(fbFd * fb, union bt_cmap *cm, int start, int ncolors)
+{
+ volatile struct bt_regs *bt;
+ u_int *ip;
+ u_int i;
+ int count;
+
+ ip = &cm->cm_chip[BT_D4M3(start)]; /* start/4 * 3 */
+ count = BT_D4M3(start + ncolors - 1) - BT_D4M3(start) + 3;
+ bt = (struct bt_regs *) fb->ramdac;
+ bt->bt_addr = BT_D4M4(start) << 24;
+ while (--count >= 0) {
+ i = *ip++;
+ /* hardware that makes one want to pound boards with hammers */
+ bt->bt_cmap = i;
+ bt->bt_cmap = i << 8;
+ bt->bt_cmap = i << 16;
+ bt->bt_cmap = i << 24;
+ }
+}
+
+/*
+ * Undo the effect of an FBIOSVIDEO that turns the video off on a CG6
+ */
+static void
+cg6_unblank(fbFd * dev)
+{
+ volatile struct cg6_thc *thc = (volatile struct cg6_thc *) dev->thc;
+ unsigned long x;
+ unsigned long y;
+
+ if (blanked) {
+ thc->thc_misc = (thc->thc_misc & ~THC_MISC_VIDEN) | THC_MISC_VIDEN;
+ }
+ blanked = 0;
+}
+
+/*
+ * Load a subset of the current (new) colormap into the Brooktree DAC.
+ */
+static void
+cg3_loadcmap(fbFd * fb, union bt_cmap *cm, int start, int ncolors)
+{
+ volatile struct bt_regs *bt;
+ u_int *ip;
+ int count;
+
+ ip = &cm->cm_chip[BT_D4M3(start)]; /* start/4 * 3 */
+ count = BT_D4M3(start + ncolors - 1) - BT_D4M3(start) + 3;
+ bt = (struct bt_regs *) fb->ramdac;
+ bt->bt_addr = BT_D4M4(start);
+ while (--count >= 0)
+ bt->bt_cmap = *ip++;
+}
+
+/*
+ * Undo the effect of an FBIOSVIDEO that turns the video off on a CG3
+ */
+static void
+cg3_unblank(fbFd * dev)
+{
+ volatile struct bt_regs *bt;
+
+ if (blanked) {
+ bt = (struct bt_regs *) dev->ramdac;
+ /* restore color 0 (and R of color 1) */
+ bt->bt_addr = 0;
+ bt->bt_cmap = sc_cmap.cm_chip[0];
+
+ /* restore read mask */
+ bt->bt_addr = 0x06; /* command reg */
+ bt->bt_ctrl = 0x73; /* overlay plane */
+ bt->bt_addr = 0x04; /* read mask */
+ bt->bt_ctrl = 0xff; /* color planes */
+ }
+ blanked = 0;
+}
+
+int
+sunIoctl(fbFd * fb, int cmd, void *arg)
+{
+ int error;
+ int v;
+ int i;
+ u_int count;
+ union cursor_cmap tcm;
+
+ switch (cmd) {
+ default:
+ errno = EINVAL;
+ return -1;
+ case FBIOPUTCMAP:
+#define q ((struct fbcmap *)arg)
+ if (error = bt_putcmap(q, &sc_cmap, 256))
+ return error;
+ if (fb->thc) { /* CG6 */
+ cg6_loadcmap(fb, &sc_cmap, q->index, q->count);
+ } else { /* CG3 */
+ cg3_loadcmap(fb, &sc_cmap, q->index, q->count);
+ }
+ break;
+ case FBIOSVIDEO:
+ if (fb->thc) { /* CG6 */
+ if (*(int *) arg)
+ cg6_unblank(fb);
+ else {
+ if (!blanked) {
+ volatile struct cg6_thc *thc =
+ (volatile struct cg6_thc *) fb->thc;
+
+ thc->thc_misc = (thc->thc_misc & ~THC_MISC_VIDEN);
+ }
+ blanked = 1;
+ }
+ } else { /* CG3 */
+ if (*(int *) arg)
+ cg3_unblank(fb);
+ else {
+ if (!blanked) {
+ volatile struct bt_regs *bt;
+
+ bt = (struct bt_regs *) fb->ramdac;
+ bt->bt_addr = 0x06; /* command reg */
+ bt->bt_ctrl = 0x70; /* overlay plane */
+ bt->bt_addr = 0x04; /* read mask */
+ bt->bt_ctrl = 0x00; /* color planes */
+
+ /*
+ * Set color 0 to black -- note that this overwrites R of
+ * color 1.
+ */
+ bt->bt_addr = 0;
+ bt->bt_cmap = 0;
+
+ }
+ blanked = 1;
+ }
+ }
+ break;
+/* these are for both FBIOSCURSOR and FBIOGCURSOR */
+#define p ((struct fbcursor *)arg)
+#define cc (&sc_cursor)
+
+ case FBIOSCURSOR:
+ if (!fb->thc) { /* reject non CG6 */
+ errno = EINVAL;
+ return -1;
+ }
+ /*
+ * For setcmap and setshape, verify parameters, so that
+ * we do not get halfway through an update and then crap
+ * out with the software state screwed up.
+ */
+ v = p->set;
+ if (v & FB_CUR_SETCMAP) {
+ /*
+ * This use of a temporary copy of the cursor
+ * colormap is not terribly efficient, but these
+ * copies are small (8 bytes)...
+ */
+ tcm = cc->cc_color;
+ error = bt_putcmap(&p->cmap, (union bt_cmap *) &tcm, 2);
+ if (error)
+ return (error);
+ }
+ if (v & FB_CUR_SETSHAPE) {
+ if ((u_int) p->size.x > 32 || (u_int) p->size.y > 32)
+ return (EINVAL);
+ count = p->size.y * 32 / NBBY;
+ if (!useracc(p->image, count, B_READ) ||
+ !useracc(p->mask, count, B_READ))
+ return (EFAULT);
+ }
+ /* parameters are OK; do it */
+ if (v & (FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT)) {
+ if (v & FB_CUR_SETCUR)
+ cc->cc_enable = p->enable;
+ if (v & FB_CUR_SETPOS)
+ cc->cc_pos = p->pos;
+ if (v & FB_CUR_SETHOT)
+ cc->cc_hot = p->hot;
+ cg6_setcursor(fb);
+ }
+ if (v & FB_CUR_SETCMAP) {
+ cc->cc_color = tcm;
+ cg6_loadomap(fb); /* XXX defer to vertical retrace */
+ }
+ if (v & FB_CUR_SETSHAPE) {
+ cc->cc_size = p->size;
+ count = p->size.y * 32 / NBBY;
+ bzero((caddr_t) cc->cc_bits, sizeof cc->cc_bits);
+ bcopy(p->mask, (caddr_t) cc->cc_bits[0], count);
+ bcopy(p->image, (caddr_t) cc->cc_bits[1], count);
+ cg6_loadcursor(fb);
+ }
+ break;
+ case FBIOSCURPOS:
+ if (!fb->thc) { /* reject non CG6 */
+ errno = EINVAL;
+ return -1;
+ }
+ sc_cursor.cc_pos = *(struct fbcurpos *) arg;
+ cg6_setcursor(fb);
+ break;
+
+ case FBIOGCURMAX:
+ if (!fb->thc) { /* reject non CG6 */
+ errno = EINVAL;
+ return -1;
+ }
+ /* max cursor size is 32x32 */
+ ((struct fbcurpos *) arg)->x = 32;
+ ((struct fbcurpos *) arg)->y = 32;
+ break;
+ case FBIORESET:
+ if (!fb->thc) { /* reject non CG6 */
+ errno = EINVAL;
+ return -1;
+ }
+ cg6_reset(fb);
+ }
+ return 0;
+}
diff --git a/xc/programs/Xserver/hw/sunLynx/vuid_event.h b/xc/programs/Xserver/hw/sunLynx/vuid_event.h
new file mode 100644
index 000000000..1b617e678
--- /dev/null
+++ b/xc/programs/Xserver/hw/sunLynx/vuid_event.h
@@ -0,0 +1,92 @@
+/* $XConsortium: vuid_event.h /main/1 1996/10/31 14:21:02 kaleb $ */
+
+
+
+/* $NetBSD: vuid_event.h,v 1.2 1994/11/20 20:53:39 deraadt Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/sunLynx/vuid_event.h,v 3.1 1996/12/27 06:51:43 dawes Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * The following is a minimal emulation of Sun's `Firm_event' structures
+ * and related operations necessary to make X11 happy (i.e., make it
+ * compile, and make old X11 binaries run).
+ */
+typedef struct firm_event {
+ u_short id; /* key or MS_* or LOC_[XY]_DELTA */
+ u_short pad; /* unused, at least by X11 */
+ int value; /* VKEY_{UP,DOWN} or locator delta */
+ struct timeval time;
+} Firm_event;
+
+/*
+ * Special `id' fields. These weird numbers simply match the old binaries.
+ * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).
+ */
+#define MS_LEFT 0x7f20 /* left mouse button */
+#define MS_MIDDLE 0x7f21 /* middle mouse button */
+#define MS_RIGHT 0x7f22 /* right mouse button */
+#define LOC_X_DELTA 0x7f80 /* mouse delta-X */
+#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */
+#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */
+#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */
+
+/*
+ * Special `value' fields. These apply to keys and mouse buttons. The
+ * value of a mouse delta is the delta. Note that positive deltas are
+ * left and up (not left and down as you might expect).
+ */
+#define VKEY_UP 0 /* key or button went up */
+#define VKEY_DOWN 1 /* key or button went down */
+
+/*
+ * The following ioctls are clearly intended to take things in and out
+ * of `firm event' mode. Since we always run in this mode (as far as
+ * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to
+ * be in this mode and reject anything else.
+ */
+#define VUIDSFORMAT _IOW('v', 1, int)
+#define VUIDGFORMAT _IOR('v', 2, int)
+#define VUID_FIRM_EVENT 1 /* the only format we support */
diff --git a/xc/programs/Xserver/hw/vfb/Imakefile b/xc/programs/Xserver/hw/vfb/Imakefile
new file mode 100644
index 000000000..5c138b191
--- /dev/null
+++ b/xc/programs/Xserver/hw/vfb/Imakefile
@@ -0,0 +1,69 @@
+XCOMM $TOG: Imakefile /main/13 1998/03/24 13:27:03 kaleb $
+XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.20 1999/06/14 07:31:45 dawes Exp $
+#include <Server.tmpl>
+
+#if HasShm
+SHMDEF = -DHAS_SHM
+#endif
+
+XCOMM add more architectures here as we discover them
+#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(i386BsdArchitecture) || defined(LinuxArchitecture)
+MMAPDEF = -DHAS_MMAP
+#endif
+
+#ifdef OS2Architecture
+SRCS1 = os2_stubs.c
+OBJS1 = os2_stubs.o
+#endif
+
+SRCSA = InitInput.c InitOutput.c stubs.c $(SRCS1) miinitext.c
+
+OBJSA = InitInput.o InitOutput.o stubs.o $(OBJS1) miinitext.o
+
+INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
+ -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \
+ -I$(EXTINCSRC) -I$(XINCLUDESRC)
+
+DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI
+
+
+#if BuildXinerama
+PAN_DEFINES = -DNO_PANORAMIX
+SRCSB = panoramiXstubs.c
+OBJSB = panoramiXstubs.o
+#endif
+
+#if BuildDPMS
+SRCSC = dpmsstubs.c
+OBJSC = dpmsstubs.o
+#endif
+
+SRCS = $(SRCSA) $(SRCSB) $(SRCSC)
+OBJS = $(OBJSA) $(OBJSB) $(OBJSC)
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(vfb,$(OBJS))
+
+#ifdef OS2Architecture
+LinkSourceFile(os2_stubs.c,../xfree86/os-support/os2)
+SpecialCObjectRule(os2_stubs,$(ICONFIGFILES),-DOS2NULLSELECT)
+#endif
+
+LinkSourceFile(stubs.c,../../Xi)
+SpecialCObjectRule(InitInput,$(ICONFIGFILES),$(EXT_DEFINES))
+
+LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
+SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER)
+
+#if BuildXinerama
+LinkSourceFile(panoramiXstubs.c,$(SERVERSRC)/Xext)
+SpecialCObjectRule(panoramiXstubs,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES))
+#endif
+
+#if BuildDPMS
+LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext)
+SpecialCObjectRule(dpmsstubs,$(ICONFIGFILES),$(EXT_DEFINES))
+#endif
+
+InstallManPage(Xvfb,$(MANDIR))
+DependTarget()
diff --git a/xc/programs/Xserver/hw/vfb/InitInput.c b/xc/programs/Xserver/hw/vfb/InitInput.c
new file mode 100644
index 000000000..cf4d883fd
--- /dev/null
+++ b/xc/programs/Xserver/hw/vfb/InitInput.c
@@ -0,0 +1,363 @@
+/* $TOG: InitInput.c /main/12 1998/02/10 13:23:52 kaleb $ */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/hw/vfb/InitInput.c,v 3.4 1998/10/04 09:38:50 dawes Exp $ */
+
+#include "X11/X.h"
+#define NEED_EVENTS
+#include "X11/Xproto.h"
+#include "scrnintstr.h"
+#include "inputstr.h"
+#include "X11/Xos.h"
+#include "mibstore.h"
+#include "mipointer.h"
+#include "lk201kbd.h"
+#include "keysym.h"
+
+#ifdef XFree86Server
+/*
+ * when building the loader, we add some code that tries to
+ * switch bit ordering based on xf86bpp; since Xvfb doesn't
+ * use that, we have to add this dummy here
+ */
+int xf86bpp = 8;
+#endif
+
+Bool
+LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return TRUE;
+}
+
+void
+ProcessInputEvents()
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+}
+
+#define VFB_MIN_KEY 8
+#define VFB_MAX_KEY 255
+KeySym map[MAP_LENGTH * LK201_GLYPHS_PER_KEY];
+
+/* The only reason for using the LK201 mappings here was that they were
+ * easy to lift.
+ */
+static Bool
+GetLK201Mappings(pKeySyms, pModMap)
+ KeySymsPtr pKeySyms;
+ CARD8 *pModMap;
+{
+#define INDEX(in) ((in - VFB_MIN_KEY) * LK201_GLYPHS_PER_KEY)
+ int i;
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+ pModMap[ KEY_LOCK ] = LockMask;
+ pModMap[ KEY_SHIFT ] = ShiftMask;
+ pModMap[ KEY_CTRL ] = ControlMask;
+ pModMap[ KEY_COMPOSE ] = Mod1Mask;
+
+ pKeySyms->minKeyCode = VFB_MIN_KEY;
+ pKeySyms->maxKeyCode = VFB_MAX_KEY;
+ pKeySyms->mapWidth = LK201_GLYPHS_PER_KEY;
+ pKeySyms->map = map;
+
+ for (i = 0; i < (MAP_LENGTH * LK201_GLYPHS_PER_KEY); i++)
+ map[i] = NoSymbol; /* make sure it is restored */
+
+ map[INDEX(KEY_F1)] = XK_F1;
+ map[INDEX(KEY_F2)] = XK_F2;
+ map[INDEX(KEY_F3)] = XK_F3;
+ map[INDEX(KEY_F4)] = XK_F4;
+ map[INDEX(KEY_F5)] = XK_F5;
+ map[INDEX(KEY_F6)] = XK_F6;
+ map[INDEX(KEY_F7)] = XK_F7;
+ map[INDEX(KEY_F8)] = XK_F8;
+ map[INDEX(KEY_F9)] = XK_F9;
+ map[INDEX(KEY_F10)] = XK_F10;
+ map[INDEX(KEY_F11)] = XK_F11;
+ map[INDEX(KEY_F12)] = XK_F12;
+ map[INDEX(KEY_F13)] = XK_F13;
+ map[INDEX(KEY_F14)] = XK_F14;
+
+ map[INDEX(KEY_HELP)] = XK_Help;
+ map[INDEX(KEY_MENU)] = XK_Menu;
+
+ map[INDEX(KEY_F17)] = XK_F17;
+ map[INDEX(KEY_F18)] = XK_F18;
+ map[INDEX(KEY_F19)] = XK_F19;
+ map[INDEX(KEY_F20)] = XK_F20;
+
+ map[INDEX(KEY_FIND)] = XK_Find;
+ map[INDEX(KEY_INSERT_HERE)] = XK_Insert;
+ map[INDEX(KEY_REMOVE)] = XK_Delete;
+ map[INDEX(KEY_SELECT)] = XK_Select;
+ map[INDEX(KEY_PREV_SCREEN)] = XK_Prior;
+ map[INDEX(KEY_NEXT_SCREEN)] = XK_Next;
+
+ map[INDEX(KEY_KP_0)] = XK_KP_0;
+ map[INDEX(KEY_KP_PERIOD)] = XK_KP_Decimal;
+ map[INDEX(KEY_KP_ENTER)] = XK_KP_Enter;
+ map[INDEX(KEY_KP_1)] = XK_KP_1;
+ map[INDEX(KEY_KP_2)] = XK_KP_2;
+ map[INDEX(KEY_KP_3)] = XK_KP_3;
+ map[INDEX(KEY_KP_4)] = XK_KP_4;
+ map[INDEX(KEY_KP_5)] = XK_KP_5;
+ map[INDEX(KEY_KP_6)] = XK_KP_6;
+ map[INDEX(KEY_KP_COMMA)] = XK_KP_Separator;
+ map[INDEX(KEY_KP_7)] = XK_KP_7;
+ map[INDEX(KEY_KP_8)] = XK_KP_8;
+ map[INDEX(KEY_KP_9)] = XK_KP_9;
+ map[INDEX(KEY_KP_HYPHEN)] = XK_KP_Subtract;
+ map[INDEX(KEY_KP_PF1)] = XK_KP_F1;
+ map[INDEX(KEY_KP_PF2)] = XK_KP_F2;
+ map[INDEX(KEY_KP_PF3)] = XK_KP_F3;
+ map[INDEX(KEY_KP_PF4)] = XK_KP_F4;
+
+ map[INDEX(KEY_LEFT)] = XK_Left;
+ map[INDEX(KEY_RIGHT)] = XK_Right;
+ map[INDEX(KEY_DOWN)] = XK_Down;
+ map[INDEX(KEY_UP)] = XK_Up;
+
+ map[INDEX(KEY_SHIFT)] = XK_Shift_L;
+ map[INDEX(KEY_CTRL)] = XK_Control_L;
+ map[INDEX(KEY_LOCK)] = XK_Caps_Lock;
+ map[INDEX(KEY_COMPOSE)] = XK_Multi_key;
+ map[INDEX(KEY_COMPOSE)+1] = XK_Meta_L;
+ map[INDEX(KEY_DELETE)] = XK_Delete;
+ map[INDEX(KEY_RETURN)] = XK_Return;
+ map[INDEX(KEY_TAB)] = XK_Tab;
+
+ map[INDEX(KEY_TILDE)] = XK_quoteleft;
+ map[INDEX(KEY_TILDE)+1] = XK_asciitilde;
+
+ map[INDEX(KEY_TR_1)] = XK_1;
+ map[INDEX(KEY_TR_1)+1] = XK_exclam;
+ map[INDEX(KEY_Q)] = XK_Q;
+ map[INDEX(KEY_A)] = XK_A;
+ map[INDEX(KEY_Z)] = XK_Z;
+
+ map[INDEX(KEY_TR_2)] = XK_2;
+ map[INDEX(KEY_TR_2)+1] = XK_at;
+
+ map[INDEX(KEY_W)] = XK_W;
+ map[INDEX(KEY_S)] = XK_S;
+ map[INDEX(KEY_X)] = XK_X;
+
+ map[INDEX(KEY_LANGLE_RANGLE)] = XK_less;
+ map[INDEX(KEY_LANGLE_RANGLE)+1] = XK_greater;
+
+ map[INDEX(KEY_TR_3)] = XK_3;
+ map[INDEX(KEY_TR_3)+1] = XK_numbersign;
+
+ map[INDEX(KEY_E)] = XK_E;
+ map[INDEX(KEY_D)] = XK_D;
+ map[INDEX(KEY_C)] = XK_C;
+
+ map[INDEX(KEY_TR_4)] = XK_4;
+ map[INDEX(KEY_TR_4)+1] = XK_dollar;
+
+ map[INDEX(KEY_R)] = XK_R;
+ map[INDEX(KEY_F)] = XK_F;
+ map[INDEX(KEY_V)] = XK_V;
+ map[INDEX(KEY_SPACE)] = XK_space;
+
+ map[INDEX(KEY_TR_5)] = XK_5;
+ map[INDEX(KEY_TR_5)+1] = XK_percent;
+
+ map[INDEX(KEY_T)] = XK_T;
+ map[INDEX(KEY_G)] = XK_G;
+ map[INDEX(KEY_B)] = XK_B;
+
+ map[INDEX(KEY_TR_6)] = XK_6;
+ map[INDEX(KEY_TR_6)+1] = XK_asciicircum;
+
+ map[INDEX(KEY_Y)] = XK_Y;
+ map[INDEX(KEY_H)] = XK_H;
+ map[INDEX(KEY_N)] = XK_N;
+
+ map[INDEX(KEY_TR_7)] = XK_7;
+ map[INDEX(KEY_TR_7)+1] = XK_ampersand;
+
+ map[INDEX(KEY_U)] = XK_U;
+ map[INDEX(KEY_J)] = XK_J;
+ map[INDEX(KEY_M)] = XK_M;
+
+ map[INDEX(KEY_TR_8)] = XK_8;
+ map[INDEX(KEY_TR_8)+1] = XK_asterisk;
+
+ map[INDEX(KEY_I)] = XK_I;
+ map[INDEX(KEY_K)] = XK_K;
+
+ map[INDEX(KEY_COMMA)] = XK_comma;
+ map[INDEX(KEY_COMMA)+1] = XK_less;
+
+ map[INDEX(KEY_TR_9)] = XK_9;
+ map[INDEX(KEY_TR_9)+1] = XK_parenleft;
+
+ map[INDEX(KEY_O)] = XK_O;
+ map[INDEX(KEY_L)] = XK_L;
+
+ map[INDEX(KEY_PERIOD)] = XK_period;
+ map[INDEX(KEY_PERIOD)+1] = XK_greater;
+
+ map[INDEX(KEY_TR_0)] = XK_0;
+ map[INDEX(KEY_TR_0)+1] = XK_parenright;
+
+ map[INDEX(KEY_P)] = XK_P;
+
+ map[INDEX(KEY_SEMICOLON)] = XK_semicolon;
+ map[INDEX(KEY_SEMICOLON)+1] = XK_colon;
+
+ map[INDEX(KEY_QMARK)] = XK_slash;
+ map[INDEX(KEY_QMARK)+1] = XK_question;
+
+ map[INDEX(KEY_PLUS)] = XK_equal;
+ map[INDEX(KEY_PLUS)+1] = XK_plus;
+
+ map[INDEX(KEY_RBRACE)] = XK_bracketright;
+ map[INDEX(KEY_RBRACE)+1] = XK_braceright;
+
+ map[INDEX(KEY_VBAR)] = XK_backslash;
+ map[INDEX(KEY_VBAR)+1] = XK_bar;
+
+ map[INDEX(KEY_UBAR)] = XK_minus;
+ map[INDEX(KEY_UBAR)+1] = XK_underscore;
+
+ map[INDEX(KEY_LBRACE)] = XK_bracketleft;
+ map[INDEX(KEY_LBRACE)+1] = XK_braceleft;
+
+ map[INDEX(KEY_QUOTE)] = XK_quoteright;
+ map[INDEX(KEY_QUOTE)+1] = XK_quotedbl;
+
+ map[INDEX(KEY_F11)] = XK_Escape;
+
+ return TRUE;
+#undef INDEX
+}
+
+static int
+vfbKeybdProc(pDevice, onoff)
+ DeviceIntPtr pDevice;
+ int onoff;
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ int i;
+ DevicePtr pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ GetLK201Mappings(&keySyms, modMap);
+ InitKeyboardDeviceStruct(pDev, &keySyms, modMap,
+ (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA);
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+static int
+vfbMouseProc(pDevice, onoff)
+ DeviceIntPtr pDevice;
+ int onoff;
+{
+ BYTE map[4];
+ DevicePtr pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents,
+ (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize());
+ break;
+
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+void
+InitInput(argc, argv)
+ int argc;
+ char *argv[];
+{
+ DeviceIntPtr p, k;
+ p = AddInputDevice(vfbMouseProc, TRUE);
+ k = AddInputDevice(vfbKeybdProc, TRUE);
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+ miRegisterPointerDevice(screenInfo.screens[0], p);
+ (void)mieqInit (k, p);
+}
+
+#ifdef XTESTEXT1
+void
+XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
+ int dev_type;
+ int keycode;
+ int keystate;
+ int mousex;
+ int mousey;
+{
+}
+
+void
+XTestGetPointerPos(fmousex, fmousey)
+ short *fmousex, *fmousey;
+{
+}
+
+void
+XTestJumpPointer(jx, jy, dev_type)
+ int jx;
+ int jy;
+ int dev_type;
+{
+}
+#endif
+
diff --git a/xc/programs/Xserver/hw/vfb/InitOutput.c b/xc/programs/Xserver/hw/vfb/InitOutput.c
new file mode 100644
index 000000000..1c70c981f
--- /dev/null
+++ b/xc/programs/Xserver/hw/vfb/InitOutput.c
@@ -0,0 +1,989 @@
+/* $TOG: InitOutput.c /main/20 1998/02/10 13:23:56 kaleb $ */
+/*
+
+Copyright 1993, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.11 1999/05/14 14:11:09 dawes Exp $ */
+
+#ifdef WIN32
+#include <X11/Xwinsock.h>
+#endif
+#include <stdio.h>
+#include "X11/X.h"
+#define NEED_EVENTS
+#include "X11/Xproto.h"
+#include "X11/Xos.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define PSZ 8
+#include "cfb.h"
+#include "mibstore.h"
+#include "colormapst.h"
+#include "gcstruct.h"
+#include "input.h"
+#include "mipointer.h"
+#include <sys/types.h>
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+#endif /* HAS_MMAP */
+#include <sys/stat.h>
+#include <errno.h>
+#ifndef WIN32
+#include <sys/param.h>
+#endif
+#include <X11/XWDFile.h>
+#ifdef HAS_SHM
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAS_SHM */
+#include "dix.h"
+#include "miline.h"
+
+extern char *display;
+
+#define VFB_DEFAULT_WIDTH 1280
+#define VFB_DEFAULT_HEIGHT 1024
+#define VFB_DEFAULT_DEPTH 8
+#define VFB_DEFAULT_WHITEPIXEL 0
+#define VFB_DEFAULT_BLACKPIXEL 1
+#define VFB_DEFAULT_LINEBIAS 0
+#define XWD_WINDOW_NAME_LEN 60
+
+typedef struct
+{
+ int scrnum;
+ int width;
+ int paddedWidth;
+ int height;
+ int depth;
+ int bitsPerPixel;
+ int sizeInBytes;
+ int ncolors;
+ char *pfbMemory;
+ XWDColor *pXWDCmap;
+ XWDFileHeader *pXWDHeader;
+ Pixel blackPixel;
+ Pixel whitePixel;
+ unsigned int lineBias;
+
+#ifdef HAS_MMAP
+ int mmap_fd;
+ char mmap_file[MAXPATHLEN];
+#endif
+
+#ifdef HAS_SHM
+ int shmid;
+#endif
+} vfbScreenInfo, *vfbScreenInfoPtr;
+
+static int vfbNumScreens;
+static vfbScreenInfo vfbScreens[MAXSCREENS];
+static Bool vfbPixmapDepths[33];
+static char *pfbdir = NULL;
+typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType;
+static fbMemType fbmemtype = NORMAL_MEMORY_FB;
+static char needswap = 0;
+static int lastScreen = -1;
+
+#define swapcopy16(_dst, _src) \
+ if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \
+ else _dst = _src;
+
+#define swapcopy32(_dst, _src) \
+ if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \
+ else _dst = _src;
+
+
+static void
+vfbInitializePixmapDepths()
+{
+ int i;
+ vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
+ for (i = 2; i <= 32; i++)
+ vfbPixmapDepths[i] = FALSE;
+}
+
+static void
+vfbInitializeDefaultScreens()
+{
+ int i;
+
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].scrnum = i;
+ vfbScreens[i].width = VFB_DEFAULT_WIDTH;
+ vfbScreens[i].height = VFB_DEFAULT_HEIGHT;
+ vfbScreens[i].depth = VFB_DEFAULT_DEPTH;
+ vfbScreens[i].blackPixel = VFB_DEFAULT_BLACKPIXEL;
+ vfbScreens[i].whitePixel = VFB_DEFAULT_WHITEPIXEL;
+ vfbScreens[i].lineBias = VFB_DEFAULT_LINEBIAS;
+ vfbScreens[i].pfbMemory = NULL;
+ }
+ vfbNumScreens = 1;
+}
+
+static int
+vfbBitsPerPixel(depth)
+ int depth;
+{
+ if (depth == 1) return 1;
+ else if (depth <= 8) return 8;
+ else if (depth <= 16) return 16;
+ else return 32;
+}
+
+void
+ddxGiveUp()
+{
+ int i;
+
+ /* clean up the framebuffers */
+
+ switch (fbmemtype)
+ {
+#ifdef HAS_MMAP
+ case MMAPPED_FILE_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == unlink(vfbScreens[i].mmap_file))
+ {
+ perror("unlink");
+ ErrorF("unlink %s failed, errno %d",
+ vfbScreens[i].mmap_file, errno);
+ }
+ }
+ break;
+#endif /* HAS_MMAP */
+
+#ifdef HAS_SHM
+ case SHARED_MEMORY_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader))
+ {
+ perror("shmdt");
+ ErrorF("shmdt failed, errno %d", errno);
+ }
+ }
+ break;
+#endif /* HAS_SHM */
+
+ case NORMAL_MEMORY_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ Xfree(vfbScreens[i].pXWDHeader);
+ }
+ break;
+ }
+}
+
+void
+AbortDDX()
+{
+ ddxGiveUp();
+}
+
+void
+OsVendorInit()
+{
+}
+
+void
+OsVendorFatalError()
+{
+}
+
+void
+ddxUseMsg()
+{
+ ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
+ ErrorF("-pixdepths list-of-int support given pixmap depths\n");
+ ErrorF("-linebias n adjust thin line pixelization\n");
+ ErrorF("-blackpixel n pixel value for black\n");
+ ErrorF("-whitepixel n pixel value for white\n");
+
+#ifdef HAS_MMAP
+ ErrorF("-fbdir directory put framebuffers in mmap'ed files in directory\n");
+#endif
+
+#ifdef HAS_SHM
+ ErrorF("-shmem put framebuffers in shared memory\n");
+#endif
+}
+
+int
+ddxProcessArgument (argc, argv, i)
+ int argc;
+ char *argv[];
+ int i;
+{
+ static Bool firstTime = TRUE;
+
+ if (firstTime)
+ {
+ vfbInitializeDefaultScreens();
+ vfbInitializePixmapDepths();
+ firstTime = FALSE;
+ }
+
+ if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */
+ {
+ int screenNum;
+ if (i + 2 >= argc) UseMsg();
+ screenNum = atoi(argv[i+1]);
+ if (screenNum < 0 || screenNum >= MAXSCREENS)
+ {
+ ErrorF("Invalid screen number %d\n", screenNum);
+ UseMsg();
+ }
+ if (3 != sscanf(argv[i+2], "%dx%dx%d",
+ &vfbScreens[screenNum].width,
+ &vfbScreens[screenNum].height,
+ &vfbScreens[screenNum].depth))
+ {
+ ErrorF("Invalid screen configuration %s\n", argv[i+2]);
+ UseMsg();
+ }
+
+ if (screenNum >= vfbNumScreens)
+ vfbNumScreens = screenNum + 1;
+ lastScreen = screenNum;
+ return 3;
+ }
+
+ if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */
+ {
+ int depth, ret = 1;
+
+ if (++i >= argc) UseMsg();
+ while ((i < argc) && (depth = atoi(argv[i++])) != 0)
+ {
+ if (depth < 0 || depth > 32)
+ {
+ ErrorF("Invalid pixmap depth %d\n", depth);
+ UseMsg();
+ }
+ vfbPixmapDepths[depth] = TRUE;
+ ret++;
+ }
+ return ret;
+ }
+
+ if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
+ {
+ Pixel pix;
+ if (++i >= argc) UseMsg();
+ pix = atoi(argv[i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].blackPixel = pix;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].blackPixel = pix;
+ }
+ return 2;
+ }
+
+ if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */
+ {
+ Pixel pix;
+ if (++i >= argc) UseMsg();
+ pix = atoi(argv[i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].whitePixel = pix;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].whitePixel = pix;
+ }
+ return 2;
+ }
+
+ if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */
+ {
+ unsigned int linebias;
+ if (++i >= argc) UseMsg();
+ linebias = atoi(argv[i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].lineBias = linebias;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].lineBias = linebias;
+ }
+ return 2;
+ }
+
+#ifdef HAS_MMAP
+ if (strcmp (argv[i], "-fbdir") == 0) /* -fbdir directory */
+ {
+ if (++i >= argc) UseMsg();
+ pfbdir = argv[i];
+ fbmemtype = MMAPPED_FILE_FB;
+ return 2;
+ }
+#endif /* HAS_MMAP */
+
+#ifdef HAS_SHM
+ if (strcmp (argv[i], "-shmem") == 0) /* -shmem */
+ {
+ fbmemtype = SHARED_MEMORY_FB;
+ return 1;
+ }
+#endif
+
+ return 0;
+}
+
+#ifdef DDXTIME /* from ServerOSDefines */
+CARD32
+GetTimeInMillis()
+{
+ struct timeval tp;
+
+ X_GETTIMEOFDAY(&tp);
+ return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}
+#endif
+
+
+static Bool
+vfbMultiDepthCreateGC(pGC)
+ GCPtr pGC;
+{
+ switch (vfbBitsPerPixel(pGC->depth))
+ {
+ case 1: return mfbCreateGC (pGC);
+ case 8: return cfbCreateGC (pGC);
+ case 16: return cfb16CreateGC (pGC);
+ case 32: return cfb32CreateGC (pGC);
+ default: return FALSE;
+ }
+}
+
+static void
+vfbMultiDepthGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
+ DrawablePtr pDrawable; /* drawable from which to get bits */
+ int wMax; /* largest value of all *pwidths */
+ register DDXPointPtr ppt; /* points to start copying from */
+ int *pwidth; /* list of number of bits to copy */
+ int nspans; /* number of scanlines to copy */
+ char *pdstStart; /* where to put the bits */
+{
+ switch (pDrawable->bitsPerPixel) {
+ case 1:
+ mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 8:
+ cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 16:
+ cfb16GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ case 32:
+ cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ break;
+ }
+ return;
+}
+
+static void
+vfbMultiDepthGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
+ DrawablePtr pDrawable;
+ int sx, sy, w, h;
+ unsigned int format;
+ unsigned long planeMask;
+ char *pdstLine;
+{
+ switch (pDrawable->bitsPerPixel)
+ {
+ case 1:
+ mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 8:
+ cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 16:
+ cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ case 32:
+ cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
+ break;
+ }
+}
+
+static ColormapPtr InstalledMaps[MAXSCREENS];
+
+static int
+vfbListInstalledColormaps(pScreen, pmaps)
+ ScreenPtr pScreen;
+ Colormap *pmaps;
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+ *pmaps = InstalledMaps[pScreen->myNum]->mid;
+ return (1);
+}
+
+
+static void
+vfbInstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ int index = pmap->pScreen->myNum;
+ ColormapPtr oldpmap = InstalledMaps[index];
+
+ if (pmap != oldpmap)
+ {
+ int entries;
+ XWDFileHeader *pXWDHeader;
+ XWDColor *pXWDCmap;
+ VisualPtr pVisual;
+ Pixel * ppix;
+ xrgb * prgb;
+ xColorItem *defs;
+ int i;
+
+ if(oldpmap != (ColormapPtr)None)
+ WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ /* Install pmap */
+ InstalledMaps[index] = pmap;
+ WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
+
+ entries = pmap->pVisual->ColormapEntries;
+ pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+ pVisual = pmap->pVisual;
+
+ swapcopy32(pXWDHeader->visual_class, pVisual->class);
+ swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
+ swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
+ swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
+ swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
+ swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
+
+ ppix = (Pixel *)ALLOCATE_LOCAL(entries * sizeof(Pixel));
+ prgb = (xrgb *)ALLOCATE_LOCAL(entries * sizeof(xrgb));
+ defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem));
+
+ for (i = 0; i < entries; i++) ppix[i] = i;
+ /* XXX truecolor */
+ QueryColors(pmap, entries, ppix, prgb);
+
+ for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+ (*pmap->pScreen->StoreColors)(pmap, entries, defs);
+
+ DEALLOCATE_LOCAL(ppix);
+ DEALLOCATE_LOCAL(prgb);
+ DEALLOCATE_LOCAL(defs);
+ }
+}
+
+static void
+vfbUninstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
+
+ if(pmap == curpmap)
+ {
+ if (pmap->mid != pmap->pScreen->defColormap)
+ {
+ curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pmap->pScreen->InstallColormap)(curpmap);
+ }
+ }
+}
+
+static void
+vfbStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ XWDColor *pXWDCmap;
+ int i;
+
+ if (pmap != InstalledMaps[pmap->pScreen->myNum]) return;
+
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ return;
+
+ for (i = 0; i < ndef; i++)
+ {
+ if (pdefs[i].flags & DoRed)
+ swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
+ if (pdefs[i].flags & DoGreen)
+ swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
+ if (pdefs[i].flags & DoBlue)
+ swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
+ }
+}
+
+static Bool
+vfbSaveScreen(pScreen, on)
+ ScreenPtr pScreen;
+ int on;
+{
+ return TRUE;
+}
+
+#ifdef HAS_MMAP
+
+/* this flushes any changes to the screens out to the mmapped file */
+static void
+vfbBlockHandler(blockData, pTimeout, pReadmask)
+ pointer blockData;
+ OSTimePtr pTimeout;
+ pointer pReadmask;
+{
+ int i;
+
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+#ifdef MS_ASYNC
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes, MS_ASYNC))
+#else
+ /* silly NetBSD and who else? */
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes))
+#endif
+ {
+ perror("msync");
+ ErrorF("msync failed, errno %d", errno);
+ }
+ }
+}
+
+
+static void
+vfbWakeupHandler(blockData, result, pReadmask)
+ pointer blockData;
+ int result;
+ pointer pReadmask;
+{
+}
+
+
+static void
+vfbAllocateMmappedFramebuffer(pvfb)
+ vfbScreenInfoPtr pvfb;
+{
+#define DUMMY_BUFFER_SIZE 65536
+ char dummyBuffer[DUMMY_BUFFER_SIZE];
+ int currentFileSize, writeThisTime;
+
+ sprintf(pvfb->mmap_file, "%s/Xvfb_screen%d", pfbdir, pvfb->scrnum);
+ if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
+ {
+ perror("open");
+ ErrorF("open %s failed, errno %d", pvfb->mmap_file, errno);
+ return;
+ }
+
+ /* Extend the file to be the proper size */
+
+ bzero(dummyBuffer, DUMMY_BUFFER_SIZE);
+ for (currentFileSize = 0;
+ currentFileSize < pvfb->sizeInBytes;
+ currentFileSize += writeThisTime)
+ {
+ writeThisTime = min(DUMMY_BUFFER_SIZE,
+ pvfb->sizeInBytes - currentFileSize);
+ if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime))
+ {
+ perror("write");
+ ErrorF("write %s failed, errno %d", pvfb->mmap_file, errno);
+ return;
+ }
+ }
+
+ /* try to mmap the file */
+
+ pvfb->pXWDHeader = (XWDFileHeader *)mmap((caddr_t)NULL, pvfb->sizeInBytes,
+ PROT_READ|PROT_WRITE,
+ MAP_FILE|MAP_SHARED,
+ pvfb->mmap_fd, 0);
+ if (-1 == (int)pvfb->pXWDHeader)
+ {
+ perror("mmap");
+ ErrorF("mmap %s failed, errno %d", pvfb->mmap_file, errno);
+ pvfb->pXWDHeader = NULL;
+ return;
+ }
+
+ if (!RegisterBlockAndWakeupHandlers(vfbBlockHandler, vfbWakeupHandler,
+ NULL))
+ {
+ pvfb->pXWDHeader = NULL;
+ }
+}
+#endif /* HAS_MMAP */
+
+
+#ifdef HAS_SHM
+static void
+vfbAllocateSharedMemoryFramebuffer(pvfb)
+ vfbScreenInfoPtr pvfb;
+{
+ /* create the shared memory segment */
+
+ pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT|0777);
+ if (pvfb->shmid < 0)
+ {
+ perror("shmget");
+ ErrorF("shmget %d bytes failed, errno %d", pvfb->sizeInBytes, errno);
+ return;
+ }
+
+ /* try to attach it */
+
+ pvfb->pXWDHeader = (XWDFileHeader *)shmat(pvfb->shmid, 0, 0);
+ if (-1 == (int)pvfb->pXWDHeader)
+ {
+ perror("shmat");
+ ErrorF("shmat failed, errno %d", errno);
+ pvfb->pXWDHeader = NULL;
+ return;
+ }
+
+ ErrorF("screen %d shmid %d\n", pvfb->scrnum, pvfb->shmid);
+}
+#endif /* HAS_SHM */
+
+static char *
+vfbAllocateFramebufferMemory(pvfb)
+ vfbScreenInfoPtr pvfb;
+{
+ if (pvfb->pfbMemory) return pvfb->pfbMemory; /* already done */
+
+ if (pvfb->bitsPerPixel == 1)
+ pvfb->sizeInBytes = (pvfb->paddedWidth * pvfb->height);
+ else
+ pvfb->sizeInBytes = pvfb->paddedWidth * pvfb->height *
+ (pvfb->bitsPerPixel/8);
+
+ /* Calculate how many entries in colormap. This is rather bogus, because
+ * the visuals haven't even been set up yet, but we need to know because we
+ * have to allocate space in the file for the colormap. The number 10
+ * below comes from the MAX_PSEUDO_DEPTH define in cfbcmap.c.
+ */
+
+ if (pvfb->depth <= 10)
+ { /* single index colormaps */
+ pvfb->ncolors = 1 << pvfb->depth;
+ }
+ else
+ { /* decomposed colormaps */
+ int nplanes_per_color_component = pvfb->depth / 3;
+ if (pvfb->depth % 3) nplanes_per_color_component++;
+ pvfb->ncolors = 1 << nplanes_per_color_component;
+ }
+
+ /* add extra bytes for XWDFileHeader, window name, and colormap */
+
+ pvfb->sizeInBytes += SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN +
+ pvfb->ncolors * SIZEOF(XWDColor);
+
+ pvfb->pXWDHeader = NULL;
+ switch (fbmemtype)
+ {
+#ifdef HAS_MMAP
+ case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
+#endif
+
+#ifdef HAS_SHM
+ case SHARED_MEMORY_FB: vfbAllocateSharedMemoryFramebuffer(pvfb); break;
+#endif
+
+ case NORMAL_MEMORY_FB:
+ pvfb->pXWDHeader = (XWDFileHeader *)Xalloc(pvfb->sizeInBytes);
+ break;
+ }
+
+ if (pvfb->pXWDHeader)
+ {
+ pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader
+ + SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN);
+ pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors);
+ return pvfb->pfbMemory;
+ }
+ else
+ return NULL;
+}
+
+
+static void
+vfbWriteXWDFileHeader(pScreen)
+ ScreenPtr pScreen;
+{
+ vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
+ XWDFileHeader *pXWDHeader = pvfb->pXWDHeader;
+ char hostname[XWD_WINDOW_NAME_LEN];
+ VisualPtr pVisual;
+ unsigned long swaptest = 1;
+ int i;
+
+ needswap = *(char *) &swaptest;
+
+ pXWDHeader->header_size = (char *)pvfb->pXWDCmap - (char *)pvfb->pXWDHeader;
+ pXWDHeader->file_version = XWD_FILE_VERSION;
+
+ pXWDHeader->pixmap_format = ZPixmap;
+ pXWDHeader->pixmap_depth = pvfb->depth;
+ pXWDHeader->pixmap_height = pXWDHeader->window_height = pvfb->height;
+ pXWDHeader->xoffset = 0;
+ pXWDHeader->byte_order = IMAGE_BYTE_ORDER;
+ pXWDHeader->bitmap_bit_order = BITMAP_BIT_ORDER;
+#ifndef INTERNAL_VS_EXTERNAL_PADDING
+ pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->width;
+ pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT;
+ pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD;
+#else
+ pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->paddedWidth;
+ pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT_PROTO;
+ pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD_PROTO;
+#endif
+ pXWDHeader->bits_per_pixel = pvfb->bitsPerPixel;
+ pXWDHeader->bytes_per_line = pvfb->paddedWidth;
+ pXWDHeader->ncolors = pvfb->ncolors;
+
+ /* visual related fields are written when colormap is installed */
+
+ pXWDHeader->window_x = pXWDHeader->window_y = 0;
+ pXWDHeader->window_bdrwidth = 0;
+
+ /* write xwd "window" name: Xvfb hostname:server.screen */
+
+ if (-1 == gethostname(hostname, sizeof(hostname)))
+ hostname[0] = 0;
+ else
+ hostname[XWD_WINDOW_NAME_LEN-1] = 0;
+ sprintf((char *)(pXWDHeader+1), "Xvfb %s:%s.%d", hostname, display,
+ pScreen->myNum);
+
+ /* write colormap pixel slot values */
+
+ for (i = 0; i < pvfb->ncolors; i++)
+ {
+ pvfb->pXWDCmap[i].pixel = i;
+ }
+
+ /* byte swap to most significant byte first */
+
+ if (needswap)
+ {
+ SwapLongs((CARD32 *)pXWDHeader, SIZEOF(XWDheader)/4);
+ for (i = 0; i < pvfb->ncolors; i++)
+ {
+ register char n;
+ swapl(&pvfb->pXWDCmap[i].pixel, n);
+ }
+ }
+}
+
+
+static Bool
+vfbCursorOffScreen (ppScreen, x, y)
+ ScreenPtr *ppScreen;
+ int *x, *y;
+{
+ return FALSE;
+}
+
+static void
+vfbCrossScreen (pScreen, entering)
+ ScreenPtr pScreen;
+ Bool entering;
+{
+}
+
+static miPointerScreenFuncRec vfbPointerCursorFuncs =
+{
+ vfbCursorOffScreen,
+ vfbCrossScreen,
+ miPointerWarpCursor
+};
+
+static Bool
+vfbScreenInit(index, pScreen, argc, argv)
+ int index;
+ ScreenPtr pScreen;
+ int argc;
+ char ** argv;
+{
+ vfbScreenInfoPtr pvfb = &vfbScreens[index];
+ int dpix = 100, dpiy = 100;
+ int ret;
+ char *pbits;
+
+ pvfb->paddedWidth = PixmapBytePad(pvfb->width, pvfb->depth);
+ pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth);
+ pbits = vfbAllocateFramebufferMemory(pvfb);
+ if (!pbits) return FALSE;
+
+ switch (pvfb->bitsPerPixel)
+ {
+ case 1:
+ ret = mfbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth * 8);
+ break;
+ case 8:
+ ret = cfbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth);
+ break;
+ case 16:
+ ret = cfb16ScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth);
+ break;
+ case 32:
+ ret = cfb32ScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth);
+ break;
+ default:
+ return FALSE;
+ }
+
+ if (!ret) return FALSE;
+
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Circumvent the backing store that was just initialised. This amounts
+ * to a truely bizarre way of initialising SaveDoomedAreas and friends.
+ */
+ pScreen->CreateGC = vfbMultiDepthCreateGC;
+ pScreen->GetImage = vfbMultiDepthGetImage;
+ pScreen->GetSpans = vfbMultiDepthGetSpans;
+
+ pScreen->InstallColormap = vfbInstallColormap;
+ pScreen->UninstallColormap = vfbUninstallColormap;
+ pScreen->ListInstalledColormaps = vfbListInstalledColormaps;
+
+ pScreen->SaveScreen = vfbSaveScreen;
+ pScreen->StoreColors = vfbStoreColors;
+
+ miDCInitialize(pScreen, &vfbPointerCursorFuncs);
+
+ vfbWriteXWDFileHeader(pScreen);
+
+ pScreen->blackPixel = pvfb->blackPixel;
+ pScreen->whitePixel = pvfb->whitePixel;
+
+ if (pvfb->bitsPerPixel == 1)
+ {
+ ret = mfbCreateDefColormap(pScreen);
+ }
+ else
+ {
+ ret = cfbCreateDefColormap(pScreen);
+ }
+
+ miSetZeroLineBias(pScreen, pvfb->lineBias);
+
+ return ret;
+
+} /* end vfbScreenInit */
+
+
+void
+InitOutput(screenInfo, argc, argv)
+ ScreenInfo *screenInfo;
+ int argc;
+ char **argv;
+{
+ int i;
+ int NumFormats = 0;
+ FILE *pf = stderr;
+
+ /* initialize pixmap formats */
+
+ /* must have a pixmap depth to match every screen depth */
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
+ }
+
+ for (i = 1; i <= 32; i++)
+ {
+ if (vfbPixmapDepths[i])
+ {
+ if (NumFormats >= MAXFORMATS)
+ FatalError ("MAXFORMATS is too small for this server\n");
+ screenInfo->formats[NumFormats].depth = i;
+ screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
+ screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+ NumFormats++;
+ }
+ }
+
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NumFormats;
+
+ /* initialize screens */
+
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == AddScreen(vfbScreenInit, argc, argv))
+ {
+ FatalError("Couldn't add screen %d", i);
+ }
+ }
+
+} /* end InitOutput */
+
+/* this is just to get the server to link on AIX */
+#ifdef AIXV3
+int SelectWaitTime = 10000; /* usec */
+#endif
+
diff --git a/xc/programs/Xserver/hw/vfb/Xvfb.man b/xc/programs/Xserver/hw/vfb/Xvfb.man
new file mode 100644
index 000000000..9da2c87b9
--- /dev/null
+++ b/xc/programs/Xserver/hw/vfb/Xvfb.man
@@ -0,0 +1,124 @@
+.\" $TOG: Xvfb.man /main/12 1998/02/10 13:24:06 kaleb $
+.\" Copyright 1993, 1998 The Open Group
+.\"
+.\" All Rights Reserved.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.TH XVFB 1 "Release 6.4" "X Version 11"
+.SH NAME
+Xvfb \- virtual framebuffer X server for X Version 11
+.SH SYNOPSIS
+.B Xvfb
+[ option ] ...
+.SH DESCRIPTION
+.I Xvfb
+is an X server that can run on machines with no display hardware
+and no physical input devices. It emulates a dumb framebuffer using
+virtual memory.
+.PP
+The primary use of this server was intended to be server testing. The
+mfb or cfb code for any depth can be exercised with this server
+without the need for real hardware that supports the desired depths.
+The X community has found many other novel uses for \fIXvfb\fP,
+including testing clients against unusual depths and screen
+configurations, doing batch processing with \fIXvfb\fP as a background
+rendering engine, load testing, as an aid to porting the X server to a
+new platform, and providing an unobtrusive way to run applications
+that don't really need an X server but insist on having one anyway.
+.SH BUILDING
+To build \fIXvfb\fP, put the following in your host.def and remake.
+.PP
+#define BuildServer YES /* if you aren't already building other servers */
+.br
+#define XVirtualFramebufferServer YES
+
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXvfb\fP accepts the following command line switches:
+.TP 4
+.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
+This option creates screen \fIscreennum\fP and sets its width, height,
+and depth to W, H, and D respectively. By default, only screen 0 exists
+and has the dimensions 1280x1024x8.
+.TP 4
+.B "\-pixdepths \fIlist-of-depths\fP"
+This option specifies a list of pixmap depths that the server should
+support in addition to the depths implied by the supported screens.
+\fIlist-of-depths\fP is a space-separated list of integers that can
+have values from 1 to 32.
+.TP 4
+.B "\-fbdir \fIframebuffer-directory\fP"
+This option specifies the directory in which the memory mapped files
+containing the framebuffer memory should be created.
+See FILES.
+This option only exists on machines that have the mmap and msync system
+calls.
+.TP 4
+.B "\-shmem"
+This option specifies that the framebuffer should be put in shared memory.
+The shared memory ID for each screen will be printed by the server.
+The shared memory is in xwd format.
+This option only exists on machines that support the System V shared memory
+interface.
+.PP
+If neither \fB\-shmem\fP nor \fB\-fbdir\fP is specified,
+the framebuffer memory will be allocated with malloc().
+.TP 4
+.B "\-linebias \fIn\fP"
+This option specifies how to adjust the pixelization of thin lines.
+The value \fIn\fP is a bitmask of octants in which to prefer an axial
+step when the Bresenham error term is exactly zero. See the file
+Xserver/mi/miline.h for more information. This option is probably only useful
+to server developers to experiment with the range of line pixelization
+possible with the cfb and mfb code.
+.TP 4
+.B "\-blackpixel \fIpixel-value\fP, \-whitepixel \fIpixel-value\fP"
+These options specify the black and white pixel values the server should use.
+.SH FILES
+The following files are created if the \-fbdir option is given.
+.TP 4
+\fIframebuffer-directory\fP/Xvfb_screen<n>
+Memory mapped file containing screen n's framebuffer memory, one file
+per screen. The file is in xwd format. Thus, taking a full-screen
+snapshot can be done with a file copy command, and the resulting
+snapshot will even contain the cursor image.
+.SH EXAMPLES
+.TP 8
+Xvfb :1 -screen 0 1600x1200x32
+The server will listen for connections as server number 1, and screen 0
+will be depth 32 1600x1200.
+.TP 8
+Xvfb :1 -screen 1 1600x1200x16
+The server will listen for connections as server number 1, will have the
+default screen configuration (one screen, 1280x1024x8), and screen 1
+will be depth 16 1600x1200.
+.TP 8
+Xvfb -pixdepths 3 27 -fbdir /usr/tmp
+The server will listen for connections as server number 0, will have the
+default screen configuration (one screen, 1280x1024x8),
+will also support pixmap
+depths of 3 and 27,
+and will use memory mapped files in /usr/tmp for the framebuffer.
+.TP 8
+xwud -in /usr/tmp/Xvfb_screen0
+Displays screen 0 of the server started by the preceding example.
+.SH "SEE ALSO"
+.PP
+X(1), Xserver(1), xwd(1), xwud(1), XWDFile.h
+.SH AUTHORS
+David P. Wiggins, The Open Group, Inc.
diff --git a/xc/programs/Xserver/hw/vfb/lk201kbd.h b/xc/programs/Xserver/hw/vfb/lk201kbd.h
new file mode 100644
index 000000000..2eb256233
--- /dev/null
+++ b/xc/programs/Xserver/hw/vfb/lk201kbd.h
@@ -0,0 +1,155 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+/* $TOG: lk201kbd.h /main/3 1998/02/10 13:24:01 kaleb $ */
+
+#define MIN_LK201_KEY 86
+#define MAX_LK201_KEY 251
+#define LK201_GLYPHS_PER_KEY 2
+
+#define KEY_F1 86
+#define KEY_F2 87
+#define KEY_F3 88
+#define KEY_F4 89
+#define KEY_F5 90
+#define KEY_F6 100
+#define KEY_F7 101
+#define KEY_F8 102
+#define KEY_F9 103
+#define KEY_F10 104
+#define KEY_F11 113
+#define KEY_F12 114
+#define KEY_F13 115
+#define KEY_F14 116
+#define KEY_HELP 124
+#define KEY_MENU 125
+#define KEY_F17 128
+#define KEY_F18 129
+#define KEY_F19 130
+#define KEY_F20 131
+#define KEY_FIND 138
+#define KEY_INSERT_HERE 139
+#define KEY_REMOVE 140
+#define KEY_SELECT 141
+#define KEY_PREV_SCREEN 142
+#define KEY_NEXT_SCREEN 143
+#define KEY_KP_0 146 /* key pad */
+#define KEY_KP_PERIOD 148 /* key pad */
+#define KEY_KP_ENTER 149 /* key pad */
+#define KEY_KP_1 150 /* key pad */
+#define KEY_KP_2 151 /* key pad */
+#define KEY_KP_3 152 /* key pad */
+#define KEY_KP_4 153 /* key pad */
+#define KEY_KP_5 154 /* key pad */
+#define KEY_KP_6 155 /* key pad */
+#define KEY_KP_COMMA 156 /* key pad */
+#define KEY_KP_7 157 /* key pad */
+#define KEY_KP_8 158 /* key pad */
+#define KEY_KP_9 159 /* key pad */
+#define KEY_KP_HYPHEN 160
+#define KEY_KP_PF1 161
+#define KEY_KP_PF2 162
+#define KEY_KP_PF3 163
+#define KEY_KP_PF4 164
+#define KEY_LEFT 167
+#define KEY_RIGHT 168
+#define KEY_DOWN 169
+#define KEY_UP 170
+#define KEY_SHIFT 174
+#define KEY_CTRL 175
+#define KEY_LOCK 176
+#define KEY_COMPOSE 177
+#define KEY_APPLE 177
+#define KEY_META 177
+#define KEY_DELETE 188
+#define KEY_RETURN 189
+#define KEY_TAB 190
+#define KEY_TILDE 191
+#define KEY_TR_1 192 /* Top Row */
+#define KEY_Q 193
+#define KEY_A 194
+#define KEY_Z 195
+#define KEY_TR_2 197
+#define KEY_W 198
+#define KEY_S 199
+#define KEY_X 200
+#define KEY_LANGLE_RANGLE 201 /* xxx */
+#define KEY_TR_3 203
+#define KEY_E 204
+#define KEY_D 205
+#define KEY_C 206
+#define KEY_TR_4 208
+#define KEY_R 209
+#define KEY_F 210
+#define KEY_V 211
+#define KEY_SPACE 212
+#define KEY_TR_5 214
+#define KEY_T 215
+#define KEY_G 216
+#define KEY_B 217
+#define KEY_TR_6 219
+#define KEY_Y 220
+#define KEY_H 221
+#define KEY_N 222
+#define KEY_TR_7 224
+#define KEY_U 225
+#define KEY_J 226
+#define KEY_M 227
+#define KEY_TR_8 229
+#define KEY_I 230
+#define KEY_K 231
+#define KEY_COMMA 232 /* xxx */
+#define KEY_TR_9 234
+#define KEY_O 235
+#define KEY_L 236
+#define KEY_PERIOD 237 /* xxx */
+#define KEY_TR_0 239
+#define KEY_P 240
+#define KEY_SEMICOLON 242 /* xxx */
+#define KEY_QMARK 243
+#define KEY_PLUS 245 /* xxx */
+#define KEY_RBRACE 246
+#define KEY_VBAR 247 /* xxx */
+#define KEY_UBAR 249 /* xxx */
+#define KEY_LBRACE 250
+#define KEY_QUOTE 251
diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG
new file mode 100644
index 000000000..8ec24c369
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG
@@ -0,0 +1,8695 @@
+XFree86 3.9.16 (31 August 1999)
+3127. Potential fix for a server crash when connecting from a byte-swapped
+ client in Xinerama mode (based on #3196, Attila Fülöp).
+3126. Build xterm/resize with -lncurses on Debian (#3197, Attila Fülöp).
+3125. Allow inclusion of Xvlib.h into C++ code (#3195, Vladimir Dergachev).
+3124. Modify the ISO-8859-{6,7,10} to Unicode tables so that they agree with
+ the tables found on ftp.unicode.org (#3172, Bruno Haible).
+3123. Some minor C&T bug fixes (#3194, David Bateman).
+3122. Xman update (#3174, Carlos A M dos Santos).
+3021. Import some xkb data file updates from 3.3.5.
+3020. Fix a build problem on Alpha platforms (#3191, Matt Grossman).
+3019. Allow driver SDK builds for the i740 driver (#3190, Daryll Strauss).
+3018. Allow driver SDK builds for the tdfx driver, and allow it to be built
+ without DRI support (#3189, Daryll Strauss).
+
+XFree86 3.9.15d (29 August 1999)
+3017. 3Dfx driver for Banshee and Voodoo3 (#3188,
+ Daryll Strauss/Precision Insight).
+3016. Fix a 24/32 GetImage problem (#3187, Mark Vojkovich).
+3015. Intel i740 driver (#3186, Precision Insight/Daryll Strauss).
+3014. Fix a planemask problem in 24bpp with the recently added MGA point
+ speedups (#3185, Mark Vojkovich).
+3013. Some new and updated ISO 10646-1 fonts, including 5x7, 6x10, 6x13, 6x13B,
+ 7x13, 7x13B, 7x14, 7x14B, 8x13, 8x13B, 9x15, 9x15B, 10x20, 9x18, 12x13ja,
+ 18x18ja (#3184, Markus Kuhn, Robert Brady, Birger Langkjer,
+ Constantine Stathopoulos).
+3012. Update the default xdm config file to disable listening for XDMCP
+ requests (#3183, Matthieu Herrb).
+3011. Reinstate the code to stop DDC1 problems on secondary screens with
+ the MGA driver (#3182, Andrew Aitchison).
+3010. Fix for the option handling in the glide driver (#3181, Henrik Harmsen).
+3009. NVIDIA doc update (#3179, Jarno Paananen).
+3008. Doc update for the C&T driver (#3176, David Bateman).
+3007. Update some of the bindist files (#3175, Michael Rohleder).
+3006. Fix a libXfont build problem that shows up on IUS (#3175,
+ Michael Rohleder).
+3005. Xaw and xedit updates (#3174, 3180, Paulo Cesar Pereira de Andrade).
+3004. Add a new DebuggableLibraries imake parameter to allow libraries to
+ be built with debugging symbols, and enable this by default for Linux
+ (#3173, Bruno Haible).
+3003. Some Driver SDK build fixes (#3172, David Bateman).
+3002. Modify the MGA driver to fall back to DDC1 if DDC2 fails or is
+ disabled (#3171, Andrew Aitchison).
+3001. Allow the -allowMouseOpenFail X server command line option to be
+ recognised independently of the XFree86-Misc extension (#3170, Joe Moss).
+3000. Update NetBSD's and OpenBSD's aperture driver to remove a warning from
+ xf86ReadBIOS() during xf86Config.c's PC98 detection on non-PC98 systems
+ (#3169, Marc La France).
+2999. Disable setting the default gamma from the DDC data (#3168,
+ Andrew Aitchison).
+2998. Update the microtouch input driver for "NEW_INPUT", and re-enable
+ building it (#3178, David Woodhouse).
+2997. Back out the change in 3.9.15c that includes "non-system" resources
+ in the RAC "system" resources list (#3167, Marc La France).
+2996. Update the RELNOTES for DDC (#3165, Andrew Aitchison).
+2995. Fix a problem with xf86ReadBIOS() on NetBSD/OpenBSD (#3164,
+ Marc La France).
+2994. Add an XLC_LOCALE file for zh_TW.Big5 (#3163, Pablo Saratxaga).
+2993. Add dummy Compose files for encodings that don't already have them
+ (#3163, Pablo Saratxaga).
+2992. APM driver updates. The Rush extension is now included in the driver
+ (some files missing, so not enabled yet) (#3162, 3159, Loic Grenie).
+2991. Some fixes for the VidMode extension (#3161, Loic Grenie).
+2990. Update SuperProbe to recognise the APM AT3D chipset (#3160, Loic Grenie).
+2989. Some fixes for the nv driver (#3158, Jarno Paananen).
+2988. Fix a typo in ObjectFromAsmSource() in xf86.rules (#3157,
+ Matthieu Herrb).
+2987. Add some NVIDIA cards to the Cards file (#3155, Jarno Paananen).
+2986. A quick hack to cut down on XAA pixmap cache thrashing that
+ happens with some particular apps (#3154, Mark Vojkovich).
+2985. Update the tabtcvn file to include the full tcvn-5712 encoding, not
+ only lowercase characters (#3153, Pablo Saratxaga).
+2984. Create the doc index list from information in the .sgml files
+ (David Dawes).
+2983. Basic man page for the generic VGA driver (David Dawes).
+2982. Fix for lockup problem with Trident Image 975 (Alan Hourihane).
+
+XFree86 3.9.15c (22 August 1999)
+2981. Update NetBSD.cf to reflect NetBSD's switch from GNU malloc to FreeBSD's
+ malloc (#3151, Bernd Ernesti).
+2980. Change xf86ReadBIOS() to reuse the fd for /dev/mem or /dev/xf86 from
+ the other bsd_video.c functions in order to avoid the difficulty caused
+ by the NetBSD aperture driver only allowing one open of /dev/xf86 at
+ a time (#3150, Matthieu Herrb).
+2979. Add pre-R6.4 compatible entries to the NLS .dir and .alias files. This
+ should make it possible for them to be used with older versions of Xlib.
+2978. Fix a typo in the MGA arc code that broke some arcs (#3149,
+ Mark Vojkovich).
+2977. Fix a problem with cfb allocating too much space on the stack when
+ clipping rects (#3148, Mark Vojkovich).
+2976. Add missing sync when uploading into the XAA pixmap cache (#3147,
+ Mark Vojkovich).
+2975. Change XDGAFlush() to XDGASync() (#3146, Mark Vojkovich).
+2974. Add transparent DGA blits to the MGA driver, and enable the OverclockMem
+ option for the G400 (#3145, Mark Vojkovich).
+2973. Update the common cursor code to keep virtual desktop panning from
+ interfering with screen rotation (#3144, Mark Vojkovich).
+2972. Dynapro driver update: initialise the incoming packet state machine,
+ and add a "SwapXY" option (#3142, David Woodhouse).
+2971. Fix a loader problem that shows up on Alpha/ELF platforms when there
+ is a .sbss section (#3141, Hannes Reinecke).
+2970. Modify DDC for neomagic (#3139, Egbert Eich).
+2969. Add DDC support for the S3 ViRGE (DDC2 untested) (#3139, Egbert Eich).
+2968. Fix DDC2 support for MGA and C&T drivers (#3139, Egbert Eich).
+2967. Add a call to xf86SetPciVideo(NULL,NONE) after each probe (#3139,
+ Egbert Eich).
+2966. Modified registration of the OS access windows (#3139, Egbert Eich).
+2965. Some Xaw and xedit fixes (#3138, Paulo Cesar Pereira de Andrade).
+2964. Next round of the font ansification and warning removal (#3135,
+ Matthieu Herrb).
+2963. Fix ATI 18800-x detection problem (#3133, Marc La France).
+2962. Check for limitations on vertical blending in panel support for the ATI
+ driver (#3133, Marc La France).
+2961. Update ATI driver to complain about bad BIOS data (#3133,
+ Marc La France).
+2960. Man page corrections for the MGA driver (#3132, Mark Vojkovich).
+2959. Limit PCI BIOS apertures to 16MB as per the PCI 2.1 spec (#3131,
+ Marc La France).
+2958. Assume a system has up to 1G of physical memory installed, rather than
+ 2G (#3130, Marc La France).
+2957. Fix a bug in the handling for buggy VGA CRTCs (#3129, Marc La France).
+2956. Fix to build the mga driver with the driver SDK (#3128, David Bateman).
+2955. Xterm patch #113 (#3125, Thomas Dickey).
+2954. Port the XAA cfb copyplane functions, adding them to the cfb code
+ (#3124, 3126, 3127, David Bateman).
+
+XFree86 3.9.15b (15 August 1999)
+2953. Improved point rendering performance for the MGA driver (#3123,
+ Mark Vojkovich).
+2952. Xaw and xedit updates (#3122, Paulo Cesar Pereira de Andrade).
+2951. Remove the Latin2 Type1 fonts.
+2950. Change the RGB mask names in the DGA structures (#3120, Mark Vojkovich).
+2949. More acceleration and bug fixes for the NV driver (#3119,
+ Jarno Paananen).
+2948. Change some things in the XAA color expansion code to facilitate
+ rendering into DMA buffers (#3118, Mark Vojkovich).
+2947. Fix a 64 bit problem with the xf24_32bpp layer (#3117, Mark Vojkovich).
+2946. Modify XF86FlushInput() to work for non-tty devices, which is required
+ for PS/2 mice with Linux 2.2.x kernels (#3114, Kazutaka Yokota).
+2945. Support for rotating the virtual desktop for the MGA driver using
+ the shadowfb (#3113, 3116, Mark Vojkovich).
+2944. Fix a colormap problem with DGA when initialized from an 8+24 mode with
+ the MGA driver (#3112, Mark Vojkovich).
+2943. Fix multihead on the MGA-2164W (#3111, Mark Vojkovich).
+2942. XAA speedups for planar copies in some cases (#3110, Mark Vojkovich).
+2941. Add a driver SDK which performs a similar function to the old LinkKit,
+ but for the loadable server (#3105, David Bateman).
+2940. C&T doc update and xgamma man page update (#3105, David Bateman).
+2939. Add an option to the C&T driver to allow the user to select the
+ transparency key when using the overlay (#3105, David Bateman).
+2938. Add DGA2 support to the C&T driver (#3105, David Bateman).
+2937. Fix a bug in the bitmap font code introduced in 3.9.15a (#3101,
+ Juliusz Chroboczek).
+2936. Some TGA driver cleanups, including a SaveScreen function and code to
+ disallow virtual desktops in a nicer way (#3100, Matt Grossman).
+
+XFree86 3.9.15a (1 August 1999)
+2935. Fix the RAC usage in the nv driver to allow multi-head to work
+ (#3093, Itai Nahshon).
+2934. Reduce memory consumption of the bitmap font backends when using
+ sparse fonts, which is important when using Unicode-encoded fonts
+ (#3092, Juliusz Chroboczek).
+2933. Fix Option register initialisation in multi-head for MGA 2064/2164
+ (#3089, Andrew Aitchison).
+2932. Convert the nv (NVIDIA) driver from 3.3.4 (#3078-3080, 3087,
+ Jarno Paananen).
+2931. Add SuperProbe for NetBSD 1.4 wscons (#3083, Matthias Drochner).
+2930. Fix button and modifier key state problems in DGA (#3082,
+ Mark Vojkovich).
+2929. Avoid a possible segmentation fault in "xsm" which, for example,
+ occurs local hostname can't be resolved (#3073, Matthias Scheler).
+2928. ATI driver updates, including:
+ - Add preliminary panel support.
+ - Rework RAC interface.
+ - PCI VGA's not on primary bus are now detected.
+ - Fix bug when an adapter's VGA has been disabled.
+ - Fix gamma support.
+ (#3069, Marc La France)
+2927. Fix 8514/A pre-defined resource and pre-define VGA sparse I/O resources
+ (#3069, 3081, Marc La France).
+2926. Fix a bug in the registration of background device BIOS'es (#3069,
+ Marc La France).
+2925. Invert the meaning of ResMinimised bit into ResEstimated (#3069,
+ Marc La France).
+2924. Allow drivers to print resource lists, and allow them to enable/disable
+ adapters before creating bus slots for them (#3069, Marc La France).
+2923. Resync SuperProbe and scanpci with 3.3.x (#3069, Marc La France).
+2922. Add some missing man pages for the DGA and VidMode extensions (#3064,
+ Joe Moss).
+2921. Some changes to the DGA and colormap layers to allow gamma changes
+ during DGA mode (#3060, Mark Vojkovich).
+2920. Fix XIM segv error (#3033, 3051, Manabe Takashi).
+2919. Add a client state callback to the DGA extension so that the server side
+ can be cleaned up when a DGA client exits (#3048, 3049, Mark Vojkovich).
+2918. Update the FreeBSD/mouse documentation (#3047, Kazutaka Yokota).
+2917. Fix an undocumented blitter constraint on the G200 (#3046,
+ Mark Vojkovich).
+2916. Fix the MGA driver so that it can support changing depth on the fly
+ in DGA mode. All depths are now offered to DGA clients regardless of
+ what the screen's main depth is (#3045, Mark Vojkovich).
+2915. Fix a bug in the InstallGenManPageLong() rule in lynx.cf (#3043,
+ Thomas Mueller).
+2914. Update ATI doc with info about a VGA/RAC problem (#3044,
+ Andrew Aitchison).
+
+XFree86 3.9.15 (19 July 1999)
+2913. -
+2912. Fix a problem with the library spec in xgc/Imakefile (#3042,
+ Thomas Mueller).
+2911. Add native 69030 support to the C&T driver (#3041, David Bateman).
+2910. Update release notes for the apm driver (#3040, Loic Grenie).
+2909. Fix a small bug in the color expands in the TGA driver (#3039,
+ Matt Grossman).
+2908. Updates for the Japanese (PC98) docs (#3038, Takaaki Nomura).
+2907. Some Xaw and xedit updates (#3037, Paulo Cesar Pereira de Andrade).
+2906. Fix a problem with the VidMode extension (#3036, David Bateman).
+2905. Sample config file for Japanese PC98 architecture (#3035,
+ Takaaki Nomura).
+
+XFree86 3.9Py (18 July 1999)
+2904. Add a visualClass to the XDGAMode request and a XDGACreateColormap
+ request to DGA 2.0 so Colormaps can be created for XDGADevices
+ without needing a corresponding visual (#3032, Mark Vojkovich).
+2903. Update the mmap versions of xf86ReadBIOS() to use a map size that
+ fits the requested BIOS offset and length rather than using a fixed
+ map size (David Dawes).
+2902. Xterm patch #112 (#3031, Thomas Dickey).
+2901. Change the colormap layer's LoadPalette function to take a Visual as
+ an argument rather than just the Visual class (#3030, Mark Vojkovich).
+2900. Add some code to auto-detect Japanese PC98 systems (#3029,
+ Takaaki Nomura).
+2899. Fix a casting problem in DefineSelf() that shows up on FreeBSD/alpha
+ (#3028, Doug Rabson).
+2898. Fix a problem with the GMX2000 DRI support (#3034, Jens Owen).
+2897. Work around a problem in mfb that is caused by an optimiser bug
+ in egcs-1.1.2 for the alpha (#3027, Doug Rabson).
+2896. Fix a problem that shows up in the s3virge driver after the recent
+ vgahw module changes (David Dawes).
+2895. Add missing references to xf86MiscExt.c in common/Imakefile (#3025,
+ Joe Moss).
+2894. Update for the apm driver so that it will work on a Japanese PC-98
+ with GA-RUSH6/PCI(VoodooRUSH based video card) (#3024, Isao Ohishi).
+2893. ISO 10646-1 Japanese font (12x13ja.bdf) that covers a superset of
+ CP1252 and JIS X 208, and which is suitable to be used together with
+ 6x13 for bi-width Japanese text output (#3022, Markus Kuhn).
+2892. Refine the MouseMan+ (PS2++) protocol support (#3020, Kazutaka Yokota).
+2891. Fix problems with the wheels on some mice, including the OEM version of
+ the Logitech FirstMouse+, are not recognized and the mouse cursor jumps
+ around (#3020, Kazutaka Yokota).
+2890. Fix a problem building the X-TT modules on Solaris 7 (based on #3019,
+ David Holland).
+2889. Fix a bug in Xaw/TextAction.c introduced in 3.9Pw (#3018,
+ Paulo Cesar Pereira de Andrade).
+2888. ISO 10646-1 version of the 5x7 and 6x13B fonts, and an update for the
+ 6x13 font (#3017, Markus Kuhn).
+2887. First part of the ansification of xc/lib/fonts. So far the bitmap,
+ fc and fontfile directories have been done (#3016, Matthieu Herrb).
+2886. Fix default PC98 XKB setting (#3015, Akio Morita).
+2885. Remove the reference to VGADriverDoc in xfree86/Imakefile (#3015,
+ Takaaki Nomura).
+2884. Fix a bug in Xaw/TextPop.c (#3014, Paulo Cesar Pereira de Andrade).
+2883. Man page update for xfontsel (#3013, Paulo Cesar Pereira de Andrade).
+
+XFree86 3.9Px (12 July 1999)
+2882. Updates to get XF86Setup to build again after the NewInput-related
+ changes, and have XF86Setup print a short message stating that it
+ isn't usable before exiting (#3012, Joe Moss).
+2881. Fix some compiler warnings in lib/Xext (#3011, Matt Grossman).
+2880. Fix a bug in the wacom driver that shows up when multiple wacom devices
+ don't report the same valuators (#3010, Frederic Lepied).
+2879. Some updates to the PCI/RAC code (#3008, Egbert Eich).
+2878. Fix the acute and apostrophe mixup in the German xkb layout with the
+ nodeadkey option, and add the EuroSign to AltGr+e (#3006, Markus Kuhn).
+2877. Add code to the mga driver to handle PC98 architecture machines
+ (#3007, Takaaki Nomura).
+2876. Add a global (ServerFlags) "PC98" Option for the Japanese PC98
+ architecture, and add a function xf86IsPc98() that drivers can call
+ to check for this.
+2875. Fix a relocation problem in the ELF loader that shows up on 64-bit
+ platforms when mapping unresolved symbols to LoaderDefaultFunc()
+ (#3005, Doug Rabson).
+2874. Remove the original text version of the DESIGN doc from hw/xfree86.
+2873. Fix a glyph padding problem in XAA's nonTE text code that shows up on
+ 64-bit platforms (Doug Rabson).
+2872. Rework the wacom driver's init phase (#3004, Frederic Lepied).
+2871. Add a 19200 speed option to the wacom driver for Airbrush tablets
+ (#3004, Frederic Lepied).
+2870. Add support for transparent stipples to the tga driver (#3003,
+ Matt Grossman).
+2869. Modify xfontsel to not show scaled fonts by default (#3002,
+ Paulo Cesar Pereira de Andrade).
+2868. Some notes about xterm for the release notes (#3001, Thomas Dickey).
+2867. Some Xaw, Xmu and xedit updates (#2999, 3002,
+ Paulo Cesar Pereira de Andrade).
+2866. Xterm patch #111 (#2998, Thomas Dickey).
+2865. Fix a "NoAccel" problem with the PM2 video support (#2997,
+ Michael Schimek).
+2864. Update for lynx.cf (#2995, Thomas Mueller).
+2863. Fix a LynxOS macro clash with the cirrus driver, and fix a
+ xf86UnmapVidMem() warning in the cirrus driver (#2995, Thomas Mueller).
+2862. Fix a problem on LynxOS where assert is unresolved in the static server
+ (#2995, Thomas Mueller).
+2861. Fix a problme with vsnprintf being unresolved when building Xvfb
+ and Xnest on some platforms (#2995, Thomas Mueller).
+2860. Remove the s3virge fifo_ changes introduced in 3.9Pu, update the
+ DGA2 support and docs (#2994, Kevin Brosius).
+2859. Initial attempt to get the XFree86-Misc again (#2993, Joe Moss).
+2858. Remove XAASync() (#2992, Rik Faith).
+2857. Cleanup the TGA driver's hw cursor code, remove global variables in
+ in the "accel" files, and fix up the RAC support (#2991, Matt Grossman).
+2856. Add partial support for color expands to the 8-bit TGA driver (#2991,
+ Matt Grossman).
+2855. Re-enable DDC2 support in the MGA driver (#2989, Andrew Aitchison).
+2854. Add missing TIOC defines for Interactive Unix to xf86_OSlib.h (#2990,
+ Michael Rohleder).
+2853. Don't register the Xqueue mouse handler for Interactive Unix (#2990,
+ Michael Rohleder).
+2852. Don't include sys/mman.h in cidchar.c when USE_MMAP isn't defined
+ (#2990, Michael Rohleder).
+2851. Disable BuildXF86DRI and BuildXF86DRIDriverSupport for Interactive Unix
+ (#2990, Michael Rohleder).
+2851. Update the apm (Alliance ProMotion) driver (#2987, 2988, Loic Grenie).
+2850. Fix a problem with the xf86config screen configuration that was
+ introduced with the removal of "32bpp" (#2986, Matthieu Herrb).
+2849. Add a DefaultDepth configuration page to xf86config (#2986,
+ Matthieu Herrb).
+2848. Add the inputDevice examples from XF86Config.eg to config files
+ generated by xf86config (#2986, Matthieu Herrb).
+2847. Modify the vgahw module to allow it to save/restore more than the
+ standard number VGA CRTC, Sequencer, Graphics and Attribute registers
+ (2985, 2996, Jeff Garzik).
+2846. Add DDC information to the release notes (#2984, Andrew Aitchison).
+2845. Change XDGAChangePixmapMode to return the X-Y position of the pixmap
+ in case the server is not able to place it exactly where requested
+ (#2983, Mark Vojkovich).
+2844. Fix some problems with unfavorable alignment of XAA offscreen pixmap
+ (#2982, Mark Vojkovich).
+2843. Some XAA speedups for NonTE text in certain cases (#2981,
+ Mark Vojkovich).
+2842. Rename the assembler files that need preprocessing from .s to .S,
+ and adjust the imake rules accordingly.
+2841. A fix for xf86PciReadBios() (#2979, Egbert Eich).
+2840. Fix a problem with false detection of multi-function PCI devices (#2978,
+ Loic Grenie).
+2839. Fix a problem with libXfont.a not being linked into exports/lib during
+ the build phase (#2977, Thomas Mueller, 2990, Michael Rohleder).
+2838. Deal with OSes which don't have TIOCM ioctls in posix_tty.c (#2976,
+ Thomas Mueller).
+2837. Fix the use of TIOCM_ in some calls to xf86SerialModem..() in mouse/pnp.c
+ (#2976, Thomas Mueller).
+2836. Enable NEW_INPUT on LynxOS (#2976, Thomas Mueller).
+
+XFree86 3.9Pw (6 July 1999)
+2835. Fix for GetBlock() (#2974, Egbert Eich).
+2834. Remove the test for SHAREDIOCLASS when creating a pciAccessInfoRec for
+ a device (#2974, Egbert Eich).
+2833. Modified BIOS ROM handling, doing validation only on demand (#2974,
+ Egbert Eich).
+2832. Add a ChangeGamma function to the ScrnInfoRec, which allows drivers to
+ optionally provide a function to do this instead of the default one
+ provided by the colormap layer (#2972, Mark Vojkovich).
+2831. Sis driver memclock fixes (#2971, Bart Oldeman, Juanjo Santamarta).
+2830. Add snprintf() and vsnprintf() to libc emulation (#2970, Marc La France).
+2829. Increase array size in PciInfo data (#2970, Marc La France).
+2828. Add a LoaderRefSymbols() function (#2970, Marc La France).
+2827. When matching fixed clocks, prefer non-CLKDIV2 modes over CLKDIV2 modes
+ (#2970, Marc La France).
+2826. Reinstate xf86GetPciConfigInfo() and some warning fixes (#2970,
+ Marc La France).
+2825. Build libXext and libX11 client-side libraries when also building
+ GLX, despite BuildServersOnly (#2970, Marc La France).
+2824. Update ATI doc (#2970, Marc La France).
+2823. ATI driver from 3.3.3.1 (rac interface is preliminary, no LCD panel
+ or Rage 128 support yet) (#2970, Marc La France).
+2822. Fix Ukrainian_GHE_with_upturn double definition error (#2969,
+ Peter Novodvorsky).
+2822. Updates to the xf86config utility for the 4.0 config file format
+ (#2968, Matthieu Herrb).
+2821. Add default rules to allow easy compilation of .c files to assembler.
+
+XFree86 3.9Pv (4 July 1999)
+2820. Add a marked up (SGML) version of the DESIGN doc (David Dawes).
+2819. Remove the Alpha-specific Linux libc6 parts in linux.cf.
+2818. Add a "defs.ent" file for defining SGML entities that can be shared by
+ other docs (David Dawes).
+2817. Import the mouse.sgml doc from 3.3.x, and update it for 4.0.
+2816. Remove support for the very old LinuxDoc tools.
+2815. Use SpecialCObjectRule() in favour of SpecialObjectRule().
+2814. Fix lots of 64-bit problems in XAA (#2967, Mark Vojkovich).
+2813. Add a new DGA request to allow switching the DGA pixmap from one the
+ size of the framebuffer to one the size of the viewport that you
+ can move around (#2966, Mark Vojkovich).
+2812. Make sure that all Xinerama heads have the same root window depth,
+ and don't advertise backing store or save unders as being available
+ unless it's available on all heads (#2965, Mark Vojkovich).
+2811. Some Xaw and xedit updates (#2964, Paulo Cesar Pereira de Andrade).
+2810. Some DRI updates (#2962, Rik Faith).
+2809. Fix a double-free problem in the mouse driver (#2959, Egbert Eich).
+2808. Add some debugging code to xalloc.c to detect and allow trapping of
+ double xfree() calls (#2954, Egbert Eich).
+2807. Add Single GLINT MX support for Direct Rendering, which now allows
+ ELSA Gloria XXL to take part in this (#2592, 2955, 2957, 2958,
+ Alan Hourihane and #2960, Rik Faith).
+2806. Add ScanlineCPU function to the glint driver for PM2 when pci
+ retries aren't used (#2952, Alan Hourihane).
+2805. Use mediumraw keyboard mode for LinuxPPC (#2946, Gerd Knorr).
+2804. Xterm patch #110 (#2943, Thomas Dickey).
+2803. Add CyberBlade/i7 (Socket 7), CyberBlade/i7 DSTN (Laptop Socket 7) and
+ CyberBlade/i1 (Slot 1) support to the trident driver (#2940,
+ Alan Hourihane).
+2802. Some new PCI ids for Cyberblades and Via MVP4 (#2939, Alan Hourihane).
+2801. Replace `__volatile__' in xf86drm.h with `volatile' (#2938,
+ Takaaki Nomura).
+2800. Fix a problem with the umask not being reset in some cases in the
+ xtrans code (#2936, Bill Nottingham).
+2799. Improve the latency associated with writing to the PCI config space,
+ which is important for RAC to work efficiently (Egbert Eich).
+
+XFree86 3.9Pu (27 June 1999)
+2798. Xterm patch #109 (#2920, Thomas Dickey).
+2797. Xaw and xedit updates (#2932, 2933, Paulo Cesar Pereira de Andrade).
+2796. Make the "fifo_conservative" memory settings default for the s3virge
+ accelerator (#2931, Kevin Brosius).
+2795. Preliminary DGA2 code for the s3virge driver (#2931, Kevin Brosius).
+2794. Updates to PI's DRI sample implementation, including:
+ - Dynamic loading of the OpenGL client driver is implemented
+ - 3D client death while holding the drawable lock does not cause deadlock
+ - The kernel module works with Linux 2.2.x [x <= 10] and 2.3.y [y <= 8]
+ - A better authentication mechanism has been implemented
+ - XF86Config options for the DRI are supported
+ (#2929, Precision Insight).
+2793. Add functions to the FBManager to query the largest size available and
+ to purge all areas that aren't nailed down (#2928, Mark Vojkovich).
+2792. Fix some serious performance problems with Xinerama when the number
+ of resource IDs becomes large (#2927, Carsten Haitzler).
+2791. Remove the significant RGB bits check from Xinerama visual eliminations
+ (#2926, Mark Vojkovich).
+2790. Fix a typo in xmodmap and xstdcmap (#2924, Matthieu Herrb).
+2789. Fix the type of the OverclockMem Option in the MGA driver (#2922,
+ Andrew Aitchison).
+2788. Fix PCI resource handling problems that were showing up with the
+ glint driver (#2918, Egbert Eich).
+2787. Fix a problem building some Makefiles when JoystickSupport is enabled
+ (#2917, Todd Fries).
+2786. Fix a typo in the RAC support for the glint driver (#2915, Jens Owen).
+2785. Fix a RAC-related build problem on 64-bit machines (#2913,
+ Matt Grossman).
+2784. Some afb-related updates (#2911, Sven Luther).
+2783. Fix race condition in xinit (Nate Eldredge, Mark Montague).
+2782. Documentation for the new RAC code (Egbert Eich).
+2781. Fix some problems with the glide driver that can result in server crashes
+ if there is a problem when it is starting up (David Dawes).
+2780. Install the X server signal handlers before xf86OpenConsole is first
+ called. This makes sure that the VT is returned to text mode if the
+ server crashes in the early stages of InitOutput() (David Dawes).
+2779. Fix xf86vsprintf() and xf86vfprintf().
+2778. Support for the different PLL reference clock used for HP's on-board
+ G200s.
+2777. Disable building the Xanti extension (Mark Vojkovich).
+2776. Update the log file handling to catch most messages that are generated
+ before the log file is actually opened (David Dawes).
+2775. Another fix for PM2 text restoration (Egbert Eich).
+
+XFree86 3.9Pt (20 June 1999)
+2774. First cut at converting the fbdev, sis, glide, neomagic and rendition
+ drivers for the new RAC code (David Dawes).
+2773. Fix a PM2 lockup problem during GLINTSave, and fix a text mode font
+ corruption problem (#2907, Egbert Eich).
+2772. Xterm patch #108 (#2906, Thomas Dickey).
+2771. Fix a problem with duplicate ShmCompletion events in Xinerama mode
+ (#2905, Mark Vojkovich).
+2770. Add a XDGAKeyEventToXKeyEvent helper function to the DGA client library
+ (#2904, Mark Vojkovich).
+2769. Fix some incorrect XAA GC validation checks (#2903, Mark Vojkovich).
+2768. Fix some XAA caching problems with shared memory pixmaps (#2903,
+ Mark Vojkovich).
+2767. Wait for the fifo to clear out in the mga driver before returning to
+ the client after any cpu->screen color expansion or image writes (#2901,
+ Mark Vojkovich).
+2766. Don't use the BIOS info for the MGA G400 since we don't understand
+ the format (#2901, Mark Vojkovich).
+2765. Fix some MGA bitblit problems when more than 16MB of memory is being
+ used (#2901, Mark Vojkovich).
+2764. Set memory clocks to the bios defaults in the MGA driver, and add an
+ Option "OverclockMem" to allow the previous settings to be used (#2901,
+ Mark Vojkovich).
+2763. Xaw and xedit updates (see lib/Xaw/Changelog) (#2899,
+ Paulo Cesar Pereira de Andrade).
+2762. Ansification and warning elimination in lib/xtrans (#2896,
+ Matthieu Herrb).
+2761. Fix a glint scanline interleave bug introduced by the change in
+ device scaning order in the new RAC code (#2890, Jens Owen).
+2760. Fix a dual head Xinerama crash that happens when running the xv program
+ (#2889, Itai Nahshon).
+2759. Add v4l Xv support to the trident driver (#2877, Alan Hourihane).
+2758. Trident Image series and standard chipset acceleration fixes (#2877,
+ Alan Hourihane).
+2757. Add more Blade3D acceleration to the trident driver (#2877,
+ Alan Hourihane).
+2756. Fix for DPMS with the new RAC (Itai Nahshon).
+2755. RAC updates, including changing the way PCI resource validation works
+ (Egbert Eich).
+2754. Update the TGA driver for the new RAC (#2886, Matt Grossman).
+2753. Fix a fatal event problem with DGA 2.0 (#2884, Mark Vojkovich).
+2752. Fix some macros in xf86str.h that conflict with system headers on some
+ platforms (#2883, 2888, 2902, Matt Grossman).
+
+XFree86 3.9Ps (14 June 1999)
+2751. Some small RAC updates (Egbert Eich).
+2750. Direct Rendering Infrastructure from Precision Insight (#2871).
+2749. Fix a problem building xedit on SVR4.0 (missing strcasecmp).
+
+XFree86 3.9Pr (13 June 1999)
+2748. Xterm patch #107 (#2879, Thomas Dickey).
+2747. Cirrus driver updates, including support for generic (V4L) video
+ adapters, fix depth 15 mode for the laguna chips and turn of the DAC
+ when blanking the screen (#2878, Itai Nahshon).
+2746. Fix problems with the build of the 6.1-compatible Xaw shared library,
+ and some optimizations and bug fixes for the Xaw and xedit (#2877,
+ Paulo Cesar Pereira de Andrade).
+2745. Add functions (CreateFontRec and DestroyFontRec) for allocating and
+ freeing FontRecs rather than having the size encoded in all of the
+ renderer modules. Also, change the font private index handling to
+ make all indices show up in all FontRecs (#2873, Mark Vojkovich).
+2744. Add ANSI prototypes for lib/XIE (#2870, Thomas Dickey).
+2743. Some preliminary work on adding afb support to the fbdev driver (#2869,
+ Sven Luther).
+2742. Change the semantics of xf86ReadPciBIOS() to allow it to temporarily
+ map an unmapped BIOS at the address assigned to another of the card's
+ base address registers, and modify the MGA driver to make use of this
+ (David Dawes).
+2741. Add some functions to the common layer to allow drivers to register
+ input handling functions, and modify the pm2_video code to make use of
+ this instead of the XInput code (David Dawes).
+2740. Trap for packed 24bpp on systems with 64-bit scanlines.
+2739. Fix the type of the "set_mckl" option in the s3virge driver (#2865,
+ Harald Koenig).
+2738. Fix some s3virge palette problems in 8bpp mode (#2863, Harald Koenig).
+2737. Avoid clobbering CR55 in the s3virge HW cursor code (#2862,
+ Harald Koenig).
+2736. Xterm patch #106 (#2861, Thomas Dickey).
+2735. Fix an incorrect test in I2CWriteBytes() in the i2c module (#2875,
+ Ben Cahill).
+2734. Don't set YDSTORG for the non-WRAM Matrox cards (#2874, Mark Vojkovich).
+2733. Change the order of text-mode font restoration in the vgahw module
+ (#2872).
+2732. XInput driver for Dynapro touch screens (#2859, 2860, 2867,
+ David Woodhouse).
+2731. Enable support for extended PS/2 protocols on Solaris/x86 (#2857,
+ Nicholas Brealey).
+2730. Fix the ZAxisMapping handling in the mouse driver (#2857,
+ Nicholas Brealey).
+2729. Add a sixth valuator to the wacom driver to support the wheel of
+ the airbrush and of the lens cursor (Frederic Lepied).
+2728. Convert the wacom driver to work with the new input code
+ (Frederic Lepied).
+2727. Increase the MAXSCREENS value from 4 to 16 (Egbert Eich).
+2726. Add support to scanpci for printing out PCI-PCI bridge header
+ information correctly (Egbert Eich).
+2725. New RAC (Resource Access Control) code (Egbert Eich).
+2724. Update the Solaris/x86 version of xf86ReadBIOS() to handle BIOSs located
+ at high physical addresses (David Dawes).
+2723. An attempt at allowing the server to correct the /tmp/.X11-unix
+ directory when it is possible to do so safely (David Dawes).
+2722. Re-enable screen->screen blts for the Trident Image3D, and fix a problem
+ with mapping/unmapping memory with VT switching (David Dawes).
+2721. Fix a problem linking with libXfont when building the shared version
+ is disabled (David Dawes).
+2720. Fix an Xlib problem introduced in 3.9Pq that shows up when X_LOCALE
+ is defined (David Dawes).
+
+XFree86 3.9Pq (6 June 1999)
+2719. Change the parser's error message printing so that they will end
+ up in the log file (David Dawes).
+2718. Add support for armscii-8, ibm-cp1133, mulelao-1, viscii1.1-1,
+ tcvn-5712, georgian-academy, georgian-ps (not all complete yet)
+ (#2843, Pablo Saratxaga).
+2717. Some fixes for the v4l driver that make it keep track of the video
+ state correctly (#2854, Gerd Knorr).
+2716. Xterm patch #105 (#2853, Thomas Dickey).
+2715. Add defines to the Xaw code to make it possible to build a version
+ of the shared library that is binary compatible with the standard 6.1
+ version (#2849, Paulo Cesar Pereira de Andrade).
+2714. Xedit updates (see the Xaw Changelog for details) (#2849,
+ Paulo Cesar Pereira de Andrade).
+2713. Bump the Xaw library major version (now 7.0), and enable the Xpm
+ dependency by default (#2849, Paulo Cesar Pereira de Andrade).
+2712. Fix an Xmu build warning (#2849, Paulo Cesar Pereira de Andrade).
+2711. Some updates to the XAnti extension (#2851, 2852, Mark Vojkovich).
+2710. Update the scanline width choices used in the MGA driver to better
+ match the capabilities of the different chips (#2850, Mark Vojkovich).
+2709. Add G400 support to the MGA driver (#2850, Mark Vojkovich).
+2708. Resync SuperProbe with 3.3.3.1e, and add ATI Rage XL & XC detection
+ (#2847, Marc La France).
+2707. Fix for drivers/v4l/README (#2846, David Woodhouse).
+2706. Fixes for the big5.eten-0 and gb2312.1980-0 encoding files (#2840, 2841,
+ 2846, Juliusz Chroboczek).
+2705. Use 8-bit I/O instead of 16-bit I/O in xf4bpp (better for older
+ adapters), and some cleanups (#2838, Marc La France).
+2704. Fix RGB "masks" for depth <=8, and fix the formatting of the "Clocks"
+ messages (#2838, Marc La France).
+2703. Remove assumption that PCI systems contain PCI video (#2838,
+ Marc La France).
+2702. Add missing parsing of the ZAxisMapping option to the revised mouse
+ driver (David Dawes).
+2701. Add a simple verification check for core-capable input devices
+ (David Dawes).
+2700. Update the serial PnP mouse support for the revised mouse driver
+ (David Dawes).
+
+XFree86 3.9Pp (30 May 1999)
+2699. Xterm patch #104 (#2836, Thomas Dickey).
+2698. Doc updates for the s3virge driver, and cleanup register debugging
+ printouts (#2835, Kevin Brosius).
+2697. Rework the config file search algorithm, and allow "safe" relative
+ paths to be specified by non-root users (David Dawes).
+2696. Close input devices while VT switched away (David Dawes).
+2695. Prevent the input device "PreInit" from being called in subsequent
+ server generations (David Dawes).
+2694. Handle the Keyboard config information as an InputDevice section
+ (but the keyboard driver isn't converted yet) (David Dawes).
+2693. Add basic accessEnable calls to the Tseng driver so that it will at
+ least work single head with an ET6000 (David Dawes).
+2692. Fix Xinerama bugs related to the Shape extension (#2832, Mark Vojkovich).
+2691. Separate the pitch and virtual X increments (#2829, Marc La France).
+2690. Add some large encoding files for the `fontenc' layer (#2827,
+ Juliusz Chroboczek).
+2689. A rewrite of the way Xinerama handles visuals (#2824, Mark Vojkovich).
+2688. Integrate the pointer acceleration patch from Kevin Brown (#2823,
+ Frederic Lepied).
+2687. Make button mapping work for XInput "AlwaysCore" devices (#2823,
+ Frederic Lepied).
+2686. Fix xtest failure with SiS TwoPointLine (#2821, Juanjo Santamarta).
+2685. Xlib support for KOI8-U (#2820, Aleksey Novodvorsky).
+2684. Fix a problems with the new mouse code looping by adding CLOCAL to
+ the standard termios flags for xf86OpenSerial() (#2819, Matthieu Herrb).
+2683. New font document (#2818, Juliusz Chroboczek).
+2682. Fix the reworked "wsmouse" code for NetBSD (#2815, Matthieu Herrb).
+2681. Fix for `resize' on OpenBSD (#2814, Matthieu Herrb).
+2680. Add the `s' flag to ArCmd and ArAddCmd for SVR4 so that empty archives
+ can be created (#2813, Nicholas Brealey).
+
+XFree86 3.9Po (23 May 1999)
+2679. Enable the new input code (NewInput) by default in xfree86.cf
+ (David Dawes).
+2678. Add compatibilty support for interpreting "Pointer" sections as
+ "InputDevice" sections in the reworked input device code (David Dawes).
+2677. Modify mkfontdir to handle duplicate encodings in a reasonable way
+ when generating the encodings.dir file (#2812, Juliusz Chroboczek).
+2676. Xaw and xedit updates (see lib/Xaw/Changelog for details) (#2811,
+ Paulo Cesar Pereira de Andrade).
+2675. Fix xinerama problems with clipmasks and stipple/tile offsets
+ in GCs used on the root window (#2810, Mark Vojkovich).
+2674. Fix problems uploading to the pixmap cache in 8+32 mode when
+ ImageWrites aren't available (#2809, Mark Vojkovich).
+2673. Ansify the Xv client library (#2808, Mark Vojkovich).
+2672. Add a XvQueryPortAttributes request to the Xv API/protocol and
+ driver interface, with an example in the v4l driver, and update the
+ documentation (#2808, Mark Vojkovich).
+2671. Fix some compiler warnings in the oldX and ICE libraries (#2807,
+ Matt Grossman).
+2670. Fix a problem with the Type1 font handling that was introduced when the
+ CID support was added (#2805, Ivan Bach).
+2669. Wacom driver update, including a fix for initialization problems with
+ Wacom IV devices, and improved Wacom V device support (Lens cursor
+ support) (#2803, Frederic Lepied).
+2668. Fix for some 8+32 xinerama problems (#2802, Mark Vojkovich).
+2667. Xkb fixes for PC98 (#2800, Akio Morita).
+2666. Xkb data files for a Macintosh keyboard (#2798, Sven LUTHER).
+2665. Some preliminary support for the "new" mouse driver for most OSs
+ (David Dawes).
+2664. Prevent xf86LogInit() being called for subsequent server generations.
+
+XFree86 3.9Pn (16 May 1999)
+2663. Add a SetClientVersion request to the DGA extension (David Dawes).
+2662. Change DGA initialisation ordering in the MGA driver (#2796,
+ Mark Vojkovich).
+2661. Turn off DGA pixmaps in xinerama since it insists on duplicating
+ the rendering protocol on all heads despite the DGA pixmaps existing
+ only on a single head (#2795, Mark Vojkovich).
+2660. Fix some xinerama problems with 8+32 overlays (#2795, Mark Vojkovich).
+2659. Add XAA acceleration for DGA pixmaps (#2795, Mark Vojkovich).
+2658. Add PCI IDs for new NVIDIA chipsets (#2794, Mark Vojkovich).
+2657. Change the default cursor colour in the app-defaults for editres
+ (#2793, Paulo Cesar Pereira de Andrade).
+2656. Xedit updates, including a new Xedit-color.ad file, to show some of
+ the new features of Xaw, and some improvements to the ispell interface
+ (#2793, Paulo Cesar Pereira de Andrade).
+2655. Xaw updates, including some fixes, optimizations, and additional
+ documentation (#2793, Paulo Cesar Pereira de Andrade).
+2654. Working mouse support with the new input device code (David Dawes).
+2653. Fix for sysv_video.c on Interactive UNIX (#2792, Michael Rohleder).
+2652. Fix handling of xkbcomp's -I flag (Stanislav Meduna).
+2651. CID updates (third submission) (#2769, Ivan Bach, SGI).
+2650. Kludge to allow a server with the glint driver to link without XInput
+ (#2788, Marc La France).
+2649. Remove unused dacSpeeds field from the ScrnInfoRec (#2788,
+ Marc La France).
+2648. Add an option to the colourmap code to allow a driver's LoadPalette()
+ to be called even when switched out (#2788, Marc La France).
+2647. Add more reasons for rejecting a mode (#2788, Marc La France).
+2646. Factor in the log verbosity when reporting the verbosity to a driver
+ (#2788, Marc La France).
+2645. Allow xf86GetClocks() to be called with NULL ProtectRegs() and
+ BlankScreen() functions (#2788, Marc La France).
+2644. When deleting a screen, also free its mode lists and options (#2788,
+ Marc La France).
+2643. Allow a driver to determine if -probeonly was specified (#2788,
+ Marc La France).
+2642. Fix a large jump in changelog numbering that happened a little while
+ ago (#2788, Marc La France).
+2641. Various warning and include fixes (#2788, Marc La France).
+2640. Xterm patch #103 (#2786, Thomas Dickey).
+2639. SiS driver updates, including fixing the SetMClk option, change solid
+ lines from bresenham to two-point, correct a clippling bug, and change
+ the verbose level of some messages (#2784, 2785, Juanjo Santamarta).
+2638. Fix a server loop that can happen when VT switching while a grab is
+ in progress (#2782, Edward Wang).
+2637. Xterm patch #102 (#2778, Thomas Dickey).
+2636. Fix some spelling errors in Xlib.h (#2775, Itai Nahshon).
+2635. Add auto-detection of Debian to imake (#2774, Sven Luther).
+2634. SiS driver updates, including turning on solid line acceleration,
+ remove GXCOPY_ONLY for Mono8x8 patterns, change mmio pointers to
+ volatile to avoid optimization problems, use xaarop.h, fix offscreen
+ memory init to avoid exceeding the accelerator's address range
+ (#2772, Alan Hourihane).
+2633. Fix build problems with the v4l driver on some systems (based on #2771,
+ Gerd Knorr, and a suggestion from David Woodhouse).
+2632. Xterm patch #101 (#2770, Thomas Dickey).
+2631. Fix some more Xinerarma bugs (#2766, 2768, Mark Vojkovich).
+2630. Fix the use of va_lists in the logging code (David Dawes).
+
+XFree86 3.9Pm (9 May 1999)
+2629. Clean up the handling of Alphas in the s3virge driver (#2767,
+ Matt Grossman).
+2628. Fix a problem that can show up when a module is unloaded while another
+ module has unaccounted for references to its symbols (Egbert Eich).
+2627. -
+2626. Finish DGA event support (#2765, Mark Vojkovich).
+2625. Xaw updates (including compatibility updates and a man page), xedit
+ and editres updates (#2764, Paulo Cesar Pereira de Andrade).
+2624. Disable MIT-SHM in Xnest since it doesn't work (#2763, Wolfram Gloger).
+2623. Add hw clipping for the SiS 6326, and solid lines (disabled) (#2760,
+ Juanjo Santamarta).
+2622. Cirrus driver updates (#2759, Itai Nahshon).
+2621. Fix complier warnings in lib/X11 (#2758, Matt Grossman).
+2620. Fix complier warnings in lib/Xau (#2757, Matt Grossman).
+2619. Update some of the font encoding translation files (#2756,
+ Juliusz Chroboczek).
+2618. Fix some bugs in the font encoding support (#2756, Juliusz Chroboczek).
+2617. Update the Arabic24 BDF font to version 1.3 (#2754, Mark Leisher).
+2616. Xterm patch #100 (#2753, Thomas Dickey).
+2615. A start at the unification of input devices (David Dawes).
+2614. Change the MGA ImageWrite code to not use the image transfer window
+ for simple cpu->framebuffer copies (#2738, Mark Vojkovich).
+2613. Add lseek and bsearch to the libc wrappers (and fix fseek), as needed
+ by the CID font code.
+2612. Add missing file for CID fonts support, and fix a few module-related
+ thing with it.
+
+XFree86 3.9Pl (3 May 1999)
+2611. Fix Xinerama bugs in GetImage and PolyRectangle (#2751, Mark Vojkovich).
+2610. Xterm patch #99 (#2750, Thomas Dickey).
+2609. Disable unneccessary C&T message (#2748, Nozomi Ytow).
+2608. Add some DGA event support (not working yet) (#2747, Mark Vojkovich).
+2607. Xaw and xedit updates including some compatibility updates and
+ performance improvements (#2746, Paulo Cesar Pereira de Andrade).
+2606. Modify mkfontdir to create "encodings.dir" files (#2745,
+ Juliusz Chroboczek).
+2605. Update the DESIGN doc for the new DGA driver interface (#2744,
+ Mark Vojkovich).
+2604. Update the LynxOS vidmem code to use the new shared vidmem.c (#2743,
+ Thomas Mueller).
+2603. -
+2602. Update TGA docs (#2737, Matt Grossman).
+2601. Fix a zero width problem that shows up in xaaSpans.c when hardware
+ clipping is enabled (#2736, Alan Hourihane).
+2600. Add support for Adobe CID fonts (#2728, Ivan Bach, SGI).
+2599. Quick fix for cirrus driver problem introduced in 3.9Pk.
+2598. Fix a problem with pcitweak that was preventing it from working with
+ buses other than bus 0 (David Dawes).
+2597. Update xfontsel to display appropriate glyphs for ISO10646 fonts
+ (Mark Leisher).
+2596. Add support for building XF86Setup with ncurses on NetBSD and OpenBSD
+ (#2734, Matthieu Herrb).
+2595. Fix vidmem map/unmap mismatch in the TGA driver (#2733, Matt Grossman).
+2594. A minor interlace improvement for the PM2 Xv driver (#2731,
+ Michael Schimek).
+2593. Fix color expansion bug in the SiS driver (#2729, Juanjo Santamarta).
+2592. Major resync for OS/2 (#2727, 2732, 2735, Holger Veit).
+2591. Xterm patch #98 (#2726, 2730, Thomas Dickey).
+2590. Fix a build V4L driver build problem (#2725, David Woodhouse).
+2589. Xterm patch #97 (#2724, Thomas Dickey).
+2588. Move the VTInit and VTSysReq keywords from the Keyboard section to
+ the ServerFlags section (as options) (David Dawes).
+2587. Remove the legacy ServerNumLock and "RightAlt", etc special key mapping
+ support (David Dawes).
+2586. Add a new, more complete version of snprintf, vsnprintf for OSs that
+ don't have it. This one is based on the "SIO" stdio-like package
+ (David Dawes).
+2585. Add log file support, including separate log and stderr streams, and
+ separate verbosity levels for each stream. Changed the -verbose option
+ to accept an optional integer argument that specifies the verbosity
+ level, add a -logverbose option and a root-only -logfile option
+ (David Dawes).
+2584. Unify the "Overlay" options and "SetMclk" options, and remove the
+ SetMClk Device section keyword (David Dawes).
+2583. Add a "frequency" option value type for use with options processed
+ by xf86ProcessOptions(). This value type consists of a floating point
+ number optionally followed by "Hz", "kHz" or "MHz" (David Dawes).
+
+XFree86 3.9Pk (25 April 1999)
+2582. Move the SVR4-specific handling of mapping memory areas which have
+ read side-effects out of the drivers and into the os-support layer
+ (David Dawes).
+2581. Fix unmap parameters for the SiS driver (David Dawes).
+2580. Fix unmap parameters for the glint driver (#2722, Alan Hourihane).
+2579. Fix the depth 24 visual initialisation (mask, offset) in the
+ Rendition driver (#2720, Martin Cerveny).
+2578. Rework the use of inb/outb in the trident driver, replacing it with
+ MMIO. Also, don't use the 0xBF000 range for the accelerator registers
+ (#2719, Alan Hourihane).
+2577. Add a -screen option to the xgamma utility so that the gamma of each
+ screen can be changed in Xinerama mode (#2717, Mark Vojkovich).
+2576. Fix all the known problems with the ispell support in xedit (#2716,
+ Paulo Cesar Pereira de Andrade).
+2575. Xaw updates, including improved speed for FindPiece in AsciiSrc.c,
+ add submenu support to the SimpleMenuWidget, add support for text
+ justification to the TextWidget, add an overwrite mode to the
+ TextWidget, make the TextWidget understand negative "multiply" values,
+ add an indent action to the TextWidget, fix a bug in the undo code
+ (#2716, 2721, Paulo Cesar Pereira de Andrade).
+2574. Pcitweak fix for LynxOS, and define NO_MMAP for pre 2.5.0 LynxOS
+ releases (#2715, Thomas Mueller).
+2573. Fix for cirrus hardware cursor on (big endian) PowerPC platform
+ (#2715, Thomas Mueller).
+2572. Experimental DDC support for the Matrox "G" series cards (#2713,
+ Andrew Aitchison).
+2571. Fix a crash in the XAA fill code that happens when
+ Mono8x8PatternFillFlags is set only to HARDWARE_PATTERN_PROGRAMMED_BITS,
+ which affects the TGA driver (#2712, Matt Grossman).
+2570. Replace the default "fixed" (6x13) font with Markus Kuhn's ISO 10646-1
+ version (#2711, Markus Kuhn).
+2569. Import Mark Leisher's ClearlyU BDF fonts (#2707, Mark Leisher).
+2568. Import Mark Leisher's Arabic24 BDF font (#2706, Mark Leisher).
+2567. Initial acceleration for the 24-plane TGA (#2710, Tim Rowley).
+2566. Fix clip bugs in the MGA driver (#2709, Mark Vojkovich).
+2565. Update the `xfsft' TrueType backend to version beta1.1.4. This includes
+ updates to the `fontenc' interfaces (#2708, Juliusz Chroboczek).
+2564. Fix some #include problems with the rendition driver (#2704, Dejan Ilic).
+2563. Fix a syntax error in the `ru' symbols file (#2703, Peter Novodvorsky).
+2562. Update the xf86SetGamma and xf86SetDpi helpers to use DDC information
+ when it is available, and update the MGA driver to make the DDC
+ information available earlier in the PreInit phase (#2702,
+ Andrew Aitchison).
+2561. Flesh out XF86Setup's config file read and write routines (#2701,
+ Joe Moss).
+2560. Parser fixes (#2700, Joe Moss).
+2559. Remove the out of date references to the sparse map mem functions from
+ the loader (#2699, Matt Grossman).
+2558. Color expansion for the SiS driver, and change the "NoTurboQueue" option
+ to "TurboQueue" (#2696, Juanjo Santamarta).
+2557. Xterm patch #96, including improved logic for bold fonts, improved
+ Unix98 PTY support, and modify initial-erase logic to ensure that the
+ ttyModes resource overrides it (#2695, Thomas Dickey).
+2556. Some #include and warning fixes (#2693, Marc La France).
+2555. On an error, tell user to re-run the server >without< -quiet. This is
+ generalized to allow the production of error messages to specify the
+ minimum verbosity to be used before reporting a problem (#2693,
+ Marc La France).
+2554. Make -depth 24 produce a more appropriate message when the driver
+ doesn't support it (#2693, Marc La France).
+2553. Reinstate black & white colour options for 1bpp (#2693, Marc La France).
+2552. Fix a typo in XF86Conf.man (#2691, Itai Nahshon).
+2551. Fix the initialisation of some global flags when the config file has
+ no ServerFlags section (David Dawes).
+
+XFree86 3.9Pj (18 April 1999)
+2550. Update SiS docs (#2690, Juanjo Santamarta).
+2549. Glide driver and documentation updates. Fix the "EXTERN_MODULE"
+ usage, force the virtual size to be the display size, and add a
+ GlideDevice Option to specify one of multiple cards (#2689,
+ Henrik Harmsen).
+2548. Resync DPMS timeout code with the 3.3.x code, which fixes some problems
+ (#2688, David Wragg).
+2547. Preliminary MTRR support for FreeBSD (3.2 and later) (David Dawes).
+2546. Separate the OS-independent and OS-dependent parts of the MapVidMem
+ functions, and handle sparse mapping with a flag to MapVidMem instead
+ of using a separate function (David Dawes).
+2545. Remove most LinkKit references.
+2544. Disable WC for the framebuffer for the Rendition V1K by default,
+ because it appears to be causing lockups (Dejan Ilic).
+2543. Some fixes for the Rendition driver (Dejan Ilic).
+2542. Add HW cursor using the Bt485 ramdac to the DEC TGA driver (#2687,
+ Matt Grossman).
+2541. More of the DGA 2.0 extension. Most of it is there now except for
+ the events (#2686, Mark Vojkovich).
+2540. Imlement attributes for Audio (mute, volume) and implement
+ QueryBestSize for the v4l driver (#2685, Gerd Knorr).
+2539. Fix hardware cursor code so that it works with the internal 64 bit
+ scanlines used on Alpha platforms (#2679, Matt Grossman).
+2538. Export new DGA symbols from the loader (#2678, Alan Hourihane).
+2537. Update C&T driver to use independent clocks for FP/dual and CRT modes
+ with HiQV chipsets (#2677, Egbert Eich).
+2536. Port of Precision Insight's NeoMagic driver to the new design
+ (#2677, Egbert Eich).
+2535. Add a Linux kernel backbone to the Permedia 2 Xv driver (#2661+revisions,
+ Michael Schimek).
+2534. Port of the rendition driver to the new design (#2674, Marc Langenbach).
+2533. Fix for the parser's printDeviceSection() function (#2673, Joe Moss).
+2532. Fix a bug in the handling of ZAxisMapping in the parser (#2672,
+ Nicholas Brealey).
+2531. Enable mono 8x8 pattern fills for the SiS driver (#2670,
+ Juanjo Santamarta).
+2530. Remove references to ru_SU in locale.alias (#2669, Aleksey Nowodworsky).
+2529. Fix a bug in xf86CollectOptions() that could cause a server crash.
+2528. Fix the problem causing the mouse acceleration to be done twice
+ (#2671, Frederic Lepied).
+2527. Disable clipping in the trident driver for FillRectSolid because the
+ driver gets passed zero values (#2681, Alan Hourihane).
+2526. Add Trident Blade3D support (#2681, Alan Hourihane).
+2525. Add Mono8x8 pattern for the Trident Image series (#2681, Alan Hourihane).
+2524. Fix trident screen glitches when mode switching (#2681, Alan Hourihane).
+2523. Some minor documentation-related cleanups. Doctools version 1.0.2 is
+ now required to format the XFree86 docs.
+
+XFree86 3.9Pi (11 April 1999)
+2522. Fix a Linux/PPC loader relocation bug, and reenable building the
+ loadable server by default for Linux/PPC (#2668, Gerd Knorr).
+2521. Fix a problem with non-terminated strings in the Xv library (#2665,
+ Gerd Knorr).
+2520. Update the v4l driver -- fix open/close handling and add support for
+ the XV_ENCODING attribute (#2665, Gerd Knorr).
+2519. Implement FBDevSaveScreen() (#2664, Gerd Knorr).
+2518. Enable shadowfb by default for the fbdev driver (#2664, Gerd Knorr).
+2517. Fix fbdev option handling (#2664, Gerd Knorr).
+2516. Fbdev documentation updates (#2664, Gerd Knorr).
+2515. Some more progress on the DGA 2.0 API/protocol (#2663, Mark Vojkovich).
+2514. Add ispell support to xedit (#2662, Paulo Cesar Pereira de Andrade).
+2513. Fix -DUSE_XPM handling in Xaw (#2662, Paulo Cesar Pereira de Andrade).
+2512. Some updates to the offscreen memory allocator and the i2c code
+ (#2661, Michael Schimek).
+2711. Use the correct version of xf86Xinput.c (the wrong version was
+ included in 3.9Ph) (Frederic Lepied).
+2710. Fix a pcitweak build problem on NetBSD (#2659, Isao Ohishi).
+2509. Add acceleration for the 8+16 mode of the C&T driver (#2658,
+ David Bateman).
+2508. Add compatibility to the client-side of the VidMode extension so that
+ it will work with 3.3.x servers (#2657, David Bateman).
+2507. Update 'ru' xkb symbols file (#2656, Aleksey Nowodworsky).
+2506. Add Trident 9525 ID to PCI info and trident driver (#2655,
+ Alan Hourihane).
+2505. Cleanup some compiler warnings in mfb and mi (#2654, Alan Hourihane).
+2504. Added a glide driver. It currently only works with the loadable
+ server (read the manpage before trying it) (#2653, Henrik Harmsen).
+2503. Update the Type1/latin2 fonts.* files to disable reencoding of the
+ fonts while keeping the same XLFD names (#2652, Juliusz Chroboczek).
+2502. Fix some pcitweak build problems on Interactive UNIX (#2651,
+ Michael Rohleder).
+2501. Xterm patch #95 (see xterm.log.html for details) (#2649, Thomas Dickey).
+2500. Fix typos in the VidMode extension that causes a protocol problem
+ (#2648, 2657, David Bateman).
+2499. Reorder the visuals to put TrueColor before DirectColor so that broken
+ clients (like Wabi) that assume the default visual is the first visual
+ will work (2647, David Woodhouse).
+2498. Fix a problem with the ThinkingMousePS/2 protocol handling of left
+ movement (#2392, Ian Remmler).
+2497. Fix an ISO8859-5 support bug in Xlib (Nikolai Saoukh).
+2496. Rework the GlxInitVisuals hooks with a more general wrapper-based
+ mechanism (David Dawes).
+2495. Fix a XINERAMA bug in dix/events.c (Dirk Hohndel).
+
+XFree86 3.9Ph (5 April 1999)
+2494. Add code to XF86Setup for mode adjustment (like xvidtune), addition,
+ and removal (#2646, Joe Moss).
+2493. Remove the use of the `dialog' program from XF86Setup, and add
+ various curses routines and the start of a text mode user-interface
+ (both curses & plain text). Also remove some obsolete Tk 4.0-specific
+ code (#2645, Joe Moss).
+2492. Add code to XF86Setup to convert all of the config file sections
+ to/from Tcl variables (#2644, Joe Moss).
+2491. Allow fbdev to handle non-page-aligned framebuffers correctly (#2643,
+ Gerd Knorr).
+2490. Add RAC code to the fbdev driver (if there is a PCI BusID specified
+ in the config file it will "check in" this into access control)
+ (#2643, Gerd Knorr).
+2489. Cleanup in sysv_video.c (#2642, Michael Rohleder).
+2488. Update xedit's realpath.c for IUS (#2642, Michael Rohleder).
+2487. Add support for InputDevice sections to the parser (not used yet)
+ (David Dawes).
+2486. A first cut at cleaning up the handling of memory mapping and client
+ exit/crash in the DGA library (David Dawes).
+2485. Shadowfb support for the generic VGA driver at depths 4 and 1
+ (Dirk Hohndel and Mark Vojkovich).
+2484. Fix the printMonitorSection and printDeviceSection functions in
+ the parser (#2641, Joe Moss).
+2483. Change the s3virge chipset names, removing the slashes (#2640,
+ Kevin Brosius).
+2482. Preliminary s3virge man page (#2640, Kevin Brosius).
+2481. Fix s3virge HW cursor (#2640, Kevin Brosius, Mark Vojkovich).
+2480. Remove some multiply defined variables in the cfb modules to avoid
+ a problem on LynxOS PowerPC (#2639, Thomas Mueller).
+2479. Fix a crash in the new xedit code for listing files and directories
+ (#2638, Paulo Cesar Pereira de Andrade).
+2478. Change the kill_ring code in TextAction.c to always end in a text block
+ of zero length (#2638, Paulo Cesar Pereira de Andrade).
+2477. Add xpm pixmap support to Xaw (needs to be built with -DUSE_XPM
+ for this), and if the xpm image has a mask, the widget will be
+ automatically reshaped to the pixmap mask (#2638,
+ Paulo Cesar Pereira de Andrade).
+2476. Add some PCI IDs for Creative Labs 3D Blaster Banshee PCI (#2637,
+ Nicholas Brealey).
+2475. XAA pixmap->window and window->pixmap copy optimization (#2636,
+ Mark Vojkovich).
+2474. Implement some attributes for the v4l module, and fix the clipping
+ code (#2635, Gerd Knorr).
+2473. Incorporate 3.3.1 FIFO settings for the SiS driver based on memory
+ bandwidth and pixel clock (#2632, Juanjo Santamarta).
+2472. SetMclk and FastVram options for the SiS driver (#2632,
+ Juanjo Santamarta).
+2471. Fix some SiS mode switch problems (#2632, Juanjo Santamarta).
+2470. Imakefile fix for building the X server with BuildGlxExt=NO (#2631,
+ Thomas Mueller).
+2469. Imakefile fixes for cxpm and sxpm (#2631, Thomas Mueller).
+2468. LynxOS resync, including removing the CrossCompile rule from lynx.cf,
+ LynxOS sparc resync, remove SMEM warning for default verbose level,
+ LynxOS support for chips driver util programs (#2631, Thomas Mueller).
+2467. Add man pages for the fbdevhw and fbdev modules (#2630, Gerd Knorr).
+2466. Add fb.h so that fbdevhw can be built on pre-2.2 Linux (#2630,
+ Gerd Knorr).
+2465. Add support for generic Xv adaptors to the fbdev driver (#2629,
+ David Woodhouse).
+2464. Fix X locale problem for Linux/libc6 introduced in 3.9Pg (#2628,
+ Nozomi Ytow).
+2463. Fix VT switching problems with the 8+16 code (#2627, David Bateman).
+2462. Generic Xv support for the s3virge driver (#2626, David Woodhouse).
+2461. Add a permission notice to videodev.h (#2625, David Woodhouse).
+2460. Resync parts of the XInput DDX code with 3.3.x, including restoring
+ the "Switch" device, RELATIVE_CHECK code, Elographics driver,
+ Wacom driver, and Joystick driver (#2514, 2548, Frederic Lepied
+ and Patrick Lecoanet).
+2459. Fix remaining build issued with the GLX/Mesa integration
+ (Marc La France).
+2458. Some preliminary support code that the new RAC code may use
+ (David Dawes).
+2457. Add a utility called `pcitweak' that can be used to read/write
+ registers in the PCI config space from the command line (David Dawes).
+
+XFree86 3.9Pg (29 March 1999)
+2456. Fix an off-by-one clipping error in the XAA wide line code (#2624,
+ Mark Vojkovich).
+2455. Add HW cursor support to the s3virge driver and make it the default
+ (#2623, Kevin Brosius).
+2454. Add OS-specific subdirectories to the loader subdirectory search lists,
+ and install OS-specific modules in such directories (David Dawes).
+2453. Set the screen numbering in multihead configurations based on the
+ ordering of the Screen entries in the ServerLayout section,
+ and allow an optional numerical argument to follow the Screen
+ keyword to indicate a different ordering (David Dawes).
+2452. Fix some signedness discrepancies in the libc_wrapper code.
+2451. Add missing parts to the parser's printKeyboardSection routine (#2621,
+ Joe Moss).
+2450. Finalising the DGA 2.0 driver interface (#2619, Mark Vojkovich).
+2449. Xterm patch #94 (#2618, Thomas Dickey).
+2448. Accelerated support for 8+16 overlays in XAA (untested) (#2617,
+ Mark Vojkovich).
+2447. Some optimisations for the 8+32 and 24+32 layers (#2616, Mark Vojkovich).
+2446. Updates for IUS (Interactive Unix) (#2614, Michael Rohleder).
+2445. Update xf86config for the 4.0 config file format (#2613,
+ Justin Bradford).
+2444. Update and clean up the Cards file (#2600, 2612, Justin Bradford).
+2443. When probing for a VGA, it's unnecessary to unlock its CRTC registers
+ (#2611, Marc La France).
+2442. Remove xf86FreeBusSlots(), which is redundant, unused and incorrect
+ (#2611, Marc La France).
+2441. Move the claiming of ISA resources from xf86Check???Slot() to
+ xf86Claim???Slot() (#2611, Marc La France).
+2440. On Linux, define _GNU_SOURCE only compiling the xc/ source tree (#2611,
+ Marc La France).
+2439. Remove uneeded s3virge files (#2615, Kevin Brosius).
+2438. "pci_burst" option updates for the s3virge driver (#2615, Kevin Brosius).
+2437. Fix missing accel flags and depth 24 problem with the s3virge driver
+ from the Alpha patch (#2615, Kevin Brosius).
+2436. Make sure the size of offscreen pixmaps don't exceed the address space
+ of the ViRGE (#2610, Mark Vojkovich).
+2435. Add a driver for video4linux frame grabber cards (#2609, Gerd Knorr,
+ David Woodhouse).
+2434. Add support to the MGA driver so that it will use any available
+ generic Xv adaptors (#2609, David Woodhouse).
+2433. Add xf86XVRegisterGenericAdaptor() and xf86XVListGenericAdaptors()
+ functions for maintaining a list of Xv adaptors which are not tied
+ to a particular screen (#2609, David Woodhouse).
+2432. Fix virtual screen panning with the SiS driver (#2608,
+ Juanjo Santamarta).
+2431. Fix security problem with the creation of the /tmp/.X11-unix directory
+ (#2607, Matthieu Herrb).
+2430. Update the 8+16 layer to get the color key from the new field in
+ the ScrnInfoRec (#2605, Mark Vojkovich).
+2429. Complete the Xv config evaluation code in the PM2 Xv driver and the
+ common layer (#2604, Michael Schimek).
+2428. Modify Xv DDX's clipping interface (#2604, Michael Schimek).
+2427. Fix a bug in the handling of Boolean options (#2603, Michael Schimek).
+2426. Have xf86ChangeGamma() update and install the default colormap
+ when the currently installed colormap is not implemented by lookup
+ (#2602, Mark Vojkovich).
+2425. Export StoreColors() (#2601, Mark Vojkovich).
+2424. Replace all Imakefile.obj files with Imakefile.inc because .obj is
+ a reserved extension for object file on OS/2 (#2599, Holger Veit).
+2423. Update the Cards file parser to accept a new DRIVER line (#2598,
+ Justin Bradford).
+2422. Fix getline clash in proxymngr and xsm (#2595, Dejan Ilic).
+2421. Fix colourmap on Permedia2, and fix GLINT SaveScreen to blank the
+ display (#2594, 2596, Alan Hourihane).
+2420. Make fbdev work on Sparc Linux, and fix a few bugs in fbdevhw and
+ fbdev (#2593, Jakub Jelinek).
+2419. Sparc Linux support for XFree86 (#2593, Jakub Jelinek).
+2418. Add DPMS support to the s3virge driver (#2592, Matt Grossman).
+2417. ppc_flush_icache() for Linux/PPC, required for the loader to work
+ correctly (#2591, Gerd Knorr).
+2416. Linux/PPC loader fix (#2590, Stuart Anderson).
+2415. Modify the ramdac module and glint driver to use the ScrnInfoRec
+ overlay fields (#2589, 2594, Alan Hourihane).
+2414. Add RTL ethernet and VIA APCI PCI devices to the ID list (#2588,
+ Kevin Brosius).
+2413. Fix a problem with $(STD_CPP_DEFINES) that was introduced in 3.9Pf.
+2412. Add VESA default modes, small perl hack to create an initialized data
+ structure from them, and the code to use those modes as default if no
+ other modes with the same name are defined (Dirk Hohndel).
+
+XFree86 3.9Pf (21 March 1999)
+2411. Fix some malloc problems in xf86xv.c (#2587, Michael Schimek).
+2410. Fix building of Xprt, Xnest and Xvfb when doing a loader build
+ (David Dawes).
+2409. Updates to s3virge driver to get it working under Linux/Alpha
+ (#2586, Matt Grossman).
+2408. Fix getline() clash (#2585, Alan Hourihane).
+2407. Have the s3virge driver use the new XAA rop helper functions (#2584,
+ Mark Vojkovich).
+2406. Add code to SuperProbe to detect the S3 Trio3D and Savage3D
+ (2583, Eric Molitor).
+2405. Add some XAA helper functions that drivers can call for help
+ converting X rops into MS rops (#2582, Mark Vojkovich).
+2404. Resync the overlay support in the glint driver (#2580, 2581,
+ Mark Vojkovich).
+2403. Add support for changing the overlay color key to the MGA driver
+ (#2579, Mark Vojkovich).
+2402. Preallocate the color key in the default colormap and set it to
+ something already in the default man (black) so that AllocColor will
+ never allocate it (#2578, Mark Vojkovich).
+2401. Use the color key field in the ScrnInfoRec for the overlay layers
+ (#2578, Mark Vojkovich).
+2400. Preliminary loader support for Linux/PPC ELF objects (#2577 (2570),
+ Stuart Anderson).
+2399. Fix some XAA offscreen pixmap problmes (#2576, Mark Vojkovich).
+2398. DGA fixes. Old apps should now run with the new driver interface,
+ and event handling should work better than before (#2575,
+ Mark Vojkovich).
+2397. Fix most remaining signed/unsigned and prototype warnings in the
+ following directories: lib/Xaw, lib/Xmu, programs/xclipboard,
+ programs/xconsole, programs/xmag, and programs/xvidtune (#2574,
+ Thomas Dickey).
+2396. Restore the interface of XmuConvertStandardSelection() to use
+ XPointer rather than XtPointer (#2574, Thomas Dickey).
+2395. Fix an malloc size bug in libICE (#2572, Christopher Sekiya).
+2394. Make MIT-SHM resource types non-static so that other extensions
+ (like Xv) can access client shared memory segments (#2571,
+ Mark Vojkovich).
+2393. First cut at altering the C&T user docs for 4.0 (#2569, David Bateman).
+2392. Fix a C&T problem affecting the colourmap setup for 1bpp modes, and some
+ other minor C&T driver fixes (#2569, David Bateman).
+2391. Fix an buffer overflow in os/connection.c (#2568, Gerd Knorr).
+2390. Add support for Modes sections and the UseModes keyword for Monitor
+ sections to the parser (#2567, Dirk Hohndel).
+2389. Fix xfree86.cf for Alpha (#2567, Dirk Hohndel).
+2388. Fix XAAFillPolygonStippled to obey the flag NO_TRANSPARENCY in
+ Mono8x8PatternFill (#2566, Xavier Ducoin).
+2387. Only allow the shadowfb layer in the C&T driver when linear addressing
+ is enabled (#2565 (2561), David Bateman).
+2386. Fix some problems with the xf8_16bpp layer, and allow it to work
+ with depth 15 as well as 16 (#2565 (2561, 2562), David Bateman).
+2385. Implement TrueColor with PseudoColor Overlays (8+16) for the
+ C&T driver for HiQV chipsets (#2565 (2561), David Bateman).
+2384. Add a -quiet option to xgamma (#2565 (2561), David Bateman).
+2383. Add TrueColor Gamma Correction for C&T HiQV chipsets (#2565 (2561),
+ David Bateman).
+2382. Fix Permedia 2 HW cursor lockup (#2563, Alan Hourihane).
+2381. Initial XAA support for SiS530 and SiS620 (#2560, Xavier Ducoin).
+2380. Add SuperProbe for SiS (#2559, Xavier Ducoin).
+2379. Fix the InstalMultipleMan and InstallMultipleManSuffix rules for
+ NetBSD and OpenBSD (#2558 (2557), Matthieu Herrb).
+2378. Add Cards entry for Number Nine FX Reality 772 (#2556, Harald Koenig).
+2377. Make XF86Setup build again (not fully functional yet) (#2555, Joe Moss).
+2376. Update the apm (Alliance Promotion) driver to the 4.0 interface (#2554,
+ Loic Grenie, Henrik Harmsen).
+2375. Add some rules for driver/module man pages, and add a sample driver
+ man page for the mga driver (David Dawes).
+2374. Update the Option Names section of xfree86/Registry (David Dawes).
+2373. Merge the OPTV_BOOLEAN and OPTV_TRI option classes, removing the
+ latter. Update code affected by this (David Dawes).
+2372. Fix the BackingStore option.
+2371. Disable transparency for screen->screen copies for Trident Image for
+ now.
+2370. Trident Image transparency update (#2564, Alan Hourihane).
+
+XFree86 3.9Pe (14 March 1999)
+2369. Fix problems debugging archive library modules on Linux with long
+ member names (Paul Flinders).
+2368. Add new XAA clipping for Trident Image (#2553, Alan Hourihane).
+2367. Fix Trident save screen so that it blanks the display (#2553,
+ Alan Hourihane).
+2366. Fix tranparency for the Trident Image cards (#2553, Alan Hourihane).
+2365. Remove the panmi and pandix directories, since they're no longer
+ needed.
+2364. Add gamma correction to the C&T driver, but disabled because it doesn't
+ work yet (David Bateman).
+2363. Add shadow fb support to the C&T driver (David Bateman).
+2362. Finish off the VidMode extension backward compatibility code
+ (David Bateman).
+2361. Add SetGamma/GetGamma requests to the VidMode extension, and a client
+ called 'xgamma' that makes use of them to allow the server's gamma
+ correction to be changed dynamically (David Bateman).
+2360. Make the cursor layer smart enough to remove the cursor itself when
+ DGA is activated (#2552, Mark Vojkovich).
+2359. Add some overlay-related entries to the ScrnInfoRec (#2550,
+ Mark Vojkovich).
+2358. Some DGA fixes (#2550, 2551, Mark Vojkovich).
+2357. Set X_BYTE_ORDER from the imake config, and use it in place of
+ the system's BYTE_ORDER (David Dawes).
+2356. Update copyright notices in the s3virge driver (#2546, Kevin Brosius).
+2355. Xterm patch #93 (#2546, Thomas Dickey).
+2354. Fix some minor fbdev problems in fbdevhw and the mga driver (#2545,
+ Gerd Knorr).
+2353. Disable the loader for LinuxPPC because it doesn't work (#2545,
+ Gerd Knorr).
+2352. Disable the Linux fbdevhw by default for versions older than 2.2
+ (#2545, Gerd Knorr).
+2351. Xaw and xedit updates, including changes to Xaw to support latin*
+ languages in the text code when not using the "international" resource
+ (#2544, Paulo Cesar Pereira de Andrade).
+2350. Add 3D decoration and the ability to display an XPM pixmap in the xdm
+ Login widget. A default pixmap made with the XFree86 logo is included
+ (#2543, Amit Margalit, Caolan McNamara, Ivan Griffin, Matthieu Herrb).
+2349. Improve attribute scaling in the PM2 Xv driver (#2542, Michael Schimek).
+2348. Add an "acecad" mouse protocol so that an acecad tablet can be used
+ with the standard mouse driver (#2541, Jeff Anton).
+2347. Include xf86_ansic.h in module build of xf86vmode.c (#2540,
+ Matthieu Herrb).
+2346. Fix a server crash when no mode lines are specified in the Monitor
+ section (#2539, Andreas Ehliar).
+2345. Resync SuperProbe with the 3.3.3.1 version (#2538, Marc La France).
+2344. Document -once server commad line option (#2538, Marc La France).
+2343. Add and document a -noreset server command line option to disable server
+ resets when the last client connection is closed. This is useful for
+ xtest'ing a server that is switched out (#2538, Marc La France).
+2342. More compiler warning fixups, including a re-integration of GLX for both
+ static and loader builds (#2538, Marc La France).
+2341. On Linux, compile with _GNU_SOURCE so that declarations for snprintf &
+ friends may be #include'd with <stdio.h> (#2538, Marc La France).
+2340. Fix the glint driver's use of resource control, which fixes problems
+ using MGA/GLINT combinations in multi-head (#2537, Alan Hourihane).
+2339. Fix a problem building xrdb with SVR4.0's cc (#2536, Satoshi Kimura).
+2338. Fix a trident 24bpp bug (#2535, Alan Hourihane).
+2337. Fix Permedia 2V hardware cursor (#2534, Alan Hourihane).
+2336. Add the rest of the known EM_ machine type defines, and Sparc
+ specific relocation defines to loader/elf.h (#2533, David Miller).
+2335. -
+2334. Disable MTRRs when unmapping memory (#2531, David Wragg).
+2333. Avoid the MTRR messages on systems with no MTRR support unless
+ the "mtrr" option is specified or -verbose is used (#2531, David Wragg).
+2332. -
+2331. Fix some offscreen pixmap-related problems with XAA (#2497, 2549,
+ Mark Vojkovich).
+
+XFree86 3.9Pd (9 March 1999)
+2330. Updates for Hurd port (#2528, UCHIYAMA Yasushi).
+2329. Fix some Solaris 7 build problems (#2530, Nicholas Brealey).
+2328. Add some more PCI entries (#2529, Nicholas Brealey).
+2327. Preliminary DGA support for the mga driver (#2527, Mark Vojkovich).
+2326. Fix some DGA bugs and turn on events in the DGA compatibility code
+ (#2526, Mark Vojkovich).
+2325. Fix the memory units in the old DGA (#2525, Mark Vojkovich).
+2324. Allow drivers to limit the size of XAA offscreen pixmaps (#2524,
+ Mark Vojkovich).
+2323. Fix the problem with XAA pixmap cache messages only being printed
+ for the first screen (#2524, Mark Vojkovich).
+2322. Temporarily disable rops without a source in the s3virge driver,
+ and add the ShowCache option (#2523, Mark Vojkovich).
+2321. Add XF86Config parser for VideoAdaptor configuration (#2521,
+ Michael Schimek).
+2320. Fis Permedia DPMS bug and Permedia 2 hw cursor (#2521, Michael Schimek).
+2319. Move include/Xvlib.h to include/X11/extensions/, add missing
+ XvPortNotify, and fix Xv DDX StopVideo deficiency (#2521,
+ Michael Schimek).
+2318. More ansifications/gcc warning removal for the clients (#2520,
+ Matthieu Herrb).
+2317. Implement backward compatibility for the server side of the VidMode
+ extension, which relies on the new clients informing the server of
+ their version (David Dawes).
+2316. Initial conversion of the VidMode extension for 4.0 (David Bateman).
+2315. Add DPMS support to the TGA driver (#2518, Matt Grossman).
+2314. Fix a bug in xaaInitAccel.c that affects disabling offscreen pixmaps
+ (#2519, Andrew Aitchison).
+2313. Some SiS driver fixes/updates (#2517, Juanjo Santamarta).
+2312. Fix a server crash when assiging the primary device (#2516,
+ Alan Hourihane).
+2311. Don't save/restore the VGA colourmap in the glint driver (#2515,
+ Alan Hourihane).
+2310. Fix a problem of using freed data in xgc (#2512, Jeff Anton).
+2309. Make the server fail gracefully when it can't load its base modules
+ (#2511, Alan Hourihane).
+2308. Fix a global declaration clash in panoramiXprocs.c (#2510,
+ Alan Hourihane).
+2307. Fix installation of GLX man pages (based on #2509, Matthieu Herrb).
+2306. Update the Linux/ppc section of xfree86.cf (#2507, Gerd Knorr).
+2305. Add code to the mga driver for using the fbdevhw module (#2507, 2522,
+ Gerd Knorr).
+2304. Add a fbdev module that provides a simple non-accelerated driver that
+ works on top of fbdevhw (#2507, Gerd Knorr).
+2303. Add a fbdevhw module that provides the functions needed to access
+ Linux framebuffer devices (#2507, Gerd Knorr).
+2302. Add a wrapper for mmap and munmap (#2507, Gerd Knorr).
+2301. Fix an XAA FillPoly problem that shows up with the noblank screen
+ saver (#2513, Mark Vojkovich).
+2300. Fix some problems in XAA's 32->24bpp image conversion (Mark Vojkovich).
+2299. Fix padding in the xf24_32bpp layer (#2508, Mark Vojkovich).
+
+XFree86 3.9Pc (2 March 1999)
+2298. Preliminary work on new DGA event support (#2506, Mark Vojkovich).
+2297. Add rewrite of s3virge driver's accel code (#2505, Mark Vojkovich,
+ Kevin Brosius).
+2296. Remove typos and inconsistencies between the Xv manual pages and
+ the implementation (#2504, Michael Schimek).,
+2295. Ansification and gcc warning elimnation in xfwp, xhost, xieperf,
+ xinit, xkbevd, xkbprint, xkbutils, xkill, xlogo (#2502, Matthieu Herrb).
+2294. Fix an MGA driver crash that shows up when running xtest (#2501
+ Alan Hourihane).
+2293. Correctly indicate when the MGA driver auto-detects SDRAM cards
+ (#2500, Alan Hourihane).
+2292. Add "noddc1" and "noddc2" options to the DDC layer to allow DDC to
+ be disabled (#2499, Alan Hourihane).
+2291. Change PsAttVal.c (Xprt/PS) so that values other then {PostScript 2}
+ can be put into xp-raw-formats-supported (#2498, Noah Roberts).
+2290. Fix a 'make includes' problem in lib/font that shows up on SVR4.
+2289. Integrate SGI's GLX and the Mesa core rendering library
+ (#2492, Precision Insight, SGI, Mesa).
+2288. -
+2287. New DGA DDX layer (not finished yet) (#2495, Mark Vojkovich).
+2286. Backwards compatibility layer translating DGA 1.0 into the new DDX
+ (#2494, Mark Vojkovich).
+2285. Disable old DGA support in the cirrus driver (#2493, Mark Vojkovich).
+2284. Ansification and gcc warning elimnation in xclipboard, xclock, xcmsdb,
+ xconsole, xdm, xdpyinfo, xedit, xfd and xfindproxy (#2491,
+ Matthieu Herrb).
+2283. Fix 8 plane TGA 8x8 pattern fill (#2490, Matt Grossman).
+2282. Fix pitch padding in the xf24_32bpp layer (#2489, 2496, Itai Nahshon).
+2281. Add DPMS support for the Cirrus Laguna chips (#2489, 2496, Itai Nahshon).
+2280. Add loader req/ref symbol lists to the cirrus module (#2489, 2496,
+ Itai Nahshon).
+2279. Fix cirrus display corruption with acceleration and SW cursor
+ (#2489, 2496, Itai Nahshon).
+2278. Add minimal 5430 support to the cirrus driver (#2489, 2496,
+ Itai Nahshon).
+2277. Resync LynxOS support (#2486, Thomas Mueller).
+2276. Remove the driver for the never-released P3D chipset (#2285, Dejan Ilic).
+2275. Change xf86XVScreenInit's arguments so that it's easier to initialize
+ the Xv DDX when adaptors come from multiple sources (#2484,
+ Mark Vojkovich).
+2274. Ansification and gcc warning elimnation in x11perf and xauth
+ (#2483, Matthieu Herrb).
+2273. Fix a backing store bug in the 24/32 layer, and add a local version
+ of a 24->24bpp copy routine since the performance in cfb24 is too
+ poor (#2481, Mark Vojkovich).
+2272. Add support for setting write-combining for the frame buffer memory,
+ and disabling WC for MMIO memory via the PPro/PII MTRR facility
+ provided in Linux 2.2 (#2480, 2503, David Wragg).
+2271. Xaw and xedit updates/fixes (#2479, Paulo Cesar Pereira de Andrade).
+2270. Add some more PCI data (#2478, Andrew Aitchison, #2489, 2495,
+ Itai Nahshon).
+2269. Fix a bug in the KIO8-U encoding in fontenc.c (#2477,
+ Juliusz Chroboczek).
+2268. Fix most of the warnings that show up when building on Digital Unix 4.0D,
+ with the DEC C compiler.
+2267. Fix for Millennium II hardware cursor-related loss of sync problem
+ that shows up with some revs of the 3026 ramdac (Trey Boudreau).
+2266. Update the setting of the option registers in G-type RAMDAC
+ Matrox cards and add "no_ddc" flag (Dirk Hohndel, Michael
+ Brown).
+
+XFree86 3.9Pb (20 February 1999)
+2265. Allow YaccCmd to be overridden in host.def (#2474-2476,
+ Christopher Sekiya).
+2264. Implement null overscans in VGA, minor fixups to VGA generic
+ default mode, re-add #ifndef's in VGA generic driver erroneously
+ deleted in 3.9No (#2473, Marc LaFrance).
+2263. More MULTIBUFFER extension fixes (#2471, Marc LaFrance).
+2262. Add support for the Matrox G200 SDRAM cards; G100 SGRAM still
+ doesn't work (Dirk Hohndel).
+2261. Support Linux PowerPC. Add Linux 2.2 PCI config space code
+ (#2470, Gerd Knorr).
+2260. Remove gcc warnings in the clients and lib/FS (#2469, Matthieu Herrb).
+2259. Updates to the PCI database (Dirk Hohndel, David Monro).
+
+XFree86 3.9Pa (14 February 1999)
+2258. Use /dev/io to enable I/O access on FreeBSD instead of KDENABIO.
+2257. Correct some typos/grammatical problems with the DESIGN doc (Ivan Bach).
+2256. Fix a crash when PciAccInfo isn't initialized (#2468, Alan Hourihane).
+2255. Add SiS530 detection to the SiS driver. Clock programming,
+ acceleration and hw cursor are not implemented, yet (Dirk Hohndel).
+2254. Fix some bugs related to hardware clipping of spans. XAA
+ WideLine speedups when hardware clipping is available (#2467
+ Mark Vojkovich).
+2253. Permedia2 clipping fixes, fix WritePixmap for non-GXcopy rasters
+ (#2466, Alan Hourihane).
+2252. Add -scanpci option and a scanpci module to the server. Add tons
+ of PCI2.1 subsystem ids to identify specifc cards; the PCI data
+ base needs more work (Dirk Hohndel).
+2251. Remove obsolete xf86[GS]etDefaultColorVisualClass() and fix some
+ small typos and comments; make type of BIOS, Memory and I/O
+ bases consistent (#2460,2465 Marc LaFrance).
+2250. Add ScanlineCPUToScreen for TX/MX and older Permedia chipsets
+ for when PCI retries are not enabled (#2459,2461,2462,2463
+ Alan Hourihane).
+2249. Add 24/8 overlay support for 3Dlabs chipsets and switch to MMIO
+ for vga access (#2459, Alan Hourihane).
+2248. Add 24/8 overlay support to IBM526 and IBM640 ramdacs, fix IBM640 hw
+ cursor (#2458, Alan Hourihane).
+2247. Fix depth 24 support in TGA driver (#2456, Tim Rowley).
+
+XFree86 3.9P (7 February 1999)
+2246. Some TGA driver speedups and cleanups (#2454, Matt Grossman).
+2245. Fix a lock_display() prototype problem in Xlibint.h that shows up
+ when building with -DXTHREADS.
+2244. Allow the driver to override XAA's assignment of Screen functions which
+ access the framebuffer (#2453, Mark Vojkovich).
+2243. Fix mga overlay problems related to the software cursor and disable
+ overlays for the G100 since it doesn't support planemasks (#2452,
+ Mark Vojkovich).
+2242. Rectangle outline performance improvements for the shadow framebuffer
+ (2451, Mark Vojkovich).
+2241. Update the ati driver code to include changes in 3.3.3.1. The driver
+ is not buildable yet (#2450, Marc La France).
+2240. Add support for VT switching to the 8+16 layer (#2449, Mark Vojkovich).
+2239. Export xf86NewSerialNumber() (#2448, Mark Vojkovich).
+2238. Fix XAA pixmap cache in 24bpp when ImageWrites are not available and
+ 32bpp pixmaps are used (#2447, Mark Vojkovich).
+2237. Improve performance for zero width arcs at 24bpp in the mga driver
+ (#2446, Mark Vojkovich).
+2236. Optimise 24->32bpp transfers (#2445, Mark Vojkovich).
+2235. Xterm patch #92 (#2444, Thomas Dickey).
+2234. Fix some compiler warnings in libfont (#2443, Marc La France).
+2233. Make building the Speedo and Type1 font code optional (#2443,
+ Marc La France).
+2232. Add DDC2 and Xv support for Permedia 2 to the glint driver (#2442,
+ Michael Schimek).
+2231. Update the glint driver's clipping for the new XAA clip support
+ (#2440, Alan Hourihane).
+2230. Add support for the ELSA Gloria-XXL with Glint Gamma chip (#2440, 2441,
+ Alan Hourihane).
+2229. Fix some ANSI vs non-ANSI prototype mixing in the Speedo code.
+2228. Fix a bug setting the framebuffer pixmap format for depth 4 in
+ xf86SetDepthBpp().
+2227. Fix some misuse of the VGA "Palette" enable/disable functions in the
+ vgahw code, and clarify what they do. This fixes some display artefacts
+ that were showing up when writing to the colourmap.
+
+XFree86 3.9Nz (1 February 1999)
+2226. Add an 8+16bpp dual framebuffer layer (#2425, Mark Vojkovich).
+2225. Add "ShadowFB" to the mga driver for experimenting with the shadowfb
+ layer (#2439, Mark Vojkovich).
+2224. Some cleanups/fixes for Solaris 7 (#2437, David Holland).
+2223. Ansify (and remove gcc warnings from) the following clients: appres,
+ bdftopcf, beforelight, bitmap and editres (#2436, Matthieu Herrb).
+2222. Eliminate cpp-related warnings about the "unix" symbol on NetBSD-current
+ (#2434, Matthieu Herrb).
+2221. Fix a bug in Xaw's StripChart widget that shows up with xload
+ (#2433, Matthieu Herrb).
+2220. Some initial code for supporting other SiS cards in the SiS driver
+ (#2420, Juanjo Santamarta).
+2219. Allow static Xvfb to compile (#2432, Marc La France).
+2218. Fix ddc and chips Imakefiles (#2432, Marc La France,
+ #2435, Matthieu Herrb).
+2217. Remove redundant BitsPerPixel macro definitions (#2432, Marc La France).
+2216. Remove some redundant rules from Xpm's Imakefile (#2432, Marc La France).
+2215. Fix some compiler warnings (#2432, Marc La France).
+2214. Allow the deprecated MultiBuffer extension to compile (#2432,
+ Marc La France).
+2213. Fix problems building with XInput disabled (#2432, Marc La France).
+2212. Fix 'make clean' to remove lndir and revpath (#2432, Marc La France).
+2211. Add a new "shadowfb" layer that maintains a virtual framebuffer in
+ system memory and tells the driver what parts of the videoram
+ framebuffer need updating. This allows the use of write-only videoram
+ framebuffers (#2431, 2438, Mark Vojkovich).
+2210. Fix some compilation problems on Alpha platforms caused by some
+ inlines in complier.h being declared as extern instead of static
+ (2430, Matt Grossman).
+2209. Remove the inconsistencies with numeric chipset tokens in the s3virge
+ driver (#2428, Kevin Brosius).
+2208. Move the mga DDC code into the PreInit function, add I2C support
+ (disabled and not working so far), and allow the driver to continue
+ without DDC support if the DDC module is missing (#2427,
+ Andrew Aitchison).
+2207. Fix a problem with xsm not acknowledging the SaveYourself message it
+ sends clients with a SaveComplete message (#2426, Robert Bihlmeyer).
+2206. Update the mga driver to use the new XAA clipping (#2424,
+ Mark Vojkovich).
+2205. Some enhancements to XAA's HW clipping handling, allowing clipping
+ to be used for more than just lines (#2423, Mark Vojkovich).
+2204. Fix a problem with the previous cfb screen pixmap access fix (#2242,
+ Mark Vojkovich).
+2203. Fix SiS 24bpp support (#2421, Alan Hourihane).
+2202. Fix SiS HW cursor, max clock and 16bpp support (#2418, Alan Hourihane).
+2201. Update the ramdac module's HW cursor support to handle hardware that
+ requires nibble swapping (#2417, 2419, Alan Hourihane).
+2200. Make the fact that the XAA TE font rendering assembly code is disabled
+ by default more obvious (#2416, David Bateman).
+2199. Fix VT switches in 8+32 mode (#2415, Mark Vojkovich).
+2198. Add common encoding support for the Speedo, Type1 and FreeType
+ font backends (#2385, Juliusz Chroboczek).
+2197. Update lib/font/FreeType to xfsft-1.0.3 (#2385, Juliusz Chroboczek).
+2196. X-TT updates for our loader (X-TT team and Nozomi Ytow).
+2195. Import X-TrueType 1.2pre-19990125 (X-TT team).
+
+XFree86 3.9Ny (26 January 1999)
+2194. Some improvements to the XAA TE font rendering assembly code (note
+ that this assembly code is disabled by default) (#2413, David Bateman).
+2193. Fix some places in cfb that were accessing the screen pixmap directly
+ from the private (#2412, Mark Vojkovich).
+2192. Fix a FreeType build problem on 64-bit platforms (#2411, Alan Hourihane).
+2191. Fix a cfb24 build problem that shows up with egcs (#2410,
+ Alan Hourihane).
+2190. Add DPMS, DDC1 and HW cursor support to the SiS driver, and fix panning
+ in the SiS driver (#2409, Alan Hourihane).
+2189. Put copyright notices from the pandix/panmi code into the merged
+ dix/mi versions (#2408, Alan Hourihane).
+2188. Update drivers to use the 24/32 conversion layer, and to default to
+ a 24bpp framebuffer format when supported.
+2187. Make some refinements to the way the depth 24 pixmap format is set.
+2186. Replace the ModuleInit function with a ModuleData data object. This
+ allows the loader to get the version and entry points from a module
+ without first executing module code.
+2185. Unify the abiclass and abivendor fields of XF86ModuleVersionInfo,
+ and add a moduleclass field.
+2184. Add a SaveRestoreImage field to the ScrnInfoRec to allow drivers to
+ supply an alternative to the default.
+
+XFree86 3.9Nx (24 January 1999)
+2183. Prevent LoadSubModule() from passing absolute module paths and from
+ providing its own module search path.
+2182. Import FreeType 1.2. This includes the FreeType library specific parts
+ of #2385 from Juliusz Chroboczek.
+2181. Add a root-only -modulepath command line option to the X server.
+2180. Fix the VT switch screen restore bug introduced a few versions ago
+ (#2406, Mark Vojkovich).
+2179. ND version of the SiS driver, currently only for the 6326 chip (#2404,
+ 2405, 2407, Alan Hourihane).
+2178. xterm patch #91 (#2402, Thomas Dickey).
+2177. Add 32/24 support to the MGA driver (#2401, Mark Vojkovich).
+2176. Add 32bpp->24bpp conversion acceleration to XAA (#2400, Mark Vojkovich).
+2175. Add partial acceleration support to the TGA driver (#2399, 2403,
+ Matt Grossman).
+2174. Fix an 8+32 layer bug introduced in 3.9Nw (#2398, Mark Vojkovich).
+2173. Add a 32/24 conversion layer. Pixmaps are still 24bpp internally,
+ but the interfaces visible to clients are all 32bpp (#2397,
+ Mark Vojkovich).
+2172. Fix trident driver panning at 24bpp (#2395, Alan Hourihane).
+2171. Add DDC1 and DDC2 (the latter not working yet) to the trident driver
+ (#2395, Alan Hourihane).
+2170. Add MCLK override to the trident driver (#2395, Alan Hourihane).
+2169. Enable pixel multiplexing to the trident drive for high resolution
+ 8bpp modes (#2395, Alan Hourihane).
+2168. Add clipping for the Trident 9682 and 9685 and Mono8x8 and CPUToScreen
+ support for the 9685 (#2395, Alan Hourihane).
+2167. Add offscreen pixmap support for the Trident Image series (#2395,
+ Alan Hourihane).
+2166. Fix some cfb24 problems that showed up after the previous changes
+ (#2396, Nozomi Ytow).
+2165. Update the C&T HW cursor defaults to only disable them by default when
+ necessary (#2394, David Bateman).
+2164. Add some sanity checking for the subdirs argument to LoadSubModule, etc.
+2163. Fix a bug in the verbose Mode handling in the parser that can result
+ in an infinite loop when the "Mode" keyword is used incorrectly in
+ a config file.
+2162. Add a global default module path to the loader, and a function that
+ the common layer can call to set it.
+2161. LoadModule was ignoring the subdir list argument (Nozomi Ytow).
+2160. Add printing of subsystem ids to scanpci (Dirk Hohndel).
+
+XFree86 3.9Nw (17 January 1999)
+2159. Add functions for finding the pixmap format and pixmap bpp for a
+ given depth, and fix a crash in xf86ValidateModes() caused by recent
+ changes in this area.
+2158. Add an extra argument to LoadSubModule (and LoadModule) to allow the
+ caller to optionally specify version and/or ABI requirements that
+ the loaded module must meet for the load to complete successfully.
+2158. Add support to the loader for vendor-defined ABI classes. These classes
+ are specified as a string. The main use is for third party modules that
+ themselves load sub-modules (like X-TT).
+2157. Fix the MGA driver's handling of the "MGA_SDRAM" option. SDRAM cards
+ are still not auto-detected though (#2391, Mark Vojkovich).
+2156. Add a screen->screen colour expansion bug workaround to the MGA driver,
+ and enable the faster linear expansions instead of the planar ones
+ (#2390, Mark Vojkovich).
+2155. Fix some depth/bpp issues in the SHM code (#2389, Mark Vojkovich).
+2154. Export some missing symbols for Alpha platforms (#2388, Alan Hourihane).
+2153. Fix a bug in determing the card type in the TGA driver (#2387,
+ Alan Hourihane).
+2152. Fix a problem in ramdac/BT.c (#2386, Alan Hourihane).
+
+XFree86 3.9Nv (15 January 1999)
+2151. Fix cfb24 problems that show up with xtest (#2384, Nozomi Ytow).
+2150. Fix 64 pixel rounding of display width in the C&T driver (#2383,
+ David Bateman).
+2149. Add an UnloadSubModule() function that can unload individual sub-modules
+ without unloading sibilings.
+2148. Remove a lot of unnecessary casts of x*alloc().
+2147. Add a pciGetBaseSize() funtion to the PCI code.
+2146. Make our PCI code aware of the following 2.1 type 0 header fields:
+ Cardbus CIS pointer and subsystem ids.
+2145. Remove the KEEP_BPP code, and fix problems with some drivers referencing
+ the unused pixmapBPP ScrnInfoRec field.
+
+XFree86 3.9Nu (13 January 1999)
+2144. Fix a bug in PANORAMIX_FREE(), which was referencing just freed data.
+2143. Merge the pandix/panmi code into dix and mi, and enable building
+ the Xinerama (panoramiX) extension by default (#2377-2381,
+ Alan Hourihane).
+2142. Rework the handling of the depth/bpp/fbbpp options. The -bpp flag and
+ related config file keywords are no longer used. New flags and options
+ have been added to specify the server-wide depth 24 pixmap format.
+ A "standard" set of pixmap formats is always advertised, so drivers
+ using these don't need to worry about explicitly adding them.
+2141. Fix some sun_path overflows in xtrans.
+2140. Some panoramix fixups (#2376, Alan Hourihane).
+2139. Don't allow arbitrarily long display number strings to be passed on
+ to xtrans by _X11TransConnectDisplay().
+2138. Update the parser and xf86Config.c to allow Options to be specified in
+ the config file's ServerLayout section. Options in the ServerLayout
+ section can override those in the ServerFlags section.
+2137. Update the parser and xf86Config.c to allow "Inactive" devices
+ to be specified in the config file's ServerLayout section.
+2136. Import xpm version 3.4k.
+
+XFree86 3.9Nt (11 January 1999)
+2135. Fix 8+32 rendering bugs (#2374, Mark Vojkovich).
+2134. Update vgaHWddc1SetSpeed() to select the 25 MHz clock (#2373,
+ Alan Hourihane).
+2133. Add support for a shared font library (#2364, Takuya SHIOZAKI).
+2132. Add ProfiledDepLibraryTarget, DebuggedDepLibraryTarget and
+ SharedDepLibraryTarget rules to imake (#2364, Takuya SHIOZAKI).
+2131. Fix a typo in xf86Init.c (#2372, Nozomi Ytow).
+2130. Xaw and xedit updates (#2371, Paulo Cesar Pereira de Andrade).
+2129. Move the DDC call to before the mode initialisation in the mga driver
+ (#2367, Alan Hourihane).
+2128. Fix a problem with the xkb dvorak layout (#2362, Tabman)
+2127. Fix an xsm crash (NULL dereference) when a client sets an SM property
+ list to a length of zero (#2361, Robert Bihlmeyer).
+2126. Untested support for the Trident 939A/DVD (#2359, 2360, Alan Hourihane).
+
+XFree86 3.9Ns (3 January 1999)
+2125. Allow backing store to be controlled with a per-screen config file
+ option (#2357, Mark Vojkovich).
+2124. Fix XAA so that the offscreen pixmaps are compatible with backing store
+ (#2354, Mark Vojkovich).
+2123. Fix a bug in XAA's stipple to 8x8 pattern reduction code (#2352,
+ Mark Vojkovich).
+2122. 8+32 overlay support for XAA (#2352, 2356, Mark Vojkovich).
+2121. Add TGUI9440 and Cyber9320 support to the trident driver (#2348,
+ Alan Hourihane).
+2120. Fix a typo in xkbcomp/symbols/sun/Imakefile (#2337, Matthieu Herrb).
+2119. Mga driver updates for the new 8+32 overlay support (#2332, 2353,
+ Mark Vojkovich).
+2118. New 8+32 overlay support (#2331, 2351, 2358, Mark Vojkovich).
+2117. Fix a bug in the xterm man page (#2333, Thomas Dickey).
+2116. Remove the -fno-strength-reduce option for OpenBSD and NetBSD (#2328,
+ Matthieu Herrb).
+2115. Import regex for systems that don't have a Posix regex.
+2114. Add a LoaderListDir() function that can be used to list the available
+ modules.
+2113. Modify LoadModule and LoadSubmodule to accept optional subdir and
+ pattern lists, and use regular expressions for the module matching
+ instead of prefix/suffix lists.
+2112. Add a "revpath" utility to xc/config/util to help in dealing with
+ imake's use of relative paths. If this proves to be useful, it could
+ be used more widely in imake's rules.
+2111. Install some classes of modules into subdirectories of the "modules"
+ directory. The imake module install rules have been updated
+ accordingly.
+
+XFree86 3.9Nr (20 December 1998)
+2110. Add support for the wscons console driver for NetBSD-current (#2326,
+ Matthieu Herrb).
+2109. Remove cfbPuntCopyPlane from cfb (#2325, Mark Vojkovich).
+2108. Fix a build problem related to Xarch.h on NetBSD (#2322, Isao Ohishi).
+2107. Fix an XAA bug tha can result in a zero height when rendering TE text
+ (#2321, Mark Vojkovich).
+2106. Fix an optimization bug in the new XAA rect and span code (#2319,
+ Mark Vojkovich).
+2105. Accelerate CopyPlane on offscreen pixmaps (#2318, Mark Vojkovich).
+2104. Fix a 4bpp problem with the C&T driver and the new colourmap code
+ (#2317, David Bateman).
+2103. Enable XAA offscreen pixmaps in the C&T driver (#2317, David Bateman).
+2102. ImageRead functions for some C&T HiQV chipsets (disabled) (#2317,
+ David Bateman).
+2101. MMIO access to the registers for PCI C&T 69000 (#2317, David Bateman).
+2100. Cleanup code in mipushpxl.c (#2313, Thomas Mueller).
+2099. Fix MX/TX clipping bugs in the glint driver (#2312, Alan Hourihane).
+2098. xterm patch #90 (#2311, Thomas Dickey).
+2097. Export missing symbols for panoramiX (#2310, Alan Hourihane).
+2096. Initialise a number of Xlib/Xt data structures, correct a minor linker
+ bug in OS/2 (#2026, Holger Veit).
+2095. Fix some realloc() usages (#2019, Matthieu Herrb).
+2094. Support for arc4random() in xdm/genauth.c (#2019, Michael Shalayeff).
+2093. Update mkfontdir to create an appropriate fonts.dir file when no
+ fonts are found rather than doing nothing.
+2092. Replace void main() -> int main() for ANSI conformance (#2019,
+ Matthieu Herrb).
+2091. Only allow the X server -nolock option when the real uid is root.
+2090. Some sanity checks on DISPLAY name (#2168, Kevin Vajk).
+2089. Fix an Xnest crash with too many visuals (#2019, Matthieu Herrb).
+2088. Swedish sun keyboard support in Xsun and xkb (#2019, Magnus Holmberg).
+2087. A quick attempt at neutralising a stack-buffer overflow problem in
+ the Xprt server.
+2086. LP64 compiler warning fixes from the NetBSD xsrc tree (#2019,
+ Ross Harvey).
+2085. Don't install lndir on OpenBSD (#2019, Matthieu Herrb).
+2084. Teach imake how to automatically determine the NetBSD architecture
+ (#2180, Jason Thorpe).
+2083. Add local font directory (Dirk Hohndel).
+2082. LynxOS OS version detection for imake (#2039, Thomas Mueller).
+2081. Resync OpenBSD.cf (#2019, Matthieu Herrb).
+2080. Fix security problem by creating /tmp/.X11-unix with sticky bit (#2168,
+ Kevin Vajk, David Dawes, Dirk Hohndel).
+2079. Make LinkVarDirectory handle DESTDIR (#2019, Matthieu Herrb).
+2078. Resync NetBSD.cf.
+2077. Some doc and nroff-related updates to the build system.
+2076. Update tk/tcl definitions in FreeBSD.cf and add support for building
+ a.out compatibility libraries on FreeBSD/ELF systems.
+2075. Create host.def with sane defaults when none exists and when a cut-down
+ source tree is detected.
+2074. Resync with 3.3.3 (items 2075-2096 above).
+2073. Fix an xset segfault (#2320, Itai Nahshon).
+
+XFree86 3.9Nq (13 December 1998)
+2072. Change the modversion field in the XF86ModuleVersionInfo struct into
+ separate major, minor and patchlevel fields.
+2071. Initial DG/ux support (#2299, Takis Psarogiannakopoulos).
+2070. DDC1 support for TVP3026 based Matrox cards (#2309, Andrew Aitchison).
+2069. More rewrites of the way spans and rects are handles in XAA so that
+ it never has to allocate any memory, thereby eliminating potential
+ stack overflow problems (#2308, Mark Vojkovich).
+2068. MGA driver-provided FillCacheBltRects replacement, optimised for fastblt
+ (#2307, Mark Vojkovich).
+2067. Choose MGA planar vs linear screen to screen colour expansion at runtime
+ rather than at compile time (#2307, Mark Vojkovich).
+2066. Fix a build problem related to Xarch.h on OpenBSD (#2306,
+ Matthieu Herrb).
+2065. Fix a typo in FreeBSD.cf that affects adding the runtime library
+ search patch for 2.2.x (#2305, Keisuke Inoue).
+2064. Some enhanced XKB files for French-Canadian keyboards (#2204,
+ Eric Moreau).
+2063. Fix an incorrect realloc in xmodmap (#2303, Alexander V. Lukyanov).
+2062. Fix depth 30 for the glint driver (#2297, Alan Hourihane).
+2061. Resync pandix and panmi, and fix some panoramix build problems
+ (#2296, Alan Hourihane).
+2060. Enable offscreen pixmaps for the glint driver (#2295, Alan Hourihane).
+2059. Fix PC98 XKB (#2292, Hirofumi Nishizuka and #2300, Tetsuo Tsukamoto).
+2058. Fix some unresolved symbols (#2293, Michael Rohleder).
+
+XFree86 3.9Np (6 December 1998)
+2057. Some xedit updates (#2291, Paulo Cesar Pereira de Andrade).
+2056. Updates to the Xaw text code (#2291, Paulo Cesar Pereira de Andrade).
+2055. XAA doc updates (#2289, Mark Vojkovich).
+2054. Replace linear screen to screen colour expansions with planar ones
+ in the MGA driver because there seems to be a hardware problem with
+ the linear ones (#2288, Mark Vojkovich).
+2053. Enable offscreen pixmaps for the MGA driver (#2288, Mark Vojkovich).
+2052. Some misc XAA updates (#2287, Mark Vojkovich).
+2051. A non-trival rewrite of the way fills are done in XAA (#2287,
+ Mark Vojkovich).
+2050. Add a LINEAR_FRAMEBUFFER flag to XAA so that the pixmap cache can
+ be loaded without requiring a driver-supplied ImageWrite function
+ (#2287, Mark Vojkovich).
+2049. Add fully accelerated offscreen pixmaps support to XAA (#2287,
+ Mark Vojkovich).
+2048. Add a RemoveAreaCallback for the offscreen memory manager. Areas
+ for which this is supplied are considered lower priority than ones
+ that don't, and can be booted out when something of higher priority
+ needs the space (#2286, Mark Vojkovich).
+2047. Remove the ScreenPtr passed to the offscreen memory manager's resize
+ function since it is already available from the FbAreaPtr (#2286,
+ Mark Vojkovich).
+2046. Change xf86SaveRestoreImage() so that it doesn't create a new
+ screen pixmap but modifies the old one (#2285, Mark Vojkovich).
+2045. Add support to mi for pixmaps with non-zero origins (#2284,
+ Mark Vojkovich).
+2044. Fix some Alpha compilation problems introduced in 3.9No (#2283,
+ Alan Hourihane).
+2043. Fix an Xlib problem with _XimLookupMBText() when using KOI8-R
+ (#2282, Alexander Kabaev).
+2042. Fix the pattern source address mask for the C&T HiQV chips, which
+ was causing 8x8 pattern problems when using more than 2MB of video
+ memory (#2281, Peter Wainwright).
+2041. Update the TGA and Trident drivers for the ramdac/cmap changes (#2277,
+ Alan Hourihane).
+2040. Change the Permedia2 to use a direct LoadPalette rather than the
+ ramdac module because of 16bpp difficulty with the TVP3026 (#2277,
+ Alan Hourihane).
+2039. Remove the old cmap code from the ramdac module and use the new
+ cmap layer instead (#2277, Alan Hourihane).
+2038. Fix os.h and misc.h so that system headers don't get included when
+ building modules.
+2037. Make the X server read an Xauthority file using the real user id
+ to avoid problems when it is located on an NFS-mounted filesystem.
+ (as suggested by #2276, MIHIRA Sanpei Yoshiro).
+2036. Xdm patch to allow the "Willing to manage" test displayed in the chooser
+ window to be generated from a program run on the target host. This
+ allows information like number of users, load average, etc to be
+ displayed (like CDE does) (#2275, Dick Snippe).
+2035. Fix a core dump problem in xauth when interrupted while attempting
+ to lock the auth file. Also fix a potential problem with calling
+ printf() from within a signal handler (#2274, BSDI/Jeff Polk).
+2034. Add DDC2 probing for Cirrus 5446/5480 and Laguna chipsets (#2273,
+ Itai Nahshon).
+2033. Fix some possible memory corruption and some minor bugs in the new DDC
+ code (#2271, 2272, Itai Nahshon).
+2032. Offscreen memory manager and colormap layer doc updates (#2270, 2290,
+ Mark Vojkovich).
+2031. Some glint clipping fixes (#2269, Alan Hourihane).
+2030. New XInput code, including new drivers for the SpaceOrb and Magellan
+ (#2243, Metro Link).
+2029. Fix mga YDstOrg start address adjustment after VT switching.
+2028. Fix cfb24 bitblt for non-trivial planemasks (Peter Wainwright).
+2027. Fix bad headers included when compiling cup.c for extmod module.
+2026. Fix a malloc/xfree mismatch in xtrans LocalInitTransports().
+2025. Add some documentation for DDC (#2259, Egbert Eich).
+2024. Fix a problem with recent VT switch changes.
+
+XFree86 3.9No (29 November 1998)
+2023. Fix the depth vs bpp mixup in miCreateScreenResources().
+2022. Resync the s3virge driver with most of the updates contained in 3.3.3.
+ This includes GX2 and MX+ support and the set_mclk and set_lcdclk
+ options (#2267, Kevin Brosius).
+2021. Update the cirrus, chips and tseng drivers to use the new colourmap
+ layer (via vgaHWHandleColormaps).
+2020. Add support for automatically adjusting the overscan colour index to
+ the new colourmap layer.
+2019. Disable backing store by default, and provide a "+bs" option to enable
+ it from the command line. This may be done in a better way later.
+2018. Remove the per-depth cfb private indices added in 3.9Nn (#2265,
+ Mark Vojkovich).
+2017. Build cfb with -DSINLGEDEPTH because we don't need the per-depth
+ cfb Screen privates.
+2016. Fix problems with the allocation of the cfbScreenPrivateIndex
+ parameters.
+2015. Remove the offscreen memory manager functions out of the ScrnInfoRec
+ (#2266, Mark Vojkovich).
+2014. Update the s3virge driver to use the new colormap layer, which fixes
+ the VT switch colormap problem (#2264, Kevin Brosius).
+2013. Disable s3virge trapezoid fills since they don't match cfb (#2264,
+ Kevin Brosius).
+2012. Add an ImageWrite function for the s3virge driver, so the pixmap
+ cache support now works (#2264, Kevin Brosius).
+2011. Turn off PCI_RETRY by default in the glint driver, and various other
+ driver updates (#2263, Alan Hourihane).
+2010. Fix a glint driver bug in WritePixmap for TX/MX chipsets (#2263,
+ Alan Hourihane).
+2009. Update the Alpha unaligned access inlines in compiler.h, based on
+ similar code in the Linux kernel (#2240, Matti Aarnio).
+2008. Fix a typo in the C&T driver (#2262, Nozomi Ytow).
+2007. Enable building libraries and clients for for sparclinux (#2261,
+ Christopher Sekiya).
+2006. Define _XOPEN_SOURCE for Linux (#2261, Christopher Sekiya).
+2005. Add the vga copy plane expansion patch to the vgafb code (#2021,
+ Jens Owen).
+2004. -
+2003. Fix a bug in xaaStipple.c which can cause a blitter lockup.
+2002. Fix a C&T bug that causes memory corruption when not in linear mode
+ (#2260, Egbert Eich).
+2001. Only disable C&T transparency blits for HiQV chips below 65550, and
+ fix the display pitch when acceleration is enabled (#2260,
+ David Bateman).
+2000. Conditionally enable ScreenToScreenColorExpandFills for C&T HiQV
+ chips (#2259, 2260, Nozomi Ytow, Egbert Eich).
+1999. Reduce the timeout period for C&T blitter lockups and reset the reset-bit
+ after blitter timeouts (#2260, Egbert Eich).
+1998. Add DDC1/2 support for the C&T driver (not tested) (#2260, Egbert Eich).
+1997. Add a DDC module with DDC1 and DDC2 support for EDID version 1.x,
+ and untested VDIF support (#2259, 2260, Egbert Eich).
+1996. Fix a problem switching from VT back to X when displayPitch
+ != displayWidth (#2260, Egbert Eich).
+1995. Some colormap layer optimisations (#2258, Mark Vojkovich).
+1994. Add some missing micmap symbols to the loader's export list (#2257,
+ Alan Hourihane).
+
+XFree86 3.9Nn (22 November 1998)
+1993. Set the valid gamma range as macros rather than having it hard coded
+ in various places.
+1992. Always refer to and store the gamma values as those of the monitor,
+ not of the correction. This means that the values stored in the
+ ScrnInfoRec are now the same as those entered in the config file and
+ on the command line.
+1991. Fix the colormap layer's handling of static colormaps (#2255,
+ Mark Vojkovich).
+1990. Add XAA acceleration for pixmap->window N deep planar copies (#2254,
+ Mark Vojkovich).
+1989. Add an xf86ChangeGamma() function to the colormap layer (#2253,
+ Mark Vojkovich).
+1988. Have NameCompare() check for NULL pointers (#2252, Rik Faith).
+1987. Port Mark Vojkovich's accelerated line code form Permedia 2 to TX
+ and Permedia 1 chips (#2249, Alan Hourihane).
+1986. Fix mono 8x8 pattern problem for Permedia 1 (#2249, Alan Hourihane).
+1985. Fix glint crash in CloseScreen, and set rgbBits to 8 by default
+ (#2249, Alan Hourihane).
+1984. Fix glint CRTC setting alignment when using 24bpp (#2249,
+ Alan Hourihane).
+1983. Give all cfb private indices unique names so that cfb's for multiple
+ depths can be loaded on the same screen (#2248, 2250, 2251,
+ Mark Vojkovich).
+1982. xterm patch #89, including the completion of double-sized character
+ support (#2247, Thomas Dickey).
+1981. Fix an MGA dashed line clipping bug (#2246, Mark Vojkovich).
+1980. S3virge driver updates, including som acceleration, reinstatement of
+ config options and chip ID changes (#2245, Kevin Brosius).
+1979. Fix some RAC-related problems with the glint driver (#2244,
+ Alan Hourihane).
+1978. Fix some 64-bit problems in some unused driver code (for reference)
+ (#2242, Matti Aarnio).
+1977. Fix a 64-bit alignment problem in cfb8line.c (#2242, Matti Aarnio).
+1976. Fix a typo in Pclose() (#2242, Matti Aarnio).
+1975. Update some Linux-related Imake.cf settings (#2242, Matti Aarnio).
+1974. -
+1973. Cirrus 546x memory interleaving (#2235, Corin Anderson).
+1972. XAA and HW cursor support for the Cirrus 546x series (#2235,
+ Corin Anderson).
+1971. Fix a cirrus 546x clock setting problem that was introduced in 3.9Nm
+ and add a few more predefined dot clocks (#2234, #2235, Corin Anderson).
+1970. Move the generic one-installed-colormap colormap handling functions
+ into micmap.c, remove the use of STATIC_COLOR, update other fb
+ layers to use the micmap functions where appropriate and ensure
+ that they initialise InstallColormap, UninstallColormap, StoreColors
+ and ListInstalledColormaps in their ScreenInit functions. Also move
+ the global InstalledMaps array into micmap.c.
+
+XFree86 3.9Nm (15 November 1998)
+1969. libXv fix (#2233, Michael Schimek).
+1968. Add support for building clients on NetBSD/vax 1.3H (#2231,
+ Chris Sekiya).
+1967. Add an alternate init function for the framebuffer manager. The new
+ one takes a region rather than a box which allows disconnected regions
+ to be managed (#2230, Mark Vojkovich).
+1966. XAA pixmap cache fix (#2229, Mark Vojkovich).
+1965. Add support to XAA for filled rects via ImageWrites (#2227,
+ Mark Vojkovich).
+1964. Preliminary "XAnti" extension for antialiasing (#2224, Mark Vojkovich).
+1963. Fix glint driver coordinates when offscreen (negative) when using
+ colour expansion and the NEGATIVE_X stuff (#2221, Alan Hourihane).
+1962. Add PCI IDs for S3 Trio3D and Savage chips to scanpci and xf86PciInfo.h
+ (#2220, Harald Koenig).
+1961. Add support to XAA for the caching of planar colour expansion data,
+ including an example of how to use it in the mga driver (#2215,
+ Mark Vojkovich).
+1960. Xaw and xedit updates (#2205, Paulo Cesar Pereira de Andrade).
+1959. Provide code to initialise cirrus memory config registers on non-primary
+ cards using config file options (#2202, Itai Nahshon).
+1958. Initial code for Cirrus Laguna I2C/DDC support (#2202, Itai Nahshon).
+1957. Fix some cirrus initialisation errors and MCLK calculation (#2202,
+ Itai Nahshon).
+1956. Synch the cir.h and lg.h files (#2202, Itai Nahshon).
+1955. For newer Cirrus Alpine chips, replace most I/O operations to calls
+ to the vgahw I/O routines, and configure them for MMIO when available
+ (#2202, Itai Nahshon).
+1954. Fix mga G100/200 planemask problem (#2198, Mark Vojkovich).
+1953. Update the mga driver to use the new colourmap layer (#2198,
+ Mark Vojkovich).
+1952. A new colourmap layer (#2197, Mark Vojkovich).
+1951. Redo the lbx colourmap fix in a multihead friendly way (#2196,
+ Mark Vojkovich).
+1950. Make the resource access updates to the glint driver to get it working
+ again (#2177, Alan Hourihane).
+1949. Fix Cirrus 546x big screen modes, 32bpp modes (#2175, Corin Anderson).
+1948. Support for the Cirrus 5464 (5462 remains untested) (#2175,
+ Corin Anderson).
+1947. Fix xf86ValidateModes() to make the maxHeight parameter optional
+ as documented (#2174, Corin Anderson).
+1946. Acceleration for the trident 3DImage/Cyber9388/Cyber9397 chipsets,
+ and accel updates for other trident chips (#2161, Alan Hourihane).
+1945. Implement I2C layer for the trident driver (#2161, Alan Hourihane).
+1944. Add TGUI96xx hardware cursor support (#2161, Alan Hourihane).
+1943. Add some xkb entries for 105 key international PC keyboards (#2157,
+ Matthieu Herrb).
+1942. Enable mode switching for the ViRGE driver (#2156, Kevin Brosius,
+ 2200, Joe Moss).
+1941. Add depths 15,16,24 to the preliminary ViRGE driver (#2156,
+ Kevin Brosius).
+1940. Replace __syscall() with syscall() in Linux/Alpha PCI code (#2211,
+ Matti Aarnio).
+
+XFree86 3.9Nl (1 November 1998)
+1939. xterm patch #88 (#2152, Thomas Dickey).
+1938. Fix some build problems that show up on SunOS 4.1.4.
+1937. Allow the driver to give XAA the definition of a full planemask,
+ with a reasonable default set when it doesn't (#2150, Mark Vojkovich).
+1936. XAA optimisation: when fgPixel == bgPixel draw opaque stipples as
+ solid rects (#2150, Mark Vojkovich).
+1935. Preliminary S3 ViRGE driver conversion (#2148, Kevin Brosius).
+1934. Fix a bug in the LBX extension's colourmap code (#2143, Mark Vojkovich).
+1933. Add base address size and type fields to PciVideoRec (#2141,
+ Egbert Eich).
+1932. Change the PCIInfo entries for NeoMagic chips (#2141, Egbert Eich).
+1931. Some C&T driver updates (#2141, Egbert Eich).
+1930. Add support for the Cirrus 5465 (and 5464, 5462 -- untested)
+ (#2140, Corin Anderson).
+1929. Make the vgahw module a little easier to use by setting its own
+ defaults where appropriate.
+
+XFree86 3.9Nk (25 October 1998)
+1928. Some XAA GC validation bug fixes and optimisations. This includes
+ wrapping pixmap rendering to determine when pixmap cache invalidation
+ is required (#2126, Mark Vojkovich).
+1927. Backout the dix fb,bg planemask manipulation added in a previous version
+ (#2125, Mark Vojkovich).
+1926. Fix an MGA fastblt bug (#2124, Mark Vojkovich).
+1925. Accelerate zero width arcs on MGA (only use for rops other than
+ GXcopy and when PCI retries are enabled) (#2124, Mark Vojkovich).
+1924. Restore default-promotion to the Xdmcp library (#2103, Thomas Dickey).
+1923. Prototype/ansification cleanup for Xserver/XIE, xfs, fontlib, mkfontdir,
+ and fix some bugs found along the way (#2103, Thomas Dickey).
+1922. Set HasPoll to YES for Linux with glibc2 (#2095, Kars de Jong).
+1921. Fix some MGA modeline problems and change the G200 MCLK to 143MHz
+ (#2088, Radislaw Kapitan).
+1920. Move xedit from the contrib tree to the main tree.
+1919. Xaw and xedit updates (see the changelog in the Xaw directory for
+ details) (#2083, Paulo Cesar Pereira de Andrade).
+1918. Add support for BSD 4.4 style long file names in ar archives to
+ the loader (#2066, Matthieu Herrb).
+1917. Some GNU/Hurd config/build updates (#2057, UCHIYAMA Yasushi).
+1916. Do a soft reset for secondary MGA cards prior to probing for the
+ video memory size (#2052, Radislaw Kapitan).
+1915. sigset_t isn't an integer type on NetBSD (and some other OSs) so
+ don't try to print it in xdm (#2048, Matthieu Herrb).
+1914. NetBSD's preprocessor emits a warning when it sees '#ifdef unix',
+ which makes imake noisy (#2048, Matthieu Herrb).
+1913. xterm patches 85, 86, 87 (see xterm.log.html for details) (#2043, 2056,
+ 2097, Thomas Dickey).
+1912. Change "fcd8859-15" to "iso8859-15".
+1911. Some updates to the "dacG" mga reset code, and enable it by default
+ since it helps initialising an inactive secondary G200 (#2032,
+ Radoslaw Kapitan).
+
+XFree86 3.9Nj (11 October 1998)
+1910. Fix the 8+24 overlay's CopyWindow wrapper so that it works properly
+ with "NoAccel" or without hardware planemasks (#2041, Mark Vojkovich).
+1909. Reenable planemasks for SDRAM G200s and disable for all G100 (#2040,
+ Mark Vojkovich).
+1908. Add mga overlay support for the TVP3026 (#2040, Mark Vojkovich).
+1907. Ansifiy and remove most warnings from the Xdmcp library and xdm
+ (#2038, Thomas Dickey).
+1906. xterm patch 84 (see xterm.log.html for details) (#2036,
+ Thomas Dickey, Bjorn Helgaas).
+1905. Enhancements for xedit (#2028, 2033, Paulo Cesar Pereira de Andrade).
+1904. Patch to make editres work properly (#2028,
+ Paulo Cesar Pereira de Andrade).
+1903. Xaw updates (see the changelog in the Xaw directory for details)
+ (#2028, 2033, Paulo Cesar Pereira de Andrade).
+
+XFree86 3.9Ni (6 October 1998)
+1902. Fix miCreateDefColormap() for depth 1.
+1901. Update the "extmod" module of the new extensions.
+1900. Fix some font-related problems introduced by the R6.4 merge.
+1899. Update the cirrus driver for the recent i2c module changes (#2025,
+ Itai Nahshon).
+1898. Initial XAA acceleration for the cirrus driver (#2025, Itai Nahshon).
+1897. Add some option code to do a soft reset when restoring the video state
+ for the "dacG" part of the MGA driver (#2012, Uli Walther).
+1896. Add some TTF encoding files (#2013-2016, Juliusz Chroboczek).
+1895. Resync the FreeType server interface with Xfsft-1.0.2, including
+ code to read encodings from plain text files (#2013-2016,
+ Juliusz Chroboczek).
+1894. Add an "8plus24" option to the MGA driver that turns on overlays when
+ in 32bpp mode. Support is there only for the 1064 and SGRAM G100/G200
+ chips so far (#2024, Mark Vojkovich).
+1893. Fix an MGA dashed line bug (#2024, Mark Vojkovich).
+1892. Add an "mga_sdram" option that turns off block mode and disables
+ planemasks (#2024, Mark Vojkovich).
+1891. Add SGRAM and NonTEText optimisations to the MGA driver (#2024,
+ Mark Vojkovich).
+1890. Add XYPixmap support to XAA (#2023, Mark Vojkovich).
+1889. Preliminary support for depth 8 + 24 mode. Depth 8 currently uses
+ 32bpp pixmaps. Support is included for destructive and non-destructive
+ overlays and driver-chosen transparency key (#2022, Mark Vojkovich).
+1888. Update imake for cpp changes with egcs-1.1 and gcc-2.8.1 (#2017,
+ David Wragg).
+1887. Fix XvQueryAdaptors() when more than one adaptor is present, and
+ export xf86XVScreenInit() to drivers (#2018, Michael Schimek).
+1886. Updates/improvements to the I2C module (#2008, 2018, Michael Schimek).
+1885. Don't include standard system headers when building XIE as a module.
+1884. Cleanup Xlibint.h, which significantly reduces the level of compiler
+ warnings, and also cleanup XIE's error.h (#2007, Thomas Dickey).
+1883. Add support for built-in driver modes (#2006, Egbert Eich).
+1882. Ansify and remove gcc warnings for imake, makedepend, lndir, makestrs,
+ makekeys and mkg3states) (#2005, Matthieu Herrb).
+1881. Introduce a "generic" PCI device (pseudo vendor/devids) for use with
+ the generic vga driver (#1994, Egbert Eich).
+1880. Fix some bugs in the C&T driver (#1994, Egbert Eich).
+1879. Fix an XAA bug with CPU_TRANSFER_PAD_QWORD handling (#1994, Egbert Eich).
+1878. Sanity fix: if all devices of a screen are of type none assume
+ resource type NONE in xf86AddControlledResource() even if specified
+ otherwise (#1994, Egbert Eich).
+1877. Added more support to the resource code for mono devices (for
+ consistency) (#1994, Egbert Eich).
+1876. Add RAC wrappers to the sprite functions (#1994, Egbert Eich).
+1875. Reset xf86Resetting in xf86Init.c (#1994, Egbert Eich).
+
+XFree86 3.9Nh (5 October 1998)
+1874. Temporary workaround to avoid static server build problem introduced
+ in 3.9Ng.
+1873. Import and merge in X11R6.4 and its first three public patches.
+
+XFree86 3.9Ng (27 September 1998)
+1872. Rewrite the XAA NonTE text code, fixing the handling of overlapping
+ characters (#2002, Mark Vojkovich).
+1871. Fix an typo causing a CapNotLast line bug in XAA (#2002, Mark Vojkovich).
+1870. Some updates to the FreeBSD/ELF support, including auto-detection
+ of the binary format.
+1869. Update the Type1 and Speedo fonts.scale files to take advantage
+ of the recent ISO 8859-2 encoding updates (#1995, Juliusz Chroboczek).
+1868. Update drivers to use miCreateDefColormap instead of calling
+ the ones in the fb-specific code, update mfbCreateDefColormap
+ to call the mi version, and remove the xf4bpp version.
+1867. ANSI-related cleanups for the C&T driver, and make use of the
+ LoaderRefSymobols() code to eliminate loader warnings (#1993,
+ David Bateman).
+1866. Fix pixmap cache sizing for C&T DSTN systems (#1993, David Bateman).
+1865. Fix a typo that affected the memory probing for C&T 65550 sysems
+ with 2MB of memory (#1993, David Bateman).
+1864. Let the C&T driver accept '-depth 15' (#1993, David Bateman).
+1863. Reintroduce DirectColor visual support for depth >8 for the
+ Millennium I (#1992, Andrew Aitchison).
+1862. Fixes and cleanups for Linux/Alpha build problems (#1989, 2000,
+ Andrew P. Lentvorski).
+1861. Make some changes to the vgahw MMIO handling for Alpha platforms.
+1860. Cleanup and simply some of the mga driver/dac/clock code (#1991,
+ Radislaw Kapitan).
+1859. Enable mga TVP3026 interlaced cursor (#1991, Radislaw Kapitan).
+1858. Enable the Pseudo-DMA window for the G100 in the mga driver (#1991,
+ Radislaw Kapitan).
+1857. Change some tables in the mga driver to 'const' to help make sure
+ that they are not abused, and fix the code that was abusing them
+ (#1991, Radislaw Kapitan).
+1856. Fix some G200 problems introduced in 3.9Nf (#1988, 1991, Mark Vojkovich,
+ Radislaw Kapitan).
+1855. Fix static server problems caused by item 1851 (based on #1984, 1985,
+ Takaaki Nomura).
+1854. xman improvements for NetBSD/OpenBSD (#1983, Matthieu Herrb,
+ Ross Harvey).
+1853. C&T update for SuperProbe (#1981, Taketoshi Sano).
+
+XFree86 3.9Nf (20 September 1998)
+1852. Update the sample config file to be consistent with the updated format.
+1851. Add a mechanism to allow modules to tell the loader which symbols from
+ from other modules it references, and which of those are essential.
+ This makes it possible to eliminate unnecessary warnings about
+ unresolved symbols, and to trigger a fatal error where appropriate.
+1850. More attempts towards a working G100 server (#1982, Dirk Hohndel).
+1849. Update the mga driver for use with the resource management code.
+1848. Fix some bugs and typos in the resource management code.
+1847. Rework the vgahw module, abstracting the register accesses and split up
+ the save/restore parts.
+1846. Add '\n' to some of the messages in PEXExtensionInit().
+1845. Fix the mga driver's handling of the option register in mga_dac3026.c.
+1844. Trap reentrancy to the FatalError() function and call abort() when
+ this happens.
+1843. Avoid a bug in SunPro C 4.2 (ix86) that shows up when building libPEX5
+ (#1980, David Holland).
+1842. Fix a typo in Xserver/Imakefile (#1979, David Holland).
+1841. Have the Xv DIX layer trap zero size src and/or dest, returning
+ BadValue (#1978, Mark Vojkovich).
+1840. Parially accelerated lines for the Permedia 2 (#1977, Mark Vojkovich).
+1839. Some formatting, bug fix updates to the C&T driver, and reintroduce
+ the screen blanking during initialisation for the C&T drivers
+ (#1976, David Bateman).
+1838. Update the C&T driver to use the RAC wrapper (#1976, Egbert Eich).
+1837. Add a Resource Access Control (RAC) wrapper module which allows
+ colourmap, cursor and fb access to be wrapped when necessary in
+ cases where memory and/or I/O resources are being shared (#1976,
+ Egbert Eich).
+1836. Back out item 1823 (mi bank enable) (#1976, Ebgert Eich).
+
+XFree86 3.9Ne (13 September 1998)
+1835. Remove the OS dependence in the formatting of docs in xfree86/doc/sgml
+ (which removes the need for the BuildAllDocs setting).
+1834. Update mi and dix cursor handling to avoid displaying empty cursors
+ (#1972, Mark Vojkovich).
+1833. Update Xv docs (#1971, Mark Vojkovich).
+1832. Add return values to the Get/Put driver functions in the Xv DDX
+ (#1970, Mark Vojkovich).
+1831. Some preliminary reorganisation of the MGA driver (#1969,
+ Mark Vojkovich).
+1830. Update CURSOR.NOTES (#1968, Mark Vojkovich).
+1829. MGA driver should recognise 15 as a valid depth (#1967,
+ Andrew Aitchison).
+1828. Experimental G100 support for the MGA driver, and fix clock PLL
+ programming (#1966, Radislaw Kapitan).
+1827. Add support for the 9660, 9680 and 9682 chips to the new trident driver,
+ and add some initial acceleration (#1963, Alan Hourihane).
+1826. Fix some planemask test problems at 16bpp with the C&T driver (#1962,
+ Taketoshi Sano).
+1825. Fix a problem with QWORD_PAD in XAA (#1961, David Bateman).
+1824. Fix SuperProbe's detection of some C&T HiQV chipsets (#1960,
+ Taketoshi Sano).
+1823. Update the mi banking code to enable resources as required (#1959,
+ Egbert Eich).
+1822. Update the generic VGA driver to use the new resource control code
+ (#1959, Egbert Eich).
+1821. Restructure the C&T driver, and fix the following:
+ - CRT half-screen blanking
+ - 1bpp mode
+ - several SEGV problems
+ - the long standing LCD blank problem
+ (#1959, Egbert Eich).
+1820. Allow a Device section without a BusID be acceptable for the primary
+ vga device when multiple heads are detected (#1959, Egbert Eich).
+1819. New resource management code, which should provide an improved
+ infrastructure for handling multi-head configuration, particularly
+ where resource sharing is required (#1959, Egbert Eich).
+1818. Fix problems with NonTE ImageText in XAA (#1958, Mark Vojkovich).
+1817. Fix the tseng driver's handling of cases when there is insufficient
+ free memory for acceleration to be used (#1957, Koen Gadeyne).
+1816. Change the RELATIVE_CHECK() macro in xf86Xinput.c to fix a multi-head
+ cursor problem (Chris Bare).
+1815. Update xf86ReadPciBIOS to set the decode enable bit while reading,
+ and update the mga driver to use xf86ReadPciBIOS when appropriate.
+1814. Use mmap for reading the BIOS on more platforms because the
+ lseek/read method doesn't work in many cases when the offset is
+ greater than 2G.
+
+XFree86 3.9Nd (6 September 1998)
+1813. Preliminary port of the trident driver for the ND (the old version
+ has been moved to the olddrivers directory (#1956, Alan Hourihane).
+1812. Document the offscreen memory managers new ResizeArea function
+ (#1955, Mark Vojkovich).
+1810. Allow the FreeType code to be build as an X server font module.
+1809. Add Latin2 support to the Speedo and Type1 font code (#1792,
+ Robert Wilhelm).
+1808. Updates to XFree86 specific parts of FreeType (#1792, 1933,
+ Robert Wilhelm, Juliusz Chroboczek).
+1807. Add the base FreeType 1.1 distribution to /xc/extras/FreeType, and
+ update the build procedure to get the source from there.
+1806. Map the pseudo-DMA transfer window used on newer MGA chips, and use
+ it for solid rects and spans (#1953, Mark Vojkovich).
+1805. Fix C&T HiQV detection (#1952, Taketoshi Sano).
+1804. Add dashed line support to XAA, and update the mga driver to use it
+ (#1951, 1953, 1954, Mark Vojkovich).
+1803. Lots of glint driver updates, including a memclock option to set the
+ mclk, and some more XAA functions for the older Permedia chip (#1950,
+ Alan Hourihane).
+1802. Use POSIX macro S_IS* instead of (((m)&S_IFMT)==S_IF*) and replace
+ "u_long" with "unsigned long" (#1949, UCHIYAMA Yasushi).
+1801. Fix IBM hw cursor pixel ordering (#1948, Alan Hourihane).
+1800. Remove accel/tga and accel/glint directories that are no longer needed
+ (#1947, Alan Hourihane).
+1799. Build support for FreeBSD/ELF (#1946, Doug Rabson, Joachim Kuebart,
+ Ollivier Robert).
+1798. Xaw and Xmu fixes (#1945, Paulo Cesar Pereira de Andrade).
+1797. HW Bresenham line drawing support for Tseng W32p and ET6000
+ (#1944, Koen Gadeyne).
+1796. Fix depth/bpp issues at depth 16 and depth 15 with the IBM support
+ in the ramdac module (#1943, Alan Hourihane).
+1795. Change messages in xf86PruneMonitorModes() so that they appear at the
+ default verbosity level (#1942, Egbert Eich).
+1794. Print out clock ranges or fixed clocks scaled by the mul/div factors
+ (#1942, Egbert Eich).
+1793. MGA G200 support (#1941, Radislaw Kapitan).
+1792. Preliminary I2C module (#1940, Itai Nahshon).
+1791. Add config support for building XFree86 on Linux with DECnet transport
+ (#1939, Eduardo Serrat).
+
+XFree86 3.9Nc (29 August 1998)
+1790. 24bpp (high res display problems) and 32bpp (horizontal stripe) fixes
+ for the mga driver (#1715, 1716, Doug Merritt).
+1789. Take the mga driver's YDstOrg parameter into account when it passed the
+ framebuffer start address to the cfbInitScreen functions. This fixes
+ problems that can show up when using more than 4MB.
+1788. Fix an extraneous pixel drawn for some H/V two point lines with
+ a Millennium I (Mark Vojkovich).
+1787. Make the BuildLinuxDoc* symbols default to YES when HasSgmlFmt is YES
+ (Marc La France).
+1786. Add a resize function to the offscreen memory manager (#1937,
+ Mark Vojkovich).
+1785. Fix C&T 69000 horizontal CRT overflow register settings (#1936,
+ David Bateman).
+1784. Add some missing UnlockDisplay calls to lib/Xv/Xv.c (#1935,
+ Thomas Mueller).
+1783. Fix colourmap save problem (#1935, Thomas Mueller).
+1782. Support for LynxOS 3.0.0 and LynxOS PowerPC fixes (#1935,
+ Thomas Mueller).
+1781. An ND version of the Cirrus driver, currently for 5480 and 5446 chips
+ only. The old driver has been moved to xfree86/olddrivers/cirrus
+ for reference (#1932, 1938, Itai Nahshon).
+1780. Xterm updates:
+ - add configure test to infer if xterm should be installed setuid
+ based on previously installed xterm (reported by Stephen Marley).
+ - integrate/extend patch by Jason Bacon to implement quasi-continuous
+ mouse reporting.
+ - correct control sequences transmitted by function keys F1 to F4
+ when sunFunctionKeys resource is true (it was still using the
+ VT100 control sequences).
+ - modify handling of backarrow key so that the control modifier
+ toggles the backspace/delete interpretation set by the
+ backarrowKey resource.
+ - limit the row and column values used to report mouse position.
+ (#1931, Thomas Dickey).
+1779. Fix clockRanges alloction problem in the tseng driver (#1927,
+ Koen Gadeyne).
+1778. Fix tseng banked accelerated mode, and disable ImageWrite in banked
+ mode if it requires more than 8k (#1927, Koen Gadeyne).
+1777. Some initial ET4000W32p acceleration (#1927, Koen Gadeyne).
+1776. Fix 24 and 32bpp tseng modes for cards with programmable clocks
+ (#1930, Koen Gadeyne).
+1775. Implement the pci_retry and Memclk options for the MGA driver (#1927,
+ Mark Vojkovich).
+1774. Update the mga driver to use MMIO for everything (making use of the
+ MMIO support in the vgahw module), and do its own colourmap handling
+ (#1927, Mark Vojkovich).
+1773. Add a MMIO version of the vgahw code to the vgahw module (#1926, 1928,
+ Mark Vojkovich).
+1772. Small Xv DDX udpate (#1925, Mark Vojkovich).
+1771. Update the C&T driver to use the new ClockMulFactor code (#1924, 1936,
+ David Bateman).
+1770. Add a ROP_NEEDS_SOURCE option to XAA, as needed by the C&T driver
+ (#1924, David Bateman).
+1769. Add support to the tga driver for 24 plane cards (#1923, Tim Rowley).
+1768. Resync the scale[] find_scale[] arrays in the bitmap font code, which
+ got out of sync when gzipped font support was added (#1921 Doug Ridgway).
+1767. Fix incorrect #ifdef in sunKeyMap.c for Danish Type 5 Sun keyboards
+ (#1919, Erik Bertelsen).
+1766. Move HW cursor support from the XAA module to the ramdac module,
+ update drivers for this change, move IBM cursor code from the glint
+ driver to the ramdac module, and intergrate the HW cursor code fir
+ the IBM ramdacs using a new helper function in the ramdac module.
+ (#1918, Alan Hourihane).
+1765. Fix some more compiler.h problems for AXP platforms (#1918,
+ Alan Hourihane).
+
+XFree86 3.9Nb (20 August 1998)
+1764. Fix some memory leaks in Xlib that happen on realloc failures
+ (#1914, ??)
+1763. Optimise the way C&T acceleration is handled by reorganising
+ some of the graphics primitives, including caching foreground and
+ background colours, and moving some operations from the Subsequent
+ primitives to the Setup primitives (#1915, David Bateman).
+1762. Introduce HW cursor for the Permedia2 (but p2 and p2v dont' work
+ yet), fixup pm2v_dac and pm2_dac register naming, and add reset
+ logic to reset the accelerator (but not used yet) (#1912,
+ Alan Hourihane).
+1761. Fix building in xfree86/common when XINPUT is not defined (Egbert Eich).
+1760. Fix problem compiling xf86_IlHack.c on Alpha platforms.
+1759. Add an option "ShowOverscan" to the vgahw module which makes the
+ unblanked area of overscan clearly visible.
+1758. Adjust the builtin mode for the 8bpp generic vga driver to blank as
+ much of the overscan area as possible.
+1757. Adjust the horizontal blank end value in the vgahw module to avoid
+ excessive blanking for most chipsets when running in generic vga mode.
+1756. Tseng driver updates, including:
+ - Add support for chips with a set of discrete clocks instead of a
+ programmable clock.
+ - use the new ClockRanges code to auutomatically select between pixmux
+ and normal modes, and for 24bpp clock scaling.
+ - add a replacement for vgaHWBlankScreen() that doesn't do a
+ sequencer reset.
+ - remove some old, unused code.
+ (#1910, Koen Gadeyne).
+1755. Loader updates required for the updated gdb (#1908, Paul Flinders).
+1754. Add VSTATUS control char support to xterm (#1907, Robert Earl).
+1753. Update the register probing of the chipset for the C&T HiQV chips
+ in SuperProbe and the C&T driver (#1904, David Bateman).
+1752. Add cached screen to screen colour expansion to the C&T driver
+ (1904, David Bateman).
+1751. Add options to XAA to allow acceleration primitives to be disabled
+ individually (#1903, David Bateman).
+1750. Add preliminary solid Bresenham and two point line support for XAA,
+ and code to make use of it for the mga driver (#1900-1902,
+ Mark Vojkovich).
+1749. Introduce Helper functions for ramdac module, Save/Restore/SetBpp,
+ and update the glint and tga drivers to use them (#1899, 1913,
+ Alan Hourihane).
+1748. Move IBM640 code from the glint driver intot he generic ramdac module
+ (#1899, Alan Hourihane).
+1747. Add ClockMulFactor and ClockDivFactor fields to clockRanges to allow
+ for scaling of clocks when doing mode validation (#1898, 1905,
+ Koen Gadeyne, 1906, Itai Nahshon).
+1746. Add recognition of the Voodoo 2 to the PCI list (#1897, Koen Gadeyne).
+1745. Some editres, xedit and xgc updates (#1788, 1842,
+ Paulo Cesar Pereira de Andrade).
+1744. Lots of Xaw/Xmu updates (including ansification of Xaw and Xmu) --
+ see the Changelog in xc/lib/Xaw for further details (#1776, 1788, 1842,
+ Paulo Cesar Pereira de Andrade).
+1743. Support for GNU/Hurd (#1895, UCHIYAMA Yasushi).
+1742. Remove the implicit assumption in some areas that O_RDONLY is 0
+ (#1894, UCHIYAMA Yasushi).
+1741. Merge in Metro Link's version of the 64 bit select fixes for the
+ X server and lbxproxy (#1893, Stuart Anderson).
+1740. Set DlLibrary to be empty for OpenBSD, and remove formatted man pages
+ on 'make clean' for OpenBSD and NetBSD (#1892, Matthieu Herrb).
+
+XFree86 3.9Na (14 August 1998)
+1739. Rework the way the maximum number of server client connections
+ is determined, and experimentally increase MAXCLIENTS to 256.
+1738. Enable mmap support in Xvfb for Linux (#1889, Douglas Ridgway).
+1737. Xv DDX layer for XFree86, and add documentation for it to the DESIGN
+ doc (#1883, 1884, Mark Vojkovich).
+1736. Modify AddScreen() and AllocateScreenPrivateIndex() to initialise new
+ screen devPrivates to zero.
+1735. Ansify the Xv server dix code (#1881, Mark Vojkovich).
+1734. XAA doc update (#1880, Mark Vojkovich).
+1733. Cache the fg, bg and planemask values in the MGA driver and only
+ change them when needed (#1878, Mark Vojkovich).
+1732. Preliminary ImageRead support for the MGA driver (disabled) (#1879,
+ Mark Vojkovich).
+1731. Preliminary ImageRead support (#1878, Mark Vojkovich).
+1730. Use accelerated ImageWrites for PutImage and BackingStore and SaveUnder
+ pixmap restores (#1878, Mark Vojkovich).
+1729. Fix an XAA text rendering bug for rotated text (#1878, Mark Vojkovich).
+1728. Tseng driver updates:
+ - Add DPMS support
+ - Replace some Boolean options with Tristate options
+ - Add ET4000W32p support and the ICS5341 16-bit ramdac support
+ - 1bpp and 4bpp support added (1bpp doesn't work yet)
+ - cleanup mode validation code
+ (#1877, Koen Gadeyne).
+1727. Fix problems using ffs() in the X server on 64bit platforms
+ (specifically Linux/Alpha) (#1876, Raphael Finkel).
+1726. Fix for palette problems with the BT ramdac support in the ramdac
+ module (#1873, Alan Hourihane).
+1725. Export the symbols __remq and __remqu from the loader for Alpha
+ platforms (#1872, Alan Hourihane).
+1724. Fix a 24/32bpp problem with the IBM code in the ramdac module
+ (#1871, Alan Hourihane).
+1723. Change the way the depth/bpp/fbbpp values are selected form the
+ command line and config file to prevent inconsistently mixing values
+ from the two sources (#1868, Alan Hourihane).
+1722. Fix some XAA hw cursor problems:
+ - Apply the HARDWARE_CURSOR_INVERT_MASK flag only after applying
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+ - Fix the 1-bit interleaving code
+ (#1867, Koen Gadeyne).
+1721. Remove all the (currently unused) colour expansion code from
+ the old branch that replaced some XAA functions. This should no
+ longer be necessary (#1866, Koen Gadeyne).
+1720. Add XAA hw cursor support for the ET6000 (#1866, Koen Gadeyne).
+1719. Fix some problems that showed up with the glint driver when
+ using a P2 and TX500 card together (#1861, Dirk Hohndel).
+1718. Have the glint driver remove all but one mode since the chipset
+ doesn't support panning (#1859, 1870, Alan Hourihane).
+1717. Update the loader to correctly identify dll ELF modules (#1858,
+ Itai Nahshon).
+1716. Fix an infinite loop in the xf86Config code that can happen with a
+ config file error (#1858, Itai Nahshon).
+1715. Resync the TGA driver with changes elsewhere (#1856, 1874,
+ Alan Hourihane).
+1714. Glint driver updates, including:
+ - HW cursor for IBM 526 and 640 ramdacs
+ - Depth 30 support for the IBM 640
+ - GLINT MX (ELSA Gloria XL) support
+ - More acceleration for the TX/MX chipsets
+ - Fixes for Alpha platforms
+ - Major acceleration updates for Permedia, Permedia2, 500TX and MX chips
+ - Permedia 2v cleanups
+ (#1855, 1857, 1860, 1863, 1864, 1865, 1890, Alan Hourihane).
+1713. Add support for depth 30 to xf86SetWeight() (#1854, Alan Hourihane).
+1712. Reinstate the ONLY_LEFT_TO_RIGHT_BITBLT and ONLY_TWO_BITBLT_DIRECTIONS
+ XAA options (#1853, Alan Hourihane).
+1711. Add support for the IBM 640 ramdac to the ramdac module (#1852,
+ Alan Hourihane).
+1710. Add finer grained offscreen memory management for the accelerator
+ to the Tseng driver to allow as many acceleration features to be
+ enabled as can be supported by the available offscreen memory
+ (#1851, Koen Gadeyne).
+1709. Add XAA scanline colour expansion, screen-to-screen colour expansion,
+ 8x8 colour pattern fills, ImageWrite to the Tseng driver (#1851,
+ Koen Gadeyne).
+
+XFree86 3.9N (2 August 1998)
+1708. Fix some XAA problems (#1850, Mark Vojkovich and Koen Gadeyne).
+1707. Rename some of the XAA colour expansion stuff, and update the XAA docs
+ (#1848, 1849, Mark Vojkovich).
+1706. Tseng driver updates (#1847, Koen Gadeyne):
+ Add Mclk support, replace globals in tseng_bank.c with entries
+ in the TsengRec, remove redundant parameter passing, fix a potential
+ bug in the ET6000 memory detection code, implement memory limit
+ checking, fix a bug in the 555/565 handling, cleanup locking/unlocking
+ code.
+1705. Some fine tuning of the way the extension modules are build.
+1704. Merge in the new design branch. A full changelog for the new design
+ branch can be found in the CHANGELOG.ND file.
+1703. Font-related X server buffer overflow fixes (Robin Cutshaw).
+
+XFree86 3.9Ak (11 July 1998)
+1702. xterm patches 81 and 82. Fix Linux/Alpha build problems,
+ utmp handling on Solaris, some terminfo nits, and improve
+ cursor colour (#1794, 1797, Thomas Dickey).
+1701. Fix CloseScreen() related problems (#1793, Marc La France).
+1700. Close some sockets that xdm was leaving open when running new
+ sessions (#1704, Matthieu Herrb).
+1699. Fix usleep problems with static servers on SVR4.
+1698. Fix a problem parsing "ModeLine" entries (#1779, Keldon Jones).
+
+XFree86 3.9Aj (04 July 1998)
+1697. PC98 fix for VT switching, VideoBoard98 update (#1766, Takaaki Nomura).
+1696. xterm patches 79 and 80. Fix for F1-F4 key handling, fg/bg pixel
+ value with -flipPixels, scrollbar color, keypad handling, and
+ various terminfo enhancements (#1758,1762 Thomas Dickey).
+1695. Lots of Xaw work. See xc/lib/Xaw/Changelog for details
+ (#1660, 1673, 1678, 1686, 1701, 1738, 1752, 1755, 1765
+ Paulo Cesar Pereira de Andrade).
+1694. Add the library security fixes (#1722).
+1693. Fix rendering errors in the generic bit expansion code (#1746,
+ Jens Owen).
+1692. Fix problem in Oak clock setting routines (#1744, Kevin Buhr).
+1691. Clean up vga16 (remove unused code, remove vga16's mfb (vga2 is used
+ instead), clean up vga16's external name space). Minor fix to ATI
+ driver. (#1742, Marc LaFrance).
+1690. Fix macro expansion in xf86Config.c (#1730, Jens Maurer).
+1689. On Linux, default the use of special or internal malloc's to NO
+ (instead of forcing it to NO). Allow CloseScreen to free wrapper
+ private storage in most servers. Push out backing store initialisation
+ to the callers of the various <framebuffer>ScreenInit()'s. Change
+ m68k's XF68_FBDev to use backing store low-level functions to
+ save/restore the screen during VT switches. Minor fixup to loader
+ message. (#1719, Marc La France).
+1688. Fixes for 24bpp and 32bpp on Matrox Millenium II. This fixes the
+ horizontal stripe for modes using > 4MB (#1715,1716, Doug Merritt).
+1687. Fix build problems on LynxOS and enable keyboard LEDs on LynxOS 2.5.1
+ (1712, Thomas Mueller).
+
+XFree86 3.9Ai (05 June 1998)
+1686. Add rendition directory. This is not included in the build process, yet
+ (#1707, Marc Langenbach).
+1685. Make glint compile on Alpha. Some xtest fixes for Alpha (#1705,
+ Christian Worley).
+1684. xterm patch 77,78, convert to ANSI C (#1702,1706 Thomas Dickey).
+1683. Fix compile problems under OS/2 (#1693, Holger Veit).
+1682. Fix xmag segfault (#1675, Andy Sloane).
+1681. Fix build problem of the static servers on FreeBSD. Fix build problem
+ on SVR4(incomplete). Update PC98 Card Database(#1691, Isao Ohishi,
+ Takaaki Nomura).
+1680. Minor fix to ATI driver clock code. Fix vga16 for xtest-detected
+ problems. Fix up vga16's pixmap printing when enabled by DEBUG. There's
+ no need for XFree86LOADER specifics in mibitblt.c(#1690, Marc La France).
+1679. Fix hw cursor on CT65555 and fix loader problem (#1688,1689 Nozomi Ytow).
+1678. Fix freeing of names when removing modes (#1685, Matthieu Herrb).
+1677. Enable ImageWrite in 24 bpp for C&T HiQV (#1684,1687 Nozomi Ytow).
+1676. Fix unknown symbol type 1e message in a.out loader (#1683,
+ Matthieu Herrb).
+1675. xterm patches 75 and 76. Fix for print-window function, minor cleanups,
+ lots of fixes from other people (see xterm.log.html) (#1681,1682,
+ Thomas Dickey).
+1674. Make vga16 use backing store functions to save/restore the screen on VT
+ switches. Don't call xf86InvalidatePixmapCache when bpp is 1 or 4
+ (#1680, Marc La France).
+1673. Change PIC code to print names of ALL devices capable of displaying
+ video. Return pointer to the last card instead of the first (#1662,
+ Dejan Ilic).
+1672. Add skeleton driver for Tritech Pyramid 3D (#1661, Dejan Ilic,
+ Mark Vojkovich).
+1671. Check additional pci bus in scanpci (Robin Cutshaw).
+
+XFree86 3.9Ah (28 April 1998)
+1670. Xterm patch 74 fix define conflicts and update print support (#1674,
+ T.E.Dickey).
+1669. Xterm patch 73 added print window facility, terminfo updates,
+ conditional include cleanup, debugging trace enhancements, and
+ HP-UX configure updates (#1672 T.E.Dickey).
+1668. Framebuffer fixes leaving valid GC on exit, fix for opaque types
+ (#1669 Marc Aurele La France).
+1667. Add ELF support for AXP platform (#1666 Stuart Anderson).
+1666. PCI function fixes for AXP platform (#1665 Alan Hourihane).
+1665. SiS updates (#1664 Mike Chapman, Mitani Hiroshi).
+1664. Fix CompressAllFonts define use in X11.tmpl (#1663 Matthieu Herrb).
+1663. Xaw updates including more functions for diaplayLists, fixes
+ for simpleMenuWidget, boxWidget, and panedWidget (#1660 Paulo Cesar
+ Pereira de Andrade).
+1662. Xdm seg fault fix (#1658 Matthieu Herrb).
+1661. Tseng PIXMUX updates (#1656 Krajcsovits Gyorgy).
+1660. Mouse driver loop restructuring and additional packet data
+ checks (#1654, Oyvind Aabling).
+1659. PANIX build fix for PC98 platform (#1653, Satoshi Kimura).
+1658. Sync loss on cursor change fix (#1650, Mark Vojkovich).
+1657. Driver line fix, unresolved symbol fix, remove loading of xaavga256
+ at depths greater than 8, glint 24bpp fix (#1645-1649 Alan Hourihane).
+1656. More XF86Setup patches, P9000 symbol fix, PC98 Imakefile sync (#1644
+ Takaaki Nomura).
+1655. Tseng doc, accel sync with 3.3.2, PIXMUX and misc fixes (#1641,1642
+ Koen Gadeyne).
+1654. ISC fix for usleep and glint probe fix for DELTA (#1639,1640 Michael
+ Rohleder).
+1653. Add FreeType code to lib/font/FreeType, but the build-related
+ things haven't been done yet (David Turner, Robert Wilhelm,
+ Werner Lemberg, Mark Leisher, Juliusz Chroboczek).
+1652. Xterm patch 72 activity notification enhancement (#1659, T.E.Dickey).
+1651. Xterm patch 71 buffer overflow fix (#1651, T.E.Dickey).
+1650. Sync I128 server acceleration with 3.3.2 (Robin Cutshaw).
+
+XFree86 3.9Ag (05 April 1998)
+1649. AGX ScrnInfoRec fix, fix compiler warnings for Xprt and loader,
+ fix vgaCloseScreen problem, add new ScreenRec functions to
+ set/get pixmaps and wrapper functions, VC switch to use
+ low-level backing store functions (#1635, Marc Aurele La France).
+1648. xfree98/XF86Setup sync with 3.3.2 (#1632, Takaaki Nomura).
+1647. xfree86/XF86Setup sync with 3.3.2 (#1629,1634 Kazutaka Yokota).
+1646. Back out the following R6.4-related changes:
+ #1169, 1170, 1342 -- version numbering changes,
+ #1167 -- CUP extension,
+ #1225, 1282, 1341 -- EVI extension,
+ #1171-1178, 1198, 1246, 1305 -- Xinerama extension,
+ #1165 -- Xt Resource Configuration Management.
+1645. XAA fixes for xf86bpp (#1633, Alan Hourihane).
+1644. More 3.3.2 syncs, PC98 sync, usleep problem with FreeBSD,
+ SVR4.0 build problem fixes (#1631, Takaaki Nomura).
+1643. Kensinngton Thinking and Expert Mouse fix (#1630, Kazutaka Yokota).
+1642. S3 968 fix (#1628, Kazutaka Yokota).
+1641. Add DoImageWrite for Permedia2 and partial 24bpp acceleration to
+ the glint server (#1627, Alan Hourihane).
+1640. ISC sync with 3.3.2 (#1625,1626, Michael Rohleder).
+1639. Xterm patch 70 including Imakefile fix for logging, "ich"
+ restoration, cursor color fix, "-vb" arg fix, character-set
+ rework, SS2/SS3 control fix, terminfo updates (#1624, T.E.Dickey).
+1638. Add loader symbol for miSetZeroLineBias (#1623, Mark Vojkovich).
+1637. Fix duplicate symbols in s3 server (#1621, Takaaki Nomura).
+1636. glint cleanup for XAA autoload modules (#1620, Alan Hourihane).
+1635. xf86Config fixes for svga and accel servers, extmod load for all
+ depths (#1618,1619, Alan Hourihane).
+
+XFree86 3.9Af (28 March 1998)
+1634. Add 1024x600 to the identified video modes in the chips server
+ (#1617, Nozomi Ytow).
+1633. Resync xfree98 with xfree86 and resync some PC98 files with 3.3.2
+ (#1616, Takaaki Nomura).
+1632. Fix micro typo in chips.sgml (#1615, David Bateman).
+1631. Define defaults for XF86Config file locations. Have make World remove
+ Makefile.bak files. Resync ScrnInfoRec's for the last time (Hope
+ springs eternal). "Externalise" InstalledMaps in all XFree?? servers.
+ Remove reference to DEFAULT_MODULE_PATH in static servers. Deal with
+ some of the warnings produced by gcc by default. Resync ATI driver with
+ the version found in XFree86 3.3.2. Fix loader bug in dealing with XAA.
+ (#1614, Marc La France).
+1630. Don't abort a static server if the Driver statement in the Device
+ section is missing (#1613, Kazutaka Yokota).
+1629. Fix typo in #1606 and improve printing of mouse related messages
+ (#1613, Kazutaka Yokota).
+1628. Build fixes for static S3 and S3V servers (#1613, Kazutaka Yokota).
+1627. Re-add 8x8 trap fill support in XAA (#1612, Mark Vojkovich).
+1626. Add new text replacements to glint server, add packed data modes, tune
+ fifo handling, fix drawing bugs and others (#1609,1611, Mark Vojkovich,
+ Alan Hourihane).
+1625. Add mouse related 3.3.2 changes to XF86Setup (which still doesn't
+ compile) (#1608,1610, Kazutaka Yokota).
+1624. Update xdpyinfo to reflect mouse code changes (#1607, Kazutaka Yokota).
+1623. Merge missing mouse code from 3.3.2 (#1606, Kazutaka Yokota).
+1622. Resync xterm, add missing patches from 3.3.2 (#1605, Thomas Dickey).
+
+XFree86 3.9Ae (22 March 1998)
+1621. Bring over some of the new mouse code from the 3.3.2 tree.
+1620. Link X11 apps against libxpg4 on FreeBSD to get multibyte locale
+ support.
+1619. SVGA/chips. include support for the new 69000 chipset. Fix up the
+ memory probing for the 65554, 65555 and 68554 chips. Add probing for
+ the 64200, 64300 and 69000 chips to SuperProbe. Fix the memory probing
+ for the 65554, etc in SuperProbe. Some docs updates (#1603,1604,
+ David Bateman).
+1618. Fix Mach32 text restoration (#1601, Marc La France).
+1618. Add Rendition V2x00 to vgaPCI.h (#1598, Marc Langenbach).
+1617. xterm patches. improve test for highlightColor so that xterm does not
+ attempt to use that unless it is different from the foreground and
+ background colors. remove ich and ich1 from xterm and xterm-8bit
+ terminfo descriptions. restore 1-pixel overlap of scrollbar border with
+ left edge of window. add a configure option, --enable-logfile-exec.
+ make the ALLOWLOGFILEEXEC code compile & run, if configured. minor
+ documentation nits. correct the problem in xterm with utmp by removing
+ the reset of setuid/setgid before the main event loop (#1525,1571,1599,
+ Thomas Dickey).
+1616. Change s3/svga from using 8x8 pattern fills to 8x8 color expand fills.
+ Add support for S3's type planar 8x8 pattern fills to XAA. Add support
+ for S3's planar 8x8 fills to the XAA stippled trapezoid stuff
+ (#1594,1595,1596,1597, Mark Vojkovich).
+1615. Ensure the correct message for lines at startup (#1591, Alan Hourihane).
+1614. Fix XAA to allow vertical lines using TwoPointLine (#1590,
+ Alan Hourihane).
+1613. Change the xf86orect.c code to always use a hardware filled rect rather
+ than a software one when drawing vertical lines (#1589, Mark Vojkovich).
+1612. Add MICROSOFT_ZERO_LINE_BIAS flag to xaa to indicate that the hardware
+ uses MicroSoft's line bias rules rather than X's. Fix the end point
+ sematics for two point lines. Add TiledFilled Rects via image write.
+ Fix a problem with the CopyArea wrapper syncing when it shouldn't. Fix
+ twopoint line problems with XAA dashed lines. Make sure we alway check
+ for one rect situations when using XAA polygon code (#1575,1576,1577,
+ 1578,1579,1580,1581, Mark Vojkovich).
+1611. Add new MGA acceleration, including image writes and 8x8 pattern trap
+ fills. Go back to two point lines. Add solid filled span replacement.
+ Make PCI retries off for mga by default (need Option "pci_retry" to turn
+ them on). Make hardware cursor work better in doublescan modes. And
+ turn hw cursor on by default (#1582,1583,1592 Mark Vojkovich).
+1610. Removes assumption that we have a Trapezoid function (#1573,
+ Alan Hourihane).
+1609. Fix ImageWrite code at 15bpp by fixing xaa not to rely on xf86bpp, but
+ use the accel structure (#1572, Alan Hourihane).
+1608. Fix problem building resize on BSDI, update manpages, add log
+ xterm.log.html (#1490, Thomas Dickey).
+1607. Small patch to xterm's 8-bit terminal description (#1481, Thomas Dickey).
+1606. Move framebuffer ModuleInit functions to separate C source files.
+ Another fixup to mono's ScrnInfoRec (#1474. Marc La France).
+1605. Loader updates (#1467, Stuart Anderson).
+1604. Ensure window and GC privates are aligned on a sizeof(long) boundary.
+ Minor bug fix to mfb and afb framebuffers. Reinstate building of Xibm
+ server. Move pRotatedPixmap, pCompositeClip, fExpose, freeCompClip from
+ GC privates to the GC structure proper (in preparation for the banking
+ mi wrapper) (#1442,1443,1444,1445,1588 Marc La France).
+1603. xterm fixes for configuration (#1437, Bjorn Helgaas).
+1602. Lots of SVGA/ATI updates. Enforce architectural limits on panning &
+ scrolling. Duplicate recent XF86_Mach64 changes (Bus detection, Chipset
+ detection adjustments, Support for 16MB linear apertures, maxClock
+ settings). First swipe at supporting adapters whose VGA has been
+ disabled. Save and restore more registers on mode
+ entries/switches/exits. Colour map initialization changes to make use
+ of uninitialized entries more obvious. Bug fix to DSP register
+ calculation. Support 15, 16, 24 and 32bpp on integrated controllers.
+ Remove dependence on TimingTab. Include VGA DAC registers in verbose
+ output. Skip sparse I/O probes when PCI configuration space indicates a
+ device has registered a block I/O base. Virtual X rounding adjustments
+ for packed modes. Documentation updates (#1430, Marc La France).
+1601. Clean up ScrnInfo, make vgaCloseScreen call the framebuffer's
+ CloseScreen() function, determine more pricely whether the virtual
+ resolution fits in video memory, minor optimization of cfb's
+ ImageGlyphBlt entry (#1428,1429, Marc La France).
+1600. Fix typo in mga.h (#1418, Tim Rowley).
+1599. Fix some baserom/_baserom confusion (#1407, Gary Barton/Concurrent).
+1598. More fixes from Metro Link and some updates for clients. Remove
+ all but one copy of sdimple.c (#1405,1406, Craig Groeschel).
+1597. Remove unnecessary byte_reversed arrays (#1400, Craig Groeschel).
+1596. Add missing Xarch.h (#1399, Craig Groeschel).
+1595. Add no-listen keyword to xfs (#1397, Topi Miettinen).
+1594. Build fixes for PC98 static build (#1391,1396 Takaaki Nomura).
+1593. Build fixes to loader directory (#1388, Alan Hourihane).
+1592. Some Link Kit fixes (#1384, David Bateman).
+1591. Add zoom initialization and fix blits on T2R (Robin Cutshaw).
+1590. Add support for several new mice, including Kensington ThinkingMouse,
+ ALPS GlidePoint, Genius NetScroll, Genius NetMouse, Genius NetMouse,
+ ASCII MieMouse, Logitech MouseMan+, Logitech FirstMouse+ (#1380,
+ Kazutaka Yokota).
+
+XFree86 3.9Ad (25 January 1998)
+1596. Fix two buffer overflow problems in the X server.
+1595. Fix some libXt VSW5 failures (#1347, 1359-1363, 1365, Kaleb Keithley,
+ Arthur Barstow).
+1594. Change server's default vendor string and release (#1342,
+ Kaleb Keithley).
+1593. Fix problem entering mode_shifted characters with xdm and XKB
+ (#1340, Kaleb Keithley).
+1592. Bump SunOS 4.x libXext rev (#1339, Kaleb Keithley).
+1591. Pick up PCI multimedia/video devices and display devices of all
+ subclasses (not just VGA) in vgaGetPCIInfo().
+1590. Reinstate Xserver/hw/ibm for reference purposes.
+1589. Cirrus and vga256 driver changes to support the PowerPC machines.
+ (1357, Gary Barton/Concurrent).
+1588. Organize xf86_ansic.h/xf86_libc.h/xf86_OSlib.h, and de-mangle xf86*
+ libc calls. Move Probe routine to the beginning of the ScrnInfoRec to
+ match the vgaVideoChipRec. Make the mach32, mach64, mach8, i128, and
+ ibm8514 servers loadable. Use one global byte_reversed array. When
+ SetCursor is called with a null CursorPtr, turn the cursor off. Fix
+ CapNotLast lines and segments in mach64 and xaa. Copy some code from
+ Metro-X 3 to handle panning at 24 bpp on Mach64. Mask the correct
+ number of pitch bits when updating the CRTC_OFF_PITCH register. Use
+ xf86scanpci instead of vgaPCIInfo. Fix tseng driver DPMS bug. Declare
+ and initialize xf86PixmapIndex. (#1356, Craig Groeschel/Metro Link).
+1587. Add xf86Serial functions (#1355, Chris Bare/Metro Link).
+1586. New config file parser, new functions for accessing xf86Info,
+ handle an XQUEUE race condition, make sure XqueQaddr is initialized
+ (1353, Stuart Anderson/Metro Link)
+1585. Build cleanups and fixes to cursor handling for multi screen layout
+ (#1354, Craig Groeschel/Metro Link).
+1584. Add portable and extensible PCI support framework (#1352,
+ Gary Barton/Concurrent).
+1583. Support PowerMAX_OS on Motorola/Concurrent PowerPC machines
+ (#1351, Gary Barton/Concurrent).
+1582. .cf and Imakefile changes to use PpcArchitecture and PpcSvr4Architecture
+ definitions for consistency (#1350, Gary Barton/Concurrent).
+1581. Fix 9397 detection in Trident driver (#1376, Alan Hourihane).
+1580. Add support for the DacSpeed entry to the Mach64 server (#1375,
+ Kevin Martin).
+1579. Fix 16bpp for the Permedia 2 (#1373, Alan Hourihane).
+1578. Fix DPMS for Trident cards (#1372, Alan Hourihane).
+1577. Add Option "no_pci_retry" to option code and the MGA driver (#1370,1371,
+ Mark Vojkovich).
+1576. Add back CyberCont that was removed from Trident driver in 3.9Ac by
+ mistake (#1369, Alan Hourihane).
+1575. Fix ImageWrite code to not read beyond the end of the source in cases
+ of bad alignment (#1368, Mark Vojkovich).
+1574. xterm updates (#1366,1378 Thomas Dickey) including:
+ - change the terminfo entry so that rs1 does a hard reset
+ - modify treatment of hard reset by the xterm program to reset the saved
+ lines
+ - correct hard reset by also resetting user-defined keys.
+ - change the way highlihting is implemented
+1573. Fix PutImage to work with Rops other than GXcopy (#1364, Alan Hourihane).
+1572. Fix clipping in 16bpp on tgui chipsets, fix 32bpp and add transparency
+ (#1345,1346,1349 Alan Hourihane).
+1571. Some updates to stub driver to reflect current layout (#1343,
+ Dejan Ilic).
+1570. Change xdm config to explicitly specify the VT used on OpenBSD (#1337,
+ Matthieu Herrb).
+1569. Build fix for P9x00 driver (#1336,1344 Takaaki Nomura).
+1568. Resync xaa/Imakefile for PC98 (#1335, Takaaki Nomura).
+
+XFree86 3.9Ac (11 January 1998)
+1567. Fix some VSW5 failures in libXt (#1333, Kaleb Keithley).
+1566. xterm updates (#1332, Thomas Dickey) including:
+ - Add xterm support for blinking text. It doesn't actually cause the
+ text to flash, but text with the blink attribute can be displayed in
+ color, using new resources colorBL and colorBLMode.
+ - Corrected a missing save-cursor in the handling of SGR 1048.
+ - Flush the output of the transparent printing after each line.
+ - Correct the modes that are affected by save/restore cursor.
+ - Corrected placement of one of the XSync calls which had the
+ side-effect of writing on the window border when the xterm was
+ resizing from 132 to 80 columns.
+ - Work around an incompatibility of the XKB definition used in xterm
+ versus that symbol from IRIX 6.2's imake definitions (by adjusting
+ the standalone configure script).
+1565. Add detection of Intel TX chips and Pyramid 3D TR25202 to scanpci
+ (#1330, Dejan Ilic).
+1564. Fix xtest related problems on MGA (related to syncing before reading)
+ (#1329, 1334, Mark Vojkovich).
+1563. Possible fix for Millennium II crashing (#1328, Mark Vojkovich).
+1562. Add more careful checking of $HOME/.xsession in the default xdm
+ Xsession script (#1327, Geoff Wing).
+1561. Fix uninitialised variables in decddx (#1326, Kaleb Keithley).
+1560. Fix a typo in the Xlib docs (#1325, Kaleb Keithley).
+1559. Add 8x8 pattern filled 1 rect polygons to XAA. Also included is
+ an 8x8 pattern filled trapezoid function (#1324, 1331, Mark Vojkovich).
+1558. Add more conservative limits for when XAA uses trapezoid fills rather
+ than spans (#1323, Mark Vojkovich).
+1557. Add transparent 8x8 pattern fills to s3/svga (#1322, Mark Vojkovich).
+1556. Xt (VSW5 failures): Xt11/XtCallConverter - Test Purposes 11, 12, 13
+ (#1321, Kaleb Keithley).
+1555. Xt: XtMakeGeometryRequest doesn't emit error if parent != composite
+ (#1320, Kaleb Keithley).
+1554. S3 (svga) ramdac fixes in IBMRGB52x_Init, TI_3020_3025_Init,
+ NORMAL_PreInit, and ATT_409_498_Probe routines, including fixes for
+ the use of the dacSpeeds array (#1319, Craig Groeschel/Metro Link).
+1553. Fixes for Permedia PM2 support to correct 32bpp, and improve things
+ for 16bpp (#1318, Alan Hourihane).
+1552. P9x00 driver (#1317, Joerg Knura).
+1551. Allow xvidtune to be driven by the keyboard (#1315, via Kaleb Keithley).
+1550. Add missing exported symbols to Win32 DLLs (#1314, Kaleb Keithley).
+1549. Detect an extra Trident Cyber chip (#1313, Alan Hourihane).
+1548. Add timeouts to all Tseng "wait for something" functions (#1312,
+ Koen Gadeyne).
+1547. Tseng driver documentation update (#1311, Koen Gadeyne).
+1546. Update xterm man page, configure script and related things (#1310,
+ Thomas Dickey).
+1545. Add a version number to xterm, and make the -version and -help options
+ used before attempting to open the display (#1310, 1316, Thomas Dickey).
+1544. Implement logic to permit xterm to work with proportional fonts.
+ This is done by rendering the characters on a fixed pitch (#1310,
+ Thomas Dickey).
+1543. Fix missing planemask in XAA function (#1309, Mark Vojkovich).
+1542. Fix XAA syncing inconsistencies (#1308, Mark Vojkovich).
+1541. Allow Trident 9397 and later 3D chipsets to work by not using
+ acceleration (#1307, Alan Hourihane).
+1540. Fixes for older Trident Cyber series (#1307, Arthur Tateshi).
+1539. Fix includes for xfwp (#1306, Craig Groeschel/Metro Link).
+1538. Fix for large pixmaps in XINERAMA extension (#1305, Kaleb Keithley).
+1537. Xlib: XGetICValues fails for {preedit,status}Attributes
+ (#1299, Kaleb Keithley).
+1536. Add locale and xkb files for Lithuanian (#1298, Ricardas Cepas).
+1535. Device updates for scanpci (Robin Cutshaw).
+1534. First cut at cleaning up the parallel make dependencies (Robin Cutshaw).
+
+XFree86 3.9Ab (29 December 1997)
+1533. Reorganize the acceleration code in the tseng driver. Fix tseng XAA init
+ problem (#1303, Koen Gadeyne).
+1532. Add support for changing the MClk from the XF86Config file for
+ W32p cards with ICS5341 RAMDAC and for the ET6000 family (#1302,
+ Koen Gadeyne).
+1531. Add option to build xterm without tek4014 emulation. Add option to
+ build xterm with default TERM value other than "xterm". Apply some
+ minor bugfixes to OS/2 version. Fix configure help message and missing
+ quotes in memmove/bcopy configure test (#1297, Thomas Dickey, Darren
+ Heibert).
+1530. Add support for clock setting of the new trident chips (#1294,
+ Alan Hourihane).
+1529. XAA vertical line speedup (#1293, Alan Hourihane).
+1528. Add panning for Permedia and Permedia 2 (#1292, Alan Hourihane).
+1527. Add a few more messages to tseng driver and clean up the use of
+ the different bytes-per-pixel variables. Add "showcache" option
+ (#1300,1301, Koen Gadeyne).
+1526. Fix XAA pixmap cache bug with 16bpp and RGB=555 or 32bpp (#1295,
+ Walter Gadeyne).
+1525. Fix ImageWrite for Tseng (and re-enable it) (#1296, Koen Gadeyne).
+1524. Fix horizontal lines in Tseng driver (#1291, George Krajcsovits).
+1523. Support MUSIC MU9C4910 RAMDAC in Tseng driver (#1290, Koen Gadeyne).
+1522. Fix bad color in hardware linedraw for Tseng (#1290, Koen Gadeyne).
+
+XFree86 3.9Aa (20 December 1997)
+1521. Fix border colours for Trident server (#1289, Alan Hourihane).
+1520. Major update to Mach64 server. Proper identification of the different
+ chips. Support for 16MB boards. Increased max DAC speed settings for
+ newer chips. Support for AGP RagePro cards. Block write mode for
+ RagePro chips. 1600x1200 mode support for VT and newer chips. Use the
+ auxilliary register aperture on chips that support it. Use 16MB memory
+ aperture on PCI Mach64s with integrated controllers.
+ (#1288, Kevin Martin).
+1519. New code for the glint server. Preliminary support for the Permedia 2
+ hardware cursor. Preliminary support for panning the display with
+ multiple modelines for Permedia/Permedia 2. Fix ELSA Permedia 2 boards.
+ Cleanup of glint_init.c. Fix DGA when using software cursor. Addition
+ of code to not save VGA state if the VGA core is disabled.
+ (#1285,1286,1287, Alan Hourihane).
+1518. Fix the "invalid depth" problem with packed 24 (#1284, Andrew Aitchison).
+1517. Fixes to finish keyboard layout (Johan Myreen).
+
+XFree86 3.9z (14 December 1997)
+1516. Fix loss of sync while panning problem and attempt to fix the occasional
+ crashes of the Millennium II by restricting the MGACountRam function
+ to test the first 8MB, only (#1280, Mark Vojkovich).
+1515. Fix XF86Setup to create a (symbolic) link of /usr/X11R6/bin/X when it
+ doesn't exist (#1279, Matthieu Herrb).
+1514. Fix solid trap/rect fill bugain the mga server for the Millennium II
+ that was hurting performance severely (#1277, Mark Vojkovich).
+1513. Reenable BitBlt accelerations for Millennium II (#1271, Mark Montague).
+1512. Fix mmap memory leak in IGS driver. ARM32/NetBSD specific fix for
+ xf86MapInfoMap (#1265, Katrina Maffey).
+1511. Resync change 1474 for PC98 and fix a reference to usleep on SVR4
+ (#1264, Takaaki Nomura).
+1510. Add BLK opaque color expansion for 2164 and change the mga code to use
+ a lookup table for XFree->mga rop conversions (#1261, Mark Vojkovich).
+1509. Fix XAA hardware cursor support for BT485 ramdacs
+ in the S3/SVGA server (#1260, Mark Vojkovich).
+1508. Fix VT switching hang in FreeBSD (#1259, Joerg Wunsch).
+1507. Enable MMIO / linear FB on Cirrus 7548. Experimental patch for screen
+ expansion (640x480 on 800x600 LCD) which doesn't seem to work, yet
+ (#1258, Achim Oppelt).
+1506. Fix gc validation (#1257,1262 Mark Vojkovich).
+1505. Fix SIGSEGV in xf86setup (Dirk Hohndel).
+1504. Extend XF86Setup to allow selecting the modes and the default color
+ depth (Dirk Hohndel).
+1503. Fix build problem on Solaris 2.6/x86 with gcc 2.7.2.3.
+1502. Fix Solaris 2.x + gcc build problem in xfwp (#1272, Takaaki Nomura).
+1501. Xkb{Get,Set}PerClientControls missing from XKBlib.h (#1283,
+ Kaleb Keithley).
+1500. BSD 4.4 sockets not handled correctly in xfwp/transport.c (#1276, 1281,
+ Kaleb Keithley).
+1499. Local connection doesn't work for lbxproxy on AIX (#1275,
+ Arthur Barstow).
+1498. Get fcntl flags in Xtrans before setting them (#1268, Kaleb Keithley).
+1497. Fix 'Xnest -query' on IBM (#1263, Kaleb Keithley).
+1496. Fix X server core dump after disconnecting from a font server
+ (#1256, Arthur Barstow).
+1495. Xserver:Security Policy parsing code returns bogus value on suceess
+ (#1254, M.S. Ramesh).
+1494. Install app-defaults in /var (#1253, Kaleb Keithley).
+1493. Some xfwp fixes (#1252, Arthur Barstow).
+1492. Fix some Win32 problems (#1251, 1255, Kaleb Keithley).
+1491. DPMS was missing from pandix main.c (#1246, Kaleb Keithley).
+1490. Solaris 2.x LOCALCONN updates (#1269 Kaleb Keithley).
+1489. DPMS updates (#1229, Kaleb Keithley).
+1488. KeyPress event doesn't use XKB state when GrabsUseXKBStateMask is set
+ (#1227, Kaleb Keithley).
+1487. Add EVI (Extended Visual Information) server extension (#1225, 1282,
+ Kaleb Keithley).
+1486. Fix some Xmb man pages and specs docs (#1220, 1270, Kaleb Keithley).
+1485. Plugin fixes (#1219, 1221, 1224, 1226, 1247, 1273, Kaleb Keithley).
+
+XFree86 3.9y (6 December 1997)
+1484. Fix some initialization problems in the xkb programs (#1233,
+ Andreas Schwab).
+1483. Fix loader to resolve symbols properly in Xext (#1250, Robin Cutshaw).
+1482. Fix loader on Solaris and enable it for SVR4 (#1248,1249, Robin Cutshaw).
+1481. Fix some problems with T2R support (#1245, Robin Cutshaw).
+1480. Fix rfhcnt calculation and VT swithcing in mga driver. Allow DirectColor
+ on Millennium II cards (#1241,1242,1243,1244, Mark Montague).
+1479. Potential fix for s3/svga cursor support for Ti ramdacs. Remove a
+ mistake from the s3/svga acceleration code (#1237, Mark Vojkovich).
+1478. Switch the MGA driver over to XAA Hardware Cursor. Only support for
+ TVP3026 is included (#1236,1239, Mark Vojkovich).
+1477. Add delayed syncing abd faster arcs ub 8bpp to mga driver (#1235,
+ Mark Vojkovich).
+1476. Fix another SIGSEGV in xterm, where wrong assumptions about the type of
+ widget passed to an action handler were made (#1234, Thomas Dickey,
+ Arfst Ludwig).
+1475. Fix the wraparound problem with the Mach32 cursor and add another seven
+ pixels to the possible width of the cursor (#1232, Bryan Feir).
+1474. Remove vga256/vgainit (#1231, Mark La France).
+1473. Fix a namespace collision in Mach8 server (#1230, Mark La France).
+1472. Fix SIGSEGV when some internal xterm buffers overflowed (#1228,
+ Thomas Dickey).
+1471. Fix HiQV version of ImageWrite in the C&T driver (#1222,1223,
+ David Bateman).
+1470. Yet another attempt to fix packing order for dashed lines (#1217,
+ Mark Vojkovich).
+1469. Build fixes for Xext (#1216,1238 Takaaki Nomura).
+1468. Remove all references to the W32 server (but not the actual server code)
+ (#1215, Koen Gadeyne).
+1467. Complete initial support for Permedia 2 and add some acceleration for it
+ (Alan Hourihane).
+1466. Some more code for supporting the IBM RGB640 in the glint server
+ (Dirk Hohndel).
+
+XFree86 3.9x (23 November 1997)
+1466. Updates for SCO (#1211, 1212, J. Kean Johnston).
+1465. Fix netscape plugin core dump when transfer is interrupted (#1209,
+ Kaleb Keithley).
+1464. Registry updates (#1205, Kaleb Keithley).
+1463. Preliminary imake support for different Linux distributions (#1203,
+ Kaleb Keithley).
+1462. Enable JIS, SJIS, EUC, etc. on X_LOCALE machines (#1201, Kaleb Keithley).
+1461. Linux and HP imake cf updated (#1200, Kaleb Keithley).
+1460. Updates to XINERAMA (#1198, Kaleb Keithley).
+1459. Make the DPMS extension a more "standard" item (ie, its library code
+ is now in libXext) (#1197, Kaleb Keithley).
+1458. xload doesn't need libutil and libkvm on NetBSD and OpenBSD (#1189,
+ Scott Reynolds).
+1457. Separate module-specific and non-module-specific Xserver/Xext code
+ (#1149, Holger Veit).
+1456. OS/2 updates (don't use WIN32 file handling) (#1149, Holger Veit).
+1455. Clean up XAA calls in glint server (#1210, Alan Hourihane).
+1454. Adapt memory detection in I128 server to T2R (#1208, Robin Cutshaw).
+1453. Add DGA to glint server and get xvidtune to work with it (#1207,
+ Alan Hourihane).
+1452. Cleanups and preliminary support for the Trident 3DImage975 and
+ 3DImage985 (#1206, Alan Hourihane).
+1451. Add stipple acceleration to the tseng driver (#1192, Koen Gadeyne,
+ Mark Vojkovich).
+1450. Add better text acceleration to the tseng driver (#1190, Koen Gadeyne).
+1449. Fix HiQV image writes (#1191, David Bateman).
+1448. Remove the need for the VideoMemSave buffers in glint server (#1196,
+ Alan Hourihane).
+1447. Handle bogus base address in vgaPCIInfo for s3/svga (#1194, Mark
+ Vojkovich).
+1446. Fix XF86Setup to work with Tcl/Tk 8.0 and improve support for future
+ mouse protocols in XF86Setup (#1158,1159, Joe Moss).
+1445. Fix DGASetViewPort problem in S3 server (#1157, Harald Koenig).
+1444. Add -U flag to imake (#1156, Chris Demetriou).
+1443. First cut for I128 Revolution support (#1155, Robin Cutshaw).
+1442. Fix packing order for dashed lines (#1154, 1188, Alan Hourihane, Mark
+ Vojkovich).
+1441. Fix joycal.c to work with Linux 2.1.x (#1153, Robin Cutshaw).
+1440. Fix ImageString xtest results. Call miImageGlyphBlt instead of
+ cfbImageGlyphBlt8 (#1152, Alan Hourihane).
+1439. Add overlay support for the IBM RGB526 (disabled)(#1151, Mark Vojkovich).
+1438. Fix setting maxclock in s3/svga (#1151, Mark Vojkovich).
+1437. Print module version in plain text (#1150, Holger Veit).
+1436. Correct change 1390 (#1148, Takaaki Nomura).
+
+XFree86 3.9w (16 November 1997)
+1435. Remove some compiler warnings.
+1434. Fix lcPublic state_depend_encoding test in Xlib (#1181, Kaleb Keithley).
+1433. Fix buffer overrun in lib/X11/omGeneric.c (#1180, Kaleb Keithley).
+1432. Add new XINERAMA extension (#1171-1178, Kaleb Keithley).
+1431. Update man pages for X11R6.4 (#1169, 1170, Kaleb Keithley).
+1430. Add new CUP (Colormap Utilization) extension code (#1167,
+ Kaleb Keithley).
+1429. Add resource configuration management code to libXt (#1165,
+ Arthur Barstow).
+1428. Xkb{Get,Set}PerClientControls not implemented in Xlib (#1164,
+ Kaleb Keithley).
+1427. Fix bug in lbxproxy's detection of synonymous server names (#1161,
+ Arthur Barstow).
+1426. Various xfwp fixes and cleanups (#1103-1107, 1109, 1110, 1140-1144,
+ 1160, 1162, 1163, 1166, 1168, 1179, Arthur Barstow).
+1426. Fix select prototype for HP/UX 10.x (#1102, Kaleb Keithley).
+1425. Fix a 64-bit nit in MakeRootTile (#1080, Kaleb Keithley).
+1424. Export weak symbols in elistgen.sun (#1078, Kaleb Keithley).
+1423. Put back the reference to the xfree68 directory in
+ xkbcomp/symbols/Imakefile.
+1422. Add xkb support for some older HP keyboards (#1077, Kaleb Keithley).
+1421. Fix some typos in the iso8859-1 compose file (#1076,
+ Niels Kristian Bech Jensen).
+1420. Xlib UTF support uses longs, but should use wchar_t (#1068,
+ Kaleb Keithley).
+1419. HP/UX 10 config update (#1066, 1079, Kaleb Keithley).
+1418. Update lbxproxy to use the Xtrans library (#1060, Arthur Barstow).
+1417. Deal with gratuitous Xserver colormap flashing (#1059, Kaleb Keithley).
+1416. LBX-related updates to the Xserver (#1049, Kaleb Keithley).
+1415. Remove Xibm server from the source (#1048, Kaleb Keithley).
+1414. Remove xmh from the core tree (#1043, Kaleb Keithley). Note, only
+ the entry for it in xc/programs/Imakefile is removed here so far, and
+ we may want to move it into our supported contrib.
+1413. Update sgi.cf (#1042, Kaleb Keithley).
+1412. Fix inconsistency with the naming of general man pages and the sections
+ they are installed in (#1040, Kaleb Keithley).
+1411. Fix xrx plug-in build problem on Solaris 2.6 (#1039, Kaleb Keithley).
+1410. Fix Xserver crash when using lbxproxy and xdm-auth-1 (#1038,
+ Kaleb Keithley).
+1409. Fix an infinite loop in CreateVisual() in lbxproxy (#1034,
+ Arthur Barstow).
+1408. locale.alias updates (#1032, Kaleb Keithley).
+1407. Misc very minor TOG updates (#1031, Kaleb Keithley).
+1406. Fix for MaxClients not being defined correctly in the Xserver
+ (#1030, Sekhar Makkapati).
+1405. Fix an Xserver problem related to FreeCursor() in
+ DisposeWindowOptional() (#1026, Kaleb Keithley).
+1404. Add setusercontext support to xdm for FreeBSD (#1025, Kaleb Keithley).
+1403. Use named pipes for local connections with Solaris 2.x (#1011, 1067
+ Kaleb Keithley).
+1402. Fix lost support for non-standard encodings in Xlib (#1005,
+ Kaleb Keithley).
+1401. Fix Xserver crash when colormap of copyfromparent given (#990,
+ Sekhar Makkapati).
+1400. Make lbxproxy try another port when bind fails (#988, Arthur Barstow).
+1399. Remove the Xserver '-config' flag for OSs that don't have tight command
+ line length restrictions (#987, Kaleb Keithley).
+1398. Remove some vararg cruft from the Appgroup library (#986,
+ Kaleb Keithley).
+1397. Fix SecurityLookupIDByClass in Xserver (#1186, Sekhar Makkapati).
+1396. Fix for sample site.def (#1184, Sekhar Makkapati).
+1395. Fix references to LINE_MAX in Xos_r.h (#1182, Sekhar Makkapati).
+
+XFree86 3.9v (9 November 1997)
+1394. Add unrolled text code for the 9 pixel width fonts (#1147,
+ Mark Vojkovich).
+1393. Fix planemask/transparency problems in tseng driver (#1146,
+ Harald Nordgard Hansen).
+1392. Add Fire GL 3000 option for glint server (#1139, Bart van den Broek).
+1391. Remove unnecessary ARM32 code (#1138, Katrina Maffey).
+1390. Fix a crash in XCopyPlane after server reset (#1137, Katrina Maffey).
+1389. Add support for PS/2 Intellimouse (#1136, Tim Goodwin).
+1388. Add a PolyArc replacement for s3/svga in 8bpp when using a linear
+ framebuffer. Add a stippled rect speedup for destinations less than 32
+ pixels wide (#1135, Mark Vojkovich).
+1387. Add read speed benchmark and support for >8bpp modes to dga test
+ program (#1134, Koen Gadeyne).
+1386. Fix dashed lines for vga256 (#1133, Alan Hourihane).
+1385. Enable trapezoid fill on mga (#1132, Radek Kapitan).
+1384. Fix ImageWriteFlags in trident driver (#1131, Alan Hourihane).
+1383. Fix wide line problem in the static server (#1129, Brian Wainscott).
+1382. Fix syncing problems with the scanline routines in XAA (#1128,
+ Alan Hourihane).
+1381. Restructure glint server to call the AccelInit function in a sane
+ manner (#1127, Alan Hourihane).
+1380. Add planemask support for the tridents and add hardware clipping for
+ the Cyber chipsets. Add Cyber 9397 detection (#1126,1130, Alan Hourihane).
+1379. Fix a typo in vgaPCI.h (#1125, Alan Hourihane).
+1378. Fix a problem with setting the maximum clock value on s3 cards at depths
+ other than 8bpp (#1123, Steve Forsythe).
+1377. Fix dashed lines for matrox driver (#1122, Radek Kapitan).
+1376. Use correct arguments to xf86ImageWrite when uploading cursor image to
+ videoram. Units of pixels instead of bytes (#1120, Mark Vojkovich).
+1375. Fix s3/svga cursor location computation error (#1119, Mark Vojkovich).
+1374. Improve GC validation code in XAA (#1117,1118,1121, Mark Vojkovich,
+ David Bateman).
+1373. Add accelerated color expansion for all color depths and for all
+ W32-style chips (#1116, Koen Gadeyne).
+1372. Add Warpnext/Warpprev to twm (#1114, Benjamin Gras).
+1371. One more fix to restore changes to variable types made in change 1347.
+ This should fix MouseSystem mice (#1111,1124,1145, Steve Forsythe,
+ Andrew Aitchison).
+1370. Add missing pm_accel.c.
+1369. Add ImageWrite support to glint server (Alan Hourihane).
+
+XFree86 3.9u (1 November 1997)
+1368. Add support for I128 Revolution to scanpci and SuperProbe (#1108,
+ Robin Cutshaw).
+1367. Compile fixes for ARM32/NetBSD (#1099, Katrina Maffey).
+1366. Change mga to use bresenham lines instead of two point (#1098,
+ Radek Kapitan).
+1365. Add mga stipple code so that it is 256K pixels barrier sensible and
+ even faster than current XAA stipple code (#1097, Mark Vojkovich,
+ Radek Kapitan).
+1364. Move C&T hw cursor into XAA. Re-enable ImageWrite on C&T. Rewrite 32bpp
+ HiQV code (should be almost usable) (#1096, David Bateman).
+1363. Get the ch8398 work in tseng driver at every color depth and any hibit
+ setting (#1095, George Krajcsovits).
+1362. Changes to XAA hw cursor code to better support switching between hw
+ and sw cursor (#1094, David Bateman).
+1361. Fix incorrect parenthesis placement caused by hand-applying part of
+ change 1347 (#1092, Mark Vojkovich).
+1360. Resync PC98 Imakefiles (#1091, Takaaki Nomura).
+1359. Build fix for PANIX (#1090, Takaaki Nomura).
+1358. Fix a duplicate inclusion of <sys/termio.h> on ISC inside xterm/screen.c
+ and update the help text for xterm to correspond with the appropriate
+ commandline switches (#1089, Michael Rohleder).
+1357. Fix some incorrect type modifications in change 1347 (#1087,1088
+ Alan Hourihane, Michael Rohleder).
+1356. Fix mga_xaarepl.c to compile with non-GNU cc (#1086, Robin Cutshaw).
+1355. Clean up vgaPCI.h for Trident (#1085, Alan Hourihane).
+1354. Fix a bug introduced in change 1222 (#1084, Koen Gadeyne).
+1353. Remove amiga/ataritt files from xkbcomp/symbols Imakefile (they have
+ been moved to a subdir in change 1338) (#1083, Takaaki Nomura).
+1352. Update VideoBoard98 (#1081, Takaaki Nomura).
+1351. Add DO_NOT_BLIT_STIPPLES to the xf86AccelInfoRec.Flags (#1070,
+ Marc Vojkovich).
+1350. More work for Permedia 2 support. Still doesn't work (Dirk Hohndel).
+1349. Split acceleration drivers for GLINT and Permedia. Get glint server
+ to work (again) on Fire GL 1000 (Helmut Fahrion).
+1348. Get glint server to work on Fire GL 3000 (Bart van den Broek).
+
+XFree86 3.9t (26 October 1997)
+1347. Add support for ARM32 architecture and IGS CyberPro 2010 support
+ (#1052, Digital Equipment Corporation).
+1346. Multi-display support for lbxproxy (#969-971, 977, 978, Arthur Barstow).
+1345. Remove some misleading 32-bit comments in Xlib (#967, Kaleb Keithley).
+1344. Additional symbols for Japanese 109 key keyboard (#962, Kaleb Keithley).
+1343. Faster bit counting algorithm for Xlib/Xt modifier code (#958,
+ Kaleb Keithley).
+1342. XKB updates for hp ddx (#955, 956, Kaleb Keithley).
+1341. Fix Xaw Text Widget call to XtMalloc(0) (#954, Kaleb Keithley).
+1340. Updates to xrx plugins (#953, 957, 959-961, 963, Kaleb Keithley).
+1339. Use dump instead of nm in elistgen.sun (#922, Kaleb Keithley).
+1338. xkb updates (#920, Kaleb Keithley).
+1337. Fix imake's SPARCcompiler CCompilerMajorVersion detection (#919,
+ Kaleb Keithley).
+1336. Updates related to xkbcomp install (#918, Kaleb Keithley).
+1335. General MS-Win lib fixes (#917, Kaleb Keithley).
+1334. xterm support for -lcurses on HPUX 10.2 (#914, 916, 952, Kaleb Keithley).
+1333. Fix incorrect mode name in xf86config.c.
+1332. Fix text restore problem on some Avance Logic cards (#1072, Thomas
+ Dreibholz).
+1331. WriteBitmap code for MGA driver (#1069, Mark Vojkovich, Radek Kapitan).
+1330. Add a clean rule to remove XKB's .dir files. Add support for newer 3D
+ Rage III adapters to SuperProbe, the Mach64 server and the ATI driver.
+ Fix misuse of DirtyStartup define. Fix Mach64 mode restoration problems
+ in ATI driver. Fix 8MB linear aperture problem in ATI driver. Fix
+ typo's in drivers/s3* Imakefiles. Fix banking globals when a linear
+ aperture is used. Retrofit 3.3.1 vgaPCI code into 3.9s. (#1065,
+ Marc La France).
+1329. Add support for the Microsoft Intellimouse in the XFree86-Misc
+ Extension and XF86Setup (#1063,1064, Takaaki Nomura, Joe Moss).
+1328. Add Scanline ImageWrite support to XAA (#1062, Alan Hourihane).
+1327. Missing Millennium II AGP fixes (#1058, Brian Wainscott).
+1326. XAA hw cursor fix. Delay cursor restoration until after the saved screen
+ is restored (#1057, Mark Vojkovich).
+1325. Fix server to print the clock scale instead of effective clocks when
+ using a clockchip (#1056, Krajcsovits Gyorgy).
+1324. Correct eraser/stylus detection in wacom driver (#1055, Frederic Lepied).
+1323. Fixes for APM driver. HW lines/HW clipping. ROP support. Text accel now
+ uses PAD_DWORD. Bugfix for WaitForFifo() (lost serial interrupts) and
+ ApmSync() (various errors). HW cursor now uses XAA interface. Combined
+ write for many registers (x+y in one longword etc.) (#1054, Henrik
+ Harmsen).
+1322. xterm fixes. Correct a minor placement problem with the right scrollbar.
+ Implement a new set of control sequences for switching between the
+ normal and alternate VT100 screens. Implement the alternate-screen menu
+ entry (#1053, Thomas Dickey).
+1321. Add some reasonable limit for when a trapezoid fill is used rather than
+ using spans (#1051, Mark Vojkovich).
+1320. Add bindist description files for an OpenBSD/sparc binary distribution
+ (#1045, Todd Fries).
+1319. Some fixes and additions to the PCI databases (#1046,1050, Dejan Ilic).
+1318. Add 543x cirrus driver for PowerPC, fix some LynxOS related problems
+ (#1044, Thomas Mueller).
+1317. Add support for ViRGE/GX2 to SuperProbe (Dirk Hohndel).
+1316. Add support for ViRGE/GX2 to SVGA and S3V server (#1041, Harald Koenig).
+
+XFree86 3.9s (15 October 1997)
+1315. Fix segmentation fault in glint driver when server is started with a
+ card without GLINT/PERMEDIA chip (Stefan Dirsch).
+1314. Lots of fixes and additions to glint acceleration (Helmut Fahrion).
+1313. Fix problem with xterm hanging when opening a log file. Add
+ right-scrollbar to xterm (#1037, Thomas Dickey, Michael Rohleder).
+1312. Add GD7555 to vgaPCI.h and fix XF98_SVGA (#1036, Shuichi Ueno).
+1311. Fix a bug with Qword pad support in ImageWrite (#1033, Mark Vojkovich).
+1310. Fix mystique driver and build problem on SVR4.0 (#1029, Takaaki Nomura,
+ Isao Ohishi).
+1309. Fix SuperProbe to correctly detect memory on the Trident 9685 (#1023,
+ Alan Hourihane).
+1308. Add hardware clipping and transparency for the trident chips that
+ support it. Partially implement the 'set_mclk' option, not yet
+ complete, remove the tgui_mclk_66 option, clean up the TV output for
+ 9685 boards. Documentation updates (#1022, Alan Hourihane).
+1307. Add accelerated ImageWrite and a WriteBitmap replacement to the tseng
+ driver (#1021, Mark Vojkovich, Koen Gadeyne).
+1306. Documentation update for tseng driver (#1020, Koen Gadeyne).
+1305. Clear disallowed flags in Options bitmap (#1019, Alan Hourihane).
+1304. Fix XAA hardware cursor for built-in S3 RAMDACs (#1018, Alan Hourihane).
+1303. Use trapezoid fills for some wide lines (#1017, Mark Vojkovich).
+1302. Fix colormap switching problem in svga/s3 (#1016, Mark Vojkovich).
+1301. Fix install problem with xkbcomp (#1014, Robin Cutshaw).
+1300. Fix lnx_jstk.c to work with 2.1.x joystick.h file (#1013, Robin Cutshaw).
+1299. Disable some HTotals in matrox driver that cause vertical stripes (#1010,
+ 1015, Radek Kapitan).
+1298. Improve some bailout messages in tseng driver (#1009, Koen Gadeyne).
+1297. Suppress popen/pclose messages (#1008, Takaaki Nomura).
+1296. Initial support for Millennium II AGP (Dirk Hohndel).
+1295. Fixes to make glint server pass more of xtest (Alan Hourihane).
+
+XFree86 3.9r (30 September 1997)
+1294. Bug fixes to xterm. Change default resource of colorMode to true. Fix
+ 'ech' control. Add resource boldColors and +pc / -pc. Add resource
+ colorAttrMode. Fix conflict between colorULMode/colorBDMode versus ANSI
+ colors. Correct two problems with the optional logging support. Various
+ updates to configure-script macros (#1004, Thomas Dickey).
+1293. Make sure ImageWriteBase gets set with a default value (#1003,
+ Alan Hourihane).
+1292. Replace mktemp() with mkstemp() in xrdb (#1002, Luke Mewburn).
+1291. Don't fail to start if there isn't enough memory for the hw cursor in
+ tseng driver (#1001, Koen Gadeyne).
+1290. Fix the install problem with XF98_SVGA (#1000, Takaaki Nomura).
+1289. Add bresenham lines to tseng driver (#997, Koen Gadeyne).
+1288. Significantly accelerate clipped terminal font performance (#996,998,999,
+ Andrew van der Stock, David Bateman).
+1287. Enable 24bpp for Trident TGUI 96xx (#995, Alan Hourihane).
+1286. Add support for the Trident ClearTV (#994, Alan Hourihane).
+1285. Remove INT64 from XAA text code (#993, Mark Vojkovich).
+1284. XAA hw cursor support for s3/svga. IBM cursor works, other RAMDAC
+ cursors need to be implemented/verified. S3 builtin curser seems
+ to work in 8bpp, but fails in other depths (#992, Mark Vojkovich).
+1283. Some fixes for Unixware 2.1.2 (#989, Steve Forsythe).
+1282. Fix the remaining line drawing problems for the CL-GD5428 and CL-GD754x
+ chips (#985, Corin Anderson).
+1281. Fix build problem (982, Takaaki Nomura).
+1280. Add more acceleration for Permedia (this is partly producing drawing
+ errors and needs much more testing) and remove Trapezoid bug in 500TX
+ support of glint server (Helmut Fahrion).
+1279. Build fixes for XAA hw cursor and updates to glint XAA hw cursor (#983,
+ 984, Alan Hourihane).
+1278. Better color depth support and cleanups for glint server (Helmut Fahrion).
+1277. Add initial support for Permedia 2 chip to glint server (Dirk Hohndel).
+1276. Add support for GLINT MX chip to glint server (Dirk Hohndel).
+1275. Add RIVA 128 to scanpci (Dirk Hohndel).
+
+XFree86 3.9q (19 September 1997)
+1274. Add XF98_SVGA server, update XF98Conf.cpp, VideoBoard98, fix mga driver
+ for PC98 (#980,981, Michio "Karl" Jinbo, Shuichirou Urata).
+1273. Some fixes to glint server (Helmut Fahrion, Stefan Dirsch, Dirk Hohndel).
+1272. Fix for glint_dump_regs and disable accelerated lines for glint
+ (Stefan Dirsch).
+1271. Add XAA hw cursor support and update trident and glint drivers to use it
+ (#973-976,979, Alan Hourihane).
+1270. Several fixes to xterm: fix redraw errors after font changes or resizes,
+ add sunKeyboard resource, correct fg/bg test in the control sequence
+ that replies with the current SGR settings ((#972, Thomas Dickey).
+1269. Several fixes to the xterm standalone configure script (#972,
+ Thomas Dickey).
+1268. Fix to pointer movement constraints (#968, Stuart Anderson).
+
+XFree86 3.9p (15 September 1997)
+1267. Disable Image Write for HiQV chips in C&T driver (#966, David Bateman).
+1266. Add stipple accelerated functions through the ScanlineScreenToScreen
+ function (#965, Alan Hourihane).
+1255. Add ImageWrite support for the Laguna chips in cirrus driver (#964,
+ Corin Anderson).
+1254. Disable the Xserver '-config' option when run set-uid.
+1253. Have the Xservers run xkbcomp under the real user's ID.
+1252. Fix xterm's default handling of the KP_Add key.
+1251. Fix Linux-axp xdm build problem.
+1250. Fix stripping of extension from module names (so that it works OK
+ when there is a '.' in the module directory pathname).
+1249. Fix some problems in the trident driver with the 9685 programmable clock
+ and disable the GE when too little memory is available (#950,
+ Alan Hourihane).
+1248. Fix build problem with non gcc compilers (#948,949, Takaaki Nomura,
+ David Bateman).
+1247. Fix some dangling references and max MClk value in matrox driver (#951,
+ Dirk Hohndel).
+1246. Disable debugging messages in DirectColor support (Andrew Aitchison).
+1245. Fix saving video memory for glint server (Helmut Fahrion).
+
+XFree86 3.9o (9 September 1997)
+1244. Yet another fix for the problems around installing xkbcomp
+ (Michael Rohleder, David Dawes, Dirk Hohndel).
+1243. Add more acceleration for 500TX to glint server (Alan Hourihane).
+1242. Add initial acceleration for Permedia to glint server (Dirk Hohndel).
+1241. Lots of cleanups and fixes to glint server (Stefan Dirsch, Helmut
+ Fahrion, Dirk Hohndel).
+1240. Fix glint server problems on some ASUS motherboards (Stefan Dirsch).
+1239. Add Permedia support to glint server (Helmut Fahrion, Dirk Hohndel).
+1238. Several m68k related fixes (faster pic code, change Atari TT geometry),
+ fixes to not reference the undefined variable XPROJECTROOT, some glibc
+ updates (#947, Andreas Schwab).
+1237. Move some of the improvements that Mark Vojkovich made for the S3 stipple
+ code back into XAA (#945, David Bateman).
+1236. Fix problem with HW cursor disappearing on Cirrus Laguna chips (#943,
+ Corin Anderson).
+1235. Fix 24bpp XAA NonTE image text with RGB_EQUAL (#942, David Bateman).
+1234. Fix BIOS layout issues in matrox drivers. This might make Millennium
+ Rev 3 cards work (#941, Andrew van der Stock).
+1233. Improve the performance of the 24bpp fills on the 6554x machines and
+ hopefully implements a solid fill at 32bpp for the 6555x machines
+ (untested). Some cosmetic changes (#940,944, David Bateman).
+1232. Turn off CPU_TRANSFER_BASE_FIXED in SVGA/S3 driver (#939, Mark Vojkovich).
+1231. Add the correct Enable/DisableIO Ports back into the glint driver (#938,
+ Alan Hourihane).
+1230. Fix trident & mga driver for PC98. Fix XF98Conf.cpp. Resync PC98
+ Imakefiles (#935, Takaaki Nomura).
+1229. Add accelerated Image Write to C&T driver. Attempted fix for the use
+ of TMED DSTN dithering on the 65555 and 68554 chips. Small
+ documentation patch (#934, David Bateman).
+1228. Fix XF86Setup to load XFree86-VidModeExtension (#932, Takaaki Nomura).
+1227. Fix MClk limits for matrox driver (#931, Andrew van der Stock).
+1226. Fix build problem on Solaris (#929, Matthieu Herrb).
+1225. Add DacSpeed to C&T driver (#930, David Bateman).
+1224. Disable acceleration for IMA bus chips in tseng driver (#928,
+ David Bateman)
+1223. Turn Record extension into module and fix problems in XInput joystick
+ module (#927,933, Matthieu Herrb).
+1222. Add support for the ch8398 and ch8398a clockchips to the tseng driver
+ (#913,914 Gyorgy Krajcsovits).
+
+XFree86 3.9n (26 August 1997)
+1221. Lots of small fixes for xterm (#912, Thomas Dickey).
+1220. Add DirectColor visual to Matrox server (#911, Andrew Aitchison).
+1219. Disable 8x8 pattern tiling on W32 (not W32i/p) cards. Fix lowend W32p
+ cards with IMA bus. Modify linear memory code (#910, Koen Gadeyne).
+1218. Fix locale in R6.3, Fix PC98 XKB, Remove xf86ClearIOPortList() and
+ xf86AddIOPorts() from PEGC driver (#908, Takaaki Nomura, Isao Ohishi).
+1217. Remove xf86ClearIOPortList() and xf86AddIOPorts() (#907,909
+ Matthieu Herrb).
+1216. Add ET6100 support to tseng driver (#906, Koen Gadeyne).
+1215. Add wide lines to XAA (#904, Mark Vojkovich).
+1214. Add Chrontel8391CalcClock function (#903, Gyorgy Krajcsovits).
+1213. Fix output of hex numbers in chip revision (#902, Dejan Ilic).
+1212. Add accelerated Bresenham lines to tseng driver at 8bpp (#901,
+ Koen Gadeyne).
+1211. Xlib: XIMStringConversionRetrival should be XIMStringConversionRetrieval
+ (#905, Kaleb Keithley).
+1210. Official fix for potential buffer overflow in XGetErrorDatabaseText
+ (#900, Kaleb Keithley).
+1209. Fix typo in cde.rules (#899, Kaleb Keithley).
+1208. SGI threads patch update (#898, Kaleb Keithley).
+1207. Fix UNSHARED_CXXLIB for SPARCcompiler4.0 (#897, Kaleb Keithley).
+1206. Fix SPARCcompiler CCompilerMajorVersion (#896, Kaleb Keithley).
+1205. Parse junk from export lists better (#895, Kaleb Keithley).
+1204. Removes some dead or unused code in os-support (#893, Matthieu Herrb).
+1203. Remove xf86tmpnam() from libc_wrapper and rewrites xf86tmpfile() to
+ use tmpfile() (#892, Matthieu Herrb).
+1202. Add a separate README.OpenBSD for 3.9 (#890, Matthieu Herrb).
+1201. Move most common extensions into a module (#889, Matthieu Herrb).
+1200. OpenBSD multi-architecture support (#888, Matthieu Herrb).
+1199. Disable disables broken software/hardware cursor switching in s3/svga
+ (#887, Mark Voikovich).
+1198. Some fixes for PC98. XF86Setup, mga driver, VideoBoards98, Cards98
+ (#886, Takaaki Nomura, Takefumi Tsukada).
+1197. Acceleration fixes for Trident and accelerated ImageWrite (#883,884,885
+ Alan Hourihane).
+1196. Bring the 3.3.1 Trident fixes into 3.9 (#882, Alan Hourihane).
+1195. Add incomplete Rendition detection code to SuperProbe (Dirk Hohndel).
+1194. Add Rendition detection to PCI code (#881, Marc Langenbach, Dirk Hohndel).
+1193. Fix to only build *.dir file for xkbcomp on make install (#880,
+ Michael Rohleder).
+1192. Add ImageWrites for s3/svga (#879, Mark Vojkovich).
+1191. Rename dashed pattern flags (#878, Mark Vojkovich).
+1190. Add ImageWrite support for XAA (#877, Mark Vojkovich).
+1189. Add MGA2164 define to vgaPCI.h (#876, Takaaki Nomura).
+1188. Extend the frame buffer test in glint_dump_regs (Stefan Dirsch).
+
+XFree86 3.9m (13 August 1997)
+1187. Add printing support to xterm (#870, Thomas E. Dickey).
+1186. Fix denial of service attack through xdm double freeing memory (#875,
+ Kaleb Keithley).
+1185. Fix Solaris build problem (#874, Takaaki Nomura).
+1184. Preliminary experimental support for the Millennium II (#852-857,
+ Andrew Vanderstock).
+1183. Recognise the rev 3 Mystique, and hopefully set everything up
+ correctly for it, change MMIO/fb mapping for Mystique rev >=3.
+ (David Dawes)
+1182. Patches to both XAA and the Glint sources that enable the
+ ScanlineScreenToScreen colour expansion (#873, Alan Hourihane).
+1181. Fix problem of xkbcomp not generating .dir files during install
+ (#872, Kaleb Keithley).
+1180. Fix problem with possible denial of service attack using the X server
+ (#867, Kaleb Keithley).
+1179. Update VidModes.sgml to latest version (#871, Eric Raymond).
+1178. Fix I128 support for AXP (#868, Robin Cutshaw).
+1177. Add planemask support to most XAA functions for all tseng chips
+ (#869, Koen Gadeyne).
+1176. Fix text rendering for W32 at 16bpp, always determine bus type, fix
+ bug in XAA color expansion (#865, Koen Gadeyne).
+1175. Fix ET6000 dram speed code, disable 32bpp on ics5301 ramdacs (#864,
+ Koen Gadeyne).
+1174. Clean up RAMDAC handling in tseng driver, extend stg1702 support, and
+ fix problems caused by treating unknown RAMDACs as AT&T compatible
+ (#862, Koen Gadeyne).
+1173. Fix support for linear memory mode on W32p rev a&b (#861, Koen Gadeyne).
+1172. Fix ET6000 black screen problem (#861, Koen Gadeyne).
+1171. Changes to Amiga XKB code (#860, Bernd Ernesti).
+
+XFree86 3.9l (31 July 1997)
+1170. Fix parsing of DPMS parameters in config file.
+1169. Catch a NULL dereference in lib/X11/lcFile.c (#843, Dirk Hohndel).
+1168. Xterm support for compound text cut and paste (#836, Kaleb Keithley).
+1166. Fix some I128 problems reported with PPro CPUs (#834, Robin Cutshaw).
+1165. Disable C&T fill at 32bpp (#831, David Bateman).
+1164. Update VideoBoard98 file (#830, 842 Takaaki Nomura, Isao Ohishi).
+1163. Prevent re-allocation of cfb ScreenPrivateIndex for multi-head
+ server (#829, Stuart Anderson).
+1162. Fix unintended changes in PCI code.
+1161. Fix handling of PS/2 protocol mice with OpenBSD (it doesn't translate
+ to BusMouse protocol like NetBSD does) (#820, Matthieu Herrb).
+
+XFree86 3.9k (29 July 1997)
+1160. Several fixes to xterm. Correct an indexing error in the doublesize
+ character logic. Correct the logic of ShowCursor when it is painting in
+ a doublesize cell. Correct the behavior when switching to doublesize
+ characters and back again. Add cbt (back_tab) to the terminfo
+ description. Correct the logic for disabling xmc. Minor correction to
+ positioning of underlines for small (e.g., 5x8 font size. Add more
+ special-case tokens to the standalone configure script's imake-option
+ filter. Add a '--enable-logging' option for the standalone configure
+ script. Add check and ifdef's for the standalone configure script to
+ allow for building on platforms with X11R6, which lacks Xpoll.h
+ (#769,821, Thomas Dickey).
+1159. Preliminary support for Millennium on PC98 (#825, Shuichiro Urata,
+ Takaaki Nomura).
+1158. update XKB for PC98 (#825, Isao Ohishi).
+1157. Support XF86Setup for PC98 (#825, Takaaki Nomura, Kazunori Ueno).
+1156. PC98 resync (#825, Michio "Karl" Jinbo).
+1155. Add common Imakefiles for some PC98 sub directories (#825,
+ Michio "Karl" Jinbo).
+1154. Add code to fine tune memory access on ET6000 boards and cleanup some
+ W32 specific code that would write to illegal registers on ET6000 cards
+ (#818, Harald Nordgard Hansen).
+1153. Ensure accelerator CRTC registers are unlocked before writing them and
+ horizontal & vertical syncs are not disabled on mode switches (#817,
+ Marc La France).
+1152. Change xsetroot -mod option to count pixels from left to right within
+ each 16-pixel slice, instead of right to left (#817, Marc La France).
+1151. Cleanup declarations for xf86Verbose, xf86ProbeOnly & xf86ProbeFailed,
+ make VGABase XF86Config option recognized by more servers, HSkew wasn't
+ being dealt with correctly in matching modes to clocks, fixup default
+ mode for the generic VGA driver (#817, Marc La France).
+1150. Fix a few bugs in ATI driver, break it up in multiple files, add
+ support for Mach64 accelerator CTRC, which now is used by default, and
+ generic VGA (untested) (#817, Marc La France).
+1149. Fix build problem on Solaris (#810, Dirk Hohndel).
+1148. Re-enable LEFT_EDGE_CLIPPING_NEGATIVE for the HiQV chips and tidy up the
+ ScreenToScreenColorExpand stuff (#808, David Bateman).
+1147. Enable the sw_cursor option and add support for the no_accel option (#806,
+ Joe Moss).
+1146. Avoid source overruns in xf86DrawStippleScanline() and remove the
+ restrictions on TRIPLE_BITS_24BPP, LEFT_EDGE_CLIPPING
+ and LEFT_EDGE_CLIPPING_NEGATIVE_X (#805, David Bateman).
+1145. Allow keywords with underscores in XF86Setup (#802, Harald Koenig).
+1144. Explicitly enable hsync and vsync on Mach64 boards (#799, Marc La France).
+1143. Small fix for norwegian keyboard in xkb (#797, Harald Nordgard Hansen).
+1142. Add 32bpp to HiQV driver and get CopyArea and Solid Fills accelerated
+ in 32bpp (#790,796, David Bateman).
+1141. Fix clock calculation on HiQV chips (#783, David Bateman).
+1140. Fix hardware clipping and get closer to a working 8x8pattern color expand
+ (#781,811, Alan Hourihane).
+1139. Disable C&T HiQV ImageWrite (#780, David Bateman).
+1138. Change how patterns are packed for LINE_PATTERN_MSBFIRST_INCREASING
+ (#779, Mark Vojkovich).
+1137. SVGA/S3 acceleration improvements (#778, Mark Vojkovich).
+1136. Fix xclock problem that shows up on Cirrus 542x chips
+ (#777, Corin Anderson).
+1135. Small fix for C&T driver (#775,776 David Bateman).
+1134. Merge missing ViRGE code from 3.3* into 3.9* (#773, Harald Koenig).
+1133. Support for I128 DRAM cards (#816, Robin Cutshaw).
+1132. PCI updates required for the I128 server (#815, Robin Cutshaw).
+1131. Fix for Xt/Error.c (#813, Kaleb Keithley).
+1130. Make XF86Setup's keyword matching the same as the Xservers (ie,
+ ignore '_', ' ', '\t' in keywords).
+1129. Tseng documentation update (#800, 803, Koen Gadeyne).
+1128. Update to imake's auto GCC PostIncDir detection for OpenBSD
+ (#794, Matthieu Herrb).
+1127. Fix I128 problems (#792, 809, Robin Cutshaw).
+1126. Fix some errors in the symbols/th XKB file (Poonlap Veeratanabutr).
+1125. Don't use EXTRA_DEFINES in Xserver/xkb/Imakefile (#786, Kaleb Keithley).
+1124. Alternate way of fixing the "./" problem in Imake.rules
+ (#785, Kaleb Keithley).
+1123. Install full path in dynamic libraries for SCO (#782, J. Kean Johnston).
+1122. Fix remaining problems with SCO OpenServer 5 support (#772,
+ J. Kean Johnston).
+1121. Fix support for older I128 cards (#771, Robin Cutshaw).
+1120. Add detection for C&T 68554, and fix detection of the 65550 revision
+ numbers (#770, David Bateman).
+1119. Fix STG170x support in tseng driver (#766, Koen Gadeyne).
+1118. Fix linkkit install problem in apm driver (#767, Holger Veit).
+1117. Add more resolutions to xf86config (#767, Holger Veit).
+1116. Add OS/2 diagnostic on network config (#767, Holger Veit).
+1115. Fix EditRes problems that show up on OS/2 (#767, Holger Veit).
+1114. Fix a problem in OS/2's imakesvc.cmd (#767, Holger Veit).
+1113. Fix lockup when the SVGA server dumps core with the MGA driver
+ on some OSs.
+1112. Fix a bug in cfb24GetSpans which can cause a server crash
+ (StarOffice will provoke this).
+1111. Fix the use of a C++ reserved word in xf86vmode.h.
+1110. Reset the DPMS state to ON when re-entering the server's VT.
+
+XFree86 3.9j (12 July 1997)
+1109. Process Xqueue events synchronously to avoid problems with
+ accelerated servers.
+1108. Fix sqrt problems in miarc (#765, Harald Koenig).
+1107. Remove special Tk 4.0 support in XF86Setup and add C code to match the
+ latest vidmode extension changes. Fix a minor bug in the DPMS code
+ (#764, Joe Moss).
+1106. Several small fixes to Xserver/{dix,include,os/,PEX5} (#760-763,
+ Craig Groeschel).
+1105. XKB fixes (#759, Stuart Anderson).
+1104. Fix uninitialized variable (verbose) in scanpci.c (#757, Thomas Mueller).
+1103. Add big endian version of PCI config structure (#757, Thomas Mueller).
+1102. Add cross compile definitions for LynxOS and add static vga server for
+ LynxOS PowerPC (#757, Thomas Mueller).
+1101. Add bindist files for LynxOS (#756, Thomas Mueller).
+1100.
+1099. Add handling for AST onboard Mach32 card (#754, Bryan Feir).
+1098. Fix a problem in Imake.rules that shows up when using Motif.rules.
+1097. Fix MGA lockup on SVR4.0.
+1096. Add missing for Japanese "small TSU" character to the XKB
+ symbols/jp file (#751, Shigehiko Sasaki).
+1095. Fix ET4000/W32i acceleration at 16 and 24bpp, and accelerate colour
+ expansion at 16bpp and 24bpp for the W32p (#747, Koen Gadeyne).
+1094. Fix for I128 rev 2 chips (#746, Robin Cutshaw).
+1093. Fix typo in xf86_libc.h.
+
+XFree86 3.9i (6 July 1997)
+1092. Fix apm HW cursor problem at VT switch, and a problem with
+ screen-to-screen bitblts (#745, Henrik Harmsen).
+1091. VidMode extensions updates, including adding a new function to
+ return the available clocks, and how many more clocks can be programmed,
+ add the HSkew parameter and some reserved fields (this introduces
+ a protocol incompatibility), and fix a bug in the ValidateModeLine
+ function's clock checking (#744, Joe Moss).
+1090. Add port probing to SuperProbe for the Alliance 6410, 6422 and AT24
+ (#743, Joe Moss).
+1089. Add similar ET6300 detection to scanpci and vgaPCI.h.
+1088. Fix SuperProbe's ET6000 memory probe (#742, Koen Gadeyne).
+1087. Add detection for the ET6100 and ET6300 to SuperProbe (#742,
+ Koen Gadeyne).
+1086. Some PCI video cards don't have the expected "IBM" string in the
+ BIOS, so look for the "PCI" string too. Without this, scanning with
+ -nopci fails for some cards (#741, Koen Gadeyne).
+1085. Possible fix for XWarpCursor() not working with the XInput
+ xf86PostMotionEvent() function (#740, Michael Rohleder).
+1084. Add some "test-support" code to xterm, which is not enabled by
+ default (#739, Thomas E. Dickey).
+1083. Fix ET4000W32p RAMDAC detection (backs out most of #717), make
+ the tseng driver use DELAYED_SYNC, and an (unsuccessful) attempt
+ to get CPU-to-screen colour expansion working (#737, Koen Gadeyne).
+1082. Add missing valuator initialisation to the OS/2, SCO and Xqueue
+ MouseProc() functions. This fixes the mouse problems on those OSs
+ (#736, 738, Holger Veit and Richard Coley).
+1081. Fix a misplaced va_end() in the recent XInput code which caused a core
+ dump on OS/2 (#736, Holger Veit).
+1080. Fix SummaSketch bug that shows up with newer XInput code, add
+ a missing conversion_proc, fix misplaced break, and add new config
+ options to the SummaSketch subsection for ActiveArea and ActiveOffset
+ (#735, Steven Lang).
+1079. Fix a problem with xterm's cursor colour versus the background, and
+ remove a duplicate initialisation of the cursor's GC (#734,
+ Thomas E. Dickey).
+1078. Fix XAA's bpp setting at 24bpp (#733, Mark Vojkovich).
+1077. Fix cpp script problem on AIX (#732, Kaleb Keithley).
+1076. Fix xhost core dump that can happen if no hosts are authorised
+ (#731, Kaleb Keithley).
+1075. Glint driver updates (#729, 730, Alan Hourihane).
+1074. Move the solx86usleep() function out of solx86_init.c into a separate
+ file, which should fix the problems addressed by #726.
+1073. Add ANSI-C wrappers (#724, Holger Veit).
+1072. Update recent config and libX11 changes for OS/2 (#724, Holger Veit).
+1071. Fix and enable ET4000W32i acceleration, and fix unmap bug in the
+ ET6000 memory probe (#723, Koen Gadeyne).
+1070. Replace fdflush() in the Summa and AceCad drivers with tcflush
+ (#722, Steven Lang).
+1069. SCO support updates (#721, J. Kean Johnston).
+1068. Add some more dead accents to the 'se' xkb layout (#718, Dejan Ilic).
+1067. Merge in TOG's X11R6.3 public patch 2.
+
+XFree86 3.9h (30 June 1997)
+1066. Don't call seteuid in the server when the real uid is root. This
+ fixes a problem of not getting a core file under some FreeBSD versions.
+1065. Tseng driver cleanups (#717, Koen Gadeyne).
+1064. 'xset dpms 600 0 0' complains about 600 being greater than 0.
+1063. New XInput driver for the AceCad ADVANCEDigitizer (#716, Shane Watts).
+1062. Clean up some problems with the xf86 wrappers (#715, Matthieu Herrb).
+1061. New Xinput driver for MicroTouch TouchPen touch screen (#714,
+ Patrick Lecoanet).
+1060. Changes for E281-2310 and fully compatible controllers in the
+ Elographics driver (#714, Juergen P. Meier).
+1059. Elographics driver updates (#714, Patrick Lecoanet).
+1058. Fix ROP bugs in the svga/s3v driver (#713, Harald Koenig).
+1057. Fix a malloc/free bug which can cause the Xserver to crash when
+ an lbxproxy terminates.
+1056. Change default compression level in lbxproxy (#710, Kaleb Keithley).
+1055. Xt/Error.c update (#708, Kaleb Keithley).
+1054. LibXext cleanups (#707, Kaleb Keithley).
+1053. Config updates (#706, Kaleb Keithley).
+1052. Add PreviousCandidate and MultipleCandidate keysyms (some new Japanese
+ keyboards have these keys) (#705, Kaleb Keithley).
+1051. Fix some xterm bugs (#700, Thomas E. Dickey).
+1050. Initial part of implementing VT100 doublesize characters for xterm
+ (#700, Thomas E. Dickey).
+1049. First stab at adding dlopen() style loader (#712, Matthieu Herrb).
+1048. Add further acceleration to the GLINT server (mostly disabled) (#711,
+ Alan Hourihane).
+1047. Add support for I128 Series II Rev 2 chips (#704, Robin Cutshaw).
+1046. Additions to the apm driver. Add support for AT3D, acceleration for
+ 8,16,32bpp (for AT3D and AT24, filled rectangles, screen-screen bitblts,
+ host-screen color expansion bitblts for text). DPMS support, hardware
+ cursor code (also in 8bpp), use programmable clock, set MCLK to 57.3
+ MHz on AT3D, various bugfixes and cleanups (#702, Henrik Harmsen).
+1045. Fix problems with displaying card READMEs in XF86Setup (#701, Dirk
+ Hohndel).
+1044. Add left-edge clipping to s3_newmmio. There's bug in both the scanline
+ screen->screen and CPU->screen stipple fallback routines though. Both
+ break certain patterns and the screen->screen bug is worse than the
+ CPU->screen one (#694, Mark Vojkovich).
+1043. Enables the XInput modules from 3.2 to be loaded as modules in
+ XF86_LOADER (#693, Matthieu Herrb).
+1042. Add code to have XAA check to see if a stipple can be reduced to an 8x8
+ pattern before banishing it from the pixmap cache on account of it's
+ size (#692, Mark Vojkovich).
+1041. Fix CapNotLast problem in dashed line code (#686, Mark Vojkovich).
+1040. Add stippled fill fallback for SVGA/S3 if the pixmap cache is too small
+ (#685, Mark Vojkovich)
+1039. Fix for xf86initac,c so that drivers can specify their own WriteBitmap
+ functions and fallbacks for non-cachable stippled fills. This also
+ allows usage of both CPU->screen and scanline screen->screen color
+ expansion instead of one or the other (#684, Mark Vojkovich).
+1038. Some Xlib fixes (#687-690, 695-699, Kaleb Keithley).
+1037. XKB updates (#674, 675, 709, Kaleb Keithley).
+1036. Config updates to make use of change 1033 (#673, Kaleb Keithley).
+1035. Fix a typo in the XKB symbols/hu file and add an entry for it in
+ the rules/xfree86.lst file (Peter Soos).
+1034. Fix a bug in Xt/Error.c that can result in partially duplicated
+ error/warning messages.
+
+XFree86 3.9g (20 June 1997)
+1033. Changes to imake to determine LinuxCLib*Version,
+ LinuxBinUtilsMajorVersion and PostIncDir at build time (#673,
+ Kaleb Keithley).
+1032. Fix SEGV in solx86's xf86MapVidMem() when called without first
+ calling xf86LinearVidMem() (David Thompson).
+1031. Fix for pci detection code in S3 server (#683, Harald Koenig).
+1030. Fix problems with rop -1 in S3V server (#679,681,682, Huver Hu, Harald
+ Koenig).
+1029. Fix cache expansion routine for HARDWARE_PATTERN_NOT_LINEAR (#680,
+ Mark Vojkovich).
+1028. Add "no_split_xfer" option to S3 server (#678, Harald Koenig).
+1027. Fix bug in xterm. Logout records should contain '\0' as first char
+ in user name (#676, Alex Belits).
+1026. Fix color problems on S3 cards with Ti3026 for SVGA/S3 (#671,
+ Achim Oppelt).
+1025. Adapt code to future changes in NetBSD's (and OpenBSD's?) mmap
+ semantics (#670, Matthieu Herrb).
+1024. Fix xterm's op termcap entry, and shorten the entry so it fits within
+ the 1024 character limit.
+1023. Actually include changes 963-965.
+1022. Add accelerated server for cards based on 3DLabs GLINT chipsets. This
+ server is known to work on Elsa GLoria L cards on most motherboards.
+ It does not support any other cards at this time. This work was
+ sponsored by S.u.S.E., Elsa, and SNI (Alan Hourihane, Stefan Dirsch,
+ Dirk Hohndel).
+
+XFree86 3.9f (16 June 1997)
+1021. Fix some build problems with 3.9e.
+
+XFree86 3.9e (15 June 1997)
+1020. Add some more I128 acceleration, including pixmap cache, rectangle
+ fills and line drawing (#669, Robin Cutshaw).
+1019. Fix a compile problem that shows up with GLX isn't enabled
+ (#668, Frederic Lepied).
+1018. If the Wacom driver isn't supplied with a value for the Suppress
+ option it is calculated to report motions according to the screen
+ resolution (#668, Frederic Lepied).
+1017. Fix a bug in the XInput Wacom driver which prevented the eraser from
+ working (#668, Frederic Lepied).
+1016. Add a virtual XInput device called "Switch" which sends extended
+ motions when a different device sends a core event (with AlwaysCore
+ enabled (#668, Frederic Lepied).
+1015. Fix behaviour of XInput relative devices. They send events with
+ accumulated valuators not with valuators deltas (#668, Frederic Lepied).
+1014. XInput devices with AlwaysCore enabled send both core and extended
+ events at the same time (#668, Frederic Lepied).
+1014. Move HP's HPkeysym.h (#667, Kaleb Keithley).
+1013. Fix a bad include in FS.h (#666, Arthur Barstow).
+1012. Add the mechanism to acknowledge the new DacSpeed[] values to the
+ svga/s3 driver. Only the Trios use it so far (#665, Mark Vojkovich).
+1011. Fix(?) Truecolor depths for the Ti 3026/3030 ramdacs in the svga/s3
+ driver (#665, Mark Vojkovich).
+1010. Fix a logic bug in the XAA code that checks to see if there is
+ enough room for 8x8 patterns in the pixmap cache (#664,
+ Mark Vojkovich).
+1009. Changes to vga256/vga to allow the NV1 driver to work without
+ requiring any VGA functionality (#663, David McKay).
+1008. Resync the MGA driver with 3.3 (#660, Radoslaw Kapitan).
+1007. Lots of updates to the svga/ati driver (#659, Marc Aurele La France).
+1006. Update support for ATI Rage II+, Rage Pro in the Mach64 server, scanpci,
+ and SuperProbe (#659, Marc Aurele La France).
+1005. Remove man pages for VGA16 and Mono servers (#659,
+ Marc Aurele La France).
+1004. Fix duplicate target in drivers/s3/Imakefile (#658, Robin Cutshaw).
+1003. Fix some Xprt problems (#655-657, Kevin Samborn).
+1002. Fix some DPMS problems, including problems when the DPMS timeouts
+ are smaller than the screensaver cycle time, and problems with the
+ various DPMS setting not being re-initialised at server reset.
+1001. Fix an InfoRec initialisation problem in xfree68/fbdev (#652,
+ Andreas Schwab).
+1000. Fix incorrect links created from nls/XLC_LOCALE to xc/exports
+ (#652, Andreas Schwab).
+ 999. Fix a flaw in a libX11 security fix (#652, Andreas Schwab).
+ 998. Add libc 6 config for Linux/m68k to Linux.cf (#652, Andreas Schwab).
+ 997. Allow depth-specific Dacspeeds to work for the tseng driver
+ (#651, Koen Gadeyne).
+ 996. Tseng driver cleanups (#650, Koen Gadeyne).
+ 995. Allow xterm to start when /etc/termcap is missing, and fix some
+ configure script nits (#649, Thomas E. Dickey).
+ 994. Fix twm crash if interrupted during startup (#644, Wolfram Gloger).
+ 993. Fontlib fixes (#636-640, 642, 646, 648, Arthur Barstow).
+ 992. Add audit logging to xfwp (#623, Kaleb Keithley).
+ 991. Sun/XKB keyboard fix (#621, Kaleb Keithley).
+ 990. Update xrx defaults (#620, Kaleb Keithley).
+ 989. Fontserver fixes (#613, 643, Arthur Barstow).
+ 988. Imake config updates (#610-612, 614-617, 619, 624, Kaleb Keithley).
+
+XFree86 3.9d (10 June 1997)
+ 987. Fix "xaa_no_color_exp" option for scanline-screen-to-screen color
+ expansion (#629, Koen Gadeyne).
+ 986. Add hint how to disable building Xprt to xf86site.def (#627, Koen
+ Gadeyne).
+ 985. Change Linux to use -D_REENTRANT (#644, Wolfram Gloger).
+ 984. Fix C&T driver to be more strict about DClk and MClk limits for HiQV
+ chips (#645, David Bateman).
+ 983. Fix I128 server (#635, Robin Cutshaw).
+ 982. Fix VT switching problems in mga driver (#634, Guy Desbief).
+ 981. Fixes for xterm (missing part of install-rule, incorrect assignment for
+ --enable-color-mode option, unexpected cursor color change while
+ scrolling) (#632,633, Thomas Dickey).
+ 980. Fix a problem where the Tseng memory mapped registers get cleared in
+ vgaScreenInit() when it is clearing the screen as startup. This only
+ happened for 8bpp with linear mode enabled (#630, OEyvind Aabling).
+ 979. Avoid nested asm calls for SVR4.0 (#631, Takaaki Nomura).
+ 978. Fix error messages when loading modules in the static server (#626,
+ Matthieu Herrb).
+ 977. Change svga/s3 into two separate modules s3_pio and s3_newmmio. This
+ doesn't work with the static server at this point. Add linear
+ addressing and 16/24(packed)/32bpp. Add pci_retry option. (#625,
+ Mark Vojkovich).
+ 976. Allow the ChipId and ChipRev values to be overridden from the XF86Config
+ for the Mach64 server.
+ 975. Fix some 1bpp and 4bpp problems (#609, Marc Aurele La France).
+ 974. Changes to allow SuperProbe, Mach64 driver, scanpci and vgaPCI to
+ detect the newer ATI 3D Rage II+ chips (#609, Marc Aurele La France).
+ 973. Allow the server side of the multibuffer extension to compile (#609,
+ Marc Aurele La France).
+ 972. Continue removal of the XF86_VGA16 & XF86_Mono servers (#609,
+ Marc Aurele La France).
+ 971. Add some new keywords to xf86_Config.h (#608, Stuart Anderson).
+ 970. Fix problem building the PC98 loader server (#607, Takaaki Nomura).
+ 969. Fix xdm/Imakefile for OpenBSD (which doesn't have libcrypt)
+ (#606, Matthieu Herrb).
+ 968. Fix default value for xf86bpp (David Dawes, Dirk Hohndel).
+ 967. Some cleanups to tseng driver, re-apply the STG1700 RAMDAC changes and
+ re-introduce some 1/4bpp checks (#605, Koen Gadeyne).
+ 966. Fix a few typos in tseng.sgml (#605, Koen Gadeyne).
+ 965. Automagically select the correct protocol for PS/2 mice at startup
+ with XF86Setup (#604, Dirk Hohndel).
+ 964. Fix XF86Setup to follow links that point to non-existing files (so that
+ it creates /var/X11R6/bin/X if necessary (#604, Dirk Hohndel).
+ 963. Fix XF86Setup to allow reading the right README files for cards using
+ the SVGA server (#604, Dirk Hohndel).
+ 962. Fix small problem with installing the LinkKit (#603, Geert Uytterhoeven).
+ 961. Fix 8x8 pattern cache size checking (#602, David Bateman).
+ 960. Remove old (pre-XAA) acceleration from C&T driver (#601, David Bateman).
+ 959. Two small fixes in C&T driver for "use_vclk1" option and ImageWrites
+ (#600, David Bateman).
+ 958. Add C&T 65555 detection to SuperProbe and SVGA server; treat it
+ basically like a 65550 but attempts to use the TMED features (untested)
+ (#600, David Bateman).
+ 957. Fix build problems in tseng_driver.c (#599, David Bateman).
+ 956. Fix XF86Setup build problem (#598, Takaaki Nomura).
+ 955. Fix yet another fontserver problem (#597, Arthur Barstow).
+ 954. Remove bogus changes to xc/Imakefile (Dirk Hohndel).
+ 953. Fix incorrect define for DGA (Steve Kump).
+
+XFree86 3.9c (3 June 1997)
+ 952. Fix a problem with the HW cursor being drawn in the overscan area
+ with the svga/s3v driver and cleanup some of the register
+ save/restore (#585, Harald Koenig).
+ 951. Disable the banked-mode speedups for the Tseng driver when running
+ in linear mode (#584, David Bateman).
+ 950. Fix for CR53 not being restored unless xf86Verbose > 1 in the svga/s3v
+ driver (#572, Sebastien Marineau).
+ 720. Fix problems restoring some non-standard text modes for the Millennium
+ (#571,573, Radoslaw Kapitan, #574, Ansgar Hockmann).
+ 948. Fix svga/s3v panning at 24bpp (#570, Harald Koenig).
+ 947. Fix S3V panning at 24bpp (#569, Harald Koenig).
+ 946. Fix misleading messages in the svga/s3v driver when the SVGA server
+ is started with a non-ViRGE S3 card (#568, Sebastien Marineau).
+ 945. Alternate S3V 32<->24 bpp translation to avoid unaligned traps
+ on Alpha platforms (#567, Harald Koenig).
+ 944. Disable 8x8 pattern fill when less than 8 scanlines are available
+ in the XAA pixmap cache (#566, David Bateman).
+ 943. Fix a screen restore problem for the Mystique when the server is
+ started with '-probeonly' (#559, Radoslaw Kapitan).
+ 942. Turn the monitor back on after DPMS has done its thing for
+ OSs where the input devices are not selectable (558, Jack Thomasson).
+ 941. Fix some incorrect ROP definitions in the C&T driver (#557,
+ David Bateman).
+ 940. Fix some text font corruption for the S3 Trio64 (#549,554 Harald Koenig).
+ 939. XF86Setup carddata updates (#547, Koen Gadeyne, #552, Matthieu Herrb).
+ 938. Modify xon to use the fully qualified hostname on Linux (#544,
+ Burchard Steinbild, Dirk Hohndel).
+ 937. Exclude ROPs with no source from XAA CopyPlane functions (#538,
+ David Bateman).
+ 936. Mach32 updates, including accepting '-bpp 15' and increasing the
+ 16bpp clock limit for the 68875 ramdac to 80MHz (#536, Bryan Feir).
+ 935. PC98 doc updates (#535, Takaaki Nomura).
+ 934. Fix for an S3V server problem at 16bpp introduced in change 650
+ (#532, Huver Hu).
+ 933. Further fix for Mystique problems when VT switching (#531,
+ Radoslaw Kapitan).
+ 932. Fix a blit bug with the ViRGE chip in the svga/s3v driver which
+ shows up with xv rubber-banding (#529, Sebastien Marineau).
+ 931. Fix a blank screen problem when switching back to the Xserver
+ from a text VT with the Mystique (#520, Radoslaw Kapitan).
+ 930. Some minor Tseng code cleanups (#519, Koen Gadeyne).
+ 929. Add a timeout to the MGA Sync() function (#518, Radoslaw Kapitan).
+ 928. Map only the amount of video memory present in the MGA driver
+ rather than always 8MB (#516, Radoslaw Kapitan).
+ 927. Disable the HW cursor in the tseng driver when entering DGA mode
+ (#514, Koen Gadeyne).
+ 926. Fix a S3V server text console corruption problem when running at 24bpp
+ (#513, Kevin Brosius).
+ 925. Update NetBSD/OpenBSD docs (#512, Matthieu Herrb).
+ 925. Update Cirrus docs (#509, Harm Hanemaayer).
+ 924. Change Tseng memory mapped registers to volatile (#507, Koen Gadeyne).
+ 923. Disable Tseng 24bpp for CH8398 RAMDAC (#507, Koen Gadeyne).
+ 922. Update docs to reflect change 643 (#507, Koen Gadeyne).
+ 921. Re-enable Tseng 8bpp+linear+accel combination (#507, OEyvind Aabling).
+ 920. Update mga docs (#502, #503, Radoslaw Kapitan).
+ 919. Fix font and LUT corruption on VT switch for the svga/s3v driver
+ (#497, Harald Koenig).
+ 918. Fix some acceleration bugs in the TGUI driver (#495,496, Alan Hourihane).
+ 917. Updates to the I128 server for Alpha platforms (#494, Robin Cutshaw).
+ 916. Fix a Mystique colour problem when switching VTs (#488, Guy Desbief).
+ 915. Fix a bug in Mystique memory detection (2MB was detected as 4MB)
+ (#482, Radoslaw Kapitan).
+ 914. Merge in simple dashed horizontal and vertical line drawing in the
+ S3V server into s3line.c, and use this for 24/32bpp (#474, Huver Hu).
+ 913. Modify the S3V server to advertise a 32 bits-per-pixel pixmap
+ format to clients, and translate to/from packed 24bpp when accessing
+ the framebuffer. This allows a lot of clients which didn't know
+ how to handle the 24 bits-per-pixel pixmap format to work
+ (#474, Huver Hu).
+ 912. Start cleanup of depth/bitPerPixel usage in the SVGA server. xdpyinfo
+ should now report the correct information (#472, Mark Vojkovich).
+ 911. Change chiprounding from 128 to 64 in 8bpp for the Mystique, which
+ allows 1600x1200x8 on 2MB boards (#467, Radoslaw Kapitan).
+ 910. Position the tseng accel scratchpad area correctly (#461, Koen Gadeyne).
+ 909. Fix a problem with the W32 server that causes it to hang with
+ W32i cards (#456, Koen Gadeyne).
+ 908. Save the initial state of bit 7 of CR58 in the S3, S3V servers and
+ svga/s3v driver, and change the "ras_precharge" option to allow it
+ to be turned on or off (#458, Harald Koenig).
+ 907. Enable the clockchip in the tseng driver by default when a suitable
+ RAMDAC/clockchip is found (#448, Koen Gadeyne).
+ 906. Fix text mode restore with ViRGE (#443, Harald Koenig).
+ 905. Add CH8398 probing to XF86_W32 (#439, Kurt Olsen).
+ 904. Add STG1702 probing to XF86_W32 (#434, Stuart Lamble).
+ 903. Fix blitbug widths in SVGA/S3V and S3V servers, enable the hardware
+ cursor in doublescan mode in SVGA/S3V server, fix the 24bpp problem in
+ SVGA/S3V server when mode switching (#432, Sebastien Marineau).
+ 902. Disable 24bpp on the STG1700, new "default" linear memory base for W32p
+ cards, fix STG170x problems (#430 Koen Gadeyne).
+ 901. Add MODULEVENDORSTRING to the ModuleVersionInfo (#423, Stuart Anderson).
+ 900. Finetuning for Miro 80SV support. Add "no_pci_disconnect" Option
+ (for some Alpha boxes, Alphastation255 and UDB) (#416, Harald Koenig).
+ 899. Fix several problems with the tseng driver. Don't allow pixmux modes
+ in the VGA16 or MONO server (it doesn't work), disable the combination
+ 8bpp + linear + acceleration, fix maximal pixel clock for W32p, fix
+ cut'n'paste bug where CRTC 0x31 was restored incorrectly, update the
+ XF86_SVGA manual pages (#414,415, Koen Gadeyne).
+ 898. NetBSD and OpenBSD doc updates (#412, Matthieu Herrb).
+ 897. LynxOS documentation updates (#411,537 Thomas Mueller).
+ 896. LynxOS microSPARC fixes (#410, Thomas Mueller).
+ 895. Small fixes for dacspeed and set_mclk code in the S3V server (#401,
+ Harald Koenig).
+ 894. Fix text mode restauration in S3V server (#400, Harald Koenig).
+ 893. Some misc bug fixes (#395, Harald Koenig).
+ 892. Change clock limits for S3 /DX and /GX chips to 170/170/135 based
+ on information from S3 (#395, Harald Koenig).
+ 891. Add detection and higher clock limits for MELCO S3 ViRGE card
+ (#395, Harald Koenig).
+ 890. Add set_mclk for S3V and S3/Trio64 (#395, Harald Koenig).
+ 889. Add support for specifying DACSpeeds separately for 8/16/24/32bpp
+ (#395, Harald Koenig).
+ 888. Fix module handle leak in LoaderOpen (#393, Eric Nygren).
+ 877. Add Mach8 and 8514 to loader server (#387,394, Hans Nasten).
+ 876. More 68k loader updates (#380, Alan Hourihane).
+ 875. Some updates to the S3 server (#374, Harald Koenig).
+ 874. Fix some hangs on C&T 65550/65554 (#370, David Bateman).
+ 873. Several OS/2 fixes: Add the creation of host.def if not present. Get
+ errno declared correctly. Add missing commandline options (#403,405
+ Holger Veit).
+ 872. Fix a problem in the tseng driver which was causing it to fail at >8bpp
+ with the STG1700 RAMDAC (#594, Koen Gadeyne).
+ 871. Tseng doc updates (#594, Koen Gadeyne).
+ 870. Enable shadow passwords by default for xdm on Linux-Elf.
+ 869. Fix Xrm buffer overflow in Xprint ddx (#591, Kaleb Keithley).
+ 868. Fix for incorrect handling of negative values in cfb (#586, Harald
+ Koenig).
+ 867. Fix for fontserver accessing NULL pointer (#587, Arthur Barstow).
+ 866. A better fix for change 862 (#590, Kaleb Keithley).
+ 865. Fix the incorrect resetting of the HW cursor hotx/hoty values at
+ VT switch in most servers/drivers that support HW cursor
+ (based on #582, OEyvind Aabling, #588, Dejan Ilic).
+ 864. Fix for Xlib/Xt buffer overflows which can be triggered by long
+ $LANG and related environment variables (#576, Alex Belits).
+ 863. Cards db updates (#583, Dirk Hohndel, Harald Koenig).
+ 862. Fix for NULL dereference in XtOpenApplication/XtAppInitialize.
+ This also makes these functions behave as documented (ie, exit
+ when the display open fails).
+ 861. Some man page updates.
+ 860. Refine change 856 to take into account that some forms of 8x8
+ pattern fill only need one scanline in the XAA pixmap cache
+ (#581, David Bateman).
+ 859. Remove some unneeded <locale.h> includes in libXp and XKB (libX11)
+ (#579, 580, Kaleb Keithley).
+ 858. Fix a problem that can cause xfs to crash after running for a while
+ (#578, Arthur Barstow).
+ 857. Fix a problem with xfs that meant it could be killed by interrupting
+ one of its clients (#575, Arthur Barstow).
+ 856. Disable 8x8 pattern fill when less than 8 scanlines are available
+ in the XAA pixmap cache (#566, David Bateman).
+ 855. Fix some sgml problems in fbdev.sgml (#564, Matthieu Herrb).
+ 854. Cards db updates (#548, Koen Gadeyne, #552, Matthieu Herrb,
+ #555, Harald Koenig).
+ 853. Make the TGA server us the same black/white pixel defaults as the
+ others, and make it honour the flippixels flag (#551, Alan Hourihane).
+ 852. Updates for the VGADriverDoc sample stub driver (#546, Harald Koenig).
+ 851. Fix uninitialised variables in xeyes which can cause it to crash
+ on Alpha platforms (#546, Harald Koenig).
+ 850. Fix a problem where XAA calls accel text functions with a ROP that
+ has no source by rechecking the text function when the ROP is changed
+ in the gc (#543, David Bateman).
+ 849. Fix an xterm autoconf problem (#541, Thomas E. Dickey).
+ 848. Add support for ICD2061 programmable clock in the pvga1 driver,
+ as used by Diamond Speedstar 24X cards (#539, Torsten Duwe).
+ 847. Fix XAA cap style problem with thin lines that shows up with the
+ MGA driver (#540, Radoslaw Kapitan).
+ 846. Update the Cards db for ViRGE cards (#534, Sebastien Marineau).
+ 845. PC98 doc updates (#530, Michio "Karl" Jinbo).
+ 844. Implement the Get/SetViewPort() functions in the VidMode extension
+ (these were already documented).
+ 843. Fix some client/server protocol mismatches in some newer VidMode
+ extension functions, and allow new clients to not fail with
+ servers that don't have these fixes. The extension version has
+ been bumped to 0.8.
+ 842. Allow xconsole to handle regular files (it could in our R5-based
+ releases, but this was lost when we moved to R6).
+ 841. Updates of tgetent for terminfo vs termcap for resize (#527,
+ Thomas E. Dickey).
+ 840. Add aixterm-style 16 colour support to xterm (#527, Thomas E. Dickey).
+ 839. Make sure the port number is printed in host byte order in Xserver
+ AUTH warning messages (#525, Marc W. Eichin).
+ 838. Stop xterm from setting the TERMCAP environment variable when
+ using terminfo (#523, Mark W. Eichin).
+ 837. Remove '.' from DefaultUserPath (#517, Per Fogelstrom).
+ 836. Add more ET6000-based cards to the Cards db, and make ET6000 and
+ ET4000w32i/p cards point to the SVGA server instead of the W32 server
+ (#515, Koen Gadeyne).
+ 835. Remove '-m486' from the default gcc options.
+ 834. Add detection of other variants of the Cyber9385 to the trident
+ driver and SuperProbe (Arthur Tateishi and Alan Hourihane).
+ 833. Change the SVGA server to tell DGA clients that the memory available
+ is InfoRec.videoRam rather than ChipLinearSize (which is often
+ too large).
+ 832. Cards db updates (#511, Harm Hanemaayer).
+ 831. Fix LynxOS inconsistent TERMCAP use by xterm and resize ($504,
+ Thomas Mueller).
+ 830. Fix a duplicate declaration in imConv.c that shows up when building
+ without XKB support, and remove a "Const" from the declaration
+ (#505, David A. Koontz).
+ 829. Remove all local symlinks for 'make clean' in lnxLib.rules.
+ 828. Add an autoconf configuration script for xterm. This isn't used
+ in the standard build process, but is useful when building xterm
+ standalone (#500, Thomas E. Dickey).
+ 827. Fix a problem in the RECORD server extension where the last ClientDied
+ is never flushed (#498, Kaleb Keithley).
+ 826. Fix array bounds problem in dixutils.c (#493, Kaleb Keithley).
+ 825. Fix Xserver crash in SHAPE extension (#492, Kaleb Keithley).
+ 824. Fix typos in NetBSD.cf and OpenBSD.cf (#491, Takaaki Nomura).
+ 823. Update sun.cf with the version numbers of more recent Sun ProWorks
+ compilers (#489, William Austin).
+ 822. TOG fix for the lib/X11 -xrm buffer overflow (#487, Kaleb Keithley).
+ 821. XInput doc updates (#486, Frederic Lepied).
+ 820. Fix SuperProbe's memory size detection for the ATI 264VT-B, 264GT-B,
+ 264LT and above, and fix SuperProbe's detection of the 264LT
+ (#481, Marc Aurele La France).
+ 819. New entries for the Monitors db (#478, collected by Andrew Vanderstock).
+ 818. Enable building support for the NetBSD/OpenBSD/Solaris aperture
+ drivers by default.
+ 817. Have postinst.sh optionally install a link in /usr/bin to rstartd.
+ 816. Change the name of the saved ids feature test macro in xterm to
+ be more accurate.
+ 815. Enable colour in the default XTerm app-defaults file, and include
+ the colour-related resources there.
+ 814. Update SOLX86 docs (#477, Matthieu Herrb).
+ 813. Update the Xservers to check for /dev/xsvc before /dev/fbs/aperture
+ on Solaris (#477, Matthieu Herrb).
+ 812. Fix XAA stipple ScreenToScreen colour expansion, and fix a problem
+ with stipples when ONLY_TRANSPARENCY is flagged (#476, David Bateman).
+ 811. Fix Xlib ctstowcs parser mishandling charset escape sequences in
+ COMPOUND_TEXT (#470, Kaleb Keithley).
+ 810. Fix the -ar1 and -ar2 Xserver flags breaking XKB auto-repeat (#469,
+ Kaleb Keithley).
+ 809. Add a backward-compatibility option to disable the recent XtMalloc
+ changes (#468, Kaleb Keithley).
+ 808. Bump the revision number of SuperProbe (#462, Koen Gadeyne).
+ 807. Add ICS5341 and ISC5301 SDAC/Gendac detection to SuperProbe (#462,
+ Koen Gadeyne).
+ 806. Fix negative offsets in pixmap during stipple fill (#460,
+ Radoslaw Kapitan).
+ 805. Fix the layout of the mouse protocol buttons in XF86Setup. XF86Setup
+ now requires Tk version 4.1 or later (#459, Matthieu Herrb).
+ 804. Install rstartd in /usr/X11R6/bin rather than in /usr/bin.
+ 803. Fix a DGA addressing problem in the S3 server (#457, Mark Vojkovich).
+ 802. Remove the part of the PCI config-type detection that seems to switch
+ some Neptune-based machines from type 1 to type 2.
+ 801. xtest update for OpenBSD (#455, Matthieu Herrb).
+ 800. Only show Xinput initialisation messages once (#454, Matthieu Herrb).
+ 799. Add support for the IntelliMouse protocol to xf86config and XF86Setup.
+ 798. Fix a problem in the Xservers where the DPMS timer code can cause
+ select() can get called with a negative timeout value (and get stuck
+ in an infinite loop) (#453, Van Jacobson).
+ 797. OS/2 updates (including docs) (#452, Holger Veit).
+ 796. Doc updates (#450, Matthieu Herrb).
+ 795. Fix the trident driver to make virtual resolutions work for the
+ TGUI96xx/Cyber chips and make 32bpp available to these chips too.
+ Also, update the clock code for these chips to allow higher
+ resolutions (#386, Alan Hourihane).
+ 794. Disable the svga/s3v register dumps except for xf86Verbose > 1.
+ 793. Fix the svga/s3v driver Probe() to not falsely assume a ViRGE card
+ is present in some circumstances.
+ 792. Add some new entries for the ServerFlags section to allow some
+ control of the code used to determine the PCI config type on
+ Intel platforms.
+ 791. Fix handling of the "line" parameter for the scroll-forw/scroll-back
+ actions in xterm, and add entries to the XTerm app-defaults to
+ use buttons 4 and 5 (as generated by the wheel on the IntelliMouse)
+ for scrolling.
+ 790. Add debugging messages to the PCI probe code. These are enabled
+ when xf86Verbose > 2. Also, try scanpci's method of detecting PCI
+ config type 1 when the other method fails.
+ 789. Fix DeviceButtonMotion (#437, George Sachs).
+ 788. Fix for SuperProbe dumping core on NetBSD (#433, Matthieu Herrb).
+ 787. Fix fbdev.c and update documentation (#428, Geert Uytterhoeven).
+ 786. mga/README updates (#419, Radoslaw Kapitan, #431, Guy Desbief).
+ 785. xtest fixes, and updates for Linux (Harald Koenig).
+ 784. MGA doc updates (#447, Guy Desbief).
+ 783. Fix the Xt TopLevelShell's XtNiconic resource (Sekhar Makkapati).
+ 782. Tseng doc updates (#445, Koen Gadeyne).
+ 781. Tseng doc updates (#421, Harald Nordgard Hansen).
+ 780. Change the behaviour of XtMalloc, XtCalloc and XtRealloc when
+ Malloc0ReturnsNull is set to YES so that they conform to the
+ Xt spec (#444, Kaleb Keithley).
+ 779. Fix for buffer overflows in libX11's GetDatabase(). This can be
+ used to exploit setuid programs linked against libX11
+ (#442, Harald Nordgard Hansen).
+ 778. Doc updates (#441, Takaaki Nomura).
+ 777. Doc updates (#440, Thomas Mueller).
+ 776. Modify some messages in the svga/s3v driver (#443, Harald Koenig).
+ 775. Undo change 623; the post dividers were incorrect (#435, Marc Aurele
+ La France).
+ 774. Move the Tk/Tcl include dirs after all the others in the XF86Setup
+ Imakefile to make sure they don't cause installed X headers to be
+ incorrectly used.
+ 773. Add CH8398 RAMDAC detection to SuperProbe (#418, Kurt Olsen).
+ 772. Fix an error in xterm's vt220 emulation: the DECUDK is only supposed
+ to be interpreted for _shifted_ function keys (#384, Thomas E. Dickey).
+ 771. Patch to GLX comment/example in xf86site.def (#409, Henry Worth).
+ 770. Improve handling of screen pitch for accelerated C&T driver (#407,
+ David Bateman).
+ 769. Add support for the Miro 80SV to the S3 server (#406, Harald Koenig).
+ 768. Fix bmtoa, smproxy, twm, xsm and Xprint to use mkstemp, if available,
+ to avoid the mktemp() race condition (#404, Matthieu Herrb).
+ 767. Several updates XInput: Add always core feature to mouse driver. Add zone
+ configuration for the wacom driver (TopX, TopY, BottomX, BottomY). Add
+ KeepShape option for the wacom to respect the ratio of width/height
+ |of the screen. Add multiple active zones on the same tablet. Add
+ checks not to send core button events when multiple devices control the
+ core pointer. Fix problem in the mouse driver not sending the button id
+ in extended events. (#402, Frederic Lepied).
+ 766. More modes for xf86config and XF86Setup database (#397, Koen Gadeyne).
+ 765. Fix name of GLX stub library (#389, Henry Worth).
+ 764. Renumber option flag definitions to allow more space in the various
+ categories.
+ 763. Fix problems with DGA on 4/8MB Millenniums (#390, Radoslaw Kapitan).
+ 762. Fix Mystique display problems and dim text font after exit problems
+ (#378,379, Guy Desbief).
+ 761. Rewrite clock restoring procedure for mga driver (#385, Radoslaw Kapitan).
+ 760. More modes for XF86Setup database (#372, Koen Gadeyne).
+ 759. Fix typos in NetBSD.cf (#363, Takaaki Nomura).
+ 758. Add a ModuleInit function to libxaa.a (#362, J. Kean Johnston).
+ 757. Fix a NULL dereference in xf86Config.c on OSs that don't support
+ dlopen() loading for the static servers (#361, Thomas Mueller).
+ 756. Fix a problem with references to the GLX stub libraries in
+ Xserver/Imakefile that affects building static servers
+ (#361, Thomas Mueller).
+ 755. Allow most of the extensions in Xext to be dynamically loaded (in
+ a single module) (#360, Matthieu Herrb).
+ 754. Allow the DBE extension to be dynamically loaded (#359, Matthieu Herrb).
+
+XFree86 3.9b (4 May 1997)
+ 753. Add BuildPC98Servers as an easy way to enable/disable building
+ all PC98 servers.
+ 752. Build Xvfb by default to help pick up build problems.
+ 751. Make 'makedepend' understand '-U' on the command line.
+ 750. Some fix-trackers from TOG, includes:
+ lib/Xi: missing error message (#352 -- we already had this fix)
+ lib/X11: long font paths can garbage heap (#353)
+ fix potential memory leak in xinput ProcXGetDeviceMotionEvents (#354)
+ fix unmatched quotes in comments (and other stuff?!?) (#355)
+ config updates (#356)
+ lib/X11: when IMS dies the library closes all open IMs (#357)
+ lib/X11: When doing XSetICValues and IMS returns ERROR, library core
+ dump (#358).
+ 749. Clean up the GLX for the static-linked servers (#351, Henry Worth).
+ 748. Fix SCO Open Server build problem (#348, J. Kean Johnston).
+ 747. Add an option to allow VClk1 to be used as the programmable clock
+ with C&T 65550 and 65554 chips (#346 Daniel Bischof, Andreas Heitmann
+ and Thomas Landgraf).
+ 746. Remove trailing ',' at the end of InfoRec initialisations, which
+ was hiding potential compiler warnings (#343, Koen Gadeyne).
+ 745. Replace the ChipClockScaleFactor field with ChipClockMulFactor and
+ ChipClockDivFactor to allow for non-integer factors required in
+ some cases (#343, Koen Gadeyne).
+ 744. Fix some 'make' problems that show up on NetBSD and OpenBSD, and clean
+ up BSD 4.4 -specific make stuff in the config/cf directory
+ (#342, #344, Matthieu Herrb).
+ 743. Add better error/warning messages for the aperture driver code for
+ NetBSD/OpenBSD (#341, Matthieu Herrb).
+ 742. Block choosing interleave mode for the Mystique, and set maxPixelClock
+ for the Mystique (#338, Radoslaw Kapitan).
+ 741. Add ability to set MCLK for the mga driver in XF86Config (#338, #339,
+ Radoslaw Kapitan).
+ 740. Fix some problems with XAA DELAYED_SYNC and the software cursor and
+ backing store -- new wrappers are added (#337, Sebastien Marineau).
+ 739. Re-enable HW cursor for Millennium, and implement looping over
+ MGAIdent when checking the Chipset (#336, Radoslaw Kapitan).
+ 738. Remove some assumptions about burst modes from the C&T ImageWrite
+ function (#335, David Bateman).
+ 737. Matrox Mystique driver support, which should work fine with
+ acceleration disabled (#334, Guy Desbief).
+ 736. Fix for double-height MGA hw cursor when using interlaced modes
+ (#333, Radoslaw Kapitan).
+ 735. Explicit syncing of the blitter at the end of the C&T XAA primitives
+ is no longer needed since delayed syncing is off by default
+ (#332, David Bateman).
+ 734. Use the source pitch for colour CPU to screen operations in the C&T
+ driver (#332, David Bateman).
+ 733. Fix writing the 16bpp planemask to the chip in the C&T driver
+ (#332, David Bateman).
+ 732. Stop reserving 1kb of video memory when the accelerator is disabled
+ for the Tseng driver (#331, Stuart Lamble).
+ 731. Fix Trident 96xx/Cyber series for snow on the screen and fix
+ acceleration issues (#330, #349, Alan Hourihane).
+ 730. C&T doc updates (#329, David Bateman).
+ 729. Fix a bitblt bug for 8bpp, widths 49..56 in the s3v driver (#328,
+ Sebastien Marineau).
+ 728. Add filled trapezoid support to the s3v driver (#328,
+ Sebastien Marineau).
+ 727. Add caching of often-used ViRGE registers (#328, Sebastien Marineau).
+ 726. Add hw cursor support for the SVGA s3v driver (#328, Sebastien Marineau).
+ 725. Add a new kind of XAA pixmap cache slot which is used to hold mono
+ 8x8 patterns for chips which have PROGRAMMED_BITS (#327,
+ Sebastien Marineau).
+ 724. Fix XAA pixmap cache invalidation after a VT switch (#327,
+ Sebastien Marineau).
+ 723. Fix lockup problem in SVGA s3v driver, and some cleanups (#326,
+ Harald Koenig).
+ 722. Fix MGA hw cursor not displaying after switching resolutions
+ (#325, Radoslaw Kapitan).
+ 721. Fix text colour problems for ViRGE/VX, a rectfill and bitblt bug
+ for virtual width == 2048, and avoid some more bad hardware lines in
+ the S3V server (#324, Harald Koenig).
+ 720. Move chipset independent hw-cursor stub from mga_dac3026.c to
+ mga_hwcurs.c (#322, Radoslaw Kapitan).
+ 719. Fix a build problem in osPexFont.c, and add a ModuleInit function
+ for libxf86cache.a (#321, Michael Rohleder).
+ 718. Fix a 32bpp Millennium DAC initialisation typo (#318, Radoslaw Kapitan).
+ 717. Loader support for m68k (#317, #323, Alan Hourihane).
+ 716. Fix copyright and remove RCS idents in xf86_ldext.h (#316,
+ Matthieu Herrb).
+ 715. Fix some NonTE text problems, and back out change #690 (#315,
+ David Bateman).
+ 714. Add initialisation of GlxInitVisualsPtr to loadmod.c (#313, Henry Worth).
+ 713. Don't build libX11 for BuildServers only unless building the Xnest
+ server (#312, Marc Aurele La France).
+ 712. Remove extraneous line in xf86text.c (#311, Harald Nordgard Hansen).
+ 711. Restore changes accidentally backed out of xfree86.cf in 3.9a
+ (includes #310, #313, #320, #326).
+ 710. Open /dev/tty0 instead of /dev/console on Linux to find the first
+ free VT.
+
+XFree86 3.9a (17 April 1997)
+ 709. Add delayed syncing as an optional flag for XAA. This is now
+ currently enabled only in the S3 driver (#308, Mark Vojkovich).
+ 708. Several fixes to TE and NonTE fonts. The server now passes CH06
+ drwimgstr, drwimgst16, drwstr, drwstr16, drwtxt and drwtxt16 xtest tests
+ (#305,307, Sebastien Marineau).
+ 707. Add Latin2 Type1 fonts (Peter Soos).
+ 706. Add Latin2 bdf fonts (Petr Kolar).
+ 705. Add SubsequentDashedTwoPointLine to XAA (#296, Mark Vojkovich).
+ 704. Add a Hungarian XKB symbols file (Peter Soos).
+ 703. Add support for Microsoft Intellimouse (#304, Thomas Vogler).
+ 702. Add ViRGE/VX support to SVGA/S3V server; this isn't really working, yet
+ (#299,301, Harald Koenig).
+ 701. Add memory, FIFO, and PCI retry options to SVGA/S3V server (#293,300,
+ Sebastien Marineau).
+ 700. Add support for 15bpp and 32bpp to SVGA/S3V server. 32bpp only with
+ very limited acceleration (#293,300, Sebastien Marineau).
+ 699. Only build libX11 while doing BuildServersOnly if Xnest is enabled (295,
+ Harald Koenig).
+ 698. Disable color expansion with planemask at 24bpp in chips driver (#303,
+ David Bateman).
+ 697. Fix small bug in SVGA/S3 dash line code (#302, Mark Vojkovich).
+ 696. Allow trident 96xx chips to restore text mode (#298, Alan Hourihane).
+ 695. Fix virtual resolutions for trident driver at 24bpp (#298, Massimiliano
+ Ghilardi).
+ 694. TGUI driver updates for PC98 (#297, Akio Morita)
+ 693. Fix building PC98 modules, resync PC98 Imakefile (#297, Takaaki Nomura).
+ 692. Fix ch8398 ramdac command byte for 8bpp in tseng driver (#294,
+ Krajcsovits Gyorgy).
+ 691. Fix NonTE fonts in XAA (#292,309 David Bateman).
+ 690. Disable XAA matchcommon logic to fix problem with grayed out fonts
+ (#291, David Bateman).
+ 689. Fix sis driver for 8x8 color expand pattern fill pattern flags and XAA's
+ new synching policy (#290, Xavier Ducoin).
+ 688. LynxOS updates (#289, Thomas Mueller).
+ 687. Enable 1bpp and 4bpp for the chips driver (#288, David Bateman).
+ 686. Jump version number to document that this is the branch working towards
+ XFree86-4.0.
+
+XFree86 3.2At (14 April 1997)
+ 685. Fix ImageText fallback (#287, David Bateman).
+ 684. Some fixes for NonTE text. Add FixedBase support. Add TRIPLE_BITS24BPP
+ support. Fix CPU_TRANSFER_PAD_QWORD problem. Fix possible loss of a few
+ pixels at the end of NonTE text strings (#286, David Bateman).
+ 683. Fix compile problem with USL compiler (#283, David Bateman).
+ 682. Updates to mga_reg.h for Mystique (Guy Desbief).
+ 681. Add ATT20C49x RAMDAC support for 16 and 24bpp modes to tseng driver.
+ Make ET6000 hardware cursor use closest available color instead of
+ refusing to change colors when it can't find an exact match. Fix
+ another W32i linear mode bug. Change ET6000 pixel clock limits as per
+ Tseng's recommendations (=much lower than we had before). fix a BUG in
+ the ET4000 "standard set-of-clocks" code. Use ChipClockScaleFactor.
+ (#282, Koen Gadeyne).
+ 680. Fix and re-enable 8x8 pattern color expansion (!=24bpp) for Alpine cards
+ Fix CPUToScreen color expansion for 24bpp mode, fix determining the BG
+ color in 24bpp color expansion routines (#281,285, Corin Anderson).
+ 679. Various Cirrus fixes and additions. Fix HAVE_546X() macro for Laguna
+ support. Add support for CL-GD5480. Disable Alpine XAA color expansion
+ code. Fix 32bpp Alpine mode bug. Overload {slow,med,fast}_dram options
+ to set Rambus BCLK on Laguna chips. Remove Sync()'s in laguna_acl.c.
+ Removed unnecessary, dead, and/or dumb code in cir_driver.c. Add clock
+ values for 150MHz through 229MHz dot clocks. Set clock limits correctly
+ for Laguna chips. (#280, Corey Anderson).
+ 678. Fix problem in xf86gcmisc.c that could cause a segfault (#279,
+ Mark Voikovich).
+ 677. Fix problems with NonTE text in XAA (#278, David Bateman).
+ 676. Fix loader under SVR4.0.4 (lstat,fstat,mknod)(#277, Richard Coley).
+ 675. Speedups for dashed lines in SVGA/S3 (#276, Mark Vojkovich).
+ 674. Allow building Xnest with BuildServersOnly (#275, Marc Aurele La France).
+ 673. Fix vga16 and banked vga2 without also breaking either of the loader or
+ static servers. Remove obsolete directories and other extraneous junk.
+ Remove mi's dependence on mfb. LoaderFixups is no longer needed. Add
+ xf86InitViewport to the symbol table. Combine vga2/mfb & vga2/mfb.banked.
+ (#274 Marc Aurele La France).
+ 672. More layout cleanups in matrox driver (#273, Radek Kapitan).
+ 671. Fix LinkKit to build loader (#272, Takaaki Nomura).
+ 670. Fix some Alpha problems (#270, Robin Cutshaw).
+ 669. Add MemClk field to all drivers (#270,271 Robin Cutshaw, Sebastien
+ Marineau).
+ 668. Fix server crashes in C&T driver caused by delayed syncing (#269, David
+ Bateman).
+ 667. Fix problems with PEX modules (#268, Takaaki Nomura).
+ 666. Fix some problems in XAA benchmarks and Trident Cyber support (#266,267,
+ Alan Hourihane).
+ 665. Add Mystique to scanpci (#264, Guy Desbief).
+ 664. Fix problems with delayed syncing (#263, Mark Vojkovich).
+ 663. Fix LinkKit and cirrus driver (#262, Takaaki Nomura).
+ 662. Fix I18N bug (#261, Nagao Tadaaki).
+ 661. First steps to get loader on SCO (#260, J. Kean Johnston).
+ 660. File structure changes for mga driver (#259, Radek Kapitan).
+ 659. Add stubs to load GLX extension (#228,246, Henry Worth, Dirk Hohndel).
+
+XFree86 3.2As (09 April 1997)
+ 658. Several fixes and enhancements for the cirrus driver. Fix the crash that
+ showed up in 3.2A with MMIO on some chips at 16bpp. Enable the 8x8
+ pattern fill code for different chips. Reorganize the BitBLT feature
+ checks in the accelerated driver, and make it compatible with the new
+ delayed syncing in XAA.Fix the > 85 MHz dot clock mode on the
+ CL-GD5436/46. Detect all DRAM configurations that are possible on the
+ CL-GD5446. Add code to handle the 7555 (no detection).
+ (#258, Harm Hanemaayer).
+ 657. Fix Bresenham line bug in trident/9440 driver (#257, Alan Hourihane).
+ 656. Add trapezoid acceleration to tseng driver (disabled), disable W32 hw
+ cursor, remove redundant warning message about "Wrong Cursor Color Tried"
+ (#256, Koen Gadeyne).
+ 655. Add mga dashed lines (#255, Andrew Vanderstock).
+ 654. Add more flexible way of loading and initializing extensions (#253,
+ Matthieu Herrb).
+ 653. Fix bugs in the S3V server concerning rectfill with scan line width of
+ 2048 and with lines (#251,252, Harald Koenig).
+ 652. Add option "set_memclk" (#249, Sebastien Marineau).
+ 651. Fix hangs in svga/s3v server, fix some bugs, add planemask support to
+ most accelerated primitives and start accelerated lines (#249, Sebastien
+ Marineau).
+ 650. Fix XAA to force ROP to GXcopy for XDrawImageString (#249, Sebastien
+ Marineau).
+ 649. Change "unsigned long" to CARD32 in dashed line support (#248,
+ Mark Vojkovich).
+ 648. Add Matrox Mystique to vgaPCI.h (Guy Desbief).
+ 647. Fix building XF98_EGC (#247, Takaaki Nomura).
+ 646. Fix some problems with delayed syncing in the C&T driver (#245, David
+ Bateman).
+ 645. Add dashed line support for SVGA/S3 (#243, Mark Vojkovich).
+ 644. Add dashed line support for XAA (#242,244, Mark Vojkovich).
+ 643. Fix some fill problems in S3V server (#241, Harald Koenig).
+ 642. Several fixes to C&T driver that rearrange code in XAA FillRect code to
+ work around bug in HW cursor, add ImageWrite function, use the 8x8
+ pattern where possible to simulate a planemask, add preliminary support
+ for vga2 and vga16 and temporary fix for Syncing problems in new XAA code
+ (#239, David Bateman).
+ 641. Further LinkKit changes (#238, Takaaki Nomura).
+ 640. Small fix for LinkKit (#237, David Bateman).
+ 639. Fix twm double-frees (#236, John Hawkinson).
+ 638. Include missing patch for change 601.
+ 637. Update Compaq vgaVideoChipRec (1bpp,4bpp,15bpp,32bpp) (#234, Gerry Toll).
+ 636. Fix Linkkit (#233, Takaaki Nomura).
+ 635. Fix broken console restore for 4bpp driver (#232, Marc Aurele La France).
+ 634. Add S3 chipset override code to SVGA/S3 server (#231, Harald Koenig).
+ 633. Start converting XF86Setup to use the loader (#230, Joe Moss).
+ 632. Correct DCLK limits for S3V server (#229, Harald Koenig).
+ 631. Add STG1702 to SuperProbe (#227, Stuart Lamble).
+ 630. Small fix for syncing in XAA color expansion (#225, Mark Vojkovich).
+ 629. Resync PC98 server (#224, Takaaki Nomura).
+ 628. Add stg1702 auto probing to the tseng driver (#223,#226, Stuart Lamble).
+ 627. Fix 4bpp for PC98 (#222, Takaaki Nomura).
+
+XFree86 3.2Ar (28 March 1997)
+ 626. Remove the old driver subdirectories.
+ 625. Fix setting of CRTC[22] on VGA compatibles (#220, Marc Aurele La France).
+ 624. Fix vga16 & banked vga2; don't remap *fb's endtab. Use the correct
+ banking functions, displayWidth handling (#219, Marc Aurele La France).
+ 623. Change Mach64 to use the known extended post-divider setting on the
+ 3D Rage II (#218, Marc Aurele La France).
+ 622. Lots of changes to the SVGA/ATI driver, including 3D Rage II support,
+ memory type detection (#217, Marc Aurele La France).
+ 621. Clean up internal allocator a bit, and make it log more information
+ (when enabled) (#216, Marc Aurele La France).
+ 620. Fix misuse of UseInstalled in the .cf files for BSD derivatives.
+ Make LinkKit use the same default CCOPTIONS as the main build.
+ Remove redundancy in svr4.cf (#215, Marc Aurele La France).
+ 619. Add newer ATI chipsets to SuperProbe (#214, Marc Aurele La France).
+ 618. Fix color expansion and pixmap cache in trident driver (#212,213,
+ Alan Hourihane).
+ 617. Change XAA to delay syncing (#211, Mark Vojkovich).
+ 616. Fix OS/2 naming problem in Xserver Imakefile and XAA 8x8 pattern
+ rotations and flag checking inconsistency (#210, Sebastien Marineau).
+ 615. Add SVGA/S3V driver (#210, Sebastien Marineau).
+ 614. Add Sigma Designs REALMagic to SuperProbe (#209, Harald Koenig).
+ 613. Merge Trio64V2/Aurora64V+/PLATO changes into S3/SVGA driver (#208,
+ Harald Koenig).
+ 612. Fix building XF98_EGC (#207, Takaaki Nomura).
+ 611. Add ImageWrite to s3/svga and prepare driver for upcoming XAA changes;
+ the s3/svga server no longer does cursor blocking, users of Xqueue
+ might have to use the Option "sw_cursor" (#206, Mark Vojkovich).
+ 610. Fix 8 bit DAC handling in SVGA server (#205, Mark Vojkovich).
+ 609. Add better support for linear memory on W32i cards (#204, Koen Gadeyne).
+ 608. Add HORIZONTAL_TWOPOINTLINE to XAA (#203, Alan Hourihane).
+ 607. Add autoloading of libxf86cache to Mach32 & Mach64 server and compile
+ ServerInit() and ModuleInit() only for the LOADER (#202, Takaaki Nomura).
+ 606. Add support for Cirrus CL-GD5464BD, CL-GD5465 (#201, Corin Anderson).
+ 605. Documentation updates and improved memory bandwidth handling in tseng
+ driver (#200, Koen Gadeyne).
+ 604. ViRGE/DX support for S3V server (#199, Harald Koenig).
+ 603. Some fixes to Trio64V+ & Trio64V2 (#198, Harald Koenig).
+ 602. Recognize 1MB on ViRGE (using an illegal setting) (Alan Hourihane).
+ 601. Fix and enhance handling of unresolved symbols in loader (#196, Harald
+ Koenig).
+ 600. Fixes and Additions for XF86Setup (#194,195, Joe Moss).
+ 599. Fix SuperProbe for W32 chipsets (#191, Koen Gadeyne).
+ 598. Fix building the static S3 server (#188-190, Harald Koenig).
+ 597. Fix undefined symbols in the pex5 module (#187, Matthieu Herrb).
+ 596. Fix autoloading modules in the S3 server for PC98 (#186,197 Takaaki
+ Nomura).
+
+XFree86 3.2Aq (23 March 1997)
+ 595. Fix building static XF86_S3 (#185, Harald Koenig).
+ 594. Enable loader on OpenBSD (#184, Matthieu Herrb).
+ 593. Add missing files for NV1 (change 591).
+
+XFree86 3.2Ap (22 March 1997)
+ 592. Fix screen problems with C&T at 24bpp (#182, Nozomi Ytow).
+ 591. Add NV1 acceleration (#181, David McKay).
+ 590. Add Trio64V2 170/110/60MHz support to S3 server (#180, Harald Koenig).
+ 589. Automagic loading of modules for old S3 server (#178,179 Harald Koenig).
+ 588. Automagic loading of modules for PC98 servers (#177, Takaaki Nomura).
+ 587. Fixes to blitter and hw cursor handling in C&T driver (#176, David
+ Bateman, Egbert Eich).
+ 586. Add Elsa handling to S3/SVGA and Trio64V2/DX/GX, ViRGE/DX/GX and PLATO/PX
+ to SuperProbe, scanpci, S3, S3V and S3/SVGA servers (#174,175,
+ Harald Koenig).
+ 585. Build fix for Xprt, Xnest and Xvfb (#172, Takaaki Nomura).
+
+XFree86 3.2Ao (18 March 1997)
+ 584. Fix/add IBM RGB528 support and add ELSA eeprom detection (only
+ for IBM ramdacs right now) (#170, Harald Koenig).
+ 583. Fix linking problem of XF86_LOADER for Linux/a.out (#170,171, Harald
+ Koenig, Xavier Ducoin)
+ 582. Fix several problems with loader and static server that were caused
+ by change 567 (Dirk Hohndel).
+ 581. Fix bad 400x300 mode line (#165, Koen Gadeyne).
+ 580. Finer W32 chipset detection (#165, Koen Gadeyne).
+ 579. Tseng documentation updates (#165, Koen Gadeyne).
+ 578. Fix unresolved strlen in PEX and XIE (#164, Takaaki Nomura).
+ 577. Fix changes of NEC480 to PEGC (#163, Michio "Karl" Jinbo).
+ 576. Fix building of XF98_LOADER (#163,169, Michio "Karl" Jinbo,
+ Takaaki Nomura).
+ 575. Fix building of normal X servers for PC98 (#163, Takaaki Nomura).
+ 574. Fix building P9000 module (#160, Takaaki Nomura).
+ 573. Add S3/SVGA color expansion (#161, Mark Vojkovich).
+ 572. Fix problems with "dac_8_bit" in svga server (#159, Mark Vojkovich).
+ 571. Fix ET6000 hardware cursor (#158, Harald Nordgard Hansen).
+ 570. Changes to NetBSD + BSD Elf library configuration (#157, Chris G.
+ Demetriou).
+ 569. Fix for the SVGA/S3 hardware cursor (Xavier Ducoin).
+
+XFree86 3.2An (15 March 1997)
+ 568. Build fixes in order to get a clean compile on Linux and FreeBSD
+ (not for PC98, though). The servers still don't work quite as
+ they should.
+
+XFree86 3.2Am (12 March 1997)
+ 567. First attempt to get a universal SVGA server that statically links
+ in all drivers except those from the accel directory. Links ok and
+ seems to work at >=8bpp, but has bit ordering problems for 1,4bpp.
+ (David Dawes, Dirk Hohndel).
+ 566. Fixes for Trident Cyber chipsets (#154,155, Alan Hourihane).
+ 565. Fixes for OS/2 (more IHaveModules and drive letters in ModulePath),
+ get Mach64 to work again (#153, Holger Veit).
+ 564. Cleanups and improvements to tseng hw cursor code (#152, Koen Gadeyne,
+ Harald Nordgard Hansen).
+ 563. Add pci_retry option to tseng driver (#151, Dejan Ilic).
+ 562. Change NEC480 to PEGC, resync of SuperProbe/Imakefile (#150, Takaaki
+ Nomura).
+ 561. Add hardware cursor to MGA driver (#149, Xavier Ducoin).
+ 560. Make tseng driver handle 1/4/8bpp at runtime (#145, Koen Gadeyne).
+ 559. Make apm driver loadable (#146, Joe Moss).
+ 558. Fix some cross compilation problem for XAA on OS/2 (#144, Sebastien
+ Marineau).
+ 557. Fix some 24bpp problems for ViRGE and cfb (#144, Sebastien Marineau).
+ 556. Move cursor area to top of vidmem for ViRGE (#144, Sebastien Marineau).
+ 555. Really fix mono/Imakefile and fix PEX struct dirent problem (#143,
+ Matthieu Herrb).
+ 554. Add handling for S3-style 8x8 pattern fill to XAA; fix s3/svga
+ accordingly (#141, Mark Vojkovich).
+ 553. Fix OS/2 problems; disable cross compiling Xprt, Xvfb, Xnest (#140,
+ Holger Veit).
+ 552. Include some fix trackers, fixing problems with sunLib.tmpl, hp.cf,
+ memory leak in xdm: xdmcp.c manage(), Imake.rules, zlib 1.0.4, AltGR
+ not working in Xlib (#131,132,135-139).
+ 551. Reapply change 536 for the new drivers (#130, Mark Vojkovich).
+ 550. Enable loader for NetBSD and fix a few typos (#127-129, Takaaki Nomura).
+
+XFree86 3.2Al ( 7 March 1997)
+ 549. Fix a.out loader for FreeBSD (#126, Takaaki Nomura).
+ 548. Add the BT-848 to scanpci (#121, Dejan Ilic).
+ 547. Change the way dynamic loading of vga2. vga16, vga256 modules is done
+ (just one module per driver for all color depths, all the drivers are
+ moved to xfree86/drivers) (#122-124, Alan Hourihane, Dirk Hohndel).
+ 546. Add support for 3DLabs GLINT chipsets to scanpci and SuperProbe, start
+ working on a 2D server for Elsa Gloria L (Dirk Hohndel, Stefan Dirsch).
+
+XFree86 3.2Ak ( 4 March 1997)
+ 545. Make Mono drivers loadable and clean up some of XF86_LOADER; this
+ change replaces some of the things done in change 537 (#119, H.J. Lu).
+ 544. Fix char alignment in COFF loader as well (#120, Thomas Mueller).
+ 543. Fix short alignment in COFF loader and add missing entry to SYMENT
+ (#118, Michael Rohleder).
+ 542. Build fix for libc_wrapper.c on ISC (#117, Michael Rohleder).
+ 541. Add Module Version to Mach32 server (#117, Michael Rohleder).
+ 540. Add smarter handling of unresolved symbols in the loader (#116,
+ Sebastien Marineau).
+ 539. Fix problem in OS/2 loader (#115, Sebastien Marineau).
+ 538. Add module versioning and auto loading to S3V server (#114, Sebastien
+ Marineau).
+ 537. Change name of Screen Section to "XFree86".
+ 536. Set correct clipping rectangle for SVGA/S3 (#112, Mark Vojkovich).
+ 535. Fix a problem in trapezoid solid fill code (not sure if this fixes
+ the problems that caused change 533 to be disabled) (#110,
+ Mark Vojkovich).
+ 534. Add 'Doublescan' support to MGA driver (#109, Radoslaw Kapitan).
+ 533. Add trapezoid solid fill acceleration to MGA driver; disabled as it
+ doesn't draw correctly at this point (#109, Radoslaw Kapitan).
+ 532. Remove MgaAccelSwitch (#108, Radoslaw Kapitan).
+ 531. Improve SolidFill speed on C&T65545/6/8 (#107, Nozomi Ytow).
+ 530. Fix libc_wrapper.c build problem on SVR4 (#106, Takaaki Nomura).
+ 529. Fix VGA16 driver (#105, Thomas Mueller).
+ 528. Fix Compaq AVGA driver (#104, Ming Yu, Joseph Pfeiffer, Gerry Toll).
+ 527. Add more comments to MGA driver (#103, Radoslaw Kapitan).
+
+XFree86 3.2Aj (28 February 1997)
+ 526. Various build fixes for FreeBSD, NetBSD, Linux, Solaris (Dirk Hohndel).
+ 525. Fixes for OS/2 loader and ar code (#100, Sebastien Marineau).
+ 524. Updates to S3/SVGA driver (#99, Mark Vojkovich).
+ 523. Add SubsequentFillTrapezoidSolid to XAA (#99, Mark Vojkovich).
+ 522. First stab at getting VGA16 as loadable module; doesn't work, yet
+ (Dirk Hohndel).
+ 521. Add Mystique register definitions (#98, Guy Desbief).
+ 520. Fix unresolved symbols with loadable ati driver (#96, Thomas Mueller).
+ 519. Add module versioning (#97, Holger Veit).
+ 518. LynxOS doesn't have vfscanf (#95, Thomas Mueller).
+ 517. Fix 499 was missing. It is now included.
+ 516. Remove bogus code in xf86frect.c (#93, Harm Hanemaayer, Harald Nordgard
+ Hansen).
+ 515. Build fixes for FreeBSD (#92, Takaaki Nomura).
+ 514. Restructure RAMDAC handling in tseng driver and add 16/24bpp support
+ for STG1703 (#91, Koen Gadeyne).
+ 513. Tseng HW cursor state save/restore (#91, Dejan Ilic).
+ 512. Disable HW cursor on et4000 (#91, Koen Gadeyne).
+ 511. Fix et6000 memory probing (#91, Koen Gadeyne).
+ 510. Fix handling of PCI probe in the tseng driver (#91, Koen Gadeyne).
+ 509. Fix "double-magic" in libc_wrapper.c (#90, Holger Veit).
+ 508. Fix for ET6000 HW cursor (#89, Harald Nordgard Hansen).
+ 507. Fixes to MGA driver: remove "nolinear", allow overriding MMIO address
+ as IoBase in XF86Config, remove obsolete files (#88, Radoslaw Kapitan).
+
+XFree86 3.2Ai (25 February 1997)
+ 506. Fix libc_wrapper.c for LynxOS, where stdin/out/err isn't a valid
+ initializer (#87, Thomas Mueller).
+ 505. Updates to SiS driver: fix setting MemBase, allow some XAA functions
+ in 8bpp even without linear mode, support DPMS (#86, Xavier Ducoin).
+ 504. Disable the stream display fetch length control for Trio64V2
+ (#85, Xavier Ducoin).
+ 503. Update SuperProbe for sis86c202 and sis86c205 (#84, Xavier Ducoin).
+ 502. Allow ModulePath to have multiple elements; use heuristic to find the
+ module if only part of the exact filename is specified; allow subdirs
+ of the module directory to be searched (Dirk Hohndel).
+ 501. Change loader code so that ModuleInit is a magic function name that
+ indicates the init function for a module. ServerInit now is the function
+ used to get the initial ScrnInfoRec; change all modules to follow these
+ naming conventions (Dirk Hohndel).
+ 500. Fix missing fsetpos/fgetpos in ISC (#78, Michael Rohleder).
+ 499. Fix elfloader to recognize .data1 and .rodata1 sections
+ (#82, Steve Forsythe).
+ 498. Add readdir family of functions to libc_wrapper (#81, Holger Veit).
+ 497. Add crosscompilation support for OS/2 (#81, Holger Veit).
+ 496. Add loadable module support for P9000 (#80, Erik Nygren).
+ 495. Fix error message in loader (#79, Matthieu Herrb).
+ 494. Workaround for a bug in 68k GNU binutils (#77, Geert Uytterhoeven).
+ 493. Add new xf86_libc.h to make porting to the new style loader
+ architecture easier. Adapt PEX5 using the new header file (Dirk Hohndel).
+ 492. Fixes for a.out loader (#74-76, Matthieu Herrb).
+ 491. More fixes for libc_wrapper.c (#73, Michael Rohleder).
+
+XFree86 3.2Ah (23 February 1997)
+ 490. Some a.out loader updates for Linux/a.out (#72, Harald Koenig).
+ 489. Add support for cross compilation of modules in the Imake rules
+ (#71, Holger Veit).
+ 488. Add a subset of xf86stdio functions to libc_wrapper.c (#71, Holger Veit).
+ 487. Make the I128 driver loadable (#65,66,70, Robin Cutshaw).
+ 486. Fix et4000 driver compile problems for vga2 and vga16
+ (#69, Koen Gadeyne).
+ 485. Fix 8x8 patterns for TGUI chips (#68, Alan Hourihane).
+ 484. Fix direct reference to memset() (#67, Harald Nordgard Hansen).
+ 483. Gnu parallel make update for loadable server (#64, H.J. Lu).
+ 482. Include the summasketch support explicitly in xf86Xinput.c when
+ not using dynamic modules (#63, Christer Nilsson).
+ 481. Loader support for OS/2-style a.out (#62, Sebastien Marineau).
+ 480. Fix nested asm calls in tseng_cursor.c (#61, Takaaki Nomura).
+ 479. Add a timeout to the C&T blitter wait loop, and reset the blitter
+ when this happens (#60, David Bateman).
+ 478. Add missing imake patch for massaging the results of parse_utsname()
+ (#57, Chris Demetriou).
+ 477. Don't define DoLoadableServer yet for non-Intel Linux platforms.
+ 476. Don't refer to the PEX init function in loadmod.c when PEXEXT isn't
+ defined (as is the case on Alpha platforms) (#56, Alan Hourihane).
+ 475. Fix references to usleep on SVR4 (#61, Takaaki Nomura).
+ 474. Fix references to snprintf on SVR4 (David Dawes).
+ 473. Fix some compile problems on FreeBSD (David Dawes).
+
+XFree86 3.2Ag (19 February 1997)
+ 472. Fix Imakefiles and loader problems on OS/2 (#53, Sebastien Marineau).
+ 471. Fix problems with ISC and the Mach32 module (#55, Michael Rohleder).
+ 470. Fix Xnest and Xvfb when DoLoadableServer is YES (Dirk Hohndel).
+ 469. Clear up multiplex support on 96xx and display error message when
+ requested resolution exceeds available memory with the accelerator
+ engine (#52, Alan Hourihane).
+ 468. Let Trio64V2 use newmmio driver (#49, Tom Angert).
+ 467. First cut for ET6000 hardware cursor (#48, Dejan Ilic).
+ 466. Some xf86 wrappers (#47, Craig Groeschel).
+ 465. Convert PEX and XIE to be loadable with the new style loader
+ (Dirk Hohndel).
+ 464. Clean up configuration files to distinguish old and new style
+ loading of extensions (Dirk Hohndel).
+ 463. Add DPMS support (off mode only) to the P9000 server
+ (#9, Karl Anders Oygard).
+ 462. Add PCI probing to the P9000 server (#9, Karl Anders Oygard).
+ 461. Resync PC98 Imakefiles.
+ 460. Enable the loadable server for LynxOS AT (#46, Thomas Mueller).
+ 459. Better fix for XF86Setup compile problems (David Dawes).
+
+XFree86 3.2Af (17 February 1997)
+ 458. Fix XF86Setup/Imakefile (#45, Harald Nordgard Hansen).
+ 457. Fix xdm/Imakefile for ISC (Michael Rohleder).
+ 456. Fix problem with S3V and W32 modules (Dirk Hohndel).
+ 455. Move module rules from xf86.rules to Imake.rules, and when building
+ a module, install a link to it in xc/exports/lib/modules/ (David Dawes).
+ 454. Start Elf loader for Linux/Alpha; doesn't work, yet (#44, Alan Hourihane).
+ 453. Hide cursor in S3/SVGA when DGA is active (#43, Mark Vojkovich).
+ 452. a.out loader for module loading (#42, Matthieu Herrb).
+ 451. Extend OS support layer to cover some libc functions and update all
+ drivers to use the internal functions (Dirk Hohndel).
+
+XFree86 3.2Ae (16 February 1997)
+ 450. Add -showunresolved flag to server.
+ 449. Add sourceAddress option to xdm (#41, Christos Zoulas).
+ 448. Fix cfb8line (#40, Jeff Anton).
+ 447. Turn pixmap cache in SVGA/S3 server back on and switch over to XAA for
+ lines and segments (#39, Mark Vojkovich).
+ 446. Fix COFF header file (#38, Stuart Anderson).
+ 445. Better XKB russian keyboard support (#36, Andrey A. Chernov).
+ 444. Fix an X11R6.3 problem with SCO 5 build (#35, Alan Hourihane).
+ 443. Fixes for Trio64V2 (#35, Tom Angert, Harald Koenig, Xavier Ducoin).
+ 442. avoid nested asm calls which cause compile errors on PANIX(SVR4) (#31,
+ Takaaki Nomura).
+ 441. Resync LinkKit (#26, Takaaki Nomura).
+ 440. Fix some build problems when not using the new loader code
+ (on FreeBSD) (David Dawes).
+ 439. Stop S3 and S3V server from overwriting CR11 (#30, Harald Koenig).
+ 438. Fix banking code in S3/SVGA driver (#29, Thomas Mueller).
+ 437. Fix DPMS code for C&T (#28, David Bateman).
+ 436. Enable left edge clipping for HiQV chips (#28, David Bateman).
+ 435. Stop C&T probe from printing out messages for non C&T chips (#28,
+ David Bateman).
+
+XFree86 3.2Ad (14 February 1997)
+ 434. Merge Metro Link loader code and make all SVGA drivers and S3, S3V
+ server loadable (Metro Link, Dirk Hohndel).
+ 433. Avoid installing CVS admin files when doing 'make install' for rstart
+ (#25).
+ 432. Resync xfree98/SuperProbe/Imakefile.
+ 431. Fix for 'xset r rate' and XF86MiscSetKbdSettings() for some OSs (#24).
+
+XFree86 3.2Ac (12 February 1997)
+ 430. Fix problem with system #define Control on LynxOS (Thomas Mueller).
+ 429. FreeBSD 2.2 doesn't need libz (Takaaki Nomura).
+ 428. Another attempt at left edge clipping for HiQV chips (still disabled
+ by default) (David Bateman).
+ 427. DPMS in C&T is now enabled even when no monitor is detect (David Bateman).
+ 426. Additional fixes for 65530/35 linear addressing (untested) (Egbert Eich).
+ 425. Fix for the 16/24 bpp corruption in RIGHT2LEFT blits in the C&T driver
+ (Egbert Eich).
+ 424. Fix LinkKit and XF98_TGUI server (Takaaki Nomura).
+ 423. Reenable xsetpointer, xsetmode, xsetxkbmap in programs/Imakefile.
+ 422. Encapsulate arguments in C&T header files (Nozomi Ytow).
+ 421. Documentation updates for ET4000, mostly about 16/24/32bpp (Koen Gadeyne).
+ 420. Fix VGA2 and VGA16 that were broken in 394/395 and reenable them
+ (Koen Gadeyne).
+ 419. Improved resolution switching and 24bpp handling in S3V (Kevin Brosius).
+ 418. Matrox detection in SuperProbe (Alan Hourihane).
+ 417. Fix bug in the Type1 font code (H.J. Lu).
+ 416. Autoprobe Viper PCI and DPMI support for P9000 (Karl Anders Oygard).
+ 415. Use fill rect solid for horizontal lines on S3 (Mark Vojkovich).
+ 414. Add 8bit dac support to MGA (Mark Vojkovich).
+ 413. Add make -j support for gnu make (H.J. Lu and Craig Groeschel).
+
+XFree86 3.2Ab (11 February 1997)
+ 412. Some fixes for Linux/m68k (Geert Uytterhoeven).
+ 411. Add XAA S3 driver to the SVGA server (Mark Vojkovich).
+ 410. Add a flag argument to the ValidMode functions (Dirk Hohndel).
+ 409. Implemented (but disabled) left edge clipping for color expansion for
+ HiQV chips (David Bateman).
+ 408. 8x8 mono pattern fills for HiQV chips (David Bateman).
+ 407. DPMS support for C&T driver (David Bateman).
+ 406. Scanpci for Alpha (Robin Cutshaw).
+ 405. Fix clock clock limits for trident driver (Alan Hourihane).
+ 404. 9420/9430 acceleration - not tested, only partial, too (Alan Hourihane).
+ 403. DPMS support for the Trident driver (Alan Hourihane).
+ 402. 24/32bpp support for Trident chipsets (Alan Hourihane).
+ 401. Trident support for the Alpha platform (Alan Hourihane).
+ 400. Add DPMS to et4000 driver of the SVGA server (Harald Nordgard Hansen).
+ 399. Fixes and addition to the acceleration for W32 and ET6000 (Koen Gadeyne).
+ 398. Chrontel RAMDAC support for W32 in SVGA server (Kurt Olsen).
+ 397. Hardware Linedraw support for ET6000 and ET4000W32p (Koen Gadeyne).
+ 396. Add memory bandwidth as a concept to the W32 RAMDAC code (Koen Gadeyne).
+ 395. Move W32/ET6k clock setting functions into tseng_clock.c. This together
+ with change 394 breaks the W32 server and the et4000 driver in the
+ VGA2 and VGA16 server (all those are disabled by default for now)
+ (Koen Gadeyne).
+ 394. Move RAMDAC support from W32 server in SVGA server and added
+ accelerated 16/24/32 bpp support for ET4000/W32p (Koen Gadeyne).
+
+XFree86 3.2Aa (10 February 1997)
+ 393. Much additional acceleration for the HiQV chips (David Bateman).
+ 392. Print the PCI retry setting in MGA server (Radoslaw Kapitan).
+ 391. OpenBSD fixes (Matthieu Herrb).
+ 390. Small fix for doc naming.
+ 389. Fix 24bpp clock limit for ViRGE (Harald Koenig).
+ 388. Fix 16bpp 6554x 8x8 pattern fill problem (David Bateman).
+ 387. Fix core dump in C&T driver (Egbert Eich).
+
+XFree86 3.2A (28 January 1997)
+ 386. Updates to the OS/2 pipe xtrans code (Sebastien Marineau).
+ 385. Update the max clock for the TGUI ProVidia 968x (Alan Hourihane).
+ 384. Disable memory interleaving before restoring the text font info
+ for the MGA driver. This fixes font corruption that shows up
+ in Alpha platforms (Jay Estabrook).
+ 383. Fix some document formatting problems.
+ 382. Enable MMIO by default for TGUI chips when acceleration is enabled.
+ It can be disabled with the "no_mmio" option.
+ 381. Fix problems with the Trident driver in 16-colour mode (Alan Hourihane).
+ 380. Back out change 370 because it is obsoleted by change 373.
+ 379. Fix 369 was missing, and is now included.
+ 378. OS/2 updates (including documentation) (Holger Veit).
+ 377. Add bitblt acceleration for 16 and 32bpp for the I128 server
+ (Robin Cutshaw).
+ 376. Tseng doc update (Koen Gadeyne).
+
+XFree86 3.2y (26 January 1997)
+ 375. I128 accel fix (Robin Cutshaw).
+ 374. Update Japanese version of documentation to 3.2 (Kazuyuki Okamoto).
+ 373. Fix 8x8 pattern acceleration for ET6000 (Koen Gadeyne).
+ 372. Fix an optimisation/volatile problem with the I128 accel code
+ (Robin Cutshaw).
+ 371. Fix the clearing of video memory in the SVGA server when the linear
+ base address has been offset (Jay Estabrook).
+ 370. Disable 8x8 pattern acceleration for ET6000 (Harald Nordgard Hansen).
+ 369. Fix stippled/tiled lines (segments) (Harm Hanemaayer).
+ 368. Update the LinkKit for recent I128 server changes (Takaaki Nomura).
+ 367. Fix display of 8bit characters in xterm (when in VT100 mode)
+ (Thomas E. Dickey).
+ 366. m68k server updates (Geert Uytterhoeven).
+ 365. Matrox doc updates (Andrew Vanderstock).
+ 364. Update Mach64 docs (Kevin Martin).
+ 363. Fix a ELSA Winner 2000PRO/X-8 initialisation problem that shows up
+ after running a certain other X server (Harald Koenig).
+ 362. Fix a PC98 TGUI problem when using XAA colour expansion (Kazunori Ueno).
+
+XFree86 3.2x (23 January 1997)
+ 361. Remove some XAA debugging messages (David Bateman).
+ 360. Preliminary I128 bitblt acceleration using XAA (Robin Cutshaw).
+ 359. NetBSD doc updates (Matthieu Herrb).
+ 358. Fix a problem with specifying the chipset as "et6000" with the W32
+ server (Koen Gadeyne).
+ 357. Fix for XAA bitmap problem which showed up with the C&T driver, and
+ With this fixed, change 339 has been backed out (David Bateman).
+ 356. Update clock limits for the PC98 TGUI server (Akio Morita).
+ 355. PC98 documentation update (Akio Morita).
+ 354. Tseng doc updates (Koen Gadeyne).
+ 353. Add NO_PLANEMASK to the Tseng XAA colorexpansion flags (Koen Gadeyne).
+ 352. LynxOS doc updates (Thomas Mueller).
+ 351. Fix some unaligned access problems with pixmap data that show up on
+ Alpha platforms (Jay Estabrook).
+ 350. Fix a problem with passing the depth/weight specified on the
+ server command line in some situations (Harald Koenig).
+ 349. Add support for the S3 Aurora64V+ programmable clock, which is slightly
+ different from the Trio64 (Harald Koenig).
+ 348. Blank the screen before turning off the sync signals for the WD90C24
+ DPMS support (Brad Bosch).
+ 347. Change 341 was missing, and is now included.
+ 346. Don't accelerate XAA functions which use source bitmap data when
+ the rop is GXclear, GXnoop, and GXset (as well as GXinvert)
+ (Harm Hanemaayer).
+ 345. S3V doc updates (Kevin Brosius).
+ 344. S3 doc updates (Harald Koenig).
+ 343. Remove some experimental code in XF86Setup that was causing it
+ to fail when starting the first server (Joe Moss).
+
+XFree86 3.2w (22 January 1997)
+ 342. Update the xset man page for the DPMS additions.
+ 341. Updates to TGUI acceleration, to hopefully fix some problems that
+ show up with xtest (Alan Hourihane).
+ 340. Add recognition of some other TGUI Cyber chipset codes (Alan Hourihane).
+ 339. Enable 8x8 mono pattern fills for C&T 65545, and limit colour expansion
+ to GXCOPY_ONLY to avoid some crashes when running things like
+ xengine and xdvi (David Bateman).
+ 338. Fix various Chips & Tech display problems for 6554x, 65550 and
+ 64300 chips (Egbert Eich).
+ 337. Fix some XAA-related xtest errors (Harm Hanemaayer).
+ 336. Enable the "no_accel" flag for the ET6000 (Koen Gadeyne).
+ 335. When the "et6000" chipset is specified, use the port-probed value
+ for the membase rather than getting it from the PCI info (Koen Gadeyne).
+ 334. Tseng documentation updates (Koen Gadeyne).
+ 333. Cirrus documentation updates (Harm Hanemaayer).
+ 332. Add README.SiS (Xavier Ducoin).
+ 331. Temporary workaround for Mode_switch problems when using XKB and
+ Latin1 charset (Matthieu Herrb).
+
+XFree86 3.2v (20 January 1997)
+ 330. Added rules to use FreeBSD's sgmlfmt tool to format Linuxdoc/sgml
+ docs -- but this needs more work.
+ 329. Blank the screen before setting a DPMS mode (Leonard N. Zubkoff).
+ 328. Fix sync disabling for DPMS for the S3 (and S3V) server (Robert Wilhelm).
+ 327. Change the .name parameter of the S3V server to "S3V" (Kevin Brosius).
+ 326. Improve S3V 24bpp mode switching (still has some problems)
+ (Kevin Brosius).
+ 325. Disable 32bpp for the S3V server (not supported) (Kevin Brosius).
+ 324. Fix S3V aspect ratio problem at 24bpp (Kevin Brosius).
+ 323. Fix rotation direction of 8x8 mono patterns in XAA (David Bateman).
+ 322. XAA updates (see xaa/NOTES for details) (Harm Hanemaayer).
+ 321. Another fix for 5446 clocks higher than 85 MHz (Harm Hanemaayer).
+ 320. When a clocks line is specified in the XF86Config file for the
+ cirrus driver, ignore it rather that insisting on its removal
+ (Harm Hanemaayer).
+ 319. Remove artificial limit for LCD dot clock for Cirrus 754x chips
+ (Harm Hanemaayer).
+ 318. Fix a problem with default cirrus MMIO operation (Harm Hanemaayer)
+ 317. Improved acceleration support at 24bpp for the Ark driver
+ (Harm Hanemaayer).
+ 316. Ark documentation updates (Harm Hanemaayer).
+ 315. Enable "slow_dram" in the tseng driver for cards below W32i
+ (Koen Gadeyne).
+ 314. Fix a tseng driver typo (missing braces) which was causing linear
+ mode to incorrectly disable acceleration for the ET6000 (Dejan Ilic)
+ 313. Fix a tseng driver bug which was causing a system hang because
+ "fast_dram" wasn't completely disabled (Dejan Ilic).
+ 312. Fix a tseng driver bug which causes a server crash when the chipset
+ "et6000" is specified for the SVGA server (Koen Gadeyne).
+ 311. Some more W32i accel code, but disabled because it doesn't yet
+ work (Koen Gadeyne).
+ 310. Fix for ET6000 24bpp MULBPP optimisation (Harald Nordgard Hansen).
+ 309. Tseng documentation updates (Koen Gadeyne).
+ 308. Cirrus documentation updates (Corin Anderson).
+ 307. Updates for TGUI96xx hw cursor (8bpp, 16bpp), and PC98 TGUI card
+ list (Akio Morita).
+ 306. Fix build TGA compile problem and xdm build problem on Linux/Alpha
+ (Robin Cutshaw).
+
+XFree86 3.2u (19 January 1997)
+ 305. Only show the "extension not loaded" messages for the first
+ server generation.
+ 304. Don't allow DPMS to be switched if the Xserver's VT isn't active
+ (Leonard N. Zubkoff).
+ 303. Implement DPMS "off" support for the WD90C24, for LCD, CRT or both
+ (Brad Bosch).
+ 302. Add a missing DPMSExtension #ifdef in os/WaitFor.c (Corin Anderson).
+ 301. Fix an XAA bug with mono patterns, SCREEN_ORIGIN, and PROGRAMMED_ORIGIN
+ (Corin Anderson).
+ 300. Implement monochrome pattern fill for Cirrus Laguna chips
+ (Corin Anderson).
+ 299. Disable "fast_dram" for the ET6000 because it can cause serious
+ problems (Koen Gadeyne).
+ 298. Disable "power saving" in the Tseng driver because the current
+ way of doing it causes memory corruption (Koen Gadeyne).
+ 297. Disable linear mode and acceleration for Tseng chips that have
+ not been tested or which are not supported (Koen Gadeyne).
+ 296. Add some code to treat the ET6000 slightly differently when the
+ chipset is specified in the XF86Config file, to help the case
+ when another (disabled) PCI video card is detected (Koen Gadeyne).
+ 295. Use triple-buffering for colour expansion in the tseng driver
+ (Koen Gadeyne).
+ 294. Make some variables in the tseng driver static (Koen Gadeyne).
+ 293. Remove some asm stuff in the tseng driver, and add a C optimised
+ MULBPP calculation (Koen Gadeyne).
+ 292. Disable XAA framebuffer concurrency in the tseng driver, which
+ hides most of the text corruption problems (Koen Gadeyne).
+ 291. Man page (DPMS) and documentation (MGA) updates (Leonard N. Zubkoff).
+ 290. Fix invalid modelines in XF98Conf.cpp (Takaaki Nomura).
+ 289. Add checking of mode size against video memory requirements to the
+ Mach32 and Mach64 servers.
+ 288. Fix GXnor and GXnand ROP definitions for the TGUI driver.
+ 287. Update for Linux a.out libX11's jump_ignore (Harald Koenig).
+ 286. Fix (?) TGA server link problem.
+
+XFree86 3.2t (18 January 1997)
+ 285. Update W32 docs (Dirk Hohndel).
+ 284. Recognise "noaccel" and "slow_dram" options in the ET4000 driver
+ (Dirk Hohndel).
+ 283. Fix problem with not truncating pixel values in the MGA driver
+ (Dirk Hohndel).
+
+XFree86 3.2s (18 January 1997)
+ 282. Fix a problem with xdm's sessreg and utmp on Linux (Leonard N. Zubkoff).
+ 281. Fix a plane-enable bug for Cirrus 754x (Corin Anderson).
+ 280. Don't use teblt code for depths other than 8 for Cirrus 754x
+ chips (Corin Anderson).
+ 279. Implement programmable pattern offset using XAA, add support for
+ plane masks and fix sum bugs for Cirrus Laguna chips (Corin Anderson).
+ 278. Don't check the PCI command FIFO for Cirrus Laguna chips
+ (Corin Anderson).
+ 277. Add XAA support to the SiS driver. The old code can be reverted
+ to at runtime with the "noaccel" option (Xavier Ducoin).
+ 276. Add recognition of XAA options as valid options for the SVGA
+ server (Alan Hourihane).
+ 275. Add "please report" messages when S3 Trio64V2, Trio64UV+ or
+ Aurora64V+ chips are detected (Harald Koenig).
+ 274. Add undocumented options to XF86Config to allow a numerical ChipID
+ and ChipRev to be specified (used by the S3 and S3V servers)
+ (Harald Koenig).
+ 273. Attempt to fix false detection of RGB524 ramdac as RGB528
+ (Harald Koenig).
+ 272. Make sure x coordinate doesn't overflow into the y coordinate
+ for some MGA operations (Xavier Ducoin and Radoslaw Kapitan).
+ 271. Don't write high order CRTC vertical bits for Trident chips earlier
+ than TGUI9440AGi (Alan Hourihane).
+ 270. Fix an error in koi8-r charset switching code (Andrey Chernov).
+ 269. Disable acceleration for TGUI Cyber chips (Alan Hourihane).
+ 268. Fix register access in Cirrus 754x LCD size detection (Harm Hanemaayer).
+ 267. Add support for the "no_stretch" option for Cirrus 754x chips
+ (Harm Hanemaayer).
+ 266. Enable MMIO by default for Cirrus 543x/4x chips, and add a "no_mmio"
+ option to allow it to be disabled (Harm Hanemaayer).
+ 265. Disable PCI burst mode on the TGUI by default, but allow it to be
+ turned on with options (Alan Hourihane).
+ 264. Update max clocks for the TGUI 96xx chips (Alan Hourihane).
+ 263. Fix centre/stretch TGUI LCD problems (Alan Hourihane).
+ 262. Add Option "tgui_mclk_66" to force MCLK to 66 MHz (Alan Hourihane).
+ 261. Fix TGUI Cyber detection problems (Alan Hourihane).
+ 260. Flush MGA "direct access read cache" in MgaSync(), which fixes
+ problems reading directly from the framebuffer after accelerated
+ operations (Radoslaw Kapitan).
+ 259. XAA updates (see xaa/NOTES for details) (Harm Hanemaayer).
+ 258. Updates for LynxOS 2.5.0 (Thomas Mueller).
+ 257. Fix xterm text highlighting when the window it partly off-screen
+ (Thomas E. Dickey).
+ 256. Remove the GetSaver/SetSaver functionality from the client
+ side of the XFree86-Misc extension, but leave dummy support in
+ the server side for now to avoid breaking old clients
+ (Leonard N. Zubkoff).
+ 255. Implement hw-specific DPMS support for servers/drivers which already
+ had an old implementation, adding support for Standby mode where
+ possible, and adding a StandbyTime keyword for the XF86Config
+ file (Leonard N. Zubkoff).
+ 254. Fix some problems with the original DPMS extension behaviour
+ (Leonard N. Zubkoff).
+ 253. Possible speedup for S3V polypoint code (Harald Koenig).
+ 252. Disable C&T 65550 acceleration features that weren't present
+ in 3.2 (David Bateman).
+ 251. Fix a C&T 24bpp pattern fill problem (David Bateman).
+ 250. Make the XAA C&T code independent of the old acceleration code
+ (David Bateman).
+ 249. Recognise the Alliance AT24, but treat the same way as a 6442
+ (Joe Moss).
+ 248. Add detection for newer TGUI chipsets to SuperProbe (Alan Hourihane).
+
+XFree86 3.2r (14 January 1997)
+ 247. Use some extra XAA flags in the MGA acceleration (Radoslaw Kapitan).
+ 246. XAA updates (see xaa/NOTES for details) (Harm Hanemaayer).
+ 245. Fix DAC register for > 85 MHz mode on Cirrus 5446 (Harm Hanemaayer).
+ 244. Memory config fix for 2MB Cirrus 7543/8 and fix 754x LCD size detection
+ (Harm Hanemaayer).
+ 243. Fix a problem in Imake.rules that causes problems when using bash
+ (Leonard N. Zubkoff).
+ 242. Fix some server prototyping problems (Thomas E. Dickey).
+ 241. Detect the Trio64UV+, Trio64V2 and Aurora64V+, and handle them
+ as a Trio64V+ (Harald Koenig).
+ 240. Add preliminary support for the ELSA Winner 2000PRO/X-8 (S3 968,
+ IBM RGB528A, 8MB VRAM 250 MHz) (Harald Koenig).
+ 239. Fix retrace waits in the MGA driver (Radoslaw Kapitan).
+ 238. Enable CPUToScreen colour expansion for the TGUI driver (Alan Hourihane).
+ 237. Add an options "lcd_center" to the TGUI driver for Cyber chips
+ (Alan Hourihane).
+ 236. Some S3V updates, including combining s3dline.c and s3dseg.c,
+ moving planemask/colour conversion into a separate module,
+ add FillSolid, improve speed of s3plypt.c, and enable some
+ previously disable functions (Berry Dijk).
+ 235. Updates for ISC support (Michael Rohleder).
+ 234. Disable ExportLists for Solaris versions older than 2.5.
+ 233. Fix for C&T 8x8 pattern fills (David Bateman).
+ 232. LinkKit fix (SiS driver) (Takaaki Nomura).
+ 231. Fix for XAA colour expansion when using FIXED_BASE (Koen Gadeyne).
+ 230. ET6000 accel updates and optimisations (Koen Gadeyne).
+ 229. Add code to the MGA driver to set MCLK based on the values
+ stored in the BIOS and the memory size (Andrew E. Mileski).
+
+XFree86 3.2q (12 January 1997)
+ 228. Make makedepend recognise #warning on all OSs (since we have it
+ in shm.h).
+ 227. Add Digital's DPMS server extension (no device-specific support yet).
+ 226. Fix some compile problems on Solaris x86 2.4 with gcc (James Hawtin).
+ 225. Add prelim support for LCD stretching with the TGUI Cyber chips
+ (Alan Hourihane).
+ 224. Add support for some blitter functions to the SiS driver (not XAA
+ yet) (Xavier Ducoin).
+ 223. Fix HW cursor problems in the SiS driver (Xavier Ducoin).
+ 222. Add 15/16/24bpp support to the SiS driver (Xavier Ducoin).
+ 221. Fix problems with linear mode in the SiS driver (Xavier Ducoin).
+ 220. Programmable clock support for the SiS 205 (Xavier Ducoin).
+ 219. TGUI acceleration updates (Alan Hourihane).
+ 218. Add XAA support for the Chips & Technologies driver (David Bateman).
+ 217. Support for 555 weighting in the MGA driver (Xavier Ducoin).
+ 216. TGUI clock fix (Alan Hourihane and Massimiliano Ghilardi).
+ 215. VGA server compiler warning fixes (Thomas E. Dickey).
+ 214. LinkKit fixes (Takaaki Nomura).
+ 213. XAA updates (see xaa/NOTES for details) (Harm Hanemaayer).
+ 212. The item 203 fix was missing. It is included now.
+ 211. Modify Cirrus 754x LCD size detection (Harm Hanemaayer).
+ 210 Add support for pattern offset for the Cirrus 5446 (Harm Hanemaayer).
+ 209. Fix non-MMIO operation for the Cirrus 5446 (Harm Hanemaayer).
+ 208. Fix font cache problem introduced in 3.2p (Takaaki Nomura).
+
+XFree86 3.2p (8 January 1997)
+ 207. XAA support for the Cirrus Laguna chips (Corin Anderson).
+ 206. Modify the PF1-PF4 coding in the xterm termcap/terminfo, and add an
+ interim xterm-vt220 description to accommodate the old and new styles
+ (Thomas E. Dickey).
+ 205. Combine the coding for foreground and background colours in xterm
+ into a single byte (Thomas E. Dickey).
+ 204. Some optimisations and transparent 8x8 pattern tiling for the ET6000
+ driver (Koen Gadeyne)
+ 203. Parallel make fix for lbxproxy (Robin Cutshaw).
+ 202. LinkKit fixes (David Bateman).
+ 201. Defining XF86ExpireServer to YES in host.def allows easy enabling
+ of server expiry.
+ 200. The item 176 fix was missing. It is included now.
+ 199. Fix an Xlib problem with non-8859-1 locales (Kaleb Keithley).
+ 198. Set default hsync and vsync polarity for the MGA driver in the same
+ way as other servers (Leonard N. Zubkoff).
+ 197. Fix sync polarity in MGA driver (Radoslaw Kapitan).
+ 196. Add DGA support to the MGA driver (Mark Vojkovich).
+ 195. Some xterm cleanups (Thomas E. Dickey).
+ 194. Implement DECSTR (soft terminal reset) for xterm (Thomas E. Dickey).
+ 193. Fix some unaligned accesses in cfb16SegmentSS1RectCopy() on Alpha
+ (Harald Koenig).
+ 192. 8x8 colour expand patterns for MGA (Radoslaw Kapitan).
+ 191. Fix various compiler warnings in the S3 server (Thomas E. Dickey).
+ 190. Fix TRANS_ENABLE definition for the TGUI driver (Alan Hourihane).
+ 189. Fix a problem with the location of ident lines in the tclIndex file
+ (Joe Moss).
+
+XFree86 3.2o (5 January 1997)
+ 188. Add MIPS/Arc support to build the S3 server on OpenBSD (Per Fogelstrom).
+ 187. Split OpenBSD config support out into a new OpenBSD.cf file
+ (Matthieu Herrb).
+ 186. Split the retrace wait out into a separate function in the S3
+ server (Mark Vojkovich).
+ 185. Fix a problem with FIFO setting for Mach64 chips with an
+ integrated DAC (Kevin Martin).
+ 184. Fix a pixmap corruption problem that shows up on Mach64 [CVG]T chips
+ (Kevin Martin).
+ 183. Disallow block write mode for [CVG]T Mach64 chips (Kevin Martin).
+ 182. Fix a problem for Mach64 CT-D cards where the server writes to the
+ wrong I/O address, possibly that of another PCI device (Kevin Martin).
+ 181. Fix Rage II support in the Mach64 server (Kevin Martin).
+ 180. Add preliminary XAA support for the TGA server (Alan Hourihane).
+ 179. Don't compile Xprint/Xrm.c because it is already included in
+ attributes.c (Holger Veit).
+ 178. Various updates for OS/2 (Holger Veit).
+ 177. Fix some typing problems in xf86expblt.c (Alan Hourihane).
+ 176. Fix XAA crash for drivers that don't fill in the ServerInfoRec
+ (Harm Hanemaayer).
+ 175. Add DPMS support for the MGA driver (Leonard N. Zubkoff).
+ 174. Add sync-on-green support to the MGA driver (Leonard N. Zubkoff).
+ 173. Add support for display modes that require more than 4MB on
+ Millennium cards (Leonard N. Zubkoff).
+ 172. Enable acceleration support for the Trident 9320LCD chips
+ (Alan Hourihane).
+ 171. Add parallel make support for the lbxutil Imakefile (Robin Cutshaw).
+ 170. Fix a problem with the Xmark script (Andrew E. Mileski).
+
+XFree86 3.2n (3 January 1997)
+ 169. Fix some xaa build problems on some platforms.
+ 168. Updates to NetBSD.cf, including auto-detection of ELF (Chris Demetriou).
+ 167. Add I128 series II detection to scanpci and SuperProbe (Robin Cutshaw).
+ 166. Fix a problem in sun.cf (Robin Cutshaw).
+
+XFree86 3.2m (2 January 1997)
+ 165. Fix some problems creating Xserver links in XF86Setup (Dirk Hohndel).
+ 164. Update to R6.3 public patch 1.
+ 165. XAA updates (Harm Hanemaayer).
+ 163. Fix problems with out-of-date cirrus_acl.c (Harm Hanemaayer).
+ 162. Move all default settings from xf86site.def to xfree86.cf, and leave
+ xf86site.def containing only commented out definitions.
+ 161. Fix 'make install' problems in xkbcomp.
+ 160. Fix some ZLIB problems.
+
+XFree86 3.2l (31 December 1996)
+ 159. Tseng acceleration updates (Koen Gadeyne).
+ 158. Add config support for using the system's standard version of libz
+ when it exists (Chris Demetriou).
+ 157. Add rules for ELF shared libraries on BSD (Chris Demetriou).
+ 156. Recognise __alpha__ as AlphaArchitecture for NetBSD, and treat
+ __alpha__ the same way as __alpha is various part of the code
+ (Chris Demetriou).
+ 155. Update NetBSD config file (Chris Demetriou).
+ 154. Add code to dynamically recognise NetBSD versions in imake, and
+ add defines to allow massaging of the information returned by
+ uname Chris Demetriou).
+ 153. Fix inconsistent usage of malloc/xalloc/Xalloc in the Xprt server.
+ 152. Fix segfault at startup of clients linked with libICE on SVR4.0
+ 151. Add detection for the 250MHz ramdac used on the PowerDoc Edition
+ variant of the Matrox Millennium (Dirk Hohndel).
+ 150. Fix some compile/cpp warnings (Marc Aurele La France).
+ 149. Add support to makedepend for the '^' and '? :' operators
+ (Marc Aurele La France).
+ 148. Change GZIP to GZIPCMD in Makefiles because of a conflict with
+ an environment variable used by gzip (Marc Aurele La France).
+ 147. Fix make depend problem for xdm-shadow (Marc Aurele La France).
+ 146. Update Linux a.out support for R6.3 (Harald Koenig).
+ 145. Trident doc updates (Alan Hourihane).
+ 144. TGUI solidfill updates (Alan Hourihane).
+ 143. XC fixes.
+
+XFree86 3.2k (28 December 1996)
+ 142. Fix a problem introduced in 3.2i which causes the S3 server to crashed
+ for cards with a Ti3026.
+ 141. Updates for GNU libc on Linux, and fix some compile warnings
+ (H.J. Lu).
+ 140. Updated Russian XKB layout (Andrey Chernov).
+ 139. Workaround for KOI8-R problem in XmbLookupString(). The change
+ is to XLC_XLOCALE/koi8-r (Andrey Chernov).
+ 138. Fix some problems with the server build on Alphas (Jay Estabrook).
+ 137. Avoid a server hang in the et4000 driver (Koen Gadeyne).
+ 136. Add some more acceleration for ET4000 chips (Koen Gadeyne).
+ 135. Fix server crash when chipset "et6000" is specified (Koen Gadeyne).
+ 134. Cleanup of vgaHW.c (Marc Aurele La France).
+ 133. In the vga2 server, use the bank size, not the aperture size, to
+ decide between banked and non-banked support (Marc Aurele La France).
+ 132. Fix to FIFO depth calculation in the Mach64 server
+ (Marc Aurele La France).
+ 131. Fix some problems with the width of the pixmap used by the VGA servers
+ when the server's VT isn't active (Marc Aurele La France).
+ 130. Major ati SVGA driver updates (Marc Aurele La France).
+ 129. Fix Xserver/Imakefile problem that sometimes causes problems with
+ cfb24 not being built (Marc Aurele La France).
+ 128. Fix some compiler warnings (including a problem with the ScreenInfoRec
+ initialisation in the I128 server) (Marc Aurele La France).
+ 127. Updated PC98 TGUI support (Akio Morita).
+ 126. Add MMIO support to the TGUI driver, and remove MCLK limits
+ (Alan Hourihane).
+ 125. Add pa, Sf, Sb capabilities to the xterm termcap.
+ 124. Add Tcl interfaces for the new vidmode functions (Joe Moss).
+ 123. Complete the implementation of XF86VidModeAddModeLine() (Joe Moss).
+ 122. Some more s3init.c cleanups (Mark Vojkovich).
+ 121. XC fixes.
+ 120. More R6.3-related updates.
+
+XFree86 3.2j (26 December 1996)
+ 119. Integrate X11R6.3 (pre-release) source base.
+
+XFree86 3.2i (20 December 1996)
+ 118. Some general cleanups (Stuart Anderson, Dirk Hohndel).
+
+XFree86 3.2h (20 December 1996)
+ 117. Fix a "void * used in arithmetic" warning in lnx_video.c.
+ 116. Allow the XInput "AlwaysCore" feature to be controlled dynamically
+ via an "integer feedback" (Frederic Lepied).
+ 115. Fix TGUI clock programming problems (Alan Hourihane).
+ 114. Fix clock scaling with ClockChip "cirrus" (Harm Hanemaayer).
+ 113. Fix some compile problems on SVR4 (Takaaki Nomura).
+
+XFree86 3.2g (19 December 1996)
+ 112. Separate the function prototypes out of xf86_OSlib.h (Stuart Anderson).
+ 111. Fix for change 97 (which was causing a server startup problem)
+ (Harald Koenig).
+ 110. Enable accelerated copy plane for 24bpp in XAA.
+ 109. Fix some compile problems related to the recent Cirrus changes.
+
+XFree86 3.2f (18 December 1996)
+ 108. Enable the XAA driver for cirrus chips with a BitBLT engine and
+ the driver for Laguna family chips (Harm Hanemaayer).
+ 107. Modify the support for dot clocks > 85 MHz on the 5436/46
+ (Harm Hanemaayer).
+ 106. Fix 24bpp support for the CL-GD5430 (Harm Hanemaayer).
+ 105. Add optimized support for the CL-GD5446 to the XAA driver
+ (Harm Hanemaayer).
+ 104. When a PCI cirrus chip is detected, enable linear addressing by default
+ (Harm Hanemaayer).
+ 103. Better LCD control settings for CL-GD754x for different LCD sizes,
+ and improve 754x LCD type detection (Harm Hanemaayer).
+ 102. Modify CRT FIFO threshold setting for the CL-GD7548 (Harm Hanemaayer).
+ 101. Don't treat the CL-GD7543 as an Alpine-family chip (Harm Hanemaayer).
+ 100. XAA updates (see the NOTES file in the xaa directory for details)
+ (Harm Hanemaayer).
+ 99. Support for sharing the core pointer between multiple XInput devices
+ (Frederic Lepied).
+ 98. XAA support for the ET6000 (Koen Gadeyne).
+ 97. Fix an S3 server crash caused by an off-by-one access when displaying
+ images (Harald Koenig).
+ 96. Updates to LynxOS support for 2.5.0 (Thomas Mueller).
+ 95. Add a "pc104" XKB layout for keyboards with the extra "Windows" keys
+ (Joe Moss).
+ 94. Fix for problem clearing "chordmiddle" flag from XF86Setup (Joe Moss).
+ 93. Ti3026 clock programming updates for the MGA driver (Andrew E. Mileski).
+ 92. A general s3init.c cleanup and modularization. This isolates
+ ramdac register save/restore functions, and moves them into
+ s3ramdacs.c (Mark Vojkovich).
+ 91. Fix S3 server lockup due to vsync wait when power-saving mode is
+ active (Xavier Ducoin).
+ 90. PC98 LinkKit updates (Takaaki Nomura).
+
+XFree86 3.2e (12 December 1996)
+ 89. Fix some TGUI clock programming problems (Massimiliano Ghilardi).
+ 88. Disable <ctrl><alt><backspace> when in DGA mode (Mark Vojkovich).
+ 87. Fix some XAA-related server link problems (Marc Aurele La France).
+ 86. Fix some LinkKit problems (David Bateman and Takaaki Nomura).
+ 85. Fix some more implicit typing in function declarations (Andreas Schwab).
+ 84. Add some more ELSA cards to the Cards file (Harald Koenig).
+ 83. Fix the ICS5342 clock limit (Harald Koenig).
+ 82. Fix typos in the mga Alpha support.
+ 81. Fix a typo in the XThrStub Imakefile (H.J. Lu).
+ 80. Resync the PC98 Imakefiles (Takaaki Nomura).
+
+XFree86 3.2d (9 December 1996)
+ 79. Updates to SCO Open Server 5 support (Tom Angert and J Kean Johnston).
+ 78. Add support for Linux C library version 6 (GLIBC), and fix some
+ prototype problems (H.J. Lu).
+ 77. Add Alpha support for the mga driver (SVGA server), and generic
+ driver (Mono/VGA2 server) (Jay Estabrook).
+ 76. Fix s3ReadImageBanked() with a planemask (Harald Koenig).
+ 75. Add fast bitblt support for the mga driver (Radoslaw Kapitan).
+ 74. Allow probing of the Bt485 when an S3 968 is detected (Mark Vojkovich).
+ 73. Fix an integer overflow in the S3V server when drawing long lines
+ (Harald Koenig).
+ 72. Add detection of the Alliance ProMotion chips to SuperProbe
+ (Joe Moss).
+ 71. XAA updates (including disabling non-TE text acceleration)
+ (Harm Hanemaayer).
+ 70. Fix pixmap support in XAA (Harm Hanemaayer and Alan Hourihane).
+ 69. Update the device-specific XF86Config parsing support to report
+ unknown keyword and options (Egbert Eich).
+ 68. Add another check for the fb base address in the S3 server
+ (Harald Koenig).
+ 67. Fix some typos in the SuperProbe Imakefile (Harald Koenig).
+ 66. Update the AXP/IO Jensen support (David Mosberger).
+ 65. Add code to the S3 server to recognise the ELSA 1000PRO/X
+ (Harald Koenig).
+ 64. Fix an initialisation problem for Diamond ViRGE/VX cards, which
+ causes a lockup (Harald Koenig).
+ 63. Add support for the STREAMS processor to the S3V server (Kevin Brosius).
+ 62. Fix a problem in xf86bench.c for OS/2 (Holger Veit).
+ 61. Some mga line fixes (Radek Kapitan).
+ 60. Chips & Technologies driver updates (includes support for the
+ 64200 and 64300 WinGine series of chips, and the 65525 and 65535
+ chips) (David Bateman and Egbert Eich).
+ 59. Fix some problems with the new S3 probe code (Mark Vojkovich).
+ 58. Allow xterm to output 8-bit characters in VT100 mode (Matthieu Herrb
+ and Thomas Dickey).
+ 57. Add a return value to XF86DGAGetVideo() (Mark Vojkovich).
+ 56. Add missing write_mem_barrier definitions (Harald Koenig).
+ 55. Fix some compile problems with 3.2c.
+
+XFree86 3.2c (24 November 1996)
+ 54. Fix some potential buffer overflows in SuperProbe, and don't
+ install it setuid root (Marc Slemko).
+ 53. Add support for driver-specific parsing of the XF86Config file's
+ Device section (Egbert Eich).
+ 52. Fix S3 virtual resolution handling problem introduced in 3.2a
+ (Mark Vojkovich).
+ 51. Add a '-nolisten' flag to the X server to allow disabling of
+ a transport type (Nathaniel D. Daw).
+ 50. Update Imake.rules to do better error recovery for missing
+ directory or Makefiles (Thomas E. Dickey).
+ 49. Add REP (repeat) control for xterm (Thomas E. Dickey).
+ 48. XAA updates (Harm Hanemaayer).
+ 47. Add required changes for the PC98 servers to build using XAA
+ (Takaaki Nomura).
+ 46. Fix an unaligned access in cfb (Harald Koenig).
+ 45. Add support for Alpha Jensen (EISA) using sparse memory MMIO
+ (Martin Ostermann).
+ 44. Add working "newmmio" support for AXP (Harald Koenig).
+ 43. Add some memory barriers to the ViRGE server for AXP (Harald Koenig).
+ 42. Reset the ViRGE (but not ViRGE/VX) GE while reading the BIOS to avoid
+ text font corruption (Harald Koenig).
+ 41. Change the S3 ViRGE default base address when PCI config registers
+ can't be accessed (mainly for AXP) (Harald Koenig).
+ 40. S3 ViRGE/VX fix (Harald Koenig).
+ 39. Patch for mk68 servers (Geert Uytterhoeven).
+ 38. Add detection for the S3 Aurora64V+ and Trio64UV+ (Harald Koenig).
+ 37. Replace the truncated files in xterm/tektests with full versions
+ (from color_xterm) (Thomas E. Dickey).
+ 36. Add some more MGA line code (Andrew Vanderstock).
+ 35. Add some MGA macros, especially for access type setting
+ (Radoslaw Kapitan).
+ 34. Add MGA screen-to-screen color expansion (not used yet)
+ (Radoslaw Kapitan).
+
+XFree86 3.2b (20 November 1996)
+ 33. Fix some compilation problems with 3.2a.
+ 32. Fix DGA fb mapping for SVR4 (Richard Coley).
+ 31. Fix Hercules mono driver text bug (H.J. Lu).
+
+XFree86 3.2a (18 November 1996)
+ 30. Bump default FreeBSD version to 2.1.6.
+ 29. TGUI driver updates for PC98 (Akio Morita).
+ 28. Fix trident driver compile problem with VGA2 and VGA16 servers
+ (Takaaki Nomura).
+ 27. XAA support for the Trident driver (Alan Hourihane).
+ 26. Add VT52 emulation to xterm (Thomas E. Dickey).
+ 25. Fix a missing resets to groundstate in xterm (Denis Auroux and
+ Thomas Dickey).
+ 24. Improve overflow problem in XAA internal benchmarking
+ (Akio Morita).
+ 23. XAA support for the mga driver (Radoslaw Kapitan and the Matrox team).
+ 22. XAA support for the Cirrus BitBLT and Laguna chips (but not enabled
+ yet) (Harm Hanemaayer).
+ 21. XAA support for the ARK driver (Harm Hanemaayer).
+ 20. A new acceleration interface (XAA) for the SVGA server (Harm Hanemaayer).
+ 19. S3V s3plypt.c changed to use GE, but is slower so still disabled
+ (Harald Koenig).
+ 18. Change the S3V GE reset to avoid lockups (Harald Koenig).
+ 17. Add WaitIdle() at the end of S3V accel routines to avoid screen
+ corruption from direct fb access while the GE is still active
+ (Harald Koenig).
+ 16. Remove unsupported option flags from the S3V server (Harald Koenig).
+ 15. Allow large S3 cursors by switching to SW cursor when required
+ (Harald Koenig).
+ 14. Fix S3 frame buffer probing and memory leak (Harald Koenig).
+ 13. Fix S3 ReadImage with a planemask (when ReadImageNoMem can't be used)
+ (Harald Koenig).
+ 12. S3 line and text fixes (Harald Koenig).
+ 11. Fix DGA colourmap problems in the W32 server.
+ 10. Fix a problem with realloc usage in xrdb for some older OSs
+ (eg, SunOS 4.x) (Wolfgang Rupprecht).
+ 9. Fix an xrdb malloc problem (Michael Lipp).
+ 8. Fix xload problems on Solaris 2.5 (David Thompson).
+ 7. Fix xload problem for most BSD OSs that was introduced in 3.2, and
+ fix some problems in the BSDI-specific code (Matthieu Herrb).
+ 6. Modify the external ClockProg support to allow for programmable
+ clocks (ie, no clocks line) (Egbert Eich).
+ 5. Fix W32p rev C and rev D PCI ids (Koen Gadeyne).
+ 4. Fix a problem which causes a server crash on PANIX/PC98 when using
+ the XFree86-Misc extension (Takaaki Nomura).
+ 3. S3 server probe cleanup (Mark Vojkovich).
+ 2. Fix XF86Setup compile problem on Solaris (Robin Cutshaw).
+ 1. Patches for OS/2 support (Holger Veit).
+
+XFree86 3.2 (26 October 1996)
+1079. Fix a bug in xgc that can cause a SEGV (Takaaki Nomura).
+1078. README and FreeBSD doc updates (Takaaki Nomura).
+1077. RELNOTES updates, and some updates to the preinst and postinst scripts.
+1076. Tell xf86config about the S3V server.
+1075. Fix some typos in XF86Setup.
+1074. Fix a problem with XF86Setup that shows up when there is no
+ <Xroot>/bin/X link present.
+1073. Fix a test restoration problem with the ali driver.
+1072. NetBSD and Solaris doc updates (Matthieu Herrb).
+1071. Cirrus doc updates (Harm Hanemaayer).
+1070. Prevent Oak probe from falsely detecting some Avance Logic chips.
+
+XFree86 3.1.2Zd (24 October 1996)
+1069. Fix a problem with the TGUI driver disabling linear mode when the
+ OS doesn't support it.
+1068. Fix an image stipple problem in the S3, Mach8, Mach32 and 8514 servers
+ (Harald Koenig).
+
+XFree86 3.1.2Zc (24 October 1996)
+1067. Mach64 doc updates (Kevin Martin).
+1066. Xvfb shouldn't depend on cfb24 (Geert Uytterhoeven).
+1065. Update contrib to R6.1.
+1064. C&T doc updates (David Bateman).
+1063. Fix an image stipple problem in the S3V server (Harald Koenig).
+1062. Doc updates (Takaaki Nomura).
+
+XFree86 3.1.2Zb (23 October 1996)
+1061. Fix some NV1 problems, including clock selection problems and
+ pixel corruption problems (David McKay).
+1060. Fix some bad random() prototypes for Linux (Harald Koenig).
+1059. Fix NeqnCmd definition in NetBSD.cf (Matthieu Herrb).
+1058. Chips&Tech doc updates (David Bateman).
+1057. Cards db update for Chips&Tech (David Bateman).
+1056. Some updates to the "supported" contrib clients (Harald Koenig).
+1055. VGADriver doc updates (Stuart Lamble).
+1054. LynxOS doc updates (Thomas Mueller).
+1053. Fix a problem in mgaFillBoxSolid() (Radoslaw Kapitan).
+1052. Fix a serious probe bug in the MGA driver which causes a crash on
+ non-PCI machines (Egbert Eich).
+1051. Fix a serious probe bug in the NV driver (David Bateman).
+
+XFree86 3.1.2Za (21 October 1996)
+1052. Some documentation updates (Dirk Hohndel).
+1051. A few cleanups that have no affect on function (Harald Koenig).
+1050. Fix a problem in XF86Setup (Harald Koenig).
+
+XFree86 3.1.2Z (20 October 1996)
+1049. Update XF86_SVGA man page (Harm Hanemaayer).
+1048. Update Linux README (Dirk Hohndel).
+1047. Fix some mono/4bpp problems introduced by recent ET6000 changes
+ (Koen Gadeyne).
+1046. Updates to the Cards database (Harald Koenig).
+1045. Fix xdpyinfo core dump when the XInput extension is not available
+ (Frederic Lepied).
+1044. Fix SuperProbe mis-detection of S3 ViRGE (Harald Koenig).
+1043. S3V README (Harald Koenig).
+1042. Resync some PC98 Imakefiles (Takaaki Nomura).
+1041. Update XF86Setup card list features, and add 1152x864 video modes
+ (Harald Koenig).
+
+XFree86 3.1.2Gq (19 October 1996)
+1040. Some updates to use the native setlocale() in the GNU libc used
+ by Linux/Alpha/ELF (Ulrich Drepper, Harald Koenig).
+1039. MGA README (Andrew Vanderstock and Dirk Hohndel).
+1038. Fix REQUIREDLIBS problem with dynamic xie.so (Alan Hourihane).
+1037. Update man page versions (Takaaki Nomura).
+1036. Add xf86VTSema checks to the MGA server, move blitter init to
+ HWRestore, and wait for drawing engine before enter/leave VT
+ (Radoslaw Kapitan).
+1035. TGA and Trident doc updates (Alan Hourihane).
+1034. Remove an unused TGA server file (Alan Hourihane).
+1033. Update to the Chips&Tech screen corruption fix (Egbert Eich).
+1032. Fix a typo in the Chips&Tech driver which prevents the "hw_clocks"
+ option from working (David Bateman).
+1031. Move the SVGA 'mx' driver to after the 'chips' driver, because its
+ probe causes problems for the chips driver. Also, fix a problem
+ in the 'mx' probe where it writes to a register without first saving
+ its contents.
+
+XFree86 3.1.2Gp (18 October 1996)
+1030. Fix the cursor colour not being correctly set in 15/16/32bpp modes
+ on the CT, ET, VT and GT chips (Kevin Martin).
+1029. Change Mach64 block_write behaviour. Assume that block write mode is
+ initialised by the BIOS, but still allow it to be turned on or off
+ explicitly in the XF86Config (Kevin Martin).
+1028. Set the extended display FIFO LWM bit on the Mach64 CT-D (Kevin Martin).
+1027. Fix the retrace wait in mach64AdjustFrame() (Kevin Martin).
+1026. Delete Mach64 doublescan modes for chipsets that don't support any
+ accelerated doublescan modes (Kevin Martin).
+1025. Set Mach64 display FIFO setting to the values supplied by ATI for
+ various chipset/memory type/memory size/bpp combinations (Kevin Martin).
+1024. Fix some MGA accel problems (Radoslaw Kapitan).
+1023. FreeBSD and NetBSD doc updates (Takaaki Nomura).
+1022. Fix some Mach32 16bit font display problems (Bryan Feir).
+1021. Add support for the ICS1562 clockchip used by the DEC TGA (Harald
+ Koenig).
+1020. Make WaitQueue wait for three more free slots than requested to
+ allow a safety margin in case of coding bugs (the ViRGE will lock
+ up the PCI bus when the FIFO is full) (Harald Koenig).
+1019. S3V fixes for some XTEST errors, and remove debug and unused code
+ (Harald Koenig).
+1018. Preliminary support for the Trident Cyber 938x chipset (Alan Hourihane).
+1017. Update the max clock for the Cirrus 754x with LCD enabled, and
+ deal more gracefully when a clock line is encountered (Harm Hanemaayer).
+1016. Add/implement XF86DGAGetViewPortSize() and add an extra argument
+ to XF86DGAViewPortChanged() which indicates the number of pages
+ being used when multi-buffering (Harm Hanemaayer).
+1015. Move the setting of the XF86DGADirectColormap flag into
+ XF86DGAInstallColormap() so that apps which use this function but
+ don't explicitly set the flag will work correctly.
+
+XFree86 3.1.2Go (17 October 1996)
+1014. Add xterm-r6 entries to the xterm termcap and terminfo files. These
+ are compatible with the standard X11R6 version of xterm.
+1013. Chips&Tech driver updates, including: add an option to deal with
+ LCD panel size problems, add an option to use an 18bit bus for some
+ TFT laptops, allow imageblt to be disabled, support sync-on-green
+ for the 65550, improve some screen scrambling problems, add DGA
+ support, fix 24bpp acceleration problems, fix HW cursor colouring
+ problems, update docs (Egbert Eich, David Bateman, Nozomi Ytow,
+ Marc de Courville, Jens Mauer, Adam Sulmicki).
+1012. BlankDelay settings for ViRGE (non-VX) (Harald Koenig).
+1011. More S3V ROPs for planemask simulation for BLTs (not used yet)
+ (Harald Koenig).
+1010. S3V fix for some image ops (Harald Koenig).
+1009. LynxOS microSPARC updates (Thomas Mueller).
+1008. OS/2 updates (Holger Veit and Sebastien Marineau).
+1007. TGA server updates, including disallow interlace modes, parse /proc/pci
+ output to find the memory base address (Alan Hourihane).
+1006. Add a DGA flag (XF86DGADirectColormap) to control when the colourmap
+ is in the exclusive control of XF86DGAInstallColormap(). This allows
+ older DGA clients which don't use XF86DGAInstallColormap() to work
+ as before.
+1005. Fix mmap in libXxf86dga for FreeBSD 1.1.5.
+1004. Fix a typo in xf86writepci() which causes it to return without doing
+ anything (URATA Shuichiro).
+
+XFree86 3.1.2Gn (16 October 1996)
+1003. Fix a problem with the ospex Imakefile regarding the building of
+ a non-shared library.
+1002. Increase the listen(2) backlog value in Xtranssock.c.
+1001. VidMode extensions updates (Joe Moss).
+1000. Add QueryDirectVideo and ViewPortChanged functions to the DGA
+ extension (Harm Hanemaayer and Mark Vojkovich).
+ 999. Fix a problem where parts of lines incorrectly appear black with the
+ S3V server (Berry Dijk).
+ 998. Fix some S3V problems that show up when running xtest (Harald Koenig).
+ 997. Change MGAAdjustPitch to choose a pitch for which acceleration is
+ possible (Ansgar Hockmann).
+ 996. Fix some server compile warnings (Thomas E. Dickey).
+ 995. Set HasPoll to YES for NetBSD 1.2 and OpenBSD. This solves the
+ fundamental problem select has with the width of a fd_set
+ (Matthieu Herrb).
+ 994. Use modified ROPs and colour bit patterns to simulate the planemask
+ where possible in the S3V line code (Harald Koenig).
+ 993. Report the Wacom function/macro button as key events (Frederic Lepied).
+ 992. Initial DSP programming of Mach64 VT-B and GT-B implemented, but not
+ enabled yet (Kevin Martin).
+ 991. Mach64 CT, ET, VT, GT clock programming changed to be more accurate.
+ Previously it used integer arithmetic, now it uses floats (Kevin Martin).
+ 990. Mach64 VT-B and GT-B extra clock divisors (3,6,12) implemented
+ (Kevin Martin).
+ 989. Fix Mach64 VT-B and GT-B memory detection (Kevin Martin).
+ 988. Updates for LinkKit and SVR4 README files (Takaaki Nomura).
+ 987. Add a MGAWAITFIFOSLOTS macro for use with accel functions
+ (Andrew Vanderstock).
+ 986. Fix for MGA line colour that works at all depths (Andrew Vanderstock).
+ 985. Add a wait for retrace to the end of most Adjust functions when DGA
+ mode is active (Mark Vojkovich and Harm Hanemaayer).
+ 984. Fix a typo in XF86Setup, and change the vsync parameters of some
+ of the default monitor types (Harm Hanemaayer).
+ 983. ET6000 support for linear memory and 16/24/32bpp in the SVGA server
+ (Koen Gadeyne).
+ 982. OpenBSD no longer defines __NetBSD__ in their cpp (Matthieu Herrb).
+ 981. OpenBSD/NetBSD doc updates (Matthieu Herrb).
+
+XFree86 3.1.2Gm (13 October 1996)
+980. Set foreground colour for MGA line code (Ansgar Hockmann).
+979. Add weight 555 support for the Cirrus 5464 (Corin Anderson).
+978. Fix Cirrus HAVE546X macro to detect the 5464 (Corin Anderson).
+977. Updates to Cirrus docs and Cards database (Corin Anderson).
+976. Add detection of the ARK2000MI to SuperProbe (Harm Hanemaayer).
+975. Cirrus updates, including fix MMIO for the Cirrus 5446, update some
+ DAC register values, disallow clocks line and change max clock for
+ LCD displays (Harm Hanemaayer).
+974. Add some sanity checks for potential VT problems in the cirrus and
+ ARK drivers (Harm Hanemaayer).
+973. Fix for LynxOS microSPARC (Thomas Mueller).
+972. Update the LynxOS docs for 3.2 (Thomas Mueller).
+971. Change the various malloc/free calls in the XKB code to use the
+ XkbMalloc/XkbFree equivalents (Joe Moss).
+970. Update the Wacom driver to support the new stylus with two side
+ buttons. The second side button is reported as button 4
+ (Frederic Lepied).
+969. Update the LinkKit to build the SVGA and I128 servers, and update the
+ LinkKit README (Takaaki Nomura).
+968. DGA support for the W32 server (Koen Gadeyne).
+967. Resynch some PC98 Imakefiles (Takaaki Nomura).
+966. LinkKit updates for a PC98-only LinkKit (Takaaki Nomura).
+965. Add some missing bits to the MGA solid box fill patch (Radoslaw Kapitan).
+964. Fix a typo in SuperProbe that would result in incorrect chipset
+ reporting for some Cirrus chips (Harm Hanemaayer).
+
+XFree86 3.1.2Gl (10 October 1996)
+963. PC98 doc updates (Michio "Karl" Jinbo).
+962. Add some solid box fills to the MGA driver (Radoslaw Kapitan).
+961. Cirrus and Ark doc updates (Harm Hanemaayer).
+960. Apply 959 to the Mach32 server.
+959. Ignore clipping boxes completely to the left of right of each glyph
+ for the S3, Mach8 and 8514 servers (Hans Nasten).
+958. LinkKit fixes for PC98 (Takaaki Nomura).
+957. Fix Imakefile problem related to dynamic loading for PC98
+ (Michio "Karl" Jinbo).
+956. ViRGE/VX update (Harald Koenig).
+955. Add power_saver support to the TGA server (Alan Hourihane).
+954. Some more line/seg updates for S3V (Harald Koenig).
+953. Fix some problems with the previous S3V planemask patch (Harald Koenig).
+952. Add code to read the MGA card information from the BIOS. This
+ allows the RAMDAC type/speed to be determined (Andrew E. Mileski).
+951. Disable 24/32bpp for S3V server because it doesn't work yet.
+950. Driver for NVidia NV1 / SGS-Thomson STG2000 (David McKay).
+
+XFree86 3.1.2Gk (8 October 1996)
+949. Use cfb code in the S3V server when the planemask is non-trivial
+ (Harald Koenig).
+948. More line/seg fixes for the S3V server (Harald Koenig).
+947. Fix XORing text (and other ROPs) for the S3V server (Harald Koenig).
+946. Force 1-cycle EDO mode for the ViRGE/VX (Harald Koenig).
+945. Disable the font and pixmap caches in the S3V server (not implemented).
+944. Apply 943 to the Mach32 and S3V servers.
+943. Ignore clipping boxes completely above or below the displayed text
+ for the S3, Mach8 and 8514 servers. This improves performance
+ when a window is partly covered by a shaped window (Hans Nasten).
+942. Resync PC98 Imakefiles, and update documentation (Michio "Karl" Jinbo).
+941. Some LinkKit changes to prevent conflicts between the xf86 and xf98
+ linkkits when doing a combined build/install.
+940. Fix for keycodes/xfree98 (Takefumi Tsukada).
+939. LinkKit support for PC98 servers (Takaaki Nomura).
+938. Fix MGA 24bpp problems (Ansgar Hockmann).
+937. Fix a potential memory interleave problem and spurious warning messages
+ in the Cirrus driver (Corin Anderson).
+
+XFree86 3.1.2Gj (6 October 1996)
+936. Build PEX, XIE as dynamically loaded modules by default where it is
+ supported.
+935. Fix some S3gendac interface changes (Koen Gadeyne).
+934. Fix a lex warning for reconfig (Koen Gadeyne).
+933. Fix a ROP problem in the W32 solid fill code (Koen Gadeyne).
+932. Dynamic PEX, XIE extension support for Linux/ELF.
+931. 24bpp packed support for the MGA driver (Ansgar Hockmann).
+930. Fix the way the list of clocks is derived for the Cirrus driver
+ (Harm Hanemaayer).
+929. Fix problems with 16bpp for a 1MB Cirrus 5434 (Harm Hanemaayer).
+928. Fix for xdm indirect query for ISC (Michael Rohleder).
+927. Remove virtual size check in the mach32ValidMode (Michael Rohleder).
+926. Fix a typo in lib/Xbsd (Michael Rohleder).
+925. Fix "nolinear" mode in the MGA driver (Radoslaw Kapitan).
+924. Add memory detection to the MGA driver (Radoslaw Kapitan).
+923. Update NetBSD/OpenBSD docs (Matthieu Herrb).
+922. Add OpenBSD/mips config support (Per Fogelstrom, Matthieu Herrb).
+921. Update OpenBSD version to 2.0 (Matthieu Herrb).
+920. Updates to the S3 ViRGE line code (Harald Koenig).
+919. Updated ViRGE/VX support (Harald Koenig).
+918. TGA server shouldn't report DGA support (Alan Hourihane).
+917. Alpha-related config updates (Harald Koenig).
+916. Updates to Cirrus probing in SuperProbe (Harm Hanemaayer).
+915. Fix a Cirrus bitmap overrun problem (Harm Hanemaayer).
+914. Fix Cirrus FIFO settings for 5436/5446 (Harm Hanemaayer).
+913. Fix Cirrus HW cursor colours at 32bpp (Harm Hanemaayer).
+912. Fix 24bpp support for Cirrus 54xx (Harm Hanemaayer).
+
+XFree86 3.1.2Gi (3 October 1996)
+911. SCO updates. SCO5 is now the only supported version (there are
+ still problems to be resolved though) (J. Kean Johnston).
+910. LinkKit updates and related cleanups (Marc Aurele La France).
+909. Updated code to program the Ti3026 clock in the MGA server
+ (Andrew E. Mileski).
+908. Preliminary S3 ViRGE/VX support (Harald Koenig).
+907. Fix S3 PCI read burst disable problem (Harald Koenig)
+906. Fix SuperProbe memory reporting for the S3 ViRGE, ViRGE/VX, and
+ separately report off-screen memory (Harald Koenig).
+905. Fix MGA interleave and 32bpp problems (Radoslaw Kapitan).
+904. Fix a RD_MASK problem that shows with 928 cards (at least on some
+ PC98 servers) (Michio "Karl" Jinbo, Harald Koenig).
+903. Allow xterm to be statically linked with libtermcap on Linux
+ (Dirk Hohndel).
+902. Fix screen save/restore on VT switch for the TGA server (Alan Hourihane).
+901. Chips&Tech updates, including a fix for line acceleration
+ problems (David Bateman).
+900. VidMode extension changes/enhancements (not complete yet) (Joe Moss).
+899. S3 ViRGE solid line code (Harald Koenig).
+898. S3 ViRGE updates, including using cfb calls for non-implemented
+ functions (Harald Koenig).
+897. Fix for a line drawing problem in the Cirrus driver (Harm Hanemaayer).
+896. Ark driver updates, including fixes for FIFO settings, HW cursor at
+ 16/32bpp, virtual panning at 24bpp, and enable BitBlt acceleration at
+ 32bpp (Harm Hanemaayer).
+895. LynxOS microSPARC updates (Thomas Mueller).
+894. Add support for Japanese 106 key keyboards on PANIX. This is enabled
+ with the 'panix106' keyword in the Keyboard section (Takefumi Tsukada).
+893. README.SVR4 update (Takaaki Nomura).
+892. ValidMode function for Mach32 (Bryan Feir).
+891. Fix a Mach32 problem with VT switch screen save/restore when the
+ virtual width is less than 1024 (Bryan Feir).
+890. Updated NetBSD aperture driver (Matthieu Herrb).
+889. Allow the PEX and XIE server extensions to be built as dynamic modules
+ (FreeBSD and NetBSD so far). (Matthieu Herrb).
+
+XFree86 3.1.2Gh (29 September 1996)
+888. Replace virtualX by displayWidth where appropriate in many SVGA drivers.
+887. Fix virtual width/pitch checking/setting for the MGA driver.
+886. Solid line acceleration for the MGA driver (Dirk Hohndel).
+885. Improve the way scanline pitch restrictions are implemented for the
+ SVGA server.
+884. Set default W32 black/white pixel values the same as for the other
+ servers.
+883. Fix some W32 stipple problems (Glenn Lai).
+882. Allow "mclk" as a synonym for "s3mclk" (Harm Hanemaayer).
+881. Adjust mode timings in the ARK driver when required for 24bpp operation
+ and for HW cursor operation (Harm Hanemaayer).
+880. Some MGA driver cleanups.
+879. Fix selection of interleave mode for MGA (Ansgar Hockmann).
+878. Add "fifo_conservative" option for the ARK driver (Harm Hanemaayer).
+877. Possible fix for ICS5342 MCLK calculation in the Ark driver
+ (Harm Hanemaayer).
+876. Fix max clocks when ClockChip "cirrus" is used (Harm Hanemaayer).
+875. XF86Setup updates (see XF86Setup/CHANGELOG for details) (Joe Moss).
+874. LCD code for Cyber9320 in PC98_TGUI server (X98 core team).
+873. Fix typos in pc98_tgui.{c,h} (X98 core team).
+872. PC98 Imakefile updates (X98 core team).
+871. PC98 documentation updates (X98 core team).
+870. New Chips&Tech accelerations, including: multiple depth ImageGlyph
+ and PolyGlyph for 65545, 8bpp CopyPlane1to8 for 65545, 8bpp
+ FillRectTransparentStippled32 and FillRectOpaqueStippled32 for 65545,
+ modified simple BitBlt and Solid fill for 65550, stipple and tile
+ functions for 65550 (Egbert Eich, Xavier Ducoin, David Bateman).
+869. Chips&Tech driver fixes, including: improve stability of
+ suspend/resume, fix DSTN screens with 65550, reduce the size of
+ MMIO regions, fix PCI burst mode, disable line acceleration because
+ it can cause a server crash in rare circumstances (Egbert Eich,
+ Xavier Ducoin, David Bateman).
+868. Make the Cirrus fifo options work for the 546x chips (Corin Anderson).
+867. Support for the Cirrus 5464 (Corin Anderson).
+866. Add a hook to the SVGA server to allow drivers to specify a display
+ width (pitch) which is different from the virtual width. This
+ is required for some Cirrus chipsets (Corin Anderson).
+865. 24bpp packed pixel Cirrus support (Harm Hanemaayer and Corin Anderson).
+864. Work around a problem on NetBSD/OpenBSD where dlsym() searches for
+ the symbol in the whole executable rather than just in the modules
+ specified (Matthieu Herrb).
+863. Add an X server and config/imake support for LynxOS microSPARC 2.4.0
+ (Thomas Mueller).
+862. Remove stale fb shared memory before dying on LynxOS (Thomas Mueller).
+861. Work around a popen/pclose bug on LynxOS in the server XKB code
+ (Thomas Mueller).
+860. Work around a bash problem on LynxOS which affects rstart/Imakefile
+ (Thomas Mueller).
+859. Solid vertical and horizontal lines for the S3 ViRGE server (Berry Dijk).
+858. Fix max clock for TGA (Alan Hourihane).
+857. Fix for TGA VT switching problems (Alan Hourihane).
+856. Add code to detect the ViRGE/VX (Dirk Hohndel).
+
+XFree86 3.1.2Gg (26 September 1996)
+855. Preliminary support for the Matrox Millennium (MGA 2064W)
+ (Radoslaw Kapitan, Andrew Vanderstock, Dirk Hohndel).
+
+XFree86 3.1.2Gf (25 September 1996)
+854. Mach32 documentation (Bryan Feir).
+853. Improve Mach32 ramdac probing in SuperProbe (Bryan Feir).
+852. Fix xf86writepci() prototype (Alan Hourihane).
+851. TGA server and documentation updates (Alan Hourihane).
+850. Fix missing argument in the QueryBestSize functions in the SVGA server
+ (Harm Hanemaayer).
+849. Another fix for usage of XInput defines, and make initext depend on
+ ICONFIGFILES (Marc Aurele La France).
+848. Improve reliability of detecting Mach64 cards in SuperProbe, the
+ Mach64 server and the ati driver (Marc Aurele La France).
+847. Complete s3im.c for s3_virge (Harald Koenig).
+846. Fix s3_virge framebuffer detection (Harald Koenig).
+845. Fix s3_virge compile problems when using a compiler other than gcc.
+844. Missing patch to vgaCmap.c for item 842 (Harm Hanemaayer).
+
+XFree86 3.1.2Ge (24 September 1996)
+843. Add Trio/ViRGE clock support to the "s3_svga" driver. This is still
+ incomplete, and for development use (Harald Koenig).
+842. Add vgaGetInstalledColormaps() and support for 8-bit colour components
+ to the SVGA server (Harm Hanemaayer).
+841. ARK driver updates, including: fix problems with BitBlts at 24bpp,
+ fix hw cursor at 8bpp, fix some ZoomDAC problems, and add support
+ for 8-bit colour components (dac_8_bit) at 8bpp (Harm Hanemaayer).
+840. Fix some typos in compiler.h (Harald Koenig).
+839. Initial ViRGE s3im.c, and remove unneeded s3linear.h and bank switching
+ (Harald Koenig).
+838. Fix some XInput and XKB defines (Marc Aurele La France).
+837. LinkKit fixes (Marc Aurele La France).
+836. Add ARK Logic chipset detection to SuperProbe (Harm Hanemaayer).
+835. Fix a typo in xkbcomp/symbols/de (Thomas Mueller).
+
+XFree86 3.1.2Gd (23 September 1996)
+834. Rename ViRGE driver from s3_generic to s3_virge (Dirk Hohndel).
+833. Don't reference uninitialised s3MmioMem in ViRGE server (Harald Koenig
+ and Dirk Hohndel).
+832. Don't do S3 bug tests for 928 and earlier (Harald Koenig).
+831. ViRGE fixes, including BITBLT and text clipping (Harald Koenig).
+830. Updates to the Cards file for Cirrus and Ark (Harm Hanemaayer).
+829. xf86config updates, including 24bpp support, and making "virtual"
+ optional (Harm Hanemaayer).
+828. Fix trident probe so that it restores all registers it touches
+ (Harm Hanemaayer).
+827. ARK driver updates, including: auto-detect the ZoomDAC and print out
+ the RAMDAC type, use DRAM bandwidth for CRT FIFO setting, don't allow
+ 5-5-5 weight for 16bpp with 1000PV and ZoomDAC, and add sanity check
+ for off-screen CopyWindow (Harm Hanemaayer).
+826. Fix a typo in the TGA server that could cause it to think it has found
+ a valid mode (Alan Hourihane).
+825. Don't try to use -ldl for XF86Setup on non-ELF Linux (Harald Koenig).
+824. Add "slow_dram" option for the W32 server to fix some problems with
+ older cards (Dirk Hohndel).
+
+XFree86 3.1.2Gc (22 September 1996)
+823. XKB data file updates for jp106/jp (Takaaki Nomura).
+822. S3 Virge server (preliminary version) (Harald Koenig).
+821. ARK driver updates, including basic BitBlt acceleration, improved
+ ramdac support, experimental 24bpp support, and max dot clocks take
+ the memory clock into consideration (Harm Hanemaayer).
+820. Minor xdm and xterm changes to allow them to compile on FreeBSD 1.1.5.
+819. Fix Trident probe in SuperProbe so that it doesn't corrupt ET6000
+ display (Koen Gadeyne).
+818. Fix Sierra 1502X RAMDAC handling in the W32 server (Dirk Hohndel).
+817. TGA server for Alpha machines. Not accelerated at this stage
+ (Alan Hourihane).
+816. SuperProbe update for ELSA Gloria (Harald Koenig).
+815. Fix/add 15/16bpp support for S3 805i with AT&T 20C498 (Hermann Lauer).
+814. Improve S3 clipped text performance (Harald Koenig).
+813. Fix a typo in xkbcomp/rules/xfree86 (Joe Moss).
+812. Add detection for the Cirrus 7548, and treat it like the other 754x
+ chips (Harm Hanemaayer).
+811. Change xterm valid-response code in DECRQSS from 0 to 1 to match a
+ real VT420 terminal (Thomas E. Dickey).
+810. Add a resource 'decTerminalID' to control the reporting level of
+ xterm (e.g., VT100, VT220), and use it to implement/correct the
+ DA1, DA2 and DECRPTUI reports (Thomas E. Dickey).
+809. Fix xterm restoration of color for bold/underline color mode
+ (Thomas E. Dickey).
+
+XFree86 3.1.2Gb (15 September 1996)
+808. Update PC98 Imakefiles (Michio "Karl" Jinbo).
+807. Fixes for problems with the PC98 TGUI server (Michio "Karl" Jinbo).
+806. Fix/workaround to avoid DGAInstallColormap() being affected by
+ window managers.
+805. Fix some problems related to the change in the xf86scanpci() interface.
+
+XFree86 3.1.2Ga (14 September 1996)
+804. Implement s3ValidMode() (Mark Vojkovich).
+803. Modify the ValidMode interface in preparation for some VidMode extension
+ changes.
+802. Fix a problem with the XOpenDisplay buffer overflow fix (item 734 below)
+ (X Consortium, Kaleb Keithley).
+801. Fix FIFO setting for Cirrus Alpine (543x, 5446) cards with 1MB
+ (Harm Hanemaayer).
+800. Modify Cirrus asm code to allow PCI burst accesses (Harm Hanemaayer).
+799. Change default for MvCmd to 'mv -f'.
+798. Redo the xf86PCI code, based on that in FreeBSD-current.
+797. Update xf86PCI code to deal with PCI bridges and multi-function
+ devices (Mihoko Tanaka).
+796. Fix a problem with the Sigma L-View driver (and presumably the same
+ problem in the HGC1280 driver (Norbert Berzen).
+795. Add a "Sundeadkeys" XKB variant for European keyboards.
+794. Change the "es" XKB symbols to match a Spanish keyboard (Jon Tombs).
+793. Update Cards database.
+792. Fix panning problem with some Cirrus cards (Corin Anderson).
+791. Map the S3 MMIO area separately (Harald Koenig).
+790. Don't allow S3 newmmio to be selected for chips that don't support
+ it (Harald Koenig).
+789. Fix for Linux/m68k frame buffer device (Geert Uytterhoeven).
+788. Fix detection of some SiS chips.
+787. Turn on 32-bit mode for TGUI chips. This allows PCI burst to be
+ turned on by default. (Alan Hourihane).
+786. Disable 16bpp for the TGUI9320LCD since it doesn't work (Alan Hourihane).
+785. Fix ET6000 problems with the VGA16/Mono servers (Koen Gadeyne).
+784. Speedups for the W32 arc and teblt8 code (Glenn Lai).
+783. Fix W32 line-drawing using the wrong ROP for horizontal and vertical
+ lines (Koen Gadeyne).
+782. Add a new xdm access control keyword "NOBROADCAST" to disable answering
+ broadcasts from specified hosts (Kimmo Suominen).
+781. Make xf86config run the correct server by name rather than trying
+ to run 'X' (Holger Veit).
+780. Change default "gb" XKB symbols (James Hawtin).
+779. Config and documentation updates for LynxOS (Thomas Mueller).
+778. Update XF86Setup's device list for LynxOS (Thomas Mueller).
+777. Fix compile problem when XINPUT isn't defined (James Hawtin).
+776. XF86Setup needs to be linked with -ldl on Solaris (James Hawtin).
+
+XFree86 3.1.2G (3 September 1996)
+775. Fixes for some NECS3 server problems (Naofumi Honda).
+774. Fix some XF86Setup typos.
+773. OS/2 updates (Holger Veit).
+
+XFree86 3.1.2Fc (3 September 1996)
+772. XF86Setup updates (see XF86Setup/CHANGELOG for details) (Joe Moss).
+771. PCI detection for the Alliance ProMotion 6422 (Kent Hamilton).
+770. Documentation updates (Dirk Hohndel, Matthieu Herrb).
+769. Updates for OpenBSD, including support for recent changes to the
+ console drivers (Matthieu Herrb).
+768. Need rint() for ISC and Lynx (Michael Rohleder).
+
+XFree86 3.1.2Fb (1 September 1996)
+767. S3 support for the Diamond SS2410 RAMDAC (eriks).
+746. Fix resize on Linux (for terminfo) (Rik Faith).
+745. Updates to Cyrillic fonts (Andrey Chernov).
+
+XFree86 3.1.2Fa (31 August 1996)
+744. Fix xterm's handling of SGR 22, 24 and 25 in combination with colorUL
+ and colorBD resources. Also noted & fixed reset of colored
+ underline/bold with SGR 0 (Thomas E. Dickey).
+743. Fix a typo in the xterm termcap (Thomas E. Dickey).
+742. Don't allow the "fb_debug" option when newmmio is used (Harald Koenig).
+741. Make sure s3Port59/s3Port5A are initialised before s3Init() is called
+ (Harald Koenig).
+740. Force 64MB alignment of linear FB, even when MemBase is given in
+ the config file (Harald Koenig).
+739. Disable newmmio when "nolinear" is specified, or when linear memory
+ mapping isn't available (Harald Koenig).
+738. Fix C&T driver printing out a line in its probe in cases where a
+ C&T chip hasn't been detected.
+737. Driver for the Alliance ProMotion 6422 (Alliance Semiconductor, and
+ Kent Hamilton).
+736. Make the Ark SVGA driver detect the ARK2000MT, and treat it as an
+ ARK2000PV.
+735. Updates for SCO OpenServer 5 support (J. Kean Johnston).
+734. Fix for a buffer overflow problem in XOpenDislpay (libX11)
+ (X Consortium, Kaleb Keithley).
+733. Some imake/config updates (Dirk Hohndel).
+732. Add a '-nolock' server command line option to disable the X server
+ locking (Roger Wolff).
+731. Scanpci updates: Check general pci-pci bridges, add some more
+ vendor and device IDs, and add a '-f' flag to print out the full
+ information -- otherwise just print the vendor/device name
+ (Mihoko Tanaka).
+730. Updates for ISC (Michael Rohleder).
+729. Fix typo in XF86Setup/mouse.tcl (Thomas Mueller).
+728. Fix malloc problem in TLI xtrans code (Joe Moss).
+727. Fix some WaitQueue problems with the S3 server (Naofumi Honda,
+ Takaaki Nomura, Harald Koenig).
+726. Fix for display problem with Trio64V+ at 16bpp (Harald Koenig).
+725. Fix clock limit arrays for Cirrus 754x chip (Corin Anderson).
+724. Add a "DefaultColorDepth" keyword for the Screen section of the
+ XF86Config (Dirk Hohndel).
+723. Fix problem using non-linear mode with TGUI chips (Alan Hourihane).
+722. Turn off PCI burst write by default for TGUI chips.
+
+XFree86 3.1.2F (27 August 1996)
+721. Update the QuickStart guide with details about using XF86Setup (Joe Moss).
+720. Some XF86Setup updates (Joe Moss).
+719. Avoid a possible malloc/free problem in the xtrans TLI code (Joe Moss).
+718. Some Linux a.out lib updates for libX11, libXt (Harald Koenig).
+717. Fix 32bpp S3 newmmio problem (Harald Koenig).
+
+XFree86 3.1.2Eo (26 August 1996)
+716. Disable 24bpp packed mode in S3 server because it doesn't work properly
+ yet (Harald Koenig).
+715. Don't use newmmio S3 driver by default on Alpha architecture (or
+ for ISC) (need to specify it explicitly in XF86Config) (Harald Koenig).
+714. Fix some incorrect printf-style arguments in xkbcomp (Thomas E. Dickey).
+713. Fix compiler warnings, including uninitialised variables, missing
+ prototypes, etc (Thomas E. Dickey).
+712. XF86Setup updates (Joe Moss).
+711. Fix for some potential buffer overrun problems in libXt and libX11 that
+ can lead to security holes.
+
+XFree86 3.1.2En (25 August 1996)
+710. Build/install the xkbui library regardless of whether XF86Setup is
+ being built.
+709. Fix lots of compiler warnings and related problems when building on
+ Alpha (Richard Henderson).
+708. Fix missing function prototype problem in libXi that causes problems
+ on Alpha platforms (Richard Henderson).
+707. XF86Setup updates.
+
+XFree86 3.1.2Em (24 August 1996)
+706. Swap acute and apostrophe keys in de(nodeadkeys) (Michael Rohleder).
+705. ISC documentation updates (Michael Rohleder).
+704. Chips & Tech documentation update (Egbert Eich).
+703. Chips & Tech driver updates, including a fix for a 65545 PCI problem,
+ and a hack/option for a suspend/resume problem (Egbert Eich).
+702. Major updates to XF86Setup (Joe Moss).
+701. Updates to the Cards database (various).
+700. ATI (SVGA) driver update (Marc Aurele La France).
+699. Cards file update for AGX (Henry Worth).
+698. Fix for a BIOS initialisation problem on some VideoLogic (S3) cards
+ (Harald Koenig).
+697. Fix some 32bpp problems with S3 newmmio (Harald Koenig, Bernd Lind).
+696. Fix some PCI lockups when using S3 newmmio mode (Harald Koenig).
+
+XFree86 3.1.2El (23 August 1996)
+695. NetBSD/OpenBSD doc updates (Matthieu Herrb).
+694. Fix typo in rules/xfree86 (Joe Moss).
+693. Fix some virtual desktop scrolling bugs with the CL-GD5462 in the
+ Cirrus driver (Corin Anderson).
+692. Set BSD (syscons/pcvt) keyboard to K_RAW after establishing the tty
+ settings (was done in the opposite order) (Naofumi Honda).
+691. Fix PCVT_SUPPORT in BSD xf86KbdOn/Off functions (Naofumi Honda).
+690. Add correct handling of PCI connect/disconnect for the PC98 S3 968
+ server (Naofumi Honda).
+689. Fix PCI probing for PC98 machines (Michio Jinbo).
+688. Fix mask used for TGUI fb address when membase is supplied (Michio Jinbo).
+687. Add an xterm option/resource to allow text selection to be shown
+ differently -- ie, only highlight the characters selected when selecting
+ beyond the end of a line (Thomas E. Dickey).
+686. Fix PCI base address for S3 868/968, and newmmio fixes (Harald Koenig).
+685. Fix problem with memory allocation in XKB that could cause the server
+ to crash (Joe Moss).
+
+XFree86 3.1.2Ek (21 August 1996)
+684. Fixes for m68k support (Geert Uytterhoeven).
+683. Naming changes for m68k servers and config options (Geert Uytterhoeven).
+682. Update SuperProbe to identify the amount of memory for a 65550/54,
+ and fix detection of 65545 (David Bateman).
+681. Fix for 65545 PCI problems in the C&T driver (Egbert Eich).
+680. resync os2_select.c (Holger Veit).
+
+XFree86 3.1.2Ej (20 August 1996)
+679. Fix install problem when xkbcomp is linked against shared libs.
+678. Prevent server exit if the mouse device is changed to something
+ unsuitable (Joe Moss).
+677. XF86Setup updates (Joe Moss).
+676. Update XF86Config man page and sample XF86Config file for XKB changes
+ (Joe Moss).
+675. LinkKit fixes (David Bateman).
+674. Chips & Tech driver updates (David Bateman and others?).
+673. xterm bug fixes (Thomas E. Dickey).
+672. PCI probe fix for S3 server (Harald Koenig).
+671. Support for new MMIO style for 868/968/Trio64V+, and MMIO support
+ (with optimised use of memory barriers) for Alpha/AXP. This currently
+ has problems at 32bpp (Bernd Lind, Harald Koenig).
+670. Use POSIX termios for xterm for all Linux systems (Richard Henderson).
+669. Generalise mmap access to DENSE I/O memory for Alpha (Richard Henderson).
+668. 32/64 bit cleanup, especially in server's XIE code (Richard Henderson).
+667. Config updates for Linux/Alpha (Richard Henderson).
+666. Updates for OS/2 (Holger Veit).
+665. Fix problems building XF86Setup with BuildServersOnly set to YES.
+
+XFree86 3.1.2Ei (18 August 1996)
+664. Fix some PC98 Imakefile problems (Michio "Karl" Jinbo).
+663. Linux/m68k support (Geert Uytterhoeven, Martin Schaller, Gary Henderson).
+662. Change the S3 server's handling of situations where mode choices
+ cause problems. It is now less likely to exit in these situations.
+661. Add a -bestRefresh command line option to the X servers to change
+ the mode selection to pick the mode with the best refresh rate when
+ multiple modes of the same name are available.
+660. XF86Setup updates (see XF86Setup/CHANGELOG) (Joe Moss).
+
+XFree86 3.1.2Eh (14 August 1996)
+659. Update Cyrillic fonts (Andrey Chernov).
+658. Add support for the CL-GD5462 to the cirrus driver, and update
+ documentation for recent cirrus driver changes (Corin Anderson).
+657. XF86Setup updates (Joe Moss).
+656. Fix some LynxOS-related typos in the config (Thomas Mueller).
+655. Add a man page for the DGA extension.
+
+XFree86 3.1.2Eg (14 August 1996)
+654 Update Japanese docs (Michio "Karl" Jinbo).
+653 Add XF98_GA968 server for GA-968V4/PCI(S3 968) (Michio "Karl" Jinbo).
+652. Bring the PC98 tree into sync with the main tree, and add XF86Setup
+ (Michio "Karl" Jinbo).
+651. Fix problems with 32bpp sparse mode that were introduced in 3.1.2Eb.
+ Need to check that this fix works OK with 24bpp packed mode.
+650. Fix some compiler warnings (Thomas E. Dickey).
+649. Mods to ct_driver.c so that it will compile on SVR4.0 (no nested
+ asm calls, and work around a code generation problem).
+648. Fix some problems with mouse changes in 3.1.2Ef (Joe Moss).
+
+XFree86 3.1.2Ef (13 August 1996)
+647. ET6000 support for the SVGA and W32 servers. The support in the
+ W32 server is accelerated (Koen Gadeyne).
+646. Add support to xterm for most vt220 and vt320 terminal features
+ (Thomas E. Dickey).
+645. Support for I128 series II cards (Robin Cutshaw).
+644. Wacom driver updates (Frederic Lepied).
+643. Support for core motion history management through mi (Frederic Lepied).
+642. Improved integration of mouse with XInput (Frederic Lepied).
+641. Major updates to XF86Setup (Joe Moss).
+640. Update to latest version of XKB.
+639. Fix broken 32bpp sparse support in S3 server (there are still some
+ problems though, and they are also seen with the Mach64 server).
+
+XFree86 3.1.2Ee (11 August 1996)
+638. Implement ech and ech1 terminal capabilities for xterm (Thomas E. Dickey).
+637. Add blinking cursor support for xterm (disabled for now)
+ (Thomas E. Dickey).
+636. Fix a PEX font struct being freed twice (Richard Henderson).
+635. Make xterm tolerant of applications that allocate the whole colour map
+ (by disabling colour mode if the ANSI colours are set with non fg/bg
+ values) (Thomas E. Dickey).
+634. Allow ISO colour support to be #ifdef'd out in xterm. This allows
+ xterm's memory usage to be significantly reduced when colorMode is not
+ enabled (Thomas E. Dickey).
+633. Reduce flickering during resize for ReverseVideo in xterm
+ (Thomas E. Dickey).
+632. Fix xterm core dump problem on IRIX 5.2 (Thomas E. Dickey).
+631. Update scanpci to detect the #9 I128 series II (Robin Cutshaw).
+630. Preliminary Mach32 ramdac support updates (Bryan Feir).
+629. Document new xterm control sequences (Thomas E. Dickey).
+628. Fix problem introduced in 3.1.2E with software cursor on some non-i386
+ platforms (Thomas E. Dickey and Thomas Mueller).
+627. Support for SCO Open Server 5 (J. Kean Johnston).
+626. Add detection of the S3 ViRGE chip to SuperProbe (and scanpci), and
+ use PCI probing for S3 chipset detection in SuperProbe where appropriate
+ (Harald Koenig).
+625. Add detection of newly supported C&T chips to SuperProbe.
+624. Add a TextClock keyword for the XF86Config to fix problems restoring
+ the text clock with the chips & tech driver (Egbert Eich).
+623. Updates for the LinkKit (Egbert Eich).
+622. Significantly improved driver for Chips and Technologies chipsets.
+ Includes linear addressing (65530 and above), 16/24bpp (65540 and above),
+ programmable clock support (65540 and above), HW cursor support (65545
+ and above), BitBLT acceleration (65545/46 and 48), support for the
+ 65546, 65548, 65550 and 65554 (Nozomi Ytow, Egbert Eich, Ken Raeburn,
+ Xavier Ducoin and David Bateman).
+
+XFree86 3.1.2Ed (10 August 1996)
+621. Fix xterm colour translation problem (Michael Rohleder and
+ Thomas E. Dickey).
+620. xterm termcap/terminfo fixes (Thomas E. Dickey).
+619. Add escape sequences to xterm that act like CDE ddterm's window
+ operations (Thomas E. Dickey).
+618. Set the initial cleared screen colour correctly for the 8514 and Mach8
+ servers to match the default black pixel value and the -flipPixels
+ flag (Hans Nasten).
+617. Add support for LynxOS AT version 2.4.0, and client-only support for
+ LynxOS microSPARC and PowerPC (Thomas Mueller).
+616. Config updates for OpenBSD and NetBSD 1.2 (Matthieu Herrb).
+615. Fix typo in trident driver, and update XFree86 man page (Alan Hourihane).
+614. Fix problems with Trio64V+ video blanking signal. Some undocumented
+ options "trio64v+_bug1" to "trio64v+_bug3" have been added enable/disable
+ parts of the code in case they are required later (Harald Koenig).
+613. Don't require SuperProbe to do the BIOS signature check for VGA cards
+ when the PCI probe detects a VGA card (Koen Gadeyne).
+612. Add ET6000 detection to SuperProbe (Koen Gadeyne).
+611. Add PCI detection of ET6000 to scanpci and SVGA server (Koen Gadeyne).
+610. Update AGX documentation (Henry Worth).
+609. Add DGA support to the AGX server (Henry Worth).
+608. AGX server recognises "fast_vram" and "slow_vram" options as equivalents
+ to "fast_dram" and "slow_dram" (Henry Worth).
+607. 8 bit/RGB DAC mode is now the default for the AGX server where supported
+ (Henry Worth).
+606. Fix initialisation of the Bt481 for AGX-016 based Hercules dual-DAC
+ Graphite cards (Henry Worth).
+605. Fix overscan colour correctly for the AGX server to match the change
+ to the default black pixel value and the -flipPixels flag (Henry Worth).
+604. Update et4000w32.c for ChipHas24bpp in vgaVideoChipRec (Thomas E. Dickey).
+603. Prevent Xserver from exiting when a mouse device can't be opened and
+ the '-allowMouseOpenFail' command line option is used (Joe Moss).
+602. Add CL-GD5446 detection to SuperProbe.
+601. Add support for CL-GD5446 to the cirrus driver (Corin Anderson).
+600. Add PCI detection of Cirrus CL-GD5446 to SVGA server and scanpci
+ (Corin Anderson).
+599. Add a function XF86DGAForkApp() to the dga library, which causes
+ the client to fork, with the parent remaining to clean up after the
+ child exits (Jon Tombs).
+598. Add an InstallColormap function to the DGA extension (Jon Tombs).
+597. Fix broken DGA setviewport on SVGA servers (Jon Tombs).
+
+XFree86 3.1.2Ec (8 July 1996)
+596. XF86Setup fixes and updates (Joe Moss).
+595. Fix some build problems on Solaris due to the positioning of
+ <stdlib.h> includes in xconsole and xwd (William Austin).
+594. Fix a make problem in xfree98/vga16/drivers (Takaaki Nomura).
+593. Add some minor features from ISO 6429 to xterm (Thomas E. Dickey).
+592. Fix for SiS clock programming, and implement HW cursor for SiS
+ (Alan Hourihane).
+591. XInput support for SummaSketch tablets (Steven Lang).
+590. Improve the startup of the Wacom driver (Frederic Lepied).
+589. Fix an XInput bug with extended events reporting the wrong number
+ of valuators (Frederic Lepied).
+588. Fix xterm's utmp usage for Solaris (Christos Zoulas).
+
+XFree86 3.1.2Eb (30 June 1996)
+587. Fix MMIO setting which causes problems with Trio64V+ cards in machines
+ with PCI SCSI controllers (Harald Koenig).
+586. Auto-select the ICD2061A for Diamond Stealth 64 VRAM cards (when
+ a Diamond BIOS, Bt485 and S3 964 are all detected).
+585. Fix a problem with the VGA16 server when Chipset "generic" is specified.
+584. Fix twm/gram.y and fonts/PEX/to_wfont.y problems that show up when
+ using bison-1.25 (Matthieu Herrb).
+583. Move the beta expiry check code into a separate file, and add a command
+ line option to allow the expiry date to be extended when a key is
+ provided.
+582. Preliminary 24bpp packed support for some S3 cards (Harald Koenig).
+581. Add 24bpp (packed pixel) support for cfb (cfb24), and the required
+ hooks for using it with the SVGA server (Shigehiro Nomura and
+ NoZomi Ytow).
+580. Fix some xterm background colouring problems (Thomas E. Dickey).
+579. Allow the PCI burst to be separately turned on/off for read and write
+ for the TGUI chips (Alan Hourihane).
+578. vgaHW.c fix (NoZomi Ytow).
+577. Fix for Mach64 block_write problems introduced in 3.1.2E (Kevin Martin).
+576. An alternate fix to the Makedirectories() rule, which causes only
+ one 'sh -c' to be used (Marc Aurele La France).
+575. Some sanity checks for the trident driver (Alan Hourihane).
+574. Another HSkew fix for the ATI SVGA driver (Marc Aurele La France).
+573. Add 256 colour support to the SiS driver (Alan Hourihane).
+572. Fix a stdlib.h -related problem in xwd (Joe Moss).
+571. Fix a stdlib.h -related problem in xfs/os/utils.h (Takaaki Nomura).
+570. Add a new Xserver configuration utility -- XF86Setup (Joe Moss).
+569. Remove the "-noscale" flag from the Xserver usage message (Joe Moss).
+568. Fix session handling of xdm for *BSD (Peter Wemm).
+
+XFree86 3.1.2Ea (10 June 1996)
+567. xf86config.c update in preparation for the XF86Setup utility (Joe Moss).
+566. Fix some Mach64 problems in the SVGA ati driver (Marc Aurele La France).
+565. Fix the xf86GetClocks prototype (Marc Aurele La France).
+564. Fix MakeDirectories rule (Stephen Hocking).
+563. By default, don't change PCI burst settings for TGUI (Alan Hourihane).
+562. Fix interlaced modes for the SVGA ali driver (Thomas Graichen).
+561. xfs updates for OS/2 (Sebastien Marineau).
+560. Fix some TGUI problems introduced in 3.1.2E (Alan Hourihane).
+559. Fix problems with scanpci on NetBSD (Michio "Karl" Jinbo).
+558. Some cleanups/removal of compiler warnings (Christos Zoulas).
+557. Patch for compiling on BSD/OS 2.1 (Mike Bernson).
+556. Turn off the Xaw3d arrow scrollbar support in xterm by default (it
+ causes xterm to suck CPU), and make it an option/resource
+ (Thomas E. Dickey).
+555. Reinstate the "no_program_clocks" for TGUI9440 chips (Alan Hourihane).
+554. XInput updates, including motion history support for the joystick and
+ elo devices, removing auto link speed detection for the elo -- it is
+ now set with the LinkSpeed XF86Config option, and added acceleration
+ handling for relative devices (Patrick Lecoanet and Frederic Lepied).
+553. Add VGA16 support to the ET3000 driver (Thomas Graichen).
+552. Fix for first button click in a xterm being mistaken for a double
+ click (Kaleb Keithley).
+551. Fix for server crash on Alpha when using the logo screen saver
+ (Manabe Takashi).
+550. xkb datafile updates, including more/better European keymaps, pc102
+ geometry and keycodes (Stuart Anderson, courtesy Metro Link).
+549. Fix xterm problem on *BSD (VMIN initialisation) that would cause
+ rlogin to fail (Matthieu Herrb).
+548. Fix problems when a dynamic module is specified with an absolute path.
+
+XFree86 3.1.2E (13 May 1996)
+547. Fix Trio64V+ problem with DAC entry#255 for color mode 0 (1 8bpp/DCLK)
+ by only using color mode 8 (2 8bpp pixel/DCLK, CR67=10) (Harald Koenig).
+546. Added options to the S3 server to slow down DRAM and EDO DRAM access
+ (Harald Koenig).
+545. Add inlined assembler code to do unaligned access on Alphas
+ (Harald Koenig).
+544. Fix a font corruption problem for Alphas in cfb (Harald Koenig).
+543. Fix sample Xcms.txt colour entries (Harald Koenig).
+542. Fix some problems building the a.out DLL version of libX11
+ (Harald Koenig).
+541. OS/2 updates (Sebastien Marineau).
+540. Fix(?) server crash on keyboard input when using DGA with XKB disabled.
+539. Install xterm termcap/terminfo files in lib/X11/etc for all OSs, not
+ just SYSV/SVR4.
+538. Convert egc_asm.s to the portable assembler format so it can be built
+ on SVR4 (Takaaki Nomura).
+537. Fix Mach64 ghostview scrollbar problem. This may also fix some font
+ corruption problems seen in Netscape (Kevin Martin).
+536. Fix Mach64 ol[v]wm icon problem (Kevin Martin).
+535. Add Mach64 cursor in doublescan mode -- this still has problems
+ (Kevin Martin).
+534. Add Mach64 doublescan mode for low resolution modes (only works so far
+ for the VT chip) (Kevin Martin).
+533. Fix Mach64 264VT support in the Mach64 server (Kevin Martin).
+532. Update the xterm termcap and terminfo descriptions (Thomas E. Dickey).
+531. Fix an xterm bug where XmbLookupString is used even though an
+ IM/IC isn't open/used (Kaleb Keithley).
+530. Fix a clock roll-over bug in xterm (Kaleb Keithley).
+529. Add some new locale aliases used by Solaris 2.5 and some other OSs
+ (Kaleb Keithley).
+528. Fix some potential data overruns with long environment variables in
+ libX11 and libXt which could create security holes in suid root
+ programs like xterm (Kaleb Keithley).
+527. Fix makedepend's handling of long typed defines (eg, 1993L)
+ (Kaleb Keithley).
+526. User alloca on UnixWare (Kaleb Keithley).
+525. Improved fix for removing compiled keymap files (Kaleb Keithley).
+
+XFree86 3.1.2Dj (12 May 1996)
+524. Disable POSIX_TERMIOS in xterm for FreeBSD versions prior to 2.1.
+523. Add a document for XInput (Frederic Lepied).
+522. Have the server remove the compiled keymap file when shutting down
+ (Joe Moss).
+521. Fix problem of XkbListComponents() not listing anything in
+ subdirectories (Joe Moss).
+520. Fix passing of button events for the Joystick (Frederic Lepied).
+519. NetBSD documentation updates (Matthieu Herrb).
+
+XFree86 3.1.2Di (11 May 1996)
+518. Modify xterm to revoke() its pty before opening it on *BSD
+ (Matthieu Herrb).
+517. Fix xterm not sending SIGHUP to its children when it dies on *BSD
+ (Matthieu Herrb).
+516. Fix some problems that were preventing extended Mouse devices from
+ working.
+515. Add "Port" as a synonym for "Device" in the Pointer section.
+514. Fix Makefile dependencies for dynamically loaded XInput modules.
+513. Fix screen saver blanking for Mach64 CT at 16bpp and 32bpp.
+512. Remove the directory components from the XKB parameters in the sample
+ XF86Config files, and from the XF86Config files generated by xf86config.
+511. Fix Mach64 memory mapping bug introduced in 3.1.2Dg.
+
+XFree86 3.1.2Dh (10 May 1996)
+510. Fix for some image problems on VGAWonder V3, V4 and V5 adapters
+ (Marc Aurele La France).
+509. Enable TERMIOS for xterm on Linux/Alpha (Kazushige Goto).
+508. Make the "clkdiv2" option a valid option for most accelerated
+ servers (Koen Gadeyne).
+507. Unified the global function names to use the xf86 prefix in the XInput
+ code (Frederic Lepied).
+506. Add support for motion history for extended input devices (implemented
+ for the Wacom driver) (Frederic Lepied).
+505. Oak documentation updates (Jorge Delgado).
+504. Fix compiler warnings introduced in 3.1.2Dg (Thomas E. Dickey).
+503. OS/2 updates (Sebastien Marineau and Holger Veit).
+502. Fix formatting of xtrans error messages (Holger Veit).
+501. S3 image fixes for Alpha (Harald Koenig).
+
+XFree86 3.1.2Dg (6 May 1996)
+500. X98 updates for PANIX(98) support (X98 core team).
+499. Allow halved clocks to be used with the VGA servers (Koen Gadeyne).
+498. Use same xlfd value rounding for alpha as for i386 (Harald Koenig).
+497. Support for Linux/Alpha (Jay Estabrook, Craig Ruff, Harald Koenig
+ and others?).
+496. Fix autorepeating modifier keys (Kaleb Keithley).
+495. Fix nonMuxMaxClock for S3 864/868 (Harald Koenig).
+494. Make sure that imake, xinit and the XFree86 servers don't inherit
+ a SIGCHLD signal handler of SIG_IGN (Marc Aurele La France).
+493. Fix default HSkew for ATI 28800 cards (Marc Aurele La France).
+492. Fix typo in SuperProbe/PCI.c (Holger Veit).
+491. Colour xterm fixes -- fixes inner border being painted with the wrong
+ colour (Thomas E. Dickey).
+490. More X server prototyping fixes -- mostly for Xserver/Xext
+ (Thomas E. Dickey).
+489. DGA support for the P9000 server (Erik Nygren).
+
+XFree86 3.1.2Df (15 April 1996)
+488. Changes to xf86Config.c in preparation for XF86Setup sharing this
+ code (Joe Moss).
+487. Prevent SuperProbe from falsely detecting non-VGA PCI devices.
+486. Config/Imake support for building LBX (Holger Veit).
+485. OS/2 updates (Holger Veit and Sebastien Marineau).
+484. Add support for the I128 8MB board with the IBM528 RAMDAC (Robin Cutshaw).
+483. Add prototyping for Xserver/dix, and fix copyright notices in new
+ header files (Thomas E. Dickey).
+482. Replace the vsync wait delays in the ICD2061A code with a 20ms usleep
+ (Harald Koenig).
+481. Ensure that the S3 server clears the screen to black even when
+ '-flipPixels' is used, and erase the S3 HW bug test patterns after
+ completing the tests (Harald Koenig).
+480. Fix incorrect S3 HW cursor offset after VT switching (Harald Koenig).
+479. Fix SuperProbe's memory probing for S3 cards with more than 4MB,
+ and add detection for the TVP3030 RAMDAC (Harald Koenig).
+478. Fix some S3 TVP3026 problems introduced in 3.1.2Dc (Harald Koenig).
+477. Add support to the S3 server for the ELSA Gloria-8 card (except the
+ GLint 300SX 3D chip) (Harald Koenig).
+476. Fix for POSIX termios support in xterm (Matthieu Herrb).
+475. Add -li386 to ServerExtraSysLibs for NetBSD (Matthieu Herrb).
+474. Fix problems when XINPUT isn't defined (Kaleb Keithley).
+473. Fix for TGUI 9320 LCD support (Alan Hourihane).
+472. Imakefile updates for X98, and PCI detection added for TGUI9320
+ (Michio "Karl" Jinbo).
+
+XFree86 3.1.2De (31 March 1996)
+471. Change the default HSkew calculation (Marc Aurele La France).
+470. Add detection of the ATI 264VT, 264VT2 and 264GT to the ati driver,
+ SuperProbe, scanpci, and the Mach64 server (Marc Aurele La France).
+469. Fix the W32 server's reporting of the bits/rgb resolution (Koen Gadeyne).
+468. Add ICD2061A clockchip support to the W32 server (Koen Gadeyne and
+ Peter Chang).
+467. Add support for PowerWindow968, Cyber9320 and TGUI9680 (X98 core team).
+466. Fixes for XF98_NEC480 on PANIX-PC98 (X98 core team).
+465. Remove X98 style version info from the server startup messages
+ (X98 core team).
+464. Improve stability of the XF98_PWSK server (X98 core team).
+463. Add some missing XFreeXDGA #ifdefs (Kaleb Keithley).
+462. Fix problem of the XKB keymaps not getting loaded when using the
+ Xqueue keyboard driver on SVR4 (Joe Moss).
+461. Add POSIX termios support to xterm, and use it for BSD Net/2
+ derived systems. This removes the need for kernels on those systems
+ to be compiled with COMPAT_43 in order to run xterm (Matthieu Herrb).
+460. Update the I/O enabling in the X servers and SuperProbe for
+ NetBSD-current (Matthieu Herrb).
+459. Save the S3 cursor colour stack (CR4A/CR4B) (Harald Koenig).
+458. Add macro button support to the Wacom driver, and handle more than
+ six valuators to post events (Frederic Lepied).
+457. Support for the Miro Magic S4 (S3 928 + Bt485). A known problem is
+ that switching between pixmux an non-pixmux modes doesn't work
+ (Bernd Strobel).
+456. Fix banked mono for the SiS driver (Alan Hourihane).
+455. X server prototype cleanups and fixes, particularly in the Xi code
+ (Thomas E. Dickey).
+454. Possible fix for tvga9000 and tvga8900d problems (Alan Hourihane).
+
+XFree86 3.1.2Dd (17 March 1996)
+453. Include R6.1 public patch 1.
+452. Fix incorrect type in SuperProbe/PCI.c (Thomas E. Dickey).
+451. Fix a memory leak in xterm when switching fonts (Thomas E. Dickey).
+450. Fixes for mouse problems introduced in 3.1.2Dc (Joe Moss,
+ Michael Rohleder, Takaaki Nomura).
+449. Man page for the VidMode extension (Joe Moss).
+448. Modify xterm to work properly with Xaw3d's arror scrollbars (based on
+ Kaleb Keithley's R5 patch).
+447. Add tilt report for the Wacom device (Frederic Lepied).
+446. Deal with DAC/clock discrepancy for Mach64 in the ati driver
+ (Marc Aurele La France).
+445. Reduce warnings in the ati driver when compiling with 'gcc -Wall'
+ (Marc Aurele La France).
+444. Fix recognition of ATI extended VGA register I/O port number on some
+ Mach32 Mach64 PCI adapters in the ati driver (Marc Aurele La France).
+443. Add nested prototypes to xf86_HWlib.h (Marc Aurele La France).
+442. Fix typo in IBM RGB514 programming for the Mach64 (Marc Aurele La France).
+441. Fix a problem with the Mach64 server incorrectly using Block I/O mode
+ on some cards.
+
+XFree86 3.1.2Dc (11 March 1996)
+440. XKB updates from recent XC fix-tracker.
+439. Fix freeing a random pointer in the module code when an absolute
+ path is given (Thomas E. Dickey).
+438. Updates to Ti3026 PLL parameter limits (Harald Koenig).
+437. Support for ELSA Winner 2000PRO/X rev G (Harald Koenig).
+436. Fix 'make clean' problems for PC98 (Takefumi Tsukada).
+435. OS/2 updates (Holger Veit).
+434. Remove DEVINTPTR ifdefs by renaming the entrypoints of the affected
+ functions (Thomas E. Dickey).
+433. Fix for handling of long version strings in beta servers (Harald Koenig).
+432. Some XFree86-Misc cleanups (Joe Moss).
+431. Add an extended input device supporting mouse protocols. This shares
+ code with the core mouse (Frederic Lepied).
+430. Fix the behaviour of ANSI colours in xterm when reverse video is used,
+ and some other xterm updates (Thomas E. Dickey).
+429. Fix SEGV with ark driver when no Ramdac is given in the XF86Config.
+428. Avoid retrace wait for S3 HW cursor when DGA is active (Jon Tombs).
+
+XFree86 3.1.2Db (5 March 1996)
+427. Fix a problem where hw cursors get recoloured incorrectly.
+426. Fix another possible Trio32 font cache problem (Harald Koenig).
+425. Another S3 968 dashed line fix (Harald Koenig).
+424. Fix RecolorCursor problems for S3 hw cursors in RAMDACs and for
+ sw cursor (Harald Koenig).
+423. Add a Japanese version of the FreeBSD README (Takefumi Tsukada).
+422. Fix for problems with XF86_WSNA server (X98 core team).
+421. Add a mapping for Pointer_EnableKeys to the XKB symbols/us map (Joe Moss).
+420. XC patch for XKB.
+419. Add code to the vidmode and misc extensions to print details of mode
+ keyboard and mouse setting changes (Joe Moss).
+418. Add code to recognise extra keys on Digital LK201 PC keyboards
+ (Basil Duval).
+417. Don't include Multibuffer support in xdpyinfo when it isn't included
+ in the X servers (Joe Moss).
+416. Fix core dump when XInput debugging is enabled (Frederic Lepied).
+415. Fix implicit grab problem with Wacom input device (Frederic Lepied).
+414. Add an "allowMouseOpenFail" XF86Config and command-line option to allow
+ the server to be started when no mouse can be initialised (Joe Moss).
+413. Updates for parallel make (Robin Cutshaw).
+412. Update xf86config for the I128 server (Robin Cutshaw).
+
+XFree86 3.1.2Da (3 March 1996)
+411. Add a preinst.sh script.
+410. Documentation updates.
+409. Fix for Linux/ELF rules (H.J. Lu).
+408. Always used extended I/O for SYSV/SVR4. This is required now for
+ ISC (Michael Rohleder).
+407. Fix BootstrapCFlags in sun.cf for Solaris x86.
+406. Solaris fixes for SuperProbe and the Mach64 server (Robin Cutshaw
+ and James Hawtin).
+405. Wacom bug fix (Frederic Lepied).
+404. Add support for writing to stdout for gccmakedep, which is required
+ for NetBSD and FreeBSD (Matthieu Herrb).
+
+XFree86 3.1.2D (24 February 1996)
+403. Fix xterm SEGV if it cannot open an input method (Manabe Takashi).
+402. Update Linux/ELF SharedLibraryTarget() (H.J. Lu).
+401. Add a BinUtilsVersion parameter for Linux, and modify ExtraLoadFlags for
+ Binutils versions 2.6.0.7 and later (H.J. Lu).
+400. Set CplusplusCmd to 'c++' for Linux, set YaccCmd to byacc when
+ USE_BYACC is defined, and remove $(CBRT) from ServerExtraSysLibs
+ (H.J. Lu).
+399. Fix installation of some SCO rules/cf files (H.J. Lu).
+398. Modify imake.rules to include Motif rules/tmpl files when BUILD_MOTIF
+ is defined (H.J. Lu).
+397. Fix argument passing typo in SuperProbe (Thomas E. Dickey).
+396. Update Cards database (Joe Moss).
+395. Documentation updates (Holger Veit, Joe Moss).
+394. Fix xset/Imakefile for OS/2 (Holger Veit).
+393. Don't use the index/rindex macros with arguments for non-ANSI compilers.
+392. Uncomment xf86cleanpci() in vga.c.
+
+XFree86 3.1.2Ch (22 February 1996)
+391. Fix xset linking for Linux a.out (Harald Koenig).
+390. Disallow interlaced modes with the SiS driver (Alan Hourihane).
+389. Change SCO interface to allow for a 128K VGA aperture
+ (Marc Aurele La France).
+388. Add support to the ati driver for Mach64 cards with a base address
+ other than 0x2EC (Marc Aurele La France).
+387. Introduce a new XF86Config mode option called HSkew which sets bits
+ 0x60 of CRTC[3] (Marc Aurele La France).
+386. Fix colour map problem on VGA Wonder V3 boards (Randall Hopper,
+ Marc Aurele La France).
+385. Allow multiple "-verbose" command line flags to increase the verbosity
+ level (Marc Aurele La France).
+384. Modify xf86scanpci() so that it will be able to deal with multi-headed
+ servers in the future, add an xf86cleanpci() function to allow
+ the PCI data to be freed after use, allow xf86scanpci() to be called
+ more than once, and fix a problem with it not always returning with I/O
+ permissions disabled (Marc Aurele La France).
+383. SuperProbe updates for Mach64 and PCI (Marc Aurele La France).
+382. OS/2 updates (Holger Veit).
+381. Keyboard/mouse parameter changes with XFree86-Misc can now be disabled,
+ and these are only allowable by default for local client connections
+ (Joe Moss).
+380. Only check/change relevant parameters with XFree86-Misc (Joe Moss).
+379. Add new/better protocol error messages for XFree86-Misc (Joe Moss).
+378. Man page for the XFree86-Misc library functions (Joe Moss).
+377. Add detection of the SiS 86C202 and 86C205 to SuperProbe and the SiS
+ driver (Alan Hourihane).
+
+XFree86 3.1.2Cg (20 February 1996)
+376. Modify the handling of the XF86Config xkb options to allow the
+ -xkbmap server flag to work (it overrides what is in the XF86Config).
+ The XKBKeyMap XF86Config setting will now work too, and it overrides
+ any other XKB settings given there.
+375. Fix for parts of a VT switch sequence getting passed to clients when
+ XKB is enabled.
+374. NetBSD.cf update (Matthieu Herrb).
+373. Fix various cases of nested comment delimiters (Thomas E. Dickey).
+372. Config additions/updates for CLIX and for HP with GCC2 (Thomas E. Dickey).
+371. Fix RecolorCursor for HW cursor in AGX, Mach32, Mach64, P9000, I128,
+ Cirrus, Ark and Trident server/drivers (untested).
+370. Fix xinit problem introduced in 3.1.2Cf.
+369. S3 dashed line fix, including an option "s3_968_dash_bug" to enable
+ a workaround for a 968 bug. There is code to auto-detect this problem,
+ so the option shouldn't need to be specified explicitly (Harald Koenig).
+368. Fix for RecolorCursor problem with S3 HW cursors. This problem is
+ also present in other accel servers (Harald Koenig).
+367. Trident linear mode updates (Alan Hourihane).
+
+XFree86 3.1.2Cf (19 February 1996)
+366. S3 update for ELSA Winner1000 cards with the AT&T 20C409 Ramdac
+ (Dirk Hohndel).
+365. PC98 updates, including a new xkbcomp/compat/pc98 description
+ (X98 core team).
+364. SiS driver updated (Alan Hourihane).
+363. Work around an S3 968 dashed line bug (Harald Koenig).
+362. OS/2 updates, including a new OS/2 README (Holger Veit and
+ Sebastien Marineau).
+361. ISC documentation updates (Michael Rohleder).
+360. NetBSD documentation updates (Matthieu Herrb).
+359. Trident driver updates (Alan Hourihane).
+
+XFree86 3.1.2Ce (18 February 1996)
+358. PC98 documentation (X98 core team).
+357. Fix a bug in the handling of the Wacom eraser as a third button
+ (Frederic Lepied).
+356. Enable the Joystick driver for NetBSD (using a port of the FreeBSD
+ joystick driver to NetBSD) (Matthieu Herrb).
+355. Allow XInput dynamic loading for NetBSD (Matthieu Herrb).
+354. Use the FreeBSD way of making dependencies in .depend files for NetBSD
+ (Matthieu Herrb).
+353. Change the XInput Dynamic module loading to allow a ModulePath to
+ be specified in the Files section of the XF86Config, and move the
+ list of loadable modules into a Modules section in XF86Config
+ (Frederic Lepied).
+352. Fix some glitches in xterm's colour behaviour (Thomas E. Dickey).
+351. Modify the xf86config utility to allow XKB information to be entered
+ (Holger Veit).
+350. Fix Xserver prototyping problems (Thomas E. Dickey).
+349. Modify PCI code for PC98 (X98 core team).
+348. Add PC98 server for WSN-A2F (X98 core team).
+347. XKB description files for a Japanese 106 key keyboard (Takefumi Tsukada).
+346. Probe the VGA sis driver before the the cl64xx to avoid mis-probing
+ (Alan Hourihane).
+345. Modify XF86VidModeGetAllModeLines() to allocate memory in one chunk
+ so it can be freed later by the client (Joe Moss).
+344. Fix incorrect handling of S3RefClock when specified in the XF86Config
+ (Harald Koenig).
+343. Clean up linear mode setup in the Trident Driver (Alan Hourihane).
+342. Disable PCI burst mode by default for the Trident driver
+ (Alan Hourihane).
+341. Fix a problem restoring 16bpp modes with the Mach32 server on OS/2
+ (Sebastien Marineau).
+340. Fix a problem that was preventing the tgui driver from working on
+ some TGUI9440 cards (Alan Hourihane).
+
+XFree86 3.1.2Cd (12 February 1996)
+339. Fix library ordering for Linux a.out for xset, xdpyinfo and xvidtune
+ (Harald Koenig).
+338. Add a version check to the XInput dynamic modules (Frederic Lepied).
+337. Fix keyboard LED initialisation. This usually shows up as a problem
+ on *BSD where the NumLock LED is on when the server is started.
+336. Update Linux DLL jump files (Harald Koenig).
+335. PC98 updates, including XF98Conf, and the XKB nec geometry description
+ (X98 core team).
+334. Automatically treat the PS/2 protocol the same as the busmouse protocol
+ on NetBSD (since that's how NetBSD's PS/2 driver works).
+333. Add XInput dynamic loading support for FreeBSD 2.x.
+332. Fix problem with XInput on non-Linux/ELF systems.
+331. xterm fixes, including updates to allow building on R5
+ (Thomas E. Dickey).
+330. Add to the docs a file containing a list of PC98 cards that are
+ supported (X98 core team).
+329. Documentation updates for xterm (Thomas E. Dickey).
+328. Disable the TGUI HW cursor by default (Alan Hourihane).
+327. Add PCI support to SuperProbe (Alan Hourihane).
+
+XFree86 3.1.2Cc (10 February 1996)
+326. Merge in final form of R6.1.
+
+XFree86 3.1.2Cb (9 February 1996)
+325. XC fix-trackers to seq-4114 (mostly XKB).
+324. Xlib prototyping improvements/fixes (Thomas E. Dickey).
+323. OS/2 updates (Holger Veit and Sebastien Marineau).
+322. Allow the eraser button of a wacom stylus to act as a third button
+ if the WacomEraser device isn't enabled (Frederic Lepied).
+321. Allow XInput device support to be dynamically loaded. This is for
+ Linux only so far (Frederic Lepied).
+320. Major updates to the ati driver, including support for the newer
+ Mach64 chips and clocks, preliminary support or pre- VGAWonder V3
+ adapters and generic VGA. The default chipset name has been changed
+ back to "ati" from "vgawonder" (Marc Aurele La France).
+319. Properly implement xf86DisableIOPrivs and xf86Disable/EnableInterrupts
+ for Linux (Marc Aurele La France).
+318. ATI doc updates (Marc Aurele La France).
+317. Remove ati.test.c, and move the functionality into the ati driver
+ (Marc Aurele La France).
+316. Remove the "undoc_clocks" option (Marc Aurele La France).
+315. Make all I/O ports in compiler.h unsigned short, and all values
+ unsigned char/short/int (Marc Aurele La France).
+314. Updates Mach64 probing for SuperProbe (Marc Aurele La France).
+313. Make the Linux ELF/a.out default build the same as the system default
+ (Marc Aurele La France).
+312. Delete unneeded cmd/sh files in xfree98/vga256 (X98 core team).
+311. Fix problems with XF98_WABS (X98 core team).
+310. update xfree98/etc/Imakefile, and remove the *.sed files and their
+ related imake rules (X98 core team).
+309. XF98_WABEP server added (for Melco WAB-EP) (X98 core team).
+308. Trident driver updates including some clock probing fixes
+ (Alan Hourihane).
+307. Fix 2MB Trio64 display error problem due to incorrect parameter
+ calculation (Harald Koenig).
+
+XFree86 3.1.2Ca (5 February 1996)
+306. Improve S3 Diamond BIOS detection.
+305. XC fix-trackers to seq-4104 (mostly a new XKB snapshot).
+304. Don't include the compaq driver by default -- it is broken.
+
+XFree86 3.1.2C (31 January 1996)
+303. Allow the mouse parameters (except the device) to be changed with
+ the XFree86-Misc extension. This causes a close/reopen of the the
+ device (Joe Moss).
+302. Fix problem introduced with the server lock code which causes a delay
+ at startup.
+301. Add some checking for the mouse baud rate given in the XF86Config
+ (Joe Moss).
+300. Fix for the bright left border problem with some Trio64V+ cards
+ (Harald Koenig).
+299. PC98 XKB support files (Kaleb Keithley, Toyonori Fujiura).
+298. Update German XKB symbols (Thomas Mueller).
+
+XFree86 3.1.2Bo (30 January 1996)
+297. Updates for XF98Conf.cpp (Takefumi Tsukada).
+296. Add an XF86Config option for disabling XKB (Kaleb Keithley).
+295. Further OS/2 support updates, including a working X server
+ (Sebastien Marineau and Holger Veit).
+294. Documentation update for PC98 (Takefumi Tsukada).
+293. Improved prototyping for Xlib.h (Thomas E. Dickey).
+292. xterm updates, including mods to allow it to be built with X11R5
+ (Thomas E. Dickey).
+291. Some XFree86-Misc extension updates (Joe Moss).
+290. GlidePoint updates (Jean-Christophe Hugly).
+289. Add XInput knowledge to xdpyinfo, and update the output format of
+ xsetpointer (Frederic Lepied).
+288. NetBSD updates for scanpci now that console.h isn't included any more
+ (Matthieu Herrb).
+287. XC fix-trackers to seq-4086 (xsm updates).
+286. xkb symbol addition for European-style keyboards (Kaleb Keithley).
+285. Possible fix for security problem related to the X server's lock files.
+
+XFree86 3.1.2Bn (28 January 1996)
+284. Fix reporting of the ATI68860 Rev C Ramdac with the Mach64 server.
+283. Support for ALPS GlidePoint. A tap on the pad is treated as a fourth
+ button (Jean-Christophe Hugly).
+282. Improved XKB support for XFree86 servers (Kaleb Keithley).
+281. Prevent mode switching and VT switching when DGA is active (Jon Tombs).
+280. Don't include for syscons with NetBSD by default.
+279. NetBSD doc updates (Matthieu Herrb).
+278. XFree86-Misc extension updates, including more sanity checking (Joe Moss).
+277. Fix some length calculations in libXxf86vm (Joe Moss).
+
+XFree86 3.1.2Bm (26 January 1996)
+276. Remove (for now) the vertical retrace wait in the S3 SetViewPort.
+275. Updates TGUI support for SuperProbe (Alan Hourihane).
+274. TGUI driver updates (Alan Hourihane).
+273. Major updates to OS/2 support (Holger Veit).
+272. Update xdpyinfo for the latest XFree86-Misc changes, and update xset
+ to allow the keyboard repeat parameters to be changed (Joe Moss).
+271. Add functions to the XFree86-Misc extension to allow getting and
+ setting mouse and keyboard configuration (Joe Moss).
+270. Remove the low ICS5342 clock limit (Harald Koenig).
+269. Add an "XF98Config.cpp" from which a sample config file suitable for
+ the X98 servers is generated (X98 core team).
+268. Update Imakefiles under hw/xfree98 (X98 core team).
+267. Fix for make dependency problem with BSD make and the XFree86 drivers
+ subdirectories (Matthieu Herrb).
+266. X Consortium fix-trackers to seq-4084 (mostly XKB and doc updates).
+265. Allow the XInput debug level to be set from the XF86Config
+ (Frederic Lepied).
+
+XFree86 3.1.2Bl (21 January 1996)
+264. Fix xterm IM problem if *inputMethod == "" (Kaleb Keithley).
+263. Xvfb fix for systems that have mmap, but not the MS_ASYNC flag for
+ msync().
+262. XC fix-trackers to seq-4060 (some XKB and config updates).
+261. 6-bit/rgb fix for the I128 server (Robin Cutshaw).
+260. Update hw/xfree98 Imakefiles (Takefumi Tsukada).
+259. Add a GetAllModeLines function to the VidMode extension, and modify
+ xdpyinfo to use it (Joe Moss).
+
+XFree86 3.1.2Bk (17 January 1996)
+258. Don't allow DGA operations which affect the server when it isn't on
+ the active screen.
+257. Have XFree86-Misc report the power saver times in seconds rather
+ than milliseconds (to be consistent with XGetScreenSaver).
+256. Modify xset to allow setting/viewing the power saver parameters via
+ the XFree86-Misc extension.
+255. Modify the VidMode extension to disallow both mode switches and
+ the locking/unlocking of mode switching when DontZoom has been set
+ in the XF86Config.
+254. Only allow the DGA extension to accept local connections.
+253. Fix Home/End key support in xterm (Thomas Mueller).
+252. Add support for VT200 compatible cursor on/off to xterm (Thomas Mueller).
+251. Add support for the XFree86-Misc extension to xdpyinfo (Joe Moss).
+250. VidMode/xvidtune updates (Kaleb Keithley).
+249. XC fix-trackers to seq-4055 (mostly XKB fixes).
+248. Fix link ordering of new libraries (Thomas Mueller).
+247. Add some missing XKB #defines (Thomas Mueller).
+246. Fix typo in include/extensions/Imakefile (Thomas Mueller).
+
+XFree86 3.1.2Bj (16 January 1996)
+245. Remove the XExExt library, and replace it with individual libraries
+ for each extension.
+244. Remove the GetSaver/SetSaver functions from the VidMode extension
+ and add them to a new extension: XFree86-Misc.
+243. Cleanup VidMode extension code -- removing "vgahelp" references
+ (Kaleb Keithley).
+242. Allow the write functions of the VidMode extension to be disabled
+ for non-local clients (default), and all clients (Kaleb Keithley).
+241. XC fix-trackers to seq-4052 (new XKB snapshot).
+240. README.S3 updates (Paul Gortmaker).
+239. Do framebuffer address scan for all VLB Trio64 cards, not just those
+ with > 1MB.
+238. Fix typo in trident driver (Alan Hourihane).
+237. Modify the I128 server to use xf86scanpci() rather than its own PCI
+ probe (which didn't work for PCI config type 1 boards) (Robin Cutshaw).
+
+XFree86 3.1.2Bi (14 January 1996)
+236. Enable dynamic allocation of XInput devices to allow for multiple
+ instances of the same device type. The Joystick2 device has been
+ removed (Frederic Lepied).
+235. Fix typo in a recent xconsole fix (Michael Rohleder).
+234. Add POSIX build config option for ISC, and change the Vendor name to IUS
+ (Interactive Unix System) (Michael Rohleder).
+233. Disable linear mode by default for non-PCI Trident cards (Alan Hourihane).
+232. Fix some compiler warnings in various parts of the source (Fred Appelman).
+231. Fix xterm compile problem with -DALLOWLOGGING (William Austin).
+230. Fix compile problem in resize for NetBSD (Matthieu Herrb).
+
+XFree86 3.1.2Bh (13 January 1996)
+229. Fix dga speed test problem when the bank size is less than 64k.
+228. Add DGA support to the Mach32 server (untested).
+227. Add SVGA-based servers for PC98 (Cirrus driver) (X98 core team).
+226. Update the Cirrus driver to use the vga PCI probe data (not tested).
+225. Include XC fix-trackers to seq-4035 (mostly fixes for Solaris 2.5
+ build problems).
+224. Update xdpyinfo to print some info about XKB (Joe Moss).
+223. Fix(?) problem some people see with vertical lines / black screens
+ with the Trident driver (Alan Hourihane).
+222. Update the Trident and SiS drivers to use the vga PCI probe data
+ (Alan Hourihane).
+221. Define SetTtyGroup for Linux (Kevin Martin).
+
+XFree86 3.1.2Bg (12 January 1996)
+220. Fix cursor colour for TGUI 9660/9680 (Alan Hourihane).
+219. LynxOS fix for xterm's resize (Thomas Mueller).
+218. Write beta marker file as the user's real uid rather than as root.
+217. Fix DGA for SVGA cards using banked memory, and enable it for most
+ SVGA drivers.
+216. Add a PCI probe to the VGA servers. The happens before the chipset
+ probes, and may be disabled with the "no_pci_probe" option.
+215. Add 16bpp support for Trident 8900D, and some cleanups (Alan Hourihane).
+214. Add install.linkkit target to the top level Makefile.
+
+XFree86 3.1.2Bf (11 January 1996)
+213. Xinput updates, including: improved error handling, "Screen" option
+ renamed to "ScreenNo" for consistency, new config options for the
+ Wacom tablet, update to the Linux joystick support, and a fix
+ for xsetmode (Frederic Lepied and Patrick Lecoanet).
+212. Fix core dump when exiting an X server started with XKB enabled.
+211. Update accelerated servers' use of miZeroClipLine().
+210. Include XC fix-trackers to seq-4031 (includes update of RECORD spec
+ to version 1.13, some Xlib and xterm fixes, and preliminary ISO Latin-2
+ compose support).
+209. Add code to detect the Trio32 BITBLT bug, and automatically enable
+ the workaround when it is detected (Harald Koenig).
+208. Final changes for POSIXized ISC build (Michael Rohleder).
+207. Define NO_READAHEAD for ISC in xconsole (Michael Rohleder).
+206. Fix(?) Xalloca.h problem on Solaris 2.5.
+205. Fix missing XFreeDGA #ifdef in change 187 (Kaleb Keithley).
+
+XFree86 3.1.2Be (10 January 1996)
+204. Fix build with BuildServersOnly set to YES (Takefumi Tsukada).
+203. Major xterm cleanup (including prototyping), and fixes to the colour
+ code (Thomas E. Dickey).
+202. PC98 EGC (16 colour) server added (X98 core team).
+201. Updates for LynxOS AT, including a workaround in the xkb clients
+ for the fact that stdin/out/err isn't a valid initialiser
+ (Thomas Mueller).
+200. Modify the dga test program to use GetTimeInMillis() (Tiago Gons).
+199. Fix merge problem in xconsole (Michael Rohleder).
+198. Initial changes to POSIXize the ISC build (Michael Rohleder).
+197. Fix a clash of symbols between libX11 and the X server's libxkb which
+ shows up when building Xnest on ISC (Michael Rohleder).
+196. Fix XKB merge problem in xf86Events.c (Kaleb Keithley).
+195. Complete the logging code in xalloc (Pascal Haible).
+
+XFree86 3.1.2Bd (8 January 1996)
+194. Fix a build problem when BuildServersOnly is set to YES.
+193. Clean up the InstallManPageLong() run for NetBSD (Takefumi Tsukada).
+192. Modify ForceSubdirs() rule for NetBSD and FreeBSD so that it works
+ with GNU make (Matthieu Herrb).
+191. Fix a Ti3026 clock problem that appears on SPEA 968+Ti3026 cards
+ (Harald Koenig).
+190. Fix TGUI 9440 HW cursor problems (Alan Hourihane).
+189. Fix problems with the TGUI 9660/9680 support (Alan Hourihane).
+188. Fix 256-colour interlace problem with TGUI cards (Alan Hourihane).
+187. Fix for text mode restore problem when the DGA extension has been
+ used with the SVGA server (Alan Hourihane).
+186. Set the Block I/O bit in the PCI userconfig register for Mach64 cards
+ that report an I/O address range.
+
+XFree86 3.1.2Bc (7 January 1996)
+185. Update lnxLib.rules for new GNU elf tools which look for libname.so
+ rather than libname.so.rev at link time (Helmut Geyer).
+184. Set default ProjectRoot back to /usr/X11R6.
+183. Include fix-trackers to seq-4024 (includes more a more recent XKB snap,
+ some record updates, and some config and Xlib updates).
+182. Fix some merge problems.
+
+XFree86 3.1.2Bb (6 January 1996)
+181. Merge in X11R6.1 beta.
+180. Fix problems with the ARK/ICS5342 clock programming (Leon Bottou).
+179. Fix problem with Mach64 CT cards that incorrectly appear to be using
+ block I/O.
+
+XFree86 3.1.2Ba (3 January 1996)
+178. Fix support for the old ET4000 in the et4000 driver.
+177. Fix problem with the SIS driver that can cause a server crash
+ (Alan Hourihane).
+176. Modify linux config for building a.out binaries on Slackware 3.0.
+175. Fix Linux Joystick compilation problems.
+174. Doc updates.
+
+XFree86 3.1.2B (28 December 1995)
+173. Fix a problem with the ARK/ICS5342 clock programming (don't know if this
+ completely fixes the clock programming problems).
+172. Don't do PCI probe in S3 server for PC98 (Takefumi Tsukada).
+171. Fix bank select problem with S3 911 cards when using DGA.
+
+XFree86 3.1.2Af (26 December 1995)
+170. Added README.DGA which gives a brief outline of the API for the DGA
+ extension. This should be converted to man pages.
+169. Added a simple standalone program (joycal) to get the Joystick
+ calibration coordinates.
+168. Modify the Joystick code to auto-detect the centre values at startup
+ if they are not given the XF86Config (this assumes that the Joystick
+ is centred when first enabled).
+167. Add XInput Joystick support for FreeBSD 2.x.
+166. Remove the strict membase checking for "orchid_p9000" in the P9000
+ server so that the correct membase can be specified for some other
+ types of P9000 cards which are not explicitly supported.
+165. Fix problem with the trident driver in the VGA16 server (Alan Hourihane).
+164. XF86Config(4/5) man page additions for the XInput section
+ (Frederic Lepied).
+163. Update xfree98/Imakefile (Takefumi Tsukada).
+162. Remove the "no_ti3026_curs" option again.
+161. Updates for xdpyinfo's Imakefile and the Xinput code for ISC
+ (Michael Rohleder).
+
+XFree86 3.1.2Ae (23 December 1995)
+160. A new document called QuickStart.doc which is a quick-start guide
+ to XFree86 setup (Joe Moss).
+159. Add a PCI probe to the S3 server, and use the membase value reported
+ when it is non-zero. This should help for some TrioV64+ cards.
+158. Move the DGA client-side helper functions into libXExExt.
+157. XInput support for XFree86. This includes device support for two
+ Joysticks (Linux-only so far), Wacom tablet (Wacom IV protocol only),
+ and Elographics touchscreen. Two utility programs are included.
+ xsetpointer can be used to make an extended device the core pointer
+ or to list the extended devices. xsetmode can be used to set a device
+ in absolute or relative mode (Frederic Lepied and Patrick Lecoanet).
+156. Workaround for a hardware bug in some S3 Trio32 revisions which causes
+ font corruption when using the font cache. This is currently enabled
+ with the "trio32_fc_bug" Option (Harald Koenig).
+155. Logging support for the internal xalloc code (Pascal Haible).
+154. Fix the S3 server's detection of the Trio64V+.
+153. Fix problems building the PC98 code (Takefumi Tsukada).
+152. LynxOS support for the DGA extension (Thomas Mueller).
+151. Fix a problem were XListFonts() can return fewer font names than
+ XListFontsWithInfo() (Manabe Takashi).
+150. Add knowledge of the XFree86-VidModeExtension, XFree86-DGA and LBX
+ extensions to xdpyinfo (Joe Moss).
+149. Add a benchmark function to the dga test program. It is activated with
+ the 'b' key (Koen Gadeyne).
+148. Change all servers to default to blackPixel = 0 and whitePixel = 1,
+ and allow this default to be swapped with the -flipPixels server
+ command line flag (Michael Rohleder).
+147. Restore the "no_ti3026_curs" option to the S3 server (Harald Koenig).
+146. Trident driver and documentation updates (Alan Hourihane).
+
+XFree86 3.1.2Ad (21 December 1995)
+145. Fix for incorrect usage of S3 PIX_TRANS writing (Takefumi Tsukada).
+144. PC98 support integrated into the main XFree86 source tree. The PC98
+ code gets built under xc/programs/Xserver/hw/xfree98 (Takefumi Tsukada
+ and the X98 team).
+
+XFree86 3.1.2Ac (17 December 1995)
+143. Modify the XDGA implementation in the server, and add support for it
+ to the Mach64 server. Also, XDGA is now enabled for all OSs since there
+ are now no OS-specific parts on the server side.
+142. Add "no_font_cache" and "no_pixmap_cache" options to allow the font
+ cache and pixmap cache/expansion to be disabled in the S3 and Mach64
+ servers.
+141. Fix positioning and shape of the Bt485 HW cursor for doublescan modes
+ in the S3 server.
+140. Fix positioning of the HW cursor for interlaced and doublescan modes
+ with the IBM RGB RAMDACs in the S3 server. The cursor shape still
+ isn't correct though (Trent Piepho and R.E. Wolff).
+139. HW cursor support for the Trident 9660/9680 and 9430 -- not tested
+ (Alan Hourihane).
+138. XFree86-DGA extension support for ISC SVR3 (Michael Rohleder).
+137. Fix for "XIOerror 11 (Resource temporarily unavailable)" errors while
+ running xterm on ISC (Michael Rohleder).
+136. Major Trident driver updates, including HW cursor for 9440, and
+ an option to use a set of fixed clocks instead of fully programmable
+ clocks for the TGUI chips (Alan Hourihane).
+135. I128 updates (Robin Cutshaw).
+134. Mach64 support for ATI Extended VGA register location on PCI
+ cards with block I/O (Kevin Martin).
+133. Clean up Mach64 software cursor support (Kevin Martin).
+132. "dac_8_bit" is now the default for supported RAMDACs in the Mach64
+ server. 6-bit mode can be forced with the "dac_6_bit" option
+ (Kevin Martin).
+131. Mach64 support for the ATI Graphics Pro Turbo 1600, including
+ 1600x1200 mode support (Kevin Martin).
+130. Mach64 support for the IBM RGB514 RAMDAC (Kevin Martin).
+129. Mach64 support for the GX-F (GX rev 3) (Kevin Martin).
+128. Add new options "w32_interleave_on" and "w32_interleave_off" to
+ the SVGA and W32 servers. They allow the desired mode to be
+ forced for W32i and W32p cards (Dirk Hohndel).
+127. Full STG1703 support for W32 server (Dirk Hohndel).
+126. Fix some incorrect prototype ifdefs in xf86.h (Kaleb Keithley).
+125. Modify xterm to call XtSetLanguageProc() rather than setlocale()
+ (Kaleb Keithley).
+124. Preliminary driver for the SIS 86C201 chipset (VGA2 and VGA16 only
+ so far) (Alan Hourihane).
+123. Change the Mach64 aperture mapping to map the video memory and
+ mmapped registers into two separate areas rather than mapping the
+ entire 8MB aperture range.
+122. Use an 8MB aperture for all but ISA Mach64 cards since most of the
+ newer Mach64 chips only support an 8MB aperture size.
+121. Fix typo in Mach64 server that was causing some RAMDACs to be incorrectly
+ detected.
+120. Fix aperture address detection for VLB Mach64 cards.
+119. In the Mach64 server, set RAMDAC to 20C408 if the 20C408 clock type
+ is detected, and same for STG1703.
+118. SIGWINCH support for xterm on ISC 4.x (Geoff Steckel).
+
+XFree86 3.1.2Ab (9 December 1995)
+117. FreeBSD support for the DGA extension.
+116. Split the DGA code out into a separate extension (called XFree86-DGA)
+ (Kaleb Keithley).
+115. Fix some compiler warnings when compiling on LynxOS (Thomas Mueller).
+114. Fix some byte swapping problems in XFree86-VidModeExtension
+ (Thomas Mueller).
+113. Add preliminary STG1703 support to the W32 server. No clock
+ programming and no pixmux yet (Dirk Hohndel).
+112. Add new options "pci_burst_on" and "pci_burst_off" to SVGA and
+ W32 server. They will allow to solve display problems on many
+ ET4000/W32p based cards (Dirk Hohndel).
+111. Add new clock selection scheme to SVGA and W32 server, so that
+ 32 clocks are used. The first 16 are the same as before, the
+ second 16 use CS3 (Dirk Hohndel and Koen Gadeyne).
+110. Add STG1703 detection to SuperProbe for ET4000/W32 based cards (Dirk
+ Hohndel).
+109. Fix extension version checking in xvidtune.
+108. Modify xterm to call XSupportsLocale() before initialising I18N
+ support (William Volkman).
+107. Fix S3 support for clocks up to 135MHz in 8 bpp for S3 868 cards
+ with ATT20C409 Gendac (e.g., Elsa Winner 1000AVI) (Dirk Hohndel).
+106. Fix S3 HW cursor handling for doublescan modes (Jon Tombs).
+105. Config and doc updates for NetBSD 1.1 (Matthieu Herrb).
+104. Preliminary (unaccelerated) I128 server code (Robin Cutshaw).
+103. Attempt to fix problem of Mach64 server mis-detecting the CH8398
+ RAMDAC.
+102. Modify the Mach64 server to use the membase address it reads from
+ the configuration registers.
+101. Fix cursor colour problem at 16, 32bpp with the Mach64 server.
+100. Support for the Mach64 CT.
+
+XFree86 3.1.2Aa (2 December 1995)
+ 99. Fix for xterm behaving badly when TERM is set to "vt100" (Joerg Wunsch).
+ 98. XDGA (direct graphics access) support added via the XFree86 VidMode
+ extension. This is primarily intended for games support. Currently
+ it is implemented only for Linux, and for the S3 and Cirrus drivers
+ (Jon Tombs).
+ 97. Fixes for Ti3026 loop clock calculation code (Dirk Hohndel).
+ 96. Detection and preliminary support for the Elsa Winner2000PRO/X-2,4 Rev.G
+ which has a S3-968, Ti3026, and ICS9161A clock chip. Clock doubling
+ doesn't work yet (Dirk Hohndel).
+ 95. Mach64 code cleanups and documentation updates (Kevin Martin).
+ 94. Fix Mach64 pixmap cache bug which resulted in xcalloc being called
+ with a negative size (Kevin Martin).
+ 93. The state of the AT&T20C408 is now saved/restored by the Mach64 server.
+ This should fix the dim screen problem when exiting from the server
+ (Kevin Martin).
+ 92. ClockChip and Ramdac can now be specified in the XF86Config for the
+ Mach64 server (Kevin Martin).
+ 91. Mach64 server ATI 18818/ICS 2595 clock chip programming now works
+ (Kevin Martin).
+ 90. Mach64 server now automatically programs a programmable clock chip
+ when present. This can be overridden with the "no_program_clocks"
+ Option. The "program_clocks" option has been removed (Kevin Martin).
+ 89. Initial changes to allow for integration of the I128 server
+ (Robin Cutshaw).
+ 88. Avoid defining __USLC__ for MP/RAS in compiler.h (Kaleb Keithley).
+ 87. If the server can't find an XF86Config file, print out the files it
+ tried to open (Joe Moss).
+ 86. Fix(?) display centering for the Cirrus 754x.
+ 85. Fix text mode clock problem in ET4000/W32 server (Koen Gadeyne).
+ 84. Remove the "-noscale" flag from the Xserver and xfs since it has
+ been obsoleted by the ":unscaled" fontpath attribute.
+ 83. Remove the RepeatedMiddle mouse option because it doesn't work
+ properly (Jon Tombs).
+ 82. Remove some casts in xf86MouseProtocol() to work around in the
+ Metaware compiler/NCR assembler (Kaleb Keithley).
+ 81. When the X server exits due to an unrecognised command-line option,
+ print out the offending option (Joe Moss).
+ 80. Remove '-lc_s' from ExtraLibraries for ISC (Michael Rohleder).
+ 79. Add code to SuperProbe and the Cirrus driver to recognise the
+ CL-GD7542 (and a guess for the CL-GD7541).
+ 78. Fix RAMDAC probe problem introduced into the S3 server in 3.1.2e
+ (Joe Moss).
+
+XFree86 3.1.2A (19 November 1995)
+ 77. Added a Beta Report template form.
+ 76. Update xf86config for some of the new Ramdacs.
+ 75. Allow 'Ramdac "ibm_rgb526" to be recognised by the S3 server. It
+ then treats it as an RGB524.
+ 74. Modify the beta startup message usage so that it gets printed once
+ for each different server started.
+ 73. Fix for AGX-010 clock probing (Henry Worth).
+
+XFree86 3.1.2e (16 November 1995)
+ 72. Updates to the Cards database.
+ 71. S3 868 + AT&T 20C409 support (8/15/16/24bpp) without pixmux, and
+ S3-868 + AT&T 20C499 support (untested) (8/15/16/24bpp, no pixmux).
+ Pixmux support is enabled, but not functional (Dirk Hohndel).
+ 70. Update SuperProbe to recognise AT&T 20C409 and AT&T 20C499 RAMDACs
+ (Dirk Hohndel).
+ 69. Allow attributes to be appended to elements of a font path. The
+ attributes are introduced by a ':' character, and multiple attributes
+ are separated by a ':'. Currently the attribute "unscaled" is
+ supported for bitmap fonts, and this prevents them from being scaled.
+ 68. Trident driver cleanups, and fixes for interlacing (Alan Hourihane).
+ 67. LynxOS updates for using MetroLink Motif (Thomas Mueller).
+ 66. Preliminary AT&T 20C409 support for the S3 server (not functional
+ yet) (Dirk Hohndel).
+ 65. W32 updates to Xserver and SuperProbe (Dirk Hohndel and Koen Gadeyne).
+
+XFree86 3.1.2d (12 November 1995)
+ 64. Fix a typo in the iso8859-1 Compose file.
+ 63. Add a '-noscale' flag to the Xserver and xfs to allow scaling of
+ bitmap fonts to be disabled. The keyword DontScaleBitmapFonts
+ in the ServerFlags section of the XF86Config file has the same affect.
+ 62. Fix problem that prevents bitmap fonts from being scaled after
+ running something like 'xset fp rehash'.
+ 61. Add a Release Date to the X server startup messages.
+ 60. Add a "RELNOTES" document to describe changes in beta releases.
+ 59. Fix panning for ARK2000PV chips with 2MB of memory (Leon Bottou).
+ 58. Support for ICS5342 programmable clock in the ARK driver (Leon Bottou).
+ 57. Major updates to the Oak driver, including more accelerated functions
+ for the OTI087 (Jorge Delgado).
+ 56. Option "program_clocks" added for the Mach64 server to allow
+ arbitrary clocks to be programmed for most clock chips. This
+ currently doesn't work with the ATI18818/ICS2595 chips (Kevin Martin).
+ 55. Mach64 server support for the AT&T 20C408 (Kevin Martin).
+ 54. Fix problem of two undisplayed pixels with the CL-GD7543
+ (Thomas Zerucha).
+ 53. Add support for three button operation with some dual protocol mice
+ when they are in Microsoft-compatible mode. The keyword to enable
+ this is 'RepeatedMiddle' (Jon Tombs).
+ 52. Fix 3 button emulation problem introduced in item 48 (Thomas Mueller).
+ 51. Add support for '-crt /dev/ttyXX' command line option for the X
+ servers for SCO. This is for compatibility with the native SCO X
+ servers (Didier Poirot).
+
+XFree86 3.1.2c (5 November 1995)
+ 50. Add expiry date and startup message for beta versions.
+ 49. Fix problem using a LinkKit generated with BuildLBX set to YES.
+ 48. Allow a real middle button event to be passed when 3 button mouse
+ emulation is enabled (Thomas Wu).
+ 47. Fix panning and some initial clock selection problems for TGUI9440
+ cards (Alan Hourihane).
+ 46. Support for the Cirrus CL-GD7543 (Thomas Zerucha).
+ 45. Fix for instability problems with Cirrus programmable clock
+ (Koen Gadeyne).
+ 44. Fix memory overwrite problem in xterm which could be a security
+ problem.
+ 43. Merge in the X Consortium's public patch 13.
+ 42. Define X_LOCALE for LynxOS for compatibility with Metrolink's
+ Motif package (Thomas Mueller).
+ 41. Update SuperProbe to recognise the Cirrus CL-GD7543.
+ 40. The Trident driver now automatically selects the "tgui" clockchip
+ when it detects a TGUI9440 (Alan Hourihane).
+ 39. Remove the dependency on -lthread for UnixWare 2.x, while still
+ allowing full MT support. This is done by adding a threads stub
+ library with weak symbols (David Wexelblat).
+
+XFree86 3.1.2b (22 October 1995)
+ 38. Updated Japanese docs, including SGML versions suitable for formatting
+ with jlinuxdoc-sgml. These docs use EUC encoding (Kazuyuki Okamoto).
+ 37. Preliminary support for the Trident TGUI9440 (Alan Hourihane).
+ 36. Add an "AllowNullPasswd" resource to xdm to make it possible for xdm
+ to login to accounts with a null password. This is set to "False"
+ by default (Joerg Wunsch).
+ 35. Use dynamically allocated strings in xrdb to avoid overruns that
+ can occur otherwise (Joerg Wunsch).
+ 34. Add ELSA Winner 2000PRO/X-8 to the S3 ELSA probe code (Dirk Hohndel).
+ 33. Fix S3 probe of IBM RGB RAMDACs incorrectly identifying an RGB528
+ or RGB528A as an RGB524 (Dirk Hohndel).
+ 32. Fix incorrect memory probe for S3 964/968 (Dirk Hohndel).
+ 31. Prelim pixmux support for ICS5341 RAMDAC in W32 server (Dirk Hohndel).
+ 30. Support for ICS5341 programmable clock in W32 server (Dirk Hohndel).
+ 29. Add RFC1700-conformant charset names for ISO-8859 locales to
+ locale.alias.
+ 28. Fix LynxOS video mapping problem that shows up when the "fb_debug"
+ option is set in the S3 server (Thomas Mueller).
+ 27. Fix reference to undeclared variable in os/xalloc.c for OSs which
+ don't have MMAP_ANON or MMAP_DEV_ZERO defined (Thomas Mueller).
+ 26. Fix W32 server core dump on LynxOS when run with '-probeonly'
+ and no Clocks line in the XF86Config file (Thomas Mueller).
+ 25. Fix reference to uninitialised string in Hercules mono driver
+ (Paul Gortmaker).
+
+XFree86 3.1.2a (23 September 1995)
+ 24. Fix HW cursor masks in Mach32 and Mach64 servers.
+ 23. Add detection of C&T 65548 to SuperProbe.
+ 22. Fix snow problems with WD90C24 when for clocks higher than MCLK
+ (Brad Bosch).
+ 21. Add XNLS support for KOI8-R (Andrey Chernov).
+ 20. Fix problem with IBM ramdac and clockchip handling in xf86config.
+ 19. Change XF86Config parsing to ignore '_' characters in keywords, and
+ to ignore '_', ' ', and '\t' characters when comparing strings with
+ StrCaseCmp() (ie, all strings except paths, Device/Monitor identifiers
+ and Mode names).
+ 18. Reduce nonMuxMaxClock to 80MHz (from 100MHz) for S3 864 with
+ ATT498-compatible RAMDACs because it was too high for some cards.
+ 17. Fix problem installing xterm on SunOS 4.x introduced in 3.1.2.
+ 16. Set -fno-strength-reduce with -O2 for gcc2 to avoid a compiler bug.
+ 15. Fix xvidtune/XF86VidMode problem when the Monitor Vendor and/or Model
+ are not specified in the XF86Config file.
+ 14. Colour support for xterm (David Wexelblat).
+ 13. Fix usage of $LINES and $COLUMNS by xterm on SVR4 (David Wexelblat).
+ 12. Fix xconsole for Unixware 2.0 (David Wexelblat).
+ 11. Fix optimisation problem with inline asm on Unixware 2.0
+ (David Wexelblat).
+ 10. Improve subdir/lib dependence on systems using BSD 4.4. make
+ (Matthieu Herrb)
+ 9. Allow the Xserver to accept InvertVCLK, EarlySC and BlankDelay. It
+ previously expected Invert_VCLK, Early_SC and Blank_Delay.
+ 8. Fix problem selecting a StaticGray visual with the VGA16 server
+ (Olivier De Smet).
+ 7. Fix compile problem on FreeBSD 1.1.5 (David Bremner).
+ 6. Change index and rindex macros in Xos.h when X_NOT_STDC_ENV is not
+ defined.
+ 5. Fix(?) alloca declaration in Xtos.h for Solaris 2.5.
+ 4. Fix dependencies for 'make includes' to ensure that auto-generated
+ headers exist before linking them to xc/X11 (David McCullough).
+ 3. Change default InvertVCLK setting for the Hercules Terminator 64 Pro
+ (Harald Koenig).
+ 2. Update for lynx.cf (Thomas Mueller).
+ 1. README updates.
+
+XFree86 3.1.2 (24 July 1995)
+235. Fix(?) scanpci compile problem with gcc on Solaris.
+234. Documentation updates.
+
+XFree86 3.1.1Z (22 July 1995)
+233. Code Freeze for 3.1.2.
+232. Fix an imake config problem on non-XFree86 platforms.
+231. xman update for Solaris 2.5 (William Austin).
+230. Cyrillic fonts with KOI8 encoding added (Cronyx Ltd, Serge Vakulenko,
+ Andrey A. Chernov).
+229. Allow ndbm to be used for the rgb database on NetBSD for those
+ who want it (Matthieu Herrb).
+228. Attempt to fix register corruption for Cirrus 5430/5434/5436 in
+ SuperProbe.
+227. Remove -DUNIXCONN from the default SVR3 ConnectionFlags.
+226. Fix disappearing S3 hw cursor when switching modes with xvidtune
+ (Harald Koenig).
+225. Sync-on-green support for the ELSA Winner 2000Pro/X (Harald Koenig).
+224. Add vendor options to S3 server (hercules, stb, genoa) (Harald Koenig).
+223. Documentation updates (Joe Moss, Harald Koenig, Matthieu Herrb).
+
+XFree86 3.1.1Dc (19 July 1995)
+222. Fix(?) server crash when the Cirrus driver auto-detects the linear
+ fb address for PCI cards.
+221. Support for 964+IBM (Hercules Terminator 64) (Harald Koenig).
+220. Disable >8bpp for S3 911 and 924 because it won't work.
+219. Fix some auto-apply problems in xvidtune, and added a restore hot-key "R".
+
+XFree86 3.1.1Db (17 July 1995)
+218. Documentation updates.
+217. xvidtune updates.
+216. S3 parameter updates for STB 968 card, and update to the Trio64V
+ probe (Harald Koenig).
+
+XFree86 3.1.1Da (16 July 1995)
+215. Replace xf86pci.c with the real scanpci.c (Robin Cutshaw).
+214. Updates to the code for the additional S3 mode parameters, including
+ better default settings (Harald Koenig).
+
+XFree86 3.1.1D (15 July 1995)
+213. xterm fix for crash when inputMethod is set to kinput2 (Manabe Keishi).
+212. Code to detect the AT&T20C490, and Sierra 1148[234579] ramdacs
+ (Joe Moss).
+211. Update the VidMode extension to handle extra mode-specific parameters,
+ and update xvidtune for extra S3 parameters.
+210. Allow some S3 parameters to be set in the Display SubSection for
+ individual modes.
+209. xf86config Cards database updates.
+208. Updates to README.WstDig for the 90C24 (Brad Bosch).
+207. Updates to LynxOS support, including support for version 2.2.1, and
+ a README.LynxOS (Thomas Mueller).
+206. Support for the SC1148{2,3,4} ramdacs at 15bpp, and the SC1148{5,7,9}
+ ramdacs at 15 and 16bpp in the S3 server (Joe Moss).
+205. Fix for problems with some WD90C24 TFT systems (Brad Bosch).
+
+XFree86 3.1.1Cd (12 July 1995)
+204. Allow for three verbosity levels for Xserver messages: -quiet, default,
+ and -verbose (Marc Aurele La France).
+203. Make the LinkKit self-contained. Apart from Xnest, it no longer
+ depends on the config files, headers, and utility programs being
+ installed (Marc Aurele La France).
+202. Updates to xvidtune. The Show button now also sets the primary
+ selection, better usage/error messages and exit codes, man page
+ updates (Joe Moss).
+201. Updates for SCO -- mostly for lbx (David McCullough).
+200. Fix a cause for some S3 lockups (Harald Koenig).
+199. Updates/fixes and SVR4 support for new malloc code.
+
+XFree86 3.1.1Cc (8 July 1995)
+198. Merge in final form of XC fix-12.
+
+XFree86 3.1.1Cb (7 July 1995)
+197. Minor IBM RGB updates (Harald Koenig).
+196. MCLK detection for STG1703 (Harald Koenig).
+195. Add detection for new S3 Trio64V+ chip to the S3 server and
+ SuperProbe (Harald Koenig).
+194. Fix some clashing option numbers (Harald Koenig).
+193. Preliminary STG1703 clock programming code.
+192. A new malloc for use by the Xserver. It is enabled by setting
+ UseInternalMalloc to YES (Pascal Haible).
+191. Fix for threads lib problem on Unixware 2.0
+190. Support for the WD90C24 in the pvga1 driver (Bradley Bosch).
+
+XFree86 3.1.1Ca (5 July 1995)
+189. Don't enable HAS_MMAP for Xvfb on Linux (Marc Aurele La France).
+188. Code to detect the STG1703 RAMDAC in SuperProbe and the S3 server
+ (Harald Koenig).
+187. A few AGX bug fixes (Henry Worth).
+186. More pre-fix-12 fix-trackers.
+
+XFree86 3.1.1C (3 July 1995)
+185. Manual page updates.
+184. Add extended power_saver support to the VGA and Mach64 servers.
+ Suspend mode isn't currently supported by the VGA servers.
+183. Add entries for the SunFA_ dead accents to the iso8859-1 Compose file
+ (Jon Tombs).
+182. Updates to IBM RGB52x in the S3 server, including fixing the
+ 8bpp problem.
+181. Documentation updates (including a README.ark) (Harm Hanemaayer).
+180. Change the Mach64 server to ignore the Clocks line in the XF86Config
+ unless the "no_bios_clocks" option is used (Kevin Martin).
+179. Fix font corruption with Mach64 server (seen when running Mosaic
+ or Netscape) (Kevin Martin).
+178. Fixes for constant-metric fonts in AGX server (Henry Worth).
+
+XFree86 3.1.1Bi (2 July 1995)
+177. Improved "power_saver" for the S3 server, and modified XFree86-VidMode
+ extension to allow its parameters to be set from a client.
+176. Fixes for AGX copyplane (Henry Worth).
+
+XFree86 3.1.1Bh (1 July 1995)
+175. Updates to AGX server. Includes reversing previous copyplane change,
+ restoring the setting of membase for AGX chips, cleanup setting
+ of the default planemask, and fixes to the agxIm routines + some
+ speedups (Henry Worth).
+174. Some more pre-fix-12 fix-trackers.
+
+XFree86 3.1.1Bg (29 June 1995)
+173. Turn on "dac_8_bit" by default in the S3 server for RAMDACs that
+ support it. Add "dac_6_bit" option to allow 6-bit mode to be selected.
+ Also, complain when "dac_8_bit" is used for a RAMDAC that can't do it.
+172. Improve "power_saver" operation by adding a delay between turning off
+ the video signal and the syncs (Bernhard Bender).
+171. Workaround for the NumLock modifier interfering with the xterm
+ ctrl+btn menus.
+170. More pre-fix-12 fix-trackers. Mostly some libX11 and libXt fixes.
+ Includes a workaround for the NumLock modifier interfering with
+ Xaw pull-down menus.
+169. Preliminary support for the IBM RGB52x ramdacs in the S3 server
+ (Harald Koenig).
+
+XFree86 3.1.1Bf (27 June 1995)
+168. Another stab at the ET4000/W32p mouse droppings fix (Glenn Lai).
+167. Back out some LBX fixes that won't be in fix-12.
+
+XFree86 3.1.1Be (25 June 1995)
+166. Some documentation updates.
+165. Fix a few LinkKit problems.
+164. Fix LBXProxyOnly build.
+
+XFree86 3.1.1Bd (24 June 1995)
+163. Add a BuildLBXProxyOnly Imake config option to allow building lbxproxy
+ from a self-contained cut-down source tree.
+162. vtname was too short in Linux OS-dep code (similar change for LynxOS
+ and SCO too) (Pascal Haible).
+161. Change uses of malloc/free in Xserver to xalloc/xfree (Pascal Haible).
+160. AGX documentation updates (Henry Worth).
+159. Fixes for AGX font rendering, and copyplane (Henry Worth).
+158. AGX font cache flushed by screensaver (Henry Worth).
+157. AGX screensaver for >8bpp (Henry Worth).
+156. pre-fix-12 fix-tracker: improvement to the Xt translation manager
+ performance when high order modifiers are assigned. Also, change
+ the servers to use Mod3 for Mode_switch instead of Mod5 to further
+ improve this.
+155. Fix some UseGnuMalloc config stuff, and set this to YES by default
+ for FreeBSD.
+154. Fix some problems with the VGA2 server, including crashes in banked
+ mode, and incorrectly switching banks when bitblting in non-banked
+ mode.
+
+XFree86 3.1.1Bc (21 June 1995)
+153. Fix for ET4000/W32p cards -- don't change the PCI burst setting.
+ This should fix mouse droppings and missing characters in text mode
+ for some cards (Glenn Lai).
+152. Fix AGX font corruption problem (Henry Worth).
+151. Disable 32bpp in AGX server by default -- it is too unstable
+ (Henry Worth).
+150. XGA clock updates in AGX server (Henry Worth).
+149. EISA XGA probing in AGX server (Henry Worth).
+148. Better scratchpad and font cache support for XGAs in AGX server
+ (Henry Worth).
+147. Font glyph blting for non-cached fonts with AGX server (Henry Worth).
+146. AGX font cache fixes (Henry Worth).
+145. pre-fix-12 fix-trackers, including:
+ - LBX fixes and additional functionality
+ - some xtrans and fontlib fixes
+ - smproxy and xsm fixes
+144. Fix sessreg (WTMP, LASTLOG, but no UTMP) for *BSD.
+143. Allow 'UseGnuMalloc' to work on all platforms.
+
+XFree86 3.1.1Bb (17 June 1995)
+142. Config updates to make LinkKit more self-contained
+ (Marc Aurele La France).
+141. Fix some problems with blocking stderr on BSD/OS 2.0 (Hans Nasten).
+140. Add auto-apply mode to xvidtune, and flesh out the xvidtune man
+ page (Joe Moss).
+139. AGX font cache bug fixes, and fix font clipping problem (Henry Worth).
+138. Some more pre-fix-12 fix-trackers, including:
+ - Xaw - removal of undocumented/broken INTERNAL selection mechanism
+ - Fix makestrs problem with -earlyR6bc.
+
+XFree86 3.1.1Ba (14 June 1995)
+137. Fix AGX problem with vertically overlapping fonts (Henry Worth).
+136. Fix some mono (VGA2) problems that can lead to a server crash.
+135. New "VGAbase" keyword for XF86Config -- currently used only by the
+ AGX server (Henry Worth).
+134. Fixes for XGA autoconfig code in the AGX server (Henry Worth).
+133. Documentation updates (Dirk Hohndel).
+132. Change default FreeBSD version in FreeBSD.cf to 2.0.5.
+131. Add a LockModeSwitch function to the VidMode extension, and modify
+ xvidtune to use it.
+130. Force VTotal to be odd for interlaced modes.
+129. Fix default Vsync/Hsync polarity setting (Marc Aurele La France).
+128. Trap a failed 'cd' in 'make Makefiles'. This prevents the Makefile
+ in the . directory being removed (and other potential problems) when
+ one of the SUBDIRS directories is missing.
+127. Include some XC fix-trackers intended for fix-12. Main changes include:
+ - Using -Xa for SVR4 compiles, and changing '#if __STDC__' to
+ '#ifdef __STDC__'
+ - Overhall tty setup in xterm -- should work better for Solaris now.
+ - Fix SVR4 ABI problems with libXt strings.
+126. Recognise 'Ramdac "generic"' in W32 server (Glenn Lai).
+
+XFree86 3.1.1B (10 June 1995)
+125. Fix problem with dacspeed line in files generated by xf86config.
+
+XFree86 3.1.1Ad (8 June 1995)
+124. Rename the vgahelp client to xvidtune.
+123. Rename "VGAHelp" extension to our registered name
+ "XFree86-VidModeExtension", and update API to use the XF86VidMode
+ prefix instead of the "XVGAHelp"/"VGAHelp" prefix.
+122. Undef i386 in Imake.cf for i386Architecture systems.
+121. Fix(?) WTMP problem with xterm on SYSV and Linux.
+120. Mach64 documentation updates (Kevin Martin).
+119. Power_saver support for the Mach64 server (Kevin Martin).
+118. Autodetect when block write mode should be disabled for the Mach64
+ server. A "block_write" option has been added to override this
+ (Kevin Martin).
+117. Use "dead_*" keysyms instead of the DEC "D*" keysyms for the dead keys
+ in the Linux keyboard code and Compose file.
+116. Use our registered name for the ModeLock keysym.
+
+XFree86 3.1.1Ac (6 June 1995)
+115. Vgahelp client enhancements (Jon Tombs).
+114. Fix core dump in fslsfonts when no fontserver is specified
+ (Matthieu Herrb).
+113. Fix W32 problem introduced with modified SaveScreen code.
+112. Update "M" parameter calculation for Trio boards (Harald Koenig).
+
+XFree86 3.1.1Ab (2 June 1995)
+111. Preliminary support for the Cirrus 5436 (Harm Hanemaayer).
+110. PCI base address detection for the Cirrus driver (Harm Hanemaayer).
+109. Fix problem linking AGX server with the LinkKit (Stephen Kump).
+108. Support for LynxOS (Thomas Mueller).
+107. Update LinkKit to make it self-contained regarding X headers
+ (Marc Aurele La France).
+106. Realtek SVGA driver. It works with the RTG3106, and possibly the
+ RTG3103 and RTG3105 (Peter Trattler).
+105. Enable the s3MCLK option for the S3 805i, and fix some bugs relating to
+ s3MCLK (Harald Koenig).
+104. Fix XF86Config problem when monitor and screen sections are interleaved.
+
+XFree86 3.1.1Aa (1 June 1995)
+103. Fix SiteIConfigFiles settings for the LinkKit (Marc Aurele La France).
+102. Fix gccmakedep problem with .s files.
+101. Updates to BSDI docs (Hans Nasten).
+100. Updates to Linux ELF config/rules (Orest Zborowski).
+ 99. Check for 868 before 864 in S3 server (Harald Koenig).
+ 98. Add rule for compiling/installing scanpci.
+
+XFree86 3.1.1A (28 May 1995)
+ 97. vgawonder driver updates (including fix for VGA2 driver with Mach64)
+ (Marc Aurele La France).
+ 97. Small TVP3026 fix (Harald Koenig).
+ 95. Fix keyboard LEDs not being turned off now that the initial lock state
+ is ignored.
+
+XFree86 3.1.1h (26 May 1995)
+ 94. Support for parallel make (on SVR4) (Robin Cutshaw).
+ 93. Don't initialise the state of the lock keys based on their state
+ prior to server startup.
+ 92. Untested changes in the AGX server for AGX-010 support (Henry Worth).
+ 91. Tested support in the AGX server for the XGA-2 at 8bpp and 16bpp
+ (Henry Worth).
+ 90. 16bpp and 32bpp support for the AGX server (Henry Worth).
+ 89. Additional accelerations for the P9000 server (Henrik Harmsen and
+ Chris Mason).
+ 88. Fix some gamma correction problems in the S3 server (Harald Koenig).
+ 87. More 968/868 fixes, including code to recognise the newer ELSA cards
+ (Harald Koenig).
+ 86. Further VGA16 scrolling fix (Stuart Anderson).
+ 85. Fix problems with some 1MB P9000 cards (Erik Nygren).
+ 84. Swap the black and white pixel values in the SVGA server's default
+ colour map. This fixes a white line problem with some older
+ VGA Wonder boards (Marc Aurele La France).
+ 83. Move sequencer resets into the driver's SaveScreen function
+ (Marc Aurele La France).
+ 82. vgawonder and ati_test updates (Marc Aurele La France).
+ 81. Handle "crippled" Mach32 and Mach64 chips in SuperProbe and the
+ vgawonder driver (Marc Aurele La France).
+ 80. Distinguish between different types of Mach64 chips in SuperProbe and
+ the vgawonder driver (Marc Aurele La France).
+ 79. Add defines to xf86Version.h for each part of the XFree86
+ version numbers (Marc Aurele La France).
+ 78. LinkKit updates to make it self-contained (Marc Aurele La France).
+ 77. Memleak support for NetBSD, and add UseMemLeak Imake config
+ parameter to allow compiling Xserver/os with memleak (Matthieu Herrb).
+ 76. Update NetBSD aperture driver to support -current loadable kernel
+ modules (Matthieu Herrb).
+ 75. Don't try to do clock doubling for 964 + Bt485 at 32bpp.
+
+XFree86 3.1.1g (7 May 1995)
+ 74. i386 BSD support for the memleak utility (Jeffrey Hsu).
+ 73. Fix a scrolling corruption problem with multiple regions in the VGA16
+ server (Stuart Anderson).
+ 72. Modify VGA16 server to provide 4 visuals which can be selected
+ using the standard -cc flag (Stuart Anderson).
+ 71. Changes to allow XDMCP broadcasts on some transports when using
+ STREAMSCONN (Stuart Anderson).
+ 70. Updates for building on NCR SVR4/MP-RAS 3.0 (Stuart Anderson).
+ 69. Some updates for ISC (Michael Rohleder).
+ 68. Fix FillRect problem that causes a server crash for most accel servers
+ when running at 16/32bpp and X isn't on the active VC (Harald Koenig).
+ 67. Fix mach32 inline asm problem (outsw) that shows up with recent gcc
+ versions.
+ 66. Modify xterm to find all ptys on recent FreeBSD (Satoshi Asami).
+ 65. Work around S3 Trio "white line" problem by swapping the default black
+ and white pixel values.
+
+XFree86 3.1.1f (24 April 1995)
+ 64. Remove ComplexProgramTargetNoMan rule, and use NormalProgramTarget
+ instead.
+ 63. Fix cirrus MMIO problem introduced in 3.1.1e, and allow 135MHz clocks
+ for a wider range of CL-GD5434 revisions (Harm Hanemaayer).
+ 62. Update to S3 HW cursor fix (Harald Koenig).
+ 61. Preliminary support for S3 866 and 868 boards (tested with the
+ ELSA Winner 1000AVI) (Harald Koenig).
+ 60. Fix a problem with virtual resolution calculation in the Mach32 and
+ Mach64 servers (when none is given in the XF86Config file)
+ (David Holland).
+
+XFree86 3.1.1e (10 April 1995)
+ 59. Fix problems that can lead to S3 crash/lockup when using HW cursor
+ (Harald Koenig).
+ 58. S3 Trio updates (Harald Koenig).
+ 57. Fix return value of QueryBestSize() for HW cursors.
+ 56. Fix cirrus display error when scrolling without BitBLT engine
+ (Harm Hanemaayer).
+ 55. Sanity check to prevent cirrus crash with negative size rectangle
+ fill (Harm Hanemaayer).
+ 54. Cirrus MMIO improvements, including support for 5429 (Harm Hanemaayer).
+ 53. More balanced cirrus FIFO settings to resolve display refresh errors
+ during drawing operations at high dot clocks (Harm Hanemaayer).
+ 52. Support for clocks up to 135MHz for CL-GD5434 revision E and later
+ (Harm Hanemaayer).
+ 51. Fix memory leak in cirrus text drawing (Harm Hanemaayer).
+ 50. Updates for Linux ELF support (H.J. Lu).
+ 49. Fix mail directory path in xbiff.
+ 48. Fix S3 interlace mode problem for boards with programmable clocks
+ (Harald Koenig).
+ 47. Fix core dump from vgahelp when started with no args (Christos Zoulas).
+ 46. Fix 968 detection in SuperProbe, and add Ti3026 detection (Harald Koenig).
+ 45. Preliminary S3 968 and Ti3026 support (Harald Koenig).
+ 44. Added similar code for SYSV regarding I/O permission, but not enabled
+ (yet) by default.
+ 43. Modify Linux I/O permission code to use IOPL rather than TSS bitmap
+ in all cases (Orest Zborowski and Harm Hanemaayer).
+ 42. Fix lack of keysyms for numerical keypad when ServerNumLock is enabled
+ on Linux (Orest Zborowski).
+ 41. Update _SC_OPEN_MAX code.
+ 40. Fix ALLOCATE_LOCAL() not using alloca() with gcc.
+
+XFree86 3.1.1d (21 March 1995)
+ 39. Preliminary mode checking for the VGAHelp extension.
+ 38. Add timeout for 3 button emulation (Mike Hench).
+ 37. Reorganise Ti302x code to remove S3-specifics from common_hw
+ (Robin Cutshaw).
+ 36. General PCI probe code (Robin Cutshaw).
+ 35. FreeBSD 1.1.5 has _SC_OPEN_MAX defined, but no sysconf().
+
+XFree86 3.1.1c (12 March 1995)
+ 34. Updates for #9 GXE64Pro required due to changes in 3.1.1b (Hans Nasten).
+ 33. Support for BSD/OS 2.0 (Hans Nasten).
+ 32. Updates for OS/2, including work on the X server support (Holger Veit).
+ 31. SVGA driver for the ARK 1000PV and 2000PV chipsets (Harm Hanemaayer).
+ 30. Add predefs to makedepend for FreeBSD and NetBSD. This allows
+ xf86_OSlib.h to be cleaned up a little.
+ 29. Fix config rules for Sentinel build (David Wexelblat).
+
+XFree86 3.1.1b (8 March 1995)
+ 28. Fix for byte swapped extension problem in lbxproxy (Dave Lemke).
+ 27. Support for Unixware 2.0 (Robin Cutshaw and Kaleb Keithley).
+ 26. Fix FIFO detection problem and bug reading BIOS video max modes in
+ Mach64 server (Kevin Martin).
+ 25. Support for Chrontel 8398 and STG1703 clock programming in the Mach64
+ server (Kevin Martin).
+ 24. Add "no_block_write" option to turn of block write mode in the Mach64
+ server (Kevin Martin).
+ 23. Add "override_bios" option to override the Mach64 server's BIOS mode
+ checking (Kevin Martin).
+ 22. Allow Membase to be given in XF86Config for the Mach64 server
+ (Kevin Martin).
+ 21. Fix bug in Mach64 ATI68860 RAMDAC code which causes noisy display
+ (Kevin Martin).
+ 20. Add support for STG1702, STG1703, ATI68875, CH8398 RAMDACs to Mach64
+ server (Kevin Martin).
+ 19. Post events for initial lock key state differently to avoid calling
+ ProcessKeyboardEvents() before all the data it uses is initialised.
+ 18. Fix and extend ISO8859-1 Compose file (Peter Dalgaard).
+ 17. Update S3 SVGA driver so that it works with 3.1.1.
+ 16. Fix 90C33 problem with 2MB cards when memory is not auto-probed.
+ 15. Fix some ISC LOCALCONN problems (Michael Rohleder).
+ 14. Put back some #9 GXE64Pro specific bits in S3 server.
+ 13. Remove 1024 min virtual width restriction from Mach64 server
+ (Kevin Martin).
+ 12. Fix dashed line server hang problem for Mach32.
+ 11. Add UseGnuMalloc to xf86site.def (only implemented for ISC so far).
+ 10. Fix POSIX_SAVED_IDS typo in xterm (Christos Zoulas).
+ 9. Fix problem of attempting to include the VGAHELP extension in Xnest.
+
+XFree86 3.1.1a (12 February 1995)
+ 8. VGAHELP X server extension for tuning video modes (Kaleb Keithley).
+ 7. Fix libfont problem that can cause xfs to get into a loop (Jason Venner).
+ 6. Fix problem with TekHVC colours (Kaz Sasayama).
+ 5. Fix merge problems in hw/sun.
+ 4. Fix line clipping problem in Mach32 server (can affect font cache).
+ 3. Fix font cache problem on 2MB Mach32 cards.
+ 2. Add detection of Trident GUI9440 to SuperProbe (untested).
+ 1. Fix some ISC problems (Michael Rohleder).
+
+
+XFree86 3.1.1 (30 January 1995)
+265. --- Code freeze ---
+264. Include final form of fix-11.
+
+XFree86 3.1.0Zg (29 January 1995)
+263. Include final form of fix-10.
+262. Fix some merge problems.
+
+XFree86 3.1.0Zf (28 January 1995)
+261. Merge in prelim version of XC fix-11.
+
+XFree86 3.1.0Ze (28 January 1995)
+260. Merge in prelim version of XC fix-10.
+
+XFree86 3.1.0Zd (28 January 1995)
+259. Merge in XC fix-09.
+258. Minor updates (mostly typographical) to smooth the fix-11 merge.
+257. Define X_LOCALE for Linux.
+
+XFree86 3.1.0Zc (27 January 1995)
+256. Doc updates.
+255. Minor hw/xfree86 updates for fix-11 (Kaleb Keithley).
+254. Merge in XC fix-08.
+
+XFree86 3.1.0Zb (26 January 1995)
+253. Rename some files under hw/xfree86 to avoid clashes when truncated to
+ 8.3 type names as used on ISO9660 format CDROMs.
+
+XFree86 3.1.0Za (25 January 1995)
+252. Minor pixmux clock limit update for Trio64 (Harald Koenig).
+251. Merge in XC fix-07.
+250. Some documentation updates.
+
+XFree86 3.1.0Z (23 January 1995)
+249. Restore correct key maps for 84-key keyboard, but allow alternate (old)
+ behaviour when "ServerNumLock" is set in the XF86Config.
+248. xf86config updates (Harald Koenig).
+247. Remove stripes when panning with Ti3025 (Harald Koenig).
+246. Enable linear fb probing for VLB Trio64 cards with > 1MB DRAM
+ (Harald Koenig).
+245. Put blank delay values back to what they were for non-#9 Ti3025
+ boards (Harald Koenig).
+244. Fix AGX fill problems and hangs when exiting with an AGX-016 under
+ SVR4 (Henry Worth).
+243. Fix AGX font cache problem, and other updates/cleanups
+ (Henry Worth).
+
+XFree86 3.1.0Ce (22 January 1995)
+242. Updates to vgawonder driver, including fix for 68800-6 memory probe,
+ and a reworking of the clock matching code (Marc Aurele La France).
+241. Remove most BIOS dependencies in vgawonder probe code
+ (Marc Aurele La France).
+240. Change ordering of Mach32 and Mach64 probing in SuperProbe, ati.test
+ and the vgawonder driver to avoid hanging Mach32 boards. Also use
+ a timeout in all WaitIdle loops in the probes (Marc Aurele La France).
+239. Minor #9 GXE64Pro updates (Hans Nasten).
+238. Allow LASTLOG to be independent of SYSV_UTMP in xterm -- so it will
+ work for Linux (Helmut Geyer).
+
+XFree86 3.1.0Cd (21 January 1995)
+237. Improve positioning of pixmap expansion and font cache areas with
+ the S3 server.
+236. Fix problem with Cirrus mono server crashing (Stephen Kump).
+235. Allow the "sw_cursor" option to work for the S3 server.
+234. Fix S3 HW cursor hot spot problem when no ViewPort entry is given in
+ the XF86Config (Harald Koenig).
+233. Fix some S3 Trio64 8bpp+pixmux display errors (Harald Koenig).
+232. Fix #9 GXE64Pro problems introduced in 3.1.0Cc (Hans Nasten).
+231. SPEA auto-detection for their Trio64 cards (Norbert Distler).
+230. Possible fix for keymap problems with 84-key keyboards.
+229. Internationalisation support for xterm (Martin Forssén).
+228. Remove the need for a Virtual entry in the XF86Config for the Mach64
+ server.
+
+XFree86 3.1.0Cc (20 January 1995)
+227. Add a check to the W32 server for invalid depths.
+226. Fix bug in PaintWindow in Mach32 and AGX servers (Stuart Anderson).
+225. Chrontel 8391 programmable clock support (Richard Burdick
+ and Harald Koenig).
+224. S3 programmable clock code updates (Harald Koenig).
+223. Support for S3 Trio32 and Trio64 (Harald Koenig).
+222. Updates to S3 Ti3025 code for the Miro 40SV (Harald Koenig).
+221. Update xf86config to know about the latest clockchip changes
+ (Harm Hanemaayer).
+220. Minor cirrus HW cursor patch (Harm Hanemaayer).
+219. Updates to OAK driver, including mapping the linear fb above 64MB
+ (Jorge Delgado).
+
+XFree86 3.1.0Cb (19 January 1995)
+218. Fix XLOCAL parsing problem introduced in XC fix-06 (Steve Forsythe).
+217. Added a DocIndex (to use as a starting point for the HTML docs).
+216. README.Oak (Jorge Delgado).
+215. SuperProbe/kbd_mode updates for compiling with PCVT_SUPPORT
+ (Joerg Wunsch).
+214. Fix for 90C31 acceleration problems.
+213. Don't use '-ansi -pedantic' for Solaris versions earlier than 2.4.
+
+XFree86 3.1.0Ca (18 January 1995)
+212. S3 update for SPEA Mercury P64 (Norbert Distler).
+211. Late LBX updates from the XC.
+210. Add a "no_imageblt" option for the Cirrus driver (Harm Hanemaayer).
+209. Support for 2:1 pixmux 8bpp RAMDACs on boards with fixed clock chips.
+208. S3 changes for the ICS5342 ramdac/clock (Harald Koenig).
+207. Fix problem in miZeroClipLine() which can cause a server hang
+ (Harald Koenig).
+206. Fix register unlocking problem in S3 server (for Stealth 64 VRAM)
+ (Harald Koenig).
+
+XFree86 3.1.0C (15 January 1995)
+205. Preliminary programmable clock support for the Mach64 server
+ (Kevin Martin).
+204. Add accelerated line code for the P9000 server and fix/update some
+ other accelerated code (Chris Mason).
+203. Allow XF86Config Videoram to override autodetection with the P9000
+ server, and allow the "vram_128" option force recognition of
+ 128kx8 VRAM (Erik Nygren).
+202. Change P9000 programmable clock operation to be consistent with other
+ servers (Erik Nygren).
+201. Allow Cirrus MMIO for the 5429, and change on of the fixed clocks
+ in the Cirrus programmable clock code (Harm Hanemaayer).
+
+XFree86 3.1.0Bf (14 January 1995)
+200. Preprocess Linux jump files, and allow libX11 to be built with XdmAuth
+ (Orest Zborowski).
+199. Fix VTSema-related problem in s3bstore.c (Henry Worth).
+198. Merge in XC's pre-fix-07 LBX code.
+
+XFree86 3.1.0Be (12 January 1995)
+197. Include Japanese translations of some XFree86 3.1 docs (Kazuyuki Okamoto).
+196. Updates to SPEA detection code (Norbert Distler).
+195. Fix for ICS2595 initialisation problem (Norbert Distler).
+194. Some vgawonder driver fixes (Marc Aurele La France).
+193. Prevent xf86config from crashing when some fields are missing in
+ the Cards database (Matthieu Herrb).
+192. Fix S3 cursor X position when the display address is not changed to
+ avoid display errors.
+191. Set S3 M/N parameters depending on the MCLK value (which can be probed
+ or set in XF86Config) (Harald Koenig).
+
+XFree86 3.1.0Bd (12 January 1995)
+190. Update cl64xx driver for modeRec changes.
+189. Merge in XC public fix-06.
+
+XFree86 3.1.0Bc (11 January 1995)
+188. Added a DontZoom keyword for the XF86Config "ServerFlags" section
+ to disable the mode switching key sequences.
+187. Updates for ISC. Includes imake config support for the SVR3 mmap
+ driver, updates to install.svr3, and patches for building lbxproxy
+ (Michael Rohleder).
+186. Fix 864 + STG1700 8bpp pixmux for clocks between 67.5 and 95 MHz
+ (Harald Koenig).
+185. Change VRAM timings for Diamond Stealth 64 VRAM (Harald Koenig).
+184. Set HSyncEnd overflow in S3 server when needed (Harald Koenig).
+183. Prevent C&T driver from pretending to support the 82c45x chipsets.
+182. Don't trap <ctrl><alt><bs> when DontZap is set.
+
+XFree86 3.1.0Bb (10 January 1995)
+181. Updates to linear fb code for OTI087, and allow the FIFO threshold
+ to be set from XF86Config (Jorge Delgado).
+180. Add hooks for server/driver mode validation. This is currently used
+ only by the NCR SVGA driver (Stuart Anderson).
+179. Fix for ET4000/W32 bank switching code in the SVGA et4000 driver
+ (David Etherton).
+178. Similar hw cursor move fix for S3 server.
+177. Fix for Cirrus crash when the hw cursor is moved while in another VT
+ (Harm Hanemaayer).
+176. Allow the "s3_964_bt485_vclk" to be used for the Diamond Stealth64 (VRAM).
+ This requires the "diamond" option (Harald Koenig).
+175. Rewrite xlfd_round_double() to speed it up on machines with no
+ hw floating point. This reduces server startup time on such machines
+ (Harald Koenig).
+174. Reduce amount of floating-point calculation in icd2061a and S3 gendac
+ clock code (Harald Koenig).
+173. Probe code to detect some SPEA boards and correctly set the clockchip
+ (Norbert Distler).
+172. Allow Xservers to be built with only PCVT support on *BSD, and
+ clean up the console driver probing for *BSD (Joerg Wunsch).
+
+XFree86 3.1.0Ba (8 January 1995)
+171. Change "ct5??" chips&tech names to "ct655??".
+170. Fix for Xnest (and Xvfb) not calling OsInitColors().
+169. Add support for relinking the Xnest server with the LinkKit.
+168. Modify vgawonder to probe clocks when -probeonly is used
+ (Marc Aurele La France).
+167. Fix some cirrus line drawing problems and fix non-interlaced modes
+ with vertical timings > 1024 (Harm Hanemaayer).
+166. Avoid use of the threads lib for SolX86 (David Holland).
+
+XFree86 3.1.0B (4 January 1995)
+165. Support for C&T 65540/45 added to the SVGA server (Régis Cridlig).
+164. Change cirrus programmable clock code to use a tested set of clock
+ parameters when there is one close to the requested clock frequency
+ (Harm Hanemaayer).
+163. Fix cirrus BitBLTs with height > 1024 for 543x (Harm Hanemaayer).
+162. Clock-related updates to the vgawonder driver (reject invalid clocks
+ where possible) (Marc Aurele La France).
+161. Config updates (including installation of host.def and fix references
+ to cl64xx driver in xf86site.def) (Marc Aurele La France).
+
+XFree86 3.1.0Ae (2 January 1995)
+160. Replace docs with the ascii versions generated from the sgml source.
+159. Major updates to xf86config(1), including the addition of a Cards
+ database (Harm Hanemaayer).
+158. Check and reject invalid XF86Config depths for the VGA16 and Mono
+ servers.
+157. Add an "s3_964_bt485_vclk" option to fix a problem with 964+Bt485.
+ Also added code to detect the MIRO 20SV board revision (Harald Koenig).
+156. Add an S3Mclk entry to XF86Config to allow the MCLK value to be specified
+ in order to aid the calculation of the optimal M parameter
+ (Harald Koenig).
+155. Fix S3 linear fb check and allow membase to work for 864/964 boards
+ (Harald Koenig).
+154. Move server lock code back into Xserver/os so that it gets used by
+ Xnest and Xvfb.
+
+XFree86 3.1.0Ad (26 December 1994)
+153. Fix problems with DBLSCAN code introduced in 3.1.0Aa (Harm Hanemaayer).
+152. Support for adding LBX via the LinkKit.
+151. Fix some LinkKit config problems.
+150. Fix LinkKit Imakefile bug introduced in 3.1.0A.
+149. Support for SPEA Mercury P64 (Bt485 + 964) (Norbert Distler).
+148. Enable ICD2061A/SC11412 clockchip by default for S3 server if the
+ the "SPEA_Mercury" option is given and Bt485 + 964/928 is detected
+ (doesn't happen if an XF86Config entry for either ramdac or clockchip
+ is present) (Norbert Distler).
+147. Fix for PCI Type 2 probe for I128 SuperProbe code (Robin Cutshaw).
+146. Major Cirrus update. Includes new acceleration using mmio (lines
+ tilefill and rectangles), and more acceleration for 16/32bpp
+ (Harm Hanemaayer).
+145. Fixes for AGX dashed line code (Henry Worth).
+144. Allow S3 server to put the cache in the area to the right of the screen
+ when it is larger than the area below it (Leonard N. Zubkoff).
+
+XFree86 3.1.0Ac (20 December 1994)
+143. Imake template and rules for LinuxDoc-SGML formatting.
+142. Documentation converted to LinuxDoc-SGML (Gertjan Akkerman,
+ Jayadev Billa, Matthieu Herrb, Michael Klemme).
+141. Re-enable SO_REUSEADDR code in Xtranssock.
+
+XFree86 3.1.0Ab (18 December 1994)
+140. Item 58. below (the patch didn't get included before).
+139. Add some sanity checking for horizontal timing parameters (including
+ HTotal overflow for 864 with 24bpp, pixmux and HTotal > 1024)
+ (Harald Koenig).
+138. Add check for 864 DCLK limit for 24bpp (Harald Koenig).
+137. Clean up of SDAC/GENDAC detection and related messages (Harald Koenig).
+136. Allow the following ramdac and clock chips to be specified by name:
+ att21c498 (att20c498), ics5300 (s3_gendac), ics5342 (s3_sdac),
+ ics9161a & dcs2824 (icd2061a). (Harald Koenig)
+135. OS/2 updates, including config updates, SuperProbe support and
+ compile-time support for most of the Xserver (Holger Veit).
+134. Updated cl64xx driver, including support for the CL6440. Note, the
+ driver name has changed from "cl6420" to "cl64xx" (Manfred Brands and
+ Randy Hendry).
+133. Fix VT switch problem with the SVGA MX driver (Frank Dikker).
+132. Add PCI config type 1 support to I128 probe in SuperProbe (Robin Cutshaw).
+131. Update support for STB Pegasus (928 + Bt485), including 16bpp and
+ 32bpp (Leonard N. Zubkoff).
+130. Fix pixmux clock check in Mach32 server (Alan Hourihane).
+129. Mods to allow XFree86 servers to compile with 'gcc -ansi -pedantic'
+ on Solaris 2.x (David Holland).
+128. Fix stipple problem in S3 server.
+127. Fix for setuid-root xterm problem reading .Xauthority file on
+ nfs-mounted filesystem (so far only for systems with POSIX_SAVED_IDS)
+ (Christos Zoulas).
+126. Move server lock code into hw/xfree86 (Kaleb Keithley).
+125. Really fix Membase handling for S3 server and 805/928.
+124. Fix Mach32 probe problem.
+123. Fix SVR3 config problems (Michael Rohleder).
+
+XFree86 3.1.0Aa (11 December 1994)
+122. Fix default mapping for numpad keys. ServerNumLock should now not
+ be required (for clients using R6 Xlib).
+121. DoubleScan modes are no longer specified with doubled vertical timings.
+120. Add extra timings fields to the ModeRec which are the CRTC values
+ used by the hardware.
+119. Update oak driver to support linear mode for the oti-087 (Jorge Delgado).
+118. Fix '-DSTATIC_COLOR' problems (Hans Nasten).
+117. Fix typos which prevented Mach64 detection in SuperProbe from working
+ (Marc Aurele La France).
+116. Allow XF86Config settings to override ELSA probe (Harald Koenig).
+115. Fix Membase handling for S3 server and 805/928.
+114. Make BSD console driver support selectable from imake.
+113. Fix some SVR4 config problems.
+
+XFree86 3.1.0A (5 December 1994)
+112. Mach64 pixmap cache fixes (Kevin Martin).
+111. Improve cirrus programmable clock handling (Harm Hanemaayer).
+110. Add code to SuperProbe to detect the #9 Imagine I128 (Robin Cutshaw).
+
+XFree86 3.1.0g (2 December 1994)
+109. Enable mmio for the Cirrus 543x (Harm Hanemaayer).
+108. Updates to xf86config (Harm Hanemaayer).
+107. Code for SuperProbe to successfully detect CL-GD543x (Harm Hanemaayer).
+106. Eliminate all references to "SYSV386". "-Di386" should be used instead,
+ even in the BOOTSTRAPCFLAGS for SVR4 and SVR3 (Kaleb Keithley).
+105. Some typo changes to bring our code closer to what the XC has.
+
+XFree86 3.1.0f (1 December 1994)
+104. Eliminate references to SYSV386.
+103. Add check for usable linear fb for 864/964 boards.
+102. Detect and reject Mach64 boards whose ROM or VGA capability has been
+ disabled (Marc Aurele La France).
+101. Experimental code in the vgawonder driver to reset Mach* boards. This
+ is enabled with the "noaccel" option (Marc Aurele La France).
+100. Fix clashes with K_SCROLLLOCK and related symbols defined in newer
+ Linux releases (Marc Aurele La France).
+ 99. Change SuperProbe to detect the Mach64, and deal with ATI DAC classes
+ 6 and 7, and recognise the ATI 28800-6 chip (Marc Aurele La France).
+ 98. ISC 3.x and 4.x support (Michael Rohleder).
+ 97. Add support for 640 and 800 line widths to AGX server (Henry Worth).
+ 96. Fix cursor/screen scrolling problem for doublescan modes (Henry Worth).
+ 95. Add missing XF86_Mach64.c file.
+
+XFree86 3.1.0e (27 November 1994)
+ 94. Add missing install rule for gccmakedep.
+ 93. Define CSRG_BASED for *BSD (Kaleb Keithley).
+ 92. Code/prototype cleanup under hw/xfree86 (Kaleb Keithley).
+ 91. Mach64 accelerated server (Kevin Martin).
+
+XFree86 3.1.0d (22 November 1994)
+ 90. Updates to NetBSD aperture driver (Matthieu Herrb).
+ 89. Bring back 'gccmakedep' from 2.x. Currently only use it when
+ UseInstalled is true.
+ 88. Support for additional keys on Microsoft ergonomic keyboard (may
+ require support in the OS's console driver) (Kaleb Keithley).
+ 87. Updates for SCO (David McCullough).
+ 86. Don't require the Virtual size to be specified for the Mach32 server.
+ 85. Allow virtual widths < 1024 for Mach32 server (currently untested).
+ 84. Some preliminary support for ISC (SVR3) 4.x (Michael Rohleder).
+ 83. ET4000/W32 server updates. Includes accelerated 32-bit opaque and
+ transparent stipple, acceleration for cases where the planemask != 0xFF,
+ and ramdac code changed to accommodate more ramdac types (Glenn Lai).
+ 82. NetBSD support in hw/sun (Dennis Ferguson, Matthew Green, Matthieu
+ Herrb).
+ 81. Fix xterm hang-on-exit problem on SolX86 2.4 (David Holland).
+ 80. Speedups for AGX constant-metric and non-overlapping characters
+ (Henry Worth).
+ 79. AGX accelerated dashed lines, and solid fills for arcs and polygons
+ (Henry Worth).
+ 78. Doublescan support for the AGX server (Henry Worth).
+ 77. Update AGX server to delete unusable modes, and to allow the virtual
+ width to be less than the display width (Henry Worth).
+ 76. Fix typo in oak driver (which broke 067/077 support) (Jorge Delgado).
+ 75. NetBSD updates, including SparcArchitecture support in imake config
+ (Matthieu Herrb).
+ 74. 32bpp support for SPEA Mercury (928+Bt485) (Norbert Distler).
+ 73. Modify Linux kbd code to read the "high_keys" mapping (Takashi Manabe).
+ 72. Fix RGBPath in XF86Config being ignored.
+
+XFree86 3.1.0c (6 November 1994)
+ 71. Fix xload for FreeBSD 1.1.5 (Joerg Wunsch).
+ 70. Modify S3 linear fb probe to handle the non-standard CR5A[6:7] address
+ mapping used by some Diamond boards (including the Diamond Stealth Pro).
+ Also, the 10 most significant bits of a specified MemBase value are
+ now used (which leads to an incompatibility with previous usage)
+ (Dick Streefland).
+ 69. Fix clock matching and some other problems in vgawonder driver
+ (Marc Aurele La France).
+ 68. Reduce RAS to 6 MCLKs for SPEA Mercury (Norbert Distler).
+ 67. Fix setting of CR65 for the SPEA Mercury -- fixes 1600 width at 8bpp
+ and 1152 width at 16bpp (Norbert Dislter).
+ 66. Change MCLK from 46MHz to 49MHz in the SC11412 clock code (Norbert
+ Distler).
+ 65. S3 code to detect 866/868/968/Trio32/Trio64 and treat them as
+ an 864 (Harald Koenig).
+ 64. Update SuperProbe to detect STG1700, S3 GENDAC and SDAC, ATT22C498,
+ S3 Vision866, 868, 968, Trio32 and Trio64 (Harald Koenig).
+ 63. Enforce 95MHz limit for 864 when no pixmux (eg, 16bpp) (Harald Koenig).
+ 62. Increase pixmux cut-in point for ATT20C498 to 95MHz (Harald Koenig).
+ 61. ATT22C498 detection and (untested) support (Harald Koenig).
+ 60. New code for S3 SDAC/GENDAC detection, and enable the programmable
+ clock when one of these is detected (Harald Koenig).
+ 59. Fixes for S3 RAMDAC detection (STG1700 and SDAC) (Harald Koenig).
+ 58. Fix ICD2061A code for clocks between 110MHz and 120MHz (Harald Koenig).
+ 57. Chips & Technology SVGA driver (Jon Block, Mike Hollick, Régis Cridlig).
+ 56. 16/32bpp support for #9 boards with Ti3020 ramdac (Robin Cutshaw).
+ 55. Fix bsdi.cf problems with gcc options (Hans Nasten).
+
+XFree86 3.1.0b (30 October 1994)
+ 54. 16/32bpp support for Elsa Winner2000Pro (964+Ti3020) (Dirk Hohndel).
+ 53. Update to cirrus programmable clock code (Harm Hanemaayer).
+ 52. Accelerated 16/32bpp bitblt for the Cirrus driver (Harm Hanemaayer).
+ 51. The vgawonder driver will now attempt to determine what the board uses to
+ generate clocks (Marc Aurele La France).
+ 50. Allow mode flags to specify composite sync polarity (Marc Aurele
+ La France).
+ 49. ati.test and vgawonder driver updates (Marc Aurele La France).
+ 48. Vgawonder driver will now attempt to use a default video mode (derived
+ from the existing CRTC settings) when no modes are specified in the
+ XF86Config (Marc Aurele La France).
+ 47. Fix problem where clock probe could report high values as zero (Marc
+ Aurele La France).
+ 46. SVGA driver for Avance Logic Inc. ali2301, ali2302, ali2308 and
+ ali2401 (Ching-Tai Chiu).
+ 45. Enable linear aperture access for BSD/386 (Hans Nasten).
+ 44. Some Linux xterm fixes (Orest Zborowski).
+ 43. Fix Linux xdm groups setting problem (Orest Zborowski).
+ 42. Allow Mach8 server to delete unsuitable modes (Hans Nasten).
+ 41. Attempt at fixing FatalError() re-entrancy problems when aborting.
+ 40. Add X server lock file code.
+ 39. Modify PTS code in xtrans to remove an existing node at server startup
+ (as happens with UNIXCONN).
+ 38. Set debug level to 1 in xtrans (this should allow error messages to
+ finally be seen).
+ 37. Modify xtrans to use ErrorF() for debug/error messages within the
+ X server.
+ 36. Updates to the S3MNAdjust option -- including no longer using global
+ variables (Harald Koenig).
+ 35. Fix horizontal stripes when panning with an S3 805i (Harald Koenig).
+ 34. Fix SDAC + pixmux patch (Harald Koenig).
+ 33. Fix line-related crash problem when using linear addressing with
+ the SVGA server (Harm Hanemaayer).
+ 32. Fix Cirrus 5434 linear addressing text blt bug (Harm Hanemaayer).
+ 31. Fix Cirrus 14-pixel font bug (Harm Hanemaayer).
+ 30. Improve Cirrus probing (Harm Hanemaayer).
+
+XFree86 3.1.0a (21 October 1994)
+ 29. Fix some missing globals in Linux libX11 (Orest Zborowski).
+ 28. Fix for TCPCONN code's checking for an existing server.
+ 27. Support for building ELF dynamic libs on Linux (Michael Riepe).
+ 26. Fix gcc local label usage in vgaFasm.h (Adam Richter).
+ 25. OS/2 client support (Holger Veit).
+ 24. Fix some data initialisation problems in libX11 and libXt
+ (Christos Zoulas).
+ 23. Use '-ansi -pedantic' with GCC when building the core tree.
+ 22. Changes to vgaFasm.h to allow compilation with 'gcc -ansi -pedantic'.
+ 21. Revised OAK driver which includes OTI-087 support (Jorge Delgado).
+ 20. Don't use -lmalloc for FreeBSD 1.1.5 -- it seems to cause some server
+ crashes.
+ 19. Change FreeBSD.cf to refer to the compiler as 'cc' instead of 'gcc'
+ (Rich Murphey).
+ 18. Work around some problems GNU make 3.62 has with the rstart Imakefile
+ (Jim Tsillas).
+ 17. Fix HW cursor problems after switching resolutions with the SVGA
+ server (Harm Hanemaayer).
+ 16. Fix I/O permission problem with AL2101 driver (Harm Hanemaayer).
+ 15. Preliminary doublescan mode flag support (Harm Hanemaayer).
+ 14. Accelerated transparent text for Cirrus 5426/8 (Harm Hanemaayer).
+ 13. Cirrus programmable clock support (Harm Hanemaayer).
+ 12. Cirrus accelerated image text for 16/32bpp (Harm Hanemaayer).
+ 11. Fix Cirrus HW cursor colour map at 16/32bpp (Harm Hanemaayer).
+ 10. Fix 16bpp VC switch lockup on Cirrus 5426 (Harm Hanemaayer).
+ 9. Fix SDAC 15/16bpp setup and 8bpp pixmux clock selection (Harald Koenig).
+ 8. New (faster) S3 stipple code (Hans Nasten).
+ 7. Add the xf86config program to the source tree (Harm Hanemaayer).
+ 6. Gamma correction support for Ti3025 (Hans Nasten).
+ 5. Add code to set 170MHz Bt485/20C505 limits for 32bpp.
+ 4. Fix incorrect clock limit for ATT20C490 + programmable clock.
+ 3. Fix S3 co-ord overflow check for bpp > 8.
+ 2. Fix to S3 server to support newer #9 GXE64Pro boards (Robin Cutshaw).
+ 1. Documentation updates.
+
+XFree86 3.1 (29 September 1994)
+400. --- Code freeze ---
+399. Fix slow server death and VT switching problems with W32 server
+ (Glenn Lai).
+398. Fix problem with the W32 server not being installed set-uid (Hans Nasten).
+397. Fix problem with LinkKit Imakefile (Matthieu Herrb).
+396. Documentation updates.
+
+XFree86 3.0Z (27 September 1994)
+395. Fix mouse access problem when server resets while not in the active VT
+ (Orest Zborowski).
+394. Fix typo in pvga1 driver (Simon Cooper).
+393. Documentation updates.
+392. Disable MMIO for Cirrus -- doesn't work yet (Harm Hanemaayer).
+391. Workaround for Cirrus GRF corruption in SVGA probe (Harm Hanemaayer).
+390. Update colourmap/blanking for W32 server (Glenn Lai).
+389. Fix clock ordering problem for vgawonder driver (Marc Aurele La France).
+388. Fix typo in Mach32 server which prevents it from starting at 16bpp
+ (Alan Hourihane).
+
+XFree86 3.0Fe (26 September 1994)
+387. Fix for S3 line drawing overwriting HW cursor storage.
+386. Include Monitors and Devices files which contain the Monitor and Device
+ XF86Config sections that have been submitted (Gertjan Akkerman).
+385. Update Cirrus probing for 543x chips in SuperProbe (Harm Hanemaayer).
+384. Update ET4000/W32 probing for SuperProbe (Glenn Lai).
+383. 16bpp support for S3 GENDAC + 801/805 (Harald Koenig).
+382. Updates to S3 GENDAC code -- program best matching clock frequency
+ (Harald Koenig).
+381. Fix most pixel shift problems for #9GXE64Pro (Hans Nasten and
+ Robin Cutshaw).
+380. Don't allow the S3 "dac_8_bit" option to have any affect at 16/32bpp,
+ and fix related problem when using the SC15025 RAMDAC.
+379. Fix problem with Spea Mercury (Norbert Distler).
+378. Documentation updates.
+377. Updates to SolX86 aperture driver config (David Holland).
+376. Don't write mouse speed setting commands when using a non-logitech
+ protocols.
+
+XFree86 3.0Fd (25 September 1994)
+375. AGX documentation updates (Henry Worth).
+374. Fix for text-mode restore problem with AGX server (Henry Worth).
+373. Change name of XF86Vga256Drivers to XF86SvgaDrivers.
+372. Documentation updates.
+371. Enable 16bpp, 32bpp for 964+Bt485.
+370. Support for 16bpp and 32bpp on 964+Bt485 -- tested so far on
+ Miro Crystal 20SV (Eddy Olk).
+369. Fix pixel wrapping for 964+Bt485 (Eddy Olk).
+368. Fix low-res mode support for GXE64Pro (Robin Cutshaw).
+367. Fix some depth 15 vs depth 16 code for the Ti3020 (Hans Nasten).
+366. Update W32 server (Glenn Lai).
+
+XFree86 3.0Fc (24 September 1994)
+365. Fix image shift at 32bpp on GXE64Pro (Hans Nasten).
+364. Only initialise TrueColor visual for 16/32bpp since DirectColor is
+ not appropriate for the hardware.
+363. Man page updates.
+362. Fix installation problems with XF86Config man page.
+361. Disable some code in vgawonder driver that leads to problems with
+ SuperProbe (Marc Aurele La France).
+360. Change clock ordering (in some cases) for vgawonder driver so it
+ now depends only on the clock chip used (Marc Aurele La France).
+359. Fix S3 VT switching problem with #9 GXE64Pro (Robin Cutshaw).
+358. Added README.SOLX86 (David Holland).
+
+XFree86 3.0Fb (23 September 1994)
+357. Enable ICS2595 clockchip support.
+356. Enable 32bpp for Ti3025+964.
+355. Change font cache and pixmap expansion allocation policy for S3
+ server. This allows better performance when there isn't much
+ offscreen memory available (Hans Nasten).
+354. Fix for banked ImageFill for bpp>8 (Hans Nasten).
+353. Updates to XF86_Accel man page.
+352. Remove references to 'Xconfig' in source code.
+351. Updates for ICS2595 code (Norbert Distler).
+350. Enable 16bpp for Spea Mercury.
+349. VTSema fixes for AGX server (Henry Worth).
+348. Updated 16bpp/32bpp support for 928+Bt485 (Norbert Distler).
+347. Partial support for 16bpp/32bpp with 964+Bt485 (Steve Parker).
+346. Fix Ti3025 pll save/restore, and set MCLK to 54.8MHz to eliminate
+ screen corruption (Hans Nasten).
+345. Fix for AGX tile SEGV (plus some cleanups) (Henry Worth).
+344. Update to solx86 aperture driver docs (David Holland).
+343. Fix problem with S3 mmio usage at 16bpp and 32bpp (Hans Nasten).
+342. Fix Mono VGA server crashes when compiled with gcc2.
+341. Updates to xterm for Linux to handle its UTMP style and lastlog
+ (Helmut Geyer).
+340. Remove some dependencies on removed cfb.banked.
+339. Fix Mach32 SW cursor SEGV.
+338. Prevent "nomemaccess" being used for S3 864/964.
+337. Change FreeBSD.cf to use gnumalloc for FreeBSD 2.x (Rich Murphey).
+336. Set weights correctly for Cirrus 32bpp (Harm Hanemaayer).
+335. Fix signal handling in xinit for SVR4 (David Holland).
+
+XFree86 3.0Fa (21 September 1994)
+334. Fix problems with cirrus top/left edge handling with HW cursor
+ (Simon Cooper).
+333. Fix GC problem causing S3 server crash at 16bpp and 32bpp.
+332. Added copyright to the output of reconfig.
+331. Fixes for vgawonder driver (Marc Aurele La France).
+330. Update README.ati and ati.test.c (Marc Aurele La France).
+329. Fix potential problem with transparent text for the cirrus 543x
+ (Harm Hanemaayer).
+328. Fixes for ICS2595 clock code (Norbert Distler).
+327. Remove cfb.banked.
+
+XFree86 3.0F (20 September 1994)
+326. Fix problem building reconfig when BuildServersOnly is YES.
+325. Updates to README.FreeBSD (Rich Murphey).
+324. Fix P9000 problem starting at 16bpp (Erik Nygren).
+323. Fix AGX screen saver, and a flash that occurs when switching into
+ XGA mode (Henry Worth).
+322. Preliminary support for the ICS2595 clock chip (not enabled yet)
+ (Norbert Distler).
+321. Fix pixel shift problem with GXE64Pro at 8bpp and 16bpp (Robin Cutshaw).
+320. Change clock doubler transition to 80MHz for Ti3025 (Robin Cutshaw).
+319. Add README.Bsdi (Hans Nasten).
+318. Removed the need to specify the "elsa_w1000pro" and "elsa_w1000isa"
+ Options.
+317. Remove "stealth64" and "miro_crystal20sv" Options -- they are no longer
+ needed.
+
+XFree86 3.0Ec (19 September 1994)
+316. Fixes for Ti3025 support -- fixes problem with machine lockups, and
+ adds preliminary 16bpp support (Robin Cutshaw).
+315. No longer allow 'Device' in the Keyboard section. Must now use
+ 'Protocol'.
+314. Updates to Cirrus BitBLT and fix for tile fill bug (Harm Hanemaayer).
+313. Disable Cirrus top/left edge HW cursor handling -- problems when
+ changing cursors near the edge.
+312. Fix another clock limit bug in S3 server.
+311. Disable Fresco by default.
+310. Updates to W32 server (Glenn Lai).
+
+XFree86 3.0Eb (18 September 1994)
+309. Updates to README.NetBSD (Matthieu Herrb).
+308. Fix Mode Flags error reporting in xf86Config.c.
+307. Fix sessreg for Linux and add an install rule for it (Leonard N. Zubkoff).
+306. Fix xdm support with shadow passwords for Linux (Leonard N. Zubkoff).
+305. Fix typo in bsdi.cf (Hans Nasten).
+304. Support for Ti3025/#9GXE64pro (Robin Cutshaw).
+303. Don't include s3_svga driver in SVGA server by default.
+
+XFree86 3.0Ea (17 September 1994)
+302. Update bsdi.cf so Gcc2 is default for versions 1.1 and later only
+ (Hans Nasten).
+301. Fix mfb.banked so it will compile with gcc 1.4x (Hans Nasten).
+300. Remove old Xconfig code.
+299. Fix some SEGV after FatalError() problems in xf86Config.c.
+298. Set max clock to 67.5MHz for Mach32 at 16bpp.
+297. Support for P9000 screen blanking at 16bpp and 32bpp (Erik Nygren).
+296. Merge in XC public fix-05.
+295. Trap bpp > 8 in S3 server for Bt485 and Ti RAMDACs since it doesn't work.
+294. Fixes for various xf86Config.c bugs.
+293. Fix S3 clock limits when using clock doubling RAMDACs.
+292. Fixes to Ti3025 code to prevent lockups (Robin Cutshaw).
+291. Move S3 Bt485 probe to after the Ti3020/5 probe (Robin Cutshaw).
+290. Fix cirrus HW cursor behaviour at top and left edges (Simon Cooper).
+289. Set background colour mapping of Cirrus HW cursor correctly
+ (Simon Cooper).
+288. Allow cirrus hardware cursor to be used when accel is turned off
+ (Simon Cooper).
+287. Don't build shared lib for LBX on Linux (Orest Zborowski).
+286. Add README.Linux (Orest Zborowski).
+285. Fix P9000 cursor problems when VT switching (Erik Nygren).
+284. Update P9000 server to work with XF86Config (Erik Nygren).
+283. Fixes for Solaris 2.4 x86 build problems with reconfig and shm.c
+ (Doug Anson).
+
+XFree86 3.0E (14 September 1994)
+282. Change the 'Device' entry in the Keyboard section of XF86Config to
+ 'Protocol'.
+281. Update the M magic formula for S3 server (Harald Koenig).
+280. Disable TI3025 support in S3 server -- it is incomplete.
+
+XFree86 3.0Dl (13 September 1994)
+279. XF86Config(4/5) manual page.
+278. LinkKit support for the W32 server.
+277. Change HW cursor code to position cursor next to the top/left edges
+ instead of disappearing (Harm Hanemaayer).
+276. Add code to the Cirrus driver to determine clock limits based on the
+ available DRAM bandwidth (Harm Hanemaayer).
+275. Add an "S3MNAdjust" entry to the Device section of the XF86Config
+ to allow tuning of the M and N parameters in the S3 server (Harald
+ Koenig).
+274. Add a Gamma entry to the Monitor section in the XF86Config (Harald
+ Koenig).
+273. Don't strip server binaries when installing.
+272. Set PLL limits in S3 server for S3 GENDAC and SDAC.
+
+XFree86 3.0Dk (11 September 1994)
+271. Add check for incorrect Modes line in XF86Config.
+270. Add some sanity checks to S3 server for supported depths.
+269. Fix SEGV during startup of VGA16 server.
+268. Support for HW cursor in the Cirrus driver (Simon Cooper).
+267. Fix LinkKit Imakefile for building SVGA server (Simon Cooper).
+266. Update lnxLib.rules for new dll tools (Orest Zborowski).
+265. Add code to the VGA servers to handle drivers (like tvga with 512k
+ in 256 colour mode) which require scaling of the raw clock to give
+ the pixel clock.
+264. Add code to the VGA servers to handle drivers (like the generic 256
+ colour driver) which use only builtin modes.
+263. Fix bitPerRGB reported by the SVGA server.
+262. ET4000/W32 accelerated server (Glenn Lai).
+261. Fix for AGX rect tile and stipple code (Henry Worth).
+260. Add checks for the presence of Modes lines to servers that require them.
+259. S3 code to handle limits imposed by clock chips.
+258. Fix S3 pMode->SynthClock code (Harald Koenig).
+257. Fix S3 raw clock setting for SC15025 (Harald Koenig).
+256. Fixes for Mach32ImageStipple (Mike Bernson).
+255. Improve AGX support for the Hercules dual RAMDACs, provide
+ better screen blanking at startup, and fix memory probe (Henry Worth).
+254. Add clockchip "ti3025" recognition (Hans Nasten).
+253. Fix xf86Config handling of ClockChip (Harald Koenig).
+252. Fix xf86Config handling of default colour weights (Harm Hanemaayer).
+251. P9000 updates (Erik Nygren).
+250. Fix SEGV problem in Mach32 font cache code.
+249. S3 code to handle clock/bpp/ramdac dependent raw-clock vs pixel clock
+ scaling.
+
+XFree86 3.0Dj (8 September 1994)
+248. Fixed and enabled ImageRead in CopyArea for P9000 server (Chris Mason).
+247. Fixed xdm server restart problem with P9000 server (Erik Nygren).
+246. Added a sample XF86Config file that gets installed as
+ $(LIBDIR)/XF86Config.eg.
+245. Change search method for XF86Config file. Only allow user-specified
+ location when real-uid == 0. Also change -xconfig flag to -xf86config,
+ and $XCONFIG to $XF86CONFIG.
+244. Fix reconfig's problem with "ps/2" (Orest Zborowski).
+243. External changes for W32 server (Glenn Lai).
+242. Change ELSA probe to check for BIOS signature first (Harald Koenig).
+241. Preliminary support for the Ti3025 & #9GXE64pro (Robin Cutshaw).
+
+XFree86 3.0Di (7 September 1994)
+240. Remove AGX server's dependence on VGA256 (Henry Worth).
+239. Fix display start address in vgawonder driver for Mach32 and Mach64
+ boards (Marc Aurele La France).
+238. Fix clock probing in vgawonder driver for Mach64 boards
+ (Marc Aurele La France).
+237. vgawonder driver now detects and rejects Mach32 boards without
+ VGA Wonder functionality (Marc Aurele La France).
+236. Add ClockChip XF86Config keyword for programmable clock chips.
+235. Add a FIFO_MODERATE option for AGX server (Henry Worth).
+234. Limited support for Big-RAMDAC and dual-RAMDAC for 2MB Hercules
+ Graphite cards (Henry Worth).
+233. Eliminate use of libvga256 in AGX server (Henry Worth).
+232. Convert AGX code to use the Ramdac keyword instead of Options (Henry
+ Worth).
+231. Fix (?) ELSA probe code's register restoral.
+230. Auto-detection code for the NetBSD aperture driver (Matthieu Herrb).
+229. Change OpStipple interface in font code (Hans Nasten and Jon Tombs).
+228. Fix clock and register restoration in P9000 server (Chris Mason,
+ Harry Langenbacher, Erik Nygren).
+227. Fix Orchid P9000 support (Harry Langenbacher).
+226. Fix BIOS Probe for Viper PCI (Bob Hollinger).
+225. 16bpp/32bpp support code for SVGA server. Cirrus 16bpp/32bpp support
+ is now enabled (Harm Hanemaayer).
+224. Fix Mach32 cache problems (Mike Bernson).
+223. Fix Mach32 memory probe.
+222. xf86Config and reconfig bug fixes.
+
+XFree86 3.0Dh (4 September 1994)
+221. Added minimal reconfig(1) man page so that 'make install.man'
+ doesn't fail.
+220. Combine Stealth64 and Miro Crystal 20SV code. This should fix
+ some Stealth64 problems.
+219. Fix InstallManPageAliases rule for FreeBSD (Ernest Hua).
+218. 16bpp and 32bpp support for Cirrus driver -- still requires some changes
+ to the SVGA server, so not enabled yet (Harm Hanemaayer).
+217. Fixes for Mach32 cache clipping problems (Mike Bernson).
+216. 32bpp S3 updates for ELSA cards (Harald Koenig).
+215. Updates to new XF86Config code.
+
+XFree86 3.0Dg (3 September 1994)
+214. Change over to new config file format -- XF86Config (Gertjan Akkerman).
+
+XFree86 3.0Df (31 August 1994)
+213. Amoeba support updates (Kees Verstoep).
+212. Fixes for Viper PCI support (Matt Thomas).
+211. MoveWindow acceleration for all depths on P9000, and acceleration
+ now enabled by default (Chris Mason).
+210. P9000 updates. Includes updates to sysconfig code, Orchid and PCI
+ support now enabled by default (Erik Nygren).
+209. SuperProbe and ModeDB updates (David Wexelblat).
+208. Support for the S3 805i and 16-bit RAMDACS (including ATT20C498,
+ STG1700, SDAC) (Bernhard Bender).
+207. Support for the S3 SDAC with S3 864 (Bernhard Bender).
+206. Basic support for ET4000W32 chipsets in the VGA servers. Includes
+ chipset detection and code to handle up to 4MB video memory (Harm
+ Hanemaayer).
+205. Mach32 server modified to use generic cache code (Mike Bernson).
+204. Allow pixmap expansion for display widths <= 800 in S3 server.
+203. Updates for SCO (including 3.2.4 and international crypt support)
+ (David McCullough).
+202. Use mi cursor for 32bpp on S3 928 because HW cursor is broken (Harald
+ Koenig).
+201. Fix nomemaccess code in s3im.c (Harald Koenig).
+200. Code to auto-detect ELSA Winner cards, and automatically enable the
+ icd2061a clock (Harald Koenig).
+199. Fix for 32bpp S3 font cache problems (Harald Koenig).
+198. Support for a linear addressing mode in the Cirrus driver (Harm
+ Hanemaayer).
+197. Performance improvements for the "fastvga256" asm code (Harm Hanemaayer).
+196. Fix for Cirrus problem caused by pvga1 probe.
+195. Code added to S3, Mach8 and VGA servers to delete modes from the
+ "Modes" line which would previously have caused the server to
+ not start (Stuart Anderson). Note: the Mach32 server already had
+ this code.
+
+XFree86 3.0De (20 August 1994)
+194. Add run-time check for SHM kernel support on FreeBSD and NetBSD.
+193. Updates to xload for Solx86 (David Holland).
+192. Fix NULL dereference in showfont (David Holland).
+191. xconsole and doc updates for NetBSD 1.0_BETA (Matthieu Herrb).
+190. Major Cirrus driver update. Includes faster solid, stipple and tile
+ filling, improved text acceleration, blt in background, shadow I/O
+ registers, optional MMIO support for 543x (Harm Hanemaayer).
+189. Support for the miroCRYSTAL 20SV (S3 964) (Eddy Olk).
+188. Preliminary 32bpp S3 support (Harald Koenig).
+187. Make TrueColor the default root visual for 15/16/24bpp S3 (Harald Koenig).
+186. Fix S3 16bpp for 1024x768 and 1152x900 and some panning problems
+ (Harald Koenig).
+185. Fix tiling problem, and VT switch problems for S3 16bpp (Harald Koenig).
+184. Fix for Ti3020 ramdac support at >8bpp (Robin Cutshaw).
+183. AGX server fixes. Includes CopyPlane, (vga) save/restore, SC15021 CLUT
+ access, scratchpad config. (Henry Worth).
+182. Merge in XC public fix-04.
+
+XFree86 3.0Dd (12 August 1994)
+181. Fix for unnecessary read-ahead in mfbblt, and remove the '-32' display
+ width restriction (Pascal Haible, Gertjan Akkerman).
+180. Support for SGS/inmos STG1700 RAMDAC -- S3 server (Bernhard Bender).
+179. Performance improvements for AGX server (Henry Worth).
+178. More 15/16bpp fixes for S3 (Harald Koenig).
+
+XFree86 3.0Dc (11 August 1994)
+177. Various 15/16bpp S3 fixes (Jon Tombs, Harald Koenig).
+176. 16bpp support for ATT 20C490 (Jon Tombs).
+175. 16/24/32bpp code for SC15025 (Harald Koenig).
+174. Support for gamma correction in S3 server (Harald Koenig).
+173. Probe code for the SC15025 (S3 server and SuperProbe) (Harald Koenig).
+
+XFree86 3.0Db (6 August 1994)
+172. Patches for N.M value trimming (Harald Koenig).
+171. ATT20C498 and 864 support for 15/16/24bpp in S3 server (Harald Koenig).
+170. Ti3020 and Bt485 Ramdac support for 15/16/24bpp in S3 server
+ (Robin Cutshaw).
+169. Fix problems building debugging libFS (Christos Zoulas).
+168. Remove XOR'd extended register addressing in S3 server.
+
+XFree86 3.0Da (3 August 1994)
+167. Use XOR'd extended register addresses for S3 server -- avoids clash
+ with "COM4" I/O address (Jon Tombs).
+166. 16bpp S3 support (no ramdac initialisation yet) (Jon Tombs).
+
+XFree86 3.0D (1 August 1994)
+165. Fix for text restore problems with cl6420 driver (Manfred Brands).
+164. Change S3 screensaver code to do the same thing as the vga256 code
+ (Bernhard Bender).
+163. Update Cirrus driver for vga256 changes (Harm Hanemaayer).
+162. Fixes for font scaling problems on SVR4 (David Wexelblat).
+161. Remove all of the old unused pixmap cache code (David Wexelblat).
+160. Use generic font cache code for S3 server (David Wexelblat).
+159. Native AGX code for Save/RestoreAreas, CopyWindow and PaintWindow
+ (Henry Worth).
+158. Change AGX clock mappings -- see README.agx for details (Henry Worth).
+157. Update AGX server for vga256 changes (Henry Worth).
+156. Xtest fix for Linux (Erik Nygren).
+155. Speedup for cached text output in Mach8 and 8514 servers (Hans Nasten).
+154. Workaround for 6225 with LCD where full on white pixels cause display
+ problems (Philip Homburg).
+153. Fix memory handling for Mach8 boards with the SVGA vgawonder driver
+ (Marc Aurele La France).
+152. Fix some build problems on NCR SVR4 (Stuart Anderson).
+151. Fix problem which caused xjewel to lock up the S3 server when running
+ in linear mode (Harald Koenig).
+150. xman support for gzip'd man pages.
+149. Fix LinkKit problems.
+148. Omit monitor ID check in 8514 server.
+147. Fix card ident problem with ati driver.
+146. Fix asm problem in new pvga1/bank.s.
+145. Fix programs/Imakefile error.
+
+XFree86 3.0Ce (24 July 1994)
+144. Alternate "SlowBcopy()" which avoids I/O (which causes problems on
+ some cards) (Glenn Lai).
+143. Restore original mouse baud rate when exiting and VT switching (Harald
+ Koenig).
+142. pvga1 driver updates. Includes 90C33 support for 2MB, and accel code
+ updates (Bill Conn and Bill Morgart).
+141. Major updates to the SVGA ATI vgawonder driver. Includes support for
+ 4MB, probe code to detect Mach8, Mach32 and Mach64 boards, RAMDAC
+ detection, clock probe update to handle the clock chip used on Mach64
+ boards, and fixes for V3, V4 and V5 boards (Marc Aurele La France).
+140. Support for BuildServersOnly option to build only the servers using
+ a cut-down source tree (Gertjan Akkerman).
+139. Preliminary P9000 accelerated support (currently incomplete and
+ disabled by default) (Chris Mason and Erik Nygren).
+138. Preliminary Viper PCI, Orchid P9000 support (currently disabled by
+ default) (Erik Nygren).
+137. Replace the cfb.banked code with fb code which relies more on the
+ standard cfb code. For further details see the file "Design" in
+ xfree86/vga256/vga/ (Stuart Anderson).
+
+XFree86 3.0Cd (22 July 1994)
+136. Add dacspeed Xconfig keyword, and modify the S3 server to use it.
+135. Update contrib source to the XC's full release version.
+134. Fix pixel doubling problem on #9 GXE64 cards (Robin Cutshaw).
+133. Change '--print' to 'print-libgcc-file-name' in Linux config files
+ for compatibility with gcc 2.6 (Orest Zbrowoski).
+
+XFree86 3.0Cc (19 July 1994)
+132. Make use of the Xconfig Ramdac keyword in the S3 server.
+131. Improved support for the ELSA W2000Pro (Dirk Hohndel).
+
+XFree86 3.0Cb (16 July 1994)
+130. Updated xc/bug-report for XC fix-03.
+129. Don't mark duplicate clocks as zero in VGA servers.
+128. Support for #9GXE64 in S3 server (Robin Cutshaw).
+127. Tiled pixmap/stipple expansion for the S3 server (David Wexelblat).
+126. Tiled pixmap/stipple expansion for Mach8 and 8514 servers (Hans Nasten).
+125. P9000 updates. Includes colour restoration fix, changes in Modes
+ processing, and removal of banking support (Erik Nygren).
+124. 16 and 32 bpp TrueColor support for the P9000 server (Erik Nygren).
+123. Updates to AGX server. Includes font cache fixes, line fixes and
+ some more tuning options (Henry Worth).
+122. Aperture driver for NetBSD (Matthieu Herrb).
+121. Added basic man page for beforelight (Rich Murphey).
+120. Swap order of libXExExt and libXext.
+119. Remove the temporary Mach32ShareCfb option.
+
+XFree86 3.0Ca (28 June 1994)
+118. NetBSD updates (Christos Zoulas).
+117. Various updates for Minix (Philip Homburg).
+116. Support for including the MIT-SCREEN-SAVER extension (David Holland).
+115. Fixes for AGX font cache code (Henry Worth).
+114. Banking support for P9000 (doesn't seem to work yet) (David Moews).
+113. Text restoration code for P9000 (Chris Mason).
+
+XFree86 3.0C (22 June 1994)
+112. Fix server crash when started with a lock key on.
+111. Recognise 864/964 PCI as capable of linear memory access.
+110. Fix ramdac access and clock probe problems with AGX server (Henry Worth).
+109. Support for Stealth 64 (S3 964 + Bt485) (Steven Parker).
+108. Fix for 4-pixel border problem with S3 864 pixmux (Harald Koenig).
+107. Allow the S3 SVGA driver to recognise the 864 and 964 (Harald Koenig).
+106. Improved 5434 support, and accelerated copyPlane1to8 for cirrus
+ (Harm Hanemaayer).
+
+XFree86 3.0Bc (19 June 1994)
+105. Fix VT switch problem in 16bpp Mach32 when sharing cfb.
+104. Add framework for a ramdac Xconfig setting (like chipset).
+103. Reorganise mode/clock matching code (Marc Aurele La France).
+102. Fix server's client count problem after authorisation failure.
+101. Option "power_saver" to enable power-down mode on "green" monitors.
+ So far this is implemented only for VGA (all depths) and S3 servers.
+100. Remove old "memaccess" S3 option.
+ 99. Add Option "pci_hack" to work around a lockup problem reported with
+ some 928-P cards.
+ 98. Fix S3 928-P detection/reporting.
+ 97. Don't allow S3 "nomemaccess" option for 864/964 chipsets.
+ 96. Make cbrt a library -- removes the need for NeedCbrt on Linux
+ (Marc Aurele La France).
+ 95. Change ATI SVGA driver to Marc Aurele La France's version
+ (includes support for Vga2 and Vga16).
+ 94. Function prototyping for AGX, and prototype cleanup in vga16 (Stuart
+ Anderson).
+ 93. Fix (not complete?) problem with dual-headed servers.
+
+XFree86 3.0Bb (16 June 1994)
+ 92. AGX server (Henry Worth).
+ 91. Accelerated support for 90C33 (Bill Conn).
+ 90. Use s3ImageWriteFunc to load S3 cursor.
+ 89. Fix problems with SPEA Mercury for clocks > 120MHz (Norbert Distler).
+ 88. Code to program S3 GENDAC clock (Clocks "s3gendac") (Jon Tombs).
+ 87. Fix some build problems with lbx.
+ 86. Build servers with -DAVOID_GLYPHBLT.
+
+XFree86 3.0Ba (11 June 1994)
+ 85. Preliminary ELSA Winner 2000PRO support (S3 964) (Dirk Hohndel).
+ 84. Updates to S3 864 support (Harald Koenig).
+ 83. Merge in XC fix-02.
+
+XFree86 3.0B (6 June 1994)
+ 82. bitblt fixes (including big memory leak) for 8514, Mach8, Mach32 and
+ S3 servers (Tiago Gons).
+ 81. line/seg fixes for 8514 and Mach8 servers (Tiago Gons).
+ 80. Remove separate cfb libs for Mach32 (only compile-tested so far).
+ 79. Restore hw/xfree86/etc directory.
+ 78. Update bsdinst.sh for SVR4 (use /usr/ucb/install, and run 'mcs -d'
+ as well as strip).
+ 77. Cirrus driver updates (Harm Hanamaayer).
+ 76. Mach support (Robert Baron).
+
+XFree86 3.0Ac (1 June 1994)
+ 75. Amoeba fixes (Kees Verstoep).
+ 74. Fixes for Mach32 dashed line/segment code (Mike Bernson).
+ 73. Preliminary 90C33 support (Bill Conn).
+ 72. NetBSD.cf updates, and README.NetBSD added (Matthieu Herrb).
+ 71. Preliminary support for the ELSA Winner 1000PRO-VL-2 (Harald Koenig).
+ 70. Add "weight" and "displayWidth" entries to ScrnInfoRec.
+ 69. Banked vga2 server (Pascal Haible).
+ 68. Font cache changes for the Mach8 and 8514 servers. This allows them
+ to work without a font cache, and should allow their use with 512k
+ Mach8 cards. (Hans Nasten)
+ 67. Don't include XIE in the Mono and VGA16 servers (it doesn't handle
+ bit-order != byte_order).
+ 66. Add LinkKit and updated VGADriverDoc.
+
+XFree86 3.0Ab (28 May 1994)
+ 65. Add support for gzip'd man pages on FreeBSD.
+ 64. P9000 server (Erik Nygren).
+ 63. Video7 SVGA driver (Craig Struble).
+ 62. CL6420 SVGA driver (Manfred Brands).
+ 61. Set default paths for xdm for *BSD (so {Give,Take}Console can find chown).
+ 60. Add a hw/xfree86/doc directory, and start putting the docs back.
+ 59. Fixes for Amoeba support (Kees Verstoep).
+
+XFree86 3.0Aa (22 May 1994)
+ 58. Merge in XC public fix-01.
+ 57. Updates to FreeBSD.cf.
+ 56. Add xf86site.def which can optionally be included from site.def.
+ 55. SCO support and some bug fixes (David McCullough).
+ 54. Some initial untested S3 864/964 code (Harald Koenig).
+ 53. Fix for bsdLib.tmpl.
+ 52. STREAMSCONN fixes for xdm, chooser and Xserver XDMCP code (Stuart
+ Anderson).
+
+XFree86 3.0A (15 May 1994)
+ 51. SVGA driver for the AL2101 chipset (Paolo Severini).
+ 50. SVGA driver for the MX68000 and MX68010 chipsets (Frank Dikker).
+ 49. Updates to the Cirrus driver (Harm Hanemaayer). Includes code cleanup,
+ mono support, improved handling of the 5430, 5434, and transparent
+ text acceleration.
+ 48. Preliminary code for detecting S3 864/964 and AT&T 20C498 (Harald Koenig).
+ 47. Generic VGA256 driver -- works only at 320x200 (Harm Hanemaayer)
+ 46. Fixes for vga2/mfb and vga16/mfb Imakefiles.
+ 45. Include SuperProbe.
+
+XFree86 3.0d (8 May 1994)
+ 44. Add missing files to vga2/mfb.
+ 43. Set VendorString and VendorRelease up for XFree86.
+ 42. Workaround for STREAMSCONN Xdmcp problems (Xserver and xdm).
+ 41. 16 bit (directcolor) support for Mach32 (Craig Groeschel).
+ 40. Minix 3886vm support (Philip Homburg).
+
+XFree86 3.0c (6 May 1994)
+ 39. Fixes for Solaris X86 (Doug Anson).
+ 38. No longer link the Mono and VGA16 servers with Xserver/mfb/libmfb.a.
+ 37. Updates to the VGA16 code (Gertjan Akkerman). Includes banking support
+ (old-style rather than the Xsvga method), staticcolor visual, oak
+ driver enabled, added some missing files to vga16/mfb.
+ 36. Fix Linux shared libs (Orest Zborowski)
+ 35. Apollo mono driver (Hamish Coleman)
+ 34. Support for dual-headed vga2+mono and vga16+mono servers (Pascal Haible).
+ 33. Reorganisation of the mono server (Pascal Haible). Includes removing
+ xfree86/bdm2, xfree86/hga2, and replacing them with xfree86/mono.
+ 32. Fixes for PEX font compiler (from our 940327a snapshot).
+ 31. Fix SIOCGIFCONF code in xdm and Xserver for SVR4 (with Lachman TCP)
+ and FreeBSD. There are still xdm and chooser problems on SVR4.
+
+XFree86 3.0b (29 April 1994)
+ 30. Add S3 driver to SVGA server.
+ 29. Disable accelerated text blit for Cirrus 543x.
+ 28. Reorder some of the Bt485 code, and get clock doubling working again
+ without pixmux.
+ 27. Fix image shift problem for pixmux on #9 cards (Robin Cutshaw).
+ 26. Fix initialisation bug for Cirrus 62{2,3}5 cards (Harm Hanemaayer).
+ 25. Remove 8514 monitor ID check in Mach8 server.
+ 24. Fix for problem with compaq driver.
+ 23. Add "no_bitblt" option for the cirrus driver.
+ 22. Recognise the 5429 in the cirrus driver.
+ 21. Disable interrupts while programming the ICD2061A.
+ 20. sync-on-green support for the TI3020.
+ 19. Move S3 clock doubler setting from icd2061ClockSelect() to s3Init().
+ 18. Fix dac_8_bit for Bt485 cursor, and fix Bt cursor blanking problem.
+ 17. S3 pixmux support for STB Pegasus, and cleanup of pixmux and icd code.
+ (Leonard Zubkoff).
+ 16. Change "fifo_conservative" setting for CLGD543x.
+ 15. Don't reserve video memory for HW cursor on S3 when using a RAMDAC cursor.
+ 14. Allow the "8clocks" option to force 9 clocks instead of 17 on WD90C3{0,1}
+ cards.
+ 13. Fix some DEALLOCATE_LOCAL problems in accel servers.
+ 12. Support for Bt485 on #9 cards (Robin Cutshaw).
+ 11. Fixes for Cirrus driver (Harm Hanemaayer).
+ 10. Fix for text restore problem on some S3 cards (Jon Tombs).
+ 9. Workaround for Mach32 detection problem on some platforms.
+ 8. Fix incorrect usage of $(DESTDIR) in some lnxLib.rules.
+ 7. Code to detect 928-P (Harald Koenig).
+ 6. Fix cbrt() in mi/ so that it can handle negative arguments.
+ 5. Fix for line clipping problem in cfb.banked (Glenn Lai).
+
+XFree86 3.0a (28 April 1994)
+ 4. Add XFree86 server names to the list in xinit.
+ 3. Set XawI18nDefines correctly for SVR4.0.
+ 2. Update ncr.cf to pick up AllocateLocalDefines when building servers.
+ 1. Fold in client/lib OS support not picked up by the XC.
+
+XFree86 3.0 (26 April 1994)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.826 1999/08/31 08:39:04 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG.ND b/xc/programs/Xserver/hw/xfree86/CHANGELOG.ND
new file mode 100644
index 000000000..3c9e1e1f6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG.ND
@@ -0,0 +1,418 @@
+XFree86 3.9jw (31 July 1998)
+1327. Fix a crash in the chips driver when the chipset is specified in the
+ config file (#1846, Taketoshi Sano).
+1326. Add more Pm2 acceleration and add DPMS support for all glint chips
+ (#1844, Alan Hourihane).
+1325. Add 8x8 pattern trapezium fills, screen to screen colour expansion
+ to the MGA driver, and fix a clipping bug with colour expansion
+ (#1843, Mark Vojkovich).
+1324. Add Screen->Screen colour expansion to XAA (#1841, Mark Vojkovich).
+1323. Fix negative widths and heights in XAA's wide line code (#1840,
+ Alan Hourihane).
+1322. Fix an XAA tiled rect alignment problem (#1839, David Bateman).
+1321. Fix XAA 8x8 mono for 24bpp.
+
+XFree86 3.9jv (24 July 1998)
+1320. Fix the BitsPerPixel() macro in cfb.h for 24bpp.
+1319. Update XAA docs (#1838, Mark Vojkovich).
+1318. Add colour expansion stipples to XAA (#1837, Mark Vojkovich).
+1317. Add a stipple replacement for the MGA driver that takes into account
+ the 256K blit maximum per operation (#1836, Mark Vojkovich).
+1316. Fix C&T memory clock messages (#1834, David Bateman).
+1315. Add some new colour expansion code for older tseng chips (W32/W32i)
+ (#1832, Koen Gadeyne).
+1314. Preliminary tseng XAA support (#1832, Koen Gadeyne).
+1313. Resync the tseng driver with the main branch version (#1832,
+ Koen Gadeyne).
+1312. Some C&T updates (#1833, David Bateman).
+1311. Speed up GXcopy for XAAFillCacheBltRects (#1831, David Bateman).
+1310. Remove some code duplication in the C&T driver (#1830, David Bateman).
+1309. Add 8x8 colour and mono fills for 8bpp and 16bpp for all C&T chips
+ and 8x8 mono fills at 24bpp for HiQV chips (#1830, David Bateman).
+1308. Fix problems with XAA 8x8 patterns (#1830, David Bateman).
+1307. Get 4bpp working with C&T chipsets, and add the ShowCache option to
+ the C&T driver (#1829, David Bateman).
+
+XFree86 3.9ju (19 July 1998)
+1306. Calculate DPI from the DisplaySize entry in the Monitor section
+ if present.
+1305. Implement "tri-state" options.
+1304. Move most of cfbcmap.c to mi.
+1303. Update the C&T driver for recent XAA ImageWrite changes, and fix
+ some bugs in CHIPSHiQVWritePixmap (#1824, Nozomi Ytow).
+1302. Optimised horizontal and vertical lines for MGA (#1823, Mark Vojkovich).
+1301. Fix some XAA bugs (#1822, Mark Vojkovich).
+1300. Major updates to the XAA documentation (#1821, Mark Vojkovich).
+1299. Update XAA for the EnterVT type change (#1821, Mark Vojkovich).
+1298. Add scanline ImageWrites to XAA (#1821, Mark Vojkovich).
+1297. Make XAA Alpha friendly (#1821, Mark Vojkovich).
+1296. Set pScrn->vtSema to FALSE in ChipCloseScreen() after restoring the
+ video hardware state.
+1295. Move xf86SetDpi() calls into PreInit().
+1294. Don't show module version info on subsequent loads.
+
+XFree86 3.9jt (18 July 1998)
+1293. Add IBM 528A to the ramdac module (#1820, Alan Hourihane).
+1292. Make it a fatal error when any AddScreen() call in XFree86's InitOutput()
+ fails.
+1291. Change the type of EnterVT() from void to Bool, and make it a fatal
+ error for this to fail.
+1290. Add a helper xf86SetBlackWhitePixels() to set the values according
+ to the presence of the -flipPixels command line option.
+1289. Add xDpi and yDpi fields to the ScrnInfoRec, and a helper xf86SetDpi()
+ to set them.
+1288. Allow a bus type prefix for BusID strings.
+1287. Remove the global xf86VTSema (David Bateman, David Dawes).
+1286. Complete the XAA 8x8 pattern caching (#1817, Mark Vojkovich).
+1285. Add a missing Millennium accel flag (#1816, Mark Vojkovich).
+1284. Make the CRTC blanking setting exact rather than allowing some unblanked
+ overscan area (#1813, Koen Gadeyne).
+1283. Prelminary TGA (AXP only) driver (#1811, 1818, Alan Hourihane).
+1282. Prelminary Bt485 ramdac support for the ramdac module (#1809, 1815,
+ Alan Hourihane).
+1281. OS-support and config updates for AXP (#1808, Alan Hourihane).
+1280. Add code to the ramdac module for initialising gamma correction
+ (1807, Alan Hourihane).
+1279. Fix C&T HiQV PCI bus support (#1802, David Bateman and Nozomi Ytow).
+1278. Add HW cursor support for the Permedia2v (#1812, Alan Hourihane).
+1277. Remove most vgahw dependencies from the glint driver (#1810,
+ Alan Hourihane).
+1276. Add preliminary support for the Permedia2v to the glint driver
+ (#1800, 1810, Alan Hourihane).
+1275. Some C&T updates (#1791, 1796, Nozomi Ytow, David Bateman).
+1274. Reintegrate Harm's XAA SolidArc code (#1814, David Bateman).
+1273. Make sure assembler usage is set correctly for x86 when MakeDllModules
+ is true (#1806, David Bateman).
+1272. Fix too little data being sent by the XAA BitmapScanline when the
+ number of dwords sent was divisible by four (#1806, David Bateman).
+1275. Fix for the swapping of fg and bg in the XAA WriteBitmap primitives
+ (#1806, David Bateman).
+1274. Add TRIPLE_BITS_24BPP code for the XAA WriteBitmap function (#1806,
+ David Bateman).
+1273. Attempts at optimised 6 and 8 pixel drawTETextScanline functions
+ in assembler (#1789, 1806, David Bateman).
+1272. Remove some redundant extern declarations (xf86Procs.h & xnest)
+ (#1790, Marc La France).
+1271. xf4bpp now loads xf1bpp (#1790, Marc La France).
+1270. Make vgahw module load cfb (re: cfbExpandDirectColors()) (#1790,
+ Marc La France).
+1269. Fix vgahw's saving/restoring of text modes, overscan handling
+ and memory leaks (#1790, Marc La France).
+1268. Fix compilation warnings in libc wrapper (Marc La France).
+1267. Rewrite VGA generic driver (Marc La France).
+1266. Fix bug that nullified the driver's mode list when deleting the
+ second-to-last mode (#1790, Marc La France).
+1265. Reduce verbosity level of the message that gets printed when
+ a driver's ValidMode() rejects a mode (#1790, Marc La France).
+1264. Allow drivers to supply a default mode (#1790, Marc La France).
+1263. Allow for more than 4 (== MAXSCREENS) drivers to probe a system
+ (1790, Marc La France).
+1262. Fix xf4bpp integration (#1790, Marc La France).
+1261. Implement -dpi flag and -flippixels flags (#1790, Marc La France).
+1260. Fix CLKDIV2 support (#1790, Marc La France).
+1259. Implement multiscanned modes (#1790, Marc La France).
+1258. Fix some depth/bitsPerPixel confusion (#1790, 1799, Marc La France).
+1257. Fix memory leaks in the MITSHM and dix pixmap code (#1790,
+ Marc La France).
+1256. Fix a minor header problem in the Type1 code (#1790, Marc La France).
+
+XFree86 3.9js (12 July 1998)
+1255. Make sure DPMSEnabled gets set correctly.
+1254. Use a BlankScreen function with xf86GetClocks() that takes more
+ appropriate arguments than SaveScreen.
+1253. Fix SEGV in TsengProbe() when there are no Tseng cards present.
+1252. Add caching of 8x8 patterns to XAA (#1787, Mark Vojkovich).
+1251. XAA updates, including TRIPPLE_BITS_24BPP, check QWORD padding in
+ the font rendering, and an attempt at Pentium optimised assembler
+ for 6 pixel wide TE font (#1785, David Bateman).
+1250. Fix an omission in xf86MatchPciInstances() (#1786, Kevin Martin).
+1249. Numerous C&T driver fixes and HW cursor support added (#1781-1783,
+ David Bateman).
+1248. Add support for 1, 8, 16, 32 and 64 bit interleaves to the XAA
+ hardware cursor code (#1780, David Bateman).
+1247. Fix a segfault in xf86DPMSInit() (#1780, David Bateman).
+1246. Some updates to the ramdac module (#1777, 1778, Alan Hourihane).
+1245. Add 500TX support to the glint driver (#1777, Alan Hourihane).
+1244. Fix parsing of ModeLine keyword (#1779, Keldon Jones).
+
+XFree86 3.9jr (5 July 1998)
+1243. Avoid mishandling 64-bit PCI base addresses, and "safely" avoid them.
+1242. Fix font modules so that clients can use the font libraries
+ (#1774, Alan Hourihane, David Dawes).
+1241. Fix for XAA GC problems that show up when backing store is enabled
+ (#1775, Mark Vojkovich).
+1240. Fix for xf86MatchPciInstances() (#1773, Alan Hourihane).
+1239. Unload drivers in InitOutput that end up not being used.
+1238. Make the ScrnInfoRec.privates persistent rather than per-generation
+ data.
+1237. Remove the "requiredModules" field from the ScrnInfoRec and have the
+ drivers load the modules they need explicitly. The loader and parts
+ of the design have been updated to take this into account.
+1236. Remove refcount code added in change 1175, and fix problem with the
+ preexisting refcount code not incrementing the count when modules
+ are loaded second and subsequent times.
+1235. Add more info for LoaderPrint{Symbol,Address} functions (1772,
+ Stuart Anderson).
+1234. Fix some Linux/Alpha loader problem (#1772, Stuart Anderson).
+
+XFree86 3.9jq (3 July 1998)
+1233. Loadable font modules (#1767, Alan Hourihane).
+1232. Add Option "ShowCache" to allow scrolling down to see part of the
+ pixmap cache (#1770, Mark Vojkovich).
+1231. Fix MGA loss of sync problem when scrolling the desktop (#1770,
+ Mark Vojkovich).
+1230. Add XAA cursor support to the MGA driver (#1770, Mark Vojkovich).
+1229. Have XAA wrap the EnterVT and LeaveVT functions so that it can
+ invalidate the pixmap cache. Also further progress towards
+ getting 8x8 patterns cached (#1769, Mark Vojkovich).
+1228. XAA cursor support. Only the TVP3026's style cursor data packing
+ (ie. source and mask not interleaved) is supported at the moment
+ (#1768, 1771, Mark Vojkovich).
+1227. Implement correct CRTC blanking timings (Koen Gadeyne).
+1226. Lots up updates to the Tseng driver (Koen Gadeyne).
+1225. Chips & Technologies driver converted to ND (#1761, David Bateman).
+1224. Ramdac/colourmap module. Support for IBM ramdac so far (#1759, 1760,
+ Alan Hourihane).
+1223. Set the Crtc[HV]Adjusted flags more appropriately in
+ xf86SetCrtcForModes() (#1757, David Bateman).
+1222. Change xf86MatchPciInstances() to work with drivers supporting chips
+ from more than one vendor (#1753, 1754, Alan Hourihane).
+
+XFree86 3.9jp (27 June 1998)
+1221. Preliminary tseng driver (Koen Gadeyne).
+1220. Add the Xv extension (from the R5 contrib) (#1749, Mark Vojkovich).
+1219. Fix a rendering error in cfb's bit expansion code that can show
+ up with a very complex clip mask (#1747, Jens Owen).
+1218. Allow XAA's pixmap cache to use smaller slots when the larger ones
+ are not available (#1751, Mark Vojkovich).
+1217. Document the offscreen memory manager (#1747, Mark Vojkovich).
+1216. Fixes and temporary workarounds for mibank problems detected by xf4bpp
+ (#1743, Marc La France).
+1215. Fix a XF68_FBDev typo (#1743, Marc La France).
+1214. Fix up cfb and mfb header files (#1743, Marc La France).
+1213. Fix up xf1bpp's integration into the new design (#1743, Marc La France).
+1212. Introduce xf4bpp, a port of vga16 to the new design (#1743,
+ Marc La France).
+1211. Allow for zero to be a valid setting for chipID and chipRev. These
+ are now initialised to -1 to indicate when they have not been set.
+
+XFree86 3.9jo (22 June 1998)
+1210. Add accelerated solid trapezoid fills to the MGA driver (#1740,
+ Mark Vojkovich).
+1209. Add accelerated polygons and wide lines to XAA, and fix some pixmap
+ cache problems (#1739, Mark Vojkovich).
+1208. Move the offscreen memory manager from XAA to xfree86/common
+ (#1739, 1741, Mark Vojkovich).
+1207. Fix a typo in the glint driver (#1737, Alan Hourihane).
+1206. Resync the parser with the common layer data structures, removing
+ some obsolete things and adding a few missing things.
+1205. Include the class/subclass/interface values in pciVideoRec.
+
+XFree86 3.9jn (21 June 1998)
+1204. Replace the "MAGIC" module init interface with the more general
+ SetupProc/TearDownProc interface.
+1203. Fix some typos in the DESIGN doc (Koen Gadeyne).
+1202. Add some more acceleration to XAA, and support for it to the MGA
+ driver (#1732, 1733, 1735, Mark Vojkovich).
+1201. Preliminary pixmap cache support and offscreen memory manager added
+ to XAA (#1732, 1734, 1736, Mark Vojkovich).
+1200. Fix linepitch handling in the glint driver (#1731, Alan Hourihane).
+
+XFree86 3.9jm (15 June 1998)
+1199. Add preliminary infrastructure for different pixmap and framebuffer
+ formats.
+1198. Start a module/driver name space registry.
+1197. Accelerated glint driver (#1725-1727, Alan Hourihane).
+1196. Resync the PCI IDs.
+1195. Update xf86GetPciInfoForScreen() and add a similar
+ xf86GetIsaInfoForScreen().
+1194. Update DGA support code in the common layer.
+1193. Update DPMS support code in the common layer.
+1192. Reintroduce xf86GetClocks() as a helper.
+
+XFree86 3.9jl (9 June 1998)
+1191. Bring over the serial port functions (from Metro Link).
+1190. Bring over the os-support/pmax code.
+1189. Change the interface for xf86MatchPciInstances() to use separate
+ lists of PCI chipset names and IDs.
+1188. Fix some build problems on SVR4.0 and Solaris.
+1187. Rename xf1bpp_mfb* entry points to xf1bpp (#1714, Marc La France).
+1186. Port some recent vga16 changes over to the nd branch (#1714,
+ Marc La France).
+1185. Remove CloseScreen() and SaveScreen() from ScrnInfoRec's (#1714,
+ Marc La France).
+1184. m68k's XF86_FBDev now uses low-level backing store functions
+ during VC switches (#1714, Marc La France).
+1183. Push out backing store and banking wrapper initialisation to the
+ to the callers of the various <framebuffer>ScreenInit()'s. This allows
+ XAA to wrap screens after banking, but before backing store (#1714,
+ Marc La France).
+1182. Allow screen wrappers to free their private data on server reset and
+ termination (#1714, Marc La France).
+1181. Minimise the number of public globals in the common layer, and replace
+ those the drivers need with functions to access their values.
+1180. Update the PCI code to match that on the main branch.
+
+XFree86 3.9jk (4 June 1998)
+1179. Change the Xserver binary name to "XFree86".
+1178. Add support for building a static Xserver.
+1177. Clean up some of the module Imake config stuff.
+1176. Fix generic vga driver probe crash.
+1175. Keep a reference count for loading modules and avoid loading the
+ same module twice.
+1174. A first attempt at ABI versioning the modules and checking it
+ in the loader.
+1173. Add a canonical naming for modules, without things like the "lib"
+ prefix or "_drv" suffix.
+1172. Add the -layout and -screen options to allow a layout or screen section
+ to be specified from the command line.
+1171. Make the interface in the xf86Find{Vendor,Layout} parser functions
+ consistent with the others.
+
+XFree86 3.9jj (31 May 1998)
+1170. Add call to LoaderCheckUnresolved().
+1169. Add finding the correct Display subsection to the xf86SetDepthBpp()
+ helper (David Dawes).
+1168. Some os-support layer cleanups (more required).
+1167. Add a new helper to simplify the driver Probe() code for PCI cards
+ (David Dawes).
+1166. Remove some fields from the ScrnInfoRec.
+1165. Add a set of option handling functions and helpers to the common layer.
+ These allow the option data structures to be opaque to the drivers
+ (David Dawes).
+1164. Add xstrdup (Xstrdup) to os/utils.c, and treat xf86strdup the same way
+ as xf86malloc in the libc wrappers.
+1163. Fix XAA 14 pixel width fonts (#1699, Mark Vojkovich).
+1162. Fix XAA CopyGC crash (#1698, Mark Vojkovich).
+
+XFree86 3.9ji (23 May 1998)
+1161. MGA Support for the new XAA code (#1697, Mark Vojkovich).
+1160. New XAA code (#1695, 1696, Mark Vojkovich).
+1159. Millennium 2 (inc AGP) support for the mga driver (#1697,
+ Mark Vojkovich).
+
+XFree86 3.9jh (22 May 1998)
+1158. Fix 'Unknown symbol type 1e' messages in the a.out loader
+ (#1683, Matthieu Herrb).
+1157. Loader updates, including Alpha and PowerPC support (#1467, 1666,
+ Metro Link).
+1156. Add '-Wall' to gcc compile options
+1155. Add Xarch.h (#1399, Metro Link).
+1154. Resync libc/ansic wrappering.
+
+XFree86 3.9jg (3 May 1998)
+1153. Remove ilbm's call to miRegisterGCPrivateIndex(), which no longer
+ exists (#1670, Marc La France).
+1152. Fix problems with mi generic functions in mibank (#1670,
+ Marc La France).
+1151. Symbolically link xf86_ansic.h so osPexFont.c can #include it
+ (#1670, Marc La France).
+1150. Fix opaque types in xf86_libc.h (#1670, Marc La France).
+1149. Fix a typo in mibank which makes miScanLineWidth() always fail.
+1148. Fix various missing symbols that show up when attempting to use
+ non-dlopen modules.
+
+XFree86 3.9jf (18 April 1998)
+1147. Add xf1bpp framebuffer for use by vga2 and mono (i.e. hga2)
+ drivers. This is just a copy of mfb compiled for the bitmapScanlinePad
+ and bitmapBitOrder needed by these hardware framebuffers (#1636,
+ Marc La France).
+1146. A mode that fails validation (for whatever reason) no longer
+ affects the resulting virtual resolution (#1636, Marc La France).
+1145. miScanlineWidth() is now passed the hardware plane pixmap format
+ rather than nBankBPP (the harware plane bpp) and nPixelBPP (the
+ "total" bpp), and have xf86ValidateModes() call miScanLineWidth()
+ to determine an appropriate line pitch for the virtual resolution
+ requested (#1636, Marc La France).
+1144. Remove the helpers' concept of pixelArea as this can be derived
+ from videoRam and bitsPerPixel, express pitchInc in bits, and
+ pass apertureSize to mode validation helper (#1636, Marc La France).
+1143. Introduce the new mi banking wrapper (not yet used) (#1636,
+ Marc La France).
+1142. Make each screen keep track of the pixmap formats and display-
+ wide attributes it needs in its ScreenInfoRec. InitOutput()
+ can then ensure consistency before adding the screens to the
+ display (#1636, Marc La France).
+1141. Use low-level backing store functions to save/restore the
+ screen during VC switches (doesn't work with vga16) (#1636,
+ Marc La France).
+1140. Move a copy of the backing store low-level function pointers
+ into the ScreenRec. This allows them to be wrapped (#1636,
+ Marc La France).
+1139. Rename [GS]etRootPixmap screen entries to [GS]etScreenPixmap
+ and add [GS]etWindowPixmap entries. Some may not be needed and
+ can be removed later (#1636, Marc La France).
+1138. Remove cfbScreenInitLong() entries. They are not needed since the
+ RGB ordering and masks can be fixed after calling cfbScreenInit()
+ (#1636, Marc La France).
+1137. Fix the saving and restoring of PSZ #define in cfb??.h headers,
+ add copyright notice to them, and get right Imakefile to include
+ them in the link kit (#1636, Marc La France).
+1136. Fix oversight in 1133 (#1636, Marc La France).
+1135. Some include file fixes (#1539, Marc La France).
+
+XFree86 3.9je (14 February 1998)
+1134. Move framebuffer ModuleInit funtions into separate files (#1475,
+ Marc La France).
+1133. Move the following GC privates to the GC structure proper:
+ pRotatedPixmap, pCompositeClip, fExpose, freeCompClip. This is in
+ preparation for the banking mi wrapper (#1451, Marc La France).
+1132. Minor bug fix to mfb and afb framebuffers (#1443, Marc La France).
+1131. Ensure window and GC privates are aligned on a sizeof(long)
+ boundary (#1442, Marc La France).
+1130. Minor optimisation of cfb's ImageGlyphBlt entry, required for
+ the new banking code (#1431, Marc La France).
+
+XFree86 3.9jd (1 February 1998)
+1129. Update the generic VGA driver for these changes (David Dawes).
+1128. Flesh out and update the design document, and add it to the source
+ tree (in xc/programs/Xserver/hw/xfree86/DESIGN) (David Dawes).
+1127. Working non-accel MGA driver (Millennium I only) (David Dawes).
+1126. Update parser (from Metro Link).
+1125. Fill in some missing bits of infrastructure, and fix some bugs there
+ (David Dawes).
+
+XFree86 3.9jc (16 January 1998)
+1124. A start at modifying non-accel MGA driver for new design (David Dawes).
+1123. Pick up multimedia/video PCI devices in xf86GetPCIVideoInfo()
+ (David Dawes).
+1122. Fix some header usage and missing prototypes (David Dawes).
+1121. Continue filling in missing bits of the new design infrastructure
+ (David Dawes).
+1120. Get the generic vga driver working (using dll modules on FreeBSD)
+ (David Dawes).
+1119. Reorganise the vgahw module (David Dawes).
+
+XFree86 3.9jb (25 September 1997)
+1118. Continuation of 1117.
+
+XFree86 3.9ja (29 July 1997)
+1117. Start converting the generic vga driver to the new design (Dirk Hohndel,
+ David Dawes).
+1116. Add flags to allow to build some modules as shared objects (Dirk Hohndel).
+1115. Fix dll loader to work on Linux (and re-fix it to work on FreeBSD
+ again) (Dirk Hohndel, David Dawes).
+1114. Add helper functions for various stages of the server (David Dawes,
+ Dirk Hohndel).
+1113. Add glue code to interface with new parser and create internal data
+ structures (David Dawes, Dirk Hohndel).
+1112. Split up vga256/vga into vgahw and vgafb (Dirk Hohndel).
+1111. New parser for the config file (Stuart Anderson).
+1110. Start work on the new design.
+
+XFree86 3.9j (12 July 1997)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG.ND,v 1.3 1998/08/02 05:16:54 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG.R5 b/xc/programs/Xserver/hw/xfree86/CHANGELOG.R5
new file mode 100644
index 000000000..5f8e03a19
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG.R5
@@ -0,0 +1,1249 @@
+XFree86 2.1.1 (4 May 1994)
+ 36. Fix server crash on reset problem in Mach32 and S3 servers
+ 35. Fix typos in apollo driver
+ 34. Fix for Imake config problem on ISC 4.0
+ 33. ET3000 memory probe fix for SuperProbe
+ 32. Documentation updates
+ 31. Some updates for NetBSD-current
+
+XFree86 2.1.0B (26 April 1994)
+ 30. Disable accelerated text blit for Cirrus 543x
+ 29. Reorder some of the Bt485 code, and get clock doubling working again
+ without pixmux
+ 28. Disable the PIXMUX_SWITCH_HACK stuff -- it doesn't seem needed any more
+ 27. Fix image shift problem for pixmux on #9 cards (Robin Cutshaw)
+ 26. Fix initialisation bug for Cirrus 62{2,3}5 cards (Harm Hanemaayer)
+ 25. Remove 8514 monitor ID check in Mach8 server
+ 24. Updates to the NetBSD README (Matthieu Herrb)
+ 23. Hey Rocky, watch me unbreak the Compaq driver... This time for sure...
+
+XFree86 2.1.0Ab (16 April 1994)
+ 22. Rewrite of ATI SVGA driver (Marc La France)
+ 21. Add "no_bitblt" option for the cirrus driver
+ 20. Recognise the 5429 in the cirrus driver
+ 19. Disable interrupts while programming the ICD2061A
+ 18. sync-on-green support for the TI3020
+ 17. Move S3 clock doubler setting from icd2061ClockSelect() to s3Init()
+ 16. Fix dac_8_bit for Bt485 cursor, and fix Bt cursor blanking problem
+ 15. SuperProbe updates
+
+XFree86 2.1.0Aa (10 April 1994)
+ 14. BDM2 apollo driver (Hamish Coleman)
+ 13. S3 support for switching between pixmux and non-pixmux modes
+ (Amancio Hasty)
+ 12. S3 pixmux support for STB Pegasus, and cleanup of pixmux and icd code
+ (Leonard Zubkoff)
+ 11. Change "fifo_conservative" setting for CLGD543x
+ 10. Updates for NetBSD-current, including bumping shared lib revs
+
+XFree86 2.1.0A (7 April 1994)
+ 9. Don't reserve video memory for HW cursor on S3 when using a RAMDAC cursor
+ 8. Allow the "8clocks" option to force 9 clocks instead of 17 on WD90C3{0,1}
+ cards
+
+XFree86 2.1.0a (6 April 1994)
+ 7. Fix some DEALLOCATE_LOCAL problems in accel servers
+ 6. Support for Bt485 on #9 cards (Robin Cutshaw)
+ 5. Fixes for Cirrus driver (Harm Hanemaayer)
+ 4. Fix for text restore problem on some S3 cards (Jon Tombs)
+ 3. Workaround for Mach32 detection problem on some platforms
+ 2. Fix incorrect usage of $(DESTDIR) in some lnuxLib.rules and x386.cf rules
+ 1. Code to detect 928-P (Harald Koenig)
+
+XFree86 2.1 (11 March 1994)
+151. OS README updates (affect individual OSs only)
+150. Fix AltGr handling for Linux (affects Linux only)
+149. Comment out the unused s3Save() and s3Restore() functions -- a typo in
+ some unreachable code may cause problems with some compilers (should not
+ affect any OSs)
+148. Linux compile-time fix for fonts/PEX/lex.l (affects Linux only)
+147. Late cirrus fix for large tiles
+146. Fix for LinkKit site.def and Imakefile (remove dbm references)
+
+XFree86 2.0Z (8 March 1994)
+145. Fix text/graphics mode switching for pixmux with SPEA Mercury. This
+ code is now reasonably stable (interlace support is still absent though)
+ (Norbert Distler)
+144. Fix for cirrus stipple fill when virtual width is not a multiple of 32
+143. Linux keyboard updates
+
+XFree86 2.0Ce (7 March 1994)
+142. Preliminary support for Bt485 pixel multiplexing on the SPEA Mercury
+ card (Norbert Distler)
+141. More documentation updates
+140. SuperProbe updates (ATI and Weitek fixes)
+139. Fix for second MB cirrus BitBLT but -- BitBLT now turned back on for
+ 2MB cards (Wolfgang Jung)
+
+XFree86 2.0Cd (6 March 1994)
+138. Default to building shared libs for FreeBSD
+137. Updates to cirrus driver: (Harm Hanemaayer)
+ New Option flag "no_2mb_banksel" for cards that have 2MB in the form
+ of 512kx8 DRAMS (4 chips)
+ Disable BitBLT engine use when using more than 1MB because there
+ are problems
+ New text bitmap transfer code
+136. Documentation updates
+135. Fix mi/cbrt.c so it handles negative arguments.
+
+XFree86 2.0Cc (5 March 1994)
+134. Update x386/etc/console.h to current version
+133. Some documentation updates (including removing README.XS3)
+132. Updates to cirrus driver: (Harm Hanemaayer)
+ New option flags "fifo_conservative" and "fifo_aggressive" to
+ control the CRTC fifo threshold.
+ Reduce clock limit for the 5420
+ Remove accelerated PolyGlyphBlt -- it causes problems
+131. Modify pvga1 driver to detect the 90C24 and treat it as a 90C30
+130. Support for the SC15025 RAMDAC in 8-bit/RGB mode (requires
+ the "sc15025" and "dac_8_bit" options) (Helmut Geyer)
+129. Fix vga colourmap save/restore when using a RAMDAC in 8-bit mode (Helmut
+ Geyer)
+
+XFree86 2.0Cb (3 March 1994)
+128. Fix for "snow" problems on WD90C3x cards with 80MHz clock (Anders Bostrom)
+127. Fixes for compilation problems on Mach and ISC
+126. Support for 8-bit/RGB for the AT&T 20C490/491 ramdacs (S3 server).
+ There is no auto-detect, so the "att_20c490_1" Option must be
+ specified (together with the "dac_8_bit" Option)
+125. Added some sample patches from Gertjan Akkerman which document some
+ useful changes which could me made to the VGA16 server (these are
+ in x386/vga16/doc/).
+124. Fix Mach8 and Mach32 server hang when run on a card with no Mach chip
+123. Update xterm's terminfo file
+122. Install mit/config/README in lib/X11/config
+121. Modify Trident driver to recognise the 9000i, 9200CX, 9100B and 9420
+ chipsets. The first is treated as a 9000, and the last three are
+ treated as a 8900CL.
+
+XFree86 2.0Ca (2 March 1994)
+120. Fix CR60 setting for clocks > 100MHz (S3 server)
+119. Fix cirrus compilation on SVR4, and bsd_init.c typo
+118. Enable Home/End esc sequences for xterm on all OSs
+117. SuperProbe register unlock fixes
+
+XFree86 2.0C (1 March 1994)
+116. Allow the MIT-SHM extension to be disabled at run-time on BSD systems
+ when kernel support for sysv-shm isn't present
+115. Enable Home/End esc sequences for xterm (Linux only -- should this be
+ extended?)
+114. Set default xterm tty parameters to reasonable values (fixes problems
+ seen when using xdm)
+113. gccmakedep fix (David McCullough)
+112. Special-case code for lines where this is one rectangle in the clip
+ region -- for Mach32 (Craig Groeschel)
+111. Update to compaq probe code -- hopefully this will reduce the number
+ of false positives
+110. Major updates to SuperProbe
+109. Cirrus driver patches
+
+XFree86 2.0Bb (27 February 1994)
+108. Removed experimental "cr60=..." options (S3), and made CR60=0xFF
+ the default setting. The "dram_{slow,med,fast}" options still remain
+ as un-documented options (just in case).
+107. Manual page updates
+106. Support for linear fb location on Mach32 PCI cards
+105. Include Solaris x86 "aperture driver" (Doug Anson and David Holland)
+104. Updated Thomas Wolfram's SVR3 mmap driver to version 2.2.3
+103. Allow the MemBase setting in Xconfig specify the high 5 bits of the
+ 4MB aperture address for the Mach32 server, and the high 6 bits of
+ the LAW address for the S3 server
+
+XFree86 2.0Ba (25 February 1994)
+102. Fix/speedup for window->pixmap part of CopyPlane() in the accel servers
+101. Fix bits per RGB reported for S3 server when using 8bpRGB
+100. Modify code for determining when pixel multiplexing is required for
+ the S3 server, and restrict the DisplayWidth to either 1024 or 2048 when
+ pixel multiplexing is used
+ 99. Preliminary support for the SC11412 clock chip used on the SPEA Mercury
+ (S3). Use 'Clocks "sc11412"' to select this (Norbert Distler)
+ 98. "icd2061a" now uses the "icd2061a_slow" clock setting algorithm.
+ The name "icd2061a_slow" will be dropped in the release after 2.1
+ 97. Fixes for zero-width arcs for the VGA16 server (Gertjan Akkerman)
+ 96. Support for David Holland's "aperture driver" for linear fbs on Solaris
+ 95. Fix Solaris panic when no free VTs are available
+ 94. Much-enhanced accelerated support for Cirrus chips (Harm Hanemaayer)
+ 93. Support for up to 17 clocks on WD90C3x cards (Anders Bostrom)
+ 92. Fix for Compaq avga driver
+ 91. Keyboard updates to handle Linux' key remapping (Orest Zborowski)
+ 90. README for Solaris (David Holland)
+
+XFree86 2.0B (21 February 1994)
+ 89. Possible fix for Bt probe problem that some people see
+
+XFree86 2.0Ab (19 February 1994)
+ 88. Combine DRAM and non-DRAM mach8 image assembler code into single files
+ with #ifdefs
+ 87. Fix for hga2 driver to prevent it from blanking MDA displays when
+ swithching back to text mode
+ 86. Code to explicitly recognise the *BSD PCVT console driver
+ 85. Preliminary support for the S3 805i in interleaved mode
+ 85. Fix for single-bank SVGA bitblt code (Giovanni Novelli)
+ 84. Fix alu usage in mach32CopyArea() (Craig Groeschel)
+ 83. Fix dash line support in Mach32 server (Mike Bernson)
+
+XFree86 2.0Aa (13 February 1994)
+ 82. S3 "No_Bt485" and "No_Ti3020" options have been replaced by "Normal_DAC",
+ and a "20C505" option has been added
+ 81. ATI text restore fixes for Mach32 server (Ton van Rosmalen)
+ 80. Planemask fixes for Mach32GetImage() (Craig Groeschel)
+ 79. Prevent S3 Ti cursor from being turned on when the screen is blanked
+ 78. No longer define __386BSD__ for BSD/386, NetBSD, FreeBSD. Change
+ the FreeBSD define from -DFreeBSD to -D__FreeBSD__. Code outside
+ ddx/x386 now uses the value of BSD (from <sys/param.h>) and for
+ code below ddx/x386, __BSD__ is defined for all the x86 BSD OSs
+ 77. Rewrite of Mach32 memory detection code (Mark Weaver)
+ 76. Set clock-doubler cut-in to 67.5MHz for Bt485 and 90MHz for AT&T 20C505
+ 75. Add ClearRTS option (some mice seem to need it)
+ 74. Mach8 server now uses a 1024 line pitch (regardless of virtualX) for
+ cards with 1MB
+ 73. Support for bank switching with the VGA16 server. Staticgray and
+ Grayscale visuals added to the VGA16 server (Gertjan Akkerman)
+ 72. Slowed down image routines for DRAM based Mach8 cards (Hans Nasten)
+ 71. Improvements to solx86 in/out assembler code, and removal of the
+ broken ProworksMOption
+
+XFree86 2.0A (15 January 1994)
+ 70. Increase Bt485 clock-doubler cut-in point from 67.5MHz to 90MHz. This
+ should fix the "flashing pixel" problem many have reported
+ 69. Mach8 font cache performance updates
+ 68. Update assembler code and SuperProbe Makefile.std for the ProWorks
+ compile on Solaris x86
+ 67. Ti3020 probe code for SuperProbe (Robin Cutshaw)
+ 66. Fix Mach32 server to recognise PCI cards
+
+XFree86 2.0g (9 January 1994)
+ 65. Clock probe code for Mach32 server
+ 64. Support for TI3020 ramdac for S3 server (Robin Cutshaw)
+ 63. Fix server crash problem if reset occurs when VT switched away
+ 62. Make accel servers honour the -dpi flag
+ 61. Mach8 font cache updates
+ 60. Support for the ProWorks compiler on Solarix x86
+ 59. Add memory probe to SuperProbe (only for a couple of chipsets so far)
+ 58. Support for display widths of 640, 800 and 2048 with S3 server
+ 57. Generalise S3 HW cursor memory allocation -- fixes problems that showed
+ up with some virtualY/displaywidth combinations, and will work for
+ display widths < 1024
+
+XFree86 2.0f (27 December 1993)
+ 56. Fix mach32RecolorCursor() SIGSEGV when VT switched away
+ 55. Possible fix for cases where the S3 linear fb probe fails the first
+ time the server is started but succeeds on subsequent times
+ 54. Updates to Mach32 memory probe
+ 53. Fixes for ATI SVGA save/restore code (Ton van Rosmalen)
+ 52. Fix xman's handling of nroff bullets and bolding (Rich Murphey)
+ 51. Mach8 font cache updates (Hans Nasten)
+ 50. Mach32 HW cursor fixes (Mark Weaver)
+ 49. Change "makedepend" for systems with gcc to use "gcc -M" (based on
+ code from Hongjiu Lu). This is much slower than the other version,
+ and maybe should be disabled by default for !UseInstalled
+
+XFree86 2.0e (18 December 1993)
+ 48. SuperProbe updates (details in SuperProbe/ChangeLog)
+ 47. Imake updates for NetBSD
+ 46. Ramdac multiplexing for Mach32 cards with TLC34075 (and ATI68875?)
+ ramdacs (Mike Bernson)
+ 45. Imake changes to allow easy building of just the servers with a
+ cut-down source tree
+ 44. Fix ClearDTR -- now it clears *only* the DTR line
+
+XFree86 2.0d (11 December 1993)
+ 43. Xconfig keyboard option: VTSysReq to enable SVR4-style VT switching
+ sequence on Linux and *BSD+syscons
+ 42. Solaris 2.x x86 support (David Holland, Doug Anson)
+ 41. Accelerated dline and dseg for Mach32 (Mike Bernson)
+ 40. Accelerated non-cache text code for Mach8 (Hans Nasten)
+ 39. VirtualY limit removed for Mach8 (cache can be disabled)
+ 38. Dynamic allocation for font cache for Mach8 (Hans Nasten)
+ 37. New GetImage for Mach32 (Mike Bernson)
+ 36. Support for linear fb on *BSD with mmapable /dev/mem
+ 35. Preliminary support for 1152 width on Rev C 801 and Rev E 928, and
+ 1600 width on Rev E 928 in S3 server
+
+XFree86 2.0c (3 December 1993)
+ 34. Support for 8-bit/gun for Mach32 server (Craig Groeschel)
+ 33. New GetImage() for Mach8 and 8514
+ 32. Fix error message printed when no appropriate graphics sections are
+ present in Xconfig
+ 31. Add a "fb_debug" option to the S3 server
+ 30. MemBase Xconfig parameter added to allow the fb base address to be
+ specified. This is currently used only by some bdm2 drivers
+ 29. Support added to bdm2 for Visa board (untested)
+ 28. HGC-1280 now supported on both primary and secondary addresses
+ 27. Sigma L-View driver tested and works now
+ 26. Code from ATI to work around memory probing problems with some Mach32
+ chips (untested)
+ 25. Workaround for some 2MB DRAM ATI cards (eg, CLX). This allows the
+ VideoRam amount specified in Xconfig to override the detected value
+ 24. Support for NetBSD/FreeBSD shared libraries (John Brezak & ??)
+ 23. Add option "intel_gx" to handle linear fb on Intel GX/Pro (Mach32)
+ 22. Composite sync support for Mach8
+ 21. Allow linear fb for EISA S3 cards
+ 20. Fix s3RecolorCursor() SIGSEGV when VT switched away
+
+XFree86 2.0b (14 November 1993)
+ 19. Add virtualY <= 896 check to Mach8 server
+ 18. Restore settings for VGA aperture mapping if linear fb access fails for,
+ S3. Also restore those registers at exit
+ 17. Merge in MIT fix-26 (mainly xterm security patch)
+ 16. Fix S3 interlaced modes with VTotal > 1025.
+ 15. Hack for 1280x1024 on S3 801 with 110MHz clock
+ 14. Composite sync support for Mach32 (Todd Pfaff)
+
+XFree86 2.0a (9 November 1993)
+ 13. Speedup for aligned <=16 bit wide stipple ops for Mach8 and 8514
+ 12. Fix NULL dereference when ModeDB is empty (Bill Metzenthen)
+ 11. make mit/rgb consistent with the server's usage of it. showrgb can now
+ read rgb.txt directly, and [sng]dbm is no longer required
+ 10. Attempt to clean up strerror() vs sys_errlist[] usage outside ddx/x386
+ 9. Disable saving the Tek screen to a file in xterm -- a quick hack to
+ get around another security problem. An official X Consortium fix
+ should be available soon
+ 8. Fix vgaFasm.h so it works for gcc2 with '-traditional'
+ 7. Fix clock probing problem in pvga1 driver
+ 6. Fix typo in xf86_OSlib.h
+ 5. Fix ClockProg informational message
+ 4. Truncate clock values to MHz resolution when checking against the limit
+ 3. Fix bug in LinkKit Imakefile
+ 2. Fix malloc problem in the PEX font reader
+ 1. Some documentation fixes
+
+XFree86 2.0 (24 October 1993)
+247. Documentation finalised
+246. Fix for VT switching problem with Mach32 server
+
+XFree86 1.9Za (23 October 1993)
+245. Documentation updates
+244. Fix bug in backing pixmap used for VT switching with the S3 server
+243. Fix typo which prevented nomemaccess being turned of when a localbus
+ S3 card is used without linear fb mapping
+
+XFree86 1.9Z (18 October 1993)
+242. Code freeze for 2.0. Docs still not finished
+241. Disable linear fb mapping for BSD/386 since it doesn't appear to work
+240. Fix for dline bug in Mach8 and 8514 servers
+239. Updates to ati SVGA driver
+238. SCO doc updates
+237. Allow "nolinear" Option for Mach32 server
+
+XFree86 1.9Fe (17 October 1993)
+236. Fix S3 cursor problem when panning
+235. Mach32 HW cursor fixes
+234. Include Accel cards db
+233. Fix video mmap problem with *BSD
+
+XFree86 1.9Fd (17 October 1993)
+232. Add undocumented "showcache" Option for the S3 server
+231. Fix ALLOCATE_LOCAL/DEALLOCATE_LOCAL problem in S3 server
+230. Fix multi-screen I/O permission bug on SYSV
+229. SVR3 version of IOPL kernel patch (required for ISC 2.0.2)
+228. Get xload's compiled-in kernel name from <paths.h> for BSD
+227. Fix some compilation-related problems
+226. Sigma Lview driver doesn't work, so removed references to it
+225. DAC_MASK save/restore for 8514 server
+
+XFree86 1.9Fc (16 October 1993)
+224. Stipple and colour mapping fixes for vga16
+223. Fix for Mach8 VT switching problem
+222. Include README.Bsdi
+221. Fix SEGV in s3WarpCursor when VT not active
+220. Don't use kbd_mode for BSDI
+
+XFree86 1.9Fb (13 October 1993)
+219. Mach32 HW cursor colouring fixes (still not quite right)
+218. Change Mach8 clock probing to measure the divided-by-4 values only
+217. Correct fix for problems when some cards are in mono address mode
+216. Fix sync polarity problem with S3 server
+215. Update kbd_mode for syscons
+214. Add "memaccess" option (for S3) so that mem access can be forced on
+ for localbus cards when the linear framebuffer can't be mapped
+
+XFree86 1.9Fa (9 October 1993)
+213. 1-pixel segments fix for Mach8
+212. Trap virtual screen sizes which are too large for Mach32
+211. Turn off Mach32 HW cursor if insufficient videoram
+210. Some documentation updates
+209. Move clock limit definitions so that they can be changed when using
+ the LinkKit
+208. SuperProbe updates
+207. Fix mis-detection of ATI cards by the compaq driver
+206. Fix hard-coded path in xdpr script
+205. Print max clock before resolving modes
+204. Fix CRTC setting procedure for Mach32
+
+XFree86 1.9F (4 October 1993)
+203. Limit clock to 80MHz for Mach8 and Mach32
+202. Mach32 HW cursor fixes and mach32im cleanup
+201. Cleanup startup messages in Mach8 and Mach32 servers
+200. Disable xterm logging by default, and provide a safer(?) method of
+ opening the log file
+
+XFree86 1.9Ed (2 October 1993)
+199. Support for Cirrus 62x5 chips (Prof. Hank Dietz)
+198. Clean up handling of 'volatile', etc for 'gcc -traditional'
+197. Merge Mach8 font cache fix into Mach32
+196. Default to probe for 4 clocks on pvga1 cards
+195. Remove implicit assumption that certain mouse protocols are only used
+ by serial devices
+194. Updates/cleanups for bdm2 code
+193. Include SVR3 mmap and SCO dmmap drivers (in x386/etc)
+192. Change location of console.h to machine/ for FreeBSD
+191. Fix setting of AdmDir for *BSD
+190. Update GnuMalloc option. Now it enables use of GNU malloc for clients
+ as well as the servers
+189. Patches for Amoeba
+188. Fix for OAK crash with SVGA server
+187. Fix for ATI SVGA restore problem
+186. HW cursor for Mach32 (Mike Bernson)
+185. Option checking in other accel servers
+
+XFree86 1.9Ec (1 October 1993)
+184. Option checking in S3 server
+183. Fix default colour visual handling for accel servers
+182. Add checking of clock limits
+181. Clean up s3Init()
+180. Fix to allow SVR3 shared libs to build when using gas
+
+XFree86 1.9Eb (29 September 1993)
+179. Updates to syscons support (requires lastest console.h -- which is now
+ included in ddx/x386/etc)
+178. Fix for colourmap restoration problem with 8514/A cards
+177. Updates to Bt485 code
+
+XFree86 1.9Ea (28 September 1993)
+176. Man page updates
+175. Modify "number9gxe" option to use the Bt485's clock doubling for clocks
+ higher than 67.5Mhz
+174. Alternate ICD clock selection code. Enable it with
+ 'Clocks "icd2061a_slow"'
+173. site.def cleanup
+172. Fix Bt485 Cursor support
+171. Update syscons support
+170. Fix for S3 font cache server crash problem
+169. Fix for S3 xqueue problems when operating in linear mode
+168. Fix for S3 928 localbus problem
+167. Fix SuperProbe's graphics co-processor detection, and add code to detect
+ Bt485 on S3 cards.
+166. Fix text problems in Mach8 and 8514 servers
+165. Image read/write fix for Mach32
+
+XFree86 1.9E (23 September 1993)
+164. Support for the syscons driver on *BSD (S|ren Schmidt)
+163. Get/PutImage speedups for S3
+162. Accelerated image text for non-cached fonts (S3)
+161. Image read/write speedups for Mach32
+
+XFree86 1.9Dc (22 September 1993)
+160. Hooks added for HW cursor support on SVGA cards
+159. Support for ISC 4.0
+158. Accel text functions for non-cached fonts (S3 server)
+157. Fix problems with vga sequencer not being turned off in the right places
+156. Support for dmmap driver for SCO
+155. Oak driver (from Steve Goldman)
+154. Updates for Minix
+
+XFree86 1.9Db (21 September 1993)
+153. Accelerated WD90C31 support (Mike Tierney)
+152. Updates to ImageStipple code for Mach8 and 8514
+151. Fix for memory leak in mi backing store (Amancio Hasty)
+150. Accelerated Cirrus support (Simon Cooper and Bill Reynolds)
+149. Accelerated dline for Mach8 and 8514 (from Tiago Gons)
+148. Fixes for localbus 928
+147. Modify server to use rgb.txt directly and create an internal hash table
+ (from Thomas Roell)
+146. SuperProbe updates
+145. Fix cursor recolour problems in S3 server
+144. Use uname/gethostbyname for cases where SIOCGIFCONF fails
+
+XFree86 1.9Da (18 September 1993)
+143. ImageStipple speedup for Mach8 and 8514 (from Hans Nasten)
+142. Reorganise man page installation details for *BSD
+141. Fix various minor bugs
+
+XFree86 1.9D (15 September 1993)
+140. Use non-MAP_FIXED for mmap on Linux -- requires latest kernel
+139. dseg for S3
+
+XFree86 1.9Cf (14 September 1993)
+138. line updates for S3 (including dline)
+137. Support for Thomas Wolfram's mmap driver for SVR3
+136. Config changes to support NetBSD and FreeBSD
+135. Correct fix for SIOCGIFCONF on *BSD (from Mark Davies)
+134. Use Jerry Whelan's BSDselect() for SVR4 in libXt and libXbsd
+133. CopyPlane() for Mach32 server
+132. Include Berkeley str{,n}casecmp() in libXbsd
+131. Sigma LView driver for bdm2 (untested)
+130. OsMouse support for SCO (uses the SCO event driver)
+
+XFree86 1.9Ce (9 September 1993)
+129. Improve reliablilty of mmio code (thanks Thomas)
+128. Fix xdm-related server crash on Linux
+127. Support for 4MB aperture with EISA Mach32 cards
+126. CopyPlane() for 8514 server
+125. Fix "xfig" problem in accel servers
+124. Fix GetImage and PolyText in accel servers
+123. Fix problem with VT-switching and server reset
+122. Fix some more cfb.banked bugs
+
+XFree86 1.9Cd (5 September 1993)
+121. Fast image read/write for 8514 server
+120. Mmio support for 928 in S3 server
+119. Fixes for BT ramdac HW cursor (S3) (still doesn't work)
+118. CopyPlane() fixes for S3
+117. Speedup for PolyPoint() in Mach8 (and others)
+116. Fix for lines in accel servers -- now match cfb lines.
+115. CopyPlane()
+
+XFree86 1.9Cc (2 September 1993)
+114. Fix auto-repeat trapping of lock keys
+113. Support BT485 ramdac's HW cursor (S3 server) (doesn't work yet)
+112. Use mmap for BIOS access on SVR4
+111. Only protect page 0 for SVR4 when the -protect0 flag is given. It makes
+ cores less useful
+110. bdm2 (banked dumb mono) fb/driver (from Pascal Haible)
+109. Fast image fill for Mach8 (from Hans Nasten)
+108. Update shared-lib version numbers for Linux
+107. Split bsdi os-support from 386BSD -- little code was common
+106. Modify s3Init() code to use vgaHWInit()
+
+XFree86 1.9Cb (28 August 1993)
+105. Fast image read/write for Mach8 (from Hans Nasten)
+
+XFree86 1.9Ca (28 August 1993)
+104. Default to NoMemAccess for S3 localbus cards on OSs that don't
+ support linear videomem mapping
+103. Add QueryBestSize() for S3
+102. Protect page 0 for SVR4 (to help find NULL pointer dereferences)
+101. Fix ChordMiddle
+100. Fix some compilation problems with vga16
+ 99. vga16 fix for OpaqueMove bug
+ 98. Work around GNU make's "different" default dependency handling.
+ Dependencies should now work reliably with GNU make.
+ 97. Fast CopyPlane() for S3 server
+ 96. Fix I/O port handling to deal with multiple screens
+ 95. Mach8 updates
+
+XFree86 1.9C (25 August 1993)
+ 94. Updated video mem <-> main mem copy code to get better performance on
+ localbus cards
+ 93. Alternate fix for xqueue with S3 (previous fix degraded performance too
+ much)
+
+XFree86 1.9Be (25 August 1993)
+ 92. SIOCGIFCONF fix for ISC in xdm
+ 91. Mach support for mapping arbitrary video memory
+ 90. Fix for performance problems in S3 server
+
+XFree86 1.9Bd (24 August 1993)
+ 89. Updated version of Xconfig/probe info
+ 88. Update libXt jump entries for Shm on Linux
+ 87. Another S3 cursor update
+ 86. Use mmap() for mapping framebuffer on SVR4
+ 85. Localbus linear mapping for S3 (tested only on Linux)
+
+XFree86 1.9Bc (23 August 1993)
+ 84. SuperProbe update
+ 83. Improve picture stability when using high clocks (S3)
+ 82. Get memory detection right for S3 911
+ 81. Change localbus wait states for S3
+ 80. Go back to the MAP_FIXED mmap for Linux, added xf86UnMapVidMem()
+ 79. S3 cache updates and cursor changes
+
+XFree86 1.9Bb (21 August 1993)
+ 78. Fix S3 server crash if it exits when its VT isn't active
+ 77. Indicate where information in server startup messages comes from (ie
+ whether from Xconfig or by probing, etc)
+ 76. Fix ATI/Mach probing in SuperProbe
+ 75. Fix S3 cursor "shadowing" in interlaced modes
+ 74. Fix problems with the S3 server when using xqueue
+ 73. 16-colour generic VGA server (from Gertjan Akkerman)
+
+XFree86 1.9Ba (18 August 1993)
+ 72. Support for a Hitachi Puma Plus digitising tablet's 4-button puck
+ (from Randy Terbush)
+ 71. Mouse "ChordMiddle" option. This is for a 3-button mouse which
+ generates left+right events when the middle button is used. This is
+ for Microsoft protocol only (from Ted Goldblatt)
+ 70. Reorganise the way SpeedUp options are handled so that the speedup code
+ is only linked into the server when the appropriate chipset driver is
+ included.
+ 69. Fix inb/inw inlines for gcc without gas
+ 68. Code to use memory to the right of the screen for caching (S3)
+ 67. Various compilation-related fixes
+
+XFree86 1.9B (16 August 1993)
+ 66. Fix memory leak on server reset
+
+XFree86 1.9Ai (16 August 1993)
+ 65. Fix LinkKit
+ 64. Cirrus driver was ignoring clocks when a VideoRam line is specified
+ 63. Fix VT switching for Mach8 and ibm8514 servers
+ 62. Fix server reset for S3 server
+ 61. Fix problems in mach32ImageFill for virtual width != 1024
+ 60. Text save/restore added to Mach32 server
+
+XFree86 1.9Ah (15 August 1993)
+ 59. Updates to SuperProbe so it can detect the latest S3 chip revisions
+ 58. VT switching support for the S3 server
+ 57. Fix for S3 image write problems with screen width 1024 & 2MB videoram
+
+XFree86 1.9Ag (14 August 1993)
+ 56. Another stipple fill fix in cfb.banked
+ 55. S3 clock select fixes -- allows clock probing to work
+ 54. Fix initialisation of miCacheFreeSlot
+
+XFree86 1.9Af (13 August 1993)
+ 53. Allow programmable clocks to be specified with 'Clocks "prog_clk_type"'
+ in Xconfig.
+ 52. Virtual size fixes for S3
+
+XFree86 1.9Ae (13 August 1993)
+ 51. Extended I/O and IOPL handling for BSDI.
+ 50. Set virtual size for S3 if not given.
+
+XFree86 1.9Ad (13 August 1993)
+ 49. Imake config updates
+ 48. Created libxf86_hw in common_hw, and moved clock probe code there.
+ 47. XF86_Mach8 and XF86_8514 compilable.
+
+XFree86 1.9Ac (12 August 1993)
+ 46. S3 updates (diff15)
+ 45. XF86_Mach32 compilable
+
+XFree86 1.9Ab (11 August 1993)
+ 44. XF86_S3 compilable and runnable on Linux
+ 43a Cirrus driver updates (including fix for line problem)
+ 43. Fix problem in Xlib compose-key code that caused auto-repeat problems
+ on some SVR4.
+ 42. Keep /dev/console open for pccons on 386BSD to work around keyboard
+ hanging problem (from Mark Weaver)
+ 41. Fix for zero width horiz, vert lines with rop other than GXcopy, GXxor
+ (from Mark Weaver)
+
+XFree86 1.9Aa (6 August 1993)
+ 40. Include accel dirs (not compilable yet)
+
+XFree86 1.9A (4 August 1993)
+ 39. Fix authorisation for LOCALCONN connections on SYSV.
+ 38. OS-lib fixes
+
+XFree86 1.9e (1 August 1993)
+ 37. Make the ET4000 Option "force_bits" standard behaviour
+ 36. Fix problem of renderer config not being handled properly in the LinkKit
+ 35. Update screen configuration handling to better suit multiple servers.
+
+XFree86 1.9d (29 July 1993)
+ 34. Mach OS-lib fixes
+
+XFree86 1.9c (28 July 1993)
+ 33. Lots of SCO patches (including fixing the bogus window problem, xterm,
+ font server, PEX)
+ 32. SuperProbe updates (includes identification of AT&T RAMDACs and
+ detection of 8514/A and ATI Mach-xx chipsets)
+ 31. Fix for bug in cfbgetsp.c
+ 30. Include pixmap cache support in mi, mfb, cfb.
+ 29. SVR3/ISC updates for gcc 2.4.5
+ 28. Moved OS-specific parts of x386Io.c to the OS-lib
+ 27. OS-lib fixes.
+ 26. Converted the experimental ET4000 RCCONF code to an Option flag:
+ "fast_dram"
+ 25. Fix SIOCGIFCONF related problems in xdm, chooser and server/os/access.c
+ on SVR4 and 386BSD (thanks to Ian Donaldson and Peter Wemm).
+ 24. Support for easily adding multiple servers to server/Imakefile and
+ the LinkKit
+
+XFree86 1.9b (13 July 1993)
+ 23. Fix for interlaced support in the Cirrus driver
+ 22. OS-library added to separate out OS-specifics under ddx/x386
+ 21. Fix initialisation of supported pixmap formats
+ 20. Fix for authorisation on streams connections for SVR3
+ 19. Fix other line bugs (fLineH.s, suLine.s, suVHLine.s)
+ 18. Really make the horizontal panning symmetric
+ 17. Fix 2MB support on Cirrus 5426
+ 16. Fix line bug in non-speedup code (fLineBres.s)
+
+XFree86 1.9a (3 July 1993)
+ 15. Added support for BSDI's BSD/386 (from Hans Nasten)
+ 14. SuperProbe updates for C&T chipsets
+ 13. Make horizontal panning symmetric
+ 12. Allow Cirrus driver to address 2MB on the 5426 cards (not tested)
+ 11. Add ChipRounding to the vga ChipRec so that chip-specific rounding of
+ virtualX can be handled properly
+ 10. OSF/1 patches (Marc Evans)
+ 9. Fix for xload problem on Linux
+ 8. Fix for ATI text-mode font restore problem
+ 7. Experimental code to set the RCCONF register on ET4000 cards (this is
+ only used if Et4000SetRCConf is set to YES in site.def)
+ 6. Allow "black" and "white" colours to be specified in Xconfig for the mono
+ vga server
+ 5. Fix Xconfig visual spec check for mono servers
+ 4. Fixed some long file names (in extensions/lib/PEXlib, fonts/bdf/misc)
+ 3. Fix xman bug introduced in 1.2Da
+ 2. Fix bank-switching bug in cfbfillsp.c
+ 1. Fix a couple problems that show up when using a XFree86 patched source
+ tree on non-i386 systems
+
+XFree86 1.3 (5 June 1993)
+98. Updates to ncr driver
+97. NCR imake config changes
+96. Docs updated for gzip extension change ".z" -> ".gz"
+95. Experimental "force_bits" option flag for ET4000
+
+XFree86 1.2Da (2 June 1993)
+94. Modify xman to use groff instead of nroff for Linux
+93. Modify xload to use /proc/loadavg for Linux
+92. Change ownership of /dev/console and /dev/tty0 for Linux
+91. Added xmodmap.std to the etc dir which lists the default key map in a form
+ that can be read by xmodmap(1)
+90. Various small SVR3 adjustments, and new README.SVR3
+89. Add a README for the LinkKit
+88. Support for banked mono in ET3000 driver (thanks to Joerg Wunsch)
+87. ET3000 probe changes
+86. README.Linux updates
+
+XFree86 1.2D (26 May 1993)
+85. Merge in MIT fix-25
+84. OSF/1 support is incomplete -- so remove references to it in the docs
+83. Add -keeptty flag to prevent server from detaching its controlling tty
+ (useful when debugging)
+82. Include support for 77C22E in ncr driver
+81. Set bank 0 for save/restore in trident driver [removed]
+80. Workaround for mouse loss when VT switching on SCO
+79. Compile-time support for SCO 3.2.4
+78. Don't include PEX in mono server (even when BuildPex is set) because it
+ only works for 8-bit PseudoColour
+77. Mach support for SuperProbe
+76. Various SVR3 shared lib fixes including fixes for AT&T SVR3.2, XDM auth
+ support and fixes for initialisation problems that showed up with Motif.
+75. Ignore SIGHUP in xterm for ISC 2.2.1, 3.0
+74. rgb/Imakefile fix
+73. Imake.tmpl updates for ISC
+
+XFree86 1.2Cb (19 May 1993)
+72. Code to slow down DAC access
+71. Possible fix for font restore bug on Linux and 386BSD (works for some
+ people, but not everyone)
+70. Merge in MIT fix-24
+69. Xosdefs.h mod for Mach
+68. Eliminate various compiler warnings with PEX
+67. Modify lndir to ignore directories called "CVS"
+66. Fix overscan restore problem when mode switching
+65. Fix a Cirrus-specific font/text restore problem
+
+XFree86 1.2Ca (16 May 1993)
+64. Fix for lndir to work with Linux (Gnu ls)
+63. Documentation updates
+62. Allow PEX to be turned on/off at link-time with the LinkKit
+61. Add "hibit_high" and "hibit_low" Option flags to handle some ET4000
+ cards when the server is started from a high-res text mode
+60. Fix screen corruption when mode-resolving fails (problem was introduced
+ in 1.2Bb)
+59. Fix to pvga1 driver for 90C11
+58. kbd_mode modified to be a no-op for codrv
+57. Imake.tmpl updates for SCO and OSF/1
+56. Remove need for <sys/ioctl_pc.h> with LinkKit on 386BSD
+
+XFree86 1.2C (8 May 1993)
+55. Modify Cirrus driver to set the reported clocks to the preset values
+ rather than probing them. Probing can be forced with the "Probe_Clocks"
+ Option flag.
+
+XFree86 1.2Bb (6 May 1993)
+54. Compatibility support for codrv 0.1.1 (run-time only)
+53. Merge in OSF/1 support (from Marc Evans)
+52. Merge in SCO support (from David McCullough)
+
+XFree86 1.2Ba (4 May 1993)
+51. SuperProbe updates (can now be compiled with a K&R compiler)
+50. Compaq driver (from Hans Oey)
+49. Merge codrv and pccons support so that a single server can support
+ both
+48. Cirrus driver for CLGD542x cards (no accelerated support) (from Bill
+ Reynolds)
+47. Allow inline'd macros to be disabled for debugging purposes (by compiling
+ the video drivers with -DNO_INLINE)
+46. Print OS version in startup message
+
+XFree86 1.2B (19 April 1993)
+45. ET4000 text clock restoration modified -- maybe it will fix the problems
+ when restoring to a high res text mode
+44. Sample SVGA driver stubs and documentation added
+43. Xconfig option to specify VGA BIOS base address (not all are at 0xC0000)
+42. Major rewrite of tvga driver. Now supports 8800CS, 8900B, 8900C, 8900CL,
+ 9000 in all modes.
+41. Xconfig option to clear DTR after opening MouseSystems mouse (only for
+ SYSV, Linux, 386BSD)
+40. Change server names. X386 -> XF86_SVGA, X386mono -> XF86_Mono.
+
+XFree86 1.2Aa (17 April 1993)
+39. SuperProbe will now find vga BIOS at addresses other than 0xC0000
+38. Support for building Linux shared libs (DLL version)
+37. Remove case-sensitivity of the Chipset option.
+36. Save and restore registers affected by clock probing
+35. Some more Xconfig validity checks
+34. Change 'Vendor' keyword in Xconfig to 'Option'
+33. Fix to make use of the RGBPath specified in Xconfig (this was pointed out
+ by Greg Hartman back in Sept)
+32. Use XWINHOME to specify ProjectRoot at run-time
+31. PEX patches for Linux
+30. libX11 shared lib problem fixed (for SVR4)
+
+XFree86 1.2A (3 April 1993)
+29. More pvga1/wd driver tuning, added rudimentary support for 90c20
+28. Improve overscan handling
+27. modeDB.txt updates
+
+XFree86 1.2e (27 March 1993)
+26. Minix/Amoeba updates
+25. New et3000 probe (to prevent tvga8900CL being falsly detected as et3000)
+24. More interlace tuning for pvga1 and tvga8900 drivers
+23. SuperProbe
+22. XDMCP fixes for Linux (and others)
+
+XFree86 1.2d (24 March 1993)
+21. Added support for Minix-386 and Amoeba (from Kees Verstoep)
+
+XFree86 1.2c (20 March 1993)
+20. Merged in MIT fix-23
+19. Support for 9th clock on WD90Cxx chips
+18. NCR 77C22 driver (from Stuart Anderson)
+17. Allow multiple Clocks lines in Xconfig
+16. Changes to external clock program code to handle VT switching better
+15. ISC 2.0.2 support (from Aki Atoji)
+14. Include driver source instead of objects in LinkKit
+
+XFree86 1.2b (1 March 1993)
+13. Improved ISC support for xman
+12. Improved handling of overscan colour
+11. Make the server's -pn option the default (compile time configurable)
+10. Hga2 support for 386BSD and Mach
+9. pvga1 driver support for WD90C3x
+8. Portable assembler macros (from Greg Sharp)
+7. More flexible handling of Vendor strings in Xconfig
+6. Store clock resolutions to nearest 1kHz.
+5. Removed old SpeedUp version
+4. Changes in LinkKit to handle distributions built with PEX support
+
+XFree86 1.2a (20 February 1993)
+3. Xlib support for run-time selectable multiple LOCAL connection types
+ for SVR3, SVR4
+2. Fix mapping problem when using codrv and a non-US keyboard mapping
+1. Fix for TVGA interlaced modes
+
+
+XFree86 1.2 (8 February 1993)
+74. README updates
+73. ATI driver updates
+72. Banked mono doesn't work on ET3000 -- so turned off for that driver
+71. Merged in MIT fix-22
+70. Changes so that XFree86 patched source will build on other platforms.
+
+XFree86 1.1F (1 February 1993)
+69. Add check for presence of "Modes" line in Xconfig
+68. Add assembler code for byte-order swapping in mfb
+67. More svr3 shlib "tuning"
+
+XFree86 1.1E (26 January 1993)
+66. Change to pvga1 driver to get correct clock ordering for 90C30
+65. Fix linux problem building liboldX
+64. server locking to prevent clobbering of local connection pipes
+63. xhost fix for LOCALCONN
+62. Add missing svr3 shlib patches
+
+XFree86 1.1D (24 January 1993)
+61. Removed SVR3 shlib stubs from clients
+
+XFree86 1.1Ce (23 January 1993)
+60. SVR3 shared lib support (from Thomas Wolfram)
+59. Added Hercules driver (from Davor Matic)
+58. Re-map scancodes for Codrv so that the keycodes the server sees are the
+ same on all platforms
+57. Modify NumPad handling so that Shift works properly.
+
+XFree86 1.1Cd (13 January 1993)
+56. Commented out force VT disabling -- causes problems with Esix 4.0.3A
+55. Support for tvga9000 (from Gertjan Akkerman)
+54. Ignore FontPath in Xconfig when a FontPath is provided with the -fp option
+53. Support for new Linux VTs
+52. Turn off Alt-Sysreq-F (forced VT switch) by default for SYSV. Added an
+ Xconfig option to prevent this disabling (AllowForceVT)
+51. X386keybd man page added
+50. mfb.banked fixes
+
+XFree86 1.1Cc (3 January 1993)
+49. tvga driver updates for banked mono
+48. Fixes to cfbblt, mfbblt for single-banked drivers
+
+XFree86 1.1Cb (1 January 1993)
+47. Added -verbose (default) and -quiet flags, and print out more information
+ in verbose mode
+46. Improved banking for mfb.banked
+
+XFree86 1.1Ca (30 December 1992)
+45. cmfb code (from Davor Matic), and an experimental mfb.banked
+44. Flush mouse input after opening
+43. Fix problem starting X from within an X session
+
+XFree86 1.1C (23 December 1992)
+42. Added -probeonly option which causes the server to exit after the
+ device probe stage.
+41. Merged in MIT fix-21
+40. Support for an external clock setting program
+39. Patches for Destiny (SVR4.2)
+
+XFree86 1.1Ba (17 December 1992)
+38. Merged in MIT fix-20
+37. Various improved error messages
+36. Improve accuracy of clock probing code -- add delay so VCO can
+ stabilise before starting the measurement
+35. Store dot-clocks to .1MHz accuracy
+34. Make the server's -dpi option work
+33. Extend fontpath validation to the compiled-in default fontpath
+32. Increase server priority while probing for clocks
+31. Fixed KDSETRAD bug introduced in 1.1a (affected DELL)
+30. Bell support for pccons driver on 386BSD
+
+XFree86 1.1B (21 November 1992)
+29. Hack for ISC local connection on SVR4 with ACP (requires the ISC
+ client binary to be edited)
+28. Added code to change IOPL on SYSV for extended I/O (including patch
+ scripts for the SVR4 kernel)
+27. Merged in MIT fix-18 and fix-19
+26. Support for PS/2 mouse
+
+XFree86 1.1A (16 November 1992)
+25. Fix problems compiling with a non-ansi compiler.
+
+XFree86 1.1c (8 November 1992)
+24. Xconfig options to set default mapping of some special keys
+23. Code to validate the fontpath given in Xconfig
+22. Patches for Logitech Trackman/Mouseman (from Christian Ziemann)
+21. Updates for version 0.1.1 of Holger's co driver
+20. Fix for et3000 text mode restoration (from Holger Veit)
+19. Fix NumLock support -- use two sets of keycodes for num keypad
+18. Add Compose / Multi-key support to Xlib (from MIT contrib)
+17. Don't reset state of lock keys when starting the server
+16. Fix code for setting visual type from Xconfig
+
+XFree86 1.1b (21 October 1992)
+15. Xload support for Linux
+14. Use Xconfig.cpp to generate the sample Xconfig with paths consistent with
+ the configuration.
+13. Allow multiple "FontPath" lines in Xconfig which are concatenated to build
+ the FontPath.
+12. Blank and clear the screen during server startup
+11. Fix tegblt code for mono server (instead of the previous workaround)
+10. Fix non-32bit tiles and stipples for mono server with 8-bit scanlines
+9. Fix circle/ellipse drawing for mono server
+8. Use 8-bit bitmap scanlines for mono server (can now remove pixmap hack)
+7. Add check in server to see if euid==0. If not, exit with a warning.
+
+XFree86 1.1a (11 October 1992)
+6. Add a VTInit option to Xconfig to run a program on the VT during
+ screen initialisation.
+5. Fix security holes in reading Xconfig files, and the undocumented
+ -mono and -colour options.
+4. Use KDMKTONE for bell for systems that support it
+3. Allow 4 clocks for generic driver
+2. Mods to allow compile time selection of 128k display mapping for mono
+ (this is experimental and may be removed)
+1. Holger's 386BSD co driver support (compile-time selectable)
+
+
+XFree86 1.1 (1 October 1992)
+70. Public release
+69. Set mailbox for 386bsd in Xaw
+
+XFree86 1.0Zb (30 September 1992)
+68. Mods to startx so that an absolute path is not required for a server
+67. Make the right-hand <ALt> key behave like Alt_R
+66. Updates to X386.man
+65. Add -mono and -colour (undocumented) options to server
+64. Look for Xconfig file in /etc before /usr/X386/lib/X11
+63. Print out Trident version in probe routine and add README.trident
+
+XFree86 1.0Za (27 September 1992)
+62. cfb.banked changes for Mach's BSD cpp.
+61. Add mkwhatis script for 386BSD
+60. Fix problems with xgc/lex.l
+59. Modify default keymap so Alt_L will work like both Meta_L and Alt_L.
+58. xload fixes for 386BSD
+57. Change config/x386config.sh for dumb BSD sh.
+
+XFree86 1.0Z (24 September 1992)
+56. Beta release (final for 1.1)
+55. Add ISC22, ISC30 defines
+
+XFree86 1.0Yb (21 September 1992)
+54. Included Thomas Eberhardt's updates to the compressed font code.
+53. Put Alan Hourihane's generic save/restore code into vgaHW.c
+52. Correction to xmh man page
+51. Support use of libdbm.a for ISC 3.0
+
+XFree86 1.0Ya (17 September 1992)
+50. Merge in Linux support (from Orest Zborowski)
+
+XFree86 1.0Y (14 September 1992)
+49. Beta release (second for 1.1)
+48. Removed FAS support on SVR4
+47. Changes to font and text save/restore
+
+XFree86 1.0Xc (12 September 1992)
+46. Fix xman scroll bug
+45. Update to ati driver to save more planes
+44. Single/double bank selection for drivers
+
+XFree86 1.0Xb (9 September 1992)
+43. Link Kit updates
+
+XFree86 1.0Xa (8 September 1992)
+42. Fix some Xconfig related problems
+41. Trident driver (256 colour and mono)
+40. Mono drivers for et3000, pvga1, gvga (untested)
+
+XFree86 1.0X (4 September 1992)
+39. Beta release
+38. Minor updates
+
+XFree86 1.0m (2 September 1992)
+37. Change name to XFree86
+36. Added link kit
+
+X386 1.2E 1.0l (30 August 1992)
+35. Added (experimental) ATI driver
+34. Changed configuration so that mono and colour servers can be built
+ at the same time.
+X386 1.2E 1.0k (30 August 1992)
+33. Directory re-organisation
+
+X386 1.2E 1.0j (29 August 1992)
+32. Fix problem of server crashing while resetting
+
+X386 1.2E 1.0i (28 August 1992)
+31. Portability changes to vgaFasm.h (for cc and gcc-1.??)
+30. Added a -xconfig flag to specifiy the Xconfig file from the command line.
+29. Fixed problem with xdmauth accessing memory between 640k and 1M.
+28. Round down the specified virtual width to the nearest required multiple.
+27. Fix some bugs in the Xconfig parser.
+26. Added 'vga2' keyword for Xconfig so one file can be used for both the
+ colour and mono servers.
+25. README's updated
+24. Minor speedup fix
+23. More server configuration changes
+
+X386 1.2E 1.0h (26 August 1992)
+22. cfb.banked updated for fix-17
+21. New SpeedUp code (works for any* virtual width)
+20. Monochrome VGA server
+19. Changes for compile-time selection of supported chipsets, and font
+ renderers
+18. Updated X386.man, README.Mach
+17. Fix mouse map bug for logitech (and microsoft?).
+16. Merge in changes for Mach386 (from Robert Baron, Joel Jacobson)
+15. Merge in changes for 386BSD (from Rich Murphey, Amancio Hasty)
+
+X386 1.2E 1.0g (25 August 1992)
+14. Merged in MIT fix-17
+
+X386 1.2E 1.0f (4 August 1992)
+13. SpeedUp flag for Rectangle Stipple fills
+
+X386 1.2E 1.0e (4 August 1992)
+12. Extend the trapping of unexpected fatal signals beyond just SIGSEGV.
+ The NoTrapSegV option has been changed to NoTrapSignals.
+
+X386 1.2E 1.0d (3 August 1992)
+11. Run mkfontdir in install directory rather than copying fonts.dir from
+ the build directory.
+10. Merged in MIT fix-16
+
+X386 1.2E 1.0c (1 August 1992)
+9. Run 'mcs -d' on SVR4 shared libraries
+8. Merged in official Type1 font patch
+7. Merged in MIT fix-15
+6. Fixed malloc/free problems in lib/X/XcmsLRGB.c, clients/xdm/greet.c
+5. Merged in MIT fix-14
+
+X386 1.2E 1.0b (27 July 1992)
+4. Updated version of fFill.s
+3. Bug fixes (for stipple) from Jim (require GCC at the moment)
+
+X386 1.2E 1.0a (22 July 1992)
+2. Merged in MIT fix-13
+1. Fix problem with divide by zero when bell pitch was set to zero.
+
+
+X386 1.2E 1.0 (16 July 1992)
+97. First general release
+96. Define repz to be repe for gas.
+95. Update XdmConf.svr4 to read /etc/default/login to set ulimit, etc.
+
+X386 1.2E 0.2c (15 July 1992)
+94. Allow easy selection of ansi level when building non-core clients.
+93. Install and use sessreg (for xdm)
+92. .align changes for gas
+91. README and X386.man updates
+
+X386 1.2E 0.2b (11 July 1992)
+90. Mods to SpeedUp for gas (jcxz changes).
+89. Minor change to xdm/auth.c for ISC3.0
+88. Removed SVR4 Vendor defines.
+
+X386 1.2E 0.2a (8 July 1992)
+87. Added some missing cld's to gBitBlt.s
+86. Some portability changes to fFill.s
+85. VT release problem when using FAS/SVR4 really fixed this time.
+84. Moved libinetemul.a to lib/InetEmul; library now called libXinetem.a, and
+ used in a similar way as libXbsd.a. Changes to top level Imakefile have
+ been removed.
+83. Updates to README (building under ISC2.2, compiling clients)
+82. Include libXbsd.a in ExtraLibraries for SVR4/SYSV
+
+X386 1.2E 0.2 (3 July 1992)
+81. Second beta version
+80. et debug option removed
+
+X386 1.2E 0.1i (2 July 1992)
+79. Fixed VT release problem when using FAS/SVR4.
+78. Added warning about using xdmauth.
+77. Updated XdmConf.svr4 to handle different auth types
+76. Reorganisation of some compiler and assembler related options in x386.cf
+
+X386 1.2E 0.1h (27 June 1992)
+75. More portability changes to assembler code.
+74. Updates to modeDB, XdmConf.svr4
+
+X386 1.2E 0.1g (25 June 1992)
+73. Assembler portability changes from Jon Block.
+72. Change startup message from 'X Windows System' to 'X Window System'
+
+X386 1.2E 0.1f (20 June 1992)
+71. Fixed line problem when compiling with SVR4 'cc'.
+70. Changes to make source compile with Esix 3.2D, ISC 3.0 (without TCPCONN)
+
+X386 1.2E 0.1e (17 June 1992)
+69. Removed Glenn's wrapper comments from cfb.banked files.
+68. Added a debug flag to check operation of hiclock selection, and hopefully
+ fixed the problem with that.
+67. Fixed PIC flag problem in sv4Lib.rules
+
+X386 1.2E 0.1d (13 June 1992)
+66. Xconfig is installed as Xconfig.sample so as not to overwrite a locally
+ configured one.
+65. Use HasSdbm to determine use of -lsdbm for server and rgb.
+64. Made SpeedUp the default when appropriate, and added 'SpeedUp "none"' and
+ 'NoSpeedUp' options.
+63. Updates to README, X386.man, modeDB.txt.
+62. Added a shar file with sample configuration files for xdm.
+61. Another setpgrp() change in xdm.
+60. Added command line option to specify which VT the server runs on.
+59. Changed default pointer map to the correct 1:1 map.
+58. Fixed bug in merge of SPEEDUP_TEGBLT8 which caused problems when that
+ option was not selected.
+
+X386 1.2E 0.1c (7 June 1992)
+57. Remove some setpgrp() calls in xdm. This allows xdm to work with
+ xqueue on Microport, Dell, AT&T versions.
+56. Default for server to open SCO Xsight connection for SVR4. SVR4.0.4
+ supports this as part of its "Advanced Compatibility Package". The
+ code doesn't appear to cause problems with versions of SVR4 without this
+ (the feature just can't be used on them).
+
+X386 1.2E 0.1b (3 June 1992)
+55. Fixed bug in SPEEDUP_TEGBLT8 selection in vga.c
+54. Glenn's new cfbteblt8.c
+
+X386 1.2E 0.1a (30 May 1992)
+53. Fixed problem when switching VT away too quickly after switching back.
+52. Added Vendor defines for ISC SVR4 (ISC4), AT&T SVR4 (ATT4)
+
+X386 1.2E 0.1 (29 May 1992)
+51. First beta version
+
+X386 1.2E 0.0n (28 May 1992)
+50. Added README.X386-1.2E
+49. Introductory info added to modeDB.
+48. A few missed RCS Header lines.
+
+X386 1.2E 0.0m (26 May 1992)
+47. Added options to control building 75dpi, 100dpi, and large misc fonts.
+46. More updates to modeDB.
+45. Assembly changes for more pedantic 4.0.4 assembler.
+44. Moved site-specific defines from x386.cf to site.def
+43. Define usleep as the nap syscall for all SVR4 to avoid using libucb.a
+
+X386 1.2E 0.0l (23 May 1992)
+42. Added BuildType1 option
+41. Fixed ManDir and LibmanDir in site.def
+40. Added RCS Header lines to modified files
+
+X386 1.2E 0.0k (23 May 1992)
+39. Moved Glenn's and Jim's assembler routines into ddx/x386/enhanced
+38. Local connection added to X386.man
+37. Jim's update to cfbtileodd.c
+
+X386 1.2E 0.0j (21 May 1992)
+36. Updates to ModeDB.txt
+35. New fLineH.s from Jim
+34. New gLine.s from Glenn
+
+X386 1.2E 0.0i (19 May 1992)
+33. Fixed problem with setting mouse acceleration
+32. Prettied up startup message
+
+X386 1.2E 0.0h (16 May 1992)
+31. Removed SPEEDUP_TEGBLT8 from SPEEDUP_ALL -- it causes problems for some
+ font rendering (characters coming out as solid filled blocks).
+30. Added Thomas Eberhardt's compressed bitmap font patches
+
+X386 1.2E 0.0g (15 May 1992)
+29. #undef'd SO_DONTLINGER in os/connection.c for SVR4 -- it is not properly
+ defined for SVR4, and it removes the familiar startup error message.
+28. Changed SPEEDUP_VHLINE to SPEEDUP_LINE since it's not just for V, H lines
+27. Included Glenn's gLine.s
+26. Modified auto-detect HiClock code to use Thomas' method of making 16
+ clocks available with ET4000. HiClock option has been removed since
+ this change makes it obsolete. X386.man and Xconfig have been updated
+ accordingly.
+25. Fix problem switching after SIGHUP is sent while VT switched away.
+24. Take x386Resetting out of os/utils.c and put it in x386Init.c
+23. Turn on screen saver before copying screen to pixmap when switching away
+22. Fixed typo in vga.c related to SPEEDUP_TEGBLT8
+
+X386 1.2E 0.0f (14 May 1992)
+21. Removed special handling of SIGSEGV when server is exiting.
+20. Take care of server exiting and resetting when VT is switched away.
+19. Copy screen to dummy pixmap when switching away, and copy it back when
+ switching back. (The contents were of the dummy pixmap were previously
+ ignored.) Masking window is no longer used.
+
+X386 1.2E 0.0e (13 May 1992)
+18. Add missing argument in call of GlennsFillBoxSolid -- hopefully fixes
+ SIGSEGV problem.
+17. Added x386Version.h, CHANGELOG
+16. Added a couple of #undef's in cfbhrzvert.c
+15. Fold in public-patch-9 for cfb/cfbbresd.c into cfb.banked/cfbbresd.c
+14. casting for VGABASE in cfbbitblt.c
+13. #include fix in connection.c
+12. Disable building of FontServer in site.def
+
+X386 1.2E 0.0d (12 May 1992)
+11. Changes to gFillCopy.s, gVHLine.s to improve hseg100 performance.
+10. Change the way GCOps are initialised when SpeedUp is selected
+9. Add SpeedUp to cfbteblt8.c that assumes xdim=1024
+
+X386 1.2E 0.0c (10 May 1992)
+8. Allow SpeedUp Xconfig option to individually select various speedups
+
+X386 1.2E 0.0b (10 May 1992)
+7. Autodetect for HiClock option (not tested yet)
+6. Fix for cfbblt not setting read on dst for GC ops that require it
+5. Minor change in X386.man
+
+X386 1.2E 0.0a (09 May 1992)
+4. Reset screen saver timer for ForceScreenSaver(Reset)
+3. Reset screen saver when switching back
+2. Raise masking window when switching back so all windows get expose events
+1. Use dummy buffer for screen writes when VT is switched away
+
+X386 1.2E 0.0 (07 May 1992)
diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile
new file mode 100644
index 000000000..0db369869
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/Imakefile
@@ -0,0 +1,195 @@
+XCOMM $XConsortium: Imakefile /main/12 1996/12/16 12:31:46 rws $
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.60 1999/08/14 10:49:30 dawes Exp $
+
+#include <Server.tmpl>
+#define IHaveSubdirs
+
+#if XF86VgaHw
+VGAHWDIR = vgahw
+#endif
+
+#if XF86FBDevHw
+FBDEVHWDIR = fbdevhw
+#endif
+
+#if XF86XAA
+XAADIR = xaa
+#endif
+
+#if XF1Bpp || XF4Bpp
+XF1BPPDIR = xf1bpp
+# if XF4Bpp
+XF4BPPDIR = xf4bpp
+# endif
+#endif
+
+#if XF8_32Bpp
+XF8_32BPPDIR = xf8_32bpp
+#endif
+
+#if XF8_16Bpp
+XF8_16BPPDIR = xf8_16bpp
+#endif
+
+#if XF24_32Bpp
+XF24_32BPPDIR = xf24_32bpp
+#endif
+
+#if XFShadowFB
+SHADOWFBDIR = shadowfb
+#endif
+
+#if XF86I2C
+I2CDIR = i2c
+#endif
+
+#if XF86DDC
+DDCDIR = ddc
+#endif
+
+#if XF86Ramdac
+RAMDACDIR = ramdac
+#endif
+
+#if XF86RAC
+RACDIR = rac
+#endif
+
+#if !defined(OsfArchitecture) && !defined(AmoebaArchitecture) && \
+ !defined(ArcArchitecture) && !defined(Arm32Architecture) && \
+ !defined(PpcArchitecture)
+SUPERPROBE = SuperProbe
+#endif
+
+#if BuildXF86Setup
+XF86SETUPDIR = XF86Setup
+#endif
+
+#if DoLoadableServer
+LOADERDIR = loader
+#endif
+
+#if BuildXInputExt
+INPUTDIR = input
+#endif
+
+#if DoLoadableServer
+DRIVERSDK = sdk
+#endif
+
+SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \
+ $(XF8_32BPPDIR) $(XF8_16BPPDIR) $(XF24_32BPPDIR) $(SHADOWFBDIR) \
+ drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \
+ $(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) parser \
+ scanpci doc xf86config $(XF86SETUPDIR) etc \
+ $(SUPERPROBE) $(DRIVERSDK)
+
+#ifndef OS2Architecture
+XF86CONFIG = XF86Config
+XF98CONFIG = XF98Config
+#else
+XF86CONFIG = XF86Conf
+#endif
+
+all:: $(XF86CONFIG) $(XF98CONFIG)
+
+#if defined(i386BsdArchitecture) && !defined(FreeBSDArchitecture)
+MANPAGE=Concat(FileManDir,/XF86Config.0)
+#else
+MANPAGE=Concat3(FileManDir,/XF86Config.,FileManSuffix)
+#endif
+
+RGBPATH=\"DefaultRGBDatabase\"
+LOCALFONTPATH=\"$(LIBDIR)/fonts/local/\"
+MISCFONTPATH=\"$(LIBDIR)/fonts/misc/\"
+T1FONTPATH=\"$(LIBDIR)/fonts/Type1/\"
+CIDFONTPATH=\"$(LIBDIR)/fonts/CID/\"
+SPFONTPATH=\"$(LIBDIR)/fonts/Speedo/\"
+DPI75FONTPATH=\"$(LIBDIR)/fonts/75dpi/\"
+DPI100FONTPATH=\"$(LIBDIR)/fonts/100dpi/\"
+DPI75USFONTPATH=\"$(LIBDIR)/fonts/75dpi/:unscaled\"
+DPI100USFONTPATH=\"$(LIBDIR)/fonts/100dpi/:unscaled\"
+
+#ifdef FreeBSDArchitecture
+ FREEBSDMOUSEDEV=" Option \"Device\" \"/dev/mse0\""
+#else
+ FREEBSDMOUSEDEV="XCOMM Option \"Device\" \"/dev/mse0\""
+#endif
+
+#if defined(i386BsdArchitecture)&&defined(NetBSDArchitecture)
+# if (OSMajorVersion >= 1) && (OSMinorVersion >= 1)
+ NETBSDOLDMOUSEDEV="XCOMM Option \"Device\" \"/dev/mms0\""
+ NETBSDNEWMOUSEDEV=" Option \"Device\" \"/dev/lms0\""
+# else
+ NETBSDOLDMOUSEDEV=" Option \"Device\" \"/dev/mms0\""
+ NETBSDNEWMOUSEDEV="XCOMM Option \"Device\" \"/dev/lms0\""
+# endif
+#else
+ NETBSDOLDMOUSEDEV="XCOMM Option \"Device\" \"/dev/mms0\""
+ NETBSDNEWMOUSEDEV="XCOMM Option \"Device\" \"/dev/lms0\""
+#endif
+
+#ifdef LinuxArchitecture
+ LINUXMOUSEDEV=" Option \"Device\" \"/dev/mouse\""
+#else
+ LINUXMOUSEDEV="XCOMM Option \"Device\" \"/dev/mouse\""
+#endif
+
+#ifdef MinixArchitecture
+CppFileTarget($(XF86CONFIG), XF86Conf.cpp,
+ -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH)
+ -DLOCALFONTPATH=$(LOCALFONTPATH)
+ -DT1FONTPATH=$(T1FONTPATH) -DCIDFONTPATH=$(CIDFONTPATH)
+ -DSPFONTPATH=$(SPFONTPATH)
+ -DDPI75FONTPATH=$(DPI75FONTPATH) -DDPI100FONTPATH=$(DPI100FONTPATH)
+ -DDPI75USFONTPATH=$(DPI75USFONTPATH) -DDPI100USFONTPATH=$(DPI100USFONTPATH)
+ -DMANPAGE=$(MANPAGE) -DMODULEPATH=\"$(MODULEDIR)\",
+ $(ICONFIGFILES))
+
+InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR))
+#else
+CppFileTarget($(XF86CONFIG), XF86Conf.cpp, \
+ -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) \
+ -DLOCALFONTPATH=$(LOCALFONTPATH) \
+ -DT1FONTPATH=$(T1FONTPATH) \
+ -DCIDFONTPATH=$(CIDFONTPATH) \
+ -DSPFONTPATH=$(SPFONTPATH) \
+ -DDPI75FONTPATH=$(DPI75FONTPATH) \
+ -DDPI100FONTPATH=$(DPI100FONTPATH) \
+ -DDPI75USFONTPATH=$(DPI75USFONTPATH) \
+ -DDPI100USFONTPATH=$(DPI100USFONTPATH) \
+ -DMANPAGE=$(MANPAGE) -DMODULEPATH=\"$(MODULEDIR)\", \
+ $(ICONFIGFILES))
+CppFileTarget($(XF98CONFIG), XF98Conf.cpp, \
+ -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) \
+ -DLOCALFONTPATH=$(LOCALFONTPATH) \
+ -DT1FONTPATH=$(T1FONTPATH) \
+ -DCIDFONTPATH=$(CIDFONTPATH) \
+ -DSPFONTPATH=$(SPFONTPATH) \
+ -DDPI75FONTPATH=$(DPI75FONTPATH) \
+ -DDPI100FONTPATH=$(DPI100FONTPATH) \
+ -DDPI75USFONTPATH=$(DPI75USFONTPATH) \
+ -DDPI100USFONTPATH=$(DPI100USFONTPATH) \
+ -DFREEBSDMOUSEDEV=$(FREEBSDMOUSEDEV) \
+ -DNETBSDOLDMOUSEDEV=$(NETBSDOLDMOUSEDEV) \
+ -DNETBSDNEWMOUSEDEV=$(NETBSDNEWMOUSEDEV) \
+ -DLINUXMOUSEDEV=$(LINUXMOUSEDEV) \
+ -DMANPAGE=$(MANPAGE) -DMODULEPATH=\"$(MODULEDIR)\", \
+ $(ICONFIGFILES))
+InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR))
+InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR))
+#endif
+
+InstallManPage(XFree86,$(MANDIR))
+InstallGenManPageLong(XF86Conf,$(FILEMANDIR),XF86Config,$(FILEMANSUFFIX))
+InstallNamedNonExec($(XF86CONFIG),XF86Config.eg,$(LIBDIR))
+InstallNamedNonExec($(XF98CONFIG),XF86Config.98,$(LIBDIR))
+
+InstallDriverSDKNamedNonExec($(XF86CONFIG),XF86Config.eg,$(DRIVERSDKDIR))
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/hw/xfree86/RAC.Notes b/xc/programs/Xserver/hw/xfree86/RAC.Notes
new file mode 100644
index 000000000..24a8bafc8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/RAC.Notes
@@ -0,0 +1,688 @@
+I. Abstract
+===========
+
+Graphics devices are accessed thru ranges in I/O or memory space. While
+most modern graphics devices allow relocation of such ranges many of
+them still require the use of well established interfaces such as VGA
+memory and IO ranges or 8514/A IO ranges. Up to version 3.3 of
+XFree86 only a single graphics device could be driven. Threfore there
+was no need to address the issue of sharing such memory or I/O ranges
+among several devices. Starting with version 4.0 XFree86 is capable of
+driving more than one graphics interface in a multihead environment.
+Therefore a mechanism needed to be desinged which was capbale of
+controlling the sharing the access to memory and I/O ranges. In this
+document we describe to use of the RAC (Resource Access Control)
+system in the XFree86 server which provides the service of controlling
+access to interface resources.
+
+II. Introduction
+================
+
+Terms and definitions:
+
+II.1. Bus
+---------
+
+'Bus' is ambiguous as it is used for different things: It may refer to
+physical incompatible extension connectors in a computer system. The
+RAC system knows two such systems: The ISA bus and the PCI bus. (On
+the software level EISA, MC and VL buses are currently treated like
+ISA buses). 'Bus' may always refer to logically different entities on
+a single bus system which are connected via briges. A PCI system may
+have several distinct PCI buses connecting each other by PCI-PCI
+bridges or to the host CPU by HOST-PCI bridges.
+
+Systems that host more than one bus system link these together using
+bridges. Bridges are a concern to RAC as they might block or pass
+specific resources. PCI-PCI bridges may be set up to pass VGA
+resources to the secondary bus. PCI-ISA buses pass any resources not
+decoded on the primary PCI bus to the ISA bus. This way VGA resources
+(although exclusive on the ISA bus) can be shared by ISA and PCI
+cards. Currently HOST-PCI bridges are not yet handeled by RAC as they
+require specific drivers.
+
+II.2. Entity
+------------
+
+The smallest independently addressable unit on a system bus is
+referred to as an entity. So far we know ISA and PCI entities. PCI
+entities can be located on the PCI bus by an unique ID consisting of
+the bus, card and function number.
+
+II.3. Resource
+--------------
+
+ 'Resource' referres to a range of memory or I/O addresses an entity
+can decode.
+
+If a device is capable of disabling this decoding the resource is
+called sharable. For PCI devices a generic method is provided to
+control resource decoding. Other devices will have to provide a device
+specific funtion to control decoding.
+
+If the entity is capable of decoding this range at a different
+location this resource is considered relocatable. Resource which start
+at a specific address and occupy a single continuous range are called
+block resources.
+
+Alternatively resource addresses can be decoded in a way that they
+satisfy the condition:
+
+ address & mask == base
+
+with base & mask == base. Resources addressed in such a way are
+considered sparse resources.
+
+
+II.4. ServerStates
+------------------
+
+The resource access control system knows two server states: the SETUP
+and the OPERATING state. The setup state is entered whenever a mode
+change takes place or the server exits or does VT switching. During
+this state any entity resource is under resource access control.
+During OPERATING state only those entities are controlled which
+actually have shared resources that conflict with others. The
+determination which entity is to be placed under RAC during OPERATING
+state takes place after ScreenInit() during the first server
+generation. This doesn't apply if only one screen is active: in this
+case no RAC is needed and the screen is simply left enabled while the
+server is active.
+
+
+III. Theory of operation
+========================
+
+III.1. General
+--------------
+
+The common level has knowledge of generic access control mechanisms
+for devices on certain bus systems (currently the PCI bus) as well as
+of methods to enable or disable access to the buses
+itself. Furthermore it can access information on resources decoded by
+these devices and if necessary modify it.
+
+When first starting the Xserver collects all this information, saves
+it for restauration checks it for consistency and if necessary correts
+it. Finally it disables all resources on a generic level prior to
+calling any driver function.
+
+ The user should provide a device section in XF86Config for each
+graphics device installed in his system. Each such entity which is
+never to be used as X display device might be marked as inactive by
+adding the keyword "Inactive" to the device section.
+
+When the Probe() function of each driver is called the device sections
+are matched against the devices found in the system. The driver may
+probe devices at this stage that cannot be identified by using device
+independent methods. Access to all resources that can be controlled in
+a device independent way is disabled. The Probe() function should
+register all non-relocatable resources at this stage. If a resource
+conflict is found between exclusive resources the driver will fail
+immediately. Optionally the driver might specify an EntityInit(),
+EntityLeave() and EntityEnter() function.
+
+EntityInit() can be used to disable any shared resources that are not
+controlled by the generic access control functions. It is called prior
+to the PreInit phase regardless if an entity is active or not. When
+calling the EntityInit(), EntityEnter() and EntityLeave() functions
+the common level will disable access to all other entities on a
+generic level. Since the common level has no knowledge of device
+specific methods to disable access to resources it cannot be
+guaranteed that certain resources are not decoded by any other entity
+until the EntityInit() or EntityEnter() phase is finished. Device
+drivers should therefore register all those resources which they are
+going to disable. If these resources are never to be used by any
+driver function they may be flagged 'ResInit' so that they can be
+removed from the resource list after processing all EntityInit()
+functions. EntityEnter() should disable decoding of all resources
+which are not registered as exclusive and which are not handled by the
+generic access control in the common level. The difference to
+EntityInit() is that the latter one is only called once during
+lifetime of the server. It can therefore be used to set up variables
+prior to disabling resources. EntityLeave() should restore the
+original state when exiting the server or switching to a different vt.
+It also needs to disable device specific access functions if they need
+to be disabled on server exit or VT switch. The default state is to
+enable them before giving up the VT.
+
+In PreInit() phase each driver should check if any sharable resources
+it has registered during Probe() has been denied and take appropriate
+action which could simply be to fail. If it needs to access resources
+it has disabled during EntitySetup() it can do so provided it has
+registered these and will disable them before returning from
+PreInit(). This also applies to all other driver functions. Several
+functions are provided to request resource ranges, register these,
+correct PCI config space and add replacements for the generic access
+functions. Resources may be marked 'disabled' or 'unused' during
+OPERATING stage. Although these steps could also be performed in
+ScreenInit(), this is not desirable.
+
+Following PreInit() phase the common level determines if resource
+access control is needed. This is the case if more than one screen is
+used. If necessary the RAC wrapper module is loaded. In ScreenInit()
+the drivers can decide which operations need to be placed under
+RAC. Available are the frame buffer operations, the pointer operations
+and the colormap operations. Any operation that requires resources
+which might be disabled during OPERATING state should be set to use
+RAC. This can be specified separately for memory and IO resources.
+
+When ScreenInit() phase is done the common level will determine which
+shared resources are requested by more than one driver and set the
+access functions accordingly. This is done following these rules:
+
+a. The sharable resources registered by each entity are compared. if
+ a resource is registered by more than one entity the entity will be
+ marked to need to share this resources type (IO or MEM).
+
+b. A resource marked 'disabled' during OPERATING state will be ignored
+ entirely.
+
+c. A resource marked 'unused' will only conflicts with an overlapping
+ resource of an other entity if the second is actually in use during
+ OPERATING state.
+
+d. If an 'unused' resource was found to conflict however the entity
+ does not use any other resource of this type the entire resource
+ type will be disabled for that entity.
+
+The driver has the choice among different ways to control access to
+certain resources:
+
+a. It can relay on the generic access functions. This is probably the
+ most common case. Here the driver only needs to register any
+ resource it is going to use.
+
+b. It can replace the generic access functions by driver specific
+ ones. This will mostly be used in cases where no generic access
+ functions are available. In this case the driver has to make sure
+ these resources are disabled when entering the PreInit() stage.
+ Since the replacement functions are registered in PreInit() the
+ driver will have to enable these resources itself if it needs to
+ access them during this state. The driver can specify if the
+ replacement functions can control memory and/or I/O resources
+ separately.
+
+c. The driver can enable resources itself when it needs them. Each
+ driver function enabling them needs to disable them before it will
+ return. This should be used if a resource which can be controlled
+ in a device dependent way is only required during SETUP state. This
+ way it can be marked 'unused' during OPERATING state.
+
+A resource which is decoded during OPERATING state however never
+accessed by the driver should be marked unused.
+
+Since access switching latencies are an issue during Xserver
+operation, the common level attempts to minimize the number of
+entities that need to be placed under RAC control. When a wrapped
+operation is called, the EnableAccess() function is called before
+control is passed on. EnableAccess() checks if a screen is under
+access control. If not it just establishes bus routing and returns. If
+the screen needs to be under access control, EnableAccess() determines
+which resource types (MEM,IO) are required. Then it tests if this
+access is already established. If so it simply returns. If not it
+disables the currently established access, fixes bus routing and
+enables access to all entities registered for this screen.
+
+Whenever a mode switch or a vt-switch is performed the common level
+will return to SETUP state.
+
+III.3. Resource Types
+---------------------
+
+Resource have certain properties. When registering resources each
+range is accompanied by a flag consisting of the or'ed flags of the
+different properties the resource has. Each resource range may be
+classified according to
+
+- its physical properties ie. if it addresses
+ memory (ResMem) or
+ I/O space (ResIo),
+- if it addresses a
+ block (ResBlock) or
+ sparse (ResSparse)
+ range,
+- its access properties.
+
+There are two known access properties:
+
+- ResExclusive
+ for resources which may not be shared with any other device and
+- ResShared
+ for resources which can be disabled and therefore can be shared.
+
+If it is desirable to test a resource aganist any type a generic
+access type 'ResAny' is provided. If this is set the resource will
+conflict with any resource of a different entity intersecting its
+range. Further it can be specified that a resource is decoded however
+never used during any stage (ResUnused) or during OPERATING state
+(ResUnusedOpr). A resource only visible during the init functions (ie.
+EntityInit(), EntityEnter() and EntityLeave() should be registered
+with the flag 'ResInit'. A resource that might conflict with
+backgronud resource ranges may be flagged with 'ResBios'. This might
+be useful when registering resources ranges that were assigned by the
+system Bios.
+
+Several predefined resource lists are available for VGA and 8514/A
+resources in common/sf86Resources.h.
+
+IV. Available Functions
+=======================
+
+The functions provided for resource management will be listed in order
+of use in the driver.
+
+IV.1. Probe phase
+-----------------
+
+In this stage each driver detects those resources it is able to drive,
+creates an entity record for each of them, registers non-relocatable
+resources and allocates screens and adds the resources to screens.
+
+Two helper functions are provided for matching device sections in the
+XF86Config file to the devices:
+
+ int xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+
+ int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities);
+
+Both functions return the number of matched entities and their indices
+in foundEntities list.
+
+They make use of several subfunctions which are also available on the
+driver level:
+
+ Bool xf86ComparePciBusString(const char *busID, int bus,
+ int device, int func);
+
+and
+
+ Bool xf86ParseIsaBusString(const char *busID);
+
+are called to interpret the busID in the device section. The functions:
+
+ int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active);
+
+ int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool
+ active);
+
+are used to allocate the entities and inititlaize their data
+structures. Both funtions return the index of the newly allocated
+entity record or (-1) should the function fail. Before probing an ISA
+card
+
+ Bool xf86IsPrimaryIsa();
+
+gets called to determine if the primary card was not detected on the
+PCI bus.
+
+Two helper fucntions are provided to aid configuring entities:
+
+ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+ PciChipsets *p_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+ Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+ IsaChipsets *i_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+
+They are used to register the init/enter/leave functions described
+above as well as the non-relocatable resources. Generally the list of
+fixed resources is obtained from the Isa/PciChipsets lists. However
+an additional list of resources may be passed. Generally this is not
+required. The init/enter/leave functions have to be of type
+
+ typedef void (*EntityProc)(int entityIndex,pointer private);
+
+They are passed the entity index and a pointer to a private scratch
+area. This are can be set up during Probe() and its address can be
+passed to xf86ConfigActiveIsaEntity() xf86ConfigActivePciEntity() as
+the last argument.
+
+These helper functions use:
+
+ void xf86ClaimFixedResources(resList list, int entityIndex);
+
+ To register the nonrelocatable resources which cannot be disabled
+ and which therefore would cause the server to fail immediately if
+ they were found to conflict. It also records non-relocatable but
+ sharable resources for processing after the Probe() phase.
+
+ Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer);
+
+ This function registers the init/enter/leave() functions along with
+ the pointer to their private area to the entity.
+
+ void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+
+ adds the entity to the screen.
+
+These functions are also avlailable on the driver level. A detailed
+Probe() function is listed below. For most drivers this can be used
+with little change.
+
+Please note that VGA resources have to be claimed in Probe()
+phase. Otherwise they are not routed to the bus.
+
+IV.2. PreInit() phase
+---------------------
+
+During this phase the remaining resource should be registered.
+PreInit() should call
+
+ EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+
+To obtain a pointer to an EntityInfoRec for each entity it is able to
+drive and check if any resource are listed in 'resources'. These have
+been rejected in the post-Probe() phase. The driver should decide if
+it can continue without using these or if it should fail. The pointer
+to the EntityInfoRec should be freed if not needed any more.
+
+Several functions are provided to simplify resource registration:
+
+ Bool xf86IsEntityPrimary(int entityIndex);
+
+is used to determine if the entity is the display device that is used
+during boot-up and text mode.
+
+ Bool xf86IsScreenPrimary(int scrnIndex);
+
+finds out if the primary entity is registered for the screen with
+specified index.
+
+ pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
+
+returns a pointer to the pciVideoRec of the specified entity. If the
+entity is not a PCI device NULL is returned.
+
+The primary function for registration of resources is
+
+ resPtr xf86RegisterResources(int entityIndex, resList list, int access);
+
+it tries to register the resources in 'list'. If list is NULL it tries
+to determine the resources automatically. This only works for entities
+that provide a generic way to read out the resource ranges they
+decode. So far this is only the case for PCI devices. By default the
+PCI resources are registered as shared (ResShared) if the driver wants
+to set a different access type it can do so by specifying the access
+flags in the third argument. A value of 0 means to use the default
+settings. If for any reason the resource broker is not able to
+register some of the requested resources the function will return a
+pointer to a list of the failed ones. In this case the driver may move
+the resource to different locations. In case of PCI bus entities this
+is done by passing the list of failed resources to
+
+ resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
+
+this function returns a list of reallocated resource. This list needs
+to be passed to xf86RegisterResources() again to be registered with
+the broker.
+
+Two functions are provided to obtain a resource range of a given type:
+
+ resRange xf86GetBlock(long type, memType size,
+ memType window_start, memType window_end,
+ memType align_mask, resPtr avoid);
+ resRange xf86GetSparse(long type, unsigned long fixed_bits,
+ unsigned long decode_mask, unsigned long address_mask,
+ resPtr avoid);
+
+The first one tries to find a block range of size 'size' and type
+'type' in a window bound by window_start and window_end with the
+alignment specified in alignment mask. Optionally a list of resource
+ranges which should be avoided inside this window can be passed. On
+failure it will return a zero range of type 'ResEnd'.
+
+The latter function does the same for sparse resources. A spares range
+is determined by to parameters: the mask and the base value. An
+address satisfying
+
+ mask & address == base
+
+belongs to the specific spares range. 'mask' and 'base' themselves
+have to satisfy:
+
+ mask & base == base.
+
+Here three values have to be specified: the address mask which marks
+all bits of the mask part of the address, the decode_mask which masks
+out the bits which are hadrcoded and are therefore not available for
+relocation and the values of the fixed bits. The function tries to
+find a base that satisfies the given condition. If the function fails
+it will return a zero range of type 'ResEnd'. Optionally it might be
+passed a list of resource ranges to avoid.
+
+Certain PCI devices are broken in the sense that they return invalid
+size information for a certain resource. In this case the driver can
+supply the correct size and make sure that the resource range
+allocated for the card is large enough to hold the address range
+decoded by the card. The function:
+
+ Bool xf86FixPciResource(int entityIndex, unsigned int prt, CARD32 alignment,
+ long type);
+
+is used for that. The parameter prt contains the number of the PCI
+base register that needs to be modified. A value of 6 referres to the
+BIOS base register. The size is specified in the alignment
+register. Since PCI resources need to span an integral range of the
+size 2^n the alignment also specifies the number of addresses that
+will be decoded. If the driver specifies a type mask it can override
+the default type for PCI resources which is 'ResShared'. The resource
+broker needs to know that to find a matching resource range. This
+function should be called before calling xf86RegisterResources().
+
+ Bool xf86CheckPciMemBase(pciVideoPtr pPci, unsigned long base);
+
+checks that the memory base value specified in base matches one of the
+PCI base address register valuse for the given PCI device.
+
+The driver may replace the generic access control functions for an
+entity by it's own ones.
+
+ void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io,
+ xf86AccessPtr p_mem, xf86AccessPtr p_io_mem,
+ xf86AccessPtr *ppAccessOld);
+
+Is used for that. The driver can pass three functions: one for I/O
+access, one for memory access and one for combined memory and I/O
+access. If the memory access and combined access functions are
+identical the common level assumes that the memory access cannot be
+controlled independently of I/O access, if the I/O access function and
+the combined access functions are the same it is assumed that I/O can
+not be controlled independently. If memory and I/O have to be
+controlled together all three values should be the same. If a non
+NULL value is passed as fifth argument it is interpreted as an address
+where to store the old access record. If the fifth argument is NULL
+it will be assumed that the generic access should be enabled before
+replacing the access functions. Otherwise it will be disabled. The
+driver may enable them itself using the returned values. It should do
+this from his replacement access functions as the generic access may
+be disabled by the common level on certain occasions. If replacement
+functions are specified they must control all resources of the
+specific type registered for the entity.
+
+To find out if specific resource range is conflicting with another
+resource
+
+ memType xf86ChkConflict(resRange *rgp, int entityIndex);
+
+may be called. If a non-zero value is retruned a conflict is found.
+
+ resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
+
+is used to set the state of a resource during OPERATING state. 'list'
+holds a list to which 'mask' is to be applied. The parameter 'mask'
+may have the value 'ResUnusedOpr' and 'ResDisableOpr'. The first one
+should be used if a reource isn't used during OPERATING state however
+decoded by the device while the latter one indicates that the resource
+is not decoded during OPERATING state. Note that the resource ranges
+have to match those specified during registration. If a range has been
+specified starting at A and ending at B and suppose C us a value
+satisfying A < C < B one may not specify the resource range (A,B) by
+splitting it into two ranges (A,C) and (C,B).
+
+Two functions are provided for special cases:
+
+ void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+
+may be used to remove an entity from a screen. This only makes sense
+if a screen has more than one entity assigned or the screen is to be
+deleted. No test is made if the screen has any entities left.
+
+ void xf86DeallocateResourcesForEntity(int entityIndex, long type);
+
+deallocates all resources of a given type registered for a certain
+entity from the resource broker list.
+
+IV.3. ScreenInit() phase
+------------------------
+
+Setting up the rac flags is all that remains to do in ScreenInit()
+phase (Note that these flags might also be set up in PreInit() phase).
+The ScrnInfoRec has separate flags for memory and PIO access:
+racIoFlags and racMemFlags. They specifies which graphics operations
+might require the use of resources which might be disabled for some
+reason. Note that even exclusive resources might be disabled if they
+are disabled along with shared resources. For example if a driver has
+registered the VGA PIO resources and lets the common level disable
+these by disabling PIO access in PCI config space (the standard way),
+exclusive PCI PIO ranges will also be disabled. Therefore the driver
+has to flag any operations requiring PCI PIO resources in racIoFlags.
+The avaliable flags are defined in rac/xf86RAC.h. Alvailable are:
+
+ RAC_FB for framebuffer operations (including hw acceleration)
+ RAC_CURSOR for Cursor operations
+ (??? I'm not sure if we need this for SW cursor it depends
+ on wich level the sw cursor is drawn)
+ RAC_COLORMAP for colormap operations
+ RAC_VIEWPORT for the call to RACAdjustFrame()
+
+The flags are or'ed.
+
+V. Appendix
+===========
+
+A. Sample Probe() Function
+--------------------------
+
+static Bool
+XXXProbe(DriverPtr drv, int flags)
+{
+ Bool foundScreen = FALSE;
+ int numDevSections, numUsed;
+ GDevPtr *devSections;
+ int *usedChips;
+ int i;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice(CHIPS_DRIVER_NAME,
+ &devSections)) <= 0) {
+ return FALSE;
+ }
+ /* PCI BUS */
+ /* test if PCI bus present */
+ if (xf86GetPciVideoInfo() ) {
+ /* match PCI instances with ones supported by the driver */
+ numUsed = xf86MatchPciInstances(XXX_NAME, PCI_VENDOR_XXX,
+ XXXChipsets, XXXPCIchipsets,
+ devSections,numDevSections, drv,
+ &usedChips);
+ if (numUsed > 0) {
+ for (i = 0; i < numUsed; i++) {
+ /* Allocate a ScrnInfoRec */
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv,0);
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = XXX_DRIVER_NAME;
+ pScrn->name = XXX_NAME;
+ pScrn->Probe = XXXProbe;
+ pScrn->PreInit = XXXPreInit;
+ pScrn->ScreenInit = XXXScreenInit;
+ pScrn->SwitchMode = XXXSwitchMode;
+ pScrn->AdjustFrame = XXXAdjustFrame;
+ pScrn->EnterVT = XXXEnterVT;
+ pScrn->LeaveVT = XXXLeaveVT;
+ pScrn->FreeScreen = XXXFreeScreen;
+ pScrn->ValidMode = XXXValidMode;
+ foundScreen = TRUE;
+ /* add screen to entity */
+ xf86ConfigActivePciEntity(pScrn,usedChips[i],XXXPCIchipsets,
+ NULL,NULL,NULL,NULL,NULL);
+ }
+ }
+ }
+
+ /* Isa Bus */
+ numUsed = xf86MatchIsaInstances(XXX_NAME,XXXChipsets,XXXISAchipsets,
+ drv,chipsFindIsaDevice,devSections,
+ numDevSections,&usedChips);
+ if(numUsed >= 0)
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv,0);
+
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = XXX_DRIVER_NAME;
+ pScrn->name = XXX_NAME;
+ pScrn->Probe = XXXProbe;
+ pScrn->PreInit = XXXPreInit;
+ pScrn->ScreenInit = XXXScreenInit;
+ pScrn->SwitchMode = XXXSwitchMode;
+ pScrn->AdjustFrame = XXXAdjustFrame;
+ pScrn->EnterVT = XXXEnterVT;
+ pScrn->LeaveVT = XXXLeaveVT;
+ pScrn->FreeScreen = XXXFreeScreen;
+ pScrn->ValidMode = XXXValidMode;
+ foundScreen = TRUE;
+ xf86ConfigActiveIsaEntity(pScrn,usedChips[i],XXXISAchipsets,
+ NULL,NULL,NULL,NULL,NULL);
+ }
+ xfree(devSections);
+ return foundScreen;
+}
+
+B. Porting Issues
+-----------------
+
+Here are some hints on porting code developed for RAC 1 to RAC 2.
+
+1. a. Initialization of RAC is now entirely done on the common level.
+ Therefore the call to xf86RACInit() can be removed.
+
+ b. Also there is no need for the racSymbols list.
+
+ c. LoadSubModule(..,rac) should be removed.
+
+ d. racSymbols should be removed from LoaderRequestSymList(racSymbols,..)
+
+2. a. if the driver uses the predefined resource lists xf86Resources.h
+ needs to be included.
+
+ b. RES_VGA should be changed to RES_EXCLUSIVE_VGA
+
+3. The device list now belongs to the EntityInfoRec.
+ Change pScrn->device to xxx->pEnt->device.
+
+4. Rewrite the Probe() function. The example given above should work
+ as a guideline.
+
+5. Register all necessary resources in PreInit() by calling
+ xf86RegisterResources().
+
+6. If applicable set the operating state of the registered resources
+ by calling xf86SetOperatingState(). This should be done during
+ PreInit(). If necessary it might still be done in ScreenInit()
+
+7. Set up the racIoFlags and racMemFlags.
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/Registry b/xc/programs/Xserver/hw/xfree86/Registry
new file mode 100644
index 000000000..633ff933b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/Registry
@@ -0,0 +1,320 @@
+This is the XFree86 driver/module registry. To avoid name space clashes and
+to maintain some consistency between drivers the important name spaces are
+maintained here.
+
+1. Module Names.
+
+Each module is required to have a unique name. Registered names are:
+
+ati
+bitmap
+cfb
+cfb16
+cfb24
+cfb32
+chips
+dbe
+ddc
+extmod
+glide
+glint
+i2c
+mfb
+mga
+pex5
+rac
+ramdac
+speedo
+tseng
+type1
+vga
+vgahw
+xaa
+xf1bpp
+xf4bpp
+xie
+
+2. External Module Object Symbols.
+
+Each module is required to use a unique prefix or prefixes for all of
+its externally visible symbols. They should be unique without regard to
+case. Registered prefixes are:
+
+ati
+cfb
+chips
+glide
+glint
+mfb
+mga
+neo
+permedia
+tseng
+vga
+vgahw
+xaa
+xf1bpp
+xf4bpp
+
+3. Chipset Names.
+
+Each video driver is required to use a unique set of chipset names. Case,
+white space and underscore characters are ignored when comparing chipset
+names. All names listed here are in lower case with all white space and
+underscores removed. Registered chipset names are:
+
+ati
+ativga
+ct64200
+ct64300
+ct65520
+ct65525
+ct65530
+ct65535
+ct65540
+ct65545
+ct65546
+ct65548
+ct65550
+ct65554
+ct65555
+ct68554
+ct69000
+et4000
+et4000w32
+et4000w32i
+et4000w32p
+et6000
+et6100
+generic
+ibmvga
+ibm8514
+mach32
+mach64
+mach8
+mga2064w
+mga1064sg
+mga2164w
+mga2164wagp
+neo2070
+neo2090
+neo2093
+neo2097
+neo2160
+neo2200
+tipm2
+vgawonder
+voodoo
+
+4. Option Names.
+
+Option names and their usage should be consistent between drivers.
+Case, white space and underscore characters are ignored when comparing
+option names. The prefix "no" may be added or removed from boolean
+option names. All names listed here are in their preferred user-visible
+form. Some registered option names are:
+
+Types are: B = boolean, O = set/unset (no value), I = integer, S = string,
+ A = optional string, F = floating point number Q = frequency
+
+Scopes are: F = global flags, V = video driver, C = common (per screen),
+ I = input drivers, X = XAA, Xv = Xv extension, M = misc.
+
+Names currently in use:
+
+Name Type Scope Description
+----------------------------------------------------------------------------
+AllowMouseOpenFail B F ignore mouse dev open failure
+AllowNonLocalModInDev B F allow non-local mod of input devs
+AllowNonLocalXvidtune B F allow non-local VidMode connections
+BlankTime I F Screen saver timeout (min)
+DisableModInDev B F disallow changing input devs
+DisableVidModeExtension B F disable VidMode extension
+DontZap B F disable Ctrl-Alt-BS sequence
+DontZoom B F disable Ctrl-Alt-+/-
+NoTrapSignals B F don't trap signals
+OffTime I F Time before DPMS off mode active (min)
+PciProbe1 O F use PCI probe algorithm 1
+PciProbe2 O F use PCI probe algorithm 2
+PciForceConfig1 O F force PCI config type 1
+PciForceConfig2 O F force PCI config type 2
+Pixmap I F depth 24 pixmap size (24 or 32)
+StandbyTime I F Time before DPMS standby active (min)
+SuspendTime I F Time before DPMS suspend mode active (min)
+
+BackingStore B C Enable backing store
+DDC B C Enable/disable DDC
+DDC1 B C Enable/disable DDC1
+DDC2 B C Enable/disable DDC2
+DPMS O C Enable DPMS
+MTRR B C Enable/disable setting MTRRs
+
+BaudRate I I Serial port baud rate
+ButtonNumber I I Button number (for touch screen?)
+ButtonThreshold I I ??
+ClearDTR O I Clear serial port DTR
+ClearRTS O I Clear serial port RTS
+DataBits I I Serial port data bits
+DemandLoad O I ??
+Device S I Device file name
+DeviceName S I Input device name
+FlowControl S I Serial flow control ("xon", "none")
+HistorySize I I ??
+MaxX I I Maximum X coordinate
+MaxY I I Maximum Y coordinate
+MinX I I Minimum X coordinate
+MinY I I Minimum Y coordinate
+Parity S I Serial port parity ("odd", "even", "none")
+ReportDelay I I ??
+ReportingMode S I may be "raw" or "scaled"
+ScreenNumber I I Screen number (for touch screen)
+SendCoreEvents B I Send core events
+SendDragEvents B I Send drag events
+StopBits I I Serial port stop bits
+SwapXY B I Swap the X and Y axes
+UntouchDelay I I ??
+Vmin I I Tty VMIN
+Vtime I I Tty VTIME
+
+
+18BitBus B V ??
+8Plus16 B V Enable depth 8 + depth 16 with overlay
+8Plus24 B V Enable depth 8 + depth 24 with overlay
+BlockWrite B V Enable/disable block write
+ColorKey I V Set the color key for overlay modes
+CompositeSync B V Composite sync
+EarlyRasPrecharge O V Early RAS pre-charge
+FastDRAM O V Fast DRAM
+FifoAggressive O V Aggressive FIFO setting
+FifoConservative O V Conservative FIFO setting
+FifoModerate O V Moderate FIFO setting
+FireGL3000 B V Card is Diamond FireGL3000
+FixPanelSize B V ??
+FPClock8 Q V Flat panel clock for 8bpp fb (MHz)
+FPClock16 Q V Flat panel clock for 16bpp fb (MHz)
+FPClock24 Q V Flat panel clock for 24bpp fb (MHz)
+FPClock32 Q V Flat panel clock for 32bpp fb (MHz)
+FPMVRAM O V Fast page mode VRAM
+FramebufferWC B V Enable/disable WC for the framebuffer
+GlideDevice I V Selects which Voodoo board to use
+HiBitHigh O V High clock bit default to set
+HiBitLow O V High clock bit default to cleared
+HWClocks B V Enable/disable HW clocks
+HWCursor B V Enable/disable HW cursor
+LateRasPrecharge O V Late RAS pre-charge
+Legend O V Card is Legend ET4000
+LCDCenter B V Enable/disable centering for LCD displays
+Linear B V Enable/disable linear framebuffer
+MCLK Q V Specify the current MCLK value (MHz)
+MedDRAM B V Medium speed DRAM
+MemCfg1 I V ??
+MemCfg2 I V ??
+MGASDRAM B V Mga card has SDRAM
+MMIO B V Enable/disable memory mapped I/O
+MuxThreshold I V Multiplexing threshold (kHz)
+NoAccel B V Disable/enable acceleration
+NoClockChip B V ??
+NoStretch B V Disable/enable stretching for LCD displays
+OnAtExit B V Leave video signal on when exiting server
+OverclockMem B V Enable memory overclocking
+Overlay A V Enable multi-depth/overlay. An optional
+ string "M,N" may be specified, where
+ M, N are the depths.
+PciBurst B V Enable/disable PCI burst mode
+PciRetry B V Enable/disable PCI retries
+ProbeClocks B V Force probe for non-programmable clocks
+RGBbits I V Number of significant bits per rgb
+Rotate S V Rotate the virtual display (CW or CCW)
+SetLCDClk Q V Set LCD clock (MHz)
+SetMclk Q V Set Memory Clock (MHz)
+ShadowFB B V Enable shadow framebuffer layer
+ShowCache B V Enable viewing of offscreen memory
+ShowOverscan O V Set the overscan area to a visible colour
+SlowDRAM O V Slow DRAM
+SlowEDODRAM O V Slow EDO DRAM
+STN B V STN screen type (??)
+SWCursor B V Enable/disable SW cursor
+SuspendHack B V ??
+SyncOnGreen B V Enable/disable sync on green
+TurboQueue B V Enable/disable turbo queue
+UseFBDev B V Use the fbdev driver interface
+UseModeLine B V Use Modeline (??)
+W32Interleave B V ??
+
+Buffers I Xv Number of buffers
+Device S Xv Device file name
+Expose B Xv Disable occlusion clipping (see DESIGN)
+FramesPerSec I Xv Max. refresh frequency
+
+XAA options. All are of type "O" and scope "X", and are self-explanatory
+
+XaaNoColor8x8PatternFillRect
+XaaNoColor8x8PatternFillTrap
+XaaNoCPUToScreenColorExpandFill
+XaaNoDashedBresenhamLine
+XaaNoDashedTwoPointLine
+XaaNoScreenToScreenCopy
+XaaNoImageReadRect
+XaaNoImageWriteRect
+XaaNoMono8x8PatternFillRect
+XaaNoMono8x8PatternFillTrap
+XaaNoOffscreenPixmaps
+XaaNoPixmapCache
+XaaNoScanlineCPUToScreenColorExpandFill
+XaaNoScanlineImageWriteRect
+XaaNoScreenToScreenColorExpandFill
+XaaNoSolidBresenhamLine
+XaaNoSolidFillRect
+XaaNoSolidFillTrap
+XaaNoSolidHorVertLine
+XaaNoSolidTwoPointLine
+
+
+Names used in previous versions:
+
+16Clocks
+8Clocks
+ClkDiv2
+EDO VRAM
+ExternDisp
+ExtFramBuf
+FastVRAM
+FavorBitBlt
+InternDisp
+NoBitBlt
+NoFontCache
+NoImageBlt
+NoMemAccess
+NoPciDisconnect
+NoPixmapCache
+NoProgramClocks
+NoSplitXfer
+OverrideBIOS
+OverrideValidateMode
+ProgLcdModeRegs
+ProgLcdModeStretch
+SlowDRAMrefresh
+SlowVRAM
+SwapHiBit
+
+
+5. Ramdac Names.
+
+Ramdac names should be consistent between drivers. Case, white space
+and underscore characters are ignored when comparing ramdac names. All
+names listed here are in lower case with all white space and underscores
+removed.
+
+
+6. Clock Chip Names.
+
+Clock chip names should be consistent between drivers. Case, white
+space and underscore characters are ignored when comparing clock chip
+names. All names listed here are in lower case with all white space
+and underscores removed.
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.15 1999/08/22 05:57:28 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/00README b/xc/programs/Xserver/hw/xfree86/SuperProbe/00README
new file mode 100644
index 000000000..c5935af8d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/00README
@@ -0,0 +1,85 @@
+ README file for SuperProbe
+ --------------------------
+ Version 2.1
+
+ David E Wexelblat
+ dwex@xfree86.org
+
+What is it?
+-----------
+SuperProbe is a program for Intel-based Unix machines. It is used to
+determine the type of video hardware installed in the machine, including,
+where it can be determined, which specific chipset, what type of
+RAMDAC is attached, and how much video memory resides on the board.
+The current version supports EISA/ISA/VLB machines running SVR3,
+SVR4, Linux, *BSD*, Minix-386, and Mach (MicroChannel and PCI machines
+are believed to work as well, although the BIOS checking may need to
+be disabled via the '-no_bios' option). Adding support for other
+operating systems should be fairly trivial, as the OS dependencies are
+isolated to a single file for each OS.
+
+Building
+--------
+Both an Imakefile and a standard Makefile are provided. If you are using
+imake, you should be able to simply do:
+
+ xmkmf -a
+ make
+ make install
+ make install.man
+
+If you are using the standard Makefile, edit the Makefile.std file to set
+up the OS dependencies; then do:
+
+ make -f Makefile.std
+ make install
+
+The program will need to be installed setuid-root on all of the currently
+supported OSs.
+
+Running
+-------
+See the SuperProbe.1 manual page.
+
+Reporting Problems
+------------------
+Please report any problems to the author, David E Wexeblat, <dwex@xfree86.org>
+
+Credits
+-------
+Finn Thoegersen
+ For providing the vgadoc2.zip and vgadoc3.zip video hardware
+ documentation packages and sample code, and for allowing me
+ to port his code to the Unix environment.
+
+David Dawes <dawes@physics.su.oz.au>
+ For lots of help on the initial design, and writing the 386BSD OS
+ support module.
+
+Orest Zborowski <obz@kodak.com>
+ For writing the Linux OS support module.
+
+Philip Homburg <philip@cs.vu.nl>
+ For writing the Minix-386 OS support module.
+
+Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
+ For writing the Mach OS support module.
+
+Tiago Gons <tiago@comosjn.hobby.nl>
+Kevin Martin <martin@cs.unc.edu>
+ 8514/A, ATI Mach8 and ATI Mach32 probe code.
+
+Marc Aurele La France <tsi@ualberta.ca>
+ ATI Mach64 probe code.
+
+The XFree86 Beta Test Team
+ For helping test and debug this software.
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/00README,v 3.5 1996/12/23 06:30:54 dawes Exp $
+
+
+
+
+
+$XConsortium: 00README /main/7 1996/02/21 17:08:47 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights b/xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights
new file mode 100644
index 000000000..129281b33
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights
@@ -0,0 +1,55 @@
+ SuperProbe is covered by the following copyright statement (certain
+ individual files are copyright by other authors as indicated in the
+ source files):
+
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ * (c) Copyright 1994-1998 by The XFree86 Project, Inc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holders shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * the copyright holders.
+ *
+ */
+
+ The vgadoc3.zip package from which much of the information in
+ SuperProbe was derived contains the following copyright statement:
+
+This compilation (c) Copyright 1991-94 Finn Thoegersen. All Rights Reserved.
+You can redistribute the collection provided it is distributed unmodified
+in its entirety and these clauses are left intact. The programs - executables
+and source - can be left out if they are not meaningful for the intended
+audience. No fee, monies et ceterra can be charged, except for normal
+connection, media, shipment and handling expenses.
+You are free to use the information herein and excerpts from the programs,
+provided that the source is credited (My name and the VGADOC3 package).
+
+ The author of SuperProbe gratefully acknowledges the work and
+ cooperation of the author of vgadoc3.zip.
+
+$XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/01.CopyRights,v 3.5 1999/03/14 03:21:39 dawes Exp $
+
+
+
+
+
+$XConsortium: 01.CopyRights /main/4 1996/02/21 17:08:52 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c
new file mode 100644
index 000000000..677fc680a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c
@@ -0,0 +1,116 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/8514.c,v 3.4 1996/12/23 06:30:55 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: 8514.c /main/5 1996/02/21 17:08:59 kaleb $ */
+
+#include "Probe.h"
+
+/*
+ * Check for basic 8514 functionality. 8514 extended functionality will
+ * be checked for elsewhere.
+ */
+
+static Word Ports[] = {SUBSYS_CNTL,ERR_TERM};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_8514 __STDCARGS((int));
+
+Chip_Descriptor IBM8514_Descriptor = {
+ "8514/A",
+ Probe_8514,
+ Ports,
+ NUMPORTS,
+ TRUE,
+ FALSE,
+ FALSE,
+ MemProbe_8514,
+};
+
+Bool Probe_8514(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Reset the 8514/A, and disable all interrupts.
+ */
+ outpw(SUBSYS_CNTL, GPCTRL_RESET|CHPTEST_NORMAL);
+ outpw(SUBSYS_CNTL, GPCTRL_ENAB|CHPTEST_NORMAL);
+
+ /*
+ * Check to see if an 8514/A is actually installed by writing
+ * to the ERR_TERM register and reading back. The 0x5A5A value
+ * is entirely arbitrary.
+ */
+ outpw(ERR_TERM, 0x5A5A);
+ if (inpw(ERR_TERM) == 0x5A5A)
+ {
+ /*
+ * Let's make certain.
+ */
+ outpw(ERR_TERM, 0x5555);
+ if (inpw(ERR_TERM) == 0x5555)
+ {
+ if (tstrg(EXT_CONF_3, 0xF0))
+ {
+ *Chipset = CHIP_CT480;
+ }
+ else
+ {
+ *Chipset = CHIP_8514;
+ }
+ result = TRUE;
+ }
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_8514(Chipset)
+int Chipset;
+{
+ int Mem;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (inpw(SUBSYS_CNTL) & 0x0080)
+ {
+ Mem = 1024;
+ }
+ else
+ {
+ Mem = 512;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c
new file mode 100644
index 000000000..963f4285e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c
@@ -0,0 +1,131 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AL.c,v 3.4 1996/12/23 06:30:56 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: AL.c /main/5 1996/02/21 17:09:04 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_AL __STDCARGS((int));
+
+Chip_Descriptor AL_Descriptor = {
+ "AL",
+ Probe_AL,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_AL,
+};
+
+Bool Probe_AL(Chipset)
+int *Chipset;
+{
+ Byte old;
+ Bool result = FALSE;
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(CRTC_IDX, 0x1A);
+ clrinx(CRTC_IDX, 0x1A, 0x10);
+ if (!testinx2(CRTC_IDX, 0x19, 0xCF))
+ {
+ setinx(CRTC_IDX, 0x1A, 0x10);
+ if ((testinx2(CRTC_IDX, 0x19, 0xCF) &&
+ (testinx2(CRTC_IDX, 0x1A, 0x3F))))
+ {
+ result = TRUE;
+ switch (rdinx(CRTC_IDX, 0x1A) >> 6)
+ {
+ case 0x03:
+ *Chipset = CHIP_AL2101;
+ break;
+ case 0x02:
+ *Chipset = CHIP_AL2228;
+ break;
+ default:
+ Chip_data = rdinx(CRTC_IDX, 0x1A);
+ *Chipset = CHIP_AL_UNKNOWN;
+ break;
+ }
+ }
+ }
+ wrinx(CRTC_IDX, 0x1A, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_AL(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(CRTC_IDX, 0x1A);
+ setinx(CRTC_IDX, 0x1A, 0x10);
+
+ /*
+ * Check
+ */
+ switch (rdinx(CRTC_IDX, 0x1E) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ case 0x03:
+ Mem = 2048;
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(CRTC_IDX, 0x1A, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c
new file mode 100644
index 000000000..0cfc1af46
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c
@@ -0,0 +1,167 @@
+/* $XConsortium: ARK.c /main/3 1996/10/25 21:18:52 kaleb $ */
+/*
+ * (c) Copyright 1996 Harm Hanemaayer <H.Hanemaayer@inter.nl.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Harm Hanemaayer shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Harm Hanemaayer.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ARK.c,v 3.2 1996/12/27 06:53:24 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {SEQ_IDX, SEQ_REG, 0x3B4, 0x3B5, 0x3D4, 0x3D5};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_ARK __STDCARGS((int));
+
+Chip_Descriptor ARK_Descriptor = {
+ "ARK Logic",
+ Probe_ARK,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_ARK,
+};
+
+Bool Probe_ARK(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte CR50, savedSR1D;
+ int id, rev;
+ int i;
+
+ if (!NoPCI)
+ {
+ i = 0;
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_ARK)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_1000PV:
+ *Chipset = CHIP_ARK1000PV;
+ break;
+ case PCI_CHIP_2000PV:
+ *Chipset = CHIP_ARK2000PV;
+ break;
+ case PCI_CHIP_2000MT:
+ *Chipset = CHIP_ARK2000MT;
+ break;
+ case PCI_CHIP_2000MI:
+ *Chipset = CHIP_ARK2000MI;
+ break;
+ default:
+ Chip_data = pcrp->_device;
+ *Chipset = CHIP_ARK_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ /* Unlock by setting bit 0 of SR1D. */
+ savedSR1D = rdinx(SEQ_IDX, 0x1D);
+ modinx(SEQ_IDX, 0x1D, 0x01, 0x01);
+
+ /*
+ * Check for read/writability of all the "Software Scratch"
+ * registers.
+ */
+ if (!testinx(SEQ_IDX, 0x1E)
+ || !testinx(SEQ_IDX, 0x1F)
+ || !testinx(SEQ_IDX, 0x1A)
+ || !testinx(SEQ_IDX, 0x1B)) {
+ wrinx(SEQ_IDX, 0x1D, savedSR1D);
+ return FALSE;
+ }
+
+ CR50 = rdinx(CRTC_IDX, 0x50);
+ id = CR50 >> 3;
+ rev = CR50 & 7;
+
+ switch (id) {
+ /* The ARK1000VL is missing. I don't know the ID. */
+ case 0x12 :
+ *Chipset = CHIP_ARK1000PV;
+ return TRUE;
+ case 0x13 :
+ *Chipset = CHIP_ARK2000PV;
+ return TRUE;
+ case 0x14 :
+ *Chipset = CHIP_ARK2000MT;
+ return TRUE;
+ case 0x15 :
+ *Chipset = CHIP_ARK2000MI;
+ return TRUE;
+ default :
+ /*
+ * The general ARK check is too weak, so don't assume
+ * it's an ARK chip.
+ */
+ break;
+ }
+ wrinx(SEQ_IDX, 0x1D, savedSR1D);
+
+ return(FALSE);
+}
+
+static int MemProbe_ARK(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+ Byte SR10, savedSR1D;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /* Unlock by setting bit 0 of SR1D. */
+ savedSR1D = rdinx(SEQ_IDX, 0x1D);
+ modinx(SEQ_IDX, 0x1D, 0x01, 0x01);
+
+ SR10 = rdinx(SEQ_IDX, 0x10);
+ if (Chipset == CHIP_ARK1000PV)
+ if ((SR10 & 0x40) == 0)
+ Mem = 1024;
+ else
+ Mem = 2048;
+ if (Chipset == CHIP_ARK2000PV || Chipset == CHIP_ARK2000MT
+ || Chipset == CHIP_ARK2000MI)
+ if ((SR10 & 0xC0) == 0)
+ Mem = 1024;
+ else
+ if ((SR10 & 0xC0) == 0x40)
+ Mem = 2048;
+ else
+ Mem = 4096;
+
+ wrinx(SEQ_IDX, 0x1D, savedSR1D);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c
new file mode 100644
index 000000000..6026d3c75
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c
@@ -0,0 +1,402 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ATI.c,v 3.18 1999/06/06 08:48:42 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: ATI.c /main/10 1996/10/25 07:00:11 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x01CE, 0x01CF};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_ATI __STDCARGS((int));
+
+Chip_Descriptor ATI_Descriptor = {
+ "ATI",
+ Probe_ATI,
+ Ports,
+ NUMPORTS,
+ TRUE,
+ TRUE,
+ TRUE,
+ MemProbe_ATI,
+};
+
+Bool Crippled_Mach32 = FALSE,
+ Crippled_Mach64 = FALSE,
+ Mach64xTB = FALSE;
+
+extern Chip_Descriptor ATIMach_Descriptor;
+
+#ifdef __STDC__
+void Probe_ATI_ChipID(int chip, int *Chipset)
+#else
+void Probe_ATI_ChipID(chip, Chipset)
+int chip, *Chipset;
+#endif
+{
+ if (chip == CHIP_MACH64)
+ {
+ extern Word ATIMach64CONFIG_CHIP_ID;
+
+ EnableIOPorts(1, &ATIMach64CONFIG_CHIP_ID);
+ chip = inpl(ATIMach64CONFIG_CHIP_ID);
+ switch (chip & 0xFFFF)
+ {
+ case 0x00D7:
+ case 0x4758:
+ switch ((chip & 0xFF000000) >> 24)
+ {
+ case 0x00:
+ *Chipset = CHIP_ATI88800GXC;
+ break;
+ case 0x01:
+ *Chipset = CHIP_ATI88800GXD;
+ break;
+ case 0x02:
+ *Chipset = CHIP_ATI88800GXE;
+ break;
+ case 0x03:
+ *Chipset = CHIP_ATI88800GXF;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_ATI_UNK;
+ break;
+ }
+ break;
+ case 0x0057:
+ case 0x4358:
+ *Chipset = CHIP_ATI88800CX;
+ break;
+ case 0x0053:
+ case 0x4354:
+ *Chipset = CHIP_ATI264CT;
+ break;
+ case 0x0093:
+ case 0x4554:
+ *Chipset = CHIP_ATI264ET;
+ break;
+ case 0x02B3:
+ case 0x5654:
+ if (chip & 0x07000000)
+ {
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264VTB;
+ }
+ else
+ *Chipset = CHIP_ATI264VT;
+ break;
+ case 0x02B4:
+ case 0x5655:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264VT3;
+ break;
+ case 0x02B5:
+ case 0x5656:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264VT4;
+ break;
+ case 0x00D3:
+ case 0x4754:
+ if (chip & 0x07000000)
+ {
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264GTB;
+ }
+ else
+ *Chipset = CHIP_ATI264GT;
+ break;
+ case 0x00D4:
+ case 0x4755:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264GTDVD;
+ break;
+ case 0x00D5:
+ case 0x00D6:
+ case 0x00D9:
+ case 0x4756:
+ case 0x4757:
+ case 0x475A:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264GTIIc;
+ break;
+ case 0x00C1:
+ case 0x00C3:
+ case 0x00C8:
+ case 0x00CF:
+ case 0x00D0:
+ case 0x4742:
+ case 0x4744:
+ case 0x4749:
+ case 0x4750:
+ case 0x4751:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264GT3;
+ break;
+ case 0x0166:
+ case 0x4C47:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264LT;
+ break;
+ case 0x0161:
+ case 0x0163:
+ case 0x0168:
+ case 0x016F:
+ case 0x4C42:
+ case 0x4C44:
+ case 0x4C49:
+ case 0x4C50:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264LTPRO;
+ break;
+ case 0x00CC:
+ case 0x00CD:
+ case 0x00CE:
+ case 0x00D1:
+ case 0x00D2:
+ case 0x474D:
+ case 0x474E:
+ case 0x474F:
+ case 0x4752:
+ case 0x4753:
+ Mach64xTB = TRUE;
+ *Chipset = CHIP_ATI264XL;
+ break;
+ default:
+ Chip_data = chip;
+ Mach64xTB = TRUE; /* Most likely */
+ *Chipset = CHIP_ATI_UNK;
+ break;
+ }
+ DisableIOPorts(1, &ATIMach64CONFIG_CHIP_ID);
+ }
+ else /* if (chip == CHIP_MACH32) */
+ {
+ Word IOPort = CHIP_ID;
+
+ EnableIOPorts(1, &IOPort);
+
+ chip = inpw(CHIP_ID);
+ if (chip == 0xFFFF)
+ chip = 0;
+ switch (chip & 0x03FF)
+ {
+ case 0x0000:
+ *Chipset = CHIP_ATI68800_3;
+ break;
+ case 0x02F7:
+ *Chipset = CHIP_ATI68800_6;
+ break;
+ case 0x0177:
+ *Chipset = CHIP_ATI68800LX;
+ break;
+ case 0x0017:
+ *Chipset = CHIP_ATI68800AX;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_ATI_UNK;
+ break;
+ }
+ DisableIOPorts(1, &IOPort);
+ }
+}
+
+#ifdef __STDC__
+Bool Probe_ATI(int *Chipset)
+#else
+Bool Probe_ATI(Chipset)
+int *Chipset;
+#endif
+{
+ Bool result = FALSE;
+ Byte bios[10];
+ Byte *signature = (Byte *)"761295520";
+ int chip;
+
+ /*
+ * First, look for a Mach32 or a Mach64.
+ */
+ if (ATIMach_Descriptor.f(&chip) &&
+ ((chip == CHIP_MACH32) || (chip == CHIP_MACH64)))
+ {
+ Probe_ATI_ChipID(chip, Chipset);
+ return (TRUE);
+ }
+
+ if (ReadBIOS(0x31, bios, 9) != 9)
+ {
+ fprintf(stderr, "%s: Failed to read ATI signature\n", MyName);
+ return(FALSE);
+ }
+ if (memcmp(bios, signature, 9) == 0)
+ {
+ if (ReadBIOS(0x40, bios, 4) != 4)
+ {
+ fprintf(stderr, "%s: Failed to read ATI BIOS data\n",
+ MyName);
+ return(FALSE);
+ }
+
+ result = TRUE;
+
+ if ((bios[0] == '3') && (bios[1] == '1'))
+ {
+ /* Set up Ports array */
+ if (ReadBIOS(0x10, bios, sizeof(Word)) != sizeof(Word))
+ {
+ fprintf(stderr,
+ "%s: Failed to read ATI BIOS data\n",
+ MyName);
+ return (FALSE);
+ }
+
+ switch (bios[3])
+ {
+ case '1':
+ *Chipset = CHIP_ATI18800;
+ break;
+ case '2':
+ *Chipset = CHIP_ATI18800_1;
+ break;
+ case '3':
+ *Chipset = CHIP_ATI28800_2;
+ break;
+ case '4':
+ *Chipset = CHIP_ATI28800_4;
+ break;
+ case '5':
+ *Chipset = CHIP_ATI28800_5;
+ break;
+ case '6':
+ *Chipset = CHIP_ATI28800_6;
+ break;
+ case 'a':
+ case 'b':
+ case 'c':
+ Crippled_Mach32 = TRUE;
+ Probe_ATI_ChipID(CHIP_MACH32, Chipset);
+ break;
+ case ' ':
+ Crippled_Mach64 = TRUE;
+ Probe_ATI_ChipID(CHIP_MACH64, Chipset);
+ break;
+ default:
+ Chip_data = (((((bios[0] << 8) |
+ bios[1]) << 8) |
+ bios[2]) << 8) | bios[3];
+ *Chipset = CHIP_ATI_UNK;
+ break;
+ }
+
+ if (!Crippled_Mach64)
+ {
+ Ports[0] = *((Word *)bios);
+ Ports[1] = Ports[0] + 1;
+ }
+
+ /*
+ * Sometimes, the BIOS lies about the chip.
+ */
+ if ((*Chipset >= CHIP_ATI28800_4) &&
+ (*Chipset <= CHIP_ATI28800_6))
+ {
+ EnableIOPorts(NUMPORTS, Ports);
+ chip = rdinx(Ports[0], 0xAA) & 0x0F;
+ if (chip < 7)
+ {
+ chip = SVGA_TYPE(V_ATI, chip);
+ if (chip > *Chipset)
+ *Chipset = chip;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ }
+ }
+ else
+ {
+ Chip_data = (((((bios[0] << 8) | bios[1]) << 8) |
+ bios[2]) << 8) | bios[3];
+ *Chipset = CHIP_ATI_UNK;
+ }
+ }
+ return(result);
+}
+
+static int MemProbe_ATI(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ if ((Chipset >= CHIP_ATI88800GXC) && !Crippled_Mach64)
+ return (ATIMach_Descriptor.memcheck(CHIP_MACH64));
+ if ((Chipset >= CHIP_ATI68800_3) && !Crippled_Mach32)
+ return (ATIMach_Descriptor.memcheck(CHIP_MACH32));
+
+ /* Ports array should already be set up */
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (Crippled_Mach32)
+ Chipset = CHIP_MACH32;
+ else if (Crippled_Mach64)
+ Chipset = CHIP_MACH64;
+
+ switch (Chipset)
+ {
+ case CHIP_ATI18800:
+ case CHIP_ATI18800_1:
+ if (rdinx(Ports[0], 0xBB) & 0x20)
+ Mem = 512;
+ else
+ Mem = 256;
+ break;
+ case CHIP_ATI28800_2:
+ case CHIP_ATI28800_4:
+ case CHIP_ATI28800_5:
+ case CHIP_ATI28800_6:
+ case CHIP_MACH32:
+ case CHIP_MACH64:
+ switch (rdinx(Ports[0], 0xB0) & 0x18)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x10:
+ Mem = 512;
+ break;
+ case 0x08:
+ case 0x18:
+ Mem = 1024;
+ break;
+ }
+ break;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c
new file mode 100644
index 000000000..bd90b70eb
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c
@@ -0,0 +1,325 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ATIMach.c,v 3.11 1997/05/22 14:22:21 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: ATIMach.c /main/10 1996/10/25 07:00:15 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {ROM_ADDR_1, DESTX_DIASTP, READ_SRC_X,
+ CONFIG_STATUS_1, MISC_OPTIONS, GP_STAT};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_ATIMach __STDCARGS((int));
+extern void Probe_ATI_ChipID __STDCARGS((int, int *));
+
+Chip_Descriptor ATIMach_Descriptor = {
+ "ATI_Mach",
+ Probe_ATIMach,
+ Ports,
+ NUMPORTS,
+ TRUE,
+ FALSE,
+ FALSE,
+ MemProbe_ATIMach,
+};
+
+#define WaitIdleEmpty() { int i; \
+ for (i=0; i < 100000; i++) \
+ if (!(inpw(GP_STAT) & (GPBUSY | 1))) \
+ break; \
+ }
+
+/* ATI Mach64 I/O port addresses */
+Word ATIMach64MEM_INFO,
+ ATIMach64SCRATCH_REG1,
+ ATIMach64DAC_CNTL,
+ ATIMach64CONFIG_CHIP_ID;
+
+#ifdef __STDC__
+static void Probe_ATIMach64(int *Chipset,
+ unsigned short int IOBase,
+ Bool SparseIO)
+#else
+static void Probe_ATIMach64(Chipset, IOBase, SparseIO)
+int *Chipset;
+unsigned short int IOBase;
+Bool SparseIO;
+#endif
+{
+ Long tmp;
+ Word IOPort;
+ int chip;
+
+ if ((*Chipset != -1) || (IOBase == 0))
+ return;
+
+ /* Determine if a Mach64 answers the call */
+ IOPort = (SparseIO ? 0x4000 : 0x0080) + IOBase;
+ EnableIOPorts(1, &IOPort);
+ tmp = inpl(IOPort);
+ outpl(IOPort, 0x55555555); /* Test odd bits */
+ if (inpl(IOPort) == 0x55555555)
+ {
+ outpl(IOPort, 0xAAAAAAAA); /* Test even bits */
+ if (inpl(IOPort) == 0xAAAAAAAA)
+ {
+ /*
+ * Fix I/O ports. I know, I know: hard-wired
+ * constants are *EVIL*, but this'll do for now.
+ */
+ if (SparseIO)
+ {
+ ATIMach64SCRATCH_REG1 = 0x4400;
+ ATIMach64MEM_INFO = 0x5000;
+ ATIMach64DAC_CNTL = 0x6000;
+ ATIMach64CONFIG_CHIP_ID = 0x6C00;
+ }
+ else
+ {
+ ATIMach64SCRATCH_REG1 = 0x0084;
+ ATIMach64MEM_INFO = 0x00B0;
+ ATIMach64DAC_CNTL = 0x00C4;
+ ATIMach64CONFIG_CHIP_ID = 0x00E0;
+ }
+ ATIMach64SCRATCH_REG1 += IOBase;
+ ATIMach64MEM_INFO += IOBase;
+ ATIMach64DAC_CNTL += IOBase;
+ ATIMach64CONFIG_CHIP_ID += IOBase;
+
+ /*
+ * Something's responding to our hail. Make sure it's
+ * a Mach64. This assumes ATI won't be producing any
+ * more adapters that don't register themselves in PCI
+ * configuration space.
+ */
+ Probe_ATI_ChipID(CHIP_MACH64, &chip);
+ if ((chip == CHIP_ATI_UNK) && SparseIO)
+ Chip_data = (Long)~0;
+ else
+ *Chipset = CHIP_MACH64;
+ }
+ }
+ outpl(IOPort, tmp);
+ DisableIOPorts(1, &IOPort);
+}
+
+#ifdef __STDC__
+Bool Probe_ATIMach(int *Chipset)
+#else
+Bool Probe_ATIMach(Chipset)
+int *Chipset;
+#endif
+{
+ Long tmp;
+ static int chip = -1;
+ static Bool Already_Called = FALSE;
+ struct pci_config_reg *PCIDevice;
+ int Index;
+
+ if (Already_Called)
+ {
+ if (chip != -1)
+ *Chipset = chip;
+ return (chip != -1);
+ }
+ Already_Called = TRUE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Check for 8514/A registers. Don't read BIOS, or an attached 8514
+ * Ultra won't be detected (the slave SVGA's BIOS is in the normal SVGA
+ * place).
+ */
+ tmp = inpw(ROM_ADDR_1);
+ outpw(ROM_ADDR_1, 0x5555);
+ WaitIdleEmpty();
+ if (inpw(ROM_ADDR_1) == 0x5555)
+ {
+ outpw(ROM_ADDR_1, 0x2A2A);
+ WaitIdleEmpty();
+ if (inpw(ROM_ADDR_1) == 0x2A2A)
+ chip = CHIP_8514;
+ }
+ outpw(ROM_ADDR_1, tmp);
+ if (chip != -1)
+ {
+ /*
+ * An 8514 accelerator is really present; now figure
+ * out which one.
+ */
+ outpw(DESTX_DIASTP, 0xAAAA);
+ WaitIdleEmpty();
+ if (inpw(READ_SRC_X) != 0x02AA)
+ chip = CHIP_MACH8;
+ else
+ chip = CHIP_MACH32;
+ outpw(DESTX_DIASTP, 0x5555);
+ WaitIdleEmpty();
+ if (inpw(READ_SRC_X) != 0x0555)
+ {
+ if (chip != CHIP_MACH8)
+ /*
+ * Something bizarre is happening.
+ */
+ chip = -1;
+ }
+ else
+ {
+ if (chip != CHIP_MACH32)
+ /*
+ * Something bizarre is happening.
+ */
+ chip = -1;
+ }
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+
+ if (chip == -1)
+ {
+ /*
+ * Check for a Mach64. Start with sparse I/O base addresses,
+ * then move on to PCI information.
+ */
+ Probe_ATIMach64(&chip, 0x02EC, TRUE);
+ Probe_ATIMach64(&chip, 0x01CC, TRUE);
+ Probe_ATIMach64(&chip, 0x01C8, TRUE);
+
+ Index = 0;
+ while ((chip == -1) && (PCIDevice = pci_devp[Index++]))
+ {
+ if (PCIDevice->_vendor != PCI_VENDOR_ATI)
+ continue;
+ if (PCIDevice->_device == PCI_CHIP_MACH32)
+ continue;
+ Probe_ATIMach64(&chip, PCIDevice->_base1 & 0xFF00,
+ FALSE);
+ }
+ }
+
+ if (chip != -1)
+ {
+ *Chipset = chip;
+ }
+
+ return(chip != -1);
+}
+
+#ifdef __STDC__
+static int MemProbe_ATIMach(int Chipset)
+#else
+static int MemProbe_ATIMach(Chipset)
+int Chipset;
+#endif
+{
+ static int Mem = 0;
+ static Bool Already_Called = FALSE;
+
+ if (Already_Called)
+ return (Mem);
+ Already_Called = TRUE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ if (Chipset == CHIP_MACH8)
+ {
+ if (inpw(CONFIG_STATUS_1) & 0x0020)
+ {
+ Mem = 1024;
+ }
+ else
+ {
+ Mem = 512;
+ }
+ }
+ else if (Chipset == CHIP_MACH32)
+ {
+ switch ((inpw(MISC_OPTIONS) & 0x000C) >> 2)
+ {
+ case 0x00:
+ Mem = 512;
+ break;
+ case 0x01:
+ Mem = 1024;
+ break;
+ case 0x02:
+ Mem = 2048;
+ break;
+ case 0x03:
+ Mem = 4096;
+ break;
+ }
+ }
+ else if (Chipset == CHIP_MACH64)
+ {
+ extern Bool Mach64xTB;
+ int tmp;
+
+ EnableIOPorts(1, &ATIMach64MEM_INFO);
+ tmp = inpl(ATIMach64MEM_INFO);
+ if (!Mach64xTB) {
+ switch (tmp & 0x00000007)
+ {
+ case 0x00:
+ Mem = 512;
+ break;
+ case 0x01:
+ Mem = 1024;
+ break;
+ case 0x02:
+ Mem = 2048;
+ break;
+ case 0x03:
+ Mem = 4096;
+ break;
+ case 0x04:
+ Mem = 6144;
+ break;
+ case 0x05:
+ Mem = 8192;
+ break;
+ case 0x06:
+ Mem = 12288;
+ break;
+ case 0x07:
+ Mem = 16384;
+ break;
+ }
+ } else {
+ if ((tmp &= 0x0000000F) < 8)
+ Mem = (tmp + 1) * 512;
+ else if (tmp < 12)
+ Mem = (tmp - 3) * 1024;
+ else
+ Mem = (tmp - 7) * 2048;
+ }
+ DisableIOPorts(1, &ATIMach64MEM_INFO);
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c
new file mode 100644
index 000000000..88ffe2969
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c
@@ -0,0 +1,123 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Ahead.c,v 3.4 1996/12/23 06:31:01 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Ahead.c /main/5 1996/02/21 17:09:18 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {GRC_IDX, GRC_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Ahead __STDCARGS((int));
+
+Chip_Descriptor Ahead_Descriptor = {
+ "Ahead",
+ Probe_Ahead,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Ahead,
+};
+
+Bool Probe_Ahead(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, tmp;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ old = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F, 0);
+ if (!testinx2(GRC_IDX, 0x0C, 0xFB))
+ {
+ wrinx(GRC_IDX, 0x0F, 0x20);
+ if (testinx2(GRC_IDX, 0x0C, 0xFB))
+ {
+ result = TRUE;
+ tmp = rdinx(GRC_IDX, 0x0F) & 0x0F;
+ switch (tmp)
+ {
+ case 0x00:
+ *Chipset = CHIP_AHEAD_A;
+ break;
+ case 0x01:
+ *Chipset = CHIP_AHEAD_B;
+ break;
+ default:
+ Chip_data = tmp;
+ *Chipset = CHIP_AHEAD_UNK;
+ break;
+ }
+ }
+ }
+ wrinx(GRC_IDX, 0x0F, old);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_Ahead(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(GRC_IDX, 0x0F);
+ setinx(GRC_IDX, 0x0F, 0x20);
+
+ /*
+ * Check
+ */
+ switch (rdinx(GRC_IDX, 0x1F) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(GRC_IDX, 0x0F, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c
new file mode 100644
index 000000000..b5c988dda
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c
@@ -0,0 +1,108 @@
+/*
+ * (c) Copyright 1996 Joseph Moss <joe@XFree86.Org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JOSEPH MOSS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Joseph Moss shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Joseph Moss.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Alliance.c,v 3.2 1999/08/28 09:00:49 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Alliance __STDCARGS((int));
+
+Chip_Descriptor Alliance_Descriptor = {
+ "Alliance",
+ Probe_Alliance,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_Alliance(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte idx;
+ char chipid[9];
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_ALLIANCE)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_PM6410:
+ *Chipset = CHIP_ALSC6410;
+ break;
+ case PCI_CHIP_PM6422:
+ *Chipset = CHIP_ALSC6422;
+ break;
+ case PCI_CHIP_PMAT24:
+ *Chipset = CHIP_ALSCAT24;
+ break;
+ case PCI_CHIP_PMAT3D:
+ *Chipset = CHIP_ALSCAT3D;
+ break;
+ default:
+ Chip_data = pcrp->_device;
+ *Chipset = CHIP_ALSC_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ EnableIOPorts(NUMPORTS, Ports);
+ for (idx = 0x11; idx < 0x19; idx++) {
+ chipid[idx-0x11] = rdinx(SEQ_IDX, idx);
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+
+ chipid[7] = '\0';
+ if ( !strcmp(chipid, "Pro6410") )
+ *Chipset = CHIP_ALSC6410;
+ else if ( !strcmp(chipid, "Pro6422") )
+ *Chipset = CHIP_ALSC6422;
+ else if ( !strcmp(chipid, "Pro6424") )
+ *Chipset = CHIP_ALSCAT24;
+ else if ( !strcmp(chipid, "ProAT3D") )
+ *Chipset = CHIP_ALSCAT3D;
+ else
+ return(FALSE);
+
+ return(TRUE);
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds b/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds
new file mode 100644
index 000000000..086faa24e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds
@@ -0,0 +1,18 @@
+# Amakefile for X11R5/mit/server/ddx/x386/SuperProbe.
+# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.cmds,v 3.3 1996/12/23 06:31:02 dawes Exp $
+
+
+
+
+
+# $XConsortium: Amake.cmds /main/5 1996/02/21 17:09:22 kaleb $
+
+INCLUDES=
+{
+};
+
+%include $ARCH/generic.amk;
+
+%include $PWD/Amake.srclist;
+
+%instance command(SuperProbe, $X11R5_MIT_SERVER_DDX_X386_SUPERPROBE);
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist b/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist
new file mode 100644
index 000000000..f99352760
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist
@@ -0,0 +1,44 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Amake.srclist,v 3.3 1996/12/23 06:31:03 dawes Exp $
+
+
+
+
+
+# $XConsortium: Amake.srclist /main/5 1996/02/21 17:09:27 kaleb $
+
+X11R5_MIT_SERVER_DDX_X386_SUPERPROBE=
+{
+ $PWD/8514.c,
+ $PWD/AL.c,
+ $PWD/ATI.c,
+ $PWD/ATIMach.c,
+ $PWD/Ahead.c,
+ $PWD/CGA.c,
+ $PWD/ChipsTech.c,
+ $PWD/Cirrus.c,
+ $PWD/Compaq.c,
+ $PWD/Genoa.c,
+ $PWD/Herc.c,
+ $PWD/HMC.c,
+ $PWD/MDA.c,
+ $PWD/MX.c,
+ $PWD/Main.c,
+ $PWD/MemProbe.c,
+ $PWD/NCR.c,
+ $PWD/OS_Minix.c,
+ $PWD/Oak.c,
+ $PWD/Primus.c,
+ $PWD/Print.c,
+ $PWD/RamDac.c,
+ $PWD/RealTek.c,
+ $PWD/S3.c,
+ $PWD/Trident.c,
+ $PWD/Tseng.c,
+ $PWD/UMC.c,
+ $PWD/Utils.c,
+ $PWD/VGA.c,
+ $PWD/Video7.c,
+ $PWD/WD.c,
+ $PWD/Weitek.c,
+ $PWD/Yamaha.c,
+};
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h
new file mode 100644
index 000000000..bb6742228
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h
@@ -0,0 +1,434 @@
+/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+/*
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the source
+ * file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation" name
+ * nor any trademark or logo of Digital Equipment Corporation may be used
+ * to endorse or promote products derived from this software without the
+ * prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed. In
+ * no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for
+ * lost profits, loss of revenue or loss of use, whether such damages arise
+ * in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even if
+ * advised of the possibility of such damage.
+ *
+ */
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.13 1999/03/28 15:32:21 dawes Exp $ */
+
+#if defined(__GNUC__)
+#if defined(linux) && defined(__alpha__)
+#define inb _inb
+#define inw _inw
+#define inl _inl
+#define outb(p,v) _outb((v),(p))
+#define outw(p,v) _outw((v),(p))
+#define outl(p,v) _outl((v),(p))
+#else
+#if defined(__sparc__)
+#ifndef ASI_PL
+#define ASI_PL 0x88
+#endif
+
+static __inline__ void
+outb(port, val)
+unsigned long port;
+char val;
+{
+ __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ void
+outw(port, val)
+unsigned long port;
+char val;
+{
+ __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ void
+outl(port, val)
+unsigned long port;
+char val;
+{
+ __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ unsigned int
+inb(port)
+unsigned long port;
+{
+ unsigned char ret;
+ __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(port)
+unsigned long port;
+{
+ unsigned char ret;
+ __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(port)
+unsigned long port;
+{
+ unsigned char ret;
+ __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+#else
+#ifdef __arm32__
+unsigned int IOPortBase; /* Memory mapped I/O port area */
+
+static __inline__ void
+outb(port, val)
+ short port;
+ char val;
+{
+ if ((unsigned short)port >= 0x400) return;
+
+ *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outw(port, val)
+ short port;
+ short val;
+{
+ if ((unsigned short)port >= 0x400) return;
+
+ *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outl(port, val)
+ short port;
+ int val;
+{
+ if ((unsigned short)port >= 0x400) return;
+
+ *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ unsigned int
+inb(port)
+ short port;
+{
+ if ((unsigned short)port >= 0x400) return((unsigned int)-1);
+
+ return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase));
+}
+
+static __inline__ unsigned int
+inw(port)
+ short port;
+{
+ if ((unsigned short)port >= 0x400) return((unsigned int)-1);
+
+ return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase));
+}
+
+static __inline__ unsigned int
+inl(port)
+ short port;
+{
+ if ((unsigned short)port >= 0x400) return((unsigned int)-1);
+
+ return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase));
+}
+#else /* __arm32__ */
+#if defined(Lynx) && defined(__powerpc__)
+extern unsigned char *ioBase;
+
+static volatile void
+eieio()
+{
+ __asm__ __volatile__ ("eieio");
+}
+
+static void
+outb(port, value)
+short port;
+unsigned char value;
+{
+ *(uchar *)(ioBase + port) = value; eieio();
+}
+
+static void
+outw(port, value)
+short port;
+unsigned short value;
+{
+ *(unsigned short *)(ioBase + port) = value; eieio();
+}
+
+static void
+outl(port, value)
+short port;
+unsigned long value;
+{
+ *(unsigned long *)(ioBase + port) = value; eieio();
+}
+
+static unsigned char
+inb(port)
+short port;
+{
+ unsigned char val;
+
+ val = *((unsigned char *)(ioBase + port)); eieio();
+ return(val);
+}
+
+static unsigned short
+inw(port)
+short port;
+{
+ unsigned short val;
+
+ val = *((unsigned short *)(ioBase + port)); eieio();
+ return(val);
+}
+
+static unsigned long
+inl(port)
+short port;
+{
+ unsigned long val;
+
+ val = *((unsigned long *)(ioBase + port)); eieio();
+ return(val);
+}
+
+#else
+#ifdef GCCUSESGAS
+static __inline__ void
+outb(port, val)
+short port;
+char val;
+{
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outw(port, val)
+short port;
+short val;
+{
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(port, val)
+short port;
+unsigned int val;
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(port)
+short port;
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(port)
+short port;
+{
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(port)
+short port;
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+#else /* GCCUSESGAS */
+
+static __inline__ void
+outb(port, val)
+ short port;
+ char val;
+{
+ __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outw(port, val)
+ short port;
+ short val;
+{
+ __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(port, val)
+ short port;
+ unsigned int val;
+{
+ __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(port)
+ short port;
+{
+ unsigned int ret;
+ __asm__ __volatile__("in%B0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(port)
+ short port;
+{
+ unsigned int ret;
+ __asm__ __volatile__("in%W0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(port)
+ short port;
+{
+ unsigned int ret;
+ __asm__ __volatile__("in%L0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+#endif /* GCCUSESGAS */
+#endif /* Lynx && __powerpc__ */
+#endif /* arm32 */
+#endif /* linux && __sparc__ */
+#endif /* linux && __alpha__ */
+
+#if defined(linux) || defined(__arm32__) || (defined(Lynx) && defined(__powerpc__))
+
+#define intr_disable()
+#define intr_enable()
+
+#else
+
+static __inline__ void
+intr_disable()
+{
+ __asm__ __volatile__("cli");
+}
+
+static __inline__ void
+intr_enable()
+{
+ __asm__ __volatile__("sti");
+}
+
+#endif /* else !linux && !__arm32__ */
+
+#else /* __GNUC__ */
+
+#if defined(_MINIX) && defined(_ACK)
+
+/* inb, outb, inw and outw are defined in the library */
+/* ... but I've no idea if the same is true for inl & outl */
+
+u8_t inb(U16_t);
+void outb(U16_t, U8_t);
+u16_t inw(U16_t);
+void outw(U16_t, U16_t);
+u32_t inl(U16_t);
+void outl(U16_t, U32_t);
+
+#else /* not _MINIX and _ACK */
+
+# if defined(__STDC__) && (__STDC__ == 1)
+# ifndef NCR
+# define asm __asm
+# endif
+# endif
+# ifdef SVR4
+# include <sys/types.h>
+# ifndef __USLC__
+# define __USLC__
+# endif
+# endif
+#ifndef SCO325
+# include <sys/inline.h>
+#else
+# include "../common/scoasm.h"
+#endif
+#define intr_disable() asm("cli")
+#define intr_enable() asm("sti")
+
+#endif /* _MINIX and _ACK */
+#endif /* __GNUC__ */
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c
new file mode 100644
index 000000000..27297faf3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c
@@ -0,0 +1,64 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/CGA.c,v 3.4 1996/12/23 06:31:05 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: CGA.c /main/5 1996/02/21 17:09:35 kaleb $ */
+
+#include "Probe.h"
+
+/*
+ * Assume that the CRT Controller is at 0x3D4 (either no other adapter,
+ * or an EGA/CGA is installed in Mono mode). Look for the cursor
+ * postition register.
+ */
+static Word Ports[] = {0x3D4, 0x3D5};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Bool Probe_CGA(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte tmp;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ tmp = rdinx(0x3D4, 0x0F);
+ if (testinx(0x3D4, 0x0F))
+ {
+ result = TRUE;
+ if (testinx(0x3D4, 0x13))
+ {
+ *Chipset = CHIP_MCGA;
+ }
+ else
+ {
+ *Chipset = CHIP_CGA;
+ }
+ }
+ wrinx(0x3D4, 0x0F, tmp);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog b/xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog
new file mode 100644
index 000000000..225c9e33e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/ChangeLog
@@ -0,0 +1,101 @@
+Version 0.1 - March 25, 1993
+ - Initial delivery to XFree86 beta-team in 1.2A
+ - Handles ident of MDA,CGA,MCGA,EGA,VGA,Hercules, and lots of SVGA
+ - Handles many RAMDACs
+ - Requires ANSI C
+
+Version 0.2 - April 17, 1993
+ - Delivery to XFree86 beta-team in 1.2B
+ - Modified to search out BIOS base address (don't assume it's at
+ 0xC0000).
+ - Add Trident 8900CL, Tseng ET4000/W32
+
+Version 0.3 - May 7, 1993
+ - Delivery to XFree86 beta-team in 1.2C
+ - Allow compilation with K&R C compilers
+ - Add support for Minix
+ - Add -noprobe option to skip certain chipsets.
+ - Cirrus has built-in RAMDAC. Test for it, since the RAMDAC probe
+ hangs machines with Cirrus boards.
+ - #ifdef out C&T probe - it just seems to be TOO evil for words.
+
+Version 0.4 - May 24, 1993
+ - Delivery to XFree86 beta team for 1.2D
+ - Add support for Mach
+ - Add Compaq QVision/1280, fix up Cirrus and NCR
+
+Version 0.5 - June 1, 1993
+ - Final delivery for XFree86 1.3
+ - Change ET3000 probe
+ - Update docs regarding MicroChannel
+
+Version 0.6 - June 28, 1993
+ - Redo C&T probe function
+
+Version 0.7 -
+ - Update RAMDAC probes to check 6/8-bit wide lookup tables and to
+ identify the different AT&T RAMDACs.
+ - Add support for 8514/A, ATI Mach8 and ATI Mach32 detection.
+
+Version 0.8 -
+ - Update the S3 probes with all currently-known information.
+ - Bug fixes from Holger Veit
+
+Version 0.9 -
+ - Fix coprocessor ID code.
+ - Add Cirrus 5428, correct Cirrus built-in RAMDACs
+ - Update OS_Mach.c for Mach 3.0
+ - Even MORE S3 rev codes
+
+Version 0.91
+ - Add ATI Ultra/XLR (I think...)
+ - Update ATIMach.c to not read BIOS so an 8514 Ultra is detected.
+ - Add -no_bios flag to disallow BIOS reading and assume EGA/VGA
+ - Update Oak probe mechanism and add 057 check
+ - Update WD/Paradise probe to distinguish 90C2X chipsets
+
+Version 0.92
+ - Fix broken ATIMach.c (infinite loops are a bad thing :->)
+ - Add probe for Bt485 RAMDAC on S3 boards
+ - Rearrange chipset numbering so that the Unknown values are
+ always index 0. Add support for printing out a signature for
+ Unknown chipsets.
+
+Version 1.0
+ - Add in Cirrus 62x5, 642x chipsets
+ - Call it "done" for XFree86 2.0
+
+Version 1.1
+ - Add AT&T 20C505/504 checks to the RAMDAC probe
+ - Add Solaris x86 support (from David Holland <davidh@dorite.use.com>)
+ - Add -no_dac option to skip RAMDAC probe, in case it's nuking things.
+ - Long and short RamDac names.
+ - If the video BIOS can't be located, don't fail. Assume that there's
+ no EGA/VGA, and probe for old hardware.
+ - Put architecture in place for doing installed memory probes.
+
+Version 1.2 - Jan 2, 1994
+ - More work on memory probes. Add support for probing memory
+ by mapping 0xA0000-0xAFFFF and switching banks. Support
+ memory probe via this mechanism for Trident and ET4000AX.
+ - Add probes for Trident 9200CXr, 9400CXi.
+ - Add support for USL-style VTs on bsd-du-jour (from J"org Wunsch).
+ - Add -no_mem option to skip memory probe
+
+Version 2.0 - Feb 27, 1994
+ - Add memory probes for everything that can be accomplished by
+ reading registers. Nothing is currently using the physical
+ memory probe.
+ - Bazillions of changes from vgadoc3.zip (thanks, Finn). Added
+ HMC, UMC, Weitek probes. Added more chipsets for Cirrus,
+ NCR, Oak, RealTek, S3, Trident, Tseng, Video7, WD. Made some
+ changes to the probes for ATI & Compaq.
+
+Version 2.1 - April 13, 1994
+ - Small updates
+
+Version 2.2 - August 28, 1994
+ - More small updates
+
+Version 2.3 - November 18, 1994
+ - Add support for ATI Mach64.
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c
new file mode 100644
index 000000000..10fa9533c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c
@@ -0,0 +1,317 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/ChipsTech.c,v 3.18 1999/07/19 13:36:14 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: ChipsTech.c /main/8 1996/10/28 04:23:17 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3D6, 0x3D7};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_CT __STDCARGS((int));
+
+Chip_Descriptor CT_Descriptor = {
+ "CT",
+ Probe_CT,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_CT,
+};
+
+#ifdef __STDC__
+Bool Probe_CT(int *Chipset)
+#else
+Bool Probe_CT(Chipset)
+int *Chipset;
+#endif
+{
+ Bool result = FALSE;
+ Byte vers;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ if ((testinx(0x3D6, 0x18) && (testinx2(0x3D6, 0x7E, 0x3F))))
+ {
+ /*
+ * It's a Chips & Tech. Now figure out which one.
+ */
+ result = TRUE;
+ vers = rdinx(0x3D6, 0x00);
+ switch (vers)
+ {
+ case 0x00:
+ *Chipset = CHIP_CT451;
+ break;
+ case 0x10:
+ *Chipset = CHIP_CT452;
+ break;
+ case 0x20:
+ *Chipset = CHIP_CT455;
+ break;
+ case 0x30:
+ *Chipset = CHIP_CT453;
+ break;
+ case 0x40:
+ *Chipset = CHIP_CT450;
+ break;
+ case 0x50:
+ *Chipset = CHIP_CT456;
+ break;
+ case 0x60:
+ *Chipset = CHIP_CT457;
+ break;
+ case 0x70:
+ *Chipset = CHIP_CTF65520;
+ break;
+ case 0x80:
+ case 0xc0: /* guess */
+ *Chipset = CHIP_CTF65530;
+ break;
+ case 0x90:
+ *Chipset = CHIP_CTF65510;
+ break;
+ case 0xa0:
+ *Chipset = CHIP_CTF64200;
+ break;
+ case 0xb0:
+ *Chipset = CHIP_CTF64300;
+ break;
+ case 0xd0:
+ *Chipset = CHIP_CTF65540;
+ break;
+ case 0xd8:
+ case 0xd9:
+ case 0xda:
+ *Chipset = CHIP_CTF65545;
+ break;
+ case 0xdb:
+ *Chipset = CHIP_CTF65546;
+ break;
+ case 0xdc:
+ *Chipset = CHIP_CTF65548;
+ break;
+ default:
+ Chip_data = vers;
+ *Chipset = CHIP_CT_UNKNOWN;
+ break;
+ }
+ }
+ /*
+ * We could still have a HiQV style chipset. C&T have the PCI
+ * vendor ID stored in XR00 and XR01 for HiQV chips, regardless
+ * of whether the chip is actually connected to a PCI BUS. So
+ * probe for C&T vendor ID.
+ */
+ if ((rdinx(0x3D6, 0x00) == 0x2C) && (rdinx(0x3D6, 0x01) == 0x10))
+ {
+ /*
+ * It's a HiQV PCI Chips & Tech.
+ * Now figure out which one on PCI device ID low
+ * stored in XR02.
+ */
+ result = TRUE;
+ *Chipset = CHIP_CT_UNKNOWN;
+ vers = rdinx(0x3D6, 0x02);
+ switch (vers)
+ {
+ case 0xe0:
+ *Chipset = CHIP_CTF65550;
+ break;
+ case 0xe4:
+ *Chipset = CHIP_CTF65554;
+ break;
+ case 0xe5:
+ *Chipset = CHIP_CTF65555;
+ break;
+ case 0xf4:
+ *Chipset = CHIP_CTF68554;
+ break;
+ case 0xc0:
+ *Chipset = CHIP_CTF69000;
+ break;
+ case 0x30:
+ if (rdinx(0x3D6, 0x03) == 0xC)
+ *Chipset = CHIP_CTF69030;
+ else
+ Chip_data = vers;
+ *Chipset = CHIP_CT_UNKNOWN;
+ break;
+ default:
+ Chip_data = vers;
+ *Chipset = CHIP_CT_UNKNOWN;
+ break;
+ }
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_CT(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ switch (Chipset)
+ {
+ case CHIP_CT450:
+ case CHIP_CT456:
+ if (rdinx(0x3D6, 0x04) & 0x01)
+ {
+ Mem = 512;
+ }
+ else
+ {
+ Mem = 256;
+ }
+ break;
+ case CHIP_CT451:
+ case CHIP_CT455:
+ case CHIP_CT457:
+ Mem = 256;
+ break;
+ case CHIP_CT452:
+ switch (rdinx(0x3D6, 0x04) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ }
+ break;
+ case CHIP_CT453:
+ switch ((rdinx(0x3D6, 0x24) >> 1) & 0x03)
+ {
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ case 0x03:
+ Mem = 256;
+ break;
+ }
+ break;
+ case CHIP_CTF65510:
+ Mem = 512;
+ break;
+ case CHIP_CTF65520:
+ case CHIP_CTF65530:
+ case CHIP_CTF65540:
+ case CHIP_CTF65545:
+ case CHIP_CTF65546:
+ case CHIP_CTF65548:
+ switch (rdinx(0x3D6, 0x0F) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+ break;
+ case CHIP_CTF64200:
+ case CHIP_CTF64300:
+ switch (rdinx(0x3D6, 0x0F) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ case 0x03:
+ Mem = 2048;
+ break;
+ }
+ break;
+ case CHIP_CTF65550:
+ switch ((rdinx(0x3D6, 0x43) & 0x06) >> 1)
+ {
+ case 0x00:
+ Mem = 1024;
+ break;
+ case 0x01:
+ Mem = 2048;
+ break;
+ case 0x03:
+ case 0x04:
+ Mem = 4096;
+ break;
+ }
+ break;
+ case CHIP_CTF65554:
+ case CHIP_CTF65555:
+ case CHIP_CTF68554:
+ switch (rdinx(0x3D6, 0xE0) & 0x0F)
+ {
+ case 0x00:
+ Mem = 512;
+ break;
+ case 0x01:
+ Mem = 1024;
+ break;
+ case 0x02:
+ Mem = 1536;
+ break;
+ case 0x03:
+ Mem = 2048;
+ break;
+ case 0x07:
+ Mem = 4096;
+ break;
+ }
+ break;
+ case CHIP_CTF69000:
+ Mem = 2048;
+ break;
+ case CHIP_CTF69030:
+ Mem = 4096;
+ break;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c
new file mode 100644
index 000000000..3e5e295f2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c
@@ -0,0 +1,511 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Cirrus.c,v 3.14 1999/03/14 03:21:40 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Cirrus.c /main/12 1996/10/25 14:09:56 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG, GRC_IDX, GRC_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor Cirrus_Descriptor = {
+ "Cirrus",
+ Probe_Cirrus,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+static int MemProbe_Cirrus54 __STDCARGS((int));
+
+Chip_Descriptor Cirrus54_Descriptor = {
+ "Cirrus54",
+ Probe_Cirrus54,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Cirrus54,
+};
+
+static int MemProbe_Cirrus64 __STDCARGS((int));
+
+Chip_Descriptor Cirrus64_Descriptor = {
+ "Cirrus64",
+ Probe_Cirrus64,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Cirrus64,
+};
+
+#define CLASS_OLD 0
+#define CLASS_54XX 1
+#define CLASS_64XX 2
+
+#ifdef __STDC__
+static Bool Probe_Cirrus_Class(int *, int);
+#else
+static Bool Probe_Cirrus_Class();
+#endif
+
+Bool Probe_Cirrus(Chipset)
+int *Chipset;
+{
+ return(Probe_Cirrus_Class(Chipset, CLASS_OLD));
+}
+
+Bool Probe_Cirrus54(Chipset)
+int *Chipset;
+{
+ return(Probe_Cirrus_Class(Chipset, CLASS_54XX));
+}
+
+Bool Probe_Cirrus64(Chipset)
+int *Chipset;
+{
+ return(Probe_Cirrus_Class(Chipset, CLASS_64XX));
+}
+
+static Bool Probe_Cirrus_Class(Chipset, Class)
+int *Chipset;
+int Class;
+{
+ Bool result = FALSE;
+ Byte old, old1, Ver;
+ int i;
+
+ if (!NoPCI && Class == CLASS_54XX)
+ {
+ i = 0;
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_CIRRUS)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_GD5430:
+ /* Note: CL-GD5440 has the same ID. */
+ *Chipset = CHIP_CL5430;
+ break;
+ case PCI_CHIP_GD5434_4:
+ case PCI_CHIP_GD5434_8:
+ *Chipset = CHIP_CL5434;
+ break;
+ case PCI_CHIP_GD5436:
+ *Chipset = CHIP_CL5436;
+ break;
+ case PCI_CHIP_GD5446:
+ *Chipset = CHIP_CL5446;
+ break;
+ case PCI_CHIP_GD5480:
+ *Chipset = CHIP_CL5480;
+ break;
+ case PCI_CHIP_GD5462:
+ *Chipset = CHIP_CL5462;
+ break;
+ case PCI_CHIP_GD5464:
+ *Chipset = CHIP_CL5464;
+ break;
+ case PCI_CHIP_GD5465:
+ *Chipset = CHIP_CL5465;
+ break;
+ case PCI_CHIP_GD7541:
+ *Chipset = CHIP_CL7541;
+ break;
+ case PCI_CHIP_GD7542:
+ *Chipset = CHIP_CL7542;
+ break;
+ case PCI_CHIP_GD7543:
+ *Chipset = CHIP_CL7543;
+ break;
+ case PCI_CHIP_GD7548:
+ *Chipset = CHIP_CL7548;
+ break;
+ default:
+ /*
+ * The PCI probing only recognizes VGA
+ * devices, so we can be sure it is
+ * a graphics chip.
+ */
+ Chip_data = pcrp->_device;
+ *Chipset = CHIP_CL_UNKNOWN;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (Class == CLASS_OLD)
+ {
+ old = rdinx(CRTC_IDX, 0x0C);
+ old1 = rdinx(SEQ_IDX, 0x06);
+ wrinx(CRTC_IDX,0x0C,0);
+ Ver = rdinx(CRTC_IDX, 0x1F);
+ wrinx(SEQ_IDX, 0x06, (Ver >> 4) | (Ver << 4));
+ if (inp(SEQ_REG) == 0)
+ {
+ outp(SEQ_REG, Ver);
+ if (inp(SEQ_REG) == 1)
+ {
+ result = TRUE;
+ switch (Ver)
+ {
+ case 0xEC:
+ *Chipset = CHIP_CL510;
+ break;
+ case 0xCA:
+ *Chipset = CHIP_CL610;
+ break;
+ case 0xEA:
+ *Chipset = CHIP_CLV7;
+ break;
+ default:
+ Chip_data = Ver;
+ *Chipset = CHIP_CL_UNKNOWN;
+ break;
+ }
+ }
+ }
+ wrinx(SEQ_IDX, 0x06, old1);
+ wrinx(CRTC_IDX, 0x0C, old);
+ }
+ else if (Class == CLASS_54XX)
+ {
+ /*
+ * Cirrus 542x, 543x, 62x5 chips
+ */
+ old = rdinx(SEQ_IDX, 0x06);
+ wrinx(SEQ_IDX, 0x06, 0x00);
+ if (rdinx(SEQ_IDX, 0x06) == 0x0F)
+ {
+ wrinx(SEQ_IDX, 0x06, 0x12);
+ if ((rdinx(SEQ_IDX, 0x06) == 0x12) &&
+ (testinx2(SEQ_IDX, 0x1E, 0x3F)))
+ {
+ result = TRUE;
+ Ver = rdinx(CRTC_IDX, 0x27);
+ if (testinx(GRC_IDX, 0x09))
+ {
+ /* 542x */
+ switch ((Ver & 0xFC) >> 2)
+ {
+ case 0x06:
+ *Chipset = CHIP_CLAVGA2;
+ break;
+ case 0x22:
+ switch (Ver & 0x03)
+ {
+ case 0x00:
+ *Chipset=CHIP_CL5402;
+ break;
+ case 0x01:
+ *Chipset=CHIP_CL5402R1;
+ break;
+ case 0x02:
+ *Chipset=CHIP_CL5420;
+ break;
+ case 0x03:
+ *Chipset=CHIP_CL5420R1;
+ break;
+ }
+ break;
+ case 0x23:
+ *Chipset = CHIP_CL5422;
+ break;
+ case 0x25:
+ *Chipset = CHIP_CL5424;
+ break;
+ case 0x24:
+ *Chipset = CHIP_CL5426;
+ break;
+ case 0x26:
+ *Chipset = CHIP_CL5428;
+ break;
+ case 0x27:
+ *Chipset = CHIP_CL5429;
+ break;
+ case 0x28:
+ *Chipset = CHIP_CL5430;
+ break;
+ case 0x2A:
+ *Chipset = CHIP_CL5434;
+ break;
+ case 0x2B:
+ *Chipset = CHIP_CL5436;
+ break;
+ case 0x2E:
+ *Chipset = CHIP_CL5446;
+ break;
+ case 0x2F:
+ *Chipset = CHIP_CL5480;
+ break;
+ case 0x0A: /* guess */
+ *Chipset = CHIP_CL7541;
+ break;
+ case 0x0B:
+ *Chipset = CHIP_CL7542;
+ break;
+ case 0x0C:
+ *Chipset = CHIP_CL7543;
+ break;
+ default:
+ Chip_data = Ver;
+ *Chipset = CHIP_CL_UNKNOWN;
+ break;
+ }
+ if (*Chipset == CHIP_CL5430 ||
+ *Chipset == CHIP_CL5434 ||
+ *Chipset == CHIP_CL5436 ||
+ *Chipset == CHIP_CL5446 ||
+ *Chipset == CHIP_CL5480)
+ {
+ /*
+ * Make sure that there is
+ * a sane value in the
+ * Display Compression
+ * Control register, which
+ * may be corrupted by other
+ * probes.
+ */
+ unsigned char tmp;
+ tmp = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F,
+ tmp & 0xc0);
+ }
+ }
+ else if (testinx(SEQ_IDX, 0x19))
+ {
+ /* 62x5 */
+ switch ((Ver & 0xC0) >> 6)
+ {
+ case 0x00:
+ *Chipset = CHIP_CL6205;
+ break;
+ case 0x01:
+ *Chipset = CHIP_CL6235;
+ break;
+ case 0x02:
+ *Chipset = CHIP_CL6215;
+ break;
+ case 0x03:
+ *Chipset = CHIP_CL6225;
+ break;
+ }
+ }
+ else
+ {
+ *Chipset = CHIP_CLAVGA2;
+ }
+ }
+ }
+ wrinx(SEQ_IDX, 0x06, old);
+ }
+ else
+ {
+ /*
+ * The Cirrus 64xx chips.
+ */
+ old = rdinx(GRC_IDX, 0x0A);
+ wrinx(GRC_IDX, 0x0A, 0xCE);
+ if (rdinx(GRC_IDX, 0x0A) == 0x00)
+ {
+ wrinx(GRC_IDX, 0x0A, 0xEC);
+ if (rdinx(GRC_IDX, 0x0A) == 0x01)
+ {
+ result = TRUE;
+ Ver = rdinx(GRC_IDX, 0xAA);
+ switch ((Ver & 0xF0) >> 4)
+ {
+ case 0x04:
+ *Chipset = CHIP_CL6440;
+ break;
+ case 0x05:
+ *Chipset = CHIP_CL6412;
+ break;
+ case 0x06:
+ *Chipset = CHIP_CL5410;
+ break;
+ case 0x07:
+ if (testinx2(0x3CE, 0x87, 0x90))
+ {
+ *Chipset = CHIP_CL6420B;
+ }
+ else
+ {
+ *Chipset = CHIP_CL6420A;
+ }
+ break;
+ case 0x08:
+ *Chipset = CHIP_CL6410;
+ break;
+ default:
+ Chip_data = Ver;
+ *Chipset = CHIP_CL_UNKNOWN;
+ break;
+ }
+ }
+ }
+ wrinx(GRC_IDX, 0x0A, old);
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_Cirrus54(Chipset)
+int Chipset;
+{
+ Byte old, SRF;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(SEQ_IDX, 0x06);
+ wrinx(SEQ_IDX, 0x06, 0x12);
+
+ /*
+ * Check
+ */
+ switch (Chipset)
+ {
+ case CHIP_CL6205:
+ case CHIP_CL6215:
+ case CHIP_CL6225:
+ case CHIP_CL6235:
+ Mem = 512;
+ break;
+ case CHIP_CL5430:
+ case CHIP_CL5434:
+ case CHIP_CL5436:
+ case CHIP_CL5446:
+ case CHIP_CL5480:
+ case CHIP_CL7543:
+ case CHIP_CL7548:
+ Mem = 512;
+ SRF = rdinx(SEQ_IDX, 0x0F);
+ if (SRF & 0x10)
+ Mem *= 2;
+ if ((SRF & 0x18) == 0x18)
+ Mem *= 2;
+ if (Chipset != CHIP_CL5430 && (SRF & 0x80))
+ Mem *= 2;
+ break;
+ case CHIP_CL5462:
+ case CHIP_CL5464:
+ case CHIP_CL5465:
+ /* Read BIOS scratch register. */
+ Mem = ((rdinx(SEQ_IDX, 0x14) & 0x07) + 1) * 1024;
+ break;
+ default:
+ /* 542x, use BIOS Scratch Register value */
+ switch ((rdinx(SEQ_IDX, 0x0A) & 0x18) >> 3)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ case 0x03:
+ Mem = 2048;
+ break;
+ }
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(SEQ_IDX, 0x06, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
+
+/* ARGSUSED */
+static int MemProbe_Cirrus64(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(GRC_IDX, 0x0A);
+ wrinx(GRC_IDX, 0x0A, 0xEC);
+
+ /*
+ * Check
+ */
+ switch (rdinx(GRC_IDX, 0xBB) >> 6)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 768;
+ break;
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(GRC_IDX, 0x0A, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c
new file mode 100644
index 000000000..55d883718
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c
@@ -0,0 +1,158 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Compaq.c,v 3.5 1996/12/23 06:31:08 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Compaq.c /main/5 1996/02/21 17:09:58 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {GRC_IDX, GRC_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Compaq __STDCARGS((int));
+
+Chip_Descriptor Compaq_Descriptor = {
+ "Compaq",
+ Probe_Compaq,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_Compaq,
+};
+
+Bool Probe_Compaq(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, ver;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F, 0x00);
+ if (!testinx(GRC_IDX, 0x45))
+ {
+ wrinx(GRC_IDX, 0x0F, 0x05);
+ if (testinx(GRC_IDX, 0x45))
+ {
+ result = TRUE;
+ ver = rdinx(GRC_IDX, 0x0C) >> 3;
+ switch (ver)
+ {
+ case 0x03:
+ *Chipset = CHIP_CPQ_IVGS;
+ break;
+ case 0x05:
+ *Chipset = CHIP_CPQ_AVGA;
+ break;
+ case 0x06:
+ *Chipset = CHIP_CPQ_Q1024;
+ break;
+ case 0x0E:
+ if (rdinx(GRC_IDX, 0x56) & 0x04)
+ {
+ *Chipset = CHIP_CPQ_Q1280;
+ }
+ else
+ {
+ *Chipset = CHIP_CPQ_Q1024;
+ }
+ break;
+ case 0x10:
+ *Chipset = CHIP_CPQ_AVGA_P;
+ break;
+ default:
+ Chip_data = ver >> 3;
+ *Chipset = CHIP_CPQ_UNK;
+ break;
+ }
+ }
+ }
+ wrinx(GRC_IDX, 0x0F, old);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_Compaq(Chipset)
+int Chipset;
+{
+ Byte old, temp;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock.
+ */
+ old = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F, 0x05);
+
+ /*
+ * Check
+ */
+ switch (Chipset)
+ {
+ case CHIP_CPQ_IVGS:
+ Mem = 256;
+ break;
+ case CHIP_CPQ_AVGA:
+ case CHIP_CPQ_AVGA_P:
+ Mem = 512;
+ break;
+ case CHIP_CPQ_Q1024:
+ case CHIP_CPQ_Q1280:
+ temp = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F, 0x05);
+ switch (rdinx(GRC_IDX, 0x54))
+ {
+ case 0x00:
+ Mem = 1024;
+ break;
+ case 0x02:
+ Mem = 512;
+ break;
+ case 0x04:
+ Mem = 1024;
+ break;
+ case 0x08:
+ Mem = 2048;
+ break;
+ }
+ wrinx(GRC_IDX, 0x0F, temp);
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(GRC_IDX, 0x0F, 0x05);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c
new file mode 100644
index 000000000..5d7fe0bcc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c
@@ -0,0 +1,91 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Epson.c,v 1.2 1999/03/14 01:21:14 dawes Exp $ */
+/*
+ * (c) Copyright 1998 by Thomas Mueller <tmueller@sysgo.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THOMAS MUELLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Thomas Mueller shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Thomas Mueller.
+ *
+ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3CD, 0x3DE, 0x3DF, 0x3D0, 0x3D1, 0x3D2, 0x3D3,
+ ATR_IDX, ATR_REG_R, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Epson __STDCARGS((int));
+
+Chip_Descriptor Epson_Descriptor = {
+ "Epson",
+ Probe_Epson,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_Epson,
+};
+
+Bool Probe_Epson(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, val;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ old = inp(0x3de);
+ outp(0x3de, 0x08);
+ val = inp(0x3df);
+ if ((val & 0xe0) == 0xe0) {
+ outp(0x3de, 0x0f); /* secondary revision code */
+ val = inp(0x3df);
+
+ if ((val & 0xf8) == 0xa0) {
+ *Chipset = CHIP_EPSON_8110;
+ result = TRUE;
+ }
+ }
+ outp(0x3de, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return result;
+}
+
+
+
+static int MemProbe_Epson(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ outp(0x3de, 3);
+ if (inp(0x3df) & 0x40)
+ Mem = 512;
+ else
+ Mem = 1024;
+
+ DisableIOPorts(NUMPORTS, Ports);
+
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c
new file mode 100644
index 000000000..2b7961477
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c
@@ -0,0 +1,254 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/GLINT.c,v 3.1 1997/03/07 00:28:51 hohndel Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Dirk Hohndel <hohndel@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Dirk Hohndel shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Dirk Hohndel.
+ *
+ */
+
+#include "Probe.h"
+
+#define PCI_EN 0x80000000
+
+#ifdef PC98
+static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 };
+#else
+static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 };
+#endif
+
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_GLINT __STDCARGS((int));
+static int GLINTMem = 0;
+
+Chip_Descriptor GLINT_Descriptor = {
+ "GLINT",
+ Probe_GLINT,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_GLINT,
+};
+
+Bool Probe_GLINT(Chipset)
+int *Chipset;
+{
+ int chipset_passed;
+ int i = -1;
+ Bool result = FALSE;
+ struct pci_config_reg * pcip;
+ unsigned long glint300sx = 0;
+ unsigned long glint500tx = 0;
+ unsigned long glintdelta = 0;
+ unsigned long glintcopro = 0;
+ unsigned long basecopro;
+ unsigned long base3copro;
+ unsigned long basedelta;
+ unsigned long *delta_pci_basep;
+ unsigned long cmd;
+ unsigned long lbsize;
+
+ /*
+ * to be able to detect multiple GLINT chips we need to set
+ * *Chipset to 0 first. We'll set it back to the value passed to
+ * us if nothing was found
+ */
+ chipset_passed = *Chipset;
+ *Chipset = 0;
+ /*
+ * we only check for the GLINT in the PCI config data that we have
+ */
+ while (pci_devp[++i] != NULL)
+ {
+ pcip = pci_devp[i];
+ if (pcip->_vendor == PCI_VENDOR_3DLABS)
+ {
+ switch (pcip->_device)
+ {
+ case PCI_CHIP_3DLABS_300SX:
+ *Chipset |= CHIP_300SX;
+ glint300sx = PCI_EN |
+ (pcip->_pcibuses[pcip->_pcibusidx] << 16) |
+ (pcip->_cardnum << 11) | (pcip->_funcnum << 8);
+ result = TRUE;
+ break;
+ case PCI_CHIP_3DLABS_500TX:
+ *Chipset |= CHIP_500TX;
+ glint500tx = PCI_EN |
+ (pcip->_pcibuses[pcip->_pcibusidx] << 16) |
+ (pcip->_cardnum << 11) | (pcip->_funcnum << 8);
+ result = TRUE;
+ break;
+ case PCI_CHIP_3DLABS_DELTA:
+ *Chipset |= CHIP_DELTA;
+ glintdelta = PCI_EN |
+ (pcip->_pcibuses[pcip->_pcibusidx] << 16) |
+ (pcip->_cardnum << 11) | (pcip->_funcnum << 8);
+ delta_pci_basep = &(pcip->_base0);
+ result = TRUE;
+ break;
+ }
+ }
+ }
+ if (!result)
+ {
+ *Chipset = chipset_passed;
+ goto Probe_GLINT_exit;
+ }
+ /*
+ * due to a few bugs in the GLINT Delta we might have to relocate
+ * the base address of config region of the Delta, if bit 17 of
+ * the base addresses of config region of the Delta and the 500TX
+ * or 300SX are different
+ * We only handle config type 1 at this point
+ */
+ if( glintdelta && (glint500tx || glint300sx) )
+ {
+ if( glint500tx && glint300sx )
+ {
+ /*
+ * can't handle if both of them are present
+ */
+ goto Probe_GLINT_exit;
+ }
+ glintcopro = glint500tx | glint300sx;
+
+ outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x10); /* base0 */
+ basecopro = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x10);
+ basedelta = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x1c); /* base3 */
+ base3copro = inpl(PCI_MODE1_DATA_REG);
+ /*
+ * while we're at it, we can figure out the RAM size as well
+ */
+ /*
+ * this number seems to be wrong, it shows 16MB on my board
+ * even though there are definitely just 8MB
+ * ignore it for now
+ */
+#if 0
+ outpl(PCI_MODE1_DATA_REG,0xffffffff);
+ lbsize = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_DATA_REG,base3copro);
+ lbsize &= 0xfffffff0;
+ lbsize ^= 0xffffffff;
+ lbsize++;
+#endif
+ if( (basedelta & 0x20000) ^ (basecopro & 0x20000) )
+ {
+ /*
+ * if the base addresses are different at bit 17,
+ * we have to remap the base0 for the delta;
+ * as wrong as this looks, we can use the base3 of the
+ * 300SX/500TX for this. The delta is working as a bridge
+ * here and gives its own addresses preference. And we
+ * don't need to access base3, as this one is the bytw
+ * swapped local buffer which we don't need.
+ * Using base3 we know that the space is
+ * a) large enough
+ * b) free (well, almost)
+ */
+ if( (basecopro & 0x20000) ^ (base3copro & 0x20000) )
+ {
+ /*
+ * oops, still different; we know that base3 is at least
+ * 1 MB, so we just take 128k offset into it
+ */
+ base3copro += 0x20000;
+ }
+ outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x10);
+ outpl(PCI_MODE1_DATA_REG,base3copro);
+ /*
+ * now update our internal structure accordingly
+ */
+ *delta_pci_basep = base3copro;
+ }
+ /*
+ * now make sure that memory space access is enabled on
+ * both chips
+ */
+ outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x04);/* command */
+ cmd = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, glintcopro | 0x04);
+ outpl(PCI_MODE1_DATA_REG,cmd | 2);
+ outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x04);
+ cmd = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, glintdelta | 0x04);
+ outpl(PCI_MODE1_DATA_REG,cmd | 2);
+ }
+
+Probe_GLINT_exit:
+
+ return(result);
+}
+
+static int MemProbe_GLINT(Chipset)
+int Chipset;
+{
+ int mem;
+ unsigned int FBMemoryCtl,LBMemoryCtl;
+ Byte * config;
+ Bool found = FALSE;
+ int i = -1;
+ int j;
+
+ while ((pci_devp[++i] != NULL) && !found)
+ {
+ if (pci_devp[i]->_vendor == PCI_VENDOR_3DLABS)
+ {
+ /*
+ * ignore the Delta chip and use one of the real
+ * copros for the memory check
+ */
+ switch (pci_devp[i]->_device)
+ {
+ case PCI_CHIP_3DLABS_300SX:
+ case PCI_CHIP_3DLABS_500TX:
+ case PCI_CHIP_3DLABS_DELTA:
+ config = MapMem(pci_devp[i]->_base0,0x2000L);
+ if (config == 0)
+ break;
+#ifdef DEBUGPCI
+ printf("\npci bus 0x%x cardnum 0x%02x function 0x%02x, vendor 0x%04x device 0x%04x\n",
+ pci_devp[i]->_pcibuses[pci_devp[i]->_pcibusidx],
+ pci_devp[i]->_cardnum, pci_devp[i]->_funcnum,
+ pci_devp[i]->_vendor, pci_devp[i]->_device);
+ printf("mapped base0 from 0x%08x to 0x%08x\n\n",
+ pci_devp[i]->_base0, config);
+#endif
+ LBMemoryCtl = *(int*)&config[0x1000];
+ FBMemoryCtl = *(int*)&config[0x1800];
+ mem = 1024 * (1 << ((LBMemoryCtl & 0x07000000) >> 24));
+ mem <<= 16;
+ mem |= 1024 * (1 << ((FBMemoryCtl & 0xe0000000)>> 29));
+ UnMapMem(config,0x2000L);
+ found = TRUE;
+ break;
+ }
+ }
+ }
+ return(mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c
new file mode 100644
index 000000000..7ff9bb94a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c
@@ -0,0 +1,108 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Genoa.c,v 3.4 1996/12/23 06:31:09 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Genoa.c /main/5 1996/02/21 17:10:03 kaleb $ */
+
+#include "Probe.h"
+
+static int MemProbe_Genoa __STDCARGS((int));
+
+Chip_Descriptor Genoa_Descriptor = {
+ "Genoa",
+ Probe_Genoa,
+ NULL,
+ 0,
+ FALSE,
+ TRUE,
+ TRUE,
+ MemProbe_Genoa,
+};
+
+Bool Probe_Genoa(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte addr, data[4];
+
+ if (ReadBIOS(0x37, &addr, 1) != 1)
+ {
+ fprintf(stderr, "%s: Failed to read Genoa BIOS address.\n",
+ MyName);
+ return(FALSE);
+ }
+ if (ReadBIOS((unsigned)addr, data, 4) != 4)
+ {
+ fprintf(stderr, "%s: Failed to read Genoa BIOS signature.\n",
+ MyName);
+ return(FALSE);
+ }
+ if ((data[0] == 0x77) && (data[2] == 0x99) && (data[3] == 0x66))
+ {
+ /*
+ * Genoa also has ET3000 and (possibly) ET4000 based
+ * boards that match this signature. We only match
+ * the ones with Genoa chips, and let other probe
+ * functions deal with other chipsets.
+ */
+ switch (data[1])
+ {
+ case 0x00:
+ *Chipset = CHIP_G_6200;
+ result = TRUE;
+ break;
+ case 0x11:
+ *Chipset = CHIP_G_6400;
+ result = TRUE;
+ break;
+ case 0x22:
+ *Chipset = CHIP_G_6100;
+ result = TRUE;
+ break;
+ }
+ }
+ return(result);
+}
+
+static int MemProbe_Genoa(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ switch (Chipset)
+ {
+ case CHIP_G_6100:
+ case CHIP_G_6200:
+ Mem = 256;
+ break;
+ case CHIP_G_6400:
+ Mem = 512;
+ break;
+ }
+
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c
new file mode 100644
index 000000000..ad6175d3e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c
@@ -0,0 +1,85 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/HMC.c,v 3.4 1996/12/23 06:31:10 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: HMC.c /main/5 1996/02/21 17:10:11 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_HMC __STDCARGS((int));
+
+Chip_Descriptor HMC_Descriptor = {
+ "HMC",
+ Probe_HMC,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_HMC,
+};
+
+Bool Probe_HMC(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (testinx(SEQ_IDX, 0xE7) && testinx(SEQ_IDX, 0xEE))
+ {
+ result = TRUE;
+ *Chipset = CHIP_HM86304;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_HMC(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (rdinx(SEQ_IDX, 0xE7) & 0x10)
+ {
+ Mem = 512;
+ }
+ else
+ {
+ Mem = 256;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c
new file mode 100644
index 000000000..3cb41a2d7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c
@@ -0,0 +1,75 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Herc.c,v 3.4 1996/12/23 06:31:11 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Herc.c /main/5 1996/02/21 17:10:16 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3BA};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+#define DSP_VSYNC_MASK 0x80
+#define DSP_ID_MASK 0x70
+
+Bool Probe_Herc(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ int i, cnt = 0;
+ Byte dsp, dsp_old;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ dsp_old = inp(0x3BA) & DSP_VSYNC_MASK;
+ for (i = 0; i < 0x10000; i++)
+ {
+ dsp = inp(0x3BA) & DSP_VSYNC_MASK;
+ if (dsp != dsp_old)
+ cnt++;
+ dsp_old = dsp;
+ }
+
+ /* If there are active sync changes, we found a Hercules board. */
+ if (cnt)
+ {
+ dsp = inp(0x3BA) & DSP_ID_MASK;
+ switch(dsp)
+ {
+ case 0x10:
+ *Chipset = CHIP_HERC_PLUS;
+ break;
+ case 0x50:
+ *Chipset = CHIP_HERC_COL;
+ break;
+ default:
+ *Chipset = CHIP_HERC_STD;
+ }
+ result = TRUE;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c
new file mode 100644
index 000000000..6a8525871
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c
@@ -0,0 +1,206 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/I128.c,v 3.8 1999/03/14 03:21:40 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Robin Cutshaw <robin@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Robin Cutshaw shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Robin Cutshaw.
+ *
+ */
+
+/* $XConsortium: I128.c /main/6 1996/10/19 17:46:43 kaleb $ */
+
+#include "Probe.h"
+
+#ifdef PC98
+static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 };
+#else
+static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 };
+#endif
+
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+#define PCI_EN 0x80000000
+
+static int MemProbe_I128 __STDCARGS((int));
+static int I128Mem = 0;
+
+Chip_Descriptor I128_Descriptor = {
+ "I128",
+ Probe_I128,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_I128,
+};
+
+Bool Probe_I128(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Word ioaddr, vendor, device, iobase;
+ Long id, vendordevice, tmplong1, tmplong2, pcibus, cardnum;
+ Byte tmp1, tmp2, configtype = 0;
+
+ EnableIOPorts(2, Ports);
+
+ outp(PCI_MODE2_ENABLE_REG, 0x00);
+ outp(PCI_MODE2_FORWARD_REG, 0x00);
+ tmp1 = inp(PCI_MODE2_ENABLE_REG);
+ tmp2 = inp(PCI_MODE2_FORWARD_REG);
+ if ((tmp1 == 0x00) && (tmp2 == 0x00))
+ configtype = 2;
+ else {
+ tmplong1 = inpl(PCI_MODE1_ADDRESS_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, PCI_EN);
+ tmplong2 = inpl(PCI_MODE1_ADDRESS_REG);
+ if (tmplong2 == PCI_EN);
+ configtype = 1;
+ outpl(PCI_MODE1_ADDRESS_REG, tmplong1);
+ }
+
+ DisableIOPorts(2, Ports);
+
+ if (configtype == 0)
+ return(FALSE);
+ else if (configtype == 1) {
+ EnableIOPorts(3, Ports);
+ for (pcibus = 0x000000; pcibus < 0x100000; pcibus += 0x10000) {
+ for (cardnum = 0x00000; cardnum < 0x10000; cardnum += 0x0800) {
+ outpl(PCI_MODE1_ADDRESS_REG, PCI_EN | pcibus | cardnum);
+ tmplong1 = inpl(PCI_MODE1_DATA_REG);
+ vendor = (unsigned short )(tmplong1 & 0xFFFF);
+ device = (unsigned short )((tmplong1 >> 16) & 0xFFFF);
+#ifdef DEBUG
+ printf("pci bus/card 0x%08x, vendor 0x%04x device 0x%04x\n",
+ pcibus | cardnum, vendor, device);
+#endif
+ if ((vendor == 0x105D) &&
+ ((device == 0x2309) || (device == 0x2339) ||
+ (device == 0x493D) || (device == 0x5348))) {
+ outpl(PCI_MODE1_ADDRESS_REG, PCI_EN | pcibus | cardnum | 0x24);
+ iobase = inpl(PCI_MODE1_DATA_REG) & 0xFFFFFF00;
+
+ DisableIOPorts(3, Ports);
+ Ports[3] = iobase + 0x18;
+ EnableIOPorts(4, Ports);
+
+ id = inpl(iobase + 0x18);
+ DisableIOPorts(4, Ports);
+
+ switch (id & 0xC0) {
+ case 0x00:
+ I128Mem = 4096;
+ break;
+ case 0x40:
+ I128Mem = 8192;
+ break;
+ case 0x80:
+ I128Mem = 16384;
+ break;
+ case 0xC0:
+ I128Mem = 32768;
+ break;
+ }
+
+ *Chipset = CHIP_I128;
+ return(TRUE);
+ }
+ }
+ }
+ /* not found */
+ DisableIOPorts(3, Ports);
+ return(FALSE);
+ }
+
+ /* else configtype == 2 */
+
+ EnableIOPorts(2, Ports);
+ outp(PCI_MODE2_ENABLE_REG, 0x80);
+ outp(PCI_MODE2_FORWARD_REG, 0x00);
+ DisableIOPorts(2, Ports);
+
+ for (ioaddr = 0xC000; ioaddr < 0xD000; ioaddr += 0x0100) {
+ Ports[2] = ioaddr;
+ Ports[3] = ioaddr + 0x24;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ vendordevice = inpl(ioaddr);
+ vendor = (unsigned short )(vendordevice & 0xFFFF);
+ device = (unsigned short )((vendordevice >> 16) & 0xFFFF);
+
+#ifdef DEBUG
+ printf("pci slot at 0x%04x, vendor 0x%04x device 0x%04x\n",
+ ioaddr, vendor, device);
+#endif
+
+ if ((vendor != 0x105D) ||
+ ((device != 0x2309) && (device != 0x2339) &&
+ (device != 0x493D) && (device != 0x5348))) {
+ DisableIOPorts(NUMPORTS, Ports);
+ continue;
+ }
+
+ iobase = inpl(ioaddr + 0x24) & 0xFFFFFF00;
+
+ DisableIOPorts(NUMPORTS, Ports);
+ Ports[2] = iobase + 0x18;
+ Ports[3] = 0x000;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ id = inpl(iobase + 0x18) & 0x7FFFFFFF;
+ switch (id & 0xC0) {
+ case 0x00:
+ I128Mem = 4096;
+ break;
+ case 0x40:
+ I128Mem = 8192;
+ break;
+ case 0x80:
+ I128Mem = 16384;
+ break;
+ case 0xC0:
+ I128Mem = 32768;
+ break;
+ }
+
+ *Chipset = CHIP_I128;
+ result = TRUE;
+ DisableIOPorts(NUMPORTS, Ports);
+ Ports[3] = 0x0000;
+ break;
+ }
+
+ Ports[2] = Ports[3] = 0x0000;
+ EnableIOPorts(NUMPORTS, Ports);
+ outp(PCI_MODE2_ENABLE_REG, 0x00);
+ DisableIOPorts(NUMPORTS, Ports);
+
+ return(result);
+}
+
+static int MemProbe_I128(Chipset)
+int Chipset;
+{
+ return(I128Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile
new file mode 100644
index 000000000..6139c5f16
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile
@@ -0,0 +1,104 @@
+XCOMM $XConsortium: Imakefile /main/14 1996/10/27 11:03:56 kaleb $
+
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Imakefile,v 3.31 1999/03/14 03:21:41 dawes Exp $
+
+#if (defined(SVR3Architecture) || defined(SVR4Architecture) || defined(SCOArchitecture)) && !defined(DguxArchitecture)
+# define OSModule OS_SYSV
+#endif
+
+#if defined(MetroLink) && defined(NCR)
+#undef NCR
+#endif
+
+#if defined(SVR4Architecture)
+# include <Server.tmpl>
+#endif
+
+#if defined(DguxArchitecture)
+# define OSModule OS_DGUX
+#endif
+
+#if defined(SVR4Architecture) && defined(SunArchitecture) && !HasGcc
+ OS_IO_SRC = SolX86IO.s
+ OS_IO_OBJ = SolX86IO.o
+#endif
+#if defined(LinuxArchitecture)
+# define OSModule OS_Linux
+#if defined(AlphaArchitecture) && !UseElfFormat /* fix/replacement for broken libc-0.43 io.c */
+ OS_IO_SRC = glibcAxpIo.c
+ OS_IO_OBJ = glibcAxpIo.o
+#endif
+#endif
+#if defined(LynxOSArchitecture)
+# define OSModule OS_LynxOS
+#endif
+#if defined(i386BsdArchitecture)
+# define OSModule OS_386BSD
+#endif
+#if defined(MinixArchitecture)
+# define OSModule OS_Minix
+#endif
+#if defined(i386MachArchitecture)
+#if defined(GNUMachArchitecture)
+ SYS_LIBRARIES =
+# define OSModule OS_GNUmach
+#else
+ SYS_LIBRARIES = /usr/lib/libmach.a
+# define OSModule OS_Mach
+#endif
+#endif
+#if defined(OS2Architecture)
+# define OSModule OS_Os2
+ CCOPTIONS = -Zmts
+#endif
+#if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \
+ && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2)
+ IOPERMDEFINES = -DUSE_I386_IOPL
+ SYS_LIBRARIES = -li386
+#endif
+OS_SRC = OSModule.c $(OS_IO_SRC)
+OS_OBJ = OSModule.o $(OS_IO_OBJ)
+BASE_SRC = MDA.c Herc.c CGA.c VGA.c RamDac.c MemProbe.c PCI.c
+BASE_OBJ = MDA.o Herc.o CGA.o VGA.o RamDac.o MemProbe.o PCI.o
+SVGA_SRC = Tseng.c WD.c ChipsTech.c Video7.c Genoa.c Trident.c Oak.c \
+ Cirrus.c Ahead.c ATI.c S3.c AL.c Yamaha.c NCR.c MX.c \
+ RealTek.c Primus.c Compaq.c HMC.c UMC.c Weitek.c SiS.c \
+ ARK.c Alliance.c Matrox.c SigmaDesigns.c Intergraphics.c \
+ Epson.c Rendition.c
+SVGA_OBJ = Tseng.o WD.o ChipsTech.o Video7.o Genoa.o Trident.o Oak.o \
+ Cirrus.o Ahead.o ATI.o S3.o AL.o Yamaha.o NCR.o MX.o \
+ RealTek.o Primus.o Compaq.o HMC.o UMC.o Weitek.o SiS.o \
+ ARK.o Alliance.o Matrox.o SigmaDesigns.o Intergraphics.o \
+ Epson.o Rendition.o
+COPROC_SRC = 8514.c ATIMach.c I128.c GLINT.c
+COPROC_OBJ = 8514.o ATIMach.o I128.o GLINT.o
+SRCS = Main.c $(SVGA_SRC) $(COPROC_SRC) $(BASE_SRC) Print.c Utils.c $(OS_SRC)
+OBJS = Main.o $(SVGA_OBJ) $(COPROC_OBJ) $(BASE_OBJ) Print.o Utils.o $(OS_OBJ)
+
+#ifdef GccGasOption
+GASDEFINES = GccGasOption
+#endif
+CONSDEFINES = XFree86ConsoleDefines
+
+#ifdef OS2Architecture
+SPECIALS= sprobe.def
+#endif
+
+DEFINES = $(GASDEFINES) $(CONSDEFINES) $(IOPERMDEFINES)
+
+PROG = SuperProbe
+
+AllTarget(ProgramTargetName($(PROG)))
+NormalProgramTarget($(PROG),$(OBJS),NullParameter,$(SPECIALS),NullParameter)
+InstallProgram($(PROG),$(BINDIR))
+InstallManPage($(PROG),$(MANDIR))
+
+#if defined(LinuxArchitecture) && defined(AlphaArchitecture) && !UseElfFormat
+LinkSourceFile(glibcAxpIo.c,../common_hw)
+#endif
+
+DependTarget()
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c
new file mode 100644
index 000000000..ce5c05987
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c
@@ -0,0 +1,83 @@
+/*
+ * (c) Copyright 1997 Harald Koenig <koenig@XFree86.Org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARALD KEONIG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Harald Koenig shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Harald Koenig.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Intergraphics.c,v 1.2 1999/03/14 01:21:14 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, };
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Intergraphics __STDCARGS((int));
+
+Chip_Descriptor Intergraphics_Descriptor = {
+ "Intergraphics",
+ Probe_Intergraphics,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_Intergraphics(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte chip, old, old1, val;
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_INTERGRAPHICS)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_INTERG_1680:
+ *Chipset = CHIP_IG_1680;
+ break;
+ case PCI_CHIP_INTERG_1682:
+ *Chipset = CHIP_IG_1682;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_IG_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ return(FALSE);
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c
new file mode 100644
index 000000000..664ab3988
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c
@@ -0,0 +1,57 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MDA.c,v 3.4 1996/12/23 06:31:14 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: MDA.c /main/5 1996/02/21 17:10:32 kaleb $ */
+
+#include "Probe.h"
+
+/*
+ * Assume that the CRT Controller is at 0x3B4 (either no other adapter,
+ * or an EGA/CGA is installed in Color mode). Look for the cursor
+ * postition register.
+ */
+static Word Ports[] = {0x3B4, 0x3B5};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Bool Probe_MDA(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte tmp;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ tmp = rdinx(0x3B4, 0x0F);
+ if (testinx(0x3B4, 0x0F))
+ {
+ result = TRUE;
+ *Chipset = CHIP_MDA;
+ }
+ wrinx(0x3B4, 0x0F, tmp);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c
new file mode 100644
index 000000000..0c8b747ae
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c
@@ -0,0 +1,119 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MX.c,v 3.4 1996/12/23 06:31:15 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: MX.c /main/5 1996/02/21 17:10:36 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {SEQ_REG, SEQ_IDX};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_MX __STDCARGS((int));
+
+Chip_Descriptor MX_Descriptor = {
+ "MX",
+ Probe_MX,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_MX,
+};
+
+Bool Probe_MX(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(SEQ_IDX, 0xA7);
+ wrinx(SEQ_IDX, 0xA7, 0x00);
+ if (!testinx(SEQ_IDX, 0xC5))
+ {
+ wrinx(SEQ_IDX, 0xA7, 0x87);
+ if (testinx(SEQ_IDX, 0xC5))
+ {
+ result = TRUE;
+ if ((rdinx(SEQ_IDX, 0x26) & 0x01) == 0)
+ {
+ *Chipset = CHIP_MX68010;
+ }
+ else
+ {
+ *Chipset = CHIP_MX68000;
+ }
+ }
+ }
+ wrinx(SEQ_IDX, 0xA7, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_MX(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(SEQ_IDX, 0xA7);
+ wrinx(SEQ_IDX, 0xA7, 0x87);
+
+ /*
+ * Check
+ */
+ switch ((rdinx(SEQ_IDX, 0xC2) >> 2) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(SEQ_IDX, 0xA7, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c
new file mode 100644
index 000000000..a0815add7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c
@@ -0,0 +1,929 @@
+/* $XConsortium: Main.c /main/11 1996/10/25 11:33:16 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ * (c) Copyright 1994-1998 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holders shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * the copyright holders.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Main.c,v 3.28 1999/03/14 03:21:41 dawes Exp $ */
+
+#include "Probe.h"
+#include "PatchLevel.h"
+
+char MyName[20];
+Word vgaIOBase;
+Bool Verbose = FALSE;
+Long Chip_data = (Long)~0;
+Byte *Bios_Base = (Byte *)0;
+Bool NoBIOS = FALSE;
+Bool NoPCI = FALSE;
+Bool PCIProbed = FALSE;
+struct pci_config_reg *pcrp;
+
+static Bool No16Bits = FALSE;
+static Bool Exclusions = FALSE;
+static Bool Mask10 = FALSE;
+static Range *Excl_List = NULL;
+static char *NoProbe = (char *)0;
+
+static char *StdStuff = "MDA, Hercules, CGA, MCGA, EGA, VGA";
+
+static Chip_Descriptor *SVGA_Descriptors[] = {
+ &WD_Descriptor,
+ &Video7_Descriptor,
+ &MX_Descriptor,
+ &Genoa_Descriptor,
+ &UMC_Descriptor,
+ &Trident_Descriptor,
+ &SiS_Descriptor,
+ &Matrox_Descriptor,
+ &ATI_Descriptor,
+ &Ahead_Descriptor,
+ &NCR_Descriptor,
+ &S3_Descriptor,
+ &AL_Descriptor,
+ &Cirrus54_Descriptor,
+ &Cirrus64_Descriptor,
+ &Epson_Descriptor, /* is detected as Tseng (has 0x3cd as Segment too) */
+ &Tseng_Descriptor,
+ &RealTek_Descriptor,
+ &Rendition_Descriptor,
+ &Primus_Descriptor,
+ &Yamaha_Descriptor,
+ &Oak_Descriptor,
+ &Cirrus_Descriptor,
+ &Compaq_Descriptor,
+ &HMC_Descriptor,
+ &Weitek_Descriptor,
+ &ARK_Descriptor,
+ &Alliance_Descriptor,
+ &SigmaDesigns_Descriptor,
+ &Intergraphics_Descriptor,
+ &CT_Descriptor, /* I think this is screwing people up, so put it last */
+ NULL
+};
+
+static Chip_Descriptor *CoProc_Descriptors[] = {
+ &ATIMach_Descriptor,
+ &IBM8514_Descriptor, /* Make this the last 8514-type entry */
+ &I128_Descriptor,
+ &GLINT_Descriptor,
+ NULL
+};
+
+static int num_tokens __STDCARGS((char *, char));
+static void ParseExclusionList __STDCARGS((Range *, char *));
+static Bool TestChip __STDCARGS((Chip_Descriptor *, int *));
+static void PrintInfo __STDCARGS((void));
+static Byte *FindBios __STDCARGS((void));
+
+#ifdef __STDC__
+static int num_tokens(char *list, char delim)
+#else
+static int num_tokens(list, delim)
+char *list;
+char delim;
+#endif
+{
+ char *p = list;
+ int cnt = 1;
+
+ while ((p = strchr(p, delim)) != NULL)
+ {
+ p++;
+ cnt++;
+ }
+ return(cnt);
+}
+
+static void ParseExclusionList(excl_list, list)
+Range *excl_list;
+char *list;
+{
+ char *p = list, *p1, c;
+ Bool done = FALSE, lo = TRUE;
+ int i = 0;
+
+ while (!done)
+ {
+ p1 = strpbrk(p, "-,");
+ if (p1)
+ {
+ c = *p1;
+ *p1 = '\0';
+ if ((c == '-') && (p == p1))
+ {
+ fprintf(stderr, "%s: Unbounded range in exclusion\n", MyName);
+ exit(1);
+ }
+ else if (p == p1)
+ {
+ p++;
+ continue;
+ }
+ }
+ else
+ {
+ if ((!lo) && (p == p1))
+ {
+ fprintf(stderr, "%s: Unbounded range in exclusion\n", MyName);
+ exit(1);
+ }
+ done = TRUE;
+ }
+ if (lo)
+ {
+ excl_list[i].lo = (Word)StrToUL(p);
+ }
+ else
+ {
+ excl_list[i].hi = (Word)StrToUL(p);
+ }
+ if (!done)
+ {
+ if (c == '-')
+ {
+ lo = FALSE;
+ }
+ else
+ {
+ if (lo)
+ {
+ excl_list[i].hi = (Word)-1;
+ }
+ else
+ {
+ lo = TRUE;
+ }
+ i++;
+ }
+ p = p1 + 1;
+ }
+ else
+ {
+ if (lo)
+ {
+ excl_list[i].hi = (Word)-1;
+ }
+ i++;
+ }
+ }
+ excl_list[i].lo = (Word)-1;
+}
+
+static Bool TestChip(chip_p, Chipset)
+Chip_Descriptor *chip_p;
+int *Chipset;
+{
+ char *p, *p1, name[64];
+
+ if ((No16Bits) && (chip_p->bit16))
+ {
+ if (Verbose)
+ {
+ printf("\tSkipping %s (16-bit registers)...\n", chip_p->name);
+ fflush(stdout);
+ }
+ return(FALSE);
+ }
+ if ((NoBIOS) && (chip_p->uses_bios))
+ {
+ if (Verbose)
+ {
+ printf("\tSkipping %s (needs BIOS read)...\n", chip_p->name);
+ fflush(stdout);
+ }
+ return(FALSE);
+ }
+ if ((Exclusions) && (Excluded(Excl_List, chip_p, Mask10)))
+ {
+ if (Verbose)
+ {
+ printf("\tskipping %s (exclusion list)...\n", chip_p->name);
+ fflush(stdout);
+ }
+ return(FALSE);
+ }
+ if (NoProbe != (char *)0)
+ {
+ p1 = p = NoProbe;
+ while (p)
+ {
+ p1 = strchr(p1, ',');
+ if (p1 != NULL)
+ {
+ (void)strncpy(name, p, (p1-p) > sizeof(name) ? sizeof(name) : (p1-p));
+ name[sizeof(name)] = '\0';
+ p1++;
+ }
+ else
+ {
+ (void)strncpy(name, p, sizeof(name) - 1);
+ name[sizeof(name) - 1] = '\0';
+ }
+ if (StrCaseCmp(name, chip_p->name) == 0)
+ {
+ if (Verbose)
+ {
+ printf("\tskipping %s (noprobe list)...\n", chip_p->name);
+ fflush(stdout);
+ }
+ return(FALSE);
+ }
+ p = p1;
+ }
+ }
+ if (Verbose)
+ {
+ printf("\tProbing %s...\n", chip_p->name);
+ fflush(stdout);
+ }
+ if (chip_p->f(Chipset))
+ {
+ return(TRUE);
+ }
+ return(FALSE);
+}
+
+static void PrintInfo()
+{
+ Chip_Descriptor *chip_p;
+ int i, len;
+
+ PRINT_VERSION;
+ putchar('\n');
+ printf("%s can detect the following standard video hardware:\n", MyName);
+ printf("\t%s\n", StdStuff);
+ printf("%s can detect the following SVGA chipsets/vendors:\n", MyName);
+ len = 0;
+ putchar('\t');
+ for (i=0; SVGA_Descriptors[i] != NULL; i++)
+ {
+ chip_p = SVGA_Descriptors[i];
+ len += strlen(chip_p->name) + 2;
+ if (len > 70)
+ {
+ printf("\n\t");
+ len = strlen(chip_p->name) + 2;
+ }
+ printf("%s, ", chip_p->name);
+ }
+ putchar('\n');
+ printf("%s can detect the following graphics coprocessors/vendors:\n",
+ MyName);
+ len = 0;
+ putchar('\t');
+ for (i=0; CoProc_Descriptors[i] != NULL; i++)
+ {
+ chip_p = CoProc_Descriptors[i];
+ len += strlen(chip_p->name) + 2;
+ if (len > 70)
+ {
+ printf("\n\t");
+ len = strlen(chip_p->name) + 2;
+ }
+ printf("%s, ", chip_p->name);
+ }
+ putchar('\n');
+ printf("%s can detect the following RAMDACs:\n", MyName);
+ len = 0;
+ putchar('\t');
+ for (i=0; i < DAC_MAX; i++)
+ {
+ len += strlen(RamDac_Names[i+1].Short) + 2;
+ if (len > 70)
+ {
+ printf("\n\t");
+ len = strlen(RamDac_Names[i+1].Short) + 2;
+ }
+ printf("%s, ", RamDac_Names[i+1].Short);
+ }
+ putchar('\n');
+}
+
+static Byte *FindBios()
+{
+ int i, score[7];
+ Byte buf[3];
+ Byte *base = (Byte *)0;
+
+ for (i=0; i < 7; i++)
+ {
+ score[i] = 1;
+ }
+ for (i=0; i < 7; i++)
+ {
+ buf[0] = buf[1] = buf[2] = (Byte)0;
+ if (ReadBIOS((unsigned)(0xC0000+(i<<15)), buf, 3) != 3)
+ {
+ score[i] = 0;
+ }
+ else if ((buf[0] != 0x55) || (buf[1] != 0xAA) || (buf[2] < 48))
+ {
+ score[i] = 0;
+ }
+ }
+ for (i=6; i >= 0; i--)
+ {
+ if (score[i] != 0)
+ {
+ base = (Byte *)(0xC0000+(i<<15));
+ }
+ }
+ return(base);
+}
+
+int main(argc, argv)
+int argc;
+char *argv[];
+{
+ char *p, *order = NULL;
+ Byte copyright[5];
+ Word Ports[10]; /* For whatever we need */
+ int Primary = -1;
+ int Secondary = -1;
+ int RamDac = -1;
+ int CoProc = -1;
+ int MemVGA = -1;
+ int MemCoProc = -1;
+ int i, cnt;
+ Chip_Descriptor *chip_p, *matched;
+ Bool Probe_DAC = TRUE;
+ Bool Probe_Mem = TRUE;
+ Bool NoEGA = FALSE;
+ Bool PCIVGA = FALSE;
+ Bool Check_CoProc;
+ Bool flag;
+
+ p = strrchr(argv[0], '/');
+ if (p == NULL)
+ p = argv[0];
+ else
+ p++;
+ (void)strncpy(MyName, p, sizeof(MyName) - 1);
+ MyName[sizeof(MyName)-1] = '\0';
+
+ for (i=1; i < argc; i++)
+ {
+ if (strncmp(argv[i], "-v", 2) == 0)
+ {
+ Verbose = TRUE;
+ continue;
+ }
+ else if (strncmp(argv[i], "-no16", 5) == 0)
+ {
+ No16Bits = TRUE;
+ continue;
+ }
+ else if ((strncmp(argv[i], "-excl", 5) == 0) ||
+ (strncmp(argv[i], "-x", 2) == 0))
+ {
+ if (Excl_List != NULL)
+ {
+ fprintf(stderr,
+ "%s: Warning - only one exclusion list allowed. ",
+ MyName);
+ fprintf(stderr, " The last one will be used\n");
+ }
+ i++;
+ if (i == argc)
+ {
+ fprintf(stderr, "%s: Exclusion list not specified\n", MyName);
+ return(1);
+ }
+ cnt = num_tokens(argv[i], ',');
+ Excl_List = (Range *)calloc(cnt+1, sizeof(Range));
+ ParseExclusionList(Excl_List, argv[i]);
+ Exclusions = TRUE;
+ continue;
+ }
+ else if ((strncmp(argv[i], "-mask10", 7) == 0) ||
+ (strncmp(argv[i], "-msk10", 6) == 0) ||
+ (strncmp(argv[i], "-10", 3) == 0))
+ {
+ Mask10 = TRUE;
+ }
+ else if (strncmp(argv[i], "-o", 2) == 0)
+ {
+ if (order != NULL)
+ {
+ fprintf(stderr,
+ "%s: Warning - only one order list allowed. ",
+ MyName);
+ fprintf(stderr, " The last one will be used\n");
+ }
+ i++;
+ if (i == argc)
+ {
+ fprintf(stderr, "%s: Order list not specified\n", MyName);
+ return(1);
+ }
+ order = argv[i];
+ }
+ else if (strncmp(argv[i], "-nopr", 5) == 0)
+ {
+ if (NoProbe != NULL)
+ {
+ fprintf(stderr,
+ "%s: Warning - only one noprobe list allowed. ",
+ MyName);
+ fprintf(stderr, " The last one will be used\n");
+ }
+ i++;
+ if (i == argc)
+ {
+ fprintf(stderr, "%s: noprobe list not specified\n", MyName);
+ return(1);
+ }
+ NoProbe = argv[i];
+ }
+ else if (strncmp(argv[i], "-bios", 5) == 0)
+ {
+ i++;
+ if (i == argc)
+ {
+ fprintf(stderr, "%s: BIOS base address not specified\n",
+ MyName);
+ return(1);
+ }
+ Bios_Base = (Byte *)StrToUL(argv[i]);
+ }
+ else if (strncmp(argv[i], "-no_pci", 7) == 0)
+ {
+ NoPCI = TRUE;
+ }
+ else if (strncmp(argv[i], "-no_bios", 8) == 0)
+ {
+ NoBIOS = TRUE;
+ }
+ else if (strncmp(argv[i], "-no_dac", 7) == 0)
+ {
+ Probe_DAC = FALSE;
+ }
+ else if (strncmp(argv[i], "-no_mem", 7) == 0)
+ {
+ Probe_Mem = FALSE;
+ }
+ else if (strncmp(argv[i], "-in", 3) == 0)
+ {
+ PrintInfo();
+ return(0);
+ }
+ else if ((strncmp(argv[i], "-?", 2) == 0) ||
+ (strncmp(argv[i], "-h", 2) == 0))
+ {
+ PRINT_VERSION;
+ printf("\n%s accepts the following options:\n", MyName);
+ printf("\t-verbose\tGive lots of information\n");
+ printf("\t-no16\t\tSkip any test that requires 16-bit ports\n");
+ printf("\t-excl list\tSkip any test that requires port on list\n");
+ printf("\t-mask10\t\tMask registers to 10 bits before comparing\n");
+ printf("\t\t\twith the exclusion list\n");
+ printf("\t-order list\tPerform test on the specified chipsets\n");
+ printf("\t\t\tin the specified order\n");
+ printf("\t-noprobe list\tDon't probe for any chipsets specified\n");
+ printf("\t-bios base\tSet BIOS base address to 'base'\n");
+ printf("\t-no_bios\tDon't read BIOS & assume EGA/VGA as primary\n");
+ printf("\t-no_dac\t\tDon't probe for RAMDAC type\n");
+ printf("\t-no_mem\t\tDon't probe for video memory\n");
+ printf("\t-no_pci\t\tDon't probe the PCI bus\n");
+ printf("\t-info\t\tPrint a list of the capabilities of %s\n",
+ MyName);
+ printf("\nRefer to the manual page '%s.1' for complete details\n",
+ MyName);
+ return(0);
+ }
+ else
+ {
+ fprintf(stderr, "%s: Unknown option '%s'\n", MyName, argv[i]);
+ return(1);
+ }
+ }
+
+ PRINT_VERSION;
+ printf("\t(c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>\n");
+ printf("\t(c) Copyright 1994-1998 by The XFree86 Project, Inc\n");
+ printf("\n\tThis work is derived from the 'vgadoc2.zip' and\n");
+ printf("\t'vgadoc3.zip' documentation packages produced by Finn\n");
+ printf("\tThoegersen, and released with all appropriate permissions\n");
+ printf("\thaving been obtained. Additional information obtained from\n");
+ printf("\t'Programmer's Guide to the EGA and VGA, 2nd ed', by Richard\n");
+ printf("\tFerraro, and from manufacturer's data books\n\n");
+ printf("Bug reports are welcome, and should be sent to "
+ "XFree86@XFree86.org.\n");
+ printf("In particular, reports of chipsets that this program fails to\n");
+ printf("correctly detect are appreciated.\n\n");
+ printf("Before submitting a report, please make sure that you have the\n");
+ printf("latest version of SuperProbe (see http://www.xfree86.org/FAQ).\n\n");
+{
+ FILE *f;
+
+ f = fopen("/dev/tty", "w");
+#ifdef __EMX__
+ /* note: don't remove the fopen above ! */
+ fclose(f);
+ f = stderr; /* OS/2 does not know /dev/tty, OTOH you cannot run this
+ * program in a window.
+ */
+#endif
+ if (f != (FILE *)NULL)
+ {
+#if !defined(DGUX) /* It crashes SuperProbe in DG/ux */
+ putc('\007', f);
+ putc('\007', f);
+ putc('\007', f);
+#endif
+ fprintf(f, "WARNING - THIS SOFTWARE COULD HANG YOUR MACHINE.\n");
+ fprintf(f, " READ THE SuperProbe.1 MANUAL PAGE BEFORE\n");
+ fprintf(f, " RUNNING THIS PROGRAM.\n\n");
+ fprintf(f, " INTERRUPT WITHIN FIVE SECONDS TO ABORT!\n\n");
+#if !defined(DGUX) /* It crashes SuperProbe in DG/ux */
+ putc('\007', f);
+ putc('\007', f);
+ putc('\007', f);
+#endif
+ fflush(f);
+ sleep(5);
+ }
+}
+
+ if (OpenVideo() < 0)
+ {
+ fprintf(stderr, "%s: Cannot open video\n", MyName);
+ return(-1);
+ }
+
+ if (!NoBIOS)
+ {
+ if (Bios_Base == (Byte *)0)
+ {
+ Bios_Base = FindBios();
+ if (Bios_Base == (Byte *)0)
+ {
+ if (Verbose)
+ {
+ printf("%s: Could not determine BIOS base address; %s",
+ MyName, " assuming no EGA/VGA present\n");
+ fflush(stdout);
+ }
+ NoEGA = TRUE;
+ }
+ }
+ }
+ if (Verbose)
+ {
+ if (NoBIOS)
+ {
+ printf("Assuming an EGA/VGA is present\n\n");
+ }
+ else
+ {
+ printf("BIOS Base address = 0x%X\n\n", (int)Bios_Base);
+ }
+ fflush(stdout);
+ }
+
+ if (!NoPCI)
+ {
+ xf86scanpci();
+
+ /* Now scan for VGA compatible cards in the PCI config space.
+ * This will avoid that the BIOS checking fails to detect a VGA,
+ * making SuperProbe report "MCGA =" ... [kmg]
+ */
+ i=0;
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if ((pcrp->_base_class == PCI_CLASS_PREHISTORIC &&
+ pcrp->_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) ||
+ (pcrp->_base_class == PCI_CLASS_DISPLAY &&
+ pcrp->_sub_class == PCI_SUBCLASS_DISPLAY_VGA))
+ {
+ PCIVGA = TRUE;
+ }
+ i++;
+ }
+ }
+
+ if ((!NoBIOS) && (!NoEGA))
+ {
+ /*
+ * Look for 'IBM' at Bios_Base+0x1E of the BIOS. It will be there for
+ * an EGA or VGA.
+ */
+ if (ReadBIOS(COPYRIGHT_BASE, copyright, 5) < 0)
+ {
+ fprintf(stderr, "%s: Failed to read BIOS\n", MyName);
+ CloseVideo();
+ return(1);
+ }
+ }
+ if (PCIVGA ||
+ ((!NoEGA) &&
+ ((NoBIOS) ||
+ ((copyright[0] == 'I') &&
+ (copyright[1] == 'B') &&
+ (copyright[2] == 'M')) ||
+ ((copyright[2] == 'P') &&
+ (copyright[3] == 'C') &&
+ (copyright[4] == 'I')))))
+ {
+ /*
+ * It's an EGA or VGA
+ */
+ Ports[0] = 0x3CC;
+ EnableIOPorts(1, Ports);
+ vgaIOBase = (inp(0x3CC) & 0x01) ? 0x3D0 : 0x3B0;
+ DisableIOPorts(1, Ports);
+ if (vgaIOBase == 0x3D0)
+ {
+ /*
+ * Color - probe for secondary mono.
+ */
+ if (Probe_MDA(&Secondary))
+ {
+ (void)Probe_Herc(&Secondary);
+ }
+ }
+ else
+ {
+ /*
+ * Mono - probe for secondary color.
+ */
+ (void)Probe_CGA(&Secondary);
+ }
+
+ if (!Probe_VGA(&Primary))
+ Primary = CHIP_EGA;
+
+ /*
+ * Do SVGA probing, even if no VGA is detected. Some SVGA can emulate
+ * pre-VGA adapters (such as EGA) and be left in such a state by BIOS
+ * initialization.
+ */
+ if (Verbose)
+ {
+ printf("Doing Super-VGA Probes...\n");
+ fflush(stdout);
+ }
+ matched = &VGA_Descriptor;
+
+ if (order == NULL)
+ {
+ /*
+ * Use default ordering.
+ */
+ for (i=0; SVGA_Descriptors[i] != NULL; i++)
+ {
+ chip_p = SVGA_Descriptors[i];
+ if (TestChip(chip_p, &Primary))
+ {
+ matched = chip_p;
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Use user specified order
+ */
+ p = order;
+ while (p)
+ {
+ order = strchr(order, ',');
+ if (order != NULL)
+ {
+ *order = '\0';
+ order++;
+ }
+ flag = FALSE;
+ for (i=0; SVGA_Descriptors[i] != NULL; i++)
+ {
+ chip_p = SVGA_Descriptors[i];
+ if (StrCaseCmp(p, chip_p->name) == 0)
+ {
+ flag = TRUE;
+ break;
+ }
+ }
+ if (flag)
+ {
+ if (TestChip(chip_p, &Primary))
+ {
+ matched = chip_p;
+ break;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "%s: Chip class '%s' not known\n",
+ MyName, p);
+ }
+ p = order;
+ }
+ }
+
+ Check_CoProc = matched->check_coproc;
+
+ if (Probe_Mem)
+ {
+ if (matched->memcheck != (MemCheckFunc)NULL)
+ {
+ MemVGA = (*matched->memcheck)(Primary);
+ }
+ else if (Verbose)
+ {
+ printf("Memory probe not supported for this chipset.\n");
+ fflush(stdout);
+ }
+ }
+ else if (Verbose)
+ {
+ printf("Skipping memory probe\n");
+ fflush(stdout);
+ }
+
+ /*
+ * If this chipset doesn't exclude probing for a coprocessor,
+ * then look for one.
+ */
+ if (Check_CoProc)
+ {
+ if (Verbose)
+ {
+ printf("\nDoing Graphics CoProcessor Probes...\n");
+ fflush(stdout);
+ }
+ for (i=0; CoProc_Descriptors[i] != NULL; i++)
+ {
+ chip_p = CoProc_Descriptors[i];
+ if (TestChip(chip_p, &CoProc))
+ {
+ matched = chip_p;
+ break;
+ }
+ }
+ if (CoProc_Descriptors[i] != NULL)
+ {
+ if (Probe_Mem)
+ {
+ if (matched->memcheck != (MemCheckFunc)NULL)
+ {
+ MemCoProc = (*matched->memcheck)(CoProc);
+ }
+ else if (Verbose)
+ {
+ printf("Memory probe not supported ");
+ printf("for this chipset.\n");
+ fflush(stdout);
+ }
+ }
+ else if (Verbose)
+ {
+ printf("Skipping memory probe\n");
+ fflush(stdout);
+ }
+ }
+ }
+ }
+ else if (Probe_MDA(&Primary))
+ {
+ (void)Probe_Herc(&Primary);
+ (void)Probe_CGA(&Secondary);
+ }
+ else if (Probe_CGA(&Primary))
+ {
+ if (Probe_MDA(&Secondary))
+ {
+ (void)Probe_Herc(&Secondary);
+ }
+ }
+
+ putchar('\n');
+ if (Primary == -1)
+ {
+ printf("Could not identify any video\n");
+ }
+ else
+ {
+ printf("First video: ");
+ if (IS_MDA(Primary))
+ {
+ printf("MDA\n");
+ }
+ else if (IS_HERC(Primary))
+ {
+ printf("Hercules\n");
+ Print_Herc_Name(Primary);
+ }
+ else if (IS_CGA(Primary))
+ {
+ printf("CGA\n");
+ }
+ else if (IS_MCGA(Primary))
+ {
+ printf("MCGA\n");
+ }
+ else if (IS_EGA(Primary))
+ {
+ printf("EGA\n");
+ }
+ else if (IS_VGA(Primary))
+ {
+ printf("Generic VGA (or unknown SVGA)\n");
+ }
+ else if (IS_SVGA(Primary))
+ {
+ printf("Super-VGA\n");
+ Print_SVGA_Name(Primary);
+ if (MemVGA > -1)
+ {
+ if (MemVGA >> 16)
+ {
+ printf("\tMemory: %d Kbytes (plus %d Kbytes off-screen)\n",
+ MemVGA & 0xffff, MemVGA >> 16);
+ }
+ else
+ printf("\tMemory: %d Kbytes\n", MemVGA);
+ }
+ if (Probe_DAC)
+ {
+ Probe_RamDac(Primary, &RamDac);
+ Print_RamDac_Name(RamDac);
+ }
+ else if (Verbose)
+ {
+ printf("Skipping RAMDAC probe\n");
+ }
+ }
+ if (CoProc != -1)
+ {
+ printf("\tAttached graphics coprocessor:\n");
+ Print_CoProc_Name(CoProc);
+ if (MemCoProc > -1)
+ {
+ if (MemCoProc > 0x00010000)
+ {
+ /*
+ * for some copros we store the local buffer in
+ * the high order 16bits
+ */
+
+ printf("\t\tMemory: %d Kbytes Framebuffer, %d Kbytes Localbuffer\n",
+ MemCoProc & 0xffff, (MemCoProc & 0xffff0000)>>16);
+ }
+ else
+ {
+ printf("\t\tMemory: %d Kbytes\n", MemCoProc);
+ }
+ }
+ }
+ }
+ if (Secondary != -1)
+ {
+ printf("Second video: ");
+ if (IS_MDA(Secondary))
+ {
+ printf("MDA\n");
+ }
+ else if (IS_HERC(Secondary))
+ {
+ printf("Hercules\n");
+ Print_Herc_Name(Secondary);
+ }
+ else if (IS_CGA(Secondary))
+ {
+ printf("CGA\n");
+ }
+ else if (IS_MCGA(Secondary))
+ {
+ printf("MCGA\n");
+ }
+ }
+
+ CloseVideo();
+ return(0);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std b/xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std
new file mode 100644
index 000000000..8011bf9d6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std
@@ -0,0 +1,160 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Makefile.std,v 3.15 1999/03/14 03:21:42 dawes Exp $
+
+
+
+
+
+# $XConsortium: Makefile.std /main/8 1996/10/27 11:04:00 kaleb $
+#
+# Installation parameters
+#
+BINDIR = /usr/local/bin
+MANDIR = /usr/share/man/man1
+OWNER = root
+GROUP = bin
+MODE = 4755
+
+#
+# OS-specific library
+#
+# SVR3 & SVR4
+#OS_DEF = -DSYSV
+#OS_DEF = -DSYSV -DSCO
+#OS_DEF = -DSYSV -DESIX
+#OS_DEF = -DSVR4 -Dsun
+OS_DEF = -DSYSV -DSVR4
+OS_SRC = OS_SYSV.c
+OS_OBJ = OS_SYSV.o
+# For Solarix x86 with ProWorks compiler only
+#IO_SRC = SolX86IO.s
+#IO_OBJ = SolX86IO.o
+# Linux
+#OS_DEF = -Dlinux -DGCCUSESGAS
+#OS_SRC = OS_Linux.c
+#OS_OBJ = OS_Linux.o
+# 386BSD
+#OS_DEF = -DCSRG_BASED -D__386BSD__ -DGCCUSESGAS $(CONS_DEF)
+#OS_SRC = OS_386BSD.c
+#OS_OBJ = OS_386BSD.o
+#CONS_DEF = -DPCCONS_SUPPORT
+# NetBSD
+#OS_DEF = -DCSRG_BASED -D__NetBSD__ -DGCCUSESGAS $(CONS_DEF)
+#OS_SRC = OS_386BSD.c
+#OS_OBJ = OS_386BSD.o
+#CONS_DEF = -DPCCONS_SUPPORT -DPCVT_SUPPORT
+# OpenBSD
+#OS_DEF = -DCSRG_BASED -D__OpenBSD__ -DGCCUSESGAS $(CONS_DEF)
+#OS_SRC = OS_386BSD.c
+#OS_OBJ = OS_386BSD.o
+#CONS_DEF = -DPCCONS_SUPPORT -DPCVT_SUPPORT
+# FreeBSD
+#OS_DEF = -DCSRG_BASED -D__FreeBSD__ -DGCCUSESGAS $(CONS_DEF)
+#OS_SRC = OS_386BSD.c
+#OS_OBJ = OS_386BSD.o
+#CONS_DEF = -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT
+# BSD/386
+#OS_DEF = -DCSRG_BASED -D__bsdi__ -DGCCUSESGAS
+#OS_SRC = OS_386BSD.c
+#OS_OBJ = OS_386BSD.o
+# Minix
+#OS_DEF = -D_MINIX -D_POSIX_SOURCE
+#OS_SRC = OS_Minix.c
+#OS_OBJ = OS_Minix.o
+# Mach (BSD Tree)
+#OS_DEF = -DMACH386 -DGCCUSESGAS -I/usr/mach/include -I/usr/include
+#OS_SRC = OS_Mach.c
+#OS_OBJ = OS_Mach.o
+#OS_LIB = /usr/lib/libmach.a
+# Mach
+#OS_DEF = -DMACH386 -DGCCUSESGAS
+#OS_SRC = OS_Mach.c
+#OS_OBJ = OS_Mach.o
+#OS_LIB = /usr/misc/.mach/lib/libmach.a
+# OS/2 with EMX
+#OS_DEF = -D__EMX__ -DGCCUSESGAS
+#OS_SRC = OS_Os2.c
+#OS_OBJ = OS_Os2.o
+#OS_LIB = -lemxio
+# LynxOS
+#OS_DEF =
+#OS_SRC = OS_LynxOS.c
+#OS_OBJ = OS_LynxOS.o
+
+HDRS = Probe.h
+BASE_SRC = MDA.c Herc.c CGA.c VGA.c RamDac.c MemProbe.c PCI.c
+BASE_OBJ = MDA.o Herc.o CGA.o VGA.o RamDac.o MemProbe.o PCI.o
+SVGA_SRC = Tseng.c WD.c ChipsTech.c Video7.c Genoa.c Trident.c Oak.c \
+ Cirrus.c Ahead.c ATI.c S3.c AL.c Yamaha.c NCR.c MX.c \
+ RealTek.c Primus.c Compaq.c HMC.c UMC.c Weitek.c SiS.c \
+ ARK.c Alliance.c Matrox.c SigmaDesigns.c Intergraphics.c \
+ Epson.c Rendition.c
+SVGA_OBJ = Tseng.o WD.o ChipsTech.o Video7.o Genoa.o Trident.o Oak.o \
+ Cirrus.o Ahead.o ATI.o S3.o AL.o Yamaha.o NCR.o MX.o \
+ RealTek.o Primus.o Compaq.o HMC.o UMC.o Weitek.o SiS.o \
+ ARK.o Alliance.o Matrox.o SigmaDesigns.o Intergraphics.o \
+ Epson.o Rendition.o
+COPROC_SRC = 8514.c ATIMach.c I128.c GLINT.c
+COPROC_OBJ = 8514.o ATIMach.o I128.o GLINT.o
+SRCS = Main.c $(SVGA_SRC) $(COPROC_SRC) $(BASE_SRC) Print.c \
+ Utils.c $(OS_SRC) $(IO_SRC)
+OBJS = Main.o $(SVGA_OBJ) $(COPROC_OBJ) $(BASE_OBJ) Print.o \
+ Utils.o $(OS_OBJ) $(IO_OBJ)
+LIBS = $(OS_LIB)
+
+
+#PROG = SuperProbe.exe # OS/2
+PROG = SuperProbe
+
+# Options for gcc
+CC = gcc
+CCOPTS = -m486 -ansi -pedantic
+DEBUG_OR_OPT = -g -Wall
+#DEBUG_OR_OPT = -O2
+
+# Options for ProWorks compiler on Solaris 2.x
+#PROWORKSHOME = /opt/SUNWspro
+#CC = $(PROWORKSHOME)/bin/cc
+#AS = /usr/ccs/bin/as
+#CCOPTS = -Xa
+#DEBUG_OR_OPT = -g
+#DEBUG_OR_OPT = -O
+
+# Options for OS/2
+#CC= gcc
+#CCOPTS = -m486
+#LDFLAGS = -Zexe
+
+
+CFLAGS = $(CCOPTS) $(DEBUG_OR_OPT) $(OS_DEF)
+
+#
+# Assemblier -> object format rule (Solaris x86 ProWorks compiler only)
+# NOTE: AS must be defined to the assemblier to be used. Currently only
+# the default assemblier supplied with Solaris/ProWorks is supported
+#
+.s.o:
+ $(RM) $@
+ $(AS) -o $*.o $*.s
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
+
+$(OBJS): $(HDRS)
+Utils.o: AsmMacros.h
+Main.o: PatchLevel.h
+
+clean:
+ rm -f $(OBJS)
+
+clobber: clean
+ rm -f $(PROG)
+
+install: $(PROG)
+ rm -f $(BINDIR)/$(PROG)
+ cp $(PROG) $(BINDIR)
+ chown $(OWNER) $(BINDIR)/$(PROG)
+ chgrp $(GROUP) $(BINDIR)/$(PROG)
+ chmod $(MODE) $(BINDIR)/$(PROG)
+ cp $(PROG).1 $(MANDIR)/$(PROG).1
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c
new file mode 100644
index 000000000..310e796bc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c
@@ -0,0 +1,118 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Matrox.c,v 3.4 1999/03/14 03:21:42 dawes Exp $ */
+/*
+ * (c) Copyright 1997 Alan Hourihane <alanh@fairlite.demon.co.uk>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * ALAN HOURIHANE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Alan Hourihane shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Alan Hourihane.
+ *
+ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Matrox __STDCARGS((int));
+
+Chip_Descriptor Matrox_Descriptor = {
+ "Matrox",
+ Probe_Matrox,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+#if 0
+ MemProbe_Matrox,
+#else
+ NULL,
+#endif
+};
+
+Bool Probe_Matrox(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte chip, old, old1, val;
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_MATROX)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_MGA1064SG:
+ *Chipset = CHIP_MGA1064SG;
+ break;
+ case PCI_CHIP_MGA2064W:
+ *Chipset = CHIP_MGA2064W;
+ break;
+ case PCI_CHIP_MGA2164W:
+ *Chipset = CHIP_MGA2164W;
+ break;
+ case PCI_CHIP_MGA2085PX:
+ *Chipset = CHIP_MGA2085PX;
+ break;
+ case PCI_CHIP_MGA2164W_AGP:
+ *Chipset = CHIP_MGA2164WAGP;
+ break;
+ case PCI_CHIP_MGAG100_PCI:
+ *Chipset = CHIP_MGAG100PCI;
+ break;
+ case PCI_CHIP_MGAG100_AGP:
+ *Chipset = CHIP_MGAG100AGP;
+ break;
+ case PCI_CHIP_MGAG200_PCI:
+ *Chipset = CHIP_MGAG200PCI;
+ break;
+ case PCI_CHIP_MGAG200_AGP:
+ *Chipset = CHIP_MGAG200AGP;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_MATROX_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ return(FALSE);
+}
+
+static int MemProbe_Matrox(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ Mem = 2048;
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c
new file mode 100644
index 000000000..1ab1e97ae
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c
@@ -0,0 +1,152 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/MemProbe.c,v 3.4 1996/12/23 06:31:18 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: MemProbe.c /main/5 1996/02/21 17:10:50 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {SEQ_IDX, SEQ_REG, GRC_IDX, GRC_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Ports[0]))
+
+#define SAVESIZE 100
+#define BYTE_AT(s,i,j) (*((s)+((i)*SAVESIZE)+(j)))
+#define TAG "SuperProbe"
+
+int Probe_Mem(Check)
+MemCheck_Descriptor Check;
+{
+ Byte Save256;
+ Byte SaveMap;
+ Byte SaveSeq;
+ Byte SaveMask;
+ Byte *Mem;
+ Byte *Store;
+ int BankNum;
+ register int i, j;
+ Bool IsMem = TRUE;
+ int SaveRBank;
+ int SaveWBank;
+ int Total;
+
+ Store = (Byte *)malloc((Check.max_bank+1)*SAVESIZE);
+ if (Store == (Byte *)0)
+ {
+ return(0);
+ }
+ Mem = MapVGA();
+ if (Mem == (Byte *)0)
+ {
+ return(0);
+ }
+ EnableIOPorts(NUMPORTS, Ports);
+ Save256 = rdinx(GRC_IDX, 0x05);
+ SaveMap = rdinx(GRC_IDX, 0x06);
+ SaveMask = rdinx(SEQ_IDX, 0x02);
+ SaveSeq = rdinx(SEQ_IDX, 0x04);
+ wrinx(GRC_IDX, 0x05, ((Save256 & 0x0F) | 0x40));
+ wrinx(GRC_IDX, 0x06, (SaveMap & 0xF0) | 0x05);
+ wrinx(SEQ_IDX, 0x02, (SaveMask & 0xF0) | 0x0F);
+ wrinx(SEQ_IDX, 0x04, (SaveSeq | 0x0E));
+ Check.get_bank(Check.chipset, &SaveRBank, &SaveWBank);
+ for (BankNum = 0; ((BankNum <= Check.max_bank) && (IsMem)); BankNum++)
+ {
+ Check.set_bank(Check.chipset, BankNum, BankNum);
+ /*
+ * See if this bank is tagged.
+ */
+ if (strncmp((char *)Mem, TAG, strlen(TAG)) == 0)
+ {
+ break;
+ }
+ for (i=0; i < SAVESIZE; i++)
+ {
+ BYTE_AT(Store,BankNum,i) = Mem[i];
+ Mem[i] ^= 0xAA;
+ }
+ IsMem = TRUE;
+ for (i=0; i < SAVESIZE; i++)
+ {
+ if (Mem[i] != (BYTE_AT(Store,BankNum,i) ^ 0xAA))
+ {
+ IsMem = FALSE;
+ break;
+ }
+ }
+ for (i = 0; i < SAVESIZE; i++)
+ {
+ Mem[i] = BYTE_AT(Store,BankNum,i);
+ }
+ if (IsMem)
+ {
+ for (i=0; i < SAVESIZE; i++)
+ {
+ Mem[i] ^= 0x55;
+ }
+ IsMem = TRUE;
+ for (i=0; i < SAVESIZE; i++)
+ {
+ if (Mem[i] != (BYTE_AT(Store,BankNum,i) ^ 0x55))
+ {
+ IsMem = FALSE;
+ break;
+ }
+ }
+ for (i = 0; i < SAVESIZE; i++)
+ {
+ Mem[i] = BYTE_AT(Store,BankNum,i);
+ }
+ }
+ if (IsMem)
+ {
+ /*
+ * Tag this bank
+ */
+ strcpy((char *)Mem, TAG);
+ }
+ }
+ Total = (BankNum * Check.bank_size) / 1024;
+
+ for (j=0; j < BankNum; j++)
+ {
+ Check.set_bank(Check.chipset, j, j);
+ for (i=0; i < SAVESIZE; i++)
+ {
+ Mem[i] = BYTE_AT(Store,j,i);
+ }
+ }
+
+ Check.set_bank(Check.chipset, SaveRBank, SaveWBank);
+ wrinx(SEQ_IDX, 0x04, SaveSeq);
+ wrinx(SEQ_IDX, 0x02, SaveMask);
+ wrinx(GRC_IDX, 0x06, SaveMap);
+ wrinx(GRC_IDX, 0x05, Save256);
+ DisableIOPorts(NUMPORTS, Ports);
+ UnMapVGA(Mem);
+
+ return(Total);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c
new file mode 100644
index 000000000..333c6bcc7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c
@@ -0,0 +1,101 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/NCR.c,v 3.5 1996/12/23 06:31:19 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: NCR.c /main/6 1996/10/24 07:09:54 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor NCR_Descriptor = {
+ "NCR",
+ Probe_NCR,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_NCR(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, tmp;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (testinx2(SEQ_IDX, 0x05, 0x05))
+ {
+ old = rdinx(SEQ_IDX, 0x05);
+ wrinx(SEQ_IDX, 0x05, 0x00);
+ if (!testinx2(SEQ_IDX, 0x10, 0xFF))
+ {
+ wrinx(SEQ_IDX, 0x05, 0x01);
+ if (testinx2(SEQ_IDX, 0x10, 0xFF))
+ {
+ result = TRUE;
+ tmp = rdinx(SEQ_IDX, 0x08) >> 4;
+ if (tmp == 0)
+ {
+ *Chipset = CHIP_NCR77C22;
+ }
+ else if (tmp == 1)
+ {
+ *Chipset = CHIP_NCR77C21;
+ }
+ else if (tmp == 2)
+ {
+ if ((rdinx(SEQ_IDX, 0x08) & 0x0F) >= 8)
+ {
+ *Chipset = CHIP_NCR77C22EP;
+ }
+ else
+ {
+ *Chipset = CHIP_NCR77C22E;
+ }
+ }
+ else if (tmp == 3)
+ {
+ *Chipset = CHIP_NCR77C32B;
+ }
+ else
+ {
+ Chip_data = tmp;
+ *Chipset = CHIP_NCR_UNK;
+ }
+ }
+ }
+ wrinx(SEQ_IDX, 0x05, old);
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c
new file mode 100644
index 000000000..81583b905
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c
@@ -0,0 +1,488 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.16 1999/08/01 07:57:06 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Dawes <dawes@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID DAWES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Dawes shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Dawes.
+ *
+ */
+
+/*
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these conditions,
+ * you may download, copy, install, use, modify and distribute this software in
+ * source and/or binary form. No title or ownership is transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain this
+ * copyright notice and list of conditions as they appear in the source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation" name nor
+ * any trademark or logo of Digital Equipment Corporation may be used to endorse or
+ * promote products derived from this software without the prior written permission
+ * of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties, including
+ * but not limited to, any implied warranties of merchantability, fitness for a
+ * particular purpose, or non-infringement are disclaimed. In no event shall DIGITAL
+ * be liable for any damages whatsoever, and in particular, DIGITAL shall not be
+ * liable for special, indirect, consequential, or incidental damages or damages for
+ * lost profits, loss of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even if advised of
+ * the possibility of such damage.
+ *
+ */
+
+/* $XConsortium: OS_386BSD.c /main/11 1996/10/27 11:04:03 kaleb $ */
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <sys/mman.h>
+
+#ifdef __bsdi__
+# include <i386/isa/pcconsioctl.h>
+# define CONSOLE_X_MODE_ON PCCONIOCRAW
+# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
+#else
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# ifdef CODRV_SUPPORT
+ /* This header is part of codrv */
+# include <machine/ioctl_pc.h>
+# endif
+# if defined(PCVT_SUPPORT) && !defined(SYSCONS_SUPPORT)
+# include <machine/pcvt_ioctl.h>
+# endif
+# ifdef SYSCONS_SUPPORT
+ /* both, Free and NetBSD have syscons */
+# include <machine/console.h>
+# endif
+# else
+# ifdef CODRV_SUPPORT
+ /* This header is part of codrv */
+# include <sys/ioctl_pc.h>
+# endif
+# endif
+# undef CONSOLE_X_MODE_ON
+# define CONSOLE_X_MODE_ON _IO('t',121)
+# undef CONSOLE_X_MODE_OFF
+# define CONSOLE_X_MODE_OFF _IO('t',122)
+#endif
+#if defined(__NetBSD__) && !defined(MAP_FILE)
+#define MAP_FILE 0
+#endif
+
+#if defined(__NetBSD__) && !defined(__OpenBSD__)
+# include <sys/param.h>
+# ifdef NetBSD1_1
+# include <machine/sysarch.h>
+# endif
+#endif
+
+#if defined(__OpenBSD__)
+# include <machine/sysarch.h>
+#endif
+
+#if !defined(__OpenBSD__)
+# define CONSOLE_DEVICE "/dev/ttyv0"
+#else
+# define CONSOLE_DEVICE "/dev/ttyC0"
+#endif
+
+#ifdef __NetBSD__
+/* Temporary while we don't have a wscons driver for XFree86. */
+# define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
+#endif
+
+#ifdef USE_ARM32_MMAP
+#define DEV_MEM_IOBASE 0x43000000
+extern unsigned int IOPortBase;
+static int DEVMEM_fd = -1;
+#endif
+
+static int CONS_fd = -1;
+static int BIOS_fd = -1;
+
+static Bool HasCodrv = FALSE;
+static Bool HasUslVt = FALSE;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For 386BSD, we disable
+ * IO protection, since this is currently the only way to access any
+ * IO registers.
+ */
+int OpenVideo()
+{
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root\n",
+ MyName);
+ return(-1);
+ }
+ /*
+ * Attempt to open /dev/kbd. If this fails, the driver is either
+ * pccons, or it is codrv and something else has it open. errno
+ * will tell us which case it is.
+ */
+ if ((CONS_fd = open("/dev/kbd", O_RDONLY|O_NDELAY, 0)) < 0)
+ {
+ if (errno == EBUSY)
+ {
+ /*
+ * Codrv, but something else is using the console
+ * in "X" mode
+ */
+ fprintf(stderr,
+ "%s: Cannot be run while an X server is running\n",
+ MyName);
+ return(-1);
+ }
+#ifndef __bsdi__
+ /*
+ * pccons. To guess if we're being run from within an
+ * X session, check $DISPLAY, and fail if it is set.
+ * This check is not foolproof -- just a guide.
+ */
+ if (getenv("DISPLAY"))
+ {
+ fprintf(stderr,
+ "%s: Cannot be run while an X server is running\n",
+ MyName);
+ fprintf(stderr,
+ "%s: If an X server is not running, unset $DISPLAY",
+ MyName);
+ fprintf(stderr,
+ " and try again\n");
+ return(-1);
+ }
+ if ((CONS_fd = open("/dev/vga", O_RDWR, 0)) < 0
+ && (CONS_fd = open(CONSOLE_DEVICE, O_RDWR, 0)) < 0
+#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
+ && (CONS_fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV,
+ O_RDWR, 0)) < 0
+#endif
+ )
+ {
+ fprintf(stderr,
+ "%s: Cannot open /dev/vga nor %s\n",
+ MyName, CONSOLE_DEVICE);
+ return(-1);
+ }
+#endif
+ }
+ else
+ {
+#ifndef __bsdi__
+#ifdef CODRV_SUPPORT
+ struct oldconsinfo tmp;
+
+ if (ioctl(CONS_fd, OLDCONSGINFO, &tmp) < 0)
+ {
+ fprintf(stderr, "%s: Unknown console driver\n",
+ MyName);
+ return(-1);
+ }
+ HasCodrv = TRUE;
+#endif
+#endif
+ }
+#ifndef __bsdi__
+ if (HasCodrv)
+ {
+#ifdef CODRV_SUPPORT
+ int onoff = X_MODE_ON;
+
+ if (ioctl(CONS_fd, CONSOLE_X_MODE, &onoff) < 0)
+ {
+ fprintf(stderr, "%s: CONSOLE_X_MODE ON failed\n",
+ MyName);
+ return(-1);
+ }
+ ioctl(CONS_fd, VGATAKECTRL, 0);
+#endif
+ }
+ else
+ {
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ /*
+ * not codrv and not BSDI; first look if we have a console
+ * driver that understands USL-style VT commands
+ */
+ int vt_num;
+
+ if (ioctl(CONS_fd, VT_GETACTIVE, &vt_num) == 0)
+ {
+ /* yes, so we don't use the old stuff */
+ HasUslVt = TRUE;
+ if (ioctl(CONS_fd, KDENABIO, 0) < 0)
+ {
+ fprintf(stderr, "%s: KDENABIO failed\n",
+ MyName);
+ return(-1);
+ }
+ }
+ else
+#endif
+#endif
+ if (ioctl(CONS_fd, CONSOLE_X_MODE_ON, 0) < 0)
+ {
+ fprintf(stderr, "%s: CONSOLE_X_MODE_ON failed\n",
+ MyName);
+ return(-1);
+ }
+#ifdef __bsdi__
+ ioctl(CONS_fd, PCCONENABIOPL, 0);
+#else
+ }
+#endif
+ return(CONS_fd);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For 386BSD, we re-enable
+ * IO protection.
+ */
+void CloseVideo()
+{
+ if (CONS_fd != -1)
+ {
+#ifndef __bsdi__
+#ifdef CODRV_SUPPORT
+ int onoff = X_MODE_OFF;
+#endif
+
+ if (HasCodrv)
+ {
+#ifdef CODRV_SUPPORT
+ ioctl(CONS_fd, VGAGIVECTRL, 0);
+ ioctl(CONS_fd, CONSOLE_X_MODE, &onoff);
+#endif
+ }
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ else if(HasUslVt)
+ ioctl(CONS_fd, KDDISABIO, 0);
+#endif
+ else
+#endif
+ ioctl(CONS_fd, CONSOLE_X_MODE_OFF, 0);
+ }
+#ifdef __bsdi__
+ ioctl(CONS_fd, PCCONDISABIOPL, 0);
+#endif
+ if (CONS_fd > 0)
+ {
+ close(CONS_fd);
+ }
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ int fd;
+ Byte *base;
+
+ if ((fd = open("/dev/vga", O_RDWR)) < 0)
+ {
+ fprintf(stderr, "%s: Failed to open /dev/vga\n", MyName);
+ return((Byte *)0);
+ }
+ base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE,
+ MAP_FILE, fd, 0);
+ close(fd);
+ if ((long)base == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+ return(base);
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte*)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ munmap((caddr_t)base, 0x10000);
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Word tmp;
+ Byte *Base = Bios_Base + Offset;
+ unsigned long bs = (unsigned long) Base;
+
+#ifdef __arm32__
+ return(-1);
+#endif
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open /dev/mem\n", MyName);
+ return(-1);
+ }
+ }
+ if ((off_t)(bs & 0x7FFF) != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ (void)lseek(BIOS_fd, (off_t)(bs & 0xF8000), SEEK_SET);
+ (void)read(BIOS_fd, &tmp, 2);
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%lx\n",
+ MyName, bs);
+ return(-1);
+ }
+ }
+ if (lseek(BIOS_fd, (off_t)bs, SEEK_SET) < 0)
+ {
+ fprintf(stderr, "%s: BIOS seek failed\n", MyName);
+ return(-1);
+ }
+ if (read(BIOS_fd, Buffer, Len) != Len)
+ {
+ fprintf(stderr, "%s: BIOS read failed\n", MyName);
+ return(-1);
+ }
+ return(Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For 386BSD,
+ * we've disabled IO protections so this is a no-op.
+ */
+static int IOEnabled = 0;
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+#ifdef USE_I386_IOPL
+ if (IOEnabled++ == 0) {
+ i386_iopl(TRUE);
+ }
+#endif
+#ifdef USE_ARM32_MMAP
+ if (IOEnabled++ == 0) {
+ if (DEVMEM_fd == -1 && (DEVMEM_fd = open("/dev/mem", O_RDWR, 0)) < 0)
+ {
+ fprintf(stderr,
+ "%s: Cannot open /dev/mem to map IO ports\n", MyName);
+ exit(1);
+ }
+
+ IOPortBase = (unsigned int)mmap((caddr_t)0, 0x400, PROT_READ|PROT_WRITE,
+ MAP_FILE, DEVMEM_fd, (off_t)DEV_MEM_IOBASE);
+
+ if (IOPortBase == (unsigned int)-1)
+ {
+ fprintf(stderr,
+ "%s: Cannot mmap IO ports\n", MyName);
+ exit(1);
+ }
+ }
+#endif
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For 386BSD,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+#ifdef USE_I386_IOPL
+ if (--IOEnabled == 0) {
+ i386_iopl(FALSE);
+ }
+#endif
+#ifdef USE_ARM32_MMAP
+ if (--IOEnabled == 0) {
+ munmap((caddr_t)IOPortBase, 0x400);
+ }
+#endif
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+ usleep(Delay * 1000);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c
new file mode 100644
index 000000000..74fef5606
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c
@@ -0,0 +1,259 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c,v 1.2 1999/08/01 07:57:06 dawes Exp $ */
+/*
+ * INTEL DG/UX RELEASE 4.20 MU04
+ * Copyright Takis Psarogiannakopoulos
+ * e-mail <takis@pmms.cam.ac.uk>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+#include "Probe.h"
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/kd.h>
+#include <sys/proc.h>
+#include <sys/mman.h>
+
+/* Definition of SI86IOPL for DG/ux
+ * According to sysi86 of DG/ux
+ * Unixware
+ */
+
+#include <sys/sysi86.h>
+#define SI86IOPL 112
+
+#define DEV_MEM "/dev/mem"
+
+int Takis_fd;
+static int BIOS_fd = -1;
+
+/*
+ * OpenVideo --
+ */
+int OpenVideo()
+{
+ int fd;
+ char takis[20];
+
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root or installed suid-root\n",
+ MyName);
+ return(-1);
+ }
+ if ((fd = open("/dev/console", O_RDWR, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Cannot open /dev/console\n",
+ MyName);
+ return(-1);
+ }
+ close(fd);
+ sprintf(takis, "/dev/console");
+
+ if ((Takis_fd = open(takis, O_RDWR|O_NDELAY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Could not open system Console \n",
+ MyName);
+ return(-1);
+ }
+ if (sysi86(SI86IOPL, 3)< 0)
+ {
+ return(-1);
+ }
+
+ return(Takis_fd);
+}
+
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware, ie Close system console,
+ * and re-enable IO protection.
+ */
+void CloseVideo()
+{
+ if (Takis_fd>0)
+ {
+ sysi86(SI86IOPL, 0); /* Disable I/O ports */
+ close(Takis_fd);
+ }
+}
+
+
+/*
+ * MapVGA --
+ */
+Byte *MapVGA()
+{
+ int fd;
+ Byte *base;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0)
+ {
+ fprintf(stderr, "%s: Failed to open %s\n", MyName, DEV_MEM);
+ return((Byte *)0);
+ }
+ base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd, (off_t)0xA0000);
+ close(fd);
+ if ((long)base == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+ return(base);
+}
+
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte*)0);
+}
+
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ munmap((caddr_t)base, 0x10000);
+ return;
+}
+
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Byte *Base = Bios_Base + Offset;
+ Word *tmp;
+ Byte *ptr;
+ unsigned long page_offset = (unsigned long)Base & 0xFFF;
+ unsigned long mmap_base = (unsigned long)Base & ~0xFFF;
+ unsigned long mmap_len = Len + page_offset;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open %s\n",
+ MyName, DEV_MEM);
+ return(-1);
+ }
+ }
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ tmp = (Word *)mmap((caddr_t)0, 0x1000, PROT_READ, MAP_SHARED,
+ BIOS_fd, (off_t)((off_t)Base & 0xF8000));
+ if ((int)tmp == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n",
+ MyName, DEV_MEM, (int)Base);
+ return(-1);
+ }
+ if (*tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ return(-1);
+ }
+ (void)munmap((caddr_t)tmp, 0x1000);
+ }
+ ptr = (Byte *)mmap((caddr_t)0, mmap_len, PROT_READ, MAP_SHARED,
+ BIOS_fd, (off_t)mmap_base);
+ if ((int)ptr == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n",
+ MyName, DEV_MEM, (int)Base);
+ return(-1);
+ }
+ (void)memcpy((void *)Buffer, (void *)(ptr + page_offset), Len);
+ (void)munmap((caddr_t)ptr, mmap_len);
+ return(Len);
+}
+
+
+/*
+ * EnableIOPort --
+ */
+/*ADDED FOR INTEL DG/ux */
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ */
+
+/*ADDED FOR INTEL DG/ux */
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ */
+
+/*ADDED FOR INTEL DG/ux */
+void ShortSleep(Delay)
+int Delay;
+{
+ usleep(Delay * 1000);
+}
+
+/* Added to allow lightweight processes to access I/O directly */
+#if defined(DGUX)
+ asm("sysi86:_sysi86:pushl %ebp");
+ asm("movl %esp,%ebp");
+ asm("pushl 12(%ebp)");
+ asm("pushl 8(%ebp)");
+ asm("pushl 4(%ebp)");
+ asm("movl $50,%eax");
+ asm("lcall $7,$0");
+ asm("addl $12,%esp");
+ asm("leave");
+ asm("ret");
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c
new file mode 100644
index 000000000..80b49f949
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c
@@ -0,0 +1,247 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_GNUmach.c,v 1.1 1998/08/16 10:25:38 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Robert V. Baron
+ * <Robert.Baron@ernst.mach.cs.cmu.edu>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * ROBERT V. BARON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Robert V. Baron shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Robert V. Baron.
+ *
+ */
+/* $XConsortium: OS_Mach.c /main/5 1996/02/21 17:11:12 kaleb $ */
+/* GNU/Hurd port by UCHIYAMA Yasushi */
+#define _GNU_SOURCE
+#define MACH3
+#include<hurd.h>
+#include<device/device.h>
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+/* These can be Mach 2.5 or 3.0 headers */
+#include <mach.h>
+#include <mach_error.h>
+#include <mach/message.h>
+
+static device_t device_master = MACH_PORT_NULL;
+static int iopl_dev = MACH_PORT_NULL;
+static memory_object_t iopl_mem = MACH_PORT_NULL;
+static vm_address_t mapped_address;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For Mach, we disable
+ * IO protection, since this is currently the only way to access any
+ * IO registers.
+ */
+int screen_addr;
+
+int OpenVideo()
+{
+ int ret;
+#define C /*Bios_Base*/ 0xc0000
+#define S 0x40000
+ if(KERN_SUCCESS != get_privileged_ports(0,&device_master)){
+ fprintf(stderr,"Failed get_privileged_ports\n");
+ return -1;
+ }
+ if (KERN_SUCCESS != device_open(device_master,D_READ|D_WRITE,"iopl",&iopl_dev)){
+ fprintf(stderr, "Failed to device_open iopl\n");
+ return -1;
+ }
+ if(KERN_SUCCESS != device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, C , S ,&iopl_mem,0)){
+ fprintf(stderr, "Failed to device_map\n");
+ return -1;
+ }
+ if(KERN_SUCCESS != vm_map(mach_task_self(),
+ &mapped_address,S,
+ 0,1,iopl_mem,C,0,VM_PROT_READ|VM_PROT_WRITE,
+ VM_PROT_READ|VM_PROT_WRITE,VM_INHERIT_NONE)){
+ fprintf(stderr,"Failed to vm_map\n");
+ return -1;
+ }
+
+ screen_addr = (int)mapped_address;
+
+ return TRUE;
+
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For Mach, we re-enable
+ * IO protection.
+ */
+void CloseVideo()
+{
+ if (KERN_SUCCESS != vm_deallocate(mach_task_self(), screen_addr, S)) {
+ fprintf(stderr, "Failed vmdeallocate %x\n", S);
+ }
+
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ return((Byte *)0);
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte *)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ return;
+}
+
+void UnMapMem(base,size)
+Byte *base;
+unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Word tmp;
+ Byte *Base;
+
+ Base = (Byte *)(screen_addr + Bios_Base + Offset - C);
+#ifdef DEBUG
+ {int i;
+ fprintf(stderr, "ReadBIOS(Offset %x, Buffer %x, Len %x) .. ",
+ Offset, Buffer, Len);
+ for (i=0;i<Len;i++)
+ fprintf(stderr," [%c](%x)|", *(Base+i), *(Base+i));
+ fprintf(stderr,"\n");
+ }
+#endif
+ bcopy(Base, Buffer, Len);
+ return (Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Mach,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Mach,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+#ifdef MACH3
+ struct trial {
+ mach_msg_header_t h;
+ mach_msg_type_t t;
+ int d;
+ } msg_rcv;
+ mach_port_t my_port;
+#else
+ /* This does Mach 2.5 IPC */
+ struct trial {
+ msg_header_t h;
+ msg_type_t t;
+ int d;
+ } msg_rcv;
+ port_t my_port;
+#endif
+ kern_return_t error;
+ int ret;
+
+ if ((error = mach_port_allocate(mach_task_self(),MACH_PORT_RIGHT_PORT_SET,&my_port)) != KERN_SUCCESS) {
+ printf("ShortSleep: mach_port_allocate failed with %d: %s\n",
+ error, mach_error_string(error));
+ return;
+ }
+
+#ifdef MACH3
+ msg_rcv.h.msgh_size = sizeof(msg_rcv);
+ if ((ret = mach_msg_receive(&msg_rcv.h, MACH_RCV_TIMEOUT, Delay)) != MACH_RCV_TIMED_OUT) {
+#else
+ if ((ret = mach_msg_receive(&msg_rcv.h, RCV_TIMEOUT, Delay)) != RCV_TIMED_OUT) {
+ msg_rcv.h.msg_local_port = my_port;
+#endif
+ mach_error("ShortSleep: mach_msg_receive returned ", ret);
+ return;
+ }
+
+ if ((error = mach_port_deallocate(mach_task_self(), my_port)) != KERN_SUCCESS) {
+ printf("ShortSleep: port_deallocate failed with %d: %s\n",
+ error, mach_error_string(error));
+ return;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c
new file mode 100644
index 000000000..9551542da
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c
@@ -0,0 +1,397 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Linux.c,v 3.13 1999/03/28 15:32:21 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Orest Zborowski <orestz@eskimo.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Orest Zborowski shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Orest Zborowski.
+ *
+ */
+
+/* $XConsortium: OS_Linux.c /main/8 1996/10/19 17:47:14 kaleb $ */
+
+#include "Probe.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/kd.h>
+#include <sys/vt.h>
+#include <sys/mman.h>
+
+#ifdef __alpha__
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme.
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
+#define isJensen (1)
+#define SPARSE (5)
+#define WORD_CODING (0x08)
+#else
+#define isJensen (!_bus_base())
+#define SPARSE (7)
+#define WORD_CODING (0x20)
+#endif
+
+#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base())
+#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x)
+#else
+#define BUS_BASE 0
+#define JENSEN_SHIFT(x) (x)
+#endif
+
+static int VT_fd = -1;
+static int VT_num = -1;
+static int VT_cur = -1;
+static int BIOS_fd = -1;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For Linux, open a new
+ * VT, and disable IO protection, since we may need to get at extended
+ * registers (full 16-bit decoding).
+ */
+int OpenVideo()
+{
+ int fd;
+ char fn[20];
+ struct vt_stat vts;
+
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root\n",
+ MyName);
+ return(-1);
+ }
+
+ if ((fd = open("/dev/console", O_WRONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Cannot open /dev/console\n", MyName);
+ return(-1);
+ }
+ /*
+ * The Linux kernel doesn't keep track of the VT to return
+ * to, so we have to maintain that ourselves. (Hmm... would
+ * it work like a stack [chain of vt parents])?
+ */
+ if (ioctl(fd, VT_GETSTATE, &vts) == 0)
+ {
+ VT_cur = vts.v_active;
+ }
+ else
+ {
+ VT_cur = -1;
+ }
+ if ((ioctl(fd, VT_OPENQRY, &VT_num) < 0) || (VT_num == -1))
+ {
+ fprintf(stderr, "%s: No free VTs\n", MyName);
+ return(-1);
+ }
+ close(fd);
+ sprintf(fn, "/dev/tty%d", VT_num);
+ if ((VT_fd = open(fn, O_RDWR|O_NDELAY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Could not open VT %s\n", MyName, fn);
+ return(-1);
+ }
+ /*
+ * Hmmm... I thought WAITACTIVE didn't activate, only
+ * waited for the vt to activate. Am I wrong in that
+ * assumption?
+ */
+ if (ioctl(VT_fd, VT_ACTIVATE, VT_num) != 0)
+ {
+ fprintf(stderr, "%s: VT_ACTIVATE failed!\n", MyName);
+ return(-1);
+ }
+ if (ioctl(VT_fd, VT_WAITACTIVE, VT_num) != 0)
+ {
+ fprintf(stderr, "%s: VT_WAITACTIVE failed!\n", MyName);
+ return(-1);
+ }
+ /*
+ * Give the other VT time to release.
+ */
+ sleep(1);
+ /*
+ * Get IOPL so we can get at all the I/O ports.
+ */
+#ifndef __sparc__
+ iopl(3);
+#endif
+ return(VT_fd);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For Linux, close the VT, and
+ * re-enable IO protection.
+ */
+void CloseVideo()
+{
+ int fd;
+
+#ifndef __sparc__
+ iopl(0);
+#endif
+ if (VT_fd > 0)
+ {
+ close(VT_fd);
+ if (VT_cur >= 0)
+ {
+ if ((fd = open("/dev/console", O_WRONLY, 0)) >= 0)
+ {
+ ioctl(fd, VT_ACTIVATE, VT_cur);
+ close(fd);
+ }
+ }
+ }
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ return( MapMem(0xA0000,0x10000) );
+}
+
+Byte *MapMem(address, size)
+ unsigned long address;
+ unsigned long size;
+{
+ int fd;
+ Byte *base;
+
+#ifdef __alpha__
+ if(isJensen){
+ fprintf(stderr, "%s: MemProbe not supported on Jensen\n", MyName);
+ return((Byte *)0);
+ }
+#endif
+
+ if ((fd = open("/dev/mem", O_RDWR)) < 0)
+ {
+ fprintf(stderr, "%s: Failed to open /dev/mem\n", MyName);
+ return((Byte *)0);
+ }
+ base = (Byte *)mmap((caddr_t)0, size, PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd, (off_t)address + BUS_BASE);
+ close(fd);
+ if ((long)base == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+ return(base);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+ Byte *base;
+{
+ UnMapMem(base,0x10000);
+ return;
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ munmap((caddr_t)base, 0x10000);
+ return;
+}
+
+#ifdef __alpha__
+SlowBCopyFromBus(src, dst, count)
+ unsigned char *src, *dst;
+ int count;
+{
+ unsigned long addr;
+ long result;
+
+ addr = (unsigned long) src;
+ while( count ){
+ result = *(volatile int *) addr;
+ result >>= ((addr>>SPARSE) & 3) * 8;
+ *dst++ = (unsigned char) (0xffUL & result);
+ addr += 1<<SPARSE;
+ count--;
+ }
+}
+#endif
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Word tmp;
+ Byte *Base = Bios_Base + Offset;
+ Byte *mybase;
+ off_t myoffset;
+ int mysize;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open /dev/mem\n", MyName);
+ return(-1);
+ }
+ }
+
+#ifdef __alpha__
+ if ((myoffset = ((off_t)Base & 0x7FFF)) != 0)
+ Base = (Byte *)((off_t)Base & 0xF8000);
+
+ mysize = myoffset + Len;
+ mybase = (unsigned char *)mmap((caddr_t)0, JENSEN_SHIFT(mysize), PROT_READ,
+ MAP_SHARED, BIOS_fd,
+ (off_t)JENSEN_SHIFT(Base) + BUS_BASE);
+
+ if (mybase == (unsigned char *)-1UL) {
+ fprintf(stderr, "%s: Failed to mmap /dev/mem (%d)\n",
+ MyName, errno);
+ return(-1);
+ }
+
+ if (myoffset != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ if (isJensen)
+ {
+ tmp = *(volatile int *) (mybase + WORD_CODING);
+ tmp >>= ((long)Base & 3) * 8;
+ tmp &= 0xffffUL;
+ }
+ else
+ {
+ tmp = *(Word *)mybase;
+ }
+
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%lx\n",
+ MyName, (long)Base);
+ return(-1);
+ }
+ }
+
+ if (isJensen)
+ SlowBCopyFromBus(&mybase[JENSEN_SHIFT(myoffset)], Buffer, Len);
+ else
+ memcpy(Buffer, &mybase[myoffset], Len);
+
+ munmap((caddr_t)((off_t)JENSEN_SHIFT(Base) | BUS_BASE), mysize);
+
+#else /* __alpha__ */
+
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET);
+ (void)read(BIOS_fd, &tmp, 2);
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ return(-1);
+ }
+ }
+ if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0)
+ {
+ fprintf(stderr, "%s: BIOS seek failed\n", MyName);
+ return(-1);
+ }
+ if (read(BIOS_fd, Buffer, Len) != Len)
+ {
+ fprintf(stderr, "%s: BIOS read failed\n", MyName);
+ return(-1);
+ }
+#endif /* __alpha__ */
+
+ return(Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Linux,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+ usleep(Delay * 1000);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c
new file mode 100644
index 000000000..1e857db61
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c
@@ -0,0 +1,256 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_LynxOS.c,v 3.7 1997/07/10 08:17:19 hohndel Exp $ */
+/*
+ * Copyright 1993 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: OS_LynxOS.c /main/5 1996/02/21 17:11:07 kaleb $ */
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#include <conf.h>
+#include <kd.h>
+#include <vt.h>
+#include <smem.h>
+
+#include <kernel.h> /* for PHYSBASE */
+
+#ifdef __powerpc__
+unsigned char *ioBase = NULL;
+static int IOEnabled;
+#endif
+
+static int BIOS_fd = -1;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware.
+ * For LynxOS just a check for super-user permissions.
+ */
+#ifdef __STDC__
+int OpenVideo(void)
+#else
+int OpenVideo()
+#endif
+{
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root\n",
+ MyName);
+ return(-1);
+ }
+
+ return(1);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware.
+ * For Lynxos a no-op.
+ */
+#ifdef __STDC__
+void CloseVideo(void)
+#else
+void CloseVideo()
+#endif
+{
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ return(MapMem(0xa0000,0x10000));
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+#define SMEM_NAME "SuperProbe-VGA"
+ Byte *base;
+
+ base = (Byte *) smem_create(SMEM_NAME, (char *)address,
+ size, SM_READ|SM_WRITE);
+ if ((long)base == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+ return(base);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ UnMapMem(base,0x10000);
+ return;
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ smem_create(NULL, (char *)base, 0, SM_DETACH);
+ smem_remove(SMEM_NAME);
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+#ifdef __STDC__
+int ReadBIOS(const unsigned Offset, Byte *Buffer, const int Len)
+#else
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+#endif
+{
+ Word tmp;
+ Byte *Base = Bios_Base + Offset;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open /dev/mem\n", MyName);
+ return(-1);
+ }
+ }
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ (void)lseek(BIOS_fd, (off_t)PHYSBASE + ((off_t)Base & 0xF8000), SEEK_SET);
+ (void)read(BIOS_fd, &tmp, 2);
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, Seek to =%x, Read Word %04x\n",
+ MyName, (int)Base & 0xF8000, tmp);
+ return(-1);
+ }
+ }
+ /* check carefully against -1 because of PHYSBASE offset.. */
+ if (lseek(BIOS_fd, (off_t)(PHYSBASE + Base), SEEK_SET) == -1)
+ {
+ fprintf(stderr, "%s: BIOS seek failed\n", MyName);
+ return(-1);
+ }
+ if (read(BIOS_fd, Buffer, Len) != Len)
+ {
+ fprintf(stderr, "%s: BIOS read failed\n", MyName);
+ return(-1);
+ }
+ return(Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'.
+ * For LynxOS this is a no-op.
+ */
+#ifdef __STDC__
+/*ARGSUSED*/
+int EnableIOPorts(const int NumPorts, const Word *Ports)
+#else
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+int NumPorts;
+Word *Ports;
+#endif
+{
+#ifdef __powerpc__
+ if (IOEnabled++ == 0) {
+ ioBase = (unsigned char *) smem_create("IOBASE",
+ (char *)0x80000000, 64*1024, SM_READ|SM_WRITE);
+ if (ioBase == (void *) -1) {
+ ioBase = NULL;
+ IOEnabled--;
+ return -1;
+ }
+ }
+#endif
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'.
+ * For LynxOS this is a no-op.
+ */
+#ifdef __STDC__
+/*ARGSUSED*/
+int DisableIOPorts(const int NumPorts, const Word *Port)
+#else
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+int NumPorts;
+Word *Port;
+#endif
+{
+#ifdef __powerpc__
+ if (--IOEnabled == 0 && ioBase) {
+ smem_create(NULL, (char *) ioBase, 0, SM_DETACH);
+ smem_remove("IOBASE");
+ ioBase = NULL;
+ }
+#endif
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+#ifdef __STDC__
+void ShortSleep(const int Delay)
+#else
+void ShortSleep(Delay)
+int Delay;
+#endif
+{
+ usleep(Delay * 1000);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c
new file mode 100644
index 000000000..183ee10b0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c
@@ -0,0 +1,236 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Mach.c,v 3.5 1997/03/07 00:28:57 hohndel Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Robert V. Baron
+ * <Robert.Baron@ernst.mach.cs.cmu.edu>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * ROBERT V. BARON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Robert V. Baron shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Robert V. Baron.
+ *
+ */
+/* $XConsortium: OS_Mach.c /main/5 1996/02/21 17:11:12 kaleb $ */
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+/* These can be Mach 2.5 or 3.0 headers */
+#include <mach.h>
+#include <mach_error.h>
+#include <mach/message.h>
+#ifdef MACH_PORT_NULL
+#define MACH3 /* they must have been 3.0 headers beckerd@cs.unc.edu */
+#endif
+#undef task_self
+
+static int IOPL_fd = -1;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For Mach, we disable
+ * IO protection, since this is currently the only way to access any
+ * IO registers.
+ */
+int screen_addr;
+
+int OpenVideo()
+{
+ int ret;
+#define C /*Bios_Base*/ 0xc0000
+#define S 0x40000
+
+ if ((IOPL_fd = open("/dev/iopl", O_RDWR, 0)) < 0) {
+ fprintf(stderr, "Failed to open /dev/iopl\n");
+ return -1;
+ }
+#define KERN_SUCESS 0
+ if (KERN_SUCESS != vm_allocate(task_self(), &screen_addr, S, TRUE)) {
+ fprintf(stderr, "Failed vmallocate %x\n", S);
+ close(IOPL_fd);
+ return -1;
+ }
+ if (mmap(screen_addr+C, S, 3, 1, IOPL_fd, C) < 0) {
+ fprintf(stderr, "Failed to mmap %x bytes at %x\n", S, C);
+ vm_deallocate(task_self(), screen_addr, S);
+ close(IOPL_fd);
+ return -1;
+ }
+ return(IOPL_fd);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For Mach, we re-enable
+ * IO protection.
+ */
+void CloseVideo()
+{
+ if (KERN_SUCESS != vm_deallocate(task_self(), screen_addr, S)) {
+ fprintf(stderr, "Failed vmdeallocate %x\n", S);
+ }
+ close(IOPL_fd);
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ return((Byte *)0);
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte *)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ return;
+}
+
+void UnMapMem(base,size)
+Byte *base;
+unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Word tmp;
+ Byte *Base = (Byte *)(screen_addr + Bios_Base + Offset);
+
+#ifdef DEBUG
+ {int i;
+ fprintf(stderr, "ReadBIOS(Offset %x, Buffer %x, Len %x) .. ",
+ Offset, Buffer, Len);
+ for (i=0;i<Len;i++)
+ fprintf(stderr," [%c](%x)|", *(Base+i), *(Base+i));
+ fprintf(stderr,"\n");
+ }
+#endif
+ bcopy(Base, Buffer, Len);
+ return (Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Mach,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Mach,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+#ifdef MACH3
+ struct trial {
+ mach_msg_header_t h;
+ mach_msg_type_t t;
+ int d;
+ } msg_rcv;
+ mach_port_t my_port;
+#else
+ /* This does Mach 2.5 IPC */
+ struct trial {
+ msg_header_t h;
+ msg_type_t t;
+ int d;
+ } msg_rcv;
+ port_t my_port;
+#endif
+ kern_return_t error;
+ int ret;
+
+ if ((error = port_allocate(task_self(), &my_port)) != KERN_SUCCESS) {
+ printf("ShortSleep: port_allocate failed with %d: %s\n",
+ error, mach_error_string(error));
+ return;
+ }
+
+#ifdef MACH3
+ msg_rcv.h.msgh_size = sizeof(msg_rcv);
+ if ((ret = msg_receive(&msg_rcv.h, MACH_RCV_TIMEOUT, Delay)) != MACH_RCV_TIMED_OUT) {
+#else
+ if ((ret = msg_receive(&msg_rcv.h, RCV_TIMEOUT, Delay)) != RCV_TIMED_OUT) {
+ msg_rcv.h.msg_local_port = my_port;
+#endif
+ mach_error("ShortSleep: msg_receive returned ", ret);
+ return;
+ }
+
+ if ((error = port_deallocate(task_self(), my_port)) != KERN_SUCCESS) {
+ printf("ShortSleep: port_deallocate failed with %d: %s\n",
+ error, mach_error_string(error));
+ return;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Minix.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Minix.c
new file mode 100644
index 000000000..143eaecc5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Minix.c
@@ -0,0 +1,228 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Minix.c,v 3.6 1997/03/17 11:22:37 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by Philip Homburg <philip@cs.vu.nl>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PHILIP HOMBURG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Philip Homburg shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Philip Homburg.
+ *
+ */
+/* $XConsortium: OS_Minix.c /main/5 1996/02/21 17:11:16 kaleb $ */
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#include <time.h>
+#include <sys/ioctl.h>
+#include <sys/memio.h>
+
+static int CONS_fd = -1;
+static int BIOS_fd = -1;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. This also gives us
+ * access to all I/O registers and the interrupt enable/disable bit.
+ */
+int OpenVideo()
+{
+ void *base;
+ u32_t aligned_base;
+ struct mio_map mio_map;
+
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root\n",
+ MyName);
+ return(-1);
+ }
+ base= malloc(0x21000);
+ if (base == NULL)
+ {
+ fprintf(stderr,
+ "%s: Cannot allocate enough memory to map /dev/vga\n",
+ MyName);
+ return(-1);
+ }
+ aligned_base= (((unsigned long)base) + 0xFFF) & ~0xFFF;
+
+ if ((CONS_fd = open("/dev/vga", O_RDWR, 0)) == -1)
+ {
+ fprintf(stderr, "%s: Cannot open /dev/vga\n",
+ MyName);
+ return(-1);
+ }
+ mio_map.mm_base= aligned_base;
+ mio_map.mm_size= 0x20000; /* 128K */
+ if (ioctl(CONS_fd, MIOCMAP, &mio_map) == -1)
+ {
+ fprintf(stderr, "%s: Cannot map /dev/vga\n",
+ MyName);
+ close(CONS_fd);
+ CONS_fd= -1;
+ return(-1);
+ }
+ return(CONS_fd);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For Minix, this removes access
+ * to I/O registers.
+ */
+void CloseVideo()
+{
+ if (CONS_fd > 0)
+ {
+ close(CONS_fd);
+ CONS_fd= -1;
+ }
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ return((Byte *)0);
+}
+
+Byte *MapMem(adress,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte*)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ return;
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ Word tmp;
+ Byte *Base = Bios_Base + Offset;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open /dev/mem\n", MyName);
+ return(-1);
+ }
+ }
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET);
+ (void)read(BIOS_fd, &tmp, 2);
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ return(-1);
+ }
+ }
+ if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0)
+ {
+ fprintf(stderr, "%s: BIOS seek failed\n", MyName);
+ return(-1);
+ }
+ if (read(BIOS_fd, Buffer, Len) != Len)
+ {
+ fprintf(stderr, "%s: BIOS read failed\n", MyName);
+ return(-1);
+ }
+ return(Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For Minix,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ if (CONS_fd == -1) abort();
+
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For Minix,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+ usleep(Delay * 1000);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c
new file mode 100644
index 000000000..273150d8c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c
@@ -0,0 +1,322 @@
+/* $XConsortium: OS_Os2.c /main/7 1996/10/27 11:46:26 kaleb $ */
+/*
+ * (c) Copyright 1994 by Holger Veit
+ * <Holger.Veit@gmd.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Holger Veit shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Holger Veit.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_Os2.c,v 3.9 1997/03/11 13:05:26 hohndel Exp $ */
+
+
+#include "Probe.h"
+
+#define INCL_32
+#define INCL_DOS
+#include <os2.h>
+
+#define UNUSED (Byte*)0xffffffffl
+
+HFILE consFd = -1;
+
+ULONG action;
+char *videoDrvPath = "/dev/pmap$";
+char *ioDrvPath = "/dev/fastio$";
+
+Byte* videoAddr = UNUSED;
+ULONG videoSize = 0x10000;
+int ioenabled = FALSE;
+
+static void sorry()
+{
+ fprintf(stderr,
+ "Didn't find a properly installed XF86SUP.SYS at your system\n");
+ fprintf(stderr,"Please install it before retrying\n");
+}
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For OS/2, we take
+ * advantage of the driver xf86sup.sys which was specifically written
+ * for XFree86/OS2.
+ *
+ * At this point we also try to weed out systems with outdated EMX code.
+ */
+int OpenVideo()
+{
+ ULONG rc;
+ HMODULE hmod;
+ char name[CCHMAXPATH];
+ char fail[9];
+
+ if (DosOpen((PSZ)videoDrvPath, (PHFILE)&consFd, (PULONG)&action,
+ (ULONG)0, FILE_SYSTEM, FILE_OPEN,
+ OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
+ (ULONG)0) != 0) {
+ sorry();
+ exit(2);
+ }
+
+ /* check for correct EMX */
+ if (_emx_rev < 50) {
+ fputs ("This program requires emx.dll revision 50 (0.9c) "
+ "or later.\n", stderr);
+ rc = DosLoadModule (fail, sizeof (fail), "emx", &hmod);
+ if (rc == 0) {
+ rc = DosQueryModuleName (hmod, sizeof (name), name);
+ if (rc == 0)
+ fprintf (stderr, "Please delete or update `%s'.\n", name);
+ DosFreeModule (hmod);
+ }
+ exit (2);
+ }
+ return 1;
+}
+
+/* this structure is used as a parameter packet for the direct access
+ * to physical memory
+ */
+typedef struct {
+ ULONG addr; /* PHYSADDR for map, VIRTADDR for unmap */
+ ULONG size;
+} DIOParPkt;
+
+/* this structure is used as a return value for the direct access ioctl
+ * to physical memory
+ */
+typedef struct {
+ ULONG addr;
+ USHORT sel;
+} DIODtaPkt;
+
+static Byte* UnmapPhys(Byte* addr,ULONG size)
+{
+ DIOParPkt par;
+ ULONG plen;
+
+ par.addr = (ULONG)addr;
+ par.size = size;
+ plen = sizeof(par);
+
+ if (consFd != -1)
+ DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x45,
+ (PVOID)&par, (ULONG)plen, (PULONG)&plen,
+ NULL, 0, NULL);
+ return UNUSED; /* no error */
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware.
+ */
+void CloseVideo()
+{
+ if (videoAddr != UNUSED)
+ videoAddr = UnmapPhys(videoAddr,videoSize);
+
+ DosClose(consFd);
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+ DIOParPkt par;
+ ULONG plen;
+ DIODtaPkt dta;
+ ULONG dlen;
+
+ par.addr = 0xa0000l;
+ par.size = videoSize;
+ plen = sizeof(par);
+
+ if (consFd != -1 &&
+ DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x44,
+ (PVOID)&par, (ULONG)plen, (PULONG)&plen,
+ (PVOID)&dta, (ULONG)6, (PULONG)&dlen) == 0) {
+ if (dlen==6) {
+ videoAddr = (Byte*)dta.addr;
+ return videoAddr;
+ }
+ } else {
+ fprintf(stderr, "%s: Failed to map framebuffer\n", MyName);
+ return (Byte*)0;
+ }
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte*)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+ UnmapPhys(videoAddr,videoSize);
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+ struct {
+ ULONG cmd;
+ ULONG phys;
+ USHORT len;
+ } par;
+ UCHAR *dta;
+ ULONG plen,dlen;
+ int i;
+
+ par.cmd = 0;
+ par.phys = (ULONG)Bios_Base+(Offset & 0xffff8000);
+ par.len = (Offset & 0x7fff) + Len;
+ plen = sizeof(par);
+
+ dta = (UCHAR*)malloc(par.len);
+ dlen = Len;
+
+ if (DosDevIOCtl(consFd, (ULONG)0x76, (ULONG)0x64,
+ (PVOID)&par, (ULONG)plen, (PULONG)&plen,
+ (PVOID)dta, (ULONG)dlen, (PULONG)&dlen)) {
+ fprintf(stderr, "%s: BIOS map failed, addr=%lx\n",
+ MyName, Bios_Base+Offset);
+ return -1;
+ }
+
+ /*
+ * Sanity check...
+ */
+ if ((Offset & 0x7fff) != 0 &&
+ (dta[0] != 0x55 || dta[1] != 0xaa)) {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, Bios_Base+Offset);
+ return -1;
+ }
+
+ memcpy(Buffer,dta + (Offset & 0x7fff), Len);
+ free(dta);
+ return(Len);
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'.
+ */
+USHORT callgate[3] = {0,0,0};
+
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ HFILE hfd;
+ ULONG dlen;
+
+ /* no need to call multiple times */
+ if (ioenabled) return 0;
+
+ if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action,
+ (ULONG)0, FILE_SYSTEM, FILE_OPEN,
+ OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
+ (ULONG)0) != 0) {
+ sorry();
+ return -1;
+ }
+ callgate[0] = callgate[1] = 0;
+
+ if (DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64,
+ NULL, 0, NULL,
+ (ULONG*)&callgate[2], sizeof(USHORT), &dlen) != 0) {
+ sorry();
+ DosClose(hfd);
+ return -1;
+ }
+
+ asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate"
+ : /*no outputs */
+ : /*no inputs */
+ : "eax","ebx","ecx","edx","cc");
+
+ ioenabled = TRUE;
+ return 0;
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'.
+ * This is a no op here: I/O access is implicitly enabled for this
+ * process through a special library.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ *
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+ DosSleep(Delay ? Delay : 1);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c
new file mode 100644
index 000000000..c0b198520
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c
@@ -0,0 +1,435 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_SYSV.c,v 3.19 1999/03/07 14:05:07 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+/* $XConsortium: OS_SYSV.c /main/13 1996/10/25 11:33:20 kaleb $ */
+
+#if defined(sun)
+/* Fix for Solaris */
+#define __EXTENSIONS__
+#endif
+
+#include "Probe.h"
+
+#include <fcntl.h>
+#if defined(SCO) || defined(ESIX)
+# include <sys/types.h>
+#endif
+#ifdef SYSV
+# if !defined(O_NDELAY) && defined(O_NONBLOCK)
+# define O_NDELAY O_NONBLOCK
+# endif
+# ifndef SCO
+# include <sys/at_ansi.h>
+# endif
+# include <sys/param.h>
+#endif
+#ifdef SCO
+# include <sys/vtkd.h>
+# include <sys/console.h>
+#ifdef SCO
+#undef _status
+#endif
+#else
+# include <sys/kd.h>
+# if !defined(sun)
+# include <sys/vt.h>
+# endif
+#endif
+#include <sys/immu.h>
+#if !defined(sun)
+# include <sys/region.h>
+#endif
+#include <sys/proc.h>
+#include <sys/tss.h>
+#ifdef NCR
+/* broken NCR <sys/sysi86.h> */
+#define __STDC
+#include <sys/sysi86.h>
+#undef __STDC
+#else
+#include <sys/sysi86.h>
+#endif
+#ifdef SVR4
+# if !defined(sun)
+# include <sys/seg.h>
+# endif
+#endif
+#ifndef V86SC_IOPL
+# include <sys/v86.h>
+#endif
+#if defined(sun)
+# include <sys/psw.h>
+#endif
+
+#ifdef __STDC__
+int sysi86(int, ...);
+int syscall(int, ...);
+#ifndef SCO
+int munmap(caddr_t, size_t);
+#endif
+#else
+int sysi86();
+int syscall();
+#ifndef SCO
+int munmap();
+#endif
+#endif
+
+#ifdef SVR4
+# include <sys/mman.h>
+# if defined(sun)
+# define DEV_MEM "/dev/fb"
+# else
+# ifdef SCO325
+# define DEV_MEM "/dev/mem"
+# else
+# define DEV_MEM "/dev/pmem"
+# endif
+# endif
+#else
+# define DEV_MEM "/dev/mem"
+#endif
+
+#ifndef SI86IOPL
+#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+#define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+#else
+#define SET_IOPL() sysi86(SI86IOPL,3)
+#define RESET_IOPL() sysi86(SI86IOPL,0)
+#endif
+
+static int VT_fd = -1;
+static int VT_num = -1;
+static int BIOS_fd = -1;
+
+/*
+ * OpenVideo --
+ *
+ * Enable access to the installed video hardware. For SYSV, open a new
+ * VT if not running on a VT. Also, disable IO protection, since we may
+ * need to get at extended registers.
+ */
+int OpenVideo()
+{
+ int fd;
+ char fn[20];
+
+ if (geteuid() != 0)
+ {
+ fprintf(stderr,
+ "%s: Must be run as root\n",
+ MyName);
+ return(-1);
+ }
+ if (ioctl(0, KIOCINFO, 0) == (('k'<<8)|'d'))
+ {
+ VT_fd = 0;
+ }
+ else
+ {
+
+#if !defined(sun)
+ if ((fd = open("/dev/console", O_RDWR, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Cannot open /dev/console\n",
+ MyName);
+ return(-1);
+ }
+ if ((ioctl(fd, VT_OPENQRY, &VT_num) < 0) || (VT_num == -1))
+ {
+ fprintf(stderr, "%s: No free VTs\n", MyName);
+ return(-1);
+ }
+ close(fd);
+ sprintf(fn, "/dev/vt%02d", VT_num);
+#else
+ sprintf(fn, "/dev/fb");
+#endif
+
+ if ((VT_fd = open(fn, O_RDWR|O_NDELAY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: Could not open VT %s\n",
+ MyName, fn);
+ return(-1);
+ }
+#if !defined(SCO) && !defined(sun)
+ if (ioctl(VT_fd, VT_WAITACTIVE, VT_num) != 0)
+ {
+ fprintf(stderr, "%s: VT_WAITACTIVE failed!\n", MyName);
+ return(-1);
+ }
+#endif /* SCO */
+ /*
+ * Give the other VT time to release.
+ */
+ sleep(1);
+ }
+ (void)SET_IOPL();
+ return(VT_fd);
+}
+
+/*
+ * CloseVideo --
+ *
+ * Disable access to the video hardware. For SYSV, close the VT if it's open.
+ * Also, re-enable IO protection.
+ */
+void CloseVideo()
+{
+ if (VT_fd != -1)
+ {
+ (void)RESET_IOPL();
+ }
+ if (VT_fd > 0)
+ {
+ close(VT_fd);
+ }
+}
+
+/*
+ * MapVGA --
+ *
+ * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
+ * the process for use in probing memory.
+ */
+Byte *MapVGA()
+{
+#if defined(SVR4)
+ int fd;
+ Byte *base;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) < 0)
+ {
+ fprintf(stderr, "%s: Failed to open %s\n", MyName, DEV_MEM);
+ return((Byte *)0);
+ }
+ base = (Byte *)mmap((caddr_t)0, 0x10000, PROT_READ|PROT_WRITE,
+ MAP_SHARED, fd, (off_t)0xA0000);
+ close(fd);
+ if ((long)base == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+#elif defined(OLDSCO)
+ static Byte *base = (Byte *)0;
+ ioctl(VT_fd, KDSETMODE, KD_GRAPHICS);
+ if (base == (Byte *) 0)
+ base = (Byte *) ioctl(VT_fd, MAPCONS, 0L);
+#else /* SVR4 */
+ static Byte *base = (Byte *)0;
+ static struct kd_memloc vgaDSC;
+
+ ioctl(VT_fd, KDSETMODE, KD_GRAPHICS);
+ if (base == (Byte *)0)
+ {
+ base = (Byte *)(((unsigned int)malloc(0x11000) & ~0xFFF)
+ + 0x1000);
+ vgaDSC.vaddr = (char *)base;
+ vgaDSC.physaddr = (char *)0xA0000;
+ vgaDSC.length = 0x10000;
+ vgaDSC.ioflg = 1;
+ }
+ if (ioctl(VT_fd, KDMAPDISP, &vgaDSC) < 0)
+ {
+ fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
+ return((Byte *)0);
+ }
+#endif /* SVR4 */
+ return(base);
+}
+
+Byte *MapMem(address,size)
+ unsigned long address;
+ unsigned long size;
+{
+ return((Byte*)0);
+}
+
+/*
+ * UnMapVGA --
+ *
+ * Unmap the VGA memory window.
+ */
+void UnMapVGA(base)
+Byte *base;
+{
+#ifdef SVR4
+ munmap((caddr_t)base, 0x10000);
+#else /* SVR4 */
+# ifndef SCO
+ ioctl(VT_fd, KDUNMAPDISP, 0);
+# endif
+ ioctl(VT_fd, KDSETMODE, KD_TEXT);
+#endif
+}
+
+void UnMapMem(base,size)
+ Byte *base;
+ unsigned long size;
+{
+ return;
+}
+
+/*
+ * ReadBIOS --
+ *
+ * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
+ * buffer 'Buffer'.
+ */
+int ReadBIOS(Offset, Buffer, Len)
+unsigned Offset;
+Byte *Buffer;
+int Len;
+{
+#ifndef SVR4
+ Word tmp;
+ Byte *Base = Bios_Base + Offset;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open %s\n",
+ MyName, DEV_MEM);
+ return(-1);
+ }
+ }
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ /*
+ * Sanity check...
+ */
+ (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET);
+ (void)read(BIOS_fd, &tmp, 2);
+ if (tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ return(-1);
+ }
+ }
+ if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0)
+ {
+ fprintf(stderr, "%s: BIOS seek failed\n", MyName);
+ return(-1);
+ }
+ if (read(BIOS_fd, Buffer, Len) != Len)
+ {
+ fprintf(stderr, "%s: BIOS read failed\n", MyName);
+ return(-1);
+ }
+ return(Len);
+#else /* SVR4 */
+ Byte *Base = Bios_Base + Offset;
+ Word *tmp;
+ Byte *ptr;
+ unsigned long page_offset = (unsigned long)Base & 0xFFF;
+ unsigned long mmap_base = (unsigned long)Base & ~0xFFF;
+ unsigned long mmap_len = Len + page_offset;
+
+ if (BIOS_fd == -1)
+ {
+ if ((BIOS_fd = open(DEV_MEM, O_RDONLY, 0)) < 0)
+ {
+ fprintf(stderr, "%s: cannot open %s\n",
+ MyName, DEV_MEM);
+ return(-1);
+ }
+ }
+ if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0)
+ {
+ tmp = (Word *)mmap((caddr_t)0, 0x1000, PROT_READ, MAP_SHARED,
+ BIOS_fd, (off_t)((off_t)Base & 0xF8000));
+ if ((int)tmp == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n",
+ MyName, DEV_MEM, (int)Base);
+ return(-1);
+ }
+ if (*tmp != (Word)0xAA55)
+ {
+ fprintf(stderr,
+ "%s: BIOS sanity check failed, addr=%x\n",
+ MyName, (int)Base);
+ return(-1);
+ }
+ (void)munmap((caddr_t)tmp, 0x1000);
+ }
+ ptr = (Byte *)mmap((caddr_t)0, mmap_len, PROT_READ, MAP_SHARED,
+ BIOS_fd, (off_t)mmap_base);
+ if ((int)ptr == -1)
+ {
+ fprintf(stderr, "%s: Failed to mmap() %s, addr=%x\n",
+ MyName, DEV_MEM, (int)Base);
+ return(-1);
+ }
+ (void)memcpy((void *)Buffer, (void *)(ptr + page_offset), Len);
+ (void)munmap((caddr_t)ptr, mmap_len);
+ return(Len);
+#endif /* SVR4 */
+}
+
+/*
+ * EnableIOPort --
+ *
+ * Enable access to 'NumPorts' IO ports listed in array 'Ports'. For SYSV,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int EnableIOPorts(NumPorts, Ports)
+CONST int NumPorts;
+CONST Word *Ports;
+{
+ return(0);
+}
+
+/*
+ * DisableIOPort --
+ *
+ * Disable access to 'NumPorts' IO ports listed in array 'Ports'. For SYSV,
+ * we've disabled IO protections so this is a no-op.
+ */
+/*ARGSUSED*/
+int DisableIOPorts(NumPorts, Port)
+CONST int NumPorts;
+CONST Word *Port;
+{
+ return(0);
+}
+
+/*
+ * ShortSleep --
+ *
+ * Sleep for the number of milliseconds specified in 'Delay'.
+ */
+void ShortSleep(Delay)
+int Delay;
+{
+ syscall(3112, Delay);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c
new file mode 100644
index 000000000..ea0d71c3b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c
@@ -0,0 +1,145 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Oak.c,v 3.4 1996/12/23 06:31:29 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+/* $XConsortium: Oak.c /main/5 1996/02/21 17:11:32 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3DE, 0x3DF};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Oak __STDCARGS((int));
+
+Chip_Descriptor Oak_Descriptor = {
+ "Oak",
+ Probe_Oak,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Oak,
+};
+
+Bool Probe_Oak(Chipset)
+int *Chipset;
+{
+ Byte temp;
+ Bool result = FALSE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (testinx2(0x3DE, 0x0D, 0x38))
+ {
+ result = TRUE;
+ if (testinx2(0x3DE, 0x23, 0x1F))
+ {
+ if ((rdinx(0x3DE, 0x00) & 0x02) == 0x00)
+ {
+ *Chipset = CHIP_OAK087;
+ }
+ else
+ {
+ *Chipset = CHIP_OAK083;
+ }
+ }
+ else
+ {
+ temp = inp(0x3DE) >> 5;
+ switch (temp)
+ {
+ case 0x00:
+ *Chipset = CHIP_OAK037C;
+ break;
+ case 0x02:
+ *Chipset = CHIP_OAK067;
+ break;
+ case 0x05:
+ *Chipset = CHIP_OAK077;
+ break;
+ case 0x07:
+ *Chipset = CHIP_OAK057;
+ break;
+ default:
+ Chip_data = temp;
+ *Chipset = CHIP_OAK_UNK;
+ break;
+ }
+ }
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_Oak(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ switch (Chipset)
+ {
+ case CHIP_OAK083:
+ case CHIP_OAK087:
+ switch (rdinx(0x3DE, 0x02) & 0x06)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x02:
+ Mem = 512;
+ break;
+ case 0x04:
+ Mem = 1024;
+ break;
+ case 0x06:
+ Mem = 2048;
+ break;
+ }
+ break;
+ default:
+ switch (rdinx(0x3DE, 0x0D) >> 6)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x02:
+ Mem = 512;
+ break;
+ case 0x01:
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+ break;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c
new file mode 100644
index 000000000..8adae61a6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c
@@ -0,0 +1,293 @@
+/*
+ * PCI Probe
+ *
+ * Copyright 1996 The XFree86 Project, Inc.
+ *
+ * A lot of this comes from Robin Cutshaw's scanpci
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.c,v 3.9 1999/03/14 03:21:42 dawes Exp $ */
+
+/* #define DEBUGPCI */
+
+#include "Probe.h"
+
+struct pci_config_reg *pci_devp[MAX_PCI_DEVICES + 1] = {NULL, };
+
+void
+xf86scanpci()
+{
+ unsigned long tmplong1, tmplong2, config_cmd, cmd;
+ unsigned char tmp1, tmp2;
+ unsigned int i, j, idx = 0;
+ int func;
+ struct pci_config_reg pcr;
+#ifdef PC98
+ Word PCI_CtrlIOPorts[] = { 0xCF8, 0xCF9, 0xCFC };
+#else
+ Word PCI_CtrlIOPorts[] = { 0xCF8, 0xCFA, 0xCFC };
+#endif
+ int Num_PCI_CtrlIOPorts = 3;
+ unsigned PCI_DevIOAddrPorts[16*16];
+ int Num_PCI_DevIOAddrPorts = 16*16;
+ int hostbridges = 0;
+
+ for (i=0; i<16; i++) {
+ for (j=0; j<16; j++)
+ PCI_DevIOAddrPorts[(i*16)+j] = 0xC000 + (i*0x0100) + (j*4);
+ }
+
+ /* Enable I/O access */
+ EnableIOPorts(Num_PCI_CtrlIOPorts,PCI_CtrlIOPorts);
+
+ outp(PCI_MODE2_ENABLE_REG, 0x00);
+ outp(PCI_MODE2_FORWARD_REG, 0x00);
+ tmp1 = inp(PCI_MODE2_ENABLE_REG);
+ tmp2 = inp(PCI_MODE2_FORWARD_REG);
+
+ if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
+ pcr._configtype = 2;
+#ifdef DEBUGPCI
+ printf("PCI says configuration type 2\n");
+#endif
+ } else {
+ tmplong1 = inpl(PCI_MODE1_ADDRESS_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, PCI_EN);
+ tmplong2 = inpl(PCI_MODE1_ADDRESS_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, tmplong1);
+ if (tmplong2 == PCI_EN) {
+ pcr._configtype = 1;
+#ifdef DEBUGPCI
+ printf("PCI says configuration type 1\n");
+#endif
+ } else {
+ pcr._configtype = 0;
+#ifdef DEBUGPCI
+ printf("No PCI !\n");
+#endif
+#if 0
+ DisableIOPorts(0);
+#endif
+ return;
+ }
+ }
+
+ /* Try pci config 1 probe first */
+
+#ifdef DEBUGPCI
+ printf("\nPCI probing configuration type 1\n");
+#endif
+
+ pcr._pcibuses[0] = 0;
+ pcr._pcinumbus = 1;
+ pcr._pcibusidx = 0;
+
+#ifndef DEBUGPCI
+ if (pcr._configtype == 1)
+#endif
+ do {
+ for (pcr._cardnum = 0x0; pcr._cardnum < 0x20; pcr._cardnum += 0x1) {
+ func = 0;
+ do { /* loop over different functions, if present */
+ config_cmd = PCI_EN | (pcr._pcibuses[pcr._pcibusidx]<<16) |
+ (pcr._cardnum<<11) | (func<<8);
+
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd); /* ioreg 0 */
+ pcr._device_vendor = inpl(PCI_MODE1_DATA_REG);
+
+ if (pcr._vendor == 0xFFFF) /* nothing there */
+ break;
+
+#ifdef DEBUGPCI
+ printf("\npci bus 0x%x cardnum 0x%02x, vendor 0x%04x device 0x%04x\n",
+ pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, pcr._vendor,
+ pcr._device);
+#endif
+
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x04);
+ pcr._status_command = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x08);
+ pcr._class_revision = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x0C);
+ pcr._bist_header_latency_cache = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x10);
+ pcr._base0 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x14);
+ pcr._base1 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x18);
+ pcr._base2 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x1C);
+ pcr._base3 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x20);
+ pcr._base4 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x24);
+ pcr._base5 = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x30);
+ pcr._baserom = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x3C);
+ pcr._max_min_ipin_iline = inpl(PCI_MODE1_DATA_REG);
+ outpl(PCI_MODE1_ADDRESS_REG, config_cmd | 0x40);
+ pcr._user_config = inpl(PCI_MODE1_DATA_REG);
+
+ pcr._funcnum = func;
+
+#if 1
+ /* check for pci-pci bridges */
+#define PCI_CLASS_MASK 0xff000000
+#define PCI_SUBCLASS_MASK 0x00ff0000
+#define PCI_CLASS_BRIDGE 0x06000000
+#define PCI_SUBCLASS_BRIDGE_PCI 0x00040000
+ switch(pcr._class_revision & (PCI_CLASS_MASK|PCI_SUBCLASS_MASK)) {
+ case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI:
+ if (pcr._secondary_bus_number > 0) {
+ pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
+ }
+ break;
+ case PCI_CLASS_BRIDGE:
+ if ( ++hostbridges > 1) {
+ pcr._pcibuses[pcr._pcinumbus] = pcr._pcinumbus;
+ pcr._pcinumbus++;
+ }
+ break;
+ default:
+ break;
+ }
+#else
+ /* check for pci-pci bridges (currently we only know Digital) */
+ if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001))
+ if (pcr._secondary_bus_number > 0)
+ pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
+#endif
+
+ if (idx >= MAX_PCI_DEVICES)
+ break;;
+
+ /* Ignore non-VGA devices */
+ if (!((pcr._base_class == PCI_CLASS_PREHISTORIC &&
+ pcr._sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) ||
+ (pcr._base_class == PCI_CLASS_DISPLAY &&
+ pcr._sub_class == PCI_SUBCLASS_DISPLAY_VGA) ||
+ (pcr._base_class == PCI_CLASS_DISPLAY &&
+ pcr._sub_class == PCI_SUBCLASS_DISPLAY_OTHER))) {
+ /*
+ * unfortunately, sometimes GLINT chips are strapped
+ * as class 0 subclass 0 by vendors...
+ */
+ if( pcr._vendor != PCI_VENDOR_3DLABS )
+ break;
+ }
+
+ if ((pci_devp[idx] = (struct pci_config_reg *)malloc(sizeof(
+ struct pci_config_reg))) == (struct pci_config_reg *)NULL) {
+ outpl(PCI_MODE1_ADDRESS_REG, 0x00);
+#if 0
+ DisableIOPorts(0);
+#endif
+ return;
+ }
+
+ memcpy(pci_devp[idx++], &pcr, sizeof(struct pci_config_reg));
+ pci_devp[idx] = NULL;
+ if((func==0) && ((pcr._header_type & PCI_MULTIFUNC_DEV) == 0)) {
+ /* not a multi function device */
+ func = 8;
+ } else {
+ func++;
+ }
+ } while (func<8);
+ }
+ } while (++pcr._pcibusidx < pcr._pcinumbus);
+
+#ifndef DEBUGPCI
+ if (pcr._configtype == 1) {
+ outpl(PCI_MODE1_ADDRESS_REG, 0x00);
+#if 0
+ xf86DisableIOPorts(0);
+#endif
+ return;
+ }
+#endif
+ /* Now try pci config 2 probe (deprecated) */
+
+ outp(PCI_MODE2_ENABLE_REG, 0xF1);
+ outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
+
+#ifdef DEBUGPCI
+ printf("\nPCI probing configuration type 2\n");
+#endif
+
+ pcr._pcibuses[0] = 0;
+ pcr._pcinumbus = 1;
+ pcr._pcibusidx = 0;
+
+ do {
+ for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){
+ outp(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
+ pcr._device_vendor = inpl(pcr._ioaddr);
+ outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
+
+ if (pcr._vendor == 0xFFFF) /* nothing there */
+ continue;
+ /* opti chipsets that use config type 1 look like this on type 2 */
+ if ((pcr._vendor == 0xFF00) && (pcr._device == 0xFFFF))
+ continue;
+
+#ifdef DEBUGPCI
+ printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n",
+ pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor,
+ pcr._device);
+#endif
+
+ outp(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */
+ pcr._status_command = inpl(pcr._ioaddr + 0x04);
+ pcr._class_revision = inpl(pcr._ioaddr + 0x08);
+ pcr._bist_header_latency_cache = inpl(pcr._ioaddr + 0x0C);
+ pcr._base0 = inpl(pcr._ioaddr + 0x10);
+ pcr._base1 = inpl(pcr._ioaddr + 0x14);
+ pcr._base2 = inpl(pcr._ioaddr + 0x18);
+ pcr._base3 = inpl(pcr._ioaddr + 0x1C);
+ pcr._base4 = inpl(pcr._ioaddr + 0x20);
+ pcr._base5 = inpl(pcr._ioaddr + 0x24);
+ pcr._baserom = inpl(pcr._ioaddr + 0x30);
+ pcr._max_min_ipin_iline = inpl(pcr._ioaddr + 0x3C);
+ pcr._user_config = inpl(pcr._ioaddr + 0x40);
+ outp(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */
+
+ /* check for pci-pci bridges (currently we only know Digital) */
+ if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001))
+ if (pcr._secondary_bus_number > 0)
+ pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number;
+
+ if (idx >= MAX_PCI_DEVICES)
+ continue;
+
+ /* Ignore non-VGA devices */
+ if (!((pcr._base_class == PCI_CLASS_PREHISTORIC &&
+ pcr._sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) ||
+ (pcr._base_class == PCI_CLASS_DISPLAY &&
+ pcr._sub_class == PCI_SUBCLASS_DISPLAY_VGA)))
+ continue;
+
+ if ((pci_devp[idx] = (struct pci_config_reg *)malloc(sizeof(
+ struct pci_config_reg))) == (struct pci_config_reg *)NULL) {
+ outp(PCI_MODE2_ENABLE_REG, 0x00);
+ outp(PCI_MODE2_FORWARD_REG, 0x00);
+#if 0
+ xf86DisableIOPorts(0);
+#endif
+ return;
+ }
+
+ memcpy(pci_devp[idx++], &pcr, sizeof(struct pci_config_reg));
+ pci_devp[idx] = NULL;
+ }
+ } while (++pcr._pcibusidx < pcr._pcinumbus);
+
+ outp(PCI_MODE2_ENABLE_REG, 0x00);
+ outp(PCI_MODE2_FORWARD_REG, 0x00);
+
+#if 0
+ DisableIOPorts(0);
+#endif
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h
new file mode 100644
index 000000000..394ae7d63
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h
@@ -0,0 +1,385 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PCI.h,v 3.32 1999/08/28 09:00:49 dawes Exp $ */
+/*
+ * PCI Probe
+ *
+ * Copyright 1995 The XFree86 Project, Inc.
+ *
+ * A lot of this comes from Robin Cutshaw's scanpci
+ *
+ */
+
+#ifndef _PCI_H
+#define _PCI_H
+
+/*
+ * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holder(s) make(s) no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+struct pci_config_reg {
+ /* start of official PCI config space header */
+ union {
+ unsigned long device_vendor;
+ struct {
+ unsigned short vendor;
+ unsigned short device;
+ } dv;
+ } dv_id;
+#define _device_vendor dv_id.device_vendor
+#define _vendor dv_id.dv.vendor
+#define _device dv_id.dv.device
+ union {
+ unsigned long status_command;
+ struct {
+ unsigned short command;
+ unsigned short status;
+ } sc;
+ } stat_cmd;
+#define _status_command stat_cmd.status_command
+#define _command stat_cmd.sc.command
+#define _status stat_cmd.sc.status
+ union {
+ unsigned long class_revision;
+ struct {
+ unsigned char rev_id;
+ unsigned char prog_if;
+ unsigned char sub_class;
+ unsigned char base_class;
+ } cr;
+ } class_rev;
+#define _class_revision class_rev.class_revision
+#define _rev_id class_rev.cr.rev_id
+#define _prog_if class_rev.cr.prog_if
+#define _sub_class class_rev.cr.sub_class
+#define _base_class class_rev.cr.base_class
+ union {
+ unsigned long bist_header_latency_cache;
+ struct {
+ unsigned char cache_line_size;
+ unsigned char latency_timer;
+ unsigned char header_type;
+ unsigned char bist;
+ } bhlc;
+ } bhlc;
+#define _bist_header_latency_cache bhlc.bist_header_latency_cache
+#define _cache_line_size bhlc.bhlc.cache_line_size
+#define _latency_timer bhlc.bhlc.latency_timer
+#define _header_type bhlc.bhlc.header_type
+#define _bist bhlc.bhlc.bist
+ union {
+ struct {
+ unsigned long dv_base0;
+ unsigned long dv_base1;
+ unsigned long dv_base2;
+ unsigned long dv_base3;
+ unsigned long dv_base4;
+ unsigned long dv_base5;
+ } dv;
+ struct {
+ unsigned long bg_rsrvd[2];
+ unsigned char primary_bus_number;
+ unsigned char secondary_bus_number;
+ unsigned char subordinate_bus_number;
+ unsigned char secondary_latency_timer;
+ unsigned char io_base;
+ unsigned char io_limit;
+ unsigned short secondary_status;
+ unsigned short mem_base;
+ unsigned short mem_limit;
+ unsigned short prefetch_mem_base;
+ unsigned short prefetch_mem_limit;
+ } bg;
+ } bc;
+#define _base0 bc.dv.dv_base0
+#define _base1 bc.dv.dv_base1
+#define _base2 bc.dv.dv_base2
+#define _base3 bc.dv.dv_base3
+#define _base4 bc.dv.dv_base4
+#define _base5 bc.dv.dv_base5
+#define _primary_bus_number bc.bg.primary_bus_number
+#define _secondary_bus_number bc.bg.secondary_bus_number
+#define _subordinate_bus_number bc.bg.subordinate_bus_number
+#define _secondary_latency_timer bc.bg.secondary_latency_timer
+#define _io_base bc.bg.io_base
+#define _io_limit bc.bg.io_limit
+#define _secondary_status bc.bg.secondary_status
+#define _mem_base bc.bg.mem_base
+#define _mem_limit bc.bg.mem_limit
+#define _prefetch_mem_base bc.bg.prefetch_mem_base
+#define _prefetch_mem_limit bc.bg.prefetch_mem_limit
+ unsigned long rsvd1;
+ unsigned long rsvd2;
+ unsigned long _baserom;
+ unsigned long rsvd3;
+ unsigned long rsvd4;
+ union {
+ unsigned long max_min_ipin_iline;
+ struct {
+ unsigned char int_line;
+ unsigned char int_pin;
+ unsigned char min_gnt;
+ unsigned char max_lat;
+ } mmii;
+ } mmii;
+#define _max_min_ipin_iline mmii.max_min_ipin_iline
+#define _int_line mmii.mmii.int_line
+#define _int_pin mmii.mmii.int_pin
+#define _min_gnt mmii.mmii.min_gnt
+#define _max_lat mmii.mmii.max_lat
+ /* I don't know how accurate or standard this is (DHD) */
+ union {
+ unsigned long user_config;
+ struct {
+ unsigned char user_config_0;
+ unsigned char user_config_1;
+ unsigned char user_config_2;
+ unsigned char user_config_3;
+ } uc;
+ } uc;
+#define _user_config uc.user_config
+#define _user_config_0 uc.uc.user_config_0
+#define _user_config_1 uc.uc.user_config_1
+#define _user_config_2 uc.uc.user_config_2
+#define _user_config_3 uc.uc.user_config_3
+ /* end of official PCI config space header */
+ unsigned long _pcibusidx;
+ unsigned long _pcinumbus;
+ unsigned long _pcibuses[16];
+ unsigned short _configtype; /* config type found */
+ unsigned short _ioaddr; /* config type 1 - private I/O addr */
+ unsigned long _cardnum; /* config type 2 - private card number */
+ unsigned short _funcnum; /* private function number */
+};
+
+#define PCI_EN 0x80000000
+#define MAX_PCI_DEVICES 64
+#define PCI_MULTIFUNC_DEV 0x80
+
+/* Registers */
+#define PCI_REG_USERCONFIG 0x40
+
+/* Base Classes */
+#define PCI_CLASS_PREHISTORIC 0x00
+#define PCI_CLASS_DISPLAY 0x03
+
+/* Sub Classes */
+#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01
+#define PCI_SUBCLASS_DISPLAY_VGA 0x00
+#define PCI_SUBCLASS_DISPLAY_OTHER 0x80
+
+/* PCI Configuration address */
+#define PCI_MODE1_ADDRESS_REG 0xCF8
+#define PCI_MODE1_DATA_REG 0xCFC
+
+#define PCI_MODE2_ENABLE_REG 0xCF8
+#ifdef PC98
+#define PCI_MODE2_FORWARD_REG 0xCF9
+#else
+#define PCI_MODE2_FORWARD_REG 0xCFA
+#endif
+
+extern struct pci_config_reg *pci_devp[];
+
+#define PCI_VENDOR_NCR_1 0x1000
+#define PCI_VENDOR_ATI 0x1002
+#define PCI_VENDOR_AVANCE 0x1005
+#define PCI_VENDOR_TSENG 0x100C
+#define PCI_VENDOR_WEITEK 0x100E
+#define PCI_VENDOR_DIGITAL 0x1011
+#define PCI_VENDOR_CIRRUS 0x1013
+#define PCI_VENDOR_NCR_2 0x101A
+#define PCI_VENDOR_TRIDENT 0x1023
+#define PCI_VENDOR_MATROX 0x102B
+#define PCI_VENDOR_CHIPSTECH 0x102C
+#define PCI_VENDOR_SIS 0x1039
+#define PCI_VENDOR_SGS 0x104A
+#define PCI_VENDOR_NUMNINE 0x105D
+#define PCI_VENDOR_UMC 0x1060
+#define PCI_VENDOR_NVIDIA 0x10DE
+#define PCI_VENDOR_ALLIANCE 0x1142
+#define PCI_VENDOR_TRITECH 0x1292
+#define PCI_VENDOR_NVIDIA_SGS 0x12D2
+#define PCI_VENDOR_RENDITION 0x1163
+#define PCI_VENDOR_SIGMADESIGNS 0x1236
+#define PCI_VENDOR_S3 0x5333
+#define PCI_VENDOR_ARK 0xEDD8
+#define PCI_VENDOR_3DLABS 0x3D3D
+#define PCI_VENDOR_INTERGRAPHICS 0x10EA
+
+/* Matrox */
+#define PCI_CHIP_MGA2085PX 0x0518
+#define PCI_CHIP_MGA2064W 0x0519
+#define PCI_CHIP_MGA1064SG 0x051A
+#define PCI_CHIP_MGA2164W 0x051B
+#define PCI_CHIP_MGA2164W_AGP 0x051F
+#define PCI_CHIP_MGAG100_PCI 0x1000
+#define PCI_CHIP_MGAG100_AGP 0x1001
+#define PCI_CHIP_MGAG200_PCI 0x0520
+#define PCI_CHIP_MGAG200_AGP 0x0521
+
+/* ATI */
+#define PCI_CHIP_MACH32 0x4158
+ /* Other ATI ChipID's deleted; not used by SuperProbe */
+
+/* Avance Logic */
+#define PCI_CHIP_ALG2301 0x2301
+
+/* Tseng */
+#define PCI_CHIP_ET4000_W32P_A 0x3202
+#define PCI_CHIP_ET4000_W32P_B 0x3205
+#define PCI_CHIP_ET4000_W32P_D 0x3206
+#define PCI_CHIP_ET4000_W32P_C 0x3207
+#define PCI_CHIP_ET6000 0x3208
+#define PCI_CHIP_ET6300 0x4702
+
+/* Weitek */
+#define PCI_CHIP_P9000 0x9001
+#define PCI_CHIP_P9100 0x9100
+
+/* Cirrus Logic */
+#define PCI_CHIP_GD7548 0x0038
+#define PCI_CHIP_GD5430 0x00A0
+#define PCI_CHIP_GD5434_4 0x00A4
+#define PCI_CHIP_GD5434_8 0x00A8
+#define PCI_CHIP_GD5436 0x00AC
+#define PCI_CHIP_GD5446 0x00B8
+#define PCI_CHIP_GD5480 0x00BC
+#define PCI_CHIP_GD5462 0x00D0
+#define PCI_CHIP_GD5464 0x00D4
+#define PCI_CHIP_GD5464BD 0x00D5
+#define PCI_CHIP_GD5465 0x00D6
+#define PCI_CHIP_GD7542 0x1200
+#define PCI_CHIP_GD7543 0x1202
+#define PCI_CHIP_GD7541 0x1204
+
+/* Trident */
+#define PCI_CHIP_9320 0x9320
+#define PCI_CHIP_9420 0x9420
+#define PCI_CHIP_9440 0x9440
+#define PCI_CHIP_9660 0x9660
+#define PCI_CHIP_9680 0x9680
+#define PCI_CHIP_9682 0x9682
+/* Bill Mair */
+#define PCI_CHIP_939A 0x939A
+#define PCI_CHIP_9388 0x9388
+#define PCI_CHIP_9397 0x9397
+#define PCI_CHIP_9520 0x9520
+#define PCI_CHIP_9750 0x9750
+#define PCI_CHIP_9850 0x9850
+
+/* Chips & Tech */
+#define PCI_CHIP_65545 0x00D8
+#define PCI_CHIP_65548 0x00DC
+#define PCI_CHIP_65550 0x00E0
+#define PCI_CHIP_65554 0x00E4
+#define PCI_CHIP_65555 0x00E5
+#define PCI_CHIP_68554 0x00F4
+
+/* SiS */
+#define PCI_CHIP_SG86C201 0x0001
+#define PCI_CHIP_SG86C202 0x0002
+#define PCI_CHIP_SG86C205 0x0205
+#define PCI_CHIP_SG86C215 0x0215
+#define PCI_CHIP_SG86C225 0x0225
+#define PCI_CHIP_SIS5598 0x0200
+#define PCI_CHIP_SIS5597 0x0200
+#define PCI_CHIP_SIS6326 0x6326
+#define PCI_CHIP_SIS530 0x6306
+#define PCI_CHIP_SIS620 0x6306
+
+/* SGS */
+#define PCI_CHIP_STG2000 0x0008
+#define PCI_CHIP_STG1764 0x0009
+
+/* NVIDIA */
+#define PCI_CHIP_NV1 0x0008
+#define PCI_CHIP_DAC64 0x0009
+
+/* NVIDIA & SGS */
+#define PCI_CHIP_RIVA128 0x0018
+
+/* Number Nine */
+#define PCI_CHIP_I128 0x2309
+#define PCI_CHIP_I128_2 0x2339
+#define PCI_CHIP_I128_3 0x493D
+
+/* Alliance Semiconductor */
+#define PCI_CHIP_PM6410 0x3210
+#define PCI_CHIP_PM6422 0x6422
+#define PCI_CHIP_PMAT24 0x6424
+#define PCI_CHIP_PMAT3D 0x643D
+
+/* Rendition */
+#define PCI_CHIP_V1000 0x0001
+#define PCI_CHIP_V2000 0x0002 /* just guessing */
+
+
+/* SIGMA DESIGNS */
+#define PCI_CHIP_SD_REALMAGIG64GX 0x6401
+
+/* S3 */
+#define PCI_CHIP_TRIO 0x8811
+#define PCI_CHIP_AURORA64VP 0x8812
+#define PCI_CHIP_TRIO64UVP 0x8814
+#define PCI_CHIP_TRIO64V2_DXGX 0x8901
+#define PCI_CHIP_PLATO_PX 0x8902
+#define PCI_CHIP_868 0x8880
+#define PCI_CHIP_928 0x88B0
+#define PCI_CHIP_864_0 0x88C0
+#define PCI_CHIP_864_1 0x88C1
+#define PCI_CHIP_964_0 0x88D0
+#define PCI_CHIP_964_1 0x88D1
+#define PCI_CHIP_968 0x88F0
+#define PCI_CHIP_ViRGE 0x5631
+#define PCI_CHIP_ViRGE_VX 0x883D
+#define PCI_CHIP_ViRGE_DXGX 0x8A01
+#define PCI_CHIP_ViRGE_GX2 0x8A10
+#define PCI_CHIP_ViRGE_MX 0x8C01
+#define PCI_CHIP_ViRGE_MXP 0x8C03
+#define PCI_CHIP_TRIO3D_B 0x8903
+#define PCI_CHIP_TRIO3D 0x8904
+#define PCI_CHIP_SAVAGE3D 0x8A20
+#define PCI_CHIP_SAVAGE3D_M 0x8A21
+
+/* ARK Logic */
+#define PCI_CHIP_1000PV 0xA091
+#define PCI_CHIP_2000PV 0xA099
+#define PCI_CHIP_2000MT 0xA0A1
+#define PCI_CHIP_2000MI 0xA0A9
+
+/* 3Dlabs */
+#define PCI_CHIP_3DLABS_300SX 0x0001
+#define PCI_CHIP_3DLABS_500TX 0x0002
+#define PCI_CHIP_3DLABS_DELTA 0x0003
+#define PCI_CHIP_3DLABS_PERMEDIA 0x0004
+
+/* Tritech Microelectronics */
+#define PCI_CHIP_TR25202 0xFC02
+
+/* Intergraphics */
+#define PCI_CHIP_INTERG_1680 0x1680
+#define PCI_CHIP_INTERG_1682 0x1682
+
+/* Increase this as required */
+#define MAX_DEV_PER_VENDOR 18
+
+#endif /* _PCI_H */
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h
new file mode 100644
index 000000000..e3784bbc4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h
@@ -0,0 +1,35 @@
+/* $XConsortium: PatchLevel.h /main/15 1996/10/28 04:46:29 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/PatchLevel.h,v 3.24 1999/06/06 08:48:42 dawes Exp $ */
+
+#define VERSION 2
+#define PATCHLEV 20
+#define RELDATE "4 June 1999"
+#define PRINT_VERSION printf("\n%s Version %d.%d (%s)\n", \
+ MyName,VERSION,PATCHLEV,RELDATE)
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c
new file mode 100644
index 000000000..72a15d96d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c
@@ -0,0 +1,64 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Primus.c,v 3.4 1996/12/23 06:31:31 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Primus.c /main/5 1996/02/21 17:11:57 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {GRC_IDX, GRC_REG, 0x3D6, 0x3D7};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor Primus_Descriptor = {
+ "Primus",
+ Probe_Primus,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_Primus(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (testinx2(GRC_IDX, 0x3D, 0x3F) &&
+ tstrg(0x3D6, 0x1F) &&
+ tstrg(0x3D7, 0x1F))
+ {
+ result = TRUE;
+ *Chipset = CHIP_P2000;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c
new file mode 100644
index 000000000..b8ecb6dd7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c
@@ -0,0 +1,383 @@
+/* $XConsortium: Print.c /main/25 1996/10/28 04:46:33 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Print.c,v 3.66 1999/07/19 13:36:14 dawes Exp $ */
+
+#include "Probe.h"
+
+static CONST char *SVGA_Names[NUM_VENDORS+1][CHPS_PER_VENDOR] =
+{
+/* dummy */ { "" },
+/* Ahead */ { "Ahead (chipset unknown)",
+ "Ahead V5000 Version A", "Ahead V5000 Version B" },
+/* ATI */ { "ATI (chipset unknown)",
+ "ATI 18800", "ATI 18800-1",
+ "ATI 28800-2", "ATI 28800-4", "ATI 28800-5", "ATI 28800-6",
+ "ATI 68800-3", "ATI 68800-6", "ATI 68800LX", "ATI 68800AX",
+ "ATI 88800GX-C", "ATI 88800GX-D", "ATI 88800GX-E",
+ "ATI 88800GX-F",
+ "ATI 88800CX",
+ "ATI 264CT", "ATI 264ET",
+ "ATI 264VT", "ATI 264VT-B", "ATI 264VT3", "ATI 264VT4",
+ "ATI 264GT (3D Rage I)", "ATI 264GT-B (3D Rage II)",
+ "ATI 264GT-B+DVD (3D Rage II+DVD)",
+ "ATI 264GT-IIc (3D Rage IIc)", "ATI 264GT3 (3D Rage Pro)",
+ "ATI 264LT", "ATI 264LT Pro (3D Rage LT Pro)",
+ "ATI Rage XL or XC" },
+/* AL */ { "Avance Logic (chipset unknown)",
+ "Avance Logic 2101", "Avance Logic 2228" },
+/* CT */ { "Chips & Tech (chipset unknown)",
+ "Chips & Tech 82c450", "Chips & Tech 82c451",
+ "Chips & Tech 82c452", "Chips & Tech 82c453",
+ "Chips & Tech 82c455", "Chips & Tech 82c456",
+ "Chips & Tech 82c457", "Chips & Tech F65510",
+ "Chips & Tech F65520", "Chips & Tech F65530",
+ "Chips & Tech F65540", "Chips & Tech F65545",
+ "Chips & Tech F65548", "Chips & Tech F65546",
+ "Chips & Tech F65550", "Chips & Tech F65554",
+ "Chips & Tech F65555", "Chips & Tech F68554",
+ "Chips & Tech F69000", "Chips & Tech F69030",
+ "Chips & Tech F64200 WinGine",
+ "Chips & Tech F64300 WinGine" },
+/* Cirrus */ { "Cirrus (chipset unknown)",
+ "Cirrus CL-GD 510/520", "Cirrus CL-GD 610/620",
+ "Cirrus Video7 OEM",
+ "Cirrus/AcuMos AVGA2",
+ "Cirrus CL-GD5402", "Cirrus CL-GD5402 Rev 1",
+ "Cirrus CL-GD5420", "Cirrus CL-GD5420 Rev 1",
+ "Cirrus CL-GD5422", "Cirrus CL-GD5424",
+ "Cirrus CL-GD5426", "Cirrus CL-GD5428",
+ "Cirrus CL-GD5429",
+ "Cirrus CL-GD5430/40", "Cirrus CL-GD5434",
+ "Cirrus CL-GD6205", "Cirrus CL-GD6215",
+ "Cirrus CL-GD6225", "Cirrus CL-GD6235",
+ "Cirrus CL-GD5410",
+ "Cirrus CL-GD6410", "Cirrus CL-GD6412",
+ "Cirrus CL-GD6420A", "Cirrus CL-GD6420B",
+ "Cirrus CL-GD6440",
+ "Cirrus CL-GD5436",
+ "Cirrus CL-GD7541", "Cirrus CL-GD7542",
+ "Cirrus CL-GD7543",
+ "Cirrus CL-GD5446",
+ "Cirrus CL-GD5462",
+ "Cirrus CL-GD7548",
+ "Cirrus CL-GD5464",
+ "Cirrus CL-GD5480",
+ "Cirrus CL-GD5465",
+ },
+/* Compaq */ { "Compaq (chipset unknown)",
+ "Compaq Int. Vid. Graphics Sys.",
+ "Compaq Advanced VGA",
+ "Compaq QVision/1024", "Compaq QVision/1280",
+ "Compaq Advanced VGA, Portable" },
+/* Genoa */ { "Genoa GVGA 6100",
+ "Genoa GVGA 6200/6300", "Genoa GVGA 6400/6600" },
+/* HMC */ { "HMC HM86304" },
+/* MX */ { "MX 68000", "MX 68010" },
+/* NCR */ { "NCR (chipset unknown)",
+ "NCR 77C21", "NCR 77C22", "NCR 77C22E", "NCR 77C22E+",
+ "NCR 77C32BLT" },
+/* Oak */ { "Oak (chipset unknown)",
+ "Oak OTI037C",
+ "Oak OTI-057", "Oak OTI-067", "Oak OTI-077",
+ "Oak OTI-083", "Oak OTI-087" },
+/* Primus */ { "Primus P2000" },
+/* Realtek */ { "Realtek (chipset unknown)",
+ "Realtek RT-3103", "Realtek RT-3105", "Realtek RT-3106" },
+/* Rendition */ { "Rendition V1000", "Rendition V2000" },
+/* S3 */ { "S3 (chipset unknown)",
+ "S3 86C911", "S3 86C924",
+ "S3 86C801, A or B-step",
+ "S3 86C801, C-step", "S3 86C801, D-step",
+ "S3 86C801i",
+ "S3 86C805, A or B-step",
+ "S3 86C805, C-step", "S3 86C805, D-step",
+ "S3 86C805i",
+ "S3 86C928, A,B,C, or D-step", "S3 86C928, E-step",
+ "S3 86C928PCI",
+ "S3 Vision864",
+ "S3 Vision964",
+ "S3 Vision866",
+ "S3 Vision868",
+ "S3 Vision968",
+ "S3 Trio32",
+ "S3 Trio64",
+ "S3 Trio64V+",
+ "S3 Vision968 & 3Dlabs 300SX",
+ "S3 Vision968 & 3Dlabs (unknown)",
+ "S3 ViRGE",
+ "S3 ViRGE/VX",
+ "S3 Aurora64V+",
+ "S3 Trio64UV+",
+ "S3 Trio64V2/DX",
+ "S3 Trio64V2/GX",
+ "S3 ViRGE/DX",
+ "S3 ViRGE/GX",
+ "S3 PLATO/PX",
+ "S3 ViRGE/GX2",
+ "S3 ViRGE/MX",
+ "S3 ViRGE/MXP",
+ "S3 Trio3D Business",
+ "S3 Trio3D",
+ "S3 Savage3D",
+ "S3 Savage3D (Macrovision Support)",
+ },
+/* Trident */ { "Trident (chipset unknown)",
+ "Trident LX8200",
+ "Trident 8800BR", "Trident 8800CS",
+ "Trident 8900B", "Trident 8900C", "Trident 8900CL/8900D",
+ "Trident 9000", "Trident 9000i",
+ "Trident LCD9100B", "Trident 9200CXr", "Trident LCD9320",
+ "Trident 9400CXi", "Trident GUI 9420", "Trident GUI 9420DGi",
+ "Trident GUI 9440AGi", "Trident GUI 9660",
+ "Trident GUI 9680", "Trident ProVidia 9682",
+ "Trident ProVidia 9685", "Trident ProVidia 9692",
+ "Trident Cyber9382", "Trident Cyber9385",
+ "Trident Cyber9385-1",
+ "Trident Cyber9388", "Trident Cyber9388-1",
+ "Trident Cyber9397", "Trident Cyber9520",
+ "Trident 3DImage975", "Trident 3DImage985",
+/* Bill Mair */
+ "Trident Cyber9397 DVD"
+ },
+/* Tseng */ { "Tseng (chipset unknown)",
+ "Tseng ET3000", "Tseng ET4000",
+ "Tseng ET4000/W32", "Tseng ET4000/W32i",
+ "Tseng ET4000/W32p Rev A",
+ "Tseng ET4000/W32i Rev B",
+ "Tseng ET4000/W32i Rev C",
+ "Tseng ET4000/W32p Rev B",
+ "Tseng ET4000/W32p Rev C",
+ "Tseng ET4000/W32p Rev D",
+ "Tseng ET6000", "Tseng ET6100", "Tseng ET6300"
+ },
+/* UMC */ { "UMC 85c408" },
+/* Video7 */ { "Video7 (chipset unknown)",
+ "Video7 FastWrite/VRAM (HT208)", "Video7 1024i (HT208A)",
+ "Video7 VRAM II (HT208B)", "Video7 VRAM II (HT208C,D)",
+ "Video7 HT216B,C", "Video7 HT216D",
+ "Video7 HT216E", "Video7 HT216E",
+ "Video7 VEGA" },
+/* WD */ { "WD/Paradise (chipset unknown)",
+ "WD/Paradise PVGA1", "WD/Paradise 90C00",
+ "WD/Paradise 90C10", "WD/Paradise 90C11",
+ "WD/Paradise 90C20", "WD/Paradise 90C20A",
+ "WD/Paradise 90C22", "WD/Paradise 90C24",
+ "WD/Paradise 90C26", "WD/Paradise 90C27",
+ "WD/Paradise 90C30", "WD/Paradise 90C31",
+ "WD/Paradise 90C33" },
+/* Weitek */ { "Weitek (chipset unknown)",
+ "Weitek 5086", "Weitek 5186", "Weitek 5286" },
+/* Yamaha */ { "Yamaha 6388 VPDC" },
+/* SiS */ { "Silicon Integrated Systems (chipset unknown)",
+ "Silicon Integrated Systems SG86C201",
+ "Silicon Integrated Systems SG86C202",
+ "Silicon Integrated Systems SG86C205",
+ "Silicon Integrated Systems SG86C215",
+ "Silicon Integrated Systems SG86C225",
+ "Silicon Integrated Systems 5597/5598",
+ "Silicon Integrated Systems 530/620",
+ "Silicon Integrated Systems 6326 AGP",
+ },
+/* ARK */ { "ARK Logic (chipset unknown)",
+ "ARK Logic ARK1000VL",
+ "ARK Logic ARK1000PV",
+ "ARK Logic ARK2000PV",
+ "ARK Logic ARK2000MT",
+ "ARK Logic ARK2000MI (Quadro64)" },
+/* Alliance */ { "Alliance Semiconductor (chipset unknown)",
+ "Alliance Semiconductor ProMotion 6410",
+ "Alliance Semiconductor ProMotion 6422",
+ "Alliance Semiconductor ProMotion AT24" },
+/* Matrox */ { "Matrox (chipset unknown)",
+ "Matrox Atlas",
+ "Matrox Millennium",
+ "Matrox Mystique",
+ "Matrox Millennium II",
+ "Matrox Millennium II AGP",
+ "Matrox G100 PCI",
+ "Matrox G100 AGP",
+ "Matrox G200 PCI",
+ "Matrox G200 AGP" },
+/* Sigma Designs */ { "Sigma Designs (chipset unknown)",
+ "Sigma Designs REALmagic64/GX (SD 6425)" },
+/* Intergraphics */ { "Intergraphics (chipset unknown)",
+ "Intergraphics IGA-1680",
+ "Intergraphics IGA-1682" },
+/* Epson */ { "Epson SPC8110" },
+};
+
+static CONST char *Herc_Names[] =
+{
+ "", /* indices start at 1 */
+ "Standard",
+ "Plus",
+ "InColor",
+};
+
+struct RamDac_Name RamDac_Names[] =
+{
+ { "Unknown", "Non-standard but unknown DAC" },
+ { "Generic", "Generic 8-bit pseudo-color DAC" },
+ { "ALG1101", "Avance Logc ALG1101" },
+ { "SS2410", "Diamond SS2410 15/16/24-bit DAC" },
+ { "Sierra15", "Sierra SC1148{1,6,8} 15-bit HiColor DAC" },
+ { "Sierra16",
+ "Sierra SC1148{2,3,4} 15-bit or SC1148{5,7,9} 15/16-bit HiColor" },
+ { "Sierra24", "Sierra 1502{5,6} 15/16/24-bit DAC" },
+ { "MU9C4870", "MUSIC MU9C4870 15/16-bit HiColor DAC" },
+ { "MU9C4910", "MUSIC MU9C4910 15/16/24-bit DAC" },
+ { "ADAC1", "AcuMos ADAC1 15/16/24-bit DAC" },
+ { "68830", "ATI 68830 15/16-bit HiColor DAC" },
+ { "68860", "ATI 68860 15/15/24-bit DAC w/pixel-mux" },
+ { "68875", "ATI-68875/Bt885/TLC34075 15/16/24-bit DAC w/pixel-mux" },
+ { "ATIMisc",
+ "ATI Misc 3rd-party 15/16/24-bit DAC, probably BT481" },
+ { "Cirrus8", "Cirrus Logic Built-in 8-bit pseudo-color DAC" },
+ { "Cirrus24B", "Cirrus Logic Built-in 15/16/24-bit DAC" },
+ { "Cirrus24", "Cirrus Logic 15/16/24-bit DAC" },
+ { "20C490", "AT&T 20C490 15/16/24-bit DAC" },
+ { "20C491", "AT&T 20C491 15/16/24-bit DAC with gamma correction" },
+ { "20C492", "AT&T 20C492 15/16/18-bit DAC with gamma correction" },
+ { "20C493", "AT&T 20C493 15/16/18-bit DAC" },
+ { "20C497", "AT&T 20C497 24-bit wide, 8-bit pseudo-color DAC" },
+ { "Bt485", "BrookTree Bt485 24-bit TrueColor DAC w/cursor,pixel-mux" },
+ { "20C504", "AT&T 20C504 24-bit TrueColor DAC w/cursor,pixel-mux" },
+ { "20C505", "AT&T 20C505 24-bit TrueColor DAC w/cursor,pixel-mux" },
+ { "TVP3020",
+ "TI ViewPoint3020 24-bit TrueColor DAC w/cursor,pixel-mux" },
+ { "TVP3025",
+ "TI ViewPoint3025 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "EDSUN", "EDSUN CEG DAC" },
+ { "20C498", "AT&T 20C498/21C498 15/16/24-bit DAC w/pixel-mux" },
+ { "22C498", "AT&T 22C498 15/16/24-bit DAC w/pixel-mux" },
+ { "STG1700", "STG1700 15/16/24-bit DAC w/pixel-mux" },
+ { "S3_GENDAC", "S3 86C708 GENDAC 15/16/24-bit DAC w/clock-PLL" },
+ { "S3_SDAC", "S3 86C716 SDAC 15/16/24-bit DAC w/pixel-mux w/clock-PLL" },
+ { "TVP3026",
+ "TI ViewPoint3026 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "RGB524",
+ "IBM RGB524 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "RGB514/525",
+ "IBM RGB514/525 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "RGB528",
+ "IBM RGB528 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "STG1703", "STG1703 15/16/24-bit DAC w/pixel-mux,clock" },
+ { "20C409", "AT&T 20C409 15/16/24-bit DAC w/clock" },
+ { "20C499", "AT&T 20C499 15/16/24-bit DAC" },
+ { "TKD8001", "Trident Built-In 15/16/24-bit DAC" },
+ { "TGUIDAC", "Trident Built-In 15/16/24-bit DAC" },
+ { "Integrated", "ATI Mach64 integrated 15/16/24/32-bit DAC w/clock" },
+ { "MU9C1880", "Music 9C1880"},
+ { "IMSG174", "Inmos G-174" },
+ { "STG1702", "STG1702 15/16/24-bit DAC w/cursor,pixel-mux" },
+ { "CH8398", "Chrontel 8398 15/16/24-bit DAC w/clock"},
+ { "20C408", "AT&T 20C408 15/16/24-bit DAC w/clock" },
+ { "TVP3030",
+ "TI ViewPoint3030 24-bit TrueColor DAC w/cursor,pixel-mux,clock" },
+ { "ET6000",
+ "Tseng Labs ET6000 built-in 15/16/24-bit DAC w/pixel-mux,clock" },
+ { "w30C516",
+ "IC Works w30C516 ZOOMDAC 15/16/24-bit DAC or AT&T 20C498" },
+ { "PM642x",
+ "Alliance ProMotion built-in 15/16/24-bit DAC w/clock" },
+ { "ICS5341",
+ "ICS5341 SDAC 15/16/24-bit DAC w/pixel-mux w/clock-PLL" },
+ { "ICS5301",
+ "ICS5301 GENDAC 15/16/24-bit DAC w/clock-PLL" },
+ { "MGA1064SG",
+ "Matrox Mystique built-in DAC w/clock" },
+ { "MGAG100",
+ "Matrox G100 built-in DAC w/clock" },
+ { "MGAG200",
+ "Matrox G200 built-in DAC w/clock" },
+ { "SiS",
+ "SiS built-in DAC w/clock" },
+};
+
+static CONST char *CoProc_Names[NUM_CP_TYPES][CHPS_PER_CPTYPE] =
+{
+/* 8514 */ { "8514/A (or true clone)",
+ "ATI Mach8", "ATI Mach32",
+ "Chips & Technologies 82C480 (8514/A clone)" },
+/* XGA */ { "" },
+/* Mach64 */ { "ATI Mach64" },
+/* Number9 */ { "Number Nine Imagine I128" },
+/* GLINT */ { "","GLINT 300SX","GLINT 500TX","GLINT 300SX & 500TX",
+ "GLINT Delta","GLINT Delta & 300SX","GLINT Delta & 500TX",
+ "GLINT Delta & 300SX & 500TX" },
+};
+
+void Print_SVGA_Name(Chipset)
+int Chipset;
+{
+ int vendor = SVGA_VENDOR(Chipset);
+ int chip = SVGA_CHIP(Chipset);
+ printf("\tChipset: %s %s\n",
+ SVGA_Names[vendor][chip],
+ (PCIProbed ? "(PCI Probed)" : "(Port Probed)"));
+ if ((!chip) && (~Chip_data))
+ {
+ printf("\t\tSignature data: %x (please report)\n",
+ Chip_data);
+ }
+}
+
+void Print_Herc_Name(Chipset)
+int Chipset;
+{
+ int chip = HERC_CHIP(Chipset);
+ printf("\tChipset: %s\n", Herc_Names[chip]);
+}
+
+void Print_RamDac_Name(RamDac)
+int RamDac;
+{
+ printf("\tRAMDAC: %s\n", RamDac_Names[DAC_CHIP(RamDac)].Long);
+ if (RamDac & DAC_8BIT)
+ {
+ printf("\t\t (with 8-bit wide lookup tables)\n");
+ }
+ else
+ {
+ printf("\t\t (with 6-bit wide lookup tables ");
+ printf("(or in 6-bit mode))\n");
+ }
+ if (RamDac & DAC_6_8_PROGRAM)
+ {
+ printf("\t\t (programmable for 6/8-bit wide lookup tables)\n");
+ }
+}
+
+void Print_CoProc_Name(CoProc)
+int CoProc;
+{
+ int class = COPROC_CLASS(CoProc);
+ int chip = COPROC_CHIP(CoProc);
+ printf("\t\tChipset: %s\n", CoProc_Names[class][chip]);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h
new file mode 100644
index 000000000..040500206
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h
@@ -0,0 +1,751 @@
+/* $XConsortium: Probe.h /main/27 1996/10/25 21:19:15 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Probe.h,v 3.66 1999/08/28 09:00:50 dawes Exp $ */
+
+/*
+ * Includes
+ */
+
+#if defined(__STDC__) && defined(__GNUC__)
+#define inline __inline__
+#endif
+#ifdef _POSIX_SOURCE
+#include <sys/types.h>
+#endif
+#include <stdio.h>
+#ifndef MACH386
+#include <unistd.h>
+#include <stdlib.h>
+#endif /* MACH386 */
+#include <ctype.h>
+#if defined(SYSV) || defined(SVR4) || defined(linux)
+# include <string.h>
+# include <memory.h>
+#else
+#ifdef _MINIX
+# include <string.h>
+#else
+# include <strings.h>
+# define strchr(a,b) index((a),(b))
+# define strrchr(a,b) rindex((a),(b))
+#endif /* _MINIX */
+#endif
+
+#include "PCI.h"
+
+#ifdef __STDC__
+# define CONST const
+# define __STDCARGS(a) a
+#else
+# define CONST
+# define __STDCARGS(a) ()
+#endif
+
+/*
+ * Types
+ */
+typedef unsigned char Byte;
+typedef unsigned short Word;
+typedef unsigned long Long;
+typedef int Bool;
+#define FALSE 0
+#define TRUE 1
+#ifndef NULL
+# define NULL (void *)0
+#endif
+
+
+typedef struct {
+ Word lo, hi;
+} Range;
+
+typedef Bool (*ProbeFunc) __STDCARGS((int *));
+typedef int (*MemCheckFunc) __STDCARGS((int));
+typedef void (*SetBank) __STDCARGS((int, int, int));
+typedef void (*GetBank) __STDCARGS((int, int *, int *));
+typedef struct {
+ int chipset; /* Chipset for bank operations */
+ SetBank set_bank; /* Set a read/write bank */
+ GetBank get_bank; /* Get the current bank number */
+ int bank_size; /* Size of a memory bank */
+ int max_bank; /* Maximum bank number */
+} MemCheck_Descriptor;
+typedef struct {
+ char *name; /* Chipset vendor/class name */
+ ProbeFunc f; /* Probe function */
+ Word *ports; /* List of ports used by probe */
+ int num_ports; /* Number of ports in list */
+ Bool bit16; /* Does probe use 16-bit ports? */
+ Bool uses_bios; /* Does probe read the BIOS? */
+ Bool check_coproc; /* Check for attached coprocessor */
+ MemCheckFunc memcheck; /* For doing memory check */
+} Chip_Descriptor;
+
+/*
+ * Prototypes
+ */
+
+/* OS_xxxx.c */
+int OpenVideo __STDCARGS((void));
+void CloseVideo __STDCARGS((void));
+Byte *MapVGA __STDCARGS((void));
+void UnMapVGA __STDCARGS((Byte *));
+Byte *MapMem __STDCARGS((unsigned long, unsigned long));
+void UnMapMem __STDCARGS((Byte *, unsigned long));
+int ReadBIOS __STDCARGS((const unsigned, Byte *, const int));
+int EnableIOPorts __STDCARGS((const int, const Word *));
+int DisableIOPorts __STDCARGS((const int, const Word *));
+void ShortSleep __STDCARGS((const int Delay));
+
+/* Utils.c */
+Byte inp __STDCARGS((Word));
+Word inpw __STDCARGS((Word));
+Long inpl __STDCARGS((Word));
+void outp __STDCARGS((Word, Byte));
+void outpw __STDCARGS((Word, Word));
+void outpl __STDCARGS((Word, Long));
+Byte rdinx __STDCARGS((Word, Byte));
+void wrinx __STDCARGS((Word, Byte, Byte));
+void wrinx2 __STDCARGS((Word, Byte, Word));
+void wrinx3 __STDCARGS((Word, Byte, Long));
+void wrinx2m __STDCARGS((Word, Byte, Word));
+void wrinx3m __STDCARGS((Word, Byte, Long));
+void modinx __STDCARGS((Word, Byte, Byte, Byte));
+void modreg __STDCARGS((Word, Byte, Byte));
+void setinx __STDCARGS((Word, Byte, Byte));
+void clrinx __STDCARGS((Word, Byte, Byte));
+Bool tstrg __STDCARGS((Word, Byte));
+Bool testinx2 __STDCARGS((Word, Byte, Byte));
+Bool testinx __STDCARGS((Word, Byte));
+void dactopel __STDCARGS((void));
+Byte trigdac __STDCARGS((void));
+Byte dactocomm __STDCARGS((void));
+Byte getdaccomm __STDCARGS((void));
+void waitforretrace __STDCARGS((void));
+Bool Excluded __STDCARGS((Range *, Chip_Descriptor *, Bool));
+int StrCaseCmp __STDCARGS((char *, char *));
+unsigned int StrToUL __STDCARGS((const char *));
+
+/*
+ * Ident functions
+ */
+int Probe_Mem __STDCARGS((MemCheck_Descriptor));
+void Probe_RamDac __STDCARGS((int, int *));
+Bool Probe_MDA __STDCARGS((int *));
+Bool Probe_Herc __STDCARGS((int *));
+Bool Probe_CGA __STDCARGS((int *));
+Bool Probe_VGA __STDCARGS((int *));
+/* SVGA */
+Bool Probe_Tseng __STDCARGS((int *));
+Bool Probe_WD __STDCARGS((int *));
+Bool Probe_CT __STDCARGS((int *));
+Bool Probe_Video7 __STDCARGS((int *));
+Bool Probe_Genoa __STDCARGS((int *));
+Bool Probe_Trident __STDCARGS((int *));
+Bool Probe_SiS __STDCARGS((int *));
+Bool Probe_Matrox __STDCARGS((int *));
+Bool Probe_Oak __STDCARGS((int *));
+Bool Probe_Cirrus __STDCARGS((int *));
+Bool Probe_Cirrus54 __STDCARGS((int *));
+Bool Probe_Cirrus64 __STDCARGS((int *));
+Bool Probe_Ahead __STDCARGS((int *));
+Bool Probe_ATI __STDCARGS((int *));
+Bool Probe_S3 __STDCARGS((int *));
+Bool Probe_AL __STDCARGS((int *));
+Bool Probe_Alliance __STDCARGS((int *));
+Bool Probe_Yamaha __STDCARGS((int *));
+Bool Probe_NCR __STDCARGS((int *));
+Bool Probe_MX __STDCARGS((int *));
+Bool Probe_Primus __STDCARGS((int *));
+Bool Probe_RealTek __STDCARGS((int *));
+Bool Probe_Rendition __STDCARGS((int *));
+Bool Probe_Compaq __STDCARGS((int *));
+Bool Probe_HMC __STDCARGS((int *));
+Bool Probe_UMC __STDCARGS((int *));
+Bool Probe_Weitek __STDCARGS((int *));
+Bool Probe_ARK __STDCARGS((int *));
+Bool Probe_SigmaDesigns __STDCARGS((int *));
+Bool Probe_Intergraphics __STDCARGS((int *));
+Bool Probe_Epson __STDCARGS((int *));
+/* CoProc */
+Bool Probe_8514 __STDCARGS((int *));
+Bool Probe_ATIMach __STDCARGS((int *));
+Bool Probe_I128 __STDCARGS((int *));
+Bool Probe_GLINT __STDCARGS((int *));
+
+/*
+ * Print functions
+ */
+void Print_SVGA_Name __STDCARGS((int));
+void Print_Herc_Name __STDCARGS((int));
+void Print_RamDac_Name __STDCARGS((int));
+void Print_CoProc_Name __STDCARGS((int));
+
+/*
+ * Globals
+ */
+extern struct pci_config_reg *pcrp;
+extern Bool NoPCI;
+extern Bool PCIProbed;
+extern char MyName[];
+extern Word vgaIOBase;
+extern Bool Verbose;
+extern Long Chip_data;
+extern Byte *Bios_Base;
+extern Bool AssumeEGA;
+
+extern Chip_Descriptor VGA_Descriptor;
+
+extern Chip_Descriptor AL_Descriptor;
+extern Chip_Descriptor Alliance_Descriptor;
+extern Chip_Descriptor ATI_Descriptor;
+extern Chip_Descriptor Ahead_Descriptor;
+extern Chip_Descriptor CT_Descriptor;
+extern Chip_Descriptor Cirrus_Descriptor;
+extern Chip_Descriptor Cirrus54_Descriptor;
+extern Chip_Descriptor Cirrus64_Descriptor;
+extern Chip_Descriptor Compaq_Descriptor;
+extern Chip_Descriptor Epson_Descriptor;
+extern Chip_Descriptor Genoa_Descriptor;
+extern Chip_Descriptor HMC_Descriptor;
+extern Chip_Descriptor MX_Descriptor;
+extern Chip_Descriptor NCR_Descriptor;
+extern Chip_Descriptor Oak_Descriptor;
+extern Chip_Descriptor Primus_Descriptor;
+extern Chip_Descriptor RealTek_Descriptor;
+extern Chip_Descriptor Rendition_Descriptor;
+extern Chip_Descriptor S3_Descriptor;
+extern Chip_Descriptor Trident_Descriptor;
+extern Chip_Descriptor SiS_Descriptor;
+extern Chip_Descriptor Matrox_Descriptor;
+extern Chip_Descriptor Tseng_Descriptor;
+extern Chip_Descriptor UMC_Descriptor;
+extern Chip_Descriptor Video7_Descriptor;
+extern Chip_Descriptor WD_Descriptor;
+extern Chip_Descriptor Weitek_Descriptor;
+extern Chip_Descriptor Yamaha_Descriptor;
+extern Chip_Descriptor ARK_Descriptor;
+extern Chip_Descriptor SigmaDesigns_Descriptor;
+extern Chip_Descriptor Intergraphics_Descriptor;
+
+extern Chip_Descriptor IBM8514_Descriptor;
+extern Chip_Descriptor ATIMach_Descriptor;
+extern Chip_Descriptor I128_Descriptor;
+extern Chip_Descriptor GLINT_Descriptor;
+
+/*
+ * Useful macros
+ */
+/* VGA */
+#define COPYRIGHT_BASE (0x1E)
+#define CRTC_IDX (vgaIOBase+0x04)
+#define CRTC_REG (vgaIOBase+0x05)
+#define GRC_IDX (0x3CE)
+#define GRC_REG (0x3CF)
+#define SEQ_IDX (0x3C4)
+#define SEQ_REG (0x3C5)
+#define ATR_IDX (0x3C0)
+#define ATR_REG_W (0x3C0)
+#define ATR_REG_R (0x3C1)
+#define MISC_OUT_W (0x3C2)
+#define MISC_OUT_R (0x3CC)
+/* 8514 */
+#define CONFIG_STATUS_1 0x12EE
+#define MISC_OPTIONS 0x36EE
+#define CHIP_ID 0xFAEE
+#define SUBSYS_CNTL 0x42E8
+#define EXT_CONF_3 0x5EE8
+#define ERR_TERM 0x92E8
+#define GPCTRL_ENAB 0x4000
+#define GPCTRL_RESET 0x8000
+#define CHPTEST_NORMAL 0x1000
+#define ROM_ADDR_1 0x52EE
+#define DESTX_DIASTP 0x8EE8
+#define READ_SRC_X 0xDAEE
+#define GP_STAT 0x9AE8
+#define GPBUSY 0x0200
+
+/*
+ * RAMDAC Types
+ */
+#define DAC_UNKNOWN 0 /* Non-standard, but unknown */
+#define DAC_STANDARD 1 /* Standard 8-bit pseudo-color DAC */
+#define DAC_ALG1101 2 /* Avance Logic ALG1101 */
+#define DAC_SS24 3 /* Diamond SS2410 */
+#define DAC_SIERRA15 4 /* Sierra 15-bit HiColor */
+#define DAC_SIERRA15_16 5 /* Sierra 15/16-bit HiColor */
+#define DAC_SIERRA24 6 /* Sierra 15/16/24-bit DAC */
+#define DAC_MUSIC4870 7 /* MUSIC 15/16-bit HiColor DAC */
+#define DAC_MUSIC4910 8 /* MUSIC 15/16/24-bit DAC */
+#define DAC_ACUMOS 9 /* AcuMos ADAC1 15/16/24-bit DAC */
+#define DAC_ATI68830 10 /* ATI 68830 15/16-bit DAC */
+#define DAC_ATI68860 11 /* ATI 68860 15/16/24-bit DAC, mux */
+#define DAC_ATI68875 12 /* ATI 68875 15/16/24-bit DAC, mux */
+#define DAC_ATIMISC24 13 /* ATI Miscellaneous 3'rd party DACs */
+#define DAC_CIRRUSA 14 /* Cirrus 5420 8-bit pseudo-color DAC */
+#define DAC_CIRRUSB 15 /* Cirrus 542{2,4,6,8} 15/16/24-bit DAC */
+#define DAC_CIRRUS24 16 /* Cirrus 15/16/24-bit separate DAC */
+#define DAC_ATT490 17 /* AT&T 20C490 15/16/24-bit DAC */
+#define DAC_ATT491 18 /* AT&T 20C491 15/16/24-bit DAC w/gamma corr */
+#define DAC_ATT492 19 /* AT&T 20C492 15/16/18-bit DAC w/gamma corr */
+#define DAC_ATT493 20 /* AT&T 20C493 15/16/18-bit DAC */
+#define DAC_ATT497 21 /* AT&T 20C497 8-bit PseudoColor,24-bit wide */
+#define DAC_BT485 22 /* BrookTree 485 RAMDAC */
+#define DAC_ATT504 23 /* AT&T 20C504 (Bt484 clone, I think) */
+#define DAC_ATT505 24 /* AT&T 20C505 (Bt485 clone) */
+#define DAC_TVP3020 25 /* TI ViewPoint TVP3020 RAMDAC */
+#define DAC_TVP3025 26 /* TI ViewPoint TVP3025 RAMDAC */
+#define DAC_EDSUN 27 /* EDSUN CEG DAC */
+#define DAC_ATT498 28 /* AT&T 20C498/21C498 15/16/24-bit DAC w/pixel-mux */
+#define DAC_ATT22C498 29 /* AT&T 22C498 15/16/24-bit DAC w/pixel-mux */
+#define DAC_STG1700 30 /* STG 1700 15/16/24-bit DAC w/pixel-mux */
+#define DAC_S3_GENDAC 31 /* S3 86C708 GENDAC 15/16/24-bit DAC w/PLL */
+#define DAC_S3_SDAC 32 /* S3 86C716 SDAC 15/16/24 w/pixel-mux w/PLL */
+#define DAC_TVP3026 33 /* TI ViewPoint TVP3026 RAMDAC */
+#define DAC_IBMRGB524 34 /* IBM RGB524 RAMDAC */
+#define DAC_IBMRGB525 35 /* IBM RGB525 RAMDAC */
+#define DAC_IBMRGB528 36 /* IBM RGB528 RAMDAC */
+#define DAC_STG1703 37 /* STG 1703 15/16/24-bit DAC w/pixel-mux w/dual PLL */
+#define DAC_ATT409 38 /* AT&T 20C409 15/16/24-bit DAC */
+#define DAC_ATT499 39 /* AT&T 20C499 15/16/24-bit DAC */
+#define DAC_TKD8001 40 /* Trident TKD8001 15/16/24-bit DAC */
+#define DAC_TGUIDAC 41 /* Trident TGUIDAC 15/16/24-bit DAC */
+#define DAC_ATI_INTERNAL 42 /* ATI Mach64 integrated DAC */
+#define DAC_MU9C1880 43 /* Music 9C1880 */
+#define DAC_IMSG174 44 /* Inmos G-174 */
+#define DAC_STG1702 45 /* STG 1702 15/16/24-bit DAC w/pixel-mux */
+#define DAC_CH8398 46 /* Chrontel 8398 */
+#define DAC_ATT408 47 /* AT&T 20C408 */
+#define DAC_TVP3030 48 /* TI ViewPoint TVP3030 RAMDAC */
+#define DAC_ET6K 49 /* Built-in 15/16/24-bit ET6000 RAMDAC */
+#define DAC_ZOOMDAC 50 /* IC Works w30C516 ZOOMDAC or ATT20C498 */
+#define DAC_ALSC_642x 51 /* Alliance ProMotion 642[24] integrated DAC */
+#define DAC_ICS5341 52 /* ICS5341 16-bit SDAC-like DAC used on ET4000W32p */
+#define DAC_ICS5301 53 /* ICS5301 8-bit GENDAC-like DAC used on ET4000W32 */
+#define DAC_MGA1064SG 54 /* Matrox Mystique integrated DAC */
+#define DAC_MGAG100 55 /* Matrox G100 integrated DAC */
+#define DAC_MGAG200 56 /* Matrox G200 integrated DAC */
+#define DAC_SIS 57 /* SiS integrated DAC */
+
+#define DAC_MAX DAC_SIS /* UPDATE THIS! */
+
+#define DAC_6_8_PROGRAM 0x40 /* RAMDAC programmable for 6/8-bit tables */
+#define DAC_8BIT 0x80 /* RAMDAC with 8-bit wide lookup tables */
+
+#define DAC_CHIP(x) ((x) & ~(DAC_8BIT|DAC_6_8_PROGRAM))
+
+
+/*
+ * RAMDAC names
+ */
+
+struct RamDac_Name {
+ CONST char *Short;
+ CONST char *Long;
+};
+extern struct RamDac_Name RamDac_Names[];
+
+/*
+ * Base chipset classes
+ */
+#define CHIP_MDA 0 /* Monochrome Display Adapter */
+#define CHIP_CGA 1 /* Color Display Adapter */
+#define CHIP_EGA 2 /* Enhanced Graphics Adapter */
+#define CHIP_PGC 3 /* Professional Graphics Controller */
+#define CHIP_VGA 4 /* Video Graphics Array */
+#define CHIP_MCGA 5 /* MultiColor Graphics Array */
+#define CHIP_COPROC 6 /* Graphics Coprocessor */
+
+/*
+ * Hercules cards
+ */
+#define HERC_TYPE(n) (CHIP_MDA | ((n) << 8))
+#define CHIP_HERC_STD HERC_TYPE(1)
+#define CHIP_HERC_PLUS HERC_TYPE(2)
+#define CHIP_HERC_COL HERC_TYPE(3)
+
+/*
+ * SVGA cards
+ */
+#define SVGA_TYPE(v,n) (((v) << 16) | ((n) << 8) | CHIP_VGA)
+#define V_AHEAD 1
+#define V_ATI 2
+#define V_AL 3
+#define V_CT 4
+#define V_CIRRUS 5
+#define V_COMPAQ 6
+#define V_GENOA 7
+#define V_HMC 8
+#define V_MX 9
+#define V_NCR 10
+#define V_OAK 11
+#define V_PRIMUS 12
+#define V_REALTEK 13
+#define V_RENDITION 14
+#define V_S3 15
+#define V_TRIDENT 16
+#define V_TSENG 17
+#define V_UMC 18
+#define V_VIDEO7 19
+#define V_WD 20
+#define V_WEITEK 21
+#define V_YAMAHA 22
+#define V_SIS 23
+#define V_ARK 24
+#define V_ALLIANCE 25
+#define V_MATROX 26
+#define V_SD 27
+#define V_IG 28
+#define V_EPSON 29
+
+#define NUM_VENDORS 29
+#define CHPS_PER_VENDOR 40
+
+#define CHIP_AHEAD_UNK SVGA_TYPE(V_AHEAD,0) /* Ahead unknown */
+#define CHIP_AHEAD_A SVGA_TYPE(V_AHEAD,1) /* Ahead V5000 Version A*/
+#define CHIP_AHEAD_B SVGA_TYPE(V_AHEAD,2) /* Ahead V5000 Version B*/
+#define CHIP_ARK_UNK SVGA_TYPE(V_ARK,0) /* ARK Logic unknown */
+#define CHIP_ARK1000VL SVGA_TYPE(V_ARK,1) /* ARK Logic ARK1000VL */
+#define CHIP_ARK1000PV SVGA_TYPE(V_ARK,2) /* ARK Logic ARK1000PV */
+#define CHIP_ARK2000PV SVGA_TYPE(V_ARK,3) /* ARK Logic ARK2000PV */
+#define CHIP_ARK2000MT SVGA_TYPE(V_ARK,4) /* ARK Logic ARK2000MT */
+#define CHIP_ARK2000MI SVGA_TYPE(V_ARK,5) /* ARK Logic ARK2000MI */
+#define CHIP_ATI_UNK SVGA_TYPE(V_ATI,0) /* ATI unknown */
+#define CHIP_ATI18800 SVGA_TYPE(V_ATI,1) /* ATI 18800 */
+#define CHIP_ATI18800_1 SVGA_TYPE(V_ATI,2) /* ATI 18800-1 */
+#define CHIP_ATI28800_2 SVGA_TYPE(V_ATI,3) /* ATI 28800-2 */
+#define CHIP_ATI28800_4 SVGA_TYPE(V_ATI,4) /* ATI 28800-4 */
+#define CHIP_ATI28800_5 SVGA_TYPE(V_ATI,5) /* ATI 28800-5 */
+#define CHIP_ATI28800_6 SVGA_TYPE(V_ATI,6) /* ATI 28800-6 */
+#define CHIP_ATI68800_3 SVGA_TYPE(V_ATI,7) /* ATI 68800-3 */
+#define CHIP_ATI68800_6 SVGA_TYPE(V_ATI,8) /* ATI 68800-6 */
+#define CHIP_ATI68800LX SVGA_TYPE(V_ATI,9) /* ATI 68800LX */
+#define CHIP_ATI68800AX SVGA_TYPE(V_ATI,10) /* ATI 68800AX */
+#define CHIP_ATI88800GXC SVGA_TYPE(V_ATI,11) /* ATI 88800GX-C */
+#define CHIP_ATI88800GXD SVGA_TYPE(V_ATI,12) /* ATI 88800GX-D */
+#define CHIP_ATI88800GXE SVGA_TYPE(V_ATI,13) /* ATI 88800GX-E */
+#define CHIP_ATI88800GXF SVGA_TYPE(V_ATI,14) /* ATI 88800GX-F */
+#define CHIP_ATI88800CX SVGA_TYPE(V_ATI,15) /* ATI 88800CX */
+#define CHIP_ATI264CT SVGA_TYPE(V_ATI,16) /* ATI 264CT */
+#define CHIP_ATI264ET SVGA_TYPE(V_ATI,17) /* ATI 264ET */
+#define CHIP_ATI264VT SVGA_TYPE(V_ATI,18) /* ATI 264VT */
+#define CHIP_ATI264VTB SVGA_TYPE(V_ATI,19) /* ATI 264VT-B */
+#define CHIP_ATI264VT3 SVGA_TYPE(V_ATI,20) /* ATI 264VT3 */
+#define CHIP_ATI264VT4 SVGA_TYPE(V_ATI,21) /* ATI 264VT4 */
+#define CHIP_ATI264GT SVGA_TYPE(V_ATI,22) /* ATI 264GT */
+#define CHIP_ATI264GTB SVGA_TYPE(V_ATI,23) /* ATI 264GT-B */
+#define CHIP_ATI264GTDVD SVGA_TYPE(V_ATI,24) /* ATI 264GT-B+DVD */
+#define CHIP_ATI264GTIIc SVGA_TYPE(V_ATI,25) /* ATI 264GT-IIc */
+#define CHIP_ATI264GT3 SVGA_TYPE(V_ATI,26) /* ATI 264GT3 */
+#define CHIP_ATI264LT SVGA_TYPE(V_ATI,27) /* ATI 264LT */
+#define CHIP_ATI264LTPRO SVGA_TYPE(V_ATI,28) /* ATI 264LT Pro */
+#define CHIP_ATI264XL SVGA_TYPE(V_ATI,29) /* ATI 264XL or XC */
+#define CHIP_AL_UNKNOWN SVGA_TYPE(V_AL,0) /* Avance Logic unknown */
+#define CHIP_AL2101 SVGA_TYPE(V_AL,1) /* Avance Logic 2101 */
+#define CHIP_AL2228 SVGA_TYPE(V_AL,2) /* Avance Logic 2228 */
+#define CHIP_ALSC_UNK SVGA_TYPE(V_ALLIANCE,0) /* Alliance unknown */
+#define CHIP_ALSC6410 SVGA_TYPE(V_ALLIANCE,1) /* Alliance PM6410 */
+#define CHIP_ALSC6422 SVGA_TYPE(V_ALLIANCE,2) /* Alliance PM6422 */
+#define CHIP_ALSCAT24 SVGA_TYPE(V_ALLIANCE,3) /* Alliance AT24 */
+#define CHIP_ALSCAT3D SVGA_TYPE(V_ALLIANCE,4) /* Alliance AT3D */
+#define CHIP_CT_UNKNOWN SVGA_TYPE(V_CT,0) /* C&T unknown */
+#define CHIP_CT450 SVGA_TYPE(V_CT,1) /* C&T 82c450 */
+#define CHIP_CT451 SVGA_TYPE(V_CT,2) /* C&T 82c451 */
+#define CHIP_CT452 SVGA_TYPE(V_CT,3) /* C&T 82c452 */
+#define CHIP_CT453 SVGA_TYPE(V_CT,4) /* C&T 82c453 */
+#define CHIP_CT455 SVGA_TYPE(V_CT,5) /* C&T 82c455 */
+#define CHIP_CT456 SVGA_TYPE(V_CT,6) /* C&T 82c456 */
+#define CHIP_CT457 SVGA_TYPE(V_CT,7) /* C&T 82c457 */
+#define CHIP_CTF65510 SVGA_TYPE(V_CT,8) /* C&T F65510 */
+#define CHIP_CTF65520 SVGA_TYPE(V_CT,9) /* C&T F65520 */
+#define CHIP_CTF65530 SVGA_TYPE(V_CT,10) /* C&T F65530 */
+#define CHIP_CTF65540 SVGA_TYPE(V_CT,11) /* C&T F65540 */
+#define CHIP_CTF65545 SVGA_TYPE(V_CT,12) /* C&T F65545 */
+#define CHIP_CTF65548 SVGA_TYPE(V_CT,13) /* C&T F65548 */
+#define CHIP_CTF65546 SVGA_TYPE(V_CT,14) /* C&T F65546 */
+#define CHIP_CTF65550 SVGA_TYPE(V_CT,15) /* C&T F65550 */
+#define CHIP_CTF65554 SVGA_TYPE(V_CT,16) /* C&T F65554 */
+#define CHIP_CTF65555 SVGA_TYPE(V_CT,17) /* C&T F65555 */
+#define CHIP_CTF68554 SVGA_TYPE(V_CT,18) /* C&T F68554 */
+#define CHIP_CTF69000 SVGA_TYPE(V_CT,19) /* C&T F69000 */
+#define CHIP_CTF69030 SVGA_TYPE(V_CT,20) /* C&T F69030 */
+#define CHIP_CTF64200 SVGA_TYPE(V_CT,21) /* C&T F64200 WinGine */
+#define CHIP_CTF64300 SVGA_TYPE(V_CT,22) /* C&T F64300 WinGine */
+#define CHIP_CL_UNKNOWN SVGA_TYPE(V_CIRRUS,0) /* Cirrus unknown */
+#define CHIP_CL510 SVGA_TYPE(V_CIRRUS,1) /* Cirrus CL-GD 510/520 */
+#define CHIP_CL610 SVGA_TYPE(V_CIRRUS,2) /* Cirrus CL-GD 610/620 */
+#define CHIP_CLV7 SVGA_TYPE(V_CIRRUS,3) /* Cirrus Video 7 OEM */
+#define CHIP_CLAVGA2 SVGA_TYPE(V_CIRRUS,4) /* Cirrus/AcuMos AVGA2 */
+#define CHIP_CL5402 SVGA_TYPE(V_CIRRUS,5) /* Cirrus 5402 */
+#define CHIP_CL5402R1 SVGA_TYPE(V_CIRRUS,6) /* Cirrus 5402 rev 1 */
+#define CHIP_CL5420 SVGA_TYPE(V_CIRRUS,7) /* Cirrus 5420 */
+#define CHIP_CL5420R1 SVGA_TYPE(V_CIRRUS,8) /* Cirrus 5420 rev 1 */
+#define CHIP_CL5422 SVGA_TYPE(V_CIRRUS,9) /* Cirrus 5422 */
+#define CHIP_CL5424 SVGA_TYPE(V_CIRRUS,10) /* Cirrus 5424 */
+#define CHIP_CL5426 SVGA_TYPE(V_CIRRUS,11) /* Cirrus 5426 */
+#define CHIP_CL5428 SVGA_TYPE(V_CIRRUS,12) /* Cirrus 5428 */
+#define CHIP_CL5429 SVGA_TYPE(V_CIRRUS,13) /* Cirrus 5429 */
+#define CHIP_CL5430 SVGA_TYPE(V_CIRRUS,14) /* Cirrus 5430 */
+#define CHIP_CL5434 SVGA_TYPE(V_CIRRUS,15) /* Cirrus 5434 */
+#define CHIP_CL6205 SVGA_TYPE(V_CIRRUS,16) /* Cirrus 6205 */
+#define CHIP_CL6215 SVGA_TYPE(V_CIRRUS,17) /* Cirrus 6215 */
+#define CHIP_CL6225 SVGA_TYPE(V_CIRRUS,18) /* Cirrus 6225 */
+#define CHIP_CL6235 SVGA_TYPE(V_CIRRUS,19) /* Cirrus 6235 */
+#define CHIP_CL5410 SVGA_TYPE(V_CIRRUS,20) /* Cirrus 6510 */
+#define CHIP_CL6410 SVGA_TYPE(V_CIRRUS,21) /* Cirrus 6410 */
+#define CHIP_CL6412 SVGA_TYPE(V_CIRRUS,22) /* Cirrus 6412 */
+#define CHIP_CL6420A SVGA_TYPE(V_CIRRUS,23) /* Cirrus 6420A */
+#define CHIP_CL6420B SVGA_TYPE(V_CIRRUS,24) /* Cirrus 6420B */
+#define CHIP_CL6440 SVGA_TYPE(V_CIRRUS,25) /* Cirrus 6440 */
+#define CHIP_CL5436 SVGA_TYPE(V_CIRRUS,26) /* Cirrus 5436 */
+#define CHIP_CL7541 SVGA_TYPE(V_CIRRUS,27) /* Cirrus 7541 */
+#define CHIP_CL7542 SVGA_TYPE(V_CIRRUS,28) /* Cirrus 7542 */
+#define CHIP_CL7543 SVGA_TYPE(V_CIRRUS,29) /* Cirrus 7543 */
+#define CHIP_CL5446 SVGA_TYPE(V_CIRRUS,30) /* Cirrus 5446 */
+#define CHIP_CL5462 SVGA_TYPE(V_CIRRUS,31) /* Cirrus 5462 */
+#define CHIP_CL7548 SVGA_TYPE(V_CIRRUS,32) /* Cirrus 7548 */
+#define CHIP_CL5464 SVGA_TYPE(V_CIRRUS,33) /* Cirrus 5464 */
+#define CHIP_CL5480 SVGA_TYPE(V_CIRRUS,34) /* Cirrus 5480 */
+#define CHIP_CL5465 SVGA_TYPE(V_CIRRUS,35) /* Cirrus 5465 */
+#define CHIP_CPQ_UNK SVGA_TYPE(V_COMPAQ,0) /* Compaq unknown */
+#define CHIP_CPQ_IVGS SVGA_TYPE(V_COMPAQ,1) /* Compaq Int Vid Gr Sys*/
+#define CHIP_CPQ_AVGA SVGA_TYPE(V_COMPAQ,2) /* Compaq Advanced VGA */
+#define CHIP_CPQ_Q1024 SVGA_TYPE(V_COMPAQ,3) /* Compaq QVision/1024 */
+#define CHIP_CPQ_Q1280 SVGA_TYPE(V_COMPAQ,4) /* Compaq QVision/1280 */
+#define CHIP_CPQ_AVGA_P SVGA_TYPE(V_COMPAQ,5) /* Compaq AVGA Portable */
+#define CHIP_G_6100 SVGA_TYPE(V_GENOA,0) /* Genoa GVGA 6100 */
+#define CHIP_G_6200 SVGA_TYPE(V_GENOA,1) /* Genoa GVGA 6200 */
+#define CHIP_G_6400 SVGA_TYPE(V_GENOA,2) /* Genoa GVGA 6400 */
+#define CHIP_HM86304 SVGA_TYPE(V_HMC,0) /* HMC HM86304 */
+#define CHIP_MX68000 SVGA_TYPE(V_MX,0) /* MX 68000 */
+#define CHIP_MX68010 SVGA_TYPE(V_MX,1) /* MX 68010 */
+#define CHIP_NCR_UNK SVGA_TYPE(V_NCR,0) /* NCR unknown */
+#define CHIP_NCR77C21 SVGA_TYPE(V_NCR,1) /* NCR 77C21 */
+#define CHIP_NCR77C22 SVGA_TYPE(V_NCR,2) /* NCR 77C22 */
+#define CHIP_NCR77C22E SVGA_TYPE(V_NCR,3) /* NCR 77C22E */
+#define CHIP_NCR77C22EP SVGA_TYPE(V_NCR,4) /* NCR 77C22E+ */
+#define CHIP_NCR77C32B SVGA_TYPE(V_NCR,5) /* NCR 77C32BLT */
+#define CHIP_OAK_UNK SVGA_TYPE(V_OAK,0) /* OAK unknown */
+#define CHIP_OAK037C SVGA_TYPE(V_OAK,1) /* OAK OTI037C */
+#define CHIP_OAK057 SVGA_TYPE(V_OAK,2) /* OAK OTI-057 */
+#define CHIP_OAK067 SVGA_TYPE(V_OAK,3) /* OAK OTI-067 */
+#define CHIP_OAK077 SVGA_TYPE(V_OAK,4) /* OAK OTI-077 */
+#define CHIP_OAK083 SVGA_TYPE(V_OAK,5) /* OAK OTI-083 */
+#define CHIP_OAK087 SVGA_TYPE(V_OAK,6) /* OAK OTI-087 */
+#define CHIP_P2000 SVGA_TYPE(V_PRIMUS,0) /* Primus P2000 */
+#define CHIP_RT_UNK SVGA_TYPE(V_REALTEK,0) /* Realtek unknown */
+#define CHIP_RT_3103 SVGA_TYPE(V_REALTEK,1) /* Realtek RT3103 */
+#define CHIP_RT_3105 SVGA_TYPE(V_REALTEK,2) /* Realtek RT3105 */
+#define CHIP_RT_3106 SVGA_TYPE(V_REALTEK,3) /* Realtek RT3106 */
+#define CHIP_REND_V1000 SVGA_TYPE(V_RENDITION,1)/* Rendtion V1000 */
+#define CHIP_REND_V2000 SVGA_TYPE(V_RENDITION,2)/* Rendtion V2000 */
+#define CHIP_S3_UNKNOWN SVGA_TYPE(V_S3,0) /* S3 unknown */
+#define CHIP_S3_911 SVGA_TYPE(V_S3,1) /* S3 86c911 */
+#define CHIP_S3_924 SVGA_TYPE(V_S3,2) /* S3 86c924 or 911A */
+#define CHIP_S3_801B SVGA_TYPE(V_S3,3) /* S3 86c801 A-B step */
+#define CHIP_S3_801C SVGA_TYPE(V_S3,4) /* S3 86c801 C step */
+#define CHIP_S3_801D SVGA_TYPE(V_S3,5) /* S3 86c801 D step */
+#define CHIP_S3_801I SVGA_TYPE(V_S3,6) /* S3 86c801i (?) */
+#define CHIP_S3_805B SVGA_TYPE(V_S3,7) /* S3 86c805 A-B step */
+#define CHIP_S3_805C SVGA_TYPE(V_S3,8) /* S3 86c805 C step */
+#define CHIP_S3_805D SVGA_TYPE(V_S3,9) /* S3 86c805 D step */
+#define CHIP_S3_805I SVGA_TYPE(V_S3,10) /* S3 86c805i */
+#define CHIP_S3_928D SVGA_TYPE(V_S3,11) /* S3 86c928 A-D step */
+#define CHIP_S3_928E SVGA_TYPE(V_S3,12) /* S3 86c928 E-step */
+#define CHIP_S3_928P SVGA_TYPE(V_S3,13) /* S3 86c928PCI */
+#define CHIP_S3_864 SVGA_TYPE(V_S3,14) /* S3 Vision864 */
+#define CHIP_S3_964 SVGA_TYPE(V_S3,15) /* S3 Vision964 */
+#define CHIP_S3_866 SVGA_TYPE(V_S3,16) /* S3 Vision866 */
+#define CHIP_S3_868 SVGA_TYPE(V_S3,17) /* S3 Vision868 */
+#define CHIP_S3_968 SVGA_TYPE(V_S3,18) /* S3 Vision968 */
+#define CHIP_S3_Trio32 SVGA_TYPE(V_S3,19) /* S3 Trio32 */
+#define CHIP_S3_Trio64 SVGA_TYPE(V_S3,20) /* S3 Trio64 */
+#define CHIP_S3_Trio64V SVGA_TYPE(V_S3,21) /* S3 Trio64V+ */
+#define CHIP_S3_968_3DLABS_300SX SVGA_TYPE(V_S3,22) /* S3 968 & 3Dlabs 300SX */
+#define CHIP_S3_968_3DLABS_UNK SVGA_TYPE(V_S3,23) /* S3 968 & 3Dlabs 300SX */
+#define CHIP_S3_ViRGE SVGA_TYPE(V_S3,24) /* S3 ViRGE */
+#define CHIP_S3_ViRGE_VX SVGA_TYPE(V_S3,25) /* S3 ViRGE/VX */
+#define CHIP_S3_Aurora64VP SVGA_TYPE(V_S3,26) /* S3 Aurora64V+ */
+#define CHIP_S3_Trio64UVP SVGA_TYPE(V_S3,27) /* S3 Trio64UV+ */
+#define CHIP_S3_Trio64V2_DX SVGA_TYPE(V_S3,28) /* S3 Trio64V2/DX */
+#define CHIP_S3_Trio64V2_GX SVGA_TYPE(V_S3,29) /* S3 Trio64V2/GX */
+#define CHIP_S3_ViRGE_DX SVGA_TYPE(V_S3,30) /* S3 ViRGE/DX */
+#define CHIP_S3_ViRGE_GX SVGA_TYPE(V_S3,31) /* S3 ViRGE/GX */
+#define CHIP_S3_PLATO_PX SVGA_TYPE(V_S3,32) /* S3 PLATO/PX */
+#define CHIP_S3_ViRGE_GX2 SVGA_TYPE(V_S3,33) /* S3 ViRGE/GX2 */
+#define CHIP_S3_ViRGE_MX SVGA_TYPE(V_S3,34) /* S3 ViRGE/MX */
+#define CHIP_S3_ViRGE_MXP SVGA_TYPE(V_S3,35) /* S3 ViRGE/MX+ */
+#define CHIP_S3_Trio3D_B SVGA_TYPE(V_S3,36) /* S3 Trio3D Business */
+#define CHIP_S3_Trio3D SVGA_TYPE(V_S3,37) /* S3 Trio3D */
+#define CHIP_S3_Savage3D SVGA_TYPE(V_S3,38) /* S3 Savage3D */
+#define CHIP_S3_Savage3D_M SVGA_TYPE(V_S3,39) /* S3 Savage3D Macro */
+#define CHIP_TVGA_UNK SVGA_TYPE(V_TRIDENT,0) /* Trident unknown */
+#define CHIP_TVGA8200 SVGA_TYPE(V_TRIDENT,1) /* Trident LX8200 */
+#define CHIP_TVGA8800BR SVGA_TYPE(V_TRIDENT,2) /* Trident 8800BR */
+#define CHIP_TVGA8800CS SVGA_TYPE(V_TRIDENT,3) /* Trident 8800CS */
+#define CHIP_TVGA8900B SVGA_TYPE(V_TRIDENT,4) /* Trident 8900B */
+#define CHIP_TVGA8900C SVGA_TYPE(V_TRIDENT,5) /* Trident 8900C */
+#define CHIP_TVGA8900CL SVGA_TYPE(V_TRIDENT,6) /* Trident 8900CL */
+#define CHIP_TVGA9000 SVGA_TYPE(V_TRIDENT,7) /* Trident 9000 */
+#define CHIP_TVGA9000I SVGA_TYPE(V_TRIDENT,8) /* Trident 9000i */
+#define CHIP_TVGA9100B SVGA_TYPE(V_TRIDENT,9) /* Trident LCD9100B */
+#define CHIP_TVGA9200CX SVGA_TYPE(V_TRIDENT,10) /* Trident 9200CXr */
+#define CHIP_TVGA9320 SVGA_TYPE(V_TRIDENT,11) /* Trident LCD9320 */
+#define CHIP_TVGA9400CX SVGA_TYPE(V_TRIDENT,12) /* Trident 9400CXi */
+#define CHIP_TVGA9420 SVGA_TYPE(V_TRIDENT,13) /* Trident GUI9420 */
+#define CHIP_TVGA9420D SVGA_TYPE(V_TRIDENT,14) /* Trident GUI9420DGi */
+#define CHIP_TVGA9440 SVGA_TYPE(V_TRIDENT,15) /* Trident GUI9440AGi */
+#define CHIP_TVGA9660 SVGA_TYPE(V_TRIDENT,16) /* Trident GUI9660 */
+#define CHIP_TVGA9680 SVGA_TYPE(V_TRIDENT,17) /* Trident GUI9680 */
+#define CHIP_TVGA9682 SVGA_TYPE(V_TRIDENT,18) /* Trident GUI9682 */
+#define CHIP_TVGA9685 SVGA_TYPE(V_TRIDENT,19) /* Trident GUI9685 */
+#define CHIP_TVGA9692 SVGA_TYPE(V_TRIDENT,20) /* Trident GUI9692 */
+#define CHIP_TVGA9382 SVGA_TYPE(V_TRIDENT,21) /* Trident Cyber9382 */
+#define CHIP_TVGA9385 SVGA_TYPE(V_TRIDENT,22) /* Trident Cyber9385 */
+#define CHIP_TVGA9385_1 SVGA_TYPE(V_TRIDENT,23) /* Trident Cyber9385-1 */
+#define CHIP_TVGA9388 SVGA_TYPE(V_TRIDENT,24) /* Trident Cyber9388 */
+#define CHIP_TVGA9388_1 SVGA_TYPE(V_TRIDENT,25) /* Trident Cyber9388-1 */
+#define CHIP_TVGA9397 SVGA_TYPE(V_TRIDENT,26) /* Trident Cyber9397 */
+#define CHIP_TVGA9520 SVGA_TYPE(V_TRIDENT,27) /* Trident Cyber9520 */
+#define CHIP_TVGA9750 SVGA_TYPE(V_TRIDENT,28) /* Trident 3DImage975 */
+#define CHIP_TVGA9850 SVGA_TYPE(V_TRIDENT,29) /* Trident 3DImage985 */
+#define CHIP_TVGA939A SVGA_TYPE(V_TRIDENT,30) /* Trident Cyber932A */
+#define CHIP_SIS_UNK SVGA_TYPE(V_SIS,0) /* SiS unknown */
+#define CHIP_SIS86C201 SVGA_TYPE(V_SIS,1) /* SiS SG86C201 */
+#define CHIP_SIS86C202 SVGA_TYPE(V_SIS,2) /* SiS SG86C202 */
+#define CHIP_SIS86C205 SVGA_TYPE(V_SIS,3) /* SiS SG86C205 */
+#define CHIP_SIS86C215 SVGA_TYPE(V_SIS,4) /* SiS SG86C215 */
+#define CHIP_SIS86C225 SVGA_TYPE(V_SIS,5) /* SiS SG86C225 */
+#define CHIP_SIS5597 SVGA_TYPE(V_SIS,6) /* SiS 5597/5598 */
+#define CHIP_SIS530 SVGA_TYPE(V_SIS,7) /* SiS 530/620 */
+#define CHIP_SIS6326 SVGA_TYPE(V_SIS,8) /* SiS 6326 */
+#define CHIP_MATROX_UNK SVGA_TYPE(V_MATROX,0) /* Matrox unknown */
+#define CHIP_MGA2085PX SVGA_TYPE(V_MATROX,1) /* Matrox Atlas */
+#define CHIP_MGA2064W SVGA_TYPE(V_MATROX,2) /* Matrox Millennium */
+#define CHIP_MGA1064SG SVGA_TYPE(V_MATROX,3) /* Matrox Mystique */
+#define CHIP_MGA2164W SVGA_TYPE(V_MATROX,4) /* Matrox Millennium II */
+#define CHIP_MGA2164WAGP SVGA_TYPE(V_MATROX,5) /* Matrox Millennium II AGP */
+#define CHIP_MGAG100PCI SVGA_TYPE(V_MATROX,6) /* Matrox G100 PCI */
+#define CHIP_MGAG100AGP SVGA_TYPE(V_MATROX,7) /* Matrox G100 AGP */
+#define CHIP_MGAG200PCI SVGA_TYPE(V_MATROX,8) /* Matrox G200 PCI */
+#define CHIP_MGAG200AGP SVGA_TYPE(V_MATROX,9) /* Matrox G200 AGP */
+#define CHIP_TSENG_UNK SVGA_TYPE(V_TSENG,0) /* Tseng unknown */
+#define CHIP_ET3000 SVGA_TYPE(V_TSENG,1) /* Tseng ET3000 */
+#define CHIP_ET4000 SVGA_TYPE(V_TSENG,2) /* Tseng ET4000 */
+#define CHIP_ET4000W32 SVGA_TYPE(V_TSENG,3) /* Tseng ET4000/W32 */
+#define CHIP_ET4000W32I SVGA_TYPE(V_TSENG,4) /* Tseng ET4000/W32i */
+#define CHIP_ET4KW32P_A SVGA_TYPE(V_TSENG,5) /* Tseng ET4000/W32p rA */
+#define CHIP_ET4KW32I_B SVGA_TYPE(V_TSENG,6) /* Tseng ET4000/W32i rB */
+#define CHIP_ET4KW32I_C SVGA_TYPE(V_TSENG,7) /* Tseng ET4000/W32i rC */
+#define CHIP_ET4KW32P_B SVGA_TYPE(V_TSENG,8) /* Tseng ET4000/W32p rB */
+#define CHIP_ET4KW32P_C SVGA_TYPE(V_TSENG,9) /* Tseng ET4000/W32p rC */
+#define CHIP_ET4KW32P_D SVGA_TYPE(V_TSENG,10) /* Tseng ET4000/W32p rD */
+#define CHIP_ET6K SVGA_TYPE(V_TSENG,11) /* Tseng ET6000 */
+#define CHIP_ET6K1 SVGA_TYPE(V_TSENG,12) /* Tseng ET6100 */
+#define CHIP_ET6K3 SVGA_TYPE(V_TSENG,13) /* Tseng ET6300 */
+#define CHIP_UMC_408 SVGA_TYPE(V_UMC,0) /* UMC 85c408 */
+#define CHIP_V7_UNKNOWN SVGA_TYPE(V_VIDEO7,0) /* Video7 unknown */
+#define CHIP_V7_FWRITE SVGA_TYPE(V_VIDEO7,1) /* Video7 Fastwrite/VRAM*/
+#define CHIP_V7_1024i SVGA_TYPE(V_VIDEO7,2) /* Video7 1024i */
+#define CHIP_V7_VRAM2_B SVGA_TYPE(V_VIDEO7,3) /* Video7 VRAM II (B) */
+#define CHIP_V7_VRAM2_C SVGA_TYPE(V_VIDEO7,4) /* Video7 VRAM II (C,D) */
+#define CHIP_HT216BC SVGA_TYPE(V_VIDEO7,5) /* Video7 HT216B,C */
+#define CHIP_HT216D SVGA_TYPE(V_VIDEO7,6) /* Video7 HT216D */
+#define CHIP_HT216E SVGA_TYPE(V_VIDEO7,7) /* Video7 HT216E */
+#define CHIP_HT216F SVGA_TYPE(V_VIDEO7,8) /* Video7 HT216F */
+#define CHIP_V7_VEGA SVGA_TYPE(V_VIDEO7,9) /* Video7 VEGA */
+#define CHIP_WD_UNK SVGA_TYPE(V_WD,0) /* WD unknown */
+#define CHIP_WD_PVGA1 SVGA_TYPE(V_WD,1) /* WD PVGA1 */
+#define CHIP_WD_90C00 SVGA_TYPE(V_WD,2) /* WD 90C00 */
+#define CHIP_WD_90C10 SVGA_TYPE(V_WD,3) /* WD 90C10 */
+#define CHIP_WD_90C11 SVGA_TYPE(V_WD,4) /* WD 90C11 */
+#define CHIP_WD_90C20 SVGA_TYPE(V_WD,5) /* WD 90C20 */
+#define CHIP_WD_90C20A SVGA_TYPE(V_WD,6) /* WD 90C20A */
+#define CHIP_WD_90C22 SVGA_TYPE(V_WD,7) /* WD 90C22 */
+#define CHIP_WD_90C24 SVGA_TYPE(V_WD,8) /* WD 90C24 */
+#define CHIP_WD_90C26 SVGA_TYPE(V_WD,9) /* WD 90C26 */
+#define CHIP_WD_90C27 SVGA_TYPE(V_WD,10) /* WD 90C27 (guess) */
+#define CHIP_WD_90C30 SVGA_TYPE(V_WD,11) /* WD 90C30 */
+#define CHIP_WD_90C31 SVGA_TYPE(V_WD,12) /* WD 90C31 */
+#define CHIP_WD_90C33 SVGA_TYPE(V_WD,13) /* WD 90C33 */
+#define CHIP_WEIT_UNK SVGA_TYPE(V_WEITEK,0) /* Weitek unknown */
+#define CHIP_WEIT_5086 SVGA_TYPE(V_WEITEK,1) /* Weitek 5086 */
+#define CHIP_WEIT_5186 SVGA_TYPE(V_WEITEK,2) /* Weitek 5186 */
+#define CHIP_WEIT_5286 SVGA_TYPE(V_WEITEK,3) /* Weitek 5286 */
+#define CHIP_YAMAHA6388 SVGA_TYPE(V_YAMAHA,0) /* Yamaha 6388 VPDC */
+#define CHIP_SD_RM_UNK SVGA_TYPE(V_SD,0) /* Sigma Desigs unknown */
+#define CHIP_SD_RM64GX SVGA_TYPE(V_SD,1) /* Sigma Desigs SD6425 */
+#define CHIP_IG_UNK SVGA_TYPE(V_IG,0) /* Intergraphics unknown */
+#define CHIP_IG_1680 SVGA_TYPE(V_IG,1) /* Intergraphics IGA-1680 */
+#define CHIP_IG_1682 SVGA_TYPE(V_IG,2) /* Intergraphics IGA-1682 */
+#define CHIP_EPSON_8110 SVGA_TYPE(V_EPSON,0) /* Epson SPC8110 */
+
+/*
+ * Graphics Coprocessors
+ */
+#define COPROC_TYPE(c,n) (((c) << 16) | ((n) << 8) | CHIP_COPROC)
+#define C_8514 0
+#define C_XGA 1
+#define C_MACH64 2
+#define C_I128 3
+#define C_GLINT 4
+
+#define NUM_CP_TYPES 5
+#define CHPS_PER_CPTYPE 8
+
+#define CHIP_8514 COPROC_TYPE(C_8514,0) /* 8514/A or true clone */
+#define CHIP_MACH8 COPROC_TYPE(C_8514,1) /* ATI Mach8 */
+#define CHIP_MACH32 COPROC_TYPE(C_8514,2) /* ATI Mach32 */
+#define CHIP_CT480 COPROC_TYPE(C_8514,3) /* C&T 82c480 */
+
+#define CHIP_MACH64 COPROC_TYPE(C_MACH64,0) /* ATI Mach64 */
+
+#define CHIP_I128 COPROC_TYPE(C_I128,0) /* Number9 Imagine I128 */
+
+#define CHIP_300SX COPROC_TYPE(C_GLINT,1) /* 3DLabs GLINT 300SX */
+#define CHIP_500TX COPROC_TYPE(C_GLINT,2) /* 3DLabs GLINT 500TX */
+#define CHIP_DELTA COPROC_TYPE(C_GLINT,4) /* 3DLabs GLINT DELTA */
+
+/*
+ * Useful macros
+ */
+#define IS_MDA(c) ((c) == CHIP_MDA)
+#define IS_HERC(c) ((((c) & 0xFF) == CHIP_MDA) && ((c) != CHIP_MDA))
+#define HERC_CHIP(c) (((c) >> 8) & 0xFF)
+#define IS_CGA(c) ((c) == CHIP_CGA)
+#define IS_EGA(c) ((c) == CHIP_EGA)
+#define IS_PGC(c) ((c) == CHIP_PGC)
+#define IS_VGA(c) ((c) == CHIP_VGA)
+#define IS_SVGA(c) ((((c) & 0xFF) == CHIP_VGA) && ((c) != CHIP_VGA))
+#define SVGA_VENDOR(c) (((c) >> 16) & 0xFF)
+#define SVGA_CHIP(c) (((c) >> 8) & 0xFF)
+#define IS_MCGA(c) ((c) == CHIP_MCGA)
+#define IS_COPROC(c) (((c) & 0xFF) == CHIP_COPROC)
+#define COPROC_CLASS(c) (((c) >> 16) & 0xFF)
+#define COPROC_CHIP(c) (((c) >> 8) & 0xFF)
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c
new file mode 100644
index 000000000..7ef4eda65
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c
@@ -0,0 +1,1432 @@
+/* $XConsortium: RamDac.c /main/17 1996/10/25 07:00:23 kaleb $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ * Contributing Authors:
+ * Robin Cutshaw <robin@xfree86.org>
+ * Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RamDac.c,v 3.35 1999/03/21 07:34:54 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, 0x3C6, 0x3C7, 0x3C8, 0x3C9};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+#define RED 0
+#define GREEN 1
+#define BLUE 2
+
+static void ReadPelReg __STDCARGS((Byte, Byte *));
+static void WritePelReg __STDCARGS((Byte, Byte *));
+static Byte SetComm __STDCARGS((Byte));
+static Bool Width8Check __STDCARGS((void));
+static Bool TestDACBit __STDCARGS((Byte, Byte, Byte));
+static Bool S3_Bt485Check __STDCARGS((int *));
+static Bool S3_TVP3020Check __STDCARGS((int *));
+static Bool S3_ATT498Check __STDCARGS((int *));
+static Bool S3_STG1700Check __STDCARGS((int *));
+static Bool S3_GENDACCheck __STDCARGS((int *));
+static void CheckMach32 __STDCARGS((int, int *));
+static void CheckMach64 __STDCARGS((int, int *));
+static void CheckMatrox __STDCARGS((int, int *));
+
+#ifdef __STDC__
+static void ReadPelReg(Byte Index, Byte *Pixel)
+#else
+static void ReadPelReg(Index, Pixel)
+Byte Index;
+Byte *Pixel;
+#endif
+{
+ outp(0x3C7, Index);
+ Pixel[RED] = inp(0x3C9);
+ Pixel[GREEN] = inp(0x3C9);
+ Pixel[BLUE] = inp(0x3C9);
+
+ return;
+}
+
+#ifdef __STDC__
+static void WritePelReg(Byte Index, Byte *Pixel)
+#else
+static void WritePelReg(Index, Pixel)
+Byte Index;
+Byte *Pixel;
+#endif
+{
+ outp(0x3C8, Index);
+ outp(0x3C9, Pixel[RED]);
+ outp(0x3C9, Pixel[GREEN]);
+ outp(0x3C9, Pixel[BLUE]);
+ return;
+}
+
+#ifdef __STDC__
+static Byte SetComm(Byte Comm)
+#else
+static Byte SetComm(Comm)
+Byte Comm;
+#endif
+{
+ (void) dactocomm();
+ outp(0x3C6, Comm);
+ (void) dactocomm();
+ return(inp(0x3C6));
+}
+
+static Bool Width8Check()
+{
+ Byte old, x, v;
+ Byte pix[3];
+
+ old = inp(0x3C8);
+ ReadPelReg(0xFF, pix);
+ v = pix[RED];
+ pix[RED]= 0xFF;
+ WritePelReg(0xFF, pix);
+ ReadPelReg(0xFF, pix);
+ x = pix[RED];
+ pix[RED] = v;
+ WritePelReg(0xFF, pix);
+ outp(0x3C8, old);
+ return(x == 0xFF);
+}
+
+#ifdef __STDC__
+static Bool TestDACBit(Byte Bit, Byte OldComm, Byte OldPel)
+#else
+static Bool TestDACBit(Bit, OldComm, OldPel)
+Byte Bit;
+Byte OldComm;
+Byte OldPel;
+#endif
+{
+ Byte tmp;
+
+ dactopel();
+ outp(0x3C6, OldPel & (Bit ^ 0xFF));
+ (void) dactocomm();
+ outp(0x3C6, OldComm | Bit);
+ tmp = inp(0x3C6);
+ outp(0x3C6, tmp & (Bit ^ 0xFF));
+ return((tmp & Bit) != 0);
+}
+
+static Bool S3_Bt485Check(RamDac)
+int *RamDac;
+{
+ Byte old1, old2, old3, old4;
+ Byte lock1, lock2;
+ Bool Found = FALSE;
+ Bool DoChecks = FALSE;
+
+ lock1 = rdinx(CRTC_IDX, 0x38);
+ lock2 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xA5);
+
+ old1 = inp(0x3C6);
+ old2 = rdinx(CRTC_IDX, 0x55);
+ outp(0x3C6, 0x0F);
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02);
+ old3 = inp(0x3C6);
+ if ((old3 & 0x80) == 0x80)
+ {
+ Found = TRUE;
+ if ((old3 & 0xC0) == 0x80)
+ {
+ *RamDac = DAC_BT485;
+ DoChecks = TRUE;
+ }
+ else if ((old3 & 0xF0) == 0xD0)
+ {
+ DoChecks = TRUE;
+ *RamDac = DAC_ATT505;
+ }
+ else
+ {
+ *RamDac = DAC_UNKNOWN;
+ }
+ }
+ else if ((old3 & 0xF0) == 0x40)
+ {
+ Found = TRUE;
+ *RamDac = DAC_ATT504;
+ DoChecks = TRUE;
+ }
+ else
+ {
+ /* Perhaps status reg is hidden behind CR3 */
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01);
+ old3 = inp(0x3C6);
+ if ((old3 & 0x80) == 0x80)
+ {
+ /* OK. CR3 is active... */
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00);
+ old3 = inp(0x3C8);
+ outp(0x3C8, 0x00);
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02);
+ old4 = inp(0x3C6);
+ if ((old4 & 0x80) == 0x80)
+ {
+ Found = TRUE;
+ if ((old4 & 0xC0) == 0x80)
+ {
+ *RamDac = DAC_BT485;
+ }
+ else if ((old4 & 0xF0) == 0xD0)
+ {
+ *RamDac = DAC_ATT505;
+ }
+ else
+ {
+ *RamDac = DAC_UNKNOWN;
+ }
+ }
+ else if ((old4 & 0xF0) == 0x40)
+ {
+ Found = TRUE;
+ *RamDac = DAC_ATT504;
+ }
+ if ((Found) && (*RamDac != DAC_UNKNOWN))
+ {
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ }
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00);
+ outp(0x3C8, old3);
+ }
+ }
+ if (DoChecks)
+ {
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ }
+ wrinx(CRTC_IDX, 0x55, old2);
+ outp(0x3C6, old1);
+
+ wrinx(CRTC_IDX, 0x39, lock2);
+ wrinx(CRTC_IDX, 0x38, lock1);
+
+ return(Found);
+}
+
+static Bool S3_TVP3020Check(RamDac)
+int *RamDac;
+{
+ Byte old1, old2, old3, old4;
+ Byte lock1, lock2;
+ Bool Found = FALSE;
+
+ /*
+ * TI ViewPoint TVP3020 support - Robin Cutshaw
+ *
+ * The 3020 has 8 direct registers accessed through standard
+ * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7. Bit 0 of
+ * CR55 is used to map these four register to the low four
+ * or high four direct 3020 registers. The high register set
+ * includes index and data registers which are used to address
+ * indirect registers 0x00-0x3F and 0xFF. Indirect register
+ * 0x3F is the chip ID register which will always return 0x20.
+ */
+
+ lock1 = rdinx(CRTC_IDX, 0x38);
+ lock2 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xA5);
+
+ old1 = inp(0x3C6);
+ old2 = rdinx(CRTC_IDX, 0x55);
+
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); /* high four registers */
+ old3 = inp(0x3C6); /* read current index register value */
+
+ outp(0x3C6, 0x3F); /* write ID register index to index register */
+ old4 = inp(0x3C7); /* read ID register from data register */
+ if (old4 == 0x20) {
+ Found = TRUE;
+ *RamDac = DAC_TVP3020 | DAC_6_8_PROGRAM;
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ } else {
+ Byte old5, old6;
+
+ /* check for Ti3025 hiding behind Bt485 mode */
+ old5 = rdinx(CRTC_IDX, 0x5C);
+
+ /* clear 0x20 (RS4) for 3020 mode */
+ wrinx(CRTC_IDX, 0x5C, old5 & 0xDF);
+ /* already twiddled CR55 above */
+ old6 = inp(0x3C6); /* read current index register value */
+ outp(0x3C6, 0x3F); /* write ID register index to index register */
+ old4 = inp(0x3C7); /* read ID register from data register */
+ if (old4 == 0x25) {
+ Found = TRUE;
+ *RamDac = DAC_TVP3025 | DAC_6_8_PROGRAM;
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01);
+ }
+
+ outp(0x3C6, old6); /* restore index register value */
+ wrinx(CRTC_IDX, 0x5C, old5); /* restore 5C */
+ }
+
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x01); /* high four registers */
+ outp(0x3C6, old3); /* restore index register value */
+
+ wrinx(CRTC_IDX, 0x55, old2);
+ outp(0x3C6, old1);
+
+ wrinx(CRTC_IDX, 0x39, lock2);
+ wrinx(CRTC_IDX, 0x38, lock1);
+
+ return(Found);
+}
+
+static Bool S3_TVP3026Check(RamDac)
+int *RamDac;
+{
+ Byte old1, old2, old3, old4, old5;
+ Byte lock1, lock2;
+ Bool Found = FALSE;
+
+ /*
+ * TI ViewPoint TVP3026/3030 support - Harald Koenig
+ *
+ * The 3026/3030 have 16 direct registers accessed through standard
+ * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7. Bits 0,1 of
+ * CR55 are used to map these four register to sets of four
+ * direct 3026/3030 registers each. The 00 register set includes
+ * the index register and the 10 register set includes the
+ * data register which are used to address indirect registers
+ * 0x00-0x3F and 0xFF. Indirect register 0x3F is the
+ * chip ID register which will always return 0x26.
+ */
+
+ lock1 = rdinx(CRTC_IDX, 0x38);
+ lock2 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xA5);
+
+ old1 = inp(0x3C6);
+ old2 = rdinx(CRTC_IDX, 0x55);
+ old5 = rdinx(CRTC_IDX, 0x45);
+
+
+ wrinx(CRTC_IDX, 0x45, old5 & ~0x20);
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* 00 four registers */
+ old3 = inp(0x3C8); /* read current index register value */
+
+ outp(0x3C8, 0x3F); /* write ID register index to index register */
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x02); /* 10 four registers */
+ old4 = inp(0x3C6); /* read ID register from data register */
+ if (old4 == 0x26 || old4 == 0x30) {
+ outp(0x3C6, ~old4); /* check if ID register is read only */
+ if (inp(0x3C6) != old4) {
+ outp(0x3C6, old4);
+ }
+ else {
+ Found = TRUE;
+ if (old4 == 0x26)
+ *RamDac = DAC_TVP3026 | DAC_6_8_PROGRAM;
+ else /* old4 == 0x30 */
+ *RamDac = DAC_TVP3030 | DAC_6_8_PROGRAM;
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* regular VGA */
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ }
+ }
+
+ wrinx(CRTC_IDX, 0x55, (old2 & 0xFC) | 0x00); /* 00 four registers */
+ outp(0x3C8, old3); /* restore index register value */
+
+ wrinx(CRTC_IDX, 0x55, old2);
+ wrinx(CRTC_IDX, 0x45, old5);
+ outp(0x3C6, old1);
+
+ wrinx(CRTC_IDX, 0x39, lock2);
+ wrinx(CRTC_IDX, 0x38, lock1);
+
+ return(Found);
+}
+
+static Bool S3_IBMRGBCheck(RamDac)
+int *RamDac;
+{
+ Byte lock1, lock2;
+ Bool Found = FALSE;
+ unsigned char CR43, CR55, dac[3], lut[6];
+ unsigned char ilow, ihigh, id, rev, id2, rev2;
+ int i,j;
+ int ret=0;
+
+ /*
+ * IBM RGB52x support - Harald Koenig
+ */
+
+ lock1 = rdinx(CRTC_IDX, 0x38);
+ lock2 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xA5);
+
+ CR43 = rdinx(CRTC_IDX, 0x43);
+ CR55 = rdinx(CRTC_IDX, 0x55);
+
+ wrinx(CRTC_IDX, 0x43, CR43 & ~0x02);
+ wrinx(CRTC_IDX, 0x55, CR55 & ~0x03);
+
+ /* save DAC and first LUT entries */
+ for (i=0; i<3; i++)
+ dac[i] = inp(0x3c6+i);
+ for (i=j=0; i<2; i++) {
+ outp(0x3c7, i);
+ lut[j++] = inp(0x3c9);
+ lut[j++] = inp(0x3c9);
+ lut[j++] = inp(0x3c9);
+ }
+
+ wrinx(CRTC_IDX, 0x55, (CR55 & ~0x03) | 0x01); /* set RS2 */
+
+ /* read ID and revision */
+ ilow = inp(0x3c8);
+ ihigh = inp(0x3c9);
+ outp(0x3c9, 0); /* index high */
+ outp(0x3c8, 0);
+ rev = inp(0x3c6);
+ outp(0x3c8, 1);
+ id = inp(0x3c6);
+
+ /* known IDs:
+ 1 = RGB525
+ 2 = RGB524, RGB528
+ */
+
+ if (id >= 1 && id <= 2) {
+ /* check if ID and revision are read only */
+ outp(0x3c8, 0);
+ outp(0x3c6, ~rev);
+ outp(0x3c8, 1);
+ outp(0x3c6, ~id);
+ outp(0x3c8, 0);
+ rev2 = inp(0x3c6);
+ outp(0x3c8, 1);
+ id2 = inp(0x3c6);
+
+ if (id == id2 && rev == rev2) { /* IBM RGB52x found */
+ Found = TRUE;
+ switch(id) {
+ case 1:
+ *RamDac = DAC_IBMRGB525 | DAC_6_8_PROGRAM;
+ break;
+ case 2:
+ outp(0x3c8, 0x70);
+ id2 = inp(0x3c6);
+ if ((id2 & 0x03) == 3)
+ *RamDac = DAC_IBMRGB528 | DAC_6_8_PROGRAM;
+ else
+ *RamDac = DAC_IBMRGB524 | DAC_6_8_PROGRAM;
+ break;
+ }
+ }
+ else {
+ outp(0x3c8, 0);
+ outp(0x3c6, rev);
+ outp(0x3c8, 1);
+ outp(0x3c6, id);
+ }
+ }
+ outp(0x3c8, ilow);
+ outp(0x3c9, ihigh);
+
+ wrinx(CRTC_IDX, 0x55, CR55 & ~0x03);
+
+ /* restore DAC and first LUT entries */
+ for (i=j=0; i<2; i++) {
+ outp(0x3c8, i);
+ outp(0x3c9, lut[j++]);
+ outp(0x3c9 ,lut[j++]);
+ outp(0x3c9 ,lut[j++]);
+ }
+ for (i=0; i<3; i++)
+ outp(0x3c6+i, dac[i]);
+
+ wrinx(CRTC_IDX, 0x43, CR43);
+ wrinx(CRTC_IDX, 0x55, CR55);
+
+
+ if (Found && Width8Check()) {
+ *RamDac |= DAC_8BIT;
+ }
+
+ wrinx(CRTC_IDX, 0x39, lock2);
+ wrinx(CRTC_IDX, 0x38, lock1);
+
+ return(Found);
+}
+
+static Bool S3_ATT498Check(RamDac)
+int *RamDac;
+{
+ Byte mir, dir, daccomm;
+ int i;
+ Bool Found = FALSE;
+
+ /*
+ * ATT20C498 support - Harald Koenig
+ * ATT20C409 and
+ * ATT20C499 support - Dirk Hohndel
+ *
+ * The ATT498 has 4 direct registers accessed through standard
+ * VGA registers 0x3C8, 0x3C9, 0x3C6, and 0x3C7 and 6 indirect
+ * registers accessed through a back door by successive reads
+ * on RMR (Pixel read mask register 0x3C6).
+ */
+
+ dactocomm();
+ inp(0x3C6); /* reading CR0 */
+ mir = inp(0x3C6);
+ dir = inp(0x3C6);
+ dactopel();
+
+ if ((mir == 0x84) && (dir == 0x98)) {
+ daccomm = getdaccomm();
+ SetComm(0);
+ SetComm(0x0a);
+ if (getdaccomm() == 0)
+ *RamDac = DAC_ATT22C498;
+ else
+ *RamDac = DAC_ATT498;
+ SetComm(daccomm);
+ Found = TRUE;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ else if( (mir = 0x84) && (dir == 0x09) ) {
+ SetComm(daccomm);
+ *RamDac = DAC_ATT409 | DAC_6_8_PROGRAM;
+ Found = TRUE;
+ }
+ else if( (mir = 0x84) && (dir == 0x99) ) {
+ SetComm(daccomm);
+ *RamDac = DAC_ATT499 | DAC_6_8_PROGRAM;
+ Found = TRUE;
+ }
+
+ return(Found);
+}
+
+static Bool CH8398Check(RamDac)
+int *RamDac;
+{
+/* This dac does not provide much information to distinguish itself. */
+/* So this probe may not be suitable, unless you know that the ch8398 */
+/* is a possibility. */
+ Byte cid;
+ Bool Found = FALSE;
+
+ dactopel();
+ inp(0x3c6);
+ inp(0x3c6);
+ inp(0x3c6);
+ cid = inp(0x3c6); /* device ID */
+ if (cid == 0xc0) {
+ Found = TRUE;
+ *RamDac = DAC_CH8398;
+ }
+ dactopel();
+ return Found;
+}
+
+static Bool S3_STG1700Check(RamDac)
+int *RamDac;
+{
+ Byte cid, did, daccomm, readmask;
+ int i;
+ Bool Found = FALSE;
+
+ readmask = inp(0x3c6);
+ dactopel();
+ daccomm = getdaccomm();
+ SetComm(daccomm | 0x10);
+ dactocomm();
+ inp(0x3C6);
+ outp(0x3c6, 0x00);
+ outp(0x3c6, 0x00);
+ cid = inp(0x3c6); /* company ID */
+ did = inp(0x3c6); /* device ID */
+ dactopel();
+ outp(0x3c6,readmask);
+ SetComm(daccomm);
+
+ if ((cid == 0x44) && (did == 0x00)) {
+ Found = TRUE;
+ *RamDac = DAC_STG1700;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ if ((cid == 0x44) && (did == 0x02)) {
+ Found = TRUE;
+ *RamDac = DAC_STG1702;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ if ((cid == 0x44) && (did == 0x03)) {
+ Found = TRUE;
+ *RamDac = DAC_STG1703;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+
+ return(Found);
+}
+
+static Bool S3_GENDACCheck(RamDac)
+int *RamDac;
+{
+ Byte daccomm;
+ int i;
+ Bool Found = FALSE;
+ Byte lock1, lock2;
+
+ Byte saveCR55, savelut[6];
+ long clock01, clock23;
+
+ /* probe for S3 GENDAC or SDAC */
+ /*
+ * S3 GENDAC and SDAC have two fixed read only PLL clocks
+ * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61
+ * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62
+ * which can be used to detect GENDAC and SDAC since there is no chip-id
+ * for the GENDAC.
+ *
+ * NOTE: for the GENDAC on a MIRO 10SD (805+GENDAC) reading PLL values
+ * for CLK0 f0 and f1 always returns 0x7f (but is documented "read only)
+ */
+
+
+ lock1 = rdinx(CRTC_IDX, 0x38);
+ lock2 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xA5);
+
+ saveCR55 = rdinx(CRTC_IDX, 0x55);
+ wrinx(CRTC_IDX, 0x55, saveCR55 & ~1);
+
+ outp(0x3c7,0);
+ for(i=0; i<2*3; i++) /* save first two LUT entries */
+ savelut[i] = inp(0x3c9);
+ outp(0x3c8,0);
+ for(i=0; i<2*3; i++) /* set first two LUT entries to zero */
+ outp(0x3c9,0);
+
+ wrinx(CRTC_IDX, 0x55, saveCR55 | 1);
+
+ outp(0x3c7,0);
+ for(i=clock01=0; i<4; i++)
+ clock01 = (clock01 << 8) | (inp(0x3c9) & 0xff);
+ for(i=clock23=0; i<4; i++)
+ clock23 = (clock23 << 8) | (inp(0x3c9) & 0xff);
+
+ wrinx(CRTC_IDX, 0x55, saveCR55 & ~1);
+
+ outp(0x3c8,0);
+ for(i=0; i<2*3; i++) /* restore first two LUT entries */
+ outp(0x3c9,savelut[i]);
+
+ wrinx(CRTC_IDX, 0x55, saveCR55);
+ wrinx(CRTC_IDX, 0x39, lock2);
+ wrinx(CRTC_IDX, 0x38, lock1);
+
+ if ( clock01 == 0x28613d62 ||
+ (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) {
+ Found = TRUE;
+
+ dactopel();
+ inp(0x3c6);
+ inp(0x3c6);
+ inp(0x3c6);
+
+ /* the fourth read will show the SDAC chip ID and revision */
+ if (((i=inp(0x3c6)) & 0xf0) == 0x70)
+ *RamDac = DAC_S3_SDAC;
+ else
+ *RamDac = DAC_S3_GENDAC;
+ dactopel();
+ }
+
+ return(Found);
+}
+
+static Bool Tseng_GENDACCheck(RamDac)
+int *RamDac;
+{
+ Byte daccomm;
+ int i;
+ Bool Found = FALSE;
+
+ Byte saveCR31, savelut[6];
+ Byte saveHercComp, saveModeContr;
+ long clock01, clock23;
+
+ /* probe for Tseng GENDAC or SDAC */
+ /*
+ * S3 GENDAC and SDAC have two fixed read only PLL clocks
+ * CLK0 f0: 25.255MHz M-byte 0x28 N-byte 0x61
+ * CLK0 f1: 28.311MHz M-byte 0x3d N-byte 0x62
+ * which can be used to detect GENDAC and SDAC since there is no chip-id
+ * for the GENDAC.
+ */
+
+
+ saveHercComp = inp(0x3BF);
+ saveModeContr= inp(0x3D8);
+ outp(0x3BF, 0x03); /* unlock ET4000 special */
+ outp(0x3D8, 0xA0);
+
+ saveCR31 = rdinx(CRTC_IDX, 0x31);
+ wrinx(CRTC_IDX, 0x31, saveCR31 & ~0x40);
+
+ outp(0x3c7,0);
+ for(i=0; i<2*3; i++) /* save first two LUT entries */
+ savelut[i] = inp(0x3c9);
+ outp(0x3c8,0);
+ for(i=0; i<2*3; i++) /* set first two LUT entries to zero */
+ outp(0x3c9,0);
+
+ wrinx(CRTC_IDX, 0x31, saveCR31 | 0x40);
+
+ outp(0x3c7,0);
+ for(i=clock01=0; i<4; i++)
+ clock01 = (clock01 << 8) | (inp(0x3c9) & 0xff);
+ for(i=clock23=0; i<4; i++)
+ clock23 = (clock23 << 8) | (inp(0x3c9) & 0xff);
+
+ wrinx(CRTC_IDX, 0x31, saveCR31 & ~0x40);
+
+ outp(0x3c8,0);
+ for(i=0; i<2*3; i++) /* restore first two LUT entries */
+ outp(0x3c9,savelut[i]);
+
+ wrinx(CRTC_IDX, 0x31, saveCR31);
+
+ outp(0x3BF, saveHercComp);
+ outp(0x3D8, saveModeContr);
+
+ if ( clock01 == 0x28613d62 ||
+ (clock01 == 0x7f7f7f7f && clock23 != 0x7f7f7f7f)) {
+ Found = TRUE;
+
+ dactopel();
+ inp(0x3c6);
+ inp(0x3c6);
+ inp(0x3c6);
+
+ /* the fourth read will show the SDAC chip ID and revision */
+ if (((i=inp(0x3c6)) & 0xf0) == 0xb0)
+ *RamDac = DAC_ICS5341;
+ else
+ *RamDac = DAC_ICS5301; /* ID code ICS5301 = 0xf0 */
+ dactopel();
+ }
+
+ return(Found);
+}
+
+static Bool S3_SC15025Check(RamDac)
+int *RamDac;
+{
+ Byte c,id[4];
+ int i;
+ Bool Found = FALSE;
+
+ /*
+ * Sierra 15025 support - Harald Koenig
+ *
+ * The SC15025 has 9 indexed extended registers which can be accessed
+ * by setting bit 0x10 in the command register.
+ * In extended registers 0x9-0xC an identification code is stored
+ * should be 53 3a b1 41
+ */
+
+ c = getdaccomm();
+ SetComm(c | 0x10); /* enable extened data registers */
+ for (i=0; i<4; i++) {
+ outp(0x3C7, 0x9+i);
+ id[i] = inp(0x3C8);
+ }
+ SetComm(c); /* restore command register */
+ dactopel();
+
+ if (id[0] == 'S' && /* Sierra */
+ ((id[1]<<8)|id[2]) == 15025) { /* unique for the SC 15025/26 */
+ if (id[3] != 'A') { /* version number */
+ fprintf(stderr,"*** ==> New Sierra SC 15025/26 version (%x) found, please report!\n",id[3]);
+ }
+ Found = TRUE;
+ *RamDac = DAC_SIERRA24;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+
+ return(Found);
+}
+
+static Bool ARK_ZOOMDACCheck(RamDac)
+int *RamDac;
+{
+ /*
+ * This DAC has the same ID as an AT&T ATT20C498, but
+ * with an ARK chip it is reasonable to assume it's a ZOOMDAC.
+ */
+ Byte cid, did, daccomm, readmask;
+ int i;
+ Bool Found = FALSE;
+
+ dactopel();
+ dactocomm();
+ inp(0x3C6);
+ cid = inp(0x3c6); /* company ID */
+ did = inp(0x3c6); /* device ID */
+ dactopel();
+
+ if ((cid == 0x84) && (did == 0x98)) {
+ Found = TRUE;
+ *RamDac = DAC_ZOOMDAC;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+
+ return(Found);
+}
+
+
+static void CheckMach32(ChipSet, RamDac)
+int ChipSet;
+int *RamDac;
+{
+ Word Port = CONFIG_STATUS_1;
+ EnableIOPorts(1, &Port);
+
+ switch ((inpw(Port) & 0x0E00) >> 9)
+ {
+ case 0x00:
+ *RamDac = DAC_ATI68830;
+ break;
+ case 0x01:
+ *RamDac = DAC_SIERRA15_16;
+ break;
+ case 0x02:
+ *RamDac = DAC_ATI68875;
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ break;
+ case 0x03:
+ *RamDac = DAC_STANDARD;
+ break;
+ case 0x04:
+ *RamDac = DAC_ATIMISC24;
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ break;
+ case 0x05:
+ *RamDac = DAC_ATI68860;
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ break;
+ case 0x06:
+ *RamDac = DAC_STG1700;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x07:
+ *RamDac = DAC_ATT498;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ }
+
+ DisableIOPorts(1, &Port);
+ return;
+}
+
+static void CheckMach64(ChipSet, RamDac)
+int ChipSet;
+int *RamDac;
+{
+ extern Word ATIMach64DAC_CNTL, ATIMach64SCRATCH_REG1;
+
+ if (ChipSet >= CHIP_ATI264CT)
+ {
+ *RamDac = DAC_ATI_INTERNAL;
+ *RamDac |= DAC_6_8_PROGRAM;
+ if (Width8Check())
+ *RamDac |= DAC_8BIT;
+ return;
+ }
+
+ EnableIOPorts(1, &ATIMach64DAC_CNTL);
+ EnableIOPorts(1, &ATIMach64SCRATCH_REG1);
+
+ switch (((inpl(ATIMach64DAC_CNTL) & 0x00070000) |
+ (inpl(ATIMach64SCRATCH_REG1) & 0x0000F000)) >> 12)
+ {
+ case 0x10:
+ *RamDac = DAC_IBMRGB525;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x20:
+ *RamDac = DAC_ATI68875;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x27:
+ case 0x57:
+ *RamDac = DAC_TVP3025;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x30:
+ *RamDac = DAC_STANDARD;
+ break;
+ case 0x40:
+ *RamDac = DAC_ATIMISC24;
+ break;
+ case 0x41:
+ *RamDac = DAC_ATT491;
+ break;
+ case 0x42:
+ *RamDac = DAC_SIERRA24;
+ break;
+ case 0x43:
+ *RamDac = DAC_MU9C1880;
+ break;
+ case 0x44:
+ *RamDac = DAC_IMSG174;
+ break;
+ case 0x50:
+ case 0x51:
+ *RamDac = DAC_ATI68860;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x60:
+ *RamDac = DAC_STG1700;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x61:
+ *RamDac = DAC_ATT498;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x70:
+ *RamDac = DAC_STG1702;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x71:
+ *RamDac = DAC_SIERRA24;
+ break;
+ case 0x72:
+ *RamDac = DAC_ATT498;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x73:
+ *RamDac = DAC_STG1703;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x74:
+ *RamDac = DAC_CH8398;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ case 0x75:
+ *RamDac = DAC_ATT408;
+ *RamDac |= DAC_6_8_PROGRAM;
+ break;
+ default:
+ break;
+ }
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+
+ DisableIOPorts(1, &ATIMach64DAC_CNTL);
+ DisableIOPorts(1, &ATIMach64SCRATCH_REG1);
+ return;
+}
+
+void Probe_RamDac(Chipset, RamDac)
+int Chipset;
+int *RamDac;
+{
+ Byte x, y, z, u, v, oldcomm, oldpel, notcomm, tmp;
+ Bool dac8, dac8now;
+
+ *RamDac = DAC_STANDARD;
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Handle special cases.
+ */
+ if (Chipset == CHIP_AL2101)
+ {
+ *RamDac = DAC_ALG1101;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ else if (SVGA_VENDOR(Chipset) == V_ATI)
+ {
+ extern Bool Crippled_Mach32, Crippled_Mach64;
+
+ if ((Chipset < CHIP_ATI68800_3) || Crippled_Mach32)
+ {
+ if (ReadBIOS(0x44, &x, 1) != 1)
+ {
+ fprintf(stderr, "%s: Failed to read ATI BIOS data\n",
+ MyName);
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (x & 0x80)
+ {
+ *RamDac = DAC_ATI68830;
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ else if (!Crippled_Mach64)
+ {
+ if (Chipset <= CHIP_ATI88800GXC)
+ {
+ CheckMach32(Chipset, RamDac);
+ if (DAC_CHIP(*RamDac) != DAC_ATIMISC24)
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ else
+ {
+ CheckMach64(Chipset, RamDac);
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ }
+ else if ((SVGA_VENDOR(Chipset) == V_CIRRUS) &&
+ (Chipset >= CHIP_CL5420))
+ {
+ if ((Chipset == CHIP_CL5420) || (Chipset >= CHIP_CL5410))
+ {
+ *RamDac = DAC_CIRRUSA;
+ }
+ else
+ {
+ *RamDac = DAC_CIRRUSB;
+ }
+ if (Width8Check())
+ {
+ *RamDac |= DAC_8BIT;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ else if ((SVGA_VENDOR(Chipset) == V_S3) && (Chipset >= CHIP_S3_928D))
+ {
+ if (S3_TVP3026Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_IBMRGBCheck(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_TVP3020Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_Bt485Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_ATT498Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_STG1700Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_GENDACCheck(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_SC15025Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ else if ( ((SVGA_VENDOR(Chipset) == V_S3) && (Chipset >= CHIP_S3_801B))
+ ||(SVGA_VENDOR(Chipset) == V_TSENG) )
+ {
+ if ( (Chipset == CHIP_ET6K) || (Chipset == CHIP_ET6K1) || (Chipset == CHIP_ET6K3) )
+ {
+ *RamDac = DAC_ET6K;
+ }
+ if (S3_GENDACCheck(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_STG1700Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (CH8398Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if ( (SVGA_VENDOR(Chipset) == V_TSENG) && ( Chipset != CHIP_ET6K )
+ && ( Chipset != CHIP_ET6K1 ) && ( Chipset != CHIP_ET6K3 ) )
+ {
+ if (Tseng_GENDACCheck(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ }
+ else if (SVGA_VENDOR(Chipset) == V_MATROX)
+ {
+ if (Chipset == CHIP_MGA2085PX)
+ *RamDac = DAC_BT485;
+ if (Chipset == CHIP_MGA2064W)
+ *RamDac = DAC_TVP3026;
+ if ((Chipset == CHIP_MGA2164W)||(Chipset == CHIP_MGA2164WAGP))
+ *RamDac = DAC_TVP3026;
+ if (Chipset == CHIP_MGA1064SG)
+ *RamDac = DAC_MGA1064SG;
+ if ((Chipset == CHIP_MGAG100PCI)||(Chipset == CHIP_MGAG100AGP))
+ *RamDac = DAC_MGAG100;
+ if ((Chipset == CHIP_MGAG200PCI)||(Chipset == CHIP_MGAG200AGP))
+ *RamDac = DAC_MGAG200;
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ else if ( (SVGA_VENDOR(Chipset) == V_TRIDENT) &&
+ (Chipset >= CHIP_TVGA9000I) )
+ {
+ if (Chipset <= CHIP_TVGA9440)
+ *RamDac = DAC_TKD8001;
+ else
+ *RamDac = DAC_TGUIDAC;
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ else if (SVGA_VENDOR(Chipset) == V_ARK)
+ {
+ if (ARK_ZOOMDACCheck(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ if (S3_STG1700Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ else if (SVGA_VENDOR(Chipset) == V_ALLIANCE)
+ {
+ if (Chipset == CHIP_ALSC6422 || Chipset == CHIP_ALSCAT24)
+ {
+ *RamDac = DAC_ALSC_642x;
+ }
+ if (S3_STG1700Check(RamDac))
+ {
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+ }
+ }
+ else if (SVGA_VENDOR(Chipset) == V_SIS)
+ {
+ if ((Chipset >= CHIP_SIS86C201) && (Chipset <= CHIP_SIS6326))
+ *RamDac = DAC_SIS;
+ }
+ /*
+ * Save current state.
+ */
+ (void) dactocomm();
+ oldcomm = inp(0x3C6);
+ dactopel();
+ oldpel = inp(0x3C6);
+
+ /*
+ * Do 8-bit-wide check.
+ */
+ (void) dactocomm();
+ outp(0x3C6, 0x00);
+ dac8 = Width8Check();
+ dactopel();
+
+ /*
+ * Check whether this DAC has a HiColor-style command register.
+ */
+ notcomm = ~oldcomm;
+ outp(0x3C6, notcomm);
+ (void) dactocomm();
+ v = inp(0x3C6);
+ if (v != notcomm)
+ {
+ /*
+ * Check for early-generation HiColor-style DAC.
+ */
+ if ((SetComm(0xE0) & 0xE0) != 0xE0)
+ {
+ dactopel();
+ x = inp(0x3C6);
+ do
+ {
+ /*
+ * Wait for same value twice.
+ */
+ y = x;
+ x = inp(0x3C6);
+ }
+ while (x != y);
+ z = x;
+ u = dactocomm();
+ if (u != 0x8E)
+ {
+ /*
+ * If command register is 0x8E, we've got an SS24;
+ */
+ y = 8;
+ do
+ {
+ x = inp(0x3C6);
+ y--;
+ }
+ while ((x != 0x8E) && (y != 0));
+ }
+ else
+ {
+ x = u;
+ }
+ if (x == 0x8E)
+ {
+ *RamDac = DAC_SS24;
+ }
+ else
+ {
+ /*
+ * Sierra SC11486
+ */
+ *RamDac = DAC_SIERRA15;
+ }
+ dactopel();
+ }
+ else
+ {
+ /*
+ * New generation of advanced DACs
+ */
+ if ((SetComm(0x60) & 0xE0) == 0x00)
+ {
+ /*
+ * AT&T 20C490/20C493
+ */
+ if ((SetComm(0x02) & 0x02) != 0x00)
+ {
+ *RamDac = DAC_ATT490;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ else
+ {
+ *RamDac = DAC_ATT493;
+ }
+ }
+ else
+ {
+ x = SetComm(oldcomm);
+ if (inp(0x3C6) == notcomm)
+ {
+ if (SetComm(0xFF) != 0xFF)
+ {
+ *RamDac = DAC_ACUMOS;
+ }
+ else
+ {
+ (void) Width8Check();
+ dactocomm();
+ tmp = inp(0x3C6);
+ dactocomm();
+ outp(0x3C6, (tmp | 0x02) & 0xFE);
+ dac8now = Width8Check();
+ if (dac8now)
+ {
+ if (Width8Check())
+ {
+ *RamDac = DAC_ATT491;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ else
+ {
+ *RamDac = DAC_CIRRUS24;
+ }
+ }
+ else
+ {
+ *RamDac = DAC_ATT492;
+ }
+ }
+ }
+ else
+ {
+ if (trigdac() == notcomm)
+ {
+ *RamDac = DAC_CIRRUS24;
+ }
+ else
+ {
+ dactopel();
+ outp(0x3C6, 0xFF);
+ switch (trigdac())
+ {
+ case 0x44:
+ *RamDac = DAC_MUSIC4870;
+ break;
+ case 0x82:
+ *RamDac = DAC_MUSIC4910;
+ break;
+ case 0x8E:
+ *RamDac = DAC_SS24;
+ break;
+ default:
+ if (TestDACBit(0x10,oldcomm,oldpel))
+ {
+ *RamDac = DAC_SIERRA24;
+ *RamDac |= DAC_6_8_PROGRAM;
+ }
+ else if (TestDACBit(0x04,oldcomm,oldpel))
+ {
+ *RamDac = DAC_UNKNOWN;
+ }
+ else
+ {
+ *RamDac = DAC_SIERRA15_16;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ dactocomm();
+ outp(0x3C6, oldcomm);
+ }
+ dactopel();
+ outp(0x3C6, oldpel);
+
+ /*
+ * If no special DAC found, check for the EDSUN DAC.
+ */
+ if (*RamDac == DAC_STANDARD)
+ {
+ /*
+ * Write "CEGEDSUN" + mode to DAC index 0xDE (222)
+ */
+ waitforretrace();
+ outp(0x3C8, 0xDE);
+ outp(0x3C9, (Byte)'C');
+ outp(0x3C9, (Byte)'E');
+ outp(0x3C9, (Byte)'G');
+ outp(0x3C8, 0xDE);
+ outp(0x3C9, (Byte)'E');
+ outp(0x3C9, (Byte)'D');
+ outp(0x3C9, (Byte)'S');
+ outp(0x3C8, 0xDE);
+ outp(0x3C9, (Byte)'U');
+ outp(0x3C9, (Byte)'N');
+ outp(0x3C9, (Byte)'\n');
+ /*
+ * Should be in CEG mode now.
+ */
+ outp(0x3C6, 0xFF);
+ x = (inp(0x3C6) >> 4) & 0x07;
+ if (x < 0x07)
+ {
+ *RamDac = DAC_EDSUN;
+ waitforretrace();
+ outp(0x3C8, 0xDF);
+ outp(0x3C9, 0x00);
+ }
+ }
+
+ /*
+ * Remember if DAC was in 8-bit mode.
+ */
+ if (dac8)
+ {
+ *RamDac |= DAC_8BIT;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c
new file mode 100644
index 000000000..b3a4f9b0a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c
@@ -0,0 +1,140 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/RealTek.c,v 3.4 1996/12/23 06:31:35 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: RealTek.c /main/5 1996/02/21 17:12:18 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, 0x3D6, 0x3D7};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_RealTek __STDCARGS((int));
+
+Chip_Descriptor RealTek_Descriptor = {
+ "RealTek",
+ Probe_RealTek,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_RealTek,
+};
+
+#ifdef __STDC__
+Bool Probe_RealTek(int *Chipset)
+#else
+Bool Probe_RealTek(Chipset)
+int *Chipset;
+#endif
+{
+ Bool result = FALSE;
+ Byte ver;
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ if (testinx2(CRTC_IDX, 0x1F, 0x3F) &&
+ tstrg(0x3D6, 0x0F) &&
+ tstrg(0x3D7, 0x0F))
+ {
+ result = TRUE;
+ ver = rdinx(CRTC_IDX, 0x1A) >> 6;
+ switch (ver)
+ {
+ case 0x00:
+ *Chipset = CHIP_RT_3103;
+ break;
+ case 0x01:
+ *Chipset = CHIP_RT_3105;
+ break;
+ case 0x02:
+ *Chipset = CHIP_RT_3106;
+ break;
+ default:
+ Chip_data = ver;
+ *Chipset = CHIP_RT_UNK;
+ break;
+ }
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_RealTek(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ switch (Chipset)
+ {
+ case CHIP_RT_3103:
+ switch (rdinx(CRTC_IDX, 0x1E) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 768;
+ break;
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+ break;
+ case CHIP_RT_3105:
+ case CHIP_RT_3106:
+ switch (rdinx(CRTC_IDX, 0x1E) & 0x03)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ Mem = 1024;
+ break;
+ case 0x03:
+ Mem = 2048;
+ break;
+ }
+ break;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c
new file mode 100644
index 000000000..7698d07dc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c
@@ -0,0 +1,105 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Rendition.c,v 3.1 1997/08/15 07:19:16 hohndel Exp $ */
+/*
+ * (c) Copyright 1997 by Dirk Hohndel <hohndel@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Dirk Hohndel shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Dirk Hohndel.
+ *
+ */
+
+#include "Probe.h"
+
+#define PCI_EN 0x80000000
+
+#ifdef PC98
+static Word Ports[] = {0xCF8, 0xCF9, 0xCFC, 0x000 };
+#else
+static Word Ports[] = {0xCF8, 0xCFA, 0xCFC, 0x000 };
+#endif
+
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Rendition __STDCARGS((int));
+
+Chip_Descriptor Rendition_Descriptor = {
+ "Rendition",
+ Probe_Rendition,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_Rendition,
+};
+
+Bool Probe_Rendition(Chipset)
+int *Chipset;
+{
+ int chipset_passed;
+ int i = -1;
+ Bool result = FALSE;
+ struct pci_config_reg * pcip;
+
+ /*
+ * to be able to detect multiple chips we need to set
+ * *Chipset to 0 first. We'll set it back to the value passed to
+ * us if nothing was found
+ */
+ chipset_passed = *Chipset;
+ *Chipset = 0;
+ /*
+ * we only check for the Rendition in the PCI config data that we have
+ */
+ while (pci_devp[++i] != NULL)
+ {
+ pcip = pci_devp[i];
+ if (pcip->_vendor == PCI_VENDOR_RENDITION)
+ {
+ switch (pcip->_device)
+ {
+ case PCI_CHIP_V1000:
+ *Chipset = CHIP_REND_V1000;
+ result = TRUE;
+ break;
+ case PCI_CHIP_V2000:
+ *Chipset = CHIP_REND_V2000;
+ result = TRUE;
+ break;
+ }
+ }
+ }
+ if (!result)
+ {
+ *Chipset = chipset_passed;
+ }
+
+ return(result);
+}
+
+static int MemProbe_Rendition(Chipset)
+int Chipset;
+{
+ /*
+ * I don't know how to do that, yet
+ */
+ return(0);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c
new file mode 100644
index 000000000..5089cad33
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c
@@ -0,0 +1,565 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/S3.c,v 3.23 1999/06/06 08:48:44 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: S3.c /main/12 1996/10/25 11:33:27 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_S3 __STDCARGS((int));
+
+Chip_Descriptor S3_Descriptor = {
+ "S3",
+ Probe_S3,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ FALSE,
+ MemProbe_S3,
+};
+
+Bool Probe_S3(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte chip, cr38, cr39, cr42, tmp, rev;
+ int i = 0;
+ struct pci_config_reg *pcrp2;
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_S3)
+ {
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+ cr38 = rdinx(CRTC_IDX, 0x38);
+ cr39 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ wrinx(CRTC_IDX, 0x39, 0xa5);
+
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_TRIO:
+#if 1 /* can only be distinguished using port probing... */
+ PCIProbed = FALSE;
+#else
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Trio32;
+ *Chipset = CHIP_S3_Trio64V;
+ *Chipset = CHIP_S3_Trio64;
+#endif
+ break;
+ case PCI_CHIP_868:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_868;
+ break;
+ case PCI_CHIP_928:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_928P;
+ break;
+ case PCI_CHIP_864_0:
+ case PCI_CHIP_864_1:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_864;
+ break;
+ case PCI_CHIP_964_0:
+ case PCI_CHIP_964_1:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_964;
+ break;
+ case PCI_CHIP_968:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_968;
+
+ /* probe for 3Dlabs chip in same PCI slot for ELSA Gloria */
+ cr42 = rdinx(CRTC_IDX, 0x42);
+ wrinx(CRTC_IDX, 0x42, cr42 | 0x08);
+ xf86scanpci();
+ if ((pcrp2 = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp2->_vendor == PCI_VENDOR_3DLABS) {
+ switch (pcrp2->_device) {
+ case PCI_CHIP_3DLABS_300SX:
+ *Chipset = CHIP_S3_968_3DLABS_300SX;
+ break;
+ default:
+ *Chipset = CHIP_S3_968_3DLABS_UNK;
+ break;
+ }
+ }
+ }
+ xf86scanpci();
+
+ break;
+ case PCI_CHIP_ViRGE:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_ViRGE;
+ /*
+ * the ViRGE is used as VGA part for
+ * the GLINT
+ */
+ S3_Descriptor.check_coproc = TRUE;
+ break;
+ case PCI_CHIP_ViRGE_DXGX:
+ PCIProbed = TRUE;
+ if (rdinx(CRTC_IDX, 0x6f) & 1)
+ *Chipset = CHIP_S3_ViRGE_GX;
+ else
+ *Chipset = CHIP_S3_ViRGE_DX;
+ break;
+ case PCI_CHIP_ViRGE_GX2:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_ViRGE_GX2;
+ break;
+ case PCI_CHIP_ViRGE_MX:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_ViRGE_MX;
+ break;
+ case PCI_CHIP_ViRGE_MXP:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_ViRGE_MXP;
+ break;
+ case PCI_CHIP_ViRGE_VX:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_ViRGE_VX;
+ break;
+ case PCI_CHIP_AURORA64VP:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Aurora64VP;
+ break;
+ case PCI_CHIP_TRIO64UVP:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Trio64UVP;
+ break;
+ case PCI_CHIP_TRIO64V2_DXGX:
+ PCIProbed = TRUE;
+ if (rdinx(CRTC_IDX, 0x6f) & 1)
+ *Chipset = CHIP_S3_Trio64V2_GX;
+ else
+ *Chipset = CHIP_S3_Trio64V2_DX;
+ break;
+ case PCI_CHIP_TRIO3D_B:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Trio3D_B;
+ break;
+ case PCI_CHIP_TRIO3D:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Trio3D;
+ break;
+ case PCI_CHIP_SAVAGE3D:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Savage3D;
+ break;
+ case PCI_CHIP_SAVAGE3D_M:
+ PCIProbed = TRUE;
+ *Chipset = CHIP_S3_Savage3D_M;
+ break;
+#if 0 /* use port probing then... */
+ default:
+ PCIProbed = TRUE;
+ Chip_data = chip;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+#endif
+ }
+
+ wrinx(CRTC_IDX, 0x39, cr39);
+ wrinx(CRTC_IDX, 0x38, cr38);
+ DisableIOPorts(NUMPORTS, Ports);
+ if (PCIProbed)
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+ cr38 = rdinx(CRTC_IDX, 0x38);
+ cr39 = rdinx(CRTC_IDX, 0x39);
+ wrinx(CRTC_IDX, 0x38, 0x00);
+ if (!testinx2(CRTC_IDX, 0x35, 0x0F))
+ {
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ if (testinx2(CRTC_IDX, 0x35, 0x0F))
+ {
+ result = TRUE;
+ wrinx(CRTC_IDX, 0x39, 0xa5);
+ rev = rdinx(CRTC_IDX, 0x30);
+ switch (rev & 0xF0)
+ {
+ case 0x80:
+ switch (rev & 0x0F)
+ {
+ case 0x01:
+ *Chipset = CHIP_S3_911;
+ break;
+ case 0x02:
+ *Chipset = CHIP_S3_924;
+ break;
+ default:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ }
+ break;
+ case 0xA0:
+ tmp = rdinx(CRTC_IDX, 0x36);
+ switch (tmp & 0x03)
+ {
+ case 0x00:
+ case 0x01:
+ /* EISA or VLB - 805 */
+ switch (rev & 0x0F)
+ {
+ case 0x00:
+ *Chipset = CHIP_S3_805B;
+ break;
+ case 0x01:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ *Chipset = CHIP_S3_805C;
+ break;
+ case 0x05:
+ *Chipset = CHIP_S3_805D;
+ break;
+ case 0x08:
+ *Chipset = CHIP_S3_805I;
+ break;
+ default:
+ /* Call >0x05 D step for now */
+ *Chipset = CHIP_S3_805D;
+ break;
+ }
+ break;
+ case 0x03:
+ /* ISA - 801 */
+ switch (rev & 0x0F)
+ {
+ case 0x00:
+ *Chipset = CHIP_S3_801B;
+ break;
+ case 0x01:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ *Chipset = CHIP_S3_801C;
+ break;
+ case 0x05:
+ *Chipset = CHIP_S3_801D;
+ break;
+ case 0x08:
+ *Chipset = CHIP_S3_801I;
+ break;
+ default:
+ /* Call >0x05 D step for now */
+ *Chipset = CHIP_S3_801D;
+ break;
+ }
+ break;
+ default:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ }
+ break;
+ case 0x90:
+ switch (rev & 0x0F)
+ {
+ case 0x00:
+ case 0x01:
+ /*
+ * Contradictory documentation -
+ * one says 0, the other says 1.
+ */
+ *Chipset = CHIP_S3_928D;
+ break;
+ case 0x02:
+ case 0x03:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ case 0x04:
+ case 0x05:
+ *Chipset = CHIP_S3_928E;
+ break;
+ default:
+ /* Call >0x05 E step for now */
+ *Chipset = CHIP_S3_928E;
+ }
+ break;
+ case 0xB0:
+ /*
+ * Don't know anything more about this
+ * just yet.
+ */
+ *Chipset = CHIP_S3_928P;
+ break;
+ case 0xC0:
+ *Chipset = CHIP_S3_864;
+ break;
+ case 0xD0:
+ *Chipset = CHIP_S3_964;
+ break;
+ case 0xE0: {
+ int chip_id, chip_rev;
+ chip_id = rdinx(CRTC_IDX, 0x2d) << 8;
+ chip_id |= rdinx(CRTC_IDX, 0x2e);
+ chip_rev = rdinx(CRTC_IDX, 0x2f);
+ switch (chip_id) {
+ case 0x8880:
+ *Chipset = CHIP_S3_866;
+ break;
+ case 0x8890:
+ *Chipset = CHIP_S3_868;
+ break;
+ case 0x8810:
+ *Chipset = CHIP_S3_Trio32;
+ break;
+ case PCI_CHIP_TRIO:
+ if ((chip_rev&0x40) == 0x40)
+ *Chipset = CHIP_S3_Trio64V;
+ else
+ *Chipset = CHIP_S3_Trio64;
+ break;
+ case PCI_CHIP_TRIO64V2_DXGX:
+ if (rdinx(CRTC_IDX, 0x6f) & 1)
+ *Chipset = CHIP_S3_Trio64V2_GX;
+ else
+ *Chipset = CHIP_S3_Trio64V2_DX;
+ break;
+ case PCI_CHIP_ViRGE_DXGX:
+ if (rdinx(CRTC_IDX, 0x6f) & 1)
+ *Chipset = CHIP_S3_ViRGE_GX;
+ else
+ *Chipset = CHIP_S3_ViRGE_DX;
+ break;
+ case PCI_CHIP_968:
+ *Chipset = CHIP_S3_968;
+ break;
+ case PCI_CHIP_AURORA64VP:
+ *Chipset = CHIP_S3_Aurora64VP;
+ break;
+ case PCI_CHIP_ViRGE:
+ *Chipset = CHIP_S3_ViRGE;
+ break;
+ case PCI_CHIP_ViRGE_VX:
+ *Chipset = CHIP_S3_ViRGE_VX;
+ break;
+ case PCI_CHIP_PLATO_PX:
+ *Chipset = CHIP_S3_PLATO_PX;
+ break;
+ case PCI_CHIP_ViRGE_GX2:
+ *Chipset = CHIP_S3_ViRGE_GX2;
+ break;
+ case PCI_CHIP_ViRGE_MX:
+ *Chipset = CHIP_S3_ViRGE_MX;
+ break;
+ case PCI_CHIP_ViRGE_MXP:
+ *Chipset = CHIP_S3_ViRGE_MXP;
+ break;
+ default:
+ Chip_data = rev;
+ Chip_data = (Chip_data << 16) | chip_id;
+ Chip_data = (Chip_data << 8) | chip_rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ }
+ break;
+ case 0xE1: {
+ int chip_id, chip_rev;
+ chip_id = rdinx(CRTC_IDX, 0x2d) << 8;
+ chip_id |= rdinx(CRTC_IDX, 0x2e);
+ chip_rev = rdinx(CRTC_IDX, 0x2f);
+ if (chip_id == PCI_CHIP_TRIO3D_B)
+ *Chipset = CHIP_S3_Trio3D_B;
+ else if (chip_id == PCI_CHIP_TRIO3D)
+ *Chipset = CHIP_S3_Trio3D;
+ else if (chip_id == PCI_CHIP_SAVAGE3D)
+ *Chipset = CHIP_S3_Savage3D;
+ else if (chip_id == PCI_CHIP_SAVAGE3D_M)
+ *Chipset = CHIP_S3_Savage3D_M;
+ else {
+ Chip_data = rev;
+ Chip_data = (Chip_data << 16) | chip_id;
+ Chip_data = (Chip_data << 8) | chip_rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ }
+ }
+ break;
+ }
+ default:
+ Chip_data = rev;
+ *Chipset = CHIP_S3_UNKNOWN;
+ break;
+ }
+ }
+ }
+ wrinx(CRTC_IDX, 0x39, cr39);
+ wrinx(CRTC_IDX, 0x38, cr38);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_S3(Chipset)
+int Chipset;
+{
+ Byte config, old, config2;
+ int Mem = 0, MemOffScreen = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(CRTC_IDX, 0x38);
+ wrinx(CRTC_IDX, 0x38, 0x00);
+ if (!testinx2(CRTC_IDX, 0x35, 0x0F))
+ {
+ wrinx(CRTC_IDX, 0x38, 0x48);
+ if (testinx2(CRTC_IDX, 0x35, 0x0F))
+ {
+ config = rdinx(CRTC_IDX, 0x36);
+ config2 = rdinx(CRTC_IDX, 0x37);
+ if ((Chipset == CHIP_S3_911) ||
+ (Chipset == CHIP_S3_924))
+ {
+ if ((config & 0x20) != 0)
+ Mem = 512;
+ else
+ Mem = 1024;
+ }
+ else if (Chipset == CHIP_S3_ViRGE)
+ {
+ switch((config & 0xE0) >> 5)
+ {
+ case 0:
+ Mem = 4 * 1024;
+ break;
+ case 4:
+ Mem = 2 * 1024;
+ break;
+ case 6:
+ Mem = 1 * 1024;
+ break;
+ }
+ }
+ else if (Chipset == CHIP_S3_ViRGE_GX2 ||
+ Chipset == CHIP_S3_ViRGE_MX ||
+ Chipset == CHIP_S3_ViRGE_MXP)
+ {
+ switch((config & 0xC0) >> 6)
+ {
+ case 1:
+ Mem = 4 * 1024;
+ break;
+ case 3:
+ Mem = 2 * 1024;
+ break;
+ }
+ }
+ else if (Chipset == CHIP_S3_Trio3D)
+ {
+ switch((config & 0xE0) >> 5)
+ {
+ case 0:
+ case 2:
+ Mem = 4 * 1024;
+ break;
+ case 4:
+ Mem = 2 * 1024;
+ break;
+ }
+ }
+ else if (Chipset == CHIP_S3_ViRGE_VX)
+ {
+ switch((config2 & 0x60) >> 5)
+ {
+ case 1:
+ MemOffScreen = 4 * 1024;
+ break;
+ case 2:
+ MemOffScreen = 2 * 1024;
+ break;
+ }
+ switch((config & 0x60) >> 5)
+ {
+ case 0:
+ Mem = 2 * 1024;
+ break;
+ case 1:
+ Mem = 4 * 1024;
+ break;
+ case 2:
+ Mem = 6 * 1024;
+ break;
+ case 3:
+ Mem = 8 * 1024;
+ break;
+ }
+ Mem -= MemOffScreen;
+ }
+ else
+ {
+ switch((config & 0xE0) >> 5)
+ {
+ case 0:
+ Mem = 4 * 1024;
+ break;
+ case 2:
+ Mem = 3 * 1024;
+ break;
+ case 3:
+ Mem = 8 * 1024;
+ break;
+ case 4:
+ Mem = 2 * 1024;
+ break;
+ case 5:
+ Mem = 6 * 1024;
+ break;
+ case 6:
+ Mem = 1 * 1024;
+ break;
+ }
+ }
+ }
+ }
+ wrinx(CRTC_IDX, 0x38, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return((MemOffScreen << 16) | Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c
new file mode 100644
index 000000000..7f68cb56f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c
@@ -0,0 +1,183 @@
+/*
+ * (c) Copyright 1996 Alan Hourihane <alanh@fairlite.demon.co.uk>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * ALAN HOURIHANE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Alan Hourihane shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Alan Hourihane.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SiS.c,v 3.5 1999/06/06 08:48:44 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_SiS __STDCARGS((int));
+
+Chip_Descriptor SiS_Descriptor = {
+ "SiS",
+ Probe_SiS,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_SiS,
+};
+
+Bool Probe_SiS(Chipset)
+int *Chipset;
+{
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_SIS)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_SG86C201:
+ *Chipset = CHIP_SIS86C201;
+ break;
+ case PCI_CHIP_SG86C202:
+ *Chipset = CHIP_SIS86C202;
+ break;
+ case PCI_CHIP_SG86C205:
+ *Chipset = CHIP_SIS86C205;
+ break;
+ case PCI_CHIP_SG86C215: /* 86C215 */
+ *Chipset = CHIP_SIS86C215;
+ break;
+ case PCI_CHIP_SIS5597: /* 5597/5598 */
+ *Chipset = CHIP_SIS5597;
+ break;
+ case PCI_CHIP_SIS6326: /* 6326 */
+ *Chipset = CHIP_SIS6326;
+ break;
+ case PCI_CHIP_SG86C225:
+ *Chipset = CHIP_SIS86C225;
+ break;
+ case PCI_CHIP_SIS530: /* 530/620 */
+ *Chipset = CHIP_SIS530;
+ break;
+ default:
+ *Chipset = CHIP_SIS_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ return(FALSE);
+}
+
+static int MemProbe_SiS(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+ unsigned char temp;
+ unsigned char bsiz;
+ unsigned char save;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /* unlock extended registers */
+ save = rdinx(SEQ_IDX,0x05);
+ wrinx(SEQ_IDX,0x05,0x86);
+
+ switch (Chipset)
+ {
+ case CHIP_SIS86C201:
+ case CHIP_SIS86C202:
+ case CHIP_SIS86C205:
+ case CHIP_SIS86C215:
+ case CHIP_SIS86C225:
+ switch (rdinx(SEQ_IDX, 0xF) & 0x03)
+ {
+ case 0x00:
+ Mem = 1024;
+ break;
+ case 0x01:
+ Mem = 2048;
+ break;
+ case 0x02:
+ Mem = 4096;
+ break;
+ }
+ break;
+ case CHIP_SIS5597:
+ bsiz = rdinx(SEQ_IDX,0x0C);
+ bsiz = (bsiz >> 1) & 3;
+
+ temp = rdinx(CRTC_IDX,0x2F);
+ temp &= 7;
+ temp++;
+ if (bsiz > 0) temp = temp << 1;
+
+ Mem = 256 * temp;
+ break;
+ case CHIP_SIS6326:
+ case CHIP_SIS530:
+ temp = rdinx(SEQ_IDX, 0xC);
+ temp >>= 1;
+ switch (temp & 0x0B)
+ {
+ case 0x00:
+ Mem = 1024;
+ break;
+ case 0x01:
+ Mem = 2048;
+ break;
+ case 0x02:
+ Mem = 4096;
+ break;
+ case 0x03:
+ if(Chipset == CHIP_SIS6326)
+ Mem = 1024;
+ else
+ Mem = 0;
+ break;
+ case 0x08:
+ Mem = 0;
+ break;
+ case 0x09:
+ Mem = 2048;
+ break;
+ case 0x0A:
+ Mem = 4096;
+ break;
+ case 0x0B:
+ Mem = 8192;
+ break;
+ }
+
+ }
+ /* lock registers again */
+ wrinx(SEQ_IDX,0x05,save);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+ }
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c
new file mode 100644
index 000000000..ddb08e8b6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c
@@ -0,0 +1,80 @@
+/*
+ * (c) Copyright 1997 Harald Koenig <koenig@XFree86.Org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARALD KOENIG BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Harald Koenig shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Harald Koenig.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SigmaDesigns.c,v 3.2 1999/03/14 03:21:45 dawes Exp $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, };
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_SigmaDesigns __STDCARGS((int));
+
+Chip_Descriptor SigmaDesigns_Descriptor = {
+ "SigmaDesigns",
+ Probe_SigmaDesigns,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_SigmaDesigns(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte chip, old, old1, val;
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_SIGMADESIGNS)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_SD_REALMAGIG64GX:
+ *Chipset = CHIP_SD_RM64GX;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_SD_RM_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ return(FALSE);
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s b/xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s
new file mode 100644
index 000000000..d10bf894f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s
@@ -0,0 +1,104 @@
+/
+/ File: SolX86IO.s
+/
+/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions
+/ for Solaris x86 using the ProWorks compiler by SunPro
+/
+/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com)
+/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com)
+/
+/ Synopsis: (c callable external declarations)
+/ extern unsigned char inb(int port);
+/ extern unsigned short inw(int port);
+/ extern unsigned long inl(int port);
+/ extern void outb(int port, unsigned char value);
+/ extern void outw(int port, unsigned short value);
+/ extern void outl(int port, unsigned long value);
+/
+/ $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SolX86IO.s,v 3.3 1996/12/23 06:31:37 dawes Exp $
+/
+/
+/
+/
+/ $XConsortium: SolX86IO.s /main/5 1996/02/21 17:12:33 kaleb $
+
+.file "SolX86IO.s"
+.text
+
+.globl inb
+.globl inw
+.globl inl
+.globl outb
+.globl outw
+.globl outl
+
+/
+/ unsigned char inb(int port);
+/
+.align 4
+inb:
+ movl 4(%esp),%edx
+ subl %eax,%eax
+ inb (%dx)
+ ret
+.type inb,@function
+.size inb,.-inb
+
+/
+/ unsigned short inw(int port);
+/
+.align 4
+inw:
+ movl 4(%esp),%edx
+ subl %eax,%eax
+ inw (%dx)
+ ret
+.type inw,@function
+.size inw,.-inw
+
+/
+/ unsigned long inl(int port);
+/
+.align 4
+inl:
+ movl 4(%esp),%edx
+ inl (%dx)
+ ret
+.type inl,@function
+.size inl,.-inl
+
+/
+/ void outb(int port, unsigned char value);
+/
+.align 4
+outb:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ outb (%dx)
+ ret
+.type outb,@function
+.size outb,.-outb
+
+/
+/ void outw(int port, unsigned short value);
+/
+.align 4
+outw:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ outw (%dx)
+ ret
+.type outw,@function
+.size outw,.-outw
+
+/
+/ void outl(int port, unsigned long value);
+/
+.align 4
+outl:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ outl (%dx)
+ ret
+.type outl,@function
+.size outl,.-outl
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man b/xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man
new file mode 100644
index 000000000..9cde8e000
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man
@@ -0,0 +1,207 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man,v 3.8 1999/08/01 07:57:06 dawes Exp $
+.TH SuperProbe 1 "XFree86 3.9.15/SuperProbe 2.20" "X Version 11"
+.SH NAME
+SuperProbe - probe for and identify installed video hardware.
+.SH SYNOPSIS
+.B SuperProbe
+[-verbose] [-no16] [-excl \fIlist\fP] [-mask10]
+.if n .br
+ [-order \fIlist\fP] [-noprobe \fIlist\fP] [-bios \fIbase\fP]
+.br
+ [-no_bios] [-no_dac] [-no_mem] [-info]
+.SH DESCRIPTION
+.PP
+.I SuperProbe
+is a a program that will attempt to determine the type of video hardware
+installed in an EISA/ISA/VLB-bus system by checking for known registers
+in various combinations at various locations (MicroChannel and PCI machines
+may not be fully supported; many work with the use of the
+.B -no_bios
+option). This is an error-prone process, especially on Unix (which
+usually has a lot more esoteric hardware installed than MS-DOS system do), so
+SuperProbe may likely need help from the user.
+.PP
+.I SuperProbe
+runs on SVR3, SVR4, Linux, 386BSD/FreeBSD/NetBSD, Minix-386, and Mach. It
+should be trivial to extend it to work on any other Unix-like operating
+system, and even non-Unix operating systems. All of the OS dependencies
+are isolated to a single file for each OS.
+.PP
+At this time,
+.I SuperProbe
+can identify MDA, Hercules, CGA, MCGA, EGA, VGA, and an entire horde of
+SVGA chipsets (see the
+.I -info
+option, below). It can also identify several HiColor/True-color RAMDACs
+in use on SVGA boards, and the amount of video memory installed (for many
+chipsets). It can identify 8514/A and some derivatives, but
+not XGA, or PGC (although the author intends to add those capabilities).
+Nor can it identify other esoteric video hardware (like Targa, TIGA, or
+Microfield boards).
+.SH OPTIONS
+.TP 8
+.B "-verbose"
+.I SuperProbe
+will be verbose and provide lots of information as it does its work.
+.TP 8
+.B "-no16"
+.I SuperProbe
+will not attempt to use any ports that require 16-bit I/O address decoding.
+The original ISA bus only specified that I/O ports be decoded to 10 bits.
+Therefore some old cards (including many 8-bit cards) will mis-decode
+references to ports that use the upper 6 bits, and may get into funny states
+because they think that they are being addressed when they are not.
+It is recommended that this option be used initially if any 8-bit cards
+are present in the system.
+.TP 8
+.BI "-excl" "\ list"
+.I SuperProbe
+will not attempt to access any I/O ports on the specified exclusion list.
+Some video cards use rather non-standard I/O ports that may conflict with
+other cards installed in your system. By specifying to
+.I SuperProbe
+a list of ports already in use, it will know that there cannot be any video
+cards that use those ports, and hence will not probe them (which could
+otherwise confuse your hardware). The exclusion list is specified as
+a comma-separated list of I/O ports or port ranges. A range is specified
+as "low-high", and is inclusive. The ports can be specified in decimal,
+in octal (numbers begin with '0'), or hexadecimal (numbers begin with '0x').
+.TP 8
+.B "-mask10"
+This option is used in combination with
+.I -excl.
+It tells
+.I SuperProbe
+that when comparing an I/O port under test against the exclusion list, the
+port address should be masked to 10 bits. This is important with older
+8-bit cards that only do 10 bit decoding, and for some cheap 16-bit cards
+as well. This option is simply a less-drastic form of the
+.I -no16
+option.
+.TP 8
+.BI "-order" "\ list"
+This option specifies which chipsets
+.I SuperProbe
+should test, and in which order. The
+.I list
+parameter is a comma-separated list of chipset names. This list overrides
+the built-in default testing order. To find the list of acceptable names,
+use the
+.I -info
+option described below. Note that items displayed as "Standard video
+hardware" are not usable with the
+.I -order
+option.
+.TP 8
+.BI "-noprobe" "\ list"
+This options specifies which chipsets
+.I SuperProbe
+should
+.B not
+test. The order of testing will either be the default order, or that
+specified with the
+.I -order
+option described above. The
+.I list
+parameter is a comma-separated list of chipset names. To find the list
+of acceptable names, use the
+.I -info
+option described below. Note that items displayed as "Standard video
+hardware" are not usable with the
+.I -noprobe
+option.
+.TP 8
+.BI "-bios" "\ base"
+This option specifies the base address for the graphics-hardware BIOS.
+By default,
+.I SuperProbe
+will attempt to locate the BIOS base on its own (the normal address is
+0xC0000). If it fails to correctly locate the BIOS (an error message will
+be printed if this occurs), the
+.I -bios
+option can be used to specify the base.
+.TP 8
+.B "-no_bios"
+Disallow reading of the video BIOS and assume that an EGA or later
+(VGA, SVGA) board is present as the primary video hardware.
+.TP 8
+.B "-no_dac"
+Skip probing for the RAMDAC type when an (S)VGA is identified.
+.TP 8
+.B "-no_mem"
+Skip probing for the amount of installed video memory.
+.TP 8
+.B "-info"
+.I SuperProbe
+will print out a listing of all the video hardware that it knows how to
+identify.
+.SH EXAMPLES
+.PP
+To run
+.I SuperProbe
+in its most basic and automated form, simply enter:
+.sp
+.ce
+.B SuperProbe
+.PP
+Note - you may want to redirect
+.I stdout
+to a file when you run
+.I SuperProbe
+(especially if your OS does not support Virtual Terminals on the console).
+.PP
+However, if you have any 8-bit cards installed, you should initially run
+.I SuperProbe
+as:
+.sp
+.ce
+.B SuperProbe -verbose -no16
+.PP
+(the
+.I -verbose
+option is included so you can see what
+.I SuperProbe
+is skipping).
+.PP
+Finer granularity can be obtained with an exclusion list, for example:
+.sp
+.ce
+.B SuperProbe -verbose -excl 0x200,0x220-0x230,0x250
+.PP
+which will not test for any device that use port 0x200, ports 0x220 through
+0x230, inclusive, or port 0x250. If you have any 8-bit cards installed,
+you should add
+.I -mask10
+to the list of options.
+.PP
+To restrict the search to Western Digital, Tseng, and Cirrus chipset,
+run
+.I SuperProbe
+as follows:
+.sp
+.ce
+.B SuperProbe -order WD,Tseng,Cirrus
+.SH BUGS
+.PP
+Probably a lot at this point. Please report any bugs or incorrect
+identifications to the author.
+.PP
+\fBIt is possible that SuperProbe can lock up your machine. Be sure to
+narrow the search by using the \fI-no16\fB, \fI-excl\fB, and \fI-mask10\fB
+options provided to keep SuperProbe from conflicting with other installed
+hardware.\fR
+.SH SEE ALSO
+.PP
+The
+.I vgadoc3.zip
+documentation package by Finn Thoegersen, available in the MS-DOS archives
+of many FTP repositories.
+.PP
+\fIProgrammer's Guide to the EGA and VGA Cards, 2nd Ed\fP, by Richard
+Ferraro.
+.SH AUTHOR
+David E. Wexelblat <dwex@xfree86.org>
+.br
+with help from David Dawes <dawes@xfree86.org> and the XFree86
+development team.
+.\" $TOG: SuperProbe.man /main/7 1997/07/19 09:20:52 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c
new file mode 100644
index 000000000..1defe2838
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c
@@ -0,0 +1,345 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Trident.c,v 3.15 1999/06/06 08:48:44 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Trident.c /main/7 1996/10/24 07:10:11 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Trident __STDCARGS((int));
+
+Chip_Descriptor Trident_Descriptor = {
+ "Trident",
+ Probe_Trident,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Trident,
+};
+
+Bool Probe_Trident(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte chip, old, old1, val;
+ unsigned char temp;
+ int i = 0;
+
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_TRIDENT)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_9320:
+ *Chipset = CHIP_TVGA9320;
+ break;
+ case PCI_CHIP_9420:
+ *Chipset = CHIP_TVGA9420;
+ break;
+ case PCI_CHIP_9440:
+ *Chipset = CHIP_TVGA9440;
+ break;
+ case PCI_CHIP_9660:
+ outp(0x3C4, 0x09);
+ temp = inp(0x3C5);
+ switch (temp) {
+ case 0x00:
+ *Chipset = CHIP_TVGA9660;
+ break;
+ case 0x01:
+ *Chipset = CHIP_TVGA9680;
+ break;
+ case 0x10:
+ *Chipset = CHIP_TVGA9682;
+ break;
+ case 0x21:
+ *Chipset = CHIP_TVGA9685;
+ break;
+ case 0x22:
+ case 0x23:
+ *Chipset = CHIP_TVGA9397;
+ break;
+/* Bill Mair */
+ case 0xF3:
+ *Chipset = CHIP_TVGA939A;
+ break;
+
+ case 0x30:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0xB3:
+ *Chipset = CHIP_TVGA9385;
+ break;
+ case 0x38:
+ case 0x3A:
+ *Chipset = CHIP_TVGA9385_1;
+ break;
+ case 0x4A:
+ *Chipset = CHIP_TVGA9388_1;
+ break;
+ case 0x40:
+ case 0x41: /* Guessing */
+ case 0x42: /* Guessing */
+ case 0x43:
+ *Chipset = CHIP_TVGA9382;
+ break;
+ case 0x50:
+ *Chipset = CHIP_TVGA9692;
+ break;
+ default:
+ Chip_data = temp;
+ *Chipset = CHIP_TVGA_UNK;
+ break;
+ }
+ break;
+ case PCI_CHIP_9680:
+ *Chipset = CHIP_TVGA9680;
+ break;
+ case PCI_CHIP_9682:
+ *Chipset = CHIP_TVGA9682;
+ break;
+ case PCI_CHIP_9388:
+ *Chipset = CHIP_TVGA9388;
+ break;
+ case PCI_CHIP_9397:
+ *Chipset = CHIP_TVGA9397;
+ break;
+/*Bill Mair*/
+ case PCI_CHIP_939A:
+ *Chipset = CHIP_TVGA939A;
+ break;
+
+ case PCI_CHIP_9520:
+ *Chipset = CHIP_TVGA9520;
+ break;
+ case PCI_CHIP_9750:
+ *Chipset = CHIP_TVGA9750;
+ break;
+ case PCI_CHIP_9850:
+ *Chipset = CHIP_TVGA9850;
+ break;
+ default:
+ Chip_data = pcrp->_device_vendor;
+ *Chipset = CHIP_TVGA_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(SEQ_IDX, 0x0B);
+ wrinx(SEQ_IDX, 0x0B, 0x00);
+ chip = inp(SEQ_REG);
+ old1 = rdinx(SEQ_IDX, 0x0E);
+ outp(SEQ_REG, 0);
+ val = inp(SEQ_REG);
+ outp(SEQ_REG, (old1 ^ 0x02));
+ wrinx(SEQ_IDX, 0x0B, old);
+ wrinx(SEQ_IDX, 0x0E, old1);
+ if ((val & 0x0F) == 2)
+ {
+ result = TRUE;
+ switch (chip)
+ {
+ case 0x01: /* Can't happen - no "new mode" */
+ *Chipset = CHIP_TVGA8800BR;
+ break;
+ case 0x02:
+ *Chipset = CHIP_TVGA8800CS;
+ break;
+ case 0x03:
+ *Chipset = CHIP_TVGA8900B;
+ break;
+ case 0x04:
+ case 0x13:
+ *Chipset = CHIP_TVGA8900C;
+ break;
+ case 0x23:
+ *Chipset = CHIP_TVGA9000;
+ break;
+ case 0x33:
+ *Chipset = CHIP_TVGA8900CL;
+ break;
+ case 0x43:
+ *Chipset = CHIP_TVGA9000I;
+ break;
+ case 0x53:
+ *Chipset = CHIP_TVGA9200CX;
+ break;
+ case 0x63:
+ *Chipset = CHIP_TVGA9100B;
+ break;
+ case 0x73:
+ case 0xF3:
+ *Chipset = CHIP_TVGA9420;
+ break;
+ case 0x83:
+ *Chipset = CHIP_TVGA8200;
+ break;
+ case 0x93:
+ *Chipset = CHIP_TVGA9400CX;
+ break;
+ case 0xA3:
+ *Chipset = CHIP_TVGA9320;
+ break;
+ case 0xC3:
+ *Chipset = CHIP_TVGA9420D;
+ break;
+ case 0xD3:
+ outp(0x3C4, 0x09);
+ temp = inp(0x3C5);
+ switch (temp) {
+ case 0x00:
+ *Chipset = CHIP_TVGA9660;
+ break;
+ case 0x01:
+ *Chipset = CHIP_TVGA9680;
+ break;
+ case 0x10:
+ *Chipset = CHIP_TVGA9682;
+ break;
+ case 0x21:
+ *Chipset = CHIP_TVGA9685;
+ break;
+ case 0x22:
+ case 0x23:
+ *Chipset = CHIP_TVGA9397;
+ break;
+/*Bill Mair*/
+ case 0xF3:
+ *Chipset = CHIP_TVGA939A;
+ break;
+
+ case 0x30:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0xB3:
+ *Chipset = CHIP_TVGA9385;
+ break;
+ case 0x38:
+ case 0x3A:
+ *Chipset = CHIP_TVGA9385_1;
+ break;
+ case 0x4A:
+ *Chipset = CHIP_TVGA9388_1;
+ break;
+ case 0x40:
+ case 0x41: /* Guessing */
+ case 0x42: /* Guessing */
+ case 0x43:
+ *Chipset = CHIP_TVGA9382;
+ break;
+ case 0x50:
+ *Chipset = CHIP_TVGA9692;
+ break;
+ default:
+ Chip_data = chip*256+temp;
+ *Chipset = CHIP_TVGA_UNK;
+ break;
+ }
+ break;
+ case 0xE3:
+ *Chipset = CHIP_TVGA9440;
+ break;
+ default:
+ Chip_data = chip;
+ *Chipset = CHIP_TVGA_UNK;
+ break;
+ }
+ }
+ else if ((chip == 1) && (testinx2(SEQ_IDX, 0x0E, 0x06)))
+ {
+ result = TRUE;
+ *Chipset = CHIP_TVGA8800BR;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_Trident(Chipset)
+int Chipset;
+{
+ int Mem = 0;
+ unsigned char temp;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ temp = rdinx(CRTC_IDX, 0x1F);
+
+ switch (temp & 0x07)
+ {
+ case 0:
+ case 4:
+/* Bill Mair */
+ if (Chipset == CHIP_TVGA939A )
+ Mem = 8192;
+ else
+ Mem = 256;
+ break;
+ case 1:
+ case 5: /* New TGUI's don't support less than 1MB */
+ if (Chipset >= CHIP_TVGA9660)
+ Mem = 4096;
+ else
+ Mem = 512;
+ break;
+ case 2:
+ case 6:
+ Mem = 768;
+ break;
+ case 3:
+ Mem = 1024;
+ break;
+ case 7:
+
+ if (((temp & 0x0F)==0x0F) && (Chipset >= CHIP_TVGA9685))
+ /* This is for the 9685 */
+ Mem = 4096;
+ else
+ Mem = 2048;
+ break;
+ }
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c
new file mode 100644
index 000000000..1e40f7794
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c
@@ -0,0 +1,388 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Tseng.c,v 3.9 1997/07/06 05:30:48 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Tseng.c /main/7 1996/10/19 17:48:18 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, 0x000, 0x000, 0x000,
+ 0x3BF, 0x3CB, 0x3CD,
+ ATR_IDX, ATR_REG_R, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_Tseng __STDCARGS((int));
+static Long ET6Kbase = 0;
+
+Chip_Descriptor Tseng_Descriptor = {
+ "Tseng",
+ Probe_Tseng,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_Tseng,
+};
+
+Bool Probe_Tseng(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, old1, ver;
+ int i=0;
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ Ports[2] = inp(MISC_OUT_R) & 0x01 ? 0x3D8 : 0x3B8;
+
+ /* check PCI config first */
+ if (!NoPCI)
+ {
+ while ((pcrp = pci_devp[i]) != (struct pci_config_reg *)NULL) {
+ if (pcrp->_vendor == PCI_VENDOR_TSENG)
+ {
+ switch (pcrp->_device)
+ {
+ case PCI_CHIP_ET6000:
+ if (pcrp->_rev_id >= 0x70)
+ *Chipset = CHIP_ET6K1;
+ else
+ *Chipset = CHIP_ET6K;
+ ET6Kbase = pcrp->_base1 & ~0xFF;
+ break;
+ case PCI_CHIP_ET6300:
+ *Chipset = CHIP_ET6K3;
+ ET6Kbase = pcrp->_base1 & ~0xFF;
+ break;
+ case PCI_CHIP_ET4000_W32P_A:
+ *Chipset = CHIP_ET4KW32P_A;
+ break;
+ case PCI_CHIP_ET4000_W32P_B:
+ *Chipset = CHIP_ET4KW32P_B;
+ break;
+ case PCI_CHIP_ET4000_W32P_C:
+ *Chipset = CHIP_ET4KW32P_C;
+ break;
+ case PCI_CHIP_ET4000_W32P_D:
+ *Chipset = CHIP_ET4KW32P_D;
+ break;
+ default:
+ Chip_data = pcrp->_device;
+ *Chipset = CHIP_TSENG_UNK;
+ break;
+ }
+ PCIProbed = TRUE;
+ return(TRUE);
+ }
+ i++;
+ }
+ }
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = inp(0x3BF);
+ old1 = inp(Ports[2]);
+ outp(0x3BF, 0x03);
+ outp(Ports[2], 0xA0);
+ if (tstrg(0x3CD, 0x3F))
+ {
+ result = TRUE;
+ if (testinx2(CRTC_IDX, 0x33, 0x0F))
+ {
+ if (tstrg(0x3CB, 0x33))
+ {
+ ver = rdinx(0x217A, 0xEC);
+ switch (ver >> 4)
+ {
+ case 0x00:
+ *Chipset = CHIP_ET4000W32;
+ break;
+ case 0x01:
+ *Chipset = CHIP_ET4000W32I;
+ break;
+ case 0x02:
+ *Chipset = CHIP_ET4KW32P_A;
+ break;
+ case 0x03:
+ *Chipset = CHIP_ET4KW32I_B;
+ break;
+ case 0x05:
+ *Chipset = CHIP_ET4KW32P_B;
+ break;
+ case 0x06:
+ *Chipset = CHIP_ET4KW32P_D;
+ break;
+ case 0x07:
+ *Chipset = CHIP_ET4KW32P_C;
+ break;
+ case 0x0B:
+ *Chipset = CHIP_ET4KW32I_C;
+ break;
+ default:
+ Chip_data = ver >> 4;
+ *Chipset = CHIP_TSENG_UNK;
+ break;
+ }
+ }
+ else
+ {
+ *Chipset = CHIP_ET4000;
+ }
+ }
+ else
+ {
+ *Chipset = CHIP_ET3000;
+ }
+ }
+ outp(Ports[2], old1);
+ outp(0x3BF, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+
+/*
+ * The 8*32kb ET6000 MDRAM granularity causes the more general probe to
+ * detect too much memory in some configurations, because that code has a
+ * 8-bank (=256k) granularity. E.g. it fails to recognize 2.25 MB of memory
+ * (detects 2.5 instead). This function goes to check if the RAM is actually
+ * there. MDRAM comes in multiples of 4 banks (16, 24, 32, 36, 40, 64, 72,
+ * 80, ...), so checking each 64k block should be enough granularity.
+ *
+ * The exact same code could be used on other Tseng chips, or even on ANY
+ * VGA board, but probably only in case of trouble.
+ *
+ */
+#define VIDMEM ((volatile unsigned int*)check_vgabase)
+#define SEGSIZE 64 /* 64 kb */
+
+/* vgaSetVidPage() doesn't seem to work -- dunno why */
+static void Tseng_set_segment(int seg)
+{
+ int seg1, seg2;
+ seg1 = seg & 0x0F;
+ seg2 = (seg & 0x30) >> 4;
+ outp(0x3CB, seg2 | (seg2 << 4));
+ outp(0x3CD, seg1 | (seg1 << 4));
+}
+
+static int et6000_check_videoram(int ram)
+{
+ unsigned char oldSegSel1, oldSegSel2, oldGR5, oldGR6, oldSEQ2, oldSEQ4;
+ int segment, i;
+ int real_ram;
+ Byte * check_vgabase;
+ Bool fooled = FALSE;
+ int save_vidmem;
+
+ if (ram > 4096) {
+ printf("ET6000: Detected more than 4MB of video RAM.\n");
+ printf(" Although some cards are sold with more than 4MB,\n");
+ printf(" the ET6000 can only use 4MB maximum.\n");
+ ram = 4096;
+ }
+
+ check_vgabase = MapVGA();
+
+ /*
+ * We need to set the VGA controller in VGA graphics mode, or else we won't
+ * be able to access the full 4MB memory range. First, we save the
+ * registers we modify, of course.
+ */
+ oldSegSel1 = inp(0x3CD);
+ oldSegSel2 = inp(0x3CB);
+ oldGR5 = rdinx(GRC_IDX, 5);
+ oldGR6 = rdinx(GRC_IDX, 6);
+ oldSEQ2 = rdinx(SEQ_IDX, 2);
+ oldSEQ4 = rdinx(SEQ_IDX, 4);
+
+ /* set graphics mode */
+ wrinx(GRC_IDX, 5, 5);
+ wrinx(GRC_IDX, 6, 0x40);
+ wrinx(SEQ_IDX, 2, 0x0f);
+ wrinx(SEQ_IDX, 4, 0x0e);
+
+ /*
+ * count down from presumed amount of memory in SEGSIZE steps, and
+ * look at each segment for real RAM.
+ */
+
+ for (segment = (ram / SEGSIZE) - 1; segment >= 0; segment--)
+ {
+ Tseng_set_segment(segment);
+
+ /* save contents of memory probing location */
+ save_vidmem = *(VIDMEM);
+
+ /* test with pattern */
+ *VIDMEM = 0xAAAA5555;
+ if (*VIDMEM != 0xAAAA5555) {
+ *VIDMEM = save_vidmem;
+ continue;
+ }
+
+ /* test with inverted pattern */
+ *VIDMEM = 0x5555AAAA;
+ if (*VIDMEM != 0x5555AAAA) {
+ *VIDMEM = save_vidmem;
+ continue;
+ }
+
+ /* check if we aren't fooled by address wrapping (mirroring) */
+ fooled = FALSE;
+ for (i = segment-1; i >=0; i--) {
+ Tseng_set_segment(i);
+ if (*VIDMEM == 0x5555AAAA) {
+ fooled = TRUE;
+ break;
+ }
+ }
+ if (!fooled) {
+ real_ram = (segment+1) * SEGSIZE;
+ break;
+ }
+ /* restore old contents again */
+ *VIDMEM = save_vidmem;
+ }
+
+ /* restore original register contents */
+ outp(0x3CD, oldSegSel1);
+ outp(0x3CB, oldSegSel2);
+ wrinx(GRC_IDX, 5, oldGR5);
+ wrinx(GRC_IDX, 6, oldGR6);
+ wrinx(SEQ_IDX, 2, oldSEQ2);
+ wrinx(SEQ_IDX, 4, oldSEQ4);
+
+ UnMapVGA(check_vgabase);
+
+ return real_ram;
+}
+
+static int MemProbe_Tseng(Chipset)
+int Chipset;
+{
+ Byte Save[2];
+ int Mem = 0;
+
+ if (PCIProbed)
+ {
+ Ports[3] = ET6Kbase + 0x45;
+ Ports[4] = ET6Kbase + 0x47;
+ }
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ Save[0] = inp(0x3BF);
+ Save[1] = inp(vgaIOBase + 8);
+ outp(0x3BF, 0x03);
+ outp(vgaIOBase + 8, 0xA0);
+
+ /*
+ * Check
+ */
+ switch (Chipset)
+ {
+ case CHIP_ET3000:
+ Mem = 512;
+ break;
+ case CHIP_ET4000:
+ switch (rdinx(CRTC_IDX, 0x37) & 0x0B)
+ {
+ case 0x03:
+ case 0x05:
+ Mem = 256;
+ break;
+ case 0x0A:
+ Mem = 512;
+ break;
+ case 0x0B:
+ Mem = 1024;
+ break;
+ }
+ break;
+ case CHIP_ET4000W32:
+ case CHIP_ET4000W32I:
+ case CHIP_ET4KW32P_A:
+ case CHIP_ET4KW32I_B:
+ case CHIP_ET4KW32I_C:
+ case CHIP_ET4KW32P_B:
+ case CHIP_ET4KW32P_C:
+ case CHIP_ET4KW32P_D:
+ switch (rdinx(CRTC_IDX, 0x37) & 0x09)
+ {
+ case 0x00:
+ Mem = 2048;
+ break;
+ case 0x01:
+ Mem = 4096;
+ break;
+ case 0x08:
+ Mem = 512;
+ break;
+ case 0x09:
+ Mem = 1024;
+ if ((Chipset != CHIP_ET4000W32) &&
+ (rdinx(CRTC_IDX, 0x32) & 0x80))
+ Mem = 2048;
+ break;
+ }
+ break;
+ case CHIP_ET6K:
+ case CHIP_ET6K1:
+ case CHIP_ET6K3:
+ switch (rdinx(CRTC_IDX, 0x34) & 0x80)
+ {
+ case 0x00: /* MDRAM */
+ Mem = ((inp(ET6Kbase+0x47) & 0x07) + 1) * 8*32; /* number of 8 32kb banks */
+ if (inp(ET6Kbase+0x45) & 0x04)
+ {
+ Mem <<= 1;
+ }
+ /* 8*32kb MDRAM refresh control granularity in the ET6000 fails to */
+ /* recognize 2.25 MB of memory (detects 2.5 instead) */
+ Mem = et6000_check_videoram(Mem);
+ break;
+ case 0x80: /* DRAM */
+ Mem = 1024 << (inp(ET6Kbase+0x45) & 0x03);
+ break;
+ }
+ }
+
+ /*
+ * Lock
+ */
+ outp(vgaIOBase + 8, Save[1]);
+ outp(0x3BF, Save[0]);
+ DisableIOPorts(NUMPORTS, Ports);
+
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c
new file mode 100644
index 000000000..cc261e4b8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c
@@ -0,0 +1,113 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/UMC.c,v 3.4 1996/12/23 06:31:41 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: UMC.c /main/5 1996/02/21 17:12:56 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3BF, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_UMC __STDCARGS((int));
+
+Chip_Descriptor UMC_Descriptor = {
+ "UMC",
+ Probe_UMC,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_UMC,
+};
+
+Bool Probe_UMC(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = inp(0x3BF);
+ outp(0x3BF, 0x03);
+ if (!testinx(SEQ_IDX, 0x06))
+ {
+ outp(0x3BF, 0xAC);
+ if (testinx(SEQ_IDX, 0x06))
+ {
+ result = TRUE;
+ *Chipset = CHIP_UMC_408;
+ }
+ }
+ outp(0x3BF, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_UMC(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = inp(0x3BF);
+ outp(0x3BF, 0xAC);
+
+ /*
+ * Check
+ */
+ switch(rdinx(SEQ_IDX, 0x07) >> 6)
+ {
+ case 0x00:
+ Mem = 256;
+ break;
+ case 0x01:
+ Mem = 512;
+ break;
+ case 0x02:
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+
+ /*
+ * Lock
+ */
+ outp(0x3BF, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c
new file mode 100644
index 000000000..c89759bee
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c
@@ -0,0 +1,554 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Utils.c,v 3.5 1996/12/23 06:31:42 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Utils.c /main/7 1996/02/21 17:13:00 kaleb $ */
+
+#include "Probe.h"
+#include "AsmMacros.h"
+
+/*
+ * Return the byte value of register 'port'
+ */
+#ifdef __STDC__
+Byte inp(Word port)
+#else
+Byte inp(port)
+Word port;
+#endif
+{
+ return(inb(port));
+}
+
+/*
+ * Return the word value of register 'port'
+ */
+#ifdef __STDC__
+Word inpw(Word port)
+#else
+Word inpw(port)
+Word port;
+#endif
+{
+ return(inw(port));
+}
+
+/*
+ * Return the long value of register 'port'
+ */
+#ifdef __STDC__
+Long inpl(Word port)
+#else
+Long inpl(port)
+Word port;
+#endif
+{
+ return(inl(port));
+}
+
+/*
+ * Set the byte register 'port' to 'val'
+ */
+#ifdef __STDC__
+void outp(Word port, Byte val)
+#else
+void outp(port, val)
+Word port;
+Byte val;
+#endif
+{
+ outb(port, val);
+}
+
+/*
+ * Set the word register 'port' to 'val'
+ */
+#ifdef __STDC__
+void outpw(Word port, Word val)
+#else
+void outpw(port, val)
+Word port, val;
+#endif
+{
+ outw(port, val);
+}
+
+/*
+ * Set the long register 'port' to 'val'
+ */
+#ifdef __STDC__
+void outpl(Word port, Long val)
+#else
+void outpl(port, val)
+Word port;
+Long val;
+#endif
+{
+ outl(port, val);
+}
+
+/*
+ * Read byte register at 'port', index 'index'
+ */
+#ifdef __STDC__
+Byte rdinx(Word port, Byte index)
+#else
+Byte rdinx(port, index)
+Word port;
+Byte index;
+#endif
+{
+ Byte tmp;
+ Word Port[2] = {MISC_OUT_R, 0x000};
+
+ if (port == ATR_IDX)
+ {
+ EnableIOPorts(1, Port);
+ Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA;
+ EnableIOPorts(2, Port);
+ tmp = inp(Port[1]); /* Reset Attribute Reg flip-flop */
+ DisableIOPorts(2, Port);
+ }
+ outb(port, index);
+ return(inb(port+1));
+}
+
+/*
+ * Set the byte register 'port', index 'index' to 'val'
+ */
+#ifdef __STDC__
+void wrinx(Word port, Byte index, Byte val)
+#else
+void wrinx(port, index, val)
+Word port;
+Byte index;
+Byte val;
+#endif
+{
+ Byte tmp;
+ Word Port[2] = {MISC_OUT_R, 0x000};
+
+ if (port == ATR_REG_W)
+ {
+ EnableIOPorts(1, Port);
+ Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA;
+ EnableIOPorts(2, Port);
+ tmp = inp(Port[1]);
+ DisableIOPorts(2, Port);
+ outp(port, index);
+ outp(port, val);
+ }
+ else
+ {
+ outb(port, index);
+ outb(port+1, val);
+ }
+}
+
+/*
+ * Set the word register 'port', index 'index' to 'val'
+ */
+#ifdef __STDC__
+void wrinx2(Word port, Byte index, Word val)
+#else
+void wrinx2(port, index, val)
+Word port;
+Byte index;
+Word val;
+#endif
+{
+ wrinx(port, index, (val) & 0xFF);
+ wrinx(port, index+1, (val >> 8) & 0xFF);
+}
+
+/*
+ * Set the longword register 'port', index 'index' to 'val' (3 bytes, actually)
+ */
+#ifdef __STDC__
+void wrinx3(Word port, Byte index, Long val)
+#else
+void wrinx3(port, index, val)
+Word port;
+Byte index;
+Long val;
+#endif
+{
+ wrinx(port, index, (val) & 0xFF);
+ wrinx(port, index+1, (val >> 8) & 0xFF);
+ wrinx(port, index+2, (val >> 16) & 0xFF);
+}
+
+/*
+ * Set the word register 'port', index 'index' to 'val' (Motorola (big-endian)
+ * byte order)
+ */
+#ifdef __STDC__
+void wrinx2m(Word port, Byte index, Word val)
+#else
+void wrinx2m(port, index, val)
+Word port;
+Byte index;
+Word val;
+#endif
+{
+ wrinx(port, index, (val >> 8) & 0xFF);
+ wrinx(port, index+1, (val) & 0xFF);
+}
+
+/*
+ * Set the longword register 'port', index 'index' to 'val' (3 bytes, actually)
+ * (Motorola (big-endian) byte order)
+ */
+#ifdef __STDC__
+void wrinx3m(Word port, Byte index, Long val)
+#else
+void wrinx3m(port, index, val)
+Word port;
+Byte index;
+Long val;
+#endif
+{
+ wrinx(port, index, (val >> 16) & 0xFF);
+ wrinx(port, index+1, (val >> 8) & 0xFF);
+ wrinx(port, index+2, (val) & 0xFF);
+}
+
+/*
+ * In byte register 'port', index 'index', set the bit that are 1 in 'mask'
+ * to the value of the corresponding bits in 'mask'
+ */
+#ifdef __STDC__
+void modinx(Word port, Byte index, Byte mask, Byte newval)
+#else
+void modinx(port, index, mask, newval)
+Word port;
+Byte index;
+Byte mask;
+Byte newval;
+#endif
+{
+ Byte tmp;
+
+ tmp = (rdinx(port, index) & ~mask) | (newval & mask);
+ wrinx(port, index, tmp);
+}
+
+/*
+ * In register 'port' sets the bits in 'mask' as in 'nvw'. Other bits are
+ * left unchanged.
+ */
+#ifdef __STDC__
+void modreg(Word port, Byte mask, Byte nvw)
+#else
+void modreg(port, mask, nvw)
+Word port;
+Byte mask;
+Byte nvw;
+#endif
+{
+ Byte tmp;
+
+ tmp = (inp(port) & (~mask)) | (nvw & mask);
+ outp(port, tmp);
+}
+
+/*
+ * Sets the bits in register 'port', index 'index' that are also set in 'val'
+ */
+#ifdef __STDC__
+void setinx(Word port, Byte index, Byte val)
+#else
+void setinx(port, index, val)
+Word port;
+Byte index;
+Byte val;
+#endif
+{
+ Byte tmp;
+
+ tmp = rdinx(port, index);
+ wrinx(port, index, tmp | val);
+}
+
+/*
+ * Clears the bits in register 'port', index 'index' that are set in 'val'
+ */
+#ifdef __STDC__
+void clrinx(Word port, Byte index, Byte val)
+#else
+void clrinx(port, index, val)
+Word port;
+Byte index;
+Byte val;
+#endif
+{
+ Byte tmp;
+
+ tmp = rdinx(port, index);
+ wrinx(port, index, tmp & ~val);
+}
+/*
+ * Return TRUE iff the bits in 'mask' of register 'port' are read/write.
+ */
+#ifdef __STDC__
+Bool tstrg(Word port, Byte mask)
+#else
+Bool tstrg(port, mask)
+Word port;
+Byte mask;
+#endif
+{
+ Byte old, new1, new2;
+
+ old = inp(port);
+ outp(port, (old & ~mask));
+ new1 = inp(port) & mask;
+ outp(port, (old | mask));
+ new2 = inp(port) & mask;
+ outp(port, old);
+ return((new1==0) && (new2==mask));
+}
+
+/*
+ * Returns true iff the bits in 'mask' of register 'port', index 'index'
+ * are read/write.
+ */
+#ifdef __STDC__
+Bool testinx2(Word port, Byte index, Byte mask)
+#else
+Bool testinx2(port, index, mask)
+Word port;
+Byte index;
+Byte mask;
+#endif
+{
+ Byte old, new1, new2;
+
+ old = rdinx(port, index);
+ wrinx(port, index, (old & ~mask));
+ new1 = rdinx(port, index) & mask;
+ wrinx(port, index, (old | mask));
+ new2 = rdinx(port, index) & mask;
+ wrinx(port, index, old);
+ return((new1==0) && (new2==mask));
+}
+
+/*
+ * Returns true iff all bits of register 'port', index 'index' are read/write
+ */
+#ifdef __STDC__
+Bool testinx(Word port, Byte index)
+#else
+Bool testinx(port, index)
+Word port;
+Byte index;
+#endif
+{
+ return(testinx2(port, index, 0xFF));
+}
+
+/*
+ * Force DAC back to PEL mode
+ */
+void dactopel()
+{
+ (void)inp(0x3C8);
+}
+
+/*
+ * Trigger HiColor DACs to change mode.
+ */
+Byte trigdac()
+{
+ (void)inp(0x3C6);
+ (void)inp(0x3C6);
+ (void)inp(0x3C6);
+ return(inp(0x3C6));
+}
+
+/*
+ * Enter command mode of HiColor DACs.
+ */
+Byte dactocomm()
+{
+ dactopel();
+ return(trigdac());
+}
+
+/*
+ * Get the HiColor DAC command register and return to PEL mode.
+ */
+Byte getdaccomm()
+{
+ Byte ret;
+
+ dactocomm();
+ ret = inp(0x3C6);
+ dactopel();
+
+ return(ret);
+}
+
+/*
+ * Wait for vertical retrace interval.
+ */
+void waitforretrace()
+{
+ Word Port[2] = {MISC_OUT_R, 0x000};
+
+ EnableIOPorts(1, Port);
+
+ Port[1] = (inp(MISC_OUT_R) & 0x01) ? 0x3DA : 0x3BA;
+ EnableIOPorts(2, Port);
+ while ((inp(Port[1]) & 0x08) != 0)
+ {
+ /* Idle */
+ }
+ while ((inp(Port[1]) & 0x08) == 0)
+ {
+ /* Idle */
+ }
+
+ DisableIOPorts(2, Port);
+ return;
+}
+
+/*
+ * Check chip descriptor against exclusion list
+ */
+Bool Excluded(ExList, Chip, Mask10)
+Range *ExList;
+Chip_Descriptor *Chip;
+Bool Mask10;
+{
+ int i, j;
+ Word mask = (Mask10 ? 0x3FF : 0xFFFF);
+
+ if (Chip->num_ports == 0)
+ {
+ return(FALSE);
+ }
+ if (Chip->ports[0] == 0)
+ {
+ /* Fill in CRTC */
+ Chip->ports[0] = CRTC_IDX;
+ Chip->ports[1] = CRTC_REG;
+ }
+ for (i=0; i < Chip->num_ports; i++)
+ {
+ for (j=0; ExList[j].lo != (Word)-1; j++)
+ {
+ if (ExList[j].hi == (Word)-1)
+ {
+ /* single port */
+ if ((Chip->ports[i] & mask) == ExList[j].lo)
+ {
+ return(TRUE);
+ }
+ }
+ else
+ {
+ /* range */
+ if (((Chip->ports[i]&mask) >= ExList[j].lo) &&
+ ((Chip->ports[i]&mask) <= ExList[j].hi))
+ {
+ return(TRUE);
+ }
+ }
+ }
+ }
+ return(FALSE);
+}
+
+int StrCaseCmp(s1, s2)
+char *s1;
+char *s2;
+{
+ char c1, c2;
+
+ if (*s1 == 0)
+ if (*s2 == 0)
+ return(0);
+ else
+ return(1);
+
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ while (c1 == c2)
+ {
+ if (c1 == '\0')
+ return(0);
+ s1++;
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ }
+ return(c1 - c2);
+}
+
+unsigned int StrToUL(str)
+CONST char *str;
+{
+ int base = 10;
+ CONST char *p = str;
+ unsigned int tot = 0;
+
+ if (*p == '0')
+ {
+ p++;
+ if (*p == 'x')
+ {
+ p++;
+ base = 16;
+ }
+ else
+ {
+ base = 8;
+ }
+ }
+ while (*p)
+ {
+ if ((*p >= '0') && (*p <= ((base == 8)?'7':'9')))
+ {
+ tot = tot * base + (*p - '0');
+ }
+ else if ((base == 16) && (*p >= 'a') && (*p <= 'f'))
+ {
+ tot = tot * base + 10 + (*p - 'a');
+ }
+ else if ((base == 16) && (*p >= 'A') && (*p <= 'F'))
+ {
+ tot = tot * base + 10 + (*p - 'A');
+ }
+ else
+ {
+ return(tot);
+ }
+ p++;
+ }
+ return(tot);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c
new file mode 100644
index 000000000..48033dad6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c
@@ -0,0 +1,78 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/VGA.c,v 3.4 1996/12/23 06:31:43 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: VGA.c /main/5 1996/02/21 17:13:06 kaleb $ */
+
+#include "Probe.h"
+
+/*
+ * Determine if this is a VGA or an EGA. VGA has one more attribute
+ * register than EGA, so see if we can read/write it.
+ */
+static Word Ports[] = {0x3C0, 0x3C1};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_VGA __STDCARGS((int));
+
+Chip_Descriptor VGA_Descriptor = {
+ "VGA",
+ Probe_VGA,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_VGA,
+};
+
+Bool Probe_VGA(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte origVal, newVal;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ origVal = rdinx(0x3C0, 0x14 | 0x20);
+ outp(0x3C0, origVal ^ 0x0F);
+ newVal = rdinx(0x3C0, 0x14 | 0x20);
+ outp(0x3C0, origVal);
+ DisableIOPorts(NUMPORTS, Ports);
+ if (newVal == (origVal ^ 0x0F))
+ {
+ result = TRUE;
+ *Chipset = CHIP_VGA;
+ }
+ return(result);
+}
+
+/* ARGSUSED */
+static int MemProbe_VGA(Chipset)
+int Chipset;
+{
+ return(256);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c
new file mode 100644
index 000000000..0eef708ed
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c
@@ -0,0 +1,117 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Video7.c,v 3.5 1996/12/23 06:31:44 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Video7.c /main/6 1996/10/24 07:10:14 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor Video7_Descriptor = {
+ "Video7",
+ Probe_Video7,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_Video7(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, old1;
+ Word id;
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(SEQ_IDX, 0x06);
+ wrinx(SEQ_IDX, 0x06, 0xEA); /* enable extensions */
+ old1 = rdinx(CRTC_IDX, 0x0C);
+ wrinx(CRTC_IDX, 0x0C, 0x55);
+ id = rdinx(CRTC_IDX, 0x1F);
+ wrinx(CRTC_IDX, 0x0C, old1);
+ if (id == (0x55 ^ 0xEA))
+ {
+ /*
+ * It's Video7
+ */
+ result = TRUE;
+ id = (rdinx(SEQ_IDX, 0x8F) << 8) | rdinx(SEQ_IDX, 0x8E);
+ if ((id >= 0x7000) && (id <= 0x70FF))
+ {
+ *Chipset = CHIP_V7_FWRITE;
+ }
+ else if ((id >= 0x7140) && (id <= 0x714F))
+ {
+ *Chipset = CHIP_V7_1024i;
+ }
+ else if (id == 0x7151)
+ {
+ *Chipset = CHIP_V7_VRAM2_B;
+ }
+ else if (id == 0x7152)
+ {
+ *Chipset = CHIP_V7_VRAM2_C;
+ }
+ else if (id == 0x7760)
+ {
+ *Chipset = CHIP_HT216BC;
+ }
+ else if (id == 0x7763)
+ {
+ *Chipset = CHIP_HT216D;
+ }
+ else if (id == 0x7764)
+ {
+ *Chipset = CHIP_HT216E;
+ }
+ else if (id == 0x7765)
+ {
+ *Chipset = CHIP_HT216F;
+ }
+ else if ((id >= 0x8000) && (id < 0xFFFF))
+ {
+ *Chipset = CHIP_V7_VEGA;
+ }
+ else
+ {
+ Chip_data = id;
+ *Chipset = CHIP_V7_UNKNOWN;
+ }
+ }
+ wrinx(SEQ_IDX, 6, old); /* disable extensions */
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c
new file mode 100644
index 000000000..ac90a62a8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c
@@ -0,0 +1,200 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/WD.c,v 3.5 1996/12/23 06:31:45 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: WD.c /main/6 1996/10/24 07:10:17 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x000, 0x000, GRC_IDX, GRC_REG, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+static int MemProbe_WD __STDCARGS((int));
+
+Chip_Descriptor WD_Descriptor = {
+ "WD",
+ Probe_WD,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ MemProbe_WD,
+};
+
+Bool Probe_WD(Chipset)
+int *Chipset;
+{
+ Byte old, old1, old2, old3;
+ Word ver;
+ Bool result = FALSE;
+
+ /* Add CRTC to enabled ports */
+ Ports[0] = CRTC_IDX;
+ Ports[1] = CRTC_REG;
+ EnableIOPorts(NUMPORTS, Ports);
+
+ old = rdinx(GRC_IDX, 0x0F);
+ setinx(GRC_IDX, 0x0F, 0x17); /* Lock registers */
+ if (!testinx2(GRC_IDX, 0x09, 0x7F))
+ {
+ wrinx(GRC_IDX, 0x0F, 0x05); /* Unlock them again */
+ if (testinx2(GRC_IDX, 0x09, 0x7F))
+ {
+ result = TRUE;
+ old2 = rdinx(CRTC_IDX, 0x29);
+ /* Unlock WD90Cxx regs */
+ modinx(CRTC_IDX, 0x29, 0x8F, 0x85);
+ if (!testinx(CRTC_IDX, 0x2B))
+ {
+ *Chipset = CHIP_WD_PVGA1;
+ }
+ else
+ {
+ old1 = rdinx(SEQ_IDX, 0x06);
+ wrinx(SEQ_IDX, 0x06, 0x48);
+ if (!testinx2(SEQ_IDX, 0x07, 0xF0))
+ {
+ *Chipset = CHIP_WD_90C00;
+ }
+ else if (!testinx(SEQ_IDX, 0x10))
+ {
+ if (testinx2(CRTC_IDX, 0x31, 0x68))
+ {
+ *Chipset = CHIP_WD_90C22;
+ }
+ else if (testinx2(CRTC_IDX, 0x31, 0x90))
+ {
+ *Chipset = CHIP_WD_90C20A;
+ }
+ else
+ {
+ *Chipset = CHIP_WD_90C20;
+ }
+ wrinx(CRTC_IDX, 0x34, 0xA6);
+ if (rdinx(CRTC_IDX, 0x32) & 0x20)
+ {
+ wrinx(CRTC_IDX, 0x34, 0x00);
+ }
+ }
+ else if (testinx2(SEQ_IDX, 0x14, 0x0F))
+ {
+ old3 = rdinx(CRTC_IDX, 0x34);
+ wrinx(CRTC_IDX, 0x34, 0x00);
+ ver = ((rdinx(CRTC_IDX, 0x36) << 8) |
+ (rdinx(CRTC_IDX, 0x37)));
+ switch (ver)
+ {
+ case 0x3234:
+ *Chipset = CHIP_WD_90C24;
+ break;
+ case 0x3236:
+ *Chipset = CHIP_WD_90C26;
+ break;
+ case 0x3237: /* Guess */
+ *Chipset = CHIP_WD_90C27;
+ break;
+ case 0x3330:
+ *Chipset = CHIP_WD_90C30;
+ break;
+ case 0x3331:
+ *Chipset = CHIP_WD_90C31;
+ break;
+ case 0x3333:
+ *Chipset = CHIP_WD_90C33;
+ break;
+ default:
+ Chip_data = ver & 0xFF;
+ *Chipset = CHIP_WD_UNK;
+ break;
+ }
+ wrinx(CRTC_IDX, 0x34, old3);
+ }
+ else if (!testinx2(SEQ_IDX, 0x10, 0x04))
+ {
+ *Chipset = CHIP_WD_90C10;
+ }
+ else
+ {
+ *Chipset = CHIP_WD_90C11;
+ }
+ wrinx(SEQ_IDX, 0x06, old1);
+ }
+ wrinx(CRTC_IDX, 0x29, old2);
+ }
+ }
+ wrinx(0x3CE, 0x0F, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
+
+static int MemProbe_WD(Chipset)
+int Chipset;
+{
+ Byte old;
+ int Mem = 0;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Unlock
+ */
+ old = rdinx(GRC_IDX, 0x0F);
+ wrinx(GRC_IDX, 0x0F, 0x05);
+
+ /*
+ * Check
+ */
+ switch (rdinx(GRC_IDX, 0x0B) >> 6)
+ {
+ case 0x00:
+ case 0x01:
+ Mem = 256;
+ break;
+ case 0x02:
+ Mem = 512;
+ break;
+ case 0x03:
+ Mem = 1024;
+ break;
+ }
+
+ if ((Chipset >= CHIP_WD_90C33) &&
+ (rdinx(CRTC_IDX, 0x3E) & 0x80))
+ {
+ Mem = 2048;
+ }
+
+ /*
+ * Lock
+ */
+ wrinx(GRC_IDX, 0x0F, old);
+
+ DisableIOPorts(NUMPORTS, Ports);
+ return(Mem);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c
new file mode 100644
index 000000000..614ec0881
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c
@@ -0,0 +1,124 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Weitek.c,v 3.5 1996/12/23 06:31:46 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Weitek.c /main/6 1996/10/25 06:19:09 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3CD, SEQ_IDX, SEQ_REG};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor Weitek_Descriptor = {
+ "Weitek",
+ Probe_Weitek,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+static Byte WeitekEnable(Flag)
+Byte Flag;
+{
+ Byte new, old, x;
+
+ old = rdinx(SEQ_IDX, 0x11);
+ for (x=0; x < 10; x++)
+ {
+ ;
+ }
+ outp(SEQ_REG, old);
+ for (x=0; x < 10; x++)
+ {
+ ;
+ }
+ outp(SEQ_REG, old);
+ for (x=0; x < 10; x++)
+ {
+ ;
+ }
+ new = inp(SEQ_REG);
+ for (x=0; x < 10; x++)
+ {
+ ;
+ }
+ outp(SEQ_REG, (new & 0x9F) | Flag);
+
+ return(old);
+}
+
+Bool Probe_Weitek(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+ Byte old, ver;
+
+ EnableIOPorts(NUMPORTS, Ports);
+
+ /*
+ * Disable extensions
+ */
+ old = WeitekEnable(0x60);
+ if (!testinx(SEQ_IDX, 0x12))
+ {
+ /*
+ * Enable extensions
+ */
+ WeitekEnable(0);
+ if (testinx(SEQ_IDX, 0x12))
+ {
+ if (tstrg(0x3CD, 0xFF))
+ {
+ result = TRUE;
+ ver = rdinx(SEQ_IDX, 0x07) >> 5;
+ switch (ver)
+ {
+ case 0x00: /* guess */
+ *Chipset = CHIP_WEIT_5086;
+ break;
+ case 0x01:
+ *Chipset = CHIP_WEIT_5186;
+ break;
+ case 0x02:
+ *Chipset = CHIP_WEIT_5286;
+ break;
+ default:
+ Chip_data = ver;
+ *Chipset = CHIP_WEIT_UNK;
+ break;
+ }
+ }
+ }
+ }
+
+ wrinx(SEQ_IDX, 0x11, old);
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c
new file mode 100644
index 000000000..d4648e5d5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c
@@ -0,0 +1,60 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/Yamaha.c,v 3.4 1996/12/23 06:31:47 dawes Exp $ */
+/*
+ * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of David Wexelblat shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from David Wexelblat.
+ *
+ */
+
+/* $XConsortium: Yamaha.c /main/5 1996/02/21 17:13:23 kaleb $ */
+
+#include "Probe.h"
+
+static Word Ports[] = {0x3D4, 0x3D5};
+#define NUMPORTS (sizeof(Ports)/sizeof(Word))
+
+Chip_Descriptor Yamaha_Descriptor = {
+ "Yamaha",
+ Probe_Yamaha,
+ Ports,
+ NUMPORTS,
+ FALSE,
+ FALSE,
+ TRUE,
+ NULL,
+};
+
+Bool Probe_Yamaha(Chipset)
+int *Chipset;
+{
+ Bool result = FALSE;
+
+ EnableIOPorts(NUMPORTS, Ports);
+ if (testinx2(0x3D4, 0x7C, 0x7C))
+ {
+ result = TRUE;
+ *Chipset = CHIP_YAMAHA6388;
+ }
+ DisableIOPorts(NUMPORTS, Ports);
+ return(result);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def b/xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def
new file mode 100644
index 000000000..9406b8451
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/sprobe.def
@@ -0,0 +1,4 @@
+NAME SuperProbe NOTWINDOWCOMPAT
+DESCRIPTION "X11R6 XFree86 3.3.3.1 SuperProbe for OS/2 EMX0.9C"
+PROTMODE
+EXETYPE OS2
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Conf.cpp b/xc/programs/Xserver/hw/xfree86/XF86Conf.cpp
new file mode 100644
index 000000000..3e92d5876
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Conf.cpp
@@ -0,0 +1,611 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.cpp,v 3.42 1999/07/18 15:47:47 dawes Exp $
+XCOMM
+XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc.
+XCOMM
+XCOMM Permission is hereby granted, free of charge, to any person obtaining a
+XCOMM copy of this software and associated documentation files (the "Software"),
+XCOMM to deal in the Software without restriction, including without limitation
+XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense,
+XCOMM and/or sell copies of the Software, and to permit persons to whom the
+XCOMM Software is furnished to do so, subject to the following conditions:
+XCOMM
+XCOMM The above copyright notice and this permission notice shall be included in
+XCOMM all copies or substantial portions of the Software.
+XCOMM
+XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+XCOMM SOFTWARE.
+XCOMM
+XCOMM Except as contained in this notice, the name of the XFree86 Project shall
+XCOMM not be used in advertising or otherwise to promote the sale, use or other
+XCOMM dealings in this Software without prior written authorization from the
+XCOMM XFree86 Project.
+XCOMM
+XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
+
+XCOMM **********************************************************************
+XCOMM This is a sample configuration file only, intended to illustrate
+XCOMM what a config file might look like. Refer to the XF86Config(4/5)
+XCOMM man page for details about the format of this file. This man page
+XCOMM is installed as MANPAGE
+XCOMM **********************************************************************
+
+XCOMM The ordering of sections is not important in version 4.0 and later.
+
+XCOMM **********************************************************************
+XCOMM Files section. This allows default font and rgb paths to be set
+XCOMM **********************************************************************
+
+Section "Files"
+
+XCOMM The location of the RGB database. Note, this is the name of the
+XCOMM file minus the extension (like ".txt" or ".db"). There is normally
+XCOMM no need to change the default.
+
+ RgbPath RGBPATH
+
+XCOMM Multiple FontPath entries are allowed (which are concatenated together),
+XCOMM as well as specifying multiple comma-separated entries in one FontPath
+XCOMM command (or a combination of both methods)
+
+ FontPath LOCALFONTPATH
+ FontPath MISCFONTPATH
+ FontPath DPI75USFONTPATH
+ FontPath DPI100USFONTPATH
+ FontPath T1FONTPATH
+ FontPath CIDFONTPATH
+ FontPath SPFONTPATH
+ FontPath DPI75FONTPATH
+ FontPath DPI100FONTPATH
+
+XCOMM ModulePath can be used to set a search path for the X server modules.
+XCOMM The default path is shown here.
+
+XCOMM ModulePath MODULEPATH
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Module section -- this is an optional section which is used to specify
+XCOMM which run-time loadable modules to load when the X server starts up.
+XCOMM **********************************************************************
+
+Section "Module"
+
+XCOMM This loads the DBE extension module.
+
+ Load "dbe"
+
+XCOMM This loads the miscellaneous extensions module, and disables
+XCOMM initialisation of the XFree86-DGA extension within that module.
+
+ SubSection "extmod"
+ Option "omit xfree86-dga"
+ EndSubSection
+
+XCOMM This loads the Type1 and FreeType font modules
+
+ Load "type1"
+ Load "freetype"
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Server flags section. This contains various server-wide Options.
+XCOMM **********************************************************************
+
+Section "ServerFlags"
+
+XCOMM Uncomment this to cause a core dump at the spot where a signal is
+XCOMM received. This may leave the console in an unusable state, but may
+XCOMM provide a better stack trace in the core dump to aid in debugging
+
+XCOMM Option "NoTrapSignals"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
+XCOMM This allows clients to receive this key event.
+
+XCOMM Option "DontZap"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
+XCOMM sequences. This allows clients to receive these key events.
+
+XCOMM Option "DontZoom"
+
+XCOMM Uncomment this to disable tuning with the xvidtune client. With
+XCOMM it the client can still run and fetch card and monitor attributes,
+XCOMM but it will not be allowed to change them. If it tries it will
+XCOMM receive a protocol error.
+
+XCOMM Option "DisableVidModeExtension"
+
+XCOMM Uncomment this to enable the use of a non-local xvidtune client.
+
+XCOMM Option "AllowNonLocalXvidtune"
+
+XCOMM Uncomment this to disable dynamically modifying the input device
+XCOMM (mouse and keyboard) settings.
+
+XCOMM Option "DisableModInDev"
+
+XCOMM Uncomment this to enable the use of a non-local client to
+XCOMM change the keyboard or mouse settings (currently only xset).
+
+XCOMM Option "AllowNonLocalModInDev"
+
+XCOMM Set the basic blanking screen saver timeout.
+
+ Option "blank time" "10" # 10 minutes
+
+XCOMM Set the DPMS timeouts. These are set here because they are global
+XCOMM rather than screen-specific. These settings alone don't enable DPMS.
+XCOMM It is enabled per-screen (or per-monitor), and even then only when
+XCOMM the driver supports it.
+
+ Option "standby time" "20"
+ Option "suspend time" "30"
+ Option "off time" "60"
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Input devices
+XCOMM **********************************************************************
+
+XCOMM **********************************************************************
+XCOMM Core keyboard's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+ Identifier "Keyboard1"
+ Driver "keyboard"
+
+XCOMM For most OSs the protocol can be omitted (it defaults to "Standard").
+XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment
+XCOMM out the above line, and uncomment the following line.
+
+XCOMM Option "Protocol" "Xqueue"
+
+XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
+XCOMM this.
+
+ Option "AutoRepeat" "500 5"
+
+XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
+
+XCOMM Option "Xleds" "1 2 3"
+
+XCOMM To disable the XKEYBOARD extension, uncomment XkbDisable.
+
+XCOMM Option "XkbDisable"
+
+XCOMM To customise the XKB settings to suit your keyboard, modify the
+XCOMM lines below (which are the defaults). For example, for a European
+XCOMM keyboard, you will probably want to use one of:
+XCOMM
+XCOMM Option "XkbModel" "pc102"
+XCOMM Option "XkbModel" "pc105"
+XCOMM
+XCOMM If you have a Microsoft Natural keyboard, you can use:
+XCOMM
+XCOMM Option "XkbModel" "microsoft"
+XCOMM
+XCOMM If you have a US "windows" keyboard you will want:
+XCOMM
+XCOMM Option "XkbModel" "pc104"
+XCOMM
+XCOMM Then to change the language, change the Layout setting.
+XCOMM For example, a german layout can be obtained with:
+XCOMM
+XCOMM Option "XkbLayout" "de"
+XCOMM
+XCOMM or:
+XCOMM
+XCOMM Option "XkbLayout" "de"
+XCOMM Option "XkbVariant" "nodeadkeys"
+XCOMM
+XCOMM If you'd like to switch the positions of your capslock and
+XCOMM control keys, use:
+XCOMM
+XCOMM Option "XkbOptions" "ctrl:swapcaps"
+
+
+XCOMM These are the default XKB settings for XFree86
+XCOMM
+XCOMM Option "XkbRules" "xfree86"
+XCOMM Option "XkbModel" "pc101"
+XCOMM Option "XkbLayout" "us"
+XCOMM Option "XkbVariant" ""
+XCOMM Option "XkbOptions" ""
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Core Pointer's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+XCOMM Identifier and driver
+
+ Identifier "Mouse1"
+ Driver "mouse"
+
+XCOMM The mouse protocol and device. The device is normally set to /dev/mouse,
+XCOMM which is usually a symbolic link to the real device.
+
+ Option "Protocol" "Microsoft"
+ Option "Device" "/dev/mouse"
+
+XCOMM On platforms where PnP mouse detection is supported the following
+XCOMM protocol setting can be used when using a newer PnP mouse:
+
+XCOMM Option "Protocol" "Auto"
+
+XCOMM When using mouse connected to a PS/2 port (aka "MousePort), set the
+XCOMM the protocol as follows. On some platforms some other settings may
+XCOMM be available.
+
+XCOMM Option "Protocol" "PS/2"
+
+XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), use
+XCOMM the following instead of any of the lines above. The Device line
+XCOMM is not required in this case.
+
+XCOMM Option "Protocol" "Xqueue"
+
+XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
+XCOMM almost every case these lines should be omitted.
+
+XCOMM Option "BaudRate" "9600"
+XCOMM Option "SampleRate" "150"
+
+XCOMM Emulate3Buttons is an option for 2-button mice
+XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+
+XCOMM Option "Emulate3Buttons"
+XCOMM Option "Emulate3Timeout" "50"
+
+XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any
+XCOMM 3-button mouse where the middle button generates left+right button
+XCOMM events.
+
+XCOMM Option "ChordMiddle"
+
+EndSection
+
+Section "InputDevice"
+ Identifier "Mouse2"
+ Driver "mouse"
+ Option "Protocol" "MouseMan"
+ Option "Device" "/dev/mouse2"
+EndSection
+
+XCOMM Some examples of extended input devices
+
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball"
+XCOMM Driver "magellan"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball2"
+XCOMM Driver "spaceorb"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen0"
+XCOMM Driver "microtouch"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "1412"
+XCOMM Option "MaxX" "15184"
+XCOMM Option "MinY" "15372"
+XCOMM Option "MaxY" "1230"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen1"
+XCOMM Driver "elo2300"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "231"
+XCOMM Option "MaxX" "3868"
+XCOMM Option "MinY" "3858"
+XCOMM Option "MaxY" "272"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonThreshold" "17"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+
+XCOMM **********************************************************************
+XCOMM Monitor section
+XCOMM **********************************************************************
+
+XCOMM Any number of monitor sections may be present
+
+Section "Monitor"
+
+XCOMM The identifier line must be present.
+
+ Identifier "Generic Monitor"
+
+XCOMM HorizSync is in kHz unless units are specified.
+XCOMM HorizSync may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+XCOMM HorizSync 31.5 # typical for a single frequency fixed-sync monitor
+XCOMM HorizSync 30-64 # multisync
+XCOMM HorizSync 31.5, 35.2 # multiple fixed sync frequencies
+XCOMM HorizSync 15-25, 30-50 # multiple ranges of sync frequencies
+
+XCOMM VertRefresh is in Hz unless units are specified.
+XCOMM VertRefresh may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+XCOMM VertRefresh 60 # typical for a single frequency fixed-sync monitor
+
+XCOMM VertRefresh 50-100 # multisync
+XCOMM VertRefresh 60, 65 # multiple fixed sync frequencies
+XCOMM VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies
+
+XCOMM Modes can be specified in two formats. A compact one-line format, or
+XCOMM a multi-line format.
+
+XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
+XCOMM These two are equivalent
+
+XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+
+ Mode "640x480"
+ DotClock 25.175
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+
+XCOMM These two are equivalent
+
+XCOMM ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+
+XCOMM Mode "1024x768i"
+XCOMM DotClock 45
+XCOMM HTimings 1024 1048 1208 1264
+XCOMM VTimings 768 776 784 817
+XCOMM Flags "Interlace"
+XCOMM EndMode
+
+XCOMM If a monitor has DPMS support, that can be indicated here. This will
+XCOMM enable DPMS when the montor is used with drivers that support it.
+
+XCOMM Option "dpms"
+
+XCOMM If a monitor requires that the sync signals be superimposed on the
+XCOMM green signal, the following option will enable this when used with
+XCOMM drivers that support it. Only a relatively small range of hardware
+XCOMM (and drivers) actually support this.
+
+XCOMM Option "sync on green"
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Graphics device section
+XCOMM **********************************************************************
+
+XCOMM Any number of graphics device sections may be present
+
+Section "Device"
+
+XCOMM The Identifier must be present.
+
+ Identifier "Generic VGA"
+
+XCOMM The Driver line must be present. When using run-time loadable driver
+XCOMM modules, this line instructs the server to load the specified driver
+XCOMM module. Even when not using loadable driver modules, this line
+XCOMM indicates which driver should interpret the information in this section.
+
+ Driver "vga"
+
+XCOMM The chipset line is optional in most cases. It can be used to override
+XCOMM the driver's chipset detection, and should not normally be specified.
+
+XCOMM Chipset "generic"
+
+XCOMM Various other lines can be specified to override the driver's automatic
+XCOMM detection code. In most cases they are not needed.
+
+XCOMM VideoRam 256
+XCOMM Clocks 25.2 28.3
+
+XCOMM The BusID line is used to specify which of possibly multiple devices
+XCOMM this section is intended for. When this line isn't present, a device
+XCOMM section can only match up with the primary video device. For PCI
+XCOMM devices a line like the following could be used. This line should not
+XCOMM normally be included unless there is more than one video device
+XCOMM intalled.
+
+XCOMM BusID "PCI:0:10:0"
+
+XCOMM Various option lines can be added here as required. Some options
+XCOMM are more appropriate in Screen sections, Display subsections or even
+XCOMM Monitor sections.
+
+XCOMM Option "hw cursor" "off"
+
+EndSection
+
+Section "Device"
+ Identifier "any supported Trident chip"
+ Driver "trident"
+EndSection
+
+Section "Device"
+ Identifier "MGA Millennium I"
+ Driver "mga"
+ Option "hw cursor" "off"
+ BusID "PCI:0:10:0"
+EndSection
+
+Section "Device"
+ Identifier "MGA G200 AGP"
+ Driver "mga"
+ BusID "PCI:1:0:0"
+ Option "pci retry"
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Screen sections.
+XCOMM **********************************************************************
+
+XCOMM Any number of screen sections may be present. Each describes
+XCOMM the configuration of a single screen. A single specific screen section
+XCOMM may be specified from the X server command line with the "-screen"
+XCOMM option.
+
+Section "Screen"
+
+XCOMM The Identifier, Device and Monitor lines must be present
+
+ Identifier "Screen 1"
+ Device "Generic VGA"
+ Monitor "Generic Monitor"
+
+XCOMM The favoured Depth and/or Bpp may be specified here
+
+ DefaultDepth 8
+
+ SubSection "Display"
+ Depth 8
+ Modes "640x480"
+ ViewPort 0 0
+ Virtual 800 600
+ EndSubsection
+
+ SubSection "Display"
+ Depth 4
+ Modes "640x480"
+ EndSubSection
+
+ SubSection "Display"
+ Depth 1
+ Modes "640x480"
+ EndSubSection
+
+EndSection
+
+
+Section "Screen"
+ Identifier "Screen MGA1"
+ Device "MGA Millennium I"
+ Monitor "Generic Monitor"
+ Option "no accel"
+ DefaultDepth 16
+XCOMM DefaultDepth 24
+
+ SubSection "Display"
+ Depth 8
+ Modes "1280x1024"
+ Option "rgb bits" "8"
+ Visual "StaticColor"
+ EndSubSection
+ SubSection "Display"
+ Depth 16
+ Modes "1280x1024"
+ EndSubSection
+ SubSection "Display"
+ Depth 24
+ Modes "1280x1024"
+ EndSubSection
+EndSection
+
+
+Section "Screen"
+ Identifier "Screen MGA2"
+ Device "MGA G200 AGP"
+ Monitor "Generic Monitor"
+ DefaultDepth 8
+
+ SubSection "Display"
+ Depth 8
+ Modes "1280x1024"
+ Option "rgb bits" "8"
+ Visual "StaticColor"
+ EndSubSection
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM ServerLayout sections.
+XCOMM **********************************************************************
+
+XCOMM Any number of ServerLayout sections may be present. Each describes
+XCOMM the way multiple screens are organised. A specific ServerLayout
+XCOMM section may be specified from the X server command line with the
+XCOMM "-layout" option. In the absence of this, the first section is used.
+XCOMM When now ServerLayout section is present, the first Screen section
+XCOMM is used alone.
+
+Section "ServerLayout"
+
+XCOMM The Identifier line must be present
+
+ Identifier "Main Layout"
+
+XCOMM Each Screen line specifies a Screen section name, and optionally
+XCOMM the relative position of other screens. The four names after
+XCOMM primary screen name are the screens to the top, bottom, left and right
+XCOMM of the primary screen. In this example, screen 2 is located to the
+XCOMM right of screen 1.
+
+ Screen "Screen MGA 1" "" "" "" "Screen MGA 2"
+ Screen "Screen MGA 2" "" "" "Screen MGA 1" ""
+
+XCOMM Each InputDevice line specifies an InputDevice section name and
+XCOMM optionally some options to specify the way the device is to be
+XCOMM used. Those options include "CorePointer", "CoreKeyboard" and
+XCOMM "SendCoreEvents". In this example, "Mouse1" is the core pointer,
+XCOMM and "Mouse2" is an extended input device that also generates core
+XCOMM pointer events (i.e., both mice will move the standard pointer).
+
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Mouse2" "SendCoreEvents"
+ InputDevice "Keyboard1" "CoreKeyboard"
+
+EndSection
+
+
+Section "ServerLayout"
+ Identifier "another layout"
+ Screen "Screen 1"
+ Screen "Screen MGA 1"
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
+
+
+Section "ServerLayout"
+ Identifier "simple layout"
+ Screen "Screen 1"
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Conf.man b/xc/programs/Xserver/hw/xfree86/XF86Conf.man
new file mode 100644
index 000000000..dc4f0c44d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Conf.man
@@ -0,0 +1,1134 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Conf.man,v 3.62 1999/04/25 10:01:54 dawes Exp $
+.TH XF86Config 4/5 "Version 4.0" "XFree86"
+.SH NAME
+XF86Config - Configuration File for XFree86
+.SH DESCRIPTION
+.I XFree86
+uses a configuration file called \fBXF86Config\fP for its initial
+setup. This configuration file is searched for in the following
+places:
+.sp
+.in 8
+.nf
+/etc/XF86Config
+<XRoot>/lib/X11/XF86Config.\fIhostname\fP
+<XRoot>/lib/X11/XF86Config
+.fi
+.in -8
+.LP
+where <XRoot> refers to the root of the X11 install tree.
+When an X server is started by a `root' user, it will first search for
+an \fBXF86Config\fP file in that user's home directory.
+.PP
+This file is composed of a number of sections. Each section has
+the form:
+.sp
+.in 8
+.nf
+Section "\fISectionName\fP"
+ \fISectionEntry\fP
+ ...
+EndSection
+.fi
+.in -8
+.PP
+The section names are:
+.sp
+.in 8
+.nf
+\fBFiles\fP (File pathnames)
+\fBModule\fP (Dynamic module loading)
+\fBServerFlags\fP (Server flags)
+\fBKeyboard\fP (Keyboard configuration)
+\fBPointer\fP (Pointer configuration)
+\fBMonitor\fP (Monitor description)
+\fBDevice\fP (Graphics device description)
+\fBScreen\fP (Screen configuration)
+\fBXInput\fP (Extended Input devices configuration)
+.fi
+.PP
+The \fBFiles\fP section is used to specify the default font path
+and the path to the RGB database. These paths can also be set from
+the command line (see \fIXserver(1)\fP). The entries available
+for this section are:
+.TP 8
+.B FontPath \fI"path"\fP
+sets the search path for fonts. This path is a comma separated
+list of directories which the X server searches for font databases.
+Multiple \fBFontPath\fP entries may be specified, and they will be
+concatenated to build up the fontpath used by the server.
+.sp
+X11R6 allows the X server to request fonts from a font server. A
+font server is specified by placing a "<trans>/<hostname>:<port_number>"
+entry into the fontpath. For example, the fontpath
+"/usr/X11R6/lib/X11/fonts/misc/,tcp/zok:7100" tells the X server
+to first try to locate the font in the local directory
+/usr/X11R6/lib/X11/fonts/misc. If that fails, then request the
+font from the \fIfont server\fP running on machine zok listening
+for connections on TCP port number 7100.
+.TP 8
+.B RGBPath \fI"path"\fP
+sets the path name for the RGB color database.
+.TP 8
+.B ModulePath \fI"path"\fP
+sets the search path for dynamic modules. This path is a comma separated
+list fo directories which the X server searches for dynamic module loading
+in the order specified.
+Multiple \fBModulePath\fP entries may be specified, and they will be
+concatenated to build the modulepath used by the server.
+.PP
+The
+.B Module
+section is used to specify which dynamic modules should be loaded.
+At present dynamic modules are only used for XInput devices, and are
+only supported on some systems (currently Linux ELF, FreeBSD 2.x and
+NetBSD 1.x). The entry available for this section is:
+.TP 8
+.B Load \fI"module"\fP
+This instructs the server to load \fI"module"\fP. If the module
+is not specified with a full pathname, the directories specified in
+the \fBModulePath\fP are searched.
+Modules are currently available to support extended input devices. The
+names of these are:
+.sp
+.in 20
+.nf
+.B xf86Elo.so
+.B xf86Jstk.so
+.B xf86Wacom.so
+.B xf86Summa.so
+.fi
+.in -20
+The PEX and XIE extension are also be available as modules on some
+systems. The names for these are:
+.sp
+.in 20
+.nf
+.B pex5.so
+.B xie.so
+.fi
+.in -20
+.RS 8
+For an up-to-date listing, check in <XRoot>/lib/modules.
+.RE
+.PP
+The \fBServerFlags\fP section is used to specify some miscellaneous
+X server options. The entries available for this section are:
+.TP 8
+.B NoTrapSignals
+This prevents the X server from trapping a range of unexpected
+fatal signals and exiting cleanly. Instead, the X server will die
+and drop core where the fault occurred. The default behaviour is
+for the X server exit cleanly, but still drop a core file. In
+general you never want to use this option unless you are debugging
+an X server problem.
+.TP 8
+.B DontZap
+This disallows the use of the \fBCtrl+Alt+Backspace\fP sequence.
+This sequence allows you to terminate the X server.
+Setting \fBDontZap\fP allows this key sequence to be passed to clients.
+.TP 8
+.B DontZoom
+This disallows the use of the \fBCtrl+Alt+Keypad-Plus\fP and
+\fBCtrl+Alt+Keypad-Minus\fP sequences. These sequences allows you to
+switch between video modes.
+Setting \fBDontZoom\fP allows these key sequences to be passed to clients.
+.TP 8
+.B AllowNonLocalXvidtune
+This allows the xvidtune client to connect from another host. By default
+non-local connections are not allowed.
+.TP 8
+.B DisableVidMode
+This disables the parts of the VidMode extension used by the xvidtune client
+that can be used to change the video modes.
+.TP 8
+.B AllowNonLocalModInDev
+This allows a client to connect from another host and change keyboard
+and mouse settings in the running server. By default
+non-local connections are not allowed.
+.TP 8
+.B DisableModInDev
+This disables the parts of the Misc extension that can be used to
+modify the input device settings dynamically.
+.TP 8
+.B AllowMouseOpenFail
+This allows the server to start up even if the mouse device can't be
+opened/initialised.
+.PP
+The \fBKeyboard\fP section is used to specify the keyboard input
+device, parameters and some default keyboard mapping options. The
+entries available for this section are:
+.TP 8
+.B Protocol \fI"kbd-protocol"\fP
+\fIkbd-protocol\fP may be either \fBStandard\fP or \fBXqueue\fP.
+\fBXqueue\fP is specified when using the event queue driver on SVR3
+or SVR4.
+.TP
+.B AutoRepeat \fIdelay rate\fP
+changes the behavior of the autorepeat of the keyboard. This does
+not work on all platforms.
+.TP 8
+.B ServerNumLock
+forces the X server to handle the numlock key internally. The X
+server sends a different set of keycodes for the numpad when the
+numlock key is active. This enables applications to make use of
+the numpad.
+.PP
+.nf
+.B LeftAlt \fImapping\fP
+.B RightAlt \fImapping\fP
+.B AltGr \fImapping\fP
+.B ScrollLock \fImapping\fP
+.B RightCtl \fImapping\fP
+.fi
+.RS 8
+Allows a default mapping to be set for the above keys (note that
+\fBAltGr\fP is a synonym for \fBRightAlt\fP). The values that may
+be specified for \fImapping\fP are:
+.sp
+.in 20
+.nf
+Meta
+Compose
+ModeShift
+ModeLock
+ScrollLock
+Control
+.fi
+.PP
+The default mapping when none of these options are specified is:
+.sp
+.in 20
+.nf
+LeftAlt Meta
+RightAlt Meta
+ScrollLock Compose
+RightCtl Control
+.fi
+.RE
+.TP 8
+.B XLeds \fIled\fP ...
+makes \fIled\fP available for clients instead of using the traditional
+function (Scroll Lock, Caps Lock & Num Lock). \fIled\fP is a list
+of numbers in the range 1 to 3.
+.TP 8
+.B VTSysReq
+enables the SYSV-style VT switch sequence for non-SYSV systems
+which support VT switching. This sequence is Alt-SysRq followed
+by a function key (Fn). This prevents the X server trapping the
+keys used for the default VT switch sequence.
+.TP 8
+.B VTInit \fI"command"\fP
+Runs \fIcommand\fP after the VT used by the server has been opened.
+The command string is passed to "/bin/sh -c", and is run with the
+real user's id with stdin and stdout set to the VT. The purpose
+of this option is to allow system dependent VT initialisation
+commands to be run. One example is a command to disable the 2-key
+VT switching sequence which is the default on some systems.
+.TP 8
+.B XkbDisable
+Turns the XKEYBOARD extension off, equivalent to using the -kb
+command line option.
+.PP
+.nf
+.B XkbRules \fI"rulesfile"\fP
+.B XkbModel \fI"model"\fP
+.B XkbLayout \fI"layout"\fP
+.B XkbVariant \fI"variant"\fP
+.B XkbOptions \fI"optionlist"\fP
+.fi
+.RS 8
+These specify the definitions which are used to determine which
+XKEYBOARD components to use. The optionlist, should be a comma
+separated list of options.
+The default mappings for each these are:
+.sp
+.in 20
+.nf
+XkbRules "xfree86"
+XkbModel "pc101"
+XkbLayout "us"
+XkbVariant ""
+XkbOptions ""
+.fi
+.RE
+.PP
+This is the preferred method of specifying the keyboard configuration,
+however, you can also specify the components directly with:
+.sp
+.nf
+.B XkbKeymap \fI"keymap"\fP
+.B XkbKeycodes \fI"keycodes"\fP
+.B XkbTypes \fI"types"\fP
+.B XkbCompat \fI"compat"\fP
+.B XkbSymbols \fI"symbols"\fP
+.B XkbGeometry \fI"geometry"\fP
+.fi
+.RS 8
+If you specify only some of the components, the remaining components
+will use these default values:
+.sp
+.in 20
+.nf
+XkbKeymap none
+XkbKeycodes "xfree86"
+XkbTypes "default"
+XkbCompat "default"
+XkbSymbols "us(pc101)"
+XkbGeometry "pc"
+.fi
+.RE
+.PP
+The \fBPointer\fP section is used to specify the pointer device
+and parameters. The entries available for this section are:
+.TP 8
+.B Protocol \fI"protocol-type\fP"
+specifies the pointer device protocol type. The protocol types
+available are:
+.sp
+.in 20
+.nf
+.B Auto
+.B BusMouse
+.B GlidePoint
+.B GlidePointPS/2
+.B IntelliMouse
+.B IMPS/2
+.B Logitech
+.B Microsoft
+.B MMHitTab
+.B MMSeries
+.B Mouseman
+.B MouseManPlusPS/2
+.B MouseSystems
+.B NetMousePS/2
+.B NetScrollPS/2
+.B OSMouse
+.B PS/2
+.B SysMouse
+.B ThinkingMouse
+.B ThinkingMousePS/2
+.B Xqueue
+.fi
+.in -20
+.RS 8
+.PP
+One should specify \fBBusMouse\fP for the Logitech bus mouse and
+bus or InPort mice from Microsoft and ATI.
+The \fBLogitech\fP protocol is for old serial mouse models from Logitech.
+Many newer Logitech serial mice use either the \fBMicrosoft\fP
+or \fBMouseMan\fP protocol. \fBXqueue\fP should be specified here
+if it was used in the \fBKeyboard\fP section. \fBOSMouse\fP refers
+to the event-driver mouse interface available on SCO's SVR3, and the
+mouse interface provided for OS/2. This
+may optionally be followed by a number specifying the number of
+buttons the mouse has.
+\fBSysMouse\fP refers to the system mouse device, /dev/sysmouse, in
+FreeBSD.
+.PP
+The \fBPS/2\fP and other \fBXXXXPS/2\fP protocol types are for PS/2 mice.
+\fBPS/2\fP should always work with any PS/2 mouse
+regardless of the model of the PS/2 mouse.
+The other \fBXXXXPS/2\fP protocol types may or may not be supported by
+your OS.
+.PP
+The rest of the protocol types are for serial mice.
+If your serial mouse is of a relatively new model, you may specify
+\fBAuto\fP, then the X server will try to select an appropriate
+protocol type automatically. The \fBAuto\fP protocol type may
+also work for the PS/2 and bus mice on some OSs.
+.RE
+.TP 8
+.B Device \fI"pointer-dev"\fP
+specifies the device the server should open for pointer input (eg,
+\fB/dev/tty00\fP or \fB/dev/mouse\fP). A device should not be
+specified when using the \fBXqueue\fP or \fBOSMouse\fP protocols.
+.TP 8
+.B Port \fI"pointer-dev"\fP
+is an alternate form of the \fBDevice\fP entry.
+.TP 8
+.B BaudRate \fIrate\fP
+sets the baudrate of the serial mouse to \fIrate\fP. For mice that
+allow dynamic speed adjustments (like older Logitechs) the baudrate is
+changed in the mouse. Otherwise the rate is simply set on the
+computer's side to allow mice with non-standard rates (the standard
+rate is 1200). For 99% of mice you should not set this to anything
+other than the default (1200).
+.TP 8
+.B Buttons \fIN\fP
+This option tells the X server the number of buttons on the mouse.
+Currently there is no reliable way to automatically detect the correct
+number.
+This option is the only means for the X server to obtain it.
+The default value is three.
+Note that if you intend to assign Z axis movement to button events
+using the \fBZAxisMapping\fP option below, you need to take account
+of those buttons into \fIN\fP too.
+.TP 8
+.B Emulate3Buttons
+enables the emulation of the third mouse button for mice which only
+have two physical buttons. The third button is emulated by pressing
+both buttons simultaneously.
+.TP 8
+.B Emulate3Timeout \fItimeout\fP
+sets the time (in milliseconds) that the server waits before deciding if
+two buttons were pressed ``simultaneously'' when 3 button emulation is
+enabled. The default timeout is 50ms.
+.TP 8
+.B ChordMiddle
+handles mice which send left+right events when the middle button
+is used (like some Logitech Mouseman mice).
+.TP 8
+.B SampleRate \fIrate\fP
+sets the number of motion/button-events the mouse sends per second.
+This is currently only supported for some Logitech mice.
+.TP 8
+.B Resolution \fIcount\fP
+sets the resolution of the device in counts per inch.
+This is not always supported by all the mice.
+.TP 8
+.B ClearDTR
+This option clears the DTR line on the serial port used by the
+mouse. This option is only valid for a mouse using the \fBMouseSystems\fP
+protocol. Some dual-protocol mice require DTR to be cleared to
+operate in MouseSystems mode. Note, in versions of XFree86 prior
+to 2.1, this option also cleared the RTS line. A separate
+\fBClearRTS\fP option has since been added for mice which require
+this.
+.TP 8
+.B ClearRTS
+This option clears the RTS line on the serial port used by the
+mouse. This option is only valid for a mouse using the \fBMouseSystems\fP
+protocol. Some dual-protocol mice require both DTR and RTS to be
+cleared to operate in MouseSystems mode. Both the \fBClearDTR\fP
+and \fBClearRTS\fP options should be used for such mice.
+.TP 8
+.B ZAxisMapping X
+.TP 8
+.B ZAxisMapping Y
+.TP 8
+.B ZAxisMapping \fIN M\fP
+Some mouse devices have a wheel or a roller. Its action is
+reported as the Z (third) axis movement in the X server.
+The Z axis movement can be assigned to another axis (\fIX\fP or \fIY\fP)
+or a pair of buttons (the button \fIN\fP for negative movement
+and \fIM\fP for positive movement) with this option.
+.PP
+The \fBMonitor\fP sections are used to define the specifications
+of a monitor and a list of video modes suitable for use with a
+monitor. More than one \fBMonitor\fP section may be present in an
+XF86Config file. The entries available for this section are:
+.TP 8
+.B Identifier \fI"ID string"\fP
+This specifies a string by which the monitor can be referred to in
+a later \fBScreen\fP section. Each \fBMonitor\fP section should
+have a unique ID string.
+.TP 8
+.B VendorName \fI"vendor"\fP
+This optional entry specifies the monitor's manufacturer.
+.TP 8
+.B ModelName \fI"model"\fP
+This optional entry specifies the monitor's model.
+.TP 8
+.B HorizSync \fIhorizsync-range\fP
+gives the range(s) of horizontal sync frequencies supported by the
+monitor. \fIhorizsync-range\fP may be a comma separated list of
+either discrete values or ranges of values. A range of values is
+two values separated by a dash. By default the values are in units
+of kHz. They may be specified in MHz or Hz if \fBMHz\fP or \fBHz\fP
+is added to the end of the line. The data given here is used by the X
+server to determine if video modes are within the specifications
+of the monitor. This information should be available in the
+monitor's handbook.
+.TP 8
+.B VertRefresh \fIvertrefresh-range\fP
+gives the range(s) of vertical refresh frequencies supported by
+the monitor. \fIvertrefresh-range\fP may be a comma separated list
+of either discrete values or ranges of values. A range of values
+is two values separated by a dash. By default the values are in
+units of Hz. They may be specified in MHz or kHz if \fBMHz\fP or
+\fBkHz\fP is added to the end of the line. The data given here is used
+by the X server to determine if video modes are within the
+specifications of the monitor. This information should be available
+in the monitor's handbook.
+.TP 8
+.B Gamma \fIgamma-value(s)\fP
+This is an optional entry that can be used to specify the gamma
+correction for the monitor. It may be specified as either a single
+value or as three separate RGB values. Not all X servers are capable
+of using this information.
+.TP 8
+.B Mode \fI"name"\fP
+indicates the start of a multi-line video mode description. The
+mode description is terminated with an \fBEndMode\fP line. The
+mode description consists of the following entries:
+.sp
+.RS 8
+.TP 4
+.B DotClock \fIclock\fP
+is the dot clock rate to be used for the mode.
+.TP 4
+.B HTimings \fIhdisp hsyncstart hsyncend htotal\fP
+specifies the horizontal timings for the mode.
+.TP 4
+.B VTimings \fIvdisp vsyncstart vsyncend vtotal\fP
+specifies the vertical timings for the mode.
+.TP 4
+.B Flags \fI"flag" ...\fP
+specifies an optional set of mode flags. \fB"Interlace"\fP indicates
+that the mode is interlaced. \fB"DoubleScan"\fP indicates a mode where
+each scanline is doubled. \fB"+HSync"\fP and \fB"-HSync"\fP can
+be used to select the polarity of the HSync signal. \fB"+VSync"\fP
+and \fB"-VSync"\fP can be used to select the polarity of the VSync
+signal. \fB"Composite"\fP, can be used to specify composite sync on
+hardware where this is supported. Additionally, on some hardware,
+\fB"+CSync"\fP and \fB"-CSync"\fP may be used to select the composite
+sync polarity.
+.TP 4
+.B HSkew \fIhskew\fP
+specifies the number of pixels (towards the right edge of the screen) by which
+the display enable signal is to be skewed. Not all drivers use this
+information. This option might become necessary to override the default
+value supplied by the server (if any). "Roving" horizontal lines indicate this
+value needs to be increased. If the last few pixels on a scan line appear on
+the left of the screen, this value should be decreased.
+.TP 4
+.B VScan \fIvscan\fP
+specifies the number of times each scanline is painted on the screen. Not all
+drivers use this information. Values less than 1 are treated as 1, which is
+the default. Generally, the \fB"DoubleScan"\fP flag mentionned above doubles
+this value.
+.RE
+.TP 8
+.B Modeline \fI"name" mode-description\fP
+is a single line format for specifying video modes. The
+\fImode-description\fP is in four sections, the first three of
+which are mandatory. The first is the pixel clock. This is a
+single number specifying the pixel clock rate for the mode. The
+second section is a list of four numbers specifying the horizontal
+timings. These numbers are the \fIhdisp\fP, \fIhsyncstart\fP,
+\fIhsyncend\fP, \fIhtotal\fP. The third section is a list of four
+numbers specifying the vertical timings. These numbers are
+\fIvdisp\fP, \fIvsyncstart\fP, \fIvsyncend\fP, \fIvtotal\fP. The
+final section is a list of flags specifying other characteristics
+of the mode. \fBInterlace\fP indicates that the mode is interlaced.
+\fBDoubleScan\fP indicates a mode where each scanline is doubled.
+\fB+HSync\fP and \fB\-HSync\fP can be used to select the polarity
+of the HSync signal. \fB+VSync\fP and \fB\-VSync\fP can be used
+to select the polarity of the VSync signal. \fBComposite\fP can be
+used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+\fB+CSync\fP and \fB-CSync\fP may be used to select the composite
+sync polarity. The \fBHSkew\fP and \fBVScan\fP options mentioned above can
+also be used here.
+.PP
+The \fBDevice\fP sections are used to define a graphics device
+(video board). More than one \fBDevice\fP section may be present
+in an XF86Config file. The entries available for this section are:
+.TP 8
+.B Identifier \fI"ID string"\fP
+This specifies a string by which the graphics device can be referred
+to in a later \fBScreen\fP section. Each \fBDevice\fP section
+should have a unique ID string.
+.TP 8
+.B VendorName \fI"vendor"\fP
+This optional entry specifies the graphics device's manufacturer.
+.TP 8
+.B BoardName \fI"model"\fP
+This optional entry specifies the name of the graphics device.
+.TP 8
+.B Chipset \fI"chipset-type"\fP
+This optional entry specifies the chipset used on the graphics
+board. In most cases this entry is not required because the X
+servers will probe the hardware to determine the chipset type.
+.TP 8
+.B Ramdac \fI"ramdac-type"\fP
+This optional entry specifies the type of RAMDAC used on the graphics
+board. This is only used by a few of the X servers, and in most
+cases it is not required because the X servers will probe the
+hardware to determine the RAMDAC type where possible.
+.TP 8
+.B DacSpeed \fIspeed\fP
+This optional entry specifies the RAMDAC speed rating (which is
+usually printed on the RAMDAC chip). The speed is in MHz. This
+is only used by a few of the X servers, and only needs to be
+specified when the speed rating of the RAMDAC is different from
+the default built in to the X server.
+.TP 8
+.B Clocks \fIclock ...\fP
+specifies the dotclocks that are on your graphics board. The clocks
+are in MHz, and may be specified as a floating point number. The
+value is stored internally to the nearest kHz. The ordering of
+the clocks is important. It must match the order in which they
+are selected on the graphics board. Multiple \fBClocks\fP lines
+may be specified. For boards with programmable clock chips, the
+\fBClockChip\fP entry should be used instead of this. A \fBClocks\fP
+entry is not mandatory for boards with non-programmable clock chips,
+but is highly recommended because it prevents the clock probing
+phase during server startup. This clock probing phase can cause
+problems for some monitors.
+.TP 8
+.B ClockChip \fI"clockchip-type"\fP
+This optional entry is used to specify the clock chip type on
+graphics boards which have a programmable clock generator. Only
+a few X servers support programmable clock chips. For details,
+see the appropriate X server manual page.
+.TP 8
+.B ClockProg \fI"command"\fP [\fItextclock\fP]
+This optional entry runs \fIcommand\fP to set the clock on the
+graphics board instead of using the internal code. The command
+string must consist of the full pathname (and no flags). When
+using this option, and no \fBClocks\fP entry is specified,
+it is assumed that the card has a fully programmable clock
+generator; for a card with a set of preset clocks a \fBClocks\fP
+entry is required to specify which clock values are to be made
+available to the server (up to 128 clocks may be specified).
+The optional \fItextclock\fP value is used to tell the server that
+\fIcommand\fP must be run to restore the textmode clock at server
+exit (or when VT switching). \fItextclock\fP must match one of the
+values in the \fBClocks\fP entry. This parameter is required when
+the clock used for text mode is a programmable clock.
+
+The command is run with the real user's id with stdin and stdout
+set to the graphics console device. Two arguments are passed to
+the command. The first is the clock frequency in MHz as a floating
+point number and the second is the index of the clock in the
+\fBClocks\fP entry. The command should return an exit status of
+0 when successful, and something in the range 1\-254 otherwise.
+
+The command is run when the initial graphics mode is set and when
+changing screen resolution with the hot-key sequences. If the
+program fails at initialisation the server exits. If it fails
+during a mode switch, the mode switch is aborted but the server
+keeps running. It is assumed that if the command fails the clock
+has not been changed.
+.TP 8
+.B Option \fI"optionstring"\fP
+This optional entry allows the user to select certain options
+provided by the drivers. Multiple \fBOption\fP entries may be
+given. The supported values for \fIoptionstring\fP are given in
+the appropriate X server manual pages.
+.TP 8
+.B VideoRam \fImem\fP
+This optional entry specifies the amount of videoram that is
+installed on the graphics board. This is measured in kBytes. In
+most cases this is not required because the X server probes the
+graphics board to determine this quantity.
+.TP 8
+.B BIOSBase \fIbaseaddress\fP
+This optional entry specifies the base address of the video BIOS
+for the VGA board. This address is normally 0xC0000, which is the
+default the X servers will use. Some systems, particularly those
+with on-board VGA hardware, have the BIOS located at an alternate
+address, usually 0xE0000. If your video BIOS is at an address
+other than 0xC0000, you must specify the base address in the
+XF86Config file. Note that some X servers don't access the BIOS
+at all, and those which do only use the BIOS when searching for
+information during the hardware probe phase.
+.TP 8
+.B MemBase \fIbaseaddress\fP
+This optional entry specifies the memory base address of a graphics
+board's linear frame buffer. This entry is only used by a few
+X servers, and the interpretation of this base address may be different
+for different X servers. Refer to the appropriate X server manual
+page for details.
+.TP 8
+.B IOBase \fIbaseaddress\fP
+This optional entry specifies the IO base address. This entry is only
+used for a few X servers. Refer to the appropriate X server manual page
+for details.
+.TP 8
+.B DACBase \fIbaseaddress\fP
+This optional entry specifies the DAC base address. This entry is only
+used for a few X servers. Refer to the appropriate X server manual page
+for details.
+.TP 8
+.B POSBase \fIbaseaddress\fP
+This optional entry specifies the POS base address. This entry is only
+used for a few X servers. Refer to the appropriate X server manual page
+for details.
+.TP 8
+.B COPBase \fIbaseaddress\fP
+This optional entry specifies the coprocessor base address. This entry
+is only used for a few X servers. Refer to the appropriate X server
+manual page for details.
+.TP 8
+.B VGABase \fIbaseaddress\fP
+This optional entry specifies the VGA memory base address. This entry
+is only used for a few X servers. Refer to the appropriate X server
+manual page for details.
+.TP 8
+.B Instance \fInumber\fP
+This optional entry specifies the instance (which indicates if the
+chip is integrated on the motherboard or on an expansion card).
+This entry is only used for a few X servers. Refer to the appropriate
+X server manual page for details.
+.TP 8
+.B Speedup \fI"selection"\fP
+This optional entry specifies the selection of speedups to be
+enabled. This entry is only used for a few X servers. Refer to
+the appropriate X server manual page for details.
+.TP 8
+.B S3MNAdjust \fIM N\fP
+This optional entry is specific to the S3 X server. For details, refer
+to the \fIXF86_S3(1)\fP manual page.
+.TP 8
+.B S3MClk \fIclock\fP
+This optional entry is specific to the S3 X server. For details, refer
+to the \fIXF86_S3(1)\fP manual page.
+.TP 8
+.B S3RefClock \fIclock\fP
+This optional entry is specific to the S3 X server. For details, refer
+to the \fIXF86_S3(1)\fP manual page.
+.PP
+The \fBScreen\fP sections are used to specify which graphics boards
+and monitors will be used with a particular X server, and the
+configuration in which they are to be used. The entries available
+for this section are:
+.TP 8
+.B Driver \fI"driver-name"\fP
+Each \fBScreen\fP section must begin with a \fBDriver\fP entry,
+and the \fIdriver-name\fP given in each \fBScreen\fP section must
+be unique. The driver name determines which X server (or driver
+type within an X server when an X server supports more than one
+head) reads and uses a particular \fBScreen\fP section. The driver
+names available are:
+.sp
+.in 20
+.nf
+.B Accel
+.B Mono
+.B SVGA
+.B VGA2
+.B VGA16
+.fi
+.in -20
+.RS 8
+.PP
+\fBAccel\fP is used by all the accelerated X servers (see
+\fIXF86_Accel(1)\fP). \fBMono\fP is used by the non-VGA mono
+drivers in the 2-bit and 4-bit X servers (see \fIXF86_Mono(1)\fP
+and \fIXF86_VGA16(1)\fP). \fBVGA2\fP and \fBVGA16\fP are used by
+the VGA drivers in the 2-bit and 4-bit X servers respectively.
+\fBSVGA\fP is used by the XF86_SVGA X server.
+.RE
+.TP 8
+.B Device \fI"device-id"\fP
+specifies which graphics device description is to be used.
+.TP 8
+.B Monitor \fI"monitor-id"\fP
+specifies which monitor description is to be used.
+.TP 8
+.B DefaultColorDepth \fIbpp-number\fP
+specifies which color depth the server should use, when no -bpp command
+line parameter was given.
+.TP 8
+.B ScreenNo \fIscrnum\fP
+This optional entry overrides the default screen numbering in a
+multi-headed configuration. The default numbering is determined by
+the ordering of the \fBScreen\fP sections in the \fIXF86Config\fP
+file. To override this, all relevant \fBScreen\fP sections must have
+this entry specified.
+.TP 8
+.B BlankTime \fItime\fP
+sets the inactivity timeout for the blanking phase of the screensaver.
+\fItime\fP is in minutes, and the default is 10.
+This is equivalent to the Xserver's `-s' flag, and the value can be
+changed at run-time with \fIxset(1)\fP.
+.TP 8
+.B StandbyTime \fItime\fP
+sets the inactivity timeout for the ``standby'' phase of DPMS mode.
+\fItime\fP is in minutes, the default is 20, and it can be changed
+at run-time with \fIxset(1)\fP.
+This is only suitable for VESA DPMS compatible monitors, and is only
+supported currently by some Xservers. The "power_saver"
+Option must be set for this to be enabled.
+.TP 8
+.B SuspendTime \fItime\fP
+sets the inactivity timeout for the ``suspend'' phase of DPMS mode.
+\fItime\fP is in minutes, the default is 30, and it can be changed
+at run-time with \fIxset(1)\fP.
+This is only suitable for VESA DPMS compatible monitors, and is only
+supported currently by some Xservers. The "power_saver"
+Option must be set for this to be enabled.
+.TP 8
+.B OffTime \fItime\fP
+sets the inactivity timeout for the ``off'' phase of DPMS mode.
+\fItime\fP is in minutes, the default is 40, and it can be changed
+at run-time with \fIxset(1)\fP.
+This is only suitable for VESA DPMS compatible monitors, and is only
+supported currently by some Xservers. The "power_saver"
+Option must be set for this to be enabled.
+.TP
+.B SubSection \fB"Display"\fP
+This entry is a subsection which is used to specify some display
+specific parameters. This subsection is terminated by an
+\fBEndSubSection\fP entry. For some X servers and drivers (those
+requiring a list of video modes) this subsection is mandatory.
+For X servers which support multiple display depths, more than one
+\fBDisplay\fP subsection may be present. When multiple \fBDisplay\fP
+subsections are present, each must have a unique \fBDepth\fP entry.
+The entries available for the \fBDisplay\fP subsection are:
+.RS 8
+.TP 4
+.B Depth \fIbpp\fP
+This entry is mandatory when more than one \fBDisplay\fP subsection
+is present in a \fBScreen\fP section. When only one \fBDisplay\fP
+subsection is present, it specifies the default depth that the X
+server will run at. When more than one \fBDisplay\fP subsection
+is present, the depth determines which gets used by the X server.
+The subsection used is the one matching the depth at which the X
+server is run at. Not all X servers (or drivers) support more than
+one depth. Permitted values for \fIbpp\fP are 8, 15, 16, 24 and 32.
+Not all X servers (or drivers) support all of these values.
+\fIbpp\fP values of 24 and 32 are treated equivalently by those X
+servers which support them.
+.TP 4
+.B Weight \fIRGB\fP
+This optional entry specifies the relative RGB weighting to be used
+for an X server running at 16bpp. This may also be specified from
+the command line (see \fIXFree86(1)\fP). Values supported by most
+16bpp X servers are \fB555\fP and \fB565\fP. For further details,
+refer to the appropriate X server manual page.
+.TP 4
+.B Virtual \fIxdim ydim\fP
+This optional entry specifies the virtual screen resolution to be
+used. \fIxdim\fP must be a multiple of either 8 or 16 for most
+colour X servers, and a multiple of 32 for the monochrome X server.
+The given value will be rounded down if this is not the case. For
+most X servers, video modes which are too large for the specified
+virtual size will be rejected. If this entry is not present, the
+virtual screen resolution will be set to accommodate all the valid
+video modes given in the \fBModes\fP entry. Some X servers do not
+support this entry. Refer to the appropriate X server manual pages
+for details.
+.TP 4
+.B ViewPort \fIx0 y0\fP
+This optional entry sets the upper left corner of the initial
+display. This is only relevant when the virtual screen resolution
+is different from the resolution of the initial video mode. If
+this entry is not given, then the initial display will be centered
+in the virtual display area.
+.TP 4
+.B Modes \fI"modename" ...\fP
+This entry is mandatory for most X servers, and it specifies the
+list of video modes to use. The video mode names must correspond
+to those specified in the appropriate \fBMonitor\fP section. Most
+X servers will delete modes from this list which don't satisfy
+various requirements. The first valid mode in this list will be
+the default display mode for startup. The list of valid modes is
+converted internally into a circular list. It is possible to switch
+to the next mode with \fBCtrl+Alt+Keypad-Plus\fP and to the previous
+mode with \fBCtrl+Alt+Keypad-Minus\fP.
+.TP 4
+.B InvertVCLK \fI"modename"\fP \fR0|1\fP
+This optional entry is specific to the S3 server only. It may be used
+to change the default VCLK invert/non-invert state for individual modes.
+If \fI"modename"\fP is "\(**" the setting applies to all modes unless
+unless overridden by later entries.
+.TP 4
+.B EarlySC \fI"modename"\fP \fR0|1\fP
+This optional entry is specific to the S3 server only. It may be used
+to change the default EarlySC setting for individual modes. This
+setting can affect screen wrapping.
+If \fI"modename"\fP is "\(**" the setting applies to all modes unless
+unless overridden by later entries.
+.TP 4
+.B BlankDelay \fI"modename" value1 value2\fP
+This optional entry is specific to the S3 server only. It may be used
+to change the default blank delay settings for individual modes. This
+can affect screen wrapping. \fIvalue1\fP and \fIvalue2\fP must be
+integers in the range 0\-7.
+If \fI"modename"\fP is "\(**" the setting applies to all modes unless
+unless overridden by later entries.
+.TP 4
+.B Visual \fI"visual-name"\fP
+This optional entry sets the default root visual type. This may
+also be specified from the command line (see \fIXserver(1)\fP).
+The visual types available for 8bpp X servers are (default is
+\fBPseudoColor\fP):
+.RE
+.sp
+.in 20
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.B TrueColor
+.B DirectColor
+.fi
+.in -20
+.RS 12
+.PP
+The visual type available for the 16bpp and 32bpp X servers is
+\fBTrueColor\fP.
+.PP
+The visual type available for the 1bpp X server is \fBStaticGray\fP.
+.PP
+The visual types available for the 4bpp X server are (default is
+\fBStaticColor\fP):
+.RE
+.sp
+.in 20
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.fi
+.in -20
+.RS 8
+.TP 4
+.B Option \fI"optionstring"\fP
+This optional entry allows the user to select certain options
+provided by the drivers. Multiple \fBOption\fP entries may be
+given. The supported values for \fIoptionstring\fP are given in
+the appropriate X server manual pages.
+.TP 4
+.B Black \fIred green blue\fP
+This optional entry allows the ``black'' colour to be specified. This
+is only supported with the VGA2 driver in the XF86_Mono server (for
+details see \fIXF86_Mono(1)\fP).
+.TP 4
+.B White \fIred green blue\fP
+This optional entry allows the ``white'' colour to be specified. This
+is only supported with the VGA2 driver in the XF86_Mono server (for
+details see \fIXF86_Mono(1)\fP).
+.RE
+.PP
+The optional \fBXInput\fP section is used to specify configuration options
+for the extended input devices. For some OSs, the extended device support is
+dynamically loaded, and in this case you need to specify which Modules to
+load in the \fBModule\fP section (this is documented above).
+Each extended device has its own
+subsection. To enable an extended device the corresponding subsection
+must appear. The subsections names are:
+.sp
+.in 8
+.nf
+\fBJoystick\fP (only on supported systems ie. Linux, FreeBSD and NetBSD)
+\fBWacomStylus\fP (stylus of a Wacom tablet)
+\fBWacomEraser\fP (eraser of a Wacom tablet)
+\fBWacomCursor\fP (cursor of a Wacom tablet)
+\fBElographics\fP (Elographics touchscreen)
+\fBSummaSketch\fP (SummaSketch tablet)
+\fBMouse\fP (Mouse)
+.fi
+.TP
+The \fBJoystick\fP subsection supports the following entries:
+.RS 8
+.TP 4
+.B Port \fI"path"\fP
+sets the path to the special file which represents the device driver.
+.TP 4
+.B DeviceName \fI"name"\fP
+sets the name of the X device.
+.TP 4
+.B TimeOut \fItimeout\fP
+sets the time (in milliseconds) between two polls of the device driver.
+The value given here may be overriden by the Operating System's joystick
+driver.
+.TP 4
+.B MaximumXPosition \fIvalue\fP
+sets the maximum X value reported by the device driver.
+.TP 4
+.B MinimumXPosition \fIvalue\fP
+sets the minimum X value reported by the device driver.
+.TP 4
+.B MaximumYPosition \fIvalue\fP
+sets the maximum Y value reported by the device driver.
+.TP 4
+.B MinimumYPosition \fIvalue\fP
+sets the minimum Y value reported by the device driver.
+.TP 4
+.B CenterX \fIvalue\fP
+sets the X center reported by the device driver when the joystick
+is idle. If this value is omitted, it is assumed that the joystick
+is centered when it is first enabled.
+.TP 4
+.B CenterY \fIvalue\fP
+sets the Y center reported by the device driver when the joystick
+is idle. If this value is omitted, it is assumed that the joystick
+is centered when it is first enabled.
+.TP 4
+.B Delta \fIvalue\fP
+sets the maximum value reported to the X server. i.e. coordinates will
+be incremented of \fI(+/\-)value/2\fP at maximum deflection. This determines
+the sensitivity.
+.TP 4
+.B AlwaysCore
+enables the sharing of the core pointer. When this feature is enabled you
+cannot put the device in extended mode (i.e. sending extended events). You
+can also use the latest integer feedback to control this feature. When the
+value of the feedback is zero, the feature is disabled. The feature
+is enabled for any other value.
+.RE
+.TP
+Multiple instances of the Wacom devices can cohabit. It can be useful
+to define multiple devices with different active zones. The
+\fBWacomStylus\fP, \fBWacomEraser\fP and \fBWacomCursor\fP subsections
+support the following entries:
+.RS 8
+.TP 4
+.B Port \fI"path"\fP
+sets the path to the special file which represents serial line where
+the tablet is plugged. You have to specify it for each subsection with
+the same value if you want to have multiple devices with the same tablet.
+.TP 4
+.B DeviceName \fI"name"\fP
+sets the name of the X device.
+.TP 4
+.B Suppress \fInumber\fP
+sets the position increment under which not to transmit coordinates.
+This entry must be specified only in the first Wacom subsection if you have
+multiple devices for one tablet.
+.TP 4
+.B Mode \fIRelative|Absolute\fP
+sets the mode of the device.
+.TP 4
+.B TiltMode
+enables tilt report if your tablet supports it (ROM version 1.4 and above).
+If this is enabled, multiple devices at the same time will not be reported.
+.TP 4
+.B HistorySize \fInumber\fP
+sets the motion history size. By default the value is zero.
+.TP 4
+.B AlwaysCore
+enables the sharing of the core pointer. When this feature is enabled you
+cannot put the device in extended mode (i.e. sending extended events). You
+can also use the latest integer feedback to control this feature. When the
+value of the feedback is zero, the feature is disabled. The feature
+is enabled for any other value.
+.TP 4
+.B TopX \fInumber\fP
+X coordinate of the top corner of the active zone.
+.TP 4
+.B TopY \fInumber\fP
+Y coordinate of the top corner of the active zone.
+.TP 4
+.B BottomX \fInumber\fP
+X coordinate of the bottom corner of the active zone.
+.TP 4
+.B BottomY \fInumber\fP
+Y coordinate of the bottom corner of the active zone.
+.TP 4
+.B KeepShape
+When this option is enabled, the active zone begins according to TopX
+and TopY. The bottom corner is calculated to keep shapes ie. the
+ratio width/heigth of the active zone is calculated to have the same
+ratio as the one of the screen.
+.RE
+.TP
+The \fBElographics\fP subsection support the following entries:
+.RS 8
+.TP 4
+.B Port \fI"path"\fP
+sets the path to the special file which represents the device driver.
+.TP 4
+.B DeviceName \fI"name"\fP
+sets the name of the X device.
+.TP 4
+.B MaximumXPosition \fIposition\fP
+sets the maximum X position reported by the touchscreen.
+.TP 4
+.B MinimumXPosition \fIposition\fP
+sets the minimum X position reported by the touchscreen.
+.TP 4
+.B MaximumYPosition \fIposition\fP
+sets the maximum Y position reported by the touchscreen.
+.TP 4
+.B MinimumYPosition \fIposition\fP
+sets the minimum Y position reported by the touchscreen.
+.TP 4
+.B ScreenNo \fInumber\fP
+sets the screen number where the touchscreen is connected.
+.TP 4
+.B UntouchDelay \fIvalue\fP
+sets the delay (in tens of milliseconds) after which the device
+considers that an untouch occurs.
+.TP 4
+.B ReportDelay \fIvalue\fP
+sets the delay (in ten of milliseconds) between two reports
+of positions.
+.TP 4
+.B AlwaysCore
+enables the sharing of the core pointer. When this feature is enabled you
+cannot put the device in extended mode (i.e. sending extended events). You
+can also use the latest integer feedback to control this feature. When the
+value of the feedback is zero, the feature is disabled. The feature
+is enabled for any other value.
+.RE
+.TP
+The \fBSummaSketch\fP subsection support the following entries:
+.RS 8
+.TP 4
+.B Port \fI"path"\fP
+sets the path to the special file which represents the device driver.
+.TP 4
+.B DeviceName \fI"name"\fP
+sets the name of the X device.
+.TP 4
+.B Mode \fIRelative|Absolute\fP
+sets the mode of the device.
+.TP 4
+.B Cursor \fIStylus|Puck\fP
+sets the cursor type, stylus or 4 button puck.
+.TP 4
+.B Increment \fIvalue\fP
+sets the maximum change in coordinates before new report.
+.TP 4
+.B ActiveArea \fIXValue YValue\fP
+sets the size of the active area on the tablet, in 10ths of an inch.
+.TP 4
+.B ActiveOffset \fIXValue YValue\fP
+sets the upper left of the active area on the tablet, in 10ths of an inch.
+If no value is specefied, it will center the active area.
+.TP 4
+.B HistorySize \fInumber\fP
+sets the motion history size. By default the value is zero.
+.TP 4
+.B AlwaysCore
+enables the sharing of the core pointer. When this feature is enabled you
+cannot put the device in extended mode (i.e. sending extended events). You
+can also use the latest integer feedback to control this feature. When the
+value of the feedback is zero, the feature is disabled. The feature
+is enabled for any other value.
+.RE
+.TP
+The \fBMouse\fP subsection support the same entries as the
+standard \fBPointer\fP section, plus the following:
+.RS 8
+.TP 4
+.B DeviceName \fI"name"\fP
+sets the name of the X device.
+.TP 4
+.B AlwaysCore
+enables the sharing of the core pointer. When this feature is enabled you
+cannot put the device in extended mode (i.e. sending extended events). You
+can also use the latest integer feedback to control this feature. When the
+value of the feedback is zero, the feature is disabled. The feature
+is enabled for any other value.
+.RE
+.PP
+For an example of an XF86Config file, see the file installed as
+<XRoot>/lib/X11/XF86Config.eg.
+.SH FILES
+.PP
+.nf
+/etc/XF86Config
+<XRoot>/lib/X11/XF86Config.\fIhostname\fP
+<XRoot>/lib/X11/XF86Config
+.sp 1
+Note: <XRoot> refers to the root of the X11 install tree.
+.fi
+.SH "SEE ALSO"
+X(1), Xserver(1), XFree86(1), XF86_SVGA(1), XF86_VGA16(1),
+XF86_Mono(1), XF86_S3(1), XF86_8514(1), XF86_Mach8(1), XF86_Mach32(1),
+XF86_P9000(1), XF86_AGX(1).
+.SH AUTHORS
+.PP
+Refer to the
+.I XFree86(1)
+manual page.
+.\" $TOG: XF86Conf.man /main/28 1997/07/19 09:22:00 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/CHANGELOG b/xc/programs/Xserver/hw/xfree86/XF86Setup/CHANGELOG
new file mode 100644
index 000000000..86a12b9a4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/CHANGELOG
@@ -0,0 +1,452 @@
+
+0.1 14 Dec 1995 Proof of concept test version - just to
+ demonstrate how Tcl/Tk could be used without
+ a dependance on wish being installed and
+ how custom commands could be added for
+ communication with the server extensions
+
+0.2 8 Feb 1996 First serious development version.
+ Basic structure is complete as well as part of
+ mouse configuration.
+ Includes commands for connecting with both
+ the XFree86-Misc and VidMode extensions.
+ Uses Tcl 7.4p3 and Tk 4.0p3 and uses the VGA16
+ server for initial graphics mode.
+
+0.3 3 Mar 1996 Mouse configuration updated to match latest
+ XFree86-Misc version (including ReOpen flag).
+ A few key bindings in Mouse configuration.
+ Some experimental Card configuration code.
+ Phase I now checks for Xqueue driver and asks
+ user if they want to use it.
+ Asks for name of symlink (e.g. /dev/mouse) to
+ real mouse device.
+ All XF86Config files include "XkbDisable"
+ Adds support of GlidePoint mouse protocol.
+ Frees memory allocated by VidMode library calls.
+ Added do/while loop command
+
+0.4 12 Mar 1996 Mouse configuration completed (includes adding
+ more keybindings, completing help text, and
+ finishing device symlink code).
+ Added comment to Imakefile about changing tcl
+ and tk library names to match those on the
+ system where it is being built
+ Added sleep, has_symlinks, link, and unlink
+ builtins
+ Removed some debugging code that was accidentally
+ left in 0.3
+ Move the execution of the Phase I code to
+ after the processing of the command line
+ arguments
+ Corrected all incorrect references to ClearCTS
+ to be ClearRTS
+ Reset button up/down indicators when switching
+ to Mouse configuration
+ Display message "Applying changes..." while
+ waiting for call to XF86MiscSetMouseSettings
+ to complete
+ Set default mouse device name values depending
+ on selected protocol
+ Add check for OsMouse driver on SCO (and ask
+ user if it should be used)
+ Use new allowMouseOpenFail server option
+ Rewrite xf86cards_getentry and xf86vid_getmonitor
+ to be simpler and fix memory allocation probs.
+ Catch protocol errors when calling any of:
+ XF86MiscSetSaver, XF86VidModeLockModeSwitch,
+ XF86MiscSetKbdSettings, XF86VidModeSwitchMode,
+ XF86MiscSetMouseSettings
+
+0.5 23 Mar 1996 Added combobox widget
+ Card configuration added
+ Changed names of global variables to use a
+ (at least semi-)consistent coding standard
+ Change cursor to a watch while waiting for call
+ to XF86MiscSetMouseSettings to complete
+ Monitor configuration added
+ Added ability to display server specific
+ README files during Card configuration
+ Added option to the "message" procedure to
+ just display the message without waiting
+ for a key press.
+ Added the XFree86 logo to the intro screen
+ Improved the introductory text
+
+0.6 3 Jun 1996 Added ability to read in XF86Config file
+ Added binding to findConfigFile to return the
+ name of the config file that the server will use
+ Use $TMPDIR, $XWINHOME, and $XF86SETUPLIB, if set
+ Moved check for the Xwinhome directory from the
+ phase1.tcl file to the beginning of the main.c
+ file to better check for proper installation
+ of files
+ Added check for the existence of needed files
+ If the VGA16 server fails to start, try again
+ with chipset "generic"
+ Improved XF86Config generation
+ Listboxes no longer export the selection,
+ enabling the selection to remain set even
+ after a selection is made in another listbox
+ Support for multiple cards added
+ Support for multiple monitors added
+ Warn of missing README files
+ Added interface to XKBui library
+ Added some commands for communicating with
+ the XKB extension
+ Removed "Other" button and added "Keyboard"
+ Added checkbuttons for server flags
+ Added widgets for changing options, vram size,
+ and max ramdac speed, if defaults read from
+ XF86Config file
+ Final XF86Config is now copied into place
+ (after moving the original to XF86Config.bak)
+ Moved the standard modelines and sync ranges
+ into a separate file (mondata.tcl)
+
+0.7 22 Jun 1996 Added more XKB interface functions
+ Chosen geometry and symbol sets are now loaded
+ into the server
+ Prepared for integration into XFree86 tree
+
+0.8 30 Jun 1996 Various Imakefile changes (David Dawes)
+(3.1.2Eb) Fix a few problems with mouse configuration
+ in the generated XF86Config file (e.g. don't
+ output a "SampleRate" line when not applicable
+ to the selected protocol)
+ When checking for a running server, don't close
+ the opened connection, thus preventing the
+ ugly server reset (David Dawes)
+ Fix mouse bindings in keyboard configuration
+ listboxes that weren't properly loading
+ the geometry and symbols
+ Modify the tkerror procedure to write a copy
+ of the stack trace to a file and tell the
+ user to submit a bug report
+
+0.9 7 Jul 1996 Change all "gets response" lines to "gets stdin
+(3.1.2Ec) response" (Michael Rohleder)
+ Add a few prototypes and casts and some other
+ code cleanups
+ Add code in several places in tclxfconf.c
+ to prevent derefencing of NULL pointers
+ Plug some memory leaks
+ Don't output "SampleRate", if zero
+
+0.10 13 Jul 1996 Fix two more places where a NULL pointer could
+ be dereferenced (David Dawes)
+ Fix inconsistencies in handling of Display
+ subsections between C and Tcl code
+ Write out Display subsections for depths > 8
+ Fix memory leak in XKB handling
+ Remove the parray proc from phase1.tcl (it was
+ used by some debugging code in an earlier
+ version and was accidentally left in when
+ that code was removed)
+ Check the found dialog executable to determine
+ if it's really the one that is wanted
+ Improved(?) handling of Modes and ModeLine
+ entries in generated XF86Config file
+ When writing the XF86Config file, the Visual
+ wasn't properly quoted
+ Decrease the wait between checks for the server
+ being ready to accept connections - for:
+ Put up a "Loading..." window asap after starting
+ the VGA16 server
+ Adjust size of widget borders and highlight
+ thicknesses in card.tcl to make things fit
+ better
+ Adjust border widths in keyboard.tcl and
+ monitor.tcl to be consistent w/ card.tcl
+ Start the VGA16 server with a larger stack size
+ limit (Matthieu Herrb reported overflows on
+ NetBSD)
+ Modify keyboard configuration code to use XKB
+ "rules" facilities
+ Catch attempt to backup existing config file
+ and display message indicating the backup
+ occurred only if successful (Michael Rohleder)
+ Make symlink from preferred server to 'X'
+ (based on patch by Michael Rohleder)
+
+0.11 20 Jul 1996 Fix bugs in "process_running" (Harald Koenig)
+ Fix ChipSet, RamDac, and ClockChip setting
+ for S3 server (Harald Koenig)
+ Modify main.c to enable shutdown of VGA16
+ server before starting second server (there
+ are now five phases)
+ Added ability to specify on the command line
+ a script to be run
+ Added handling of standard wish arguments to
+ main.c (some are ignored unless a script is
+ specified)
+ Updated tclkbd.c and keyboard.tcl to match
+ latest XKB patches
+ Added separate mouse configuration program
+ Moved non-XF86Setup specific functions to
+ from setuplib.tcl to tcllib/misc.tcl
+ Moved some code that is used in more than one
+ phase to setuplib.tcl
+ If startup of second server fails, it is now
+ caught and the user is returned to phase2
+ Moved the server flags to a separate "Other"
+ configuration screen
+ Improved "done" stuff
+ Make it compile with newer Tcl/Tk releases
+
+0.12 2 Aug 1996 Updated Imakefile
+(3.1.2Ef) Full support for Tcl 7.5/Tk 4.1 added
+ More XKB updates (_XKB_RULES_NAMES property
+ support)
+ XKB functions no longer use a single static
+ xkb structure and now return a handle to the
+ allocated structure
+ Interface to xkbui library is now a full-
+ fledged Tk widget
+ Add function to write out all significant
+ variables to a state file
+ Add option to read in a state file
+ After shutting down a server, exec a new copy
+ of XF86Setup -- workaround Tk caching some
+ info about the server, which is no longer
+ true, because we start/stop servers behind
+ its back
+ Only put 640x480 modelines in the config file
+ used to start the VGA16 server
+ Renamed "message" to "mesg" to avoid conflict
+ with the Tk message widget
+ Handle XKB rules Options - add scrollbar, if
+ there are too many options to fit
+ Change writeXF86Config to take a filename,
+ instead of a file handle
+ In card configuration, update the message at
+ the bottom after clock probing is completed
+ Add -nodialog option to force plain text
+ output
+ Add some more comments to the C code
+ Add "flush stdout" statements to flush the
+ (Tcl 7.5) channel buffers
+
+0.13 15 Aug 1996 Process window path names to use as prefix
+(3.1.2Eh) to other window paths
+ Add man pages for XF86Setup and xmseconfig
+ Imakefile updates (David Dawes)
+ Change exec of second XF86Setup to use execlp
+ instead of execl (David Dawes)
+ Modified config file reading routines to keep
+ all existing monitor and devices - this also
+ eliminated a bug in handling multiple
+ monitors/devices
+ Fixed typo in monitor sync rates (Harald Koenig)
+ Changed autorepeat timings for the scrollbar
+ associated with the card list - scrolling
+ takes too long with the VGA16 server
+
+0.14 16 Aug 1996 Added -notk option (when a script is specified)
+ When writing config file for VGA16 server,
+ don't write a Virtual size
+ Use -vgamode option when writing config file
+ used to start VGA16 server with
+ Chipset "generic"
+ Added "lrmdups" proc to eliminate duplicate
+ elements from a list
+ Fleshed out Chipset, RamDac, ClockChip, and
+ Options info in carddata.tcl
+ Output error message if exec-ing second copy
+ fails
+ Fixed bug w/ keyboard focus during monitor
+ configuration
+ Monitor sync range canvases now handle ranges
+ that exceed their limits
+ Fix bug in Card_clockprobe - cardDetail wasn't
+ declared global
+ The card list can now be accessed even when
+ the existing config file is read
+ Output "Aborted" message when abort is pressed
+
+0.15 17 Aug 1996 Added -script option to look for a file in
+(3.1.2Ei) the scripts directory, otherwise the PATH
+ is searched
+ Fix typo in Mach64 RamDacs (David Dawes)
+ Fix typo in writing Virtual size (Harald Koenig)
+ Workaround bug in Tk 4.0 canvases that left
+ stray red lines in the monitor sync range
+ bars in certain cases
+ Use new -bestRefresh server option (David Dawes)
+ Add message line to keyboard config for
+ "Please wait..." type messages
+ Changed mouse device entry to a combobox w/
+ list of devices from the /dev directory
+ Use list of devices to pick a default mouse
+ device
+
+0.16 19 Aug 1996 Improve patterns used to find available mouse
+ devices (David Dawes)
+ Sorted lists that are going to displayed in a
+ listbox
+ Fixed bug with mouse link not being read for
+ the real device when reading the exiting
+ config file
+ Real mouse device is converted to a full path
+ if the symlink was relative
+ Fixed bug where device wasn't reopened when a
+ new device name was specified
+ When reading the X link to find out what server
+ to use, strip off any directory name
+ Stack size limit is now changed in main.c on
+ OSes that support it
+ Write a 24bpp screen section to config file
+ Remove temp files when exiting normally
+ Check that the mouse link is in a directory
+ not writeable by non-root users
+ Update selection in listboxes when the value
+ of the entry changes
+ Change the mouse device combobox to a listbox
+ that is always showing - this is due to
+ problems with keybindings in comboboxes
+ (which are very important since the mouse
+ is probably not yet working when this list
+ is used)
+
+0.17 23 Aug 1996 Add new C&T README to list and use the
+(3.1.2Em) Oak, WstDig, ati, etc. READMEs for the
+ Mono & VGA16 servers, as well as SVGA
+ Add ProjectRoot to the list of search directories
+ Start the VGA16 server just w/ Chipset "generic"
+ Add tcl commands for changing the umask and
+ for adding and removing directories
+ Add random function
+ Add "clock clicks" and "clock seconds" commands
+ to Tcl 7.4 interpreters
+ Move all temp files to a randomly named subdir
+ of a .XF86Setup* subdir
+ Place the mouse link with the rest of the
+ temp files and then write the actual mouse
+ device to the config file
+ Check the permissions of the temp subdirs
+ before any write to a file
+ When writing the config file, use the link
+ for the mouse device, except for the final
+ config file to which the actual device is
+ written (unless there was an existing
+ /dev/mouse link which already pointed to
+ the correct device - in that case write
+ /dev/mouse as the device name)
+ If the dacspeed "Probed" button is depressed,
+ and the user clicks on the slider, switch to
+ using the slider value
+ Add a pretty border to the popup help windows
+ Destroy existing help popups if the user
+ clicks on help, while one is already up
+ Don't show the mouse device entry box or
+ device list, if the user won't be able to
+ make any changes
+ Print messages to the text screen while in
+ graphics mode directing them to switch
+ to the correct VT
+ Let the user choose where to write the
+ config file (with the existing location,
+ as the default)
+ Reset list of clocks when a clock chip or a
+ different card or server is selected
+ Reset mouse button canvas when a new protocol
+ is selected
+ Change welcome screen to state that the
+ underlined letters indicate Ctrl or Alt
+ bindings
+ Add copyright and disclaimer notices
+ Add function to search along an axis for a
+ focus window
+ Add keybindings for the arrow keys
+
+0.18 25 Aug 1996 Added online help text
+(3.1.2Eo) Some fixes for mouse device name handling
+ (David Dawes)
+ Add border to and fix the autorepeat timings for
+ the readme display box (David Dawes)
+ Improvements to mouse device name patterns
+ and searching (David Dawes)
+ Change default XF86Config file location to
+ /etc (David Dawes)
+ Fixed typo that caused the rmdir command to
+ call the MkDir function (David Dawes)
+ Fixed bug where prompt for config file name
+ wasn't being removed after saving to the
+ file
+ Changed "Applying" message in mouse setup to
+ use the same line as the "Press ? or Alt..."
+ message
+ Fixed mouse device name handling (completely?)
+ Removed clock probing from card.tcl and
+ now read clocks from startup messages of
+ the second server.
+ Added binding to <Return> in listboxes and
+ improve behavior of arrow keys within
+ listboxes
+ Set the BoardName to the name selected in the
+ Card list.
+ Fixed bug where the additional device lines
+ were appended to instead of replaced when
+ a new card was picked from the list
+
+1.00 26 Aug 1996 Updated XF86Setup & xmseconfig man pages
+(3.1.2F) Fixed some security problems with mouse
+ device name handling
+ Fixed bug with device name handling for
+ Xqueue and OsMouse drivers
+ Updated xmseconfig to work with new mouse
+ device name changes
+
+1.01 30 Aug 1996 Fixed bug in setting default PS/2 device name
+ (Thomas Mueller)
+ Fixed bug in changing stack limit (the
+ sys/resource.h file wasn't being included)
+ Existing link to mouse device is read even if
+ not reading existing config file
+ Recursively read the X symlink
+ Prevent ServerNumLock from being selected
+ when writing a config file that uses XKB
+ Fixed dialog core dump due to too long of
+ line length in VGA16 server not found mesg
+ Set keyboard focus to "Okay" button when
+ user selects "Done"
+ Add xf86OsMouseOption() stub function to
+ tclxfconf.c (J. Kean Johnston)
+ Add gpmdata to list of mouse device patterns
+ Improved code that creates symlink to X server
+
+1.02 2 Sep 1996 Check for existence of chosen server
+(3.1.2G) Remove some remaining probe code
+ Fix bug with writing device name to config
+ file when using Xqueue or OsMouse drivers
+ Add support for Alliance ProMotion driver
+ Add some partial support for the new
+ DefaultColorDepth option
+
+1.03 27 Sep 1996 Update mouse device patterns (Thomas Mueller)
+ Added chipset "newmmio" and clockchip "cirrus"
+ to carddata.tcl
+ Link w/ -ldl on appropriate OSes (James Hawtin,
+ Harald Koenig)
+ - needed when Tcl 7.5 or later is
+ configured to support dynamic loading
+ Restructured lists in carddata.tcl in prepa-
+ ration for restricting listboxes and the
+ README display to only the values appropriate
+ for the specified chipset
+ Added support for configuring "unsupported"
+ cards
+ Fixed messages about the chosen server not
+ being installed (they had an extra newline
+ embedded within them)
+ Added README.Mach32 to list
+ Added support for ViRGE and DECtga servers and
+ the Matrox SVGA driver
+ Add copyright and disclaimer to generated
+ config file
+ Make help and README displays readonly
+ When the mouse screen is first selected, the
+ help text pops up automagically
+ Changes to the mouse protocol cause an autoapply
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile b/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile
new file mode 100644
index 000000000..2725ae1e2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile
@@ -0,0 +1,172 @@
+XCOMM $XConsortium: Imakefile /main/4 1996/10/24 10:16:33 kaleb $
+
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/Imakefile,v 3.30 1999/07/12 08:14:25 dawes Exp $
+#include <Server.tmpl>
+#define IHaveSubdirs
+
+#if !BuildXKBlib || !BuildXF86MiscLibrary || !BuildXF86VidModeLibrary
+all::
+ @echo This program requires that you build with XKB, XF86Misc, and XF86VidMode
+ @exit 1
+
+depend::
+ @echo This program requires that you build with XKB, XF86Misc, and XF86VidMode
+ @exit 1
+
+includes::
+ @echo This program requires that you build with XKB, XF86Misc, and XF86VidMode
+ @exit 1
+
+#else
+#if !HasSnprintf
+ MISCSRCS = snprintf.c
+ MISCOBJS = snprintf.o
+ MISC_DEFINES = -DNEED_SNPRINTF
+#endif
+ SRCS = main.c tclmisc.c tclvidmode.c tclcards.c tclother.c \
+ tclkbd.c tclxfconf.c confread.c confwrite.c \
+ cards.c tclxkbui.c tkother.c tclcurses.c $(MISCSRCS)
+ OBJS = main.o tclmisc.o tclvidmode.o tclcards.o tclother.o \
+ tclkbd.o tclxfconf.o confread.o confwrite.o \
+ cards.o tclxkbui.o tkother.o tclcurses.o $(MISCOBJS)
+ TCL_FILES = phase1.tcl phase2.tcl phase3.tcl phase4.tcl phase5.tcl \
+ setuplib.tcl srvflags.tcl carddata.tcl \
+ card.tcl done.tcl filelist.tcl keyboard.tcl \
+ mseproto.tcl ph2notk.tcl kbddata.tcl vidmode.tcl \
+ mondata.tcl monitor.tcl modeselect.tcl mouse.tcl LICENSE
+ TCLLIB_FILES = tcllib/button.tcl tcllib/combobox.tcl tcllib/misc.tcl \
+ tcllib/downarrow.xbm tcllib/dialog.tcl tcllib/entry.tcl \
+ tcllib/focus.tcl tcllib/init.tcl tcllib/listbox.tcl \
+ tcllib/menu.tcl tcllib/optionMenu.tcl tcllib/palette.tcl \
+ tcllib/scale.tcl tcllib/scrollbar.tcl tcllib/tclIndex \
+ tcllib/tearoff.tcl tcllib/text.tcl tcllib/tk.tcl \
+ tcllib/tkerror.tcl tcllib/uparrow.xbm tcllib/license.terms
+ PICS_FILES = pics/vidcard.xbm pics/vidcard.msk \
+ pics/XFree86.xbm pics/XFree86.msk
+ SUBDIRS = scripts texts
+
+#if BuildServersOnly && !defined(UseInstalled)
+/* Use installed X libraries and headers */
+ USEINSTALLEDLIB = -L$(USRLIBDIR)
+ USEBUILTLIB = -L$(BUILDLIBDIR)
+ USEINSTALLEDINC = -I$(INCROOT)
+ LDPRELIB =
+#undef XawClientDepLibs
+#define XawClientDepLibs /**/
+#endif
+
+ MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\"
+
+#ifdef DefaultFontPath
+DEFAULTFONTPATH = DefaultFontPath
+SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\"
+#endif
+
+#ifdef DefaultRGBDatabase
+DEFAULTRGBDATABASE = DefaultRGBDatabase
+SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\"
+#endif
+
+#if defined(SVR4Architecture) || (defined(LinuxArchitecture) && UseElfFormat)
+/* Some OSs need this, and it should(?) be harmless when not needed */
+/* Not available for Linux x86/a.out and Linux AXP/ECOFF */
+ EXTRASYSLIBS = -ldl
+#endif
+
+#if XF86SetupUsesStaticTk
+ TKLIBRARY = StaticLibrary($(TKLIBDIR),$(TKLIBNAME))
+#endif
+#if XF86SetupUsesStaticTcl
+ TCLLIBRARY = StaticLibrary($(TCLLIBDIR),$(TCLLIBNAME))
+#endif
+
+ TCLTK_LIBRARIES = $(TKLIBRARY) $(TCLLIBRARY)
+
+ XF86CONFLIB = $(XF86SRC)/parser/LibraryTargetName(xf86config)
+
+/*
+ * HasNCurses should be set to YES in the os.cf file if the include file
+ * is called ncurses.h instead of curses.h
+ */
+#if HasNCurses
+# ifdef NCursesLibDir
+CURSESLIB = -L$(NCURSESLIBDIR) NCursesLibName
+# else
+CURSESLIB = NCursesLibName
+# endif
+# ifdef NCursesIncDir
+CURSES_DEFINES = -DCURSES -DNCURSES -I$(NCURSESINCDIR)
+# else
+CURSES_DEFINES = -DCURSES -DNCURSES
+# endif
+#else
+CURSESLIB = -lcurses
+CURSES_DEFINES = -DCURSES
+#endif
+
+ LOCAL_LIBRARIES = $(USEBUILTLIB) $(XKBUILIB) $(XKBFILELIB) \
+ $(XF86CONFLIB) \
+ $(TCLTK_LIBRARIES) $(XXF86VMLIB) $(XXF86MISCLIB) \
+ $(USEINSTALLEDLIB) XawClientLibs $(CURSESLIB) MathLibrary
+ DEPLIBS = XawClientDepLibs $(DEPXXF86VMLIB)
+ CARDDBFILE = $(LIBDIR)/Cards
+ XCONFIGFILE = XF86Config
+
+ XCONFIG_DEFINES = $(EXT_DEFINES) -DXF86SETUP \
+ '-DPROJECTROOT="$(PROJECTROOT)"' \
+ '-DSERVER_CONFIG_FILE="$(LIBDIR)/$(XCONFIGFILE)"' \
+ $(SITE_FONT_PATH) $(SITE_RGB_DB) \
+ -DNO_WRAPPERS
+
+ XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
+ DEFINES = -DCARD_DATABASE_FILE='"$(CARDDBFILE)"' \
+ $(XCONFIG_DEFINES) $(MODULEDEFINES) $(CURSES_DEFINES) \
+ $(MISC_DEFINES)
+ INCLUDES = -I../os-support -I../common -I../vgahw \
+ -I$(FONTLIBSRC)/include -I$(SERVERSRC)/mi -I../parser \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(INCLUDESRC) \
+ -I$(EXTINCSRC) $(USEINSTALLEDINC) -I$(SERVERSRC)/Xext \
+ -I$(TCLINCDIR) -I$(TKINCDIR)
+
+ MSEPROTODEFS = $(STD_DEFINES)
+
+#if HasLdRunPath
+ CCENVSETUP = LD_RUN_PATH=$(USRLIBDIR):$(TCLLIBDIR)
+ CCLINK = $(CCENVSETUP) $(CC)
+#endif
+
+AllTarget(ProgramTargetName(XF86Setup))
+
+LinkSourceFile(Cards,../xf86config)
+LinkSourceFile(cards.h,../xf86config)
+LinkSourceFile(cards.c,../xf86config)
+
+#if !HasSnprintf
+LinkSourceFile(snprintf.c,$(LIBSRC)/misc)
+LinkSourceFile(snprintf.h,$(LIBSRC)/misc)
+#endif
+
+#if NewInput
+LinkSourceFile(mouse.h,../input/mouse)
+#endif
+
+CppFileTarget(mseproto.tcl, mseproto.cpp, $(MSEPROTODEFS), NullParameter)
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+
+NormalProgramTarget(XF86Setup,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) $(SYSTEM_LIBRARIES) $(EXTRASYSLIBS),NullParameter)
+InstallProgram(XF86Setup,$(BINDIR))
+DependTarget()
+
+InstallMultiple($(TCL_FILES),$(XF86SETUPLIBDIR))
+InstallMultiple($(TCLLIB_FILES),$(XF86SETUPLIBDIR)/tcllib)
+InstallMultiple($(PICS_FILES),$(XF86SETUPLIBDIR)/pics)
+InstallManPage(XF86Setup,$(MANDIR))
+
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/LICENSE b/xc/programs/Xserver/hw/xfree86/XF86Setup/LICENSE
new file mode 100644
index 000000000..4dec4ba66
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/LICENSE
@@ -0,0 +1,23 @@
+
+The files in this directory are:
+Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of Joseph Moss not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission. Joseph Moss makes no representations
+about the suitability of this software for any purpose. It is provided
+"as is" without express or implied warranty.
+
+JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/README b/xc/programs/Xserver/hw/xfree86/XF86Setup/README
new file mode 100644
index 000000000..34032797d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/README
@@ -0,0 +1,204 @@
+
+ XF86SETUP README
+ ----------------
+
+INTRODUCTION
+
+ XF86Setup is a new program to aid in the configuration of the XFree86
+ servers. It is unlike previous programs (such as ConfigXF86 and
+ xf86config) in that it is specifically designed to do as much as
+ possible while in graphics mode.
+
+ However, xf86config is _not_ being replaced. XF86Setup's resource
+ requirements are considerably greater than those of xf86config. It also
+ is not usable for OS/2 configuration (at least not yet).
+
+ XF86Setup requires that both the VGA16 and card-appropriate servers be
+ installed. Furthermore, the servers must include the XKEYBOARD,
+ XFree86-VidModeExtension, and XFree86-Misc extensions. If the dialog
+ program is installed, it will be used, but is not required.
+
+ If you wish to run XF86Setup without installing it first, you need to
+ set the environment variable "XF86SETUPLIB" to point to the source
+ directory.
+
+ The command line options are documented in the XF86Setup man page. For
+ instructions regarding the use of the program, see the Quick Start Guide
+ to XFree86 Configuration and the on-line help.
+
+ The rest of this file contains information that is mainly of use to
+ someone interested in hacking on the code.
+
+MANIFEST
+ CHANGELOG List of changes in each version
+ Imakefile Imakefile to generate the program
+ LICENSE Redistribution license and disclaimer
+ README ASCII version of the README
+ README.html HTML version of the README
+ TODO Things to be done or at least considered
+ XF86Setup.man The man page
+ main.c Main prog that starts the Tcl interpreter
+ tclcards.c Routines to connect Tcl and the Cards database
+ reading functions
+ tclcards.h Prototypes for above
+ tclkbd.c Routines to connect to the XKB extension
+ tclmisc.c Routines to connect to the XFree86-Misc extension
+ tclmisc.h Prototypes for above
+ tclother.c Routines to implement misc Tcl commands
+ tclvidmode.c Routines to connect Tcl and
+ XFree86-VidModeExtension
+ tclvidmode.h Prototypes for above
+ tclxfconf.c Interface to xf86Config.c for reading an existing
+ XF86Config file
+ xfsconf.h Prototypes for above
+ tclxkbui.c Tk widget interface to the xkbui library
+ tkother.c Routines to implement misc commands requiring Tk
+ card.tcl Device configuration routines
+ carddata.tcl Information regarding supported chips and such
+ that is used by card.tcl
+ done.tcl Routines that are used once the user has finished
+ the various configuration steps
+ filelist.tcl Lists of files that should be checked for proper
+ installation
+ keyboard.tcl Routines for keyboard and other configuration
+ mondata.tcl Default monitor sync rates and modes
+ monitor.tcl Monitor configuration routines
+ mouse.tcl Mouse configuration routines
+ phase1.tcl Tcl commands to do Phase I
+ phase2.tcl Tcl commands for Phase II
+ phase3.tcl Tcl commands for Phase III
+ phase4.tcl Tcl commands for Phase IV
+ phase5.tcl Tcl commands for Phase V
+ setuplib.tcl Library of XF86Setup specific Tcl procs
+ srvflags.tcl Configuration routines for server flags
+ pics Directory containing bitmaps used by program
+ scripts Directory of other scripts that use XF86Setup as
+ an interpreter to implement other clients
+ tcllib Directory containing Tcl code to set the standard
+ widget bindings (from the Tcl & Tk 4.0p3
+ distributions) and with misc tcl routines and the
+ combobox widget
+
+NEW TCL COMMANDS
+
+ The program includes a Tcl interpreter which has been extended with
+ additional commands (in addition to those in the Tk toolkit). They are
+ explained below.
+
+Interfacing with the Cards database
+
+ Two commands have been added to read data from the "Cards" database (as
+ used by "xf86config")
+ xf86cards_getlist Return the full list of card names
+ xf86cards_getentry Get complete info on a card
+
+ A valid card name should be supplied as an argument to
+ "xf86cards_getentry"
+
+XFree86-VidModeExtension commands
+
+ Several commands have been added which allow the program to communicate
+ with the XFree86-VidModeExtension server extension, namely:
+ xf86vid_getversion Query extension version
+ xf86vid_getbasevals
+ Get the ErrorBase and EventBase
+ xf86vid_getmodeline
+ Get the current video mode settings
+ xf86vid_getallmodelines
+ Get video settings for all modes
+ xf86vid_getmonitor Get monitor specs
+ xf86vid_lockmodeswitch
+ Turn on/off mode switching
+ xf86vid_switchmode Switch to next/previous mode
+
+ Only the last two take an argument, which is either "lock" or "unlock"
+ in the case of "xf86vid_lockmodeswitch" and either "next" or "prev" in
+ the case of "xf86vid_switchmode".
+
+ "xf86vid_getversion" returns the version as a floating point number
+ (e.g., 1.2), whereas "xf86vid_getbasevals" returns a Tcl list containing
+ two elements.
+
+ The "xf86vid_getmodeline" command returns a string which contains the
+ standard mode line values including flags, if any, with each value
+ separated by a single space.
+
+ "xf86vid_getallmodelines" returns a Tcl list. The number of elements
+ corresponds to the number of valid video modes. Each element is in the
+ format returned by "xf86vid_getmodeline". The first element contains the
+ mode info for the current mode.
+
+ "xf86vid_getmonitor" also returns a Tcl list. The first element is the
+ vendor name. The second is the model name. The third element contains
+ all of the horizontal sync rates as comma separated ranges (so for
+ example if the sync rates were 31.5, 35-40, and 45-55 the return value
+ would be: "31.50-31.50,35.00-40.00,45.00-55.00"). The last element
+ contains the vertical sync rates in the same format.
+
+XFree86-Misc extension commands
+
+ Communication with the XFree86-Misc extension is possible using these
+ new commands:
+ xf86misc_getversion
+ Query extension version
+ xf86misc_getbasevals
+ Get the ErrorBase and EventBase
+ xf86misc_getmouse Get the current mouse settings
+ xf86misc_setmouse Set the current mouse settings
+ xf86misc_getkeyboard
+ Get the current keyboard settings
+ xf86misc_setkeyboard
+ Set the current keyboard settings
+ xf86misc_getsaver Get the power saver settings
+ xf86misc_setsaver Set the power saver settings
+
+XKEYBOARD extension commands
+
+ A few commands are available for communicating with the XKEYBOARD
+ extension:
+ xkb_components List the components that make up the given
+ keyboard
+ xkb_free Free a previously allocated keyboard description
+ structure
+ xkb_getrulesprop Read the _XKB_RULES_NAMES root property
+ xkb_list Returns a list of available components
+ xkb_listrules Returns a list of available rules defs and their
+ descriptions
+ xkb_load Change the keyboard setup for the specified
+ components
+ xkb_read Get keyboard information from the server
+ xkb_setrulesprop Set the _XKB_RULES_NAMES root property
+ xkb_resolvecomponents
+ Use the XKB rules to determine the components
+ necessay for an appropriate keymap (requires XKB
+ library support that might not yet be in the
+ XFree86 tree).
+
+ The xkbview widget is also available as interface to the xkbui library.
+
+Miscellaneous
+
+ Other commands added to the interpreter are:
+ getuid Returns the real uid of the user
+ server_running Returns true if a server is running on the
+ specified display
+ process_running Checks if the specified process is running
+ has_symlinks Returns true if running on an OS that supports
+ symbolic links
+ link Makes a (soft or hard) link from one file to
+ another
+ unlink Removes the specified file
+ mkdir Create the named directory
+ rmdir Remove the named directory
+ umask Set the file creation mode mask
+ sleep Sleeps for the specified number of seconds
+ findfocuswindow Search along an axis for a window which accepts
+ focus (added to the interpreter after Tk has been
+ initialized)
+
+ "getuid" just returns the numeric result of getuid().
+
+ The "server_running" command simply tries to perform an "XOpenDisplay()"
+ on its argument. If the call fails, it returns false (0), otherwise it
+ calls "XCloseDisplay()" and returns true (1).
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/README.html b/xc/programs/Xserver/hw/xfree86/XF86Setup/README.html
new file mode 100644
index 000000000..4ea958713
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/README.html
@@ -0,0 +1,218 @@
+<!-- $XConsortium: README.html /main/4 1996/10/28 07:05:01 kaleb $ -->
+<!---->
+<!---->
+<!---->
+<!---->
+<!-- $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/README.html,v 3.4 1996/12/27 06:53:58 dawes Exp $ -->
+<HTML>
+<HEAD>
+<TITLE>README for XF86Setup</TITLE>
+</HEAD>
+<BODY>
+<H1>XF86Setup README</H1>
+
+<H2>Introduction</H2>
+
+ <P>XF86Setup is a new program to aid in the configuration of the
+ XFree86 servers. It is unlike previous programs (such as ConfigXF86
+ and xf86config) in that it is specifically designed to do as much
+ as possible while in graphics mode.
+ <P>However, xf86config is <EM>not</EM> being replaced. XF86Setup's
+ resource requirements are considerably greater than those of
+ xf86config. It also is not usable for OS/2 configuration
+ (at least not yet).
+ <P>XF86Setup requires that both the VGA16 and card-appropriate servers
+ be installed. Furthermore, the servers must include the XKEYBOARD,
+ XFree86-VidModeExtension, and XFree86-Misc extensions. If the
+ dialog program is installed, it will be used, but is not required.
+
+ <P>If you wish to run XF86Setup without installing it first,
+ you need to set the environment variable
+ <KBD>XF86SETUPLIB</KBD> to point to the source directory.
+
+ <P>The command line options are documented in the XF86Setup man
+ page. For instructions regarding the use of the program, see the
+ <A HREF="http://www.XFree86.org/3.1.2G/QuickStart.html">Quick Start Guide to XFree86 Configuration</A>
+ and the on-line help.
+
+ <P>The rest of this file contains information that is mainly of
+ use to someone interested in hacking on the code.
+
+<H2>Manifest</H2>
+ <DL>
+ <DT>CHANGELOG <DD>List of changes in each version
+ <DT>Imakefile <DD>Imakefile to generate the program
+ <DT>LICENSE <DD>Redistribution license and disclaimer
+ <DT>README <DD>ASCII version of the README
+ <DT>README.html <DD>HTML version of the README
+ <DT>TODO <DD>Things to be done or at least considered
+ <DT>XF86Setup.man <DD>The man page
+ <DT>main.c <DD>Main prog that starts the Tcl interpreter
+ <DT>tclcards.c <DD>Routines to connect Tcl and the Cards
+ database reading functions
+ <DT>tclcards.h <DD>Prototypes for above
+ <DT>tclkbd.c <DD>Routines to connect to the XKB extension
+ <DT>tclmisc.c <DD>Routines to connect to the XFree86-Misc
+ extension
+ <DT>tclmisc.h <DD>Prototypes for above
+ <DT>tclother.c <DD>Routines to implement misc Tcl commands
+ <DT>tclvidmode.c <DD>Routines to connect Tcl and
+ XFree86-VidModeExtension
+ <DT>tclvidmode.h <DD>Prototypes for above
+ <DT>tclxfconf.c <DD>Interface to xf86Config.c for reading an
+ existing XF86Config file
+ <DT>xfsconf.h <DD>Prototypes for above
+ <DT>tclxkbui.c <DD>Tk widget interface to the xkbui library
+ <DT>tkother.c <DD>Routines to implement misc commands requiring Tk
+ <DT>card.tcl <DD>Device configuration routines
+ <DT>carddata.tcl <DD>Information regarding supported chips and
+ such that is used by card.tcl
+ <DT>done.tcl <DD>Routines that are used once the user has
+ finished the various configuration steps
+ <DT>filelist.tcl <DD>Lists of files that should be checked for
+ proper installation
+ <DT>keyboard.tcl <DD>Routines for keyboard and other configuration
+ <DT>mondata.tcl <DD>Default monitor sync rates and modes
+ <DT>monitor.tcl <DD>Monitor configuration routines
+ <DT>mouse.tcl <DD>Mouse configuration routines
+ <DT>phase1.tcl <DD>Tcl commands to do Phase I
+ <DT>phase2.tcl <DD>Tcl commands for Phase II
+ <DT>phase3.tcl <DD>Tcl commands for Phase III
+ <DT>phase4.tcl <DD>Tcl commands for Phase IV
+ <DT>phase5.tcl <DD>Tcl commands for Phase V
+ <DT>setuplib.tcl <DD>Library of XF86Setup specific Tcl procs
+ <DT>srvflags.tcl <DD>Configuration routines for server flags
+ <DT>pics <DD>Directory containing bitmaps used by program
+ <DT>scripts <DD>Directory of other scripts that use XF86Setup
+ as an interpreter to implement other clients
+ <DT>tcllib <DD>Directory containing Tcl code to set the
+ standard widget bindings (from the Tcl &amp;
+ Tk 4.0p3 distributions) and with misc tcl
+ routines and the combobox widget
+ </DL>
+
+<H2>New Tcl commands</H2>
+
+ <P>The program includes a Tcl interpreter which has been extended
+ with additional commands (in addition to those in the Tk toolkit).
+ They are explained below.
+
+<H3>Interfacing with the Cards database</H3>
+
+ <P>Two commands have been added to read data from the
+ <CITE>Cards</CITE> database (as used by <CITE>xf86config</CITE>)
+ <DL>
+ <DT>xf86cards_getlist <DD>Return the full list of card names
+ <DT>xf86cards_getentry <DD>Get complete info on a card
+ </DL>
+ <P>A valid card name should be supplied as an argument to
+ <KBD>xf86cards_getentry</KBD>
+
+<H3>XFree86-VidModeExtension commands</H3>
+
+ <P>Several commands have been added which allow the program to
+ communicate with the XFree86-VidModeExtension server extension,
+ namely:
+ <DL>
+ <DT>xf86vid_getversion <DD>Query extension version
+ <DT>xf86vid_getbasevals <DD>Get the ErrorBase and EventBase
+ <DT>xf86vid_getmodeline <DD>Get the current video mode settings
+ <DT>xf86vid_getallmodelines <DD>Get video settings for all modes
+ <DT>xf86vid_getmonitor <DD>Get monitor specs
+ <DT>xf86vid_lockmodeswitch <DD>Turn on/off mode switching
+ <DT>xf86vid_switchmode <DD>Switch to next/previous mode
+ </DL>
+ <P>Only the last two take an argument, which is either <KBD>lock</KBD>
+ or <KBD>unlock</KBD> in the case of <KBD>xf86vid_lockmodeswitch</KBD>
+ and either <KBD>next</KBD> or <KBD>prev</KBD> in the case of
+ <KBD>xf86vid_switchmode</KBD>.
+ <P><KBD>xf86vid_getversion</KBD> returns the version as a floating
+ point number (e.g., 1.2), whereas <KBD>xf86vid_getbasevals</KBD>
+ returns a Tcl list containing two elements.
+ <P>The <KBD>xf86vid_getmodeline</KBD> command returns a string
+ which contains the standard mode line values including flags,
+ if any, with each value separated by a single space.
+ <P><KBD>xf86vid_getallmodelines</KBD> returns a Tcl list. The
+ number of elements corresponds to the number of valid video
+ modes. Each element is in the format returned by
+ <KBD>xf86vid_getmodeline</KBD>. The first element contains the
+ mode info for the current mode.
+ <P><KBD>xf86vid_getmonitor</KBD> also returns a Tcl list. The
+ first element is the vendor name. The second is the model name.
+ The third element contains all of the horizontal sync rates
+ as comma separated ranges (so for example if the sync rates
+ were 31.5, 35-40, and 45-55 the return value would be:
+ <KBD>31.50-31.50,35.00-40.00,45.00-55.00</KBD>). The last element
+ contains the vertical sync rates in the same format.
+
+<H3>XFree86-Misc extension commands</H3>
+
+ <P>Communication with the XFree86-Misc extension is possible
+ using these new commands:
+ <DL>
+ <DT>xf86misc_getversion <DD>Query extension version
+ <DT>xf86misc_getbasevals <DD>Get the ErrorBase and EventBase
+ <DT>xf86misc_getmouse <DD>Get the current mouse settings
+ <DT>xf86misc_setmouse <DD>Set the current mouse settings
+ <DT>xf86misc_getkeyboard <DD>Get the current keyboard settings
+ <DT>xf86misc_setkeyboard <DD>Set the current keyboard settings
+ <DT>xf86misc_getsaver <DD>Get the power saver settings
+ <DT>xf86misc_setsaver <DD>Set the power saver settings
+ </DL>
+
+<H3>XKEYBOARD extension commands</H3>
+
+ <P>A few commands are available for communicating with the XKEYBOARD
+ extension:
+ <DL>
+ <DT>xkb_components <DD>List the components that make up the
+ given keyboard
+ <DT>xkb_free <DD>Free a previously allocated keyboard
+ description structure
+ <DT>xkb_getrulesprop <DD>Read the _XKB_RULES_NAMES root property
+ <DT>xkb_list <DD>Returns a list of available components
+ <DT>xkb_listrules <DD>Returns a list of available rules
+ defs and their descriptions
+ <DT>xkb_load <DD>Change the keyboard setup for the
+ specified components
+ <DT>xkb_read <DD>Get keyboard information from the
+ server
+ <DT>xkb_setrulesprop <DD>Set the _XKB_RULES_NAMES root property
+ <DT>xkb_resolvecomponents <DD>Use the XKB rules to determine the
+ components necessay for an
+ appropriate keymap (requires XKB
+ library support that might not yet
+ be in the XFree86 tree).
+ </DL>
+ <P>The xkbview widget is also available as interface to the xkbui library.
+
+<H3>Miscellaneous</H3>
+
+ <P>Other commands added to the interpreter are:
+ <DL>
+ <DT>getuid <DD>Returns the real uid of the user
+ <DT>server_running <DD>Returns true if a server is
+ running on the specified display
+ <DT>process_running <DD>Checks if the specified process is running
+ <DT>has_symlinks <DD>Returns true if running on an OS
+ that supports symbolic links
+ <DT>link <DD>Makes a (soft or hard) link from
+ one file to another
+ <DT>unlink <DD>Removes the specified file
+ <DT>mkdir <DD>Create the named directory
+ <DT>rmdir <DD>Remove the named directory
+ <DT>umask <DD>Set the file creation mode mask
+ <DT>sleep <DD>Sleeps for the specified number
+ of seconds
+ <DT>findfocuswindow <DD>Search along an axis for a window which
+ accepts focus (added to the interpreter
+ after Tk has been initialized)
+ </DL>
+ <P><KBD>getuid</KBD> just returns the numeric result of getuid().
+ <P>The <KBD>server_running</KBD> command simply tries to perform
+ an <KBD>XOpenDisplay()</KBD> on its argument. If the call fails,
+ it returns false (0), otherwise it calls <KBD>XCloseDisplay()</KBD>
+ and returns true (1).
+
+</BODY>
+</HTML>
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/TODO b/xc/programs/Xserver/hw/xfree86/XF86Setup/TODO
new file mode 100644
index 000000000..f5cd18949
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/TODO
@@ -0,0 +1,125 @@
+
+RELATED CHANGES TO OTHER PARTS OF THE X SOURCE TREE:
+----------------------------------------------------------------------
+
+ A) Add ability to dynamically add and remove video modes and to switch
+ directly to a specific mode to the XFree86-VidModeExtension
+
+ B) Update vidmode extension to know about the Hskew parameter
+
+ C) Add a GetViewPort function to the vidmode extension
+
+ D) Update os-support/README.OS-lib with info regarding allowMouseOpenFail
+
+ E) Modify the server mouse open functions to test that the file is of
+ the correct type before opening the device ???
+
+ F) In cards.c, allow $XWINHOME to override location of Cards file
+
+ G) Write a README file which describes all the available options
+
+ H) Add an option to SuperProbe to specify a parser-friendly output mode
+
+ I) Add an option to SuperProbe to cause it to probe just enough to figure
+ out which server should be run
+
+
+CHANGES IN XF86SETUP:
+----------------------------------------------------------------------
+
+ 1) When using the SVGA server, further restrict the list of available
+ RAMDACs, clock chips, and READMEs once the chipset has been selected.
+
+ 2) Improve keybindings for the arrow keys (e.g. scale widgets should
+ allow perpendicular movement to other widgets)
+
+ 3) Add configuration of related things that can be set with xset such as
+ keyboard repeat rate, mouse acceleration, screen saver settings,
+ etc. ???
+
+ 4) Check for proper permissions of various files ???
+
+ 6) More fine-grained control of what is read from the existing XF86Config ???
+
+ 7) Add support for XInput
+
+ 8) Add support for Modules
+
+ 9) Add ability to select modes and their order (dependant on vidmode
+ extension changes)
+
+10) Internationalization of messages
+
+11) List all of the files that are found to be missing (not just the first)
+
+12) Make the X symlink while in graphics mode, instead of after switching
+ back to text mode
+
+13) Investigate reports of the hsync and vsync fields not allowing editing
+
+14) Update the xkbview widget to display glyphs on the keys (work is going
+ to start soon on adding the necessary functionality to libxkbui)
+
+15) The UI for the video RAM and RAMDAC max speed could probably improved
+ a bit still
+
+16) Preserve existing mode lines when reading existing config file
+
+17) Preserve existing comments in the config file (difficult)
+
+18) Make the list of available mouse devices show only the device names
+ that are appropriate for the selected protocol
+
+19) Add ability to map individual keys
+
+20) Move the server flags configuration to the second server?
+
+21) Check for invalid combinations of XKB settings
+
+22) Add a warning that the XF86Config file is used just to set defaults
+ (i.e. that comments and such will be lost)
+
+23) Some kind of better monitor identifier
+
+24) Display a warning message telling the user to use ctrl-alt-bkspc, if
+ things lock up
+
+25) Detect premature server shutdowns (e.g. if user presses ctrl-alt-bkspc)
+ and then do what?
+
+26) Move "Done" button to top row ???
+
+27) Add user-friendly names for the possible mouse devices
+
+28) Set a specific width for the "Sample Rate" / "Lines/Inch" slider to avoid
+ the repacking of the widgets that currently occurs when changing to/from
+ the MMHitTab protocol
+
+29) Add a text area in which the keyboard can be tested
+
+30) If server fails to start because of an already running server, increment
+ and try again
+
+31) If server startup fails for some other reason, include the error in the
+ message to the user
+
+32) Set the initial Emulate3Buttons state to on, if not reading from an
+ existing config file
+
+34) Provide a way to go back from phase 4 to phase 2.
+
+35) Let the the user specify the existing config file to be read
+
+36) Show the horizontal sync rates in the list of monitors
+
+39) Limit card list to only those appropriate to what SuperProbe reports
+
+41) Add button for displaying the option description README or perhaps
+ add some kind of online help that describes a selected option (maybe
+ something like balloon help)
+
+44) Make the keyboard configuration screen also a seperate client
+ (a la xmseconfig).
+
+45) Do the same with the new mode selection screen
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man b/xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man
new file mode 100644
index 000000000..754ee8539
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man
@@ -0,0 +1,106 @@
+.\" $XConsortium: XF86Setup.man /main/3 1996/12/09 17:37:49 kaleb $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man,v 3.4 1996/12/27 06:53:58 dawes Exp $
+.TH XF86Setup 1 "Version 3.2" "XFree86"
+.SH NAME
+XF86Setup - Graphical configuration utility for XFree86
+.SH SYNOPSIS
+.B XF86Setup
+[ -sync ] [ -name \fIappname\fP ] [ -nodialog ] [ -- \fIarg\fP ...]
+.LP
+.B XF86Setup
+[ -sync ] [ -name \fIappname\fP ] [ -script ]
+[ -display \fIdisplay\fP ] [ -geometry \fIgeometry\fP ]
+\fIfilename\fP [ [ -- ] \fIarg\fP ... ]
+.SH DESCRIPTION
+.I XF86Setup
+is normally used to either perform the initial setup of the XFree86
+X servers or to make adjustments to the existing configuration.
+.PP
+When used to initially configure the XFree86 servers, it will
+start the VGA 16 server and then allow configuration settings to be
+entered. Once that is completed the appropriate server for the
+hardware will be started and the configuration settings will be
+saved.
+.PP
+For a more complete description see the \fIQuick-Start Guide to
+XFree86 Setup\fP.
+.PP
+When run from within an already running server environment (e.g.
+from an xterm window),
+.I XF86Setup
+can be used to make adjustments to the current server configuration.
+.PP
+Note that when the existing XF86Config file is read, it is used to
+set the default values for various settings, but the complete contents
+of the existing file are not preserved. For example, when the new
+XF86Config file is written, it will \fInot\fP contain any additional
+comment lines from the original file.
+.PP
+When a filename is specified, it is interpreted as a script file
+containing Tcl/Tk commands to run. If the filename contains a slash,
+it is assumed that it specifies the path to the file to execute,
+otherwise the file is searched for in the user's PATH, unless the
+\fB-script\fP option is given, in which case, it is expected to
+exist in the \fIscripts\fP subdirectory of the
+\fIXF86Setup\fP library directory.
+.PP
+The result is entirely dependant on the contents of the file.
+
+.SH ARGUMENTS
+.TP 14
+.B -sync
+Turn on synchronization for all communication with an X server.
+.TP 14
+.BI -name " appname"
+Use \fIappname\fP as the window name.
+.TP 14
+.BI -display " display"
+Specify the display to talk to.
+.TP 14
+.B -nodialog
+Do not use the Dialog program for text mode user interaction.
+Normally \fIXF86Setup\fP will use the Dialog program, if it is
+found in the user's PATH, otherwise a simple text interface is used.
+.TP 14
+.BI -geometry " geomspec"
+Specify the initial geometry for the window.
+.TP 14
+.BI -script
+Look for the specified filename in the \fIscripts\fP directory,
+instead of searching the user's PATH (if the filename doesn't
+specify a path).
+.SH ENVIRONMENT
+.TP 14
+.B PATH
+Used to search for the location of the Dialog program
+.TP 14
+.B XWINHOME
+If set, indicates the parent directory of X bin and lib directories.
+.TP 14
+.B XF86SETUPLIB
+If set, overrides the default location of the library directory
+(normally <XRoot>/lib/X11/XF86Setup).
+.TP 14
+.B TMPDIR
+Directory in which to store temporary files (defaults to /tmp)
+.SH FILES
+<XRoot>/lib/X11/XF86Config
+.br
+\fIor\fP /etc/XF86Config
+.RS 14
+Can optionally be read to set default values
+for configuration settings
+.RE
+.SH "SEE ALSO"
+\fIQuick-Start Guide to XFree86 Setup\fP
+.br
+Xserver(1), XFree86(1), XF86Config(4/5), xvidtune(1), xdm(1),
+xf86config(1), xinit(1), XF86Misc(3), XF86VidMode(3),
+xmseconfig(1), dialog(1)
+.SH AUTHOR
+.PP
+Joe Moss, \fIjoe@XFree86.org\fP
+.SH BUGS
+Does not support all possible configurations, for example,
+graphics tablets must be configured by editing the XF86Config
+file manually.
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/card.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/card.tcl
new file mode 100644
index 000000000..7d22f72f7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/card.tcl
@@ -0,0 +1,587 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/card.tcl,v 3.17 1999/04/05 07:12:58 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: card.tcl /main/5 1996/10/28 04:55:06 kaleb $
+
+#
+# Card configuration routines
+#
+
+
+proc Card_create_widgets { win } {
+ global ServerList XF86Setup_library cardDevNum DeviceIDs
+ global cardDetail cardReadmeWasSeen UseConfigFile cardDriverReadme
+ global pc98_EGC messages
+
+ set cardDriverReadme "NONE"
+ set w [winpathprefix $win]
+ set cardDevNum 0
+ if !$pc98_EGC {
+ frame $w.card -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.card -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.card.top
+ pack $w.card.top -side top -fill x -padx 5m
+ if { [llength $DeviceIDs] > 1 } {
+ label $w.card.title -text $messages(card.1) -anchor w
+ pack $w.card.title -side left -fill x -padx 5m -in $w.card.top
+ combobox $w.card.cardselect -state disabled -bd 2
+ pack $w.card.cardselect -side left -in $w.card.top
+ eval [list $w.card.cardselect linsert end] $DeviceIDs
+ Card_cbox_setentry $w.card.cardselect [lindex $DeviceIDs 0]
+ bind $w.card.cardselect.popup.list <ButtonRelease-1> \
+ "+[list Card_cardselect $win]"
+ bind $w.card.cardselect.popup.list <Return> \
+ "+[list Card_cardselect $win]"
+ } else {
+ label $w.card.title -text $messages(card.2) -anchor w
+ pack $w.card.title -side left -fill x -padx 5m -in $w.card.top
+ }
+
+ frame $w.card.list
+ scrollbar $w.card.list.sb -command [list $w.card.list.lb yview] \
+ -repeatdelay 1200 -repeatinterval 800
+ listbox $w.card.list.lb -yscroll [list $w.card.list.sb set] \
+ -setgrid true -height 20
+ bind $w.card.list.lb <Return> \
+ [list Card_selected $win $w.card.list.lb]
+ bind $w.card.list.lb <ButtonRelease-1> \
+ [list Card_selected $win $w.card.list.lb]
+ eval $w.card.list.lb insert 0 [xf86cards_getlist]
+ pack $w.card.list.lb -side left -fill both -expand yes
+ pack $w.card.list.sb -side left -fill y
+
+ image create bitmap cardpic -foreground yellow -background black \
+ -file $XF86Setup_library/pics/vidcard.xbm \
+ -maskfile $XF86Setup_library/pics/vidcard.msk
+ label $w.card.list.pic -image cardpic
+ pack $w.card.list.pic -side left -padx 3m -pady 3m
+
+
+ frame $w.card.bot -borderwidth 5
+ pack $w.card.bot -side bottom -fill x
+ label $w.card.bot.message
+ pack $w.card.bot.message -side top -fill x
+
+ frame $w.card.buttons
+ pack $w.card.buttons -side bottom -fill x
+
+ button $w.card.readme -text $messages(card.3) \
+ -command [list Card_display_readme $win]
+ pack $w.card.readme -side left -expand yes \
+ -in $w.card.buttons
+
+ button $w.card.modebutton -text $messages(card.4) \
+ -command [list Card_switchdetail $win]
+ pack $w.card.modebutton -side left -expand yes \
+ -in $w.card.buttons
+
+ frame $w.card.detail -bd 2 -relief sunken
+
+ frame $w.card.server
+ pack $w.card.server -side top -fill x -in $w.card.detail
+ label $w.card.server.title -text $messages(card.5)
+ pack $w.card.server.title -side left
+ foreach serv $ServerList {
+ set lcserv [string tolower $serv]
+ radiobutton $w.card.server.$lcserv -indicatoron no \
+ -text $serv -variable cardServer -value $serv \
+ -command [list Card_set_cboxlists $win]
+ pack $w.card.server.$lcserv -anchor w -side left \
+ -expand yes -fill x
+ }
+
+ frame $w.card.detail.cboxen
+ pack $w.card.detail.cboxen -side top
+
+ frame $w.card.chipset
+ pack $w.card.chipset -side left -expand yes -fill x \
+ -in $w.card.detail.cboxen -padx 5m
+ label $w.card.chipset.title -text $messages(card.7)
+ combobox $w.card.chipset.cbox -state disabled -bd 2
+ pack $w.card.chipset.title $w.card.chipset.cbox
+
+ frame $w.card.ramdac
+ pack $w.card.ramdac -side left -expand yes -fill x \
+ -in $w.card.detail.cboxen -padx 5m
+ label $w.card.ramdac.title -text $messages(card.8)
+ combobox $w.card.ramdac.cbox -state disabled -bd 2
+ pack $w.card.ramdac.title $w.card.ramdac.cbox
+
+ frame $w.card.clockchip
+ pack $w.card.clockchip -side left -expand yes -fill x \
+ -in $w.card.detail.cboxen -padx 5m
+ label $w.card.clockchip.title -text $messages(card.9)
+ combobox $w.card.clockchip.cbox -state disabled -bd 2
+ pack $w.card.clockchip.title $w.card.clockchip.cbox
+
+ set extr $w.card.extra
+ frame $extr
+ pack $extr -side bottom -padx 5m \
+ -fill x -expand yes -in $w.card.detail
+ frame $extr.dacspeed
+ if { $UseConfigFile } {
+ pack $extr.dacspeed -side left -fill x -expand yes
+ }
+ label $extr.dacspeed.title -text $messages(card.10)
+ checkbutton $extr.dacspeed.probe -width 15 -text $messages(card.11) \
+ -variable cardDacProbe -indicator off \
+ -command [list Card_dacspeed $win] \
+ -highlightthickness 0
+ scale $extr.dacspeed.value -variable cardDacSpeed \
+ -orient horizontal -from 60 -to 300 -resolution 5
+ bind $extr.dacspeed.value <ButtonPress> \
+ "set cardDacProbe 0; [list Card_dacspeed $win]"
+ pack $extr.dacspeed.title -side top -fill x -expand yes
+ pack $extr.dacspeed.probe -side top -expand yes
+ pack $extr.dacspeed.value -side top -fill x -expand yes
+ frame $extr.videoram
+ pack $extr.videoram -side left -fill x -expand yes
+ label $extr.videoram.title -text $messages(card.12)
+ pack $extr.videoram.title -side top -fill x -expand yes
+ radiobutton $extr.videoram.mprobed -indicator off -width 15 \
+ -variable cardRamSize -value 0 -text $messages(card.13) \
+ -highlightthickness 0
+ pack $extr.videoram.mprobed -side top -expand yes
+ frame $extr.videoram.cols
+ pack $extr.videoram.cols -side top -fill x -expand yes
+ frame $extr.videoram.col1
+ frame $extr.videoram.col2
+ pack $extr.videoram.col1 $extr.videoram.col2 \
+ -side left -fill x -expand yes \
+ -in $extr.videoram.cols
+ radiobutton $extr.videoram.m256k \
+ -variable cardRamSize -value 256 -text $messages(card.14) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m512k \
+ -variable cardRamSize -value 512 -text $messages(card.15) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m1m \
+ -variable cardRamSize -value 1024 -text $messages(card.16) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m2m \
+ -variable cardRamSize -value 2048 -text $messages(card.17) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m3m \
+ -variable cardRamSize -value 3072 -text $messages(card.18) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m4m \
+ -variable cardRamSize -value 4096 -text $messages(card.19) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m6m \
+ -variable cardRamSize -value 6144 -text $messages(card.20) \
+ -highlightthickness 0
+ radiobutton $extr.videoram.m8m \
+ -variable cardRamSize -value 8192 -text $messages(card.21) \
+ -highlightthickness 0
+ pack $extr.videoram.m256k $extr.videoram.m512k \
+ $extr.videoram.m1m $extr.videoram.m2m \
+ -side top -fill x -expand yes \
+ -in $extr.videoram.col1
+ pack $extr.videoram.m3m $extr.videoram.m4m \
+ $extr.videoram.m6m $extr.videoram.m8m \
+ -side top -fill x -expand yes \
+ -in $extr.videoram.col2
+
+ frame $w.card.options
+ pack $w.card.options -side bottom -fill x -in $w.card.detail \
+ -pady 2m
+
+ frame $w.card.options.list
+ pack $w.card.options.list -side top
+ combobox $w.card.options.list.cbox -state disabled -width 80 -bd 2
+ label $w.card.options.list.title -text $messages(card.22)
+ $w.card.options.list.cbox.popup.list configure \
+ -selectmode multiple
+ pack $w.card.options.list.title -side left
+ pack $w.card.options.list.cbox -fill x -expand yes -side left
+
+ frame $w.card.options.text
+ pack $w.card.options.text -side top
+ text $w.card.options.text.text -yscroll [list $w.card.options.text.sb set] \
+ -setgrid true -height 4 -background white
+ scrollbar $w.card.options.text.sb -command \
+ [list $w.card.options.text.text yview]
+ label $w.card.options.text.title -text $messages(card.23)
+ pack $w.card.options.text.title -fill x -expand yes -side top
+ pack $w.card.options.text.text -fill x -expand yes -side left
+ pack $w.card.options.text.sb -side left -fill y
+
+ $w.card.readme configure -state disabled
+ for {set idx 0} {$idx < [llength $DeviceIDs]} {incr idx} {
+ set cardReadmeWasSeen($idx) 0
+ }
+ if { $UseConfigFile } {
+ set cardDetail std
+ Card_switchdetail $win
+ #$w.card.modebutton configure -state disabled
+ } else {
+ set cardDetail detail
+ Card_switchdetail $win
+ }
+}
+
+proc Card_activate { win } {
+ set w [winpathprefix $win]
+ Card_get_configvars $win
+ pack $w.card -side top -fill both -expand yes
+}
+
+proc Card_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.card
+ Card_set_configvars $win
+}
+
+proc Card_dacspeed { win } {
+ global cardDacSpeed cardDacProbe messages
+
+ set w [winpathprefix $win]
+ if { $cardDacProbe } {
+ #$w.card.extra.dacspeed.probe configure -text "Probed: Yes"
+ $w.card.extra.dacspeed.value configure \
+ -foreground [option get $w.card background *] ;# -state disabled
+ } else {
+ #$w.card.extra.dacspeed.probe configure -text "Probed: No"
+ $w.card.extra.dacspeed.value configure \
+ -foreground [option get $w.card foreground *] -state normal
+ }
+}
+
+proc Card_switchdetail { win } {
+ global cardDetail cardDevNum messages
+
+ set w [winpathprefix $win]
+ if { $cardDetail == "std" } {
+ set cardDetail detail
+ $w.card.modebutton configure -text $messages(card.26)
+ pack forget $w.card.list
+ pack $w.card.detail -expand yes -side top -fill both
+ $w.card.bot.message configure -text $messages(card.30)
+ } else {
+ set cardDetail std
+ $w.card.modebutton configure -text $messages(card.27)
+ pack forget $w.card.detail
+ pack $w.card.list -expand yes -side top -fill both
+ $w.card.bot.message configure -text $messages(card.31)
+ }
+}
+
+proc Card_cbox_setentry { cb text } {
+ $cb econfig -state normal
+ $cb edelete 0 end
+ if [string length $text] {
+ $cb einsert 0 $text
+ }
+ $cb econfig -state disabled
+ set cblist [$cb lget 0 end]
+ if { [string match *.options.cbox $cb] } {
+ $cb lselection clear 0 end
+ foreach option [split $text ,] {
+ set idx [lsearch $cblist $option]
+ if { $idx != -1 } {
+ $cb see $idx
+ $cb lselection set $idx
+ $cb activate $idx
+ }
+ }
+ } else {
+ set idx [lsearch $cblist $text]
+ if { $idx != -1 } {
+ $cb see $idx
+ $cb lselection clear 0 end
+ $cb lselection set $idx
+ $cb activate $idx
+ }
+ }
+}
+
+proc Card_selected { win lbox } {
+ global cardServer cardReadmeWasSeen cardDevNum cardDriverReadme
+ global pc98 Module messages
+
+ set w [winpathprefix $win]
+ if { ![string length [$lbox curselection]] } return
+ set cardentry [$lbox get [$lbox curselection]]
+ set carddata [xf86cards_getentry $cardentry]
+ set cardDriverReadme ""
+ $w.card.title configure -text "$messages(card.28)$cardentry"
+ $w.card.options.text.text delete 0.0 end
+ if { [lsearch [lindex $carddata 7] UNSUPPORTED] == -1 } {
+ #Card_cbox_setentry $w.card.chipset.cbox [lindex $carddata 1]
+ set cardDriverReadmeRaw [lindex $carddata 1]
+ switch -glob $cardDriverReadmeRaw {
+ S3\ ViRGE { set cardDriverReadme "s3v" }
+ ET3* { set cardDriverReadme "et3000" }
+ ET4* { set cardDriverReadme "et4000" }
+ ET6* { set cardDriverReadme "et4000" }
+ CL* { set cardDriverReadme "cirrus" }
+ ARK* { set cardDriverReadme "ark" }
+ ct* { set cardDriverReadme "chips" }
+ mga* { set cardDriverReadme "mga" }
+ MGA* { set cardDriverReadme "mga" }
+ TVGA* { set cardDriverReadme "tvga8900" }
+ TGUI* { set cardDriverReadme "tvga8900" }
+ SIS* { set cardDriverReadme "sis" }
+ nv1* { set cardDriverReadme "nv" }
+ Oak* { set cardDriverReadme "oak" }
+ WD* { set cardDriverReadme "pvga1" }
+ ALG* { set cardDriverReadme "NONE" }
+ AP* { set cardDriverReadme "NONE" }
+ Avance* { set cardDriverReadme "NONE" }
+ Alliance* { set cardDriverReadme "NONE" }
+ }
+ set cardServer [lindex $carddata 2]
+ Card_cbox_setentry $w.card.ramdac.cbox [lindex $carddata 3]
+ Card_cbox_setentry $w.card.clockchip.cbox [lindex $carddata 4]
+ $w.card.options.text.text insert 0.0 [lindex $carddata 6]
+ if { $cardReadmeWasSeen($cardDevNum) } {
+ $w.card.bot.message configure -text $messages(card.32)
+ } else {
+ $w.card.bot.message configure -text $messages(card.33)
+ }
+ } else {
+ set cardServer VGA16
+ Card_cbox_setentry $w.card.chipset.cbox generic
+ Card_cbox_setentry $w.card.ramdac.cbox ""
+ Card_cbox_setentry $w.card.clockchip.cbox ""
+ $w.card.bot.message configure -text $messages(card.34)
+ }
+ Card_set_cboxlists $win cardselected
+ if $pc98 {
+ switch $cardServer {
+ EGC { set Module(Load) egc }
+ PEGC { set Module(Load) pegc }
+ GANBWAP { set Module(Load) ganbwap }
+ NKVNEC { set Module(Load) nkvnec }
+ WABS { set Module(Load) wabs }
+ WABEP { set Module(Load) wabep }
+ WSNA { set Module(Load) wsna }
+ TGUI { set Module(Load) trident }
+ MGA { set Module(Load) mga }
+ NECS3 { set Module(Load) s3nec }
+ PWSKB { set Module(Load) s3pwskb }
+ PWLB { set Module(Load) s3pwlb }
+ GA968 { set Module(Load) s3ga968 }
+ }
+ }
+}
+
+proc Card_set_cboxlists { win args } {
+ global CardChipSets CardRamDacs CardClockChips cardServer
+ global CardReadmes cardReadmeWasSeen CardOptions Xwinhome
+ global pc98
+
+ set w [winpathprefix $win]
+ $w.card.bot.message configure -text [make_message_card $args]
+ if { [llength $CardReadmes($cardServer)] > 0 } {
+ $w.card.readme configure -state normal
+ } else {
+ $w.card.readme configure -state disabled
+ }
+ $w.card.chipset.cbox ldelete 0 end
+ if [llength $CardChipSets($cardServer)] {
+ $w.card.chipset.cbox.button configure -state normal
+ $w.card.chipset.cbox linsert end "<Probed>"
+ eval [list $w.card.chipset.cbox linsert end] \
+ $CardChipSets($cardServer)
+ } else {
+ $w.card.chipset.cbox.button configure -state disabled
+
+ }
+ set chipset [$w.card.chipset.cbox eget]
+ if { [string length $chipset] && [lsearch \
+ $CardChipSets($cardServer) $chipset] < 0} {
+ Card_cbox_setentry $w.card.chipset.cbox ""
+ }
+
+ $w.card.ramdac.cbox ldelete 0 end
+ if [llength $CardRamDacs($cardServer)] {
+ $w.card.ramdac.cbox.button configure -state normal
+ $w.card.ramdac.cbox linsert end "<Probed>"
+ eval [list $w.card.ramdac.cbox linsert end] \
+ $CardRamDacs($cardServer)
+ } else {
+ $w.card.ramdac.cbox.button configure -state disabled
+ }
+ set ramdac [$w.card.ramdac.cbox eget]
+ if { [string length $ramdac] && [lsearch \
+ $CardRamDacs($cardServer) $ramdac] < 0} {
+ Card_cbox_setentry $w.card.ramdac.cbox ""
+ }
+
+
+ $w.card.clockchip.cbox ldelete 0 end
+ if [llength $CardClockChips($cardServer)] {
+ $w.card.clockchip.cbox.button configure -state normal
+ $w.card.clockchip.cbox linsert end "<Probed>"
+ eval [list $w.card.clockchip.cbox linsert end] \
+ $CardClockChips($cardServer)
+ } else {
+ $w.card.clockchip.cbox.button configure -state disabled
+ }
+ set clockchip [$w.card.clockchip.cbox eget]
+ if { [string length $clockchip] && [lsearch \
+ $CardClockChips($cardServer) $clockchip] < 0} {
+ Card_cbox_setentry $w.card.clockchip.cbox ""
+ }
+
+ $w.card.options.list.cbox ldelete 0 end
+ if [llength $CardOptions($cardServer)] {
+ $w.card.options.list.cbox.button configure -state normal
+ eval [list $w.card.options.list.cbox linsert end] \
+ $CardOptions($cardServer)
+ } else {
+ $w.card.options.list.cbox.button configure -state disabled
+ }
+ set options ""
+ foreach option [split [$w.card.options.list.cbox eget] ,] {
+ if { [string length $option] && [lsearch \
+ $CardOptions($cardServer) $option] != -1} {
+ lappend options $option
+ }
+ }
+ Card_cbox_setentry $w.card.options.list.cbox [join $options ,]
+}
+
+proc Card_display_readme { win } {
+ global cardServer CardReadmes cardReadmeWasSeen cardDriverReadme
+ global cardDevNum Xwinhome messages pc98_EGC
+
+ set w [winpathprefix $win]
+ catch {destroy .cardreadme}
+ toplevel .cardreadme -bd 5 -relief ridge
+ wm title .cardreadme "Chipset Specific README"
+ wm geometry .cardreadme +30+30
+ frame .cardreadme.file
+ text .cardreadme.file.text -setgrid true \
+ -xscroll ".cardreadme.horz.hsb set" \
+ -yscroll ".cardreadme.file.vsb set"
+ if $pc98_EGC {
+ .cardreadme.file.text configure -height 20
+ }
+ if { ![string compare $cardServer "SVGA"] &&
+ [string length $cardDriverReadme] } {
+ set readmeindex $cardServer-$cardDriverReadme
+ } else {
+ set readmeindex $cardServer
+ }
+ foreach file $CardReadmes($readmeindex) {
+ set fd [open $Xwinhome/lib/X11/doc/$file r]
+ .cardreadme.file.text insert end [read $fd]
+ close $fd
+ }
+ .cardreadme.file.text configure -state disabled
+ frame .cardreadme.horz
+ scrollbar .cardreadme.horz.hsb -orient horizontal \
+ -command ".cardreadme.file.text xview" \
+ -repeatdelay 1200 -repeatinterval 800
+ scrollbar .cardreadme.file.vsb \
+ -command ".cardreadme.file.text yview" \
+ -repeatdelay 1200 -repeatinterval 800
+ button .cardreadme.ok -text $messages(card.29) \
+ -command "destroy .cardreadme"
+ focus .cardreadme.ok
+ pack .cardreadme.file -side top -fill both
+ pack .cardreadme.file.text -side left
+ pack .cardreadme.file.vsb -side left -fill y
+ #update idletasks
+ #.cardreadme.horz configure -width [winfo width .cardreadme.file.text] \
+ -height [winfo width .cardreadme.file.vsb]
+ #pack propagate .cardreadme.horz 0
+ #pack .cardreadme.horz -side top -anchor w
+ #pack .cardreadme.horz.hsb -fill both
+ pack .cardreadme.ok -side bottom
+ set cardReadmeWasSeen($cardDevNum) 1
+}
+
+proc Card_cardselect { win } {
+ global cardDevNum
+
+ set w [winpathprefix $win]
+ if { ![string length [$w.card.cardselect curselection]] } return
+ Card_set_configvars $win
+ set cardDevNum [$w.card.cardselect curselection]
+ Card_get_configvars $win
+}
+
+proc Card_set_configvars { win } {
+ global DeviceIDs cardServer ServerList cardDevNum
+ global AccelServerList CardChipSets CardRamDacs CardClockChips
+ global cardDacSpeed cardDacProbe cardRamSize UseConfigFile
+
+ set w [winpathprefix $win]
+ set devid [lindex $DeviceIDs $cardDevNum]
+ global Device_$devid messages
+
+ set Device_${devid}(Server) $cardServer
+ set Device_${devid}(Chipset) [$w.card.chipset.cbox eget]
+ set Device_${devid}(Ramdac) [$w.card.ramdac.cbox eget]
+ set Device_${devid}(ClockChip) [$w.card.clockchip.cbox eget]
+ set Device_${devid}(ExtraLines) [$w.card.options.text.text get 0.0 end]
+ set Device_${devid}(Options) [split [$w.card.options.list.cbox eget] ,]
+ if {[llength $DeviceIDs] == 1} {
+ set Device_${devid}(BoardName) [string range \
+ [$w.card.title cget -text] \
+ [string length $messages(card.28)] end]
+ }
+ if { $cardRamSize } {
+ set Device_${devid}(VideoRam) $cardRamSize
+ } else {
+ set Device_${devid}(VideoRam) ""
+ }
+ if { $UseConfigFile } {
+ if { $cardDacProbe } {
+ set Device_${devid}(DacSpeed) ""
+ } else {
+ set Device_${devid}(DacSpeed) [expr $cardDacSpeed*1000]
+ }
+ }
+}
+
+proc Card_get_configvars { win } {
+ global DeviceIDs cardServer ServerList cardDevNum
+ global AccelServerList CardChipSets CardRamDacs CardClockChips
+ global cardDacSpeed cardDacProbe cardRamSize UseConfigFile
+
+ set w [winpathprefix $win]
+ set devid [lindex $DeviceIDs $cardDevNum]
+ global Device_$devid
+
+ set cardServer [set Device_${devid}(Server)]
+ Card_cbox_setentry $w.card.chipset.cbox [set Device_${devid}(Chipset)]
+ Card_cbox_setentry $w.card.ramdac.cbox [set Device_${devid}(Ramdac)]
+ Card_cbox_setentry $w.card.clockchip.cbox [set Device_${devid}(ClockChip)]
+ $w.card.options.text.text delete 0.0 end
+ $w.card.options.text.text insert 0.0 [set Device_${devid}(ExtraLines)]
+ Card_cbox_setentry $w.card.options.list.cbox \
+ [join [set Device_${devid}(Options)] ,]
+ Card_set_cboxlists $win
+ if { $UseConfigFile } {
+ set ram [set Device_${devid}(VideoRam)]
+ if { [string length $ram] > 0 } {
+ set cardRamSize $ram
+ } else {
+ set cardRamSize 0
+ }
+ set speed [set Device_${devid}(DacSpeed)]
+ if { [string length $speed] > 0 } {
+ set cardDacSpeed [expr int($speed/1000)]
+ set cardDacProbe 0
+ } else {
+ set cardDacSpeed 60
+ set cardDacProbe 1
+ }
+ Card_dacspeed $win
+ } else {
+ set cardRamSize 0
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/carddata.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/carddata.tcl
new file mode 100644
index 000000000..ff6b7e3f4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/carddata.tcl
@@ -0,0 +1,520 @@
+# $XConsortium: carddata.tcl /main/8 1996/10/28 05:42:15 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/carddata.tcl,v 3.20 1998/03/20 21:05:21 hohndel Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Data used by the card configuration routines
+#
+
+
+if !$pc98 {
+ set ServerList [list Mono VGA16 SVGA 8514 AGX I128 \
+ Mach8 Mach32 Mach64 P9000 S3 S3V TGA ]
+ set AccelServerList [list 8514 AGX I128 Mach8 Mach32 Mach64 P9000 \
+ S3 S3V TGA ]
+} else {
+ set ServerList [list EGC PEGC GANBWAP NKVNEC TGUI MGA \
+ WABS WABEP WSNA NECS3 PWSKB PWLB GA968 ]
+ set AccelServerList [list EGC PEGC GANBWAP NKVNEC TGUI MGA \
+ WABS WABEP WSNA NECS3 PWSKB PWLB GA968 ]
+}
+
+###
+
+# For each server, what chipsets can be chosen (for the Mono, VGA16,
+# and SVGA servers, the list is broken out by driver)?
+set CardChipSets(SVGA-al2101) al2101
+set CardChipSets(SVGA-ali) { ali2228 ali2301 ali2302 ali2308 ali2401 }
+set CardChipSets(SVGA-apm) ap6422
+set CardChipSets(SVGA-ark) { ark1000vl ark1000pv ark2000pv }
+set CardChipSets(SVGA-ati) ati
+set CardChipSets(SVGA-cl64xx) { cl6410 cl6412 cl6420 cl6440 }
+set CardChipSets(SVGA-cirrus) { clgd5420 clgd5422 clgd5424 clgd5426 \
+ clgd5428 clgd5429 clgd5430 clgd5434 \
+ clgd5436 clgd5446 clgd6215 clgd6225 \
+ clgd6235 clgd7541 clgd7542 clgd7543 }
+#set CardChipSets(SVGA-compaq) cpq_avga
+set CardChipSets(SVGA-chips) { ct65520 ct65530 ct65540 ct65545 \
+ ct65546 ct65548 ct65550 ct65554 \
+ ct65555 ct68554 ct69000 \
+ ct64200 ct64300 \
+ ct451 ct452 ct453 ct455 ct456 ct457 }
+set CardChipSets(SVGA-et3000) et3000
+set CardChipSets(SVGA-et4000) { et4000 et4000w32 et4000w32i et4000w32i_rev_b \
+ et4000w32i_rev_c et4000w32p et4000w32p_rev_a \
+ et4000w32p_rev_b et4000w32p_rev_c \
+ et4000w32p_rev_d, et6000 }
+set CardChipSets(SVGA-gvga) gvga
+set CardChipSets(SVGA-mga) mga2064w
+set CardChipSets(SVGA-mx) mx
+set CardChipSets(SVGA-ncr77c22) { ncr77c22 ncr77c22e }
+set CardChipSets(SVGA-nv) { nv1 stg2000 riva128 }
+set CardChipSets(SVGA-oak) { oti067 oti077 oti087 oti037c }
+set CardChipSets(SVGA-pvga1) { pvga1 \
+ wd90c00 wd90c10 wd90c30 wd90c24 \
+ wd90c31 wd90c31 wd90c33 wd90c20 }
+set CardChipSets(SVGA-realtek) realtek
+#set CardChipSets(SVGA-s3_svga) s3
+set CardChipSets(SVGA-sis) { sis86c201 sis86c202 sis86c205 }
+set CardChipSets(SVGA-tvga8900) { tvga8200lx tvga8800cs tvga8900b tvga8900c \
+ tvga8900cl tvga8900d tvga9000 tvga9000i \
+ tvga9100b tvga9200cxr \
+ tgui9320lcd tgui9400cxi tgui9420 \
+ tgui9420dgi tgui9430dgi tgui9440agi \
+ tgui9660xgi tgui9680 cyber938x }
+set CardChipSets(SVGA-video7) video7
+set chiplist ""
+foreach idx [array names CardChipSets SVGA-*] {
+ eval lappend chiplist $CardChipSets($idx)
+}
+set CardChipSets(SVGA) [concat generic [lrmdups $chiplist]]
+
+set CardChipSets(VGA16-ati) $CardChipSets(SVGA-ati)
+set CardChipSets(VGA16-cl64xx) $CardChipSets(SVGA-cl64xx)
+set CardChipSets(VGA16-et3000) $CardChipSets(SVGA-et3000)
+set CardChipSets(VGA16-et4000) $CardChipSets(SVGA-et4000)
+set CardChipSets(VGA16-ncr77c22) $CardChipSets(SVGA-ncr77c22)
+set CardChipSets(VGA16-oak) $CardChipSets(SVGA-oak)
+set CardChipSets(VGA16-sis) $CardChipSets(SVGA-sis)
+set CardChipSets(VGA16-tvga8900) $CardChipSets(SVGA-tvga8900)
+set chiplist ""
+foreach idx [array names CardChipSets VGA16-*] {
+ eval lappend chiplist $CardChipSets($idx)
+}
+set CardChipSets(VGA16) [concat generic [lrmdups $chiplist]]
+
+set CardChipSets(Mono-ati) $CardChipSets(SVGA-ati)
+set CardChipSets(Mono-cl64xx) $CardChipSets(SVGA-cl64xx)
+set CardChipSets(Mono-cirrus) $CardChipSets(SVGA-cirrus)
+set CardChipSets(Mono-et3000) $CardChipSets(SVGA-et3000)
+set CardChipSets(Mono-et4000) $CardChipSets(SVGA-et4000)
+set CardChipSets(Mono-gvga) $CardChipSets(SVGA-gvga)
+set CardChipSets(Mono-ncr77c22) $CardChipSets(SVGA-ncr77c22)
+set CardChipSets(Mono-oak) $CardChipSets(SVGA-oak)
+set CardChipSets(Mono-pvga1) $CardChipSets(SVGA-pvga1)
+set CardChipSets(Mono-sis) $CardChipSets(SVGA-sis)
+set CardChipSets(Mono-tvga8900) $CardChipSets(SVGA-tvga8900)
+set chiplist ""
+foreach idx [array names CardChipSets Mono-*] {
+ eval lappend chiplist $CardChipSets($idx)
+}
+set CardChipSets(Mono) [concat generic [lrmdups $chiplist]]
+unset chiplist idx
+
+set CardChipSets(8514) { ibm8514 }
+set CardChipSets(AGX) { agx-010 agx-014 agx-015 agx-016 xga-1 xga-2 }
+set CardChipSets(I128) { i128 }
+set CardChipSets(Mach8) { mach8 }
+set CardChipSets(Mach32) { mach32 }
+set CardChipSets(Mach64) { mach64 }
+set CardChipSets(P9000) { orchid_p9000 viperpci vipervlb }
+set CardChipSets(S3) { mmio_928 newmmio s3_generic }
+set CardChipSets(S3V) { s3_virge }
+set CardChipSets(TGA) { tga }
+set CardChipSets(EGC) { vga }
+set CardChipSets(PEGC) { pegc }
+set CardChipSets(GANBWAP) { clgd5426 clgd5428 clgd5429 clgd5430 \
+ clgd5434 clgd5440 clgd5446 clgd7543 \
+ clgd7548 clgd7555 }
+set CardChipSets(NKVNEC) { clgd5426 clgd5428 clgd5429 clgd5430 \
+ clgd5434 clgd5440 clgd5446 clgd7543 \
+ clgd7548 clgd7555 }
+set CardChipSets(WABS) { clgd5426 clgd5428 clgd5429 clgd5430 \
+ clgd5434 clgd5440 clgd5446 clgd7543 \
+ clgd7548 clgd7555 }
+set CardChipSets(WABEP) { clgd5426 clgd5428 clgd5429 clgd5430 \
+ clgd5434 clgd5440 clgd5446 clgd7543 \
+ clgd7548 clgd7555 }
+set CardChipSets(WSNA) { clgd5426 clgd5428 clgd5429 clgd5430 \
+ clgd5434 clgd5440 clgd5446 clgd7543 \
+ clgd7548 clgd7555 }
+set CardChipSets(TGUI) { tgui9660xgi tgui9680 cyber938x }
+set CardChipSets(MGA) { }
+set CardChipSets(NECS3) { s3_generic mmio_928 }
+set CardChipSets(PWSKB) { s3_generic mmio_928 }
+set CardChipSets(PWLB) { mmio_928 s3_generic }
+set CardChipSets(GA968) { newmmio mmio_928 s3_generic }
+
+###
+
+# For each server, what ramdacs can be chosen?
+set CardRamDacs(8514) {}
+set CardRamDacs(AGX) { normal att20c490 bt481 bt482 \
+ herc_dual_dac herc_small_dac \
+ sc15025 xga }
+set CardRamDacs(I128) { ibm526 ibm528 ti3025 }
+set CardRamDacs(Mach8) {}
+set CardRamDacs(Mach32) { ati68830 ati68860 ati68875 \
+ att20c490 att20c491 att21c498 \
+ bt476 bt478 bt481 bt482 bt885 \
+ ims_g173 ims_g174 \
+ inmos176 inmos178 \
+ mu9c1880 mu9c4870 mu9c4910 \
+ sc11483 sc11486 sc11488 \
+ sc15021 sc15025 sc15026 \
+ stg1700 stg1702 \
+ tlc34075 }
+set CardRamDacs(Mach64) { internal \
+ ati68860 ati68860b ati68860c ati68875 \
+ att20c408 att20c491 att20c498 att21c498 \
+ att498 \
+ bt476 bt478 bt481 \
+ ch8398 \
+ ibm_rgb514 \
+ ims_g174 \
+ inmos176 inmos178 \
+ mu9c1880 \
+ sc15021 sc15026 \
+ stg1700 stg1702 stg1703 \
+ tlc34075 \
+ tvp3026 \
+ }
+set CardRamDacs(P9000) {}
+set CardRamDacs(S3) { normal \
+ att20c409 att20c490 att20c491 att20c498 \
+ att20c505 att21c498 att22c498 \
+ bt485 bt9485 \
+ ch8391 \
+ ibm_rgb514 ibm_rgb524 ibm_rgb525 \
+ ibm_rgb526 ibm_rgb528 \
+ ics5300 ics5342 \
+ s3gendac s3_sdac \
+ s3_trio s3_trio32 s3_trio64 \
+ sc11482 sc11483 sc11484 sc11485 \
+ sc11487 sc11489 sc15025 \
+ stg1700 stg1703 \
+ ti3020 ti3025 ti3026 ti3030 \
+ }
+set CardRamDacs(S3V) {} ;# { normal s3_trio64 }
+set CardRamDacs(TGA) { bt485 }
+
+set CardRamDacs(SVGA-ark) { ark1491a att20c490 att20c498 \
+ ics5342 stg1700 \
+ w30c491 w30c498 w30c516 \
+ zoomdac }
+set CardRamDacs(SVGA-ati) [lrmdups [concat \
+ $CardRamDacs(Mach8) \
+ $CardRamDacs(Mach32) \
+ $CardRamDacs(Mach64)] ]
+set CardRamDacs(SVGA-et4000) { normal \
+ att20c47xa att20c490 att20c491 \
+ att20c492 att20c493 att20c497 \
+ ics5341 sc1502x stg1700 stg1702 \
+ stg1703 ch8398 ics5301 et6000 }
+set CardRamDacs(SVGA-mga) ti3026
+set daclist ""
+foreach idx [array names CardRamDacs SVGA-*] {
+ eval lappend daclist $CardRamDacs($idx)
+}
+set CardRamDacs(SVGA) [lrmdups $daclist]
+
+set CardRamDacs(VGA16-ati) $CardRamDacs(SVGA-ati)
+set CardRamDacs(VGA16-et4000) $CardRamDacs(SVGA-et4000)
+set CardRamDacs(VGA16) [lrmdups [concat $CardRamDacs(SVGA-ati) \
+ $CardRamDacs(SVGA-et4000)] ]
+set CardRamDacs(Mono-ati) $CardRamDacs(SVGA-ati)
+set CardRamDacs(Mono-et4000) $CardRamDacs(SVGA-et4000)
+set CardRamDacs(Mono) $CardRamDacs(VGA16)
+
+set CardRamDacs(EGC) {}
+set CardRamDacs(PEGC) {}
+set CardRamDacs(GANBWAP) {}
+set CardRamDacs(NKVNEC) {}
+set CardRamDacs(WABS) {}
+set CardRamDacs(WABEP) {}
+set CardRamDacs(WSNA) {}
+set CardRamDacs(TGUI) {}
+set CardRamDacs(MGA) ti3026
+set CardRamDacs(NECS3) { sc15025 s3_sdac }
+set CardRamDacs(PWSKB) { sc15025 bt478 bt485 s3_gendac att20c498 }
+set CardRamDacs(PWLB) { att20c505 sc15025 ti3025 }
+set CardRamDacs(GA968) ibm_rgb524
+unset daclist idx
+
+###
+
+# For each server, what clockchips can be chosen?
+set CardClockChips(8514) {}
+set CardClockChips(AGX) {}
+set CardClockChips(I128) { ibm_rgb526 ibm_rgb528 ibm_rbg52x ibm_rgb5xx \
+ ti3025 }
+set CardClockChips(Mach8) {}
+set CardClockChips(Mach32) {}
+set CardClockChips(Mach64) { ati18818 att20c408 ch8398 ibm_rgb514 \
+ ics2595 stg1703 }
+set CardClockChips(P9000) { icd2061a }
+set CardClockChips(S3) { att20c409 att20c499 att20c408 \
+ ch8391 dcs2824 \
+ ibm_rgb514 ibm_rgb51x ibm_rgb524 ibm_rgb525 \
+ ibm_rgb528 ibm_rgb52x ibm_rgb5xx \
+ icd2061a ics2595 ics5300 ics5342 ics9161a \
+ s3_aurora64 s3_sdac s3_trio s3_trio32 \
+ s3_trio64 s3_trio64v2 s3gendac \
+ sc11412 stg1703 ti3025 ti3026 ti3030 \
+ }
+set CardClockChips(S3V) {} ;# { s3_trio64 }
+set CardClockChips(TGA) ics1562
+
+set CardClockChips(SVGA-ark) ics5342
+set CardClockChips(SVGA-cirrus) cirrus
+set CardClockChips(SVGA-et4000) { dcs2824 et6000 icd2061a ics5341 ics5301 stg1703 }
+set CardClockChips(SVGA-mga) ti3026
+set CardClockChips(SVGA-pvga1) icd2061A
+set CardClockChips(SVGA-tvga8900) tgui
+set clklist ""
+foreach idx [array names CardClockChips SVGA-*] {
+ eval lappend clklist $CardClockChips($idx)
+}
+set CardClockChips(SVGA) [lrmdups $clklist]
+
+set CardClockChips(VGA16-et4000) $CardClockChips(SVGA-et4000)
+set CardClockChips(VGA16-tvga8900) $CardClockChips(SVGA-tvga8900)
+set CardClockChips(VGA16) [lrmdups [concat $CardClockChips(SVGA-et4000) \
+ $CardClockChips(SVGA-tvga8900)] ]
+
+set CardClockChips(Mono-cirrus) $CardClockChips(SVGA-cirrus)
+set CardClockChips(Mono-et4000) $CardClockChips(SVGA-et4000)
+set CardClockChips(Mono-tvga8900) $CardClockChips(SVGA-tvga8900)
+set CardClockChips(Mono) [lrmdups [concat $CardClockChips(Mono-cirrus) \
+ $CardClockChips(Mono-et4000) \
+ $CardClockChips(Mono-tvga8900)] ]
+
+set CardClockChips(EGC) {}
+set CardClockChips(PEGC) {}
+set CardClockChips(GANBWAP) cirrus
+set CardClockChips(NKVNEC) cirrus
+set CardClockChips(WABS) cirrus
+set CardClockChips(WABEP) cirrus
+set CardClockChips(WSNA) cirrus
+set CardClockChips(TGUI) tgui
+set CardClockChips(MGA) ti3026
+set CardClockChips(NECS3) s3_sdac
+set CardClockChips(PWSKB) { icd2061a s3_gendac }
+set CardClockChips(PWLB) { icd2061a ti3025 }
+set CardClockChips(GA968) {}
+unset clklist idx
+
+# For each server, what options can be chosen?
+set CardOptions(Mono) { 16clocks 8clocks all_wait clgd6225_lcd \
+ clkdiv2 clock_50 clock_66 composite \
+ enable_bitblt epsonmemwin extern_disp \
+ fast_dram favour_bitblt favor_bitblt \
+ fb_debug fifo_aggressive fifo_conservative \
+ first_wwait ga98nb1 ga98nb2 ga98nb4 \
+ hibit_high hibit_low hw_clocks hw_cursor \
+ intern_disp lcd_center lcd_stretch \
+ legend linear med_dram mmio nec_cirrus \
+ noaccel nolinear no_2mb_banksel no_bitblt \
+ no_imageblt no_pci_probe no_pixmap_cache \
+ no_program_clocks \
+ no_wait one_wait pc98_tgui pci_burst_off \
+ pci_burst_on pci_retry power_saver probe_clocks \
+ read_wait secondary \
+ slow_dram swap_hibit sw_cursor tgui_mclk_66 \
+ tgui_pci_read_off tgui_pci_read_on \
+ tgui_pci_write_off tgui_pci_write_on \
+ w32_interleave_off w32_interleave_on \
+ wap write_wait xaa_no_col_exp\
+ }
+set CardOptions(VGA16) { 16clocks all_wait clgd6225_lcd clkdiv2 \
+ clock_50 clock_66 composite enable_bitblt \
+ fast_dram fb_debug fifo_aggressive \
+ fifo_conservative first_wwait hibit_high \
+ hibit_low hw_clocks hw_cursor \
+ lcd_center lcd_stretch legend \
+ linear med_dram \
+ mmio noaccel nolinear no_pci_probe \
+ no_program_clocks no_wait one_wait \
+ pc98_tgui pci_burst_off pci_burst_on pci_retry \
+ power_saver probe_clocks read_wait \
+ secondary \
+ slow_dram tgui_mclk_66 \
+ tgui_pci_read_off tgui_pci_read_on \
+ tgui_pci_write_off tgui_pci_write_on \
+ w32_interleave_off w32_interleave_on \
+ write_wait xaa_no_col_exp\
+ }
+set CardOptions(SVGA) { 16clocks 8clocks all_wait clgd6225_lcd \
+ clkdiv2 clock_50 clock_66 composite \
+ dac_6_bit dac_8_bit early_ras_precharge \
+ enable_bitblt \
+ epsonmemwin extern_disp \
+ ext_fram_buf fast_dram favour_bitblt \
+ favor_bitblt fb_debug fifo_aggressive \
+ fifo_conservative fifo_moderate \
+ first_wwait fix_panel_size \
+ fpm_vram ga98nb1 \
+ ga98nb2 ga98nb4 hibit_high hibit_low \
+ hw_clocks hw_cursor intern_disp \
+ late_ras_precharge lcd_center \
+ lcd_centre legend linear \
+ med_dram mmio nec_cirrus noaccel nolinear \
+ no_2mb_banksel no_bitblt no_imageblt \
+ no_pci_probe no_pixmap_cache \
+ no_program_clocks no_stretch no_wait \
+ one_wait pc98_tgui pci_burst_off\
+ pci_burst_on pci_retry power_saver probe_clocks \
+ read_wait slow_edoram slow_dram stn suspend_hack \
+ swap_hibit sw_cursor sync_on_green \
+ tgui_mclk_66 tgui_pci_read_off \
+ tgui_pci_read_on tgui_pci_write_off \
+ tgui_pci_write_on use_18bit_bus use_modeline \
+ use_vclk1 \
+ w32_interleave_off w32_interleave_on wap \
+ write_wait pci_retry no_pixmap_cache \
+ xaa_benchmark xaa_no_col_exp \
+ }
+set CardOptions(8514) {}
+set CardOptions(AGX) { 8_bit_bus bt482_curs bt485_curs clkdiv2 \
+ crtc_delay dac_6_bit dac_8_bit engine_delay \
+ fast_dram fast_vram s3_fast_vram \
+ fifo_aggressive fifo_conservative \
+ fifo_moderate med_dram noaccel nolinear \
+ no_wait_state refresh_20 refresh_25 \
+ slow_dram slow_vram s3_slow_vram \
+ sprite_refresh screen_refresh sw_cursor \
+ sync_on_green vlb_a vlb_b vram_128 \
+ vram_256 vram_delay_latch vram_delay_ras \
+ vram_extend_ras wait_state \
+ }
+set CardOptions(I128) { dac_8_bit noaccel power_saver showcache \
+ sync_on_green }
+set CardOptions(Mach8) composite
+set CardOptions(Mach32) { clkdiv2 composite dac_8_bit intel_gx \
+ nolinear sw_cursor }
+set CardOptions(Mach64) { block_write clkdiv2 composite dac_6_bit \
+ dac_8_bit hw_cursor no_bios_clocks \
+ no_block_write no_font_cache no_pixmap_cache \
+ no_program_clocks override_bios power_saver \
+ sw_cursor \
+ }
+set CardOptions(P9000) { noaccel sw_cursor sync_on_green vram_128 vram_256 }
+set CardOptions(S3) { bt485_curs clkdiv2 dac_6_bit dac_8_bit \
+ diamond early_ras_precharge elsa_w1000pro \
+ elsa_w1000isa elsa_w2000pro elsa_w2000pro/x8 \
+ epsonmemwin fast_vram \
+ s3_fast_vram fb_debug genoa hercules \
+ ibmrgb_curs late_ras_precharge legend \
+ miro_80sv miro_magic_s4 \
+ necwab noinit nolinear no_font_cache \
+ nomemaccess no_pci_disconnect no_pixmap_cache \
+ no_ti3020_curs \
+ number_nine pchkb pci_hack pcskb pcskb4 \
+ power_saver pw805i pw968 pw_localbus \
+ pw_mux s3_964_bt485_vclk s3_968_dash_bug \
+ showcache slow_dram slow_dram_refresh \
+ s3_slow_dram_refresh slow_edodram slow_vram \
+ s3_slow_vram spea_mercury stb stb_pegasus \
+ sw_cursor sync_on_green ti3020_curs \
+ ti3026_curs trio32_fc_bug trio64v+_bug1 \
+ trio64v+_bug2 trio64v+_bug3 \
+ }
+set CardOptions(S3V) { sw_cursor dac_6_bit dac_8_bit power_saver \
+ slow_dram_refresh slow_edodram slow_vram }
+set CardOptions(TGA) { bt485_cursor dac_6_bit dac_8_bit hw_cursor \
+ power_saver sw_cursor \
+ }
+
+set CardOptions(EGC) {}
+set CardOptions(PEGC) {}
+set CardOptions(GANBWAP) { ga98nb1 ga98nb2 ga98nb4 wap epsonmemwin \
+ sw_cursor }
+set CardOptions(NKVNEC) { nec_cirrus }
+set CardOptions(WABS) {}
+set CardOptions(WABEP) { med_dram }
+set CardOptions(WSNA) { epsonmemwin sw_cursor med_dram }
+set CardOptions(TGUI) { noaccel }
+set CardOptions(MGA) { noaccel }
+set CardOptions(NECS3) { necwab nomemaccess dac_8_bit bt485_curs }
+set CardOptions(PWSKB) { pcskb pcskb4 pchkb pw805i pw_mux \
+ nomemaccess epsonmemwin dac_8_bit \
+ bt485_curs }
+set CardOptions(PWLB) { pw_localbus dac_8_bit bt485_curs numbernine }
+set CardOptions(GA968) {}
+
+# For each server, what readme files are applicable?
+set CardReadmes(SVGA-ark) README.ark
+set CardReadmes(SVGA-ati) README.ati
+set CardReadmes(SVGA-cl64xx) README.cirrus
+set CardReadmes(SVGA-cirrus) README.cirrus
+set CardReadmes(SVGA-chips) README.chips
+set CardReadmes(SVGA-et3000) README.tseng
+set CardReadmes(SVGA-et4000) README.tseng
+set CardReadmes(SVGA-mga) README.MGA
+set CardReadmes(SVGA-nv) README.NV1
+set CardReadmes(SVGA-oak) README.Oak
+set CardReadmes(SVGA-pvga1) README.WstDig
+set CardReadmes(SVGA-s3v) README.S3V
+set CardReadmes(SVGA-sis) README.SiS
+set CardReadmes(SVGA-tvga8900) README.trident
+set CardReadmes(SVGA-video7) README.Video7
+set CardReadmes(SVGA-NONE) README
+set rdmelist ""
+foreach idx [array names CardReadmes SVGA-*] {
+ eval lappend rdmelist $CardReadmes($idx)
+}
+set CardReadmes(SVGA) [concat [lrmdups $rdmelist]]
+
+set CardReadmes(VGA16-ati) $CardReadmes(SVGA-ati)
+set CardReadmes(VGA16-cl64xx) $CardReadmes(SVGA-cl64xx)
+set CardReadmes(VGA16-et3000) $CardReadmes(SVGA-et3000)
+set CardReadmes(VGA16-et4000) $CardReadmes(SVGA-et4000)
+set CardReadmes(VGA16-oak) $CardReadmes(SVGA-oak)
+set CardReadmes(VGA16-tvga8900) $CardReadmes(SVGA-tvga8900)
+set rdmelist ""
+foreach idx [array names CardReadmes VGA16-*] {
+ eval lappend rdmelist $CardReadmes($idx)
+}
+set CardReadmes(VGA16) [concat [lrmdups $rdmelist]]
+
+
+set CardReadmes(Mono-ati) $CardReadmes(SVGA-ati)
+set CardReadmes(Mono-cl64xx) $CardReadmes(SVGA-cl64xx)
+set CardReadmes(Mono-cirrus) $CardReadmes(SVGA-cirrus)
+set CardReadmes(Mono-et3000) $CardReadmes(SVGA-et3000)
+set CardReadmes(Mono-et4000) $CardReadmes(SVGA-et4000)
+set CardReadmes(Mono-oak) $CardReadmes(SVGA-oak)
+set CardReadmes(Mono-pvga1) $CardReadmes(SVGA-pvga1)
+set CardReadmes(Mono-tvga8900) $CardReadmes(SVGA-tvga8900)
+set CardReadmes(Mono) $CardReadmes(SVGA)
+set rdmelist ""
+foreach idx [array names CardReadmes Mono-*] {
+ eval lappend rdmelist $CardReadmes($idx)
+}
+set CardReadmes(Mono) [concat [lrmdups $rdmelist]]
+
+
+set CardReadmes(8514) {}
+set CardReadmes(AGX) README.agx
+set CardReadmes(I128) {}
+set CardReadmes(Mach8) {}
+set CardReadmes(Mach32) README.Mach32
+set CardReadmes(Mach64) README.Mach64
+set CardReadmes(P9000) README.P9000
+set CardReadmes(S3) README.S3
+set CardReadmes(S3V) README.S3V
+set CardReadmes(TGA) README.DECtga
+set CardReadmes(W32) README.W32
+
+set CardReadmes(EGC) {}
+set CardReadmes(PEGC) {}
+set CardReadmes(GANBWAP) README.cirrus
+set CardReadmes(NKVNEC) README.cirrus
+set CardReadmes(WABS) README.cirrus
+set CardReadmes(WABEP) README.cirrus
+set CardReadmes(WSNA) README.cirrus
+set CardReadmes(TGUI) README.trident
+set CardReadmes(MGA) README.MGA
+set CardReadmes(NECS3) README.S3
+set CardReadmes(PWSKB) README.S3
+set CardReadmes(PWLB) README.S3
+set CardReadmes(GA968) README.S3
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c
new file mode 100644
index 000000000..06e6ef3a3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c
@@ -0,0 +1,903 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confread.c,v 1.8 1999/07/12 08:14:25 dawes Exp $ */
+/*
+ * Copyright 1999 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ Functions for converting a XF86ConfigRec to Tcl variables
+
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+
+#include "tcl.h"
+#include "xfsconf.h"
+
+char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
+char *rgbPath = RGB_DB;
+
+#if NeedVarargsPrototypes
+#include <stdarg.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef NEED_SNPRINTF
+#include "snprintf.h"
+#endif
+
+static int getsection_files (Tcl_Interp *interp, char *varpfx);
+static int getsection_module (Tcl_Interp *interp, char *varpfx);
+static int getsection_flags (Tcl_Interp *interp, char *varpfx);
+#ifndef NEW_INPUT
+static int getsection_keyboard(Tcl_Interp *interp, char *varpfx);
+static int getsection_pointer (Tcl_Interp *interp, char *varpfx);
+#endif
+#if 0
+static int getsection_input (Tcl_Interp *interp, char *varpfx);
+static int getsection_dri (Tcl_Interp *interp, char *varpfx);
+#endif
+static int getsection_vidadptr(Tcl_Interp *interp, char *varpfx);
+static int getsection_modes (Tcl_Interp *interp, char *varpfx);
+static int getsection_monitor (Tcl_Interp *interp, char *varpfx);
+static int getsection_device (Tcl_Interp *interp, char *varpfx);
+static int getsection_screen (Tcl_Interp *interp, char *varpfx);
+static int getsection_layout (Tcl_Interp *interp, char *varpfx);
+static int getsection_vendor (Tcl_Interp *interp, char *varpfx);
+
+static void read_options(
+ Tcl_Interp *interp,
+ char *arrname,
+ char *idxname,
+ XF86OptionPtr opts
+);
+
+static void read_modes(
+ Tcl_Interp *interp,
+ char *arrname,
+ char *idxname,
+ XF86ConfModeLinePtr modes
+);
+
+#define APPEND_ELEMENT (TCL_APPEND_VALUE|TCL_LIST_ELEMENT)
+
+#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \
+ "%P/etc/X11/%F,%D/%X,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X"
+
+/*
+ Implements the xf86config_readfile command which locates and reads
+ in the XF86Config file and set the values from it
+*/
+
+int
+TCL_XF86ReadXF86Config(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int pfxarg = 1;
+ char *filename, *cmdline = NULL;
+
+ if (argc > 3) {
+ Tcl_SetResult(interp,
+ "Usage: xf86config_readfile [cmdline] <prefix>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (argc == 3) {
+ cmdline = argv[1];
+ pfxarg = 2;
+ }
+
+ if ((filename = xf86OpenConfigFile(CONFPATH, cmdline, NULL)) == NULL) {
+ Tcl_SetResult(interp,
+ "Unable to open file" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+ Tcl_SetResult(interp, filename, TCL_VOLATILE);
+ if ((config_list = xf86ReadConfigFile()) == NULL) {
+ Tcl_SetResult(interp,
+ "Error parsing config file" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+ xf86CloseConfigFile();
+ getsection_files (interp, argv[pfxarg]);
+ getsection_module (interp, argv[pfxarg]);
+ getsection_flags (interp, argv[pfxarg]);
+#ifndef NEW_INPUT
+ getsection_keyboard(interp, argv[pfxarg]);
+ getsection_pointer (interp, argv[pfxarg]);
+#endif
+#if 0
+ getsection_input (interp, argv[pfxarg]);
+ getsection_dri (interp, argv[pfxarg]);
+#endif
+ getsection_vidadptr(interp, argv[pfxarg]);
+ getsection_modes (interp, argv[pfxarg]);
+ getsection_monitor (interp, argv[pfxarg]);
+ getsection_device (interp, argv[pfxarg]);
+ getsection_screen (interp, argv[pfxarg]);
+ getsection_layout (interp, argv[pfxarg]);
+ getsection_vendor (interp, argv[pfxarg]);
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Files section
+*/
+
+static int
+getsection_files(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char *f, section[128];
+
+ SECTION_NAME("Files");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+
+ Tcl_SetVar2(interp, section, "LogFile",
+ StrOrNull(config_list->conf_files->file_logfile), 0);
+ if (config_list->conf_files->file_fontpath) {
+ f = validate_font_path(config_list->conf_files->file_fontpath);
+ Tcl_SetVar2(interp, section, "FontPath", StrOrNull(f), 0);
+ } else {
+ Tcl_SetVar2(interp, section, "FontPath", defaultFontPath, 0);
+ }
+ if (config_list->conf_files->file_rgbpath)
+ Tcl_SetVar2(interp, section, "RGBPath",
+ config_list->conf_files->file_rgbpath, 0);
+ else
+ Tcl_SetVar2(interp, section, "RGBPath", rgbPath, 0);
+ Tcl_SetVar2(interp, section, "ModulePath",
+ StrOrNull(config_list->conf_files->file_modulepath), 0);
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the ServerFlags section
+*/
+
+static int
+getsection_flags(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+
+ SECTION_NAME("Server");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+
+ if (!config_list->conf_flags)
+ return TRUE;
+
+ read_options(interp, section, NULL,
+ config_list->conf_flags->flg_option_lst);
+ return TCL_OK;
+}
+
+#ifndef NEW_INPUT
+
+/*
+ Set the Tcl variables for the config from the Keyboard section
+*/
+
+static int
+getsection_keyboard(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ XF86ConfKeyboardPtr keyboard;
+ char tmpbuf[128], tmpbuf2[16];
+ int i;
+
+ SECTION_NAME("Keyboard");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+
+ keyboard = config_list->conf_keyboard;
+#ifdef XQUEUE
+ if (!NameCompare(keyboard->keyb_protocol, "Xqueue"))
+ Tcl_SetVar2(interp, section, "Protocol", "Xqueue", 0);
+#endif
+ if (!NameCompare(keyboard->keyb_protocol, "Standard"))
+ Tcl_SetVar2(interp, section, "Protocol", "Standard", 0);
+
+ if (keyboard->keyb_kbdDelay) {
+ sprintf(tmpbuf, "%d", keyboard->keyb_kbdDelay);
+ Tcl_SetVar2(interp, section, "AutoRepeat_delay", tmpbuf, 0);
+ }
+ if (keyboard->keyb_kbdRate) {
+ sprintf(tmpbuf, "%d", keyboard->keyb_kbdRate);
+ Tcl_SetVar2(interp, section, "AutoRepeat_rate", tmpbuf, 0);
+ }
+
+ tmpbuf[0] = '\0';
+ for (i = 1; i < 8; i++) {
+ if (keyboard->keyb_xleds & (1L << (i-1))) {
+ sprintf(tmpbuf2, "%d ", i);
+ strcat(tmpbuf, tmpbuf2);
+ }
+ }
+ Tcl_SetVar2(interp, section, "XLeds", tmpbuf, 0);
+
+#ifdef XKB
+ Tcl_SetVar2(interp, section, "XkbDisable",
+ keyboard->keyb_xkbDisable ? "XkbDisable": "", 0);
+ Tcl_SetVar2(interp, section, "XkbKeycodes",
+ StrOrNull(keyboard->keyb_xkbkeycodes), 0);
+ Tcl_SetVar2(interp, section, "XkbTypes",
+ StrOrNull(keyboard->keyb_xkbtypes), 0);
+ Tcl_SetVar2(interp, section, "XkbCompat",
+ StrOrNull(keyboard->keyb_xkbcompat), 0);
+ Tcl_SetVar2(interp, section, "XkbSymbols",
+ StrOrNull(keyboard->keyb_xkbsymbols), 0);
+ Tcl_SetVar2(interp, section, "XkbGeometry",
+ StrOrNull(keyboard->keyb_xkbgeometry), 0);
+ Tcl_SetVar2(interp, section, "XkbKeymap",
+ StrOrNull(keyboard->keyb_xkbkeymap), 0);
+ Tcl_SetVar2(interp, section, "XkbRules",
+ StrOrNull(keyboard->keyb_xkbrules), 0);
+ Tcl_SetVar2(interp, section, "XkbModel",
+ StrOrNull(keyboard->keyb_xkbmodel), 0);
+ Tcl_SetVar2(interp, section, "XkbLayout",
+ StrOrNull(keyboard->keyb_xkblayout), 0);
+ Tcl_SetVar2(interp, section, "XkbVariant",
+ StrOrNull(keyboard->keyb_xkbvariant), 0);
+ Tcl_SetVar2(interp, section, "XkbOptions",
+ StrOrNull(keyboard->keyb_xkboptions), 0);
+#endif /* XKB */
+
+#if defined(SVR4) && defined(i386) && defined(PC98)
+ Tcl_SetVar2(interp, section, "Panix106",
+ keyboard->keyb_panix106 ? "Panix106": "", 0);
+#endif
+
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Pointer section
+*/
+
+static int
+getsection_pointer(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ char tmpbuf[16];
+ char *name;
+ XF86ConfPointerPtr pntr;
+ int mtoken = -1;
+ int i;
+
+ SECTION_NAME("Pointer");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ pntr = config_list->conf_pointer;
+ name = NULL;
+ if (pntr->pntr_protocol) {
+ if (!NameCompare(pntr->pntr_protocol, "Xqueue"))
+#ifdef XQUEUE
+ name = "Xqueue";
+#else
+ name = NULL;
+#endif
+ if (!NameCompare(pntr->pntr_protocol, "OSMouse"))
+#if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY)
+ name = "OSMouse";
+#else
+ name = NULL;
+#endif
+#ifndef OSMOUSE_ONLY
+ if (name == NULL) {
+ mtoken = string_to_token(xfsMouseTab,
+ pntr->pntr_protocol);
+ if (mtoken >= 0)
+ name = pntr->pntr_protocol;
+ }
+#endif
+ }
+ Tcl_SetVar2(interp, section, "Protocol", StrOrNull(name), 0);
+
+#ifndef OSMOUSE_ONLY
+ Tcl_SetVar2(interp, section, "Device",
+ StrOrNull(pntr->pntr_device), 0);
+ i = pntr->pntr_baudrate;
+ if (i) {
+ if (mtoken == PROT_LOGIMAN && i != 1200 && i != 9600)
+ i = 0;
+ else if (i % 1200 != 0 || i < 1200 || i > 9600)
+ i = 0;
+ }
+ sprintf(tmpbuf, "%d", i);
+ Tcl_SetVar2(interp, section, "BaudRate", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", pntr->pntr_samplerate);
+ Tcl_SetVar2(interp, section, "SampleRate", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", pntr->pntr_resolution);
+ Tcl_SetVar2(interp, section, "Resolution", tmpbuf, 0);
+ Tcl_SetVar2(interp, section, "ChordMiddle",
+ pntr->pntr_chordMiddle ? "ChordMiddle": "", 0);
+
+#ifdef XINPUT
+ Tcl_SetVar2(interp, section, "AlwaysCore",
+ pntr->pntr_alwaysCore ? "AlwaysCore": "", 0);
+#endif
+
+#ifdef CLEARDTR_SUPPORT
+ Tcl_SetVar2(interp, section, "ClearDTR",
+ pntr->pntr_clearDtr ? "ClearDTR": "", 0);
+ Tcl_SetVar2(interp, section, "ClearRTS",
+ pntr->pntr_clearRts ? "ClearRTS": "", 0);
+#endif
+#endif /* OSMOUSE_ONLY */
+
+ sprintf(tmpbuf, "%d", pntr->pntr_buttons);
+ Tcl_SetVar2(interp, section, "Buttons", tmpbuf, 0);
+ Tcl_SetVar2(interp, section, "Emulate3Buttons",
+ pntr->pntr_emulate3Buttons ? "Emulate3Buttons": "", 0);
+ if (pntr->pntr_emulate3Timeout) {
+ sprintf(tmpbuf, "%d", pntr->pntr_emulate3Timeout);
+ Tcl_SetVar2(interp, section, "Emulate3Timeout", tmpbuf, 0);
+ }
+
+ switch (pntr->pntr_positiveZ) {
+ case 0:
+ Tcl_SetVar2(interp, section, "ZAxisPosMapping", "", 0);
+ Tcl_SetVar2(interp, section, "ZAxisNegMapping", "", 0);
+ break;
+ case CONF_ZAXIS_MAPTOX:
+ Tcl_SetVar2(interp, section, "ZAxisPosMapping", "X", 0);
+ Tcl_SetVar2(interp, section, "ZAxisNegMapping", "X", 0);
+ break;
+ case CONF_ZAXIS_MAPTOY:
+ Tcl_SetVar2(interp, section, "ZAxisPosMapping", "Y", 0);
+ Tcl_SetVar2(interp, section, "ZAxisNegMapping", "Y", 0);
+ break;
+ default:
+ sprintf(tmpbuf, "%d", pntr->pntr_negativeZ);
+ Tcl_SetVar2(interp, section, "ZAxisNegMapping", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", pntr->pntr_positiveZ);
+ Tcl_SetVar2(interp, section, "ZAxisPosMapping", tmpbuf, 0);
+ }
+
+ return TCL_OK;
+}
+
+#endif /* NEW_INPUT */
+
+/*
+ Set the Tcl variables for the config from the Monitor sections
+*/
+
+static int
+getsection_monitor(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ int i;
+ char *namebuf, tmpbuf[32];
+ XF86ConfMonitorPtr mptr;
+ XF86ConfModesLinkPtr lptr;
+
+ SECTION_NAME("Monitor");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (mptr = config_list->conf_monitor_lst; mptr; mptr = mptr->list.next) {
+ namebuf = (char *)XtMalloc(strlen(section)
+ + strlen(mptr->mon_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, mptr->mon_identifier);
+
+ Tcl_SetVar2(interp, section, "Identifiers", mptr->mon_identifier,
+ APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, "VendorName",
+ StrOrNull(mptr->mon_vendor), 0);
+ Tcl_SetVar2(interp, namebuf, "ModelName",
+ StrOrNull(mptr->mon_modelname), 0);
+ sprintf(tmpbuf, "%d", mptr->mon_width);
+ Tcl_SetVar2(interp, namebuf, "Width", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", mptr->mon_height);
+ Tcl_SetVar2(interp, namebuf, "Height", tmpbuf, 0);
+
+ Tcl_SetVar2(interp, namebuf, "HorizSync", "", 0);
+ tmpbuf[0] = '\0';
+ for (i = 0; i < mptr->mon_n_hsync; i++) {
+ sprintf(tmpbuf, "%.5g-%.5g",
+ mptr->mon_hsync[i].lo, mptr->mon_hsync[i].hi);
+ Tcl_SetVar2(interp, namebuf, "HorizSync", tmpbuf,
+ APPEND_ELEMENT);
+ }
+
+ Tcl_SetVar2(interp, namebuf, "VertRefresh", "", 0);
+ tmpbuf[0] = '\0';
+ for (i = 0; i < mptr->mon_n_vrefresh; i++) {
+ sprintf(tmpbuf, "%.5g-%.5g",
+ mptr->mon_vrefresh[i].lo, mptr->mon_vrefresh[i].hi);
+ Tcl_SetVar2(interp, namebuf, "VertRefresh", tmpbuf,
+ APPEND_ELEMENT);
+ }
+
+ sprintf(tmpbuf, "%.3g %.3g %.3g",
+ mptr->mon_gamma_red,
+ mptr->mon_gamma_green,
+ mptr->mon_gamma_blue);
+ Tcl_SetVar2(interp, namebuf, "Gamma", tmpbuf, 0);
+
+ read_modes (interp, namebuf, NULL, mptr->mon_modeline_lst);
+ read_options(interp, namebuf, NULL, mptr->mon_option_lst);
+ Tcl_SetVar2 (interp, namebuf, "ModeLinks", "", 0);
+ for (lptr = mptr->mon_modes_sect_lst; lptr; lptr = lptr->list.next) {
+ Tcl_SetVar2 (interp, namebuf, "ModeLinks",
+ lptr->ml_modes_str, APPEND_ELEMENT);
+ }
+
+ XtFree(namebuf);
+ }
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Device sections
+*/
+
+static int
+getsection_device(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ int i;
+ char *namebuf, tmpbuf[128];
+ XF86ConfDevicePtr dptr;
+
+ SECTION_NAME("Device");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (dptr = config_list->conf_device_lst; dptr; dptr = dptr->list.next) {
+ namebuf = XtMalloc(strlen(section)
+ + strlen(dptr->dev_identifier) + 10);
+ sprintf(namebuf, "%s_%s", section, dptr->dev_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", dptr->dev_identifier,
+ APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, "VendorName",
+ StrOrNull(dptr->dev_vendor), 0);
+ Tcl_SetVar2(interp, namebuf, "BoardName",
+ StrOrNull(dptr->dev_board), 0);
+ Tcl_SetVar2(interp, namebuf, "Chipset",
+ StrOrNull(dptr->dev_chipset), 0);
+ Tcl_SetVar2(interp, namebuf, "BusID",
+ StrOrNull(dptr->dev_busid), 0);
+ Tcl_SetVar2(interp, namebuf, "Card",
+ StrOrNull(dptr->dev_card), 0);
+ Tcl_SetVar2(interp, namebuf, "Driver",
+ StrOrNull(dptr->dev_driver), 0);
+ Tcl_SetVar2(interp, namebuf, "Ramdac",
+ StrOrNull(dptr->dev_ramdac), 0);
+ Tcl_SetVar2(interp, namebuf, "DacSpeed",
+ NonZeroStr(dptr->dev_dacSpeeds[0]/1000,10), 0);
+ if (dptr->dev_dacSpeeds[0]/1000 > 0)
+ for (i = 1; i < MAXDACSPEEDS; i++) {
+ if (dptr->dev_dacSpeeds[i]/1000 <= 0)
+ break;
+ sprintf(tmpbuf, "%d", dptr->dev_dacSpeeds[i]/1000);
+ Tcl_SetVar2(interp, namebuf, "DacSpeed",
+ tmpbuf, APPEND_ELEMENT);
+ }
+ Tcl_SetVar2(interp, namebuf, "VideoRam",
+ NonZeroStr(dptr->dev_videoram,10), 0);
+ sprintf(tmpbuf, "%.5g", dptr->dev_textclockfreq/1000.0);
+ Tcl_SetVar2(interp, namebuf, "TextClockFreq", tmpbuf, 0);
+ Tcl_SetVar2(interp, namebuf, "BIOSBase",
+ NonZeroStr(dptr->dev_bios_base,16), 0);
+ Tcl_SetVar2(interp, namebuf, "MemBase",
+ NonZeroStr(dptr->dev_mem_base,16), 0);
+ Tcl_SetVar2(interp, namebuf, "IOBase",
+ NonZeroStr(dptr->dev_io_base,16), 0);
+ Tcl_SetVar2(interp, namebuf, "ClockChip",
+ StrOrNull(dptr->dev_clockchip), 0);
+ Tcl_SetVar2(interp, namebuf, "Clocks", "", 0);
+ for (i = 0; i < dptr->dev_clocks; i++) {
+ sprintf(tmpbuf, "%.5g ", dptr->dev_clock[i]/1000.0);
+ Tcl_SetVar2(interp, namebuf, "Clocks",
+ tmpbuf, APPEND_ELEMENT);
+ }
+ Tcl_SetVar2(interp, namebuf, "ChipID", (dptr->dev_chipid <1) ?
+ "-1": NonZeroStr(dptr->dev_chipid,16), 0);
+ Tcl_SetVar2(interp, namebuf, "ChipRev", (dptr->dev_chiprev <1) ?
+ "-1": NonZeroStr(dptr->dev_chiprev,16), 0);
+
+ read_options(interp, namebuf, NULL, dptr->dev_option_lst);
+ XtFree(namebuf);
+ }
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Screen sections
+*/
+
+static int
+getsection_screen(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ XF86ConfScreenPtr screen;
+ XF86ConfDisplayPtr disp;
+ XF86ModePtr mode;
+ char *namebuf, tmpbuf[128], tmpbuf2[32];
+ int depth;
+
+ SECTION_NAME("Screen");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (screen = config_list->conf_screen_lst; screen; screen = screen->list.next) {
+ namebuf = (char *) XtMalloc(strlen(section)
+ + strlen(screen->scrn_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, screen->scrn_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", screen->scrn_identifier,
+ APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, "Identifier",
+ StrOrNull(screen->scrn_identifier), 0);
+ Tcl_SetVar2(interp, namebuf, "Driver",
+ StrOrNull(screen->scrn_obso_driver), 0);
+ sprintf(tmpbuf, "%d", screen->scrn_defaultdepth);
+ Tcl_SetVar2(interp, namebuf, "DefaultDepth", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", screen->scrn_defaultbpp);
+ Tcl_SetVar2(interp, namebuf, "DefaultBPP", tmpbuf, 0);
+ sprintf(tmpbuf, "%d", screen->scrn_defaultfbbpp);
+ Tcl_SetVar2(interp, namebuf, "DefaultFbBPP", tmpbuf, 0);
+ Tcl_SetVar2(interp, namebuf, "Monitor",
+ StrOrNull(screen->scrn_monitor_str), 0);
+ Tcl_SetVar2(interp, namebuf, "Device",
+ StrOrNull(screen->scrn_device_str), 0);
+
+ Tcl_SetVar2(interp, namebuf, "Depths", "", 0);
+ for (disp = screen->scrn_display_lst; disp; disp = disp->list.next) {
+ depth = disp->disp_depth;
+ sprintf(tmpbuf, "%d", depth);
+ Tcl_SetVar2(interp, namebuf, "Depths", tmpbuf, APPEND_ELEMENT);
+ sprintf(tmpbuf2, "Depth,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, tmpbuf, 0);
+ sprintf(tmpbuf, "%d", disp->disp_bpp);
+ sprintf(tmpbuf2, "BPP,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, tmpbuf, 0);
+
+ if (disp->disp_frameX0 > 0 || disp->disp_frameX0 > 0) {
+ sprintf(tmpbuf, "%d %d",
+ disp->disp_frameX0, disp->disp_frameY0);
+ sprintf(tmpbuf2, "ViewPort,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, tmpbuf, 0);
+ }
+
+ if (disp->disp_virtualX > 0 || disp->disp_virtualY > 0) {
+ sprintf(tmpbuf, "%d %d",
+ disp->disp_virtualX, disp->disp_virtualY);
+ sprintf(tmpbuf2, "Virtual,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, tmpbuf, 0);
+ }
+
+ if (disp->disp_depth == 16 && disp->disp_weight.red > 0) {
+ sprintf(tmpbuf, "%d%d%d",
+ disp->disp_weight.red,
+ disp->disp_weight.green,
+ disp->disp_weight.blue);
+ sprintf(tmpbuf2, "Weight,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, tmpbuf, 0);
+ }
+
+ if (disp->disp_visual) {
+ if (!NameCompare(disp->disp_visual, "StaticGray") ||
+ !NameCompare(disp->disp_visual, "GrayScale") ||
+ !NameCompare(disp->disp_visual, "StaticColor") ||
+ !NameCompare(disp->disp_visual, "PseudoColor") ||
+ !NameCompare(disp->disp_visual, "TrueColor") ||
+ !NameCompare(disp->disp_visual, "DirectColor")) {
+ sprintf(tmpbuf2, "Visual,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, disp->disp_visual, 0);
+ }
+ }
+
+ sprintf(tmpbuf2, "Modes,%d", depth);
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, "", 0);
+ for (mode = disp->disp_mode_lst; mode; mode = mode->list.next) {
+ Tcl_SetVar2(interp, namebuf, tmpbuf2, mode->mode_name,
+ APPEND_ELEMENT);
+ }
+ sprintf(tmpbuf, "%d", depth);
+ read_options(interp, namebuf, tmpbuf, disp->disp_option_lst);
+
+ }
+
+ /* XXX: scrn_adaptor_lst */
+ read_options(interp, namebuf, NULL, screen->scrn_option_lst);
+
+ XtFree(namebuf);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Module section
+*/
+
+static int
+getsection_module(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ XF86LoadPtr lptr;
+
+ SECTION_NAME("Module");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ for (lptr = config_list->conf_modules->mod_load_lst; lptr; lptr = lptr->list.next) {
+ Tcl_SetVar2(interp, section, lptr->load_name,
+ lptr->load_type? "driver": "module", 0);
+ read_options(interp, section, lptr->load_name, lptr->load_opt);
+ }
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Layout section
+*/
+
+static int
+getsection_layout(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], tmpbuf[16], *namebuf;
+ XF86ConfLayoutPtr lptr;
+ XF86ConfAdjacencyPtr aptr;
+ XF86ConfInactivePtr iptr;
+
+ SECTION_NAME("Layout");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (lptr = config_list->conf_layout_lst; lptr; lptr = lptr->list.next) {
+ namebuf = (char *)XtMalloc(strlen(section)
+ + strlen(lptr->lay_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, lptr->lay_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", lptr->lay_identifier,
+ APPEND_ELEMENT);
+
+ Tcl_SetVar2(interp, namebuf, "Screens", "", 0);
+ for (aptr = lptr->lay_adjacency_lst; aptr; aptr = aptr->list.next) {
+ Tcl_SetVar2(interp, namebuf, "Screens",
+ aptr->adj_screen_str, APPEND_ELEMENT);
+ sprintf(tmpbuf, "%d", aptr->adj_scrnum);
+ Tcl_SetVar2(interp, namebuf, aptr->adj_screen_str,
+ tmpbuf, TCL_LIST_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, aptr->adj_screen_str,
+ StrOrNull(aptr->adj_top_str), APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, aptr->adj_screen_str,
+ StrOrNull(aptr->adj_bottom_str), APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, aptr->adj_screen_str,
+ StrOrNull(aptr->adj_left_str), APPEND_ELEMENT);
+ Tcl_SetVar2(interp, namebuf, aptr->adj_screen_str,
+ StrOrNull(aptr->adj_right_str), APPEND_ELEMENT);
+ }
+
+ Tcl_SetVar2(interp, namebuf, "InactiveDevices", "", 0);
+ for (iptr = lptr->lay_inactive_lst; iptr; iptr = iptr->list.next) {
+ Tcl_SetVar2(interp, namebuf, "InactiveDevices",
+ StrOrNull(iptr->inactive_device_str), APPEND_ELEMENT);
+ }
+ read_options(interp, namebuf, NULL, lptr->lay_option_lst);
+ XtFree(namebuf);
+ }
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the VideoAdaptor section
+*/
+
+static int
+getsection_vidadptr(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ char *namebuf;
+ XF86ConfVideoAdaptorPtr aptr;
+ XF86ConfVideoPortPtr pptr;
+
+ SECTION_NAME("VidAdaptr");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (aptr= config_list->conf_videoadaptor_lst; aptr; aptr= aptr->list.next) {
+ namebuf = (char *)XtMalloc(strlen(section)
+ + strlen(aptr->va_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, aptr->va_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", aptr->va_identifier,
+ APPEND_ELEMENT);
+
+ Tcl_SetVar2(interp, namebuf, "VendorName",
+ StrOrNull(aptr->va_vendor), 0);
+ Tcl_SetVar2(interp, namebuf, "BoardName",
+ StrOrNull(aptr->va_board), 0);
+ Tcl_SetVar2(interp, namebuf, "BusID",
+ StrOrNull(aptr->va_busid), 0);
+ Tcl_SetVar2(interp, namebuf, "Driver",
+ StrOrNull(aptr->va_driver), 0);
+ Tcl_SetVar2(interp, namebuf, "VideoPorts", "", 0);
+ for (pptr = aptr->va_port_lst; pptr; pptr = pptr->list.next) {
+ Tcl_SetVar2(interp, namebuf, "VideoPorts",
+ StrOrNull(pptr->vp_identifier), APPEND_ELEMENT);
+ read_options(interp, namebuf, pptr->vp_identifier, pptr->vp_option_lst);
+ }
+ read_options(interp, namebuf, NULL, aptr->va_option_lst);
+ /* XXX what about pptr->va_fwdref??? */
+ }
+ return TCL_OK;
+}
+
+/*
+ Set the Tcl variables for the config from the Modes section
+*/
+
+static int
+getsection_modes(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ char *namebuf;
+ XF86ConfModesPtr mptr;
+
+ SECTION_NAME("Modes");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (mptr = config_list->conf_modes_lst; mptr; mptr = mptr->list.next) {
+ namebuf = (char *)XtMalloc(strlen(section)
+ + strlen(mptr->modes_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, mptr->modes_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", mptr->modes_identifier,
+ APPEND_ELEMENT);
+ read_modes(interp, namebuf, NULL, mptr->mon_modeline_lst);
+ }
+ return TCL_OK;
+}
+
+static int
+getsection_vendor(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ char *namebuf;
+ XF86ConfVendorPtr vptr;
+
+ SECTION_NAME("Vendor");
+ fprintf(stderr, "getsection_%s(%p, %p(%s))\n", section, interp, varpfx, varpfx);
+ Tcl_SetVar2(interp, section, "Identifiers", "", 0);
+ for (vptr = config_list->conf_vendor_lst; vptr; vptr = vptr->list.next) {
+ namebuf = (char *)XtMalloc(strlen(section)
+ + strlen(vptr->vnd_identifier) + 2);
+ sprintf(namebuf, "%s_%s", section, vptr->vnd_identifier);
+ Tcl_SetVar2(interp, section, "Identifiers", vptr->vnd_identifier,
+ APPEND_ELEMENT);
+ read_options(interp, namebuf, NULL, vptr->vnd_option_lst);
+ }
+ return TCL_OK;
+}
+
+static void
+read_options(interp, arrname, idxname, opts)
+ Tcl_Interp *interp;
+ char *arrname, *idxname;
+ XF86OptionPtr opts;
+{
+ char idxbuf[128];
+ char optbuf[128];
+
+ if (idxname) {
+ snprintf(idxbuf, 128, "%s:Options", idxname);
+ } else {
+ strcpy(idxbuf, "Options");
+ }
+ Tcl_SetVar2(interp, arrname, idxbuf, "", 0);
+ for ( ; opts; opts = opts->list.next) {
+ snprintf(optbuf, 128, "%s%sOpt:%s", StrOrNull(idxname),
+ (idxname? "_": ""), opts->opt_name);
+ Tcl_SetVar2(interp, arrname, optbuf, opts->opt_val, 0);
+ Tcl_SetVar2(interp, arrname, idxbuf, opts->opt_name, APPEND_ELEMENT);
+ }
+}
+
+#define APPENDVAL(dfmt,var) { sprintf(tmpbuf2,dfmt,(var)); \
+ Tcl_SetVar2(interp,arrname,modebuf,tmpbuf2,APPEND_ELEMENT); }
+
+static void
+read_modes(interp, arrname, idxname, modes)
+ Tcl_Interp *interp;
+ char *arrname, *idxname;
+ XF86ConfModeLinePtr modes;
+{
+ char idxbuf[128], modebuf[128];
+ char tmpbuf2[16];
+ static seqnum = 0;
+
+ if (idxname) {
+ snprintf(idxbuf, 128, "%s:Modes", idxname);
+ } else {
+ strcpy(idxbuf, "Modes");
+ }
+ Tcl_SetVar2(interp, arrname, idxbuf, "", 0);
+ for ( ; modes; modes = modes->list.next) {
+ snprintf(modebuf, 128, "%.110s%sMode:%d", StrOrNull(idxname),
+ (idxname? "_": ""), ++seqnum);
+ sprintf(tmpbuf2, "%d", seqnum);
+ Tcl_SetVar2(interp, arrname, idxbuf, tmpbuf2, APPEND_ELEMENT);
+ Tcl_SetVar2(interp, arrname, modebuf, modes->ml_identifier, 0);
+
+ APPENDVAL("%.4g", modes->ml_clock/1000.0);
+ APPENDVAL("%d", modes->ml_hdisplay);
+ APPENDVAL("%d", modes->ml_hsyncstart);
+ APPENDVAL("%d", modes->ml_hsyncend);
+ APPENDVAL("%d", modes->ml_htotal);
+ APPENDVAL("%d", modes->ml_vdisplay);
+ APPENDVAL("%d", modes->ml_vsyncstart);
+ APPENDVAL("%d", modes->ml_vsyncend);
+ APPENDVAL("%d", modes->ml_vtotal);
+ if (modes->ml_flags & XF86CONF_INTERLACE)
+ Tcl_SetVar2(interp, arrname, modebuf, "Interlace", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_PHSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "+HSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_NHSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "-HSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_PVSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "+VSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_NVSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "-VSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_CSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "Composite", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_PCSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "+CSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_NCSYNC)
+ Tcl_SetVar2(interp, arrname, modebuf, "-CSync", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_DBLSCAN)
+ Tcl_SetVar2(interp, arrname, modebuf, "DoubleScan", APPEND_ELEMENT);
+ if (modes->ml_flags & XF86CONF_HSKEW) {
+ APPENDVAL("HSkew %d", modes->ml_hskew);
+ }
+ if (modes->ml_vscan) {
+ APPENDVAL("VScan %d", modes->ml_vscan);
+ }
+ }
+}
+
+#undef APPENDVAL
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c
new file mode 100644
index 000000000..c54589983
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c
@@ -0,0 +1,909 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/confwrite.c,v 1.8 1999/07/12 08:14:25 dawes Exp $ */
+/*
+ * Copyright 1999 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains Tcl bindings to the XF86Config file read/write routines
+
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+
+#include "tcl.h"
+#include "xfsconf.h"
+
+#if NeedVarargsPrototypes
+#include <stdarg.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef NEED_SNPRINTF
+#include "snprintf.h"
+#endif
+
+static int putsection_files (Tcl_Interp *interp, char *varpfx);
+static int putsection_module (Tcl_Interp *interp, char *varpfx);
+static int putsection_flags (Tcl_Interp *interp, char *varpfx);
+#ifndef NEW_INPUT
+static int putsection_keyboard(Tcl_Interp *interp, char *varpfx);
+static int putsection_pointer (Tcl_Interp *interp, char *varpfx);
+#endif
+#if 0
+static int putsection_input (Tcl_Interp *interp, char *varpfx);
+static int putsection_dri (Tcl_Interp *interp, char *varpfx);
+#endif
+static int putsection_vidadptr(Tcl_Interp *interp, char *varpfx);
+static int putsection_modes (Tcl_Interp *interp, char *varpfx);
+static int putsection_monitor (Tcl_Interp *interp, char *varpfx);
+static int putsection_device (Tcl_Interp *interp, char *varpfx);
+static int putsection_screen (Tcl_Interp *interp, char *varpfx);
+static int putsection_layout (Tcl_Interp *interp, char *varpfx);
+static int putsection_vendor (Tcl_Interp *interp, char *varpfx);
+
+static int write_options(
+ Tcl_Interp *interp,
+ char *section,
+ char *idxname,
+ XF86OptionPtr *ptr2optptr
+);
+
+static int write_modes(
+ Tcl_Interp *interp,
+ char *section,
+ char *idxname,
+ XF86ConfModeLinePtr *ptr2modeptr
+);
+
+
+/*
+ Implements the xf86config_writefile command which writes
+ values to the XF86Config file
+*/
+
+int
+TCL_XF86WriteXF86Config(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 3) {
+ Tcl_SetResult(interp,
+ "Usage: xf86config_writefile filename varprefix" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ config_list = (XF86ConfigPtr) XtMalloc(sizeof(XF86ConfigRec));
+ memset(config_list, 0, sizeof(XF86ConfigRec));
+
+ putsection_files (interp, argv[2]);
+ putsection_module (interp, argv[2]);
+ putsection_flags (interp, argv[2]);
+#ifndef NEW_INPUT
+ putsection_keyboard(interp, argv[2]);
+ putsection_pointer (interp, argv[2]);
+#endif
+#if 0
+ putsection_input (interp, argv[2]);
+ putsection_dri (interp, argv[2]);
+#endif
+ putsection_vidadptr(interp, argv[2]);
+ putsection_modes (interp, argv[2]);
+ putsection_monitor (interp, argv[2]);
+ putsection_device (interp, argv[2]);
+ putsection_screen (interp, argv[2]);
+ putsection_layout (interp, argv[2]);
+ putsection_vendor (interp, argv[2]);
+
+ if (xf86WriteConfigFile(argv[1], config_list) == 0) {
+ Tcl_SetResult(interp,
+ "Unable to write file" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+#define SETSTR(ptr, idx) \
+ { char *p=Tcl_GetVar2(interp,section,idx,0); \
+ if (p && strlen(p)) { \
+ ptr=XtRealloc(ptr,strlen(p)+1); strcpy(ptr, p); \
+ } else ptr=NULL; }
+#define SETINT(var, idx) \
+ { char *p=Tcl_GetVar2(interp,section,idx,0); \
+ if (p && strlen(p)) Tcl_GetInt(interp, p, &(var)); }
+#define SETBOOL(var, idx) \
+ { char *p=Tcl_GetVar2(interp,section,idx,0); \
+ var = 0; if (p && strlen(p)) var = 1; }
+
+#define SETnSTR(ptr, idx) \
+ { char *p=Tcl_GetVar2(interp,namebuf,idx,0); \
+ if (p && strlen(p)) { \
+ ptr=XtRealloc(ptr,strlen(p)+1); strcpy(ptr, p); \
+ } else ptr=NULL; }
+#define SETnINT(var, idx) \
+ { char *p=Tcl_GetVar2(interp,namebuf,idx,0); \
+ if (p && strlen(p)) Tcl_GetInt(interp, p, &(var)); }
+#define SETnBOOL(var, idx) \
+ { char *p=Tcl_GetVar2(interp,namebuf,idx,0); \
+ var = 0; if (p && strlen(p)) var = 1; }
+
+static int
+putsection_files(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+ XF86ConfFilesPtr fptr;
+
+ fprintf(stderr, "putsection_files(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Files");
+
+ fptr = (XF86ConfFilesPtr) XtMalloc(sizeof(XF86ConfFilesRec));
+ config_list->conf_files = fptr;
+ memset(fptr, 0, sizeof(XF86ConfFilesRec));
+ SETSTR(fptr->file_logfile, "LogFile");
+ SETSTR(fptr->file_fontpath, "FontPath");
+ SETSTR(fptr->file_rgbpath, "RGBPath");
+ SETSTR(fptr->file_modulepath, "ModulePath");
+ return TCL_OK;
+}
+
+static int
+putsection_module(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], buf[160], *tmpbuf, *tmpptr, **idxv;
+ int i, idxc;
+ XF86LoadPtr lptr, prev;
+
+ fprintf(stderr, "putsection_module(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Module");
+
+ config_list->conf_modules =
+ (XF86ConfModulePtr) XtMalloc(sizeof(XF86ConfModuleRec));
+ memset(config_list->conf_modules, 0, sizeof(XF86ConfModuleRec));
+ lptr = config_list->conf_modules->mod_load_lst = NULL;
+
+ strcpy(buf, "array names "); strcat(buf, section);
+ if (Tcl_Eval(interp, buf) != TCL_OK)
+ return TCL_ERROR;
+
+ tmpbuf = XtMalloc(strlen(interp->result)+1);
+ strcpy(tmpbuf, interp->result);
+ if (Tcl_SplitList(interp, tmpbuf, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86LoadPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ if (strstr(idxv[i], "_Opt:") || strstr(idxv[i], ":Options"))
+ continue;
+ lptr = (XF86LoadPtr) XtMalloc(sizeof(XF86LoadRec));
+ memset(lptr, 0, sizeof(XF86LoadRec));
+ if (prev == (XF86LoadPtr) 0) {
+ config_list->conf_modules->mod_load_lst = lptr;
+ } else {
+ prev->list.next = lptr;
+ }
+ lptr->load_name = idxv[i];
+ tmpptr = Tcl_GetVar2(interp, section, idxv[i], 0);
+ if (!NameCompare(tmpptr, "driver")) {
+ lptr->load_type = 1;
+ } else {
+ lptr->load_type = 0;
+ }
+ write_options(interp, section, idxv[i], &(lptr->load_opt));
+ prev = lptr;
+ }
+ XtFree(tmpbuf);
+ return TCL_OK;
+}
+
+static int
+putsection_flags(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128];
+
+ fprintf(stderr, "putsection_flags(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Server");
+
+ if (Tcl_GetVar2(interp, section, "Options", 0) != NULL) {
+ config_list->conf_flags =
+ (XF86ConfFlagsPtr) XtMalloc(sizeof(XF86ConfFlagsRec));
+ memset(config_list->conf_flags, 0, sizeof(XF86ConfFlagsRec));
+ write_options(interp, section, NULL,
+ &(config_list->conf_flags->flg_option_lst));
+ }
+ return TCL_OK;
+}
+
+#ifndef NEW_INPUT
+static int
+putsection_keyboard(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], *ptr;
+ long val;
+ XF86ConfKeyboardPtr kptr;
+
+ fprintf(stderr, "putsection_keyboard(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Keyboard");
+ kptr = (XF86ConfKeyboardPtr) XtMalloc(sizeof(XF86ConfKeyboardRec));
+ config_list->conf_keyboard = kptr;
+ memset(kptr, 0, sizeof(XF86ConfKeyboardRec));
+ SETSTR (kptr->keyb_protocol, "Protocol");
+ ptr = Tcl_GetVar2(interp, section, "AutoRepeat_delay", 0);
+ if (ptr) Tcl_GetInt(interp, ptr, &(kptr->keyb_kbdDelay));
+ ptr = Tcl_GetVar2(interp, section, "AutoRepeat_rate", 0);
+ if (ptr) Tcl_GetInt(interp, ptr, &(kptr->keyb_kbdRate));
+ ptr = Tcl_GetVar2(interp, section, "XLeds", 0);
+ while (ptr && *ptr != '\0') {
+ val = strtoul(ptr, &ptr, 0);
+ if (val > sizeof(long)*8)
+ continue;
+ kptr->keyb_xleds |= 1L << (val - 1);
+ }
+#ifdef XKB
+ SETBOOL(kptr->keyb_xkbDisable, "XkbDisable");
+ SETSTR(kptr->keyb_xkbkeycodes, "XkbKeycodes");
+ SETSTR(kptr->keyb_xkbtypes, "XkbTypes");
+ SETSTR(kptr->keyb_xkbcompat, "XkbCompat");
+ SETSTR(kptr->keyb_xkbsymbols, "XkbSymbols");
+ SETSTR(kptr->keyb_xkbgeometry, "XkbGeometry");
+ SETSTR(kptr->keyb_xkbkeymap, "XkbKeymap");
+ SETSTR(kptr->keyb_xkbrules, "XkbRules");
+ SETSTR(kptr->keyb_xkbmodel, "XkbModel");
+ SETSTR(kptr->keyb_xkblayout, "XkbLayout");
+ SETSTR(kptr->keyb_xkbvariant, "XkbVariant");
+ SETSTR(kptr->keyb_xkboptions, "XkbOptions");
+#endif
+#if defined(SVR4) && defined(i386) && defined(PC98)
+ SETBOOL(kptr->keyb_panix106, "Panix106");
+#endif
+ return TCL_OK;
+}
+
+static int
+putsection_pointer(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], *ptr;
+ XF86ConfPointerPtr pptr;
+
+ fprintf(stderr, "putsection_pointer(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Pointer");
+ pptr = (XF86ConfPointerPtr) XtMalloc(sizeof(XF86ConfPointerRec));
+ config_list->conf_pointer = pptr;
+ memset(pptr, 0, sizeof(XF86ConfPointerRec));
+ SETSTR (pptr->pntr_protocol, "Protocol");
+#ifndef OSMOUSE_ONLY
+ SETSTR (pptr->pntr_device, "Device");
+ SETINT (pptr->pntr_baudrate, "BaudRate");
+ SETINT (pptr->pntr_samplerate, "SampleRate");
+ SETINT (pptr->pntr_resolution, "Resolution");
+ SETBOOL(pptr->pntr_chordMiddle, "ChordMiddle");
+#ifdef XINPUT
+ SETBOOL(pptr->pntr_alwaysCore, "AlwaysCore");
+#endif
+#ifdef CLEARDTR_SUPPORT
+ SETBOOL(pptr->pntr_clearDtr, "ClearDTR");
+ SETBOOL(pptr->pntr_clearRts, "ClearRTS");
+#endif
+#endif /* OSMOUSE_ONLY */
+ SETBOOL(pptr->pntr_emulate3Buttons, "Emulate3Buttons");
+ SETINT (pptr->pntr_emulate3Timeout, "Emulate3Timeout");
+ SETINT (pptr->pntr_buttons, "Buttons");
+ ptr = Tcl_GetVar2(interp, section, "ZAxisPosMapping", 0);
+ if (!strlen(ptr))
+ return TCL_OK;
+ if (!strcmp(ptr, "X")) {
+ pptr->pntr_negativeZ = CONF_ZAXIS_MAPTOX;
+ pptr->pntr_positiveZ = CONF_ZAXIS_MAPTOX;
+ } else if (!strcmp(ptr, "Y")) {
+ pptr->pntr_negativeZ = CONF_ZAXIS_MAPTOY;
+ pptr->pntr_positiveZ = CONF_ZAXIS_MAPTOY;
+ } else {
+ SETINT(pptr->pntr_negativeZ, "ZAxisNegMapping");
+ SETINT(pptr->pntr_positiveZ, "ZAxisPosMapping");
+ }
+ return TCL_OK;
+}
+#endif /* NEW_INPUT */
+
+static int
+putsection_monitor(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv, **tmpv;
+ int i, j, idxc, tmpc;
+ XF86ConfMonitorPtr mptr, prev;
+ XF86ConfModesLinkPtr lptr, lprev;
+
+ fprintf(stderr, "putsection_monitor(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Monitor");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86ConfMonitorPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ mptr = (XF86ConfMonitorPtr) XtMalloc(sizeof(XF86ConfMonitorRec));
+ memset(mptr, 0, sizeof(XF86ConfMonitorRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfMonitorPtr) 0) {
+ config_list->conf_monitor_lst = mptr;
+ } else {
+ prev->list.next = mptr;
+ }
+ mptr->mon_identifier = idxv[i];
+ SETnSTR(mptr->mon_vendor, "VendorName");
+ SETnSTR(mptr->mon_modelname, "ModelName");
+ SETnINT(mptr->mon_width, "Width");
+ SETnINT(mptr->mon_height, "Height");
+ ptr = Tcl_GetVar2(interp, namebuf, "HorizSync", 0);
+ tmpc=0;
+ if (Tcl_SplitList(interp, ptr, &tmpc, &tmpv) != TCL_OK)
+ return TCL_ERROR;
+ fprintf(stderr, "HorizSync = '%s' tmpc=%d\n", ptr, tmpc);
+ mptr->mon_n_hsync = tmpc;
+ for (j = 0; j < tmpc; j++) {
+ fprintf(stderr, "Scanning '%s'\n", tmpv[j]);
+ sscanf(tmpv[j], "%g-%g",
+ &(mptr->mon_hsync[j].lo),
+ &(mptr->mon_hsync[j].hi));
+ }
+ ptr = Tcl_GetVar2(interp, namebuf, "VertRefresh", 0);
+ if (Tcl_SplitList(interp, ptr, &tmpc, &tmpv) != TCL_OK)
+ return TCL_ERROR;
+ mptr->mon_n_vrefresh = tmpc;
+ for (j = 0; j < tmpc; j++) {
+ sscanf(tmpv[j], "%g-%g",
+ &(mptr->mon_vrefresh[j].lo),
+ &(mptr->mon_vrefresh[j].hi));
+ }
+ ptr = Tcl_GetVar2(interp, namebuf, "Gamma", 0);
+ sscanf(ptr, "%g %g %g", &(mptr->mon_gamma_red),
+ &(mptr->mon_gamma_green), &(mptr->mon_gamma_blue));
+ write_modes (interp, namebuf, NULL, &(mptr->mon_modeline_lst));
+ write_options(interp, namebuf, NULL, &(mptr->mon_option_lst));
+ ptr = Tcl_GetVar2(interp, namebuf, "ModeLinks", 0);
+ if (Tcl_SplitList(interp, ptr, &tmpc, &tmpv) != TCL_OK)
+ return TCL_ERROR;
+ lprev = (XF86ConfModesLinkPtr) 0;
+ for (j = 0; j < tmpc; j++) {
+ lptr = (XF86ConfModesLinkPtr) XtMalloc(sizeof(XF86ConfModesLinkRec));
+ memset(mptr, 0, sizeof(XF86ConfModesLinkRec));
+ if (lprev == (XF86ConfModesLinkPtr) 0) {
+ mptr->mon_modes_sect_lst = lptr;
+ } else {
+ lprev->list.next = lptr;
+ }
+ lptr->ml_modes_str = tmpv[j];
+ lprev = lptr;
+ }
+ prev = mptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_device(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv, **av;
+ int i, j, idxc, ac, n;
+ XF86ConfDevicePtr dptr, prev;
+ double tmpdbl;
+
+ fprintf(stderr, "putsection_device(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Device");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86ConfDevicePtr) 0;
+ for (i = 0; i < idxc; i++) {
+ dptr = (XF86ConfDevicePtr) XtMalloc(sizeof(XF86ConfDeviceRec));
+ memset(dptr, 0, sizeof(XF86ConfDeviceRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfDevicePtr) 0) {
+ config_list->conf_device_lst = dptr;
+ } else {
+ prev->list.next = dptr;
+ }
+ dptr->dev_identifier = idxv[i];
+ fprintf(stderr, "identifier = %s\n", idxv[i]);
+ SETnSTR(dptr->dev_vendor, "VendorName");
+ SETnSTR(dptr->dev_board, "BoardName");
+ SETnSTR(dptr->dev_chipset, "Chipset");
+ SETnSTR(dptr->dev_busid, "BusID");
+ SETnSTR(dptr->dev_card, "Card");
+ SETnSTR(dptr->dev_driver, "Driver");
+ SETnSTR(dptr->dev_ramdac, "Ramdac");
+ ptr = Tcl_GetVar2(interp, namebuf, "DacSpeed", 0);
+ if (strlen(ptr)) {
+ if (Tcl_SplitList(interp, ptr, &ac, &av) != TCL_OK)
+ return TCL_ERROR;
+ for (j = 0; j < ac; j++) {
+ Tcl_GetInt(interp, av[j], &n);
+ dptr->dev_dacSpeeds[j] = n * 1000;
+ }
+ }
+ SETnINT(dptr->dev_videoram, "VideoRam");
+ ptr = Tcl_GetVar2(interp, namebuf, "TextClockFreq", 0);
+ if (ptr && strlen(ptr)) {
+ Tcl_GetDouble(interp, ptr, &tmpdbl);
+ dptr->dev_textclockfreq = tmpdbl*1000.0 + 0.5;
+ }
+ ptr = Tcl_GetVar2(interp, namebuf, "BIOSBase", 0);
+ dptr->dev_bios_base = strtoul(ptr, NULL, 16);
+ fprintf(stderr, "BIOSBase = %s\n", ptr);
+ ptr = Tcl_GetVar2(interp, namebuf, "MemBase", 0);
+ dptr->dev_mem_base = strtoul(ptr, NULL, 16);
+ ptr = Tcl_GetVar2(interp, namebuf, "IOBase", 0);
+ dptr->dev_io_base = strtoul(ptr, NULL, 16);
+ SETnSTR(dptr->dev_clockchip, "ClockChip");
+ ptr = Tcl_GetVar2(interp, namebuf, "Clocks", 0);
+ if (strlen(ptr)) {
+ if (Tcl_SplitList(interp, ptr, &ac, &av) != TCL_OK)
+ return TCL_ERROR;
+ dptr->dev_clocks = ac;
+ for (j = 0; j < ac; j++) {
+ Tcl_GetInt(interp, av[j], &n);
+ dptr->dev_clock[j] = n * 1000;
+ }
+ }
+ ptr = Tcl_GetVar2(interp, namebuf, "ChipID", 0);
+ dptr->dev_chipid = strtoul(ptr, NULL, 16);
+ ptr = Tcl_GetVar2(interp, namebuf, "ChipRev", 0);
+ dptr->dev_chiprev = strtoul(ptr, NULL, 16);
+ write_options(interp, namebuf, NULL, &(dptr->dev_option_lst));
+ prev = dptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_screen(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], tmpbuf2[128], *ptr, **idxv, **dv, **mv;
+ int i, j, k, idxc, dc, depth, mc;
+ XF86ConfScreenPtr sptr, sprev;
+ XF86ConfDisplayPtr dptr, dprev;
+ XF86ModePtr mptr, mprev;
+
+ fprintf(stderr, "putsection_screen(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Screen");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ sprev = (XF86ConfScreenPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ sptr = (XF86ConfScreenPtr) XtMalloc(sizeof(XF86ConfScreenRec));
+ memset(sptr, 0, sizeof(XF86ConfScreenRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ fprintf(stderr, "namebuf = %s\n", namebuf);
+ if (sprev == (XF86ConfScreenPtr) 0) {
+ config_list->conf_screen_lst = sptr;
+ } else {
+ sprev->list.next = sptr;
+ }
+ sptr->scrn_identifier = idxv[i];
+ SETnSTR(sptr->scrn_obso_driver, "Driver");
+ SETnINT(sptr->scrn_defaultdepth, "DefaultDepth");
+ SETnINT(sptr->scrn_defaultbpp, "DefaultBPP");
+ SETnINT(sptr->scrn_defaultfbbpp, "DefaultFbBPP");
+ SETnSTR(sptr->scrn_monitor_str, "Monitor");
+ fprintf(stderr, "dev = %p (%s)\n", sptr->scrn_device_str, sptr->scrn_device_str);
+ SETnSTR(sptr->scrn_device_str, "Device");
+ fprintf(stderr, "dev' = %p (%s)\n", sptr->scrn_device_str, sptr->scrn_device_str);
+
+ dprev = (XF86ConfDisplayPtr) 0;
+ ptr = Tcl_GetVar2(interp, namebuf, "Depths", 0);
+ if (Tcl_SplitList(interp, ptr, &dc, &dv) != TCL_OK)
+ return TCL_ERROR;
+ fprintf(stderr, "Depths: %s\n", ptr);
+ for (j = 0; j < dc; j++) {
+ dptr = (XF86ConfDisplayPtr) XtMalloc(sizeof(XF86ConfDisplayRec));
+ memset(dptr, 0, sizeof(XF86ConfDisplayRec));
+ Tcl_GetInt(interp, dv[j], &depth);
+ fprintf(stderr, "depth = %d\n", depth);
+ if (dprev == (XF86ConfDisplayPtr) 0) {
+ sptr->scrn_display_lst = dptr;
+ } else {
+ dprev->list.next = dptr;
+ }
+ dptr->disp_depth = depth;
+ fprintf(stderr, ">>> BPP\n");
+ sprintf(tmpbuf2, "BPP,%d", depth);
+ ptr = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ if (ptr)
+ Tcl_GetInt(interp, ptr, &(dptr->disp_bpp));
+ fprintf(stderr, ">>> ViewPort\n");
+ sprintf(tmpbuf2, "ViewPort,%d", depth);
+ ptr = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ if (ptr)
+ sscanf(ptr, "%d %d",
+ &(dptr->disp_frameX0), &(dptr->disp_frameY0));
+ fprintf(stderr, ">>> Virtual\n");
+ sprintf(tmpbuf2, "Virtual,%d", depth);
+ ptr = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ if (ptr)
+ sscanf(ptr, "%d %d",
+ &(dptr->disp_virtualX), &(dptr->disp_virtualY));
+ fprintf(stderr, ">>> Weight\n");
+ sprintf(tmpbuf2, "Weight,%d", depth);
+ ptr = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ if (ptr)
+ sscanf(ptr, "%1d%1d%1d", &(dptr->disp_weight.red),
+ &(dptr->disp_weight.green), &(dptr->disp_weight.blue));
+ fprintf(stderr, ">>> Visual\n");
+ sprintf(tmpbuf2, "Visual,%d", depth);
+ dptr->disp_visual = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ sprintf(tmpbuf2, "Modes,%d", depth);
+ ptr = Tcl_GetVar2(interp, namebuf, tmpbuf2, 0);
+ if (Tcl_SplitList(interp, ptr, &mc, &mv) != TCL_OK)
+ return TCL_ERROR;
+ fprintf(stderr, "%s '%s'\n", tmpbuf2, ptr);
+ mprev = (XF86ModePtr) 0;
+ for (k = 0; k < mc; k++) {
+ mptr = (XF86ModePtr) XtMalloc(sizeof(XF86ModeRec));
+ memset(mptr, 0, sizeof(XF86ModeRec));
+ if (mprev == (XF86ModePtr) 0) {
+ dptr->disp_mode_lst = mptr;
+ } else {
+ mprev->list.next = mptr;
+ }
+ fprintf(stderr, "Mode ID = '%s' mptr=%p dptr=%p\n", mv[k], mptr, dptr);
+ mptr->mode_name = ConfigStrdup(mv[k]);
+ mprev = mptr;
+ }
+ fprintf(stderr, ">>> Options\n");
+ write_options(interp, namebuf, dv[j], &(dptr->disp_option_lst));
+ dprev = dptr;
+ }
+ write_options(interp, namebuf, NULL, &(sptr->scrn_option_lst));
+ sprev = sptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_layout(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv, **av, **sv;
+ int i, j, idxc, ac, sc;
+ XF86ConfLayoutPtr lptr, prev;
+ XF86ConfAdjacencyPtr aptr, aprev;
+
+ fprintf(stderr, "putsection_layout(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Layout");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ fprintf(stderr, "Identifiers: %s\n", ptr);
+ prev = (XF86ConfLayoutPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ lptr = (XF86ConfLayoutPtr) XtMalloc(sizeof(XF86ConfLayoutRec));
+ memset(lptr, 0, sizeof(XF86ConfLayoutRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfLayoutPtr) 0) {
+ config_list->conf_layout_lst = lptr;
+ } else {
+ prev->list.next = lptr;
+ }
+ lptr->lay_identifier = ConfigStrdup(idxv[i]);
+ aprev = (XF86ConfAdjacencyPtr) 0;
+ ptr = Tcl_GetVar2(interp, namebuf, "Screens", 0);
+ if (Tcl_SplitList(interp, ptr, &sc, &sv) != TCL_OK)
+ return TCL_ERROR;
+ fprintf(stderr, "Screens: %s\n", ptr);
+ for (j = 0; j < sc; j++) {
+ aptr = (XF86ConfAdjacencyPtr) XtMalloc(sizeof(XF86ConfAdjacencyRec));
+ memset(aptr, 0, sizeof(XF86ConfAdjacencyRec));
+ fprintf(stderr, "screen = %s\n", sv[j]);
+ if (aprev == (XF86ConfAdjacencyPtr) 0) {
+ lptr->lay_adjacency_lst = aptr;
+ } else {
+ aprev->list.next = aptr;
+ }
+ aptr->adj_screen_str = ConfigStrdup(sv[j]);
+ ptr = Tcl_GetVar2(interp, namebuf, sv[j], 0);
+ if (Tcl_SplitList(interp, ptr, &ac, &av) != TCL_OK)
+ return TCL_ERROR;
+ Tcl_GetInt(interp, av[0], &(aptr->adj_scrnum));
+ aptr->adj_top_str = ConfigStrdup(av[1]);
+ aptr->adj_bottom_str = ConfigStrdup(av[2]);
+ aptr->adj_left_str = ConfigStrdup(av[3]);
+ aptr->adj_right_str = ConfigStrdup(av[4]);
+ aprev = aptr;
+ }
+ write_options(interp, namebuf, NULL, &(lptr->lay_option_lst));
+ prev = lptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_vidadptr(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv;
+ int i, idxc;
+ XF86ConfVideoAdaptorPtr aptr, prev;
+ XF86ConfVideoPortPtr pptr;
+
+ fprintf(stderr, "putsection_vidadptr(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("VidAdaptr");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86ConfVideoAdaptorPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ aptr = (XF86ConfVideoAdaptorPtr) XtMalloc(sizeof(XF86ConfVideoAdaptorRec));
+ memset(aptr, 0, sizeof(XF86ConfVideoAdaptorRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfVideoAdaptorPtr) 0) {
+ config_list->conf_videoadaptor_lst = aptr;
+ } else {
+ prev->list.next = aptr;
+ }
+ aptr->va_identifier = idxv[i];
+ SETnSTR(aptr->va_vendor, "VendorName");
+ SETnSTR(aptr->va_board, "BoardName");
+ SETnSTR(aptr->va_busid, "BusID");
+ SETnSTR(aptr->va_driver, "Driver");
+ /* XXX aptr->vp_port_lst */
+ write_options(interp, namebuf, NULL, &(aptr->va_option_lst));
+ /* XXX aptr->va_fwdref */
+ prev = aptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_modes(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv;
+ int i, idxc;
+ XF86ConfModesPtr mptr, prev;
+
+ fprintf(stderr, "putsection_modes(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Modes");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86ConfModesPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ mptr = (XF86ConfModesPtr) XtMalloc(sizeof(XF86ConfModesRec));
+ memset(mptr, 0, sizeof(XF86ConfModesRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfModesPtr) 0) {
+ config_list->conf_modes_lst = mptr;
+ } else {
+ prev->list.next = mptr;
+ }
+ mptr->modes_identifier = idxv[i];
+ write_modes(interp, namebuf, NULL, &(mptr->mon_modeline_lst));
+ prev = mptr;
+ }
+ return TCL_OK;
+}
+
+static int
+putsection_vendor(interp, varpfx)
+ Tcl_Interp *interp;
+ char *varpfx;
+{
+ char section[128], namebuf[128], *ptr, **idxv;
+ int i, idxc;
+ XF86ConfVendorPtr vptr, prev;
+
+ fprintf(stderr, "putsection_vendor(%p, %s)\n", interp, varpfx);
+ SECTION_NAME("Vendor");
+ ptr = Tcl_GetVar2(interp, section, "Identifiers", 0);
+ if (Tcl_SplitList(interp, ptr, &idxc, &idxv) != TCL_OK)
+ return TCL_ERROR;
+
+ prev = (XF86ConfVendorPtr) 0;
+ for (i = 0; i < idxc; i++) {
+ vptr = (XF86ConfVendorPtr) XtMalloc(sizeof(XF86ConfVendorRec));
+ memset(vptr, 0, sizeof(XF86ConfVendorRec));
+ snprintf(namebuf, 128, "%s_%s", section, idxv[i]);
+ if (prev == (XF86ConfVendorPtr) 0) {
+ config_list->conf_vendor_lst = vptr;
+ } else {
+ prev->list.next = vptr;
+ }
+ vptr->vnd_identifier = idxv[i];
+ write_options(interp, namebuf, NULL, &(vptr->vnd_option_lst));
+ prev = vptr;
+ }
+ return TCL_OK;
+}
+
+
+static int
+write_options(interp, section, idxname, ptr2optptr)
+ Tcl_Interp *interp;
+ char *section, *idxname;
+ XF86OptionPtr *ptr2optptr;
+{
+ XF86OptionPtr optr, prev;
+ char **optv, *tmpbuf, *optlist, *ptr, *ptr2;
+ int i, optc, idxlen;
+
+ fprintf(stderr, "write_options(%p, %s, %s, %p)\n", interp, section, idxname, ptr2optptr);
+ if (idxname) {
+ idxlen = strlen(idxname);
+ tmpbuf = XtMalloc(idxlen+9);
+ sprintf(tmpbuf, "%s:Options", idxname);
+ } else {
+ idxlen = 0;
+ tmpbuf = XtMalloc(8);
+ strcpy(tmpbuf, "Options");
+ }
+ fprintf(stderr, "tmpbuf = '%s'\n", tmpbuf);
+ optlist = Tcl_GetVar2(interp, section, tmpbuf, 0);
+ fprintf(stderr, "options = %p\n", optlist);
+ Tcl_SplitList(interp, optlist, &optc, &optv);
+ fprintf(stderr, "options: %s\n", optlist);
+
+ prev = (XF86OptionPtr) 0;
+ for (i = 0; i < optc; i++) {
+ ptr = XtMalloc(idxlen+strlen(optv[i])+6);
+ sprintf(ptr, "%s%sOpt:%s", StrOrNull(idxname),
+ (idxname? "_": ""), optv[i]);
+ optr = (XF86OptionPtr) XtMalloc(sizeof(XF86OptionRec));
+ memset(optr, 0, sizeof(XF86OptionRec));
+ fprintf(stderr, "optidx = %s\n", ptr);
+ if (prev == (XF86OptionPtr) 0) {
+ *ptr2optptr = optr;
+ } else {
+ prev->list.next = optr;
+ }
+ optr->opt_name= ConfigStrdup(optv[i]);
+ ptr2 = Tcl_GetVar2(interp, section, ptr, 0);
+ if (strlen(ptr2)) {
+ optr->opt_val = ConfigStrdup(ptr2);
+ }
+ optr->opt_used = 0;
+ prev = optr;
+ XtFree(ptr);
+ }
+ XtFree(tmpbuf);
+ return TCL_OK;
+}
+
+static int
+write_modes(interp, section, idxname, ptr2modeptr)
+ Tcl_Interp *interp;
+ char *section, *idxname;
+ XF86ConfModeLinePtr *ptr2modeptr;
+{
+ XF86ConfModeLinePtr mptr, prev;
+ char **modev, **mlv, *tmpbuf, *modelist, *ptr, *ptr2;
+ int i, j, modec, mlc, idxlen;
+ double tmpclk;
+
+ fprintf(stderr, "write_modes(%p, %s, %s, %p)\n", interp, section, idxname, ptr2modeptr);
+ if (idxname) {
+ idxlen = strlen(idxname);
+ tmpbuf = XtMalloc(idxlen+9);
+ sprintf(tmpbuf, "%s:Modes", idxname);
+ } else {
+ idxlen = 0;
+ tmpbuf = XtMalloc(8);
+ strcpy(tmpbuf, "Modes");
+ }
+ modelist = Tcl_GetVar2(interp, section, tmpbuf, 0);
+ Tcl_SplitList(interp, modelist, &modec, &modev);
+
+ prev = (XF86ConfModeLinePtr) 0;
+ for (i = 0; i < modec; i++) {
+ ptr = XtMalloc(idxlen+strlen(modev[i])+6);
+ sprintf(ptr, "%s%sMode:%s", StrOrNull(idxname),
+ (idxname? "_": ""), modev[i]);
+ mptr = (XF86ConfModeLinePtr) XtMalloc(sizeof(XF86ConfModeLineRec));
+ memset(mptr, 0, sizeof(XF86ConfModeLineRec));
+ if (prev == (XF86ConfModeLinePtr) 0) {
+ *ptr2modeptr = mptr;
+ } else {
+ prev->list.next = mptr;
+ }
+ ptr2 = Tcl_GetVar2(interp, section, ptr, 0);
+ Tcl_SplitList(interp, ptr2, &mlc, &mlv);
+ if (mlc < 10) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Invalid modeline: ", ptr2, NULL);
+ return TCL_ERROR;
+ }
+ mptr->ml_identifier = ConfigStrdup(mlv[0]);
+ Tcl_GetDouble(interp, mlv[1], &(tmpclk));
+ mptr->ml_clock = (int) (tmpclk * 1000.0 + 0.5);
+ Tcl_GetInt(interp, mlv[2], &(mptr->ml_hdisplay));
+ Tcl_GetInt(interp, mlv[3], &(mptr->ml_hsyncstart));
+ Tcl_GetInt(interp, mlv[4], &(mptr->ml_hsyncend));
+ Tcl_GetInt(interp, mlv[5], &(mptr->ml_htotal));
+ Tcl_GetInt(interp, mlv[6], &(mptr->ml_vdisplay));
+ Tcl_GetInt(interp, mlv[7], &(mptr->ml_vsyncstart));
+ Tcl_GetInt(interp, mlv[8], &(mptr->ml_vsyncend));
+ Tcl_GetInt(interp, mlv[9], &(mptr->ml_vtotal));
+
+#define CHKFLAG(str,bit) if (!NameCompare(mlv[j], (str))) { \
+ mptr->ml_flags |= (bit); continue; }
+
+ for (j = 10; j < mlc; j++) {
+ CHKFLAG("Interlace", XF86CONF_INTERLACE);
+ CHKFLAG("+HSync", XF86CONF_PHSYNC);
+ CHKFLAG("-HSync", XF86CONF_NHSYNC);
+ CHKFLAG("+VSync", XF86CONF_PVSYNC);
+ CHKFLAG("-VSync", XF86CONF_NVSYNC);
+ CHKFLAG("Composite", XF86CONF_CSYNC);
+ CHKFLAG("+CSync", XF86CONF_PCSYNC);
+ CHKFLAG("-CSync", XF86CONF_NCSYNC);
+ CHKFLAG("DoubleScan", XF86CONF_DBLSCAN);
+ if (strlen(mlv[j]) > 6 && mlv[j][5] == ' ') {
+ mlv[j][5] = '\0';
+ if (!NameCompare(mlv[j], "HSkew")) {
+ mptr->ml_flags |= XF86CONF_HSKEW;
+ Tcl_GetInt(interp, &(mlv[j][6]), &(mptr->ml_hskew));
+ }
+ if (!NameCompare(mlv[j], "VScan")) {
+ Tcl_GetInt(interp, &(mlv[j][6]), &(mptr->ml_vscan));
+ }
+ mlv[j][5] = ' ';
+ }
+ /* Ignore unknown flags */
+ }
+#undef CHKFLAG
+ prev = mptr;
+ XtFree(ptr);
+ }
+ XtFree(tmpbuf);
+ return TCL_OK;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/done.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/done.tcl
new file mode 100644
index 000000000..1168a12a2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/done.tcl
@@ -0,0 +1,72 @@
+# $XConsortium: done.tcl /main/4 1996/10/25 10:21:11 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/done.tcl,v 3.9 1998/04/05 16:15:49 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Routines run to end the main configuration phase (phase 2)
+#
+
+proc Done_create_widgets { win } {
+ global pc98_EGC messages
+ set w [winpathprefix $win]
+ if !$pc98_EGC {
+ frame $w.done -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.done -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.done.pad -relief raised -bd 3
+ pack $w.done.pad -padx 20 -pady 15 -expand yes
+ label $w.done.pad.text
+ $w.done.pad.text configure -text $messages(done.1)
+ pack $w.done.pad.text -fill both -expand yes
+ button $w.done.pad.okay -text $messages(done.2) \
+ -command [list Done_nextphase $w]
+ pack $w.done.pad.okay -side bottom -pady 10m
+ focus $w.done.pad.okay
+}
+
+proc Done_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.done -side top -fill both -expand yes
+ focus $w.done.pad.okay
+}
+
+proc Done_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.done
+}
+
+proc Done_execute { win } {
+ global CfgSelection
+
+ set w [winpathprefix $win]
+ set CfgSelection Done
+ config_select $w
+}
+
+proc Done_nextphase { win } {
+ global StartServer XF86Setup_library env messages
+
+ set w [winpathprefix $win]
+ if $StartServer {
+ mesg $messages(done.3) info
+ catch {destroy .}
+ catch {server_running -close $env(DISPLAY)}
+ save_state
+ } else {
+ destroy $w.menu $w.done $w.buttons
+ uplevel #0 source $XF86Setup_library/phase4.tcl
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl
new file mode 100644
index 000000000..29572a439
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl
@@ -0,0 +1,105 @@
+# $XConsortium: filelist.tcl /main/2 1996/10/19 18:52:58 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/filelist.tcl,v 3.5 1997/12/05 22:01:27 hohndel Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# List of files that are needed by this program or programs spawned by it.
+# These lists are not meant to be exhaustive, but they should be
+# complete enough to ensure that all the needed .tgz files have been
+# installed
+
+array set FilePermsDescriptions {
+ Libs "X11 libraries"
+ Cfg "configuration and application default files"
+ Fonts "standard font files"
+ DB "device, keysym, error, locale, and color databases"
+ Bin "standard X client programs"
+ VidTune "xvidtune configuration files and/or the xvidtune program"
+ XKB "X keyboard extension programs and configuration files"
+}
+
+array set FilePermsLibs {
+ lib/libX11* 644
+ lib/libXaw* 644
+ lib/libXext* 644
+ lib/libXi* 644
+ lib/libXmu* 644
+ lib/libXtst* 644
+ lib/libSM* 644
+ lib/libICE* 644
+}
+
+array set FilePermsCfg {
+ lib/X11/xinit/xinitrc 444
+ lib/X11/app-defaults/Bitmap 444
+ lib/X11/app-defaults/XLogo 444
+ lib/X11/app-defaults/XTerm 444
+}
+
+array set FilePermsFonts {
+ lib/X11/fonts/misc/fonts.dir 444
+ lib/X11/fonts/misc/fonts.alias 444
+ lib/X11/fonts/misc/6x13.pc* 444
+ lib/X11/fonts/75dpi/fonts.dir 444
+ lib/X11/fonts/75dpi/symb10.pc* 444
+}
+
+array set FilePermsDB {
+ lib/X11/XErrorDB 444
+ lib/X11/XKeysymDB 444
+ lib/X11/rgb.txt 444
+ lib/X11/Cards 444
+ lib/X11/locale/locale.dir 444
+ lib/X11/locale/C/XLC_LOCALE 444
+}
+
+array set FilePermsBin {
+ bin/SuperProbe 755
+ bin/bitmap 755
+ bin/mkfontdir 755
+ bin/twm 755
+ bin/xdpyinfo 755
+ bin/xinit 755
+ bin/xset 755
+ bin/xterm 755
+}
+
+array set FilePermsVidTune {
+ bin/xvidtune 755
+ lib/X11/app-defaults/Xvidtune 444
+}
+
+array set FilePermsXKB {
+ bin/xkbcomp 755
+ lib/X11/xkb/xkbcomp 755
+ lib/X11/xkb/compat/default 444
+ lib/X11/xkb/compiled/README 444
+ lib/X11/xkb/geometry/pc 444
+ lib/X11/xkb/keycodes/xfree86 444
+ lib/X11/xkb/keymap/xfree86 444
+ lib/X11/xkb/semantics/default 444
+ lib/X11/xkb/symbols/us 444
+ lib/X11/xkb/types/default 444
+ lib/X11/xkb/rules/xfree86 444
+ lib/X11/xkb/rules/xfree86.lst 444
+}
+
+array set FilePermsReadMe {
+ lib/X11/doc/README.Oak 444
+ lib/X11/doc/README.ati 444
+ lib/X11/doc/README.trident 444
+ lib/X11/doc/README.agx 444
+ lib/X11/doc/README.Mach64 444
+ lib/X11/doc/README.P9000 444
+ lib/X11/doc/README.S3 444
+ lib/X11/doc/README.tseng 444
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist98.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist98.tcl
new file mode 100644
index 000000000..7ff26ffee
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/filelist98.tcl
@@ -0,0 +1,99 @@
+# $XConsortium: filelist.tcl /main/2 1996/10/19 18:52:58 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/filelist98.tcl,v 1.1 1999/07/11 10:47:13 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# List of files that are needed by this program or programs spawned by it.
+# These lists are not meant to be exhaustive, but they should be
+# complete enough to ensure that all the needed .tgz files have been
+# installed
+
+array set FilePermsDescriptions {
+ Libs "X11 libraries"
+ Cfg "configuration and application default files"
+ Fonts "standard font files"
+ DB "device, keysym, error, locale, and color databases"
+ Bin "standard X client programs"
+ VidTune "xvidtune configuration files and/or the xvidtune program"
+ XKB "X keyboard extension programs and configuration files"
+}
+
+array set FilePermsLibs {
+ lib/libX11* 644
+ lib/libXaw* 644
+ lib/libXext* 644
+ lib/libXi* 644
+ lib/libXmu* 644
+ lib/libXtst* 644
+ lib/libSM* 644
+ lib/libICE* 644
+}
+
+array set FilePermsCfg {
+ lib/X11/xinit/xinitrc 444
+ lib/X11/app-defaults/Bitmap 444
+ lib/X11/app-defaults/XLogo 444
+ lib/X11/app-defaults/XTerm 444
+}
+
+array set FilePermsFonts {
+ lib/X11/fonts/misc/fonts.dir 444
+ lib/X11/fonts/misc/fonts.alias 444
+ lib/X11/fonts/misc/6x13.pc* 444
+ lib/X11/fonts/75dpi/fonts.dir 444
+ lib/X11/fonts/75dpi/symb10.pc* 444
+}
+
+array set FilePermsDB {
+ lib/X11/XErrorDB 444
+ lib/X11/XKeysymDB 444
+ lib/X11/rgb.txt 444
+ lib/X11/Cards98 444
+ lib/X11/locale/locale.dir 444
+ lib/X11/locale/C/XLC_LOCALE 444
+}
+
+array set FilePermsBin {
+ bin/bitmap 755
+ bin/mkfontdir 755
+ bin/twm 755
+ bin/xdpyinfo 755
+ bin/xinit 755
+ bin/xset 755
+ bin/xterm 755
+}
+
+array set FilePermsVidTune {
+ bin/xvidtune 755
+ lib/X11/app-defaults/Xvidtune 444
+}
+
+array set FilePermsXKB {
+ bin/xkbcomp 755
+ lib/X11/xkb/xkbcomp 755
+ lib/X11/xkb/compat/default 444
+ lib/X11/xkb/compiled/README 444
+ lib/X11/xkb/geometry/pc 444
+ lib/X11/xkb/keycodes/xfree98 444
+ lib/X11/xkb/keymap/xfree98 444
+ lib/X11/xkb/semantics/default 444
+ lib/X11/xkb/symbols/us 444
+ lib/X11/xkb/types/default 444
+ lib/X11/xkb/rules/xfree86 444
+ lib/X11/xkb/rules/xfree86.lst 444
+}
+
+array set FilePermsReadMe {
+ lib/X11/doc/README.MGA 444
+ lib/X11/doc/README.S3 444
+ lib/X11/doc/README.cirrus 444
+ lib/X11/doc/README.trident 444
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/kbddata.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/kbddata.tcl
new file mode 100644
index 000000000..b07ac62f4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/kbddata.tcl
@@ -0,0 +1,79 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/kbddata.tcl,v 1.1 1999/04/05 07:12:59 dawes Exp $
+#
+# Copyright 1998 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Data used by the keyboard configuration routines
+#
+
+set XKBrules $Xwinhome/lib/X11/xkb/rules/xfree86
+
+# procedure for determining available XKB settings, when the XKB extension
+# is not available
+#
+proc Kbd_setxkbcomponents {} {
+ global Xwinhome locale XKBrules XKBComponents
+
+ set XKBComponents(models,names) ""
+ set XKBComponents(models,descriptions) ""
+ set XKBComponents(layouts,names) ""
+ set XKBComponents(layouts,descriptions) ""
+ set XKBComponents(variants,names) ""
+ set XKBComponents(variants,descriptions) ""
+ set XKBComponents(options,names) ""
+ set XKBComponents(options,descriptions) ""
+
+ if [file readable ${XKBrules}-$locale.lst] {
+ set fd [open $XKBrules-$locale.lst r]
+ } else {
+ set fd [open $XKBrules.lst r]
+ }
+ set type none
+ set ws "\[ \t]"
+ while { [gets $fd line] >= 0 } {
+ switch -regexp -- $line {
+ "^$ws*$" -
+ "^$ws*//" continue
+ "^! [a-z]+" {
+ set type [string range $line 2 end]
+ set type [string trim $type]
+ }
+ default {
+ switch -- $type {
+ model -
+ layout -
+ variant -
+ option {
+ if ![regexp "^$ws+(\[^ \t]+)$ws+(.+)$" \
+ $line dummy name desc] \
+ continue
+ if { "X$type" == "Xoption" && \
+ [string first : $name] == -1 } \
+ continue
+ lappend XKBComponents(${type}s,names) \
+ $name
+ lappend XKBComponents(${type}s,descriptions) \
+ $desc
+ }
+ }
+ }
+ }
+ }
+ if [string length $XKBComponents(models,names)] \
+ return
+ # Set some defaults, if we couldn't read the rules list
+ set XKBComponents(models,names) "pc101 pc102 pc104 microsoft"
+ set XKBComponents(models,descriptions) [list \
+ "Generic 101-key PC" "Generic 102-key PC" \
+ "Generic 104-key PC" "Microsoft Natural"]
+ set XKBComponents(layouts,names) "us de es fr gb it jp"
+ set XKBComponents(layouts,descriptions) [list \
+ "U.S. English" German Spanish French \
+ "U.K. English" Italian Japanese]
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/keyboard.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/keyboard.tcl
new file mode 100644
index 000000000..4b9ca2423
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/keyboard.tcl
@@ -0,0 +1,292 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/keyboard.tcl,v 3.12 1999/04/05 07:12:59 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: keyboard.tcl /main/2 1996/10/25 10:21:16 kaleb $
+
+#
+# Keyboard configuration routines
+#
+
+proc Keyboard_create_widgets { win } {
+ global XKBComponents XKBavailable XKBhandle
+ global pc98 messages
+
+ set w [winpathprefix $win]
+ if !$pc98 {
+ frame $w.keyboard -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.keyboard -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+
+ frame $w.keyboard.xkb
+ label $w.keyboard.xkb.text -text $messages(keyboard.4)
+ frame $w.keyboard.xkb.geom
+ label $w.keyboard.xkb.geom.title -text $messages(keyboard.1)
+ combobox $w.keyboard.xkb.geom.cbox -bd 2 -width 30
+ eval [list $w.keyboard.xkb.geom.cbox linsert end] \
+ $XKBComponents(models,descriptions)
+ pack $w.keyboard.xkb.geom.title $w.keyboard.xkb.geom.cbox -side top
+ frame $w.keyboard.xkb.lang
+ label $w.keyboard.xkb.lang.title -text $messages(keyboard.2)
+ combobox $w.keyboard.xkb.lang.cbox -bd 2 -width 30
+ eval [list $w.keyboard.xkb.lang.cbox linsert end] \
+ $XKBComponents(layouts,descriptions)
+ pack $w.keyboard.xkb.lang.title $w.keyboard.xkb.lang.cbox -side top
+ frame $w.keyboard.xkb.vari
+ label $w.keyboard.xkb.vari.title -text $messages(keyboard.6)
+ combobox $w.keyboard.xkb.vari.cbox -bd 2 -width 30
+ $w.keyboard.xkb.vari.cbox linsert end "<None>"
+ eval [list $w.keyboard.xkb.vari.cbox linsert end] \
+ $XKBComponents(variants,descriptions)
+ pack $w.keyboard.xkb.vari.title $w.keyboard.xkb.vari.cbox -side top
+ pack $w.keyboard.xkb.text -side top -expand yes -fill both -padx 6m
+ pack $w.keyboard.xkb.geom -side top -expand yes -fill both -padx 6m
+ pack $w.keyboard.xkb.lang -side top -expand yes -fill both -padx 6m
+ pack $w.keyboard.xkb.vari -side top -expand yes -fill both -padx 6m
+ if { $XKBavailable } {
+ bind $w.keyboard.xkb.geom.cbox.popup.list <ButtonRelease-1> \
+ "+Keyboard_loadsettings $win noload"
+ bind $w.keyboard.xkb.geom.cbox.popup <Return> \
+ "+Keyboard_loadsettings $win noload"
+ bind $w.keyboard.xkb.lang.cbox.popup.list <ButtonRelease-1> \
+ "+Keyboard_loadsettings $win noload"
+ bind $w.keyboard.xkb.lang.cbox.popup <Return> \
+ "+Keyboard_loadsettings $win noload"
+ xkbview $w.keyboard.xkb.graphic -height 100 -kbd $XKBhandle \
+ -dbl 1 -bd 6 -relief ridge
+ } else {
+ frame $w.keyboard.xkb.graphic
+ }
+ pack $w.keyboard.xkb.graphic -side top -expand yes -fill x
+ if { $XKBavailable } {
+ button $w.keyboard.xkb.apply -text $messages(keyboard.3) \
+ -command "Keyboard_loadsettings $win load"
+ pack $w.keyboard.xkb.apply -side top -expand yes -fill both
+ }
+ label $w.keyboard.xkb.message -text "" -foreground black
+ pack $w.keyboard.xkb.message -side top -expand yes -fill x
+
+ frame $w.keyboard.options -relief groove -bd 4
+ Keyboard_create_options_widgets $win
+ pack $w.keyboard.xkb -side left -fill both -expand yes -pady 10m
+ pack $w.keyboard.options -side left -fill both -expand no
+ Keyboard_initsettings $win
+}
+
+proc Keyboard_create_options_widgets { win } {
+ global XKBComponents keyboardXkbOpts messages
+
+ set w [winpathprefix $win]
+ set numopts [llength $XKBComponents(options,names)]
+ if { $numopts == 0 } {
+ set keyboardXkbOpts(noopts) -1
+ return
+ }
+
+ label $w.keyboard.options.title -text $messages(keyboard.5)
+ pack $w.keyboard.options.title -fill x \
+ -expand no -pady 3m -side top
+ frame $w.keyboard.options.line -relief sunken -height 2 -bd 3
+ pack $w.keyboard.options.line -fill x \
+ -expand no -pady 3m -side top
+
+ set canv $w.keyboard.options.canvas
+ canvas $canv
+ frame $canv.list
+ set id [$canv create window 0 0 -window $canv.list -anchor nw]
+ for {set idx 0} { $idx < $numopts } {incr idx} {
+ set name [lindex $XKBComponents(options,names) $idx]
+ set desc [lindex $XKBComponents(options,descriptions) $idx]
+ set tmp [split $name :]
+ set value $idx
+ if { [llength $tmp] != 2 } {
+ set next ""
+ if { [expr $idx+1] < $numopts } {
+ set next [lindex $XKBComponents(options,names) \
+ [expr $idx+1] ]
+ }
+ if { [string match $name:* $next] } {
+ label $canv.list.$name -text $desc \
+ -relief ridge -bd 3
+ pack $canv.list.$name -fill both -expand no
+ set tmp [list $name default]
+ set value -1
+ set desc $messages(keyboard.7)
+ set keyboardXkbOpts($name) -1
+ } else {
+ checkbutton $canv.list.$name \
+ -variable keyboardXkbOpts($name) \
+ -text $desc -highlightthickness 1 \
+ -offvalue -1 -onvalue $idx -anchor w \
+ -relief sunken -bd 1
+ pack $canv.list.$name -fill both -expand no
+ set keyboardXkbOpts($name) -1
+ continue
+ }
+ }
+ set group [lindex $tmp 0]
+ set option [lindex $tmp 1]
+ radiobutton $canv.list.$group-$option \
+ -variable keyboardXkbOpts($group) -value $value \
+ -text $desc -highlightthickness 1 -anchor w
+ pack $canv.list.$group-$option -fill both -expand no -padx 3
+ }
+ update idletasks
+ pack $canv -fill y -expand no -side left
+ scrollbar $w.keyboard.options.sb -command "$canv yview" -relief sunken
+ set bbox [$canv bbox $id]
+ $canv configure -yscrollcommand "$w.keyboard.options.sb set" \
+ -scrollregion $bbox -width [lindex $bbox 2]
+ if { [winfo reqheight $canv.list] > [winfo height $w]*.7 } {
+ pack $w.keyboard.options.sb -side left -fill y -expand yes
+ }
+}
+
+proc Keyboard_initsettings { win } {
+ global Keyboard XKBComponents keyboardXkbOpts
+
+ set w [winpathprefix $win]
+ set model $Keyboard(XkbModel)
+ set layout $Keyboard(XkbLayout)
+ set variant $Keyboard(XkbVariant)
+ set options $Keyboard(XkbOptions)
+
+ set tmp [xkb_getrulesprop]
+ if { [llength $tmp] == 5 } {
+ set model [lindex $tmp 1]
+ set layout [lindex $tmp 2]
+ set variant [lindex $tmp 3]
+ set options [lindex $tmp 4]
+ }
+ set geomidx [lsearch -exact $XKBComponents(models,names) $model]
+ if { $geomidx == -1 } {set geomidx 0}
+ set langidx [lsearch -exact $XKBComponents(layouts,names) $layout]
+ if { $langidx == -1 } {set langidx 0}
+ set variidx [lsearch -exact $XKBComponents(variants,names) $variant]
+ incr variidx
+
+ $w.keyboard.xkb.geom.cbox einsert 0 \
+ [lindex $XKBComponents(models,descriptions) $geomidx]
+ $w.keyboard.xkb.lang.cbox einsert 0 \
+ [lindex $XKBComponents(layouts,descriptions) $langidx]
+ if { $variidx } {
+ $w.keyboard.xkb.vari.cbox einsert 0 \
+ [lindex $XKBComponents(variants,descriptions) $variidx]
+ }
+ $w.keyboard.xkb.geom.cbox econfig -state disabled
+ $w.keyboard.xkb.lang.cbox econfig -state disabled
+ $w.keyboard.xkb.vari.cbox econfig -state disabled
+ $w.keyboard.xkb.geom.cbox lselection set $geomidx
+ $w.keyboard.xkb.lang.cbox lselection set $langidx
+ $w.keyboard.xkb.vari.cbox lselection set $variidx
+ $w.keyboard.xkb.geom.cbox activate $geomidx
+ $w.keyboard.xkb.lang.cbox activate $langidx
+ $w.keyboard.xkb.vari.cbox activate $variidx
+ $w.keyboard.xkb.geom.cbox see $geomidx
+ $w.keyboard.xkb.lang.cbox see $langidx
+ $w.keyboard.xkb.vari.cbox see $variidx
+
+ set optlist [split $options ,]
+ set namelist $XKBComponents(options,names)
+ set cl $w.keyboard.options.canvas.list
+ foreach opt $optlist {
+ set tmp [split $opt :]
+ set idx [lsearch -exact $namelist $opt]
+ if { [llength $tmp] != 2 } {
+ if { [winfo exists $cl.$opt-default] } {
+ set keyboardXkbOpts($opt) -1
+ } else {
+ set keyboardXkbOpts($opt) $idx
+ }
+ } else {
+ set keyboardXkbOpts([lindex $tmp 0]) $idx
+ }
+ }
+}
+
+proc Keyboard_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.keyboard -side top -fill both -expand yes
+}
+
+proc Keyboard_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.keyboard
+ Keyboard_loadsettings $win setvars
+}
+
+proc Keyboard_loadsettings { win loadflag } {
+ global XKBComponents XKBrules Keyboard XKBhandle keyboardXkbOpts
+ global messages
+
+ set w [winpathprefix $win]
+ if { $loadflag == "load" } {
+ $w.keyboard.xkb.message configure \
+ -text $messages(keyboard.9)
+ }
+ if { $loadflag == "noload" } {
+ $w.keyboard.xkb.message configure \
+ -text $messages(keyboard.10)
+ }
+ update
+ set geom_idx [$w.keyboard.xkb.geom.cbox curselection]
+ set lang_idx [$w.keyboard.xkb.lang.cbox curselection]
+ set vari_idx [$w.keyboard.xkb.vari.cbox curselection]
+ incr vari_idx -1
+ set geom [lindex $XKBComponents(models,names) $geom_idx]
+ set lang [lindex $XKBComponents(layouts,names) $lang_idx]
+ if { $vari_idx == -1 } {
+ set vari ""
+ } else {
+ set vari [lindex $XKBComponents(variants,names) $vari_idx]
+ }
+ set opts ""
+ foreach key [array names keyboardXkbOpts] {
+ if { $keyboardXkbOpts($key) == -1 } continue
+ set opt [lindex $XKBComponents(options,names) \
+ $keyboardXkbOpts($key)]
+ if { ![string length $opts] } {
+ set opts $opt
+ } else {
+ append opts ",$opt"
+ }
+ }
+
+ if { $loadflag != "setvars" } {
+ set comp [xkb_resolvecomponents \
+ $XKBrules $geom $lang $vari $opts]
+ set notloaded [catch {eval xkb_load $comp $loadflag} kbd]
+ if { $notloaded } {
+ $w.keyboard.xkb.message configure \
+ -text $messages(keyboard.8)
+ bell
+ after 1000
+ } else {
+ xkb_free $XKBhandle
+ set XKBhandle $kbd
+ $w.keyboard.xkb.graphic configure -kbd $kbd
+ if { $loadflag != "noload" } {
+ xkb_setrulesprop $XKBrules \
+ $geom $lang $vari $opts
+ set Keyboard(XkbModel) $geom
+ set Keyboard(XkbLayout) $lang
+ set Keyboard(XkbVariant) $vari
+ set Keyboard(XkbOptions) $opts
+ }
+ }
+ } else {
+ set Keyboard(XkbModel) $geom
+ set Keyboard(XkbLayout) $lang
+ set Keyboard(XkbVariant) $vari
+ set Keyboard(XkbOptions) $opts
+ }
+ focus $w
+ $w.keyboard.xkb.message configure -text ""
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/main.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/main.c
new file mode 100644
index 000000000..29849a1c6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/main.c
@@ -0,0 +1,659 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/main.c,v 3.16 1999/04/25 10:01:57 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/* $XConsortium: main.c /main/2 1996/10/23 13:12:09 kaleb $ */
+
+
+/*
+ * Main procedure for XF86Setup, by Joe Moss
+ */
+
+#include <stdio.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xos.h>
+#include <tcl.h>
+#include <tk.h>
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+
+#if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX)
+#include <sys/resource.h>
+#endif
+
+#if TK_MAJOR_VERSION < 4 || (TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION < 1)
+#error You must use Tk 4.1 or newer
+#endif
+
+static Tcl_Interp *interp;
+
+static char *name = NULL; /* name of application */
+static char *display = NULL; /* display to connect to */
+static char *geometry = NULL; /* initial geometry spec */
+static char *statefile = NULL; /* file containing state vars */
+static char *LibDir; /* where the tcl src files are */
+static int rest = 0; /* arg after options */
+static int synchronize = 0; /* sync X connection */
+static int nocurses = 0; /* Don't use curses */
+static int notk = 0; /* Don't add Tk to interp */
+static int usescriptdir = 0; /* Use script dir, not PATH */
+static Boolean pc98 = FALSE; /* machine architecure */
+static int pc98_EGC = 0; /* default server */
+#define PHASE1 "phase1.tcl"
+#define PHASE2 "phase2.tcl"
+#define PHASE3 "phase3.tcl"
+#define PHASE4 "phase4.tcl"
+#define PHASE5 "phase5.tcl"
+
+#define PHASE2NOTK "ph2notk.tcl"
+
+/*
+ Initialization code - sets the Xwinhome, XF86Setup_library,
+ tcl_library, and tk_library variables and checks for the
+ the existence of the startup file (phase1)
+*/
+
+#ifndef PROJECTROOT
+#define PROJECTROOT ""
+#endif
+
+static char Set_InitVars[] =
+ "if [info exists env(XWINHOME)] {\n"
+ " set Xwinhome $env(XWINHOME)\n"
+ "} else {\n"
+ " set xdirs [list " PROJECTROOT " /usr/X11R6 /usr/X11 "
+ "/usr/X /var/X11R6 /var/X11 /var/X /usr/X11R6.3 "
+ "/usr/local/X11R6 /usr/local/X11 /usr/local/X]\n"
+ " foreach dir $xdirs {\n"
+ " if {[llength [glob -nocomplain $dir/bin/XF86_* $dir/bin/XF98_*]] } {\n"
+ " set Xwinhome $dir\n"
+ " break\n"
+ " }\n"
+ " }\n"
+ " if ![info exists Xwinhome] {\n"
+ " error \"Couldn't determine where you have XFree86 installed.\\n"
+ "If you have XFree86 properly installed, set the "
+ "XWINHOME environment\\n variable to point to the "
+ "parent directory of the XFree86 bin directory.\\n\"\n"
+ " }\n"
+ " unset xdirs dir\n"
+ "}\n"
+ "if [info exists env(XF86SETUPLIB)] {\n"
+ " set XF86Setup_library $env(XF86SETUPLIB)\n"
+ "} else {\n"
+ " set XF86Setup_library $Xwinhome/lib/X11/XF86Setup\n"
+ "}\n"
+ "set tk_library [set tcl_library $XF86Setup_library/tcllib]\n"
+ "set XF86Setup_startup $XF86Setup_library/" PHASE1 "\n"
+ "if ![file exists $XF86Setup_startup] {\n"
+ " error \"The startup file for this program ($XF86Setup_startup)\\n"
+ "is missing. You need to install it before running "
+ "this program.\\n\"\n"
+ "} else {\n"
+ " if ![file readable $XF86Setup_startup] {\n"
+ " error \"The startup file for this program "
+ "($XF86Setup_startup)\\ncan't be accessed. "
+ "Perhaps a permission problem?\\n\"\n"
+ " }\n"
+ "}\n"
+ ;
+
+static char usage_msg[] =
+ "Usage: %s [options] [filename] [--] [arg ...]\n"
+ "Options always available:\n"
+ " -sync Use synchronous mode for display server\n"
+ " -name <name> Name to use for application\n"
+ " -notk Don't open a connection to the X server\n"
+#ifdef PC98
+ " -egc Use EGC server\n"
+ " -pegc Use PEGC server\n"
+#endif
+ "\n"
+ "Options available only when a filename is specified:\n"
+ " -display <disp> Display to use\n"
+ " -geometry <geom> Initial geometry for window\n"
+ " -script Look for filename in script directory\n"
+ "\n"
+ "Options available only when a filename is not specified:\n"
+ " -nocurses Don't use curses for user interaction\n"
+ "Any args after the double dashes (--) are passed to the script\n"
+ ;
+
+static Tk_ArgvInfo argTable[] = {
+ {"-display", TK_ARGV_STRING, (char *) NULL, (char *) &display,
+ "Display to use"},
+ {"-geometry", TK_ARGV_STRING, (char *) NULL, (char *) &geometry,
+ "Initial geometry for window"},
+ {"-name", TK_ARGV_STRING, (char *) NULL, (char *) &name,
+ "Name to use for application"},
+ {"-sync", TK_ARGV_CONSTANT, (char *) 1, (char *) &synchronize,
+ "Use synchronous mode for display server"},
+ {"-nocurses", TK_ARGV_CONSTANT, (char *) 1, (char *) &nocurses,
+ "Don't use curses for interaction with user"},
+ {"-notk", TK_ARGV_CONSTANT, (char *) 1, (char *) &notk,
+ "Don't open a connection to the X server or load Tk widgets"},
+ {"-script", TK_ARGV_CONSTANT, (char *) 1, (char *) &usescriptdir,
+ "Look for filename in the scripts directory"},
+ {"-egc", TK_ARGV_CONSTANT, (char *) 1, (char *) &pc98_EGC,
+ "Use egc"},
+ {"-pegc", TK_ARGV_CONSTANT, (char *) 0, (char *) &pc98_EGC,
+ "Use pegc"},
+ {"--", TK_ARGV_REST, (char *) 1, (char *) &rest,
+ "Pass all remaining arguments through to script"},
+ /* This one is undocumented - it's used when execing a 2nd copy */
+ {"-statefile", TK_ARGV_STRING, (char *) NULL, (char *) &statefile, ""},
+ {(char *) NULL, TK_ARGV_END, (char *) NULL, (char *) NULL,
+ (char *) NULL}
+};
+
+extern int Curses_Init(Tcl_Interp *interp);
+extern int XF86Other_Init(Tcl_Interp *interp);
+extern int XF86TkOther_Init(Tcl_Interp *interp);
+extern int Cards_Init(Tcl_Interp *interp);
+extern int XF86Config_Init(Tcl_Interp *interp);
+extern int XF86vid_Init(Tcl_Interp *interp);
+extern int XF86Misc_Init(Tcl_Interp *interp);
+extern int XF86Kbd_Init(Tcl_Interp *interp);
+static void XF86Setup_TclEvalFile(Tcl_Interp *interp, char *filename);
+static void XF86Setup_TclRunScript(Tcl_Interp *interp, char *filename);
+static void XF86Setup_TkInit(
+ Tcl_Interp *interp,
+ char *display,
+ char *appname
+);
+static void kill_server(Tcl_Interp *interp);
+
+/*
+ Runs the commands in the specified file in the lib directory
+
+ If an error occurs while processing, the error message is printed
+ and the program exits
+*/
+static void
+XF86Setup_TclEvalFile(interp, filename)
+ Tcl_Interp *interp;
+ char *filename;
+{
+ int retval;
+ char *msg;
+
+ retval = Tcl_VarEval(interp, "source ",
+ LibDir, "/", filename, (char *) NULL);
+ if (retval != TCL_OK) {
+ msg = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
+ if (msg == NULL) {
+ msg = interp->result;
+ }
+ fprintf(stderr, "%s\n", msg);
+ Tcl_Eval(interp, "exit 1");
+ }
+ fflush(stdout);
+ Tcl_ResetResult(interp);
+}
+
+/*
+ Runs the commands in the specified file - search PATH, if needed
+
+ If an error occurs while processing, the error message is printed
+ and the program exits
+*/
+static void
+XF86Setup_TclRunScript(interp, filename)
+ Tcl_Interp *interp;
+ char *filename;
+{
+ int retval;
+ char *msg;
+
+ if (!usescriptdir) {
+ retval = Tcl_VarEval(interp,
+ "if {[string first ", filename, " /] != -1} {",
+ "source ", filename,
+ "} else {",
+ "foreach dir [split $env(PATH) :] {",
+ "if [file executable $dir/", filename, "] {",
+ "source $dir/", filename, "; return 0",
+ "}",
+ "}\n",
+ "error {File not found: ", filename, "}\n",
+ "}",
+ (char *) NULL);
+ } else {
+ retval = Tcl_VarEval(interp,
+ "if {[string first ", filename, " /] != -1} {",
+ "source ", filename,
+ "} else {",
+ "source $XF86Setup_library/scripts/", filename,
+ "}",
+ (char *) NULL);
+ }
+
+ if (retval != TCL_OK) {
+ msg = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
+ if (msg == NULL) {
+ msg = interp->result;
+ }
+ fprintf(stderr, "%s\n", msg);
+ Tcl_Eval(interp, "exit 1");
+ }
+ fflush(stdout);
+ Tcl_ResetResult(interp);
+}
+
+#define print_result_and_exit {fprintf(stderr,"%s\n",interp->result); exit(1);}
+
+/*
+
+ Main function for XF86Setup.
+
+ Creates a Tcl interpreter and adds various extensions to it.
+ Then if a filename is not given on the command line, it executes
+ the commands in either phase1.tcl or phase3.tcl
+ Tk is then added to the interpreter, as well as various X related
+ extensions
+ If a filename was given, it is then executed, otherwise either
+ phase2.tcl or phase4.tcl is run
+ If phase2.tcl was run, the server is shutdown and then a new
+ invocation of XF86Setup is exec-ed
+ If phase4.tcl was run, the server is shutdown and phase5.tcl run
+
+*/
+
+void
+main(int argc, char **argv)
+{
+ char *tmpptr, *filename, *argv0, tmpbuf[20], buf[128];
+ int Phase2FallBack = 0;
+
+#ifdef RLIMIT_STACK
+#define STACK_SIZE (2048*1024)
+
+ struct rlimit rlim;
+
+ if (!getrlimit(RLIMIT_STACK, &rlim))
+ {
+ if (STACK_SIZE < rlim.rlim_max)
+ rlim.rlim_cur = STACK_SIZE;
+ else
+ rlim.rlim_cur = rlim.rlim_max;
+ (void)setrlimit(RLIMIT_STACK, &rlim);
+ }
+#undef STACK_SIZE
+#endif
+
+ /**** Create the Tcl interpreter ****/
+ interp = Tcl_CreateInterp();
+
+ /**** Parse the command line args ****/
+ if (Tk_ParseArgv(interp, (Tk_Window) NULL, &argc, argv, argTable, 0)
+ != TCL_OK) {
+ fprintf(stderr, usage_msg, argv[0]);
+ exit(1);
+ }
+
+ if (argc == 1)
+ filename = NULL;
+ else if (argc == 2)
+ filename = argv[1];
+ else {
+ if (rest == 0 || rest == 2)
+ filename = argv[1];
+ else {
+ fprintf(stderr, usage_msg, argv[0]);
+ exit(1);
+ }
+ }
+
+ /**** Add the commands to the Tcl interpreter for the
+ convenience functions ****/
+
+ if (XF86Other_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Add the commands to the Tcl interpreter that interface
+ with the Cards database ****/
+
+ if (Cards_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Add the commands to the Tcl interpreter that interface
+ with the XF86Config reading routines ****/
+
+ if (XF86Config_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ if (Curses_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Find where things are installed ****/
+ if (Tcl_Eval(interp, Set_InitVars) != TCL_OK)
+ print_result_and_exit;
+
+ LibDir = Tcl_GetVar(interp, "XF86Setup_library", TCL_GLOBAL_ONLY);
+
+ /**** This program will not be used interactively as a shell ****/
+ Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
+
+ /**** Make command-line arguments available to scripts ****/
+
+ argv0 = argv[0];
+ if (filename != NULL) {
+ tmpptr = Tcl_Merge(argc-2, argv+2);
+ sprintf(tmpbuf, "%d", argc-2);
+ } else {
+ tmpptr = Tcl_Merge(argc-1, argv+1);
+ sprintf(tmpbuf, "%d", argc-1);
+ }
+ Tcl_SetVar(interp, "argv", tmpptr, TCL_GLOBAL_ONLY);
+ XtFree(tmpptr);
+ Tcl_SetVar(interp, "argc", tmpbuf, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "argv0", argv0, TCL_GLOBAL_ONLY);
+#ifdef PC98
+ nocurses = 1;
+ Tcl_SetVar(interp, "pc98", "1", TCL_GLOBAL_ONLY);
+ if (pc98_EGC) {
+#if defined(linux) || defined(SVR4)
+ fprintf(stderr, "Sorry, EGC server doesn't work on this OS.\n");
+ fprintf(stderr, "-egc option can't be used.\n");
+ exit(1);
+#endif
+ Tcl_SetVar(interp, "pc98_EGC", "1", TCL_GLOBAL_ONLY);
+ } else {
+ Tcl_SetVar(interp, "pc98_EGC", "0", TCL_GLOBAL_ONLY);
+ }
+#if defined(linux)
+ printf("\033[98;0]"); /* set euc mode */
+ fflush(stdout);
+#endif
+#else
+ Tcl_SetVar(interp, "pc98", "0", TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "pc98_EGC", "0", TCL_GLOBAL_ONLY);
+#endif
+
+ Tcl_LinkVar(interp, "NoCurses", (char *) &nocurses, TCL_LINK_BOOLEAN);
+ Tcl_LinkVar(interp, "NoTk", (char *) &notk, TCL_LINK_BOOLEAN);
+
+ if (filename == NULL) {
+ Tcl_LinkVar(interp, "Phase2FallBack",
+ (char *)&Phase2FallBack, TCL_LINK_BOOLEAN);
+ if (statefile == NULL) {
+ /**** Execute the Phase I Tcl code ****/
+ XF86Setup_TclEvalFile(interp, PHASE1);
+ } else {
+ Tcl_SetVar(interp, "StateFileName",
+ statefile, TCL_GLOBAL_ONLY);
+ /**** Execute the Phase III Tcl code ****/
+ XF86Setup_TclEvalFile(interp, PHASE3);
+ }
+ tmpptr = Tcl_GetVar(interp, "ExitStatus", TCL_GLOBAL_ONLY);
+ if (tmpptr) {
+ Tcl_VarEval(interp, "exit ", tmpptr, (char *)0);
+ exit(1);
+ }
+ } else {
+ if (notk) {
+ /**** Load the default bindings ****/
+ strcpy(buf, "source $tk_library/init.tcl");
+ if (Tcl_Eval(interp, buf) != TCL_OK)
+ print_result_and_exit;
+ XF86Setup_TclRunScript(interp, filename);
+ Tcl_Eval(interp, "exit 0");
+ exit(1);
+ }
+ }
+
+ /* If the app name wasn't given, use the filename or argv[0] */
+ if (name == NULL) {
+ if (filename == NULL) {
+ name = strrchr(argv0, '/');
+ if (name != NULL)
+ name++;
+ else
+ name = argv0;
+ } else
+ name = filename;
+ }
+
+ if (filename == NULL)
+ display = NULL;
+
+ if (!notk) {
+ /**** Here is the first routine that needs to have an X
+ server running. It tries to create a window and will,
+ of course, fail if the server isn't running ****/
+
+ XF86Setup_TkInit(interp, display, name);
+
+ if (filename != NULL) {
+ /*
+ * Set the geometry of the main window, if requested. Put the
+ * requested geometry into the "geometry" variable.
+ */
+
+ if (geometry != NULL) {
+ Tcl_SetVar(interp, "geometry", geometry, TCL_GLOBAL_ONLY);
+ if (Tcl_VarEval(interp, "wm geometry . ", geometry, (char *) NULL)
+ != TCL_OK) {
+ fprintf(stderr, "%s\n", interp->result);
+ }
+ }
+
+ /**** set the DISPLAY environment variable ****/
+ if (display != NULL)
+ Tcl_SetVar2(interp, "env", "DISPLAY", display, TCL_GLOBAL_ONLY);
+ }
+
+ /**** Add the commands to the Tcl interpreter that interface
+ with the XFree86-VidModeExtension ****/
+
+ if (XF86vid_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Add the commands to the Tcl interpreter that interface
+ with the XFree86-Misc extension ****/
+
+ if (XF86Misc_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Add the commands to the Tcl interpreter that interface
+ with the XKEYBOARD extension and library ****/
+
+ if (XF86Kbd_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+
+ /**** Add the commands to the Tcl interpreter for the
+ Tk convenience functions ****/
+
+ if (XF86TkOther_Init(interp) == TCL_ERROR)
+ print_result_and_exit;
+ } /* !notk */
+
+ if (filename != NULL) {
+ /**** Load the default bindings ****/
+ strcpy(buf, "source $tk_library/init.tcl");
+ if (Tcl_Eval(interp, buf) != TCL_OK)
+ print_result_and_exit;
+ strcpy(buf, "source $tk_library/tk.tcl");
+ if (Tcl_Eval(interp, buf) != TCL_OK)
+ print_result_and_exit;
+ XF86Setup_TclRunScript(interp, filename);
+ Tk_MainLoop();
+ } else {
+ if (statefile == NULL || Phase2FallBack) {
+ /**** Now execute the Phase II commands ****/
+ XF86Setup_TclEvalFile(interp, (notk? PHASE2NOTK: PHASE2));
+ } else {
+ /**** Now execute the Phase IV commands ****/
+ XF86Setup_TclEvalFile(interp, PHASE4);
+ }
+ /**** Enter the event loop until Phase II/IV is completed (last
+ window destroyed) ****/
+
+ if (!notk) {
+ Tk_MainLoop();
+
+ kill_server(interp);
+ }
+
+ tmpptr = Tcl_GetVar(interp, "ExitStatus", TCL_GLOBAL_ONLY);
+ if (tmpptr) {
+ Tcl_VarEval(interp, "exit ", tmpptr, (char *)0);
+ exit(1);
+ }
+ if (statefile == NULL || Phase2FallBack) {
+ statefile = Tcl_GetVar(interp, "StateFileName", TCL_GLOBAL_ONLY);
+#ifdef DEBUG
+ fprintf(stderr,
+ "Executing second copy of XF86Setup (%s -statefile %s)...\n",
+ argv[0], statefile);
+#endif
+ if (statefile) {
+ execlp(argv[0], argv[0], "-statefile", statefile, (char *)0);
+ fprintf(stderr,
+ "Exec of 2nd XF86Setup failed! Returned error #%d\n",
+ errno);
+ Tcl_Eval(interp, "exit 1");
+ exit(1);
+ }
+#ifdef DEBUG
+ else
+ fprintf(stderr, "The StateFileName variable isn't set!\n");
+#endif
+ } else {
+ /**** Lastly, execute the Phase V commands ****/
+ XF86Setup_TclEvalFile(interp, PHASE5);
+ }
+ }
+
+ Tcl_Eval(interp, "exit 0");
+ exit(1);
+}
+
+void keypress(void) {
+/*
+ * The parse_database routine (in cards.c) calls keypress() when it
+ * finds a problem with the database (after printing an error message)
+ *
+ * We just ignore the error
+ */
+}
+
+/*
+ Kill the process whose id is in the ServerPID variable, if any
+
+ This is used to kill the X server and switch back to text mode
+*/
+void kill_server(interp)
+ Tcl_Interp *interp;
+{
+ int pid;
+ char *pidstr;
+
+ pidstr = Tcl_GetVar(interp, "ServerPID", TCL_GLOBAL_ONLY);
+ if (pidstr == NULL)
+ return;
+ pid = atoi(pidstr);
+ if (!pid)
+ return;
+ kill(pid,SIGTERM);
+ sleep(2);
+ return;
+}
+
+extern int TkCreateFrame (
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv,
+ int toplevel,
+ char *appName
+);
+
+#if TK_MAJOR_VERSION == 4
+extern int TkPlatformInit (
+#else
+extern int TkpInit (
+#endif
+ Tcl_Interp *interp
+);
+
+extern int XkbUIWinCmd (
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+);
+
+/*
+ Open a connection to the X server and create the main Tk window
+*/
+static void
+XF86Setup_TkInit(interp, display, appName)
+ Tcl_Interp *interp;
+ char *display;
+ char *appName;
+{
+ Tk_Window mainWindow;
+ char *class;
+ char *av[10];
+ int ac;
+
+ if (appName == NULL)
+ appName = "XF86Setup";
+ if (display == NULL)
+ display = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);
+ class = (char *) XtMalloc((unsigned) (strlen(appName) + 1));
+ strcpy(class, appName);
+ if (islower(class[0]))
+ class[0] = toupper((unsigned char) class[0]);
+
+ av[0] = "toplevel";
+ av[1] = ".";
+ av[2] = "-class";
+ av[3] = class;
+ ac = 4;
+ if (display != NULL) {
+ av[4] = "-screen";
+ av[5] = display;
+ ac = 6;
+ }
+ av[ac] = NULL;
+ if (TkCreateFrame((ClientData) NULL, interp, ac, av, 1, appName) != TCL_OK)
+ print_result_and_exit;
+
+ Tcl_ResetResult(interp);
+ mainWindow = Tk_MainWindow(interp);
+#if TK_MAJOR_VERSION == 4
+ TkPlatformInit(interp);
+#else
+ TkpInit(interp);
+#endif
+ XtFree(class);
+
+ if (synchronize)
+ XSynchronize(Tk_Display(mainWindow), True);
+
+ /**** Add the xkbview widget command to the interpreter ****/
+ Tcl_CreateCommand(interp, "xkbview", XkbUIWinCmd,
+ (ClientData) mainWindow, (void (*)()) NULL);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl
new file mode 100644
index 000000000..10ec6b164
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl
@@ -0,0 +1,203 @@
+#
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/modeselect.tcl,v 3.2 1998/04/05 16:15:50 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+# 1997 by Dirk H Hohndel <hohndel@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# routines to select the modes that the user actually wants to use
+#
+
+proc Modeselect_create_widgets { win } {
+ global MonitorIDs monDevNum monCanvas MonitorDescriptions
+ global pc98_EGC messages
+
+ set w [winpathprefix $win]
+
+ if !$pc98_EGC {
+ frame $w.modesel -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.modesel -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.modesel.top
+ frame $w.modesel.mid -relief sunken -borderwidth 3
+ frame $w.modesel.bot
+ pack $w.modesel.top -side top
+ pack $w.modesel.mid -side top -expand yes
+ pack $w.modesel.bot -side top
+
+ label $w.modesel.top.title -text "Select the modes you want to use"
+ frame $w.modesel.type
+ pack $w.modesel.top.title $w.modesel.type -in $w.modesel.top -side top
+ set canv [canvas $w.modesel.buttons]
+
+ checkbutton $w.modesel.buttons.m640x480 \
+ -text $messages(modeselect.2) \
+ -indicatoron no -variable m640x480 \
+ -command [list modesel_enable $win " 640x480*"]
+ lappend lbuttons $w.modesel.buttons.m640x480
+ checkbutton $w.modesel.buttons.m800x600 \
+ -text $messages(modeselect.3) \
+ -indicatoron no -variable m800x600 \
+ -command [list modesel_enable $win " 800x600*"]
+ lappend lbuttons $w.modesel.buttons.m800x600
+ checkbutton $w.modesel.buttons.m1024x768 \
+ -text $messages(modeselect.4) \
+ -indicatoron no -variable m1024x768 \
+ -command [list modesel_enable $win "1024x768*"]
+ lappend lbuttons $w.modesel.buttons.m1024x768
+ checkbutton $w.modesel.buttons.m1152x864 \
+ -text $messages(modeselect.5) \
+ -indicatoron no -variable m1152x864 \
+ -command [list modesel_enable $win "1152x864*"]
+ lappend lbuttons $w.modesel.buttons.m1152x864
+ checkbutton $w.modesel.buttons.m1280x1024 \
+ -text $messages(modeselect.6) \
+ -indicatoron no -variable m1280x1024 \
+ -command [list modesel_enable $win "1280x1024*"]
+ lappend lbuttons $w.modesel.buttons.m1280x1024
+ checkbutton $w.modesel.buttons.m1600x1200 \
+ -text $messages(modeselect.7) \
+ -indicatoron no -variable m1600x1200 \
+ -command [list modesel_enable $win "1600x1200*"]
+ lappend lbuttons $w.modesel.buttons.m1600x1200
+ checkbutton $w.modesel.buttons.m640x400 \
+ -text $messages(modeselect.8) \
+ -indicatoron no -variable m640x400 \
+ -command [list modesel_enable $win " 640x400*"]
+ lappend lbuttons $w.modesel.buttons.m640x400
+ checkbutton $w.modesel.buttons.m320x200 \
+ -text $messages(modeselect.9) \
+ -indicatoron no -variable m320x200 \
+ -command [list modesel_enable $win " 320x200*"]
+ lappend lbuttons $w.modesel.buttons.m320x200
+ checkbutton $w.modesel.buttons.m320x240 \
+ -text $messages(modeselect.10) \
+ -indicatoron no -variable m320x240 \
+ -command [list modesel_enable $win " 320x240*"]
+ lappend lbuttons $w.modesel.buttons.m320x240
+ checkbutton $w.modesel.buttons.m400x300 \
+ -text $messages(modeselect.11) \
+ -indicatoron no -variable m400x300 \
+ -command [list modesel_enable $win " 400x300*"]
+ lappend lbuttons $w.modesel.buttons.m400x300
+ checkbutton $w.modesel.buttons.m480x300 \
+ -text $messages(modeselect.12) \
+ -indicatoron no -variable m480x300 \
+ -command [list modesel_enable $win " 480x300*"]
+ lappend lbuttons $w.modesel.buttons.m480x300
+ checkbutton $w.modesel.buttons.m512x384 \
+ -text $messages(modeselect.13) \
+ -indicatoron no -variable m512x384 \
+ -command [list modesel_enable $win " 512x384*"]
+ lappend lbuttons $w.modesel.buttons.m512x384
+ set ht 0
+ set wd 0
+ foreach wb $lbuttons {
+ set bwd [winfo reqwidth $wb]
+ if {$wd < $bwd} {set wd $bwd}
+ }
+ foreach wb $lbuttons {
+ $canv create window \
+ [expr ($wd-[winfo reqwidth $wb])/2] $ht \
+ -anchor nw -window $wb
+ set ht [expr $ht + [winfo reqheight $wb]]
+ }
+ $canv configure -yscrollcommand [list $w.modesel.sb set] \
+ -scrollregion [list 0 0 $wd $ht] \
+ -width $wd
+ scrollbar $w.modesel.sb \
+ -command [list $canv yview]
+ pack $canv -in $w.modesel.mid \
+ -side left -fill both -expand yes -pady 2m
+ pack $w.modesel.sb -in $w.modesel.mid -side right \
+ -fill y -expand yes
+ frame $w.modesel.dcd
+ label $w.modesel.dcd.title -text $messages(modeselect.14)
+ radiobutton $w.modesel.8bpp -text $messages(modeselect.15) \
+ -indicatoron false -variable ColorDepth \
+ -value "depth8" -underline 19 \
+ -command [list modesel_color_select $w 8]
+ radiobutton $w.modesel.16bpp -text $messages(modeselect.16) \
+ -indicatoron false -variable ColorDepth \
+ -value "depth16" -underline 19 \
+ -command [list modesel_color_select $w 16]
+ radiobutton $w.modesel.24bpp -text $messages(modeselect.17) \
+ -indicatoron false -variable ColorDepth \
+ -value "depth24" -underline 19 \
+ -command [list modesel_color_select $w 24]
+ radiobutton $w.modesel.32bpp -text $messages(modeselect.18) \
+ -indicatoron false -variable ColorDepth \
+ -value "depth32" -underline 19 \
+ -command [list modesel_color_select $w 32]
+ pack $w.modesel.8bpp $w.modesel.16bpp $w.modesel.24bpp \
+ $w.modesel.32bpp -side left -fill x -expand yes \
+ -in $w.modesel.dcd
+ pack $w.modesel.dcd.title $w.modesel.dcd -side left -fill y -expand yes
+}
+
+proc Modeselection_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.modesel -side top -fill both -expand yes
+}
+
+proc Modeselection_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.modesel
+
+}
+
+proc modesel_color_select { win val } {
+ global DefaultColorDepth
+
+ set w [winpathprefix $win]
+
+ set DefaultColorDepth $val
+}
+
+proc modesel_enable { win val } {
+ global MonitorStdModes SelectedMonitorModes haveSelectedModes
+
+ set w [winpathprefix $win]
+
+ set haveSelectedModes 1
+
+ # we need to handle the fact that these are toggle buttons, so every
+ # other time this is selected, the user actually wants to deselect
+ # the entries
+ # this would be much easier if I have a way to remove pairs from an array...
+ if { [array get SelectedMonitorModes $val] != "" } {
+# puts stderr "$val already existed"
+ #
+ foreach desc [array names SelectedMonitorModes $val] {
+ if [string match \#removed $SelectedMonitorModes($desc)] {
+ # ok, we're enabling again
+ set SelectedMonitorModes($desc) $MonitorStdModes($desc)
+ } else {
+# puts stderr "invalidating for $desc"
+ set SelectedMonitorModes($desc) "#removed"
+ }
+ }
+ } else {
+# puts stderr "add $val to selected modes"
+ foreach desc [array names MonitorStdModes $val] {
+ set modeline $MonitorStdModes($desc)
+# puts stderr "$desc :: $modeline"
+ set SelectedMonitorModes($desc) $modeline
+ }
+ }
+# foreach desc [array names SelectedMonitorModes] {
+# puts stderr "$desc -> $SelectedMonitorModes($desc)"
+# }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/mondata.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/mondata.tcl
new file mode 100644
index 000000000..be8a7e056
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/mondata.tcl
@@ -0,0 +1,167 @@
+# $XConsortium: mondata.tcl /main/4 1996/10/28 05:42:19 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/mondata.tcl,v 3.12 1997/12/14 10:03:55 hohndel Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Data used by the monitor configuration routines
+#
+
+array set MonitorVsyncRanges {
+ 0 60
+ 1 55-60
+ 2 60,70,87
+ 3 55-90
+ 4 55-90
+ 5 55-90
+ 6 50-90
+ 7 50-90
+ 8 50-100
+ 9 40-100
+}
+
+array set MonitorHsyncRanges {
+ 0 31.5
+ 1 31.5-35.1
+ 2 31.5,35.5
+ 3 31.5,35.15,35.5
+ 4 31.5-37.9
+ 5 31.5-48.5
+ 6 31.5-57.0
+ 7 31.5-64.3
+ 8 31.5-79.0
+ 9 31.5-82.0
+}
+
+set MonitorDescriptions [list \
+ "Standard VGA, 640x480 @ 60 Hz" \
+ "Super VGA, 800x600 @ 56 Hz" \
+ "8514 Compatible, 1024x768@87 Hz interlaced (no 800x600)" \
+ "Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz" \
+ "Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz" \
+ "Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz" \
+ "High Frequency SVGA, 1024x768 @ 70 Hz" \
+ "Multi-frequency that can do 1280x1024 @ 60 Hz" \
+ "Multi-frequency that can do 1280x1024 @ 74 Hz" \
+ "Multi-frequency that can do 1280x1024 @ 76 Hz" \
+]
+
+set haveSelectedModes 0
+
+set DefaultColorDepth 8
+
+array set SelectedMonitorModes { }
+
+array set MonitorStdModes {
+ " 640x400 @ pc98 EGC mode : 60 Hz, 24 kHz hsync"
+ "16.442 640 649 656 663 400 407 415 440"
+ " 640x400 @ 70 Hz, 31.5 kHz hsync"
+ "25.175 640 664 760 800 400 409 411 450"
+ " 640x480 @ 60 Hz, 31.5 kHz hsync"
+ "25.175 640 664 760 800 480 491 493 525"
+ " 800x600 @ 56 Hz, 35.15 kHz hsync"
+ "36 800 824 896 1024 600 601 603 625"
+ "1024x768 @ 87 Hz interlaced, 35.5 kHz hsync"
+ "44.9 1024 1048 1208 1264 768 776 784 817 Interlace"
+ " 640x480 @ 67 Hz, 35.0 kHz hsync"
+ "28 640 664 760 800 480 491 493 525"
+ " 640x400 @ 85 Hz, 37.86 kHz hsync"
+ "31.5 640 672 736 832 400 401 404 445 -HSync +VSync"
+ " 640x480 @ 70 Hz, 36.5 kHz hsync"
+ "31.5 640 680 720 864 480 488 491 521"
+ " 640x480 @ 75 Hz, 37.50 kHz hsync"
+ "31.5 640 656 720 840 480 481 484 500 -HSync -VSync"
+ " 800x600 @ 60 Hz, 37.8 kHz hsync"
+ "40 800 840 968 1056 600 601 605 628 +hsync +vsync"
+ " 640x480 @ 85 Hz, 43.27 kHz hsync"
+ "36 640 696 752 832 480 481 484 509 -HSync -VSync"
+ "1152x864 @ 89 Hz interlaced, 44 kHz hsync"
+ "65 1152 1168 1384 1480 864 865 875 985 Interlace"
+ " 800x600 @ 72 Hz, 48.0 kHz hsync"
+ "50 800 856 976 1040 600 637 643 666 +hsync +vsync"
+ "1024x768 @ 60 Hz, 48.4 kHz hsync"
+ "65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync"
+ " 640x480 @ 100 Hz, 53.01 kHz hsync"
+ "45.8 640 672 768 864 480 488 494 530 -HSync -VSync"
+ "1152x864 @ 60 Hz, 53.5 kHz hsync"
+ "89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync"
+ " 800x600 @ 85 Hz, 55.84 kHz hsync"
+ "60.75 800 864 928 1088 600 616 621 657 -HSync -VSync"
+ "1024x768 @ 70 Hz, 56.5 kHz hsync"
+ "75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync"
+ "1280x1024 @ 87 Hz interlaced, 51 kHz hsync"
+ "80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace"
+ "1024x768 @ 76 Hz, 62.5 kHz hsync"
+ "85 1024 1032 1152 1360 768 784 787 823"
+ "1152x864 @ 70 Hz, 62.4 kHz hsync"
+ "92 1152 1208 1368 1474 864 865 875 895"
+ " 800x600 @ 100 Hz, 64.02 kHz hsync"
+ "69.650 800 864 928 1088 600 604 610 640 -HSync -VSync"
+ "1024x768 @ 85 Hz, 70.24 kHz hsync"
+ "98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync"
+ "1152x864 @ 78 Hz, 70.8 kHz hsync"
+ "110 1152 1240 1324 1552 864 864 876 908"
+ "1152x864 @ 84 Hz, 76.0 kHz hsync"
+ "135 1152 1464 1592 1776 864 864 876 908"
+ "1280x1024 @ 61 Hz, 64.2 kHz hsync"
+ "110 1280 1328 1512 1712 1024 1025 1028 1054"
+ "1280x1024 @ 70 Hz, 74.59 kHz hsync"
+ "126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync"
+ "1600x1200 @ 60Hz, 75.00 kHz hsync"
+ "162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync"
+ "1280x1024 @ 74 Hz, 78.85 kHz hsync"
+ "135 1280 1312 1456 1712 1024 1027 1030 1064"
+ "1024x768 @ 100Hz, 80.21 kHz hsync"
+ "115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync"
+ "1280x1024 @ 76 Hz, 81.13 kHz hsync"
+ "135 1280 1312 1416 1664 1024 1027 1030 1064"
+ "1600x1200 @ 70 Hz, 87.50 kHz hsync"
+ "189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync"
+ "1152x864 @ 100 Hz, 89.62 kHz hsync"
+ "137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync"
+ "1280x1024 @ 85 Hz, 91.15 kHz hsync"
+ "157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync"
+ "1600x1200 @ 75 Hz, 93.75 kHz hsync"
+ "202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync"
+ "1600x1200 @ 85 Hz, 105.77 kHz hsync"
+ "220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync"
+ "1280x1024 @ 100 Hz, 107.16 kHz hsync"
+ "181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync"
+ "1800x1440 @ 64Hz, 96.15 kHz hsync"
+ "230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync"
+ "1800x1440 @ 70Hz, 104.52 kHz hsync"
+ "250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync"
+ " 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio"
+ "12.588 320 336 384 400 200 204 205 225 Doublescan"
+ " 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio"
+ "12.588 320 336 384 400 240 245 246 262 Doublescan"
+ " 320x240 @ 72 Hz, 36.5 kHz hsync"
+ "15.750 320 336 384 400 240 244 246 262 Doublescan"
+ " 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio"
+ "18 400 416 448 512 300 301 302 312 Doublescan"
+ " 400x300 @ 60 Hz, 37.8 kHz hsync"
+ "20 400 416 480 528 300 301 303 314 Doublescan"
+ " 400x300 @ 72 Hz, 48.0 kHz hsync"
+ "25 400 424 488 520 300 319 322 333 Doublescan"
+ " 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio"
+ "21.656 480 496 536 616 300 301 302 312 Doublescan"
+ " 480x300 @ 60 Hz, 37.8 kHz hsync"
+ "23.890 480 496 576 632 300 301 303 314 Doublescan"
+ " 480x300 @ 63 Hz, 39.6 kHz hsync"
+ "25 480 496 576 632 300 301 303 314 Doublescan"
+ " 480x300 @ 72 Hz, 48.0 kHz hsync"
+ "29.952 480 504 584 624 300 319 322 333 Doublescan"
+ " 512x384 @ 78 Hz, 31.50 kHz hsync"
+ "20.160 512 528 592 640 384 385 388 404 -HSync -VSync"
+ " 512x384 @ 85 Hz, 34.38 kHz hsync"
+ "22 512 528 592 640 384 385 388 404 -HSync -VSync"
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/monitor.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/monitor.tcl
new file mode 100644
index 000000000..1250e1b9a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/monitor.tcl
@@ -0,0 +1,330 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/monitor.tcl,v 3.13 1999/04/05 07:13:00 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: monitor.tcl /main/2 1996/10/25 10:21:20 kaleb $
+
+#
+# Monitor configuration routines
+#
+
+proc Monitor_create_widgets { win } {
+ global MonitorIDs monDevNum monCanvas MonitorDescriptions
+ global pc98_EGC messages
+
+ set w [winpathprefix $win]
+ set monDevNum 0
+ if !$pc98_EGC {
+ frame $w.monitor -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.monitor -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.monitor.sync
+ pack $w.monitor.sync -side top -pady 1m
+
+ frame $w.monitor.sync.line1
+ pack $w.monitor.sync.line1 -side top -fill x -expand yes
+ label $w.monitor.sync.title -text $messages(monitor.1)
+ pack $w.monitor.sync.title -side left -fill x \
+ -in $w.monitor.sync.line1 -expand yes
+ if { [llength $MonitorIDs] > 1 } {
+ label $w.monitor.sync.monsel \
+ -text $messages(monitor.2) -anchor w
+ pack $w.monitor.sync.monsel -side left \
+ -in $w.monitor.sync.line1
+ combobox $w.monitor.sync.monselect -state disabled -bd 2
+ pack $w.monitor.sync.monselect -side left \
+ -in $w.monitor.sync.line1
+ eval [list $w.monitor.sync.monselect linsert end] $MonitorIDs
+ Monitor_cbox_setentry $w.monitor.sync.monselect [lindex $MonitorIDs 0]
+ bind $w.monitor.sync.monselect.popup.list <ButtonRelease-1> \
+ "+Monitor_monselect $win"
+ bind $w.monitor.sync.monselect.popup.list <Return> \
+ "+Monitor_monselect $win"
+ }
+ frame $w.monitor.sync.horz
+ pack $w.monitor.sync.horz -side left -padx 10m
+ label $w.monitor.sync.horz.title -text $messages(monitor.3)
+ entry $w.monitor.sync.horz.entry -width 35 -bd 2
+ pack $w.monitor.sync.horz.title -side left
+ pack $w.monitor.sync.horz.entry -side left
+
+ frame $w.monitor.sync.vert
+ pack $w.monitor.sync.vert -side left -padx 10m
+ label $w.monitor.sync.vert.title -text $messages(monitor.4)
+ entry $w.monitor.sync.vert.entry -width 35 -bd 2
+ pack $w.monitor.sync.vert.title -side left
+ pack $w.monitor.sync.vert.entry -side left
+
+ set canv $w.monitor.canvas
+ set monCanvas $canv
+ if !$pc98_EGC {
+ canvas $canv -width 600 -height 330 -highlightthickness 0 \
+ -takefocus 0 -relief sunken -borderwidth 2
+ } else {
+ canvas $canv -width 600 -height 250 -highlightthickness 0 \
+ -takefocus 0 -relief sunken -borderwidth 2
+ }
+ pack $canv -side top -fill x
+
+ frame $canv.list
+ listbox $canv.list.lb -height 10 -width 55 -setgrid true \
+ -yscroll [list $canv.list.sb set]
+ scrollbar $canv.list.sb -command [list $canv.list.lb yview]
+ if !$pc98_EGC {
+ pack $canv.list.lb -side left -fill y
+ # pack $canv.list.sb -side left -fill y
+ } else {
+ $canv.list.lb configure -height 5
+ pack $canv.list.lb -side left -fill y
+ pack $canv.list.sb -side left -fill y
+ }
+ eval [list $canv.list.lb insert end] $MonitorDescriptions
+ bind $canv.list.lb <ButtonRelease-1> \
+ [list Monitor_setstandard $win $canv]
+ bind $canv.list.lb <Return> \
+ [list Monitor_setstandard $win $canv]
+
+ if !$pc98_EGC {
+ $canv create rectangle 150 55 550 305 -fill cyan
+ $canv create rectangle 160 70 540 280 -fill grey
+ $canv create rectangle 170 80 530 270 -fill blue
+ $canv create arc 170 76 530 84 -fill blue \
+ -start 0 -extent 180 -style chord -outline blue
+ $canv create arc 170 266 530 274 -fill blue \
+ -start 0 -extent -180 -style chord -outline blue
+ $canv create arc 166 80 174 270 -fill blue \
+ -start 90 -extent 180 -style chord -outline blue
+ $canv create arc 526 80 534 270 -fill blue \
+ -start 90 -extent -180 -style chord -outline blue
+ $canv create line 160 70 170 80
+ $canv create line 540 70 530 80
+ $canv create line 540 280 530 270
+ $canv create line 160 280 170 270
+ $canv create rectangle 320 305 380 315 -fill cyan
+ $canv create rectangle 285 315 415 320 -fill cyan
+
+ $canv create window 350 175 -window $canv.list
+
+ $canv create rectangle 120 30 570 45 -fill white -tag hsync
+ for {set i 20} {$i<=110} {incr i 10} {
+ $canv create text [expr $i*5+20] 22 -text $i
+ }
+
+ $canv create rectangle 50 30 65 305 -fill white -tag vsync
+ for {set i 40} {$i<=150} {incr i 10} {
+ $canv create text 35 [expr $i*2.5-70] -text $i -anchor e
+ }
+ } else {
+ $canv create rectangle 150 55 550 225 -fill cyan
+ $canv create rectangle 160 70 540 200 -fill grey
+ $canv create rectangle 170 80 530 190 -fill blue
+ $canv create arc 170 76 530 84 -fill blue \
+ -start 0 -extent 180 -style chord -outline blue
+ $canv create arc 170 186 530 194 -fill blue \
+ -start 0 -extent -180 -style chord -outline blue
+ $canv create arc 166 80 174 190 -fill blue \
+ -start 90 -extent 180 -style chord -outline blue
+ $canv create arc 526 80 534 190 -fill blue \
+ -start 90 -extent -180 -style chord -outline blue
+ $canv create line 160 70 170 80
+ $canv create line 540 70 530 80
+ $canv create line 540 200 530 190
+ $canv create line 160 200 170 190
+ $canv create rectangle 320 225 380 235 -fill cyan
+ $canv create rectangle 285 235 415 240 -fill cyan
+
+ $canv create window 350 135 -window $canv.list
+
+ $canv create rectangle 120 30 570 45 -fill white -tag hsync
+ for {set i 20} {$i<=110} {incr i 10} {
+ $canv create text [expr $i*5+20] 22 -text $i
+ }
+
+ $canv create rectangle 50 30 65 225 -fill white -tag vsync
+ for {set i 40} {$i<=150} {incr i 10} {
+ $canv create text 35 [expr $i*1.7-38] -text $i -anchor e
+ }
+ }
+
+ frame $w.monitor.bot
+ label $w.monitor.bot.message -text $messages(monitor.5)
+ pack $w.monitor.bot -side top
+ pack $w.monitor.bot.message
+
+ $canv bind hsync <ButtonPress-1> [list Monitor_sync_sel $canv hsync %x %y]
+ $canv bind hsync <B1-Motion> [list Monitor_sync_chg $canv hsync %x %y]
+ $canv bind hsync <ButtonRelease-1> [list Monitor_sync_rel $canv hsync %x %y]
+ $canv bind hsync <Button-3> [list Monitor_sync_del $canv hsync %x %y]
+ $canv bind vsync <ButtonPress-1> [list Monitor_sync_sel $canv vsync %x %y]
+ $canv bind vsync <B1-Motion> [list Monitor_sync_chg $canv vsync %x %y]
+ $canv bind vsync <ButtonRelease-1> [list Monitor_sync_rel $canv vsync %x %y]
+ $canv bind vsync <Button-3> [list Monitor_sync_del $canv vsync %x %y]
+ bind $w.monitor.sync.horz.entry , \
+ [list Monitor_sync_ent $w.monitor.sync.horz.entry $canv horz]
+ bind $w.monitor.sync.horz.entry <KP_Enter> \
+ [list Monitor_sync_ent $w.monitor.sync.horz.entry $canv horz]
+ bind $w.monitor.sync.horz.entry <Return> \
+ [list Monitor_sync_ent $w.monitor.sync.horz.entry $canv horz]
+ bind $w.monitor.sync.vert.entry , \
+ [list Monitor_sync_ent $w.monitor.sync.vert.entry $canv vert]
+ bind $w.monitor.sync.vert.entry <KP_Enter> \
+ [list Monitor_sync_ent $w.monitor.sync.vert.entry $canv vert]
+ bind $w.monitor.sync.vert.entry <Return> \
+ [list Monitor_sync_ent $w.monitor.sync.vert.entry $canv vert]
+}
+
+proc Monitor_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.monitor -side top -fill both -expand yes
+
+ Monitor_get_configvars $win
+}
+
+proc Monitor_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.monitor
+
+ Monitor_set_configvars $win
+}
+
+proc Monitor_monselect { win } {
+ global monDevNum
+
+ set w [winpathprefix $win]
+ if { ![string length [$w.monitor.sync.monselect curselection]] } \
+ return
+ Monitor_set_configvars $win
+ set monDevNum [$w.monitor.sync.monselect curselection]
+ Monitor_get_configvars $win
+}
+
+proc Monitor_set_configvars { win } {
+ global monDevNum MonitorIDs
+
+ set w [winpathprefix $win]
+ set devid [lindex $MonitorIDs $monDevNum]
+ set varname Monitor_$devid
+ global $varname
+ set ${varname}(HorizSync) [$w.monitor.sync.horz.entry get]
+ set ${varname}(VertRefresh) [$w.monitor.sync.vert.entry get]
+}
+
+proc Monitor_get_configvars { win } {
+ global monDevNum MonitorIDs monCanvas
+
+ set w [winpathprefix $win]
+ set devid [lindex $MonitorIDs $monDevNum]
+ set varname Monitor_$devid
+ global $varname
+ $w.monitor.sync.horz.entry delete 0 end
+ $w.monitor.sync.horz.entry insert 0 [set ${varname}(HorizSync)]
+ $w.monitor.sync.vert.entry delete 0 end
+ $w.monitor.sync.vert.entry insert 0 [set ${varname}(VertRefresh)]
+ Monitor_sync_ent $w.monitor.sync.horz.entry $monCanvas horz
+ Monitor_sync_ent $w.monitor.sync.vert.entry $monCanvas vert
+}
+
+proc Monitor_cbox_setentry { cb text } {
+ $cb econfig -state normal
+ $cb edelete 0 end
+ if [string length $text] {
+ $cb einsert 0 $text
+ }
+ $cb econfig -state disabled
+ set cblist [$cb lget 0 end]
+ set idx [lsearch $cblist $text]
+ if { $idx != -1 } {
+ $cb see $idx
+ $cb lselection clear 0 end
+ $cb lselection set $idx
+ $cb activate $idx
+ }
+}
+
+proc Monitor_setstandard { win c } {
+ global MonitorHsyncRanges MonitorVsyncRanges
+
+ set w [winpathprefix $win]
+ set monidx [$c.list.lb curselection]
+ if ![string length $monidx] return
+ $w.monitor.sync.horz.entry delete 0 end
+ $w.monitor.sync.horz.entry insert end $MonitorHsyncRanges($monidx)
+ Monitor_sync_ent $w.monitor.sync.horz.entry $c horz
+ $w.monitor.sync.vert.entry delete 0 end
+ $w.monitor.sync.vert.entry insert end $MonitorVsyncRanges($monidx)
+ Monitor_sync_ent $w.monitor.sync.vert.entry $c vert
+}
+
+proc Monitor_sync_ent { win c dir } {
+ global pc98_EGC
+
+ set w [winpathprefix $win]
+ if { [string compare $dir horz] == 0 } {
+ set min 20.0
+ set max 110.0
+ set x1 {$beg*5.0+20}
+ set y1 30
+ set x2 {$end*5.0+20}
+ set y2 45
+ } else {
+ set min 40.0
+ set max 150.0
+ set x1 50
+ set x2 65
+ if !$pc98_EGC {
+ set y1 {$beg*2.5-70}
+ set y2 {$end*2.5-70}
+ } else {
+ set y1 {$beg*1.7-38}
+ set y2 {$end*1.7-38}
+ }
+ }
+ set rng [zap_white [$w get]]
+ set rnglist [split $rng ,]
+ set count 0
+ catch {$c delete ${dir}rng}
+ foreach elem $rnglist {
+ set beg [set end 0]
+ set elem [zap_white $elem]
+ if { [string first - $elem] == -1 } {
+ scan $elem %f beg
+ set end $beg
+ } else {
+ scan $elem %f-%f beg end
+ }
+ if { $beg > $end } {
+ set end $beg
+ }
+ if { $beg < $min } {
+ if { $end < $min } continue
+ set beg $min
+ }
+ if { $end > $max } {
+ if { $beg > $max } continue
+ set end $max
+ }
+ incr count
+ $c create rectangle \
+ [expr $x1] [expr $y1] [expr $x2] [expr $y2] \
+ -fill red -tag "${dir}$count ${dir}rng"
+ }
+}
+
+proc Monitor_sync_chg { c t x y } {
+}
+
+proc Monitor_sync_del { c t x y } {
+}
+
+proc Monitor_sync_rel { c t x y } {
+}
+
+proc Monitor_sync_sel { c t x y } {
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/mouse.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/mouse.tcl
new file mode 100644
index 000000000..8abddfd84
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/mouse.tcl
@@ -0,0 +1,684 @@
+# $XConsortium: mouse.tcl /main/6 1996/10/28 05:42:22 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/mouse.tcl,v 3.25 1998/04/26 16:04:34 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Mouse configuration routines
+#
+
+set mseTypeList [concat $SupportedMouseTypes { Xqueue OSMouse } ]
+
+set msePatterns [list {tty[0-9A-Za-o]*} cua* *bm *mse* *mouse* \
+ ps*x psm* m320 pms* com* gpmdata lms* kdmouse logi msm]
+set mseDevices ""
+foreach pat $msePatterns {
+ if ![catch {glob /dev/$pat}] {
+ eval lappend mseDevices [glob /dev/$pat]
+ }
+}
+if [info exists Pointer(RealDev)] {
+ lappend mseDevices $Pointer(RealDev)
+}
+set mseDevices [lrmdups $mseDevices]
+
+proc Mouse_proto_select { win } {
+ global mseType baudRate chordMiddle clearDTR clearRTS sampleRate
+ global mseRes mseButtons mseDeviceSelected messages
+
+ set w [winpathprefix $win]
+ set canv $w.mouse.mid.right.canvas
+ $canv itemconfigure mbut -fill white
+ $canv itemconfigure coord -fill black
+ if {[lsearch -exact {BusMouse Xqueue OSMouse PS/2 IMPS/2
+ ThinkingMousePS/2 MouseManPlusPS/2 GlidePointPS/2
+ NetMousePS/2 NetScrollPS/2 SysMouse} \
+ $mseType] == -1} {
+ foreach rate {1200 2400 4800 9600} {
+ $w.mouse.brate.$rate configure -state normal
+ }
+ if { ![string compare MouseMan $mseType] } {
+ $w.mouse.brate.2400 configure -state disabled
+ $w.mouse.brate.4800 configure -state disabled
+ if { $baudRate == 2400 || $baudRate == 4800 } {
+ set baudRate 1200
+ }
+ }
+ } else {
+ foreach rate {1200 2400 4800 9600} {
+ $w.mouse.brate.$rate configure -state disabled
+ }
+ }
+ if { ![string compare MMHitTab $mseType] } {
+ $w.mouse.srate.title configure -text $messages(mouse.1)
+ $w.mouse.srate.scale configure -to 1200 -tickinterval 200 \
+ -resolution 20
+ $w.mouse.srate.scale configure -state normal
+ } else {
+ $w.mouse.srate.title configure -text $messages(mouse.2)
+ $w.mouse.srate.scale configure -to 150 -tickinterval 25 \
+ -resolution 1
+ if {[lsearch -exact \
+ {MouseMan BusMouse Xqueue OSMouse} \
+ $mseType] == -1} {
+ $w.mouse.srate.scale configure -state normal
+ } else {
+ $w.mouse.srate.scale configure -state disabled
+ set sampleRate 0
+ }
+ }
+ if { ![string compare MouseSystems $mseType] } {
+ $w.mouse.flags.dtr configure -state normal
+ $w.mouse.flags.rts configure -state normal
+ } else {
+ $w.mouse.flags.dtr configure -state disabled
+ $w.mouse.flags.rts configure -state disabled
+ set clearDTR [set clearRTS 0]
+ }
+ if {[lsearch -exact {Microsoft MouseMan} $mseType] == -1} {
+ $w.mouse.chdmid configure -state disabled
+ set chordMiddle 0
+ } else {
+ $w.mouse.chdmid configure -state normal
+ }
+ if { !$mseDeviceSelected } {
+ $w.mouse.device.entry delete 0 end
+ $w.mouse.device.entry insert 0 \
+ [Mouse_defaultdevice $mseType]
+ Mouse_setlistbox $w $w.mouse.device.list.lb
+ }
+# Mouse_setsettings $win
+}
+
+proc Mouse_create_widgets { win } {
+ global mseType mseDevices baudRate sampleRate mseTypeList clearDTR
+ global emulate3Buttons emulate3Timeout chordMiddle clearRTS
+ global pc98_EGC mseRes mseButtons messages
+
+ set w [winpathprefix $win]
+ if !$pc98_EGC {
+ frame $w.mouse -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.mouse -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.mouse.top
+ frame $w.mouse.mid -relief sunken -borderwidth 3
+ frame $w.mouse.bot
+ pack $w.mouse.top -side top
+ pack $w.mouse.mid -side top -fill x -expand yes
+ pack $w.mouse.bot -side top
+
+ label $w.mouse.top.title -text $messages(mouse.3)
+ frame $w.mouse.type
+ pack $w.mouse.top.title $w.mouse.type -in $w.mouse.top -side top
+ set i 0
+ foreach Type $mseTypeList {
+ set type [string tolower $Type]
+ radiobutton $w.mouse.type.$type -text $Type \
+ -width 16 \
+ -indicatoron false \
+ -variable mseType -value $Type \
+ -highlightthickness 1 \
+ -command [list Mouse_proto_select $win]
+ grid $w.mouse.type.$type -column [expr $i % 6] \
+ -row [expr $i / 6]
+ incr i
+ }
+
+ frame $w.mouse.mid.left
+ pack $w.mouse.mid.left -side left -fill x -fill y
+ frame $w.mouse.device
+ pack $w.mouse.device -in $w.mouse.mid.left -side top \
+ -pady 3m -padx 3m
+ label $w.mouse.device.title -text $messages(mouse.5)
+ entry $w.mouse.device.entry -bd 2
+ bind $w.mouse.device.entry <Return> \
+ "[list Mouse_setlistbox $win $w.mouse.device.list.lb]; \
+ focus $w.mouse.em3but"
+ frame $w.mouse.device.list
+ if !$pc98_EGC {
+ listbox $w.mouse.device.list.lb -height 6 \
+ -yscroll [list $w.mouse.device.list.sb set]
+ } else {
+ listbox $w.mouse.device.list.lb -height 4 \
+ -yscroll [list $w.mouse.device.list.sb set]
+ }
+ eval [list $w.mouse.device.list.lb insert end] $mseDevices
+ bind $w.mouse.device.list.lb <Return> \
+ "[list Mouse_setentry $win $w.mouse.device.list.lb]; \
+ focus $w.mouse.em3but"
+ bind $w.mouse.device.list.lb <ButtonRelease-1> \
+ [list Mouse_setentry $win $w.mouse.device.list.lb]
+ scrollbar $w.mouse.device.list.sb \
+ -command [list $w.mouse.device.list.lb yview]
+
+ pack $w.mouse.device.list.lb -side left -expand yes -fill both
+ pack $w.mouse.device.list.sb -side left -expand yes -fill y
+
+ pack $w.mouse.device.title $w.mouse.device.entry \
+ $w.mouse.device.list -side top -fill x
+
+ frame $w.mouse.mid.left.buttons
+ pack $w.mouse.mid.left.buttons -in $w.mouse.mid.left \
+ -side top -fill x -pady 2m
+ checkbutton $w.mouse.em3but -text $messages(mouse.6) \
+ -indicatoron no -variable emulate3Buttons \
+ -command [list Mouse_set_em3but $win]
+ checkbutton $w.mouse.chdmid -text $messages(mouse.7) \
+ -indicatoron no -variable chordMiddle \
+ -command [list Mouse_set_chdmid $win]
+ pack $w.mouse.em3but $w.mouse.chdmid -in $w.mouse.mid.left.buttons \
+ -side top -fill x -padx 3m -anchor w
+
+ frame $w.mouse.resolution
+ pack $w.mouse.resolution -in $w.mouse.mid.left -side top -pady 2m
+ label $w.mouse.resolution.title -text $messages(mouse.19)
+ pack $w.mouse.resolution.title -side top
+ frame $w.mouse.resolution.left
+ frame $w.mouse.resolution.mid
+ frame $w.mouse.resolution.right
+ pack $w.mouse.resolution.left $w.mouse.resolution.mid \
+ $w.mouse.resolution.right -side left -expand yes -fill x
+ radiobutton $w.mouse.resolution.200 -text $messages(mouse.20) \
+ -variable mseRes -value 200
+ pack $w.mouse.resolution.200 -side top -fill x -anchor w \
+ -in $w.mouse.resolution.left
+ radiobutton $w.mouse.resolution.100 -text $messages(mouse.21) \
+ -variable mseRes -value 100
+ pack $w.mouse.resolution.100 -side top -fill x -anchor w \
+ -in $w.mouse.resolution.mid
+ radiobutton $w.mouse.resolution.50 -text $messages(mouse.22) \
+ -variable mseRes -value 50
+ pack $w.mouse.resolution.50 -side top -fill x -anchor w \
+ -in $w.mouse.resolution.right
+
+ frame $w.mouse.mid.mid
+ pack $w.mouse.mid.mid -side left -fill x -fill y
+
+ frame $w.mouse.brate
+# pack $w.mouse.brate -in $w.mouse.mid.left -side top -pady 2m
+ pack $w.mouse.brate -in $w.mouse.mid.mid -side top -pady 2m
+ label $w.mouse.brate.title -text $messages(mouse.8)
+ pack $w.mouse.brate.title -side top
+ frame $w.mouse.brate.left
+ frame $w.mouse.brate.right
+ pack $w.mouse.brate.left $w.mouse.brate.right -side left \
+ -expand yes -fill x
+ foreach rate { 1200 2400 4800 9600 } {
+ radiobutton $w.mouse.brate.$rate -text $rate \
+ -variable baudRate -value $rate
+ pack $w.mouse.brate.$rate -side top -anchor w \
+ -in $w.mouse.brate.[expr $rate<4800?"left":"right"]
+ }
+
+ frame $w.mouse.flags
+ pack $w.mouse.flags -in $w.mouse.mid.mid -side top \
+ -fill x -pady 3m
+ label $w.mouse.flags.title -text $messages(mouse.10)
+ checkbutton $w.mouse.flags.dtr -text $messages(mouse.11) \
+ -width 14 -indicatoron no -variable clearDTR
+ checkbutton $w.mouse.flags.rts -text $messages(mouse.12) \
+ -width 14 -indicatoron no -variable clearRTS
+ pack $w.mouse.flags.title $w.mouse.flags.dtr $w.mouse.flags.rts \
+ -side top -fill x -padx 3m -anchor w
+
+ frame $w.mouse.buttons
+ pack $w.mouse.buttons -in $w.mouse.mid.mid -side top \
+ -pady 3m
+ label $w.mouse.buttons.title -text $messages(mouse.23)
+ pack $w.mouse.buttons.title -side top
+ frame $w.mouse.buttons.left
+ frame $w.mouse.buttons.mid
+ frame $w.mouse.buttons.right
+ pack $w.mouse.buttons.left $w.mouse.buttons.mid \
+ $w.mouse.buttons.right -side left -expand yes -fill x
+ radiobutton $w.mouse.buttons.3 -text 3 \
+ -variable mseButtons -value 3
+ pack $w.mouse.buttons.3 -side top -fill x -anchor w \
+ -in $w.mouse.buttons.left
+ radiobutton $w.mouse.buttons.4 -text 4 \
+ -variable mseButtons -value 4
+ pack $w.mouse.buttons.4 -side top -fill x -anchor w \
+ -in $w.mouse.buttons.mid
+ radiobutton $w.mouse.buttons.5 -text 5 \
+ -variable mseButtons -value 5
+ pack $w.mouse.buttons.5 -side top -fill x -anchor w \
+ -in $w.mouse.buttons.right
+
+ frame $w.mouse.srate
+ pack $w.mouse.srate -in $w.mouse.mid -side left -fill y -expand yes
+ label $w.mouse.srate.title -text $messages(mouse.13)
+ scale $w.mouse.srate.scale -orient vertical -from 0 -to 150 \
+ -tickinterval 25 -variable sampleRate -state disabled
+ pack $w.mouse.srate.title -side top
+ pack $w.mouse.srate.scale -side top -fill y -expand yes
+
+ frame $w.mouse.em3tm
+ pack $w.mouse.em3tm -in $w.mouse.mid -side left -fill y -expand yes
+ label $w.mouse.em3tm.title -text $messages(mouse.14)
+ scale $w.mouse.em3tm.scale -orient vertical -from 0 -to 1000 \
+ -tickinterval 250 -variable emulate3Timeout -resolution 5
+ pack $w.mouse.em3tm.title -side top
+ pack $w.mouse.em3tm.scale -side top -fill y -expand yes
+
+ frame $w.mouse.mid.right
+ pack $w.mouse.mid.right -side left
+ set canv $w.mouse.mid.right.canvas
+ if !$pc98_EGC {
+ set canvHeight 4i
+ set canvRect4Height 3.75i
+ set canvTextHeight 2.25i
+ } else {
+ set canvHeight 2i
+ set canvRect4Height 1.75i
+ set canvTextHeight 1.50i
+ }
+ canvas $canv -width 1.5i -height 3i -highlightthickness 0 \
+ -takefocus 0
+ $canv create rectangle 0.1i 1i 1.3i 2.5i -fill white \
+ -tag {mbut mbut4}
+ $canv create rectangle 0.1i 0.25i 0.5i 1i -fill white \
+ -tag {mbut mbut1}
+ $canv create rectangle 0.5i 0.25i 0.9i 1i -fill white \
+ -tag {mbut mbut2}
+ $canv create rectangle 0.9i 0.25i 1.3i 1i -fill white \
+ -tag {mbut mbut3}
+ $canv create text 0.7i 2.20i -tag coord
+
+ button $w.mouse.mid.right.apply -text $messages(mouse.15) \
+ -command [list Mouse_setsettings $win]
+ pack $canv $w.mouse.mid.right.apply -side top
+ if $pc98_EGC {
+ pack forget $w.mouse.flag
+ pack $w.mouse.flags -in $w.mouse.mid.right -side top \
+ -fill x -pady 3m
+ }
+
+ label $w.mouse.bot.mesg -text $messages(mouse.16) \
+ -foreground [$w.mouse.top.title cget -foreground]
+ pack $w.mouse.bot.mesg
+
+ Mouse_getsettings $w
+}
+
+proc Mouse_activate { win } {
+ global mseHelpShown
+
+ set w [winpathprefix $win]
+ pack $w.mouse -side top -fill both -expand yes
+
+ set canv $w.mouse.mid.right.canvas
+ bind $win <ButtonPress> [list $canv itemconfigure mbut%b -fill black]
+ bind $win <ButtonRelease> [list $canv itemconfigure mbut%b -fill white]
+ bind $win <ButtonPress-4> [list $canv itemconfigure mbut4 -fill black;
+ $canv itemconfigure coord -fill white]
+ bind $win <ButtonRelease-4> [list $canv itemconfigure mbut4 -fill white;
+ $canv itemconfigure coord -fill black]
+ bind $win <Motion> [list $canv itemconfigure coord -text (%X,%Y)]
+
+ $canv itemconfigure mbut -fill white
+ $canv itemconfigure coord -fill black
+
+ set ifcmd {if { [string compare [focus] %s.mouse.device.entry]
+ != 0 } { %s %s } }
+
+ bind $win a [format $ifcmd $w Mouse_setsettings $win ]
+ bind $win b [format $ifcmd $w Mouse_nextbaudrate $win ]
+ bind $win c [format $ifcmd $w $w.mouse.chdmid invoke ]
+ bind $win d [format $ifcmd $w $w.mouse.flags.dtr invoke ]
+ bind $win e [format $ifcmd $w $w.mouse.em3but invoke ]
+ bind $win l [format $ifcmd $w Mouse_nextresolution $win ]
+ bind $win n [format $ifcmd $w Mouse_selectentry $win ]
+ bind $win p [format $ifcmd $w Mouse_nextprotocol $win ]
+ bind $win r [format $ifcmd $w $w.mouse.flags.rts invoke ]
+ bind $win s [format $ifcmd $w Mouse_incrsamplerate $win ]
+ bind $win t [format $ifcmd $w Mouse_increm3timeout $win ]
+ bind $win 3 [format $ifcmd $w $w.mouse.buttons.3 invoke ]
+ bind $win 4 [format $ifcmd $w $w.mouse.buttons.4 invoke ]
+ bind $win 5 [format $ifcmd $w $w.mouse.buttons.5 invoke ]
+ if ![info exists mseHelpShown] {
+ Mouse_popup_help $win
+ set mseHelpShown yes
+ }
+}
+
+proc Mouse_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.mouse
+
+ bind $win <ButtonPress> ""
+ bind $win <ButtonRelease> ""
+ bind $win <ButtonPress-4> ""
+ bind $win <ButtonRelease-4> ""
+ bind $win <Motion> ""
+
+ bind $win a ""
+ bind $win b ""
+ bind $win c ""
+ bind $win d ""
+ bind $win e ""
+ bind $win n ""
+ bind $win p ""
+ bind $win r ""
+ bind $win s ""
+ bind $win t ""
+}
+
+proc Mouse_selectentry { win } {
+ set w [winpathprefix $win]
+ if { [ $w.mouse.device.entry cget -state] != "disabled" } {
+ focus $w.mouse.device.entry
+ }
+}
+
+proc Mouse_nextprotocol { win } {
+ global mseType mseTypeList
+
+ set w [winpathprefix $win]
+ set idx [lsearch -exact $mseTypeList $mseType]
+ do {
+ incr idx
+ if { $idx >= [llength $mseTypeList] } {
+ set idx 0
+ }
+ set mseType [lindex $mseTypeList $idx]
+ set mtype [string tolower $mseType]
+ } while { [$w.mouse.type.$mtype cget -state] == "disabled" }
+ Mouse_proto_select $w
+}
+
+proc Mouse_nextbaudrate { win } {
+ global baudRate
+
+ set w [winpathprefix $win]
+ if { [$w.mouse.brate.$baudRate cget -state] == "disabled" } {
+ return
+ }
+ do {
+ set baudRate [expr $baudRate*2]
+ if { $baudRate > 9600 } {
+ set baudRate 1200
+ }
+ } while { [$w.mouse.brate.$baudRate cget -state] == "disabled" }
+}
+
+proc Mouse_nextresolution { win } {
+ global mseRes
+
+ set w [winpathprefix $win]
+ set mseRes [expr $mseRes/2]
+ if { $mseRes < 50 } {
+ set mseRes 200
+ }
+ $w.mouse.resolution.$mseRes invoke
+}
+
+proc Mouse_incrsamplerate { win } {
+ global sampleRate
+
+ set w [winpathprefix $win]
+ if { [$w.mouse.srate.scale cget -state] == "disabled" } {
+ return
+ }
+
+ set max [$w.mouse.srate.scale cget -to]
+ set interval [expr [$w.mouse.srate.scale cget -tickinterval]/2.0]
+ if { $sampleRate+$interval > $max } {
+ set sampleRate 0
+ } else {
+ set sampleRate [expr $sampleRate+$interval]
+ }
+}
+
+proc Mouse_increm3timeout { win } {
+ global emulate3Timeout
+
+ set w [winpathprefix $win]
+ if { [$w.mouse.em3tm.scale cget -state] == "disabled" } {
+ return
+ }
+ set max [$w.mouse.em3tm.scale cget -to]
+ set interval [expr [$w.mouse.em3tm.scale cget -tickinterval]/2.0]
+ if { $emulate3Timeout+$interval > $max } {
+ set emulate3Timeout 0
+ } else {
+ set emulate3Timeout [expr $emulate3Timeout+$interval]
+ }
+}
+
+proc Mouse_set_em3but { win } {
+ global emulate3Buttons chordMiddle
+
+ set w [winpathprefix $win]
+ if { $emulate3Buttons } {
+ $w.mouse.em3tm.scale configure -state normal
+ } else {
+ $w.mouse.em3tm.scale configure -state disabled
+ }
+ if { $chordMiddle && $emulate3Buttons } {
+ $w.mouse.chdmid invoke
+ }
+}
+
+proc Mouse_set_chdmid { win } {
+ global emulate3Buttons chordMiddle
+
+ set w [winpathprefix $win]
+ if { $chordMiddle && $emulate3Buttons } {
+ $w.mouse.em3but invoke
+ }
+}
+
+proc Mouse_setsettings { win } {
+ global mseType baudRate sampleRate clearDTR Pointer
+ global emulate3Buttons emulate3Timeout chordMiddle clearRTS
+ global mseRes mseButtons mseDeviceSelected messages
+
+ set w [winpathprefix $win]
+ $w.mouse.bot.mesg configure -foreground black \
+ -text $messages(mouse.4)
+ $win configure -cursor watch
+ update idletasks
+ set mseDeviceSelected 1
+ set msedev [$w.mouse.device.entry get]
+ set em3but off
+ set chdmid off
+ if $emulate3Buttons {set em3but on}
+ if $chordMiddle {set chdmid on}
+ set flags ""
+ if $clearDTR {lappend flags ClearDTR}
+ if $clearRTS {lappend flags ClearRTS}
+ if { "$mseType" == "MouseSystems" } {lappend flags ReOpen}
+ if [string length $msedev] {
+ set Pointer(RealDev) $msedev
+ check_tmpdirs
+ unlink $Pointer(Device)
+ if [link $Pointer(RealDev) $Pointer(Device)] {
+ lappend flags ReOpen
+ }
+ }
+ check_tmpdirs
+ set result [catch { eval [list xf86misc_setmouse \
+ $msedev $mseType $baudRate $sampleRate $mseRes $mseButtons \
+ $em3but $emulate3Timeout $chdmid] $flags } ]
+ if { $result } {
+ bell -displayof $w
+ } else {
+ set Pointer(Protocol) $mseType
+ if { [$w.mouse.brate.1200 cget -state] == "disabled" } {
+ set Pointer(BaudRate) ""
+ } else {
+ set Pointer(BaudRate) $baudRate
+ }
+ if { [$w.mouse.srate.scale cget -state] == "disabled"
+ || $sampleRate == 0 } {
+ set Pointer(SampleRate) ""
+ } else {
+ set Pointer(SampleRate) $sampleRate
+ }
+ set Pointer(Resolution) $mseRes
+ set Pointer(Buttons) $mseButtons
+ set Pointer(Emulate3Buttons) [expr $emulate3Buttons?"ON":""]
+ set Pointer(Emulate3Timeout) \
+ [expr $emulate3Buttons?$emulate3Timeout:""]
+ set Pointer(ChordMiddle) [expr $chordMiddle?"ON":""]
+ set Pointer(ClearDTR) [expr $clearDTR?"ON":""]
+ set Pointer(ClearRTS) [expr $clearRTS?"ON":""]
+ }
+ $w.mouse.bot.mesg configure \
+ -text $messages(mouse.9) \
+ -foreground [$w.mouse.top.title cget -foreground]
+ $win configure -cursor top_left_arrow
+}
+
+proc Mouse_getsettings { win } {
+ global mseType mseTypeList baudRate sampleRate clearDTR Pointer
+ global emulate3Buttons emulate3Timeout chordMiddle clearRTS
+ global mseRes mseButtons mseDeviceSelected SupportedMouseTypes
+
+ set w [winpathprefix $win]
+ set initlist [xf86misc_getmouse]
+ set initdev [lindex $initlist 0]
+ set inittype [lindex $initlist 1]
+ set initbrate [lindex $initlist 2]
+ set initsrate [lindex $initlist 3]
+ set initres [lindex $initlist 4]
+ set initbtn [lindex $initlist 5]
+ set initem3btn [lindex $initlist 6]
+ set initem3tm [lindex $initlist 7]
+ set initchdmid [lindex $initlist 8]
+ set initflags [lrange $initlist 9 end]
+
+ set mseDeviceSelected 1
+ if [getuid] {
+ pack forget $w.mouse.device.title
+ pack forget $w.mouse.device.entry
+ pack forget $w.mouse.device.list
+ } else {
+ if { [info exists Pointer(RealDev)] } {
+ $w.mouse.device.entry insert 0 $Pointer(RealDev)
+ } else {
+ set default [Mouse_defaultdevice $inittype]
+ if { [string length $default] } {
+ $w.mouse.device.entry insert 0 $default
+ set mseDeviceSelected 0
+ } else {
+ pack forget $w.mouse.device.title
+ pack forget $w.mouse.device.entry
+ pack forget $w.mouse.device.list
+ }
+ }
+ }
+ Mouse_setlistbox $w $w.mouse.device.list.lb
+ $w.mouse.brate.$initbrate invoke
+
+ set chordMiddle [expr [string compare $initchdmid on] == 0]
+ set emulate3Buttons [expr [string compare $initem3btn on] == 0]
+ set emulate3Timeout $initem3tm
+ set sampleRate $initsrate
+ set mseRes $initres
+ if { $mseRes <= 0 } {
+ set mseRes 100
+ }
+ $w.mouse.resolution.$mseRes invoke
+ set mseButtons $initbtn
+ if { $mseButtons < 3 } {
+ set mseButtons 3
+ } elseif { $mseButtons > 5 } {
+ set mseButtons 5
+ }
+ $w.mouse.buttons.$mseButtons invoke
+ set clearDTR [expr [string first $initflags ClearDTR] >= 0]
+ set clearRTS [expr [string first $initflags ClearRTS] >= 0]
+
+ foreach mse $mseTypeList {
+ $w.mouse.type.[string tolower $mse] \
+ configure -state disabled
+ }
+ set mtype [string tolower $inittype]
+ if { $mtype == "osmouse" || $mtype == "xqueue" } {
+ $w.mouse.type.$mtype configure -state normal
+ } else {
+ foreach mse $SupportedMouseTypes {
+ $w.mouse.type.[string tolower $mse] \
+ configure -state normal
+ }
+ }
+ $w.mouse.type.$mtype invoke
+}
+
+proc Mouse_setentry { win lbox } {
+ global Pointer mseDeviceSelected
+
+ set w [winpathprefix $win]
+ set idx [$lbox curselection]
+ if ![string length $idx] {
+ return
+ }
+ $w.mouse.device.entry delete 0 end
+ set devname [$lbox get $idx]
+ $w.mouse.device.entry insert end $devname
+ set Pointer(RealDev) $devname
+ set mseDeviceSelected 1
+}
+
+proc Mouse_setlistbox { win lbox } {
+ global Pointer mseDevices
+
+ set w [winpathprefix $win]
+ set devname [$w.mouse.device.entry get]
+ if ![string length $devname] {
+ return
+ }
+ set Pointer(RealDev) $devname
+ if { [set idx [lsearch $mseDevices $devname]] != -1 } {
+ $lbox selection clear 0 end
+ $lbox selection set $idx
+ $lbox activate $idx
+ $lbox see $idx
+ }
+}
+
+proc Mouse_defaultdevice { mousetype } {
+ global mseDevices
+
+ switch $mousetype {
+ PS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ IMPS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ ThikingMousePS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ MouseManPlusPS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ GlidePointPS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ NetMousePS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ NetScrollPS/2 { set idx [lsearch -regexp $mseDevices \
+ {/dev/p[ms].*} ] }
+ BusMouse { set idx [lsearch -regexp $mseDevices \
+ /dev/.*bm|/dev/mse.* ] }
+ SysMouse { set idx [lsearch -regexp $mseDevices \
+ /dev/sysmouse.* ] }
+ OsMouse -
+ Xqueue { return "" }
+ default { set idx [lsearch -regexp $mseDevices \
+ /dev/cua*|/dev/tty* ] }
+ }
+ if { $idx == -1 } {
+ set idx 0
+ }
+ return [lindex $mseDevices $idx]
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/mseproto.cpp b/xc/programs/Xserver/hw/xfree86/XF86Setup/mseproto.cpp
new file mode 100644
index 000000000..72604156c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/mseproto.cpp
@@ -0,0 +1,78 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/mseproto.cpp,v 3.2 1998/12/13 07:37:42 dawes Exp $ */
+
+#if defined(PC98)
+set SerialMouseTypes [list \
+ "Microsoft" \
+ "Logitech" \
+ "MouseMan" \
+ "IntelliMouse" \
+]
+#else
+set SerialMouseTypes [list \
+ "Microsoft" \
+ "MouseSystems" \
+ "MMSeries" \
+ "Logitech" \
+ "MouseMan" \
+ "MMHitTab" \
+ "GlidePoint" \
+ "IntelliMouse" \
+ "ThinkingMouse" \
+]
+#endif
+
+set BusMouseTypes [list \
+ "BusMouse" \
+]
+
+#if defined(PC98)
+set StandardPS2Types []
+set ExtendedPS2Types []
+#else
+set StandardPS2Types [list \
+ "PS/2" \
+]
+
+set ExtendedPS2Types [list \
+ "IMPS/2" \
+ "ThinkingMousePS/2" \
+ "MouseManPlusPS/2" \
+ "GlidePointPS/2" \
+ "NetMousePS/2" \
+ "NetScrollPS/2" \
+]
+#endif
+
+set PnpMouseTypes [list \
+ "Auto" \
+]
+
+
+#if defined(__FreeBSD__)
+set ExtraMouseTypes [list \
+ "SysMouse" \
+]
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types \
+ $PnpMouseTypes $ExtraMouseTypes
+#elif defined(__NetBSD__)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $PnpMouseTypes
+#elif defined(__OpenBSD__)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types \
+ $PnpMouseTypes
+#elif defined(Lynx)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types
+#elif defined(ISC)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types
+#elif defined(sun) && defined(i386) && defined(SVR4)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types
+#elif defined(DGUX)
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types \
+ $PnpMouseTypes $ExtendedPS2Types
+#elif defined (SVR4) || defined(SYSV)
+#define MOUSE_TYPES $SerialMouseTypes $PnpMouseTypes
+#else
+#define MOUSE_TYPES $SerialMouseTypes $BusMouseTypes $StandardPS2Types \
+ $PnpMouseTypes $ExtendedPS2Types
+#endif
+
+set SupportedMouseTypes [concat MOUSE_TYPES]
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/ph2notk.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/ph2notk.tcl
new file mode 100644
index 000000000..dd902b1e4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/ph2notk.tcl
@@ -0,0 +1,67 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/ph2notk.tcl,v 1.1 1999/04/05 07:13:00 dawes Exp $
+#
+# Copyright 1997 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Phase II - Curses/Text server configuration
+#
+
+set XKBavailable 0
+Kbd_setxkbcomponents
+puts $XKBComponents(models,names)
+puts $XKBComponents(models,descriptions)
+puts $XKBComponents(options,names)
+puts $XKBComponents(options,descriptions)
+sleep 100
+
+mesg "\n\
+ There are five areas of configuration that need to\
+ be completed:\n\
+ Mouse - Use this to set the protocol, baud rate, etc.\
+ used by your mouse\n\
+ Keyboard - Set the nationality and layout of\
+ your keyboard\n\
+ Card - Used to select the chipset, RAMDAC, etc.\
+ of your card\n\
+ Monitor - Use this to enter your\
+ monitor's capabilities\n\
+ Other - Configure some miscellaneous settings\n\n\
+ You'll probably want to start with configuring your\
+ mouse (you can just press \[Enter\] to do so)\n\
+ and when you've finished configuring all five of these,\
+ select the Done button.\n\n\
+ You can also press ? or click on the Help button at\
+ any time for additional instructions\n\n" \
+ okay "Introduction to Configuration with XF86Setup"
+
+proc Intro_popup_help { win } {
+ .introhelp.text insert 0.0 "\n\
+ You need to fill in the requested information on each\
+ of the five\n\
+ configuration screens. The buttons along the top allow\
+ you to choose which\n\
+ screen you are going to work on. You can do them in\
+ any order or go back\n\
+ to each of them as many times as you like, however,\
+ it will be very\n\
+ difficult to use some of them if your mouse is not\
+ working, so you\n\
+ should configure your mouse first.\n\n\
+ Until you get your mouse working, here are some keys you\
+ can use:\n\n\
+ \ \ Tab, Ctrl-Tab Move to the \"next\" widget\n\
+ \ \ Shift-Tab Move to the \"previous\" widget\n\
+ \ \ <Arrow keys> Move in the appropriate direction\n\
+ \ \ Return Activate the selected widget\n\n\
+ Also, you can press Alt and one of the underlined letters\
+ to activate the\n\
+ corresponding button."
+ .introhelp.text configure -state disabled
+ button .introhelp.ok -text "Dismiss" -command "destroy .introhelp"
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/phase1.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase1.tcl
new file mode 100644
index 000000000..aaabb58b5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase1.tcl
@@ -0,0 +1,401 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/phase1.tcl,v 3.21 1999/07/12 08:14:26 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: phase1.tcl /main/3 1996/10/28 05:42:26 kaleb $
+
+#
+# Phase I - Initial text mode interaction w/user and starting of SVGA server
+#
+set clicks1 [clock clicks]
+
+# load the autoload stuff
+source $tcl_library/init.tcl
+# load language specific library
+source $XF86Setup_library/texts/local_text.tcl
+# load in our library
+source $XF86Setup_library/setuplib.tcl
+source $XF86Setup_library/filelist.tcl
+source $XF86Setup_library/carddata.tcl
+source $XF86Setup_library/kbddata.tcl
+source $XF86Setup_library/mondata.tcl
+
+proc check_for_files { xwinhome } {
+ global FilePermsDescriptions FilePermsReadMe messages
+
+ foreach var [array names FilePermsDescriptions] {
+ global FilePerms$var
+ foreach tmp [array names FilePerms$var] {
+ set pattern [lindex $tmp 0]
+ set perms [lindex $tmp 1] ;# ignored (for now at least)
+ if ![llength [glob -nocomplain -- $xwinhome/$pattern]] {
+ set msg [format "$messages(phase1.1) %s %s %s %s" \
+ $FilePermsDescriptions($var) \
+ $messages(phase1.2) \
+ $xwinhome/$pattern $messages(phase1.3)]
+ mesg [parafmt 65 $msg] okay
+ exit 1
+ }
+ }
+ }
+ foreach readme [array names FilePermsReadMe] {
+ set pattern [lindex $readme 0]
+ set perms [lindex $readme 1] ;# ignored (for now at least)
+ if ![llength [glob -nocomplain -- $xwinhome/$pattern]] {
+ mesg [parafmt 65 $messages(phase1.4)] okay
+ break
+ }
+ }
+}
+
+proc set_xf86config_defaults {} {
+ global Xwinhome ConfigFile messages
+ global Files Server Keyboard Pointer MonitorIDs DeviceIDs
+
+ if {![catch {xf86config_readfile $Xwinhome files server \
+ keyboard mouse monitor device screen} tmp]} {
+ array set Files [array get files]
+ array set Server [array get Server]
+ array set Keyboard [array get keyboard]
+ array set Pointer [array get mouse]
+ foreach drvr { Mono VGA2 VGA16 SVGA Accel } {
+ global Scrn_$drvr
+ if [info exists screen_$drvr] {
+ array set Scrn_$drvr [array get screen_$drvr]
+ } else {
+ set Scrn_${drvr}(Driver) ""
+ }
+ }
+ set MonitorIDs [set DeviceIDs ""]
+ set primon 0
+ set priname "Primary Monitor"
+ global Monitor_$priname
+ foreach mon [info vars monitor_*] {
+ set id [string range $mon 8 end]
+ global Monitor_$id
+ if { "$id" == "$priname" } {
+ set primon 1
+ } else {
+ array set Monitor_$id [array get Monitor_$priname]
+ }
+ lappend MonitorIDs $id
+ array set Monitor_$id [array get monitor_$id]
+ }
+ if !$primon { global Monitor_$priname; unset Monitor_$priname }
+ set pridev 0
+ set priname "Primary Card"
+ global Device_$priname
+ foreach dev [info vars device_*] {
+ set id [string range $dev 7 end]
+ global Device_$id
+ if { "$id" == "$priname" } {
+ set pridev 1
+ } else {
+ array set Device_$id [array get Device_$priname]
+ }
+ lappend DeviceIDs $id
+ array set Device_$id [array get device_$id]
+ set Device_${id}(Options) [set Device_${id}(Option)]
+ set Device_${id}(Server) NoMatch
+ }
+ if !$pridev { global Device_$priname; unset Device_$priname }
+ set fd [open $ConfigFile r]
+ set ws "\[ \t\]"
+ set nqt {[^"]}
+ set alnum {[A-Z0-9]}
+ set idpat "^$ws+\[Ii]\[Dd]$nqt+\"($nqt*)\""
+ set servpat "\"$nqt*\"$ws+##.*SERVER:$ws*($alnum+)"
+ while { [gets $fd line] >= 0 } {
+ set tmp [string toupper [zap_white $line] ]
+ if { [string compare $tmp {SECTION"DEVICE"}] == 0 } {
+ while { [gets $fd nextline] >= 0 } {
+ set upper [string toupper $nextline]
+ if { [regexp $idpat $nextline dummy id] } {
+ set found [regexp $servpat $upper dummy serv]
+ if $found {
+ if { [string match XF86_* $serv] } {
+ set serv [string range $serv 5 end]
+ }
+ set Device_${id}(Server) $serv
+ }
+ break
+ }
+ if ![string compare [string trim $upper] "ENDSECTION"] {
+ break
+ }
+ }
+ }
+ }
+ close $fd
+ global ServerList
+ foreach devid $DeviceIDs {
+ set varname Device_${devid}(Server)
+ if { ![info exists $varname] ||
+ [lsearch -exact $ServerList [set $varname]] < 0} {
+ set filename $Xwinhome/bin/X
+ for {set nlinks 0} \
+ {[file exists $filename] && \
+ [file type $filename]=="link" && $nlinks<20} \
+ {incr nlinks} {
+ set filename [readlink $filename]
+ }
+ set $varname [string range [file tail $filename] 5 end]
+ if { [lsearch -exact $ServerList [set $varname]] < 0
+ || $nlinks == 20} {
+ set $varname SVGA
+ }
+ }
+ }
+ } else {
+ mesg $messages(phase1.5) okay
+ puts $tmp
+ exit 0
+ }
+}
+
+proc parray {a {pattern *}} {
+ upvar 1 $a array
+ if ![array exists array] {
+ error "\"$a\" isn't an array"
+ }
+ set maxl 0
+ foreach name [lsort [array names array $pattern]] {
+ if {[string length $name] > $maxl} {
+ set maxl [string length $name]
+ }
+ }
+ set maxl [expr {$maxl + [string length $a] + 2}]
+ foreach name [lsort [array names array $pattern]] {
+ set nameString [format %s(%s) $a $name]
+ puts stdout [format "%-*s = %s" $maxl $nameString $array($name)]
+ }
+}
+
+#########
+puts "XF86Setup is not yet functional. Please use xf86config for now."
+exit 0
+
+set vlist [xf86config_readfile Cfg]
+foreach arr [lsort [info vars Cfg*]] {
+ #parray $arr
+}
+xf86config_writefile test.cfg Cfg
+#exit 0
+
+if { !$NoCurses } {
+ if [info exists env(TERM)] {
+ if {[catch {curses init} retval]} {
+ puts [format $messages(phase1.27) $env(TERM)]
+ sleep 2
+ set NoCurses 1
+ }
+ } else {
+ puts $messages(phase1.28)
+ sleep 2
+ set NoCurses 1
+ }
+}
+
+check_for_files $Xwinhome
+
+#set ConfigFile [xf86config_findfile]
+set ConfigFile XF86Config
+set StartServer 1
+set ReConfig 0
+set UseConfigFile 0
+set UseLoader 1
+if !$pc98 {
+ if { ![file exists $Xwinhome/bin/XF86_LOADER] } {
+ set UseLoader 0
+ }
+} else {
+ if { ![file exists $Xwinhome/bin/XF98_LOADER] } {
+ set UseLoader 0
+ }
+}
+if { [string length $ConfigFile] > 0 } {
+ if [info exists env(DISPLAY)] {
+ set msg [format "%s\n \n%s\n \n%s" \
+ [parafmt 65 $messages(phase1.6)] \
+ [parafmt 65 $messages(phase1.7)] \
+ $messages(phase1.8) ]
+ set ReConfig [mesg $msg yesno]
+ }
+ if { $ReConfig } {
+ set UseConfigFile 1
+ set StartServer 0
+ if { [getuid] != 0 } {
+ if { [mesg $messages(phase1.9) yesno] == 0 } {
+ exit 1
+ }
+ }
+ } else {
+ if { [getuid] != 0 } {
+ mesg $messages(phase1.10) okay
+ exit 1
+ }
+ if !$pc98 {
+ if { !$UseLoader && ![file exists $Xwinhome/bin/XF86_SVGA] } {
+ if !$NoTk {
+ mesg $messages(phase1.11) okay
+ set NoTk 1
+ }
+ }
+ } else {
+ if { !$UseLoader && ![file exists $Xwinhome/bin/XF98_EGC] \
+ && ![file exists $Xwinhome/bin/XF98_PEGC]} {
+ mesg $messages(phase1.12) okay
+ exit 1
+ }
+ }
+ set UseConfigFile [mesg $messages(phase1.13) yesno]
+ }
+ # initialize the configuration variables
+ initconfig $Xwinhome
+
+ set UseConfigFile 0
+ if { $UseConfigFile } {
+ set_xf86config_defaults
+ }
+} else {
+ set ConfigFile /etc/XF86Config
+ if { [getuid] != 0 } {
+ mesg $messages(phase1.14) okay
+ exit 1
+ }
+ if !$pc98 {
+ if { !$ReConfig && !$UseLoader
+ && ![file exists $Xwinhome/bin/XF86_SVGA] } {
+ if !$NoTk {
+ mesg $messages(phase1.15) okay
+ set NoTk 1
+ }
+ }
+ } else {
+ if { !$ReConfig && !$UseLoader
+ && ![file exists $Xwinhome/bin/XF98_EGC]
+ && ![file exists $Xwinhome/bin/XF98_PEGC] } {
+ mesg $messages(phase1.16) okay
+ exit 1
+ }
+ }
+ # initialize the configuration variables
+ initconfig $Xwinhome
+}
+
+set clicks2 [clock clicks]
+
+if { ![getuid] } {
+ if { !$UseConfigFile } {
+ # Check for the SysV Xqueue mouse driver
+ if { [file exists /etc/conf/pack.d/xque]
+ && [file exists /usr/lib/mousemgr] } {
+ set xque [mesg $messages(phase1.17) yesno]
+ if $xque {
+ set Keyboard(Protocol) Xqueue
+ set Pointer(Protocol) Xqueue
+ set Pointer(Device) ""
+ }
+ }
+
+ # Check for the SCO OsMouse
+ if { [file exists /etc/conf/pack.d/cn/class.h]
+ && [file exists /etc/conf/pack.d/ev] } {
+ set osmse [mesg $messages(phase1.18) yesno]
+ if $osmse {
+ set Pointer(Protocol) OsMouse
+ set Pointer(Device) ""
+ }
+ }
+ }
+}
+
+set PID [pid]
+if { [info exists env(TMPDIR)] } {
+ set XF86SetupDir $env(TMPDIR)/.XF86Setup$PID
+} else {
+ set XF86SetupDir /tmp/.XF86Setup$PID
+}
+
+
+if ![mkdir $XF86SetupDir 0700] {
+ mesg "$messages(phase1.19)$XF86SetupDir$messages(phase1.20)" okay
+ exit 1
+}
+
+set rand1 [random 1073741823]
+random seed [expr $clicks2-$clicks1]
+set rand2 [random 1073741823]
+
+set TmpDir $XF86SetupDir/[format "%x-%x" $rand1 $rand2]
+if ![mkdir $TmpDir 0700] {
+ mesg "$messages(phase1.19)$TmpDir$messages(phase1.20)" okay
+ exit 1
+}
+check_tmpdirs
+
+if { ![getuid] } {
+ if [string length $Pointer(Device)] {
+ if {[file exists $Pointer(Device)]
+ && [file type $Pointer(Device)] == "link" } {
+ set Pointer(RealDev) [readlink $Pointer(Device)]
+ set Pointer(OldLink) $Pointer(Device)
+ if ![string compare $Pointer(RealDev) "/dev/psaux"] {
+ set Pointer(Protocol) "PS/2"
+ }
+ } else {
+ set Pointer(RealDev) $Pointer(Device)
+ }
+ set Pointer(Device) $TmpDir/mouse
+ }
+ if [info exists Pointer(RealDev)] {
+ link $Pointer(RealDev) $Pointer(Device)
+ }
+}
+
+set Confname $TmpDir/Config
+
+if $NoTk { set StartServer 0 }
+
+if $StartServer {
+ # write out a temp XF86Config file
+ if !$pc98 {
+ writeXF86Config $Confname-1 -vgamode -generic
+ } else {
+ writeXF86Config $Confname-1 -vgamode
+ }
+
+ mesg $messages(phase1.23) okay
+
+ if !$pc98 {
+ set ServerPID [start_server SVGA $Confname-1 ServerOut-1]
+ } else {
+ if !$pc98_EGC {
+ set ServerPID [start_server PEGC $Confname-1 ServerOut-1]
+# if {$ServerPID == 0 || $ServerPID == -1} {
+# puts "Unable to start PEGC server!\n\
+# try to start EGC server.\n";
+# set pc98_EGC 1;
+# }
+ } else {
+ set ServerPID [start_server EGC $Confname-1 ServerOut-1]
+ }
+ }
+
+ if { $ServerPID == 0 } {
+ mesg $messages(phase1.24) info
+ set NoTk 1
+ }
+ if { $ServerPID == -1 } {
+ mesg $messages(phase1.25) info
+ exit 1
+ }
+} else {
+ if !$NoTk {
+ mesg $messages(phase1.26) info
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/phase2.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase2.tcl
new file mode 100644
index 000000000..ead50b6f4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase2.tcl
@@ -0,0 +1,219 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/phase2.tcl,v 3.16 1999/04/05 07:13:00 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: phase2.tcl /main/2 1996/10/25 10:21:29 kaleb $
+
+#
+# Phase II - Commands run after connection is made to VGA16 server
+#
+
+set_resource_defaults
+
+wm withdraw .
+
+create_main_window [set w .xf86setup]
+
+# put up a message ASAP so the user knows we're still alive
+label $w.waitmsg -text $messages(phase2.1)
+pack $w.waitmsg -expand yes -fill both
+update idletasks
+
+if $StartServer {
+ mesg $messages(phase2.14) info
+}
+
+if { [catch {set XKBhandle [xkb_read from_server]} res] } {
+ $w.waitmsg configure -text $messages(phase2.2)
+ update idletasks
+ after 10000
+ set XKBavailable 0
+ set retval ""
+} else {
+ set XKBavailable 1
+ set retval [xkb_listrules $XKBrules]
+}
+
+if { [llength $retval] < 4 } {
+ Kbd_setxkbcomponents
+} else {
+ set XKBComponents(models,names) [lindex $retval 0]
+ set XKBComponents(models,descriptions) [lindex $retval 1]
+ set XKBComponents(layouts,names) [lindex $retval 2]
+ set XKBComponents(layouts,descriptions) [lindex $retval 3]
+ set XKBComponents(variants,names) [lindex $retval 4]
+ set XKBComponents(variants,descriptions) [lindex $retval 5]
+ set XKBComponents(options,names) [lindex $retval 6]
+ set XKBComponents(options,descriptions) [lindex $retval 7]
+}
+
+# Setup the default bindings for the various widgets
+source $tcl_library/tk.tcl
+
+source $XF86Setup_library/mseproto.tcl
+source $XF86Setup_library/mouse.tcl
+source $XF86Setup_library/keyboard.tcl
+source $XF86Setup_library/card.tcl
+source $XF86Setup_library/monitor.tcl
+source $XF86Setup_library/srvflags.tcl
+source $XF86Setup_library/done.tcl
+source $XF86Setup_library/modeselect.tcl
+
+proc Intro_create_widgets { win } {
+ global XF86Setup_library
+ global pc98_EGC pc98 messages
+
+ set w [winpathprefix $win]
+ if !$pc98_EGC {
+ frame $w.intro -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.intro -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ image create bitmap XFree86-logo \
+ -foreground black -background cyan \
+ -file $XF86Setup_library/pics/XFree86.xbm \
+ -maskfile $XF86Setup_library/pics/XFree86.msk
+ label $w.intro.logo -image XFree86-logo
+ pack $w.intro.logo
+
+ frame $w.intro.textframe
+ text $w.intro.textframe.text
+ $w.intro.textframe.text tag configure heading \
+ -justify center -foreground yellow \
+ -font -adobe-times-bold-i-normal--24-240-*-*-p-*-iso8859-1
+ make_intro_headline $w.intro.textframe.text
+ $w.intro.textframe.text insert end $messages(phase2.12)
+ if !$pc98_EGC {
+ pack $w.intro.textframe.text -fill both -expand yes
+ pack $w.intro.textframe -fill both -expand yes -padx 10 -pady 10
+ } else {
+ scrollbar $w.intro.textframe.scroll \
+ -command "$w.intro.textframe.text yview"
+ bind $w.intro <Prior> \
+ "$w.intro.textframe.text yview scroll -1 unit;break;"
+ bind $w.intro <Next> \
+ "$w.intro.textframe.text yview scroll 1 unit;break;"
+
+ $w.intro.textframe.text configure \
+ -yscrollcommand "$w.intro.textframe.scroll set"
+ pack $w.intro.textframe.scroll -side right -fill y
+ pack $w.intro.textframe.text -fill both -expand yes -side right
+ pack $w.intro.textframe -fill both -expand yes -padx 10 -pady 10
+ }
+ $w.intro.textframe.text configure -state disabled
+}
+
+proc Intro_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.intro -side top -fill both -expand yes
+}
+
+proc Intro_deactivate { win } {
+ set w [winpathprefix $win]
+ pack forget $w.intro
+}
+
+proc config_select { win } {
+ global CfgSelection prevSelection
+
+ set w [winpathprefix $win]
+ $win configure -cursor watch
+ ${prevSelection}_deactivate $win
+ set prevSelection $CfgSelection
+ ${CfgSelection}_activate $w
+ $win configure -cursor top_left_arrow
+}
+
+proc config_help { win } {
+ global CfgSelection
+
+ set w [winpathprefix $win]
+ ${CfgSelection}_popup_help $win
+}
+
+frame $w.menu -width 640
+
+radiobutton $w.menu.mouse -text $messages(phase2.3) -indicatoron false \
+ -variable CfgSelection -value Mouse -underline 0 \
+ -command [list config_select $w]
+radiobutton $w.menu.keyboard -text $messages(phase2.4) -indicatoron false \
+ -variable CfgSelection -value Keyboard -underline 0 \
+ -command [list config_select $w]
+radiobutton $w.menu.card -text $messages(phase2.5) -indicatoron false \
+ -variable CfgSelection -value Card -underline 0 \
+ -command [list config_select $w]
+radiobutton $w.menu.monitor -text $messages(phase2.6) -indicatoron false \
+ -variable CfgSelection -value Monitor -underline 2 \
+ -command [list config_select $w]
+radiobutton $w.menu.modeselect -text $messages(phase2.7) -indicatoron false \
+ -variable CfgSelection -value Modeselection -underline 4 \
+ -command [list config_select $w]
+radiobutton $w.menu.other -text $messages(phase2.8) -indicatoron false \
+ -variable CfgSelection -value Other -underline 0 \
+ -command [list config_select $w]
+if !$pc98 {
+ pack $w.menu.mouse $w.menu.keyboard $w.menu.card \
+ $w.menu.monitor $w.menu.modeselect $w.menu.other \
+ -side left -fill both -expand yes
+} else {
+ pack $w.menu.mouse $w.menu.card $w.menu.monitor \
+ $w.menu.modeselect $w.menu.other \
+ -side left -fill both -expand yes
+}
+
+frame $w.buttons
+#label $w.buttons.xlogo -bitmap @/usr/X11R6/include/X11/bitmaps/xlogo16 -anchor w
+#label $w.buttons.xlogo -bitmap @/usr/tmp/xfset1.xbm -anchor w \
+ -foreground black
+#pack $w.buttons.xlogo -side left -anchor w -expand no -padx 0 -fill x
+button $w.buttons.abort -text $messages(phase2.9) -underline 0 \
+ -command "clear_scrn;puts stderr Aborted;shutdown 1"
+button $w.buttons.done -text $messages(phase2.10) -underline 0 \
+ -command [list Done_execute $w]
+button $w.buttons.help -text $messages(phase2.11) -underline 0 \
+ -command [list config_help $w]
+pack $w.buttons.abort $w.buttons.done $w.buttons.help \
+ -expand no -side left -padx 50
+
+Intro_create_widgets $w
+if !$pc98 {
+ Keyboard_create_widgets $w
+}
+Mouse_create_widgets $w
+Card_create_widgets $w
+Monitor_create_widgets $w
+Modeselect_create_widgets $w
+Other_create_widgets $w
+Done_create_widgets $w
+
+proc ac_bind { win letter command } {
+ bind $win <Alt-$letter> $command
+ bind $win <Control-$letter> $command
+}
+
+bind $w <Alt-x> [list I'm an error]
+ac_bind $w a [list $w.buttons.abort invoke]
+ac_bind $w d [list $w.buttons.done invoke]
+ac_bind $w h [list config_help $w]
+bind $w ? [list config_help $w]
+ac_bind $w m [list $w.menu.mouse invoke]
+ac_bind $w c [list $w.menu.card invoke]
+ac_bind $w k [list $w.menu.keyboard invoke]
+ac_bind $w n [list $w.menu.monitor invoke]
+ac_bind $w s [list $w.menu.modeselect invoke]
+ac_bind $w o [list $w.menu.other invoke]
+set_default_arrow_bindings
+
+set CfgSelection Intro
+set prevSelection Intro
+destroy $w.waitmsg
+pack $w.menu -side top -fill x
+pack $w.buttons -side bottom -expand no
+config_select $w
+focus $w.menu.mouse
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/phase3.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase3.tcl
new file mode 100644
index 000000000..1969e0021
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase3.tcl
@@ -0,0 +1,75 @@
+# $XConsortium: phase3.tcl /main/1 1996/09/21 14:17:37 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/phase3.tcl,v 3.5 1998/04/05 16:15:51 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Phase III - Commands run after switching back to text mode
+# - responsible for starting second server
+#
+
+source $tcl_library/init.tcl
+source $XF86Setup_library/texts/local_text.tcl
+source $XF86Setup_library/setuplib.tcl
+source $XF86Setup_library/carddata.tcl
+source $XF86Setup_library/mondata.tcl
+source $StateFileName
+
+mesg $messages(phase3.1) info
+sleep 2
+writeXF86Config $Confname-2 -defaultmodes
+
+set devid [lindex $DeviceIDs 0]
+global Device_$devid
+set server [set Device_${devid}(Server)]
+
+set ServerPID [start_server $server $Confname-2 ServerOut-2 ]
+
+if { $ServerPID == -1 } {
+ set msg $messages(phase3.2)
+}
+
+if { $ServerPID == 0 } {
+ set msg $messages(phase3.3)
+}
+
+if { $ServerPID < 1 } {
+ mesg "$msg$messages(phase3.4)" okey
+ set Phase2FallBack 1
+ set ServerPID [start_server $server $Confname-1 ServerOut-1Bis]
+ if { $ServerPID < 1 } {
+ mesg $messages(phase3.5) info
+ exit 1
+ }
+}
+
+if { ![string length [set Device_${devid}(ClockChip)]] } {
+ set fd [open $TmpDir/ServerOut-2 r]
+ set clockrates ""
+ set zerocount 0
+ while {[gets $fd line] >= 0} {
+ if {[regexp {\(.*: clocks: (.*)$} $line dummy clocks]} {
+ set clocks [string trim [squash_white $clocks]]
+ foreach clock [split $clocks] {
+ lappend clockrates $clock
+ if { $clock < 0.1 } {
+ incr zerocount
+ }
+ }
+ }
+ }
+ close $fd
+ set clockcount [llength $clockrates]
+ if { $clockcount != 0 && 1.0*$zerocount/$clockcount < 0.25 } {
+ set Device_${devid}(Clocks) $clockrates
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/phase4.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase4.tcl
new file mode 100644
index 000000000..718053211
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase4.tcl
@@ -0,0 +1,111 @@
+# $XConsortium: phase4.tcl /main/1 1996/09/21 14:17:41 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/phase4.tcl,v 3.11 1999/04/05 07:13:01 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Phase IV - Commands run after second server is started
+#
+
+source $XF86Setup_library/texts/local_text.tcl
+source $XF86Setup_library/vidmode.tcl
+
+if $StartServer {
+ set_resource_defaults
+
+ wm withdraw .
+
+ create_main_window [set w .xf86setup]
+
+ # put up a message ASAP so the user knows we're still alive
+ label $w.waitmsg -text $messages(phase4.1)
+ pack $w.waitmsg -expand yes -fill both
+ update idletasks
+
+ mesg "The program is running on a different virtual terminal\n\n\
+ Please switch to the correct virtual terminal" info
+
+ source $tk_library/tk.tcl
+ set_default_arrow_bindings
+ set msg $messages(phase4.13)
+} else {
+ set msg ""
+}
+
+proc Phase4_adj_modes { win } {
+ global Xwinhome
+
+ VidMode_activate $win
+}
+
+proc Phase4_nextphase { win } {
+ global Confname StartServer messages
+
+ set w [winpathprefix $win]
+ set saveto [$w.saveto.entry get]
+ check_tmpdirs
+ writeXF86Config $Confname-3 -displayof $w -realdevice
+ set backupmsg ""
+ make_message_phase4 $saveto
+ if [file exists $saveto] {
+ if {[catch {exec mv $saveto $saveto.bak} ret] != 0} {
+ bell
+ $w.mesg configure -text $messages(phase4.2)
+ return
+ }
+ set backupmsg $messages(phase4.3)
+ }
+ if {[catch {exec cp $Confname-3 $saveto} ret] != 0} {
+ bell
+ $w.mesg configure -text $messages(phase4.4)
+ return
+ }
+ $w.text configure -text $messages(phase4.5)
+ pack forget $w.buttons $w.mesg $w.saveto
+ if $StartServer {
+ set cmd {mesg $messages(phase4.14) info; shutdown}
+ } else {
+ set cmd {shutdown;source $XF86Setup_library/phase5.tcl}
+ }
+ button $w.okay -text $messages(phase4.6) -command $cmd
+ pack $w.text $w.okay -side top
+ focus $w.okay
+}
+
+label $w.text -text " $msg$messages(phase4.7)"
+frame $w.saveto
+label $w.saveto.title -text $messages(phase4.8)
+entry $w.saveto.entry -bd 2 -width 40
+pack $w.saveto.title $w.saveto.entry -side left
+if [getuid] {
+ if [info exists env(HOME)] {
+ $w.saveto.entry insert end $env(HOME)/XF86Config
+ } else {
+ $w.saveto.entry insert end /tmp/XF86Config.$PID
+ }
+} else {
+ $w.saveto.entry insert end $ConfigFile
+}
+label $w.mesg -text ""
+frame $w.buttons
+button $w.buttons.xvidtune -text $messages(phase4.9) \
+ -command [list Phase4_adj_modes $w]
+button $w.buttons.save -text $messages(phase4.10) \
+ -command [list Phase4_nextphase $w]
+button $w.buttons.abort -text $messages(phase4.11) \
+ -command "clear_scrn;puts stderr $messages(phase4.12);shutdown 1"
+pack $w.buttons.xvidtune $w.buttons.save $w.buttons.abort -side top \
+ -pady 5m -fill x
+
+catch {destroy $w.waitmsg}
+pack $w.text $w.saveto $w.buttons $w.mesg -side top -pady 8m
+focus $w.buttons.save
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl
new file mode 100644
index 000000000..68497560a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl
@@ -0,0 +1,91 @@
+# $XConsortium: phase5.tcl /main/4 1996/10/28 05:42:32 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/phase5.tcl,v 3.11 1998/04/05 16:15:52 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Phase V - Final commands after return to text mode
+#
+
+check_tmpdirs
+clear_scrn
+foreach fname [glob -nocomplain $TmpDir/*] {
+ unlink $fname
+}
+rmdir $TmpDir
+rmdir $XF86SetupDir
+
+if { ![getuid] } {
+ set idx -1
+ if { [llength $DeviceIDs] == 1 } {
+ set idx 0
+ } else {
+ if [string length $Scrn_Accel(Device)] {
+ set idx [lsearch $DeviceIDs $Scrn_Accel(Device)]
+ } else {
+ set idx [lsearch $DeviceIDs $Scrn_SVGA(Device)]
+ }
+ }
+ if { $idx >= 0 } {
+ set devid [lindex $DeviceIDs $idx]
+ global Device_$devid
+ set server [set Device_${devid}(Server)]
+ set linkname $Xwinhome/bin/X
+ set lastlink $linkname
+ for {set nlinks 0} \
+ {[file exists $linkname] && [file type $linkname]=="link" \
+ && $nlinks<20} \
+ {incr nlinks} {
+ set lastlink $linkname
+ set linkname [readlink $linkname]
+ }
+ catch {
+ if { [file type $linkname]=="link" && ![file exists $linkname] } {
+ set lastlink [readlink $linkname]
+ }
+ }
+ if { [file type $linkname]=="link" && ![file exists $linkname] } {
+ set lastlink [readlink $linkname]
+ }
+
+ if { $nlinks < 20 } {
+ set servname [string range [file tail $linkname] 5 end]
+ if ![string compare $servname $server] {
+ unset linkname
+ }
+ } else {
+ set linkname $Xwinhome/bin/X
+ }
+ }
+ if [info exists linkname] {
+ set linkdir [file dirname $lastlink]
+ set mklink [mesg \
+ "$messages(phase5.1)$server$messages(phase5.2)\
+ $linkdir$messages(phase5.3)" yesno]
+ if $mklink {
+ set CWD [pwd]
+ cd $linkdir
+ catch "unlink X" ret
+ if [catch "link $Xwinhome/bin/XF86_$server X" ret] {
+ mesg $messages(phase5.4) okay
+ } else {
+ mesg $messages(phase5.5) okay
+ }
+ cd $CWD
+ }
+ }
+}
+
+clear_scrn
+puts $messages(phase5.6)
+
+exit 0
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.msk b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.msk
new file mode 100644
index 000000000..98294fc88
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.msk
@@ -0,0 +1,388 @@
+#define XFlogo_width 242
+#define XFlogo_height 149
+static unsigned char XFlogo_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x7f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
+ 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x0f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x1f, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00,
+ 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x03, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07,
+ 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xfc, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x1f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
+ 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x7f, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xfe, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x7f, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01,
+ 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xe0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x80, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x3f, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x1f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x07, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00,
+ 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x01, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x03, 0xfc, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x24, 0x6d,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x3f, 0x00, 0x24, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
+ 0x20, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x20, 0x54, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f,
+ 0x00, 0x00, 0x20, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x20, 0x44, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.xbm
new file mode 100644
index 000000000..d4cc61338
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/XFree86.xbm
@@ -0,0 +1,388 @@
+#define XFlogo_width 242
+#define XFlogo_height 149
+static unsigned char XFlogo_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x7f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x1f, 0x00, 0x00,
+ 0x00, 0x80, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0xfe, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0xf3, 0x71, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0x61,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0x60, 0x78, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0xf0, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x60, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x30, 0xf8, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0xbe,
+ 0x0f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0xde, 0x1f, 0x78, 0x1c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
+ 0x00, 0x7e, 0x1e, 0x3c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x3c, 0x00, 0x1f, 0x0e, 0x1e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x0f, 0x0f,
+ 0xdf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x3e, 0x00, 0x0f, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x80,
+ 0x07, 0x4f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xff, 0xff, 0x1f, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x1f, 0x00, 0x1e, 0x80, 0x87, 0x67, 0x0f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00,
+ 0x1f, 0x80, 0x87, 0x37, 0x0f, 0x0c, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00,
+ 0xfe, 0x01, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0xff, 0xff, 0x1f,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x1f, 0xc0, 0x83, 0x1f, 0xfe,
+ 0x07, 0x00, 0xe0, 0xff, 0x01, 0x00, 0x80, 0xff, 0x0f, 0x80, 0x03, 0x00,
+ 0x00, 0x00, 0x0c, 0x00, 0xf8, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x07, 0xfc,
+ 0x0f, 0xe0, 0xff, 0xc0, 0x03, 0x0f, 0xfc, 0x01, 0x00, 0xf8, 0xff, 0x03,
+ 0x00, 0xe0, 0xff, 0x1f, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0xe0,
+ 0xff, 0x00, 0xf0, 0x8f, 0xff, 0x03, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7e, 0xf0, 0x0f, 0x00, 0xf0, 0x87, 0x3f, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0xe0, 0xff, 0x00, 0xf0, 0x87, 0xff,
+ 0x01, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+ 0xc0, 0x0f, 0x00, 0xf8, 0x83, 0x3f, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x83, 0xff, 0x01, 0xc0, 0x0f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x80, 0x1f, 0x00, 0xfc, 0x81,
+ 0x7f, 0x00, 0x1c, 0x00, 0x00, 0x80, 0x03, 0x00, 0xc0, 0xff, 0x01, 0xf8,
+ 0x81, 0xff, 0x01, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x0f, 0x80, 0x1f, 0x00, 0xfe, 0xc0, 0x7f, 0x00, 0x3c, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x80, 0xff, 0x01, 0xfc, 0x80, 0xff, 0x00, 0x80, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x3f, 0x00,
+ 0xff, 0xc0, 0x7f, 0x00, 0x78, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff,
+ 0x03, 0x3e, 0xc0, 0xff, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x07, 0x00, 0x3f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0xf8,
+ 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xff, 0x03, 0x1f, 0xc0, 0xff, 0x00,
+ 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00,
+ 0x3f, 0x80, 0x3f, 0xc0, 0x7f, 0x00, 0xb0, 0x01, 0x00, 0xe0, 0x00, 0x00,
+ 0x00, 0xff, 0x83, 0x0f, 0xc0, 0x7f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x3f, 0xc0, 0x3f, 0x80, 0x3f,
+ 0x00, 0xf0, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00, 0xfe, 0xc7, 0x07, 0xc0,
+ 0x7f, 0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
+ 0x07, 0x00, 0x3f, 0xe0, 0x3f, 0x00, 0x1f, 0x00, 0xe0, 0x03, 0x00, 0x70,
+ 0x00, 0x00, 0x00, 0xfe, 0xc7, 0x03, 0xe0, 0x7f, 0x00, 0x07, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x80, 0x1f, 0xe0, 0x1f,
+ 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x30, 0x00, 0x00, 0x00, 0xfe, 0xef,
+ 0x01, 0xe0, 0x7f, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xe0, 0x1f, 0x80, 0x1f, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x06,
+ 0x00, 0x38, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0xe0, 0x3f, 0xc0, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0xc0, 0x0f,
+ 0xf0, 0x0f, 0x00, 0x00, 0x00, 0xc0, 0x0d, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0xfc, 0x7f, 0x00, 0xe0, 0x3f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0xff, 0xe0, 0x07, 0xf8, 0x0f, 0x00, 0x00, 0x00,
+ 0x80, 0x0f, 0x00, 0x1c, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xf0, 0x3f,
+ 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff,
+ 0xf3, 0x03, 0xf8, 0xcf, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x0c, 0x00,
+ 0x00, 0x00, 0xf8, 0x1f, 0x00, 0xf0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x1b, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00,
+ 0xf0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0x37, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0xf9, 0x1f,
+ 0x3c, 0x00, 0x7e, 0x00, 0x80, 0x1f, 0x00, 0x80, 0xff, 0x3f, 0x00, 0xfc,
+ 0x1f, 0xfe, 0x03, 0x00, 0x00, 0x3f, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xe0,
+ 0x7f, 0x00, 0xf8, 0x1f, 0xff, 0xf9, 0x1f, 0x7f, 0x80, 0xff, 0x01, 0xe0,
+ 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0xfc, 0x0f, 0xfc, 0x07, 0x00, 0x00,
+ 0x77, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0x0f, 0xfc,
+ 0xf0, 0x8f, 0xff, 0xe0, 0xe7, 0x03, 0xf8, 0xf9, 0x00, 0x00, 0xff, 0xff,
+ 0x00, 0xfc, 0x07, 0xf8, 0x07, 0x00, 0x00, 0x6e, 0x00, 0x06, 0x00, 0x00,
+ 0x00, 0xf8, 0xff, 0x00, 0xf8, 0x0f, 0xf8, 0xc0, 0xcf, 0xfc, 0xf0, 0xc1,
+ 0x03, 0x7c, 0xf0, 0x00, 0xc0, 0xff, 0xff, 0x01, 0xfe, 0x07, 0xf8, 0x07,
+ 0x00, 0x00, 0x76, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0xfc,
+ 0x0f, 0xf8, 0xc0, 0x6f, 0xfc, 0xf8, 0xc1, 0x07, 0x7e, 0xf0, 0x01, 0xf0,
+ 0xf3, 0xff, 0x03, 0xfe, 0x03, 0xf8, 0x0f, 0x00, 0x00, 0xee, 0x00, 0x06,
+ 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0xfc, 0x0f, 0xf8, 0xc0, 0x3f, 0xfc,
+ 0xfc, 0xc0, 0x07, 0x3f, 0xf0, 0x01, 0xf8, 0xc1, 0xff, 0x03, 0xfe, 0x03,
+ 0xf8, 0x0f, 0x00, 0x00, 0xde, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9f, 0xff,
+ 0x01, 0xfc, 0x07, 0x78, 0xc0, 0x1f, 0x78, 0x7e, 0xc0, 0x87, 0x1f, 0xf0,
+ 0x01, 0xfc, 0x00, 0xff, 0x07, 0xfe, 0x03, 0xf8, 0x0f, 0x00, 0x00, 0xfe,
+ 0x00, 0x06, 0x00, 0x00, 0x80, 0x8f, 0xff, 0x01, 0xfc, 0x07, 0x70, 0xe0,
+ 0x1f, 0x00, 0x7e, 0xe0, 0x87, 0x1f, 0xf8, 0x01, 0x7e, 0x00, 0xfc, 0x07,
+ 0xfe, 0x03, 0xf8, 0x0f, 0x00, 0x00, 0xde, 0x00, 0x03, 0x00, 0x00, 0xc0,
+ 0x07, 0xff, 0x03, 0xfe, 0x07, 0x78, 0xe0, 0x0f, 0x00, 0x7f, 0xe0, 0xc3,
+ 0x1f, 0xf8, 0x00, 0x7f, 0x00, 0xf8, 0x07, 0xfe, 0x01, 0xf8, 0x0f, 0x00,
+ 0x00, 0xfc, 0x00, 0x03, 0x00, 0x00, 0xe0, 0x03, 0xff, 0x03, 0xfe, 0x07,
+ 0x78, 0xe0, 0x0f, 0x00, 0x3f, 0xf8, 0xc1, 0x0f, 0x7e, 0x00, 0x3f, 0x00,
+ 0xf8, 0x07, 0xfe, 0x01, 0xf8, 0x0f, 0x00, 0x00, 0xdc, 0x00, 0x03, 0x00,
+ 0x00, 0xf0, 0x01, 0xff, 0x07, 0xfe, 0x03, 0x38, 0xf0, 0x07, 0x80, 0x3f,
+ 0xfe, 0xe0, 0x8f, 0x3f, 0x80, 0x3f, 0x00, 0xf0, 0x07, 0xfe, 0x01, 0xf8,
+ 0x0f, 0x00, 0x00, 0xbc, 0x01, 0x03, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0x07,
+ 0xfe, 0x03, 0x00, 0xf0, 0x07, 0x80, 0xff, 0x3f, 0xe0, 0xff, 0x0f, 0x80,
+ 0x3f, 0x00, 0xf0, 0x07, 0xfe, 0x01, 0xfc, 0x07, 0x00, 0x00, 0xfc, 0x01,
+ 0x03, 0x00, 0x00, 0x7c, 0x00, 0xfe, 0x0f, 0xff, 0x03, 0x00, 0xf0, 0x03,
+ 0x80, 0xff, 0x03, 0xe0, 0xff, 0x00, 0x80, 0x3f, 0x00, 0xf0, 0x07, 0xfe,
+ 0x01, 0xfc, 0x07, 0x00, 0x00, 0xac, 0x01, 0x03, 0x00, 0x00, 0x3e, 0x00,
+ 0xfc, 0x0f, 0xff, 0x03, 0x00, 0xf0, 0x03, 0x80, 0x3f, 0x00, 0xe0, 0x0f,
+ 0x00, 0x80, 0x3f, 0x00, 0xf0, 0x03, 0xfc, 0x01, 0xfc, 0x03, 0x00, 0x00,
+ 0xdc, 0x01, 0x03, 0x00, 0x00, 0x1f, 0x00, 0xfc, 0x0f, 0xff, 0x01, 0x00,
+ 0xf8, 0x03, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0x00, 0x80, 0x3f, 0x00, 0xf0,
+ 0x03, 0xfc, 0x01, 0xfc, 0x03, 0x00, 0x00, 0xec, 0x01, 0x06, 0x00, 0x80,
+ 0x1f, 0x00, 0xf8, 0x1f, 0xff, 0x01, 0x00, 0xf8, 0x01, 0x80, 0x3f, 0x00,
+ 0xe0, 0x0f, 0x00, 0x80, 0x7f, 0x00, 0xf8, 0x01, 0xfc, 0x01, 0xfe, 0x01,
+ 0x00, 0x00, 0xde, 0x01, 0x06, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x9f, 0xff,
+ 0x01, 0x00, 0xf8, 0x01, 0x80, 0x3f, 0x80, 0xe0, 0x0f, 0x20, 0x00, 0x7f,
+ 0x00, 0xf8, 0x00, 0xf8, 0x01, 0xfe, 0x00, 0x00, 0x00, 0xbe, 0x03, 0x06,
+ 0x00, 0xf8, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x01, 0x00,
+ 0x3f, 0xc0, 0xc1, 0x0f, 0x70, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xf0, 0x03,
+ 0x7f, 0x00, 0x00, 0x00, 0x76, 0x03, 0x06, 0x00, 0xff, 0xff, 0xc3, 0xff,
+ 0xff, 0xff, 0x7f, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0xe0, 0xc0, 0x1f, 0x38,
+ 0x00, 0xfe, 0x83, 0x7f, 0x00, 0xf0, 0x03, 0x3f, 0x00, 0x00, 0x00, 0xae,
+ 0x03, 0x06, 0x00, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xfc,
+ 0x00, 0x00, 0xfe, 0x38, 0x80, 0x3f, 0x0e, 0x00, 0xf8, 0xff, 0x1f, 0x00,
+ 0xe0, 0xc7, 0x1f, 0x00, 0x00, 0x00, 0xd6, 0x01, 0x06, 0x00, 0xff, 0xff,
+ 0xe1, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x1f, 0x00,
+ 0xff, 0x07, 0x00, 0xe0, 0xff, 0x07, 0x00, 0x80, 0xff, 0x07, 0x00, 0x00,
+ 0x00, 0xbe, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x01, 0x0c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xbb, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xef, 0x00, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0xd7, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xbe, 0x00, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0xdd, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xfe,
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xee,
+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf1, 0x00, 0x00, 0x00, 0x00,
+ 0xe0, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x75, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x00, 0xf0, 0xe0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00,
+ 0x38, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0x6f, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xe0, 0x03, 0x00,
+ 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xe0, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x75, 0x00, 0x80, 0x01,
+ 0x00, 0x00, 0x00, 0xf8, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xb8, 0x3a, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, 0xe0,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00,
+ 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x35, 0x00,
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x7c, 0xf0, 0x03, 0x70, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xec, 0x1a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x7c, 0xf0, 0xf9, 0xff, 0xf0, 0x0f, 0xfe, 0xc1, 0x0f, 0xf8, 0x87, 0xff,
+ 0x00, 0x00, 0xf0, 0xe1, 0xef, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x7c,
+ 0x1f, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0xf8, 0xe8, 0xfd, 0x7c,
+ 0x38, 0xf6, 0xf1, 0x38, 0x7c, 0xce, 0xff, 0x00, 0x00, 0xf0, 0xe1, 0xf7,
+ 0x07, 0x3e, 0x07, 0x00, 0x00, 0x00, 0xae, 0x0f, 0x00, 0x00, 0x0e, 0x00,
+ 0x00, 0x00, 0xfc, 0x3f, 0xe0, 0xf7, 0x3c, 0x78, 0xf8, 0x78, 0x3c, 0x1e,
+ 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0x80, 0x9f, 0x07, 0x8f, 0x07, 0x00, 0x00,
+ 0x00, 0x5f, 0x07, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3e, 0x07, 0xe0,
+ 0x63, 0x3e, 0x78, 0xf8, 0x3c, 0x3c, 0x1f, 0x0f, 0x0f, 0x00, 0x00, 0xf8,
+ 0x80, 0x8f, 0x87, 0x8f, 0x07, 0x00, 0x00, 0x00, 0xaf, 0x06, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xf0, 0x01, 0x1f, 0x7c, 0xf8, 0x3c,
+ 0x1e, 0x0f, 0x06, 0x0f, 0x00, 0x00, 0xf8, 0xc0, 0x87, 0x87, 0x07, 0x03,
+ 0x00, 0x00, 0x80, 0x57, 0x03, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1e,
+ 0x00, 0xf0, 0x00, 0x1f, 0x7c, 0x78, 0xbe, 0x8f, 0x0f, 0x80, 0x07, 0x00,
+ 0x00, 0xf8, 0xc0, 0xc3, 0xc3, 0x07, 0x00, 0x00, 0x00, 0xc0, 0xbb, 0x03,
+ 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1e, 0x00, 0xf0, 0x00, 0x0f, 0x7c,
+ 0x7c, 0xfe, 0x81, 0x07, 0x80, 0x07, 0x00, 0x00, 0x7c, 0xc0, 0xc3, 0xc3,
+ 0x03, 0x00, 0x00, 0x00, 0xe0, 0xd5, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00,
+ 0x00, 0x1f, 0x00, 0xf0, 0x00, 0x0f, 0x3e, 0x7c, 0x1e, 0x80, 0x07, 0x80,
+ 0x27, 0x0e, 0x00, 0x7c, 0xc0, 0xc3, 0xd3, 0x03, 0xe0, 0x00, 0x00, 0xb0,
+ 0xea, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x1f, 0x00, 0x78, 0x00,
+ 0x0f, 0x3e, 0x7c, 0x1e, 0x80, 0x07, 0xc2, 0x33, 0x1f, 0x00, 0x7c, 0xe0,
+ 0xe1, 0xd9, 0x03, 0xf1, 0x01, 0x00, 0x78, 0xf5, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x0f, 0x00, 0x78, 0x00, 0x0e, 0x1e, 0x3c, 0x1e, 0x98,
+ 0x0f, 0xc3, 0x1b, 0x1f, 0x00, 0x7c, 0xe0, 0xe1, 0xc9, 0x87, 0xf1, 0x01,
+ 0x00, 0xac, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x1f, 0x00,
+ 0x78, 0x00, 0x1e, 0x07, 0x3e, 0xfc, 0x0f, 0xff, 0xc1, 0x0f, 0x1f, 0x00,
+ 0xfe, 0xe0, 0xe1, 0x87, 0xff, 0xf0, 0x01, 0x00, 0x76, 0x35, 0x00, 0x00,
+ 0x00, 0x00, 0x0c, 0x00, 0xe0, 0x7f, 0x00, 0x7c, 0x00, 0xf8, 0x01, 0x3e,
+ 0xf8, 0x03, 0x7c, 0x80, 0x07, 0x1e, 0x80, 0xff, 0xf1, 0xc0, 0x03, 0x3e,
+ 0xe0, 0x00, 0x00, 0xbb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x57, 0x0d,
+ 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfb, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0x55, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x9c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xae, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x5c, 0xd7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0xfa, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x57, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xbb, 0x3b,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0x75, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8,
+ 0xaa, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xdd, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xaf, 0xee, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x57, 0xf5, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xf0, 0xba, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x55, 0x1f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xaf, 0xaa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf7,
+ 0xd7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfb,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xae, 0xea, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x7c, 0xd5, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xaa, 0x3e, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xc0, 0xd7, 0xd5, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0xeb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xae, 0xee, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdf,
+ 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x7f, 0x5d, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xfe, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xeb, 0xbb,
+ 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x78, 0xf7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x55, 0xd7, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xab, 0x3f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xaf,
+ 0xbe, 0xea, 0x03, 0xfc, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0xdf, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xd5, 0x55, 0xfd, 0x00, 0x24, 0x6d,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
+ 0xaa, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
+ 0xff, 0xae, 0xfa, 0x3f, 0x00, 0x24, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x77, 0xff, 0x07, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5f, 0x57, 0xf7, 0x07, 0x00,
+ 0x20, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xbf, 0xeb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf8, 0xbf, 0xaa, 0xbe, 0xff, 0x00, 0x00, 0x20, 0x54, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf5, 0xfd,
+ 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x55, 0x57, 0xd5, 0x1f,
+ 0x00, 0x00, 0x20, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xbf, 0xef, 0xff, 0xff, 0x3f, 0x00, 0xc0,
+ 0xff, 0xff, 0xef, 0xfa, 0xfa, 0xfb, 0x01, 0x00, 0x00, 0x20, 0x44, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfe, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x75, 0x5d, 0xd5,
+ 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, 0xba, 0xea, 0xaa,
+ 0xea, 0xbf, 0xaa, 0xae, 0xaa, 0xab, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xff, 0xd7, 0x57, 0x7d, 0x5d, 0xd5, 0xd7, 0x55, 0xd7,
+ 0xf5, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
+ 0xea, 0xea, 0xaf, 0xab, 0xaa, 0xeb, 0xea, 0xff, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x55, 0x57, 0x55, 0xf5,
+ 0xd5, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xbf, 0xfa, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
+ 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.msk b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.msk
new file mode 100644
index 000000000..440d01bf0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.msk
@@ -0,0 +1,133 @@
+#define vidx_width 144
+#define vidx_height 86
+static unsigned char vidx_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0xa0, 0xaa, 0x54, 0x15,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x60, 0xf5, 0xbf, 0x1a, 0x70, 0xc4, 0x19, 0xe3, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0xe0, 0xff, 0xff, 0x1f,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0xe0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0x05, 0x00, 0xfe, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0xf0, 0x0f, 0xfc, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0x10, 0x0f, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0xf0, 0x0f, 0xe0, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0xc0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20,
+ 0xe0, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0xc0, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0x0f, 0x20, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0xc0, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0x07, 0x20,
+ 0xf0, 0x0f, 0x80, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff, 0xf1, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f, 0xfc, 0x9f, 0xff, 0xe3, 0xff, 0x20,
+ 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff, 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f,
+ 0xfc, 0x9f, 0xff, 0xe7, 0xff, 0x21, 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f, 0xfc, 0x1f, 0xff, 0xc7, 0xff, 0x21,
+ 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff, 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f,
+ 0xfc, 0x9f, 0xff, 0xe7, 0xff, 0x21, 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f, 0xfc, 0x9f, 0xff, 0xe7, 0xff, 0x21,
+ 0x10, 0x0f, 0x80, 0xfe, 0xff, 0xff, 0xf1, 0xff, 0xff, 0x7f, 0xf0, 0x7f,
+ 0xfc, 0x9f, 0xff, 0xe7, 0xff, 0x21, 0x10, 0x0f, 0x80, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x10, 0x0f, 0x80, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x0f, 0x80, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x10, 0x0f, 0x80, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf0, 0x0f, 0x80, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xe0, 0x0f, 0xfc, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0xf0, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x10, 0x0f, 0xe0, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20,
+ 0xf0, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x00, 0x85, 0xaa, 0x54, 0xa5, 0x0a,
+ 0xf1, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20,
+ 0x00, 0x85, 0xaa, 0x54, 0xa5, 0x0a, 0xf1, 0xff, 0xff, 0x7f, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x00, 0xe5, 0xff, 0xff, 0xff, 0xcf,
+ 0xf3, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20,
+ 0x00, 0xe5, 0xff, 0xff, 0xff, 0xcf, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x73, 0xce, 0x98, 0x01, 0x20,
+ 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0xff, 0x01, 0x20, 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x20,
+ 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe5, 0xff, 0xff, 0xff, 0x0f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x85, 0xaa, 0x54, 0xa5, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x85, 0xaa, 0x54, 0xa5, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x80, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f,
+ 0x00, 0x05, 0x80, 0x00, 0x00, 0x80, 0xf6, 0xfb, 0xbe, 0xb7, 0xdd, 0xdf,
+ 0x76, 0xdb, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x00, 0x00, 0x80,
+ 0xf6, 0xfb, 0xbe, 0xb7, 0xdd, 0xdf, 0x76, 0xdb, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x05, 0x80, 0x00, 0x00, 0x80, 0xf6, 0xfb, 0xbe, 0xb7, 0xdd, 0xdf,
+ 0x76, 0xdb, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x80, 0x00, 0x00, 0x80,
+ 0xf6, 0xfb, 0xbe, 0xb7, 0xdd, 0xdf, 0x76, 0xdb, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x05, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0x00, 0x00, 0x80,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0xd9, 0x76, 0x00, 0x00, 0x00, 0xf6, 0xfb, 0xb6, 0xb7, 0xdd, 0xdf,
+ 0x60, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.xbm
new file mode 100644
index 000000000..e3fc50c55
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/pics/vidcard.xbm
@@ -0,0 +1,133 @@
+#define vidx_width 144
+#define vidx_height 86
+static unsigned char vidx_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbb, 0xb6, 0x96, 0xd9, 0xdf,
+ 0x62, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf6, 0xbb, 0xb6, 0x96, 0xd9, 0xdf, 0x62, 0xda, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbb, 0xb6, 0x96, 0xd9, 0xdf,
+ 0x62, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf6, 0xbb, 0xb6, 0x96, 0xd9, 0xdf, 0x62, 0xda, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/Imakefile b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/Imakefile
new file mode 100644
index 000000000..2b1eb9812
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/Imakefile
@@ -0,0 +1,19 @@
+XCOMM $XConsortium: Imakefile /main/1 1996/09/21 14:14:32 kaleb $
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/Imakefile,v 3.2 1996/12/27 06:54:47 dawes Exp $
+
+ XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
+ SCRIPTSDIR = $(XF86SETUPLIBDIR)/scripts
+
+ SCRIPTFILES = mseconfig.tcl
+
+all::
+
+InstallNamedProg(xmseconfig,xmseconfig,$(BINDIR))
+InstallMultiple($(SCRIPTFILES),$(SCRIPTSDIR))
+
+InstallManPage(xmseconfig,$(MANDIR))
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts
new file mode 100644
index 000000000..64aaba7ee
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts
@@ -0,0 +1,80 @@
+#! /bin/sh
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/findopts,v 3.2 1997/12/06 08:53:03 hohndel Exp $
+#
+# This script should be run by XF86Setup \
+exec XF86Setup -notk `basename $0` -- ${1+"$@"}
+
+# This is just for my own use in generating a list of valid options
+# to each server as needed by carddata.tcl
+
+set xf86dir $Xwinhome/xc/programs/Xserver/hw/xfree86
+
+set dirlist [list accel/ibm8514 accel/agx accel/i128 accel/mach8\
+ accel/mach32 accel/mach64 accel/p9000 accel/s3 \
+ vga256 vga16 vga2]
+set srvlist {8514 AGX I128 Mach8 Mach32 Mach64 P9000 S3 SVGA VGA16 Mono}
+
+set fd [open $xf86dir/common/xf86_Option.h r]
+set table none
+while {[gets $fd line] >= 0} {
+ if { $table == "none" } {
+ if {[regexp {^OptFlagRec xf86_(.+)Tab.+ =} $line dummy tab]} {
+ if { $tab == "Option" } {
+ set table Options
+ } elseif { $tab == "ClockOption" } {
+ set table Clocks
+ }
+ }
+ continue
+ }
+ if {[string match {*"",*} $line]} {
+ set table none
+ continue
+ }
+ if {![regexp {"([^"]+)",[ ]*([A-Z_]+TION_[^ \}]+)} $line dummy nam val]} {
+ continue
+ }
+ if ![info exists ${table}($val)] {
+ set ${table}($val) ""
+ }
+ lappend ${table}($val) $nam
+}
+close $fd
+set Clocks(CLOCK_OPTION_PROGRAMABLE) ""
+
+for {set idx 0} {$idx < [llength $srvlist]} {incr idx} {
+ set srv [lindex $srvlist $idx]
+ cd $xf86dir/[lindex $dirlist $idx]
+ set optlist ""
+ set clklist ""
+ set lines [exec find . -name {*.[hc]} -print | xargs grep OPTION_]
+ foreach line [split $lines \n] {
+ if [regexp {[^_](OPTION_[0-9A-Z_]+)} $line dummy opt] {
+ lappend optlist $opt
+ }
+ if [regexp {(CLOCK_OPTION_[0-9A-Z_]+)} $line dummy opt] {
+ lappend clklist $opt
+ }
+ }
+ set optnamlist ""
+ foreach opt [lrmdups $optlist] {
+ if [info exists Options($opt)] {
+ eval lappend optnamlist $Options($opt)
+ } else {
+ puts "Unknown option: $opt"
+ }
+ }
+ puts "CardOptions($srv) = $optnamlist"
+ set clknamlist ""
+ foreach opt [lrmdups $clklist] {
+ if [info exists Clocks($opt)] {
+ eval lappend clknamlist $Clocks($opt)
+ } else {
+ puts "Unknown clock option: $opt"
+ }
+ }
+ puts "CardClockChips($srv) = $clknamlist"
+ puts ""
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/mseconfig.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/mseconfig.tcl
new file mode 100644
index 000000000..20ba1c9d2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/mseconfig.tcl
@@ -0,0 +1,104 @@
+# $XConsortium: mseconfig.tcl /main/1 1996/09/21 14:14:40 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/mseconfig.tcl,v 3.4 1998/03/27 23:23:07 hohndel Exp $
+
+set clicks1 [clock clicks]
+
+array set Pointer {
+ Device ""
+ Protocol ""
+ BaudRate ""
+ SampleRate ""
+ Resolution ""
+ Buttons ""
+ Emulate3Buttons ""
+ Emulate3Timeout ""
+ ChordMiddle ""
+ ClearDTR ""
+ ClearRTS ""
+}
+
+set ConfigFile [xf86config_findfile]
+if ![getuid] {
+ if {![catch {xf86config_readfile $Xwinhome files server \
+ keyboard mouse monitor device screen} tmp]} {
+ if [info exists mouse] {
+ set Pointer(Device) $mouse(Device)
+ if [string length $mouse(Device)] {
+ if {[file exists $mouse(Device)]
+ && [file type $mouse(Device)] == "link" } {
+ set Pointer(RealDev) [readlink $mouse(Device)]
+ set Pointer(OldLink) $mouse(Device)
+ } else {
+ set Pointer(RealDev) $mouse(Device)
+ }
+ }
+ }
+ foreach var {files server keyboard mouse} {
+ catch {unset $var}
+ }
+ foreach var [info vars monitor_*] {
+ catch {unset $var}
+ }
+ foreach var [info vars device_*] {
+ catch {unset $var}
+ }
+ foreach var [info vars screen_*] {
+ catch {unset $var}
+ }
+ }
+ set clicks2 [clock clicks]
+}
+
+if { [info exists env(TMPDIR)] } {
+ set XF86SetupDir $env(TMPDIR)/.XF86Setup[pid]
+} else {
+ set XF86SetupDir /tmp/.XF86Setup[pid]
+}
+
+
+if ![mkdir $XF86SetupDir 0700] {
+ mesg "Unable to make directory $XF86SetupDir\n\
+ for storing temporary files" okay
+ exit 1
+}
+
+source $XF86Setup_library/texts/local_text.tcl
+source $XF86Setup_library/setuplib.tcl
+if ![getuid] {
+ set rand1 [random 1073741823]
+ random seed [expr $clicks2-$clicks1]
+ set rand2 [random 1073741823]
+
+ set TmpDir $XF86SetupDir/[format "%x-%x" $rand1 $rand2]
+ if ![mkdir $TmpDir 0700] {
+ mesg "Unable to make directory $TmpDir\n\
+ for storing temporary files" okay
+ exit 1
+ }
+} else {
+ set TmpDir $XF86SetupDir
+}
+
+check_tmpdirs
+
+if ![getuid] {
+ set Pointer(Device) $TmpDir/mouse
+ if [info exists Pointer(RealDev)] {
+ link $Pointer(RealDev) $Pointer(Device)
+ }
+}
+
+set_resource_defaults
+source $XF86Setup_library/mseproto.tcl
+source $XF86Setup_library/mouse.tcl
+Mouse_create_widgets .
+Mouse_activate .
+button .mouse.exit -text $messages(mouse.17) \
+ -command "exit 0" -underline $messages(mouse.18)
+pack .mouse.exit -side bottom -expand yes -fill x
+bind . <Alt-x> "exit 0"
+bind . <Control-x> "exit 0"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig
new file mode 100644
index 000000000..6d37e2e18
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig
@@ -0,0 +1,10 @@
+#! /bin/sh
+# $XConsortium: xmseconfig /main/1 1996/09/21 14:14:44 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig,v 3.2 1996/12/27 06:54:49 dawes Exp $
+#
+
+exec XF86Setup -script mseconfig.tcl "$@"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man
new file mode 100644
index 000000000..327e282b1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man
@@ -0,0 +1,55 @@
+.\" $XConsortium: xmseconfig.man /main/3 1996/12/09 17:42:35 kaleb $
+.\"
+.\"
+.\"
+.\"
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man,v 3.4 1997/11/16 06:18:46 dawes Exp $
+.TH xmseconfig 1 "Release 6.4 (XFree86 3.3.1)" "X Version 11"
+.SH NAME
+xmseconfig - Graphical mouse configuration utility
+.SH SYNOPSIS
+.B xmseconfig
+[ -sync ] [ -display \fIdisplay\fP ] [ -geometry \fIgeometry\fP ]
+.SH DESCRIPTION
+.I xmseconfig
+enables the user to make changes to the server's mouse configuration.
+Changes apply only to the currently running server and are not saved
+to a configuration file as they are with \fBXF86Setup\fP.
+.SH ARGUMENTS
+.TP 14
+.B -sync
+Turn on synchronization for all communication with an X server.
+.TP 14
+.BI -display " display"
+Specify the display to talk to.
+.TP 14
+.BI -geometry " geomspec"
+Specify the initial geometry for the window.
+.SH ENVIRONMENT
+.TP 14
+.B XWINHOME
+If set, indicates the parent directory of X bin and lib directories.
+.TP 14
+.B XF86SETUPLIB
+If set, overrides the default location of the library directory
+(normally <XRoot>/lib/X11/XF86Setup).
+.SH FILES
+<XRoot>/lib/X11/XF86Config
+.br
+\fIor\fP /etc/XF86Config
+.RS 14
+Used to determine the link to the mouse device
+.RE
+.SH "SEE ALSO"
+\fIQuick-Start Guide to XFree86 Setup\fP
+.br
+XF86Setup(1), XFree86(1), XF86Config(4/5),
+xf86config(1), XF86Misc(3)
+.SH AUTHOR
+.PP
+Joe Moss, \fIjoe@XFree86.org\fP
+.SH NOTES
+If the program is unable to read the mouse configuration from
+the existing XF86Config file or if the user is not the superuser,
+changes to the mouse device are disallowed.
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/setuplib.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/setuplib.tcl
new file mode 100644
index 000000000..59e2fb35c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/setuplib.tcl
@@ -0,0 +1,805 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/setuplib.tcl,v 3.23 1999/04/05 07:13:01 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $XConsortium: setuplib.tcl /main/3 1996/10/25 10:21:33 kaleb $
+
+#
+# Library of routines used by XF86Setup
+#
+
+# Initialize all the variables that hold configuration info
+
+proc initconfig {xwinhome} {
+ global Files ServerFlags Module Keyboard Pointer
+ global "Monitor_Primary Monitor" "Device_Primary Card"
+ global DeviceIDs MonitorIDs
+ global Scrn_Accel Scrn_Mono Scrn_VGA2 Scrn_VGA16 Scrn_SVGA
+ global pc98 pc98_EGC
+
+ set fontdir "$xwinhome/lib/X11/fonts"
+ set Files(FontPath) [list $fontdir/misc:unscaled \
+ $fontdir/75dpi:unscaled $fontdir/100dpi:unscaled \
+ $fontdir/Type1 $fontdir/Speedo \
+ $fontdir/misc $fontdir/75dpi $fontdir/100dpi ]
+ set Files(RGBPath) $xwinhome/lib/X11/rgb
+ set Files(ModulePath) ""
+ set Files(LogFile) ""
+
+
+ if !$pc98 {
+ set Module(Load) vga
+ } else {
+ if !$pc98_EGC {
+ set Module(Load) pegc
+ } else {
+ set Module(Load) egc
+ }
+ }
+
+ set ServerFlags(NoTrapSignals) ""
+ set ServerFlags(DontZap) ""
+ set ServerFlags(DontZoom) ""
+ set ServerFlags(DisableVidModeExtension) ""
+ set ServerFlags(AllowNonLocalXvidtune) ""
+ set ServerFlags(DisableModInDev) ""
+ set ServerFlags(AllowNonLocalModInDev) ""
+
+ set Keyboard(Protocol) Standard
+ set Keyboard(ServerNumLock) ""
+ foreach key { AutoRepeat LeftAlt RightAlt ScrollLock
+ RightCtl XLeds VTSysReq VTInit
+ XkbKeycodes XkbTypes XkbCompat
+ XkbSymbols XkbGeometry XkbKeymap
+ Panix106 } {
+ set Keyboard($key) ""
+ }
+ if !$pc98 {
+ set Keyboard(XkbDisable) ""
+ set Keyboard(XkbRules) xfree86
+ set Keyboard(XkbModel) pc101
+ set Keyboard(XkbLayout) us
+ set Keyboard(XkbVariant) ""
+ set Keyboard(XkbOptions) ""
+ set Pointer(Protocol) Microsoft
+ set Pointer(Emulate3Buttons) ""
+ } else {
+ set Keyboard(XkbDisable) ""
+ set Keyboard(XkbRules) xfree98
+ set Keyboard(XkbModel) pc98
+ set Keyboard(XkbLayout) nec/jp
+ set Keyboard(XkbVariant) ""
+ set Keyboard(XkbOptions) ""
+ set Pointer(Protocol) BusMouse
+ set Pointer(Emulate3Buttons) 1
+ }
+
+# set Pointer(Device) /dev/mouse
+ set Pointer(Device) ""
+ set Pointer(BaudRate) ""
+ set Pointer(Emulate3Timeout) ""
+ set Pointer(ChordMiddle) ""
+ set Pointer(SampleRate) ""
+ set Pointer(Resolution) ""
+ set Pointer(Buttons) ""
+ set Pointer(ClearDTR) ""
+ set Pointer(ClearRTS) ""
+ set Pointer(AlwaysCore) ""
+
+ if !$pc98_EGC {
+ set id "Primary Monitor"
+ set Monitor_${id}(VendorName) Unknown
+ set Monitor_${id}(ModelName) Unknown
+ set Monitor_${id}(HorizSync) 31.5
+ set Monitor_${id}(VertRefresh) 60
+ set Monitor_${id}(Gamma) ""
+ set MonitorIDs [list $id]
+ } else {
+ set id "Primary Monitor"
+ set Monitor_${id}(VendorName) Unknown
+ set Monitor_${id}(ModelName) Unknown
+ set Monitor_${id}(HorizSync) 24.8
+ set Monitor_${id}(VertRefresh) 56.4
+ set Monitor_${id}(Gamma) ""
+ set MonitorIDs [list $id]
+ }
+ set id "Primary Card"
+ set Device_${id}(VendorName) Unknown
+ set Device_${id}(BoardName) Unknown
+ if !$pc98 {
+ set Device_${id}(Server) SVGA
+ } else {
+ if !$pc98_EGC {
+ set Device_${id}(Server) PEGC
+ } else {
+ set Device_${id}(Server) EGC
+ }
+ set uname [exec uname]
+ if {$uname == {FreeBSD}} {
+ set Pointer(Device) /dev/mse0
+ } elseif {$uname == {NetBSD}} {
+ set Pointer(Device) /dev/lms0
+ }
+ }
+ foreach key {Chipset Ramdac DacSpeed Clocks ClockChip
+ ClockProg Options VideoRam BIOSBase Membase
+ IOBase DACBase POSBase COPBase VGABase
+ Instance Speedup S3MNAdjust S3MClk S3RefClock
+ ExtraLines} {
+ set Device_${id}($key) ""
+ }
+ set DeviceIDs [list $id]
+
+ set Scrn_Accel(Driver) "Accel"
+ set Scrn_Accel(Device) "Primary Card"
+ set Scrn_Accel(Monitor) "Primary Monitor"
+ set Scrn_Accel(ScreenNo) ""
+ set Scrn_Accel(BlankTime) ""
+ set Scrn_Accel(StandbyTime) ""
+ set Scrn_Accel(SuspendTime) ""
+ set Scrn_Accel(OffTime) ""
+ set Scrn_Accel(DefaultColorDepth) ""
+
+ if !$pc98 {
+ array set Scrn_Mono [array get Scrn_Accel]
+ array set Scrn_VGA2 [array get Scrn_Accel]
+ }
+ array set Scrn_VGA16 [array get Scrn_Accel]
+ array set Scrn_SVGA [array get Scrn_Accel]
+
+ if !$pc98 {
+ set Scrn_Mono(Driver) "Mono"
+ set Scrn_VGA2(Driver) "VGA2"
+ }
+ set Scrn_SVGA(Driver) "SVGA"
+ set Scrn_VGA16(Driver) "VGA16"
+
+ if !$pc98 {
+ set Scrn_Mono(Depth,1) 1
+ set Scrn_VGA2(Depth,1) 1
+ }
+ set Scrn_VGA16(Depth,4) 4
+
+ foreach depth {4 8 15 16 24 32} {
+ set Scrn_SVGA(Depth,$depth) $depth
+ set Scrn_Accel(Depth,$depth) $depth
+ }
+}
+
+
+# Write a XF86Config file to the given fd
+
+proc writeXF86Config {filename args} {
+ global Files Module ServerFlags Keyboard Pointer UseLoader
+ global MonitorIDs DeviceIDs MonitorStdModes SelectedMonitorModes
+ global Scrn_Accel Scrn_Mono Scrn_VGA2 Scrn_VGA16 Scrn_SVGA
+ global pc98 pc98_EGC haveSelectedModes DefaultColorDepth
+
+ set generic_vga [ expr {[lsearch -exact $args -generic] >= 0} ]
+ #puts stderr "generic_vga = $generic_vga"
+ check_tmpdirs
+ set fd [open $filename w]
+ puts $fd "# XF86Config auto-generated by XF86Setup"
+ puts $fd "#"
+ puts $fd "# Copyright (c) 1996 by The XFree86 Project, Inc.\n"
+ puts $fd "#"
+ puts $fd "# Permission is hereby granted, free of charge, to any person obtaining a"
+ puts $fd {# copy of this software and associated documentation files (the "Software"),}
+ puts $fd "# to deal in the Software without restriction, including without limitation"
+ puts $fd "# the rights to use, copy, modify, merge, publish, distribute, sublicense,"
+ puts $fd "# and/or sell copies of the Software, and to permit persons to whom the"
+ puts $fd "# Software is furnished to do so, subject to the following conditions:"
+ puts $fd "#"
+ puts $fd "# The above copyright notice and this permission notice shall be included in"
+ puts $fd "# all copies or substantial portions of the Software."
+ puts $fd "#"
+ puts $fd {# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR}
+ puts $fd "# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"
+ puts $fd "# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL"
+ puts $fd "# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,"
+ puts $fd "# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF"
+ puts $fd "# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"
+ puts $fd "# SOFTWARE."
+ puts $fd "#"
+ puts $fd "# Except as contained in this notice, the name of the XFree86 Project shall"
+ puts $fd "# not be used in advertising or otherwise to promote the sale, use or other"
+ puts $fd "# dealings in this Software without prior written authorization from the"
+ puts $fd "# XFree86 Project."
+ puts $fd "#"
+ puts $fd ""
+ puts $fd "# See 'man XF86Config' for info on the format of this file"
+
+ puts $fd ""
+ puts $fd {Section "Files"}
+ puts $fd " RgbPath \"$Files(RGBPath)\""
+ foreach path $Files(FontPath) {
+ puts $fd " FontPath \"$path\""
+ }
+ puts $fd "EndSection"
+
+ if { $UseLoader && ($generic_vga || [llength $Module(Load)]) } {
+ puts $fd ""
+ puts $fd {Section "Module"}
+ if $generic_vga {
+ if !$pc98 {
+ puts $fd { Load "vga"}
+ } else {
+ if !$pc98_EGC {
+ puts $fd { Load "pegc"}
+ } else {
+ puts $fd { Load "egc"}
+ }
+ }
+ } else {
+ foreach module $Module(Load) {
+ puts $fd " Load \"$module\""
+ }
+ }
+ puts $fd { Load "extmod"}
+ puts $fd "EndSection"
+ }
+
+ puts $fd ""
+ puts $fd {Section "ServerFlags"}
+ foreach key {NoTrapSignals DontZap DontZoom} {
+ if { [string length $ServerFlags($key)] } {
+ puts " $ServerFlags($key)"
+ }
+ }
+ puts $fd "EndSection"
+
+ puts $fd ""
+ puts $fd {Section "Keyboard"}
+ puts $fd " Protocol \"$Keyboard(Protocol)\""
+ set xkbvars ""
+ foreach key [array names Keyboard {Xkb[ABCE-Z]*}] {
+ append xkbvars $Keyboard($key)
+ }
+ if { ![string length $xkbvars]
+ && [string length $Keyboard(ServerNumLock)] } {
+ puts $fd " ServerNumLock"
+ }
+ foreach key { AutoRepeat LeftAlt RightAlt ScrollLock RightCtl XLeds } {
+ if { [string length $Keyboard($key)] } {
+ puts $fd [format " %-15s %s" $key $Keyboard($key)]
+ }
+ }
+ foreach key { XkbKeycodes XkbTypes XkbCompat
+ XkbSymbols XkbGeometry XkbKeymap
+ XkbRules XkbModel XkbLayout XkbVariant XkbOptions} {
+ if { [string length $Keyboard($key)] } {
+ puts $fd [format " %-15s \"%s\"" \
+ $key $Keyboard($key)]
+ }
+ }
+ #if { [string length $Keyboard(XkbDisable)] } {
+ # puts $fd " XkbDisable"
+ #}
+ if { [string length $Keyboard(VTInit)] } {
+ puts $fd " VTInit \"$Keyboard(VTInit)\""
+ }
+ if { [string length $Keyboard(VTSysReq)] } {
+ puts $fd " VTSysReq"
+ }
+ puts $fd "EndSection"
+
+ puts $fd ""
+ puts $fd {Section "Pointer"}
+ puts $fd " Protocol \"$Pointer(Protocol)\""
+ if { [lsearch -exact $args -realdevice] >= 0
+ && [info exists Pointer(RealDev)] } {
+ set realdev $Pointer(RealDev)
+ } else {
+ set realdev ""
+ }
+ if { [string length $realdev] } {
+ if {[info exists Pointer(OldLink)]
+ && ![string compare [readlink $Pointer(OldLink)] $realdev]} {
+ puts $fd " Device \"$Pointer(OldLink)\""
+ } else {
+ puts $fd " Device \"$realdev\""
+ }
+ } elseif { [string length $Pointer(Device)] } {
+ puts $fd " Device \"$Pointer(Device)\""
+ }
+ foreach key {BaudRate Emulate3Timeout SampleRate Resolution Buttons} {
+ if { [string length $Pointer($key)] && $Pointer($key) } {
+ puts $fd [format " %-15s %s" $key $Pointer($key)]
+ }
+ }
+ foreach key {Emulate3Buttons ChordMiddle ClearDTR ClearRTS} {
+ if { [string length $Pointer($key)] } {
+ puts $fd " $key"
+ }
+ }
+ puts $fd "EndSection"
+
+ set modeNames ""
+ foreach id $MonitorIDs {
+ global Monitor_$id
+ puts $fd ""
+ puts $fd {Section "Monitor"}
+ puts $fd " Identifier \"$id\""
+ if { [string length [set Monitor_${id}(VendorName)]] } {
+ puts $fd " VendorName \"[set Monitor_${id}(VendorName)]\""
+ }
+ if { [string length [set Monitor_${id}(ModelName)]] } {
+ puts $fd " ModelName \"[set Monitor_${id}(ModelName)]\""
+ }
+ puts $fd " HorizSync [set Monitor_${id}(HorizSync)]"
+ puts $fd " VertRefresh [set Monitor_${id}(VertRefresh)]"
+ if { [string length [set Monitor_${id}(Gamma)]] } {
+ puts $fd " Gamma [set Monitor_${id}(Gamma)]"
+ }
+ set modepattern "None"
+ if { [lsearch -exact $args -vgamode] >= 0 } {
+ if !$pc98_EGC {
+ set modepattern " 640x480*"
+ } else {
+ set modepattern " 640x400*"
+ }
+ }
+ if { [lsearch -exact $args -defaultmodes] >= 0 } {
+ set modepattern "*"
+ }
+ if { [string compare None $modepattern] != 0} {
+ if { $haveSelectedModes <= 0 } {
+# puts stderr "No selected modes"
+ foreach desc [lsort -decreasing \
+ [array names MonitorStdModes $modepattern]] {
+ set modeline $MonitorStdModes($desc)
+ puts $fd "# $desc"
+ set id [format "%dx%d" \
+ [lindex $modeline 1] [lindex $modeline 5]]
+ puts $fd [format " Modeline %-11s %s" \
+ "\"$id\"" $modeline]
+ lappend modeNames $id
+ }
+ } else {
+ foreach desc [lsort -decreasing \
+ [array names SelectedMonitorModes $modepattern]] {
+ set modeline $SelectedMonitorModes($desc)
+ if ![string match \#removed $modeline] {
+ puts $fd "# $desc"
+ set id [format "%dx%d" \
+ [lindex $modeline 1] [lindex $modeline 5]]
+ puts $fd [format " Modeline %-11s %s" \
+ "\"$id\"" $modeline]
+ lappend modeNames $id
+ }
+ }
+ }
+ } else {
+ set dispof [lsearch -exact $args -displayof]
+ if { $dispof >= 0 } {
+ set dispwin [lindex $args [expr $dispof+1]]
+ set modelist [xf86vid_getallmodelines \
+ -displayof $dispwin]
+
+ } else {
+ set modelist [xf86vid_getallmodelines]
+ }
+ foreach modeline $modelist {
+ set id [format "%dx%d" \
+ [lindex $modeline 1] [lindex $modeline 5]]
+ puts $fd [format " Modeline %-11s %s" \
+ "\"$id\"" $modeline]
+ lappend modeNames $id
+ }
+ }
+ puts $fd "EndSection"
+ }
+
+ set modesList [lrmdups -decreasing -command mode_compare $modeNames]
+
+ foreach id $DeviceIDs {
+ global Device_$id
+ puts $fd ""
+ puts $fd {Section "Device"}
+ puts $fd " Identifier \"$id\""
+ foreach key {VendorName BoardName Ramdac Speedup} {
+ if { [string length [set Device_${id}($key)]] } {
+ puts $fd [format " %-15s \"%s\"" \
+ $key [set Device_${id}($key)] ]
+ }
+ }
+ if { !$generic_vga } {
+ set chipset [set Device_${id}(Chipset)]
+ if { [string length $chipset] } {
+ puts $fd " Chipset \"$chipset\""
+ }
+ } else {
+ puts $fd " Chipset \"generic\""
+ }
+ foreach opt [set Device_${id}(Options)] {
+ puts $fd " Option \"$opt\""
+ }
+ if { [lsearch -exact $args -noclocks] < 0 } {
+ set clockchip [set Device_${id}(ClockChip)]
+ if { [string length $clockchip] } {
+ puts $fd " ClockChip \"$clockchip\""
+ }
+ set clocks [set Device_${id}(Clocks)]
+ if { [string length $clocks] } {
+ puts $fd " Clocks $clocks"
+ }
+ set clockprog [set Device_${id}(ClockProg)]
+ if { [string length $clockprog] } {
+ puts $fd " ClockProg $clockprog"
+ }
+ }
+ foreach key {DacSpeed VideoRam BIOSBase Membase IOBase
+ DACBase POSBase COPBase VGABase Instance
+ S3MNAdjust S3MClk S3RefClock} {
+ if { [string length [set Device_${id}($key)]] } {
+ puts $fd [format " %-15s %s" \
+ $key [set Device_${id}($key)] ]
+ }
+ }
+ if { [string length [set Device_${id}(ExtraLines)]] } {
+ puts $fd [set Device_${id}(ExtraLines)]
+ }
+ puts $fd "EndSection"
+ }
+
+ foreach drvr {Accel SVGA VGA16 VGA2 Mono} {
+
+ if $pc98 {
+ if {![string compare $drvr "Mono"] || \
+ ![string compare $drvr "VGA2"]} \
+ continue
+ }
+ if { [string compare $drvr [set Scrn_${drvr}(Driver)]] } \
+ continue
+ puts $fd ""
+ puts $fd {Section "Screen"}
+ puts $fd " Driver \"$drvr\""
+ puts $fd " Device \"[set Scrn_${drvr}(Device)]\""
+ puts $fd " Monitor \"[set Scrn_${drvr}(Monitor)]\""
+ if { ![string compare $drvr "Accel"] ||
+ ![string compare $drvr "SVGA"] } {
+ puts $fd " DefaultColorDepth $DefaultColorDepth"
+ }
+ foreach key {ScreenNo BlankTime StandbyTime SuspendTime
+ OffTime } {
+ if { [string length [set Scrn_${drvr}($key)]] } {
+ puts $fd [format " %-15s %s" \
+ $key [set Scrn_${drvr}($key)] ]
+ }
+ }
+ foreach depth {1 4 8 15 16 24 32} {
+ if [info exists Scrn_${drvr}(Depth,$depth)] {
+ puts $fd { SubSection "Display"}
+ puts $fd " Depth $depth"
+ puts -nonewline $fd " Modes "
+ foreach mode $modesList {
+ puts -nonewline $fd " \"$mode\""
+ }
+ puts $fd ""
+ if [info exists Scrn_${drvr}(Visual,$depth)] {
+ puts $fd [format " Visual \"%s\"" \
+ [set Scrn_${drvr}(Visual,$depth)] ]
+ }
+ if { [lsearch -exact $args -vgamode] < 0 } {
+ if [info exists Scrn_${drvr}(Virtual,$depth)] {
+ puts $fd [format " Virtual %s" \
+ [set Scrn_${drvr}(Virtual,$depth)] ]
+ }
+ }
+ foreach key {ViewPort White Black Weight
+ InvertVCLK EarlySC BlankDelay} {
+ if [info exists Scrn_${drvr}($key,$depth)] {
+ puts $fd [format " %-12s %s" \
+ $key [set Scrn_${drvr}($key,$depth)] ]
+ }
+ }
+ puts $fd " EndSubSection"
+ }
+ }
+ puts $fd "EndSection"
+ }
+ close $fd
+}
+
+
+# compare two mode names of the form 0000x000
+# horizontal width is compared first, then height
+proc mode_compare { itemA itemB } {
+ set Alist [split $itemA x]
+ set Blist [split $itemB x]
+ if { [lindex $Alist 0] == [lindex $Blist 0] } {
+ return [expr [lindex $Alist 1] - [lindex $Blist 1]]
+ }
+ return [expr [lindex $Alist 0] - [lindex $Blist 0]]
+}
+
+proc set_resource_defaults {} {
+ # Colors chosen to work with the VGA16 server
+ option add *background grey
+ option add *foreground blue
+ option add *selectColor cyan
+ option add *selectForeground black
+ option add *disabledForeground "" ;# stippled
+ option add *highlightBackground grey
+ option add *font fixed
+ option add *Frame.highlightThickness 0
+ option add *Listbox.exportSelection no
+}
+
+proc create_main_window { w } {
+ toplevel $w
+ global pc98_EGC
+
+ if !$pc98_EGC {
+ $w configure -height 480 -width 640 -highlightthickness 0
+ } else {
+ $w configure -height 400 -width 640 -highlightthickness 0
+ }
+ pack propagate $w no
+ wm geometry $w +0+0
+ if !$pc98_EGC {
+ #wm minsize $w 640 480
+ } else {
+ #wm minsize $w 640 400
+ }
+}
+
+proc set_default_arrow_bindings { } {
+ foreach class {Button Checkbutton Radiobutton Entry} {
+ bind $class <Key-Down> {focus [findfocuswindow %W y 15]}
+ bind $class <Key-Right> {focus [findfocuswindow %W x 15]}
+ bind $class <Key-Up> {focus [findfocuswindow %W y -15]}
+ bind $class <Key-Left> {focus [findfocuswindow %W x -15]}
+ }
+}
+
+proc start_server { server configfile outfile } {
+ global env TmpDir Xwinhome serverNumber UseLoader pc98
+
+ if { ![info exists serverNumber] } {
+ set serverNumber 7
+ } else {
+ incr serverNumber
+ }
+ set env(DISPLAY) [set disp :$serverNumber]
+
+ if !$pc98 {
+ if { $UseLoader } {
+ if { ![string compare $server VGA16] } {
+ set pid [exec $Xwinhome/bin/XF86_LOADER $disp -bpp 4 \
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ } else {
+ set pid [exec $Xwinhome/bin/XF86_LOADER $disp \
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ }
+ } else {
+ set pid [exec $Xwinhome/bin/XF86_$server $disp \
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ }
+ } else {
+ if { $UseLoader } {
+ if { ![string compare $server EGC] } {
+ set pid [exec $Xwinhome/bin/XF98_LOADER $disp -bpp 4\
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ } else {
+ set pid [exec $Xwinhome/bin/XF98_LOADER $disp\
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ }
+ } else {
+ if { ![string compare $server EGC] } {
+ set pid [exec $Xwinhome/bin/XF98_$server $disp -bpp 4 \
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ } else {
+ set pid [exec $Xwinhome/bin/XF98_$server $disp \
+ -allowMouseOpenFail -xf86config $configfile \
+ -bestRefresh >& $TmpDir/$outfile & ]
+ }
+ }
+ }
+
+ sleep 9
+ set trycount 0
+ while { [incr trycount] < 10 } {
+ if ![process_running $pid] {
+ return 0
+ }
+ sleep 2
+ if [server_running $disp] {
+ return $pid
+ }
+ }
+ return -1
+}
+
+proc clear_scrn {} {
+ global NoCurses
+
+ if { $NoCurses } {
+ set blank \n\n\n\n\n
+ puts $blank$blank$blank$blank$blank
+ flush stdout
+ } else {
+ #catch {exec $Dialog --clear >&@stdout} ret
+ }
+}
+
+proc mesg { text {buttontype okay} {title ""} } {
+ global NoCurses message messages
+
+ if { $NoCurses } {
+ puts -nonewline $text
+ flush stdout
+ if { [string compare $buttontype yesno] == 0 } {
+ puts -nonewline " "
+ flush stdout
+ gets stdin response
+ return [string match {[yY]} [string index $response 0]]
+ }
+ if { [string compare $buttontype okay] == 0 } {
+ puts -nonewline $messages(setuplib.1)
+ flush stdout
+ gets stdin response
+ }
+ return
+ }
+ # else
+ set textlist [split $text \n]
+ set height [expr [llength $textlist]+2]
+ if { [string compare $buttontype info] != 0 } {
+ incr height 2
+ }
+ set width 0
+ foreach line $textlist {
+ if { [string length $line] > $width } {
+ set width [string length $line]
+ }
+ }
+ incr width 6
+ set minwidth 12
+ set scrninfo [stdscr info]
+ set scrnht [lindex $scrninfo 1]
+ set scrnwid [lindex $scrninfo 0]
+ switch -- $buttontype {
+ yesno {
+ set buttons "Yes No"
+ if [info exists message] {
+ append buttons " Help"
+ }
+ incr width 2
+ set minwidth 25
+ }
+ okay {
+ set buttons "Okay Cancel"
+ if [info exists message] {
+ append buttons " help"
+ }
+ }
+ okayonly { set buttons "Okay" }
+ default { set buttons "" }
+ }
+ if { $width < $minwidth } {
+ set width $minwidth
+ }
+ if { $width > [expr $scrnwid - 2] } {
+ set width [expr $scrnwid - 2]
+ }
+ if { $height > [expr $scrnht] } {
+ set height $scrnht
+ }
+ set begx [expr ($scrnwid - $width)/2]
+ set begy [expr ($scrnht - $height)/2]
+ set mesgwin mesgwin[info level]
+ curses newwin $mesgwin $height $width $begy $begx
+ stdscr update
+ $mesgwin configure -border line
+ if [string length $title] {
+ $mesgwin configure -title $title
+ }
+
+ if [string length $buttons] {
+ $mesgwin text $text
+ eval $mesgwin buttons $buttons
+ do {
+ $mesgwin update
+ set sel [$mesgwin activate]
+ if ![string compare $sel Help] {
+ mesg $message okayonly
+ }
+ } while { ![string compare $sel Help] }
+ if ![string compare $buttontype okayonly] {
+ return 1
+ }
+ if { [string compare $sel [lindex $buttons 0]] == 0 } {
+ return 1
+ } else {
+ return 0
+ }
+ } else {
+ $mesgwin text $text
+ $mesgwin update
+ }
+ return 1
+}
+
+proc save_state {} {
+ global env XF86SetupDir TmpDir StateFileName PID
+ set StateFileName "$TmpDir/state"
+ check_tmpdirs
+ set fd [open $StateFileName w]
+
+ global NoCurses Confname ConfigFile UseConfigFile UseLoader StartServer
+ global pc98
+
+ puts $fd [list set NoCurses $NoCurses]
+ puts $fd [list set Confname $Confname]
+ puts $fd [list set ConfigFile $ConfigFile]
+ puts $fd [list set UseConfigFile $UseConfigFile]
+ puts $fd [list set UseLoader $UseLoader]
+ puts $fd [list set StartServer $StartServer]
+ puts $fd [list set XF86SetupDir $XF86SetupDir]
+ puts $fd [list set TmpDir $TmpDir]
+ puts $fd [list set PID $PID]
+ global DeviceIDs MonitorIDs haveSelectedModes DefaultColorDepth
+ puts $fd [list set DeviceIDs $DeviceIDs]
+ puts $fd [list set MonitorIDs $MonitorIDs]
+ puts $fd [list set DefaultColorDepth $DefaultColorDepth]
+ puts $fd [list set haveSelectedModes $haveSelectedModes]
+ if !$pc98 {
+ set arrlist [list Files Module ServerFlags Keyboard Pointer \
+ SelectedMonitorModes MonitorStdModes \
+ Scrn_Accel Scrn_Mono Scrn_VGA2 Scrn_VGA16 Scrn_SVGA]
+ } else {
+ set arrlist [list Files Module ServerFlags Keyboard Pointer \
+ SelectedMonitorModes MonitorStdModes \
+ Scrn_Accel Scrn_VGA16 Scrn_SVGA]
+ }
+ foreach devid $DeviceIDs {
+ lappend arrlist Device_$devid
+ }
+ foreach monid $MonitorIDs {
+ lappend arrlist Monitor_$monid
+ }
+ foreach arrname $arrlist {
+ global $arrname
+ puts $fd [list array set $arrname [array get $arrname]]
+ }
+ close $fd
+}
+
+proc shutdown {args} {
+ global env ExitStatus
+
+ catch {destroy .}
+ catch {server_running -close $env(DISPLAY)}
+ if { [string length $args] } {
+ set ExitStatus $args
+ }
+}
+
+proc check_tmpdirs {} {
+ global TmpDir XF86SetupDir messages
+
+ file lstat $XF86SetupDir xfsdir
+ file lstat $TmpDir tmpdir
+ if { [string compare $xfsdir(type) directory]
+ || [string compare $tmpdir(type) directory]
+ || $xfsdir(uid) != [getuid]
+ || $tmpdir(uid) != [getuid]
+ || $xfsdir(mode)&0077
+ || $tmpdir(mode)&0077 } \
+ {
+ mesg "$messages(setuplib.2)$TmpDir$messages(setuplib.3)"
+ shutdown 1
+ exit 1
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/srvflags.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/srvflags.tcl
new file mode 100644
index 000000000..0614841f1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/srvflags.tcl
@@ -0,0 +1,108 @@
+# $XConsortium: srvflags.tcl /main/2 1996/10/25 10:21:38 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/srvflags.tcl,v 3.6 1998/04/05 16:15:53 robin Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Configuration of misc server flags
+#
+
+proc Other_create_widgets { win } {
+ global ServerFlags otherZap otherZoom otherTrapSignals
+ global otherXvidtune otherInpDevMods
+ global pc98_EGC messages
+
+ set w [winpathprefix $win]
+ if !$pc98_EGC {
+ frame $w.other -width 640 -height 420 \
+ -relief ridge -borderwidth 5
+ } else {
+ frame $w.other -width 640 -height 400 \
+ -relief ridge -borderwidth 5
+ }
+ frame $w.srvflags -bd 2 -relief sunken
+ pack $w.srvflags -in $w.other \
+ -fill both -expand yes -padx 20m -pady 20m
+ label $w.srvflags.title -text $messages(srvflags.1)
+ pack $w.srvflags.title -side top -fill both -expand yes
+ frame $w.srvflags.line -height 2 -bd 2 -relief sunken
+ pack $w.srvflags.line -side top -fill x -pady 2m
+ checkbutton $w.srvflags.zap -indicatoron true \
+ -text $messages(srvflags.2) \
+ -variable otherZap -anchor w
+ checkbutton $w.srvflags.zoom -indicatoron true \
+ -text $messages(srvflags.3) \
+ -variable otherZoom -anchor w
+ checkbutton $w.srvflags.trapsignals -indicatoron true \
+ -text $messages(srvflags.4) \
+ -variable otherTrapSignals -anchor w
+ checkbutton $w.srvflags.nonlocalxvidtune -indicatoron true \
+ -text $messages(srvflags.5) \
+ -variable otherXvidtune -anchor w
+ checkbutton $w.srvflags.nonlocalmodindev -indicatoron true \
+ -text $messages(srvflags.6) \
+ -variable otherInpDevMods -anchor w
+ pack $w.srvflags.zap $w.srvflags.zoom $w.srvflags.trapsignals \
+ -anchor w -expand yes -fill x -padx 15m
+ pack $w.srvflags.nonlocalxvidtune $w.srvflags.nonlocalmodindev \
+ -anchor w -expand yes -fill x -padx 15m
+ set otherZap [expr [string length $ServerFlags(DontZap)] == 0]
+ set otherZoom [expr [string length $ServerFlags(DontZoom)] == 0]
+ set otherTrapSignals [expr [string length \
+ $ServerFlags(NoTrapSignals)] > 0]
+ set otherXvidtune [expr [string length \
+ $ServerFlags(AllowNonLocalXvidtune)] > 0]
+ set otherInpDevMods [expr [string length \
+ $ServerFlags(AllowNonLocalModInDev)] > 0]
+
+}
+
+proc Other_activate { win } {
+ set w [winpathprefix $win]
+ pack $w.other -side top -fill both -expand yes
+}
+
+proc Other_deactivate { win } {
+ global ServerFlags otherZap otherZoom otherTrapSignals
+ global otherXvidtune otherInpDevMods
+
+ set w [winpathprefix $win]
+ pack forget $w.other
+ set ServerFlags(DontZap) [expr $otherZap?"":"DontZap"]
+ set ServerFlags(DontZoom) [expr $otherZoom?"":"DontZoom"]
+ set ServerFlags(NoTrapSignals) \
+ [expr $otherTrapSignals?"NoTrapSignals":""]
+ set ServerFlags(AllowNonLocalXvidtune) \
+ [expr $otherXvidtune?"AllowNonLocalXvidtune":""]
+ set ServerFlags(AllowNonLocalModInDev) \
+ [expr $otherInpDevMods?"AllowNonLocalModInDev":""]
+}
+
+proc Other_popup_help { win } {
+ catch {destroy .otherhelp}
+ toplevel .otherhelp -bd 5 -relief ridge
+ wm title .otherhelp "Help"
+ wm geometry .otherhelp +30+30
+ text .otherhelp.text
+ .otherhelp.text insert 0.0 "\n\n\
+ On this screen you can select the settings of various\
+ server options.\n\
+ These should already be set to the values most often used\n\
+ and generally you don't need to make any changes.\n\n\
+ If you would like more information regarding what each\
+ of these do,\n\
+ read the XF86Config man page."
+ .otherhelp.text configure -state disabled
+ button .otherhelp.ok -text "Dismiss" -command "destroy .otherhelp"
+ focus .otherhelp.ok
+ pack .otherhelp.text .otherhelp.ok
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcards.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcards.c
new file mode 100644
index 000000000..534fa5be2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcards.c
@@ -0,0 +1,176 @@
+/* $XConsortium: tclcards.c /main/1 1996/09/21 14:17:56 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclcards.c,v 3.4 1996/12/27 06:54:15 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains Tcl bindings to the Cards database routines
+
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <tcl.h>
+#include <tk.h>
+
+#include "cards.h"
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+#include <X11/Xos.h>
+
+int TCL_XF86GetCardList(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86GetCardEntry(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int lookupcard(
+#if NeedNestedPrototypes
+ char *name
+#endif
+);
+
+/*
+ Adds all the Cards database specific commands to the Tcl interpreter
+*/
+
+int
+Cards_Init(interp)
+ Tcl_Interp *interp;
+{
+ if (parse_database()) {
+ Tcl_AppendResult(interp, "Couldn't read card database file ",
+ CARD_DATABASE_FILE, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ Tcl_CreateCommand(interp, "xf86cards_getlist",
+ TCL_XF86GetCardList, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86cards_getentry",
+ TCL_XF86GetCardEntry, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86cards_getlist command which returns
+ a list of the cards in the database
+*/
+
+int
+TCL_XF86GetCardList(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int i;
+ char **av;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86cards_getlist", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ av = (char **) XtMalloc(sizeof(char *) * (lastcard+2));
+
+ for (i = 0; i <= lastcard; i++) {
+ av[i] = card[i].name;
+ }
+ av[i] = (char *) NULL;
+ Tcl_SetResult(interp, Tcl_Merge(i, av), TCL_DYNAMIC);
+ XtFree((char *) av);
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86cards_getentry command which returns
+ the full info on the given card
+*/
+
+int
+TCL_XF86GetCardEntry(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int idx;
+ char tmpbuf[64];
+ char *av[9];
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: xf86cards_getentry cardname",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((idx = lookupcard(argv[1])) == -1) {
+ Tcl_SetResult(interp, "Cannot find card", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ av[0] = card[idx].name;
+ av[1] = card[idx].chipset;
+ av[2] = card[idx].server;
+ av[3] = card[idx].ramdac;
+ av[4] = card[idx].clockchip;
+ av[5] = card[idx].dacspeed;
+ av[6] = card[idx].lines;
+
+ tmpbuf[0] = '\0';
+ if (card[idx].flags & NOCLOCKPROBE)
+ strcat(tmpbuf, "NOCLOCKPROBE ");
+ if (card[idx].flags & UNSUPPORTED)
+ strcat(tmpbuf, "UNSUPPORTED ");
+ if (tmpbuf[0] != '\0')
+ tmpbuf[strlen(tmpbuf)-1] = '\0';
+ av[7] = tmpbuf;
+ av[8] = (char *) NULL;
+
+ Tcl_SetResult(interp, Tcl_Merge(8, av), TCL_DYNAMIC);
+ return TCL_OK;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.c
new file mode 100644
index 000000000..eca2f3bb3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.c
@@ -0,0 +1,887 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.c,v 1.2 1999/04/05 08:28:23 dawes Exp $ */
+/*
+ * Copyright 1997 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+ This file contains Tcl bindings to the curses library
+ */
+
+#include <tcl.h>
+#ifdef CURSES
+#ifdef NCURSES
+#include <ncurses.h>
+#else
+#include <curses.h>
+#endif
+#include <string.h>
+#include "tclcurses.h"
+#endif /* CURSES */
+
+static int curs_debug = 0;
+
+/*
+ Adds the curses command to the Tcl interpreter
+*/
+
+int
+Curses_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "curses", TCL_Curses, NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+#ifndef CURSES
+
+/* Stub version */
+int
+TCL_Curses(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tcl_AppendResult(interp,
+ "Curses not compiled in to this version of XF86SETUP", NULL);
+ return TCL_ERROR;
+}
+
+#else
+
+/*
+*/
+
+int
+TCL_Curses(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ struct windata *winPtr;
+ WINDOW *tmpwin;
+
+ if (argc < 2) {
+ Tcl_SetResult(interp, "Usage: curses ", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(argv[1], "init")) {
+ if (stdscr) {
+ Tcl_AppendResult(interp, "Already initialized", NULL);
+ return TCL_ERROR;
+ }
+ if (initscr() == NULL) {
+ Tcl_AppendResult(interp, "Unable to initialize curses", NULL);
+ return TCL_ERROR;
+ }
+ cbreak();
+ noecho();
+ nonl();
+ intrflush(stdscr, FALSE);
+ keypad(stdscr, TRUE);
+ if (has_colors()) {
+ start_color();
+ }
+ init_pair(PAIR_SCREEN);
+ init_pair(PAIR_ULBORD);
+ init_pair(PAIR_LRBORD);
+ init_pair(PAIR_TEXT);
+ init_pair(PAIR_TITLE);
+ init_pair(PAIR_SELECT);
+ winPtr = initwinPtr(stdscr);
+ bkgd(ATTR_SCREEN);
+ attrset(ATTR_SCREEN);
+ Tcl_CreateCommand(interp,"stdscr",TCL_WinProc,winPtr,NULL);
+ } else if (argc == 3 && !strcmp(argv[1], "debug")) {
+ curs_debug = atoi(argv[2]);
+ } else if (!strcmp(argv[1], "end")) {
+ if (endwin() != OK) {
+ Tcl_AppendResult(interp, "curses end failed", NULL);
+ return TCL_ERROR;
+ }
+ } else if (!strcmp(argv[1], "menubar")) {
+ /* TBD */
+ Tcl_AppendResult(interp, "Not yet implemented", NULL);
+ return TCL_OK;
+ } else if (!strcmp(argv[1], "newwin")) {
+ if (argc != 7) {
+ Tcl_AppendResult(interp,
+ "Usage: curses newwin <winname> <nlines>"
+ " <ncols> <begin_y> <begin_x>",
+ NULL);
+ return TCL_ERROR;
+ }
+ if ((tmpwin = newwin(atoi(argv[3]),atoi(argv[4]),
+ atoi(argv[5]),atoi(argv[6]))) == NULL) {
+ Tcl_AppendResult(interp, "Unable to create window", NULL);
+ ckfree(tmpwin);
+ return TCL_ERROR;
+ }
+ keypad(tmpwin, TRUE);
+ winPtr = initwinPtr(tmpwin);
+ wbkgd(winPtr->win,ATTR_TEXT);
+ Tcl_CreateCommand(interp,argv[2],TCL_WinProc,winPtr,NULL);
+ } else if (!strcmp(argv[1], "delwin")) {
+ if (argc != 3) {
+ Tcl_AppendResult(interp,
+ "Usage: curses delwin <winname>", NULL);
+ return TCL_ERROR;
+ }
+ if (Tcl_DeleteCommand(interp, argv[2]) == TCL_ERROR)
+ return TCL_ERROR;
+ } else {
+ Tcl_AppendResult(interp, "Invalid option: ",
+ argv[2], NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+void TCL_WinDelete(clientData)
+ ClientData clientData;
+{
+ struct windata *winPtr;
+ int i;
+
+ winPtr = (struct windata *) clientData;
+ delwin(winPtr->win);
+ ckfree(winPtr->title);
+ ckfree(winPtr->menu.chkd);
+ ckfree(winPtr->menu.win);
+ ckfree(winPtr->menu.data);
+ ckfree(winPtr->text.buffer);
+ ckfree(winPtr->text.data);
+ for (i = 0; i < MAXBUTTONS; i++)
+ ckfree(winPtr->button[i]);
+ ckfree(winPtr);
+}
+
+/*
+*/
+
+int
+TCL_WinProc(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ struct windata *winPtr = (struct windata *) clientData;
+ char tmpbuf[64];
+
+ if (argc == 4 && !strcmp(argv[1], "move")) {
+ wmove(winPtr->win,atoi(argv[2]),atoi(argv[3]));
+ } else if (argc == 3 && !strcmp(argv[1], "addstr")) {
+ waddstr(winPtr->win,argv[2]);
+ } else if (argc == 3 && !strcmp(argv[1], "text")) {
+ return settext(winPtr, interp, argv[2]);
+ } else if (argc == 2 && !strcmp(argv[1], "activate")) {
+ return processinput(winPtr, interp);
+ } else if (argc == 2 && !strcmp(argv[1], "clear")) {
+ wclear(winPtr->win);
+ } else if (argc == 2 && !strcmp(argv[1], "update")) {
+ wrefresh(winPtr->win);
+ } else if (argc == 2 && !strcmp(argv[1], "info")) {
+ sprintf(tmpbuf, "%d %d %d %d", winPtr->width, winPtr->height,
+ winPtr->border, winPtr->shadow);
+ Tcl_AppendResult(interp, tmpbuf, NULL);
+ Tcl_AppendElement(interp, winPtr->title);
+ } else if (argc > 2 && !strcmp(argv[1], "menu")) {
+ winPtr->menu.type=TYPE_MENU;
+ return setmenu(winPtr, interp, argc, argv);
+ } else if (argc > 2 && !strcmp(argv[1], "checklist")) {
+ winPtr->menu.type=TYPE_CHECK;
+ return setmenu(winPtr, interp, argc, argv);
+ } else if (argc > 2 && !strcmp(argv[1], "radiolist")) {
+ winPtr->menu.type=TYPE_RADIO;
+ return setmenu(winPtr, interp, argc, argv);
+ } else if (argc > 2 && !strcmp(argv[1], "buttons")) {
+ return setbuttons(winPtr, interp, argc, argv);
+ } else if (argc > 2 && !strcmp(argv[1], "configure")) {
+ return winconfig(winPtr, interp, argc, argv);
+ } else {
+ Tcl_AppendResult(interp, "Invalid option: ",
+ argv[1], NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+static int
+settext(winPtr, interp, text)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+ char *text;
+{
+ int i, numcols;
+ char savechar, *ptr, *nlptr, *spcptr, *endchar;
+
+ DEBUG4("settext(%p, %p, %s)\n", winPtr, interp, text);
+
+ numcols = winPtr->width - (winPtr->border==BORDER_NONE? 0: 2);
+ if (winPtr->text.data) {
+ ckfree(winPtr->text.data);
+ ckfree(winPtr->text.buffer);
+ }
+ winPtr->text.items = winPtr->text.topline = 0;
+ if (strlen(text)) {
+ winPtr->text.buffer = strdup(text);
+ ptr = nlptr = winPtr->text.buffer;
+ endchar = winPtr->text.buffer + strlen(text);
+ while (nlptr < endchar) {
+ if ((nlptr = strchr(ptr, '\n')) == NULL)
+ nlptr = endchar;
+ if (nlptr - ptr > numcols) {
+ *nlptr = '\0';
+ while (strlen(ptr) > numcols) {
+ savechar = ptr[numcols];
+ ptr[numcols] = '\0';
+ spcptr = strrchr(ptr, ' ');
+ ptr[numcols] = savechar;
+ if (spcptr == NULL) {
+ ptr[numcols-1] = '\n';
+ ptr += numcols - 1;
+ } else {
+ *spcptr = '\n';
+ ptr = spcptr + 1;
+ }
+ }
+ if (nlptr != endchar)
+ *nlptr = '\n';
+ }
+ ptr = nlptr + 1;
+ }
+ } else {
+ winPtr->text.data = (char **) 0;
+ winPtr->text.buffer = endchar = NULL;
+ }
+
+ for (ptr= nlptr= winPtr->text.buffer; ptr<endchar && nlptr; ptr= nlptr+1) {
+ nlptr = strchr(ptr, '\n');
+ winPtr->text.items++;
+ }
+ winPtr->text.data = (char **) ckalloc(winPtr->text.items * sizeof(char *));
+
+ for (i=0, ptr= nlptr= winPtr->text.buffer; ptr<endchar && nlptr; ptr= nlptr+1) {
+ if ((nlptr = strchr(ptr, '\n')) != NULL)
+ *nlptr = '\0';
+ winPtr->text.data[i++] = ptr;
+ }
+ DEBUG3("(text='%s' items=%d)\n", winPtr->text.buffer, winPtr->text.items);
+
+ updatetext(winPtr, interp);
+ DEBUG1("settext() returning okay\n");
+ return TCL_OK;
+}
+
+static int
+updatetext(winPtr, interp)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+{
+ int i, j, row, col, numrows, numcols;
+
+ DEBUG3("updatetext(%p, %p)\n", winPtr, interp);
+ wattrset(winPtr->win, ATTR_TEXT);
+ if (winPtr->border == BORDER_NONE) {
+ row = col = 0;
+ numcols = winPtr->width;
+ } else {
+ row = col = 1;
+ numcols = winPtr->width-2;
+ }
+ numrows = textlines(winPtr);
+
+ for (i = row; i < row+numrows; i++) {
+ wmove(winPtr->win, i, col);
+ for (j = col; j < col+numcols; j++)
+ waddch(winPtr->win, ATTR_TEXT | ' ');
+ }
+ if (!winPtr->text.items)
+ return TCL_OK;
+
+ for (i= 0, j= winPtr->text.topline; i<numrows && j<winPtr->text.items; i++, j++) {
+ wmove(winPtr->win, i+row, col);
+ waddstr(winPtr->win, winPtr->text.data[j]);
+ }
+ DEBUG1("updatetext() returning okay\n");
+ return TCL_OK;
+}
+
+static int
+textlines(winPtr)
+ struct windata *winPtr;
+{
+ int rows;
+
+ if (winPtr->border == BORDER_NONE) {
+ rows = winPtr->height;
+ if (winPtr->button[0]) rows--;
+ } else {
+ rows = winPtr->height-2;
+ if (winPtr->button[0]) rows-=2;
+ }
+ if (winPtr->menu.items) rows -= winPtr->menu.items+2;
+
+ return rows;
+}
+
+static int
+processinput(winPtr, interp)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+{
+ int key=0, i, lastbutton;
+
+#define mybeep() beep(); wrefresh(winPtr->win)
+
+ for (lastbutton=0; lastbutton<MAXBUTTONS; lastbutton++) {
+ if (!winPtr->button[lastbutton])
+ break;
+ }
+ while (1) {
+ switch (key = wgetch(winPtr->win)) {
+ case KEY_RIGHT:
+ if (!winPtr->button[0] || winPtr->butsel == lastbutton-1) {
+ mybeep();
+ } else {
+ winPtr->butsel++;
+ updatebuttons(winPtr);
+ }
+ when KEY_LEFT:
+ if (!winPtr->button[0] || winPtr->butsel == 0) {
+ mybeep();
+ } else {
+ winPtr->butsel--;
+ updatebuttons(winPtr);
+ }
+ when KEY_UP:
+ case KEY_SR:
+ if (updatepos(winPtr, interp, KEY_UP, SCROLL_LINE) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_DOWN:
+ case KEY_SF:
+ if (updatepos(winPtr, interp, KEY_DOWN, SCROLL_LINE) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_HOME:
+ case KEY_BEG:
+ if (updatepos(winPtr, interp, KEY_UP, SCROLL_ALL) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_LL:
+ case KEY_END:
+ if (updatepos(winPtr, interp, KEY_DOWN, SCROLL_ALL) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_PPAGE:
+ if (updatepos(winPtr, interp, KEY_UP, SCROLL_PAGE) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_NPAGE:
+ if (updatepos(winPtr, interp, KEY_DOWN, SCROLL_PAGE) == TCL_ERROR)
+ return TCL_ERROR;
+ when KEY_ENTER:
+ case '\r':
+ case '\n':
+ Tcl_AppendElement(interp, winPtr->button[0]?
+ winPtr->button[winPtr->butsel]: "");
+ if (winPtr->menu.items) {
+ if (winPtr->menu.type == TYPE_RADIO) {
+ Tcl_AppendElement(interp,
+ winPtr->menu.data[winPtr->menu.rsel]);
+ } else if (winPtr->menu.type == TYPE_CHECK) {
+ for (i = 0; i < winPtr->menu.items; i++) {
+ if (winPtr->menu.chkd[i])
+ Tcl_AppendElement(interp,
+ winPtr->menu.data[i]);
+ }
+ } else
+ Tcl_AppendElement(interp,
+ winPtr->menu.data[winPtr->menu.current]);
+ }
+ return TCL_OK;
+ when KEY_SELECT:
+ case ' ':
+ if (winPtr->menu.items == 0
+ || winPtr->menu.type == TYPE_NONE
+ || winPtr->menu.type == TYPE_MENU) {
+ mybeep();
+ } else {
+ if (winPtr->menu.type == TYPE_RADIO)
+ winPtr->menu.rsel = winPtr->menu.current;
+ else
+ winPtr->menu.chkd[winPtr->menu.current] =
+ (winPtr->menu.chkd[winPtr->menu.current]+1)%2;
+ if (updatemenu(winPtr) == TCL_ERROR)
+ return TCL_ERROR;
+ wrefresh(winPtr->menu.win);
+ }
+ when KEY_REFRESH:
+ case 0x0c: /* ^L */
+ wrefresh(curscr);
+ when KEY_ESC:
+ Tcl_AppendResult(interp, "Escape", NULL);
+ return TCL_OK;
+ /* break */
+ default:
+ mybeep();
+ }
+ }
+}
+
+static int
+updatepos(winPtr, interp, dir, amt)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+ int dir, amt;
+{
+ int scroll;
+
+ if ((winPtr->menu.type == TYPE_NONE && winPtr->text.data == NULL)
+ || (winPtr->menu.type != TYPE_NONE && winPtr->menu.lines == 0) ) {
+ mybeep();
+ return TCL_OK;
+ }
+ switch (amt) {
+ case SCROLL_LINE:
+ scroll = 1;
+ when SCROLL_PAGE:
+ if (winPtr->menu.type == TYPE_NONE) {
+ scroll = textlines(winPtr);
+ } else {
+ scroll = winPtr->menu.lines;
+ }
+ when SCROLL_ALL:
+ scroll = 0;
+ break;
+ default:
+ Tcl_AppendResult(interp,
+ "internal error: updatepos() called with invalid scroll amount (%d)",
+ amt, NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->menu.type == TYPE_NONE) {
+ int rows = textlines(winPtr);
+ switch (dir) {
+ case KEY_UP:
+ if (winPtr->text.topline == 0) {
+ mybeep();
+ return TCL_OK;
+ }
+ winPtr->text.topline -= scroll;
+ if (!scroll || winPtr->text.topline < 0)
+ winPtr->text.topline = 0;
+ if (updatetext(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ wrefresh(winPtr->win);
+ when KEY_DOWN:
+ if (winPtr->text.topline >= winPtr->text.items-rows) {
+ mybeep();
+ return TCL_OK;
+ }
+ winPtr->text.topline += scroll;
+ if (!scroll || winPtr->text.topline > winPtr->text.items-rows) {
+ winPtr->text.topline = winPtr->text.items-rows;
+ if (winPtr->text.topline < 0)
+ winPtr->text.topline = 0;
+ }
+ if (updatetext(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ wrefresh(winPtr->win);
+ break;
+ default:
+ Tcl_AppendResult(interp,
+ "internal error: updatepos() called with invalid dir (%d)",
+ dir, NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ switch (dir) {
+ case KEY_UP:
+ if (winPtr->menu.current == 0) {
+ mybeep();
+ return TCL_OK;
+ }
+ winPtr->menu.current -= scroll;
+ if (!scroll || winPtr->menu.current < 0)
+ winPtr->menu.current = 0;
+ if (scroll != 1) {
+ winPtr->menu.topline -= scroll;
+ if (!scroll || winPtr->menu.topline < 0)
+ winPtr->menu.topline = 0;
+ }
+ if (updatemenu(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ wrefresh(winPtr->menu.win);
+ when KEY_DOWN:
+ if (winPtr->menu.current == winPtr->menu.items-1) {
+ mybeep();
+ return TCL_OK;
+ }
+ winPtr->menu.current += scroll;
+ if (!scroll || winPtr->menu.current > winPtr->menu.items-1)
+ winPtr->menu.current = winPtr->menu.items-1;
+ if (scroll != 1) {
+ winPtr->menu.topline += scroll;
+ if (!scroll || winPtr->menu.topline > winPtr->menu.items-winPtr->menu.lines)
+ winPtr->menu.topline = winPtr->menu.items-winPtr->menu.lines;
+ }
+ if (updatemenu(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ wrefresh(winPtr->menu.win);
+ break;
+ default:
+ Tcl_AppendResult(interp,
+ "internal error: updatepos() called with invalid dir (%d)",
+ dir, NULL);
+ return TCL_ERROR;
+ }
+ }
+ return TCL_OK;
+}
+
+static struct windata *
+initwinPtr(win)
+ WINDOW *win;
+{
+ struct windata *winPtr;
+ int i;
+
+ if ((winPtr= (struct windata *) ckalloc(sizeof(struct windata))) == NULL)
+ return NULL;
+ winPtr->win = win;
+ getmaxyx(win, winPtr->height, winPtr->width);
+ winPtr->title = (char *) 0;
+ winPtr->border = BORDER_NONE;
+ winPtr->shadow = 0;
+
+ winPtr->menu.type = TYPE_NONE;
+ winPtr->menu.lines = 0;
+ winPtr->menu.items = 0;
+ winPtr->menu.topline = 0;
+ winPtr->menu.current = 0;
+ winPtr->menu.rsel = 0;
+ winPtr->menu.chkd = (int *) 0;
+ winPtr->menu.win = (WINDOW *) 0;
+ winPtr->menu.data = (char **) 0;
+ winPtr->text.items = 0;
+ winPtr->text.topline = 0;
+ winPtr->text.buffer = (char *) 0;
+ winPtr->text.data = (char **) 0;
+ winPtr->butsel = 0;
+ for (i = 0; i < MAXBUTTONS; i++)
+ winPtr->button[i] = (char *) 0;
+ return winPtr;
+}
+
+static int
+winconfig(winPtr, interp, argc, argv)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int i;
+
+ DEBUG5("winconfig(%p, %p, %d, %p)\n", winPtr, interp, argc, argv);
+ for (i = 2; i < argc-1; i += 2) {
+ if (!strcmp(argv[i],"-shadow")) {
+ /* TBD */
+ Tcl_AppendResult(interp, "Not yet implemented", NULL);
+ return TCL_OK;
+ } else if (!strcmp(argv[i],"-title")) {
+ if (winPtr->border == BORDER_NONE) {
+ Tcl_AppendResult(interp,
+ "Only bordered windows can have titles",
+ NULL);
+ return TCL_ERROR;
+ }
+ if (strlen(argv[i+1]) > winPtr->width-2) {
+ Tcl_AppendResult(interp,
+ "Title too long", NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->title) {
+ ckfree(winPtr->title);
+ drawbox(winPtr, 0, 0, winPtr->height,
+ winPtr->width, winPtr->border-1,
+ ATTR_ULBORD, ATTR_LRBORD);
+ }
+ wmove(winPtr->win, 0, (winPtr->width-strlen(argv[i+1]))/2);
+ wattrset(winPtr->win, ATTR_TITLE);
+ waddstr(winPtr->win, argv[i+1]);
+ } else if (!strcmp(argv[i],"-border")) {
+ if (!strcmp(argv[i+1], "none")) {
+ winPtr->border=BORDER_NONE;
+ } else if (!strcmp(argv[i+1], "blank")) {
+ winPtr->border=BORDER_BLANK;
+ drawbox(winPtr, 0, 0, winPtr->height,
+ winPtr->width, 0, ATTR_ULBORD, ATTR_LRBORD);
+ } else if (!strcmp(argv[i+1], "line")) {
+ winPtr->border=BORDER_LINE;
+ drawbox(winPtr, 0, 0, winPtr->height,
+ winPtr->width, 1, ATTR_ULBORD, ATTR_LRBORD);
+ } else {
+ Tcl_AppendResult(interp, "Invalid border type: ",
+ argv[i+1], NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ Tcl_AppendResult(interp, "Invalid option: ",
+ argv[i], NULL);
+ return TCL_ERROR;
+ }
+ }
+ DEBUG1("winconfig() returning okay\n");
+ return TCL_OK;
+}
+
+static int
+setmenu(winPtr, interp, argc, argv)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int i, subx, suby, subwid, subht, winy, winx;
+ static char *defaultbuttons[] = {"menu", "buttons", "Okay", "Cancel"};
+
+ DEBUG5("setmenu(%p, %p, %d, %p)\n", winPtr, interp, argc, argv);
+ if (winPtr->menu.data)
+ ckfree(winPtr->menu.data);
+ if (winPtr->menu.win)
+ delwin(winPtr->menu.win);
+ if (!(winPtr->menu.items = argc-3)) {
+ winPtr->menu.lines = 0;
+ winPtr->menu.topline = 0;
+ winPtr->menu.current = 0;
+ return TCL_OK;
+ }
+ subht = winPtr->menu.lines = atoi(argv[2]);
+ i = winPtr->height - 3 - (winPtr->border? 3: 0);
+ if (subht > i) {
+ Tcl_AppendResult(interp, "Not enough room for menu window",
+ NULL);
+ return TCL_ERROR;
+ }
+ winPtr->menu.data = (char **) ckalloc(sizeof(char *) * (argc-2));
+ for (i = 0; i<argc-3; i++) {
+ winPtr->menu.data[i] = strdup(argv[i+3]);
+ }
+ if (winPtr->menu.type == TYPE_CHECK) {
+ winPtr->menu.chkd = (int *) ckalloc(sizeof(int) * (argc-3));
+ for (i = 0; i<argc-3; i++) {
+ winPtr->menu.chkd[i] = 0;
+ }
+ }
+ winPtr->menu.data[i] = NULL;
+ if (!winPtr->button[0]) {
+ if (setbuttons(winPtr, interp, 4, defaultbuttons) == TCL_ERROR)
+ return TCL_ERROR;
+ }
+ getbegyx(winPtr->win, winy, winx);
+ subx = (winPtr->border? 3: 2);
+ suby = winPtr->height - 2 - (winPtr->border? 2: 0) - subht;
+ subwid = winPtr->width - (winPtr->border? 6: 4);
+ if ((winPtr->menu.win = subwin(winPtr->win, subht, subwid,
+ suby+winy, subx+winx)) == NULL) {
+ Tcl_AppendResult(interp, "Unable to create menu subwindow",
+ NULL);
+ return TCL_ERROR;
+ }
+ drawbox(winPtr, suby-1, subx-1, subht+2, subwid+2, 1,
+ ATTR_LRBORD, ATTR_ULBORD);
+
+ if (updatemenu(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ if (updatetext(winPtr, interp) == TCL_ERROR)
+ return TCL_ERROR;
+ DEBUG1("setmenu() returning okay\n");
+ return TCL_OK;
+}
+
+static int
+updatemenu(winPtr, interp)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+{
+ int i, j, tmp, bottom, wid, ht;
+ DEBUG3("updatemenu(%p, %p)\n", winPtr, interp);
+ bottom = winPtr->menu.topline + winPtr->menu.lines - 1;
+ DEBUG2("bottom = %d\n", bottom);
+ if (winPtr->menu.current < winPtr->menu.topline) {
+ winPtr->menu.topline = winPtr->menu.current;
+ }
+ if (winPtr->menu.current > bottom) {
+ winPtr->menu.topline = winPtr->menu.current - winPtr->menu.lines + 1;
+ }
+ DEBUG5("menu.current=%d, menu.topline=%d, menu.lines=%d, bottom=%d\n",
+ winPtr->menu.current, winPtr->menu.topline, (int) winPtr->menu.lines, bottom);
+ getmaxyx(winPtr->menu.win, ht, wid);
+ for (i = 0; i < winPtr->menu.lines; i++) {
+ tmp = i+winPtr->menu.topline;
+ if (tmp == winPtr->menu.current)
+ wattrset(winPtr->menu.win, ATTR_SELECT);
+ else
+ wattrset(winPtr->menu.win, ATTR_TEXT);
+ wmove(winPtr->menu.win, i, 0);
+ for (j = 0; j < wid; j++)
+ waddch(winPtr->menu.win, ' ');
+ if (tmp < winPtr->menu.items && winPtr->menu.data[tmp]) {
+ wmove(winPtr->menu.win, i, 0);
+ if (winPtr->menu.type == TYPE_RADIO) {
+ if (winPtr->menu.rsel == tmp)
+ waddstr(winPtr->menu.win, "(X) ");
+ else
+ waddstr(winPtr->menu.win, "( ) ");
+ }
+ if (winPtr->menu.type == TYPE_CHECK) {
+ if (winPtr->menu.chkd[tmp])
+ waddstr(winPtr->menu.win, "[X] ");
+ else
+ waddstr(winPtr->menu.win, "[ ] ");
+ }
+ waddstr(winPtr->menu.win, winPtr->menu.data[tmp]);
+ }
+ }
+ return TCL_OK;
+}
+
+static int
+setbuttons(winPtr, interp, argc, argv)
+ struct windata *winPtr;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int i, needlines=1, needcols=0;
+
+ DEBUG5("setbuttons(%p, %p, %d, %p)\n", winPtr, interp, argc, argv);
+ if (winPtr->text.items) needlines++;
+ if (winPtr->border) {
+ needlines+= winPtr->text.items? 3:2;
+ needcols+=2;
+ }
+ for (i = 2; i < argc; i++) {
+ needcols += strlen(argv[i]) + 3;
+ }
+ if (winPtr->height < needlines || winPtr->width < needcols) {
+ Tcl_AppendResult(interp, "Window too small", NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->border && winPtr->text.items) {
+ wattrset(winPtr->win, ATTR_ULBORD);
+ wmove(winPtr->win, winPtr->height-3, 0);
+ waddch(winPtr->win, ACS_LTEE);
+ for (i = 0; i < winPtr->width-2; i++)
+ waddch(winPtr->win, ACS_HLINE);
+ wattrset(winPtr->win, ATTR_LRBORD);
+ waddch(winPtr->win, ACS_RTEE);
+ }
+ for (i = 0; i < MAXBUTTONS; i++) {
+ if (winPtr->button[i])
+ ckfree(winPtr->button);
+ }
+ for (i = 0; argv[i+2]; i++)
+ winPtr->button[i] = strdup(argv[i+2]);
+ updatebuttons(winPtr);
+ DEBUG1("setbuttons() returning okay\n");
+ return TCL_OK;
+}
+
+static void
+updatebuttons(winPtr)
+ struct windata *winPtr;
+{
+ int i, j, numbuttons, needcols=0, x, y;
+
+ DEBUG1("updatebuttons(winPtr)\n");
+
+ getyx(winPtr->win, y, x);
+ for (i = numbuttons = 0; i < MAXBUTTONS; i++) {
+ if (winPtr->button[i])
+ numbuttons++;
+ else
+ break;
+ }
+ if (winPtr->border)
+ needcols+=2;
+ for (i = 0; i < numbuttons; i++) {
+ needcols += strlen(winPtr->button[i]) + 3;
+ }
+ wmove(winPtr->win, winPtr->height-2, 1);
+ for (i = 0; i < winPtr->width-2; i++) {
+ waddch(winPtr->win, ' ');
+ }
+ wmove(winPtr->win, winPtr->height-2, 1);
+ wattrset(winPtr->win, ATTR_TEXT);
+ for (i = 0; i < numbuttons; i++) {
+ for (j = 0; j < (winPtr->width-needcols)/(numbuttons+1); j++)
+ waddch(winPtr->win, ' ');
+ if (winPtr->butsel == i) {
+ wattrset(winPtr->win, ATTR_SELECT);
+ getyx(winPtr->win, y, x);
+ }
+ waddch(winPtr->win, '<');
+ waddstr(winPtr->win, winPtr->button[i]);
+ waddch(winPtr->win, '>');
+ wattrset(winPtr->win, ATTR_TEXT);
+ }
+ wmove(winPtr->win, y, x+1);
+}
+
+static void
+drawbox(winPtr, begrow, begcol, rows, cols, lchar, ulattr, lrattr)
+ struct windata *winPtr;
+ int begrow, begcol, rows, cols, lchar;
+ chtype ulattr, lrattr;
+{
+ int i;
+
+#define bchar(ch) (lchar? (ch): ' ')
+
+ DEBUG9("drawbox(%p, %d, %d, %d, %d, %d, %lx, %lx)\n",
+ winPtr, begrow, begcol, rows, cols, lchar, ulattr, lrattr);
+ wattrset(winPtr->win, ulattr);
+ wmove(winPtr->win, begrow, begcol);
+ waddch(winPtr->win, bchar(ACS_ULCORNER));
+ for (i=0; i<cols-2; i++)
+ waddch(winPtr->win, bchar(ACS_HLINE));
+ wattrset(winPtr->win, lrattr);
+ waddch(winPtr->win, bchar(ACS_URCORNER));
+ for (i=begrow+1; i<begrow+rows-1; i++) {
+ wattrset(winPtr->win, ulattr);
+ mvwaddch(winPtr->win,i,begcol,bchar(ACS_VLINE));
+ wattrset(winPtr->win, lrattr);
+ mvwaddch(winPtr->win,i,begcol+cols-1,bchar(ACS_VLINE));
+ }
+ wmove(winPtr->win, begrow+rows-1, begcol);
+ wattrset(winPtr->win, ulattr);
+ waddch(winPtr->win, bchar(ACS_LLCORNER));
+ wattrset(winPtr->win, lrattr);
+ for (i=0; i<cols-2; i++)
+ waddch(winPtr->win, bchar(ACS_HLINE));
+ waddch(winPtr->win, bchar(ACS_LRCORNER));
+}
+
+#endif /* CURSES */
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.h b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.h
new file mode 100644
index 000000000..ac277bcfe
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.h
@@ -0,0 +1,204 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclcurses.h,v 1.1 1999/04/05 07:13:02 dawes Exp $ */
+
+#include <tcl.h>
+#ifdef NCURSES
+#include <ncurses.h>
+#else
+#include <curses.h>
+#endif
+
+#define MAXBUTTONS 8
+
+#define BORDER_NONE 0
+#define BORDER_BLANK 1
+#define BORDER_LINE 2
+
+#define TYPE_NONE 0
+#define TYPE_MENU 1
+#define TYPE_RADIO 2
+#define TYPE_CHECK 3
+
+#define PAIR_SCREEN 1, COLOR_CYAN, COLOR_BLUE
+#define PAIR_ULBORD 2, COLOR_WHITE, COLOR_WHITE
+#define PAIR_LRBORD 3, COLOR_BLACK, COLOR_WHITE
+#define PAIR_TEXT 4, COLOR_WHITE, COLOR_WHITE
+#define PAIR_TITLE 5, COLOR_BLUE, COLOR_WHITE
+#define PAIR_SELECT 6, COLOR_BLUE, COLOR_WHITE
+
+#define ATTR_SCREEN COLOR_PAIR(1)
+#define ATTR_ULBORD (COLOR_PAIR(2)|A_BOLD)
+#define ATTR_LRBORD COLOR_PAIR(3)
+#define ATTR_TEXT ATTR_LRBORD
+#define ATTR_TITLE (COLOR_PAIR(5)|A_BOLD)
+#define ATTR_SELECT (COLOR_PAIR(6)|A_REVERSE)
+
+#define KEY_ESC 27
+
+#define SCROLL_LINE 0
+#define SCROLL_PAGE 1
+#define SCROLL_ALL 2
+
+struct windata {
+ WINDOW *win;
+ short width;
+ short height;
+ char *title;
+ short border; /* border type */
+ short shadow; /* Add shadow? */
+
+ struct {
+ short type;
+ short lines;
+ int items;
+ int topline;
+ int current;
+ int rsel;
+ int *chkd;
+ WINDOW *win;
+ char **data;
+ } menu;
+
+ struct {
+ int items; /* lines of text */
+ int topline; /* top text line */
+ char *buffer; /* text area contents */
+ char **data; /* text lines */
+ } text;
+
+ short butsel; /* which button is selected */
+ char *button[MAXBUTTONS]; /* button text labels */
+};
+
+#define DEBUG1(s) if (curs_debug) fprintf(stderr, s)
+#define DEBUG2(s,a) if (curs_debug) fprintf(stderr, s,a)
+#define DEBUG3(s,a,b) if (curs_debug) fprintf(stderr, s,a,b)
+#define DEBUG4(s,a,b,c) if (curs_debug) fprintf(stderr, s,a,b,c)
+#define DEBUG5(s,a,b,c,d) if (curs_debug) fprintf(stderr, s,a,b,c,d)
+#define DEBUG6(s,a,b,c,d,e) if (curs_debug) fprintf(stderr, s,a,b,c,d,e)
+#define DEBUG7(s,a,b,c,d,e,f) if (curs_debug) fprintf(stderr, s,a,b,c,d,e,f)
+#define DEBUG8(s,a,b,c,d,e,f,g) if (curs_debug) fprintf(stderr, s,a,b,c,d,e,f,g)
+#define DEBUG9(s,a,b,c,d,e,f,g,h) if (curs_debug) fprintf(stderr, s,a,b,c,d,e,f,g,h)
+
+#define when break; case
+
+int TCL_Curses(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+void TCL_WinDelete(
+#if NeedNestedPrototypes
+ ClientData clientData
+#endif
+);
+
+int TCL_WinProc(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+static int settext(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ char *text
+#endif
+);
+
+static int updatetext(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ char *text
+#endif
+);
+
+static int textlines(
+#if NeedNestedPrototypes
+ struct windata winPtr
+#endif
+);
+
+static int setbuttons(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+static int setmenu(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+static int winconfig(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+static int processinput(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp
+#endif
+);
+
+static int updatemenu(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp
+#endif
+);
+
+static void updatebuttons(
+#if NeedNestedPrototypes
+ struct windata winPtr
+#endif
+);
+
+static int updatepos(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ Tcl_Interp *interp,
+ int dir;
+ int amt;
+#endif
+);
+
+static struct windata * initwinPtr(
+#if NeedNestedPrototypes
+ WINDOW *win
+#endif
+);
+
+static void drawbox(
+#if NeedNestedPrototypes
+ struct windata winPtr,
+ int begrow,
+ int begcol,
+ int rows,
+ int cols,
+ int lchar,
+ chtype ulattr,
+ chtype lrattr
+#endif
+);
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclkbd.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclkbd.c
new file mode 100644
index 000000000..a44704fdc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclkbd.c
@@ -0,0 +1,877 @@
+/* $XConsortium: tclkbd.c /main/2 1996/10/19 19:06:13 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclkbd.c,v 3.5 1996/12/27 06:54:16 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains routines to add commands to the Tcl interpreter
+ that interface with the XKEYBOARD server extension
+
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xproto.h>
+#include <X11/Xfuncs.h>
+#include <X11/Xatom.h>
+#include <tcl.h>
+#include <tk.h>
+
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKBgeom.h>
+#include <X11/extensions/XKM.h>
+#include <X11/extensions/XKBfile.h>
+#include <X11/extensions/XKBui.h>
+#include <X11/extensions/XKBrules.h>
+
+static int TCL_XF86GetKBD(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86GetKBDComponents(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86FreeKBD(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86ListKBDComponents(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86LoadKBD(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86ResolveKBDComponents(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86ListKBDRules(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86GetKBDProp(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86SetKBDProp(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int init_xkb(
+#if NeedNestedProtoTypes
+ Tcl_Interp *interp,
+ Display *dpy
+#endif
+);
+
+extern XkbDescPtr GetXkbDescPtr(
+#if NeedNestedProtoTypes
+ Tcl_Interp *interp,
+ char *handle
+#endif
+);
+
+extern void GetXkbHandle(
+#if NeedNestedProtoTypes
+ char *buf
+#endif
+);
+
+static Tcl_HashTable XkbDescTable; /* Table of ptrs to XkbDescRecs */
+
+/*
+ Adds all the new commands to the Tcl interpreter
+*/
+
+int
+XF86Kbd_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_InitHashTable(&XkbDescTable, TCL_STRING_KEYS);
+
+ Tcl_CreateCommand(interp, "xkb_read",
+ TCL_XF86GetKBD, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_load",
+ TCL_XF86LoadKBD, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_free",
+ TCL_XF86FreeKBD, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_components",
+ TCL_XF86GetKBDComponents, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_listcomponents",
+ TCL_XF86ListKBDComponents, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_resolvecomponents",
+ TCL_XF86ResolveKBDComponents, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_listrules",
+ TCL_XF86ListKBDRules, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_getrulesprop",
+ TCL_XF86GetKBDProp, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xkb_setrulesprop",
+ TCL_XF86SetKBDProp, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ Check that the server supports the XKB extension
+*/
+
+static int
+init_xkb(interp, dpy)
+ Tcl_Interp *interp;
+ Display *dpy;
+{
+ static Bool been_here = False;
+ int major, minor, op, event, error;
+
+ if (been_here == True)
+ return TCL_OK;
+
+ major = XkbMajorVersion;
+ minor = XkbMinorVersion;
+ if (!XkbQueryExtension(dpy, &op, &event, &error, &major, &minor)) {
+ Tcl_SetResult(interp,
+ "Unable to initialize XKEYBOARD extension",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ Read an XKB description from the X server or from a .xkm file
+*/
+
+int
+TCL_XF86GetKBD(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ XkbDescPtr xkb;
+ Tcl_HashEntry *entry;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp,
+ "Usage: xkb_read from_server|<filename>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (strcmp(argv[1], "from_server") == 0) {
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+ if (init_xkb(interp, disp) != TCL_OK)
+ return TCL_ERROR;
+ xkb=XkbGetKeyboard(disp,
+ XkbGBN_AllComponentsMask,XkbUseCoreKbd);
+ } else {
+#if 0
+ unsigned tmp;
+ FILE *fd;
+ int major, minor;
+ XkbFileInfo result;
+
+ XkbInitAtoms(NULL);
+ major = XkbMajorVersion;
+ minor = XkbMinorVersion;
+ XkbLibraryVersion(&major, &minor);
+ bzero((char *) &result, sizeof(result));
+ if ((result.xkb=xkb=XkbAllocKeyboard()) == NULL) {
+ Tcl_SetResult(interp,
+ "Couldn't allocate keyboard", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ fd = fopen(argv[1], "r");
+ tmp = XkmReadFile(fd,XkmGeometryMask,XkmKeymapLegal,&result);
+ fclose(fd);
+#else
+ Tcl_SetResult(interp,
+ "Reading from a file is not currently supported",
+ TCL_STATIC);
+ return TCL_ERROR;
+#endif
+ }
+
+
+ if ((xkb==NULL)||(xkb->geom==NULL)) {
+ Tcl_SetResult(interp, "Couldn't get keyboard", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (xkb->names->geometry == 0)
+ xkb->names->geometry = xkb->geom->name;
+ GetXkbHandle(interp->result);
+ entry = Tcl_FindHashEntry(&XkbDescTable, interp->result);
+ Tcl_SetHashValue(entry, xkb);
+ return TCL_OK;
+}
+
+/*
+ Return a Tcl list of the names of the components which make up
+ the specified keyboard description
+*/
+
+int
+TCL_XF86GetKBDComponents(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ XkbDescPtr xkb;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: xkb_components <keyboard>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+
+ xkb = GetXkbDescPtr(interp, argv[1]);
+ if (xkb == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_AppendElement(interp,
+ XkbAtomText(disp, xkb->names->keycodes, XkbMessage));
+ Tcl_AppendElement(interp,
+ XkbAtomText(disp, xkb->names->types, XkbMessage));
+ Tcl_AppendElement(interp,
+ XkbAtomText(disp, xkb->names->compat, XkbMessage));
+ Tcl_AppendElement(interp,
+ XkbAtomText(disp, xkb->names->symbols, XkbMessage));
+ Tcl_AppendElement(interp,
+ XkbAtomText(disp, xkb->geom->name, XkbMessage));
+
+ return TCL_OK;
+}
+
+
+/*
+ Return a list of the components in the server's database
+
+ Each component is prefixed by a character:
+ # - Default
+ + - Partial
+ * - Partial & Default
+ <sp> - None of the above
+
+*/
+
+#define MAX_COMPONENTS 400 /* Max # components of one type */
+#define MAX_TTL_COMPONENTS 1000 /* Max # components of all types */
+#define flag2char(flag) ((flag & XkbLC_Default)? \
+ ((flag & XkbLC_Partial)? '*': '#'): \
+ ((flag & XkbLC_Partial)? '+': ' '))
+
+int
+TCL_XF86ListKBDComponents(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ XkbComponentNamesRec getcomps;
+ XkbComponentListPtr comps;
+ char *av[MAX_COMPONENTS], *names;
+ char bufs[MAX_COMPONENTS][32];
+ int max, i, ncomps;
+
+ if (argc != 7) {
+ Tcl_SetResult(interp,
+ "Usage: xkb_listcomponents <keymap_pat> "
+ "<keycodes_pat> <compat_pat> <types_pat> "
+ "<symbols_pat> <geometry_pat>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+ max = MAX_TTL_COMPONENTS;
+ getcomps.keymap = argv[1];
+ getcomps.keycodes = argv[2];
+ getcomps.compat = argv[3];
+ getcomps.types = argv[4];
+ getcomps.symbols = argv[5];
+ getcomps.geometry = argv[6];
+ comps = XkbListComponents(disp, XkbUseCoreKbd, &getcomps, &max);
+
+ for (i = 0; i < MAX_COMPONENTS; i++)
+ av[i] = bufs[i];
+
+ for (i = 0, ncomps = 0; i < comps->num_keymaps; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->keymaps[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->keymaps[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->keymaps[i].name, 30);
+ bufs[ncomps++][31] = '\0';
+ }
+ names = Tcl_Merge(ncomps, av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ for (i = 0, ncomps = 0; i < comps->num_keycodes; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->keycodes[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->keycodes[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->keycodes[i].name, 30);
+ bufs[ncomps++][31] = '\0';
+ }
+ names = Tcl_Merge(ncomps,av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ for (i = 0, ncomps = 0; i < comps->num_compat; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->compat[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->compat[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->compat[i].name, 30);
+ bufs[ncomps++][31] = '\0';
+ }
+ names = Tcl_Merge(ncomps,av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ for (i = 0, ncomps = 0; i < comps->num_types; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->types[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->types[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->types[i].name, 30);
+ bufs[ncomps++][31] = '\0';
+ }
+ names = Tcl_Merge(ncomps,av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ for (i = 0, ncomps = 0; i < comps->num_symbols; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->symbols[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->symbols[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->symbols[i].name, 30);
+ bufs[ncomps][31] = '\0';
+ ncomps++;
+ }
+ names = Tcl_Merge(ncomps,av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ for (i = 0, ncomps = 0; i < comps->num_geometry; i++) {
+ if (ncomps == MAX_COMPONENTS)
+ break;
+ if (comps->geometry[i].flags & XkbLC_Hidden)
+ continue;
+ bufs[ncomps][0] = flag2char(comps->geometry[i].flags);
+ strncpy(&(bufs[ncomps][1]), comps->geometry[i].name, 30);
+ bufs[ncomps++][31] = '\0';
+ }
+ names = Tcl_Merge(ncomps,av);
+ Tcl_AppendElement(interp, names);
+ XtFree(names);
+
+ XkbFreeComponentList(comps);
+ return TCL_OK;
+}
+
+/*
+ Return a keyboard description, given the component names
+ optionally load it into the server as the new keyboard
+*/
+
+static char *usage_LoadKBD = "Usage: xkb_load <keymap_pat> "
+ "<keycodes_pat> <compat_pat> <types_pat> "
+ "<symbols_pat> <geometry_pat> [load|noload]";
+
+int
+TCL_XF86LoadKBD(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ XkbComponentNamesRec getcomps;
+ XkbDescPtr xkb;
+ Bool loadit = True;
+ Tcl_HashEntry *entry;
+
+ if (argc < 7 || argc > 8) {
+ Tcl_SetResult(interp, usage_LoadKBD, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (argc == 8) {
+ if (!strcmp(argv[7], "load"))
+ loadit = True;
+ else if (!strcmp(argv[7], "noload"))
+ loadit = False;
+ else {
+ Tcl_SetResult(interp, usage_LoadKBD, TCL_STATIC);
+ return TCL_ERROR;
+ }
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+
+ getcomps.keymap = argv[1];
+ getcomps.keycodes = argv[2];
+ getcomps.compat = argv[3];
+ getcomps.types = argv[4];
+ getcomps.symbols = argv[5];
+ getcomps.geometry = argv[6];
+ xkb = XkbGetKeyboardByName(disp, XkbUseCoreKbd, &getcomps,
+ XkbGBN_AllComponentsMask, 0, loadit);
+ if (!xkb) {
+ Tcl_SetResult(interp, "Load failed", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (xkb->names->geometry == 0)
+ xkb->names->geometry = xkb->geom->name;
+
+ GetXkbHandle(interp->result);
+ entry = Tcl_FindHashEntry(&XkbDescTable, interp->result);
+ Tcl_SetHashValue(entry, xkb);
+
+ return TCL_OK;
+}
+
+/*
+ Free the memory occupied by a keyboard description
+*/
+
+int
+TCL_XF86FreeKBD(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XkbDescPtr xkb;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: xkb_free <keyboard>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ xkb = GetXkbDescPtr(interp, argv[1]);
+ XkbFreeKeyboard(xkb,0,True);
+ return TCL_OK;
+}
+
+/*
+ Use rules to determine the appropriate components for the given defs
+*/
+
+int
+TCL_XF86ResolveKBDComponents(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XkbRF_RulesPtr rules;
+ XkbRF_VarDefsRec defs;
+ XkbComponentNamesRec comps;
+ FILE *fp;
+ Bool complete;
+
+ if (argc != 6) {
+ Tcl_SetResult(interp,
+ "Usage: xkb_resolvecomponents <rulesfile>"
+ " <model> <layout> <variant> <options>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((fp = fopen(argv[1], "r")) == NULL) {
+ Tcl_SetResult(interp, "Can't open rules file" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((rules= XkbRF_Create(0,0))==NULL) {
+ fclose(fp);
+ Tcl_SetResult(interp, "Can't create rules structure" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (!XkbRF_LoadRules(fp,rules)) {
+ fclose(fp);
+ XkbRF_Free(rules,True);
+ Tcl_SetResult(interp, "Can't load rules" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+ defs.model = strlen(argv[2])? argv[2]: NULL;
+ defs.layout = strlen(argv[3])? argv[3]: NULL;
+ defs.variant = strlen(argv[4])? argv[4]: NULL;
+ defs.options = strlen(argv[5])? argv[5]: NULL;
+ bzero((char *)&comps, sizeof(XkbComponentNamesRec));
+ complete= XkbRF_GetComponents(rules, &defs, &comps);
+
+ Tcl_AppendElement(interp,(comps.keymap? comps.keymap: ""));
+ Tcl_AppendElement(interp,(comps.keycodes?comps.keycodes:""));
+ Tcl_AppendElement(interp,(comps.compat? comps.compat: ""));
+ Tcl_AppendElement(interp,(comps.types? comps.types: ""));
+ Tcl_AppendElement(interp,(comps.symbols? comps.symbols: ""));
+ Tcl_AppendElement(interp,(comps.geometry?comps.geometry:""));
+
+ XtFree(comps.keymap);
+ XtFree(comps.keycodes);
+ XtFree(comps.compat);
+ XtFree(comps.types);
+ XtFree(comps.symbols);
+ XtFree(comps.geometry);
+ XkbRF_Free(rules,True);
+ fclose(fp);
+
+ return TCL_OK;
+}
+
+/*
+ Return a list of rules defs and their descriptions
+*/
+
+#ifdef min
+#undef min
+#endif
+#define min(a,b) ((a<b)?(a):(b))
+
+int
+TCL_XF86ListKBDRules(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XkbRF_RulesPtr list;
+ Bool result;
+ int i, maxcnt;
+ char *tmp;
+ char *av_names[MAX_COMPONENTS];
+ char *av_descs[MAX_COMPONENTS];
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: xkb_listrules <rulesfilename>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((list= XkbRF_Create(0,0))==NULL) {
+ Tcl_SetResult(interp, "Can't create rules structure" , TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ result = XkbRF_LoadDescriptionsByName(argv[1],NULL,list);
+
+ if (result == False) {
+ Tcl_SetResult(interp, "", TCL_STATIC);
+ return TCL_OK;
+ }
+
+ maxcnt = min(list->models.num_desc,MAX_COMPONENTS);
+ for (i=0; i<maxcnt; i++) {
+ av_names[i] = list->models.desc[i].name;
+ av_descs[i] = list->models.desc[i].desc;
+ }
+
+ if ((tmp = Tcl_Merge(maxcnt, av_names)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ if ((tmp = Tcl_Merge(maxcnt, av_descs)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ maxcnt = min(list->layouts.num_desc,MAX_COMPONENTS);
+ for (i=0; i<maxcnt; i++) {
+ av_names[i] = list->layouts.desc[i].name;
+ av_descs[i] = list->layouts.desc[i].desc;
+ }
+
+ if ((tmp = Tcl_Merge(maxcnt, av_names)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ if ((tmp = Tcl_Merge(maxcnt, av_descs)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ maxcnt = min(list->variants.num_desc,MAX_COMPONENTS);
+ for (i=0; i<maxcnt; i++) {
+ av_names[i] = list->variants.desc[i].name;
+ av_descs[i] = list->variants.desc[i].desc;
+ }
+
+ if ((tmp = Tcl_Merge(maxcnt, av_names)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ if ((tmp = Tcl_Merge(maxcnt, av_descs)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ maxcnt = min(list->options.num_desc,MAX_COMPONENTS);
+ for (i=0; i<maxcnt; i++) {
+ av_names[i] = list->options.desc[i].name;
+ av_descs[i] = list->options.desc[i].desc;
+ }
+
+ if ((tmp = Tcl_Merge(maxcnt, av_names)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ if ((tmp = Tcl_Merge(maxcnt, av_descs)) == NULL)
+ return TCL_ERROR;
+ Tcl_AppendElement(interp, tmp);
+ XtFree(tmp);
+
+ XkbRF_Free(list,True);
+
+ return TCL_OK;
+}
+
+/*
+ Find out what rules defs were used to generate the keyboard currently
+ used by the server
+*/
+
+int
+TCL_XF86GetKBDProp(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ char *rulesfile;
+ XkbRF_VarDefsRec defs;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xkb_getrulesprop", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+ if (XkbRF_GetNamesProp(disp, &rulesfile, &defs) == False)
+ return TCL_OK;
+ Tcl_AppendElement(interp, rulesfile? rulesfile:"");
+ Tcl_AppendElement(interp, defs.model? defs.model:"");
+ Tcl_AppendElement(interp, defs.layout? defs.layout:"");
+ Tcl_AppendElement(interp, defs.variant? defs.variant:"");
+ Tcl_AppendElement(interp, defs.options? defs.options:"");
+ XtFree(rulesfile);
+ XtFree(defs.model);
+ XtFree(defs.layout);
+ XtFree(defs.variant);
+ XtFree(defs.options);
+
+ return TCL_OK;
+}
+
+/*
+ Set the _XKB_RULES_NAMES property to indicate what defs are
+ being used for the keyboard
+*/
+
+int
+TCL_XF86SetKBDProp(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin;
+ Display *disp;
+ XkbRF_VarDefsRec defs;
+ char *rulesfile;
+
+ if (argc != 6) {
+ Tcl_SetResult(interp,
+ "Usage: xkb_setrulesprop <rulesfile>"
+ " <model> <layout> <variant> <options>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ disp = Tk_Display(topwin);
+
+ defs.model = strlen(argv[2])? argv[2]: NULL;
+ defs.layout = strlen(argv[3])? argv[3]: NULL;
+ defs.variant = strlen(argv[4])? argv[4]: NULL;
+ defs.options = strlen(argv[5])? argv[5]: NULL;
+ rulesfile = strrchr(argv[1], '/');
+ if (rulesfile == NULL)
+ rulesfile = argv[1];
+ else
+ rulesfile++;
+
+ if (!XkbRF_SetNamesProp(disp, rulesfile, &defs)) {
+ Tcl_SetResult(interp, "Unable to set rules property",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ Given a string handle, return the corresponding pointer to a
+ keyboard description
+*/
+
+XkbDescPtr
+GetXkbDescPtr(interp, handle)
+ Tcl_Interp *interp;
+ char *handle;
+{
+ Tcl_HashEntry *entry;
+ entry = Tcl_FindHashEntry(&XkbDescTable, handle);
+ if (entry == NULL) {
+ Tcl_AppendResult(interp, "No keyboard named \"",
+ handle, "\"", (char *) NULL);
+ return NULL;
+ }
+ return (XkbDescPtr) Tcl_GetHashValue(entry);
+}
+
+/*
+ Get the next available handle
+*/
+
+void
+GetXkbHandle(buf)
+ char *buf;
+{
+ static unsigned int id = 1;
+ int new;
+
+ do {
+ sprintf(buf, "xkb%d", id++);
+ Tcl_CreateHashEntry(&XkbDescTable, buf, &new);
+ } while (!new);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/README b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/README
new file mode 100644
index 000000000..aa9dd9f03
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/README
@@ -0,0 +1,9 @@
+This directory contains the same files as the library directory of the
+Tk4.0p3 distribution, with the following changes:
+
+init.tcl has been added (it is from the Tcl4.0p3 sources)
+prolog.ps and obsolete.tcl have been removed
+combobox.tcl, downarrow.xbm, and uparrow.xbm added
+misc.tcl added
+
+tclIndex has been updated to reflect the above changes
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/button.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/button.tcl
new file mode 100644
index 000000000..073d8db63
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/button.tcl
@@ -0,0 +1,190 @@
+# button.tcl --
+#
+# This file defines the default bindings for Tk label, button,
+# checkbutton, and radiobutton widgets and provides procedures
+# that help in implementing those bindings.
+#
+# @(#) button.tcl 1.17 95/05/05 16:56:01
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for buttons.
+#-------------------------------------------------------------------------
+
+bind Button <FocusIn> {}
+bind Button <Enter> {
+ tkButtonEnter %W
+}
+bind Button <Leave> {
+ tkButtonLeave %W
+}
+bind Button <1> {
+ tkButtonDown %W
+}
+bind Button <ButtonRelease-1> {
+ tkButtonUp %W
+}
+bind Button <space> {
+ tkButtonInvoke %W
+}
+bind Button <Return> {
+ if !$tk_strictMotif {
+ tkButtonInvoke %W
+ }
+}
+
+bind Checkbutton <FocusIn> {}
+bind Checkbutton <Enter> {
+ tkButtonEnter %W
+}
+bind Checkbutton <Leave> {
+ tkButtonLeave %W
+}
+bind Checkbutton <1> {
+ tkCheckRadioInvoke %W
+}
+bind Checkbutton <space> {
+ tkCheckRadioInvoke %W
+}
+bind Checkbutton <Return> {
+ if !$tk_strictMotif {
+ tkCheckRadioInvoke %W
+ }
+}
+
+bind Radiobutton <FocusIn> {}
+bind Radiobutton <Enter> {
+ tkButtonEnter %W
+}
+bind Radiobutton <Leave> {
+ tkButtonLeave %W
+}
+bind Radiobutton <1> {
+ tkCheckRadioInvoke %W
+}
+bind Radiobutton <space> {
+ tkCheckRadioInvoke %W
+}
+bind Radiobutton <Return> {
+ if !$tk_strictMotif {
+ tkCheckRadioInvoke %W
+ }
+}
+
+# tkButtonEnter --
+# The procedure below is invoked when the mouse pointer enters a
+# button widget. It records the button we're in and changes the
+# state of the button to active unless the button is disabled.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkButtonEnter {w} {
+ global tkPriv
+ if {[$w cget -state] != "disabled"} {
+ $w config -state active
+ if {$tkPriv(buttonWindow) == $w} {
+ $w configure -state active -relief sunken
+ }
+ }
+ set tkPriv(window) $w
+}
+
+# tkButtonLeave --
+# The procedure below is invoked when the mouse pointer leaves a
+# button widget. It changes the state of the button back to
+# inactive. If we're leaving the button window with a mouse button
+# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
+# button too.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkButtonLeave w {
+ global tkPriv
+ if {[$w cget -state] != "disabled"} {
+ $w config -state normal
+ }
+ if {$w == $tkPriv(buttonWindow)} {
+ $w configure -relief $tkPriv(relief)
+ }
+ set tkPriv(window) ""
+}
+
+# tkButtonDown --
+# The procedure below is invoked when the mouse button is pressed in
+# a button widget. It records the fact that the mouse is in the button,
+# saves the button's relief so it can be restored later, and changes
+# the relief to sunken.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkButtonDown w {
+ global tkPriv
+ set tkPriv(relief) [lindex [$w config -relief] 4]
+ if {[$w cget -state] != "disabled"} {
+ set tkPriv(buttonWindow) $w
+ $w config -relief sunken
+ }
+}
+
+# tkButtonUp --
+# The procedure below is invoked when the mouse button is released
+# in a button widget. It restores the button's relief and invokes
+# the command as long as the mouse hasn't left the button.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkButtonUp w {
+ global tkPriv
+ if {$w == $tkPriv(buttonWindow)} {
+ set tkPriv(buttonWindow) ""
+ $w config -relief $tkPriv(relief)
+ if {($w == $tkPriv(window))
+ && ([$w cget -state] != "disabled")} {
+ uplevel #0 [list $w invoke]
+ }
+ }
+}
+
+# tkButtonInvoke --
+# The procedure below is called when a button is invoked through
+# the keyboard. It simulate a press of the button via the mouse.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkButtonInvoke w {
+ if {[$w cget -state] != "disabled"} {
+ set oldRelief [$w cget -relief]
+ set oldState [$w cget -state]
+ $w configure -state active -relief sunken
+ update idletasks
+ after 100
+ $w configure -state $oldState -relief $oldRelief
+ uplevel #0 [list $w invoke]
+ }
+}
+
+# tkCheckRadioInvoke --
+# The procedure below is invoked when the mouse button is pressed in
+# a checkbutton or radiobutton widget, or when the widget is invoked
+# through the keyboard. It invokes the widget if it
+# isn't disabled.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkCheckRadioInvoke w {
+ if {[$w cget -state] != "disabled"} {
+ uplevel #0 [list $w invoke]
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/combobox.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/combobox.tcl
new file mode 100644
index 000000000..e058309f5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/combobox.tcl
@@ -0,0 +1,179 @@
+# $XConsortium: combobox.tcl /main/1 1996/09/21 14:15:02 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/combobox.tcl,v 3.6 1996/12/27 06:54:54 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# Implements a simple combobox widget
+
+proc combobox {w args} {
+ global tcl_library
+
+ frame $w
+ # putting the # in front does a pretty good job of hiding things
+ rename $w #$w.frame
+ proc $w {args} "eval [list \\#combobox_proc $w] \$args"
+
+ entry $w.entry -relief sunken -bd 1m
+ button $w.button -command "\\#combobox_popup [list $w]" \
+ -bitmap @$tcl_library/downarrow.xbm
+ pack $w.entry $w.button -side left
+
+ toplevel $w.popup -cursor top_left_arrow
+
+ listbox $w.popup.list -yscroll "$w.popup.sb set" \
+ -selectmode browse -relief sunken -bd 1m
+ scrollbar $w.popup.sb -command "$w.popup.list yview"
+
+ set topwin [winfo toplevel $w]
+ wm withdraw $w.popup
+ wm transient $w.popup $topwin
+ wm overrideredirect $w.popup 1
+
+ bind $w.popup.list <ButtonRelease-1> "\\#combobox_buttonrel [list $w]"
+
+ if [llength $args] {
+ eval "\\#combobox_proc [list $w] econfig $args"
+ }
+}
+
+proc #combobox_proc {w op args} {
+
+ set p $w.popup
+ switch -- $op {
+ activate {return [eval [list $p.list activate] $args]}
+ bbox {return [eval [list $p.list bbox] $args]}
+ ecget {return [eval [list $w.entry cget] $args]}
+ lcget {return [eval [list $p.list cget] $args]}
+ econfig {return [eval [list $w.entry configure] $args]}
+ lconfig {return [eval [list $p.list configure] $args]}
+ curselection {return [eval \
+ [list $p.list curselection] $args]}
+ edelete {return [eval [list $w.entry delete] $args]}
+ ldelete {return [eval [list $p.list delete] $args]}
+ eget {return [eval [list $w.entry get] $args]}
+ lget {return [eval [list $p.list get] $args]}
+ icursor {return [eval [list $w.entry icursor] $args]}
+ eindex {return [eval [list $w.entry index] $args]}
+ lindex {return [eval [list $p.list index] $args]}
+ einsert {return [eval [list $w.entry insert] $args]}
+ linsert {return [eval [list $p.list insert] $args]}
+ nearest {return [eval [list $p.list nearest] $args]}
+ escan {return [eval [list $w.entry scan] $args]}
+ lscan {return [eval [list $p.list scan] $args]}
+ see {return [eval [list $p.list see] $args]}
+ eselection {return [eval [list $w.entry selection] $args]}
+ lselection {return [eval [list $p.list selection] $args]}
+ size {return [eval [list $p.list size] $args]}
+ exview {return [eval [list $w.entry xview] $args]}
+ lxview {return [eval [list $p.list xview] $args]}
+ yview {return [eval [list $p.list yview] $args]}
+ default {error "Unknown option" }
+ }
+}
+
+proc #combobox_popup { w } {
+ global tcl_library #combobox_vars
+
+ set count [$w.popup.list size]
+ if { $count == 0 } return
+ pack forget $w.popup.sb $w.popup.list
+ set #combobox_vars(focus) [focus]
+ if { $count > 10 } {
+ set wid [winfo width $w.entry]
+ $w.popup.list configure -height 10 -width [$w.entry cget -width]
+ #$w.popup.list configure -height 10
+ incr wid [expr [winfo width $w.button] +1 ]
+ pack $w.popup.list -side left -fill x -expand yes
+ pack $w.popup.sb -side left -fill y -expand yes
+ } else {
+ set wid [winfo width $w.entry]
+ #$w.popup.list configure -height $count -width $wid
+ $w.popup.list configure -height $count -width [$w.entry cget -width]
+ pack $w.popup.list -side left -fill x -expand yes
+ }
+ update idletasks
+ set ht [winfo reqheight $w.popup]
+ set xpos [winfo rootx $w]
+ set ypos [expr [winfo rooty $w]+[winfo reqheight $w]]
+ wm geometry $w.popup ${wid}x${ht}+${xpos}+${ypos}
+ #$w.popup.list configure -width [winfo width $w.entry]
+ #pack $w.popup.sb -side left -fill y -expand yes
+ wm deiconify $w.popup
+ raise $w.popup
+ #$w.button configure -state disabled
+ #grab -global $w.popup
+ grab $w.popup
+ bind $w.popup <ButtonPress-1> "\\#combobox_checkmsepos [list $w] %X %Y"
+ bind $w.popup.list <Return> "\\#combobox_popdown [list $w]"
+ #bind $w.popup.list <Escape> "\\#combobox_popdown [list $w]"
+ $w.button configure -command "\\#combobox_popdown [list $w]" \
+ -bitmap @$tcl_library/uparrow.xbm
+ set #combobox_vars($w,x) [winfo rootx $w]
+ set #combobox_vars($w,y) [winfo rooty $w]
+ bind [winfo toplevel $w] <Configure> "\\#combobox_follow [list $w]"
+ if [string length [focus]] {
+ focus $w.popup.list
+ }
+}
+
+proc #combobox_follow { w } {
+ global #combobox_vars
+
+ regexp {([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)} \
+ [wm geometry $w.popup] dummy pw ph px py
+ set oldx [set #combobox_vars($w,x)]
+ set oldy [set #combobox_vars($w,y)]
+ set newx [expr $px+[winfo rootx $w]-$oldx]
+ set newy [expr $py+[winfo rooty $w]-$oldy]
+ wm geometry $w.popup ${pw}x${ph}+${newx}+${newy}
+ set #combobox_vars($w,x) [winfo rootx $w]
+ set #combobox_vars($w,y) [winfo rooty $w]
+}
+
+proc #combobox_popdown { w } {
+ global tcl_library #combobox_vars
+
+ wm withdraw $w.popup
+ #$w.button configure -state normal
+ grab release $w.popup
+ if { [info exists #combobox_vars(focus)]
+ && [string length [set #combobox_vars(focus)]] } {
+ focus [set #combobox_vars(focus)]
+ }
+ set entry ""
+ foreach selection [$w.popup.list curselection] {
+ set text [$w.popup.list get $selection]
+ if { [string compare $text "<None>" ] != 0 &&
+ [string compare $text "<Probed>"] != 0 } {
+ append entry ",$text"
+ }
+ }
+ set oldstate [$w.entry cget -state]
+ $w.entry configure -state normal
+ $w.entry delete 0 end
+ $w.entry insert end [string range $entry 1 end]
+ $w.entry configure -state $oldstate
+ $w.button configure -command "\\#combobox_popup [list $w]" \
+ -bitmap @$tcl_library/downarrow.xbm
+}
+
+proc #combobox_buttonrel { w } {
+ set mode [$w.popup.list cget -selectmode]
+ if { "$mode" == "multiple" || "$mode" == "extended" } return
+ \#combobox_popdown $w
+}
+
+proc #combobox_checkmsepos { w xpos ypos } {
+ set curwin [winfo containing $xpos $ypos]
+ if { "[winfo toplevel $curwin]" == "$w.popup" } return
+ \#combobox_popdown $w
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/dialog.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/dialog.tcl
new file mode 100644
index 000000000..af09c3db2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/dialog.tcl
@@ -0,0 +1,130 @@
+# $XConsortium: dialog.tcl /main/1 1996/09/21 14:15:10 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/dialog.tcl,v 3.1 1996/12/27 06:54:55 dawes Exp $
+#
+# dialog.tcl --
+#
+# This file defines the procedure tk_dialog, which creates a dialog
+# box containing a bitmap, a message, and one or more buttons.
+#
+# @(#) dialog.tcl 1.18 95/11/24 15:03:04
+#
+# Copyright (c) 1992-1993 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# tk_dialog:
+#
+# This procedure displays a dialog box, waits for a button in the dialog
+# to be invoked, then returns the index of the selected button.
+#
+# Arguments:
+# w - Window to use for dialog top-level.
+# title - Title to display in dialog's decorative frame.
+# text - Message to display in dialog.
+# bitmap - Bitmap to display in dialog (empty string means none).
+# default - Index of button that is to display the default ring
+# (-1 means none).
+# args - One or more strings to display in buttons across the
+# bottom of the dialog box.
+
+proc tk_dialog {w title text bitmap default args} {
+ global tkPriv
+
+ # 1. Create the top-level window and divide it into top
+ # and bottom parts.
+
+ catch {destroy $w}
+ toplevel $w -class Dialog
+ wm title $w $title
+ wm iconname $w Dialog
+ wm protocol $w WM_DELETE_WINDOW { }
+ wm transient $w [winfo toplevel [winfo parent $w]]
+ frame $w.top -relief raised -bd 1
+ pack $w.top -side top -fill both
+ frame $w.bot -relief raised -bd 1
+ pack $w.bot -side bottom -fill both
+
+ # 2. Fill the top part with bitmap and message (use the option
+ # database for -wraplength so that it can be overridden by
+ # the caller).
+
+ option add *Dialog.msg.wrapLength 3i widgetDefault
+ label $w.msg -justify left -text $text \
+ -font -Adobe-Times-Medium-R-Normal--*-180-*-*-*-*-*-*
+ pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
+ if {$bitmap != ""} {
+ label $w.bitmap -bitmap $bitmap
+ pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
+ }
+
+ # 3. Create a row of buttons at the bottom of the dialog.
+
+ set i 0
+ foreach but $args {
+ button $w.button$i -text $but -command "set tkPriv(button) $i"
+ if {$i == $default} {
+ frame $w.default -relief sunken -bd 1
+ raise $w.button$i $w.default
+ pack $w.default -in $w.bot -side left -expand 1 -padx 3m -pady 2m
+ pack $w.button$i -in $w.default -padx 2m -pady 2m
+ } else {
+ pack $w.button$i -in $w.bot -side left -expand 1 \
+ -padx 3m -pady 2m
+ }
+ incr i
+ }
+
+ # 4. Withdraw the window, then update all the geometry information
+ # so we know how big it wants to be, then center the window in the
+ # display and de-iconify it.
+
+ wm withdraw $w
+ update idletasks
+ set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
+ - [winfo vrootx [winfo parent $w]]]
+ set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
+ - [winfo vrooty [winfo parent $w]]]
+ wm geom $w +$x+$y
+ wm deiconify $w
+
+ # 5. Set a grab and claim the focus too.
+
+ set oldFocus [focus]
+ set oldGrab [grab current $w]
+ if {$oldGrab != ""} {
+ set grabStatus [grab status $oldGrab]
+ }
+ grab $w
+ tkwait visibility $w
+ if {$default >= 0} {
+ focus $w.button$default
+ } else {
+ focus $w
+ }
+
+ # 6. Wait for the user to respond, then restore the focus and
+ # return the index of the selected button. Restore the focus
+ # before deleting the window, since otherwise the window manager
+ # may take the focus away so we can't redirect it. Finally,
+ # restore any grab that was in effect.
+
+ tkwait variable tkPriv(button)
+ catch {focus $oldFocus}
+ destroy $w
+ if {$oldGrab != ""} {
+ if {$grabStatus == "global"} {
+ grab -global $oldGrab
+ } else {
+ grab $oldGrab
+ }
+ }
+ return $tkPriv(button)
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/downarrow.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/downarrow.xbm
new file mode 100644
index 000000000..7050444ce
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/downarrow.xbm
@@ -0,0 +1,6 @@
+#define x5_width 13
+#define x5_height 14
+static char x5_bits[] = {
+ 0x40, 0x01, 0xc0, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x40, 0x01, 0xc0, 0x01,
+ 0x40, 0x01, 0xc0, 0x01, 0x4c, 0x19, 0xf8, 0x0f, 0x70, 0x07, 0xe0, 0x03,
+ 0xc0, 0x01, 0x80, 0x00};
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/entry.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/entry.tcl
new file mode 100644
index 000000000..6239daa52
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/entry.tcl
@@ -0,0 +1,501 @@
+# $XConsortium: entry.tcl /main/1 1996/09/21 14:15:21 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/entry.tcl,v 3.1 1996/12/27 06:54:56 dawes Exp $
+#
+# entry.tcl --
+#
+# This file defines the default bindings for Tk entry widgets and provides
+# procedures that help in implementing those bindings.
+#
+# @(#) entry.tcl 1.36 95/06/17 17:47:29
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# Elements of tkPriv that are used in this file:
+#
+# afterId - If non-null, it means that auto-scanning is underway
+# and it gives the "after" id for the next auto-scan
+# command to be executed.
+# mouseMoved - Non-zero means the mouse has moved a significant
+# amount since the button went down (so, for example,
+# start dragging out a selection).
+# pressX - X-coordinate at which the mouse button was pressed.
+# selectMode - The style of selection currently underway:
+# char, word, or line.
+# x, y - Last known mouse coordinates for scanning
+# and auto-scanning.
+#-------------------------------------------------------------------------
+
+# tkEntryClipboardKeysyms --
+# This procedure is invoked to identify the keys that correspond to
+# the "copy", "cut", and "paste" functions for the clipboard.
+#
+# Arguments:
+# copy - Name of the key (keysym name plus modifiers, if any,
+# such as "Meta-y") used for the copy operation.
+# cut - Name of the key used for the cut operation.
+# paste - Name of the key used for the paste operation.
+
+proc tkEntryClipboardKeysyms {copy cut paste} {
+ bind Entry <$copy> {
+ if {[selection own -displayof %W] == "%W"} {
+ clipboard clear -displayof %W
+ catch {
+ clipboard append -displayof %W [selection get -displayof %W]
+ }
+ }
+ }
+ bind Entry <$cut> {
+ if {[selection own -displayof %W] == "%W"} {
+ clipboard clear -displayof %W
+ catch {
+ clipboard append -displayof %W [selection get -displayof %W]
+ %W delete sel.first sel.last
+ }
+ }
+ }
+ bind Entry <$paste> {
+ catch {
+ %W insert insert [selection get -displayof %W \
+ -selection CLIPBOARD]
+ }
+ }
+}
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for entries.
+#-------------------------------------------------------------------------
+
+# Standard Motif bindings:
+
+bind Entry <1> {
+ tkEntryButton1 %W %x
+ %W selection clear
+}
+bind Entry <B1-Motion> {
+ set tkPriv(x) %x
+ tkEntryMouseSelect %W %x
+}
+bind Entry <Double-1> {
+ set tkPriv(selectMode) word
+ tkEntryMouseSelect %W %x
+ catch {%W icursor sel.first}
+}
+bind Entry <Triple-1> {
+ set tkPriv(selectMode) line
+ tkEntryMouseSelect %W %x
+ %W icursor 0
+}
+bind Entry <Shift-1> {
+ set tkPriv(selectMode) char
+ %W selection adjust @%x
+}
+bind Entry <Double-Shift-1> {
+ set tkPriv(selectMode) word
+ tkEntryMouseSelect %W %x
+}
+bind Entry <Triple-Shift-1> {
+ set tkPriv(selectMode) line
+ tkEntryMouseSelect %W %x
+}
+bind Entry <B1-Leave> {
+ set tkPriv(x) %x
+ tkEntryAutoScan %W
+}
+bind Entry <B1-Enter> {
+ tkCancelRepeat
+}
+bind Entry <ButtonRelease-1> {
+ tkCancelRepeat
+}
+bind Entry <Control-1> {
+ %W icursor @%x
+}
+
+bind Entry <Left> {
+ tkEntrySetCursor %W [expr [%W index insert] - 1]
+}
+bind Entry <Right> {
+ tkEntrySetCursor %W [expr [%W index insert] + 1]
+}
+bind Entry <Shift-Left> {
+ tkEntryKeySelect %W [expr [%W index insert] - 1]
+ tkEntrySeeInsert %W
+}
+bind Entry <Shift-Right> {
+ tkEntryKeySelect %W [expr [%W index insert] + 1]
+ tkEntrySeeInsert %W
+}
+bind Entry <Control-Left> {
+ tkEntrySetCursor %W \
+ [string wordstart [%W get] [expr [%W index insert] - 1]]
+}
+bind Entry <Control-Right> {
+ tkEntrySetCursor %W [string wordend [%W get] [%W index insert]]
+}
+bind Entry <Shift-Control-Left> {
+ tkEntryKeySelect %W \
+ [string wordstart [%W get] [expr [%W index insert] - 1]]
+ tkEntrySeeInsert %W
+}
+bind Entry <Shift-Control-Right> {
+ tkEntryKeySelect %W [string wordend [%W get] [%W index insert]]
+ tkEntrySeeInsert %W
+}
+bind Entry <Home> {
+ tkEntrySetCursor %W 0
+}
+bind Entry <Shift-Home> {
+ tkEntryKeySelect %W 0
+ tkEntrySeeInsert %W
+}
+bind Entry <End> {
+ tkEntrySetCursor %W end
+}
+bind Entry <Shift-End> {
+ tkEntryKeySelect %W end
+ tkEntrySeeInsert %W
+}
+
+bind Entry <Delete> {
+ if [%W selection present] {
+ %W delete sel.first sel.last
+ } else {
+ %W delete insert
+ }
+}
+bind Entry <BackSpace> {
+ tkEntryBackspace %W
+}
+
+bind Entry <Control-space> {
+ %W selection from insert
+}
+bind Entry <Select> {
+ %W selection from insert
+}
+bind Entry <Control-Shift-space> {
+ %W selection adjust insert
+}
+bind Entry <Shift-Select> {
+ %W selection adjust insert
+}
+bind Entry <Control-slash> {
+ %W selection range 0 end
+}
+bind Entry <Control-backslash> {
+ %W selection clear
+}
+tkEntryClipboardKeysyms F16 F20 F18
+
+bind Entry <KeyPress> {
+ tkEntryInsert %W %A
+}
+
+# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
+# Otherwise, if a widget binding for one of these is defined, the
+# <KeyPress> class binding will also fire and insert the character,
+# which is wrong. Ditto for Escape, Return, and Tab.
+
+bind Entry <Alt-KeyPress> {# nothing}
+bind Entry <Meta-KeyPress> {# nothing}
+bind Entry <Control-KeyPress> {# nothing}
+bind Entry <Escape> {# nothing}
+bind Entry <Return> {# nothing}
+bind Entry <KP_Enter> {# nothing}
+bind Entry <Tab> {# nothing}
+
+bind Entry <Insert> {
+ catch {tkEntryInsert %W [selection get -displayof %W]}
+}
+
+# Additional emacs-like bindings:
+
+if !$tk_strictMotif {
+ bind Entry <Control-a> {
+ tkEntrySetCursor %W 0
+ }
+ bind Entry <Control-b> {
+ tkEntrySetCursor %W [expr [%W index insert] - 1]
+ }
+ bind Entry <Control-d> {
+ %W delete insert
+ }
+ bind Entry <Control-e> {
+ tkEntrySetCursor %W end
+ }
+ bind Entry <Control-f> {
+ tkEntrySetCursor %W [expr [%W index insert] + 1]
+ }
+ bind Entry <Control-h> {
+ tkEntryBackspace %W
+ }
+ bind Entry <Control-k> {
+ %W delete insert end
+ }
+ bind Entry <Control-t> {
+ tkEntryTranspose %W
+ }
+ bind Entry <Meta-b> {
+ tkEntrySetCursor %W \
+ [string wordstart [%W get] [expr [%W index insert] - 1]]
+ }
+ bind Entry <Meta-d> {
+ %W delete insert [string wordend [%W get] [%W index insert]]
+ }
+ bind Entry <Meta-f> {
+ tkEntrySetCursor %W [string wordend [%W get] [%W index insert]]
+ }
+ bind Entry <Meta-BackSpace> {
+ %W delete [string wordstart [%W get] [expr [%W index insert] - 1]] \
+ insert
+ }
+ tkEntryClipboardKeysyms Meta-w Control-w Control-y
+
+ # A few additional bindings of my own.
+
+ bind Entry <2> {
+ %W scan mark %x
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ set tkPriv(mouseMoved) 0
+ }
+ bind Entry <B2-Motion> {
+ if {abs(%x-$tkPriv(x)) > 2} {
+ set tkPriv(mouseMoved) 1
+ }
+ %W scan dragto %x
+ }
+ bind Entry <ButtonRelease-2> {
+ if !$tkPriv(mouseMoved) {
+ catch {
+ %W insert @%x [selection get -displayof %W]
+ }
+ }
+ }
+}
+
+# tkEntryButton1 --
+# This procedure is invoked to handle button-1 presses in entry
+# widgets. It moves the insertion cursor, sets the selection anchor,
+# and claims the input focus.
+#
+# Arguments:
+# w - The entry window in which the button was pressed.
+# x - The x-coordinate of the button press.
+
+proc tkEntryButton1 {w x} {
+ global tkPriv
+
+ set tkPriv(selectMode) char
+ set tkPriv(mouseMoved) 0
+ set tkPriv(pressX) $x
+ $w icursor @$x
+ $w selection from @$x
+ if {[lindex [$w configure -state] 4] == "normal"} {focus $w}
+}
+
+# tkEntryMouseSelect --
+# This procedure is invoked when dragging out a selection with
+# the mouse. Depending on the selection mode (character, word,
+# line) it selects in different-sized units. This procedure
+# ignores mouse motions initially until the mouse has moved from
+# one character to another or until there have been multiple clicks.
+#
+# Arguments:
+# w - The entry window in which the button was pressed.
+# x - The x-coordinate of the mouse.
+
+proc tkEntryMouseSelect {w x} {
+ global tkPriv
+
+ set cur [$w index @$x]
+ set anchor [$w index anchor]
+ if {($cur != $anchor) || (abs($tkPriv(pressX) - $x) >= 3)} {
+ set tkPriv(mouseMoved) 1
+ }
+ switch $tkPriv(selectMode) {
+ char {
+ if $tkPriv(mouseMoved) {
+ if {$cur < [$w index anchor]} {
+ $w selection to $cur
+ } else {
+ $w selection to [expr $cur+1]
+ }
+ }
+ }
+ word {
+ if {$cur < [$w index anchor]} {
+ $w selection range [string wordstart [$w get] $cur] \
+ [string wordend [$w get] [expr $anchor-1]]
+ } else {
+ $w selection range [string wordstart [$w get] $anchor] \
+ [string wordend [$w get] $cur]
+ }
+ }
+ line {
+ $w selection range 0 end
+ }
+ }
+ update idletasks
+}
+
+# tkEntryAutoScan --
+# This procedure is invoked when the mouse leaves an entry window
+# with button 1 down. It scrolls the window left or right,
+# depending on where the mouse is, and reschedules itself as an
+# "after" command so that the window continues to scroll until the
+# mouse moves back into the window or the mouse button is released.
+#
+# Arguments:
+# w - The entry window.
+
+proc tkEntryAutoScan {w} {
+ global tkPriv
+ set x $tkPriv(x)
+ if {$x >= [winfo width $w]} {
+ $w xview scroll 2 units
+ tkEntryMouseSelect $w $x
+ } elseif {$x < 0} {
+ $w xview scroll -2 units
+ tkEntryMouseSelect $w $x
+ }
+ set tkPriv(afterId) [after 50 tkEntryAutoScan $w]
+}
+
+# tkEntryKeySelect --
+# This procedure is invoked when stroking out selections using the
+# keyboard. It moves the cursor to a new position, then extends
+# the selection to that position.
+#
+# Arguments:
+# w - The entry window.
+# new - A new position for the insertion cursor (the cursor hasn't
+# actually been moved to this position yet).
+
+proc tkEntryKeySelect {w new} {
+ if ![$w selection present] {
+ $w selection from insert
+ $w selection to $new
+ } else {
+ $w selection adjust $new
+ }
+ $w icursor $new
+}
+
+# tkEntryInsert --
+# Insert a string into an entry at the point of the insertion cursor.
+# If there is a selection in the entry, and it covers the point of the
+# insertion cursor, then delete the selection before inserting.
+#
+# Arguments:
+# w - The entry window in which to insert the string
+# s - The string to insert (usually just a single character)
+
+proc tkEntryInsert {w s} {
+ if {$s == ""} {
+ return
+ }
+ catch {
+ set insert [$w index insert]
+ if {([$w index sel.first] <= $insert)
+ && ([$w index sel.last] >= $insert)} {
+ $w delete sel.first sel.last
+ }
+ }
+ $w insert insert $s
+ tkEntrySeeInsert $w
+}
+
+# tkEntryBackspace --
+# Backspace over the character just before the insertion cursor.
+# If backspacing would move the cursor off the left edge of the
+# window, reposition the cursor at about the middle of the window.
+#
+# Arguments:
+# w - The entry window in which to backspace.
+
+proc tkEntryBackspace w {
+ if [$w selection present] {
+ $w delete sel.first sel.last
+ } else {
+ set x [expr {[$w index insert] - 1}]
+ if {$x >= 0} {$w delete $x}
+ if {[$w index @0] >= [$w index insert]} {
+ set range [$w xview]
+ set left [lindex $range 0]
+ set right [lindex $range 1]
+ $w xview moveto [expr $left - ($right - $left)/2.0]
+ }
+ }
+}
+
+# tkEntrySeeInsert --
+# Make sure that the insertion cursor is visible in the entry window.
+# If not, adjust the view so that it is.
+#
+# Arguments:
+# w - The entry window.
+
+proc tkEntrySeeInsert w {
+ set c [$w index insert]
+ set left [$w index @0]
+ if {$left > $c} {
+ $w xview $c
+ return
+ }
+ set x [winfo width $w]
+ while {([$w index @$x] <= $c) && ($left < $c)} {
+ incr left
+ $w xview $left
+ }
+}
+
+# tkEntrySetCursor -
+# Move the insertion cursor to a given position in an entry. Also
+# clears the selection, if there is one in the entry, and makes sure
+# that the insertion cursor is visible.
+#
+# Arguments:
+# w - The entry window.
+# pos - The desired new position for the cursor in the window.
+
+proc tkEntrySetCursor {w pos} {
+ $w icursor $pos
+ $w selection clear
+ tkEntrySeeInsert $w
+}
+
+# tkEntryTranspose -
+# This procedure implements the "transpose" function for entry widgets.
+# It tranposes the characters on either side of the insertion cursor,
+# unless the cursor is at the end of the line. In this case it
+# transposes the two characters to the left of the cursor. In either
+# case, the cursor ends up to the right of the transposed characters.
+#
+# Arguments:
+# w - The entry window.
+
+proc tkEntryTranspose w {
+ set i [$w index insert]
+ if {$i < [$w index end]} {
+ incr i
+ }
+ set first [expr $i-2]
+ if {$first < 0} {
+ return
+ }
+ set new [string index [$w get] [expr $i-1]][string index [$w get] $first]
+ $w delete $first $i
+ $w insert insert $new
+ tkEntrySeeInsert $w
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/focus.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/focus.tcl
new file mode 100644
index 000000000..df890776d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/focus.tcl
@@ -0,0 +1,187 @@
+# $XConsortium: focus.tcl /main/1 1996/09/21 14:15:25 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/focus.tcl,v 3.1 1996/12/27 06:54:57 dawes Exp $
+#
+# focus.tcl --
+#
+# This file defines several procedures for managing the input
+# focus.
+#
+# @(#) focus.tcl 1.15 95/10/30 08:08:27
+#
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# tk_focusNext --
+# This procedure returns the name of the next window after "w" in
+# "focus order" (the window that should receive the focus next if
+# Tab is typed in w). "Next" is defined by a pre-order search
+# of a top-level and its non-top-level descendants, with the stacking
+# order determining the order of siblings. The "-takefocus" options
+# on windows determine whether or not they should be skipped.
+#
+# Arguments:
+# w - Name of a window.
+
+proc tk_focusNext w {
+ set cur $w
+ while 1 {
+
+ # Descend to just before the first child of the current widget.
+
+ set parent $cur
+ set children [winfo children $cur]
+ set i -1
+
+ # Look for the next sibling that isn't a top-level.
+
+ while 1 {
+ incr i
+ if {$i < [llength $children]} {
+ set cur [lindex $children $i]
+ if {[winfo toplevel $cur] == $cur} {
+ continue
+ } else {
+ break
+ }
+ }
+
+ # No more siblings, so go to the current widget's parent.
+ # If it's a top-level, break out of the loop, otherwise
+ # look for its next sibling.
+
+ set cur $parent
+ if {[winfo toplevel $cur] == $cur} {
+ break
+ }
+ set parent [winfo parent $parent]
+ set children [winfo children $parent]
+ set i [lsearch -exact $children $cur]
+ }
+ if {($cur == $w) || [tkFocusOK $cur]} {
+ return $cur
+ }
+ }
+}
+
+# tk_focusPrev --
+# This procedure returns the name of the previous window before "w" in
+# "focus order" (the window that should receive the focus next if
+# Shift-Tab is typed in w). "Next" is defined by a pre-order search
+# of a top-level and its non-top-level descendants, with the stacking
+# order determining the order of siblings. The "-takefocus" options
+# on windows determine whether or not they should be skipped.
+#
+# Arguments:
+# w - Name of a window.
+
+proc tk_focusPrev w {
+ set cur $w
+ while 1 {
+
+ # Collect information about the current window's position
+ # among its siblings. Also, if the window is a top-level,
+ # then reposition to just after the last child of the window.
+
+ if {[winfo toplevel $cur] == $cur} {
+ set parent $cur
+ set children [winfo children $cur]
+ set i [llength $children]
+ } else {
+ set parent [winfo parent $cur]
+ set children [winfo children $parent]
+ set i [lsearch -exact $children $cur]
+ }
+
+ # Go to the previous sibling, then descend to its last descendant
+ # (highest in stacking order. While doing this, ignore top-levels
+ # and their descendants. When we run out of descendants, go up
+ # one level to the parent.
+
+ while {$i > 0} {
+ incr i -1
+ set cur [lindex $children $i]
+ if {[winfo toplevel $cur] == $cur} {
+ continue
+ }
+ set parent $cur
+ set children [winfo children $parent]
+ set i [llength $children]
+ }
+ set cur $parent
+ if {($cur == $w) || [tkFocusOK $cur]} {
+ return $cur
+ }
+ }
+}
+
+# tkFocusOK --
+#
+# This procedure is invoked to decide whether or not to focus on
+# a given window. It returns 1 if it's OK to focus on the window,
+# 0 if it's not OK. The code first checks whether the window is
+# viewable. If not, then it never focuses on the window. Then it
+# checks the -takefocus option for the window and uses it if it's
+# set. If there's no -takefocus option, the procedure checks to
+# see if (a) the widget isn't disabled, and (b) it has some key
+# bindings. If all of these are true, then 1 is returned.
+#
+# Arguments:
+# w - Name of a window.
+
+proc tkFocusOK w {
+ if {![winfo viewable $w]} {
+ return 0
+ }
+ set code [catch {$w cget -takefocus} value]
+ if {($code == 0) && ($value != "")} {
+ if {$value == 0} {
+ return 0
+ } elseif {$value == 1} {
+ return 1
+ } else {
+ set value [uplevel #0 $value $w]
+ if {$value != ""} {
+ return $value
+ }
+ }
+ }
+ set code [catch {$w cget -state} value]
+ if {($code == 0) && ($value == "disabled")} {
+ return 0
+ }
+ regexp Key|Focus "[bind $w] [bind [winfo class $w]]"
+}
+
+# tk_focusFollowsMouse --
+#
+# If this procedure is invoked, Tk will enter "focus-follows-mouse"
+# mode, where the focus is always on whatever window contains the
+# mouse. If this procedure isn't invoked, then the user typically
+# has to click on a window to give it the focus.
+#
+# Arguments:
+# None.
+
+proc tk_focusFollowsMouse {} {
+ set old [bind all <Enter>]
+ set script {
+ if {("%d" == "NotifyAncestor") || ("%d" == "NotifyNonlinear")
+ || ("%d" == "NotifyInferior")} {
+ if [tkFocusOK %W] {
+ focus %W
+ }
+ }
+ }
+ if {$old != ""} {
+ bind all <Enter> "$old; $script"
+ } else {
+ bind all <Enter> $script
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/init.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/init.tcl
new file mode 100644
index 000000000..e481d2ed9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/init.tcl
@@ -0,0 +1,284 @@
+# $XConsortium: init.tcl /main/1 1996/09/21 14:15:28 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/init.tcl,v 3.1 1996/12/27 06:54:58 dawes Exp $
+#
+# init.tcl --
+#
+# Default system startup file for Tcl-based applications. Defines
+# "unknown" procedure and auto-load facilities.
+#
+# @(#) init.tcl 1.37 95/03/29 10:26:32
+#
+# Copyright (c) 1991-1993 The Regents of the University of California.
+# Copyright (c) 1994 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+set auto_path [info library]
+set errorCode ""
+set errorInfo ""
+
+# unknown:
+# Invoked when a Tcl command is invoked that doesn't exist in the
+# interpreter:
+#
+# 1. See if the autoload facility can locate the command in a
+# Tcl script file. If so, load it and execute it.
+# 2. If the command was invoked interactively at top-level:
+# (a) see if the command exists as an executable UNIX program.
+# If so, "exec" the command.
+# (b) see if the command requests csh-like history substitution
+# in one of the common forms !!, !<number>, or ^old^new. If
+# so, emulate csh's history substitution.
+# (c) see if the command is a unique abbreviation for another
+# command. If so, invoke the command.
+
+proc unknown args {
+ global auto_noexec auto_noload env unknown_pending tcl_interactive
+ global errorCode errorInfo
+
+ # Save the values of errorCode and errorInfo variables, since they
+ # may get modified if caught errors occur below. The variables will
+ # be restored just before re-executing the missing command.
+
+ set savedErrorCode $errorCode
+ set savedErrorInfo $errorInfo
+ set name [lindex $args 0]
+ if ![info exists auto_noload] {
+ #
+ # Make sure we're not trying to load the same proc twice.
+ #
+ if [info exists unknown_pending($name)] {
+ unset unknown_pending($name)
+ if {[array size unknown_pending] == 0} {
+ unset unknown_pending
+ }
+ return -code error "self-referential recursion in \"unknown\" for command \"$name\"";
+ }
+ set unknown_pending($name) pending;
+ set ret [catch {auto_load $name} msg]
+ unset unknown_pending($name);
+ if {$ret != 0} {
+ return -code $ret "error while autoloading \"$name\": $msg"
+ }
+ if ![array size unknown_pending] {
+ unset unknown_pending
+ }
+ if $msg {
+ set errorCode $savedErrorCode
+ set errorInfo $savedErrorInfo
+ set code [catch {uplevel $args} msg]
+ if {$code == 1} {
+ #
+ # Strip the last five lines off the error stack (they're
+ # from the "uplevel" command).
+ #
+
+ set new [split $errorInfo \n]
+ set new [join [lrange $new 0 [expr [llength $new] - 6]] \n]
+ return -code error -errorcode $errorCode \
+ -errorinfo $new $msg
+ } else {
+ return -code $code $msg
+ }
+ }
+ }
+ if {([info level] == 1) && ([info script] == "") \
+ && [info exists tcl_interactive] && $tcl_interactive} {
+ if ![info exists auto_noexec] {
+ if [auto_execok $name] {
+ set errorCode $savedErrorCode
+ set errorInfo $savedErrorInfo
+ return [uplevel exec >&@stdout <@stdin $args]
+ }
+ }
+ set errorCode $savedErrorCode
+ set errorInfo $savedErrorInfo
+ if {$name == "!!"} {
+ return [uplevel {history redo}]
+ }
+ if [regexp {^!(.+)$} $name dummy event] {
+ return [uplevel [list history redo $event]]
+ }
+ if [regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new] {
+ return [uplevel [list history substitute $old $new]]
+ }
+ set cmds [info commands $name*]
+ if {[llength $cmds] == 1} {
+ return [uplevel [lreplace $args 0 0 $cmds]]
+ }
+ if {[llength $cmds] != 0} {
+ if {$name == ""} {
+ return -code error "empty command name \"\""
+ } else {
+ return -code error \
+ "ambiguous command name \"$name\": [lsort $cmds]"
+ }
+ }
+ }
+ return -code error "invalid command name \"$name\""
+}
+
+# auto_load:
+# Checks a collection of library directories to see if a procedure
+# is defined in one of them. If so, it sources the appropriate
+# library file to create the procedure. Returns 1 if it successfully
+# loaded the procedure, 0 otherwise.
+
+proc auto_load cmd {
+ global auto_index auto_oldpath auto_path env errorInfo errorCode
+
+ if [info exists auto_index($cmd)] {
+ uplevel #0 $auto_index($cmd)
+ return [expr {[info commands $cmd] != ""}]
+ }
+ if [catch {set path $auto_path}] {
+ if [catch {set path $env(TCLLIBPATH)}] {
+ if [catch {set path [info library]}] {
+ return 0
+ }
+ }
+ }
+ if [info exists auto_oldpath] {
+ if {$auto_oldpath == $path} {
+ return 0
+ }
+ }
+ set auto_oldpath $path
+ catch {unset auto_index}
+ for {set i [expr [llength $path] - 1]} {$i >= 0} {incr i -1} {
+ set dir [lindex $path $i]
+ set f ""
+ if [catch {set f [open $dir/tclIndex]}] {
+ continue
+ }
+ set error [catch {
+ set id [gets $f]
+ if {$id == "# Tcl autoload index file, version 2.0"} {
+ eval [read $f]
+ } elseif {$id == "# Tcl autoload index file: each line identifies a Tcl"} {
+ while {[gets $f line] >= 0} {
+ if {([string index $line 0] == "#")
+ || ([llength $line] != 2)} {
+ continue
+ }
+ set name [lindex $line 0]
+ set auto_index($name) "source $dir/[lindex $line 1]"
+ }
+ } else {
+ error "$dir/tclIndex isn't a proper Tcl index file"
+ }
+ } msg]
+ if {$f != ""} {
+ close $f
+ }
+ if $error {
+ error $msg $errorInfo $errorCode
+ }
+ }
+ if [info exists auto_index($cmd)] {
+ uplevel #0 $auto_index($cmd)
+ if {[info commands $cmd] != ""} {
+ return 1
+ }
+ }
+ return 0
+}
+
+# auto_execok:
+# Returns 1 if there's an executable in the current path for the
+# given name, 0 otherwise. Builds an associative array auto_execs
+# that caches information about previous checks, for speed.
+
+proc auto_execok name {
+ global auto_execs env
+
+ if [info exists auto_execs($name)] {
+ return $auto_execs($name)
+ }
+ set auto_execs($name) 0
+ if {[string first / $name] >= 0} {
+ if {[file executable $name] && ![file isdirectory $name]} {
+ set auto_execs($name) 1
+ }
+ return $auto_execs($name)
+ }
+ foreach dir [split $env(PATH) :] {
+ if {$dir == ""} {
+ set dir .
+ }
+ if {[file executable $dir/$name] && ![file isdirectory $dir/$name]} {
+ set auto_execs($name) 1
+ return 1
+ }
+ }
+ return 0
+}
+
+# auto_reset:
+# Destroy all cached information for auto-loading and auto-execution,
+# so that the information gets recomputed the next time it's needed.
+# Also delete any procedures that are listed in the auto-load index
+# except those related to auto-loading.
+
+proc auto_reset {} {
+ global auto_execs auto_index auto_oldpath
+ foreach p [info procs] {
+ if {[info exists auto_index($p)] && ($p != "unknown")
+ && ![string match auto_* $p]} {
+ rename $p {}
+ }
+ }
+ catch {unset auto_execs}
+ catch {unset auto_index}
+ catch {unset auto_oldpath}
+}
+
+# auto_mkindex:
+# Regenerate a tclIndex file from Tcl source files. Takes as argument
+# the name of the directory in which the tclIndex file is to be placed,
+# floowed by any number of glob patterns to use in that directory to
+# locate all of the relevant files.
+
+proc auto_mkindex {dir args} {
+ global errorCode errorInfo
+ set oldDir [pwd]
+ cd $dir
+ set dir [pwd]
+ append index "# Tcl autoload index file, version 2.0\n"
+ append index "# This file is generated by the \"auto_mkindex\" command\n"
+ append index "# and sourced to set up indexing information for one or\n"
+ append index "# more commands. Typically each line is a command that\n"
+ append index "# sets an element in the auto_index array, where the\n"
+ append index "# element name is the name of a command and the value is\n"
+ append index "# a script that loads the command.\n\n"
+ foreach file [eval glob $args] {
+ set f ""
+ set error [catch {
+ set f [open $file]
+ while {[gets $f line] >= 0} {
+ if [regexp {^proc[ ]+([^ ]*)} $line match procName] {
+ append index "set [list auto_index($procName)]"
+ append index " \"source \$dir/$file\"\n"
+ }
+ }
+ close $f
+ } msg]
+ if $error {
+ set code $errorCode
+ set info $errorInfo
+ catch {close $f}
+ cd $oldDir
+ error $msg $info $code
+ }
+ }
+ set f [open tclIndex w]
+ puts $f $index nonewline
+ close $f
+ cd $oldDir
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/license.terms b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/license.terms
new file mode 100644
index 000000000..3dcd816f4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/license.terms
@@ -0,0 +1,32 @@
+This software is copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., and other parties. The following
+terms apply to all files associated with the software unless explicitly
+disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+RESTRICTED RIGHTS: Use, duplication or disclosure by the government
+is subject to the restrictions as set forth in subparagraph (c) (1) (ii)
+of the Rights in Technical Data and Computer Software Clause as DFARS
+252.227-7013 and FAR 52.227-19.
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/listbox.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/listbox.tcl
new file mode 100644
index 000000000..bfc4e8820
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/listbox.tcl
@@ -0,0 +1,453 @@
+# $XConsortium: listbox.tcl /main/1 1996/09/21 14:15:40 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/listbox.tcl,v 3.1 1996/12/27 06:54:59 dawes Exp $
+#
+# listbox.tcl --
+#
+# This file defines the default bindings for Tk listbox widgets
+# and provides procedures that help in implementing those bindings.
+#
+# @(#) listbox.tcl 1.14 95/11/02 11:02:19
+#
+# Copyright (c) 1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+#--------------------------------------------------------------------------
+# tkPriv elements used in this file:
+#
+# afterId - Token returned by "after" for autoscanning.
+# listboxPrev - The last element to be selected or deselected
+# during a selection operation.
+# listboxSelection - All of the items that were selected before the
+# current selection operation (such as a mouse
+# drag) started; used to cancel an operation.
+#--------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for listboxes.
+#-------------------------------------------------------------------------
+
+# Note: the check for existence of %W below is because this binding
+# is sometimes invoked after a window has been deleted (e.g. because
+# there is a double-click binding on the widget that deletes it). Users
+# can put "break"s in their bindings to avoid the error, but this check
+# makes that unnecessary.
+
+bind Listbox <1> {
+ if [winfo exists %W] {
+ tkListboxBeginSelect %W [%W index @%x,%y]
+ }
+}
+
+# Ignore double clicks so that users can define their own behaviors.
+# Among other things, this prevents errors if the user deletes the
+# listbox on a double click.
+
+bind Listbox <2> {
+ # Empty script
+}
+
+bind Listbox <B1-Motion> {
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ tkListboxMotion %W [%W index @%x,%y]
+}
+bind Listbox <ButtonRelease-1> {
+ tkCancelRepeat
+ %W activate @%x,%y
+}
+bind Listbox <Shift-1> {
+ tkListboxBeginExtend %W [%W index @%x,%y]
+}
+bind Listbox <Control-1> {
+ tkListboxBeginToggle %W [%W index @%x,%y]
+}
+bind Listbox <B1-Leave> {
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ tkListboxAutoScan %W
+}
+bind Listbox <B1-Enter> {
+ tkCancelRepeat
+}
+
+bind Listbox <Up> {
+ tkListboxUpDown %W -1
+}
+bind Listbox <Shift-Up> {
+ tkListboxExtendUpDown %W -1
+}
+bind Listbox <Down> {
+ tkListboxUpDown %W 1
+}
+bind Listbox <Shift-Down> {
+ tkListboxExtendUpDown %W 1
+}
+bind Listbox <Left> {
+ %W xview scroll -1 units
+}
+bind Listbox <Control-Left> {
+ %W xview scroll -1 pages
+}
+bind Listbox <Right> {
+ %W xview scroll 1 units
+}
+bind Listbox <Control-Right> {
+ %W xview scroll 1 pages
+}
+bind Listbox <Prior> {
+ %W yview scroll -1 pages
+ %W activate @0,0
+}
+bind Listbox <Next> {
+ %W yview scroll 1 pages
+ %W activate @0,0
+}
+bind Listbox <Control-Prior> {
+ %W xview scroll -1 pages
+}
+bind Listbox <Control-Next> {
+ %W xview scroll 1 pages
+}
+bind Listbox <Home> {
+ %W xview moveto 0
+}
+bind Listbox <End> {
+ %W xview moveto 1
+}
+bind Listbox <Control-Home> {
+ %W activate 0
+ %W see 0
+ %W selection clear 0 end
+ %W selection set 0
+}
+bind Listbox <Shift-Control-Home> {
+ tkListboxDataExtend %W 0
+}
+bind Listbox <Control-End> {
+ %W activate end
+ %W see end
+ %W selection clear 0 end
+ %W selection set end
+}
+bind Listbox <Shift-Control-End> {
+ tkListboxDataExtend %W end
+}
+bind Listbox <F16> {
+ if {[selection own -displayof %W] == "%W"} {
+ clipboard clear -displayof %W
+ clipboard append -displayof %W [selection get -displayof %W]
+ }
+}
+bind Listbox <space> {
+ tkListboxBeginSelect %W [%W index active]
+}
+bind Listbox <Select> {
+ tkListboxBeginSelect %W [%W index active]
+}
+bind Listbox <Control-Shift-space> {
+ tkListboxBeginExtend %W [%W index active]
+}
+bind Listbox <Shift-Select> {
+ tkListboxBeginExtend %W [%W index active]
+}
+bind Listbox <Escape> {
+ tkListboxCancel %W
+}
+bind Listbox <Control-slash> {
+ tkListboxSelectAll %W
+}
+bind Listbox <Control-backslash> {
+ if {[%W cget -selectmode] != "browse"} {
+ %W selection clear 0 end
+ }
+}
+
+# Additional Tk bindings that aren't part of the Motif look and feel:
+
+bind Listbox <2> {
+ %W scan mark %x %y
+}
+bind Listbox <B2-Motion> {
+ %W scan dragto %x %y
+}
+
+# tkListboxBeginSelect --
+#
+# This procedure is typically invoked on button-1 presses. It begins
+# the process of making a selection in the listbox. Its exact behavior
+# depends on the selection mode currently in effect for the listbox;
+# see the Motif documentation for details.
+#
+# Arguments:
+# w - The listbox widget.
+# el - The element for the selection operation (typically the
+# one under the pointer). Must be in numerical form.
+
+proc tkListboxBeginSelect {w el} {
+ global tkPriv
+ if {[$w cget -selectmode] == "multiple"} {
+ if [$w selection includes $el] {
+ $w selection clear $el
+ } else {
+ $w selection set $el
+ }
+ } else {
+ $w selection clear 0 end
+ $w selection set $el
+ $w selection anchor $el
+ set tkPriv(listboxSelection) {}
+ set tkPriv(listboxPrev) $el
+ }
+}
+
+# tkListboxMotion --
+#
+# This procedure is called to process mouse motion events while
+# button 1 is down. It may move or extend the selection, depending
+# on the listbox's selection mode.
+#
+# Arguments:
+# w - The listbox widget.
+# el - The element under the pointer (must be a number).
+
+proc tkListboxMotion {w el} {
+ global tkPriv
+ if {$el == $tkPriv(listboxPrev)} {
+ return
+ }
+ set anchor [$w index anchor]
+ switch [$w cget -selectmode] {
+ browse {
+ $w selection clear 0 end
+ $w selection set $el
+ set tkPriv(listboxPrev) $el
+ }
+ extended {
+ set i $tkPriv(listboxPrev)
+ if [$w selection includes anchor] {
+ $w selection clear $i $el
+ $w selection set anchor $el
+ } else {
+ $w selection clear $i $el
+ $w selection clear anchor $el
+ }
+ while {($i < $el) && ($i < $anchor)} {
+ if {[lsearch $tkPriv(listboxSelection) $i] >= 0} {
+ $w selection set $i
+ }
+ incr i
+ }
+ while {($i > $el) && ($i > $anchor)} {
+ if {[lsearch $tkPriv(listboxSelection) $i] >= 0} {
+ $w selection set $i
+ }
+ incr i -1
+ }
+ set tkPriv(listboxPrev) $el
+ }
+ }
+}
+
+# tkListboxBeginExtend --
+#
+# This procedure is typically invoked on shift-button-1 presses. It
+# begins the process of extending a selection in the listbox. Its
+# exact behavior depends on the selection mode currently in effect
+# for the listbox; see the Motif documentation for details.
+#
+# Arguments:
+# w - The listbox widget.
+# el - The element for the selection operation (typically the
+# one under the pointer). Must be in numerical form.
+
+proc tkListboxBeginExtend {w el} {
+ if {([$w cget -selectmode] == "extended")
+ && [$w selection includes anchor]} {
+ tkListboxMotion $w $el
+ }
+}
+
+# tkListboxBeginToggle --
+#
+# This procedure is typically invoked on control-button-1 presses. It
+# begins the process of toggling a selection in the listbox. Its
+# exact behavior depends on the selection mode currently in effect
+# for the listbox; see the Motif documentation for details.
+#
+# Arguments:
+# w - The listbox widget.
+# el - The element for the selection operation (typically the
+# one under the pointer). Must be in numerical form.
+
+proc tkListboxBeginToggle {w el} {
+ global tkPriv
+ if {[$w cget -selectmode] == "extended"} {
+ set tkPriv(listboxSelection) [$w curselection]
+ set tkPriv(listboxPrev) $el
+ $w selection anchor $el
+ if [$w selection includes $el] {
+ $w selection clear $el
+ } else {
+ $w selection set $el
+ }
+ }
+}
+
+# tkListboxAutoScan --
+# This procedure is invoked when the mouse leaves an entry window
+# with button 1 down. It scrolls the window up, down, left, or
+# right, depending on where the mouse left the window, and reschedules
+# itself as an "after" command so that the window continues to scroll until
+# the mouse moves back into the window or the mouse button is released.
+#
+# Arguments:
+# w - The entry window.
+
+proc tkListboxAutoScan {w} {
+ global tkPriv
+ set x $tkPriv(x)
+ set y $tkPriv(y)
+ if {$y >= [winfo height $w]} {
+ $w yview scroll 1 units
+ } elseif {$y < 0} {
+ $w yview scroll -1 units
+ } elseif {$x >= [winfo width $w]} {
+ $w xview scroll 2 units
+ } elseif {$x < 0} {
+ $w xview scroll -2 units
+ } else {
+ return
+ }
+ tkListboxMotion $w [$w index @$x,$y]
+ set tkPriv(afterId) [after 50 tkListboxAutoScan $w]
+}
+
+# tkListboxUpDown --
+#
+# Moves the location cursor (active element) up or down by one element,
+# and changes the selection if we're in browse or extended selection
+# mode.
+#
+# Arguments:
+# w - The listbox widget.
+# amount - +1 to move down one item, -1 to move back one item.
+
+proc tkListboxUpDown {w amount} {
+ global tkPriv
+ $w activate [expr [$w index active] + $amount]
+ $w see active
+ switch [$w cget -selectmode] {
+ browse {
+ $w selection clear 0 end
+ $w selection set active
+ }
+ extended {
+ $w selection clear 0 end
+ $w selection set active
+ $w selection anchor active
+ set tkPriv(listboxPrev) [$w index active]
+ set tkPriv(listboxSelection) {}
+ }
+ }
+}
+
+# tkListboxExtendUpDown --
+#
+# Does nothing unless we're in extended selection mode; in this
+# case it moves the location cursor (active element) up or down by
+# one element, and extends the selection to that point.
+#
+# Arguments:
+# w - The listbox widget.
+# amount - +1 to move down one item, -1 to move back one item.
+
+proc tkListboxExtendUpDown {w amount} {
+ if {[$w cget -selectmode] != "extended"} {
+ return
+ }
+ $w activate [expr [$w index active] + $amount]
+ $w see active
+ tkListboxMotion $w [$w index active]
+}
+
+# tkListboxDataExtend
+#
+# This procedure is called for key-presses such as Shift-KEndData.
+# If the selection mode isn't multiple or extend then it does nothing.
+# Otherwise it moves the active element to el and, if we're in
+# extended mode, extends the selection to that point.
+#
+# Arguments:
+# w - The listbox widget.
+# el - An integer element number.
+
+proc tkListboxDataExtend {w el} {
+ set mode [$w cget -selectmode]
+ if {$mode == "extended"} {
+ $w activate $el
+ $w see $el
+ if [$w selection includes anchor] {
+ tkListboxMotion $w $el
+ }
+ } elseif {$mode == "multiple"} {
+ $w activate $el
+ $w see $el
+ }
+}
+
+# tkListboxCancel
+#
+# This procedure is invoked to cancel an extended selection in
+# progress. If there is an extended selection in progress, it
+# restores all of the items between the active one and the anchor
+# to their previous selection state.
+#
+# Arguments:
+# w - The listbox widget.
+
+proc tkListboxCancel w {
+ global tkPriv
+ if {[$w cget -selectmode] != "extended"} {
+ return
+ }
+ set first [$w index anchor]
+ set last $tkPriv(listboxPrev)
+ if {$first > $last} {
+ set tmp $first
+ set first $last
+ set last $tmp
+ }
+ $w selection clear $first $last
+ while {$first <= $last} {
+ if {[lsearch $tkPriv(listboxSelection) $first] >= 0} {
+ $w selection set $first
+ }
+ incr first
+ }
+}
+
+# tkListboxSelectAll
+#
+# This procedure is invoked to handle the "select all" operation.
+# For single and browse mode, it just selects the active element.
+# Otherwise it selects everything in the widget.
+#
+# Arguments:
+# w - The listbox widget.
+
+proc tkListboxSelectAll w {
+ set mode [$w cget -selectmode]
+ if {($mode == "single") || ($mode == "browse")} {
+ $w selection clear 0 end
+ $w selection set active
+ } else {
+ $w selection set 0 end
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/menu.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/menu.tcl
new file mode 100644
index 000000000..02407c881
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/menu.tcl
@@ -0,0 +1,921 @@
+# $XConsortium: menu.tcl /main/1 1996/09/21 14:15:49 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/menu.tcl,v 3.1 1996/12/27 06:55:00 dawes Exp $
+#
+# menu.tcl --
+#
+# This file defines the default bindings for Tk menus and menubuttons.
+# It also implements keyboard traversal of menus and implements a few
+# other utility procedures related to menus.
+#
+# @(#) menu.tcl 1.59 95/11/24 14:51:37
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# Elements of tkPriv that are used in this file:
+#
+# cursor - Saves the -cursor option for the posted menubutton.
+# focus - Saves the focus during a menu selection operation.
+# Focus gets restored here when the menu is unposted.
+# grabGlobal - Used in conjunction with tkPriv(oldGrab): if
+# tkPriv(oldGrab) is non-empty, then tkPriv(grabGlobal)
+# contains either an empty string or "-global" to
+# indicate whether the old grab was a local one or
+# a global one.
+# inMenubutton - The name of the menubutton widget containing
+# the mouse, or an empty string if the mouse is
+# not over any menubutton.
+# oldGrab - Window that had the grab before a menu was posted.
+# Used to restore the grab state after the menu
+# is unposted. Empty string means there was no
+# grab previously set.
+# popup - If a menu has been popped up via tk_popup, this
+# gives the name of the menu. Otherwise this
+# value is empty.
+# postedMb - Name of the menubutton whose menu is currently
+# posted, or an empty string if nothing is posted
+# A grab is set on this widget.
+# relief - Used to save the original relief of the current
+# menubutton.
+# window - When the mouse is over a menu, this holds the
+# name of the menu; it's cleared when the mouse
+# leaves the menu.
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+# Overall note:
+# This file is tricky because there are four different ways that menus
+# can be used:
+#
+# 1. As a pulldown from a menubutton. This is the most common usage.
+# In this style, the variable tkPriv(postedMb) identifies the posted
+# menubutton.
+# 2. As a torn-off menu copied from some other menu. In this style
+# tkPriv(postedMb) is empty, and the top-level menu is no
+# override-redirect.
+# 3. As an option menu, triggered from an option menubutton. In thi
+# style tkPriv(postedMb) identifies the posted menubutton.
+# 4. As a popup menu. In this style tkPriv(postedMb) is empty and
+# the top-level menu is override-redirect.
+#
+# The various binding procedures use the state described above to
+# distinguish the various cases and take different actions in each
+# case.
+#-------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for menus
+# and menubuttons.
+#-------------------------------------------------------------------------
+
+bind Menubutton <FocusIn> {}
+bind Menubutton <Enter> {
+ tkMbEnter %W
+}
+bind Menubutton <Leave> {
+ tkMbLeave %W
+}
+bind Menubutton <1> {
+ if {$tkPriv(inMenubutton) != ""} {
+ tkMbPost $tkPriv(inMenubutton) %X %Y
+ }
+}
+bind Menubutton <Motion> {
+ tkMbMotion %W up %X %Y
+}
+bind Menubutton <B1-Motion> {
+ tkMbMotion %W down %X %Y
+}
+bind Menubutton <ButtonRelease-1> {
+ tkMbButtonUp %W
+}
+bind Menubutton <space> {
+ tkMbPost %W
+ tkMenuFirstEntry [%W cget -menu]
+}
+bind Menubutton <Return> {
+ tkMbPost %W
+ tkMenuFirstEntry [%W cget -menu]
+}
+
+# Must set focus when mouse enters a menu, in order to allow
+# mixed-mode processing using both the mouse and the keyboard.
+# Don't set the focus if the event comes from a grab release,
+# though: such an event can happen after as part of unposting
+# a cascaded chain of menus, after the focus has already been
+# restored to wherever it was before menu selection started.
+
+bind Menu <FocusIn> {}
+bind Menu <Enter> {
+ set tkPriv(window) %W
+ if {"%m" != "NotifyUngrab"} {
+ focus %W
+ }
+}
+bind Menu <Leave> {
+ tkMenuLeave %W %X %Y %s
+}
+bind Menu <Motion> {
+ tkMenuMotion %W %y %s
+}
+bind Menu <ButtonPress> {
+ tkMenuButtonDown %W
+}
+bind Menu <ButtonRelease> {
+ tkMenuInvoke %W 1
+}
+bind Menu <space> {
+ tkMenuInvoke %W 0
+}
+bind Menu <Return> {
+ tkMenuInvoke %W 0
+}
+bind Menu <Escape> {
+ tkMenuEscape %W
+}
+bind Menu <Left> {
+ tkMenuLeftRight %W left
+}
+bind Menu <Right> {
+ tkMenuLeftRight %W right
+}
+bind Menu <Up> {
+ tkMenuNextEntry %W -1
+}
+bind Menu <Down> {
+ tkMenuNextEntry %W +1
+}
+bind Menu <KeyPress> {
+ tkTraverseWithinMenu %W %A
+}
+
+# The following bindings apply to all windows, and are used to
+# implement keyboard menu traversal.
+
+bind all <Alt-KeyPress> {
+ tkTraverseToMenu %W %A
+}
+bind all <F10> {
+ tkFirstMenu %W
+}
+
+# tkMbEnter --
+# This procedure is invoked when the mouse enters a menubutton
+# widget. It activates the widget unless it is disabled. Note:
+# this procedure is only invoked when mouse button 1 is *not* down.
+# The procedure tkMbB1Enter is invoked if the button is down.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkMbEnter w {
+ global tkPriv
+
+ if {$tkPriv(inMenubutton) != ""} {
+ tkMbLeave $tkPriv(inMenubutton)
+ }
+ set tkPriv(inMenubutton) $w
+ if {[$w cget -state] != "disabled"} {
+ $w configure -state active
+ }
+}
+
+# tkMbLeave --
+# This procedure is invoked when the mouse leaves a menubutton widget.
+# It de-activates the widget, if the widget still exists.
+#
+# Arguments:
+# w - The name of the widget.
+
+proc tkMbLeave w {
+ global tkPriv
+
+ set tkPriv(inMenubutton) {}
+ if ![winfo exists $w] {
+ return
+ }
+ if {[$w cget -state] == "active"} {
+ $w configure -state normal
+ }
+}
+
+# tkMbPost --
+# Given a menubutton, this procedure does all the work of posting
+# its associated menu and unposting any other menu that is currently
+# posted.
+#
+# Arguments:
+# w - The name of the menubutton widget whose menu
+# is to be posted.
+# x, y - Root coordinates of cursor, used for positioning
+# option menus. If not specified, then the center
+# of the menubutton is used for an option menu.
+
+proc tkMbPost {w {x {}} {y {}}} {
+ global tkPriv
+ if {([$w cget -state] == "disabled") || ($w == $tkPriv(postedMb))} {
+ return
+ }
+ set menu [$w cget -menu]
+ if {$menu == ""} {
+ return
+ }
+ if ![string match $w.* $menu] {
+ error "can't post $menu: it isn't a descendant of $w (this is a new requirement in Tk versions 3.0 and later)"
+ }
+ set cur $tkPriv(postedMb)
+ if {$cur != ""} {
+ tkMenuUnpost {}
+ }
+ set tkPriv(cursor) [$w cget -cursor]
+ set tkPriv(relief) [$w cget -relief]
+ $w configure -cursor arrow
+ $w configure -relief raised
+ set tkPriv(postedMb) $w
+ set tkPriv(focus) [focus]
+ $menu activate none
+
+ # If this looks like an option menubutton then post the menu so
+ # that the current entry is on top of the mouse. Otherwise post
+ # the menu just below the menubutton, as for a pull-down.
+
+ if {([$w cget -indicatoron] == 1) && ([$w cget -textvariable] != "")} {
+ if {$y == ""} {
+ set x [expr [winfo rootx $w] + [winfo width $w]/2]
+ set y [expr [winfo rooty $w] + [winfo height $w]/2]
+ }
+ tkPostOverPoint $menu $x $y [tkMenuFindName $menu [$w cget -text]]
+ } else {
+ $menu post [winfo rootx $w] [expr [winfo rooty $w]+[winfo height $w]]
+ }
+ focus $menu
+ tkSaveGrabInfo $w
+ grab -global $w
+}
+
+# tkMenuUnpost --
+# This procedure unposts a given menu, plus all of its ancestors up
+# to (and including) a menubutton, if any. It also restores various
+# values to what they were before the menu was posted, and releases
+# a grab if there's a menubutton involved. Special notes:
+# 1. It's important to unpost all menus before releasing the grab, so
+# that any Enter-Leave events (e.g. from menu back to main
+# application) have mode NotifyGrab.
+# 2. Be sure to enclose various groups of commands in "catch" so that
+# the procedure will complete even if the menubutton or the menu
+# or the grab window has been deleted.
+#
+# Arguments:
+# menu - Name of a menu to unpost. Ignored if there
+# is a posted menubutton.
+
+proc tkMenuUnpost menu {
+ global tkPriv
+ set mb $tkPriv(postedMb)
+
+ # Restore focus right away (otherwise X will take focus away when
+ # the menu is unmapped and under some window managers (e.g. olvwm)
+ # we'll lose the focus completely).
+
+ catch {focus $tkPriv(focus)}
+ set tkPriv(focus) ""
+
+ # Unpost menu(s) and restore some stuff that's dependent on
+ # what was posted.
+
+ catch {
+ if {$mb != ""} {
+ set menu [$mb cget -menu]
+ $menu unpost
+ set tkPriv(postedMb) {}
+ $mb configure -cursor $tkPriv(cursor)
+ $mb configure -relief $tkPriv(relief)
+ } elseif {$tkPriv(popup) != ""} {
+ $tkPriv(popup) unpost
+ set tkPriv(popup) {}
+ } elseif {[wm overrideredirect $menu]} {
+ # We're in a cascaded sub-menu from a torn-off menu or popup.
+ # Unpost all the menus up to the toplevel one (but not
+ # including the top-level torn-off one) and deactivate the
+ # top-level torn off menu if there is one.
+
+ while 1 {
+ set parent [winfo parent $menu]
+ if {([winfo class $parent] != "Menu")
+ || ![winfo ismapped $parent]} {
+ break
+ }
+ $parent activate none
+ $parent postcascade none
+ if {![wm overrideredirect $parent]} {
+ break
+ }
+ set menu $parent
+ }
+ $menu unpost
+ }
+ }
+
+ # Release grab, if any, and restore the previous grab, if there
+ # was one.
+
+ if {$menu != ""} {
+ set grab [grab current $menu]
+ if {$grab != ""} {
+ grab release $grab
+ }
+ }
+ if {$tkPriv(oldGrab) != ""} {
+ if {$tkPriv(grabStatus) == "global"} {
+ grab set -global $tkPriv(oldGrab)
+ } else {
+ grab set $tkPriv(oldGrab)
+ }
+ set tkPriv(oldGrab) ""
+ }
+}
+
+# tkMbMotion --
+# This procedure handles mouse motion events inside menubuttons, and
+# also outside menubuttons when a menubutton has a grab (e.g. when a
+# menu selection operation is in progress).
+#
+# Arguments:
+# w - The name of the menubutton widget.
+# upDown - "down" means button 1 is pressed, "up" means
+# it isn't.
+# rootx, rooty - Coordinates of mouse, in (virtual?) root window.
+
+proc tkMbMotion {w upDown rootx rooty} {
+ global tkPriv
+
+ if {$tkPriv(inMenubutton) == $w} {
+ return
+ }
+ set new [winfo containing $rootx $rooty]
+ if {($new != $tkPriv(inMenubutton)) && (($new == "")
+ || ([winfo toplevel $new] == [winfo toplevel $w]))} {
+ if {$tkPriv(inMenubutton) != ""} {
+ tkMbLeave $tkPriv(inMenubutton)
+ }
+ if {($new != "") && ([winfo class $new] == "Menubutton")
+ && ([$new cget -indicatoron] == 0)} {
+ if {$upDown == "down"} {
+ tkMbPost $new $rootx $rooty
+ } else {
+ tkMbEnter $new
+ }
+ }
+ }
+}
+
+# tkMbButtonUp --
+# This procedure is invoked to handle button 1 releases for menubuttons.
+# If the release happens inside the menubutton then leave its menu
+# posted with element 0 activated. Otherwise, unpost the menu.
+#
+# Arguments:
+# w - The name of the menubutton widget.
+
+proc tkMbButtonUp w {
+ global tkPriv
+
+ if {($tkPriv(postedMb) == $w) && ($tkPriv(inMenubutton) == $w)} {
+ tkMenuFirstEntry [$tkPriv(postedMb) cget -menu]
+ } else {
+ tkMenuUnpost {}
+ }
+}
+
+# tkMenuMotion --
+# This procedure is called to handle mouse motion events for menus.
+# It does two things. First, it resets the active element in the
+# menu, if the mouse is over the menu. Second, if a mouse button
+# is down, it posts and unposts cascade entries to match the mouse
+# position.
+#
+# Arguments:
+# menu - The menu window.
+# y - The y position of the mouse.
+# state - Modifier state (tells whether buttons are down).
+
+proc tkMenuMotion {menu y state} {
+ global tkPriv
+ if {$menu == $tkPriv(window)} {
+ $menu activate @$y
+ }
+ if {($state & 0x1f00) != 0} {
+ $menu postcascade active
+ }
+}
+
+# tkMenuButtonDown --
+# Handles button presses in menus. There are a couple of tricky things
+# here:
+# 1. Change the posted cascade entry (if any) to match the mouse position.
+# 2. If there is a posted menubutton, must grab to the menubutton; this
+# overrrides the implicit grab on button press, so that the menu
+# button can track mouse motions over other menubuttons and change
+# the posted menu.
+# 3. If there's no posted menubutton (e.g. because we're a torn-off menu
+# or one of its descendants) must grab to the top-level menu so that
+# we can track mouse motions across the entire menu hierarchy.
+#
+# Arguments:
+# menu - The menu window.
+
+proc tkMenuButtonDown menu {
+ global tkPriv
+ $menu postcascade active
+ if {$tkPriv(postedMb) != ""} {
+ grab -global $tkPriv(postedMb)
+ } else {
+ while {[wm overrideredirect $menu]
+ && ([winfo class [winfo parent $menu]] == "Menu")
+ && [winfo ismapped [winfo parent $menu]]} {
+ set menu [winfo parent $menu]
+ }
+
+ # Don't update grab information if the grab window isn't changing.
+ # Otherwise, we'll get an error when we unpost the menus and
+ # restore the grab, since the old grab window will not be viewable
+ # anymore.
+
+ if {$menu != [grab current $menu]} {
+ tkSaveGrabInfo $menu
+ }
+
+ # Must re-grab even if the grab window hasn't changed, in order
+ # to release the implicit grab from the button press.
+
+ grab -global $menu
+ }
+}
+
+# tkMenuLeave --
+# This procedure is invoked to handle Leave events for a menu. It
+# deactivates everything unless the active element is a cascade element
+# and the mouse is now over the submenu.
+#
+# Arguments:
+# menu - The menu window.
+# rootx, rooty - Root coordinates of mouse.
+# state - Modifier state.
+
+proc tkMenuLeave {menu rootx rooty state} {
+ global tkPriv
+ set tkPriv(window) {}
+ if {[$menu index active] == "none"} {
+ return
+ }
+ if {([$menu type active] == "cascade")
+ && ([winfo containing $rootx $rooty]
+ == [$menu entrycget active -menu])} {
+ return
+ }
+ $menu activate none
+}
+
+# tkMenuInvoke --
+# This procedure is invoked when button 1 is released over a menu.
+# It invokes the appropriate menu action and unposts the menu if
+# it came from a menubutton.
+#
+# Arguments:
+# w - Name of the menu widget.
+# buttonRelease - 1 means this procedure is called because of
+# a button release; 0 means because of keystroke.
+
+proc tkMenuInvoke {w buttonRelease} {
+ global tkPriv
+
+ if {$buttonRelease && ($tkPriv(window) == "")} {
+ # Mouse was pressed over a menu without a menu button, then
+ # dragged off the menu (possibly with a cascade posted) and
+ # released. Unpost everything and quit.
+
+ $w postcascade none
+ $w activate none
+ tkMenuUnpost $w
+ return
+ }
+ if {[$w type active] == "cascade"} {
+ $w postcascade active
+ set menu [$w entrycget active -menu]
+ tkMenuFirstEntry $menu
+ } elseif {[$w type active] == "tearoff"} {
+ tkMenuUnpost $w
+ tkTearOffMenu $w
+ } else {
+ tkMenuUnpost $w
+ uplevel #0 [list $w invoke active]
+ }
+}
+
+# tkMenuEscape --
+# This procedure is invoked for the Cancel (or Escape) key. It unposts
+# the given menu and, if it is the top-level menu for a menu button,
+# unposts the menu button as well.
+#
+# Arguments:
+# menu - Name of the menu window.
+
+proc tkMenuEscape menu {
+ if {[winfo class [winfo parent $menu]] != "Menu"} {
+ tkMenuUnpost $menu
+ } else {
+ tkMenuLeftRight $menu -1
+ }
+}
+
+# tkMenuLeftRight --
+# This procedure is invoked to handle "left" and "right" traversal
+# motions in menus. It traverses to the next menu in a menu bar,
+# or into or out of a cascaded menu.
+#
+# Arguments:
+# menu - The menu that received the keyboard
+# event.
+# direction - Direction in which to move: "left" or "right"
+
+proc tkMenuLeftRight {menu direction} {
+ global tkPriv
+
+ # First handle traversals into and out of cascaded menus.
+
+ if {$direction == "right"} {
+ set count 1
+ if {[$menu type active] == "cascade"} {
+ $menu postcascade active
+ set m2 [$menu entrycget active -menu]
+ if {$m2 != ""} {
+ tkMenuFirstEntry $m2
+ }
+ return
+ }
+ } else {
+ set count -1
+ set m2 [winfo parent $menu]
+ if {[winfo class $m2] == "Menu"} {
+ $menu activate none
+ focus $m2
+
+ # This code unposts any posted submenu in the parent.
+
+ set tmp [$m2 index active]
+ $m2 activate none
+ $m2 activate $tmp
+ return
+ }
+ }
+
+ # Can't traverse into or out of a cascaded menu. Go to the next
+ # or previous menubutton, if that makes sense.
+
+ set w $tkPriv(postedMb)
+ if {$w == ""} {
+ return
+ }
+ set buttons [winfo children [winfo parent $w]]
+ set length [llength $buttons]
+ set i [expr [lsearch -exact $buttons $w] + $count]
+ while 1 {
+ while {$i < 0} {
+ incr i $length
+ }
+ while {$i >= $length} {
+ incr i -$length
+ }
+ set mb [lindex $buttons $i]
+ if {([winfo class $mb] == "Menubutton")
+ && ([$mb cget -state] != "disabled")
+ && ([$mb cget -menu] != "")
+ && ([[$mb cget -menu] index last] != "none")} {
+ break
+ }
+ if {$mb == $w} {
+ return
+ }
+ incr i $count
+ }
+ tkMbPost $mb
+ tkMenuFirstEntry [$mb cget -menu]
+}
+
+# tkMenuNextEntry --
+# Activate the next higher or lower entry in the posted menu,
+# wrapping around at the ends. Disabled entries are skipped.
+#
+# Arguments:
+# menu - Menu window that received the keystroke.
+# count - 1 means go to the next lower entry,
+# -1 means go to the next higher entry.
+
+proc tkMenuNextEntry {menu count} {
+ global tkPriv
+ if {[$menu index last] == "none"} {
+ return
+ }
+ set length [expr [$menu index last]+1]
+ set quitAfter $length
+ set active [$menu index active]
+ if {$active == "none"} {
+ set i 0
+ } else {
+ set i [expr $active + $count]
+ }
+ while 1 {
+ if {$quitAfter <= 0} {
+ # We've tried every entry in the menu. Either there are
+ # none, or they're all disabled. Just give up.
+
+ return
+ }
+ while {$i < 0} {
+ incr i $length
+ }
+ while {$i >= $length} {
+ incr i -$length
+ }
+ if {[catch {$menu entrycget $i -state} state] == 0} {
+ if {$state != "disabled"} {
+ break
+ }
+ }
+ if {$i == $active} {
+ return
+ }
+ incr i $count
+ incr quitAfter -1
+ }
+ $menu activate $i
+ $menu postcascade $i
+}
+
+# tkMenuFind --
+# This procedure searches the entire window hierarchy under w for
+# a menubutton that isn't disabled and whose underlined character
+# is "char". It returns the name of that window, if found, or an
+# empty string if no matching window was found. If "char" is an
+# empty string then the procedure returns the name of the first
+# menubutton found that isn't disabled.
+#
+# Arguments:
+# w - Name of window where key was typed.
+# char - Underlined character to search for;
+# may be either upper or lower case, and
+# will match either upper or lower case.
+
+proc tkMenuFind {w char} {
+ global tkPriv
+ set char [string tolower $char]
+
+ foreach child [winfo child $w] {
+ switch [winfo class $child] {
+ Menubutton {
+ set char2 [string index [$child cget -text] \
+ [$child cget -underline]]
+ if {([string compare $char [string tolower $char2]] == 0)
+ || ($char == "")} {
+ if {[$child cget -state] != "disabled"} {
+ return $child
+ }
+ }
+ }
+ Frame {
+ set match [tkMenuFind $child $char]
+ if {$match != ""} {
+ return $match
+ }
+ }
+ }
+ }
+ return {}
+}
+
+# tkTraverseToMenu --
+# This procedure implements keyboard traversal of menus. Given an
+# ASCII character "char", it looks for a menubutton with that character
+# underlined. If one is found, it posts the menubutton's menu
+#
+# Arguments:
+# w - Window in which the key was typed (selects
+# a toplevel window).
+# char - Character that selects a menu. The case
+# is ignored. If an empty string, nothing
+# happens.
+
+proc tkTraverseToMenu {w char} {
+ if {$char == ""} {
+ return
+ }
+ while {[winfo class $w] == "Menu"} {
+ set w [winfo parent $w]
+ }
+ set w [tkMenuFind [winfo toplevel $w] $char]
+ if {$w != ""} {
+ tkMbPost $w
+ tkMenuFirstEntry [$w cget -menu]
+ }
+}
+
+# tkFirstMenu --
+# This procedure traverses to the first menubutton in the toplevel
+# for a given window, and posts that menubutton's menu.
+#
+# Arguments:
+# w - Name of a window. Selects which toplevel
+# to search for menubuttons.
+
+proc tkFirstMenu w {
+ set w [tkMenuFind [winfo toplevel $w] ""]
+ if {$w != ""} {
+ tkMbPost $w
+ tkMenuFirstEntry [$w cget -menu]
+ }
+}
+
+# tkTraverseWithinMenu
+# This procedure implements keyboard traversal within a menu. It
+# searches for an entry in the menu that has "char" underlined. If
+# such an entry is found, it is invoked and the menu is unposted.
+#
+# Arguments:
+# w - The name of the menu widget.
+# char - The character to look for; case is
+# ignored. If the string is empty then
+# nothing happens.
+
+proc tkTraverseWithinMenu {w char} {
+ if {$char == ""} {
+ return
+ }
+ set char [string tolower $char]
+ set last [$w index last]
+ if {$last == "none"} {
+ return
+ }
+ for {set i 0} {$i <= $last} {incr i} {
+ if [catch {set char2 [string index \
+ [$w entrycget $i -label] \
+ [$w entrycget $i -underline]]}] {
+ continue
+ }
+ if {[string compare $char [string tolower $char2]] == 0} {
+ if {[$w type $i] == "cascade"} {
+ $w postcascade $i
+ $w activate $i
+ set m2 [$w entrycget $i -menu]
+ if {$m2 != ""} {
+ tkMenuFirstEntry $m2
+ }
+ } else {
+ tkMenuUnpost $w
+ uplevel #0 [list $w invoke $i]
+ }
+ return
+ }
+ }
+}
+
+# tkMenuFirstEntry --
+# Given a menu, this procedure finds the first entry that isn't
+# disabled or a tear-off or separator, and activates that entry.
+# However, if there is already an active entry in the menu (e.g.,
+# because of a previous call to tkPostOverPoint) then the active
+# entry isn't changed. This procedure also sets the input focus
+# to the menu.
+#
+# Arguments:
+# menu - Name of the menu window (possibly empty).
+
+proc tkMenuFirstEntry menu {
+ if {$menu == ""} {
+ return
+ }
+ focus $menu
+ if {[$menu index active] != "none"} {
+ return
+ }
+ set last [$menu index last]
+ if {$last == "none"} {
+ return
+ }
+ for {set i 0} {$i <= $last} {incr i} {
+ if {([catch {set state [$menu entrycget $i -state]}] == 0)
+ && ($state != "disabled") && ([$menu type $i] != "tearoff")} {
+ $menu activate $i
+ return
+ }
+ }
+}
+
+# tkMenuFindName --
+# Given a menu and a text string, return the index of the menu entry
+# that displays the string as its label. If there is no such entry,
+# return an empty string. This procedure is tricky because some names
+# like "active" have a special meaning in menu commands, so we can't
+# always use the "index" widget command.
+#
+# Arguments:
+# menu - Name of the menu widget.
+# s - String to look for.
+
+proc tkMenuFindName {menu s} {
+ set i ""
+ if {![regexp {^active$|^last$|^none$|^[0-9]|^@} $s]} {
+ catch {set i [$menu index $s]}
+ return $i
+ }
+ set last [$menu index last]
+ if {$last == "none"} {
+ return
+ }
+ for {set i 0} {$i <= $last} {incr i} {
+ if ![catch {$menu entrycget $i -label} label] {
+ if {$label == $s} {
+ return $i
+ }
+ }
+ }
+ return ""
+}
+
+# tkPostOverPoint --
+# This procedure posts a given menu such that a given entry in the
+# menu is centered over a given point in the root window. It also
+# activates the given entry.
+#
+# Arguments:
+# menu - Menu to post.
+# x, y - Root coordinates of point.
+# entry - Index of entry within menu to center over (x,y).
+# If omitted or specified as {}, then the menu's
+# upper-left corner goes at (x,y).
+
+proc tkPostOverPoint {menu x y {entry {}}} {
+ if {$entry != {}} {
+ if {$entry == [$menu index last]} {
+ incr y [expr -([$menu yposition $entry] \
+ + [winfo reqheight $menu])/2]
+ } else {
+ incr y [expr -([$menu yposition $entry] \
+ + [$menu yposition [expr $entry+1]])/2]
+ }
+ incr x [expr -[winfo reqwidth $menu]/2]
+ }
+ $menu post $x $y
+ if {($entry != {}) && ([$menu entrycget $entry -state] != "disabled")} {
+ $menu activate $entry
+ }
+}
+
+# tkSaveGrabInfo --
+# Sets the variables tkPriv(oldGrab) and tkPriv(grabStatus) to record
+# the state of any existing grab on the w's display.
+#
+# Arguments:
+# w - Name of a window; used to select the display
+# whose grab information is to be recorded.
+
+proc tkSaveGrabInfo w {
+ global tkPriv
+ set tkPriv(oldGrab) [grab current $w]
+ if {$tkPriv(oldGrab) != ""} {
+ set tkPriv(grabStatus) [grab status $tkPriv(oldGrab)]
+ }
+}
+
+# tk_popup --
+# This procedure pops up a menu and sets things up for traversing
+# the menu and its submenus.
+#
+# Arguments:
+# menu - Name of the menu to be popped up.
+# x, y - Root coordinates at which to pop up the
+# menu.
+# entry - Index of a menu entry to center over (x,y).
+# If omitted or specified as {}, then menu's
+# upper-left corner goes at (x,y).
+
+proc tk_popup {menu x y {entry {}}} {
+ global tkPriv
+ if {($tkPriv(popup) != "") || ($tkPriv(postedMb) != "")} {
+ tkMenuUnpost {}
+ }
+ tkPostOverPoint $menu $x $y $entry
+ tkSaveGrabInfo $menu
+ grab -global $menu
+ set tkPriv(popup) $menu
+ set tkPriv(focus) [focus]
+ focus $menu
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/misc.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/misc.tcl
new file mode 100644
index 000000000..17eba6f55
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/misc.tcl
@@ -0,0 +1,144 @@
+# $XConsortium: misc.tcl /main/1 1996/09/21 14:15:06 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/misc.tcl,v 3.4 1996/12/27 06:55:01 dawes Exp $
+#
+# Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+#
+# See the file "LICENSE" for information regarding redistribution terms,
+# and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#
+# Misc routines that could be useful outside XF86Setup
+#
+
+# remove all whitespace from the string
+
+proc zap_white { str } {
+ regsub -all "\[ \t\n\]+" $str {} str
+ return $str
+}
+
+
+# replace all sequences of whitespace with a single space
+
+proc squash_white { str } {
+ regsub -all "\[ \t\n\]+" $str { } str
+ return $str
+}
+
+
+# implement do { ... } while loop
+
+proc do { commands while expression } {
+ uplevel $commands
+ while { [uplevel [list expr $expression]] } {
+ uplevel $commands
+ }
+}
+
+
+# break a long line into shorter lines
+
+proc parafmt { llen string } {
+ set string [string trim [squash_white $string]]
+ set retval ""
+ while { [string length $string] > $llen } {
+ set tmp [string range $string 0 $llen]
+ #puts stderr "'$string'$tmp'$retval'"
+ set pos [string last " " $tmp]
+ if { $pos == -1 } {
+ append retval [string range $string 0 [expr $llen-1]]\n
+ set string [string range $string $llen end]
+ continue
+ }
+ if { $pos == 0 } {
+ append retval [string range $string 1 [expr $llen]]\n
+ set string [string range $string $llen end]
+ continue
+ }
+ if { $pos == $llen-1 } {
+ append retval [string range $string 0 [expr $llen-2]]\n
+ set string [string range $string $llen end]
+ continue
+ }
+ append retval [string range $tmp 0 [expr $pos-1]]\n
+ set string [string range $string [expr $pos+1] end]
+ }
+ #return [string trimright $retval \n]\n$string
+ return $retval$string
+}
+
+
+# convert the window name to a form that can be used as a prefix to
+# to the window names of child windows
+# - basically, avoid double dot
+
+proc winpathprefix { w } {
+ if ![string compare . $w] { return "" }
+ return $w
+}
+
+
+# return a (sorted) list with duplicate elements removed
+# uses the same syntax as lsort
+
+proc lrmdups { args } {
+ set inlist [eval lsort $args]
+ set retlist ""
+ set lastelem "nomatch[lindex $inlist 0]"
+ foreach elem $inlist {
+ if [string compare $lastelem $elem] {
+ lappend retlist $elem
+ set lastelem $elem
+ }
+ }
+ return $retlist
+}
+
+
+# return the name of the file to which the given symlink points
+# if the name is a relative path, convert it to a full path
+# (assumes the symlink is given as a full path)
+
+proc readlink { linkname } {
+ set fname [file readlink $linkname]
+ if { ![string length $fname]
+ || ![string compare [string index $fname 0] /] } {
+ return $fname
+ }
+ set path [file dirname $linkname]/$fname
+ regsub -all {/\./} $path / path
+ return $path
+}
+
+
+#simple random number generator
+
+proc random {args} {
+ global RNG_seed
+
+ set max 259200
+ set argcnt [llength $args]
+ if { $argcnt < 1 || $argcnt > 2 } {
+ error "wrong # args: random limit | seed ?seedval?"
+ }
+ if ![string compare [lindex $args 0] seed] {
+ if { $argcnt == 2 } {
+ set RNG_seed [expr [lindex $args 1]%$max]
+ } else {
+ set RNG_seed [expr \
+ ([pid]+[clock clicks])%$max]
+ }
+ return
+ }
+ if ![info exists RNG_seed] {
+ set RNG_seed [expr ([pid]+[clock clicks])%$max]
+ }
+ set RNG_seed [expr ($RNG_seed*7141+54773) % $max]
+ return [expr int(double($RNG_seed)*[lindex $args 0]/$max)]
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/narrower.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/narrower.xbm
new file mode 100644
index 000000000..7a4980315
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/narrower.xbm
@@ -0,0 +1,11 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/narrower.xbm,v 1.1 1999/04/05 07:13:04 dawes Exp $ */
+#define narrower_width 24
+#define narrower_height 24
+static unsigned char narrower_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0xff, 0x03, 0x40, 0x00, 0x02, 0x40, 0x00, 0x02,
+ 0x40, 0x00, 0x02, 0x48, 0x00, 0x12, 0x50, 0x00, 0x0a, 0x7e, 0x00, 0x7e,
+ 0x50, 0x00, 0x0a, 0x48, 0x00, 0x12, 0x40, 0x00, 0x02, 0x40, 0x00, 0x02,
+ 0x40, 0x00, 0x02, 0xc0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/optionMenu.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/optionMenu.tcl
new file mode 100644
index 000000000..1411d02a9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/optionMenu.tcl
@@ -0,0 +1,53 @@
+# $XConsortium: optionMenu.tcl /main/1 1996/09/21 14:15:53 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/optionMenu.tcl,v 3.1 1996/12/27 06:55:02 dawes Exp $
+#
+# optionMenu.tcl --
+#
+# This file defines the procedure tk_optionMenu, which creates
+# an option button and its associated menu.
+#
+# @(#) optionMenu.tcl 1.6 95/01/06 11:18:53
+#
+# Copyright (c) 1994 The Regents of the University of California.
+# Copyright (c) 1994 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# tk_optionMenu --
+# This procedure creates an option button named $w and an associated
+# menu. Together they provide the functionality of Motif option menus:
+# they can be used to select one of many values, and the current value
+# appears in the global variable varName, as well as in the text of
+# the option menubutton. The name of the menu is returned as the
+# procedure's result, so that the caller can use it to change configuration
+# options on the menu or otherwise manipulate it.
+#
+# Arguments:
+# w - The name to use for the menubutton.
+# varName - Global variable to hold the currently selected value.
+# firstValue - First of legal values for option (must be >= 1).
+# args - Any number of additional values.
+
+proc tk_optionMenu {w varName firstValue args} {
+ upvar #0 $varName var
+
+ if ![info exists var] {
+ set var $firstValue
+ }
+ menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \
+ -relief raised -bd 2 -padx 4p -pady 4p -highlightthickness 2 \
+ -anchor c
+ menu $w.menu -tearoff 0
+ $w.menu add command -label $firstValue \
+ -command [list set $varName $firstValue]
+ foreach i $args {
+ $w.menu add command -label $i -command [list set $varName $i]
+ }
+ return $w.menu
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/palette.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/palette.tcl
new file mode 100644
index 000000000..0cd0f3694
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/palette.tcl
@@ -0,0 +1,227 @@
+# $XConsortium: palette.tcl /main/1 1996/09/21 14:16:00 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/palette.tcl,v 3.1 1996/12/27 06:55:03 dawes Exp $
+#
+# palette.tcl --
+#
+# This file contains procedures that change the color palette used
+# by Tk.
+#
+# @(#) palette.tcl 1.1 95/05/22 14:55:29
+#
+# Copyright (c) 1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# tk_setPalette --
+# Changes the default color scheme for a Tk application by setting
+# default colors in the option database and by modifying all of the
+# color options for existing widgets that have the default value.
+#
+# Arguments:
+# The arguments consist of either a single color name, which
+# will be used as the new background color (all other colors will
+# be computed from this) or an even number of values consisting of
+# option names and values. The name for an option is the one used
+# for the option database, such as activeForeground, not -activeforeground.
+
+proc tk_setPalette args {
+ global tkPalette
+
+ # Create an array that has the complete new palette. If some colors
+ # aren't specified, compute them from other colors that are specified.
+
+ if {[llength $args] == 1} {
+ set new(background) [lindex $args 0]
+ } else {
+ array set new $args
+ }
+ if ![info exists new(background)] {
+ error "must specify a background color"
+ }
+ if ![info exists new(foreground)] {
+ set new(foreground) black
+ }
+ set bg [winfo rgb . $new(background)]
+ set fg [winfo rgb . $new(foreground)]
+ set darkerBg [format #%02x%02x%02x [expr (9*[lindex $bg 0])/2560] \
+ [expr (9*[lindex $bg 1])/2560] [expr (9*[lindex $bg 2])/2560]]
+ foreach i {activeForeground insertBackground selectForeground \
+ highlightColor} {
+ if ![info exists new($i)] {
+ set new($i) $new(foreground)
+ }
+ }
+ if ![info exists new(disabledForeground)] {
+ set new(disabledForeground) [format #%02x%02x%02x \
+ [expr (3*[lindex $bg 0] + [lindex $fg 0])/1024] \
+ [expr (3*[lindex $bg 1] + [lindex $fg 1])/1024] \
+ [expr (3*[lindex $bg 2] + [lindex $fg 2])/1024]]
+ }
+ if ![info exists new(highlightBackground)] {
+ set new(highlightBackground) $new(background)
+ }
+ if ![info exists new(activeBackground)] {
+ # Pick a default active background that islighter than the
+ # normal background. To do this, round each color component
+ # up by 15% or 1/3 of the way to full white, whichever is
+ # greater.
+
+ foreach i {0 1 2} {
+ set light($i) [expr [lindex $bg $i]/256]
+ set inc1 [expr ($light($i)*15)/100]
+ set inc2 [expr (255-$light($i))/3]
+ if {$inc1 > $inc2} {
+ incr light($i) $inc1
+ } else {
+ incr light($i) $inc2
+ }
+ if {$light($i) > 255} {
+ set light($i) 255
+ }
+ }
+ set new(activeBackground) [format #%02x%02x%02x $light(0) \
+ $light(1) $light(2)]
+ }
+ if ![info exists new(selectBackground)] {
+ set new(selectBackground) $darkerBg
+ }
+ if ![info exists new(troughColor)] {
+ set new(troughColor) $darkerBg
+ }
+ if ![info exists new(selectColor)] {
+ set new(selectColor) #b03060
+ }
+
+ # Walk the widget hierarchy, recoloring all existing windows.
+ # Before doing this, make sure that the tkPalette variable holds
+ # the default values of all options, so that tkRecolorTree can
+ # be sure to only change options that have their default values.
+ # If the variable exists, then it is already correct (it was created
+ # the last time this procedure was invoked). If the variable
+ # doesn't exist, fill it in using the defaults from a few widgets.
+
+ if ![info exists tkPalette] {
+ checkbutton .c14732
+ entry .e14732
+ scrollbar .s14732
+ set tkPalette(activeBackground) \
+ [lindex [.c14732 configure -activebackground] 3]
+ set tkPalette(activeForeground) \
+ [lindex [.c14732 configure -activeforeground] 3]
+ set tkPalette(background) \
+ [lindex [.c14732 configure -background] 3]
+ set tkPalette(disabledForeground) \
+ [lindex [.c14732 configure -disabledforeground] 3]
+ set tkPalette(foreground) \
+ [lindex [.c14732 configure -foreground] 3]
+ set tkPalette(highlightBackground) \
+ [lindex [.c14732 configure -highlightbackground] 3]
+ set tkPalette(highlightColor) \
+ [lindex [.c14732 configure -highlightcolor] 3]
+ set tkPalette(insertBackground) \
+ [lindex [.e14732 configure -insertbackground] 3]
+ set tkPalette(selectColor) \
+ [lindex [.c14732 configure -selectcolor] 3]
+ set tkPalette(selectBackground) \
+ [lindex [.e14732 configure -selectbackground] 3]
+ set tkPalette(selectForeground) \
+ [lindex [.e14732 configure -selectforeground] 3]
+ set tkPalette(troughColor) \
+ [lindex [.s14732 configure -troughcolor] 3]
+ destroy .c14732 .e14732 .s14732
+ }
+ tkRecolorTree . new
+
+ # Change the option database so that future windows will get the
+ # same colors.
+
+ foreach option [array names new] {
+ option add *$option $new($option) widgetDefault
+ }
+
+ # Save the options in the global variable tkPalette, for use the
+ # next time we change the options.
+
+ array set tkPalette [array get new]
+}
+
+# tkRecolorTree --
+# This procedure changes the colors in a window and all of its
+# descendants, according to information provided by the colors
+# argument. It only modifies colors that have their default values
+# as specified by the tkPalette variable.
+#
+# Arguments:
+# w - The name of a window. This window and all its
+# descendants are recolored.
+# colors - The name of an array variable in the caller,
+# which contains color information. Each element
+# is named after a widget configuration option, and
+# each value is the value for that option.
+
+proc tkRecolorTree {w colors} {
+ global tkPalette
+ upvar $colors c
+ foreach dbOption [array names c] {
+ set option -[string tolower $dbOption]
+ if ![catch {$w cget $option} value] {
+ if {$value == $tkPalette($dbOption)} {
+ $w configure $option $c($dbOption)
+ }
+ }
+ }
+ foreach child [winfo children $w] {
+ tkRecolorTree $child c
+ }
+}
+
+# tkDarken --
+# Given a color name, computes a new color value that darkens (or
+# brightens) the given color by a given percent.
+#
+# Arguments:
+# color - Name of starting color.
+# perecent - Integer telling how much to brighten or darken as a
+# percent: 50 means darken by 50%, 110 means brighten
+# by 10%.
+
+proc tkDarken {color percent} {
+ set l [winfo rgb . $color]
+ set red [expr [lindex $l 0]/256]
+ set green [expr [lindex $l 1]/256]
+ set blue [expr [lindex $l 2]/256]
+ set red [expr ($red*$percent)/100]
+ if {$red > 255} {
+ set red 255
+ }
+ set green [expr ($green*$percent)/100]
+ if {$green > 255} {
+ set green 255
+ }
+ set blue [expr ($blue*$percent)/100]
+ if {$blue > 255} {
+ set blue 255
+ }
+ format #%02x%02x%02x $red $green $blue
+}
+
+# tk_bisque --
+# Reset the Tk color palette to the old "bisque" colors.
+#
+# Arguments:
+# None.
+
+proc tk_bisque {} {
+ tk_setPalette activeBackground #e6ceb1 activeForeground black \
+ background #ffe4c4 disabledForeground #b0b0b0 foreground black \
+ highlightBackground #ffe4c4 highlightColor black \
+ insertBackground black selectColor #b03060 \
+ selectBackground #e6ceb1 selectForeground black \
+ troughColor #cdb79e
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/prolog.ps b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/prolog.ps
new file mode 100644
index 000000000..409e06a65
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/prolog.ps
@@ -0,0 +1,284 @@
+%%BeginProlog
+50 dict begin
+
+% This is a standard prolog for Postscript generated by Tk's canvas
+% widget.
+% SCCS: @(#) prolog.ps 1.5 96/02/17 17:45:11
+
+% The definitions below just define all of the variables used in
+% any of the procedures here. This is needed for obscure reasons
+% explained on p. 716 of the Postscript manual (Section H.2.7,
+% "Initializing Variables," in the section on Encapsulated Postscript).
+
+/baseline 0 def
+/stipimage 0 def
+/height 0 def
+/justify 0 def
+/lineLength 0 def
+/spacing 0 def
+/stipple 0 def
+/strings 0 def
+/xoffset 0 def
+/yoffset 0 def
+/tmpstip null def
+
+% Define the array ISOLatin1Encoding (which specifies how characters are
+% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript
+% level 2 is supposed to define it, but level 1 doesn't).
+
+systemdict /ISOLatin1Encoding known not {
+ /ISOLatin1Encoding [
+ /space /space /space /space /space /space /space /space
+ /space /space /space /space /space /space /space /space
+ /space /space /space /space /space /space /space /space
+ /space /space /space /space /space /space /space /space
+ /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
+ /quoteright
+ /parenleft /parenright /asterisk /plus /comma /minus /period /slash
+ /zero /one /two /three /four /five /six /seven
+ /eight /nine /colon /semicolon /less /equal /greater /question
+ /at /A /B /C /D /E /F /G
+ /H /I /J /K /L /M /N /O
+ /P /Q /R /S /T /U /V /W
+ /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
+ /quoteleft /a /b /c /d /e /f /g
+ /h /i /j /k /l /m /n /o
+ /p /q /r /s /t /u /v /w
+ /x /y /z /braceleft /bar /braceright /asciitilde /space
+ /space /space /space /space /space /space /space /space
+ /space /space /space /space /space /space /space /space
+ /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
+ /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron
+ /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
+ /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
+ /registered /macron
+ /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph
+ /periodcentered
+ /cedillar /onesuperior /ordmasculine /guillemotright /onequarter
+ /onehalf /threequarters /questiondown
+ /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
+ /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex
+ /Idieresis
+ /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
+ /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
+ /germandbls
+ /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
+ /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
+ /idieresis
+ /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
+ /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn
+ /ydieresis
+ ] def
+} if
+
+% font ISOEncode font
+% This procedure changes the encoding of a font from the default
+% Postscript encoding to ISOLatin1. It's typically invoked just
+% before invoking "setfont". The body of this procedure comes from
+% Section 5.6.1 of the Postscript book.
+
+/ISOEncode {
+ dup length dict begin
+ {1 index /FID ne {def} {pop pop} ifelse} forall
+ /Encoding ISOLatin1Encoding def
+ currentdict
+ end
+
+ % I'm not sure why it's necessary to use "definefont" on this new
+ % font, but it seems to be important; just use the name "Temporary"
+ % for the font.
+
+ /Temporary exch definefont
+} bind def
+
+% StrokeClip
+%
+% This procedure converts the current path into a clip area under
+% the assumption of stroking. It's a bit tricky because some Postscript
+% interpreters get errors during strokepath for dashed lines. If
+% this happens then turn off dashes and try again.
+
+/StrokeClip {
+ {strokepath} stopped {
+ (This Postscript printer gets limitcheck overflows when) =
+ (stippling dashed lines; lines will be printed solid instead.) =
+ [] 0 setdash strokepath} if
+ clip
+} bind def
+
+% desiredSize EvenPixels closestSize
+%
+% The procedure below is used for stippling. Given the optimal size
+% of a dot in a stipple pattern in the current user coordinate system,
+% compute the closest size that is an exact multiple of the device's
+% pixel size. This allows stipple patterns to be displayed without
+% aliasing effects.
+
+/EvenPixels {
+ % Compute exact number of device pixels per stipple dot.
+ dup 0 matrix currentmatrix dtransform
+ dup mul exch dup mul add sqrt
+
+ % Round to an integer, make sure the number is at least 1, and compute
+ % user coord distance corresponding to this.
+ dup round dup 1 lt {pop 1} if
+ exch div mul
+} bind def
+
+% width height string StippleFill --
+%
+% Given a path already set up and a clipping region generated from
+% it, this procedure will fill the clipping region with a stipple
+% pattern. "String" contains a proper image description of the
+% stipple pattern and "width" and "height" give its dimensions. Each
+% stipple dot is assumed to be about one unit across in the current
+% user coordinate system. This procedure trashes the graphics state.
+
+/StippleFill {
+ % The following code is needed to work around a NeWSprint bug.
+
+ /tmpstip 1 index def
+
+ % Change the scaling so that one user unit in user coordinates
+ % corresponds to the size of one stipple dot.
+ 1 EvenPixels dup scale
+
+ % Compute the bounding box occupied by the path (which is now
+ % the clipping region), and round the lower coordinates down
+ % to the nearest starting point for the stipple pattern. Be
+ % careful about negative numbers, since the rounding works
+ % differently on them.
+
+ pathbbox
+ 4 2 roll
+ 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
+ 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
+
+ % Stack now: width height string y1 y2 x1 x2
+ % Below is a doubly-nested for loop to iterate across this area
+ % in units of the stipple pattern size, going up columns then
+ % across rows, blasting out a stipple-pattern-sized rectangle at
+ % each position
+
+ 6 index exch {
+ 2 index 5 index 3 index {
+ % Stack now: width height string y1 y2 x y
+
+ gsave
+ 1 index exch translate
+ 5 index 5 index true matrix tmpstip imagemask
+ grestore
+ } for
+ pop
+ } for
+ pop pop pop pop pop
+} bind def
+
+% -- AdjustColor --
+% Given a color value already set for output by the caller, adjusts
+% that value to a grayscale or mono value if requested by the CL
+% variable.
+
+/AdjustColor {
+ CL 2 lt {
+ currentgray
+ CL 0 eq {
+ .5 lt {0} {1} ifelse
+ } if
+ setgray
+ } if
+} bind def
+
+% x y strings spacing xoffset yoffset justify stipple DrawText --
+% This procedure does all of the real work of drawing text. The
+% color and font must already have been set by the caller, and the
+% following arguments must be on the stack:
+%
+% x, y - Coordinates at which to draw text.
+% strings - An array of strings, one for each line of the text item,
+% in order from top to bottom.
+% spacing - Spacing between lines.
+% xoffset - Horizontal offset for text bbox relative to x and y: 0 for
+% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
+% yoffset - Vertical offset for text bbox relative to x and y: 0 for
+% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
+% justify - 0 for left justification, 0.5 for center, 1 for right justify.
+% stipple - Boolean value indicating whether or not text is to be
+% drawn in stippled fashion. If text is stippled,
+% procedure StippleText must have been defined to call
+% StippleFill in the right way.
+%
+% Also, when this procedure is invoked, the color and font must already
+% have been set for the text.
+
+/DrawText {
+ /stipple exch def
+ /justify exch def
+ /yoffset exch def
+ /xoffset exch def
+ /spacing exch def
+ /strings exch def
+
+ % First scan through all of the text to find the widest line.
+
+ /lineLength 0 def
+ strings {
+ stringwidth pop
+ dup lineLength gt {/lineLength exch def} {pop} ifelse
+ newpath
+ } forall
+
+ % Compute the baseline offset and the actual font height.
+
+ 0 0 moveto (TXygqPZ) false charpath
+ pathbbox dup /baseline exch def
+ exch pop exch sub /height exch def pop
+ newpath
+
+ % Translate coordinates first so that the origin is at the upper-left
+ % corner of the text's bounding box. Remember that x and y for
+ % positioning are still on the stack.
+
+ translate
+ lineLength xoffset mul
+ strings length 1 sub spacing mul height add yoffset mul translate
+
+ % Now use the baseline and justification information to translate so
+ % that the origin is at the baseline and positioning point for the
+ % first line of text.
+
+ justify lineLength mul baseline neg translate
+
+ % Iterate over each of the lines to output it. For each line,
+ % compute its width again so it can be properly justified, then
+ % display it.
+
+ strings {
+ dup stringwidth pop
+ justify neg mul 0 moveto
+ stipple {
+
+ % The text is stippled, so turn it into a path and print
+ % by calling StippledText, which in turn calls StippleFill.
+ % Unfortunately, many Postscript interpreters will get
+ % overflow errors if we try to do the whole string at
+ % once, so do it a character at a time.
+
+ gsave
+ /char (X) def
+ {
+ char 0 3 -1 roll put
+ currentpoint
+ gsave
+ char true charpath clip StippleText
+ grestore
+ char stringwidth translate
+ moveto
+ } forall
+ grestore
+ } {show} ifelse
+ 0 spacing neg translate
+ } forall
+} bind def
+
+%%EndProlog
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scale.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scale.tcl
new file mode 100644
index 000000000..e68f39b84
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scale.tcl
@@ -0,0 +1,269 @@
+# $XConsortium: scale.tcl /main/1 1996/09/21 14:16:04 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scale.tcl,v 3.1 1996/12/27 06:55:04 dawes Exp $
+#
+# scale.tcl --
+#
+# This file defines the default bindings for Tk scale widgets and provides
+# procedures that help in implementing the bindings.
+#
+# @(#) scale.tcl 1.9 95/08/30 09:46:57
+#
+# Copyright (c) 1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for entries.
+#-------------------------------------------------------------------------
+
+# Standard Motif bindings:
+
+bind Scale <Enter> {
+ if $tk_strictMotif {
+ set tkPriv(activeBg) [%W cget -activebackground]
+ %W config -activebackground [%W cget -background]
+ }
+ tkScaleActivate %W %x %y
+}
+bind Scale <Motion> {
+ tkScaleActivate %W %x %y
+}
+bind Scale <Leave> {
+ if $tk_strictMotif {
+ %W config -activebackground $tkPriv(activeBg)
+ }
+ if {[%W cget -state] == "active"} {
+ %W configure -state normal
+ }
+}
+bind Scale <1> {
+ tkScaleButtonDown %W %x %y
+}
+bind Scale <B1-Motion> {
+ tkScaleDrag %W %x %y
+}
+bind Scale <B1-Leave> { }
+bind Scale <B1-Enter> { }
+bind Scale <ButtonRelease-1> {
+ tkCancelRepeat
+ tkScaleEndDrag %W
+ tkScaleActivate %W %x %y
+}
+bind Scale <2> {
+ tkScaleButton2Down %W %x %y
+}
+bind Scale <B2-Motion> {
+ tkScaleDrag %W %x %y
+}
+bind Scale <B2-Leave> { }
+bind Scale <B2-Enter> { }
+bind Scale <ButtonRelease-2> {
+ tkCancelRepeat
+ tkScaleEndDrag %W
+ tkScaleActivate %W %x %y
+}
+bind Scale <Control-1> {
+ tkScaleControlPress %W %x %y
+}
+bind Scale <Up> {
+ tkScaleIncrement %W up little noRepeat
+}
+bind Scale <Down> {
+ tkScaleIncrement %W down little noRepeat
+}
+bind Scale <Left> {
+ tkScaleIncrement %W up little noRepeat
+}
+bind Scale <Right> {
+ tkScaleIncrement %W down little noRepeat
+}
+bind Scale <Control-Up> {
+ tkScaleIncrement %W up big noRepeat
+}
+bind Scale <Control-Down> {
+ tkScaleIncrement %W down big noRepeat
+}
+bind Scale <Control-Left> {
+ tkScaleIncrement %W up big noRepeat
+}
+bind Scale <Control-Right> {
+ tkScaleIncrement %W down big noRepeat
+}
+bind Scale <Home> {
+ %W set [%W cget -from]
+}
+bind Scale <End> {
+ %W set [%W cget -to]
+}
+
+# tkScaleActivate --
+# This procedure is invoked to check a given x-y position in the
+# scale and activate the slider if the x-y position falls within
+# the slider.
+#
+# Arguments:
+# w - The scale widget.
+# x, y - Mouse coordinates.
+
+proc tkScaleActivate {w x y} {
+ global tkPriv
+ if {[$w cget -state] == "disabled"} {
+ return;
+ }
+ if {[$w identify $x $y] == "slider"} {
+ $w configure -state active
+ } else {
+ $w configure -state normal
+ }
+}
+
+# tkScaleButtonDown --
+# This procedure is invoked when a button is pressed in a scale. It
+# takes different actions depending on where the button was pressed.
+#
+# Arguments:
+# w - The scale widget.
+# x, y - Mouse coordinates of button press.
+
+proc tkScaleButtonDown {w x y} {
+ global tkPriv
+ set tkPriv(dragging) 0
+ set el [$w identify $x $y]
+ if {$el == "trough1"} {
+ tkScaleIncrement $w up little initial
+ } elseif {$el == "trough2"} {
+ tkScaleIncrement $w down little initial
+ } elseif {$el == "slider"} {
+ set tkPriv(dragging) 1
+ set tkPriv(initValue) [$w get]
+ set coords [$w coords]
+ set tkPriv(deltaX) [expr $x - [lindex $coords 0]]
+ set tkPriv(deltaY) [expr $y - [lindex $coords 1]]
+ }
+}
+
+# tkScaleDrag --
+# This procedure is called when the mouse is dragged with
+# mouse button 1 down. If the drag started inside the slider
+# (i.e. the scale is active) then the scale's value is adjusted
+# to reflect the mouse's position.
+#
+# Arguments:
+# w - The scale widget.
+# x, y - Mouse coordinates.
+
+proc tkScaleDrag {w x y} {
+ global tkPriv
+ if !$tkPriv(dragging) {
+ return
+ }
+ $w set [$w get [expr $x - $tkPriv(deltaX)] \
+ [expr $y - $tkPriv(deltaY)]]
+}
+
+# tkScaleEndDrag --
+# This procedure is called to end an interactive drag of the
+# slider. It just marks the drag as over.
+#
+# Arguments:
+# w - The scale widget.
+
+proc tkScaleEndDrag {w} {
+ global tkPriv
+ set tkPriv(dragging) 0
+}
+
+# tkScaleIncrement --
+# This procedure is invoked to increment the value of a scale and
+# to set up auto-repeating of the action if that is desired. The
+# way the value is incremented depends on the "dir" and "big"
+# arguments.
+#
+# Arguments:
+# w - The scale widget.
+# dir - "up" means move value towards -from, "down" means
+# move towards -to.
+# big - Size of increments: "big" or "little".
+# repeat - Whether and how to auto-repeat the action: "noRepeat"
+# means don't auto-repeat, "initial" means this is the
+# first action in an auto-repeat sequence, and "again"
+# means this is the second repetition or later.
+
+proc tkScaleIncrement {w dir big repeat} {
+ global tkPriv
+ if {$big == "big"} {
+ set inc [$w cget -bigincrement]
+ if {$inc == 0} {
+ set inc [expr abs([$w cget -to] - [$w cget -from])/10.0]
+ }
+ if {$inc < [$w cget -resolution]} {
+ set inc [$w cget -resolution]
+ }
+ } else {
+ set inc [$w cget -resolution]
+ }
+ if {([$w cget -from] > [$w cget -to]) ^ ($dir == "up")} {
+ set inc [expr -$inc]
+ }
+ $w set [expr [$w get] + $inc]
+
+ if {$repeat == "again"} {
+ set tkPriv(afterId) [after [$w cget -repeatinterval] \
+ tkScaleIncrement $w $dir $big again]
+ } elseif {$repeat == "initial"} {
+ set delay [$w cget -repeatdelay]
+ if {$delay > 0} {
+ set tkPriv(afterId) [after $delay \
+ tkScaleIncrement $w $dir $big again]
+ }
+ }
+}
+
+# tkScaleControlPress --
+# This procedure handles button presses that are made with the Control
+# key down. Depending on the mouse position, it adjusts the scale
+# value to one end of the range or the other.
+#
+# Arguments:
+# w - The scale widget.
+# x, y - Mouse coordinates where the button was pressed.
+
+proc tkScaleControlPress {w x y} {
+ set el [$w identify $x $y]
+ if {$el == "trough1"} {
+ $w set [$w cget -from]
+ } elseif {$el == "trough2"} {
+ $w set [$w cget -to]
+ }
+}
+
+# tkScaleButton2Down
+# This procedure is invoked when button 2 is pressed over a scale.
+# It sets the value to correspond to the mouse position and starts
+# a slider drag.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - Mouse coordinates within the widget.
+
+proc tkScaleButton2Down {w x y} {
+ global tkPriv
+
+ if {[$w cget -state] == "disabled"} {
+ return;
+ }
+ $w configure -state active
+ $w set [$w get $x $y]
+ set tkPriv(dragging) 1
+ set tkPriv(initValue) [$w get]
+ set coords "$x $y"
+ set tkPriv(deltaX) 0
+ set tkPriv(deltaY) 0
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scrollbar.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scrollbar.tcl
new file mode 100644
index 000000000..2d0e19b92
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scrollbar.tcl
@@ -0,0 +1,411 @@
+# $XConsortium: scrollbar.tcl /main/1 1996/09/21 14:16:08 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/scrollbar.tcl,v 3.1 1996/12/27 06:55:05 dawes Exp $
+#
+# scrollbar.tcl --
+#
+# This file defines the default bindings for Tk scrollbar widgets.
+# It also provides procedures that help in implementing the bindings.
+#
+# @(#) scrollbar.tcl 1.18 95/09/05 15:19:08
+#
+# Copyright (c) 1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for scrollbars.
+#-------------------------------------------------------------------------
+
+# Standard Motif bindings:
+
+bind Scrollbar <Enter> {
+ if $tk_strictMotif {
+ set tkPriv(activeBg) [%W cget -activebackground]
+ %W config -activebackground [%W cget -background]
+ }
+ %W activate [%W identify %x %y]
+}
+bind Scrollbar <Motion> {
+ %W activate [%W identify %x %y]
+}
+bind Scrollbar <Leave> {
+ if $tk_strictMotif {
+ %W config -activebackground $tkPriv(activeBg)
+ }
+ %W activate {}
+}
+bind Scrollbar <1> {
+ tkScrollButtonDown %W %x %y
+}
+bind Scrollbar <B1-Motion> {
+ tkScrollDrag %W %x %y
+}
+bind Scrollbar <B1-B2-Motion> {
+ tkScrollDrag %W %x %y
+}
+bind Scrollbar <ButtonRelease-1> {
+ tkScrollButtonUp %W %x %y
+}
+bind Scrollbar <B1-Leave> {
+ # Prevents <Leave> binding from being invoked.
+}
+bind Scrollbar <B1-Enter> {
+ # Prevents <Enter> binding from being invoked.
+}
+bind Scrollbar <2> {
+ tkScrollButton2Down %W %x %y
+}
+bind Scrollbar <B1-2> {
+ # Do nothing, since button 1 is already down.
+}
+bind Scrollbar <B2-1> {
+ # Do nothing, since button 2 is already down.
+}
+bind Scrollbar <B2-Motion> {
+ tkScrollDrag %W %x %y
+}
+bind Scrollbar <ButtonRelease-2> {
+ tkScrollButtonUp %W %x %y
+}
+bind Scrollbar <B1-ButtonRelease-2> {
+ # Do nothing: B1 release will handle it.
+}
+bind Scrollbar <B2-ButtonRelease-1> {
+ # Do nothing: B2 release will handle it.
+}
+bind Scrollbar <B2-Leave> {
+ # Prevents <Leave> binding from being invoked.
+}
+bind Scrollbar <B2-Enter> {
+ # Prevents <Enter> binding from being invoked.
+}
+bind Scrollbar <Control-1> {
+ tkScrollTopBottom %W %x %y
+}
+bind Scrollbar <Control-2> {
+ tkScrollTopBottom %W %x %y
+}
+
+bind Scrollbar <Up> {
+ tkScrollByUnits %W v -1
+}
+bind Scrollbar <Down> {
+ tkScrollByUnits %W v 1
+}
+bind Scrollbar <Control-Up> {
+ tkScrollByPages %W v -1
+}
+bind Scrollbar <Control-Down> {
+ tkScrollByPages %W v 1
+}
+bind Scrollbar <Left> {
+ tkScrollByUnits %W h -1
+}
+bind Scrollbar <Right> {
+ tkScrollByUnits %W h 1
+}
+bind Scrollbar <Control-Left> {
+ tkScrollByPages %W h -1
+}
+bind Scrollbar <Control-Right> {
+ tkScrollByPages %W h 1
+}
+bind Scrollbar <Prior> {
+ tkScrollByPages %W hv -1
+}
+bind Scrollbar <Next> {
+ tkScrollByPages %W hv 1
+}
+bind Scrollbar <Home> {
+ tkScrollToPos %W 0
+}
+bind Scrollbar <End> {
+ tkScrollToPos %W 1
+}
+
+# tkScrollButtonDown --
+# This procedure is invoked when a button is pressed in a scrollbar.
+# It changes the way the scrollbar is displayed and takes actions
+# depending on where the mouse is.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - Mouse coordinates.
+
+proc tkScrollButtonDown {w x y} {
+ global tkPriv
+ set tkPriv(relief) [$w cget -activerelief]
+ $w configure -activerelief sunken
+ set element [$w identify $x $y]
+ if {$element == "slider"} {
+ tkScrollStartDrag $w $x $y
+ } else {
+ tkScrollSelect $w $element initial
+ }
+}
+
+# tkScrollButtonUp --
+# This procedure is invoked when a button is released in a scrollbar.
+# It cancels scans and auto-repeats that were in progress, and restores
+# the way the active element is displayed.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - Mouse coordinates.
+
+proc tkScrollButtonUp {w x y} {
+ global tkPriv
+ tkCancelRepeat
+ $w configure -activerelief $tkPriv(relief)
+ tkScrollEndDrag $w $x $y
+ $w activate [$w identify $x $y]
+}
+
+# tkScrollSelect --
+# This procedure is invoked when a button is pressed over the scrollbar.
+# It invokes one of several scrolling actions depending on where in
+# the scrollbar the button was pressed.
+#
+# Arguments:
+# w - The scrollbar widget.
+# element - The element of the scrollbar that was selected, such
+# as "arrow1" or "trough2". Shouldn't be "slider".
+# repeat - Whether and how to auto-repeat the action: "noRepeat"
+# means don't auto-repeat, "initial" means this is the
+# first action in an auto-repeat sequence, and "again"
+# means this is the second repetition or later.
+
+proc tkScrollSelect {w element repeat} {
+ global tkPriv
+ if {$element == "arrow1"} {
+ tkScrollByUnits $w hv -1
+ } elseif {$element == "trough1"} {
+ tkScrollByPages $w hv -1
+ } elseif {$element == "trough2"} {
+ tkScrollByPages $w hv 1
+ } elseif {$element == "arrow2"} {
+ tkScrollByUnits $w hv 1
+ } else {
+ return
+ }
+ if {$repeat == "again"} {
+ set tkPriv(afterId) [after [$w cget -repeatinterval] \
+ tkScrollSelect $w $element again]
+ } elseif {$repeat == "initial"} {
+ set delay [$w cget -repeatdelay]
+ if {$delay > 0} {
+ set tkPriv(afterId) [after $delay tkScrollSelect $w $element again]
+ }
+ }
+}
+
+# tkScrollStartDrag --
+# This procedure is called to initiate a drag of the slider. It just
+# remembers the starting position of the mouse and slider.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - The mouse position at the start of the drag operation.
+
+proc tkScrollStartDrag {w x y} {
+ global tkPriv
+
+ if {[$w cget -command] == ""} {
+ return
+ }
+ set tkPriv(pressX) $x
+ set tkPriv(pressY) $y
+ set tkPriv(initValues) [$w get]
+ set iv0 [lindex $tkPriv(initValues) 0]
+ if {[llength $tkPriv(initValues)] == 2} {
+ set tkPriv(initPos) $iv0
+ } else {
+ if {$iv0 == 0} {
+ set tkPriv(initPos) 0.0
+ } else {
+ set tkPriv(initPos) [expr (double([lindex $tkPriv(initValues) 2])) \
+ / [lindex $tkPriv(initValues) 0]]
+ }
+ }
+}
+
+# tkScrollDrag --
+# This procedure is called for each mouse motion even when the slider
+# is being dragged. It notifies the associated widget if we're not
+# jump scrolling, and it just updates the scrollbar if we are jump
+# scrolling.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - The current mouse position.
+
+proc tkScrollDrag {w x y} {
+ global tkPriv
+
+ if {$tkPriv(initPos) == ""} {
+ return
+ }
+ set delta [$w delta [expr $x - $tkPriv(pressX)] [expr $y - $tkPriv(pressY)]]
+ if [$w cget -jump] {
+ if {[llength $tkPriv(initValues)] == 2} {
+ $w set [expr [lindex $tkPriv(initValues) 0] + $delta] \
+ [expr [lindex $tkPriv(initValues) 1] + $delta]
+ } else {
+ set delta [expr round($delta * [lindex $tkPriv(initValues) 0])]
+ eval $w set [lreplace $tkPriv(initValues) 2 3 \
+ [expr [lindex $tkPriv(initValues) 2] + $delta] \
+ [expr [lindex $tkPriv(initValues) 3] + $delta]]
+ }
+ } else {
+ tkScrollToPos $w [expr $tkPriv(initPos) + $delta]
+ }
+}
+
+# tkScrollEndDrag --
+# This procedure is called to end an interactive drag of the slider.
+# It scrolls the window if we're in jump mode, otherwise it does nothing.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - The mouse position at the end of the drag operation.
+
+proc tkScrollEndDrag {w x y} {
+ global tkPriv
+
+ if {$tkPriv(initPos) == ""} {
+ return
+ }
+ if [$w cget -jump] {
+ set delta [$w delta [expr $x - $tkPriv(pressX)] \
+ [expr $y - $tkPriv(pressY)]]
+ tkScrollToPos $w [expr $tkPriv(initPos) + $delta]
+ }
+ set tkPriv(initPos) ""
+}
+
+# tkScrollByUnits --
+# This procedure tells the scrollbar's associated widget to scroll up
+# or down by a given number of units. It notifies the associated widget
+# in different ways for old and new command syntaxes.
+#
+# Arguments:
+# w - The scrollbar widget.
+# orient - Which kinds of scrollbars this applies to: "h" for
+# horizontal, "v" for vertical, "hv" for both.
+# amount - How many units to scroll: typically 1 or -1.
+
+proc tkScrollByUnits {w orient amount} {
+ set cmd [$w cget -command]
+ if {($cmd == "") || ([string first \
+ [string index [$w cget -orient] 0] $orient] < 0)} {
+ return
+ }
+ set info [$w get]
+ if {[llength $info] == 2} {
+ uplevel #0 $cmd scroll $amount units
+ } else {
+ uplevel #0 $cmd [expr [lindex $info 2] + $amount]
+ }
+}
+
+# tkScrollByPages --
+# This procedure tells the scrollbar's associated widget to scroll up
+# or down by a given number of screenfuls. It notifies the associated
+# widget in different ways for old and new command syntaxes.
+#
+# Arguments:
+# w - The scrollbar widget.
+# orient - Which kinds of scrollbars this applies to: "h" for
+# horizontal, "v" for vertical, "hv" for both.
+# amount - How many screens to scroll: typically 1 or -1.
+
+proc tkScrollByPages {w orient amount} {
+ set cmd [$w cget -command]
+ if {($cmd == "") || ([string first \
+ [string index [$w cget -orient] 0] $orient] < 0)} {
+ return
+ }
+ set info [$w get]
+ if {[llength $info] == 2} {
+ uplevel #0 $cmd scroll $amount pages
+ } else {
+ uplevel #0 $cmd [expr [lindex $info 2] + $amount*([lindex $info 1] - 1)]
+ }
+}
+
+# tkScrollToPos --
+# This procedure tells the scrollbar's associated widget to scroll to
+# a particular location, given by a fraction between 0 and 1. It notifies
+# the associated widget in different ways for old and new command syntaxes.
+#
+# Arguments:
+# w - The scrollbar widget.
+# pos - A fraction between 0 and 1 indicating a desired position
+# in the document.
+
+proc tkScrollToPos {w pos} {
+ set cmd [$w cget -command]
+ if {($cmd == "")} {
+ return
+ }
+ set info [$w get]
+ if {[llength $info] == 2} {
+ uplevel #0 $cmd moveto $pos
+ } else {
+ uplevel #0 $cmd [expr round([lindex $info 0]*$pos)]
+ }
+}
+
+# tkScrollTopBottom
+# Scroll to the top or bottom of the document, depending on the mouse
+# position.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - Mouse coordinates within the widget.
+
+proc tkScrollTopBottom {w x y} {
+ set element [$w identify $x $y]
+ if [string match *1 $element] {
+ tkScrollToPos $w 0
+ } elseif [string match *2 $element] {
+ tkScrollToPos $w 1
+ }
+}
+
+# tkScrollButton2Down
+# This procedure is invoked when button 2 is pressed over a scrollbar.
+# If the button is over the trough or slider, it sets the scrollbar to
+# the mouse position and starts a slider drag. Otherwise it just
+# behaves the same as button 1.
+#
+# Arguments:
+# w - The scrollbar widget.
+# x, y - Mouse coordinates within the widget.
+
+proc tkScrollButton2Down {w x y} {
+ global tkPriv
+ set element [$w identify $x $y]
+ if {($element == "arrow1") || ($element == "arrow2")} {
+ tkScrollButtonDown $w $x $y
+ return
+ }
+ tkScrollToPos $w [$w fraction $x $y]
+
+ # Need the "update idletasks" below so that the widget calls us
+ # back to reset the actual scrollbar position before we start the
+ # slider drag.
+
+ update idletasks
+ set tkPriv(relief) [$w cget -activerelief]
+ $w configure -activerelief sunken
+ $w activate slider
+ tkScrollStartDrag $w $x $y
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/shorter.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/shorter.xbm
new file mode 100644
index 000000000..c64bfcd98
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/shorter.xbm
@@ -0,0 +1,11 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/shorter.xbm,v 1.1 1999/04/05 07:13:04 dawes Exp $ */
+#define shorter_width 24
+#define shorter_height 24
+static unsigned char shorter_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x2a, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x08, 0x00, 0xfe, 0xff, 0x7f,
+ 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
+ 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0xfe, 0xff, 0x7f,
+ 0x00, 0x08, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/taller.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/taller.xbm
new file mode 100644
index 000000000..c7ce2c244
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/taller.xbm
@@ -0,0 +1,11 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/taller.xbm,v 1.1 1999/04/05 07:13:05 dawes Exp $ */
+#define taller_width 24
+#define taller_height 24
+static unsigned char taller_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x7f,
+ 0x02, 0x08, 0x40, 0x02, 0x1c, 0x40, 0x02, 0x2a, 0x40, 0x02, 0x08, 0x40,
+ 0x02, 0x08, 0x40, 0x02, 0x08, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
+ 0x02, 0x00, 0x40, 0x02, 0x08, 0x40, 0x02, 0x08, 0x40, 0x02, 0x08, 0x40,
+ 0x02, 0x2a, 0x40, 0x02, 0x1c, 0x40, 0x02, 0x08, 0x40, 0xfe, 0xff, 0x7f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tclIndex b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tclIndex
new file mode 100644
index 000000000..a88bcbec1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tclIndex
@@ -0,0 +1,117 @@
+# Tcl autoload index file, version 2.0
+# This file is generated by the "auto_mkindex" command
+# and sourced to set up indexing information for one or
+# more commands. Typically each line is a command that
+# sets an element in the auto_index array, where the
+# element name is the name of a command and the value is
+# a script that loads the command.
+#
+# $TOG: tclIndex /main/2 1997/02/13 13:55:50 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tclIndex,v 3.6 1997/07/05 15:16:31 dawes Exp $
+
+set auto_index(tkButtonEnter) "source $dir/button.tcl"
+set auto_index(tkButtonLeave) "source $dir/button.tcl"
+set auto_index(tkButtonDown) "source $dir/button.tcl"
+set auto_index(tkButtonUp) "source $dir/button.tcl"
+set auto_index(tkButtonInvoke) "source $dir/button.tcl"
+set auto_index(tkCheckRadioInvoke) "source $dir/button.tcl"
+set auto_index(tk_dialog) "source $dir/dialog.tcl"
+set auto_index(tkTextClipboardKeysyms) "source $dir/text.tcl"
+set auto_index(tkTextButton1) "source $dir/text.tcl"
+set auto_index(tkTextSelectTo) "source $dir/text.tcl"
+set auto_index(tkTextKeyExtend) "source $dir/text.tcl"
+set auto_index(tkTextAutoScan) "source $dir/text.tcl"
+set auto_index(tkTextSetCursor) "source $dir/text.tcl"
+set auto_index(tkTextKeySelect) "source $dir/text.tcl"
+set auto_index(tkTextResetAnchor) "source $dir/text.tcl"
+set auto_index(tkTextInsert) "source $dir/text.tcl"
+set auto_index(tkTextUpDownLine) "source $dir/text.tcl"
+set auto_index(tkTextPrevPara) "source $dir/text.tcl"
+set auto_index(tkTextNextPara) "source $dir/text.tcl"
+set auto_index(tkTextScrollPages) "source $dir/text.tcl"
+set auto_index(tkTextTranspose) "source $dir/text.tcl"
+set auto_index(tk_focusNext) "source $dir/focus.tcl"
+set auto_index(tk_focusPrev) "source $dir/focus.tcl"
+set auto_index(tkFocusOK) "source $dir/focus.tcl"
+set auto_index(tk_focusFollowsMouse) "source $dir/focus.tcl"
+set auto_index(tkListboxBeginSelect) "source $dir/listbox.tcl"
+set auto_index(tkListboxMotion) "source $dir/listbox.tcl"
+set auto_index(tkListboxBeginExtend) "source $dir/listbox.tcl"
+set auto_index(tkListboxBeginToggle) "source $dir/listbox.tcl"
+set auto_index(tkListboxAutoScan) "source $dir/listbox.tcl"
+set auto_index(tkListboxUpDown) "source $dir/listbox.tcl"
+set auto_index(tkListboxExtendUpDown) "source $dir/listbox.tcl"
+set auto_index(tkListboxDataExtend) "source $dir/listbox.tcl"
+set auto_index(tkListboxCancel) "source $dir/listbox.tcl"
+set auto_index(tkListboxSelectAll) "source $dir/listbox.tcl"
+set auto_index(tkMbEnter) "source $dir/menu.tcl"
+set auto_index(tkMbLeave) "source $dir/menu.tcl"
+set auto_index(tkMbPost) "source $dir/menu.tcl"
+set auto_index(tkMenuUnpost) "source $dir/menu.tcl"
+set auto_index(tkMbMotion) "source $dir/menu.tcl"
+set auto_index(tkMbButtonUp) "source $dir/menu.tcl"
+set auto_index(tkMenuMotion) "source $dir/menu.tcl"
+set auto_index(tkMenuButtonDown) "source $dir/menu.tcl"
+set auto_index(tkMenuLeave) "source $dir/menu.tcl"
+set auto_index(tkMenuInvoke) "source $dir/menu.tcl"
+set auto_index(tkMenuEscape) "source $dir/menu.tcl"
+set auto_index(tkMenuLeftRight) "source $dir/menu.tcl"
+set auto_index(tkMenuNextEntry) "source $dir/menu.tcl"
+set auto_index(tkMenuFind) "source $dir/menu.tcl"
+set auto_index(tkTraverseToMenu) "source $dir/menu.tcl"
+set auto_index(tkFirstMenu) "source $dir/menu.tcl"
+set auto_index(tkTraverseWithinMenu) "source $dir/menu.tcl"
+set auto_index(tkMenuFirstEntry) "source $dir/menu.tcl"
+set auto_index(tkMenuFindName) "source $dir/menu.tcl"
+set auto_index(tkPostOverPoint) "source $dir/menu.tcl"
+set auto_index(tk_popup) "source $dir/menu.tcl"
+set auto_index(tk_optionMenu) "source $dir/optionMenu.tcl"
+set auto_index(tk_setPalette) "source $dir/palette.tcl"
+set auto_index(tkRecolorTree) "source $dir/palette.tcl"
+set auto_index(tkDarken) "source $dir/palette.tcl"
+set auto_index(tk_bisque) "source $dir/palette.tcl"
+set auto_index(tkScaleActivate) "source $dir/scale.tcl"
+set auto_index(tkScaleButtonDown) "source $dir/scale.tcl"
+set auto_index(tkScaleDrag) "source $dir/scale.tcl"
+set auto_index(tkScaleEndDrag) "source $dir/scale.tcl"
+set auto_index(tkScaleIncrement) "source $dir/scale.tcl"
+set auto_index(tkScaleControlPress) "source $dir/scale.tcl"
+set auto_index(tkScrollButtonDown) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollButtonUp) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollSelect) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollStartDrag) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollDrag) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollEndDrag) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollByUnits) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollByPages) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollToPos) "source $dir/scrollbar.tcl"
+set auto_index(tkScrollTopBottom) "source $dir/scrollbar.tcl"
+set auto_index(tkTearOffMenu) "source $dir/tearoff.tcl"
+set auto_index(tkMenuDup) "source $dir/tearoff.tcl"
+set auto_index(tkEntryClipboardKeysyms) "source $dir/entry.tcl"
+set auto_index(tkEntryButton1) "source $dir/entry.tcl"
+set auto_index(tkEntryMouseSelect) "source $dir/entry.tcl"
+set auto_index(tkEntryAutoScan) "source $dir/entry.tcl"
+set auto_index(tkEntryKeySelect) "source $dir/entry.tcl"
+set auto_index(tkEntryInsert) "source $dir/entry.tcl"
+set auto_index(tkEntryBackspace) "source $dir/entry.tcl"
+set auto_index(tkEntrySeeInsert) "source $dir/entry.tcl"
+set auto_index(tkEntrySetCursor) "source $dir/entry.tcl"
+set auto_index(tkEntryTranspose) "source $dir/entry.tcl"
+set auto_index(tkScreenChanged) "source $dir/tk.tcl"
+set auto_index(tkCancelRepeat) "source $dir/tk.tcl"
+set auto_index(tkerror) "source $dir/tkerror.tcl"
+set auto_index(bgerror) "source $dir/tkerror.tcl"
+set auto_index(combobox) "source $dir/combobox.tcl"
+set auto_index(zap_white) "source $dir/misc.tcl"
+set auto_index(squash_white) "source $dir/misc.tcl"
+set auto_index(do) "source $dir/misc.tcl"
+set auto_index(parafmt) "source $dir/misc.tcl"
+set auto_index(winpathprefix) "source $dir/misc.tcl"
+set auto_index(lrmdups) "source $dir/misc.tcl"
+set auto_index(readlink) "source $dir/misc.tcl"
+set auto_index(random) "source $dir/misc.tcl"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tearoff.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tearoff.tcl
new file mode 100644
index 000000000..41a428c3f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tearoff.tcl
@@ -0,0 +1,128 @@
+# $XConsortium: tearoff.tcl /main/1 1996/09/21 14:16:12 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tearoff.tcl,v 3.1 1996/12/27 06:55:07 dawes Exp $
+#
+# tearoff.tcl --
+#
+# This file contains procedures that implement tear-off menus.
+#
+# @(#) tearoff.tcl 1.5 95/04/23 16:50:06
+#
+# Copyright (c) 1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+# tkTearoffMenu --
+# Given the name of a menu, this procedure creates a torn-off menu
+# that is identical to the given menu (including nested submenus).
+# The new torn-off menu exists as a toplevel window managed by the
+# window manager. The return value is the name of the new menu.
+#
+# Arguments:
+# w - The menu to be torn-off (duplicated).
+
+proc tkTearOffMenu w {
+ # Find a unique name to use for the torn-off menu. Find the first
+ # ancestor of w that is a toplevel but not a menu, and use this as
+ # the parent of the new menu. This guarantees that the torn off
+ # menu will be on the same screen as the original menu. By making
+ # it a child of the ancestor, rather than a child of the menu, it
+ # can continue to live even if the menu is deleted; it will go
+ # away when the toplevel goes away.
+
+ set parent [winfo parent $w]
+ while {([winfo toplevel $parent] != $parent)
+ || ([winfo class $parent] == "Menu")} {
+ set parent [winfo parent $parent]
+ }
+ if {$parent == "."} {
+ set parent ""
+ }
+ for {set i 1} 1 {incr i} {
+ set menu $parent.tearoff$i
+ if ![winfo exists $menu] {
+ break
+ }
+ }
+
+ tkMenuDup $w $menu
+ wm overrideredirect $menu 0
+
+ # Pick a title for the new menu by looking at the parent of the
+ # original: if the parent is a menu, then use the text of the active
+ # entry. If it's a menubutton then use its text.
+
+ set parent [winfo parent $w]
+ switch [winfo class $parent] {
+ Menubutton {
+ wm title $menu [$parent cget -text]
+ }
+ Menu {
+ wm title $menu [$parent entrycget active -label]
+ }
+ }
+
+ $menu configure -tearoff 0
+ $menu post [winfo x $w] [winfo y $w]
+
+ # Set tkPriv(focus) on entry: otherwise the focus will get lost
+ # after keyboard invocation of a sub-menu (it will stay on the
+ # submenu).
+
+ bind $menu <Enter> {
+ set tkPriv(focus) %W
+ }
+}
+
+# tkMenuDup --
+# Given a menu (hierarchy), create a duplicate menu (hierarchy)
+# in a given window.
+#
+# Arguments:
+# src - Source window. Must be a menu. It and its
+# menu descendants will be duplicated at dst.
+# dst - Name to use for topmost menu in duplicate
+# hierarchy.
+
+proc tkMenuDup {src dst} {
+ set cmd "menu $dst"
+ foreach option [$src configure] {
+ if {[llength $option] == 2} {
+ continue
+ }
+ lappend cmd [lindex $option 0] [lindex $option 4]
+ }
+ eval $cmd
+ set last [$src index last]
+ if {$last == "none"} {
+ return
+ }
+ for {set i [$src cget -tearoff]} {$i <= $last} {incr i} {
+ set cmd "$dst add [$src type $i]"
+ foreach option [$src entryconfigure $i] {
+ lappend cmd [lindex $option 0] [lindex $option 4]
+ }
+ eval $cmd
+ if {[$src type $i] == "cascade"} {
+ tkMenuDup [$src entrycget $i -menu] $dst.m$i
+ $dst entryconfigure $i -menu $dst.m$i
+ }
+ }
+
+ # Duplicate the binding tags and bindings from the source menu.
+
+ regsub -all . $src {\\&} quotedSrc
+ regsub -all . $dst {\\&} quotedDst
+ regsub -all $quotedSrc [bindtags $src] $dst x
+ bindtags $dst $x
+ foreach event [bind $src] {
+ regsub -all $quotedSrc [bind $src $event] $dst x
+ bind $dst $event $x
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/text.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/text.tcl
new file mode 100644
index 000000000..6f33190c3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/text.tcl
@@ -0,0 +1,798 @@
+# $XConsortium: text.tcl /main/1 1996/09/21 14:16:15 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/text.tcl,v 3.1 1996/12/27 06:55:08 dawes Exp $
+#
+# text.tcl --
+#
+# This file defines the default bindings for Tk text widgets and provides
+# procedures that help in implementing the bindings.
+#
+# @(#) text.tcl 1.36 95/06/28 10:24:23
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+
+#-------------------------------------------------------------------------
+# Elements of tkPriv that are used in this file:
+#
+# afterId - If non-null, it means that auto-scanning is underway
+# and it gives the "after" id for the next auto-scan
+# command to be executed.
+# char - Character position on the line; kept in order
+# to allow moving up or down past short lines while
+# still remembering the desired position.
+# mouseMoved - Non-zero means the mouse has moved a significant
+# amount since the button went down (so, for example,
+# start dragging out a selection).
+# prevPos - Used when moving up or down lines via the keyboard.
+# Keeps track of the previous insert position, so
+# we can distinguish a series of ups and downs, all
+# in a row, from a new up or down.
+# selectMode - The style of selection currently underway:
+# char, word, or line.
+# x, y - Last known mouse coordinates for scanning
+# and auto-scanning.
+#-------------------------------------------------------------------------
+
+# tkTextClipboardKeysyms --
+# This procedure is invoked to identify the keys that correspond to
+# the "copy", "cut", and "paste" functions for the clipboard.
+#
+# Arguments:
+# copy - Name of the key (keysym name plus modifiers, if any,
+# such as "Meta-y") used for the copy operation.
+# cut - Name of the key used for the cut operation.
+# paste - Name of the key used for the paste operation.
+
+proc tkTextClipboardKeysyms {copy cut paste} {
+ bind Text <$copy> {
+ if {[selection own -displayof %W] == "%W"} {
+ clipboard clear -displayof %W
+ catch {
+ clipboard append -displayof %W [selection get -displayof %W]
+ }
+ }
+ }
+ bind Text <$cut> {
+ if {[selection own -displayof %W] == "%W"} {
+ clipboard clear -displayof %W
+ catch {
+ clipboard append -displayof %W [selection get -displayof %W]
+ %W delete sel.first sel.last
+ }
+ }
+ }
+ bind Text <$paste> {
+ catch {
+ %W insert insert [selection get -displayof %W \
+ -selection CLIPBOARD]
+ }
+ }
+}
+
+#-------------------------------------------------------------------------
+# The code below creates the default class bindings for entries.
+#-------------------------------------------------------------------------
+
+ # Standard Motif bindings:
+
+bind Text <1> {
+ tkTextButton1 %W %x %y
+ %W tag remove sel 0.0 end
+}
+bind Text <B1-Motion> {
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ tkTextSelectTo %W %x %y
+}
+bind Text <Double-1> {
+ set tkPriv(selectMode) word
+ tkTextSelectTo %W %x %y
+ catch {%W mark set insert sel.first}
+}
+bind Text <Triple-1> {
+ set tkPriv(selectMode) line
+ tkTextSelectTo %W %x %y
+ catch {%W mark set insert sel.first}
+}
+bind Text <Shift-1> {
+ tkTextResetAnchor %W @%x,%y
+ set tkPriv(selectMode) char
+ tkTextSelectTo %W %x %y
+}
+bind Text <Double-Shift-1> {
+ set tkPriv(selectMode) word
+ tkTextSelectTo %W %x %y
+}
+bind Text <Triple-Shift-1> {
+ set tkPriv(selectMode) line
+ tkTextSelectTo %W %x %y
+}
+bind Text <B1-Leave> {
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ tkTextAutoScan %W
+}
+bind Text <B1-Enter> {
+ tkCancelRepeat
+}
+bind Text <ButtonRelease-1> {
+ tkCancelRepeat
+}
+bind Text <Control-1> {
+ %W mark set insert @%x,%y
+}
+bind Text <Left> {
+ tkTextSetCursor %W [%W index {insert - 1c}]
+}
+bind Text <Right> {
+ tkTextSetCursor %W [%W index {insert + 1c}]
+}
+bind Text <Up> {
+ tkTextSetCursor %W [tkTextUpDownLine %W -1]
+}
+bind Text <Down> {
+ tkTextSetCursor %W [tkTextUpDownLine %W 1]
+}
+bind Text <Shift-Left> {
+ tkTextKeySelect %W [%W index {insert - 1c}]
+}
+bind Text <Shift-Right> {
+ tkTextKeySelect %W [%W index {insert + 1c}]
+}
+bind Text <Shift-Up> {
+ tkTextKeySelect %W [tkTextUpDownLine %W -1]
+}
+bind Text <Shift-Down> {
+ tkTextKeySelect %W [tkTextUpDownLine %W 1]
+}
+bind Text <Control-Left> {
+ tkTextSetCursor %W [%W index {insert - 1c wordstart}]
+}
+bind Text <Control-Right> {
+ tkTextSetCursor %W [%W index {insert wordend}]
+}
+bind Text <Control-Up> {
+ tkTextSetCursor %W [tkTextPrevPara %W insert]
+}
+bind Text <Control-Down> {
+ tkTextSetCursor %W [tkTextNextPara %W insert]
+}
+bind Text <Shift-Control-Left> {
+ tkTextKeySelect %W [%W index {insert - 1c wordstart}]
+}
+bind Text <Shift-Control-Right> {
+ tkTextKeySelect %W [%W index {insert wordend}]
+}
+bind Text <Shift-Control-Up> {
+ tkTextKeySelect %W [tkTextPrevPara %W insert]
+}
+bind Text <Shift-Control-Down> {
+ tkTextKeySelect %W [tkTextNextPara %W insert]
+}
+bind Text <Prior> {
+ tkTextSetCursor %W [tkTextScrollPages %W -1]
+}
+bind Text <Shift-Prior> {
+ tkTextKeySelect %W [tkTextScrollPages %W -1]
+}
+bind Text <Next> {
+ tkTextSetCursor %W [tkTextScrollPages %W 1]
+}
+bind Text <Shift-Next> {
+ tkTextKeySelect %W [tkTextScrollPages %W 1]
+}
+bind Text <Control-Prior> {
+ %W xview scroll -1 page
+}
+bind Text <Control-Next> {
+ %W xview scroll 1 page
+}
+
+bind Text <Home> {
+ tkTextSetCursor %W {insert linestart}
+}
+bind Text <Shift-Home> {
+ tkTextKeySelect %W {insert linestart}
+}
+bind Text <End> {
+ tkTextSetCursor %W {insert lineend}
+}
+bind Text <Shift-End> {
+ tkTextKeySelect %W {insert lineend}
+}
+bind Text <Control-Home> {
+ tkTextSetCursor %W 1.0
+}
+bind Text <Control-Shift-Home> {
+ tkTextKeySelect %W 1.0
+}
+bind Text <Control-End> {
+ tkTextSetCursor %W {end - 1 char}
+}
+bind Text <Control-Shift-End> {
+ tkTextKeySelect %W {end - 1 char}
+}
+
+bind Text <Tab> {
+ tkTextInsert %W \t
+ focus %W
+ break
+}
+bind Text <Shift-Tab> {
+ # Needed only to keep <Tab> binding from triggering; doesn't
+ # have to actually do anything.
+}
+bind Text <Control-Tab> {
+ focus [tk_focusNext %W]
+}
+bind Text <Control-Shift-Tab> {
+ focus [tk_focusPrev %W]
+}
+bind Text <Control-i> {
+ tkTextInsert %W \t
+}
+bind Text <Return> {
+ tkTextInsert %W \n
+}
+bind Text <Delete> {
+ if {[%W tag nextrange sel 1.0 end] != ""} {
+ %W delete sel.first sel.last
+ } else {
+ %W delete insert
+ %W see insert
+ }
+}
+bind Text <BackSpace> {
+ if {[%W tag nextrange sel 1.0 end] != ""} {
+ %W delete sel.first sel.last
+ } elseif [%W compare insert != 1.0] {
+ %W delete insert-1c
+ %W see insert
+ }
+}
+
+bind Text <Control-space> {
+ %W mark set anchor insert
+}
+bind Text <Select> {
+ %W mark set anchor insert
+}
+bind Text <Control-Shift-space> {
+ set tkPriv(selectMode) char
+ tkTextKeyExtend %W insert
+}
+bind Text <Shift-Select> {
+ set tkPriv(selectMode) char
+ tkTextKeyExtend %W insert
+}
+bind Text <Control-slash> {
+ %W tag add sel 1.0 end
+}
+bind Text <Control-backslash> {
+ %W tag remove sel 1.0 end
+}
+tkTextClipboardKeysyms F16 F20 F18
+bind Text <Insert> {
+ catch {tkTextInsert %W [selection get -displayof %W]}
+}
+bind Text <KeyPress> {
+ tkTextInsert %W %A
+}
+
+# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
+# Otherwise, if a widget binding for one of these is defined, the
+# <KeyPress> class binding will also fire and insert the character,
+# which is wrong. Ditto for <Escape>.
+
+bind Text <Alt-KeyPress> {# nothing }
+bind Text <Meta-KeyPress> {# nothing}
+bind Text <Control-KeyPress> {# nothing}
+bind Text <Escape> {# nothing}
+bind Text <KP_Enter> {# nothing}
+
+# Additional emacs-like bindings:
+
+if !$tk_strictMotif {
+ bind Text <Control-a> {
+ tkTextSetCursor %W {insert linestart}
+ }
+ bind Text <Control-b> {
+ tkTextSetCursor %W insert-1c
+ }
+ bind Text <Control-d> {
+ %W delete insert
+ }
+ bind Text <Control-e> {
+ tkTextSetCursor %W {insert lineend}
+ }
+ bind Text <Control-f> {
+ tkTextSetCursor %W insert+1c
+ }
+ bind Text <Control-k> {
+ if [%W compare insert == {insert lineend}] {
+ %W delete insert
+ } else {
+ %W delete insert {insert lineend}
+ }
+ }
+ bind Text <Control-n> {
+ tkTextSetCursor %W [tkTextUpDownLine %W 1]
+ }
+ bind Text <Control-o> {
+ %W insert insert \n
+ %W mark set insert insert-1c
+ }
+ bind Text <Control-p> {
+ tkTextSetCursor %W [tkTextUpDownLine %W -1]
+ }
+ bind Text <Control-t> {
+ tkTextTranspose %W
+ }
+ bind Text <Control-v> {
+ tkTextScrollPages %W 1
+ }
+ bind Text <Meta-b> {
+ tkTextSetCursor %W {insert - 1c wordstart}
+ }
+ bind Text <Meta-d> {
+ %W delete insert {insert wordend}
+ }
+ bind Text <Meta-f> {
+ tkTextSetCursor %W {insert wordend}
+ }
+ bind Text <Meta-less> {
+ tkTextSetCursor %W 1.0
+ }
+ bind Text <Meta-greater> {
+ tkTextSetCursor %W end-1c
+ }
+ bind Text <Meta-BackSpace> {
+ %W delete {insert -1c wordstart} insert
+ }
+ bind Text <Meta-Delete> {
+ %W delete {insert -1c wordstart} insert
+ }
+ tkTextClipboardKeysyms Meta-w Control-w Control-y
+
+ # A few additional bindings of my own.
+
+ bind Text <Control-h> {
+ if [%W compare insert != 1.0] {
+ %W delete insert-1c
+ %W see insert
+ }
+ }
+ bind Text <2> {
+ %W scan mark %x %y
+ set tkPriv(x) %x
+ set tkPriv(y) %y
+ set tkPriv(mouseMoved) 0
+ }
+ bind Text <B2-Motion> {
+ if {(%x != $tkPriv(x)) || (%y != $tkPriv(y))} {
+ set tkPriv(mouseMoved) 1
+ }
+ if $tkPriv(mouseMoved) {
+ %W scan dragto %x %y
+ }
+ }
+ bind Text <ButtonRelease-2> {
+ if !$tkPriv(mouseMoved) {
+ catch {
+ %W insert @%x,%y [selection get -displayof %W]
+ }
+ }
+ }
+}
+set tkPriv(prevPos) {}
+
+# tkTextButton1 --
+# This procedure is invoked to handle button-1 presses in text
+# widgets. It moves the insertion cursor, sets the selection anchor,
+# and claims the input focus.
+#
+# Arguments:
+# w - The text window in which the button was pressed.
+# x - The x-coordinate of the button press.
+# y - The x-coordinate of the button press.
+
+proc tkTextButton1 {w x y} {
+ global tkPriv
+
+ set tkPriv(selectMode) char
+ set tkPriv(mouseMoved) 0
+ set tkPriv(pressX) $x
+ $w mark set insert @$x,$y
+ $w mark set anchor insert
+ if {[$w cget -state] == "normal"} {focus $w}
+}
+
+# tkTextSelectTo --
+# This procedure is invoked to extend the selection, typically when
+# dragging it with the mouse. Depending on the selection mode (character,
+# word, line) it selects in different-sized units. This procedure
+# ignores mouse motions initially until the mouse has moved from
+# one character to another or until there have been multiple clicks.
+#
+# Arguments:
+# w - The text window in which the button was pressed.
+# x - Mouse x position.
+# y - Mouse y position.
+
+proc tkTextSelectTo {w x y} {
+ global tkPriv
+
+ set cur [$w index @$x,$y]
+ if [catch {$w index anchor}] {
+ $w mark set anchor $cur
+ }
+ set anchor [$w index anchor]
+ if {[$w compare $cur != $anchor] || (abs($tkPriv(pressX) - $x) >= 3)} {
+ set tkPriv(mouseMoved) 1
+ }
+ switch $tkPriv(selectMode) {
+ char {
+ if [$w compare $cur < anchor] {
+ set first $cur
+ set last anchor
+ } else {
+ set first anchor
+ set last [$w index "$cur + 1c"]
+ }
+ }
+ word {
+ if [$w compare $cur < anchor] {
+ set first [$w index "$cur wordstart"]
+ set last [$w index "anchor - 1c wordend"]
+ } else {
+ set first [$w index "anchor wordstart"]
+ set last [$w index "$cur wordend"]
+ }
+ }
+ line {
+ if [$w compare $cur < anchor] {
+ set first [$w index "$cur linestart"]
+ set last [$w index "anchor - 1c lineend + 1c"]
+ } else {
+ set first [$w index "anchor linestart"]
+ set last [$w index "$cur lineend + 1c"]
+ }
+ }
+ }
+ if {$tkPriv(mouseMoved) || ($tkPriv(selectMode) != "char")} {
+ $w tag remove sel 0.0 $first
+ $w tag add sel $first $last
+ $w tag remove sel $last end
+ update idletasks
+ }
+}
+
+# tkTextKeyExtend --
+# This procedure handles extending the selection from the keyboard,
+# where the point to extend to is really the boundary between two
+# characters rather than a particular character.
+#
+# Arguments:
+# w - The text window.
+# index - The point to which the selection is to be extended.
+
+proc tkTextKeyExtend {w index} {
+ global tkPriv
+
+ set cur [$w index $index]
+ if [catch {$w index anchor}] {
+ $w mark set anchor $cur
+ }
+ set anchor [$w index anchor]
+ if [$w compare $cur < anchor] {
+ set first $cur
+ set last anchor
+ } else {
+ set first anchor
+ set last $cur
+ }
+ $w tag remove sel 0.0 $first
+ $w tag add sel $first $last
+ $w tag remove sel $last end
+}
+
+# tkTextAutoScan --
+# This procedure is invoked when the mouse leaves a text window
+# with button 1 down. It scrolls the window up, down, left, or right,
+# depending on where the mouse is (this information was saved in
+# tkPriv(x) and tkPriv(y)), and reschedules itself as an "after"
+# command so that the window continues to scroll until the mouse
+# moves back into the window or the mouse button is released.
+#
+# Arguments:
+# w - The text window.
+
+proc tkTextAutoScan {w} {
+ global tkPriv
+ if {$tkPriv(y) >= [winfo height $w]} {
+ $w yview scroll 2 units
+ } elseif {$tkPriv(y) < 0} {
+ $w yview scroll -2 units
+ } elseif {$tkPriv(x) >= [winfo width $w]} {
+ $w xview scroll 2 units
+ } elseif {$tkPriv(x) < 0} {
+ $w xview scroll -2 units
+ } else {
+ return
+ }
+ tkTextSelectTo $w $tkPriv(x) $tkPriv(y)
+ set tkPriv(afterId) [after 50 tkTextAutoScan $w]
+}
+
+# tkTextSetCursor
+# Move the insertion cursor to a given position in a text. Also
+# clears the selection, if there is one in the text, and makes sure
+# that the insertion cursor is visible. Also, don't let the insertion
+# cursor appear on the dummy last line of the text.
+#
+# Arguments:
+# w - The text window.
+# pos - The desired new position for the cursor in the window.
+
+proc tkTextSetCursor {w pos} {
+ global tkPriv
+
+ if [$w compare $pos == end] {
+ set pos {end - 1 chars}
+ }
+ $w mark set insert $pos
+ $w tag remove sel 1.0 end
+ $w see insert
+}
+
+# tkTextKeySelect
+# This procedure is invoked when stroking out selections using the
+# keyboard. It moves the cursor to a new position, then extends
+# the selection to that position.
+#
+# Arguments:
+# w - The text window.
+# new - A new position for the insertion cursor (the cursor hasn't
+# actually been moved to this position yet).
+
+proc tkTextKeySelect {w new} {
+ global tkPriv
+
+ if {[$w tag nextrange sel 1.0 end] == ""} {
+ if [$w compare $new < insert] {
+ $w tag add sel $new insert
+ } else {
+ $w tag add sel insert $new
+ }
+ $w mark set anchor insert
+ } else {
+ if [$w compare $new < anchor] {
+ set first $new
+ set last anchor
+ } else {
+ set first anchor
+ set last $new
+ }
+ $w tag remove sel 1.0 $first
+ $w tag add sel $first $last
+ $w tag remove sel $last end
+ }
+ $w mark set insert $new
+ $w see insert
+ update idletasks
+}
+
+# tkTextResetAnchor --
+# Set the selection anchor to whichever end is farthest from the
+# index argument. One special trick: if the selection has two or
+# fewer characters, just leave the anchor where it is. In this
+# case it doesn't matter which point gets chosen for the anchor,
+# and for the things like Shift-Left and Shift-Right this produces
+# better behavior when the cursor moves back and forth across the
+# anchor.
+#
+# Arguments:
+# w - The text widget.
+# index - Position at which mouse button was pressed, which determines
+# which end of selection should be used as anchor point.
+
+proc tkTextResetAnchor {w index} {
+ global tkPriv
+
+ if {[$w tag ranges sel] == ""} {
+ $w mark set anchor $index
+ return
+ }
+ set a [$w index $index]
+ set b [$w index sel.first]
+ set c [$w index sel.last]
+ if [$w compare $a < $b] {
+ $w mark set anchor sel.last
+ return
+ }
+ if [$w compare $a > $c] {
+ $w mark set anchor sel.first
+ return
+ }
+ scan $a "%d.%d" lineA chA
+ scan $b "%d.%d" lineB chB
+ scan $c "%d.%d" lineC chC
+ if {$lineB < $lineC+2} {
+ set total [string length [$w get $b $c]]
+ if {$total <= 2} {
+ return
+ }
+ if {[string length [$w get $b $a]] < ($total/2)} {
+ $w mark set anchor sel.last
+ } else {
+ $w mark set anchor sel.first
+ }
+ return
+ }
+ if {($lineA-$lineB) < ($lineC-$lineA)} {
+ $w mark set anchor sel.last
+ } else {
+ $w mark set anchor sel.first
+ }
+}
+
+# tkTextInsert --
+# Insert a string into a text at the point of the insertion cursor.
+# If there is a selection in the text, and it covers the point of the
+# insertion cursor, then delete the selection before inserting.
+#
+# Arguments:
+# w - The text window in which to insert the string
+# s - The string to insert (usually just a single character)
+
+proc tkTextInsert {w s} {
+ if {($s == "") || ([$w cget -state] == "disabled")} {
+ return
+ }
+ catch {
+ if {[$w compare sel.first <= insert]
+ && [$w compare sel.last >= insert]} {
+ $w delete sel.first sel.last
+ }
+ }
+ $w insert insert $s
+ $w see insert
+}
+
+# tkTextUpDownLine --
+# Returns the index of the character one line above or below the
+# insertion cursor. There are two tricky things here. First,
+# we want to maintain the original column across repeated operations,
+# even though some lines that will get passed through don't have
+# enough characters to cover the original column. Second, don't
+# try to scroll past the beginning or end of the text.
+#
+# Arguments:
+# w - The text window in which the cursor is to move.
+# n - The number of lines to move: -1 for up one line,
+# +1 for down one line.
+
+proc tkTextUpDownLine {w n} {
+ global tkPriv
+
+ set i [$w index insert]
+ scan $i "%d.%d" line char
+ if {[string compare $tkPriv(prevPos) $i] != 0} {
+ set tkPriv(char) $char
+ }
+ set new [$w index [expr $line + $n].$tkPriv(char)]
+ if {[$w compare $new == end] || [$w compare $new == "insert linestart"]} {
+ set new $i
+ }
+ set tkPriv(prevPos) $new
+ return $new
+}
+
+# tkTextPrevPara --
+# Returns the index of the beginning of the paragraph just before a given
+# position in the text (the beginning of a paragraph is the first non-blank
+# character after a blank line).
+#
+# Arguments:
+# w - The text window in which the cursor is to move.
+# pos - Position at which to start search.
+
+proc tkTextPrevPara {w pos} {
+ set pos [$w index "$pos linestart"]
+ while 1 {
+ if {(([$w get "$pos - 1 line"] == "\n") && ([$w get $pos] != "\n"))
+ || ($pos == "1.0")} {
+ if [regexp -indices {^[ ]+(.)} [$w get $pos "$pos lineend"] \
+ dummy index] {
+ set pos [$w index "$pos + [lindex $index 0] chars"]
+ }
+ if {[$w compare $pos != insert] || ($pos == "1.0")} {
+ return $pos
+ }
+ }
+ set pos [$w index "$pos - 1 line"]
+ }
+}
+
+# tkTextNextPara --
+# Returns the index of the beginning of the paragraph just after a given
+# position in the text (the beginning of a paragraph is the first non-blank
+# character after a blank line).
+#
+# Arguments:
+# w - The text window in which the cursor is to move.
+# start - Position at which to start search.
+
+proc tkTextNextPara {w start} {
+ set pos [$w index "$start linestart + 1 line"]
+ while {[$w get $pos] != "\n"} {
+ if [$w compare $pos == end] {
+ return [$w index "end - 1c"]
+ }
+ set pos [$w index "$pos + 1 line"]
+ }
+ while {[$w get $pos] == "\n"} {
+ set pos [$w index "$pos + 1 line"]
+ if [$w compare $pos == end] {
+ return [$w index "end - 1c"]
+ }
+ }
+ if [regexp -indices {^[ ]+(.)} [$w get $pos "$pos lineend"] \
+ dummy index] {
+ return [$w index "$pos + [lindex $index 0] chars"]
+ }
+ return $pos
+}
+
+# tkTextScrollPages --
+# This is a utility procedure used in bindings for moving up and down
+# pages and possibly extending the selection along the way. It scrolls
+# the view in the widget by the number of pages, and it returns the
+# index of the character that is at the same position in the new view
+# as the insertion cursor used to be in the old view.
+#
+# Arguments:
+# w - The text window in which the cursor is to move.
+# count - Number of pages forward to scroll; may be negative
+# to scroll backwards.
+
+proc tkTextScrollPages {w count} {
+ set bbox [$w bbox insert]
+ $w yview scroll $count pages
+ if {$bbox == ""} {
+ return [$w index @[expr [winfo height $w]/2],0]
+ }
+ return [$w index @[lindex $bbox 0],[lindex $bbox 1]]
+}
+
+# tkTextTranspose --
+# This procedure implements the "transpose" function for text widgets.
+# It tranposes the characters on either side of the insertion cursor,
+# unless the cursor is at the end of the line. In this case it
+# transposes the two characters to the left of the cursor. In either
+# case, the cursor ends up to the right of the transposed characters.
+#
+# Arguments:
+# w - Text window in which to transpose.
+
+proc tkTextTranspose w {
+ set pos insert
+ if [$w compare $pos != "$pos lineend"] {
+ set pos [$w index "$pos + 1 char"]
+ }
+ set new [$w get "$pos - 1 char"][$w get "$pos - 2 char"]
+ if [$w compare "$pos - 1 char" == 1.0] {
+ return
+ }
+ $w delete "$pos - 2 char" $pos
+ $w insert insert $new
+ $w see insert
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tk.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tk.tcl
new file mode 100644
index 000000000..9f948681b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tk.tcl
@@ -0,0 +1,118 @@
+# $XConsortium: tk.tcl /main/1 1996/09/21 14:15:57 kaleb $
+#
+#
+#
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tk.tcl,v 3.3 1997/11/22 00:00:08 hohndel Exp $
+#
+# tk.tcl --
+#
+# Initialization script normally executed in the interpreter for each
+# Tk-based application. Arranges class bindings for widgets.
+#
+# @(#) tk.tcl 1.73 95/08/30 16:40:20
+#
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+# Insist on running with compatible versions of Tcl and Tk.
+
+scan [info tclversion] "%d.%d" a b
+if {$a < 7 || ($a == 7 && $b < 5)} {
+ error "wrong version of Tcl loaded ([info tclversion]): need 7.5 or later"
+}
+scan $tk_version "%d.%d" a b
+if {($a < 4) || ($a == 4 && $b < 1)} {
+ error "wrong version of Tk loaded ($tk_version): need 4.1 or later"
+}
+unset a b
+
+# Add Tk's directory to the end of the auto-load search path:
+
+lappend auto_path $tk_library
+
+# Turn off strict Motif look and feel as a default.
+
+set tk_strictMotif 0
+
+# tkScreenChanged --
+# This procedure is invoked by the binding mechanism whenever the
+# "current" screen is changing. The procedure does two things.
+# First, it uses "upvar" to make global variable "tkPriv" point at an
+# array variable that holds state for the current display. Second,
+# it initializes the array if it didn't already exist.
+#
+# Arguments:
+# screen - The name of the new screen.
+
+proc tkScreenChanged screen {
+ set disp [file rootname $screen]
+ uplevel #0 upvar #0 tkPriv.$disp tkPriv
+ global tkPriv
+ if [info exists tkPriv] {
+ set tkPriv(screen) $screen
+ return
+ }
+ set tkPriv(afterId) {}
+ set tkPriv(buttons) 0
+ set tkPriv(buttonWindow) {}
+ set tkPriv(dragging) 0
+ set tkPriv(focus) {}
+ set tkPriv(grab) {}
+ set tkPriv(initPos) {}
+ set tkPriv(inMenubutton) {}
+ set tkPriv(listboxPrev) {}
+ set tkPriv(mouseMoved) 0
+ set tkPriv(oldGrab) {}
+ set tkPriv(popup) {}
+ set tkPriv(postedMb) {}
+ set tkPriv(pressX) 0
+ set tkPriv(pressY) 0
+ set tkPriv(screen) $screen
+ set tkPriv(selectMode) char
+ set tkPriv(window) {}
+}
+
+# Do initial setup for tkPriv, so that it is always bound to something
+# (otherwise, if someone references it, it may get set to a non-upvar-ed
+# value, which will cause trouble later).
+
+tkScreenChanged [winfo screen .]
+
+# ----------------------------------------------------------------------
+# Read in files that define all of the class bindings.
+# ----------------------------------------------------------------------
+
+source $tk_library/button.tcl
+source $tk_library/entry.tcl
+source $tk_library/listbox.tcl
+source $tk_library/menu.tcl
+source $tk_library/scale.tcl
+source $tk_library/scrollbar.tcl
+source $tk_library/text.tcl
+
+# ----------------------------------------------------------------------
+# Default bindings for keyboard traversal.
+# ----------------------------------------------------------------------
+
+bind all <Tab> {focus [tk_focusNext %W]}
+bind all <Key-ISO_Left_Tab> {focus [tk_focusPrev %W]}
+bind all <Shift-Tab> {focus [tk_focusPrev %W]}
+
+# tkCancelRepeat --
+# This procedure is invoked to cancel an auto-repeat action described
+# by tkPriv(afterId). It's used by several widgets to auto-scroll
+# the widget when the mouse is dragged out of the widget with a
+# button pressed.
+#
+# Arguments:
+# None.
+
+proc tkCancelRepeat {} {
+ global tkPriv
+ after cancel $tkPriv(afterId)
+ set tkPriv(afterId) {}
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tkerror.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tkerror.tcl
new file mode 100644
index 000000000..fce946605
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tkerror.tcl
@@ -0,0 +1,85 @@
+# $XConsortium: tkerror.tcl /main/1 1996/09/21 14:15:45 kaleb $
+#
+#
+#
+#
+# tkerror.tcl --
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/tkerror.tcl,v 3.4 1996/12/27 06:55:10 dawes Exp $
+#
+# This file contains a modified version of the tkError procedure. It
+# posts a dialog box with the error message and gives the user a chance
+# to see a more detailed stack trace. It also saves a copy of the
+# stack trace to a file.
+#
+# Copyright 1996 by Joseph Moss,
+# based on the standard implementation which is:
+# Copyright (c) 1992-1994 The Regents of the University of California.
+# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+if { $tk_version > 4.0 } {
+ set errprocname bgerror
+} else {
+ set errprocname tkerror
+}
+
+proc $errprocname err {
+ global errorInfo
+ set info $errorInfo
+ set fd [open /tmp/XS[pid].err w]
+ puts $fd $errorInfo
+ close $fd
+ set button [tk_dialog .tkerrorDialog "Error in Tcl Script" \
+ "Error: $err\n\nA copy of the stack trace has been saved\
+ in the file /tmp/XS[pid].err\n\n\
+ If you think this error has not been reported before,\
+ please send a copy of that file, along with details of\
+ the problem you encountered, to joe@XFree86.org" \
+ error 0 OK "Skip Messages" "Stack Trace"]
+ if {$button == 0} {
+ return
+ } elseif {$button == 1} {
+ return -code break
+ }
+
+ set w .tkerrorTrace
+ catch {destroy $w}
+ toplevel $w -class ErrorTrace
+ wm minsize $w 1 1
+ wm title $w "Stack Trace for Error"
+ wm iconname $w "Stack Trace"
+ button $w.ok -text OK -command "destroy $w"
+ text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" \
+ -setgrid true -width 60 -height 20
+ scrollbar $w.scroll -relief sunken -command "$w.text yview"
+ pack $w.ok -side bottom -padx 3m -pady 2m
+ pack $w.scroll -side right -fill y
+ pack $w.text -side left -expand yes -fill both
+ $w.text insert 0.0 $info
+ $w.text mark set insert 0.0
+
+ # Center the window on the screen.
+
+ wm withdraw $w
+ update idletasks
+ set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
+ - [winfo vrootx [winfo parent $w]]]
+ set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
+ - [winfo vrooty [winfo parent $w]]]
+ wm geom $w +$x+$y
+ wm deiconify $w
+
+ # Be sure to release any grabs that might be present on the
+ # screen, since they could make it impossible for the user
+ # to interact with the stack trace.
+
+ if {[grab current .] != ""} {
+ grab release [grab current .]
+ }
+}
+
+unset errprocname
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/uparrow.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/uparrow.xbm
new file mode 100644
index 000000000..8ea0081ab
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/uparrow.xbm
@@ -0,0 +1,5 @@
+#define uparrow_width 13
+#define uparrow_height 14
+static char uparrow_bits[] = {
+ 0x80,0x00,0xc0,0x01,0xe0,0x03,0x70,0x07,0xf8,0x0f,0x4c,0x19,0xc0,0x01,0x40,
+ 0x01,0xc0,0x01,0x40,0x01,0xc0,0x01,0x40,0x01,0xc0,0x01,0x40,0x01};
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/wider.xbm b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/wider.xbm
new file mode 100644
index 000000000..afa61f476
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/wider.xbm
@@ -0,0 +1,11 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tcllib/wider.xbm,v 1.1 1999/04/05 07:13:05 dawes Exp $ */
+#define larger_width 24
+#define larger_height 24
+static unsigned char larger_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xfe, 0xff, 0x7f, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
+ 0x02, 0x00, 0x40, 0x22, 0x00, 0x44, 0x12, 0x00, 0x48, 0xfa, 0xc3, 0x5f,
+ 0x12, 0x00, 0x48, 0x22, 0x00, 0x44, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40,
+ 0x02, 0x00, 0x40, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c
new file mode 100644
index 000000000..33f8641c1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c
@@ -0,0 +1,564 @@
+/* $Xconsortium: $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.c,v 3.13 1999/04/25 10:01:58 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains Tcl bindings to the XFree86-Misc extension
+
+ */
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/xf86misc.h>
+#include <X11/Xos.h>
+#include <tcl.h>
+#include <tk.h>
+#include <ctype.h>
+#include "tclmisc.h"
+
+#if X_NOT_STDC_ENV
+int atoi(
+#if NeedFunctionPrototypes
+ char *str
+#endif
+);
+#endif
+
+static int (*savErrorFunc)();
+static int errorOccurred;
+static char errMsgBuf[512];
+
+int XF86Misc_Init(Tcl_Interp *interp);
+
+static int miscError(Display *dis, XErrorEvent *err)
+{
+ XGetErrorText(dis, err->error_code, errMsgBuf, 512);
+ errorOccurred = TRUE;
+ return 0;
+}
+
+/*
+ Adds all the xf86misc specific commands to the Tcl interpreter
+*/
+
+int
+XF86Misc_Init(interp)
+Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "xf86misc_getversion",
+ TCL_XF86MiscQueryVersion, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_getbasevals",
+ TCL_XF86MiscQueryExtension, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_getsaver",
+ TCL_XF86MiscGetSaver, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_setsaver",
+ TCL_XF86MiscSetSaver, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_getkeyboard",
+ TCL_XF86MiscGetKbdSettings, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_setkeyboard",
+ TCL_XF86MiscSetKbdSettings, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_getmouse",
+ TCL_XF86MiscGetMouseSettings, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86misc_setmouse",
+ TCL_XF86MiscSetMouseSettings, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/* Note, the characters '_', ' ', and '\t' are ignored in the comparison */
+int
+StrCaseCmp(s1, s2)
+char *s1, *s2;
+{
+ char c1, c2;
+
+ if (*s1 == 0)
+ if (*s2 == 0)
+ return(0);
+ else
+ return(1);
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ while (c1 == c2)
+ {
+ if (c1 == '\0')
+ return(0);
+ s1++; s2++;
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ }
+ return(c1 - c2);
+}
+
+/*
+ Implements the xf86misc_getversion command which
+ returns (in interp->result) the version of the
+ XFree86-MiscExtension that is built into the X server
+ The version is returned simple floating point number (e.g. 0.4)
+*/
+
+int
+TCL_XF86MiscQueryVersion(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int MajorVersion, MinorVersion;
+ Tk_Window tkwin;
+ char tmpbuf[16];
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86misc_getversion", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ if (!XF86MiscQueryVersion(Tk_Display(tkwin), &MajorVersion, &MinorVersion))
+ {
+ Tcl_AppendResult(interp,
+ "Could not query XF86Misc extension version",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(tmpbuf, "%d.%d", MajorVersion, MinorVersion);
+ Tcl_AppendResult(interp, tmpbuf, (char *) NULL);
+ return TCL_OK;
+ }
+}
+
+
+/*
+ Implements the xf86misc_getbasevals command which
+ returns (in interp->result) a list containing two elements.
+ The first element is the EventBase and the second is the ErrorBase
+*/
+
+int
+TCL_XF86MiscQueryExtension(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ int eventBase, errorBase;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86misc_getbasevals", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ if (!XF86MiscQueryExtension(Tk_Display(tkwin),
+ &eventBase, &errorBase)) {
+ Tcl_AppendResult(interp,
+ "Unable to query XF86Misc extension information",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ sprintf(interp->result, "%d %d", eventBase, errorBase);
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86misc_getsaver command which
+ returns (in interp->result) a list containing the
+ powersaver timeouts
+*/
+
+int
+TCL_XF86MiscGetSaver(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86misc_getsaver", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+#if 0
+ if (!XF86MiscGetSaver(Tk_Display(tkwin), Tk_ScreenNumber(tkwin),
+ &suspendtime, &offtime)) {
+ Tcl_AppendResult(interp,
+ "Unable to get screen saver timeouts",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(interp->result, "%d %d", suspendtime, offtime);
+ return TCL_OK;
+ }
+#else
+ return TCL_OK;
+#endif
+}
+
+/*
+ Implements the xf86misc_setsaver command which
+ sets the powersaver timeouts
+*/
+
+int
+TCL_XF86MiscSetSaver(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int suspendtime, offtime;
+ Tk_Window tkwin;
+
+ if (argc != 3) {
+ Tcl_SetResult(interp,
+ "Usage: xf86misc_setsaver <suspendtime> <offtime>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ suspendtime = atoi(argv[1]);
+ offtime = atoi(argv[2]);
+
+#if 0
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(miscError);
+ errorOccurred = 0;
+ XF86MiscSetSaver(Tk_Display(tkwin), Tk_ScreenNumber(tkwin),
+ suspendtime, offtime);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp,
+ "Unable to set screen saver timeouts: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+#endif
+ return TCL_OK;
+}
+
+static char *kbdtable[] = { "None", "84Key", "101Key", "Other", "Xqueue" };
+/*
+ Implements the xf86misc_getkeyboard command which
+ returns (in interp->result) a list containing the
+ keyboard settings
+*/
+
+int
+TCL_XF86MiscGetKbdSettings(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XF86MiscKbdSettings kbdinfo;
+ Tk_Window tkwin;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86misc_getkeyboard", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ if (!XF86MiscGetKbdSettings(Tk_Display(tkwin), &kbdinfo)) {
+ Tcl_AppendResult(interp,
+ "Unable to get keyboard settings",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(interp->result, "%s %d %d %s",
+ kbdtable[kbdinfo.type], kbdinfo.delay, kbdinfo.rate,
+ kbdinfo.servnumlock? "on": "off");
+ return TCL_OK;
+ }
+}
+
+/*
+ Implements the xf86misc_setkeyboard command which
+ sets the keyboard settings
+*/
+
+int
+TCL_XF86MiscSetKbdSettings(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XF86MiscKbdSettings kbdinfo;
+ Tk_Window tkwin;
+ int i;
+ char *usage = "Usage: xf86misc_setkeyboard 84Key|101Key|Other|Xqueue"
+ " <delay> <rate> on|off";
+
+ if (argc != 5) {
+ Tcl_SetResult(interp, usage, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ kbdinfo.type = -1;
+ for (i = 1; i < sizeof(kbdtable)/sizeof(char *); i++) {
+ if (!StrCaseCmp(kbdtable[i], argv[1])) {
+ kbdinfo.type = i;
+ }
+ }
+ if (kbdinfo.type == -1) {
+ Tcl_AppendResult(interp, "Invalid keyboard type\n",
+ usage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ kbdinfo.delay = atoi(argv[2]);
+ kbdinfo.rate = atoi(argv[3]);
+ if (!StrCaseCmp(argv[4], "on"))
+ kbdinfo.servnumlock = 1;
+ else if (!StrCaseCmp(argv[4], "off"))
+ kbdinfo.servnumlock = 0;
+ else {
+ Tcl_AppendResult(interp, "Option must be either on or off\n",
+ usage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(miscError);
+ errorOccurred = 0;
+ XF86MiscSetKbdSettings(Tk_Display(tkwin), &kbdinfo);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp,
+ "Unable to set keyboard settings: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+static char *msetable[] = { "None", "Microsoft", "MouseSystems", "MMSeries",
+ "Logitech", "BusMouse", "Mouseman", "PS/2",
+ "MMHitTab", "GlidePoint", "IntelliMouse",
+ "ThinkingMouse", "IMPS/2", "ThinkingMousePS/2",
+ "MouseManPlusPS/2", "GlidePointPS/2",
+ "NetMousePS/2", "NetScrollPS/2", "SysMouse",
+ "Auto", "Xqueue", "OSMouse" };
+#define MSETABLESIZE (sizeof(msetable)/sizeof(char *))
+
+/*
+ Implements the xf86misc_getmouse command which
+ returns (in interp->result) a list containing the
+ mouse settings
+*/
+
+int
+TCL_XF86MiscGetMouseSettings(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XF86MiscMouseSettings mseinfo;
+ Tk_Window tkwin;
+ char tmpbuf[200];
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86misc_getmouse", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ if (!XF86MiscGetMouseSettings(Tk_Display(tkwin), &mseinfo)) {
+ Tcl_AppendResult(interp,
+ "Unable to get mouse settings",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ char *name;
+ if (mseinfo.type == MTYPE_XQUEUE)
+ name = "Xqueue";
+ else if (mseinfo.type == MTYPE_OSMOUSE)
+ name = "OSMouse";
+ else if (mseinfo.type < 0 || (mseinfo.type >= MSETABLESIZE))
+ name = "Unknown";
+ else
+ name = msetable[mseinfo.type+1];
+ sprintf(tmpbuf, "%s %s %d %d %d %d %s %d %s",
+ mseinfo.device==NULL? "{}": mseinfo.device,
+ name,
+ mseinfo.baudrate, mseinfo.samplerate,
+ mseinfo.resolution, mseinfo.buttons,
+ mseinfo.emulate3buttons? "on": "off",
+ mseinfo.emulate3timeout,
+ mseinfo.chordmiddle? "on": "off");
+ if (mseinfo.flags & MF_CLEAR_DTR)
+ strcat(tmpbuf, " ClearDTR");
+ if (mseinfo.flags & MF_CLEAR_RTS)
+ strcat(tmpbuf, " ClearRTS");
+ Tcl_SetResult(interp, tmpbuf, TCL_VOLATILE);
+ if (mseinfo.device) {
+ XtFree(mseinfo.device);
+ }
+ return TCL_OK;
+ }
+}
+
+/*
+ Implements the xf86misc_setmouse command which
+ sets the mouse settings
+*/
+
+static char *setmouseusage =
+ "Usage: xf86misc_setmouse <device> <mousetype>"
+ " <baudrate> <samplerate> <resolution> <buttons>"
+ " on|off <timeout> on|off [ClearDTR] [ClearRTS] [ReOpen]";
+
+int
+TCL_XF86MiscSetMouseSettings(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ XF86MiscMouseSettings mseinfo;
+ int i;
+ Tk_Window tkwin;
+
+ if (argc < 9 || argc > 12) {
+ Tcl_SetResult(interp, setmouseusage, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == (Tk_Window) NULL)
+ return TCL_ERROR;
+ mseinfo.device = argv[1];
+ mseinfo.type = -1;
+ for (i = 1; i < sizeof(msetable)/sizeof(char *); i++) {
+ if (!StrCaseCmp(msetable[i], argv[2])) {
+ mseinfo.type = i - 1;
+ }
+ }
+ if (!StrCaseCmp("Xqueue", argv[2]))
+ mseinfo.type = MTYPE_XQUEUE;
+ else if (!StrCaseCmp("OSMouse", argv[2]))
+ mseinfo.type = MTYPE_OSMOUSE;
+ if (mseinfo.type == -1) {
+ Tcl_AppendResult(interp, "Invalid mouse type\n",
+ setmouseusage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ mseinfo.baudrate = atoi(argv[3]);
+ mseinfo.samplerate = atoi(argv[4]);
+ mseinfo.resolution = atoi(argv[5]);
+ mseinfo.buttons = atoi(argv[6]);
+ if (!StrCaseCmp(argv[7], "on"))
+ mseinfo.emulate3buttons = 1;
+ else if (!StrCaseCmp(argv[7], "off"))
+ mseinfo.emulate3buttons = 0;
+ else {
+ Tcl_AppendResult(interp, "Option must be either on or off\n",
+ setmouseusage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ mseinfo.emulate3timeout = atoi(argv[8]);
+ if (!StrCaseCmp(argv[9], "on"))
+ mseinfo.chordmiddle = 1;
+ else if (!StrCaseCmp(argv[9], "off"))
+ mseinfo.chordmiddle = 0;
+ else {
+ Tcl_AppendResult(interp, "Option must be either on or off\n",
+ setmouseusage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ mseinfo.flags = 0;
+ for (i = 10; i < argc; i++) {
+ if (!StrCaseCmp(argv[i], "cleardtr"))
+ mseinfo.flags |= MF_CLEAR_DTR;
+ else if (!StrCaseCmp(argv[i], "clearrts"))
+ mseinfo.flags |= MF_CLEAR_RTS;
+ else if (!StrCaseCmp(argv[i], "reopen"))
+ mseinfo.flags |= MF_REOPEN;
+ else {
+ Tcl_AppendResult(interp,
+ "Flag must be one of ClearDTR,"
+ "ClearRTS, or ReOpen\n",
+ setmouseusage, (char *) NULL);
+ return TCL_ERROR;
+ }
+ }
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(miscError);
+ errorOccurred = 0;
+ XF86MiscSetMouseSettings(Tk_Display(tkwin), &mseinfo);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp,
+ "Unable to set mouse settings: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.h b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.h
new file mode 100644
index 000000000..10766f714
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.h
@@ -0,0 +1,93 @@
+/* $Xconsortium: $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclmisc.h,v 3.2 1996/12/27 06:54:18 dawes Exp $ */
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/xf86misc.h>
+#include <tcl.h>
+#include <tk.h>
+
+int TCL_XF86MiscQueryVersion(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscQueryExtension(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscGetSaver(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscSetSaver(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscGetKbdSettings(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscSetKbdSettings(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscGetMouseSettings(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86MiscSetMouseSettings(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int StrCaseCmp(
+#if NeedNestedPrototypes
+ char *string1,
+ char *string2
+#endif
+);
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c
new file mode 100644
index 000000000..a2850ef20
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c
@@ -0,0 +1,558 @@
+/* $XConsortium: tclother.c /main/3 1996/10/28 04:46:43 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclother.c,v 3.9 1996/12/27 06:54:19 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains routines to add a few misc commands to Tcl
+
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+#include <X11/Xfuncs.h>
+#include <tcl.h>
+#include <tk.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static int TCL_XF86GetUID(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86ServerRunning(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86ProcessRunning(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86HasSymlinks(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86Link(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86UnLink(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86Umask(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86MkDir(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86RmDir(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+static int TCL_XF86Sleep(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+#if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION == 4
+static int TCL_XF86Clock(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+#endif
+
+/*
+ Adds all the new commands to the Tcl interpreter
+*/
+
+int
+XF86Other_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "getuid",
+ TCL_XF86GetUID, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "server_running",
+ TCL_XF86ServerRunning, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "process_running",
+ TCL_XF86ProcessRunning, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "has_symlinks",
+ TCL_XF86HasSymlinks, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "link",
+ TCL_XF86Link, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "unlink",
+ TCL_XF86UnLink, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "umask",
+ TCL_XF86Umask, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "mkdir",
+ TCL_XF86MkDir, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "rmdir",
+ TCL_XF86RmDir, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "sleep",
+ TCL_XF86Sleep, (ClientData) NULL,
+ (void (*)()) NULL);
+
+#if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION == 4
+ Tcl_CreateCommand(interp, "clock",
+ TCL_XF86Clock, (ClientData) NULL,
+ (void (*)()) NULL);
+#endif
+
+ return TCL_OK;
+}
+
+/*
+ Returns the users numeric id
+*/
+
+int
+TCL_XF86GetUID(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: getuid", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ /* This is short, so we can write directly into the
+ pre-allocated buffer */
+ sprintf(interp->result, "%d", (int) getuid());
+ return TCL_OK;
+}
+
+/*
+ Trivial error handler used to ignore failed attempts to connect
+ to the server
+*/
+
+static int ignoreErrors(disp, error)
+ Display *disp;
+ XErrorEvent *error;
+{
+ return 0;
+}
+
+/*
+ Attempt to connect to an Xserver.
+ Also used to close the connection opened in a previous call.
+*/
+
+int
+TCL_XF86ServerRunning(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ static Tcl_HashTable connectTable;
+ static Bool initted = False;
+ Tcl_HashEntry *entry;
+ int new, (*old)();
+ Display *display;
+
+ if (!initted) {
+ initted = True;
+ Tcl_InitHashTable(&connectTable, TCL_STRING_KEYS);
+ }
+ if (argc < 2 || argc > 3
+ || (argc == 3 && strcmp(argv[1],"-close")) ) {
+ Tcl_SetResult(interp,
+ "Usage: server_running [-close] <display>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (argc == 3) {
+ entry = Tcl_FindHashEntry(&connectTable, argv[2]);
+ if (entry == NULL) {
+ Tcl_SetResult(interp, "No connection to display",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ display = (Display *) Tcl_GetHashValue(entry);
+ XCloseDisplay(display);
+ Tcl_DeleteHashEntry(entry);
+ } else {
+ entry = Tcl_FindHashEntry(&connectTable, argv[1]);
+ if (entry != NULL) {
+ Tcl_SetResult(interp,
+ "Connection to display already open",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ old = XSetErrorHandler(ignoreErrors);
+ display = XOpenDisplay(argv[1]);
+ if (display == (Display *) NULL) {
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ } else {
+ entry = Tcl_CreateHashEntry(&connectTable, argv[1], &new);
+ Tcl_SetHashValue(entry, display);
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ XSync(display, False);
+ }
+ (void) XSetErrorHandler(old);
+ }
+ return TCL_OK;
+}
+
+/*
+ Check if the specified process is running
+*/
+
+int
+TCL_XF86ProcessRunning(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: process_running <pid>",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (kill(atoi(argv[1]), 0) == 0) {
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ } else {
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ }
+ return TCL_OK;
+}
+
+/*
+ Return 1 if the system supports symbolic links, zero otherwise
+*/
+
+int
+TCL_XF86HasSymlinks(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: has_symlinks", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+#ifdef S_IFLNK
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+#else
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+#endif
+ return TCL_OK;
+}
+
+/*
+ Make a link from one file to another (use symlinks, if available)
+*/
+
+int
+TCL_XF86Link(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 3) {
+ Tcl_SetResult(interp, "Usage: link <oldfilename> <newfilename>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+#ifdef S_IFLNK
+ if (symlink(argv[1], argv[2]) == -1)
+#else
+ if (link(argv[1], argv[2]) == -1)
+#endif
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ else
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ return TCL_OK;
+}
+
+/*
+ Delete the specified file
+*/
+
+int
+TCL_XF86UnLink(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: unlink <filename>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (unlink(argv[1]) == -1)
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ else
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ return TCL_OK;
+}
+
+/*
+ Set the umask
+*/
+
+int
+TCL_XF86Umask(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int mode;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: umask <value>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetInt(interp, argv[1], &mode) != TCL_OK)
+ return TCL_ERROR;
+ if (umask((mode_t) mode) == (mode_t)-1)
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ else
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ return TCL_OK;
+}
+
+/*
+ Create the named directory
+*/
+
+int
+TCL_XF86MkDir(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int mode = 0777;
+
+ if (argc < 2 || argc > 3) {
+ Tcl_SetResult(interp, "Usage: mkdir <dirname> [<mode>]", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (argc == 3) {
+ if (Tcl_GetInt(interp, argv[2], &mode) != TCL_OK)
+ return TCL_ERROR;
+ }
+
+ if (mkdir(argv[1], mode) == -1)
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ else
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ return TCL_OK;
+}
+
+/*
+ Remove the specified directory
+*/
+
+int
+TCL_XF86RmDir(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: rmdir <dirname>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (rmdir(argv[1]) == -1)
+ Tcl_SetResult(interp, "0", TCL_STATIC);
+ else
+ Tcl_SetResult(interp, "1", TCL_STATIC);
+ return TCL_OK;
+}
+
+/*
+ Pause for the specified number of seconds
+*/
+
+int
+TCL_XF86Sleep(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc != 2) {
+ Tcl_SetResult(interp, "Usage: sleep <seconds>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ sleep(atoi(argv[1]));
+ return TCL_OK;
+}
+
+#if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION == 4
+/*
+ Emulate a subset of the Tcl 7.5 clock command
+*/
+
+#ifdef X_NOT_STDC_ENV
+extern long time();
+#else
+#include <time.h>
+#endif
+
+int
+TCL_XF86Clock(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"",
+ argv[0], " option ?arg ...?\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(argv[1], "clicks")) {
+ if (argc != 2) {
+ Tcl_AppendResult(interp, "wrong # arguments: must be \"",
+ argv[0], " clicks\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+#ifndef AMOEBA
+ {
+ struct timeval tp;
+
+ X_GETTIMEOFDAY(&tp);
+ sprintf(interp->result, "%lu",
+ tp.tv_sec*1000000 + tp.tv_usec);
+ }
+#else
+ sprintf(interp->result, "%lu", sys_milli());
+#endif
+ return TCL_OK;
+ } else if (!strcmp(argv[1], "seconds")) {
+ if (argc != 2) {
+ Tcl_AppendResult(interp, "wrong # arguments: must be \"",
+ argv[0], " seconds\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ sprintf(interp->result, "%ld", (long) time(0));
+ } else {
+ Tcl_AppendResult(interp, "unknown option \"", argv[1],
+ "\": must be clicks, format, scan, or seconds",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+}
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.c
new file mode 100644
index 000000000..135ee6c38
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.c
@@ -0,0 +1,834 @@
+/* $XConsortium: tclvidmode.c /main/2 1996/10/19 19:06:29 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.c,v 3.9 1997/07/10 08:17:20 hohndel Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains Tcl bindings to the XFree86-VidModeExtension
+
+ */
+
+#define NOT_YET_IMPLEMENTED 0
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/xf86vmode.h>
+#include <tcl.h>
+#include <tk.h>
+#include "tclvidmode.h"
+
+/* Mode flags -- ignore flags not in V_FLAG_MASK */
+#define V_FLAG_MASK 0x1FF;
+#define V_PHSYNC 0x001
+#define V_NHSYNC 0x002
+#define V_PVSYNC 0x004
+#define V_NVSYNC 0x008
+#define V_INTERLACE 0x010
+#define V_DBLSCAN 0x020
+#define V_CSYNC 0x040
+#define V_PCSYNC 0x080
+#define V_NCSYNC 0x100
+#define V_HSKEW 0x200
+
+static int (*savErrorFunc)();
+static int errorOccurred;
+static char errMsgBuf[512];
+
+/*
+ Simple error handler
+*/
+static int vidError(dis, err)
+Display *dis;
+XErrorEvent *err;
+{
+ XGetErrorText(dis, err->error_code, errMsgBuf, 512);
+ errorOccurred = TRUE;
+ return 0;
+}
+
+static int modeline2list(interp, mode_line)
+ Tcl_Interp *interp;
+ XF86VidModeModeInfo *mode_line;
+{
+ sprintf(interp->result, "%6.2f %d %d %d %d %d %d %d %d",
+ mode_line->dotclock/1000.0,
+ mode_line->hdisplay, mode_line->hsyncstart,
+ mode_line->hsyncend, mode_line->htotal,
+ mode_line->vdisplay, mode_line->vsyncstart,
+ mode_line->vsyncend, mode_line->vtotal);
+#define chkflag(flg,string) if (mode_line->flags & flg) \
+ Tcl_AppendResult(interp, string, (char *) NULL)
+ chkflag(V_PHSYNC," +hsync");
+ chkflag(V_NHSYNC," -hsync");
+ chkflag(V_PVSYNC," +vsync");
+ chkflag(V_NVSYNC," -vsync");
+ chkflag(V_INTERLACE," interlace");
+ chkflag(V_CSYNC," composite");
+ chkflag(V_PCSYNC," +csync");
+ chkflag(V_NCSYNC," -csync");
+ chkflag(V_DBLSCAN," doublescan");
+ if (mode_line->flags & V_HSKEW) {
+ char tmpbuf[16];
+ sprintf(tmpbuf, "%d", mode_line->hskew);
+ Tcl_AppendResult(interp, " doublescan ", tmpbuf, (char *) NULL);
+ }
+#undef chkflag
+ return TCL_OK;
+}
+
+#define TclOkay(expr) if ((expr) != TCL_OK) return TCL_ERROR
+
+static int list2modeline(interp, buf, mode_line)
+ Tcl_Interp *interp;
+ char *buf;
+ XF86VidModeModeInfo *mode_line;
+{
+ char **av;
+ int ac, i, tmpint;
+ double tmpdbl;
+
+ TclOkay(Tcl_SplitList(interp, buf, &ac, &av));
+ if (ac < 9) return TCL_ERROR;
+
+ mode_line->hskew = 0;
+
+ TclOkay(Tcl_GetDouble(interp, av[0], &tmpdbl));
+ mode_line->dotclock = (int) (tmpdbl * 1000.0);
+
+ TclOkay(Tcl_GetInt(interp, av[1], &tmpint));
+ mode_line->hdisplay = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[2], &tmpint));
+ mode_line->hsyncstart = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[3], &tmpint));
+ mode_line->hsyncend = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[4], &tmpint));
+ mode_line->htotal = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[5], &tmpint));
+ mode_line->vdisplay = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[6], &tmpint));
+ mode_line->vsyncstart = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[7], &tmpint));
+ mode_line->vsyncend = (unsigned short) tmpint;
+ TclOkay(Tcl_GetInt(interp, av[8], &tmpint));
+ mode_line->vtotal = (unsigned short) tmpint;
+
+ mode_line->flags = 0;
+ for (i = 9; i < ac; i++) {
+ if (!strcmp(av[i], "+hsync")) mode_line->flags |= V_PHSYNC;
+ else if (!strcmp(av[i], "-hsync")) mode_line->flags |= V_NHSYNC;
+ else if (!strcmp(av[i], "+vsync")) mode_line->flags |= V_PVSYNC;
+ else if (!strcmp(av[i], "-vsync")) mode_line->flags |= V_NVSYNC;
+ else if (!strcmp(av[i], "interlace")) mode_line->flags |= V_INTERLACE;
+ else if (!strcmp(av[i], "composite")) mode_line->flags |= V_CSYNC;
+ else if (!strcmp(av[i], "+csync")) mode_line->flags |= V_PCSYNC;
+ else if (!strcmp(av[i], "-csync")) mode_line->flags |= V_NCSYNC;
+ else if (!strcmp(av[i], "doublescan")) mode_line->flags |= V_DBLSCAN;
+ else if (!strcmp(av[i], "hskew") && i < ac-1) {
+ mode_line->flags |= V_HSKEW;
+ TclOkay(Tcl_GetInt(interp, av[++i], &tmpint));
+ mode_line->hskew = (unsigned short) tmpint;
+ } else {
+ Tcl_AppendResult(interp, "Invalid mode flag: ", av[i], (char *)0);
+ return TCL_ERROR;
+ }
+ }
+ mode_line->privsize = 0;
+ mode_line->private = NULL;
+ return TCL_OK;
+}
+
+/*
+ Adds all the vidmode specific commands to the Tcl interpreter
+*/
+
+int
+XF86vid_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "xf86vid_getversion",
+ TCL_XF86VidModeQueryVersion, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_getbasevals",
+ TCL_XF86VidModeQueryExtension, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_addmodeline",
+ TCL_XF86VidModeAddModeLine, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_modifymodeline",
+ TCL_XF86VidModeModModeLine, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_checkmodeline",
+ TCL_XF86VidModeValidateModeLine, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_deletemodeline",
+ TCL_XF86VidModeDeleteModeLine, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_getmodeline",
+ TCL_XF86VidModeGetModeLine, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_getallmodelines",
+ TCL_XF86VidModeGetAllModeLines, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_lockmodeswitch",
+ TCL_XF86VidModeLockModeSwitch, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_switchmode",
+ TCL_XF86VidModeSwitchMode, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_switchtomode",
+ TCL_XF86VidModeSwitchToMode, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_getmonitor",
+ TCL_XF86VidModeGetMonitor, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86vid_getclocks",
+ TCL_XF86VidModeGetDotClocks, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_getversion command which
+ returns (in interp->result) the version of the
+ XFree86-VidModeExtension that is built into the X server
+ The version is returned simple floating point number (e.g. 0.4)
+*/
+
+int
+TCL_XF86VidModeQueryVersion(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int MajorVersion, MinorVersion;
+ Tk_Window tkwin;
+ char tmpbuf[16];
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86vid_getversion", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if (!XF86VidModeQueryVersion(Tk_Display(tkwin), &MajorVersion, &MinorVersion))
+ {
+ Tcl_AppendResult(interp,
+ "Could not query vidmode extension version",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(tmpbuf, "%d.%d", MajorVersion, MinorVersion);
+ Tcl_AppendResult(interp, tmpbuf, (char *) NULL);
+ return TCL_OK;
+ }
+}
+
+
+/*
+ Implements the xf86vid_getbasevals command which
+ returns (in interp->result) a list containing two elements.
+ The first element is the EventBase and the second is the ErrorBase
+*/
+
+int
+TCL_XF86VidModeQueryExtension(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int EventBase, ErrorBase;
+ Tk_Window tkwin;
+ char tmpbuf[16];
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86vid_getbasevals", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if (!XF86VidModeQueryExtension(Tk_Display(tkwin), &EventBase, &ErrorBase)) {
+ Tcl_AppendResult(interp,
+ "Unable to query video extension information",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(tmpbuf, "%d %d", EventBase, ErrorBase);
+ Tcl_AppendResult(interp, tmpbuf, (char *) NULL);
+ return TCL_OK;
+ }
+}
+
+
+/*
+ Implements the xf86vid_addmodeline command which
+ adds a new mode to the list of video modes.
+*/
+
+int
+TCL_XF86VidModeAddModeLine(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ XF86VidModeModeInfo newmode, aftermode;
+
+ if (argc < 2 || argc > 3) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_addmodeline <new_mode> [<after_mode>]",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ TclOkay(list2modeline(interp, argv[1], &newmode));
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(vidError);
+ errorOccurred = 0;
+ XF86VidModeAddModeLine(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &newmode,
+ (argc==2)? NULL: &aftermode);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp, "Unable to add modeline: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_modifymodeline command which
+ changes the current mode is to match the specified parameters.
+*/
+
+int
+TCL_XF86VidModeModModeLine(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ XF86VidModeModeInfo mode_info;
+ XF86VidModeModeLine mode_line;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_modifymodeline <modeline>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ TclOkay(list2modeline(interp, argv[1], &mode_info));
+ mode_line.hdisplay = mode_info.hdisplay;
+ mode_line.hsyncstart = mode_info.hsyncstart;
+ mode_line.hsyncend = mode_info.hsyncend;
+ mode_line.htotal = mode_info.htotal;
+ mode_line.hskew = mode_info.hskew;
+ mode_line.vdisplay = mode_info.vdisplay;
+ mode_line.vsyncstart = mode_info.vsyncstart;
+ mode_line.vsyncend = mode_info.vsyncend;
+ mode_line.vtotal = mode_info.vtotal;
+ mode_line.flags = mode_info.flags;
+ mode_line.privsize = mode_info.privsize;
+ mode_line.private = mode_info.private;
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(vidError);
+ errorOccurred = 0;
+ XF86VidModeModModeLine(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &mode_line);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp, "Unable to modify modeline: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_checkmodeline command which
+ checks that the specified mode is usable with the
+ video driver and monitor.
+*/
+
+int
+TCL_XF86VidModeValidateModeLine(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ XF86VidModeModeInfo mode_line;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_checkmodeline <modeline>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ TclOkay(list2modeline(interp, argv[1], &mode_line));
+ sprintf(interp->result, "%d",
+ XF86VidModeValidateModeLine(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &mode_line));
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_deletemodeline command which
+ removes the specified mode from the list of valid modes
+*/
+
+int
+TCL_XF86VidModeDeleteModeLine(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ XF86VidModeModeInfo mode_line;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_deletemodeline <modeline>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ TclOkay(list2modeline(interp, argv[1], &mode_line));
+
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(vidError);
+ errorOccurred = 0;
+ XF86VidModeDeleteModeLine(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &mode_line);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp, "Unable to delete modeline: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_getmodeline command which
+ returns (in interp->result) a list containing the
+ various video mode parameters (including any flags)
+ of the current mode
+*/
+
+int
+TCL_XF86VidModeGetModeLine(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int dot_clock;
+ Tk_Window tkwin;
+ XF86VidModeModeLine mode_line;
+ XF86VidModeModeInfo mode_info;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86vid_getmodeline", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if (!XF86VidModeGetModeLine(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin),
+ &dot_clock, &mode_line)) {
+ Tcl_AppendResult(interp,
+ "Unable to get mode line information",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ XtFree((char *) mode_line.private);
+ mode_info.dotclock = dot_clock;
+ mode_info.hdisplay = mode_line.hdisplay;
+ mode_info.hsyncstart = mode_line.hsyncstart;
+ mode_info.hsyncend = mode_line.hsyncend;
+ mode_info.htotal = mode_line.htotal;
+ mode_info.hskew = mode_line.hskew;
+ mode_info.vdisplay = mode_line.vdisplay;
+ mode_info.vsyncstart = mode_line.vsyncstart;
+ mode_info.vsyncend = mode_line.vsyncend;
+ mode_info.vtotal = mode_line.vtotal;
+ mode_info.flags = mode_line.flags;
+ return modeline2list(interp, &mode_info);
+}
+
+/*
+ Implements the xf86vid_getallmodelines command which
+ returns (in interp->result) a list containing lists of the
+ various video mode parameters (including any flags)
+*/
+
+int
+TCL_XF86VidModeGetAllModeLines(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int i, modecount, mode_flags;
+ Tk_Window topwin, tkwin;
+ XF86VidModeModeInfo **modelines;
+ char tmpbuf[200], tmpbuf2[16];
+
+ if (argc != 1 && !(argc==3 && !strcmp(argv[1],"-displayof"))) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_getallmodelines [-displayof <window>]",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if (argc == 3) {
+ tkwin = Tk_NameToWindow(interp, argv[2], topwin);
+ } else
+ tkwin = topwin;
+ if (!XF86VidModeGetAllModeLines(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin),
+ &modecount, &modelines)) {
+ Tcl_AppendResult(interp,
+ "Unable to get mode line information",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ for (i = 0; i < modecount; i++) {
+ sprintf(tmpbuf, "%6.2f %d %d %d %d %d %d %d %d",
+ (float) modelines[i]->dotclock/1000.0,
+ modelines[i]->hdisplay, modelines[i]->hsyncstart,
+ modelines[i]->hsyncend, modelines[i]->htotal,
+ modelines[i]->vdisplay, modelines[i]->vsyncstart,
+ modelines[i]->vsyncend, modelines[i]->vtotal);
+ mode_flags = modelines[i]->flags;
+ if (mode_flags & V_PHSYNC) strcat(tmpbuf, " +hsync");
+ if (mode_flags & V_NHSYNC) strcat(tmpbuf, " -hsync");
+ if (mode_flags & V_PVSYNC) strcat(tmpbuf, " +vsync");
+ if (mode_flags & V_NVSYNC) strcat(tmpbuf, " -vsync");
+ if (mode_flags & V_INTERLACE) strcat(tmpbuf, " interlace");
+ if (mode_flags & V_CSYNC) strcat(tmpbuf, " composite");
+ if (mode_flags & V_PCSYNC) strcat(tmpbuf, " +csync");
+ if (mode_flags & V_NCSYNC) strcat(tmpbuf, " -csync");
+ if (mode_flags & V_DBLSCAN) strcat(tmpbuf, " doublescan");
+ if (mode_flags & V_HSKEW) {
+ strcat(tmpbuf, " hskew ");
+ sprintf(tmpbuf2, "%d", modelines[i]->hskew);
+ strcat(tmpbuf, tmpbuf2);
+ }
+ Tcl_AppendElement(interp, tmpbuf);
+ }
+ XtFree((char *) modelines);
+ return TCL_OK;
+ }
+}
+
+/*
+ Returns the monitor's manufacturer and model names and its
+ horiz and vert sync rates,
+*/
+
+int
+TCL_XF86VidModeGetMonitor(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+#define MNHSync ((int) monitor.nhsync)
+#define MNVSync ((int) monitor.nvsync)
+
+ XF86VidModeMonitor monitor;
+ Tk_Window tkwin;
+ char *Hsyncbuf, *Vsyncbuf, *tmpptr, *av[5];
+ int i;
+
+ if (argc != 1) {
+ Tcl_SetResult(interp, "Usage: xf86vid_getmonitor", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if (!XF86VidModeGetMonitor(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &monitor))
+ {
+ Tcl_AppendResult(interp,
+ "Could not get monitor information",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ av[0] = monitor.vendor;
+ av[1] = monitor.model;
+
+ tmpptr = Hsyncbuf = XtMalloc(MNHSync*14);
+ for (i = 0; i < MNHSync; i++) {
+ sprintf(tmpptr, "%s%.5g-%.5g", (i? ",": ""),
+ monitor.hsync[i].lo, monitor.hsync[i].hi);
+ tmpptr += strlen(tmpptr);
+ }
+ av[2] = Hsyncbuf;
+
+ tmpptr = Vsyncbuf = XtMalloc(MNVSync*14);
+ for (i = 0; i < MNVSync; i++) {
+ sprintf(tmpptr, "%s%.5g-%.5g", (i? ",": ""),
+ monitor.vsync[i].lo, monitor.vsync[i].hi);
+ tmpptr += strlen(tmpptr);
+ }
+ av[3] = Vsyncbuf;
+ av[4] = NULL;
+
+ Tcl_SetResult(interp, Tcl_Merge(4, av), TCL_DYNAMIC);
+ XtFree(Hsyncbuf);
+ XtFree(Vsyncbuf);
+ XtFree(monitor.vendor);
+ XtFree(monitor.model);
+ XtFree((char *) monitor.hsync);
+ XtFree((char *) monitor.vsync);
+ return TCL_OK;
+ }
+#undef MNHSync
+#undef MNVSync
+}
+
+/*
+ Turn on/off video mode switching
+*/
+
+int
+TCL_XF86VidModeLockModeSwitch(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ int lock;
+ Tk_Window tkwin;
+ static char usagemsg[] = "Usage: xf86vid_lockmodeswitch lock|unlock";
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, usagemsg, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (!strcmp(argv[1], "lock")) {
+ lock = TRUE;
+ } else if (!strcmp(argv[1], "unlock")) {
+ lock = FALSE;
+ } else {
+ Tcl_SetResult(interp, usagemsg, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(vidError);
+ errorOccurred = 0;
+ XF86VidModeLockModeSwitch(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), lock);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp, "Unable to ",
+ (lock? "":"un"), "lock mode switching: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ Change to the previous/next video mode
+*/
+
+int
+TCL_XF86VidModeSwitchMode(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+#define PREV -1
+#define NEXT 1
+ int direction;
+ Tk_Window tkwin;
+ static char usagemsg[] = "Usage: xf86vid_switchmode previous|next";
+
+ if (argc != 2) {
+ Tcl_SetResult(interp, usagemsg, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if (!strncmp(argv[1], "prev", 4)) {
+ direction = PREV;
+ } else if (!strcmp(argv[1], "next")) {
+ direction = NEXT;
+ } else {
+ Tcl_SetResult(interp, usagemsg, TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+
+ XSync(Tk_Display(tkwin), False);
+ savErrorFunc = XSetErrorHandler(vidError);
+ errorOccurred = 0;
+ XF86VidModeSwitchMode(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), direction);
+ XSync(Tk_Display(tkwin), False);
+ XSetErrorHandler(savErrorFunc);
+ if (errorOccurred) {
+ Tcl_AppendResult(interp,
+ "Unable to switch modes: ",
+ errMsgBuf, (char *) NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+#undef PREV
+#undef NEXT
+}
+
+/*
+ Implements the xf86vid_switchtomode command which
+ attempts to make the specified video mode, the current display mode
+*/
+
+int
+TCL_XF86VidModeSwitchToMode(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ XF86VidModeModeInfo mode_line;
+
+ if (argc != 2) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_switchtomode <modeline>", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ TclOkay(list2modeline(interp, argv[1], &mode_line));
+
+ sprintf(interp->result, "%d",
+ XF86VidModeSwitchToMode(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin), &mode_line));
+ return TCL_OK;
+}
+
+/*
+ Implements the xf86vid_getclocks command which
+ returns a list of available dot clocks
+*/
+
+int
+TCL_XF86VidModeGetDotClocks(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window tkwin;
+ int flags, numclocks, maxclocks, *clocks, i;
+ char tmpbuf[200];
+
+ if (argc != 1) {
+ Tcl_SetResult(interp,
+ "Usage: xf86vid_getclocks", TCL_STATIC);
+ return TCL_ERROR;
+ }
+
+ if ((tkwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+
+ if (!XF86VidModeGetDotClocks(Tk_Display(tkwin),
+ Tk_ScreenNumber(tkwin),
+ &flags, &numclocks, &maxclocks, &clocks))
+ {
+ Tcl_AppendResult(interp,
+ "Unable to get dot clock information",
+ (char *) NULL);
+ return TCL_ERROR;
+ } else {
+ sprintf(tmpbuf, "%d",
+ maxclocks * ((flags&CLKFLAG_PROGRAMABLE)? -1: 1));
+ Tcl_SetResult(interp, tmpbuf, TCL_VOLATILE);
+
+ for (i = 0; i < numclocks; i++) {
+ sprintf(tmpbuf, "%d", clocks[i]);
+ Tcl_AppendElement(interp, tmpbuf);
+ }
+ }
+
+ return TCL_OK;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.h b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.h
new file mode 100644
index 000000000..436762d91
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.h
@@ -0,0 +1,131 @@
+/* $XConsortium: tclvidmode.h /main/2 1996/10/19 19:06:34 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclvidmode.h,v 3.5 1997/07/10 08:17:20 hohndel Exp $ */
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/xf86vmode.h>
+#include <tcl.h>
+#include <tk.h>
+
+int TCL_XF86VidModeQueryVersion(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeQueryExtension(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeAddModeLine(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeModModeLine(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeValidateModeLine(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeDeleteModeLine(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeGetModeLine(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeGetAllModeLines(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeGetMonitor(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeLockModeSwitch(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeSwitchMode(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeSwitchToMode(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
+int TCL_XF86VidModeGetDotClocks(
+#if NeedNestedPrototypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+#endif
+);
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c
new file mode 100644
index 000000000..8d3dcbb52
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c
@@ -0,0 +1,339 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxfconf.c,v 3.28 1999/07/12 08:14:26 dawes Exp $ */
+/*
+ * Copyright 1996,1999 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/* $XConsortium: tclxfconf.c /main/3 1996/10/23 11:44:07 kaleb $ */
+
+
+/*
+
+ This file contains Tcl bindings to the XF86Config file read/write routines
+
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+
+#ifdef NEW_INPUT
+#include "xf86Xinput.h"
+#include "mouse.h"
+#endif
+
+#include "tcl.h"
+
+#include "xfsconf.h"
+
+#if NeedVarargsPrototypes
+#include <stdarg.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+
+XF86ConfigPtr config_list;
+
+Tcl_Interp *errinterp;
+
+Bool Must_have_memory = FALSE;
+
+#ifndef NEW_INPUT
+SymTabRec xfsMouseTab[] = {
+ { PROT_MS, "microsoft" },
+ { PROT_MSC, "mousesystems" },
+ { PROT_MM, "mmseries" },
+ { PROT_LOGI, "logitech" },
+ { PROT_BM, "busmouse" },
+ { PROT_LOGIMAN, "mouseman" },
+ { PROT_PS2, "ps/2" },
+ { PROT_MMHIT, "mmhittab" },
+ { PROT_GLIDEPOINT, "glidepoint" },
+ { PROT_IMSERIAL, "intellimouse" },
+ { PROT_THINKING, "thinkingmouse" },
+ { PROT_IMPS2, "imps/2" },
+ { PROT_THINKINGPS2, "thinkingmouseps/2" },
+ { PROT_MMANPLUSPS2, "mousemanplusps/2" },
+ { PROT_GLIDEPOINTPS2, "glidepointps/2" },
+ { PROT_NETPS2, "netmouseps/2" },
+ { PROT_NETSCROLLPS2, "netscrollps/2" },
+ { PROT_SYSMOUSE, "sysmouse" },
+ { PROT_WSMOUSE, "wsmouse" },
+ { PROT_AUTO, "auto" },
+ { -1, "" },
+};
+#endif
+
+/* Error handling functions */
+
+#if NeedVarargsPrototypes
+void
+VErrorF(f, args)
+ const char *f;
+ va_list args;
+{
+ char tmpbuf[1024];
+ vsprintf(tmpbuf, f, args);
+ Tcl_AppendResult(errinterp, tmpbuf, (char *) NULL);
+}
+#endif
+
+/*VARARGS1*/
+void
+ErrorF(
+#if NeedVarargsPrototypes
+ const char * f, ...)
+#else
+ f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
+ char *f;
+ char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+#endif
+{
+#if NeedVarargsPrototypes
+ va_list args;
+ va_start(args, f);
+ VErrorF(f, args);
+ va_end(args);
+#else
+ char tmpbuf[1024];
+#ifdef AMOEBA
+ mu_lock(&print_lock);
+#endif
+ sprintf( tmpbuf, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
+ Tcl_AppendResult(errinterp, tmpbuf, (char *) NULL);
+#ifdef AMOEBA
+ mu_unlock(&print_lock);
+#endif
+#endif
+}
+
+/*VARARGS1*/
+void
+FatalError(
+#if NeedVarargsPrototypes
+ const char *f, ...)
+#else
+f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
+ char *f;
+ char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+#endif
+{
+#if NeedVarargsPrototypes
+ va_list args;
+#endif
+ ErrorF("\nFatal server error:\n");
+#if NeedVarargsPrototypes
+ va_start(args, f);
+ VErrorF(f, args);
+ va_end(args);
+#else
+ ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
+#endif
+ ErrorF("\n");
+}
+
+/*
+ Adds the config file R/W commands to the Tcl interpreter
+*/
+
+int
+XF86Config_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "xf86config_readfile",
+ TCL_XF86ReadXF86Config, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ Tcl_CreateCommand(interp, "xf86config_writefile",
+ TCL_XF86WriteXF86Config, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ Convert the given value to a string representation in the specified
+ base. If the value is zero, return an empty string
+*/
+
+char *NonZeroStr(val, base)
+ unsigned long val;
+ int base;
+{
+ static char tmpbuf[16];
+
+ if (val) {
+ if (base == 16)
+ sprintf(tmpbuf, "%#lx", val);
+ else
+ sprintf(tmpbuf, "%ld", val);
+ return tmpbuf;
+ } else
+ return "";
+}
+
+/* other subroutines */
+
+#define DIR_FILE "/fonts.dir"
+
+/*
+ * xf86GetPathElem --
+ * Extract a single element from the font path string starting at
+ * pnt. The font path element will be returned, and pnt will be
+ * updated to point to the start of the next element, or set to
+ * NULL if there are no more.
+ *
+ * Taken from xf86Config.c.
+ */
+char *
+get_path_elem(pnt)
+ char **pnt;
+{
+ char *p1;
+
+ p1 = *pnt;
+ *pnt = strchr(*pnt, ',');
+ if (*pnt != NULL) {
+ **pnt = '\0';
+ *pnt += 1;
+ }
+ return(p1);
+}
+
+/*
+ * xf86ValidateFontPath --
+ * Validates the user-specified font path. Each element that
+ * begins with a '/' is checked to make sure the directory exists.
+ * If the directory exists, the existence of a file named 'fonts.dir'
+ * is checked. If either check fails, an error is printed and the
+ * element is removed from the font path.
+ *
+ * Taken from xf86Config.c.
+ */
+#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type))
+char *
+validate_font_path(path)
+ char *path;
+{
+ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+ struct stat stat_buf;
+ int flag;
+ int dirlen;
+
+ tmp_path = (char *)XtCalloc(1,strlen(path)+1);
+ out_pnt = tmp_path;
+ path_elem = NULL;
+ next = path;
+ while (next != NULL) {
+ path_elem = get_path_elem(&next);
+#ifndef __EMX__
+ if (*path_elem == '/') {
+ dir_elem = (char *)XtCalloc(1, strlen(path_elem) + 1);
+ if ((p1 = strchr(path_elem, ':')) != 0)
+#else
+ /* OS/2 must prepend X11ROOT */
+ if (*path_elem == '/') {
+ path_elem = (char*)__XOS2RedirRoot(path_elem);
+ dir_elem = (char*)XtCalloc(1, strlen(path_elem) + 1);
+ if (p1 = strchr(path_elem+2, ':'))
+#endif
+ dirlen = p1 - path_elem;
+ else
+ dirlen = strlen(path_elem);
+ strncpy(dir_elem, path_elem, dirlen);
+ dir_elem[dirlen] = '\0';
+ flag = stat(dir_elem, &stat_buf);
+ if (flag == 0)
+ if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR))
+ flag = -1;
+ if (flag != 0) {
+ ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem);
+ ErrorF(" Entry deleted from font path.\n");
+ continue;
+ }
+ else {
+ p1 = (char *)XtMalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
+ strcpy(p1, dir_elem);
+ strcat(p1, DIR_FILE);
+ flag = stat(p1, &stat_buf);
+ if (flag == 0)
+ if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG))
+ flag = -1;
+#ifndef __EMX__
+ XtFree(p1);
+#endif
+ if (flag != 0) {
+ ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ ErrorF(" Entry deleted from font path.\n");
+ ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ continue;
+ }
+ }
+ XtFree(dir_elem);
+ }
+
+ /*
+ * Either an OK directory, or a font server name. So add it to
+ * the path.
+ */
+ if (out_pnt != tmp_path)
+ *out_pnt++ = ',';
+ strcat(out_pnt, path_elem);
+ out_pnt += strlen(path_elem);
+ }
+ return(tmp_path);
+}
+
+/*
+ * xf86TokenToString --
+ * returns the string corresponding to token
+ */
+char *
+token_to_string(SymTabPtr table, int token)
+{
+ int i;
+
+ for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
+ ;
+ if (table[i].token < 0)
+ return("unknown");
+ else
+ return((char *) table[i].name);
+}
+
+/*
+ * xf86StringToToken --
+ * returns the string corresponding to token
+ */
+int
+string_to_token(table, string)
+ SymTabPtr table;
+ char *string;
+{
+ int i;
+
+ for (i = 0; table[i].token >= 0 && NameCompare(string, table[i].name); i++)
+ ;
+ return(table[i].token);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxkbui.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxkbui.c
new file mode 100644
index 000000000..976432e7c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tclxkbui.c
@@ -0,0 +1,557 @@
+/* $XConsortium: tclxkbui.c /main/2 1996/10/19 19:06:46 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tclxkbui.c,v 3.2 1996/12/27 06:54:25 dawes Exp $ */
+/*
+ * tkXkbUIWin.c --
+ *
+ * This module implements "xkbview" widgets.
+ * A "xkbview" is a widget that uses the xkbui library to
+ * display a representation of the keyboard as described by
+ * the XKB geometry.
+ *
+ * Copyright 1996 Joseph Moss
+ *
+ * The file is derived from the sample widget code tkSquare.c, which is
+ * Copyright (c) 1991-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1995 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include <Xos.h>
+#include <Xfuncs.h>
+#include <tk.h>
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKBgeom.h>
+#include <X11/extensions/XKBui.h>
+
+#define DEF_XKBUI_HEIGHT "100"
+#define DEF_XKBUI_WIDTH "300"
+
+extern char * TkInitXkbUIWin _ANSI_ARGS_((Tcl_Interp *interp,
+ Tk_Window tkwin, int toplevel, int argc,
+ char *argv[]));
+
+extern XkbDescPtr GetXkbDescPtr _ANSI_ARGS_((Tcl_Interp *interp,
+ char *handle));
+
+/*
+ * A data structure of the following type is kept for each xkbview
+ * widget managed by this file:
+ */
+
+typedef struct {
+ Tk_Window tkwin; /* Window that embodies the xkbview. NULL
+ * means window has been deleted but
+ * widget record hasn't been cleaned up yet. */
+ Display *display; /* X's token for the window's display. */
+ Tcl_Interp *interp; /* Interpreter associated with widget. */
+ Tcl_Command widgetCmd; /* Token for xkbview's widget command. */
+ int width, height; /* Window height & width */
+
+ /*
+ * Information used when displaying widget:
+ */
+
+ int borderWidth; /* Width of 3-D border around whole widget. */
+ Tk_3DBorder bgBorder; /* Used for drawing background. */
+ int relief; /* Indicates whether window as a whole is
+ * raised, sunken, or flat. */
+ GC gc; /* Graphics context for copying from
+ * off-screen pixmap onto screen. */
+ int doubleBuffer; /* Non-zero means double-buffer redisplay
+ * with pixmap; zero means draw straight
+ * onto the display. */
+ int updatePending; /* Non-zero means a call to XkbUIWinDisplay
+ * has already been scheduled. */
+ char *xkbHandle; /* Handle of XkbDescRec */
+ XkbUI_ViewPtr view; /* XkbUI view structure */
+
+} XkbUIWin;
+
+/*
+ * Information used for argv parsing.
+ */
+
+static Tk_ConfigSpec configSpecs[] = {
+ {TK_CONFIG_BORDER, "-background", "background", "Background",
+ "#cdb79e", Tk_Offset(XkbUIWin, bgBorder), TK_CONFIG_COLOR_ONLY},
+ {TK_CONFIG_BORDER, "-background", "background", "Background",
+ "white", Tk_Offset(XkbUIWin, bgBorder), TK_CONFIG_MONO_ONLY},
+ {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *) NULL,
+ (char *) NULL, 0, 0},
+ {TK_CONFIG_SYNONYM, "-bg", "background", (char *) NULL,
+ (char *) NULL, 0, 0},
+ {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
+ "2", Tk_Offset(XkbUIWin, borderWidth), 0},
+ {TK_CONFIG_INT, "-dbl", "doubleBuffer", "DoubleBuffer",
+ "1", Tk_Offset(XkbUIWin, doubleBuffer), 0},
+ {TK_CONFIG_PIXELS, "-height", "height", "Height",
+ DEF_XKBUI_HEIGHT, Tk_Offset(XkbUIWin, height), 0},
+ {TK_CONFIG_STRING, "-keyboard", "keyboard", (char *) NULL,
+ "xkb1", Tk_Offset(XkbUIWin, xkbHandle), 0},
+ {TK_CONFIG_SYNONYM, "-kbd", "keyboard", (char *) NULL,
+ (char *) NULL, 0, 0},
+ {TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
+ "raised", Tk_Offset(XkbUIWin, relief), 0},
+ {TK_CONFIG_PIXELS, "-width", "width", "Width",
+ DEF_XKBUI_WIDTH, Tk_Offset(XkbUIWin, width), 0},
+ {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
+ (char *) NULL, 0, 0}
+};
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static void XkbUIWinCmdDeletedProc _ANSI_ARGS_((
+ ClientData clientData));
+static int XkbUIWinConfigure _ANSI_ARGS_((Tcl_Interp *interp,
+ XkbUIWin *xkbui, int argc, char **argv,
+ int flags));
+static void XkbUIWinDestroy _ANSI_ARGS_((ClientData clientData));
+static void XkbUIWinDisplay _ANSI_ARGS_((ClientData clientData));
+static void XkbUIWinEventProc _ANSI_ARGS_((ClientData clientData,
+ XEvent *eventPtr));
+static int XkbUIWinWidgetCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *, int argc, char **argv));
+
+/*
+ *--------------------------------------------------------------
+ *
+ * XkbUIWinCmd --
+ *
+ * This procedure is invoked to process the "xkbview" Tcl
+ * command. It creates a new "xkbview" widget.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * A new widget is created and configured.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+XkbUIWinCmd(clientData, interp, argc, argv)
+ ClientData clientData; /* Main window associated with
+ * interpreter. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+ char **argv; /* Argument strings. */
+{
+ Tk_Window main = (Tk_Window) clientData;
+ XkbUIWin *xkbuiPtr;
+ Tk_Window tkwin;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"",
+ argv[0], " pathName ?options?\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ tkwin = Tk_CreateWindowFromPath(interp, main, argv[1], (char *) NULL);
+ if (tkwin == NULL) {
+ return TCL_ERROR;
+ }
+ Tk_SetClass(tkwin, "Xkbui");
+
+ /*
+ * Allocate and initialize the widget record.
+ */
+
+ xkbuiPtr = (XkbUIWin *) ckalloc(sizeof(XkbUIWin));
+ xkbuiPtr->tkwin = tkwin;
+ xkbuiPtr->display = Tk_Display(tkwin);
+ xkbuiPtr->interp = interp;
+ xkbuiPtr->widgetCmd = Tcl_CreateCommand(interp,
+ Tk_PathName(xkbuiPtr->tkwin), XkbUIWinWidgetCmd,
+ (ClientData) xkbuiPtr, XkbUIWinCmdDeletedProc);
+ xkbuiPtr->height = -1;
+ xkbuiPtr->width = -1;
+ xkbuiPtr->borderWidth = 0;
+ xkbuiPtr->bgBorder = NULL;
+ xkbuiPtr->relief = TK_RELIEF_FLAT;
+ xkbuiPtr->gc = None;
+ xkbuiPtr->doubleBuffer = 1;
+ xkbuiPtr->updatePending = 0;
+ xkbuiPtr->xkbHandle = NULL;
+ xkbuiPtr->view = NULL;
+
+ Tk_CreateEventHandler(xkbuiPtr->tkwin, ExposureMask|StructureNotifyMask,
+ XkbUIWinEventProc, (ClientData) xkbuiPtr);
+ if (XkbUIWinConfigure(interp, xkbuiPtr, argc-2, argv+2, 0) != TCL_OK) {
+ Tk_DestroyWindow(xkbuiPtr->tkwin);
+ return TCL_ERROR;
+ }
+
+ interp->result = Tk_PathName(xkbuiPtr->tkwin);
+ return TCL_OK;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * XkbUIWinWidgetCmd --
+ *
+ * This procedure is invoked to process the Tcl command
+ * that corresponds to a widget managed by this module.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+XkbUIWinWidgetCmd(clientData, interp, argc, argv)
+ ClientData clientData; /* Information about xkbview widget. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+ char **argv; /* Argument strings. */
+{
+ XkbUIWin *xkbuiPtr = (XkbUIWin *) clientData;
+ int result = TCL_OK;
+ size_t length;
+ char c;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"",
+ argv[0], " option ?arg arg ...?\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ Tk_Preserve((ClientData) xkbuiPtr);
+ c = argv[1][0];
+ length = strlen(argv[1]);
+ if ((c == 'c') && (strncmp(argv[1], "cget", length) == 0)
+ && (length >= 2)) {
+ if (argc != 3) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"",
+ argv[0], " cget option\"",
+ (char *) NULL);
+ goto error;
+ }
+ result = Tk_ConfigureValue(interp, xkbuiPtr->tkwin, configSpecs,
+ (char *) xkbuiPtr, argv[2], 0);
+ } else if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0)
+ && (length >= 2)) {
+ if (argc == 2) {
+ result = Tk_ConfigureInfo(interp, xkbuiPtr->tkwin, configSpecs,
+ (char *) xkbuiPtr, (char *) NULL, 0);
+ } else if (argc == 3) {
+ result = Tk_ConfigureInfo(interp, xkbuiPtr->tkwin, configSpecs,
+ (char *) xkbuiPtr, argv[2], 0);
+ } else {
+ result = XkbUIWinConfigure(interp, xkbuiPtr, argc-2, argv+2,
+ TK_CONFIG_ARGV_ONLY);
+ }
+ } else if ((c == 'r') && (strncmp(argv[1], "refresh", length) == 0)
+ && (length >= 2)) {
+ /* Nothing - The call to Tk_DoWhenIdle below takes care of this */
+ ;
+ } else {
+ Tcl_AppendResult(interp, "bad option \"", argv[1],
+ "\": must be cget, configure, or refresh",
+ (char *) NULL);
+ goto error;
+ }
+ if (!xkbuiPtr->updatePending) {
+ Tk_DoWhenIdle(XkbUIWinDisplay, (ClientData) xkbuiPtr);
+ xkbuiPtr->updatePending = 1;
+ }
+ Tk_Release((ClientData) xkbuiPtr);
+ return result;
+
+ error:
+ Tk_Release((ClientData) xkbuiPtr);
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XkbUIWinConfigure --
+ *
+ * This procedure is called to process an argv/argc list in
+ * conjunction with the Tk option database to configure (or
+ * reconfigure) a xkbview widget.
+ *
+ * Results:
+ * The return value is a standard Tcl result. If TCL_ERROR is
+ * returned, then interp->result contains an error message.
+ *
+ * Side effects:
+ * Configuration information, such as colors, border width,
+ * etc. get set for xkbuiPtr; old resources get freed,
+ * if there were any.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+XkbUIWinConfigure(interp, xkbuiPtr, argc, argv, flags)
+ Tcl_Interp *interp; /* Used for error reporting. */
+ XkbUIWin *xkbuiPtr; /* Information about widget. */
+ int argc; /* Number of valid entries in argv. */
+ char **argv; /* Arguments. */
+ int flags; /* Flags to pass to
+ * Tk_ConfigureWidget. */
+{
+ if (Tk_ConfigureWidget(interp, xkbuiPtr->tkwin, configSpecs,
+ argc, argv, (char *) xkbuiPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Set the background for the window and create a graphics context
+ * for use during redisplay.
+ */
+
+ Tk_SetWindowBackground(xkbuiPtr->tkwin,
+ Tk_3DBorderColor(xkbuiPtr->bgBorder)->pixel);
+ if ((xkbuiPtr->gc == None) && (xkbuiPtr->doubleBuffer)) {
+ XGCValues gcValues;
+ gcValues.function = GXcopy;
+ gcValues.graphics_exposures = False;
+ xkbuiPtr->gc = Tk_GetGC(xkbuiPtr->tkwin,
+ GCFunction|GCGraphicsExposures, &gcValues);
+ }
+
+ /*
+ * Register the desired geometry for the window. Then arrange for
+ * the window to be redisplayed.
+ */
+
+ Tk_GeometryRequest(xkbuiPtr->tkwin, 200, 150);
+ Tk_SetInternalBorder(xkbuiPtr->tkwin, xkbuiPtr->borderWidth);
+ if (!xkbuiPtr->updatePending) {
+ Tk_DoWhenIdle(XkbUIWinDisplay, (ClientData) xkbuiPtr);
+ xkbuiPtr->updatePending = 1;
+ }
+ return TCL_OK;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * XkbUIWinEventProc --
+ *
+ * This procedure is invoked by the Tk dispatcher for various
+ * events on xkbviews.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * When the window gets deleted, internal structures get
+ * cleaned up. When it gets exposed, it is redisplayed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+XkbUIWinEventProc(clientData, eventPtr)
+ ClientData clientData; /* Information about window. */
+ XEvent *eventPtr; /* Information about event. */
+{
+ XkbUIWin *xkbuiPtr = (XkbUIWin *) clientData;
+
+ if (eventPtr->type == Expose) {
+ if (!xkbuiPtr->updatePending) {
+ Tk_DoWhenIdle(XkbUIWinDisplay, (ClientData) xkbuiPtr);
+ xkbuiPtr->updatePending = 1;
+ }
+ } else if (eventPtr->type == ConfigureNotify) {
+ if (!xkbuiPtr->updatePending) {
+ Tk_DoWhenIdle(XkbUIWinDisplay, (ClientData) xkbuiPtr);
+ xkbuiPtr->updatePending = 1;
+ }
+ } else if (eventPtr->type == DestroyNotify) {
+ if (xkbuiPtr->tkwin != NULL) {
+ xkbuiPtr->tkwin = NULL;
+ Tcl_DeleteCommand(xkbuiPtr->interp,
+ Tcl_GetCommandName(xkbuiPtr->interp,
+ xkbuiPtr->widgetCmd));
+ }
+ if (xkbuiPtr->updatePending) {
+ Tk_CancelIdleCall(XkbUIWinDisplay, (ClientData) xkbuiPtr);
+ }
+ Tk_EventuallyFree((ClientData) xkbuiPtr,
+ (Tcl_FreeProc *)XkbUIWinDestroy);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XkbUIWinCmdDeletedProc --
+ *
+ * This procedure is invoked when a widget command is deleted. If
+ * the widget isn't already in the process of being destroyed,
+ * this command destroys it.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The widget is destroyed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+XkbUIWinCmdDeletedProc(clientData)
+ ClientData clientData; /* Pointer to widget record for widget. */
+{
+ XkbUIWin *xkbuiPtr = (XkbUIWin *) clientData;
+ Tk_Window tkwin = xkbuiPtr->tkwin;
+
+ /*
+ * This procedure could be invoked either because the window was
+ * destroyed and the command was then deleted (in which case tkwin
+ * is NULL) or because the command was deleted, and then this procedure
+ * destroys the widget.
+ */
+
+ if (tkwin != NULL) {
+ xkbuiPtr->tkwin = NULL;
+ Tk_DestroyWindow(tkwin);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * XkbUIWinDisplay --
+ *
+ * This procedure redraws the contents of a xkbview window.
+ * It is invoked as a do-when-idle handler, so it only runs
+ * when there's nothing else for the application to do.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information appears on the screen.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+XkbUIWinDisplay(clientData)
+ ClientData clientData; /* Information about window. */
+{
+ XkbUIWin *xkbuiPtr = (XkbUIWin *) clientData;
+ Tk_Window tkwin = xkbuiPtr->tkwin;
+ Pixmap pm = None;
+ Drawable d;
+ XkbDescPtr xkb;
+ XkbUI_ViewOptsRec opts;
+ int width, height, bd;
+
+ xkbuiPtr->updatePending = 0;
+ if (!Tk_IsMapped(tkwin)) {
+ return;
+ }
+
+ /*
+ * Create a pixmap for double-buffering, if necessary.
+ */
+
+ if (xkbuiPtr->doubleBuffer) {
+ pm = XCreatePixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
+ (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
+ (unsigned) DefaultDepthOfScreen(Tk_Screen(tkwin)));
+ d = pm;
+ } else {
+ d = Tk_WindowId(tkwin);
+ }
+
+ /*
+ * Redraw the widget's background and border.
+ */
+
+ Tk_Fill3DRectangle(tkwin, d, xkbuiPtr->bgBorder, 0, 0, Tk_Width(tkwin),
+ Tk_Height(tkwin), xkbuiPtr->borderWidth, xkbuiPtr->relief);
+
+ /*
+ * Display the keyboard.
+ */
+
+ bzero((char *)&opts, sizeof(opts));
+ bd = 0;
+ if (xkbuiPtr->relief != TK_RELIEF_FLAT)
+ bd = xkbuiPtr->borderWidth;
+ opts.present = XkbUI_SizeMask|XkbUI_ColormapMask
+ |XkbUI_MarginMask|XkbUI_OffsetMask;
+ opts.margin_width = opts.margin_height = 0;
+ opts.viewport.x = opts.viewport.y = bd;
+ width = opts.viewport.width = Tk_Width(tkwin) - 2*bd;
+ height = opts.viewport.height = Tk_Height(tkwin) - 2*bd;
+ opts.cmap = Tk_Colormap(tkwin);
+ xkb = GetXkbDescPtr(xkbuiPtr->interp, xkbuiPtr->xkbHandle);
+ if (xkb != NULL) {
+ if (xkbuiPtr->view)
+ ckfree(xkbuiPtr->view);
+ xkbuiPtr->view= XkbUI_Init(xkbuiPtr->display, d,
+ width, height, xkb, &opts);
+ if (xkbuiPtr->view)
+ XkbUI_DrawRegion(xkbuiPtr->view,NULL);
+ }
+
+ /*
+ * If double-buffered, copy to the screen and release the pixmap.
+ */
+
+ if (xkbuiPtr->doubleBuffer) {
+ XCopyArea(Tk_Display(tkwin), pm, Tk_WindowId(tkwin), xkbuiPtr->gc,
+ 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
+ 0, 0);
+ XFreePixmap(Tk_Display(tkwin), pm);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XkbUIWinDestroy --
+ *
+ * This procedure is invoked by Tk_EventuallyFree or Tk_Release
+ * to clean up the internal structure of a xkbview at a safe time
+ * (when no-one is using it anymore).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Everything associated with the xkbview is freed up.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+XkbUIWinDestroy(clientData)
+ ClientData clientData; /* Info about xkbview widget. */
+{
+ XkbUIWin *xkbuiPtr = (XkbUIWin *) clientData;
+
+ Tk_FreeOptions(configSpecs, (char *) xkbuiPtr, xkbuiPtr->display, 0);
+ if (xkbuiPtr->gc != None) {
+ Tk_FreeGC(xkbuiPtr->display, xkbuiPtr->gc);
+ }
+ if (xkbuiPtr->view != NULL) {
+ ckfree(xkbuiPtr->view);
+ }
+ ckfree((char *) xkbuiPtr);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/Imakefile b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/Imakefile
new file mode 100644
index 000000000..2b5eedbc3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/Imakefile
@@ -0,0 +1,20 @@
+XCOMM
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/Imakefile,v 1.2 1998/04/05 15:25:33 robin Exp $
+XCOMM
+
+#include <Server.tmpl>
+#define IHaveSubdirs
+
+ XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
+ SCRIPTSDIR = $(XF86SETUPLIBDIR)/texts
+
+ SCRIPTFILES = local_text.tcl
+
+ SUBDIRS = generic ja
+
+all::
+
+InstallMultiple($(SCRIPTFILES),$(SCRIPTSDIR))
+
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/Imakefile b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/Imakefile
new file mode 100644
index 000000000..429993cb4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/Imakefile
@@ -0,0 +1,14 @@
+XCOMM
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/Imakefile,v 1.2 1998/04/05 15:30:27 robin Exp $
+XCOMM
+ XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
+ SCRIPTSDIR = $(XF86SETUPLIBDIR)/texts/generic
+
+ SCRIPTFILES = messages.tcl message_proc.tcl \
+ help_card.tcl help_done.tcl help_keyboard.tcl \
+ help_monitor.tcl help_mouse.tcl help_other.tcl \
+ help_intro.tcl help_modeselect.tcl
+
+all::
+
+InstallMultiple($(SCRIPTFILES),$(SCRIPTSDIR))
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_card.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_card.tcl
new file mode 100644
index 000000000..341723fb4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_card.tcl
@@ -0,0 +1,55 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_card.tcl,v 1.2 1998/04/05 15:30:28 robin Exp $
+#
+global cardDetail
+
+if { $cardDetail == "std" } {
+ set message "\n\n\
+ Pick your card from the list.\n\n\
+ If there are README files that may pertain to your card\n\
+ the 'Read README file' button will then be usable (i.e. not\
+ greyed out).\n\
+ Please read them.\n\n\
+ If your card is not in the list, or if there are any\
+ special settings\n\
+ listed in the README file as required by your card, you\
+ can press the\n\
+ 'Detailed Setup' button to make sure that\
+ they have been selected."
+} else {
+ global DeviceIDs
+ if { [llength $DeviceIDs] > 1 } {
+ set message \
+ " If you picked a card from the Card list, at least most\
+ things should\n\
+ already be set properly.\n\n"
+ } else {
+ set message "\n\n"
+ }
+ append message \
+ " First select the appropriate server for your card.\n\
+ Then read the README file corresponding to the selected\
+ server by pressing\n\
+ the 'Read README file' button (it won't do anything, if\
+ there is no README).\n\n\
+ Next, pick the chipset, and Ramdac of your card, if\
+ directed by the README\n\
+ file. In most cases, you don't need to select these,\
+ as the server will\n\
+ detect (probe) them automatically.\n\n\
+ The clockchip should generally be picked, if your card\
+ has one, as these\n\
+ are often impossible to probe (the exception is when\
+ the clockchip is built\n\
+ into one of the other chips).\n\n\
+ Choose whatever options are appropriate (again,\
+ according to the README).\n\n\
+ You can also set the maximum speed of your Ramdac. Some\
+ Ramdacs are available\n\
+ with various speed ratings. The max speed cannot be\
+ detected by the server\n\
+ so it will use the speed rating of the slowest version\
+ of the specified Ramdac.\n\n\
+ Additionally, you can also specify the amount of RAM on\
+ your card, though\n\
+ the server will usually be able to detect this."
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_done.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_done.tcl
new file mode 100644
index 000000000..3a42a4de3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_done.tcl
@@ -0,0 +1,12 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_done.tcl,v 1.2 1998/04/05 15:30:28 robin Exp $
+#
+set message "\n\n\
+ If you've finished configuring everything, select the\
+ 'Okay' button.\n\n\
+ If there are still some configuration screens you\
+ have not completed,\n\
+ pick the appropriate button from the row across the top\
+ and then press\n\
+ 'Done' again, when you've finished all of the\
+ configuration screens."
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_intro.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_intro.tcl
new file mode 100644
index 000000000..03e968e4b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_intro.tcl
@@ -0,0 +1,23 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_intro.tcl,v 1.2 1998/04/05 15:30:28 robin Exp $
+#
+set message "\n\
+ You need to fill in the requested information on each\
+ of the five\n\
+ configuration screens. The buttons along the top allow\
+ you to choose which\n\
+ screen you are going to work on. You can do them in\
+ any order or go back\n\
+ to each of them as many times as you like, however,\
+ it will be very\n\
+ difficult to use some of them if your mouse is not\
+ working, so you\n\
+ should configure your mouse first.\n\n\
+ Until you get your mouse working, here are some keys you\
+ can use:\n\n\
+ \ \ Tab, Ctrl-Tab Move to the \"next\" widget\n\
+ \ \ Shift-Tab Move to the \"previous\" widget\n\
+ \ \ <Arrow keys> Move in the appropriate direction\n\
+ \ \ Return Activate the selected widget\n\n\
+ Also, you can press Alt and one of the underlined letters\
+ to activate the\n\
+ corresponding button."
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_keyboard.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_keyboard.tcl
new file mode 100644
index 000000000..7c32fbc84
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_keyboard.tcl
@@ -0,0 +1,9 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_keyboard.tcl,v 1.2 1998/04/05 15:30:28 robin Exp $
+#
+set message "\n\n\n\
+ First select the model of keyboard that you have (or\
+ the closest equivalent).\n\
+ The small graphic will automatically be updated.\n\n\
+ Next select the layout and any variant or options desired.\n\n\
+ Pressing the 'Apply' button will cause the selected\
+ settings to take effect."
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_modeselect.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_modeselect.tcl
new file mode 100644
index 000000000..7587165de
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_modeselect.tcl
@@ -0,0 +1,14 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_modeselect.tcl,v 1.2 1998/04/05 15:30:29 robin Exp $
+#
+set message "\n\n\
+ XFree86 supports multiple modes that you can cycle\n\
+ through while running the X server (on hardware that supports this).\n\
+ Click on the modes that you want to have included in your\n\
+ configuration.\n\
+ \n\
+ Additionally, you can select the default color depth the server \n\
+ starts in when no overriding flags are given on the command line.\n\
+ Be aware that XF86Setup may fail if you select a color depth that\n\
+ your hardware (or the server that you have chosen) does not support.\n"
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_monitor.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_monitor.tcl
new file mode 100644
index 000000000..241ef55f3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_monitor.tcl
@@ -0,0 +1,14 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_monitor.tcl,v 1.2 1998/04/05 15:30:29 robin Exp $
+#
+set message "\n\n\n\
+ Enter the horizontal and vertical sync rates of your\n\
+ monitor. These should be listed in your manual.\n\n\
+ If you can not find this information, you can pick from the\n\
+ the list of common monitor capabilities, the one that best\n\
+ describes your monitor, and the appropriate sync rates\n\
+ will be filled in for you.\n\n\
+ It is very important that these values be correct!\n\n\
+ Using video modes that require sync rates beyond the\n\
+ capabilities of your monitor may damage it.\n\
+ The server will automatically exclude any video modes\n\
+ that require sync rates beyond those you enter."
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_mouse.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_mouse.tcl
new file mode 100644
index 000000000..473a140c3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_mouse.tcl
@@ -0,0 +1,38 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_mouse.tcl,v 1.2 1998/04/05 15:30:29 robin Exp $
+#
+set message \
+{ First select the protocol for your mouse using 'p', then if needed, change the device
+ name. If applicable, also set the baud rate (1200 should work). Avoid moving the
+ mouse or pressing buttons before the correct protocol has been selected. Press 'a'
+ to apply the changes and try moving your mouse around. If the mouse pointer does
+ not move properly, try a different protocol or device name.
+
+ Once the mouse is moving properly, test that the various buttons also work correctly.
+ If you have a three button mouse and the middle button does not work, try the buttons
+ labeled ChordMiddle and Emulate3Buttons.
+
+ Note: the `Logitech' protocol is only used by older Logitech mice. Most current
+ models use the `Microsoft' or `MouseMan' protocol.
+
+ Key Function
+ ------------------------------------------------------
+ a - Apply changes
+ b - Change to next baud rate
+ c - Toggle the ChordMiddle button
+ d - Toggle the ClearDTR button
+ e - Toggle the Emulate3button button
+ l - Select the next resolution
+ n - Set the name of the device
+ p - Select the next protocol
+ r - Toggle the ClearRTS button
+ s - Increase the sample rate
+ t - Increase the 3-button emulation timeout
+ 3 - Set buttons to 3
+ 4 - Set buttons to 4
+ 5 - Set buttons to 5
+ ------------------------------------------------------
+ You can also use Tab, and Shift-Tab to move around and then use Enter to activate
+ the selected button.
+
+ See the documentation for more information
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_other.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_other.tcl
new file mode 100644
index 000000000..c24e2f258
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_other.tcl
@@ -0,0 +1,10 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/help_other.tcl,v 1.2 1998/04/05 15:30:29 robin Exp $
+#
+set message "\n\n\
+ On this screen you can select the settings of various\
+ server options.\n\
+ These should already be set to the values most often used\n\
+ and generally you don't need to make any changes.\n\n\
+ If you would like more information regarding what each\
+ of these do,\n\
+ read the XF86Config man page."
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/message_proc.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/message_proc.tcl
new file mode 100644
index 000000000..d0308cdcd
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/message_proc.tcl
@@ -0,0 +1,77 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/message_proc.tcl,v 1.2 1998/04/05 15:30:30 robin Exp $
+#
+# These procedures generate local messages with arguments
+
+proc make_message_phase4 { saveto } {
+ global messages
+ set messages(phase4.2) \
+ "Unable to backup $saveto as $saveto.bak!\n\
+ The configuration has not been saved!\n\
+ Try again, with a different file name"
+ set messages(phase4.3) "A backup of the previous configuration has\n\
+ been saved to the file $saveto.bak"
+ set messages(phase4.4) "Unable to save the configuration to\n\
+ the file $saveto.\n\n\
+ Try again, with a different file name"
+ set messages(phase4.5) "The configuration has been completed.\n\n"
+
+}
+proc make_message_card { args } {
+ global pc98 messages Xwinhome
+ global cardServer
+
+ set mes ""
+ if !$pc98 {
+ if ![file exists $Xwinhome/bin/XF86_$cardServer] {
+ if ![string compare $args cardselected] {
+ set mes \
+ "*** The server required by your card is not\
+ installed! Please abort, install the\
+ $cardServer server as\n\
+ $Xwinhome/bin/XF86_$cardServer and\
+ run this program again ***"
+ } else {
+ set mes \
+ "*** The selected server is not\
+ installed! Please abort, install the\
+ $cardServer server as\n\
+ $Xwinhome/bin/XF86_$cardServer and\
+ run this program again ***"
+ }
+ bell
+ }
+ } else {
+ if ![file exists $Xwinhome/bin/XF98_$cardServer] {
+ if ![string compare $args cardselected] {
+ set mes \
+ "*** The server required by your card is not\
+ installed! Please abort, install the\
+ $cardServer server as\n\
+ $Xwinhome/bin/XF98_$cardServer and\
+ run this program again ***"
+ } else {
+ set mes \
+ "*** The selected server is not\
+ installed! Please abort, install the\
+ $cardServer server as\n\
+ $Xwinhome/bin/XF98_$cardServer and\
+ run this program again ***"
+ }
+ bell
+ }
+ }
+ return $mes
+}
+
+proc make_intro_headline { win } {
+ global pc98
+
+ $win insert end \
+ "Introduction to Configuration with XF86Setup" heading
+ if !$pc98 {
+ $win insert end "\n"
+ }
+}
+
+proc make_underline { win } {
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/messages.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/messages.tcl
new file mode 100644
index 000000000..a1b0181bf
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/messages.tcl
@@ -0,0 +1,312 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/generic/messages.tcl,v 1.5 1999/04/05 07:13:05 dawes Exp $
+#
+# messages in done.tcl :
+set messages(done.1) "\n\n\
+ If you've finished configuring everything press the\n\
+ Okay button to start the X server using the\
+ configuration you've selected.\n\n\
+ If you still wish to configure some things,\n\
+ press one of the buttons at the top and then\n\
+ press \"Done\" again, when you've finished."
+set messages(done.2) "Okay."
+set messages(done.3) "Just a moment..."
+
+# messages in srvflags :
+set messages(srvflags.1) "Optional server settings\n\n\
+ These should be set to reasonable values, by default,\n\
+ so you probably don't need to change anything"
+set messages(srvflags.2) "Allow server to be killed with\
+ hotkey sequence (Ctrl-Alt-Backspace)"
+set messages(srvflags.3) "Allow video mode switching"
+set messages(srvflags.4) "Don't Trap Signals\
+ - prevents the server from exitting cleanly"
+set messages(srvflags.5) "Allow video mode changes from other hosts"
+set messages(srvflags.6) "Allow changes to keyboard and mouse settings\
+ from other hosts"
+
+# messages in phase1 :
+set messages(phase1.1) "Not all of the"
+set messages(phase1.2) "are installed. The file"
+set messages(phase1.3) "is missing"
+set messages(phase1.4) \
+ "Warning! Not all of the READMEs are\
+ installed. You may not be able to view some of\
+ the instructions regarding setting up your card,\
+ but otherwise, everything should work correctly"
+set messages(phase1.5) "Error encountered reading existing\
+ configuration file"
+set messages(phase1.6) \
+ "It appears that you are currently \
+ running under X11. If this is correct \
+ and you are interested in making some \
+ adjustments to your current setup, \
+ answer yes to the following question."
+set messages(phase1.7) \
+ "If this is incorrect or you \
+ would like to go through the full \
+ configuration process, then answer no."
+set messages(phase1.8) "Is this a reconfiguration?"
+set messages(phase1.9) \
+ "You are not running as root.\n\n\
+ Superuser privileges are usually required to save any changes\n\
+ you make in a directory that is searched by the server and\n\
+ are required to change the mouse device.\n\n\
+ Would you like to continue anyway?"
+set messages(phase1.10) \
+ "You need to be root to set the initial\
+ configuration with this program"
+set messages(phase1.11) \
+ "Can't find the XFree86 loader - falling back\n\
+ to text interface for configuration"
+set messages(phase1.12) \
+ "The XFree86 loader (XF98_LOADER) or the EGC\n\
+ or the PEGC server is required when using\n\
+ this program to set the initial configuration"
+set messages(phase1.13) \
+ "Would you like to use the\
+ existing XF86Config file for defaults?"
+set messages(phase1.14) "You need to be root to run this program"
+set messages(phase1.15) \
+ "Can't find the XFree86 loader - falling back\n\
+ to text interface for configuration"
+set messages(phase1.16) \
+ "Either the XFree86 loader (XF98_LOADER) or the\n\
+ EGC server or the PEGC server is required to run\n\
+ this program"
+set messages(phase1.17) \
+ "Would you like to use the Xqueue driver\n\
+ for mouse and keyboard input?"
+set messages(phase1.18) \
+ "Would you like to use the system event\
+ queue for mouse input?"
+set messages(phase1.19) "Unable to make directory "
+set messages(phase1.20) "\nfor storing temporary files"
+set messages(phase1.23) "Ready to switch to graphics mode.\n\
+ \nIt may take a while"
+set messages(phase1.24) "Unable to start X server!\n\
+ Falling back to text or curses interface...."
+set messages(phase1.25) "Unable to communicate with X server!\n\
+ Falling back to text or curses interface...."
+set messages(phase1.26) "Please wait\n\nThis may take a while..."
+set messages(phase1.27) "Unable to startup curses - maybe your terminal\n\
+ type (%s) is unknown? Falling back to plain text interface...."
+set messages(phase1.28) "\$TERM no set.\n\
+ Falling back to plain text interface...."
+
+# messages in phase2 :
+set messages(phase2.1) "Loading - Please wait...\n\n\n"
+set messages(phase2.2) \
+ "Unable to read keyboard information from the server.\n\n\
+ This problem most often occurs when you are running when\n\
+ you are running a server which does not have the XKEYBOARD\n\
+ extension or which has it disabled.\n\n\
+ The ability of this program to configure the keyboard is\n\
+ reduced without the XKEYBOARD extension, but is still\
+ functional.\n\n\
+ Continuing..."
+set messages(phase2.3) Mouse
+set messages(phase2.4) Keyboard
+set messages(phase2.5) Card
+set messages(phase2.6) Monitor
+set messages(phase2.7) Modeselection
+set messages(phase2.8) Other
+set messages(phase2.9) Abort
+set messages(phase2.10) Done
+set messages(phase2.11) Help
+set messages(phase2.12) "\n\
+ There are five areas of configuration that need to\
+ be completed, corresponding to the buttons\n\
+ along the top:\n\n\
+ \tMouse\t\t- Use this to set the protocol, baud rate, etc.\
+ used by your mouse\n\
+ \tKeyboard\t- Set the nationality and layout of\
+ your keyboard\n\
+ \tCard\t\t- Used to select the chipset, RAMDAC, etc.\
+ of your card\n\
+ \tMonitor\t\t- Use this to enter your\
+ monitor's capabilities\n\
+ \tModeselction\t\t- Use this to chose the modes\
+ that you want to use\n\
+ \tOther\t\t- Configure some miscellaneous settings\n\n\
+ You'll probably want to start with configuring your\
+ mouse (you can just press \[Enter\] to do so)\n\
+ and when you've finished configuring all five of these,\
+ select the Done button.\n\n\
+ To select any of the buttons, press the underlined\
+ letter together with either Control or Alt.\n\
+ You can also press ? or click on the Help button at\
+ any time for additional instructions\n\n"
+set messages(phase2.13) "Dismiss"
+set messages(phase2.14) "The program is running on a different\
+ virtual terminal\n\n\
+ Please switch to the correct virtual terminal"
+
+# messages in phase3 :
+set messages(phase3.1) "Attempting to start server..."
+set messages(phase3.2) "Unable to communicate with X server"
+set messages(phase3.3) "Unable to start X server"
+set messages(phase3.4) "\n\nPress \[Enter\] to try configuration again"
+set messages(phase3.5) \
+ "Ack! Unable to get the VGA16 server going again!"
+
+# messages in phase4 :
+set messages(phase4.1) "Loading - Please wait..."
+# phase.2-5 is generated by proc 'make_message_phase4'.
+set messages(phase4.6) "Okay"
+set messages(phase4.7) \
+ "You can now run xvidtune to adjust your display settings,\n\
+ if you want to change the size or placement of the screen image\n\n\
+ If not, go ahead and exit\n\n\n\
+ If you choose to save the configuration, a backup copy will be\n\
+ made, if the file already exists"
+set messages(phase4.8) "Save configuration to:"
+set messages(phase4.9) "Run xvidtune"
+set messages(phase4.10) "Save the configuration and exit"
+set messages(phase4.11) "Abort - Don't save the configuration"
+set messages(phase4.12) "Aborted"
+set messages(phase4.13) "Congratulations, you've got a running server!\n\n"
+set messages(phase4.14) "Just a moment..."
+set messages(phase4.15) ""
+set messages(phase4.16) "The program is running on a different\
+ virtual terminal\n\n\
+ Please switch to the correct virtual terminal"
+
+# messages in phase5.tcl :
+set messages(phase5.1) "Do you want to create an 'X' link to the "
+set messages(phase5.2) \
+ " server?\n\n(the link will be created in the directory:"
+set messages(phase5.3) ") Okay?"
+set messages(phase5.4) "Link creation failed!\n\
+ You'll have to do it yourself"
+set messages(phase5.5) "Link created successfully."
+set messages(phase5.6) "\n\nConfiguration complete."
+
+# messages in setuplib.tcl :
+set messages(setuplib.1) "\n\nPress \[Enter\] to continue..."
+set messages(setuplib.2) "The temporary files directory ("
+set messages(setuplib.3) ")\nis no longer secure!"
+
+# messages in card.tcl :
+set messages(card.1) "Card selected:"
+set messages(card.2) "Card selected: None"
+set messages(card.3) "Read README file"
+set messages(card.4) "Detailed Setup"
+set messages(card.5) Server:
+set messages(card.7) Chipset
+set messages(card.8) RamDac
+set messages(card.9) ClockChip
+set messages(card.10) "RAMDAC Max Speed"
+set messages(card.11) "Probed"
+set messages(card.12) "Video RAM"
+set messages(card.13) "Probed"
+set messages(card.14) "256K"
+set messages(card.15) "512K"
+set messages(card.16) "1Meg"
+set messages(card.17) "2Meg"
+set messages(card.18) "3Meg"
+set messages(card.19) "4Meg"
+set messages(card.20) "6Meg"
+set messages(card.21) "8Meg"
+set messages(card.22) "Selected options:"
+set messages(card.23) "Additional lines to\
+ add to Device section of the XF86Config file:"
+#set messages(card.24) "Probed: Yes"
+#set messages(card.25) "Probed: No"
+set messages(card.26) "Card List"
+set messages(card.27) "Detailed Setup"
+set messages(card.28) "Card selected: "
+set messages(card.29) "Dismiss"
+set messages(card.30) \
+ "First make sure the correct server is selected,\
+ then make whatever changes are needed\n\
+ If the Chipset, RamDac, or ClockChip entries\
+ are left blank, they will be probed"
+set messages(card.31) \
+ "Select your card from the list.\n\
+ If your card is not listed,\
+ click on the Detailed Setup button"
+set messages(card.32) \
+ "That's all there is to configuring your card\n\
+ unless you would like to make changes to the\
+ standard settings (by pressing Detailed Setup)"
+set messages(card.33) \
+ "That's probably all there is to configuring\
+ your card, but you should probably check the\n\
+ README to make sure. If any changes are needed,\
+ press the Detailed Setup button"
+set messages(card.34) \
+ "You have selected a card which is not fully\
+ supported by XFree86, however all of the proper\n\
+ configuration options have been set such that it\
+ should work in standard VGA mode"
+
+# messages in keyboard.tcl :
+set messages(keyboard.1) "Model:"
+set messages(keyboard.2) "Layout (language):"
+set messages(keyboard.3) "Apply"
+set messages(keyboard.4) \
+ "Select the appropriate model and layout"
+set messages(keyboard.5) "Available options:"
+set messages(keyboard.6) \
+ "Variant (non U.S. Keyboards only):"
+set messages(keyboard.7) "Use default setting"
+set messages(keyboard.8) "Failed! Try again"
+set messages(keyboard.9) "Applying..."
+set messages(keyboard.10) "Please wait..."
+
+# messages in modeselect.tcl :
+
+set messages(modeselect.1) "Select the modes you want to use"
+set messages(modeselect.2) 640x480
+set messages(modeselect.3) 800x600
+set messages(modeselect.4) 1024x768
+set messages(modeselect.5) 1152x864
+set messages(modeselect.6) 1280x1024
+set messages(modeselect.7) 1600x1200
+set messages(modeselect.8) 640x400
+set messages(modeselect.9) 320x200
+set messages(modeselect.10) 320x240
+set messages(modeselect.11) 400x300
+set messages(modeselect.12) 480x300
+set messages(modeselect.13) 512x384
+set messages(modeselect.14) "Select the default color depth you want to use"
+set messages(modeselect.15) " 8bpp "
+set messages(modeselect.16) " 16bpp "
+set messages(modeselect.17) " 24bpp "
+set messages(modeselect.18) " 32bpp "
+
+# messages in monitor.tcl :
+
+set messages(monitor.1) "Monitor sync rates"
+set messages(monitor.2) "Monitor selected:"
+set messages(monitor.3) "Horizontal"
+set messages(monitor.4) "Vertical"
+set messages(monitor.5) \
+ "Enter the Horizontal and Vertical Sync ranges for your monitor\n\
+ or if you do not have that information, choose from the list"
+
+# messages in mouse.tcl :
+
+set messages(mouse.1) "Lines/inch"
+set messages(mouse.2) "Sample Rate"
+set messages(mouse.3) "Select the mouse protocol"
+set messages(mouse.4) "Applying..."
+set messages(mouse.5) "Mouse Device"
+set messages(mouse.6) Emulate3Buttons
+set messages(mouse.7) ChordMiddle
+set messages(mouse.8) "Baud Rate"
+set messages(mouse.9) "Press ? or Alt-H for a list of key bindings"
+set messages(mouse.10) Flags
+set messages(mouse.11) ClearDTR
+set messages(mouse.12) ClearRTS
+set messages(mouse.13) "Sample Rate"
+set messages(mouse.14) "Emulate3Timeout"
+set messages(mouse.15) "Apply"
+set messages(mouse.16) "Press ? or Alt-H for a list of key bindings"
+set messages(mouse.17) "Exit"
+set messages(mouse.18) 1
+set messages(mouse.19) "Resolution"
+set messages(mouse.20) "High"
+set messages(mouse.21) "Medium"
+set messages(mouse.22) "Low"
+set messages(mouse.23) "Buttons"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/Imakefile b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/Imakefile
new file mode 100644
index 000000000..b75a613eb
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/Imakefile
@@ -0,0 +1,14 @@
+XCOMM
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/Imakefile,v 1.2 1998/04/05 15:30:30 robin Exp $
+XCOMM
+ XF86SETUPLIBDIR = $(LIBDIR)/XF86Setup
+ SCRIPTSDIR = $(XF86SETUPLIBDIR)/texts/ja
+
+ SCRIPTFILES = messages.tcl message_proc.tcl \
+ help_card.tcl help_done.tcl help_keyboard.tcl \
+ help_monitor.tcl help_mouse.tcl help_other.tcl \
+ help_intro.tcl help_modeselect.tcl
+
+all::
+
+InstallMultiple($(SCRIPTFILES),$(SCRIPTSDIR))
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_card.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_card.tcl
new file mode 100644
index 000000000..214f55e9e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_card.tcl
@@ -0,0 +1,47 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_card.tcl,v 1.2 1998/04/05 15:30:31 robin Exp $
+#
+global cardDetail
+
+if { $cardDetail == "std" } {
+ set message "\n\n\
+ ĽęĽšĽČ¤Ť¤éťČÍѤˇ¤Ć¤¤¤ëĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ňÁŞÂň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤â¤ˇĄ˘¤˝¤ÎĽŤĄźĽÉÍѤΠREADME ĽŐĽĄĽ¤Ľë¤Ź¤˘¤ě¤Đ <README ĽŐĽĄĽ¤Ľë¤ň\n\
+ Ćɤŕ> ¤ňÁŞÂň¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ˛ÄÇ˝¤Ę¸Â¤ęĄ˘Ćɤŕ¤č¤Ś¤Ë\n\
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁREADME ĽŐĽĄĽ¤Ľë¤Ź¤Ę¤ą¤ě¤Đ¤ł¤ÎĽÜĽżĽó¤Ď\n\
+ łĽż§¤Ë¤Ę¤Ă¤ĆĄ˘ÁŞÂň¤Ç¤­¤Ę¤Ż¤Ę¤Ă¤Ć¤¤¤ë¤Ď¤ş¤Ç¤šĄŁ\n\n\
+ ¤â¤ˇĄ˘ťČ¤Ă¤Ć¤¤¤ëĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ŹĽęĽšĽČ¤Ë¤Ę¤¤ťţĄ˘\n\
+ ¤˘¤ë¤¤¤Ď README ĽŐĽĄĽ¤Ľë¤ËĄÖ¤ł¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤Ď\n\
+ ĆĂźě¤ĘŔßÄꤏɏÍפŔĄ×¤Č˝ń¤¤¤Ć¤˘¤Ă¤żžěšç¤Ë¤Ď <žÜşŮŔßÄę> ¤ň\n\
+ ˛Ą¤ˇ¤ĆÉŹÍפĘŔßÄę¤ňšÔ¤Ę¤Ă¤Ć˛ź¤ľ¤¤ĄŁ"
+} else {
+ global DeviceIDs
+ if { [llength $DeviceIDs] > 1 } {
+ set message "\n\
+ ĽęĽšĽČ¤Ť¤éťČÍѤˇ¤Ć¤¤¤ëĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ňÁŞÂň¤š¤ě¤ĐĄ˘\n\
+ ¤Ű¤Č¤ó¤É¤ÎŔßÄę¤ĎşŃ¤ó¤Ç¤¤¤ë¤Ď¤ş¤Ç¤šĄŁ\n"
+ } else {
+ set message "\n\n"
+ }
+ append message "\
+ ¤Ţ¤şĄ˘Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ËşÇĹŹ¤ĘĽľĄźĽĐĄź¤ňÁޤó¤Ç\n\
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ˇ¤Ć<README ĽŐĽĄĽ¤Ľë¤ňĆɤŕ> ¤ň˛Ą¤ˇ¤Ć\n\
+ ¤˝¤ÎĽľĄźĽĐĄź¤ËÂĐąţ¤š¤ë README ¤ňĆɤó¤Ç˛ź¤ľ¤¤ĄŁ\n\
+ ¤â¤ˇĄ˘¤ł¤ÎĽÜĽżĽó¤ŹÍ­¸ú¤Ë¤Ę¤Ă¤Ć¤Ę¤ą¤ě¤ĐĄ˘¤˝¤Î\n\
+ ¤Ë¤Ď README ĽŐĽĄĽ¤Ľë¤ŹÂ¸şß¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ\n\n\
+ źĄ¤ËĄ˘Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ËťČ¤ď¤ě¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Č\n\
+ RAMDAC ¤ň README ¤Ë˝ń¤¤¤Ć¤˘¤ë¤č¤Ś¤ËÁޤó¤Ç˛ź¤ľ¤¤ĄŁ\n\
+ ¤ż¤¤¤Ć¤¤¤ĎĽľĄźĽĐĄź¤ŹźŤĆ°Ç§źą(Probe) ¤ˇ¤Ć¤Ż¤ě¤ë¤Î¤Ç\n\
+ ¤ł¤ě¤ňŔßÄꤚ¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ\n\n\
+ ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Ë¤Ä¤¤¤Ć¤ĎĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤ËĽŻĽíĽĂĽŻ\n\
+ ĽÁĽĂĽ×¤ŹÁȤߚţ¤Ţ¤ě¤Ć¤¤¤ë¤Ę¤É¤ÎĆĂźě¤Ęžěšç¤Ç¤Ę¤ą¤ě¤Đ\n\
+ ÁޤÖÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ\n\n\
+ źĄ¤ËĄ˘README ¤ňĆɤߤʤŹ¤éÉŹÍ×¤ĘĽŞĽ×ĽˇĽçĽó¤ňŔßÄę\n\
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ\n\n\
+ ¤¤¤Ż¤Ä¤Ť¤ÎÂŽĹ٤ŹÁŞ¤Ů¤ë¤č¤Ś¤ĘźďÎŕ¤Î RAMDAC¤Ç¤˘¤ě¤ĐĄ˘\n\
+ RAMDAC ¤ÎşÇÂçÂŽĹ٤ňŔßÄꤚ¤ë¤ł¤Č¤â¤Ç¤­¤Ţ¤šĄŁ¤˝¤Ś¤ˇ¤Ę¤¤žěšçĄ˘\n\
+ ĽľĄźĽĐĄź¤ĎşÇÂçÂŽĹ٤ňźŤĆ°Ç§źą¤š¤ë¤ł¤Č¤Ď¤Ç¤­¤Ę¤¤¤Î¤ÇĄ˘¤˝¤Î \n\
+ RAMDAC ¤ÇťČÍѲÄÇ˝¤Ę°ěČÖĂ٤¤ÂŽĹ٤ŹťČ¤ď¤ě¤ë¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄŁ\n\n\
+ ¤˝¤Îž¤ËĄ˘VRAM ¤ÎÎ̤ňŔßÄꤚ¤ë¤ł¤Č¤â¤Ç¤­¤Ţ¤šĄŁ¤ż¤Ŕ¤ˇĄ˘\n\
+ ÄĚžď¤ĎĽľĄźĽĐĄź¤ŹźŤĆ°Ç§źą¤ˇ¤Ć¤Ż¤ě¤ë¤Î¤Ç¤˝¤ÎÉŹÍפĎ\n\
+ ¤˘¤ę¤Ţ¤ť¤óĄŁ"
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_done.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_done.tcl
new file mode 100644
index 000000000..8d9ae8204
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_done.tcl
@@ -0,0 +1,6 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_done.tcl,v 1.2 1998/04/05 15:30:31 robin Exp $
+#
+set message "\n\n\
+ ¤š¤Ů¤Ć¤ÎŔßÄꤏ˝ŞÎť¤ˇ¤ż¤Ę¤éĄ˘<´°Îť> ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤Ţ¤ŔŔßÄę¤ňÂł¤ą¤ż¤¤žěšç¤Ď˛čĚĚžĺ¤Ë¤˘¤ëĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆŔßÄę¤ňÂł¤ąĄ˘\n\
+ ŔßÄꤏ˝Ş¤Ă¤ż¤éşÇ¸ĺ¤Ë¤â¤Ś°ěĹŮ <ŔßÄ꽪Ν> ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_intro.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_intro.tcl
new file mode 100644
index 000000000..523727b40
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_intro.tcl
@@ -0,0 +1,31 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_intro.tcl,v 1.2 1998/04/05 15:30:31 robin Exp $
+#
+ if !$pc98 {
+ set message "\n\
+ ŔßÄę¤ĎĄ˘Łś¤Ä¤ÎÉôĘŹ¤Ë¤ď¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁžĺ¤Ë¤Ę¤é¤ó¤Ç¤¤¤ëĽÜĽżĽó¤ň\n\
+ ˛Ą¤ť¤ĐĄ˘¤˝¤ÎšŕĚܤÎŔßÄꤏ¤Ď¤¸¤Ţ¤ę¤Ţ¤šĄŁ¤É¤ó¤Ę˝çČÖ¤ÇŔßÄę¤ň\n\
+ ¤ˇ¤Ć¤¤¤Ă¤Ć¤âš˝¤ď¤Ę¤¤¤ˇĄ˘˛żĹŮŔßÄę¤ň¤ä¤ęÄž¤ˇ¤Ć¤âš˝¤¤¤Ţ¤ť¤ó¤ŹĄ˘\n\
+ ¤Ţ¤ş¤ĎĽŢĽŚĽš¤ňĆ°¤Ť¤ť¤ë¤č¤Ś¤Ë¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁĽ­ĄźĽÜĄźĽÉ\n\
+ ¤Ŕ¤ą¤ÇŔßÄę¤ň¤š¤Ů¤ĆšÔ¤Ę¤Ś¤Î¤ĎĄ˘ÂçĘѤǤšĄŁ\n\n\
+ ĽŢĽŚĽš¤ÎŔßÄꤏşŃ¤ŕ¤Ţ¤Ç¤Î´Ö¤ĎĄ˘°Ę˛ź¤ÎĽ­ĄźĆţÎϤˤč¤Ă¤ĆÁŕşî¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ :\n\n\
+ \tTAB , Ctrl+TAB\tźĄ¤ÎšŕĚܤ˰ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tSHIFT+TAB\tÁ°¤ÎšŕĚܤ˰ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tĽŤĄźĽ˝ĽëĽ­Ąź\t˛Ą¤ˇ¤żĘý¸ţ¤Ë°ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tĽęĽżĄźĽó(ENTER)\t¸˝şßĄ˘ĽŤĄźĽ˝Ľë¤Î¤˘¤ëšŕĚܤňÍ­¸ú¤Ë¤ˇ¤Ţ¤š\n\n\
+ ¤˝¤Î¤Ű¤Ť¤ËĄ˘ALT ¤ČĄ˘šŕĚܤÎĂć¤ÎĽ˘ĽóĽŔĄźĽéĽ¤Ľó¤Î°ú¤¤¤Ć¤˘¤ë\n\
+ ʸťú¤ň˛Ą¤ť¤ĐĄ˘¤˝¤ÎšŕĚܤŹÍ­¸ú¤Ë¤Ę¤ę¤Ţ¤šĄŁ"
+} else {
+ set message "\n\
+ ŔßÄę¤ĎĄ˘Łľ¤Ä¤ÎÉôĘŹ¤Ë¤ď¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁžĺ¤Ë¤Ę¤é¤ó¤Ç¤¤¤ëĽÜĽżĽó¤ň\n\
+ ˛Ą¤ť¤ĐĄ˘¤˝¤ÎšŕĚܤÎŔßÄꤏ¤Ď¤¸¤Ţ¤ę¤Ţ¤šĄŁ¤É¤ó¤Ę˝çČÖ¤ÇŔßÄę¤ň\n\
+ ¤ˇ¤Ć¤¤¤Ă¤Ć¤âš˝¤ď¤Ę¤¤¤ˇĄ˘˛żĹŮŔßÄę¤ň¤ä¤ęÄž¤ˇ¤Ć¤âš˝¤¤¤Ţ¤ť¤ó¤ŹĄ˘\n\
+ ¤Ţ¤ş¤ĎĽŢĽŚĽš¤ňĆ°¤Ť¤ť¤ë¤č¤Ś¤Ë¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁĽ­ĄźĽÜĄźĽÉ\n\
+ ¤Ŕ¤ą¤ÇŔßÄę¤ň¤š¤Ů¤ĆšÔ¤Ę¤Ś¤Î¤ĎĄ˘ÂçĘѤǤšĄŁ\n\n\
+ ĽŢĽŚĽš¤ÎŔßÄꤏşŃ¤ŕ¤Ţ¤Ç¤Î´Ö¤ĎĄ˘°Ę˛ź¤ÎĽ­ĄźĆţÎϤˤč¤Ă¤ĆÁŕşî¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ :\n\n\
+ \tTAB , Ctrl+TAB\tźĄ¤ÎšŕĚܤ˰ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tSHIFT+TAB\tÁ°¤ÎšŕĚܤ˰ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tĽŤĄźĽ˝ĽëĽ­Ąź\t˛Ą¤ˇ¤żĘý¸ţ¤Ë°ÜĆ°¤ˇ¤Ţ¤š\n\
+ \tĽęĽżĄźĽó\t¸˝şßĄ˘ĽŤĄźĽ˝Ľë¤Î¤˘¤ëšŕĚܤňÍ­¸ú¤Ë¤ˇ¤Ţ¤š\n\n\
+ ¤˝¤Î¤Ű¤Ť¤ËĄ˘GRPH ¤ČĄ˘šŕĚܤÎĂć¤ÎĽ˘ĽóĽŔĄźĽéĽ¤Ľó¤Î°ú¤¤¤Ć¤˘¤ë\n\
+ ʸťú¤ň˛Ą¤ť¤ĐĄ˘¤˝¤ÎšŕĚܤŹÍ­¸ú¤Ë¤Ę¤ę¤Ţ¤šĄŁ"
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_keyboard.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_keyboard.tcl
new file mode 100644
index 000000000..5ba8c4996
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_keyboard.tcl
@@ -0,0 +1,13 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_keyboard.tcl,v 1.2 1998/04/05 15:30:31 robin Exp $
+#
+set message "\n\n\n\
+ ¤Ţ¤şĄ˘Ľ­ĄźĽÜĄźĽÉ¤ÎĽâĽÇĽë¤Ť¤éĄ˘ťČ¤Ă¤Ć¤¤¤ëźďÎŕ¤ň\n\
+ Áޤó¤Ç˛ź¤ľ¤¤ĄŁ¤â¤ˇ¤âĽęĽšĽČ¤ÎĂć¤Ë¤Ę¤ą¤ě¤ĐĄ˘°ěČÖ\n\
+ śá¤¤¤â¤Î¤ňÁŞ¤Ů¤Đ¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁ\n\
+ Ľ°ĽéĽŐĽŁĽĂĽŻ¤ŹÉĎźĺ¤Ę¤Î¤Ď¤˝¤Î¤Ś¤Á˝¤Ŕľ¤ľ¤ě¤ë¤Ď¤ş¤Ç¤šĄŁ\n\n\
+ ¤Ä¤Ž¤ËĄ˘Ľ­Ąź¤ÎĽěĽ¤Ľ˘ĽŚĽČ¤Č¤˝¤Îž¤ÎĽŞĽ×ĽˇĽçĽó¤ňĄ˘\n\
+ ÉŹÍפ˹ţ¤¸¤ĆŔßÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ\n\
+ <ŔßÄęźÂšÔ> ¤ň˛Ą¤š¤ČĄ˘¸˝şßÁŞÂň¤ľ¤ě¤Ć¤¤¤ëžőÂÖ¤Ź\n\
+ źÂşÝ¤ËĽľĄźĽĐĄź¤ËČżąÇ¤ľ¤ě¤Ţ¤šĄŁ¤˝¤Ś¤š¤ě¤ĐĄ˘¤˝¤ě°Ęšß¤Ď\n\
+ Ľ­ĄźĽČĽĂĽ×¤Ë˝ń¤Ť¤ě¤żÄ̤ę¤Îʸťú¤ŹĆţÎϤǤ­¤ë¤č¤Ś¤Ë\n\
+ ¤Ę¤ë¤Ď¤ş¤Ç¤šĄŁ"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_modeselect.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_modeselect.tcl
new file mode 100644
index 000000000..e2b3b3b6d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_modeselect.tcl
@@ -0,0 +1,19 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_modeselect.tcl,v 1.2 1998/04/05 15:30:32 robin Exp $
+#
+set message "\n\n\n\
+ ťČ¤¤¤ż¤¤˛ňÁüĹ٤ň¤š¤Ů¤ĆÁŞÂň¤ˇĄ˘ÄĚžďťČÍѤš¤ëż§żô¤ň°ě¤ÄÁŞÂň\n\
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ł¤ÇÁŞÂň¤ˇ¤żż§żô¤ĎĄ˘X ĽľĄźĽĐĄź¤ňľŻĆ°¤š¤ëşÝ\n\
+ ¤ËĽŞĽ×ĽˇĽçĽó¤Ë¤č¤Ă¤ĆĚŔź¨ĹŞ¤ËťŘÄꤚ¤ë¤ł¤Č¤ÇĘŃšš¤š¤ë¤ł¤Č¤â\n\
+ ¤Ç¤­¤Ţ¤šĄŁ¤Ţ¤żĄ˘Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤Č VRAM ¤ÎÎ̤ˤč¤Ă¤Ć˛ň\n\
+ ÁüĹ٤ȿ§żô¤ĎŔŠ¸Â¤ľ¤ě¤Ţ¤šĄŁÉ˝ź¨¤Ç¤­¤Ę¤¤ÁȚ礝¤ňÁޤó¤Ŕ¤Č¤ˇ\n\
+ ¤Ć¤âźÂşÝ¤ËťČÍѤš¤ë¤ł¤Č¤Ď¤Ç¤­¤Ę¤¤¤Î¤ÇĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤Ę¤ŞĄ˘ĽÇĽŁĽšĽ×ĽěĽ¤¤ÎŔ­Ç˝¤ňąŰ¤¨¤ż˛ňÁüĹ٤ŹÁŞÂň¤ľ¤ě¤Ć\n\
+ ¤¤¤ëžěšçĄ˘ĽľĄźĽĐĄź¤Ď¤˝¤ě¤ňźŤĆ°Ĺޤ˸ĄĂΤľ¤ě¤ĆŔßÄꤏ\n\
+ şď˝ü¤ľ¤ě¤ë¤Î¤Ç¤˝¤Î¤č¤Ś¤Ę˛ňÁüĹ٤ňÁޤ֤Τâ°ŐĚŁ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ\n\n\
+ ĘŁżô¤Î˛ňÁüĹ٤ňÁŞÂň¤ˇ¤żžěšçĄ˘ĄÖ¤˝¤ÎžĄ×¤ÎĽťĽŻĽˇĽçĽó¤Ç \n\
+ ĽľĄźĽĐĄź¤ŹÎŠ¤Ážĺ¤Ź¤Ă¤Ć¤¤¤ëžőÂ֤ǤβňÁüĹŮĘŃšš¤ňÍ­¸ú¤Ë¤ˇ¤Ć\n\
+ ¤¤¤ě¤ĐĄ˘ĽľĄźĽĐĄź¤ňťČÍŃĂć¤Ë CTRL+ALT(GRPH)+'+' ¤ň˛Ą¤š¤ł¤Č\n\
+ ¤Ç˛ňÁüĹ٤ÎĘŃšš¤Ź˛ÄÇ˝¤Ç¤šĄŁ¤â¤ˇĄ˘źÂşÝ¤ËľŻĆ°¤ˇ¤Ć¤ß¤Ć˛čĚĚ\n\
+ ¤Ź¤ß¤Ŕ¤ě¤ż¤ę¤ˇ¤żžěšç¤â¤č¤ęÄ㤤˛ňÁüĹ٤ËŔÚÂؤ¨¤ě¤ĐÉ˝ź¨¤Ç\n\
+ ¤­¤ë¤ł¤Č¤ŹÂż¤¤¤Î¤ÇĄ˘¤˝¤Îžěšç¤ł¤ÎĽŰĽĂĽČĽ­Ąź¤ňťî¤ˇ¤Ć¤ß¤ë\n\
+ ¤Č¤č¤¤¤Ç¤ˇ¤ç¤ŚĄŁ\n"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_monitor.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_monitor.tcl
new file mode 100644
index 000000000..9e90f36fc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_monitor.tcl
@@ -0,0 +1,16 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_monitor.tcl,v 1.2 1998/04/05 15:30:32 robin Exp $
+#
+set message "\n\n\n\
+ ťČÍѤˇ¤Ć¤¤¤ëĽÇĽŁĽšĽ×ĽěĽ¤¤ÎżĺĘżĄżżâÄžźţÇČżô¤ňĆţÎĎ\n\
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĽŢĽËĽĺĽ˘Ľë¤ÎĄÖťĹÍͥפÎ\n\
+ Íó¤Ę¤É¤Ëľ­şÜ¤ˇ¤Ć¤˘¤ë¤Ď¤ş¤Ç¤šĄŁ\n\n\
+ ¤â¤ˇĄ˘¤˝¤ě¤Ź¸Ť¤Ä¤Ť¤é¤Ę¤Ť¤Ă¤żžěšç¤Ë¤Ď°ěČĚĹŞ¤ĘĽÇĽŁĽšĽ×ĽěĽ¤¤Î\n\
+ ťĹÍͤΰěÍ÷¤Ť¤éĄ˘źŤĘŹ¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤Ëšç¤Ă¤Ć¤¤¤ë¤Čť×¤Ś\n\
+ ¤â¤Î¤ňÁޤó¤Ç˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤ł¤ě¤é¤ÎĂͤϥ˘ŔľłÎ¤Ç¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤Î\n\
+ ťĹÍͤňąŰ¤¨¤żźţÇČżô¤Ç˛čĚ̤ňÉ˝ź¨¤ˇ¤č¤Ś¤Č¤š¤ë¤ČĄ˘şÇ°­¤Î\n\
+ žěšçĄ˘ĽÇĽŁĽšĽ×ĽěĽ¤¤Źąě¤ňżá¤Ż¤Ť¤âĂΤě¤Ţ¤ť¤óĄŁ¤˝¤Ś¤Ç¤Ę¤Ż¤Ć¤â\n\
+ ĽÇĽŁĽšĽ×ĽěĽ¤¤Ë°­ąĆśÁ¤ňľÚ¤Ü¤š¤Ş¤˝¤ě¤Ď˝˝ĘŹ¤Ë¤˘¤ę¤Ţ¤šĄŁ\n\
+ ¤ł¤ł¤ËĆţÎϤš¤ëĂͤŹŔľłÎ¤Ç¤˘¤ě¤ĐĄ˘ĽľĄźĽĐĄź¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Î\n\
+ ¸ÂĹ٤ňąŰ¤¨¤ż˛ňÁüĹŮĄŚż§żô¤Ę¤É¤ňźŤĆ°Ĺޤ˸ĄĂΤˇĄ˘É˝ź¨¤Ç¤­¤ë\n\
+ ĽâĄźĽÉ¤Î¤ß¤ňťČÍѤˇ¤Ţ¤šĄŁ"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_mouse.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_mouse.tcl
new file mode 100644
index 000000000..a3be2b9f9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_mouse.tcl
@@ -0,0 +1,82 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_mouse.tcl,v 1.2 1998/04/05 15:30:32 robin Exp $
+#
+if !$pc98 {
+ set message "\
+ (ĂíĄ§PageDown / Up Ľ­Ąź¤Ë¤č¤Ă¤ĆĄ˘ĽšĽŻĽíĄźĽë¤ˇ¤Ţ¤š)\n\
+ ťĎ¤á¤ËĄ˘p ¤ň˛Ą¤ˇ¤ĆĽŢĽŚĽš¤ÎźďÎŕ¤ňÁޤó¤Ç˛ź¤ľ¤¤ĄŁ¤˝¤Î¸ĺĄ˘ÉŹÍפʤé\n\
+ ¤ĐĽŢĽŚĽš¤Î¤Ä¤Ę¤Ź¤Ă¤Ć¤¤¤ëĽÇĽĐĽ¤ĽšĚž¤ňĘŃšš¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤Ţ¤żĄ˘ĽÜĄźĽě\n\
+ ĄźĽČ¤ňŔßÄꤡ¤Ć¤â¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁ¤Ę¤ŞĄ˘ÁŞÂň¤ň¤ˇ¤Ć¤¤¤ë´ÖĄ˘ĽŢĽŚĽš¤ňż¨\n\
+ ¤é¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁŔľ¤ˇ¤ŻŔßÄę¤Ç¤­¤ż¤éĄ˘a ¤ň˛Ą¤ˇ¤ĆŔßÄę¤ňźÂşÝ¤ËšÔ¤Ę\n\
+ ¤¤¤Ţ¤šĄŁ¤˝¤Î¸ĺĄ˘ĽŢĽŚĽš¤ňĆ°¤Ť¤ˇ¤ĆĄ˘Ć°¤Ż¤ŤłÎ¤Ť¤á¤Ć˛ź¤ľ¤¤ĄŁĆ°¤Ť¤Ę¤ą\n\
+ ¤ě¤ĐĄ˘ŔßÄę¤ň¤â¤Ś°ěĹ٤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ĽŢĽŚĽš¤ŹĆ°¤¤¤ż¤éĄ˘ĽŢĽŚĽš¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆŔľ¤ˇ¤ŻĆ°¤¤¤Ć¤¤¤ë¤ŤłÎ¤Ť\n\
+ ¤á¤Ć˛ź¤ľ¤¤ĄŁ¤â¤ˇĄ˘3ĽÜĽżĽóĽŢĽŚĽš¤ňťČ¤Ă¤Ć¤¤¤ĆĄ˘żżĂć¤ÎĽÜĽżĽó¤ŹĆ°¤Ť\n\
+ ¤Ę¤¤¤Ę¤éĄ˘ChordMiddle ¤ä Emulate3Buttons ¤ňťî¤ˇ¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ĂíĄ§Logitech ¤Č¤¤¤ŚźďÎŕ¤ĎĄ˘¸Ĺ¤¤ĽíĽ¸ĽĆĽĂĽŻ¤ÎĽŢĽŚĽšÍѤǤšĄŁ\n\
+ ¸˝şß¤Î¤â¤Î¤ĎĄ˘Microsoft ¤Ť MouseMan ¤Č¤¤¤ŚźďÎŕ¤ňÁޤó\n\
+ ¤Ç˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤Ę¤ŞĄ˘Emulate3Buttons ¤ňÁŞ¤Ö¤ČĄ˘ĽŢĽŚĽš¤Îş¸ąŚĽÜĽżĽó¤ňĆąťţ¤Ë˛Ą¤š\n\
+ ¤ł¤Č¤ÇĂćąű¤ÎĽÜĽżĽó¤Ź˛Ą¤ľ¤ě¤ż¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄŁ3-button timeout ¤ň\n\
+ ĹŹĹö¤ËĘŃšš¤ˇ¤ĆĄ˘ťČ¤¤¤ä¤š¤¤¤č¤Ś¤Ë¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ \tĽ­Ąź\t\tĆ°şî\n\
+ ------------------------------------------------------\n\
+ \ta\t-\tŔßÄę¤ÎĘŃšš¤ňźÂşÝ¤ËšÔ¤Ę¤Ś\n\
+ \tb\t-\tĽÜĄźĽěĄźĽČ¤ňĘŃšš¤š¤ë\n\
+ \tc\t-\tChord Middle ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \td\t-\tClearDTR ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \te\t-\tEmulate3button ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \tl\t-\tĽŢĽŚĽš¤Î´śĹ٤ňĘŃšš¤š¤ë\n\
+ \tn\t-\tĽŢĽŚĽš¤ÎĽÇĽĐĽ¤ĽšĚž¤ňŔßÄꤚ¤ë\n\
+ \tp\t-\tĽŢĽŚĽš¤ÎźďÎŕ¤ňÁޤÖ\n\
+ \tr\t-\tClearRTS ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \ts\t-\tĽľĽóĽ×ĽëĽěĄźĽČ¤ňÁý¤ä¤š\n\
+ \tt\t-\t3ĽÜĽżĽóĽ¨ĽßĽĺĽěĄźĽˇĽçĽó¤ÎďçĂͤňÁý¤ä¤š\n\
+ \t3\t-\tĽÜĽżĽóżô¤ňŁł¸Ä¤Ë¤š¤ë\n\
+ \t4\t-\tĽÜĽżĽóżô¤ňŁ´¸Ä¤Ë¤š¤ë\n\
+ \t5\t-\tĽÜĽżĽóżô¤ňŁľ¸Ä¤Ë¤š¤ë\n\
+ ------------------------------------------------------\n\
+ TAB ¤ä SHIFT-TAB ¤ňťČ¤Ś¤ł¤Č¤ÇĽÜĽżĽó¤ňÁޤ֤ł¤Č¤Ź¤Ç¤­Ą˘¤˝¤ł¤Ç\n\
+ Enter ¤ň˛Ą¤š¤ł¤Č¤ÇĽÜĽżĽó¤ň˛Ą¤š¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\n\
+ ¤č¤ęžÜ¤ˇ¤¤ŔâĚŔ¤ĎĄ˘ĽÉĽ­ĽĺĽáĽóĽČĽŐĽĄĽ¤Ľë¤ňĆɤó¤Ç˛ź¤ľ¤¤ĄŁ\n\n"
+} else {
+ set message "\
+ (ĂíĄ§ROLL UP/DOWN Ľ­Ąź¤Ë¤č¤Ă¤ĆĄ˘ĽšĽŻĽíĄźĽë¤ˇ¤Ţ¤š)\n\
+ ¤â¤ˇ¤âĄ˘ŁšŁ¸É¸˝ŕĽŢĽŚĽšĄĘĽĐĽšĽŢĽŚĽšĄË¤ňťČ¤Ă¤Ć¤¤¤ë¤Ę¤éĄ˘ĽŢĽŚĽš¤ň\n\
+ Ć°¤Ť¤ˇ¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄŁ¤â¤ˇĆ°¤Ť¤Ę¤ą¤ě¤ĐĄ˘ĽŢĽŚĽš¤ÎťÉ¤ľ¤Ă¤Ć¤¤¤ë\n\
+ ĽÇĽĐĽ¤Ľš¤ňÁŞÂň¤ˇ¤ĆĄ˘<ŔßÄęźÂšÔ> ¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄŁ\n\
+ ¤˝¤ě¤Ç¤âĆ°¤Ť¤Ę¤ą¤ě¤ĐĄ˘ĽÇĽĐĽ¤Ľš¤ŹĽŤĄźĽÍĽë¤Ëǧźą¤ľ¤ě¤Ć¤¤¤ë¤ŤĄ˘\n\
+ łÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤˝¤Ś¤Ç¤Ę¤¤žěšçĄ˘ťĎ¤á¤ËĄ˘p ¤ň˛Ą¤ˇ¤ĆĽŢĽŚĽš¤ÎźďÎŕ¤ňÁޤó¤Ç˛ź¤ľ¤¤ĄŁ\n\
+ ¤˝¤Î¸ĺĄ˘ÉŹÍפʤé¤ĐĽŢĽŚĽš¤Î¤Ä¤Ę¤Ź¤Ă¤Ć¤¤¤ëĽÇĽĐĽ¤ĽšĚž¤ňĘŃšš¤ˇ¤Ć\n\
+ ˛ź¤ľ¤¤ĄŁ¤Ţ¤żĄ˘ĽÜĄźĽěĄźĽČ¤ňŔßÄꤡ¤Ć¤â¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁ¤Ę¤ŞĄ˘ÁŞÂň¤ň\n\
+ ¤ˇ¤Ć¤¤¤ë´ÖĄ˘ĽŢĽŚĽš¤ňż¨¤é¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁŔľ¤ˇ¤ŻŔßÄę¤Ç¤­¤ż¤éĄ˘\n\
+ a ¤ň˛Ą¤ˇ¤ĆŔßÄę¤ňźÂşÝ¤ËšÔ¤Ę¤¤¤Ţ¤šĄŁ¤˝¤Î¸ĺĄ˘ĽŢĽŚĽš¤ňĆ°¤Ť¤ˇ¤ĆĄ˘\n\
+ Ć°¤Ż¤ŤłÎ¤Ť¤á¤Ć˛ź¤ľ¤¤ĄŁĆ°¤Ť¤Ę¤ą¤ě¤ĐĄ˘ŔßÄę¤ň¤â¤Ś°ěĹ٤ä¤ęÄž¤ˇ¤Ć\n\
+ ˛ź¤ľ¤¤ĄŁ\n\n\
+ ĽŢĽŚĽš¤ŹĆ°¤¤¤ż¤éĄ˘ĽŢĽŚĽš¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆŔľ¤ˇ¤ŻĆ°¤¤¤Ć¤¤¤ë¤ŤłÎ¤Ť\n\
+ ¤á¤Ć˛ź¤ľ¤¤ĄŁ¤â¤ˇĄ˘3ĽÜĽżĽóĽŢĽŚĽš¤ňťČ¤Ă¤Ć¤¤¤ĆĄ˘żżĂć¤ÎĽÜĽżĽó¤ŹĆ°¤Ť\n\
+ ¤Ę¤¤¤Ę¤éĄ˘ChordMiddle ¤ä Emulate3Buttons ¤ňťî¤ˇ¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ ¤Ę¤ŞĄ˘Emulate3Buttons ¤ňÁŞ¤Ö¤ČĄ˘ĽŢĽŚĽš¤Îş¸ąŚĽÜĽżĽó¤ňĆąťţ¤Ë˛Ą¤š\n\
+ ¤ł¤Č¤ÇĂćąű¤ÎĽÜĽżĽó¤Ź˛Ą¤ľ¤ě¤ż¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄŁ3-button timeout ¤ň\n\
+ ĹŹĹö¤ËĘŃšš¤ˇ¤ĆĄ˘ťČ¤¤¤ä¤š¤¤¤č¤Ś¤Ë¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\
+ \tĽ­Ąź\t\tĆ°şî\n\
+ ------------------------------------------------------\n\
+ \ta\t-\tŔßÄę¤ÎĘŃšš¤ňźÂşÝ¤ËšÔ¤Ę¤Ś\n\
+ \tb\t-\tĽÜĄźĽěĄźĽČ¤ňĘŃšš¤š¤ë\n\
+ \tc\t-\tChord Middle ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \td\t-\tClearDTR ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \te\t-\tEmulate3button ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \tl\t-\tĽŢĽŚĽš¤Î´śĹ٤ňĘŃšš¤š¤ë\n\
+ \tn\t-\tĽŢĽŚĽš¤ÎĽÇĽĐĽ¤ĽšĚž¤ňŔßÄꤚ¤ë\n\
+ \tp\t-\tĽŢĽŚĽš¤ÎźďÎŕ¤ňÁޤÖ\n\
+ \tr\t-\tClearRTS ĽÜĽżĽó¤ň˛Ą¤šĄżÎĽ¤š\n\
+ \ts\t-\tĽľĽóĽ×ĽëĽěĄźĽČ¤ňÁý¤ä¤š\n\
+ \tt\t-\t3ĽÜĽżĽóĽ¨ĽßĽĺĽěĄźĽˇĽçĽó¤ÎďçĂͤňÁý¤ä¤š\n\
+ \t3\t-\tĽÜĽżĽóżô¤ňŁł¸Ä¤Ë¤š¤ë\n\
+ \t4\t-\tĽÜĽżĽóżô¤ňŁ´¸Ä¤Ë¤š¤ë\n\
+ \t5\t-\tĽÜĽżĽóżô¤ňŁľ¸Ä¤Ë¤š¤ë\n\
+ ------------------------------------------------------\n\
+ TAB ¤ä SHIFT-TAB ¤ňťČ¤Ś¤ł¤Č¤ÇĽÜĽżĽó¤ňÁޤ֤ł¤Č¤Ź¤Ç¤­Ą˘¤˝¤ł¤Ç\n\
+ ĽęĽżĄźĽóĽ­Ąź¤ň˛Ą¤š¤ł¤Č¤ÇĽÜĽżĽó¤ň˛Ą¤š¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\n\
+ ¤č¤ęžÜ¤ˇ¤¤ŔâĚŔ¤ĎĄ˘ĽÉĽ­ĽĺĽáĽóĽČĽŐĽĄĽ¤Ľë¤ňĆɤó¤Ç˛ź¤ľ¤¤ĄŁ\n\n"
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_other.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_other.tcl
new file mode 100644
index 000000000..593d2e18e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_other.tcl
@@ -0,0 +1,8 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/help_other.tcl,v 1.2 1998/04/05 15:30:33 robin Exp $
+#
+set message "\n\n\
+ ¤ł¤ł¤Ç¤ĎĄ˘ĽľĄźĽĐĄź¤Î¤¤¤í¤¤¤í¤ĘĽŞĽ×ĽˇĽçĽó¤ňŔßÄꤡ¤Ţ¤šĄŁ\n\
+ ĽŞĽ×ĽˇĽçĽó¤Ď¤š¤Ç¤ËĄ˘ÉáÄ̝Ȥď¤ě¤ëžőÂÖ¤ËŔßÄꤡ¤Ć¤˘¤ë¤Î¤Ç\n\
+ ĘŃšš¤ň¤š¤ëÉŹÍפϤ˘¤Ţ¤ę¤Ę¤¤¤Ç¤ˇ¤ç¤ŚĄŁ\n\n\
+ ¤â¤ˇĄ˘ĽŞĽ×ĽˇĽçĽó¤Ë¤Ä¤¤¤Ć¤ÎžÜ¤ˇ¤¤žđĘ󤏤ۤˇ¤ą¤ě¤ĐĄ˘\n\
+ XF86Config ¤Î man page ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/message_proc.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/message_proc.tcl
new file mode 100644
index 000000000..08a9958ea
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/message_proc.tcl
@@ -0,0 +1,88 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/message_proc.tcl,v 1.2 1998/04/05 15:30:33 robin Exp $
+#
+# These procedures generate local messages with arguments
+
+proc make_message_phase4 { saveto } {
+ global messages
+ set messages(phase4.2) \
+ "ĽŐĽĄĽ¤Ľë $saveto ¤ÎĽĐĽĂĽŻĽ˘ĽĂĽ×ĽŐĽĄĽ¤ĽëĄ˘$saveto.bak ¤Ź\n\
+ şî¤ě¤Ę¤¤¤Î¤ÇĄ˘ŔßÄę¤ĎĘݸ¤ľ¤ě¤Ţ¤ť¤ó¤Ç¤ˇ¤żĄŁ\n\
+ ĽŐĽĄĽ¤ĽëĚž¤ňĘŃšš¤ˇ¤ĆĄ˘Ęݸ¤ˇÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase4.3) "şŁ¤Ţ¤Ç¤ÎŔßÄęĽŐĽĄĽ¤Ľë¤Ď $saveto.bak ¤Ë \n\
+ ĽĐĽĂĽŻĽ˘ĽĂĽ×¤Č¤ˇ¤ĆĘݸ¤ľ¤ě¤Ţ¤ˇ¤żĄŁ"
+ set messages(phase4.4) \
+ "ĽŐĽĄĽ¤Ľë $saveto ¤ËŔßÄę¤ňĘݸ¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤ť¤óĄŁ\n\n\
+ ĽŐĽĄĽ¤ĽëĚž¤ňĘŃšš¤ˇ¤ĆĘݸ¤ˇÄž¤ˇ¤Ć˛ź¤ľ¤¤"
+ set messages(phase4.5) "X ¤ÎŔßÄꤏ´°Îť¤ˇ¤Ţ¤ˇ¤żĄŁ\n\n"
+}
+proc make_message_card { args } {
+ global pc98 messages Xwinhome
+ global cardServer
+
+ set mes ""
+ if !$pc98 {
+ if ![file exists $Xwinhome/bin/XF86_$cardServer] {
+ if ![string compare $args cardselected] {
+ set mes \
+ "!!! ¤ł¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ËÉŹÍפʼľĄźĽĐĄź¤Ď\
+ Ľ¤ĽóĽšĽČĄźĽë¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁŔßÄę¤ňĂćĂǤˇ¤ĆĄ˘\
+ $cardServer ĽľĄźĽĐĄź¤ň $Xwinhome/bin/XF86_$cardServer \
+ ¤ÎĚžÁ°¤ÇĽ¤ĽóĽšĽČĄźĽë¤ˇĄ˘¤â¤Ś°ěĹŮŔßÄę¤ň \
+ ¤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ !!!"
+ } else {
+ set mes \
+ "!!! ÁŞÂň¤ľ¤ě¤żĽľĄźĽĐĄź¤ĎĽ¤ĽóĽšĽČĄźĽë \
+ ¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁŔßÄę¤ňĂćĂǤˇ¤ĆĄ˘\
+ $cardServer ĽľĄźĽĐĄź¤ň $Xwinhome/bin/XF86_$cardServer \
+ ¤ÎĚžÁ°¤ÇĽ¤ĽóĽšĽČĄźĽë¤ˇĄ˘¤â¤Ś°ěĹŮŔßÄę¤ň \
+ ¤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ !!!"
+ }
+ bell
+ }
+ } else {
+ if ![file exists $Xwinhome/bin/XF98_$cardServer] {
+ if ![string compare $args cardselected] {
+ set mes \
+ "!!! ¤ł¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ËÉŹÍפʼľĄźĽĐĄź¤Ď\
+ Ľ¤ĽóĽšĽČĄźĽë¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁŔßÄę¤ňĂćĂǤˇ¤ĆĄ˘\
+ $cardServer ĽľĄźĽĐĄź¤ň $Xwinhome/bin/XF98_$cardServer \
+ ¤ÎĚžÁ°¤ÇĽ¤ĽóĽšĽČĄźĽë¤ˇĄ˘¤â¤Ś°ěĹŮŔßÄę¤ň \
+ ¤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ !!!"
+ } else {
+ set mes \
+ "!!! ÁŞÂň¤ľ¤ě¤żĽľĄźĽĐĄź¤ĎĽ¤ĽóĽšĽČĄźĽë \
+ ¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁŔßÄę¤ňĂćĂǤˇ¤ĆĄ˘\
+ $cardServer ĽľĄźĽĐĄź¤ň $Xwinhome/bin/XF98_$cardServer \
+ ¤ÎĚžÁ°¤ÇĽ¤ĽóĽšĽČĄźĽë¤ˇĄ˘¤â¤Ś°ěĹŮŔßÄę¤ň \
+ ¤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ !!!"
+ }
+ bell
+ }
+ }
+ return $mes
+}
+
+proc make_intro_headline { win } {
+ global pc98
+ $win tag configure heading \
+ -font -jis-fixed-medium-r-normal--24-230-*-*-c-*-jisx0208.1983-0
+ if !$pc98 {
+ $win insert end \
+ "ŁŘŁĆŁ¸ŁśŁÓŁĺŁôŁőŁđ¤Ë¤Ä¤¤¤Ć" heading
+ } else {
+ $win insert end \
+ "ŁŘŁĆŁšŁ¸ŁÓŁĺŁôŁőŁđ¤Ë¤Ä¤¤¤Ć" heading
+ }
+}
+
+proc make_underline { win } {
+ $win.menu.mouse configure -underline 4
+ $win.menu.keyboard configure -underline 6
+ $win.menu.card configure -underline 4
+ $win.menu.monitor configure -underline 7
+ $win.menu.modeselect configure -underline 4
+ $win.menu.other configure -underline 4
+ $win.buttons.abort configure -underline 3
+ $win.buttons.done configure -underline 5
+ $win.buttons.help configure -underline 4
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/messages.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/messages.tcl
new file mode 100644
index 000000000..7ead51647
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/messages.tcl
@@ -0,0 +1,402 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/ja/messages.tcl,v 1.3 1998/04/05 16:15:56 robin Exp $
+#
+# messages in done.tcl :
+set messages(done.1) "\n\
+ ŔßÄę¤ň¤š¤Ů¤Ć´°Îť¤ˇ¤Ć¤č¤í¤ˇ¤¤¤Ç¤š¤ŤĄŠ\n\n\
+ ¤č¤ą¤ě¤Đ <´°Îť> ĽÜĽżĽó¤ň˛Ą¤š¤ł¤Č¤ÇĄ˘¤ł¤ÎŔßÄę¤Ç X ĽľĄźĽĐĄź¤ň\n\
+ Ί¤Á¤˘¤˛¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\
+ ¤Ţ¤ŔŔßÄę¤ňÂł¤ą¤ż¤¤žěšç¤Ď˛čĚĚžĺ¤Ë¤˘¤ëĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆŔßÄę¤ňÂł¤ąĄ˘\n\
+ ŔßÄꤏ˝Ş¤Ă¤ż¤éşÇ¸ĺ¤Ë¤â¤Ś°ěĹŮ <ŔßÄ꽪Ν> ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+set messages(done.2) "´°Îť"
+
+# messages in srvflags :
+set messages(srvflags.1) "ĽľĄźĽĐĄźŔßÄę¤ÎĽŞĽ×ĽˇĽçĽó\n\n\
+ ¤ł¤ě¤é¤ÎĽŞĽ×ĽˇĽçĽó¤Ď¤˘¤é¤Ť¤¸¤áĄ˘ÄĚžď¤ÎŔßÄꤏÁŞÂň¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ\n\
+ ¤Ş¤˝¤é¤ŻĄ˘ĘŃšš¤ÎÉŹÍפϤʤ¤¤Ç¤ˇ¤ç¤ŚĄŁ"
+set messages(srvflags.2) "Ctrl-Alt-Backspace ¤Îť°¤Ä¤ÎĽ­Ąź¤ň˛Ą¤š¤ł¤Č¤Ç\n\
+ ĽľĄźĽĐĄź¤ňśŻŔŠ˝ŞÎť¤Ç¤­¤ë¤č¤Ś¤Ë¤š¤ëĄŁ"
+set messages(srvflags.3) "ĽľĄźĽĐĄź¤ŹÎŠ¤Ážĺ¤Ź¤Ă¤żžőÂ֤ǤβňÁüĹŮĘŃšš¤ň\n\
+ ¤Ç¤­¤ë¤č¤Ś¤Ë¤š¤ëĄŁ "
+set messages(srvflags.4) "ĽˇĽ°ĽĘĽë¤ňĚľťë¤š¤ë ĄÄ \n\
+ ĄĄĄĄĄĄĄĄĄĄ prevents the server from exitting cleanly"
+set messages(srvflags.5) "ž¤ÎĽŰĽšĽČ¤Ë¤č¤Ă¤Ć˛ňÁüĹ٤ňĘŃšš¤Ç¤­¤ë¤č¤Ś¤Ë¤š¤ë"
+set messages(srvflags.6) "ž¤ÎĽŰĽšĽČ¤Ë¤č¤Ă¤ĆĽ­ĄźĽÜĄźĽÉ¤ČĽŢĽŚĽš¤Î\n\
+ ŔßÄę¤ňĘŃšš¤Ç¤­¤ë¤č¤Ś¤Ë¤š¤ë"
+
+# messages in phase2 :
+set messages(phase2.1) "Ί¤Á¤˘¤˛¤Ć¤¤¤Ţ¤šĄŁ¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ\n\n\n"
+set messages(phase2.2) \
+ "ĽľĄźĽĐĄź¤Ť¤éĽ­ĄźĽÜĄźĽÉžđĘó¤ňĆɤߚţ¤ŕ¤ł¤Č¤Ź¤Ç¤­¤Ţ¤ť¤ó¤Ç¤ˇ¤żĄŁ\n\n\
+ XKEYBOARD extension ¤ňÁȤߚţ¤ó¤Ç¤¤¤Ę¤¤¤ŤĄ˘Ěľ¸ú¤Ë \
+ ¤ˇ¤Ć¤¤¤ëĽľĄźĽĐĄź¤ňťČÍѤˇ¤Ć¤¤¤Ţ¤ť¤ó¤ŤĄŠ\n\n\
+ XKEYBOARD extension ¤ĎÉԲġç¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘¤Ę¤¤žěšç¤Ë \
+ Ľ­ĄźĽÜĄźĽÉŔßÄꤏ˝˝ĘŹ¤Ë¤Ç¤­¤Ę¤¤¤Ş¤˝¤ě¤Ź¤˘¤ę¤Ţ¤šĄŁ\n\n\
+ ÂłšÔ¤ˇ¤Ţ¤šĄÄ"
+set messages(phase2.3) ĽŢĽŚĽš(M)
+set messages(phase2.4) Ľ­ĄźĽÜĄźĽÉ(K)
+set messages(phase2.5) ĽŤĄźĽÉ(C)
+set messages(phase2.6) ĽÇĽŁĽšĽ×ĽěĽ¤(D)
+set messages(phase2.7) ˛ňÁüĹŮ(M)
+set messages(phase2.8) ¤˝¤Îž(O)
+set messages(phase2.9) Ăćťß(A)
+set messages(phase2.10) ŔßÄ꽪Ν(D)
+set messages(phase2.11) ĽŘĽëĽ×(H)
+if !$pc98 {
+ set messages(phase2.12) "\n\
+¤Ţ¤şĄ˘¤ł¤ÎĽáĽĂĽťĄźĽ¸¤äĽŘĽëĽ×¤Î˛ź¤ÎĘý¤ŹĆɤá¤Ę¤¤žěšçĄ˘PageUp/Down¤Ę¤É¤ÎĽ­Ąź¤ň\n\
+˛Ą¤š¤ł¤Č¤ÇĽšĽŻĽíĄźĽë¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\n\
+ĽľĄźĽĐĄź¤ÎŔßÄę¤ĎĄ˘6¤Ä¤ÎÉôĘŹ¤Ë¤ď¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁ\n\
+\tĽŢĽŚĽš\t\tĄÄ ĽŢĽŚĽš¤ÎĽ×ĽíĽČĽłĽëĄ˘ÄĚżŽÂŽĹ٤ʤɤňŔßÄꤡ¤Ţ¤šĄŁ\n\
+\tĽ­ĄźĽÜĄźĽÉ\t\tĄÄ Ľ­ĄźĽÜĄźĽÉ¤Î¸Ŕ¸ě¤ČĽěĽ¤Ľ˘ĽŚĽČ¤ňŔßÄꤡ¤Ţ¤šĄŁ\n\
+\tĽŤĄźĽÉ\t\tĄÄ ťČÍѤš¤ëĽ°ĽéĽŐĽŁĽĂĽŻĄŚĽ˘ĽŻĽťĽéĽěĄźĽż(SVGA ĽŤĄźĽÉ) \n\
+\t\t\t ¤ÎŔßÄę¤ňšÔ¤Ę¤¤¤Ţ¤šĄŁ\n\
+\tĽÇĽŁĽšĽ×ĽěĽ¤\tĄÄ ĽÇĽŁĽšĽ×ĽěĽ¤¤ŹÉ˝ź¨¤Ç¤­¤ëżĺĘżĄŚżâÄžźţÇČżô¤ň\n\
+\t\t\t ŔßÄꤡ¤Ţ¤šĄŁ\n\
+\t˛ňÁüĹŮ\t\tĄÄ ˛čĚ̤βňÁüĹ٤ȿ§żô¤ňŔßÄꤡ¤Ţ¤šĄŁ\n\
+\t¤˝¤Îž\t\tĄÄ ¤˝¤Îž¤ÎŔßÄę¤ňšÔ¤Ę¤¤¤Ţ¤šĄŁ\n\n\
+¤Ţ¤şĄ˘ĽŢĽŚĽš¤ÎŔßÄꤍ¤éťĎ¤á¤ë¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ(Enter Ľ­Ąź¤ň˛Ą¤ť¤Đ\n\
+ŔßÄꤏťĎ¤Ţ¤ę¤Ţ¤šĄŁ)\n\
+¤š¤Ů¤Ć¤ÎŔßÄꤏ˝Ş¤Ă¤ż¤éĄ˘˛ź¤Ë¤˘¤ë<ŔßÄ꽪Ν> ¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ĽÜĽżĽó¤ňÁŞ¤Öťţ¤ĎĄ˘CTRL ¤Ţ¤ż¤Ď ALT Ľ­Ąź¤Č˛źŔţ¤Ź°ú¤¤¤Ć¤˘¤ëʸťúĄĘ¤ż¤Č¤¨¤ĐĄ˘\n\
+ĽŢĽŚĽš¤Ę¤é CTRL+'M' Ľ­ĄźĄË¤ň˛Ą¤šĄ˘ĽŤĄźĽ˝ĽëĽ­Ąź¤äTAB Ľ­Ąź¤Ç¤˝¤ÎÁŞÂňťč¤Ë\n\
+ĽŤĄźĽ˝Ľë¤ňšç¤ď¤ť¤Ć ENTER ¤ň˛Ą¤šĄ˘ĽŢĽŚĽš¤ÇĽÜĽżĽó¤ňş¸ĽŻĽęĽĂĽŻ¤š¤ëĄ˘¤Ę¤É¤ň\n\
+¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤Ţ¤żĄ˘'?'Ľ­Ąź¤ň˛Ą¤š¤ŤĄ˘HELP ĽÜĽżĽó¤ňĽŻĽęĽĂĽŻ¤š¤ě¤ĐłĆŔßÄę¤Ë\n\
+¤Ä¤¤¤ĆĄ˘ĽŘĽëĽ×¤ň¸Ť¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ"
+} else {
+ set messages(phase2.12) "\n\
+¤Ţ¤şĄ˘¤ł¤ÎĽáĽĂĽťĄźĽ¸¤äĽŘĽëĽ×¤Î˛ź¤ÎĘý¤ŹĆɤá¤Ę¤¤žěšçĄ˘ROLLUP/DOWN¤Ę¤É¤ÎĽ­Ąź¤ň\n\
+˛Ą¤š¤ł¤Č¤ÇĽšĽŻĽíĄźĽë¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\n\
+ĽľĄźĽĐĄź¤ÎŔßÄę¤ĎĄ˘5¤Ä¤ÎÉôĘŹ¤Ë¤ď¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁ\n\
+\tĽŢĽŚĽš\t\tĄÄ ĽŢĽŚĽš¤ÎĽ×ĽíĽČĽłĽëĄ˘ÄĚżŽÂŽĹ٤ʤɤňŔßÄꤡ¤Ţ¤šĄŁ\n\
+\tĽŤĄźĽÉ\t\tĄÄ ťČÍѤš¤ëĽ°ĽéĽŐĽŁĽĂĽŻĄŚĽ˘ĽŻĽťĽéĽěĄźĽż(SVGA ĽŤĄźĽÉ) \n\
+\t\t\t ¤ÎŔßÄę¤ňšÔ¤Ę¤¤¤Ţ¤šĄŁ\n\
+\tĽÇĽŁĽšĽ×ĽěĽ¤\tĄÄ ĽÇĽŁĽšĽ×ĽěĽ¤¤ŹÉ˝ź¨¤Ç¤­¤ëżĺĘżĄŚżâÄžźţÇČżô¤ň\n\
+\t\t\t ŔßÄꤡ¤Ţ¤šĄŁ\n\
+\t˛ňÁüĹŮ\t\tĄÄ ˛čĚ̤βňÁüĹ٤ȿ§żô¤ňŔßÄꤡ¤Ţ¤šĄŁ\n\
+\t¤˝¤Îž\t\tĄÄ ¤˝¤Îž¤ÎŔßÄę¤ňšÔ¤Ę¤¤¤Ţ¤šĄŁ\n\n\
+¤Ţ¤şĄ˘ĽŢĽŚĽš¤ÎŔßÄꤍ¤éťĎ¤á¤ë¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ\n\
+\tĄĘĽęĽżĄźĽóĽ­Ąź¤ň˛Ą¤ť¤ĐŔßÄꤏťĎ¤Ţ¤ę¤Ţ¤šĄŁĄË\n\
+¤š¤Ů¤Ć¤ÎŔßÄꤏ˝Ş¤Ă¤ż¤éĄ˘˛ź¤Ë¤˘¤ë<ŔßÄ꽪Ν> ¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\
+ĽÜĽżĽó¤ňÁŞ¤Öťţ¤ĎĄ˘CTRL ¤Ţ¤ż¤Ď GRPH Ľ­Ąź¤Č˛źŔţ¤Ź°ú¤¤¤Ć¤˘¤ëʸťú(¤ż¤Č¤¨¤ĐĄ˘\n\
+ĽŢĽŚĽš¤Ę¤é CTRL+'M' Ľ­ĄźĄË¤ň˛Ą¤šĄ˘ĽŤĄźĽ˝ĽëĽ­Ąź¤ä TAB Ľ­Ąź¤Ç¤˝¤ÎÁŞÂňťč¤Ë\n\
+ĽŤĄźĽ˝Ľë¤ňšç¤ď¤ť¤Ć ĽęĽżĄźĽóĽ­Ąź¤ň˛Ą¤šĄ˘ĽŢĽŚĽš¤ÇĽÜĽżĽó¤ňş¸ĽŻĽęĽĂĽŻ¤š¤ëĄ˘\n\
+¤Ę¤É¤ň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤Ţ¤żĄ˘'?'Ľ­Ąź¤ň˛Ą¤š¤ŤĄ˘HELP ĽÜĽżĽó¤ňĽŻĽęĽĂĽŻ¤š¤ě¤Đ\n\
+łĆŔßÄę¤Ë¤Ä¤¤¤ĆĄ˘ĽŘĽëĽ×¤ň¸Ť¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ"
+}
+set messages(phase2.13) "ĽŘĽëĽ×˝ŞÎť"
+# messages in phase4 :
+set messages(phase4.1) "Ί¤Á¤˘¤˛¤Ć¤¤¤Ţ¤šĄŁ¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ"
+# phase.2-5 is generated by proc 'make_message_phase4'.
+set messages(phase4.6) "Okey"
+set messages(phase4.7) \
+ "˛čĚ̤ÎÂ礭¤ľ¤äĽÇĽŁĽšĽ×ĽěĽ¤žĺ¤Ç¤Î˛čĚ̤ΰĚĂ֤ʤɥ˘˛čĚ̤ÎŔßÄę¤ň\n\
+ ĘŃšš¤š¤ë¤ż¤á¤Ë xvidtune ¤ňťČÍѤš¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ\n\
+ ĘŃšš¤ÎÉŹÍפŹ¤Ę¤¤¤Ę¤é˝ŞÎť¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\n\n\
+ ŔßÄę¤ňĘݸ¤š¤ë¤Č¤­Ą˘¤š¤Ç¤Ëž¤ÎŔßÄꤏ¸şß¤ˇ¤Ć¤¤¤ě¤ĐĽĐĽĂĽŻĽ˘ĽĂĽ×\n\
+ ¤Č¤ˇ¤ĆĘݸ¤ľ¤ě¤Ţ¤šĄŁ"
+set messages(phase4.8) "ŔßÄę¤ňĘݸ¤š¤ëĽŐĽĄĽ¤ĽëĚž"
+set messages(phase4.9) "xvidtune ¤ňťČÍѤš¤ë"
+set messages(phase4.10) "ŔßÄę¤ňĽŐĽĄĽ¤Ľë¤ËĘݸ¤ˇ¤ĆĄ˘˝ŞÎť¤š¤ë"
+set messages(phase4.11) "ĂćĂÇ ĄÄ ŔßÄę¤ňĘݸ¤ˇ¤Ę¤¤¤Ç˝ŞÎť¤š¤ë"
+
+# messages in card.tcl :
+set messages(card.1) "ÁŞÂň¤ľ¤ě¤żĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ :"
+set messages(card.2) "Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ĎÁŞÂň¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁ"
+set messages(card.3) "README ĽŐĽĄĽ¤Ľë¤ňĆɤŕ"
+set messages(card.4) "žÜşŮŔßÄę"
+set messages(card.5) ĽľĄźĽĐĄź:
+set messages(card.7) ĽÁĽĂĽ×ĽťĽĂĽČ
+set messages(card.8) RamDac
+set messages(card.9) ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+set messages(card.10) "RAMDAC Max Speed"
+set messages(card.11) "Probed"
+set messages(card.12) "Video RAM"
+set messages(card.13) "Probed"
+set messages(card.14) "256 Ľ­Ľí"
+set messages(card.15) "512 Ľ­Ľí"
+set messages(card.16) "1 ĽáĽŹ"
+set messages(card.17) "2 ĽáĽŹ"
+set messages(card.18) "3 ĽáĽŹ"
+set messages(card.19) "4 ĽáĽŹ"
+set messages(card.20) "6 ĽáĽŹ"
+set messages(card.21) "8 ĽáĽŹ"
+set messages(card.22) "ÁŞÂň¤ľ¤ě¤ż\nĽŞĽ×ĽˇĽçĽó:"
+set messages(card.23) "XF86Config ¤Î Device ¤Îšŕ¤ËÉŐ¤ą˛Ă¤¨¤ëŔßÄę:"
+#set messages(card.24) "Probed: Yes"
+#set messages(card.25) "Probed: No"
+set messages(card.26) "ĽŤĄźĽÉ¤ÎÁŞÂň"
+set messages(card.27) "žÜşŮŔßÄę"
+set messages(card.28) "ÁŞÂň¤ľ¤ě¤żĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ: "
+set messages(card.29) "˝ŞÎť"
+set messages(card.30) \
+ " ¤Ţ¤şĄ˘ĽľĄźĽĐĄź¤ŹŔľ¤ˇ¤¤¤Ť¤É¤Ś¤Ť¤ż¤ˇ¤Ť¤á¤Ć¤Ť¤éĄ˘\n\
+ ÉŹÍפʤéŔßÄę¤ňĘŃšš¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽÁĽĂĽ×ĽťĽĂĽČĄ˘RamDac Ą˘\n\
+ ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ŹśőÍó¤ÎžěšçĄ˘źŤĆ°Ç§źą¤ľ¤ě¤Ţ¤šĄŁ"
+set messages(card.31) \
+ " ĽęĽšĽČ¤Ť¤éťČ¤Ă¤Ć¤¤¤ëĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ňÁޤó¤Ç˛ź¤ľ¤¤ĄŁ\n\
+ ¤â¤ˇĄ˘ťČ¤Ă¤Ć¤¤¤ëĽŤĄźĽÉ¤ŹĽęĽšĽČ¤Ë¤Ę¤¤žěšçĄ˘žÜşŮŔßÄę¤Î \n\
+ ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+set messages(card.32) \
+ "ÄĚžď¤ÎŔßÄę¤Ç¤č¤ą¤ě¤ĐĄ˘ĽŤĄźĽÉ¤ÎŔßÄę¤Ď¤ł¤ě¤Ç˝˝ĘŹ¤Ç¤šĄŁ\n\
+ ÄĚžď¤Č°ă¤ŚŔßÄę¤ň¤ˇ¤ż¤¤žěšçĄ˘žÜşŮŔßÄę¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+set messages(card.33) \
+ "ÄĚžď¤ÎŔßÄę¤Ç¤č¤ą¤ě¤ĐĄ˘ĽŤĄźĽÉ¤ÎŔßÄę¤Ď¤ł¤ě¤Ç˝˝ĘŹ¤Ç¤šĄŁ\n\
+ ¤ż¤Ŕ¤ˇĄ˘łÎǧ¤Î¤ż¤á¤Ë README ¤ňĆɤŕ¤č¤Ś¤Ë¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ\n\
+ ¤â¤ˇĄ˘¤Ę¤ó¤é¤Ť¤ÎĘŃšš¤ŹÉŹÍפǤ˘¤ě¤ĐžÜşŮŔßÄę¤ÎĽÜĽżĽó¤ň\n\
+ ˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+set messages(card.34) \
+ "¤ł¤ÎĽŤĄźĽÉ¤ĎĄ˘XFree86 ¤Ç¤Ď¤Ţ¤Ŕ´°Á´¤Ë¤ĎĽľĽÝĄźĽČ¤ľ¤ě¤Ć\n\
+ ¤¤¤Ţ¤ť¤óĄŁ¤ż¤Ŕ¤ˇĄ˘ÄĚžď¤ÎVGA ĽâĄźĽÉ¤ÇĆ°¤Ż¤č¤Ś¤Ë\n\
+ ŔßÄę¤ĎşŃ¤ó¤Ç¤¤¤Ţ¤šĄŁ"
+
+# messages in keyboard.tcl :
+set messages(keyboard.1) "ĽâĽÇĽë:"
+set messages(keyboard.2) "ĽěĽ¤Ľ˘ĽŚĽČ (¸Ŕ¸ě):"
+set messages(keyboard.3) "ŔßÄęźÂšÔ"
+set messages(keyboard.4) \
+ "Ŕľ¤ˇ¤¤ĽâĽÇĽë¤ČĽěĽ¤Ľ˘ĽŚĽČ¤ňÁޤó¤Ç˛ź¤ľ¤¤ĄŁ"
+set messages(keyboard.5) "ťČ¤Ś¤ł¤Č¤Î¤Ç¤­¤ëĽŞĽ×ĽˇĽçĽó :"
+set messages(keyboard.6) \
+ "Variant (non U.S. Keyboards only):"
+set messages(keyboard.7) "´űÄęĂͤňťČÍѤš¤ë"
+set messages(keyboard.8) "źşÇÔ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ä¤ęÄž¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+set messages(keyboard.9) "ŔßÄęĂć¤Ç¤šĄÄ"
+set messages(keyboard.10) "¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄÄ"
+
+# messages in modeselect.tcl :
+
+set messages(modeselect.1) "ÍřÍѤˇ¤ż¤¤˛ňÁüĹ٤ňÁŞÂň¤ˇ¤Ć˛ź¤ľ¤¤"
+set messages(modeselect.2) 640x480
+set messages(modeselect.3) 800x600
+set messages(modeselect.4) 1024x768
+set messages(modeselect.5) 1152x864
+set messages(modeselect.6) 1280x1024
+set messages(modeselect.7) 1600x1200
+set messages(modeselect.8) 640x400
+set messages(modeselect.9) 320x200
+set messages(modeselect.10) 320x240
+set messages(modeselect.11) 400x300
+set messages(modeselect.12) 480x300
+set messages(modeselect.13) 512x384
+set messages(modeselect.14) "ťČÍѤš¤ëż§żô¤ňÁŞÂň¤ˇ¤Ć˛ź¤ľ¤¤"
+set messages(modeselect.15) " 256ż§ "
+set messages(modeselect.16) " 65536ż§ "
+set messages(modeselect.17) " 1600Ëüż§(Packed) "
+set messages(modeselect.18) " 1600Ëüż§ "
+
+# messages in monitor.tcl :
+
+set messages(monitor.1) "ĽÇĽŁĽšĽ×ĽěĽ¤¤ÎźţÇČżô"
+set messages(monitor.2) "ÁŞÂň¤ľ¤ě¤żĽÇĽŁĽšĽ×ĽěĽ¤:"
+set messages(monitor.3) "żĺĘżźţÇČżô"
+set messages(monitor.4) "żâÄžźţÇČżô"
+set messages(monitor.5) \
+ "ĽÇĽŁĽšĽ×ĽěĽ¤¤ËÉ˝ź¨˛ÄÇ˝¤ĘżĺĘżĄŚżâÄžźţÇČżô¤ňĆţÎϤˇ¤Ć˛ź¤ľ¤¤ĄŁ\n\
+ ¤ď¤Ť¤é¤Ę¤ą¤ě¤ĐĄ˘ĽęĽšĽČ¤Ť¤éşÇĹŹ¤Čť×¤ď¤ě¤ë¤â¤Î¤ňÁŞÂň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+
+# messages in mouse.tcl :
+
+set messages(mouse.1) "Lines/inch"
+set messages(mouse.2) "ĽľĽóĽ×Ľë\nĽěĄźĽČ"
+set messages(mouse.3) "ĽŢĽŚĽš¤ÎźďÎŕ¤ňÁޤó¤Ç˛ź¤ľ¤¤"
+set messages(mouse.4) "ŔßÄęĂćĄÄ"
+set messages(mouse.5) "ĽŢĽŚĽš¤Î¤˘¤ëĽÇĽĐĽ¤Ľš"
+set messages(mouse.6) "Emulate3Buttons"
+set messages(mouse.7) ChordMiddle
+set messages(mouse.8) "ÄĚżŽÂŽĹŮ"
+set messages(mouse.9) "? ¤Ţ¤ż¤Ď CTRL-H ¤ň˛Ą¤ť¤ĐĄ˘Ľ­ĄźĽÜĄźĽÉ¤ÎťČ¤¤Ęý¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁ"
+set messages(mouse.10) ĽŐĽéĽ°
+set messages(mouse.11) "DTR¤ň\nĽŻĽęĽ˘¤š¤ë"
+set messages(mouse.12) "RTS¤ň\nĽŻĽęĽ˘¤š¤ë"
+set messages(mouse.13) "ĽľĽóĽ×Ľë\nĽěĄźĽČ"
+set messages(mouse.14) "3ĽÜĽżĽóĽ¨ĽßĽĺ\nĽěĄźĽČ¤ÎďçĂÍ"
+set messages(mouse.15) "ŔßÄęźÂšÔ"
+set messages(mouse.16) "? ¤Ţ¤ż¤Ď CTRL-H ¤ň˛Ą¤ť¤ĐĄ˘Ľ­ĄźĽÜĄźĽÉ¤ÎťČ¤¤Ęý¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁ"
+set messages(mouse.17) "˝ŞÎť(X)"
+set messages(mouse.18) 3
+set messages(mouse.19) "´śĹŮ"
+set messages(mouse.20) "šâ"
+set messages(mouse.21) "Ăć"
+set messages(mouse.22) "Äă"
+set messages(mouse.23) "ĽÜĽżĽóżô"
+
+# These messages are viewd by 'mesg' command.
+# Most of users probably do not use kon , so these are English.
+if $pc98 {
+ set messages(done.3) "¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ"
+ set messages(phase1.1) ""
+ set messages(phase1.2) "¤ËĄ˘Ľ¤ĽóĽšĽČĄźĽë¤ľ¤ě¤Ć¤Ę¤¤¤â¤Î¤Ź¤˘¤ę¤Ţ¤šĄŁ\n"
+ set messages(phase1.3) "¤Č¤¤¤ŚĽŐĽĄĽ¤Ľë¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.4) \
+ "ˇŮšđĄ§ README ĽŐĽĄĽ¤Ľë¤ÇĄ˘Ľ¤ĽóĽšĽČĄźĽë¤ľ¤ě¤Ć¤Ę¤¤¤â¤Î¤Ź\
+ ¤˘¤ę¤Ţ¤šĄŁĽ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ÎĽťĽĂĽČĽ˘ĽĂĽ×¤Îťţ¤ËĄ˘¤â¤ˇ¤Ť\
+ ¤š¤ë¤Č README ĽŐĽĄĽ¤Ľë¤Ź¸Ť¤ě¤Ę¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ¤ż¤Ŕ¤ˇĄ˘\
+ ¤˝¤ě°Ęł°¤ÎĆ°şî¤ËĚäÂę¤Ď¤Ş¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.5) "¸˝şß¤ÎŔßÄęĽŐĽĄĽ¤Ľë¤ÎĆɤߚţ¤ßťţ¤ËĽ¨ĽéĄź¤Ź\
+ ČŻŔ¸¤ˇ¤Ţ¤ˇ¤żĄŁ"
+ set messages(phase1.6) \
+ "X11 ¤ÎľŻĆ°˛ź¤ÇĽ×ĽíĽ°ĽéĽŕ¤ňźÂšÔ¤ˇ¤ż¤č¤Ś¤Ç¤šĄŁ\
+ ¸˝şß¤ÎŔßÄę¤ňĘŃšš¤š¤ë¤ż¤á¤ËĄ˘°ŐźąĹޤˤ˝¤Ś¤ˇ¤ż¤Î\
+ ¤Ę¤é¤ĐĄ˘°Ę˛ź¤ÎźÁĚä¤Ëyes ¤ČĹú¤¨¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase1.7) \
+ "¤â¤ˇĄ˘´Ö°ă¤Ă¤Ć¤˝¤Ś¤ˇ¤Ć¤ˇ¤Ţ¤Ă¤żĄ˘¤˘¤ë¤¤¤ĎĄ˘\
+ ¤š¤Ů¤Ć¤ÎŔßÄę¤ňťĎ¤á¤Ť¤é¤ä¤ę¤ż¤¤¤Î¤Ę¤é¤ĐĄ˘\
+ no ¤ČĹú¤¨¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase1.8) "şĆŔßÄę¤ňšÔ¤Ę¤¤¤Ţ¤š¤ŤĄŠ "
+ set messages(phase1.9) \
+ " root °Ęł°¤Ť¤éĽ×ĽíĽ°ĽéĽŕ¤ŹźÂšÔ¤ľ¤ě¤Ţ¤ˇ¤żĄŁ\n\
+ ĽŢĽŚĽšĽÇĽĐĽ¤Ľš¤ÎĘŃššĄ˘ŔßÄę¤ÎĘݸ¤Ę¤É¤Ë¤ĎÄ̞異\n\
+ Superuser Ćø˘¤ŹÉŹÍפȤľ¤ě¤Ţ¤šĄŁ\n\n\
+ ¤˝¤ě¤Ç¤âÂłšÔ¤ˇ¤Ţ¤š¤ŤĄŠ "
+ set messages(phase1.10) \
+ " ťĎ¤á¤Ć¤ÎŔßÄę¤Îťţ¤Ë¤ĎĄ˘¤ł¤ÎĽ×ĽíĽ°ĽéĽŕ¤ň root ¤Ť¤é\
+ źÂšÔ¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.11) \
+ "ťĎ¤á¤Ć¤ÎŔßÄę¤Îťţ¤Ë¤ĎĄ˘XFree86 loader (XF86_LOADER) Ą˘\n\
+ ¤Ţ¤ż¤Ď SVGA server ¤ŹÉŹÍפǤšĄŁ"
+ set messages(phase1.12) \
+ "ťĎ¤á¤Ć¤ÎŔßÄę¤Îťţ¤Ë¤ĎĄ˘XFree86 loader (XF86_LOADER) Ą˘\n\
+ ¤Ţ¤ż¤Ď EGC/PEGC server ¤ŹÉŹÍפǤšĄŁ"
+ set messages(phase1.13) \
+ "¤š¤Ç¤Ë¸şß¤š¤ë XF86Config ĽŐĽĄĽ¤Ľë¤ňĽÇĽŐĽŠĽëĽČ¤Č¤ˇ¤Ć\n\
+ ťČÍѤˇ¤Ţ¤š¤ŤĄŠ"
+ set messages(phase1.14) \
+ "¤ł¤ÎĽ×ĽíĽ°ĽéĽŕ¤Ď root ¤Ť¤éźÂšÔ¤ľ¤ě¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.15) \
+ "XFree86 loader (XF86_LOADER) Ą˘¤Ţ¤ż¤Ď SVGA server ¤Ź\n\
+ ÉŹÍפǤšĄŁ"
+ set messages(phase1.16) \
+ "XFree86 loader (XF86_LOADER) Ą˘¤Ţ¤ż¤Ď EGC/PEGC server ¤Ź\n\
+ ÉŹÍפǤšĄŁ"
+ set messages(phase1.17) \
+ "ĽŢĽŚĽš¤ČĽ­ĄźĽÜĄźĽÉ¤ÎĆţÎϤ˥˘Xqueue ĽÉĽéĽ¤ĽĐĄź¤ň\n\
+ ¤ˇ¤č¤Ś¤ˇ¤Ţ¤š¤ŤĄŠ"
+ set messages(phase1.18) \
+ "ĽŢĽŚĽšĆţÎϤËÂФˇ¤ĆĄ˘systen event queue ¤ňťČÍѤˇ¤Ţ¤š¤ŤĄŠ"
+ set messages(phase1.19) "ĽĆĽóĽÝĽéĽęĽŐĽĄĽ¤Ľë¤ňłĘÇź¤š¤ë¤ż¤á¤Î"
+ set messages(phase1.20) "\n¤Č¤¤¤ŚĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.23) "Ľ°ĽéĽŐĽŁĽĂĽŻĽâĄźĽÉ¤ËŔÚ¤ęÂؤď¤ę¤Ţ¤šĄŁ\n\
+ ¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ"
+ set messages(phase1.24) "X server ¤ČÄĚżŽ¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.25) "X server ¤ňľŻĆ°¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase1.26) "¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ"
+ set messages(phase2.14) "¤ł¤ÎĽ×ĽíĽ°ĽéĽŕ¤ĎĘ̤βžÁŰĂźËöžĺ¤Ç\
+ źÂšÔ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ\n\n¤ż¤Ŕ¤ˇ¤¤˛žÁŰĂźËö¤ËŔÚÂؤ¨¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase3.1) "ĽľĄźĽĐĄź¤ňľŻĆ°¤ˇ¤Ć¤¤¤Ţ¤šĄŁ"
+ set messages(phase3.2) "X server ¤ČÄĚżŽ¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase3.3) "X server ¤ňľŻĆ°¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase3.4) \
+ "\n\nŔßÄę¤ňÂłšÔ¤š¤ë¤Ë¤ĎĄ˘\[Enter\] Ľ­Ąź¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase3.5) \
+ "VGA16 ĽľĄźĽĐĄź¤ňşĆľŻĆ°¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤ť¤óĄŁ"
+ set messages(phase4.12) "ŔßÄę¤ňĂćĂǤˇ¤Ţ¤ˇ¤żĄŁ"
+ set messages(phase4.13) "¤Ş¤á¤Ç¤Č¤Ś¤´¤ś¤¤¤Ţ¤šĄ˘\
+ ĽľĄźĽĐĄź¤ÎŔßÄꤏ´°Îť¤ˇ¤Ţ¤ˇ¤ż\n\n"
+ set messages(phase4.14) "¤ˇ¤Đ¤é¤Ż¤ŞÂÔ¤Á˛ź¤ľ¤¤ĄŁ"
+ set messages(phase4.15) "¤ł¤ÎĽ×ĽíĽ°ĽéĽŕ¤ĎĘ̤βžÁŰĂźËöžĺ¤Ç\
+ źÂšÔ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ\n\n¤ż¤Ŕ¤ˇ¤¤˛žÁŰĂźËö¤ËŔÚÂؤ¨¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase5.1) ""
+ set messages(phase5.2) \
+ " ĽľĄźĽĐĄź¤ËÂФˇ¤Ć X ¤Č¤¤¤ŚĚžÁ°¤ÎĽęĽóĽŻ¤ňşî¤ę¤Ţ¤š¤ŤĄŠ\n\n\
+ (ĽęĽóĽŻ¤ĎĄ˘"
+ set messages(phase5.3) "¤Č¤¤¤ŚĽÇĽŁĽěĽŻĽČĽę¤Ëşî¤é¤ě¤Ţ¤š)"
+ set messages(phase5.4) "ĽęĽóĽŻ¤Źşî¤ě¤Ţ¤ť¤ó¤Ç¤ˇ¤żĄŁĽęĽóĽŻ¤ĎźęĆ°¤Ç\n\
+ şî¤Ă¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(phase5.5) "ĽęĽóĽŻ¤ÎşîŔŽ¤Ź´°Îť¤ˇ¤Ţ¤ˇ¤żĄŁ"
+ set messages(phase5.6) "\n\nŔßÄę¤Ď˝ŞÎť¤ˇ¤Ţ¤ˇ¤żĄŁ"
+ set messages(setuplib.1) "\n\nÂłšÔ¤š¤ë¤Ë¤ĎĄ˘\[Enter\] Ľ­Ąź¤ň\
+ ˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ"
+ set messages(setuplib.2) "ĽĆĽóĽÝĽéĽęĄźĽŐĽĄĽ¤Ľë¤ÎĽÇĽŁĽěĽŻĽČĽęĄ˘"
+ set messages(setuplib.3) ")\n¤ĎĄ˘°ÂÁ´¤Ç¤˘¤ę¤Ţ¤ť¤óĄŁ"
+} else {
+ set messages(done.3) "Just a moment..."
+ set messages(phase1.1) "Not all of the"
+ set messages(phase1.2) "are installed. The file"
+ set messages(phase1.3) "is missing"
+ set messages(phase1.4) \
+ "Warning! Not all of the READMEs are\
+ installed. You may not be able to view some of\
+ the instructions regarding setting up your card,\
+ but otherwise, everything should work correctly"
+ set messages(phase1.5) "Error encountered reading existing\
+ configuration file"
+ set messages(phase1.6) \
+ "It appears that you are currently \
+ running under X11. If this is correct \
+ and you are interested in making some \
+ adjustments to your current setup, \
+ answer yes to the following question."
+ set messages(phase1.7) \
+ "If this is incorrect or you \
+ would like to go through the full \
+ configuration process, then answer no."
+ set messages(phase1.8) "Is this a reconfiguration?"
+ set messages(phase1.9) \
+ "You are not running as root.\n\n\
+ Superuser privileges are usually required to save any changes\n\
+ you make in a directory that is searched by the server and\n\
+ are required to change the mouse device.\n\n\
+ Would you like to continue anyway?"
+ set messages(phase1.10) \
+ "You need to be root to set the initial\
+ configuration with this program"
+ set messages(phase1.11) \
+ "The XFree86 loader (XF86_LOADER) or the SVGA\n\
+ server is required when using\n\
+ this program to set the initial configuration"
+ set messages(phase1.12) \
+ "The XFree86 loader (XF98_LOADER) or the EGC\n\
+ or the PEGC server is required when using\n\
+ this program to set the initial configuration"
+ set messages(phase1.13) \
+ "Would you like to use the\
+ existing XF86Config file for defaults?"
+ set messages(phase1.14) "You need to be root to run this program"
+ set messages(phase1.15) \
+ "Either the XFree86 loader (XF86_LOADER) or the\n\
+ SVGA server is required to run this program"
+ set messages(phase1.16) \
+ "Either the XFree86 loader (XF98_LOADER) or the\n\
+ EGC server or the PEGC server is required to run\n\
+ this program"
+ set messages(phase1.17) \
+ "Would you like to use the Xqueue driver\n\
+ for mouse and keyboard input?"
+ set messages(phase1.18) \
+ "Would you like to use the system event\
+ queue for mouse input?"
+ set messages(phase1.19) "Unable to make directory "
+ set messages(phase1.20) "\nfor storing temporary files"
+ set messages(phase1.23) "Ready to switch to graphics mode.\n\
+ \nIt may take a while"
+ set messages(phase1.24) "Unable to start X server!"
+ set messages(phase1.25) "Unable to communicate with X server!"
+ set messages(phase1.26) "Please wait\n\nThis may take a while..."
+ set messages(phase2.14) "The program is running on a different\
+ virtual terminal\n\n\
+ Please switch to the correct virtual terminal"
+ set messages(phase3.1) "Attempting to start server..."
+ set messages(phase3.2) "Unable to communicate with X server"
+ set messages(phase3.3) "Unable to start X server"
+ set messages(phase3.4) "\n\nPress \[Enter\] to try configuration again"
+ set messages(phase3.5) \
+ "Ack! Unable to get the VGA16 server going again!"
+ set messages(phase4.12) "Aborted."
+ set messages(phase4.13) "Congratulations, \
+ you've got a running server!\n\n"
+ set messages(phase4.14) "Just a moment..."
+ set messages(phase4.15) "The program is running on a different\
+ virtual terminal\n\n\
+ Please switch to the correct virtual terminal"
+ set messages(phase5.1) "Do you want to create an 'X' link to the "
+ set messages(phase5.2) \
+ " server?\n\n(the link will be created in the directory:"
+ set messages(phase5.3) ") Okay?"
+ set messages(phase5.4) "Link creation failed!\n\
+ You'll have to do it yourself"
+ set messages(phase5.5) "Link created successfully."
+ set messages(phase5.6) "\n\nConfiguration complete."
+ set messages(setuplib.1) "\n\nPress \[Enter\] to continue..."
+ set messages(setuplib.2) "The temporary files directory ("
+ set messages(setuplib.3) ")\nis no longer secure!"
+}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/local_text.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/local_text.tcl
new file mode 100644
index 000000000..383fa4bc4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/texts/local_text.tcl
@@ -0,0 +1,132 @@
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/texts/local_text.tcl,v 1.2 1998/04/05 15:25:34 robin Exp $
+#
+proc Make_popup_help { file } {
+ global pc98 pc98_EGC messages
+
+ set win .help_$file
+ # get 'message' variable.
+ source [Find_local_text help_$file.tcl]
+
+ catch {destroy $win}
+ toplevel $win -bd 5 -relief ridge
+ wm title $win "Help"
+ if !$pc98_EGC {
+ wm geometry $win 590x430+30+20
+ } else {
+ $win configure -height 350
+ wm geometry $win 590x350+30+20
+ }
+ text $win.text -takefocus 0 -width 90 -height 30 \
+ -yscrollcommand [list $win.sb set]
+ scrollbar $win.sb -command [list $win.text yview]
+ bind $win <Prior> \
+ "$win.text yview scroll -1 unit ; break ;"
+ bind $win <Next> \
+ "$win.text yview scroll 1 unit ; break ;"
+ $win.text insert 0.0 $message
+ $win.text configure -state disabled
+ button $win.ok -text $messages(phase2.13) \
+ -command "destroy $win"
+ pack $win.ok -side bottom
+ pack $win.text -side left -fill both -expand yes
+ pack $win.text $win.ok
+ focus $win.ok
+}
+
+proc append_helppath { newlang } {
+ upvar rootdir r
+ upvar lang l
+ global helppath
+
+ set l $newlang
+ if [file isdirectory $r/$l] {
+ lappend helppath $r/$l
+ }
+}
+
+proc Make_local_directory {} {
+ global locale helppath XF86Setup_library
+ set rootdir $XF86Setup_library/texts
+ if {[info exists locale]} {
+ append_helppath $locale
+ while {[set pt [string last . $lang]] != -1} {
+ append_helppath [string range $lang 0 [expr $pt-1]]
+ }
+ if {[set pt [string first _ $lang]] != -1} {
+ append_helppath [string range $lang 0 [expr $pt-1]]
+ }
+ }
+ append_helppath generic
+}
+
+proc Read_locale {} {
+ global env Xwinhome locale
+ set locale_dir $Xwinhome/lib/X11/locale
+ set locale {}
+ if {[info exists env(LANG)]} {
+ if {[file readable $locale_dir/locale.alias]} {
+ set cmd {[ \t]+/ {print $2;}}
+ set cmd "/^$env(LANG)$cmd";
+ set locale [exec awk $cmd $locale_dir/locale.alias]
+ }
+ if {$locale == {} } {
+ set locale $env(LANG)
+ }
+ }
+}
+
+proc Find_local_text {filename} {
+ global helppath
+ foreach path $helppath {
+ if [file exists $path/$filename] {
+ if {[file readable $path/$filename] && \
+ [file isfile $path/$filename]} {
+ return $path/$filename
+ }
+ }
+ }
+ return /dev/null
+}
+
+proc Card_popup_help { win } {
+ global cardDetail
+ Make_popup_help card
+ if {$cardDetail != "std"} {
+ pack .help_card.sb -side right -fill y
+ }
+}
+
+proc Done_popup_help { win } {
+ Make_popup_help done
+}
+
+proc Keyboard_popup_help { win } {
+ Make_popup_help keyboard
+}
+
+proc Monitor_popup_help { win } {
+ Make_popup_help monitor
+}
+
+proc Other_popup_help { win } {
+ Make_popup_help other
+}
+
+proc Intro_popup_help { win } {
+ Make_popup_help intro
+}
+
+proc Mouse_popup_help { win } {
+ Make_popup_help mouse
+ pack .help_mouse.sb -side right -fill y
+}
+
+proc Modeselection_popup_help { win } {
+ Make_popup_help modeselect
+}
+
+Read_locale
+Make_local_directory
+source [Find_local_text messages.tcl]
+source [Find_local_text message_proc.tcl]
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/tkother.c b/xc/programs/Xserver/hw/xfree86/XF86Setup/tkother.c
new file mode 100644
index 000000000..80e1d17cc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/tkother.c
@@ -0,0 +1,185 @@
+/* $XConsortium: tkother.c /main/2 1996/10/19 19:06:55 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/tkother.c,v 3.1 1996/12/27 06:54:26 dawes Exp $ */
+/*
+ * Copyright 1996 by Joseph V. Moss <joe@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Joseph Moss not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Joseph Moss makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * JOSEPH MOSS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL JOSEPH MOSS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*
+
+ This file contains routines to add a few misc commands to Tcl
+ which require the Tk toolkit
+
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+#include <X11/Xfuncs.h>
+#include <tcl.h>
+#include <tk.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static int TK_XF86FindWindow(
+#if NeedNestedProtoTypes
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char *argv[]
+#endif
+);
+
+/*
+ Adds all the new commands to the Tcl interpreter
+*/
+
+int
+XF86TkOther_Init(interp)
+ Tcl_Interp *interp;
+{
+ Tcl_CreateCommand(interp, "findfocuswindow",
+ TK_XF86FindWindow, (ClientData) NULL,
+ (void (*)()) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ Search (starting from the given win) along the specified axis for a
+ window which accepts focus, move the specified number pixels at a time
+ when searching. For each increment it looks first from the center
+ of the starting window, then midway between the center and one side,
+ then midway between the center and the other side, then from each
+ side. For example:
+
+ A +---------------+
+ | |
+ +---------------+ B
+ 4 2 1 3 5
+
+ if searching down from the window (which stretches from point A to
+ point B), the search will start 1*increment pixels down from one,
+ it then looks 1*increment pixels down from two, etc,, then 2*increment
+ pixels down from one, 2*increment down from two, and so on until
+ a widow is found which will accept the keyboard focus.
+
+ If no suitable window is found the original window is returned.
+*/
+
+static char fwusage[] = "Usage: findfocuswindow <window> x|y <increment>";
+
+int
+TK_XF86FindWindow(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
+{
+ Tk_Window topwin, oldwin, tkwin;
+ int ulx, uly, wid, ht, limit, increment;
+ int x, y, idx, pos[5];
+
+ if (argc != 4) {
+ sprintf(interp->result, fwusage);
+ return TCL_ERROR;
+ }
+
+ if ((topwin = Tk_MainWindow(interp)) == NULL)
+ return TCL_ERROR;
+ if ((oldwin = Tk_NameToWindow(interp, argv[1], topwin)) == NULL)
+ return TCL_ERROR;
+
+ if (Tcl_GetInt(interp, argv[3], &increment) != TCL_OK)
+ return TCL_ERROR;
+
+ Tk_GetRootCoords(oldwin, &ulx, &uly);
+ wid = Tk_Width(oldwin);
+ ht = Tk_Height(oldwin);
+
+ if (!strcmp(argv[2], "x")) {
+ limit = WidthOfScreen(Tk_Screen(oldwin));
+ if (increment < 0)
+ x = ulx;
+ else
+ x = ulx+wid;
+ pos[0] = (2*uly+ht)/2;
+ pos[1] = (uly+pos[0])/2;
+ pos[2] = (uly+ht+pos[0])/2;
+ pos[3] = uly;
+ pos[4] = uly+ht;
+ while (0 < x && x < limit) {
+ x += increment;
+ for (idx=0; idx < 5; idx++) {
+ tkwin = Tk_CoordsToWindow(x, pos[idx], topwin);
+ if ( tkwin ) {
+ if (Tcl_VarEval(interp, "tkFocusOK ",
+ Tk_PathName(tkwin), NULL) != TCL_OK)
+ return TCL_ERROR;
+ if (!strcmp(interp->result, "1")) {
+ Tcl_SetResult(interp, Tk_PathName(tkwin),
+ TCL_STATIC);
+ return TCL_OK;
+ }
+ }
+ }
+ }
+ } else if (!strcmp(argv[2], "y")) {
+ limit = HeightOfScreen(Tk_Screen(oldwin));
+ if (increment < 0)
+ y = uly;
+ else
+ y = uly+ht;
+ pos[0] = (2*ulx+wid)/2;
+ pos[1] = (ulx+pos[0])/2;
+ pos[2] = (ulx+wid+pos[0])/2;
+ pos[3] = ulx;
+ pos[4] = ulx+wid;
+ while (0 < y && y < limit) {
+ y += increment;
+ for (idx=0; idx < 5; idx++) {
+ tkwin = Tk_CoordsToWindow(pos[idx], y, topwin);
+ if ( tkwin ) {
+ if (Tcl_VarEval(interp, "tkFocusOK ",
+ Tk_PathName(tkwin), NULL) != TCL_OK)
+ return TCL_ERROR;
+ if (!strcmp(interp->result, "1")) {
+ Tcl_SetResult(interp, Tk_PathName(tkwin),
+ TCL_STATIC);
+ return TCL_OK;
+ }
+ }
+ }
+ }
+ } else {
+ sprintf(interp->result, fwusage);
+ return TCL_ERROR;
+ }
+ Tcl_SetResult(interp, Tk_PathName(oldwin), TCL_STATIC);
+ return TCL_OK;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/vidmode.tcl b/xc/programs/Xserver/hw/xfree86/XF86Setup/vidmode.tcl
new file mode 100644
index 000000000..b093b6e9e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/vidmode.tcl
@@ -0,0 +1,470 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/vidmode.tcl,v 1.1 1999/04/05 07:13:02 dawes Exp $
+
+proc VidMode_describe { mode } {
+ set clock [lindex $mode 0]
+ set hdisp [lindex $mode 1]
+ set htotal [lindex $mode 4]
+ set vdisp [lindex $mode 5]
+ set vtotal [lindex $mode 8]
+ set desc [format "%4dx%-4d Clock: %6.2f (%6.2f Hz vert, %6.2f kHz horiz)" \
+ $hdisp $vdisp $clock \
+ [expr $clock*1000000.0/($htotal*$vtotal)] \
+ [expr $clock*1000.0/$htotal] ]
+ set flags [string tolower [lrange $mode 9 end]]
+ if {[lsearch $flags "interlace"] != -1} {
+ append desc " Interlaced"
+ }
+ if {[lsearch $flags "doublescan"] != -1} {
+ append desc " DoubleScan"
+ }
+ return $desc
+}
+
+proc VidMode_create_widgets { win } {
+ global vidmListFlag
+
+ VidMode_create_modelist_widgets $win
+ VidMode_create_modeadjust_widgets $win
+
+ set vidmListFlag 1
+ bind $win n [list VidMode_next $win]
+ bind $win p [list VidMode_prev $win]
+ #bind $win <Control-Alt-KP_Add> [list VidMode_next $win]
+ #bind $win <Control-Alt-KP_Subtract> [list VidMode_prev $win]
+}
+
+proc VidMode_create_modelist_widgets { win } {
+ global vidmMode vidmCurrentModes vidmValidModes MonitorStdModes
+ global tcl_library
+
+ set w [winpathprefix $win]
+ set vidmCurrentModes [xf86vid_getallmodelines]
+ frame $w.curr
+ label $w.curr.title -anchor w \
+ -text "Currently selected/available modes:"
+ pack $w.curr.title -side top -fill x -expand yes
+ frame $w.curr.modes
+ listbox $w.curr.modes.lb -height 8 -width 70
+ foreach mode $vidmCurrentModes {
+ $w.curr.modes.lb insert end [VidMode_describe $mode]
+ }
+ pack $w.curr.modes.lb -side left -fill x -expand yes
+ $w.curr.modes.lb configure -yscroll [list $w.curr.modes.sb set]
+ scrollbar $w.curr.modes.sb -command [list $w.curr.modes.lb yview]
+ pack $w.curr.modes.sb -side left -fill y
+ frame $w.curr.buttons
+ #frame $w.curr.buttons.row1
+ #frame $w.curr.buttons.row2
+ button $w.curr.buttons.next -text "Next" \
+ -command [list VidMode_next $win]
+ button $w.curr.buttons.prev -text "Prev" \
+ -command [list VidMode_prev $win]
+ button $w.curr.buttons.move2top -text "Move to Top" \
+ -command [list VidMode_move2top $win]
+ button $w.curr.buttons.delete -text "Delete" \
+ -command [list VidMode_delete $win]
+ #pack $w.curr.buttons.next $w.curr.buttons.prev \
+ -in $w.curr.buttons.row1 -side left -fill x -expand yes
+ #pack $w.curr.buttons.move2top $w.curr.buttons.delete \
+ -in $w.curr.buttons.row2 -side left -fill x -expand yes
+ #pack $w.curr.buttons.row1 $w.curr.buttons.row2 -side top
+ pack $w.curr.buttons.next $w.curr.buttons.prev \
+ $w.curr.buttons.move2top $w.curr.buttons.delete \
+ -side top -fill x -expand yes
+
+ frame $w.known
+ label $w.known.title -anchor w \
+ -text "Known modes likely to work with this card/monitor:"
+ pack $w.known.title -side top -fill x -expand yes
+ frame $w.known.modes
+ listbox $w.known.modes.lb -height 8 -width 70
+ set vidmValidModes ""
+ foreach mode [lsort [array names MonitorStdModes]] {
+ set modeline [string tolower $MonitorStdModes($mode)]
+ set retv [xf86vid_checkmodeline $modeline]
+ puts "Retv = $retv Modeline = $modeline"
+ if {!$retv} {
+ lappend vidmValidModes $modeline
+ $w.known.modes.lb insert end [VidMode_describe $modeline]
+ } else {
+ puts "Rejected: $modeline"
+ }
+ }
+ pack $w.known.modes.lb -side left -fill x -expand yes
+ $w.known.modes.lb configure -yscroll [list $w.known.modes.sb set]
+ scrollbar $w.known.modes.sb -command [list $w.known.modes.lb yview]
+ pack $w.known.modes.sb -side left -fill y
+ #frame $w.known.buttons -width 8c -height 4c
+ frame $w.known.buttons
+ button $w.known.buttons.add -text "Add" \
+ -command [list VidMode_add $win]
+ button $w.known.buttons.new -text "New" \
+ -command [list VidMode_new $win]
+ button $w.known.buttons.help -text "Help"
+ button $w.known.buttons.tune -text "Tune" \
+ -command "set vidmListFlag 0;[list VidMode_list_or_adjust $win]"
+ pack $w.known.buttons.add $w.known.buttons.new -side top
+ pack $w.known.buttons.help $w.known.buttons.tune -side top
+ #pack propagate $w.curr.buttons no
+ pack $w.curr.modes $w.curr.buttons -side left -fill x -expand yes
+ pack $w.known.modes $w.known.buttons -side left -fill x -expand yes
+ frame $w.move
+ frame $w.move.but
+ button $w.move.but.left -text "Left" \
+ -command "VidMode_adjust $win left"
+ button $w.move.but.right -text "Right" \
+ -command "VidMode_adjust $win right"
+ button $w.move.but.up -text "Up" \
+ -command "VidMode_adjust $win up"
+ button $w.move.but.down -text "Down" \
+ -command "VidMode_adjust $win down"
+ pack $w.move.but.left $w.move.but.right \
+ $w.move.but.up $w.move.but.down -side left
+ frame $w.size
+ frame $w.size.but
+ button $w.size.but.wider -bitmap @$tcl_library/wider.xbm \
+ -command "VidMode_adjust $win wider"
+ button $w.size.but.narrow -bitmap @$tcl_library/narrower.xbm \
+ -command "VidMode_adjust $win narrow"
+ button $w.size.but.taller -bitmap @$tcl_library/taller.xbm \
+ -command "VidMode_adjust $win taller"
+ button $w.size.but.shorter -bitmap @$tcl_library/shorter.xbm \
+ -command "VidMode_adjust $win short"
+ pack $w.size.but.wider $w.size.but.narrow \
+ $w.size.but.taller $w.size.but.shorter -side left
+ pack $w.move.but
+ pack $w.size.but
+ #pack $w.move $w.size -side left
+ pack $w.move $w.size
+}
+
+proc VidMode_create_modeadjust_widgets { win } {
+ global vidmMode vidmCurrentModes vidmValidModes MonitorStdModes
+ set w [winpathprefix $win]
+
+ frame $w.modeline
+ label $w.modeline.header -text "Adjusting mode:"
+ frame $w.horz
+ frame $w.horz.beg
+ label $w.horz.beg.text -text "HSyncStart:" -width 12
+ scale $w.horz.beg.sc -variable vidmMode(HBegin) -orient horizontal \
+ -resolution 4
+ pack $w.horz.beg.text -side left
+ pack $w.horz.beg.sc -side left -fill x -expand yes
+ frame $w.horz.end
+ label $w.horz.end.text -text "HSyncEnd:" -width 12
+ scale $w.horz.end.sc -variable vidmMode(HEnd) -orient horizontal \
+ -resolution 4
+ pack $w.horz.end.text -side left
+ pack $w.horz.end.sc -side left -fill x -expand yes
+ frame $w.horz.ttl
+ label $w.horz.ttl.text -text "HorizTotal:" -width 12
+ scale $w.horz.ttl.sc -variable vidmMode(HTotal) -orient horizontal \
+ -resolution 8
+ pack $w.horz.ttl.text -side left
+ pack $w.horz.ttl.sc -side left -fill x -expand yes
+ frame $w.horz.but
+ button $w.horz.but.left -text "Left" \
+ -command "VidMode_adjust $win left"
+ button $w.horz.but.right -text "Right" \
+ -command "VidMode_adjust $win right"
+ button $w.horz.but.wider -text "Wider" \
+ -command "VidMode_adjust $win wider"
+ button $w.horz.but.narrow -text "Narrower" \
+ -command "VidMode_adjust $win narrow"
+ pack $w.horz.but.left $w.horz.but.right $w.horz.but.wider \
+ $w.horz.but.narrow -side left
+ pack $w.horz.beg $w.horz.end $w.horz.ttl $w.horz.but \
+ -side top -fill x -expand yes
+ frame $w.vert
+ frame $w.vert.beg
+ label $w.vert.beg.text -text "VSyncStart:" -width 12
+ scale $w.vert.beg.sc -variable vidmMode(VBegin) -orient horizontal \
+ -resolution 2
+ pack $w.vert.beg.text -side left
+ pack $w.vert.beg.sc -side left -fill x -expand yes
+ frame $w.vert.end
+ label $w.vert.end.text -text "VSyncEnd:" -width 12
+ scale $w.vert.end.sc -variable vidmMode(VEnd) -orient horizontal \
+ -resolution 2
+ pack $w.vert.end.text -side left
+ pack $w.vert.end.sc -side left -fill x -expand yes
+ frame $w.vert.ttl
+ label $w.vert.ttl.text -text "VertTotal:" -width 12
+ scale $w.vert.ttl.sc -variable vidmMode(VTotal) -orient horizontal \
+ -resolution 4
+ pack $w.vert.ttl.text -side left
+ pack $w.vert.ttl.sc -side left -fill x -expand yes
+ frame $w.vert.but
+ button $w.vert.but.up -text "Up" \
+ -command "VidMode_adjust $win up"
+ button $w.vert.but.down -text "Down" \
+ -command "VidMode_adjust $win down"
+ button $w.vert.but.shorter -text "Shorter" \
+ -command "VidMode_adjust $win short"
+ button $w.vert.but.taller -text "Taller" \
+ -command "VidMode_adjust $win tall"
+ pack $w.vert.but.up $w.vert.but.down $w.vert.but.shorter \
+ $w.vert.but.taller -side left
+ pack $w.vert.beg $w.vert.end $w.vert.ttl $w.vert.but \
+ -side top -fill x -expand yes
+ frame $w.other
+ frame $w.flags
+ checkbutton $w.flags.interlace -text "Interlace" -variable vidmMode(Intlc) \
+ -onvalue "interlace" -offvalue "" -indicatoron false
+ checkbutton $w.flags.dblscan -text "DoubleScan" -variable vidmMode(DblScn) \
+ -onvalue "doublescan" -offvalue "" -indicatoron false
+ checkbutton $w.flags.csync -text "CSync" -variable vidmMode(CSync) \
+ -onvalue "composite" -offvalue "" -indicatoron false
+ checkbutton $w.flags.pcsync -text "+CSync" -variable vidmMode(CSync) \
+ -onvalue "+csync" -offvalue "" -indicatoron false
+ checkbutton $w.flags.ncsync -text "-CSync" -variable vidmMode(CSync) \
+ -onvalue "-csync" -offvalue "" -indicatoron false
+ checkbutton $w.flags.phsync -text "+HSync" -variable vidmMode(HSync) \
+ -onvalue "+hsync" -offvalue "" -indicatoron false
+ checkbutton $w.flags.nhsync -text "-HSync" -variable vidmMode(HSync) \
+ -onvalue "-hsync" -offvalue "" -indicatoron false
+ checkbutton $w.flags.pvsync -text "+VSync" -variable vidmMode(VSync) \
+ -onvalue "+vsync" -offvalue "" -indicatoron false
+ checkbutton $w.flags.nvsync -text "-VSync" -variable vidmMode(VSync) \
+ -onvalue "-vsync" -offvalue "" -indicatoron false
+ pack $w.flags.interlace $w.flags.dblscan -side left
+ pack $w.flags.csync $w.flags.pcsync $w.flags.ncsync -side left
+ pack $w.flags.phsync $w.flags.nhsync -side left
+ pack $w.flags.pvsync $w.flags.nvsync -side left
+ #button $w.b -text "Okay" -command [list VidMode_deactivate $win];exit
+ #catch {destroy $w.waitmsg}
+ frame $w.buttons
+ button $w.buttons.abort -text "Abort" \
+ -command "set vidmListFlag 1;[list VidMode_list_or_adjust $win]"
+ button $w.buttons.save -text "Save" \
+ -command "set vidmListFlag 1;[list VidMode_list_or_adjust $win]"
+ button $w.buttons.help -text "Help"
+ pack $w.buttons.abort $w.buttons.save $w.buttons.help -side left
+ pack $w.modeline.header -side top
+ pack $w.horz $w.vert -side left -in $w.modeline -fill x -expand yes
+}
+
+proc VidMode_activate { win } {
+ global vidmCurrentModes
+
+ set w [winpathprefix $win]
+ xf86vid_lockmodeswitch lock
+ VidMode_list_or_adjust $win
+ $w.curr.modes.lb selection clear 0 end
+ $w.curr.modes.lb selection set 0
+ VidMode_tune $w [lindex $vidmCurrentModes 0]
+}
+
+proc VidMode_deactivate { win } {
+ xf86vid_lockmodeswitch unlock
+}
+
+proc VidMode_list_or_adjust { win } {
+ global vidmListFlag
+
+ set w [winpathprefix $win]
+
+ pack forget $w.curr $w.known $w.modeline $w.flags $w.buttons
+ if $vidmListFlag {
+ pack $w.curr -side top -fill x -expand yes
+ pack $w.known -side top -fill x -expand yes
+ } else {
+ pack $w.modeline -side top -fill x -expand yes
+ #pack $w.flags $w.b -side top
+ pack $w.flags -side top
+ pack $w.buttons -side top
+ }
+}
+
+proc VidMode_add { win } {
+ global vidmCurrentModes vidmValidModes
+
+ set w [winpathprefix $win]
+ set newmode [$w.known.modes.lb curselection]
+ if { [llength $newmode] != 1 } return
+ set curmode [$w.curr.modes.lb curselection]
+ if { [llength $curmode] != 1 } return
+ incr curmode
+ if { $curmode >= [llength $vidmCurrentModes] } {
+ set curmode end
+ }
+ puts stderr "Adding [lindex $vidmValidModes $newmode]"
+ set retval [catch {xf86vid_addmodeline [lindex $vidmValidModes $newmode]} retmsg]
+ puts stderr "Added - $retval - $retmsg"
+ if !$retval {
+ set vidmCurrentModes [linsert $vidmCurrentModes \
+ $curmode [lindex $vidmValidModes $newmode]]
+ $w.curr.modes.lb insert $curmode [$w.known.modes.lb get $newmode]
+ }
+}
+
+proc VidMode_new { win } {
+}
+
+proc VidMode_next { win } {
+ global vidmCurrentModes
+
+ set w [winpathprefix $win]
+ set curmode [$w.curr.modes.lb curselection]
+ incr curmode
+ if { $curmode >= [llength $vidmCurrentModes] } {
+ set curmode 0
+ }
+ $w.curr.modes.lb selection clear 0 end
+ $w.curr.modes.lb selection set $curmode
+ xf86vid_lockmodeswitch unlock
+ xf86vid_switchmode next
+ xf86vid_lockmodeswitch lock
+ VidMode_tune $w [lindex $vidmCurrentModes $curmode]
+}
+
+proc VidMode_prev { win } {
+ global vidmCurrentModes
+
+ set w [winpathprefix $win]
+ set curmode [$w.curr.modes.lb curselection]
+ incr curmode -1
+ if { $curmode < 0 } {
+ set curmode [expr [llength $vidmCurrentModes]-1]
+ }
+ $w.curr.modes.lb selection clear 0 end
+ $w.curr.modes.lb selection set $curmode
+ xf86vid_lockmodeswitch unlock
+ xf86vid_switchmode prev
+ xf86vid_lockmodeswitch lock
+ VidMode_tune $w [lindex $vidmCurrentModes $curmode]
+}
+
+proc VidMode_move2top { win } {
+ global vidmCurrentModes vidmValidModes
+
+ set w [winpathprefix $win]
+}
+
+proc VidMode_delete { win } {
+ global vidmCurrentModes vidmValidModes
+
+ set w [winpathprefix $win]
+ set curmode [$w.curr.modes.lb curselection]
+ if { [llength $curmode] != 1 } return
+ puts stderr "Deleting [lindex $vidmCurrentModes $curmode]"
+ set retval [catch {xf86vid_deletemodeline [lindex $vidmCurrentModes $curmode]} retmsg]
+ puts stderr "deleted - $retval - $retmsg"
+ set vidmCurrentModes [lreplace $vidmCurrentModes $curmode $curmode]
+ $w.curr.modes.lb delete $curmode
+}
+
+proc VidMode_adjust { win dir } {
+ global vidmMode
+
+ array set savemode [array get vidmMode]
+ set w [winpathprefix $win]
+ switch $dir {
+ up {
+ incr vidmMode(VBegin) 4
+ incr vidmMode(VEnd) 4
+ }
+ down {
+ incr vidmMode(VBegin) -4
+ incr vidmMode(VEnd) -4
+ }
+ short {
+ incr vidmMode(VTotal) 4
+ incr vidmMode(VBegin) 2
+ incr vidmMode(VEnd) 2
+ # Update Sync rates
+ }
+ tall {
+ incr vidmMode(VTotal) -4
+ incr vidmMode(VBegin) -2
+ incr vidmMode(VEnd) -2
+ # Update Sync rates
+ }
+ right {
+ incr vidmMode(HBegin) -8
+ incr vidmMode(HEnd) -8
+ }
+ left {
+ incr vidmMode(HBegin) 8
+ incr vidmMode(HEnd) 8
+ }
+ narrow {
+ incr vidmMode(HTotal) 8
+ incr vidmMode(HBegin) 4
+ incr vidmMode(HEnd) 4
+ # Update Sync rates
+ }
+ wider {
+ incr vidmMode(HTotal) -8
+ incr vidmMode(HBegin) -4
+ incr vidmMode(HEnd) -4
+ # Update Sync rates
+ }
+ }
+ set flags "$vidmMode(Intlc) $vidmMode(DblScn) $vidmMode(CSync) \
+ $vidmMode(HSync) $vidmMode(VSync)"
+ if { ![string length [string trim $flags]] } {
+ set retval [catch {xf86vid_modifymodeline [list $vidmMode(Clock) \
+ $vidmMode(HDisp) $vidmMode(HBegin) $vidmMode(HEnd) $vidmMode(HTotal) \
+ $vidmMode(VDisp) $vidmMode(VBegin) $vidmMode(VEnd) $vidmMode(VTotal) \
+ ] } out ]
+ } else {
+ puts "Flags:$flags:"
+ set retval [catch {xf86vid_modifymodeline [concat \
+ [list $vidmMode(Clock) \
+ $vidmMode(HDisp) $vidmMode(HBegin) $vidmMode(HEnd) $vidmMode(HTotal) \
+ $vidmMode(VDisp) $vidmMode(VBegin) $vidmMode(VEnd) $vidmMode(VTotal) ] \
+ $flags] } out ]
+ }
+ puts "$retval:$out"
+ if $retval {
+ array set vidmMode [array get savemode]
+ }
+}
+
+proc VidMode_tune { win modeline } {
+ global vidmMode
+
+ set w [winpathprefix $win]
+ $w.modeline.header configure -text "Adjusting mode:\
+ [VidMode_describe $modeline]"
+ puts stderr "modeline='$modeline'"
+ set vidmMode(Clock) [lindex $modeline 0]
+ set vidmMode(HDisp) [lindex $modeline 1]
+ set max [expr int($vidmMode(HDisp)*1.5+0.5)]
+ foreach scale [list beg end ttl] {
+ $w.horz.$scale.sc configure -from $vidmMode(HDisp) -to $max
+ }
+ set vidmMode(HBegin) [lindex $modeline 2]
+ set vidmMode(HEnd) [lindex $modeline 3]
+ set vidmMode(HTotal) [lindex $modeline 4]
+
+ set vidmMode(VDisp) [lindex $modeline 5]
+ set max [expr int($vidmMode(VDisp)*1.5+0.5)]
+ foreach scale [list beg end ttl] {
+ $w.vert.$scale.sc configure -from $vidmMode(VDisp) -to $max
+ }
+ set vidmMode(VBegin) [lindex $modeline 6]
+ set vidmMode(VEnd) [lindex $modeline 7]
+ set vidmMode(VTotal) [lindex $modeline 8]
+
+ set vidmMode(CSync) [set vidmMode(HSync) [set vidmMode(VSync) ""]]
+ set vidmMode(Intlc) [set vidmMode(DblScn) ""]
+
+ foreach flag [lrange $modeline 9 end] {
+ set lflag [string tolower $flag]
+ switch -- $lflag {
+ interlace { set vidmMode(Intlc) interlace }
+ doublescan { set vidmMode(DblScn) doublescan }
+ composite -
+ -csync -
+ +csync { set vidmMode(CSync) $lflag }
+ -hsync -
+ +hsync { set vidmMode(HSync) $lflag }
+ -vsync -
+ +vsync { set vidmMode(VSync) $lflag }
+ }
+ }
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Setup/xfsconf.h b/xc/programs/Xserver/hw/xfree86/XF86Setup/xfsconf.h
new file mode 100644
index 000000000..feddf6bb2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF86Setup/xfsconf.h
@@ -0,0 +1,86 @@
+/* $XConsortium: xfsconf.h /main/2 1996/10/19 19:06:59 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/xfsconf.h,v 3.4 1999/04/05 07:13:03 dawes Exp $ */
+
+extern char *XtMalloc(
+ unsigned int /* size */
+);
+
+extern char *XtCalloc(
+ unsigned int /* num */,
+ unsigned int /* size */
+);
+
+extern char *XtRealloc(
+ char* /* ptr */,
+ unsigned int /* num */
+);
+
+extern void XtFree(
+ char* /* ptr */
+);
+
+int XF86Config_Init(
+ Tcl_Interp *interp
+);
+
+int TCL_XF86ReadXF86Config(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+);
+
+int TCL_XF86WriteXF86Config(
+ ClientData clientData,
+ Tcl_Interp *interp,
+ int argc,
+ char **argv
+);
+
+char *NonZeroStr(
+ unsigned long val,
+ int base
+);
+
+char *get_path_elem(
+ char **pnt
+);
+
+char *validate_font_path(
+ char *path
+);
+
+char *token_to_string(
+ SymTabPtr table,
+ int token
+);
+
+int string_to_token(
+ SymTabPtr table,
+ char *string
+);
+
+extern char *rgbPath, *defaultFontPath;
+
+extern XF86ConfigPtr config_list;
+
+extern Tcl_Interp *errinterp;
+
+extern Bool Must_have_memory;
+
+extern SymTabRec xfsMouseTab[];
+
+#define StrOrNull(xx) ((xx)==NULL? "": (xx))
+
+#define SECTION_NAME(name) { int len = sizeof(section)-sizeof(name)-1; \
+ strncpy(section, varpfx, len); \
+ varpfx[len] = '\0'; strcat(section, name); \
+ Tcl_AppendElement(interp, name); }
+
+#define DIR_FILE "/fonts.dir"
+
diff --git a/xc/programs/Xserver/hw/xfree86/XF98Conf.cpp b/xc/programs/Xserver/hw/xfree86/XF98Conf.cpp
new file mode 100644
index 000000000..be962bd4a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XF98Conf.cpp
@@ -0,0 +1,529 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/XF98Conf.cpp,v 1.1 1999/07/19 13:36:11 dawes Exp $
+XCOMM
+XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc.
+XCOMM
+XCOMM Permission is hereby granted, free of charge, to any person obtaining a
+XCOMM copy of this software and associated documentation files (the "Software"),
+XCOMM to deal in the Software without restriction, including without limitation
+XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense,
+XCOMM and/or sell copies of the Software, and to permit persons to whom the
+XCOMM Software is furnished to do so, subject to the following conditions:
+XCOMM
+XCOMM The above copyright notice and this permission notice shall be included in
+XCOMM all copies or substantial portions of the Software.
+XCOMM
+XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+XCOMM SOFTWARE.
+XCOMM
+XCOMM Except as contained in this notice, the name of the XFree86 Project shall
+XCOMM not be used in advertising or otherwise to promote the sale, use or other
+XCOMM dealings in this Software without prior written authorization from the
+XCOMM XFree86 Project.
+XCOMM
+XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
+
+XCOMM **********************************************************************
+XCOMM This is a sample configuration file only, intended to illustrate
+XCOMM what a config file might look like. Refer to the XF86Config(4/5)
+XCOMM man page for details about the format of this file. This man page
+XCOMM is installed as MANPAGE
+XCOMM **********************************************************************
+
+XCOMM The ordering of sections is not important in version 4.0 and later.
+
+XCOMM **********************************************************************
+XCOMM Files section. This allows default font and rgb paths to be set
+XCOMM **********************************************************************
+
+Section "Files"
+
+XCOMM The location of the RGB database. Note, this is the name of the
+XCOMM file minus the extension (like ".txt" or ".db"). There is normally
+XCOMM no need to change the default.
+
+ RgbPath RGBPATH
+
+XCOMM Multiple FontPath entries are allowed (which are concatenated together),
+XCOMM as well as specifying multiple comma-separated entries in one FontPath
+XCOMM command (or a combination of both methods)
+
+ FontPath LOCALFONTPATH
+ FontPath MISCFONTPATH
+ FontPath DPI75USFONTPATH
+ FontPath DPI100USFONTPATH
+ FontPath T1FONTPATH
+ FontPath CIDFONTPATH
+ FontPath SPFONTPATH
+ FontPath DPI75FONTPATH
+ FontPath DPI100FONTPATH
+
+XCOMM ModulePath can be used to set a search path for the X server modules.
+XCOMM The default path is shown here.
+
+XCOMM ModulePath MODULEPATH
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Module section -- this is an optional section which is used to specify
+XCOMM which run-time loadable modules to load when the X server starts up.
+XCOMM **********************************************************************
+
+Section "Module"
+
+XCOMM This loads the PEX extension module.
+
+ Load "pex5"
+
+XCOMM This loads the XIE extension module.
+
+ Load "xie"
+
+XCOMM This loads the GLX extension module.
+
+ Load "glx"
+
+XCOMM This loads the DBE extension module.
+
+ Load "dbe"
+
+XCOMM This loads the RECORD extension module.
+
+ Load "record"
+
+XCOMM This loads the miscellaneous extensions module, and disables
+XCOMM initialisation of the XFree86-DGA extension within that module.
+
+ SubSection "extmod"
+ Option "omit xfree86-dga"
+ EndSubSection
+
+XCOMM This loads the Type1, Speedo and FreeType font modules
+
+ Load "type1"
+ Load "speedo"
+ Load "freetype"
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Server flags section. This contains various server-wide Options.
+XCOMM **********************************************************************
+
+Section "ServerFlags"
+
+XCOMM Uncomment this to cause a core dump at the spot where a signal is
+XCOMM received. This may leave the console in an unusable state, but may
+XCOMM provide a better stack trace in the core dump to aid in debugging
+
+XCOMM Option "NoTrapSignals"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
+XCOMM This allows clients to receive this key event.
+
+XCOMM Option "DontZap"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
+XCOMM sequences. This allows clients to receive these key events.
+
+XCOMM Option "DontZoom"
+
+XCOMM Uncomment this to disable tuning with the xvidtune client. With
+XCOMM it the client can still run and fetch card and monitor attributes,
+XCOMM but it will not be allowed to change them. If it tries it will
+XCOMM receive a protocol error.
+
+XCOMM Option "DisableVidModeExtension"
+
+XCOMM Uncomment this to enable the use of a non-local xvidtune client.
+
+XCOMM Option "AllowNonLocalXvidtune"
+
+XCOMM Uncomment this to disable dynamically modifying the input device
+XCOMM (mouse and keyboard) settings.
+
+XCOMM Option "DisableModInDev"
+
+XCOMM Uncomment this to enable the use of a non-local client to
+XCOMM change the keyboard or mouse settings (currently only xset).
+
+XCOMM Option "AllowNonLocalModInDev"
+
+XCOMM Set the basic blanking screen saver timeout.
+
+ Option "blank time" "10" # 10 minutes
+
+XCOMM Set the DPMS timeouts. These are set here because they are global
+XCOMM rather than screen-specific. These settings alone don't enable DPMS.
+XCOMM It is enabled per-screen (or per-monitor), and even then only when
+XCOMM the driver supports it.
+
+ Option "standby time" "20"
+ Option "suspend time" "30"
+ Option "off time" "60"
+
+XCOMM Specify PC98 architecture
+
+XCOMM Option "PC98"
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Input devices
+XCOMM **********************************************************************
+
+XCOMM **********************************************************************
+XCOMM Core keyboard's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+ Identifier "Keyboard1"
+ Driver "keyboard"
+
+XCOMM For most OSs the protocol can be omitted (it defaults to "Standard").
+XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment
+XCOMM out the above line, and uncomment the following line.
+
+XCOMM Option "Protocol" "Xqueue"
+
+XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
+XCOMM this.
+
+ Option "AutoRepeat" "500 5"
+
+XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
+
+XCOMM Option "Xleds" "1 2 3"
+
+XCOMM To disable the XKEYBOARD extension, uncomment XkbDisable.
+
+XCOMM Option "XkbDisable"
+
+ Option "XkbRules" "xfree86"
+ Option "XkbModel" "pc98"
+ Option "XkbLayout" "nec/jp"
+XCOMM Option "XkbVariant" ""
+XCOMM Option "XkbOptions" ""
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Core Pointer's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+XCOMM Identifier and driver
+
+ Identifier "Mouse1"
+ Driver "mouse"
+
+XCOMM The mouse protocol and device. The device is normally set to /dev/mouse,
+XCOMM which is usually a symbolic link to the real device.
+
+ Option "Protocol" "BusMouse"
+XCOMM For FreeBSD(98)-2.X
+FREEBSDMOUSEDEV
+XCOMM For NetBSD/pc98 (based on NetBSD 1.1 or later)
+NETBSDNEWMOUSEDEV
+XCOMM For NetBSD/pc98 (based on NetBSD 1.0)
+NETBSDOLDMOUSEDEV
+XCOMM For Linux/98
+LINUXMOUSEDEV
+
+XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), use
+XCOMM the following instead of any of the lines above. The Device line
+XCOMM is not required in this case.
+
+XCOMM Option "Protocol" "Xqueue"
+
+XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
+XCOMM almost every case these lines should be omitted.
+
+XCOMM Option "BaudRate" "9600"
+XCOMM Option "SampleRate" "150"
+
+XCOMM Emulate3Buttons is an option for 2-button mice
+XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+
+ Option "Emulate3Buttons"
+XCOMM Option "Emulate3Timeout" "50"
+
+XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any
+XCOMM 3-button mouse where the middle button generates left+right button
+XCOMM events.
+
+XCOMM Option "ChordMiddle"
+
+EndSection
+
+Section "InputDevice"
+ Identifier "Mouse2"
+ Driver "mouse"
+ Option "Protocol" "MouseMan"
+ Option "Device" "/dev/mouse2"
+EndSection
+
+XCOMM Some examples of extended input devices
+
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball"
+XCOMM Driver "magellan"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball2"
+XCOMM Driver "spaceorb"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen0"
+XCOMM Driver "microtouch"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "1412"
+XCOMM Option "MaxX" "15184"
+XCOMM Option "MinY" "15372"
+XCOMM Option "MaxY" "1230"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen1"
+XCOMM Driver "elo2300"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "231"
+XCOMM Option "MaxX" "3868"
+XCOMM Option "MinY" "3858"
+XCOMM Option "MaxY" "272"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonThreshold" "17"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+
+XCOMM **********************************************************************
+XCOMM Monitor section
+XCOMM **********************************************************************
+
+XCOMM Any number of monitor sections may be present
+
+Section "Monitor"
+
+XCOMM The identifier line must be present.
+
+ Identifier "Generic Monitor"
+
+XCOMM The VendorName and ModelName lines are optional.
+ VendorName "Unknown"
+ ModelName "Unknown"
+
+XCOMM HorizSync is in kHz unless units are specified.
+XCOMM HorizSync may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+ HorizSync 31.5 # typical for a single frequency fixed-sync monitor
+
+XCOMM HorizSync 30-64 # multisync
+XCOMM HorizSync 31.5, 35.2 # multiple fixed sync frequencies
+XCOMM HorizSync 15-25, 30-50 # multiple ranges of sync frequencies
+
+XCOMM VertRefresh is in Hz unless units are specified.
+XCOMM VertRefresh may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+ VertRefresh 60 # typical for a single frequency fixed-sync monitor
+
+XCOMM VertRefresh 50-100 # multisync
+XCOMM VertRefresh 60, 65 # multiple fixed sync frequencies
+XCOMM VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies
+
+XCOMM Modes can be specified in two formats. A compact one-line format, or
+XCOMM a multi-line format.
+
+XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
+XCOMM These two are equivalent
+
+XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+
+ Mode "640x480"
+ DotClock 25.175
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+
+XCOMM These two are equivalent
+
+XCOMM ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+
+XCOMM Mode "1024x768i"
+XCOMM DotClock 45
+XCOMM HTimings 1024 1048 1208 1264
+XCOMM VTimings 768 776 784 817
+XCOMM Flags "Interlace"
+XCOMM EndMode
+
+XCOMM If a monitor has DPMS support, that can be indicated here. This will
+XCOMM enable DPMS when the montor is used with drivers that support it.
+
+XCOMM Option "dpms"
+
+XCOMM If a monitor requires that the sync signals be superimposed on the
+XCOMM green signal, the following option will enable this when used with
+XCOMM drivers that support it. Only a relatively small range of hardware
+XCOMM (and drivers) actually support this.
+
+XCOMM Option "sync on green"
+
+EndSection
+
+Section "Monitor"
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+ Identifier "Multi sync"
+ VendorName "IDEK"
+ ModelName "MF8615"
+ HorizSync 24-70
+ VertRefresh 50-100
+
+ Mode "640x400"
+ DotClock 28.322
+ HTimings 640 664 712 808
+ VTimings 400 400 402 417
+ EndMode
+
+ Mode "640x480"
+ DotClock 28.0
+ HTimings 640 690 752 800
+ VTimings 480 496 544 560
+ EndMode
+
+ Mode "NEC480"
+ DotClock 31.5
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+
+ Mode "800x600"
+ DotClock 36.00
+ HTimings 800 840 900 1000
+ VTimings 600 602 610 664
+ EndMode
+
+ Mode "1024x768"
+ DotClock 65.00
+ HTimings 1024 1188 1210 1370
+ VTimings 768 768 770 790
+ EndMode
+
+ Mode "1024x768i"
+ DotClock 45.00
+ HTimings 1024 1030 1230 1260
+ VTimings 768 768 790 830
+ Flags "Interlace"
+ EndMode
+
+ Mode "1024x768H"
+ DotClock 75.00
+ HTimings 1024 1068 1184 1328
+ VTimings 768 771 777 806
+ EndMode
+
+ Mode "1280x1024"
+ DotClock 109.00
+ HTimings 1280 1290 1680 1696
+ VTimings 1024 1027 1030 1064
+ EndMode
+
+ Mode "1280x1024H"
+ DotClock 110.00
+ HTimings 1280 1300 1315 1700
+ VTimings 1024 1027 1030 1064
+ EndMode
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Graphics device section
+XCOMM **********************************************************************
+
+XCOMM Any number of graphics device sections may be present
+
+Section "Device"
+ Identifier "MGA"
+ VendorName "Matrox"
+ BoardName "Millennium"
+ Driver "mga"
+XCOMM BusID "PCI:0:10:0"
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Screen sections.
+XCOMM **********************************************************************
+
+XCOMM Any number of screen sections may be present. Each describes
+XCOMM the configuration of a single screen. A single specific screen section
+XCOMM may be specified from the X server command line with the "-screen"
+XCOMM option.
+
+Section "Screen"
+
+XCOMM The Identifier, Device and Monitor lines must be present
+
+ Identifier "Screen 1"
+ Device "MGA"
+ Monitor "Multi sync"
+
+XCOMM The favoured Depth and/or Bpp may be specified here
+
+ DefaultDepth 8
+
+ SubSection "Display"
+ Depth 8
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ EndSubsection
+
+ SubSection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ EndSubsection
+
+ SubSection "Display"
+ Depth 24
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ EndSubsection
+
+ SubSection "Display"
+ Depth 32
+ Modes "1024x768" "800x600" "640x480"
+ EndSubsection
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM ServerLayout sections.
+XCOMM **********************************************************************
+
+Section "ServerLayout"
+ Identifier "simple layout"
+ Screen "Screen 1"
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
diff --git a/xc/programs/Xserver/hw/xfree86/XFree86.man b/xc/programs/Xserver/hw/xfree86/XFree86.man
new file mode 100644
index 000000000..9858ed6d2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/XFree86.man
@@ -0,0 +1,556 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.43 1998/07/25 16:54:46 dawes Exp $
+.TH XFree86 1 "Version 4.0" "XFree86"
+.SH NAME
+XFree86 - X11R6 X server
+.SH SYNOPSIS
+.B XFree86
+[:display] [option ...]
+.SH DESCRIPTION
+XFree86 is an X servers for UNIX-like OSs on Intel x86 and other platforms.
+This work is derived from
+.I "X386\ 1.2"
+which was contributed to X11R5 by Snitily Graphics Consulting Service.
+The current XFree86 release is based on X11R6.3.
+The XFree86 X server architecture was redesigned for the 4.0 release, and
+it includes among other things a loadable module system donated by
+Metro Link, Inc.
+.SH CONFIGURATIONS
+.PP
+.I XFree86
+operates under the following operating systems:
+.RS .5i
+.na
+.PP
+-- SVR3.2: SCO 3.2.2, 3.2.4, ISC 3.x, 4.x
+.br
+-- SVR4.0: ESIX, Microport, Dell, UHC, Consensys, MST, ISC, AT&T, NCR
+.br
+-- SVR4.2: Consensys, Univel (UnixWare)
+.br
+-- Solaris (x86) 2.5, 2.6
+.br
+-- FreeBSD 2.1.x, 2.2.x, 3.0-current
+.br
+-- NetBSD 1.2, 1.3
+.br
+-- OpenBSD
+.ig
+.br
+-- BSD/386 version 1.1 and BSD/OS 2.0
+.br
+-- Mach (from CMU)
+..
+.br
+-- Linux
+.ig
+.br
+-- Amoeba version 5.1
+.br
+-- Minix-386vm version 1.6.25.1
+..
+.br
+-- LynxOS AT versions 2.2.1, 2.3.0 and 2.4.0, LynxOS microSPARC 2.4.0
+.ad
+.RE
+.PP
+.SH "NETWORK CONNECTIONS"
+\fIXFree86\fP supports connections made using the following reliable
+byte-streams:
+.TP 4
+.I "Local"
+\fIXFree86\fP supports local connections via Streams pipe via various mechanisms,
+using the following paths (\fIn\fP represents the display number):
+.sp .5v
+.in 8
+.nf
+/dev/X/server.\fBn\fR (SVR3 and SVR4)
+/dev/X/Nserver.\fBn\fR (SVR4)
+.ig
+/tmp/.X11-unix/X\fBn\fR (ISC SVR3)
+..
+/dev/X\fBn\fRS and /dev/X\fBn\fRR (SCO SVR3)
+.fi
+.in
+.sp .5v
+On SVR4.0.4, if the \fIAdvanced Compatibility Package\fP
+is installed, and in SVR4.2, \fIXFree86\fP supports local connections
+from clients for SCO XSight/ODT, and (with modifications to the binary)
+clients for ISC SVR3.
+.TP 4
+.I "Unix Domain"
+\fIXFree86\fP uses \fI/tmp/.X11-unix/X\fBn\fR as the filename for the socket,
+where \fIn\fP is the display number.
+.TP 4
+.I TCP\/IP
+\fIXFree86\fP listens on port htons(6000+\fIn\fP), where \fIn\fP is the display
+number.
+.ig
+.TP 4
+.I "Amoeba RPC"
+This is the default communication medium used under native Amoeba.
+Note that under Amoeba, the server should be started
+with a ``\fIhostname\fP:\fIdisplaynumber\fP'' argument.
+..
+.SH "ENVIRONMENT VARIABLES"
+For operating systems that support local connections other than Unix Domain
+sockets (SVR3 and SVR4), there is a compiled-in list specifying the order
+in which local connections should be attempted. This list can be overridden by
+the \fIXLOCAL\fP environment variable described below. If the display name
+indicates a best-choice connection should be made (e.g. \fI:0.0\fP), each
+connection mechanism is tried until a connection succeeds or no more
+mechanisms are available. Note: for these OSs, the Unix Domain socket
+connection is treated differently from the other local connection types.
+To use it the connection must be made to \fIunix:0.0\fP.
+.PP
+The \fIXLOCAL\fP environment variable should contain a list of one more
+more of the following:
+.sp .5v
+.in 8
+.nf
+NAMED
+PTS
+SCO
+ISC
+.fi
+.in
+.sp .5v
+which represent SVR4 Named Streams pipe, Old-style USL
+Streams pipe, SCO XSight Streams pipe, and ISC Streams pipe, respectively.
+You can select a single mechanism (e.g. \fIXLOCAL=NAMED\fP), or an ordered
+list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP). This variable overrides the
+compiled-in defaults. For SVR4 it is recommended that \fINAMED\fP be
+the first preference connection. The default setting is
+\fIPTS:NAMED:ISC:SCO\fP.
+.PP
+To globally override the compiled-in defaults, you should define (and
+export if using \fIsh\fP or \fIksh\fP) \fIXLOCAL\fP globally. If you
+use \fIstartx/xinit\fP, the definition should be at the top of
+your \fI.xinitrc\fP file. If you use \fIxdm\fP, the definitions should be
+early on in the \fI<XRoot>/lib/X11/xdm/Xsession\fP script.
+.SH OPTIONS
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXFree86\fP accepts the following command line switches:
+.TP 8
+.B vt\fIXX\fP
+\fIXX\fP specifies the Virtual Terminal device number which
+\fIXFree86\fP will use. Without this option, \fIXFree86\fP will pick the first
+available Virtual Terminal that it can locate. This option applies only
+to SVR3, SVR4, Linux, and BSD OSs with the `syscons' or `pcvt' driver.
+.TP 8
+.B -crt /dev/tty\fIXX\fP
+SCO only. This is the same as the \fBvt\fP option, and is provided for
+compatibility with the native SCO X server.
+.TP 8
+.B \-probeonly
+Causes the server to exit after the device probing stage. The XF86Config file
+is still used when this option is given, so information that can be
+auto-detected should be commented out.
+.TP 8
+.B \-quiet
+Suppress most informational messages at startup.
+.TP 8
+.B \-bpp \fIn\fP
+Set number of bits per pixel. The default is 8. Legal values are
+1, 4, 8, 15, 16, 24, 32. Not all servers support all values.
+.TP 8
+.B \-weight \fInnn\fP
+Set RGB weighting at 16 bpp. The default is 565. This applies
+only to those servers which support 16 bpp.
+.TP 8
+.B \-flipPixels
+Swap the default values for the black and white pixels.
+.TP 8
+.B \-disableVidMode
+Disable the the parts of the VidMode extension used by the xvidtune client
+that can be used to change the video modes.
+.TP 8
+.B \-allowNonLocalXvidtune
+Allow the xvidtune client to connect from another host. By default non-local
+connections are not allowed.
+.TP 8
+.B \-disableModInDev
+Disable dynamic modification of input device settings.
+.TP 8
+.B \-allowNonLocalModInDev
+Allow changes to keyboard and mouse settings from non-local clients.
+By default, connections from non-local clients are not allowed to do this.
+.TP
+.B \-allowMouseOpenFail
+Allow the server to start up even if the mouse device can't be opened or
+initialised.
+.TP 8
+.B \-gamma \fIvalue\fP
+Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The
+default is 1.0
+This value is applied equally to the R, G and B values. Not all servers
+support this.
+.TP 8
+.B \-rgamma \fIvalue\fP
+Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. The
+default is 1.0
+Not all servers support this.
+.TP 8
+.B \-ggamma \fIvalue\fP
+Set the green gamma correction. \fIvalue\fP must be between 0.1 and 10. The
+default is 1.0
+Not all servers support this.
+.TP 8
+.B \-bgamma \fIvalue\fP
+Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. The
+default is 1.0
+Not all servers support this.
+.TP 8
+.B \-showconfig
+Print out the server version, patchlevel, and a list of screen drivers
+configured in the server.
+.TP 8
+.B \-verbose
+Multiple occurrences of this flag increase the amount of information printed on
+stderr (more than the default).
+.TP 8
+.B \-version
+Same as \fB\-showconfig\fP.
+.TP 8
+.B \-xf86config \fIfile\fP
+Read the server configuration from \fIfile\fP. This option is only available
+when the server is run as root (i.e, with real-uid 0).
+.TP 8
+.B \-keeptty
+Prevent the server from detaching its initial controlling terminal. This
+option is only useful when debugging the server.
+.SH "KEYBOARD"
+Multiple key presses recognized directly by \fIXFree86\fP are:
+.TP 8
+.B Ctrl+Alt+Backspace
+Immediately kills the server -- no questions asked. (Can be disabled by
+specifying "DontZap" in the \fBServerFlags\fP section of the XF86Config file.)
+.TP 8
+.B Ctrl+Alt+Keypad-Plus
+Change video mode to next one specified in the configuration file,
+(increasing video resolution order).
+.TP 8
+.B Ctrl+Alt+Keypad-Minus
+Change video mode to previous one specified in the configuration file,
+(decreasing video resolution order).
+.TP 8
+.B Ctrl+Alt+F1...F12
+For BSD systems using the syscons driver and Linux, these keystroke
+combinations are used to switch to Virtual
+Console 1 through 12.
+.SH SETUP
+.I XFree86
+uses a configuration file called \fBXF86Config\fP for its initial setup.
+Refer to the
+.I XF86Config(4/5)
+manual page for more information.
+.SH FILES
+.TP 30
+/etc/XF86Config
+Server configuration file
+.TP 30
+<XRoot>/lib/X11/XF86Config.\fIhostname\fP
+Server configuration file
+.TP 30
+<XRoot>/lib/X11/XF86Config
+Server configuration file
+.TP 30
+<XRoot>/bin/\(**
+Client binaries
+.TP 30
+<XRoot>/include/\(**
+Header files
+.TP 30
+<XRoot>/lib/\(**
+Libraries
+.TP 30
+<XRoot>/lib/X11/fonts/\(**
+Fonts
+.TP 30
+<XRoot>/lib/X11/rgb.txt
+Color names to RGB mapping
+.TP 30
+<XRoot>/lib/X11/XErrorDB
+Client error message database
+.TP 30
+<XRoot>/lib/X11/app-defaults/\(**
+Client resource specifications
+.TP 30
+<XRoot>/man/man?/\(**
+Manual pages
+.TP 30
+/etc/X\fIn\fP.hosts
+Initial access control list for display \fIn\fP
+.LP
+Note: <XRoot> refers to the root of the X11 install tree.
+.SH "SEE ALSO"
+X(1), Xserver(1), xdm(1), xinit(1), XF86Config(4/5), xf86config(1),
+XF86_SVGA(1), XF86_VGA16(1), XF86_Mono(1), XF86_Accel(1), xvidtune(1)
+.SH AUTHORS
+.PP
+For X11R5, \fIXF86 1.2\fP was provided by:
+.TP 8
+Thomas Roell, \fIroell@informatik.tu-muenchen.de\fP
+TU-Muenchen: Server and SVR4 stuff
+.TP 8
+Mark W. Snitily, \fImark@sgcs.com\fP
+SGCS: SVR3 support, X Consortium Sponsor
+.PP
+ ... and many more people out there on the net who helped with ideas and
+bug-fixes.
+.PP
+XFree86 was integrated into X11R6 by the following team:
+.PP
+.nf
+Stuart Anderson \fIanderson@metrolink.com\fP
+Doug Anson \fIdanson@lgc.com\fP
+Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP
+Mike Bernson \fImike@mbsun.mlb.org\fP
+Robin Cutshaw \fIrobin@XFree86.org\fP
+David Dawes \fIdawes@XFree86.org\fP
+Marc Evans \fImarc@XFree86.org\fP
+Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP
+Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP
+Dirk Hohndel \fIhohndel@XFree86.org\fP
+David Holland \fIdavidh@use.com\fP
+Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP
+Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP
+Glenn Lai \fIglenn@cs.utexas.edu\fP
+Ted Lemon \fImellon@ncd.com\fP
+Rich Murphey \fIrich@XFree86.org\fP
+Hans Nasten \fInasten@everyware.se\fP
+Mark Snitily \fImark@sgcs.com\fP
+Randy Terbush \fIrandyt@cse.unl.edu\fP
+Jon Tombs \fItombs@XFree86.org\fP
+Kees Verstoep \fIversto@cs.vu.nl\fP
+Paul Vixie \fIpaul@vix.com\fP
+Mark Weaver \fIMark_Weaver@brown.edu\fP
+David Wexelblat \fIdwex@XFree86.org\fP
+Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP
+Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP
+Orest Zborowski \fIorestz@eskimo.com\fP
+.fi
+.PP
+The \fIXFree86\fP enhancement package was provided by:
+.TP 8
+David Dawes, \fIdawes@XFree86.org\fP
+Release coordination, administration of FTP repository and mailing lists.
+Source tree management
+and integration, accelerated server integration, fixing, and coding.
+.TP 8
+Glenn Lai, \fIglenn@cs.utexas.edu\fP
+The SpeedUp code for ET4000 based SVGA cards, and ET4000/W32 accelerated
+server.
+.TP 8
+Jim Tsillas, \fIjtsilla@ccs.neu.edu\fP
+Many server speedups from the fX386 series of enhancements.
+.TP 8
+David Wexelblat, \fIdwex@XFree86.org\fP
+Integration of the fX386 code into the default server,
+many driver fixes, and driver documentation, assembly of the VGA
+card/monitor database, development of the generic video mode listing.
+Accelerated server integration, fixing, and coding.
+.TP 8
+Dirk Hohndel, \fIhohndel@XFree86.org\fP
+Linux shared libraries and release coordination. Accelerated server
+integration and fixing. Generic administrivia and documentation.
+.PP
+.TP 8
+Amancio Hasty Jr., \fIhasty@netcom.com\fP
+Porting to \fB386BSD\fP version 0.1 and XS3 development.
+.TP 8
+Rich Murphey, \fIrich@XFree86.org\fP
+Ported to \fB386BSD\fP version 0.1 based on the original port by Pace Willison.
+Support for \fB386BSD\fP, \fBFreeBSD\fP, and \fBNetBSD\fP.
+.TP 8
+Robert Baron, \fIRobert.Baron@ernst.mach.cs.cmu.edu\fP
+Ported to \fBMach\fP.
+.TP 8
+Orest Zborowski, \fIorestz@eskimo.com\fP
+Ported to \fBLinux\fP.
+.TP 8
+Doug Anson, \fIdanson@lgc.com\fP
+Ported to \fBSolaris x86\fP.
+.TP 8
+David Holland, \fIdavidh@use.com\fP
+Ported to \fBSolaris x86\fP.
+.TP 8
+David McCullough, \fIdavidm@stallion.oz.au\fP
+Ported to \fBSCO SVR3\fP.
+.TP 8
+Michael Rohleder, \fImichael.rohleder@stadt-frankfurt.de\fP
+Ported to \fBISC SVR3\fP.
+.TP 8
+Kees Verstoep, \fIversto@cs.vu.nl\fP
+Ported to \fBAmoeba\fP based on Leendert van Doorn's original Amoeba port of
+X11R5.
+.TP 8
+Marc Evans, \fIMarc@XFree86.org\fP
+Ported to \fBOSF/1\fP.
+.TP 8
+Philip Homburg, \fIphilip@cs.vu.nl\fP
+Ported to \fBMinix-386vm\fP.
+.TP 8
+Thomas Mueller, \fItm@systrix.de\fP
+Ported to \fBLynxOS\fP.
+.TP 8
+Jon Tombs, \fItombs@XFree86.org\fP
+S3 server and accelerated server coordination.
+.TP 8
+Harald Koenig, \fIkoenig@tat.physik.uni-tuebingen.de\fP
+S3 server development.
+.TP 8
+Bernhard Bender, \fIbr@elsa.mhs.compuserve.com\fP
+S3 server development.
+.TP 8
+Kevin Martin, \fImartin@cs.unc.edu\fP
+Overall work on the base accelerated servers (ATI and 8514/A), and Mach64
+server.
+.TP 8
+Rik Faith, \fIfaith@cs.unc.edu\fP
+Overall work on the base accelerated servers (ATI and 8514/A).
+.TP 8
+Tiago Gons, \fItiago@comosjn.hobby.nl\fP
+Mach8 and 8514/A server development
+.TP 8
+Hans Nasten, \fInasten@everyware.se\fP
+Mach8, 8514/A, and S3 server development and BSD/386 support
+.TP 8
+Mike Bernson, \fImike@mbsun.mlb.org\fP
+Mach32 server development.
+.TP 8
+Mark Weaver, \fIMark_Weaver@brown.edu\fP
+Mach32 server development.
+.TP 8
+Craig Groeschel, \fIcraig@metrolink.com\fP
+Mach32 server development.
+.TP 8
+Henry Worth, \fIHenry.Worth@amail.amdahl.com\fP
+AGX server.
+.TP 8
+Erik Nygren, \fInygren@mit.edu\fP
+P9000 server.
+.TP 8
+Harry Langenbacher \fIharry@brain.jpl.nasa.gov\fP
+P9000 server.
+.TP 8
+Chris Mason, \fImason@mail.csh.rit.edu\fP
+P9000 server.
+.TP 8
+Henrik Harmsen \fIharmsen@eritel.se\fP
+P9000 server.
+.TP 8
+Simon Cooper, \fIscooper@vizlab.rutgers.edu\fP
+Cirrus accelerated code (based on work by Bill Reynolds).
+.TP 8
+Harm Hanemaayer, \fIhhanemaa@cs.ruu.nl\fP
+Cirrus accelerated code, and ARK driver.
+.TP 8
+Thomas Zerucha, \fIzerucha@shell.portal.com\fP
+Support for Cirrus CL-GD7543.
+.TP 8
+Leon Bottou, \fIbottou@laforia.ibp.fr\fP
+ARK driver.
+.TP 8
+Mike Tierney, \fIfloyd@eng.umd.edu\fP
+WD accelerated code.
+.TP 8
+Bill Conn, \fIconn@bnr.ca\fP
+WD accelerated code.
+.TP 8
+Brad Bosch, \fIbrad@lachman.com\fP
+WD 90C24A support.
+.TP 8
+Alan Hourihane, \fIalanh@fairlite.demon.co.uk\fP
+Trident SVGA driver, SiS SVGA driver and DEC 21030 server.
+.TP 8
+Marc Aurele La France, \fItsi@ualberta.ca\fP
+ATI SVGA driver
+.TP 8
+Steve Goldman, \fIsgoldman@encore.com\fP
+Oak 067/077 SVGA driver.
+.TP 8
+Jorge Delgado, \fIernar@dit.upm.es\fP
+Oak SVGA driver, and 087 accelerated code.
+.TP 8
+Bill Conn, \fIconn@bnr.ca\fP
+WD accelerated code.
+.TP 8
+Paolo Severini, \fIlendl@dist.dist.unige.it\fP
+AL2101 SVGA driver
+.TP 8
+Ching-Tai Chiu, \fIcchiu@netcom.com\fP
+Avance Logic ALI SVGA driver
+.TP 8
+Manfred Brands, \fImb@oceonics.nl\fP
+Cirrus 64xx SVGA driver
+.TP 8
+Randy Hendry, \fIrandy@sgi.com\fP
+Cirrus 6440 support in the cl64xx SVGA driver
+.TP 8
+Frank Dikker, \fIdikker@cs.utwente.nl\fP
+MX SVGA driver
+.TP 8
+Regis Cridlig, \fIcridlig@dmi.ens.fr\fP
+Chips & Technologies driver
+.TP 8
+Jon Block, \fIblock@frc.com\fP
+Chips & Technologies driver
+.TP 8
+Mike Hollick, \fIhollick@graphics.cis.upenn.edu\fP
+Chips & Technologies driver
+.TP 8
+Nozomi Ytow
+Chips & Technologies driver
+.TP 8
+Egbert Eich, \fIEgbert.Eich@Physik.TH-Darmstadt.DE\fP
+Chips & Technologies driver
+.TP 8
+David Bateman, \fIdbateman@ee.uts.edu.au\fP
+Chips & Technologies driver
+.TP 8
+Xavier Ducoin, \fIxavier@rd.lectra.fr\fP
+Chips & Technologies driver
+.TP 8
+Peter Trattler, \fIpeter@sbox.tu-graz.ac.at\fP
+RealTek SVGA driver
+.TP 8
+Craig Struble, \fIcstruble@acm.vt.edu\fP
+Video7 SVGA driver
+.TP 8
+Gertjan Akkerman, \fIakkerman@dutiba.twi.tudelft.nl\fP
+16 colour VGA server, and XF86Config parser.
+.TP 8
+Davor Matic, \fIdmatic@Athena.MIT.EDU\fP
+Hercules driver.
+.TP 8
+Pascal Haible, \fIhaible@izfm.uni-stuttgart.de\fP
+Banked monochrome VGA support, Hercules support, and mono frame buffer
+support for dumb monochrome devices
+.TP 8
+Martin Schaller,
+.TP 8
+Geert Uytterhoeven,\fIGeert.Uytterhoeven@cs.kuleuven.ac.be\fP
+Linux/m68k Frame Buffer Device driver
+.TP 8
+Andreas Schwab, \fIschwab@issan.informatik.uni-dortmund.de\fP
+Linux/m68k Frame Buffer Device driver
+.TP 8
+Guenther Kelleter, \fIguenther@Pool.Informatik.RWTH-Aachen.de\fP
+Linux/m68k Frame Buffer Device driver
+.TP 8
+Frederic Lepied, \fLepied@XFree86.Org\fP
+XInput extension integration. Wacom, joystick and extended mouse drivers.
+.TP 8
+Patrick Lecoanet, \flecoanet@cena.dgac.fr\fP
+Elographics touchscreen driver.
+.TP 8
+Steven Lang, \ftiger@tyger.org\fP
+SummaSketch tablet driver.
+.PP
+ ... and many more people out there on the net who helped with beta-testing
+this enhancement.
+.PP
+\fIXFree86\fP source is available from the FTP server
+\fIftp.XFree86.org\fP, among others. Send email to
+\fIXFree86@XFree86.org\fP for details.
+.\" $XConsortium: XFree86.man /main/25 1996/12/09 17:33:22 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile
new file mode 100644
index 000000000..2ccf88e62
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile
@@ -0,0 +1,202 @@
+XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $
+
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.105 1999/08/14 10:49:34 dawes Exp $
+
+
+
+#include <Server.tmpl>
+
+#ifdef i386MachArchitecture
+#ifdef GNUMachArchitecture
+ KBD = xf86Kbd
+#else
+ KBD = xf86KbdMach
+#endif /* GNUMachArchitecture */
+#else
+# ifdef i386BsdArchitecture
+ KBD = xf86KbdBSD
+# else
+# ifdef LinuxArchitecture
+ KBD = xf86KbdLnx
+# else
+ KBD = xf86Kbd
+# endif
+# endif
+#endif
+
+#if BuildXKB
+ XKBDDXSRC = xf86XKB.c
+ XKBDDXOBJ = xf86XKB.o
+#endif
+
+#if BuildXInputExt
+ XF86_XINPUT_SRC = xf86Xinput.c xf86Switch.c xisb.c
+ XF86_XINPUT_OBJ = xf86Xinput.o xf86Switch.o xisb.o
+#endif
+
+MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\"
+LOGDEFINES = -DDEFAULT_LOGPREFIX=\"$(LOGDIRECTORY)/XFree86.\"
+
+#if DoLoadableServer
+EXT_MODULES_DEFINES = $(GLX_DEFINES)
+#endif
+
+#if !NewInput
+#if !defined(LynxOSArchitecture) && !defined(OS2Architecture)
+ PNPMOUSESRCS = xf86PnPMouse.c
+ PNPMOUSEOBJS = xf86PnPMouse.o
+ PNPMOUSEDEFINES = -DPNP_MOUSE
+#endif
+ MOUSESRCS = xf86Mouse.c
+ MOUSEOBJS = xf86Mouse.o
+#endif
+
+#if defined(LinuxArchitecture) && defined(PpcArchitecture)
+ KBDDEFINES = -DASSUME_CUSTOM_KEYCODES
+#endif
+
+#ifndef XF86ExpireServer
+#define XF86ExpireServer NO
+#endif
+
+#if XF86ExpireServer
+ BETASRC = xf86Beta.c
+ BETAOBJ = xf86Beta.o
+ BETADEFS = -DDO_CHECK_BETA
+#ifndef NeedXF86Beta
+#define NeedXF86Beta YES
+#endif
+#endif
+
+#ifndef NeedXF86Beta
+#define NeedXF86Beta NO
+#endif
+
+#if XF86ExpireServer
+EXP_FORCE_DEFINES = -DSHOW_BETA_MESSAGE -DEXPIRE_SERVER
+#endif
+
+SRCS = \
+ xf86Bus.c \
+ xf86IniExt.c \
+ xf86Config.c \
+ xf86Cursor.c \
+ xf86DGA.c \
+ xf86DPMS.c \
+ xf86DefModes.c \
+ xf86DoScanPci.c \
+ xf86Events.c \
+ xf86Globals.c \
+ xf86Helper.c \
+ xf86Init.c \
+ xf86Io.c \
+ xf86MiscExt.c \
+ xf86Mode.c \
+ $(MOUSESRCS) \
+ $(PNPMOUSESRCS) \
+ xf86Option.c \
+ xf86VidMode.c \
+ xf86fbman.c \
+ xf86xv.c \
+ xf86cmap.c\
+ $(KBD).c \
+ $(XF86_XINPUT_SRC) \
+ $(XINPUT_DEV_SRCS) \
+ $(XKBDDXSRC) \
+ $(BETASRC) \
+ $(SERVERSRCS)
+
+OBJS = \
+ xf86Bus.o \
+ xf86Config.o \
+ xf86Cursor.o \
+ xf86DGA.o \
+ xf86DPMS.o \
+ xf86DefModes.o \
+ xf86DoScanPci.o \
+ xf86Events.o \
+ xf86Globals.o \
+ xf86Helper.o \
+ xf86Io.o \
+ xf86MiscExt.o \
+ xf86Mode.o \
+ $(MOUSEOBJS) \
+ $(PNPMOUSEOBJS) \
+ xf86Option.o \
+ xf86VidMode.o \
+ xf86fbman.o \
+ xf86xv.o \
+ xf86cmap.o\
+ $(XF86_XINPUT_OBJ) \
+ $(XKBDDXOBJ) \
+ $(BETAOBJ) \
+ $(KBD).o
+
+OFILES = \
+ xf86Init.o \
+ xf86IniExt.o
+
+ VGAINCLUDES = -I$(XF86SRC)/vgahw
+ INCLUDES = -I. -I$(XF86OSSRC) -I$(XF86OSSRC)/bus -I$(SERVERSRC)/mfb \
+ -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(SERVERSRC)/os \
+ -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \
+ -I$(SERVERSRC)/Xi -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+ -I$(FONTLIBSRC)/include -I$(XF86SRC) -I$(XF86PARSERSRC) \
+ -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac
+
+
+
+ OSNAME = OSName
+ OSVENDOR = OSVendor
+ OSNAMEDEF = -DOSNAME='"$(OSNAME)"' -DOSVENDOR='"$(OSVENDOR)"'
+CONSDEFINES = XFree86ConsoleDefines
+EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES)
+PROJECTROOT = ProjectRoot
+XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"'
+
+ DEFINES = $(CONSDEFINES) $(PNPMOUSEDEFINES) $(KBDDEFINES) $(EXT_DEFINES)
+
+AllTarget($(OFILES))
+
+SpecialCObjectRule(xf86Bus,NullParameter,$(VGAINCLUDES))
+SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(EXT_DEFINES) $(BETADEFS))
+SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES))
+SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES) $(MODPATHDEFINES) $(LOGDEFINES))
+SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES))
+
+#if NeedXF86Beta
+SpecialCObjectRule($(BETAOBJ),NullParameter,$(EXP_DEFINES))
+#endif
+
+SpecialCObjectRule(xf86IniExt,$(ICONFIGFILES),$(EXT_DEFINES) $(EXT_MODULES_DEFINES))
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(xf86,$(OBJS))
+
+LinkFile(xf86IniExt.c,$(SERVERSRC)/mi/miinitext.c)
+LinkSourceFile(xf86Version.h,..)
+LinkSourceFile(xf86Pci.h,$(XF86OSSRC)/bus)
+
+#ifndef OS2Architecture
+DependTarget()
+#endif
+
+InstallDriverSDKNonExecFile(compiler.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Module.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Opt.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Pci.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86PciInfo.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Priv.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Privstr.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Resources.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Version.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86Xinput.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86cmap.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86fbman.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86str.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86xv.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/xc/programs/Xserver/hw/xfree86/common/NOTES.Mice b/xc/programs/Xserver/hw/xfree86/common/NOTES.Mice
new file mode 100644
index 000000000..575615bbb
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/NOTES.Mice
@@ -0,0 +1,470 @@
+Enhancing Mouse Support in the X server
+
+22 January 1998.
+Kazutaka YOKOTA
+yokota@zodiac.mech.utsunomiya-u.ac.jp, yokota@freebsd.org
+
+0. Introduction -------------------------------------------------------
+
+Since Microsoft introduced IntelliMouse to the market, manufacturers
+have added new features, such as a wheel/roller and additional
+buttons, to their mouse products. However, these mice often need
+specific initialization procedure and may use new data format which
+XFree86 servers have not known.
+
+This tar file contains two sets of patches to enhance mouse support in
+the XFree86 servers: one set for 3.3.1 (331.diff) and the other for
+3.9Ac (39Ac.diff).
+
+The diff files modify the following files:
+
+xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
+xc/programs/Xserver/hw/xfree86/common/xf86.h
+xc/programs/Xserver/hw/xfree86/common/xf86_Config.h
+xc/programs/Xserver/hw/xfree86/common/xf86Config.c
+xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c
+xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c (NEW FILE)
+xc/programs/Xserver/hw/xfree86/common/xf86Events.c
+xc/programs/Xserver/hw/xfree86/common/xf86Io.c
+xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
+
+Choose an appropriate diff file and apply it in
+xc/programs/Xserver/hw/xfree86.
+
+%cd xc/programs/Xserver/hw/xfree86
+%patch -p0 < _diff_file_
+
+1. Modifications -----------------------------------------------------
+
+1.1. Support more mice
+
+The patch adds the support for the following mice:
+
+Kensington ThinkingMouse (serial, PS/2Ą¤4 buttons)
+ALPS GlidePoint (PS/2Ą¤3 buttons)*1
+Genius NetScroll (PS/2Ą¤4 buttons, wheel)
+Genius NetMouse (serial, PS/2, 2 buttons + magic button)
+Genius NetMouse Pro (serial, PS/2, 3 buttons + magic button)
+ASCII MieMouse (serial, PS/2, 3 buttons, knob)
+Logitech MouseMan+ (serial, PS/2, 4 buttons, wheel)
+Logitech FirstMouse+ (serial, PS/2, 3 buttons, wheel)
+
+*1 The serial version of GlidePoint has been supported by XFree86
+since 3.2(?).
+
+To support wheel/roller and additional buttons of the above mice, the
+following enhancements were added:
+
+a) Add support for up to 12 buttons. XFree86 3.3.1 and 3.9Ac assumed
+the maximum number of buttons for the mouse is 5.
+
+b) Recognize the wheel/roller/magic_button movement as the Z (third)
+axis movement. I am very aware that the IntelliMouse support in
+XFree86 3.3.1 and 3.9 betas interpret the wheel movement as the button
+4 and 5. However, some mice have more than three buttons AND a wheel
+as you can see in the above list. It is overly restrictive to always
+have the wheel movement treated as the button 4 and 5. Instead, the
+wheel is regarded as the Z axis in this patch.
+
+Ideally, the wheel movement should be handled in the XInput extension
+as the third valuator. I hope this patch will provide the basis for
+such support in the future.
+
+Currently the Z axis movement is NOT reported back to the upper
+routines by xf86MouseProtocol(). In order to let the user to utilize
+this Z axis (wheel) movement, a new option, `ZAxisMapping', is added
+in XF86Config so that the user can choose any pair of buttons or
+another axis (X or Y) to which the Z axis (wheel) movement is
+assigned.
+
+For example, to make the IntelliMouse behave in the same way as
+before, add the following option to XF86Config.
+
+ ZAxisMapping 4 5
+
+c) PS/2 mouse initialization
+The above PS/2 mice need specialized initialization procedure to
+enable their features, otherwise they behave like the standard two
+button (or three button) PS/2 mouse. To initialize these mice, the
+host system must send a sequence of commands which is specific to each
+model.
+
+The PS/2 IntelliMouse support code in XFree86 3.9Ac beta already does
+this. The same technique is used to initialize the other PS/2 mice in
+this patch. However, the current implementation works only if the
+PS/2 mouse device allows `write' operation to the device and pass the
+written data as is to the PS/2 mouse. I don't know how many OS
+platforms support this, but suspect Linux is OK.
+
+If the initialization code does not work on the user's OS, s/he has
+to use the mouse as the standard PS/2 mouse by specifying "PS/2" as
+the mouse protocol.
+
+FreeBSD 2.2.5 or earlier certainly can NOT support PS/2 mouse
+initialization this way and the user is forced to use these mice as
+the standard PS/2 mouse ;-< FreeBSD 2.2.6 or later has better mouse
+support code and all these initialization chores are handled in the
+device driver in the kernel and the X server does not need to bother
+about them.
+
+1.2. Automatic protocol detection
+
+1.2.1 Serial mouse detection
+
+The user may specify "Auto" as the Protocol of his/her SERIAL mouse.
+Then, xf86SetupMouse() in xf86_Mouse.c will invoke the PnP COM device
+enumeration procedure (xf86GetPnPMouseProtocol() in xf86_PnPMouse.c)
+and select the appropriate protocol automatically based on the PnP ID
+string.
+
+If the user purchased a serial mouse in the last two, three years,
+there is a good chance that s/he can just write
+
+ Protocol "Auto"
+ Device "/dev/xxxx" (where xxxx is a serial device)
+
+in XF86Config and the X server is able to detect the right protocol.
+
+This PnP capability is OS-independent and the code should on any
+platforms running XFree86.
+
+1.2.2 Automatic detection in FreeBSD
+
+In FreeBSD 3.0-CURRENT and forthcoming 2.2.6, the user may specify
+"Auto" to the bus mouse, PS/2 mouse and system mouse (sysmouse)
+devices too, as the X server queries the mouse protocol used by these
+drivers via ioctls provided by the drivers.
+
+(FreeBSD 2.2.6 has not been released. But, a snapshot is available
+as ftp://releng22.FreeBSD.ORG/pub/FreeBSD.)
+
+This is made possible because these new versions of FreeBSD have
+improved mouse support. The bus and PS/2 mouse drivers and the mouse
+daemon can handle wide variety of mouse models and offer new services
+in the following area. The drivers can now be instructed to send
+mouse data in the standardized format, the SysMouse format. (The first
+5 bytes of this format are exactly the same as the MouseSystems
+format.)
+
+To maintain compatibility with previous versions of the drivers, the
+concept of operation level is introduced. The drivers are at the
+basic level (level 0) when opened and send data in the previous,
+proprietary format. They will switch to the standard SysMouse format
+after the user program sends an ioctl call to change the level to the
+extended level (level 1).
+
+A set of new ioctl functions is supported by the drivers. The user
+program can obtain various information about the driver and the
+pointing device. These ioctls are useful because even if the user
+failed to specify the correct protocol type in XF86Config, the X
+server can override it with the information obtained from the driver.
+
+To take advantage of the new services, xf86SetupMouse() does the
+followings:
+
+Step 1. Call the ioctl function to set the operation level 1.
+
+Step 2. Call ioctl functions obtain driver and device information.
+Inspect the protocol type the driver uses. If Step 1 was successful,
+we should see the driver is using the SysMouse protocol. If the
+protocol type specified in XF86Config and the one reported by the
+driver do not agree, the latter should be taken as the correct type
+hereafter.
+
+Step 3. If the ioctl functions in Step 2 failed, we must be dealing
+with either a serial mouse or a mouse driver which is incapable of
+serving new functions. If the user specified "Auto" in XF86Config,
+invoke the PnP COM device enumeration procedure to detect the mouse.
+Otherwise use the protocol specified by the user.
+
+Step 4. Complete initialization according to the detected protocol
+type.
+
+FreeBSD-specific code is marked by #if defined(__FreeBSD__) in the
+patch.
+
+1.3. New options in XF86Config
+
+a) New keywords for mouse protocol
+The following strings are accepted in the Protocol statement:
+ "ThinkingMouse" (Kensington ThinkingMouse, serial version)
+ "ThinkingMousePS/2" (Kensington ThinkingMouse, PS/2 version)
+ "GlidePointPS/2" (ALPS GlidePoint, PS/2 version)
+ "MouseManPlusPS/2" (Logitech MouseMan+, FistMouse+, PS/2 version)
+ "NetMousePS/2" (Genius NetMouse, NetMouse Pro, PS/2 version,
+ ASCII MieMouse, PS/2 version)
+ "NetScrollPS/2" (Genius NetScroll, PS/2 version)
+ "SysMouse" (FreeBSD sysmouse)
+ "Auto" (for automatic protocol detection)
+
+(The serial version of MouseMan+, FirstMouse+, NetMouse and MieMouse
+are compatible with MS IntelliMouse: specify "IntelliMouse" in the
+Protocol statement, or "Auto" to invoke the PnP enumeration
+procedure.)
+
+"ThinkingMousePS/2", "GlidePointPS/2", "MouseManPlusPS/2",
+"NetMousePS/2" and "NetScrollPS/2" are NOT supported by FreeBSD 2.2.5
+or earlier, because the OS does not support `write' operation to the
+PS/2 mouse driver, thus, these PS/2 mice cannot be initialized in the
+manner described in 1.1 (c). The user should specify "PS/2" for these
+mice and the X server will use the mice as the standard PS/2 mouse.
+
+These keywords are NOT supported by FreeBSD 2.2.6 or later too,
+because these mice are supported by the PS/2 mouse driver in the
+kernel and the X server does not need to initialize the mice or
+interpret new data format; it should simply read the data in the
+standardized "SysMouse" format passed by the PS/2 mouse driver. The
+user should specify "PS/2", "SysMouse" or "Auto" as the protocol for
+these mice.
+
+b) ZAxisMappping
+The option to map the Z axis (wheel) motion to a pair of buttons or to
+another axis.
+
+ ZAxisMapping X
+ ZAxisMapping Y
+ ZAxisMapping N M
+
+The first example will map the Z axis motion to the X axis motion.
+Whenever the user moves the wheel/roller, its movement is reported as
+the X axis motion. When the wheel/roller stays still, the real X axis
+motion is reported as is. The last example will map negative Z axis
+motion to the button N and positive Z axis motion to the button M. If
+this option is used and the buttons N or M actually exists in the
+mouse, their actions cannot be detected by the X server.
+
+c) Resolution
+The following option will set the mouse device resolution to N, if
+possible:
+
+ Resolution N
+
+Not all mice can support this. The PS/2 mouse device driver in
+FreeBSD 3.0-CURRENT and 2.2.6 can support it. I wrote generic code in
+xf86_Mouse.c for other platforms, but have no idea if it works.
+
+2. Some notes on mice ------------------------------------------------
+
+2.1 MS IntelliMouse (serial, PS/2):
+
+This mouse has been supported since XFree86 3.3. However, my patch
+will slightly change its behavior. The wheel movement is recognized
+as the Z axis motion. This behavior is not compatible with XFree86
+3.3, but is more consistent with the support for other mice with
+wheels or rollers. If you want to make the wheel behave like before,
+you can use the new option `ZAxisMapping'.
+
+IntelliMouse supports the PnP COM device specification.
+
+To use this mouse as a serial device:
+ Protocol "Auto" or "IntelliMouse"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use this mouse as the PS/2 device:
+ Protocol "IMPS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.2 Kensington Thinking Mouse (serial, PS/2):
+
+This mouse has four buttons.
+
+ThinkingMouse supports the PnP COM device specification.
+
+To use this mouse as a serial device:
+ Protocol "Auto" or "ThinkingMouse"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use this mouse as a PS/2 device;
+ Protocol "ThinkingMousePS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.3 Genius NetScroll (PS/2):
+
+This mouse has four buttons and a roller. The roller movement is
+recognized as the Z axis motion.
+
+To use this mouse as a PS/2 device;
+ Protocol "NetScrollPS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.4 Genius NetMouse and NetMouse Pro (serial, PS/2):
+
+These mice have a "magic button" which is used like a wheel or a
+roller. The "magic button" action is recognized as the Z axis motion.
+NetMouse Pro is identical to NetMouse except that it has the third
+button on the left hand side.
+
+NetMouse and NetMouse Pro support the PnP COM device specification.
+When used as a serial mouse, they are compatible with MS IntelliMouse.
+
+To use these mice as a serial device:
+ Protocol "Auto" or "IntelliMouse"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use these mice as the PS/2 device:
+ Protocol "NetMousePS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.5 ALPS GlidePoint (serial, PS/2):
+
+The serial version of this mouse(pad) has been supported since XFree86
+3.2. `Tapping' action is interpreted as the fourth button press.
+(IMHO, the fourth button of GlidePoint should be mapped to the first
+button in order to make this pad behave like the other pad products.)
+
+To use this pad as a serial device:
+ Protocol "GlidePoint"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use this mouse as the PS/2 device:
+ Protocol "GlidePointPS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.6 ASCII MieMouse (serial, PS/2):
+
+This mouse appears to be OEMed from Genius. Although its shape is
+quite different, it works like Genius NetMouse Pro. This mouse has a
+"knob" which is used like a wheel or a roller. The "knob" action is
+recognized as the Z axis motion.
+
+MieMouse supports the PnP COM device specification. When used as a
+serial mouse, it is compatible with MS IntelliMouse.
+
+To use this mouse as a serial device:
+ Protocol "Auto" or "IntelliMouse"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use this mouse as the PS/2 device:
+ Protocol "NetMousePS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+2.7 Logitech MouseMan+ and FirstMouse+ (serial, PS/2):
+
+MouseMan+ has two buttons on top, one side button and a roller.
+FirstMouse+ has two buttons and a roller. The roller movement is
+recognized as the Z axis motion. The roller also acts as the third
+button. The side button is recognized as the fourth button.
+
+MouseMan+ and FirstMouse+ support the PnP COM device specification.
+They have MS IntelliMouse compatible mode when used as a serial mouse.
+
+To use these mice as a serial device:
+ Protocol "Auto" or "IntelliMouse"
+ Device "/dev/xxxx" (where xxxx is a serial port)
+To use these mice as the PS/2 device:
+ Protocol "MouseManPlusPS/2"
+ Device "/dev/xxxx" (where xxxx is the PS/2 mouse device)
+As the PS/2 device in FreeBSD 2.2.5 or earlier:
+ Protocol "PS/2"
+ Device "/dev/psm0"
+As the PS/2 device in FreeBSD 2.2.6 or later:
+ Protocol "Auto", "SysMouse" or "PS/2"
+ Device "/dev/psm0"
+
+3. TODO ---------------------------------------------------------------
+
+a) xf86 Misc Extention
+ProcXF86MiscGetMouseSettings() and ProcXF86MiscSetMouseSettings()
+should handle newly added protocol types. Expand the struct
+XF86MiscGetMouseSettings to accomodate the device resolution value and
+ZAxisMapping settings?
+
+b) Integration with XInput
+Wheel/roller movement should be processed as the third valuator.
+Currently the core pointer and the extended mouse device code in
+XInput always assume there are only two valuators.
+
+c) XF86Setup, xmseconfig
+Update lib/X11/XF86Setup/mouse.tcl, lib/X11/XF86Setup/scripts/mseconfig.tcl.
+
+4. Comments on the patch ---------------------------------------------
+
+xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h
+
+- Include `machine/mouse.h' for FreeBSD.
+
+xc/programs/Xserver/hw/xfree86/common/xf86.h
+
+- Added `mseModel', `negativeZ', `positiveZ' and `resolution' to
+ MouseDevRec.
+- Added prototype for xf86GetPnPMouseProtocol().
+
+xc/programs/Xserver/hw/xfree86/common/xf86_Config.h
+
+- Defined constants and strings for new options and newly supported mice.
+
+xc/programs/Xserver/hw/xfree86/common/xf86Config.c
+
+- Initialize `mseModel', `negativeZ', `positiveZ' and `resolution'
+ at the start of configPointerSection().
+- Recognize new keywords.
+
+xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c
+
+- Added support for the following PS/2 type mice:
+ ALPS GlidePoint, MS IntelliMouse, Kensington ThinkingMouse,
+ Genius NetScroll, Genius NetMouse, NetMouse Pro, ASCII
+ Mie Mouse, Logitech MouseMan+, FirstMouse+
+- Added support for the following SERIAL mice:
+ Kensington ThinkingMouse
+ (Genius NetMouse, NetMouse Pro, ASCII MieMouse, Logitech MouseMan+
+ and FirstMouse+ are compatible with MS IntelliMouse, when connected
+ to a serial port, thus requires no explicit support)
+- MS IntelliMouse support code is modified so that the wheel
+ movement is recognized as the Z axis motion.
+- Added support for `Auto' to invoke PnP COM device detection code.
+- Added support for `SysMouse' protocol for FreeBSD.
+- Optionally map the Z axis movement to another axis or button events
+ based on `negativeZ' and `positiveZ' settings.
+- Reorganized xf86SetupMouse().
+
+xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c
+
+- PnP COM device support. The bulk of the code is taken from the mouse
+ daemon code in FreeBSD.
+
+xc/programs/Xserver/hw/xfree86/common/xf86Events.c
+
+- Support up to 12 buttons.
+
+xc/programs/Xserver/hw/xfree86/common/xf86Io.c
+
+- Make xf86MseProcAux() support up to 12 buttons.
+
+xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
+
+- Make xf86CheckButton() recognize up to 12 buttons.
+
+
+----------------------------------------------------------- end of file
diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h
new file mode 100644
index 000000000..745481e85
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h
@@ -0,0 +1,311 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.11 1999/04/29 05:12:54 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */
+
+#ifndef _ATKEYNAMES_H
+#define _ATKEYNAMES_H
+
+#define XK_TECHNICAL
+#define XK_KATAKANA
+#include "keysym.h"
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 127
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+#define AltMask Mod1Mask
+#define NumLockMask Mod2Mask
+#define AltLangMask Mod3Mask
+#define KanaMask Mod4Mask
+#define ScrollLockMask Mod5Mask
+
+#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
+#define ModifierDown(k) ((keyc->state & (k)) == (k))
+
+#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
+
+/*
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
+ * Bit 7 ist set if the key is released. The code E0 switches to a
+ * different meaning to add the new MF cursorkeys, while not breaking old
+ * applications. E1 is another special prefix. Since I assume that there
+ * will be further versions of PC/XT scancode compatible keyboards, we
+ * may be in trouble one day.
+ *
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
+ * 2) Use the keyboards native set and translate it to common keysyms.
+ */
+
+/*
+ * definition of the AT84/MF101/MF102 Keyboard:
+ * ============================================================
+ * Defined Key Cap Glyphs Pressed value
+ * Key Name Main Also (hex) (dec)
+ * ---------------- ---------- ------- ------ ------
+ */
+
+#ifndef PC98
+
+#define KEY_Escape /* Escape 0x01 */ 1
+#define KEY_1 /* 1 ! 0x02 */ 2
+#define KEY_2 /* 2 @ 0x03 */ 3
+#define KEY_3 /* 3 # 0x04 */ 4
+#define KEY_4 /* 4 $ 0x05 */ 5
+#define KEY_5 /* 5 % 0x06 */ 6
+#define KEY_6 /* 6 ^ 0x07 */ 7
+#define KEY_7 /* 7 & 0x08 */ 8
+#define KEY_8 /* 8 * 0x09 */ 9
+#define KEY_9 /* 9 ( 0x0a */ 10
+#define KEY_0 /* 0 ) 0x0b */ 11
+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
+#define KEY_Equal /* = (Equal) + 0x0d */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_LBrace /* [ { 0x1a */ 26
+#define KEY_RBrace /* ] } 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_A /* A 0x1e */ 30
+#define KEY_S /* S 0x1f */ 31
+#define KEY_D /* D 0x20 */ 32
+#define KEY_F /* F 0x21 */ 33
+#define KEY_G /* G 0x22 */ 34
+#define KEY_H /* H 0x23 */ 35
+#define KEY_J /* J 0x24 */ 36
+#define KEY_K /* K 0x25 */ 37
+#define KEY_L /* L 0x26 */ 38
+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
+#define KEY_Z /* Z 0x2c */ 44
+#define KEY_X /* X 0x2d */ 45
+#define KEY_C /* C 0x2e */ 46
+#define KEY_V /* V 0x2f */ 47
+#define KEY_B /* B 0x30 */ 48
+#define KEY_N /* N 0x31 */ 49
+#define KEY_M /* M 0x32 */ 50
+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_Space /* (SpaceBar) 0x39 */ 57
+#define KEY_CapsLock /* CapsLock 0x3a */ 58
+#define KEY_F1 /* F1 0x3b */ 59
+#define KEY_F2 /* F2 0x3c */ 60
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_F8 /* F8 0x42 */ 66
+#define KEY_F9 /* F9 0x43 */ 67
+#define KEY_F10 /* F10 0x44 */ 68
+#define KEY_NumLock /* NumLock 0x45 */ 69
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_SysReqest /* SysReqest 0x54 */ 84
+ /* NOTUSED 0x55 */
+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
+#define KEY_F11 /* F11 0x57 */ 87
+#define KEY_F12 /* F12 0x58 */ 88
+
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* specail 0x61 */ 97
+
+/*
+ * The 'scancodes' below are generated by the server, because the MF101/102
+ * keyboard sends them as sequence of other scancodes
+ */
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+
+#else
+
+#define KEY_Escape /* Escape 0x01 */ 0
+#define KEY_1 /* 1 ! 0x02 */ 1
+#define KEY_2 /* 2 " 0x03 */ 2
+#define KEY_3 /* 3 # 0x04 */ 3
+#define KEY_4 /* 4 $ 0x05 */ 4
+#define KEY_5 /* 5 % 0x06 */ 5
+#define KEY_6 /* 6 & 0x07 */ 6
+#define KEY_7 /* 7 ' 0x08 */ 7
+#define KEY_8 /* 8 ( 0x09 */ 8
+#define KEY_9 /* 9 ) 0x0a */ 9
+#define KEY_0 /* 0 0x0b */ 10
+#define KEY_Minus /* - (Minus) = (Equal) 0x0c */ 11
+#define KEY_Hat /* ^ (Hat) ` 0x0d */ 12
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_At /* @ ~ 0x1a */ 26
+#define KEY_LBrace /* [ { 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_A /* A 0x1d */ 29
+#define KEY_S /* S 0x1e */ 30
+#define KEY_D /* D 0x1f */ 31
+#define KEY_F /* F 0x20 */ 32
+#define KEY_G /* G 0x21 */ 33
+#define KEY_H /* H 0x22 */ 34
+#define KEY_J /* J 0x23 */ 35
+#define KEY_K /* K 0x24 */ 36
+#define KEY_L /* L 0x25 */ 37
+#define KEY_SemiColon /* ;(SemiColon) +(Plus) 0x26 */ 38
+#define KEY_Colon /* :(Colon) *(Quote) 0x27 */ 39
+#define KEY_RBrace /* ] } 0x28 */ 40
+#define KEY_Z /* Z 0x29 */ 41
+#define KEY_X /* X 0x2a */ 42
+#define KEY_C /* C 0x2b */ 43
+#define KEY_V /* V 0x2c */ 44
+#define KEY_B /* B 0x2d */ 45
+#define KEY_N /* N 0x2e */ 46
+#define KEY_M /* M 0x2f */ 47
+#define KEY_Comma /* , (Comma) < (Less) 0x30 */ 48
+#define KEY_Period /* . (Period) >(Greater)0x31 */ 49
+#define KEY_Slash /* / (Slash) ? 0x32 */ 50
+#define KEY_Under /* _ 0x33 */ 51
+#define KEY_Space /* (SpaceBar) 0x34 */ 52
+#define KEY_Xfer /* (XFER) 0x35 */ 53
+#define KEY_PgUp /* PgUp 0x36 */ 54
+#define KEY_Pgdown /* (Roll Down) 0x37 */ 55
+#define KEY_Insert /* Insert 0x38 */ 56
+#define KEY_Delete /* Delete 0x39 */ 57
+#define KEY_Up /* Up 0x3a */ 58
+#define KEY_Left /* Left 0x3b */ 59
+#define KEY_Right /* Right 0x3c */ 60
+#define KEY_Down /* Down 0x3d */ 61
+#define KEY_Home /* Home 0x3e */ 62
+#define KEY_Help /* Help 0x3f */ 63
+#define KEY_KP_Subtract /* - (Minus) 0x40 */ 64
+#define KEY_KP_Minus /* - */ 64
+#define KEY_KP_Divide /* / (Slash) 0x41 */ 65
+#define KEY_KP_7 /* 7 0x42 */ 66
+#define KEY_KP_8 /* 8 0x43 */ 67
+#define KEY_KP_9 /* 9 0x44 */ 68
+#define KEY_KP_Multiply /* * 0x45 */ 69
+#define KEY_KP_4 /* 4 0x46 */ 70
+#define KEY_KP_5 /* 5 0x47 */ 71
+#define KEY_KP_6 /* 6 0x48 */ 72
+#define KEY_KP_Add /* + (Plus) 0x49 */ 73
+#define KEY_KP_Plus /* + */ 73
+#define KEY_KP_1 /* 1 0x4a */ 74
+#define KEY_KP_2 /* 2 0x4b */ 75
+#define KEY_KP_3 /* 3 0x4c */ 76
+#define KEY_KP_Equal /* = 0x4d */ 77
+#define KEY_KP_0 /* 0 0x4e */ 78
+#define KEY_KP_Separator /* , 0x4f */ 79
+#define KEY_KP_Decimal /* . (Decimal) 0x50 */ 80
+#define KEY_Nfer /* (NFER) 0x51 */ 81
+#define KEY_F11 /* F11 0x52 */ 82
+#define KEY_F12 /* F12 0x53 */ 83
+#define KEY_F13 /* F13 0x54 */ 84
+#define KEY_F14 /* F14 0x55 */ 85
+#define KEY_F15 /* F15 0x56 */ 86
+#define KEY_Break /* (Stop) 0x60 */ 96
+#define KEY_Copy /* (Copy) 0x61 */ 97
+#define KEY_Begin /* Begin ?? */ 97
+#define KEY_F1 /* F1 0x62 */ 98
+#define KEY_F2 /* F2 0x63 */ 99
+#define KEY_F3 /* F3 0x64 */ 100
+#define KEY_F4 /* F4 0x65 */ 101
+#define KEY_F5 /* F5 0x66 */ 102
+#define KEY_F6 /* F6 0x67 */ 103
+#define KEY_F7 /* F7 0x68 */ 104
+#define KEY_F8 /* F8 0x69 */ 105
+#define KEY_F9 /* F9 0x6a */ 106
+#define KEY_F10 /* F10 0x6b */ 107
+#define KEY_ShiftL /* Shift(left) 0x70 */ 112
+#define KEY_CapsLock /* CapsLock 0x71 */ 113
+#define KEY_KanaLock /* Kana 0x72 */ 114
+#define KEY_Alt /* Alt(left) 0x73 */ 115
+#define KEY_LCtrl /* Ctrl(left) 0x74 */ 116
+
+#endif /* PC98 */
+
+#endif /* _ATKEYNAMES_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h
new file mode 100644
index 000000000..61c487d68
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h
@@ -0,0 +1,1520 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.43 1999/06/14 12:02:08 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */
+
+#ifndef _COMPILER_H
+#define _COMPILER_H
+
+#ifndef __STDC__
+# ifdef signed
+# undef signed
+# endif
+# ifdef volatile
+# undef volatile
+# endif
+# ifdef const
+# undef const
+# endif
+# define signed /**/
+# ifdef __GNUC__
+# define volatile __volatile__
+# define const __const__
+# ifdef PC98
+# undef NO_INLINE
+# endif
+# else
+# define const /**/
+# ifdef PC98
+# define __inline__ /**/
+# endif
+# ifdef __HIGHC__
+# define __inline__ _Inline
+# endif
+# endif /* __GNUC__ */
+#endif /* !__STDC__ */
+
+#if defined(IODEBUG) && defined(__GNUC__)
+#define outb RealOutb
+#define outw RealOutw
+#define outl RealOutl
+#define inb RealInb
+#define inw RealInw
+#define inl RealInl
+#endif
+
+#if defined(NO_INLINE) || defined(DO_PROTOTYPES)
+
+#if !defined(__sparc__)
+
+extern void outb(unsigned short, unsigned char);
+extern void outw(unsigned short, unsigned short);
+extern void outl(unsigned short, unsigned int);
+extern unsigned int inb(unsigned short);
+extern unsigned int inw(unsigned short);
+extern unsigned int inl(unsigned short);
+
+#else /* __sparc__ */
+
+extern void outb(unsigned long, unsigned char);
+extern void outw(unsigned long, unsigned short);
+extern void outl(unsigned long, unsigned int);
+extern unsigned int inb(unsigned long);
+extern unsigned int inw(unsigned long);
+extern unsigned int inl(unsigned long);
+
+#endif /* __sparc__ */
+
+extern unsigned long ldq_u(unsigned long *);
+extern unsigned long ldl_u(unsigned int *);
+extern unsigned long ldw_u(unsigned short *);
+extern void stq_u(unsigned long, unsigned long *);
+extern void stl_u(unsigned long, unsigned int *);
+extern void stw_u(unsigned long, unsigned short *);
+extern void mem_barrier(void);
+extern void write_mem_barrier(void);
+extern void stl_brx(unsigned long, volatile unsigned char *, int);
+extern void stw_brx(unsigned short, volatile unsigned char *, int);
+extern unsigned long ldl_brx(volatile unsigned char *, int);
+extern unsigned short ldw_brx(volatile unsigned char *, int);
+extern unsigned char rdinx(unsigned short, unsigned char);
+extern void wrinx(unsigned short, unsigned char, unsigned char);
+extern void modinx(unsigned short, unsigned char, unsigned char, unsigned char);
+extern int testrg(unsigned short, unsigned char);
+extern int testinx2(unsigned short, unsigned char, unsigned char);
+extern int testinx(unsigned short, unsigned char);
+
+#endif
+
+#ifndef NO_INLINE
+
+#ifdef __GNUC__
+
+#if defined(linux) && defined(__alpha__)
+/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
+/* note that the appropriate setup via "ioperm" needs to be done */
+/* *before* any inx/outx is done. */
+
+extern void _outb(char val, unsigned short port);
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ _outb(val, port);
+}
+
+extern void _outw(short val, unsigned short port);
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ _outw(val, port);
+}
+
+extern void _outl(int val, unsigned short port);
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ _outl(val, port);
+}
+
+extern unsigned int _inb(unsigned short port);
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ return _inb(port);
+}
+
+extern unsigned int _inw(unsigned short port);
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ return _inw(port);
+}
+
+extern unsigned int _inl(unsigned short port);
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ return _inl(port);
+}
+
+
+/*
+ * inline functions to do unaligned accesses
+ * from linux/include/asm-alpha/unaligned.h
+ */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+/*
+ * Elemental unaligned loads
+ */
+/* let's try making these things static */
+
+static __inline__ unsigned long ldq_u(unsigned long * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extql %0,%2,%0\n\t"
+ "extqh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(7+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+static __inline__ unsigned long ldl_u(unsigned int * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extll %0,%2,%0\n\t"
+ "extlh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(3+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+static __inline__ unsigned long ldw_u(unsigned short * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extwl %0,%2,%0\n\t"
+ "extwh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(1+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+/*
+ * Elemental unaligned stores
+ */
+
+static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "insqh %6,%7,%5\n\t"
+ "insql %6,%7,%4\n\t"
+ "mskqh %3,%7,%3\n\t"
+ "mskql %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(7+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inslh %6,%7,%5\n\t"
+ "insll %6,%7,%4\n\t"
+ "msklh %3,%7,%3\n\t"
+ "mskll %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(3+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
+{
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inswh %6,%7,%5\n\t"
+ "inswl %6,%7,%4\n\t"
+ "mskwh %3,%7,%3\n\t"
+ "mskwl %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(1+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+#define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
+#ifdef __ELF__
+#define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory")
+#else /* ECOFF gas 2.6 doesn't know "wmb" :-( */
+#define write_mem_barrier() mem_barrier()
+#endif
+
+#elif (defined(linux) || defined(Lynx)) && defined(__sparc__)
+
+#if !defined(Lynx)
+#ifndef ASI_PL
+#define ASI_PL 0x88
+#endif
+
+static __inline__ void outb(unsigned long port, unsigned char val)
+{
+ __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ void outw(unsigned long port, unsigned short val)
+{
+ __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ void outl(unsigned long port, unsigned int val)
+{
+ __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
+}
+
+static __inline__ unsigned int inb(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int inw(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int inl(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+#endif /* !Lynx */
+
+#include <string.h>
+
+static __inline__ unsigned long ldq_u(unsigned long *p)
+{
+ unsigned long ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ unsigned long ldl_u(unsigned int *p)
+{
+ unsigned int ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ unsigned long ldw_u(unsigned short *p)
+{
+ unsigned short ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ void stq_u(unsigned long val, unsigned long *p)
+{
+ unsigned long tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+ unsigned int tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stw_u(unsigned long val, unsigned short *p)
+{
+ unsigned short tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+#define mem_barrier() /* XXX: nop for now */
+#define write_mem_barrier() /* XXX: nop for now */
+
+#elif defined(__mips__) || defined(__arm32__)
+
+unsigned int IOPortBase; /* Memory mapped I/O port area */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val;
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase));
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase));
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase));
+}
+
+
+#if defined(__mips__)
+static __inline__ unsigned long ldq_u(unsigned long * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(3+(char *) r11)));
+ return r1;
+}
+
+static __inline__ unsigned long ldl_u(unsigned int * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(3+(char *) r11)));
+ return r1;
+}
+
+static __inline__ unsigned long ldw_u(unsigned short * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(1+(char *) r11)));
+ return r1;
+}
+
+#define stq_u(v,p) stl_u(v,p)
+#define stl_u(v,p) ((unsigned char *)(p)) = (v); \
+ ((unsigned char *)(p)+1) = ((v) >> 8); \
+ ((unsigned char *)(p)+2) = ((v) >> 16); \
+ ((unsigned char *)(p)+3) = ((v) >> 24)
+
+#define stw_u(v,p) ((unsigned char *)(p)) = (v); \
+ ((unsigned char *)(p)+1) = ((v) >> 8)
+
+#define mem_barrier() /* NOP */
+#endif /* __mips__ */
+
+#if defined(__arm32__)
+#define ldq_u(p) (*((unsigned long *)(p)))
+#define ldl_u(p) (*((unsigned int *)(p)))
+#define ldw_u(p) (*((unsigned short *)(p)))
+#define stq_u(v,p) ((unsigned long *)(p)) = (v)
+#define stl_u(v,p) ((unsigned int *)(p)) = (v)
+#define stw_u(v,p) ((unsigned short *)(p)) = (v)
+#define mem_barrier() /* NOP */
+#define write_mem_barrier() /* NOP */
+#endif /* __arm32__ */
+
+#elif (defined(Lynx) || defined(linux)) && defined(__powerpc__)
+
+extern volatile unsigned char *ioBase;
+
+#define eieio() __asm__ __volatile__ ("eieio")
+
+static __inline__ void
+outb(unsigned short port, unsigned char value)
+{
+ *((volatile unsigned char *)(ioBase + port)) = value; eieio();
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short value)
+{
+ __asm__ __volatile__ (
+ "sthbrx %0,%1,%2\n\t"
+ "eieio"
+ :
+ : "r" (value), "r" (ioBase), "r" (port)
+ : "memory"
+ );
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int value)
+{
+ __asm__ __volatile__ (
+ "stwbrx %0,%1,%2\n\t"
+ "eieio"
+ :
+ : "r" (value), "r" (ioBase), "r" (port)
+ : "memory"
+ );
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char val;
+
+ val = *((volatile unsigned char *)(ioBase + port));
+ eieio();
+ return(val);
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ register unsigned short val;
+
+ __asm__ ("lhbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "r" (ioBase), "r" (port)
+ );
+ return(val);
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ register unsigned long val;
+
+ __asm__ ("lwbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "r" (ioBase), "r" (port)
+ );
+ return(val);
+}
+
+#define ldq_u(p) ldl_u(p)
+#define ldl_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8) | \
+ (*((unsigned char *)(p)+2)<<16) | \
+ (*((unsigned char *)(p)+3)<<24))
+#define ldw_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8))
+
+#define stq_u(v,p) stl_u(v,p)
+#define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8); \
+ (*((unsigned char *)(p)+2)) = ((v) >> 16); \
+ (*((unsigned char *)(p)+3)) = ((v) >> 24)
+#define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8)
+
+#define mem_barrier() eieio()
+#define write_mem_barrier() eieio()
+
+#else /* ix86 */
+
+#define ldq_u(p) (*((unsigned long *)(p)))
+#define ldl_u(p) (*((unsigned int *)(p)))
+#define ldw_u(p) (*((unsigned short *)(p)))
+#define stq_u(v,p) ((unsigned long *)(p)) = (v)
+#define stl_u(v,p) ((unsigned int *)(p)) = (v)
+#define stw_u(v,p) ((unsigned short *)(p)) = (v)
+#define mem_barrier() /* NOP */
+#define write_mem_barrier() /* NOP */
+
+#if !defined(FAKEIT) && !defined(__mc68000__)
+#ifdef GCCUSESGAS
+
+/*
+ * If gcc uses gas rather than the native assembler, the syntax of these
+ * inlines has to be different. DHD
+ */
+#ifndef PC98
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+#else /* PC98 */
+
+static __inline__ void
+_outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("outb %0,%1" ::"a" (val), "d" (port));
+}
+
+static __inline__ void
+_outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("outw %0,%1" ::"a" (val), "d" (port));
+}
+
+static __inline__ void
+_outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+
+static __inline__ unsigned int
+_inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+_inw(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+_inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+
+#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968)
+#define PW_PORT 0x600
+extern short chipID;
+extern void *mmioBase;
+extern unsigned short _port_tbl[];
+#define port_convert(x) _port_tbl[(unsigned short)x]
+#endif
+
+#if defined(PC98_WAB) || defined(PC98_GANB_WAP)
+static __inline__ unsigned short
+port_convert(unsigned short port)
+{
+ port <<= 8;
+ port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
+ port |= 0xE0;
+ return port;
+}
+#endif /* PC98_WAB || PC98_GANB_WAP */
+
+#if defined(PC98_WABEP)
+static __inline__ unsigned short
+port_convert(unsigned short port)
+{
+ port &= 0x7f; /* Mask 0000 0000 0111 1111 */
+ port |= 0x0f00;
+ return port;
+}
+#endif /* PC98_WABEP */
+
+#ifdef PC98_WSNA
+static __inline__ unsigned short
+port_convert(unsigned short port)
+{
+ port <<= 8;
+ port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
+ port |= 0xE2;
+ return port;
+}
+#endif /* PC98_WSNA */
+
+#ifdef PC98_NKVNEC
+#ifdef PC98_NEC_CIRRUS2
+static __inline__ unsigned short
+port_convert(unsigned short port)
+{
+ port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050;
+ return port;
+}
+#else
+static __inline__ unsigned short
+port_convert(unsigned short port)
+{
+ port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0;
+ return port;
+}
+#endif /* PC98_NEC_CIRRUS2 */
+#endif /* PC98_NKVNEC */
+
+#if defined(PC98_TGUI)
+extern void *mmioBase;
+#endif
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val);
+#else
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+#endif
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val);
+#else
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+#endif
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val);
+#else
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+#endif
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ ret =*(volatile unsigned char *)((char *)mmioBase+(port));
+#else
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+#endif
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ ret =*(volatile unsigned short *)((char *)mmioBase+(port));
+#else
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+#endif
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)
+ ret =*(volatile unsigned int *)((char *)mmioBase+(port));
+#else
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+#endif
+ return ret;
+}
+
+#endif /* PC98 */
+
+#else /* GCCUSESGAS */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("in%B0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("in%W0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("in%L0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+#endif /* GCCUSESGAS */
+
+#else /* !defined(FAKEIT) && !defined(__mc68000__) */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ return 0;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ return 0;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ return 0;
+}
+
+#endif /* FAKEIT */
+
+#endif /* ix86 */
+
+#elif defined(__powerpc__) /* && !__GNUC__ */
+/*
+ * NON-GCC PowerPC - Presumed to be PowerMAX OS for now
+ */
+# ifndef PowerMAX_OS
+# error - Non-gcc PowerPC and !PowerMAXOS ???
+# endif
+
+#define PPCIO_DEBUG 0
+#define PPCIO_INLINE 1
+#define USE_ABS_MACRO 1
+/*
+ * Use compiler intrinsics to access certain PPC machine instructions
+ */
+#define eieio() __inst_eieio()
+#define stw_brx(val,base,ndx) __inst_sthbrx(val,base,ndx)
+#define stl_brx(val,base,ndx) __inst_stwbrx(val,base,ndx)
+#define ldw_brx(base,ndx) __inst_lhbrx(base,ndx)
+#define ldl_brx(base,ndx) __inst_lwbrx(base,ndx)
+
+#define ldq_u(p) (*((unsigned long long *)(p)))
+#define ldl_u(p) (*((unsigned long *)(p)))
+#define ldw_u(p) (*((unsigned short *)(p)))
+#define stq_u(v,p) ((unsigned long long *)(p)) = (v)
+#define stl_u(v,p) ((unsigned long *)(p)) = (v)
+#define stw_u(v,p) ((unsigned short *)(p)) = (v)
+#define mem_barrier() eieio()
+#define write_mem_barrier() eieio()
+
+extern volatile unsigned char *ioBase;
+
+#if !defined(abs) && defined(USE_ABS_MACRO)
+#define abs(x) ((x) >= 0 ? (x) : -(x))
+#endif
+
+#undef inb
+#undef inw
+#undef inl
+#undef outb
+#undef outw
+#undef outl
+
+#if PPCIO_DEBUG
+
+extern void debug_outb(unsigned int a, unsigned char b, int line, char *file);
+extern void debug_outw(unsigned int a, unsigned short w, int line, char *file);
+extern void debug_outl(unsigned int a, unsigned long l, int line, char *file);
+extern unsigned char debug_inb(unsigned int a, int line, char *file);
+extern unsigned short debug_inw(unsigned int a, int line, char *file);
+extern unsigned long debug_inl(unsigned int a, int line, char *file);
+
+#define outb(a,b) debug_outb(a,b, __LINE__, __FILE__)
+#define outw(a,w) debug_outw(a,w, __LINE__, __FILE__)
+#define outl(a,l) debug_outl(a,l, __LINE__, __FILE__)
+#define inb(a) debug_inb(a, __LINE__, __FILE__)
+#define inw(a) debug_inw(a, __LINE__, __FILE__)
+#define inl(a) debug_inl(a, __LINE__, __FILE__)
+
+#else /* !PPCIO_DEBUG */
+
+extern unsigned char inb(unsigned int a);
+extern unsigned short inw(unsigned int a);
+extern unsigned long inl(unsigned int a);
+
+# if PPCIO_INLINE
+
+#define outb(a,b) (*((volatile unsigned char *)(ioBase + (a))) = (b), eieio())
+#define outw(a,w) (stw_brx((w),ioBase,(a)), eieio())
+#define outl(a,l) (stl_brx((l),ioBase,(a)), eieio())
+
+# else /* !PPCIO_INLINE */
+
+extern void outb(unsigned int a, unsigned char b);
+extern void outw(unsigned int a, unsigned char w);
+extern void outl(unsigned int a, unsigned char l);
+
+# endif /* PPCIO_INLINE */
+
+#endif /* !PPCIO_DEBUG */
+
+#else /* !GNUC && !PPC */
+#if !defined(AMOEBA) && !defined(MINIX)
+# if defined(__STDC__) && (__STDC__ == 1)
+# ifndef asm
+# define asm __asm
+# endif
+# endif
+# ifdef SVR4
+#if 0
+# include <sys/types.h>
+#endif
+# ifndef __HIGHC__
+# ifndef __USLC__
+# define __USLC__
+# endif
+# endif
+# endif
+# ifndef PC98
+# ifndef SCO325
+# include <sys/inline.h>
+# else
+# include "scoasm.h"
+# endif
+# else
+#if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968)
+#define PW_PORT 0x600
+extern short chipID;
+extern void *mmioBase;
+extern unsigned short _port_tbl[];
+#define port_convert(x) _port_tbl[(unsigned short)x]
+#endif
+
+asm void _outl(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+}
+
+asm void _outw(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ data16
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movw val, %ax
+ data16
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ data16
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movw val, %ax
+ data16
+ outl (%dx)
+}
+
+asm void _outb(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outb (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movb val, %al
+ outb (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outb (%dx)
+%mem port,val;
+ movw port, %dx
+ movb val, %al
+ outb (%dx)
+}
+
+asm int _inl(port)
+{
+%reg port;
+ movl port, %edx
+ inl (%dx)
+%mem port;
+ movw port, %dx
+ inl (%dx)
+}
+
+asm int _inw(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ data16
+ inl (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ data16
+ inl (%dx)
+}
+
+asm int _inb(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ inb (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ inb (%dx)
+}
+
+#if defined(PC98_WAB) || defined(PC98_GANB_WAP)
+static unsigned short
+port_convert(unsigned short port)
+{
+ port <<= 8;
+ port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
+ port |= 0xE0;
+ return port;
+}
+#endif /* PC98_WAB || PC98_GANB_WAP */
+
+#if defined(PC98_WABEP)
+static unsigned short
+port_convert(unsigned short port)
+{
+ port &= 0x7f; /* Mask 0000 0000 0111 1111 */
+ port |= 0x0f00;
+ return port;
+}
+#endif /* PC98_WABEP */
+
+#ifdef PC98_WSNA
+static unsigned short
+port_convert(unsigned short port)
+{
+ port <<= 8;
+ port &= 0x7f00; /* Mask 0111 1111 0000 0000 */
+ port |= 0xE2;
+ return port;
+}
+#endif /* PC98_WSNA */
+
+#ifdef PC98_NKVNEC
+#ifdef PC98_NEC_CIRRUS2
+static unsigned short
+port_convert(unsigned short port)
+{
+ port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050;
+ return port;
+}
+#else
+static unsigned short
+port_convert(unsigned short port)
+{
+ port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0;
+ return port;
+}
+#endif /* PC98_NEC_CIRRUS2 */
+#endif /* PC98_NKVNEC */
+
+static void outl(port,val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val);
+#else
+ _outl(port,val);
+#endif
+}
+
+static void outw(port,val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val);
+#else
+ _outw(port,val);
+#endif
+}
+
+static void outb(port,val)
+{
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val);
+#else
+ _outb(port,val);
+#endif
+}
+
+static int inl(port)
+{
+ unsigned int ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ ret =*(volatile unsigned int *)((char *)mmioBase+(port));
+#else
+ ret = _inl(port);
+#endif
+ return ret;
+}
+
+static int inw(port)
+{
+ unsigned short ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ ret =*(volatile unsigned short *)((char *)mmioBase+(port));
+#else
+ ret = _inw(port);
+#endif
+ return ret;
+}
+
+static int inb(port)
+{
+ unsigned char ret;
+
+#if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \
+ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \
+ defined(PC98_XKB) || defined(PC98_NEC)
+ unsigned short tmp;
+ tmp=port_convert(port);
+ port=tmp;
+#endif
+
+#if defined(PC98_NEC)||defined(PC98_PWLB)
+ ret =*(volatile unsigned char *)((char *)mmioBase+(port));
+#else
+ ret = _inb(port);
+#endif
+ return ret;
+}
+
+
+# endif /* PC98 */
+# if !defined(__HIGHC__) && !defined(SCO325)
+# pragma asm partial_optimization outl
+# pragma asm partial_optimization outw
+# pragma asm partial_optimization outb
+# pragma asm partial_optimization inl
+# pragma asm partial_optimization inw
+# pragma asm partial_optimization inb
+# endif
+#endif
+#define ldq_u(p) (*((unsigned long *)(p)))
+#define ldl_u(p) (*((unsigned int *)(p)))
+#define ldw_u(p) (*((unsigned short *)(p)))
+#define stq_u(v,p) ((unsigned long *)(p)) = (v)
+#define stl_u(v,p) ((unsigned int *)(p)) = (v)
+#define stw_u(v,p) ((unsigned short *)(p)) = (v)
+#define mem_barrier() /* NOP */
+#define write_mem_barrier() /* NOP */
+#endif /* __GNUC__ */
+
+#if defined(IODEBUG) && defined(__GNUC__)
+#undef inb
+#undef inw
+#undef inl
+#undef outb
+#undef outw
+#undef outl
+#define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+#define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+#define inl(a) __extension__ ({unsigned long __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+
+#define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b))
+#define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b))
+#define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b))
+#endif
+
+/*
+ * This header sometimes gets included where is isn't needed, and on some
+ * OSs this causes problems because the following functions generate
+ * references to inb() and outb() which can't be resolved. Defining
+ * NO_COMPILER_H_EXTRAS avoids this problem.
+ */
+
+#ifndef NO_COMPILER_H_EXTRAS
+/*
+ *-----------------------------------------------------------------------
+ * Port manipulation convenience functions
+ *-----------------------------------------------------------------------
+ */
+
+#ifndef __GNUC__
+#ifdef __HIGHC__
+#define __inline__ _Inline
+#else
+#define __inline__ /**/
+#endif
+#endif
+
+/*
+ * rdinx - read the indexed byte port 'port', index 'ind', and return its value
+ */
+static __inline__ unsigned char
+rdinx(unsigned short port, unsigned char ind)
+{
+ if (port == 0x3C0) /* reset attribute flip-flop */
+ (void) inb(0x3DA);
+ outb(port, ind);
+ return(inb(port+1));
+}
+
+/*
+ * wrinx - write 'val' to port 'port', index 'ind'
+ */
+static __inline__ void
+wrinx(unsigned short port, unsigned char ind, unsigned char val)
+{
+ outb(port, ind);
+ outb(port+1, val);
+}
+
+/*
+ * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new';
+ * the other bits are unchanged.
+ */
+static __inline__ void
+modinx(unsigned short port, unsigned char ind,
+ unsigned char mask, unsigned char new)
+{
+ unsigned char tmp;
+
+ tmp = (rdinx(port, ind) & ~mask) | (new & mask);
+ wrinx(port, ind, tmp);
+}
+
+/*
+ * tstrg - returns true iff the bits in 'mask' of register 'port' are
+ * readable & writable.
+ */
+
+static __inline__ int
+testrg(unsigned short port, unsigned char mask)
+{
+ unsigned char old, new1, new2;
+
+ old = inb(port);
+ outb(port, old & ~mask);
+ new1 = inb(port) & mask;
+ outb(port, old | mask);
+ new2 = inb(port) & mask;
+ outb(port, old);
+ return((new1 == 0) && (new2 == mask));
+}
+
+/*
+ * testinx2 - returns true iff the bits in 'mask' of register 'port', index
+ * 'ind' are readable & writable.
+ */
+static __inline__ int
+testinx2(unsigned short port, unsigned char ind, unsigned char mask)
+{
+ unsigned char old, new1, new2;
+
+ old = rdinx(port, ind);
+ wrinx(port, ind, old & ~mask);
+ new1 = rdinx(port, ind) & mask;
+ wrinx(port, ind, old | mask);
+ new2 = rdinx(port, ind) & mask;
+ wrinx(port, ind, old);
+ return((new1 == 0) && (new2 == mask));
+}
+
+/*
+ * testinx - returns true iff all bits of register 'port', index 'ind' are
+ * readable & writable.
+ */
+static __inline__ int
+testinx(unsigned short port, unsigned char ind)
+{
+ return(testinx2(port, ind, 0xFF));
+}
+#endif /* NO_COMPILER_H_EXTRAS */
+
+#endif /* NO_INLINE */
+#endif /* _COMPILER_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl b/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl
new file mode 100644
index 000000000..24c0609d7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+# automatically generate the xf86DefaultModes.c file from a normal
+# XF86Config style file of Modelines
+#
+# run as
+#
+# perl /modeline2c.pl < [modesfile] > xf86DefModes.c
+#
+# hackish perl - author Dirk Hohndel
+# Copyright 1999 by The XFree86 Project, Inc.
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.2 1999/03/29 12:55:55 dawes Exp $
+
+my %flagshash;
+$flagshash{""} = "0";
+$flagshash{"Interlace"} = "V_INTERLACE";
+$flagshash{"+hsync"} = "V_PHSYNC";
+$flagshash{"-hsync"} = "V_NHSYNC";
+$flagshash{"+vsync"} = "V_PVSYNC";
+$flagshash{"-vsync"} = "V_NVSYNC";
+
+# stop CVS from expanding the XFree86 Id here...
+
+my $proj = "XFree86";
+printf("/* \$$proj: \$ */
+
+/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
+ * modeline2c.pl */
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ *
+ * Author: Dirk Hohndel <hohndel\@XFree86.Org>
+ */
+
+#include \"xf86.h\"
+#include \"xf86Config.h\"
+#define NO_COMPILER_H_EXTRAS
+#include \"xf86Priv.h\"
+#include \"xf86_OSlib.h\"
+
+#include \"globals.h\"
+
+#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,0,0
+
+DisplayModeRec xf86DefaultModes [] = {
+");
+while (<>) {
+ if (/^\#/) {
+ s/^\#//;
+ chop;
+ print "/*" . $_ . " */\n";
+ }
+ if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/) {
+ my $name = $1;
+ my $values = $2;
+ my $flags = $3;
+ $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/;
+ printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n",
+ $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags});
+ }
+
+
+}
+printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n");
diff --git a/xc/programs/Xserver/hw/xfree86/common/scoasm.h b/xc/programs/Xserver/hw/xfree86/common/scoasm.h
new file mode 100644
index 000000000..12fe46693
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/scoasm.h
@@ -0,0 +1,112 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/scoasm.h,v 3.0 1996/10/03 08:34:06 dawes Exp $ */
+
+/*
+ * scoasm.h - used to define inline versions of certain functions which
+ * do NOT appear in sys/inline.h.
+ */
+#ifdef SCO325
+#ifndef _SCOASM_HDR_INC
+#define _SCOASM_HDR_INC
+
+asm void outl(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+}
+
+asm void outw(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ data16
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movw val, %ax
+ data16
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ data16
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movw val, %ax
+ data16
+ outl (%dx)
+}
+
+asm void outb(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outb (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movb val, %al
+ outb (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outb (%dx)
+%mem port,val;
+ movw port, %dx
+ movb val, %al
+ outb (%dx)
+}
+
+asm int inl(port)
+{
+%reg port;
+ movl port, %edx
+ inl (%dx)
+%mem port;
+ movw port, %dx
+ inl (%dx)
+}
+
+asm int inw(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ data16
+ inl (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ data16
+ inl (%dx)
+}
+
+asm int inb(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ inb (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ inb (%dx)
+}
+
+#endif /* _SCOASM_HDR_INC */
+#endif /* SCO325 */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h
new file mode 100644
index 000000000..bf818fef8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h
@@ -0,0 +1,259 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.116 1999/08/21 13:48:23 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains declarations for public XFree86 functions and variables,
+ * and definitions of public macros.
+ *
+ * "public" means available to video drivers.
+ */
+
+#ifndef _XF86_H
+#define _XF86_H
+
+#include "xf86str.h"
+#include "xf86Opt.h"
+#include <X11/Xfuncproto.h>
+#include <stdarg.h>
+
+/* General parameters */
+extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */
+extern int xf86PixmapIndex;
+extern Bool xf86ResAccessEnter;
+extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
+extern const unsigned char byte_reversed[256];
+
+#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
+
+#define XF86FLIP_PIXELS() \
+ do { \
+ if (xf86GetFlipPixels()) { \
+ pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
+ pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
+ } \
+ while (0)
+
+#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
+
+#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \
+ (((p) == Pix24Use32) ? 32 : 0))
+
+/* Function Prototypes */
+#ifndef _NO_XF86_PROTOTYPES
+
+/* xf86Bus.c */
+
+Bool xf86CheckPciSlot(int bus, int device, int func);
+int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active);
+Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
+ int *func);
+Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
+pciVideoPtr *xf86GetPciVideoInfo(void);
+#ifdef _XF86PCI_H
+pciConfigPtr *xf86GetPciConfigInfo(void);
+#endif
+void xf86SetPciVideo(pciVideoPtr, resType);
+void xf86PrintResList(int verb, resPtr list);
+int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+int xf86GetIsaInfoForScreen(int scrnIndex);
+Bool xf86ParseIsaBusString(const char *busID);
+void xf86EnableAccess(ScrnInfoPtr pScrn);
+Bool xf86IsPrimaryPci(pciVideoPtr pPci);
+Bool xf86IsPrimaryIsa(void);
+int xf86CheckPciGAType(pciVideoPtr pPci);
+/* new RAC */
+void xf86ClaimFixedResources(resList list, int entityIndex);
+void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
+Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer);
+void xf86DeallocateResourcesForEntity(int entityIndex, long type);
+resPtr xf86RegisterResources(int entityIndex, resList list, int access);
+Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base);
+void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io,
+ xf86AccessPtr p_mem, xf86AccessPtr p_io_mem,
+ xf86AccessPtr *ppAccessOld);
+Bool xf86IsEntityPrimary(int entityIndex);
+Bool xf86FixPciResource(int entityIndex, int prt, memType alignment,
+ long type);
+resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
+resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
+void xf86EnterServerState(xf86State state);
+resRange xf86GetBlock(long type, memType size,
+ memType window_start, memType window_end,
+ memType align_mask, resPtr avoid);
+resRange xf86GetSparse(long type, memType fixed_bits,
+ memType decode_mask, memType address_mask,
+ resPtr avoid);
+memType xf86ChkConflict(resRange *rgp, int entityIndex);
+
+
+/* xf86Cursor.c */
+
+void xf86LockZoom(ScreenPtr pScreen, int lock);
+void xf86InitViewport(ScrnInfoPtr pScr);
+void xf86SetScreenLayout(int scrnIndex, int left, int right, int up, int down);
+void xf86SetViewport(ScreenPtr pScreen, int x, int y);
+Bool xf86ZoomLocked(ScreenPtr pScreen);
+void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
+void *xf86GetPointerScreenFuncs(void);
+
+/* xf86DPMS.c */
+
+Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
+
+/* xf86DGA.c */
+
+Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
+ int num);
+
+/* xf86Events.c */
+
+void SetTimeSinceLastInputEvent(void);
+pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
+void xf86RemoveInputHandler(pointer handler);
+void xf86DisableInputHandler(pointer handler);
+void xf86EnableInputHandler(pointer handler);
+
+/* xf86Helper.c */
+
+void xf86AddDriver(DriverPtr driver, pointer module, int flags);
+void xf86DeleteDriver(int drvIndex);
+ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
+void xf86DeleteScreen(int scrnIndex, int flags);
+int xf86AllocateScrnInfoPrivateIndex(void);
+Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
+Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
+ int depth24flags);
+void xf86PrintDepthBpp(ScrnInfoPtr scrp);
+Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
+Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
+Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma);
+void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
+void xf86SetBlackWhitePixels(ScreenPtr pScreen);
+Bool xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what);
+void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, va_list args);
+void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, ...);
+void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...);
+void xf86MsgVerb(MessageType type, int verb, const char *format, ...);
+void xf86Msg(MessageType type, const char *format, ...);
+void xf86ErrorFVerb(int verb, const char *format, ...);
+void xf86ErrorF(const char *format, ...);
+const char *xf86TokenToString(SymTabPtr table, int token);
+int xf86StringToToken(SymTabPtr table, const char *string);
+void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
+void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+ SymTabPtr chips);
+int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
+int xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities);
+void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+ Bool (*ClockFunc)(ScrnInfoPtr, int),
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg,
+ int maskval, int knownclkindex, int knownclkvalue);
+const char *xf86GetVisualName(int visual);
+int xf86GetVerbosity(void);
+Pix24Flags xf86GetPix24(void);
+int xf86GetDepth(void);
+rgb xf86GetWeight(void);
+Gamma xf86GetGamma(void);
+Bool xf86GetFlipPixels(void);
+const char *xf86GetServerName(void);
+Bool xf86ServerIsExiting(void);
+Bool xf86ServerIsResetting(void);
+Bool xf86ServerIsInitialising(void);
+Bool xf86ServerIsOnlyProbing(void);
+Bool xf86CaughtSignal(void);
+Bool xf86GetVidModeAllowNonLocal(void);
+Bool xf86GetVidModeEnabled(void);
+Bool xf86GetModInDevAllowNonLocal(void);
+Bool xf86GetModInDevEnabled(void);
+Bool xf86GetAllowMouseOpenFail(void);
+Bool xf86IsPc98(void);
+pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
+void xf86LoaderReqSymLists(const char **, ...);
+void xf86LoaderReqSymbols(const char *, ...);
+void xf86Break1(void);
+void xf86Break2(void);
+void xf86Break3(void);
+void xf86SetBackingStore(ScreenPtr pScreen);
+int xf86NewSerialNumber(WindowPtr p, pointer unused);
+pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options);
+void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
+Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+ PciChipsets *p_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+ IsaChipsets *i_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+Bool xf86IsScreenPrimary(int scrnIndex);
+
+
+/* xf86Init.c */
+
+PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
+int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
+
+/* xf86Mode.c */
+
+int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider);
+const char *xf86ModeStatusToString(ModeStatus status);
+ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy);
+ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
+ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ int maxPitch, int virtualX,
+ int virtualY);
+ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ int flags);
+int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch,
+ int minHeight, int maxHeight, int pitchInc,
+ int virtualX, int virtualY, int apertureSize,
+ LookupModeFlags strategy);
+void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
+void xf86PruneDriverModes(ScrnInfoPtr scrp);
+void xf86PruneMonitorModes(MonPtr monp);
+void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
+void xf86PrintModes(ScrnInfoPtr scrp);
+void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
+
+/* xf86Option.c */
+
+void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+
+/* xf86VidModeExtentionInit.c */
+
+Bool VidModeExtensionInit(ScreenPtr pScreen);
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+#endif /* _XF86_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Beta.c b/xc/programs/Xserver/hw/xfree86/common/xf86Beta.c
new file mode 100644
index 000000000..82f63bab5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Beta.c
@@ -0,0 +1,280 @@
+/* Copyright 1996, The XFree86 Project, Inc */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Beta.c,v 3.7 1998/08/16 10:25:39 dawes Exp $ */
+
+/*
+ * This is for publicly released beta server binaries.
+ *
+ * The current version is written to $HOME/.xf86ServerName
+ * If $HOME isn't set (as may be the case when starting xdm at boot time)
+ * try '/'.
+ *
+ * Defining EXPIRE_SERVER enables the server expiry date. If EXPIRY_TIME
+ * is 0, this is disabled.
+ *
+ * Defining SHOW_BETA_MESSAGE enables displaying the beta message when first
+ * running a new beta version (the current version is checked against the
+ * contents of $HOME/.xf86ServerName)
+ *
+ * If EXPIRE_SERVER is defined, the message will be displayed both with
+ * WARNING_DAYS days of expiry and after expiry regardless of
+ * SHOW_BETA_MESSAGE.
+ *
+ * MESSAGE_SLEEP sets the sleep time (in seconds) after displaying the
+ * message.
+ */
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86Version.h"
+
+#ifndef EXPIRY_TIME
+#define EXPIRY_TIME 0
+#endif
+#ifndef SHOW_BETA_MESSAGE
+#if (XF86_VERSION_BETA > 0) && (XF86_VERSION_ALPHA == 0)
+#define SHOW_BETA_MESSAGE
+#endif
+#endif
+#ifndef EXPIRE_SERVER
+#if (XF86_VERSION_BETA > 0) && (XF86_VERSION_ALPHA == 0)
+#define EXPIRE_SERVER
+#endif
+#endif
+#ifndef MESSAGE_SLEEP
+#define MESSAGE_SLEEP 10
+#endif
+#ifndef WARNING_DAYS
+#define WARNING_DAYS 7
+#endif
+#define DAY_IN_SECONDS (24 * 60 * 60)
+
+#define XOR_VALUE_1 0x39479da4L
+#define XOR_VALUE_2 0x7df6324bL
+#define KEY_LENGTH 16
+
+#ifdef X_NOT_STDC_ENV
+extern char *getenv();
+#endif
+
+void
+xf86CheckBeta(int extraDays, char *key)
+{
+ FILE *m = NULL;
+ Bool showmessage = FALSE;
+ Bool expired = FALSE;
+ Bool expiresoon = FALSE;
+ Bool requireconfirm = FALSE;
+ int expiryextended = 0;
+#ifdef SHOW_BETA_MESSAGE
+ FILE *f = NULL;
+ char *home = NULL;
+ char *filename = NULL;
+ Bool writefile = FALSE;
+ char oldvers[16] = {0, };
+#endif
+#ifndef X_NOT_STDC_ENV
+ time_t expirytime = EXPIRY_TIME;
+#else
+ long expirytime = EXPIRY_TIME;
+#endif
+
+ /*
+ * Check if the beta message should be displayed. It is displayed when
+ * the version doesn't match that in $HOME/.XFree86, and when within
+ * one week of the expiry date.
+ */
+
+#ifdef SHOW_BETA_MESSAGE
+ if (!(home = getenv("HOME")))
+ home = "/";
+ {
+ char homebuf[PATH_MAX];
+ /* getenv might return R/O memory, as with OS/2 */
+ strncpy(homebuf,home,PATH_MAX-1);
+ homebuf[PATH_MAX-1] = '\0';
+ home = homebuf;
+
+ if (!(filename =
+ (char *)ALLOCATE_LOCAL(strlen(home) +
+ strlen(xf86ServerName) + 3)))
+ showmessage = TRUE;
+ else {
+ if (home[0] == '/' && home[1] == '\0')
+ home[0] = '\0';
+ sprintf(filename, "%s/.%s", home, xf86ServerName);
+ writefile = TRUE;
+ if (!(f = fopen(filename, "r+")))
+ showmessage = TRUE;
+ else {
+ fgets(oldvers, 16, f);
+ if (strncmp(oldvers, XF86_VERSION, 15)) {
+ showmessage = TRUE;
+ }
+ fclose(f);
+ }
+ }
+ }
+#endif
+#ifdef EXPIRE_SERVER
+ if (expirytime != 0) {
+ if (extraDays > 0 && key != NULL && strlen(key) == KEY_LENGTH) {
+#ifndef X_NOT_STDC_ENV
+ time_t newExpiry;
+#else
+ long newExpiry;
+#endif
+ unsigned long key1, key2;
+ char tmp[9];
+
+ strncpy(tmp, key, 8);
+ tmp[8] = '\0';
+ key1 = strtoul(tmp, NULL, 16);
+ key2 = strtoul(key + 8, NULL, 16);
+ newExpiry = expirytime + extraDays * DAY_IN_SECONDS;
+ if ((newExpiry ^ key1) == XOR_VALUE_1 &&
+ (newExpiry ^ key2) == XOR_VALUE_2) {
+ expirytime = newExpiry;
+ expiryextended = extraDays;
+ }
+ }
+ if (time(NULL) > expirytime) {
+ showmessage = TRUE;
+ expired = TRUE;
+ } else if (expirytime - time(NULL) < WARNING_DAYS * (DAY_IN_SECONDS)) {
+ showmessage = TRUE;
+ expiresoon = TRUE;
+ }
+ }
+#endif
+
+ if (showmessage) {
+
+#if 0
+ /*
+ * This doesn't work very well. stdin is usually closed, and even if
+ * the server doesn't close it, xinit prevents this from being useful.
+ */
+ /* Check if stderr is a tty */
+ if (isatty(fileno(stderr))) {
+ requireconfirm = TRUE;
+ }
+#endif
+
+#if 0
+ /* This doesn't work when the server is started by xinit */
+#ifndef __EMX__
+ /* See if /dev/tty can be opened */
+ m = fopen("/dev/tty", "r+");
+#endif
+#endif
+
+ if (m)
+ requireconfirm = TRUE;
+ else
+ m = stderr;
+ if (m) {
+ putc('\007', m);
+ fprintf(m, "\n");
+ fprintf(m, " This is a beta version of XFree86.\n\n");
+ fprintf(m, " This binary may be redistributed providing it is not"
+ " modified in any way.\n\n");
+ fprintf(m, " Please send success and problem reports to"
+ " <report@XFree86.org>.\n\n");
+ if (expired) {
+ fprintf(m, " This version (%s) has expired.\n", XF86_VERSION);
+ fprintf(m, " Please get the release version or a newer beta"
+ " version.\n");
+ } else if (expiresoon) {
+ fprintf(m, " WARNING! This version (%s) will expire in less than"
+ " %ld day(s)\n at %s\n", XF86_VERSION,
+ (long)(expirytime - time(NULL)) / DAY_IN_SECONDS + 1,
+ ctime(&expirytime));
+ fprintf(m, " Please get the release version or a newer beta"
+ " version.\n");
+ } else if (expirytime != 0) {
+ fprintf(m, " This version (%s) will expire at %s\n", XF86_VERSION,
+ ctime(&expirytime));
+ }
+ if (!expired && expiryextended) {
+ fprintf(m, " Note: the expiry date has been extended by %d days\n",
+ expiryextended);
+ }
+
+ if (!expired) {
+ if (requireconfirm) {
+ char c[2];
+ fflush(m);
+ fprintf(m, "\nHit <Enter> to continue: ");
+ fflush(m);
+ fgets(c, 2, m);
+ } else {
+ fflush(m);
+ fprintf(m, "\nWaiting for %d seconds...", MESSAGE_SLEEP);
+ fflush(m);
+ sleep(MESSAGE_SLEEP);
+ fprintf(m, "\n");
+ }
+ }
+ fprintf(m, "\n");
+ if (m != stderr)
+ fclose(m);
+ }
+ }
+#ifdef SHOW_BETA_MESSAGE
+
+#define WRITE_BETA_FILE { \
+ unlink(filename); \
+ if (f = fopen(filename, "w")) { \
+ fprintf(f, XF86_VERSION); \
+ fclose(f); \
+ } \
+ }
+
+ if (writefile) {
+#if !defined(__EMX__)
+#if defined(SYSV) || defined(linux)
+ /* Need to fork to change to ruid without loosing euid */
+ if (getuid() != 0) {
+ switch (fork()) {
+ case -1:
+ FatalError("xf86CheckBeta(): fork failed (%s)\n", strerror(errno));
+ break;
+ case 0: /* child */
+ setuid(getuid());
+ WRITE_BETA_FILE
+ exit(0);
+ break;
+ default: /* parent */
+ wait(NULL);
+ }
+ } else {
+ WRITE_BETA_FILE
+ }
+#else /* ! (SYSV || linux) */
+ {
+ int realuid = getuid();
+#if !defined(SVR4) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__GNU__)
+ setruid(0);
+#endif
+ seteuid(realuid);
+ WRITE_BETA_FILE
+ seteuid(0);
+#if !defined(SVR4) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__GNU__)
+ setruid(realuid);
+#endif
+ }
+#endif /* SYSV || linux */
+#else /* __EMX__ */
+ WRITE_BETA_FILE
+#endif /* __EMX__ */
+ }
+ if (filename) {
+ DEALLOCATE_LOCAL(filename);
+ filename = NULL;
+ }
+#endif
+ if (expired)
+ exit(1);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
new file mode 100644
index 000000000..a8e60853c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c
@@ -0,0 +1,4129 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.37 1999/08/28 09:00:51 dawes Exp $ */
+#define DEBUG
+/*
+ * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "X.h"
+#include "os.h"
+#include "xf86Pci.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+/* Bus-specific headers */
+
+#include "xf86Bus.h"
+#define DECLARE_CARD_DATASTRUCTURES TRUE
+#include "xf86PciInfo.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+
+/* Bus-specific globals */
+pciConfigPtr *xf86PciInfo = NULL; /* Full PCI probe info */
+pciVideoPtr *xf86PciVideoInfo = NULL; /* PCI probe for video hw */
+pciAccPtr * xf86PciAccInfo = NULL; /* PCI access related */
+BusAccPtr xf86PciBusAccInfo = NULL;
+
+/* PCI buses */
+static PciBusPtr xf86PciBus = NULL;
+
+/* Entity data */
+static EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
+static int xf86NumEntities = 0;
+
+static xf86AccessRec AccessNULL = {NULL,NULL,NULL};
+
+xf86CurrentAccessRec xf86CurrentAccess = {NULL,NULL};
+
+static BusRec primaryBus = { BUS_NONE, {{0}}};
+
+Bool xf86ResAccessEnter = FALSE;
+
+/* new RAC */
+
+/* resource lists */
+static resPtr Acc = NULL;
+
+/* allocatable ranges */
+static resPtr ResRange = NULL;
+
+/* predefined special resources */
+resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END};
+resRange resVgaShared[] = {_VGA_SHARED, _END};
+resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END};
+resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END};
+resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END};
+resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END};
+resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END};
+resRange res8514Shared[] = {_8514_SHARED, _END};
+resRange PciAvoid[] = {_PCI_AVOID, _END};
+
+/* Flag: do we need RAC ? */
+static Bool needRAC = FALSE;
+
+/* Bus-specific probe/sorting functions */
+
+/* PCI classes that get included in xf86PciVideoInfo */
+#define PCIINFOCLASSES(b,s) \
+ (((b) == PCI_CLASS_PREHISTORIC) || \
+ ((b) == PCI_CLASS_DISPLAY) || \
+ ((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO) || \
+ ((b) == PCI_CLASS_PROCESSOR && (s) == PCI_SUBCLASS_PROCESSOR_COPROC))
+
+/*
+ * PCI classes that have messages printed always. The others are only
+ * have a message printed when the vendor/dev IDs are recognised.
+ */
+#define PCIALWAYSPRINTCLASSES(b,s) \
+ (((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \
+ ((b) == PCI_CLASS_DISPLAY) || \
+ ((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO))
+
+/*
+ * PCI classes for which potentially destructive checking of the map sizes
+ * may be done. Any classes where this may be unsafe should be omitted
+ * from this list.
+ */
+#define PCINONSYSTEMCLASSES(b,s) PCIALWAYSPRINTCLASSES(b,s)
+
+/*
+ * PCI classes that use RAC
+ */
+#define PCISHAREDIOCLASSES(b,s) \
+ (((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \
+ ((b) == PCI_CLASS_DISPLAY && (s) == PCI_SUBCLASS_DISPLAY_VGA))
+
+/* XXX Fixme: Hack: so far we only support 32 bit PCI addresses */
+#define PCI_MEMBASE_LENGTH_TYPE(x) 0xFFFFFFFF
+#define PCI_MEMBASE_LENGTH_MAX 0xFFFFFFFF
+#define PCI_IOBASE_LENGTH_MAX 0xFFFF
+#undef MIN
+#define MIN(x,y) ((x<y)?x:y)
+
+SymTabPtr xf86PCIVendorNameInfo;
+pciVendorCardInfo *xf86PCICardInfo;
+pciVendorDeviceInfo * xf86PCIVendorInfo;
+
+static void
+xf86FindPCIVideoInfo(void)
+{
+ pciConfigPtr pcrp, *pcrpp;
+ int i = 0, j, k;
+ int num = 0;
+ pciVideoPtr info;
+ Bool mem64 = FALSE;
+
+ pcrpp = xf86PciInfo = xf86scanpci(0);
+
+ if (pcrpp == NULL) {
+ xf86PciVideoInfo = NULL;
+ return;
+ }
+
+ while ((pcrp = pcrpp[i])) {
+ if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) {
+ num++;
+ xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
+ sizeof(pciVideoPtr) * (num + 1));
+ xf86PciVideoInfo[num] = NULL;
+ info = xf86PciVideoInfo[num - 1] = xnfalloc(sizeof(pciVideoRec));
+ info->validate = FALSE;
+ info->vendor = pcrp->pci_vendor;
+ info->chipType = pcrp->pci_device;
+ info->chipRev = pcrp->pci_rev_id;
+ info->subsysVendor = pcrp->pci_subsys_vendor;
+ info->subsysCard = pcrp->pci_subsys_card;
+ info->bus = pcrp->busnum;
+ info->device = pcrp->devnum;
+ info->func = pcrp->funcnum;
+ info->class = pcrp->pci_base_class;
+ info->subclass = pcrp->pci_sub_class;
+ info->interface = pcrp->pci_prog_if;
+ info->biosBase = pcrp->pci_baserom;
+ info->biosSize = pciGetBaseSize(pcrp->tag, 6, TRUE, NULL);
+ info->thisCard = pcrp;
+ if ((PCISHAREDIOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class))
+ && (pcrp->pci_command & PCI_CMD_IO_ENABLE) &&
+ (pcrp->pci_prog_if == 0)) {
+ /* assumption: primary bus is always VGA */
+ primaryBus.type = BUS_PCI;
+ primaryBus.id.pci.bus = pcrp->busnum;
+ primaryBus.id.pci.device = pcrp->devnum;
+ primaryBus.id.pci.func = pcrp->funcnum;
+ }
+
+ for (j = 0; j < 6; j++) {
+ info->memBase[j] = 0;
+ info->ioBase[j] = 0;
+ if (PCINONSYSTEMCLASSES(info->class, info->subclass)) {
+ info->size[j] = pciGetBaseSize(pcrp->tag, j, TRUE, NULL);
+ info->validate = TRUE;
+ }
+ else
+ info->size[j] = pcrp->basesize[j];
+ /* pciGetBaseSize(pcrp->tag, j, FALSE, NULL) */
+ info->type[j] = 0;
+ }
+
+ /*
+ * 64-bit base addresses are checked for and avoided.
+ * XXX Should deal with them on platforms that support them.
+ */
+
+ if (pcrp->pci_base0) {
+ if (pcrp->pci_base0 & PCI_MAP_IO) {
+ info->ioBase[0] = (memType)PCIGETIO(pcrp->pci_base0);
+ info->type[0] = pcrp->pci_base0 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base0))
+ mem64 = TRUE;
+ else {
+ info->memBase[0] = (memType)PCIGETMEMORY(pcrp->pci_base0);
+ info->type[0] = pcrp->pci_base0 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ }
+
+ if (pcrp->pci_base1 && !mem64) {
+ if (pcrp->pci_base1 & PCI_MAP_IO) {
+ info->ioBase[1] = (memType)PCIGETIO(pcrp->pci_base1);
+ info->type[1] = pcrp->pci_base1 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base1))
+ mem64 = TRUE;
+ else {
+ info->memBase[1] = (memType)PCIGETMEMORY(pcrp->pci_base1);
+ info->type[1] = pcrp->pci_base1 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ } else if (mem64)
+ mem64 = FALSE;
+
+ if (pcrp->pci_base2 && !mem64) {
+ if (pcrp->pci_base2 & PCI_MAP_IO) {
+ info->ioBase[2] = (memType)PCIGETIO(pcrp->pci_base2);
+ info->type[2] = pcrp->pci_base2 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base2))
+ mem64 = TRUE;
+ else {
+ info->memBase[2] = (memType)PCIGETMEMORY(pcrp->pci_base2);
+ info->type[2] = pcrp->pci_base2 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ } else if (mem64)
+ mem64 = FALSE;
+
+ if (pcrp->pci_base3 && !mem64) {
+ if (pcrp->pci_base3 & PCI_MAP_IO) {
+ info->ioBase[3] = (memType)PCIGETIO(pcrp->pci_base3);
+ info->type[3] = pcrp->pci_base3 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base3))
+ mem64 = TRUE;
+ else {
+ info->memBase[3] = (memType)PCIGETMEMORY(pcrp->pci_base3);
+ info->type[3] = pcrp->pci_base3 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ } else if (mem64)
+ mem64 = FALSE;
+
+ if (pcrp->pci_base4 && !mem64) {
+ if (pcrp->pci_base4 & PCI_MAP_IO) {
+ info->ioBase[4] = (memType)PCIGETIO(pcrp->pci_base4);
+ info->type[4] = pcrp->pci_base4 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base4))
+ mem64 = TRUE;
+ else {
+ info->memBase[4] = (memType)PCIGETMEMORY(pcrp->pci_base4);
+ info->type[4] = pcrp->pci_base4 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ } else if (mem64)
+ mem64 = FALSE;
+
+ if (pcrp->pci_base5 && !mem64) {
+ if (pcrp->pci_base5 & PCI_MAP_IO) {
+ info->ioBase[5] = (memType)PCIGETIO(pcrp->pci_base5);
+ info->type[5] = pcrp->pci_base5 & PCI_MAP_IO_ATTR_MASK;
+ } else
+ if (PCI_MAP_IS64BITMEM(pcrp->pci_base5))
+ mem64 = TRUE;
+ else {
+ info->memBase[5] = (memType)PCIGETMEMORY(pcrp->pci_base5);
+ info->type[5] = pcrp->pci_base5 & PCI_MAP_MEMORY_ATTR_MASK;
+ }
+ }
+ }
+ i++;
+ }
+
+ /* Print a summary of the video devices found */
+ {
+ for (k = 0; k < num; k++) {
+ char *vendorname = NULL, *chipname = NULL;
+ Bool memdone = FALSE, iodone = FALSE;
+
+ i = 0;
+ info = xf86PciVideoInfo[k];
+ while (xf86PCIVendorNameInfo[i].token) {
+ if (xf86PCIVendorNameInfo[i].token == info->vendor)
+ vendorname = (char *)xf86PCIVendorNameInfo[i].name;
+ i++;
+ }
+ i = 0;
+ while(xf86PCIVendorInfo[i].VendorID) {
+ if (xf86PCIVendorInfo[i].VendorID == info->vendor) {
+ j = 0;
+ while (xf86PCIVendorInfo[i].Device[j].DeviceName) {
+ if (xf86PCIVendorInfo[i].Device[j].DeviceID ==
+ info->chipType) {
+ chipname =
+ xf86PCIVendorInfo[i].Device[j].DeviceName;
+ break;
+ }
+ j++;
+ }
+ break;
+ }
+ i++;
+ }
+ if ((!vendorname || !chipname) &&
+ !PCIALWAYSPRINTCLASSES(info->class, info->subclass))
+ continue;
+ xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device,
+ info->func);
+ if (vendorname)
+ ErrorF("%s ", vendorname);
+ else
+ ErrorF("unknown vendor (0x%04x) ", info->vendor);
+ if (chipname)
+ ErrorF("%s ", chipname);
+ else
+ ErrorF("unknown chipset (0x%04x) ", info->chipType);
+ ErrorF("rev %d", info->chipRev);
+ for (i = 0; i < 6; i++) {
+ if (info->memBase[i]) {
+ if (!memdone) {
+ ErrorF(", Mem @ ");
+ memdone = TRUE;
+ } else
+ ErrorF(", ");
+ ErrorF("0x%08x/%d", info->memBase[i], info->size[i]);
+ }
+ }
+ for (i = 0; i < 6; i++) {
+ if (info->ioBase[i]) {
+ if (!iodone) {
+ ErrorF(", I/O @ ");
+ iodone = TRUE;
+ } else
+ ErrorF(", ");
+ ErrorF("0x%04x/%d", info->ioBase[i], info->size[i]);
+ }
+ }
+ ErrorF("\n");
+ }
+ }
+}
+
+/*
+ * Call the bus probes relevant to the architecture.
+ *
+ * The only one available so far is for PCI
+ */
+
+void
+xf86BusProbe(void)
+{
+
+#ifdef XFree86LOADER
+ /*
+ * we need to get the pointer to the pci data structures initialized
+ */
+ xf86PCIVendorNameInfo =
+ (SymTabPtr)LoaderSymbol("xf86PCIVendorNameInfoData");
+ xf86PCIVendorInfo =
+ (pciVendorDeviceInfo*)LoaderSymbol("xf86PCIVendorInfoData");
+ xf86PCICardInfo =
+ (pciVendorCardInfo*)LoaderSymbol("xf86PCICardInfoData");
+#else
+ xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData;
+ xf86PCIVendorInfo = xf86PCIVendorInfoData;
+ xf86PCICardInfo = xf86PCICardInfoData;
+#endif
+ xf86FindPCIVideoInfo();
+}
+
+/*
+ * Functions to access the bus list. The data structures are opaque to
+ * the video drivers.
+ */
+
+static int
+xf86AllocateEntity(void)
+{
+ xf86NumEntities++;
+ xf86Entities = xnfrealloc(xf86Entities, sizeof(EntityPtr) * xf86NumEntities);
+ xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec));
+ return (xf86NumEntities - 1);
+}
+
+/*
+ * Check if the slot requested is free. If it is already in use, return FALSE.
+ */
+
+Bool
+xf86CheckPciSlot(int bus, int device, int func)
+{
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ p = xf86Entities[i];
+ /* Check if this PCI slot is taken */
+ if (p->busType == BUS_PCI && p->pciBusId.bus == bus &&
+ p->pciBusId.device == device && p->pciBusId.func == func)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ * fixPciSizeInfo() -- fix pci size info by testing it destructively
+ * (if not already done), fix pciVideoInfo and entry in the resource
+ * list.
+ */
+/*
+ * Note: once we have OS support to read the sizes GetBaseSize() will
+ * have to be wrapped by the OS layer. fixPciSizeInfo() should also
+ * be wrapped by the OS layer to do nothing if the size is always
+ * returned correctly by GetBaseSize(). It should however set validate
+ * in pciVideoRec if validation is required. PciValidate() also needs
+ * to be wrapped by the OS layer. This may do nothing if the OS has
+ * already taken care of validation. fixPciResource() may be moved to
+ * OS layer with minimal changes. Once the wrapping layer is in place
+ * the common level and drivers should not reference these functions
+ * directly but thru the OS layer.
+ */
+
+static void
+fixPciSizeInfo(int entityIndex)
+{
+ pciVideoPtr pvp;
+ resPtr pAcc;
+ PCITAG tag;
+ int j;
+
+ if (! (pvp = xf86GetPciInfoForEntity(entityIndex))) return;
+ if (pvp->validate) return;
+
+ tag = pciTag(pvp->bus,pvp->device,pvp->func);
+
+ for (j = 0; j < 6; j++) {
+ pAcc = Acc;
+ if (pvp->memBase[j])
+ while (pAcc) {
+ if (((pAcc->res_type & (ResMem | ResBlock))
+ == (ResMem | ResBlock))
+ && (pAcc->block_begin == pvp->memBase[j])
+ && (pAcc->block_end == pvp->memBase[j]
+ + (1 << (pvp->size[j])) - 1)) break;
+ pAcc = pAcc->next;
+ } else if (pvp->ioBase[j])
+ while (pAcc) {
+ if (((pAcc->res_type & (ResIo | ResBlock)) ==
+ (ResIo | ResBlock))
+ && (pAcc->block_begin == pvp->ioBase[j])
+ && (pAcc->block_end == pvp->ioBase[j]
+ + (1 << (pvp->size[j])) - 1)) break;
+ pAcc = pAcc->next;
+ } else continue;
+ pvp->size[j] = pciGetBaseSize(tag, j, TRUE, NULL);
+ if (pAcc)
+ pAcc->block_end = pAcc->block_begin + (1 << (pvp->size[j])) - 1;
+ }
+ if (pvp->biosBase) {
+ pAcc = Acc;
+ while (pAcc) {
+ if (((pAcc->res_type & (ResMem | ResBlock)) == (ResMem | ResBlock))
+ && (pAcc->block_begin == pvp->biosBase)
+ && (pAcc->block_end == pvp->biosBase
+ + (1 << (pvp->biosSize)) - 1)) break;
+ pAcc = pAcc->next;
+ }
+ pvp->biosSize = pciGetBaseSize(tag, 6, TRUE, NULL);
+ if (pAcc)
+ pAcc->block_end = pAcc->block_begin + (1 << (pvp->biosSize))- 1;
+ }
+
+ pvp->validate = TRUE;
+}
+
+/*
+ * If the slot requested is already in use, return -1.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+static void disablePciBios(PCITAG tag);
+
+int
+xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p;
+ pciAccPtr *ppaccp = xf86PciAccInfo;
+ BusAccPtr pbap = xf86PciBusAccInfo;
+
+ int num;
+
+ if (xf86CheckPciSlot(bus, device, func)) {
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = chipset;
+ p->busType = BUS_PCI;
+ p->device = dev;
+ p->pciBusId.bus = bus;
+ p->pciBusId.device = device;
+ p->pciBusId.func = func;
+ p->active = active;
+ p->inUse = FALSE;
+ /* Here we initialize the access structure */
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ while (ppaccp && *ppaccp) {
+ if ((*ppaccp)->busnum == bus
+ && (*ppaccp)->devnum == device
+ && (*ppaccp)->funcnum == func) {
+ p->access->fallback = &(*ppaccp)->io_memAccess;
+ p->access->pAccess = &(*ppaccp)->io_memAccess;
+ (*ppaccp)->ctrl = TRUE; /* mark control if not already */
+ break;
+ }
+ ppaccp++;
+ }
+ if (!ppaccp || !*ppaccp) {
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ }
+
+ p->busAcc = NULL;
+ while (pbap) {
+ if (pbap->type == BUS_PCI && pbap->busdep.pci.bus == bus)
+ p->busAcc = pbap;
+ pbap = pbap->next;
+ }
+ fixPciSizeInfo(num);
+
+ /* in case bios is enabled disable it */
+ disablePciBios(pciTag(bus,device,func));
+
+ return num;
+ } else
+ return -1;
+}
+
+/*
+ * Get xf86PciVideoInfo for a driver.
+ */
+pciVideoPtr *
+xf86GetPciVideoInfo(void)
+{
+ return xf86PciVideoInfo;
+}
+
+/* --- Used by ATI driver, but also more generally useful */
+
+/*
+ * Get the full xf86scanpci data.
+ */
+pciConfigPtr *
+xf86GetPciConfigInfo(void)
+{
+ return xf86PciInfo;
+}
+
+/*
+ * Enable a device and route VGA to it. This is intended for a driver's
+ * Probe(), before creating EntityRec's. Only one device can be thus enabled
+ * at any one time, and should be disabled when the driver is done with it.
+ *
+ * The following special calls are also available:
+ *
+ * pvp == NULL && rt == NONE disable previously enabled device
+ * pvp != NULL && rt == NONE ensure device is disabled
+ * pvp == NULL && rt != NONE disable >all< subsequent calls to this function
+ * (done from xf86PostProbe())
+ *
+ * The device represented by pvp may not have been previously claimed.
+ */
+void
+xf86SetPciVideo(pciVideoPtr pvp, resType rt)
+{
+ static BusAccPtr pbap = NULL;
+ static xf86AccessPtr pAcc = NULL;
+ static Bool DoneProbes = FALSE;
+ pciAccPtr pcaccp;
+ int i;
+
+ if (DoneProbes)
+ return;
+
+ /* Disable previous access */
+ if (pAcc) {
+ if (pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pAcc = NULL;
+ }
+ if (pbap) {
+ while (pbap->primary) {
+ if (pbap->disable_f)
+ (*pbap->disable_f)(pbap);
+ pbap->primary->current = NULL;
+ pbap = pbap->primary;
+ }
+ pbap = NULL;
+ }
+
+ /* Check for xf86PostProbe's magic combo */
+ if (!pvp) {
+ if (rt != NONE)
+ DoneProbes = TRUE;
+ return;
+ }
+
+ /* Validate device */
+ if (!xf86PciVideoInfo || !xf86PciAccInfo || !xf86PciBusAccInfo)
+ return;
+
+ for (i = 0; pvp != xf86PciVideoInfo[i]; i++)
+ if (!xf86PciVideoInfo[i])
+ return;
+
+ /* Ignore request for claimed adapters */
+ if (!xf86CheckPciSlot(pvp->bus, pvp->device, pvp->func))
+ return;
+
+ /* Find pciAccRec structure */
+ for (i = 0; ; i++) {
+ if (!(pcaccp = xf86PciAccInfo[i]))
+ return;
+ if ((pvp->bus == pcaccp->busnum) &&
+ (pvp->device == pcaccp->devnum) &&
+ (pvp->func == pcaccp->funcnum))
+ break;
+ }
+
+ if (rt == NONE) {
+ /* This is a call to ensure the adapter is disabled */
+ if (pcaccp->io_memAccess.AccessDisable)
+ (*pcaccp->io_memAccess.AccessDisable)(pcaccp->io_memAccess.arg);
+ return;
+ }
+
+ /* Find BusAccRec structure */
+ for (pbap = xf86PciBusAccInfo; ; pbap = pbap->next) {
+ if (!pbap)
+ return;
+ if (pvp->bus == pbap->busdep.pci.bus)
+ break;
+ }
+
+ /* Route VGA */
+ if (pbap->set_f)
+ (*pbap->set_f)(pbap);
+
+ /* Enable device */
+ switch (rt) {
+ case IO:
+ pAcc = &pcaccp->ioAccess;
+ break;
+ case MEM_IO:
+ pAcc = &pcaccp->io_memAccess;
+ break;
+ case MEM:
+ pAcc = &pcaccp->memAccess;
+ break;
+ default: /* no compiler noise */
+ break;
+ }
+
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+}
+
+/* --- */
+
+/*
+ * Determine what bus type the busID string represents. The start of the
+ * bus-dependent part of the string is returned as retID.
+ */
+
+static BusType
+StringToBusType(const char* busID, const char **retID)
+{
+ char *p, *s;
+ BusType ret = BUS_NONE;
+
+ /* If no type field, Default to PCI */
+ if (isdigit(busID[0])) {
+ if (retID)
+ *retID = busID;
+ return BUS_PCI;
+ }
+
+ s = xstrdup(busID);
+ p = strtok(s, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return BUS_NONE;
+ }
+ if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
+ ret = BUS_PCI;
+ if (!xf86NameCmp(p, "isa"))
+ ret = BUS_ISA;
+ if (ret != BUS_NONE)
+ if (retID)
+ *retID = busID + strlen(p) + 1;
+ xfree(s);
+ return ret;
+}
+
+
+/*
+ * Parse a BUS ID string, and return the PCI bus parameters if it was
+ * in the correct format for a PCI bus id.
+ */
+
+Bool
+xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
+{
+ /*
+ * The format is assumed to be "bus:device:func", where bus, device
+ * and func are decimal integers. func may be omitted and assumed to
+ * be zero, although it doing this isn't encouraged.
+ */
+
+ char *p, *s;
+ const char *id;
+ int i;
+
+ if (StringToBusType(busID, &id) != BUS_PCI)
+ return FALSE;
+
+ s = xstrdup(id);
+ p = strtok(s, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return FALSE;
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *bus = atoi(p);
+ p = strtok(NULL, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return FALSE;
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *device = atoi(p);
+ *func = 0;
+ p = strtok(NULL, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return TRUE;
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *func = atoi(p);
+ xfree(s);
+ return TRUE;
+}
+
+/*
+ * Compare a BUS ID string with a PCI bus id. Return TRUE if they match.
+ */
+
+Bool
+xf86ComparePciBusString(const char *busID, int bus, int device, int func)
+{
+ int ibus, idevice, ifunc;
+
+ if (xf86ParsePciBusString(busID, &ibus, &idevice, &ifunc)) {
+ return bus == ibus && device == idevice && func == ifunc;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * If the slot requested is already in use, return FALSE.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+
+int
+xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p;
+ BusAccPtr pbap = xf86PciBusAccInfo;
+ int num;
+
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = chipset;
+ p->busType = BUS_ISA;
+ p->device = dev;
+ p->active = active;
+ p->inUse = FALSE;
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ p->busAcc = NULL;
+ while (pbap) {
+ if (pbap->type == BUS_ISA)
+ p->busAcc = pbap;
+ pbap = pbap->next;
+ }
+ return num;
+}
+
+/*
+ * Get the list of ISA "slots" claimed by a screen
+ *
+ * Note: The ISA implementation here assumes that only one ISA "slot" type
+ * can be claimed by any one screen. That means a return value other than
+ * 0 or 1 isn't useful.
+ */
+int
+xf86GetIsaInfoForScreen(int scrnIndex)
+{
+ int num = 0;
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
+ p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
+ if (p->busType == BUS_ISA) {
+ num++;
+ }
+ }
+ return num;
+}
+
+/*
+ * Parse a BUS ID string, and return True if it is a ISA bus id.
+ */
+
+Bool
+xf86ParseIsaBusString(const char *busID)
+{
+ /*
+ * The format assumed to be "isa" or "isa:"
+ */
+ return (StringToBusType(busID,NULL) == BUS_ISA);
+}
+
+/*
+ * IO enable/disable related routines for PCI
+ */
+#define SETBITS PCI_CMD_IO_ENABLE
+static void
+pciIoAccessEnable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ SETBITS, SETBITS);
+}
+
+static void
+pciIoAccessDisable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0);
+}
+
+#undef SETBITS
+#define SETBITS (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)
+static void
+pciIo_MemAccessEnable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ SETBITS, SETBITS);
+}
+
+static void
+pciIo_MemAccessDisable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0);
+}
+
+#undef SETBITS
+#define SETBITS (PCI_CMD_MEM_ENABLE)
+static void
+pciMemAccessEnable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,
+ SETBITS, SETBITS);
+}
+
+static void
+pciMemAccessDisable(void* arg)
+{
+#ifdef DEBUG
+ ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,SETBITS, 0);
+}
+#undef SETBITS
+
+#define PCI_PCI_BRDG_CTRL_BASE (PCI_PCI_BRIDGE_CONTROL_REG & 0xFC)
+#define SHIFT_BITS ((PCI_PCI_BRIDGE_CONTROL_REG & 0x3) << 3)
+#define SETBITS (CARD32)((PCI_PCI_BRIDGE_VGA_EN) << SHIFT_BITS)
+static void
+pciBusAccessEnable(BusAccPtr ptr)
+{
+ ptr->busdep.pci.func(ptr->busdep.pci.acc,PCI_PCI_BRDG_CTRL_BASE,
+ SETBITS,SETBITS);
+}
+
+static void
+pciBusAccessDisable(BusAccPtr ptr)
+{
+ ptr->busdep.pci.func(ptr->busdep.pci.acc,PCI_PCI_BRDG_CTRL_BASE,SETBITS,0);
+}
+#undef SETBITS
+#undef SHIFT_BITS
+static void
+pciSetBusAccess(BusAccPtr ptr)
+{
+#ifdef DEBUG
+ ErrorF("pciSetBusAccess: route VGA to bus %d\n", ptr->busdep.pci.bus);
+#endif
+
+ if (!ptr->primary && !ptr->current)
+ return;
+
+ if (ptr->current && ptr->current->disable_f)
+ ptr->current->disable_f(ptr->current);
+ ptr->current = NULL;
+
+ /* walk down */
+ while (ptr->primary) { /* no enable for top bus */
+ if (ptr->primary->current != ptr) {
+ if (ptr->primary->current && ptr->primary->current->disable_f)
+ ptr->primary->current->disable_f(ptr->primary->current);
+ if (ptr->enable_f) ptr->enable_f(ptr);
+ ptr->primary->current = ptr;
+ }
+ ptr = ptr->primary;
+ }
+}
+
+static void
+savePciState(PCITAG tag, pciSavePtr ptr)
+{
+ int i;
+
+ ptr->command = pciReadLong(tag,PCI_CMD_STAT_REG);
+ for (i=0; i < 6; i++)
+ ptr->base[i] = pciReadLong(tag,PCI_CMD_BASE_REG + i*4 );
+ ptr->biosBase = pciReadLong(tag,PCI_CMD_BIOS_REG);
+}
+
+static void
+restorePciState(PCITAG tag, pciSavePtr ptr)
+{
+ int i;
+
+ /* disable card before setting anything */
+ pciSetBitsLong(tag, PCI_CMD_STAT_REG, PCI_CMD_MEM_ENABLE
+ | PCI_CMD_IO_ENABLE , 0);
+ pciWriteLong(tag,PCI_CMD_BIOS_REG,ptr->biosBase);
+ for (i=0; i<6; i++)
+ pciWriteLong(tag,PCI_CMD_BASE_REG + i*4, ptr->base[i]);
+ pciWriteLong(tag,PCI_CMD_STAT_REG,ptr->command);
+}
+
+static void
+savePciBusState(BusAccPtr ptr)
+{
+ ptr->busdep.pci.save.io =
+ pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_IO_REG);
+ ptr->busdep.pci.save.mem =
+ pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_MEM_REG);
+ ptr->busdep.pci.save.pmem =
+ pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG);
+ ptr->busdep.pci.save.control =
+ pciReadByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG);
+}
+
+static void
+restorePciBusState(BusAccPtr ptr)
+{
+ pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_IO_REG,
+ ptr->busdep.pci.save.io);
+ pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_MEM_REG,
+ ptr->busdep.pci.save.mem);
+ pciWriteWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG,
+ ptr->busdep.pci.save.pmem);
+ pciWriteByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG,
+ ptr->busdep.pci.save.control);
+}
+
+/*-----------------------------------------------------------------*/
+static void
+initPciState(void)
+{
+ int i = 0;
+ int j = 0;
+ pciVideoPtr pvp;
+ pciAccPtr pcaccp;
+
+ if (xf86PciAccInfo != NULL)
+ return;
+
+ if (xf86PciVideoInfo == NULL)
+ return;
+
+ while ((pvp = xf86PciVideoInfo[i]) != NULL) {
+ i++;
+ j++;
+ xf86PciAccInfo = xnfrealloc(xf86PciAccInfo,
+ sizeof(pciAccPtr) * (j + 1));
+ xf86PciAccInfo[j] = NULL;
+ pcaccp = xf86PciAccInfo[j - 1] = xnfalloc(sizeof(pciAccRec));
+ pcaccp->busnum = pvp->bus;
+ pcaccp->devnum = pvp->device;
+ pcaccp->funcnum = pvp->func;
+ pcaccp->arg.tag = pciTag(pvp->bus, pvp->device, pvp->func);
+ pcaccp->arg.func =
+ (SetBitsProcPtr)pciLongFunc(pcaccp->arg.tag,SET_BITS);
+ pcaccp->ioAccess.AccessDisable = pciIoAccessDisable;
+ pcaccp->ioAccess.AccessEnable = pciIoAccessEnable;
+ pcaccp->ioAccess.arg = &pcaccp->arg;
+ pcaccp->io_memAccess.AccessDisable = pciIo_MemAccessDisable;
+ pcaccp->io_memAccess.AccessEnable = pciIo_MemAccessEnable;
+ pcaccp->io_memAccess.arg = &pcaccp->arg;
+ pcaccp->memAccess.AccessDisable = pciMemAccessDisable;
+ pcaccp->memAccess.AccessEnable = pciMemAccessEnable;
+ pcaccp->memAccess.arg = &pcaccp->arg;
+ if (PCISHAREDIOCLASSES(pvp->class, pvp->subclass))
+ pcaccp->ctrl = TRUE;
+ else
+ pcaccp->ctrl = FALSE;
+ savePciState(pcaccp->arg.tag, &pcaccp->save);
+ }
+}
+
+/*
+ * initPciBusState() - fill out the BusAccRec for a PCI bus.
+ * Theory: each bus is associated with one bridge connecting it
+ * to its parent bus. The address of a bridge is therefore stored
+ * in the BusAccRec of the bus it connects to. Each bus can
+ * have several bridges connecting secondary buses to it. Only one
+ * of these bridges can be open. Therefore the status of a bridge
+ * associated with a bus is stored in the BusAccRec of the parent
+ * the bridge connects to. The first member of the structure is
+ * a pointer to a function that open access to this bus. This function
+ * receives a pointer to the structure itself as argument. This
+ * design should be common to BusAccRecs of any type of buses we
+ * support. The remeinder of the structure is bus type specific.
+ * In this case it contains a pointer to the structure of the
+ * parent bus. Thus enabling access to a specific bus is simple:
+ * 1. Close any bridge going to secondary buses.
+ * 2. Climb down the ladder and enable any bridge on buses
+ * on the path from the CPU to this bus.
+ */
+
+static void
+initPciBusState(void)
+{
+ BusAccPtr *ppbap_next = &xf86PciBusAccInfo;
+ BusAccPtr pbap, pbap_tmp;
+ PciBusPtr pbp = xf86PciBus;
+
+ while (pbp) {
+ (*ppbap_next) = pbap = xnfcalloc(1,sizeof(BusAccRec));
+ pbap->busdep.pci.bus = pbp->secondary;
+#if 0
+ pbap->save_f = NULL;
+ pbap->restore_f = NULL;
+ pbap->set_f = NULL;
+ pbap->enable_f = NULL;
+ pbap->disable_f = NULL;
+ pbap->current = NULL;
+ pbap->next = NULL;
+#endif
+ pbap->busdep.pci.acc = PCITAG_SPECIAL;
+ switch (pbp->subclass) {
+ case PCI_SUBCLASS_BRIDGE_HOST:
+#ifdef DEBUG
+ ErrorF("setting up HOST: %i\n",pbap->busdep.pci.bus);
+#endif
+ pbap->type = BUS_PCI;
+ pbap->set_f = pciSetBusAccess;
+ break;
+ case PCI_SUBCLASS_BRIDGE_PCI:
+#ifdef DEBUG
+ ErrorF("setting up PCI: %i\n",pbap->busdep.pci.bus);
+#endif
+ pbap->type = BUS_PCI;
+ pbap->save_f = savePciBusState;
+ pbap->restore_f = restorePciBusState;
+ pbap->set_f = pciSetBusAccess;
+ pbap->enable_f = pciBusAccessEnable;
+ pbap->disable_f = pciBusAccessDisable;
+ pbap->busdep.pci.acc = pciTag(pbp->brbus,pbp->brdev,pbp->brfunc);
+ pbap->busdep.pci.func =
+ (SetBitsProcPtr)pciLongFunc(pbap->busdep.pci.acc,SET_BITS);
+ savePciBusState(pbap);
+ break;
+ case PCI_SUBCLASS_BRIDGE_ISA:
+#ifdef DEBUG
+ ErrorF("setting up ISA: %i\n",pbap->busdep.pci.bus);
+#endif
+ pbap->type = BUS_ISA;
+ pbap->set_f = pciSetBusAccess;
+ break;
+ }
+ pbap->next = NULL;
+ ppbap_next = &pbap->next;
+ pbp = pbp->next;
+ }
+
+ pbp = xf86PciBus;
+ pbap = xf86PciBusAccInfo;
+
+ while (pbp) {
+ pbap->primary = NULL;
+ if (pbp->primary > -1) {
+ pbap_tmp = xf86PciBusAccInfo;
+ while (pbap_tmp) {
+ if (pbap_tmp->busdep.pci.bus == pbp->primary) {
+ pbap->primary = pbap_tmp;
+ break;
+ }
+ pbap_tmp = pbap_tmp->next;
+ }
+ /* set initial state */
+#if 0 /* before doing anything we close all bridges */
+ if (pbap->primary
+ && pbp->subclass == PCI_SUBCLASS_BRIDGE_PCI
+ && pbp->brcontrol & 0x08)
+ pbap->primary->current = pbap;
+#endif
+ }
+ pbap = pbap->next;
+ pbp = pbp->next;
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
+static void
+PciStateEnter(void)
+{
+ pciAccPtr paccp;
+ int i = 0;
+
+ if (xf86PciAccInfo == NULL)
+ return;
+
+ while ((paccp = xf86PciAccInfo[i]) != NULL) {
+ i++;
+ if (!paccp->ctrl)
+ continue;
+ savePciState(paccp->arg.tag, &paccp->save);
+ restorePciState(paccp->arg.tag, &paccp->restore);
+ }
+}
+
+static void
+PciBusStateEnter(void)
+{
+ BusAccPtr pbap = xf86PciBusAccInfo;
+
+ while (pbap) {
+ if (pbap->save_f)
+ pbap->save_f(pbap);
+ pbap = pbap->next;
+ }
+}
+
+static void
+PciStateLeave(void)
+{
+ pciAccPtr paccp;
+ int i = 0;
+
+ if (xf86PciAccInfo == NULL)
+ return;
+
+ while ((paccp = xf86PciAccInfo[i]) != NULL) {
+ i++;
+ if (!paccp->ctrl)
+ continue;
+ savePciState(paccp->arg.tag, &paccp->restore);
+ restorePciState(paccp->arg.tag, &paccp->save);
+ }
+}
+
+static void
+PciBusStateLeave(void)
+{
+ BusAccPtr pbap = xf86PciBusAccInfo;
+
+ while (pbap) {
+ if (pbap->restore_f)
+ pbap->restore_f(pbap);
+ pbap = pbap->next;
+ }
+}
+
+static void
+DisablePciAccess(void)
+{
+ int i = 0;
+ pciAccPtr paccp;
+ if (xf86PciAccInfo == NULL)
+ return;
+
+ while ((paccp = xf86PciAccInfo[i]) != NULL) {
+ i++;
+ if (!paccp->ctrl) /* disable devices that are under control initially*/
+ continue;
+ pciIo_MemAccessDisable(paccp->io_memAccess.arg);
+ }
+}
+
+static void
+disablePciBios(PCITAG tag)
+{
+ pciSetBitsLong(tag, PCI_CMD_BIOS_REG, PCI_CMD_BIOS_ENABLE, 0);
+}
+
+static void
+DisablePciBusAccess(void)
+{
+ BusAccPtr pbap = xf86PciBusAccInfo;
+
+ while (pbap) {
+ if (pbap->disable_f)
+ pbap->disable_f(pbap);
+ if (pbap->primary)
+ pbap->primary->current = NULL;
+ pbap = pbap->next;
+ }
+}
+
+/*
+ * xf86IsPrimaryPci() -- return TRUE if primary device
+ * is PCI and bus, dev and func numbers match.
+ */
+
+Bool
+xf86IsPrimaryPci(pciVideoPtr pPci)
+{
+ if (primaryBus.type != BUS_PCI) return FALSE;
+ return (pPci->bus == primaryBus.id.pci.bus &&
+ pPci->device == primaryBus.id.pci.device &&
+ pPci->func == primaryBus.id.pci.func);
+}
+
+/*
+ * xf86IsPrimaryIsa() -- return TRUE if primary device
+ * is ISA.
+ */
+
+Bool
+xf86IsPrimaryIsa(void)
+{
+ return ( primaryBus.type == BUS_ISA );
+}
+
+/*
+ * Generic VGA IO part - add other buses here
+ */
+
+void
+xf86EntityInit(void)
+{
+ int i;
+ resPtr *pprev_next;
+ resPtr res;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityInit) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ /* remove init resources after init is processed */
+ pprev_next = &Acc;
+ res = Acc;
+ while (res) {
+ if (res->res_type & ResInit && (res->entityIndex == i)) {
+ (*pprev_next) = res->next;
+ xfree(res);
+ } else
+ pprev_next = &(res->next);
+ res = (*pprev_next);
+ }
+ }
+}
+
+static void
+EntityEnter(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityEnter) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+static void
+EntityLeave(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityLeave) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+static void
+disableAccess(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+ EntityAccessPtr peacc;
+
+ /* call disable funcs and reset current access pointer */
+ /* the entity specific access funcs are in an enabled */
+ /* state - driver must restore their state explicitely */
+ for (i = 0; i < xf86NumScreens; i++) {
+ peacc = xf86Screens[i]->CurrentAccess->pIoAccess;
+ while (peacc) {
+ if (peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ peacc = peacc->next;
+ }
+ xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
+ peacc = xf86Screens[i]->CurrentAccess->pMemAccess;
+ while (peacc) {
+ if (peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ peacc = peacc->next;
+ }
+ xf86Screens[i]->CurrentAccess->pMemAccess = NULL;
+ }
+ /* then call the generic entity disable funcs */
+ for (i = 0; i < xf86NumEntities; i++) {
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+/*
+ * xf86AccessInit() - set up everything needed for access control
+ * called only once on first server generation.
+ */
+
+void
+xf86AccessInit(void)
+{
+ initPciState();
+ initPciBusState();
+ DisablePciBusAccess();
+ DisablePciAccess();
+
+ xf86ResAccessEnter = TRUE;
+}
+
+/*
+ * xf86AccessEnter() -- gets called to save the text mode VGA IO
+ * resources when reentering the server after a VT switch.
+ */
+
+void
+xf86AccessEnter(void)
+{
+ if (xf86ResAccessEnter)
+ return;
+
+ /*
+ * on enter we simply disable routing of special resources
+ * to any bus and let the RAC code to "open" the right bridges.
+ */
+ PciBusStateEnter();
+ DisablePciBusAccess();
+ PciStateEnter();
+ disableAccess();
+ EntityEnter();
+ xf86EnterServerState(SETUP);
+ xf86ResAccessEnter = TRUE;
+}
+
+/*
+ * xf86AccessLeave() -- prepares access for and calls the
+ * entityLeave() functions.
+ * xf86AccessLeaveState() --- gets called to restore the
+ * access to the VGA IO resources when switching VT or on
+ * server exit.
+ * This was split to call xf86AccessLeaveState() from
+ * ddxGiveUp().
+ */
+
+void
+xf86AccessLeave(void)
+{
+ if (!xf86ResAccessEnter)
+ return;
+ disableAccess();
+ DisablePciBusAccess();
+ EntityLeave();
+}
+
+void
+xf86AccessLeaveState(void)
+{
+ if (!xf86ResAccessEnter)
+ return;
+ xf86ResAccessEnter = FALSE;
+ PciStateLeave();
+ PciBusStateLeave();
+}
+
+/*
+ * xf86EnableAccess() -- enable access to controlled resources.
+ * To reduce latency when switching access the ScrnInfoRec has
+ * a linked list of the EntityAccPtr of all screen entities.
+ */
+/*
+ * switching access needs to be done in te following oder:
+ * disable
+ * 1. disable old entity
+ * 2. reroute bus
+ * 3. enable new entity
+ * Otherwise resources needed for access control might be shadowed
+ * by other resources!
+ */
+void
+xf86EnableAccess(ScrnInfoPtr pScrn)
+{
+ register EntityAccessPtr peAcc = (EntityAccessPtr) pScrn->access;
+ register EntityAccessPtr pceAcc;
+ register xf86AccessPtr pAcc;
+ EntityAccessPtr tmp;
+#ifdef DEBUG
+ ErrorF("Enable access %i\n",pScrn->scrnIndex);
+#endif
+
+ /* Entity is not under access control or currently enabled */
+ if (!pScrn->access) {
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ return;
+ }
+
+ switch (pScrn->resourceType) {
+ case IO:
+ pceAcc = pScrn->CurrentAccess->pIoAccess;
+ if (peAcc == pceAcc) {
+#if 0
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+#endif
+ return;
+ }
+ if (pScrn->CurrentAccess->pMemAccess == pceAcc)
+ pScrn->CurrentAccess->pMemAccess = NULL;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if ( pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case MEM_IO:
+ pceAcc = pScrn->CurrentAccess->pIoAccess;
+ if (peAcc != pceAcc) { /* current Io != pAccess */
+ tmp = pceAcc;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (peAcc != pceAcc /* current Mem != pAccess */
+ && tmp !=pceAcc) {
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ }
+ } else { /* current Io == pAccess */
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (pceAcc == peAcc) { /* current Mem == pAccess */
+#if 0
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+#endif
+ return;
+ }
+ while (pceAcc) { /* current Mem != pAccess */
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pMemAccess =
+ pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case MEM:
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (peAcc == pceAcc) {
+#if 0
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+#endif
+ return;
+ }
+ if (pScrn->CurrentAccess->pIoAccess == pceAcc)
+ pScrn->CurrentAccess->pIoAccess = NULL;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if ( pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case NONE:
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ return;
+ }
+}
+
+void
+xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io, xf86AccessPtr p_mem,
+ xf86AccessPtr p_io_mem, xf86AccessPtr *ppAccessOld)
+{
+ AccessFuncPtr rac;
+
+ if (!xf86Entities[pEnt->index]->rac)
+ xf86Entities[pEnt->index]->rac = xnfcalloc(1,sizeof(AccessFuncRec));
+
+ rac = xf86Entities[pEnt->index]->rac;
+
+ if (p_mem == p_io_mem && p_mem && p_io)
+ xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_MEM_FROM_IO;
+ if (p_io == p_io_mem && p_mem && p_io)
+ xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_IO_FROM_MEM;
+
+ rac->mem_new = p_mem;
+ rac->io_new = p_io;
+ rac->io_mem_new = p_io_mem;
+
+ rac->old = ppAccessOld;
+}
+
+/*------------------------------------------------------------*/
+static void CheckGenericGA(void);
+
+/*
+ * xf86FindPrimaryDevice() - Find the display device which
+ * was active when the server was started. Side effects:
+ * - disable IO access to all VGA/8514 display adaptors
+ * if possible.
+ */
+void
+xf86FindPrimaryDevice()
+{
+ /* if no VGA device is found check for primary PCI device */
+ if (primaryBus.type == BUS_NONE)
+ CheckGenericGA();
+}
+
+#include "vgaHW.h"
+#include "compiler.h"
+
+/*
+ * CheckGenericGA() - Check for presence of a VGA device.
+ */
+static void
+CheckGenericGA()
+{
+#if !defined(__sparc__) && !defined(__powerpc__) /* FIXME ?? */
+ CARD16 GenericIOBase = VGAHW_GET_IOBASE();
+ CARD8 CurrentValue, TestValue;
+
+ /* VGA CRTC registers are not used here, so don't bother unlocking them */
+
+ /* VGA has one more read/write attribute register than EGA */
+ (void) inb(GenericIOBase + 0x0AU); /* Reset flip-flop */
+ outb(0x3C0, 0x14 | 0x20);
+ CurrentValue = inb(0x3C1);
+ outb(0x3C0, CurrentValue ^ 0x0F);
+ outb(0x3C0, 0x14 | 0x20);
+ TestValue = inb(0x3C1);
+ outb(0x3C0, CurrentValue);
+
+ if ((CurrentValue ^ 0x0F) == TestValue) {
+ primaryBus.type = BUS_ISA;
+ }
+#endif
+}
+
+/*
+ * xf86CheckPciGAType() -- return type of PCI graphics adapter.
+ */
+int
+xf86CheckPciGAType(pciVideoPtr pPci)
+{
+ int i = 0;
+ pciConfigPtr pcp;
+
+ while ((pcp = xf86PciInfo[i]) != NULL) {
+ if (pPci->bus == pcp->busnum && pPci->device == pcp->devnum
+ && pPci->func == pcp->funcnum) {
+ if (pcp->pci_base_class == PCI_CLASS_PREHISTORIC &&
+ pcp->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA)
+ return PCI_CHIP_VGA ;
+ if (pcp->pci_base_class == PCI_CLASS_DISPLAY &&
+ pcp->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA) {
+ if (pcp->pci_prog_if == 0)
+ return PCI_CHIP_VGA ;
+ if (pcp->pci_prog_if == 1)
+ return PCI_CHIP_8514;
+ }
+ return -1;
+ }
+ i++;
+ }
+ return -1;
+}
+
+/* new RAC */
+
+static memType
+getMask(memType val)
+{
+ memType mask = 0;
+ memType tmp = 0;
+
+ mask=~mask;
+ tmp = ~((~tmp) >> 1);
+
+ while (!(val & tmp)) {
+ mask = mask >> 1;
+ val = val << 1;
+ }
+ return mask;
+}
+
+/*
+ * checkConflictBlock() -- check for conflicts of a block resource range.
+ * If conflict is found return end of conflicting range. Else return 0.
+ */
+static memType
+checkConflictBlock(resRange *range, resPtr pRes)
+{
+ memType val,tmp,prev;
+ int i;
+
+ switch (pRes->res_type & ResExtMask) {
+ case ResBlock:
+ if (range->rBegin < pRes->block_end &&
+ range->rEnd > pRes->block_begin)
+ return pRes->block_end < range->rEnd ?
+ pRes->block_end : range->rEnd;
+ return 0;
+ case ResSparse:
+ if (pRes->sparse_base > range->rEnd) return 0;
+
+ val = (~pRes->sparse_mask | pRes->sparse_base) & getMask(range->rEnd);
+#ifdef DEBUG
+ ErrorF("base = 0x%lx, mask = 0x%lx, begin = 0x%lx, end = 0x%lx ,"
+ "val = 0x%lx\n",
+ pRes->sparse_base, pRes->sparse_mask, range->rBegin,
+ range->rEnd, val);
+#endif
+ i = sizeof(memType) * 8;
+ tmp = prev = pRes->sparse_base;
+
+ while (i) {
+#ifdef DEBUG
+ ErrorF("tmp = 0x%lx\n",tmp);
+#endif
+ tmp |= 1<< (--i) & val;
+ if (tmp > range->rEnd)
+ tmp = prev;
+ else
+ prev = tmp;
+ }
+ if (tmp >= range->rBegin) {
+#ifdef DEBUG
+ ErrorF("conflict found at: 0x%lx\n",tmp);
+#endif
+ return tmp;
+ }
+ else
+ return 0;
+ }
+ return 0;
+}
+
+/*
+ * checkConflictSparse() -- check for conflicts of a sparse resource range.
+ * If conflict is found return base of conflicting region. Else return 0.
+ */
+#define mt_max ~(memType)0
+#define length sizeof(memType) * 8
+static memType
+checkConflictSparse(resRange *range, resPtr pRes)
+{
+ memType val, tmp, prev;
+ int i;
+
+ switch (pRes->res_type & ResExtMask) {
+ case ResSparse:
+ tmp = pRes->sparse_mask & range->rMask;
+ if ((tmp & pRes->sparse_base) == (tmp & range->rBase))
+ return pRes->sparse_mask;
+ return 0;
+
+ case ResBlock:
+ if (pRes->block_end < range->rBase) return 0;
+
+ val = (~range->rMask | range->rBase) & getMask(pRes->block_end);
+ i = length;
+ tmp = prev = range->rBase;
+
+ while (i) {
+#ifdef DEBUG
+ ErrorF("tmp = 0x%lx\n",tmp);
+#endif
+ tmp |= 1<< (--i) & val;
+ if (tmp > pRes->block_end)
+ tmp = prev;
+ else
+ prev = tmp;
+ }
+ if (tmp < pRes->block_begin)
+ return 0;
+ else {
+ /*
+ * now we subdivide the block region in sparse regions
+ * with base values = 2^n and find the smallest mask.
+ * This might be done in a simpler way....
+ */
+ memType mask, m_mask = 0, base = pRes->block_begin;
+ int i;
+ while (base < pRes->block_end) {
+ for (i = 1; i < length; i++)
+ if ( base != (base & (mt_max << i))) break;
+ mask = mt_max >> (length - i);
+ do mask >>= 1;
+ while ((mask + base + 1) > pRes->block_end);
+ /* m_mask and are _inverted_ sparse masks */
+ m_mask = mask > m_mask ? mask : m_mask;
+ base = base + mask + 1;
+ }
+#ifdef DEBUG
+ ErrorF("conflict found at: 0x%lx\n",tmp);
+#endif
+ return ~m_mask;
+ }
+ }
+ return 0;
+}
+#undef mt_max
+#undef length
+
+/*
+ * needCheck() -- this function decides whether to check for conflicts
+ * depending on the types of the resource ranges and their locations
+ */
+static Bool
+needCheck(resPtr pRes, long type, int entityIndex, xf86State state)
+{
+ /* the same entity shouldn't conflict with itself */
+ ScrnInfoPtr pScrn;
+ int i;
+ BusType loc = BUS_NONE;
+ BusType r_loc = BUS_NONE;
+
+ if (!((pRes->res_type & type) & ResPhysMask)) return FALSE;
+
+ /*
+ * Resources set by BIOS (ResBios) are allowed to conflict
+ * with resources marked (ResBios).
+ */
+ if (pRes->res_type & type & ResBios)
+ return FALSE;
+
+ if (type & pRes->res_type & ResUnused) return FALSE;
+
+ if (state == OPERATING) {
+ if (type & ResDisableOpr || pRes->res_type & ResDisableOpr)
+ return FALSE;
+ if (type & pRes->res_type & ResUnusedOpr) return FALSE;
+ /*
+ * Maybe we should have ResUnused set The resUnusedOpr
+ * bit, too. This way we could avoid this confusion
+ */
+ if ((type & ResUnusedOpr && pRes->res_type & ResUnused) ||
+ (type & ResUnused && pRes->res_type & ResUnusedOpr))
+ return FALSE;
+ }
+
+ if (entityIndex > -1)
+ loc = xf86Entities[entityIndex]->busType;
+ if (pRes->entityIndex > -1)
+ r_loc = xf86Entities[pRes->entityIndex]->busType;
+
+ switch (type & ResAccMask) {
+ case ResExclusive:
+ switch (pRes->res_type & ResAccMask) {
+ case ResExclusive:
+ break;
+ case ResShared:
+ /* ISA buses are only locally exclusive on a PCI system */
+ if (loc == BUS_ISA && r_loc == BUS_PCI)
+ return FALSE;
+ break;
+ }
+ break;
+ case ResShared:
+ switch (pRes->res_type & ResAccMask) {
+ case ResExclusive:
+ /* ISA buses are only locally exclusive on a PCI system */
+ if (loc == BUS_PCI && r_loc == BUS_ISA)
+ return FALSE;
+ break;
+ case ResShared:
+ return FALSE;
+ }
+ break;
+ case ResAny:
+ break;
+ }
+
+ if (pRes->entityIndex == entityIndex) return FALSE;
+
+ if (pRes->entityIndex > -1 &&
+ (pScrn = xf86FindScreenForEntity(entityIndex))) {
+ for (i = 0; i < pScrn->numEntities; i++)
+ if (pScrn->entityList[i] == pRes->entityIndex) return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * checkConflict() - main conflict checking function which all other
+ * function call.
+ */
+static memType
+checkConflict(resRange *rgp, resPtr pRes, int entityIndex, xf86State state)
+{
+ memType ret;
+
+ while(pRes) {
+ if (!needCheck(pRes,rgp->type, entityIndex ,state)) {
+ pRes = pRes->next;
+ continue;
+ }
+ switch (rgp->type & ResExtMask) {
+ case ResBlock:
+ if (rgp->rEnd < rgp->rBegin) {
+ xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
+ rgp->rEnd,rgp->rBegin);
+ return 0;
+ }
+ if ((ret = checkConflictBlock(rgp, pRes)))
+ return ret;
+ break;
+ case ResSparse:
+ if ((rgp->rBase & rgp->rMask) != rgp->rBase) {
+ xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
+ "doesn't satisfy (base & mask = mask)\n",
+ rgp->rBase, rgp->rMask);
+ return 0;
+ }
+ if ((ret = checkConflictSparse(rgp, pRes)))
+ return ret;
+ break;
+ }
+ pRes = pRes->next;
+ }
+ return 0;
+}
+
+/*
+ * ChkConflict() -- used locally ; find conflict with any location.
+ */
+static memType
+ChkConflict(resRange *rgp, resPtr res, xf86State state)
+{
+ return checkConflict(rgp, res, -2, state);
+}
+
+/*
+ * xf86ChkConflict() - This function is the low level interface to
+ * the resource broker that gets exported. Tests all resources ie.
+ * performs test with SETUP flag.
+ */
+memType
+xf86ChkConflict(resRange *rgp, int entityIndex)
+{
+ return checkConflict(rgp, Acc, entityIndex, SETUP);
+}
+
+resPtr
+xf86JoinResLists(resPtr rlist1, resPtr rlist2)
+{
+ resPtr pRes;
+
+ if (!rlist1)
+ return rlist2;
+
+ if (!rlist2)
+ return rlist1;
+
+ for (pRes = rlist1; pRes->next; pRes = pRes->next)
+ ;
+ pRes->next = rlist2;
+ return rlist1;
+}
+
+resPtr
+xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
+{
+ resPtr new;
+
+ switch (range->type & ResExtMask) {
+ case ResBlock:
+ if (range->rEnd < range->rBegin) {
+ xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
+ range->rEnd,range->rBegin);
+ return rlist;
+ }
+ break;
+ case ResSparse:
+ if ((range->rBase & range->rMask) != range->rBase) {
+ xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
+ "doesn't satisfy (base & mask = mask)\n",
+ range->rBase, range->rMask);
+ return rlist;
+ }
+ break;
+ }
+
+ new = xnfalloc(sizeof(resRec));
+ new->val = *range;
+ new->entityIndex = entityIndex;
+ new->next = rlist;
+ return new;
+}
+
+void
+xf86FreeResList(resPtr rlist)
+{
+ resPtr pRes;
+
+ if (!rlist)
+ return;
+
+ for (pRes = rlist->next; pRes; rlist = pRes, pRes = pRes->next)
+ xfree(rlist);
+ xfree(rlist);
+}
+
+resPtr
+xf86DupResList(const resPtr rlist)
+{
+ resPtr pRes, ret, prev, new;
+
+ if (!rlist)
+ return NULL;
+
+ ret = xnfalloc(sizeof(resRec));
+ *ret = *rlist;
+ prev = ret;
+ for (pRes = rlist->next; pRes; pRes = pRes->next) {
+ new = xnfalloc(sizeof(resRec));
+ *new = *pRes;
+ prev->next = new;
+ prev = new;
+ }
+ return ret;
+}
+
+void
+xf86PrintResList(int verb, resPtr list)
+{
+ int i = 0;
+ const char *s, *r;
+ resPtr tmp = list;
+ long type;
+
+ if (!list)
+ return;
+
+ type = ResMem;
+ r = "M";
+ while (1) {
+ while (list) {
+ if ((list->res_type & ResPhysMask) == type) {
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x (0x%x)",
+ i, list->entityIndex, list->block_begin,
+ list->block_end,
+ list->block_end - list->block_begin + 1);
+ break;
+ case ResSparse:
+ xf86ErrorFVerb(verb, "\t[%d] %d\t0x%08x - 0x%08x ",
+ i, list->entityIndex,
+ list->sparse_base,list->sparse_mask);
+ break;
+ default:
+ list = list->next;
+ continue;
+ }
+ xf86ErrorFVerb(verb, " %s", r);
+ switch (list->res_type & ResAccMask) {
+ case ResExclusive:
+ if (list->res_type & ResUnused)
+ s = "x";
+ else
+ s = "X";
+ break;
+ case ResShared:
+ if (list->res_type & ResUnused)
+ s = "s";
+ else
+ s = "S";
+ break;
+ default:
+ s = "?";
+ }
+ xf86ErrorFVerb(verb, "%s", s);
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ s = "B";
+ break;
+ case ResSparse:
+ s = "S";
+ break;
+ default:
+ s = "?";
+ }
+ xf86ErrorFVerb(verb, "%s", s);
+ if (list->res_type & ResEstimated)
+ xf86ErrorFVerb(verb, "E");
+ if (list->res_type & ResInit)
+ xf86ErrorFVerb(verb, "t");
+ if (list->res_type & ResBios)
+ xf86ErrorFVerb(verb, "(B)");
+ xf86ErrorFVerb(verb, "\n");
+ i++;
+ }
+ list = list->next;
+ }
+ if (type == ResIo) break;
+ type = ResIo;
+ r = "I";
+ list = tmp;
+ }
+}
+
+#define MEM_ALIGN (1024 * 1024)
+
+/*
+ * RemoveOverlaps() -- remove overlaps between resources of the
+ * same kind.
+ * Beware: This function doesn't check for access attributes.
+ * At resource broker initialization this is no problem as this
+ * only deals with exclusive resources.
+ */
+static void
+RemoveOverlaps(resPtr target, resPtr list, Bool pciAlignment)
+{
+ resPtr pRes;
+ memType size, newsize, adjust;
+
+ for (pRes = list; pRes; pRes = pRes->next) {
+ if (pRes != target
+ && ((pRes->res_type & ResPhysMask) ==
+ (target->res_type & ResPhysMask))
+ && pRes->block_begin <= target->block_end
+ && pRes->block_end >= target->block_begin) {
+ /*
+ * target should be a larger region than pRes. If pRes fully
+ * contains target, don't do anything.
+ */
+ if (pRes->block_begin <= target->block_begin &&
+ pRes->block_end >= target->block_end)
+ continue;
+ /*
+ * cases where the target and pRes have the same starting address
+ * cannot be resolved, so skip them (with a warning).
+ */
+ if (pRes->block_begin == target->block_begin) {
+ xf86MsgVerb(X_WARNING, 3, "Unresolvable overlap at 0x%08x\n",
+ pRes->block_begin);
+ continue;
+ }
+ /* Otherwise, trim target to remove the overlap */
+ if (pRes->block_begin <= target->block_end) {
+ target->block_end = pRes->block_begin - 1;
+ } else if (!pciAlignment &&
+ pRes->block_end >= target->block_begin) {
+ target->block_begin = pRes->block_end + 1;
+ }
+ if (pciAlignment) {
+ /*
+ * Align to a power of two. This requires finding the
+ * largest power of two that is smaller than the adjusted
+ * size.
+ */
+ size = target->block_end - target->block_begin + 1;
+ newsize = 1UL << (sizeof(memType) * 8 - 1);
+ while (!(newsize & size))
+ newsize >>= 1;
+ target->block_end = target->block_begin + newsize - 1;
+ } else if (target->block_end > MEM_ALIGN) {
+ /* Align the end to MEM_ALIGN */
+ if ((adjust = (target->block_end + 1) % MEM_ALIGN))
+ target->block_end -= adjust;
+ }
+ }
+ }
+}
+
+#define PSR_SYS 0x01 /* non-display devices */
+#define PSR_NONSYS 0x02 /* display devices */
+#define PSR_ALL (PSR_SYS | PSR_NONSYS)
+#define PSR_VIDEO 0x04
+#define PSR_NO_OVERLAP 0x08
+
+static void
+xf86GetPciSysRes(resPtr *res, int flags)
+{
+ pciConfigPtr pcrp, *pcrpp;
+ pciVideoPtr pvp, *pvpp;
+ CARD32 *basep;
+ memType end;
+ resPtr sysRes = NULL, nonsysRes = NULL;
+ int i;
+ resPtr pRes;
+ int verb;
+ resRange range;
+ static Bool printed = FALSE;
+
+ if (!res || !xf86PciInfo)
+ return;
+
+ if (xf86PciVideoInfo)
+ for (pvpp = xf86PciVideoInfo, pvp = *pvpp; pvp; pvp = *(++pvpp)) {
+ if (!(flags & PSR_VIDEO) &&
+ !PCINONSYSTEMCLASSES(pvp->class, pvp->subclass))
+ continue;
+ for (i = 0; i < 6; i++) {
+ if (pvp->ioBase[i]) {
+ RANGE(range,pvp->ioBase[i],
+ pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
+ ResExcIoBlock | ResBios);
+ nonsysRes = xf86AddResToList(nonsysRes, &range,-1);
+ } else if (pvp->memBase[i]) {
+ RANGE(range,pvp->memBase[i],
+ pvp->memBase[i] + (1 << pvp->size[i]) - 1,
+ ResExcMemBlock | ResBios);
+ nonsysRes = xf86AddResToList(nonsysRes, &range, -1);
+ }
+ }
+ if (pvp->biosBase) {
+ RANGE(range, pvp->biosBase,
+ pvp->biosBase + (1 << pvp->biosSize) - 1,
+ ResExcMemBlock | ResBios);
+ nonsysRes = xf86AddResToList(nonsysRes, &range, -1);
+ }
+ }
+
+ /* No need to resolve overlaps for NONSYS, so can return here */
+ if (!(flags & PSR_SYS)) {
+ *res = nonsysRes;
+ return;
+ }
+
+ /* XXX Needs to be updated for 64 bit mappings */
+ for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) {
+ long resMisc;
+ if (PCINONSYSTEMCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class))
+ continue;
+ /* Only process devices with type 0 headers */
+ if ((pcrp->pci_header_type & 0x7f) != 0)
+ continue;
+ if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class))
+ resMisc = ResBios;
+ else
+ resMisc = ResEstimated;
+
+ basep = &pcrp->pci_base0;
+ for (i = 0; i < 6; i++) {
+ if (basep[i]) {
+ if (PCI_MAP_IS_IO(basep[i])) {
+ RANGE(range,PCIGETIO(basep[i]),
+ range.rBegin + (1 << pcrp->basesize[i]) - 1,
+ ResExcIoBlock | resMisc);
+ sysRes = xf86AddResToList(sysRes, &range, -1);
+ } else {
+ RANGE(range,PCIGETMEMORY(basep[i]),
+ range.rBegin + (1 << pcrp->basesize[i]) - 1,
+ ResExcMemBlock | resMisc);
+ sysRes = xf86AddResToList(sysRes, &range, -1);
+ }
+ }
+ }
+ if (pcrp->pci_baserom) {
+ RANGE(range,PCIGETROM(pcrp->pci_baserom),
+ range.rBegin + (1 << pcrp->basesize[6]) - 1,
+ ResExcMemBlock | resMisc);
+ sysRes = xf86AddResToList(sysRes, &range, -1);
+ }
+ }
+
+ /* Only print the messages once unless very verbose */
+ if (!printed) {
+ printed = TRUE;
+ verb = 3;
+ } else {
+ verb = 5;
+ }
+ /* Check for overlaps */
+ if (flags & PSR_NO_OVERLAP) {
+ for (pRes = sysRes; pRes; pRes = pRes->next) {
+ resRange r = pRes->val;
+ r.type = (r.type & ResPhysMask) | ResExclusive | ResBlock;
+ r.type &= ~(CARD32)ResBios; /* remove for overlap checking */
+ if ((end = ChkConflict(&r, pRes->next, SETUP)))
+ xf86MsgVerb(X_INFO, verb,
+ "PCI %s Resource overlap for 0x%08x at 0x%08x\n",
+ (pRes->res_type & ResMem)?"Memory":"Io",
+ pRes->block_begin, end);
+ if ((end = ChkConflict(&r, nonsysRes, SETUP)))
+ xf86MsgVerb(X_INFO, verb,
+ "PCI %s Resource overlap for 0x%08x at 0x%08x\n",
+ (pRes->res_type & ResMem)?"Memory":"Io",
+ pRes->block_begin, end);
+ }
+ }
+
+ xf86MsgVerb(X_INFO, verb, "Non-system PCI resource ranges:\n");
+ xf86PrintResList(verb, nonsysRes);
+
+ /*
+ * Adjust ranges based on the assumption that there are no real
+ * overlaps in the PCI base allocations. This assumption should be
+ * reasonable in most cases. It may be possible to refine the
+ * approximated PCI base sizes by considering bus mapping information
+ * from PCI-PCI bridges.
+ */
+ xf86MsgVerb(X_INFO, verb, "System PCI resource ranges:\n");
+ xf86PrintResList(verb, sysRes);
+ if (flags & PSR_NO_OVERLAP) {
+ for (pRes = sysRes; pRes; pRes = pRes->next) {
+ if (ResIsEstimated(&pRes->val)) {
+ RemoveOverlaps(pRes, nonsysRes, TRUE);
+ RemoveOverlaps(pRes, sysRes, TRUE);
+ }
+ }
+ xf86MsgVerb(X_INFO, verb,
+ "System PCI resource ranges after removing overlaps:\n");
+ xf86PrintResList(verb, sysRes);
+ }
+
+ if (flags & (PSR_NONSYS | PSR_VIDEO)) {
+ *res = xf86JoinResLists(sysRes, nonsysRes);
+ } else {
+ xf86FreeResList(nonsysRes);
+ *res = sysRes;
+ }
+}
+
+static Bool fixPciResource(int prt, memType alignment,
+ pciVideoPtr pvp, long type);
+
+static void
+ValidatePci(void)
+{
+ pciVideoPtr pvp, pvp1;
+ PciBusPtr pbp, pbp1;
+ resPtr res_mp = NULL, res_m_io = NULL;
+ resPtr tmp, avoid;
+ resPtr Sys;
+ resPtr Fix;
+ resRange range;
+ int n = 0, m, i;
+
+ if (!xf86PciVideoInfo) return;
+
+ /*
+ * The order the video devices are listed in is
+ * just right: the lower buses come first.
+ * This way we attempt to fix a conflict of
+ * a lower bus device with a higher bus device
+ * where we have more room to find different
+ * resources.
+ */
+ while ((pvp = xf86PciVideoInfo[n++])) {
+ if (!pvp->validate) continue;
+ Sys = NULL;
+ m = n;
+ while ((pvp1 = xf86PciVideoInfo[m++])) {
+ if (!pvp1->validate) continue;
+ for (i = 0; i<6; i++) {
+ if (pvp1->ioBase[i]) {
+ RANGE(range,pvp1->ioBase[i],
+ pvp1->ioBase[i] + (1 << pvp1->size[i]) - 1,
+ ResExcIoBlock);
+ Sys = xf86AddResToList(Sys,&range,-1);
+ } else if (pvp1->memBase[i]) {
+ RANGE(range,pvp1->memBase[i],
+ pvp1->memBase[i] + (1 << pvp1->size[i]) - 1,
+ ResExcMemBlock);
+ Sys = xf86AddResToList(Sys,&range,-1);
+ }
+ }
+ }
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3,"Sys:\n");
+ xf86PrintResList(3,Sys);
+#endif
+ avoid = NULL;
+ pbp = pbp1 = xf86PciBus;
+ while (pbp) {
+ if (pbp->secondary == pvp->bus) {
+ if (pbp->pmem) {
+ /* keep prefetchable separate */
+ res_mp = findIntersectOfLists(pbp->pmem,ResRange);
+ }
+ if (pbp->mem) {
+ res_m_io = findIntersectOfLists(pbp->mem,ResRange);
+ }
+ if (pbp->io) {
+ res_m_io = xf86JoinResLists(res_m_io,
+ findIntersectOfLists(pbp->io,ResRange));
+ }
+ }
+ while (pbp1) {
+ if (pbp1->primary == pvp->bus) {
+ tmp = xf86DupResList(pbp1->pmem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ tmp = xf86DupResList(pbp1->mem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ tmp = xf86DupResList(pbp1->io);
+ avoid = xf86JoinResLists(avoid,tmp);
+ }
+ pbp1 = pbp1->next;
+ }
+ pbp = pbp->next;
+ }
+ if (res_m_io == NULL)
+ res_m_io = xf86DupResList(ResRange);
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3,"avoid:\n");
+ xf86PrintResList(3,avoid);
+ xf86MsgVerb(X_INFO, 3,"prefetchable Memory:\n");
+ xf86PrintResList(3,res_mp);
+ xf86MsgVerb(X_INFO, 3,"MEM/IO:\n");
+ xf86PrintResList(3,res_m_io);
+#endif
+ Fix = NULL;
+ for (i = 0; i < 6; i++) {
+ int j;
+ resPtr own = NULL;
+ for (j = i+1; j < 6; j++) {
+ if (pvp->ioBase[j]) {
+ RANGE(range,pvp->ioBase[j],
+ pvp->ioBase[j] + (1 << pvp->size[j]) - 1,
+ ResExcIoBlock);
+ own = xf86AddResToList(own,&range,-1);
+ } else if (pvp->memBase[j]) {
+ RANGE(range,pvp->memBase[j],
+ pvp->memBase[j] + (1 << pvp->size[j]) - 1,
+ ResExcMemBlock);
+ own = xf86AddResToList(own,&range,-1);
+ }
+ }
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3,"own:\n");
+ xf86PrintResList(3,own);
+#endif
+ if (pvp->ioBase[i]) {
+ RANGE(range,pvp->ioBase[i],
+ pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
+ ResExcIoBlock);
+ if (isSubsetOf(range,res_m_io)
+ && ! ChkConflict(&range,own,SETUP)
+ && ! ChkConflict(&range,avoid,SETUP)
+ && ! ChkConflict(&range,Sys,SETUP))
+ continue;
+ xf86MsgVerb(X_WARNING, 0,
+ "****INVALID IO ALLOCATION**** b: 0x%lx e: 0x%lx "
+ "correcting\a\n", range.rBegin,range.rEnd);
+#ifdef DEBUG
+ sleep(2);
+#endif
+ fixPciResource(i, 0, pvp, range.type);
+ } else if (pvp->memBase[i]) {
+ RANGE(range,pvp->memBase[i],
+ pvp->memBase[i] + (1 << pvp->size[i]) - 1,
+ ResExcMemBlock);
+ if (pvp->type[i] & PCI_MAP_MEMORY_CACHABLE) {
+ if (isSubsetOf(range,res_mp)
+ && ! ChkConflict(&range,own,SETUP)
+ && ! ChkConflict(&range,avoid,SETUP)
+ && ! ChkConflict(&range,Sys,SETUP))
+ continue;
+ }
+ if (isSubsetOf(range,res_m_io)
+ && ! ChkConflict(&range,own,SETUP)
+ && ! ChkConflict(&range,avoid,SETUP)
+ && ! ChkConflict(&range,Sys,SETUP))
+ continue;
+ xf86MsgVerb(X_WARNING, 0,
+ "****INVALID MEM ALLOCATION**** b: 0x%lx e: 0x%lx "
+ "correcting\a\n", range.rBegin,range.rEnd);
+#ifdef DEBUG
+ sleep(2);
+#endif
+ fixPciResource(i, 0, pvp, range.type);
+ }
+ xf86FreeResList(own);
+ }
+ xf86FreeResList(avoid);
+ xf86FreeResList(Sys);
+ xf86FreeResList(res_mp);
+ xf86FreeResList(res_m_io);
+ }
+ return;
+}
+
+
+static resList
+GetImplicitPciResources(int entityIndex)
+{
+ pciVideoPtr pvp;
+ int i;
+ resList list = NULL;
+
+ int num = 0;
+
+ if (! (pvp = xf86GetPciInfoForEntity(entityIndex))) return NULL;
+
+ for (i = 0; i < 6; i++) {
+ if (pvp->ioBase[i]) {
+ list = xnfrealloc(list,sizeof(resRange) * (++num));
+ RANGE(list[num - 1],pvp->ioBase[i],
+ pvp->ioBase[i] + (1 << pvp->size[i]) - 1,
+ ResShrIoBlock | ResBios);
+ } else if (pvp->memBase[i]) {
+ list = xnfrealloc(list,sizeof(resRange) * (++num));
+ RANGE(list[num - 1],pvp->memBase[i],
+ pvp->memBase[i] + (1 << pvp->size[i]) - 1,
+ ResShrMemBlock | ResBios);
+ }
+ }
+ if (pvp->biosBase) {
+ list = xnfrealloc(list,sizeof(resRange) * (++num));
+ RANGE(list[num - 1], pvp->biosBase,
+ pvp->biosBase + (1 << pvp->biosSize) - 1,
+ ResShrMemBlock | ResBios);
+ }
+ list = xnfrealloc(list,sizeof(resRange) * (++num));
+ list[num - 1].type = ResEnd;
+
+ return list;
+}
+
+void
+xf86ResourceBrokerInit(void)
+{
+ resPtr resPci = NULL;
+ resPtr pRes = NULL, tmp;
+
+ /* Get the addressable ranges */
+ ResRange = xf86AccWindowsFromOS();
+ xf86MsgVerb(X_INFO, 3, "Addressable resource ranges are\n");
+ xf86PrintResList(3, ResRange);
+
+ /* Get the ranges used exclusively by the system */
+ pRes = xf86AccResFromOS(pRes);
+
+ /* Get bus-specific system resources (PCI) */
+ xf86GetPciSysRes(&resPci, PSR_SYS | PSR_NO_OVERLAP);
+
+ /*
+ * Adjust OS-reported resource ranges based on the assumption that there
+ * are no overlaps with the PCI base allocations. This should be a good
+ * assumption because writes to PCI address space won't be routed directly
+ * host memory.
+ */
+ xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges:\n");
+ xf86PrintResList(3, pRes);
+
+ for (tmp = pRes; tmp; tmp = tmp->next)
+ RemoveOverlaps(tmp, resPci, FALSE);
+
+ xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges after removing"
+ " overlaps with PCI:\n");
+ xf86PrintResList(3, pRes);
+
+ pRes = xf86JoinResLists(pRes, resPci);
+ xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n");
+ xf86PrintResList(3, pRes);
+
+ resPci = NULL;
+ xf86GetPciSysRes(&resPci, PSR_NONSYS);
+ /* Initialise the OS-layer PCI allocator */
+ xf86PciBus = xf86InitOSPciAllocator(xf86PciInfo, &pRes, resPci);
+ Acc = pRes;
+
+}
+
+/*
+ * xf86ClaimFixedResources() -- This function gets called from the
+ * driver Probe() function to claim fixed resources.
+ */
+static void
+resError(resList list)
+{
+ FatalError("The driver tried to allocate the %s %sresource at \n"
+ "0x%x:0x%x which collided with a resource. Send the\n"
+ "output of the server to xfree86@xfree86.org. Please \n"
+ "specify your computer hardware as closely as possible\n",
+ ResIsBlock(list)?"Block":"Sparse",
+ ResIsMem(list)?"Mem":"Io",
+ ResIsBlock(list)?list->rBegin:list->rBase,
+ ResIsBlock(list)?list->rEnd:list->rMask);
+}
+
+/*
+ * xf86ClaimFixedResources() is used to allocate static
+ * (ie. fixed non-sharable reosurces).
+ */
+void
+xf86ClaimFixedResources(resList list, int entityIndex)
+{
+ resPtr ptr = NULL;
+
+ if (!list) return;
+
+ while (list->type !=ResEnd) {
+ switch (list->type & ResAccMask) {
+ case ResExclusive:
+ if (!xf86ChkConflict(list, entityIndex)) {
+ list->type &= ~ResBios;
+ Acc = xf86AddResToList(Acc,list,entityIndex);
+ } else resError(list); /* no return */
+ break;
+ case ResShared:
+ /* at this stage the resources are just added to the
+ * EntityRec. After the Probe() phase this list is checked by
+ * xf86PostProbe(). All resources which don't
+ * conflict with already allocated ones are allocated
+ * and removed from the EntityRec. Thus a non-empty resource
+ * list in the EntityRec indicates resource conflicts the
+ * driver should either handle or fail.
+ */
+ if (xf86Entities[entityIndex]->active)
+ ptr = xf86AddResToList(ptr,list,entityIndex);
+ break;
+ }
+ list++;
+ }
+ xf86Entities[entityIndex]->resources =
+ xf86JoinResLists(xf86Entities[entityIndex]->resources,ptr);
+ xf86MsgVerb(X_INFO, 3,
+ "resource ranges after xf86ClaimFixedResources() call:\n");
+ xf86PrintResList(3,Acc);
+#ifdef DEBUG
+ if (ptr) {
+ xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
+ xf86PrintResList(3,ptr);
+ }
+#endif
+}
+
+static void
+checkRoutingForScreens(xf86State state)
+{
+ resList list = resVgaUnusedExclusive;
+ resPtr pResVGA = NULL;
+ pointer vga = NULL;
+ int i,j;
+ int entityIndex;
+ EntityPtr pEnt;
+ resPtr pAcc;
+
+ /*
+ * find devices that need VGA routed: ie the ones that have
+ * registered VGA resources without ResUnused. ResUnused
+ * doesn't conflict with itself therefore use it here.
+ */
+ while (list->type != ResEnd) {
+ pResVGA = xf86AddResToList(pResVGA,list,-1);
+ list++;
+ }
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ entityIndex = xf86Screens[i]->entityList[j];
+ pEnt = xf86Entities[entityIndex];
+ pAcc = Acc;
+ vga = NULL;
+ while (pAcc) {
+ if (pAcc->entityIndex == entityIndex)
+ if (checkConflict(&pAcc->val,pResVGA,
+ entityIndex,state)) {
+ if (vga && vga != pEnt->busAcc) {
+ xf86Msg(X_ERROR, "Screen %i needs vga routed to"
+ "different buses - deleting\n",i);
+ xf86DeleteScreen(i--,0);
+ }
+ vga = pEnt->busAcc;
+ pEnt->entityProp |= (state == SETUP
+ ? NEED_VGA_ROUTED_SETUP : NEED_VGA_ROUTED);
+ break;
+ }
+ pAcc = pAcc->next;
+ }
+ if (vga)
+ xf86MsgVerb(X_INFO, 3,"Setting vga for screen %i.\n",i);
+ }
+ }
+ xf86FreeResList(pResVGA);
+}
+
+
+/*
+ * xf86PostProbe() -- Allocate all non conflicting resources
+ * This function gets called by xf86Init().
+ */
+void
+xf86PostProbe(void)
+{
+ memType val;
+ int i,j;
+ resPtr resp, acc, tmp, resp_x, *pprev_next;
+
+ xf86SetPciVideo(NULL, MEM_IO);
+
+ /* don't compare against ResInit - remove it from clone.*/
+ acc = tmp = xf86DupResList(Acc);
+ pprev_next = &acc;
+ while (tmp) {
+ if (tmp->res_type & ResInit) {
+ (*pprev_next) = tmp->next;
+ xfree(tmp);
+ } else
+ pprev_next = &(tmp->next);
+ tmp = (*pprev_next);
+ }
+
+ for (i=0; i<xf86NumEntities; i++) {
+ resp = xf86Entities[i]->resources;
+ xf86Entities[i]->resources = NULL;
+ resp_x = NULL;
+ while (resp) {
+ if (! (val = checkConflict(&resp->val,acc,i,SETUP)))
+ {
+ tmp = resp_x;
+ resp_x = resp;
+ resp = resp->next;
+ resp_x->next = tmp;
+ } else {
+ xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
+ tmp = xf86Entities[i]->resources;
+ xf86Entities[i]->resources = resp;
+ resp = resp->next;
+ xf86Entities[i]->resources->next = tmp;
+ }
+ }
+ xf86JoinResLists(Acc,resp_x);
+ }
+ xf86FreeResList(acc);
+
+ ValidatePci();
+
+ xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n");
+ xf86PrintResList(3, Acc);
+ checkRoutingForScreens(SETUP);
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ pointer *route = NULL;
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ EntityPtr pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+ if (pEnt->entityProp & NEED_VGA_ROUTED_SETUP)
+ route = pEnt->busAcc;
+ if (route) {
+ xf86Screens[i]->busAccess = route;
+ break;
+ }
+ }
+ }
+}
+
+void
+xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
+{
+ if (entityIndex == -1)
+ return;
+ if (xf86Entities[entityIndex]->inUse)
+ FatalError("Requested Entity already in use!\n");
+
+ pScrn->numEntities++;
+ pScrn->entityList = xnfrealloc(pScrn->entityList,
+ pScrn->numEntities * sizeof(int));
+ pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
+ xf86Entities[entityIndex]->access->next = pScrn->access;
+ pScrn->access = xf86Entities[entityIndex]->access;
+ xf86Entities[entityIndex]->inUse = TRUE;
+}
+
+Bool
+xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ if (entityIndex >= xf86NumEntities)
+ return FALSE;
+ xf86Entities[entityIndex]->entityInit = init;
+ xf86Entities[entityIndex]->entityEnter = enter;
+ xf86Entities[entityIndex]->entityLeave = leave;
+ xf86Entities[entityIndex]->private = private;
+ return TRUE;
+}
+
+void
+xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
+{
+ int i;
+ EntityAccessPtr *ptr = (EntityAccessPtr *)&pScrn->access;
+ EntityAccessPtr peacc;
+
+ for (i = 0; i < pScrn->numEntities; i++) {
+ if (pScrn->entityList[i] == entityIndex) {
+ peacc = xf86Entities[pScrn->entityList[i]]->access;
+ (*ptr) = peacc->next;
+ /* disable entity: call disable func */
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ /* also disable fallback - just in case */
+ if (peacc->fallback && peacc->fallback->AccessDisable)
+ peacc->fallback->AccessDisable(peacc->fallback->arg);
+ for (i++; i < pScrn->numEntities; i++)
+ pScrn->entityList[i-1] = pScrn->entityList[i];
+ pScrn->numEntities--;
+ xf86Entities[entityIndex]->inUse = FALSE;
+ break;
+ }
+ ptr = &(xf86Entities[pScrn->entityList[i]]->access->next);
+ }
+}
+
+void
+xf86DeallocateResourcesForEntity(int entityIndex, long type)
+{
+ resPtr *pprev_next = &Acc;
+ resPtr res = Acc;
+
+ while (res) {
+ if (res->entityIndex == entityIndex &&
+ (type & ResAccMask & res->res_type))
+ {
+ (*pprev_next) = res->next;
+ xfree(res);
+ } else
+ pprev_next = &(res->next);
+ res = (*pprev_next);
+ }
+}
+
+/*
+ * xf86ClearEntitiesForScreen() - called when a screen is deleted
+ * to mark it's entities unused. Called by xf86DeleteScreen().
+ */
+void
+xf86ClearEntityListForScreen(int scrnIndex)
+{
+ int i;
+ EntityAccessPtr peacc;
+
+ if (xf86Screens[scrnIndex]->entityList == NULL
+ || xf86Screens[scrnIndex]->numEntities == 0) return;
+
+ for (i=0; i<xf86Screens[scrnIndex]->numEntities; i++) {
+ xf86Entities[xf86Screens[scrnIndex]->entityList[i]]->inUse = FALSE;
+ /* disable resource: call the disable function */
+ peacc = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]->access;
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ /* and the fallback function */
+ if (peacc->fallback && peacc->fallback->AccessDisable)
+ peacc->fallback->AccessDisable(peacc->fallback->arg);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(i, ResShared);
+ }
+ xfree(xf86Screens[scrnIndex]->entityList);
+ if (xf86Screens[scrnIndex]->CurrentAccess->pIoAccess
+ == (EntityAccessPtr) xf86Screens[scrnIndex]->access)
+ xf86Screens[scrnIndex]->CurrentAccess->pIoAccess = NULL;
+ if (xf86Screens[scrnIndex]->CurrentAccess->pMemAccess
+ == (EntityAccessPtr) xf86Screens[scrnIndex]->access)
+ xf86Screens[scrnIndex]->CurrentAccess->pMemAccess = NULL;
+ xf86Screens[scrnIndex]->entityList = NULL;
+}
+
+/*
+ * xf86GetEntityInfo() -- This function hands information from the
+ * EntityRec struct to the drivers. The EntityRec structure itself
+ * remains invisible to the driver.
+ */
+EntityInfoPtr
+xf86GetEntityInfo(int entityIndex)
+{
+ EntityInfoPtr pEnt;
+
+ if (entityIndex >= xf86NumEntities)
+ return NULL;
+
+ pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
+ pEnt->index = entityIndex;
+ pEnt->location = xf86Entities[entityIndex]->bus;
+ pEnt->active = xf86Entities[entityIndex]->active;
+ pEnt->chipset = xf86Entities[entityIndex]->chipset;
+ pEnt->resources = xf86Entities[entityIndex]->resources;
+ pEnt->device = xf86Entities[entityIndex]->device;
+
+ return pEnt;
+}
+
+/*
+ * xf86GetPciInfoForEntity() -- Get the pciVideoRec of entity.
+ */
+pciVideoPtr
+xf86GetPciInfoForEntity(int entityIndex)
+{
+ pciVideoPtr *ppPci;
+ EntityPtr p = xf86Entities[entityIndex];
+
+ if (entityIndex >= xf86NumEntities
+ || p->busType != BUS_PCI) return NULL;
+
+ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ if (p->pciBusId.bus == (*ppPci)->bus &&
+ p->pciBusId.device == (*ppPci)->device &&
+ p->pciBusId.func == (*ppPci)->func)
+ return (*ppPci);
+ }
+ return NULL;
+}
+
+ScrnInfoPtr
+xf86FindScreenForEntity(int entityIndex)
+{
+ int i,j;
+
+ if (entityIndex == -1) return NULL;
+
+ if (xf86Screens) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if ( xf86Screens[i]->entityList[j] == entityIndex )
+ return (xf86Screens[i]);
+ }
+ }
+ }
+ return NULL;
+}
+
+#define ALIGN(x,a) ((x) + a) &~(a)
+
+resRange
+xf86GetBlock(long type, memType size,
+ memType window_start, memType window_end,
+ memType align_mask, resPtr avoid)
+{
+ memType min, max, tmp;
+ resRange r = {ResEnd,0,0};
+ resPtr res_range = ResRange;
+
+ if (!size) return r;
+ if (window_end < window_start || (window_end - window_start) < (size - 1)) {
+ ErrorF("Requesting insufficient memory window!:"
+ " start: 0x%lx end: 0x%lx size 0x%lx\n",
+ window_start,window_end,size);
+ return r;
+ }
+ type = (type & ~ResExtMask & ~ResNoAvoid) | ResBlock;
+
+ while (res_range) {
+ if (type & res_range->res_type & ResPhysMask) {
+ if (res_range->block_begin > window_start)
+ min = res_range->block_begin;
+ else
+ min = window_start;
+ if (res_range->block_end < window_end)
+ max = res_range->block_end;
+ else
+ max = window_end;
+ min = ALIGN(min,align_mask);
+ /* do not produce an overflow! */
+ while (min < max && (max - min) >= (size - 1)) {
+ RANGE(r,min,min + size - 1,type);
+ tmp = ChkConflict(&r,Acc,SETUP);
+ if (!tmp) {
+ tmp = ChkConflict(&r,avoid,SETUP);
+ if (!tmp) {
+ return r;
+ }
+ }
+ min = ALIGN(tmp,align_mask);
+ }
+ }
+ res_range = res_range->next;
+ }
+ RANGE(r,0,0,ResEnd);
+ return r;
+}
+
+#define mt_max ~(memType)0
+#define length sizeof(memType) * 8
+/*
+ * make_base() -- assign the lowest bits to the bits set in mask.
+ * example: mask 011010 val 0000110 -> 011000
+ */
+static memType
+make_base(memType val, memType mask)
+{
+ int i,j = 0;
+ memType ret = 0
+ ;
+ for (i = 0;i<length;i++) {
+ if ((1 << i) & mask) {
+ ret |= (((val >> j) & 1) << i);
+ j++;
+ }
+ }
+ return ret;
+}
+
+/*
+ * make_base() -- assign the bits set in mask to the lowest bits.
+ * example: mask 011010 , val 010010 -> 000011
+ */
+static memType
+unmake_base(memType val, memType mask)
+{
+ int i,j = 0;
+ memType ret = 0;
+
+ for (i = 0;i<length;i++) {
+ if ((1 << i) & mask) {
+ ret |= (((val >> i) & 1) << j);
+ j++;
+ }
+ }
+ return ret;
+}
+
+static memType
+fix_counter(memType val, memType old_mask, memType mask)
+{
+ mask = old_mask & mask;
+
+ val = make_base(val,old_mask);
+ return unmake_base(val,mask);
+}
+
+resRange
+xf86GetSparse(long type, memType fixed_bits,
+ memType decode_mask, memType address_mask, resPtr avoid)
+{
+ resRange r = {ResEnd,0,0};
+ memType new_mask;
+ memType mask1;
+ memType base;
+ memType bits;
+ memType counter = 0;
+ memType counter1;
+ memType max_counter = ~(memType)0;
+ memType max_counter1;
+ memType conflict = 0;
+
+ /* for sanity */
+ type = (type & ~ResExtMask & ~ResNoAvoid) | ResSparse;
+
+ /*
+ * a sparse address consists of 3 parts:
+ * fixed_bits: F bits which hard decoded by the hardware
+ * decode_bits: D bits which are used to decode address
+ * but which may be set by software
+ * address_bits: A bits which are used to address the
+ * sparse range.
+ * the decode_mask marks all decode bits while the address_mask
+ * masks out all address_bits:
+ * F D A
+ * decode_mask: 0 1 0
+ * address_mask: 1 1 0
+ */
+ decode_mask &= address_mask;
+ new_mask = decode_mask;
+
+ /*
+ * We start by setting the decode_mask bits to different values
+ * when a conflict is found the address_mask of the conflicting
+ * resource is returned. We remove those bits from decode_mask
+ * that are also set in the returned address_mask as they always
+ * conflict with resources which use them as address masks.
+ * The resoulting mask is stored in new_mask.
+ * We continue until no conflict is found or until we have
+ * tried all possible settings of new_mask.
+ */
+ while (1) {
+ base = make_base(counter,new_mask) | fixed_bits;
+ RANGE(r,base,address_mask,type);
+ conflict = ChkConflict(&r,Acc,SETUP);
+ if (!conflict) {
+ conflict = ChkConflict(&r,avoid,SETUP);
+ if (!conflict) {
+ return r;
+ }
+ }
+ counter = fix_counter(counter,new_mask,conflict);
+ max_counter = fix_counter(max_counter,new_mask,conflict);
+ new_mask &= conflict;
+ counter ++;
+ if (counter > max_counter) break;
+ }
+ if (!new_mask && (new_mask == decode_mask)) {
+ RANGE(r,0,0,ResEnd);
+ return r;
+ }
+ /*
+ * if we haven't been successful we also try to modify those
+ * bits in decode_mask that are not at the same time set in
+ * new mask. These bits overlap with address_bits of some
+ * resources. If a conflict with a resource of this kind is
+ * found (ie. returned_mask & mask1 != mask1) with
+ * mask1 = decode_mask & ~new_mask we cannot
+ * use our choice of bits in the new_mask part. We try
+ * another choice.
+ */
+ max_counter = fix_counter(mt_max,mt_max,new_mask);
+ mask1 = decode_mask & ~new_mask;
+ max_counter1 = fix_counter(mt_max,mt_max,mask1);
+ counter = 0;
+
+ while (1) {
+ bits = make_base(counter,new_mask) | fixed_bits;
+ counter1 = 0;
+ while (1) {
+ base = make_base(counter1,mask1);
+ RANGE(r,base,address_mask,type);
+ conflict = ChkConflict(&r,Acc,SETUP);
+ if (!conflict) {
+ conflict = ChkConflict(&r,avoid,SETUP);
+ if (!conflict) {
+ return r;
+ }
+ }
+ counter1 ++;
+ if ((mask1 & conflict) != mask1 || counter1 > max_counter1)
+ break;
+ }
+ counter ++;
+ if (counter > max_counter) break;
+ }
+ RANGE(r,0,0,ResEnd);
+ return r;
+}
+
+#undef length
+#undef mt_max
+
+static resList
+xf86GetResourcesImplicitly(int entityIndex)
+{
+ if (entityIndex >= xf86NumEntities) return NULL;
+
+ switch (xf86Entities[entityIndex]->bus.type) {
+ case BUS_ISA:
+ case BUS_NONE:
+ return NULL;
+ case BUS_PCI:
+ return GetImplicitPciResources(entityIndex);
+ }
+ return NULL;
+}
+
+/*
+ * xf86RegisterResources() -- attempts to register listed resources.
+ * If list is NULL it tries to obtain resources implicitly. Function
+ * returns a resPtr listing all resources not successfully registered.
+ */
+resPtr
+xf86RegisterResources(int entityIndex, resList list, int access)
+{
+ resPtr res = NULL;
+ resRange range;
+
+ if (!list) {
+ list = xf86GetResourcesImplicitly(entityIndex);
+ if (!list) return NULL;
+ }
+ while(list->type != ResEnd) {
+ range = *list;
+ if ((access != ResNone) && (access & ResAccMask)) {
+ range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
+ }
+ if(xf86ChkConflict(&range,entityIndex))
+ res = xf86AddResToList(res,&range,entityIndex);
+ else {
+ range.type &= ~ResBios;
+ Acc = xf86AddResToList(Acc,&range,entityIndex);
+ }
+ list++;
+ }
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
+ xf86PrintResList(3, Acc);
+ if (res) xf86MsgVerb(X_INFO, 3,
+ "Failed Resources after driver initialization\n");
+ xf86PrintResList(3, res);
+#endif
+ return res;
+
+}
+
+static void
+checkRequiredResources(int entityIndex)
+{
+ resRange range;
+ resPtr pAcc = Acc;
+ const EntityPtr pEnt = xf86Entities[entityIndex];
+ while (pAcc) {
+ if (pAcc->entityIndex == entityIndex) {
+ range = pAcc->val;
+ /* ResAny to find conflicts with anything. */
+ range.type = (range.type & ~ResAccMask) | ResAny | ResBios;
+ if (checkConflict(&range,Acc,entityIndex,OPERATING))
+ switch (pAcc->res_type & ResPhysMask) {
+ case ResMem:
+ pEnt->entityProp |= NEED_MEM_SHARED;
+ break;
+ case ResIo:
+ pEnt->entityProp |= NEED_IO_SHARED;
+ break;
+ }
+ if (!(pAcc->res_type & ResOprMask)) {
+ switch (pAcc->res_type & ResPhysMask) {
+ case ResMem:
+ pEnt->entityProp |= NEED_MEM;
+ break;
+ case ResIo:
+ pEnt->entityProp |= NEED_IO;
+ break;
+ }
+ }
+ }
+ pAcc = pAcc->next;
+ }
+
+ /* check if we can separately enable mem/io resources */
+ /* XXX we still need to find out how to set this yet */
+ if ( ((pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)
+ && (pEnt->entityProp & NEED_MEM_SHARED))
+ || ((pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)
+ && (pEnt->entityProp & NEED_IO_SHARED)) )
+ pEnt->entityProp |= NEED_SHARED;
+ /*
+ * After we have checked all resources of an entity agains any
+ * other resource we know if the entity need this resource type
+ * (ie. mem/io) at all. if not we can disable this type completely,
+ * so no need to share it either.
+ */
+ if ((pEnt->entityProp & NEED_MEM_SHARED)
+ && (!(pEnt->entityProp & NEED_MEM))
+ && (!(pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)))
+ pEnt->entityProp &= ~(unsigned long)NEED_MEM_SHARED;
+
+ if ((pEnt->entityProp & NEED_IO_SHARED)
+ && (!(pEnt->entityProp & NEED_IO))
+ && (!(pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)))
+ pEnt->entityProp &= ~(unsigned long)NEED_IO_SHARED;
+}
+
+static xf86AccessPtr
+busTypeSpecific(EntityPtr pEnt, xf86State state)
+{
+ pciAccPtr *ppaccp;
+
+ switch (pEnt->bus.type) {
+ case BUS_ISA:
+ switch (state) {
+ case SETUP:
+ return &AccessNULL;
+ break;
+ case OPERATING:
+ if (pEnt->entityProp & NEED_SHARED)
+ return &AccessNULL;
+ else /* no conflicts at all */
+ return NULL; /* remove from RAC */
+ break;
+ }
+ break;
+ case BUS_PCI:
+ ppaccp = xf86PciAccInfo;
+ while (*ppaccp) {
+ if ((*ppaccp)->busnum == pEnt->pciBusId.bus
+ && (*ppaccp)->devnum == pEnt->pciBusId.device
+ && (*ppaccp)->funcnum == pEnt->pciBusId.func) {
+ switch (state) {
+ case SETUP:
+ (*ppaccp)->io_memAccess.AccessDisable((*ppaccp)->
+ io_memAccess.arg);
+ return &(*ppaccp)->io_memAccess;
+ break;
+ case OPERATING:
+ if (!(pEnt->entityProp & NEED_MEM_SHARED)){
+ if (pEnt->entityProp & NEED_MEM)
+ (*ppaccp)->memAccess.AccessEnable((*ppaccp)->
+ memAccess.arg);
+ else
+ (*ppaccp)->memAccess.AccessDisable((*ppaccp)->memAccess.arg);
+ }
+ if (!(pEnt->entityProp & NEED_IO_SHARED)) {
+ if (pEnt->entityProp & NEED_IO)
+ (*ppaccp)->ioAccess.AccessEnable((*ppaccp)->
+ ioAccess.arg);
+ else
+ (*ppaccp)->ioAccess.AccessDisable((*ppaccp)->
+ ioAccess.arg);
+ }
+ switch(pEnt->entityProp & NEED_SHARED) {
+ case NEED_IO_SHARED:
+ return &(*ppaccp)->ioAccess;
+ case NEED_MEM_SHARED:
+ return &(*ppaccp)->memAccess;
+ case NEED_SHARED:
+ return &(*ppaccp)->io_memAccess;
+ default: /* no conflicts at all */
+ return NULL; /* remove from RAC */
+ }
+ break;
+ }
+ }
+ ppaccp++;
+ }
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+/*
+ * setAccess() -- sets access functions according to resources
+ * required.
+ */
+static void
+setAccess(EntityPtr pEnt, xf86State state)
+{
+ xf86AccessPtr new = NULL;
+
+ /* set access funcs and access state according to resource requirements */
+ pEnt->access->pAccess = busTypeSpecific(pEnt,state);
+
+ if (state == OPERATING) {
+ switch(pEnt->entityProp & NEED_SHARED) {
+ case NEED_SHARED:
+ pEnt->access->rt = MEM_IO;
+ break;
+ case NEED_IO_SHARED:
+ pEnt->access->rt = IO;
+ break;
+ case NEED_MEM_SHARED:
+ pEnt->access->rt = MEM;
+ break;
+ default:
+ pEnt->access->rt = NONE;
+ }
+ } else
+ pEnt->access->rt = MEM_IO;
+
+ /* disable shared resources */
+ if (pEnt->access->pAccess
+ && pEnt->access->pAccess->AccessDisable)
+ pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg);
+
+ /*
+ * If device is not under access control it is enabled.
+ * If it needs bus routing do it here as it isn't bus
+ * type specific. Any conflicts should be checked at this
+ * stage
+ */
+ if (!pEnt->access->pAccess
+ && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP :
+ NEED_VGA_ROUTED)))
+ ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc);
+
+ /* do we have a driver replacement for the generic access funcs ?*/
+ if (pEnt->rac) {
+ /* XXX should we use rt here? */
+ switch (pEnt->access->rt) {
+ case MEM_IO:
+ new = pEnt->rac->io_mem_new;
+ break;
+ case IO:
+ new = pEnt->rac->io_new;
+ break;
+ case MEM:
+ new = pEnt->rac->mem_new;
+ break;
+ default:
+ new = NULL;
+ break;
+ }
+ }
+ if (new) {
+ /* does the driver want the old access func? */
+ if (pEnt->rac->old) {
+ /* give it to the driver, leave state disabled */
+ (*pEnt->rac->old) = pEnt->access->pAccess;
+ } else if ((pEnt->access->rt != NONE) && pEnt->access->pAccess
+ && pEnt->access->pAccess->AccessEnable) {
+ /* driver doesn't want it - enable generic access */
+ pEnt->access->pAccess->AccessEnable(pEnt->access->pAccess->arg);
+ }
+ /* now replace access funcs */
+ pEnt->access->pAccess = new;
+ /* call the new disable func just to be shure */
+ /* XXX should we do this only if rt != NONE? */
+ if (pEnt->access->pAccess && pEnt->access->pAccess->AccessDisable)
+ pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg);
+ /* The replacement function needs to handle _all_ shared resources */
+ /* unless they are handeled locally and disabled otherwise */
+ }
+}
+
+
+void
+xf86EnterServerState(xf86State state)
+{
+ EntityPtr pEnt;
+ ScrnInfoPtr pScrn;
+ int i,j;
+ resType rt;
+
+#ifdef DEBUG
+ if (state == SETUP)
+ ErrorF("Entering SETUP state\n");
+ else
+ ErrorF("Entering OPERATING state\n");
+#endif
+
+ for (i=0; i<xf86NumScreens; i++) {
+ pScrn = xf86Screens[i];
+ j = pScrn->entityList[pScrn->numEntities - 1];
+ pScrn->access = xf86Entities[j]->access;
+
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+ if (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP
+ : NEED_VGA_ROUTED))
+ xf86Screens[i]->busAccess = pEnt->busAcc;
+ }
+ }
+
+ /*
+ * if we just have one screen we don't have RAC.
+ * Therefore just enable the screen and return.
+ */
+ if (!needRAC) {
+ xf86EnableAccess(xf86Screens[0]);
+ return;
+ }
+
+ disableAccess();
+
+ for (i=0; i<xf86NumScreens;i++) {
+
+ rt = NONE;
+
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+
+ setAccess(pEnt,state);
+
+ if (pEnt->access->rt != NONE) {
+ if (rt != NONE && rt != pEnt->access->rt)
+ rt = MEM_IO;
+ else
+ rt = pEnt->access->rt;
+ }
+ }
+ xf86Screens[i]->resourceType = rt;
+ if (rt == NONE) {
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+
+#ifdef DEBUG
+ if (xf86Screens[i]->busAccess)
+ ErrorF("Screen %i setting vga route\n",i);
+#endif
+ switch (rt) {
+ case MEM_IO:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares mem & io resources\n",i);
+ break;
+ case IO:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares io resources\n",i);
+ break;
+ case MEM:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares mem resources\n",i);
+ break;
+ default:
+ xf86MsgVerb(X_INFO, 3, "Entity %i shares no resources\n",i);
+ break;
+ }
+ }
+}
+
+void
+xf86PostPreInit()
+{
+ if (xf86NumScreens > 1)
+ needRAC = TRUE;
+
+#ifdef XFree86LOADER
+ ErrorF("do I need RAC?\n");
+
+ if (needRAC) {
+ char *list[] = { "rac",NULL };
+ ErrorF(" Yes, I do.\n");
+
+ if (!xf86LoadModules(list, NULL))
+ FatalError("Cannot load RAC module\n");
+ } else
+ ErrorF(" No, I don't.\n");
+#endif
+
+ xf86MsgVerb(X_INFO, 3, "resource ranges after preInit:\n");
+ xf86PrintResList(3, Acc);
+}
+
+void
+xf86PostScreenInit(void)
+{
+ int i,j;
+ ScreenPtr pScreen;
+ unsigned int flags;
+ int nummem = 0, numio = 0;
+
+#ifdef XFree86LOADER
+ pointer xf86RACInit = NULL;
+ if (needRAC) {
+ xf86RACInit = LoaderSymbol("xf86RACInit");
+ if (!xf86RACInit)
+ FatalError("Cannot resolve symbol \"xf86RACInit\"\n");
+ }
+#endif
+#ifdef DEBUG
+ ErrorF("PostScreenInit generation: %i\n",serverGeneration);
+#endif
+ if (serverGeneration == 1) {
+ checkRoutingForScreens(OPERATING);
+ for (i=0; i<xf86NumEntities; i++) {
+ checkRequiredResources(i);
+ }
+
+ /*
+ * after removing NEED_XXX_SHARED from entities that
+ * don't need need XXX resources at all we might have
+ * a single entity left that has NEED_XXX_SHARED set.
+ * In this case we can delete that, too.
+ */
+ for (i = 0; i < xf86NumEntities; i++) {
+ if (xf86Entities[i]->entityProp & NEED_MEM_SHARED)
+ nummem++;
+ if (xf86Entities[i]->entityProp & NEED_IO_SHARED)
+ numio++;
+ }
+ for (i = 0; i < xf86NumEntities; i++) {
+ if (nummem < 2)
+ xf86Entities[i]->entityProp &= ~NEED_MEM_SHARED;
+ if (numio < 2)
+ xf86Entities[i]->entityProp &= ~NEED_IO_SHARED;
+ }
+ }
+
+ if (xf86Screens && needRAC) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ Bool needRACforMem = FALSE, needRACforIo = FALSE;
+
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_MEM_SHARED)
+ needRACforMem = TRUE;
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_IO_SHARED)
+ needRACforIo = TRUE;
+ }
+
+ pScreen = xf86Screens[i]->pScreen;
+ flags = 0;
+ if (needRACforMem) {
+ flags |= xf86Screens[i]->racMemFlags;
+#ifdef DEBUG
+ ErrorF("Screen %d is using RAC for mem\n", i);
+#endif
+ }
+ if (needRACforIo) {
+ flags |= xf86Screens[i]->racIoFlags;
+#ifdef DEBUG
+ ErrorF("Screen %d is using RAC for io\n", i);
+#endif
+ }
+
+#ifdef XFree86LOADER
+ ((Bool(*)(ScreenPtr,unsigned int))xf86RACInit)
+ (pScreen,flags);
+#else
+ xf86RACInit(pScreen,flags);
+#endif
+ }
+ }
+
+ xf86EnterServerState(OPERATING);
+
+}
+
+/*
+ * xf86CheckPciMemBase() checks that the memory base value matches one of the
+ * PCI base address register values for the given PCI device.
+ */
+Bool
+xf86CheckPciMemBase(pciVideoPtr pPci, memType base)
+{
+ int i;
+
+ /* XXX Doesn't handle 64-bit base addresses */
+ for (i = 0; i < 6; i++)
+ if (base == pPci->memBase[i])
+ return TRUE;
+ return FALSE;
+}
+
+Bool
+xf86IsEntityPrimary(int entityIndex)
+{
+ EntityPtr pEnt = xf86Entities[entityIndex];
+
+ if (primaryBus.type != pEnt->busType) return FALSE;
+
+ switch (pEnt->busType) {
+ case BUS_PCI:
+ return (pEnt->pciBusId.bus == primaryBus.id.pci.bus &&
+ pEnt->pciBusId.device == primaryBus.id.pci.device &&
+ pEnt->pciBusId.func == primaryBus.id.pci.func);
+ case BUS_ISA:
+ return ( primaryBus.type == BUS_ISA );
+ default:
+ return FALSE;
+ }
+}
+
+static Bool
+fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
+{
+ int res_n;
+ memType *p_base;
+ int *p_size;
+ unsigned char p_type;
+ resPtr AccTmp = NULL;
+ resPtr *pAcc = &AccTmp;
+ resPtr avoid = NULL;
+ resList p_avoid = PciAvoid;
+ resRange range;
+ resPtr resBios = 0;
+ resPtr w_tmp, w = NULL, w_2nd = NULL;
+ PCITAG tag;
+ PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus;
+ resPtr tmp;
+
+ if (!pvp) return FALSE;
+
+ type &= ResAccMask;
+ if (!type) type = ResShared;
+ if (prt < 6) {
+ if (pvp->memBase[prt]) {
+ type |= ResMem;
+ res_n = prt;
+ p_base = &(pvp->memBase[res_n]);
+ p_size = &(pvp->size[res_n]);
+ p_type = pvp->type[res_n];
+ } else if (pvp->ioBase[prt]){
+ type |= ResIo;
+ res_n = prt;
+ p_base = &(pvp->ioBase[res_n]);
+ p_size = &(pvp->size[res_n]);
+ p_type = pvp->type[res_n];
+ } else return FALSE;
+ } else if (prt == 6) {
+ type |= ResMem;
+ res_n = 0xff; /* special flag for bios rom */
+ p_base = &(pvp->biosBase);
+ p_size = &(pvp->biosSize);
+ /* XXX This should also include the PCI_MAP_MEMORY_TYPE_MASK part */
+ p_type = 0;
+ RANGE(range,0,0xffffffff,ResExcMemBlock);
+ resBios = xf86AddResToList(resBios,&range,-1);
+ } else return FALSE;
+
+ if (! *p_base) return FALSE;
+
+ type |= ResBlock;
+
+ /* setup avoid */
+ avoid = addRangesToList(avoid,p_avoid,-1);
+
+ while (pbp) {
+ if (pbp->secondary == pvp->bus) {
+ if (type & ResMem) {
+ if (((p_type & PCI_MAP_MEMORY_CACHABLE)
+#if 0 /*EE*/
+ || (res_n == 0xff)/* bios should also be prefetchable */
+#endif
+ )
+ && pbp->pmem) {
+ w = findIntersectOfLists(pbp->pmem,ResRange);
+ if (pbp->mem) {
+ w_2nd = findIntersectOfLists(pbp->mem,ResRange);
+ }
+ } else if (pbp->mem) {
+ w = findIntersectOfLists(pbp->mem,ResRange);
+ }
+ } else if (pbp->io) {
+ w = findIntersectOfLists(pbp->io,ResRange);
+ }
+
+ while (pbp1) {
+ if (pbp1->primary == pvp->bus) {
+ if (type & ResMem) {
+ tmp = xf86DupResList(pbp1->pmem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ tmp = xf86DupResList(pbp1->mem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ } else {
+ tmp = xf86DupResList(pbp1->io);
+ avoid = xf86JoinResLists(avoid,tmp);
+ }
+ }
+ pbp1 = pbp1->next;
+ }
+ break;
+ }
+ pbp = pbp->next;
+ }
+
+ if (!w)
+ w = xf86DupResList(ResRange);
+
+ if (resBios) {
+ w_tmp = w;
+ w = findIntersectOfLists(w,resBios);
+ xf86FreeResList(w_tmp);
+ xf86FreeResList(resBios);
+ }
+
+ if (!alignment)
+ alignment = (1 << (*p_size)) - 1;
+
+ /* Access list holds bios resources -- remove this one */
+#ifdef NOTYET
+ AccTmp = xf86DupResList(Acc);
+ while ((*pAcc)) {
+ if ((((*pAcc)->res_type & (type & ~ResAccMask))
+ == (type & ~ResAccMask))
+ && ((*pAcc)->block_begin == (*p_base))
+ && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) {
+ resPtr acc_tmp = (*pAcc)->next;
+ xfree((*pAcc));
+ (*pAcc) = acc_tmp;
+ break;
+ } else
+ pAcc = &((*pAcc)->next);
+ }
+ /* check if we really need to fix anything */
+ RANGE(range, (*p_base), (*p_base) + (1 << (*p_size)) - 1, type);
+ if (!ChkConflict(&range,avoid,SETUP)
+ && !ChkConflict(&range,AccTmp,SETUP)
+ && (((*p_base) & alignment) == (*p_base)->block_begin)
+ && ((isSubsetOf(range,w)
+ || (w_2nd && isSubsetOf(range,w_2n))))) {
+#ifdef DEBUG
+ ErrorF("nothing to fix\n");
+#endif
+ xf86FreeResList(AccTmp);
+ xf86FreeResList(w);
+ xf86FreeResList(w_2nd);
+ xf86FreeResList(avoid);
+ return TRUE;
+ } else {
+#ifdef DEBUG
+ ErrorF("removing old resource\n");
+#endif
+ xf86FreeResList(Acc);
+ Acc = AccTmp;
+ }
+#else
+ pAcc = &Acc;
+ while ((*pAcc)) {
+ if ((((*pAcc)->res_type & (type & ~ResAccMask))
+ == (type & ~ResAccMask))
+ && ((*pAcc)->block_begin == (*p_base))
+ && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) {
+#ifdef DEBUG
+ ErrorF("removing old resource\n");
+#endif
+ (*pAcc) = (*pAcc)->next;
+ break;
+ } else
+ pAcc = &((*pAcc)->next);
+ }
+#endif
+
+#ifdef DEBUG
+ ErrorF("base: 0x%lx alignment: 0x%lx size[bit]: 0x%x\n",
+ (*p_base),alignment,(*p_size));
+ xf86MsgVerb(X_INFO, 3, "window:\n");
+ xf86PrintResList(3, w);
+ if (w_2nd)
+ xf86MsgVerb(X_INFO, 3, "2nd window:\n");
+ xf86PrintResList(3, w_2nd);
+ xf86ErrorFVerb(3,"avoid:\n");
+ xf86PrintResList(3,avoid);
+#endif
+ w_tmp = w;
+ while (w) {
+ if (type & w->res_type & ResPhysMask) {
+ range = xf86GetBlock(type,alignment + 1, w->block_begin,
+ w->block_end, alignment,avoid);
+ if (range.type != ResEnd)
+ break;
+ }
+ w = w->next;
+ }
+ xf86FreeResList(w_tmp);
+ /* if unsuccessful and memory prefetchable try non-prefetchable */
+ if (range.type == ResEnd && w_2nd) {
+ w_tmp = w_2nd;
+ while (w_2nd) {
+ if (type & w_2nd->res_type & ResPhysMask) {
+ range = xf86GetBlock(type,alignment + 1, w_2nd->block_begin,
+ w_2nd->block_end,alignment,avoid);
+ if (range.type != ResEnd)
+ break;
+ }
+ w_2nd = w_2nd->next;
+ }
+ xf86FreeResList(w_tmp);
+ }
+ xf86FreeResList(avoid);
+
+ if (range.type == ResEnd)
+ return FALSE;
+
+ (*p_size) = 0;
+ while (alignment >> (*p_size))
+ (*p_size)++;
+ (*p_base) = range.rBegin;
+
+#ifdef DEBUG
+ ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n",
+ res_n,(*p_base),(1 << (*p_size)),type | ResMem ? "Mem" : "Io");
+#endif
+ tag = pciTag(pvp->bus,pvp->device,pvp->func);
+
+ if (res_n != 0xff) /*XXX fix for 64 bit */
+ pciWriteLong(tag,PCI_CMD_BASE_REG + res_n * sizeof(CARD32),
+ (CARD32)(*p_base) | (CARD32)(p_type));
+ else {
+ CARD32 val = pciReadLong(tag,PCI_CMD_BIOS_REG) & 0x01;
+ pciWriteLong(tag,PCI_CMD_BIOS_REG,(CARD32)(*p_base) | val);
+ }
+ /* fake BIOS allocated resource */
+ range.type |= ResBios;
+ Acc = xf86AddResToList(Acc, &range,-1);
+
+ return TRUE;
+
+}
+
+Bool
+xf86FixPciResource(int entityIndex, int prt, memType alignment,
+ long type)
+{
+ pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex);
+ return fixPciResource(prt, alignment, pvp, type);
+}
+
+resPtr
+xf86ReallocatePciResources(int entityIndex, resPtr pRes)
+{
+ pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex);
+ resPtr pBad = NULL,pResTmp;
+ unsigned int prt = 0;
+ int i;
+
+ if (!pvp) return pRes;
+
+ while (pRes) {
+ switch (pRes->res_type & ResPhysMask) {
+ case ResMem:
+ if (pRes->block_begin == pvp->biosBase &&
+ pRes->block_end == pvp->biosBase + (1 << (pvp->biosSize)) - 1)
+ prt = 6;
+ else for (i = 0 ; i < 6; i++)
+ if (pRes->block_begin == pvp->memBase[i]
+ && pRes->block_end
+ == pvp->memBase[i] + (1 << (pvp->size[i])) - 1) {
+ prt = i;
+ break;
+ }
+ break;
+ case ResIo:
+ for (i = 0 ; i < 6; i++)
+ if (pRes->block_begin == pvp->ioBase[i]
+ && pRes->block_end
+ == pvp->ioBase[i] + (1 << (pvp->size[i])) - 1) {
+ prt = i;
+ break;
+ }
+ break;
+ }
+
+ if (!prt) return pRes;
+
+ pResTmp = pRes->next;
+ if (! fixPciResource(prt, 0, pvp, pRes->res_type)) {
+ pRes->next = pBad;
+ pBad = pRes;
+ } else
+ xfree(pRes);
+
+ pRes = pResTmp;
+ }
+ return pBad;
+}
+
+
+resPtr
+xf86SetOperatingState(resList list, int entityIndex, int mask)
+{
+ resPtr acc;
+ resPtr r_fail = NULL;
+
+ while (list->type != ResEnd) {
+ acc = Acc;
+ while (acc) {
+#define MASK (ResPhysMask | ResExtMask)
+ if (acc->entityIndex == entityIndex
+ && acc->val.a == list->a && acc->val.b == list->b
+ && (acc->val.type & MASK) == (list->type & MASK))
+ break;
+#undef MASK
+ acc = acc->next;
+ }
+ if (acc)
+ acc->val.type = (acc->val.type & ~ResOprMask)
+ | (mask & ResOprMask);
+ else
+ r_fail = xf86AddResToList(r_fail,list,entityIndex);
+
+ list ++;
+ }
+
+ return r_fail;
+}
+
+memType
+getValidBIOSBase(PCITAG tag, int num)
+{
+ pciVideoPtr pvp;
+ PciBusPtr pbp, pbp1;
+ memType start_mp = 0, start_m = 0;
+ memType end_mp, end_m;
+ resPtr tmp, avoid;
+ resRange range;
+ int n = 0;
+
+ if (!xf86PciVideoInfo) return 0;
+
+ while ((pvp = xf86PciVideoInfo[n++])) {
+ if (pciTag(pvp->bus,pvp->device,pvp->func) == tag)
+ break;
+ }
+ if (!pvp) return 0;
+ avoid = NULL;
+ end_m = PCI_MEMBASE_LENGTH_MAX;
+ end_mp = PCI_MEMBASE_LENGTH_MAX;
+ pbp = pbp1 = xf86PciBus;
+ while (pbp) {
+ if (pbp->secondary == pvp->bus) {
+ if (pbp->pmem) {
+ start_mp = pbp->pmem->block_begin;
+ end_mp = MIN(end_mp,pbp->pmem->block_end);
+ }
+ if (pbp->mem) {
+ start_m = pbp->mem->block_begin;
+ end_m = MIN(end_m,pbp->mem->block_end);
+ }
+ }
+ while (pbp1) {
+ if (pbp1->primary == pvp->bus) {
+ tmp = xf86DupResList(pbp1->pmem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ tmp = xf86DupResList(pbp1->mem);
+ avoid = xf86JoinResLists(avoid,tmp);
+ tmp = xf86DupResList(pbp1->io);
+ avoid = xf86JoinResLists(avoid,tmp);
+ }
+ pbp1 = pbp1->next;
+ }
+ pbp = pbp->next;
+ }
+
+ if (pvp->biosBase) { /* try biosBase first */
+ RANGE(range, pvp->biosBase,
+ pvp->biosBase + (1 << pvp->biosSize) - 1,
+ ResExcMemBlock);
+ if (((range.rBegin >= start_m && range.rEnd <= end_m) ||
+ (range.rBegin >= start_mp && range.rEnd <= end_mp))
+ && ! ChkConflict(&range,avoid,SETUP)) {
+ xf86FreeResList(avoid);
+ return pvp->biosBase;
+ }
+ }
+#if 0
+ if (num >= 0 && num <= 5 && pvp->memBase[num]) {
+ /* then try suggested memBase */
+ RANGE(range, pvp->memBase[num],
+ pvp->memBase[num] + (1 << pvp->biosSize) - 1,
+ ResExcMemBlock); /* keep bios size ! */
+ if (((range.rBegin >= start_m && range.rEnd <= end_m) ||
+ (range.rBegin >= start_mp && range.rEnd <= end_mp))
+ && ! ChkConflict(&range,avoid,SETUP)) {
+ xf86FreeResList(avoid);
+ return pvp->memBase[num];
+ }
+ }
+#endif
+ range = xf86GetBlock(ResExcMemBlock, (1 << pvp->biosSize),start_m,end_m,
+ (1 << pvp->biosSize) -1, avoid);
+ xf86FreeResList(avoid);
+ return range.rBase;
+}
+
+static resPtr
+addRangesToList(resPtr list, resRange *pRange, int entityIndex)
+{
+ while(pRange && pRange->type != ResEnd) {
+ list = xf86AddResToList(list,pRange,entityIndex);
+ pRange++;
+ }
+ return list;
+}
+
+/*
+ * not yet used. FIXME: add support for sparse
+ */
+static Bool
+isSubsetOf(resRange range, resPtr list)
+{
+ while (list) {
+ if (range.type & list->res_type & ResPhysMask) {
+ switch (range.type & ResExtMask) {
+ case ResBlock:
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ if (range.rBegin >= list->block_begin
+ && range.rEnd <= list->block_end)
+ return TRUE;
+ break;
+ }
+ break;
+ }
+ }
+ list = list->next;
+ }
+ return FALSE;
+}
+
+static Bool
+isListSubsetOf(resPtr list, resPtr BaseList)
+{
+ while (list) {
+ if (! isSubsetOf(list->val,BaseList))
+ return FALSE;
+ list = list->next;
+ }
+ return TRUE;
+}
+
+static resPtr
+findIntersect(resRange Range, resPtr list)
+{
+ resRange range;
+ resPtr new = NULL;
+
+ while (list) {
+ if (Range.type & list->res_type & ResPhysMask) {
+ switch (Range.type & ResExtMask) {
+ case ResBlock:
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ if (Range.rBegin >= list->block_begin)
+ range.rBegin = Range.rBegin;
+ else
+ range.rBegin = list->block_begin;
+ if (range.rEnd <= list->block_end)
+ range.rEnd = Range.rEnd;
+ else
+ range.rEnd = Range.rEnd;
+ if (range.rEnd > range.rBegin) {
+ range.type = Range.type;
+ xf86AddResToList(new,&range,-1);
+ }
+ break;
+ }
+ break;
+ }
+ }
+ list = list->next;
+ }
+ return new;
+}
+
+static resPtr
+findIntersectOfLists(resPtr l1, resPtr l2)
+{
+ resPtr ret = NULL;
+
+ while (l1) {
+ ret = xf86JoinResLists(ret,findIntersect(l1->val,l2));
+ l1 = l1->next;
+ }
+ return ret;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h
new file mode 100644
index 000000000..ec6678e03
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h
@@ -0,0 +1,121 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.9 1999/08/21 13:48:24 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains definitions of the bus-related data structures/types.
+ * Everything contained here is private to xf86Bus.c. In particular the
+ * video drivers must not include this file.
+ */
+
+#ifndef _XF86_BUS_H
+#define _XF86_BUS_H
+
+typedef struct racInfo {
+ xf86AccessPtr mem_new;
+ xf86AccessPtr io_new;
+ xf86AccessPtr io_mem_new;
+ xf86AccessPtr *old;
+} AccessFuncRec, *AccessFuncPtr;
+
+#define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF)
+
+typedef struct {
+ DriverPtr driver;
+ int chipset;
+ int entityProp;
+ EntityProc entityInit;
+ EntityProc entityEnter;
+ EntityProc entityLeave;
+ pointer private;
+ GDevPtr device;
+ resPtr resources;
+ Bool active;
+ Bool inUse;
+ BusRec bus;
+ EntityAccessPtr access;
+ AccessFuncPtr rac;
+ pointer busAcc;
+} EntityRec, *EntityPtr;
+
+#define NO_SEPARATE_IO_FROM_MEM 0x0001
+#define NO_SEPARATE_MEM_FROM_IO 0x0002
+#define NEED_VGA_ROUTED 0x0004
+#define NEED_VGA_ROUTED_SETUP 0x0008
+#define NEED_MEM 0x0010
+#define NEED_IO 0x0020
+#define NEED_MEM_SHARED 0x0040
+#define NEED_IO_SHARED 0x0080
+
+#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
+
+#define busType bus.type
+#define pciBusId bus.id.pci
+#define isaBusId bus.id.isa
+
+typedef struct {
+ CARD32 command;
+ CARD32 base[6];
+ CARD32 biosBase;
+} pciSave, *pciSavePtr;
+
+typedef void (*SetBitsProcPtr)(PCITAG, int, CARD32, CARD32);
+
+typedef struct {
+ PCITAG tag;
+ SetBitsProcPtr func;
+} pciArg;
+
+typedef struct pci_io {
+ int busnum;
+ int devnum;
+ int funcnum;
+ pciArg arg;
+ xf86AccessRec ioAccess;
+ xf86AccessRec io_memAccess;
+ xf86AccessRec memAccess;
+ pciSave save;
+ pciSave restore;
+ Bool ctrl;
+} pciAccRec, *pciAccPtr;
+
+typedef struct {
+ CARD16 io;
+ CARD32 mem;
+ CARD32 pmem;
+ CARD8 control;
+} pciBridgeSave, *pciBridgeSavePtr;
+
+struct x_BusAccRec;
+typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
+
+typedef struct x_BusAccRec {
+ BusAccProcPtr set_f;
+ BusAccProcPtr enable_f;
+ BusAccProcPtr disable_f;
+ BusAccProcPtr save_f;
+ BusAccProcPtr restore_f;
+ struct x_BusAccRec *current; /* pointer to bridge open on this bus */
+ struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
+ struct x_BusAccRec *next; /* this links the different buses together */
+ BusType type;
+ /* Bus-specific fields */
+ union {
+ struct {
+ int bus;
+ PCITAG acc;
+ pciBridgeSave save;
+ void (*func)(PCITAG,int,CARD32,CARD32);
+ } pci;
+ } busdep;
+} BusAccRec, *BusAccPtr;
+
+static resPtr addRangesToList(resPtr list, resRange *pRange,int entityIndex);
+static Bool isSubsetOf(resRange range, resPtr list);
+static Bool isListSubsetOf(resPtr list, resPtr BaseList);
+static resPtr findIntersect(resRange Range, resPtr list);
+static resPtr findIntersectOfLists(resPtr l1, resPtr l2);
+
+#endif /* _XF86_BUS_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
new file mode 100644
index 000000000..c49361ab5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
@@ -0,0 +1,2264 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.191 1999/07/18 08:14:30 dawes Exp $ */
+
+
+/*
+ * Copyright 1991-1997 by The XFree86 Project, Inc.
+ * Copyright 1997 by Metro Link, Inc.
+ *
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * <Put copyright message here>
+ *
+ * Author: Dirk Hohndel <hohndel@XFree86.Org>
+ */
+
+#include "xf86.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "xf86Config.h"
+#define NO_COMPILER_H_EXTRAS
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include "globals.h"
+
+#ifdef XINPUT
+#include "xf86Xinput.h"
+extern DeviceAssocRec mouse_assoc;
+#endif
+
+#ifdef XKB
+#define XKB_IN_SERVER
+#include "XKBsrv.h"
+#endif
+
+#if (defined(i386) || defined(__i386__)) && \
+ (defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \
+ defined(SVR4))
+#define SUPPORT_PC98
+#endif
+
+/*
+ * These paths define the way the config file search is done. The escape
+ * sequences are documented in parser/scan.c.
+ */
+#ifndef ROOT_CONFIGPATH
+#define ROOT_CONFIGPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "%D/%X," \
+ "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%X," "%P/lib/X11/%X.%H," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef USER_CONFIGPATH
+#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \
+ "/etc/X11/%G," "%P/etc/X11/%G," \
+ "/etc/X11/%X," "/etc/%X," "%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%X," "%P/lib/X11/%X.%H," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef PROJECTROOT
+#define PROJECTROOT "/usr/X11R6"
+#endif
+
+static char *fontPath = NULL;
+
+/* Forward declarations */
+static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
+ int scrnum, MessageType from);
+static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
+static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
+ Bool active);
+static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
+ MessageType from);
+static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
+static Bool addDefaultModes(MonPtr monitorp);
+#ifdef XF86DRI
+static Bool configDRI(XF86ConfDRIPtr drip);
+#endif
+
+/*
+ * xf86GetPathElem --
+ * Extract a single element from the font path string starting at
+ * pnt. The font path element will be returned, and pnt will be
+ * updated to point to the start of the next element, or set to
+ * NULL if there are no more.
+ */
+static char *
+xf86GetPathElem(char **pnt)
+{
+ char *p1;
+
+ p1 = *pnt;
+ *pnt = index(*pnt, ',');
+ if (*pnt != NULL) {
+ **pnt = '\0';
+ *pnt += 1;
+ }
+ return(p1);
+}
+
+/*
+ * xf86ValidateFontPath --
+ * Validates the user-specified font path. Each element that
+ * begins with a '/' is checked to make sure the directory exists.
+ * If the directory exists, the existence of a file named 'fonts.dir'
+ * is checked. If either check fails, an error is printed and the
+ * element is removed from the font path.
+ */
+
+#define DIR_FILE "/fonts.dir"
+static char *
+xf86ValidateFontPath(char *path)
+{
+ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+ struct stat stat_buf;
+ int flag;
+ int dirlen;
+
+ tmp_path = xcalloc(1,strlen(path)+1);
+ out_pnt = tmp_path;
+ path_elem = NULL;
+ next = path;
+ while (next != NULL) {
+ path_elem = xf86GetPathElem(&next);
+#ifndef __EMX__
+ if (*path_elem == '/') {
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
+ if ((p1 = strchr(path_elem, ':')) != 0)
+#else
+ /* OS/2 must prepend X11ROOT */
+ if (*path_elem == '/') {
+ path_elem = (char*)__XOS2RedirRoot(path_elem);
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
+ if (p1 = strchr(path_elem+2, ':'))
+#endif
+ dirlen = p1 - path_elem;
+ else
+ dirlen = strlen(path_elem);
+ strncpy(dir_elem, path_elem, dirlen);
+ dir_elem[dirlen] = '\0';
+ flag = stat(dir_elem, &stat_buf);
+ if (flag == 0)
+ if (!S_ISDIR(stat_buf.st_mode))
+ flag = -1;
+ if (flag != 0) {
+ xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ continue;
+ }
+ else {
+ p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
+ strcpy(p1, dir_elem);
+ strcat(p1, DIR_FILE);
+ flag = stat(p1, &stat_buf);
+ if (flag == 0)
+ if (!S_ISREG(stat_buf.st_mode))
+ flag = -1;
+#ifndef __EMX__
+ xfree(p1);
+#endif
+ if (flag != 0) {
+ xf86Msg(X_WARNING,
+ "`fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ continue;
+ }
+ }
+ xfree(dir_elem);
+ }
+
+ /*
+ * Either an OK directory, or a font server name. So add it to
+ * the path.
+ */
+ if (out_pnt != tmp_path)
+ *out_pnt++ = ',';
+ strcat(out_pnt, path_elem);
+ out_pnt += strlen(path_elem);
+ }
+ return(tmp_path);
+}
+
+
+/*
+ * use the datastructure that the parser provides and pick out the parts
+ * that we need at this point
+ */
+char **
+xf86ModulelistFromConfig(pointer **optlist)
+{
+ int count = 0;
+ char **modulearray;
+ pointer *optarray;
+ XF86LoadPtr modp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ if (xf86configptr->conf_modules) {
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ }
+ if (count == 0)
+ return NULL;
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ optarray = xnfalloc((count + 1) * sizeof(pointer));
+ count = 0;
+ if (xf86configptr->conf_modules) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ }
+ modulearray[count] = NULL;
+ optarray[count] = NULL;
+ if (optlist)
+ *optlist = optarray;
+ return modulearray;
+}
+
+
+char **
+xf86DriverlistFromConfig()
+{
+ int count = 0;
+ char **modulearray;
+ screenLayoutPtr slp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ /*
+ * Walk the list of driver lines in active "Device" sections to
+ * determine now many implicitly loaded modules there are.
+ *
+ * XXX The set of inactive "Device" sections needs to be handled too,
+ * when the rest of the supporting code is done.
+ */
+ slp = xf86ConfigLayout.screens;
+ while ((slp++)->screen) {
+ count++;
+ }
+
+ if (count == 0)
+ return NULL;
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ slp = xf86ConfigLayout.screens;
+ while (slp->screen) {
+ modulearray[count] = slp->screen->device->driver;
+ count++;
+ slp++;
+ }
+ modulearray[count] = NULL;
+
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
+}
+
+
+Bool
+xf86BuiltinInputDriver(const char *name)
+{
+ if (xf86NameCmp(name, "keyboard") == 0 || xf86NameCmp(name, "mouse") == 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+char **
+xf86InputDriverlistFromConfig()
+{
+ int count = 0;
+ char **modulearray;
+ IDevPtr idp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ /*
+ * Walk the list of driver lines in active "InputDevice" sections to
+ * determine now many implicitly loaded modules there are.
+ */
+ idp = xf86ConfigLayout.inputs;
+ while (idp->identifier) {
+ if (!xf86BuiltinInputDriver(idp->driver))
+ count++;
+ idp++;
+ }
+
+ if (count == 0)
+ return NULL;
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ idp = xf86ConfigLayout.inputs;
+ while (idp->identifier) {
+ if (!xf86BuiltinInputDriver(idp->driver)) {
+ modulearray[count] = idp->driver;
+ count++;
+ }
+ idp++;
+ }
+ modulearray[count] = NULL;
+
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
+}
+
+
+/*
+ * xf86ConfigError --
+ * Print a READABLE ErrorMessage!!! All information that is
+ * available is printed.
+ */
+static void
+xf86ConfigError(char *msg, ...)
+{
+ va_list ap;
+
+ ErrorF("\nConfig Error:\n");
+ va_start(ap, msg);
+ VErrorF(msg, ap);
+ va_end(ap);
+ ErrorF("\n");
+ return;
+}
+
+static Bool
+configFiles(XF86ConfFilesPtr fileconf)
+{
+ MessageType pathFrom = X_DEFAULT;
+
+ /* FontPath */
+
+ /* Try XF86Config FontPath first */
+ if (!xf86fpFlag) {
+ if (fileconf->file_fontpath) {
+ char *f = xf86ValidateFontPath(fileconf->file_fontpath);
+ pathFrom = X_CONFIG;
+ if (*f)
+ defaultFontPath = f;
+ else {
+ xf86Msg(X_WARNING,
+ "FontPath is completely invalid. Using compiled-in default.\n");
+ fontPath = NULL;
+ pathFrom = X_DEFAULT;
+ }
+ } else {
+ xf86Msg(X_WARNING,
+ "No FontPath specified. Using compiled-in default.\n");
+ pathFrom = X_DEFAULT;
+ }
+ } else {
+ /* Use fontpath specified with '-fp' */
+ if (fontPath)
+ {
+ fontPath = NULL;
+ }
+ pathFrom = X_CMDLINE;
+ }
+ if (!fileconf->file_fontpath) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ could be static, so we make a copy. */
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
+ f[0] = '\0';
+ strcpy (f, defaultFontPath);
+ defaultFontPath = xf86ValidateFontPath(f);
+ xfree(f);
+ }
+
+ /* If defaultFontPath is still empty, exit here */
+
+ if (! *defaultFontPath)
+ FatalError("No valid FontPath could be found\n");
+
+ xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath);
+
+ /* RgbPath */
+
+ pathFrom = X_DEFAULT;
+
+ if (xf86coFlag)
+ pathFrom = X_CMDLINE;
+ else if (fileconf->file_rgbpath) {
+ rgbPath = fileconf->file_rgbpath;
+ pathFrom = X_CONFIG;
+ }
+
+ xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath);
+
+#ifdef XFree86LOADER
+ /* ModulePath */
+
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
+ }
+
+ xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
+#endif
+
+#if 0
+ /* LogFile */
+ /*
+ * XXX The problem with this is that the log file is already open.
+ * One option might be to copy the exiting contents to the new location.
+ * and re-open it. The down side is that the default location would
+ * already have been overwritten. Another option would be to start with
+ * unique temporary location, then copy it once the correct name is known.
+ * A problem with this is what happens if the server exits before that
+ * happens.
+ */
+ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
+ xf86LogFile = fileconf->file_logfile;
+ xf86LogFileFrom = X_CONFIG;
+ }
+#endif
+
+ return TRUE;
+}
+
+typedef enum {
+ FLAG_NOTRAPSIGNALS,
+ FLAG_DONTZAP,
+ FLAG_DONTZOOM,
+ FLAG_DISABLEVIDMODE,
+ FLAG_ALLOWNONLOCAL,
+ FLAG_DISABLEMODINDEV,
+ FLAG_MODINDEVALLOWNONLOCAL,
+ FLAG_ALLOWMOUSEOPENFAIL,
+ FLAG_VTINIT,
+ FLAG_VTSYSREQ,
+ FLAG_PCIPROBE1,
+ FLAG_PCIPROBE2,
+ FLAG_PCIFORCECONFIG1,
+ FLAG_PCIFORCECONFIG2,
+ FLAG_SAVER_BLANKTIME,
+ FLAG_DPMS_STANDBYTIME,
+ FLAG_DPMS_SUSPENDTIME,
+ FLAG_DPMS_OFFTIME,
+ FLAG_PIXMAP,
+ FLAG_PC98
+} FlagValues;
+
+static OptionInfoRec FlagOptions[] = {
+ { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEMODINDEV, "DisableModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_MODINDEVALLOWNONLOCAL, "AllowNonLocalModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_VTINIT, "VTInit", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG1, "PciForceConfig1", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PC98, "PC98", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE }
+};
+
+static Bool
+detectPC98()
+{
+#ifdef SUPPORT_PC98
+ unsigned char buf[2];
+
+ if (xf86ReadBIOS(0xf8000, 0xe80, buf, 2) != 2)
+ return FALSE;
+ if ((buf[0] == 0x98) && (buf[1] == 0x21))
+ return TRUE;
+ else
+ return FALSE;
+#else
+ return FALSE;
+#endif
+}
+
+static Bool
+configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
+{
+ XF86OptionPtr optp, tmp;
+ int i;
+ Pix24Flags pix24 = Pix24DontCare;
+ Bool value;
+
+ if(flagsconf == NULL)
+ return TRUE;
+ /*
+ * Merge the ServerLayout and ServerFlags options. The former have
+ * precedence over the latter.
+ */
+ optp = NULL;
+ if (flagsconf->flg_option_lst)
+ optp = OptionListDup(flagsconf->flg_option_lst);
+ if (layoutopts) {
+ tmp = OptionListDup(layoutopts);
+ if (optp)
+ OptionListMerge(optp, tmp);
+ else
+ optp = tmp;
+ }
+
+ xf86ProcessOptions(-1, optp, FlagOptions);
+
+ xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
+
+ /*
+ * Set things up based on the config file information. Some of these
+ * settings may be overridden later when the command line options are
+ * checked.
+ */
+#ifdef XF86VIDMODE
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value))
+ xf86Info.vidModeEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value))
+ xf86Info.vidModeAllowNonLocal = value;
+#endif
+
+#ifdef XF86MISC
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value))
+ xf86Info.miscModInDevEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value))
+ xf86Info.miscModInDevAllowNonLocal = value;
+#endif
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
+ xf86Info.allowMouseOpenFail = value;
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) {
+#ifdef USE_VT_SYSREQ
+ xf86Info.vtSysreq = value;
+ xf86Msg(X_CONFIG, "VTSysReq enabled\n");
+#else
+ if (value)
+ xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n");
+#endif
+ }
+
+ xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT);
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1))
+ xf86Info.pciFlags = PCIProbe1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2))
+ xf86Info.pciFlags = PCIProbe2;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG1))
+ xf86Info.pciFlags = PCIForceConfig1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2))
+ xf86Info.pciFlags = PCIForceConfig2;
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
+ if (i >= 0)
+ ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
+
+#ifdef DPMSExtension
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
+ if (i >= 0)
+ DPMSStandbyTime = defaultDPMSStandbyTime = i * MILLI_PER_MIN;
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
+ if (i >= 0)
+ DPMSSuspendTime = defaultDPMSSuspendTime = i * MILLI_PER_MIN;
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
+ if (i >= 0)
+ DPMSOffTime = defaultDPMSOffTime = i * MILLI_PER_MIN;
+#endif
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i);
+ switch (i) {
+ case 24:
+ pix24 = Pix24Use24;
+ break;
+ case 32:
+ pix24 = Pix24Use32;
+ break;
+ case -1:
+ break;
+ default:
+ xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
+ return FALSE;
+ }
+ if (xf86Pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = xf86Pix24;
+ xf86Info.pix24From = X_CMDLINE;
+ } else if (pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = pix24;
+ xf86Info.pix24From = X_CONFIG;
+ } else {
+ xf86Info.pixmap24 = Pix24DontCare;
+ xf86Info.pix24From = X_DEFAULT;
+ }
+#if defined(i386) || defined(__i386__)
+ if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) {
+ xf86Info.pc98 = value;
+ if (value) {
+ xf86Msg(X_CONFIG, "Japanese PC98 architecture\n");
+ }
+ } else
+ if (detectPC98()) {
+ xf86Info.pc98 = TRUE;
+ xf86Msg(X_PROBED, "Japanese PC98 architecture\n");
+ }
+#endif
+
+ return TRUE;
+}
+
+#ifndef NEW_INPUT
+static Bool
+configKeyboard(XF86ConfKeyboardPtr keybconf)
+{
+#ifdef XKB
+ MessageType from = X_DEFAULT;
+#endif
+
+ /* Initialize defaults */
+ xf86Info.xleds = 0L;
+ xf86Info.kbdDelay = 500;
+ xf86Info.kbdRate = 30;
+ xf86Info.kbdProc = NULL;
+ xf86Info.vtinit = NULL;
+ xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
+#if defined(SVR4) && defined(i386)
+ xf86Info.panix106 = FALSE;
+#endif
+#ifdef XKB
+ if (!xf86IsPc98()) {
+ xf86Info.xkbrules = "xfree86";
+ xf86Info.xkbmodel = "pc101";
+ xf86Info.xkblayout = "us";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ } else {
+ xf86Info.xkbrules = "xfree86";
+ xf86Info.xkbmodel = "pc98";
+ xf86Info.xkblayout = "nec/jp";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ }
+ xf86Info.xkbcomponents_specified = FALSE;
+ /* Should discourage the use of these. */
+ xf86Info.xkbkeymap = NULL;
+ xf86Info.xkbtypes = NULL;
+ xf86Info.xkbcompat = NULL;
+ xf86Info.xkbkeycodes = NULL;
+ xf86Info.xkbsymbols = NULL;
+ xf86Info.xkbgeometry = NULL;
+#endif
+
+ if ( NameCompare(keybconf->keyb_protocol,"standard") == 0 ) {
+ xf86Info.kbdProc = xf86KbdProc;
+#ifdef AMOEBA
+ xf86Info.kbdEvents = NULL;
+#else
+ xf86Info.kbdEvents = xf86KbdEvents;
+#endif
+ } else if ( NameCompare(keybconf->keyb_protocol,"xqueue") == 0 ) {
+#ifdef XQUEUE
+ xf86Info.kbdProc = xf86XqueKbdProc;
+ xf86Info.kbdEvents = xf86XqueEvents;
+#ifndef NEW_INPUT
+ xf86Info.mouseDev->xqueSema = 0;
+#endif
+ xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
+#endif
+ } else {
+ xf86ConfigError("\"%s\" is not a valid keyboard protocol name",
+ keybconf->keyb_protocol);
+ return 0;
+ }
+
+ if ( keybconf->keyb_kbdDelay > 0 ) {
+ xf86Info.kbdDelay = keybconf->keyb_kbdDelay;
+ }
+
+ if ( keybconf->keyb_kbdRate > 0 ) {
+ xf86Info.kbdRate = keybconf->keyb_kbdRate;
+ }
+
+ if ( keybconf->keyb_xleds ) {
+ xf86Info.xleds = keybconf->keyb_xleds;
+ }
+
+#ifdef XKB
+ if ( keybconf->keyb_xkbDisable ) {
+ noXkbExtension = TRUE;
+ from = X_CONFIG;
+ xf86Msg(X_CONFIG, "XKB: disabled\n");
+ } else if (noXkbExtension)
+ from = X_CMDLINE;
+ if (noXkbExtension)
+ xf86Msg(from, "XKB: disabled\n");
+
+ if (!noXkbExtension && !XkbInitialMap) {
+ if ( keybconf->keyb_xkbkeymap ) {
+ xf86Info.xkbkeymap = keybconf->keyb_xkbkeymap;
+ xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
+ "(overrides other XKB settings)\n", xf86Info.xkbkeymap);
+ } else {
+ if ( keybconf->keyb_xkbcompat ) {
+ xf86Info.xkbcompat = keybconf->keyb_xkbcompat;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", xf86Info.xkbcompat);
+ }
+
+ if ( keybconf->keyb_xkbtypes ) {
+ xf86Info.xkbtypes = keybconf->keyb_xkbtypes;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", xf86Info.xkbtypes);
+ }
+
+ if ( keybconf->keyb_xkbkeycodes ) {
+ xf86Info.xkbkeycodes = keybconf->keyb_xkbkeycodes;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", xf86Info.xkbkeycodes);
+ }
+
+ if ( keybconf->keyb_xkbgeometry ) {
+ xf86Info.xkbgeometry = keybconf->keyb_xkbgeometry;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", xf86Info.xkbgeometry);
+ }
+
+ if ( keybconf->keyb_xkbsymbols ) {
+ xf86Info.xkbsymbols = keybconf->keyb_xkbsymbols;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", xf86Info.xkbsymbols);
+ }
+
+ if ( keybconf->keyb_xkbrules ) {
+ xf86Info.xkbrules = keybconf->keyb_xkbrules;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", xf86Info.xkbrules);
+ }
+
+ if ( keybconf->keyb_xkbmodel ) {
+ xf86Info.xkbmodel = keybconf->keyb_xkbmodel;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", xf86Info.xkbmodel);
+ }
+
+ if ( keybconf->keyb_xkblayout ) {
+ xf86Info.xkblayout = keybconf->keyb_xkblayout;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", xf86Info.xkblayout);
+ }
+
+ if ( keybconf->keyb_xkbvariant ) {
+ xf86Info.xkbvariant = keybconf->keyb_xkbvariant;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", xf86Info.xkbvariant);
+ }
+
+ if ( keybconf->keyb_xkboptions ) {
+ xf86Info.xkboptions = keybconf->keyb_xkboptions;
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", xf86Info.xkboptions);
+ }
+ }
+ }
+#endif
+#if defined(SVR4) && defined(i386)
+ if ( keybconf->keyb_panix106 ) {
+ xf86Info.panix106 = TRUE;
+ xf86Msg(X_CONFIG, "PANIX106: enabled\n");
+ }
+#endif
+
+ return TRUE;
+}
+
+static SymTabRec MouseTab[] = {
+ { PROT_MS, "microsoft" },
+ { PROT_MSC, "mousesystems" },
+ { PROT_MM, "mmseries" },
+ { PROT_LOGI, "logitech" },
+ { PROT_BM, "busmouse" },
+ { PROT_LOGIMAN, "mouseman" },
+ { PROT_PS2, "ps/2" },
+ { PROT_MMHIT, "mmhittab" },
+ { PROT_GLIDEPOINT, "glidepoint" },
+ { PROT_IMSERIAL, "intellimouse" },
+ { PROT_THINKING, "thinkingmouse" },
+ { PROT_IMPS2, "imps/2" },
+ { PROT_THINKINGPS2, "thinkingmouseps/2" },
+ { PROT_MMANPLUSPS2, "mousemanplusps/2" },
+ { PROT_GLIDEPOINTPS2, "glidepointps/2" },
+ { PROT_NETPS2, "netmouseps/2" },
+ { PROT_NETSCROLLPS2, "netscrollps/2" },
+ { PROT_SYSMOUSE, "sysmouse" },
+ { PROT_WSMOUSE, "wsmouse" },
+ { PROT_SUN, "sun" },
+ { PROT_AUTO, "auto" },
+ { PROT_ACECAD, "acecad" },
+ { -1, "" },
+};
+
+#define ISSERIALPROT(m) \
+ ((m) == PROT_MS || (m) == PROT_MSC || (m) == PROT_MM || \
+ (m) == PROT_LOGI || (m) == PROT_LOGIMAN || (m) == PROT_MMHIT || \
+ (m) == PROT_GLIDEPOINT || (m) == PROT_IMSERIAL || \
+ (m) == PROT_THINKING || (m) == PROT_AUTO || (m) == PROT_ACECAD)
+
+/* XXXSTU The interface in xf86XInput.c also needs to change to match this.
+ * This function is also used for the (*device_config)() function */
+
+static Bool
+configPointer(MouseDevPtr mouse_dev, XF86ConfPointerPtr pointerconf)
+{
+ int mtoken = -1;
+
+ /* Set defaults */
+ mouse_dev->baudRate = 1200;
+ mouse_dev->oldBaudRate = -1;
+ mouse_dev->sampleRate = 0;
+ mouse_dev->emulate3Buttons = FALSE;
+ mouse_dev->emulate3Timeout = 50;
+ mouse_dev->chordMiddle = FALSE;
+ mouse_dev->mouseFlags = 0;
+ mouse_dev->mseProc = NULL;
+ mouse_dev->mseDevice = NULL;
+ mouse_dev->mseType = -1;
+ mouse_dev->mseModel = 0;
+ mouse_dev->resolution = 0;
+ mouse_dev->buttons = MSE_DFLTBUTTONS;
+ mouse_dev->negativeZ = 0;
+ mouse_dev->positiveZ = 0;
+
+ if ( pointerconf->pntr_protocol ) {
+#if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY)
+ if ( NameCompare(pointerconf->pntr_protocol,"osmouse") == 0 ) {
+ xf86Msg(X_CONFIG, "OsMouse selected for mouse input\n");
+ mouse_dev->mseProc = xf86OsMouseProc;
+ mouse_dev->mseEvents = (void(*)(MouseDevPtr))xf86OsMouseEvents;
+ }
+#endif
+#ifdef XQUEUE
+ if ( NameCompare(pointerconf->pntr_protocol,"xqueue") == 0 ) {
+ mouse_dev->mseProc = xf86XqueMseProc;
+ mouse_dev->mseEvents = (void(*)(MouseDevPtr))xf86XqueEvents;
+ mouse_dev->xqueSema = 0;
+ xf86Msg(X_CONFIG, "Xqueue selected for mouse input\n");
+ }
+#endif
+#ifndef OSMOUSE_ONLY
+ if( !mouse_dev->mseProc ) {
+ mtoken = xf86StringToToken(MouseTab, pointerconf->pntr_protocol);
+#ifdef AMOEBA
+ mouse_dev->mseProc = xf86MseProc;
+ mouse_dev->mseEvents = NULL;
+#else
+ mouse_dev->mseProc = xf86MseProc;
+ mouse_dev->mseEvents = xf86MseEvents;
+#endif
+ if (mtoken == -1)
+ {
+ xf86ConfigError("Pointer Protocol \"%s\" not recognized",
+ pointerconf->pntr_protocol);
+ return FALSE;
+ }
+ mouse_dev->mseType = mtoken;
+ if (!xf86MouseSupported(mouse_dev->mseType))
+ {
+ xf86ConfigError("Mouse type \"%s\"not supported by this OS",
+ pointerconf->pntr_protocol);
+ return FALSE;
+ }
+ }
+#endif /* !OSMOUSE_ONLY */
+
+ if( !mouse_dev->mseProc ) {
+ xf86ConfigError("Mouse type \"%s\" not supported by this OS",
+ pointerconf->pntr_protocol);
+ return FALSE;
+ }
+ } else {
+ xf86ConfigError("No mouse protocol given\n");
+ return FALSE;
+ }
+
+#ifndef OSMOUSE_ONLY
+#ifdef MACH386
+ mouse_dev->mseDevice = "/dev/mouse";
+#else
+ if( pointerconf->pntr_device ) {
+ mouse_dev->mseDevice = pointerconf->pntr_device;
+ }
+#endif
+
+ if( pointerconf->pntr_baudrate ) {
+ if (mouse_dev->mseType == PROT_LOGIMAN) {
+ /*
+ * XXXX This should be extended to other mouse types -- most
+ * support only 1200. Should also disallow baudrate for bus mice
+ */
+ /* Moan if illegal baud rate! [CHRIS-211092] */
+ if ((pointerconf->pntr_baudrate != 1200)
+ && (pointerconf->pntr_baudrate != 9600)) {
+ xf86ConfigError("Only 1200 or 9600 Baud are supported by MouseMan");
+ return FALSE;
+ }
+ }
+ else {
+ if (pointerconf->pntr_baudrate%1200 != 0
+ || pointerconf->pntr_baudrate < 1200
+ || pointerconf->pntr_baudrate > 9600) {
+ xf86ConfigError("Baud rate must be one of 1200, 2400, 4800, or 9600");
+ return FALSE;
+ }
+ }
+ mouse_dev->baudRate = pointerconf->pntr_baudrate;
+ }
+
+ if( pointerconf->pntr_samplerate ) {
+ if (mouse_dev->mseType == PROT_LOGIMAN) {
+ /* XXXX Most mice don't allow this */
+ /* Moan about illegal sample rate! [CHRIS-211092] */
+ xf86ConfigError("Selection of sample rate is not supported by MouseMan");
+ return FALSE;
+ }
+ mouse_dev->sampleRate = pointerconf->pntr_samplerate;
+ }
+
+ if (pointerconf->pntr_resolution) {
+ if (pointerconf->pntr_resolution <= 0) {
+ xf86ConfigError("Resolution must be a positive value");
+ } else {
+ mouse_dev->resolution = pointerconf->pntr_resolution;
+ }
+ }
+
+#endif /* !OSMOUSE_ONLY */
+ if( pointerconf->pntr_emulate3Buttons ) {
+ if( pointerconf->pntr_chordMiddle ) {
+ xf86ConfigError("Can't use Emulate3Buttons with ChordMiddle");
+ return FALSE;
+ }
+ mouse_dev->emulate3Buttons = pointerconf->pntr_emulate3Buttons;
+ }
+ if( pointerconf->pntr_emulate3Timeout ) {
+ mouse_dev->emulate3Timeout = pointerconf->pntr_emulate3Timeout;
+ }
+#ifndef OSMOUSE_ONLY
+ if( pointerconf->pntr_chordMiddle ) {
+ if (mouse_dev->mseType == PROT_MS ||
+ mouse_dev->mseType == PROT_LOGIMAN) {
+ if (mouse_dev->emulate3Buttons) {
+ xf86ConfigError("Can't use ChordMiddle with Emulate3Buttons");
+ return FALSE;
+ }
+ mouse_dev->chordMiddle = pointerconf->pntr_chordMiddle;
+ }
+ else {
+ xf86ConfigError("ChordMiddle is only supported for "
+ "Microsoft and Logiman");
+ return 0;
+ }
+ }
+ if( pointerconf->pntr_clearDtr ) {
+#ifdef CLEARDTR_SUPPORT
+ if (mouse_dev->mseType == PROT_MSC)
+ mouse_dev->mouseFlags |= MF_CLEAR_DTR;
+ else
+ xf86ConfigError("ClearDTR only supported for MouseSystems mouse");
+#else
+ xf86ConfigError("ClearDTR not supported on this OS");
+#endif
+ }
+
+ if( pointerconf->pntr_clearRts ) {
+#ifdef CLEARDTR_SUPPORT
+ if (mouse_dev->mseType == PROT_MSC)
+ mouse_dev->mouseFlags |= MF_CLEAR_RTS;
+ else
+ xf86ConfigError("ClearRTS only supported for MouseSystems mouse");
+#else
+ xf86ConfigError("ClearRTS not supported on this OS");
+#endif
+ }
+
+ if( pointerconf->pntr_alwaysCore ) {
+#ifdef XINPUT
+ xf86AlwaysCore(mouse_dev->local, TRUE);
+#else
+ xf86ConfigError("AlwaysCore not supported in this Server");
+#endif
+ }
+#endif /* OSMOUSE_ONLY */
+
+ if (pointerconf->pntr_buttons) {
+ if (pointerconf->pntr_buttons <= 0
+ || pointerconf->pntr_buttons > MSE_MAXBUTTONS) {
+ xf86ConfigError("Number of buttons (1..12) expected");
+ } else {
+ mouse_dev->buttons = pointerconf->pntr_buttons;
+ }
+ }
+
+ if (pointerconf->pntr_positiveZ) {
+ switch (pointerconf->pntr_positiveZ) {
+ case CONF_ZAXIS_MAPTOX:
+ mouse_dev->negativeZ = mouse_dev->positiveZ = MSE_MAPTOX;
+ break;
+ case CONF_ZAXIS_MAPTOY:
+ mouse_dev->negativeZ = mouse_dev->positiveZ = MSE_MAPTOY;
+ break;
+ default: /* number */
+ if (pointerconf->pntr_negativeZ <= 0
+ || pointerconf->pntr_negativeZ > MSE_MAXBUTTONS
+ || pointerconf->pntr_positiveZ <= 0
+ || pointerconf->pntr_positiveZ > MSE_MAXBUTTONS) {
+ xf86ConfigError("Button number (1..12) expected");
+ } else {
+ mouse_dev->negativeZ = 1 << (pointerconf->pntr_negativeZ - 1);
+ mouse_dev->positiveZ = 1 << (pointerconf->pntr_positiveZ - 1);
+ if (pointerconf->pntr_negativeZ > mouse_dev->buttons)
+ mouse_dev->buttons = pointerconf->pntr_negativeZ;
+ if (pointerconf->pntr_positiveZ > mouse_dev->buttons)
+ mouse_dev->buttons = pointerconf->pntr_positiveZ;
+ }
+ break;
+ }
+ }
+
+ /*
+ * If mseProc is set and mseType isn't, then using Xqueue or OSmouse.
+ * Otherwise, a mouse device is required.
+ */
+ if (mouse_dev->mseType >= 0 && !mouse_dev->mseDevice) {
+ xf86ConfigError("No mouse device given");
+ }
+
+ if (mouse_dev->mseType >= 0) {
+ Bool formatFlag = FALSE;
+ xf86Msg(X_CONFIG, "Mouse: type: %s, device: %s",
+ pointerconf->pntr_protocol, mouse_dev->mseDevice);
+ if (ISSERIALPROT(mouse_dev->mseType)) {
+ formatFlag = TRUE;
+ xf86ErrorF(", baudrate: %d", mouse_dev->baudRate);
+ }
+ if (mouse_dev->sampleRate) {
+ xf86ErrorF("%ssamplerate: %d", formatFlag ? ",\n\t" : ", ",
+ mouse_dev->sampleRate);
+ formatFlag = !formatFlag;
+ }
+ if (mouse_dev->resolution) {
+ xf86ErrorF("%sresolution: %d", formatFlag ? ",\n\t" : ", ",
+ mouse_dev->resolution);
+ if (formatFlag)
+ formatFlag = FALSE;
+ }
+ if (mouse_dev->emulate3Buttons)
+ xf86ErrorF("%s3 button emulation (timeout: %dms)",
+ formatFlag ? ",\n\t" : ", ", mouse_dev->emulate3Timeout);
+ if (mouse_dev->chordMiddle)
+ xf86ErrorF("%sChorded middle button", formatFlag ? ",\n\t" : ", ");
+ switch (mouse_dev->negativeZ) {
+ case 0: /* none */
+ break;
+ case MSE_MAPTOX:
+ xf86ErrorF("%szaxis mapping: X", formatFlag ? ",\n\t" : ", ");
+ break;
+ case MSE_MAPTOY:
+ xf86ErrorF("%szaxis mapping: Y", formatFlag ? ",\n\t" : ", ");
+ break;
+ default: /* buttons */
+ xf86ErrorF("%szaxis mapping: (-)%d (+)%d", formatFlag ? ",\n\t" : ", ",
+ pointerconf->pntr_negativeZ, pointerconf->pntr_positiveZ);
+ break;
+ }
+ xf86ErrorF("\n");
+ }
+ return TRUE;
+}
+#endif
+
+/*
+ * XXX This function is temporary, and will be removed when the keyboard
+ * driver is converted into a regular input driver.
+ */
+static Bool
+configInputKbd(IDevPtr inputp)
+{
+ char *s;
+#ifdef XKB
+ MessageType from = X_DEFAULT;
+#endif
+
+ /* Initialize defaults */
+ xf86Info.xleds = 0L;
+ xf86Info.kbdDelay = 500;
+ xf86Info.kbdRate = 30;
+ xf86Info.kbdProc = NULL;
+ xf86Info.vtinit = NULL;
+ xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
+#if defined(SVR4) && defined(i386)
+ xf86Info.panix106 = FALSE;
+#endif
+#ifdef XKB
+ if (!xf86IsPc98()) {
+ xf86Info.xkbrules = "xfree86";
+ xf86Info.xkbmodel = "pc101";
+ xf86Info.xkblayout = "us";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ } else {
+ xf86Info.xkbrules = "xfree98";
+ xf86Info.xkbmodel = "pc98";
+ xf86Info.xkblayout = "nec/jp";
+ xf86Info.xkbvariant = NULL;
+ xf86Info.xkboptions = NULL;
+ }
+ xf86Info.xkbcomponents_specified = FALSE;
+ /* Should discourage the use of these. */
+ xf86Info.xkbkeymap = NULL;
+ xf86Info.xkbtypes = NULL;
+ xf86Info.xkbcompat = NULL;
+ xf86Info.xkbkeycodes = NULL;
+ xf86Info.xkbsymbols = NULL;
+ xf86Info.xkbgeometry = NULL;
+#endif
+
+ s = xf86SetStrOption(inputp->commonOptions, "Protocol", "standard");
+ if (xf86NameCmp(s, "standard") == 0) {
+ xf86Info.kbdProc = xf86KbdProc;
+#ifdef AMOEBA
+ xf86Info.kbdEvents = NULL;
+#else
+ xf86Info.kbdEvents = xf86KbdEvents;
+#endif
+ } else if (xf86NameCmp(s, "xqueue") == 0) {
+#ifdef XQUEUE
+ xf86Info.kbdProc = xf86XqueKbdProc;
+ xf86Info.kbdEvents = xf86XqueEvents;
+ xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
+#endif
+ } else {
+ xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s);
+ return FALSE;
+ }
+
+ s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL);
+ if (s) {
+ if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) {
+ xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s);
+ return FALSE;
+ }
+ }
+
+ s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
+ if (s) {
+ char *l, *end;
+ unsigned int i;
+ l = strtok(s, " \t\n");
+ while (l) {
+ i = strtoul(l, &end, 0);
+ if (*end == '\0')
+ xf86Info.xleds |= 1L << (i - 1);
+ else {
+ xf86ConfigError("\"%s\" is not a valid XLeds value", l);
+ return FALSE;
+ }
+ l = strtok(NULL, " \t\n");
+ }
+ }
+
+#ifdef XKB
+ from = X_DEFAULT;
+ if (noXkbExtension)
+ from = X_CMDLINE;
+ else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) {
+ noXkbExtension =
+ xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE);
+ from = X_CONFIG;
+ }
+ if (noXkbExtension)
+ xf86Msg(from, "XKB: disabled\n");
+
+#define NULL_IF_EMPTY(s) (s[0] ? s : NULL)
+
+ if (!noXkbExtension && !XkbInitialMap) {
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) {
+ xf86Info.xkbkeymap = NULL_IF_EMPTY(s);
+ xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
+ "(overrides other XKB settings)\n", xf86Info.xkbkeymap);
+ } else {
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) {
+ xf86Info.xkbcompat = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) {
+ xf86Info.xkbtypes = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) {
+ xf86Info.xkbkeycodes = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) {
+ xf86Info.xkbgeometry = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) {
+ xf86Info.xkbsymbols = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) {
+ xf86Info.xkbrules = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) {
+ xf86Info.xkbmodel = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) {
+ xf86Info.xkblayout = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) {
+ xf86Info.xkbvariant = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s);
+ }
+
+ if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) {
+ xf86Info.xkboptions = NULL_IF_EMPTY(s);
+ xf86Info.xkbcomponents_specified = TRUE;
+ xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s);
+ }
+ }
+ }
+#undef NULL_IF_EMPTY
+#endif
+#if defined(SVR4) && defined(i386)
+ if ((xf86Info.panix106 =
+ xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) {
+ xf86Msg(X_CONFIG, "PANIX106: enabled\n");
+ }
+#endif
+
+ return TRUE;
+}
+
+static Bool
+checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
+{
+ Bool havePointer = FALSE, haveKeyboard = FALSE;
+ Bool foundPointer = FALSE, foundKeyboard = FALSE;
+ IDevPtr indp;
+ IDevRec Pointer, Keyboard;
+ XF86ConfInputPtr confInput;
+ int count = 0;
+ MessageType from = X_DEFAULT;
+
+ /* Check if a core pointer or core keyboard is needed. */
+ for (indp = servlayoutp->inputs; indp->identifier; indp++) {
+ if ((indp->commonOptions &&
+ xf86FindOption(indp->extraOptions, "CorePointer")) ||
+ (indp->extraOptions &&
+ xf86FindOption(indp->commonOptions, "CorePointer"))) {
+ havePointer = TRUE;
+ }
+ if ((indp->commonOptions &&
+ xf86FindOption(indp->extraOptions, "CoreKeyboard")) ||
+ (indp->extraOptions &&
+ xf86FindOption(indp->commonOptions, "CoreKeyboard"))) {
+ haveKeyboard = TRUE;
+ }
+ count++;
+ }
+ if (!havePointer) {
+ if (xf86PointerName) {
+ confInput = xf86FindInput(xf86PointerName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86PointerName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ } else {
+ from = X_DEFAULT;
+ confInput = xf86FindInput(CONF_IMPLICIT_POINTER,
+ xf86configptr->conf_input_lst);
+ if (!confInput && implicitLayout) {
+ confInput = xf86FindInputByDriver("mouse",
+ xf86configptr->conf_input_lst);
+ }
+ }
+ if (confInput)
+ foundPointer = configInput(&Pointer, confInput, from);
+ }
+ if (!haveKeyboard) {
+ if (xf86KeyboardName) {
+ confInput = xf86FindInput(xf86KeyboardName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86KeyboardName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ } else {
+ from = X_DEFAULT;
+ confInput = xf86FindInput(CONF_IMPLICIT_KEYBOARD,
+ xf86configptr->conf_input_lst);
+ if (!confInput && implicitLayout) {
+ confInput = xf86FindInputByDriver("keyboard",
+ xf86configptr->conf_input_lst);
+ }
+ }
+ if (confInput)
+ foundKeyboard = configInput(&Keyboard, confInput, from);
+ }
+ if (foundPointer) {
+ count++;
+ indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
+ indp[count - 1] = Pointer;
+ indp[count - 1].extraOptions = addNewOption(NULL, "CorePointer", NULL);
+ indp[count].identifier = NULL;
+ servlayoutp->inputs = indp;
+ } else if (!havePointer) {
+ if (implicitLayout)
+ xf86Msg(X_ERROR, "Unable to find a core pointer device\n");
+ else
+ xf86Msg(X_ERROR, "No core pointer device specified\n");
+ return FALSE;
+ }
+ if (foundKeyboard) {
+ count++;
+ indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
+ indp[count - 1] = Keyboard;
+ indp[count - 1].extraOptions = addNewOption(NULL, "CoreKeyboard", NULL);
+ indp[count].identifier = NULL;
+ servlayoutp->inputs = indp;
+ } else if (!haveKeyboard) {
+ if (implicitLayout)
+ xf86Msg(X_ERROR, "Unable to find a core keyboard device\n");
+ else
+ xf86Msg(X_ERROR, "No core keyboard device specified\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * figure out which layout is active, which screens are used in that layout,
+ * which drivers and monitors are used in these screens
+ */
+static Bool
+configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout)
+{
+ XF86ConfAdjacencyPtr adjp;
+ XF86ConfInactivePtr idp;
+ XF86ConfInputrefPtr irp;
+ int count = 0;
+ int scrnum;
+ XF86ConfLayoutPtr l;
+ MessageType from;
+ screenLayoutPtr slp;
+ GDevPtr gdp;
+ IDevPtr indp;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ /*
+ * which layout section is the active one?
+ *
+ * If there is a -layout command line option, use that one, otherwise
+ * pick the first one.
+ */
+ from = X_CONFIG;
+ if (xf86LayoutName != NULL) {
+ if ((l = xf86FindLayout(xf86LayoutName, conf_layout)) == NULL) {
+ xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
+ xf86LayoutName);
+ return FALSE;
+ }
+ conf_layout = l;
+ from = X_CMDLINE;
+ }
+ xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
+ adjp = conf_layout->lay_adjacency_lst;
+
+ /*
+ * we know that each screen is referenced exactly once on the left side
+ * of a layout statement in the Layout section. So to allocate the right
+ * size for the array we do a quick walk of the list to figure out how
+ * many sections we have
+ */
+ while (adjp) {
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d screens in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ slp = xnfalloc((count + 1) * sizeof(screenLayoutRec));
+ slp[count].screen = NULL;
+ /*
+ * now that we have storage, loop over the list again and fill in our
+ * data structure; at this point we do not fill in the adjacency
+ * information as it is not clear if we need it at all
+ */
+ adjp = conf_layout->lay_adjacency_lst;
+ count = 0;
+ while (adjp) {
+ slp[count].screen = xnfalloc(sizeof(confScreenRec));
+ if (adjp->adj_scrnum < 0)
+ scrnum = count;
+ else
+ scrnum = adjp->adj_scrnum;
+ if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
+ X_CONFIG))
+ return FALSE;
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ }
+ /*
+ * Count the number of inactive devices.
+ */
+ count = 0;
+ idp = conf_layout->lay_inactive_lst;
+ while (idp) {
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d inactive devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ gdp = xnfalloc((count + 1) * sizeof(GDevRec));
+ gdp[count].identifier = NULL;
+ idp = conf_layout->lay_inactive_lst;
+ count = 0;
+ while (idp) {
+ if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+ return FALSE;
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+ /*
+ * Count the number of input devices.
+ */
+ count = 0;
+ irp = conf_layout->lay_input_lst;
+ while (irp) {
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d input devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ indp = xnfalloc((count + 1) * sizeof(IDevRec));
+ indp[count].identifier = NULL;
+ irp = conf_layout->lay_input_lst;
+ count = 0;
+ while (irp) {
+ if (!configInput(&indp[count], irp->iref_inputdev, X_CONFIG))
+ return FALSE;
+ indp[count].extraOptions = irp->iref_option_lst;
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+ servlayoutp->id = conf_layout->lay_identifier;
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = gdp;
+ servlayoutp->inputs = indp;
+ servlayoutp->options = conf_layout->lay_option_lst;
+#ifdef NEW_INPUT
+ if (!checkCoreInputDevices(servlayoutp, FALSE))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+/*
+ * No layout section, so find the first Screen section and set that up as
+ * the only active screen.
+ */
+static Bool
+configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
+{
+ MessageType from;
+ XF86ConfScreenPtr s;
+ screenLayoutPtr slp;
+ IDevPtr indp;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ if (conf_screen == NULL) {
+ xf86ConfigError("No Screen sections present\n");
+ return FALSE;
+ }
+
+ /*
+ * which screen section is the active one?
+ *
+ * If there is a -screen option, use that one, otherwise use the first
+ * one.
+ */
+
+ from = X_CONFIG;
+ if (xf86ScreenName != NULL) {
+ if ((s = xf86FindScreen(xf86ScreenName, conf_screen)) == NULL) {
+ xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
+ xf86ScreenName);
+ return FALSE;
+ }
+ conf_screen = s;
+ from = X_CMDLINE;
+ }
+
+ /* We have exactly one screen */
+
+ slp = xnfalloc(2 * sizeof(screenLayoutRec));
+ slp[0].screen = xnfalloc(sizeof(confScreenRec));
+ slp[1].screen = NULL;
+ if (!configScreen(slp[0].screen, conf_screen, 0, from))
+ return FALSE;
+ servlayoutp->id = "(implicit)";
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = NULL;
+ servlayoutp->options = NULL;
+ /* Set up an empty input device list, then look for some core devices. */
+ indp = xnfalloc(sizeof(IDevRec));
+ indp->identifier = NULL;
+ servlayoutp->inputs = indp;
+#ifdef NEW_INPUT
+ if (!checkCoreInputDevices(servlayoutp, TRUE))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+static Bool
+configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
+{
+ int count = 0;
+ XF86ConfVideoPortPtr conf_port;
+
+ xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
+ conf_adaptor->va_identifier);
+ adaptor->identifier = conf_adaptor->va_identifier;
+ adaptor->options = conf_adaptor->va_option_lst;
+ if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
+ xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
+ return FALSE;
+ }
+
+ /*
+ * figure out how many videoport subsections there are and fill them in
+ */
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
+ adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec));
+ adaptor->numports = count;
+ count = 0;
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ adaptor->ports[count].identifier = conf_port->vp_identifier;
+ adaptor->ports[count].options = conf_port->vp_option_lst;
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
+
+ return TRUE;
+}
+
+static Bool
+configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
+ MessageType from)
+{
+ int count = 0;
+ XF86ConfDisplayPtr dispptr;
+ XF86ConfAdaptorLinkPtr conf_adaptor;
+
+ xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
+ scrnum);
+ /*
+ * now we fill in the elements of the screen
+ */
+ screenp->id = conf_screen->scrn_identifier;
+ screenp->screennum = scrnum;
+ screenp->defaultdepth = conf_screen->scrn_defaultdepth;
+ screenp->defaultbpp = conf_screen->scrn_defaultbpp;
+ screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
+ screenp->monitor = xnfalloc(sizeof(MonRec));
+ if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
+ return FALSE;
+ screenp->device = xnfalloc(sizeof(GDevRec));
+ configDevice(screenp->device,conf_screen->scrn_device, TRUE);
+ screenp->device->myScreenSection = screenp;
+ screenp->options = conf_screen->scrn_option_lst;
+
+ /*
+ * figure out how many display subsections there are and fill them in
+ */
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
+ screenp->displays = xnfalloc((count) * sizeof(DispRec));
+ screenp->numdisplays = count;
+ count = 0;
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ configDisplay(&(screenp->displays[count]),dispptr);
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
+
+ /*
+ * figure out how many videoadaptor references there are and fill them in
+ */
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ count++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
+ screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec));
+ screenp->numxvadaptors = 0;
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]),
+ conf_adaptor->al_adaptor))
+ screenp->numxvadaptors++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
+
+ return TRUE;
+}
+
+static Bool
+configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
+{
+ int count;
+ DisplayModePtr mode,last = NULL;
+ XF86ConfModeLinePtr cmodep;
+ XF86ConfModesPtr modes;
+ XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
+ Gamma zeros = {0.0, 0.0, 0.0};
+ float badgamma = 0.0;
+
+ xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n",
+ conf_monitor->mon_identifier);
+ monitorp->id = conf_monitor->mon_identifier;
+ monitorp->vendor = conf_monitor->mon_vendor;
+ monitorp->model = conf_monitor->mon_modelname;
+ monitorp->Modes = NULL;
+ monitorp->Last = NULL;
+ monitorp->gamma = zeros;
+ monitorp->widthmm = conf_monitor->mon_width;
+ monitorp->heightmm = conf_monitor->mon_height;
+ monitorp->options = conf_monitor->mon_option_lst;
+
+ /*
+ * fill in the monitor structure
+ */
+ for( count = 0 ; count < conf_monitor->mon_n_hsync; count++) {
+ monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi;
+ monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo;
+ }
+ monitorp->nHsync = conf_monitor->mon_n_hsync;
+ for( count = 0 ; count < conf_monitor->mon_n_vrefresh; count++) {
+ monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi;
+ monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo;
+ }
+ monitorp->nVrefresh = conf_monitor->mon_n_vrefresh;
+
+ /*
+ * first we collect the mode lines from the UseModes directive
+ */
+ while(modeslnk)
+ {
+ modes = xf86FindModes (modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor */
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ addListItem((GenericListPtr)conf_monitor->mon_modeline_lst,
+ (GenericListPtr)modes->mon_modeline_lst);
+ modeslnk = modeslnk->list.next;
+ }
+
+ /*
+ * we need to hook in the mode lines now
+ * here both data structures use lists, only our internal one
+ * is double linked
+ */
+ cmodep = conf_monitor->mon_modeline_lst;
+ while( cmodep ) {
+ mode = xnfalloc(sizeof(DisplayModeRec));
+ memset(mode,'\0',sizeof(DisplayModeRec));
+ mode->type = 0;
+ mode->Clock = cmodep->ml_clock;
+ mode->HDisplay = cmodep->ml_hdisplay;
+ mode->HSyncStart = cmodep->ml_hsyncstart;
+ mode->HSyncEnd = cmodep->ml_hsyncend;
+ mode->HTotal = cmodep->ml_htotal;
+ mode->VDisplay = cmodep->ml_vdisplay;
+ mode->VSyncStart = cmodep->ml_vsyncstart;
+ mode->VSyncEnd = cmodep->ml_vsyncend;
+ mode->VTotal = cmodep->ml_vtotal;
+ mode->Flags = cmodep->ml_flags;
+ mode->HSkew = cmodep->ml_hskew;
+ mode->VScan = cmodep->ml_vscan;
+ mode->name = xnfstrdup(cmodep->ml_identifier);
+ if( last ) {
+ mode->prev = last;
+ last->next = mode;
+ }
+ else {
+ /*
+ * this is the first mode
+ */
+ monitorp->Modes = mode;
+ mode->prev = NULL;
+ }
+ last = mode;
+ cmodep = (XF86ConfModeLinePtr)cmodep->list.next;
+ }
+ if(last){
+ last->next = NULL;
+ }
+ monitorp->Last = last;
+
+ /* add the (VESA) default modes */
+ if (! addDefaultModes(monitorp) )
+ return FALSE;
+
+ if (conf_monitor->mon_gamma_red > GAMMA_ZERO)
+ monitorp->gamma.red = conf_monitor->mon_gamma_red;
+ if (conf_monitor->mon_gamma_green > GAMMA_ZERO)
+ monitorp->gamma.green = conf_monitor->mon_gamma_green;
+ if (conf_monitor->mon_gamma_blue > GAMMA_ZERO)
+ monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
+
+ /* Check that the gamma values are within range */
+ if (monitorp->gamma.red > GAMMA_ZERO &&
+ (monitorp->gamma.red < GAMMA_MIN ||
+ monitorp->gamma.red > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.red;
+ } else if (monitorp->gamma.green > GAMMA_ZERO &&
+ (monitorp->gamma.green < GAMMA_MIN ||
+ monitorp->gamma.green > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.green;
+ } else if (monitorp->gamma.blue > GAMMA_ZERO &&
+ (monitorp->gamma.blue < GAMMA_MIN ||
+ monitorp->gamma.blue > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.blue;
+ }
+ if (badgamma > GAMMA_ZERO) {
+ xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
+ badgamma, GAMMA_MIN, GAMMA_MAX);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static int
+lookupVisual(const char *visname)
+{
+ int i;
+
+ if (!visname || !*visname)
+ return -1;
+
+ for (i = 0; i <= DirectColor; i++) {
+ if (!NameCompare(visname, xf86VisualNames[i]))
+ break;
+ }
+
+ if (i <= DirectColor)
+ return i;
+
+ return -1;
+}
+
+
+static Bool
+configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
+{
+ int count = 0;
+ XF86ModePtr modep;
+
+ displayp->frameX0 = conf_display->disp_frameX0;
+ displayp->frameY0 = conf_display->disp_frameY0;
+ displayp->virtualX = conf_display->disp_virtualX;
+ displayp->virtualY = conf_display->disp_virtualY;
+ displayp->depth = conf_display->disp_depth;
+ displayp->fbbpp = conf_display->disp_bpp;
+ displayp->weight.red = conf_display->disp_weight.red;
+ displayp->weight.green = conf_display->disp_weight.green;
+ displayp->weight.blue = conf_display->disp_weight.blue;
+ displayp->blackColour.red = conf_display->disp_black.red;
+ displayp->blackColour.green = conf_display->disp_black.green;
+ displayp->blackColour.blue = conf_display->disp_black.blue;
+ displayp->whiteColour.red = conf_display->disp_white.red;
+ displayp->whiteColour.green = conf_display->disp_white.green;
+ displayp->whiteColour.blue = conf_display->disp_white.blue;
+ displayp->options = conf_display->disp_option_lst;
+ if (conf_display->disp_visual) {
+ displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
+ if (displayp->defaultVisual == -1) {
+ xf86ConfigError("Invalid visual name: \"%s\"",
+ conf_display->disp_visual);
+ return FALSE;
+ }
+ } else {
+ displayp->defaultVisual = -1;
+ }
+
+ /*
+ * now hook in the modes
+ */
+ modep = conf_display->disp_mode_lst;
+ while(modep) {
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes = xnfalloc((count+1) * sizeof(char*));
+ modep = conf_display->disp_mode_lst;
+ count = 0;
+ while(modep) {
+ displayp->modes[count] = modep->mode_name;
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes[count] = NULL;
+
+ return TRUE;
+}
+
+static Bool
+configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
+{
+ int i;
+
+ if (active)
+ xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
+ conf_device->dev_identifier);
+ else
+ xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
+ conf_device->dev_identifier);
+
+ /*
+ * some things (like clocks) are missing here
+ */
+ devicep->identifier = conf_device->dev_identifier;
+ devicep->vendor = conf_device->dev_vendor;
+ devicep->board = conf_device->dev_board;
+ devicep->chipset = conf_device->dev_chipset;
+ devicep->ramdac = conf_device->dev_ramdac;
+ devicep->driver = conf_device->dev_driver;
+ devicep->active = active;
+ devicep->videoRam = conf_device->dev_videoram;
+ devicep->BiosBase = conf_device->dev_bios_base;
+ devicep->MemBase = conf_device->dev_mem_base;
+ devicep->IOBase = conf_device->dev_io_base;
+ devicep->clockchip = conf_device->dev_clockchip;
+ devicep->busID = conf_device->dev_busid;
+ devicep->textClockFreq = conf_device->dev_textclockfreq;
+ devicep->chipID = conf_device->dev_chipid;
+ devicep->chipRev = conf_device->dev_chiprev;
+ devicep->options = conf_device->dev_option_lst;
+ devicep->irq = conf_device->dev_irq;
+
+ for (i = 0; i < MAXDACSPEEDS; i++) {
+ if (i < CONF_MAXDACSPEEDS)
+ devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i];
+ else
+ devicep->dacSpeeds[i] = 0;
+ }
+ devicep->numclocks = conf_device->dev_clocks;
+ if (devicep->numclocks > MAXCLOCKS)
+ devicep->numclocks = MAXCLOCKS;
+ for (i = 0; i < devicep->numclocks; i++) {
+ devicep->clock[i] = conf_device->dev_clock[i];
+ }
+ devicep->claimed = FALSE;
+
+ return TRUE;
+}
+
+#ifdef XF86DRI
+static Bool
+configDRI(XF86ConfDRIPtr drip)
+{
+ int count = 0;
+ XF86ConfBuffersPtr bufs;
+ int i;
+
+ xf86ConfigDRI.group = drip ? drip->dri_group : NULL;
+ xf86ConfigDRI.mode = drip ? drip->dri_mode : NULL;
+ xf86ConfigDRI.bufs_count = 0;
+ xf86ConfigDRI.bufs = NULL;
+
+ if (drip) {
+ for (bufs = drip->dri_buffers_lst; bufs; bufs = bufs->list.next)
+ ++count;
+
+ xf86ConfigDRI.bufs_count = count;
+ xf86ConfigDRI.bufs = xnfalloc(count * sizeof(*xf86ConfigDRI.bufs));
+
+ for (i = 0, bufs = drip->dri_buffers_lst;
+ i < count;
+ i++, bufs = bufs->list.next) {
+
+ xf86ConfigDRI.bufs[i].count = bufs->buf_count;
+ xf86ConfigDRI.bufs[i].size = bufs->buf_size;
+ /* FIXME: Flags not implemented. These
+ could be used, for example, to specify a
+ contiguous block and/or write-combining
+ cache policy. */
+ xf86ConfigDRI.bufs[i].flags = 0;
+ }
+ }
+
+ return TRUE;
+}
+#endif
+
+static Bool
+configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
+{
+ xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
+ inputp->identifier = conf_input->inp_identifier;
+ inputp->driver = conf_input->inp_driver;
+ inputp->commonOptions = conf_input->inp_option_lst;
+ inputp->extraOptions = NULL;
+
+ /* XXX This is required until the keyboard driver is converted */
+ if (!xf86NameCmp(inputp->driver, "keyboard"))
+ return configInputKbd(inputp);
+
+ return TRUE;
+}
+
+static Bool
+modeIsPresent(char * modename,MonPtr monitorp)
+{
+ DisplayModePtr knownmodes = monitorp->Modes;
+
+ /* all I can think of is a linear search... */
+ while(knownmodes != NULL)
+ {
+ if(strcmp(modename,knownmodes->name) == 0)
+ return TRUE;
+ knownmodes = knownmodes->next;
+ }
+ return FALSE;
+}
+
+static Bool
+addDefaultModes(MonPtr monitorp)
+{
+ DisplayModePtr mode;
+ DisplayModePtr last = monitorp->Last;
+ int i = 0;
+
+ while (xf86DefaultModes[i].name != NULL)
+ {
+ if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) )
+ do
+ {
+ mode = xnfalloc(sizeof(DisplayModeRec));
+ memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
+ if (xf86DefaultModes[i].name)
+ mode->name = xnfstrdup(xf86DefaultModes[i].name);
+ if( last ) {
+ mode->prev = last;
+ last->next = mode;
+ }
+ else {
+ /* this is the first mode */
+ monitorp->Modes = mode;
+ mode->prev = NULL;
+ }
+ last = mode;
+ i++;
+ }
+ while((xf86DefaultModes[i].name != NULL) &&
+ (!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name)));
+ else
+ i++;
+ }
+ monitorp->Last = last;
+
+ return TRUE;
+}
+
+/*
+ * load the config file and fill the global data structure
+ */
+Bool
+xf86HandleConfigFile(void)
+{
+ const char *filename;
+ char *searchpath;
+ MessageType from = X_DEFAULT;
+
+ if (getuid() == 0)
+ searchpath = ROOT_CONFIGPATH;
+ else
+ searchpath = USER_CONFIGPATH;
+
+ if (xf86ConfigFile)
+ from = X_CMDLINE;
+
+ filename = xf86OpenConfigFile(searchpath, xf86ConfigFile, PROJECTROOT);
+ if (filename) {
+ xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
+ } else {
+ xf86Msg(X_ERROR, "Unable to locate/open config file");
+ if (xf86ConfigFile)
+ xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
+ xf86ErrorFVerb(0, "\n");
+ return FALSE;
+ }
+ if ((xf86configptr = xf86ReadConfigFile ()) == NULL) {
+ xf86Msg(X_ERROR, "Problem parsing the config file\n");
+ return FALSE;
+ }
+ xf86CloseConfigFile ();
+
+ /* Initialise a few things. */
+
+#ifndef NEW_INPUT
+#if defined(XINPUT)
+ xf86Info.mouseLocal = mouse_assoc.device_allocate();
+ xf86Info.mouseDev = (MouseDevPtr)
+ ((LocalDevicePtr)xf86Info.mouseLocal)->private;
+ xf86Info.mouseDev->mseProc = NULL;
+#else
+ xf86Info.mouseDev = (MouseDevPtr)xnfcalloc(1, sizeof(MouseDevRec));
+#endif
+#endif
+
+ /* Show what the marker symbols mean */
+ xf86ErrorF("Markers: " X_PROBE_STRING " probed, "
+ X_CONFIG_STRING " from config file, "
+ X_DEFAULT_STRING " default setting,\n"
+ " " X_CMDLINE_STRING " from command line, "
+ X_NOTICE_STRING " notice, "
+ X_INFO_STRING " informational,\n"
+ " " X_WARNING_STRING " warning, "
+ X_ERROR_STRING " error, "
+ X_UNKNOWN_STRING " unknown.\n");
+
+ /*
+ * now we convert part of the information contained in the parser
+ * structures into our own structures.
+ * The important part here is to figure out which Screen Sections
+ * in the XF86Config file are active so that we can piece together
+ * the modes that we need later down the road.
+ * And while we are at it, we'll decode the rest of the stuff as well
+ */
+
+ /* First check if a layout section is present, and if it is valid. */
+
+ if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
+ if (xf86ScreenName == NULL) {
+ xf86Msg(X_WARNING,
+ "No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout(&xf86ConfigLayout,
+ xf86configptr->conf_screen_lst)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ } else {
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
+
+ /* Now process everything else */
+
+ if (!configFiles(xf86configptr->conf_files) ||
+ !configServerFlags(xf86configptr->conf_flags,
+ xf86ConfigLayout.options)
+#ifndef NEW_INPUT
+ || !configKeyboard(xf86configptr->conf_keyboard)
+ || !configPointer(xf86Info.mouseDev,xf86configptr->conf_pointer)
+#endif
+#ifdef XF86DRI
+ || !configDRI(xf86configptr->conf_dri)
+#endif
+ ) {
+ ErrorF ("Problem when converting the config data structures\n");
+ return FALSE;
+ }
+
+ /*
+ * Handle some command line options that can override some of the
+ * ServerFlags settings.
+ */
+#ifdef XF86VIDMODE
+ if (xf86VidModeDisabled)
+ xf86Info.vidModeEnabled = FALSE;
+ if (xf86VidModeAllowNonLocal)
+ xf86Info.vidModeAllowNonLocal = TRUE;
+#endif
+
+#ifdef XF86MISC
+ if (xf86MiscModInDevDisabled)
+ xf86Info.miscModInDevEnabled = FALSE;
+ if (xf86MiscModInDevAllowNonLocal)
+ xf86Info.miscModInDevAllowNonLocal = TRUE;
+#endif
+
+ if (xf86AllowMouseOpenFail)
+ xf86Info.allowMouseOpenFail = TRUE;
+
+ return TRUE;
+}
+
+
+/* These make the equivalent parser functions visible to the common layer. */
+Bool
+xf86PathIsAbsolute(const char *path)
+{
+ return (PathIsAbsolute(path) != 0);
+}
+
+Bool
+xf86PathIsSafe(const char *path)
+{
+ return (PathIsSafe(path) != 0);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.h b/xc/programs/Xserver/hw/xfree86/common/xf86Config.h
new file mode 100644
index 000000000..6f6001b3c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.h
@@ -0,0 +1,25 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.h,v 1.4 1999/05/05 14:29:51 dawes Exp $ */
+/*
+ * Copyright 1997 by The XFree86 Project, Inc
+ */
+
+#ifndef _xf86_config_h
+#define _xf86_config_h
+
+#ifdef HAVE_PARSER_DECLS
+/*
+ * global structure that holds the result of parsing the config file
+ */
+extern XF86ConfigPtr xf86configptr;
+#endif
+
+/*
+ * prototypes
+ */
+char ** xf86ModulelistFromConfig(pointer **);
+char ** xf86DriverlistFromConfig(void);
+char ** xf86InputDriverlistFromConfig(void);
+Bool xf86BuiltinInputDriver(const char *);
+Bool xf86HandleConfigFile(void);
+
+#endif /* _xf86_config_h */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c
new file mode 100644
index 000000000..36e9d3152
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c
@@ -0,0 +1,367 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.18 1999/08/22 05:57:30 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xmd.h"
+#include "input.h"
+#include "cursor.h"
+#include "mipointer.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef XINPUT
+#include "XIproto.h"
+#include "xf86Xinput.h"
+#endif
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+typedef struct {
+ short left, right, up, down;
+} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
+
+static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
+static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
+static void xf86WarpCursor(ScreenPtr pScreen, int x, int y);
+
+static void xf86PointerMoved(int scrnIndex, int x, int y);
+
+static miPointerScreenFuncRec xf86PointerScreenFuncs = {
+ xf86CursorOffScreen,
+ xf86CrossScreen,
+ xf86WarpCursor,
+#ifdef XINPUT
+ xf86eqEnqueue,
+ xf86eqSwitchScreen
+#else
+ /* let miPointerInitialize take care of these */
+ NULL,
+ NULL
+#endif
+};
+
+static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
+static Bool haveScreenLayout;
+
+/*
+ * xf86InitViewport --
+ * Initialize paning & zooming parameters, so that a driver must only
+ * check what resolutions are possible and whether the virtual area
+ * is valid if specified.
+ */
+
+void
+xf86InitViewport(ScrnInfoPtr pScr)
+{
+
+ /* Set a default layout if none has been specified directly */
+ if (!haveScreenLayout) {
+ int left, right;
+
+ left = pScr->scrnIndex ? pScr->scrnIndex - 1 : xf86NumScreens - 1;
+ right = (pScr->scrnIndex + 1) % xf86NumScreens;
+
+ xf86SetScreenLayout(pScr->scrnIndex, left, right, -1, -1);
+ }
+
+ pScr->PointerMoved = xf86PointerMoved;
+
+ /*
+ * Compute the initial Viewport if necessary
+ */
+ if (pScr->frameX0 < 0)
+ {
+ pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
+ pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
+ }
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+
+ /*
+ * Now adjust the initial Viewport, so it lies within the virtual area
+ */
+ if (pScr->frameX1 >= pScr->virtualX)
+ {
+ pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+ }
+
+ if (pScr->frameY1 >= pScr->virtualY)
+ {
+ pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+ }
+}
+
+
+/*
+ * xf86SetViewport --
+ * Scroll the visual part of the screen so the pointer is visible.
+ */
+
+void
+xf86SetViewport(ScreenPtr pScreen, int x, int y)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+
+ (*pScr->PointerMoved)(pScreen->myNum, x, y);
+}
+
+
+static void
+xf86PointerMoved(int scrnIndex, int x, int y)
+{
+ Bool frameChanged = FALSE;
+ ScrnInfoPtr pScr = xf86Screens[scrnIndex];
+
+ /*
+ * check wether (x,y) belongs to the visual part of the screen
+ * if not, change the base of the displayed frame accoring
+ */
+ if ( pScr->frameX0 > x) {
+ pScr->frameX0 = x;
+ pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
+ frameChanged = TRUE ;
+ }
+
+ if ( pScr->frameX1 < x) {
+ pScr->frameX1 = x + 1;
+ pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
+ frameChanged = TRUE ;
+ }
+
+ if ( pScr->frameY0 > y) {
+ pScr->frameY0 = y;
+ pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
+ frameChanged = TRUE;
+ }
+
+ if ( pScr->frameY1 < y) {
+ pScr->frameY1 = y;
+ pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
+ frameChanged = TRUE;
+ }
+
+ if (frameChanged && pScr->AdjustFrame != NULL)
+ pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+}
+
+/*
+ * xf86LockZoom --
+ * Enable/disable ZoomViewport
+ */
+
+void
+xf86LockZoom(ScreenPtr pScreen, Bool lock)
+{
+ XF86SCRNINFO(pScreen)->zoomLocked = lock;
+}
+
+Bool
+xf86ZoomLocked(ScreenPtr pScreen)
+{
+ if (xf86Info.dontZoom || XF86SCRNINFO(pScreen)->zoomLocked)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*
+ * xf86ZoomViewport --
+ * Reinitialize the visual part of the screen for another mode.
+ */
+
+void
+xf86ZoomViewport (ScreenPtr pScreen, int zoom)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ Bool tmp;
+
+ if (pScr->zoomLocked)
+ return;
+
+ if (pScr->SwitchMode != NULL &&
+ pScr->currentMode != pScr->currentMode->next) {
+ pScr->currentMode = zoom > 0 ? pScr->currentMode->next
+ : pScr->currentMode->prev;
+
+ xf86EnterServerState(SETUP);
+ tmp = pScr->SwitchMode(pScr->scrnIndex, pScr->currentMode, 0);
+ xf86EnterServerState(OPERATING);
+ if (tmp) {
+ /*
+ * adjust new frame for the displaysize
+ */
+ pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 -
+ pScr->currentMode->HDisplay) / 2;
+ pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
+
+ if (pScr->frameX0 < 0) {
+ pScr->frameX0 = 0;
+ pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
+ } else if (pScr->frameX1 >= pScr->virtualX) {
+ pScr->frameX0 = pScr->virtualX - pScr->currentMode->HDisplay;
+ pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
+ }
+
+ pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 -
+ pScr->currentMode->VDisplay) / 2;
+ pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
+
+ if (pScr->frameY0 < 0) {
+ pScr->frameY0 = 0;
+ pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
+ } else if (pScr->frameY1 >= pScr->virtualY) {
+ pScr->frameY0 = pScr->virtualY - pScr->currentMode->VDisplay;
+ pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
+ }
+ }
+ else /* switch failed, so go back to old mode */
+ pScr->currentMode = zoom > 0 ? pScr->currentMode->prev
+ : pScr->currentMode->next;
+ }
+
+ if (pScr->AdjustFrame != NULL)
+ (pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+}
+
+
+
+/*
+ * xf86CursorOffScreen --
+ * Check whether it is necessary to switch to another screen
+ */
+
+static Bool
+xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
+{
+ int newX, newY;
+ int newScreen = -1;
+ ScreenPtr oldScreen = *pScreen;
+ xf86ScreenLayoutPtr layout = &(xf86ScreenLayout[(*pScreen)->myNum]);
+
+ /* This is a trivial case but it is not checked anywhere else. */
+ if (screenInfo.numScreens == 1)
+ return FALSE;
+
+ newX = *x;
+ newY = *y;
+
+ /* Find the new screen number from the screen layout array. */
+ if (*y < 0) {
+ newScreen = layout->up;
+ } else if (*y >= (*pScreen)->height) {
+ newScreen = layout->down;
+ } else if (*x < 0) {
+ newScreen = layout->left;
+ } else if (*x >= (*pScreen)->width) {
+ newScreen = layout->right;
+ }
+
+ if (newScreen < 0 || newScreen >= screenInfo.numScreens)
+ return FALSE;
+
+ /* Set pScreen, adjust x and y, set x and y. */
+ *pScreen = screenInfo.screens[newScreen];
+
+ if (*y < 0) {
+ newY += (*pScreen)->height;
+ } else if (*y >= oldScreen->height) {
+ newY -= oldScreen->height;
+ } else if (*x < 0) {
+ newX += (*pScreen)->width;
+ } else if (*x >= oldScreen->width) {
+ newX -= oldScreen->width;
+ }
+
+ *x = newX;
+ *y = newY;
+
+ return TRUE;
+}
+
+
+
+/*
+ * xf86CrossScreen --
+ * Switch to another screen
+ */
+
+/* NEED TO CHECK THIS */
+/* ARGSUSED */
+static void
+xf86CrossScreen (ScreenPtr pScreen, Bool entering)
+{
+#if 0
+ if (xf86Info.sharedMonitor)
+ (XF86SCRNINFO(pScreen)->EnterLeaveMonitor)(entering);
+ (XF86SCRNINFO(pScreen)->EnterLeaveCursor)(entering);
+#endif
+}
+
+
+/*
+ * xf86WarpCursor --
+ * Warp possible to another screen
+ */
+
+/* ARGSUSED */
+static void
+xf86WarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ miPointerWarpCursor(pScreen,x,y);
+
+ xf86Info.currentScreen = pScreen;
+}
+
+void
+xf86SetScreenLayout(int num, int left, int right, int up, int down)
+{
+#ifdef DEBUG
+ ErrorF("xf86SetScreenLayout: %d %d %d %d %d\n", num, left,right,up,down);
+#endif
+ if (num >= MAXSCREENS) {
+ ErrorF("xf86SetScreenLayout: Screen number %d >= MAXSCREENS\n", num);
+ return;
+ }
+
+ xf86ScreenLayout[num].left = left;
+ xf86ScreenLayout[num].right = right;
+ xf86ScreenLayout[num].up = up;
+ xf86ScreenLayout[num].down = down;
+}
+
+void *
+xf86GetPointerScreenFuncs(void)
+{
+ return (void *)&xf86PointerScreenFuncs;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c
new file mode 100644
index 000000000..ce9c4cc04
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c
@@ -0,0 +1,1055 @@
+/*
+ Copyright (c) 1999 - The XFree86 Project, Inc.
+
+ Written by Mark Vojkovich
+*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.24 1999/08/22 05:57:31 dawes Exp $ */
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Priv.h"
+#include "dgaproc.h"
+#include "xf86dgastr.h"
+#include "colormapst.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "XIproto.h"
+#include "globals.h"
+#include "servermd.h"
+#include "micmap.h"
+#ifdef XKB
+#include "XKBsrv.h"
+#endif
+
+static unsigned long DGAGeneration = 0;
+static int DGAScreenIndex = -1;
+
+static Bool DGACloseScreen(int i, ScreenPtr pScreen);
+static void DGADestroyColormap(ColormapPtr pmap);
+static void DGAInstallColormap(ColormapPtr pmap);
+
+static int
+DGASetDGAMode(
+ int index,
+ int num,
+ DGADevicePtr devRet
+);
+
+static void
+DGACopyModeInfo(
+ DGAModePtr mode,
+ XDGAModePtr xmode
+);
+
+#ifdef XFree86LOADER
+int *XDGAEventBase = NULL;
+#else
+int *XDGAEventBase = &DGAEventBase;
+#endif
+
+#define DGA_GET_SCREEN_PRIV(pScreen) \
+ ((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr))
+
+
+typedef struct _FakedVisualList{
+ Bool free;
+ VisualPtr pVisual;
+ struct _FakedVisualList *next;
+} FakedVisualList;
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ int numModes;
+ DGAModePtr modes;
+ CloseScreenProcPtr CloseScreen;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ DGADevicePtr current;
+ DGAFunctionPtr funcs;
+ int input;
+ ClientPtr client;
+ int pixmapMode;
+ FakedVisualList *fakedVisuals;
+ ColormapPtr dgaColormap;
+ ColormapPtr savedColormap;
+} DGAScreenRec, *DGAScreenPtr;
+
+
+Bool
+DGAInit(
+ ScreenPtr pScreen,
+ DGAFunctionPtr funcs,
+ DGAModePtr modes,
+ int num
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DGAScreenPtr pScreenPriv;
+ int i;
+
+ if(!funcs->Sync || !funcs->SetMode || !funcs->SetViewport ||
+ !funcs->GetViewport || !funcs->OpenFramebuffer)
+ return FALSE;
+
+ if(!modes || !num)
+ return FALSE;
+
+ if(DGAGeneration != serverGeneration) {
+ if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ DGAGeneration = serverGeneration;
+ }
+
+ if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
+ return FALSE;
+
+ pScreenPriv->pScrn = pScrn;
+ pScreenPriv->numModes = num;
+ pScreenPriv->modes = modes;
+ pScreenPriv->current = NULL;
+ pScreenPriv->funcs = funcs;
+ pScreenPriv->input = 0;
+ pScreenPriv->client = NULL;
+ pScreenPriv->fakedVisuals = NULL;
+ pScreenPriv->dgaColormap = NULL;
+ pScreenPriv->savedColormap = NULL;
+
+ for(i = 0; i < num; i++)
+ modes[i].num = i + 1;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ for(i = 0; i < num; i++)
+ modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
+#endif
+
+
+ pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DGACloseScreen;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreen->DestroyColormap = DGADestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = DGAInstallColormap;
+
+ pScrn->SetDGAMode = DGASetDGAMode;
+
+ return TRUE;
+}
+
+
+static void
+FreeMarkedVisuals(ScreenPtr pScreen)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ FakedVisualList *prev, *curr, *tmp;
+
+ if(!pScreenPriv->fakedVisuals)
+ return;
+
+ prev = NULL;
+ curr = pScreenPriv->fakedVisuals;
+
+ while(curr) {
+ if(curr->free) {
+ tmp = curr;
+ curr = curr->next;
+ if(prev)
+ prev->next = curr;
+ else
+ pScreenPriv->fakedVisuals = curr;
+ xfree(tmp->pVisual);
+ xfree(tmp);
+ } else {
+ prev = curr;
+ curr = curr->next;
+ }
+ }
+}
+
+
+static Bool
+DGACloseScreen(int i, ScreenPtr pScreen)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ FreeMarkedVisuals(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+
+ /* DGAShutdown() should have ensured that no DGA
+ screen were active by here */
+
+ xfree(pScreenPriv);
+
+ return((*pScreen->CloseScreen)(i, pScreen));
+}
+
+
+static void
+DGADestroyColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ VisualPtr pVisual = pmap->pVisual;
+
+ if(pScreenPriv->fakedVisuals) {
+ FakedVisualList *curr = pScreenPriv->fakedVisuals;
+
+ while(curr) {
+ if(curr->pVisual == pVisual) {
+ /* We can't get rid of them yet since FreeColormap
+ still needs the pVisual during the cleanup */
+ curr->free = TRUE;
+ break;
+ }
+ curr = curr->next;
+ }
+ }
+
+ if(pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap)(pmap);
+ pScreen->DestroyColormap = DGADestroyColormap;
+ }
+}
+
+
+static void
+DGAInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv->current) {
+ if (pmap != pScreenPriv->dgaColormap) {
+ pScreenPriv->savedColormap = pmap;
+ pmap = pScreenPriv->dgaColormap;
+ }
+ }
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap)(pmap);
+ pScreen->InstallColormap = DGAInstallColormap;
+}
+
+static int
+DGASetDGAMode(
+ int index,
+ int num,
+ DGADevicePtr devRet
+){
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ ScrnInfoPtr pScrn = pScreenPriv->pScrn;
+ DGADevicePtr device;
+ PixmapPtr pPix = NULL;
+ DGAModePtr pMode = NULL;
+
+ if(!num) {
+ if(pScreenPriv->current) {
+ PixmapPtr oldPix = pScreenPriv->current->pPix;
+ if(oldPix) {
+ if(oldPix->drawable.id)
+ FreeResource(oldPix->drawable.id, RT_NONE);
+ else
+ (*pScreen->DestroyPixmap)(oldPix);
+ }
+ xfree(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ pScrn->vtSema = TRUE;
+ if(pScreenPriv->savedColormap) {
+ miInstalledMaps[index] = pScreenPriv->savedColormap;
+ pScreenPriv->savedColormap = NULL;
+ }
+ pScreenPriv->dgaColormap = NULL;
+ (*pScreenPriv->funcs->SetMode)(pScreenPriv->pScrn, NULL);
+ (*pScrn->SaveRestoreImage)(index, RestoreImage);
+
+ FreeMarkedVisuals(pScreen);
+ }
+ return Success;
+ }
+
+ if(!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */
+ return BadAlloc;
+
+ if((num > 0) && (num <= pScreenPriv->numModes))
+ pMode = &(pScreenPriv->modes[num - 1]);
+ else
+ return BadValue;
+
+ if(!(device = (DGADevicePtr)xalloc(sizeof(DGADeviceRec))))
+ return BadAlloc;
+
+ if(!pScreenPriv->current && !(*pScrn->SaveRestoreImage)(index, SaveImage)){
+ xfree(device);
+ return BadAlloc;
+ }
+
+ if(!(*pScreenPriv->funcs->SetMode)(pScreenPriv->pScrn, pMode)) {
+ xfree(device);
+ if(!pScreenPriv->current)
+ (*pScrn->SaveRestoreImage)(index, FreeImage);
+ return BadAlloc;
+ }
+
+ if(!pScreenPriv->current && !pScreenPriv->input) {
+ /* if it's multihead we need to warp the cursor off of
+ our screen so it doesn't get trapped */
+ }
+
+ pScrn->vtSema = FALSE;
+
+ if(pScreenPriv->current) {
+ if(pScreenPriv->current->pPix)
+ (*pScreen->DestroyPixmap)(pPix);
+ xfree(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ }
+
+ if(pMode->flags & DGA_PIXMAP_AVAILABLE) {
+ if((pPix = (*pScreen->CreatePixmap)(pScreen, 0, 0, pMode->depth))) {
+ (*pScreen->ModifyPixmapHeader)(pPix,
+ pMode->pixmapWidth, pMode->pixmapHeight,
+ pMode->depth, pMode->bitsPerPixel,
+ pMode->bytesPerScanline,
+ (pointer)(pMode->address));
+ }
+ }
+
+ devRet->mode = device->mode = pMode;
+ devRet->pPix = device->pPix = pPix;
+ pScreenPriv->current = device;
+ pScreenPriv->pixmapMode = FALSE;
+
+ return Success;
+}
+
+
+/*********** exported ones ***************/
+
+
+Bool
+DGAChangePixmapMode(int index, int *x, int *y, int mode)
+{
+ DGAScreenPtr pScreenPriv;
+ DGADevicePtr pDev;
+ DGAModePtr pMode;
+ PixmapPtr pPix;
+
+ if(DGAScreenIndex < 0)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix)
+ return FALSE;
+
+ pDev = pScreenPriv->current;
+ pPix = pDev->pPix;
+ pMode = pDev->mode;
+
+ if(mode) {
+ int shift = 2;
+
+ if(*x > (pMode->pixmapWidth - pMode->viewportWidth))
+ *x = pMode->pixmapWidth - pMode->viewportWidth;
+ if(*y > (pMode->pixmapHeight - pMode->viewportHeight))
+ *y = pMode->pixmapHeight - pMode->viewportHeight;
+
+ switch(xf86Screens[index]->bitsPerPixel) {
+ case 16: shift = 1; break;
+ case 32: shift = 0; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ shift++;
+
+ *x = (*x >> shift) << shift;
+
+ pPix->drawable.x = *x;
+ pPix->drawable.y = *y;
+ pPix->drawable.width = pMode->viewportWidth;
+ pPix->drawable.height = pMode->viewportHeight;
+ } else {
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->drawable.width = pMode->pixmapWidth;
+ pPix->drawable.height = pMode->pixmapHeight;
+ }
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pScreenPriv->pixmapMode = mode;
+
+ return TRUE;
+}
+
+Bool
+DGAAvailable(int index)
+{
+ if(DGAScreenIndex < 0)
+ return FALSE;
+
+ if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
+ return TRUE;
+
+ return FALSE;
+}
+
+Bool
+DGAActive(int index)
+{
+ DGAScreenPtr pScreenPriv;
+
+ if(DGAScreenIndex < 0)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(pScreenPriv && pScreenPriv->current)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+
+/* Called by the event code in case the server is abruptly terminated */
+
+void
+DGAShutdown()
+{
+ DGAScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+ int i;
+
+ if(DGAScreenIndex < 0)
+ return;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv && pScreenPriv->current) {
+ if(pScreenPriv->current->pPix)
+ (*pScreen->DestroyPixmap)(pScreenPriv->current->pPix);
+ xfree(pScreenPriv->current);
+
+ (*pScreenPriv->funcs->SetMode)(pScreenPriv->pScrn, NULL);
+ pScreenPriv->pScrn->vtSema = TRUE;
+ }
+ }
+}
+
+/* Called by the extension to initialize a mode */
+
+int
+DGASetMode(
+ int index,
+ int num,
+ XDGAModePtr mode,
+ PixmapPtr *pPix
+){
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ DGADeviceRec device;
+ int ret;
+
+ /* We rely on the extension to check that DGA is available */
+
+ ret = (*pScrn->SetDGAMode)(index, num, &device);
+ if((ret == Success) && num) {
+ DGACopyModeInfo(device.mode, mode);
+ *pPix = device.pPix;
+ }
+
+ return ret;
+}
+
+/* Called from the extension to let the DDX know which events are requested */
+
+void
+DGASelectInput(
+ int index,
+ ClientPtr client,
+ long mask
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+ pScreenPriv->client = client;
+ pScreenPriv->input = mask;
+}
+
+int
+DGAGetViewportStatus(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ return((*pScreenPriv->funcs->GetViewport)(pScreenPriv->pScrn));
+}
+
+int
+DGASetViewport(
+ int index,
+ int x, int y,
+ int mode
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ (*pScreenPriv->funcs->SetViewport)(pScreenPriv->pScrn, x, y, mode);
+ return Success;
+}
+
+
+static int
+BitsClear(CARD32 data)
+{
+ int bits = 0;
+ CARD32 mask;
+
+ for(mask = 1; mask; mask <<= 1) {
+ if(!(data & mask)) bits++;
+ else break;
+ }
+
+ return bits;
+}
+
+int
+DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ FakedVisualList *fvlp;
+ VisualPtr pVisual;
+ DGAModePtr pMode;
+ ColormapPtr pmap;
+
+ if(!mode || (mode > pScreenPriv->numModes))
+ return BadValue;
+
+ if((alloc != AllocNone) && (alloc != AllocAll))
+ return BadValue;
+
+ pMode = &(pScreenPriv->modes[mode - 1]);
+
+ if(!(pVisual = xalloc(sizeof(VisualRec))))
+ return BadAlloc;
+
+ pVisual->vid = FakeClientID(0);
+ pVisual->class = pMode->visualClass;
+ pVisual->nplanes = pMode->depth;
+ pVisual->ColormapEntries = 1 << pMode->depth;
+ pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3;
+
+ switch (pVisual->class) {
+ case PseudoColor:
+ case GrayScale:
+ case StaticGray:
+ pVisual->bitsPerRGBValue = 8; /* not quite */
+ pVisual->redMask = 0;
+ pVisual->greenMask = 0;
+ pVisual->blueMask = 0;
+ pVisual->offsetRed = 0;
+ pVisual->offsetGreen = 0;
+ pVisual->offsetBlue = 0;
+ break;
+ case DirectColor:
+ case TrueColor:
+ pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue;
+ /* fall through */
+ case StaticColor:
+ pVisual->redMask = pMode->red_mask;
+ pVisual->greenMask = pMode->green_mask;
+ pVisual->blueMask = pMode->blue_mask;
+ pVisual->offsetRed = BitsClear(pVisual->redMask);
+ pVisual->offsetGreen = BitsClear(pVisual->greenMask);
+ pVisual->offsetBlue = BitsClear(pVisual->blueMask);
+ }
+
+ if(!(fvlp = xalloc(sizeof(FakedVisualList)))) {
+ xfree(pVisual);
+ return BadAlloc;
+ }
+
+ fvlp->free = FALSE;
+ fvlp->pVisual = pVisual;
+ fvlp->next = pScreenPriv->fakedVisuals;
+ pScreenPriv->fakedVisuals = fvlp;
+
+ LEGAL_NEW_RESOURCE(id, client);
+
+ return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index);
+}
+
+/* Called by the extension to install a colormap on DGA active screens */
+
+void
+DGAInstallCmap(ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(!pScreenPriv->dgaColormap)
+ pScreenPriv->savedColormap = miInstalledMaps[pScreen->myNum];
+ pScreenPriv->dgaColormap = cmap;
+
+ (*pScreen->InstallColormap)(cmap);
+}
+
+int
+DGASync(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ (*pScreenPriv->funcs->Sync)(pScreenPriv->pScrn);
+
+ return Success;
+}
+
+int
+DGAFillRect(
+ int index,
+ int x, int y, int w, int h,
+ unsigned long color
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->FillRect &&
+ (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) {
+
+ (*pScreenPriv->funcs->FillRect)(pScreenPriv->pScrn, x, y, w, h, color);
+ return Success;
+ }
+ return BadMatch;
+}
+
+int
+DGABlitRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->BlitRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) {
+
+ (*pScreenPriv->funcs->BlitRect)(pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty);
+ return Success;
+ }
+ return BadMatch;
+}
+
+int
+DGABlitTransRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->BlitTransRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) {
+
+ (*pScreenPriv->funcs->BlitTransRect)(pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty, color);
+ return Success;
+ }
+ return BadMatch;
+}
+
+
+int
+DGAGetModes(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ /* We rely on the extension to check that DGA is available */
+
+ return pScreenPriv->numModes;
+}
+
+
+int
+DGAGetModeInfo(
+ int index,
+ XDGAModePtr mode,
+ int num
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ /* We rely on the extension to check that DGA is available */
+
+ if((num <= 0) || (num > pScreenPriv->numModes))
+ return BadValue;
+
+ DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode);
+
+ return Success;
+}
+
+
+static void
+DGACopyModeInfo(
+ DGAModePtr mode,
+ XDGAModePtr xmode
+){
+ DisplayModePtr dmode = mode->mode;
+
+ xmode->num = mode->num;
+ xmode->name = dmode->name;
+ xmode->VSync_num = dmode->Clock * 1000.0;
+ xmode->VSync_den = dmode->HTotal * dmode->VTotal;
+ xmode->flags = mode->flags;
+ xmode->imageWidth = mode->imageWidth;
+ xmode->imageHeight = mode->imageHeight;
+ xmode->pixmapWidth = mode->pixmapWidth;
+ xmode->pixmapHeight = mode->pixmapHeight;
+ xmode->bytesPerScanline = mode->bytesPerScanline;
+ xmode->byteOrder = mode->byteOrder;
+ xmode->depth = mode->depth;
+ xmode->bitsPerPixel = mode->bitsPerPixel;
+ xmode->red_mask = mode->red_mask;
+ xmode->green_mask = mode->green_mask;
+ xmode->blue_mask = mode->blue_mask;
+ xmode->visualClass = mode->visualClass;
+ xmode->viewportWidth = mode->viewportWidth;
+ xmode->viewportHeight = mode->viewportHeight;
+ xmode->xViewportStep = mode->xViewportStep;
+ xmode->yViewportStep = mode->yViewportStep;
+ xmode->maxViewportX = mode->maxViewportX;
+ xmode->maxViewportY = mode->maxViewportY;
+ xmode->viewportFlags = mode->viewportFlags;
+ xmode->reserved1 = mode->reserved1;
+ xmode->reserved2 = mode->reserved2;
+ xmode->offset = mode->offset;
+
+ if(dmode->Flags & V_INTERLACE) xmode->flags |= DGA_INTERLACED;
+ if(dmode->Flags & V_DBLSCAN) xmode->flags |= DGA_DOUBLESCAN;
+}
+
+
+Bool
+DGAVTSwitch(void)
+{
+ ScreenPtr pScreen;
+ int i;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+
+ /* Alternatively, this could send events to DGA clients */
+
+ if(DGAScreenIndex >= 0) {
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv && pScreenPriv->current)
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/* We have the power to steal or modify events that are about to get queued */
+
+extern InputInfo inputInfo;
+
+Bool
+DGAStealKeyEvent(int index, xEvent *e)
+{
+ DGAScreenPtr pScreenPriv;
+ DeviceIntPtr keybd;
+ KeyClassPtr keyc;
+ int key, bit, i;
+ BYTE *kptr;
+ CARD8 modifiers, mask;
+
+ if(DGAScreenIndex < 0) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->current) /* no direct mode */
+ return FALSE;
+
+ keybd = (DeviceIntPtr)xf86Info.pKeyboard;
+ keyc = keybd->key;
+
+ e->u.keyButtonPointer.state = (keyc->state |
+ inputInfo.pointer->button->state);
+
+ key = e->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+ modifiers = keyc->modifierMap[key];
+
+ if(e->u.u.type == KeyPress) {
+ if(!(*kptr & bit)) {
+ *kptr |= bit;
+ keyc->prev_state = keyc->state;
+ keyc->state |= modifiers;
+
+ for(mask = 0x80, i = 0; mask; mask >>= 1, i++) {
+ if(mask & modifiers)
+ keyc->modifierKeyCount[i]++;
+ }
+ }
+ } else { /* KeyRelease */
+ if(!(*kptr & bit))
+ return TRUE;
+ *kptr &= ~bit;
+ keyc->prev_state = keyc->state;
+ for(mask = 0x80, i = 0; mask; mask >>= 1, i++) {
+ if(mask & modifiers) {
+ if(--keyc->modifierKeyCount[i] <= 0) {
+ keyc->state &= ~mask;
+ keyc->modifierKeyCount[i] = 0;
+ }
+ }
+ }
+ }
+
+ if(pScreenPriv->client && !pScreenPriv->client->clientGone) {
+ Bool GrabEvent = FALSE;
+
+ switch(e->u.u.type) {
+ case KeyPress:
+ if(pScreenPriv->input & KeyPressMask)
+ GrabEvent = TRUE;
+ break;
+ case KeyRelease:
+ if(pScreenPriv->input & KeyReleaseMask)
+ GrabEvent = TRUE;
+ break;
+ }
+
+ if(GrabEvent){ /* steal this event */
+ dgaEvent de;
+
+ de.u.u.type = e->u.u.type + *XDGAEventBase;
+ de.u.u.detail = key;
+ de.u.u.sequenceNumber = pScreenPriv->client->sequence;
+ de.u.event.time = e->u.keyButtonPointer.time;
+ de.u.event.screen = index;
+ de.u.event.state = e->u.keyButtonPointer.state;
+
+ TryClientEvents(pScreenPriv->client, (xEvent*)&de, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ }
+ return TRUE;
+ }
+
+
+ /* Not sure how best to handle this stuff. It's only for
+ DGA 1.0 compatibility. Hopefully, we can remove this
+ some day */
+
+ if(((DeviceIntPtr)(xf86Info.pKeyboard))->grab){
+ /* these would be non-sense otherwise */
+ e->u.keyButtonPointer.eventX = 0;
+ e->u.keyButtonPointer.eventY = 0;
+ e->u.keyButtonPointer.rootX = 0;
+ e->u.keyButtonPointer.rootY = 0;
+
+ keybd->public.processInputProc(e, keybd, 1);
+ }
+
+ /* Direct mode but the client doesn't want the events.
+ We have to keep them from hitting the other windows.
+ */
+
+ return TRUE;
+}
+
+
+Bool
+DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
+{
+ DGAScreenPtr pScreenPriv;
+ ButtonClassPtr butc;
+
+ if(DGAScreenIndex < 0) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->current) /* no direct mode */
+ return FALSE;
+
+ /* I hope this part is correct. Motion events are different
+ in the sense that the mipointer code is relied on to fill
+ out the rest of the event info. We steal the event before
+ then so we need to fill that info out here */
+
+ if(dx | dy) {
+ e->u.u.type = MotionNotify;
+ e->u.keyButtonPointer.time = GetTimeInMillis();
+ }
+
+ butc = ((DeviceIntPtr)xf86Info.pMouse)->button;
+
+ e->u.keyButtonPointer.state = butc->state | (
+#ifdef XKB
+ !noXkbExtension ? inputInfo.keyboard->key->xkbInfo->state.grab_mods :
+#endif
+ inputInfo.keyboard->key->state);
+
+ if(e->u.u.type != MotionNotify) {
+ ButtonClassPtr butc = ((DeviceIntPtr)xf86Info.pMouse)->button;
+ int key = e->u.u.detail;
+ BYTE *kptr = &butc->down[key >> 3];
+ int bit = 1 << (key & 7);
+
+ if(e->u.u.type == ButtonPress) {
+ butc->buttonsDown++;
+ butc->motionMask = ButtonMotionMask;
+ *kptr |= bit;
+ if (!e->u.u.detail)
+ return TRUE;
+ if (e->u.u.detail <= 5)
+ butc->state |= (Button1Mask >> 1) << e->u.u.detail;
+ } else { /* ButtonRelease */
+ if (!--butc->buttonsDown)
+ butc->motionMask = 0;
+ *kptr &= ~bit;
+ if (!e->u.u.detail)
+ return TRUE;
+ if (e->u.u.detail <= 5)
+ butc->state &= ~((Button1Mask >> 1) << e->u.u.detail);
+ }
+ }
+
+ if(pScreenPriv->client && !pScreenPriv->client->clientGone) {
+ Bool GrabEvent = FALSE;
+
+ switch(e->u.u.type) {
+ case MotionNotify:
+ if(pScreenPriv->input & PointerMotionMask)
+ GrabEvent = TRUE;
+ break;
+ case ButtonPress:
+ if(pScreenPriv->input & ButtonPressMask)
+ GrabEvent = TRUE;
+ break;
+ case ButtonRelease:
+ if(pScreenPriv->input & ButtonReleaseMask)
+ GrabEvent = TRUE;
+ break;
+ }
+
+ if(GrabEvent){ /* steal this event */
+ dgaEvent de;
+
+ de.u.u.type = e->u.u.type + *XDGAEventBase;
+ de.u.u.detail = e->u.u.detail;
+ de.u.u.sequenceNumber = pScreenPriv->client->sequence;
+ de.u.event.dx = dx;
+ de.u.event.dy = dy;
+ de.u.event.time = e->u.keyButtonPointer.time;
+ de.u.event.screen = index;
+ de.u.event.state = e->u.keyButtonPointer.state;
+
+ TryClientEvents(pScreenPriv->client, (xEvent*)&de, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ }
+ return TRUE;
+ }
+
+
+ /* Not sure how best to handle this stuff. It's only for
+ DGA 1.0 compatibility. Hopefully, we can remove this
+ some day */
+
+ if(((DeviceIntPtr)(xf86Info.pMouse))->grab) {
+ e->u.keyButtonPointer.eventX = dx;
+ e->u.keyButtonPointer.eventY = dy;
+ e->u.keyButtonPointer.rootX = dx;
+ e->u.keyButtonPointer.rootY = dy;
+ DeliverGrabbedEvent(e, (xf86Info.pMouse), FALSE, 1);
+ }
+
+ /* Direct mode but the client doesn't want the events.
+ We have to keep them from hitting the other windows.
+ */
+
+ return TRUE;
+}
+
+
+Bool
+DGAOpenFramebuffer(
+ int index,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *flags
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+
+ return (*pScreenPriv->funcs->OpenFramebuffer)(pScreenPriv->pScrn,
+ name, mem, size, offset, flags);
+}
+
+void
+DGACloseFramebuffer(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+ if(pScreenPriv->funcs->CloseFramebuffer)
+ (*pScreenPriv->funcs->CloseFramebuffer)(pScreenPriv->pScrn);
+}
+
+/* For DGA 1.0 backwards compatibility only */
+
+int
+DGAGetOldDGAMode(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ ScrnInfoPtr pScrn = pScreenPriv->pScrn;
+ DGAModePtr mode;
+ int i, w, h, p;
+
+ /* We rely on the extension to check that DGA is available */
+
+ w = pScrn->currentMode->HDisplay;
+ h = pScrn->currentMode->VDisplay;
+ p = ((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) + 3) & ~3L;
+
+ for(i = 0; i < pScreenPriv->numModes; i++) {
+ mode = &(pScreenPriv->modes[i]);
+
+ if((mode->viewportWidth == w) && (mode->viewportHeight == h) &&
+ (mode->bytesPerScanline == p) &&
+ (mode->bitsPerPixel == pScrn->bitsPerPixel)) {
+
+ return mode->num;
+ }
+ }
+
+ return 0;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c b/xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c
new file mode 100644
index 000000000..3217b48d1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c
@@ -0,0 +1,161 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.4 1999/06/20 05:23:29 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997-1998 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains the DPMS functions required by the extension.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+
+
+#ifdef DPMSExtension
+static int DPMSGeneration = 0;
+static int DPMSIndex = -1;
+static Bool DPMSClose(int i, ScreenPtr pScreen);
+static int DPMSCount = 0;
+#endif
+
+
+Bool
+xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
+{
+#ifdef DPMSExtension
+ DPMSPtr pDPMS;
+ pointer DPMSOpt;
+
+ if (serverGeneration != DPMSGeneration) {
+ if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ DPMSGeneration = serverGeneration;
+ }
+
+ if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1)))
+ return FALSE;
+
+ pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+ pDPMS->Set = set;
+ pDPMS->Flags = flags;
+ DPMSOpt = xf86FindOption(xf86Screens[pScreen->myNum]->options, "dpms");
+ if (DPMSOpt) {
+ pDPMS->Enabled = TRUE;
+ DPMSEnabled = TRUE;
+ xf86MarkOptionUsed(DPMSOpt);
+ xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n");
+ } else {
+ pDPMS->Enabled = FALSE;
+ }
+ pDPMS->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DPMSClose;
+ DPMSCount++;
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+
+#ifdef DPMSExtension
+
+static Bool
+DPMSClose(int i, ScreenPtr pScreen)
+{
+ DPMSPtr pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+
+ /* This shouldn't happen */
+ if (!pDPMS)
+ return FALSE;
+
+ pScreen->CloseScreen = pDPMS->CloseScreen;
+
+ xfree((pointer)pDPMS);
+ pDPMS = NULL;
+ if (--DPMSCount == 0)
+ DPMSIndex = -1;
+ return pScreen->CloseScreen(i, pScreen);
+}
+
+
+/*
+ * DPMSSet --
+ * Device dependent DPMS mode setting hook. This is called whenever
+ * the DPMS mode is to be changed.
+ */
+void
+DPMSSet(CARD16 level)
+{
+ int i;
+ DPMSPtr pDPMS;
+
+ DPMSPowerLevel = level;
+
+ if (DPMSIndex < 0)
+ return;
+
+ /* For each screen, set the DPMS level */
+ for (i = 0; i < xf86NumScreens; i++) {
+ pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ if (pDPMS && pDPMS->Set && pDPMS->Enabled && xf86Screens[i]->vtSema) {
+ xf86EnableAccess(xf86Screens[i]);
+ pDPMS->Set(xf86Screens[i], level, 0);
+ }
+ }
+}
+
+
+/*
+ * DPMSSupported --
+ * Return TRUE if any screen supports DPMS.
+ */
+Bool
+DPMSSupported(void)
+{
+ int i;
+ DPMSPtr pDPMS;
+
+ if (DPMSIndex < 0) {
+ return FALSE;
+ }
+
+ /* For each screen, check if DPMS is supported */
+ for (i = 0; i < xf86NumScreens; i++) {
+ pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ if (pDPMS && pDPMS->Set)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+#if 0
+/*
+ * DPMSGet --
+ * Device dependent DPMS mode getting hook. This returns the current
+ * DPMS mode, or -1 if DPMS is not supported.
+ *
+ * This should hook in to the appropriate driver-level function, which
+ * will be added to the ScrnInfoRec.
+ *
+ * NOTES:
+ * 1. the calling interface should be changed to specify which
+ * screen to check.
+ * 2. It isn't clear that this function is ever used or what it should
+ * return.
+ */
+CARD16
+DPMSGet(CARD16 *level)
+{
+ return DPMSPowerLevel;
+}
+#endif
+
+#endif /* DPMSExtension */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c b/xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c
new file mode 100644
index 000000000..b0e8a84c8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c
@@ -0,0 +1,93 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.2 1999/03/29 12:55:55 dawes Exp $ */
+
+/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
+ * modeline2c.pl */
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ *
+ * Author: Dirk Hohndel <hohndel@XFree86.Org>
+ */
+
+#include "xf86.h"
+#include "xf86Config.h"
+#define NO_COMPILER_H_EXTRAS
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include "globals.h"
+
+#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,0,0
+
+DisplayModeRec xf86DefaultModes [] = {
+/* 640x350 @ 85Hz (VESA) hsync: 37.9kHz */
+ {MODEPREFIX("640x350"),31500, 640,672,736,832,0, 350,382,385,445,0, 0, MODESUFFIX},
+/* 640x400 @ 85Hz (VESA) hsync: 37.9kHz */
+ {MODEPREFIX("640x400"),31500, 640,672,736,832,0, 400,401,404,445,0, 0, MODESUFFIX},
+/* 720x400 @ 85Hz (VESA) hsync: 37.9kHz */
+ {MODEPREFIX("720x400"),35500, 720,756,828,936,0, 400,401,404,446,0, 0, MODESUFFIX},
+/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */
+ {MODEPREFIX("640x480"),25200, 640,656,752,800,0, 480,490,492,525,0, 0, MODESUFFIX},
+/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */
+ {MODEPREFIX("640x480"),31500, 640,664,704,832,0, 480,489,491,520,0, 0, MODESUFFIX},
+/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */
+ {MODEPREFIX("640x480"),31500, 640,656,720,840,0, 480,481,484,500,0, 0, MODESUFFIX},
+/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */
+ {MODEPREFIX("640x480"),36000, 640,696,752,832,0, 480,481,484,509,0, 0, MODESUFFIX},
+/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */
+ {MODEPREFIX("800x600"),36000, 800,824,896,1024,0, 600,601,603,625,0, 0, MODESUFFIX},
+/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */
+ {MODEPREFIX("800x600"),40000, 800,840,968,1056,0, 600,601,605,628,0, 0, MODESUFFIX},
+/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */
+ {MODEPREFIX("800x600"),50000, 800,856,976,1040,0, 600,637,643,666,0, 0, MODESUFFIX},
+/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */
+ {MODEPREFIX("800x600"),49500, 800,816,896,1056,0, 600,601,604,625,0, 0, MODESUFFIX},
+/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */
+ {MODEPREFIX("800x600"),56300, 800,832,896,1048,0, 600,601,604,631,0, 0, MODESUFFIX},
+/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */
+ {MODEPREFIX("1024x768"),44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_INTERLACE, MODESUFFIX},
+/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */
+ {MODEPREFIX("1024x768"),65000, 1024,1048,1184,1344,0, 768,771,777,806,0, 0, MODESUFFIX},
+/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */
+ {MODEPREFIX("1024x768"),75000, 1024,1048,1184,1328,0, 768,771,777,806,0, 0, MODESUFFIX},
+/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */
+ {MODEPREFIX("1024x768"),78800, 1024,1040,1136,1312,0, 768,769,772,800,0, 0, MODESUFFIX},
+/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */
+ {MODEPREFIX("1024x768"),94500, 1024,1072,1168,1376,0, 768,769,772,808,0, 0, MODESUFFIX},
+/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */
+ {MODEPREFIX("1152x864"),108000, 1152,1216,1344,1600,0, 864,865,868,900,0, 0, MODESUFFIX},
+/* 1280x960 @ 60Hz (VESA) hsync: 60.0kHz */
+ {MODEPREFIX("1280x960"),108000, 1280,1376,1488,1800,0, 960,961,964,1000,0, 0, MODESUFFIX},
+/* 1280x960 @ 85Hz (VESA) hsync: 85.9kHz */
+ {MODEPREFIX("1280x960"),148500, 1280,1344,1504,1728,0, 960,961,964,1011,0, 0, MODESUFFIX},
+/* 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz */
+ {MODEPREFIX("1280x1024"),108000, 1280,1328,1440,1688,0, 1024,1025,1028,1066,0, 0, MODESUFFIX},
+/* 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz */
+ {MODEPREFIX("1280x1024"),135000, 1280,1296,1440,1688,0, 1024,1025,1028,1066,0, 0, MODESUFFIX},
+/* 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz */
+ {MODEPREFIX("1280x1024"),157500, 1280,1344,1504,1728,0, 1024,1025,1028,1072,0, 0, MODESUFFIX},
+/* 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz */
+ {MODEPREFIX("1600x1200"),162000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, 0, MODESUFFIX},
+/* 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz */
+ {MODEPREFIX("1600x1200"),175500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, 0, MODESUFFIX},
+/* 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz */
+ {MODEPREFIX("1600x1200"),189000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, 0, MODESUFFIX},
+/* 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz */
+ {MODEPREFIX("1600x1200"),202500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, 0, MODESUFFIX},
+/* 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz */
+ {MODEPREFIX("1600x1200"),229500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, 0, MODESUFFIX},
+/* 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz */
+ {MODEPREFIX("1792x1344"),204800, 1792,1920,2120,2448,0, 1344,1345,1348,1394,0, 0, MODESUFFIX},
+/* 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz */
+ {MODEPREFIX("1792x1344"),261000, 1792,1888,2104,2456,0, 1344,1345,1348,1417,0, 0, MODESUFFIX},
+/* 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz */
+ {MODEPREFIX("1856x1392"),218300, 1856,1952,2176,2528,0, 1392,1393,1396,1439,0, 0, MODESUFFIX},
+/* 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz */
+ {MODEPREFIX("1856x1392"),288000, 1856,1984,2208,2560,0, 1392,1393,1396,1500,0, 0, MODESUFFIX},
+/* 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz */
+ {MODEPREFIX("1920x1444"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, 0, MODESUFFIX},
+/* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */
+ {MODEPREFIX("1920x1444"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, 0, MODESUFFIX},
+ {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,MODESUFFIX}
+};
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c b/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c
new file mode 100644
index 000000000..f42cba25b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c
@@ -0,0 +1,111 @@
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.6 1999/06/20 05:23:29 dawes Exp $ */
+/*
+ * finish setting up the server
+ * call the functions from the scanpci module
+ *
+ * Copyright 1999 by The XFree86 Project, Inc.
+ *
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "X.h"
+#include "Xmd.h"
+#include "os.h"
+#ifdef XFree86LOADER
+#include "loaderProcs.h"
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Pci.h"
+#define DECLARE_CARD_DATASTRUCTURES TRUE
+#include "xf86PciInfo.h"
+
+static void (*xf86ScanPciFunc)(int);
+
+void xf86DisplayPCICardInfo(int);
+
+void DoScanPci(int argc, char **argv, int i)
+{
+ int j,skip,globalVerbose,scanpciVerbose;
+#ifdef XFree86LOADER
+ int errmaj, errmin;
+ char *name;
+#endif
+
+ /*
+ * first we need to finish setup of the OS so that we can call other
+ * functions in the server
+ */
+ OsInit();
+
+ /*
+ * now we decrease verbosity and remember the value, in case a later
+ * -verbose on the command line increases it, because that is a
+ * verbose flag for scanpci...
+ */
+ globalVerbose = --xf86Verbose;
+ /*
+ * next we process the arguments that are remaining on the command line,
+ * so that things like the module path can be set there
+ */
+ for ( j = i+1; j < argc; j++ ) {
+ if ((skip = ddxProcessArgument(argc, argv, j)))
+ j += (skip - 1);
+ }
+ /*
+ * was the verbosity level increased?
+ */
+ if( (globalVerbose == 0) && (xf86Verbose > 0) )
+ scanpciVerbose = xf86Verbose - globalVerbose -1;
+ else
+ scanpciVerbose = xf86Verbose - globalVerbose;
+ xf86Verbose = globalVerbose;
+ /*
+ * now get the loader set up and load the scanpci module
+ */
+#ifdef XFree86LOADER
+ /* Initialise the loader */
+ LoaderInit();
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
+
+
+ /* Normalise the module name */
+ name = xf86NormalizeName("scanpci");
+
+ if (!LoadModule(name, NULL, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin)) {
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ exit(1);
+ }
+ if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) {
+ /* For now, just a warning */
+ xf86Msg(X_WARNING, "Some symbols could not be resolved!\n");
+ }
+ xf86ScanPciFunc = (void (*)(int))LoaderSymbol("xf86DisplayPCICardInfo");
+ /*
+ * we need to get the pointer to the pci data structures initialized
+ */
+ xf86PCIVendorInfo =
+ (pciVendorDeviceInfo*)LoaderSymbol("xf86PCIVendorInfoData");
+ xf86PCIVendorNameInfo =
+ (SymTabPtr)LoaderSymbol("xf86PCIVendorNameInfoData");
+ xf86PCICardInfo =
+ (pciVendorCardInfo*)LoaderSymbol("xf86PCICardInfoData");
+#else
+ xf86ScanPciFunc = xf86DisplayPCICardInfo;
+ xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData;
+ xf86PCIVendorInfo = xf86PCIVendorInfoData;
+ xf86PCICardInfo = xf86PCICardInfoData;
+#endif
+
+ (*xf86ScanPciFunc)(scanpciVerbose);
+
+ /*
+ * that's it; we really should clean things up, but a simple
+ * exit seems to be all we need
+ */
+ exit(0);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
new file mode 100644
index 000000000..baecd9b5d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c
@@ -0,0 +1,1584 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.75 1999/06/27 09:20:16 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86Events.c /main/46 1996/10/25 11:36:30 kaleb $ */
+
+/* [JCH-96/01/21] Extended std reverse map to four buttons. */
+
+#include "X.h"
+#include "Xproto.h"
+#include "misc.h"
+
+#include "compiler.h"
+
+#include "Xpoll.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#include "xf86Xinput.h"
+#else
+#include "inputstr.h"
+#endif
+
+#include "mipointer.h"
+
+#ifdef XKB
+extern Bool noXkbExtension;
+#endif
+
+#define XE_POINTER 1
+#define XE_KEYBOARD 2
+
+#ifdef XTESTEXT1
+
+#define XTestSERVER_SIDE
+#include "xtestext1.h"
+extern short xtest_mousex;
+extern short xtest_mousey;
+extern int on_steal_input;
+extern Bool XTestStealKeyData();
+extern void XTestStealMotionData();
+
+#ifdef XINPUT
+#define ENQUEUE(ev, code, direction, dev_type) \
+ (ev)->u.u.detail = (code); \
+ (ev)->u.u.type = (direction); \
+ if (!on_steal_input || \
+ XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \
+ xtest_mousex, xtest_mousey)) \
+ xf86eqEnqueue((ev))
+#else
+#define ENQUEUE(ev, code, direction, dev_type) \
+ (ev)->u.u.detail = (code); \
+ (ev)->u.u.type = (direction); \
+ if (!on_steal_input || \
+ XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \
+ xtest_mousex, xtest_mousey)) \
+ mieqEnqueue((ev))
+#endif
+
+#define MOVEPOINTER(dx, dy, time) \
+ if (on_steal_input) \
+ XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \
+ miPointerDeltaCursor (dx, dy, time)
+
+#else /* ! XTESTEXT1 */
+
+#ifdef XINPUT
+#define ENQUEUE(ev, code, direction, dev_type) \
+ (ev)->u.u.detail = (code); \
+ (ev)->u.u.type = (direction); \
+ xf86eqEnqueue((ev))
+#else
+#define ENQUEUE(ev, code, direction, dev_type) \
+ (ev)->u.u.detail = (code); \
+ (ev)->u.u.type = (direction); \
+ mieqEnqueue((ev))
+#endif
+#define MOVEPOINTER(dx, dy, time) \
+ miPointerDeltaCursor (dx, dy, time)
+
+#endif
+
+/*
+ * The first of many hack's to get VT switching to work under
+ * Solaris 2.1 for x86. The basic problem is that Solaris is supposed
+ * to be SVR4. It is for the most part, except where the video interface
+ * is concerned. These hacks work around those problems.
+ * See the comments for Linux, and SCO.
+ *
+ * This is a toggleling variable:
+ * FALSE = No VT switching keys have been pressed last time around
+ * TRUE = Possible VT switch Pending
+ * (DWH - 12/2/93)
+ *
+ * This has been generalised to work with Linux and *BSD+syscons (DHD)
+ */
+
+#ifdef USE_VT_SYSREQ
+static Bool VTSysreqToggle = FALSE;
+#endif /* !USE_VT_SYSREQ */
+static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD */
+
+extern fd_set EnabledDevices;
+
+#if defined(XQUEUE)
+extern void xf86XqueRequest(void);
+#endif
+
+static void xf86VTSwitch(void);
+
+/*
+ * Allow arbitrary drivers or other XFree86 code to register with our main
+ * Wakeup handler.
+ */
+typedef struct x_IHRec {
+ int fd;
+ InputHandlerProc ihproc;
+ pointer data;
+ Bool enabled;
+ struct x_IHRec * next;
+} IHRec, *IHPtr;
+
+static IHPtr InputHandlers = NULL;
+
+#ifndef NEW_INPUT
+static CARD32 buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg);
+
+/*
+ * Lets create a simple finite-state machine:
+ *
+ * state[?][0]: action1
+ * state[?][1]: action2
+ * state[?][2]: next state
+ *
+ * action > 0: ButtonPress
+ * action = 0: nothing
+ * action < 0: ButtonRelease
+ *
+ * Why this stuff ??? Normally you cannot press both mousebuttons together, so
+ * the mouse reports both pressed at the same time ...
+ */
+
+static signed char stateTab[48][3] = {
+
+/* nothing pressed */
+ { 0, 0, 0 },
+ { 0, 0, 8 }, /* 1 right -> delayed right */
+ { 0, 0, 0 }, /* 2 nothing */
+ { 0, 0, 8 }, /* 3 right -> delayed right */
+ { 0, 0, 16 }, /* 4 left -> delayed left */
+ { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */
+ { 0, 0, 16 }, /* 6 left -> delayed left */
+ { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */
+
+/* delayed right */
+ { 1, -1, 0 }, /* 8 nothing (right event) -> init */
+ { 1, 0, 32 }, /* 9 right (right press) -> right pressed */
+ { 1, -1, 0 }, /* 10 nothing (right event) -> init */
+ { 1, 0, 32 }, /* 11 right (right press) -> right pressed */
+ { 1, -1, 16 }, /* 12 left (right event) -> delayed left */
+ { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */
+ { 1, -1, 16 }, /* 14 left (right event) -> delayed left */
+ { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */
+
+/* delayed left */
+ { 3, -3, 0 }, /* 16 nothing (left event) -> init */
+ { 3, -3, 8 }, /* 17 right (left event) -> delayed right */
+ { 3, -3, 0 }, /* 18 nothing (left event) -> init */
+ { 3, -3, 8 }, /* 19 right (left event) -> delayed right */
+ { 3, 0, 40 }, /* 20 left (left press) -> pressed left */
+ { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */
+ { 3, 0, 40 }, /* 22 left (left press) -> pressed left */
+ { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */
+
+/* pressed middle */
+ { -2, 0, 0 }, /* 24 nothing (middle release) -> init */
+ { -2, 0, 0 }, /* 25 right (middle release) -> init */
+ { -2, 0, 0 }, /* 26 nothing (middle release) -> init */
+ { -2, 0, 0 }, /* 27 right (middle release) -> init */
+ { -2, 0, 0 }, /* 28 left (middle release) -> init */
+ { 0, 0, 24 }, /* 29 left & right -> pressed middle */
+ { -2, 0, 0 }, /* 30 left (middle release) -> init */
+ { 0, 0, 24 }, /* 31 left & right -> pressed middle */
+
+/* pressed right */
+ { -1, 0, 0 }, /* 32 nothing (right release) -> init */
+ { 0, 0, 32 }, /* 33 right -> pressed right */
+ { -1, 0, 0 }, /* 34 nothing (right release) -> init */
+ { 0, 0, 32 }, /* 35 right -> pressed right */
+ { -1, 0, 16 }, /* 36 left (right release) -> delayed left */
+ { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */
+ { -1, 0, 16 }, /* 38 left (right release) -> delayed left */
+ { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */
+
+/* pressed left */
+ { -3, 0, 0 }, /* 40 nothing (left release) -> init */
+ { -3, 0, 8 }, /* 41 right (left release) -> delayed right */
+ { -3, 0, 0 }, /* 42 nothing (left release) -> init */
+ { -3, 0, 8 }, /* 43 right (left release) -> delayed right */
+ { 0, 0, 40 }, /* 44 left -> left pressed */
+ { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */
+ { 0, 0, 40 }, /* 46 left -> left pressed */
+ { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */
+};
+
+
+/*
+ * Table to allow quick reversal of natural button mapping to correct mapping
+ */
+
+/*
+ * [JCH-96/01/21] The ALPS GlidePoint pad extends the MS protocol
+ * with a fourth button activated by tapping the PAD.
+ * The 2nd line corresponds to 4th button on; the drv sends
+ * the buttons in the following map (MSBit described first) :
+ * 0 | 4th | 1st | 2nd | 3rd
+ * And we remap them (MSBit described first) :
+ * 0 | 4th | 3rd | 2nd | 1st
+ */
+static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7,
+ 8, 12, 10, 14, 9, 13, 11, 15,
+ 16, 20, 18, 22, 17, 21, 19, 23,
+ 24, 28, 26, 30, 25, 29, 27, 31};
+
+
+static char hitachMap[16] = { 0, 2, 1, 3,
+ 8, 10, 9, 11,
+ 4, 6, 5, 7,
+ 12, 14, 13, 15 };
+
+#define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f])
+#endif
+
+/*
+ * TimeSinceLastInputEvent --
+ * Function used for screensaver purposes by the os module. Retruns the
+ * time in milliseconds since there last was any input.
+ */
+
+int
+TimeSinceLastInputEvent()
+{
+ if (xf86Info.lastEventTime == 0) {
+ xf86Info.lastEventTime = GetTimeInMillis();
+ }
+ return GetTimeInMillis() - xf86Info.lastEventTime;
+}
+
+
+
+/*
+ * SetTimeSinceLastInputEvent --
+ * Set the lastEventTime to now.
+ */
+
+void
+SetTimeSinceLastInputEvent()
+{
+ xf86Info.lastEventTime = GetTimeInMillis();
+}
+
+
+
+/*
+ * ProcessInputEvents --
+ * Retrieve all waiting input events and pass them to DIX in their
+ * correct chronological order. Only reads from the system pointer
+ * and keyboard.
+ */
+
+void
+ProcessInputEvents ()
+{
+ int x, y;
+#ifdef INHERIT_LOCK_STATE
+ static int generation = 0;
+#endif
+
+#ifdef AMOEBA
+#define MAXEVENTS 32
+#define BUTTON_PRESS 0x1000
+#define MAP_BUTTON(ev,but) (((ev) == EV_ButtonPress) ? \
+ ((but) | BUTTON_PRESS) : ((but) & ~BUTTON_PRESS))
+#define KEY_RELEASE 0x80
+#define MAP_KEY(ev, key) (((ev) == EV_KeyReleaseEvent) ? \
+ ((key) | KEY_RELEASE) : ((key) & ~KEY_RELEASE))
+
+ register IOPEvent *e, *elast;
+ IOPEvent events[MAXEVENTS];
+ int dx, dy, nevents;
+#endif
+
+ /*
+ * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock
+ * and ScrollLock will be set to match that of the VT the server is
+ * running on.
+ */
+#ifdef INHERIT_LOCK_STATE
+ if (generation != serverGeneration) {
+ xEvent kevent;
+ DevicePtr pKeyboard = xf86Info.pKeyboard;
+ extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll;
+
+ generation = serverGeneration;
+ kevent.u.keyButtonPointer.time = GetTimeInMillis();
+ kevent.u.keyButtonPointer.rootX = 0;
+ kevent.u.keyButtonPointer.rootY = 0;
+ kevent.u.u.type = KeyPress;
+
+
+ if (xf86InitialCaps) {
+ kevent.u.u.detail = xf86InitialCaps;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialCaps = 0;
+ }
+ if (xf86InitialNum) {
+ kevent.u.u.detail = xf86InitialNum;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialNum = 0;
+ }
+ if (xf86InitialScroll) {
+ kevent.u.u.detail = xf86InitialScroll;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialScroll = 0;
+ }
+ }
+#endif
+
+#ifdef AMOEBA
+ /*
+ * Get all events from the IOP server
+ */
+ while ((nevents = AmoebaGetEvents(events, MAXEVENTS)) > 0) {
+ for (e = &events[0], elast = &events[nevents]; e < elast; e++) {
+ xf86Info.lastEventTime = e->time;
+ switch (e->type) {
+ case EV_PointerDelta:
+ if (e->x != 0 || e->y != 0) {
+ xf86PostMseEvent(&xf86Info.pMouse, 0, e->x, e->y);
+ }
+ break;
+ case EV_ButtonPress:
+ case EV_ButtonRelease:
+ xf86PostMseEvent(&xf86Info.pMouse, MAP_BUTTON(e->type, e->keyorbut), 0, 0);
+ break;
+ case EV_KeyPressEvent:
+ case EV_KeyReleaseEvent:
+ xf86PostKbdEvent(MAP_KEY(e->type, e->keyorbut));
+ break;
+ default:
+ /* this shouldn't happen */
+ ErrorF("stray event %d (%d,%d) %x\n",
+ e->type, e->x, e->y, e->keyorbut);
+ break;
+ }
+ }
+ }
+#endif
+
+ xf86Info.inputPending = FALSE;
+
+#ifdef XINPUT
+ xf86eqProcessInputEvents();
+#else
+ mieqProcessInputEvents();
+#endif
+ miPointerUpdate();
+
+ miPointerPosition(&x, &y);
+ xf86SetViewport(xf86Info.currentScreen, x, y);
+}
+
+
+
+/*
+ * xf86PostKbdEvent --
+ * Translate the raw hardware KbdEvent into an XEvent, and tell DIX
+ * about it. Scancode preprocessing and so on is done ...
+ *
+ * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c
+ * as some things differ, and I did not want to scatter this routine with
+ * ifdefs further (hv).
+ */
+
+#ifdef ASSUME_CUSTOM_KEYCODES
+extern u_char SpecialServerMap[];
+#endif /* ASSUME_CUSTOM_KEYCODES */
+
+#if !defined(__EMX__)
+void
+xf86PostKbdEvent(unsigned key)
+{
+ int scanCode = (key & 0x7f);
+ int specialkey;
+ Bool down = (key & 0x80 ? FALSE : TRUE);
+ KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
+ Bool updateLeds = FALSE;
+ Bool UsePrefix = FALSE;
+ Bool Direction = FALSE;
+ xEvent kevent;
+ KeySym *keysym;
+ int keycode;
+ static int lockkeys = 0;
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ static Bool first_time = TRUE;
+#endif
+#if defined(__sparc__)
+ static int kbdSun = -1;
+#endif
+
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ if (first_time)
+ {
+ first_time = FALSE;
+ VTSwitchEnabled = (xf86Info.consType == SYSCONS)
+ || (xf86Info.consType == PCVT);
+ }
+#endif
+
+#if defined (__sparc__)
+ if (kbdSun == -1) {
+ if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
+ kbdSun = 1;
+ else
+ kbdSun = 0;
+ }
+ if (kbdSun)
+ goto special;
+#endif /* __sparc__ */
+
+#if defined (i386) && defined (SVR4) && !defined (PC98)
+ /*
+ * PANIX returns DICOP standards based keycodes in using 106jp
+ * keyboard. We need to remap some keys.
+ */
+#define KEY_P_UP 0x5A
+#define KEY_P_PGUP 0x5B
+#define KEY_P_LEFT 0x5C
+#define KEY_P_BKSL 0x73
+#define KEY_P_YEN 0x7D
+#define KEY_P_NFER 0x7B
+#define KEY_P_XFER 0x79
+
+ if(xf86Info.panix106 == TRUE){
+ switch (scanCode) {
+ /* case 0x78: scanCode = KEY_P_UP; break; not needed*/
+ case 0x56: scanCode = KEY_P_BKSL; break; /* Backslash */
+ case 0x5A: scanCode = KEY_P_NFER; break; /* No Kanji Transfer*/
+ case 0x5B: scanCode = KEY_P_XFER; break; /* Kanji Tranfer */
+ case 0x5C: scanCode = KEY_P_YEN; break; /* Yen curs pgup */
+ case 0x6B: scanCode = KEY_P_LEFT; break; /* Cur Left */
+ case 0x6F: scanCode = KEY_P_PGUP; break; /* Cur PageUp */
+ case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
+ case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
+ }
+ }
+#endif /* i386 && SVR4 */
+
+#ifndef ASSUME_CUSTOM_KEYCODES
+ /*
+ * First do some special scancode remapping ...
+ */
+ if (xf86Info.scanPrefix == 0) {
+
+ switch (scanCode) {
+
+#ifndef PC98
+ case KEY_Prefix0:
+ case KEY_Prefix1:
+#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
+ || xf86Info.consType == PCVT) {
+#endif
+ xf86Info.scanPrefix = scanCode; /* special prefixes */
+ return;
+#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ }
+ break;
+#endif
+#endif /* not PC98 */
+ }
+ }
+
+#ifndef PC98
+ else if (
+#ifdef CSRG_BASED
+ (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
+ || xf86Info.consType == PCVT) &&
+#endif
+ (xf86Info.scanPrefix == KEY_Prefix0)) {
+ xf86Info.scanPrefix = 0;
+
+ switch (scanCode) {
+ case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */
+ case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */
+ case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */
+ case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */
+ case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */
+ case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */
+ case KEY_KP_1: scanCode = KEY_End; break; /* curs end */
+ case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */
+ case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */
+ case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */
+ case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */
+ case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */
+ case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */
+ case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */
+ case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */
+ case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */
+ case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */
+ case 0x5b: scanCode = KEY_LMeta; break;
+ case 0x5c: scanCode = KEY_RMeta; break;
+ case 0x5d: scanCode = KEY_Menu; break;
+ case KEY_F3: scanCode = KEY_F13; break;
+ case KEY_F4: scanCode = KEY_F14; break;
+ case KEY_F5: scanCode = KEY_F15; break;
+ case KEY_F6: scanCode = KEY_F16; break;
+ case KEY_F7: scanCode = KEY_F17; break;
+ case KEY_KP_Plus: scanCode = KEY_KP_DEC; break;
+ /*
+ * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
+ */
+ default:
+ return; /* skip illegal */
+ }
+ }
+
+ else if (xf86Info.scanPrefix == KEY_Prefix1)
+ {
+ xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
+ return;
+ }
+
+ else if (xf86Info.scanPrefix == KEY_LCtrl)
+ {
+ xf86Info.scanPrefix = 0;
+ if (scanCode != KEY_NumLock) return;
+ scanCode = KEY_Pause; /* pause */
+ }
+#endif /* not PC98 */
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+
+ /*
+ * and now get some special keysequences
+ */
+
+#ifdef ASSUME_CUSTOM_KEYCODES
+ specialkey = SpecialServerMap[scanCode];
+#else /* ASSUME_CUSTOM_KEYCODES */
+ specialkey = scanCode;
+#endif /* ASSUME_CUSTOM_KEYCODES */
+
+#if defined (__sparc__)
+special:
+ if (kbdSun) {
+ switch (scanCode) {
+ case 0x2b: specialkey = KEY_BackSpace; break;
+ case 0x47: specialkey = KEY_KP_Minus; break;
+ case 0x7d: specialkey = KEY_KP_Plus; break;
+ case 0x05: specialkey = KEY_F1; break;
+ case 0x06: specialkey = KEY_F2; break;
+ case 0x08: specialkey = KEY_F3; break;
+ case 0x0a: specialkey = KEY_F4; break;
+ case 0x0c: specialkey = KEY_F5; break;
+ case 0x0e: specialkey = KEY_F6; break;
+ case 0x10: specialkey = KEY_F7; break;
+ case 0x11: specialkey = KEY_F8; break;
+ case 0x12: specialkey = KEY_F9; break;
+ case 0x07: specialkey = KEY_F10; break;
+ case 0x09: specialkey = KEY_F11; break;
+ case 0x0b: specialkey = KEY_F12; break;
+ default: specialkey = 0; break;
+ }
+ /*
+ * XXX XXX XXX:
+ *
+ * I really don't know what's wrong here, but passing the real
+ * scanCode offsets by one from XKB's point of view.
+ *
+ * (ecd@skynet.be, 980405)
+ */
+ scanCode--;
+ }
+#endif /* defined (__sparc__) */
+
+ if ((ModifierDown(ControlMask | AltMask)) ||
+ (ModifierDown(ControlMask | AltLangMask)))
+ {
+
+ switch (specialkey) {
+
+ case KEY_BackSpace:
+ if (!xf86Info.dontZap) {
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+ GiveUp(0);
+ }
+ break;
+
+ /*
+ * The idea here is to pass the scancode down to a list of
+ * registered routines. There should be some standard conventions
+ * for processing certain keys.
+ */
+ case KEY_KP_Minus: /* Keypad - */
+ if (!xf86Info.dontZoom) {
+ if (down) xf86ZoomViewport(xf86Info.currentScreen, -1);
+ return;
+ }
+ break;
+
+ case KEY_KP_Plus: /* Keypad + */
+ if (!xf86Info.dontZoom) {
+ if (down) xf86ZoomViewport(xf86Info.currentScreen, 1);
+ return;
+ }
+ break;
+
+#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) || defined(SCO)
+ /*
+ * Under Linux, the raw keycodes are consumed before the kernel
+ * does any processing on them, so we must emulate the vt switching
+ * we want ourselves.
+ */
+ case KEY_F1:
+ case KEY_F2:
+ case KEY_F3:
+ case KEY_F4:
+ case KEY_F5:
+ case KEY_F6:
+ case KEY_F7:
+ case KEY_F8:
+ case KEY_F9:
+ case KEY_F10:
+ if (VTSwitchEnabled && !xf86Info.vtSysreq
+#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)))
+ && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
+#endif
+ )
+ {
+ if (down)
+#ifdef SCO325
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1);
+#else
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F1 + 1);
+#endif
+ return;
+ }
+ break;
+ case KEY_F11:
+ case KEY_F12:
+ if (VTSwitchEnabled && !xf86Info.vtSysreq
+#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)))
+ && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
+#endif
+ )
+ {
+ if (down)
+#ifdef SCO325
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 10);
+#else
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey - KEY_F11 + 11);
+#endif
+ return;
+ }
+ break;
+#endif /* linux || BSD with VTs */
+
+ /* just worth mentioning here: any 386bsd keyboard driver
+ * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC
+ * before any application (e.g. XF86) will see it
+ * OBS: syscons does not, nor does pcvt !
+ */
+ }
+ }
+
+ /*
+ * Start of actual Solaris VT switching code.
+ * This should pretty much emulate standard SVR4 switching keys.
+ *
+ * DWH 12/2/93
+ */
+
+#ifdef USE_VT_SYSREQ
+ if (VTSwitchEnabled && xf86Info.vtSysreq)
+ {
+ switch (specialkey)
+ {
+ /*
+ * syscons on *BSD doesn't have a VT #0 -- don't think Linux does
+ * either
+ */
+#if defined (sun) && defined (i386) && defined (SVR4)
+ case KEY_H:
+ if (VTSysreqToggle && down)
+ {
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0);
+ VTSysreqToggle = 0;
+ return;
+ }
+ break;
+
+ /*
+ * Yah, I know the N, and P keys seem backwards, however that's
+ * how they work under Solaris
+ * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1)
+ */
+
+ case KEY_N:
+ if (VTSysreqToggle && down)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1 ) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ VTSysreqToggle = FALSE;
+ return;
+ }
+ break;
+
+ case KEY_P:
+ if (VTSysreqToggle && down)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1 ) < 0)
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ VTSysreqToggle = FALSE;
+ return;
+ }
+ break;
+#endif
+
+ case KEY_F1:
+ case KEY_F2:
+ case KEY_F3:
+ case KEY_F4:
+ case KEY_F5:
+ case KEY_F6:
+ case KEY_F7:
+ case KEY_F8:
+ case KEY_F9:
+ case KEY_F10:
+ if (VTSysreqToggle && down)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F1 + 1) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ VTSysreqToggle = FALSE;
+ return;
+ }
+ break;
+
+ case KEY_F11:
+ case KEY_F12:
+ if (VTSysreqToggle && down)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, specialkey-KEY_F11 + 11) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ VTSysreqToggle = FALSE;
+ return;
+ }
+ break;
+
+ /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
+ case KEY_Alt:
+#ifndef PC98
+ case KEY_AltLang:
+#endif /* not PC98 */
+ break;
+
+#ifndef PC98
+ case KEY_SysReqest:
+ if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
+ VTSysreqToggle = TRUE;
+ break;
+#endif /* not PC98 */
+
+ default:
+ if (VTSysreqToggle)
+ {
+ /*
+ * We only land here when Alt-SysReq is followed by a
+ * non-switching key.
+ */
+ VTSysreqToggle = FALSE;
+
+ }
+ }
+ }
+
+#endif /* USE_VT_SYSREQ */
+
+#ifdef SCO
+ /*
+ * With the console in raw mode, SCO will not switch consoles,
+ * you get around this by activating the next console along, if
+ * this fails then go back to console 0, if there is only one
+ * then it doesn't matter, switching to yourself is a nop as far
+ * as the console driver is concerned.
+ * We could do something similar to linux here but SCO ODT uses
+ * Ctrl-PrintScrn, so why change?
+ */
+ if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
+ if (down)
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ return;
+ }
+#endif /* SCO */
+
+ /*
+ * Now map the scancodes to real X-keycodes ...
+ */
+ keycode = scanCode + MIN_KEYCODE;
+ keysym = (keyc->curKeySyms.map +
+ keyc->curKeySyms.mapWidth *
+ (keycode - keyc->curKeySyms.minKeyCode));
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ /*
+ * Filter autorepeated caps/num/scroll lock keycodes.
+ */
+#define CAPSFLAG 0x01
+#define NUMFLAG 0x02
+#define SCROLLFLAG 0x04
+#define MODEFLAG 0x08
+ if( down ) {
+ switch( keysym[0] ) {
+ case XK_Caps_Lock :
+ if (lockkeys & CAPSFLAG)
+ return;
+ else
+ lockkeys |= CAPSFLAG;
+ break;
+
+ case XK_Num_Lock :
+ if (lockkeys & NUMFLAG)
+ return;
+ else
+ lockkeys |= NUMFLAG;
+ break;
+
+ case XK_Scroll_Lock :
+ if (lockkeys & SCROLLFLAG)
+ return;
+ else
+ lockkeys |= SCROLLFLAG;
+ break;
+ }
+ if (keysym[1] == XF86XK_ModeLock)
+ {
+ if (lockkeys & MODEFLAG)
+ return;
+ else
+ lockkeys |= MODEFLAG;
+ }
+
+ }
+ else {
+ switch( keysym[0] ) {
+ case XK_Caps_Lock :
+ lockkeys &= ~CAPSFLAG;
+ break;
+
+ case XK_Num_Lock :
+ lockkeys &= ~NUMFLAG;
+ break;
+
+ case XK_Scroll_Lock :
+ lockkeys &= ~SCROLLFLAG;
+ break;
+ }
+ if (keysym[1] == XF86XK_ModeLock)
+ lockkeys &= ~MODEFLAG;
+ }
+
+ /*
+ * LockKey special handling:
+ * ignore releases, toggle on & off on presses.
+ * Don't deal with the Caps_Lock keysym directly, but check the lock modifier
+ */
+#ifndef PC98
+ if (keyc->modifierMap[keycode] & LockMask ||
+ keysym[0] == XK_Scroll_Lock ||
+ keysym[1] == XF86XK_ModeLock ||
+ keysym[0] == XK_Num_Lock)
+ {
+ Bool flag;
+
+ if (!down) return;
+ if (KeyPressed(keycode)) {
+ down = !down;
+ flag = FALSE;
+ }
+ else
+ flag = TRUE;
+
+ if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag;
+ if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag;
+ if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag;
+ if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
+ updateLeds = TRUE;
+ }
+#endif /* not PC98 */
+
+#ifndef ASSUME_CUSTOM_KEYCODES
+ /*
+ * normal, non-keypad keys
+ */
+ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
+#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__)
+ /*
+ * magic ALT_L key on AT84 keyboards for multilingual support
+ */
+ if (xf86Info.kbdType == KB_84 &&
+ ModifierDown(AltMask) &&
+ keysym[2] != NoSymbol)
+ {
+ UsePrefix = TRUE;
+ Direction = TRUE;
+ }
+#endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */
+ }
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+ if (updateLeds) xf86KbdLeds();
+#ifdef XKB
+ }
+#endif
+
+ /*
+ * check for an autorepeat-event
+ */
+ if ((down && KeyPressed(keycode)) &&
+ (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode]))
+ return;
+
+ xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
+ /*
+ * And now send these prefixes ...
+ * NOTE: There cannot be multiple Mode_Switch keys !!!!
+ */
+ if (UsePrefix)
+ {
+ ENQUEUE(&kevent,
+ keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
+ (Direction ? KeyPress : KeyRelease),
+ XE_KEYBOARD);
+ ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
+ ENQUEUE(&kevent,
+ keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
+ (Direction ? KeyRelease : KeyPress),
+ XE_KEYBOARD);
+ }
+ else
+ {
+ ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
+ }
+}
+#endif /* !__EMX__ */
+
+
+#ifndef NEW_INPUT
+static CARD32
+buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+#ifndef NEW_INPUT
+ MouseDevPtr priv = MOUSE_DEV((DeviceIntPtr) arg);
+
+ xf86PostMseEvent(((DeviceIntPtr) arg), priv->truebuttons, 0, 0);
+#endif
+ return(0);
+}
+#endif
+
+
+/*
+ * xf86PostMseEvent --
+ * Translate the raw hardware MseEvent into an XEvent(s), and tell DIX
+ * about it. Perform a 3Button emulation if required.
+ */
+
+#ifndef NEW_INPUT
+void
+xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy)
+{
+ static OsTimerPtr timer = NULL;
+ MouseDevPtr private = MOUSE_DEV(device);
+ int id, change;
+ int truebuttons;
+ xEvent mevent[2];
+
+#ifdef AMOEBA
+ int pressed;
+
+ pressed = ((buttons & BUTTON_PRESS) != 0);
+ buttons &= ~BUTTON_PRESS;
+#endif
+
+ xf86Info.lastEventTime = mevent->u.keyButtonPointer.time = GetTimeInMillis();
+
+ truebuttons = buttons;
+ if (private->mseType == PROT_MMHIT)
+ buttons = reverseBits(hitachMap, buttons);
+ else
+ buttons = reverseBits(reverseMap, buttons);
+
+ if (dx || dy) {
+ /*
+ * The accelaration stuff is now done in xf86Xinput.c when XInput
+ * support is enabled.
+ */
+#ifndef XINPUT
+
+ /*
+ * accelerate the baby now if sqrt(dx*dx + dy*dy) > threshold !
+ * but do some simpler arithmetic here...
+ */
+ if ((abs(dx) + abs(dy)) >= private->threshold) {
+ dx = (dx * private->num) / private->den;
+ dy = (dy * private->num)/ private->den;
+ }
+
+ MOVEPOINTER(dx, dy, mevent->u.keyButtonPointer.time);
+#else
+ xf86PostMotionEvent(device, 0, 0, 2, dx, dy);
+#endif
+ }
+
+ if (private->emulate3Buttons)
+ {
+
+ /*
+ * Hack to operate the middle button even with Emulate3Buttons set.
+ * Modifying the state table to keep track of the middle button state
+ * would nearly double its size, so I'll stick with this fix. - TJW
+ */
+ if (private->mseType == PROT_MMHIT)
+ change = buttons ^ reverseBits(hitachMap, private->lastButtons);
+ else
+ change = buttons ^ reverseBits(reverseMap, private->lastButtons);
+ if (change & 02)
+ {
+#ifndef XINPUT
+ ENQUEUE(mevent,
+ 2, (buttons & 02) ? ButtonPress : ButtonRelease,
+ XE_POINTER);
+#else
+ xf86PostButtonEvent(device, 0, 2, (buttons & 02), 0, 0);
+#endif
+ }
+
+ /*
+ * emulate the third button by the other two
+ */
+ if ((id = stateTab[(buttons & 0x07) + private->emulateState][0]) != 0)
+ {
+#ifndef XINPUT
+ ENQUEUE(mevent,
+ abs(id), (id < 0 ? ButtonRelease : ButtonPress),
+ XE_POINTER);
+#else
+ xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0);
+#endif
+ }
+
+ if ((id = stateTab[(buttons & 0x07) + private->emulateState][1]) != 0)
+ {
+#ifndef XINPUT
+ ENQUEUE(mevent,
+ abs(id), (id < 0 ? ButtonRelease : ButtonPress),
+ XE_POINTER);
+#else
+ xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0);
+#endif
+ }
+
+ private->emulateState = stateTab[(buttons & 0x07) + private->emulateState][2];
+ if (stateTab[(buttons & 0x07) + private->emulateState][0] ||
+ stateTab[(buttons & 0x07) + private->emulateState][1])
+ {
+ private->truebuttons = truebuttons;
+ timer = TimerSet(timer, 0, private->emulate3Timeout, buttonTimer,
+ (pointer)device);
+ }
+ else
+ {
+ if (timer)
+ {
+ TimerFree(timer);
+ timer = NULL;
+ }
+ }
+ }
+ else
+ {
+#ifdef AMOEBA
+ if (truebuttons != 0) {
+# ifndef XINPUT
+ ENQUEUE(mevent,
+ truebuttons, (pressed ? ButtonPress : ButtonRelease),
+ XE_POINTER);
+# else
+ xf86PostButtonEvent(device, 0, truebuttons, pressed, 0, 0);
+# endif
+ }
+#else
+ /*
+ * real three button event
+ * Note that xf86Info.lastButtons has the hardware button mapping which
+ * is the reverse of the button mapping reported to the server.
+ */
+ if (private->mseType == PROT_MMHIT)
+ change = buttons ^ reverseBits(hitachMap, private->lastButtons);
+ else
+ change = buttons ^ reverseBits(reverseMap, private->lastButtons);
+ while (change)
+ {
+ id = ffs(change);
+ change &= ~(1 << (id-1));
+# ifndef XINPUT
+ ENQUEUE(mevent,
+ id, (buttons&(1<<(id-1)))? ButtonPress : ButtonRelease,
+ XE_POINTER);
+# else
+ xf86PostButtonEvent(device, 0, id, (buttons&(1<<(id-1))), 0, 0);
+# endif
+ }
+#endif
+ }
+ private->lastButtons = truebuttons;
+}
+#endif
+
+
+
+#ifndef NEW_INPUT
+/*
+ * xf86Block --
+ * Os block handler.
+ */
+
+/* ARGSUSED */
+void
+xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+#if defined(XQUEUE)
+ /*
+ * On MP SVR4 boxes, a race condition exists because the XQUEUE does
+ * not have anyway to lock it for exclusive access. This results in one
+ * processor putting something on the queue at the same time the other
+ * processor is taking it something off. The count of items in the queue
+ * can get off by 1. This just goes and checks to see if an extra event
+ * was put in the queue a during this period. The signal for this event
+ * was ignored while processing the previous event.
+ */
+
+ if (xf86Screens[0]->vtSema)
+ xf86XqueRequest();
+#endif
+}
+#endif
+
+
+#ifndef AMOEBA
+
+/*
+ * xf86Wakeup --
+ * Os wakeup handler.
+ */
+
+/* ARGSUSED */
+void
+xf86Wakeup(pointer blockData, int err, pointer pReadmask)
+{
+
+#ifndef __EMX__
+#ifdef __OSF__
+ fd_set kbdDevices;
+ fd_set mseDevices;
+#endif /* __OSF__ */
+ fd_set* LastSelectMask = (fd_set*)pReadmask;
+ fd_set devicesWithInput;
+#ifdef NEW_INPUT
+ InputInfoPtr pInfo;
+#endif
+
+ if (err >= 0) {
+
+ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
+#ifndef __OSF__
+ if (XFD_ANYSET(&devicesWithInput)) {
+ (xf86Info.kbdEvents)();
+#ifndef NEW_INPUT
+ (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev);
+#else
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0 &&
+ (FD_ISSET(pInfo->fd, ((fd_set *)pReadmask)) != 0)) {
+ pInfo->read_input(pInfo);
+ /*
+ * Must break here because more than one device may share
+ * the same file descriptor.
+ */
+ break;
+ }
+ pInfo = pInfo->next;
+ }
+#endif /* NEW_INPUT */
+ }
+#else /* __OSF__ */
+ /*
+ * Until the two devices are made nonblock on read, we have to do this.
+ */
+ MASKANDSETBITS(devicesWithInput, pReadmask, EnabledDevices);
+
+ CLEARBITS(kbdDevices);
+ BITSET(kbdDevices, xf86Info.consoleFd);
+ MASKANDSETBITS(kbdDevices, kbdDevices, devicesWithInput);
+
+ CLEARBITS(mseDevices);
+ BITSET(mseDevices, xf86Info.mouseDev->mseFd);
+ MASKANDSETBITS(mseDevices, mseDevices, devicesWithInput);
+
+ if (ANYSET(kbdDevices) || xf86Info.kbdRate)
+ (xf86Info.kbdEvents)(ANYSET(kbdDevices));
+ if (ANYSET(mseDevices))
+ (xf86Info.mouseDev->mseEvents)(1);
+#endif /* __OSF__ */
+ }
+#else /* __EMX__ */
+
+ (xf86Info.kbdEvents)(); /* Under OS/2, always call */
+ (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev);
+
+#endif /* __EMX__ */
+
+ {
+ IHPtr ih;
+
+ for (ih = InputHandlers; ih; ih = ih->next) {
+ if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
+ (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) {
+ ih->ihproc(ih->fd, ih->data);
+ }
+ }
+ }
+
+#ifndef NEW_INPUT
+#if defined(XQUEUE) && !defined(XQUEUE_ASYNC)
+ /* This could be done more cleanly */
+ if (xf86Info.mouseDev->xqueSema && xf86Info.mouseDev->xquePending)
+ xf86XqueRequest();
+#endif
+#endif
+
+ if (xf86VTSwitchPending()) xf86VTSwitch();
+
+ if (xf86Info.inputPending) ProcessInputEvents();
+}
+
+#endif /* AMOEBA */
+
+
+/*
+ * xf86SigHandler --
+ * Catch unexpected signals and exit cleanly.
+ */
+void
+xf86SigHandler(int signo)
+{
+ signal(signo,SIG_IGN);
+ xf86Info.caughtSignal = TRUE;
+#if defined(DEBUG) && defined(XFree86LOADER)
+ if (signo == SIGSEGV)
+ LoaderDumpSymbols();
+#endif
+ FatalError("Caught signal %d. Server aborting\n", signo);
+}
+
+/*
+ * xf86VTSwitch --
+ * Handle requests for switching the vt.
+ */
+static void
+xf86VTSwitch()
+{
+ int i;
+#ifdef NEW_INPUT
+ InputInfoPtr pInfo;
+#endif
+ IHPtr ih;
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch()\n");
+#endif
+
+#ifdef XFreeXDGA
+ if(!DGAVTSwitch())
+ return;
+#endif
+
+ /*
+ * Since all screens are currently all in the same state it is sufficient
+ * check the first. This might change in future.
+ */
+ if (xf86Screens[0]->vtSema) {
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ BOOLTOSTRING(xf86Exiting));
+#endif
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Exiting)
+ if (xf86Screens[i]->SaveRestoreImage)
+ xf86Screens[i]->SaveRestoreImage(i, SaveImage);
+ }
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->LeaveVT(i, 0);
+ }
+#ifndef __EMX__
+ DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
+#ifndef NEW_INPUT
+ DisableDevice((DeviceIntPtr)xf86Info.pMouse);
+#else
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ DisableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* NEW_INPUT */
+#endif /* !__EMX__ */
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ xf86AccessLeaveState(); /* We need this here, otherwise */
+ xf86AccessLeave(); /* console won't be restored */
+
+ if (!xf86VTSwitchAway()) {
+ /*
+ * switch failed
+ */
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leave failed\n");
+#endif
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ if (!xf86Exiting) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->SaveRestoreImage)
+ xf86Screens[i]->SaveRestoreImage(i, RestoreImage);
+ }
+ }
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+#ifndef __EMX__
+ EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
+#ifndef NEW_INPUT
+ EnableDevice((DeviceIntPtr)xf86Info.pMouse);
+#else
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* NEW_INPUT */
+#endif /* !__EMX__ */
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+
+ } else {
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+ xf86DisableIO();
+ }
+ } else {
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Entering\n");
+#endif
+ if (!xf86VTSwitchTo()) return;
+
+ xf86EnableIO();
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->vtSema = TRUE;
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->SaveRestoreImage)
+ xf86Screens[i]->SaveRestoreImage(i, RestoreImage);
+ }
+
+ /* Turn screen saver off when switching back */
+ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
+
+#ifndef __EMX__
+ EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
+#ifndef NEW_INPUT
+ EnableDevice((DeviceIntPtr)xf86Info.pMouse);
+#else
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+#endif /* NEW_INPUT */
+#endif /* !__EMX__ */
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+ }
+}
+
+
+/* Input handler registration */
+
+pointer
+xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+{
+ IHPtr ih;
+
+ if (fd < 0 || !proc)
+ return NULL;
+
+ ih = xcalloc(sizeof(*ih), 1);
+ if (!ih)
+ return NULL;
+
+ ih->fd = fd;
+ ih->ihproc = proc;
+ ih->data = data;
+ ih->enabled = TRUE;
+
+ ih->next = InputHandlers;
+ InputHandlers = ih;
+
+ AddEnabledDevice(fd);
+
+ return ih;
+}
+
+void
+xf86RemoveInputHandler(pointer handler)
+{
+ IHPtr ih, p;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+
+ if (ih == InputHandlers)
+ InputHandlers = ih->next;
+ else {
+ p = InputHandlers;
+ while (p && p->next != ih)
+ p = p->next;
+ if (ih)
+ p->next = ih->next;
+ }
+ xfree(ih);
+}
+
+void
+xf86DisableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = FALSE;
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+}
+
+void
+xf86EnableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = TRUE;
+ if (ih->fd >= 0)
+ AddEnabledDevice(ih->fd);
+}
+
+#ifdef XTESTEXT1
+
+void
+XTestGetPointerPos(short *fmousex, short *fmousey)
+{
+ int x,y;
+
+ miPointerPosition(&x, &y);
+ *fmousex = x;
+ *fmousey = y;
+}
+
+
+
+void
+XTestJumpPointer(int jx, int jy, int dev_type)
+{
+ miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() );
+}
+
+
+
+void
+XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex,
+ int mousey)
+{
+ xEvent tevent;
+
+ tevent.u.u.type = (dev_type == XE_POINTER) ?
+ (keystate == XTestKEY_UP) ? ButtonRelease : ButtonPress :
+ (keystate == XTestKEY_UP) ? KeyRelease : KeyPress;
+ tevent.u.u.detail = keycode;
+ tevent.u.keyButtonPointer.rootX = mousex;
+ tevent.u.keyButtonPointer.rootY = mousey;
+ tevent.u.keyButtonPointer.time = xf86Info.lastEventTime = GetTimeInMillis();
+#ifdef XINPUT
+ xf86eqEnqueue(&tevent);
+#else
+ mieqEnqueue(&tevent);
+#endif
+ xf86Info.inputPending = TRUE; /* virtual event */
+}
+
+#endif /* XTESTEXT1 */
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86ExtInit.h b/xc/programs/Xserver/hw/xfree86/common/xf86ExtInit.h
new file mode 100644
index 000000000..b9855361b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86ExtInit.h
@@ -0,0 +1,17 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86ExtInit.h,v 3.6 1996/12/23 06:43:25 dawes Exp $ */
+
+
+
+
+
+/* $XConsortium: xf86ExtInit.h /main/6 1996/02/21 17:38:17 kaleb $ */
+
+/* Hack to avoid multiple versions of dixfonts in vga{2,16}misc.o */
+#ifndef LBX
+extern void LbxFreeFontTag(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+void LbxFreeFontTag() {}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
new file mode 100644
index 000000000..eab83aa62
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
@@ -0,0 +1,207 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.21 1999/07/11 10:27:04 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains all the XFree86 global variables.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Parser.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+
+/* Globals that video drivers may access */
+
+int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */
+ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
+int xf86PixmapIndex = 0;
+const unsigned char byte_reversed[256] =
+{
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+};
+
+/* Globals that input drivers may access */
+InputInfoPtr xf86InputDevs = NULL;
+
+
+/* Globals that video drivers may not access */
+
+xf86InfoRec xf86Info = {
+ NULL, /* pKeyboard */
+ NULL, /* kbdProc */
+ NULL, /* kbdEvents */
+ -1, /* consoleFd */
+ -1, /* kbdFd */
+ -1, /* vtno */
+ -1, /* kbdType */
+ -1, /* kbdRate */
+ -1, /* kbdDelay */
+ -1, /* bell_pitch */
+ -1, /* bell_duration */
+ TRUE, /* autoRepeat */
+ 0, /* leds */
+ 0, /* xleds */
+ NULL, /* vtinit */
+ 0, /* scanPrefix */
+ FALSE, /* capsLock */
+ FALSE, /* numLock */
+ FALSE, /* scrollLock */
+ FALSE, /* modeSwitchLock */
+ FALSE, /* composeLock */
+ FALSE, /* vtSysreq */
+#if defined(SVR4) && defined(i386)
+ FALSE, /* panix106 */
+#endif
+ NULL, /* pMouse */
+#ifdef XINPUT
+ NULL, /* mouseLocal */
+#endif
+#ifndef NEW_INPUT
+ NULL, /* mouseDev */
+#endif
+ -1, /* lastEventTime */
+ FALSE, /* vtRequestsPending */
+ FALSE, /* inputPending */
+ FALSE, /* dontZap */
+ FALSE, /* dontZoom */
+ FALSE, /* notrapSignals */
+ FALSE, /* caughtSignal */
+ FALSE, /* sharedMonitor */
+ NULL, /* currentScreen */
+#ifdef CSRG_BASED
+ -1, /* screenFd */
+ -1, /* consType */
+#endif
+#ifdef AMOEBA
+ NULL, /* screenPtr */
+#endif
+#ifdef XKB
+ NULL, /* xkbkeymap */
+ NULL, /* xkbkeycodes */
+ NULL, /* xkbtypes */
+ NULL, /* xkbcompat */
+ NULL, /* xkbsymbols */
+ NULL, /* xkbgeometry */
+ FALSE, /* xkbcomponents_specified */
+ NULL, /* xkbrules */
+ NULL, /* xkbmodel */
+ NULL, /* xkblayout */
+ NULL, /* xkbvariant */
+ NULL, /* xkboptions */
+#endif
+ FALSE, /* allowMouseOpenFail */
+ TRUE, /* vidModeEnabled */
+ FALSE, /* vidModeAllowNonLocal */
+ TRUE, /* miscModInDevEnabled */
+ FALSE, /* miscModInDevAllowNonLocal */
+ PCIProbe1, /* pciFlags */
+ Pix24DontCare, /* pixmap24 */
+ X_DEFAULT /* pix24From */
+#if defined(i386) || defined(__i386__)
+ ,FALSE /* pc98 */
+#endif
+};
+const char *xf86ConfigFile = NULL;
+const char *xf86ModulePath = DEFAULT_MODULE_PATH;
+MessageType xf86ModPathFrom = X_DEFAULT;
+const char *xf86LogFile = DEFAULT_LOGPREFIX;
+MessageType xf86LogFileFrom = X_DEFAULT;
+serverLayoutRec xf86ConfigLayout = {NULL, };
+confDRIRec xf86ConfigDRI = {0, };
+XF86ConfigPtr xf86configptr = NULL;
+Bool xf86Exiting = FALSE;
+Bool xf86Resetting = FALSE;
+Bool xf86Initialising = FALSE;
+Bool xf86ProbeFailed = FALSE;
+#ifdef XFree86LOADER
+DriverPtr *xf86DriverList = NULL;
+int xf86NumDrivers = 0;
+InputDriverPtr *xf86InputDriverList = NULL;
+int xf86NumInputDrivers = 0;
+#endif
+int xf86NumScreens = 0;
+
+const char *xf86VisualNames[] = {
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor",
+ "DirectColor"
+};
+
+/* Parameters set only from the command line */
+char *xf86ServerName = "no-name";
+Bool xf86fpFlag = FALSE;
+Bool xf86coFlag = FALSE;
+Bool xf86sFlag = FALSE;
+Bool xf86bsEnableFlag = FALSE;
+Bool xf86bsDisableFlag = FALSE;
+char *xf86LayoutName = NULL;
+char *xf86ScreenName = NULL;
+char *xf86PointerName = NULL;
+char *xf86KeyboardName = NULL;
+Bool xf86ProbeOnly = FALSE;
+int xf86Verbose = DEFAULT_VERBOSE;
+int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
+int xf86FbBpp = -1;
+Pix24Flags xf86Pix24 = Pix24DontCare;
+int xf86Depth = -1;
+rgb xf86Weight = {0, 0, 0};
+Bool xf86FlipPixels = FALSE;
+Gamma xf86Gamma = {0.0, 0.0, 0.0};
+Bool xf86ShowUnresolved = DEFAULT_UNRESOLVED;
+Bool xf86BestRefresh = DEFAULT_BEST_REFRESH;
+Bool xf86AllowMouseOpenFail = FALSE;
+#ifdef XF86VIDMODE
+Bool xf86VidModeDisabled = FALSE;
+Bool xf86VidModeAllowNonLocal = FALSE;
+#endif
+#ifdef XF86MISC
+Bool xf86MiscModInDevDisabled = FALSE;
+Bool xf86MiscModInDevAllowNonLocal = FALSE;
+#endif
+
+#ifdef DLOPEN_HACK
+/*
+ * This stuff is a hack to allow dlopen() modules to work. It is intended
+ * only to be used when using dlopen() modules for debugging purposes.
+ */
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
new file mode 100644
index 000000000..6f37aa087
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c
@@ -0,0 +1,2337 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.56 1999/08/28 09:00:52 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997-1998 by The XFree86 Project, Inc.
+ *
+ * Authors: Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ *
+ * This file includes the helper functions that the server provides for
+ * different drivers.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "servermd.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "micmap.h"
+#include "xf86PciInfo.h"
+#include "xf86DDC.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+
+/* For xf86GetClocks */
+#if defined(CSRG_BASED) || defined(MACH386)
+#include <sys/resource.h>
+#endif
+
+static int xf86ScrnInfoPrivateCount = 0;
+static FILE *logfile = NULL;
+
+
+#ifdef XFree86LOADER
+/* Add a pointer to a new DriverRec to xf86DriverList */
+
+void
+xf86AddDriver(DriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86DriverList == NULL)
+ xf86NumDrivers = 0;
+
+ xf86NumDrivers++;
+ xf86DriverList = xnfrealloc(xf86DriverList,
+ xf86NumDrivers * sizeof(DriverPtr));
+ xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
+ *xf86DriverList[xf86NumDrivers - 1] = *driver;
+ xf86DriverList[xf86NumDrivers - 1]->module = module;
+ xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
+}
+
+void
+xf86DeleteDriver(int drvIndex)
+{
+ if (xf86DriverList[drvIndex] && xf86DriverList[drvIndex]->module)
+ UnloadModule(xf86DriverList[drvIndex]->module);
+ xf86DriverList[drvIndex] = NULL;
+}
+
+
+/* Add a pointer to a new InputDriverRec to xf86InputDriverList */
+
+void
+xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86InputDriverList == NULL)
+ xf86NumInputDrivers = 0;
+
+ xf86NumInputDrivers++;
+ xf86InputDriverList = xnfrealloc(xf86InputDriverList,
+ xf86NumInputDrivers * sizeof(InputDriverPtr));
+ xf86InputDriverList[xf86NumInputDrivers - 1] =
+ xnfalloc(sizeof(InputDriverRec));
+ *xf86InputDriverList[xf86NumInputDrivers - 1] = *driver;
+ xf86InputDriverList[xf86NumInputDrivers - 1]->module = module;
+ xf86InputDriverList[xf86NumInputDrivers - 1]->refCount = 0;
+}
+
+void
+xf86DeleteInputDriver(int drvIndex)
+{
+ if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
+ UnloadModule(xf86InputDriverList[drvIndex]->module);
+ xf86InputDriverList[drvIndex] = NULL;
+}
+#endif
+
+
+/* Allocate a new ScrnInfoRec in xf86Screens */
+
+ScrnInfoPtr
+xf86AllocateScreen(DriverPtr drv, int flags)
+{
+ int i;
+
+ if (xf86Screens == NULL)
+ xf86NumScreens = 0;
+
+ i = xf86NumScreens++;
+ xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr));
+ xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1);
+ xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
+ xf86Screens[i]->origIndex = i; /* This never changes */
+ xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion),
+ xf86ScrnInfoPrivateCount);
+ /*
+ * Almost everything uses this default, and many of those that don't
+ * will wrap it.
+ */
+ xf86Screens[i]->SaveRestoreImage = xf86SaveRestoreImage;
+
+ xf86Screens[i]->drv = drv;
+ drv->refCount++;
+#ifdef XFree86LOADER
+ xf86Screens[i]->module = DuplicateModule(drv->module, NULL);
+#else
+ xf86Screens[i]->module = NULL;
+#endif
+ /*
+ * set the initial access state. This will be modified after PreInit.
+ * XXX Or should we do it some other place?
+ */
+ xf86Screens[i]->CurrentAccess = &xf86CurrentAccess;
+ xf86Screens[i]->resourceType = MEM_IO;
+ return xf86Screens[i];
+}
+
+
+/*
+ * Remove an entry from xf86Screens. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+void
+xf86DeleteScreen(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ /* First check if the screen is valid */
+ if (xf86NumScreens == 0 || xf86Screens == NULL)
+ return;
+
+ if (scrnIndex > xf86NumScreens - 1)
+ return;
+
+ if (!(pScrn = xf86Screens[scrnIndex]))
+ return;
+
+ /* If a FreeScreen function is defined, call it here */
+ if (pScrn->FreeScreen != NULL)
+ pScrn->FreeScreen(scrnIndex, 0);
+
+ while (pScrn->modes)
+ xf86DeleteMode(&pScrn->modes, pScrn->modes);
+
+ while (pScrn->modePool)
+ xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
+
+ xf86OptionListFree(pScrn->options);
+
+#ifdef XFree86LOADER
+ if (pScrn->module)
+ UnloadModule(pScrn->module);
+#endif
+
+ if (pScrn->drv)
+ pScrn->drv->refCount--;
+
+ if (pScrn->privates);
+ xfree(pScrn->privates);
+
+ xf86ClearEntityListForScreen(scrnIndex);
+
+ xfree(pScrn);
+
+ /* Move the other entries down, updating their scrnIndex fields */
+
+ xf86NumScreens--;
+
+ for (i = scrnIndex; i < xf86NumScreens; i++) {
+ xf86Screens[i] = xf86Screens[i + 1];
+ xf86Screens[i]->scrnIndex = i;
+ /* Also need to take care of the screen layout settings */
+ }
+}
+
+/*
+ * Allocate a private in ScrnInfoRec.
+ */
+
+int
+xf86AllocateScrnInfoPrivateIndex(void)
+{
+ int idx, i;
+ ScrnInfoPtr pScr;
+ DevUnion *nprivs;
+
+ idx = xf86ScrnInfoPrivateCount++;
+ for (i = 0; i < xf86NumScreens; i++) {
+ pScr = xf86Screens[i];
+ nprivs = xnfrealloc(pScr->privates,
+ xf86ScrnInfoPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
+ pScr->privates = nprivs;
+ }
+ return idx;
+}
+
+/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */
+
+InputInfoPtr
+xf86AllocateInput(InputDriverPtr drv, int flags)
+{
+ InputInfoPtr new;
+
+ if (!(new = xcalloc(sizeof(InputInfoRec), 1)))
+ return NULL;
+
+ new->drv = drv;
+ drv->refCount++;
+#ifdef XFree86LOADER
+ new->module = DuplicateModule(drv->module, NULL);
+#else
+ new->module = NULL;
+#endif
+ new->next = xf86InputDevs;
+ xf86InputDevs = new;
+ return new;
+}
+
+
+/*
+ * Remove an entry from xf86InputDevs. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+void
+xf86DeleteInput(InputInfoPtr pInp, int flags)
+{
+ InputInfoPtr p;
+
+ /* First check if the inputdev is valid. */
+ if (pInp == NULL)
+ return;
+
+#if 0
+ /* If a free function is defined, call it here. */
+ if (pInp->free)
+ pInp->free(pInp, 0);
+#endif
+
+#ifdef XFree86LOADER
+ if (pInp->module)
+ UnloadModule(pInp->module);
+#endif
+
+ if (pInp->drv)
+ pInp->drv->refCount--;
+
+ if (pInp->private);
+ xfree(pInp->private);
+
+ /* Remove the entry from the list. */
+ if (pInp == xf86InputDevs)
+ xf86InputDevs = pInp->next;
+ else {
+ p = xf86InputDevs;
+ while (p && p->next != pInp)
+ p = p->next;
+ if (p)
+ p->next = pInp->next;
+ /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
+ }
+ xfree(pInp);
+}
+
+Bool
+xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
+{
+ int i;
+
+ if (pScrn->numFormats >= MAXFORMATS)
+ return FALSE;
+
+ if (bpp <= 0) {
+ if (depth == 1)
+ bpp = 1;
+ else if (depth <= 8)
+ bpp = 8;
+ else if (depth <= 16)
+ bpp = 16;
+ else if (depth <= 32)
+ bpp = 32;
+ else
+ return FALSE;
+ }
+ if (pad <= 0)
+ pad = BITMAP_SCANLINE_PAD;
+
+ i = pScrn->numFormats++;
+ pScrn->formats[i].depth = depth;
+ pScrn->formats[i].bitsPerPixel = bpp;
+ pScrn->formats[i].scanlinePad = pad;
+ return TRUE;
+}
+
+/*
+ * Set the depth we are using based on (in the following order of preference):
+ * - values given on the command line
+ * - values given in the config file
+ * - values provided by the driver
+ * - an overall default when nothing else is given
+ *
+ * Also find a Display subsection matching the depth/bpp found.
+ *
+ * Sets the following ScrnInfoRec fields:
+ * bitsPerPixel, pixmap24, depth, display, imageByteOrder,
+ * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats,
+ * formats, fbFormat.
+ */
+
+/* Can the screen handle 24 bpp pixmaps */
+#define DO_PIX24(f) ((f & Support24bppFb) || \
+ ((f & Support32bppFb) && (f & SupportConvert24to32)))
+
+/* Can the screen handle 32 bpp pixmaps */
+#define DO_PIX32(f) ((f & Support32bppFb) || \
+ ((f & Support24bppFb) && (f & SupportConvert32to24)))
+
+/* Does the screen prefer 32bpp fb for 24bpp pixmaps */
+#define CHOOSE32FOR24(f) ((f & Support32bppFb) && (f & SupportConvert24to32) \
+ && (f & PreferConvert24to32))
+
+/* Does the screen prefer 24bpp fb for 32bpp pixmaps */
+#define CHOOSE24FOR32(f) ((f & Support24bppFb) && (f & SupportConvert32to24) \
+ && (f & PreferConvert32to24))
+
+/* Can the screen handle 32bpp pixmaps for 24bpp fb */
+#define DO_PIX32FOR24(f) ((f & Support24bppFb) && (f & SupportConvert32to24))
+
+/* Can the screen handle 24bpp pixmaps for 32bpp fb */
+#define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32))
+
+Bool
+xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
+ int depth24flags)
+{
+ int i;
+ DispPtr disp;
+ Pix24Flags pix24 = xf86Info.pixmap24;
+ Bool nomatch = FALSE;
+
+ scrp->bitsPerPixel = -1;
+ scrp->depth = -1;
+ scrp->pixmap24 = Pix24DontCare;
+ scrp->bitsPerPixelFrom = X_DEFAULT;
+ scrp->depthFrom = X_DEFAULT;
+
+#if BITMAP_SCANLINE_UNIT == 64
+ /*
+ * For platforms with 64-bit scanlines, modify the driver's depth24flags
+ * to remove preferences for packed 24bpp modes, which are not currently
+ * supported on these platforms.
+ */
+ depth24flags &= ~(SupportConvert32to24 | SupportConvert32to24 |
+ PreferConvert24to32 | PreferConvert32to24);
+#endif
+
+ if (xf86FbBpp > 0) {
+ scrp->bitsPerPixel = xf86FbBpp;
+ scrp->bitsPerPixelFrom = X_CMDLINE;
+ }
+
+ if (xf86Depth > 0) {
+ scrp->depth = xf86Depth;
+ scrp->depthFrom = X_CMDLINE;
+ }
+
+ if (xf86FbBpp < 0 && xf86Depth < 0) {
+ if (scrp->confScreen->defaultfbbpp > 0) {
+ scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ }
+ if (scrp->confScreen->defaultdepth > 0) {
+ scrp->depth = scrp->confScreen->defaultdepth;
+ scrp->depthFrom = X_CONFIG;
+ }
+ }
+
+ /* If none of these is set, pick a default */
+ if (scrp->bitsPerPixel < 0 && scrp->depth < 0) {
+ if (fbbpp > 0 || depth > 0) {
+ if (fbbpp > 0)
+ scrp->bitsPerPixel = fbbpp;
+ if (depth > 0)
+ scrp->depth = depth;
+ } else {
+ scrp->bitsPerPixel = 8;
+ scrp->depth = 8;
+ }
+ }
+
+ /* If any are not given, determine a default for the others */
+
+ if (scrp->bitsPerPixel < 0) {
+ /* The depth must be set */
+ if (scrp->depth > -1) {
+ if (scrp->depth == 1)
+ scrp->bitsPerPixel = 1;
+ else if (scrp->depth <= 4)
+ scrp->bitsPerPixel = 4;
+ else if (scrp->depth <= 8)
+ scrp->bitsPerPixel = 8;
+ else if (scrp->depth <= 16)
+ scrp->bitsPerPixel = 16;
+ else if (scrp->depth <= 24) {
+ /*
+ * Figure out if a choice is possible based on the depth24
+ * and pix24 flags.
+ */
+ /* Check pix24 first */
+ if (pix24 != Pix24DontCare) {
+ if (pix24 == Pix24Use32) {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else {
+ nomatch = TRUE;
+ }
+ } else if (pix24 == Pix24Use24) {
+ if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ } else {
+ nomatch = TRUE;
+ }
+ }
+ } else {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ }
+ }
+ } else if (scrp->depth <= 32)
+ scrp->bitsPerPixel = 32;
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than 32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "xf86SetDepthBpp: internal error: depth and fbbpp"
+ " are both not set\n");
+ return FALSE;
+ }
+ if (scrp->bitsPerPixel < 0) {
+ if (nomatch)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24 pixmap format (%d)\n",
+ PIX24TOBPP(pix24));
+ else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
+ NoDepth24Support)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24\n");
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't find fbbpp for depth 24\n");
+ return FALSE;
+ }
+ scrp->bitsPerPixelFrom = X_PROBED;
+ }
+
+ if (scrp->depth <= 0) {
+ /* bitsPerPixel is already set */
+ switch (scrp->bitsPerPixel) {
+ case 32:
+ scrp->depth = 24;
+ break;
+ default:
+ /* 1, 4, 8, 16 and 24 */
+ scrp->depth = scrp->bitsPerPixel;
+ break;
+ }
+ scrp->depthFrom = X_PROBED;
+ }
+
+ /* Sanity checks */
+ if (scrp->depth < 1 || scrp->depth > 32) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is not in the range 1-32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ switch (scrp->bitsPerPixel) {
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified fbbpp (%d) is not a permitted value\n",
+ scrp->bitsPerPixel);
+ return FALSE;
+ }
+ if (scrp->depth > scrp->bitsPerPixel) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than the fbbpp (%d)\n",
+ scrp->depth, scrp->bitsPerPixel);
+ return FALSE;
+ }
+
+ /* set scrp->pixmap24 if the driver isn't flexible */
+ if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) {
+ scrp->pixmap24 = Pix24Use24;
+ }
+ if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) {
+ scrp->pixmap24 = Pix24Use32;
+ }
+
+ /*
+ * Find the Display subsection matching the depth/fbbpp and initialise
+ * scrp->display with it.
+ */
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
+ || (disp->depth == scrp->depth && disp->fbbpp <= 0)
+ || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
+ scrp->display = disp;
+ break;
+ }
+ }
+ if (i == scrp->confScreen->numdisplays) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR, "No Display subsection "
+ "in Screen section \"%s\" for depth/fbbpp %d/%d\n",
+ scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
+ return FALSE;
+ }
+
+ /*
+ * Setup defaults for the display-wide attributes the framebuffer will
+ * need. These defaults should eventually be set globally, and not
+ * dependent on the screens.
+ */
+ scrp->imageByteOrder = IMAGE_BYTE_ORDER;
+ scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ if (scrp->depth < 8) {
+ /* Planar modes need these settings */
+ scrp->bitmapScanlineUnit = 8;
+ scrp->bitmapBitOrder = MSBFirst;
+ } else {
+ scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
+ }
+
+ /*
+ * If an unusual depth is required, add it to scrp->formats. The formats
+ * for the common depths are handled globally in InitOutput
+ */
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ case 15:
+ case 16:
+ case 24:
+ /* Common depths. Nothing to do for them */
+ break;
+ default:
+ if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't add pixmap format for depth %d\n", scrp->depth);
+ return FALSE;
+ }
+ }
+
+ /* Initialise the framebuffer format for this screen */
+ scrp->fbFormat.depth = scrp->depth;
+ scrp->fbFormat.bitsPerPixel = scrp->bitsPerPixel;
+ scrp->fbFormat.scanlinePad = BITMAP_SCANLINE_PAD;
+
+ return TRUE;
+}
+
+/*
+ * Print out the selected depth and bpp.
+ */
+void
+xf86PrintDepthBpp(ScrnInfoPtr scrp)
+{
+ xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
+ xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel);
+}
+
+/*
+ * xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths
+ * greater than MAX_PSEUDO_DEPTH also scrp->rgbBits.
+ */
+Bool
+xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
+{
+ MessageType weightFrom = X_DEFAULT;
+
+ scrp->weight.red = 0;
+ scrp->weight.green = 0;
+ scrp->weight.blue = 0;
+
+ if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) {
+ scrp->weight = xf86Weight;
+ weightFrom = X_CMDLINE;
+ } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
+ && scrp->display->weight.blue > 0) {
+ scrp->weight = scrp->display->weight;
+ weightFrom = X_CONFIG;
+ } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
+ scrp->weight = weight;
+ } else {
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ scrp->weight.red = scrp->weight.green =
+ scrp->weight.blue = scrp->rgbBits;
+ break;
+ case 15:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
+ break;
+ case 16:
+ scrp->weight.red = scrp->weight.blue = 5;
+ scrp->weight.green = 6;
+ break;
+ case 24:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
+ break;
+ case 30:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
+ break;
+ }
+ }
+
+ if (scrp->weight.red)
+ xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
+ scrp->weight.red, scrp->weight.green, scrp->weight.blue);
+
+ if (scrp->depth > MAX_PSEUDO_DEPTH &&
+ (scrp->depth != scrp->weight.red + scrp->weight.green +
+ scrp->weight.blue)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Weight given (%d%d%d) is inconsistent with the "
+ "depth (%d)\n", scrp->weight.red, scrp->weight.green,
+ scrp->weight.blue, scrp->depth);
+ return FALSE;
+ }
+ if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) {
+ /*
+ * XXX Does this even mean anything for TrueColor visuals?
+ * If not, we shouldn't even be setting it here. However, this
+ * matches the behaviour of 3.x versions of XFree86.
+ */
+ scrp->rgbBits = scrp->weight.red;
+ if (scrp->weight.green > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.green;
+ if (scrp->weight.blue > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.blue;
+ }
+
+ /* Set the mask and offsets */
+ if (mask.red == 0 || mask.green == 0 || mask.blue == 0) {
+ /* Default to a setting common to PC hardware */
+ scrp->offset.red = scrp->weight.green + scrp->weight.blue;
+ scrp->offset.green = scrp->weight.blue;
+ scrp->offset.blue = 0;
+ scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
+ scrp->mask.green = ((1 << scrp->weight.green) - 1)
+ << scrp->offset.green;
+ scrp->mask.blue = (1 << scrp->weight.blue) - 1;
+ } else {
+ /* Initialise to the values passed */
+ scrp->mask.red = mask.red;
+ scrp->mask.green = mask.green;
+ scrp->mask.blue = mask.blue;
+ scrp->offset.red = ffs(mask.red);
+ scrp->offset.green = ffs(mask.green);
+ scrp->offset.blue = ffs(mask.blue);
+ }
+ return TRUE;
+}
+
+Bool
+xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
+{
+ MessageType visualFrom = X_DEFAULT;
+ Bool bad = FALSE;
+
+ if (defaultColorVisualClass >= 0) {
+ scrp->defaultVisual = defaultColorVisualClass;
+ visualFrom = X_CMDLINE;
+ } else if (scrp->display->defaultVisual >= 0) {
+ scrp->defaultVisual = scrp->display->defaultVisual;
+ visualFrom = X_CONFIG;
+ } else if (visual >= 0) {
+ scrp->defaultVisual = visual;
+ } else {
+ if (scrp->depth == 1)
+ scrp->defaultVisual = StaticGray;
+ else if (scrp->depth == 4)
+ scrp->defaultVisual = StaticColor;
+ else if (scrp->depth <= MAX_PSEUDO_DEPTH)
+ scrp->defaultVisual = PseudoColor;
+ else
+ scrp->defaultVisual = TrueColor;
+ }
+ switch (scrp->defaultVisual) {
+ case StaticGray:
+ case GrayScale:
+ case StaticColor:
+ case PseudoColor:
+ case TrueColor:
+ case DirectColor:
+ xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
+ xf86VisualNames[scrp->defaultVisual]);
+ /* Check if the visual is valid for the depth */
+ if (scrp->depth == 1 && scrp->defaultVisual != StaticGray)
+ bad = TRUE;
+ else if (scrp->depth == 4 &&
+ (scrp->defaultVisual == TrueColor ||
+ scrp->defaultVisual == DirectColor))
+ bad = TRUE;
+ else if (scrp->depth > MAX_PSEUDO_DEPTH &&
+ scrp->defaultVisual != TrueColor &&
+ scrp->defaultVisual != DirectColor)
+ bad = TRUE;
+ if (bad) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Selected default "
+ "visual (%s) is not valid for depth %d\n",
+ xf86VisualNames[scrp->defaultVisual], scrp->depth);
+ return FALSE;
+ } else
+ return TRUE;
+ default:
+
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Invalid default visual class (%d)\n", scrp->defaultVisual);
+ return FALSE;
+ }
+}
+
+#define TEST_GAMMA(g) \
+ (g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO
+
+#define SET_GAMMA(g) \
+ (g) > GAMMA_ZERO ? (g) : 1.0
+
+Bool
+xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
+{
+ MessageType from = X_DEFAULT;
+ xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
+
+ if (TEST_GAMMA(xf86Gamma)) {
+ from = X_CMDLINE;
+ scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
+ scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
+ scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
+ } else if (TEST_GAMMA(scrp->monitor->gamma)) {
+ from = X_CONFIG;
+ scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
+ scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
+ scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
+#if 0
+ } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) {
+ from = X_PROBED;
+ scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
+ /* EDID structure version 2 gives optional seperate red, green & blue gamma values
+ * in bytes 0x57-0x59 */
+#endif
+ } else if (TEST_GAMMA(gamma)) {
+ scrp->gamma.red = SET_GAMMA(gamma.red);
+ scrp->gamma.green = SET_GAMMA(gamma.green);
+ scrp->gamma.blue = SET_GAMMA(gamma.blue);
+ } else {
+ scrp->gamma.red = 1.0;
+ scrp->gamma.green = 1.0;
+ scrp->gamma.blue = 1.0;
+ }
+ xf86DrvMsg(scrp->scrnIndex, from,
+ "Using gamma correction (%.1f, %.1f, %.1f)\n",
+ scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
+
+ return TRUE;
+}
+
+#undef TEST_GAMMA
+#undef SET_GAMMA
+
+
+/*
+ * Set the DPI from the command line option. XXX should allow it to be
+ * calculated from the witdhmm/heightmm values.
+ */
+
+#undef MMPERINCH
+#define MMPERINCH 25.4
+
+void
+xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
+{
+ MessageType from = X_DEFAULT;
+ xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC);
+
+ /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */
+ pScrn->widthmm = pScrn->monitor->widthmm;
+ pScrn->heightmm = pScrn->monitor->heightmm;
+
+ if (monitorResolution > 0) {
+ pScrn->xDpi = monitorResolution;
+ pScrn->yDpi = monitorResolution;
+ from = X_CMDLINE;
+ } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
+ from = X_CONFIG;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ pScrn->widthmm, pScrn->heightmm);
+ } else if ( DDC && (DDC->features.hsize > 0 || DDC->features.vsize > 0) ) {
+ from = X_PROBED;
+ /* DDC gives display size in mm for individual modes,
+ * but cm for monitor
+ */
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) cm\n",
+ DDC->features.hsize, DDC->features.vsize );
+ pScrn->widthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
+ pScrn->heightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ } else {
+ if (x > 0)
+ pScrn->xDpi = x;
+ else
+ pScrn->xDpi = DEFAULT_DPI;
+ if (y > 0)
+ pScrn->yDpi = y;
+ else
+ pScrn->yDpi = DEFAULT_DPI;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n",
+ pScrn->xDpi, pScrn->yDpi);
+}
+
+#undef MMPERINCH
+
+
+void
+xf86SetBlackWhitePixels(ScreenPtr pScreen)
+{
+ if (xf86FlipPixels) {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ } else {
+ pScreen->whitePixel = 1;
+ pScreen->blackPixel = 0;
+ }
+}
+
+/*
+ * create a new serial number for the window. Used in xf86SaveRestoreImage
+ * to force revalidation of all the GC in the window tree of each screen.
+ */
+/*ARGSUSED*/
+int
+xf86NewSerialNumber(WindowPtr p, pointer unused)
+{
+ p->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ return WT_WALKCHILDREN;
+}
+
+/*
+ * Function to save/restore the video image and replace the root drawable
+ * with a pixmap.
+ *
+ * This is used when VT switching and when entering/leaving DGA direct mode.
+ *
+ * This has been rewritten compared with the older code, with the intention
+ * of making it more general. It relies on some new functions added to
+ * the ScreenRec. It has not been tested yet.
+ *
+ * Here, we switch the pixmap data pointers, rather than the pixmaps themselves
+ * to avoid having to find and change any references to the screen pixmap
+ * such as GC's, window privates etc.
+ */
+
+Bool
+xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what)
+{
+ ScreenPtr pScreen;
+ static unsigned char *devPrivates[MAXSCREENS];
+ static int devKinds[MAXSCREENS];
+ pointer devPrivate;
+ Bool ret = FALSE;
+ int width, height, devKind, bitsPerPixel;
+ PixmapPtr pScreenPix, pPix;
+
+ BoxRec pixBox;
+ RegionRec pixReg;
+
+ pScreen = xf86Screens[scrnIndex]->pScreen;
+
+ pixBox.x1 = pixBox.y1 = 0;
+ pixBox.x2 = pScreen->width;
+ pixBox.y2 = pScreen->height;
+ (*pScreen->RegionInit)(&pixReg, &pixBox, 1);
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ switch (what) {
+ case SaveImage:
+ /*
+ * Create a dummy pixmap to write to while VT is switched out, and
+ * copy the screen to that pixmap.
+ */
+ width = pScreenPix->drawable.width;
+ height = pScreenPix->drawable.height;
+ bitsPerPixel = pScreenPix->drawable.bitsPerPixel;
+
+ /* save the old data */
+ devPrivates[scrnIndex] = pScreenPix->devPrivate.ptr;
+ devKinds[scrnIndex] = pScreenPix->devKind;
+
+ /* allocate new data */
+ devKind = (((width * bitsPerPixel) + 31) >> 5) << 2; /* which macro ? */
+ devPrivate = xalloc(devKind * height);
+
+ if(devPrivate) {
+ pPix = GetScratchPixmapHeader(pScreen, width, height,
+ pScreen->rootDepth, bitsPerPixel, devKind, devPrivate);
+
+ if(pPix) {
+ (*pScreen->BackingStoreFuncs.SaveAreas)(pPix, &pixReg, 0, 0,
+ WindowTable[scrnIndex]);
+
+ FreeScratchPixmapHeader(pPix);
+
+ /* modify the pixmap */
+ pScreenPix->devPrivate.ptr = devPrivate;
+ pScreenPix->devKind = devKind;
+
+ WalkTree(xf86Screens[scrnIndex]->pScreen,xf86NewSerialNumber,0);
+ ret = TRUE;
+ } else
+ xfree(devPrivate);
+ }
+ break;
+ case RestoreImage:
+ /*
+ * Reinstate the screen pixmap and copy the dummy pixmap back
+ * to the screen.
+ */
+
+ if (!xf86Resetting) {
+ width = pScreenPix->drawable.width;
+ height = pScreenPix->drawable.height;
+ bitsPerPixel = pScreenPix->drawable.bitsPerPixel;
+ devPrivate = pScreenPix->devPrivate.ptr;
+ devKind = pScreenPix->devKind;
+
+ /* scratch pixmap for the saved screen */
+ pPix = GetScratchPixmapHeader(pScreen, width, height,
+ pScreen->rootDepth, bitsPerPixel, devKind, devPrivate);
+
+ if(pPix) {
+ /* restore the screen pixmap's correct values */
+ pScreenPix->devPrivate.ptr = devPrivates[scrnIndex];
+ pScreenPix->devKind = devKinds[scrnIndex];
+
+ (*pScreen->BackingStoreFuncs.RestoreAreas)(pPix, &pixReg, 0, 0,
+ WindowTable[scrnIndex]);
+ xfree(devPrivate);
+ FreeScratchPixmapHeader(pPix);
+ /* restore old values */
+ WalkTree(xf86Screens[scrnIndex]->pScreen,xf86NewSerialNumber,0);
+ ret = TRUE;
+ }
+ break;
+ }
+ /* Fall through */
+ case FreeImage:
+ if (pScreenPix->devPrivate.ptr)
+ xfree(pScreenPix->devPrivate.ptr);
+ ret = TRUE;
+ break;
+ default:
+ ErrorF("xf86SaveRestoreImage: Invalid flag (%d)\n", what);
+ }
+ (*pScreen->RegionUninit)(&pixReg);
+ return ret;
+}
+
+/* Buffer to hold log data written before the log file is opened */
+static char *saveBuffer = NULL;
+static int size = 0, unused = 0, pos = 0;
+
+/* These functions do the actual writes. */
+static void
+VWrite(int verb, const char *f, va_list args)
+{
+ static char buffer[1024];
+ int len = 0;
+
+ /*
+ * Since a va_list can only be processed once, write the string to a
+ * buffer, and then write the buffer out to the appropriate output
+ * stream(s).
+ */
+ if (verb < 0 || xf86LogVerbose >= verb || xf86Verbose >= verb) {
+ vsnprintf(buffer, sizeof(buffer), f, args);
+ len = strlen(buffer);
+ }
+ if ((verb < 0 || xf86Verbose >= verb) && len > 0)
+ fwrite(buffer, len, 1, stderr);
+ if ((verb < 0 || xf86LogVerbose >= verb) && len > 0) {
+ if (logfile)
+ fwrite(buffer, len, 1, logfile);
+ else {
+ /*
+ * Note, this code is used before OsInit() has been called, so
+ * xalloc and friends can't be used.
+ */
+ if (len > unused) {
+ size += 1024;
+ unused += 1024;
+ saveBuffer = realloc(saveBuffer, size);
+ if (!saveBuffer)
+ FatalError("realloc() failed while saving log messages\n");
+ }
+ unused -= len;
+ memcpy(saveBuffer + pos, buffer, len);
+ pos += len;
+ }
+ }
+}
+
+static void
+Write(int verb, const char *f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ VWrite(verb, f, args);
+ va_end(args);
+}
+
+/* Print driver messages in the standard format */
+
+void
+xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ va_list args)
+{
+ char *s = X_UNKNOWN_STRING;
+
+ /* Ignore verbosity for X_ERROR */
+ if (xf86Verbose >= verb || xf86LogVerbose >= verb || type == X_ERROR) {
+ switch (type) {
+ case X_PROBED:
+ s = X_PROBE_STRING;
+ break;
+ case X_CONFIG:
+ s = X_CONFIG_STRING;
+ break;
+ case X_DEFAULT:
+ s = X_DEFAULT_STRING;
+ break;
+ case X_CMDLINE:
+ s = X_CMDLINE_STRING;
+ break;
+ case X_NOTICE:
+ s = X_NOTICE_STRING;
+ break;
+ case X_ERROR:
+ s = X_ERROR_STRING;
+ if (verb > 0)
+ verb = 0;
+ break;
+ case X_WARNING:
+ s = X_WARNING_STRING;
+ break;
+ case X_INFO:
+ s = X_INFO_STRING;
+ break;
+ case X_NONE:
+ s = NULL;
+ break;
+ }
+
+ if (s != NULL)
+ Write(verb, "%s ", s);
+ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens)
+ Write(verb, "%s(%d): ", xf86Screens[scrnIndex]->name, scrnIndex);
+ VWrite(verb, format, args);
+#if 0
+ if (type == X_ERROR && xf86Verbose < xf86LogVerbose) {
+ fprintf(stderr, X_ERROR_STRING " Please check the log file \"%s\""
+ " >before<\n\treporting a problem.\n", xf86LogFile);
+ }
+#endif
+ }
+}
+
+/* Print driver messages, with verbose level specified directly */
+void
+xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print driver messages, with verbose level of 1 (default) */
+void
+xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Print non-driver messages with verbose level specified directly */
+void
+xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(-1, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print non-driver messages with verbose level of 1 (default) */
+void
+xf86Msg(MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(-1, type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Just like ErrorF, but with the verbose level checked */
+void
+xf86ErrorFVerb(int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= verb || xf86LogVerbose >= verb)
+ VWrite(verb, format, ap);
+ va_end(ap);
+}
+
+/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */
+void
+xf86ErrorF(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
+ VWrite(1, format, ap);
+ va_end(ap);
+}
+
+void
+OsVendorVErrorF(const char *f, va_list args)
+{
+ VWrite(-1, f, args);
+}
+
+void
+xf86LogInit()
+{
+#ifndef __EMX__
+ char *lf;
+
+#define LOGSUFFIX ".log"
+
+ /* Get the log file name */
+ if (xf86LogFileFrom == X_DEFAULT) {
+ /* Append the display number and ".log" */
+ lf = malloc(strlen(xf86LogFile) + strlen(display) +
+ strlen(LOGSUFFIX) + 1);
+ if (!lf)
+ FatalError("Cannot allocate space for the log file name\n");
+ sprintf(lf, "%s%s" LOGSUFFIX, xf86LogFile, display);
+ xf86LogFile = lf;
+ }
+ if ((logfile = fopen(xf86LogFile, "w")) == NULL)
+ FatalError("Cannot open log file \"%s\"\n", xf86LogFile);
+ setvbuf(logfile, NULL, _IONBF, 0);
+ if (!OsVendorVErrorFProc)
+ OsVendorVErrorFProc = OsVendorVErrorF;
+
+ /* Flush saved log information */
+ if (saveBuffer && size > 0) {
+ fwrite(saveBuffer, pos, 1, logfile);
+ free(saveBuffer); /* Note, must be free(), not xfree() */
+ saveBuffer = 0;
+ size = 0;
+ }
+
+#undef LOGSUFFIX
+#else /* __EMX__ */
+ xf86LogFile = NULL;
+#endif /* __EMX__ */
+}
+
+void
+xf86CloseLog()
+{
+ if (logfile) {
+ fclose(logfile);
+ logfile = NULL;
+ }
+}
+
+
+/*
+ * Drivers can use these for using their own SymTabRecs.
+ */
+
+const char *
+xf86TokenToString(SymTabPtr table, int token)
+{
+ int i;
+
+ for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
+ ;
+
+ if (table[i].token < 0)
+ return NULL;
+ else
+ return(table[i].name);
+}
+
+int
+xf86StringToToken(SymTabPtr table, const char *string)
+{
+ int i;
+
+ if (string == NULL)
+ return -1;
+
+ for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++)
+ ;
+
+ return(table[i].token);
+}
+
+/*
+ * helper to display the clocks found on a card
+ */
+void
+xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
+{
+ int j;
+
+ xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:");
+ for (j=0; j < scrp->numClocks; j++) {
+ if ((j % 4) == 0) {
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
+ }
+ xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0);
+ }
+ xf86ErrorF("\n");
+}
+
+
+/*
+ * This prints out the driver identify message, including the names of
+ * the supported chipsets.
+ *
+ * XXX This makes assumptions about the line width, etc. Maybe we could
+ * use a more general "pretty print" function for messages.
+ */
+void
+xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
+{
+ int len, i;
+
+ len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
+ xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
+ for (i = 0; chips[i].name != NULL; i++) {
+ if (i != 0) {
+ xf86ErrorF(",");
+ len++;
+ }
+ if (len + 2 + strlen(chips[i].name) < 78) {
+ xf86ErrorF(" ");
+ len++;
+ } else {
+ xf86ErrorF("\n\t");
+ len = 8;
+ }
+ xf86ErrorF("%s", chips[i].name);
+ len += strlen(chips[i].name);
+ }
+ xf86ErrorF("\n");
+}
+
+
+#define MAXDRIVERS 64 /* A >hack<, to be sure ... */
+
+
+int
+xf86MatchDevice(const char *drivername, GDevPtr **driversectlist)
+{
+ static char * drivernames[MAXDRIVERS];
+ static GDevPtr * devices[MAXDRIVERS];
+ static int count[MAXDRIVERS];
+ confScreenPtr screensecptr;
+ int i,j;
+
+ /*
+ * This is a very important function that matches the device sections
+ * as they show up in the config file with the drivers that the server
+ * loads at run time.
+
+ * ChipProbe can call
+ * int xf86MatchDevice(char * drivername, GDevPtr * driversectlist)
+ * with its driver name. The function allocates an array of GDevPtr and
+ * returns this via driversectlist and returns the number of elements in
+ * this list as return value. 0 means none found, -1 means fatal error.
+ *
+ * It can figure out which of the Device sections to use for which card
+ * (using things like the Card statement, etc). For single headed servers
+ * there will of course be just one such Device section.
+ *
+ * If there's no Device section with matching name, then xf86MatchDevice()
+ * returns the first Device section without a Driver statement. This will
+ * again work out ok in a single headed environment.
+ */
+ /*
+ * in order to be able to access the results of these queries again, we
+ * keep two parallel static arrays, one holding the name of the driver,
+ * the other holding the coresponding Device section pointers.
+ * So first, we need to check if the query has already been answered
+ * and simply return that old answer if this is the case.
+ */
+ i = 0;
+ while (drivernames[i] && i < MAXDRIVERS) {
+ if (xf86NameCmp(drivername,drivernames[i]) == 0) {
+ /*
+ * we already had that one
+ */
+ *driversectlist = devices[i];
+ return count[i];
+ }
+ i++;
+ }
+
+ if (i == MAXDRIVERS)
+ return -1;
+
+ /*
+ * if we get here, this is a new name
+ */
+ drivernames[i] = xstrdup(drivername);
+ count[i] = 0;
+
+ /*
+ * first we need to loop over all the Screens sections to get to all
+ * 'active' device sections
+ */
+ for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
+ screensecptr = xf86ConfigLayout.screens[j].screen;
+ if ((screensecptr->device->driver != NULL)
+ && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a matching driver that wasn't claimed, yet
+ */
+ screensecptr->device->claimed = TRUE;
+ devices[i] = xnfrealloc(devices[i],
+ (count[i] + 2) * sizeof(GDevPtr));
+ devices[i][count[i]++] = screensecptr->device;
+ }
+ }
+#if 0
+ /*
+ * XXX The parser won't let devices with no Driver name through, so
+ * this can be removed.
+ */
+ if (count[i] == 0) {
+ /*
+ * we haven't found a single one, let's try to find one that
+ * wasn't claimed and has no driver given
+ */
+ for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
+ screensecptr = xf86ConfigLayout.screens[j].screen;
+ if ((screensecptr->device->driver == NULL)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a device section without driver that wasn't claimed
+ */
+ screensecptr->device->claimed = TRUE;
+ devices[i] = xnfrealloc(devices[i],
+ (count[i] + 2) * sizeof(GDevPtr));
+ devices[i][count[i]++] = screensecptr->device;
+ }
+ }
+ }
+#endif
+ /*
+ * make the array NULL terminated and return its address
+ */
+ if( count[i] )
+ devices[i][count[i]] = NULL;
+ else
+ devices[i] = NULL;
+
+ *driversectlist = devices[i];
+
+ return count[i];
+}
+
+#define DEBUG
+struct Inst {
+ pciVideoPtr pci;
+ GDevPtr dev;
+ Bool foundHW; /* PCIid in list of supported chipsets */
+ Bool claimed; /* BusID matches with a device section */
+ int chip;
+};
+
+int
+xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
+{
+ int i,j;
+ MessageType from;
+ pciVideoPtr pPci, *ppPci;
+ struct Inst {
+ pciVideoPtr pci;
+ GDevPtr dev;
+ Bool foundHW; /* PCIid in list of supported chipsets */
+ Bool claimed; /* BusID matches with a device section */
+ int chip;
+ } *instances = NULL;
+ int numClaimedInstances = 0;
+ int allocatedInstances = 0;
+ int numFound = 0;
+ SymTabRec *c;
+ PciChipsets *id;
+ GDevPtr devBus = NULL;
+ GDevPtr dev = NULL;
+ int *retEntities = NULL;
+
+ if (vendorID == 0) {
+ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ for (id = PCIchipsets; id->PCIid != -1; id++) {
+ if ( (((id->PCIid & 0xFFFF0000) >> 16) == (*ppPci)->vendor) &&
+ ((id->PCIid & 0x0000FFFF) == (*ppPci)->chipType)){
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].pci = *ppPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ instances[allocatedInstances - 1].chip = id->numChipset;
+ }
+ }
+ }
+ } else if (vendorID == PCI_VENDOR_GENERIC) {
+ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ for (id = PCIchipsets; id->PCIid != -1; id++) {
+ if (id->PCIid == xf86CheckPciGAType(*ppPci)) {
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].pci = *ppPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ instances[allocatedInstances - 1].chip = id->numChipset;
+ }
+ }
+ }
+ } else {
+ /* Find PCI devices that match the given vendor ID */
+
+ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
+ if ((*ppPci)->vendor == vendorID) {
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].pci = *ppPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = FALSE;
+
+ /* Check if the chip type is listed in the chipsets table */
+ for (id = PCIchipsets; id->PCIid != -1; id++) {
+ if (id->PCIid == (*ppPci)->chipType) {
+ instances[allocatedInstances - 1].chip
+ = id->numChipset;
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ /*
+ * This may be debatable, but if no PCI devices with a matching vendor
+ * type is found, return zero now. It is probably not desirable to
+ * allow the config file to override this.
+ */
+ if (allocatedInstances <= 0) {
+ xfree(instances);
+ return 0;
+ }
+#ifdef DEBUG
+ ErrorF("%s instances found: %d\n", driverName, numClaimedInstances);
+#endif
+
+ for (i = 0; i < allocatedInstances; i++) {
+ pPci = instances[i].pci;
+ devBus = NULL;
+ dev = NULL;
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86ComparePciBusString(devList[j]->busID, pPci->bus,
+ pPci->device,
+ pPci->func)) {
+ if (devBus)
+ xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device section for "
+ "instance (BusID: %s) found: %s\n",
+ driverName,devList[j]->identifier,
+ devList[j]->busID);
+ else
+ devBus = devList[j];
+ }
+ } else {
+ /*
+ * if device section without BusID is found
+ * only assign to it to the primary device.
+ */
+ if (xf86IsPrimaryPci(pPci)) {
+ xf86Msg(X_PROBED, "Assigning device section with no busID"
+ " to primary device\n");
+ if (dev || devBus)
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", devList[j]->identifier);
+ else
+ dev = devList[j];
+ }
+ }
+ }
+ if (devBus) dev = devBus; /* busID preferred */
+ if (!dev) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID PCI:%i:%i:%i) found\n",
+ driverName, pPci->bus, pPci->device, pPci->func);
+ } else {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
+ }
+ /*
+ * Now check that a chipset or chipID override in the device section
+ * is valid. Chipset has precedence over chipID.
+ * If chipset is not valid ignore BusSlot completely.
+ */
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+ if (!instances[i].claimed) {
+ continue;
+ }
+ from = X_PROBED;
+ if (instances[i].dev->chipset) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0)
+ break;
+ }
+ if (c->token == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ } else {
+ instances[i].chip = c->token;
+
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->numChipset == instances[i].chip)
+ break;
+ }
+ if(id->numChipset >=0){
+ xf86Msg(X_CONFIG,"Chipset override: %s\n",
+ instances[i].dev->chipset);
+ from = X_CONFIG;
+ } else {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't a valid PCI chipset\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ }
+ }
+ } else if (instances[i].dev->chipID > 0) {
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->PCIid == instances[i].dev->chipID)
+ break;
+ }
+ if (id->numChipset == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipID,
+ instances[i].dev->identifier);
+ } else {
+ instances[i].chip = id->numChipset;
+
+ xf86Msg( X_CONFIG,"ChipID override: 0x%04X\n",
+ instances[i].dev->chipID);
+ from = X_CONFIG;
+ }
+ } else if (!instances[i].foundHW) {
+ /*
+ * This means that there was no override and the PCI chipType
+ * doesn't match one that is supported
+ */
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ }
+ if (instances[i].claimed == TRUE){
+ for (c = chipsets; c->token >= 0; c++) {
+ if (c->token == instances[i].chip)
+ break;
+ }
+ xf86Msg(from,"Chipset %s found\n",
+ c->name);
+ }
+ }
+
+ /*
+ * Of the claimed instances, check that another driver hasn't already
+ * claimed its slot.
+ */
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+
+ if (!instances[i].claimed)
+ continue;
+ pPci = instances[i].pci;
+ if (!xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func))
+ continue;
+
+#ifdef DEBUG
+ ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ driverName, pPci->bus, pPci->device, pPci->func);
+#endif
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1]
+ = xf86ClaimPciSlot(pPci->bus, pPci->device,
+ pPci->func,drvp, instances[i].chip,
+ instances[i].dev,instances[i].dev->active ?
+ TRUE : FALSE);
+
+ }
+ xfree(instances);
+ if (numFound > 0) {
+ *foundEntities = retEntities;
+ }
+ return numFound;
+}
+
+int
+xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities)
+{
+ SymTabRec *c;
+ IsaChipsets *Chips;
+ int i;
+ int numFound = 0;
+ int *retEntities = NULL;
+
+ for (i = 0; i < numDevs; i++) {
+ MessageType from = X_CONFIG;
+ GDevPtr dev = NULL;
+ GDevPtr devBus = NULL;
+ int foundChip = -1;
+
+ if (devList[i]->busID && *devList[i]->busID) {
+ if (xf86ParseIsaBusString(devList[i]->busID)) {
+ if (devBus) xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device "
+ "section for ISA-Bus found: %s\n",
+ driverName,devList[i]->identifier);
+ else devBus = devList[i];
+ }
+ } else {
+ if (xf86IsPrimaryIsa()) {
+ if (dev) xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching "
+ "Device section found: %s\n",
+ driverName,devList[i]->identifier);
+ else dev = devList[i];
+ }
+ }
+ if (devBus) dev = devBus;
+ if (dev) {
+ if (dev->chipset) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (xf86NameCmp(c->name, dev->chipset) == 0)
+ break;
+ }
+ if (c->token == -1) {
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, dev->chipset,
+ dev->identifier);
+ } else
+ foundChip = c->token;
+ } else {
+ if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev);
+ /* Probe it */
+ from = X_PROBED;
+ }
+ }
+
+/* Check if the chip type is listed in the chipset table - for sanity*/
+
+ if (foundChip >= 0){
+ for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) {
+ if (Chips->numChipset == foundChip)
+ break;
+ }
+ if (Chips->numChipset == -1){
+ foundChip = -1;
+ xf86MsgVerb(X_WARNING,0,
+ "%s: Driver detected unknown ISA-Bus Chipset\n",
+ driverName);
+ }
+ }
+ if (foundChip != -1) {
+ numFound++;
+ retEntities = xnfrealloc(retEntities,numFound * sizeof(int));
+ retEntities[numFound - 1] =
+ xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE);
+ for (c = chipsets; c->token >= 0; c++) {
+ if (c->token == foundChip)
+ break;
+ }
+ xf86Msg(from, "Chipset %s found\n", c->name);
+ }
+ }
+ *foundEntities = retEntities;
+
+ return numFound;
+}
+
+/*
+ * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
+ */
+void
+xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg,
+ int maskval, int knownclkindex, int knownclkvalue)
+{
+ register int status = vertsyncreg;
+ unsigned long i, cnt, rcnt, sync;
+ int saved_nice;
+
+ /* First save registers that get written on */
+ (*ClockFunc)(pScrn, CLK_REG_SAVE);
+
+#if defined(CSRG_BASED) || defined(MACH386)
+ saved_nice = getpriority(PRIO_PROCESS, 0);
+ setpriority(PRIO_PROCESS, 0, -20);
+#endif
+#if defined(SYSV) || defined(SVR4) || defined(linux)
+ saved_nice = nice(0);
+ nice(-20 - saved_nice);
+#endif
+
+ if (num > MAXCLOCKS)
+ num = MAXCLOCKS;
+
+ for (i = 0; i < num; i++)
+ {
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, TRUE);
+ if (!(*ClockFunc)(pScrn, i))
+ {
+ pScrn->clock[i] = -1;
+ continue;
+ }
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, FALSE);
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, FALSE);
+
+ usleep(50000); /* let VCO stabilise */
+
+ cnt = 0;
+ sync = 200000;
+
+ /* XXX How critical is this? */
+ if (!xf86DisableInterrupts())
+ {
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+ ErrorF("Failed to disable interrupts during clock probe. If\n");
+ ErrorF("your OS does not support disabling interrupts, then you\n");
+ FatalError("must specify a Clocks line in the XF86Config file.\n");
+ }
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == maskval)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+
+ for (rcnt = 0; rcnt < 5; rcnt++)
+ {
+ while (!(inb(status) & maskval))
+ cnt++;
+ while ((inb(status) & maskval))
+ cnt++;
+ }
+
+finish:
+ xf86EnableInterrupts();
+
+ pScrn->clock[i] = cnt ? cnt : -1;
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, TRUE);
+ }
+
+#if defined(CSRG_BASED) || defined(MACH386)
+ setpriority(PRIO_PROCESS, 0, saved_nice);
+#endif
+#if defined(SYSV) || defined(SVR4) || defined(linux)
+ nice(20 + saved_nice);
+#endif
+
+ for (i = 0; i < num; i++)
+ {
+ if (i != knownclkindex)
+ {
+ if (pScrn->clock[i] == -1)
+ {
+ pScrn->clock[i] = 0;
+ }
+ else
+ {
+ pScrn->clock[i] = (int)(0.5 +
+ (((float)knownclkvalue) * pScrn->clock[knownclkindex]) /
+ (pScrn->clock[i]));
+ /* Round to nearest 10KHz */
+ pScrn->clock[i] += 5;
+ pScrn->clock[i] /= 10;
+ pScrn->clock[i] *= 10;
+ }
+ }
+ }
+
+ pScrn->clock[knownclkindex] = knownclkvalue;
+ pScrn->numClocks = num;
+
+ /* Restore registers that were written on */
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+}
+const char *
+xf86GetVisualName(int visual)
+{
+ if (visual < 0 || visual > DirectColor)
+ return NULL;
+
+ return xf86VisualNames[visual];
+}
+
+
+int
+xf86GetVerbosity()
+{
+ return max(xf86Verbose, xf86LogVerbose);
+}
+
+
+Pix24Flags
+xf86GetPix24()
+{
+ return xf86Info.pixmap24;
+}
+
+
+int
+xf86GetDepth()
+{
+ return xf86Depth;
+}
+
+
+rgb
+xf86GetWeight()
+{
+ return xf86Weight;
+}
+
+
+Gamma
+xf86GetGamma()
+{
+ return xf86Gamma;
+}
+
+
+Bool
+xf86GetFlipPixels()
+{
+ return xf86FlipPixels;
+}
+
+
+const char *
+xf86GetServerName()
+{
+ return xf86ServerName;
+}
+
+
+Bool
+xf86ServerIsExiting()
+{
+ return xf86Exiting;
+}
+
+
+Bool
+xf86ServerIsResetting()
+{
+ return xf86Resetting;
+}
+
+
+Bool
+xf86ServerIsInitialising()
+{
+ return xf86Initialising;
+}
+
+
+Bool
+xf86ServerIsOnlyProbing(void)
+{
+ return xf86ProbeOnly;
+}
+
+
+Bool
+xf86CaughtSignal()
+{
+ return xf86Info.caughtSignal;
+}
+
+
+Bool
+xf86GetVidModeAllowNonLocal()
+{
+ return xf86Info.vidModeAllowNonLocal;
+}
+
+
+Bool
+xf86GetVidModeEnabled()
+{
+ return xf86Info.vidModeEnabled;
+}
+
+Bool
+xf86GetModInDevAllowNonLocal()
+{
+ return xf86Info.miscModInDevAllowNonLocal;
+}
+
+
+Bool
+xf86GetModInDevEnabled()
+{
+ return xf86Info.miscModInDevEnabled;
+}
+
+
+Bool
+xf86GetAllowMouseOpenFail()
+{
+ return xf86Info.allowMouseOpenFail;
+}
+
+
+Bool
+xf86IsPc98()
+{
+#if defined(i386) || defined(__i386__)
+ return xf86Info.pc98;
+#else
+ return FALSE;
+#endif
+}
+
+
+pointer
+xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
+{
+#ifdef XFree86LOADER
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
+ return ret;
+#else
+ return (pointer)1;
+#endif
+}
+
+void
+xf86LoaderReqSymLists(const char **list0, ...)
+{
+#ifdef XFree86LOADER
+ va_list ap;
+
+ va_start(ap, list0);
+ LoaderVReqSymLists(list0, ap);
+ va_end(ap);
+#endif
+}
+
+void
+xf86LoaderReqSymbols(const char *sym0, ...)
+{
+#ifdef XFree86LOADER
+ va_list ap;
+
+ va_start(ap, sym0);
+ LoaderVReqSymbols(sym0, ap);
+ va_end(ap);
+#endif
+}
+
+void xf86Break1(void)
+{
+}
+
+void xf86Break2(void)
+{
+}
+
+void xf86Break3(void)
+{
+}
+
+
+typedef enum {
+ OPTION_BACKING_STORE
+} BSOpts;
+
+static OptionInfoRec BSOptions[] = {
+ { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+void
+xf86SetBackingStore(ScreenPtr pScreen)
+{
+ Bool useBS = FALSE;
+ MessageType from = X_DEFAULT;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, BSOptions);
+
+ /* check for commandline option here */
+ if (xf86bsEnableFlag) {
+ from = X_CMDLINE;
+ useBS = TRUE;
+ } else if (xf86bsDisableFlag) {
+ from = X_CMDLINE;
+ useBS = FALSE;
+ } else {
+ if (xf86GetOptValBool(BSOptions, OPTION_BACKING_STORE, &useBS))
+ from = X_CONFIG;
+ }
+ pScreen->backingStoreSupport = useBS ? Always : NotUseful;
+ if (serverGeneration == 1)
+ xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
+ useBS ? "enabled" : "disabled");
+}
+
+
+/* Wrote this function for the PM2 Xv driver, preliminary. */
+
+pointer
+xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ confXvAdaptorPtr adaptor;
+ int i;
+
+ if (adaptor_index >= pScrn->confScreen->numxvadaptors) {
+ if (adaptor_name) *adaptor_name = NULL;
+ if (adaptor_options) *adaptor_options = NULL;
+ return NULL;
+ }
+
+ adaptor = &pScrn->confScreen->xvadaptors[adaptor_index];
+ if (adaptor_name) *adaptor_name = adaptor->identifier;
+ if (adaptor_options) *adaptor_options = adaptor->options;
+
+ for (i = 0; i < adaptor->numports; i++)
+ if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
+ return adaptor->ports[i].options;
+
+ return NULL;
+}
+
+/* Rather than duplicate loader's get OS function, just include it directly */
+#define LoaderGetOS xf86GetOS
+#include "loader/os.c"
+
+/* new RAC */
+/*
+ * xf86ConfigActiveIsa/PciEntity() -- These helper functions assign an
+ * active entity to a screen, registers its fixed resources, assign
+ * special enter/leave functions and their private scratch area to
+ * this entity, take the dog for a walk...
+ */
+Bool
+xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+ IsaChipsets *i_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ IsaChipsets *i_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+
+ if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) {
+ xfree(pEnt);
+ return FALSE;
+ }
+
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ if (i_chip) {
+ for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
+ if (pEnt->chipset == i_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(i_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+ xf86ClaimFixedResources(res,entityIndex);
+ if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+ PciChipsets *p_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ PciChipsets *p_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+
+ if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
+ xfree(pEnt);
+ return FALSE;
+ }
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ if (p_chip) {
+ for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
+ if (pEnt->chipset == p_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(p_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+
+ xf86ClaimFixedResources(res,entityIndex);
+ if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * xf86ConfigPci/IsaEntityInactive() -- These functions can be used
+ * to configure an inactive entity as well as to reconfigure an
+ * previously active entity inactive. If the entity has been
+ * assigned to a screen before it will be removed. If p_pci(p_isa) is
+ * non-NULL all static resources listed there will be registered.
+ */
+void
+xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ resList res, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ PciChipsets *p_id;
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ else if (p_chip) {
+ for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
+ if (pEnt->chipset == p_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(p_id->resList,pEnt->index);
+ }
+ xf86ClaimFixedResources(res,pEnt->index);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+void
+xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
+ resList res, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ IsaChipsets *i_id;
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ else if (i_chip) {
+ for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
+ if (pEnt->chipset == i_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(i_id->resList,pEnt->index);
+ }
+ xf86ClaimFixedResources(res,pEnt->index);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+Bool
+xf86IsScreenPrimary(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ int i;
+
+ for (i=0 ; i < pScrn->numEntities; i++) {
+ if (xf86IsEntityPrimary(i))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h b/xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h
new file mode 100644
index 000000000..5cd66d882
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h
@@ -0,0 +1,17 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h,v 1.4 1999/05/17 13:17:14 dawes Exp $ */
+
+#ifndef _xf86InPriv_h
+#define _xf86InPriv_h
+
+/* xf86Globals.c */
+#ifdef XFree86LOADER
+extern InputDriverPtr *xf86InputDriverList;
+#else
+extern InputDriverPtr xf86InputDriverList[];
+#endif
+extern int xf86NumInputDrivers;
+
+/* xf86Xinput.c */
+void xf86ActivateDevice(InputInfoPtr pInfo);
+
+#endif /* _xf86InPriv_h */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c
new file mode 100644
index 000000000..2e222b1fd
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c
@@ -0,0 +1,1584 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.134 1999/08/28 09:00:52 dawes Exp $ */
+
+/*
+ * Copyright 1991-1999 by The XFree86 Project, Inc.
+ *
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ */
+
+#ifndef X_NOT_STDC_ENV
+#include <stdlib.h>
+#else
+extern int atoi();
+#endif
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xmd.h"
+#include "Xproto.h"
+#include "input.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "site.h"
+
+#include "compiler.h"
+
+#ifdef XFree86LOADER
+#include "loaderProcs.h"
+#endif
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#define XF86_OS_PRIVS
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Config.h"
+#include "xf86_OSlib.h"
+#include "xf86Version.h"
+#include "mipointer.h"
+
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#else
+#include "inputstr.h"
+#endif
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+
+#include "globals.h"
+
+#ifdef XTESTEXT1
+#include "atKeynames.h"
+extern int xtest_command_key;
+#endif /* XTESTEXT1 */
+
+
+/* forward declarations */
+
+static void xf86PrintBanner(void);
+static void xf86RunVtInit(void);
+
+#ifdef DO_CHECK_BETA
+static int extraDays = 0;
+static char *expKey = NULL;
+#endif
+
+#ifdef __EMX__
+extern void os2ServerVideoAccess();
+#endif
+
+#ifdef XFree86LOADER
+static char *baseModules[] = {
+ "bitmap",
+ "pcidata",
+ NULL
+};
+#endif
+
+/* Common pixmap formats */
+
+static PixmapFormatRec formats[MAXFORMATS] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD }
+};
+static int numFormats = 6;
+static Bool formatsDone = FALSE;
+
+#ifdef NEW_INPUT
+InputDriverRec xf86KEYBOARD = {
+ 1,
+ "keyboard",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0
+};
+#undef MOUSE
+extern InputDriverRec MOUSE;
+#endif
+
+/*
+ * InitOutput --
+ * Initialize screenInfo for all actually accessible framebuffers.
+ * That includes vt-manager setup, querying all possible devices and
+ * collecting the pixmap formats.
+ */
+
+void
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ int i, j, k, scr_index;
+ static unsigned long generation = 0;
+#ifdef XFree86LOADER
+ char **modulelist;
+ pointer *optionlist;
+#endif
+ screenLayoutPtr layout;
+ Pix24Flags screenpix24, pix24;
+ MessageType pix24From = X_DEFAULT;
+ Bool pix24Fail = FALSE;
+
+#ifdef __EMX__
+ os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */
+#endif
+
+ xf86Initialising = TRUE;
+
+ /* Do this early? */
+ if (generation != serverGeneration) {
+ xf86ScreenIndex = AllocateScreenPrivateIndex();
+ xf86PixmapIndex = AllocatePixmapPrivateIndex();
+ generation = serverGeneration;
+ }
+
+ if (serverGeneration == 1) {
+
+ pScreenInfo->numScreens = 0;
+
+ if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
+ xf86ServerName++;
+ else
+ xf86ServerName = argv[0];
+
+#ifdef DO_CHECK_BETA
+ xf86CheckBeta(extraDays, expKey);
+#endif
+
+ xf86PrintBanner();
+ {
+ time_t t;
+ const char *ct;
+ t = time(NULL);
+ ct = ctime(&t);
+ if (xf86LogFile)
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
+
+ /* Read and parse the config file */
+ if (!xf86HandleConfigFile()) {
+ xf86Msg(X_ERROR, "Error from xf86HandleConfigFile()\n");
+ return;
+ }
+
+ /*
+ * Install signal handler for unexpected signals
+ */
+ xf86Info.caughtSignal=FALSE;
+ if (!xf86Info.notrapSignals) {
+ signal(SIGSEGV,xf86SigHandler);
+ signal(SIGILL,xf86SigHandler);
+#ifdef SIGEMT
+ signal(SIGEMT,xf86SigHandler);
+#endif
+ signal(SIGFPE,xf86SigHandler);
+#ifdef SIGBUS
+ signal(SIGBUS,xf86SigHandler);
+#endif
+#ifdef SIGSYS
+ signal(SIGSYS,xf86SigHandler);
+#endif
+#ifdef SIGXCPU
+ signal(SIGXCPU,xf86SigHandler);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ,xf86SigHandler);
+#endif
+ }
+
+ xf86OpenConsole();
+
+ /* Run an external VT Init program if specified in the config file */
+ xf86RunVtInit();
+
+ /* Do this after XF86Config is read (it's normally in OsInit()) */
+ OsInitColors();
+
+ /* Enable full I/O access */
+ xf86EnableIO();
+
+#ifdef XFree86LOADER
+ /* Initialise the loader */
+ LoaderInit();
+
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
+
+#ifdef TESTING
+ {
+ char **list, **l;
+ const char *subdirs[] = {
+ "drivers",
+ NULL
+ };
+ const char *patlist[] = {
+ "(.*)_drv\\.so",
+ "(.*)_drv\\.o",
+ NULL
+ };
+ ErrorF("Getting module listing...\n");
+ list = LoaderListDirs(NULL, NULL);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("module: %s\n", *l);
+ LoaderFreeDirList(list);
+ ErrorF("Getting video driver listing...\n");
+ list = LoaderListDirs(subdirs, NULL);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("video driver: %s\n", *l);
+ LoaderFreeDirList(list);
+ ErrorF("Getting driver listing...\n");
+ list = LoaderListDirs(NULL, patlist);
+ if (list)
+ for (l = list; *l; l++)
+ ErrorF("video driver: %s\n", *l);
+ LoaderFreeDirList(list);
+ }
+#endif
+
+ /* Force load mandatory base modules */
+ if (!xf86LoadModules(baseModules, NULL))
+ FatalError("Unable to load required base modules, Exiting...\n");
+
+#endif
+
+ /* Do a general bus probe. This will be a PCI probe for x86 platforms */
+ xf86BusProbe();
+
+ /* Initialise the resource broker */
+ xf86ResourceBrokerInit();
+
+#ifdef XFree86LOADER
+ /* Load all modules specified explicitly in the config file */
+ if ((modulelist = xf86ModulelistFromConfig(&optionlist)))
+ xf86LoadModules(modulelist, optionlist);
+
+ /* Load all driver modules specified in the config file */
+ if ((modulelist = xf86DriverlistFromConfig()))
+ xf86LoadModules(modulelist, NULL);
+
+#ifdef NEW_INPUT
+ /* Setup the builtin input drivers */
+ xf86AddInputDriver(&xf86KEYBOARD, NULL, 0);
+ xf86AddInputDriver(&MOUSE, NULL, 0);
+#endif
+ /* Load all input driver modules specified in the config file. */
+ if ((modulelist = xf86InputDriverlistFromConfig()))
+ xf86LoadModules(modulelist, NULL);
+
+ /*
+ * It is expected that xf86AddDriver()/xf86AddInputDriver will be
+ * called for each driver as it is loaded. Those functions save the
+ * module pointers for drivers.
+ * XXX Nothing keeps track of them for other modules.
+ */
+ /* XXX What do we do if not all of these could be loaded? */
+#endif
+
+ /*
+ * At this point, xf86DriverList[] is all filled in with entries for
+ * each of the drivers to try and xf86NumDrivers has the number of
+ * drivers. If there are none, return now.
+ */
+
+ if (xf86NumDrivers == 0) {
+ xf86Msg(X_ERROR, "No drivers available.\n");
+ return;
+ }
+
+ /*
+ * Call each of the Identify functions. The Identify functions print
+ * out some identifying information, and anything else that might be
+ * needed at this early stage.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++)
+ /* The Identify function is mandatory, but if it isn't there continue */
+ if (xf86DriverList[i]->Identify != NULL)
+ xf86DriverList[i]->Identify(0);
+ else {
+ xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
+ xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
+ : "noname");
+ }
+
+ /*
+ * Locate bus slot that had register IO enabled at server startup
+ */
+
+ xf86AccessInit();
+ xf86FindPrimaryDevice();
+
+ /*
+ * Now call each of the Probe functions. Each successful probe will
+ * result in an extra entry added to the xf86Screens[] list for each
+ * instance of the hardware found.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++) {
+ if (xf86DriverList[i]->Probe != NULL)
+ xf86DriverList[i]->Probe(xf86DriverList[i], 0);
+ else {
+ xf86MsgVerb(X_WARNING, 0,
+ "Driver `%s' has no Probe function (ignoring)\n",
+ xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
+ : "noname");
+ }
+ xf86SetPciVideo(NULL,NONE);
+ }
+
+ /*
+ * If nothing was detected, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "No devices detected.\n");
+ return;
+ }
+
+ /*
+ * Match up the screens found by the probes against those specified
+ * in the config file. Remove the ones that won't be used. Sort
+ * them in the order specified.
+ */
+
+ /*
+ * What is the best way to do this?
+ *
+ * For now, go through the screens allocated by the probes, and
+ * look for screen config entry which refers to the same device
+ * section as picked out by the probe.
+ *
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
+ layout++) {
+ Bool found = FALSE;
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ EntityInfoPtr pEnt =
+ xf86GetEntityInfo(xf86Screens[i]->entityList[j]);
+ if (pEnt->device == layout->screen->device) {
+ /* A match has been found */
+ xf86Screens[i]->confScreen = layout->screen;
+ found = TRUE;
+ xfree(pEnt);
+ break;
+ }
+ xfree(pEnt);
+ }
+ if (found) break;
+ }
+ if (layout->screen == NULL) {
+ /* No match found */
+ xf86Msg(X_ERROR,
+ "Screen %d deleted because of no matching config section.\n", i);
+ xf86DeleteScreen(i--, 0);
+ }
+ }
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Device(s) detected, but none match those in the config file.\n");
+ return;
+ }
+
+ xf86PostProbe();
+ xf86EntityInit();
+
+ /*
+ * Sort the drivers to match the requested ording. Using a slow
+ * bubble sort.
+ */
+ for (j = 0; j < xf86NumScreens - 1; j++) {
+ for (i = 0; i < xf86NumScreens - j - 1; i++) {
+ if (xf86Screens[i + 1]->confScreen->screennum <
+ xf86Screens[i]->confScreen->screennum) {
+ ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
+ xf86Screens[i + 1] = xf86Screens[i];
+ xf86Screens[i] = tmpScrn;
+ }
+ }
+ }
+ /* Fix up the indexes */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->scrnIndex = i;
+ }
+
+ /*
+ * Prune the set of monitor modes for each monitor that is referenced
+ * by a screen section.
+ *
+ * XXX Probably best to do this here than elsewhere?
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86PruneMonitorModes(xf86Screens[i]->confScreen->monitor);
+ }
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->PreInit &&
+ xf86Screens[i]->PreInit(xf86Screens[i], 0))
+ xf86Screens[i]->configured = TRUE;
+ }
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86Screens[i]->configured)
+ xf86DeleteScreen(i--, 0);
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Screen(s) found, but none have a usable configuration.\n");
+ return;
+ }
+
+ /* This could be moved into a separate function */
+
+ /*
+ * Check that all screens have initialised the mandatory function
+ * entry points. Delete those which have not.
+ */
+
+#define WARN_SCREEN(func) \
+ xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \
+ xf86Screens[i]->name, (warned++, func))
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ int warned = 0;
+ if (xf86Screens[i]->name == NULL) {
+ xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1);
+ if (i < 10)
+ sprintf(xf86Screens[i]->name, "screen%c", i + '0');
+ else
+ sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A');
+ xf86MsgVerb(X_WARNING, 0,
+ "Screen driver %d has no name set, using `%s'.\n",
+ i, xf86Screens[i]->name);
+ }
+ if (xf86Screens[i]->ScreenInit == NULL)
+ WARN_SCREEN("ScreenInit");
+ if (xf86Screens[i]->EnterVT == NULL)
+ WARN_SCREEN("EnterVT");
+ if (xf86Screens[i]->LeaveVT == NULL)
+ WARN_SCREEN("LeaveVT");
+ if (warned)
+ xf86DeleteScreen(i--, 0);
+ }
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n");
+ return;
+ }
+
+ /* XXX Should this be before or after loading dependent modules? */
+ if (xf86ProbeOnly)
+ {
+ OsCleanup();
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+ }
+
+#ifdef XFree86LOADER
+ /* Remove (unload) drivers that are not required */
+ for (i = 0; i < xf86NumDrivers; i++)
+ if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+ xf86DeleteDriver(i);
+#endif
+
+#ifdef XFree86LOADER
+ if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) {
+ /* For now, just a warning */
+ xf86Msg(X_WARNING, "Some symbols could not be resolved!\n");
+ }
+#endif
+
+ /*
+ * At this stage we know how many screens there are.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86InitViewport(xf86Screens[i]);
+
+ /*
+ * Collect all pixmap formats and check for conflicts at the display
+ * level. Should we die here? Or just delete the offending screens?
+ * Also, should this be done for -probeonly?
+ */
+ screenpix24 = Pix24DontCare;
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->imageByteOrder !=
+ xf86Screens[0]->imageByteOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlinePad !=
+ xf86Screens[0]->bitmapScanlinePad)
+ FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlineUnit !=
+ xf86Screens[0]->bitmapScanlineUnit)
+ FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
+ if (xf86Screens[i]->bitmapBitOrder !=
+ xf86Screens[0]->bitmapBitOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+
+ /* Determine the depth 24 pixmap format the screens would like */
+ if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
+ if (screenpix24 == Pix24DontCare)
+ screenpix24 = xf86Screens[i]->pixmap24;
+ else if (screenpix24 != xf86Screens[i]->pixmap24)
+ FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
+ }
+ }
+ /* check if screenpix24 is consistent with the config/cmdline */
+ if (xf86Info.pixmap24 != Pix24DontCare) {
+ pix24 = xf86Info.pixmap24;
+ pix24From = xf86Info.pix24From;
+ if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
+ pix24Fail = TRUE;
+ } else if (screenpix24 != Pix24DontCare) {
+ pix24 = screenpix24;
+ pix24From = X_PROBED;
+ } else
+ pix24 = Pix24Use32;
+
+ if (pix24Fail)
+ FatalError("Screen(s) can't use the required depth 24 pixmap format"
+ " (%d). Exiting\n", PIX24TOBPP(pix24));
+
+ /* Initialise the depth 24 format */
+ for (j = 0; j < numFormats && formats[j].depth != 24; j++)
+ ;
+ formats[j].bitsPerPixel = PIX24TOBPP(pix24);
+
+ /* Collect additional formats */
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numFormats; j++) {
+ for (k = 0; ; k++) {
+ if (k >= numFormats) {
+ if (k >= MAXFORMATS)
+ FatalError("Too many pixmap formats! Exiting\n");
+ formats[k] = xf86Screens[i]->formats[j];
+ numFormats++;
+ break;
+ }
+ if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
+ if ((formats[k].bitsPerPixel ==
+ xf86Screens[i]->formats[j].bitsPerPixel) &&
+ (formats[k].scanlinePad ==
+ xf86Screens[i]->formats[j].scanlinePad))
+ break;
+ FatalError("Inconsistent pixmap format for depth %d."
+ " Exiting\n", formats[k].depth);
+ }
+ }
+ }
+ }
+ formatsDone = TRUE;
+
+ /* If a screen uses depth 24, show what the pixmap format is */
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->depth == 24) {
+ xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
+ PIX24TOBPP(pix24));
+ break;
+ }
+ }
+
+#if BITMAP_SCANLINE_UNIT == 64
+ /*
+ * cfb24 doesn't currently work on architectures with a 64 bit
+ * BITMAP_SCANLINE_UNIT, so check for 24 bit pixel size for pixmaps
+ * or framebuffers.
+ */
+ {
+ Bool usesCfb24 = FALSE;
+
+ if (PIX24TOBPP(pix24) == 24)
+ usesCfb24 = TRUE;
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->bitsPerPixel == 24)
+ usesCfb24 = TRUE;
+ if (usesCfb24) {
+ FatalError("24-bit pixel size is not supported on systems with"
+ " 64-bit scanlines.\n");
+ }
+ }
+#endif
+
+#ifdef XKB
+ xf86InitXkb();
+#endif
+ /* set up the proper access funcs */
+ xf86PostPreInit();
+
+ } else {
+ /*
+ * serverGeneration != 1; some OSs have to do things here, too.
+ */
+ xf86OpenConsole();
+ /* Make sure full I/O access is enabled */
+ xf86EnableIO();
+ }
+
+#if 0
+ /*
+ * Install signal handler for unexpected signals
+ */
+ xf86Info.caughtSignal=FALSE;
+ if (!xf86Info.notrapSignals)
+ {
+ signal(SIGSEGV,xf86SigHandler);
+ signal(SIGILL,xf86SigHandler);
+#ifdef SIGEMT
+ signal(SIGEMT,xf86SigHandler);
+#endif
+ signal(SIGFPE,xf86SigHandler);
+#ifdef SIGBUS
+ signal(SIGBUS,xf86SigHandler);
+#endif
+#ifdef SIGSYS
+ signal(SIGSYS,xf86SigHandler);
+#endif
+#ifdef SIGXCPU
+ signal(SIGXCPU,xf86SigHandler);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ,xf86SigHandler);
+#endif
+ }
+#endif
+
+ /*
+ * Use the previously collected parts to setup pScreenInfo
+ */
+
+ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
+ pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
+ pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
+ pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
+ pScreenInfo->numPixmapFormats = numFormats;
+ for (i = 0; i < numFormats; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ /* Make sure the server's VT is active */
+
+ if (serverGeneration != 1) {
+ xf86Resetting = TRUE;
+ xf86Exiting = FALSE;
+#ifdef HAS_USL_VTS
+ /* All screens are in the same state, so just check the first */
+ if (!xf86Screens[0]->vtSema) {
+ ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
+ }
+#endif
+ }
+#ifdef SCO
+ else {
+ /*
+ * Under SCO we must ack that we got the console at startup,
+ * I think this is the safest way to assure it.
+ */
+ static int once = 1;
+ if (once) {
+ once = 0;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+ xf86Msg(X_WARNING, "VT_ACKACQ failed");
+ }
+ }
+#endif /* SCO */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ if (scr_index == i) {
+ /*
+ * Hook in our ScrnInfoRec, and initialise some other pScreen
+ * fields.
+ */
+ screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
+ = (pointer)xf86Screens[i];
+ xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
+ /* The driver should set this, but make sure it is set anyway */
+ xf86Screens[i]->vtSema = TRUE;
+ } else {
+ /* This shouldn't normally happen */
+ FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
+ }
+
+#ifdef NOT_USED
+ /*
+ * Here we have to let the driver getting access of the VT. Note that
+ * this doesn't mean that the graphics board may access automatically
+ * the monitor. If the monitor is shared this is done in xf86CrossScreen!
+ */
+ if (!xf86Info.sharedMonitor) (xf86Screens[i]->EnterLeaveMonitor)(ENTER);
+#endif
+ }
+ xf86PostScreenInit();
+
+ xf86Resetting = FALSE;
+ xf86Initialising = FALSE;
+
+#ifndef AMOEBA
+#ifdef NEW_INPUT
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
+ NULL);
+#else
+ RegisterBlockAndWakeupHandlers(xf86Block, xf86Wakeup, NULL);
+#endif
+#endif
+}
+
+
+static InputDriverPtr
+MatchInput(IDevPtr pDev)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
+}
+
+
+/*
+ * InitInput --
+ * Initialize all supported input devices...what else is there
+ * besides pointer and keyboard? Two DeviceRec's are allocated and
+ * registered as the system pointer and keyboard devices.
+ */
+
+void
+InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ IDevPtr pDev;
+ InputDriverPtr pDrv;
+ InputInfoPtr pInfo, coreKeyboard = NULL, corePointer = NULL;
+
+ xf86Info.vtRequestsPending = FALSE;
+ xf86Info.inputPending = FALSE;
+#ifdef XTESTEXT1
+ xtest_command_key = KEY_Begin + MIN_KEYCODE;
+#endif /* XTESTEXT1 */
+
+ if (serverGeneration == 1) {
+ /* Call the PreInit function for each input device instance. */
+ for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
+ /* XXX The keyboard driver is a special case for now. */
+ if (!xf86NameCmp(pDev->driver, "keyboard")) {
+ xf86Msg(X_INFO, "Keyboard \"%s\" handled by legacy driver\n",
+ pDev->identifier);
+ continue;
+ }
+ if ((pDrv = MatchInput(pDev)) == NULL) {
+ xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
+ /* XXX For now, just continue. */
+ continue;
+ }
+ if (!pDrv->PreInit) {
+ xf86MsgVerb(X_WARNING, 0,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ pDrv->driverName);
+ continue;
+ }
+ pInfo = pDrv->PreInit(pDrv, pDev, 0);
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
+ pDev->identifier);
+ continue;
+ } else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ pDev->identifier);
+ xf86DeleteInput(pInfo, 0);
+ continue;
+ }
+ if (pInfo->flags & XI86_CORE_KEYBOARD) {
+ if (coreKeyboard) {
+ xf86Msg(X_ERROR,
+ "Attempt to register more than one core keyboard (%s)\n",
+ pInfo->name);
+ pInfo->flags &= ~XI86_CORE_KEYBOARD;
+ } else {
+ if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
+ /* XXX just a warning for now */
+ xf86Msg(X_WARNING,
+ "%s: does not have core keyboard capabilities\n",
+ pInfo->name);
+ }
+ coreKeyboard = pInfo;
+ }
+ }
+ if (pInfo->flags & XI86_CORE_POINTER) {
+ if (corePointer) {
+ xf86Msg(X_ERROR,
+ "Attempt to register more than one core pointer (%s)\n",
+ pInfo->name);
+ pInfo->flags &= ~XI86_CORE_POINTER;
+ } else {
+ if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
+ /* XXX just a warning for now */
+ xf86Msg(X_WARNING,
+ "%s: does not have core pointer capabilities\n",
+ pInfo->name);
+ }
+ corePointer = pInfo;
+ }
+ }
+ }
+#ifdef NEW_INPUT
+ if (!corePointer) {
+ xf86Msg(X_WARNING, "No core pointer registered\n");
+ /* XXX register a dummy core pointer */
+ }
+#ifdef NEW_KBD
+ if (!coreKeyboard) {
+ xf86Msg(X_WARNING, "No core keyboard registered\n");
+ /* XXX register a dummy core keyboard */
+ }
+#endif
+#endif
+ }
+
+#ifdef NEW_INPUT
+ /* Initialise all input devices. */
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ xf86ActivateDevice(pInfo);
+ pInfo = pInfo->next;
+ }
+#endif
+
+ xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
+#ifndef NEW_INPUT
+ xf86Info.pMouse = AddInputDevice(xf86Info.mouseDev->mseProc, TRUE);
+#else
+ if (corePointer)
+ xf86Info.pMouse = corePointer->dev;
+#endif
+ RegisterKeyboardDevice(xf86Info.pKeyboard);
+#ifndef NEW_INPUT
+ RegisterPointerDevice(xf86Info.pMouse);
+#endif
+
+#ifndef NEW_INPUT
+#ifdef XINPUT
+ (xf86Info.pMouse)->public.devicePrivate = xf86Info.mouseLocal;
+ ((LocalDevicePtr) xf86Info.mouseLocal)->dev = xf86Info.pMouse;
+#else
+ (xf86Info.pMouse)->public.devicePrivate = (pointer) xf86Info.mouseDev;
+#endif
+#endif
+
+#ifndef NEW_INPUT
+#ifdef XINPUT
+ InitExtInput();
+#endif
+#endif
+
+ miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
+#ifdef XINPUT
+#ifndef NEW_INPUT
+ xf86XinputFinalizeInit(xf86Info.pMouse);
+#endif
+ xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
+#else
+ mieqInit (xf86Info.pKeyboard, xf86Info.pMouse);
+#endif
+}
+
+/*
+ * OsVendorInit --
+ * OS/Vendor-specific initialisations. Called from OsInit(), which
+ * is called by dix before establishing the well known sockets.
+ */
+
+void
+OsVendorInit()
+{
+ static Bool beenHere = FALSE;
+
+ /* xf86WrapperInit() is called directly from OsInit() */
+#ifdef SIGCHLD
+ signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
+#endif
+ OsDelayInitColors = TRUE;
+#ifdef XFree86LOADER
+ loadableFonts = TRUE;
+#endif
+
+ if (!beenHere)
+ xf86LogInit();
+
+ beenHere = TRUE;
+}
+
+/*
+ * ddxGiveUp --
+ * Device dependent cleanup. Called by by dix before normal server death.
+ * For SYSV386 we must switch the terminal back to normal mode. No error-
+ * checking here, since there should be restored as much as possible.
+ */
+
+void
+ddxGiveUp()
+{
+ xf86AccessLeaveState();
+#ifdef USE_XF86_SERVERLOCK
+ xf86UnlockServer();
+#endif
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+
+ xf86CloseConsole();
+
+ xf86CloseLog();
+
+ /* If an unexpected signal was caught, dump a core for debugging */
+ if (xf86Info.caughtSignal)
+ abort();
+}
+
+
+
+/*
+ * AbortDDX --
+ * DDX - specific abort routine. Called by AbortServer(). The attempt is
+ * made to restore all original setting of the displays. Also all devices
+ * are closed.
+ */
+
+void
+AbortDDX()
+{
+ int i;
+
+#if 0
+ if (xf86Exiting)
+ return;
+#endif
+
+ xf86Exiting = TRUE;
+
+ /*
+ * try to deinitialize all input devices
+ */
+#ifndef NEW_INPUT
+ if (xf86Info.pMouse)
+ (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_CLOSE);
+#endif
+ if (xf86Info.pKeyboard)
+ (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
+
+ /*
+ * try to restore the original video state
+ */
+#ifdef HAS_USL_VTS
+ /* Need the sleep when starting X from within another X session */
+ sleep(1);
+#endif
+ if (xf86Screens) {
+ if (xf86Screens[0]->vtSema)
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished
+ * we might not have been wrapped yet. Therefore enable
+ * screen explicitely.
+ */
+ xf86EnableAccess(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT)(i, 0);
+ }
+ }
+
+ xf86AccessLeave();
+
+ /*
+ * This is needed for an abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp();
+}
+
+void
+OsVendorFatalError()
+{
+ ErrorF("\nWhen reporting a problem related to a server crash, please send\n"
+ "the full server output, not just the last messages.\n");
+ if (xf86LogFile)
+ ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile);
+ ErrorF("\n");
+}
+
+/*
+ * ddxProcessArgument --
+ * Process device-dependent command line args. Returns 0 if argument is
+ * not device dependent, otherwise Count of number of elements of argv
+ * that are part of a device dependent commandline option.
+ */
+
+/* ARGSUSED */
+int
+ddxProcessArgument(int argc, char **argv, int i)
+{
+ /*
+ * Note: can't use xalloc/xfree here because OsInit() hasn't been called
+ * yet. Use malloc/free instead.
+ */
+
+ static Bool beenHere = FALSE;
+
+ if (!beenHere) {
+ /*
+ * This initialises our hook into VErrorF() for catching log messages
+ * that are generated before OsInit() is called.
+ */
+ OsVendorVErrorFProc = OsVendorVErrorF;
+ beenHere = TRUE;
+ }
+
+ /* First the options that are only allowed for root */
+ if (getuid() == 0)
+ {
+ if (!strcmp(argv[i], "-modulepath"))
+ {
+ char *mp;
+ if (!argv[i + 1])
+ return 0;
+ mp = malloc(strlen(argv[i + 1]) + 1);
+ if (!mp)
+ FatalError("Can't allocate memory for ModulePath\n");
+ strcpy(mp, argv[i + 1]);
+ xf86ModulePath = mp;
+ xf86ModPathFrom = X_CMDLINE;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-logfile"))
+ {
+ char *lf;
+ if (!argv[i + 1])
+ return 0;
+ lf = malloc(strlen(argv[i + 1]) + 1);
+ if (!lf)
+ FatalError("Can't allocate memory for LogFile\n");
+ strcpy(lf, argv[i + 1]);
+ xf86LogFile = lf;
+ xf86LogFileFrom = X_CMDLINE;
+ return 2;
+ }
+ }
+ if (!strcmp(argv[i], "-xf86config"))
+ {
+ if (!argv[i + 1])
+ return 0;
+ if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
+ ErrorF("\nInvalid argument for -xf86config\n"
+ "\tFor non-root users, the file specified with -xf86config must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n\n");
+ return 0;
+ }
+ xf86ConfigFile = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i],"-showunresolved"))
+ {
+ xf86ShowUnresolved = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-probeonly"))
+ {
+ xf86ProbeOnly = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-flipPixels"))
+ {
+ xf86FlipPixels = TRUE;
+ return 1;
+ }
+#ifdef XF86VIDMODE
+ if (!strcmp(argv[i],"-disableVidMode"))
+ {
+ xf86VidModeDisabled = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
+ {
+ xf86VidModeAllowNonLocal = TRUE;
+ return 1;
+ }
+#endif
+#ifdef XF86MISC
+ if (!strcmp(argv[i],"-disableModInDev"))
+ {
+ xf86MiscModInDevDisabled = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-allowNonLocalModInDev"))
+ {
+ xf86MiscModInDevAllowNonLocal = TRUE;
+ return 1;
+ }
+#endif
+ if (!strcmp(argv[i],"-allowMouseOpenFail"))
+ {
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-bestRefresh"))
+ {
+ xf86BestRefresh = TRUE;
+ return 1;
+ }
+#ifdef DO_CHECK_BETA
+ if (!strcmp(argv[i],"-extendExpiry"))
+ {
+ extraDays = atoi(argv[i + 1]);
+ expKey = argv[i + 2];
+ return 3;
+ }
+#endif
+ if (!strcmp(argv[i],"-verbose"))
+ {
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86Verbose = val;
+ return 2;
+ }
+ }
+ xf86Verbose++;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-logverbose"))
+ {
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86LogVerbose = val;
+ return 2;
+ }
+ }
+ xf86LogVerbose++;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-quiet"))
+ {
+ xf86Verbose = 0;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
+ {
+ xf86PrintBanner();
+ exit(0);
+ }
+ /* Notice the -fp flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-fp"))
+ {
+ xf86fpFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -co flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-co"))
+ {
+ xf86coFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-bs"))
+ {
+ xf86bsDisableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the +bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "+bs"))
+ {
+ xf86bsEnableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -s flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-s"))
+ {
+ xf86sFlag = TRUE;
+ return 0;
+ }
+ if (!strcmp(argv[i], "-bpp"))
+ {
+ if (++i >= argc)
+ return 0;
+ ErrorF("The -bpp option is no longer supported.\n"
+ "\tUse -depth to set the color depth, and use -fbbpp if you really\n"
+ "\tneed to force a non-default framebuffer (hardware) pixel format.\n");
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pixmap24"))
+ {
+ xf86Pix24 = Pix24Use24;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-pixmap32"))
+ {
+ xf86Pix24 = Pix24Use32;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-fbbpp"))
+ {
+ int bpp;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%d", &bpp) == 1)
+ {
+ xf86FbBpp = bpp;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid fbbpp\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-depth"))
+ {
+ int depth;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%d", &depth) == 1)
+ {
+ xf86Depth = depth;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid depth\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-weight"))
+ {
+ int red, green, blue;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%1d%1d%1d", &red, &green, &blue) == 3)
+ {
+ xf86Weight.red = red;
+ xf86Weight.green = green;
+ xf86Weight.blue = blue;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid weighting\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
+ !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
+ {
+ double gamma;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%lf", &gamma) == 1) {
+ if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
+ ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
+ " is valid\n", GAMMA_MIN, GAMMA_MAX);
+ return 0;
+ }
+ if (!strcmp(argv[i-1], "-gamma"))
+ xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
+ else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
+ else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
+ else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
+ return 2;
+ }
+ }
+ if (!strcmp(argv[i], "-layout"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86LayoutName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-screen"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86ScreenName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pointer"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86PointerName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-keyboard"))
+ {
+ if (++i >= argc)
+ return 0;
+ xf86KeyboardName = argv[i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-scanpci"))
+ {
+ DoScanPci(argc, argv, i);
+ }
+ /* OS-specific processing */
+ return xf86ProcessArgument(argc, argv, i);
+}
+
+/*
+ * ddxUseMsg --
+ * Print out correct use of device dependent commandline options.
+ * Maybe the user now knows what really to do ...
+ */
+
+void
+ddxUseMsg()
+{
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage\n");
+ if (getuid() == 0)
+ {
+ ErrorF("-xf86config file specify a configuration file\n");
+ ErrorF("-modulepath paths specify the module search path\n");
+ ErrorF("-logfile file specify a log file name\n");
+ ErrorF("-scanpci execute the scanpci module and exit\n");
+ }
+ else
+ {
+ ErrorF("-xf86config file specify a configuration file (must be relative)\n");
+ }
+ ErrorF("-probeonly probe for devices, then exit\n");
+ ErrorF("-verbose [n] verbose startup messages\n");
+ ErrorF("-logverbose [n] verbose log messages\n");
+ ErrorF("-quiet minimal startup messages\n");
+ ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
+ ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
+ ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
+ ErrorF("-depth n set colour depth. Default: 8\n");
+ ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
+ ErrorF("-rgamma f set gamma value for red phase\n");
+ ErrorF("-ggamma f set gamma value for green phase\n");
+ ErrorF("-bgamma f set gamma value for blue phase\n");
+ ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
+ ErrorF("-layout name specify the ServerLayout section name\n");
+ ErrorF("-screen name specify the Screen section name\n");
+ ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
+ ErrorF("-pointer name specify the core pointer InputDevice name\n");
+ ErrorF("-flipPixels swap default black/white Pixel values\n");
+#ifdef XF86VIDMODE
+ ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
+ ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
+#endif
+#ifdef XF86MISC
+ ErrorF("-disableModInDev disable dynamic modification of input device settings\n");
+ ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n");
+ ErrorF(" from non-local clients\n");
+ ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
+#endif
+ ErrorF("-bestRefresh chose modes with the best refresh rate\n");
+ ErrorF("-version show the server version\n");
+ /* OS-specific usage */
+ xf86UseMsg();
+ ErrorF("\n");
+}
+
+
+#ifndef OSNAME
+#define OSNAME "unknown"
+#endif
+#ifndef OSVENDOR
+#define OSVENDOR ""
+#endif
+
+static void
+xf86PrintBanner()
+{
+ ErrorF("\nXFree86 Version%s/ X Window System\n", XF86_VERSION);
+ ErrorF("(protocol Version %d, revision %d, vendor release %d)\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE );
+ ErrorF("Release Date: %s\n", XF86_DATE);
+ ErrorF("\tIf the server is older than 6-12 months, or if your card is "
+ "newer\n"
+ "\tthan the above date, look for a newer version before "
+ "reporting\n"
+ "\tproblems. (see http://www.XFree86.Org/FAQ)\n");
+ ErrorF("Operating System: %s %s\n", OSNAME, OSVENDOR);
+#ifdef XFree86LOADER
+ ErrorF("Module Loader present\n");
+#endif
+}
+
+static void
+xf86RunVtInit(void)
+{
+#if !defined(AMOEBA) && !defined(MINIX)
+ int i;
+
+ /*
+ * If VTInit was set, run that program with consoleFd as stdin and stdout
+ */
+
+ if (xf86Info.vtinit) {
+ switch(fork()) {
+ case -1:
+ FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
+ break;
+ case 0: /* child */
+ setuid(getuid());
+ /* set stdin, stdout to the consoleFd */
+ for (i = 0; i < 2; i++) {
+ if (xf86Info.consoleFd != i) {
+ close(i);
+ dup(xf86Info.consoleFd);
+ }
+ }
+ execl("/bin/sh", "sh", "-c", xf86Info.vtinit, NULL);
+ xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n",
+ strerror(errno));
+ exit(255);
+ break;
+ default: /* parent */
+ wait(NULL);
+ }
+ }
+#endif /* !AMOEBA && !MINIX */
+}
+
+#ifdef XFree86LOADER
+/*
+ * xf86LoadModules iterates over a list that is being passed in.
+ */
+Bool
+xf86LoadModules(char **list, pointer *optlist)
+{
+ int errmaj, errmin;
+ pointer opt;
+ int i;
+ char *name;
+
+ if (!list)
+ return TRUE;
+
+ for (i = 0; list[i] != NULL; i++) {
+
+ /* Normalise the module name */
+ name = xf86NormalizeName(list[i]);
+
+ /* Skip empty names */
+ if (name == NULL || *name == '\0')
+ continue;
+
+ if (optlist)
+ opt = optlist[i];
+ else
+ opt = NULL;
+
+ if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ xfree(name);
+ return FALSE;
+ }
+ xfree(name);
+ }
+ return TRUE;
+}
+#endif
+
+/* Pixmap format stuff */
+
+PixmapFormatPtr
+xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
+{
+ int i;
+ static PixmapFormatRec format; /* XXX not reentrant */
+
+ /*
+ * When the formats[] list initialisation isn't complete, check the
+ * depth 24 pixmap config/cmdline options and screen-specified formats.
+ */
+
+ if (!formatsDone) {
+ if (depth == 24) {
+ Pix24Flags pix24 = Pix24DontCare;
+
+ format.depth = 24;
+ format.scanlinePad = BITMAP_SCANLINE_PAD;
+ if (xf86Info.pixmap24 != Pix24DontCare)
+ pix24 = xf86Info.pixmap24;
+ else if (pScrn->pixmap24 != Pix24DontCare)
+ pix24 = pScrn->pixmap24;
+ if (pix24 == Pix24Use24)
+ format.bitsPerPixel = 24;
+ else
+ format.bitsPerPixel = 32;
+ return &format;
+ }
+ }
+
+ for (i = 0; i < numFormats; i++)
+ if (formats[i].depth == depth)
+ break;
+ if (i != numFormats)
+ return &formats[i];
+ else if (!formatsDone) {
+ /* Check for screen-specified formats */
+ for (i = 0; i < pScrn->numFormats; i++)
+ if (pScrn->formats[i].depth == depth)
+ break;
+ if (i != pScrn->numFormats)
+ return &pScrn->formats[i];
+ }
+ return NULL;
+}
+
+int
+xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
+{
+ PixmapFormatPtr format;
+
+
+ format = xf86GetPixFormat(pScrn, depth);
+ if (format)
+ return format->bitsPerPixel;
+ else
+ return 0;
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c
new file mode 100644
index 000000000..510c037a4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c
@@ -0,0 +1,561 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.36 1999/05/09 06:06:20 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+#include "mipointer.h"
+
+#ifdef XINPUT
+#include "xf86Xinput.h"
+#include "XIproto.h"
+#include "exevents.h"
+#endif
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBsrv.h>
+#endif
+
+unsigned int xf86InitialCaps = 0;
+unsigned int xf86InitialNum = 0;
+unsigned int xf86InitialScroll = 0;
+
+#include "atKeynames.h"
+
+/*
+ * xf86KbdBell --
+ * Ring the terminal/keyboard bell for an amount of time proportional to
+ * "loudness".
+ */
+
+void
+xf86KbdBell(percent, pKeyboard, ctrl, unused)
+ int percent; /* Percentage of full volume */
+ DeviceIntPtr pKeyboard; /* Keyboard to ring */
+ pointer ctrl;
+ int unused;
+{
+ xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration);
+}
+
+#ifdef AMOEBA
+#define LED_CAP IOP_LED_CAP
+#define LED_NUM IOP_LED_NUM
+#define LED_SCR IOP_LED_SCROLL
+#endif
+
+#ifdef MINIX
+#define LED_CAP KBD_LEDS_CAPS
+#define LED_NUM KBD_LEDS_NUM
+#define LED_SCR KBD_LEDS_SCROLL
+#endif
+
+void
+xf86KbdLeds ()
+{
+ int leds = 0;
+#ifdef XKB
+ if (!noXkbExtension) {
+ XkbEventCauseRec cause;
+ XkbSetCauseUnknown(&cause);
+ XkbUpdateIndicators((DeviceIntPtr)xf86Info.pKeyboard,
+ XkbAllIndicatorsMask, False, NULL, &cause);
+ return;
+ }
+#endif
+#ifdef LED_CAP
+ if (xf86Info.capsLock && !(xf86Info.xleds & XLED1))
+ leds |= LED_CAP;
+
+ if (xf86Info.numLock && !(xf86Info.xleds & XLED2))
+ leds |= LED_NUM;
+
+ if ((xf86Info.scrollLock ||
+ xf86Info.modeSwitchLock ||
+ xf86Info.composeLock) &&
+ !(xf86Info.xleds & XLED3))
+ leds |= LED_SCR;
+
+ if ((xf86Info.leds & xf86Info.xleds) & XLED1) leds |= LED_CAP;
+ if ((xf86Info.leds & xf86Info.xleds) & XLED2) leds |= LED_NUM;
+ if ((xf86Info.leds & xf86Info.xleds) & XLED3) leds |= LED_SCR;
+
+ xf86SetKbdLeds(leds);
+#endif /* LED_CAP */
+}
+
+/*
+ * xf86KbdCtrl --
+ * Alter some of the keyboard control parameters. All special protocol
+ * values are handled by dix (ProgChangeKeyboardControl)
+ */
+
+void
+xf86KbdCtrl (pKeyboard, ctrl)
+ DevicePtr pKeyboard; /* Keyboard to alter */
+ KeybdCtrl *ctrl;
+{
+ xf86Info.bell_pitch = ctrl->bell_pitch;
+ xf86Info.bell_duration = ctrl->bell_duration;
+ xf86Info.autoRepeat = ctrl->autoRepeat;
+ xf86Info.leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
+
+ xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
+
+ xf86KbdLeds();
+}
+
+/*
+ * xf86InitKBD --
+ * Reinitialize the keyboard. Only set Lockkeys accrding to ours leds.
+ * Depress all other keys.
+ */
+
+void
+xf86InitKBD(init)
+Bool init;
+{
+ char leds = 0, rad;
+ unsigned int i;
+ xEvent kevent;
+ DeviceIntPtr pKeyboard = xf86Info.pKeyboard;
+ KeyClassRec *keyc = xf86Info.pKeyboard->key;
+ KeySym *map = keyc->curKeySyms.map;
+
+#ifndef MACH386
+ kevent.u.keyButtonPointer.time = GetTimeInMillis();
+ kevent.u.keyButtonPointer.rootX = 0;
+ kevent.u.keyButtonPointer.rootY = 0;
+
+ /*
+ * Hmm... here is the biggest hack of every time !
+ * It may be possible that a switch-vt procedure has finished BEFORE
+ * you released all keys neccessary to do this. That peculiar behavior
+ * can fool the X-server pretty much, cause it assumes that some keys
+ * were not released. TWM may stuck alsmost completly....
+ * OK, what we are doing here is after returning from the vt-switch
+ * exeplicitely unrelease all keyboard keys before the input-devices
+ * are reenabled.
+ */
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth)
+ if (KeyPressed(i))
+ {
+ switch (*map) {
+ /* Don't release the lock keys */
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ break;
+ default:
+ kevent.u.u.detail = i;
+ kevent.u.u.type = KeyRelease;
+ (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
+ }
+ }
+#endif /* MACH386 */
+
+ xf86Info.scanPrefix = 0;
+
+ if (init)
+ {
+ /*
+ * we must deal here with the fact, that on some cases the numlock or
+ * capslock key are enabled BEFORE the server is started up. So look
+ * here at the state on the according LEDS to determine whether a
+ * lock-key is already set.
+ */
+
+ xf86Info.capsLock = FALSE;
+ xf86Info.numLock = FALSE;
+ xf86Info.scrollLock = FALSE;
+ xf86Info.modeSwitchLock = FALSE;
+ xf86Info.composeLock = FALSE;
+
+#ifdef LED_CAP
+#ifdef INHERIT_LOCK_STATE
+ leds = xf86Info.leds;
+
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth)
+
+ switch(*map) {
+
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ if (leds & LED_CAP)
+ {
+ xf86InitialCaps = i;
+ xf86Info.capsLock = TRUE;
+ }
+ break;
+
+ case XK_Num_Lock:
+ if (leds & LED_NUM)
+ {
+ xf86InitialNum = i;
+ xf86Info.numLock = TRUE;
+ }
+ break;
+
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ if (leds & LED_SCR)
+ {
+ xf86InitialScroll = i;
+ xf86Info.scrollLock = TRUE;
+ }
+ break;
+ }
+#endif /* INHERIT_LOCK_STATE */
+ xf86SetKbdLeds(leds);
+#endif /* LED_CAP */
+
+ if (xf86Info.kbdDelay <= 375) rad = 0x00;
+ else if (xf86Info.kbdDelay <= 625) rad = 0x20;
+ else if (xf86Info.kbdDelay <= 875) rad = 0x40;
+ else rad = 0x60;
+
+ if (xf86Info.kbdRate <= 2) rad |= 0x1F;
+ else if (xf86Info.kbdRate >= 30) rad |= 0x00;
+ else rad |= ((58 / xf86Info.kbdRate) - 2);
+
+ xf86SetKbdRepeat(rad);
+ }
+}
+
+/*
+ * xf86KbdProc --
+ * Handle the initialization, etc. of a keyboard.
+ */
+
+int
+xf86KbdProc (pKeyboard, what)
+ DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
+ int what; /* What to do to it */
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ int kbdFd;
+
+ switch (what) {
+
+ case DEVICE_INIT:
+ /*
+ * First open and find the current state of the keyboard.
+ */
+
+ xf86KbdInit();
+
+ xf86KbdGetMapping(&keySyms, modMap);
+
+
+#ifndef XKB
+ defaultKeyboardControl.leds = xf86GetKbdLeds();
+#else
+ defaultKeyboardControl.leds = 0;
+#endif
+
+ /*
+ * Perform final initialization of the system private keyboard
+ * structure and fill in various slots in the device record
+ * itself which couldn't be filled in before.
+ */
+
+ pKeyboard->public.on = FALSE;
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
+ &keySyms,
+ modMap,
+ xf86KbdBell,
+ (KbdCtrlProcPtr)xf86KbdCtrl);
+#ifdef XKB
+ } else {
+ XkbComponentNamesRec names;
+ if (XkbInitialMap) {
+ if ((xf86Info.xkbkeymap = strchr(XkbInitialMap, '/')) != NULL)
+ xf86Info.xkbkeymap++;
+ else
+ xf86Info.xkbkeymap = XkbInitialMap;
+ }
+ if (xf86Info.xkbkeymap) {
+ names.keymap = xf86Info.xkbkeymap;
+ names.keycodes = NULL;
+ names.types = NULL;
+ names.compat = NULL;
+ names.symbols = NULL;
+ names.geometry = NULL;
+ } else {
+ names.keymap = NULL;
+ names.keycodes = xf86Info.xkbkeycodes;
+ names.types = xf86Info.xkbtypes;
+ names.compat = xf86Info.xkbcompat;
+ names.symbols = xf86Info.xkbsymbols;
+ names.geometry = xf86Info.xkbgeometry;
+ }
+ if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
+ && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
+ xf86Info.xkbrules = NULL;
+ }
+ XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
+ xf86Info.xkblayout, xf86Info.xkbvariant,
+ xf86Info.xkboptions);
+ XkbInitKeyboardDeviceStruct(pKeyboard,
+ &names,
+ &keySyms,
+ modMap,
+ xf86KbdBell,
+ (KbdCtrlProcPtr)xf86KbdCtrl);
+ }
+#endif
+
+ xf86InitKBD(TRUE);
+ break;
+
+ case DEVICE_ON:
+ /*
+ * Set the keyboard into "direct" mode and turn on
+ * event translation.
+ */
+
+ kbdFd = xf86KbdOn();
+ /*
+ * Discard any pending input after a VT switch to prevent the server
+ * passing on parts of the VT switch sequence.
+ */
+ sleep(1);
+ if (kbdFd != -1) {
+ char buf[16];
+ read(kbdFd, buf, 16);
+ }
+
+#ifndef __EMX__ /* Under EMX, keyboard cannot be select()'ed */
+ if (kbdFd != -1)
+ AddEnabledDevice(kbdFd);
+#endif /* __EMX__ */
+
+ pKeyboard->public.on = TRUE;
+ xf86InitKBD(FALSE);
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ /*
+ * Restore original keyboard directness and translation.
+ */
+
+ kbdFd = xf86KbdOff();
+
+ if (kbdFd != -1)
+ RemoveEnabledDevice(kbdFd);
+
+ pKeyboard->public.on = FALSE;
+ break;
+
+ }
+ return (Success);
+}
+
+#ifndef NEW_INPUT
+/*
+ * xf86MseCtrl --
+ * Alter the control parameters for the mouse. Note that all special
+ * protocol values are handled by dix.
+ */
+
+void
+xf86MseCtrl(pPointer, ctrl)
+ DevicePtr pPointer;
+ PtrCtrl *ctrl;
+{
+ MouseDevPtr mouse = MOUSE_DEV((DeviceIntPtr) pPointer);
+
+ mouse->num = ctrl->num;
+ mouse->den = ctrl->den;
+ mouse->threshold = ctrl->threshold;
+}
+
+/*
+ * xf86MseProc --
+ * Handle the initialization, etc. of a mouse
+ */
+
+int
+xf86MseProc(pPointer, what)
+ DeviceIntPtr pPointer;
+ int what;
+{
+ MouseDevPtr mouse = MOUSE_DEV(pPointer);
+
+ mouse->device = pPointer;
+
+ return xf86MseProcAux(pPointer, what, mouse, NULL,
+ (PtrCtrlProcPtr)xf86MseCtrl);
+}
+
+int
+xf86MseProcAux(pPointer, what, mouse, fd, ctrl)
+ DeviceIntPtr pPointer;
+ int what;
+ MouseDevPtr mouse;
+ int *fd;
+ PtrCtrlProcPtr ctrl;
+{
+ unsigned char map[MSE_MAXBUTTONS + 1];
+ int nbuttons;
+ int mousefd;
+
+ switch (what)
+ {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ /*
+ * [KAZU-241097] We don't know exactly how many buttons the
+ * device has...
+ */
+ for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
+ map[nbuttons + 1] = nbuttons + 1;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer,
+ map,
+ min(mouse->buttons, MSE_MAXBUTTONS),
+ miPointerGetMotionEvents,
+ ctrl,
+ miPointerGetMotionBufferSize());
+#ifdef XINPUT
+ InitValuatorAxisStruct(pPointer,
+ 0,
+ 0, /* min val */
+ screenInfo.screens[0]->width, /* max val */
+ 1, /* resolution */
+ 0, /* min_res */
+ 1); /* max_res */
+ InitValuatorAxisStruct(pPointer,
+ 1,
+ 0, /* min val */
+ screenInfo.screens[0]->height, /* max val */
+ 1, /* resolution */
+ 0, /* min_res */
+ 1); /* max_res */
+ /* Initialize valuator values in synch
+ * with dix/event.c DefineInitialRootWindow
+ */
+ *pPointer->valuator->axisVal = screenInfo.screens[0]->width / 2;
+ *(pPointer->valuator->axisVal+1) = screenInfo.screens[0]->height / 2;
+#endif
+ xf86MouseInit(mouse);
+
+ break;
+
+ case DEVICE_ON:
+
+ mousefd = xf86MouseOn(mouse);
+
+ if (fd)
+ *fd = mousefd;
+
+ if (mousefd != -1) {
+ if (mousefd == -2) {
+ if (fd)
+ *fd = -1;
+ } else {
+ if (mouse->mseType == PROT_PS2)
+ write(mousefd, "\364", 1);
+
+ AddEnabledDevice(mousefd);
+ }
+ mouse->lastButtons = 0;
+ mouse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ } else {
+ return !Success;
+ }
+
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+
+ mousefd = xf86MouseOff(mouse, what == DEVICE_CLOSE);
+
+ if (mousefd != -1)
+ RemoveEnabledDevice(mousefd);
+
+ pPointer->public.on = FALSE;
+ usleep(300000);
+ break;
+ }
+ return Success;
+}
+
+/*
+ * xf86MseEvents --
+ * Read the new events from the device, and pass them to the eventhandler.
+ * This should is not used if there is only an OS_MOUSE driver.
+ */
+#ifndef OSMOUSE_ONLY
+void
+xf86MseEvents(mouse)
+ MouseDevPtr mouse;
+{
+ xf86MouseEvents(mouse);
+}
+#endif
+#endif /* !NEW_INPUT */
+
+#if !defined(AMOEBA) && !(defined (sun) && defined(i386) && defined (SVR4)) && !defined(MINIX) && !defined(__mips__)
+/*
+ * These are getting tossed in here until I can think of where
+ * they really belong
+ */
+CARD32
+GetTimeInMillis()
+{
+ struct timeval tp;
+
+ gettimeofday(&tp, 0);
+ return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
+}
+#endif /* !AMOEBA && !(sun || SVR4) && !MINIX */
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c b/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c
new file mode 100644
index 000000000..c8777dbc6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c
@@ -0,0 +1,366 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.19 1999/04/29 05:12:57 dawes Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+#include "xf86Config.h"
+
+#include "xf86Keymap.h"
+
+#define KD_GET_ENTRY(i,n) \
+ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
+
+#if defined(KDGKBTYPE) && \
+ !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && \
+ !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__)
+#define HAS_GETKBTYPE
+#endif
+#if defined(GIO_KEYMAP) && \
+ !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && \
+ !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && \
+ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX)
+#define HAS_GETKEYMAP
+#endif
+
+/*
+ * NOTE: Not all possible remappable symbols are remapped. There are two main
+ * reasons:
+ * a) The mapping between scancode and SYSV/386 - symboltable
+ * is inconsistent between different versions and has some
+ * BIG mistakes.
+ * b) In X-Windows there is a difference between numpad-keys
+ * and normal keys. SYSV/386 uses for both kinds of keys
+ * the same symbol.
+ *
+ * Thus only the alpha keypad and the function keys are translated.
+ * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
+ */
+
+static unsigned char remap[128] = {
+ 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
+ 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
+ 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
+ 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
+};
+
+static KeySym eascii_to_x[512] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
+ XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
+ XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
+ XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
+ XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
+ XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
+ XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
+ XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
+ XK_sterling, XK_yen, XK_paragraph, XK_section,
+ XK_aacute, XK_iacute, XK_oacute, XK_uacute,
+ XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
+ XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
+ XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
+ XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
+ XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
+ XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
+ XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
+ XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
+ XK_degree, NoSymbol, NoSymbol, XK_radical,
+ XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
+
+ /*
+ * special marked entries (256 + x)
+ */
+
+ NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
+ XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
+ NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
+ XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_F1,
+ XK_F2, XK_F3, XK_F4, XK_F5,
+ XK_F6, XK_F7, XK_F8, XK_F9,
+ XK_F10, XK_F11, XK_F12, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ };
+
+
+/*
+ * LegalModifier --
+ * determine whether a key is a legal modifier key, i.e send a
+ * press/release sequence.
+ */
+
+/*ARGSUSED*/
+Bool
+LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return (TRUE);
+}
+
+
+
+/*
+ * xf86KbdGetMapping --
+ * Get the national keyboard mapping. The keyboard type is set, a new map
+ * and the modifiermap is computed.
+ */
+
+void
+xf86KbdGetMapping (pKeySyms, pModMap)
+ KeySymsPtr pKeySyms;
+ CARD8 *pModMap;
+{
+ KeySym *k;
+#ifdef HAS_GETKEYMAP
+ keymap_t keymap;
+#endif
+ char type;
+ int i;
+ KeySym *pMap;
+
+#ifdef HAS_GETKBTYPE
+ xf86Info.kbdType =
+ ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
+ if (xf86Info.kbdType == KB_84)
+ pMap = map84;
+ else
+ pMap = map;
+#else
+ xf86Info.kbdType = 0;
+ pMap = map;
+#endif
+
+#ifdef HAS_GETKEYMAP
+ /*
+ * use the keymap, which can be gotten from our oringinal vt??.
+ * ( ttymap(1) !!!! )
+ */
+ if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
+ for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
+
+ if (remap[i]) {
+
+ k = pMap + (remap[i] << 2);
+
+ k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
+ k[1] = KD_GET_ENTRY(i,1); /* shifted */
+ k[2] = KD_GET_ENTRY(i,4); /* alt */
+ k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ }
+ }
+#endif
+
+ /*
+ * compute the modifier map
+ */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = pMap, i = MIN_KEYCODE;
+ i < (NUM_KEYCODES + MIN_KEYCODE);
+ i++, k += 4)
+
+ switch(*k) {
+
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+
+ /* kana support */
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+
+ /* alternate toggle for multinational support */
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+
+ }
+
+#ifdef HAS_GETKBTYPE
+ xf86Info.kbdType =
+ ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
+#else
+/* OS/2 sets the keyboard type during xf86OpenKbd */
+#ifndef __EMX__
+ xf86Info.kbdType = 0;
+#endif
+#endif
+
+
+ pKeySyms->map = pMap;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c
new file mode 100644
index 000000000..ce7d1a4b8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c
@@ -0,0 +1,542 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.12 1999/04/29 05:12:57 dawes Exp $ */
+/*
+ * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
+ * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * and from xf86KbdCODrv.c by Holger Veit
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+#include "xf86Keymap.h"
+
+#define KD_GET_ENTRY(i,n) \
+ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
+
+#ifndef PC98
+static unsigned char remap[128] = {
+ 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
+ 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
+ 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
+ 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
+};
+#else /* PC98 */
+static unsigned char remap[128] = {
+ 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0, 0, 0, /* 0x30 - 0x37 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x38 - 0x3f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x47 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
+ 0, 0, 0x52, 0x53, 0x54, 0x55, 0x56, 0, /* 0x50 - 0x57 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 - 0x67 */
+ 0x68, 0x69, 0x6a, 0x6b, 0, 0, 0, 0, /* 0x68 - 0x6f */
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0, 0, 0, /* 0x70 - 0x77 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
+};
+#endif /* PC98 */
+
+
+/* This table assumes the ibm code page 437 coding for characters
+ * > 0x80. They are returned in this form by PCVT */
+static KeySym eascii_to_x[512] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
+ XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
+ XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
+ XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
+ XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
+ XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
+ XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
+ XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
+ XK_sterling, XK_yen, XK_paragraph, XK_section,
+ XK_aacute, XK_iacute, XK_oacute, XK_uacute,
+ XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
+ XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
+ XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
+ XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
+ XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
+ XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
+ XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
+ XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
+ XK_degree, NoSymbol, NoSymbol, XK_radical,
+ XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
+
+ /*
+ * special marked entries (256 + x)
+ */
+
+ NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
+ XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
+ NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
+ XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_F1,
+ XK_F2, XK_F3, XK_F4, XK_F5,
+ XK_F6, XK_F7, XK_F8, XK_F9,
+ XK_F10, XK_F11, XK_F12, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ };
+
+#ifdef __OpenBSD__
+/* don't mark AltR and CtrlR for remapping, since they
+ * cannot be remapped by pccons */
+static unsigned char pccons_remap[128] = {
+ 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
+ 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
+ 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
+};
+
+/* This table assumes an iso8859_1 encoding for the characters
+ * > 80, as returned by pccons */
+static KeySym latin1_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+ };
+#endif
+/*
+ * LegalModifier --
+ * determine whether a key is a legal modifier key, i.e send a
+ * press/release sequence.
+ */
+
+/*ARGSUSED*/
+Bool
+LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return (TRUE);
+}
+
+/*
+ * xf86KbdGetMapping --
+ * Get the national keyboard mapping. The keyboard type is set, a new map
+ * and the modifiermap is computed.
+ */
+
+void
+xf86KbdGetMapping (pKeySyms, pModMap)
+ KeySymsPtr pKeySyms;
+ CARD8 *pModMap;
+{
+ KeySym *k;
+ int i;
+
+#ifndef __bsdi__
+ switch (xf86Info.consType) {
+
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+#if defined(__OpenBSD__)
+ /*
+ * on OpenBSD, the pccons keymap is programmable, too
+ */
+ {
+ pccons_keymap_t keymap[KB_NUM_KEYS];
+ if (ioctl(xf86Info.consoleFd, CONSOLE_GET_KEYMAP, &keymap) != -1) {
+ for (i = 0; i < KB_NUM_KEYS; i++)
+ if (pccons_remap[i]) {
+ k = map + (pccons_remap[i] << 2);
+ switch (keymap[i].type) {
+ case KB_ASCII:
+ /* For ASCII keys, there is only one char in the keymap */
+ k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];
+ k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];
+ k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];
+ k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];
+ break;
+ case KB_SCROLL:
+ k[0] = XK_Scroll_Lock;
+ goto special;
+ case KB_NUM:
+ k[0] = XK_Num_Lock;
+ goto special;
+ case KB_CAPS:
+ k[0] = XK_Caps_Lock;
+ goto special;
+ case KB_SHIFT:
+ switch (keymap[i].unshift[0]) {
+ case 1:
+ /* left shift */
+ k[0] = XK_Shift_L;
+ break;
+ case 2:
+ /* right shift */
+ k[0] = XK_Shift_R;
+ break;
+ default:
+ k[0] = NoSymbol;
+ }
+ goto special;
+ case KB_CTL:
+ k[0] = XK_Control_L;
+ goto special;
+ case KB_ALT:
+ k[0] = XK_Alt_L;
+ goto special;
+ case KB_FUNC:
+ switch (keymap[i].unshift[2]) {
+ case 'M':
+ k[0] = XK_F1;
+ break;
+ case 'N':
+ k[0] = XK_F2;
+ break;
+ case 'O':
+ k[0] = XK_F3;
+ break;
+ case 'P':
+ k[0] = XK_F4;
+ break;
+ case 'Q':
+ k[0] = XK_F5;
+ break;
+ case 'R':
+ k[0] = XK_F6;
+ break;
+ case 'S':
+ k[0] = XK_F7;
+ break;
+ case 'T':
+ k[0] = XK_F8;
+ break;
+ case 'U':
+ k[0] = XK_F9;
+ break;
+ case 'V':
+ k[0] = XK_F10;
+ break;
+ case 'W':
+ k[0] = XK_F11;
+ break;
+ case 'X':
+ k[0] = XK_F12;
+ break;
+ default:
+ k[0] = NoSymbol;
+ break;
+ }
+ goto special;
+ default:
+ k[0] = NoSymbol;
+ special:
+ k[1] = k[2] = k[3] = NoSymbol;
+ }
+ }
+ } else {
+ ErrorF("Can't read pccons keymap\n");
+ }
+ }
+#endif /* __OpenBSD__ */
+ break;
+#endif
+
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ {
+ keymap_t keymap;
+
+ if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
+ for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
+#ifdef PC98
+ if (remap[i] || i == 0) {
+#else
+ if (remap[i]) {
+#endif
+ k = map + (remap[i] << 2);
+ k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
+ k[1] = KD_GET_ENTRY(i,1); /* shifted */
+ k[2] = KD_GET_ENTRY(i,4); /* alt */
+ k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3])
+ k[2] = k[3] = NoSymbol;
+ }
+ }
+ }
+ break;
+#endif /* SYSCONS || PCVT */
+
+ }
+#endif /* !bsdi */
+
+ /*
+ * compute the modifier map
+ */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = map, i = MIN_KEYCODE;
+ i < (NUM_KEYCODES + MIN_KEYCODE);
+ i++, k += 4)
+
+ switch(*k) {
+
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+
+ /* kana support */
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+
+ /* alternate toggle for multinational support */
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+
+ }
+
+ xf86Info.kbdType = 0;
+
+ pKeySyms->map = map;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c
new file mode 100644
index 000000000..5a6d1df28
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c
@@ -0,0 +1,622 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.15 1999/04/29 05:12:58 dawes Exp $ */
+/*
+ * Linux version of keymapping setup. The kernel (since 0.99.14) has support
+ * for fully remapping the keyboard, but there are some differences between
+ * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
+ * remove the restriction on what keycodes can be remapped.
+ * Orest Zborowski.
+ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+
+#include "xf86Keymap.h"
+#include "DECkeysym.h"
+
+/*
+ * LegalModifier --
+ * determine whether a key is a legal modifier key, i.e send a
+ * press/release sequence.
+ */
+
+/*ARGSUSED*/
+Bool
+LegalModifier(unsigned int key, DevicePtr pDev)
+{
+ return (TRUE);
+}
+
+/*
+ * xf86KbdGetMapping --
+ * Get the national keyboard mapping. The keyboard type is set, a new map
+ * and the modifiermap is computed.
+ */
+
+static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
+
+void
+xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ KeySym *k;
+ char type;
+ int i;
+
+ readKernelMapping(pKeySyms, pModMap);
+
+ /*
+ * compute the modifier map
+ */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = map, i = MIN_KEYCODE;
+ i < (NUM_KEYCODES + MIN_KEYCODE);
+ i++, k += 4)
+
+ switch(*k) {
+
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+
+ /* kana support */
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+
+ /* alternate toggle for multinational support */
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+
+ }
+
+ xf86Info.kbdType =
+ ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
+
+ pKeySyms->map = map;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+#include <linux/keyboard.h>
+
+static KeySym linux_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+};
+
+#ifndef ASSUME_CUSTOM_KEYCODES
+
+/*
+ * Maps the AT keycodes to Linux keycodes
+ */
+static unsigned char at2lnx[NUM_KEYCODES] =
+{
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
+};
+#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
+
+#else /* !ASSUME_CUSTOM_KEYCODES */
+
+#define NUM_AT2LNX NR_KEYS
+
+u_char SpecialServerMap[NR_KEYS];
+
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+
+static void
+readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ KeySym *k;
+ int i;
+ static unsigned char tbl[GLYPHS_PER_KEY] =
+ {
+ 0, /* unshifted */
+ 1, /* shifted */
+ 0, /* modeswitch unshifted */
+ 0 /* modeswitch shifted */
+ };
+
+ /*
+ * Read the mapping from the kernel.
+ * Since we're still using the XFree86 scancode->AT keycode mapping
+ * routines, we need to convert the AT keycodes to Linux keycodes,
+ * then translate the Linux keysyms into X keysyms.
+ *
+ * First, figure out which tables to use for the modeswitch columns
+ * above, from the XF86Config fields.
+ */
+ tbl[2] = 8; /* alt */
+ tbl[3] = tbl[2] | 1;
+
+#ifndef ASSUME_CUSTOM_KEYCODES
+ for (i = 0, k = map+GLYPHS_PER_KEY; i < NUM_AT2LNX; ++i)
+#else /* !ASSUME_CUSTOM_KEYCODES */
+ for (i = 0, k = map; i < NUM_AT2LNX; ++i)
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+ {
+ struct kbentry kbe;
+ int j;
+
+#ifndef ASSUME_CUSTOM_KEYCODES
+ kbe.kb_index = at2lnx[i];
+#else /* !ASSUME_CUSTOM_KEYCODES */
+ kbe.kb_index = i;
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+
+ for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
+ {
+ unsigned short kval;
+
+ *k = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ if (
+#ifndef ASSUME_CUSTOM_KEYCODES
+ kbe.kb_index == 0 ||
+#endif /* !ASSUME_CUSTOM_KEYCODES */
+ ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
+ continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value))
+ {
+ case KT_LATIN:
+ case KT_LETTER:
+ *k = linux_to_x[kval];
+ break;
+
+ case KT_FN:
+ if (kval <= 19)
+ *k = XK_F1 + kval;
+ else switch (kbe.kb_value)
+ {
+ case K_FIND:
+ *k = XK_Home; /* or XK_Find */
+ break;
+ case K_INSERT:
+ *k = XK_Insert;
+ break;
+ case K_REMOVE:
+ *k = XK_Delete;
+ break;
+ case K_SELECT:
+ *k = XK_End; /* or XK_Select */
+ break;
+ case K_PGUP:
+ *k = XK_Prior;
+ break;
+ case K_PGDN:
+ *k = XK_Next;
+ break;
+ case K_HELP:
+ *k = XK_Help;
+ break;
+ case K_DO:
+ *k = XK_Execute;
+ break;
+ case K_PAUSE:
+ *k = XK_Pause;
+ break;
+ case K_MACRO:
+ *k = XK_Menu;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_SPEC:
+ switch (kbe.kb_value)
+ {
+ case K_ENTER:
+ *k = XK_Return;
+ break;
+ case K_BREAK:
+ *k = XK_Break;
+ break;
+ case K_CAPS:
+ *k = XK_Caps_Lock;
+ break;
+ case K_NUM:
+ *k = XK_Num_Lock;
+ break;
+ case K_HOLD:
+ *k = XK_Scroll_Lock;
+ break;
+ case K_COMPOSE:
+ *k = XK_Multi_key;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_PAD:
+ switch (kbe.kb_value)
+ {
+ case K_PPLUS:
+ *k = XK_KP_Add;
+ break;
+ case K_PMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ case K_PSTAR:
+ *k = XK_KP_Multiply;
+ break;
+ case K_PSLASH:
+ *k = XK_KP_Divide;
+ break;
+ case K_PENTER:
+ *k = XK_KP_Enter;
+ break;
+ case K_PCOMMA:
+ *k = XK_KP_Separator;
+ break;
+ case K_PDOT:
+ *k = XK_KP_Decimal;
+ break;
+ case K_PPLUSMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ default:
+ if (kval <= 9)
+ *k = XK_KP_0 + kval;
+ break;
+ }
+ break;
+
+ /*
+ * KT_DEAD keys are for accelerated diacritical creation.
+ */
+ case KT_DEAD:
+ switch (kbe.kb_value)
+ {
+ case K_DGRAVE:
+ *k = XK_dead_grave;
+ break;
+ case K_DACUTE:
+ *k = XK_dead_acute;
+ break;
+ case K_DCIRCM:
+ *k = XK_dead_circumflex;
+ break;
+ case K_DTILDE:
+ *k = XK_dead_tilde;
+ break;
+ case K_DDIERE:
+ *k = XK_dead_diaeresis;
+ break;
+ }
+ break;
+
+ case KT_CUR:
+ switch (kbe.kb_value)
+ {
+ case K_DOWN:
+ *k = XK_Down;
+ break;
+ case K_LEFT:
+ *k = XK_Left;
+ break;
+ case K_RIGHT:
+ *k = XK_Right;
+ break;
+ case K_UP:
+ *k = XK_Up;
+ break;
+ }
+ break;
+
+ case KT_SHIFT:
+ switch (kbe.kb_value)
+ {
+ case K_ALTGR:
+ *k = XK_Alt_R;
+ break;
+ case K_ALT:
+ *k = (kbe.kb_index == 0x64 ?
+ XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ *k = (kbe.kb_index == 0x61 ?
+ XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL:
+ *k = XK_Control_L;
+ break;
+ case K_CTRLR:
+ *k = XK_Control_R;
+ break;
+ case K_SHIFT:
+ *k = (kbe.kb_index == 0x36 ?
+ XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL:
+ *k = XK_Shift_L;
+ break;
+ case K_SHIFTR:
+ *k = XK_Shift_R;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ /*
+ * KT_ASCII keys accumulate a 3 digit decimal number that gets
+ * emitted when the shift state changes. We can't emulate that.
+ */
+ case KT_ASCII:
+ break;
+
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK)
+ *k = XK_Shift_Lock;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (k[-1] == k[-2]) k[-1] = NoSymbol;
+ if (k[-2] == k[-3]) k[-2] = NoSymbol;
+ if (k[-3] == k[-4]) k[-3] = NoSymbol;
+ if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
+ if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
+ }
+#ifdef ASSUME_CUSTOM_KEYCODES
+ /*
+ * Find the Mapping for the special server functions
+ */
+ for (i = 0; i < NR_KEYS; ++i) {
+ struct kbentry kbe;
+ int special = 0;
+
+ kbe.kb_index = i;
+ kbe.kb_table = 0; /* Plain map */
+ if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
+ switch (kbe.kb_value) {
+ case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
+ special = KEY_BackSpace;
+ break;
+ case K_PMINUS:
+ special = KEY_KP_Minus;
+ break;
+ case K_PPLUS:
+ special = KEY_KP_Plus;
+ break;
+ case K_F1:
+ special = KEY_F1;
+ break;
+ case K_F2:
+ special = KEY_F2;
+ break;
+ case K_F3:
+ special = KEY_F3;
+ break;
+ case K_F4:
+ special = KEY_F4;
+ break;
+ case K_F5:
+ special = KEY_F5;
+ break;
+ case K_F6:
+ special = KEY_F6;
+ break;
+ case K_F7:
+ special = KEY_F7;
+ break;
+ case K_F8:
+ special = KEY_F8;
+ break;
+ case K_F9:
+ special = KEY_F9;
+ break;
+ case K_F10:
+ special = KEY_F10;
+ break;
+ case K_F11:
+ special = KEY_F11;
+ break;
+ case K_F12:
+ special = KEY_F12;
+ break;
+ case K_ALT:
+ special = KEY_Alt;
+ break;
+ case K_ALTGR:
+ special = KEY_AltLang;
+ break;
+ case K_CONS:
+ special = KEY_SysReqest;
+ break;
+ }
+ SpecialServerMap[i] = special;
+ }
+#endif /* ASSUME_CUSTOM_KEYCODES */
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c
new file mode 100644
index 000000000..fbbafd8af
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c
@@ -0,0 +1,313 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.8 1998/07/25 16:55:09 dawes Exp $ */
+/*
+ *****************************************************************************
+ * HISTORY
+ * Log: xf86KbdMach.c,v
+ * Revision 2.1.2.1 92/06/25 10:32:08 moore
+ * Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes
+ * to run Thomas Roell's I386 color X11R5. Original code only worked
+ * with SCO Unix. New code works with 2.5 and 3.0 Mach
+ * [92/06/24 rvb]
+ *
+ * EndLog
+ *
+ *****************************************************************************
+ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+#include "xf86Config.h"
+
+#include "xf86Keymap.h"
+
+static KeySym ascii_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
+ XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
+ XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
+ XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
+ XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
+ XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
+ XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
+ XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
+ XK_sterling, XK_yen, XK_paragraph, XK_section,
+ XK_aacute, XK_iacute, XK_oacute, XK_uacute,
+ XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
+ XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
+ XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
+ XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
+ XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
+ XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
+ XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
+ XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
+ XK_degree, NoSymbol, NoSymbol, XK_radical,
+ XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
+ };
+
+/*
+ * LegalModifier --
+ * determine whether a key is a legal modifier key, i.e send a
+ * press/release sequence.
+ */
+
+/*ARGSUSED*/
+Bool
+LegalModifier(key, pDev)
+ unsigned int key;
+ DevicePtr pDev;
+{
+ return (TRUE);
+}
+
+
+
+/*
+ * xf86KbdGetMapping --
+ * Get the national keyboard mapping. The keyboard type is set, a new map
+ * and the modifiermap is computed.
+ */
+
+void
+xf86KbdGetMapping (pKeySyms, pModMap)
+ KeySymsPtr pKeySyms;
+ CARD8 *pModMap;
+{
+ KeySym *k;
+ struct kbentry kbe;
+ char type;
+ int i, j;
+
+ for (i = 0; i < NUMKEYS; i++)
+ {
+ static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT };
+ int j;
+
+ k = &map[i*4];
+ kbe.kb_index = i;
+
+ for (j = 0; j < 4; j++)
+ {
+ kbe.kb_state = states[j];
+
+ if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1)
+ continue;
+
+ if (kbe.kb_value [0] == K_SCAN)
+ {
+ int keycode = -1;
+ switch (kbe.kb_value [1])
+ {
+ case K_CTLSC: keycode = XK_Control_L; break;
+ case K_LSHSC: keycode = XK_Shift_L; break;
+ case K_RSHSC: keycode = XK_Shift_R; break;
+ case K_ALTSC: keycode = XK_Alt_L; break;
+ case K_CLCKSC: keycode = XK_Caps_Lock; break;
+ case K_NLCKSC: keycode = XK_Num_Lock; break;
+ default: break;
+ }
+ if (keycode > 0)
+ k[j] = keycode;
+ }
+ else if (kbe.kb_value[1] != NC)
+ {
+ /* How to handle multiple characters?
+ Ignore them for now. */
+ }
+ else
+ {
+ k[j] = ascii_to_x[kbe.kb_value[0]];
+ }
+ }
+ }
+
+ /*
+ * Apply the special key mapping specified in XF86Config
+ */
+ for (k = map, i = MIN_KEYCODE;
+ i < (NUM_KEYCODES + MIN_KEYCODE);
+ i++, k += 4) {
+ switch (k[0]) {
+ case XK_Alt_L:
+ j = K_INDEX_LEFTALT;
+ break;
+ case XK_Alt_R:
+ j = K_INDEX_RIGHTALT;
+ break;
+ case XK_Scroll_Lock:
+ j = K_INDEX_SCROLLLOCK;
+ break;
+ case XK_Control_R:
+ j = K_INDEX_RIGHTCTL;
+ break;
+ default:
+ j = -1;
+ }
+ if (j >= 0)
+ switch (xf86Info.specialKeyMap[j]) {
+ case KM_META:
+ if (k[0] == XK_Alt_R)
+ k[1] = XK_Meta_R;
+ else {
+ k[0] = XK_Alt_L;
+ k[1] = XK_Meta_L;
+ }
+ break;
+ case KM_COMPOSE:
+ k[0] = XK_Multi_key;
+ break;
+ case KM_MODESHIFT:
+ k[0] = XK_Mode_switch;
+ k[1] = NoSymbol;
+ break;
+ case KM_MODELOCK:
+ k[0] = XK_Mode_switch;
+ k[1] = XF86XK_ModeLock;
+ break;
+ case KM_SCROLLLOCK:
+ k[0] = XK_Scroll_Lock;
+ break;
+ case KM_CONTROL:
+ k[0] = XK_Control_R;
+ break;
+ }
+ }
+
+ /*
+ * compute the modifier map
+ */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = map, i = MIN_KEYCODE;
+ i < (NUM_KEYCODES + MIN_KEYCODE);
+ i++, k += 4)
+
+ switch(*k) {
+
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+
+ case XK_Num_Lock:
+ if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
+ break;
+
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+
+ /* kana support */
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+
+ /* alternate toggle for multinational support */
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+
+ }
+
+ xf86Info.kbdType =
+ ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB;
+
+ pKeySyms->map = map;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ if (xf86Info.serverNumLock)
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+ else
+ pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
+
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h
new file mode 100644
index 000000000..82a485ff4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h
@@ -0,0 +1,401 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.12 1999/04/29 05:12:58 dawes Exp $ */
+/*
+ *
+ * For Scancodes see notes in atKeynames.h !!!!
+ *
+ */
+/* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+#ifndef PC98
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+
+ /* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+#else /* PC98 */
+ /* 0x00 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_1, XK_exclam, XK_kana_NU, NoSymbol,
+ /* 0x02 */ XK_2, XK_quotedbl, XK_kana_FU, NoSymbol,
+ /* 0x03 */ XK_3, XK_numbersign, XK_kana_A, XK_kana_a,
+ /* 0x04 */ XK_4, XK_dollar, XK_kana_U, XK_kana_u,
+ /* 0x05 */ XK_5, XK_percent, XK_kana_E, XK_kana_e,
+ /* 0x06 */ XK_6, XK_ampersand, XK_kana_O, XK_kana_o,
+ /* 0x07 */ XK_7, XK_quoteright, XK_kana_YA, XK_kana_ya,
+ /* 0x08 */ XK_8, XK_parenleft, XK_kana_YU, XK_kana_yu,
+ /* 0x09 */ XK_9, XK_parenright, XK_kana_YO, XK_kana_yo,
+ /* 0x0a */ XK_0, NoSymbol, XK_kana_WA, XK_kana_WO,
+ /* 0x0b */ XK_minus, XK_equal, XK_kana_HO, NoSymbol,
+ /* 0x0c */ XK_asciicircum, XK_quoteleft, XK_kana_HE, NoSymbol,
+ /* 0x0d */ XK_backslash, XK_bar, XK_prolongedsound, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, XK_kana_TA, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, XK_kana_TE, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, XK_kana_I, XK_kana_i,
+ /* 0x13 */ XK_R, NoSymbol, XK_kana_SU, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, XK_kana_KA, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, XK_kana_N, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, XK_kana_NA, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, XK_kana_NI, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, XK_kana_RA, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, XK_kana_SE, NoSymbol,
+ /* 0x1a */ XK_at, XK_asciitilde, XK_voicedsound, NoSymbol,
+ /* 0x1b */ XK_bracketleft, XK_braceleft, XK_semivoicedsound, XK_kana_openingbracket,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_A, NoSymbol, XK_kana_CHI, NoSymbol,
+ /* 0x1e */ XK_S, NoSymbol, XK_kana_TO, NoSymbol,
+ /* 0x1f */ XK_D, NoSymbol, XK_kana_SHI, NoSymbol,
+ /* 0x20 */ XK_F, NoSymbol, XK_kana_HA, NoSymbol,
+ /* 0x21 */ XK_G, NoSymbol, XK_kana_KI, NoSymbol,
+ /* 0x22 */ XK_H, NoSymbol, XK_kana_KU, NoSymbol,
+ /* 0x23 */ XK_J, NoSymbol, XK_kana_MA, NoSymbol,
+ /* 0x24 */ XK_K, NoSymbol, XK_kana_NO, NoSymbol,
+ /* 0x25 */ XK_L, NoSymbol, XK_kana_RI, NoSymbol,
+ /* 0x26 */ XK_semicolon, XK_plus, XK_kana_RE, NoSymbol,
+ /* 0x27 */ XK_colon, XK_asterisk, XK_kana_KE, NoSymbol,
+ /* 0x28 */ XK_bracketright,XK_braceright, XK_kana_MU, XK_kana_closingbracket,
+ /* 0x29 */ XK_Z, NoSymbol, XK_kana_TSU, NoSymbol,
+ /* 0x2a */ XK_X, NoSymbol, XK_kana_SA, NoSymbol,
+ /* 0x2b */ XK_C, NoSymbol, XK_kana_SO, NoSymbol,
+ /* 0x2c */ XK_V, NoSymbol, XK_kana_HI, NoSymbol,
+ /* 0x2d */ XK_B, NoSymbol, XK_kana_KO, NoSymbol,
+ /* 0x2e */ XK_N, NoSymbol, XK_kana_MI, NoSymbol,
+ /* 0x2f */ XK_M, NoSymbol, XK_kana_MO, NoSymbol,
+ /* 0x30 */ XK_comma, XK_less, XK_kana_NE, XK_kana_comma,
+ /* 0x31 */ XK_period, XK_greater, XK_kana_RU, XK_kana_fullstop,
+ /* 0x32 */ XK_slash, XK_question, XK_kana_ME, XK_kana_middledot,
+ /* 0x33 */ XK_underscore, XK_underscore, XK_kana_RO, NoSymbol,
+ /* 0x34 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_Henkan, XK_Kanji, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_Clear, XK_Home, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_Help, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Equal, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_Separator,NoSymbol, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_F13, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ XK_F14, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_F15, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x57 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ XK_kana_switch, NoSymbol, XK_kana_switch, NoSymbol,
+ /* 0x73 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x74 */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+#endif /* PC98 */
+};
+
+#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && !defined(linux) && !defined(CSRG_BASED)
+static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+
+ /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+};
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c b/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c
new file mode 100644
index 000000000..83e114c63
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c
@@ -0,0 +1,549 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.2 1999/07/18 03:26:49 dawes Exp $ */
+
+/*
+ * This file contains the Pointer/Keyboard functions needed by the
+ * XFree86-Misc extension.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef XF86MISC
+#define _XF86MISC_SERVER_
+#include "xf86misc.h"
+#include "xf86miscproc.h"
+#endif
+
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h"
+#include "xf86Xinput.h"
+#else
+#include "inputstr.h"
+#endif
+
+#ifdef NEW_INPUT
+#include "xf86OSmouse.h"
+#include "../input/mouse/mouse.h"
+const char * xf86ProtocolIDToName(ProtocolID id);
+#endif
+
+#define DEBUG
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+#ifdef XF86MISC
+
+typedef struct {
+ int type;
+ int baudrate;
+ int samplerate;
+ int resolution;
+ int buttons;
+ Bool em3buttons;
+ int em3timeout;
+ Bool chordmiddle;
+ int flags;
+ pointer private;
+} mseParamsRec, *mseParamsPtr;
+
+typedef struct {
+ int type;
+ int rate;
+ int delay;
+ int serverNumLock; /* obsolete */
+} kbdParamsRec, *kbdParamsPtr;
+
+typedef enum {
+ TO_MISC,
+ FROM_MISC
+} MseProtoMapDirection;
+
+/*
+ Sigh...
+
+ The extension should probably be changed to use protocol
+ names instead of ID numbers
+*/
+static int
+MapMseProto(int proto, MseProtoMapDirection mapping)
+{
+#ifndef NEW_INPUT
+ static int MapProto_ToMisc[] = {
+ MTYPE_MICROSOFT, MTYPE_MOUSESYS, MTYPE_MMSERIES,
+ MTYPE_LOGITECH, MTYPE_BUSMOUSE, MTYPE_LOGIMAN,
+ MTYPE_PS_2, MTYPE_MMHIT, MTYPE_GLIDEPOINT,
+ MTYPE_IMSERIAL, MTYPE_THINKING, MTYPE_IMPS2,
+ MTYPE_THINKINGPS2, MTYPE_MMANPLUSPS2, MTYPE_GLIDEPOINTPS2,
+ MTYPE_NETPS2, MTYPE_NETSCROLLPS2, MTYPE_SYSMOUSE,
+ MTYPE_UNKNOWN, MTYPE_UNKNOWN, MTYPE_AUTOMOUSE,
+ MTYPE_ACECAD
+ };
+
+ static MouseProtocol MapProto_FromMisc[] = {
+ PROT_MS, PROT_MSC, PROT_MM,
+ PROT_LOGI, PROT_BM, PROT_LOGIMAN,
+ PROT_PS2, PROT_MMHIT, PROT_GLIDEPOINT,
+ PROT_IMSERIAL, PROT_THINKING, PROT_IMPS2,
+ PROT_THINKINGPS2, PROT_MMPLUSPS2, PROT_GLIDEPOINTPS2,
+ PROT_NETPS2, PROT_NETSCROLLPS2, PROT_SYSMOUSE,
+ PROT_AUTO, PROT_ACECAD
+ };
+#define PROT_DEFAULT 0 /* PROT_MS */
+#else
+ static int MapProto_ToMisc[] = {
+ MTYPE_MICROSOFT, MTYPE_MOUSESYS, MTYPE_MMSERIES,
+ MTYPE_LOGITECH, MTYPE_LOGIMAN, MTYPE_MMHIT,
+ MTYPE_GLIDEPOINT, MTYPE_IMSERIAL, MTYPE_THINKING,
+ MTYPE_ACECAD, MTYPE_PS_2, MTYPE_IMPS2,
+ MTYPE_THINKINGPS2, MTYPE_MMANPLUSPS2, MTYPE_GLIDEPOINTPS2,
+ MTYPE_NETPS2, MTYPE_NETSCROLLPS2, MTYPE_BUSMOUSE,
+ MTYPE_AUTOMOUSE, MTYPE_SYSMOUSE
+ };
+
+ static ProtocolID MapProto_FromMisc[] = {
+ PROT_MS, PROT_MSC, PROT_MM, PROT_LOGI,
+ PROT_BM, PROT_LOGIMAN, PROT_PS2, PROT_MMHIT,
+ PROT_GLIDE, PROT_IMSERIAL, PROT_THINKING, PROT_IMPS2,
+ PROT_THINKPS2, PROT_MMPS2, PROT_GLIDEPS2, PROT_NETPS2,
+ PROT_NETSCPS2, PROT_SYSMOUSE, PROT_AUTO, PROT_ACECAD
+ };
+#define PROT_DEFAULT -2 /* PROT_UNKNOWN */
+#endif
+
+ if (mapping == TO_MISC) {
+#ifndef NEW_INPUT
+ if ((MouseProtocol) proto == PROT_OSMOUSE)
+ return MTYPE_OSMOUSE;
+#endif
+ if (proto < 0 || proto >= sizeof(MapProto_ToMisc)/sizeof(int))
+ return MTYPE_UNKNOWN;
+ return MapProto_ToMisc[proto];
+ } else {
+#ifndef NEW_INPUT
+ if (proto == MTYPE_OSMOUSE || proto == MTYPE_XQUEUE)
+ return -1; /* PROT_OSMOUSE */
+#endif
+ if (proto < 0 || proto >= sizeof(MapProto_FromMisc)/sizeof(int))
+ return PROT_DEFAULT;
+ return MapProto_FromMisc[proto];
+ }
+#undef PROT_DEFAULT
+}
+
+Bool
+MiscExtGetMouseSettings(pointer *mouse, char **devname)
+{
+ mseParamsPtr mseptr;
+
+ DEBUG_P("MiscExtGetMouseSettings");
+
+ mseptr = MiscExtCreateStruct(MISC_KEYBOARD);
+ if (!mseptr)
+ return FALSE;
+
+#ifndef NEW_INPUT
+ *devname = xf86Info.mouseDev->mseDevice;
+ mseptr->type = MapMseProto(xf86Info.mouseDev->mseType, TO_MISC);
+#ifdef XQUEUE
+ if (xf86Info.mouseDev->mseProc == xf86XqueMseProc)
+ mseptr->type = MTYPE_XQUEUE;
+#endif
+#if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY)
+ if (xf86Info.mouseDev->mseProc == xf86OsMouseProc)
+ mseptr->type = MTYPE_OSMOUSE;
+#endif
+ mseptr->baudrate = xf86Info.mouseDev->baudRate;
+ mseptr->samplerate = xf86Info.mouseDev->sampleRate;
+ mseptr->resolution = xf86Info.mouseDev->resolution;
+ mseptr->buttons = xf86Info.mouseDev->buttons;
+ mseptr->em3buttons = xf86Info.mouseDev->emulate3Buttons;
+ mseptr->em3timeout = xf86Info.mouseDev->emulate3Timeout;
+ mseptr->chordmiddle = xf86Info.mouseDev->chordMiddle;
+ mseptr->flags = xf86Info.mouseDev->mouseFlags;
+#else
+ {
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (xf86IsCorePointer(pInfo->dev))
+ break;
+ pInfo = pInfo->next;
+ }
+ if (!pInfo)
+ return FALSE;
+
+ *devname = xf86FindOptionValue(pInfo->options, "Device");
+ pMse = pInfo->private;
+
+ mseptr->type = MapMseProto(pMse->protocolID, TO_MISC);
+ mseptr->baudrate = pMse->baudRate;
+ mseptr->samplerate = pMse->sampleRate;
+ mseptr->resolution = pMse->resolution;
+ mseptr->buttons = pMse->buttons;
+ mseptr->em3buttons = pMse->emulate3Buttons;
+ mseptr->em3timeout = pMse->emulate3Timeout;
+ mseptr->chordmiddle = pMse->chordMiddle;
+ mseptr->flags = pMse->mouseFlags;
+ mseptr->private = pInfo;
+ }
+#endif
+ *mouse = mseptr;
+ return TRUE;
+}
+
+int
+MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype)
+{
+ mseParamsPtr mse = mouse;
+
+ DEBUG_P("MiscExtGetMouseValue");
+
+ switch (valtype) {
+ case MISC_MSE_PROTO: return mse->type;
+ case MISC_MSE_BAUDRATE: return mse->baudrate;
+ case MISC_MSE_SAMPLERATE: return mse->samplerate;
+ case MISC_MSE_RESOLUTION: return mse->resolution;
+ case MISC_MSE_BUTTONS: return mse->buttons;
+ case MISC_MSE_EM3BUTTONS: return mse->em3buttons;
+ case MISC_MSE_EM3TIMEOUT: return mse->em3timeout;
+ case MISC_MSE_CHORDMIDDLE: return mse->chordmiddle;
+ case MISC_MSE_FLAGS: return mse->flags;
+ }
+ return 0;
+}
+
+Bool
+MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value)
+{
+ mseParamsPtr mse = mouse;
+
+ DEBUG_P("MiscExtSetMouseValue");
+
+ switch (valtype) {
+ case MISC_MSE_PROTO:
+ mse->type = value;
+ return TRUE;
+ case MISC_MSE_BAUDRATE:
+ mse->baudrate = value;
+ return TRUE;
+ case MISC_MSE_SAMPLERATE:
+ mse->samplerate = value;
+ return TRUE;
+ case MISC_MSE_RESOLUTION:
+ mse->resolution = value;
+ return TRUE;
+ case MISC_MSE_BUTTONS:
+ mse->buttons = value;
+ return TRUE;
+ case MISC_MSE_EM3BUTTONS:
+ mse->em3buttons = value;
+ return TRUE;
+ case MISC_MSE_EM3TIMEOUT:
+ mse->em3timeout = value;
+ return TRUE;
+ case MISC_MSE_CHORDMIDDLE:
+ mse->chordmiddle = value;
+ return TRUE;
+ case MISC_MSE_FLAGS:
+ mse->flags = value;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+Bool
+MiscExtGetKbdSettings(pointer *kbd)
+{
+ kbdParamsPtr kbdptr;
+
+ DEBUG_P("MiscExtGetKbdSettings");
+
+ kbdptr = MiscExtCreateStruct(MISC_KEYBOARD);
+ if (!kbdptr)
+ return FALSE;
+ kbdptr->type = xf86Info.kbdType;
+ kbdptr->rate = xf86Info.kbdRate;
+ kbdptr->delay = xf86Info.kbdDelay;
+ *kbd = kbdptr;
+ return TRUE;
+}
+
+int
+MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
+{
+ kbdParamsPtr kbd = keyboard;
+
+ DEBUG_P("MiscExtGetKbdValue");
+ switch (valtype) {
+ case MISC_KBD_TYPE: return kbd->type;
+ case MISC_KBD_RATE: return kbd->rate;
+ case MISC_KBD_DELAY: return kbd->delay;
+ case MISC_KBD_SERVNUMLOCK: return 0;
+ }
+ return 0;
+}
+
+Bool
+MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
+{
+ kbdParamsPtr kbd = keyboard;
+
+ DEBUG_P("MiscExtSetKbdValue");
+ switch (valtype) {
+ case MISC_KBD_TYPE:
+ kbd->type = value;
+ return TRUE;
+ case MISC_KBD_RATE:
+ kbd->rate = value;
+ return TRUE;
+ case MISC_KBD_DELAY:
+ kbd->delay = value;
+ return TRUE;
+ case MISC_KBD_SERVNUMLOCK:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+pointer
+MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
+{
+ DEBUG_P("MiscExtCreateStruct");
+
+ switch (mse_or_kbd) {
+ case MISC_POINTER:
+ return xcalloc(sizeof(mseParamsRec),1);
+ case MISC_KEYBOARD:
+ return xcalloc(sizeof(kbdParamsRec),1);
+ }
+ return 0;
+}
+
+void
+MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd)
+{
+ DEBUG_P("MiscExtDestroyStruct");
+
+ switch (mse_or_kbd) {
+ case MISC_POINTER:
+ case MISC_KEYBOARD:
+ xfree(structure);
+ }
+}
+
+MiscExtReturn
+MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
+{
+ DEBUG_P("MiscExtApply");
+
+ if (mse_or_kbd == MISC_POINTER) {
+ Bool reopen = FALSE;
+ mseParamsPtr mse = structure;
+#ifndef NEW_INPUT
+ int msetype;
+#else
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ MouseProtocolPtr protocol;
+ char tmpbuf[128];
+#endif
+
+ if (mse->type < MTYPE_MICROSOFT
+ || ( mse->type > MTYPE_ACECAD
+ && (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE)))
+ return MISC_RET_BADMSEPROTO;
+#ifdef OSMOUSE_ONLY
+ if (mse->type != MTYPE_OSMOUSE)
+ return MISC_RET_BADMSEPROTO;
+#else
+#if !defined(XQUEUE) || defined(NEW_INPUT)
+ if (mse->type == MTYPE_XQUEUE)
+ return MISC_RET_BADMSEPROTO;
+#endif
+#if !defined(USE_OSMOUSE) || defined(NEW_INPUT)
+ if (mse->type == MTYPE_OSMOUSE)
+ return MISC_RET_BADMSEPROTO;
+#endif
+#endif /* OSMOUSE_ONLY */
+
+ if (mse->em3timeout < 0)
+ return MISC_RET_BADVAL;
+
+ if (mse->type == MTYPE_LOGIMAN
+ && !(mse->baudrate == 1200 || mse->baudrate == 9600) )
+ return MISC_RET_BADBAUDRATE;
+ if (mse->type == MTYPE_LOGIMAN && mse->samplerate)
+ return MISC_RET_BADCOMBO;
+
+#ifndef NEW_INPUT
+ msetype = xf86Info.mouseDev->mseType;
+#ifdef XQUEUE
+ if (xf86Info.mouseDev->mseProc == xf86XqueMseProc)
+ msetype = MTYPE_XQUEUE;
+#endif
+#if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY)
+ if (xf86Info.mouseDev->mseProc == xf86OsMouseProc)
+ msetype = MTYPE_OSMOUSE;
+#endif
+
+ if (mse->type != msetype) {
+ if (mse->type == MTYPE_XQUEUE || mse->type == MTYPE_OSMOUSE
+ || msetype == MTYPE_XQUEUE || msetype == MTYPE_OSMOUSE)
+ return MISC_RET_BADMSEPROTO;
+ else
+ reopen = TRUE;
+ }
+#endif /* NEW_INPUT */
+
+ if (mse->flags & MF_REOPEN) {
+ reopen = TRUE;
+ mse->flags &= ~MF_REOPEN;
+ }
+ if (mse->type != MTYPE_OSMOUSE
+ && mse->type != MTYPE_XQUEUE
+ && mse->type != MTYPE_PS_2
+ && mse->type != MTYPE_BUSMOUSE
+ && mse->type != MTYPE_IMPS2
+ && mse->type != MTYPE_THINKINGPS2
+ && mse->type != MTYPE_MMANPLUSPS2
+ && mse->type != MTYPE_GLIDEPOINTPS2
+ && mse->type != MTYPE_NETPS2
+ && mse->type != MTYPE_NETSCROLLPS2
+ && mse->type != MTYPE_SYSMOUSE)
+ {
+ if (mse->baudrate % 1200 != 0
+ || mse->baudrate < 1200 || mse->baudrate > 9600)
+ return MISC_RET_BADBAUDRATE;
+ }
+ if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS))
+ && (mse->type != MTYPE_MOUSESYS))
+ return MISC_RET_BADFLAGS;
+
+ if (mse->type != MTYPE_OSMOUSE
+ && mse->type != MTYPE_XQUEUE
+ && mse->type != MTYPE_BUSMOUSE)
+ {
+ if (mse->samplerate < 0)
+ return MISC_RET_BADVAL;
+ }
+
+ if (mse->resolution < 0)
+ return MISC_RET_BADVAL;
+ if (mse->chordmiddle)
+ {
+ if (mse->em3buttons || !(mse->type == MTYPE_MICROSOFT
+ || mse->type == MTYPE_LOGIMAN) )
+ return MISC_RET_BADCOMBO;
+ }
+
+#ifndef NEW_INPUT
+ if (xf86Info.mouseDev->mseType != MapMseProto(mse->type, FROM_MISC)
+ || xf86Info.mouseDev->baudRate != mse->baudRate
+ || xf86Info.mouseDev->sampleRate != mse->sampleRate
+ || xf86Info.mouseDev->resolution != mse->resolution
+ || xf86Info.mouseDev->mouseFlags != mse->flags)
+ reopen = TRUE;
+
+ if (reopen && msetype != MTYPE_OSMOUSE && msetype != MTYPE_XQUEUE)
+ (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_CLOSE);
+
+ xf86Info.mouseDev->mseType = MapMseProto(mse->type, FROM_MISC);
+ xf86Info.mouseDev->baudRate = mse->baudRate;
+ xf86Info.mouseDev->sampleRate = mse->sampleRate;
+ xf86Info.mouseDev->resolution = mse->resolution;
+ xf86Info.mouseDev->buttons = mse->buttons;
+ xf86Info.mouseDev->emulate3Buttons = mse->em3buttons;
+ xf86Info.mouseDev->emulate3Timeout = mse->em3timeout;
+ xf86Info.mouseDev->chordMiddle = mse->chordMiddle;
+ xf86Info.mouseDev->mouseFlags = mse->flags;
+
+ if (reopen && msetype != MTYPE_OSMOUSE && msetype != MTYPE_XQUEUE) {
+ xf86Info.pMouse->public.on = FALSE;
+ xf86AllowMouseOpenFail = TRUE;
+ xf86MouseInit(xf86Info.mouseDev);
+ (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_ON);
+ }
+#else /* NEW_INPUT */
+ /* XXX - This still needs work */
+
+ pInfo = mse->private;
+ pMse = pInfo->private;
+
+ if (pMse->protocolID != MapMseProto(mse->type, FROM_MISC)
+ || pMse->baudRate != mse->baudrate
+ || pMse->sampleRate != mse->samplerate
+ || pMse->resolution != mse->resolution
+ || pMse->mouseFlags != mse->flags)
+ reopen = TRUE;
+
+ if (reopen)
+ (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE);
+
+ pMse->protocolID = MapMseProto(mse->type, FROM_MISC);
+ pMse->baudRate = mse->baudrate;
+ pMse->sampleRate = mse->samplerate;
+ pMse->resolution = mse->resolution;
+ pMse->buttons = mse->buttons;
+ pMse->emulate3Buttons = mse->em3buttons;
+ pMse->emulate3Timeout = mse->em3timeout;
+ pMse->chordMiddle = mse->chordmiddle;
+ pMse->mouseFlags = mse->flags;
+
+ pMse->protocol = xf86ProtocolIDToName(pMse->protocolID);
+ if (reopen)
+ (pMse->device->deviceProc)(pMse->device, DEVICE_ON);
+ /* Set pInfo->options too */
+
+#endif /* NEW_INPUT */
+ }
+ if (mse_or_kbd == MISC_KEYBOARD) {
+ kbdParamsPtr kbd = structure;
+
+ if (kbd->rate < 0)
+ return MISC_RET_BADVAL;
+ if (kbd->delay < 0)
+ return MISC_RET_BADVAL;
+ if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE)
+ return MISC_RET_BADKBDTYPE;
+
+ if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) {
+ char rad;
+
+ xf86Info.kbdRate = kbd->rate;
+ xf86Info.kbdDelay = kbd->delay;
+ if (xf86Info.kbdDelay <= 375) rad = 0x00;
+ else if (xf86Info.kbdDelay <= 625) rad = 0x20;
+ else if (xf86Info.kbdDelay <= 875) rad = 0x40;
+ else rad = 0x60;
+
+ if (xf86Info.kbdRate <= 2) rad |= 0x1F;
+ else if (xf86Info.kbdRate >= 30) rad |= 0x00;
+ else rad |= ((58/xf86Info.kbdRate)-2);
+
+ xf86SetKbdRepeat(rad);
+ }
+#if 0 /* Not done yet */
+ xf86Info.kbdType = kbd->kbdtype;
+#endif
+ }
+ return MISC_RET_SUCCESS;
+}
+
+#endif /* XF86MISC */
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
new file mode 100644
index 000000000..115a29929
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c
@@ -0,0 +1,1280 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.20 1999/08/01 07:57:11 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997,1998 by The XFree86 Project, Inc.
+ *
+ * Authors: Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ *
+ * This file includes helper functions for mode related things.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "mibank.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * xf86GetNearestClock --
+ * Find closest clock to given frequency (in kHz). This assumes the
+ * number of clocks is greater than zero.
+ */
+int
+xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider)
+{
+ int nearestClock = 0, nearestDiv = 1;
+ int minimumGap = abs(freq - scrp->clock[0]);
+ int i, j, k, gap;
+
+ if (allowDiv2)
+ k = 2;
+ else
+ k = 1;
+
+ /* Must set this here in case the best match is scrp->clock[0] */
+ if (divider != NULL)
+ *divider = 0;
+
+ for (i = 0; i < scrp->numClocks; i++) {
+ for (j = 1; j <= k; j++) {
+ gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor));
+ if ((gap < minimumGap) ||
+ ((gap == minimumGap) && (j < nearestDiv))) {
+ minimumGap = gap;
+ nearestClock = i;
+ nearestDiv = j;
+ if (divider != NULL)
+ *divider = (j - 1) * V_CLKDIV2;
+ }
+ }
+ }
+ return nearestClock;
+}
+
+/*
+ * xf86ModeStatusToString
+ *
+ * Convert a ModeStatus value to a printable message
+ */
+
+const char *
+xf86ModeStatusToString(ModeStatus status)
+{
+ switch (status) {
+ case MODE_OK:
+ return "Mode OK";
+ case MODE_HSYNC:
+ return "hsync out of range";
+ case MODE_VSYNC:
+ return "vrefresh out of range";
+ case MODE_H_ILLEGAL:
+ return "illegal horizontal timings";
+ case MODE_V_ILLEGAL:
+ return "illegal vertical timings";
+ case MODE_BAD_WIDTH:
+ return "width requires unsupported line pitch";
+ case MODE_NOMODE:
+ return "no mode of this name";
+ case MODE_NO_INTERLACE:
+ return "interlace mode not supported";
+ case MODE_NO_DBLESCAN:
+ return "doublescan mode not supported";
+ case MODE_NO_VSCAN:
+ return "multiscan mode not supported";
+ case MODE_MEM:
+ return "insufficient memory for mode";
+ case MODE_VIRTUAL_X:
+ return "width too large for virtual size";
+ case MODE_VIRTUAL_Y:
+ return "height too large for virtual size";
+ case MODE_MEM_VIRT:
+ return "insufficient memory given virtual size";
+ case MODE_NOCLOCK:
+ return "no clock available for mode";
+ case MODE_CLOCK_HIGH:
+ return "mode clock too high";
+ case MODE_CLOCK_LOW:
+ return "mode clock too low";
+ case MODE_CLOCK_RANGE:
+ return "bad mode clock/interlace/doublescan";
+ case MODE_BAD_HVALUE:
+ return "horizontal timing out of range";
+ case MODE_BAD_VVALUE:
+ return "vertical timing out of range";
+ case MODE_BAD_VSCAN:
+ return "VScan value out of range";
+ case MODE_HSYNC_NARROW:
+ return "horizontal sync too narrow";
+ case MODE_HSYNC_WIDE:
+ return "horizontal sync too wide";
+ case MODE_HBLANK_NARROW:
+ return "horizontal blanking too narrow";
+ case MODE_HBLANK_WIDE:
+ return "horizontal blanking too wide";
+ case MODE_VSYNC_NARROW:
+ return "vertical sync too narrow";
+ case MODE_VSYNC_WIDE:
+ return "vertical sync too wide";
+ case MODE_VBLANK_NARROW:
+ return "vertical blanking too narrow";
+ case MODE_VBLANK_WIDE:
+ return "vertical blanking too wide";
+ case MODE_PANEL:
+ return "exceeds panel dimensions";
+ case MODE_BAD:
+ return "unknown reason";
+ case MODE_ERROR:
+ return "internal error";
+ }
+ return "unknown";
+}
+
+/*
+ * xf86ShowClockRanges() -- Print the clock ranges allowed
+ * and the clock values scaled by ClockMulFactor and ClockDivFactor
+ */
+void
+xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges)
+{
+ ClockRangePtr cp;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int i, j;
+ int scaledClock;
+
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ DivFactor = max(1, cp->ClockDivFactor);
+ MulFactor = max(1, cp->ClockMulFactor);
+ if (scrp->progClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO, "clock range: %6.2f to %6.2f MHz\n",
+ (double)cp->minClock / 1000.0, (double)cp->maxClock / 1000);
+ } else if (DivFactor > 1 || MulFactor > 1) {
+ j = 0;
+ for (i = 0; i < scrp->numClocks; i++) {
+ scaledClock = (scrp->clock[i] * DivFactor) / MulFactor;
+ if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) {
+ if ((j % 8) == 0) {
+ if (j > 0)
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:");
+ }
+ xf86ErrorF(" %6.2f", (double)scaledClock / 1000.0);
+ j++;
+ }
+ }
+ xf86ErrorF("\n");
+ }
+ }
+}
+
+/*
+ * xf86HandleBuiltinMode() - handles built-in modes
+ */
+static ModeStatus
+xf86HandleBuiltinMode(ScrnInfoPtr scrp,
+ DisplayModePtr p,
+ DisplayModePtr modep,
+ ClockRangePtr clockRanges,
+ Bool allowDiv2)
+{
+ ClockRangePtr cp;
+ int extraFlags = 0;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int clockIndex;
+
+ if ((p->type & M_T_CLOCK_C) == M_T_CLOCK_C) {
+ /* Check clock is in range */
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ if ((cp->minClock <= p->Clock) &&
+ (cp->maxClock >= p->Clock) &&
+ (cp->interlaceAllowed ||
+ !(p->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((!(p->Flags & V_DBLSCAN)) && (p->VScan <= 1))))
+ break;
+ }
+ if (cp == NULL){
+ modep->type = p->type;
+ return MODE_CLOCK_RANGE;
+ }
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ if (!scrp->progClock) {
+ clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor,
+ cp->ClockMulFactor, &extraFlags);
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor)
+ / MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
+ } else {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor)
+ / DivFactor;
+ }
+ modep->PrivFlags = cp->PrivFlags;
+ } else {
+ if(!scrp->progClock) {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = p->ClockIndex;
+ modep->SynthClock = p->SynthClock;
+ } else {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = p->SynthClock;
+ }
+ modep->PrivFlags = p->PrivFlags;
+ }
+ modep->type = p->type;
+ modep->HDisplay = p->HDisplay;
+ modep->HSyncStart = p->HSyncStart;
+ modep->HSyncEnd = p->HSyncEnd;
+ modep->HTotal = p->HTotal;
+ modep->HSkew = p->HSkew;
+ modep->VDisplay = p->VDisplay;
+ modep->VSyncStart = p->VSyncStart;
+ modep->VSyncEnd = p->VSyncEnd;
+ modep->VTotal = p->VTotal;
+ modep->VScan = p->VScan;
+ modep->Flags = p->Flags | extraFlags;
+ modep->CrtcHDisplay = p->CrtcHDisplay;
+ modep->CrtcHSyncStart = p->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = p->CrtcHSyncEnd;
+ modep->CrtcHTotal = p->CrtcHTotal;
+ modep->CrtcHSkew = p->CrtcHSkew;
+ modep->CrtcVDisplay = p->CrtcVDisplay;
+ modep->CrtcVSyncStart = p->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = p->CrtcVSyncEnd;
+ modep->CrtcVTotal = p->CrtcVTotal;
+ modep->CrtcHAdjusted = p->CrtcHAdjusted;
+ modep->CrtcVAdjusted = p->CrtcVAdjusted;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86LookupMode
+ *
+ * This function returns a mode from the given list which matches the
+ * given name. When multiple modes with the same name are available,
+ * the method of picking the matching mode is determined by the
+ * strategy selected. There is an implicit assumption in this that modes
+ * with the same name are of the same size.
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * modep pointer to the returned mode, which must have the name
+ * field filled in.
+ * clockRanges a list of clock ranges
+ * strategy how to decide which mode to use from multiple modes with
+ * the same name
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * modePool the list of monitor modes compatible with the driver
+ * clocks a list of discrete clocks
+ * numClocks number of discrete clocks
+ * progClock clock is programmable
+ *
+ * If a mode was found, its values are filled in to the area pointed to
+ * by modep, If a mode was not found the return value indicates the
+ * reason.
+ */
+
+ModeStatus
+xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy)
+{
+ DisplayModePtr p, bestMode = NULL;
+ ClockRangePtr cp;
+ int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1;
+ double refresh, bestRefresh = 0.0;
+ Bool found = FALSE;
+ int extraFlags = 0;
+ int clockIndex = -1;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int ModePrivFlags = 0;
+ ModeStatus status = MODE_NOMODE;
+ Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
+ strategy &= ~LOOKUP_CLKDIV2;
+
+ /* Some sanity checking */
+ if (scrp == NULL || scrp->modePool == NULL ||
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n");
+ return MODE_ERROR;
+ }
+ if (modep == NULL || modep->name == NULL) {
+ ErrorF("xf86LookupMode: called with invalid modep\n");
+ return MODE_ERROR;
+ }
+ if (clockRanges == NULL) {
+ ErrorF("xf86LookupMode: called with invalid clockRanges\n");
+ return MODE_ERROR;
+ }
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ /* DivFactor and MulFactor must be > 0 */
+ cp->ClockDivFactor = max(1, cp->ClockDivFactor);
+ cp->ClockMulFactor = max(1, cp->ClockMulFactor);
+ }
+
+ /* Scan the mode pool for matching names */
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+ if (strcmp(p->name, modep->name) == 0) {
+
+ /*
+ * Requested mode is a built-in mode. Don't let the user
+ * override it.
+ * Since built-in modes always come before user specified
+ * modes it will always be found first.
+ */
+ if (p->type & M_T_BUILTIN)
+ return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
+ allowDiv2);
+
+ /* Check clock is in range */
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ if ((cp->minClock <= p->Clock) &&
+ (cp->maxClock >= p->Clock) &&
+ (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((!(p->Flags & V_DBLSCAN)) && (p->VScan <= 1))))
+ break;
+ }
+ if (cp == NULL) {
+ /*
+ * XXX Could do more here to provide a more detailed
+ * reason for not finding a mode.
+ */
+ if (!found)
+ status = MODE_CLOCK_RANGE;
+ continue;
+ }
+
+ /*
+ * If programmable clock and strategy is not LOOKUP_BEST_REFRESH,
+ * the required mode has been found, otherwise record the refresh
+ * and continue looking.
+ */
+ if (scrp->progClock) {
+ found = TRUE;
+ if (strategy != LOOKUP_BEST_REFRESH) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ break;
+ } else {
+ refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal;
+ if (p->Flags & V_INTERLACE) {
+ refresh *= 2.0;
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ }
+ if (p->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (p->VScan > 1)
+ refresh /= p->VScan;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ bestRefresh = refresh;
+ }
+ continue;
+ }
+ }
+
+ /*
+ * Clock is in range, so if it is not a programmable clock, find
+ * a matching clock.
+ */
+
+ i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor, &k);
+ /*
+ * If the clock is too far from the requested clock, this
+ * mode is no good.
+ */
+ if (k & V_CLKDIV2)
+ gap = abs((p->Clock * 2) -
+ ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
+ else
+ gap = abs(p->Clock -
+ ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
+ if (gap > minimumGap) {
+ if (!found)
+ status = MODE_NOCLOCK;
+ continue;
+ } else {
+ found = TRUE;
+ }
+
+ /*
+ * If strategy is neither LOOKUP_BEST_REFRESH or
+ * LOOKUP_CLOSEST_CLOCK the required mode has been found.
+ */
+ if (strategy != LOOKUP_BEST_REFRESH &&
+ strategy != LOOKUP_CLOSEST_CLOCK) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ break;
+ } else
+ /* Otherwise, record the refresh or gap and continue looking */
+ if (strategy == LOOKUP_BEST_REFRESH) {
+ refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal;
+ if (p->Flags & V_INTERLACE) {
+ refresh *= 2.0;
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ }
+ if (p->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (p->VScan > 1)
+ refresh /= p->VScan;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ bestRefresh = refresh;
+ }
+ continue;
+ } else if (strategy == LOOKUP_CLOSEST_CLOCK) {
+ if (gap < minimumGap) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ minimumGap = gap;
+ }
+ continue;
+ }
+ }
+ }
+ if (!found || bestMode == NULL)
+ return status;
+
+ /* Fill in the mode parameters */
+ if (scrp->progClock) {
+ modep->Clock = bestMode->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor) / DivFactor;
+ } else {
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
+ }
+ modep->type = bestMode->type;
+ modep->PrivFlags = ModePrivFlags;
+ modep->HDisplay = bestMode->HDisplay;
+ modep->HSyncStart = bestMode->HSyncStart;
+ modep->HSyncEnd = bestMode->HSyncEnd;
+ modep->HTotal = bestMode->HTotal;
+ modep->HSkew = bestMode->HSkew;
+ modep->VDisplay = bestMode->VDisplay;
+ modep->VSyncStart = bestMode->VSyncStart;
+ modep->VSyncEnd = bestMode->VSyncEnd;
+ modep->VTotal = bestMode->VTotal;
+ modep->VScan = bestMode->VScan;
+ modep->Flags = bestMode->Flags | extraFlags;
+ modep->CrtcHDisplay = bestMode->CrtcHDisplay;
+ modep->CrtcHSyncStart = bestMode->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd;
+ modep->CrtcHTotal = bestMode->CrtcHTotal;
+ modep->CrtcHSkew = bestMode->CrtcHSkew;
+ modep->CrtcVDisplay = bestMode->CrtcVDisplay;
+ modep->CrtcVSyncStart = bestMode->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd;
+ modep->CrtcVTotal = bestMode->CrtcVTotal;
+ modep->CrtcHAdjusted = bestMode->CrtcHAdjusted;
+ modep->CrtcVAdjusted = bestMode->CrtcVAdjusted;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86CheckModeForMonitor
+ *
+ * This function takes a mode and monitor description, and determines
+ * if the mode is valid for the monitor.
+ */
+
+ModeStatus
+xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
+{
+ int i;
+ float hsync, vrefresh;
+
+ /* Sanity checks */
+ if (mode == NULL || monitor == NULL) {
+ ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n");
+ return MODE_ERROR;
+ }
+
+ /* Some basic mode validity checks */
+ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
+ mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
+ return MODE_H_ILLEGAL;
+
+ if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart ||
+ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
+ return MODE_V_ILLEGAL;
+
+ /* Check hsync against the allowed ranges */
+ hsync = (float)mode->Clock / (float)mode->HTotal;
+ for (i = 0; i < monitor->nHsync; i++)
+ if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of sync ranges without finding a match */
+ if (i == monitor->nHsync)
+ return MODE_HSYNC;
+
+ /* Check vrefresh against the allowed ranges */
+ vrefresh = mode->Clock * 1000.0 / (mode->HTotal * mode->VTotal);
+ if (mode->Flags & V_INTERLACE)
+ vrefresh *= 2.0;
+ if (mode->Flags & V_DBLSCAN)
+ vrefresh /= 2.0;
+ if (mode->VScan > 1)
+ vrefresh /= (float)(mode->VScan);
+ for (i = 0; i < monitor->nVrefresh; i++)
+ if ((vrefresh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (vrefresh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of refresh ranges without finding a match */
+ if (i == monitor->nVrefresh)
+ return MODE_VSYNC;
+
+ /* Force interlaced modes to have an odd VTotal */
+ if (mode->Flags & V_INTERLACE)
+ mode->CrtcVTotal = mode->VTotal |= 1;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86InitialCheckModeForDriver
+ *
+ * This function checks if a mode satisfies a driver's initial requirements:
+ * - mode size fits within the available pixel area (memory)
+ * - width lies within the range of supported line pitches
+ * - mode size fits within virtual size (if fixed)
+ * - horizontal timings are in range
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * mode mode to check
+ * maxPitch (optional) maximum line pitch
+ * virtualX (optional) virtual width requested
+ * virtualY (optional) virtual height requested
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * fbFormat pixel format for the framebuffer
+ * videoRam video memory size (in kB)
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ */
+
+ModeStatus
+xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ int maxPitch, int virtualX, int virtualY)
+{
+ /* Sanity checks */
+ if (scrp == NULL || mode == NULL) {
+ ErrorF("xf86InitialCheckModeForDriver: "
+ "called with invalid parameters\n");
+ return MODE_ERROR;
+ }
+
+ if (mode->HDisplay * mode->VDisplay * scrp->fbFormat.bitsPerPixel >
+ scrp->videoRam * (1024 * 8))
+ return MODE_MEM;
+
+ if (maxPitch > 0 && mode->HDisplay > maxPitch)
+ return MODE_BAD_WIDTH;
+
+ if (virtualX > 0 && mode->HDisplay > virtualX)
+ return MODE_VIRTUAL_X;
+
+ if (virtualY > 0 && mode->VDisplay > virtualY)
+ return MODE_VIRTUAL_Y;
+
+ if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue)
+ return MODE_BAD_HVALUE;
+
+ if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue)
+ return MODE_BAD_VVALUE;
+
+ if (scrp->ValidMode)
+ return scrp->ValidMode(scrp->scrnIndex, mode, FALSE, 0);
+
+ /* Assume it is OK */
+ return MODE_OK;
+}
+
+/*
+ * xf86CheckModeForDriver
+ *
+ * This function is for checking modes while the server is running (for
+ * use mainly by the VidMode extension).
+ *
+ * This function checks if a mode satisfies a driver's requirements:
+ * - width lies within the line pitch
+ * - mode size fits within virtual size
+ * - horizontal/vertical timings are in range
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * mode mode to check
+ * flags not (currently) used
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ * virtualX virtual width
+ * virtualY virtual height
+ * clockRanges allowable clock ranges
+ */
+
+ModeStatus
+xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
+{
+/* To be implemented */
+ return MODE_OK;
+}
+
+/*
+ * xf86ValidateModes
+ *
+ * This function takes a set of mode names, modes and limiting conditions,
+ * and selects a set of modes and parameters based on those conditions.
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * availModes the list of modes available for the monitor
+ * modeNames list of mode names that the screen is requesting
+ * clockRanges a list of clock ranges
+ * linePitches (optional) a list of line pitches
+ * minPitch (optional) minimum line pitch (in pixels)
+ * maxPitch (optional) maximum line pitch (in pixels)
+ * pitchInc (mandatory) pitch increment (in bits)
+ * minHeight (optional) minimum virtual height (in pixels)
+ * maxHeight (optional) maximum virtual height (in pixels)
+ * virtualX (optional) virtual width requested (in pixels)
+ * virtualY (optional) virtual height requested (in pixels)
+ * apertureSize size of video aperture (in bytes)
+ * strategy how to decide which mode to use from multiple modes with
+ * the same name
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * clocks a list of discrete clocks
+ * numClocks number of discrete clocks
+ * progClock clock is programmable
+ * fbFormat format of the framebuffer
+ * videoRam video memory size
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ * xInc horizontal timing increment (defaults to 8 pixels)
+ *
+ * The function fills in the following ScrnInfoRec fields:
+ * modePool A subset of the modes available to the monitor which
+ * are compatible with the driver.
+ * modes one mode entry for each of the requested modes, with the
+ * status field filled in to indicate if the mode has been
+ * accepted or not.
+ * virtualX the resulting virtual width
+ * virtualY the resulting virtual height
+ * displayWidth the resulting line pitch
+ *
+ * The function's return value is the number of matching modes found, or -1
+ * if an unrecoverable error was encountered.
+ */
+
+int
+xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch, int pitchInc,
+ int minHeight, int maxHeight, int virtualX, int virtualY,
+ int apertureSize, LookupModeFlags strategy)
+{
+ /* XXX Implement checking against minHeight and maxHeight */
+
+ DisplayModePtr p, q, new;
+ int i, numModes = 0;
+ Bool firstMode = TRUE;
+ ModeStatus status;
+ int linePitch = -1, virtX = 0, virtY = 0;
+ int newLinePitch, newVirtX, newVirtY;
+ int pixelArea = scrp->videoRam * (1024 * 8); /* in bits */
+ int bitsPerPixel, pixmapPad;
+ PixmapFormatRec *BankFormat;
+
+ /* Some sanity checking */
+ if (scrp == NULL || scrp->name == NULL ||
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n");
+ return -1;
+ }
+ if (modeNames == NULL || modeNames[0] == NULL) {
+ ErrorF("xf86ValidateModes: called with invalid modeNames\n");
+ return -1;
+ }
+ if (linePitches != NULL && linePitches[0] <= 0) {
+ ErrorF("xf86ValidateModes: called with invalid linePitches\n");
+ return -1;
+ }
+ if (pitchInc <= 0) {
+ ErrorF("xf86ValidateModes: called with invalid pitchInc\n");
+ return -1;
+ }
+ if (clockRanges == NULL) {
+ ErrorF("xf86ValidateModes: called with invalid clockRanges\n");
+ return -1;
+ }
+ if ((virtualX > 0) != (virtualY > 0)) {
+ ErrorF("xf86ValidateModes: called with invalid virtual resolution\n");
+ return -1;
+ }
+
+ /* Determine which pixmap format to pass to miScanLineWidth() */
+ if (scrp->depth > 4)
+ BankFormat = &scrp->fbFormat;
+ else
+ BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */
+
+ bitsPerPixel = scrp->fbFormat.bitsPerPixel;
+ pixmapPad = scrp->fbFormat.scanlinePad;
+ if (scrp->depth == 4)
+ pixmapPad *= 4; /* 4 planes */
+
+ if (scrp->xInc <= 0)
+ scrp->xInc = 8; /* Suitable for VGA and others */
+
+#define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc)
+#define _VIDEOSIZE(w, x, y) \
+ ((((((w) * bitsPerPixel) + pixmapPad - 1) / pixmapPad) * pixmapPad * \
+ ((y) - 1)) + ((x) * bitsPerPixel))
+
+ /*
+ * Determine maxPitch if it wasn't given explicitly. Note linePitches
+ * always takes precedence if is non-NULL. In that case the minPitch and
+ * maxPitch values passed are ignored.
+ */
+ if (linePitches) {
+ minPitch = maxPitch = linePitches[0];
+ for (i = 1; linePitches[i] > 0; i++) {
+ if (linePitches[i] > maxPitch)
+ maxPitch = linePitches[i];
+ if (linePitches[i] < minPitch)
+ minPitch = linePitches[i];
+ }
+ }
+
+ /* Initial check of virtual size against other constraints */
+ scrp->virtualFrom = X_PROBED;
+ /*
+ * Initialise virtX and virtY if the values are fixed.
+ */
+ if (virtualY > 0) {
+ if (maxHeight > 0 && virtualY > maxHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too large for the hardware "
+ "(max %d)\n", virtualY, maxHeight);
+ return -1;
+ }
+
+ virtualX = _VIRTUALX(virtualX);
+ if (linePitches != NULL) {
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= virtualX) &&
+ (linePitches[i] ==
+ miScanLineWidth(virtualX, virtualY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ linePitch = linePitches[i];
+ break;
+ }
+ }
+ } else {
+ linePitch = miScanLineWidth(virtualX, virtualY, minPitch,
+ apertureSize, BankFormat, pitchInc);
+ }
+
+ if ((linePitch < minPitch) || (linePitch > maxPitch)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual width (%d) is too large for the hardware "
+ "(max %d)\n", virtualX, maxPitch);
+ return -1;
+ }
+
+ if (_VIDEOSIZE(linePitch, virtualX, virtualY) > pixelArea) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual size (%dx%d) (pitch %d) exceeds video memory\n",
+ virtualX, virtualY, linePitch);
+ return -1;
+ }
+
+ virtX = virtualX;
+ virtY = virtualY;
+ scrp->virtualFrom = X_CONFIG;
+ }
+ /* Print clock ranges and scaled clocks */
+ xf86ShowClockRanges(scrp, clockRanges);
+
+ /*
+ * If scrp->modePool hasn't been setup yet, set it up now. This allows
+ * the modes that the driver definitely can't use to be weeded out
+ * early.
+ */
+ if (scrp->modePool == NULL) {
+ q = NULL;
+ for (p = availModes; p != NULL; p = p->next) {
+ status = xf86InitialCheckModeForDriver(scrp, p, maxPitch, virtualX,
+ virtualY);
+ if (status == MODE_OK) {
+ new = xnfalloc(sizeof(DisplayModeRec));
+ *new = *p;
+ new->next = NULL;
+ if (!q) {
+ scrp->modePool = new;
+ } else {
+ q->next = new;
+ }
+ new->prev = q;
+ q = new;
+ q->name = xnfstrdup(p->name);
+ } else {
+ if (p->type & M_T_BUILTIN)
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Built-in mode \"%s\" deleted (%s)\n", p->name,
+ xf86ModeStatusToString(status));
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Mode \"%s\" deleted (%s)\n", p->name,
+ xf86ModeStatusToString(status));
+ }
+ }
+ }
+
+ if (scrp->modePool == NULL) {
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n");
+ return 0;
+ }
+
+ /*
+ * Allocate one entry in scrp->modes for each named mode, if not already
+ * done.
+ */
+ if (scrp->modes == NULL) {
+ scrp->modes = xnfalloc(sizeof(DisplayModeRec));
+ scrp->modes->next = NULL;
+ scrp->modes->prev = NULL;
+ }
+ q = scrp->modes;
+ for (i = 0; modeNames[i] != NULL; i++) {
+ if (firstMode) {
+ firstMode = FALSE;
+ } else {
+ if (q->next == NULL) {
+ q->next = xnfalloc(sizeof(DisplayModeRec));
+ q->next->next = NULL;
+ q->next->name = NULL;
+ } else {
+ if (q->next->name)
+ xfree(q->next->name);
+ }
+ q->next->prev = q;
+ q = q->next;
+ }
+ q->name = xnfalloc(strlen(modeNames[i]) + 1);
+ strcpy(q->name, modeNames[i]);
+ q->type = 0;
+ }
+ q->next = NULL;
+ /*
+ * XXX Check if there are any remaining previously allocated entries
+ * which should be freed? (but there shouldn't normally be any such
+ * entries)
+ */
+
+ /* Lookup each mode */
+ for (p = scrp->modes; p != NULL; p = p->next) {
+ status = xf86LookupMode(scrp, p, clockRanges, strategy);
+ if (status == MODE_ERROR) {
+ ErrorF("xf86ValidateModes: "
+ "unexpected result from xf86LookupMode()\n");
+ return -1;
+ }
+ if (status != MODE_OK) {
+ p->status = status;
+ continue;
+ }
+
+ newLinePitch = linePitch;
+ newVirtX = virtX;
+ newVirtY = virtY;
+
+ /*
+ * Adjust virtual width and height if the mode is too large for the
+ * current values and if they are not fixed.
+ */
+ if (virtualX <= 0 && p->HDisplay > newVirtX)
+ newVirtX = _VIRTUALX(p->HDisplay);
+ if (virtualY <= 0 && p->VDisplay > newVirtY)
+ newVirtY = p->VDisplay;
+
+ /*
+ * If virtual resolution is to be increased, revalidate it.
+ */
+ if ((virtX != newVirtX) || (virtY != newVirtY)) {
+ if (linePitches != NULL) {
+ newLinePitch = -1;
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= newVirtX) &&
+ (linePitches[i] >= linePitch) &&
+ (linePitches[i] ==
+ miScanLineWidth(newVirtX, newVirtY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ newLinePitch = linePitches[i];
+ break;
+ }
+ }
+ } else {
+ if (linePitch < minPitch)
+ linePitch = minPitch;
+ newLinePitch = miScanLineWidth(newVirtX, newVirtY, linePitch,
+ apertureSize, BankFormat,
+ pitchInc);
+ }
+ if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) {
+ p->status = MODE_BAD_WIDTH;
+ continue;
+ }
+
+ /*
+ * Check that the pixel area required by the new virtual height
+ * and line pitch isn't too large.
+ */
+ if (_VIDEOSIZE(newLinePitch, newVirtX, newVirtY) > pixelArea) {
+ p->status = MODE_MEM_VIRT;
+ continue;
+ }
+
+ virtX = newVirtX;
+ virtY = newVirtY;
+ linePitch = newLinePitch;
+ }
+
+ /* Mode has passed all the tests */
+ p->status = MODE_OK;
+ numModes++;
+ }
+
+#undef _VIRTUALX
+#undef _VIDEOSIZE
+
+ /* Update the ScrnInfoRec parameters */
+
+ scrp->virtualX = virtX;
+ scrp->virtualY = virtY;
+ scrp->displayWidth = linePitch;
+
+ /* Make the mode list into a circular list by joining up the ends */
+ if (numModes > 0) {
+ p = scrp->modes;
+ while (p->next != NULL)
+ p = p->next;
+ /* p is now the last mode on the list */
+ p->next = scrp->modes;
+ scrp->modes->prev = p;
+ }
+
+ return numModes;
+}
+
+/*
+ * xf86DeleteMode
+ *
+ * This function removes a mode from a list of modes.
+ *
+ * There are two types of mode lists:
+ *
+ * - doubly linked linear lists, starting and ending in NULL
+ * - doubly linked circular lists
+ *
+ */
+
+void
+xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
+{
+ /* Catch the easy/insane cases */
+ if (modeList == NULL || *modeList == NULL || mode == NULL)
+ return;
+
+ /* If the mode is at the start of the list, move the start of the list */
+ if (*modeList == mode)
+ *modeList = mode->next;
+
+ /* If mode is the only one on the list, set the list to NULL */
+ if ((mode == mode->prev) && (mode->prev == mode->next)) {
+ *modeList = NULL;
+ } else {
+ if (mode->prev != NULL)
+ mode->prev->next = mode->next;
+ if (mode->next != NULL)
+ mode->next->prev = mode->prev;
+ }
+
+ xfree(mode->name);
+ xfree(mode);
+}
+
+/*
+ * xf86PruneMonitorModes
+ *
+ * Remove the monitor modes which are inconsistent with the monitor's
+ * specs.
+ */
+
+void
+xf86PruneMonitorModes(MonPtr monp)
+{
+ DisplayModePtr p, n;
+ ModeStatus status;
+ Bool first = TRUE;
+ float refresh;
+
+ p = monp->Modes;
+ while (p != NULL) {
+ n = p->next;
+ status = xf86CheckModeForMonitor(p, monp);
+ if (status != MODE_OK) {
+ if ((p->type & M_T_DEFAULT) == 0) {
+ if (first) {
+ first = FALSE;
+ xf86Msg(X_INFO, "Bad modes for monitor \"%s\"\n",
+ monp->id);
+ }
+ xf86Msg(X_INFO, " Mode \"%s\" deleted (%s", p->name, /*) */
+ xf86ModeStatusToString(status));
+ switch (status) {
+ case MODE_HSYNC:
+ xf86ErrorF(": %.2f kHz", (double)p->Clock / p->HTotal);
+ break;
+ case MODE_VSYNC:
+ refresh = p->Clock * 1000.0 / (p->HTotal * p->VTotal);
+ if (p->Flags & V_INTERLACE)
+ refresh *= 2.0;
+ if (p->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (p->VScan > 1)
+ refresh /= (float)(p->VScan);
+ xf86ErrorF(": %.2f Hz", refresh);
+ break;
+ default:
+ break;
+ }
+ xf86ErrorF( /*( */ ")\n");
+ }
+ xf86DeleteMode(&(monp->Modes), p);
+ }
+ p = n;
+ }
+}
+
+/*
+ * xf86PruneDriverModes
+ *
+ * Remove modes from the driver's mode list which have been marked as
+ * invalid.
+ */
+
+void
+xf86PruneDriverModes(ScrnInfoPtr scrp)
+{
+ DisplayModePtr first, p, n;
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ if (!(first = scrp->modes))
+ return;
+ n = p->next;
+ if (p->status != MODE_OK) {
+ if (p->type & M_T_BUILTIN)
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Built-in mode \"%s\" deleted (%s)\n", p->name,
+ xf86ModeStatusToString(p->status));
+ else if ((p->type & M_T_DEFAULT) == 0)
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Mode \"%s\" deleted (%s)\n", p->name,
+ xf86ModeStatusToString(p->status));
+ xf86DeleteMode(&(scrp->modes), p);
+ }
+ p = n;
+ } while (p != NULL && p != first);
+}
+
+
+/*
+ * xf86SetCrtcForModes
+ *
+ * Goes through the screen's mode list, and initialises the Crtc
+ * parameters for each mode. The initialisation includes adjustments
+ * for interlaced and double scan modes.
+ */
+void
+xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
+{
+ DisplayModePtr p;
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ if (!(p->type & M_T_BUILTIN) ||
+ ((p->type & M_T_CRTC_C) == M_T_CRTC_C)) {
+ p->CrtcHDisplay = p->HDisplay;
+ p->CrtcHSyncStart = p->HSyncStart;
+ p->CrtcHSyncEnd = p->HSyncEnd;
+ p->CrtcHTotal = p->HTotal;
+ p->CrtcHSkew = p->HSkew;
+ p->CrtcVDisplay = p->VDisplay;
+ p->CrtcVSyncStart = p->VSyncStart;
+ p->CrtcVSyncEnd = p->VSyncEnd;
+ p->CrtcVTotal = p->VTotal;
+ if ((p->Flags & V_INTERLACE) && (adjustFlags & INTERLACE_HALVE_V))
+ {
+ p->CrtcVDisplay /= 2;
+ p->CrtcVSyncStart /= 2;
+ p->CrtcVSyncEnd /= 2;
+ p->CrtcVTotal /= 2;
+ }
+ if (p->Flags & V_DBLSCAN) {
+ p->CrtcVDisplay *= 2;
+ p->CrtcVSyncStart *= 2;
+ p->CrtcVSyncEnd *= 2;
+ p->CrtcVTotal *= 2;
+ }
+ if (p->VScan > 1) {
+ p->CrtcVDisplay *= p->VScan;
+ p->CrtcVSyncStart *= p->VScan;
+ p->CrtcVSyncEnd *= p->VScan;
+ p->CrtcVTotal *= p->VScan;
+ }
+ p->CrtcHAdjusted = FALSE;
+ p->CrtcVAdjusted = FALSE;
+ p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
+ p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
+ if ((p->CrtcVBlankEnd - p->CrtcVBlankStart) >= 127) {
+ /*
+ * V Blanking size must be < 127.
+ * Moving blank start forward is safer than moving blank end
+ * back, since monitors clamp just AFTER the sync pulse (or in
+ * the sync pulse), but never before.
+ */
+ p->CrtcVBlankStart = p->CrtcVBlankEnd - 127;
+ }
+ p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
+ p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
+ if ((p->CrtcHBlankEnd - p->CrtcHBlankStart) >= 63 * 8) {
+ /*
+ * H Blanking size must be < 63*8. Same remark as above.
+ */
+ p->CrtcHBlankStart = p->CrtcHBlankEnd - 63 * 8;
+ }
+ }
+#ifdef DEBUG
+ ErrorF("%s %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
+ (p->type & M_T_DEFAULT) ? "(VESA)Mode" : "Mode",
+ p->name, p->CrtcHDisplay, p->CrtcHBlankStart,
+ p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd,
+ p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart,
+ p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd,
+ p->CrtcVTotal);
+#endif
+ p = p->next;
+ } while (p != NULL && p != scrp->modes);
+}
+
+
+void
+xf86PrintModes(ScrnInfoPtr scrp)
+{
+ DisplayModePtr p;
+ float hsync, refresh;
+ char *desc, *desc2, *prefix;
+
+ if (scrp == NULL)
+ return;
+
+ xf86DrvMsg(scrp->scrnIndex, scrp->virtualFrom, "Virtual size is %dx%d "
+ "(pitch %d)\n", scrp->virtualX, scrp->virtualY,
+ scrp->displayWidth);
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ desc = desc2 = "";
+ hsync = (float)p->Clock / (float)p->HTotal;
+ refresh = hsync * 1000.0 / p->VTotal;
+ if (p->Flags & V_INTERLACE) {
+ refresh *= 2.0;
+ desc = " (I)";
+ }
+ if (p->Flags & V_DBLSCAN) {
+ refresh /= 2.0;
+ desc = " (D)";
+ }
+ if (p->VScan > 1) {
+ refresh /= p->VScan;
+ desc2 = " (VScan)";
+ }
+ if (p->type & M_T_BUILTIN)
+ prefix = "Built-in mode";
+ else if (p->type & M_T_DEFAULT)
+ prefix = "VESA mode";
+ else
+ prefix = "Mode";
+ if (p->Clock == p->SynthClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n",
+ prefix, p->name, p->Clock / 1000.0, hsync, refresh,
+ desc, desc2);
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s \"%s\": %.1f MHz (scaled from %.1f MHz), "
+ "%.1f kHz, %.1f Hz%s%s\n",
+ prefix, p->name, p->Clock / 1000.0,
+ p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
+ }
+ p = p->next;
+ } while (p != NULL && p != scrp->modes);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
new file mode 100644
index 000000000..51c50f411
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h
@@ -0,0 +1,191 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.17 1999/07/06 11:38:14 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains the parts of the loader interface that are visible
+ * to modules. This is the only loader-related header that modules should
+ * include.
+ *
+ * It should include a bare minimum of other headers.
+ *
+ * Longer term, the module/loader code should probably live directly under
+ * Xserver/.
+ *
+ * XXX This file arguably belongs in xfree86/loader/.
+ */
+
+#ifndef _XF86MODULE_H
+#define _XF86MODULE_H
+
+#include "misc.h"
+#include "xf86Version.h"
+#ifndef NULL
+#define NULL 0
+#endif
+
+typedef enum {
+ LD_RESOLV_IFDONE = 0, /* only check if no more
+ delays pending */
+ LD_RESOLV_NOW = 1, /* finish one delay step */
+ LD_RESOLV_FORCE = 2 /* force checking... */
+} LoaderResolveOptions;
+
+#define DEFAULT_LIST ((char *)-1)
+
+/* This indicates a special module that doesn't have the usual entry point */
+#define EXTERN_MODULE ((pointer)-1)
+
+/* Built-in ABI classes. These definitions must not be changed. */
+#define ABI_CLASS_NONE NULL
+#define ABI_CLASS_ANSIC "XFree86 ANSI C Emulation"
+#define ABI_CLASS_VIDEODRV "XFree86 Video Driver"
+#define ABI_CLASS_XINPUT "XFree86 XInput driver"
+#define ABI_CLASS_EXTENSION "XFree86 Server Extension"
+#define ABI_CLASS_FONT "XFree86 Font Renderer"
+
+#define ABI_MINOR_MASK 0x0000FFFF
+#define ABI_MAJOR_MASK 0xFFFF0000
+#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
+#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
+#define SET_ABI_VERSION(maj, min) \
+ ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
+
+/*
+ * ABI versions. Each version has a major and minor revision. Modules
+ * using lower minor revisions must work with servers of a higher minor
+ * revision. There is no compatibility between different major revisions.
+ * Whenever the ABI_ANSIC_VERSION is changed, the others must also be
+ * changed. The minor revision mask is 0x0000FFFF and the major revision
+ * mask is 0xFFFF0000.
+ */
+#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 1)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 1)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 0)
+#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 0)
+#define ABI_FONT_VERSION SET_ABI_VERSION(0, 0)
+
+#define MODINFOSTRING1 0xef23fdc5
+#define MODINFOSTRING2 0x10dc023a
+
+#ifndef MODULEVENDORSTRING
+#define MODULEVENDORSTRING "The XFree86 Project"
+#endif
+
+/* Error return codes for errmaj. New codes must only be added at the end. */
+typedef enum {
+ LDR_NOERROR = 0,
+ LDR_NOMEM, /* memory allocation failed */
+ LDR_NOENT, /* Module file does not exist */
+ LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
+ LDR_NOSPACE, /* internal module array full */
+ LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
+ LDR_UNKTYPE, /* file is not a recognized module type */
+ LDR_NOLOAD, /* type specific loader failed */
+ LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
+ LDR_NOPORTOPEN, /* could not open port (check errmin) */
+ LDR_NOHARDWARE, /* could not query/initialize the hardware device */
+ LDR_MISMATCH, /* the module didn't match the spec'd requirments */
+ LDR_BADUSAGE, /* LoadModule is called with bad arguments */
+ LDR_INVALID, /* The module doesn't have a valid ModuleData object */
+ LDR_BADOS, /* The module doesn't support the OS */
+ LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
+} LoaderErrorCode;
+
+/*
+ * Some common module classes. The moduleclass can be used to identify
+ * that modules loaded are of the correct type. This is a finer
+ * classification than the ABI classes even though the default set of
+ * classes have the same names. For example, not all modules that require
+ * the video driver ABI are themselves video drivers.
+ */
+#define MOD_CLASS_NONE NULL
+#define MOD_CLASS_VIDEODRV "XFree86 Video Driver"
+#define MOD_CLASS_XINPUT "XFree86 XInput Driver"
+#define MOD_CLASS_FONT "XFree86 Font Renderer"
+#define MOD_CLASS_EXTENSION "XFree86 Server Extension"
+
+/* This structure is expected to be returned by the initfunc */
+typedef struct {
+ const char * modname; /* name of module, e.g. "foo" */
+ const char * vendor; /* vendor specific string */
+ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
+ CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
+ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* module-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class description */
+ CARD32 checksum[4]; /* contains a digital signature of the */
+ /* version info structure */
+} XF86ModuleVersionInfo;
+
+/*
+ * This structure can be used to callers of LoadModule and LoadSubModule to
+ * specify version and/or ABI requirements.
+ */
+typedef struct {
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* moudle-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class */
+} XF86ModReqInfo;
+
+/* values to indicate unspecified fields in XF86ModReqInfo. */
+#define MAJOR_UNSPEC 0xFF
+#define MINOR_UNSPEC 0xFF
+#define PATCH_UNSPEC 0xFFFF
+#define ABI_VERS_UNSPEC 0xFFFFFFFF
+
+#define INITARGS void
+
+typedef void (*InitExtension)(INITARGS);
+
+typedef struct {
+ InitExtension initFunc;
+ char * name;
+ Bool *disablePtr;
+ InitExtension setupFunc;
+} ExtensionModule;
+
+extern ExtensionModule extension[];
+
+/* Prototypes for Loader functions that are exported to modules */
+#ifndef IN_LOADER
+/* Prototypes with opaque pointers for use by modules */
+pointer LoadSubModule(pointer, const char *, const char **,
+ const char **, pointer, const XF86ModReqInfo *,
+ int *, int *);
+void UnloadSubModule(pointer);
+void LoadFont(pointer);
+#endif
+pointer LoaderSymbol(const char *);
+char **LoaderListDirs(const char **, const char **);
+void LoaderFreeDirList(char **);
+void LoaderErrorMsg(const char *, const char *, int, int);
+void LoadExtension(ExtensionModule *);
+void LoaderRefSymLists(const char **, ...);
+void LoaderRefSymbols(const char *, ...);
+void LoaderReqSymLists(const char **, ...);
+void LoaderReqSymbols(const char *, ...);
+int LoaderCheckUnresolved(int);
+void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
+
+typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
+typedef void (*ModuleTearDownProc)(pointer);
+#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*)
+#define MODULETEARDOWNPROTO(func) void func(pointer)
+
+typedef struct {
+ XF86ModuleVersionInfo * vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+} XF86ModuleData;
+
+#endif /* _XF86STR_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Mouse.c b/xc/programs/Xserver/hw/xfree86/common/xf86Mouse.c
new file mode 100644
index 000000000..bab33b6c8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Mouse.c
@@ -0,0 +1,1308 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mouse.c,v 1.15 1999/07/17 06:30:57 dawes Exp $ */
+/*
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * Copyright 1993 by David Dawes <dawes@xfree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Thomas Roell and David Dawes not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. Thomas Roell
+ * and David Dawes makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: xf86_Mouse.c /main/21 1996/10/27 11:05:32 kaleb $ */
+/* Patch for PS/2 Intellimouse - Tim Goodwin 1997-11-06. */
+
+/*
+ * [JCH-96/01/21] Added fourth button support for PROT_GLIDEPOINT mouse
+ * protocol.
+ */
+
+/*
+ * [TVO-97/03/05] Added microsoft IntelliMouse support
+ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+
+#ifdef XINPUT
+#include "xf86Xinput.h"
+#include "XI.h"
+#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h"
+#else
+#include "inputstr.h"
+#endif
+
+#ifdef XINPUT
+static int xf86MouseProc(DeviceIntPtr, int);
+static void xf86MouseReadInput(LocalDevicePtr);
+static LocalDevicePtr xf86MouseAllocate(void);
+#endif /* XINPUT */
+
+#ifndef MOUSE_PROTOCOL_IN_KERNEL
+/*
+ * List of mouse types supported by xf86MouseProtocol()
+ *
+ * For systems which do the mouse protocol translation in the kernel,
+ * this list should be defined in the appropriate *_io.c file under
+ * xf86/os-support.
+ */
+Bool xf86SupportedMouseTypes[NUM_PROTOCOLS] =
+{
+ TRUE, /* Microsoft */
+ TRUE, /* MouseSystems */
+ TRUE, /* MMSeries */
+ TRUE, /* Logitech */
+ TRUE, /* BusMouse */
+ TRUE, /* MouseMan */
+#if !defined(PC98)
+ TRUE, /* PS/2 */
+#else
+ FALSE, /* PS/2 */
+#endif
+ TRUE, /* Hitachi Tablet */
+ TRUE, /* ALPS GlidePoint (serial) */
+ TRUE, /* Microsoft IntelliMouse (serial) */
+ TRUE, /* Kensington ThinkingMouse (serial) */
+#if !defined(__FreeBSD__) && !defined(Lynx) && !defined(__NetBSD__)
+ TRUE, /* Microsoft IntelliMouse (PS/2) */
+ TRUE, /* Kensington ThinkingMouse (PS/2) */
+ TRUE, /* Logitech MouseMan+ (PS/2) */
+ TRUE, /* ALPS GlidePoint (PS/2) */
+ TRUE, /* Genius NetMouse (PS/2) */
+ TRUE, /* Genius NetScroll (PS/2) */
+#else
+ FALSE, /* Microsoft IntelliMouse (PS/2) */
+ FALSE, /* Kensington ThinkingMouse (PS/2) */
+ FALSE, /* Logitech MouseMan+ (PS/2) */
+ FALSE, /* ALPS GlidePoint (PS/2) */
+ FALSE, /* Genius NetMouse (PS/2) */
+ FALSE, /* Genius NetScroll (PS/2) */
+#endif /* __FreeBSD__, Lynx, __NetBSD__ */
+#if defined(__FreeBSD__)
+ TRUE, /* sysmouse */
+#else
+ FALSE, /* sysmouse */
+#endif
+#ifdef WSCONS_SUPPORT
+ TRUE, /* wsmouse */
+#else
+ FALSE, /* wsmouse */
+#endif
+#ifdef PNP_MOUSE
+ TRUE, /* auto */
+#else
+ FALSE, /* auto */
+#endif
+ TRUE /* Acecad tablets */
+};
+
+int xf86NumMouseTypes = sizeof(xf86SupportedMouseTypes) /
+ sizeof(xf86SupportedMouseTypes[0]);
+
+/*
+ * termio[s] c_cflag settings for each mouse type.
+ *
+ * For systems which do the mouse protocol translation in the kernel,
+ * this list should be defined in the appropriate *_io.c under
+ * xf86/os-support if it is required.
+ */
+
+unsigned short xf86MouseCflags[NUM_PROTOCOLS] =
+{
+ (CS7 | CREAD | CLOCAL | HUPCL ), /* MicroSoft */
+ (CS8 | CSTOPB | CREAD | CLOCAL | HUPCL ), /* MouseSystems */
+ (CS8 | PARENB | PARODD | CREAD | CLOCAL | HUPCL ), /* MMSeries */
+ (CS8 | CSTOPB | CREAD | CLOCAL | HUPCL ), /* Logitech */
+ 0, /* BusMouse */
+ (CS7 | CREAD | CLOCAL | HUPCL ), /* MouseMan,
+ [CHRIS-211092] */
+ 0, /* PS/2 */
+ (CS8 | CREAD | CLOCAL | HUPCL ), /* mmhitablet */
+ (CS7 | CREAD | CLOCAL | HUPCL ), /* GlidePoint */
+ (CS7 | CREAD | CLOCAL | HUPCL ), /* IntelliMouse */
+ (CS7 | CREAD | CLOCAL | HUPCL ), /* ThinkingMouse */
+ /* PS/2 variants */
+ 0, /* IntelliMouse */
+ 0, /* ThinkingMouse */
+ 0, /* MouseMan+ */
+ 0, /* GlidePoint */
+ 0, /* NetMouse */
+ 0, /* NetScroll */
+ 0, /* wsmouse */
+ 0, /* Sun Mouse */
+
+ (CS8 | CSTOPB | CREAD | CLOCAL | HUPCL ), /* sysmouse */
+ 0, /* auto */
+ (CS8 | PARENB | PARODD | CREAD | CLOCAL | HUPCL ) /* ACECAD */
+};
+
+
+
+/*
+ * xf86MouseSupported --
+ * Returns true if OS supports mousetype
+ */
+
+Bool
+xf86MouseSupported(mousetype)
+ int mousetype;
+{
+ if (mousetype < 0 || mousetype >= xf86NumMouseTypes)
+ {
+ return(FALSE);
+ }
+ return(xf86SupportedMouseTypes[mousetype]);
+}
+#endif /* ! MOUSE_PROTOCOL_IN_KERNEL */
+/*
+ * xf86SetupMouse --
+ * Sets up the mouse parameters
+ */
+
+#ifndef MOUSE_PROTOCOL_IN_KERNEL
+#define MF_SAFE 0x01 /* !inSync: Accept packet only if no header in data */
+static unsigned char proto[][8] = {
+ /* --header-- ---data--- packet -4th-byte- mouse */
+ /* mask id mask id bytes mask id flags */
+ { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, 0 }, /* MicroSoft */
+ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MF_SAFE }, /* MouseSystems */
+ { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, 0 }, /* MMSeries */
+ { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, 0 }, /* Logitech */
+ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, 0 }, /* BusMouse */
+ { 0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00, 0 }, /* MouseMan */
+ { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, 0 }, /* PS/2 mouse */
+ { 0xe0, 0x80, 0x80, 0x00, 3, 0x00, 0xff, 0 }, /* MM_HitTablet */
+ { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, 0 }, /* GlidePoint */
+ { 0x40, 0x40, 0x40, 0x00, 3, ~0x3f, 0x00, 0 }, /* IntelliMouse */
+ { 0x40, 0x40, 0x40, 0x00, 3, ~0x33, 0x00, 0 }, /* ThinkingMouse */
+ /* PS/2 variants */
+ { 0xc0, 0x00, 0x00, 0x00, 4, 0x00, 0xff, 0 }, /* IntelliMouse */
+ { 0x80, 0x80, 0x00, 0x00, 3, 0x00, 0xff, 0 }, /* ThinkingMouse */
+ { 0x08, 0x08, 0x00, 0x00, 3, 0x00, 0xff, 0 }, /* MouseMan+ */
+ { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff, 0 }, /* GlidePoint */
+ { 0xc0, 0x00, 0x00, 0x00, 4, 0x00, 0xff, 0 }, /* NetMouse */
+ { 0xc0, 0x00, 0x00, 0x00, 6, 0x00, 0xff, 0 }, /* NetScroll */
+
+ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, 0 }, /* sysmouse */
+#ifdef WSCONS_SUPPORT
+ { 0x00, 0x00, 0x00, 0x00, sizeof(struct wscons_event),
+ 0x00, 0x00, 0 }, /* wsmouse */
+#else
+ { 0x00, 0x00, 0x00, 0x00, 0, 0x00, 0xff, 0 }, /* wsmouse */
+#endif
+ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff }, /* Sun Mouse */
+ { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff }, /* dummy entry for auto - used only to fill space */
+ { 0x80, 0x80, 0x80, 0x00, 3, 0x00, 0xff }, /* ACECAD */
+};
+#endif /* ! MOUSE_PROTOCOL_IN_KERNEL */
+
+void
+xf86SetupMouse(mouse)
+MouseDevPtr mouse;
+{
+#if !defined(MOUSE_PROTOCOL_IN_KERNEL) || defined(MACH386)
+ /*
+ ** The following lines take care of the Logitech MouseMan protocols.
+ **
+ ** NOTE: There are different versions of both MouseMan and TrackMan!
+ ** Hence I add another protocol PROT_LOGIMAN, which the user can
+ ** specify as MouseMan in his XF86Config file. This entry was
+ ** formerly handled as a special case of PROT_MS. However, people
+ ** who don't have the middle button problem, can still specify
+ ** Microsoft and use PROT_MS.
+ **
+ ** By default, these mice should use a 3 byte Microsoft protocol
+ ** plus a 4th byte for the middle button. However, the mouse might
+ ** have switched to a different protocol before we use it, so I send
+ ** the proper sequence just in case.
+ **
+ ** NOTE: - all commands to (at least the European) MouseMan have to
+ ** be sent at 1200 Baud.
+ ** - each command starts with a '*'.
+ ** - whenever the MouseMan receives a '*', it will switch back
+ ** to 1200 Baud. Hence I have to select the desired protocol
+ ** first, then select the baud rate.
+ **
+ ** The protocols supported by the (European) MouseMan are:
+ ** - 5 byte packed binary protocol, as with the Mouse Systems
+ ** mouse. Selected by sequence "*U".
+ ** - 2 button 3 byte MicroSoft compatible protocol. Selected
+ ** by sequence "*V".
+ ** - 3 button 3+1 byte MicroSoft compatible protocol (default).
+ ** Selected by sequence "*X".
+ **
+ ** The following baud rates are supported:
+ ** - 1200 Baud (default). Selected by sequence "*n".
+ ** - 9600 Baud. Selected by sequence "*q".
+ **
+ ** Selecting a sample rate is no longer supported with the MouseMan!
+ ** Some additional lines in xf86Config.c take care of ill configured
+ ** baud rates and sample rates. (The user will get an error.)
+ ** [CHRIS-211092]
+ */
+
+#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE)
+ static struct {
+ int dproto;
+ int proto;
+ } devproto[] = {
+ { MOUSE_PROTO_MS, PROT_MS },
+ { MOUSE_PROTO_MSC, PROT_MSC },
+ { MOUSE_PROTO_LOGI, PROT_LOGI },
+ { MOUSE_PROTO_MM, PROT_MM },
+ { MOUSE_PROTO_LOGIMOUSEMAN, PROT_LOGIMAN },
+ { MOUSE_PROTO_BUS, PROT_BM },
+ { MOUSE_PROTO_INPORT, PROT_BM },
+ { MOUSE_PROTO_PS2, PROT_PS2 },
+ { MOUSE_PROTO_HITTAB, PROT_MMHIT },
+ { MOUSE_PROTO_GLIDEPOINT, PROT_GLIDEPOINT },
+ { MOUSE_PROTO_INTELLI, PROT_IMSERIAL },
+ { MOUSE_PROTO_THINK, PROT_THINKING },
+ { MOUSE_PROTO_SYSMOUSE, PROT_SYSMOUSE },
+ };
+ mousehw_t hw;
+ mousemode_t mode;
+#endif /* __FreeBSD__ */
+ unsigned char *param;
+ int paramlen;
+ int ps2param;
+ int i;
+
+ if (mouse->mseType != PROT_AUTO)
+ memcpy(mouse->protoPara, proto[mouse->mseType],
+ sizeof(mouse->protoPara));
+ else
+ memset(mouse->protoPara, 0, sizeof(mouse->protoPara));
+
+#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE)
+ /* set the driver operation level, if applicable */
+ i = 1;
+ ioctl(mouse->mseFd, MOUSE_SETLEVEL, &i);
+
+ /* interrogate the driver and get some intelligence on the device... */
+ hw.iftype = MOUSE_IF_UNKNOWN;
+ hw.model = MOUSE_MODEL_GENERIC;
+ ioctl(mouse->mseFd, MOUSE_GETHWINFO, &hw);
+ mouse->mseModel = hw.model;
+ if (ioctl(mouse->mseFd, MOUSE_GETMODE, &mode) == 0)
+ {
+ for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i)
+ if (mode.protocol == devproto[i].dproto)
+ {
+ mouse->mseType = devproto[i].proto;
+ memcpy(mouse->protoPara, proto[mouse->mseType],
+ sizeof(mouse->protoPara));
+ /* override some paramters */
+ mouse->protoPara[4] = mode.packetsize;
+ mouse->protoPara[0] = mode.syncmask[0];
+ mouse->protoPara[1] = mode.syncmask[1];
+ break;
+ }
+ if (i >= sizeof(devproto)/sizeof(devproto[0]))
+ ErrorF("xf86SetupMouse: Unknown mouse device protocol - %d\n",
+ mode.protocol);
+ }
+#endif /* __FreeBSD__ */
+
+#ifdef PNP_MOUSE
+ if (mouse->mseType == PROT_AUTO)
+ {
+ /* a PnP serial mouse? */
+ mouse->mseType = xf86GetPnPMouseProtocol(mouse);
+ if (mouse->mseType < 0)
+ mouse->mseType = PROT_AUTO;
+ else
+ memcpy(mouse->protoPara, proto[mouse->mseType],
+ sizeof(mouse->protoPara));
+ }
+#endif
+
+ param = NULL;
+ paramlen = 0;
+ ps2param = FALSE;
+ switch (mouse->mseType) {
+
+ case PROT_AUTO:
+ if (!xf86Info.allowMouseOpenFail)
+ FatalError("xf86SetupMouse: Cannot determine the mouse protocol\n");
+ else
+ ErrorF("xf86SetupMouse: Cannot determine the mouse protocol\n");
+ break;
+
+ case PROT_LOGI: /* Logitech Mice */
+ /*
+ * The baud rate selection command must be sent at the current
+ * baud rate; try all likely settings
+ */
+ xf86SetMouseSpeed(mouse, 9600, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ xf86SetMouseSpeed(mouse, 4800, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ xf86SetMouseSpeed(mouse, 2400, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ xf86SetMouseSpeed(mouse, 1200, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ /* select MM series data format */
+ write(mouse->mseFd, "S", 1);
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[PROT_MM]);
+ /* select report rate/frequency */
+ if (mouse->sampleRate <= 0) write(mouse->mseFd, "O", 1);
+ else if (mouse->sampleRate <= 15) write(mouse->mseFd, "J", 1);
+ else if (mouse->sampleRate <= 27) write(mouse->mseFd, "K", 1);
+ else if (mouse->sampleRate <= 42) write(mouse->mseFd, "L", 1);
+ else if (mouse->sampleRate <= 60) write(mouse->mseFd, "R", 1);
+ else if (mouse->sampleRate <= 85) write(mouse->mseFd, "M", 1);
+ else if (mouse->sampleRate <= 125) write(mouse->mseFd, "Q", 1);
+ else write(mouse->mseFd, "N", 1);
+ break;
+
+ case PROT_LOGIMAN:
+ xf86SetMouseSpeed(mouse, 1200, 1200, xf86MouseCflags[mouse->mseType]);
+ write(mouse->mseFd, "*X", 2);
+ xf86SetMouseSpeed(mouse, 1200, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ break;
+
+ case PROT_MMHIT: /* MM_HitTablet */
+ {
+ char speedcmd;
+
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ /*
+ * Initialize Hitachi PUMA Plus - Model 1212E to desired settings.
+ * The tablet must be configured to be in MM mode, NO parity,
+ * Binary Format. mouse->sampleRate controls the sensativity
+ * of the tablet. We only use this tablet for it's 4-button puck
+ * so we don't run in "Absolute Mode"
+ */
+ write(mouse->mseFd, "z8", 2); /* Set Parity = "NONE" */
+ usleep(50000);
+ write(mouse->mseFd, "zb", 2); /* Set Format = "Binary" */
+ usleep(50000);
+ write(mouse->mseFd, "@", 1); /* Set Report Mode = "Stream" */
+ usleep(50000);
+ write(mouse->mseFd, "R", 1); /* Set Output Rate = "45 rps" */
+ usleep(50000);
+ write(mouse->mseFd, "I\x20", 2); /* Set Incrememtal Mode "20" */
+ usleep(50000);
+ write(mouse->mseFd, "E", 1); /* Set Data Type = "Relative */
+ usleep(50000);
+ /* These sample rates translate to 'lines per inch' on the Hitachi
+ tablet */
+ if (mouse->sampleRate <= 40) speedcmd = 'g';
+ else if (mouse->sampleRate <= 100) speedcmd = 'd';
+ else if (mouse->sampleRate <= 200) speedcmd = 'e';
+ else if (mouse->sampleRate <= 500) speedcmd = 'h';
+ else if (mouse->sampleRate <= 1000) speedcmd = 'j';
+ else speedcmd = 'd';
+ write(mouse->mseFd, &speedcmd, 1);
+ usleep(50000);
+ write(mouse->mseFd, "\021", 1); /* Resume DATA output */
+ }
+ break;
+
+ case PROT_THINKING: /* ThinkingMouse */
+ {
+ fd_set fds;
+ char *s;
+ char c;
+
+ xf86SetMouseSpeed(mouse, 1200, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ /* this mouse may send a PnP ID string, ignore it */
+ usleep(200000);
+ xf86FlushInput(mouse->mseFd);
+ /* send the command to initialize the beast */
+ for (s = "E5E5"; *s; ++s) {
+ write(mouse->mseFd, s, 1);
+ FD_ZERO(&fds);
+ FD_SET(mouse->mseFd, &fds);
+ if (select(FD_SETSIZE, &fds, NULL, NULL, NULL) <= 0)
+ break;
+ read(mouse->mseFd, &c, 1);
+ if (c != *s)
+ break;
+ }
+ }
+ break;
+
+ case PROT_MSC: /* MouseSystems Corp */
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ usleep(100000);
+ xf86FlushInput(mouse->mseFd);
+#ifdef CLEARDTR_SUPPORT
+ if (mouse->mouseFlags & MF_CLEAR_DTR)
+ {
+ i = TIOCM_DTR;
+ ioctl(mouse->mseFd, TIOCMBIC, &i);
+ }
+ if (mouse->mouseFlags & MF_CLEAR_RTS)
+ {
+ i = TIOCM_RTS;
+ ioctl(mouse->mseFd, TIOCMBIC, &i);
+ }
+#endif
+ break;
+
+ case PROT_ACECAD:
+ xf86SetMouseSpeed(mouse, 9600, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ /* initialize */
+ /* a nul charactor resets */
+ write(mouse->mseFd, "", 1);
+ usleep(50000);
+ /* stream out relative mode high resolution increments of 1 */
+ write(mouse->mseFd, "@EeI!", 5);
+ break;
+
+#if defined(__FreeBSD__) && defined(MOUSE_PROTO_SYSMOUSE)
+ case PROT_SYSMOUSE:
+ if (hw.iftype == MOUSE_IF_SYSMOUSE || hw.iftype == MOUSE_IF_UNKNOWN)
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ /* fall through */
+
+ case PROT_PS2: /* standard PS/2 mouse */
+ case PROT_BM: /* bus/InPort mouse */
+ mode.rate =
+ (mouse->sampleRate > 0) ? mouse->sampleRate : -1;
+ mode.resolution =
+ (mouse->resolution > 0) ? mouse->resolution : -1;
+ mode.accelfactor = -1;
+ mode.level = -1;
+ ioctl(mouse->mseFd, MOUSE_SETMODE, &mode);
+ break;
+#else
+ case PROT_SYSMOUSE:
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ break;
+
+ case PROT_PS2: /* standard PS/2 mouse */
+ ps2param = TRUE;
+ break;
+
+ case PROT_BM: /* bus/InPort mouse */
+ break;
+#endif /* __FreeBSD__ */
+
+ case PROT_IMPS2: /* IntelliMouse */
+ {
+ static unsigned char s[] = { 243, 200, 243, 100, 243, 80, };
+
+ param = s;
+ paramlen = sizeof(s);
+ ps2param = TRUE;
+ }
+ break;
+
+ case PROT_NETPS2: /* NetMouse, NetMouse Pro, Mie Mouse */
+ case PROT_NETSCROLLPS2: /* NetScroll */
+ {
+ static unsigned char s[] = { 232, 3, 230, 230, 230, };
+
+ param = s;
+ paramlen = sizeof(s);
+ ps2param = TRUE;
+ }
+ break;
+
+ case PROT_MMANPLUSPS2: /* MouseMan+, FirstMouse+ */
+ {
+ static unsigned char s[] = { 230, 232, 0, 232, 3, 232, 2, 232, 1,
+ 230, 232, 3, 232, 1, 232, 2, 232, 3, };
+ param = s;
+ paramlen = sizeof(s);
+ ps2param = TRUE;
+ }
+ break;
+
+ case PROT_GLIDEPOINTPS2: /* GlidePoint */
+ ps2param = TRUE;
+ break;
+
+ case PROT_THINKINGPS2: /* ThinkingMouse */
+ {
+ static unsigned char s[] = { 243, 10, 232, 0, 243, 20, 243, 60,
+ 243, 40, 243, 20, 243, 20, 243, 60,
+ 243, 40, 243, 20, 243, 20, };
+ param = s;
+ paramlen = sizeof(s);
+ ps2param = TRUE;
+ }
+ break;
+
+ case PROT_WSMOUSE:
+ break;
+
+ case PROT_SUN:
+ break;
+
+ default:
+ xf86SetMouseSpeed(mouse, mouse->baudRate, mouse->baudRate,
+ xf86MouseCflags[mouse->mseType]);
+ break;
+ }
+
+ if (paramlen > 0)
+ {
+#ifdef EXTMOUSEDEBUG
+ char c[2];
+ for (i = 0; i < paramlen; ++i)
+ {
+ if (write(mouse->mseFd, &param[i], 1) != 1)
+ ErrorF("xf86SetupMouse: Write to mouse failed (%s)\n",
+ strerror(errno));
+ usleep(30000);
+ read(mouse->mseFd, c, 1);
+ ErrorF("xf86SetupMouse: got %02x\n", c[0]);
+ }
+#else
+ if (write(mouse->mseFd, param, paramlen) != paramlen)
+ ErrorF("xf86SetupMouse: Write to mouse failed (%s)\n",
+ strerror(errno));
+#endif
+ usleep(30000);
+ xf86FlushInput(mouse->mseFd);
+ }
+ if (ps2param)
+ {
+ unsigned char c[2];
+
+ c[0] = 230; /* 1:1 scaling */
+ write(mouse->mseFd, c, 1);
+ c[0] = 244; /* enable mouse */
+ write(mouse->mseFd, c, 1);
+ c[0] = 243; /* set sampling rate */
+ if (mouse->sampleRate > 0)
+ {
+ if (mouse->sampleRate >= 200)
+ c[1] = 200;
+ else if (mouse->sampleRate >= 100)
+ c[1] = 100;
+ else if (mouse->sampleRate >= 60)
+ c[1] = 60;
+ else if (mouse->sampleRate >= 40)
+ c[1] = 40;
+ else
+ c[1] = 20;
+ }
+ else
+ {
+ c[1] = 100;
+ }
+ write(mouse->mseFd, c, 2);
+ c[0] = 232; /* set device resolution */
+ if (mouse->resolution > 0)
+ {
+ if (mouse->resolution >= 200)
+ c[1] = 3;
+ else if (mouse->resolution >= 100)
+ c[1] = 2;
+ else if (mouse->resolution >= 50)
+ c[1] = 1;
+ else
+ c[1] = 0;
+ }
+ else
+ {
+ c[1] = 2;
+ }
+ write(mouse->mseFd, c, 2);
+ usleep(30000);
+ xf86FlushInput(mouse->mseFd);
+ }
+
+ mouse->protoBufTail = 0;
+ mouse->inSync = 0;
+#endif /* !MOUSE_PROTOCOL_IN_KERNEL || MACH386 */
+}
+
+#ifndef MOUSE_PROTOCOL_IN_KERNEL
+void
+xf86MouseProtocol(device, rBuf, nBytes)
+ DeviceIntPtr device;
+ unsigned char *rBuf;
+ int nBytes;
+{
+ MouseDevPtr mouse = MOUSE_DEV(device);
+ int i, j, buttons, dx, dy, dz, baddata;
+ int pBufP = mouse->protoBufTail;
+ unsigned char *pBuf = mouse->protoBuf;
+#ifdef WSCONS_SUPPORT
+ struct wscons_event ev;
+#endif
+
+#ifdef EXTMOUSEDEBUG2
+ ErrorF("received %d bytes",nBytes);
+ for ( i=0; i < nBytes; i++)
+ ErrorF(" %02x",rBuf[i]);
+ ErrorF("\n");
+#endif
+ for ( i=0; i < nBytes; i++) {
+
+ if (pBufP >= mouse->protoPara[4]) {
+
+ /*
+ * Buffer contains a full packet, which has already been processed:
+ * Empty the buffer and check for optional 4th byte, which will be
+ * processed directly, without being put into the buffer first ...
+ */
+
+ pBufP = 0;
+
+ if ((rBuf[i] & mouse->protoPara[0]) != mouse->protoPara[1] &&
+ (rBuf[i] & mouse->protoPara[5]) == mouse->protoPara[6])
+ {
+ /*
+ * Hack for Logitech MouseMan Mouse - Middle button
+ *
+ * Unfortunately this mouse has variable length packets: the standard
+ * Microsoft 3 byte packet plus an optional 4th byte whenever the
+ * middle button status changes.
+ *
+ * We have already processed the standard packet with the movement
+ * and button info. Now post an event message with the old status
+ * of the left and right buttons and the updated middle button.
+ */
+
+ /*
+ * Even worse, different MouseMen and TrackMen differ in the 4th
+ * byte: some will send 0x00/0x20, others 0x01/0x21, or even
+ * 0x02/0x22, so I have to strip off the lower bits. [CHRIS-211092]
+ *
+ * [JCH-96/01/21]
+ * HACK for ALPS "fourth button". (It's bit 0x10 of the "fourth byte"
+ * and it is activated by tapping the glidepad with the finger! 8^)
+ * We map it to bit bit3, and the reverse map in xf86Events just has
+ * to be extended so that it is identified as Button 4. The lower
+ * half of the reverse-map may remain unchanged.
+ */
+
+ /*
+ * [KAZU-030897]
+ * Receive the fourth byte only when preceeding three bytes have
+ * been detected (pBufP >= mouse->protoPara[4]). In the previous
+ * versions, the test was pBufP == 0; we may have mistakingly
+ * received a byte even if we didn't see anything preceeding
+ * the byte.
+ */
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF("mouse 4th byte %02x",rBuf[i]);
+#endif
+
+ dx = dy = dz = 0;
+ buttons = 0;
+ switch(mouse->mseType) {
+
+ /*
+ * [KAZU-221197]
+ * IntelliMouse, NetMouse (including NetMouse Pro) and Mie Mouse
+ * always send the fourth byte, whereas the fourth byte is
+ * optional for GlidePoint and ThinkingMouse. The fourth byte
+ * is also optional for MouseMan+ and FirstMouse+ in their
+ * native mode. It is always sent if they are in the IntelliMouse
+ * compatible mode.
+ */
+ case PROT_IMSERIAL: /* IntelliMouse, NetMouse, Mie Mouse,
+ MouseMan+ */
+ dz = (rBuf[i] & 0x08) ? (rBuf[i] & 0x0f) - 16 : (rBuf[i] & 0x0f);
+ buttons |= ((int)(rBuf[i] & 0x10) >> 3)
+ | ((int)(rBuf[i] & 0x20) >> 2)
+ | (mouse->lastButtons & 0x05);
+ break;
+
+ case PROT_GLIDEPOINT:
+ case PROT_THINKING:
+ buttons |= ((int)(rBuf[i] & 0x10) >> 1);
+ /* fall through */
+
+ default:
+ buttons |= ((int)(rBuf[i] & 0x20) >> 4) | (mouse->lastButtons & 0x05);
+ break;
+ }
+ goto post_event;
+ }
+ }
+ /* End of packet buffer flush and 4th byte hack. */
+
+ /*
+ * Append next byte to buffer (which is empty or contains an
+ * incomplete packet); iterate if packet (still) not complete.
+ */
+ pBuf[pBufP++] = rBuf[i];
+ if (pBufP != mouse->protoPara[4]) continue;
+
+ /*
+ * Hack for resyncing: We check here for a package that is:
+ * a) illegal (detected by wrong data-package header)
+ * b) invalid (0x80 == -128 and that might be wrong for MouseSystems)
+ * c) bad header-package
+ *
+ * NOTE: b) is a violation of the MouseSystems-Protocol, since values of
+ * -128 are allowed, but since they are very seldom we can easily
+ * use them as package-header with no button pressed.
+ * NOTE/2: On a PS/2 mouse any byte is valid as a data byte. Furthermore,
+ * 0x80 is not valid as a header byte. For a PS/2 mouse we skip
+ * checking data bytes.
+ * For resyncing a PS/2 mouse we require the two most significant
+ * bits in the header byte to be 0. These are the overflow bits,
+ * and in case of an overflow we actually lose sync. Overflows
+ * are very rare, however, and we quickly gain sync again after
+ * an overflow condition. This is the best we can do. (Actually,
+ * we could use bit 0x08 in the header byte for resyncing, since
+ * that bit is supposed to be always on, but nobody told
+ * Microsoft...)
+ */
+
+ /*
+ * [KAZU,OYVIND-120398]
+ * The above hack is wrong! Because of b) above, we shall see
+ * erroneous mouse events so often when the MouseSystem mouse is
+ * moved quickly. As for the PS/2 and its variants, we don't need
+ * to treat them as special cases, because protoPara[2] and
+ * protoPara[3] are both 0x00 for them, thus, any data bytes will
+ * never be discarded. 0x80 is rejected for MMSeries, Logitech
+ * and MMHittab protocols, because protoPara[2] and protoPara[3]
+ * are 0x80 and 0x00 respectively. The other protocols are 7-bit
+ * protocols; there is no use checking 0x80.
+ *
+ * All in all we should check the condition a) only.
+ */
+
+ /*
+ * [OYVIND-120498]
+ * Check packet for valid data:
+ * If driver is in sync with datastream, the packet is considered
+ * bad if any byte (header and/or data) contains an invalid value.
+ *
+ * If packet is bad, we discard the first byte and shift the buffer.
+ * Next iteration will then check the new situation for validity.
+ *
+ * If flag MF_SAFE is set in proto[7] and the driver
+ * is out of sync, the packet is also considered bad if
+ * any of the data bytes contains a valid header byte value.
+ * This situation could occur if the buffer contains
+ * the tail of one packet and the header of the next.
+ *
+ * Note: The driver starts in out-of-sync mode (mouse->inSync = 0).
+ */
+
+ baddata = 0;
+
+ /* All databytes must be valid. */
+ for ( j=1; j < pBufP; j++ )
+ if ((pBuf[j] & mouse->protoPara[2]) != mouse->protoPara[3])
+ baddata = 1;
+
+ /* If out of sync, don't mistake a header byte for data. */
+ if ((mouse->protoPara[7] & MF_SAFE) && !mouse->inSync)
+ for ( j=1; j < pBufP; j++ )
+ if ((pBuf[j] & mouse->protoPara[0]) == mouse->protoPara[1])
+ baddata = 1;
+
+ /* Accept or reject the packet ? */
+ if ((pBuf[0] & mouse->protoPara[0]) != mouse->protoPara[1] || baddata) {
+#ifdef EXTMOUSEDEBUG
+ if (mouse->inSync)
+ ErrorF("mouse driver lost sync\n");
+ ErrorF("skipping byte %02x\n",*pBuf);
+#endif
+ mouse->protoBufTail = --pBufP;
+ for ( j=0; j < pBufP; j++)
+ pBuf[j] = pBuf[j+1];
+ mouse->inSync = 0;
+ continue;
+ }
+
+ if (!mouse->inSync) {
+#ifdef EXTMOUSEDEBUG
+ ErrorF("mouse driver back in sync\n");
+#endif
+ mouse->inSync = 1;
+ }
+
+ /*
+ * Packet complete and verified, now process it ...
+ */
+
+ dz = 0;
+ switch(mouse->mseType) {
+
+ case PROT_LOGIMAN: /* MouseMan / TrackMan [CHRIS-211092] */
+ case PROT_MS: /* Microsoft */
+ if (mouse->chordMiddle)
+ buttons = (((int) pBuf[0] & 0x30) == 0x30) ? 2 :
+ ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4);
+ else
+ buttons = (mouse->lastButtons & 2)
+ | ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4);
+ dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
+ dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
+ break;
+
+ case PROT_GLIDEPOINT: /* ALPS GlidePoint */
+ case PROT_THINKING: /* ThinkingMouse */
+ case PROT_IMSERIAL: /* IntelliMouse, NetMouse, Mie Mouse, MouseMan+ */
+ buttons = (mouse->lastButtons & (8 + 2))
+ | ((int)(pBuf[0] & 0x20) >> 3)
+ | ((int)(pBuf[0] & 0x10) >> 4);
+ dx = (char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
+ dy = (char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
+ break;
+
+ case PROT_MSC: /* Mouse Systems Corp */
+ buttons = (~pBuf[0]) & 0x07;
+ dx = (char)(pBuf[1]) + (char)(pBuf[3]);
+ dy = - ((char)(pBuf[2]) + (char)(pBuf[4]));
+ break;
+
+ case PROT_MMHIT: /* MM_HitTablet */
+ buttons = pBuf[0] & 0x07;
+ if (buttons != 0)
+ buttons = 1 << (buttons - 1);
+ dx = (pBuf[0] & 0x10) ? pBuf[1] : - pBuf[1];
+ dy = (pBuf[0] & 0x08) ? - pBuf[2] : pBuf[2];
+ break;
+
+ case PROT_ACECAD: /* ACECAD */
+ /* ACECAD is almost exactly like MM but the buttons are different */
+ buttons = (pBuf[0] & 0x02) | ((pBuf[0] & 0x04) >> 2) | ((pBuf[0] & 1) << 2);
+ dx = (pBuf[0] & 0x10) ? pBuf[1] : - pBuf[1];
+ dy = (pBuf[0] & 0x08) ? - pBuf[2] : pBuf[2];
+ break;
+
+ case PROT_MM: /* MM Series */
+ case PROT_LOGI: /* Logitech Mice */
+ buttons = pBuf[0] & 0x07;
+ dx = (pBuf[0] & 0x10) ? pBuf[1] : - pBuf[1];
+ dy = (pBuf[0] & 0x08) ? - pBuf[2] : pBuf[2];
+ break;
+
+ case PROT_BM: /* BusMouse */
+ case PROT_SUN: /* Sun Mouse */
+#if defined(__NetBSD__)
+ case PROT_PS2:
+#endif
+ buttons = (~pBuf[0]) & 0x07;
+ dx = (char)pBuf[1];
+ dy = - (char)pBuf[2];
+ break;
+
+#if !defined(__NetBSD__)
+ case PROT_PS2: /* PS/2 mouse */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2; /* Left */
+ dx = (pBuf[0] & 0x10) ? (int)pBuf[1]-256 : (int)pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -((int)pBuf[2]-256) : -(int)pBuf[2];
+ break;
+
+ /* PS/2 mouse variants */
+ case PROT_IMPS2: /* IntelliMouse PS/2 */
+ case PROT_NETPS2: /* NetMouse PS/2 */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2; /* Left */
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ dz = (char)pBuf[3];
+ break;
+
+ case PROT_MMANPLUSPS2: /* MouseMan+ PS/2 */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2; /* Left */
+ dx = (pBuf[0] & 0x10) ? pBuf[1] - 256 : pBuf[1];
+ if (((pBuf[0] & 0x48) == 0x48) &&
+ (abs(dx) > 191) &&
+ ((((pBuf[2] & 0x03) << 2) | 0x02) == (pBuf[1] & 0x0f))) {
+ /* extended data packet */
+ switch ((((pBuf[0] & 0x30) >> 2) | ((pBuf[1] & 0x30) >> 4))) {
+ case 1: /* wheel data packet */
+ buttons |= ((pBuf[2] & 0x10) ? 0x08 : 0) | /* fourth button */
+ ((pBuf[2] & 0x20) ? 0x10 : 0); /* fifth button */
+ dx = dy = 0;
+ dz = (pBuf[2] & 0x08) ? (pBuf[2] & 0x0f) - 16 :
+ (pBuf[2] & 0x0f);
+ break;
+ case 0: /* device type packet - shouldn't happen */
+ case 2: /* reserved packet - shouldn't happen */
+ default:
+ buttons |= (mouse->lastButtons & ~0x07);
+ dx = dy = 0;
+ dz = 0;
+ break;
+ }
+ } else {
+ buttons |= (mouse->lastButtons & ~0x07);
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ }
+ break;
+
+ case PROT_GLIDEPOINTPS2: /* GlidePoint PS/2 */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2 | /* Left */
+ ((pBuf[0] & 0x08) ? 0 : 0x08);/* fourth button */
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ break;
+
+ case PROT_NETSCROLLPS2: /* NetScroll PS/2 */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2 | /* Left */
+ ((pBuf[3] & 0x02) ? 0x08 : 0);/* fourth button */
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ dz = (pBuf[3] & 0x10) ? pBuf[4] - 256 : pBuf[4];
+ break;
+
+ case PROT_THINKINGPS2: /* ThinkingMouse PS/2 */
+ buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */
+ (pBuf[0] & 0x02) >> 1 | /* Right */
+ (pBuf[0] & 0x01) << 2 | /* Left */
+ ((pBuf[0] & 0x08) ? 0x08 : 0);/* fourth button */
+ pBuf[1] |= (pBuf[0] & 0x40) ? 0x80 : 0x00;
+ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1];
+ dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2];
+ break;
+
+#endif /* !__NetBSD__ */
+
+ case PROT_SYSMOUSE: /* sysmouse */
+ buttons = (~pBuf[0]) & 0x07;
+ dx = (char)(pBuf[1]) + (char)(pBuf[3]);
+ dy = - ((char)(pBuf[2]) + (char)(pBuf[4]));
+ /* FreeBSD sysmouse sends additional data bytes */
+ if (mouse->protoPara[4] >= 8)
+ {
+ dz = ((char)(pBuf[5] << 1) + (char)(pBuf[6] << 1))/2;
+ buttons |= (int)(~pBuf[7] & 0x07) << 3;
+ }
+ break;
+
+#ifdef WSCONS_SUPPORT
+ case PROT_WSMOUSE: /* wsmouse */
+ /* copy to guarantee alignment */
+ memcpy(&ev, pBuf, sizeof ev);
+ switch (ev.type) {
+ case WSCONS_EVENT_MOUSE_UP:
+ dx = dy = 0;
+#define BUTBIT (1 << (ev.value <= 2 ? 2 - ev.value : ev.value))
+ buttons = mouse->lastButtons & ~BUTBIT;
+ break;
+ case WSCONS_EVENT_MOUSE_DOWN:
+ dx = dy = 0;
+ buttons = mouse->lastButtons | BUTBIT;
+#undef BUTBIT
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_X:
+ dx = ev.value;
+ dy = 0;
+ buttons = mouse->lastButtons;
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_Y:
+ dx = 0;
+ dy = -ev.value;
+ buttons = mouse->lastButtons;
+ break;
+#ifdef WSCONS_EVENT_MOUSE_DELTA_Z
+ case WSCONS_EVENT_MOUSE_DELTA_Z:
+ dx = dy = 0;
+ dz = ev.value;
+ buttons = mouse->lastButtons;
+ break;
+#endif
+ default:
+ ErrorF("wsmouse: bad event type=%d\n", ev.type);
+ return;
+ }
+ break;
+#endif /* WSCONS_SUPPORT */
+
+ default: /* There's a table error */
+#ifdef EXTMOUSEDEBUG
+ ErrorF("mouse table error\n");
+#endif
+ continue;
+ }
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF("packet");
+ for ( j=0; j < pBufP; j++)
+ ErrorF(" %02x",pBuf[j]);
+#endif
+
+post_event:
+ /* map the Z axis movement */
+ switch (mouse->negativeZ) {
+ case 0: /* do nothing */
+ break;
+ case MSE_MAPTOX:
+ if (dz != 0)
+ {
+ dx = dz;
+ dz = 0;
+ }
+ break;
+ case MSE_MAPTOY:
+ if (dz != 0)
+ {
+ dy = dz;
+ dz = 0;
+ }
+ break;
+ default: /* buttons */
+ buttons &= ~(mouse->negativeZ | mouse->positiveZ);
+ if (dz < 0)
+ buttons |= mouse->negativeZ;
+ else if (dz > 0)
+ buttons |= mouse->positiveZ;
+ dz = 0;
+ break;
+ }
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF(": buttons %c%c%c%c%c delta (%d,%d)\n",
+ (buttons&0x10) ? '5' : '-',
+ (buttons&0x08) ? '4' : '-',
+ (buttons&0x04) ? '3' : '-',
+ (buttons&0x02) ? '2' : '-',
+ (buttons&0x01) ? '1' : '-',
+ dx, dy);
+#endif
+
+ /* post an event */
+ xf86PostMseEvent(device, buttons, dx, dy);
+
+ /*
+ * If dz has been mapped to a button `down' event, we need to cook
+ * up a corresponding button `up' event.
+ */
+ if( (mouse->negativeZ > 0) &&
+ (buttons & (mouse->negativeZ | mouse->positiveZ)))
+ {
+ buttons &= ~(mouse->negativeZ | mouse->positiveZ);
+ xf86PostMseEvent(device, buttons, 0, 0);
+ }
+
+ /*
+ * We don't reset pBufP here yet, as there may be an additional data
+ * byte in some protocols. See above.
+ */
+ }
+
+ mouse->protoBufTail = pBufP;
+}
+#endif /* MOUSE_PROTOCOL_IN_KERNEL */
+
+#ifdef XINPUT
+
+/*
+ * xf86MouseCtrl --
+ * Alter the control parameters for the mouse. Note that all special
+ * protocol values are handled by dix.
+ */
+
+void
+xf86MouseCtrl(device, ctrl)
+ DeviceIntPtr device;
+ PtrCtrl *ctrl;
+{
+ LocalDevicePtr local = (LocalDevicePtr)(device)->public.devicePrivate;
+ MouseDevPtr mouse = (MouseDevPtr) local->private;
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF("xf86MouseCtrl mouse=0x%x\n", mouse);
+#endif
+
+ mouse->num = ctrl->num;
+ mouse->den = ctrl->den;
+ mouse->threshold = ctrl->threshold;
+}
+
+/*
+ ***************************************************************************
+ *
+ * xf86MouseProc --
+ *
+ ***************************************************************************
+ */
+static int
+xf86MouseProc(device, what)
+ DeviceIntPtr device;
+ int what;
+{
+ LocalDevicePtr local = (LocalDevicePtr)device->public.devicePrivate;
+ MouseDevPtr mouse = (MouseDevPtr) local->private;
+ int fd;
+ int ret;
+
+ mouse->device = device;
+
+ ret = xf86MseProcAux(device, what, mouse, &fd, xf86MouseCtrl);
+
+ if (what == DEVICE_ON) {
+ local->fd = fd;
+ } else {
+ if ((what == DEVICE_INIT) &&
+ (ret == Success)) {
+#ifdef EXTMOUSEDEBUG
+ ErrorF("assigning 0x%x atom=%d name=%s\n", device,
+ local->atom, local->name);
+#endif
+ }
+ }
+
+ return ret;
+}
+
+/*
+ ***************************************************************************
+ *
+ * xf86MouseReadInput --
+ *
+ ***************************************************************************
+ */
+static void
+xf86MouseReadInput(local)
+ LocalDevicePtr local;
+{
+ MouseDevPtr mouse = (MouseDevPtr) local->private;
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF("xf86MouseReadInput mouse=0x%x\n", mouse);
+#endif
+
+ mouse->mseEvents(mouse);
+}
+
+/*
+ ***************************************************************************
+ *
+ * xf86MouseConvert --
+ * Convert valuators to X and Y.
+ *
+ ***************************************************************************
+ */
+static Bool
+xf86MouseConvert(LocalDevicePtr local,
+ int first,
+ int num,
+ int v0,
+ int v1,
+ int v2,
+ int v3,
+ int v4,
+ int v5,
+ int* x,
+ int* y)
+{
+ if (first != 0 || num != 2)
+ return FALSE;
+
+ *x = v0;
+ *y = v1;
+
+ return TRUE;
+}
+
+/*
+ ***************************************************************************
+ *
+ * xf86MouseAllocate --
+ *
+ ***************************************************************************
+ */
+static LocalDevicePtr
+xf86MouseAllocate()
+{
+ LocalDevicePtr local = xalloc(sizeof(LocalDeviceRec));
+ MouseDevPtr mouse = xalloc(sizeof(MouseDevRec));
+
+ local->name = "MOUSE";
+ local->type_name = XI_MOUSE;
+ local->flags = XI86_SEND_DRAG_EVENTS;
+ local->device_control = xf86MouseProc;
+ local->read_input = xf86MouseReadInput;
+ local->motion_history_proc = xf86GetMotionEvents;
+ local->history_size = 0;
+ local->control_proc = 0;
+ local->close_proc = 0;
+ local->switch_mode = 0;
+ local->conversion_proc = xf86MouseConvert;
+ local->reverse_conversion_proc = 0;
+ local->fd = -1;
+ local->dev = NULL;
+ local->private = mouse;
+ local->always_core_feedback = 0;
+
+ mouse->device = NULL;
+ mouse->mseFd = -1;
+ mouse->mseDevice = "";
+ mouse->mseType = -1;
+ mouse->mseModel = 0;
+ mouse->baudRate = -1;
+ mouse->oldBaudRate = -1;
+ mouse->sampleRate = -1;
+ mouse->resolution = 0;
+ mouse->buttons = MSE_DFLTBUTTONS;
+ mouse->negativeZ = 0;
+ mouse->positiveZ = 0;
+ mouse->local = local;
+
+#ifdef EXTMOUSEDEBUG
+ ErrorF("xf86MouseAllocate mouse=0x%x\n", local->private);
+#endif
+
+ return local;
+}
+
+/*
+ ***************************************************************************
+ *
+ * Mouse device association --
+ *
+ ***************************************************************************
+ */
+DeviceAssocRec mouse_assoc =
+{
+ "mouse", /* config_section_name */
+ xf86MouseAllocate /* device_allocate */
+};
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h
new file mode 100644
index 000000000..66571e416
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h
@@ -0,0 +1,79 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.9 1999/06/05 15:55:22 dawes Exp $ */
+
+/* Option handling things that ModuleSetup procs can use */
+
+#ifndef _XF86_OPT_H_
+#define _XF86_OPT_H_
+
+typedef struct {
+ double freq;
+ int units;
+} OptFrequency;
+
+typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+} ValueUnion;
+
+typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+} OptionValueType;
+
+typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+} OptFreqUnits;
+
+typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+} OptionInfoRec, *OptionInfoPtr;
+
+int xf86SetIntOption(pointer optlist, const char *name, int deflt);
+char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
+int xf86SetBoolOption(pointer list, const char *name, int deflt );
+pointer xf86AddNewOption(pointer head, char *name, char *val );
+pointer xf86NewOption(char *name, char *value );
+pointer xf86NextOption(pointer list );
+pointer xf86OptionListCreate(const char **options, int count, int used);
+pointer xf86OptionListMerge(pointer head, pointer tail);
+void xf86OptionListFree(pointer opt);
+char *xf86OptionName(pointer opt);
+char *xf86OptionValue(pointer opt);
+void xf86OptionListReport(pointer parm);
+pointer xf86FindOption(pointer options, const char *name);
+char *xf86FindOptionValue(pointer options, const char *name);
+void xf86MarkOptionUsed(pointer option);
+void xf86MarkOptionUsedByName(pointer options, const char *name);
+Bool xf86CheckIfOptionUsed(pointer option);
+Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
+void xf86ShowUnusedOptions(int scrnIndex, pointer options);
+void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
+OptionInfoPtr xf86TokenToOptinfo(OptionInfoPtr table, int token);
+const char *xf86TokenToOptName(OptionInfoPtr table, int token);
+Bool xf86IsOptionSet(OptionInfoPtr table, int token);
+char *xf86GetOptValString(OptionInfoPtr table, int token);
+Bool xf86GetOptValInteger(OptionInfoPtr table, int token, int *value);
+Bool xf86GetOptValULong(OptionInfoPtr table, int token, unsigned long *value);
+Bool xf86GetOptValReal(OptionInfoPtr table, int token, double *value);
+Bool xf86GetOptValFreq(OptionInfoPtr table, int token,
+ OptFreqUnits expectedUnits, double *value);
+Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value);
+Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def);
+int xf86NameCmp(const char *s1, const char *s2);
+char *xf86NormalizeName(const char *s);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c
new file mode 100644
index 000000000..1657b5028
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c
@@ -0,0 +1,728 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.14 1999/06/12 07:18:43 dawes Exp $ */
+
+/*
+ * Copyright (c) 1998 by The XFree86 Project, Inc.
+ *
+ * Author: David Dawes <dawes@xfree86.org>
+ *
+ *
+ * This file includes public option handling functions.
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86Optrec.h"
+
+static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p);
+
+/*
+ * xf86CollectOptions collects the options from each of the config file
+ * sections used by the screen and puts the combined list in pScrn->options.
+ * This function requires that the following have been initialised:
+ *
+ * pScrn->confScreen
+ * pScrn->Entities[i]->device
+ * pScrn->display
+ * pScrn->monitor
+ *
+ * The extraOpts parameter may optionally contain a list of additional options
+ * to include.
+ *
+ * The order of precedence for options is:
+ *
+ * extraOpts, display, confScreen, monitor, device
+ */
+
+void
+xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
+{
+ XF86OptionPtr tmp;
+ XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
+ EntityInfoPtr pEnt;
+
+ int i;
+
+ pScrn->options = NULL;
+
+ for (i=pScrn->numEntities - 1; i >= 0; i--) {
+ pEnt = xf86GetEntityInfo(pScrn->entityList[i]);
+ if (pEnt->device && pEnt->device->options) {
+ tmp = OptionListDup(pEnt->device->options);
+ if (pScrn->options)
+ OptionListMerge(pScrn->options,tmp);
+ else
+ pScrn->options = tmp;
+ }
+ xfree(pEnt);
+ }
+ if (pScrn->monitor->options) {
+ tmp = OptionListDup(pScrn->monitor->options);
+ if (pScrn->options)
+ pScrn->options = OptionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (pScrn->confScreen->options) {
+ tmp = OptionListDup(pScrn->confScreen->options);
+ if (pScrn->options)
+ pScrn->options = OptionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (pScrn->display->options) {
+ tmp = OptionListDup(pScrn->display->options);
+ if (pScrn->options)
+ pScrn->options = OptionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (extras) {
+ tmp = OptionListDup(extras);
+ if (pScrn->options)
+ pScrn->options = OptionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+}
+
+/*
+ * xf86CollectInputOptions collects the options for an InputDevice.
+ * This function requires that the following has been initialised:
+ *
+ * pInfo->conf_idev
+ *
+ * The extraOpts parameter may optionally contain a list of additional options
+ * to include.
+ *
+ * The order of precedence for options is:
+ *
+ * extraOpts, pInfo->conf_idev->extraOptions,
+ * pInfo->conf_idev->commonOptions, defaultOpts
+ */
+
+void
+xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+ pointer extraOpts)
+{
+ XF86OptionPtr tmp;
+ XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
+
+ pInfo->options = NULL;
+ if (defaultOpts) {
+ pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
+ }
+ if (pInfo->conf_idev->commonOptions) {
+ tmp = OptionListDup(pInfo->conf_idev->commonOptions);
+ if (pInfo->options)
+ pInfo->options = OptionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+ if (pInfo->conf_idev->extraOptions) {
+ tmp = OptionListDup(pInfo->conf_idev->extraOptions);
+ if (pInfo->options)
+ pInfo->options = OptionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+ if (extras) {
+ tmp = OptionListDup(extras);
+ if (pInfo->options)
+ pInfo->options = OptionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+}
+
+/* Created for new XInput stuff -- essentially extensions to the parser */
+
+/* These xf86Set* functions are intended for use by non-screen specific code */
+
+int
+xf86SetIntOption(pointer optlist, const char *name, int deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_INTEGER;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.num;
+ return deflt;
+}
+
+
+char *
+xf86SetStrOption(pointer optlist, const char *name, char *deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_STRING;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.str;
+ if (deflt)
+ return xstrdup(deflt);
+ else
+ return NULL;
+}
+
+
+int
+xf86SetBoolOption(pointer optlist, const char *name, int deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue(-1, optlist, &o))
+ deflt = o.value.bool;
+ return deflt;
+}
+
+
+pointer
+xf86AddNewOption(pointer head, char *name, char *val)
+{
+ return addNewOption(head, name, val);
+}
+
+
+pointer
+xf86NewOption(char *name, char *value)
+{
+ return NewOption(name, value);
+}
+
+
+pointer
+xf86NextOption(pointer list)
+{
+ return NextOption(list);
+}
+
+pointer
+xf86OptionListCreate(const char **options, int count, int used)
+{
+ return OptionListCreate(options, count, used);
+}
+
+pointer
+xf86OptionListMerge(pointer head, pointer tail)
+{
+ return OptionListMerge(head, tail);
+}
+
+void
+xf86OptionListFree(pointer opt)
+{
+ OptionListFree(opt);
+}
+
+char *
+xf86OptionName(pointer opt)
+{
+ return OptionName(opt);
+}
+
+char *
+xf86OptionValue(pointer opt)
+{
+ return OptionValue(opt);
+}
+
+void
+xf86OptionListReport(pointer parm)
+{
+ XF86OptionPtr opts = parm;
+
+ while(opts) {
+ if (OptionValue(opts))
+ xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n",
+ OptionName(opts), OptionValue(opts));
+ else
+ xf86ErrorFVerb( 5, "\tOption \"%s\"\n", OptionName(opts));
+ opts = NextOption(opts);
+ }
+}
+
+/* End of XInput-caused section */
+
+pointer
+xf86FindOption(pointer options, const char *name)
+{
+ return FindOption(options, name);
+}
+
+
+char *
+xf86FindOptionValue(pointer options, const char *name)
+{
+ return FindOptionValue(options, name);
+}
+
+
+void
+xf86MarkOptionUsed(pointer option)
+{
+ if (option != NULL)
+ ((XF86OptionPtr)option)->opt_used = TRUE;
+}
+
+
+void
+xf86MarkOptionUsedByName(pointer options, const char *name)
+{
+ XF86OptionPtr opt;
+
+ opt = FindOption(options, name);
+ if (opt != NULL)
+ opt->opt_used = TRUE;
+}
+
+Bool
+xf86CheckIfOptionUsed(pointer option)
+{
+ if (option != NULL)
+ return ((XF86OptionPtr)option)->opt_used;
+ else
+ return FALSE;
+}
+
+Bool
+xf86CheckIfOptionUsedByName(pointer options, const char *name)
+{
+ XF86OptionPtr opt;
+
+ opt = FindOption(options, name);
+ if (opt != NULL)
+ return opt->opt_used;
+ else
+ return FALSE;
+}
+
+void
+xf86ShowUnusedOptions(int scrnIndex, pointer options)
+{
+ XF86OptionPtr opt = options;
+
+ while (opt) {
+ if (opt->opt_name && !opt->opt_used) {
+ xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
+ opt->opt_name);
+ }
+ opt = opt->list.next;
+ }
+}
+
+
+static Bool
+GetBoolValue(OptionInfoPtr p, const char *s)
+{
+ if (*s == '\0') {
+ p->value.bool = TRUE;
+ } else {
+ if (xf86NameCmp(s, "1") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "on") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "true") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "yes") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "0") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "off") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "false") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "no") == 0)
+ p->value.bool = FALSE;
+ else
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p)
+{
+ char *s, *end;
+ Bool wasUsed;
+
+ if ((s = FindOptionValue(options, p->name)) != NULL) {
+ wasUsed = xf86CheckIfOptionUsedByName(options, p->name);
+ xf86MarkOptionUsedByName(options, p->name);
+ switch (p->type) {
+ case OPTV_INTEGER:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.num = strtoul(s, &end, 0);
+ if (*end == '\0') {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_STRING:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an string value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.str = s;
+ p->found = TRUE;
+ }
+ break;
+ case OPTV_ANYSTR:
+ p->value.str = s;
+ p->found = TRUE;
+ break;
+ case OPTV_REAL:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.realnum = strtod(s, &end);
+ if (*end == '\0') {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_BOOLEAN:
+ if (GetBoolValue(p, s)) {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", p->name);
+ p->found = FALSE;
+ }
+ break;
+ case OPTV_FREQ:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.freq.freq = strtod(s, &end);
+ p->value.freq.units = 0;
+ if (end != s) {
+ p->found = TRUE;
+ if (!xf86NameCmp(end, "Hz"))
+ p->value.freq.units = 1;
+ else if (!xf86NameCmp(end, "kHz") ||
+ !xf86NameCmp(end, "k"))
+ p->value.freq.units = 1000;
+ else if (!xf86NameCmp(end, "MHz") ||
+ !xf86NameCmp(end, "M"))
+ p->value.freq.units = 1000000;
+ else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found && p->value.freq.units > 0)
+ p->value.freq.freq *= (double)p->value.freq.units;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_NONE:
+ /* Should never get here */
+ p->found = FALSE;
+ break;
+ }
+ if (p->found) {
+ int verb = 2;
+ if (wasUsed)
+ verb = 4;
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name);
+ if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
+ xf86ErrorFVerb(verb, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(verb, "\n");
+ }
+ } else if (p->type == OPTV_BOOLEAN) {
+ /* Look for matches with options with or without a "No" prefix. */
+ char *n, *newn;
+ OptionInfoRec opt;
+
+ n = xf86NormalizeName(p->name);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ if (strncmp(n, "no", 2) == 0) {
+ newn = n + 2;
+ } else {
+ xfree(n);
+ n = xalloc(strlen(p->name) + 2 + 1);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ strcpy(n, "No");
+ strcat(n, p->name);
+ newn = n;
+ }
+ if ((s = FindOptionValue(options, newn)) != NULL) {
+ xf86MarkOptionUsedByName(options, newn);
+ if (GetBoolValue(&opt, s)) {
+ p->value.bool = !opt.value.bool;
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", newn);
+ p->found = FALSE;
+ }
+ } else {
+ p->found = FALSE;
+ }
+ if (p->found) {
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
+ if (*s != 0) {
+ xf86ErrorFVerb(2, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(2, "\n");
+ }
+ xfree(n);
+ } else {
+ p->found = FALSE;
+ }
+ return p->found;
+}
+
+
+void
+xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
+{
+ OptionInfoPtr p;
+
+ for (p = optinfo; p->name != NULL; p++) {
+ ParseOptionValue(scrnIndex, options, p);
+ }
+}
+
+
+OptionInfoPtr
+xf86TokenToOptinfo(OptionInfoPtr table, int token)
+{
+ OptionInfoPtr p;
+
+ for (p = table; p->token >= 0 && p->token != token; p++)
+ ;
+
+ if (p->token < 0)
+ return NULL;
+ else
+ return p;
+}
+
+
+const char *
+xf86TokenToOptName(OptionInfoPtr table, int token)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ return p->name;
+}
+
+
+Bool
+xf86IsOptionSet(OptionInfoPtr table, int token)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ return (p && p->found);
+}
+
+
+char *
+xf86GetOptValString(OptionInfoPtr table, int token)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found)
+ return p->value.str;
+ else
+ return NULL;
+}
+
+
+Bool
+xf86GetOptValInteger(OptionInfoPtr table, int token, int *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.num;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+Bool
+xf86GetOptValULong(OptionInfoPtr table, int token, unsigned long *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.num;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+Bool
+xf86GetOptValReal(OptionInfoPtr table, int token, double *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.realnum;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+Bool
+xf86GetOptValFreq(OptionInfoPtr table, int token, OptFreqUnits expectedUnits,
+ double *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ if (p->value.freq.units > 0) {
+ /* Units give, so the scaling is known. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ *value = p->value.freq.freq / 1000.0;
+ break;
+ case OPTUNITS_MHZ:
+ *value = p->value.freq.freq / 1000000.0;
+ break;
+ }
+ } else {
+ /* No units given, so try to guess the scaling. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_MHZ:
+ if (p->value.freq.freq > 1000000.0)
+ *value = p->value.freq.freq / 1000000.0;
+ else if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ }
+ }
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+Bool
+xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.bool;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+Bool
+xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ return p->value.bool;
+ } else
+ return def;
+}
+
+
+int
+xf86NameCmp(const char *s1, const char *s2)
+{
+ return NameCompare(s1, s2);
+}
+
+char *
+xf86NormalizeName(const char *s)
+{
+ char *ret, *q;
+ const char *p;
+
+ if (s == NULL)
+ return NULL;
+
+ ret = xalloc(strlen(s) + 1);
+ for (p = s, q = ret; *p != 0; p++) {
+ switch (*p) {
+ case '_':
+ case ' ':
+ case '\t':
+ continue;
+ default:
+ if (isupper(*p))
+ *q++ = tolower(*p);
+ else
+ *q++ = *p;
+ }
+ }
+ *q = '\0';
+ return ret;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
new file mode 100644
index 000000000..084bfc7dd
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
@@ -0,0 +1,1480 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.39 1999/08/29 12:42:55 dawes Exp $ */
+/*
+ * PCI Probe
+ *
+ * Copyright 1995-1999 by The XFree86 Project, Inc.
+ *
+ * A lot of this comes from Robin Cutshaw's scanpci
+ *
+ */
+
+#ifndef _XF86_PCIINFO_H
+#define _XF86_PCIINFO_H
+
+#include "xf86str.h"
+
+/* PCI Pseudo Vendor */
+#define PCI_VENDOR_GENERIC 0x00FF
+
+#define PCI_VENDOR_REAL3D 0x003D
+#define PCI_VENDOR_COMPAQ 0x0E11
+#define PCI_VENDOR_NCR_1 0x1000
+#define PCI_VENDOR_ATI 0x1002
+#define PCI_VENDOR_VLSI 0x1004
+#define PCI_VENDOR_AVANCE 0x1005
+#define PCI_VENDOR_NS 0x100B
+#define PCI_VENDOR_TSENG 0x100C
+#define PCI_VENDOR_WEITEK 0x100E
+#define PCI_VENDOR_DIGITAL 0x1011
+#define PCI_VENDOR_CIRRUS 0x1013
+#define PCI_VENDOR_IBM 0x1014
+#define PCI_VENDOR_NCR_2 0x101A
+#define PCI_VENDOR_WD 0x101C
+#define PCI_VENDOR_AMD 0x1022
+#define PCI_VENDOR_TRIDENT 0x1023
+#define PCI_VENDOR_ALI 0x1025
+#define PCI_VENDOR_MATROX 0x102B
+#define PCI_VENDOR_CHIPSTECH 0x102C
+#define PCI_VENDOR_MIRO 0x1031
+#define PCI_VENDOR_NEC 0x1033
+#define PCI_VENDOR_FD 0x1036
+#define PCI_VENDOR_SIS 0x1039
+#define PCI_VENDOR_HP 0x103C
+#define PCI_VENDOR_SMC_PCTECH 0x1042
+#define PCI_VENDOR_DPT 0x1044
+#define PCI_VENDOR_OPTI 0x1045
+#define PCI_VENDOR_ELSA 0x1048
+#define PCI_VENDOR_SGS 0x104A
+#define PCI_VENDOR_BUSLOGIC 0x104B
+#define PCI_VENDOR_TI 0x104C
+#define PCI_VENDOR_OAK 0x104E
+#define PCI_VENDOR_WINBOND 0x1050
+#define PCI_VENDOR_MOTOROLA 0x1057
+#define PCI_VENDOR_PROMISE 0x105A
+#define PCI_VENDOR_NUMNINE 0x105D
+#define PCI_VENDOR_UMC 0x1060
+#define PCI_VENDOR_X 0x1061
+#define PCI_VENDOR_PICOP 0x1066
+#define PCI_VENDOR_MYLEX 0x1069
+#define PCI_VENDOR_APPLE 0x106B
+/* Yahama is a guess based on chipset */
+#define PCI_VENDOR_YAMAHA 0x1073
+#define PCI_VENDOR_NEXGEN 0x1074
+#define PCI_VENDOR_QLOGIC 0x1077
+#define PCI_VENDOR_CYRIX 0x1078
+#define PCI_VENDOR_LEADTEK 0x107D
+#define PCI_VENDOR_CONTAQ 0x1080
+#define PCI_VENDOR_FOREX 0x1083
+#define PCI_VENDOR_OLICOM 0x108D
+#define PCI_VENDOR_SUN 0x108E
+#define PCI_VENDOR_DIAMOND 0x1092
+#define PCI_VENDOR_CMD 0x1095
+#define PCI_VENDOR_VISION 0x1098
+#define PCI_VENDOR_BROOKTREE 0x109E
+#define PCI_VENDOR_SIERRA 0x10A8
+#define PCI_VENDOR_ACC 0x10AA
+#define PCI_VENDOR_WINBOND_2 0x10AB
+#define PCI_VENDOR_DATABOOK 0x10B3
+#define PCI_VENDOR_3COM 0x10B7
+#define PCI_VENDOR_SMC 0x10B8
+#define PCI_VENDOR_ALI_2 0x10B9
+#define PCI_VENDOR_MITSUBISHI 0x10BA
+#define PCI_VENDOR_SURECOM 0x10BD
+#define PCI_VENDOR_NEOMAGIC 0x10C8
+#define PCI_VENDOR_ASP 0x10CD
+#define PCI_VENDOR_CERN 0x10DC
+#define PCI_VENDOR_NVIDIA 0x10DE
+#define PCI_VENDOR_IMS 0x10E0
+#define PCI_VENDOR_TEKRAM 0x10E1
+#define PCI_VENDOR_TUNDRA 0x10E3
+#define PCI_VENDOR_AMCC 0x10E8
+#define PCI_VENDOR_INTEGRAPHICS 0x10EA
+#define PCI_VENDOR_REALTEC 0x10EC
+#define PCI_VENDOR_TRUEVISION 0x10FA
+#define PCI_VENDOR_INITIO 0x1101
+#define PCI_VENDOR_CREATIVE_2 0x1102
+#define PCI_VENDOR_VIA 0x1106
+#define PCI_VENDOR_VORTEX 0x1119
+#define PCI_VENDOR_EF 0x111A
+#define PCI_VENDOR_FORE 0x1127
+#define PCI_VENDOR_IMAGTEC 0x112F
+#define PCI_VENDOR_PLX 0x113C
+#define PCI_VENDOR_ALLIANCE 0x1142
+#define PCI_VENDOR_VMIC 0x114A
+#define PCI_VENDOR_DIGI 0x114F
+#define PCI_VENDOR_MUTECH 0x1159
+#define PCI_VENDOR_RENDITION 0x1163
+#define PCI_VENDOR_TOSHIBA 0x1179
+#define PCI_VENDOR_ZEINET 0x1193
+#define PCI_VENDOR_SPECIALIX 0x11CB
+#define PCI_VENDOR_CONTROL 0x11FE
+#define PCI_VENDOR_CYCLADES 0x120E
+#define PCI_VENDOR_3DFX 0x121A
+#define PCI_VENDOR_SIGMADESIGNS 0x1236
+#define PCI_VENDOR_ENSONIQ 0x1274
+#define PCI_VENDOR_YOKOGAWA 0x1281
+#define PCI_VENDOR_TRITECH 0x1292
+#define PCI_VENDOR_NVIDIA_SGS 0x12d2
+#define PCI_VENDOR_SYMPHONY 0x1C1C
+#define PCI_VENDOR_TEKRAM_2 0x1DE1
+#define PCI_VENDOR_3DLABS 0x3D3D
+#define PCI_VENDOR_AVANCE_2 0x4005
+#define PCI_VENDOR_HERCULES 0x4843
+#define PCI_VENDOR_CREATIVE 0x4942
+#define PCI_VENDOR_S3 0x5333
+#define PCI_VENDOR_INTEL 0x8086
+#define PCI_VENDOR_ADAPTEC 0x9004
+#define PCI_VENDOR_ADAPTEC_2 0x9005
+#define PCI_VENDOR_ATRONICS 0x907F
+#define PCI_VENDOR_ARK 0xEDD8
+
+
+/* Generic */
+#define PCI_CHIP_VGA 0x0000
+#define PCI_CHIP_8514 0x0001
+
+/* Real 3D */
+#define PCI_CHIP_I740_PCI 0x00D1
+
+/* Compaq */
+#define PCI_CHIP_QV1280 0x3033
+#define PCI_CHIP_SMART 0xAE10
+#define PCI_CHIP_NETELL100 0xAE32
+#define PCI_CHIP_NETELL10 0xAE34
+#define PCI_CHIP_NETFLEX3 0xAE35
+#define PCI_CHIP_NETELL100D 0xAE40
+#define PCI_CHIP_NETELL100PL 0xAE43
+#define PCI_CHIP_NETELL100I 0xB011
+#define PCI_CHIP_THUNDERLAN 0xF130
+#define PCI_CHIP_NETFLEX3BNC 0xF150
+
+/* NCR */
+#define PCI_CHIP_53C810 0x0001
+#define PCI_CHIP_53C820 0x0002
+#define PCI_CHIP_53C825 0x0003
+#define PCI_CHIP_53C815 0x0004
+#define PCI_CHIP_53C810AP 0x0005
+#define PCI_CHIP_53C860 0x0006
+#define PCI_CHIP_53C896 0x000B
+#define PCI_CHIP_53C895 0x000C
+#define PCI_CHIP_53C885 0x000D
+#define PCI_CHIP_53C875 0x000F
+#define PCI_CHIP_53C875J 0x008F
+
+/* ATI */
+#define PCI_CHIP_MACH32 0x4158
+#define PCI_CHIP_MACH64CT 0x4354
+#define PCI_CHIP_MACH64CX 0x4358
+#define PCI_CHIP_MACH64ET 0x4554
+#define PCI_CHIP_MACH64GB 0x4742
+#define PCI_CHIP_MACH64GD 0x4744
+#define PCI_CHIP_MACH64GI 0x4749
+#define PCI_CHIP_MACH64GP 0x4750
+#define PCI_CHIP_MACH64GQ 0x4751
+#define PCI_CHIP_MACH64GT 0x4754
+#define PCI_CHIP_MACH64GU 0x4755
+#define PCI_CHIP_MACH64GX 0x4758
+#define PCI_CHIP_MACH64GZ 0x475A
+#define PCI_CHIP_MACH64LB 0x4C42
+#define PCI_CHIP_MACH64LD 0x4C44
+#define PCI_CHIP_MACH64LG 0x4C47
+#define PCI_CHIP_MACH64LI 0x4C49
+#define PCI_CHIP_MACH64LP 0x4C50
+#define PCI_CHIP_MACH64VT 0x5654
+#define PCI_CHIP_MACH64VU 0x5655
+#define PCI_CHIP_MACH64VV 0x5656
+
+/* VLSI */
+#define PCI_CHIP_82C592_FC1 0x0005
+#define PCI_CHIP_82C593_FC1 0x0006
+#define PCI_CHIP_82C594_AFC2 0x0007
+#define PCI_CHIP_82C597_AFC2 0x0009
+#define PCI_CHIP_82C541 0x000C
+#define PCI_CHIP_82C543 0x000D
+#define PCI_CHIP_VAS96011 0x0702
+
+/* Avance Logic */
+#define PCI_CHIP_ALG2301 0x2301
+
+/* NS */
+#define PCI_CHIP_87415 0x0002
+#define PCI_CHIP_87410 0xD001
+
+/* Tseng */
+#define PCI_CHIP_ET4000_W32P_A 0x3202
+#define PCI_CHIP_ET4000_W32P_B 0x3205
+#define PCI_CHIP_ET4000_W32P_D 0x3206
+#define PCI_CHIP_ET4000_W32P_C 0x3207
+#define PCI_CHIP_ET6000 0x3208
+#define PCI_CHIP_ET6300 0x4702
+
+/* Weitek */
+#define PCI_CHIP_P9000 0x9001
+#define PCI_CHIP_P9100 0x9100
+
+/* Digital */
+#define PCI_CHIP_DC21050 0x0001
+#define PCI_CHIP_DC21040_10 0x0002
+#define PCI_CHIP_DEC21030 0x0004
+#define PCI_CHIP_DC21040_100 0x0009
+#define PCI_CHIP_TGA2 0x000D
+#define PCI_CHIP_DEFPA 0x000F
+#define PCI_CHIP_DC21041 0x0014
+#define PCI_CHIP_DC21142 0x0019
+#define PCI_CHIP_DC21052 0x0021
+#define PCI_CHIP_DC21152 0x0024
+
+/* Cirrus Logic */
+#define PCI_CHIP_GD7548 0x0038
+#define PCI_CHIP_GD7555 0x0040
+#define PCI_CHIP_GD5430 0x00A0
+#define PCI_CHIP_GD5434_4 0x00A4
+#define PCI_CHIP_GD5434_8 0x00A8
+#define PCI_CHIP_GD5436 0x00AC
+#define PCI_CHIP_GD5446 0x00B8
+#define PCI_CHIP_GD5480 0x00BC
+#define PCI_CHIP_GD5462 0x00D0
+#define PCI_CHIP_GD5464 0x00D4
+#define PCI_CHIP_GD5464BD 0x00D5
+#define PCI_CHIP_GD5465 0x00D6
+#define PCI_CHIP_6729 0x1100
+#define PCI_CHIP_6832 0x1110
+#define PCI_CHIP_GD7542 0x1200
+#define PCI_CHIP_GD7543 0x1202
+#define PCI_CHIP_GD7541 0x1204
+
+/* IBM */
+#define PCI_CHIP_FIRE_CORAL 0x000A
+#define PCI_CHIP_TOKEN_RING 0x0018
+#define PCI_CHIP_82G2675 0x001D
+#define PCI_CHIP_82351 0x0022
+
+/* WD */
+#define PCI_CHIP_7197 0x3296
+
+/* AMD */
+#define PCI_CHIP_79C970 0x2000
+#define PCI_CHIP_53C974 0x2020
+
+/* Trident */
+#define PCI_CHIP_8400 0x8400
+#define PCI_CHIP_8420 0x8420
+#define PCI_CHIP_8500 0x8500
+#define PCI_CHIP_9320 0x9320
+#define PCI_CHIP_9388 0x9388
+#define PCI_CHIP_9397 0x9397
+#define PCI_CHIP_939A 0x939A
+#define PCI_CHIP_9420 0x9420
+#define PCI_CHIP_9440 0x9440
+#define PCI_CHIP_9520 0x9520
+#define PCI_CHIP_9525 0x9525
+#define PCI_CHIP_9660 0x9660
+#define PCI_CHIP_9750 0x9750
+#define PCI_CHIP_9850 0x9850
+#define PCI_CHIP_9880 0x9880
+
+/* ALI */
+#define PCI_CHIP_M1435 0x1435
+
+/* Matrox */
+#define PCI_CHIP_MGA2085 0x0518
+#define PCI_CHIP_MGA2064 0x0519
+#define PCI_CHIP_MGA1064 0x051a
+#define PCI_CHIP_MGA2164 0x051b
+#define PCI_CHIP_MGA2164_AGP 0x051f
+#define PCI_CHIP_MGAG200_PCI 0x0520
+#define PCI_CHIP_MGAG200 0x0521
+#define PCI_CHIP_MGAG400 0x0525
+#define PCI_CHIP_IMPRESSION 0x0D10
+#define PCI_CHIP_MGAG100_PCI 0x1000
+#define PCI_CHIP_MGAG100 0x1001
+
+#define PCI_CARD_MILL_G200_SD 0xff00
+#define PCI_CARD_PROD_G100_SD 0xff01
+#define PCI_CARD_MYST_G200_SD 0xff02
+#define PCI_CARD_MILL_G200_SG 0xff03
+#define PCI_CARD_MARV_G200_SD 0xff04
+
+/* Chips & Tech */
+#define PCI_CHIP_65545 0x00D8
+#define PCI_CHIP_65548 0x00DC
+#define PCI_CHIP_65550 0x00E0
+#define PCI_CHIP_65554 0x00E4
+#define PCI_CHIP_65555 0x00E5
+#define PCI_CHIP_68554 0x00F4
+#define PCI_CHIP_69000 0x00C0
+#define PCI_CHIP_69030 0x0C30
+
+/* Miro */
+#define PCI_CHIP_ZR36050 0x5601
+
+/* NEC */
+#define PCI_CHIP_POWER_VR 0x0046
+
+/* FD */
+#define PCI_CHIP_TMC_18C30 0x0000
+
+/* SiS */
+#define PCI_CHIP_SG86C201 0x0001
+#define PCI_CHIP_SG86C202 0x0002
+#define PCI_CHIP_SG85C503 0x0008
+#define PCI_CHIP_SIS5597 0x0200
+#define PCI_CHIP_SG86C205 0x0205
+#define PCI_CHIP_SG86C215 0x0215
+#define PCI_CHIP_SG86C225 0x0225
+#define PCI_CHIP_85C501 0x0406
+#define PCI_CHIP_85C496 0x0496
+#define PCI_CHIP_85C601 0x0601
+#define PCI_CHIP_85C5107 0x5107
+#define PCI_CHIP_85C5511 0x5511
+#define PCI_CHIP_85C5513 0x5513
+#define PCI_CHIP_SIS5571 0x5571
+#define PCI_CHIP_SIS5597_2 0x5597
+#define PCI_CHIP_SIS530 0x6306
+#define PCI_CHIP_SIS6326 0x6326
+#define PCI_CHIP_SIS7001 0x7001
+
+/* HP */
+#define PCI_CHIP_J2585A 0x1030
+#define PCI_CHIP_J2585B 0x1031
+
+/* SMC/PCTECH */
+#define PCI_CHIP_RZ1000 0x1000
+#define PCI_CHIP_RZ1001 0x1001
+
+/* DPT */
+#define PCI_CHIP_SMART_CACHE 0xA400
+
+/* Opti */
+#define PCI_CHIP_92C178 0xC178
+#define PCI_CHIP_82C557 0xC557
+#define PCI_CHIP_82C558 0xC558
+#define PCI_CHIP_82C621 0xC621
+#define PCI_CHIP_82C700 0xC700
+#define PCI_CHIP_82C701 0xC701
+#define PCI_CHIP_82C814 0xC814
+#define PCI_CHIP_82C822 0xC822
+
+/* SGS */
+#define PCI_CHIP_STG2000 0x0008
+#define PCI_CHIP_STG1764 0x0009
+
+/* BusLogic */
+#define PCI_CHIP_946C_01 0x0140
+#define PCI_CHIP_946C_10 0x1040
+#define PCI_CHIP_FLASH_POINT 0x8130
+
+/* Texas Instruments */
+#define PCI_CHIP_TI_PERMEDIA 0x3d04
+#define PCI_CHIP_TI_PERMEDIA2 0x3d07
+#define PCI_CHIP_PCI_1130 0xAC12
+#define PCI_CHIP_PCI_1131 0xAC15
+
+/* Oak */
+#define PCI_CHIP_OTI107 0x0107
+
+/* Winbond */
+#define PCI_CHIP_89C940 0x0940
+
+/* Motorola */
+#define PCI_CHIP_MPC105_EAGLE 0x0001
+#define PCI_CHIP_MPC105_GRACKLE 0x0002
+#define PCI_CHIP_RAVEN 0x4801
+
+/* Promise */
+#define PCI_CHIP_ULTRA_DMA 0x4D33
+#define PCI_CHIP_DC5030 0x5300
+
+/* Number Nine */
+#define PCI_CHIP_I128 0x2309
+#define PCI_CHIP_I128_2 0x2339
+#define PCI_CHIP_I128_T2R 0x493D
+#define PCI_CHIP_I128_T2R4 0x5348
+
+/* BrookTree */
+#define PCI_CHIP_BT848 0x0350
+#define PCI_CHIP_BT849 0x0351
+
+/* NVIDIA */
+#define PCI_CHIP_NV1 0x0008
+#define PCI_CHIP_DAC64 0x0009
+#define PCI_CHIP_TNT 0x0020
+#define PCI_CHIP_TNT2 0x0028
+#define PCI_CHIP_UTNT2 0x0029
+#define PCI_CHIP_VTNT2 0x002C
+#define PCI_CHIP_UVTNT2 0x002D
+#define PCI_CHIP_ITNT2 0x00A0
+
+/* NVIDIA & SGS */
+#define PCI_CHIP_RIVA128 0x0018
+
+/* Alliance Semiconductor */
+#define PCI_CHIP_AP6410 0x3210
+#define PCI_CHIP_AP6422 0x6422
+#define PCI_CHIP_AT24 0x6424
+
+/* 3Dfx Interactive */
+#define PCI_CHIP_VOODOO_GRAPHICS 0x0001
+#define PCI_CHIP_VOODOO2 0x0002
+#define PCI_CHIP_BANSHEE 0x0003
+#define PCI_CHIP_VOODOO3 0x0005
+
+/* Rendition */
+#define PCI_CHIP_V1000 0x0001
+#define PCI_CHIP_V2x00 0x2000
+
+/* 3Dlabs */
+#define PCI_CHIP_300SX 0x0001
+#define PCI_CHIP_500TX 0x0002
+#define PCI_CHIP_DELTA 0x0003
+#define PCI_CHIP_PERMEDIA 0x0004
+#define PCI_CHIP_MX 0x0006
+#define PCI_CHIP_PERMEDIA2 0x0007
+#define PCI_CHIP_GAMMA 0x0008
+#define PCI_CHIP_PERMEDIA2V 0x0009
+
+/* S3 */
+#define PCI_CHIP_PLATO 0x0551
+#define PCI_CHIP_VIRGE 0x5631
+#define PCI_CHIP_TRIO 0x8811
+#define PCI_CHIP_AURORA64VP 0x8812
+#define PCI_CHIP_TRIO64UVP 0x8814
+#define PCI_CHIP_VIRGE_VX 0x883D
+#define PCI_CHIP_868 0x8880
+#define PCI_CHIP_928 0x88B0
+#define PCI_CHIP_864_0 0x88C0
+#define PCI_CHIP_864_1 0x88C1
+#define PCI_CHIP_964_0 0x88D0
+#define PCI_CHIP_964_1 0x88D1
+#define PCI_CHIP_968 0x88F0
+#define PCI_CHIP_TRIO64V2_DXGX 0x8901
+#define PCI_CHIP_PLATO_PX 0x8902
+#define PCI_CHIP_Trio3D 0x8904
+#define PCI_CHIP_VIRGE_DXGX 0x8A01
+#define PCI_CHIP_VIRGE_GX2 0x8A10
+#define PCI_CHIP_Savage3D 0x8A20
+#define PCI_CHIP_Savage3D_MV 0x8A21
+#define PCI_CHIP_VIRGE_MX 0x8C01
+#define PCI_CHIP_VIRGE_MXPLUS 0x8C01
+#define PCI_CHIP_VIRGE_MXP 0x8C03
+
+/* ARK Logic */
+#define PCI_CHIP_1000PV 0xA091
+#define PCI_CHIP_2000PV 0xA099
+#define PCI_CHIP_2000MT 0xA0A1
+#define PCI_CHIP_2000MI 0xA0A9
+
+/* Tritech Microelectronics */
+#define PCI_CHIP_TR25202 0xfc02
+
+/* Neomagic */
+#define PCI_CHIP_NM2070 0x0001
+#define PCI_CHIP_NM2090 0x0002
+#define PCI_CHIP_NM2093 0x0003
+#define PCI_CHIP_NM2097 0x0083
+#define PCI_CHIP_NM2160 0x0004
+#define PCI_CHIP_NM2200 0x0005
+
+/* Intel */
+#define PCI_CHIP_I740_AGP 0x7800
+
+/*
+ * first the VendorId - VendorName mapping
+ */
+extern SymTabPtr xf86PCIVendorNameInfo;
+extern SymTabRec xf86PCIVendorNameInfoData[];
+
+#ifdef INIT_PCI_VENDOR_NAME_INFO
+SymTabRec xf86PCIVendorNameInfoData[] = {
+ {PCI_VENDOR_REAL3D, "Real 3D"},
+ {PCI_VENDOR_COMPAQ, "Compaq"},
+ {PCI_VENDOR_NCR_1, "NCR"},
+ {PCI_VENDOR_ATI, "ATI"},
+ {PCI_VENDOR_VLSI, "VLSI"},
+ {PCI_VENDOR_AVANCE, "Avance Logic"},
+ {PCI_VENDOR_NS, "NS"},
+ {PCI_VENDOR_TSENG, "Tseng Labs"},
+ {PCI_VENDOR_WEITEK, "Weitek"},
+ {PCI_VENDOR_DIGITAL, "Digital"},
+ {PCI_VENDOR_CIRRUS, "Cirrus Logic"},
+ {PCI_VENDOR_IBM, "IBM"},
+ {PCI_VENDOR_NCR_2, "NCR"},
+ {PCI_VENDOR_WD, "WD*"},
+ {PCI_VENDOR_AMD, "AMD"},
+ {PCI_VENDOR_TRIDENT, "Trident"},
+ {PCI_VENDOR_ALI, "ALI"},
+ {PCI_VENDOR_MATROX, "Matrox"},
+ {PCI_VENDOR_CHIPSTECH, "C&T"},
+ {PCI_VENDOR_MIRO, "Miro"},
+ {PCI_VENDOR_NEC, "NEC"},
+ {PCI_VENDOR_FD, "FD"},
+ {PCI_VENDOR_SIS, "SiS"},
+ {PCI_VENDOR_HP, "HP"},
+ {PCI_VENDOR_SMC_PCTECH, "SMC/PCTECH"},
+ {PCI_VENDOR_DPT, "DPT"},
+ {PCI_VENDOR_SGS, "SGS-Thomson"},
+ {PCI_VENDOR_BUSLOGIC, "BusLogic"},
+ {PCI_VENDOR_TI, "Texas Instruments"},
+ {PCI_VENDOR_OAK, "Oak"},
+ {PCI_VENDOR_WINBOND,"Winbond"},
+ {PCI_VENDOR_MOTOROLA, "Motorola"},
+ {PCI_VENDOR_OAK, "Promise"},
+ {PCI_VENDOR_NUMNINE, "Number Nine"},
+ {PCI_VENDOR_UMC, "UMC"},
+ {PCI_VENDOR_X , "X"},
+ {PCI_VENDOR_PICOP , "PICOP"},
+ {PCI_VENDOR_MYLEX, "Mylex"},
+ {PCI_VENDOR_APPLE, "Apple"},
+ {PCI_VENDOR_NEXGEN, "Nexgen"},
+ {PCI_VENDOR_QLOGIC, "QLogic"},
+ {PCI_VENDOR_CYRIX, "Cyrix"},
+ {PCI_VENDOR_LEADTEK, "Leadtek"},
+ {PCI_VENDOR_CONTAQ, "Contaq"},
+ {PCI_VENDOR_FOREX, "FOREX"},
+ {PCI_VENDOR_OLICOM, "Olicom"},
+ {PCI_VENDOR_SUN, "Sun"},
+ {PCI_VENDOR_CMD, "CMD"},
+ {PCI_VENDOR_VISION, "Vision"},
+ {PCI_VENDOR_BROOKTREE, "BrookTree"},
+ {PCI_VENDOR_SIERRA, "Sierra"},
+ {PCI_VENDOR_ACC, "ACC"},
+ {PCI_VENDOR_WINBOND_2, "Winbond"},
+ {PCI_VENDOR_DATABOOK, "Databook"},
+ {PCI_VENDOR_3COM, "3COM"},
+ {PCI_VENDOR_SMC, "SMC"},
+ {PCI_VENDOR_ALI_2, "ALI"},
+ {PCI_VENDOR_MITSUBISHI, "Mitsubishi"},
+ {PCI_VENDOR_SURECOM, "Surecom"},
+ {PCI_VENDOR_NEOMAGIC, "Neomagic"},
+ {PCI_VENDOR_ASP, "Advanced System Products"},
+ {PCI_VENDOR_CERN, "CERN"},
+ {PCI_VENDOR_NVIDIA, "NVidia"},
+ {PCI_VENDOR_IMS, "IMS"},
+ {PCI_VENDOR_TEKRAM, "Tekram"},
+ {PCI_VENDOR_TUNDRA, "Tundra"},
+ {PCI_VENDOR_AMCC, "AMCC"},
+ {PCI_VENDOR_INTEGRAPHICS, "Intergraphics"},
+ {PCI_VENDOR_REALTEC, "Realtek"},
+ {PCI_VENDOR_TRUEVISION, "Truevision"},
+ {PCI_VENDOR_INITIO, "Initio Corp"},
+ {PCI_VENDOR_CREATIVE_2, "Creative Labs"},
+ {PCI_VENDOR_VIA, "VIA"},
+ {PCI_VENDOR_VORTEX, "Vortex"},
+ {PCI_VENDOR_EF, "EF"},
+ {PCI_VENDOR_FORE, "Fore Systems"},
+ {PCI_VENDOR_IMAGTEC, "Imaging Technology"},
+ {PCI_VENDOR_PLX, "PLX"},
+ {PCI_VENDOR_NVIDIA_SGS, "NVidia/SGS-Thomson"},
+ {PCI_VENDOR_ALLIANCE, "Alliance Semiconductor"},
+ {PCI_VENDOR_VMIC, "VMIC"},
+ {PCI_VENDOR_DIGI, "DIGI*"},
+ {PCI_VENDOR_MUTECH, "Mutech"},
+ {PCI_VENDOR_RENDITION, "Rendition"},
+ {PCI_VENDOR_3DFX, "3Dfx Interactive"},
+ {PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"},
+ {PCI_VENDOR_ENSONIQ, "Ensoniq"},
+ {PCI_VENDOR_YOKOGAWA, "YOKOGAWA"},
+ {PCI_VENDOR_TRITECH, "Tritech Microelectronics"},
+ {PCI_VENDOR_NVIDIA_SGS, "NVidia/SGS-Thomson"},
+ {PCI_VENDOR_SYMPHONY, "Symphony"},
+ {PCI_VENDOR_TEKRAM_2, "Tekram"},
+ {PCI_VENDOR_3DLABS, "3Dlabs"},
+ {PCI_VENDOR_AVANCE_2, "Avance"},
+ {PCI_VENDOR_CREATIVE, "Creative Labs"},
+ {PCI_VENDOR_S3, "S3"},
+ {PCI_VENDOR_INTEL, "Intel"},
+ {PCI_VENDOR_ADAPTEC, "Adaptec"},
+ {PCI_VENDOR_ADAPTEC_2, "Adaptec"},
+ {PCI_VENDOR_ATRONICS, "Atronics"},
+ {PCI_VENDOR_ARK, "ARK Logic"},
+ {PCI_VENDOR_YAMAHA, "Yamaha"},
+ {0,NULL}
+};
+#endif
+
+/* Increase this as required */
+#define MAX_DEV_PER_VENDOR 64
+
+typedef struct {
+ unsigned short VendorID;
+ struct pciDevice {
+ unsigned short DeviceID;
+ char *DeviceName;
+ } Device[MAX_DEV_PER_VENDOR];
+} pciVendorDeviceInfo;
+
+extern pciVendorDeviceInfo* xf86PCIVendorInfo;
+extern pciVendorDeviceInfo xf86PCIVendorInfoData[];
+
+#ifdef INIT_PCI_VENDOR_INFO
+pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
+ {PCI_VENDOR_REAL3D, {
+ {PCI_CHIP_I740_PCI, "i740 (PCI)" },
+ {0x0000, NULL}}},
+
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_COMPAQ, {
+ {0x3033, "QVision 1280/p" },
+ {0xae10, "Smart-2/P RAID Controller" },
+ {0xae32, "Netellignet 10/100" },
+ {0xae34, "Netellignet 10" },
+ {0xae35, "NetFlex 3" },
+ {0xae40, "Netellignet 10/100 Dual" },
+ {0xae43, "Netellignet 10/100 ProLiant" },
+ {0xb011, "Netellignet 10/100 Integrated" },
+ {0xf130, "ThunderLAN" },
+ {0xf150, "NetFlex 3 BNC" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_NCR_1, {
+ {PCI_CHIP_53C810, "53c810"},
+ {PCI_CHIP_53C820, "53c820"},
+ {PCI_CHIP_53C825, "53c825"},
+ {PCI_CHIP_53C815, "53c815"},
+ {PCI_CHIP_53C810AP, "53c810AP"},
+ {PCI_CHIP_53C860, "53c860"},
+ {PCI_CHIP_53C896, "53c896"},
+ {PCI_CHIP_53C895, "53c895"},
+ {PCI_CHIP_53C885, "53c885"},
+ {PCI_CHIP_53C875, "53c875"},
+ {PCI_CHIP_53C875J, "53c875J"},
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_ATI, {
+ {PCI_CHIP_MACH32, "Mach32"},
+ {PCI_CHIP_MACH64CT, "Mach64 CT"},
+ {PCI_CHIP_MACH64CX, "Mach64 CX"},
+ {PCI_CHIP_MACH64ET, "Mach64 ET"},
+ {PCI_CHIP_MACH64GB, "Mach64 GB"},
+ {PCI_CHIP_MACH64GD, "Mach64 GD"},
+ {PCI_CHIP_MACH64GI, "Mach64 GI"},
+ {PCI_CHIP_MACH64GP, "Mach64 GP"},
+ {PCI_CHIP_MACH64GQ, "Mach64 GQ"},
+ {PCI_CHIP_MACH64GT, "Mach64 GT"},
+ {PCI_CHIP_MACH64GU, "Mach64 GT"},
+ {PCI_CHIP_MACH64GX, "Mach64 GX"},
+ {PCI_CHIP_MACH64GZ, "Mach64 GZ"},
+ {PCI_CHIP_MACH64LB, "Mach64 LB"},
+ {PCI_CHIP_MACH64LD, "Mach64 LD"},
+ {PCI_CHIP_MACH64LG, "Mach64 LG"},
+ {PCI_CHIP_MACH64LI, "Mach64 LI"},
+ {PCI_CHIP_MACH64LP, "Mach64 LP"},
+ {PCI_CHIP_MACH64VT, "Mach64 VT"},
+ {PCI_CHIP_MACH64VU, "Mach64 VU"},
+ {PCI_CHIP_MACH64VV, "Mach64 VV"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_VLSI, {
+ {0x0005, "82C592-FC1" },
+ {0x0006, "82C593-FC1" },
+ {0x0007, "82C594-AFC2" },
+ {0x0009, "82C597-AFC2" },
+ {0x000C, "82C541 Lynx" },
+ {0x000D, "82C543 Lynx ISA" },
+ {0x0702, "VAS96011" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_AVANCE, {
+ {PCI_CHIP_ALG2301, "ALG2301"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_NS, {
+ {0x0002, "87415" },
+ {0xD001, "87410" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_TSENG, {
+ {PCI_CHIP_ET4000_W32P_A, "ET4000W32P revA"},
+ {PCI_CHIP_ET4000_W32P_B, "ET4000W32P revB"},
+ {PCI_CHIP_ET4000_W32P_C, "ET4000W32P revC"},
+ {PCI_CHIP_ET4000_W32P_D, "ET4000W32P revD"},
+ {PCI_CHIP_ET6000, "ET6000/6100"},
+ {PCI_CHIP_ET6300, "ET6300"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_WEITEK, {
+ {PCI_CHIP_P9000, "P9000"},
+ {PCI_CHIP_P9100, "P9100"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_DIGITAL, {
+ {PCI_CHIP_DEC21030, "21030/TGA"},
+ {0x0001, "DC21050 PCI-PCI Bridge",
+ /* print_pcibridge} */ },
+ {0x0002, "DC21040 10Mb/s Ethernet" },
+ {0x0009, "DC21140 10/100 Mb/s Ethernet" },
+ {0x000D, "TGA2" },
+ {0x000F, "DEFPA (FDDI PCI)" },
+ {0x0014, "DC21041 10Mb/s Ethernet Plus" },
+ {0x0019, "DC21142 10/100 Mb/s Ethernet" },
+ {0x0021, "DC21052" },
+ {0x0024, "DC21152" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CIRRUS, {
+ {PCI_CHIP_GD5430, "GD5430"},
+ {PCI_CHIP_GD5434_4, "GD5434"},
+ {PCI_CHIP_GD5434_8, "GD5434"},
+ {PCI_CHIP_GD5436, "GD5436"},
+ {PCI_CHIP_GD5446, "GD5446"},
+ {PCI_CHIP_GD5480, "GD5480"},
+ {PCI_CHIP_GD5462, "GD5462"},
+ {PCI_CHIP_GD5464, "GD5464"},
+ {PCI_CHIP_GD5464BD, "GD5464BD"},
+ {PCI_CHIP_GD5465, "GD5465"},
+ {PCI_CHIP_GD7541, "GD7541"},
+ {PCI_CHIP_GD7542, "GD7542"},
+ {PCI_CHIP_GD7543, "GD7543"},
+ {PCI_CHIP_GD7548, "GD7548"},
+ {PCI_CHIP_GD7555, "GD7555"},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {0x6001, "CS4236B/CS4611 Audio" },
+#endif
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_IBM, {
+ {0x000A, "Fire Coral" },
+ {0x0018, "Token Ring" },
+ {0x001D, "82G2675" },
+ {0x0022, "82351 pci-pci bridge" },
+ {0x0000, NULL}}},
+#endif
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_NCR_2, {
+ {0x0000, NULL}}},
+#endif
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_WD, {
+ {0x3296, "WD 7197" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_AMD, {
+ {0x2000, "79C970 Lance" },
+ {0x2020, "53C974 SCSI" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_TRIDENT, {
+ {PCI_CHIP_9320, "TGUI 9320"},
+ {PCI_CHIP_9420, "TGUI 9420"},
+ {PCI_CHIP_9440, "TGUI 9440"},
+ {PCI_CHIP_9660, "TGUI 96xx"},
+ {PCI_CHIP_9388, "Cyber 9388"},
+ {PCI_CHIP_9397, "Cyber 9397"},
+ {PCI_CHIP_939A, "Cyber 939A/DVD"},
+ {PCI_CHIP_9520, "Cyber 9520"},
+ {PCI_CHIP_9525, "Cyber 9525/DVD"},
+ {PCI_CHIP_9750, "3DImage975"},
+ {PCI_CHIP_9850, "3DImage985"},
+ {PCI_CHIP_9880, "Blade3D"},
+ {PCI_CHIP_8400, "CyberBlade/i7"},
+ {PCI_CHIP_8420, "CyberBlade/DSTN/i7"},
+ {PCI_CHIP_8500, "CyberBlade/i1"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_ALI, {
+ {0x1435, "M1435"},
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_MATROX, {
+ {PCI_CHIP_MGA2085, "MGA 2085PX"},
+ {PCI_CHIP_MGA2064, "MGA 2064W"},
+ {PCI_CHIP_MGA1064, "MGA 1064SG"},
+ {PCI_CHIP_MGA2164, "MGA 2164W"},
+ {PCI_CHIP_MGA2164_AGP, "MGA 2164W AGP"},
+ {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI"},
+ {PCI_CHIP_MGAG200, "MGA G200 AGP"},
+ {PCI_CHIP_MGAG400, "MGA G400 AGP"},
+ {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI"},
+ {PCI_CHIP_MGAG100, "MGA G100 AGP"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CHIPSTECH, {
+ {PCI_CHIP_65545, "65545"},
+ {PCI_CHIP_65548, "65548"},
+ {PCI_CHIP_65550, "65550"},
+ {PCI_CHIP_65554, "65554"},
+ {PCI_CHIP_65555, "65555"},
+ {PCI_CHIP_68554, "68554"},
+ {PCI_CHIP_69000, "69000"},
+ {PCI_CHIP_69030, "69030"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_MIRO, {
+ {0x5601, "ZR36050" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_NEC, {
+ {0x0046, "PowerVR PCX2" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_FD, {
+ {0x0000, "TMC-18C30 (36C70)" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_SIS, {
+ {PCI_CHIP_SG86C201, "SG86C201"},
+ {PCI_CHIP_SG86C202, "SG86C202"},
+ {PCI_CHIP_SG86C205, "SG86C205"},
+ {PCI_CHIP_SG86C215, "SG86C215"},
+ {PCI_CHIP_SG86C225, "SG86C225"},
+ {PCI_CHIP_SIS5597, "5597"},
+ {PCI_CHIP_SIS530, "530"},
+ {PCI_CHIP_SIS6326, "6326"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_HP, {
+ {0x1030, "J2585A" },
+ {0x1031, "J2585B" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_SMC_PCTECH, {
+ {0x1000, "FDC 37C665/RZ1000" },
+ {0x1001, "FDC /RZ1001" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_DPT, {
+ {0xA400, "SmartCache/Raid" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_SGS, {
+ {PCI_CHIP_STG2000, "STG2000"},
+ {PCI_CHIP_STG1764, "STG1764"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_BUSLOGIC, {
+ {PCI_CHIP_946C_01, "946C 01"},
+ {PCI_CHIP_946C_10, "946C 10"},
+ {PCI_CHIP_FLASH_POINT, "FlashPoint"},
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_TI, {
+ {PCI_CHIP_TI_PERMEDIA, "Permedia"},
+ {PCI_CHIP_TI_PERMEDIA2, "Permedia 2"},
+ {PCI_CHIP_PCI_1130, "PCI 1130"},
+ {PCI_CHIP_PCI_1131, "PCI 1131"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_OAK, {
+ {PCI_CHIP_OTI107, "OTI107"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_WINBOND, {
+ {PCI_CHIP_89C940, "89C940 NE2000-PCI"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_MOTOROLA, {
+ {PCI_CHIP_MPC105_EAGLE, "MPC105 Eagle"},
+ {PCI_CHIP_MPC105_GRACKLE,"MPC105 Grackle"},
+ {PCI_CHIP_RAVEN, "Raven"},
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_OAK, {
+ {PCI_CHIP_ULTRA_DMA, "IDE UltraDMA/33"},
+ {PCI_CHIP_DC5030, "DC5030"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_NUMNINE, {
+ {PCI_CHIP_I128, "Imagine 128"},
+ {PCI_CHIP_I128_2, "Imagine 128 II"},
+ {PCI_CHIP_I128_T2R, "Imagine 128 T2R"},
+ {PCI_CHIP_I128_T2R4, "Imagine 128 T2R4"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_UMC, {
+ {0x0101, "UM8673F"},
+ {0x673A, "UM8886BF"},
+ {0x886A, "UM8886A"},
+ {0x8881, "UM8881F"},
+ {0x8886, "UM8886F"},
+ {0x8891, "UM8891A"},
+ {0x9017, "UM9017F"},
+ {0xE886, "UM8886N"},
+ {0xE891, "UM8891N"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_X, {
+ {0x0001, "ITT AGX016"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_PICOP, {
+ {0x0001, "PT86C52x Vesuvius" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_MYLEX, {
+ {0x0010, "AccelRAID 250" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_APPLE, {
+ {0x0001, "Bandit" },
+ {0x0002, "Grand Central" },
+ {0x000E, "Hydra" },
+ {0x0000, NULL}}},
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_NEXGEN, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_QLOGIC, {
+ {0x1020, "ISP1020" },
+ {0x1022, "ISP1022" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_CYRIX, {
+ {0x0000, "5510" },
+ {0x0001, "PCI Master" },
+ {0x0002, "5520" },
+ {0x0100, "5530 Kahlua Legacy" },
+ {0x0101, "5530 Kahlua SMI" },
+ {0x0102, "5530 Kahlua IDE" },
+ {0x0103, "5530 Kahlua Audio" },
+ {0x0104, "5530 Kahlua Video" },
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_LEADTEK, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_CONTAQ, {
+ {0x0600, "82C599" },
+ {0xc693, "82C693" },
+ {0x0000, NULL}}},
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_FOREX, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_OLICOM, {
+ {0x0001, "OC-3136" },
+ {0x0011, "OC-2315" },
+ {0x0012, "OC-2325" },
+ {0x0013, "OC-2183" },
+ {0x0014, "OC-2326" },
+ {0x0021, "OC-6151" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_SUN, {
+ {0x1000, "EBUS" },
+ {0x1001, "Happy Meal" },
+ {0x8000, "PCI Bus Module" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CMD, {
+ {0x0640, "640A" },
+ {0x0643, "643" },
+ {0x0646, "646" },
+ {0x0670, "670" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_VISION, {
+ {0x0001, "QD 8500" },
+ {0x0002, "QD 8580" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_BROOKTREE, {
+ {PCI_CHIP_BT848, "848"},
+ {PCI_CHIP_BT849, "849"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_SIERRA, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ACC, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_WINBOND_2, {
+ {0x0001, "W83769F" },
+ {0x0105, "SL82C105" },
+ {0x0565, "W83C553" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_DATABOOK, {
+ {0xB106, "DB87144" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_3COM, {
+ {0x5900, "3C590 10bT" },
+ {0x5950, "3C595 100bTX" },
+ {0x5951, "3C595 100bT4" },
+ {0x5952, "3C595 10b-MII" },
+ {0x9000, "3C900 10bTPO" },
+ {0x9001, "3C900 10b Combo" },
+ /* Is it OK for 2 devices to have the same name ? */
+ {0x9005, "3C900 10b Combo" },
+ {0x9050, "3C905 100bTX" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_SMC, {
+ {0x0005, "9432 TX" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ALI_2, {
+ {0x1445, "M1445" },
+ {0x1449, "M1449" },
+ {0x1451, "M1451" },
+ {0x1461, "M1461" },
+ {0x1489, "M1489" },
+ {0x1511, "M1511" },
+ {0x1513, "M1513" },
+ {0x1521, "M1521" },
+ {0x1523, "M1523" },
+ {0x1531, "M1531 Aladdin IV" },
+ {0x1533, "M1533 Aladdin IV" },
+ {0x5215, "M4803" },
+ {0x5219, "M5219" },
+ {0x5229, "M5229 TXpro" },
+ {0x0000, NULL}}},
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_MITSUBISHI, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_SURECOM, {
+ {0x0E34, "NE-34PCI Lan" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_NEOMAGIC, {
+ {PCI_CHIP_NM2070, "NM2070"},
+ {PCI_CHIP_NM2090, "NM2090"},
+ {PCI_CHIP_NM2093, "NM2093"},
+ {PCI_CHIP_NM2160, "NM2160"},
+ {PCI_CHIP_NM2200, "NM2200"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_ASP, {
+ { 0x1200, "ABP940" },
+ { 0x1300, "ABP940U" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CERN, {
+ { 0x0001, "STAR/RD24 SCI-PCI (PMC)" },
+ { 0x0002, "STAR/RD24 SCI-PCI (PMC)" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_NVIDIA, {
+ {PCI_CHIP_NV1, "NV1"},
+ {PCI_CHIP_DAC64, "DAC64"},
+ {PCI_CHIP_TNT, "Riva TNT"},
+ {PCI_CHIP_TNT2, "Riva TNT2"},
+ {PCI_CHIP_UTNT2, "Riva Ultra TNT2"},
+ {PCI_CHIP_VTNT2, "Riva Vanta"},
+ {PCI_CHIP_UVTNT2, "Riva Ultra 64"},
+ {PCI_CHIP_ITNT2, "Riva Integrated"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_IMS, {
+ {0x8849, "8849" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_TEKRAM, {
+ {0x690C, "DC690C" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_TUNDRA, {
+ {0x0000, "CA91C042 Universe" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_AMCC, {
+ {0x8043, "Myrinet PCI (M2-PCI-32)" },
+ {0x807D, "S5933 PCI44" },
+ {0x809C, "S5933 Traquair HEPC3" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_INTEGRAPHICS, {
+ {0x1680, "IGA-1680" },
+ {0x1682, "IGA-1682" },
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_REALTEC, {
+ {0x8029, "8029" },
+ {0x8129, "8129" },
+ {0x8139, "RTL8139 Ethernet Controller" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_TRUEVISION, {
+ {0x000C, "Targa 1000" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_INITIO, {
+ {0x9100, "320 P" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_VIA, {
+ {0x0501, "VT 8501 MVP4 Host Bridge" },
+ {0x0505, "VT 82C505" },
+ {0x0561, "VT 82C505" },
+ {0x0571, "VT 82C586 MVP3 IDE Bridge" },
+ {0x0576, "VT 82C576 3V" },
+ {0x0586, "VT 82C586 MVP3 ISA Bridge" },
+ {0x0686, "VT 82C686 MVP4 ISA Bridge" },
+ {0x0597, "VT 82C598 MVP3 Host Bridge" },
+ {0x3038, "VT 82C586 MVP3 USB Controller" },
+ {0x3040, "VT 82C586B MVP3 ACPI Bridge" },
+ {0x3057, "VT 8501 MVP4 ACPI Bridge" },
+ {0x3058, "VT 8501 MVP4 MultiMedia" },
+ {0x3068, "VT 8501 MVP4 Modem" },
+ {0x8501, "VT 8501 MVP4 PCI/AGP Bridge" },
+ {0x8598, "VT 82C598 MVP3 PCI/AGP Bridge" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_VORTEX, {
+ {0x0001, "GDT 6000b" },
+ {0x0000, NULL}}},
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_EF, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_FORE, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_IMAGTEC, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_PLX, {
+ {0x0000, NULL}}},
+#endif
+#endif
+ {PCI_VENDOR_NVIDIA_SGS, {
+ {PCI_CHIP_RIVA128, "Riva128"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ALLIANCE, {
+ {PCI_CHIP_AP6410, "ProMotion 6410"},
+ {PCI_CHIP_AP6422, "ProMotion 6422"},
+ {PCI_CHIP_AT24, "ProMotion AT24"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_VMIC, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_DIGI, {
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_MUTECH, {
+ {0x0001, "MV1000" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_RENDITION, {
+ {PCI_CHIP_V1000, "Verite 1000"},
+ {PCI_CHIP_V2x00, "Verite 2x00"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_TOSHIBA, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ZEINET, {
+ {0x0001, "1221" },
+ {0x0000, NULL}}},
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_SPECIALIX, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CONTROL, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_CYCLADES, {
+ {0x0000, NULL}}},
+#endif
+#endif
+ {PCI_VENDOR_3DFX, {
+ {PCI_CHIP_VOODOO_GRAPHICS, "Voodoo Graphics"},
+ {PCI_CHIP_VOODOO2, "Voodoo2"},
+ {PCI_CHIP_BANSHEE, "Banshee"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_SIGMADESIGNS, {
+ {0x6401, "REALmagic64/GX (SD 6425)" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ENSONIQ, {
+ {0x5000, "es1370 (AudioPCI)" },
+ {0x1371, "es1371" },
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+#ifdef INCLUDE_EMPTY_LISTS
+ {PCI_VENDOR_YOKOGAWA, {
+ {0x0000, NULL}}},
+#endif
+#endif
+ {PCI_VENDOR_TRITECH, {
+ {PCI_CHIP_TR25202, "Pyramid3D TR25202"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_NVIDIA_SGS, {
+ {0x0018, "Riva128" },
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_SYMPHONY, {
+ {0x0001, "82C101" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_TEKRAM_2, {
+ {0xDC29, "DC290" },
+ {0x0000, NULL}}},
+#endif
+ {PCI_VENDOR_3DLABS, {
+ {PCI_CHIP_300SX, "GLINT 300SX"},
+ {PCI_CHIP_500TX, "GLINT 500TX"},
+ {PCI_CHIP_DELTA, "GLINT Delta"},
+ {PCI_CHIP_PERMEDIA, "GLINT Permedia"},
+ {PCI_CHIP_MX, "GLINT MX"},
+ {PCI_CHIP_PERMEDIA2, "GLINT Permedia 2"},
+ {PCI_CHIP_GAMMA, "GLINT Gamma"},
+ {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_AVANCE_2, {
+ {0x0000, NULL}}},
+ {PCI_VENDOR_S3, {
+ {PCI_CHIP_PLATO, "PLATO/PX"},
+ {PCI_CHIP_VIRGE, "ViRGE"},
+ {PCI_CHIP_TRIO, "Trio32/64"},
+ {PCI_CHIP_AURORA64VP, "Aurora64V+"},
+ {PCI_CHIP_TRIO64UVP, "Trio64UV+"},
+ {PCI_CHIP_TRIO64V2_DXGX,"Trio64V2/DX or /GX"},
+ {PCI_CHIP_PLATO_PX, "PLATO/PX"},
+ {PCI_CHIP_Trio3D, "Trio3D"},
+ {PCI_CHIP_VIRGE_VX, "ViRGE/VX"},
+ {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX"},
+ {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2"},
+ {PCI_CHIP_Savage3D, "Savage3D (86E391)"},
+ {PCI_CHIP_Savage3D_MV, "Savage3D+MacroVision (86E390)"},
+ {PCI_CHIP_VIRGE_MX, "ViRGE/MX"},
+ {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+"},
+ {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV"},
+ {PCI_CHIP_868, "868"},
+ {PCI_CHIP_928, "928"},
+ {PCI_CHIP_864_0, "864"},
+ {PCI_CHIP_864_1, "864"},
+ {PCI_CHIP_964_0, "964"},
+ {PCI_CHIP_964_1, "964"},
+ {PCI_CHIP_968, "968"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_INTEL,{
+ {0x0482, "82375EB pci-eisa bridge"},
+ {0x0483, "82424ZX cache dram controller"},
+ {0x0484, "82378IB/ZB pci-isa bridge"},
+ {0x0486, "82430ZX Aries"},
+ {0x04A3, "82434LX/NX pci cache mem controller"},
+ {0x0960, "960RD processor/bridge"},
+ {0x1221, "82092AA"},
+ {0x1222, "82092AA"},
+ {0x1223, "SAA7116"},
+ {0x1226, "82596"},
+ {0x1227, "82865"},
+ {0x1229, "82557/8 10/100MBit network controller"},
+ {0x122D, "82437 Triton"},
+ {0x122E, "82471 Triton"},
+ {0x1230, "82371 bus-master IDE controller"},
+ {0x1234, "82371MX bus-master IDE controller"},
+ {0x1235, "82437MX"},
+ {0x1237, "82441FX Natoma"},
+ {0x124B, "82380FB"},
+ {0x1250, "82439"},
+ {0x7000, "82371 pci-isa bridge"},
+ {0x7010, "82371 bus-master IDE controller"},
+ {0x7020, "82371 bus-master IDE controller"},
+ {0x7030, "82437VX"},
+ {0x7100, "82439TX"},
+ {0x7110, "82371AB PIIX4 ISA"},
+ {0x7111, "82371AB PIIX4 IDE"},
+ {0x7112, "82371AB PIIX4 USB"},
+ {0x7113, "82371AB PIIX4 ACPI"},
+ {0x7180, "82443LX PAC Host"},
+ {0x7181, "82443LX PAC AGP"},
+ {0x7190, "82443BX Host"},
+ {0x7191, "82443BX AGP"},
+ {0x7192, "82443BX Host (no AGP)"},
+ {0x71a0, "82443GX Host"},
+ {0x71a1, "82443GX AGP"},
+ {0x71a2, "82443GX Host (no AGP)"},
+ {0x84C4, "P6"},
+ {0x84C5, "82450GX20"},
+ {PCI_CHIP_I740_AGP, "i740 (AGP)"},
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ADAPTEC, {
+ {0x0010, "2940U2" },
+ {0x1078, "7810" },
+ {0x5078, "7850" },
+ {0x5578, "7855" },
+ {0x6078, "7860" },
+ {0x6178, "2940AU" },
+ {0x7078, "7870" },
+ {0x7178, "2940" },
+ {0x7278, "7872" },
+ {0x7378, "398X" },
+ {0x7478, "2944" },
+ {0x7895, "7895" },
+ {0x8078, "7880" },
+ {0x8178, "2940U/UW" },
+ {0x8278, "3940U/UW" },
+ {0x8378, "389XU" },
+ {0x8478, "2944U" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ADAPTEC_2, {
+ {0x001F, "7890/7891" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ATRONICS, {
+ {0x2015, "IDE-2015PL" },
+ {0x0000, NULL}}},
+ {PCI_VENDOR_ARK, {
+ {PCI_CHIP_1000PV, "1000PV"},
+ {PCI_CHIP_2000PV, "2000PV"},
+ {PCI_CHIP_2000MT, "2000MT"},
+ {PCI_CHIP_2000MI, "2000MI"},
+ {0x0000, NULL}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ {PCI_VENDOR_YAMAHA, {
+ {0x000a, "YMF740-V Audio"},
+ {0x0000, NULL}}},
+#endif
+ {0x0000, {
+ {0x0000, NULL}}},
+};
+#endif
+
+#ifdef DECLARE_CARD_DATASTRUCTURES
+
+/* Increase this as required */
+#define MAX_CARD_PER_VENDOR 64
+
+typedef void (*pciPrintProcPtr)(pciCfgRegs *);
+typedef struct {
+ unsigned short VendorID;
+ struct pciCard {
+ unsigned short SubsystemID;
+ char *CardName;
+ pciPrintProcPtr printFunc;
+ } Device[MAX_CARD_PER_VENDOR];
+} pciVendorCardInfo;
+
+extern pciVendorCardInfo *xf86PCICardInfo;
+extern pciVendorCardInfo xf86PCICardInfoData[];
+#ifdef INIT_PCI_CARD_INFO
+
+#define NF (pciPrintProcPtr)NULL
+
+pciVendorCardInfo xf86PCICardInfoData[] = {
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { PCI_VENDOR_3COM, {
+ { 0x9005, "PCI Combo ethernet card" },
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { PCI_VENDOR_ADAPTEC, {
+ { 0x7881, "AHA-2940U/UW SCSI", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+ { PCI_VENDOR_ATI, {
+ { 0x4750, "XPERT XL", NF },
+ { 0x4755, "Mach64-GT-B+DVD", NF },
+ { 0x0084, "Xpert'98", NF },
+ { 0x4d55, "264GT3 (Rage3D III)", NF },
+ { 0x0088, "Mach64 (SuSE Econ)", NF },
+ { 0x4c42, "XPERT LCD", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#ifdef VENDOR_INCLUDE_NONVIDEO
+#ifdef INCLUDE_EMPTY_LISTS
+ { PCI_VENDOR_COMPAQ, {
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { PCI_VENDOR_NCR_1, {
+ { 0x1000, "SCSI HBA", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_REALTEC, {
+ { 0x8139, "Generic", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+ { PCI_VENDOR_CREATIVE_2, {
+ { 0x1017, "3D Blaster Banshee", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ {PCI_VENDOR_DIGITAL, {
+ { 0x500A, "EtherWORKS 10/100", NF},
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+ { PCI_VENDOR_DIAMOND, {
+ { 0x8000, "C&T 69000", NF },
+ { 0x1103, "Fire GL 1000", NF },
+ { 0x0154, "Fire GL 1000 PRO", NF },
+ { 0x0003, "Monster Fusion", NF },
+ { 0x8a10, "Stealth 3D 4000", NF },
+ { 0x0100, "Stealth II G460", NF },
+ { 0x2000, "Stealth II S220", NF },
+ { 0x1092, "Viper 330", NF },
+ { 0x0550, "Viper 550", NF },
+ { 0x8760, "Fireport 40 Dual", NF },
+ { 0x2110, "Sonic Impact S70", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_ELSA, {
+ { 0x0914, "Winner 1000", NF },
+ { 0x0930, "Winner 1000PRO 864", NF },
+ { 0x0931, "Winner 1000PRO Trio32", NF },
+ { 0x0932, "Winner 1000Trio Trio64", NF },
+ { 0x0933, "Winner 1000TrioV Trio64V+", NF },
+ { 0x0934, "Victory 3D", NF },
+ { 0x0935, "Winner 1000 T2D", NF },
+ { 0x0936, "Winner 1000PRO 868", NF },
+ { 0x0937, "Winner 1000PRO/X 868", NF },
+ { 0x0938, "Winner 1000ViRGE", NF },
+ { 0x0939, "Winner 1000ViRGE/DX", NF },
+ { 0x093a, "Winner 1000/T2DX", NF },
+ { 0x093b, "Winner DUO M5", NF },
+ { 0x093c, "Victory 1000", NF },
+ { 0x0940, "Winner 2000PRO 964/TVP3020", NF },
+ { 0x0941, "Winner 2000PRO/X 968/TVP3020", NF },
+ { 0x0942, "Winner 2000PRO/X 968/TVP3026", NF },
+ { 0x0943, "Winner 2000AVI 968/TVP3026", NF },
+ { 0x0948, "Winner 2000PRO-8 964/RGB528", NF },
+ { 0x094a, "Winner 2000PRO-8 968/RGB528", NF },
+ { 0x094b, "Winner 2000PRO-8 968/TVP3030", NF },
+ { 0x0950, "ViRGE/VX", NF },
+ { 0x0951, "Winner 2000AVI 3D", NF },
+ { 0x0952, "Winner 2000AVI 220", NF },
+ { 0x0960, "Winner 3000M", NF },
+ { 0x0962, "Winner 3000L", NF },
+ { 0x0964, "Winner 3000XL", NF },
+ { 0x096a, "Winner 3000Twin", NF },
+ { 0x096c, "Winner 3000LT", NF },
+ { 0x0980, "GLoria 4 TVP3026", NF },
+ { 0x0982, "GLoria 4 TVP3030", NF },
+ { 0x0981, "GLoria 8", NF },
+ { 0x0a10, "GLoria M", NF },
+ { 0x0a14, "GLoria S", NF },
+ { 0x0a31, "Winner 2000 Office", NF },
+ { 0x0a32, "GLoria Synergy P2C", NF },
+ { 0x0a33, "GLoria Synergy P2C", NF },
+ { 0x0a34, "GLoria Synergy P2V", NF },
+ { 0x0a35, "GLoria Synergy P2A", NF },
+ { 0x0a36, "Quad GLoria Synergy P2A", NF },
+ { 0x0a40, "GLoria MX", NF },
+ { 0x0a41, "GLoria XL", NF },
+ { 0x0a42, "GLoria XXL", NF },
+ { 0x0a43, "Winner 2000 Office P2V", NF },
+ { 0x0a44, "Winner 2000 Office P2A", NF },
+ { 0x0a80, "GLoria S MAC", NF },
+ { 0x0c10, "Victory Erazor 4", NF },
+ { 0x0c11, "Victory Erazor 8", NF },
+ { 0x0c12, "Winner 1000 R3D", NF },
+ { 0x0c13, "Winner 1000 ZX4", NF },
+ { 0x0c14, "Victory Erazor/LT SGRAM", NF },
+ { 0x0c15, "Victory Erazor/LT SDRAM", NF },
+ { 0x0c18, "Erazor II SGRAM", NF },
+ { 0x0c19, "Erazor II SDRAM video", NF },
+ { 0x0c1a, "Synergy Pro", NF },
+ { 0x0c1c, "Erazor II SDRAM", NF },
+ { 0x0c20, "Synergy II 32", NF },
+ { 0x0c21, "Synergy II 16", NF },
+ { 0x0c22, "Erazor III", NF },
+ { 0x0c23, "Erazor III video", NF },
+ { 0x0d10, "Victory II SGRAM", NF },
+ { 0x0d11, "Victory II SDRAM", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_HERCULES, {
+ { 0x0001, "Thriller3D", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_IBM, {
+ { 0x00ba, "Thinkpad 600 NeoMagic NM2160", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ {PCI_VENDOR_INTEL, {
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { 0x0009, "PCI 10/100Mb/s ethernet card", NF },
+ /* Seattle AL440BX is 0x8080, is anything else ? */
+ { 0x8080, "motherboard", NF },
+ { 0x4d55, "Maui (MU) motherboard", NF },
+#endif
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_MATROX, {
+ { 0x1100, "Mystique", NF },
+ { 0x1000, "Millennium II", NF },
+ { 0x0100, "Millennium II", NF },
+ { 0x1200, "Millennium II", NF },
+ { PCI_CARD_MILL_G200_SD, "Millennium G200 SD", NF },
+ { PCI_CARD_PROD_G100_SD, "Produktiva G100 SD", NF },
+ { PCI_CARD_MYST_G200_SD, "Mystique G200 SD", NF },
+ { PCI_CARD_MILL_G200_SG, "Millennium G200 SG", NF },
+ { PCI_CARD_MARV_G200_SD, "Marvel G200 SD", NF },
+ { 0x1001, "Productiva G100 SG", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_SIS, {
+ { 0x6306, "530 based motherboard", NF },
+ { 0x6326, "6326 based card", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { PCI_VENDOR_CREATIVE, {
+ { 0x4c4c, "Sound Blaster PCI128", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+ { PCI_VENDOR_S3, {
+ { 0x8904, "Trio3D", NF },
+ { 0x8a10, "ViRGE/GX2", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_NUMNINE, {
+ { 0x8a10, "Reality 334", NF },
+ { 0x0000, (char *)NULL, NF } } },
+ { PCI_VENDOR_TOSHIBA, {
+ { 0x0001, "4010CDT CT65555", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#ifdef VENDOR_INCLUDE_NONVIDEO
+ { PCI_VENDOR_BUSLOGIC, {
+ { 0x1040, "BT958", NF },
+ { 0x0000, (char *)NULL, NF } } },
+#endif
+ {0x0000, {
+ {0x0000, NULL, NF } } },
+};
+#endif
+#endif
+#endif /* _XF86_PCIINFO_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PnPMouse.c b/xc/programs/Xserver/hw/xfree86/common/xf86PnPMouse.c
new file mode 100644
index 000000000..9b473dc77
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86PnPMouse.c
@@ -0,0 +1,511 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PnPMouse.c,v 1.3 1999/03/14 03:21:52 dawes Exp $ */
+
+/*
+ * Copyright 1998 by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Kazutaka YOKOTA not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Kazutaka YOKOTA makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * KAZUTAKA YOKOTA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KAZUTAKA YOKOTA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define NEED_EVENTS
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifdef ISC
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMSET 0x5418
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#endif
+
+/* serial PnP ID string */
+typedef struct {
+ int revision; /* PnP revision, 100 for 1.00 */
+ char *eisaid; /* EISA ID including mfr ID and product ID */
+ char *serial; /* serial No, optional */
+ char *class; /* device class, optional */
+ char *compat; /* list of compatible drivers, optional */
+ char *description; /* product description, optional */
+ int neisaid; /* length of the above fields... */
+ int nserial;
+ int nclass;
+ int ncompat;
+ int ndescription;
+} pnpid_t;
+
+/* symbol table entry */
+typedef struct {
+ char *name;
+ int val;
+} symtab_t;
+
+/* PnP EISA/product IDs */
+static symtab_t pnpprod[] = {
+ { "KML0001", PROT_THINKING }, /* Kensignton ThinkingMouse */
+ { "MSH0001", PROT_IMSERIAL }, /* MS IntelliMouse */
+ { "MSH0004", PROT_IMSERIAL }, /* MS IntelliMouse TrackBall */
+ { "KYEEZ00", PROT_MS }, /* Genius EZScroll */
+ { "KYE0001", PROT_MS }, /* Genius PnP Mouse */
+ { "KYE0003", PROT_IMSERIAL }, /* Genius NetMouse */
+ { "LGI800C", PROT_IMSERIAL }, /* Logitech MouseMan (4 button model) */
+ { "LGI8050", PROT_IMSERIAL }, /* Logitech MouseMan+ */
+ { "LGI8051", PROT_IMSERIAL }, /* Logitech FirstMouse+ */
+ { "LGI8001", PROT_LOGIMAN }, /* Logitech serial */
+
+ { "PNP0F00", PROT_BM }, /* MS bus */
+ { "PNP0F01", PROT_MS }, /* MS serial */
+ { "PNP0F02", PROT_BM }, /* MS InPort */
+ { "PNP0F03", PROT_PS2 }, /* MS PS/2 */
+ /*
+ * EzScroll returns PNP0F04 in the compatible device field; but it
+ * doesn't look compatible... XXX
+ */
+ { "PNP0F04", PROT_MSC }, /* MouseSystems */
+ { "PNP0F05", PROT_MSC }, /* MouseSystems */
+#ifdef notyet
+ { "PNP0F06", PROT_??? }, /* Genius Mouse */
+ { "PNP0F07", PROT_??? }, /* Genius Mouse */
+#endif
+ { "PNP0F08", PROT_LOGIMAN }, /* Logitech serial */
+ { "PNP0F09", PROT_MS }, /* MS BallPoint serial */
+ { "PNP0F0A", PROT_MS }, /* MS PnP serial */
+ { "PNP0F0B", PROT_MS }, /* MS PnP BallPoint serial */
+ { "PNP0F0C", PROT_MS }, /* MS serial comatible */
+ { "PNP0F0D", PROT_BM }, /* MS InPort comatible */
+ { "PNP0F0E", PROT_PS2 }, /* MS PS/2 comatible */
+ { "PNP0F0F", PROT_MS }, /* MS BallPoint comatible */
+#ifdef notyet
+ { "PNP0F10", PROT_??? }, /* TI QuickPort */
+#endif
+ { "PNP0F11", PROT_BM }, /* MS bus comatible */
+ { "PNP0F12", PROT_PS2 }, /* Logitech PS/2 */
+ { "PNP0F13", PROT_PS2 }, /* PS/2 */
+#ifdef notyet
+ { "PNP0F14", PROT_??? }, /* MS Kids Mouse */
+#endif
+ { "PNP0F15", PROT_BM }, /* Logitech bus */
+#ifdef notyet
+ { "PNP0F16", PROT_??? }, /* Logitech SWIFT */
+#endif
+ { "PNP0F17", PROT_LOGIMAN }, /* Logitech serial compat */
+ { "PNP0F18", PROT_BM }, /* Logitech bus compatible */
+ { "PNP0F19", PROT_PS2 }, /* Logitech PS/2 compatible */
+#ifdef notyet
+ { "PNP0F1A", PROT_??? }, /* Logitech SWIFT compatible */
+ { "PNP0F1B", PROT_??? }, /* HP Omnibook */
+ { "PNP0F1C", PROT_??? }, /* Compaq LTE TrackBall PS/2 */
+ { "PNP0F1D", PROT_??? }, /* Compaq LTE TrackBall serial */
+ { "PNP0F1E", PROT_??? }, /* MS Kids Trackball */
+#endif
+ { NULL, -1 },
+};
+
+static int
+pnpgets(
+#if NeedFunctionPrototypes
+ MouseDevPtr,
+ char *
+#endif
+);
+
+static int
+pnpparse(
+#if NeedFunctionPrototypes
+ pnpid_t *,
+ char *,
+ int
+#endif
+);
+
+static symtab_t *
+pnpproto(
+#if NeedFunctionPrototypes
+ pnpid_t *
+#endif
+);
+
+static symtab_t *
+gettoken(
+#if NeedFunctionPrototypes
+ symtab_t *,
+ char *,
+ int
+#endif
+);
+
+int
+xf86GetPnPMouseProtocol(mouse)
+MouseDevPtr mouse;
+{
+ char buf[256]; /* PnP ID string may be up to 256 bytes long */
+ pnpid_t pnpid;
+ symtab_t *t;
+ int len;
+
+ if (((len = pnpgets(mouse, buf)) <= 0) || !pnpparse(&pnpid, buf, len))
+ return -1;
+ if ((t = pnpproto(&pnpid)) == NULL)
+ return -1;
+ ErrorF("Mouse: protocol: %d\n", t->val);
+ return (t->val);
+}
+
+/*
+ * Try to elicit a PnP ID as described in
+ * Microsoft, Hayes: "Plug and Play External COM Device Specification,
+ * rev 1.00", 1995.
+ *
+ * The routine does not fully implement the COM Enumerator as par Section
+ * 2.1 of the document. In particular, we don't have idle state in which
+ * the driver software monitors the com port for dynamic connection or
+ * removal of a device at the port, because `moused' simply quits if no
+ * device is found.
+ *
+ * In addition, as PnP COM device enumeration procedure slightly has
+ * changed since its first publication, devices which follow earlier
+ * revisions of the above spec. may fail to respond if the rev 1.0
+ * procedure is used. XXX
+ */
+static int
+pnpgets(mouse, buf)
+MouseDevPtr mouse;
+char *buf;
+{
+ struct timeval timeout;
+ fd_set fds;
+ int i;
+ char c;
+
+#if 0
+ /*
+ * This is the procedure described in rev 1.0 of PnP COM device spec.
+ * Unfortunately, some devices which comform to earlier revisions of
+ * the spec gets confused and do not return the ID string...
+ */
+
+ /* port initialization (2.1.2) */
+ ioctl(mouse->mseFd, TIOCMGET, &i);
+ i |= TIOCM_DTR; /* DTR = 1 */
+ i &= ~TIOCM_RTS; /* RTS = 0 */
+ ioctl(mouse->mseFd, TIOCMSET, &i);
+ usleep(200000);
+ if ((ioctl(mouse->mseFd, TIOCMGET, &i) == -1) || ((i & TIOCM_DSR) == 0))
+ goto disconnect_idle;
+
+ /* port setup, 1st phase (2.1.3) */
+ xf86SetMouseSpeed(mouse, 1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
+ ioctl(mouse->mseFd, TIOCMBIC, &i);
+ usleep(200000);
+ i = TIOCM_DTR; /* DTR = 1, RTS = 0 */
+ ioctl(mouse->mseFd, TIOCMBIS, &i);
+ usleep(200000);
+
+ /* wait for response, 1st phase (2.1.4) */
+ xf86FlushInput(mouse->mseFd);
+ i = TIOCM_RTS; /* DTR = 1, RTS = 1 */
+ ioctl(mouse->mseFd, TIOCMBIS, &i);
+
+ /* try to read something */
+ FD_ZERO(&fds);
+ FD_SET(mouse->mseFd, &fds);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
+ if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0) {
+
+ /* port setup, 2nd phase (2.1.5) */
+ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
+ ioctl(mouse->mseFd, TIOCMBIC, &i);
+ usleep(200000);
+
+ /* wait for respose, 2nd phase (2.1.6) */
+ xf86FlushInput(mouse->mseFd);
+ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 1, RTS = 1 */
+ ioctl(mouse->mseFd, TIOCMBIS, &i);
+
+ /* try to read something */
+ FD_ZERO(&fds);
+ FD_SET(mouse->mseFd, &fds);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
+ if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
+ goto connect_idle;
+ }
+#else
+ /*
+ * This is a simplified procedure; it simply toggles RTS.
+ */
+
+ ioctl(mouse->mseFd, TIOCMGET, &i);
+ i |= TIOCM_DTR; /* DTR = 1 */
+ i &= ~TIOCM_RTS; /* RTS = 0 */
+ ioctl(mouse->mseFd, TIOCMSET, &i);
+ usleep(200000);
+
+ xf86SetMouseSpeed(mouse, 1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+
+ /* wait for respose */
+ xf86FlushInput(mouse->mseFd);
+ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 1, RTS = 1 */
+ ioctl(mouse->mseFd, TIOCMBIS, &i);
+
+ /* try to read something */
+ FD_ZERO(&fds);
+ FD_SET(mouse->mseFd, &fds);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
+ if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
+ goto connect_idle;
+#endif
+
+ /* collect PnP COM device ID (2.1.7) */
+ i = 0;
+ usleep(200000); /* the mouse must send `Begin ID' within 200msec */
+ while (read(mouse->mseFd, &c, 1) == 1) {
+ /* we may see "M", or "M3..." before `Begin ID' */
+ if ((c == 0x08) || (c == 0x28)) { /* Begin ID */
+ buf[i++] = c;
+ break;
+ }
+ }
+ if (i <= 0) {
+ /* we haven't seen `Begin ID' in time... */
+ goto connect_idle;
+ }
+
+ ++c; /* make it `End ID' */
+ for (;;) {
+ FD_ZERO(&fds);
+ FD_SET(mouse->mseFd, &fds);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
+ if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
+ break;
+
+ read(mouse->mseFd, &buf[i], 1);
+ if (buf[i++] == c) /* End ID */
+ break;
+ if (i >= 256)
+ break;
+ }
+ if (buf[i - 1] != c)
+ goto connect_idle;
+ return i;
+
+ /*
+ * According to PnP spec, we should set DTR = 1 and RTS = 0 while
+ * in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
+ * assuming there is something at the port even if it didn't
+ * respond to the PnP enumeration procedure.
+ */
+disconnect_idle:
+ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 1, RTS = 1 */
+ ioctl(mouse->mseFd, TIOCMBIS, &i);
+connect_idle:
+ return 0;
+}
+
+static int
+pnpparse(id, buf, len)
+pnpid_t *id;
+char *buf;
+int len;
+{
+ char s[3];
+ int offset;
+ int sum = 0;
+ int i, j;
+
+ id->revision = 0;
+ id->eisaid = NULL;
+ id->serial = NULL;
+ id->class = NULL;
+ id->compat = NULL;
+ id->description = NULL;
+ id->neisaid = 0;
+ id->nserial = 0;
+ id->nclass = 0;
+ id->ncompat = 0;
+ id->ndescription = 0;
+
+ offset = 0x28 - buf[0];
+
+ /* calculate checksum */
+ for (i = 0; i < len - 3; ++i) {
+ sum += buf[i];
+ buf[i] += offset;
+ }
+ sum += buf[len - 1];
+ for (; i < len; ++i)
+ buf[i] += offset;
+ ErrorF("Mouse: PnP ID string: '%*.*s'\n", len, len, buf);
+
+ /* revision */
+ buf[1] -= offset;
+ buf[2] -= offset;
+ id->revision = ((buf[1] & 0x3f) << 6) | (buf[2] & 0x3f);
+ ErrorF("Mouse: PnP rev %d.%02d\n", id->revision / 100, id->revision % 100);
+
+ /* EISA vender and product ID */
+ id->eisaid = &buf[3];
+ id->neisaid = 7;
+
+ /* option strings */
+ i = 10;
+ if (buf[i] == '\\') {
+ /* device serial # */
+ for (j = ++i; i < len; ++i) {
+ if (buf[i] == '\\')
+ break;
+ }
+ if (i >= len)
+ i -= 3;
+ if (i - j == 8) {
+ id->serial = &buf[j];
+ id->nserial = 8;
+ }
+ }
+ if (buf[i] == '\\') {
+ /* PnP class */
+ for (j = ++i; i < len; ++i) {
+ if (buf[i] == '\\')
+ break;
+ }
+ if (i >= len)
+ i -= 3;
+ if (i > j + 1) {
+ id->class = &buf[j];
+ id->nclass = i - j;
+ }
+ }
+ if (buf[i] == '\\') {
+ /* compatible driver */
+ for (j = ++i; i < len; ++i) {
+ if (buf[i] == '\\')
+ break;
+ }
+ /*
+ * PnP COM spec prior to v0.96 allowed '*' in this field,
+ * it's not allowed now; just igore it.
+ */
+ if (buf[j] == '*')
+ ++j;
+ if (i >= len)
+ i -= 3;
+ if (i > j + 1) {
+ id->compat = &buf[j];
+ id->ncompat = i - j;
+ }
+ }
+ if (buf[i] == '\\') {
+ /* product description */
+ for (j = ++i; i < len; ++i) {
+ if (buf[i] == ';')
+ break;
+ }
+ if (i >= len)
+ i -= 3;
+ if (i > j + 1) {
+ id->description = &buf[j];
+ id->ndescription = i - j;
+ }
+ }
+
+ /* checksum exists if there are any optional fields */
+ if ((id->nserial > 0) || (id->nclass > 0)
+ || (id->ncompat > 0) || (id->ndescription > 0)) {
+#if 0
+ ErrorF("Mouse: PnP checksum: 0x%02X\n", sum);
+#endif
+ sprintf(s, "%02X", sum & 0x0ff);
+ if (strncmp(s, &buf[len - 3], 2) != 0) {
+#if 0
+ /*
+ * Checksum error!!
+ * I found some mice do not comply with the PnP COM device
+ * spec regarding checksum... XXX
+ */
+ return FALSE;
+#endif
+ }
+ }
+
+ return TRUE;
+}
+
+static symtab_t *
+pnpproto(id)
+pnpid_t *id;
+{
+ symtab_t *t;
+ int i, j;
+
+ if (id->nclass > 0)
+ if (strncmp(id->class, "MOUSE", id->nclass) != 0)
+ /* this is not a mouse! */
+ return NULL;
+
+ if (id->neisaid > 0) {
+ t = gettoken(pnpprod, id->eisaid, id->neisaid);
+ if (t->val != -1)
+ return t;
+ }
+
+ /*
+ * The 'Compatible drivers' field may contain more than one
+ * ID separated by ','.
+ */
+ if (id->ncompat <= 0)
+ return NULL;
+ for (i = 0; i < id->ncompat; ++i) {
+ for (j = i; id->compat[i] != ','; ++i)
+ if (i >= id->ncompat)
+ break;
+ if (i > j) {
+ t = gettoken(pnpprod, id->compat + j, i - j);
+ if (t->val != -1)
+ return t;
+ }
+ }
+
+ return NULL;
+}
+
+/* name/val mapping */
+
+static symtab_t *
+gettoken(tab, s, len)
+symtab_t *tab;
+char *s;
+int len;
+{
+ int i;
+
+ for (i = 0; tab[i].name != NULL; ++i) {
+ if (strncmp(tab[i].name, s, len) == 0)
+ break;
+ }
+ return &tab[i];
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
new file mode 100644
index 000000000..94db1d290
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h
@@ -0,0 +1,209 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.54 1999/08/01 07:57:11 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains declarations for private XFree86 functions and variables,
+ * and definitions of private macros.
+ *
+ * "private" means not available to video drivers.
+ */
+
+#ifndef _XF86PRIV_H
+#define _XF86PRIV_H
+
+#include "xf86Privstr.h"
+
+/*
+ * Parameters set ONLY from the command line options
+ * The global state of these things is held in xf86InfoRec (when appropriate).
+ */
+extern const char *xf86ConfigFile;
+extern Bool xf86AllowMouseOpenFail;
+#ifdef XF86VIDMODE
+extern Bool xf86VidModeDisabled;
+extern Bool xf86VidModeAllowNonLocal;
+#endif
+#ifdef XF86MISC
+extern Bool xf86MiscModInDevDisabled;
+extern Bool xf86MiscModInDevAllowNonLocal;
+#endif
+extern Bool xf86fpFlag;
+extern Bool xf86coFlag;
+extern Bool xf86sFlag;
+extern Bool xf86bsEnableFlag;
+extern Bool xf86bsDisableFlag;
+extern char *xf86LayoutName;
+extern char *xf86ScreenName;
+extern char *xf86PointerName;
+extern char *xf86KeyboardName;
+#ifdef KEEPBPP
+extern int xf86Bpp;
+#endif
+extern int xf86FbBpp;
+extern int xf86Depth;
+extern Pix24Flags xf86Pix24;
+extern rgb xf86Weight;
+extern Bool xf86FlipPixels;
+extern Bool xf86BestRefresh;
+extern Gamma xf86Gamma;
+extern char *xf86ServerName;
+extern Bool xf86ShowUnresolved;
+
+/* Other parameters */
+
+extern xf86InfoRec xf86Info;
+extern const char *xf86ModulePath;
+extern MessageType xf86ModPathFrom;
+extern const char *xf86LogFile;
+extern MessageType xf86LogFileFrom;
+extern serverLayoutRec xf86ConfigLayout;
+extern Pix24Flags xf86ConfigPix24;
+extern confDRIRec xf86ConfigDRI;
+
+extern unsigned short xf86MouseCflags[];
+extern Bool xf86SupportedMouseTypes[];
+extern int xf86NumMouseTypes;
+
+#ifdef XFree86LOADER
+extern DriverPtr *xf86DriverList;
+#else
+extern DriverPtr xf86DriverList[];
+#endif
+extern int xf86NumDrivers;
+extern Bool xf86Exiting;
+extern Bool xf86Resetting;
+extern Bool xf86Initialising;
+extern Bool xf86ProbeFailed;
+extern int xf86NumScreens;
+extern pciVideoPtr *xf86PciVideoInfo;
+extern xf86CurrentAccessRec xf86CurrentAccess;
+extern const char *xf86VisualNames[];
+extern int xf86Verbose; /* verbosity level */
+extern int xf86LogVerbose; /* log file verbosity level */
+extern Bool xf86ProbeOnly;
+
+#ifndef DEFAULT_VERBOSE
+#define DEFAULT_VERBOSE 1
+#endif
+#ifndef DEFAULT_LOG_VERBOSE
+#define DEFAULT_LOG_VERBOSE 3
+#endif
+#ifndef DEFAULT_DPI
+#define DEFAULT_DPI 75
+#endif
+
+#define DEFAULT_UNRESOLVED TRUE
+#define DEFAULT_BEST_REFRESH FALSE
+
+/* Function Prototypes */
+#ifndef _NO_XF86_PROTOTYPES
+
+/* xf86Beta.c */
+extern void xf86CheckBeta(int extraDays, char *key);
+
+/* xf86Bus.c */
+
+void xf86BusProbe(void);
+void xf86ChangeBusIndex(int oldIndex, int newIndex);
+void xf86AccessInit(void);
+void xf86AccessEnter(void);
+void xf86AccessLeave(void);
+void xf86EntityInit(void);
+void xf86EntityEnter(void);
+void xf86EntityLeave(void);
+void xf86AccessLeaveState(void);
+
+void xf86FindPrimaryDevice(void);
+/* new RAC */
+resPtr xf86AddResToList(resPtr rlist, resRange *range, int entityIndex);
+resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2);
+resPtr xf86DupResList(const resPtr rlist);
+void xf86FreeResList(resPtr rlist);
+void xf86ResourceBrokerInit(void);
+void xf86PostProbe(void);
+void xf86ClearEntityListForScreen(int scrnIndex);
+ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
+extern void xf86PostPreInit(void);
+extern void xf86PostScreenInit(void);
+extern memType getValidBIOSBase(PCITAG tag, int num);
+
+/* xf86Config.c */
+
+Bool xf86PathIsAbsolute(const char *path);
+Bool xf86PathIsSafe(const char *path);
+
+/* xf86DefaultModes */
+
+extern DisplayModeRec xf86DefaultModes [];
+
+/* xf86DoScanPci.c */
+
+void DoScanPci(int argc, char **argv, int i);
+
+/* xf86Events.c */
+
+void xf86PostKbdEvent(unsigned key);
+void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy);
+#ifndef NEW_INPUT
+void xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
+#endif
+void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+void xf86SigHandler(int signo);
+
+/* xf86Helper.c */
+void xf86LogInit(void);
+void xf86CloseLog(void);
+void OsVendorVErrorF(const char *f, va_list args);
+
+/* xf86Init.c */
+Bool xf86LoadModules(char **list, pointer *optlist);
+
+/* xf86Io.c */
+
+void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
+ int unused);
+void xf86KbdLeds(void);
+void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
+void xf86InitKBD(Bool init);
+int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
+#ifndef NEW_INPUT
+void xf86MseCtrl(DevicePtr pPointer, PtrCtrl *ctrl);
+int xf86MseProc(DeviceIntPtr pPointer, int what);
+int xf86MseProcAux(DeviceIntPtr pPointer, int what, MouseDevPtr mouse,
+ int *fd, PtrCtrlProcPtr ctrl);
+void xf86MseEvents(MouseDevPtr mouse);
+
+/* xf86Mouse.c */
+
+Bool xf86MouseSupported(int mousetype);
+void xf86SetupMouse(MouseDevPtr mouse);
+void xf86MouseProtocol(DeviceIntPtr device, unsigned char *rBuf, int nBytes);
+#ifdef XINPUT
+void xf86MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
+#endif
+
+/* xf86PnPMouse.c */
+int xf86GetPnPMouseProtocol(MouseDevPtr mouse);
+#endif
+
+/* xf86Kbd.c */
+
+void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
+
+/* xf86Lock.c */
+
+#ifdef USE_XF86_SERVERLOCK
+void xf86UnlockServer(void);
+#endif
+
+/* xf86XKB.c */
+
+void xf86InitXkb(void);
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+
+#endif /* _XF86PRIV_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
new file mode 100644
index 000000000..4bf5efd0d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
@@ -0,0 +1,276 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.16 1999/07/11 10:27:05 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997,1998 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains definitions of the private XFree86 data structures/types.
+ * None of the data structures here should be used by video drivers.
+ */
+
+#ifndef _XF86PRIVSTR_H
+#define _XF86PRIVSTR_H
+
+#include "Xproto.h"
+#include "xf86Pci.h"
+#ifdef XINPUT
+#endif
+
+#ifndef NEW_INPUT
+/* Mouse device private record */
+
+typedef struct _MouseDevRec {
+ DeviceProc mseProc; /* procedure for initializing */
+ void (*mseEvents)(struct _MouseDevRec *);
+ /* proc for processing events */
+ DeviceIntPtr device;
+ int mseFd;
+ char * mseDevice;
+ MouseProtocol mseType;
+ int mseModel;
+ int baudRate;
+ int oldBaudRate;
+ int sampleRate;
+ int lastButtons;
+ int threshold; /* acceleration */
+ int num;
+ int den;
+ int buttons; /* # of buttons */
+ int emulateState; /* automata state for 2 button mode */
+ Bool emulate3Buttons;
+ int emulate3Timeout;/* Timeout for 3 button emulation */
+ Bool chordMiddle;
+ int mouseFlags; /* Flags to Clear after opening
+ * mouse dev */
+ int truebuttons; /* Arg to maintain before
+ * emulate3buttons timer callback */
+ int resolution;
+ int negativeZ;
+ int positiveZ;
+#ifndef MOUSE_PROTOCOL_IN_KERNEL
+ int protoBufTail;
+#ifndef WSCONS_SUPPORT
+ unsigned char protoBuf[8];
+#else
+ unsigned char protoBuf[32];
+#endif
+ unsigned char protoPara[7];
+ unsigned char inSync; /* driver in sync with datastream */
+#endif
+ /* xqueue part */
+ int xquePending; /* was xqueFd, but nothing uses that */
+ int xqueSema;
+#ifdef XINPUT
+ struct _LocalDeviceRec *local;
+#endif
+} MouseDevRec, *MouseDevPtr;
+
+#ifndef XINPUT
+#define MOUSE_DEV(dev) (MouseDevPtr) (dev)->public.devicePrivate
+#endif
+
+/* Mouse device private record */
+
+#define MSE_MAPTOX -1
+#define MSE_MAPTOY -2
+#define MSE_MAXBUTTONS 12
+#define MSE_DFLTBUTTONS 3
+#endif
+
+/* PCI probe flags */
+
+typedef enum {
+ PCIProbe1 = 0,
+ PCIProbe2,
+ PCIForceConfig1,
+ PCIForceConfig2
+} PciProbeType;
+
+/*
+ * xf86InfoRec contains global parameters which the video drivers never
+ * need to access. Global parameters which the video drivers do need
+ * should be individual globals.
+ */
+
+typedef struct {
+
+ /* keyboard part */
+ DeviceIntPtr pKeyboard;
+ DeviceProc kbdProc; /* procedure for initializing */
+ void (* kbdEvents)(void); /* proc for processing events */
+ int consoleFd;
+ int kbdFd;
+ int vtno;
+ int kbdType; /* AT84 / AT101 */
+ int kbdRate;
+ int kbdDelay;
+ int bell_pitch;
+ int bell_duration;
+ Bool autoRepeat;
+ unsigned long leds;
+ unsigned long xleds;
+ char * vtinit;
+ int scanPrefix; /* scancode-state */
+ Bool capsLock;
+ Bool numLock;
+ Bool scrollLock;
+ Bool modeSwitchLock;
+ Bool composeLock;
+ Bool vtSysreq;
+#if defined(SVR4) && defined(i386)
+ Bool panix106;
+#endif /* SVR4 && i386 */
+
+ /* mouse part */
+ DeviceIntPtr pMouse;
+#ifdef XINPUT
+ pointer mouseLocal;
+#endif
+#ifndef NEW_INPUT
+ MouseDevPtr mouseDev;
+#endif
+
+ /* event handler part */
+ int lastEventTime;
+ Bool vtRequestsPending;
+ Bool inputPending;
+ Bool dontZap;
+ Bool dontZoom;
+ Bool notrapSignals; /* don't exit cleanly - die at fault */
+ Bool caughtSignal;
+
+ /* graphics part */
+ Bool sharedMonitor;
+ ScreenPtr currentScreen;
+#ifdef CSRG_BASED
+ int screenFd; /* fd for memory mapped access to
+ * vga card */
+ int consType; /* Which console driver? */
+#endif
+#if defined(AMOEBA)
+ void * screenPtr;
+#endif
+
+#ifdef XKB
+ /*
+ * would like to use an XkbComponentNamesRec here but can't without
+ * pulling in a bunch of header files. :-(
+ */
+ char * xkbkeymap;
+ char * xkbkeycodes;
+ char * xkbtypes;
+ char * xkbcompat;
+ char * xkbsymbols;
+ char * xkbgeometry;
+ Bool xkbcomponents_specified;
+ char * xkbrules;
+ char * xkbmodel;
+ char * xkblayout;
+ char * xkbvariant;
+ char * xkboptions;
+#endif
+
+ /* Other things */
+ Bool allowMouseOpenFail;
+ Bool vidModeEnabled; /* VidMode extension enabled */
+ Bool vidModeAllowNonLocal; /* allow non-local VidMode
+ * connections */
+ Bool miscModInDevEnabled; /* Allow input devices to be
+ * changed */
+ Bool miscModInDevAllowNonLocal;
+ PciProbeType pciFlags;
+ Pix24Flags pixmap24;
+ MessageType pix24From;
+#if defined(i386) || defined(__i386__)
+ Bool pc98;
+#endif
+} xf86InfoRec, *xf86InfoPtr;
+
+#ifdef DPMSExtension
+/* Private info for DPMS */
+typedef struct {
+ DPMSSetProcPtr Set;
+ CloseScreenProcPtr CloseScreen;
+ Bool Enabled;
+ int Flags;
+} DPMSRec, *DPMSPtr;
+#endif
+
+#ifdef XF86VIDMODE
+/* Private info for Video Mode Extentsion */
+typedef struct {
+ DisplayModePtr First;
+ DisplayModePtr Next;
+ int Flags;
+ CloseScreenProcPtr CloseScreen;
+} VidModeRec, *VidModePtr;
+#endif
+
+typedef struct pciBusRec {
+ int brbus, brdev, brfunc; /* ID of the bridge to this bus */
+ int primary, secondary, subordinate;
+ int subclass; /* bridge type */
+ resPtr io; /* I/O range */
+ resPtr mem; /* non-prefetchable memory range */
+ resPtr pmem; /* prefetchable memory range */
+ int brcontrol; /* bridge_control byte */
+ struct pciBusRec *next;
+} PciBusRec, *PciBusPtr;
+
+/* private resource types */
+#define ResNoAvoid ResBios
+
+/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
+#define XLED1 ((unsigned long) 0x00000001)
+#define XLED2 ((unsigned long) 0x00000002)
+#define XLED3 ((unsigned long) 0x00000004)
+#define XLED4 ((unsigned long) 0x00000008)
+#define XCAPS ((unsigned long) 0x20000000)
+#define XNUM ((unsigned long) 0x40000000)
+#define XSCR ((unsigned long) 0x80000000)
+#define XCOMP ((unsigned long) 0x00008000)
+
+/* BSD console driver types (consType) */
+#ifdef CSRG_BASED
+#define PCCONS 0
+#define CODRV011 1
+#define CODRV01X 2
+#define SYSCONS 8
+#define PCVT 16
+#endif
+
+/* Values of xf86Info.mouseFlags */
+#define MF_CLEAR_DTR 1
+#define MF_CLEAR_RTS 2
+
+/* Prefix strings for driver messages */
+#ifndef X_UNKNOWN_STRING
+#define X_UNKNOWN_STRING "(\?\?)"
+#endif
+#ifndef X_PROBE_STRING
+#define X_PROBE_STRING "(--)"
+#endif
+#ifndef X_CONFIG_STRING
+#define X_CONFIG_STRING "(**)"
+#endif
+#ifndef X_DEFAULT_STRING
+#define X_DEFAULT_STRING "(==)"
+#endif
+#ifndef X_CMDLINE_STRING
+#define X_CMDLINE_STRING "(++)"
+#endif
+#ifndef X_NOTICE_STRING
+#define X_NOTICE_STRING "(!!)"
+#endif
+#ifndef X_ERROR_STRING
+#define X_ERROR_STRING "(EE)"
+#endif
+#ifndef X_WARNING_STRING
+#define X_WARNING_STRING "(WW)"
+#endif
+#ifndef X_INFO_STRING
+#define X_INFO_STRING "(II)"
+#endif
+
+#endif /* _XF86PRIVSTR_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h
new file mode 100644
index 000000000..f1380d426
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h
@@ -0,0 +1,82 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.5 1999/08/01 07:57:12 dawes Exp $ */
+
+#ifndef _XF86_RESOURCES_H
+
+#define _XF86_RESOURCES_H
+
+#include "xf86str.h"
+
+#define _END {ResEnd,0,0}
+
+#define _VGA_EXCLUSIVE {ResExcMemBlock,0xA0000,0xAFFFF},\
+ {ResExcMemBlock,0xB0000,0xB7FFF},\
+ {ResExcMemBlock,0xB8000,0xBFFFF},\
+ {ResExcIoBlock,0x3B0,0x3BB},\
+ {ResExcIoBlock,0x3C0,0x3DF}
+
+#define _VGA_SHARED {ResShrMemBlock,0xA0000,0xAFFFF},\
+ {ResShrMemBlock,0xB0000,0xB7FFF},\
+ {ResShrMemBlock,0xB8000,0xBFFFF},\
+ {ResShrIoBlock,0x3B0,0x3BB},\
+ {ResShrIoBlock,0x3C0,0x3DF}
+
+/* exclusive unused VGA: resource uneeded but cannot be disabled. */
+/* like old Millennium */
+#define _VGA_EXCLUSIVE_UNUSED {ResExcUusdMemBlock,0xA0000,0xAFFFF},\
+ {ResExcUusdMemBlock,0xB0000,0xB7FFF},\
+ {ResExcUusdMemBlock,0xB8000,0xBFFFF},\
+ {ResExcUusdIoBlock,0x3B0,0x3BB},\
+ {ResExcUusdIoBlock,0x3C0,0x3DF}
+
+/* shared unused VGA: resources unneeded but cannot be disabled */
+/* independently. This is used to determine if a device needs rac */
+#define _VGA_SHARED_UNUSED {ResShrUusdMemBlock,0xA0000,0xAFFFF},\
+ {ResShrUusdMemBlock,0xB0000,0xB7FFF},\
+ {ResShrUusdMemBlock,0xB8000,0xBFFFF},\
+ {ResShrUusdIoBlock,0x3B0,0x3BB},\
+ {ResShrUusdIoBlock,0x3C0,0x3DF}
+
+/* Sparse versions of the above for those adapters that respond to all ISA
+ * aliases of VGA ports. */
+#define _VGA_EXCLUSIVE_SPARSE {ResExcMemBlock,0xA0000,0xAFFFF},\
+ {ResExcMemBlock,0xB0000,0xB7FFF},\
+ {ResExcMemBlock,0xB8000,0xBFFFF},\
+ {ResExcIoSparse,0x3B0,0x3F8},\
+ {ResExcIoSparse,0x3B8,0x3FC},\
+ {ResExcIoSparse,0x3C0,0x3E0}
+
+#define _VGA_SHARED_SPARSE {ResShrMemBlock,0xA0000,0xAFFFF},\
+ {ResShrMemBlock,0xB0000,0xB7FFF},\
+ {ResShrMemBlock,0xB8000,0xBFFFF},\
+ {ResShrIoSparse,0x3B0,0x3F8},\
+ {ResShrIoSparse,0x3B8,0x3FC},\
+ {ResShrIoSparse,0x3C0,0x3E0}
+
+#define _8514_EXCLUSIVE {ResExcIoSparse,0x2E8,0x3F8}
+
+#define _8514_SHARED {ResShrIoSparse,0x2E8,0x3F8}
+
+/* predefined resources */
+extern resRange resVgaExclusive[];
+extern resRange resVgaShared[];
+extern resRange resVgaUnusedExclusive[];
+extern resRange resVgaUnusedShared[];
+extern resRange resVgaSparseExclusive[];
+extern resRange resVgaSparseShared[];
+extern resRange res8514Exclusive[];
+extern resRange res8514Shared[];
+
+/* old style names */
+#define RES_EXCLUSIVE_VGA resVgaExclusive
+#define RES_SHARED_VGA resVgaShared
+#define RES_EXCLUSIVE_8514 res8514Exclusive
+#define RES_SHARED_8514 res8514Shared
+
+#define _PCI_AVOID {ResExcIoSparse, 0x100, 0x300},\
+ {ResExcIoSparse, 0x200, 0x200}
+
+extern resRange PciAvoid[];
+
+#define RES_UNDEFINED NULL
+#endif
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c b/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c
new file mode 100644
index 000000000..cbcfb83a2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright 1997-1998 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c,v 3.8 1999/05/07 02:56:14 dawes Exp $ */
+
+#if !defined(sun) || defined(i386)
+#include "xf86.h"
+#include "xf86Xinput.h"
+#else
+#include "extio.h"
+#endif
+
+/******************************************************************************
+ * debugging macro
+ *****************************************************************************/
+#ifdef DBG
+#undef DBG
+#endif
+#ifdef DEBUG
+#undef DEBUG
+#endif
+
+static int debug_level = 0;
+#define DEBUG 1
+#if DEBUG
+#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
+#else
+#define DBG(lvl, f)
+#endif
+
+/******************************************************************************
+ * device records
+ *****************************************************************************/
+
+typedef struct
+{
+ XID last; /* last core pointer */
+} SwitchDevRec, *SwitchDevPtr;
+
+/*
+ ***************************************************************************
+ *
+ * xf86SwtConvert --
+ * Convert valuators to X and Y.
+ *
+ ***************************************************************************
+ */
+static Bool
+xf86SwtConvert(LocalDevicePtr local,
+ int first,
+ int num,
+ int v0,
+ int v1,
+ int v2,
+ int v3,
+ int v4,
+ int v5,
+ int* x,
+ int* y)
+{
+ return FALSE;
+}
+
+/*
+ * xf86SwitchCoreDevice --
+ * Test if the core device has changed and send a motion event accordingly.
+ */
+void
+xf86SwitchCoreDevice(LocalDevicePtr local,
+ DeviceIntPtr core)
+{
+ SwitchDevPtr priv;
+
+ if (!local)
+ return;
+
+ priv = (SwitchDevPtr) local->private;
+
+ if (core->id != priv->last) {
+ DBG(3, ErrorF("xf86SwitchCoreDevice new core id=%d old=%d\n", core->id, priv->last));
+ priv->last = core->id;
+ xf86PostMotionEvent(local->dev, 1, 0, 1, core->id);
+ }
+}
+
+static void
+xf86SwtControlProc(DeviceIntPtr device,
+ PtrCtrl *ctrl)
+{
+ DBG(2, ErrorF("xf86SwtControlProc\n"));
+}
+
+/*
+ * xf86SwtProc --
+ * Handle the initialization, etc. of a switch
+ */
+static int
+xf86SwtProc(pSwt, what)
+ DeviceIntPtr pSwt;
+ int what;
+{
+ int loop;
+ int nbaxes;
+ LocalDevicePtr local = (LocalDevicePtr)pSwt->public.devicePrivate;
+ SwitchDevPtr priv = (SwitchDevPtr)XI_PRIVATE(pSwt);
+
+ DBG(2, ErrorF("BEGIN xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv));
+
+ switch (what)
+ {
+ case DEVICE_INIT:
+ DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=INIT\n", pSwt));
+
+ nbaxes = 1;
+
+ if (InitFocusClassDeviceStruct(pSwt) == FALSE)
+ {
+ ErrorF("unable to init Focus class device\n");
+ return !Success;
+ }
+
+ if (InitValuatorClassDeviceStruct(pSwt,
+ nbaxes,
+ xf86GetMotionEvents,
+ local->history_size,
+ Absolute) /* relatif ou absolute */
+ == FALSE)
+ {
+ ErrorF("unable to allocate Valuator class device\n");
+ return !Success;
+ }
+ else
+ {
+ for(loop=0; loop<nbaxes; loop++) {
+ InitValuatorAxisStruct(pSwt,
+ loop,
+ 0, /* min val */
+ 1000, /* max val */
+ 1); /* resolution */
+ }
+ /* allocate the motion history buffer if needed */
+ xf86MotionHistoryAllocate(local);
+
+ AssignTypeAndName(pSwt, local->atom, local->name);
+ }
+
+ break;
+
+ case DEVICE_ON:
+ DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=ON\n", pSwt));
+ pSwt->public.on = TRUE;
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=%s\n", pSwt,
+ (what == DEVICE_CLOSE) ? "CLOSE" : "OFF"));
+ pSwt->public.on = FALSE;
+ break;
+
+ default:
+ ErrorF("unsupported mode=%d\n", what);
+ return !Success;
+ break;
+ }
+ DBG(2, ErrorF("END xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv));
+ return Success;
+}
+
+/*
+ * xf86SwtAllocate --
+ * Allocate Switch device structures.
+ */
+static LocalDevicePtr
+xf86SwtAllocate()
+{
+ LocalDevicePtr local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec));
+ SwitchDevPtr priv = (SwitchDevPtr) xalloc(sizeof(SwitchDevRec));
+
+ local->name = "SWITCH";
+ local->flags = 0;
+ local->device_control = xf86SwtProc;
+ local->read_input = NULL;
+ local->close_proc = NULL;
+ local->control_proc = NULL;
+ local->switch_mode = NULL;
+ local->conversion_proc = xf86SwtConvert;
+ local->fd = -1;
+ local->atom = 0;
+ local->dev = NULL;
+ local->private = priv;
+ local->type_name = "Switch";
+ local->history_size = 0;
+
+ priv->last = -1;
+
+ return local;
+}
+
+/*
+ * switch association
+ */
+DeviceAssocRec switch_assoc =
+{
+ " ", /* config_section_name */
+ xf86SwtAllocate /* device_allocate */
+};
+
+/* end of xf86Switch.c */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c b/xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c
new file mode 100644
index 000000000..fd274c78b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c
@@ -0,0 +1,730 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.6 1999/08/28 09:00:54 dawes Exp $ */
+
+/*
+ * This file contains the VidMode functions required by the extension.
+ * These have been added to avoid the need for the higher level extension
+ * code to access the private XFree86 data structures directly. Wherever
+ * possible this code uses the functions in xf86Mode.c to do the work,
+ * so that two version of code that do similar things don't have to be
+ * maintained.
+ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef XF86VIDMODE
+#include "vidmodeproc.h"
+#include "xf86cmap.h"
+
+static int VidModeGeneration = 0;
+static int VidModeIndex = -1;
+static int VidModeCount = 0;
+static Bool VidModeClose(int i, ScreenPtr pScreen);
+
+#define VMPTR(p) ((VidModePtr)(p)->devPrivates[VidModeIndex].ptr)
+
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+Bool
+VidModeExtensionInit(ScreenPtr pScreen)
+{
+#ifdef XF86VIDMODE
+ VidModePtr pVidMode;
+
+ DEBUG_P("VidModeExtensionInit");
+
+ if (!xf86GetVidModeEnabled()) {
+ DEBUG_P("!xf86GetVidModeEnabled()");
+ return FALSE;
+ }
+
+ if (serverGeneration != VidModeGeneration) {
+ if ((VidModeIndex = AllocateScreenPrivateIndex()) < 0) {
+ DEBUG_P("AllocateScreenPrivateIndex() failed");
+ return FALSE;
+ }
+ VidModeGeneration = serverGeneration;
+ }
+
+ if (!(pScreen->devPrivates[VidModeIndex].ptr = xcalloc(sizeof(VidModeRec), 1))) {
+ DEBUG_P("xcalloc failed");
+ return FALSE;
+ }
+
+ pVidMode = VMPTR(pScreen);
+ pVidMode->Flags = 0;
+ pVidMode->Next = NULL;
+ pVidMode->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = VidModeClose;
+ VidModeCount++;
+ return TRUE;
+#else
+ DEBUG_P("no vidmode extension");
+ return FALSE;
+#endif
+}
+
+
+#ifdef XF86VIDMODE
+
+static Bool
+VidModeClose(int i, ScreenPtr pScreen)
+{
+ VidModePtr pVidMode = VMPTR(pScreen);
+
+ DEBUG_P("VidModeClose");
+
+ /* This shouldn't happen */
+ if (!pVidMode)
+ return FALSE;
+
+ pScreen->CloseScreen = pVidMode->CloseScreen;
+
+ if (--VidModeCount == 0)
+ VidModeIndex = -1;
+ return pScreen->CloseScreen(i, pScreen);
+}
+
+Bool
+VidModeAvailable(int scrnIndex)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+
+ DEBUG_P("VidModeAvailable");
+
+ if (VidModeIndex < 0) {
+ DEBUG_P("VidModeIndex < 0");
+ return FALSE;
+ }
+
+ pScrn = xf86Screens[scrnIndex];
+ if (pScrn == NULL) {
+ DEBUG_P("pScrn == NULL");
+ return FALSE;
+ }
+
+ pVidMode = VMPTR(pScrn->pScreen);
+ if (pVidMode)
+ return TRUE;
+ else {
+ DEBUG_P("pVidMode == NULL");
+ return FALSE;
+ }
+}
+
+Bool
+VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetCurrentModeline");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *mode = (pointer)(pScrn->currentMode);
+ *dotClock = pScrn->currentMode->Clock;
+
+ return TRUE;
+}
+
+int
+VidModeGetDotClock(int scrnIndex, int Clock)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetDotClock");
+
+ if (!VidModeAvailable(scrnIndex))
+ return 0;
+
+ pScrn = xf86Screens[scrnIndex];
+ if ((pScrn->progClock) || (Clock > MAXCLOCKS))
+ return Clock;
+ else
+ return pScrn->clock[Clock];
+}
+
+int
+VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetNumOfClocks");
+
+ if (!VidModeAvailable(scrnIndex))
+ return 0;
+
+ pScrn = xf86Screens[scrnIndex];
+ if (pScrn->progClock){
+ *progClock = TRUE;
+ return 0;
+ } else {
+ *progClock = FALSE;
+ return pScrn->numClocks;
+ }
+}
+
+Bool
+VidModeGetClocks(int scrnIndex, int *Clocks)
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ DEBUG_P("VidModeGetClocks");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ if (pScrn->progClock)
+ return FALSE;
+
+ for (i = 0; i < pScrn->numClocks; i++)
+ *Clocks++ = pScrn->clock[i];
+
+ return TRUE;
+}
+
+
+Bool
+VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+
+ DEBUG_P("VidModeGetFirstModeline");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ pVidMode = VMPTR(pScrn->pScreen);
+ pVidMode->First = pScrn->modes;
+ pVidMode->Next = pVidMode->First->next;
+
+ if (pVidMode->First->status == MODE_OK) {
+ *mode = (pointer)(pVidMode->First);
+ *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
+ return TRUE;
+ }
+
+ return VidModeGetNextModeline(scrnIndex, mode, dotClock);
+}
+
+Bool
+VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+ DisplayModePtr p;
+
+ DEBUG_P("VidModeGetNextModeline");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ pVidMode = VMPTR(pScrn->pScreen);
+
+ for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
+ if (p->status == MODE_OK) {
+ pVidMode->Next = p->next;
+ *mode = (pointer)p;
+ *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+Bool
+VidModeDeleteModeline(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeDeleteModeline");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86DeleteMode(&(pScrn->modes), (DisplayModePtr)mode);
+ return TRUE;
+}
+
+Bool
+VidModeZoomViewport(int scrnIndex, int zoom)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeZoomViewPort");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86ZoomViewport(pScrn->pScreen, zoom);
+ return TRUE;
+}
+
+Bool
+VidModeSetViewPort(int scrnIndex, int x, int y)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeSetViewPort");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86SetViewport(pScrn->pScreen, min(0, x), min(0, y));
+
+ return TRUE;
+}
+Bool
+VidModeGetViewPort(int scrnIndex, int *x, int *y)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetViewPort");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *x = pScrn->frameX0;
+ *y = pScrn->frameY0;
+ return TRUE;
+}
+
+Bool
+VidModeSwitchMode(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+ Bool tmp;
+
+ DEBUG_P("VidModeSwitchMode");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ /* This is basically the xf86ZoomViewport code reproduced */
+
+ if (pScrn->SwitchMode == NULL) return FALSE;
+
+ xf86EnterServerState(SETUP);
+ tmp = pScrn->SwitchMode(scrnIndex, (DisplayModePtr)mode, 0);
+ xf86EnterServerState(OPERATING);
+ if (tmp) {
+ /*
+ * adjust new frame for the displaysize
+ */
+ pScrn->currentMode = (DisplayModePtr)mode;
+ pScrn->frameX0 = (pScrn->frameX1 + pScrn->frameX0 -
+ ((DisplayModePtr)mode)->HDisplay) / 2;
+ pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1;
+
+ if (pScrn->frameX0 < 0) {
+ pScrn->frameX0 = 0;
+ pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1;
+ } else if (pScrn->frameX1 >= pScrn->virtualX) {
+ pScrn->frameX0 = pScrn->virtualX - ((DisplayModePtr)mode)->HDisplay;
+ pScrn->frameX1 = pScrn->frameX0 + ((DisplayModePtr)mode)->HDisplay - 1;
+ }
+
+ pScrn->frameY0 = (pScrn->frameY1 + pScrn->frameY0 -
+ ((DisplayModePtr)mode)->VDisplay) / 2;
+ pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1;
+
+ if (pScrn->frameY0 < 0) {
+ pScrn->frameY0 = 0;
+ pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1;
+ } else if (pScrn->frameY1 >= pScrn->virtualY) {
+ pScrn->frameY0 = pScrn->virtualY - ((DisplayModePtr)mode)->VDisplay;
+ pScrn->frameY1 = pScrn->frameY0 + ((DisplayModePtr)mode)->VDisplay - 1;
+ }
+ }
+
+ if (pScrn->AdjustFrame != NULL)
+ (pScrn->AdjustFrame)(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ return TRUE;
+}
+
+Bool
+VidModeLockZoom(int scrnIndex, Bool lock)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeLockZoom");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ if (xf86Info.dontZoom)
+ return FALSE;
+
+ xf86LockZoom(pScrn->pScreen, lock);
+ return TRUE;
+}
+
+Bool
+VidModeGetMonitor(int scrnIndex, pointer *monitor)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetMonitor");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *monitor = (pointer)(pScrn->monitor);
+
+ return TRUE;
+}
+
+Bool
+VidModeCheckModeClock(int scrnIndex, pointer mode, int dotClock)
+{
+ ScrnInfoPtr pScrn;
+ int extraFlags = 0;
+ int minimumGap = CLOCK_TOLERANCE + 1;
+ int i, gap;
+
+ DEBUG_P("VidModeCheckModeClock");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ /* Clock checking code, mostly copied from the xf86LookupMode function */
+ if ((dotClock < pScrn->numClocks) || (pScrn->progClock)) {
+ ((DisplayModePtr)mode)->Clock = dotClock;
+ } else {
+ Bool allowDiv2 = FALSE; /* The driver passes these, so where do I */
+ int ClockDivFactor = 1; /* them from? For now just set them to */
+ int ClockMulFactor = 1; /* sensible values. maxClock set to a no. */
+ int maxClock = 1000000; /* large enough so it is ignored */
+
+ i = xf86GetNearestClock(pScrn, dotClock, allowDiv2,
+ ClockDivFactor, ClockMulFactor, &extraFlags);
+
+ if (extraFlags & V_CLKDIV2) {
+ if ( ((pScrn->clock[i]/2) / 1000) > (maxClock / 1000) )
+ return FALSE;
+ gap = abs((dotClock * 2) -
+ ((pScrn->clock[i] * ClockDivFactor) / ClockMulFactor));
+ } else {
+ if ( ((pScrn->clock[i]) / 1000) > (maxClock / 1000) )
+ return FALSE;
+ gap = abs(dotClock -
+ ((pScrn->clock[i] * ClockDivFactor) / ClockMulFactor));
+ }
+
+ if (gap > minimumGap) {
+ return FALSE;
+ } else {
+ ((DisplayModePtr)mode)->Clock = i;
+ }
+ }
+ return TRUE;
+ }
+
+ModeStatus
+VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeCheckModeForMonitor");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return MODE_ERROR;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor);
+}
+
+ModeStatus
+VidModeCheckModeForDriver(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeCheckModeForDriver");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return MODE_ERROR;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor);
+}
+
+void
+VidModeSetCrtcForMode(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+ DisplayModePtr ScreenModes;
+
+ DEBUG_P("VidModeSetCrtcForMode");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return;
+
+ /* Ugly hack so that the xf86Mode.c function can be used without change */
+ pScrn = xf86Screens[scrnIndex];
+ ScreenModes = pScrn->modes;
+ pScrn->modes = (DisplayModePtr)mode;
+
+ /*
+ * XXXX What can we do here!!! Generally this call is from the driver
+ * and so there is no way to find the value of the flags in the VidMode
+ * extension. Pick INTERLACE_HALVE_V as the flags as this seems to be
+ * universally used!!
+ */
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+ pScrn->modes = ScreenModes;
+ return;
+}
+
+Bool
+VidModeAddModeline(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeAddModeline");
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ ((DisplayModePtr)mode)->next = pScrn->modes->next;
+ ((DisplayModePtr)mode)->prev = pScrn->modes;
+ pScrn->modes->next = (DisplayModePtr)mode;
+ ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode;
+
+ return TRUE;
+}
+
+int
+VidModeGetNumOfModes(int scrnIndex)
+{
+ pointer mode = NULL;
+ int dotClock= 0, nummodes = 0;
+
+ DEBUG_P("VidModeGetNumOfModes");
+
+ if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
+ return nummodes;
+
+ do {
+ nummodes++;
+ if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock))
+ return nummodes;
+ } while (TRUE);
+}
+
+Bool
+VidModeSetGamma(int scrnIndex, float red, float green, float blue)
+{
+ ScrnInfoPtr pScrn;
+ Gamma gamma;
+
+ DEBUG_P("VidModeSetGamma");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ gamma.red = red;
+ gamma.green = green;
+ gamma.blue = blue;
+ if (xf86ChangeGamma(pScrn->pScreen, gamma) != Success)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+Bool
+VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
+{
+ ScrnInfoPtr pScrn;
+
+ DEBUG_P("VidModeGetGamma");
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *red = pScrn->gamma.red;
+ *green = pScrn->gamma.green;
+ *blue = pScrn->gamma.blue;
+ return TRUE;
+}
+
+pointer
+VidModeCreateMode(void)
+{
+ DisplayModePtr mode;
+
+ mode = xalloc(sizeof(DisplayModeRec));
+ if (mode != NULL) {
+ mode->name = "";
+ mode->Private = NULL;
+ mode->next = mode;
+ mode->prev = mode;
+ }
+ return mode;
+}
+
+void
+VidModeCopyMode(pointer modefrom, pointer modeto)
+{
+ memcpy(modeto, modefrom, sizeof(DisplayModeRec));
+}
+
+
+int
+VidModeGetModeValue(pointer mode, int valtyp)
+{
+ int ret = 0;
+
+ switch (valtyp) {
+ case VIDMODE_H_DISPLAY:
+ ret = ((DisplayModePtr) mode)->HDisplay;
+ break;
+ case VIDMODE_H_SYNCSTART:
+ ret = ((DisplayModePtr)mode)->HSyncStart;
+ break;
+ case VIDMODE_H_SYNCEND:
+ ret = ((DisplayModePtr)mode)->HSyncEnd;
+ break;
+ case VIDMODE_H_TOTAL:
+ ret = ((DisplayModePtr)mode)->HTotal;
+ break;
+ case VIDMODE_H_SKEW:
+ ret = ((DisplayModePtr)mode)->HSkew;
+ break;
+ case VIDMODE_V_DISPLAY:
+ ret = ((DisplayModePtr)mode)->VDisplay;
+ break;
+ case VIDMODE_V_SYNCSTART:
+ ret = ((DisplayModePtr)mode)->VSyncStart;
+ break;
+ case VIDMODE_V_SYNCEND:
+ ret = ((DisplayModePtr)mode)->VSyncEnd;
+ break;
+ case VIDMODE_V_TOTAL:
+ ret = ((DisplayModePtr)mode)->VTotal;
+ break;
+ case VIDMODE_FLAGS:
+ ret = ((DisplayModePtr)mode)->Flags;
+ break;
+ case VIDMODE_CLOCK:
+ ret = ((DisplayModePtr)mode)->Clock;
+ break;
+ }
+ return ret;
+}
+
+void
+VidModeSetModeValue(pointer mode, int valtyp, int val)
+{
+ switch (valtyp) {
+ case VIDMODE_H_DISPLAY:
+ ((DisplayModePtr)mode)->HDisplay = val;
+ break;
+ case VIDMODE_H_SYNCSTART:
+ ((DisplayModePtr)mode)->HSyncStart = val;
+ break;
+ case VIDMODE_H_SYNCEND:
+ ((DisplayModePtr)mode)->HSyncEnd = val;
+ break;
+ case VIDMODE_H_TOTAL:
+ ((DisplayModePtr)mode)->HTotal = val;
+ break;
+ case VIDMODE_H_SKEW:
+ ((DisplayModePtr)mode)->HSkew = val;
+ break;
+ case VIDMODE_V_DISPLAY:
+ ((DisplayModePtr)mode)->VDisplay = val;
+ break;
+ case VIDMODE_V_SYNCSTART:
+ ((DisplayModePtr)mode)->VSyncStart = val;
+ break;
+ case VIDMODE_V_SYNCEND:
+ ((DisplayModePtr)mode)->VSyncEnd = val;
+ break;
+ case VIDMODE_V_TOTAL:
+ ((DisplayModePtr)mode)->VTotal = val;
+ break;
+ case VIDMODE_FLAGS:
+ ((DisplayModePtr)mode)->Flags = val;
+ break;
+ case VIDMODE_CLOCK:
+ ((DisplayModePtr)mode)->Clock = val;
+ break;
+ }
+ return;
+}
+
+int
+VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
+{
+ int ret = 0;
+
+ switch (valtyp) {
+ case VIDMODE_MON_VENDOR:
+ ret = (int)(((MonPtr)monitor)->vendor);
+ break;
+ case VIDMODE_MON_MODEL:
+ ret = (int)(((MonPtr)monitor)->model);
+ break;
+ case VIDMODE_MON_NHSYNC:
+ ret = ((MonPtr)monitor)->nHsync;
+ break;
+ case VIDMODE_MON_NVREFRESH:
+ ret = ((MonPtr)monitor)->nVrefresh;
+ break;
+ case VIDMODE_MON_HSYNC_LO:
+ ret = (int)(100.0 * ((MonPtr)monitor)->hsync[indx].lo);
+ break;
+ case VIDMODE_MON_HSYNC_HI:
+ ret = (int)(100.0 * ((MonPtr)monitor)->hsync[indx].hi);
+ break;
+ case VIDMODE_MON_VREFRESH_LO:
+ ret = (int)(100.0 * ((MonPtr)monitor)->vrefresh[indx].lo);
+ break;
+ case VIDMODE_MON_VREFRESH_HI:
+ ret = (int)(100.0 * ((MonPtr)monitor)->vrefresh[indx].hi);
+ break;
+ }
+ return ret;
+}
+
+
+#endif /* XF86VIDMODE */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86XKB.c b/xc/programs/Xserver/hw/xfree86/common/xf86XKB.c
new file mode 100644
index 000000000..7e09a6a14
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86XKB.c
@@ -0,0 +1,127 @@
+/* $XConsortium: xf86XKB.c /main/4 1996/02/04 09:28:04 kaleb $ */
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.8 1999/03/28 15:32:29 dawes Exp $ */
+
+#include <stdio.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "XI.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+
+#include "XKBsrv.h"
+
+#ifdef AMOEBA
+#define LED_CAP IOP_LED_CAP
+#define LED_NUM IOP_LED_NUM
+#define LED_SCR IOP_LED_SCROLL
+#endif
+
+#ifdef MINIX
+#define LED_CAP KBD_LEDS_CAPS
+#define LED_NUM KBD_LEDS_NUM
+#define LED_SCR KBD_LEDS_SCROLL
+#endif
+
+void
+xf86InitXkb(void)
+{
+}
+
+void
+XkbDDXUpdateIndicators(DeviceIntPtr pXDev,CARD32 new)
+{
+ CARD32 old;
+#if defined (__sparc__)
+ static int kbdSun = -1;
+
+ if (kbdSun == -1) {
+ if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
+ kbdSun = 1;
+ else
+ kbdSun = 0;
+ }
+ if (kbdSun) {
+ old = new;
+ new = 0;
+ if (old & 0x08) new |= XLED1;
+ if (old & 0x04) new |= XLED3;
+ if (old & 0x02) new |= XLED4;
+ if (old & 0x01) new |= XLED2;
+ }
+#endif /* defined (__sparc__) */
+#ifdef DEBUG
+/* if (xkbDebugFlags)*/
+ ErrorF("XkbDDXUpdateIndicators(...,0x%x) -- XFree86 version\n",new);
+#endif
+#ifdef LED_CAP
+ old= new;
+ new= 0;
+ if (old&XLED1) new|= LED_CAP;
+ if (old&XLED2) new|= LED_NUM;
+ if (old&XLED3) new|= LED_SCR;
+#ifdef LED_COMP
+ if (old&XLED4) new|= LED_COMP;
+#endif
+#endif
+ xf86SetKbdLeds(new);
+ return;
+}
+
+void
+XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ CARD32 new)
+{
+ if (sli->fb.kf==dev->kbdfeed)
+ XkbDDXUpdateIndicators(dev,new);
+ else if (sli->class==KbdFeedbackClass) {
+ KbdFeedbackPtr kf;
+ kf= sli->fb.kf;
+ if (kf && kf->CtrlProc) {
+ (*kf->CtrlProc)(dev,&kf->ctrl);
+ }
+ }
+ else if (sli->class==LedFeedbackClass) {
+ LedFeedbackPtr lf;
+ lf= sli->fb.lf;
+ if (lf && lf->CtrlProc) {
+ (*lf->CtrlProc)(dev,&lf->ctrl);
+ }
+ }
+ return;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
new file mode 100644
index 000000000..7d8abf9c7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c
@@ -0,0 +1,1536 @@
+/* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */
+/*
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.52 1999/06/13 05:18:47 dawes Exp $ */
+
+#include "Xfuncproto.h"
+#include "Xmd.h"
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#endif
+#include "xf86.h"
+#include "Xpoll.h"
+#include "xf86Priv.h"
+#include "xf86Xinput.h"
+#ifdef XINPUT
+#include "XIstubs.h"
+#endif
+#include "mipointer.h"
+#include "xf86InPriv.h"
+
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include "extensions/dpms.h"
+#include "dpmsproc.h"
+#endif
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#include "exevents.h" /* AddInputDevice */
+#include "exglobals.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "windowstr.h" /* screenIsSaved */
+
+#include <stdarg.h>
+
+#include "osdep.h" /* EnabledDevices */
+
+/******************************************************************************
+ * debugging macro
+ *****************************************************************************/
+#ifdef DBG
+#undef DBG
+#endif
+#ifdef DEBUG
+#undef DEBUG
+#endif
+
+#define DEBUG 0
+
+#if DEBUG
+static int debug_level = 0;
+
+#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
+#else
+#define DBG(lvl, f)
+#endif
+
+
+static LocalDevicePtr switch_device = NULL;
+extern DeviceAssocRec switch_assoc;
+
+/***********************************************************************
+ *
+ * xf86AlwaysCoreControl --
+ *
+ * Control proc for the integer feedback that controls the always
+ * core feature.
+ *
+ ***********************************************************************
+ */
+static void
+xf86AlwaysCoreControl(DeviceIntPtr device,
+ IntegerCtrl *control)
+{
+}
+
+/***********************************************************************
+ *
+ * Core devices functions --
+ *
+ * Test if device is the core device by checking the
+ * value of always core feedback and the inputInfo struct.
+ *
+ ***********************************************************************
+ */
+int
+xf86IsCorePointer(DeviceIntPtr device)
+{
+ return(device == inputInfo.pointer);
+}
+
+static int
+xf86ShareCorePointer(DeviceIntPtr device)
+{
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+
+ return((local->always_core_feedback &&
+ local->always_core_feedback->ctrl.integer_displayed));
+}
+
+static Bool
+xf86SendDragEvents(DeviceIntPtr device)
+{
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+
+ if (inputInfo.pointer->button->buttonsDown > 0)
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
+ else
+ return (TRUE);
+}
+
+int
+xf86IsCoreKeyboard(DeviceIntPtr device)
+{
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+
+ return((local->flags & XI86_ALWAYS_CORE) ||
+ (device == inputInfo.keyboard));
+}
+
+void
+xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always)
+{
+ if (always) {
+ local->flags |= XI86_ALWAYS_CORE;
+ } else {
+ local->flags &= ~XI86_ALWAYS_CORE;
+ }
+}
+
+/***********************************************************************
+ *
+ * xf86CheckButton --
+ *
+ * Test if the core pointer button state is coherent with
+ * the button event to send.
+ *
+ ***********************************************************************
+ */
+Bool
+xf86CheckButton(int button,
+ int down)
+{
+ int state = (inputInfo.pointer->button->state & 0x1f00) >> 8;
+ int check = (state & (1 << (button - 1)));
+
+ if ((check && down) && (!check && !down)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/***********************************************************************
+ *
+ * xf86ProcessCommonOptions --
+ *
+ * Process global options.
+ *
+ ***********************************************************************
+ */
+void
+xf86ProcessCommonOptions(LocalDevicePtr local,
+ pointer list)
+{
+ if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
+ xf86SetBoolOption(list, "SendCoreEvents", 0)) {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
+ }
+
+ if (xf86SetBoolOption(list, "CorePointer", 0)) {
+ local->flags |= XI86_CORE_POINTER;
+ xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name);
+ }
+
+ if (xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+ local->flags |= XI86_CORE_KEYBOARD;
+ xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name);
+ }
+
+ if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
+ local->flags |= XI86_SEND_DRAG_EVENTS;
+ } else {
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ }
+
+ local->history_size = xf86SetIntOption(list, "HistorySize", 0);
+
+ if (local->history_size > 0) {
+ xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
+ local->history_size);
+ }
+}
+
+/***********************************************************************
+ *
+ * xf86XinputFinalizeInit --
+ *
+ * Create and initialize an integer feedback to control the always
+ * core feature.
+ *
+ ***********************************************************************
+ */
+void
+xf86XinputFinalizeInit(DeviceIntPtr dev)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ local->dxremaind = 0.0;
+ local->dyremaind = 0.0;
+
+ if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
+ ErrorF("Unable to init integer feedback for always core feature\n");
+ } else {
+ local->always_core_feedback = dev->intfeed;
+ dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
+ }
+}
+
+/***********************************************************************
+ *
+ * xf86ActivateDevice --
+ *
+ * Initialize an input device.
+ *
+ ***********************************************************************
+ */
+void
+xf86ActivateDevice(LocalDevicePtr local)
+{
+ DeviceIntPtr dev;
+
+ if (local->flags & XI86_CONFIGURED) {
+ int open_on_init;
+
+ open_on_init = local->flags &
+ (XI86_OPEN_ON_INIT |
+ XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD);
+
+ dev = AddInputDevice(local->device_control,
+ open_on_init);
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->name,
+ strlen(local->name),
+ TRUE);
+ AssignTypeAndName (dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ xf86XinputFinalizeInit(dev);
+
+ if (local->flags & XI86_CORE_POINTER)
+ RegisterPointerDevice(dev);
+ else if (local->flags & XI86_CORE_KEYBOARD)
+ RegisterKeyboardDevice(dev);
+#ifdef XINPUT
+ else
+ RegisterOtherDevice(dev);
+#endif
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
+ }
+}
+
+#if 0
+/***********************************************************************
+ *
+ * InitExtInput --
+ *
+ * Initialize any extended devices we might have. It is called from
+ * ddx InitInput.
+ *
+ ***********************************************************************
+ */
+void
+InitExtInput()
+{
+ LocalDevicePtr local;
+
+ /* Register a Wakeup handler to handle input when generated */
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA, ReadInput,
+ NULL);
+
+ /* Create and initialize the special device Switch */
+ local = switch_assoc.device_allocate();
+ switch_device = local;
+ switch_device->flags |= XI86_CONFIGURED; /* no configuration available */
+ switch_device->next = xf86FirstLocalDevice();
+
+ /* Add each device */
+ while(local) {
+ xf86ActivateDevice(local);
+ local = local->next;
+ }
+}
+#endif
+
+
+#ifdef XINPUT
+/***********************************************************************
+ *
+ * Caller: ProcXOpenDevice
+ *
+ * This is the implementation-dependent routine to open an input device.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. This entry point is for the latter type of
+ * implementation.
+ *
+ * If the physical device is not already open, do it here. In this case,
+ * you need to keep track of the fact that one or more clients has the
+ * device open, and physically close it when the last client that has
+ * it open does an XCloseDevice.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are opened during X server initialization and kept open).
+ *
+ ***********************************************************************
+ */
+
+void
+OpenInputDevice(DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
+{
+ if (!dev->inited) {
+ *status = BadDevice;
+ } else {
+ if (!dev->public.on) {
+ if (!EnableDevice(dev)) {
+ *status = BadDevice;
+ } else {
+ /* to prevent ProcXOpenDevice to call EnableDevice again */
+ dev->startup = FALSE;
+ }
+ }
+ }
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangeKeyboardDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the keyboard device.
+ *
+ * The X keyboard device has a FocusRec. If the device that has been
+ * made into the new X keyboard did not have a FocusRec,
+ * ProcXChangeKeyboardDevice will allocate one for it.
+ *
+ * If you do not want clients to be able to focus the old X keyboard
+ * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
+ *
+ * If you support input devices with keys that you do not want to be
+ * used as the X keyboard, you need to check for them here and return
+ * a BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you do want
+ * clients to be able to focus the old X keyboard). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ ***********************************************************************
+ */
+
+int
+ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev)
+{
+ /**********************************************************************
+ * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
+ **********************************************************************/
+ return !Success;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangePointerDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the pointer device.
+ *
+ * The X pointer device does not have a FocusRec. If the device that
+ * has been made into the new X pointer had a FocusRec,
+ * ProcXChangePointerDevice will free it.
+ *
+ * If you want clients to be able to focus the old pointer device that
+ * has now become accessible through the input extension, you need to
+ * add a FocusRec to it here.
+ *
+ * The XChangePointerDevice protocol request also allows the client
+ * to choose which axes of the new pointer device are used to move
+ * the X cursor in the X- and Y- directions. If the axes are different
+ * than the default ones, you need to keep track of that here.
+ *
+ * If you support input devices with valuators that you do not want to be
+ * used as the X pointer, you need to check for them here and return a
+ * BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you don't want
+ * clients to be able to focus the old X pointer). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ ***********************************************************************
+ */
+
+int
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+{
+ /************************************************************************
+ InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
+
+ x_axis = x; * keep track of new x-axis*
+ y_axis = y; * keep track of new y-axis*
+ if (x_axis != 0 || y_axis != 1)
+ axes_changed = TRUE; * remember axes have changed*
+ else
+ axes_changed = FALSE;
+ *************************************************************************/
+
+ /* Return failure if we try with the Switch device */
+ if (switch_device && new_dev == switch_device->dev) {
+ return !Success;
+ }
+
+ /*
+ * We don't allow axis swap or other exotic features.
+ */
+ if (x == 0 && y == 1) {
+ LocalDevicePtr old_local = (LocalDevicePtr)old_dev->public.devicePrivate;
+ LocalDevicePtr new_local = (LocalDevicePtr)new_dev->public.devicePrivate;
+
+ InitFocusClassDeviceStruct(old_dev);
+
+ /* Restore Extended motion history information */
+ old_dev->valuator->GetMotionProc = old_local->motion_history_proc;
+ old_dev->valuator->numMotionEvents = old_local->history_size;
+
+ /* Save Extended motion history information */
+ new_local->motion_history_proc = new_dev->valuator->GetMotionProc;
+ new_local->history_size = new_dev->valuator->numMotionEvents;
+
+ /* Set Core motion history information */
+ new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
+ new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
+
+ return Success;
+ }
+ else
+ return !Success;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXCloseDevice
+ *
+ * Take care of implementation-dependent details of closing a device.
+ * Some implementations may actually close the device, others may just
+ * remove this clients interest in that device.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ *
+ ***********************************************************************
+ */
+
+void
+CloseInputDevice (DeviceIntPtr d, ClientPtr client)
+{
+ ErrorF("ProcXCloseDevice to close or not ?\n");
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXListInputDevices
+ *
+ * This is the implementation-dependent routine to initialize an input
+ * device to the point that information about it can be listed.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. If some other process has the device open, the
+ * server may not be able to get information about the device to list it.
+ *
+ * This procedure should be used by implementations that do not initialize
+ * all input devices at server startup. It should do device-dependent
+ * initialization for any devices not previously initialized, and call
+ * AddInputDevice for each of those devices so that a DeviceIntRec will be
+ * created for them.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ * The commented-out sample code shows what you might do if you don't want
+ * the default.
+ *
+ ***********************************************************************
+ */
+
+void
+AddOtherInputDevices ()
+{
+}
+
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceMode
+ *
+ * Change the mode of an extension device.
+ * This function is used to change the mode of a device from reporting
+ * relative motion to reporting absolute positional information, and
+ * vice versa.
+ * The default implementation below is that no such devices are supported.
+ *
+ ***********************************************************************
+ */
+
+int
+SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ if (local->switch_mode) {
+ return (*local->switch_mode)(client, dev, mode);
+ }
+ else
+ return BadMatch;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXSetDeviceValuators
+ *
+ * Set the value of valuators on an extension input device.
+ * This function is used to set the initial value of valuators on
+ * those input devices that are capable of reporting either relative
+ * motion or an absolute position, and allow an initial position to be set.
+ * The default implementation below is that no such devices are supported.
+ *
+ ***********************************************************************
+ */
+
+int
+SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
+ int first_valuator, int num_valuators)
+{
+ return BadMatch;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangeDeviceControl
+ *
+ * Change the specified device controls on an extension input device.
+ *
+ ***********************************************************************
+ */
+
+int
+ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ if (!local->control_proc) {
+ return (BadMatch);
+ }
+ else {
+ return (*local->control_proc)(local, control);
+ }
+}
+#endif
+
+/*
+ * adapted from mieq.c to support extended events
+ *
+ */
+#define QUEUE_SIZE 256
+
+typedef struct _Event {
+ xEvent event;
+#ifdef XINPUT
+ deviceValuator val;
+#endif
+ ScreenPtr pScreen;
+} EventRec, *EventPtr;
+
+typedef struct _EventQueue {
+ HWEventQueueType head, tail;
+ CARD32 lastEventTime; /* to avoid time running backwards */
+ Bool lastMotion;
+ EventRec events[QUEUE_SIZE]; /* static allocation for signals */
+ DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
+ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
+ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
+} EventQueueRec, *EventQueuePtr;
+
+static EventQueueRec xf86EventQueue;
+
+Bool
+xf86eqInit (DevicePtr pKbd, DevicePtr pPtr)
+{
+ xf86EventQueue.head = xf86EventQueue.tail = 0;
+ xf86EventQueue.lastEventTime = GetTimeInMillis ();
+ xf86EventQueue.pKbd = pKbd;
+ xf86EventQueue.pPtr = pPtr;
+ xf86EventQueue.lastMotion = FALSE;
+ xf86EventQueue.pEnqueueScreen = screenInfo.screens[0];
+ xf86EventQueue.pDequeueScreen = xf86EventQueue.pEnqueueScreen;
+ SetInputCheck (&xf86EventQueue.head, &xf86EventQueue.tail);
+ return TRUE;
+}
+
+/*
+ * Must be reentrant with ProcessInputEvents. Assumption: xf86eqEnqueue
+ * will never be interrupted. If this is called from both signal
+ * handlers and regular code, make sure the signal is suspended when
+ * called from regular code.
+ */
+
+void
+xf86eqEnqueue (xEvent *e)
+{
+ int oldtail, newtail;
+ Bool isMotion;
+#ifdef XINPUT
+ int count;
+
+ switch (e->u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+#ifdef XFreeXDGA
+ /* we do this here, because nobody seems to be calling
+ xf86PostKeyEvent(). We can't steal MotionNotify events here
+ because the motion-relative information has been lost already. */
+ if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e))
+ return;
+#endif
+ /* fall through */
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ count = 1;
+ break;
+ default:
+ if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) {
+ count = 1;
+ }
+ else {
+ count = 2;
+ }
+ break;
+ }
+#endif
+
+ oldtail = xf86EventQueue.tail;
+ isMotion = e->u.u.type == MotionNotify;
+ if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) {
+ if (oldtail == 0)
+ oldtail = QUEUE_SIZE;
+ oldtail = oldtail - 1;
+ }
+ else {
+ newtail = oldtail + 1;
+ if (newtail == QUEUE_SIZE)
+ newtail = 0;
+ /* Toss events which come in late */
+ if (newtail == xf86EventQueue.head)
+ return;
+ xf86EventQueue.tail = newtail;
+ }
+
+ xf86EventQueue.lastMotion = isMotion;
+ xf86EventQueue.events[oldtail].event = *e;
+#ifdef XINPUT
+ if (count == 2) {
+ xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
+ }
+#endif
+ /*
+ * Make sure that event times don't go backwards - this
+ * is "unnecessary", but very useful
+ */
+ if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime &&
+ xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
+
+ xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time =
+ xf86EventQueue.lastEventTime;
+ }
+ xf86EventQueue.events[oldtail].pScreen = xf86EventQueue.pEnqueueScreen;
+}
+
+/*
+ * Call this from ProcessInputEvents()
+ */
+void
+xf86eqProcessInputEvents ()
+{
+ EventRec *e;
+ int x, y;
+ xEvent xe;
+#ifdef XINPUT
+ DeviceIntPtr dev;
+ int id, count;
+ deviceKeyButtonPointer *dev_xe;
+#endif
+
+ while (xf86EventQueue.head != xf86EventQueue.tail) {
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+#ifdef DPMSExtension
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(DPMSModeOn);
+#endif
+
+ e = &xf86EventQueue.events[xf86EventQueue.head];
+ /*
+ * Assumption - screen switching can only occur on motion events
+ */
+ if (e->pScreen != xf86EventQueue.pDequeueScreen) {
+ xf86EventQueue.pDequeueScreen = e->pScreen;
+ x = e->event.u.keyButtonPointer.rootX;
+ y = e->event.u.keyButtonPointer.rootY;
+ if (xf86EventQueue.head == QUEUE_SIZE - 1)
+ xf86EventQueue.head = 0;
+ else
+ ++xf86EventQueue.head;
+ NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y);
+ }
+ else {
+ xe = e->event;
+ if (xf86EventQueue.head == QUEUE_SIZE - 1)
+ xf86EventQueue.head = 0;
+ else
+ ++xf86EventQueue.head;
+ switch (xe.u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+ (*xf86EventQueue.pKbd->processInputProc)
+ (&xe, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
+ break;
+#ifdef XINPUT
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ (*(inputInfo.pointer->public.processInputProc))
+ (&xe, (DeviceIntPtr)inputInfo.pointer, 1);
+ break;
+
+ default:
+ dev_xe = (deviceKeyButtonPointer *) e;
+ id = dev_xe->deviceid & DEVICE_BITS;
+ if (!(dev_xe->deviceid & MORE_EVENTS)) {
+ count = 1;
+ }
+ else {
+ count = 2;
+ }
+ dev = LookupDeviceIntRec(id);
+ if (dev == NULL) {
+ ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
+/* FatalError("xf86eqProcessInputEvents : device not found.\n");
+ */
+ break;
+ }
+ if (!dev->public.processInputProc) {
+ FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
+ break;
+ }
+ (*dev->public.processInputProc)(&e->event, dev, count);
+#else
+ default:
+ (*xf86EventQueue.pPtr->processInputProc)
+ (&xe, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
+#endif
+ break;
+ }
+ }
+ }
+}
+
+void
+xf86eqSwitchScreen(ScreenPtr pScreen,
+ Bool fromDIX)
+{
+ xf86EventQueue.pEnqueueScreen = pScreen;
+
+ if (fromDIX)
+ xf86EventQueue.pDequeueScreen = pScreen;
+}
+
+/*
+ * convenient functions to post events
+ */
+
+/*
+ * Relative devices send accumulated valuators.
+ */
+#define RELATIVE_CHECK(VALUATOR,IDX) \
+ { \
+ if (!is_absolute) { \
+ (VALUATOR) += axisvals[(IDX)]; \
+ axisvals[(IDX)] = (VALUATOR); \
+ } \
+ }
+
+
+void
+xf86PostMotionEvent(DeviceIntPtr device,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int loop;
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+ deviceValuator *xv = (deviceValuator*) xev+1;
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ char *buff = 0;
+ Time current;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_shared = xf86ShareCorePointer(device);
+ Bool drag = xf86SendDragEvents(device);
+ ValuatorClassPtr val = device->valuator;
+ int *axisvals;
+ AxisInfoPtr axes;
+ int dx, dy;
+ float mult;
+#ifdef XFreeXDGA
+ int xdelta = 0, ydelta = 0;
+#endif
+
+ DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) switch=0x%x is_core=%s is_shared=%s is_absolute=%s\n",
+ device, device->name, switch_device,
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+ if (is_core || is_shared) {
+ xf86SwitchCoreDevice(switch_device, device);
+ }
+
+ current = GetTimeInMillis();
+
+ if (!is_core) {
+ if (HAS_MOTION_HISTORY(local)) {
+ buff = ((char *)local->motion_history +
+ (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
+ }
+ }
+
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
+
+ axisvals = val->axisVal;
+ axes = val->axes;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = va_arg(var, int);
+ if (loop == num_valuators)
+ RELATIVE_CHECK(xv->valuator0, loop+first_valuator);
+ break;
+ case 1:
+ xv->valuator1 = va_arg(var, int);
+
+ DBG(5, ErrorF("xf86PostMotionEvent v0=%d v1=%d\n", xv->valuator0, xv->valuator1));
+
+ if (loop == 1 && !is_absolute && device->ptrfeed && device->ptrfeed->ctrl.num) {
+ /* modeled from xf86Events.c */
+ if (device->ptrfeed->ctrl.threshold) {
+ if ((abs(xv->valuator0) + abs(xv->valuator1)) >= device->ptrfeed->ctrl.threshold) {
+ xv->valuator0 = (xv->valuator0 * device->ptrfeed->ctrl.num) /
+ device->ptrfeed->ctrl.den;
+ xv->valuator1 = (xv->valuator1 * device->ptrfeed->ctrl.num) /
+ device->ptrfeed->ctrl.den;
+ }
+ }
+ else if (xv->valuator0 || xv->valuator1) {
+ dx = xv->valuator0;
+ dy = xv->valuator1;
+ mult = pow((float)(dx*dx+dy*dy),
+ ((float)(device->ptrfeed->ctrl.num) /
+ (float)(device->ptrfeed->ctrl.den) - 1.0) /
+ 2.0) / 2.0;
+ if (dx) {
+ local->dxremaind = mult * (float)dx + local->dxremaind;
+ xv->valuator0 = dx = (int)local->dxremaind;
+ local->dxremaind = local->dxremaind - (float)dx;
+ }
+ if (dy) {
+ local->dyremaind = mult * (float)dy + local->dyremaind;
+ xv->valuator1 = dy = (int)local->dyremaind;
+ local->dyremaind = local->dyremaind - (float)dy;
+ }
+ }
+ DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n", xv->valuator0, xv->valuator1));
+ }
+
+ /* mr Sat Jul 5 13:46:55 MET 1997
+ * fix to recognize XWarpCursor requests
+ * FL Thu Nov 12 07:42:03 1998
+ * Fix the fix to revert x/y coordinates to valuators space.
+ * This has to be done only for relative devices which control
+ * the core pointer.
+ */
+ if ((loop == 1) && !is_absolute && (is_core || is_shared)) {
+ int x1, y1;
+
+ miPointerPosition(&x1,&y1);
+
+ if (x1!=local->old_x || y1!=local->old_y ) {
+ if (!local->reverse_conversion_proc) {
+ axisvals[loop+first_valuator-1] = x1;
+ axisvals[loop+first_valuator] = y1;
+ }
+ else {
+ (*local->reverse_conversion_proc)(local, x1, y1, axisvals);
+ }
+ DBG(5, ErrorF("xf86PostMotionEvent(mr) x1=%d y1=%d\n", x1,y1));
+ }
+ }
+#ifdef XFreeXDGA
+ /* We need to save this for DGA so we can undo it
+ to get relative motion again */
+ if(!is_absolute) {
+ xdelta = axisvals[loop+first_valuator-1];
+ ydelta = axisvals[loop+first_valuator];
+ } else
+ xdelta = ydelta = 0;
+#endif
+ RELATIVE_CHECK(xv->valuator0, loop+first_valuator-1);
+ RELATIVE_CHECK(xv->valuator1, loop+first_valuator);
+ break;
+ case 2:
+ xv->valuator2 = va_arg(var, int);
+ RELATIVE_CHECK(xv->valuator2, loop+first_valuator);
+ break;
+ case 3:
+ xv->valuator3 = va_arg(var, int);
+ RELATIVE_CHECK(xv->valuator3, loop+first_valuator);
+ break;
+ case 4:
+ xv->valuator4 = va_arg(var, int);
+ RELATIVE_CHECK(xv->valuator4, loop+first_valuator);
+ break;
+ case 5:
+ xv->valuator5 = va_arg(var, int);
+ RELATIVE_CHECK(xv->valuator5, loop+first_valuator);
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+
+ if (!is_core) {
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xf86Info.lastEventTime = xev->time = current;
+ xev->deviceid = device->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+
+ xv->device_state = 0;
+
+ if (HAS_MOTION_HISTORY(local)) {
+ *(Time*)buff = current;
+ memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator, &xv->valuator0,
+ sizeof(INT32)*xv->num_valuators);
+ }
+
+ xf86eqEnqueue(xE);
+ }
+ /* Drag is true if no buttons are down, or if there are buttons
+ * down and SendDragEvents is true.
+ */
+ if ((is_core || is_shared) && (num_valuators >= 2) && drag) {
+ int x, y;
+
+ if ((*local->conversion_proc)(local,
+ xv->first_valuator,
+ xv->num_valuators,
+ xv->valuator0,
+ xv->valuator1,
+ xv->valuator2,
+ xv->valuator3,
+ xv->valuator4,
+ xv->valuator5,
+ &x, &y) == FALSE) {
+ DBG(4, ErrorF("xf86PostMotionEvent conversion failed\n"));
+ continue;
+ }
+
+ DBG(4, ErrorF("xf86PostMotionEvent x=%d y=%d\n", x, y));
+
+ if (x == local->old_x && y == local->old_y) {
+ DBG(4, ErrorF("xf86PostMotionEvent same cursor position continuing\n"));
+ continue;
+ }
+
+ xf86Info.lastEventTime = current;
+
+ /* FL [Sat Jun 14 14:32:01 1997]
+ * needs to integrate with DGA and XTEST event posting
+ */
+
+#ifdef XFreeXDGA
+ if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, x - xdelta, y - ydelta )) {
+#endif
+ miPointerAbsoluteCursor(x, y, xf86Info.lastEventTime);
+
+ /* Fix valuators for relative devices when the mi layer
+ * has bounded the x and y coordinates. This is needed
+ * to be sure to have an exact mapping between x,y coordinates
+ * and valuators space.
+ */
+ if (!is_absolute) {
+ int x1, y1;
+
+ miPointerPosition(&x1, &y1);
+
+ /* The mi layer has bounded the coordinates.
+ */
+ if (x != x1 || y != y1) {
+ /* When there is no reverse conversion proc, we
+ * asume that x,y are mapped to the first valuators.
+ */
+ if (!local->reverse_conversion_proc) {
+ axisvals[0] = x1;
+ axisvals[1] = y1;
+ }
+ else {
+ (*local->reverse_conversion_proc)(local, x1, y1, axisvals);
+ }
+ x = x1;
+ y = y1;
+ }
+ }
+#ifdef XFreeXDGA
+ }
+#endif
+ /* Save the core pointer coordinates to be able to work
+ * with multiple relative devices and to detect XWarpCursor
+ * requests.
+ */
+ local->old_x = x;
+ local->old_y = y;
+
+ /* If the device don't send extended events, stop the loop.
+ */
+ if (!is_shared)
+ break;
+ }
+ }
+ }
+ va_end(var);
+ if (HAS_MOTION_HISTORY(local)) {
+ local->last = (local->last + 1) % device->valuator->numMotionEvents;
+ if (local->last == local->first)
+ local->first = (local->first + 1) % device->valuator->numMotionEvents;
+ }
+ DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) switch=0x%x is_core=%s is_shared=%s\n",
+ device, device->name, switch_device,
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False"));
+}
+
+void
+xf86PostProximityEvent(DeviceIntPtr device,
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int loop;
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+ deviceValuator *xv = (deviceValuator*) xev+1;
+ ValuatorClassPtr val = device->valuator;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_absolute = val && ((val->mode & 1) == Relative);
+
+ DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+ if (is_core) {
+ return;
+ }
+
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
+
+ xev->type = is_in ? ProximityIn : ProximityOut;
+ xev->detail = 0;
+ xev->deviceid = device->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+ xv->device_state = 0;
+
+ if ((device->valuator->mode & 1) == Relative) {
+ num_valuators = 0;
+ }
+
+ if (num_valuators != 0) {
+ int *axisvals = val->axisVal;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 1:
+ xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 2:
+ xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 3:
+ xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 4:
+ xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 5:
+ xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+
+ xf86eqEnqueue(xE);
+ }
+ }
+ va_end(var);
+ }
+ else {
+ /* no valuator */
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+
+ xf86eqEnqueue(xE);
+ }
+ DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
+ device, device->name, is_in ? "true" : "false",
+ is_core ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+}
+
+void
+xf86PostButtonEvent(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int loop;
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+ deviceValuator *xv = (deviceValuator*) xev+1;
+ ValuatorClassPtr val = device->valuator;
+ Bool is_core = xf86IsCorePointer(device);
+ Bool is_shared = xf86ShareCorePointer(device);
+
+ DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n",
+ device, device->name, button,
+ is_down ? "True" : "False",
+ is_core ? "True" : "False",
+ is_shared ? "True" : "False",
+ is_absolute ? "True" : "False"));
+
+ /* Check the core pointer button state not to send an inconsistent
+ * event. This can happen with the AlwaysCore feature.
+ */
+ if ((is_core || is_shared) && !xf86CheckButton(button, is_down)) {
+ return;
+ }
+
+ if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
+ ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
+ return;
+ }
+
+ if (is_core || is_shared) {
+ xf86SwitchCoreDevice(switch_device, device);
+ }
+
+ if (!is_core) {
+ xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
+ xev->detail = button;
+ xev->deviceid = device->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+ xv->device_state = 0;
+
+ if (num_valuators != 0) {
+ int *axisvals = val->axisVal;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 1:
+ xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 2:
+ xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 3:
+ xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 4:
+ xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ case 5:
+ xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
+ break;
+ }
+ if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ xv->num_valuators = (loop % 6) + 1;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+ xf86eqEnqueue(xE);
+ }
+ }
+ va_end(var);
+ }
+ else {
+ /* no valuator */
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+ xf86eqEnqueue(xE);
+ }
+ }
+
+ if (is_core || is_shared) {
+ /* core pointer */
+ int cx, cy;
+
+ GetSpritePosition(&cx, &cy);
+
+ xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
+ xE->u.u.detail = device->button->map[button];
+ xE->u.keyButtonPointer.rootY = cx;
+ xE->u.keyButtonPointer.rootX = cy;
+ xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
+
+#ifdef XFreeXDGA
+ if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0))
+#endif
+ xf86eqEnqueue (xE);
+ }
+ DBG(5, ErrorF("xf86PostButtonEvent END\n"));
+}
+
+void
+xf86PostKeyEvent(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int loop;
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
+ deviceValuator *xv = (deviceValuator*) xev+1;
+
+ va_start(var, num_valuators);
+
+ for(loop=0; loop<num_valuators; loop++) {
+ switch (loop % 6) {
+ case 0:
+ xv->valuator0 = va_arg(var, int);
+ break;
+ case 1:
+ xv->valuator1 = va_arg(var, int);
+ break;
+ case 2:
+ xv->valuator2 = va_arg(var, int);
+ break;
+ case 3:
+ xv->valuator3 = va_arg(var, int);
+ break;
+ case 4:
+ xv->valuator4 = va_arg(var, int);
+ break;
+ case 5:
+ xv->valuator5 = va_arg(var, int);
+ break;
+ }
+ if (((loop % 6 == 5) || (loop == num_valuators - 1))) {
+ xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
+ xev->detail = key_code;
+
+ xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ xev->deviceid = device->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = device->id;
+ xv->device_state = 0;
+ /* if the device is in the relative mode we don't have to send valuators */
+ xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
+ xv->first_valuator = first_valuator + (loop / 6) * 6;
+
+ xf86eqEnqueue(xE);
+ /* if the device is in the relative mode only one event is needed */
+ if (!is_absolute) break;
+ }
+ }
+ va_end(var);
+}
+
+/*
+ * Motion history management.
+ */
+
+void
+xf86MotionHistoryAllocate(LocalDevicePtr local)
+{
+ ValuatorClassPtr valuator = local->dev->valuator;
+
+ if (!HAS_MOTION_HISTORY(local))
+ return;
+
+ local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
+ * valuator->numMotionEvents);
+ local->first = 0;
+ local->last = 0;
+}
+
+int
+xf86GetMotionEvents(DeviceIntPtr dev,
+ xTimecoord *buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+ ValuatorClassPtr valuator = dev->valuator;
+ int num = 0;
+ int loop = local->first;
+ int size;
+ Time current;
+
+ if (!HAS_MOTION_HISTORY(local))
+ return 0;
+
+ size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
+
+ while (loop != local->last) {
+ current = *(Time*)(((char *)local->motion_history)+loop*size);
+ if (current > stop)
+ return num;
+ if (current >= start) {
+ memcpy(((char *)buff)+size*num,
+ ((char *)local->motion_history)+loop*size, size);
+ num++;
+ }
+ loop = (loop + 1) % valuator->numMotionEvents;
+ }
+ return num;
+}
+
+LocalDevicePtr
+xf86FirstLocalDevice()
+{
+ return xf86InputDevs;
+}
+
+/*
+ * Cx - raw data from touch screen
+ * Sxhigh - scaled highest dimension
+ * (remember, this is of rows - 1 because of 0 origin)
+ * Sxlow - scaled lowest dimension
+ * Rxhigh - highest raw value from touch screen calibration
+ * Rxlow - lowest raw value from touch screen calibration
+ *
+ * This function is the same for X or Y coordinates.
+ * You may have to reverse the high and low values to compensate for
+ * different orgins on the touch screen vs X.
+ */
+
+int
+xf86ScaleAxis(int Cx,
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
+{
+ int X;
+ int dSx = Sxhigh - Sxlow;
+ int dRx = Rxhigh - Rxlow;
+
+ dSx = Sxhigh - Sxlow;
+ if (dRx) {
+ X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
+ }
+ else {
+ X = 0;
+ ErrorF ("Divide by Zero in xf86ScaleAxis");
+ }
+
+ if (X > Sxlow)
+ X = Sxlow;
+ if (X < Sxhigh)
+ X = Sxhigh;
+
+ return (X);
+}
+
+/*
+ * This function checks the given screen against the current screen and
+ * makes changes if appropriate. It should be called from an XInput driver's
+ * ReadInput function before any events are posted, if the device is screen
+ * specific like a touch screen.
+ */
+void
+xf86XInputSetScreen(LocalDevicePtr local,
+ int screen_number,
+ int x,
+ int y)
+{
+ if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) &&
+ (miPointerCurrentScreen() != screenInfo.screens[screen_number])) {
+ miPointerSetNewScreen (screen_number, x, y);
+ }
+}
+
+
+void
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+ int resolution, int min_res, int max_res)
+{
+#ifdef XINPUT
+ if (maxval == -1) {
+ if (axnum == 0)
+ maxval = screenInfo.screens[0]->width - 1;
+ else if (axnum == 1)
+ maxval = screenInfo.screens[0]->height - 1;
+ /* else? */
+ }
+ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
+ max_res);
+#endif
+}
+
+/*
+ * Set the valuator values to be in synch with dix/event.c
+ * DefineInitialRootWindow().
+ */
+void
+xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
+{
+#ifdef XINPUT
+ if (axnum == 0)
+ dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
+ else if (axnum == 1)
+ dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+#endif
+}
+
+/* end of xf86Xinput.c */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
new file mode 100644
index 000000000..7ca6f3e83
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h
@@ -0,0 +1,195 @@
+/* $XConsortium: xf86Xinput.h /main/11 1996/10/27 11:05:29 kaleb $ */
+/*
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.27 1999/06/13 05:18:48 dawes Exp $ */
+
+#ifndef _xf86Xinput_h
+#define _xf86Xinput_h
+
+#ifndef NEED_EVENTS
+#define NEED_EVENTS
+#endif
+#include "X.h"
+#include "Xproto.h"
+#include "inputstr.h"
+#ifdef XINPUT
+#include "XI.h"
+#include "XIproto.h"
+#include "XIstubs.h"
+#endif
+
+/* Input device flags */
+#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
+#define XI86_CONFIGURED 0x02 /* the device has been configured */
+#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
+/* the device sends Xinput and core pointer events */
+#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
+/* if the device is the core pointer or is sending core events, and
+ * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
+ * (mouse drag action) are sent. This is mainly to allow a touch screen to be
+ * used with netscape and other browsers which do strange things if the mouse
+ * moves between button down and button up. With a touch screen, this motion
+ * is common due to the user's finger moving slightly.
+ */
+#define XI86_SEND_DRAG_EVENTS 0x08
+#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
+#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
+#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
+#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
+
+#define XI_PRIVATE(dev) \
+ (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+
+#ifndef NEW_INPUT
+#define MOUSE_DEV(dev) (MouseDevPtr) XI_PRIVATE(dev)
+#endif
+
+#ifdef DBG
+#undef DBG
+#endif
+#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
+
+#ifdef HAS_MOTION_HISTORY
+#undef HAS_MOTION_HISTORY
+#endif
+#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
+
+/* This holds the input driver entry and module information. */
+typedef struct _InputDriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
+ IDevPtr dev, int flags);
+ void (*UnInit)(struct _InputDriverRec *drv,
+ struct _LocalDeviceRec *pInfo,
+ int flags);
+ pointer module;
+ int refCount;
+} InputDriverRec, *InputDriverPtr;
+
+
+/* This is to input devices what the ScrnInfoRec is to screens. */
+
+typedef struct _LocalDeviceRec {
+ struct _LocalDeviceRec *next;
+ char * name;
+ int flags;
+
+ Bool (*device_control)(DeviceIntPtr device, int what);
+ void (*read_input)(struct _LocalDeviceRec *local);
+ int (*control_proc)(struct _LocalDeviceRec *local,
+ xDeviceCtl *control);
+ void (*close_proc)(struct _LocalDeviceRec *local);
+ int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
+ int mode);
+ Bool (*conversion_proc)(struct _LocalDeviceRec *local,
+ int first, int num, int v0,
+ int v1, int v2, int v3, int v4,
+ int v5, int *x, int *y);
+ Bool (*reverse_conversion_proc)(
+ struct _LocalDeviceRec *local,
+ int x, int y, int *valuators);
+
+ int fd;
+ Atom atom;
+ DeviceIntPtr dev;
+ pointer private;
+ int private_flags;
+ pointer motion_history;
+ ValuatorMotionProcPtr motion_history_proc;
+ unsigned int history_size; /* only for configuration purpose */
+ unsigned int first;
+ unsigned int last;
+ int old_x;
+ int old_y;
+ float dxremaind;
+ float dyremaind;
+ char * type_name;
+ IntegerFeedbackPtr always_core_feedback;
+ IDevPtr conf_idev;
+ InputDriverPtr drv;
+ pointer module;
+ pointer options;
+} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
+
+typedef struct _DeviceAssocRec
+{
+ char * config_section_name;
+ LocalDevicePtr (*device_allocate)(void);
+} DeviceAssocRec, *DeviceAssocPtr;
+
+/* xf86Globals.c */
+extern InputInfoPtr xf86InputDevs;
+
+/* xf86Xinput.c */
+int xf86IsCorePointer(DeviceIntPtr dev);
+int xf86IsCoreKeyboard(DeviceIntPtr dev);
+void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
+#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
+
+void InitExtInput(void);
+Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
+void xf86eqEnqueue(struct _xEvent *event);
+void xf86eqProcessInputEvents (void);
+void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
+void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, ...);
+void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
+ int first_valuator, int num_valuators, ...);
+void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ ...);
+void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ ...);
+void xf86MotionHistoryAllocate(LocalDevicePtr local);
+int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
+ unsigned long start, unsigned long stop,
+ ScreenPtr pScreen);
+void xf86XinputFinalizeInit(DeviceIntPtr dev);
+Bool xf86CheckButton(int button, int down);
+void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
+void xf86AddLocalDevice(LocalDevicePtr device, pointer options);
+Bool xf86RemoveLocalDevice(LocalDevicePtr device);
+LocalDevicePtr xf86FirstLocalDevice(void);
+int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
+void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
+void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
+ int maxval, int resolution, int min_res,
+ int max_res);
+void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
+
+/* xf86Helper.c */
+void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+void xf86DeleteInputDriver(int drvIndex);
+InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+void xf86DeleteInput(InputInfoPtr pInp, int flags);
+
+/* xf86Option.c */
+void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+ pointer extraOpts);
+
+#endif /* _xf86Xinput_h */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86cmap.c b/xc/programs/Xserver/hw/xfree86/common/xf86cmap.c
new file mode 100644
index 000000000..32e11ecd9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86cmap.c
@@ -0,0 +1,935 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.16 1999/08/01 07:57:12 dawes Exp $ */
+
+#ifdef _XOPEN_SOURCE
+#include <math.h>
+#else
+#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
+#include <math.h>
+#undef _XOPEN_SOURCE
+#endif
+
+#include "X.h"
+#include "misc.h"
+#include "Xproto.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+
+#include "resource.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86str.h"
+#include "micmap.h"
+
+#ifdef XFreeXDGA
+#define _XF86DGA_SERVER_
+#include "extensions/xf86dgastr.h"
+#include "dgaproc.h"
+#endif
+
+#include "xf86cmap.h"
+
+#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
+ ((CMapScreenPtr) (pScreen)->devPrivates[CMapScreenIndex].ptr)->field)
+#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+#define LOAD_PALETTE(pmap, index) \
+ ((pmap == miInstalledMaps[index]) && \
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
+ (xf86Screens[index]->vtSema || pScreenPriv->isDGAmode)))
+
+
+typedef struct _CMapLink {
+ ColormapPtr cmap;
+ struct _CMapLink *next;
+} CMapLink, *CMapLinkPtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ CloseScreenProcPtr CloseScreen;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+ LoadPaletteFuncPtr LoadPalette;
+ SetOverscanFuncPtr SetOverscan;
+ Bool (*EnterVT)(int, int);
+ Bool (*SwitchMode)(int, DisplayModePtr, int);
+ int (*SetDGAMode)(int, int, DGADevicePtr);
+ int maxColors;
+ int sigRGBbits;
+ int gammaElements;
+ LOCO *gamma;
+ int *PreAllocIndices;
+ CMapLinkPtr maps;
+ unsigned int flags;
+ Bool isDGAmode;
+} CMapScreenRec, *CMapScreenPtr;
+
+typedef struct {
+ int numColors;
+ LOCO *colors;
+ Bool recalculate;
+ int overscan;
+} CMapColormapRec, *CMapColormapPtr;
+
+static unsigned long CMapGeneration = 0;
+static int CMapScreenIndex = -1;
+static int CMapColormapIndex = -1;
+
+static void CMapInstallColormap(ColormapPtr);
+static void CMapStoreColors(ColormapPtr, int, xColorItem *);
+static Bool CMapCloseScreen (int, ScreenPtr);
+static Bool CMapCreateColormap (ColormapPtr);
+static void CMapDestroyColormap (ColormapPtr);
+
+static Bool CMapEnterVT(int, int);
+static Bool CMapSwitchMode(int, DisplayModePtr, int);
+static int CMapSetDGAMode(int, int, DGADevicePtr);
+static int CMapChangeGamma(int, Gamma);
+
+static void ComputeGamma(CMapScreenPtr);
+static Bool CMapAllocateColormapPrivate(ColormapPtr);
+static Bool CMapInitDefMap(ColormapPtr);
+static void CMapRefreshColors(ColormapPtr, int, int*);
+static void CMapSetOverscan(ColormapPtr, int, int *);
+static void CMapReinstallMap(ColormapPtr);
+static void CMapUnwrapScreen(ScreenPtr pScreen);
+
+
+
+Bool xf86HandleColormaps(
+ ScreenPtr pScreen,
+ int maxColors,
+ int sigRGBbits,
+ LoadPaletteFuncPtr loadPalette,
+ SetOverscanFuncPtr setOverscan,
+ unsigned int flags
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ColormapPtr pDefMap = NULL;
+ CMapScreenPtr pScreenPriv;
+ LOCO *gamma;
+ int *indices;
+ int elements;
+
+ if(!maxColors || !sigRGBbits || !loadPalette)
+ return FALSE;
+
+ if(CMapGeneration != serverGeneration) {
+ if(((CMapScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
+ ((CMapColormapIndex = AllocateColormapPrivateIndex(
+ CMapInitDefMap)) < 0))
+ return FALSE;
+ CMapGeneration = serverGeneration;
+ }
+
+ elements = 1 << sigRGBbits;
+
+ if(!(gamma = xalloc(elements * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(indices = xalloc(maxColors * sizeof(int)))) {
+ xfree(gamma);
+ return FALSE;
+ }
+
+ if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) {
+ xfree(gamma);
+ xfree(indices);
+ return FALSE;
+ }
+
+ pScreen->devPrivates[CMapScreenIndex].ptr = (pointer)pScreenPriv;
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreateColormap = pScreen->CreateColormap;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreenPriv->StoreColors = pScreen->StoreColors;
+ pScreen->CloseScreen = CMapCloseScreen;
+ pScreen->CreateColormap = CMapCreateColormap;
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ pScreen->InstallColormap = CMapInstallColormap;
+ pScreen->StoreColors = CMapStoreColors;
+
+ pScreenPriv->pScrn = pScrn;
+ pScreenPriv->LoadPalette = loadPalette;
+ pScreenPriv->SetOverscan = setOverscan;
+ pScreenPriv->maxColors = maxColors;
+ pScreenPriv->sigRGBbits = sigRGBbits;
+ pScreenPriv->gammaElements = elements;
+ pScreenPriv->gamma = gamma;
+ pScreenPriv->PreAllocIndices = indices;
+ pScreenPriv->maps = NULL;
+ pScreenPriv->flags = flags;
+ pScreenPriv->isDGAmode = FALSE;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScreenPriv->SwitchMode = pScrn->SwitchMode;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+
+ pScrn->EnterVT = CMapEnterVT;
+ if(flags & CMAP_RELOAD_ON_MODE_SWITCH)
+ pScrn->SwitchMode = CMapSwitchMode;
+#ifdef XFreeXDGA
+ pScrn->SetDGAMode = CMapSetDGAMode;
+#endif
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ ComputeGamma(pScreenPriv);
+
+ /* get the default map */
+
+ pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+
+ if(!CMapAllocateColormapPrivate(pDefMap)) {
+ CMapUnwrapScreen(pScreen);
+ return FALSE;
+ }
+
+ /* Force the initial map to be loaded */
+ miInstalledMaps[pScreen->myNum] = NULL;
+ CMapInstallColormap(pDefMap);
+ return TRUE;
+}
+
+static Bool
+CMapInitDefMap(ColormapPtr cmap)
+{
+ return TRUE;
+}
+
+
+/**** Screen functions ****/
+
+
+static Bool
+CMapCloseScreen (int i, ScreenPtr pScreen)
+{
+ CMapUnwrapScreen(pScreen);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static Bool
+CMapAllocateColormapPrivate(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapColormapPtr pColPriv;
+ CMapLinkPtr pLink;
+ int numColors;
+ LOCO *colors;
+
+ if((1 << pmap->pVisual->nplanes) > pScreenPriv->maxColors)
+ numColors = pmap->pVisual->ColormapEntries;
+ else
+ numColors = 1 << pmap->pVisual->nplanes;
+
+ if(!(colors = xalloc(numColors * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) {
+ xfree(colors);
+ return FALSE;
+ }
+
+ pmap->devPrivates[CMapColormapIndex].ptr = (pointer)pColPriv;
+
+ pColPriv->numColors = numColors;
+ pColPriv->colors = colors;
+ pColPriv->recalculate = TRUE;
+ pColPriv->overscan = -1;
+
+ /* add map to list */
+ pLink = xalloc(sizeof(CMapLink));
+ if(pLink) {
+ pLink->cmap = pmap;
+ pLink->next = pScreenPriv->maps;
+ pScreenPriv->maps = pLink;
+ }
+
+ return TRUE;
+}
+
+static Bool
+CMapCreateColormap (ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ Bool ret = FALSE;
+
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ if((*pScreen->CreateColormap)(pmap)) {
+ if(CMapAllocateColormapPrivate(pmap))
+ ret = TRUE;
+ }
+ pScreen->CreateColormap = CMapCreateColormap;
+
+ return ret;
+}
+
+static void
+CMapDestroyColormap (ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) cmap->devPrivates[CMapColormapIndex].ptr;
+ CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
+
+ if(pColPriv) {
+ if(pColPriv->colors) xfree(pColPriv->colors);
+ xfree(pColPriv);
+ }
+
+ /* remove map from list */
+ while(pLink) {
+ if(pLink->cmap == cmap) {
+ if(prevLink)
+ prevLink->next = pLink->next;
+ else
+ pScreenPriv->maps = pLink->next;
+ xfree(pLink);
+ break;
+ }
+ prevLink = pLink;
+ pLink = pLink->next;
+ }
+
+ if(pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap)(cmap);
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ }
+}
+
+
+
+static void
+CMapStoreColors(
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs
+){
+ ScreenPtr pScreen = pmap->pScreen;
+ VisualPtr pVisual = pmap->pVisual;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ int *indices = pScreenPriv->PreAllocIndices;
+ int num = ndef;
+
+ /* At the moment this isn't necessary since there's nobody below us */
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+ (*pScreen->StoreColors)(pmap, ndef, pdefs);
+ pScreen->StoreColors = CMapStoreColors;
+
+ /* should never get here for these */
+ if( (pVisual->class == TrueColor) ||
+ (pVisual->class == StaticColor) ||
+ (pVisual->class == StaticGray))
+ return;
+
+ if(pVisual->class == DirectColor) {
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ int i;
+
+ if((1 << pVisual->nplanes) > pScreenPriv->maxColors) {
+ int index;
+
+ num = 0;
+ while(ndef--) {
+ if(pdefs[ndef].flags & DoRed) {
+ index = (pdefs[ndef].pixel & pVisual->redMask) >>
+ pVisual->offsetRed;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoGreen) {
+ index = (pdefs[ndef].pixel & pVisual->greenMask) >>
+ pVisual->offsetGreen;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoBlue) {
+ index = (pdefs[ndef].pixel & pVisual->blueMask) >>
+ pVisual->offsetBlue;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ }
+
+ } else {
+ /* not really as overkill as it seems */
+ num = pColPriv->numColors;
+ for(i = 0; i < pColPriv->numColors; i++)
+ indices[i] = i;
+ }
+ } else {
+ while(ndef--)
+ indices[ndef] = pdefs[ndef].pixel;
+ }
+
+ CMapRefreshColors(pmap, num, indices);
+}
+
+
+static void
+CMapInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ int index = pScreen->myNum;
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+
+ if (pmap == miInstalledMaps[index])
+ return;
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap)(pmap);
+ pScreen->InstallColormap = CMapInstallColormap;
+
+ /* Important. We let the lower layers, namely DGA,
+ overwrite the choice of Colormap to install */
+ pmap = miInstalledMaps[index];
+
+ if(!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pmap->pVisual->class == TrueColor) &&
+ ((1 << pmap->pVisual->nplanes) > pScreenPriv->maxColors))
+ return;
+
+ if(LOAD_PALETTE(pmap, index))
+ CMapReinstallMap(pmap);
+}
+
+
+/**** ScrnInfoRec functions ****/
+
+static Bool
+CMapEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+
+ if((*pScreenPriv->EnterVT)(index, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static Bool
+CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+
+ if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#ifdef XFreeXDGA
+static int
+CMapSetDGAMode(int index, int num, DGADevicePtr dev)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ int ret;
+
+ ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
+
+ pScreenPriv->isDGAmode = DGAActive(index);
+
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+
+ return ret;
+}
+#endif
+
+
+/**** Utilities ****/
+
+static void
+CMapReinstallMap(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapColormapPtr cmapPriv =
+ (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ int i = cmapPriv->numColors;
+ int *indices = pScreenPriv->PreAllocIndices;
+
+ while(i--)
+ indices[i] = i;
+
+ if(cmapPriv->recalculate)
+ CMapRefreshColors(pmap, cmapPriv->numColors, indices);
+ else {
+ (*pScreenPriv->LoadPalette)(pScreenPriv->pScrn, cmapPriv->numColors,
+ indices, cmapPriv->colors, pmap->pVisual);
+ if (pScreenPriv->SetOverscan) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CMapReinstallMap\n");
+#endif
+ pScreenPriv->SetOverscan(pScreenPriv->pScrn, cmapPriv->overscan);
+ }
+ }
+
+ cmapPriv->recalculate = FALSE;
+}
+
+
+static void
+CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ VisualPtr pVisual = pmap->pVisual;
+ int numColors, i;
+ LOCO *gamma, *colors;
+ EntryPtr entry;
+ int reds, greens, blues, maxValue, index, shift;
+
+ numColors = pColPriv->numColors;
+ shift = 16 - pScreenPriv->sigRGBbits;
+ maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
+ gamma = pScreenPriv->gamma;
+ colors = pColPriv->colors;
+
+ reds = pVisual->redMask >> pVisual->offsetRed;
+ greens = pVisual->greenMask >> pVisual->offsetGreen;
+ blues = pVisual->blueMask >> pVisual->offsetBlue;
+
+ switch(pVisual->class) {
+ case StaticGray:
+ for(i = 0; i <= numColors - 1; i++) {
+ index = i * maxValue / numColors;
+ colors[i].red = gamma[index].red;
+ colors[i].green = gamma[index].green;
+ colors[i].blue = gamma[index].blue;
+ }
+ break;
+ case TrueColor:
+ if((1 << pVisual->nplanes) > pScreenPriv->maxColors) {
+ for(i = 0; i <= reds; i++)
+ colors[i].red = gamma[i * maxValue / reds].red;
+ for(i = 0; i <= greens; i++)
+ colors[i].green = gamma[i * maxValue / greens].green;
+ for(i = 0; i <= blues; i++)
+ colors[i].blue = gamma[i * maxValue / blues].blue;
+ break;
+ }
+ for(i = 0; i < numColors; i++) {
+ colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
+ maxValue / reds].red;
+ colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
+ maxValue / greens].green;
+ colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
+ maxValue / blues].blue;
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case GrayScale:
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ entry = (EntryPtr)&pmap->red[index];
+
+ if(entry->fShared) {
+ colors[index].red =
+ gamma[entry->co.shco.red->color >> shift].red;
+ colors[index].green =
+ gamma[entry->co.shco.green->color >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.shco.blue->color >> shift].blue;
+ } else {
+ colors[index].red =
+ gamma[entry->co.local.red >> shift].red;
+ colors[index].green =
+ gamma[entry->co.local.green >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.local.blue >> shift].blue;
+ }
+ }
+ break;
+ case DirectColor:
+ if((1 << pVisual->nplanes) > pScreenPriv->maxColors) {
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ if(index <= reds)
+ colors[index].red =
+ gamma[pmap->red[index].co.local.red >> shift].red;
+ if(index <= greens)
+ colors[index].green =
+ gamma[pmap->green[index].co.local.green >> shift].green;
+ if(index <= blues)
+ colors[index].blue =
+ gamma[pmap->blue[index].co.local.blue >> shift].blue;
+
+ }
+ break;
+ }
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+
+ colors[index].red = gamma[pmap->red[
+ (index >> pVisual->offsetRed) & reds
+ ].co.local.red >> shift].red;
+ colors[index].green = gamma[pmap->green[
+ (index >> pVisual->offsetGreen) & greens
+ ].co.local.green >> shift].green;
+ colors[index].blue = gamma[pmap->blue[
+ (index >> pVisual->offsetBlue) & blues
+ ].co.local.blue >> shift].blue;
+ }
+ break;
+ }
+
+
+ if(LOAD_PALETTE(pmap, pmap->pScreen->myNum))
+ (*pScreenPriv->LoadPalette)(pScreenPriv->pScrn, defs, indices,
+ colors, pmap->pVisual);
+
+ if (pScreenPriv->SetOverscan)
+ CMapSetOverscan(pmap, defs, indices);
+
+}
+
+static Bool
+CMapCompareColors(LOCO *color1, LOCO *color2)
+{
+ /* return TRUE if the color1 is "closer" to black than color2 */
+#ifdef DEBUGOVERSCAN
+ ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
+ color1->red, color1->green, color1->blue,
+ color2->red, color2->green, color2->blue,
+ color1->red + color1->green + color1->blue,
+ color2->red + color2->green + color2->blue);
+#endif
+ return (color1->red + color1->green + color1->blue <
+ color2->red + color2->green + color2->blue);
+}
+
+static void
+CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapColormapPtr pColPriv =
+ (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+ LOCO *colors;
+ int index;
+ Bool newOverscan = FALSE;
+ int overscan, tmpOverscan;
+
+ colors = pColPriv->colors;
+ overscan = pColPriv->overscan;
+
+ /*
+ * Search for a new overscan index in the following cases:
+ *
+ * - The index hasn't yet been initialised.  In this case search
+ * for an index that is black or a close match to black.
+ *
+ * - The colour of the old index is changed. In this case search
+ * all indices for a black or close match to black.
+ *
+ * - The colour of the old index wasn't black. In this case only
+ * search the indices that were changed for a better match to black.
+ */
+
+ switch (pVisual->class) {
+ case StaticGray:
+ case TrueColor:
+ /* Should only come here once. Initialise the overscan index to 0 */
+ overscan = 0;
+ newOverscan = TRUE;
+ break;
+ case StaticColor:
+ /*
+ * Only come here once, but search for the overscan in the same way
+ * as for the other cases.
+ */
+ case DirectColor:
+ case PseudoColor:
+ case GrayScale:
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
+ /* Uninitialised */
+ newOverscan = TRUE;
+ } else {
+ /* Check if the overscan was changed */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (index == overscan) {
+ newOverscan = TRUE;
+ break;
+ }
+ }
+ }
+ if (newOverscan) {
+ /* The overscan is either uninitialised or it has been changed */
+
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
+ tmpOverscan = pScreenPriv->maxColors - 1;
+ else
+ tmpOverscan = overscan;
+
+ /* search all entries for a close match to black */
+ for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
+ if (colors[i].red == 0 && colors[i].green == 0 &&
+ colors[i].blue == 0) {
+ overscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", i);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", i);
+#endif
+ if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
+ tmpOverscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n", i);
+#endif
+ }
+ }
+ }
+ if (i < 0)
+ overscan = tmpOverscan;
+ } else {
+ /* Check of the old overscan wasn't black */
+ if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
+ colors[overscan].blue != 0) {
+ int oldOverscan = tmpOverscan = overscan;
+ /* See of there is now a better match */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (colors[index].red == 0 && colors[index].green == 0 &&
+ colors[index].blue == 0) {
+ overscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", index);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", index);
+#endif
+ if (CMapCompareColors(&colors[index],
+ &colors[tmpOverscan])) {
+ tmpOverscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n",
+ index);
+#endif
+ }
+ }
+ }
+ if (i == defs)
+ overscan = tmpOverscan;
+ if (overscan != oldOverscan)
+ newOverscan = TRUE;
+ }
+ }
+ break;
+ }
+ if (newOverscan) {
+ pColPriv->overscan = overscan;
+ if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CmapSetOverscan\n");
+#endif
+ pScreenPriv->SetOverscan(pScreenPriv->pScrn, overscan);
+ }
+ }
+}
+
+static void
+CMapUnwrapScreen(ScreenPtr pScreen)
+{
+ CMapScreenPtr pScreenPriv =
+ (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->SwitchMode = pScreenPriv->SwitchMode;
+ pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+
+ xfree(pScreenPriv->gamma);
+ xfree(pScreenPriv->PreAllocIndices);
+ xfree(pScreenPriv);
+}
+
+
+static void
+ComputeGamma(CMapScreenPtr priv)
+{
+ int elements = priv->gammaElements - 1;
+ double RedGamma, GreenGamma, BlueGamma;
+ int i;
+
+#ifndef DONT_CHECK_GAMMA
+ /* This check is to catch drivers that are not initialising pScrn->gamma */
+ if (priv->pScrn->gamma.red < GAMMA_MIN ||
+ priv->pScrn->gamma.red > GAMMA_MAX ||
+ priv->pScrn->gamma.green < GAMMA_MIN ||
+ priv->pScrn->gamma.green > GAMMA_MAX ||
+ priv->pScrn->gamma.blue < GAMMA_MIN ||
+ priv->pScrn->gamma.blue > GAMMA_MAX) {
+
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "The %s driver didn't call xf86SetGamma() to initialise\n"
+ "\tthe gamma values.\n", priv->pScrn->driverName);
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName);
+ priv->pScrn->gamma.red = 1.0;
+ priv->pScrn->gamma.green = 1.0;
+ priv->pScrn->gamma.blue = 1.0;
+ }
+#endif
+
+ RedGamma = 1.0 / (double)priv->pScrn->gamma.red;
+ GreenGamma = 1.0 / (double)priv->pScrn->gamma.green;
+ BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue;
+
+ for(i = 0; i <= elements; i++) {
+ if(RedGamma == 1.0)
+ priv->gamma[i].red = i;
+ else
+ priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements,
+ RedGamma) * (double)elements + 0.5);
+
+ if(GreenGamma == 1.0)
+ priv->gamma[i].green = i;
+ else
+ priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements,
+ GreenGamma) * (double)elements + 0.5);
+
+ if(BlueGamma == 1.0)
+ priv->gamma[i].blue = i;
+ else
+ priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements,
+ BlueGamma) * (double)elements + 0.5);
+ }
+}
+
+
+int
+CMapChangeGamma(
+ int index,
+ Gamma gamma
+){
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ /* Is this sufficient checking ? */
+ if(CMapScreenIndex == -1)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
+ gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
+ gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
+ return BadValue;
+
+ pScrn->gamma.red = gamma.red;
+ pScrn->gamma.green = gamma.green;
+ pScrn->gamma.blue = gamma.blue;
+
+ ComputeGamma(pScreenPriv);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ pColPriv =
+ (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr;
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if(miInstalledMaps[pScreen->myNum] &&
+ (pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
+
+ if(!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ ((1 << pMap->pVisual->nplanes) > pScreenPriv->maxColors)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ if(pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if(pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ miInstalledMaps[pScreen->myNum] = pLink->cmap;
+ CMapReinstallMap(pLink->cmap);
+ miInstalledMaps[pScreen->myNum] = pMap;
+ }
+ } else
+ CMapReinstallMap(pMap);
+ }
+
+ return Success;
+}
+
+
+int
+xf86ChangeGamma(
+ ScreenPtr pScreen,
+ Gamma gamma
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if(pScrn->ChangeGamma)
+ return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
+
+ return Success; /* Success? */
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86cmap.h b/xc/programs/Xserver/hw/xfree86/common/xf86cmap.h
new file mode 100644
index 000000000..084991dad
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86cmap.h
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.5 1999/07/18 03:26:49 dawes Exp $ */
+
+#ifndef _XF86CMAP_H
+#define _XF86CMAP_H
+
+#include "xf86str.h"
+#include "colormapst.h"
+
+#define CMAP_PALETTED_TRUECOLOR 0x0000001
+#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
+#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
+
+typedef void (*LoadPaletteFuncPtr)(
+ ScrnInfoPtr pScrn,
+ int numColors,
+ int *indicies,
+ LOCO *colors,
+ VisualPtr pVisual
+);
+
+typedef void (*SetOverscanFuncPtr)(
+ ScrnInfoPtr pScrn,
+ int Index
+);
+
+Bool xf86HandleColormaps(
+ ScreenPtr pScreen,
+ int maxCol,
+ int sigRGBbits,
+ LoadPaletteFuncPtr loadPalette,
+ SetOverscanFuncPtr setOverscan,
+ unsigned int flags
+);
+
+int
+xf86ChangeGamma(
+ ScreenPtr pScreen,
+ Gamma gamma
+);
+
+#endif /* _XF86CMAP_H */
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c
new file mode 100644
index 000000000..dbbd20b1e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.c
@@ -0,0 +1,684 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.12 1999/06/27 14:07:57 dawes Exp $ */
+
+#include "misc.h"
+#include "xf86.h"
+
+#include "X.h"
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+
+
+static Bool xf86FBCloseScreen(int, ScreenPtr);
+static unsigned long xf86FBGeneration = 0;
+static int xf86FBScreenIndex = -1;
+static void SendCallFreeBoxCallbacks(FBManagerPtr);
+static FBAreaPtr AllocateArea(
+ FBManagerPtr offman,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+);
+
+
+Bool
+xf86FBManagerRunning(ScreenPtr pScreen)
+{
+ if(xf86FBScreenIndex < 0)
+ return FALSE;
+ if(!pScreen->devPrivates[xf86FBScreenIndex].ptr)
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+xf86InitFBManager(
+ ScreenPtr pScreen,
+ BoxPtr FullBox
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RegionRec ScreenRegion;
+ RegionRec FullRegion;
+ BoxRec ScreenBox;
+ Bool ret;
+
+ ScreenBox.x1 = 0;
+ ScreenBox.y1 = 0;
+ ScreenBox.x2 = pScrn->virtualX;
+ ScreenBox.y2 = pScrn->virtualY;
+
+ if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) ||
+ (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) {
+ return FALSE;
+ }
+
+ REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1);
+ REGION_INIT(pScreen, &FullRegion, FullBox, 1);
+
+ REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion);
+
+ ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
+
+ REGION_UNINIT(pScreen, &ScreenRegion);
+ REGION_UNINIT(pScreen, &FullRegion);
+
+ return ret;
+}
+
+Bool
+xf86InitFBManagerRegion(
+ ScreenPtr pScreen,
+ RegionPtr FullRegion
+){
+ FBManagerPtr offman;
+
+ if(REGION_NIL(FullRegion))
+ return FALSE;
+
+ if(xf86FBGeneration != serverGeneration) {
+ if((xf86FBScreenIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ xf86FBGeneration = serverGeneration;
+ }
+
+ offman = xalloc(sizeof(FBManager));
+ if(!offman) return FALSE;
+
+ pScreen->devPrivates[xf86FBScreenIndex].ptr = (pointer)offman;
+
+ offman->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86FBCloseScreen;
+
+ offman->InitialBoxes = REGION_CREATE(pScreen, NULL, 1);
+ offman->FreeBoxes = REGION_CREATE(pScreen, NULL, 1);
+
+ REGION_COPY(pScreen, offman->InitialBoxes, FullRegion);
+ REGION_COPY(pScreen, offman->FreeBoxes, FullRegion);
+
+ offman->pScreen = pScreen;
+ offman->UsedAreas = NULL;
+ offman->NumUsedAreas = 0;
+ offman->NumCallbacks = 0;
+ offman->FreeBoxesUpdateCallback = NULL;
+ offman->devPrivates = NULL;
+
+ return TRUE;
+}
+
+static void
+SendCallFreeBoxCallbacks(FBManagerPtr offman)
+{
+ int i = offman->NumCallbacks;
+
+ while(i--) {
+ (*offman->FreeBoxesUpdateCallback[i])(
+ offman->pScreen, offman->FreeBoxes, offman->devPrivates[i].ptr);
+ }
+}
+
+Bool
+xf86RegisterFreeBoxCallback(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv
+){
+ FBManagerPtr offman;
+ FreeBoxCallbackProcPtr *newCallbacks;
+ DevUnion *newPrivates;
+
+ if(!xf86FBManagerRunning(pScreen))
+ return FALSE;
+
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback,
+ sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
+
+ newPrivates = xrealloc(offman->devPrivates,
+ sizeof(DevUnion) * (offman->NumCallbacks + 1));
+
+ if(!newCallbacks || !newPrivates)
+ return FALSE;
+
+ offman->FreeBoxesUpdateCallback = newCallbacks;
+ offman->devPrivates = newPrivates;
+
+ offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback;
+ offman->devPrivates[offman->NumCallbacks].ptr = devPriv;
+ offman->NumCallbacks++;
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+
+static FBAreaPtr
+AllocateArea(
+ FBManagerPtr offman,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ ScreenPtr pScreen = offman->pScreen;
+ FBLinkPtr link = NULL;
+ FBAreaPtr area = NULL;
+ RegionRec NewReg;
+ int i, x = 0, num;
+ BoxPtr boxp;
+
+ if(granularity <= 1) granularity = 0;
+
+ boxp = REGION_RECTS(offman->FreeBoxes);
+ num = REGION_NUM_RECTS(offman->FreeBoxes);
+
+ /* look through the free boxes */
+ for(i = 0; i < num; i++, boxp++) {
+ x = boxp->x1;
+ if(granularity) {
+ int tmp = x % granularity;
+ if(tmp) x += (granularity - tmp);
+ }
+
+ if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
+ continue;
+
+ link = xalloc(sizeof(FBLink));
+ if(!link) return NULL;
+
+ area = &(link->area);
+ break;
+ }
+
+ /* try to boot a removeable one out if we are not expendable ourselves */
+ if(!area && !removeCB) {
+ link = offman->UsedAreas;
+
+ while(link) {
+ if(!link->area.RemoveAreaCallback) {
+ link = link->next;
+ continue;
+ }
+
+ boxp = &(link->area.box);
+ x = boxp->x1;
+ if(granularity) {
+ int tmp = x % granularity;
+ if(tmp) x += (granularity - tmp);
+ }
+
+ if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
+ link = link->next;
+ continue;
+ }
+
+ /* bye, bye */
+ (*link->area.RemoveAreaCallback)(&link->area);
+ REGION_INIT(pScreen, &NewReg, &(link->area.box), 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ offman->NumUsedAreas--;
+
+ area = &(link->area);
+ break;
+ }
+ }
+
+ if(area) {
+ area->pScreen = pScreen;
+ area->granularity = granularity;
+ area->box.x1 = x;
+ area->box.x2 = x + w;
+ area->box.y1 = boxp->y1;
+ area->box.y2 = boxp->y1 + h;
+ area->MoveAreaCallback = moveCB;
+ area->RemoveAreaCallback = removeCB;
+ area->devPrivate.ptr = privData;
+
+ REGION_INIT(pScreen, &NewReg, &(area->box), 1);
+ REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ link->next = offman->UsedAreas;
+ offman->UsedAreas = link;
+ offman->NumUsedAreas++;
+ }
+
+ return area;
+}
+
+FBAreaPtr
+xf86AllocateOffscreenArea(
+ ScreenPtr pScreen,
+ int w, int h,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerPtr offman;
+ FBAreaPtr area = NULL;
+
+ if(!xf86FBManagerRunning(pScreen)) return NULL;
+
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
+ SendCallFreeBoxCallbacks(offman);
+
+ return area;
+}
+
+FBAreaPtr
+xf86AllocateLinearOffscreenArea(
+ ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerPtr offman;
+ FBLinkPtr link = NULL;
+ FBAreaPtr area = NULL;
+ RegionRec NewReg;
+ BoxPtr boxp, box1p = NULL;
+ int i, num, w, h;
+
+ if (!xf86FBManagerRunning(pScreen)) return NULL;
+
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ if (offman->InitialBoxes->extents.x1 != 0 ||
+ length <= 0) return NULL;
+
+ w = offman->InitialBoxes->extents.x2 -
+ offman->InitialBoxes->extents.x1;
+ h = (length + w - 1) / w;
+
+ /* look through the free boxes,
+ bottom up to reduce fragmentation troubles */
+
+ boxp = REGION_RECTS(offman->FreeBoxes);
+ num = REGION_NUM_RECTS(offman->FreeBoxes);
+
+ for (i = 0; i < num; i++, boxp++) {
+ if (((boxp->y2 - boxp->y1) < h) ||
+ ((boxp->x2 - boxp->x1) < w) ||
+ (box1p && box1p->y1 > boxp->y1))
+ continue;
+
+ box1p = boxp;
+ }
+
+ if (!box1p) return NULL;
+ link = xalloc(sizeof(FBLink));
+ if (!link) return NULL;
+ area = &(link->area);
+
+ area->pScreen = pScreen;
+ area->granularity = gran;
+ area->box.x1 = box1p->x1; /* Presumed zero */
+ area->box.x2 = box1p->x1 + w;
+ area->box.y1 = box1p->y2 - h;
+ area->box.y2 = box1p->y2;
+ area->MoveAreaCallback = moveCB;
+ area->RemoveAreaCallback = removeCB;
+ area->devPrivate.ptr = privData;
+
+ REGION_INIT(pScreen, &NewReg, &(area->box), 1);
+ REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ link->next = offman->UsedAreas;
+ offman->UsedAreas = link;
+ offman->NumUsedAreas++;
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return area;
+}
+
+void
+xf86FreeOffscreenArea(FBAreaPtr area)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, pLinkPrev = NULL;
+ RegionRec FreedRegion;
+ ScreenPtr pScreen;
+
+ if(!area || !xf86FBManagerRunning(area->pScreen))
+ return;
+
+ pScreen = area->pScreen;
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ pLink = offman->UsedAreas;
+ if(!pLink) return;
+
+ while(&(pLink->area) != area) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return;
+ }
+
+ /* put the area back into the pool */
+ REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedRegion);
+ REGION_UNINIT(pScreen, &FreedRegion);
+
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ xfree(pLink);
+ offman->NumUsedAreas--;
+
+ SendCallFreeBoxCallbacks(offman);
+}
+
+
+
+Bool
+xf86ResizeOffscreenArea(
+ FBAreaPtr resize,
+ int w, int h
+){
+ FBManagerPtr offman;
+ ScreenPtr pScreen;
+ BoxRec OrigArea;
+ RegionRec FreedReg;
+ FBAreaPtr area = NULL;
+ FBLinkPtr pLink, pLinkPrev = NULL;
+
+ if(!resize || !xf86FBManagerRunning(resize->pScreen))
+ return FALSE;
+
+ pScreen = resize->pScreen;
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ /* find this link */
+ if(!(pLink = offman->UsedAreas))
+ return FALSE;
+
+ while(&(pLink->area) != resize) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return FALSE;
+ }
+
+ OrigArea.x1 = resize->box.x1;
+ OrigArea.x2 = resize->box.x2;
+ OrigArea.y1 = resize->box.y1;
+ OrigArea.y2 = resize->box.y2;
+
+ /* if it's smaller, this is easy */
+
+ if((w <= (resize->box.x2 - resize->box.x1)) &&
+ (h <= (resize->box.y2 - resize->box.y1))) {
+ RegionRec NewReg;
+
+ resize->box.x2 = resize->box.x1 + w;
+ resize->box.y2 = resize->box.y1 + h;
+
+ if((resize->box.y2 == OrigArea.y2) &&
+ (resize->box.x2 == OrigArea.x2))
+ return TRUE;
+
+ REGION_INIT(pScreen, &FreedReg, &OrigArea, 1);
+ REGION_INIT(pScreen, &NewReg, &(resize->box), 1);
+ REGION_SUBTRACT(pScreen, &FreedReg, &FreedReg, &NewReg);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ REGION_UNINIT(pScreen, &FreedReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+ }
+
+
+ /* otherwise we remove the old region */
+
+ REGION_INIT(pScreen, &FreedReg, &OrigArea, 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+
+ /* remove the old link */
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ /* and try to add a new one */
+
+ if((area = AllocateArea(offman, w, h, resize->granularity,
+ resize->MoveAreaCallback, resize->RemoveAreaCallback,
+ resize->devPrivate.ptr))) {
+
+ xfree(pLink);
+
+ /* AllocateArea added one but we really only exchanged one */
+ offman->NumUsedAreas--;
+ } else {
+ /* reinstate the old region */
+ REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ REGION_UNINIT(pScreen, &FreedReg);
+
+ pLink->next = offman->UsedAreas;
+ offman->UsedAreas = pLink;
+ return FALSE;
+ }
+
+
+ REGION_UNINIT(pScreen, &FreedReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+
+
+Bool
+xf86FBCloseScreen (int i, ScreenPtr pScreen)
+{
+ FBLinkPtr pLink, tmp;
+ FBManagerPtr offman =
+ (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+
+ pScreen->CloseScreen = offman->CloseScreen;
+
+ pLink = offman->UsedAreas;
+
+ while(pLink) {
+ tmp = pLink;
+ pLink = pLink->next;
+ xfree(tmp);
+ }
+
+ REGION_DESTROY(pScreen, offman->InitialBoxes);
+ REGION_DESTROY(pScreen, offman->FreeBoxes);
+
+ xfree(offman);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+
+Bool
+xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, tmp, pPrev = NULL;
+ RegionRec FreedRegion;
+ Bool anyUsed = FALSE;
+
+ if(!xf86FBManagerRunning(pScreen))
+ return FALSE;
+
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ pLink = offman->UsedAreas;
+ if(!pLink) return TRUE;
+
+ while(pLink) {
+ if(pLink->area.RemoveAreaCallback) {
+ (*pLink->area.RemoveAreaCallback)(&pLink->area);
+
+ REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1);
+ REGION_APPEND(pScreen, offman->FreeBoxes, &FreedRegion);
+ REGION_UNINIT(pScreen, &FreedRegion);
+
+ if(pPrev)
+ pPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ tmp = pLink;
+ pLink = pLink->next;
+ xfree(tmp);
+ offman->NumUsedAreas--;
+ anyUsed = TRUE;
+ } else {
+ pPrev = pLink;
+ pLink = pLink->next;
+ }
+ }
+
+ if(anyUsed) {
+ REGION_VALIDATE(pScreen, offman->FreeBoxes, &anyUsed);
+ SendCallFreeBoxCallbacks(offman);
+ }
+
+ return TRUE;
+}
+
+
+Bool
+xf86QueryLargestOffscreenArea(
+ ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences,
+ int severity
+){
+ FBManagerPtr offman;
+ RegionPtr newRegion = NULL;
+ BoxPtr pbox;
+ int nbox;
+ int x, w, h, area, oldArea;
+
+ *width = *height = oldArea = 0;
+
+ if(!xf86FBManagerRunning(pScreen))
+ return FALSE;
+
+ if(granularity <= 1) granularity = 0;
+
+ if((preferences < 0) || (preferences > 3))
+ return FALSE;
+
+ offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+
+ if(severity < 0) severity = 0;
+ if(severity > 2) severity = 2;
+
+ switch(severity) {
+ case 2:
+ if(offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+ newRegion = REGION_CREATE(pScreen, NULL, 1);
+ REGION_COPY(pScreen, newRegion, offman->InitialBoxes);
+ pLink = offman->UsedAreas;
+
+ while(pLink) {
+ if(!pLink->area.RemoveAreaCallback) {
+ REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1);
+ REGION_SUBTRACT(pScreen, newRegion, newRegion, &tmpRegion);
+ REGION_UNINIT(pScreen, &tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = REGION_NUM_RECTS(newRegion);
+ pbox = REGION_RECTS(newRegion);
+ break;
+ }
+ case 1:
+ if(offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+ newRegion = REGION_CREATE(pScreen, NULL, 1);
+ REGION_COPY(pScreen, newRegion, offman->FreeBoxes);
+ pLink = offman->UsedAreas;
+
+ while(pLink) {
+ if(pLink->area.RemoveAreaCallback) {
+ REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1);
+ REGION_APPEND(pScreen, newRegion, &tmpRegion);
+ REGION_UNINIT(pScreen, &tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = REGION_NUM_RECTS(newRegion);
+ pbox = REGION_RECTS(newRegion);
+ break;
+ }
+ default:
+ nbox = REGION_NUM_RECTS(offman->FreeBoxes);
+ pbox = REGION_RECTS(offman->FreeBoxes);
+ break;
+ }
+
+ while(nbox--) {
+ x = pbox->x1;
+ if(granularity) {
+ int tmp = x % granularity;
+ if(tmp) x += (granularity - tmp);
+ }
+
+ w = pbox->x2 - x;
+ h = pbox->y2 - pbox->y1;
+ area = w * h;
+
+ if(w > 0) {
+ Bool gotIt = FALSE;
+ switch(preferences) {
+ case FAVOR_AREA_THEN_WIDTH:
+ if((area > oldArea) || ((area == oldArea) && (w > *width)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_AREA_THEN_HEIGHT:
+ if((area > oldArea) || ((area == oldArea) && (h > *height)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_WIDTH_THEN_AREA:
+ if((w > *width) || ((w == *width) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_HEIGHT_THEN_AREA:
+ if((h > *height) || ((h == *height) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ }
+ if(gotIt) {
+ *width = w;
+ *height = h;
+ oldArea = area;
+ }
+ }
+ pbox++;
+ }
+
+ if(newRegion)
+ REGION_DESTROY(pScreen, newRegion);
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h
new file mode 100644
index 000000000..fdb295043
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86fbman.h
@@ -0,0 +1,120 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.8 1999/06/27 14:07:57 dawes Exp $ */
+
+#ifndef _XF86FBMAN_H
+#define _XF86FBMAN_H
+
+
+#include "scrnintstr.h"
+#include "regionstr.h"
+
+
+#define FAVOR_AREA_THEN_WIDTH 0
+#define FAVOR_AREA_THEN_HEIGHT 1
+#define FAVOR_WIDTH_THEN_AREA 2
+#define FAVOR_HEIGHT_THEN_AREA 3
+
+#define PRIORITY_LOW 0
+#define PRIORITY_NORMAL 1
+#define PRIORITY_EXTREME 2
+
+
+typedef struct _FBArea {
+ ScreenPtr pScreen;
+ BoxRec box;
+ int granularity;
+ void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*);
+ void (*RemoveAreaCallback)(struct _FBArea*);
+ DevUnion devPrivate;
+} FBArea, *FBAreaPtr;
+
+typedef struct _FBLink {
+ FBArea area;
+ struct _FBLink *next;
+} FBLink, *FBLinkPtr;
+
+typedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer);
+typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr);
+typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr);
+
+typedef struct {
+ ScreenPtr pScreen;
+ RegionPtr InitialBoxes;
+ RegionPtr FreeBoxes;
+ FBLinkPtr UsedAreas;
+ int NumUsedAreas;
+ CloseScreenProcPtr CloseScreen;
+ int NumCallbacks;
+ FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
+ DevUnion *devPrivates;
+} FBManager, *FBManagerPtr;
+
+
+
+Bool
+xf86InitFBManagerRegion(
+ ScreenPtr pScreen,
+ RegionPtr ScreenRegion
+);
+
+Bool
+xf86InitFBManager(
+ ScreenPtr pScreen,
+ BoxPtr FullBox
+);
+
+Bool
+xf86FBManagerRunning(
+ ScreenPtr pScreen
+);
+
+FBAreaPtr
+xf86AllocateOffscreenArea (
+ ScreenPtr pScreen,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+);
+
+FBAreaPtr
+xf86AllocateLinearOffscreenArea (
+ ScreenPtr pScreen,
+ int length,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+);
+
+void xf86FreeOffscreenArea(FBAreaPtr area);
+
+Bool
+xf86ResizeOffscreenArea(
+ FBAreaPtr resize,
+ int w, int h
+);
+
+Bool
+xf86RegisterFreeBoxCallback(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv
+);
+
+Bool
+xf86PurgeUnlockedOffscreenAreas(
+ ScreenPtr pScreen
+);
+
+
+Bool
+xf86QueryLargestOffscreenArea(
+ ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences,
+ int priority
+);
+
+#endif /* _XF86FBMAN_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86str.h b/xc/programs/Xserver/hw/xfree86/common/xf86str.h
new file mode 100644
index 000000000..e6e69ab4c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86str.h
@@ -0,0 +1,868 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.47 1999/08/22 05:57:31 dawes Exp $ */
+
+/*
+ * Copyright (c) 1997 by The XFree86 Project, Inc.
+ */
+
+/*
+ * This file contains definitions of the public XFree86 data structures/types.
+ * Any data structures that video drivers need to access should go here.
+ */
+
+#ifndef _XF86STR_H
+#define _XF86STR_H
+
+#include "misc.h"
+#include "input.h"
+#include "scrnintstr.h"
+#include "xf86Module.h"
+
+/*
+ * memType is of the size of the addressable memory (machine size)
+ * usually unsigned long.
+ */
+typedef unsigned long memType;
+
+/* Video mode flags */
+
+typedef enum {
+ V_PHSYNC = 0x0001,
+ V_NHSYNC = 0x0002,
+ V_PVSYNC = 0x0004,
+ V_NVSYNC = 0x0008,
+ V_INTERLACE = 0x0010,
+ V_DBLSCAN = 0x0020,
+ V_CSYNC = 0x0040,
+ V_PCSYNC = 0x0080,
+ V_NCSYNC = 0x0100,
+ V_HSKEW = 0x0200, /* hskew provided */
+ V_PIXMUX = 0x1000,
+ V_DBLCLK = 0x2000,
+ V_CLKDIV2 = 0x4000
+} ModeFlags;
+
+typedef enum {
+ INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
+} CrtcAdjustFlags;
+
+
+/* These are possible return values for xf86CheckMode() and ValidMode() */
+typedef enum {
+ MODE_OK = 0, /* Mode OK */
+ MODE_HSYNC, /* hsync out of range */
+ MODE_VSYNC, /* vsync out of range */
+ MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_BAD_WIDTH, /* requires an unsupported linepitch */
+ MODE_NOMODE, /* no mode with a maching name */
+ MODE_NO_INTERLACE, /* interlaced mode not supported */
+ MODE_NO_DBLESCAN, /* doublescan mode not supported */
+ MODE_NO_VSCAN, /* multiscan mode not supported */
+ MODE_MEM, /* insufficient video memory */
+ MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
+ MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
+ MODE_MEM_VIRT, /* insufficient video memory given virtual size */
+ MODE_NOCLOCK, /* no fixed clock available */
+ MODE_CLOCK_HIGH, /* clock required is too high */
+ MODE_CLOCK_LOW, /* clock required is too low */
+ MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
+ MODE_BAD_HVALUE, /* horizontal timing was out of range */
+ MODE_BAD_VVALUE, /* vertical timing was out of range */
+ MODE_BAD_VSCAN, /* VScan value out of range */
+ MODE_HSYNC_NARROW, /* horizontal sync too narrow */
+ MODE_HSYNC_WIDE, /* horizontal sync too wide */
+ MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
+ MODE_HBLANK_WIDE, /* horizontal blanking too wide */
+ MODE_VSYNC_NARROW, /* vertical sync too narrow */
+ MODE_VSYNC_WIDE, /* vertical sync too wide */
+ MODE_VBLANK_NARROW, /* vertical blanking too narrow */
+ MODE_VBLANK_WIDE, /* vertical blanking too wide */
+ MODE_PANEL, /* exceeds panel dimensions */
+ MODE_BAD = -2, /* unspecified reason */
+ MODE_ERROR = -1 /* error condition */
+} ModeStatus;
+
+# define M_T_BUILTIN 0x01 /* built-in mode */
+# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
+# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
+# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
+ /* built-in mode - configure CRTC and clock */
+# define M_T_DEFAULT 0x10 /* (VESA) default modes */
+/* Video mode */
+
+typedef struct _DisplayModeRec {
+ struct _DisplayModeRec * prev;
+ struct _DisplayModeRec * next;
+ char * name; /* identifier for the mode */
+ ModeStatus status;
+ int type;
+
+ /* These are the values that the user sees/provides */
+ int Clock; /* pixel clock freq */
+ int HDisplay; /* horizontal timing */
+ int HSyncStart;
+ int HSyncEnd;
+ int HTotal;
+ int HSkew;
+ int VDisplay; /* vertical timing */
+ int VSyncStart;
+ int VSyncEnd;
+ int VTotal;
+ int VScan;
+ int Flags;
+
+ /* These are the values the hardware uses */
+ int ClockIndex;
+ int SynthClock; /* Actual clock freq to
+ * be programmed */
+ int CrtcHDisplay;
+ int CrtcHBlankStart;
+ int CrtcHSyncStart;
+ int CrtcHSyncEnd;
+ int CrtcHBlankEnd;
+ int CrtcHTotal;
+ int CrtcHSkew;
+ int CrtcVDisplay;
+ int CrtcVBlankStart;
+ int CrtcVSyncStart;
+ int CrtcVSyncEnd;
+ int CrtcVBlankEnd;
+ int CrtcVTotal;
+ Bool CrtcHAdjusted;
+ Bool CrtcVAdjusted;
+ int PrivSize;
+ INT32 * Private;
+ int PrivFlags;
+} DisplayModeRec, *DisplayModePtr;
+
+/* The monitor description */
+
+#define MAX_HSYNC 8
+#define MAX_VREFRESH 8
+
+typedef struct { float hi, lo; } range;
+
+typedef struct { CARD32 red, green, blue; } rgb;
+
+typedef struct { float red, green, blue; } Gamma;
+
+/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
+#define GAMMA_MAX 10.0
+#define GAMMA_MIN (1.0 / GAMMA_MAX)
+#define GAMMA_ZERO (GAMMA_MIN / 100.0)
+
+typedef struct {
+ char * id;
+ char * vendor;
+ char * model;
+ int nHsync;
+ range hsync[MAX_HSYNC];
+ int nVrefresh;
+ range vrefresh[MAX_VREFRESH];
+ DisplayModePtr Modes; /* Start of the monitor's mode list */
+ DisplayModePtr Last; /* End of the monitor's mode list */
+ Gamma gamma; /* Gamma of the monitor */
+ int widthmm;
+ int heightmm;
+ pointer options;
+ pointer DDC;
+} MonRec, *MonPtr;
+
+/* the list of clock ranges */
+typedef struct x_ClockRange {
+ struct x_ClockRange *next;
+ int minClock;
+ int maxClock;
+ int clockIndex; /* -1 for programmable clocks */
+ Bool interlaceAllowed;
+ Bool doubleScanAllowed;
+ int ClockMulFactor;
+ int ClockDivFactor;
+ int PrivFlags;
+} ClockRange, *ClockRangePtr;
+
+/*
+ * The driver list struct. This contains the information required for each
+ * driver before a ScrnInfoRec has been allocated.
+ */
+typedef struct _DriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ Bool (*Probe)(struct _DriverRec *drv, int flags);
+ pointer module;
+ int refCount;
+} DriverRec, *DriverPtr;
+
+/*
+ * These are the private bus types. New types can be added here. Types
+ * required for the public interface should be added to xf86str.h, with
+ * function prototypes added to xf86.h.
+ */
+
+typedef enum {
+ BUS_NONE,
+ BUS_ISA,
+ BUS_PCI
+} BusType;
+
+typedef struct {
+ int bus;
+ int device;
+ int func;
+} PciBusId;
+
+typedef struct {
+ unsigned int dummy;
+} IsaBusId;
+
+typedef struct _bus {
+ BusType type;
+ union {
+ IsaBusId isa;
+ PciBusId pci;
+ } id;
+} BusRec, *BusPtr;
+
+#define MAXCLOCKS 128
+typedef enum {
+ DAC_BPP8 = 0,
+ DAC_BPP16,
+ DAC_BPP24,
+ DAC_BPP32,
+ MAXDACSPEEDS
+} DacSpeedIndex;
+
+typedef struct {
+ char * identifier;
+ char * vendor;
+ char * board;
+ char * chipset;
+ char * ramdac;
+ char * driver;
+ struct _confscreenrec * myScreenSection;
+ Bool claimed;
+ int dacSpeeds[MAXDACSPEEDS];
+ int numclocks;
+ int clock[MAXCLOCKS];
+ char * clockchip;
+ char * busID;
+ Bool active;
+ Bool inUse;
+ int videoRam;
+ int textClockFreq;
+ unsigned long BiosBase; /* Base address of video BIOS */
+ unsigned long MemBase; /* Frame buffer base address */
+ unsigned long IOBase;
+ int chipID;
+ int chipRev;
+ pointer options;
+ int irq;
+} GDevRec, *GDevPtr;
+
+typedef int (*FindIsaDevProc)(GDevPtr dev);
+
+typedef struct {
+ char * identifier;
+ char * driver;
+ pointer commonOptions;
+ pointer extraOptions;
+} IDevRec, *IDevPtr;
+
+typedef struct {
+ int vendor;
+ int chipType;
+ int chipRev;
+ int subsysVendor;
+ int subsysCard;
+ int bus;
+ int device;
+ int func;
+ int class;
+ int subclass;
+ int interface;
+ memType memBase[6];
+ memType ioBase[6];
+ int size[6];
+ unsigned char type[6];
+ memType biosBase;
+ int biosSize;
+ pointer thisCard;
+ Bool validate;
+} pciVideoRec, *pciVideoPtr;
+
+typedef struct {
+ int frameX0;
+ int frameY0;
+ int virtualX;
+ int virtualY;
+ int depth;
+ int fbbpp;
+ rgb weight;
+ rgb blackColour;
+ rgb whiteColour;
+ int defaultVisual;
+ char ** modes;
+ pointer options;
+} DispRec, *DispPtr;
+
+typedef struct _confxvportrec {
+ char * identifier;
+ pointer options;
+} confXvPortRec, *confXvPortPtr;
+
+typedef struct _confxvadaptrec {
+ char * identifier;
+ int numports;
+ confXvPortPtr ports;
+ pointer options;
+} confXvAdaptorRec, *confXvAdaptorPtr;
+
+typedef struct _confscreenrec {
+ char * id;
+ int screennum;
+ int defaultdepth;
+ int defaultbpp;
+ int defaultfbbpp;
+ MonPtr monitor;
+ GDevPtr device;
+ int numdisplays;
+ DispPtr displays;
+ int numxvadaptors;
+ confXvAdaptorPtr xvadaptors;
+ pointer options;
+} confScreenRec, *confScreenPtr;
+
+typedef struct _screenlayoutrec {
+ confScreenPtr screen;
+ confScreenPtr top;
+ confScreenPtr bottom;
+ confScreenPtr left;
+ confScreenPtr right;
+} screenLayoutRec, *screenLayoutPtr;
+
+typedef struct _serverlayoutrec {
+ char * id;
+ screenLayoutPtr screens;
+ GDevPtr inactives;
+ IDevPtr inputs;
+ pointer options;
+} serverLayoutRec, *serverLayoutPtr;
+
+typedef struct _confdribufferrec {
+ int count;
+ int size;
+ enum {
+ XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
+ } flags;
+} confDRIBufferRec, *confDRIBufferPtr;
+
+typedef struct _confdrirec {
+ int group;
+ int mode;
+ int bufs_count;
+ confDRIBufferRec *bufs;
+} confDRIRec, *confDRIPtr;
+
+/* These values should be adjusted when new fields are added to ScrnInfoRec */
+#define NUM_RESERVED_INTS 16
+#define NUM_RESERVED_POINTERS 16
+#define NUM_RESERVED_FUNCS 16
+
+typedef pointer (*funcPointer)(void);
+
+/* Flags for driver messages */
+typedef enum {
+ X_PROBED, /* Value was probed */
+ X_CONFIG, /* Value was given in the config file */
+ X_DEFAULT, /* Value is a default */
+ X_CMDLINE, /* Value was given on the command line */
+ X_NOTICE, /* Notice */
+ X_ERROR, /* Error message */
+ X_WARNING, /* Warning message */
+ X_INFO, /* Informational message */
+ X_NONE /* No prefix */
+} MessageType;
+
+/* flags for depth 24 pixmap options */
+typedef enum {
+ Pix24DontCare = 0,
+ Pix24Use24,
+ Pix24Use32
+} Pix24Flags;
+
+/* flags for SaveRestoreImage */
+typedef enum {
+ SaveImage,
+ RestoreImage,
+ FreeImage
+} SaveRestoreFlags;
+
+/*
+ * The IO access enabler struct. This contains the address for
+ * the IOEnable/IODisable funcs for their specific bus along
+ * with a pointer to data needed by them
+ */
+typedef struct _AccessRec {
+ void (*AccessDisable)(void *arg);
+ void (*AccessEnable)(void *arg);
+ void *arg;
+} xf86AccessRec, *xf86AccessPtr;
+
+/* bus-access-related types */
+typedef enum {
+ NONE,
+ IO,
+ MEM_IO,
+ MEM
+} resType;
+
+typedef struct _EntityAccessRec {
+ xf86AccessPtr fallback;
+ xf86AccessPtr pAccess;
+ resType rt;
+ pointer busAcc;
+ struct _EntityAccessRec *next;
+} EntityAccessRec, *EntityAccessPtr;
+
+typedef struct _CurrAccRec {
+ EntityAccessPtr pMemAccess;
+ EntityAccessPtr pIoAccess;
+} xf86CurrentAccessRec, *xf86CurrentAccessPtr;
+
+/* new RAC */
+
+/* Resource Type values */
+#define ResNone -1
+
+#define ResMem 0x0001
+#define ResIo 0x0002
+#define ResPhysMask 0x000F
+
+#define ResExclusive 0x0010
+#define ResShared 0x0020
+#define ResAny 0x0040
+#define ResAccMask 0x0070
+#define ResUnused 0x0080
+
+#define ResUnusedOpr 0x0100
+#define ResDisableOpr 0x0200
+#define ResOprMask 0x0300
+
+#define ResBlock 0x0400
+#define ResSparse 0x0800
+#define ResExtMask 0x0C00
+
+#define ResEstimated 0x1000
+#define ResInit 0x2000
+#define ResBios 0x4000
+#define ResMiscMask 0xF000
+
+#define ResEnd ResNone
+
+#define ResExcMemBlock (ResMem | ResExclusive | ResBlock)
+#define ResExcIoBlock (ResIo | ResExclusive | ResBlock)
+#define ResShrMemBlock (ResMem | ResShared | ResBlock)
+#define ResShrIoBlock (ResIo | ResShared | ResBlock)
+#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock)
+#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock)
+#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock)
+#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock)
+#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse)
+#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse)
+#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse)
+#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse)
+
+#define ResExcMemSparse (ResMem | ResExclusive | ResSparse)
+#define ResExcIoSparse (ResIo | ResExclusive | ResSparse)
+#define ResShrMemSparse (ResMem | ResShared | ResSparse)
+#define ResShrIoSparse (ResIo | ResShared | ResSparse)
+#define ResUusdMemSparse (ResMem | ResUnused | ResSparse)
+#define ResUusdIoSparse (ResIo | ResUnused | ResSparse)
+
+#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem)
+#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo)
+#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive)
+#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared)
+#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused)
+#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
+#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
+#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
+
+typedef struct {
+ long type; /* shared, exclusive, unused etc. */
+ memType a;
+ memType b;
+} resRange, *resList;
+
+#define RANGE(r,u,v,t) (r).a = (u);\
+ (r).b = (v);\
+ (r).type = t;
+
+#define rBase a
+#define rMask b
+#define rBegin a
+#define rEnd b
+
+/* resource record */
+typedef struct _resRec *resPtr;
+typedef struct _resRec {
+ resRange val;
+ int entityIndex; /* who owns the resource */
+ resPtr next;
+} resRec;
+
+#define sparse_base val.rBase
+#define sparse_mask val.rMask
+#define block_begin val.rBegin
+#define block_end val.rEnd
+#define res_type val.type
+
+typedef struct {
+ int numChipset;
+ resRange *resList;
+} IsaChipsets;
+
+typedef struct {
+ int numChipset;
+ int PCIid;
+ resRange *resList;
+} PciChipsets;
+
+/* Entity properties */
+typedef void (*EntityProc)(int entityIndex,pointer private);
+
+typedef struct _entityInfo {
+ int index;
+ BusRec location;
+ int chipset;
+ Bool active;
+ resPtr resources;
+ GDevPtr device;
+} EntityInfoRec, *EntityInfoPtr;
+
+/* server states */
+
+typedef enum {
+ SETUP,
+ OPERATING
+} xf86State;
+
+
+/* DGA */
+
+typedef struct {
+ int num; /* A unique identifier for the mode (num > 0) */
+ DisplayModePtr mode;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset; /* offset into physical memory */
+ unsigned char *address; /* server's mapped framebuffer */
+ int reserved1;
+ int reserved2;
+} DGAModeRec, *DGAModePtr;
+
+typedef struct {
+ DGAModePtr mode;
+ PixmapPtr pPix;
+} DGADeviceRec, *DGADevicePtr;
+
+/*
+ * ScrnInfoRec
+ *
+ * There is one of these for each screen, and it holds all the screen-specific
+ * information.
+ *
+ * Note: the size and layout must be kept the same across versions. New
+ * fields are to be added in place of the "reserved*" fields. No fields
+ * are to be dependent on compile-time defines.
+ */
+
+
+typedef struct _ScrnInfoRec {
+ int driverVersion;
+ char * driverName; /* canonical name used in */
+ /* the config file */
+ ScreenPtr pScreen; /* Pointer to the ScreenRec */
+ int scrnIndex; /* Number of this screen */
+ Bool configured; /* Is this screen valid */
+ int origIndex; /* initial number assigned to
+ * this screen before
+ * finalising the number of
+ * available screens */
+
+ /* Display-wide screenInfo values needed by this screen */
+ int imageByteOrder;
+ int bitmapScanlineUnit;
+ int bitmapScanlinePad;
+ int bitmapBitOrder;
+ int numFormats;
+ PixmapFormatRec formats[MAXFORMATS];
+ PixmapFormatRec fbFormat;
+
+ int bitsPerPixel; /* fb bpp */
+ Pix24Flags pixmap24; /* pixmap pref for depth 24 */
+ int depth; /* depth of default visual */
+ MessageType depthFrom; /* set from config? */
+ MessageType bitsPerPixelFrom; /* set from config? */
+ rgb weight; /* r/g/b weights */
+ rgb mask; /* rgb masks */
+ rgb offset; /* rgb offsets */
+ int rgbBits; /* Number of bits in r/g/b */
+ Gamma gamma; /* Gamma of the monitor */
+ int defaultVisual; /* default visual class */
+ int maxHValue; /* max horizontal timing */
+ int maxVValue; /* max vertical timing value */
+ int virtualX; /* Virtual width */
+ int virtualY; /* Virtual height */
+ int xInc; /* Horizontal timing increment */
+ MessageType virtualFrom; /* set from config? */
+ int displayWidth; /* memory pitch */
+ int frameX0; /* viewport position */
+ int frameY0;
+ int frameX1;
+ int frameY1;
+ int zoomLocked; /* Disallow mode changes */
+ DisplayModePtr modePool; /* list of compatible modes */
+ DisplayModePtr modes; /* list of actual modes */
+ DisplayModePtr currentMode; /* current mode
+ * This was previously
+ * overloaded with the modes
+ * field, which is a pointer
+ * into a circular list */
+ confScreenPtr confScreen; /* Screen config info */
+ MonPtr monitor; /* Monitor information */
+ DispPtr display; /* Display information */
+ int * entityList; /* List of device entities */
+ int numEntities;
+ int widthmm; /* physical display dimensions
+ * in mm */
+ int heightmm;
+ int xDpi; /* width DPI */
+ int yDpi; /* height DPI */
+ char * name; /* Name to prefix messages */
+ pointer driverPrivate; /* Driver private area */
+ DevUnion * privates; /* Other privates can hook in
+ * here */
+ DriverPtr drv; /* xf86DriverList[] entry */
+ pointer module; /* Pointer to module head */
+ int colorKey;
+ int overlayFlags;
+
+ /* Some of these may be moved out of here into the driver private area */
+
+ char * chipset; /* chipset name */
+ char * ramdac; /* ramdac name */
+ char * clockchip; /* clock name */
+ Bool progClock; /* clock is programmable */
+ int numClocks; /* number of clocks */
+ int clock[MAXCLOCKS]; /* list of clock frequencies */
+ int videoRam; /* amount of video ram (kb) */
+ unsigned long biosBase; /* Base address of video BIOS */
+ unsigned long memPhysBase; /* Physical address of FB */
+ unsigned long fbOffset; /* Offset of FB in the above */
+ unsigned long ioBase; /* I/O or MMIO base adderss */
+ int memClk; /* memory clock */
+ int textClockFreq; /* clock of text mode */
+ Bool flipPixels; /* swap default black/white */
+ pointer options;
+
+ int chipID;
+ int chipRev;
+ int racMemFlags;
+ int racIoFlags;
+ pointer access;
+ xf86CurrentAccessPtr CurrentAccess;
+ resType resourceType;
+ pointer busAccess;
+ /* Allow screens to be enabled/disabled individually */
+ Bool vtSema;
+ /*
+ * These can be used when the minor ABI version is incremented.
+ * The NUM_* parameters must be reduced appropriately to keep the
+ * structure size and alignment unchanged.
+ */
+ int reservedInt[NUM_RESERVED_INTS];
+ pointer reservedPtr[NUM_RESERVED_POINTERS];
+
+ /*
+ * Driver entry points.
+ *
+ */
+
+ Bool (*Probe)(DriverPtr drv, int flags);
+ Bool (*PreInit)(struct _ScrnInfoRec *pScrn, int flags);
+ Bool (*ScreenInit)(int scrnIndex, ScreenPtr pScreen,
+ int argc, char **argv);
+ Bool (*SwitchMode)(int scrnIndex, DisplayModePtr mode,
+ int flags);
+ void (*AdjustFrame)(int scrnIndex, int x, int y, int flags);
+ Bool (*EnterVT)(int scrnIndex, int flags);
+ void (*LeaveVT)(int scrnIndex, int flags);
+ void (*FreeScreen)(int scrnIndex, int flags);
+ int (*ValidMode)(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
+ Bool (*SaveRestoreImage)(int scrnIndex,
+ SaveRestoreFlags what);
+ int (*SetDGAMode)(int scrnIndex, int num,
+ DGADevicePtr devRet);
+ int (*ChangeGamma)(int scrnIndex, Gamma gamma);
+ void (*PointerMoved)(int scrnIndex, int x, int y);
+ /*
+ * This can be used when the minor ABI version is incremented.
+ * The NUM_* parameter must be reduced appropriately to keep the
+ * structure size and alignment unchanged.
+ */
+ funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
+
+} ScrnInfoRec, *ScrnInfoPtr;
+
+
+typedef struct {
+ Bool (*OpenFramebuffer)(
+ ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *extra
+ );
+ void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
+ Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
+ void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
+ int (*GetViewport)(ScrnInfoPtr pScrn);
+ void (*Sync)(ScrnInfoPtr);
+ void (*FillRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned long color
+ );
+ void (*BlitRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+ );
+ void (*BlitTransRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+ );
+} DGAFunctionRec, *DGAFunctionPtr;
+
+typedef struct {
+ int token; /* id of the token */
+ const char * name; /* token name */
+} SymTabRec, *SymTabPtr;
+
+
+/* These are the possible flags for ValidMode */
+typedef enum {
+ MODE_USED, /* this mode is really being used in the */
+ /* modes line of the Display Subsection */
+ MODE_SUGGESTED, /* this mode is included in the available*/
+ /* modes in the Monitor Section */
+ MODE_VID /* this is called from the VidMode extension */
+} ValidModeFlags;
+
+/* flags for xf86LookupMode */
+typedef enum {
+ LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
+ LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
+ LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
+ LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
+ LOOKUP_CLKDIV2 = 0x0100 /* Allow half clocks */
+} LookupModeFlags;
+
+#define NoDepth24Support 0x00
+#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
+#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
+#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
+#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
+#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
+#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
+
+#ifndef NEW_INPUT
+/*
+ * mouse protocol types
+ */
+typedef enum {
+ PROT_OSMOUSE = -1,
+ PROT_MS = 0, /* Microsoft */
+ PROT_MSC, /* Mouse Systems Corp */
+ PROT_MM, /* MMseries */
+ PROT_LOGI, /* Logitech */
+ PROT_BM, /* BusMouse ??? */
+ PROT_LOGIMAN, /* MouseMan / TrackMan */
+ PROT_PS2, /* PS/2 mouse */
+ PROT_MMHIT, /* MM_HitTab */
+ PROT_GLIDEPOINT, /* ALPS serial GlidePoint */
+ PROT_IMSERIAL, /* Microsoft serial IntelliMouse */
+ PROT_THINKING, /* Kensington serial ThinkingMouse */
+ PROT_IMPS2, /* Microsoft PS/2 IntelliMouse */
+ PROT_THINKINGPS2, /* Kensington PS/2 ThinkingMouse */
+ PROT_MMANPLUSPS2, /* Logitech PS/2 MouseMan+ */
+ PROT_GLIDEPOINTPS2, /* ALPS PS/2 GlidePoint */
+ PROT_NETPS2, /* Genius PS/2 NetMouse */
+ PROT_NETSCROLLPS2, /* Genius PS/2 NetScroll */
+ PROT_SYSMOUSE, /* SysMouse */
+ PROT_WSMOUSE, /* wsmouse (NetBSD) */
+ PROT_SUN, /* Sun Microsystems */
+ PROT_AUTO, /* automatic */
+ PROT_ACECAD, /* Acecad tablets */
+ NUM_PROTOCOLS /* MUST BE LAST */
+} MouseProtocol;
+#endif
+
+
+/* For DPMS */
+typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
+
+/* Input handler proc */
+typedef void (*InputHandlerProc)(int fd, pointer data);
+
+/* These are used by xf86GetClocks */
+#define CLK_REG_SAVE -1
+#define CLK_REG_RESTORE -2
+
+/*
+ * misc constants
+ */
+#define INTERLACE_REFRESH_WEIGHT 1.5
+#define SYNC_TOLERANCE 0.01 /* 1 percent */
+#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
+
+
+#define OVERLAY_8_32_DUALFB 0x00000001
+#define OVERLAY_8_24_DUALFB 0x00000002
+#define OVERLAY_8_16_DUALFB 0x00000004
+#define OVERLAY_8_32_PLANAR 0x00000008
+
+#if 0
+#define LD_RESOLV_IFDONE 0 /* only check if no more
+ delays pending */
+#define LD_RESOLV_NOW 1 /* finish one delay step */
+#define LD_RESOLV_FORCE 2 /* force checking... */
+#endif
+
+#endif /* _XF86STR_H */
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.c b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c
new file mode 100644
index 000000000..642d886f3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c
@@ -0,0 +1,1375 @@
+/*
+
+ XFree86 Xv DDX written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+ Copyright (C) 1998, 1999 - The XFree86 Project Inc.
+
+*/
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.12 1999/05/23 06:33:47 dawes Exp $ */
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "X.h"
+#include "Xproto.h"
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include "Xv.h"
+#include "Xvproto.h"
+#include "xvdix.h"
+#ifdef XFree86LOADER
+#include "xvmodproc.h"
+#endif
+
+#include "xf86xv.h"
+
+
+/* XvScreenRec fields */
+
+static Bool xf86XVCloseScreen(int, ScreenPtr);
+static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
+
+/* XvAdaptorRec fields */
+
+static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
+static int xf86XVFreePort(XvPortPtr);
+static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
+static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
+static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
+static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+ CARD16, CARD16,CARD16, CARD16,
+ unsigned int*, unsigned int*);
+
+/* ScreenRec fields */
+
+static void xf86XVWindowExposures(WindowPtr, RegionPtr, RegionPtr);
+static Bool xf86XVCreateWindow(WindowPtr pWin);
+static Bool xf86XVUnrealizeWindow(WindowPtr pWin);
+static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
+static void xf86XVCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
+
+/* ScrnInfoRec functions */
+
+static Bool xf86XVEnterVT(int, int);
+static void xf86XVLeaveVT(int, int);
+
+/* misc */
+
+static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
+
+
+int XF86XVWindowIndex = -1;
+int XF86XvScreenIndex = -1;
+static unsigned long XF86XVGeneration = 0;
+static unsigned long PortResource = 0;
+
+#ifdef XFree86LOADER
+int (*XvGetScreenIndexProc)(void) = NULL;
+unsigned long (*XvGetRTPortProc)(void) = NULL;
+int (*XvScreenInitProc)(ScreenPtr) = NULL;
+#else
+int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex;
+unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
+int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
+#endif
+
+
+static XF86VideoAdaptorPtr *GenAdaptors = NULL;
+static int NumGenAdaptors = 0;
+
+int
+xf86XVRegisterGenericAdaptor(
+ XF86VideoAdaptorPtr *adaptors,
+ int num
+){
+ int i;
+ XF86VideoAdaptorPtr *newadaptors;
+
+ newadaptors = xrealloc(GenAdaptors, sizeof(XF86VideoAdaptorPtr) *
+ (num + NumGenAdaptors));
+ if (!newadaptors)
+ return 0;
+ GenAdaptors = newadaptors;
+
+ for (i=0; i<num && NumGenAdaptors <= 4; i++, NumGenAdaptors++) {
+ GenAdaptors[NumGenAdaptors] = adaptors[i];
+ }
+
+ return i;
+}
+
+int
+xf86XVListGenericAdaptors(
+ XF86VideoAdaptorPtr **adaptors
+){
+ *adaptors = GenAdaptors;
+ return NumGenAdaptors;
+}
+
+Bool
+xf86XVScreenInit(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *adaptors,
+ int num
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XF86XVScreenPtr ScreenPriv;
+ XvScreenPtr pxvs;
+
+ if(XF86XVGeneration != serverGeneration) {
+ if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0)
+ return FALSE;
+ XF86XVGeneration = serverGeneration;
+ }
+
+ if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,sizeof(XF86XVWindowRec)))
+ return FALSE;
+
+ if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
+ return FALSE;
+
+ if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+
+ XF86XvScreenIndex = (*XvGetScreenIndexProc)();
+ PortResource = (*XvGetRTPortProc)();
+
+ pxvs = (XvScreenPtr)pScreen->devPrivates[XF86XvScreenIndex].ptr;
+
+
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
+
+ pxvs->ddCloseScreen = xf86XVCloseScreen;
+ pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
+
+ /* The Xv di layer provides us with a private hook so that we don't
+ have to allocate our own screen private. They also provide
+ a CloseScreen hook so that we don't have to wrap it. I'm not
+ sure that I appreciate that. */
+
+ ScreenPriv = xalloc(sizeof(XF86XVScreenRec));
+ pxvs->devPriv.ptr = (pointer)ScreenPriv;
+
+ if(!ScreenPriv) return FALSE;
+
+
+ ScreenPriv->ClipNotify = pScreen->ClipNotify;
+ ScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
+ ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->CreateWindow = pScreen->CreateWindow;
+ ScreenPriv->CopyWindow = pScreen->CopyWindow;
+ ScreenPriv->EnterVT = pScrn->EnterVT;
+ ScreenPriv->LeaveVT = pScrn->LeaveVT;
+
+
+ pScreen->ClipNotify = xf86XVClipNotify;
+ pScreen->UnrealizeWindow = xf86XVUnrealizeWindow;
+ pScreen->WindowExposures = xf86XVWindowExposures;
+ pScreen->CreateWindow = xf86XVCreateWindow;
+ pScreen->CopyWindow = xf86XVCopyWindow;
+ pScrn->EnterVT = xf86XVEnterVT;
+ pScrn->LeaveVT = xf86XVLeaveVT;
+
+ if(!xf86XVInitAdaptors(pScreen, adaptors, num))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+ int i;
+
+ if(pAdaptor->name)
+ xfree(pAdaptor->name);
+
+ if(pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
+ if(pEncode->name) xfree(pEncode->name);
+ }
+ xfree(pAdaptor->pEncodings);
+ }
+
+ if(pAdaptor->pFormats)
+ xfree(pAdaptor->pFormats);
+
+ if(pAdaptor->pPorts) {
+ XvPortPtr pPort = pAdaptor->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv) {
+ if(pPriv->clientClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
+ xfree(pPriv);
+ }
+ }
+ xfree(pAdaptor->pPorts);
+ }
+
+ if(pAdaptor->devPriv.ptr)
+ xfree(pAdaptor->devPriv.ptr);
+}
+
+static Bool
+xf86XVInitAdaptors(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *infoPtr,
+ int number
+) {
+ XvScreenPtr pxvs = (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XF86VideoAdaptorPtr adaptorPtr;
+ XF86VideoEncodingPtr encodingPtr;
+ XF86VideoFormatPtr formatPtr;
+ XF86AttributeListPtr attributePtr;
+ XvAdaptorRecPrivatePtr adaptorPriv;
+ XvPortRecPrivatePtr portPriv;
+ XvAdaptorPtr pAdaptor, pa;
+ int na, numAdaptor;
+ XvEncodingPtr pEncode, pe;
+ int ne, numEncode;
+ XvFormatPtr pFormat, pf;
+ int nf, numFormat, totFormat;
+ XvPortPtr pPort, pp;
+ int np, numPort;
+ XvAttributePtr pAttribute;
+ int nat, numAttribute;
+
+ int numVisuals;
+ VisualPtr pVisual;
+
+ pxvs->nAdaptors = 0;
+ pxvs->pAdaptors = NULL;
+
+ pAdaptor = xcalloc(number, sizeof(XvAdaptorRec));
+ if(!pAdaptor) return FALSE;
+
+ for(pa = pAdaptor, na = 0, numAdaptor = 0;
+ na < number;
+ na++) {
+
+ adaptorPtr = infoPtr[na];
+
+ if(!adaptorPtr->type) continue;
+
+ pa->pScreen = pScreen;
+ pa->type = adaptorPtr->type;
+ pa->ddAllocatePort = xf86XVAllocatePort;
+ pa->ddFreePort = xf86XVFreePort;
+ pa->ddPutVideo = xf86XVPutVideo;
+ pa->ddPutStill = xf86XVPutStill;
+ pa->ddGetVideo = xf86XVGetVideo;
+ pa->ddGetStill = xf86XVGetStill;
+ pa->ddStopVideo = xf86XVStopVideo;
+ pa->ddSetPortAttribute = xf86XVSetPortAttribute;
+ pa->ddGetPortAttribute = xf86XVGetPortAttribute;
+ pa->ddQueryBestSize = xf86XVQueryBestSize;
+ if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
+ strcpy(pa->name, adaptorPtr->name);
+
+ pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec));
+ if(!pEncode) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for(pe = pEncode, ne = 0, numEncode = 0;
+ ne < adaptorPtr->nEncodings;
+ ne++) {
+
+ encodingPtr = &adaptorPtr->pEncodings[ne];
+
+ pe->id = encodingPtr->id;
+ pe->pScreen = pScreen;
+ if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
+ strcpy(pe->name, encodingPtr->name);
+ pe->width = encodingPtr->width;
+ pe->height = encodingPtr->height;
+ pe->rate.numerator = encodingPtr->rate.numerator;
+ pe->rate.denominator = encodingPtr->rate.denominator;
+
+ pe++;
+ numEncode++;
+ }
+ pa->nEncodings = numEncode;
+ pa->pEncodings = pEncode;
+ if(!numEncode) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ totFormat = adaptorPtr->nFormats;
+
+ pFormat = xcalloc(totFormat, sizeof(XvFormatRec));
+ if(!pFormat) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for(pf = pFormat, nf = 0, numFormat = 0;
+ nf < adaptorPtr->nFormats;
+ nf++) {
+
+ formatPtr = &adaptorPtr->pFormats[nf];
+
+ numVisuals = pScreen->numVisuals;
+ pVisual = pScreen->visuals;
+
+ while(numVisuals--) {
+ if((pVisual->class == formatPtr->class) &&
+ (pVisual->nplanes == formatPtr->depth)) {
+
+ if(numFormat >= totFormat) {
+ void *moreSpace;
+ totFormat *= 2;
+ moreSpace = xrealloc(pFormat, totFormat * sizeof(XvFormatRec));
+ if(!moreSpace) break;
+ pFormat = moreSpace;
+ pf = pFormat + numFormat;
+ }
+
+ pf->visual = pVisual->vid;
+ pf->depth = formatPtr->depth;
+
+ pf++;
+ numFormat++;
+ }
+ pVisual++;
+ }
+ }
+ pa->nFormats = numFormat;
+ pa->pFormats = pFormat;
+ if(!numFormat) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+
+ adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate));
+ if(!adaptorPriv) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ adaptorPriv->flags = adaptorPtr->flags;
+ adaptorPriv->PutVideo = adaptorPtr->PutVideo;
+ adaptorPriv->PutStill = adaptorPtr->PutStill;
+ adaptorPriv->GetVideo = adaptorPtr->GetVideo;
+ adaptorPriv->GetStill = adaptorPtr->GetStill;
+ adaptorPriv->StopVideo = adaptorPtr->StopVideo;
+ adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
+ adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
+ adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
+
+ pa->devPriv.ptr = (pointer)adaptorPriv;
+
+ if(pa->type & XvInputMask) {
+ if(!adaptorPtr->PutVideo || !adaptorPtr->PutStill ||
+ !adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ }
+
+ if(pa->type & XvOutputMask) {
+ if(!adaptorPtr->GetVideo || !adaptorPtr->GetStill ||
+ !adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ }
+
+ pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec));
+ if(!pPort) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for(pp = pPort, np = 0, numPort = 0;
+ np < adaptorPtr->nPorts;
+ np++) {
+
+ pp->numAttributes = 0;
+ pp->attributes = NULL;
+ if(adaptorPtr->pAttributes) {
+ if((numAttribute = adaptorPtr->pAttributes[np].number)) {
+ attributePtr = &adaptorPtr->pAttributes[np];
+ pp->attributes = xcalloc(numAttribute, sizeof(XvAttributeRec));
+ if(!pp->attributes) continue;
+
+ pp->numAttributes = numAttribute;
+ for(pAttribute = pp->attributes, nat = 0;
+ nat < numAttribute;
+ nat++, pAttribute++) {
+ pAttribute->flags = attributePtr->flags[nat];
+ pAttribute->name = attributePtr->names[nat];
+ }
+ }
+ }
+
+ if(!(pp->id = FakeClientID(0))) continue;
+ if(!AddResource(pp->id, PortResource, pp)) continue;
+
+ pp->pAdaptor = pa;
+ pp->pNotify = (XvPortNotifyPtr)NULL;
+ pp->pDraw = (DrawablePtr)NULL;
+ pp->client = (ClientPtr)NULL;
+ pp->grab.client = (ClientPtr)NULL;
+ pp->time = currentTime;
+
+
+ portPriv = xcalloc(1, sizeof(XvPortRecPrivate));
+ pp->devPriv.ptr = portPriv;
+ if(!portPriv) continue;
+
+ portPriv->pScrn = pScrn;
+ portPriv->AdaptorRec = adaptorPriv;
+ portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[np].ptr;
+
+ pp++;
+ numPort++;
+ }
+ pa->nPorts = numPort;
+ pa->pPorts = pPort;
+ if(!numPort) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ pa->base_id = pPort->id;
+
+ pa++;
+ numAdaptor++;
+ }
+
+ if(numAdaptor) {
+ pxvs->nAdaptors = numAdaptor;
+ pxvs->pAdaptors = pAdaptor;
+ } else {
+ xfree(pAdaptor);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Video should be clipped to the intersection of the window cliplist
+ and the client cliplist specified in the GC for which the video was
+ initialized. When we need to reclip a window, the GC that started
+ the video may not even be around anymore. That's why we save the
+ client clip from the GC when the video is initialized. We then
+ use xf86XVUpdateCompositeClip to calculate the new composite clip
+ when we need it. This is different from what DEC did. They saved
+ the GC and used it's clip list when they needed to reclip the window,
+ even if the client clip was different from the one the video was
+ initialized with. If the original GC was destroyed, they had to stop
+ the video. I like the new method better (MArk).
+*/
+
+static void
+xf86XVUpdateCompositeClip(
+ DrawablePtr pDraw,
+ XvPortRecPrivatePtr portPriv
+){
+ RegionPtr pregWin, pCompositeClip;
+ WindowPtr pWin = (WindowPtr)pDraw;
+ Bool freeCompClip = FALSE;
+
+ /* get window clip list */
+ if(portPriv->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeCompClip = TRUE;
+ } else
+ pregWin = &pWin->clipList;
+
+ if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip);
+ }
+
+ if(!portPriv->clientClip) {
+ portPriv->pCompositeClip = pregWin;
+ portPriv->FreeCompositeClip = freeCompClip;
+ return;
+ }
+
+
+ pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1);
+ REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip);
+ REGION_TRANSLATE(pWin->pScreen, pCompositeClip,
+ pDraw->x + portPriv->clipOrg.x,
+ pDraw->y + portPriv->clipOrg.y);
+ REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip);
+
+ portPriv->pCompositeClip = pCompositeClip;
+ portPriv->FreeCompositeClip = TRUE;
+
+ if(freeCompClip) {
+ REGION_DESTROY(pWin->pScreen, pregWin);
+ }
+}
+
+/* Save the current clientClip and update the CompositeClip whenever
+ we have a fresh GC */
+
+static void
+xf86XVCopyClip(
+ XvPortRecPrivatePtr portPriv,
+ GCPtr pGC
+){
+ /* free the old clientClip */
+ if(portPriv->clientClip) {
+ REGION_DESTROY(pGC->pScreen, portPriv->clientClip);
+ portPriv->clientClip = NULL;
+ }
+
+ /* copy the new one if it exists */
+ if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+ portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1);
+ /* Note: this is in window coordinates */
+ REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip);
+ }
+
+ /* get rid of the old clip list */
+ if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip);
+ }
+
+ portPriv->clipOrg = pGC->clipOrg;
+ portPriv->pCompositeClip = pGC->pCompositeClip;
+ portPriv->FreeCompositeClip = FALSE;
+}
+
+static int
+xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ RegionRec ScreenRegion;
+ BoxRec WinBox, ScreenBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+ int ret = Success;
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_EXPOSE) {
+ ScreenBox.x1 = 0;
+ ScreenBox.y1 = 0;
+ ScreenBox.x2 = portPriv->pScrn->virtualX;
+ ScreenBox.y2 = portPriv->pScrn->virtualY;
+ REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, &ScreenRegion);
+ } else
+ /* clip to the window composite clip */
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+#if 0
+ /* that's all if it's totally obscured and video already off */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion) && !portPriv->isOn)
+ goto CLIP_VIDEO_BAILOUT;
+#endif
+
+ /* turn off the video if it's on */
+ if(portPriv->isOn) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = FALSE;
+ }
+
+#if 1
+ /* if you wanted VIDEO_NO_CLIPPING hardware to grab the window area
+ if part of it was visible rather than just failing, you could
+ comment out this section. There may be security problems
+ with that though. */
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+#endif
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ portPriv->pDraw->x + portPriv->drw_x,
+ portPriv->pDraw->y + portPriv->drw_y,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+ if(ret == Success) {
+ /* the driver had a chance to lower the curtain,
+ that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion))
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ else
+ portPriv->isOn = TRUE;
+ }
+
+CLIP_VIDEO_BAILOUT:
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+ int ret = Success;
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* turn off the video if it's on */
+ if(portPriv->isOn) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = FALSE;
+ }
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion))
+ goto CLIP_VIDEO_BAILOUT;
+
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ portPriv->pDraw->x + portPriv->drw_x,
+ portPriv->pDraw->y + portPriv->drw_y,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+ if(ret == Success)
+ portPriv->isOn = TRUE;
+
+CLIP_VIDEO_BAILOUT:
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+xf86XVReputAllVideo(WindowPtr pWin, pointer data)
+{
+ XF86XVWindowPtr WinPriv =
+ (XF86XVWindowPtr)pWin->devPrivates[XF86XVWindowIndex].ptr;
+
+ while(WinPriv) {
+ xf86XVUpdateCompositeClip((DrawablePtr)pWin, WinPriv->PortRec);
+ if(WinPriv->PortRec->type == XvInputMask)
+ xf86XVReputVideo(WinPriv->PortRec);
+ else
+ xf86XVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ XF86XVWindowPtr winPriv, PrivRoot;
+
+ winPriv = PrivRoot =
+ (XF86XVWindowPtr)(pWin->devPrivates[XF86XVWindowIndex].ptr);
+
+ /* Enlist our port in the window private */
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) /* we're already listed */
+ break;
+ winPriv = winPriv->next;
+ }
+
+ if(!winPriv) {
+ winPriv = xalloc(sizeof(XF86XVWindowRec));
+ if(!winPriv) return BadAlloc;
+ winPriv->PortRec = portPriv;
+ winPriv->next = PrivRoot;
+ pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
+ }
+ return Success;
+}
+
+
+static void
+xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ XF86XVWindowPtr winPriv, prevPriv = NULL;
+
+ winPriv = (XF86XVWindowPtr)(pWin->devPrivates[XF86XVWindowIndex].ptr);
+
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) {
+ if(prevPriv)
+ prevPriv->next = winPriv->next;
+ else
+ pWin->devPrivates[XF86XVWindowIndex].ptr =
+ (pointer)winPriv->next;
+ xfree(winPriv);
+ break;
+ }
+ prevPriv = winPriv;
+ winPriv = winPriv->next;
+ }
+}
+
+/**** ScreenRec fields ****/
+
+
+static Bool
+xf86XVCreateWindow(WindowPtr pWin)
+{
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pWin->drawable.pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ int ret;
+
+ ret = (*ScreenPriv->CreateWindow)(pWin);
+
+ if(ret) pWin->devPrivates[XF86XVWindowIndex].ptr = NULL;
+
+ return ret;
+}
+
+static void
+xf86XVWindowExposures(
+ WindowPtr pWin,
+ RegionPtr pReg,
+ RegionPtr pOtherReg
+){
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pWin->drawable.pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XF86XVWindowPtr WinPriv =
+ (XF86XVWindowPtr)pWin->devPrivates[XF86XVWindowIndex].ptr;
+
+ (*ScreenPriv->WindowExposures)(pWin, pReg, pOtherReg);
+
+ while(WinPriv) {
+ xf86XVUpdateCompositeClip((DrawablePtr)pWin, WinPriv->PortRec);
+ if(WinPriv->PortRec->type == XvInputMask)
+ xf86XVReputVideo(WinPriv->PortRec);
+ else
+ xf86XVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
+ }
+}
+
+static Bool
+xf86XVUnrealizeWindow(WindowPtr pWin)
+{
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pWin->drawable.pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XF86XVWindowPtr WinPriv =
+ (XF86XVWindowPtr)pWin->devPrivates[XF86XVWindowIndex].ptr;
+ XvPortRecPrivatePtr pPriv;
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if(pPriv->isOn) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = FALSE;
+ }
+ WinPriv = WinPriv->next;
+ }
+
+ return((* ScreenPriv->UnrealizeWindow)(pWin));
+}
+
+static void
+xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pWin->drawable.pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XF86XVWindowPtr WinPriv =
+ (XF86XVWindowPtr)pWin->devPrivates[XF86XVWindowIndex].ptr;
+ XvPortRecPrivatePtr pPriv;
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if(pPriv->isOn) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = FALSE;
+ }
+ WinPriv = WinPriv->next;
+ }
+
+ if(ScreenPriv->ClipNotify)
+ (* ScreenPriv->ClipNotify)(pWin, dx, dy);
+}
+
+static void
+xf86XVCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+){
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pWin->drawable.pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XF86XVWindowPtr WinPriv =
+ (XF86XVWindowPtr)pWin->devPrivates[XF86XVWindowIndex].ptr;
+ XvPortRecPrivatePtr pPriv;
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if(pPriv->isOn) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = FALSE;
+ }
+ WinPriv = WinPriv->next;
+ }
+
+ (*ScreenPriv->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+}
+
+
+/**** Required XvScreenRec fields ****/
+
+static Bool
+xf86XVCloseScreen(int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XvScreenPtr pxvs = (XvScreenPtr) pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XvAdaptorPtr pa;
+ int c;
+
+ if(!ScreenPriv) return TRUE;
+
+ pScreen->CreateWindow = ScreenPriv->CreateWindow;
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+ pScreen->UnrealizeWindow = ScreenPriv->UnrealizeWindow;
+ pScreen->CopyWindow = ScreenPriv->CopyWindow;
+
+ pScrn->EnterVT = ScreenPriv->EnterVT;
+ pScrn->LeaveVT = ScreenPriv->LeaveVT;
+
+ for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ xf86XVFreeAdaptor(pa);
+ }
+
+ if(pxvs->pAdaptors)
+ xfree(pxvs->pAdaptors);
+
+ xfree(ScreenPriv);
+
+
+ return TRUE;
+}
+
+
+static int
+xf86XVQueryAdaptors(
+ ScreenPtr pScreen,
+ XvAdaptorPtr *p_pAdaptors,
+ int *p_nAdaptors
+){
+ XvScreenPtr pxvs = (XvScreenPtr) pScreen->devPrivates[XF86XvScreenIndex].ptr;
+
+ *p_nAdaptors = pxvs->nAdaptors;
+ *p_pAdaptors = pxvs->pAdaptors;
+
+ return (Success);
+}
+
+
+/**** ScrnInfoRec fields ****/
+
+static Bool
+xf86XVEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ Bool ret;
+
+ ret = (*ScreenPriv->EnterVT)(index, flags);
+
+ if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
+
+ return ret;
+}
+
+static void
+xf86XVLeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XvScreenPtr pxvs =
+ (XvScreenPtr) pScreen->devPrivates[XF86XvScreenIndex].ptr;
+ XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr;
+ XvAdaptorPtr pAdaptor;
+ XvPortPtr pPort;
+ XvPortRecPrivatePtr pPriv;
+ int i, j;
+
+ for(i = 0; i < pxvs->nAdaptors; i++) {
+ pAdaptor = &pxvs->pAdaptors[i];
+ for(j = 0; j < pAdaptor->nPorts; j++) {
+ pPort = &pAdaptor->pPorts[j];
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv->isOn) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = FALSE;
+ }
+ }
+ }
+
+ (*ScreenPriv->LeaveVT)(index, flags);
+}
+
+
+/**** XvAdaptorRec fields ****/
+
+static int
+xf86XVAllocatePort(
+ unsigned long port,
+ XvPortPtr pPort,
+ XvPortPtr *ppPort
+){
+ *ppPort = pPort;
+ return Success;
+}
+
+
+
+static int
+xf86XVFreePort(XvPortPtr pPort)
+{
+ return Success;
+}
+
+
+static int
+xf86XVPutVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ int result;
+
+ /* No dumping video to pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ portPriv->pDraw = NULL;
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvInputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ return(xf86XVReputVideo(portPriv));
+}
+
+static int
+xf86XVPutStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ Bool WasOn = FALSE;
+ int ret = Success;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion))
+ goto PUT_STILL_BAILOUT;
+
+ if(portPriv->isOn) {
+ WasOn = TRUE;
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = FALSE;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ goto PUT_STILL_BAILOUT;
+ }
+
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn, vid_x, vid_y,
+ pDraw->x + drw_x, pDraw->y + drw_y,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+PUT_STILL_BAILOUT:
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ /* If this port was in use, reinstate it */
+ if(portPriv->pDraw && WasOn) {
+ if(portPriv->type == XvInputMask)
+ xf86XVReputVideo(portPriv);
+ else
+ xf86XVRegetVideo(portPriv);
+ }
+
+ return ret;
+}
+
+static int
+xf86XVGetVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ int result;
+
+ /* No pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ portPriv->pDraw = NULL;
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvOutputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ return(xf86XVRegetVideo(portPriv));
+}
+
+static int
+xf86XVGetStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ RegionRec ScreenRegion;
+ BoxRec WinBox, ScreenBox;
+ Bool WasOn = FALSE;
+ int ret = Success;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_EXPOSE) {
+ ScreenBox.x1 = 0;
+ ScreenBox.y1 = 0;
+ ScreenBox.x2 = pScreen->width;
+ ScreenBox.y2 = pScreen->height;
+ REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, &ScreenRegion);
+ } else
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion))
+ goto GET_STILL_BAILOUT;
+
+ if(portPriv->isOn) {
+ WasOn = TRUE;
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = FALSE;
+ }
+
+
+#if 1
+ /* if you wanted VIDEO_NO_CLIPPING hardware to grab the window area
+ if part of it was visible rather than just failing, you could
+ comment out this section. There may be security problems
+ with that though. */
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ goto GET_STILL_BAILOUT;
+ }
+#endif
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetStill)(portPriv->pScrn, vid_x, vid_y,
+ pDraw->x + drw_x, pDraw->y + drw_y,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+GET_STILL_BAILOUT:
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ /* If this port was in use, reinstate it */
+ if(portPriv->pDraw && WasOn) {
+ if(portPriv->type == XvInputMask)
+ xf86XVReputVideo(portPriv);
+ else
+ xf86XVRegetVideo(portPriv);
+ }
+
+ return ret;
+}
+
+
+
+static int
+xf86XVStopVideo(
+ ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ if(pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
+
+ portPriv->pDraw = NULL;
+ portPriv->type = 0;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ /* Must free resources. */
+
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, TRUE);
+ portPriv->isOn = FALSE;
+
+ return Success;
+}
+
+static int
+xf86XVSetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn,
+ attribute, value, portPriv->DevPriv.ptr));
+}
+
+
+static int
+xf86XVGetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 *p_value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn,
+ attribute, p_value, portPriv->DevPriv.ptr));
+}
+
+
+
+static int
+xf86XVQueryBestSize(
+ ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 vid_w, CARD16 vid_h,
+ CARD16 drw_w, CARD16 drw_h,
+ unsigned int *p_w, unsigned int *p_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn,
+ (Bool)motion, vid_w, vid_h, drw_w, drw_h,
+ p_w, p_h, portPriv->DevPriv.ptr);
+
+ return Success;
+}
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h
new file mode 100644
index 000000000..9aaa8a8ba
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h
@@ -0,0 +1,149 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.5 1999/05/23 06:33:47 dawes Exp $ */
+
+#ifndef _XVDIX_H_
+#define _XVDIX_H_
+
+#include "xvdix.h"
+#include "xf86str.h"
+
+#define VIDEO_NO_CLIPPING 0x00000001
+#define VIDEO_INVERT_CLIPLIST 0x00000002
+#define VIDEO_EXPOSE 0x00000004
+
+
+typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool exit);
+typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 value, pointer data);
+typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 *value, pointer data);
+typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data);
+
+
+/*** this is what the driver needs to fill out ***/
+
+typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+
+
+typedef struct {
+ char depth;
+ short class;
+} XF86VideoFormatRec, *XF86VideoFormatPtr;
+
+typedef struct {
+ int number;
+ int *flags;
+ char **names;
+} XF86AttributeListRec, *XF86AttributeListPtr;
+
+typedef struct {
+ unsigned char type;
+ int flags;
+ char *name;
+ int nEncodings;
+ XF86VideoEncodingPtr pEncodings;
+ int nFormats;
+ XF86VideoFormatPtr pFormats;
+ int nPorts;
+ XF86AttributeListPtr pAttributes;
+ DevUnion *pPortPrivates;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
+
+
+Bool
+xf86XVScreenInit(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *Adaptors,
+ int num
+);
+
+int
+xf86XVRegisterGenericAdaptor(
+ XF86VideoAdaptorPtr *Adaptors,
+ int num
+);
+
+int
+xf86XVListGenericAdaptors(
+ XF86VideoAdaptorPtr **Adaptors
+);
+
+
+/*** These are DDX layer privates ***/
+
+
+typedef struct {
+ CreateWindowProcPtr CreateWindow;
+ ClipNotifyProcPtr ClipNotify;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+} XF86XVScreenRec, *XF86XVScreenPtr;
+
+typedef struct {
+ int flags;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ DrawablePtr pDraw;
+ unsigned char type;
+ unsigned int subWindowMode;
+ DDXPointRec clipOrg;
+ RegionPtr clientClip;
+ RegionPtr pCompositeClip;
+ Bool FreeCompositeClip;
+ XvAdaptorRecPrivatePtr AdaptorRec;
+ Bool isOn;
+ int vid_x, vid_y, vid_w, vid_h;
+ int drw_x, drw_y, drw_w, drw_h;
+ DevUnion DevPriv;
+} XvPortRecPrivate, *XvPortRecPrivatePtr;
+
+typedef struct _XF86XVWindowRec{
+ XvPortRecPrivatePtr PortRec;
+ struct _XF86XVWindowRec *next;
+} XF86XVWindowRec, *XF86XVWindowPtr;
+
+#endif /* _XVDIX_H_ */
+
diff --git a/xc/programs/Xserver/hw/xfree86/common/xisb.c b/xc/programs/Xserver/hw/xfree86/common/xisb.c
new file mode 100644
index 000000000..7c5711aa6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xisb.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xisb.c,v 1.4 1999/03/06 13:12:32 dawes Exp $ */
+
+/*
+ X Input Serial Buffer routines for use in any XInput driver that accesses
+ a serial device.
+*/
+
+
+/*****************************************************************************
+ * Standard Headers
+ ****************************************************************************/
+
+#include <misc.h>
+#include <xf86.h>
+#include <xf86Version.h>
+#include <xf86_OSproc.h>
+#include <xf86_OSlib.h>
+#include <xf86Xinput.h>
+#include "xisb.h"
+
+/*****************************************************************************
+ * Local Headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Variables without includable headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Local Variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Function Definitions
+ ****************************************************************************/
+
+XISBuffer *
+XisbNew (int fd, xf86ssize_t size)
+{
+ XISBuffer *b;
+
+ b = xalloc (sizeof (XISBuffer));
+ if (!b)
+ return (NULL);
+ b->buf = xalloc ((sizeof (unsigned char) * size));
+ if (!b->buf)
+ {
+ xfree (b);
+ return (NULL);
+ }
+
+ b->fd = fd;
+ b->trace = 0;
+ b->block_duration = 0;
+ b->current = 1; /* force it to be past the end to trigger initial read */
+ b->end = 0;
+ b->buffer_size = size;
+ return (b);
+}
+
+void
+XisbFree (XISBuffer *b)
+{
+ xfree (b->buf);
+ xfree (b);
+}
+
+int
+XisbRead (XISBuffer *b)
+{
+ int ret;
+
+ if (b->current >= b->end)
+ {
+ if (b->block_duration >= 0)
+ {
+ if (xf86WaitForInput (b->fd, b->block_duration) < 1)
+ return (-1);
+ }
+ else
+ {
+ /*
+ * automatically clear it so if XisbRead is called in a loop
+ * the next call will make sure there is data with select and
+ * thus prevent a blocking read
+ */
+ b->block_duration = 0;
+ }
+
+ ret = xf86ReadSerial (b->fd, b->buf, b->buffer_size);
+ switch (ret)
+ {
+ case 0:
+ return (-1); /* timeout */
+ case -1:
+ return (-2); /* error */
+ default:
+ b->end = ret;
+ b->current = 0;
+ break;
+ }
+ }
+ if (b->trace)
+ ErrorF ("read 0x%02x (%c)\n", b->buf[b->current], b->buf[b->current]);
+
+ return (b->buf[b->current++]);
+}
+
+/* the only purpose of this function is to provide output tracing */
+xf86ssize_t
+XisbWrite (XISBuffer *b, unsigned char *msg, xf86ssize_t len)
+{
+ if (b->trace)
+ {
+ int i = 0;
+ for (i = 0; i < len; i++)
+ ErrorF ("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]);
+ }
+ return (xf86WriteSerial (b->fd, msg, len));
+}
+
+/* turn tracing of this buffer on (1) or off (0) */
+void
+XisbTrace (XISBuffer *b, int trace)
+{
+ b->trace = trace;
+}
+
+/*
+ * specify a block_duration of -1 when you know the buffer's fd is ready to
+ * read. After a read, it is automatically set to 0 so that the next read
+ * will use check to select for data and prevent a block.
+ * It is the caller's responsibility to set the block_duration to -1 if it
+ * knows that there is data to read (because the main select loop triggered
+ * the read) and want's to avoid the unnecessary overhead of the select call
+ *
+ * a zero or positive block duration will cause the select to block for the
+ * give duration in usecs.
+ */
+
+void
+XisbBlockDuration (XISBuffer *b, int block_duration)
+{
+ b->block_duration = block_duration;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xisb.h b/xc/programs/Xserver/hw/xfree86/common/xisb.h
new file mode 100644
index 000000000..7b5e26a23
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/common/xisb.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xisb.h,v 1.1 1998/12/05 14:40:10 dawes Exp $ */
+
+#ifndef _xisb_H_
+#define _xisb_H_
+
+/******************************************************************************
+ * Definitions
+ * structs, typedefs, #defines, enums
+ *****************************************************************************/
+
+typedef struct _XISBuffer
+{
+ int fd;
+ int trace;
+ int block_duration;
+ xf86ssize_t current; /* bytes read */
+ xf86ssize_t end;
+ xf86ssize_t buffer_size;
+ unsigned char *buf;
+} XISBuffer;
+
+/******************************************************************************
+ * Declarations
+ * variables: use xisb_LOC in front
+ * of globals.
+ * put locals in the .c file.
+ *****************************************************************************/
+XISBuffer * XisbNew (int fd, xf86ssize_t size);
+void XisbFree (XISBuffer *b);
+int XisbRead (XISBuffer *b);
+xf86ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, xf86ssize_t len);
+void XisbTrace (XISBuffer *b, int trace);
+void XisbBlockDuration (XISBuffer *b, int block_duration);
+
+/*
+ * DO NOT PUT ANYTHING AFTER THIS ENDIF
+ */
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO b/xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO
new file mode 100644
index 000000000..432ab9643
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO
@@ -0,0 +1,97 @@
+ DDC.HOWTO
+
+ This file describes how to add DDC support to a chipset driver.
+
+1) DDC INITIALIZATION
+
+ When implementing DDC in the driver one has the choice between
+ DDC1 and DDC2.
+ DDC1 data is contiuously transmitted by a DDC1 capable display
+ device. The data is send serially over a data line; the Vsync
+ signal serves as clock. Only one EDID 1.x data block can be
+ transmitted using DDC1. Since transmission of an EDID1 block
+ using a regular Vsync frequency would take up several seconds
+ the driver can increase the Vsync frequency to up to 25 kHz as
+ soon as it detects DDC1 activety on the data line.
+ DDC2 data is transmitted using the I2C protocol. This requires
+ an additional clock line. DDC2 is capable of transmitting EDID1
+ and EDID2 block as well as a VDIF block on display devices that
+ support these.
+ Display devices switch into the DDC2 mode as soon as they detect
+ activety on the DDC clock line. Once the are in DDC2 mode they
+ stop transmitting DDC1 signals until the next power cycle.
+
+ Some graphics chipset configurations which are not capable of
+ DDC2 might still be able to read DDC1 data. Where available
+ DDC2 it is preferrable.
+
+ All relevant prototypes and defines are in xf86DDC.h.
+ DDC2 additionally requires I2C support. The I2C prototypes
+ are in xf86i2c.h.
+
+ DDC1 Support:
+
+ The driver has to provide a read function which waits for the
+ end of the next Vsync signal and reads in and returns the status
+ of the DDC line:
+
+ unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
+
+ Additionally a function is required to inclrease the Vsync
+ frequency to max. 25 kHz.
+
+ void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
+
+ If the speed argument is DDC_FAST the function should increase
+ the Vsync frequency on DDC_SLOW it should restore the original
+ value. For convenience a generic ddc1SetSpeed() function is provided
+ in the vga module for VGA-like chipsets.
+
+ void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed).
+
+ To read out the DDC1 data the driver should call
+
+ xf86MonPtr xf86DoEDID_DDC1(int scrnIndex,
+ void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
+ unsigned int (*DDC1Read)(ScrnInfoPtr))
+
+ in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
+ function, DDC1Read has to point to the DDC1 read function.
+ The function will return a pointer to the xf86Monitor structure
+ which contains all information retreived by DDC.
+ NULL will be returned on failure.
+
+ DDC2 Support
+
+ To read out DDC2 information I2C has to be initialized first.
+ (See documentation for the i2c module).
+ The function
+
+ xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+
+ is provided to read out and process DDC2 data. A pointer
+ to the I2CBusRec of the appropriate I2C Bus has to be passed
+ as the second argument.
+ The function will return a pointer to the xf86Monitor structure
+ which contains all information retreived by DDC.
+ NULL will be returned on failure.
+
+ Printing monitor parameters
+
+ To print out the information contained in the xf86Monitor
+ structure the function
+
+ void xf86PrintEDID(xf86MonPtr monitor)
+
+ is provided.
+
+ Further processing of the xf86Monitor structure is not yet
+ implemented. Howerver it is planned to use the information
+ about video modes, gamma values etc.
+ Therefore it is strongly recommended to read out DDC data
+ before any video mode processing is done.
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/Imakefile b/xc/programs/Xserver/hw/xfree86/ddc/Imakefile
new file mode 100644
index 000000000..6e8a02d4f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/Imakefile
@@ -0,0 +1,28 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/ddc/Imakefile,v 1.5 1999/08/14 10:49:35 dawes Exp $
+
+#define IHaveModules
+#include <Server.tmpl>
+
+SRCS = xf86DDC.c edid.c interpret_edid.c print_edid.c \
+ interpret_vdif.c print_vdif.c
+OBJS = xf86DDC.o edid.o interpret_edid.o print_edid.o \
+ interpret_vdif.o print_vdif.o
+
+INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(XF86SRC)/i2c
+
+ModuleObjectRule()
+
+LibraryModuleTarget(ddc, $(OBJS))
+
+InstallLibraryModule(ddc,$(MODULEDIR),.)
+
+DependTarget()
+
+
+InstallDriverSDKLibraryModule(ddc,$(DRIVERSDKMODULEDIR),.)
+
+InstallDriverSDKNonExecFile(edid.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(vdif.h,$(DRIVERSDKINCLUDEDIR))
+InstallDriverSDKNonExecFile(xf86DDC.h,$(DRIVERSDKINCLUDEDIR))
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/edid.c b/xc/programs/Xserver/hw/xfree86/ddc/edid.c
new file mode 100644
index 000000000..6b2a909e1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/edid.c
@@ -0,0 +1,127 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.c,v 1.2 1999/01/14 13:04:14 dawes Exp $ */
+
+/* edid.c: retrieve EDID record from raw DDC1 data stream: data
+ * is contained in an array of unsigned int each unsigned int
+ * contains one bit if bit is 0 unsigned int has to be zero else
+ * unsigned int > 0
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+
+int checksum(unsigned char *, int);
+static int find_start(unsigned int *);
+static unsigned char * find_header(unsigned char *);
+static unsigned char * resort(unsigned char *);
+
+unsigned char *
+GetEDID_DDC1(unsigned int *s_ptr)
+{
+ unsigned char *d_block, *d_pos;
+ unsigned int *s_pos, *s_end;
+ int s_start;
+ int i,j;
+ s_start = find_start(s_ptr);
+ if (s_start==-1) return NULL;
+ s_end = s_ptr + NUM;
+ s_pos = s_ptr + s_start;
+ d_block=xalloc(EDID1_LEN);
+ if (!d_block) return NULL;
+ d_pos = d_block;
+ for (i=0;i<EDID1_LEN;i++) {
+ for (j=0;j<8;j++) {
+ *d_pos <<= 1;
+ if (*s_pos) {
+ *d_pos |= 0x01;
+ }
+ s_pos++; if (s_pos == s_end) s_pos=s_ptr;
+ };
+ s_pos++; if (s_pos == s_end) s_pos=s_ptr;
+ d_pos++;
+ }
+ xfree(s_ptr);
+ if (d_block && checksum(d_block,EDID1_LEN)) return NULL;
+ return (resort(d_block));
+}
+
+int
+checksum(unsigned char *block, int len)
+{
+ int i, result = 0;
+ for (i=0;i<len;i++)
+ result += block[i];
+#ifdef DEBUG
+ if (result & 0xFF) ErrorF("DDC checksum not correct\n");
+#endif
+ return (result&0xFF);
+}
+
+static int
+find_start(unsigned int *ptr)
+{
+ unsigned int comp[9], test[9];
+ int i,j;
+
+ for (i=0;i<9;i++){
+ comp[i] = *(ptr++);
+ test[i] = 1;
+ }
+ for (i=0;i<127;i++){
+ for (j=0;j<9;j++){
+ test[j] = test[j] & !(comp[j] ^ *(ptr++));
+ }
+ }
+ for (i=0;i<9;i++)
+ if (test[i]) return (i+1);
+ return (-1);
+}
+
+static unsigned char *
+find_header(unsigned char *block)
+{
+ unsigned char *ptr, *head_ptr, *end;
+ unsigned char header[]={0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
+
+ ptr = block;
+ end = block + EDID1_LEN;
+ while (ptr<end) {
+ int i;
+ head_ptr = ptr;
+ for (i=0;i<8;i++){
+ if (header[i] != *(head_ptr++)) break;
+ if (head_ptr == end) head_ptr = block;
+ }
+ if (i==8) break;
+ ptr++;
+ }
+ if (ptr == end) return (NULL);
+ return (ptr);
+}
+
+static unsigned char *
+resort(unsigned char *s_block)
+{
+ unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
+ unsigned char tmp;
+
+ s_end = s_block + EDID1_LEN;
+ d_new = xalloc(EDID1_LEN);
+ if (!d_new) return NULL;
+ d_end = d_new + EDID1_LEN;
+
+ s_ptr = find_header(s_block);
+ if (!s_ptr) return NULL;
+ for (d_ptr=d_new;d_ptr<d_end;d_ptr++){
+ tmp = *(s_ptr++);
+ *d_ptr = tmp;
+ if (s_ptr == s_end) s_ptr = s_block;
+ }
+ xfree(s_block);
+ return (d_new);
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/edid.h b/xc/programs/Xserver/hw/xfree86/ddc/edid.h
new file mode 100644
index 000000000..2de607195
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/edid.h
@@ -0,0 +1,417 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.h,v 1.3 1999/01/31 14:07:11 dawes Exp $ */
+
+/* edid.h: defines to parse an EDID block
+ *
+ * This file contains all information to interpret a standard EDIC block
+ * transmitted by a display device via DDC (Display Data Channel). So far
+ * there is no information to deal with optional EDID blocks.
+ * DDC is a Trademark of VESA (Video Electronics Standard Association).
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#include "vdif.h"
+
+/* read complete EDID record */
+#define EDID1_LEN 128
+#define BITS_PER_BYTE 9
+#define NUM BITS_PER_BYTE*EDID1_LEN
+#define HEADER 6
+
+#define STD_TIMINGS 8
+#define DET_TIMINGS 4
+
+#ifdef _PARSE_EDID_
+
+/* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
+#define HEADER_SECTION 0
+#define HEADER_LENGTH 8
+
+/* vendor section */
+#define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH)
+#define V_MANUFACTURER 0
+#define V_PROD_ID (V_MANUFACTURER + 2)
+#define V_SERIAL (V_PROD_ID + 2)
+#define V_WEEK (V_SERIAL + 4)
+#define V_YEAR (V_WEEK + 1)
+#define VENDOR_LENGTH (V_YEAR + 1)
+
+/* EDID version */
+#define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH)
+#define V_VERSION 0
+#define V_REVISION (V_VERSION + 1)
+#define VERSION_LENGTH (V_REVISION + 1)
+
+/* display information */
+#define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH)
+#define D_INPUT 0
+#define D_HSIZE (D_INPUT + 1)
+#define D_VSIZE (D_HSIZE + 1)
+#define D_GAMMA (D_VSIZE + 1)
+#define FEAT_S (D_GAMMA + 1)
+#define D_RG_LOW (FEAT_S + 1)
+#define D_BW_LOW (D_RG_LOW + 1)
+#define D_REDX (D_BW_LOW + 1)
+#define D_REDY (D_REDX + 1)
+#define D_GREENX (D_REDY + 1)
+#define D_GREENY (D_GREENX + 1)
+#define D_BLUEX (D_GREENY + 1)
+#define D_BLUEY (D_BLUEX + 1)
+#define D_WHITEX (D_BLUEY + 1)
+#define D_WHITEY (D_WHITEX + 1)
+#define DISPLAY_LENGTH (D_WHITEY + 1)
+
+/* supported VESA and other standard timings */
+#define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH)
+#define E_T1 0
+#define E_T2 (E_T1 + 1)
+#define E_TMANU (E_T2 + 1)
+#define E_TIMING_LENGTH (E_TMANU + 1)
+
+/* non predefined standard timings supported by display */
+#define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
+#define STD_TIMING_INFO_LEN 2
+#define STD_TIMING_INFO_NUM STD_TIMINGS
+#define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM)
+
+/* detailed timing info of non standard timings */
+#define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH)
+#define DET_TIMING_INFO_LEN 18
+#define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
+#define DET_TIMING_INFO_NUM DET_TIMINGS
+#define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM)
+
+/* number of EDID sections to follow */
+#define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
+/* one byte checksum */
+#define CHECKSUM (NO_EDID + 1)
+
+#if (CHECKSUM != (EDID1_LEN - 1))
+# error "EDID1 length != 128!"
+#endif
+
+
+#define SECTION(x,y) (Uchar *)(x + y)
+#define GET_ARRAY(y) ((Uchar *)(c + y))
+#define GET(y) *(Uchar *)(c + y)
+
+/* extract information from vendor section */
+#define _PROD_ID(x) x[0] + (x[1] << 8);
+#define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
+#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
+#define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
+#define _YEAR(x) (x & 0xFF) + 1990
+#define YEAR _YEAR(GET(V_YEAR))
+#define WEEK GET(V_WEEK) & 0xFF
+#define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
+#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
+#define _L3(x) (x[1] & 0x1F) + '@';
+#define L1 _L1(GET_ARRAY(V_MANUFACTURER))
+#define L2 _L2(GET_ARRAY(V_MANUFACTURER))
+#define L3 _L3(GET_ARRAY(V_MANUFACTURER))
+
+/* extract information from version section */
+#define VERSION GET(V_VERSION)
+#define REVISION GET(V_REVISION)
+
+/* extract information from display section */
+#define _INPUT_TYPE(x) ((x & 0x80) >> 7)
+#define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
+#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
+#define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
+#define _SETUP(x) ((x & 0x10) >> 4)
+#define SETUP _SETUP(GET(D_INPUT))
+#define _SYNC(x) (x & 0x0F)
+#define SYNC _SYNC(GET(D_INPUT))
+#define _GAMMA(x) ((x + 100.0)/100.0)
+#define GAMMA _GAMMA(GET(D_GAMMA))
+#define HSIZE_MAX GET(D_HSIZE)
+#define VSIZE_MAX GET(D_VSIZE)
+#define _DPMS(x) ((x & 0xE0) >> 5)
+#define DPMS _DPMS(GET(FEAT_S))
+#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
+#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
+#define _MSC(x) (x & 0x7)
+#define MSC _MSC(GET(FEAT_S))
+
+
+/* color characteristics */
+#define CC_L(x,y) ((x & (0x03 << y)) >> y)
+#define CC_H(x) (x << 2)
+#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
+#define F_CC(x) ((x)/1024.0)
+#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
+#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
+#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
+#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
+#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
+#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
+#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
+#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
+
+/* extract information from standard timing section */
+#define T1 GET(E_T1)
+#define T2 GET(E_T2)
+#define T_MANU GET(E_TMANU)
+
+/* extract information from estabished timing section */
+#define _HSIZE1(x) ((x[0] + 31) * 8)
+#define HSIZE1 _HSIZE1(c)
+#define RATIO(x) ((x[1] & 0xC0) >> 6)
+#define RATIO1_1 0
+#define RATIO4_3 1
+#define RATIO5_4 2
+#define RATIO16_9 3
+#define _VSIZE1(x,y) switch(RATIO(x)){ \
+ case RATIO1_1: y = _HSIZE1(x); break; \
+ case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
+ case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
+ case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
+ }
+#define VSIZE1(x) _VSIZE1(c,x)
+#define _REFRESH_R(x) (x[1] & 0x3F) + 60
+#define REFRESH_R _REFRESH_R(c)
+#define _ID_LOW(x) x[0]
+#define ID_LOW _ID_LOW(c)
+#define _ID_HIGH(x) (x[1] << 8)
+#define ID_HIGH _ID_HIGH(c)
+#define STD_TIMING_ID (ID_LOW | ID_HIGH)
+#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
+#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
+
+
+/* EDID Ver. > 1.2 */
+#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0 && x[2] == 0 && x[4] == 0)
+#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
+#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
+#define PIXEL_CLOCK _PIXEL_CLOCK(c)
+#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
+#define H_ACTIVE _H_ACTIVE(c)
+#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
+#define H_BLANK _H_BLANK(c)
+#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
+#define V_ACTIVE _V_ACTIVE(c)
+#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
+#define V_BLANK _V_BLANK(c)
+#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
+#define H_SYNC_OFF _H_SYNC_OFF(c)
+#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
+#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
+#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
+#define V_SYNC_OFF _V_SYNC_OFF(c)
+#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
+#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
+#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
+#define H_SIZE _H_SIZE(c)
+#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
+#define V_SIZE _V_SIZE(c)
+#define _H_BORDER(x) (x[15])
+#define H_BORDER _H_BORDER(c)
+#define _V_BORDER(x) (x[16])
+#define V_BORDER _V_BORDER(c)
+#define _INTERLACED(x) ((x[17] & 0x80) >> 7)
+#define INTERLACED _INTERLACED(c)
+#define _STEREO(x) ((x[17] & 0x60) >> 6)
+#define STEREO _STEREO(c)
+#define _SYNC_T(x) ((x[17] & 0x18) >> 4)
+#define SYNC_T _SYNC_T(c)
+#define _MISC(x) ((x[17] & 0x06) >> 2)
+#define MISC _MISC(c)
+
+#define _MONITOR_DESC_TYPE(x) x[3]
+#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
+#define SERIAL_NUMBER 0xFF
+#define ASCII_STR 0xFE
+#define MONITOR_RANGES 0xFD
+#define _MIN_V(x) x[5]
+#define MIN_V _MIN_V(c)
+#define _MAX_V(x) x[6]
+#define MAX_V _MAX_V(c)
+#define _MIN_H(x) x[7]
+#define MIN_H _MIN_H(c)
+#define _MAX_H(x) x[8]
+#define MAX_H _MAX_H(c)
+#define _MAX_CLOCK(x) x[9]
+#define MAX_CLOCK _MAX_CLOCK(c)
+#define MONITOR_NAME 0xFC
+#define ADD_COLOR_POINT 0xFB
+#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
+#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
+#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
+#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
+#define _WHITE_INDEX1(x) x[5]
+#define WHITE_INDEX1 _WHITE_INDEX1(c)
+#define _WHITE_INDEX2(x) x[10]
+#define WHITE_INDEX2 _WHITE_INDEX2(c)
+#define WHITEX1 _WHITEX_ADD(c,6)
+#define WHITEY1 _WHITEY_ADD(c,6)
+#define WHITEX2 _WHITEX_ADD(c,12)
+#define WHITEY2 _WHITEY_ADD(c,12)
+#define _WHITE_GAMMA1(x) _GAMMA(x[9])
+#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
+#define _WHITE_GAMMA2(x) _GAMMA(x[14])
+#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
+#define ADD_STD_TIMINGS 0xFA
+
+#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
+#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
+
+#endif /* _PARSE_EDID_ */
+
+/* input type */
+#define DIGITAL(x) x
+
+/* input voltage level */
+#define V070 0 /* 0.700V/0.300V */
+#define V071 1 /* 0.714V/0.286V */
+#define V100 2 /* 1.000V/0.400V */
+#define V007 3 /* 0.700V/0.000V */
+
+/* Signal level setup */
+#define SIG_SETUP(x) (x)
+
+/* sync characteristics */
+#define SEP_SYNC(x) (x & 0x08)
+#define COMP_SYNC(x) (x & 0x04)
+#define SYNC_O_GREEN(x) (x & 0x02)
+#define SYNC_SERR(x) (x & 0x01)
+
+/* DPMS features */
+#define DPMS_STANDBY(x) (x & 0x04)
+#define DPMS_SUSPEND(x) (x & 0x02)
+#define DPMS_OFF(x) (x & 0x01)
+
+/* display type */
+#define DISP_MONO 0
+#define DISP_RGB 1
+#define DISP_MULTCOLOR 2
+
+/* Msc stuff EDID Ver > 1.1 */
+#define STD_COLOR_SPACE(x) (x & 0x4)
+#define PREFERRED_TIMING_MODE(x) (x & 0x2)
+#define GFT_SUPPORTED(x) (x & 0x1)
+
+/* detailed timing misc */
+#define IS_INTERLACED(x) (x)
+#define IS_STEREO(x) (x)
+#define IS_RIGHT_ON_SYNC(x) (x & 0x01)
+#define IS_LEFT_ON_SYNC(x) (x & 0x02)
+
+typedef unsigned int Uint;
+typedef unsigned char Uchar;
+
+struct vendor {
+ char name[4];
+ int prod_id;
+ Uint serial;
+ int week;
+ int year;
+};
+
+struct edid_version {
+ int version;
+ int revision;
+};
+
+struct disp_features {
+ unsigned int input_type:1;
+ unsigned int input_voltage:2;
+ unsigned int input_setup:1;
+ unsigned int input_sync:5;
+ int hsize;
+ int vsize;
+ float gamma;
+ unsigned int dpms:3;
+ unsigned int display_type:2;
+ unsigned int msc:3;
+ float redx;
+ float redy;
+ float greenx;
+ float greeny;
+ float bluex;
+ float bluey;
+ float whitex;
+ float whitey;
+};
+
+struct established_timings {
+ Uchar t1;
+ Uchar t2;
+ Uchar t_manu;
+};
+
+struct std_timings {
+ int hsize;
+ int vsize;
+ int refresh;
+ CARD16 id;
+};
+
+struct detailed_timings {
+ int clock;
+ int h_active;
+ int h_blanking;
+ int v_active;
+ int v_blanking;
+ int h_sync_off;
+ int h_sync_width;
+ int v_sync_off;
+ int v_sync_width;
+ int h_size;
+ int v_size;
+ int h_border;
+ int v_border;
+ unsigned int interlaced:1;
+ unsigned int stereo:2;
+ unsigned int sync:2;
+ unsigned int misc:2;
+};
+
+#define DT 0
+#define DS_SERIAL 0xFF
+#define DS_ASCII_STR 0xFE
+#define DS_NAME 0xFC
+#define DS_RANGES 0xFD
+#define DS_WHITE_P 0xFB
+#define DS_STD_TIMINGS 0xFA
+
+struct monitor_ranges {
+ int min_v;
+ int max_v;
+ int min_h;
+ int max_h;
+ int max_clock;
+};
+
+struct whitePoints{
+ int index;
+ float white_x;
+ float white_y;
+ float white_gamma;
+};
+
+struct detailed_monitor_section {
+ int type;
+ union {
+ struct detailed_timings d_timings;
+ Uchar serial[13];
+ Uchar ascii_data[13];
+ Uchar name[13];
+ struct monitor_ranges ranges;
+ struct std_timings std_t[5];
+ struct whitePoints wp[2];
+ } section;
+};
+
+typedef struct {
+ struct vendor vendor;
+ struct edid_version ver;
+ struct disp_features features;
+ struct established_timings timings1;
+ struct std_timings timings2[8];
+ struct detailed_monitor_section det_mon[4];
+ xf86vdifPtr vdif;
+ int no_sections;
+} xf86Monitor, *xf86MonPtr;
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/edid2.h b/xc/programs/Xserver/hw/xfree86/ddc/edid2.h
new file mode 100644
index 000000000..8ca85c2f2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/edid2.h
@@ -0,0 +1,59 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid2.h,v 1.2 1999/08/21 13:48:26 dawes Exp $ */
+
+#ifdef _PARSE_EDID_
+
+#define EDID2_len 256
+
+#define VERSION_SECTION 0
+#define VERSION_LEN 1
+#define VENDOR_SECTION (VERSION_SECTION + VERSION_LEN)
+#define V_MANUFACURER VENDOR_SECTION
+#define V_PROD_ID (V_MANUFACURER + 2)
+#define V_WEEK (V_PROD_ID + 2)
+#define V_YEAR (V_WEEK + 1)
+#define VENDOR_LEN 7
+#define MANUFACTURER_SECTION (VENDOR_SECTION + VENDOR_LEN)
+#define MANUFACTURER_LEN 32
+#define SERIAL_NO_SECTION (MANUFACTURER_SECTION + MANUFACTURER_LEN)
+#define SERIAL_NO_LEN 16
+#define UNUSED (SERIAL_NO_SECTION + SERIAL_NO_LEN)
+#define UNUSED_LEN 8
+#define DISPLAY_INTERFACE (UNUSED + UNUSED_LEN)
+#define PHYS_INTERFACE DISPLAY_INTERFACE
+#define VIDEO_INTERFACE (PHYS_INTERFACE + 1)
+#define INTERFACE_DATA_FORMAT (VIDEO_INTERFACE + 1)
+#define INTERFACE_COLOR_ENCODING (INTERFACE_DATA_FORMAT + 8)
+#define DISPLAY_INTERFACE_LEN 15
+#define DISPLAY_DEVICE (DISPLAY_INTERFACE + DISPLAY_INTERFACE_LEN)
+#define DISPLAY_TECHNOLOGY DISPLAY_DEVICE
+#define DISPLAY_CHARACTER (DISPLAY_TECHNOLOGY + 1)
+#define FEATURE_SUPPORT (DISPLAY_CHARACTER + 1)
+#define DISPLAY_DEVICE_LEN 5
+#define DISPLAY_RESPONSE_TIME (DISPLAY_INTERFACE + DISPLAY_INTERFACE_LEN)
+#define DISPLAY_RESPONSE_TIME_LEN 2
+#define COLOR_DESCRIPTION (DISPLAY_RESPONSE_TIME + DISPLAY_RESONSE_TIME_LEN)
+#define GAMMA COLOR_DESCRIPTION
+#define MAX_LUM (GAMMA + 4)
+#define WHITE_POINT (MAX_LUM + 4)
+#define COLOR_DESCRIPTION_LEN 28
+#define DISPLAY_DIMENSION (COLOR_DESCRIPTION + COLOR_DESCRIPTION_LEN)
+#define DISPLAY_SIZE DISPLAY_DIMENSION
+#define DISPLAY_ADDRESSABILITY (DISPLAY_SIZE + 4)
+#define DISPLAY_PITCH (DISPLAY_ADDRESSABILITY + 4)
+#define DISPLAY_DIMENION_LEN 10
+#define UNUSED1 (DISPLAY_DIMENSION + DISPLAY_DIMENSION_LEN)
+#define UNUSED1_LEN
+#define GFT_SUPPORT (UNUSED1 + UNUSED1_LEN)
+#define GFT_SUPPORT_LEN
+#define TIMING_INFO_MAP (GFT_SUPPORT + GFT_SUPPORT_LEN)
+#define TIMING_INFO_LEN 2
+#define LUM_TAB_TIMING (TIMING_INFO_MAP + TIMING_INFO_LEN)
+#define LUM_TAB_TIMING_LEN 127
+#define CHECKSUM (LUM_TAB_TIMING + LUM_TAB_TIMING_LEN)
+
+
+#define GET(y) *(CARD8 *)(y)
+/* Version / Revision */
+#define VERSION (GET(VERSION_SECTION) >> 4)
+#define REVISION (GET(VERSION_SECTION) & 0xf)
+/* Vendor / Product ID */
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c b/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c
new file mode 100644
index 000000000..4d161bbb8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c
@@ -0,0 +1,223 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c,v 1.3 1999/01/31 14:07:12 dawes Exp $ */
+
+/* interpret_edid.c: interpret a primary EDID block
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#define _PARSE_EDID_
+#include "xf86DDC.h"
+
+static void get_vendor_section(Uchar*, struct vendor *);
+static void get_version_section(Uchar*, struct edid_version *);
+static void get_display_section(Uchar*, struct disp_features *);
+static void get_established_timing_section(Uchar*, struct established_timings *);
+static void get_std_timing_section(Uchar*, struct std_timings *);
+static void get_dt_md_section(Uchar *, struct edid_version *,
+ struct detailed_monitor_section *det_mon);
+static void copy_string(Uchar *, Uchar *);
+static void get_dst_timing_section(Uchar *, struct std_timings *);
+static void get_monitor_ranges(Uchar *, struct monitor_ranges *);
+static void get_whitepoint_section(Uchar *, struct whitePoints *);
+static void get_detailed_timing_section(Uchar*, struct detailed_timings *);
+
+xf86MonPtr
+InterpretEDID(Uchar *block)
+{
+ xf86MonPtr m;
+
+ if (!block) return NULL;
+ if (! (m = xnfcalloc(sizeof(xf86Monitor),1))) return NULL;
+ get_vendor_section(SECTION(VENDOR_SECTION,block),&m->vendor);
+ get_version_section(SECTION(VERSION_SECTION,block),&m->ver);
+ get_display_section(SECTION(DISPLAY_SECTION,block),&m->features);
+ get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION,block),
+ &m->timings1);
+ get_std_timing_section(SECTION(STD_TIMING_SECTION,block),m->timings2);
+ get_dt_md_section(SECTION(DET_TIMING_SECTION,block),&m->ver, m->det_mon);
+ m->no_sections = (int)*(char *)SECTION(NO_EDID,block);
+ return (m);
+}
+
+static void
+get_vendor_section(Uchar *c, struct vendor *r)
+{
+ r->name[0] = L1;
+ r->name[1] = L2;
+ r->name[2] = L3;
+ r->name[3] = '\0';
+
+ r->prod_id = PROD_ID;
+ r->serial = SERIAL_NO;
+ r->week = WEEK;
+ r->year = YEAR;
+}
+
+static void
+get_version_section(Uchar *c, struct edid_version *r)
+{
+ r->version = VERSION;
+ r->revision = REVISION;
+}
+
+static void
+get_display_section(Uchar *c, struct disp_features *r)
+{
+ r->input_type = INPUT_TYPE;
+ r->input_voltage = INPUT_VOLTAGE;
+ r->input_setup = SETUP;
+ r->input_sync = SYNC;
+ r->hsize = HSIZE_MAX;
+ r->vsize = VSIZE_MAX;
+ r->gamma = GAMMA;
+ r->dpms = DPMS;
+ r->display_type = DISPLAY_TYPE;
+ r->msc = MSC;
+ r->redx = REDX;
+ r->redy = REDY;
+ r->greenx = GREENX;
+ r->greeny = GREENY;
+ r->bluex = BLUEX;
+ r->bluey = BLUEY;
+ r->whitex = WHITEX;
+ r->whitey = WHITEY;
+}
+
+static void
+get_established_timing_section(Uchar *c, struct established_timings *r)
+{
+ r->t1 = T1;
+ r->t2 = T2;
+ r->t_manu = T_MANU;
+}
+
+static void
+get_std_timing_section(Uchar *c, struct std_timings *r)
+{
+ int i;
+
+ for (i=0;i<STD_TIMINGS;i++){
+ r[i].hsize = HSIZE1;
+ VSIZE1(r[i].vsize);
+ r[i].refresh = REFRESH_R;
+ r[i].id = STD_TIMING_ID;
+ NEXT_STD_TIMING;
+ }
+}
+
+static void
+get_dt_md_section(Uchar *c, struct edid_version *ver,
+ struct detailed_monitor_section *det_mon)
+{
+ int i;
+
+ for (i=0;i<DET_TIMINGS;i++) {
+ if (ver->version == 1 && ver->revision > 1 && IS_MONITOR_DESC) {
+
+ switch (MONITOR_DESC_TYPE) {
+ case SERIAL_NUMBER:
+ det_mon[i].type = DS_SERIAL;
+ copy_string(c,det_mon[i].section.serial);
+ break;
+ case ASCII_STR:
+ det_mon[i].type = DS_ASCII_STR;
+ copy_string(c,det_mon[i].section.ascii_data);
+ break;
+ case MONITOR_RANGES:
+ det_mon[i].type = DS_RANGES;
+ get_monitor_ranges(c,&det_mon[i].section.ranges);
+ break;
+ case MONITOR_NAME:
+ det_mon[i].type = DS_NAME;
+ copy_string(c,det_mon[i].section.name);
+ break;
+ case ADD_COLOR_POINT:
+ det_mon[i].type = DS_WHITE_P;
+ get_whitepoint_section(c,det_mon[i].section.wp);
+ break;
+ case ADD_STD_TIMINGS:
+ det_mon[i].type = DS_STD_TIMINGS;
+ get_dst_timing_section(c,det_mon[i].section.std_t);
+ break;
+ }
+ } else {
+ det_mon[i].type = DT;
+ get_detailed_timing_section(c,&det_mon[i].section.d_timings);
+ }
+ NEXT_DT_MD_SECTION;
+ }
+}
+
+static void
+copy_string(Uchar *c, Uchar *s)
+{
+ int i;
+ c = c + 5;
+ for (i = 0; (i < 13 && *s != 0x0A); i++)
+ *(s++) = *(c++);
+ *s = 0;
+}
+
+static void
+get_dst_timing_section(Uchar *c, struct std_timings *t)
+{
+ int j;
+ c = c + 5;
+ for (j = 0; j < 5; j++) {
+ t[j].hsize = HSIZE1;
+ VSIZE1(t[j].vsize);
+ t[j].refresh = REFRESH_R;
+ t[j].id = STD_TIMING_ID;
+ NEXT_STD_TIMING;
+ }
+}
+
+static void
+get_monitor_ranges(Uchar *c, struct monitor_ranges *r)
+{
+ r->min_v = MIN_V;
+ r->max_v = MAX_V;
+ r->min_h = MIN_H;
+ r->max_h = MAX_H;
+ r->max_clock = MAX_CLOCK * 10;
+}
+
+static void
+get_whitepoint_section(Uchar *c, struct whitePoints *wp)
+{
+ wp[1].white_x = WHITEX1;
+ wp[1].white_y = WHITEY1;
+ wp[2].white_x = WHITEX2;
+ wp[2].white_y = WHITEY2;
+ wp[1].index = WHITE_INDEX1;
+ wp[2].index = WHITE_INDEX2;
+ wp[1].white_gamma = WHITE_GAMMA1;
+ wp[2].white_gamma = WHITE_GAMMA2;
+}
+
+static void
+get_detailed_timing_section(Uchar *c, struct detailed_timings *r)
+{
+ r->clock = PIXEL_CLOCK;
+ r->h_active = H_ACTIVE;
+ r->h_blanking = H_BLANK;
+ r->v_active = V_ACTIVE;
+ r->v_blanking = V_BLANK;
+ r->h_sync_off = H_SYNC_OFF;
+ r->h_sync_width = H_SYNC_WIDTH;
+ r->v_sync_off = V_SYNC_OFF;
+ r->v_sync_width = V_SYNC_WIDTH;
+ r->h_size = H_SIZE;
+ r->v_size = V_SIZE;
+ r->h_border = H_BORDER;
+ r->v_border = V_BORDER;
+ r->interlaced = INTERLACED;
+ r->stereo = STEREO;
+ r->sync = SYNC_T;
+ r->misc = MISC;
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/interpret_vdif.c b/xc/programs/Xserver/hw/xfree86/ddc/interpret_vdif.c
new file mode 100644
index 000000000..b02168dd6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/interpret_vdif.c
@@ -0,0 +1,120 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/interpret_vdif.c,v 1.4 1999/03/14 05:51:05 dawes Exp $ */
+
+#include "Xarch.h"
+#include "vdif.h"
+static xf86VdifLimitsPtr* get_limits(CARD8 *c);
+static xf86VdifGammaPtr* get_gamma(CARD8 *c);
+static xf86VdifTimingPtr* get_timings(CARD8 *c);
+static CARD32 swap_byte_order(CARD32 c);
+
+xf86vdifPtr
+InterpretVdif(CARD8 *c)
+{
+ xf86VdifPtr p = (xf86VdifPtr)c;
+ xf86vdifPtr vdif;
+ int i;
+ int length;
+ unsigned long l = 0;
+
+ if (c == NULL) return NULL;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ length = swap_byte_order(p->FileLength);
+ for (i = 0; i < (length >>2); i++)
+ ((CARD32*)c)[i] = swap_byte_order(((CARD32*)c)[i]) ;
+#endif
+ if (p->VDIFId[0] != 'V' || p->VDIFId[1] != 'D' || p->VDIFId[2] != 'I'
+ || p->VDIFId[3] != 'F') return NULL;
+ for ( i = 12; i < p->FileLength; i++)
+ l += c[i];
+ if ( l != p->Checksum) return NULL;
+ vdif = xalloc(sizeof(xf86vdif));
+ vdif->vdif = p;
+ vdif->limits = get_limits(c);
+ vdif->timings = get_timings(c);
+ vdif->gamma = get_gamma(c);
+ vdif->strings = VDIF_STRING(((xf86VdifPtr)c),0);
+ xfree(c);
+ return vdif;
+}
+
+static xf86VdifLimitsPtr*
+get_limits(CARD8 *c)
+{
+ int num, i, j;
+ xf86VdifLimitsPtr *pp;
+ xf86VdifLimitsPtr p;
+
+ num = ((xf86VdifPtr)c)->NumberOperationalLimits;
+ pp = xalloc(sizeof(xf86VdifLimitsPtr) * (num+1));
+ p = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr)c));
+ j = 0;
+ for ( i = 0; i<num; i++) {
+ if (p->Header.ScnTag = VDIF_OPERATIONAL_LIMITS_TAG)
+ pp[j++] = p;
+ VDIF_NEXT_OPERATIONAL_LIMITS(p);
+ }
+ pp[j] = NULL;
+ return pp;
+}
+
+static xf86VdifGammaPtr*
+get_gamma(CARD8 *c)
+{
+ int num, i, j;
+ xf86VdifGammaPtr *pp;
+ xf86VdifGammaPtr p;
+
+ num = ((xf86VdifPtr)c)->NumberOptions;
+ pp = xalloc(sizeof(xf86VdifGammaPtr) * (num+1));
+ p = (xf86VdifGammaPtr)VDIF_OPTIONS(((xf86VdifPtr)c));
+ j = 0;
+ for ( i = 0; i<num; i++)
+ {
+ if (p->Header.ScnTag = VDIF_GAMMA_TABLE_TAG)
+ pp[j++] = p;
+ VDIF_NEXT_OPTIONS(p);
+ }
+ pp[j] = NULL;
+ return pp;
+}
+
+static xf86VdifTimingPtr*
+get_timings(CARD8 *c)
+{
+ int num, num_limits;
+ int i,j,k;
+ xf86VdifLimitsPtr lp;
+ xf86VdifTimingPtr *pp;
+ xf86VdifTimingPtr p;
+
+ num = ((xf86VdifPtr)c)->NumberOperationalLimits;
+ lp = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr)c));
+ num_limits = 0;
+ for (i = 0; i < num; i++) {
+ if (p->Header.ScnTag = VDIF_OPERATIONAL_LIMITS_TAG)
+ num_limits += lp->NumberPreadjustedTimings;
+ VDIF_NEXT_OPERATIONAL_LIMITS(lp);
+ }
+ pp = xalloc(sizeof(xf86VdifTimingPtr)
+ * (num_limits+1));
+ j = 0;
+ lp = VDIF_OPERATIONAL_LIMITS(((xf86VdifPtr) c));
+ for (i = 0; i < num; i++) {
+ p = VDIF_PREADJUSTED_TIMING(lp);
+ for (k = 0; k < lp->NumberPreadjustedTimings; k++) {
+ if (p->Header.ScnTag == VDIF_PREADJUSTED_TIMING_TAG)
+ pp[j++] = p;
+ VDIF_NEXT_PREADJUSTED_TIMING(p);
+ }
+ VDIF_NEXT_OPERATIONAL_LIMITS(lp);
+ }
+ pp[j] = NULL;
+ return pp;
+}
+
+static CARD32
+swap_byte_order(CARD32 c)
+{
+ return ((c & 0xFF000000) >> 24) | ((c & 0xFF0000) >> 8)
+ | ((c & 0xFF00) << 8) | ((c & 0xFF) << 24);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c b/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c
new file mode 100644
index 000000000..735e8a8d4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/print_edid.c
@@ -0,0 +1,260 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.4 1999/06/27 14:08:00 dawes Exp $ */
+
+/* print_edid.c: print out all information retrieved from display device
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+
+static void print_vendor(struct vendor *);
+static void print_version(struct edid_version *);
+static void print_display(struct disp_features *);
+static void print_established_timings(struct established_timings *);
+static void print_std_timings(struct std_timings *);
+static void print_detailed_monitor_section(struct detailed_monitor_section *);
+static void print_detailed_timings(struct detailed_timings *);
+
+static void print_input_features(struct disp_features *);
+static void print_dpms_features(struct disp_features *);
+static void print_whitepoint(struct disp_features *);
+
+void
+xf86PrintEDID(xf86MonPtr m)
+{
+ if (!(m)) return;
+ print_vendor(&m->vendor);
+ print_version(&m->ver);
+ print_display(&m->features);
+ print_established_timings(&m->timings1);
+ print_std_timings(m->timings2);
+ print_detailed_monitor_section(m->det_mon);
+}
+
+static void
+print_vendor(struct vendor *c)
+{
+ ErrorF("Manufacturer: %s ",&c->name);
+ ErrorF("Model: %x ",c->prod_id);
+ ErrorF("Serial#: %u ",c->serial);
+ ErrorF("Year: %u ",c->year);
+ ErrorF("Week: %u\n",c->week);
+}
+
+static void
+print_version(struct edid_version *c)
+{
+ ErrorF("EDID Version: %u.%u\n",c->version,c->revision);
+}
+
+static void
+print_display(struct disp_features *disp)
+{
+ print_input_features(disp);
+ ErrorF("Max H-Image Size [cm]: ");
+ if (disp->hsize)
+ ErrorF("horiz.: %i ",disp->hsize);
+ else
+ ErrorF("H-Size may change, ");
+ if (disp->vsize)
+ ErrorF("vert.: %i\n",disp->vsize);
+ else
+ ErrorF("V-Size may change\n");
+ ErrorF("Gamma: %.2f\n", disp->gamma);
+ print_dpms_features(disp);
+ print_whitepoint(disp);
+}
+
+static void
+print_input_features(struct disp_features *c)
+{
+ if (DIGITAL(c->input_type))
+ ErrorF("Digital Display Input, ");
+ else {
+ ErrorF("Analog Display Input, ");
+ ErrorF("Input Voltage Level: ");
+ switch (c->input_voltage){
+ case V070:
+ ErrorF("0.700/0.300 V\n");
+ break;
+ case V071:
+ ErrorF("0.714/0.286 V\n");
+ break;
+ case V100:
+ ErrorF("1.000/0.400 V\n");
+ break;
+ case V007:
+ ErrorF("0.700/0.700 V\n");
+ break;
+ default:
+ ErrorF("undefined\n");
+ }
+ if (SIG_SETUP(c->input_setup)) ErrorF("Signal levels configurable\n");
+ ErrorF("Sync: ");
+ if (SEP_SYNC(c->input_sync)) ErrorF("Separate ");
+ if (COMP_SYNC(c->input_sync)) ErrorF("Composite ");
+ if (SYNC_O_GREEN(c->input_sync)) ErrorF("SyncOnGreen ");
+ if (SYNC_SERR(c->input_sync))
+ ErrorF("\nSerration on V.Sync Pulse req. if CompSync or SyncOnGreen\n");
+ else ErrorF("\n");
+ }
+}
+
+static void
+print_dpms_features(struct disp_features *c)
+{
+ ErrorF("DPMS capabilities: ");
+ if (DPMS_STANDBY(c->dpms)) ErrorF("StandBy ");
+ if (DPMS_SUSPEND(c->dpms)) ErrorF("Suspend ");
+ if (DPMS_OFF(c->dpms)) ErrorF("Off ");
+ switch (c->display_type){
+ case DISP_MONO:
+ ErrorF("; Monochorome/GrayScale Display\n");
+ break;
+ case DISP_RGB:
+ ErrorF("; RGB/Color Display\n");
+ break;
+ case DISP_MULTCOLOR:
+ ErrorF("; Non RGB Multicolor Display\n");
+ break;
+ default:
+ break;
+ }
+ if (STD_COLOR_SPACE(c->msc))
+ ErrorF("Default color space is primary color space\n");
+ if (PREFERRED_TIMING_MODE(c->msc))
+ ErrorF("First detailed timing is preferred mode\n");
+ if (GFT_SUPPORTED(c->msc))
+ ErrorF("GTF timings supported\n");
+}
+
+static void
+print_whitepoint(struct disp_features *disp)
+{
+ ErrorF("redX: %.3f redY: %.3f ",
+ disp->redx,disp->redy);
+ ErrorF("greenX: %.3f greenY: %.3f\n",
+ disp->greenx,disp->greeny);
+ ErrorF("blueX: %.3f blueY: %.3f ",
+ disp->bluex,disp->bluey);
+ ErrorF("whiteX: %.3f whiteY: %.3f\n",
+ disp->whitex,disp->whitey);
+}
+
+static void
+print_established_timings(struct established_timings *t)
+{
+ unsigned char c;
+
+ ErrorF("Supported VESA Video Modes:\n");
+ c=t->t1;
+ if (c&0x80) ErrorF("720x400@70Hz\n");
+ if (c&0x40) ErrorF("720x400@88Hz\n");
+ if (c&0x20) ErrorF("640x480@60Hz\n");
+ if (c&0x10) ErrorF("640x480@67Hz\n");
+ if (c&0x08) ErrorF("640x480@72Hz\n");
+ if (c&0x04) ErrorF("640x480@75Hz\n");
+ if (c&0x02) ErrorF("800x600@56Hz\n");
+ if (c&0x01) ErrorF("800x600@60Hz\n");
+ c=t->t2;
+ if (c&0x80) ErrorF("800x600@72Hz\n");
+ if (c&0x40) ErrorF("800x600@75Hz\n");
+ if (c&0x20) ErrorF("832x624@75Hz\n");
+ if (c&0x10) ErrorF("1024x768@87Hz (interlaced)\n");
+ if (c&0x08) ErrorF("1024x768@60Hz\n");
+ if (c&0x04) ErrorF("1024x768@70Hz\n");
+ if (c&0x02) ErrorF("1024x768@75Hz\n");
+ if (c&0x01) ErrorF("1280x1024@75Hz\n");
+ c=t->t_manu;
+ if (c&0x80) ErrorF("1152x870@75Hz\n");
+ ErrorF("Manufacturer's mask: %X\n",c&0x7F);
+}
+
+static void
+print_std_timings(struct std_timings *t)
+{
+ int i;
+ ErrorF("Supported Future Video Modes:\n");
+ for (i=0;i<STD_TIMINGS;i++) {
+ if (t[i].hsize > 256) { /* sanity check */
+ ErrorF("#%i: hsize: %i vsize %i refresh: %i vid: %i\n",
+ i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id);
+ }
+ }
+}
+
+static void
+print_detailed_monitor_section(struct detailed_monitor_section *m)
+{
+ int i,j;
+
+ for (i=0;i<DET_TIMINGS;i++) {
+ switch (m[i].type) {
+ case DT:
+ print_detailed_timings(&m[i].section.d_timings);
+ break;
+ case DS_SERIAL:
+ ErrorF("Serial No: %s\n",m[i].section.serial);
+ break;
+ case DS_ASCII_STR:
+ ErrorF(" %s\n",m[i].section.ascii_data);
+ break;
+ case DS_NAME:
+ ErrorF("Monitor name: %s\n",m[i].section.name);
+ break;
+ case DS_RANGES:
+ ErrorF("Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
+ m[i].section.ranges.min_v, m[i].section.ranges.max_v,
+ m[i].section.ranges.min_h, m[i].section.ranges.max_h);
+ if (m[i].section.ranges.max_clock != 0)
+ ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock);
+ else
+ ErrorF("\n");
+ break;
+ case DS_STD_TIMINGS:
+ for (j = 0; j<5; i++)
+ ErrorF("#%i: hsize: %i vsize %i refresh: %i "
+ "vid: %i\n",i,m[i].section.std_t[i].hsize,
+ m[i].section.std_t[j].vsize,m[i].section.std_t[j].refresh,
+ m[i].section.std_t[j].id);
+ break;
+ case DS_WHITE_P:
+ for (j = 0; j<2; i++)
+ if (m[i].section.wp[j].index != 0)
+ ErrorF("White point %i: whiteX: %f, whiteY: %f; gamma: %f\n",
+ m[i].section.wp[j].index,m[i].section.wp[j].white_x,
+ m[i].section.wp[j].white_y, m[i].section.wp[j].white_gamma);
+ break;
+ }
+ }
+}
+
+static void
+print_detailed_timings(struct detailed_timings *t)
+{
+
+ if (t->clock > 15000000) { /* sanity check */
+ ErrorF("Supported additional Video Mode:\n");
+ ErrorF("clock: %.1f MHz ",t->clock/1000000.0);
+ ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size);
+ ErrorF("h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ",
+ t->h_active, t->h_sync_off + t->h_active,
+ t->h_sync_off + t->h_sync_width + t->h_active,
+ t->h_active + t->h_blanking);
+ ErrorF("h_border: %i\n",t->h_border);
+ ErrorF("v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ",
+ t->v_active, t->v_sync_off + t->v_active,
+ t->v_sync_off + t->v_sync_width + t->v_active,
+ t->v_active + t->v_blanking);
+ ErrorF("v_border: %i\n",t->v_border);
+ if (IS_STEREO(t->stereo)) {
+ ErrorF("Stereo: ");
+ if (IS_RIGHT_ON_SYNC(t->stereo))
+ ErrorF("right channel on sync\n");
+ else ErrorF("right channel on sync\n");
+ }
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c b/xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c
new file mode 100644
index 000000000..0ae0126fc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c
@@ -0,0 +1,219 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_vdif.c,v 1.1 1998/11/28 10:43:05 dawes Exp $ */
+
+#include "vdif.h"
+static void print_vdif(xf86VdifPtr l, char *s);
+static void print_timings(xf86VdifTimingPtr *pt);
+static void print_limits(xf86VdifLimitsPtr *pl);
+static void print_gamma(xf86VdifGammaPtr *pg);
+static void print_type(CARD8 c);
+static void print_polarity(CARD8 c);
+
+void
+xf86print_vdif(xf86vdifPtr v)
+{
+ print_vdif(v->vdif,v->strings);
+ print_limits(v->limits);
+ print_timings(v->timings);
+ print_gamma(v->gamma);
+}
+
+static void
+print_vdif(xf86VdifPtr l, char *s)
+{
+ ErrorF("Version %i.%i",l->VDIFVersion,l->VDIFRevision);
+ ErrorF(" Date: %i/%i/%i, Manufactured: %i/%i/%i\n",l->Date[0],
+ l->Date[1],l->Date[2],l->DateManufactured[0],
+ l->DateManufactured[1],l->DateManufactured[2]);
+ ErrorF("File Revision: %i",l->FileRevision);
+ ErrorF("Manufacturer: %s\n",s + l->Manufacturer);
+ ErrorF("ModelNumber: %s\n",s + l->ModelNumber);
+ ErrorF("VDIFIndex: %s\n",s +l->MinVDIFIndex);
+ ErrorF("Version: %s\n",s + l->Version);
+ ErrorF("SerialNumber %s\n",s + l->SerialNumber);
+ ErrorF("MonitorType: ");
+ switch (l->MonitorType) {
+ case VDIF_MONITOR_MONOCHROME:
+ ErrorF("Mono\n");
+ break;
+ case VDIF_MONITOR_COLOR:
+ ErrorF("Color\n");
+ break;
+ }
+ ErrorF("CRT Size: %i inches\n",l->CRTSize);
+ switch (l->MonitorType) {
+ case VDIF_MONITOR_MONOCHROME:
+ ErrorF("Border: %i percent\n",
+ l->BorderRed);
+ ErrorF("Phosphor Decay: 1: %i,",l->RedPhosphorDecay);
+ if (l->GreenPhosphorDecay !=0)
+ ErrorF(" 2: %i,",l->GreenPhosphorDecay);
+ if (l->BluePhosphorDecay !=0)
+ ErrorF(" 3: %i",l->BluePhosphorDecay);
+ ErrorF(" ms\n");
+ if (l->RedChromaticity_x)
+ ErrorF("Chromaticity: 1: x:%f, y:%f; ",
+ l->RedChromaticity_x/1000.0,l->RedChromaticity_y/1000.0);
+ if (l->GreenChromaticity_x)
+ ErrorF("Chromaticity: 2: x:%f, y:%f; ",
+ l->GreenChromaticity_x/1000.0,l->GreenChromaticity_y/1000.0);
+ if (l->BlueChromaticity_x)
+ ErrorF("Chromaticity: 3: x:%f, y:%f ",
+ l->BlueChromaticity_x/1000.0,l->BlueChromaticity_y/1000.0);
+ ErrorF("\n");
+ ErrorF("Gamma: %f\n",l->RedGamma/1000.0);
+ break;
+ case VDIF_MONITOR_COLOR:
+ ErrorF("Border: Red: %i Green: %i Blue: %i percent\n",
+ l->BorderRed,l->BorderGreen,l->BorderBlue);
+ ErrorF("Phosphor Decay: Red: %i, Green: %i, Blue: %i ms\n",
+ l->RedPhosphorDecay,l->GreenPhosphorDecay,l->BluePhosphorDecay);
+ ErrorF("Chromaticity: Red: x:%f, y:%f; Green: x:%f, y:%f; "
+ "Blue: x:%f, y:%f\n",
+ l->RedChromaticity_x/1000.0,l->RedChromaticity_y/1000.0,
+ l->GreenChromaticity_x/1000.0,l->GreenChromaticity_y/1000.0,
+ l->BlueChromaticity_x/1000.0,l->BlueChromaticity_y/1000.0);
+ ErrorF("Gamma: Red:%f, Green:%f, Blue:%f\n",l->RedGamma/1000.0,
+ l->GreenGamma/1000.0,l->BlueGamma/1000.0);
+ break;
+ }
+ ErrorF("White Point: x: %f y: %f Y: %f\n",l->WhitePoint_x/1000.0,
+ l->WhitePoint_y/1000.0,l->WhitePoint_Y/1000.0);
+}
+
+static void
+print_limits(xf86VdifLimitsPtr *pl)
+{
+ int i = 0;
+ xf86VdifLimitsPtr l;
+
+ while((l = pl[i]) != NULL) {
+ ErrorF("Max display resolution: %i x %i pixel\n",l->MaxHorPixel,
+ l->MaxVerPixel);
+ ErrorF("Size of active area: %i x %i millimeters\n",l->MaxHorActiveLength,
+ l->MaxVerActiveHeight);
+ ErrorF("Video Type: ");
+ print_type(l->VideoType);
+ ErrorF("Sync Type: ");
+ print_type(l->SyncType);
+ ErrorF("Sync Configuration ");
+ switch (l->SyncConfiguration) {
+ case VDIF_SYNC_SEPARATE:
+ ErrorF("separate\n");
+ break;
+ case VDIF_SYNC_C:
+ ErrorF("composite C\n");
+ break;
+ case VDIF_SYNC_CP:
+ ErrorF("composite CP\n");
+ break;
+ case VDIF_SYNC_G:
+ ErrorF("composite G\n");
+ break;
+ case VDIF_SYNC_GP:
+ ErrorF("composite GP\n");
+ break;
+ case VDIF_SYNC_OTHER:
+ ErrorF("other\n");
+ break;
+ }
+ ErrorF("Termination Resistance: %i\n",l->TerminationResistance);
+ ErrorF("Levels: white: %i, black: %i, blank: %i, sync: %i mV\n",
+ l->WhiteLevel,l->BlackLevel,l->BlankLevel,l->SyncLevel);
+ ErrorF("Max. Pixel Clock: %f MHz\n",l->MaxPixelClock/1000.0);
+ ErrorF("Freq. Range: Hor.: %f - %f kHz, Ver.: %f - %f Hz\n",
+ l->MaxHorFrequency/1000.0,l->MinHorFrequency/1000.0,
+ l->MaxVerFrequency/1000.0,l->MinVerFrequency/1000.0);
+ ErrorF("Retrace time: Hor: %f us, Ver: %f ms\n",l->MinHorRetrace/1000.0,
+ l->MinVerRetrace/1000.0);
+ }
+}
+
+static void
+print_timings(xf86VdifTimingPtr *pt)
+{
+ int i = 0;
+ xf86VdifTimingPtr t;
+
+ while((t = pt[i]) != NULL) {
+ ErrorF("SVGA / SVPMI mode number: %i\n",t->PreadjustedTimingName);
+ ErrorF("Mode %i x %i\n",t->HorPixel,t->VerPixel);
+ ErrorF("Size: %i x %i mm\n",t->HorAddrLength,t->VerAddrHeight);
+ ErrorF("Ratios: %i/%i\n",t->PixelWidthRatio,t->PixelHeightRatio);
+ ErrorF("Character width: %i",t->CharacterWidth);
+ ErrorF("Clock: %f MHz HFreq.: %f kHz, VFreq: %f Hz\n",t->PixelClock/1000.0,
+ t->HorFrequency/1000.0,t->VerFrequency/1000.0);
+ ErrorF("Htotal: %f us, Vtotal %f ms\n", t->HorTotalTime/1000.0,
+ t->VerTotalTime/1000.0);
+ ErrorF("HDisp: %f, HBlankStart: %f, HBlankLength: %f, "
+ "HSyncStart: %f HSyncEnd: %f us\n",t->HorAddrTime/1000.0,
+ t->HorBlankStart/1000.0,t->HorBlankTime/1000.0,
+ t->HorSyncStart/1000.0,t->HorSyncTime/1000.0);
+ ErrorF("VDisp: %f, VBlankStart: %f, VBlankLength: %f, "
+ "VSyncStart: %f VSyncEnd: %f us\n",t->VerAddrTime/1000.0,
+ t->VerBlankStart/1000.0,t->VerBlankTime/1000.0,
+ t->VerSyncStart/1000.0,t->VerSyncTime/1000.0);
+ ErrorF("Scan Type: ");
+ switch (t->ScanType) {
+ case VDIF_SCAN_INTERLACED:
+ ErrorF("interlaced ");
+ break;
+ case VDIF_SCAN_NONINTERLACED:
+ ErrorF("non interlaced ");
+ break;
+ case VDIF_SCAN_OTHER:
+ ErrorF("other ");
+ break;
+ }
+ ErrorF("Polarity: H: ");
+ print_polarity(t->HorSyncPolarity);
+ ErrorF("V: ");
+ print_polarity(t->VerSyncPolarity);
+ ErrorF("\n");
+ }
+}
+
+static void
+print_gamma(xf86VdifGammaPtr *pg)
+{
+ int i = 0;
+ xf86VdifGammaPtr g;
+
+ while((g = pg[i]) != NULL) {
+ ErrorF("Gamma Table Entries: %i\n",g->GammaTableEntries);
+ }
+}
+
+static void
+print_type(CARD8 c)
+{
+ switch (c) {
+ case VDIF_VIDEO_TTL :
+ ErrorF("TTL\n");
+ break;
+ case VDIF_VIDEO_ANALOG :
+ ErrorF("Analog\n");
+ break;
+ case VDIF_VIDEO_ECL:
+ ErrorF("ECL\n");
+ break;
+ case VDIF_VIDEO_DECL:
+ ErrorF("DECL\n");
+ break;
+ case VDIF_VIDEO_OTHER:
+ ErrorF("other\n");
+ break;
+ }
+}
+
+static void
+print_polarity(CARD8 c)
+{
+ switch (c) {
+ case VDIF_POLARITY_NEGATIVE:
+ ErrorF(" Neg.");
+ break;
+ case VDIF_POLARITY_POSITIVE:
+ ErrorF(" Pos.");
+ break;
+ }
+}
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/vdif.h b/xc/programs/Xserver/hw/xfree86/ddc/vdif.h
new file mode 100644
index 000000000..b4f385e69
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/vdif.h
@@ -0,0 +1,164 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/vdif.h,v 1.1 1998/11/28 10:43:05 dawes Exp $ */
+
+#define VDIF_MONITOR_MONOCHROME 0
+#define VDIF_MONITOR_COLOR 1
+#define VDIF_VIDEO_TTL 0
+#define VDIF_VIDEO_ANALOG 1
+#define VDIF_VIDEO_ECL 2
+#define VDIF_VIDEO_DECL 3
+#define VDIF_VIDEO_OTHER 4
+#define VDIF_SYNC_SEPARATE 0
+#define VDIF_SYNC_C 1
+#define VDIF_SYNC_CP 2
+#define VDIF_SYNC_G 3
+#define VDIF_SYNC_GP 4
+#define VDIF_SYNC_OTHER 5
+#define VDIF_SCAN_NONINTERLACED 0
+#define VDIF_SCAN_INTERLACED 1
+#define VDIF_SCAN_OTHER 2
+#define VDIF_POLARITY_NEGATIVE 0
+#define VDIF_POLARITY_POSITIVE 1
+#include "xf86.h"
+
+typedef struct _VDIF { /* Monitor Description: */
+ CARD8 VDIFId[4]; /* alway "VDIF" */
+ CARD32 FileLength; /* lenght of the whole file */
+ CARD32 Checksum; /* sum of all bytes in the file after*/
+ /* this field */
+ CARD16 VDIFVersion; /* structure version number */
+ CARD16 VDIFRevision; /* structure revision number */
+ CARD16 Date[3]; /* file date Year/Month/Day */
+ CARD16 DateManufactured[3]; /* date Year/Month/Day */
+ CARD32 FileRevision; /* file revision string */
+ CARD32 Manufacturer; /* ASCII ID of the manufacturer */
+ CARD32 ModelNumber; /* ASCII ID of the model */
+ CARD32 MinVDIFIndex; /* ASCII ID of Minimum VDIF index */
+ CARD32 Version; /* ASCII ID of the model version */
+ CARD32 SerialNumber; /* ASCII ID of the serial number */
+ CARD8 MonitorType; /* Monochrome or Color */
+ CARD8 CRTSize; /* inches */
+ CARD8 BorderRed; /* percent */
+ CARD8 BorderGreen; /* percent */
+ CARD8 BorderBlue; /* percent */
+ CARD8 Reserved1; /* padding */
+ CARD16 Reserved2; /* padding */
+ CARD32 RedPhosphorDecay; /* microseconds */
+ CARD32 GreenPhosphorDecay; /* microseconds */
+ CARD32 BluePhosphorDecay; /* microseconds */
+ CARD16 WhitePoint_x; /* WhitePoint in CIExyY (scale 1000) */
+ CARD16 WhitePoint_y;
+ CARD16 WhitePoint_Y;
+ CARD16 RedChromaticity_x; /* Red chromaticity in x,y */
+ CARD16 RedChromaticity_y;
+ CARD16 GreenChromaticity_x; /* Green chromaticity in x,y */
+ CARD16 GreenChromaticity_y;
+ CARD16 BlueChromaticity_x; /* Blue chromaticity in x,y */
+ CARD16 BlueChromaticity_y;
+ CARD16 RedGamma; /* Gamme curve exponent (scale 1000) */
+ CARD16 GreenGamma;
+ CARD16 BlueGamma;
+ CARD32 NumberOperationalLimits;
+ CARD32 OffsetOperationalLimits;
+ CARD32 NumberOptions; /* optinal sections (gamma table) */
+ CARD32 OffsetOptions;
+ CARD32 OffsetStringTable;
+} xf86VdifRec, *xf86VdifPtr;
+
+typedef enum { /* Tags for section identification */
+ VDIF_OPERATIONAL_LIMITS_TAG = 1,
+ VDIF_PREADJUSTED_TIMING_TAG,
+ VDIF_GAMMA_TABLE_TAG
+} VDIFScnTag;
+
+typedef struct _VDIFScnHdr { /* Generic Section Header: */
+ CARD32 ScnLength; /* lenght of section */
+ CARD32 ScnTag; /* tag for section identification */
+} VDIFScnHdrRec, *VDIFScnHdrPtr;
+
+typedef struct _VDIFLimits { /* Operational Limits: */
+ VDIFScnHdrRec Header; /* common section info */
+ CARD16 MaxHorPixel; /* pixels */
+ CARD16 MaxVerPixel; /* lines */
+ CARD16 MaxHorActiveLength; /* millimeters */
+ CARD16 MaxVerActiveHeight; /* millimeters */
+ CARD8 VideoType; /* TTL / Analog / ECL / DECL */
+ CARD8 SyncType; /* TTL / Analog / ECL / DECL */
+ CARD8 SyncConfiguration; /* separate / composite / other */
+ CARD8 Reserved1; /* padding */
+ CARD16 Reserved2; /* padding */
+ CARD16 TerminationResistance; /* */
+ CARD16 WhiteLevel; /* millivolts */
+ CARD16 BlackLevel; /* millivolts */
+ CARD16 BlankLevel; /* millivolts */
+ CARD16 SyncLevel; /* millivolts */
+ CARD32 MaxPixelClock; /* kiloHertz */
+ CARD32 MinHorFrequency; /* Hertz */
+ CARD32 MaxHorFrequency; /* Hertz */
+ CARD32 MinVerFrequency; /* milliHertz */
+ CARD32 MaxVerFrequency; /* milliHertz */
+ CARD16 MinHorRetrace; /* nanoseconds */
+ CARD16 MinVerRetrace; /* microseconds */
+ CARD32 NumberPreadjustedTimings;
+ CARD32 OffsetNextLimits;
+} xf86VdifLimitsRec, *xf86VdifLimitsPtr;
+
+typedef struct _VDIFTiming { /* Preadjusted Timing: */
+ VDIFScnHdrRec Header; /* common section info */
+ CARD32 PreadjustedTimingName; /* SVGA/SVPMI mode number */
+ CARD16 HorPixel; /* pixels */
+ CARD16 VerPixel; /* lines */
+ CARD16 HorAddrLength; /* millimeters */
+ CARD16 VerAddrHeight; /* millimeters */
+ CARD8 PixelWidthRatio; /* gives H:V */
+ CARD8 PixelHeightRatio;
+ CARD8 Reserved1; /* padding */
+ CARD8 ScanType; /* noninterlaced / interlaced / other*/
+ CARD8 HorSyncPolarity; /* negative / positive */
+ CARD8 VerSyncPolarity; /* negative / positive */
+ CARD16 CharacterWidth; /* pixels */
+ CARD32 PixelClock; /* kiloHertz */
+ CARD32 HorFrequency; /* Hertz */
+ CARD32 VerFrequency; /* milliHertz */
+ CARD32 HorTotalTime; /* nanoseconds */
+ CARD32 VerTotalTime; /* microseconds */
+ CARD16 HorAddrTime; /* nanoseconds */
+ CARD16 HorBlankStart; /* nanoseconds */
+ CARD16 HorBlankTime; /* nanoseconds */
+ CARD16 HorSyncStart; /* nanoseconds */
+ CARD16 HorSyncTime; /* nanoseconds */
+ CARD16 VerAddrTime; /* microseconds */
+ CARD16 VerBlankStart; /* microseconds */
+ CARD16 VerBlankTime; /* microseconds */
+ CARD16 VerSyncStart; /* microseconds */
+ CARD16 VerSyncTime; /* microseconds */
+} xf86VdifTimingRec, *xf86VdifTimingPtr;
+
+typedef struct _VDIFGamma { /* Gamma Table: */
+ VDIFScnHdrRec Header; /* common section info */
+ CARD16 GammaTableEntries; /* count of grays or RGB 3-tuples */
+ CARD16 Unused1;
+} xf86VdifGammaRec, *xf86VdifGammaPtr;
+
+/* access macros */
+#define VDIF_OPERATIONAL_LIMITS(vdif) \
+((xf86VdifLimitsPtr)((char*)(vdif) + (vdif)->OffsetOperationalLimits))
+#define VDIF_NEXT_OPERATIONAL_LIMITS(limits) \
+ ((xf86VdifLimitsPtr)((char*)(limits) + (limits)->OffsetNextLimits))
+#define VDIF_PREADJUSTED_TIMING(limits) \
+ ((xf86VdifTimingPtr)((char*)(limits) + (limits)->Header.ScnLength))
+#define VDIF_NEXT_PREADJUSTED_TIMING(timing) \
+ ((xf86VdifTimingPtr)((char*)(timing) + (timing)->Header.ScnLength))
+#define VDIF_OPTIONS(vdif) \
+ ((VDIFScnHdrPtr)((char*)(vdif) + (vdif)->OffsetOptions))
+#define VDIF_NEXT_OPTIONS(options) \
+ ((VDIFScnHdrPtr)((char*)(options) + (options)->Header.ScnLength))
+#define VDIF_STRING(vdif, string) \
+ ((char*)((char*)vdif + vdif->OffsetStringTable + (string)))
+
+typedef struct _vdif {
+ xf86VdifPtr vdif;
+ xf86VdifLimitsPtr *limits;
+ xf86VdifTimingPtr *timings;
+ xf86VdifGammaPtr *gamma;
+ char * strings;
+} xf86vdif, *xf86vdifPtr;
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
new file mode 100644
index 000000000..d760089dd
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c
@@ -0,0 +1,354 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.11 1999/08/21 13:48:26 dawes Exp $ */
+
+/* xf86DDC.c
+ *
+ * Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+
+const char *i2cSymbols[] = {
+ "xf86CreateI2CDevRec",
+ "xf86I2CDevInit",
+ "xf86I2CWriteRead",
+ "xf86DestroyI2CDevRec",
+ NULL
+};
+
+#ifdef XFree86LOADER
+
+static MODULESETUPPROTO(ddcSetup);
+
+static XF86ModuleVersionInfo ddcVersRec =
+{
+ "ddc",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+XF86ModuleData ddcModuleData = { &ddcVersRec, ddcSetup, NULL };
+
+static pointer
+ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ /*
+ * Tell the loader about symbols from other modules that this module
+ * might refer to.
+ */
+ LoaderRefSymLists(i2cSymbols, NULL);
+
+ }
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (pointer)1;
+}
+
+#endif
+
+#define RETRIES 4
+
+extern unsigned char *GetEDID_DDC1(
+ unsigned int *
+);
+
+extern int checksum(
+ unsigned char *,
+ int
+);
+
+extern xf86MonPtr InterpretEDID(
+ unsigned char *
+);
+
+extern xf86vdifPtr InterpretVdif(
+ unsigned char *
+);
+
+static unsigned char *EDIDRead_DDC1(
+ ScrnInfoPtr pScrn,
+ void (*)(ScrnInfoPtr,xf86ddcSpeed),
+ unsigned int (*)(ScrnInfoPtr)
+);
+
+static Bool TestDDC1(
+ ScrnInfoPtr pScrn,
+ unsigned int (*)(ScrnInfoPtr)
+);
+
+static unsigned int *FetchEDID_DDC1(
+ ScrnInfoPtr,
+ register unsigned int (*)(ScrnInfoPtr)
+);
+
+static unsigned char* EDID1Read_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus
+);
+
+static unsigned char * VDIFRead(
+ int scrnIndex,
+ I2CBusPtr pBus,
+ int start
+);
+
+static unsigned char * DDCRead_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus,
+ int start,
+ int len
+);
+
+typedef enum {
+ DDCOPT_NODDC1,
+ DDCOPT_NODDC2,
+ DDCOPT_NODDC
+} DDCOpts;
+
+static OptionInfoRec DDCOptions[] = {
+ { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE },
+ { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE },
+ { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+
+xf86MonPtr
+xf86DoEDID_DDC1(
+ int scrnIndex, void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
+ unsigned int (*DDC1Read)(ScrnInfoPtr)
+)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ unsigned char *EDID_block = NULL;
+ xf86MonPtr tmp = NULL;
+ /* Default DDC and DDC1 to enabled. */
+ Bool noddc = FALSE, noddc1 = FALSE;
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, DDCOptions);
+
+ xf86GetOptValBool(DDCOptions, DDCOPT_NODDC, &noddc);
+ xf86GetOptValBool(DDCOptions, DDCOPT_NODDC1, &noddc1);
+
+ if (noddc || noddc1)
+ return NULL;
+
+ EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read);
+
+ if (EDID_block){
+ tmp = InterpretEDID(EDID_block);
+ }
+#ifdef DEBUG
+ else ErrorF("No EDID block returned\n");
+ if (!tmp)
+ ErrorF("Cannot interpret EDID block\n");
+#endif
+ return tmp;
+}
+
+xf86MonPtr
+xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ unsigned char *EDID_block = NULL;
+ unsigned char *VDIF_Block = NULL;
+ xf86MonPtr tmp = NULL;
+ /* Default DDC and DDC2 to enabled. */
+ Bool noddc = FALSE, noddc2 = FALSE;
+
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, DDCOptions);
+
+ xf86GetOptValBool(DDCOptions, DDCOPT_NODDC, &noddc);
+ xf86GetOptValBool(DDCOptions, DDCOPT_NODDC2, &noddc2);
+
+ if (noddc || noddc2)
+ return NULL;
+
+ EDID_block = EDID1Read_DDC2(scrnIndex,pBus);
+
+ if (EDID_block){
+ tmp = InterpretEDID(EDID_block);
+ } else {
+#ifdef DEBUG
+ ErrorF("No EDID block returned\n");
+#endif
+ return NULL;
+ }
+#ifdef DEBUG
+ if (!tmp)
+ ErrorF("Cannot interpret EDID block\n");
+#endif
+ ErrorF("Sections to follow: %i\n",tmp->no_sections);
+ VDIF_Block =
+ VDIFRead(scrnIndex, pBus, EDID1_LEN * (tmp->no_sections + 1));
+ tmp->vdif = InterpretVdif(VDIF_Block);
+
+ return tmp;
+}
+
+/*
+ * read EDID record , pass it to callback function to interpret.
+ * callback function will store it for further use by calling
+ * function; it will also decide if we need to reread it
+ */
+static unsigned char *
+EDIDRead_DDC1(ScrnInfoPtr pScrn, void (*DDCSpeed)(ScrnInfoPtr,xf86ddcSpeed),
+ unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ unsigned char *EDID_block = NULL;
+ int count = RETRIES;
+
+ if (!read_DDC) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "chipset doesn't support DDC1\n");
+ return NULL;
+ };
+
+ if (TestDDC1(pScrn,read_DDC)==-1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
+ return NULL;
+ };
+
+ if (DDCSpeed) DDCSpeed(pScrn,DDC_FAST);
+ do {
+ EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn,read_DDC));
+ count --;
+ } while (!EDID_block && count);
+ if (DDCSpeed) DDCSpeed(pScrn,DDC_SLOW);
+
+ return EDID_block;
+}
+
+/* test if DDC1 return 0 if not */
+static Bool
+TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ int old, count;
+
+ old = read_DDC(pScrn);
+ count = HEADER * BITS_PER_BYTE;
+ do {
+ /* wait for next retrace */
+ if (old != read_DDC(pScrn)) break;
+ } while(count--);
+ return (count);
+}
+
+/* fetch entire EDID record; DDC bit needs to be masked */
+static unsigned int *
+FetchEDID_DDC1(register ScrnInfoPtr pScrn,
+ register unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ int count = NUM;
+ unsigned int *ptr, *xp;
+
+ ptr=xp=xalloc(sizeof(int)*NUM);
+
+ if (!ptr) return NULL;
+ do {
+ /* wait for next retrace */
+ *xp = read_DDC(pScrn);
+ xp++;
+ } while(--count);
+ return (ptr);
+}
+
+static unsigned char*
+EDID1Read_DDC2(int scrnIndex, I2CBusPtr pBus)
+{
+ return DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN);
+}
+
+static unsigned char*
+VDIFRead(int scrnIndex, I2CBusPtr pBus, int start)
+{
+ unsigned char * Buffer, *v_buffer = NULL, *v_bufferp = NULL;
+ int i, num = 0;
+
+ /* read VDIF length in 64 byte blocks */
+ Buffer = DDCRead_DDC2(scrnIndex, pBus,start,64);
+ if (Buffer == NULL)
+ return NULL;
+ ErrorF("number of 64 bit blocks: %i\n",Buffer[0]);
+ if ((num = Buffer[0]) > 0)
+ v_buffer = v_bufferp = xalloc(sizeof(unsigned char) * 64 * num);
+
+ for (i = 0; i < num; i++) {
+ Buffer = DDCRead_DDC2(scrnIndex, pBus,start,64);
+ if (Buffer == NULL) {
+ xfree (v_buffer);
+ return NULL;
+ }
+ memcpy(v_bufferp,Buffer,63); /* 64th byte is checksum */
+ xfree(Buffer);
+ v_bufferp += 63;
+ }
+ return v_buffer;
+}
+
+static unsigned char *
+DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
+{
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+ int w_bytes;
+ unsigned char *R_Buffer;
+ int i;
+
+ xf86LoaderReqSymLists(i2cSymbols, NULL);
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "ddc2";
+ dev->SlaveAddr = 0xA0;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->pI2CBus = pBus;
+ if (! xf86I2CDevInit(dev)) {
+ xf86DrvMsg(X_PROBED,scrnIndex,"No DDC2 device\n");
+ return NULL;
+ }
+ if (start < 0x100) {
+ w_bytes = 1;
+ W_Buffer[0] = start;
+ } else {
+ w_bytes = 2;
+ W_Buffer[0] = start & 0xFF;
+ W_Buffer[1] = (start & 0xFF00) >> 8;
+ }
+ R_Buffer = xcalloc(1,sizeof(unsigned char)
+ * (len));
+ for (i=0; i<RETRIES; i++) {
+ if (xf86I2CWriteRead(dev, W_Buffer,w_bytes, R_Buffer,len)) {
+ if (!checksum(R_Buffer,len)) {
+ xf86DestroyI2CDevRec(dev,TRUE);
+ return R_Buffer;
+ }
+#ifdef DEBUG
+ else ErrorF("Checksum error in EDID block\n");
+#endif
+ }
+#ifdef DEBUG
+ else ErrorF("Error reading EDID block\n");
+#endif
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ xfree(R_Buffer);
+ return NULL;
+}
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.h b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.h
new file mode 100644
index 000000000..e31f48833
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.h
@@ -0,0 +1,43 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.h,v 1.2 1999/03/14 03:21:56 dawes Exp $ */
+
+/* xf86DDC.h
+ *
+ * This file contains all information to interpret a standard EDIC block
+ * transmitted by a display device via DDC (Display Data Channel). So far
+ * there is no information to deal with optional EDID blocks.
+ * DDC is a Trademark of VESA (Video Electronics Standard Association).
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+
+
+#ifndef XF86_DDC_H
+# define XF86_DDC_H
+
+#include "edid.h"
+#include "xf86i2c.h"
+
+/* speed up / slow down */
+typedef enum {
+ DDC_SLOW,
+ DDC_FAST
+} xf86ddcSpeed;
+
+extern xf86MonPtr xf86DoEDID_DDC1(
+ int scrnIndex,
+ void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
+ unsigned int (*DDC1Read)(ScrnInfoPtr)
+);
+
+extern xf86MonPtr xf86DoEDID_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus
+);
+
+extern void xf86PrintEDID(
+ xf86MonPtr
+);
+
+#endif
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/AccelCards b/xc/programs/Xserver/hw/xfree86/doc/AccelCards
new file mode 100644
index 000000000..c3d0cc3fa
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/AccelCards
@@ -0,0 +1,1700 @@
+#---------------------------------------------------------------------------#
+#
+# Accelerated card supported by XFree86
+#
+# Version 1.5 - August 27, 1994
+# List for XFree86 3.1 - David Wexelblat <dwex@xfree86.org>
+#---------------------------------------------------------------------------#
+# This file contains the list of accelerated cards that have been tested
+# as compatible with XFree86. Other cards with supported chipsets may
+# work with XFree86, but we cannot guarentee it. If you try out a card
+# not on this list and it works, please fill in the blank template at the
+# bottom of this file and mail it to us at <xfree86@physics.su.oz.au>.
+#
+# If you have a card with a supported chipset that does not function with
+# XFree86, please get in touch with us so we can attempt to rectify the
+# situations. Please first ensure that your hardware is functioning
+# correctly by running under DOS/Windows.
+#---------------------------------------------------------------------------#
+# This file is divided into sections by chipset:
+# S3 911/924
+# S3 801/805
+# S3 928
+# 8514/A
+# ATI Mach8
+# ATI Mach32
+# Weitek P9000
+# SVGA (Cirrus)
+# SVGA (Western Digital)
+#
+# A lot of information about RAMDACs and clock chips is provided; this is
+# likely sufficient to get an unlisted card up and running. At the bottom
+# of this file, above the blank form, is a listing of available clocks
+# for clock synthesizer chipsets we know about. If your card has one
+# of these chipsets, you can use the clocks listed in the Clocks line of
+# your Xconfig file. You should copy the list exactly as it appears.
+#
+#---------------------------------------------------------------------------#
+# S3 911/924 #
+#---------------------------------------------------------------------------#
+Card Vendor : DEC
+Card Model : DEC PC450D2LP
+Card Bus (ISA/EISA/VLB) : Embedded
+Chipset : 86C924
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 46 45 130 12 80 32 110 65 75 95
+Clocks (cont) :
+Option Flags :
+RAMDAC :
+Submitter : Eric Hvozda <ack@clark.net>
+Last Edit Date : Feb 20, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : Hewlett-Packard
+Card Model : D2325A
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80 nS
+Clock Chip : ICS1394M
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 30.00 0.00 32.50 36.00 38.00 40.00
+Clocks (cont) : 44.90 48.00 50.10 60.10 64.20 65.10 75.20 80.20
+Option Flags : nomemaccess on my setup to prevent lockups
+RAMDAC : MUSIC TR9C1710-80
+Submitter : Greg Holdren <gregh@hprnd.rose.hp.com,geh@netcom.com>
+Last Edit Date : Jan 21, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 (Circa 1991)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80 ns
+Clock Chip : Chrontel CH9204CB-NC
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.175 28.33 40 0 50 77 36 44.9
+Clocks (cont) : 130 120 80 31.5 110 65 75 96
+Option Flags :
+RAMDAC : SC11483CV (Silkscreen outine for Bt476)
+Submitter : Douglas Lenz <lenz@comm.mot.com>
+Last Edit Date : Sept 29, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 911
+Video Memory : 1 Meg
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip : ???
+Programmable? (Y/N) : No ???
+Number of clocks : 16
+Clocks : 25.2 28.3 40 72 50 77 36 45
+Clocks (cont) : 131 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : Sierra HC
+Submitter : Kent A. Vander Velden
+Last Edit Date : Oct 24, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Paelit
+Card Model : S3 VGA (I kid you not)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 911
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 76.0 94.5
+Option Flags :
+RAMDAC :
+Submitter : Stephen Hocking
+Last Edit Date : Sep 29, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Farenheit 1280
+Card Bus(ISA/EISA/VLB) : ISA
+Chipset : S3 86C924
+Video Memory : 1024k
+Memory Type(DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
+Clocks (cont) : 78.00 56.70 63.00 74.90 80.00 89.90 100.90 31.50
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : Richard Coley
+Last Edit Date : Oct 4 1993
+#---------------------------------------------------------------------------#
+Card Vendor : S3, Incorporated
+Card Model : MVGA-S3C911
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 924
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC : SC11487CN
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : SIXGRAPH
+Card Model : WIZARD 924
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 924
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 39.70 0.00 50.00 77.00 35.70 44.70
+Clocks (cont) : 130.30 119.60 79.50 31.20 109.70 65.30 75.00 71.40
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : Jean-F. Cormier <jfcor@phy.ulaval.ca>
+Last Edit Date : Jan 23, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : WA
+Card Model : WA911
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks :
+Clocks : 25.2 28.32 39.9 0.0 50.10 79.80 36.10 44.9
+Option Flags :
+RAMDAC :
+Submitter : Steffan Henke <henker@informatik.uni-bremen.de>
+Last Edit Date : June 7, 1994
+#---------------------------------------------------------------------------#
+# S3 801/805 #
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 (original proto design).
+Card Bus (ISA/EISA/VLB) : ISA.
+Chipset : S3 86C801
+Video Memory : 1024k (upgradable)
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : crontel (need to check make)
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 72 49 77 36 45
+Clocks (cont) : 90 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Jon Tombs <jon@xfree86.org>
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GE32
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3-801
+Video Memory : 1M
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : (80ns ?)
+Clock Chip : ATT
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25 28 40 72 50 77 36 45 90 120 80 32 110 65 75 95
+Clocks (cont) :
+Option Flags :
+RAMDAC :
+Submitter : brezak@ch.hp.com
+Last Edit Date : 10/25/93
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C801
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : Unknown
+Clock Chip : Avasem AV9194-??
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 40.0 0.0 50.1 77.0 36.2 44.9
+Clocks (cont) : 80.0 120.0 130.2 31.5 110.3 65.0 74.9 72.4
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : Jordan K. Hubbard <jkh@whisker.lotus.ie>
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C801
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 95.0
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : David E. Wexelblat <dwex@xfree86.org>
+Last Edit Date : Sept 25, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : "made in taiwan" VGA windows accellerator
+Card Model : 2157?
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3-801
+Video Memory : 1024k + 1024k optional, I have 2Mb.
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 50ns.
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No.
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags : None.
+RAMDAC : ATT 491? (24/15/16/8 bit ramdac from ATT) (110Mhz)
+Submitter : R.E. Wolff
+Last Edit Date : Mon Sep 27 09:15:36 MET 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : Graphics Engine 32VL+
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31.5 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : Marc Wandschneider <marcwan@microsoft.com>
+Last Edit Date : Oct 25, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32VL+/2mb
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.30 39.70 0.00 50.00 76.70 35.70 44.60
+Clocks (cont) : 130.30 121.40 79.40 31.20 109.80 65.10 74.90 94.60
+Option Flags :
+RAMDAC : Winbond W82C490P-110
+Submitter : Dick Garner <cedar!dick@beaver.cs.washington.edu>
+Last Edit Date : Oct. 29, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Dell Computer on board video card
+Card Model :
+Card Bus (ISA/EISA/VLB) : Integrated Local Bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 40.00 77.50 77.50 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.00 65.00 75.00 94.50
+Option Flags :
+RAMDAC : AT&T 20C492
+Submitter : Didier Poirot <dp@chorus.fr>
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : 433/M
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS2494AM
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.50 36.00 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.10 65.00 75.00 94.50
+Option Flags :
+RAMDAC : SC11483CV
+Submitter : Joe V. Moss <joe@morton.rain.com>
+Last Edit Date : Oct 14, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : 4066/XE
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS2494AM
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 78.20 36.00 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.00 65.00 75.00 94.50
+Option Flags :
+RAMDAC : SC11483CV
+Submitter : Joe V. Moss <joe@morton.rain.com>
+Last Edit Date : Oct 14, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : Built-into Dell 4066/XE
+Card Bus (ISA/EISA/VLB) : local bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 512k @ ? / 512k @ 70ns
+Clock Chip : ?
+Programmable? (Y/N) : no?
+Number of clocks : 16
+Clocks : 25.20 28.32 39.90 0.00 50.10 77.60 36.00 36.10
+Clocks (cont) : 62.90 100.30 79.90 31.50 109.90 109.90 75.00 94.50
+Option Flags : Option "nomemaccess"
+RAMDAC : AT&T 20C492
+Submitter : harry@brain.Jpl.Nasa.Gov (Harry Langenbacher)
+Last Edit Date : Oct 29, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : "Made In Taiwan" VGA Windows Accellerator
+Card Model : P/N: 910-0032 CODE 2155
+Card Bus (ISA/EISA/VLB) : VESA Local Bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS 2494 AN 9312-305 (ICS2494-305)
+Programmable? (Y/N) : No.
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Frode Roervik <froder@ifi.uio.no>
+Last Edit Date : Jan 26, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : Micronics
+Card Model : MPower 3
+Card Bus (ISA/EISA/VLB) : on-motherboard (VLB)
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AvaSem
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31.5 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C491-80
+Comments : RAMDAC limits max clock to 80MHz
+Submitter : David Dawes <dawes@xfree86.org>
+Last Edit Date : Dec 14, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : miro Computer Products AG Germany
+Card Model : CRYSTAL 8S
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 P86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS2494AN
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.2 28.32 39.9 0 50.1 77 36 44.8 129.7 120.2
+Clocks (cont) : 120.2 31.5 109.9 65 75 94.5 31.5 109.9 65 75 94.5
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : rohde@physik.uni-kiel.d400.de
+Last Edit Date : Nov 5, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : miro Computer Products AG
+Card Model : miroCRYSTAL 8S
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 P86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS2494AN
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.2 28.32 40.0 0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Christoph Rimek <chrimek@toppoint.de>
+Last Edit Date : Mar 6, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit VLB ( = VA/VLB - audio )
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 50ns(1M) + 60ns (1M)
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.10 45.00
+Clocks (cont) : 130.00 120.20 80.00 31.50 110.30 65.00 75.00 94.60
+Option Flags :
+RAMDAC : AT&T 490
+Submitter : Yasu-Hiro Yamazaki<hiro@rainbow.physics.utoronto.ca>
+Last Edit Date : Oct. 7, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 Plus VLB
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3-805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60 ns
+Clock Chip : Chrontel 9303 (?)
+Programmable? (Y/N) : N (?)
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.20 44.90
+Clocks (cont) : 130.10 120.00 80.00 31.50 110.20 65.00 75.00 94.60
+Option Flags :
+RAMDAC : AT&T 20C490-80
+Submitter : Steve Forsythe <forsse@meaddata.com>
+Last Edit Date : Oct. 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 Plus
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60 ns
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.20 44.90
+Clocks (cont) : 130.00 120.00 80.00 31.50 110.20 65.00 75.00 94.60
+Option Flags : nomemaccess
+RAMDAC : ?
+Submitter : Steven Wallace <swallace@ece.uci.edu>
+Last Edit Date : October 3, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : SPEA Videoseven
+Card Model : V7-Mirage
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC :
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : STB
+Card Model : VL-24
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : ?
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : progamable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC :
+Submitter :
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : Viglen
+Card Model : Genie
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC :
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+# S3 928 #
+#---------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine Ultra Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C928
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 25ns (I think: chips are: TMS 44C251ASD)
+Clock Chip : Chrontel CH9204CL-NC
+Programmable? (Y/N) : Not sure (probably not)
+Number of clocks : 16
+Clocks : 25 28 40 72 50 77 36 45 90 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : Winbond W82C490P-110
+Submitter : Richard Gooch <rgooch@atnf.csiro.au>
+Last Edit Date : 1-OCT-1993
+#---------------------------------------------------------------------------#
+Card Vendor : Diamond Computer Systems, Inc.
+Card Model : Stealth Pro (not officially supported)
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60ns
+Clock Chip :
+Programmable? (Y/N) : Y ;Need external clock program (like ds3) to
+Number of clocks : 3 or more ;set 3rd clock entry to:
+Clocks : 19.9 22.3 24.8 25.0 28.1 31.3
+Clocks (cont) : 32.2 35.7 35.9 37.0 39.8 (interlaced)
+Clocks (cont) : 39.7 44.6 49.6 49.9 56.2 62.6
+Clocks (cont) : 64.4 71.4 71.8 73.9 79.6 (non-interlaced)
+Option Flags : nomemaccess
+RAMDAC : Diamond SS2410
+Submitter : Hans Oey <hans@mo.hobby.nl>
+Last Edit Date : Oct 5, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C928
+Video Memory : 2048k and 1024k (tested both)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns
+Clock Chip : ICD 2061ASC-1
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra SC 15025CV Highcolor 24 - 110
+Submitter : Dirk Hohndel <hohndel@xfree86.org>
+Last Edit Date : 09/27/93
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA, Aachen, Germany
+Card Model : ELSA Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA (and EISA, but no EISA motherboard, not tested)
+Chipset : S3-928 rev. D
+Video Memory : 1024k (up to 2MB VRAM)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICD 2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : SC 15025
+Submitter : Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA, Aachen, Germany
+Card Model : ELSA Winner 1000 VL
+Card Bus (ISA/EISA/VLB) : VLB (33 MHz)
+Chipset : S3-928 rev. D
+Video Memory : 1024k (up to 2MB VRAM + 1MB offscreen DRAM)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICD 2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : SC 15025
+Submitter : Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA/EISA Twinbus (EISA not yet tested)
+Chipset : S3 928 D-step
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "ic2061a"
+Option Flags : nomemaccess
+RAMDAC : SIERRA 15/16 bit (SC15025)
+Submitter : Helmut Geyer geyer@kalliope.iwr.uni-heidelberg.de
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Elsa
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM (Micron MT42C4256Z-8 or -7)
+Memory Speed : 80ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra 15/16-bit HiColor
+Submitter : Peter E. <Peter.Eubert@iwb.mw.tu-muenchen.d400.de>
+Last Edit Date : October 8, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra SC 15025CV
+Submitter : Helmut Geyer <geyer@kalliope.iwr.uni-heidelberg.de>
+Last Edit Date : Oct 12, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : ELSA Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3/928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC :
+Submitter : Walter Tuppa <tuppa@iue.tuwien.ac.at>
+Last Edit Date : Oct 11, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Miro Computer Products GmbH - GERMANY
+Card Model : MIRO 32S Eisa
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : S3 928
+Video Memory : 4 Mb
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICS 2494
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 50.350 56.644 65.000 72.000 80.000 89.800
+Clocks (cont) : 0.000 29.500 14.750 25.175 44.900 84.000
+Clocks (cont) : 100.000 110.000 125.000 135.000
+Option Flags : ?
+RAMDAC : BT 485
+Submitter : ?
+Last Edit Date : May 13, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : Number 9
+Card Model : GXE Level 11
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : 1M VRAM, 1M DRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Marc Evans <marc@xfree86.org>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928 Rev D
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485KPJ135
+Submitter : David Wexelblat <dwex@xfree86.org>
+Last Edit Date : October 16, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Number 9
+Card Model : GXe12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928
+Video Memory : 3Mb
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : Yes
+Number of clocks : Programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Brooktree Bt485
+Submitter : Orest Zborowski <orestz@microsoft.com>
+Last Edit Date : Sep 25, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928 Rev E
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+N}mber of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Daniel Ling <danzig@eclipse.its.rpi.edu>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928 Rev D [other codes: 1XP1-0001 93295DB 9318101]
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485KPJ135 [other codes: 006 9320]
+Submitter : Ed Hall <edhall@rand.org>
+Last Edit Date : October 15, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : GXE level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928
+Video Memory : 3 MB
+Memory Type (DRAM/VRAM) : 2 MB VRAM / 1 MB DRAM
+Memory Speed : ?
+Clock Chip : icd2061a
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485
+Submitter : Ted Goldblatt
+Last Edit Date : 25 October 1993
+#---------------------------------------------------------------------------#
+Card Vendor : #9
+Card Model : GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Yes
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree 485
+Submitter : Randy Terbush <randyt@cse.unl.edu>
+Last Edit Date : Oct 25, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928 Rev E
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 60ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+N}mber of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Daniel Ling <danzig@eclipse.its.rpi.edu>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXe Level 12
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : 86C928P-P
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags : "nolinear", "nomemaccess", "bt485_curs"
+RAMDAC : BT485
+Submitter : Andreas Joppich <aj@ms.DeTeMobil.de>
+Last Edit Date : March 24,1994
+#---------------------------------------------------------------------------#
+Card Vendor : Spea/V7
+Card Model : Mercury PCI Lite
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : S3 928P
+Video Memory : 1 MB
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60 ns
+Clock Chip : Avasem AV9194-U7CW20
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31 110 65 75 95
+Option Flags : "dac_8_bit"
+RAMDAC : Sierra SC 15025
+Submitter : Kai Maekisara <Kai.Makisara@vtt.fi>
+Last Edit Date : March 24, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : SPEA Video7
+Card Model : Mercury PCI
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : S3-928
+Video Memory : 2048 kB
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : SC11412
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "sc11412"
+Option Flags : "spea_mercury"
+RAMDAC : BT485
+Submitter : preuss@cach02.chm.tu-dresden.de
+Last Edit Date : May 24, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : STB
+Card Model : Pegasus
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 2048k or 4096k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 17.86, 18.52, 19.23, or 20 ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags : stb_pegasus,dac_8_bit,sync_on_green
+RAMDAC : Bt485
+Submitter : David Gadbois
+Last Edit Date : May 27, 1994
+#---------------------------------------------------------------------------#
+# 8514/A #
+#---------------------------------------------------------------------------#
+Card Vendor : Western Digital
+Card Model : WD9510-AT
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 8514/A-compatible
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : n/a
+Programmable? (Y/N) : n/a
+Number of clocks : n/a
+Clocks : n/a
+Option Flags :
+RAMDAC : std
+Submitter : <andrew@werple.apana.org.au>
+Last Edit Date : Mon Sep 27 11:11:53 EST 1993
+#---------------------------------------------------------------------------#
+# ATI Mach8 #
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : 8514 Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach-8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip : 18811-0
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 43.10 48.90 92.90 36.30 50.30 56.60 0.00 44.90
+Clocks (cont) : 30.30 32.10 0.00 80.50 40.20 44.90 75.40 65.30
+Clocks (cont) : 21.60 24.40 46.40 18.10 25.10 28.30 0.00 22.40
+Clocks (cont) : 15.20 16.10 55.40 40.20 20.10 22.40 37.70 32.70
+Option Flags :
+RAMDAC : standard
+Submitter : Tiago Gons <tiago@comosjn.hobby.nl>
+Last Edit Date : Sept 27, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-0
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 42.95 48.77 92.4 36.0 50.35 56.64 0.0 44.9
+Clocks (cont) : 30.24 32.0 110.0 80.0 39.91 44.9 75.0 65.0
+Clocks (cont) : 21.47 24.38 45.2 18.0 25.17 28.32 0.0 22.45
+Clocks (cont) : 15.12 16.0 55.0 40.0 19.95 22.45 37.5 32.5
+Option Flags :
+RAMDAC : Unknown
+Submitter : Scott Laird <lair@midway.uchicago.edu>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 16
+Clocks : 43.0 48.8 0.0 36.0 50.4 56.6 0.0 44.9
+Clocks (cont) : 30.2 32.0 110.0 80.0 40.0 44.9 75.0 65.0
+Option Flags :
+RAMDAC : generic 8-bit pseudocolor (says SuperProbe)
+Submitter : mrex@rz.fht-mannheim.de
+Last Edit Date : 30-Sep-93
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-0
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 43.10 48.90 92.80 36.30 50.30 56.60 0.00 44.90
+Clocks (cont) : 30.30 32.10 110.70 80.50 40.20 44.90 75.40 65.30
+Option Flags :
+RAMDAC :
+Submitter : Hans Nasten <nasten@everyware.se>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra (P/N1041111520, BIOS#1130111513(c)91)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8 38800-1 (VGA - VGA Wonder+ 28800-5)
+Video Memory : 1024k (VGA - 512k)
+Memory Type (DRAM/VRAM) : VRAM TMS44C251-10 (VGA - DRAM)
+Memory Speed : 100ns (VGA - 80ns)
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 43.00 48.80 0.00 36.00 50.30 56.70 0.00 44.90
+Clocks (cont) : 30.30 32.00 108.40 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 21.50 24.40 0.00 18.00 25.20 28.30 0.00 22.40
+Clocks (cont) : 15.10 16.00 55.00 40.00 20.00 22.40 37.50 32.50
+Option Flags :
+RAMDAC : (?) INMOS IMSG176J666
+Submitter : Henry Worth <haw30@ras.amdahl.com>
+Last Edit Date : Oct 3, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics ULTRA
+Card Bus : ISA
+Chipset : ATI 28800-6 and ATI 38800-1
+Video Memory : 1024k
+Memory Type : VRAM
+Memory Speed : 80ns
+Clock Chip : ATI 188102
+Programmable? (Y/N) : don't know
+Number of clocks : 32
+Clocks : 43.00 48.80 0.00 36.00 50.30 56.70 0.00 44.90
+Clocks (cont) : 30.30 32.00 89.50 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 21.50 24.40 0.00 18.00 25.20 28.30 0.00 22.40
+Clocks (cont) : 15.10 16.00 50.10 40.10 20.00 22.40 37.50 32.50
+Option Flags :
+RAMDAC : IMSG176J-S07
+Submitter : Joergen Haegg <jh@efd.lth.se>
+Last Edit Date : Oct 13, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1MB VRAM ACCEL / 512KB DRAM VGA
+Memory Type (DRAM/VRAM) : See above
+Memory Speed : 60ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 13
+Clocks : 30.3 32.0 36.0 40.0 43.0 44.9 48.8
+Clocks (cont) : 50.3 56.7 65.1 75.0 80.0 92.0
+Option Flags :
+RAMDAC :
+Submitter : Dimitrios Evmorfopoulos
+Last Edit Date : Oct 26th 1993
+#---------------------------------------------------------------------------#
+# ATI Mach32 #
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : AX0
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875
+Submitter : Alan Hourihane <alanh@metro.co.uk>
+Last Edit Date : Jan 6, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100.0 126.0 92.4 36.0 50.35 56.64 0 44.90
+Clocks (cont) : 135.0 32.0 110.0 80.0 39.91 49.90 75.0 65.0
+Option Flags : None
+RAMDAC : ATI34075
+Submitter : Mike Bernson
+Last Edit Date : Sept 26, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : VLB mach32
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI 68800-3 (mach32)
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ATI 18811-1
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 100 126 92.4 36 50.35 56.64 External 44.9
+Clocks (cont) : 135 32 110 80 39.91 44.9 75 65
+Option Flags : none
+RAMDAC : ATI 68875
+Submitter : Craig E. Groeschel <craig@metrolink.com>
+Last Edit Date : Oct 3, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : ATI Ultra Pro (OEM version without mouse)
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : MACH 32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ics2494AM 9236-308
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 51.00 36.00 126.00 25.00 80.00 65.00 45.00 40.00
+Clocks (cont) : 135.00 32.00 110.00 80.00 45.00 40.00 75.00 65.00
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Bill Broadley <Broadley@neurocog.lrdc.pitt.edu>
+Last Edit Date :
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Mach32 Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 6880006
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80 ns
+Clock Chip : ATI1881 (ICS2494)
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 18.00 22.00 25.00 28.00 36.00 44.00 50.00 56.00
+Clocks (cont) : 30.00 32.00 37.00 39.00 40.00 0.00 75.00 65.00
+Option Flags :
+RAMDAC : ATI68830
+Submitter : Ed Krohne <krohne@elrond.mcdata.com>
+Last Edit Date : Sept 30, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI Technologies Inc
+Card Model : Graphics Ultra Pro VLB
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : 256Kx4 VRAM; 512-bit serial transfer
+Memory Speed : ??
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100.00 126.00 92.40 36.00 50.35 56.64 Ext 44.90
+Clocks (cont) : 135.00 32.00 110.00 80.00 39.91 44.90 75.00 65.00
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Mark Weaver <Mark_Weaver@brown.edu>
+Last Edit Date : Oct 3, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A / Mach 32
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns (according to docs, not actually opened)
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC :
+Submitter : Linus Torvalds <Linus.Torvalds@Helsinki.FI>
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : VLB mach32
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100.0 126.0 92.0 36.0 51.0 57.0 0.0 44.0
+Clocks (cont) : 135.0 32.0 110.0 80.0 39.0 45.0 75.0 65.0
+Clocks (cont) : 50.0 63.0 46.0 18.0 25.0 28.0 0.0 22.0
+Clocks (cont) : 67.0 16.0 55.0 40.0 19.0 23.0 37.0 33.0
+Option Flags :
+RAMDAC : ATI 68875
+Submitter : Todd Pfaff <todd@flex.eng.mcmaster.ca>
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100 126 92 36 50 56 0 45 135 32 110 80 40 45 75 65
+Option Flags :
+RAMDAC : ?
+Submitter : Ari Laakkonen <apl@doc.ic.ac.uk>
+Last Edit Date : Oct 4, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A/Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 45ns
+Clock Chip :
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875 RAMDAC
+Submitter : Dietmar Wolz <dietmar@cs.tu-berlin.de>
+Last Edit Date : Oct 09, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphic Ultra Pro
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : ATI 28800-A
+Video Memory : 2M
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns (I think! if not 60ns)
+Clock Chip : 18811-1
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 100 126 92 36 50 56 0 45
+Clocks (cont) : 132 32 110 80 40 45 75 65
+Option Flags : none(?)
+RAMDAC : ATI68875/TLC34075 (reported by inw 12EE[11:9])
+Submitter : aal@rot.qc.ca (Alain Hebert)
+Last Edit Date : Oct 26, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : ATI Ultra Mach32
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach32 2200688003 + ATI 68875 BFN
+Video Memory : 2 MB
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns
+Clock Chip : ICS 2494 AM ?
+Programmable? (Y/N) : Y
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags : --
+RAMDAC : 18820 ATI
+Submitter : Christoph Kukulies <kuku@acds.physik.rwth-aachen.de>
+Last Edit Date : Oct 30, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra CLX
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI 68800-06
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ATI 18811-2
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Marc Wandschneider <marcwan@microsoft.com>
+Last Edit Date : Oct 25, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Dell Computer on board video card
+Card Model : Omniplex 466
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : ATI 68800 (Mach32, 8514/A compatible)
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : ?
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 17.40 19.60 21.80 24.90 27.70 31.00 34.60 44.90
+Clocks (cont) : 51.80 53.50 55.30 62.20 69.30 76.00 87.10 93.30
+Clocks (cont) : 8.70 9.80 10.90 12.45 13.85 15.50 17.30 22.45
+Clocks (cont) : 25.90 26.75 27.65 31.10 34.65 38.00 43.55 46.65
+Option Flags : None
+RAMDAC : ?
+Submitter : Blaine Benson <benson@ssu.abratech.com>
+Last Edit Date : June 15, 1994
+#---------------------------------------------------------------------------#
+Card Vendor : NCR
+Card Model : Clarity II
+Card Bus (ISA/EISA/VLB) : Direct Access Video Buss (DAVB) Sort of a VLB
+Chipset : ATI Mach-32
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : ?? (Toshiba TC524258BJ-80)
+Memory Speed : 80ns
+Clock Chip : ??
+Programmable? (Y/N) : ?
+Number of clocks : ?
+Clocks : ?
+Clocks (cont) : ?
+Option Flags : none
+RAMDAC : TIC34075
+Submitter : Stuart Anderson <Stuart.Anderson@ColumbiaSC.NCR.COM>
+Last Edit Date : Thu Dec 2 1993
+#---------------------------------------------------------------------------#
+Card Vendor : PRISMA
+Card Model : GraphicSTAR-FX V
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A/Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 45ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875 RAMDAC
+Submitter : Peter Blok <pb@pbgate.iaf.nl>
+Last Edit Date : Dec 09, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model :
+Card Bus (ISA/EISA/VLB): VLB
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM): DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100.30 126.60 92.40 36.10 50.50 56.80 0.00 44.90
+Clocks (cont) : 135.10 32.00 109.70 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 50.15 63.30 46.20 18.05 25.25 28.40 0.00 22.45
+Clocks (cont) : 67.55 16.00 54.85 40.00 20.00 22.45 37.50 32.50
+Option Flags : None
+RAMDAC : BT481
+Submitter : Jin Tao
+Last Edit Date : Dec. 15, 1993
+#---------------------------------------------------------------------------#
+# Weitek P9000 #
+#---------------------------------------------------------------------------#
+Card Vendor : Diamond Computer Systems, Inc.
+Card Model : Viper
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Weitek Power 9000
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : icd2061a Compatable
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : 25 to 135 (over 110 not recommended)
+Option Flags :
+RAMDAC : bt485
+Submitter : Erik Nygren <nygren@mit.edu>
+Last Edit Date : July 8, 1994
+#---------------------------------------------------------------------------#
+# SVGA (Cirrus) #
+#---------------------------------------------------------------------------#
+Card Vendor : Boca
+Card Model : SVGAX3
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Cirrus 5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : ?
+Clock Chip : Built-In
+Programmable? (Y/N) : No
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08
+Clocks (cont) : 49.87 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Cirrus Logic Built-in 15/16/24-bit DAC
+Submitter : <johnsonp@nicco.sscnet.ucla.edu>
+Last Edit Date : Oct 3, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Cirrus Logic
+Card Model : MVGA-AVGA3VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : CL 5426
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70ns
+Clock Chip : internal
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.23 42.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.89 72.16 75.00 80.01
+Option Flags :
+RAMDAC : internal
+Submitter : <woju@keep.fan.bln.sub.org>
+Last Edit Date : Thu Oct 7 10:56:50 MET 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Diamond
+Card Model : SpeedStar PRO
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus 5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70ns (HY534256S-70; 9306A KOREA)
+Clock Chip : Cirrus built-in
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Cirrus Logic Built-in 15/16/24-bit DAC
+Submitter : Chris Metcalf <metcalf@lcs.mit.edu>
+Last Edit Date : Sun Sep 26 22:12:50 EDT 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Genoa Systems
+Card Model : WindowsVGA 24 8500VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic GD5426 (P/N: CL-GD5426-80QC-A)
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : Best guess 70ns (P/N: AAA1M304J-07)
+Clock Chip : Integrated
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.20 28.30 41.20 36.10 31.50 40.00 44.90 49.87
+Clocks (cont) : 65.00 72.20 75.00 80.00
+Option Flags :
+RAMDAC : Integrated
+Submitter : <scooper@noc.rutgers.edu>
+Last Edit Date : Oct 5, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Genoa
+Card Model : 8500VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus CLGD5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70 ns
+Clock Chip : internal
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : internal
+Submitter : Dave Kochan <slflq@cc.usu.edu>
+Last Edit Date : Oct. 5, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : No Name
+Card Model : Unmarked
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : CLGD5426
+Video Memory : 1MB+1MB
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns
+Clock Chip : builtin
+Programmable? (Y/N) : Y
+Number of clocks : 16
+Clocks : 25.23 28.32 41.16 36.08 31.5 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.17 80.05 85.23 90.20 94.95 100.23
+Option Flags : slow_ram
+RAMDAC : builtin (?)
+Submitter : Piercarlo Grandi <pcg@aber.ac.uk>
+Last Edit Date : 93/10/26
+#---------------------------------------------------------------------------#
+Card Vendor : TMC Research Corporation
+Card Model : HG426AV VESA Local(VL) Bus Graphics Card
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic 5426 BitBLT
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70 ns
+Clock Chip : Internal
+Programmable? : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08
+Clocks (cont) : 49.87 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Internal
+Submitter : Dilvan de A. Moreira <ddam@ukc.ac.uk>
+Last Edit Date : Oct 7, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Unspecified
+Card Model : AVGA3VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic GD5426-A
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns surface-mounted, and 8 x 70/80ns 256kx4
+Clock Chip : Cirrus, built-in
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.20 28.30 41.20 36.10 31.50 40.00 44.90 49.87
+Clocks (cont) : 65.00 72.20 75.00 80.00
+Option Flags :
+RAMDAC : Cirrus built-in
+Submitter : H. Hanemaayer <hhanemaa@cs.ruu.nl>
+Last Edit Date : Oct 26, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Genoa
+Card Model : 8500vl 18/24
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus CL-5428
+Video Memory : 2048k
+Memory Type (DRAM/VRA) : DRAM (2nd meg)/ VRAM (1st meg)
+Memory Speed : 60ns (1st), 80ns (2nd)
+Clock Chip : ?
+Programmable (Y/N) : ?
+Number of clocks : 16
+Clocks : ?
+Option Flags : ?
+RAMDAC : ?
+Submitter : John L. Clarke,III <jlc3@netcom.com>
+Last Edit Date : Oct 28, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : ?
+Card Model : PT-528
+Card Bus (ISA/EISA/VLB) : ?
+Chipset : Cirrus CL-5428
+Video Memory : 1024k
+Memory Type (DRAM/VRA) : DRAM (2nd meg)
+Memory Speed : ?
+Clock Chip : ?
+Programmable (Y/N) : ?
+Number of clocks : 13
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 48.08 49.87
+Clocks (cont) : 64.98 72.16 0.00 75.00 80.01
+Option Flags : ?
+RAMDAC : ?
+Submitter : Aled Davies <ssudavia@reading.ac.uk>
+Last Edit Date : Dec 15, 1993
+#---------------------------------------------------------------------------#
+# SVGA (Western Digital) #
+#---------------------------------------------------------------------------#
+Card Vendor : DFI Inc
+Card Model : VG-8000WH
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS90C64AV
+Programmable? (Y/N) :
+Number of clocks : 9
+Clocks : 25.20 28.32 65.50 36.30 40.30 50.30 32.20 45.00
+Clocks (cont) : 49.70
+Option Flags :
+RAMDAC : AT&T 20C492 15/16/18-bit DAC with gamma correction
+Submitter : Charlie Brady <charlieb@tplrd.tpl.oz.au>
+Last Edit Date : Thu Oct 7 19:26:31 EST 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Diamond
+Card Model : SpeedStar 24X
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD/Paradise 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 77.30 0.00 0.00 28.30 0.00 0.00
+Clocks (cont) : 50.50
+Option Flags :
+RAMDAC : Diamond SS2410
+Submitter : Mike Tierney <mjtiern@pepsi.eng.umd.edu>
+Last Edit Date : Oct 7, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : HP
+Card Model : 5/60LM
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : WD/Paradise 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 65.60 36.30 0.00 28.30 0.00 0.00
+Clocks (cont) : 49.70 (most bogus because of server probing problem)
+Option Flags :
+RAMDAC : ?
+Submitter : <skelton%jdp.UUCP@dragon.com>
+Last Edit Date : Nov 29, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : OCTEK
+Card Model : PVGA1D+
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD/Paradise 90C31-LR
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70nS
+Clock Chip : Avasem AV90C64N
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 65.10 35.60 0.00 49.90 32.10 45.00 44.50
+Option Flags :
+RAMDAC : Sierra 15/16/bit Hicolor
+Submitter : Antti Heinila <aheinila@vipunen.hut.fi>
+Last Edit Date : Nov 12, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Western Digital (on Viglen Motherboard)
+Card Model :
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : WD90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : unknown
+Memory Speed : unknown
+Clock Chip : unknwon
+Programmable? (Y/N) : unknwon
+Number of clocks : 8
+Clocks : 25.00 28.00 65.00 0.00 36.00 0.00 44.00
+Option Flags :
+RAMDAC :
+Submitter : row@uk.co.bnr
+Last Edit Date : Oct 14, 1993
+#---------------------------------------------------------------------------#
+Card Vendor : Western Digital
+Card Model : Accelerator for Windows
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD90c31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 9
+Clocks : 25 28 65 36 40 50 32 45 ??
+Option Flags :
+RAMDAC : Sierra HiColor (32k colors)
+Submitter : wmagro@uiuc.edu (William Magro)
+Last Edit Date : Nov 2, 1993
+
+#---------------------------------------------------------------------------#
+# Known clock synthesizer dot-clocks #
+#---------------------------------------------------------------------------#
+ATI 18811-0:
+ 42.95 48.77 92.4 36.0 50.35 56.64 0.0 44.9
+ 30.24 32.00 110.0 80.0 39.91 44.9 75.0 65.0
+ATI 18811-1:
+ 100.0 126.0 92.4 36.0 50.35 56.64 0.0 44.9
+ 135.0 32.0 110.0 80.0 39.91 44.9 75.0 65.0
+Avasem AV9194-56:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 72.0
+Avasem AV9194-07, AV9194-11:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Chrontel CH9294-G:
+ 25.175 28.322 40.0 72.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+ICS ICS2494-256:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 72.0
+ICS ICS2494-275, ICS2494-305:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+
+#---------------------------------------------------------------------------#
+# Blank form for new supported cards. Fill this in and mail in everything #
+# below header section. #
+#---------------------------------------------------------------------------#
+To: XFree86@XFree86.org
+Subject: New accelerated card database entry.
+
+Card Vendor :
+Card Model :
+Card Bus (ISA/EISA/VLB) :
+Chipset :
+Video Memory :
+Memory Type (DRAM/VRAM) :
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks :
+Clocks :
+Option Flags :
+RAMDAC :
+Submitter :
+Last Edit Date :
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/AccelCards,v 3.5 1996/12/23 06:44:36 dawes Exp $
+
+
+
+
+
+$XConsortium: AccelCards /main/4 1996/02/21 17:41:23 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/BUILD b/xc/programs/Xserver/hw/xfree86/doc/BUILD
new file mode 100644
index 000000000..dc95f9a77
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/BUILD
@@ -0,0 +1,196 @@
+ Building XFree86
+
+ David Dawes
+
+ 24 May 1997
+
+ Abstract
+
+ This document describes how to build XFree86 from the source dis-
+ tribution. It covers building from the full source distribution as
+ well as from the cut-down source distribution available for build-
+ ing only the X servers. It is designed to be used in conjunction
+ with the OS-specific README files.
+
+1. Building XFree86 From a Source Distribution
+
+ NOTE: Refer to the appropriate OS-specific README file before
+ attempting to build XFree86. These files contain additional infor-
+ mation that you may need to successfully build under your OS.
+
+We highly recommend using GCC-2 to build XFree86. Do not use version 2.6.0
+or 2.4.x versions prior to 2.4.5 due to bugs that cause either build or exe-
+cution failures. (gcc-2 is available from prep.ai.mit.edu and other sites
+archiving GNU source.)
+
+1.1 How to get the XFree86 3.3 source
+
+There are a few starting points for getting the XFree86 source. One option
+is to start directly with the XFree86 3.3 source distribution. In this case,
+the procedure is as follows:
+
+ o The XFree86 3.3 source is contained in files X33src-1.tgz, X33src-2.tgz
+ and X33src-3.tgz. These can be found at
+ ftp://ftp.xfree86.org/pub/XFree86/3.3/source/ and similar locations on
+ XFree86 mirror sites. X33src-2.tgz contains the fonts and documentation
+ source. X33src-3.tgz contains the hardcopy documentation. X33src-1.tgz
+ contains everything else. If you don't need the docs or fonts you can
+ get by with only X33src-1.tgz.
+
+ o Extract each of these files by running the following from a directory on
+ a filesystem containing enough space (the full source requires around
+ 130MB, and a similar amount is required in addition to this for the com-
+ piled binaries):
+
+ gzip -d < X33src-1.tgz | tar vxf -
+ gzip -d < X33src-2.tgz | tar vxf -
+ gzip -d < X33src-3.tgz | tar vxf -
+
+Another option is to start with the X11R6.3 source distribution and patch it
+up to XFree86 3.3. In this case you need to do the following:
+
+ o Start with the X Consortium's X11R6.3 distribution with public patch 1
+ applied. This can be obtained by following the links from the X home-
+ page <URL:http://www.x.org>.
+
+ o Get the files R6.3pl1-3.3.diff.gz and cfont33.tgz from
+ ftp://ftp.xfree86.org/pub/XFree86/3.3/patches/ (or a similar location on
+ mirror sites). To upgrade the source to XFree86 3.3, run the following
+ from directory containing the xc directory of the X11R6.3 pl1 source
+ tree:
+
+ gzip -d < R6.3pl1-3.3.diff.gz | patch -p0 -E
+ gzip -d < cfont33.tgz | tar vxf -
+
+ Be sure to do this with a clean unmodified source tree. If you don't
+ some patches may fail.
+
+If you only want to build the XFree86 X servers, you can use a cut-down ver-
+sion of the XFree86 source tree called the ``servers only'' distribution. If
+you choose this option, do the following:
+
+ o Get the X33servonly.tgz file from
+ ftp://ftp.xfree86.org/pub/XFree86/3.3/source/ (or a similar locations on
+ mirror sites.
+
+ o Extract this by running the following:
+
+ gzip -d < X33servonly.tgz | tar vxf -
+
+There is no patch to upgrade from the XFree86 3.2 source to 3.3. The reason
+for this is the large number of changes associated with the move from X11R6.1
+to X11R6.3.
+
+XFree86 supports a small subset of the X Consortium X11R6.1 contrib distribu-
+tion. If you wish to build this, you will need at least the following
+files/directories from that distribution:
+
+ contrib/Imakefile
+ contrib/programs/Imakefile
+ contrib/programs/ico
+ contrib/programs/listres
+ contrib/programs/showfont
+ contrib/programs/viewres
+ contrib/programs/xbiff
+ contrib/programs/xcalc
+ contrib/programs/xditview
+ contrib/programs/xedit
+ contrib/programs/xev
+ contrib/programs/xeyes
+ contrib/programs/xfontsel
+ contrib/programs/xgc
+ contrib/programs/xload
+ contrib/programs/xman
+ contrib/programs/xmessage
+
+You will also need the XFree86 patch contrib-3.3.diff.gz. To apply the
+patch, run the following from the directory containing the contrib directory:
+
+ gzip -d < contrib-3.3.diff.gz | patch -p0 -E
+
+If you wish to build the xtest distribution, get the souce distribution
+X33test.tgz from the XFree86 source directory, and extract it by running:
+
+ gzip -d < X33test.tgz | tar vxf -
+
+Note, xtest is no longer part of the core X11 distribution (since X11R6.3).
+
+1.2 Configuring the source before building
+
+It is recommended that you start the configuration process by going to the
+xc/config/cf directory, and copying the file xf86site.def to host.def. Then
+read through the host.def file (which is heavily commented), and set any
+parameters that you want for your configuration. You can usually find out
+what the default settings are by checking the .cf file(s) relevant to your
+OS.
+
+Unlike previous versions, imake can now automatically detect and set the var-
+ious OS*Version parameters, so you shouldn't need to enter those settings
+explicitly.
+
+If you are using just the X33src-1.tgz part of the source dist, you will need
+to define BuildFonts to NO.
+
+If you are using the ``servers only'' distribution, you will need to define
+BuildServersOnly to YES.
+
+1.3 Building and installing the distribution
+
+Before building the distribution, read through the OS-specific README file in
+xc/programs/Xserver/hw/xfree86/doc that is relevant to you. Once those OS-
+specific details have been taken care of, go the xc directory and run ``make
+World'' with the BOOTSTRAPCFLAGS set as described in the OS-specific README
+(if necessary). It is advisable to redirect stdout and stderr to World.Log
+so that you can track down problems that might occur during the build.
+
+When the build is finished, you should check World.Log to see if there were
+any problems. If there weren't any then you can install the binaries. When
+using the full source distribution, the installation should be done from the
+xc directory. When using the ``servers only'' distribution, the install
+should be done from the xc/programs/Xserver directory. To do the install,
+run ``make install'' and ``make install.man''. Make sure you have enough
+space in /usr/X11R6 for the install to succeed. If you want to install on a
+filesystem other than /usr, make a symbolic link to /usr/X11R6 before
+installing.
+
+To install the binary LinkKit (in /usr/X11R6/lib/Server), run ``make
+install.linkkit'' from the xc directory.
+
+To build the subset of the contrib release supported by XFree86, make sure
+that you have first built and installed the core distribution. Then go to
+the contrib directory and run ``xmkmf -a; make''. When that is completed,
+run ``make install'' and ``make install.man'' to install it.
+
+To build/run the xtest distribution, refer to the instructions in the file
+test/xsuite/NOTES.xf86.
+
+2. Reconfiguring the server (source distribution)
+
+To build a different set of servers or servers with a different set of
+drivers installed:
+
+ 1. Make sure the source for any new drivers is in the correct place (e.g.,
+ driver source for the SVGA server should be in a subdirectory of
+ xc/programs/Xserver/hw/xfree86/vga256/drivers).
+
+ 2. Change the settings of the server defines in host.def to specify which
+ servers you wish to build. Also, change the driver lists to suit your
+ needs.
+
+ 3. From xc/programs/Xserver, run:
+
+ make Makefile
+ make Makefiles
+ make depend
+ make
+
+3. Reconfiguring the server (binary distribution)
+
+If you have installed the server Binary LinkKit, it is possible to reconfig-
+ure the drivers and some of the extensions in the servers. For details of
+how to do this, please refer to the README.LinkKit file.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/BUILD.sgml,v 3.2 1997/05/24 13:46:34 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/BUILD,v 3.4 1999/04/15 03:34:43 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/BetaReport b/xc/programs/Xserver/hw/xfree86/doc/BetaReport
new file mode 100644
index 000000000..350babb70
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/BetaReport
@@ -0,0 +1,57 @@
+ XFree86 Beta Test Report Form
+
+Please fill in as many of the fields a possible, and return this form to
+report@XFree86.org. Replace the comments in [] with your own text.
+
+VERSION:
+
+3.2A
+
+XSERVER:
+
+[e.g. XF86_S3]
+
+OPERATING SYSTEM:
+
+[e.g. Linux]
+
+VIDEO CARD:
+
+ [Fill out each relevant entry. If you don't know some of the details,
+ just leave them blank.]
+
+ MODEL:
+
+ [Include a precise description of the model. There are often subtle
+ differences in card model names.]
+
+ GRAPHICS CHIPSET:
+
+ [e.g. S3 968]
+
+ RAMDAC:
+
+ [e.g. AT&T 20C498 Note: visual inspection of the card is the most
+ reliable way to determine the RAMDAC type]
+
+ CLOCKCHIP:
+
+ [e.g. ICD2061A Note: visual inspection of the card is the most reliable
+ way to determine the ClockChip type]
+
+ VIDEO MEMORY:
+
+ [e.g. 2MB DRAM Include both the amount, and type (if known)]
+
+ BUS TYPE:
+
+ [e.g. PCI]
+
+REPORT:
+
+ [Include details of any problems you encountered. If you didn't have
+ any problems, just say "no problems". Indicate what modes and colour
+ depths you tested. If you found a bug, give a description of how to
+ reproduce it.]
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/CODING b/xc/programs/Xserver/hw/xfree86/doc/CODING
new file mode 100644
index 000000000..9cc55215b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/CODING
@@ -0,0 +1,35 @@
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/CODING,v 3.6 1996/12/23 06:44:38 dawes Exp $
+ GNU indent options:
+
+-bad -bap -c40 -cd0 -ncdb -ci4 -cli0 -cp0 -ncs -d0
+-di4 -i4 -ip4 -l78 -nlp -npcs -psl -sob -ss -br -ce -sc
+
+-bad forces a blank line after every block of declarations.
+-bap forces a blank line after every procedure body.
+-c40 put comments to the right of code in column 40
+-cd0 put comments immediately to the right of the declarations.
+-ncdb do not put comment delimiters on blank lines
+-ci4 continuation indent of 4 spaces.
+-cli0 case label indent of 0 spaces
+-cp0 put comments immediately to the right of `#else' and `#endif' statements
+-ncs do not put a space after cast operators
+-d0 set indentation of comments not to the right of code to 0 spaces
+-di4 put variables in column 4
+-i4 set indentation level to 4 spaces
+-ip4 indent parameter types in old-style function definitions by 4 spaces
+-l78 set maximum line length to 78
+-nlp don't line up continued lines at parentheses
+-npcs do not put space after the function in function calls
+-psl put the type of a procedure on the line before its name
+-sob swallow optional blank lines
+-ss on one-line `for' and `while' statments, force a blank before the semicolo
+n
+-ce cuddle else and preceeding `}'
+-sc put the `*' character at the left of comments
+-br formats braces like this:
+
+ if (x > 0) {
+ x--;
+ }
+
+$XConsortium: CODING /main/2 1996/02/21 17:41:28 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/DESIGN b/xc/programs/Xserver/hw/xfree86/doc/DESIGN
new file mode 100644
index 000000000..8b09203f0
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/DESIGN
@@ -0,0 +1,5918 @@
+ XFree86 X server ``New Design'' (DRAFT)
+
+ The XFree86 Project, Inc
+
+ Last modified 17 July 1999
+
+NOTE: This is a DRAFT document, and the interfaces described here are subject
+to change without notice.
+
+1. Preface
+
+The broad design principles are:
+
+ o keep it reasonable
+
+ o We cannot rewrite the complete server
+
+ o We don't want to re-invent the wheel
+
+ o keep it modular
+
+ o As many things as possible should go into modules
+
+ o The basic loader binary should be minimal
+
+ o A clean design with well defined layering is important
+
+ o DDX specific global variables are a nono
+
+ o The structure should be flexible enough to allow future extensions
+
+ o The structure should minimize duplication of common code
+
+ o keep important features in mind
+
+ o multiple screens, including multiple instances of drivers
+
+ o mixing different color depths and visuals on different and ideally
+ even on the same screen
+
+ o better control of the PCI device used
+
+ o better config file parser
+
+ o get rid of all VGA compatibility assumptions
+
+Unless we find major deficiencies in the DIX layer, we should avoid making
+changes there.
+
+2. The XF86Config File
+
+The XF86Config file format is similar to the old format, with the following
+changes:
+
+2.1 Device section
+
+The Device sections are similar to what they used to be, and describe hard-
+ware-specific information for a single video card. Device Some new keywords
+are added:
+
+ Driver "drivername"
+ Specifies the name of the driver to be used for the card. This
+ is mandatory.
+
+ BusID "busslot"
+ Specifies uniquely the location of the card on the bus. The pur-
+ pose is to identify particular cards in a multi-headed configura-
+ tion. The format of the argument is intentionally vague, and may
+ be architecture dependent. For a PCI bus, it is something like
+ "bus:slot:func".
+
+A Device section is considered ``active'' if there is a reference to it in an
+active Screen section.
+
+2.2 Screen section
+
+The Screen sections are similar to what they used to be. They no longer have
+a Driver keyword, but an Identifier keyword is added. (The Driver keyword
+may be accepted in place of the Identifier keyword for compatibility pur-
+poses.) The identifier can be used to identify which screen is to be active
+when multiple Screen sections are present. It is possible to specify the
+active screen from the command line. A default is chosen in the absence of
+one being specified. A Screen section is considered ``active'' if there is a
+reference to it either from the command line, or from an active ServerLayout
+section.
+
+2.3 InputDevice section
+
+The InputDevice section is a new section that describes configuration infor-
+mation for input devices. It replaces the old Keyboard, Pointer and XInput
+sections. Like the Device section, it has two mandatory keywords: Identifier
+and Driver. For compatibility purposes the old Keyboard and Pointer sections
+are converted by the parser into InputDevice sections as follows:
+
+ Keyboard
+ Identifier "Implicit Core Keyboard"
+
+ Driver "keyboard"
+
+ Pointer
+ Identifier "Implicit Core Pointer"
+
+ Driver "mouse"
+
+An InputDevice section is considered active if there is a reference to it in
+an active ServerLayout section. An InputDevice section may also be refer-
+enced implicitly if there is no ServerLayout section, if the -screen command
+line options is used, or if the ServerLayout section doesn't reference any
+InputDevice sections. In this case, the first sections with drivers "key-
+board" and "mouse" are used as the core keyboard and pointer respectively.
+
+2.4 ServerLayout section
+
+The ServerLayout section is a new section that is used to identify which
+Screen sections are to be used in a multi-headed configuration, and the rela-
+tive layout of those screens. It also identifies which InputDevice sections
+are to be used. Each ServerLayout section has an identifier, a list of
+Screen section identifiers, and a list of InputDevice section identifiers.
+ServerFlags options may also be included in a ServerLayout section, making it
+possible to override the global values in the ServerFlags section.
+
+A ServerLayout section can be made active by being referenced on the command
+line. In the absence of this, a default will be chosen (the first one
+found). The screen names may optionally be followed by a number specifying
+the preferred screen number, and optionally by the names of the four screens
+adjacent to it. The order of these is top, bottom, left, right. When no
+screen number is specified, they are numbered according to the order in which
+they are listed. Here is an example of a ServerLayout section for two
+screens, with the second located to the right of the first:
+
+ Section "ServerLayout"
+ Identifier "Main Layout"
+ Screen "Screen 1" 0 "" "" "" "Screen 2"
+ Screen "Screen 2" 1
+ Screen "Screen 3"
+ EndSection
+
+2.5 Options
+
+Options are used more extensively. They may appear in most sections now.
+Options related to drivers can be present in the Screen, Device and Monitor
+sections and the Display subsections. The order of precedence is Display,
+Screen, Monitor, Device. Options have been extended to allow an optional
+value to be specified in addition to the option name. For more details about
+options, see the Options (section 10., page 1) section for details.
+
+3. Driver Interface
+
+The driver interface consists of a minimal set of entry points that are
+required based on the external events that the driver must react to. No non-
+essential structure is imposed on the way they are used beyond that. This is
+a significant difference compared with the old design.
+
+The entry points for drawing operations are already taken care of by the
+framebuffer code (including, XAA). Extensions and enhancements to frame-
+buffer code are outside the scope of this document.
+
+This approach to the driver interface provides good flexibility, but does
+increase the complexity of drivers. To help address this, the XFree86 common
+layer provides a set of ``helper'' functions to take care of things that most
+drivers need. These helpers help minimise the amount of code duplication
+between drivers. The use of helper functions by drivers is however optional,
+though encouraged. The basic philosophy behind the helper functions is that
+they should be useful to many drivers, that they should balance this against
+the complexity of their interface. It is inevitable that some drivers may
+find some helpers unsuitable and need to provide their own code.
+
+Events that a driver needs to react to are:
+
+ ScreenInit
+ An initialisation function is called from the DIX layer for each
+ screen at the start of each server generation.
+
+ Enter VT
+ The server takes control of the console.
+
+ Leave VT
+ The server releases control of the console.
+
+ Mode Switch
+ Change video mode.
+
+ ViewPort change
+ Change the origin of the physical view port.
+
+ ScreenSaver state change
+ Screen saver activation/deactivation.
+
+ CloseScreen
+ A close screen function is called from the DIX layer for each
+ screen at the end of each server generation.
+
+In addition to these events, the following functions are required by the
+XFree86 common layer:
+
+ Identify
+ Print a driver identifying message.
+
+ Probe
+ This is how a driver identifies if there is any hardware present
+ that it knows how to drive.
+
+ PreInit
+ Process information from the XF86Config file, determine the full
+ characteristics of the hardware, and determine if a valid config-
+ uration is present.
+
+The VidMode extension also requires:
+
+ ValidMode
+ Identify if a new mode is usable with the current configuration.
+ The PreInit function (and/or helpers it calls) may also make use
+ of the ValidMode function or something similar.
+
+Other extensions may require other entry points. The drivers will inform the
+common layer of these in such cases.
+
+4. Resource Access Control Introduction
+
+Graphics devices are accessed through ranges in I/O or memory space. While
+most modern graphics devices allow relocation of such ranges many of them
+still require the use of well established interfaces such as VGA memory and
+IO ranges or 8514/A IO ranges. With modern buses (like PCI) it is possible
+for multiple video devices to share access to these resources. The RAC
+(Resource Access Control) subsystem provides a mechanism for this.
+
+4.1 Terms and Definitions
+
+4.1.1 Bus
+
+``Bus'' is ambiguous as it is used for different things: it may refer to
+physical incompatible extension connectors in a computer system. The RAC
+system knows two such systems: The ISA bus and the PCI bus. (On the software
+level EISA, MCA and VL buses are currently treated like ISA buses). ``Bus''
+may also refer to logically different entities on a single bus system which
+are connected via bridges. A PCI system may have several distinct PCI buses
+connecting each other by PCI-PCI bridges or to the host CPU by HOST-PCI
+bridges.
+
+Systems that host more than one bus system link these together using bridges.
+Bridges are a concern to RAC as they might block or pass specific resources.
+PCI-PCI bridges may be set up to pass VGA resources to the secondary bus.
+PCI-ISA buses pass any resources not decoded on the primary PCI bus to the
+ISA bus. This way VGA resources (although exclusive on the ISA bus) can be
+shared by ISA and PCI cards. Currently HOST-PCI bridges are not yet handled
+by RAC as they require specific drivers.
+
+4.1.2 Entity
+
+The smallest independently addressable unit on a system bus is referred to as
+an entity. So far we know ISA and PCI entities. PCI entities can be located
+on the PCI bus by an unique ID consisting of the bus, card and function num-
+ber.
+
+4.1.3 Resource
+
+``Resource'' refers to a range of memory or I/O addresses an entity can
+decode.
+
+If a device is capable of disabling this decoding the resource is called
+sharable. For PCI devices a generic method is provided to control resource
+decoding. Other devices will have to provide a device specific function to
+control decoding.
+
+If the entity is capable of decoding this range at a different location this
+resource is considered relocatable.
+
+Resources which start at a specific address and occupy a single continuous
+range are called block resources.
+
+Alternatively resource addresses can be decoded in a way that they satisfy
+the conditions:
+
+ address & mask == base
+
+and
+
+ base & mask == base
+
+Resources addressed in such a way are called sparse resources.
+
+4.1.4 Server States
+
+The resource access control system knows two server states: the SETUP and the
+OPERATING state. The SETUP state is entered whenever a mode change takes
+place or the server exits or does VT switching. During this state all entity
+resources are under resource access control. During OPERATING state only
+those entities are controlled which actually have shared resources that con-
+flict with others.
+
+5. Control Flow in the Server and Mandatory Driver Functions
+
+At the start of each server generation, main() (dix/main.c) calls the DDX
+function InitOutput(). This is the first place that the DDX gets control.
+InitOutput() is expected to fill in the global screenInfo struct, and one
+screenInfo.screen[] entry for each screen present. Here is what InitOutput()
+does:
+
+5.1 Parse the XF86Config file
+
+This is done at the start of the first server generation only.
+
+The XF86Config file is read in full, and the resulting information stored in
+data structures. None of the parsed information is processed at this point.
+The parser data structures are opaque to the video drivers and to most of the
+common layer code.
+
+The entire file is parsed first to remove any section ordering requirements.
+
+5.2 Initial processing of parsed information and command line options
+
+This is done at the start of the first server generation only.
+
+The initial processing is to determine paths like the ModulePath, etc, and to
+determine which ServerLayout, Screen and Device sections are active.
+
+5.3 Enable port I/O access
+
+Port I/O access is controlled from the XFree86 common layer, and is ``all or
+nothing''. It is enabled prior to calling driver probes, at the start of
+subsequent server generations, and when VT switching back to the Xserver. It
+is disabled at the end of server generations, and when VT switching away from
+the Xserver.
+
+The implementation details of this may vary on different platforms.
+
+5.4 General bus probe
+
+This is done at the start of the first server generation only.
+
+In the case of ix86 machines, this will be a general PCI probe. The full
+information obtained here will be available to the drivers. This information
+persists for the life of the Xserver. In the PCI case, the PCI information
+for all video cards found is available by calling xf86GetPciVideoInfo().
+
+ pciVideoPtr *xf86GetPciVideoInfo(void)
+
+ returns a pointer to a list of pointers to pciVideoRec
+ entries, of which there is one for each detected PCI
+ video card. The list is terminated with a NULL pointer.
+ If no PCI video cards were detected, the return value is
+ NULL.
+
+After the bus probe, the resource broker is initialised.
+
+5.5 Load initial set of modules
+
+This is done at the start of the first server generation only.
+
+The core server contains a list of mandatory modules. These are loaded
+first. Currently the only module on this list is the bitmap font module.
+
+The next set of modules loaded are those specified explicitly in the Module
+section of the config file.
+
+The final set of initial modules are the driver modules referenced by the
+active Device and InputDevice sections in the config file. Each of these
+modules is loaded exactly once.
+
+5.6 Register Video and Input Drivers
+
+This is done at the start of the first server generation only.
+
+When a driver module is loaded, the loader calls its Setup function. For
+video drivers, this function calls xf86AddDriver() to register the driver's
+DriverRec, which contains a small set of essential details and driver entry
+points required during the early phase of InitOutput(). xf86AddDriver() adds
+it to the global xf86DriverList[] array.
+
+The DriverRec contains the driver's version, a short descriptive message, the
+Identify() and Probe() function entry points as well as a pointer to the
+driver's module (as returned from the loader when the driver was loaded) and
+a reference count which keeps track of how many screens are using the driver.
+The entry driver entry points are those required prior to the driver allocat-
+ing and filling in its ScrnInfoRec.
+
+For a static server, the xf86DriverList[] array is initialised at build time,
+and the loading of modules is not done.
+
+A similar procedure is used for input drivers. The input driver's Setup
+function calls xf86AddInputDriver() to register the driver's InputDriverRec,
+which contains a small set of essential details and driver entry points
+required during the early phase of InitInput(). xf86AddInputDriver() adds it
+to the global xf86InputDriverList[] array. For a static server, the
+xf86InputDriverList[] array is initialised at build time.
+
+Both the xf86DriverList[] and xf86InputDriverList[] arrays have been ini-
+tialised by the end of this stage.
+
+Once all the drivers are registered, their ChipIdentify() functions are
+called.
+
+ void ChipIdentify(int flags)
+
+ This is expected to print a message indicating the driver
+ name, a short summary of what it supports, and a list of
+ the chipset names that it supports. It may use the
+ xf86PrintChipsets() helper to do this.
+
+ void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+
+ SymTabPtr chips)
+
+ This function provides an easy way for a driver's ChipI-
+ dentify function to format the identification message.
+
+5.7 Initialise Access Control
+
+This is done at the start of the first server generation only.
+
+The Resource Access Control (RAC) subsystem is initialised before calling any
+driver functions that may access hardware. All generic bus information is
+probed and saved (for restoration later). All (shared resource) video
+devices are disabled at the generic bus level, and a probe is done to find
+the ``primary'' video device. These devices remain disabled for the next
+step.
+
+5.8 Video Driver Probe
+
+This is done at the start of the first server generation only. The Chip-
+Probe() function of each registered video driver is called.
+
+ Bool ChipProbe(DriverPtr drv, int flags)
+
+ The purpose of this is to identify all instances of hard-
+ ware supported by the driver. The flags value is cur-
+ rently not used, and should be ignored by the driver.
+
+ The probe must find the active device sections that match
+ the driver by calling xf86MatchDevice(). The number of
+ matches found limits the maximum number of instances for
+ this driver. If no matches are found, the problem should
+ return FALSE immediately.
+
+ Devices that cannot be identified by using device-inde-
+ pendent methods should be probed at this stage (keeping
+ in mind that access to all resources that can be disabled
+ in a device-independent way are disabled during this
+ phase). The probe must be a minimal probe. It should
+ just determine if there is a card present that the driver
+ can drive. It should use the least intrusive probe meth-
+ ods possible. It must not do anything that is not essen-
+ tial, like probing for other details such as the amount
+ of memory installed, etc. It is recommended that the
+ xf86MatchPciInstances() helper function be used for iden-
+ tifying matching PCI devices, and similarly the
+ xf86MatchIsaInstances() for ISA (non-PCI) devices (see
+ the RAC (section 9., page 1) section). These helpers
+ also checks and claims the appropriate entity. When not
+ using the helper, that should be done with xf86CheckPciS-
+ lot() and xf86ClaimPciSlot() for PCI devices and
+ xf86ClaimIsaSlot() for ISA devices (see the RAC (section
+ 9., page 1) section).
+
+ The probe must register all non-relocatable resources at
+ this stage. If a resource conflict is found between
+ exclusive resources the driver will fail immediately.
+ This is usually best done with the xf86ConfigActivePciEn-
+ tity() helper function for PCI and xf86ConfigActiveIsaEn-
+ tity() for ISA (see the RAC (section 9., page 1) sec-
+ tion). It is possible to register some entity specific
+ functions with those helpers. When not using the
+ helpers, the xf86AddEntityToScreen() xf86ClaimFixe-
+ dResources() and xf86SetEntityFuncs() should be used
+ instead (see the RAC (section 9., page 1) section).
+
+ If a chipset is specified in an active device section
+ which the driver considers relevant (ie it has no driver
+ specified, or the driver specified matches the driver
+ doing the probe), the Probe must return FALSE if the
+ chipset doesn't match one supported by the driver.
+
+ If there are no active device sections that the driver
+ considers relevant, it must return FALSE.
+
+ Allocate a ScrnInfoRec for each instance of the hardware
+ found, and fill in the basic information, including the
+ other driver entry points. The xf86AllocateScreen()
+ function must be used to allocate the ScrnInfoRec, and it
+ takes care of initialising fields to defined ``unused''
+ values.
+
+ Claim the entities for each instance of the hardware
+ found. This prevents other drivers from claiming the
+ same hardware.
+
+ Must leave hardware in the same state it found it in, and
+ must not do any hardware initialisation.
+
+ All detection can be overridden via the config file, and
+ that parsed information is available to the driver at
+ this stage.
+
+ Returns TRUE if one or more instances are found, and
+ FALSE otherwise.
+
+ int xf86MatchDevice(const char *drivername,
+
+ GDevPtr **driversectlist)
+
+ This function takes the name of the driver and returns
+ via driversectlist a list of device sections that match
+ the driver name. The function return value is the number
+ of matches found. If a fatal error is encountered the
+ return value is -1.
+
+ The caller should use xfree() to free *driversectlist
+ when it is no longer needed.
+
+ ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags)
+
+ This function allocates a new ScrnInfoRec in the
+ xf86Screens[] array. This function is normally called by
+ the video driver ChipProbe() functions. The return value
+ is a pointer to the newly allocated ScrnInfoRec. The
+ scrnIndex, origIndex, module and drv fields are ini-
+ tialised. The reference count in drv is incremented.
+ The storage for any currently allocated ``privates''
+ pointers is also allocated and the privates field ini-
+ tialised (the privates data is of course not allocated or
+ initialised). This function never returns on failure.
+ If the allocation fails, the server exits with a fatal
+ error. The flags value is not currently used, and should
+ be set to zero.
+
+At the completion of this, a list of ScrnInfoRecs have been allocated in the
+xf86Screens[] array, and the associated entities and fixed resources have
+been claimed. The following ScrnInfoRec fields must be initialised at this
+point:
+
+ driverVersion
+ driverName
+ scrnIndex(*)
+ origIndex(*)
+ drv(*)
+ module(*)
+ name
+ Probe
+ PreInit
+ ScreenInit
+ EnterVT
+ LeaveVT
+ numEntities
+ entityList
+ access
+
+(*) These are initialised when the ScrnInfoRec is allocated, and not explic-
+itly by the driver.
+
+The following ScrnInfoRec fields must be initialised if the driver is going
+to use them:
+
+ SwitchMode
+ AdjustFrame
+ FreeScreen
+ ValidMode
+
+5.9 Matching Screens
+
+This is done at the start of the first server generation only.
+
+After the Probe phase is finished, there will be some number of ScrnInfoRecs.
+These are then matched with the active Screen sections in the XF86Config, and
+those not having an active Screen section are deleted. If the number of
+remaining screens is 0, InitOutput() sets screenInfo.numScreens to 0 and
+returns.
+
+At this point the following fields of the ScrnInfoRecs must be initialised:
+
+ confScreen
+
+5.10 Allocate non-conflicting resources
+
+This is done at the start of the first server generation only.
+
+Before calling the drivers again, the resource information collected from the
+Probe phase is processed. This includes checking the extent of PCI resources
+for the probed devices, and resolving any conflicts in the relocatable PCI
+resources. It also reports conflicts, checks bus routing issues, and any-
+thing else that is needed to enable the entities for the next phase.
+
+If any drivers registered an EntityInit() function during the Probe phase,
+then they are called here.
+
+5.11 Sort the Screens and pre-check Monitor Information
+
+This is done at the start of the first server generation only.
+
+The list of screens is sorted to match the ordering requested in the config
+file.
+
+The list of modes for each active monitor is checked against the monitor's
+parameters. Invalid modes are pruned.
+
+5.12 PreInit
+
+This is done at the start of the first server generation only.
+
+For each ScrnInfoRec, enable access to the screens entities and call the
+ChipPreInit() function.
+
+ Bool ChipPreInit(ScrnInfoRec screen, int flags)
+
+ The purpose of this function is to find out all the
+ information required to determine if the configuration is
+ usable, and to initialise those parts of the ScrnInfoRec
+ that can be set once at the beginning of the first server
+ generation.
+
+ The number of entities registered for the screen should
+ be checked against the expected number (most drivers
+ expect only one). The entity information for each of
+ them should be retrieved (with xf86GetEntityInfo()) and
+ checked for the correct bus type and that none of the
+ sharable resources registered during the Probe phase was
+ rejected.
+
+ Access to resources for the entities that can be con-
+ trolled in a device-independent way are enabled before
+ this function is called. If the driver needs to access
+ any resources that it has disabled in an EntityInit()
+ function that it registered, then it may enable them here
+ providing that it disables them before this function
+ returns.
+
+ This includes probing for video memory, clocks, ramdac,
+ and all other HW info that is needed. It includes deter-
+ mining the depth/bpp/visual and related info. It
+ includes validating and determining the set of video
+ modes that will be used (and anything that is required to
+ determine that).
+
+ This information should be determined in the least intru-
+ sive way possible. The state of the HW must remain
+ unchanged by this function. Although video memory
+ (including MMIO) may be mapped within this function, it
+ must be unmapped before returning. Driver specific
+ information should be stored in a structure hooked into
+ the ScrnInfoRec's driverPrivate field. Any other modules
+ which require persistent data (ie data that persists
+ across server generations) should be initialised in this
+ function, and they should allocate a ``privates'' index
+ to hook their data into by calling xf86AllocateScrnInfo-
+ PrivateIndex(). The ``privates'' data is persistent.
+
+ Helper functions for some of these things are provided at
+ the XFree86 common level, and the driver can choose to
+ make use of them.
+
+ All additional resources that the screen needs must be
+ registered here. This should be done with xf86Register-
+ Resources(). If some of the fixed resources registered
+ in the Probe phase are not needed or not decoded by the
+ hardware when in the OPERATING server state, their status
+ should be updated with xf86SetOperatingState().
+
+ Modules may be loaded at any point in this function, and
+ all modules that the driver will need must be loaded
+ before the end of this function. The xf86LoadSubModule()
+ function should be used to load modules. A driver may
+ unload a module within this function if it was only
+ needed temporarily, and the UnloadSubModule() function
+ should be used to do that. Otherwise there is no need to
+ explicitly unload modules because the loader takes care
+ of module dependencies and will unload submodules auto-
+ matically if/when the driver module is unloaded.
+
+ The bulk of the ScrnInfoRec fields should be filled out
+ in this function.
+
+ ChipPreInit() returns FALSE when the configuration is
+ unusable in some way (unsupported depth, no valid modes,
+ not enough video memory, etc), and TRUE if it is usable.
+
+ It is expected that if the ChipPreInit() function returns
+ TRUE, then the only reasons that subsequent stages in the
+ driver might fail are lack or resources (like xalloc
+ failures). All other possible reasons for failure should
+ be determined by the ChipPreInit() function.
+
+The ScrnInfoRecs for screens where the ChipPreInit() fails are removed. If
+none remain, InitOutput() sets screenInfo.numScreens to 0 and returns.
+
+At this point, further fields of the ScrnInfoRecs would normally be filled
+in. Most are not strictly mandatory, but many are required by other layers
+and/or helper functions that the driver may choose to use. The documentation
+for those layers and helper functions indicates which they require.
+
+The following fields of the ScrnInfoRecs should be filled in if the driver is
+going to use them:
+
+ monitor
+ display
+ depth
+ pixmapBPP
+ bitsPerPixel
+ weight (>8bpp only)
+ mask (>8bpp only)
+ offset (>8bpp only)
+ rgbBits (8bpp only)
+ gamma
+ defaultVisual
+ maxHValue
+ maxVValue
+ virtualX
+ virtualY
+ displayWidth
+ frameX0
+ frameY0
+ frameX1
+ frameY1
+ zoomLocked
+ modePool
+ modes
+ currentMode
+ progClock (TRUE if clock is programmable)
+ chipset
+ ramdac
+ clockchip
+ numClocks (if not programmable)
+ clock[] (if not programmable)
+ videoRam
+ biosBase
+ memBase
+ memClk
+ driverPrivate
+ chipID
+ chipRev
+
+ pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name):
+
+ Load a module that a driver depends on. This function
+ loads the module name as a sub module of the driver. The
+ return value is a handle identifying the new module. If
+ the load fails, the return value will be NULL. If a
+ driver needs to explicitly unload a module it has loaded
+ in this way, the return value must be saved and passed to
+ UnloadSubModule() when unloading.
+
+ void UnloadSubModule(pointer module)
+
+ Unloads the module referenced by module. module should
+ be a pointer returned previously by xf86LoadSubModule().
+
+5.13 Cleaning up Unused Drivers
+
+At this point it is known which screens will be in use, and which drivers are
+being used. Unreferenced drivers (and modules they may have loaded) are
+unloaded here.
+
+5.14 Consistency Checks
+
+The parameters that must be global to the server, like pixmap formats, bitmap
+bit order, bitmap scanline unit and image byte order are compared for each of
+the screens. If a mismatch is found, the server exits with an appropriate
+message.
+
+5.15 Check of Resource Control is Needed
+
+Determine if resource access control is needed. This is the case if more
+than one screen is used. If necessary the RAC wrapper module is loaded.
+
+5.16 AddScreen (ScreenInit)
+
+At this point, the valid screens are known. AddScreen() is called for each
+of them, passing ChipScreenInit() as the argument. AddScreen() is a DIX
+function that allocates a new screenInfo.screen[] entry (aka pScreen), and
+does some basic initialisation of it. It then calls the ChipScreenInit()
+function, with pScreen as one of its arguments. If ChipScreenInit() returns
+FALSE, AddScreen() returns -1. Otherwise it returns the index of the screen.
+AddScreen() should only fail because of programming errors or failure to
+allocate resources (like memory). All configuration problems should be
+detected BEFORE this point.
+
+ Bool ChipScreenInit(int index, ScreenPtr pScreen,
+
+ int argc, char **argv)
+
+ This is called at the start of each server generation.
+
+ Fill in all of pScreen, possibly doing some of this by
+ calling ScreenInit functions from other layers like mi,
+ framebuffers (cfb, etc), and extensions.
+
+ Decide which operations need to be placed under resource
+ access control. The classes of operations are the frame
+ buffer operations (RAC_FB), the pointer operations
+ (RAC_CURSOR), the viewport change operations (RAC_VIEW-
+ PORT) and the colormap operations (RAC_COLORMAP). Any
+ operation that requires resources which might be disabled
+ during OPERATING state should be set to use RAC. This
+ can be specified separately for memory and IO resources
+ (the racMemFlags and racIoFlags fields of the ScrnInfoRec
+ respectively).
+
+ Map any video memory or other memory regions.
+
+ Save the video card state. Enough state must be saved so
+ that the original state can later be restored.
+
+ Initialise the initial video mode. The ScrnInfoRec's
+ vtSema field should be set to TRUE just prior to changing
+ the video hardware's state.
+
+The ChipScreenInit() function (or functions from other layers that it calls)
+should allocate entries in the ScreenRec's devPrivates area by calling Allo-
+cateScreenPrivateIndex() if it needs per-generation storage. Since the
+ScreenRec's devPrivates information is cleared for each server generation,
+this is the correct place to initialise it.
+
+After AddScreen() has successfully returned, the following ScrnInfoRec fields
+are initialised:
+
+ pScreen
+ racMemFlags
+ racIoFlags
+
+The ChipScreenInit() function should initialise the CloseScreen and Save-
+Screen fields of pScreen. The old value of pScreen->CloseScreen should be
+saved as part of the driver's per-screen private data, allowing it to be
+called from ChipCloseScreen(). This means that the existing CloseScreen()
+function is wrapped.
+
+5.17 Finalising RAC Initialisation
+
+After all the ChipScreenInit() functions have been called, each screen has
+registered its RAC requirements. This information is used to determine which
+shared resources are requested by more than one driver and set the access
+functions accordingly. This is done following these rules:
+
+ 1. The sharable resources registered by each entity are compared. If a
+ resource is registered by more than one entity the entity will be
+ marked to indicate that it needs to share this resources type (IO or
+ MEM).
+
+ 2. A resource marked ``disabled'' during OPERATING state will be ignored
+ entirely.
+
+ 3. A resource marked ``unused'' will only conflict with an overlapping
+ resource of an other entity if the second is actually in use during
+ OPERATING state.
+
+ 4. If an ``unused'' resource was found to conflict but the entity does not
+ use any other resource of this type the entire resource type will be
+ disabled for that entity.
+
+5.18 Finishing InitOutput()
+
+At this point InitOutput() is finished, and all the screens have been setup
+in their initial video mode.
+
+5.19 Mode Switching
+
+When a SwitchMode event is received, ChipSwitchMode() is called (when it
+exists):
+
+ Bool ChipSwitchMode(int index, DisplayModePtr mode, int flags)
+
+ Initialises the new mode for the screen identified by
+ index;. The viewport may need to be adjusted also.
+
+5.20 Changing Viewport
+
+When a Change Viewport event is received, ChipAdjustFrame() is called (when
+it exists):
+
+ void ChipAdjustFrame(int index, int x, int y, int flags)
+
+ Changes the viewport for the screen identified by index;.
+
+5.21 VT Switching
+
+When a VT switch event is received, xf86VTSwitch() is called. xf86VTSwitch()
+does the following:
+
+ On ENTER:
+
+ o enable port I/O access
+
+ o save and initialise the bus/resource state
+
+ o enter the SETUP server state
+
+ o calls ChipEnterVT() for each screen
+
+ o enter the OPERATING server state
+
+ o validate GCs
+
+ o Restore fb from saved pixmap for each screen
+
+ o Enable all input devices
+
+ On LEAVE:
+
+ o Save fb to pixmap for each screen
+
+ o validate GCs
+
+ o enter the SETUP server state
+
+ o calls ChipLeaveVT() for each screen
+
+ o disable all input devices
+
+ o restore bus/resource state
+
+ o disables port I/O access
+
+ Bool ChipEnterVT(int index, int flags)
+
+ This function should map memory regions, initialise the
+ current video mode and initialise the viewport, turn on
+ the HW cursor if appropriate, etc.
+
+ Should it re-save the video state before initialising the
+ video mode?
+
+ void ChipLeaveVT(int index, int flags)
+
+ This function should restore the saved video state and
+ unmap the memory regions. If appropriate it should also
+ turn off the HW cursor, and invalidate any pixmap/font
+ caches.
+
+Other layers may wrap the ChipEnterVT() and ChipLeaveVT() functions if they
+need to take some action when these events are received.
+
+5.22 End of server generation
+
+At the end of each server generation, the DIX layer calls ChipCloseScreen()
+for each screen:
+
+ Bool ChipCloseScreen(int index, ScreenPtr pScreen)
+
+ This function should restore the saved video state and
+ unmap the memory regions.
+
+ It should also free per-screen data structures allocated
+ by the driver. Note that the persistent data held in the
+ ScrnInfoRec's driverPrivate field should not be freed
+ here because it is needed by subsequent server genera-
+ tions.
+
+ The ScrnInfoRec's vtSema field should be set to FALSE
+ once the video HW state has been restored.
+
+ Before freeing the per-screen driver data the saved Clos-
+ eScreen value should be restored to pScreen->CloseScreen,
+ and that function should be called after freeing the
+ data.
+
+6. Optional Driver Functions
+
+The functions outlined here can be called from the XFree86 common layer, but
+their presence is optional.
+
+6.1 Mode Validation
+
+When a mode validation helper supplied by the XFree86-common layer is being
+used, it can be useful to provide a function to check for hw specific mode
+constraints:
+
+ ModeStatus ChipValidMode(int index, DisplayModePtr mode,
+
+ Bool verbose, int flags)
+
+ Check the passed mode for hw-specific constraints, and
+ return the appropriate status value.
+
+6.2 Free screen data
+
+When a screen is deleted prior to the completion of the ScreenInit phase the
+ChipFreeScreen() function is called when defined.
+
+ void ChipFreeScreen(int scrnindex, int flags)
+
+ Free any driver-allocated data that may have been allo-
+ cated up to and including an unsuccessful Chip-
+ ScreenInit() call. This would predominantly be data
+ allocated by ChipPreInit() that persists across server
+ generations. It would include the driverPrivate, and any
+ ``privates'' entries that modules may have allocated.
+
+7. Recommended driver functions
+
+The functions outlined here are for internal use by the driver only. They
+are entirely optional, and are never accessed directly from higher layers.
+The sample function declarations shown here are just examples. The interface
+(if any) used is up to the driver.
+
+7.1 Save
+
+Save the video state. This could be called from ChipScreenInit() and (possi-
+bly) ChipEnterVT().
+
+ void ChipSave(ScrnInfoPtr pScrn)
+
+ Saves the current state. This will only be saving pre-
+ server states or states before returning to the server.
+ There is only one current saved state per screen and it
+ is stored in private storage in the screen.
+
+7.2 Restore
+
+Restore the original video state. This could be called from the
+ChipLeaveVT() and ChipCloseScreen() functions.
+
+ void ChipRestore(ScrnInfoPtr pScrn)
+
+ Restores the saved state from the private storage. Usu-
+ ally only used for restoring text modes.
+
+7.3 Initialise Mode
+
+Initialise a video mode. This could be called from the ChipScreenInit(),
+ChipSwitchMode() and ChipEnterVT() functions.
+
+ Bool ChipModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ Programs the hardware for the given video mode.
+
+8. Data and Data Structures
+
+8.1 Command line data
+
+Command line options are typically global, and are stored in global vari-
+ables. These variables are read-only and are available to drivers via a
+function call interface. Most of these command line values are processed via
+helper functions to ensure that they are treated consistently by all drivers.
+The other means of access is provided for cases where the supplied helper
+functions might not be appropriate.
+
+Some of them are:
+
+ xf86Verbose verbosity level
+ xf86Bpp -bpp from the command line
+ xf86Depth -depth from the command line
+ xf86Weight -weight from the command line
+ xf86Gamma -{r,g,b,}gamma from the command line
+ xf86FlipPixels -flippixels from the command line
+ xf86ProbeOnly -probeonly from the command line
+ defaultColorVisualClass -cc from the command line
+
+If we ever do allow for screen-specific command line options, we may need to
+rethink this.
+
+These can be accessed in a read-only manner by drivers with the following
+functions:
+
+ int xf86GetVerbosity()
+
+ Returns the value of xf86Verbose.
+
+ int xf86GetDepth()
+
+ Returns the -depth command line setting. If not set on
+ the command line, -1 is returned.
+
+ rgb xf86GetWeight()
+
+ Returns the -weight command line setting. If not set on
+ the command line, {0, 0, 0} is returned.
+
+ Gamma xf86GetGamma()
+
+ Returns the -gamma or -rgamma, -ggamma, -bgamma command
+ line settings. If not set on the command line, {0.0,
+ 0.0, 0.0} is returned.
+
+ Bool xf86GetFlipPixels()
+
+ Returns TRUE if -flippixels is present on the command
+ line, and FALSE otherwise.
+
+ const char *xf86GetServerName()
+
+ Returns the name of the X server from the command line.
+
+8.2 Data handling
+
+Config file data contains parts that are global, and parts that are Screen
+specific. All of it is parsed into data structures that neither the drivers
+or most other parts of the server need to know about.
+
+The global data is typically not required by drivers, and as such, most of it
+is stored in the private xf86InfoRec.
+
+The screen-specific data collected from the config file is stored in screen,
+device, display, monitor-specific data structures that are separate from the
+ScrnInfoRecs, with the appropriate elements/fields hooked into the ScrnIn-
+foRecs as required. The screen config data is held in confScreenRec, device
+data in the GDevRec, monitor data in the MonRec, and display data in the Dis-
+pRec.
+
+The XFree86 common layer's screen specific data (the actual data in use for
+each screen) is held in the ScrnInfoRecs. As has been outlined above, the
+ScrnInfoRecs are allocated at probe time, and it is the responsibility of the
+Drivers' Probe() and PreInit() functions to finish filling them in based on
+both data provided on the command line and data provided from the Config
+file. The precedence for this is:
+
+ command line -> config file -> probed/default data
+
+For most things in this category there are helper functions that the drivers
+can use to ensure that the above precedence is consistently used.
+
+As well as containing screen-specific data that the XFree86 common layer
+(including essential parts of the server infrastructure as well as helper
+functions) needs to access, it also contains some data that drivers use
+internally. When considering whether to add a new field to the ScrnInfoRec,
+consider the balance between the convenience of things that lots of drivers
+need and the size/obscurity of the ScrnInfoRec.
+
+Per-screen driver specific data that cannot be accommodated with the static
+ScrnInfoRec fields is held in a driver-defined data structure, a pointer to
+which is assigned to the ScrnInfoRec's driverPrivate field. This is per-
+screen data that persists across server generations (as does the bulk of the
+static ScrnInfoRec data). It would typically also include the video card's
+saved state.
+
+Per-screen data for other modules that the driver uses (for example, the XAA
+module) that is reset for each server generation is hooked into the ScrnIn-
+foRec through it's privates field.
+
+Once it has stabilised, the data structures and variables accessible to video
+drivers will be documented here. In the meantime, those things defined in
+the xf86.h and xf86str.h files are visible to video drivers. Things defined
+in xf86Priv.h and xf86Privstr.h are NOT intended to be visible to video
+drivers, and it is an error for a driver to include those files.
+
+8.3 Accessing global data
+
+Some other global state information that the drivers may access via functions
+is as follows:
+
+ Bool xf86ServerIsExiting()
+
+ Returns TRUE if the server is at the end of a generation
+ and is in the process of exiting, and FALSE otherwise.
+
+ Bool xf86ServerIsResetting()
+
+ Returns TRUE if the server is at the end of a generation
+ and is in the process of resetting, and FALSE otherwise.
+
+ Bool xf86ServerIsInitialising()
+
+ Returns TRUE if the server is at the beginning of a gen-
+ eration and is in the process of initialising, and FALSE
+ otherwise.
+
+ Bool xf86ServerIsOnlyProbing()
+
+ Returns TRUE if the -probeonly command line flag was
+ specified, and FALSE otherwise.
+
+ Bool xf86CaughtSignal()
+
+ Returns TRUE if the server has caught a signal, and FALSE
+ otherwise.
+
+8.4 Allocating private data
+
+A driver and any module it uses may allocate per-screen private storage in
+either the ScreenRec (DIX level) or ScrnInfoRec (XFree86 common layer level).
+ScreenRec storage persists only for a single server generation, and ScrnIn-
+foRec storage persists across generations for the lifetime of the server.
+
+The ScreenRec devPrivates data must be reallocated/initialised at the start
+of each new generation. This is normally done from the ChipScreenInit()
+function, and Init functions for other modules that it calls. Data allocated
+in this way should be freed by the driver's ChipCloseScreen() functions, and
+Close functions for other modules that it calls. A new devPrivates entry is
+allocated by calling the AllocateScreenPrivateIndex() function.
+
+ int AllocateScreenPrivateIndex()
+
+ This function allocates a new element in the devPrivates
+ field of all currently existing ScreenRecs. The return
+ value is the index of this new element in the devPrivates
+ array. The devPrivates field is of type DevUnion:
+
+ typedef union _DevUnion {
+ pointer ptr;
+ long val;
+ unsigned long uval;
+ pointer (*fptr)(void);
+ } DevUnion;
+
+ which allows the element to be used for any of the above
+ types. It is commonly used as a pointer to data that the
+ caller allocates after the new index has been allocated.
+
+ This function will return -1 when there is an error allo-
+ cating the new index.
+
+The ScrnInfoRec privates data persists for the life of the server, so only
+needs to be allocated once. This should be done from the ChipPreInit() func-
+tion, and Init functions for other modules that it calls. Data allocated in
+this way should be freed by the driver's ChipFreeScreen() functions, and Free
+functions for other modules that it calls. A new privates entry is allocated
+by calling the xf86AllocateScrnInfoPrivateIndex() function.
+
+ int xf86AllocateScrnInfoPrivateIndex()
+
+ This function allocates a new element in the privates
+ field of all currently existing ScrnInfoRecs. The return
+ value is the index of this new element in the privates
+ array. The privates field is of type DevUnion:
+
+ typedef union _DevUnion {
+ pointer ptr;
+ long val;
+ unsigned long uval;
+ pointer (*fptr)(void);
+ } DevUnion;
+
+ which allows the element to be used for any of the above
+ types. It is commonly used as a pointer to data that the
+ caller allocates after the new index has been allocated.
+
+ This function will not return when there is an error
+ allocating the new index. When there is an error it will
+ cause the server to exit with a fatal error. The similar
+ function for allocation privates in the ScreenRec (Allo-
+ cateScreenPrivateIndex()) differs in this respect by
+ returning -1 when the allocation fails.
+
+9. Keeping Track of Bus Resources
+
+9.1 Theory of Operation
+
+The XFree86 common layer has knowledge of generic access control mechanisms
+for devices on certain bus systems (currently the PCI bus) as well as of
+methods to enable or disable access to the buses itself. Furthermore it can
+access information on resources decoded by these devices and if necessary
+modify it.
+
+When first starting the Xserver collects all this information, saves it for
+restoration, checks it for consistency, and if necessary, corrects it.
+Finally it disables all resources on a generic level prior to calling any
+driver function.
+
+When the Probe() function of each driver is called the device sections are
+matched against the devices found in the system. The driver may probe
+devices at this stage that cannot be identified by using device independent
+methods. Access to all resources that can be controlled in a device indepen-
+dent way is disabled. The Probe() function should register all non-relocat-
+able resources at this stage. If a resource conflict is found between exclu-
+sive resources the driver will fail immediately. Optionally the driver might
+specify an EntityInit(), EntityLeave() and EntityEnter() function.
+
+EntityInit() can be used to disable any shared resources that are not con-
+trolled by the generic access control functions. It is called prior to the
+PreInit phase regardless if an entity is active or not. When calling the
+EntityInit(), EntityEnter() and EntityLeave() functions the common level will
+disable access to all other entities on a generic level. Since the common
+level has no knowledge of device specific methods to disable access to
+resources it cannot be guaranteed that certain resources are not decoded by
+any other entity until the EntityInit() or EntityEnter() phase is finished.
+Device drivers should therefore register all those resources which they are
+going to disable. If these resources are never to be used by any driver
+function they may be flagged ResInit so that they can be removed from the
+resource list after processing all EntityInit() functions. EntityEnter()
+should disable decoding of all resources which are not registered as exclu-
+sive and which are not handled by the generic access control in the common
+level. The difference to EntityInit() is that the latter one is only called
+once during lifetime of the server. It can therefore be used to set up vari-
+ables prior to disabling resources. EntityLeave() should restore the origi-
+nal state when exiting the server or switching to a different VT. It also
+needs to disable device specific access functions if they need to be disabled
+on server exit or VT switch. The default state is to enable them before giv-
+ing up the VT.
+
+In PreInit() phase each driver should check if any sharable resources it has
+registered during Probe() has been denied and take appropriate action which
+could simply be to fail. If it needs to access resources it has disabled
+during EntitySetup() it can do so provided it has registered these and will
+disable them before returning from PreInit(). This also applies to all other
+driver functions. Several functions are provided to request resource ranges,
+register these, correct PCI config space and add replacements for the generic
+access functions. Resources may be marked ``disabled'' or ``unused'' during
+OPERATING stage. Although these steps could also be performed in
+ScreenInit(), this is not desirable.
+
+Following PreInit() phase the common level determines if resource access con-
+trol is needed. This is the case if more than one screen is used. If neces-
+sary the RAC wrapper module is loaded. In ScreenInit() the drivers can
+decide which operations need to be placed under RAC. Available are the frame
+buffer operations, the pointer operations and the colormap operations. Any
+operation that requires resources which might be disabled during OPERATING
+state should be set to use RAC. This can be specified separately for memory
+and IO resources.
+
+When ScreenInit() phase is done the common level will determine which shared
+resources are requested by more than one driver and set the access functions
+accordingly. This is done following these rules:
+
+ 1. The sharable resources registered by each entity are compared. If a
+ resource is registered by more than one entity the entity will be
+ marked to need to share this resources type (IO or MEM).
+
+ 2. A resource marked ``disabled'' during OPERATING state will be ignored
+ entirely.
+
+ 3. A resource marked ``unused'' will only conflicts with an overlapping
+ resource of an other entity if the second is actually in use during
+ OPERATING state.
+
+ 4. If an ``unused'' resource was found to conflict however the entity does
+ not use any other resource of this type the entire resource type will
+ be disabled for that entity.
+
+The driver has the choice among different ways to control access to certain
+resources:
+
+ 1. It can rely on the generic access functions. This is probably the most
+ common case. Here the driver only needs to register any resource it is
+ going to use.
+
+ 2. It can replace the generic access functions by driver specific ones.
+ This will mostly be used in cases where no generic access functions are
+ available. In this case the driver has to make sure these resources
+ are disabled when entering the PreInit() stage. Since the replacement
+ functions are registered in PreInit() the driver will have to enable
+ these resources itself if it needs to access them during this state.
+ The driver can specify if the replacement functions can control memory
+ and/or I/O resources separately.
+
+ 3. The driver can enable resources itself when it needs them. Each driver
+ function enabling them needs to disable them before it will return.
+ This should be used if a resource which can be controlled in a device
+ dependent way is only required during SETUP state. This way it can be
+ marked ``unused'' during OPERATING state.
+
+A resource which is decoded during OPERATING state however never accessed by
+the driver should be marked unused.
+
+Since access switching latencies are an issue during Xserver operation, the
+common level attempts to minimize the number of entities that need to be
+placed under RAC control. When a wrapped operation is called, the EnableAc-
+cess() function is called before control is passed on. EnableAccess() checks
+if a screen is under access control. If not it just establishes bus routing
+and returns. If the screen needs to be under access control, EnableAccess()
+determines which resource types (MEM, IO) are required. Then it tests if
+this access is already established. If so it simply returns. If not it dis-
+ables the currently established access, fixes bus routing and enables access
+to all entities registered for this screen.
+
+Whenever a mode switch or a VT-switch is performed the common level will
+return to SETUP state.
+
+9.2 Resource Types
+
+Resource have certain properties. When registering resources each range is
+accompanied by a flag consisting of the ORed flags of the different proper-
+ties the resource has. Each resource range may be classified according to
+
+ o its physical properties i.e., if it addresses memory (ResMem) or I/O
+ space (ResIo),
+
+ o if it addresses a block (ResBlock) or sparse (ResSparse) range,
+
+ o its access properties.
+
+There are two known access properties:
+
+ o ResExclusive for resources which may not be shared with any other device
+ and
+
+ o ResShared for resources which can be disabled and therefore can be
+ shared.
+
+If it is necessary to test a resource against any type a generic access type
+ResAny is provided. If this is set the resource will conflict with any
+resource of a different entity intersecting its range. Further it can be
+specified that a resource is decoded however never used during any stage
+(ResUnused) or during OPERATING state (ResUnusedOpr). A resource only visi-
+ble during the init functions (ie. EntityInit(), EntityEnter() and
+EntityLeave() should be registered with the flag ResInit. A resource that
+might conflict with background resource ranges may be flagged with ResBios.
+This might be useful when registering resources ranges that were assigned by
+the system Bios.
+
+Several predefined resource lists are available for VGA and 8514/A resources
+in common/xf86Resources.h.
+
+9.3 Available Functions
+
+The functions provided for resource management are listed in their order of
+use in the driver.
+
+9.3.1 Probe Phase
+
+In this phase each driver detects those resources it is able to drive, cre-
+ates an entity record for each of them, registers non-relocatable resources
+and allocates screens and adds the resources to screens.
+
+Two helper functions are provided for matching device sections in the
+XF86Config file to the devices:
+
+ int xf86MatchPciInstances(const char *driverName, int vendorID,
+
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+
+ GDevPtr *devList, int numDevs,
+
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+
+ int **foundEntities)
+
+ This function finds matches between PCI cards that a
+ driver supports and config file device sections. It is
+ intended for use in the ChipProbe() function of drivers
+ for PCI cards. Only probed PCI devices with a vendor ID
+ matching vendorID are considered. devList and numDevs
+ are typically those found from calling xf86MatchDevice(),
+ and represent the active config file device sections rel-
+ evant to the driver. PCIchipsets is a table that pro-
+ vides a mapping between the PCI device IDs, the driver's
+ internal chipset tokens and a list of fixed resources.
+
+ When a device section doesn't have a BusID entry it can
+ only match the primary video device. Secondary devices
+ are only matched with device sections that have a match-
+ ing BusID entry.
+
+ Once the preliminary matches have been found, a final
+ match is confirmed by checking if the chipset override,
+ ChipID override or probed PCI chipset type match one of
+ those given in the chipsets and PCIchipsets lists. The
+ PCIchipsets list includes a list of the PCI device IDs
+ supported by the driver. The list should be terminated
+ with an entry with PCI ID -1". The chipsets list is a
+ table mapping the driver's internal chipset tokens to
+ names, and should be terminated with a NULL entry. Only
+ those entries with a corresponding entry in the PCI-
+ chipsets list are considered. The order of precedence
+ is: config file chipset, config file ChipID, probed PCI
+ device ID.
+
+ In cases where a driver handles PCI chipsets with more
+ than one vendor ID, it may set vendorID to 0, and OR each
+ devID in the list with (the vendor ID << 16).
+
+ Entity index numbers for confirmed matches are returned
+ as an array via foundEntities. The PCI information,
+ chipset token and device section for each match are found
+ in the EntityInfoRec referenced by the indices.
+
+ The function return value is the number of confirmed
+ matches. A return value of -1 indicates an internal
+ error. The returned foundEntities array should be freed
+ by the driver with xfree() when it is no longer needed in
+ cases where the return value is greater than zero.
+
+ int xf86MatchIsaInstances(const char *driverName,
+
+ SymTabPtr chipsets, IsaChipsets *ISAchipsets,
+
+ DriverPtr drvp, FindIsaDevProc FindIsaDevice,
+
+ GDevPtr *devList, int numDevs, int **foundEntities)
+
+ This function finds matches between ISA cards that a
+ driver supports and config file device sections. It is
+ intended for use in the ChipProbe() function of drivers
+ for ISA cards. devList and numDevs are typically those
+ found from calling xf86MatchDevice(), and represent the
+ active config file device sections relevant to the
+ driver. ISAchipsets is a table that provides a mapping
+ between the driver's internal chipset tokens and the
+ resource classes. FindIsaDevice is a driver-provided
+ function that probes the hardware and returns the chipset
+ token corresponding to what was detected, and -1 if noth-
+ ing was detected.
+
+ If the config file device section contains a chipset
+ entry, then it is checked against the chipsets list.
+ When no chipset entry is present, the FindIsaDevice func-
+ tion is called instead.
+
+ Entity index numbers for confirmed matches are returned
+ as an array via foundEntities. The chipset token and
+ device section for each match are found in the EntityIn-
+ foRec referenced by the indices.
+
+ The function return value is the number of confirmed
+ matches. A return value of -1 indicates an internal
+ error. The returned foundEntities array should be freed
+ by the driver with xfree() when it is no longer needed in
+ cases where the return value is greater than zero.
+
+These two helper functions make use of several core functions that are avail-
+able at the driver level:
+
+ Bool xf86ParsePciBusString(const char *busID, int *bus,
+
+ int *device, int *func)
+
+ Takes a BusID string, and if it is in the correct format,
+ returns the PCI bus, device, func values that it indi-
+ cates. The format of the string is expected to be
+ "PCI:bus:device:func" where each of `bus', `device' and
+ `func' are decimal integers. The ":func" part may be
+ omitted, and the func value assumed to be zero, but this
+ isn't encouraged. The "PCI" prefix may also be omitted.
+ The prefix "AGP" is currently equivalent to the "PCI"
+ prefix. If the string isn't a valid PCI BusID, the
+ return value is FALSE.
+
+ Bool xf86ComparePciBusString(const char *busID, int bus,
+
+ int device, int func)
+
+ Compares a BusID string with PCI bus, device, func val-
+ ues. If they match TRUE is returned, and FALSE if they
+ don't.
+
+ Bool xf86ParseIsaBusString(const char *busID)
+
+ Compares a BusID string with the ISA bus ID string ("ISA"
+ or "ISA:"). If they match TRUE is returned, and FALSE if
+ they don't.
+
+ Bool xf86CheckPciSlot(int bus, int device, int func)
+
+ Checks if the PCI slot bus:device:func has been claimed.
+ If so, it returns FALSE, and otherwise TRUE.
+
+ int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+
+ int chipset, GDevPtr dev, Bool active)
+
+ This function is used to claim a PCI slot, allocate the
+ associated entity record and initialise their data struc-
+ tures. The return value is the index of the newly allo-
+ cated entity record, or -1 if the claim fails. This
+ function should always succeed if xf86CheckPciSlot()
+ returned TRUE for the same PCI slot.
+
+ Bool xf86IsPrimaryPci(void)
+
+ This function returns TRUE if the primary card is a PCI
+ device, and FALSE otherwise.
+
+ int xf86ClaimIsaSlot(DriverPtr drvp, int chipset,
+
+ GDevPtr dev, Bool active)
+
+ This allocates an entity record entity and initialise the
+ data structures. The return value is the index of the
+ newly allocated entity record.
+
+ Bool xf86IsPrimaryIsa(void)
+
+ This function returns TRUE if the primary card is an ISA
+ (non-PCI) device, and FALSE otherwise.
+
+Two helper functions are provided to aid configuring entities:
+
+ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+
+ PciChipsets *p_chip, resList res,
+
+ EntityProc init, EntityProc enter,
+
+ EntityProc leave, pointer private)
+
+ Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+
+ IsaChipsets *i_chip, resList res,
+
+ EntityProc init, EntityProc enter,
+
+ EntityProc leave, pointer private)
+
+ These functions are used to register the non-relocatable
+ resources for an entity, and the optional entity-specific
+ Init, Enter and Leave functions. Usually the list of
+ fixed resources is obtained from the Isa/PciChipsets
+ lists. However an additional list of resources may be
+ passed. Generally this is not required. The return
+ value is TRUE when successful. The init, enter, leave
+ functions are defined as follows:
+
+ typedef void (*EntityProc)(int entityIndex,
+
+ pointer private)
+
+ They are passed the entity index and a pointer to a pri-
+ vate scratch area. This are can be set up during Probe()
+ and its address can be passed to xf86ConfigActiveIsaEn-
+ tity() xf86ConfigActivePciEntity() as the last argument.
+
+These two helper functions make use of several core functions that are avail-
+able at the driver level:
+
+ void xf86ClaimFixedResources(resList list, int entityIndex)
+
+ This function registers the non-relocatable resources
+ which cannot be disabled and which therefore would cause
+ the server to fail immediately if they were found to con-
+ flict. It also records non-relocatable but sharable
+ resources for processing after the Probe() phase.
+
+ Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+
+ EntityProc enter, EntityProc leave, pointer)
+
+ This function registers with an entity the init, enter,
+ leave functions along with the pointer to their private
+ area.
+
+ void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
+
+ This function associates the entity referenced by enti-
+ tyIndex with the screen.
+
+9.3.2 PreInit Phase
+
+During this phase the remaining resource should be registered. PreInit()
+should call xf86GetEntityInfo() To obtain a pointer to an EntityInfoRec for
+each entity it is able to drive and check if any resource are listed in its
+resources field. If resources registered in the Probe phase have been
+rejected in the post-Probe phase (resources == NULL), then the driver should
+decide if it can continue without using these or if it should fail.
+
+ EntityInfoPtr xf86GetEntityInfo(int entityIndex)
+
+ This function returns a pointer to the EntityInfoRec ref-
+ erenced by entityIndex. The returned EntityInfoRec
+ should be freed with xfree() when no longer needed.
+
+Several functions are provided to simplify resource registration:
+
+ Bool xf86IsEntityPrimary(int entityIndex)
+
+ This function returns TRUE if the entity referenced by
+ entityIndex is the display device that primary display
+ device (i.e., the one initialised at boot time and used
+ in text mode).
+
+ Bool xf86IsScreenPrimary(int scrnIndex)
+
+ This function returns TRUE if the primary entity is reg-
+ istered with the screen referenced by scrnIndex.
+
+ pciVideoPtr xf86GetPciInfoForEntity(int entityIndex)
+
+ This function returns a pointer to the pciVideoRec for
+ the specified entity. If the entity is not a PCI device,
+ NULL is returned.
+
+The primary function for registration of resources is:
+
+ resPtr xf86RegisterResources(int entityIndex, resList list,
+
+ int access)
+
+ This function tries to register the resources in list.
+ If list is NULL it tries to determine the resources auto-
+ matically. This only works for entities that provide a
+ generic way to read out the resource ranges they decode.
+ So far this is only the case for PCI devices. By default
+ the PCI resources are registered as shared (ResShared) if
+ the driver wants to set a different access type it can do
+ so by specifying the access flags in the third argument.
+ A value of 0 means to use the default settings. If for
+ any reason the resource broker is not able to register
+ some of the requested resources the function will return
+ a pointer to a list of the failed ones. In this case the
+ driver may be able to move the resource to different
+ locations. In case of PCI bus entities this is done by
+ passing the list of failed resources to xf86ReallocateP-
+ ciResources(). When the registration succeeds, the
+ return value is NULL.
+
+ resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes)
+
+ This function takes a list of PCI resources that need to
+ be reallocated and returns a list of the reallocated
+ resource. This list needs to be passed to xf86Register-
+ Resources() again to be registered with the broker. If
+ the reallocation fails, NULL is returned.
+
+Two functions are provided to obtain a resource range of a given type:
+
+ resRange xf86GetBlock(long type, memType size,
+
+ memType window_start, memType window_end,
+
+ memType align_mask, resPtr avoid)
+
+ This function tries to find a block range of size size
+ and type type in a window bound by window_start and win-
+ dow_end with the alignment specified in align_mask.
+ Optionally a list of resource ranges which should be
+ avoided within the window can be supplied. On failure a
+ zero-length range of type ResEnd will be returned.
+
+ resRange xf86GetSparse(long type, memType fixed_bits,
+
+ memType decode_mask, memType address_mask,
+
+ resPtr avoid)
+
+ This function is like the previous one, but attempts to
+ find a sparse range instead of a block range. Here three
+ values have to be specified: the address_mask which marks
+ all bits of the mask part of the address, the decode_mask
+ which masks out the bits which are hardcoded and are
+ therefore not available for relocation and the values of
+ the fixed bits. The function tries to find a base that
+ satisfies the given condition. If the function fails it
+ will return a zero range of type ResEnd. Optionally it
+ might be passed a list of resource ranges to avoid.
+
+Some PCI devices are broken in the sense that they return invalid size infor-
+mation for a certain resource. In this case the driver can supply the cor-
+rect size and make sure that the resource range allocated for the card is
+large enough to hold the address range decoded by the card. The function
+xf86FixPciResource() can be used to do this:
+
+ Bool xf86FixPciResource(int entityIndex, unsigned int prt,
+
+ CARD32 alignment, long type)
+
+ This function fixes a PCI resource allocation. The prt
+ parameter contains the number of the PCI base register
+ that needs to be fixed (0-5, and 6 for the BIOS base reg-
+ ister). The size is specified by the alignment. Since
+ PCI resources need to span an integral range of the size
+ 2^n the alignment also specifies the number of addresses
+ that will be decoded. If the driver specifies a type
+ mask it can override the default type for PCI resources
+ which is ResShared. The resource broker needs to know
+ that to find a matching resource range. This function
+ should be called before calling xf86RegisterResources().
+ The return value is TRUE when the function succeeds.
+
+ Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base)
+
+ This function checks that the memory base address speci-
+ fied matches one of the PCI base address register values
+ for the given PCI device. This is mostly used to check
+ that an externally provided base address (e.g., from a
+ config file) matches an actual value allocated to a
+ device.
+
+The driver may replace the generic access control functions for an entity by
+it's own ones. This is done with the xf86SetAccessFuncs():
+
+ void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io,
+
+ xf86AccessPtr p_mem, xf86AccessPtr p_io_mem,
+
+ xf86AccessPtr *ppAccessOld)
+
+ The driver can pass three functions: one for I/O access,
+ one for memory access and one for combined memory and I/O
+ access. If the memory access and combined access func-
+ tions are identical the common level assumes that the
+ memory access cannot be controlled independently of I/O
+ access, if the I/O access function and the combined
+ access functions are the same it is assumed that I/O can
+ not be controlled independently. If memory and I/O have
+ to be controlled together all three values should be the
+ same. If a non NULL value is passed as fifth argument it
+ is interpreted as an address where to store the old
+ access record. If the fifth argument is NULL it will be
+ assumed that the generic access should be enabled before
+ replacing the access functions. Otherwise it will be
+ disabled. The driver may enable them itself using the
+ returned values. It should do this from his replacement
+ access functions as the generic access may be disabled by
+ the common level on certain occasions. If replacement
+ functions are specified they must control all resources
+ of the specific type registered for the entity.
+
+To find out if specific resource range is conflicting with another resource
+the xf86ChkConflict() function may be used:
+
+ memType xf86ChkConflict(resRange *rgp, int entityIndex)
+
+ This function checks if the resource range rgp of for the
+ specified entity conflicts with with another resource.
+ If it a conflict is found, the address of the start of
+ the conflict is returned. The return value is zero when
+ there is no conflict.
+
+The OPERATING state properties of previously registered fixed resources can
+be set with the xf86SetOperatingState() function:
+
+ resPtr xf86SetOperatingState(resList list, int entityIndex,
+
+ int mask)
+
+ This function is used to set the status of a resource
+ during OPERATING state. list holds a list to which mask
+ is to be applied. The parameter mask may have the value
+ ResUnusedOpr and ResDisableOpr. The first one should be
+ used if a resource isn't used by the driver during OPER-
+ ATING state although it is decoded by the device, while
+ the latter one indicates that the resource is not decoded
+ during OPERATING state. Note that the resource ranges
+ have to match those specified during registration. If a
+ range has been specified starting at A and ending at B
+ and suppose C us a value satisfying A < C < B one may not
+ specify the resource range (A,B) by splitting it into two
+ ranges (A,C) and (C,B).
+
+The following two functions are provided for special cases:
+
+ void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
+
+ This function may be used to remove an entity from a
+ screen. This only makes sense if a screen has more than
+ one entity assigned or the screen is to be deleted. No
+ test is made if the screen has any entities left.
+
+ void xf86DeallocateResourcesForEntity(int entityIndex, long type)
+
+ This function deallocates all resources of a given type
+ registered for a certain entity from the resource broker
+ list.
+
+9.3.3 ScreenInit Phase
+
+All that is required in this phase is to setup the RAC flags. Note that it
+is also permissible to set these flags up in the PreInit phase. The RAC
+flags are held in the racIoFlags and racMemFlags fields of the ScrnInfoRec
+for each screen. They specify which graphics operations might require the
+use of shared resources. This can be specified separately for memory and I/O
+resources. The available flags are defined in rac/xf86RAC.h. They are:
+
+RAC_FB
+
+ for framebuffer operations (including hw acceleration)
+
+RAC_CURSOR
+
+ for Cursor operations (??? I'm not sure if we need this for SW cur-
+ sor it depends on which level the sw cursor is drawn)
+
+RAC_COLORMAP
+
+ for colormap operations
+
+RAC_VIEWPORT
+
+ for the call to ChipAdjustFrame()
+
+The flags are ORed together.
+
+10. Config file ``Option'' entries
+
+Option entries are permitted in most sections and subsections of the config
+file. There are two forms of option entries:
+
+ Option "option-name"
+ A boolean option.
+
+ Option "option-name" "option-value"
+ An option with an arbitrary value.
+
+The option entries are handled by the parser, and a list of the parsed
+options is included with each of the appropriate data structures that the
+drivers have access to. The data structures used to hold the option informa-
+tion are opaque to the driver, and a driver must not access the option data
+directly. Instead, the common layer provides a set of functions that may be
+used to access, check and manipulate the option data.
+
+First, the low level option handling functions. In most cases drivers would
+not need to use these directly.
+
+ pointer xf86FindOption(pointer options, const char *name)
+
+ Takes a list of options and an option name, and returns a
+ handle for the first option entry in the list matching
+ the name. Returns NULL if no match is found.
+ char *xf86FindOptionValue(pointer options, const char *name)
+
+ Takes a list of options and an option name, and returns
+ the value associated with the first option entry in the
+ list matching the name. If the matching option has no
+ value, an empty string ("") is returned. Returns NULL if
+ no match is found.
+
+ void xf86MarkOptionUsed(pointer option)
+
+ Takes a handle for an option, and marks that option as
+ used.
+
+ void xf86MarkOptionUsedByName(pointer options, const char *name)
+
+ Takes a list of options and an option name and marks the
+ first option entry in the list matching the name as used.
+
+Next, the higher level functions that most drivers would use.
+
+ void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
+
+ Collect the options from each of the config file sections
+ used by the screen (pScrn) and return the merged list as
+ pScrn->options. This function requires that pScrn->conf-
+ Screen, pScrn->display, pScrn->monitor, pScrn->numEnti-
+ ties, and pScrn->entityList are initialised. extraOpts
+ may optionally be set to an additional list of options to
+ be combined with the others. The order of precedence for
+ options is extraOpts, display, confScreen, monitor,
+ device.
+
+ void xf86ProcessOptions(int scrnIndex, pointer options,
+
+ OptionInfoPtr optinfo)
+
+ Processes a list of options according to the information
+ in the array of OptionInfoRecs (optinfo). The resulting
+ information is stored in the value fields of the appro-
+ priate optinfo entries. The found fields are set to TRUE
+ when an option with a value of the correct type if found,
+ and FALSE otherwise. The type field is used to determine
+ the expected value type for each option. Each option in
+ the list of options for which there is a name match (but
+ not necessarily a value type match) is marked as used.
+ Warning messages are printed when option values don't
+ match the types specified in the optinfo data.
+
+ NOTE: If this function is called before a driver's screen
+ number is known (e.g., from the ChipProbe() function) a
+ scrnIndex value of -1 should be used.
+
+ The OptionInfoRec is defined as follows:
+
+ typedef struct {
+ double freq;
+ int units;
+ } OptFrequency;
+
+ typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+ } ValueUnion;
+
+ typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+ } OptionValueType;
+
+ typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+ } OptFreqUnits;
+
+ typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+ } OptionInfoRec, *OptionInfoPtr;
+
+ OPTV_FREQ can be used for options values that are fre-
+ quencies. These values are a floating point number with
+ an optional unit name appended. The unit name can be one
+ of "Hz", "kHz", "k", "MHz", "M". The multiplier associ-
+ ated with the unit is stored in freq.units, and the
+ scaled frequency is stored in freq.freq. When no unit is
+ specified, freq.units is set to 0, and freq.freq is
+ unscaled.
+
+ Typical usage is to setup a static array of OptionIn-
+ foRecs with the token, name, and type fields initialised.
+ The value and found fields get set by xf86ProcessOp-
+ tions(). For cases where the value parsing is more com-
+ plex, the driver should specify OPTV_STRING, and parse
+ the string itself. An example of using this option han-
+ dling is included in the Sample Driver (section 20., page
+ 1) section.
+
+ void xf86ShowUnusedOptions(int scrnIndex, pointer options)
+
+ Prints out warning messages for each option in the list
+ of options that isn't marked as used. This is intended
+ to show options that the driver hasn't recognised. It
+ would normally be called near the end of the Chip-
+ ScreenInit() function, but only when
+ serverGeneration == 1.
+
+ OptionInfoPtr xf86TokenToOptinfo(OptionInfoPtr table, int token)
+
+ Returns a pointer to the OptionInfoRec in table with a
+ token field matching token. Returns NULL if no match is
+ found.
+
+ Bool xf86IsOptionSet(OptionInfoPtr table, int token)
+
+ Returns the found field of the OptionInfoRec in table
+ with a token field matching token. This can be used for
+ options of all types. Note that for options of type
+ OPTV_BOOLEAN, it isn't sufficient to check this to deter-
+ mine the value of the option. Returns FALSE if no match
+ is found.
+
+ char *xf86GetOptValString(OptionInfoPtr table, int token)
+
+ Returns the value.str field of the OptionInfoRec in table
+ with a token field matching token. Returns NULL if no
+ match is found.
+
+ Bool xf86GetOptValInteger(OptionInfoPtr table, int token,
+
+ int *value)
+
+ Returns via *value the value.num field of the OptionIn-
+ foRec in table with a token field matching token. *value
+ is only changed when a match is found so it can be safely
+ initialised with a default prior to calling this func-
+ tion. The function return value is as for xf86IsOption-
+ Set().
+
+ Bool xf86GetOptValULong(OptionInfoPtr table, int token,
+
+ unsigned long *value)
+
+ Like xf86GetOptValInteger(), except the value is treated
+ as an unsigned long.
+
+ Bool xf86GetOptValReal(OptionInfoPtr table, int token,
+
+ double *value)
+
+ Like xf86GetOptValInteger(), except that value.realnum is
+ used.
+
+ Bool xf86GetOptValFreq(OptionInfoPtr table, int token,
+
+ OptFreqUnits expectedUnits, double *value)
+
+ Like xf86GetOptValInteger(), except that the value.freq
+ data is returned. The frequency value is scaled to the
+ units indicated by expectedUnits. The scaling is exact
+ when the units were specified explicitly in the option's
+ value. Otherwise, the expectedUnits field is used as a
+ hint when doing the scaling. In this case, values larger
+ than 1000 are assumed to have be specified in the next
+ smallest units. For example, if the Option value is
+ "10000" and expectedUnits is OPTUNITS_MHZ, the value
+ returned is 10.
+
+ Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value)
+
+ This function is used to check boolean options
+ (OPTV_BOOLEAN). If the function return value is FALSE,
+ it means the option wasn't set. Otherwise *value is set
+ to the boolean value indicated by the option's value. No
+ option value is interpreted as TRUE. Option values mean-
+ ing TRUE are "1", "yes", "on", "true", and option values
+ meaning FALSE are "0", "no", "off", "false". Option
+ names both with the "no" prefix in their names, and with
+ that prefix removed are also checked and handled in the
+ obvious way. *value is not changed when the option isn't
+ present. It should normally be set to a default value
+ before calling this function.
+
+ Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def)
+
+ This function is used to check boolean options
+ (OPTV_BOOLEAN). If the option is set, its value is
+ returned. If the options is not set, the default value
+ specified by def is returned. The option interpretation
+ is the same as for xf86GetOptValBool().
+
+ int xf86NameCmp(const char *s1, const char *s2)
+
+ This function should be used when comparing strings from
+ the config file with expected values. It works like str-
+ cmp(), but is not case sensitive and space, tab, and `_'
+ characters are ignored in the comparison. The use of
+ this function isn't restricted to parsing option values.
+ It may be used anywhere where this functionality
+ required.
+
+11. Modules, Drivers, Include Files and Interface Issues
+
+NOTE: this section is incomplete.
+
+11.1 Include files
+
+The following include files are typically required by video drivers:
+
+ All drivers should include these:
+
+ "xf86.h"
+
+ "xf86_OSproc.h"
+
+ "xf86_ansic.h"
+
+ "xf86Resources.h"
+
+ Wherever inb/outb (and related things) are used the following
+ should be included:
+
+ "compiler.h"
+
+ Drivers that need to access PCI vendor/device definitions need
+ this:
+
+ "xf86PciInfo.h"
+
+ Drivers that need to access the PCI config space need this:
+
+ "xf86Pci.h"
+
+ Drivers that initialise a SW cursor need this:
+
+ "mipointer.h"
+
+ All drivers implementing backing store need this:
+
+ "mibstore.h"
+
+ All drivers using the mi colourmap code need this:
+
+ "micmap.h"
+
+ If a driver uses the vgahw module, it needs this:
+
+ "vgaHW.h"
+
+ Drivers supporting VGA or Hercules monochrome screens need:
+
+ "xf1bpp.h"
+
+ Drivers supporting VGA or EGC 16-colour screens need:
+
+ "xf4bpp.h"
+
+ Drivers using cfb need:
+
+ #define PSZ 8
+
+ #include "cfb.h"
+
+ #undef PSZ
+
+ Drivers supporting bpp 16, 24 or 32 with cfb need one or more of:
+
+ "cfb16.h"
+
+ "cfb24.h"
+
+ "cfb32.h"
+
+ If a driver uses XAA, it needs these:
+
+ "xaa.h"
+
+ "xaalocal.h"
+
+ If a driver uses the fb manager, it needs this:
+
+ "xf86fbman.h"
+
+Non-driver modules should include "xf86_ansic.h" to get the correct wrapping
+of ANSI C/libc functions.
+
+All modules must NOT include any system include files, or the following:
+
+ "xf86Priv.h"
+
+ "xf86Privstr.h"
+
+ "xf86_libc.h"
+
+ "xf86_OSlib.h"
+
+ "Xos.h"
+
+or any other include files with ``priv'' in their name.
+
+12. Offscreen Memory Manager
+
+Management of offscreen video memory may be handled by the XFree86 frame-
+buffer manager. Once the offscreen memory manager is running, drivers or
+extensions may allocate, free or resize areas of offscreen video memory using
+the following functions (definitions taken from xf86fbman.h):
+
+ typedef struct _FBArea {
+ ScreenPtr pScreen;
+ BoxRec box;
+ int granularity;
+ void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*)
+ void (*RemoveAreaCallback)(struct _FBArea*)
+ DevUnion devPrivate;
+ } FBArea, *FBAreaPtr;
+
+ typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr from, FBAreaPtr to)
+ typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr)
+
+ FBAreaPtr xf86AllocateOffscreenArea (
+ ScreenPtr pScreen,
+ int width, int height,
+ int granularity,
+ MoveAreaCallbackProcPtr MoveAreaCallback,
+ RemoveAreaCallbackProcPtr RemoveAreaCallback,
+ pointer privData
+ )
+
+ void xf86FreeOffscreenArea (FBAreaPtr area)
+
+ Bool xf86ResizeOffscreenArea (
+ FBAreaPtr area
+ int w, int h
+ )
+
+The function:
+
+ Bool xf86FBManagerRunning(ScreenPtr pScreen)
+
+can be used by an extension to check if the driver has initialized the memory
+manager. The manager is not available if this returns FALSE and the func-
+tions above will all fail.
+
+xf86AllocateOffscreenArea() can be used to request a rectangle of dimensions
+width x height (in pixels) from unused offscreen memory. granularity speci-
+fies that the leftmost edge of the rectangle must lie on some multiple of
+granularity pixels. A granularity of zero means the same thing as a granu-
+larity of one - no alignment preference. A MoveAreaCallback can be provided
+to notify the requester when the offscreen area is moved. If no MoveArea-
+Callback is supplied then the area is considered to be immovable. The priv-
+Data field will be stored in the manager's internal structure for that allo-
+cated area and will be returned to the requester in the FBArea passed via the
+MoveAreaCallback. An optional RemoveAreaCallback is provided. If the driver
+provides this it indicates that the area should be allocated with a lower
+priority. Such an area may be removed when a higher priority request (one
+that doesn't have a RemoveAreaCallback) is made. When this function is
+called, the driver will have an opportunity to do whatever cleanup it needs
+to do to deal with the loss of the area, but it must finish its cleanup
+before the function exits since the offscreen memory manager will free the
+area immediately after.
+
+xf86AllocateOffscreenArea() returns NULL if it was unable to allocate the
+requested area. When no longer needed, areas should be freed with xf86Free-
+OffscreenArea().
+
+xf86ResizeOffscreenArea() resizes an existing FBArea. xf86ResizeOff-
+screenArea() returns TRUE if the resize was successful. If xf86ResizeOff-
+screenArea() returns FALSE, the original FBArea is left unmodified. Resizing
+an area maintains the area's original granularity, devPrivate, and MoveArea-
+Callback. xf86ResizeOffscreenArea() has considerably less overhead than
+freeing the old area then reallocating the new size, so it should be used
+whenever possible.
+
+The function:
+
+ Bool xf86QueryLargestOffscreenArea(
+
+ ScreenPtr pScreen,
+
+ int *width, int *height,
+
+ int granularity,
+
+ int preferences,
+
+ int priority
+
+ )
+
+is provided to query the width and height of the largest single FBArea allo-
+catable given a particular priority. preferences can be one of the following
+to indicate whether width, height or area should be considered when determin-
+ing which is the largest single FBArea available.
+
+ FAVOR_AREA_THEN_WIDTH
+
+ FAVOR_AREA_THEN_HEIGHT
+
+ FAVOR_WIDTH_THEN_AREA
+
+ FAVOR_HEIGHT_THEN_AREA
+
+priority is one of the following:
+
+ PRIORITY_LOW
+
+ Return the largest block available without stealing any-
+ one else's space. This corresponds to the priority of
+ allocating a FBArea when a RemoveAreaCallback is pro-
+ vided.
+
+ PRIORITY_NORMAL
+
+ Return the largest block available if it is acceptable to
+ steal a lower priority area from someone. This corre-
+ sponds to the priority of allocating a FBArea without
+ providing a RemoveAreaCallback.
+
+ PRIORITY_EXTREME
+
+ Return the largest block available if all FBAreas that
+ aren't locked down were expunged from memory first. This
+ corresponds to any allocation made directly after a call
+ to xf86PurgeUnlockedOffscreenAreas().
+
+The function:
+
+ Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+
+is provided as an extreme method to free up offscreen memory. This will
+remove all removable FBArea allocations.
+
+Initialization of the XFree86 framebuffer manager is done via
+
+ Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
+
+FullBox represents the area of the framebuffer that the manager is allowed to
+manage. This is typically a box with a width of pScrn->displayWidth and a
+height of as many lines as can be fit within the total video memory, however,
+the driver can reserve areas at the extremities by passing a smaller area to
+the manager.
+
+xf86InitFBManager() must be called before XAA is initialized since XAA uses
+the manager for it's pixmap cache.
+
+An alternative function is provided to allow the driver to initialize the
+framebuffer manager with a Region rather than a box.
+
+ Bool xf86InitFBManagerRegion(ScreenPtr pScreen,
+
+ RegionPtr FullRegion)
+
+xf86InitFBManagerRegion(), unlike xf86InitFBManager(), does not remove the
+area used for the visible screen so that area should not be included in the
+region passed to the function. xf86InitFBManagerRegion() is useful when non-
+contiguous areas are available to be managed, and is required when multiple
+framebuffers are stored in video memory (as in the case where an overlay of a
+different depth is stored as a second framebuffer in offscreen memory).
+
+13. Colormap Handling
+
+A generic colormap handling layer is provided within the XFree86 common
+layer. This layer takes care of most of the details, and only requires a
+function from the driver that loads the hardware palette when required. To
+use the colormap layer, a driver calls the xf86HandleColormaps() function.
+
+ Bool xf86HandleColormaps(ScreenPtr pScreen, int maxColors,
+
+ int sigRGBbits, LoadPaletteFuncPtr loadPalette,
+
+ SetOverscanFuncPtr setOverscan, unsigned int flags)
+
+ This function must be called after the default colormap
+ has been initialised. The pScrn->gamma field must also
+ be initialised, preferably by calling xf86SetGamma().
+ maxColors is the number of entries in the palette.
+ sigRGBbits is the number of significant bits in each
+ colour component. This would normally be the same as
+ pScrn->rgbBits. loadPalette is a driver-provided func-
+ tion for loading a colormap into the hardware, and is
+ described below. setOverscan is an optional function
+ that may be provided when the overscan color is an index
+ from the standard LUT and when it needs to be adjusted to
+ keep it as close to black as possible. The setOverscan
+ function programs the overscan index. It shouldn't nor-
+ mally be used for depths other than 8. setOverscan
+ should be set to NULL when it isn't needed. flags may be
+ set to the following (which may be ORed together):
+
+ CMAP_PALETTED_TRUECOLOR
+
+ the TrueColor visual is paletted and is just a
+ special case of DirectColor. This flag is only
+ valid for bpp > 8.
+
+ CMAP_RELOAD_ON_MODE_SWITCH
+
+ reload the colormap automatically after mode
+ switches. This is useful for when the driver
+ is resetting the hardware during mode switches
+ and corrupting or erasing the hardware palette.
+
+ The colormap layer always reloads the palette after VT
+ enters so it is not necessary for the driver to save and
+ restore the palette when switching VTs. The driver must,
+ however, still save the initial palette during server
+ start up and restore it during server exit.
+
+ void LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+
+ LOCO *colors, VisualPtr pVisual)
+
+ LoadPalette() is a driver-provide function for loading a
+ colormap into hardware. colors is the array of RGB val-
+ ues that represent the full colormap. indices is a list
+ of index values into the colors array. These indices
+ indicate the entries that need to be updated. numColors
+ is the number of the indices to be updated.
+
+ void SetOverscan(ScrnInfoPtr pScrn, int overscan)
+
+ SetOverscan() is a driver-provided function for program-
+ ming the overscan index. As described above, it is nor-
+ mally only appropriate for LUT modes where all colormap
+ entries are available for the display, but where one of
+ them is also used for the overscan (typically 8bpp for
+ VGA compatible LUTs). It isn't required in cases where
+ the overscan area is never visible.
+
+14. DPMS Extension
+
+Support code for the DPMS extension is included in the XFree86 common layer.
+This code provides an interface between the main extension code, and a means
+for drivers to initialise DPMS when they support it. One function is avail-
+able to drivers to do this initialisation, and it is always available, even
+when the DPMS extension is not supported by the core server (in which case it
+returns a failure result).
+
+ Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
+
+ This function registers a driver's DPMS level programming
+ function set. It also checks pScrn->options for the
+ "dpms" option, and when present marks DPMS as being
+ enabled for that screen. The set function is called
+ whenever the DPMS level changes, and is used to program
+ the requested level. flags is currently not used, and
+ should be 0. If the initialisation fails for any reason,
+ including when there is no DPMS support in the core
+ server, the function returns FALSE.
+
+Drivers that implement DPMS support must provide the following function, that
+gets called when the DPMS level is changed:
+
+ void ChipDPMSSet(ScrnInfoPtr pScrn, int level, int flags)
+
+ Program the DPMS level specified by level. Valid values
+ of level are DPMSModeOn, DPMSModeStandby, DPMSModeSus-
+ pend, DPMSModeOff. These values are defined in "exten-
+ sions/dpms.h".
+
+15. DGA Extension
+
+Drivers can support the XFree86 Direct Graphics Architecture (DGA) by filling
+out a structure of function pointers and a list of modes and passing them to
+DGAInit.
+
+ Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs,
+
+ DGAModePtr modes, int num)
+
+ /** The DGAModeRec **/
+
+ typedef struct {
+ int num;
+ DisplayModePtr mode;
+ int flags;
+ int imageWidth;
+ int imageHeight;
+ int pixmapWidth;
+ int pixmapHeight;
+ int bytesPerScanline;
+ int byteOrder;
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep;
+ int yViewportStep;
+ int maxViewportX;
+ int maxViewportY;
+ int viewportFlags;
+ int offset;
+ unsigned char *address;
+ int reserved1;
+ int reserved2;
+ } DGAModeRec, *DGAModePtr;
+
+ num
+
+ Can be ignored. The DGA DDX will assign these
+ numbers.
+
+ mode
+
+ A pointer to the DisplayModeRec for this mode.
+
+ flags
+
+ The following flags are defined and may be OR'd
+ together:
+
+ DGA_CONCURRENT_ACCESS
+
+ Indicates that the driver supports
+ concurrent graphics accelerator and
+ linear framebuffer access.
+
+ DGA_FILL_RECT
+
+ DGA_BLIT_RECT
+
+ DGA_BLIT_RECT_TRANS
+
+ Indicates that the driver supports
+ the FillRect, BlitRect or BlitTran-
+ sRect functions in this mode.
+
+ DGA_PIXMAP_AVAILABLE
+
+ Indicates that Xlib may be used on
+ the framebuffer. This flag will usu-
+ ally be set unless the driver wishes
+ to prohibit this for some reason.
+
+ DGA_INTERLACED
+
+ DGA_DOUBLESCAN
+
+ Indicates that these are interlaced
+ or double scan modes.
+
+ imageWidth
+
+ imageHeight
+
+ These are the dimensions of the linear frame-
+ buffer accessible by the client.
+
+ pixmapWidth
+
+ pixmapHeight
+
+ These are the dimensions of the area of the
+ framebuffer accessible by the graphics acceler-
+ ator.
+
+ bytesPerScanline
+
+ Pitch of the framebuffer in bytes.
+
+ byteOrder
+
+ Usually the same as pScrn->imageByteOrder.
+
+ depth
+
+ The depth of the framebuffer in this mode.
+
+ bitsPerPixel
+
+ The number of bits per pixel in this mode.
+
+ red_mask
+
+ green_mask
+
+ blue_mask
+
+ The RGB masks for this mode, if applicable.
+
+ viewportWidth
+
+ viewportHeight
+
+ Dimensions of the visible part of the frame-
+ buffer. Usually mode->HDisplay and mode->VDis-
+ play.
+
+ xViewportStep
+
+ yViewportStep
+
+ The granularity of x and y viewport positions
+ that the driver supports in this mode.
+
+ maxViewportX
+
+ maxViewportY
+
+ The maximum viewport position supported by the
+ driver in this mode.
+
+ viewportFlags
+
+ The following may be OR'd together:
+
+ DGA_FLIP_IMMEDIATE
+
+ The driver supports immediate view-
+ port changes.
+
+ DGA_FLIP_RETRACE
+
+ The driver supports viewport changes
+ at retrace.
+
+ offset
+
+ The offset into the linear framebuffer that
+ corresponds to pixel (0,0) for this mode.
+
+ /** The DGAFunctionRec **/
+
+ typedef struct {
+ Bool (*OpenFramebuffer)(
+ ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *extra
+ );
+ void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
+ Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
+ void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
+ int (*GetViewport)(ScrnInfoPtr pScrn);
+ void (*Flush)(ScrnInfoPtr);
+ void (*FillRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned long color
+ );
+ void (*BlitRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+ );
+ void (*BlitTransRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+ );
+ } DGAFunctionRec, *DGAFunctionPtr;
+
+ Bool OpenFramebuffer (pScrn, name, mem, size, offset, extra)
+
+ OpenFramebuffer() should pass the client everything it
+ needs to know to be able to open the framebuffer. These
+ parameters are OS specific and their meanings are to be
+ interpreted by an OS specific client library.
+
+ name
+
+ The name of the device to open or NULL if there
+ is no special device to open. A NULL name
+ tells the client that it should open whatever
+ device one would usually open to access physi-
+ cal memory.
+
+ mem
+
+ The physical address of the start of the frame-
+ buffer.
+
+ size
+
+ The size of the framebuffer in bytes.
+
+ offset
+
+ Any offset into the device, if applicable.
+
+ flags
+
+ Any additional information that the client may
+ need. Currently, only the DGA_NEED_ROOT flag
+ is defined.
+
+ void CloseFramebuffer (pScrn)
+
+ CloseFramebuffer() merely informs the driver (if it even
+ cares) that client no longer needs to access the frame-
+ buffer directly. This function is optional.
+
+ Bool SetMode (pScrn, pMode)
+
+ SetMode() tells the driver to initialize the mode passed
+ to it. If pMode is NULL, then the driver should restore
+ the original pre-DGA mode.
+
+ void SetViewport (pScrn, x, y, flags)
+
+ SetViewport() tells the driver to make the upper left-
+ hand corner of the visible screen correspond to coordi-
+ nate (x,y) on the framebuffer. Flags currently defined
+ are:
+
+ DGA_FLIP_IMMEDIATE
+
+ The viewport change should occur immediately.
+
+ DGA_FLIP_RETRACE
+
+ The viewport change should occur at the verti-
+ cal retrace, but this function should return
+ sooner if possible.
+
+ The (x,y) locations will be passed as the client speci-
+ fied them, however, the driver is expected to round these
+ locations down to the next supported location as speci-
+ fied by the xViewportStep and yViewportStep for the cur-
+ rent mode.
+
+ int GetViewport (pScrn)
+
+ GetViewport() gets the current page flip status. Set
+ bits in the returned int correspond to viewport change
+ requests still pending. For instance, set bit zero if
+ the last SetViewport request is still pending, bit one if
+ the one before that is still pending, etc.
+
+ void Flush (pScrn)
+
+ This function should ensure that any graphics accelerator
+ operations have finished. This function should not
+ return until the graphics accelerator is idle.
+
+ void FillRect (pScrn, x, y, w, h, color)
+
+ This optional function should fill a rectangle w × h
+ located at (x,y) in the given color.
+
+ void BlitRect (pScrn, srcx, srcy, w, h, dstx, dsty)
+
+ This optional function should copy an area w × h located
+ at (srcx,srcy) to location (dstx,dsty). This function
+ will need to handle copy directions as appropriate.
+
+ void BlitTransRect (pScrn, srcx, srcy, w, h, dstx, dsty, color)
+
+ This optional function is the same as BlitRect except
+ that pixels in the source corresponding to the color key
+ color should be skipped.
+
+16. The XFree86 X Video Extension (Xv) Device Dependent Layer
+
+XFree86 offers the X Video Extension which allows clients to treat video as
+any another primitive and ``Put'' video into drawables. By default, the
+extension reports no video adaptors as being available since the DDX layer
+has not been initialized. The driver can initialize the DDX layer by filling
+out one or more XF86VideoAdaptorRecs as described later in this document and
+passing a list of XF86VideoAdaptorPtr pointers to the following function:
+
+ Bool xf86XVScreenInit(
+
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *adaptPtrs,
+
+ int num)
+
+After doing this, the extension will report video adaptors as being avail-
+able, providing the data in their respective XF86VideoAdaptorRecs was valid.
+xf86XVScreenInit() copies data from the structure passed to it so the driver
+may free it after the initialization. At the moment, the DDX only supports
+rendering into Window drawables. Pixmap rendering will be supported after a
+sufficient survey of suitable hardware is completed.
+
+The XF86VideoAdaptorRec:
+
+ typedef struct {
+ unsigned char type;
+ int flags;
+ char *name;
+ int nEncodings;
+ XF86VideoEncodingPtr pEncodings;
+ int nFormats;
+ XF86VideoFormatPtr pFormats;
+ int nPorts;
+ XF86AttributeListPtr pAttributes;
+ DevUnion *pPortPrivates;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
+
+ Each adaptor will have its own XF86VideoAdaptorRec. The fields are
+ as follows:
+
+ type
+
+ This can be XvInputMask, XvOutputMask or both OR'd
+ together. This refers to the target drawable and is sim-
+ ilar to a Window's class. XvInputMask indicates that the
+ adaptor can put video into a drawable. XvOutputMask
+ indicates that the adaptor can get video from a drawable.
+
+ flags
+
+ Currently, the following flags are defined:
+
+ VIDEO_NO_CLIPPING
+
+ This indicates that the video adaptor does not
+ support clipping. The driver will never
+ receive Get/Put requests where less than the
+ entire area determined by drw_x, drw_y, drw_w
+ and drw_h is visible.
+
+ VIDEO_INVERT_CLIPLIST
+
+ This indicates that the video driver requires
+ the clip list to contain the regions which are
+ obscured rather than the regions which are are
+ visible.
+
+ VIDEO_EXPOSE
+
+ This flag applies to GetStill and GetVideo
+ only, it indicates the clip list shall contain
+ obscured regions. Note the source region will
+ still be clipped against the screen bounds.
+ This flag is meant for showing all the contents
+ of the [root] window, if the administrator has
+ no hesitations regarding security.
+
+ name
+
+ The name of the adaptor.
+
+ nEncodings
+
+ pEncodings
+
+ The number of encodings the adaptor is capable of and
+ pointer to the XF86VideoEncodingRec array. The
+ XF86VideoEncodingRec is described later on.
+
+ nFormats
+
+ pFormats
+
+ The number of formats the adaptor is capable of and
+ pointer to the XF86VideoFormatRec array. The XF86Video-
+ FormatRec is described later on.
+
+ nPorts
+
+ pPortPrivates
+
+ The number of ports is the number of separate data
+ streams which the adaptor can handle simultaneously. If
+ you have more than one port, the adaptor is expected to
+ be able to render into more than one window at a time.
+ pPortPrivates is an array of pointers or ints - one for
+ each port. A port's private data will be passed to the
+ driver any time the port is requested to do something
+ like put the video or stop the video. In the case where
+ there may be many ports, this enables the driver to know
+ which port the request is intended for. Most commonly,
+ this will contain a pointer to the data structure con-
+ taining information about the port.
+
+ pAttributes
+
+ There is an array of XF86AttributeListRecs with an entry
+ for each port.
+
+ PutVideo PutStill GetVideo GetStill StopVideo SetPortAttribute Get-
+ PortAttribute QueryBestSize
+
+ These functions define the DDX->driver interface. In
+ each case, the pointer data is passed to the driver.
+ This is the port private for that port as described
+ above. All fields are required except under the follow-
+ ing conditions:
+
+ 1. PutVideo and PutStill are not required when the
+ adaptor type does not contain XvInputMask.
+
+ 2. GetVideo and GetStill are not required when the
+ adaptor type does not contain XvOutputMask.
+
+ These functions should return Success if the operation
+ was completed successfully. They can return XvBadAlloc
+ otherwise. Xv DDX will not call a Get/Put function while
+ video is active, rather issue a StopVideo call first.
+
+ Earlier versions of Xv DDX had a ReclipVideo function,
+ obsolete now. The clip region will be passed directly by
+ the functions below. If the VIDEO_NO_CLIPPING flag is
+ set, the RegionPtr should be ignored by the driver.
+ ClipBoxes is an X-Y banded region identical to those used
+ throughout the server. The clipBoxes represent the visi-
+ ble portions of area determined by drw_x, drw_y, drw_w
+ and drw_h in the Get/Put function. The boxes are in
+ screen coordinates, are guaranteed not to overlap and an
+ empty region will be passed only to GetVideo, once. This
+ to notify the driver the primitive is totally obscured
+ now. A StopVideo call will immediately follow neverthe-
+ less. In the case where the VIDEO_INVERT_CLIPLIST flag
+ is set, clipBoxes will indicate the areas of the primi-
+ tive which are obscured rather than the areas visible.
+ The Region must not be altered by the driver and will be
+ deleted when the function returns.
+
+ typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+
+ short vid_w, short vid_h, short drw_w, short drw_h,
+
+ RegionPtr clipBoxes, pointer data )
+
+ This indicates that the driver should take a subsection
+ vid_w × vid_h at location (vid_x,vid_y) from the video
+ stream and direct it into the rectangle rw_w × drw_h at
+ location (drw_x,drw_y) on the screen, scaling as neces-
+ sary. Due to the large variations in capabilities of the
+ various hardware expected to be used with this extension,
+ it is not expected that all hardware will be able to do
+ this exactly as described. In that case the driver
+ should just do ``the best it can,'' scaling as closely to
+ the target rectangle as it can without rendering outside
+ of it. In the worst case, the driver can opt to just not
+ turn on the video.
+
+ typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+
+ short vid_w, short vid_h, short drw_w, short drw_h,
+
+ RegionPtr clipBoxes, pointer data )
+
+ This is same as PutVideo except that the driver should
+ place only one frame from the stream on the screen.
+
+ typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+
+ short vid_w, short vid_h, short drw_w, short drw_h,
+
+ RegionPtr clipBoxes, pointer data )
+
+ This is same as PutVideo except that the driver gets
+ video from the screen and outputs it. The driver should
+ do the best it can to get the requested dimensions cor-
+ rect without reading from an area larger than requested.
+
+ typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+
+ short vid_w, short vid_h, short drw_w, short drw_h,
+
+ RegionPtr clipBoxes, pointer data )
+
+ This is the same as GetVideo except that the driver
+ should place only one frame from the screen into the out-
+ put stream.
+
+ typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn,
+ pointer data, Bool cleanup)
+
+ This indicates the the driver should stop displaying the
+ video. This is used to stop both input and output video.
+ The cleanup field indicates that the video is being
+ stopped because the client requested it to stop or
+ because the server is exiting the current VT. In that
+ case the driver should deallocate any offscreen memory
+ areas (if there are any) being used to put the video to
+ the screen. If cleanup is not set, the video is being
+ stopped temporarily due to clipping or moving of the win-
+ dow, etc... and video will likely be restarted soon so
+ the driver should not deallocate any offscreen areas
+ associated with that port.
+
+ typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn,
+
+ Atom attribute,INT32 value, pointer data)
+
+ typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn,
+ Atom attribute,INT32 *value, pointer data)
+
+ A port may have particular attributes such as hue, satu-
+ ration, brightness or contrast. Xv clients set and get
+ these attribute values by sending attribute strings
+ (Atoms) to the server. Such requests end up at these
+ driver functions. It is recommended that the driver pro-
+ vide at least the following attributes mentioned in the
+ Xv client library docs:
+
+ XV_ENCODING
+
+ XV_HUE
+
+ XV_SATURATION
+
+ XV_BRIGHTNESS
+
+ XV_CONTRAST
+
+ but the driver may recognize as many atoms as it wishes.
+ If a requested attribute is unknown by the driver it
+ should return BadMatch. XV_ENCODING is the attribute
+ intended to let the client specify which video encoding
+ the particular port should be using (see the description
+ of XF86VideoEncodingRec below). If the requested encod-
+ ing is unsupported, the driver should return XvBadEncod-
+ ing. Success should be returned otherwise.
+
+ typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn,
+
+ Bool motion, short vid_w, short vid_h,
+
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data)
+
+ QueryBestSize provides the client with a way to query
+ what the destination dimensions would end up being if
+ they were to request that an area vid_w × vid_h from the
+ video stream be scaled to rectangle of drw_w × drw_h on
+ the screen. Since it is not expected that all hardware
+ will be able to get the target dimensions exactly, it is
+ important that the driver provide this function. The
+ returned dimensions must be less than or equal to the
+ requested dimension.
+
+The XF86VideoEncodingRec:
+
+ typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+ } XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+ The XF86VideoEncodingRec specifies what encodings the adaptor can
+ support. Most of this data is just informational and for the
+ client's benefit, and is what will be reported by XvQueryEncodings.
+ The id field is expected to be a unique identifier to allow the
+ client to request a certain encoding via the XV_ENCODING attribute
+ string.
+
+The XF86VideoFormatRec:
+
+ typedef struct {
+ char depth;
+ short class;
+ } XF86VideoFormatRec, *XF86VideoFormatPtr;
+
+ This specifies what visuals the video is viewable in. depth is the
+ depth of the visual (not bpp). class is the visual class such as
+ TrueColor, DirectColor or PseudoColor. Initialization of an adap-
+ tor will fail if none of the visuals on that screen are supported.
+
+The XF86AttributeListRec:
+
+ typedef struct {
+ int number;
+ int *flags;
+ char **names;
+ } XF86AttributeListRec, *XF86AttributeListPtr;
+
+ Each port will have one of these indicating the number of
+ attributes for that port, an array of names of the attributes and
+ an array of flags associated with each attribute. Both arrays are
+ number in size. Currently defined flags are XvGettable and XvSet-
+ table which may be OR'd together indicating that attribute is
+ ``gettable'' or ``settable'' by the client. Both arrays can be
+ nulled if number is zero. While the Xv DDX copies most data from
+ these structures and stores it internally, including adaptor and
+ encoding names, the attribute names are not copied, but only their
+ pointers. Because of this, the strings pointed to by names[] must
+ exist as long as Xv is initialized.
+
+17. The Loader
+
+This section describes the interfaces to the module loader. The loader
+interfaces can be divided into two groups: those that are only available to
+the XFree86 common layer, and those that are also available to modules.
+
+17.1 Loader Overview
+
+The loader is capable of loading modules in a range of object formats, and
+knowledge of these formats is built in to the loader. Knowledge of new
+object formats can be added to the loader in a straightforward manner. This
+makes it possible to provide OS-independent modules (for a given CPU archi-
+tecture type). In addition to this, the loader can load modules via the OS-
+provided dlopen(3) service where available. Such modules are not platform
+independent, and the semantics of dlopen() on most systems results in signif-
+icant limitations in the use of modules of this type. Support for dlopen()
+modules in the loader is primarily for experimental and development purposes.
+
+Symbols exported by the loader (on behalf of the core X server) to modules
+are determined at compile time. Only those symbols explicitly exported are
+available to modules. All external symbols of loaded modules are exported to
+other modules, and to the core X server. The loader can be requested to
+check for unresolved symbols at any time, and the action to be taken for
+unresolved symbols can be controlled by the caller of the loader. Typically
+the caller identifies which symbols can safely remain unresolved and which
+cannot.
+
+17.2 Semi-private Loader Interface
+
+The following is the semi-private loader interface that is available to the
+XFree86 common layer.
+
+ void LoaderInit(void)
+
+ The LoaderInit() function initialises the loader, and it
+ must be called once before calling any other loader func-
+ tions. This function initialises the tables of exported
+ symbols, and anything else that might need to be ini-
+ tialised.
+
+ void LoaderSetPath(const char *path)
+
+ The LoaderSetPath() function initialises a default module
+ search path. This must be called if calls to other func-
+ tions are to be made without explicitly specifying a mod-
+ ule search path. The search path path must be a string
+ of one or more comma separated absolute paths. Modules
+ are expected to be located below these paths, possibly in
+ subdirectories of these paths.
+
+ pointer LoadModule(const char *module, const char *path,
+
+ const char **subdirlist, const char **patternlist,
+
+ pointer options, const XF86ModReqInfo * modreq,
+
+ int *errmaj, int *errmin)
+
+ The LoadModule() function loads the module called module.
+ The return value is a module handle, and may be used in
+ future calls to the loader that require a reference to a
+ loaded module. The module name module is normally the
+ module's canonical name, which doesn't contain any direc-
+ tory path information, or any object/library file pre-
+ fixes of suffixes. Currently a full pathname and/or
+ filename is also accepted. This might change. The other
+ parameters are:
+
+ path
+
+ An optional comma-separated list of module
+ search paths. When NULL, the default search
+ path is used.
+
+ subdirlist
+
+ An optional NULL terminated list of subdirecto-
+ ries to search. When NULL, the default built-
+ in list is used (refer to stdSubdirs in load-
+ mod.c). The default list is also substituted
+ for entries in subdirlist with the value
+ DEFAULT_LIST. This makes is possible to aug-
+ ment the default list instead of replacing it.
+ Subdir elements must be relative, and must not
+ contain "..". If any violate this requirement,
+ the load fails.
+
+ patternlist
+
+ An optional NULL terminated list of POSIX regu-
+ lar expressions used to connect module file-
+ names with canonical module names. Each regex
+ should contain exactly one subexpression that
+ corresponds to the canonical module name. When
+ NULL, the default built-in list is used (refer
+ to stdPatterns in loadmod.c). The default list
+ is also substituted for entries in patternlist
+ with the value DEFAULT_LIST. This makes it
+ possible to augment the default list instead of
+ replacing it.
+
+ options
+
+ An optional parameter that is passed to the
+ newly loaded module's SetupProc function (if it
+ has one). This argument is normally a NULL
+ terminated list of Options, and must be inter-
+ preted that way by modules loaded directly by
+ the XFree86 common layer. However, it may be
+ used for application-specific parameter passing
+ in other situations.
+
+ When loading ``external'' modules (modules that
+ don't have the the standard entry point, for
+ example a special shared library) the options
+ parameter can be set to EXTERN_MODULE to tell
+ the loader not to reject the module when it
+ doesn't find the standard entry point.
+
+ modreq
+
+ An optional XF86ModReqInfo* containing ver-
+ sion/ABI/vendor information to requirements to
+ check the newly loaded module against. The
+ main purpose of this is to allow the loader to
+ verify that a module of the correct type/ver-
+ sion before running its SetupProc function.
+ The XF86ModReqInfo struct is defined as fol-
+ lows:
+
+ typedef struct {
+ CARD8 majorversion; /* MAJOR_UNSPEC */
+ CARD8 minorversion; /* MINOR_UNSPEC */
+ CARD16 patchlevel; /* PATCH_UNSPEC */
+ const char * abiclass; /* ABI_CLASS_NONE */
+ CARD32 abiversion; /* ABI_VERS_UNSPEC */
+ const char * moduleclass; /* MOD_CLASS_NONE */
+ } XF86ModReqInfo;
+
+ The information here is compared against the
+ equivalent information in the module's XF86Mod-
+ uleVersionInfo record (which is described
+ below). The values in comments above indicate
+ ``don't care'' settings for each of the fields.
+ The comparisons made are as follows:
+
+ majorversion
+
+ Must match the module's majorversion
+ exactly.
+
+ minorversion
+
+ The module's minor version must be no
+ less than this value. This compari-
+ son is only made if majorversion is
+ specified and matches.
+
+ patchlevel
+
+ The module's patchlevel must be no
+ less than this value. This compari-
+ son is only made if minorversion is
+ specified and matches.
+
+ abiclass
+
+ String must match the module's abi-
+ class string.
+
+ abiversion
+
+ Must be consistent with the module's
+ abiversion (major equal, minor no
+ older).
+
+ moduleclass
+
+ String must match the module's mod-
+ uleclass string.
+
+ errmaj
+
+ An optional pointer to a variable holding the
+ major part or the error code. When provided,
+ it *errmaj is filled in when LoadModule()
+ fails.
+
+ errmin
+
+ Like errmaj, but for the minor part of the
+ error code.
+
+ void UnloadModule(pointer mod)
+
+ This function unloads the module referred to by the han-
+ dle mod. All child modules are also unloaded recur-
+ sively. This function must not be used to directly
+ unload modules that are child modules (i.e., those that
+ have been loaded with LoadSubModule()).
+
+17.3 Module Requirements
+
+Modules must provide information about themselves to the loader, and may
+optionally provide entry points for "setup" and "teardown" functions (those
+two functions are referred to here as SetupProc and TearDownProc).
+
+The module information is contained in the XF86ModuleVersionInfo struct,
+which is defined as follows:
+
+ typedef struct {
+ const char * modname; /* name of module, e.g. "foo" */
+ const char * vendor; /* vendor specific string */
+ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
+ CARD32 _modinfo2_; /* infoarea with a binary editor/sign tool */
+ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* module-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class */
+ CARD32 checksum[4]; /* contains a digital signature of the */
+ /* version info structure */
+ } XF86ModuleVersionInfo;
+
+ The fields are used as follows:
+
+ modname
+
+ The module's name. This field is currently only for
+ informational purposes, but the loader may be modified in
+ future to require it to match the module's canonical
+ name.
+
+ vendor
+
+ The module vendor. This field is for informational pur-
+ poses only.
+
+ _modinfo1_
+
+ This field holds the first part of a signature that can
+ be used to locate this structure in the binary. It
+ should always be initialised to MODINFOSTRING1.
+
+ _modinfo2_
+
+ This field holds the second part of a signature that can
+ be used to locate this structure in the binary. It
+ should always be initialised to MODINFOSTRING2.
+
+ xf86version
+
+ The XFree86 version against which the module was com-
+ piled. This is mostly for informational/diagnostic pur-
+ poses. It should be initialised to XF86_VERSION_CURRENT,
+ which is defined in xf86Version.h.
+
+ majorversion
+
+ The module-specific major version. For modules where
+ this version is used for more than simply informational
+ purposes, the major version should only change (be incre-
+ mented) when ABI incompatibilities are introduced, or ABI
+ components are removed.
+
+ minorversion
+
+ The module-specific minor version. For modules where
+ this version is used for more than simply informational
+ purposes, the minor version should only change (be incre-
+ mented) when ABI additions are made in a backward compat-
+ ible way. It should be reset to zero when the major ver-
+ sion is increased.
+
+ patchlevel
+
+ The module-specific patch level. The patch level should
+ increase with new revisions of the module where there are
+ no ABI changes, and it should be reset to zero when the
+ minor version is increased.
+
+ abiclass
+
+ The ABI class that the module requires. The class is
+ specified as a string for easy extensibility. It should
+ indicate which (if any) of the X server's built-in ABI
+ classes that the module relies on, or a third-party ABI
+ if appropriate. Built-in ABI classes currently defined
+ are:
+ ABI_CLASS_NONE
+ no class
+
+ ABI_CLASS_ANSIC
+
+ only requires the ANSI C interfaces
+
+ ABI_CLASS_VIDEODRV
+
+ requires the video driver ABI
+
+ ABI_CLASS_XINPUT
+
+ requires the XInput driver ABI
+
+ ABI_CLASS_EXTENSION
+
+ requires the extension module ABI
+
+ ABI_CLASS_FONT
+
+ requires the font module ABI
+
+ abiversion
+
+ The version of abiclass that the module requires. The
+ version consists of major and minor components. The
+ major version must match and the minor version must be no
+ newer than that provided by the server or parent module.
+ Version identifiers for the built-in classes currently
+ defined are:
+ ABI_ANSIC_VERSION
+
+ ABI_VIDEODRV_VERSION
+
+ ABI_XINPUT_VERSION
+
+ ABI_EXTENSION_VERSION
+
+ ABI_FONT_VERSION
+
+ moduleclass
+
+ This is similar to the abiclass field, except that it
+ defines the type of module rather than the ABI it
+ requires. For example, although all video drivers
+ require the video driver ABI, not all modules that
+ require the video driver ABI are video drivers. This
+ distinction can be made with the moduleclass. Currently
+ pre-defined module classes are:
+
+ MOD_CLASS_NONE
+
+ MOD_CLASS_VIDEODRV
+
+ MOD_CLASS_XINPUT
+
+ MOD_CLASS_FONT
+
+ MOD_CLASS_EXTENSION
+
+ checksum
+
+ Not currently used.
+
+The module version information, and the optional SetupProc and TearDownProc
+entry points are found by the loader by locating a data object in the module
+called "modnameModuleData", where "modname" is the canonical name of the mod-
+ule. Modules must contain such a data object, and it must be declared with
+global scope, be compile-time initialised, and is of the following type:
+
+ typedef struct {
+ XF86ModuleVersionInfo * vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+ } XF86ModuleData;
+
+The vers parameter must be initialised to a pointer to a correctly ini-
+tialised XF86ModuleVersionInfo struct. The other two parameter are optional,
+and should be initialised to NULL when not required. The other parameters
+are defined as
+
+ typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *)
+
+ typedef void (*ModuleTearDownProc)(pointer)
+
+ pointer SetupProc(pointer module, pointer options,
+
+ int *errmaj, int *errmin)
+
+ When defined, this function is called by the loader after
+ successfully loading a module. module is a handle for
+ the newly loaded module, and maybe used by the SetupProc
+ if it calls other loader functions that require a refer-
+ ence to it. The remaining arguments are those that were
+ passed to the LoadModule() (or LoadSubModule()), and are
+ described above. When the SetupProc is successful it
+ must return a non-NULL value. The loader checks this,
+ and if it is NULL it unloads the module and reports the
+ failure to the caller of LoadModule(). If the SetupProc
+ does things that need to be undone when the module is
+ unloaded, it should define a TearDownProc, and return a
+ pointer that the TearDownProc can use to undo what has
+ been done.
+
+ When a module is loaded multiple times, the SetupProc is
+ called once for each time it is loaded.
+
+ void TearDownProc(pointer tearDownData)
+
+ When defined, this function is called when the loader
+ unloads a module. The tearDownData parameter is the
+ return value of the SetupProc() that was called when the
+ module was loaded. The purpose of this function is to
+ clean up before the module is unloaded (for example, by
+ freeing allocated resources).
+
+17.4 Public Loader Interface
+
+The following is the Loader interface that is available to any part of the
+server, and may also be used from within modules.
+
+ pointer LoadSubModule(pointer parent, const char *module,
+
+ const char **subdirlist, const char **patternlist,
+
+ pointer options, const XF86ModReqInfo * modreq,
+
+ int *errmaj, int *errmin)
+
+ This function is like the LoadModule() function described
+ above, except that the module loaded is registered as a
+ child of the calling module. The parent parameter is the
+ calling module's handle. Modules loaded with this func-
+ tion are automatically unloaded when the parent module is
+ unloaded. The other difference is that the path parame-
+ ter may not be specified. The module search path used
+ for modules loaded with this function is the default
+ search path as initialised with LoaderSetPath().
+
+ void UnloadSubModule(pointer module)
+
+ This function unloads the module with handle module. If
+ that module itself has children, they are also unloaded.
+ It is like LoadModule(), except that it is safe to use
+ for unloading child modules.
+
+ pointer LoaderSymbol(const char *symbol)
+
+ This function returns the address of the symbol with name
+ symbol. This may be used to locate a module entry point
+ with a known name.
+
+ char **LoaderlistDirs(const char **subdirlist,
+
+ const char **patternlist)
+
+ This function returns a NULL terminated list of canonical
+ modules names for modules found in the default module
+ search path. The subdirlist and patternlist parameters
+ are as described above, and can be used to control the
+ locations and names that are searched. If no modules are
+ found, the return value is NULL. The returned list
+ should be freed by calling LoaderFreeDirList() when it is
+ no longer needed.
+
+ void LoaderFreeDirList(char **list)
+
+ This function frees a module list created by Loaderlist-
+ Dirs().
+
+ void LoaderReqSymLists(const char **list0, ...)
+
+ This function allows the registration of required symbols
+ with the loader. It is normally used by a caller of
+ LoadSubModule(). If any symbols registered in this way
+ are found to be unresolved when LoaderCheckUnresolved()
+ is called then LoaderCheckUnresolved() will report a
+ failure. The function takes one or more NULL terminated
+ lists of symbols. The end of the argument list is indi-
+ cated by a NULL argument.
+
+ void LoaderReqSymbols(const char *sym0, ...)
+
+ This function is like LoaderReqSymLists() except that its
+ arguments are symbols rather than lists of symbols. This
+ function is more convenient when single functions are to
+ be registered, especially when the single function might
+ depend on runtime factors. The end of the argument list
+ is indicated by a NULL argument.
+
+ void LoaderRefSymLists(const char **list0, ...)
+
+ This function allows the registration of possibly unre-
+ solved symbols with the loader. When LoaderCheckUnre-
+ solved() is run it won't generate warnings for symbols
+ registered in this way unless they were also registered
+ as required symbols.
+
+ void LoaderRefSymbols(const char *sym0, ...)
+
+ This function is like LoaderRefSymLists() except that its
+ arguments are symbols rather than lists of symbols. This
+ function is more convenient when single functions are to
+ be registered, especially when the single function might
+ depend on runtime factors. The end of the argument list
+ is indicated by a NULL argument.
+
+ int LoaderCheckUnresolved(int delayflag)
+
+ This function checks for unresolved symbols. It gener-
+ ates warnings for unresolved symbols that have not been
+ registered with LoaderRefSymLists(), and maps them to a
+ dummy function. This behaviour may change in future. If
+ unresolved symbols are found that have been registered
+ with LoaderReqSymLists() or LoaderReqSymbols() then this
+ function returns a non-zero value. If none of these sym-
+ bols are unresolved the return value is zero, indicating
+ success.
+
+ The delayflag parameter should normally be set to
+ LD_RESOLV_IFDONE.
+
+ LoaderErrorMsg(const char *name, const char *modname,
+
+ int errmaj, int errmin)
+
+ This function prints an error message that includes the
+ text ``Failed to load module'', the module name modname,
+ a message specific to the errmaj value, and the value if
+ errmin. If name is non-NULL, it is printed as an identi-
+ fying prefix to the message (followed by a `:').
+
+17.5 Special Registration Functions
+
+The loader contains some functions for registering some classes of modules.
+These may be moved out of the loader at some point.
+
+ void LoadExtension(ExtensionModule *ext)
+
+ This registers the entry points for the extension identi-
+ fied by ext. The ExtensionModule struct is defined as:
+
+ typedef struct {
+ InitExtension initFunc;
+ char * name;
+ Bool *disablePtr;
+ InitExtension setupFunc;
+ } ExtensionModule;
+
+ void LoadFont(FontModule *font)
+
+ This registers the entry points for the font rasteriser
+ module identified by font. The FontModule struct is
+ defined as:
+
+ typedef struct {
+ InitFont initFunc;
+ char * name;
+ pointer module;
+ } FontModule;
+
+18. Helper Functions
+
+This section describe ``helper'' functions that video driver might find use-
+ful. While video drivers are not required to use any of these to be consid-
+ered ``compliant'', the use of appropriate helpers is strongly encouraged to
+improve the consistency of driver behaviour.
+
+18.1 Functions for printing messages
+
+ ErrorF(const char *format, ...)
+
+ This is the basic function for writing to the error log
+ (typically stderr and/or a log file). Video drivers
+ should usually avoid using this directly in favour of the
+ more specialised functions described below. This func-
+ tion is useful for printing messages while debugging a
+ driver.
+
+ FatalError(const char *format, ...)
+
+ This prints a message and causes the Xserver to abort.
+ It should rarely be used within a video driver, as most
+ error conditions should be flagged by the return values
+ of the driver functions. This allows the higher layers
+ to decide how to proceed. In rare cases, this can be
+ used within a driver if a fatal unexpected condition is
+ found.
+
+ xf86ErrorF(const char *format, ...)
+
+ This is like ErrorF(), except that the message is only
+ printed when the Xserver's verbosity level is set to the
+ default (1) or higher. It means that the messages are
+ not printed when the server is started with the -quiet
+ flag. Typically this function would only be used for
+ continuing messages started with one of the more spe-
+ cialised functions described below.
+
+ xf86ErrorFVerb(int verb, const char *format, ...)
+
+ Like xf86ErrorF(), except the minimum verbosity level for
+ which the message is to be printed is given explicitly.
+ Passing a verb value of zero means the message is always
+ printed. A value higher than 1 can be used for informa-
+ tion would normally not be needed, but which might be
+ useful when diagnosing problems.
+
+ xf86Msg(MessageType type, const char *format, ...)
+
+ This is like xf86ErrorF(), except that the message is
+ prefixed with a marker determined by the value of type.
+ The marker is used to indicate the type of message (warn-
+ ing, error, probed value, config value, etc). Note the
+ xf86Verbose value is ignored for messages of type
+ X_ERROR.
+
+ The marker values are:
+
+ X_PROBED
+
+ Value was probed.
+
+ X_CONFIG
+
+ Value was given in the config file.
+
+ X_DEFAULT
+
+ Value is a default.
+
+ X_CMDLINE
+
+ Value was given on the command line.
+
+ X_NOTICE
+
+ Notice.
+
+ X_ERROR
+
+ Error message.
+
+ X_WARNING
+
+ Warning message.
+
+ X_INFO
+
+ Informational message.
+
+ X_NONE
+
+ No prefix.
+
+ xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+
+ Like xf86Msg(), but with the verbosity level given
+ explicitly.
+
+ xf86DrvMsg(int scrnIndex, MessageType type, const char *format,
+ ...)
+
+ This is like xf86Msg() except that the driver's name (the
+ name field of the ScrnInfoRec) followed by the scrnIndex
+ in parentheses is printed following the prefix. This
+ should be used by video drivers in most cases as it
+ clearly indicates which driver/screen the message is for.
+ If scrnIndex is negative, this function behaves exactly
+ like xf86Msg().
+ NOTE: This function can only be used after the ScrnIn-
+ foRec and its name field have been allocated. That means
+ that it can not be used before the END of the ChipProbe()
+ function. Prior to that, use xf86Msg(), providing the
+ driver's name explicitly. No screen number can be sup-
+ plied at that point.
+
+ xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+
+ const char *format, ...)
+
+ Like xf86DrvMsg(), but with the verbosity level given
+ explicitly.
+
+18.2 Functions for setting values based on command line and config file
+
+ Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int
+ fbbpp,
+
+ int depth24flags)
+
+ This function sets the depth, pixmapBPP and bitsPerPixel
+ fields of the ScrnInfoRec. It also determines the
+ defaults for display-wide attributes and pixmap formats
+ the screen will support, and finds the Display subsection
+ that matches the depth/bpp. This function should nor-
+ mally be called very early from the ChipPreInit() func-
+ tion.
+ It requires that the confScreen field of the ScrnInfoRec
+ be initialised prior to calling it. This is done by the
+ XFree86 common layer prior to calling ChipPreInit().
+
+ The parameters passed are:
+
+ depth
+
+ driver's preferred default depth if no other is
+ given. If zero, use the overall server
+ default.
+
+ bpp
+
+ Same, but for the pixmap bpp.
+
+ fbbpp
+
+ Same, but for the framebuffer bpp.
+
+ depth24flags
+
+ Flags that indicate the level of 24/32bpp sup-
+ port and whether conversion between different
+ framebuffer and pixmap formats is supported.
+ The flags for this argument are defined as fol-
+ lows, and multiple flags may be ORed together:
+
+ NoDepth24Support
+ No depth 24 formats supported
+
+ Support24bppFb
+
+ 24bpp framebuffer supported
+
+ Support32bppFb
+
+ 32bpp framebuffer supported
+
+ SupportConvert24to32
+
+ Can convert 24bpp pixmap to 32bpp fb
+
+ SupportConvert32to24
+
+ Can convert 32bpp pixmap to 24bpp fb
+
+ ForceConvert24to32
+
+ Force 24bpp pixmap to 32bpp fb con-
+ version
+
+ ForceConvert32to24
+
+ Force 32bpp pixmap to 24bpp fb con-
+ version
+
+ It uses the command line, config file, and default values
+ in the correct order of precedence to determine the depth
+ and bpp values. It is up to the driver to check the
+ results to see that it supports them. If not the Chip-
+ PreInit() function should return FALSE.
+
+ If only one of depth/bpp is given, the other is set to a
+ reasonable (and consistent) default.
+
+ If a driver finds that the initial depth24flags it uses
+ later results in a fb format that requires more video
+ memory than is available it may call this function a sec-
+ ond time with a different depth24flags setting.
+
+ On success, the return value is TRUE. On failure it
+ prints an error message and returns FALSE.
+
+ The following fields of the ScrnInfoRec are initialised
+ by this function:
+
+ depth, bitsPerPixel, display, imageByteOrder,
+ bitmapScanlinePad, bitmapScanlineUnit, bitmap-
+ BitOrder, numFormats, formats, fbFormat.
+
+ void xf86PrintDepthBpp(scrnInfoPtr scrp)
+
+ This function can be used to print out the depth and bpp
+ settings. It should be called after the final call to
+ xf86SetDepthBpp().
+
+ Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
+
+ This function sets the weight, mask, offset and rgbBits
+ fields of the ScrnInfoRec. It would normally be called
+ fairly early in the ChipPreInit() function for
+ depths > 8bpp.
+
+ It requires that the depth and display fields of the
+ ScrnInfoRec be initialised prior to calling it.
+ The parameters passed are:
+
+ weight
+
+ driver's preferred default weight if no other
+ is given. If zero, use the overall server
+ default.
+
+ mask
+
+ Same, but for mask.
+
+ It uses the command line, config file, and default values
+ in the correct order of precedence to determine the
+ weight value. It derives the mask and offset values from
+ the weight and the defaults. It is up to the driver to
+ check the results to see that it supports them. If not
+ the ChipPreInit() function should return FALSE.
+
+ On success, this function prints a message showing the
+ weight values selected, and returns TRUE.
+
+ On failure it prints an error message and returns FALSE.
+
+ The following fields of the ScrnInfoRec are initialised
+ by this function:
+
+ weight, mask, offset.
+
+ Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
+
+ This function sets the defaultVisual field of the ScrnIn-
+ foRec. It would normally be called fairly early from the
+ ChipPreInit() function.
+
+ It requires that the depth and display fields of the
+ ScrnInfoRec be initialised prior to calling it.
+
+ The parameters passed are:
+
+ visual
+
+ driver's preferred default visual if no other
+ is given. If -1, use the overall server
+ default.
+
+ It uses the command line, config file, and default values
+ in the correct order of precedence to determine the
+ default visual value. It is up to the driver to check
+ the result to see that it supports it. If not the Chip-
+ PreInit() function should return FALSE.
+
+ On success, this function prints a message showing the
+ default visual selected, and returns TRUE.
+
+ On failure it prints an error message and returns FALSE.
+
+ Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
+
+ This function sets the gamma field of the ScrnInfoRec.
+ It would normally be called fairly early from the Chip-
+ PreInit() function in cases where the driver supports
+ gamma correction.
+
+ It requires that the monitor field of the ScrnInfoRec be
+ initialised prior to calling it.
+ The parameters passed are:
+
+ gamma
+
+ driver's preferred default gamma if no other is
+ given. If zero (< 0.01), use the overall
+ server default.
+
+ It uses the command line, config file, and default values
+ in the correct order of precedence to determine the gamma
+ value. It is up to the driver to check the results to
+ see that it supports them. If not the ChipPreInit()
+ function should return FALSE.
+
+ On success, this function prints a message showing the
+ gamma value selected, and returns TRUE.
+
+ On failure it prints an error message and returns FALSE.
+
+ void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
+
+ This function sets the xDpi and yDpi fields of the Scrn-
+ InfoRec. The driver can specify preferred defaults by
+ setting x and y to non-zero values. The -dpi command
+ line option overrides all other settings. Otherwise, if
+ the DisplaySize entry is present in the screen's Monitor
+ config file section, it is used together with the virtual
+ size to calculate the dpi values. This function should
+ be called after all the mode resolution has been done.
+
+ void xf86SetBlackWhitePixels(ScrnInfoPtr pScrn)
+
+ This functions sets the blackPixel and whitePixel fields
+ of the ScrnInfoRec according to whether or not the -flip-
+ Pixels command line options is present.
+
+ const char *xf86GetVisualName(int visual)
+
+ Returns a printable string with the visual name matching
+ the numerical visual class provided. If the value is
+ outside the range of valid visual classes, NULL is
+ returned.
+
+18.3 Primary Mode functions
+
+The primary mode helper functions are those which would normally be used by a
+driver, unless it has unusual requirements which cannot be catered for the by
+the helpers.
+
+ int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+
+ char **modeNames, ClockRangePtr clockRanges,
+
+ int *linePitches, int minPitch, int maxPitch,
+
+ int pitchInc, int minHeight, int maxHeight,
+
+ int virtualX, int virtualY,
+
+ unsigned long apertureSize,
+
+ LookupModeFlags strategy)
+
+ This function basically selects the set of modes to use
+ based on those available and the various constraints. It
+ also sets some other related parameters. It is normally
+ called near the end of the ChipPreInit() function.
+
+ The parameters passed to the function are:
+ availModes
+
+ List of modes available for the monitor.
+
+ modeNames
+
+ List of mode names that the screen is request-
+ ing.
+
+ clockRanges
+
+ A list of clock ranges allowed by the driver.
+ Each range includes whether interlaced or mul-
+ tiscan modes are supported for that range. See
+ below for more on clockRanges.
+
+ linePitches
+
+ List of supported line pitches supported by the
+ driver. This is optional and should be NULL
+ when not used.
+
+ minPitch
+
+ Minimum line pitch supported by the driver.
+ This must be supplied when linePitches is NULL,
+ and is ignored otherwise.
+
+ maxPitch
+
+ Maximum line pitch supported by the driver.
+ This is required when minPitch is required.
+
+ pitchInc
+
+ Granularity of horizontal pitch values as sup-
+ ported by the chipset. This is expressed in
+ bits. This must be supplied.
+
+ minHeight
+
+ minimum virtual height allowed. If zero, no
+ limit is imposed.
+
+ maxHeight
+
+ maximum virtual height allowed. If zero, no
+ limit is imposed.
+
+ virtualX
+
+ If greater than zero, this is the virtual width
+ value that will be used. Otherwise, the vir-
+ tual width is chosen to be the smallest that
+ can accommodate the modes selected.
+
+ virtualY
+
+ If greater than zero, this is the virtual
+ height value that will be used. Otherwise, the
+ virtual height is chosen to be the smallest
+ that can accommodate the modes selected.
+
+ apertureSize
+
+ The size (in bytes) of the aperture used to
+ access video memory.
+
+ strategy
+
+ The strategy to use when choosing from multiple
+ modes with the same name. The options are:
+
+ LOOKUP_DEFAULT
+
+ ???
+
+ LOOKUP_BEST_REFRESH
+
+ mode with best refresh rate
+
+ LOOKUP_CLOSEST_CLOCK
+
+ mode with closest matching clock
+
+ LOOKUP_LIST_ORDER
+
+ first usable mode in list
+
+ LOOKUP_CLKDIV2
+
+ Allow halved clocks
+
+ LOOKUP_CLKDIV2 can be combined (OR'ed) with one
+ of the others.
+
+ This function requires that the following fields of the
+ ScrnInfoRec are initialised prior to calling it:
+
+ clock[]
+
+ List of discrete clocks (when non-pro-
+ grammable).
+
+ numClocks
+
+ Number of discrete clocks (when non-pro-
+ grammable).
+
+ progClock
+
+ Whether the clock is programmable or not.
+
+ formats
+
+ pixmap formats for screen
+
+ numFormats
+
+ number of pixmap formats for screen
+
+ videoRam
+
+ total video memory size (in bytes)
+
+ maxHValue
+
+ Maximum horizontal timing value allowed
+
+ maxVValue
+
+ Maximum vertical timing value allowed
+
+ This function fills in the following ScrnInfoRec fields:
+
+ modePool
+
+ A subset of the modes available to the monitor
+ which are compatible with the driver.
+
+ modes
+
+ One mode entry for each of the requested modes,
+ with the status field of each filled in to
+ indicate if the mode has been accepted or not.
+ This list of modes is a circular list.
+
+ virtualX
+
+ The resulting virtual width.
+
+ virtualY
+
+ The resulting virtual height.
+
+ displayWidth
+
+ The resulting line pitch.
+
+ virtualFrom
+
+ Where the virtual size was determined from.
+
+ The first stage of this function checks that the virtualX
+ and virtualY values supplied (if greater than zero) are
+ consistent with the line pitch and maxHeight limitations.
+ If not, an error message is printed, and the return value
+ is -1.
+
+ The second stage sets up the mode pool, eliminating imme-
+ diately any modes that exceed the driver's line pitch
+ limits, and also the virtual width and height limits (if
+ greater than zero). For each mode removed an informa-
+ tional message is printed at verbosity level 2. If the
+ mode pool ends up being empty, an error message is
+ printed, and the return value is -1.
+
+ The final stage is to lookup each mode, and fill in the
+ remaining parameters. If an error condition is encoun-
+ tered, a message is printed, and the return value is -1.
+ Otherwise, the return value is the number of valid modes
+ found (0 if none are found).
+
+ A message is only printed by this function when a funda-
+ mental problem is found. It is intended that this func-
+ tion may be called more than once if there is more than
+ one set of constraints that the driver can work within.
+
+ If this function returns -1, the ChipPreInit() function
+ should return FALSE.
+
+ clockRanges is a linked list of clock ranges allowed by
+ the driver. If a mode doesn't fit in any of the defined
+ clockRanges, it is rejected. The first clockRange that
+ matches all requirements is used.
+
+ clockRanges contains the following fields:
+
+ minClock
+
+ maxClock
+
+ The lower and upper mode clock bounds for which
+ the rest of the clockRange parameters apply.
+ Since these are the mode clocks, they are not
+ scaled with the ClockMulFactor and ClockDivFac-
+ tor. It is up to the driver to adjust these
+ values if they depend on the clock scaling fac-
+ tors.
+
+ clockIndex
+
+ (not used yet) -1 for programmable clocks
+
+ interlaceAllowed
+
+ TRUE if interlacing is allowed for this range
+
+ doubleScanAllowed
+
+ TRUE if doublescan is allowed for this range
+
+ ClockMulFactor
+
+ ClockDivFactor
+
+ Scaling factors that are applied to the mode
+ clocks ONLY before selecting a clock index
+ (when there is no programmable clock) or a Syn-
+ thClock value. This is useful for drivers that
+ support pixel multiplexing or that need to
+ scale the clocks because of hardware restric-
+ tions (like sending 24bpp data to an 8 bit RAM-
+ DAC using a tripled clock).
+
+ Note that these parameters describe what must
+ be done to the mode clock to achieve the data
+ transport clock between graphics controller and
+ RAMDAC. For example for 2:1 pixel multiplex-
+ ing, two pixels are sent to the RAMDAC on each
+ clock. This allows the RAMDAC clock to be half
+ of the actual pixel clock. Hence, ClockMulFac-
+ tor=1 and ClockDivFactor=2. This means that
+ the clock used for clock selection (ie, deter-
+ mining the correct clock index from the list of
+ discrete clocks) or for the SynthClock field in
+ case of a programmable clock is: (mode->Clock
+ * ClockMulFactor) / ClockDivFactor.
+
+ PrivFlags
+
+ This field is copied into the mode->PrivFlags
+ field when this clockRange is selected by
+ xf86ValidateModes(). It allows the driver to
+ find out what clock range was selected, so it
+ knows it needs to set up pixel multiplexing or
+ any other range-dependent feature. This field
+ is purely driver-defined: it may contain flag
+ bits, an index or anything else (as long as it
+ is an INT).
+
+ Note that the mode->SynthClock field is always filled in
+ by xf86ValidateModes(): it will contain the ``data trans-
+ port clock'', which is the clock that will have to be
+ programmed in the chip when it has a programmable clock,
+ or the clock that will be picked from the clocks list
+ when it is not a programmable one. Thus:
+
+ mode->SynthClock =
+
+ (mode->Clock * ClockMulFactor) / ClockDivFactor
+
+ void xf86PruneDriverModes(ScrnInfoPtr scrp)
+
+ This function deletes modes in the modes field of the
+ ScrnInfoRec that have been marked as invalid. This is
+ normally run after having run xf86ValidateModes() for the
+ last time. For each mode that is deleted, a warning mes-
+ sage is printed out indicating the reason for it being
+ deleted.
+
+ void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
+
+ This function fills in the Crtc* fields for all the modes
+ in the modes field of the ScrnInfoRec. The adjustFlags
+ parameter determines how the vertical CRTC values are
+ scaled for interlaced modes. They are halved if it is
+ INTERLACE_HALVE_V. The vertical CRTC values are doubled
+ for doublescan modes, and are further multiplied by the
+ VScan value.
+
+ This function is normally called after calling
+ xf86PruneDriverModes().
+
+ NOTE: The Crtc* fields are not initialised anywhere else,
+ so the driver must either call this function or ini-
+ tialise them itself.
+
+ void xf86PrintModes(ScrnInfoPtr scrp)
+
+ This function prints out the virtual size setting, and
+ the line pitch being used. It also prints out one line
+ for each mode being used, including its pixel clock, hor-
+ izontal sync rate, refresh rate, and whether it is inter-
+ laced or multiscan.
+
+ This function is normally called after calling
+ xf86SetCrtcForModes().
+
+18.4 Secondary Mode functions
+
+The secondary mode helper functions are functions which are normally used by
+the primary mode helper functions, and which are not normally called directly
+by a driver. If a driver has unusual requirements and needs to do its own
+mode validation, it might be able to make use of some of these secondary mode
+helper functions.
+
+ int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+
+ int *divider)
+
+ This function returns the index of the closest clock to
+ the frequency freq given (in kHz). It assumes that the
+ number of clocks is greater than zero. It requires that
+ the numClocks and clock fields of the ScrnInfoRec are
+ initialised. The allowDiv2 field determines if the
+ clocks can be halved. The *divider return value indi-
+ cates whether clock division is used when determining the
+ clock returned.
+
+ This function is only for non-programmable clocks.
+
+ const char *xf86ModeStatusToString(ModeStatus status)
+
+ This function converts the status value to a descriptive
+ printable string.
+
+ ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+
+ ClockRangePtr clockRanges, LookupModeFlags strategy)
+
+ This function takes a pointer to a mode with the name
+ filled in, and looks for a mode in the modePool list
+ which matches. The parameters of the matching mode are
+ filled in to *modep. The clockRanges and strategy param-
+ eters are as for the xf86ValidateModes() function above.
+
+ This function requires the modePool, clock[], numClocks
+ and progClock fields of the ScrnInfoRec to be initialised
+ before being called.
+
+ The return value is MODE_OK if a mode was found. Other-
+ wise it indicates why a matching mode could not be found.
+
+ ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp,
+
+ DisplayModePtr mode, int maxPitch,
+
+ int virtualX, int virtualY)
+
+ This function checks the passed mode against some basic
+ driver constraints. Apart from the ones passed explic-
+ itly, the maxHValue and maxVValue fields of the ScrnIn-
+ foRec are also used. If the ValidMode field of the Scrn-
+ InfoRec is set, that function is also called to check the
+ mode.
+ If the mode is consistent with the constraints, the
+ return value is MODE_OK. Otherwise the return value
+ indicates which constraint wasn't met.
+
+ void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
+
+ This function deletes the mode given from the modeList.
+ It never prints any messages, so it is up to the caller
+ to print a message if required.
+
+18.5 Functions for handling strings and tokens
+
+Tables associating strings and numerical tokens combined with the following
+functions provide a compact way of handling strings from the config file, and
+for converting tokens into printable strings. The table data structure is:
+
+ typedef struct {
+ int token;
+ const char * name;
+ } SymTabRec, *SymTabPtr;
+
+A table is an initialised array of SymTabRec. The tokens must be non-nega-
+tive integers. Multiple names may be mapped to a single token. The table is
+terminated with an element with a token value of -1 and NULL for the name.
+
+ const char *xf86TokenToString(SymTabPtr table, int token)
+
+ This function returns the first string in table that
+ matches token. If no match is found, NULL is returned
+ (NOTE, older versions of this function would return the
+ string "unknown" when no match is found).
+
+ int xf86StringToToken(SymTabPtr table, const char *string)
+
+ This function returns the first token in table that
+ matches string. The xf86NameCmp() function is used to
+ determine the match. If no match is found, -1 is
+ returned.
+
+18.6 Functions for finding which config file entries to use
+
+These functions can be used to select the appropriate config file entries
+that match the detected hardware. They are described above in the Probe
+(section 5.8, page 1) and Available Functions (section 9.3, page 1) sections.
+
+18.7 Probing discrete clocks on old hardware
+
+The xf86GetClocks() function may be used to assist in finding the discrete
+pixel clock values on older hardware.
+
+ void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+
+ Bool (*ClockFunc)(ScrnInfoPtr, int),
+
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+
+ void (*BlankScreen)(ScrnInfoPtr, Bool),
+
+ int vertsyncreg, int maskval, int knownclkindex,
+
+ int knownclkvalue)
+
+ This function uses a comparative sampling method to mea-
+ sure the discrete pixel clock values. The number of dis-
+ crete clocks to measure is given by num. clockFunc is a
+ function that selects the n'th clock. It should also
+ save or restore any state affected by programming the
+ clocks when the index passed is CLK_REG_SAVE or
+ CLK_REG_RESTORE. ProtectRegs is a function that does
+ whatever is required to protect the hardware state while
+ selecting a new clock. BlankScreen is a function that
+ blanks the screen. vertsyncreg and maskval are the reg-
+ ister and bitmask to check for the presence of vertical
+ sync pulses. knownclkindex and knownclkvalue are the
+ index and value of a known clock. These are the known
+ references on which the comparative measurements are
+ based. The number of clocks probed is set in pScrn->num-
+ Clocks, and the probed clocks are set in the
+ pScrn->clock[] array. All of the clock values are in
+ units of kHz.
+
+ void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
+
+ Print out the pixel clocks scrp->clock[]. from indicates
+ whether the clocks were probed or from the config file.
+
+19. The vgahw module
+
+The vgahw modules provides an interface for saving, restoring and programming
+the standard VGA registers, and for handling VGA colourmaps.
+
+19.1 Data Structures
+
+The public data structures used by the vgahw module are vgaRegRec and vgaH-
+WRec. They are defined in vgaHW.h.
+
+19.2 General vgahw Functions
+
+ Bool vgaHWGetHWRec(ScrnInfoPtr pScrn)
+
+ This function allocates a vgaHWRec structure, and hooks
+ it into the ScrnInfoRec's privates. Like all information
+ hooked into the privates, it is persistent, and only
+ needs to be allocated once per screen. This function
+ should normally be called from the driver's ChipPreInit()
+ function. The vgaHWRec is zero-allocated, and the fol-
+ lowing fields are explicitly initialised:
+ ModeReg.DAC[]
+
+ initialised with a default colourmap
+
+ ModeReg.Attribute[0x11]
+
+ initialised with the default overscan index
+
+ ShowOverscan
+
+ initialised according to the "ShowOverscan"
+ option
+
+ paletteEnabled
+
+ initialised to FALSE
+
+ cmapSaved
+
+ initialised to FALSE
+
+ pScrn
+
+ initialised to pScrn
+
+ In addition to the above, vgaHWSetStdFuncs() is called to
+ initialise the register access function fields with the
+ standard VGA set of functions.
+
+ Once allocated, a pointer to the vgaHWRec can be obtained
+ from the ScrnInfoPtr with the VGAHWPTR(pScrn) macro.
+
+ void vgaHWFreeHWRec(ScrnInfoPtr pScrn)
+
+ This function frees a vgaHWRec structure. It should be
+ called from a driver's ChipFreeScreen() function.
+
+ Bool vgaHWSetRegCounts(ScrnInfoPtr pScrn, int numCRTC,
+
+ int numSequencer, int numGraphics, int numAttribute)
+
+ This function allows the number of CRTC, Sequencer,
+ Graphics and Attribute registers to be changed. This
+ makes it possible for extended registers to be saved and
+ restored with vgaHWSave() and vgaHWRestore(). This func-
+ tion should be called after a vgaHWRec has been allocated
+ with vgaHWGetHWRec(). The default values are defined in
+ vgaHW.h as follows:
+
+ #define VGA_NUM_CRTC 25
+ #define VGA_NUM_SEQ 5
+ #define VGA_NUM_GFX 9
+ #define VGA_NUM_ATTR 21
+
+ Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)
+
+ This function copies the contents of the VGA saved regis-
+ ters in src to dst. Note that it isn't possible to sim-
+ ply do this with memcpy() (or similar). This function
+ returns TRUE unless there is a problem allocating space
+ for the CRTC and related fields in dst.
+
+ void vgaHWSetStdFuncs(vgaHWPtr hwp)
+
+ This function initialises the register access function
+ fields of hwp with the standard VGA set of functions.
+ This is called by vgaHWGetHWRec(), so there is usually no
+ need to call this explicitly. The register access func-
+ tions are described below.
+
+ void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
+
+ This function initialised the register access function
+ fields of hwp with a generic MMIO set of functions.
+ hwp->MMIOBase is initialised with base, which must be the
+ virtual address that the start of MMIO area is mapped to.
+ hwp->MMIOOffset is initialised with offset, which must be
+ calculated in such a way that when the standard VGA I/O
+ port value is added to it the correct offset into the
+ MMIO area results. That means that these functions are
+ only suitable when the VGA I/O ports are made available
+ in a direct mapping to the MMIO space. If that is not
+ the case, the driver will need to provide its own regis-
+ ter access functions. The register access functions are
+ described below.
+
+ Bool vgaHWMapMem(ScrnInfoPtr pScrn)
+
+ This function maps the VGA memory window. It requires
+ that the vgaHWRec be allocated. If a driver requires
+ non-default MapPhys or MapSize settings (the physical
+ location and size of the VGA memory window) then those
+ fields of the vgaHWRec must be initialised before calling
+ this function. Otherwise, this function initialiases the
+ default values of 0xA0000 for MapPhys and (64 * 1024) for
+ MapSize. This function must be called before attempting
+ to save or restore the VGA state. If the driver doesn't
+ call it explicitly, the vgaHWSave() and vgaHWRestore()
+ functions may call it if they need to access the VGA mem-
+ ory (in which case they will also call vgaHWUnmapMem() to
+ unmap the VGA memory before exiting).
+
+ void vgaHWUnmapMem(ScrnInfoPtr pScrn)
+
+ This function unmaps the VGA memory window. It must only
+ be called after the memory has been mapped. The Base
+ field of the vgaHWRec field is set to NULL to indicate
+ that the memory is no longer mapped.
+
+ void vgaHWGetIOBase(vgaHWPtr hwp)
+
+ This function initialises the IOBase field of the vgaH-
+ WRec. This function must be called before using any
+ other functions that access the video hardware.
+
+ A macro VGAHW_GET_IOBASE() is also available in vgaHW.h
+ that returns the I/O base, and this may be used when the
+ vgahw module is not loaded (for example, in the Chip-
+ Probe() function).
+
+ void vgaHWUnlock(vgaHWPtr hwp)
+
+ This function unlocks the VGA CRTC[0-7] registers, and
+ must be called before attempting to write to those regis-
+ ters.
+
+ A macro VGAHW_UNLOCK(base) is also available in vgaHW.h
+ that does the same thing, and this may be used when the
+ vgahw module is not loaded (for example, in the Chip-
+ Probe() function).
+
+ void vgaHWLock(vgaHWPtr hwp)
+
+ This function locks the VGA CRTC[0-7] registers.
+
+ A macro VGAHW_LOCK(base) is also available in vgaHW.h
+ that does the same thing, and this may be used when the
+ vgahw module is not loaded (for example, in the Chip-
+ Probe() function).
+
+ void vgaHWSave(ScrnInfoPtr pScrn, vgaRegPtr save, int flags)
+
+ This function saves the VGA state. The state is written
+ to the vgaRegRec pointed to by save. flags is set to one
+ or more of the following flags ORed together:
+
+ VGA_SR_MODE
+
+ the mode setting registers are saved
+
+ VGA_SR_FONTS
+
+ the text mode font/text data is saved
+
+ VGA_SR_CMAP
+
+ the colourmap (LUT) is saved
+
+ VGA_SR_ALL
+
+ all of the above are saved
+
+ The vgaHWRec and its IOBase fields must be initialised
+ before this function is called. If VGA_SR_FONTS is set
+ in flags, the VGA memory window must be mapped. If it
+ isn't then vgaHWMapMem() will be called to map it, and
+ vgaHWUnmapMem() will be called to unmap it afterwards.
+ vgaHWSave() uses the three functions below in the order
+ vgaHWSaveColormap(), vgaHWSaveMode(), vgaHWSaveFonts() to
+ carry out the different save phases. It is undecided at
+ this stage whether they will be part of the vgahw mod-
+ ule's public interface or not.
+
+ void vgaHWSaveMode(ScrnInfoPtr pScrn, vgaRegPtr save)
+
+ This functions saves the VGA mode registers. They are
+ saved to the vgaRegRec pointed to by save. The registers
+ saved are:
+
+ MiscOut
+
+ CRTC[0-0x18]
+
+ Attribute[0-0x14]
+
+ Graphics[0-8]
+
+ Sequencer[0-4]
+
+ void vgaHWSaveFonts(ScrnInfoPtr pScrn, vgaRegPtr save)
+
+ This functions saves the text mode font and text data
+ held in the video memory. If called while in a graphics
+ mode, no save is done. The VGA memory window must be
+ mapped with vgaHWMapMem() before to calling this func-
+ tion.
+
+ On some platforms, one or more of the font/text plane
+ saves may be no-ops. This is the case when the plat-
+ form's VC driver already takes care of this.
+
+ void vgaHWSaveColormap(ScrnInfoPtr pScrn, vgaRegPtr save)
+
+ This function saves the VGA colourmap (LUT). Before sav-
+ ing it, it attempts to verify that the colourmap is read-
+ able. In rare cases where it isn't readable, a default
+ colourmap is saved instead.
+
+ void vgaHWRestore(ScrnInfoPtr pScrn, vgaRegPtr restore, int flags)
+
+ This function programs the VGA state. The state pro-
+ grammed is that contained in the vgaRegRec pointed to by
+ restore. flags is the same as described above for the
+ vgaHWSave() function.
+
+ The vgaHWRec and its IOBase fields must be initialised
+ before this function is called. If VGA_SR_FONTS is set
+ in flags, the VGA memory window must be mapped. If it
+ isn't then vgaHWMapMem() will be called to map it, and
+ vgaHWUnmapMem() will be called to unmap it afterwards.
+ vgaHWRestore() uses the three functions below in the
+ order vgaHWRestoreFonts(), vgaHWRestoreMode(), vgaHWRe-
+ storeColormap() to carry out the different restore
+ phases. It is undecided at this stage whether they will
+ be part of the vgahw module's public interface or not.
+
+ void vgaHWRestoreMode(ScrnInfoPtr pScrn, vgaRegPtr restore)
+
+ This functions restores the VGA mode registers. They are
+ restore from the data in the vgaRegRec pointed to by
+ restore. The registers restored are:
+
+ MiscOut
+
+ CRTC[0-0x18]
+
+ Attribute[0-0x14]
+
+ Graphics[0-8]
+
+ Sequencer[0-4]
+
+ void vgaHWRestoreFonts(ScrnInfoPtr pScrn, vgaRegPtr restore)
+
+ This functions restores the text mode font and text data
+ to the video memory. The VGA memory window must be
+ mapped with vgaHWMapMem() before to calling this func-
+ tion.
+
+ On some platforms, one or more of the font/text plane
+ restores may be no-ops. This is the case when the plat-
+ form's VC driver already takes care of this.
+
+ void vgaHWRestoreColormap(ScrnInfoPtr pScrn, vgaRegPtr restore)
+
+ This function restores the VGA colourmap (LUT).
+
+ void vgaHWInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+
+ This function fills in the vgaHWRec's ModeReg field with
+ the values appropriate for programming the given video
+ mode. It requires that the ScrnInfoRec's depth field is
+ initialised, which determines how the registers are pro-
+ grammed.
+
+ void vgaHWSeqReset(vgaHWPtr hwp, Bool start)
+
+ Do a VGA sequencer reset. If start is TRUE, the reset is
+ started. If start is FALSE, the reset is ended.
+
+ void vgaHWProtect(ScrnInfoPtr pScrn, Bool on)
+
+ This function protects VGA registers and memory from cor-
+ ruption during loads. It is typically called with on set
+ to TRUE before programming, and with on set to FALSE
+ after programming.
+
+ Bool vgaHWSaveScreen(ScreenPtr pScreen, Bool on)
+
+ This function blanks and unblanks the screen. It is
+ blanked when on is FALSE, and unblanked when on is TRUE.
+
+ void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on)
+
+ This function blanks and unblanks the screen. It is
+ blanked when on is FALSE, and unblanked when on is TRUE.
+ This function is provided for use in cases where the
+ ScrnInfoRec can't be derived from the ScreenRec, like
+ probing for clocks.
+
+19.3 VGA Colormap Functions
+
+The vgahw modules uses the standard colormap support (see the Colormap Han-
+dling (section 13., page 1) section. This is initialised with the following
+function:
+
+ Bool vgaHWHandleColormaps(ScreenPtr pScreen)
+
+19.4 VGA Register Access Functions
+
+The vgahw module abstracts access to the standard VGA registers by using a
+set of functions held in the vgaHWRec. When the vgaHWRec is created these
+function pointers are initialised with the set of standard VGA I/O register
+access functions. In addition to these, the vgahw module includes a basic
+set of MMIO register access functions, and the vgaHWRec function pointers can
+be initialised to these by calling the vgaHWSetMmioFuncs() function described
+above. Some drivers/platforms may require a different set of functions for
+VGA access. The access functions are described here.
+
+ void writeCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)
+
+ Write value to CRTC register index.
+
+ CARD8 readCrtc(vgaHWPtr hwp, CARD8 index)
+
+ Return the value read from CRTC register index.
+
+ void writeGr(vgaHWPtr hwp, CARD8 index, CARD8 value)
+
+ Write value to Graphics Controller register index.
+
+ CARD8 readGR(vgaHWPtr hwp, CARD8 index)
+
+ Return the value read from Graphics Controller register
+ index.
+
+ void writeSeq(vgaHWPtr hwp, CARD8 index, CARD8, value)
+
+ Write value to Sequencer register index.
+
+ CARD8 readSeq(vgaHWPtr hwp, CARD8 index)
+
+ Return the value read from Sequencer register index.
+
+ void writeAttr(vgaHWPtr hwp, CARD8 index, CARD8, value)
+
+ Write value to Attribute Controller register index. When
+ writing out the index value this function should set bit
+ 5 (0x20) according to the setting of hwp->paletteEnabled
+ in order to preserve the palette access state. It should
+ be cleared when hwp->paletteEnabled is TRUE and set when
+ it is FALSE.
+
+ CARD8 readAttr(vgaHWPtr hwp, CARD8 index)
+
+ Return the value read from Attribute Controller register
+ index. When writing out the index value this function
+ should set bit 5 (0x20) according to the setting of
+ hwp->paletteEnabled in order to preserve the palette
+ access state. It should be cleared when hwp->paletteEn-
+ abled is TRUE and set when it is FALSE.
+
+ void writeMiscOut(vgaHWPtr hwp, CARD8 value)
+
+ Write `value' to the Miscellaneous Output register.
+
+ CARD8 readMiscOut(vgwHWPtr hwp)
+
+ Return the value read from the Miscellaneous Output reg-
+ ister.
+
+ void enablePalette(vgaHWPtr hwp)
+
+ Clear the palette address source bit in the Attribute
+ Controller index register and set hwp->paletteEnabled to
+ TRUE.
+
+ void disablePalette(vgaHWPtr hwp)
+
+ Set the palette address source bit in the Attribute Con-
+ troller index register and set hwp->paletteEnabled to
+ FALSE.
+
+ void writeDacMask(vgaHWPtr hwp, CARD8 value)
+
+ Write value to the DAC Mask register.
+
+ CARD8 readDacMask(vgaHWptr hwp)
+
+ Return the value read from the DAC Mask register.
+
+ void writeDacReadAddress(vgaHWPtr hwp, CARD8 value)
+
+ Write value to the DAC Read Address register.
+
+ void writeDacWriteAddress(vgaHWPtr hwp, CARD8 value)
+
+ Write value to the DAC Write Address register.
+
+ void writeDacData(vgaHWPtr hwp, CARD8 value)
+
+ Write value to the DAC Data register.
+
+ CARD8 readDacData(vgaHWptr hwp)
+
+ Return the value read from the DAC Data register.
+
+20. Some notes about writing a driver
+
+NOTE: some parts of this are not up to date
+
+The following is an outline for writing a basic unaccelerated driver for a
+PCI video card with a linear mapped framebuffer, and which has a VGA core.
+It is includes some general information that is relevant to most drivers
+(even those which don't fit that basic description).
+
+The information here is based on the initial conversion of the Matrox Millen-
+nium driver to the ``new design''. For a fleshing out and sample implementa-
+tion of some of the bits outlined here, refer to that driver. Note that this
+is an example only. The approach used here will not be appropriate for all
+drivers.
+
+Each driver must reserve a unique driver name, and a string that is used to
+prefix all of its externally visible symbols. This is to avoid name space
+clashes when loading multiple drivers. The examples here are for the ``ZZZ''
+driver, which uses the ``ZZZ'' or ``zzz'' prefix for its externally visible
+symbols.
+
+20.1 Include files
+
+All drivers normally include the following headers:
+
+ "xf86.h"
+
+ "xf86_OSproc.h"
+
+ "xf86_ansic.h"
+
+ "xf86Resources.h"
+
+Wherever inb/outb (and related things) are used the following should be
+included:
+
+ "compiler.h"
+
+Drivers that need to access PCI vendor/device definitions need this:
+
+ "xf86PciInfo.h"
+
+Drivers that need to access the PCI config space need this:
+
+ "xf86Pci.h"
+
+Drivers using the mi banking wrapper need:
+
+ "mibank.h"
+
+Drivers that initialise a SW cursor need this:
+
+ "mipointer.h"
+
+All drivers implementing backing store need this:
+
+ "mibstore.h"
+
+All drivers using the mi colourmap code need this:
+
+ "micmap.h"
+
+If a driver uses the vgahw module, it needs this:
+
+ "vgaHW.h"
+
+Drivers supporting VGA or Hercules monochrome screens need:
+
+ "xf1bpp.h"
+
+Drivers supporting VGA or EGC 16-colour screens need:
+
+ "xf4bpp.h"
+
+Drivers using cfb need:
+
+ #define PSZ 8
+
+ #include "cfb.h"
+
+ #undef PSZ
+
+Drivers supporting bpp 16, 24 or 32 with cfb need one or more of:
+
+ "cfb16.h"
+
+ "cfb24.h"
+
+ "cfb32.h"
+
+The driver's own header file:
+
+ "zzz.h"
+
+Drivers must NOT include the following:
+
+ "xf86Priv.h"
+
+ "xf86Privstr.h"
+
+ "xf86_libc.h"
+
+ "xf86_OSlib.h"
+
+ "Xos.h"
+
+ any OS header
+
+20.2 Data structures and initialisation
+
+ o The following macros should be defined:
+
+ #define VERSION <version-as-an-int>
+ #define ZZZ_NAME "ZZZ" /* the name used to prefix messages */
+ #define ZZZ_DRIVER_NAME "zzz" /* the driver name as used in config file */
+ #define ZZZ_MAJOR_VERSION <int>
+ #define ZZZ_MINOR_VERSION <int>
+ #define ZZZ_PATCHLEVEL <int>
+
+ XXX Probably want to remove one of these version.
+
+ NOTE: ZZZ_DRIVER_NAME should match the name of the driver module without
+ things like the "lib" prefix, the "_drv" suffix or filename extensions.
+
+ o A DriverRec must be defined, which includes the functions required at
+ the pre-probe phase. The name of this DriverRec must be an upper-case
+ version of ZZZ_DRIVER_NAME (for the purposes of static linking).
+
+ DriverRec ZZZ = {
+ VERSION,
+ "unaccelerated driver for ZZZ Zzzzzy cards",
+ ZZZIdentify,
+ ZZZProbe,
+ NULL,
+ 0
+ };
+
+ o Define list of supported chips and their matching ID:
+
+ static SymTabRec ZZZChipsets[] = {
+ { PCI_CHIP_ZZZ1234, "zzz1234a" },
+ { PCI_CHIP_ZZZ5678, "zzz5678a" },
+ { -1, NULL }
+ };
+
+ The token field may be any integer value that the driver may use to
+ uniquely identify the supported chipsets. For drivers that support only
+ PCI devices using the PCI device IDs might be a natural choice, but this
+ isn't mandatory. For drivers that support both PCI and other devices
+ (like ISA), some other ID should probably used. When other IDs are used
+ as the tokens it is recommended that the names be defined as an enum
+ type.
+
+ o If the driver uses the xf86MatchPciInstances() helper (recommended for
+ drivers that support PCI cards) a list that maps PCI IDs to chip IDs and
+ fixed resources must be defined:
+
+ static PciChipsets ZZZPciChipsets[] = {
+ { PCI_CHIP_ZZZ1234, PCI_CHIP_ZZZ1234, RES_SHARED_VGA },
+ { PCI_CHIP_ZZZ5678, PCI_CHIP_ZZZ5678, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED }
+ }
+
+ o Define the XF86ModuleVersionInfo struct for the driver. This is
+ required for the dynamically loaded version:
+
+ #ifdef XFree86LOADER
+ static XF86ModuleVersionInfo zzzVersRec =
+ {
+ "zzz",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ ZZZ_MAJOR_VERSION, ZZZ_MINOR_VERSION, ZZZ_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0,0,0,0}
+ };
+ #endif
+
+ o Define a data structure to hold the driver's screen-specific data. This
+ must be used instead of global variables. This would be defined in the
+ "zzz.h" file, something like:
+
+ typedef struct {
+ type1 field1;
+ type2 field2;
+ int fooHack;
+ Bool pciRetry;
+ Bool noAccel;
+ Bool hwCursor;
+ CloseScreenProcPtr CloseScreen;
+ ...
+ } ZZZRec, *ZZZPtr;
+
+ o Define the list of config file Options that the driver accepts. For
+ consistency between drivers those in the list of ``standard'' options
+ should be used where appropriate before inventing new options.
+
+ typedef enum {
+ OPTION_FOO_HACK,
+ OPTION_PCI_RETRY,
+ OPTION_HW_CURSOR,
+ OPTION_NOACCEL
+ } ZZZOpts;
+
+ static OptionInfoRec ZZZOptions[] = {
+ { OPTION_FOO_HACK, "FooHack", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+ };
+
+20.3 Functions
+
+20.3.1 SetupProc
+
+For dynamically loaded modules, a ModuleData variable is required. It is
+should be the name of the driver prepended to "ModuleData". A Setup() func-
+tion is also required, which calls xf86AddDriver() to add the driver to the
+main list of drivers.
+
+ #ifdef XFree86LOADER
+
+ static MODULESETUPPROTO(mgaSetup);
+
+ XF86ModuleData zzzModuleData = { &zzzVersRec, zzzSetup, NULL };
+
+ static pointer
+ zzzSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ {
+ static Bool setupDone = FALSE;
+
+ /* This module should be loaded only once, but check to be sure. */
+
+ if (!setupDone) {
+ /*
+ * Modules that this driver always requires may be loaded
+ * here by calling LoadSubModule().
+ */
+
+ setupDone = TRUE;
+ xf86AddDriver(&MGA, module, 0);
+
+ /*
+ * The return value must be non-NULL on success even though
+ * there is no TearDownProc.
+ */
+ return (pointer)1;
+ } else {
+ if (errmaj) *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+ }
+ #endif
+
+20.3.2 GetRec, FreeRec
+
+A function is usually required to allocate the driver's screen-specific data
+structure and hook it into the ScrnInfoRec's driverPrivate field. The Scrn-
+InfoRec's driverPrivate is initialised to NULL, so it is easy to check if the
+initialisation has already been done. After allocating it, initialise the
+fields. By using xnfcalloc() to do the allocation it is zeroed, and if the
+allocation fails the server exits.
+
+ static Bool
+ ZZZGetRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate != NULL)
+ return TRUE;
+ pScrn->driverPrivate = xnfcalloc(sizeof(ZZZRec), 1);
+ /* Initialise as required */
+ ...
+ return TRUE;
+ }
+
+Define a macro in "zzz.h" which gets a pointer to the ZZZRec when given
+pScrn:
+
+ #define ZZZPTR(p) ((ZZZPtr)((p)->driverPrivate))
+
+Define a function to free the above, setting it to NULL once it has been
+freed:
+
+ static void
+ ZZZFreeRec(ScrnInfoPtr pScrn)
+ {
+ if (pScrn->driverPrivate == NULL)
+ return;
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+20.3.3 Identify
+
+Define the Identify() function. It is run before the Probe, and typically
+prints out an identifying message, which might include the chipsets it sup-
+ports. This function is mandatory:
+
+ static void
+ ZZZIdentify(int flags)
+ {
+ xf86PrintChipsets(ZZZ_NAME, "driver for ZZZ Tech chipsets",
+ ZZZChipsets);
+ }
+
+20.3.4 Probe
+
+Define the Probe() function. The purpose of this is to find all instances of
+the hardware that the driver supports, and for the ones not already claimed
+by another driver, claim the slot, and allocate a ScrnInfoRec. This should
+be a minimal probe, and it should under no circumstances leave the state of
+the hardware changed. Because a device is found, don't assume that it will
+be used. Don't do any initialisations other than the required ScrnInfoRec
+initialisations. Don't allocate any new data structures.
+
+This function is mandatory.
+
+NOTE: The xf86DrvMsg() functions cannot be used from the Probe.
+
+ static Bool
+ ZZZProbe(DriverPtr drv, int flags)
+ {
+ Bool foundScreen = FALSE;
+ int numDevSections, numUsed;
+ GDevPtr *devSections;
+ int *usedChips;
+ int i;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice(ZZZ_DRIVER_NAME,
+ &devSections)) <= 0) {
+ return FALSE;
+ }
+
+ /*
+ * Since this is a PCI card, "probing" just amounts to checking
+ * the PCI data that the server has already collected. If there
+ * is none, return.
+ *
+ * Although the config file is allowed to override things, it
+ * is reasonable to not allow it to override the detection
+ * of no PCI video cards.
+ *
+ * The provided xf86MatchPciInstances() helper takes care of
+ * the details.
+ */
+ /* test if PCI bus present */
+ if (xf86GetPciVideoInfo()) {
+
+ numUsed = xf86MatchPciInstances(ZZZ_NAME, PCI_VENDOR_ZZZ,
+ ZZZChipsets, ZZZPciChipsets, devSections,
+ numDevSections, drv, &usedChips);
+
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn;
+
+ /* Allocate a ScrnInfoRec */
+ pScrn = xf86AllocateScreen(drv, 0);
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = ZZZ_DRIVER_NAME;
+ pScrn->name = ZZZ_NAME;
+ pScrn->Probe = ZZZProbe;
+ pScrn->PreInit = ZZZPreInit;
+ pScrn->ScreenInit = ZZZScreenInit;
+ pScrn->SwitchMode = ZZZSwitchMode;
+ pScrn->AdjustFrame = ZZZAdjustFrame;
+ pScrn->EnterVT = ZZZEnterVT;
+ pScrn->LeaveVT = ZZZLeaveVT;
+ pScrn->FreeScreen = ZZZFreeScreen;
+ pScrn->ValidMode = ZZZValidMode;
+ foundScreen = TRUE;
+ /* add screen to entity */
+ xf86ConfigActivePciEntity(pScrn, usedChips[i],
+ ZZZPciChipsets, NULL, NULL, NULL, NULL, NULL);
+
+ }
+ if (numUsed > 0)
+ xfree(usedChips);
+ }
+
+ #ifdef HAS_ISA_DEVS
+ /*
+ * If the driver supports ISA hardware, the following block
+ * can be included too.
+ */
+ numUsed = xf86MatchIsaInstances(ZZZ_NAME, ZZZChipsets,
+ ZZZIsaChipsets, drv, ZZZFindIsaDevice,
+ devSections, numDevSections, &usedChips);
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv,0);
+
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = ZZZ_DRIVER_NAME;
+ pScrn->name = ZZZ_NAME;
+ pScrn->Probe = ZZZProbe;
+ pScrn->PreInit = ZZZPreInit;
+ pScrn->ScreenInit = ZZZScreenInit;
+ pScrn->SwitchMode = ZZZSwitchMode;
+ pScrn->AdjustFrame = ZZZAdjustFrame;
+ pScrn->EnterVT = ZZZEnterVT;
+ pScrn->LeaveVT = ZZZLeaveVT;
+ pScrn->FreeScreen = ZZZFreeScreen;
+ pScrn->ValidMode = ZZZValidMode;
+ foundScreen = TRUE;
+ xf86ConfigActiveIsaEntity(pScrn, usedChips[i], ZZZIsaChipsets,
+ NULL, NULL, NULL, NULL, NULL);
+ }
+ if (numUsed > 0)
+ xfree(usedChips);
+ #endif /* HAS_ISA_DEVS */
+
+ xfree(devSections);
+ return foundScreen;
+
+20.3.5 PreInit
+
+Define the PreInit() function. The purpose of this is to find all the infor-
+mation required to determine if the configuration is usable, and to ini-
+tialise those parts of the ScrnInfoRec that can be set once at the beginning
+of the first server generation. The information should be found in the least
+intrusive way possible.
+
+This function is mandatory.
+
+NOTES:
+
+ 1. The PreInit() function is only called once during the life of the X
+ server (at the start of the first generation).
+
+ 2. Data allocated here must be of the type that persists for the life of
+ the X server. This means that data that hooks into the ScrnInfoRec's
+ privates field should be allocated here, but data that hooks into the
+ ScreenRec's devPrivates field should not be allocated here. The
+ driverPrivate field should also be allocated here.
+
+ 3. Although the ScrnInfoRec has been allocated before this function is
+ called, the ScreenRec has not been allocated. That means that things
+ requiring it cannot be used in this function.
+
+ 4. Very little of the ScrnInfoRec has been initialised when this function
+ is called. It is important to get the order of doing things right in
+ this function.
+
+ static Bool
+ ZZZPreInit(ScrnInfoPtr pScrn, int flags)
+ {
+ /* Fill in the monitor field */
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ /*
+ * If using the vgahw module, it will typically be loaded
+ * here by calling xf86LoadSubModule(pScrn, "vgahw");
+ */
+
+ /*
+ * Set the depth/bpp. Our preferred default depth/bpp is 8, and
+ * we support both 24bpp and 32bpp framebuffer layouts.
+ * This sets pScrn->display also.
+ */
+ if (!xf86SetDepthBpp(pScrn, 8, 8, 8,
+ Support24bppFb | Support32bppFb)) {
+ return FALSE;
+ } else {
+ if (depth/bpp isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+ /* Print out the depth/bpp that was set */
+ xf86PrintDepthBpp(pScrn);
+
+ /* Set bits per RGB for 8bpp */
+ if (pScrn->depth <= 8) {
+ /* Take into account a dac_6_bit option here */
+ pScrn->rgbBits = 6 or 8;
+ }
+
+ /*
+ * xf86SetWeight() and xf86SetDefaultVisual() must be called
+ * after pScrn->display is initialised.
+ */
+
+ /* Set weight/mask/offset for depth > 8 */
+ if (pScrn->depth > 8) {
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultMask)) {
+ return FALSE;
+ } else {
+ if (weight isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+ }
+
+ /* Set the default visual. */
+ if (!xf86SetDefaultVisual(pScrn, -1)) {
+ return FALSE;
+ } else {
+ if (visual isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+
+ /* If the driver supports gamma correction, set the gamma. */
+ if (!xf86SetGamma(pScrn, default_gamma)) {
+ return FALSE;
+ }
+
+ /* This driver uses a programmable clock */
+ pScrn->progClock = TRUE;
+
+ /* Allocate the ZZZRec driverPrivate */
+ if (!ZZZGetRec(pScrn)) {
+ return FALSE;
+ }
+
+ pZzz = ZZZPTR(pScrn);
+
+ /* Collect all of the option flags (fill in pScrn->options) */
+ xf86CollectOptions(pScrn, NULL);
+
+ /*
+ * Process the options based on the information in ZZZOptions.
+ * The results are written to ZZZOptions.
+ */
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ZZZOptions);
+
+ /*
+ * Set various fields of ScrnInfoRec and/or ZZZRec based on
+ * the options found.
+ */
+ from = X_DEFAULT;
+ pZzz->hwCursor = FALSE;
+ if (xf86IsOptionSet(ZZZOptions, OPTION_HW_CURSOR)) {
+ from = X_CONFIG;
+ pZzz->hwCursor = TRUE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
+ pZzz->hwCursor ? "HW" : "SW");
+ if (xf86IsOptionSet(ZZZOptions, OPTION_NOACCEL)) {
+ pZzz->noAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Acceleration disabled\n");
+ } else {
+ pZzz->noAccel = FALSE;
+ }
+ if (xf86IsOptionSet(ZZZOptions, OPTION_PCI_RETRY)) {
+ pZzz->UsePCIRetry = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n");
+ }
+ pZzz->fooHack = 0;
+ if (xf86GetOptValInteger(ZZZOptions, OPTION_FOO_HACK,
+ &pZzz->fooHack)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Foo Hack set to %d\n",
+ pZzz->fooHack);
+ }
+
+ /*
+ * Find the PCI slot(s) that this screen claimed in the probe.
+ * In this case, exactly one is expected, so complain otherwise.
+ * Note in this case we're not interested in the card types so
+ * that parameter is set to NULL.
+ */
+ if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL))
+ != 1) {
+ print error message;
+ ZZZFreeRec(pScrn);
+ if (i > 0)
+ xfree(pciList);
+ return FALSE;
+ }
+ /* Note that pciList should be freed below when no longer needed */
+
+ /*
+ * Determine the chipset, allowing config file chipset and
+ * chipid values to override the probed information. The config
+ * chipset value has precedence over its chipid value if both
+ * are present.
+ *
+ * It isn't necessary to fill in pScrn->chipset if the driver
+ * keeps track of the chipset in its ZZZRec.
+ */
+
+ ...
+
+ /*
+ * Determine video memory, fb base address, I/O addresses, etc,
+ * allowing the config file to override probed values.
+ *
+ * Set the appropriate pScrn fields (videoRam is probably the
+ * most important one that other code might require), and
+ * print out the settings.
+ */
+
+ ...
+
+ /* Initialise a clockRanges list. */
+
+ ...
+
+ /* Set any other chipset specific things in the ZZZRec */
+
+ ...
+
+ /* Select valid modes from those available */
+
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ pScrn->display->modes, clockRanges,
+ NULL, minPitch, maxPitch, rounding,
+ minHeight, maxHeight,
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ pScrn->videoRam * 1024,
+ LOOKUP_BEST_REFRESH);
+ if (i == -1) {
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /* Prune the modes marked as invalid */
+
+ xf86PruneDriverModes(pScrn);
+
+ /* If no valid modes, return */
+
+ if (i == 0 || pScrn->modes == NULL) {
+ print error message;
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /*
+ * Initialise the CRTC fields for the modes. This driver expects
+ * vertical values to be halved for interlaced modes.
+ */
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+
+ /* Set the current mode to the first in the list. */
+ pScrn->currentMode = pScrn->modes;
+
+ /* Print the list of modes being used. */
+ xf86PrintModes(pScrn);
+
+ /* Set the DPI */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Load bpp-specific modules */
+ switch (pScrn->bitsPerPixel) {
+ case 1:
+ mod = "xf1bpp";
+ break;
+ case 4:
+ mod = "xf4bpp";
+ break;
+ case 8:
+ mod = "cfb";
+ break;
+ case 16:
+ mod = "cfb16";
+ break;
+ case 24:
+ mod = "cfb24";
+ break;
+ case 32:
+ mod = "cfb32";
+ break;
+ }
+ if (mod && !xf86LoadSubModule(pScrn, mod))
+ ZZZFreeRec(pScrn);
+ return FALSE;
+
+ /* Load XAA if needed */
+ if (!pZzz->noAccel || pZzz->hwCursor)
+ if (!xf86LoadSubModule(pScrn, "xaa")) {
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /* Done */
+ return TRUE;
+ }
+
+20.3.6 MapMem, UnmapMem
+
+Define functions to map and unmap the video memory and any other memory aper-
+tures required. These functions are not mandatory, but it is often useful to
+have such functions.
+
+ static Bool
+ ZZZMapMem(ScrnInfoPtr pScrn)
+ {
+ /* Call xf86MapPciMem() to map each PCI memory area */
+ ...
+ return TRUE or FALSE;
+ }
+
+ static Bool
+ ZZZUnmapMem(ScrnInfoPtr pScrn)
+ {
+ /* Call xf86UnMapVidMem() to unmap each memory area */
+ ...
+ return TRUE or FALSE;
+ }
+
+20.3.7 Save, Restore
+
+Define functions to save and restore the original video state. These func-
+tions are not mandatory, but are often useful.
+
+ static void
+ ZZZSave(ScrnInfoPtr pScrn)
+ {
+ /*
+ * Save state into per-screen data structures.
+ * If using the vgahw module, vgaHWSave will typically be
+ * called here.
+ */
+ ...
+ }
+
+ static void
+ ZZZRestore(ScrnInfoPtr pScrn)
+ {
+ /*
+ * Restore state from per-screen data structures.
+ * If using the vgahw module, vgaHWRestore will typically be
+ * called here.
+ */
+ ...
+ }
+
+20.3.8 ModeInit
+
+Define a function to initialise a new video mode. This function isn't manda-
+tory, but is often useful.
+
+ static Bool
+ ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ {
+ /*
+ * Program a video mode. If using the vgahw module,
+ * vgaHWInit and vgaRestore will typically be called here.
+ * Once up to the point where there can't be a failure
+ * set pScrn->vtSema to TRUE.
+ */
+ ...
+ }
+
+20.3.9 ScreenInit
+
+Define the ScreenInit() function. This is called at the start of each server
+generation, and should fill in as much of the ScreenRec as possible as well
+as any other data that is initialised once per generation. It should ini-
+tialise the framebuffer layers it is using, and initialise the initial video
+mode.
+
+This function is mandatory.
+
+NOTE: The ScreenRec (pScreen) is passed to this driver, but it and the Scrn-
+InfoRecs are not yet hooked into each other. This means that in this func-
+tion, and functions it calls, one cannot be found from the other.
+
+ static Bool
+ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ {
+ /* Get the ScrnInfoRec */
+ pScrn = xf86Screens[pScreen->myNum];
+
+ /*
+ * If using the vgahw module, its data structures and related
+ * things are typically initialised/mapped here.
+ */
+
+ /* Save the current video state */
+ ZZZSave(pScrn);
+
+ /* Initialise the first mode */
+ ZZZModeInit(pScrn, pScrn->currentMode);
+
+ /* Set the viewport if supported */
+
+ ZZZAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ /*
+ * Setup the screen's visuals, and initialise the framebuffer
+ * code.
+ */
+
+ /* Reset the visual list */
+ miClearVisualTypes();
+
+ /*
+ * Setup the visuals supported. This driver only supports
+ * TrueColor for bpp > 8, so the default set of visuals isn't
+ * acceptable. To deal with this, call miSetVisualTypes with
+ * the appropriate visual mask.
+ */
+
+ if (pScrn->bitsPerPixel > 8) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ } else {
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ }
+
+ /*
+ * Initialise the framebuffer.
+ */
+
+ switch (pScrn->bitsPerPixel) {
+ case 1:
+ ret = xf1bppScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 4:
+ ret = xf4bppScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 8:
+ ret = cfbScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 16:
+ ret = cfb16ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 24:
+ ret = cfb24ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 32:
+ ret = cfb32ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ default:
+ print a message about an internal error;
+ ret = FALSE;
+ break;
+ }
+
+ if (!ret)
+ return FALSE;
+
+ /* Override the default mask/offset settings */
+ if (pScrn->bitsPerPixel > 8) {
+ for (i = 0, visual = pScreen->visuals;
+ i < pScreen->numVisuals; i++, visual++) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ /*
+ * If banking is needed, initialise an miBankInfoRec (defined in
+ * "mibank.h"), and call miInitializeBanking().
+ */
+ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
+ pScrn->displayWidth, pBankInfo))
+ return FALSE;
+
+ /*
+ * If backing store is to be supported (as is usually the case),
+ * initialise it.
+ */
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Set initial black & white colourmap indices.
+ */
+ xf86SetBlackWhitePixels(pScreen);
+
+ /*
+ * Install colourmap functions. If using the vgahw module,
+ * vgaHandleColormaps would usually be called here.
+ */
+
+ ...
+
+ /*
+ * Initialise cursor functions. This example is for the mi
+ * software cursor.
+ */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Initialise the default colourmap */
+ switch (pScrn->depth) {
+ case 1:
+ if (!xf1bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ case 4:
+ if (!xf4bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ default:
+ if (!cfbCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ }
+
+ /*
+ * Wrap the CloseScreen vector and set SaveScreen.
+ */
+ ZZZPTR(pScrn)->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = ZZZCloseScreen;
+ pScreen->SaveScreen = ZZZSaveScreen;
+
+ /* Report any unused options (only for the first generation) */
+ if (serverGeneration == 1) {
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+ }
+
+ /* Done */
+ return TRUE;
+ }
+
+20.3.10 SwitchMode
+
+Define the SwitchMode() function if mode switching is supported by the
+driver.
+
+ static Bool
+ ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+ {
+ return ZZZModeInit(xf86Screens[scrnIndex], mode);
+ }
+
+20.3.11 AdjustFrame
+
+Define the AdjustFrame() function if the driver supports this.
+
+ static void
+ ZZZAdjustFrame(int scrnIndex, int x, int y, int flags)
+ {
+ /* Adjust the viewport */
+ }
+
+20.3.12 EnterVT, LeaveVT
+
+Define the EnterVT() and LeaveVT() functions.
+
+These functions are mandatory.
+
+ static Bool
+ ZZZEnterVT(int scrnIndex, int flags)
+ {
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ return ZZZModeInit(pScrn, pScrn->currentMode);
+ }
+
+ static void
+ ZZZLeaveVT(int scrnIndex, int flags)
+ {
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ZZZRestore(pScrn);
+ }
+
+20.3.13 CloseScreen
+
+Define the CloseScreen() function:
+
+This function is mandatory. Note that it unwraps the previously wrapped
+pScreen->CloseScreen, and finishes by calling it.
+
+ static Bool
+ ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ {
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ZZZRestore(pScrn);
+ ZZZUnmapMem(pScrn);
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen;
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+ }
+
+20.3.14 SaveScreen
+
+Define the SaveScreen() function (the screen blanking function). When using
+the vgahw module, this will typically be:
+
+This function is mandatory.
+
+ static Bool
+ ZZZSaveScreen(ScreenPtr pScreen, Bool unblank)
+ {
+ return vgaHWSaveScreen(pScreen, unblank);
+ }
+
+20.3.15 FreeScreen
+
+Define the FreeScreen() function. This function is optional. It should be
+defined if the ScrnInfoRec driverPrivate field is used so that it can be
+freed when a screen is deleted by the common layer for reasons possibly
+beyond the driver's control. This function is not used in during normal
+(error free) operation. The per-generation data is freed by the Clos-
+eScreen() function.
+
+ static void
+ ZZZFreeScreen(int scrnIndex, int flags)
+ {
+ /*
+ * If the vgahw module is used vgaHWFreeHWRec() would be called
+ * here.
+ */
+ ZZZFreeRec(xf86Screens[scrnIndex]);
+ }
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.9 1999/07/18 03:26:51 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.5 1999/07/18 08:34:28 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Devices b/xc/programs/Xserver/hw/xfree86/doc/Devices
new file mode 100644
index 000000000..58c3991e1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Devices
@@ -0,0 +1,756 @@
+#From: David Dawes <dawes@physics.su.OZ.AU>
+#Date: Fri, 16 Sep 1994 12:40:08 +1000 (EST)
+#Status -- taken from sample config.
+Section "Device"
+ Identifier "Actix GE32+ 2MB"
+ VendorName "Actix"
+ BoardName "GE32+"
+ Ramdac "ATT20C490"
+ Dacspeed 110
+ Option "dac_8_bit"
+ Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
+ Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
+EndSection
+
+#From: Hans Nasten <nasten@everyware.se>
+#Date: Tue, 27 Sep 1994 10:18:05 +0100 (MET)
+Section "Device"
+ Identifier "ATI GU"
+ VendorName "ATI"
+ BoardName "ATI Graphics Ultra"
+ Clocks 43 49 80 36 50 56 0 45 30 32 110 79 40 45 75 65
+ Clocks 22 25 46 18 25 28 0 22 15 16 55 40 20 22 38 32
+EndSection
+
+#From: Mark_Weaver@brown.edu (Mark_Weaver@brown.edu)
+#Date: Mon, 19 Sep 1994 14:59:09 -0400
+Section "Device"
+ Identifier "ATI-GUP"
+ VendorName "ATI"
+ BoardName "Graphics Ultra Pro"
+ Clocks 100 126 92 36 51 57 0 44 135 32 110 80 39
+ 45 75 65 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+ Option "dac_8_bit"
+EndSection
+
+#From: Hans Nasten <nasten@everyware.se>
+#Date: Tue, 27 Sep 1994 10:18:05 +0100 (MET)
+Section "Device"
+ Identifier "ATI SVGA"
+ Chipset "vgawonder"
+ VendorName "ATI"
+ BoardName "ATI Graphics Ultra"
+ Clocks 30 32 11 80 42 48 92 36 40 45 75 65 50 56 0 0
+ Clocks 15 16 55 0 21 24 46 18 20 22 37 32 25 28 0 0
+EndSection
+
+#From: hal@caty.ol.sub.de (Holger Lubitz)
+#Date: Wed, 07 Jun 1995 12:58:00 GMT
+Section "Device"
+ Identifier "Colormaster 12+ (ET 4000)"
+ VendorName "Colormaster"
+ BoardName "12+"
+ VideoRam 1024
+ Clocks 25.22 28.32 32.59 36.23 39.98 44.86 31.50 37.50
+ Clocks 50.39 56.66 65.16 72.42 79.98 89.74 63.03 75.02
+EndSection
+
+#Date: Mon, 19 Sep 94 17:50:04 +0200
+#From: Didier Poirot <dp@chorus.fr>
+Section "Device"
+ Identifier "Dell S3C805"
+ VendorName "Dell"
+ BoardName "Dell"
+EndSection
+
+#From: hedrick@klinzhai.rutgers.edu (Charles Hedrick)
+#Date: Sat, 26 Nov 1994 20:21:32 -0500
+Section "Device"
+ Identifier "Speedstar"
+ VendorName "Diamond"
+ BoardName "SpeedStar 64"
+# for 1MB version. probably fast_dram would be appropriate for 2MB.
+ Option "slow_dram"
+# getting a stable high refresh rate with the 1 MB version took some
+# doing. (Generally 2 MB would be recommended for high refresh.) Critical
+# factors were using slow_dram (specifying this isn't really necessary, as the
+# BIOS defaults to this -- I mention it simply because I had
+# experimented with fast_dram), and using a slightly higher second
+# horizontal time, e.g.
+# "1024x768" 80 1024 1100 1100 1260 768 768 768 788
+# though 1100 is higher than needed.
+EndSection
+
+#From: peterc@a3.ph.man.ac.uk (Peter Chang)
+#Date: Fri, 23 Sep 1994 17:40:40 +0100
+#Note: 'freq' may not exist.
+#Section "Device"
+# Identifier "Diamond Stealth 32 VLB"
+# VendorName "Diamond"
+# BoardName "Diamond Stealth 32 VLB"
+## Chipset "w32p_rev_a"
+## VideoRam 1024
+# Clocks 25.18 28.32 49.999 74.959
+## the freq program hacked to use as a clock program
+# ClockProg "/usr/local/bin/freq" 28
+#EndSection
+
+#Date: Thu, 22 Sep 1994 01:38:45 -0400
+#From: Chris Mason <mason@mail.csh.rit.edu>
+Section "Device"
+ Identifier "Diamond Viper VLB 2MB"
+ VendorName "Diamond"
+ BoardName "viper"
+ Chipset "vipervlb"
+ Clocks 135 120 110 103 100 85 49 # Choose clocks to suit your modes
+ Videoram 2048
+EndSection
+
+#Date: Sat, 17 Sep 1994 00:50:57 -0400
+#From: Erik Nygren <nygren@mit.edu>
+Section "Device"
+ Identifier "Diamond Viper VLB 2MB"
+ VendorName "Diamond"
+ BoardName "Viper VLB 2MB"
+ Clocks 81 50 31 # These need only match the mode clocks
+ Videoram 2048 # Required
+ Membase 0x80000000 # Optional [defaults to 0x80000000]
+EndSection
+
+#From: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Sat, 17 Sep 1994 15:46:10 +0200 (MET DST)
+Section "Device"
+ Identifier "ELSA WINNER 1000PRO-VL"
+ VendorName "ELSA"
+ BoardName "WINNER 1000PRO-VL"
+ Option "dac_8_bit"
+ #
+ # the following settings should be detected and set automaticly by XF86_S3
+ # if the serial number of the ELSA card is printed correctly:
+ #
+ # ClockChip "icd2061a"
+ # Option "elsa_w1000pro"
+ # Membase 0xf3000000
+EndSection
+
+#From: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Sat, 17 Sep 1994 15:46:10 +0200 (MET DST)
+Section "Device"
+ Identifier "ELSA WINNER 1000VL"
+ VendorName "ELSA"
+ BoardName "WINNER 1000VL"
+ Option "dac_8_bit"
+ #
+ # the following settings should be detected and set automaticly by XF86_S3
+ # if the serial number of the ELSA card is printed correctly:
+ #
+ # ClockChip "icd2061a"
+ # Membase 0xf8000000
+EndSection
+
+#From: J Wunsch <joerg_wunsch@uriah.sax.de>
+#Date: Fri, 23 Sep 1994 09:28:58 +0200 (MET DST)
+Section "Device"
+ Identifier "ELSA Winner 1000"
+ VendorName "ELSA"
+ BoardName "Winner 1000"
+# ClockChip "icd2061a"
+# Ramdac "sc15025"
+ Option "dac_8_bit"
+EndSection
+
+#From: Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>
+#Date: Wed, 21 Sep 1994 23:48:57 +0200 (MET DST)
+Section "Device"
+ Identifier "ELSA Winner 1000pro"
+ VendorName "ELSA GmbH"
+ BoardName "Winner 1000pro"
+ Option "dac_8_bit"
+ Option "power_saver"
+EndSection
+
+#From: Andreas Braukmann <andy@orca.north.de>
+#Date: Sat, 10 Jun 1995 16:08:58 +0200 (MET DST)
+Section "Device"
+ Identifier "Elsa Winner 1000 Trio 2MB"
+ VendorName "Elsa"
+ BoardName "Winner 1000Trio"
+ #VideoRam 2048
+EndSection
+
+#Date: Fri, 16 Sep 1994 12:58:21 +0200 (MET DST)
+#From: kiwi@belly.in-berlin.de (Axel Habermann)
+Section "Device"
+ Identifier "ELSA Winner 2000 Pro 4MB/PCI"
+ VendorName "ELSA"
+ BoardName "Winner 2000 Pro 4MB/PCI"
+ Option "elsa_w2000pro"
+EndSection
+
+#From: hohndel@aib.com (Dirk H. Hohndel)
+#Date: Tue, 13 Jun 95 19:23 EDT
+Section "Device"
+ Identifier "Elsa Winner2000PRO/X"
+ VendorName "Elsa"
+ BoardName "Winner2000PRO/X"
+ DacSpeed 220
+ VideoRam 4096
+EndSection
+
+#Date: Sun, 18 Sep 1994 16:00:53 +1000
+#From: Stephen Hocking <sysseh@devetir.qld.gov.au>
+Section "Device"
+ Identifier "Generic S3-801"
+ # was: "VGAWINACCEL"
+ VendorName "GENERIC"
+ BoardName "S3-801"
+ RamDac "ATT20C490"
+EndSection
+
+#Date: Mon, 19 Sep 1994 13:37:39 +0100
+#From: Charles Hawkins <ceh@eng.cam.ac.uk>
+Section "Device"
+ Identifier "Generic S3C924 SC1148 DAC"
+ VendorName "Generic"
+ BoardName "S3C924 SC1148 DAC"
+ Clocks 25.2 28.3 39.7 1.7 49.9 76.7 35.7 44
+ Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3
+EndSection
+
+#From: David Dawes <dawes@physics.su.OZ.AU>
+#Date: Fri, 16 Sep 1994 12:40:08 +1000 (EST)
+Section "Device"
+ Identifier "Generic VGA"
+ VendorName "Unknown"
+ BoardName "Unknown"
+ Chipset "generic"
+EndSection
+
+#From: Artur Gomes <agomes@mozart.si.ualg.pt>
+#Date: Tue, 20 Dec 1994 16:55:09 +0000 (GMT)
+Section "Device"
+ Identifier "Genoa Phantom 64"
+ VendordName "Genoa"
+ BoardName "Phantom 64 2MB PCI (864)"
+ ClockChip "s3_sdac"
+ Ramdac "s3_sdac"
+EndSection
+
+#From: dlj0@chern.math.lehigh.edu (DAVID L. JOHNSON)
+#Date: Fri, 23 Sep 1994 23:23:18 -0400
+Section "Device"
+ Identifier "Hercules Dynamite Pro ISA (D201E)"
+ #was: "et4000w32 series"
+ VendorName "Tseng"
+ BoardName "Hercules Dynamite Pro ISA (D201E)"
+ Chipset "et4000w32"
+ Clocks 25 28.32 32.4 35.9 39.9 44.7 31.4 37.5
+ 50.0 56.5 64.9 71.9 79.9 89.6 62.8 74.8
+EndSection
+
+#Date: Wed, 21 Sep 1994 22:22:42 +0100
+#From: Andrew Dyer <adyer@zarniwoop.chi.il.us>
+Section "Device"
+ Identifier "Hercules Graphite HG-210"
+ VendorName "Hercules"
+ BoardName "Graphite HG-210"
+ Chipset "AGX-014"
+ VideoRam 1024
+ Ramdac "BT482"
+ Dacspeed 85
+ Option "dac_8_bit"
+ Option "no_wait_state"
+ Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0
+ Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
+EndSection
+
+#From: karlcz@uclink.berkeley.edu (Karl Frederick Czajkowski)
+#Date: Thu, 15 Sep 1994 23:14:30 -0700
+Section "Device"
+ Identifier "Hercules HG210"
+ VendorName "Hercules"
+ BoardName "HG210"
+ Chipset "AGX-014"
+ Clocks 25.18 28.70 32.70 35.90 40.00 44.90 50.30 64.70
+ 70.10 76.00 80.50 86.30 90.40 95.90 100.70 109.30
+ Option "no_wait_state"
+ Option "fast_dram"
+ Videoram 1024
+EndSection
+
+#From: dwex@xfree86.org (David E. Wexelblat)
+#Date: Sat, 30 Sep 1995 17:21:45 EDT
+Section "Device"
+ Identifier "Hercules Graphite Terminator DRAM"
+ VendorName "Hercules"
+ BoardName "Graphite Terminator DRAM"
+ #
+ # Uses S3 Trio64 - don't need anything else
+ #
+EndSection
+
+#From: haw30@eng.amdahl.com (Henry A Worth )
+#Date: Tue, 27 Sep 94 22:10:01 PDT
+Section "Device"
+ Identifier "Hercules Graphite VL Pro HG720"
+ VendorName "Hercules"
+ BoardName "Graphite VL Pro"
+ Chipset "AGX-015"
+ Clocks 25.2 28.3 32.5 36.0 40.0 45.0 50.4 65.0
+ 70.0 75.0 80.0 85.0 0.00 0.00 0.00 0.00
+ 0.00 0.00 0.00 0.00 0.00 90.0 100 130
+ 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
+ Videoram 2048
+ RamDac "herc_dual_dac"
+ Option "dac_8_bit"
+ Option "no_wait_state"
+EndSection
+
+#From: Richard_Burdick@fionn.cuug.ab.ca (Richard Burdick)
+#Date: Tue, 31 Jan 95 22:10:01 MST
+Section "Device"
+ Identifier "S3 with Chrontel 8391 Ramdac/clockchip"
+ VendorName "Jaton"
+ BoardName "8241 or VL41"
+ RamDac "ATT20C490"
+ ClockChip "ch8391"
+ #Videoram 1024
+ Option "dac_8_bit"
+EndSection
+
+#From: Gertjan Akkerman <akkerman@dutiba.twi.tudelft.nl>
+#Date: Sat, 24 Sep 1994
+Section "Device"
+ Identifier "Let the server probe"
+ VendorName "To be determined"
+ BoardName "To be determined"
+# no chipset, clocks, ...
+EndSection
+
+#From: Hannes Reinecke <hare@zarquon.mathi.uni-heidelberg.de>
+#Date: Wed, 7 Jun 1995 18:56:36 +0100 (MET DST)
+Section "Device"
+ Identifier "MiroCrystal 8S"
+ VendorName "Miro"
+ BoardName "8S"
+ Ramdac "att20c490"
+ Option "dac_8_bit"
+ Videoram 1024
+ Clocks 25.20 28.32 40.00 0.00 50.10 77.00 36.00 44.80
+ Clocks 130.00 121.00 80.00 31.50 110.00 65.00 75.00 94.50
+EndSection
+
+#From: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Sun, 25 Sep 1994 18:55:42 +0100 (MET)
+Section "Device"
+ Identifier "Miro 10SD GENDAC"
+ VendorName "MIRO"
+ BoardName "10SD GENDAC"
+# Clocks 25.255 28.311 31.500 0 40.025 64.982 74.844
+# Clocks 25.255 28.311 31.500 36.093 40.025 64.982 74.844
+ ClockChip "s3gendac"
+ RamDac "s3gendac"
+EndSection
+
+#From: jos@chopin.muc.de (Jochen Schwenk)
+#Date: Sat, 24 Dec 1994 02:59:00 +0100
+Section "Device"
+ Identifier "Miro 20SD"
+ VendorName "miro"
+ BoardName "20SD"
+ Dacspeed 135
+ ClockChip "s3gendac"
+ Option "dac_8_bit"
+EndSection
+
+#Date: Mon, 19 Sep 1994 20:37:05 +0200
+#From: eddy@dutecae.et.tudelft.nl (J.G.E. Olk)
+Section "Device"
+ Identifier "Miro CRYSTAL 20SV"
+ VendorName "Miro"
+ BoardName "CRYSTAL 20SV"
+ Clockchip "icd2061a"
+# Option "miro_crystal20sv"
+ Option "dac_8_bit"
+EndSection
+
+#From: Ted.Goldblatt@telematics.com (Ted Goldblatt)
+#Date: Fri, 23 Sep 1994 11:52:28 +0500
+Section "Device"
+ Identifier "Number Nine GXE L16 VLB"
+ VendorName "Number-nine"
+ BoardName "GXE L16"
+ Dacspeed 200
+ ClockChip "icd2061a"
+ Option "dac_8_bit"
+ Option "nolinear"
+ Option "nomemaccess"
+ Option "number_nine"
+EndSection
+
+#From: rich@id.slip.bcm.tmc.edu (Rich Murphey)
+#Date: Thu, 15 Sep 1994 23:30:52 -0501
+Section "Device"
+ Identifier "Number Nine GXE Level 12 3Mb"
+ VendorName "#9"
+ BoardName "Number Nine GXE Level 12 3Mb"
+ Option "dac_8_bit"
+ Option "number_nine"
+ Clockchip "icd2061a"
+EndSection
+
+#From: Christos Zoulas <christos@deshaw.com>
+#Date: Fri, 16 Sep 1994 14:07:41 -0400
+Section "Device"
+ Identifier "Number Nine GXE Level 14 2Mb"
+ VendorName "#9"
+ BoardName "Number Nine GXE Level 14 2Mb"
+ Option "dac_8_bit"
+ Clockchip "icd2061a"
+ Option "number_nine"
+EndSection
+
+#Date: Wed, 21 Sep 94 16:11:47 PDT
+#From: eh@c-cube.com (Ernest Hua)
+Section "Device"
+ Identifier "Number Nine GXE64 Pro 2M"
+ VendorName "Number 9"
+ BoardName "GXE64 Pro"
+# Chipset "Vision964"
+ VideoRam 2048
+ ClockChip "Icd2061a"
+EndSection
+
+#Date: Wed, 21 Sep 1994 22:47:06 -0700
+#From: "Brett J. Vickers" <bvickers@rumba.ICS.UCI.EDU>
+Section "Device"
+ Identifier "Number Nine GXE64 Pro 2MB"
+ VendorName "Number 9"
+ BoardName "GXE 64Pro"
+ Ramdac "TI3025"
+EndSection
+
+#Date: Fri, 16 Sep 1994 11:42:19 +0100
+#From: Doug Rabson <dfr@render.com>
+Section "Device"
+ Identifier "Number Nine GXE64 Pro"
+ VendorName "Number Nine"
+ BoardName "GXE64 Pro"
+EndSection
+
+#From: Bob Mende Pie <mende@piecomputer.rutgers.edu>
+#Date: Fri, 23 Sep 1994 22:51:51 -0400
+Section "Device"
+ Identifier "Number Nine GXE64 Pro VLB"
+ #Was: "GXEPRO"
+ VendorName "#9"
+ BoardName "#9 GXE64 Pro VLB"
+ RamDac "ti3025"
+ Option "dac_8_bit"
+ Option "number_nine"
+# s3mnadjust 3 248
+ ClockChip "ti3025"
+EndSection
+
+#Date: Tue, 20 Sep 94 08:32:45 EDT
+#From: bremner@muff.cs.mcgill.ca (David BREMNER)
+Section "Device"
+ Identifier "Number Nine GXE64 (1)"
+ VendorName "Number Nine"
+ BoardName "GXE64-2M"
+ Clockchip "icd2061a"
+ Option "number_nine"
+EndSection
+
+#From: Farrell.McKay@nms.otc.com.au (Farrell McKay)
+#Date: Mon, 26 Sep 1994 10:05:03 +1000 (EST)
+Section "Device"
+ Identifier "Number Nine GXE64 (2)"
+ VendorName "Number Nine"
+ BoardName "#9GXE-64"
+ Chipset "mmio_928"
+ Clockchip "icd2061a"
+ Option "number_nine"
+ Videoram 2048
+EndSection
+
+#From: ciotti@nas.nasa.gov (Robert B. Ciotti)
+#Date: Fri, 30 Sep 1994 10:34:37 -0700
+Section "Device"
+ Identifier "Number9GXE64PCI"
+ VendorName "NumberNine"
+ BoardName "GXE64PCI"
+ Clockchip "icd2061a"
+ Option "number_nine"
+ Option "dac_8_bit"
+EndSection
+
+#From: Richard Coley <rcoley@pyra.co.uk>
+#Date: Thu, 15 Sep 1994 12:29:10 +0100 (BST)
+Section "Device"
+ Identifier "Orchid Fahrenheit 1280"
+ VendorName "Orchid"
+ BoardName "Fahrenheit 1280"
+ Clocks 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
+ Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50
+EndSection
+
+#From: forsse@meaddata.com (Steve Forsythe)
+#Date: Sun, 18 Sep 94 3:27:15 EDT
+Section "Device"
+ Identifier "Orchid Fahrenheit VLB 1280"
+ VendorName "Orchid"
+ BoardName "Fahrenheit VLB"
+ Ramdac "att20c490"
+ Clocks 25.20 28.32 40.00 0.00 50.10 77.00 36.20 44.90
+ 130.10 120.00 80.00 31.50 110.20 65.00 75.00 94.60
+EndSection
+
+#Date: Tue, 20 Sep 94 08:09:20 EDT
+#From: Yasuhiro Yamazaki <hiro@rainbow.physics.utoronto.ca>
+#Status: May need editing.
+Section "Device"
+ Identifier "Orchid Fahrenheit VLB"
+ VendorName "Orchid"
+ BoardName "Fahrenheit-VLB"
+# VideoRam 2048
+ Ramdac "sc15025"
+ Option "dac_8_bit"
+# Option "nolinear"
+# Option "nomemaccess"
+# Membase 0x7c000000
+ Clocks 25.20 28.32 40.00 0.00 50.10 77.00 36.10 45.00
+ Clocks 130.00 120.20 80.00 31.50 110.30 65.00 75.00 94.60
+EndSection
+
+#From: matthieu@laas.fr (Matthieu Herrb)
+#Date: Tue, 27 Sep 1994 10:05:24 +0100
+Section "Device"
+ Identifier "Orchid Fahrenheit-1280+"
+ VendorName "Orchid"
+ BoardName "Fahrenheit 1280+ VLB"
+ Ramdac "att20C490"
+ Dacspeed 110
+ Clocks 25.20 28.32 40.0 0.0 50.10 77.0 36.10 45.0
+ Clocks 130.0 120.20 80.0 31.50 110.30 65.0 75.0 94.60
+ Option "dac_8_bit"
+EndSection
+
+#From: adrian@dragons.demon.co.uk (Adrian Joseph)
+#Date: Tue, 27 Sep 1994 23:43:35 +0200 (BST)
+Section "Device"
+ Identifier "Orchid P9000 VLB"
+ VendorName "Orchid"
+ BoardName "P9000 VLB"
+ Chipset "orchid_p9000"
+ Clocks 25.175 25.20 28.32 45 50 65 75 80
+ Videoram 2048
+ Membase 0xE0000000
+EndSection
+
+#Date: Sun, 18 Sep 1994 16:00:53 +1000
+#From: Stephen Hocking <sysseh@devetir.qld.gov.au>
+Section "Device"
+ Identifier "PAELIT-S3911"
+ VendorName "PAELIT"
+ BoardName "S3911"
+ Clocks 25 28 40 0 50 77 36 45 130 120 80 31.5 110 65 75 72
+EndSection
+
+#From: Michael Kofler <kofler@ping.at>
+#Date: Sat, 10 Jun 1995 05:31:55 +0100 (GMT+0100)
+Section "Device"
+ Identifier "sigma legend II"
+ VendorName "sigma"
+ BoardName "legend II"
+ Clocks 25 28 0 40 36 40 45 58 32 36 31 35 50 48 33 65
+ Option "legend"
+EndSection
+
+#From: aeglos@valinor.owl.de (Holger Schemel)
+#Date: Wed, 7 Jun 95 23:31 MET DST
+Section "Device"
+ Identifier "Spea V7 VEGA"
+ VendorName "Unknown"
+ BoardName "Unknown"
+ VideoRam 1024
+ Chipset "clgd5426"
+ Option "fast_dram"
+ Option "linear"
+ Membase 0x00e00000
+ Option "favour_bitblt"
+ #Clocks 25.23 28.32 41.16 36.08 31.50 39.99 45.08 49.87
+ #Clocks 64.98 72.16 75.00 80.01 85.23
+EndSection
+
+#Date: Wed, 7 Jun 1995 09:28:12 +0200
+#From: ernst.molitor@uni-bonn.de
+Section "Device"
+ Identifier "SPEA-Mirage"
+ VendorName "SPEA"
+ BoardName "Mirage"
+ Clocks 25.175 28.322 37.50 0.00 50.00 75.0 35.5 44.90
+ Clocks 130.00 120.00 80.0 31.50 110.00 65.00 75.00 94.60
+ Ramdac "att20c490"
+ DacSpeed 80
+ Option "dac_8_bit"
+EndSection
+
+#Date: Wed, 7 Jun 1995 00:45:55 +0200 (MET DST)
+#From: volker@illuminatus.rhein-main.de (Volker Schmidt)
+Section "Device"
+ Identifier "SPEA VEGA/V7"
+ VendorName "SPEA"
+ BoardName "VEGA/V7"
+ VideoRam 1024
+ Option "fast_dram"
+ Option "fifo_aggressive"
+ Option "power_saver"
+ # Insert Clocks lines here
+ # Clocks 25.23 28.32 41.16 36.08 31.50 39.99
+ # Clocks 45.08 49.87 64.98 72.16 75.00 80.01 85.23
+EndSection
+
+#From: ws@bluebocs.donut.ruhr.com (Wolfgang Schaefer)
+#Date: 8 Jun 95 19:21:00 +0100
+Section "Device"
+ Identifier "Spea V7 Mirage P64 Trio"
+ VendorName "SPEA"
+ BoardName "V7 Mirage P64 Trio"
+EndSection
+
+#From: "Karsten Weiss" <karsten@addx.tynet.sub.org>
+#Date: Wed, 07 Jun 95 15:42:01 +0100
+Section "Device"
+ Identifier "SPEA Mirage P64 2MB"
+ VendorName "SPEA Videoseven"
+ BoardName "Mirage P64 2MB"
+ VideoRam 2048
+ Ramdac "ATT21C498"
+ Dacspeed 130
+ ClockChip "ics2595"
+EndSection
+
+#Date: Fri, 16 Sep 1994 23:16:32 -0700
+#From: "Leonard N. Zubkoff" <lnz@dandelion.com>
+Section "Device"
+ Identifier "STB Pegasus"
+ VendorName "STB"
+ BoardName "Pegasus"
+ Chipset "mmio_928"
+ Ramdac "bt485"
+ ClockChip "icd2061a"
+ Option "stb_pegasus"
+ Option "bt485_curs"
+ Option "dac_8_bit"
+ Option "sync_on_green"
+EndSection
+
+#From: Jeff Stern <jstern@eclectic.ss.uci.edu>
+#Date: Fri, 30 Dec 1994 12:07:46 -0800 (PST)
+Section "Device"
+ Identifier "STB X24 S3 ISA"
+ VendorName "STB"
+ BoardName "PowerGraph X.24"
+ Ramdac "ATT20C490"
+ Dacspeed 110
+ Option "dac_8_bit"
+ #VideoRam 1024
+ ClockChip "icd2061a"
+EndSection
+
+#Date: Sun, 18 Sep 1994 22:55:32 -0700 (PDT)
+#From: Shyam Subramanyan <shyam@crl.com>
+Section "Device"
+ Identifier "Spider Black Widow Plus 2MB"
+ VendorName "SPIDER"
+ BoardName "Spider Black Widow Plus"
+ Chipset "AGX-015"
+ Ramdac "SC15025"
+ Clocks 25.18 28.30 39.90 72.20 50.10 76.90 36.10 44.90
+ Clocks 89.90 120.00 79.90 31.50 110.10 64.90 74.90 94.40
+ Option "dac_8_bit"
+ Option "no_wait_state"
+ Option "fifo_moderate"
+ Videoram 2048
+EndSection
+
+#From: haw30@eng.amdahl.com (Henry A Worth )
+#Date: Tue, 27 Sep 94 22:10:01 PDT
+Section "Device"
+ Identifier "Spider Black Widow Plus"
+ VendorName "Spider"
+ BoardName "Black Widow Plus"
+ Chipset "AGX-016"
+ Clocks 25.2 28.3 39.9 72.2 50.0 76.9 36.1 44.8
+ 89.0 119.8 79.9 31.5 110.0 64.9 74.9 94.9
+ Videoram 2048
+ RamDac "SC15025"
+ Option "dac_8_bit"
+ Option "no_wait_state"
+EndSection
+
+#From: Gertjan Akkerman <akkerman@dutiba.twi.tudelft.nl>
+#Date: Tue, 20 Sep 1994 11:45:21 +0200 (MET DST)
+Section "Device"
+ Identifier "Trident TVGA 9000"
+ VendorName "Trident MicroSystems" # (sp?)
+ BoardName "TVGA 9000"
+ Chipset "tvga9000"
+# Clocks 25.2 28.3 44.9 36.0 57.3 65.0 50.4 40.0
+# Clocks 00.0 00.0 00.0 00.0 72.0 77.0 80.0 75.0
+EndSection
+
+#From: "M{kinen Sami J." <sjm@cs.tut.fi>
+#Date: Mon, 19 Sep 1994 23:47:01 +0300
+Section "Device"
+ Identifier "Tseng Genoa Phantom ET4000/W32i 2MB VLB"
+ VendorName "Tseng"
+ BoardName "Genoa Phantom ET4000/W32i 2MB VLB"
+# Chipset "et4000w32i_rev_b"
+# Videoram 2048
+ Clocks 24.80 28.30 32.40 35.50 40.00 45.00 31.20 37.20
+ 50.00 56.50 65.00 70.00 80.00 90.00 62.50 75.00
+EndSection
+
+#Date: Wed, 21 Sep 1994 14:22:23 -0700 (PDT)
+#From: James Dooley <jdooley@ugcs.caltech.edu>
+#Also-date: Wed, 21 Sep 1994 19:54:08 -0400 (EDT)
+#Also-from: Andrew Robinson <robinson@cnj.digex.net>
+#Also-date: 22 Sep 1994 10:25:06 -0700 (PDT)
+#Also-from: Ken Latta <klatta@pkdla5.syntex.com>
+Section "Device"
+ Identifier "Tseng et4000w32 series"
+ VendorName "Tseng"
+ BoardName "STB W32P"
+ Clocks 25.04 28.32 32.47 36.00 40.00 44.56 31.48 37.49
+ 50.00 56.65 64.93 72.04 80.03 89.70 62.99 75.04
+EndSection
+
+#From: hedrick@klinzhai.rutgers.edu (Charles Hedrick)
+#Date: Sat, 26 Nov 1994 20:21:32 -0500
+Section "Device"
+ Identifier "928Movie"
+ VendorName "VideoLogic"
+ BoardName "928Movie"
+ Ramdac "bt485"
+ DacSpeed 135
+ ClockChip "ics2595"
+EndSection
+
+#From: "william (w.f.) conn" <conn@bnr.ca>
+#Date: Sun, 25 Sep 1994 19:51:00 -0500
+Section "Device"
+ Identifier "wd90c33"
+ VendorName "Western Digital"
+ BoardName "Paradise Accelerator VL Plus"
+EndSection
+
+
+# $XFree86: xc/programs/Xserver/hw/xfree86/doc/Devices,v 3.15 1996/12/23 06:44:39 dawes Exp $
+
+
+
+
+
+# $XConsortium: Devices /main/11 1996/02/21 17:41:35 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/Imakefile
new file mode 100644
index 000000000..3a707f224
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Imakefile
@@ -0,0 +1,97 @@
+XCOMM $XConsortium: Imakefile /main/33 1996/10/28 05:12:24 kaleb $
+
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.59 1999/08/26 08:16:15 dawes Exp $
+
+#include <Server.tmpl>
+#include <lnxdoc.rules>
+
+#define IHaveSubdirs
+
+#if BuildSgmlDocs
+SGMLDIR = sgml
+#endif
+
+#if InstallJapaneseDocs
+JAPANESEDIR = Japanese
+#endif
+
+SUBDIRS = $(SGMLDIR) $(JAPANESEDIR) man
+
+all::
+
+#if XFree86Version % 10
+REPORTFORM = BetaReport
+#endif
+
+#if !BuildLinuxDocText
+OSREADMES = \
+ /*ReadmeFile(Bsdi)*/ \
+ ReadmeFile(DGux) \
+ ReadmeFile(FreeBSD) \
+ ReadmeFile(isc) \
+ ReadmeFile(Linux) \
+ ReadmeFile(LynxOS) \
+ ReadmeFile(NetBSD) \
+ ReadmeFile(OpenBSD) \
+ ReadmeFile(OS2) \
+ OS2.Notes \
+ ReadmeFile(SCO) \
+ ReadmeFile(SOLX86) \
+ ReadmeFile(SVR4) \
+ $(_NULLENTRY_)
+
+HWREADME = \
+ ReadmeFile(3Dlabs) \
+ ReadmeFile(apm) \
+ /*ReadmeFile(agx)*/ \
+ /*ReadmeFile(ark)*/ \
+ ReadmeFile(ati) \
+ ReadmeFile(chips) \
+ ReadmeFile(cirrus) \
+ /*ReadmeFile(cyrix)*/ \
+ ReadmeFile(DECtga) \
+ /*ReadmeFile(epson)*/ \
+ ReadmeFile(fbdev) \
+ /*ReadmeFile(I128)*/ \
+ /*ReadmeFile(i740)*/ \
+ /*ReadmeFile(Mach32)*/ \
+ /*ReadmeFile(Mach64)*/ \
+ ReadmeFile(MGA) \
+ ReadmeFile(NVIDIA) \
+ /*ReadmeFile(Oak)*/ \
+ /*ReadmeFile(P9000)*/ \
+ ReadmeFile(rendition) \
+ /*ReadmeFile(S3)*/ \
+ ReadmeFile(SiS) \
+ ReadmeFile(s3virge) \
+ ReadmeFile(trident) \
+ ReadmeFile(tseng) \
+ /*ReadmeFile(Video7)*/ \
+ /*ReadmeFile(WstDig)*/ \
+ $(_NULLENTRY_)
+
+MAINDOCS = LICENSE README /*ReadmeFile(Config)*/ /*BUILD*/ RELNOTES DESIGN
+
+OTHERDOCS = VideoModes.doc /*QuickStart.doc*/ xinput \
+ ReadmeFile(fonts) ReadmeFile(mouse)
+#endif
+
+MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) ReadmeFile(DGA) \
+ VideoBoard98
+
+DATABASE = /* modeDB.txt */ /* AccelCards Monitors Devices */
+
+FILES = $(MAINDOCS) $(OSREADME) $(HWREADME) $(OTHERDOCS) $(MISCDOCS) $(DATABASE)
+
+InstallMultipleDest(install,$(FILES),$(XFREE86DOCDIR))
+
+#ifdef IHaveSubdirs
+MakeSubdirs($(SUBDIRS))
+DependSubdirs($(SUBDIRS))
+#endif
+
+InstallDriverSDKNonExecFile(DESIGN,$(DRIVERSDKDIR))
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/AccelCards b/xc/programs/Xserver/hw/xfree86/doc/Japanese/AccelCards
new file mode 100644
index 000000000..92a7cc76e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/AccelCards
@@ -0,0 +1,1752 @@
+#-------------------------------------------------------------------------#
+#
+# XFree86 $B$G%5%]!<%H$7$F$$$k%"%/%;%i%l!<%?%+!<%I(J
+#
+# $B%P!<%8%g%s(J 1.5 - 1994 $BG/(J 8 $B7n(J 27$BF|(J
+# XFree86 3.1 $BMQ0lMw(J - David Wexelblat <dwex@xfree86.org>
+#-------------------------------------------------------------------------#
+#
+# $B$3$N%U%!%$%k$O(J XFree86 $B$G8_49@-$,$"$k$+%F%9%H$7$?%"%/%;%i%l!<%?%+!<%I$N0l(J
+# $BMw$rDs6!$9$k$b$N$G$9!#(J $B%5%]!<%H$7$F$$$k%A%C%W$,Ek:\$5$l$F$$$kB>$N%+!<%I$G(J
+# $B$b(J XFree86 $B$,F0:n$9$k$+$I$&$+!";d$?$A$OJ]>Z$9$k$3$H$O=PMh$^$;$s!#(J $B0lMw$K$J(J
+# $B$$%+!<%I$G;n$7$F$_$F$&$^$/F0$$$?$i!"$3$N%U%!%$%k$N:G8e$K$"$k%o!<%/%7!<%H$N(J
+# $B6uGr$rKd$a$F(J <xfree86@physics.su.oz.au> $B08$F$KEE;R%a!<%k$rAw$C$F2<$5$$!#(J
+#
+# $B%5%]!<%H$7$F$$$k%A%C%W%;%C%H$rEk:\$7$F$$$k%+!<%I$G(J XFree86 $B$,F0:n$7$J$$>l(J
+# $B9g$O!">u67$r2~A1$9$k$?$a$K2f!9$KO"Mm$r2<$5$$!#@h$::G=i$K(J DOS $B$d(J Windows $B$G(J
+# $B%O!<%I%&%'%"$,@5$7$/F0:n$9$k$+3NG'$7$F2<$5$$!#(J
+#-------------------------------------------------------------------------#
+# $B$3$N%U%!%$%k$O%A%C%W%;%C%H$G>O$KJ,$1$F$$$^$9!#%A%C%W%;%C%H$O<!$NDL$j(J:
+# S3 911/924
+# S3 801/805
+# S3 928
+# 8514/A
+# ATI Mach8
+# ATI Mach32
+# Weitek P9000
+# SVGA (Cirrus)
+# SVGA (Western Digital)
+#
+# $B0lMw$K$J$$%+!<%I$r;}$C$FMh$FF0:n$5$;$k$N$K==J,$J(J RAMDAC $B$H%/%m%C%/%A%C%W$K(J
+# $B4X$9$kBgNL$N>pJs$rDs6!$7$^$9!#$3$N%U%!%$%k$N=*$o$j!"%o!<%/%7!<%H$ND>A0$K;d(J
+# $B$?$A$,D4::$7$?;HMQ2DG=$J%/%m%C%/%7%s%;%5%$%6!<$N%A%C%W%;%C%H$N0lMw$,$"$j$^(J
+# $B$9!#MxMQ$9$k%+!<%I$,0lMw$K$"$k%A%C%W%;%C%H$rEk:\$7$F$$$k>l9g$K!"(JXconfig $B%U(J
+# $B%!%$%k$N(JClocks $B9T$K0lMw$K$"$k%/%m%C%/$r;H$&$3$H$,=PMh$^$9!#0lMw$K$"$k%/%m(J
+# $B%C%/$r$=$N$^$^%3%T!<$7$F$/$@$5$$!#(J
+#
+# [ $BLuCm(J : $B%G!<%?%Y!<%9$O:G=i$N0l$D$@$1(J $B9`L\L>$@$1BPLuIw$K$7$^$9!#(J ]
+# [ $BDs6!%G!<%?$O$=$N$^$^$K$7$F$*$-$^$9!#(J ]
+#-------------------------------------------------------------------------#
+# S3 911/924 #
+#-------------------------------------------------------------------------#
+Card Vendor : DEC
+Card Model : DEC PC450D2LP
+Card Bus (ISA/EISA/VLB) : Embedded
+Chipset : 86C924
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 46 45 130 12 80 32 110 65 75 95
+Clocks (cont) :
+Option Flags :
+RAMDAC :
+Submitter : Eric Hvozda <ack@clark.net>
+Last Edit Date : Feb 20, 1994
+#-------------------------------------------------------------------------#
+$B%+!<%I@=B$2q<R(J : DEC
+$B@=IJL>(J : DEC PC450D2LP
+$B%P%9$N<oN`(J (ISA/EISA/VLB) : Embedded
+$B%A%C%W%;%C%H(J : 86C924
+$B%S%G%*%a%b%jNL(J : 1024K
+$B%a%b%j$N7?(J (DRAM/VRAM) : VRAM
+$B%a%b%j$NB.EY(J :
+$B%/%m%C%/%A%C%W(J :
+$B%W%m%0%i%^%V%k$N2DH](J(Y/N) :
+$B%/%m%C%/?t(J : 16
+$B%/%m%C%/(J : 25 28 40 0 50 77 46 45 130 12 80 32 110 65 75 95
+$B%/%m%C%/(J ($B7QB39T(J) :
+$B%*%W%7%g%s%U%i%0(J :
+RAMDAC :
+$BDs=P<T(J : Eric Hvozda <ack@clark.net>
+$B:G=*=$@5F|(J : Feb 20, 1994
+#-------------------------------------------------------------------------#
+Card Vendor : Hewlett-Packard
+Card Model : D2325A
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80 nS
+Clock Chip : ICS1394M
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 30.00 0.00 32.50 36.00 38.00 40.00
+Clocks (cont) : 44.90 48.00 50.10 60.10 64.20 65.10 75.20 80.20
+Option Flags : nomemaccess on my setup to prevent lockups
+RAMDAC : MUSIC TR9C1710-80
+Submitter : Greg Holdren <gregh@hprnd.rose.hp.com,geh@netcom.com>
+Last Edit Date : Jan 21, 1994
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 (Circa 1991)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80 ns
+Clock Chip : Chrontel CH9204CB-NC
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.175 28.33 40 0 50 77 36 44.9
+Clocks (cont) : 130 120 80 31.5 110 65 75 96
+Option Flags :
+RAMDAC : SC11483CV (Silkscreen outine for Bt476)
+Submitter : Douglas Lenz <lenz@comm.mot.com>
+Last Edit Date : Sept 29, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 911
+Video Memory : 1 Meg
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip : ???
+Programmable? (Y/N) : No ???
+Number of clocks : 16
+Clocks : 25.2 28.3 40 72 50 77 36 45
+Clocks (cont) : 131 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : Sierra HC
+Submitter : Kent A. Vander Velden
+Last Edit Date : Oct 24, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Paelit
+Card Model : S3 VGA (I kid you not)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 911
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 76.0 94.5
+Option Flags :
+RAMDAC :
+Submitter : Stephen Hocking
+Last Edit Date : Sep 29, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Farenheit 1280
+Card Bus(ISA/EISA/VLB) : ISA
+Chipset : S3 86C924
+Video Memory : 1024k
+Memory Type(DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
+Clocks (cont) : 78.00 56.70 63.00 74.90 80.00 89.90 100.90 31.50
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : Richard Coley
+Last Edit Date : Oct 4 1993
+#-------------------------------------------------------------------------#
+Card Vendor : S3, Incorporated
+Card Model : MVGA-S3C911
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 924
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC : SC11487CN
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : SIXGRAPH
+Card Model : WIZARD 924
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 924
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 39.70 0.00 50.00 77.00 35.70 44.70
+Clocks (cont) : 130.30 119.60 79.50 31.20 109.70 65.30 75.00 71.40
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : Jean-F. Cormier <jfcor@phy.ulaval.ca>
+Last Edit Date : Jan 23, 1994
+#-------------------------------------------------------------------------#
+Card Vendor : WA
+Card Model : WA911
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C911
+Video Memory : 1024K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks :
+Clocks : 25.2 28.32 39.9 0.0 50.10 79.80 36.10 44.9
+Option Flags :
+RAMDAC :
+Submitter : Steffan Henke <henker@informatik.uni-bremen.de>
+Last Edit Date : June 7, 1994
+#-------------------------------------------------------------------------#
+# S3 801/805 #
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 (original proto design).
+Card Bus (ISA/EISA/VLB) : ISA.
+Chipset : S3 86C801
+Video Memory : 1024k (upgradable)
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : crontel (need to check make)
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 72 49 77 36 45
+Clocks (cont) : 90 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Jon Tombs <jon@xfree86.org>
+Last Edit Date : Sept 27, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GE32
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3-801
+Video Memory : 1M
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : (80ns ?)
+Clock Chip : ATT
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25 28 40 72 50 77 36 45 90 120 80 32 110 65 75 95
+Clocks (cont) :
+Option Flags :
+RAMDAC :
+Submitter : brezak@ch.hp.com
+Last Edit Date : 10/25/93
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C801
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : Unknown
+Clock Chip : Avasem AV9194-??
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 40.0 0.0 50.1 77.0 36.2 44.9
+Clocks (cont) : 80.0 120.0 130.2 31.5 110.3 65.0 74.9 72.4
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : Jordan K. Hubbard <jkh@whisker.lotus.ie>
+Last Edit Date : Sept 27, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32 Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C801
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 95.0
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : David E. Wexelblat <dwex@xfree86.org>
+Last Edit Date : Sept 25, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : "made in taiwan" VGA windows accellerator
+Card Model : 2157?
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3-801
+Video Memory : 1024k + 1024k optional, I have 2Mb.
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 50ns.
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No.
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags : None.
+RAMDAC : ATT 491? (24/15/16/8 bit ramdac from ATT) (110Mhz)
+Submitter : R.E. Wolff
+Last Edit Date : Mon Sep 27 09:15:36 MET 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : Graphics Engine 32VL+
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31.5 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C490-11
+Submitter : Marc Wandschneider <marcwan@microsoft.com>
+Last Edit Date : Oct 25, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine32VL+/2mb
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : Avasem AV9194-11
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.30 39.70 0.00 50.00 76.70 35.70 44.60
+Clocks (cont) : 130.30 121.40 79.40 31.20 109.80 65.10 74.90 94.60
+Option Flags :
+RAMDAC : Winbond W82C490P-110
+Submitter : Dick Garner <cedar!dick@beaver.cs.washington.edu>
+Last Edit Date : Oct. 29, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Dell Computer on board video card
+Card Model :
+Card Bus (ISA/EISA/VLB) : Integrated Local Bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 40.00 77.50 77.50 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.00 65.00 75.00 94.50
+Option Flags :
+RAMDAC : AT&T 20C492
+Submitter : Didier Poirot <dp@chorus.fr>
+Last Edit Date : Oct 4, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : 433/M
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS2494AM
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.50 36.00 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.10 65.00 75.00 94.50
+Option Flags :
+RAMDAC : SC11483CV
+Submitter : Joe V. Moss <joe@morton.rain.com>
+Last Edit Date : Oct 14, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : 4066/XE
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS2494AM
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 78.20 36.00 44.90
+Clocks (cont) : 63.00 100.20 79.90 31.50 110.00 65.00 75.00 94.50
+Option Flags :
+RAMDAC : SC11483CV
+Submitter : Joe V. Moss <joe@morton.rain.com>
+Last Edit Date : Oct 14, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Dell
+Card Model : Built-into Dell 4066/XE
+Card Bus (ISA/EISA/VLB) : local bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 512k @ ? / 512k @ 70ns
+Clock Chip : ?
+Programmable? (Y/N) : no?
+Number of clocks : 16
+Clocks : 25.20 28.32 39.90 0.00 50.10 77.60 36.00 36.10
+Clocks (cont) : 62.90 100.30 79.90 31.50 109.90 109.90 75.00 94.50
+Option Flags : Option "nomemaccess"
+RAMDAC : AT&T 20C492
+Submitter : harry@brain.Jpl.Nasa.Gov (Harry Langenbacher)
+Last Edit Date : Oct 29, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : "Made In Taiwan" VGA Windows Accellerator
+Card Model : P/N: 910-0032 CODE 2155
+Card Bus (ISA/EISA/VLB) : VESA Local Bus
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS 2494 AN 9312-305 (ICS2494-305)
+Programmable? (Y/N) : No.
+Number of clocks : 16
+Clocks : 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Frode Roervik <froder@ifi.uio.no>
+Last Edit Date : Jan 26, 1994
+#-------------------------------------------------------------------------#
+Card Vendor : Micronics
+Card Model : MPower 3
+Card Bus (ISA/EISA/VLB) : on-motherboard (VLB)
+Chipset : S3 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AvaSem
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31.5 110 65 75 95
+Option Flags :
+RAMDAC : AT&T 20C491-80
+Comments : RAMDAC limits max clock to 80MHz
+Submitter : David Dawes <dawes@xfree86.org>
+Last Edit Date : Dec 14, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : miro Computer Products AG Germany
+Card Model : CRYSTAL 8S
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 P86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS2494AN
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.2 28.32 39.9 0 50.1 77 36 44.8 129.7 120.2
+Clocks (cont) : 120.2 31.5 109.9 65 75 94.5 31.5 109.9 65 75 94.5
+Option Flags :
+RAMDAC : AT&T 20C491
+Submitter : rohde@physik.uni-kiel.d400.de
+Last Edit Date : Nov 5, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : miro Computer Products AG
+Card Model : miroCRYSTAL 8S
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 P86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45 ns
+Clock Chip : ICS2494AN
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.2 28.32 40.0 0 50.0 77.0 36.0 44.9
+Clocks (cont) : 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Option Flags :
+RAMDAC : AT&T 20C491-11
+Submitter : Christoph Rimek <chrimek@toppoint.de>
+Last Edit Date : Mar 6, 1994
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit VLB ( = VA/VLB - audio )
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C805
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 50ns(1M) + 60ns (1M)
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.10 45.00
+Clocks (cont) : 130.00 120.20 80.00 31.50 110.30 65.00 75.00 94.60
+Option Flags :
+RAMDAC : AT&T 490
+Submitter : Yasu-Hiro Yamazaki<hiro@rainbow.physics.utoronto.ca>
+Last Edit Date : Oct. 7, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 Plus VLB
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3-805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60 ns
+Clock Chip : Chrontel 9303 (?)
+Programmable? (Y/N) : N (?)
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.20 44.90
+Clocks (cont) : 130.10 120.00 80.00 31.50 110.20 65.00 75.00 94.60
+Option Flags :
+RAMDAC : AT&T 20C490-80
+Submitter : Steve Forsythe <forsse@meaddata.com>
+Last Edit Date : Oct. 4, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : Orchid
+Card Model : Fahrenheit 1280 Plus
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60 ns
+Clock Chip : ?
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.20 28.32 40.00 0.00 50.10 77.00 36.20 44.90
+Clocks (cont) : 130.00 120.00 80.00 31.50 110.20 65.00 75.00 94.60
+Option Flags : nomemaccess
+RAMDAC : ?
+Submitter : Steven Wallace <swallace@ece.uci.edu>
+Last Edit Date : October 3, 1993
+#-------------------------------------------------------------------------#
+Card Vendor : SPEA Videoseven
+Card Model : V7-Mirage
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC :
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : STB
+Card Model : VL-24
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : ?
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : progamable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC :
+Submitter :
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : Viglen
+Card Model : Genie
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : 86C805
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : AV9194-56N20
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 25.2 28.3 39.7 0.0 49.9 76.7 35.7 44.6 130.2 119.5
+Clocks (cont) : 79.4 31.2 110.0 65.2 74.9 71.3
+Option Flags :
+RAMDAC :
+Submitter : C.E. Hawkins ceh@eng.cam.ac.uk
+Last Edit Date : Oct 4, 1993
+#--------------------------------------------------------------------------#
+# S3 928 #
+#--------------------------------------------------------------------------#
+Card Vendor : Actix
+Card Model : GraphicsEngine Ultra Plus
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C928
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 25ns (I think: chips are: TMS 44C251ASD)
+Clock Chip : Chrontel CH9204CL-NC
+Programmable? (Y/N) : Not sure (probably not)
+Number of clocks : 16
+Clocks : 25 28 40 72 50 77 36 45 90 120 80 32 110 65 75 95
+Option Flags :
+RAMDAC : Winbond W82C490P-110
+Submitter : Richard Gooch <rgooch@atnf.csiro.au>
+Last Edit Date : 1-OCT-1993
+#--------------------------------------------------------------------------#
+Card Vendor : Diamond Computer Systems, Inc.
+Card Model : Stealth Pro (not officially supported)
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60ns
+Clock Chip :
+Programmable? (Y/N) : Y ;Need external clock program (like ds3) to
+Number of clocks : 3 or more ;set 3rd clock entry to:
+Clocks : 19.9 22.3 24.8 25.0 28.1 31.3
+Clocks (cont) : 32.2 35.7 35.9 37.0 39.8 (interlaced)
+Clocks (cont) : 39.7 44.6 49.6 49.9 56.2 62.6
+Clocks (cont) : 64.4 71.4 71.8 73.9 79.6 (non-interlaced)
+Option Flags : nomemaccess
+RAMDAC : Diamond SS2410
+Submitter : Hans Oey <hans@mo.hobby.nl>
+Last Edit Date : Oct 5, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 86C928
+Video Memory : 2048k and 1024k (tested both)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns
+Clock Chip : ICD 2061ASC-1
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra SC 15025CV Highcolor 24 - 110
+Submitter : Dirk Hohndel <hohndel@xfree86.org>
+Last Edit Date : 09/27/93
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA, Aachen, Germany
+Card Model : ELSA Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA (and EISA, but no EISA motherboard, not tested)
+Chipset : S3-928 rev. D
+Video Memory : 1024k (up to 2MB VRAM)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICD 2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : SC 15025
+Submitter : Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+Last Edit Date : Sept 27, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA, Aachen, Germany
+Card Model : ELSA Winner 1000 VL
+Card Bus (ISA/EISA/VLB) : VLB (33 MHz)
+Chipset : S3-928 rev. D
+Video Memory : 1024k (up to 2MB VRAM + 1MB offscreen DRAM)
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICD 2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : SC 15025
+Submitter : Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+Last Edit Date : Sept 27, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA/EISA Twinbus (EISA not yet tested)
+Chipset : S3 928 D-step
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "ic2061a"
+Option Flags : nomemaccess
+RAMDAC : SIERRA 15/16 bit (SC15025)
+Submitter : Helmut Geyer geyer@kalliope.iwr.uni-heidelberg.de
+Last Edit Date : Sept 27, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Elsa
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM (Micron MT42C4256Z-8 or -7)
+Memory Speed : 80ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra 15/16-bit HiColor
+Submitter : Peter E. <Peter.Eubert@iwb.mw.tu-muenchen.d400.de>
+Last Edit Date : October 8, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : Winner 1000
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : S3 86C928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Sierra SC 15025CV
+Submitter : Helmut Geyer <geyer@kalliope.iwr.uni-heidelberg.de>
+Last Edit Date : Oct 12, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ELSA
+Card Model : ELSA Winner 1000
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3/928
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC :
+Submitter : Walter Tuppa <tuppa@iue.tuwien.ac.at>
+Last Edit Date : Oct 11, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Miro Computer Products GmbH - GERMANY
+Card Model : MIRO 32S Eisa
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : S3 928
+Video Memory : 4 Mb
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ICS 2494
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 50.350 56.644 65.000 72.000 80.000 89.800
+Clocks (cont) : 0.000 29.500 14.750 25.175 44.900 84.000
+Clocks (cont) : 100.000 110.000 125.000 135.000
+Option Flags : ?
+RAMDAC : BT 485
+Submitter : ?
+Last Edit Date : May 13, 1994
+#--------------------------------------------------------------------------#
+Card Vendor : Number 9
+Card Model : GXE Level 11
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : 1M VRAM, 1M DRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Marc Evans <marc@xfree86.org>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928 Rev D
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485KPJ135
+Submitter : David Wexelblat <dwex@xfree86.org>
+Last Edit Date : October 16, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Number 9
+Card Model : GXe12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928
+Video Memory : 3Mb
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : Yes
+Number of clocks : Programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Brooktree Bt485
+Submitter : Orest Zborowski <orestz@microsoft.com>
+Last Edit Date : Sep 25, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : S3 928 Rev E
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+N}mber of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Daniel Ling <danzig@eclipse.its.rpi.edu>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928 Rev D [other codes: 1XP1-0001 93295DB 9318101]
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485KPJ135 [other codes: 006 9320]
+Submitter : Ed Hall <edhall@rand.org>
+Last Edit Date : October 15, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : GXE level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928
+Video Memory : 3 MB
+Memory Type (DRAM/VRAM) : 2 MB VRAM / 1 MB DRAM
+Memory Speed : ?
+Clock Chip : icd2061a
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : Bt485
+Submitter : Ted Goldblatt
+Last Edit Date : 25 October 1993
+#--------------------------------------------------------------------------#
+Card Vendor : #9
+Card Model : GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Yes
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree 485
+Submitter : Randy Terbush <randyt@cse.unl.edu>
+Last Edit Date : Oct 25, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXE Level 12
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 928 Rev E
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 60ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+N}mber of clocks : programmable
+Clocks : "icd2061a"
+Option Flags :
+RAMDAC : BrookTree Bt485
+Submitter : Daniel Ling <danzig@eclipse.its.rpi.edu>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : Number Nine
+Card Model : #9GXe Level 12
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : 86C928P-P
+Video Memory : 3072k
+Memory Type (DRAM/VRAM) : 2MB VRAM, 1MB DRAM
+Memory Speed : 70ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags : "nolinear", "nomemaccess", "bt485_curs"
+RAMDAC : BT485
+Submitter : Andreas Joppich <aj@ms.DeTeMobil.de>
+Last Edit Date : March 24,1994
+#--------------------------------------------------------------------------#
+Card Vendor : Spea/V7
+Card Model : Mercury PCI Lite
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : S3 928P
+Video Memory : 1 MB
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 60 ns
+Clock Chip : Avasem AV9194-U7CW20
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 25 28 40 0 50 77 36 45
+Clocks (cont) : 130 120 80 31 110 65 75 95
+Option Flags : "dac_8_bit"
+RAMDAC : Sierra SC 15025
+Submitter : Kai Maekisara <Kai.Makisara@vtt.fi>
+Last Edit Date : March 24, 1994
+#--------------------------------------------------------------------------#
+Card Vendor : SPEA Video7
+Card Model : Mercury PCI
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : S3-928
+Video Memory : 2048 kB
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : SC11412
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "sc11412"
+Option Flags : "spea_mercury"
+RAMDAC : BT485
+Submitter : preuss@cach02.chm.tu-dresden.de
+Last Edit Date : May 24, 1994
+#--------------------------------------------------------------------------#
+Card Vendor : STB
+Card Model : Pegasus
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : S3 86C928
+Video Memory : 2048k or 4096k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 17.86, 18.52, 19.23, or 20 ns
+Clock Chip : ICD2061A
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : "icd2061a"
+Option Flags : stb_pegasus,dac_8_bit,sync_on_green
+RAMDAC : Bt485
+Submitter : David Gadbois
+Last Edit Date : May 27, 1994
+#--------------------------------------------------------------------------#
+# 8514/A #
+#--------------------------------------------------------------------------#
+Card Vendor : Western Digital
+Card Model : WD9510-AT
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : 8514/A-compatible
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : n/a
+Programmable? (Y/N) : n/a
+Number of clocks : n/a
+Clocks : n/a
+Option Flags :
+RAMDAC : std
+Submitter : <andrew@werple.apana.org.au>
+Last Edit Date : Mon Sep 27 11:11:53 EST 1993
+#--------------------------------------------------------------------------#
+# ATI Mach8 #
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : 8514 Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach-8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 100ns
+Clock Chip : 18811-0
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 43.10 48.90 92.90 36.30 50.30 56.60 0.00 44.90
+Clocks (cont) : 30.30 32.10 0.00 80.50 40.20 44.90 75.40 65.30
+Clocks (cont) : 21.60 24.40 46.40 18.10 25.10 28.30 0.00 22.40
+Clocks (cont) : 15.20 16.10 55.40 40.20 20.10 22.40 37.70 32.70
+Option Flags :
+RAMDAC : standard
+Submitter : Tiago Gons <tiago@comosjn.hobby.nl>
+Last Edit Date : Sept 27, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-0
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 42.95 48.77 92.4 36.0 50.35 56.64 0.0 44.9
+Clocks (cont) : 30.24 32.0 110.0 80.0 39.91 44.9 75.0 65.0
+Clocks (cont) : 21.47 24.38 45.2 18.0 25.17 28.32 0.0 22.45
+Clocks (cont) : 15.12 16.0 55.0 40.0 19.95 22.45 37.5 32.5
+Option Flags :
+RAMDAC : Unknown
+Submitter : Scott Laird <lair@midway.uchicago.edu>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 16
+Clocks : 43.0 48.8 0.0 36.0 50.4 56.6 0.0 44.9
+Clocks (cont) : 30.2 32.0 110.0 80.0 40.0 44.9 75.0 65.0
+Option Flags :
+RAMDAC : generic 8-bit pseudocolor (says SuperProbe)
+Submitter : mrex@rz.fht-mannheim.de
+Last Edit Date : 30-Sep-93
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-0
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 43.10 48.90 92.80 36.30 50.30 56.60 0.00 44.90
+Clocks (cont) : 30.30 32.10 110.70 80.50 40.20 44.90 75.40 65.30
+Option Flags :
+RAMDAC :
+Submitter : Hans Nasten <nasten@everyware.se>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra (P/N1041111520, BIOS#1130111513(c)91)
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8 38800-1 (VGA - VGA Wonder+ 28800-5)
+Video Memory : 1024k (VGA - 512k)
+Memory Type (DRAM/VRAM) : VRAM TMS44C251-10 (VGA - DRAM)
+Memory Speed : 100ns (VGA - 80ns)
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 43.00 48.80 0.00 36.00 50.30 56.70 0.00 44.90
+Clocks (cont) : 30.30 32.00 108.40 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 21.50 24.40 0.00 18.00 25.20 28.30 0.00 22.40
+Clocks (cont) : 15.10 16.00 55.00 40.00 20.00 22.40 37.50 32.50
+Option Flags :
+RAMDAC : (?) INMOS IMSG176J666
+Submitter : Henry Worth <haw30@ras.amdahl.com>
+Last Edit Date : Oct 3, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics ULTRA
+Card Bus : ISA
+Chipset : ATI 28800-6 and ATI 38800-1
+Video Memory : 1024k
+Memory Type : VRAM
+Memory Speed : 80ns
+Clock Chip : ATI 188102
+Programmable? (Y/N) : don't know
+Number of clocks : 32
+Clocks : 43.00 48.80 0.00 36.00 50.30 56.70 0.00 44.90
+Clocks (cont) : 30.30 32.00 89.50 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 21.50 24.40 0.00 18.00 25.20 28.30 0.00 22.40
+Clocks (cont) : 15.10 16.00 50.10 40.10 20.00 22.40 37.50 32.50
+Option Flags :
+RAMDAC : IMSG176J-S07
+Submitter : Joergen Haegg <jh@efd.lth.se>
+Last Edit Date : Oct 13, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach8
+Video Memory : 1MB VRAM ACCEL / 512KB DRAM VGA
+Memory Type (DRAM/VRAM) : See above
+Memory Speed : 60ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 13
+Clocks : 30.3 32.0 36.0 40.0 43.0 44.9 48.8
+Clocks (cont) : 50.3 56.7 65.1 75.0 80.0 92.0
+Option Flags :
+RAMDAC :
+Submitter : Dimitrios Evmorfopoulos
+Last Edit Date : Oct 26th 1993
+#--------------------------------------------------------------------------#
+# ATI Mach32 #
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : AX0
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 45ns
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875
+Submitter : Alan Hourihane <alanh@metro.co.uk>
+Last Edit Date : Jan 6, 1994
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100.0 126.0 92.4 36.0 50.35 56.64 0 44.90
+Clocks (cont) : 135.0 32.0 110.0 80.0 39.91 49.90 75.0 65.0
+Option Flags : None
+RAMDAC : ATI34075
+Submitter : Mike Bernson
+Last Edit Date : Sept 26, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : VLB mach32
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI 68800-3 (mach32)
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ATI 18811-1
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 100 126 92.4 36 50.35 56.64 External 44.9
+Clocks (cont) : 135 32 110 80 39.91 44.9 75 65
+Option Flags : none
+RAMDAC : ATI 68875
+Submitter : Craig E. Groeschel <craig@metrolink.com>
+Last Edit Date : Oct 3, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : ATI Ultra Pro (OEM version without mouse)
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : MACH 32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ics2494AM 9236-308
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 51.00 36.00 126.00 25.00 80.00 65.00 45.00 40.00
+Clocks (cont) : 135.00 32.00 110.00 80.00 45.00 40.00 75.00 65.00
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Bill Broadley <Broadley@neurocog.lrdc.pitt.edu>
+Last Edit Date :
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Mach32 Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : 6880006
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80 ns
+Clock Chip : ATI1881 (ICS2494)
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 18.00 22.00 25.00 28.00 36.00 44.00 50.00 56.00
+Clocks (cont) : 30.00 32.00 37.00 39.00 40.00 0.00 75.00 65.00
+Option Flags :
+RAMDAC : ATI68830
+Submitter : Ed Krohne <krohne@elrond.mcdata.com>
+Last Edit Date : Sept 30, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI Technologies Inc
+Card Model : Graphics Ultra Pro VLB
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : 256Kx4 VRAM; 512-bit serial transfer
+Memory Speed : ??
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100.00 126.00 92.40 36.00 50.35 56.64 Ext 44.90
+Clocks (cont) : 135.00 32.00 110.00 80.00 39.91 44.90 75.00 65.00
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Mark Weaver <Mark_Weaver@brown.edu>
+Last Edit Date : Oct 3, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A / Mach 32
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns (according to docs, not actually opened)
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC :
+Submitter : Linus Torvalds <Linus.Torvalds@Helsinki.FI>
+Last Edit Date : Oct 4, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : VLB mach32
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 80ns
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100.0 126.0 92.0 36.0 51.0 57.0 0.0 44.0
+Clocks (cont) : 135.0 32.0 110.0 80.0 39.0 45.0 75.0 65.0
+Clocks (cont) : 50.0 63.0 46.0 18.0 25.0 28.0 0.0 22.0
+Clocks (cont) : 67.0 16.0 55.0 40.0 19.0 23.0 37.0 33.0
+Option Flags :
+RAMDAC : ATI 68875
+Submitter : Todd Pfaff <todd@flex.eng.mcmaster.ca>
+Last Edit Date : Oct 4, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : ?
+Clock Chip : 18811-1
+Programmable? (Y/N) : No
+Number of clocks : 16
+Clocks : 100 126 92 36 50 56 0 45 135 32 110 80 40 45 75 65
+Option Flags :
+RAMDAC : ?
+Submitter : Ari Laakkonen <apl@doc.ic.ac.uk>
+Last Edit Date : Oct 4, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra Pro
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A/Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 45ns
+Clock Chip :
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875 RAMDAC
+Submitter : Dietmar Wolz <dietmar@cs.tu-berlin.de>
+Last Edit Date : Oct 09, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphic Ultra Pro
+Card Bus (ISA/EISA/VLB) : EISA
+Chipset : ATI 28800-A
+Video Memory : 2M
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 70ns (I think! if not 60ns)
+Clock Chip : 18811-1
+Programmable? (Y/N) : N
+Number of clocks : 16
+Clocks : 100 126 92 36 50 56 0 45
+Clocks (cont) : 132 32 110 80 40 45 75 65
+Option Flags : none(?)
+RAMDAC : ATI68875/TLC34075 (reported by inw 12EE[11:9])
+Submitter : aal@rot.qc.ca (Alain Hebert)
+Last Edit Date : Oct 26, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : ATI Ultra Mach32
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Mach32 2200688003 + ATI 68875 BFN
+Video Memory : 2 MB
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns
+Clock Chip : ICS 2494 AM ?
+Programmable? (Y/N) : Y
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags : --
+RAMDAC : 18820 ATI
+Submitter : Christoph Kukulies <kuku@acds.physik.rwth-aachen.de>
+Last Edit Date : Oct 30, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model : Graphics Ultra CLX
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : ATI 68800-06
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ATI 18811-2
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI68875
+Submitter : Marc Wandschneider <marcwan@microsoft.com>
+Last Edit Date : Oct 25, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Dell Computer on board video card
+Card Model : Omniplex 466
+Card Bus (ISA/EISA/VLB) : PCI
+Chipset : ATI 68800 (Mach32, 8514/A compatible)
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : ?
+Memory Speed : ?
+Clock Chip : ?
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 17.40 19.60 21.80 24.90 27.70 31.00 34.60 44.90
+Clocks (cont) : 51.80 53.50 55.30 62.20 69.30 76.00 87.10 93.30
+Clocks (cont) : 8.70 9.80 10.90 12.45 13.85 15.50 17.30 22.45
+Clocks (cont) : 25.90 26.75 27.65 31.10 34.65 38.00 43.55 46.65
+Option Flags : None
+RAMDAC : ?
+Submitter : Blaine Benson <benson@ssu.abratech.com>
+Last Edit Date : June 15, 1994
+#--------------------------------------------------------------------------#
+Card Vendor : NCR
+Card Model : Clarity II
+Card Bus (ISA/EISA/VLB) : Direct Access Video Buss (DAVB) Sort of a VLB
+Chipset : ATI Mach-32
+Video Memory : 2048K
+Memory Type (DRAM/VRAM) : ?? (Toshiba TC524258BJ-80)
+Memory Speed : 80ns
+Clock Chip : ??
+Programmable? (Y/N) : ?
+Number of clocks : ?
+Clocks : ?
+Clocks (cont) : ?
+Option Flags : none
+RAMDAC : TIC34075
+Submitter : Stuart Anderson <Stuart.Anderson@ColumbiaSC.NCR.COM>
+Last Edit Date : Thu Dec 2 1993
+#--------------------------------------------------------------------------#
+Card Vendor : PRISMA
+Card Model : GraphicSTAR-FX V
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : ATI 28800-A/Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed : 45ns
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 32
+Clocks : 100 126 92 36 51 57 0 44 135 32 110 80 39 45 75 65
+Clocks (cont) : 50 63 46 18 25 28 0 22 67 16 55 40 19 23 37 33
+Option Flags :
+RAMDAC : ATI 68875 RAMDAC
+Submitter : Peter Blok <pb@pbgate.iaf.nl>
+Last Edit Date : Dec 09, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ATI
+Card Model :
+Card Bus (ISA/EISA/VLB): VLB
+Chipset : Mach32
+Video Memory : 2048k
+Memory Type (DRAM/VRAM): DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : No
+Number of clocks : 32
+Clocks : 100.30 126.60 92.40 36.10 50.50 56.80 0.00 44.90
+Clocks (cont) : 135.10 32.00 109.70 80.00 40.00 44.90 75.00 65.00
+Clocks (cont) : 50.15 63.30 46.20 18.05 25.25 28.40 0.00 22.45
+Clocks (cont) : 67.55 16.00 54.85 40.00 20.00 22.45 37.50 32.50
+Option Flags : None
+RAMDAC : BT481
+Submitter : Jin Tao
+Last Edit Date : Dec. 15, 1993
+#--------------------------------------------------------------------------#
+# Weitek P9000 #
+#--------------------------------------------------------------------------#
+Card Vendor : Diamond Computer Systems, Inc.
+Card Model : Viper
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Weitek Power 9000
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : VRAM
+Memory Speed :
+Clock Chip : icd2061a Compatable
+Programmable? (Y/N) : Y
+Number of clocks : programmable
+Clocks : 25 to 135 (over 110 not recommended)
+Option Flags :
+RAMDAC : bt485
+Submitter : Erik Nygren <nygren@mit.edu>
+Last Edit Date : July 8, 1994
+#--------------------------------------------------------------------------#
+# SVGA (Cirrus) #
+#--------------------------------------------------------------------------#
+Card Vendor : Boca
+Card Model : SVGAX3
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : Cirrus 5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : ?
+Clock Chip : Built-In
+Programmable? (Y/N) : No
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08
+Clocks (cont) : 49.87 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Cirrus Logic Built-in 15/16/24-bit DAC
+Submitter : <johnsonp@nicco.sscnet.ucla.edu>
+Last Edit Date : Oct 3, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Cirrus Logic
+Card Model : MVGA-AVGA3VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : CL 5426
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70ns
+Clock Chip : internal
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.23 42.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.89 72.16 75.00 80.01
+Option Flags :
+RAMDAC : internal
+Submitter : <woju@keep.fan.bln.sub.org>
+Last Edit Date : Thu Oct 7 10:56:50 MET 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Diamond
+Card Model : SpeedStar PRO
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus 5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70ns (HY534256S-70; 9306A KOREA)
+Clock Chip : Cirrus built-in
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Cirrus Logic Built-in 15/16/24-bit DAC
+Submitter : Chris Metcalf <metcalf@lcs.mit.edu>
+Last Edit Date : Sun Sep 26 22:12:50 EDT 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Genoa Systems
+Card Model : WindowsVGA 24 8500VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic GD5426 (P/N: CL-GD5426-80QC-A)
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : Best guess 70ns (P/N: AAA1M304J-07)
+Clock Chip : Integrated
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.20 28.30 41.20 36.10 31.50 40.00 44.90 49.87
+Clocks (cont) : 65.00 72.20 75.00 80.00
+Option Flags :
+RAMDAC : Integrated
+Submitter : <scooper@noc.rutgers.edu>
+Last Edit Date : Oct 5, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Genoa
+Card Model : 8500VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus CLGD5426
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70 ns
+Clock Chip : internal
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : internal
+Submitter : Dave Kochan <slflq@cc.usu.edu>
+Last Edit Date : Oct. 5, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : No Name
+Card Model : Unmarked
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : CLGD5426
+Video Memory : 1MB+1MB
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns
+Clock Chip : builtin
+Programmable? (Y/N) : Y
+Number of clocks : 16
+Clocks : 25.23 28.32 41.16 36.08 31.5 39.99 45.08 49.87
+Clocks (cont) : 64.98 72.16 75.17 80.05 85.23 90.20 94.95 100.23
+Option Flags : slow_ram
+RAMDAC : builtin (?)
+Submitter : Piercarlo Grandi <pcg@aber.ac.uk>
+Last Edit Date : 93/10/26
+#--------------------------------------------------------------------------#
+Card Vendor : TMC Research Corporation
+Card Model : HG426AV VESA Local(VL) Bus Graphics Card
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic 5426 BitBLT
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70 ns
+Clock Chip : Internal
+Programmable? : Y
+Number of clocks : 12
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 45.08
+Clocks (cont) : 49.87 64.98 72.16 75.00 80.01
+Option Flags :
+RAMDAC : Internal
+Submitter : Dilvan de A. Moreira <ddam@ukc.ac.uk>
+Last Edit Date : Oct 7, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Unspecified
+Card Model : AVGA3VL
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus Logic GD5426-A
+Video Memory : 2048k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 80ns surface-mounted, and 8 x 70/80ns 256kx4
+Clock Chip : Cirrus, built-in
+Programmable? (Y/N) : Y
+Number of clocks : 12
+Clocks : 25.20 28.30 41.20 36.10 31.50 40.00 44.90 49.87
+Clocks (cont) : 65.00 72.20 75.00 80.00
+Option Flags :
+RAMDAC : Cirrus built-in
+Submitter : H. Hanemaayer <hhanemaa@cs.ruu.nl>
+Last Edit Date : Oct 26, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Genoa
+Card Model : 8500vl 18/24
+Card Bus (ISA/EISA/VLB) : VLB
+Chipset : Cirrus CL-5428
+Video Memory : 2048k
+Memory Type (DRAM/VRA) : DRAM (2nd meg)/ VRAM (1st meg)
+Memory Speed : 60ns (1st), 80ns (2nd)
+Clock Chip : ?
+Programmable (Y/N) : ?
+Number of clocks : 16
+Clocks : ?
+Option Flags : ?
+RAMDAC : ?
+Submitter : John L. Clarke,III <jlc3@netcom.com>
+Last Edit Date : Oct 28, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : ?
+Card Model : PT-528
+Card Bus (ISA/EISA/VLB) : ?
+Chipset : Cirrus CL-5428
+Video Memory : 1024k
+Memory Type (DRAM/VRA) : DRAM (2nd meg)
+Memory Speed : ?
+Clock Chip : ?
+Programmable (Y/N) : ?
+Number of clocks : 13
+Clocks : 25.23 28.32 41.16 36.08 31.50 39.99 48.08 49.87
+Clocks (cont) : 64.98 72.16 0.00 75.00 80.01
+Option Flags : ?
+RAMDAC : ?
+Submitter : Aled Davies <ssudavia@reading.ac.uk>
+Last Edit Date : Dec 15, 1993
+#--------------------------------------------------------------------------#
+# SVGA (Western Digital) #
+#--------------------------------------------------------------------------#
+Card Vendor : DFI Inc
+Card Model : VG-8000WH
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 60ns
+Clock Chip : ICS90C64AV
+Programmable? (Y/N) :
+Number of clocks : 9
+Clocks : 25.20 28.32 65.50 36.30 40.30 50.30 32.20 45.00
+Clocks (cont) : 49.70
+Option Flags :
+RAMDAC : AT&T 20C492 15/16/18-bit DAC with gamma correction
+Submitter : Charlie Brady <charlieb@tplrd.tpl.oz.au>
+Last Edit Date : Thu Oct 7 19:26:31 EST 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Diamond
+Card Model : SpeedStar 24X
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD/Paradise 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 77.30 0.00 0.00 28.30 0.00 0.00
+Clocks (cont) : 50.50
+Option Flags :
+RAMDAC : Diamond SS2410
+Submitter : Mike Tierney <mjtiern@pepsi.eng.umd.edu>
+Last Edit Date : Oct 7, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : HP
+Card Model : 5/60LM
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : WD/Paradise 90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 65.60 36.30 0.00 28.30 0.00 0.00
+Clocks (cont) : 49.70 (most bogus because of server probing problem)
+Option Flags :
+RAMDAC : ?
+Submitter : <skelton%jdp.UUCP@dragon.com>
+Last Edit Date : Nov 29, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : OCTEK
+Card Model : PVGA1D+
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD/Paradise 90C31-LR
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed : 70nS
+Clock Chip : Avasem AV90C64N
+Programmable? (Y/N) : N
+Number of clocks : 9
+Clocks : 25.20 28.32 65.10 35.60 0.00 49.90 32.10 45.00 44.50
+Option Flags :
+RAMDAC : Sierra 15/16/bit Hicolor
+Submitter : Antti Heinila <aheinila@vipunen.hut.fi>
+Last Edit Date : Nov 12, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Western Digital (on Viglen Motherboard)
+Card Model :
+Card Bus (ISA/EISA/VLB) : Integrated
+Chipset : WD90C31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : unknown
+Memory Speed : unknown
+Clock Chip : unknwon
+Programmable? (Y/N) : unknwon
+Number of clocks : 8
+Clocks : 25.00 28.00 65.00 0.00 36.00 0.00 44.00
+Option Flags :
+RAMDAC :
+Submitter : row@uk.co.bnr
+Last Edit Date : Oct 14, 1993
+#--------------------------------------------------------------------------#
+Card Vendor : Western Digital
+Card Model : Accelerator for Windows
+Card Bus (ISA/EISA/VLB) : ISA
+Chipset : WD90c31
+Video Memory : 1024k
+Memory Type (DRAM/VRAM) : DRAM
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks : 9
+Clocks : 25 28 65 36 40 50 32 45 ??
+Option Flags :
+RAMDAC : Sierra HiColor (32k colors)
+Submitter : wmagro@uiuc.edu (William Magro)
+Last Edit Date : Nov 2, 1993
+
+#--------------------------------------------------------------------------#
+# $BJ,$+$C$F$$$k(J $B%/%m%C%/%7%s%;%5%$%6!<(J $B$N(J $B%I%C%H%/%m%C%/(J #
+#--------------------------------------------------------------------------#
+ATI 18811-0:
+ 42.95 48.77 92.4 36.0 50.35 56.64 0.0 44.9
+ 30.24 32.00 110.0 80.0 39.91 44.9 75.0 65.0
+ATI 18811-1:
+ 100.0 126.0 92.4 36.0 50.35 56.64 0.0 44.9
+ 135.0 32.0 110.0 80.0 39.91 44.9 75.0 65.0
+Avasem AV9194-56:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 72.0
+Avasem AV9194-07, AV9194-11:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+Chrontel CH9294-G:
+ 25.175 28.322 40.0 72.0 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+ICS ICS2494-256:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 72.0
+ICS ICS2494-275, ICS2494-305:
+ 25.175 28.322 40.0 0.0 50.0 77.0 36.0 44.889
+ 130.0 120.0 80.0 31.5 110.0 65.0 75.0 94.5
+
+#--------------------------------------------------------------------------#
+# $B?7$7$/%5%]!<%H$9$k%+!<%IMQ$NEj9FMQ;f$G$9!#%X%C%@!<$N<!$NA4$F$N6uGrMs$K(J #
+# $B@_Dj$r5-F~$7$F%a!<%k$rAw$C$F$/$@$5$$!#(J #
+#--------------------------------------------------------------------------#
+To: XFree86@XFree86.org
+Subject: New accelerated card database entry.
+
+Card Vendor :
+Card Model :
+Card Bus (ISA/EISA/VLB) :
+Chipset :
+Video Memory :
+Memory Type (DRAM/VRAM) :
+Memory Speed :
+Clock Chip :
+Programmable? (Y/N) :
+Number of clocks :
+Clocks :
+Option Flags :
+RAMDAC :
+Submitter :
+Last Edit Date :
+
+
+#--------------------------------------------------------------------------#
+[ $BLuCm(J : $B$=$l$>$l$N0UL#$O<!$N$H$*$j$G$9!#(J $B>e$N%G!<%?%Y!<%9$N@_Dj$NMQ;f$r(J ]
+[ $B;H$C$F(J XFree86@XFree86.org $B$^$G%a!<%k$rAw$j$^$7$g$&!#(J ]
+[ From: $B$"$J$?$N%a!<%k%"%I%l%9(J $B$rK:$l$J$$$GIU$1$F$/$@$5$$!#(J ]
+To: XFree86 $B%W%m%8%'%/%H<R(J <XFree86@XFree86.org>
+Subject: $B?7$7$$%"%/%;%i%l!<%?%+!<%I$N%G!<%?%Y!<%9$X$NEPO?(J
+$B%+!<%I@=B$2q<R(J :
+$B@=IJL>(J :
+$B%P%9$N<oN`(J (ISA/EISA/VLB) :
+$B%A%C%W%;%C%H(J :
+$B%S%G%*%a%b%jNL(J :
+$B%a%b%j$N7?(J (DRAM/VRAM) :
+$B%a%b%j$NB.EY(J :
+$B%/%m%C%/%A%C%W(J :
+$B%W%m%0%i%^%V%k$+$I$&$+!)(J(Y/N) :
+$B%/%m%C%/?t(J :
+$B%/%m%C%/(J :
+$B%/%m%C%/(J ($B7QB39T(J) :
+$B%*%W%7%g%s%U%i%0(J :
+RAMDAC :
+$BDs=P<T(J :
+$B:G=*=$@5F|(J :
+
+
+Based on:
+XConsortium: AccelCards,v 1.2 94/11/21 21:48:41 kaleb Exp
+XFree86: xc/programs/Xserver/hw/xfree86/doc/AccelCards,v 3.3 1995/01/28 15:58:25 dawes Exp
+
+----------------------------------------------------------------------------
+$B$3$N%U%!%$%k$O(J xc/programs/Xserver/hw/xfree86/doc/AccelCards,v 3.3
+1995/01/28 15:58:25 $B$r!"(J $B2,K\!!0l9,(J <ikko-@pacific.rim.or.jp>
+$B$,(J XFree86 3.1.1 $B$rF|K\$G%$%s%9%H!<%k$9$k?M8~$1$KK]Lu$7$?$b$N$G$9!#(J
+ $B$3$3$,$*$+$7$$$H$+!"(J $B$3$3$O$3$&$7$?$[$&$,$$$$$H$$$C$?$40U8+(J
+$B$,$"$j$^$7$?$i!"(J $BEE;R%a!<%k$G$*CN$i$;2<$5$$!#(J
+$B86J8$NCx:n8"$O(J XFree86 $B%W%m%8%'%/%H<R$K$"$j$^$9!#(J
+$B$3$NOBLu$NCx:n8"$O(J XFree86 $B%W%m%8%'%/%H<R!"5Z$S(J $B2,K\!!0l9,(J $B$K$"$j$^$9$,!"(J
+$B$3$NOBLu$NIT6q9g$O;d$K!"(J $BEE;R%a!<%k$GAw$C$F2<$5$$!#(J
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/Japanese/AccelCards,v 3.2 1996/12/23 06:45:36 dawes Exp $
+$XConsortium: AccelCards /main/3 1996/02/21 17:41:47 kaleb $
+----------------------------------------------------------------------------
+[EOF]
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/COPYRIGHT b/xc/programs/Xserver/hw/xfree86/doc/Japanese/COPYRIGHT
new file mode 100644
index 000000000..7ff9bbdc4
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/COPYRIGHT
@@ -0,0 +1,180 @@
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ Ăřşî¸˘É˝ź¨
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇĂř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+
+ 1. XFree86 Ăřşî¸˘É˝ź¨
+
+ Ăřşî¸˘¤ŹĚŔź¨¤ľ¤ě¤Ć¤¤¤ëĽ×ĽíĽ°ĽéĽŕ¤ň˝ü¤¤¤Ć XFree86 ¤ÎĽ×ĽíĽ°ĽéĽŕ¤ĎźĄ¤ÎĂř
+ şî¸˘¤ňÍ­¤š¤ë:
+
+ Copyright (C) 1994, 1995, 1996 The XFree86 Project, Inc. All Rights
+ Reserved.
+
+ ĚľÎÁ¤ÇĄ˘ĂŻ¤â¤Ź¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤Č´ŘϢ¤š¤ëʸ˝ńĽŐĽĄĽ¤ĽëĄĘ°Ęšß¤Ţ¤Č¤á¤Ć
+ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤Č¸Ć¤ÖĄË¤ňĆţźę¤š¤ëťöĄ˘ťČÍѸ˘Ą˘ĘŁźĚ¸˘Ą˘ĘŃšš¸˘Ą˘Ęťšç
+ ¸˘Ą˘˝ĐČǸ˘Ą˘ÇŰÉŐ¸˘Ą˘şĆźÂťÜľöÂú¸˘ ¤Ť¤Ä/¤Ţ¤ż¤Ď ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎČÎÇ丢
+ ¤ň´Ţ¤ó¤ÇŔŠĚóĚľ¤ˇ¤Çźč¤ę°ˇ¤ŚťöĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ňŔŠ¸ÂĚľ¤ˇ¤ÇśĄľë¤š¤ëżÍ
+ ¤ňľö˛Ä¤š¤ëťöĄ˘¤ň°Ę˛ź¤ÎžňˇďÉŐ¤­¤ÇĄ˘¤ł¤ł¤ËžľÇ§¤š¤ëĄŁ
+
+ žĺľ­¤ÎĂřşî¸˘šđź¨¤Č¤ł¤Îǧ˛Äšđź¨¤ň ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎÁ´¤Ć¤Ţ¤ż¤ĎĄ˘˝ĹÍפĘ
+ ÉôĘŹ¤ČśŚ¤ËĂÖ¤ŻťöĄŁ
+
+ ÇĄ˛ż¤Ę¤ëźďÎॢˇÁÍĆĄ˘°ŐĚŁ¤Ç¤âĄ˘žŚÉʲ˝¤Î˛ÄÇ˝Ŕ­ľÚ¤ÓĄ˘ĆĂÄę¤ÎĚÜĹŞ¤Ť¤É¤Ś¤ŤĄ˘
+ Č󿯳˛¤ŤČݤŤ¤ÎĘÝžÚĚľ¤ˇ¤ËĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň ``¤˘¤ë¤Ź¤Ţ¤Ţ'' ¤ÎˇÁ¤ÇśĄ
+ ľë¤ˇ¤Ţ¤šĄŁÍ׾ᥢł˛¤ä¤˝¤Îž¤ÎŔŐǤľÚ¤ÓÇĄ˛ż¤Ę¤ëˇŔĚó¤ÎźÂšÔ¤äÉÔŔľšÔ°ŮĄ˘
+ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤Ë´ŘϢ¤ŹÍ­¤Ă¤Ć¤âĚľ¤Ż¤Ć¤âŔ¸¤¸¤ż¸˝žÝĄ˘Ëô¤Ď ``¤˝¤Ő¤Č¤Ś¤§
+ ¤˘'' ¤ÎťČÍѡë˛Ě¤äž¤Îźč¤ę°ˇ¤¤ˇë˛Ě¤Ë¤Ä¤¤¤ĆĄ˘¤É¤ó¤ĘşłşŮ¤Ę¤ł¤Č¤Ç¤â
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČ¤Ë¤ĎŔŐǤ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ¤ł¤Îšđź¨¤Ë´Ţ¤Ţ¤ě¤Ć¤¤¤ëťö¤ň˝ü¤¤¤ĆĄ˘ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň XFree86 Ľ×Ľí
+ Ľ¸Ľ§ĽŻĽČ¤ÎĚž¤Î˛ź¤Ëš­šđ¤ˇ¤ż¤ęĄ˘ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ť¤é°ĘÁ°¤ËČŻšÔ¤ˇ
+ ¤żľö˛Ä˝ńĚľ¤ˇ¤ËžźÔ¤Ź ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ňČÎÇ䥢ťČÍŃĄ˘źč¤ę°ˇ¤¤¤ň´ŤÍś¤š¤ë
+ ¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 2. ¤˝¤Îž¤ÎĂřşî¸˘É˝ź¨
+
+ °ěÉô¤ÎĽ×ĽíĽ°ĽéĽŕ¤ĎźĄ¤ÎĂřşî¸˘¤ňÍ­¤š¤ë:
+
+ 2.1. X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ
+
+ Copyright (C) 1996 X Consortium
+
+ ĚľÎÁ¤ÇĄ˘ĂŻ¤â¤Ź¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤Č´ŘϢ¤š¤ëʸ˝ńĽŐĽĄĽ¤ĽëĄĘ°Ęšß¤Ţ¤Č¤á¤Ć
+ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤Č¸Ć¤ÖĄË¤ňĆţźę¤š¤ëťöĄ˘ťČÍѸ˘Ą˘ĘŁźĚ¸˘Ą˘ĘŃšš¸˘Ą˘Ęťšç
+ ¸˘Ą˘˝ĐČǸ˘Ą˘ÇŰÉŐ¸˘Ą˘şĆźÂťÜľöÂú¸˘ ¤Ť¤Ä/¤Ţ¤ż¤Ď ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎČÎÇ丢
+ ¤ň´Ţ¤ó¤ÇŔŠĚóĚľ¤ˇ¤Çźč¤ę°ˇ¤ŚťöĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ňŔŠ¸ÂĚľ¤ˇ¤ÇśĄľë¤š¤ëżÍ
+ ¤ňľö˛Ä¤š¤ëťöĄ˘¤ňźĄ¤ÎžňˇďÉŐ¤­¤ÇĄ˘¤ł¤ł¤ËžľÇ§¤š¤ëĄŁ
+
+ žĺľ­¤ÎĂřşî¸˘šđź¨¤Č¤ł¤Îǧ˛Äšđź¨¤ň ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎÁ´¤Ć¤Ţ¤ż¤ĎĄ˘˝ĹÍפĘ
+ ÉôĘŹ¤ČśŚ¤ËĂÖ¤ŻťöĄŁ
+
+ ÇĄ˛ż¤Ę¤ëźďÎॢˇÁÍĆĄ˘°ŐĚŁ¤Ç¤âĄ˘žŚÉʲ˝¤Î˛ÄÇ˝Ŕ­ľÚ¤ÓĄ˘ĆĂÄę¤ÎĚÜĹŞ¤Ť¤É¤Ś¤ŤĄ˘
+ Č󿯳˛¤ŤČݤŤ¤ÎĘÝžÚĚľ¤ˇ¤ËĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň ``¤˘¤ë¤Ź¤Ţ¤Ţ'' ¤ÎˇÁ¤ÇśĄ
+ ľë¤ˇ¤Ţ¤šĄŁÍ׾ᥢł˛¤ä¤˝¤Îž¤ÎŔŐǤľÚ¤ÓÇĄ˛ż¤Ę¤ëˇŔĚó¤ÎźÂšÔ¤äÉÔŔľšÔ°ŮĄ˘
+ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤Ë´ŘϢ¤ŹÍ­¤Ă¤Ć¤âĚľ¤Ż¤Ć¤âŔ¸¤¸¤ż¸˝žÝĄ˘Ëô¤Ď ``¤˝¤Ő¤Č¤Ś¤§
+ ¤˘'' ¤ÎťČÍѡë˛Ě¤äž¤Îźč¤ę°ˇ¤¤ˇë˛Ě¤Ë¤Ä¤¤¤ĆĄ˘¤É¤ó¤ĘşłşŮ¤Ę¤ł¤Č¤Ç¤â X Ľł
+ ĽóĽ˝ĄźĽˇĽ˘ĽŕźŇ¤Ë¤ĎŔŐǤ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ¤ł¤Îšđź¨¤Ë´Ţ¤Ţ¤ě¤Ć¤¤¤ëťö¤ň˝ü¤¤¤ĆĄ˘ ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň X ĽłĽóĽ˝ĄźĽˇĽ˘
+ ĽŕźŇ¤ÎĚž¤Î˛ź¤Ëš­šđ¤ˇ¤ż¤ęĄ˘ X ĽłĽóĽ˝ĄźĽˇĽ˘ĽŕźŇ¤Ť¤é°ĘÁ°¤ËČŻšÔ¤ˇ¤żľö˛Ä˝ń
+ Ěľ¤ˇ¤ËžźÔ¤Ź ``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ňČÎÇ䥢ťČÍŃĄ˘źč¤ę°ˇ¤¤¤ň´ŤÍś¤š¤ë¤ł¤Č¤Ď¤˘
+ ¤ę¤Ţ¤ť¤óĄŁ
+
+ X ĽŚĽŁĽóĽÉĽŚĽˇĽšĽĆĽŕ ¤Ď X ĽłĽóĽ˝ĄźĽˇĽ˘ĽŕźŇ¤ÎžŚÉ¸¤Ç¤šĄŁ
+
+ 2.2. Berkeley ¤Ë´đ¤Ĺ¤ŻĂřşî¸˘:
+
+ 2.2.1. °ěČĚ
+
+ şĆÇŰÉۤČĘŃšš¤Î¤˘¤ę¤Ę¤ˇ¤Ë°ř¤é¤Ę¤¤Ľ˝ĄźĽš¤ČĽĐĽ¤ĽĘĽę¤ÎˇÁÂ֤ǤιżÍѤňźĄ¤Îžň
+ ˇďÉŐ¤­¤Çľö˛Ä¤š¤ë:
+
+ 1. Ľ˝ĄźĽš¤ÎşĆÇŰÉۤˤ˘¤ż¤ęžĺľ­¤ÎĂřşî¸˘É˝ź¨¤Č¤ł¤Îžňˇďʸ¤Î°ěÍ÷¤Č°Ęšß¤ÎĘü
+ ´ţŔë¸Ŕ¤ňĘÝťý¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤¤ĄŁ
+
+ 2. ĽĐĽ¤ĽĘĽęˇÁź°¤ÎşĆÇŰÉۤˤ˘¤ż¤ęžĺľ­¤ÎĂřşî¸˘É˝ź¨¤Č¤ł¤Îžňˇďʸ¤Î°ěÍ÷¤Č°Ę
+ šß¤Îʸ˝ń¤ÎĘü´ţŔë¸ŔľÚ¤Ó/¤Ţ¤ż¤Ď ÇŰÉŰĘŞ¤ËÉŐ°¤š¤ëʸ˝ń¤ňĹžşÜ¤ˇ¤Ę¤ą¤ě¤Đ
+ ¤Ę¤é¤Ę¤¤ĄŁ
+
+ 3. ĂřşîźÔ¤ÎĚžÁ°¤ĎĚŔłÎ¤Ë°ĘÁ°¤ËČŻšÔ¤ˇ¤żľö˛Ä˝ńĚľ¤ˇ¤Ë¤ł¤Î¤˝¤Ő¤Č¤Ś¤§¤˘¤Ť¤é
+ ÇÉŔ¸¤ˇ¤ż¤â¤Î¤ň΢˝ń¤­¤ˇ¤ż¤ęÂĽżĘ¤š¤ë¤â¤Î¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ÇĄ˛ż¤Ę¤ëˇÁÍĆĄ˘°ŐĚŁ¤Ç¤âĄ˘žŚÉʲ˝¤Î˛ÄÇ˝Ŕ­¤ňŔŠ¸Â¤ť¤şľÚ¤ÓĄ˘ĆĂÄę¤ÎĚÜĹŞ¤ËĹŹšç
+ ¤š¤ë¤Ť¤É¤Ś¤Ť¤ÎĘÝžÚ¤ňĘü´ţ¤ˇ¤ĆĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň ``¤˘¤ë¤Ź¤Ţ¤Ţ'' ¤ÎˇÁ
+ ¤ÇĂřşîźÔ¤ŹśĄľë¤ˇ¤Ţ¤šĄŁÄžŔÜĹŞĄ˘´ÖŔÜĹŞĄ˘¸Î°ŐĄ˘ĆĂĘĚĄ˘ĚĎČĎĹŞĄ˘ÉŹÁłĹŞÂťł˛
+ ĄĘŔŠ¸Â¤Î¤Ę¤¤ÂĺÂŘĘŞ¤äĽľĄźĽÓĽšĄ˘˛ÄÍŃŔ­¤ÎÄ㲟¤äĽÇĄźĽż¤äÍřą×¤ÎÂťźş¤Ţ¤ż¤ĎąÄ
+ śČ˸ł˛¤ň´Ţ¤ŕĄË¤ŹŔ¸¤¸¤Ć¤âĄ˘¤˝¤Îž¤ÎŔŐǤľÚ¤ÓÇĄ˛ż¤Ę¤ëˇŔĚó¤ÎźÂšÔĄ˘´°Á´¤ĘşÄ
+ Ěł¤äÉÔŔľšÔ°ŮĄĘÉÔĂí°Ő¤Ë¤č¤ëťö¸ÎĹů¤ň´Ţ¤ŕĄËĄ˘˛ž¤ËÂťł˛¤Î˛ÄÇ˝Ŕ­¤Ź¤˘¤Ă¤Ć
+ ¤â``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎťČÍѡë˛Ě¤Ë¤Ä¤¤¤ĆĄ˘ĂřşîźÔ¤Ë¤ĎŔŐǤ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 2.2.2. UCB/LBL
+
+ Copyright (c) 1993 The Regents of the University of California. All
+ rights reserved.
+
+ ¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤Ď DARPA ˇŔĚóČÖšć BG 91-66 ¤Ë´đ¤Ĺ¤­ Lawrence Berkeley
+ Laboratory ¤Î Computer Systems Engineering Ľ°ĽëĄźĽ×¤ŹłŤČŻ¤ˇ Berkeley
+ ¤Ë´óÉŐ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ ĆĂħ¤ň˝Ň¤Ů¤Ć¤¤¤ëÁ´¤Ć¤ÎŔëĹÁşŕÎÁ¤Č¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤ňťČ¤Ś¤ČÉŹ¤şźĄ¤ÎźŐ°Ő¤Î
+ ĽáĽĂĽťĄźĽ¸¤ňÉ˝ź¨¤ˇ¤Ţ¤šĄŁ This product includes software developed by
+ the University of California, Lawrence Berkeley Laboratory.
+
+ ĘŃšš¤ÎÍ­Ěľ¤Ë¤Ť¤Ť¤ď¤é¤şşĆÇŰÉۤȼ˝ĄźĽš¤ČĽĐĽ¤ĽĘĽęˇÁź°¤ÎÍřÍѤňźĄ¤Îžňˇď¤Ë
+ ˝ž¤Ă¤Ćǧ¤á¤ë:
+
+ 1. Ľ˝ĄźĽšĽ×ĽíĽ°ĽéĽŕ¤ÎşĆÇŰÉۤϞ徭¤ÎĂřşî¸˘É˝ź¨¤Č¤ł¤Îžňˇď°ěÍ÷¤ČźĄ¤ÎĘü´ţ
+ Ŕë¸Ŕ¤ňÉŹ¤şĘÝťý¤š¤ë¤ł¤ČĄŁ
+
+ 2. ĽĐĽ¤ĽĘĽęˇÁź°¤ÎşĆÇŰÉۤϞ徭¤ÎĂřşî¸˘É˝ź¨¤Č¤ł¤Îžňˇď°ěÍ÷¤ČźĄ¤ÎĘü´ţŔë¸Ŕ
+ ¤ňÉŹ¤şĘ¸˝ń¤Č¤ˇ¤ĆĘÝťý¤š¤ë¤ŤËô¤ĎÇŰÉŰĘŞ¤Ë´Ţ¤á¤ĆÄ󜥤š¤ë¤ł¤ČĄŁ
+
+ 3. ĆĂħ¤ň˝Ň¤Ů¤Ć¤¤¤ëÁ´¤Ć¤ÎŔëĹÁşŕÎÁ¤Č¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤ňťČ¤Ś¤ČÉŹ¤şźĄ¤ÎźŐ
+ °Ő¤ÎĽáĽĂĽťĄźĽ¸¤ňÉ˝ź¨¤ˇ¤Ţ¤šĄŁ This product includes software
+ developed by the University of California, Berkeley and its
+ contributors.
+
+ 4. ÂçłŘ¤ÎĚžÁ°¤ä´óÉŐźÔ¤ÎĚžÁ°¤Î¤É¤Á¤é¤â¤ł¤ÎĽ˝ĽŐĽČĽŚĽ§Ľ˘¤Ť¤éĚŔłÎ¤Ę°ĘÁ°¤Ë
+ ČŻšÔ¤ˇ¤żľö˛Ä˝ńĚľ¤ˇ¤ËÇÉŔ¸¤ˇ¤ż¤â¤Î¤ň΢˝ń¤­¤ˇ¤ż¤ęÂĽżĘ¤š¤ë¤â¤Î¤Ç¤Ď¤˘¤ę
+ ¤Ţ¤ť¤óĄŁ
+
+ ÇĄ˛ż¤Ę¤ëˇÁÍĆĄ˘°ŐĚŁ¤Ç¤âĄ˘žŚÉʲ˝¤Î˛ÄÇ˝Ŕ­¤ňŔŠ¸Â¤ť¤şľÚ¤ÓĄ˘ĆĂÄę¤ÎĚÜĹŞ¤ËĹŹšç
+ ¤š¤ë¤Ť¤É¤Ś¤Ť¤ÎĘÝžÚ¤ňĘü´ţ¤ˇ¤ĆĄ˘``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ň ``¤˘¤ë¤Ź¤Ţ¤Ţ'' ¤ÎˇÁ
+ ¤ÇĂřşîźÔ¤ŹśĄľë¤ˇ¤Ţ¤šĄŁÄžŔÜĹŞĄ˘´ÖŔÜĹŞĄ˘¸Î°ŐĄ˘ĆĂĘĚĄ˘ĚĎČĎĹŞĄ˘ÉŹÁłĹŞÂťł˛
+ ĄĘŔŠ¸Â¤Î¤Ę¤¤ÂĺÂŘĘŞ¤äĽľĄźĽÓĽšĄ˘˛ÄÍŃŔ­¤ÎÄ㲟¤äĽÇĄźĽż¤äÍřą×¤ÎÂťźş¤Ţ¤ż¤ĎąÄ
+ śČ˸ł˛¤ň´Ţ¤ŕĄË¤ŹŔ¸¤¸¤Ć¤âĄ˘¤˝¤Îž¤ÎŔŐǤľÚ¤ÓÇĄ˛ż¤Ę¤ëˇŔĚó¤ÎźÂšÔĄ˘´°Á´¤ĘşÄ
+ Ěł¤äÉÔŔľšÔ°ŮĄĘÉÔĂí°Ő¤Ë¤č¤ëťö¸ÎĹů¤ň´Ţ¤ŕĄËĄ˘˛ž¤ËÂťł˛¤Î˛ÄÇ˝Ŕ­¤Ź¤˘¤Ă¤Ć
+ ¤â``¤˝¤Ő¤Č¤Ś¤§¤˘'' ¤ÎťČÍѡë˛Ě¤Ë¤Ä¤¤¤ĆĄ˘ĂřşîźÔ¤Ë¤ĎŔŐǤ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 2.3. NVidia Corp
+
+ 2.4. NVidia źŇ
+
+ Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+ ťČÍџԤؤÎĂí°Ő: Ľ˝ĄźĽšĽ×ĽíĽ°ĽéĽŕ¤ĎĽ˘ĽáĽęĽŤ¤Î˥Χ¤ČšńşÝËĄ¤ÇĂřşî¸˘¤ŹĘݸî
+ ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁCalifornia ˝ŁĄ˘Sunnyvale ¤Ë¤˘¤ë NVIDIA źŇ¤ŹĂřşî¸˘¤ňĘÝÍ­
+ ¤ˇ¤Ć¤¤¤Ć NV ĽÁĽĂĽ×¤ÎŔߡפȼ¤ĽóĽżĽŐĽ§ĄźĽš¤ÎŔߡ×ĆĂľö¤ňĘÝÍ­¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł
+ ¤ÎĽ˝ĄźĽšĽ×ĽíĽ°ĽéĽŕ¤ÎťČÍџԤȽęÍ­źÔ¤Ď¤˝¤Î¤Ţ¤Ţ¤Ç¤ĎźÂšÔ¤Ç¤­¤Ę¤ŻĄ˘¸ÄżÍÍѤČ
+ žŚÍŃĽ˝ĽŐĽČĽŚĽ§Ľ˘¤Ç¤ĎťČÍŃÎÁ¤Î¤¤¤é¤Ę¤¤Ăřşî¸˘¤ČĆĂľö¸˘¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ ¤ł¤ÎĽ˝ĄźĽšĽ×ĽíĽ°ĽéĽŕ¤ňÇĄ˛ż¤Ę¤ëˇÁÂ֤ǝȤŚ¤Č¤ˇ¤Ć¤âĽćĄźĽśÍŃʸ˝ń¤ČĽ×ĽíĽ°Ľé
+ ĽŕĆâÉô¤ÎĽłĽáĽóĽČ¤ČĽ¨ĽóĽÉĽćĄźĽśÍŃʸ˝ń¤ËźĄ¤Îʸ¤Ź´Ţ¤Ţ¤ě¤Ć¤¤¤ëÉŹÍפŹ¤˘¤ę¤Ţ
+ ¤šĄŁ
+
+ Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the
+ U.S. and foreign countries.
+
+ NVIDIA źŇ ¤ĎÇĄ˛ż¤Ę¤ëĚÜĹŞ¤ËĹŹšç¤š¤ë¤Ť¤Ë¤Ä¤¤¤ĆŔŐǤ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁÇĄ˛ż¤Ę¤ë
+ ˇÁÍƤä°ŐĚŁ¤Ç¤âĘݞڤʤˇ¤Ë ``¤˘¤ë¤Ź¤Ţ¤Ţ'' śĄľë¤ˇ¤Ţ¤šĄŁNVIDIA źŇ ¤ĎÁ´¤Ć¤Î
+ žŚÉʲ˝¤Î˛ÄÇ˝Ŕ­ľÚ¤ÓĄ˘ĆĂÄę¤ÎĚÜĹŞ¤ËĹŹšç¤š¤ë¤Ť¤É¤Ś¤Ť¤ÎĘÝžÚ¤ňĘü´ţ¤ˇ¤Ţ
+ ¤šĄŁNVIDIA źŇ ¤ĎĆĂĘĚĄ˘´ÖŔÜĹŞĄ˘śöČŻĹŞĄ˘ÉŹÁłĹŞÂťł˛Ą˘¤ż¤Č¤¨¤É¤Î¤č¤Ś¤Ę˛ÄÍŃ
+ Ŕ­¤ÎÄ㲟¤äĽÇĄźĽż¤äÍřą×¤ÎÂťźş¤Ź¤˘¤Ă¤Ć¤âĄ˘¤Ţ¤żąÄśČłčĆ°¤äÉÔĂí°Ő¤Ë¤č¤ëťö¸Î
+ ¤Ţ¤ż¤ĎÉÔŔľšÔ°ŮĄ˘¤ł¤ÎĽ˝ĄźĽšĽ×ĽíĽ°ĽéĽŕ¤ÎÍřÍѤäŔ­Ç˝¤Ë¤Ä¤¤¤ĆÄžŔܴء¸¤˘¤Ă¤Ć
+ ¤â¤Ę¤Ż¤Ć¤âŔ¸¤¸¤żťöžÝ¤Ë¤Ä¤¤¤ĆŔŐǤ¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/CPYRIGHT.sgml,v 3.6
+ 1996/10/10 14:03:59 dawes Exp
+
+ $XConsortium: CPYRIGHT.sgml /main/3 1995/11/12 19:59:19 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/CPYRIGHT.sgml,v
+ 3.6 1 996/10/10 14:03:59 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Copyright (C) 1995, Kazuyuki (ikko-) Okamoto. All Rights Reserved.
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/CPYRIGHT.sgml,v
+ 3.7 1995/11/9 15:37:30 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/INSTALL b/xc/programs/Xserver/hw/xfree86/doc/Japanese/INSTALL
new file mode 100644
index 000000000..c86d0046f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/INSTALL
@@ -0,0 +1,263 @@
+ XFree86 3.2 Ľ¤ĽóĽšĽČĄźĽëĽŹĽ¤ĽÉ
+ David Dawes Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 24 Ćü
+
+ ¤ł¤Îʸ˝ń¤Ç¤ĎĽ˝ĄźĽšÇŰÉŰĘŞ¤Ť¤é¤É¤Î¤č¤Ś¤Ë XFree86 ¤ňš˝Ăۤš¤ë¤Ť¤ňŔâĚŔ¤ˇ¤Ć
+ ¤¤¤Ţ¤šĄŁÇŰÉŰĘŞ¤ÎÁ´¤Ć¤ÎĽ˝ĄźĽš¤Ť¤éš˝Ăۤš¤ëžěšç¤ČĆąÍͤ˥˘X ĽľĄźĽĐĄź¤Ŕ¤ą¤ň
+ š˝Ăۤš¤ë¤ż¤á¤ÎŔÚ¤ęľÍ¤á¤żĽ˝ĄźĽš¤Ť¤éš˝Ăۤš¤ëžěšç¤âŔâĚŔ¤ˇ¤Ć¤¤¤Ţ¤šĄŁłĆĄš¤Î
+ OS ¤Ë°Í¸¤ˇ¤ż README ĽŐĽĄĽ¤Ľë¤Č´ŘϢ¤ľ¤ť¤ĆťČÍѤš¤ë¤č¤Ś¤Ëš˝Áۤˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ¤ł¤Îʸ˝ń¤Ç¤Ď ĆłĆţĘýËĄ¤äĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ÎššżˇĘýËĄ¤Ë¤Ä¤¤¤Ć¤ĎŔâĚŔ¤ˇ¤Ć
+ ¤¤¤Ţ¤ť¤óĄŁ¤ł¤ě¤é¤ÎžđĘó¤Ď RELNOTES, łĆĄš¤Î OS ¤Ë°Í¸¤ˇ¤ż README ĽŐĽĄ
+ Ľ¤ĽëËô¤Ďż§Ąš¤ĘĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ËĹşÉŐ¤ˇ¤Ć¤˘¤ëĘĚʸ˝ń¤Ëľ­şÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. Ľ˝ĄźĽšÇŰÉŰĘŞ¤Ť¤é¤Î XFree86 ¤ÎşîŔŽ
+
+ 2. Ľ˝ĄźĽšÇŰÉŐĘŞ¤Ť¤é¤ÎĽľĄźĽĐĄź¤ÎşĆš˝ĂŰ
+
+ 3. ĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤Ť¤é¤ÎĽľĄźĽĐĄź¤ÎşĆš˝ĂŰ
+ ______________________________________________________________________
+
+ 1. Ľ˝ĄźĽšÇŰÉŰĘŞ¤Ť¤é¤Î XFree86 ¤ÎşîŔŽ
+
+ Ăí°Ő: XFree86 ¤ňşîŔŽ¤ˇ¤č¤Ś¤Č¤š¤ëÁ°¤ËĆĂÄę¤Î OS ¸ÇÍ­¤Î README
+ ĽŐĽĄĽ¤Ľë¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤é¤ÎĽŐĽĄĽ¤Ľë¤Ë¤Ď¸ÄĄš¤Î OS ¤Î´Äś­¤Î
+ ˛ź¤Ç¤Ś¤Ţ¤Ż XFree86 ¤ňşîŔŽ¤š¤ë¤Î¤ËÉŹÍפĘÄɲÞđĘ󤏴ޤޤě¤Ć¤¤¤Ţ
+ ¤šĄŁ
+
+ GCC-2 ¤ňťČ¤Ă¤Ć XFree86 ¤ňşîŔŽ¤š¤ëťö¤ňśŻ¤Ż¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁĽĐĄźĽ¸ĽçĽó
+ 2.6.0 Ëô¤Ď 2.4.x Ĺů 2.4.5 °ĘÁ°¤ÎĘŞ¤ĎĽĐĽ°¤Î¤ż¤áşîŔŽ¤äźÂšÔ¤ŹźşÇÔ¤š¤ë¤Î¤Ç
+ ťČÍѤˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤ĄŁ GCC ¤Î -m486 ĽŞĽ×ĽˇĽçĽó¤ňťČ¤¨¤ĐĄ˘486 ¤ÇĚó Łľ% Ŕ­
+ Ç˝¤ň¸ţžĺ¤ľ¤ť¤ë¤ł¤Č¤Ź¤Ç¤­¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤č¤ęÂ礭¤ĘĽĐĽ¤ĽĘĽę¤ĎĘ̤Ȥˇ¤ĆĄ˘386
+ ¤Ç¤âŔ­Ç˝¤Ď°­¤Ż¤Ď¤Ę¤ę¤Ţ¤ť¤óĄŁĄĘ gcc-2 ¤Ď prep.ai.mit.edu ¤Čž¤Î GNU Ľ˝
+ ĄźĽš¤ňĂÖ¤¤¤Ć¤¤¤ëĽľĽ¤ĽČ¤Ë¤˘¤ę¤Ţ¤šĄŁĄË
+
+ 1. źĄ¤ÎĘŞ¤ŹÉŹÍפǤš:
+
+ o fix 01 ¤ÎĽŃĽĂĽÁ¤ňĹö¤Ć¤ż X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ X11R6.1 ¤ÎÇŰÉŐĘŞĄŁ
+
+ o R6.1pl1-3.2.diff.gz, cfont32.tgz
+
+ o ÄɲäȤˇ¤Ć X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î X11R6.1 ´óÂŁ ÇŰÉŰĘŞĄŁ
+
+ o contrib-3.2.diff.gz (¤¤¤Ż¤Ä¤Ť¤Î X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î ``´óÂŁ'' ÇŰÉŐĘŞ
+ ¤Ř¤ÎÄɲüѼüÁ)
+
+ o XFree86 X ĽľĄźĽĐĄź¤Ŕ¤ą¤ňš˝Ăۤˇ¤ż¤¤žěšç¤ĎĄ˘X32servonly.tgz ¤Ŕ¤ą¤ŹÉŹ
+ Íפǥ˘¤ł¤ě¤Ď ``ServersOnly'' ¤Č¤¤¤ŚĽ˝ĄźĽšÇŰÉŰĘŞ¤ňŔÚ¤ęľÍ¤á¤ż¤â¤Î¤ČĆą
+ ¤¸¤â¤Î¤Ç¤šĄŁ
+
+ o Á´¤Ć¤Î XFree86 Ľ˝ĄźĽš¤Ť¤éşîŔŽ¤š¤ë¤ČĚó130MB ¤Îśő¤­ĽÇĽŁĽšĽŻÍĆÎ̤ŹÉŹÍ×
+ ¤Ç¤šĄŁÁ´ÉôşîŔŽ¤š¤ë¤Ë¤ĎĄĘ OS ¤ÎśŚÍѼ鼤ĽÖĽéĽę¤ňťČÍѤˇ¤Ę¤¤ťţĄË130MB
+ ÄɲĂÍĆÎ̤ŹÉŹÍפǤšĄŁÁ´¤Ć¤ÎÇŰÉŐĘŞ¤ňĆłĆţ¤š¤ë¤Ë¤ĎĄĘśŚÍѼ鼤ĽÖĽéĽę¤ňťČ
+ ÍѤˇ¤żžěšçĄËĚó 55 ¤Ť¤é 65MB¤Îśő¤­ĽÇĽŁĽšĽŻÍĆÎ̤ŹÉŹÍפǤšĄŁşîŔŽşîśČ¤Ë
+ ˝ĹÍפǤʤ¤ÉôĘŹ¤ňşď˝ü¤š¤ë¤ł¤Č¤ÇĄ˘¤˝¤ě¤ž¤ěźĄ¤ÎĽÇĽŁĽšĽŻÍĆÎ̤ňşď¸ş˝ĐÍč
+ ¤Ţ¤šĄŁ:
+
+ xc/test 16MB
+ xc/doc/hardcopy 11MB
+ xc/doc/specs 27MB
+
+ ĽŐĽŠĽóĽČ¤ňşîŔŽ¤š¤ëÉŹÍפŹ¤Ę¤¤ťţ¤ĎĄ˘xc/fonts ¤ňşď˝ü¤š¤ë¤ł¤Č¤Ç 30MB Ŕá
+ Ěó¤Ç¤­¤Ţ¤šĄŁPEX Ëô¤Ď XIE ¤ňşîŔŽ¤ˇ¤ż¤Ż¤Ę¤¤ťţ¤ĎĄ˘¤˝¤ě¤é¤ňşď˝ü¤š¤ë¤ł¤Č
+ ¤ÇĄ˘¤˝¤ě¤ž¤ěźĄ¤ÎĽÇĽŁĽšĽŻÍĆÎ̤ňşď¸ş˝ĐÍč¤Ţ¤šĄŁ:
+
+ xc/programs/Xserver/XIE 3MB
+ xc/programs/Xserver/PEX5 2MB
+
+ xc/programs/Xserver/hw/¤Î˛ź¤Î XFree86 °Ęł°¤ÎĽÇĽŁĽěĽŻĽČĽę¤ňşď˝ü¤š¤ě
+ ¤ĐĄ˘¤â¤Śżô MB łŤĘü˝ĐÍč¤Ţ¤šĄŁ
+
+ o XFree86 ĽľĄźĽĐĄź¤ÎşîŔŽ¤Ë¸Â¤Ă¤żžěšçĄ˘ŔÚ¤ęľÍ¤á¤żĽ˝ĄźĽšĽÄĽęĄź¤ňš˝ŔŽ¤š
+ ¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ¤ł¤ÎĽ˝ĄźĽšĽÄĽęĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď 50 ¤Ť¤é 55MB ¤Î
+ ĽÇĽŁĽšĽŻ¤Ëśő¤­¤ŹÉŹÍפǤšĄŁ
+
+ o contrib-3.2.diff.gz ¤ÎĽŃĽĂĽÁĽŐĽĄĽ¤Ľë¤Ď X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î R6.1 ´óÂŁ
+ ÇŰÉŐĘŞ¤Î¤´¤Ż°ěÉô¤Ř¤ÎĽŃĽĂĽÁ¤ňÄ󜥤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽŃĽĂĽÁĽŐĽĄĽ¤Ľë¤ňĹŹÍѤš
+ ¤ë¤ČĄ˘źĄ¤Î X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î´óÂŁČǤκǿˇČǤμռĄĽ¤Ľë/ĽÇĽŁĽěĽŻĽČĽę
+ ¤ŹÉŹÍפˤʤę¤Ţ¤šĄŁ:
+
+ contrib/Imakefile
+ contrib/programs/Imakefile
+ contrib/programs/ico
+ contrib/programs/listres
+ contrib/programs/showfont
+ contrib/programs/viewres
+ contrib/programs/xbiff
+ contrib/programs/xcalc
+ contrib/programs/xditview
+ contrib/programs/xedit
+ contrib/programs/xev
+ contrib/programs/xeyes
+ contrib/programs/xfontsel
+ contrib/programs/xgc
+ contrib/programs/xload
+ contrib/programs/xman
+ contrib/programs/xmessage
+
+ 2. ɸ˝ŕĹŞ¤Ę X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ R6.1 ¤ÎĽŃĽĂĽÁĽěĽŮĽë 1 ¤ÎĽ˝ĄźĽšÇŰÉŐĘŞ¤Ť¤é
+ ťĎ¤á¤ëžěšç¤ĎĄ˘ xc ĽÇĽŁĽěĽŻĽČĽę¤Ë°ÜĆ°¤ˇ¤ĆźĄ¤ÎĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁ:
+
+ gzip -d < R6.1pl1-3.2.diff.gz | patch -p -E
+ gzip -d < cfont32.tgz | tar vxf -
+
+ ĘŃšš¤ˇ¤Ć¤¤¤Ę¤¤Ľ˝ĄźĽš¤Ť¤éĽ¤ĽóĽšĽČĄźĽë¤š¤ëžěšç¤ĎĄ˘ĚäÂę¤Ď˛ż¤â¤Ę¤¤¤Ç
+ ¤ˇ¤ç¤ŚĄŁĽŃĽĂĽÁ¤Î¸ĺ¤ËĽŃĽĂĽÁ¤ŹľŃ˛ź¤ľ¤ě¤żˇë˛ĚĄĘ rejection ĄË¤ČĽŃĽĂĽÁ¤Î
+ ĘŹŔϡë˛ĚĄĘresolve ĄË¤ňÄ´¤Ů¤Ţ¤ˇ¤ç¤ŚĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽŐĽĄĽ¤Ľë (Î㤨¤Đ
+ xf86site.def ¤ä site.def) ¤ňĘŃšš¤ˇ¤żžěšç¤ĎĄ˘¤˝¤ě¤é¤ÎĽŐĽĄĽ¤ĽëĚž¤ňĘŃ
+ ¤¨¤ĆĄ˘ĽŃĽĂĽÁ¤š¤ëÁ°¤ÎÄ󜥤ˇ¤żžőÂÖ¤ËĚᤡ¤Ţ¤ˇ¤ç¤ŚĄŁ ¸ľ¤ÎĽĐĽĂĽŻĽ˘ĽĂĽ×¤ň
+ ťý¤Ă¤Ć¤¤¤Ę¤¤žěšç¤ĎĄ˘¸ÄĄš¤ÎĽŐĽĄĽ¤Ľë¤Ď ftp://ftp.x.org/pub/R6.1/xc ¤Ť
+ ¤éÍưפ˟ę¤ËĆţ¤ě¤é¤ě¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ¤â¤ˇ°ĘÁ°¤ËťČÍѤˇ¤Ć¤¤¤żĽ˝ĄźĽš¤ËĽŃĽĂĽÁ¤ňĹö¤Ć¤ëžěšç¤ĎĄ˘şšĘŹĽŐĽĄĽ¤Ľë¤ň
+ ĹŹÍѤš¤ëÁ°¤Ë xc ĽÇĽŁĽěĽŻĽČĽę¤Ť¤é ``make clean'' ¤ňËş¤ě¤ş¤ËźÂšÔ¤ˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ´óÂŁÉôĘŹ¤ËĽŃĽĂĽÁ¤š¤ë¤Ę¤é¤ĐĄ˘ contrib ĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤ĆĄ˘źĄ¤ÎÁŕ
+ şî¤ňźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤Ś:
+
+ gzip -d < contrib-3.2.diff.gz | patch -p -E
+
+ 3. config/cf/xf86site.def¤ňÄĚĆɤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ źŤĘŹ¤Îš˝ŔŽ¤Ëšç¤ď¤ť¤ĆÍÍ
+ Ąš¤ĘĽŃĽéĽáĄźĽż¤ňŔßÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ ˝é¤á¤Ć¤ÎşîŔŽ¤Îžěšç¤ĎĄ˘
+ BuildFonts¤ň YES ¤ËŔßÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ĽľĄźĽĐĄź¤Ŕ¤ą¤ňşîŔŽ¤š¤ë¤ż¤á¤ËŔÚ¤ęľÍ¤á¤żĽ˝ĄźĽšĽÄĽęĄź¤ňťČ¤Ś¤Č¤­¤Ď
+ BuildServersOnly ¤ň YES ¤ËŔßÄꤡĄ˘XnestServer ¤ň NO ¤ËŔßÄꤡ¤Ţ¤ˇ¤ç
+ ¤ŚĄŁ
+
+ şîŔŽ¤ˇ¤ż¤¤ĽľĄźĽĐĄź¤ňťŘÄꤚ¤ë¤Ë¤ĎĄ˘źĄ¤ÎÄęľÁ¤ňŔßÄꤡ¤Ţ¤ˇ¤ç¤Ś:
+
+ Colour SVGA server (XF86_SVGA): XF86SVGAServer
+ 16 colour (S)VGA server (XF86_VGA16): XF86VGA16Server
+ ET4000/W32 accelerated server (XF86_W32): XF86W32Server
+ Monochrome server (XF86_Mono): XF86MonoServer
+ S3 accelerated server (XF86_S3): XF86S3Server
+ S3 ViRGE accelerated server (XF86_S3V): XF86S3VServer
+ 8514/A accelerated server (XF86_8514): XF86I8514Server
+ Mach8 accelerated server (XF86_Mach8): XF86Mach8Server
+ Mach32 accelerated server (XF86_Mach32): XF86Mach32Server
+ Mach64 accelerated server (XF86_Mach64): XF86Mach64Server
+ P9000 accelerated server (XF86_P9000): XF86P9000Server
+ AGX accelerated server (XF86_AGX): XF86AGXServer
+ I128 server (XF86_I128): XF86I128Server
+
+ ÁĐĆŹ¤Î Mono+VGA2 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď, XF86MonoDualServer ¤ň
+ YES¤Ë¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ÁĐĆŹ¤Î Mono+VGA16 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď, XF86VGA16DualServer ¤ň
+ YES¤Ë¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ X ¤ËĽęĽóĽŻ¤ňÄĽ¤ę¤ż¤¤ĽľĄźĽĐĄź¤ň ServerToInstall ¤ËŔßÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ¤ł
+ ¤ě¤ŹťŘÄꤾ¤ě¤Ę¤¤¤Čžĺľ­Ą˘ĽľĄźĽĐĄź¤Î°ěÍ÷¤ÎşÇ˝é¤ÎĘŞ¤Ź˝é´üĂͤˤʤäƺî
+ ŔŽ¤ľ¤ě¤Ţ¤šĄŁ
+
+ ĽľĄźĽĐĄź¤Ë´Ţ¤á¤ż¤¤ĽÉĽéĽ¤ĽĐĄź¤â xf86site.def¤ÎĂć¤ÇÁŞÂň¤ˇ¤Ţ¤šĄŁSVGA
+ ĽľĄźĽĐĄźÂĐąţ¤ÎĽÉĽéĽ¤ĽĐĄź¤Ď XF86SvgaDrivers ĽŃĽéĽáĽż¤ÇťŘÄꤡ¤Ţ¤šĄŁ¤ł
+ ¤ě¤ĎĽÉĽéĽ¤ĽĐĽÇĽŁĽěĽŻĽČĽę¤Î°ěÍ÷É˝ˇÁź°¤ÇĄ˘žŽĘ¸ťú¤Ç˝ń¤­¤Ţ¤šĄŁĽŃĽéĽáĽż
+ ¤ÎťŘÄę˝ç˝ř¤ÇľŻĆ°ťţ¤ËĂľşş¤ňšÔ¤¤¤Ţ¤šĄŁÁ´¤Ć¤ÎÄ󜥤ľ¤ě¤Ć¤ëĽÉĽéĽ¤ĽĐ¤Ď˝é
+ ´üĂͤÇŔßÄꤾ¤ě¤Ţ¤šĄŁ¤˘¤Č¤ËÂł¤ŻĄ˘ĽŃĽéĽáĽż¤ŹťŘÄꤚ¤ëĽÉĽéĽ¤ĽĐ¤âĆąÍͤÇ
+ ¤š:
+
+ XF86Vga16Drivers XF86_VGA16
+ XF86Vga2Drivers XF86_Mono (vga2 drivers)
+ XF86MonoDrivers XF86_Mono, XF86_VGA16 (other mono drivers)
+
+ SVGA, VGA16 ¤Č VGA2 ˛čĚ̤Ϥ˝¤ě¤ž¤ěĄ˘ČĆÍŃ(``generic'')ĽÉĽéĽ¤ĽĐĄź¤Ë´Ţ
+ ¤Ţ¤ěĄ˘¤ł¤ě¤é¤Ď¤É¤ó¤Ę VGA ĽŤĄźĽÉ¤Ç¤âĂľşş¤ËŔŽ¸ů¤š¤ë¤Î¤ÇĄ˘žď¤Ë°ěÍ÷¤ÎşÇ
+ ¸ĺ¤ËĂÖ¤Ż¤č¤Ś¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ 4. ĄĘ¸˝şß LinuxDoc/SGML ¤Î˛ź¤Ë¤˘¤ë˝ńź°¤ËĄËXFree86 ¤ÎĽÉĽ­ĽĺĽáĽóĽČ¤ňŔ°ˇÁ
+ ¤ˇ¤ż¤¤žěšçĄ˘ ftp://ftp.xfree86.org/pub/XFree86/3.2/Linuxdoc ¤Ë¤˘¤ë
+ linuxdoc-sgml-1.2.tar.gz ¤ČĽŃĽĂĽÁ ¤ňźę¤ËĆţ¤ě¤ĆÁȤߚţ¤ó¤Ç˛ź¤ľ¤¤ĄŁ
+ xf86site.def ĽŐĽĄĽ¤Ľë¤ňłÎǧ¤ˇ¤Ć ĹŹŔÚ¤Ë Linuxdoc ¤ÎĽŞĽ×ĽˇĽçĽó¤ňĘÔ˝¸
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 5. ÇŰÉŐĘŞ¤Ť¤éŔ¸ŔŽ¤š¤ëÁ°¤ËĄ˘ xc/programs/Xserver/hw/xfree86/doc ¤Ë¤˘¤ë
+ ´Äś­¤Ë´ŘϢ¤ˇ¤ż OS ¸ÇÍ­¤Î README ĽŐĽĄĽ¤Ľë¤ňÎɤŻĆɤळ¤Č¤ŹÂçŔڤǤšĄŁ
+ ¤ł¤ě¤Ţ¤Ç¤âĄ˘¤ł¤ě¤é¤Î OS ¸ÇÍ­¤ÎžÜşŮĽŢĽËĽĺĽ˘Ľë¤ÎźęĆţ¤ě¤ň¤ˇ¤Ć¤­¤Ţ¤ˇ
+ ¤żĄŁ xc ĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤ĆĄ˘¤˝¤ˇ¤Ć OS ¸ÇÍ­¤Î README ĽŐĽĄĽ¤Ľë¤Ë
+ ľ­˝Ň¤ˇ¤Ć¤˘¤ë¤č¤Ś¤ËŔßÄꤡ¤ż BOOTSTRAPCFLAGS ¤ňÉŐ¤ą¤Ć ``make World''
+ ¤ňźÂšÔ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁš˝Ăۤš¤ë´Ö¤ËČŻŔ¸¤š¤ë¤Ť¤â¤ˇ¤ě¤Ę¤¤ĚäÂę¤ňÄɤ¤¤Ť¤ą¤ë
+ ¤ł¤Č¤Ź˝ĐÍč¤ë¤č¤Ś¤ËĄ˘¤ł¤Î˝čÍý¤Îɸ˝ŕ˝ĐÎϤČɸ˝ŕĽ¨ĽéĄź˝ĐÎϤňĽęĽŔĽ¤ĽěĽŻ
+ ĽČ¤ˇ¤Ć World.Log ¤Ëźč¤Ă¤Ć¤Ş¤Ż¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁŔÚ¤ęľÍ¤á¤żĽ˝ĄźĽšÇŰ
+ ÉŰĘŞ¤Î¤É¤ě¤Ť¤ňťČ¤Śžěšç¤Ë¤ĎĄ˘ÄĚžďşÇžĺ°Ě¤Î Makefile ¤ňťČÍѤˇ¤Ę¤¤¤Ç
+ ``make -f Makefile.ini World'' ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6. Á´¤Ć˝çÄ´¤ËšÔ¤ď¤ě¤żžěšç¤ËĄ˘š˝ŔŽ¤Ë°ř¤ę¤Ţ¤š¤ŹĽˇĽšĽĆĽŕŔ¸ŔŽ¤Ď 2 ťţ´Ö¤Ť¤é
+ 12 ťţ´Ö°ĚłÝ¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁĽĐĽ¤ĽĘĽę¤ÎÁȤߚţ¤ß¤Ë˛ż¤ŤĚäÂꤏ̾¤Ť¤Ă¤ż¤Ť
+ World.Log ¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ Á´Ľ˝ĄźĽšÇŰÉŰĘŞ¤ňťČÍѤš¤ë¤Č¤­¤ĎĄ˘ xc
+ ĽÇĽŁĽěĽŻĽČĽę¤Ť¤éÁȤߚţ¤ß¤ňšÔ¤¤¤Ţ¤šĄŁ ServersOnly ÇŰÉŰĘŞ¤ňťČÍѤš¤ë
+ ¤Č¤­¤ĎĄ˘ xc/programs/Xserver ĽÇĽŁĽěĽŻĽČĽę¤Ť¤éÁȤߚţ¤ß¤ňšÔ¤¤¤Ţ¤šĄŁ
+ ÁȤߚţ¤ŕ¤Ë¤ĎĄ˘ ``make install'' ¤Č ``make install.man''¤ňźÂšÔ¤ˇ¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ Ľ¤ĽóĽšĽČĄźĽë˝ĐÍč¤ë¤Ŕ¤ą¤Î˝˝ĘŹ¤Ęśő¤­ĽÇĽŁĽšĽŻÍĆÎ̤ŹĄ˘
+ /usr/X11R6 ¤Ë¤˘¤ë¤ł¤Č¤ňłÎǧ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ /usr°Ęł°¤Îžě˝ę¤ËÁȤߚţ¤ß¤ż
+ ¤¤žěšç¤ĎĄ˘ÁȤߚţ¤ŕÁ°¤Ë /usr/ X11R6 ¤ËĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ňÄĽ¤ę¤Ţ¤ˇ¤ç
+ ¤ŚĄŁ
+
+ ( /usr/X11R6/lib/Server ¤Ë¤˘¤ë)ĽĐĽ¤ĽĘĽęĽęĽóĽŻĽ­ĽĂĽČ¤ňÁȤߚţ¤ŕťţ¤ĎĄ˘
+ ĄĘÁ´Ľ˝ĄźĽšÇŰÉŰĘŞËô¤Ď ServersOnly ÇŰÉŰĘŞ¤ňťČÍѤš¤ëžěšçĄËźĄ¤ň xc ĽÇĽŁ
+ ĽěĽŻĽČĽę¤Ť¤éźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ:
+
+ make install.linkkit
+
+ 7. XFree86 ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë´óÂŁČǤμľĽÖĽťĽĂĽČ¤ňşîŔŽ¤š¤ë¤Č¤­¤ĎĄ˘şÇ˝é
+ ¤ËşîŔŽ¤ˇ¤ĆĆłĆţ¤ˇ¤żĽłĽ˘ÇŰÉŐĘŞ¤ňłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ ¤˝¤ˇ¤ĆĄ˘ contrib
+ ĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤ĆĄ˘``xmkmf -a; make''¤ňźÂšÔ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ ¤ł¤ě¤Ź
+ ¤Ś¤Ţ¤Ż¤¤¤Ă¤ż¤éĄ˘ ``make install'' ¤Č ``make install.man'' ¤ňźÂšÔ¤ˇ
+ ¤Ć¤ł¤ě¤ňÁȤߚţ¤ó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. Ľ˝ĄźĽšÇŰÉŐĘŞ¤Ť¤é¤ÎĽľĄźĽĐĄź¤ÎşĆš˝ĂŰ
+
+ ż§Ąš¤ĘĽľĄźĽĐĄźËô¤Ďż§Ąš¤ĘĽÉĽéĽ¤ĽĐĄź¤ÎÁȤߚç¤ď¤ť¤ÎĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ëžě
+ šç:
+
+ 1. żˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐĄźÂĐąţ¤ÎĽ˝ĄźĽš¤ŹŔľ¤ˇ¤¤žě˝ę¤Ë¤˘¤ë¤ł¤Č¤ňłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤
+ ĄĘÎ㤨¤ĐĄ˘SVGA ĽľĄźĽĐĄźÂĐąţĽ˝ĄźĽš¤Ď
+ xc/programs/Xserver/hw/xfree86/vga256/drivers¤Č¸Ŕ¤ŚĽľĽÖĽÇĽŁĽěĽŻĽČĽę
+ ¤Ë¤˘¤ę¤Ţ¤šĄËĄŁ
+
+ 2. ĽľĄźĽĐĄź¤ÎÄęľÁĄĘÎ㤨¤ĐĄ˘žĺľ­¤Ç˝Ň¤Ů¤ż XF86SVGAServer ĄË¤ĎĄ˘
+ xf86site.def ¤ňťČ¤Ă¤ĆşîŔŽ¤ˇ¤ż¤¤ĽľĄźĽĐĄź¤ňťŘÄꤡ¤ĆŔßÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ¤Ţ
+ ¤żĄ˘ĽÉĽéĽ¤ĽĐĄź°ěÍ÷¤ňÉŹÍפ˹ţ¤¸¤ĆĘŃšš¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 3. xc/programs/Xserver ¤Ť¤éźĄ¤ÎĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤Ś:
+
+ make Makefile
+ make Makefiles
+ make depend
+ make
+
+ 3. ĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤Ť¤é¤ÎĽľĄźĽĐĄź¤ÎşĆš˝ĂŰ
+
+ ĽľĄźĽĐĄź¤ÎĽĐĽ¤ĽĘĽęĽęĽóĽŻĽ­ĽĂĽČ¤ňÁȤߚţ¤ŕ¤ČĄ˘ĽľĄźĽĐĄźĆâ¤ÎĽÉĽéĽ¤ĽĐ¤ČĽľĄź
+ ĽĐĄź¤ÎľĄÇ˝łČÄĽ¤ÎşĆš˝ĂۤŹ˛ÄÇ˝¤Ë¤Ę¤ę¤Ţ¤šĄŁşĆš˝ĂۤňÇĄ˛ż¤ËšÔ¤Ś¤Ť¤ÎžÜşŮ¤ĎĄ˘
+ README.LinkKit ĽŐĽĄĽ¤Ľë¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/INSTALL.sgml,v 3.17
+ 1996/10/26 09:38:49 dawes Exp
+
+ $XConsortium: INSTALL.sgml /main/6 1995/11/12 19:59:30 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/INSTALL.sgml,v
+ 3.17 1 996/10/26 09:38:49 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/INSTALL.sgml,v
+ 3.18 1996/11/10 12:18:33 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/Japanese/Imakefile
new file mode 100644
index 000000000..806d11fb8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/Imakefile
@@ -0,0 +1,26 @@
+XCOMM $XConsortium: Imakefile /main/6 1996/02/21 17:41:56 kaleb $
+
+
+
+
+
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Japanese/Imakefile,v 3.9 1999/07/19 13:36:18 dawes Exp $
+#include <Server.tmpl>
+
+#ifdef LinuxArchitecture
+OSREADME = README.Linux
+#endif
+
+MAINDOCS = COPYRIGHT QuickStart.doc README README.Config INSTALL AccelCards \
+ /*VideoModes.doc*/ README.S3 README.Mach64 README.ati \
+ README.cirrus RELNOTES LinkKit VGADriver.doc \
+ README98.1st README98
+
+FILES = $(MAINDOCS) $(OSREADME)
+
+all::
+
+InstallMultipleDest(install,$(FILES),$(XFREE86JAPANESEDOCDIR))
+
+LinkFile(README.Mach64,READ.Mach64)
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/LinkKit b/xc/programs/Xserver/hw/xfree86/doc/Japanese/LinkKit
new file mode 100644
index 000000000..abb0c4da3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/LinkKit
@@ -0,0 +1,169 @@
+ XFree86 3.2 ĽęĽóĽŻĽ­ĽĂĽČ¤Î Readme
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇĂř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 14 Ćü
+
+ 1. XFree86 3.2 ĽęĽóĽŻĽ­ĽĂĽČ¤Î Readme
+
+ 1. gcc-2 ¤ňťČÍѤˇ¤Ę¤¤ĽˇĽšĽĆĽŕ¤ÇĄ˘gcc-2 ¤ÇşîŔŽ¤ľ¤ě¤żĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤ňťČ
+ ÍѤš¤ëžěšç¤Ď libgcc.a ¤ňÁȤߚţ¤ŕÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 2. ĽęĽóĽŻĽ­ĽĂĽČ¤Ç Xnest ¤ňÁȤߚţ¤ŕžěšç¤Ď XFree86 3.2 ¤Î /usr/X11R6 ¤Î
+ ˛ź¤ËÁȤߚţ¤Ţ¤ě¤żĽéĽ¤ĽÖĽéĽę¤ňłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¸˝şßĄ˘ĽęĽóĽŻĽ­ĽĂĽČ¤Ďž
+ ¤ÎĽľĄźĽĐĄź¤Ç¤ĎĆ⢤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 3. ¤É¤ÎĽľĄźĽĐĄź¤ňÁȤߚţ¤ß¤ż¤¤¤Ť¤ČĄ˘¤É¤ÎĽÉĽéĽ¤ĽĐ¤ČľĄÇ˝łČÄĽ¤ň´Ţ¤Ţ¤ť¤ż¤¤
+ ¤Ť¤ňÄęľÁ¤š¤ë¤ż¤á¤Ë xf86site.def ĽŐĽĄĽ¤Ľë¤ňĘÔ˝¸¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o ˝é´üĂͤŹŔľ¤ˇ¤Ż¤Ę¤¤žěšç¤ËĄ˘ťČÍѤš¤ëĽłĽóĽŃĽ¤ĽéĄź¤Ëšç¤ď¤ť¤Ć HasGcc ¤Č
+ HasGcc2 ¤ňŔßÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ź gcc-2.x ¤ÇşîŔŽ¤ľ¤ě¤Ć¤¤¤ĆĄ˘¤˝¤ě¤Č°Ű¤Ę¤ëĽłĽóĽŃĽ¤ĽéĄź¤ň
+ ťČÍѤš¤ëžěšçĄ˘ libgcc.a ¤Č NeedLibGcc ¤ň YES ¤ËŔßÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ
+ ¤šĄŁ
+
+ o 256 ż§ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86SVGAServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o 16 ż§ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86VGA16Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o ÇňšőĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86MonoServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o S3 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86S3Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Mach8 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86Mach8Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Mach32 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86Mach32Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Mach64 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86Mach64Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o P9000 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86P9000Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o AGX ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86AGXServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o ET4000/W32 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86W32Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o IBM 8514/A ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86I8514Server ¤ň YES ¤Ë¤ˇ¤Ţ
+ ¤šĄŁ
+
+ o I128 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86I128Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o TGA ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF86TGAServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o GA-98NB/WAP ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98GANBServer ¤ň YES ¤Ë¤ˇ¤Ţ
+ ¤šĄŁ
+
+ o NEC480 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98NEC480Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o NEC-CIRRUS/EPSON NKV/NKV2 server: XF98NKVNECServer ¤ň YES ¤Ë¤ˇ¤Ţ
+ ¤šĄŁ
+
+ o WAB-S ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98WABSServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o WAB-EP ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98WABEPServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o WSN-A2F ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98WSNAServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Trident Cyber9320/9680 server: XF98TGUIServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o EGC ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98EGCServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o NEC S3 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98NECS3Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o S3 PW/PCSKB ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98PWSKBServer ¤ň YES ¤Ë¤ˇ¤Ţ
+ ¤šĄŁ
+
+ o S3 PW/LB ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98PWLBServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o S3 GA-968 ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XF98GA968Server ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Xnest ĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë¤Ë¤Ď: XnestServer ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o XF86SvgaDrivers ¤ň SVGA ĽľĄźĽĐĄź¤Ë´Ţ¤á¤ż¤¤ĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ËŔßÄꤡ¤Ć
+ ˛ź¤ľ¤¤ĄŁ
+
+ o XF86Vga16Drivers ¤ň 16 ż§ ĽľĄźĽĐĄź¤Ë´Ţ¤á¤ż¤¤ĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ËŔßÄꤡ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o XF86Vga2Drivers ¤ňÇňšő vga ĽľĄźĽĐĄź¤Ë´Ţ¤á¤ż¤¤ĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ËŔßÄꤡ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o XF86MonoDrivers ¤ňÇňšőËô¤Ď VGA16 ĽľĄźĽĐĄź (ÁĐĆŹ¤ÎĽľĄźĽĐĄź¤ňşîŔŽ¤š¤ë
+ ¤Č¤­)¤ň´Ţ¤á¤ż¤¤Čó VGA ĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ËŔßÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o Ăí°Ő: ĽÉĽéĽ¤ĽĐ¤Î˝çČ֤ϼɼ鼤ĽĐ¤Î¸Ą˝Đ¤Î˝çČÖ¤ňˇčÄꤡ¤Ţ¤šĄŁ `ČĆÍŃ'
+ (`generic') ĽÉĽéĽ¤ĽĐ¤Ďžď¤Ë¸Ą˝Đ¤ËŔŽ¸ů¤š¤ë¤Î¤Ç Mono ¤Č VGA16 ¤Č SVGA
+ ĽľĄźĽĐĄź¤Ë´Ţ¤Ţ¤ť¤ëĽÉĽéĽ¤ĽĐ¤ÎşÇ¸ĺ¤ËťŘÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ o Ć°ĹŞĽíĄźĽÉ˛ÄÇ˝ĽâĽ¸ĽĺĄźĽë(Î㤨¤Đ PEX, XIE)¤ňťČÍѤš¤ë¤Ë¤Ď:
+ ExtensionsDynamicModules ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o PEX ľĄÇ˝łČÄĽ¤ňÁȤߚţ¤ŕ¤Ë¤Ď: BuildPexExt ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o X Ľ¤ĽáĄźĽ¸ľĄÇ˝łČÄĽ¤ňÁȤߚţ¤ŕ¤Ë¤Ď: BuildXIE ¤ň YES ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Ćó˝ĹĽĐĽĂĽŐĽĄľĄÇ˝łČÄĽ¤ň¤Ď¤ş¤šťţ¤Ď: BuildDBE ¤ň NO ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o ľ­ĎżľĄÇ˝łČÄĽ¤ň¤Ď¤ş¤šťţ¤Ď: BuildRECORD ¤ň NO ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o ĽšĽŻĽęĄźĽóĽťĄźĽĐĄźľĄÇ˝łČÄĽ¤ň¤Ď¤ş¤šťţ¤Ď: BuildScreenSaverExt to NO
+ ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o Although it is possible to disable other extensions through this
+ mechanism, doing so is not recommended because savings in server
+ size are not appreciable, or the resulting server might even be
+ crippled in some way.
+
+ o ¤˝¤Îž¤ÎľĄÇ˝łČÄĽ¤ň¤ł¤ÎľĄš˝¤ňťČ¤Ă¤Ć¤Ď¤ş¤š¤ł¤Č¤Ď˝ĐÍč¤Ţ¤š¤ŹĄ˘ĽľĄźĽĐ¤Î
+ Â礭¤ľ¤ŹĚܤ˸Ť¤¨¤ë¤Ű¤ÉŔáĚó˝ĐÍč¤Ę¤¤Ą˘¤Ţ¤ż¤Ď¤¤¤Ż¤Ä¤Ť¤ÎĹŔ¤ÇÉÔĘؤˤʤë
+ ¤Î¤Ç¤Ş´Ť¤á¤ˇ¤Ţ¤ť¤óĄŁ
+
+ 4. ɸ˝ŕÇŰÉŐĘŞ¤Ë´Ţ¤Ţ¤ě¤Ę¤¤ĽÉĽéĽ¤ĽĐ¤ňÁȤߚţ¤ŕžěšç¤ĎĄ˘drivers/vga256 (Çň
+ šőĽľĄźĽĐĄź¤Î VGA2 ¤Îžěšç¤Ď drivers/vga2Ą˘16 ż§ĽľĄźĽĐĄź¤Îžěšç¤Ď
+ drivers/vga16Ą˘Čó VGA ¤Î Çňšő¤Č 16 ż§ĽľĄźĽĐĄź¤Îžěšç¤Ď drivers/mono)
+ ¤ÎĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤ĆĄ˘¤˝¤ÎĽÇĽŁĽěĽŻĽČĽę¤Î˛ź¤ËĽ˝ĄźĽšĽŐĽĄĽ¤Ľë¤Ť .o
+ ĽŐĽĄĽ¤Ľë¤Î¤¤¤ş¤ě¤Ť¤ČĹŹŔÚ¤Ę Imakefile ¤ňĽłĽÔĄź¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤˝¤ÎĽÇĽŁĽě
+ ĽŻĽČĽę¤ÎĚžžÎ¤ĎłşĹö¤š¤ëĽÉĽéĽ¤ĽĐ¤ÎĚžžÎ¤Č°ěĂפľ¤ť¤Ć˛ź¤ľ¤¤ĄĘ¤č¤ęžÜ¤ˇ¤Ż
+ ¤Ď VGADriverDoc ĽÇĽŁĽěĽŻĽČĽę¤ÎĂć¤Ë¤˘¤ëʸ˝ń¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄËĄŁ
+
+ 5. Makefile ¤ňşîŔŽ¤š¤ë¤Ë¤ĎĄ˘źĄ¤ÎĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ./mkmf
+
+ 6. `make' ¤ňźÂšÔ¤š¤ë¤Čš˝ŔŽÄęľÁ¤ˇ¤żĽľĄźĽĐĄź¤ňˇëšç¤ˇ¤Ţ¤šĄŁ
+
+ 7. `make install' ¤ňźÂšÔ¤š¤ë¤Čżˇ¤ˇ¤¤ĽľĄźĽĐĄź¤ňÁȤߚţ¤ß¤Ţ¤šĄŁ
+
+ 8. `make clean' ¤ňźÂšÔ¤š¤ë¤Č¤ł¤Îźę˝ç¤ÇşîŔŽ¤ˇ¤żĽŐĽĄĽ¤Ľë¤ňşď˝ü¤ˇ¤Ţ¤šĄŁ
+
+ 9. xf86site.def ĽŐĽĄĽ¤Ľë¤ňĘÔ˝¸¤ˇĄ˘şîŔŽ¤š¤ëĽľĄźĽĐĄź¤ŤĽľĄźĽĐĄź¤Ë´Ţ¤Ţ¤ť¤ë
+ ĽÉĽéĽ¤ĽĐ¤ÎÁŞÂň¤ňĘŃšš¤ˇ¤ĆĄ˘žĺľ­¤Îźę˝ç¤ňˇŤ¤ęĘÖ¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁxf86site.def ĽŐĽĄĽ¤Ľë¤Ë¤Ć X ĽľĄźĽĐĄźľĄÇ˝łČÄĽ¤ÎÁŞÂň¤ňĘŃšš¤ˇ¤żžě
+ šç¤ĎĄ˘`./mkmf' ¤Î¤Ť¤ď¤ę¤Ë `make Makefile' ¤ňźÂšÔ¤š¤ě¤Đ˝˝ĘŹ¤Ç¤ˇ¤ç
+ ¤ŚĄŁ
+
+ 10.
+ X ĽľĄźĽĐĄź¤Ë `-showconfig' ĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ĆźÂšÔ¤š¤ě¤Đ X ĽľĄźĽĐĄź
+ ¤Ë´Ţ¤Ţ¤ě¤Ć¤¤¤ëĽÉĽéĽ¤ĽĐ¤ňÄ´¤Ů¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ¤É¤ó¤ĘľĄÇ˝łČÄĽ¤Ź´Ţ¤Ţ
+ ¤ě¤Ć¤¤¤ë¤Ť¤ňłÎǧ¤š¤ë¤Ë¤ĎĄ˘X ĽľĄźĽĐĄź¤ňľŻĆ°¤ˇĄ˘`xdpyinfo' ¤ňźÂšÔ¤ˇ¤Ć
+ ˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LinkKit.sgml,v 3.11 1996/10/16 14:41:12 dawes Exp
+ $XConsortium: LinkKit.sgml /main/4 1995/11/12 19:59:36 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/LinkKit.sgml,v
+ 3.11 1996/10/16 14:41:12 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/LinkKit.sgml,v 3.12 1996/12/09 07:52:23 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/QuickStart.doc b/xc/programs/Xserver/hw/xfree86/doc/Japanese/QuickStart.doc
new file mode 100644
index 000000000..a64740a1b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/QuickStart.doc
@@ -0,0 +1,618 @@
+ XFree86 ¤ÎŔßÄę¤ňźęÁ᤯¤š¤ë°Ů¤Îźę°ú¤­
+ Joe Moss 1996 ÇŻ 8 ˇî 26 Ćü
+
+ Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto (ikko-@pacific.rim.or.jp) Ěő
+
+ şÇżˇ¤Î XFree86 ¤ĎĽľĄźĽĐ¤ÎŔßÄę¤Îźę˝ç¤ňźŤĆ°˛˝¤š¤ë¤Î¤ËĚň¤ËΊ¤ÄĽÄĄźĽë¤ň´ö
+ ¤Ä¤â´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ¤ˇ¤Ť¤ˇĄ˘´ű¸¤Îʸ˝ń¤Î¤Ű¤Č¤ó¤É¤ĎŔßÄęşîśČ¤ňźę¤Ç¤š¤ëĎäň
+ °ˇ¤Ă¤Ć¤Ş¤ęĄ˘¤ˇ¤Ť¤âĄ˘ľť˝ŃĹŞ¤ĘşŮ¤Ť¤¤ĎäŹÂçÎ̤˽ń¤¤¤Ć¤˘¤Ă¤ż¤ę¤ˇ¤Ţ¤šĄŁ¤ł¤ě
+ ¤é¤ĎĽŢĽËĽ˘¸ţ¤ą¤ÎľĄ´ď¤äźŤĘŹ¤Îźę¤Ç˛ż¤Č¤Ť¤ˇ¤ż¤¤¤Čť×¤Ă¤Ć¤¤¤ëĽćĄźĽś¤Ë¤ĎÁÇŨ
+ ¤ĘžđĘó¤Ç¤šĄŁ¤ˇ¤Ť¤ˇĄ˘°ěČĚĹŞ¤ĘľĄ´ď¤ňťČÍѤˇ¤Ć¤ëËؤɤμ楟Ľś¤Ď¤Č¤Ë¤Ť¤Ż X
+ ¤ň¤š¤°¤ËĆ°¤Ť¤ˇ¤Ć¤ß¤ż¤¤¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤Îźę°ú¤­¤Ď¤˝¤ó¤ĘĽćĄźĽś¤Î°Ů¤ÎžđĘó¤Ç
+ ¤šĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. ¤Ď¤¸¤á¤ëÁ°¤Ë
+
+ 2. ˛ż¤ňšÔ¤Ś¤Î¤Ť - łľÍ×
+
+ 3. (TT
+
+ 3.1. şÇ˝é¤ÎľżĚä
+
+ 3.2. š˝ŔŽžđĘó¤ÎšŕĚÜ
+
+ 3.2.1. ĽŢĽŚĽš
+
+ 3.2.2. Ľ­ĄźĽÜĄźĽÉ
+
+ 3.2.3. ĽÓĽÇĽŞĽŤĄźĽÉ
+
+ 3.2.4. ĽâĽËĽż
+
+ 3.2.5. ¤˝¤Îž
+
+ 3.2.6. š˝ŔŽÄęľÁ¤ÎťĹžĺ¤˛
+
+ 3.3. ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤ë
+
+ 3.4. Â裲ĽľĄźĽĐ
+
+ 3.5. şÇ¸ĺ¤Ë
+
+ 4. (TT
+
+ 4.1. şÇ˝é¤Î˛čĚĚ
+
+ 4.2. Ŕľ¤ˇ¤¤
+
+ 4.3. ĽŢĽŚĽš¤ÎŔßÄę
+
+ 4.4. Ľ­ĄźĽÜĄźĽÉ¤ÎŔßÄę
+
+ 4.5. ĽâĽËĽż¤ÎŔßÄę
+
+ 4.6. ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎÁŞÂň
+
+ 4.7. ĽľĄźĽĐ¤ÎÁŞÂň
+
+ 4.8. ĽšĽŻĽęĄźĽó/ĽÓĽÇĽŞĽŤĄźĽÉ¤Îš˝ŔŽ
+
+ 4.9. ĽâĄźĽÉ¤ÎÁŞÂň
+
+ 4.10. (TT
+
+ 4.11. şÇ˝ŞĂí°Őťöšŕ
+
+ 5. XF86Config ĽŐĽĄĽ¤Ľë¤Î˝¤Ŕľ
+
+ 6. (TT
+
+ 7. ĽČĽéĽÖĽëĽˇĽĺĄźĽĆĽŁĽóĽ°
+
+ 7.1. ĽŢĽŚĽš¤Ź¤Á¤ă¤ó¤ČĆ°¤Ť¤Ę¤¤ĄŁ¤Ä¤Ţ¤ę˛čĚ̤ËÄĽ¤ęÉŐ¤¤¤ż¤Ţ¤ŢĆ°¤Ť¤Ę¤¤ĄŁ
+
+ 7.2. ĽľĄźĽĐ¤ŹľŻĆ°¤ˇ¤Ę¤¤ĄŁ¤ł¤ÎťţĽŢĽŚĽš¤ŹťČÍѺѤߤǤ˘¤ë¤ČÉ˝ź¨¤ľ¤ě¤ëĄŁ
+
+ 7.3. żż¤óĂć¤ÎĽÜĽżĽó¤ŹťČÍŃ˝ĐÍč¤Ę¤¤ĄŁ
+
+ 7.4. ˛čĚ̤Źžĺ˛źş¸ąŚ¤ËĘŇ´ó¤ëĄŁ
+
+ 7.5. xf86config ¤Ţ¤ż¤Ď xvidtune ¤ŹĽˇĽšĽĆĽŕ¤ÎĂć¤Ë¸Ť¤Ä¤ą¤é¤ě¤Ę¤¤ĄŁ
+ ______________________________________________________________________
+
+ 1. ¤Ď¤¸¤á¤ëÁ°¤Ë
+
+ ĽľĄźĽĐ¤ÎŔßÄę¤ňšÔ¤ŚÁ°¤ËĂÎ¤Ă¤Ć¤Ş¤ŻÉŹÍפΤ˘¤ëšŕĚܤŹžŻ¤ˇ¤˘¤ę¤Ţ¤šĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽâĽÇĽëĚžžÎ
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎŔľłÎ¤ĘĽâĽÇĽëĚžžÎ¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤Ţ¤żĄ˘ĽÓĽÇĽŞĽŤ
+ ĄźĽÉ¤ËĹëşÜ¤ľ¤ě¤Ć¤¤¤ëĽ°ĽéĽŐĽŁĽĂĽŻĽÁĽĂĽ×ĽťĽĂĽČ, RAMDAC ¤Č ĽŻ
+ ĽíĽĂĽŻĽÁĽĂĽ×¤ňĂÎ¤Ă¤Ć¤Ş¤Ż¤Č˝ő¤Ť¤ę¤Ţ¤šĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëĽáĽâĽę¤ÎÎĚ
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëĽáĽâĽę¤Ź˛ż MB ĽĐĽ¤ĽČ¤˘¤ë¤ŤÄ´¤Ů¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤Ź VGA ¸ß´š¤Ç¤˘¤ë¤Ť¤É¤Ś¤Ť
+ şÇśá¤ÎËŘ¤É¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤Ď VGA ¸ß´š¤Ç¤š¤ŹĄ˘Î㤨¤ĐŔΤÎÇňšő¤ÎĽÓĽÇ
+ ĽŞĽŤĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤Ď VGA ¸ß´š¤Ç¤Ď¤Ę¤¤ťţ¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ ĽâĽËĽż¤ÎťĹÍÍ
+ Ćä˿ĺʿƹ´üźţÇČżô (ĘŁżô) ¤ČżâÄžĽęĽŐĽěĽĂĽˇĽĺĽěĄźĽČ (ĘŁżô) ¤ĎĂΤĂ
+ ¤Ć¤Ş¤ŻÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ě¤é¤Ď˝ĹÍפǤšĄŞĽâĽËĽż¤ÎĽŢĽËĽĺĽ˘Ľë¤ňÄ´¤Ů
+ ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽŢĽŚĽš¤ÎťČÍѤˇ¤Ć¤¤¤ëĽ×ĽíĽČĽłĽë
+ ĽŢĽŚĽš¤ČŔÜÂł¤š¤ë¤Î¤ËťČÍѤˇ¤Ć¤¤¤ëĽ×ĽíĽČĽłĽë¤ňĂÎ¤Ă¤Ć¤Ş¤Ż¤ČĄ˘ŔßÄęşî
+ śČ¤ÎÂŽĹٸţžĺ¤ËĚň¤ËΊ¤Á¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽŢĽŚĽš¤Ď°Ű¤Ę¤ëŁ˛¤Ä¤ÎĽ×ĽíĽČ
+ ĽłĽë¤ňťČÍѤˇ¤Ć¤¤¤Ţ¤š¤Ť¤éĄ˘ŔÚ¤ęÂؤ¨Ęý¤ĎÍÍĄš¤Ç¤šĄŁ
+
+ 2. ˛ż¤ňšÔ¤Ś¤Î¤Ť - łľÍ×
+
+ XFree86 ¤ÎŔßÄę¤ËÍ­ÍѤʣł¤Ä¤ÎĽÄĄźĽë¤Ź¤˘¤ę¤Ţ¤šĄŁ:
+
+ o XF86Setup
+
+ o xf86config
+
+ o xvidtune
+
+ XF86Setup ¤Ďźç¤ËĽ°ĽéĽŐĽŁĽĂĽŻĽćĄźĽśĽ¤ĽóĽżĽŐĽ§ĄźĽš¤ňťČ¤Ă¤Ć¤¤¤ĆĄ˘˝é´üŔßÄę
+ ¤ËÎɤŻťČÍѤˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘ťČ¤¨¤Ę¤¤¤¤¤Ż¤Ä¤Ť¤Îžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁĽÓĽÇĽŞĽŤĄźĽÉ
+ ¤Ź VGA ¸ß´š¤Ç¤Ď¤Ę¤¤žěšçĄ˘¸ÇÄęźţÇČżô¤ÎĽâĽËĽż¤ÎžěšçĄ˘¤Ţ¤ż¤Ď OS/2 ¤ŹźÂšÔ
+ Ăć¤Îžěšç¤Ď XF86Setup ¤ĎťČ¤¨¤Ţ¤ť¤ó¤Î¤ÇĄ˘Âĺ¤ď¤ę¤Ë xf86config ¤Ë¤Ä¤¤¤ĆĆÉ
+ ¤ó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁĽáĽâĽę¤ŹžŻ¤Ę¤¤Ëô¤ĎĂ٤¤ĽˇĽšĽĆĽŕ¤ňťČ¤Śžěšç¤âĄ˘ĆąÍͤË
+ xf86config ¤ňťČÍѤˇ¤ż¤Ű¤Ś¤ŹÎɤ¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ xf86config ¤ĎĽĆĽ­ĽšĽČĽŮĄźĽš¤Ç¤š¤ŹĄ˘ËؤɤμϥźĽÉĽŚĽ§Ľ˘¤ÎÁȤߚç¤ď¤ť¤ÇĆ°
+ şî¤ˇ¤Ţ¤šĄŁÉáÄ̤μƼ­ĽšĽČĽâĄźĽÉ¤ŹĆ°şî¤ˇ¤Ę¤¤¤č¤Ś¤Ę¸ÇÄęźţÇČżô¤ÎĽâĽËĽżĄź¤Ç
+ ¤ĎžěšçĄ˘ÉŹÍפĘʸ˝ń¤ňĆɤó¤ÇźŤ¤é¤Îźę¤ÇŔßÄꤡ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ ¤Á¤ç¤Ś¤ÉÎɤ¤˛čÁü¤ň¸Ť¤Ä¤ą¤ë¤Ë¤ĎĄ˘É˝ź¨¤ľ¤ě¤ż˛čÁü¤ň (Î㤨¤ĐĄ˘˛čÁü¤ňš­¤˛¤ż
+ ¤ęĄ˘žŻ¤ˇş¸¤Ë°ÜĆ°¤ˇ¤ż¤ęĹůĄš) Ä´Ŕ°¤š¤ë xvidtune ¤ňťČÍѤš¤ëÉŹÍפŹ¤˘¤ę¤Ţ
+ ¤šĄŁXF86Setup ¤ĎĹŹŔڤʝţ¤Ë xvidtune ¤ňźÂšÔ¤ˇ¤Ţ¤šĄŁxf86config ¤ňźÂšÔ¤š
+ ¤ëžěšç¤ĎĄ˘¸ĺ¤Ç xvidtune ¤ňťČÍѤˇ¤Ţ¤šĄŁ
+
+ ¤ł¤Îźę˝ç¤ĎźĄžĎ°Ęšß¤ÇžÜşŮ¤ËŔâĚŔ¤ˇ¤Ţ¤šĄŁĘ¸˝ń¤ňĆɤߤż¤Ż¤Ę¤¤Ęý¤Ë¤ĎĄ˘ż§Ąšťî
+ ¤ˇ¤Ć¤ß¤ĆźŤĘŹ¤ÎšÔ¤ŻĆť¤ňşî¤Ă¤Ć˛ź¤ľ¤¤ĄŁ¤ľ¤˘ XF86Setup ¤Č¤Ŕ¤ąÂǤÁšţ¤ó¤Ç¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁĚäÂꤏŔ¸¤¸¤ż¤éĄ˘¤ł¤ł¤Ë¤˘¤ëʸ˝ń¤ňĆɤߤޤˇ¤ç¤ŚĄŁ
+
+ X ĆâÉô¤Ť¤é XF86Setup ¤ňźÂšÔ¤ˇĄ¤¸˝şßÍřÍѤˇ¤Ć¤¤¤ëŔßÄę¤ňĘŃšš¤š¤ë¤ł¤Č¤â¤Ç
+ ¤­¤Ţ¤š¤ŹĄ˘¤ł¤ł¤Ç¤Ď¤˝¤Î¤č¤Ś¤ĘťČÍŃËĄ¤Ë¤Ä¤¤¤Ć¤ĎĆäËŔâĚŔ¤ˇ¤Ţ¤ť¤óĄŁ¤ł¤ł¤ÇŔâ
+ ĚŔ¤ˇ¤Ć¤¤¤ëÁŕşîźę˝ç¤ĎĄ˘źç¤ËXFree86 ¤ň°ě¤Ť¤éŔßÄꤚ¤ëžěšç¤Ë¤Ä¤¤¤Ć˝Ň¤Ů¤Ć¤¤
+ ¤Ţ¤šĄŁ
+
+ 3. XF86Setup ¤ÎťČÍŃËĄ
+
+ XF86Setup ¤ĎşÇ˝é¤ËĆłĆţ¤ľ¤ě¤Ć¤¤¤ë°ěÄę¤ÎĽŐĽĄĽ¤Ľë¤ňłÎǧ¤ˇ¤Ţ¤š¤Î¤ÇĽëĄźĽČ¤Ë
+ ¤Ę¤Ă¤ĆźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁĚäÂꤏȯŔ¸¤ˇ¤ż¤éĄ˘ĽáĽĂĽťĄźĽ¸¤ňÉ˝ź¨¤ˇ¤Ć˝ŞÎť¤ˇ¤Ţ
+ ¤šĄŁĚäÂę¤ň˝¤Ŕľ (Î㤨¤ĐĄ˘Ěľ¤¤ĽŐĽĄĽ¤Ľë¤ňĆłĆţ¤š¤ëĹů) ¤ˇ¤Ć¤â¤Ś°ěĹٟšԤˇ¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ
+
+ 3.1. şÇ˝é¤ÎľżĚä
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Ź¤š¤Ç¤Ë¤˘¤ëžěšç¤ĎĄ˘ÍÍĄš¤ĘŔßÄęšŕĚܤÎɸ˝ŕĂͤňŔßÄꤚ
+ ¤ë¤Î¤ËĄ˘¤˝¤ł¤Ë¤˘¤ëšŕĚܤňɸ˝ŕĂͤ˝ȤäƤ⚽¤ď¤Ę¤¤¤ŤĘš¤Ť¤ě¤Ţ¤šĄŁ¤â¤ˇ (Âż
+ žŻ¤Ę¤ę¤Č¤â) ´ű¤ËĆ°şî¤ˇ¤Ć¤¤¤ëš˝ŔŽ¤ŹĆţźę¤Ç¤­¤ë¤Ę¤é¤˝¤ě¤Ť¤éťĎ¤á¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ĽŤĄźĽÍĽëĆâÉô¤ËĽŢĽŚĽšĽÉĽéĽ¤ĽĐ¤ŹĆ⢤ľ¤ě¤Ć¤¤¤ë OS (Î㤨¤ĐĄ˘SCO Ëô¤Ď
+ SVR4) ¤ŹĆ°şî¤ˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘¤˝¤ÎĽÉĽéĽ¤ĽĐ¤ňťČÍѤˇ¤Ć¤â¤č¤¤¤ŤłÎǧ¤ˇ¤Ć¤Ż¤Ŕ
+ ¤ľ¤¤ĄŁ
+
+ °ěĂś (¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ę¤¤) ľżĚ䤏˛ňžĂ¤ˇ¤ż¤éĄ˘Ľ°ĽéĽŐĽŁĽĂĽŻĽâĄźĽÉ¤ËŔÚ¤ęÂؤ¨
+ ¤ë˝ŕČ÷¤Ź¤Ç¤­¤żťö¤ňź¨¤šĽáĽĂĽťĄźĽ¸¤ŹÉ˝ź¨¤ľ¤ě¤ë¤Čť×¤¤¤Ţ¤šĄŁĚۤäƼ¨ĽóĽżĄź
+ Ľ­Ąź¤ň˛Ą¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤Á¤ç¤Ă¤Č¤ˇ¤Ć¤Ť¤éĽ°ĽéĽŐĽŁĽĂĽŻ˛čĚĚ¤Ë Welcome to
+ XFree86 Setup ¤ŹÉ˝ź¨¤ľ¤ě¤Ę¤¤žěšç¤ĎĄ˘˛ż¤Ť¤ŹÂżĘŹ¤Ŕ¤ó¤Ţ¤ęžőÂ֤ˤʤ俤Î
+ ¤ÇĄ˘Ctrl Ľ­Ąź¤Č Alt Ľ­Ąź¤Č Backspace Ľ­Ąź¤ňĆąťţ¤Ë˛Ą¤ˇ¤ĆĽĆĽ­ĽšĽČĽâĄźĽÉ
+ ¤ËĚá¤Ă¤ĆĄ˘XF86Setup ¤ÎÂĺ¤ď¤ę¤Ë xf86config ¤ňťČ¤ŚÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 3.2. š˝ŔŽžđĘó¤ÎšŕĚÜ
+
+ °ěĂśĄ˘VGA16 ¤ÎĽľĄźĽĐ¤ŹľŻĆ°¤ˇ¤ĆĄ˘Ľ×ĽíĽ°ĽéĽŕ¤ÎĽíĄźĽÇĽŁĽóĽ°¤Ź´°Îť¤š¤ě¤ĐĄ˘
+ ˛čĚ̤Ξĺ¤ËŁľ¤Ä¤ÎĽÜĽżĽó¤Č˛ź¤ËŁł¤Ä¤ÎĽÜĽżĽó¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁš˝ŔŽžđĘó¤ÎĆ⥢
+ °ěČĚĹŞ¤ĘĘŹÎŕ¤ËÂĐąţ¤š¤ëĽÜĽżĽó¤Źžĺ¤Ë¤˘¤ę¤Ţ¤šĄŁźÂšÔ¤š¤ë˝çČÖ¤ĎĚ䤤¤Ţ¤ť¤óĄŁ
+ °Ęšß¤Ç¤˝¤ě¤ž¤ě¤ÎšŕĚܤΞܺ٤ˤĤ¤¤ĆŔâĚŔ¤ˇ¤Ţ¤šĄŁ˛ź¤ÎĽÜĽżĽó¤Ď¤˝¤ě¤ž¤ě
+ Abort, Done, ¤Č Help ¤Č¤¤¤Ś¤â¤Î¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁ
+
+ Abort ¤ĎĚžÁ°¤É¤Ş¤ę¤Î°ŐĚŁ (Ăćťß) ¤Ç¤šĄŁŔßÄꤡ¤żÁ´¤Ć¤ÎĘŃšš¤ňłĘÇź¤ˇ¤Ę¤¤¤Ç
+ ˝ŞÎť¤ˇ¤Ţ¤šĄŁ(Ăćťß˝ĐÍč¤Ę¤¤)Łą¤Ä¤˘¤ę¤˝¤Ś¤ĘÎăł°¤ĎĽŢĽŚĽš¤ÎĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ
+ ¤Ř¤ÎĽęĽóĽŻ¤Ç¤šĄŁšÔ¤Ă¤żĘŃšš¤ň¤š¤°¤ËŔßÄꤡ¤ż¤¤¤Č¤­¤Ď Apply ¤ňÁŞÂň¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ ż§Ąš¤ĘĘŹÎŕ¤Îš˝ŔŽžđĘó¤ÎŔßÄꤏ˝ŞÎť¤ˇ¤ż¤Č¤­¤Ď Done ¤ňÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¸˝šÔ¤ÎŔßÄę˛čĚ̤˴ؤš¤ëĽŞĽóĽéĽ¤ĽóĽŘĽëĽ×¤ŹÍߤˇ¤¤¤Č¤­¤Ď Help ¤ň˛Ą¤ˇ¤Ć¤Ż¤Ŕ
+ ¤ľ¤¤ĄŁ
+
+ ž¤ÎÉôĘŹ¤ÎŔßÄꤏ¤â¤Ă¤Č´ĘĂą¤Ë¤Ę¤ë¤Î¤ÇĄ˘ĽŢĽŚĽš¤ÎŔßÄꤍ¤éťĎ¤á¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 3.2.1. ĽŢĽŚĽš
+
+ ĽŢĽŚĽš¤ÎŔßÄę˛čĚ̤ϥ˘ĽŢĽŚĽš¤ňŔľ¤ˇ¤ŻĆ°şî¤ľ¤ť¤ë¤ż¤á¤ËťČÍѤˇ¤Ţ¤šĄŁ¤Ţ¤ŔĽŢĽŚ
+ Ľš¤ŹĆ°şî¤ˇ¤Ć¤¤¤Ę¤¤žěšç¤Ç¤âĄ˘ĽŢĽŚĽš¤ÎŔßÄę¤ňÍưפˤš¤ë¤ż¤áĄ¤ĽŢĽŚĽš¤ÎÁ´ľĄ
+ Ç˝¤ËÂĐąţ¤š¤ëĽ­Ąź¤Źłä¤ęĹö¤Ć¤é¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+ ŁłĽÜĽżĽó¤ÎÇň¤¤ĽŢĽŚĽš¤ÎĚĎź°żŢ¤ň˛čĚ̤ËÉ˝ź¨¤ˇ¤Ţ¤šĄŁĽŢĽŚĽš¤ňĆ°¤Ť¤š¤ČĄ˘˛čĚĚ
+ ¤ËĽŢĽŚĽšĽŤĄźĽ˝Ľë¤ÎşÂɸĂͤŹÉ˝ź¨¤ľ¤ěĄ˘ĽŢĽŚĽš¤ÎĽÜĽżĽó¤ň˛Ą¤š¤ČÂĐąţ¤š¤ëĚĎź°
+ żŢ¤ÎĽÜĽżĽó¤Źšő¤Żż§¤ŹĘѤď¤ę¤Ţ¤šĄŁ¤ł¤ÎÍͤˤʤé¤Ę¤¤žěšç¤ĎĄ˘ĽŢĽŚĽš¤ĎŔľ¤ˇ¤Ż
+ ŔßÄę˝ĐÍč¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ ˛čĚ̤Ξĺ¤Ëʤó¤Ç¤¤¤ëĽÜĽżĽó¤ÎÎó¤ĎłşĹö¤š¤ëż§Ąš¤ĘťČÍѲÄÇ˝¤ĘĽ×ĽíĽČĽłĽë¤ËÂĐ
+ ąţ¤ˇ¤Ć¤¤¤Ţ¤šĄŁÂž¤ÎŔßÄę¤ňšÔ¤Ś¤ż¤á¤ÎĽÜĽżĽó¤äĽšĽéĽ¤ĽŔ¤â¤¤¤Ż¤Ä¤Ť¤˘¤ę¤Ţ¤š
+ ¤ˇĄ˘ĽŢĽŚĽš¤ÎĚĎź°żŢĄ˘¤Ş¤č¤ÓŔßÄęĘŃšš¤ňČżąÇ¤ľ¤ť¤ë¤ż¤á¤ÎĽÜĽżĽó¤â¤˘¤ę¤Ţ¤šĄŁ
+ ťČÍѲÄÇ˝¤ĘĽÇĽĐĽ¤Ľš¤Î°ěÍ÷¤ÎĂ植¤éĽÇĽĐĽ¤Ľš¤ňŔßÄꤚ¤ëĽ¨ĽóĽČĽęĽÜĽĂĽŻĽš¤â¤˘
+ ¤ę¤Ţ¤šĄŁ
+
+ ¤Ţ¤şşÇ˝é¤ËĽŢĽŚĽš¤ň°ÜĆ°¤ľ¤ť¤ĆĄ˘ĽŢĽŚĽšĽŤĄźĽ˝Ľë¤ŹŔľ¤ˇ¤Ż°ÜĆ°¤š¤ë¤ł¤Č¤ňłÎǧ
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤Ś¤Ţ¤ŻĆ°¤¤¤ż¤éĄ˘ĽÜĽżĽó¤Ź¤Á¤ă¤ó¤ČĆ°şî¤š¤ë¤ŤĽĆĽšĽČ¤ˇ¤Ć¤ß¤Ţ
+ ¤ˇ¤ç¤ŚĄŁť×¤Ă¤ż¤č¤Ś¤ËĆ°şî¤ˇ¤ż¤éĄ˘źĄ¤Ďž¤ÎŔßÄęšŕĚܤ˚Ԥ­¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ĽŢĽŚĽšĽŤĄźĽ˝Ľë¤ŹÁ´¤Ż°ÜĆ°˝ĐÍč¤Ę¤¤žěšçĄ˘ĽŢĽŚĽšĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤ŤĽŢĽŚĽš¤Î
+ Ľ×ĽíĽČĽłĽë¤Î¤É¤Á¤é¤Ť (źă¤Ż¤ĎΞĘý) ¤ň˝¤Ŕľ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ 'n' ¤ËÂł
+ ¤¤¤ĆĽżĽÖĽ­Ąź¤ň˛Ą¤š¤ČźĄ¤ËťČÍѲÄÇ˝¤ĘĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤š
+ ¤Î¤Ç°Ű¤Ę¤Ă¤żĽ×ĽíĽČĽłĽë¤ňÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ'p' ¤ň˛Ą¤ť¤ĐźĄ¤ËťČÍѲÄÇ˝¤ĘĽ×
+ ĽíĽČĽłĽë¤Î°ěÍ÷¤ŹÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤äĽ×ĽíĽČĽłĽë¤ňĘŃšš¤ˇ¤ż¸ĺ
+ ¤Ď 'a' ¤ň˛Ą¤ť¤ĐĘŃšš¤ŹČżąÇ¤ľ¤ě¤Ţ¤š¤Î¤Ç¤â¤Ś°ěĹٝ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁĽŢĽŚĽš
+ ¤Ť¤é¤ÎąţĹú¤ŹĘ֤äƤŻ¤ë¤Ţ¤Ç¤ł¤ÎÁŕşî¤ňˇŤ¤ęĘÖ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ĽŢĽŚĽšĽŤĄźĽ˝Ľë¤ŤĽÜĽżĽó¤ŹłÎǧÍѤÎĚĎź°żŢ¤Ç¤ĎĆ°şî¤š¤ë¤Î¤ËĄ˘źÂşÝ¤ËĽŢĽŚĽš¤ň
+ °ÜĆ°¤ľ¤ť¤żťţ¤Á¤ă¤ó¤ČĽŢĽŚĽšĽŤĄźĽ˝Ľë¤Ź°ÜĆ°¤ˇ¤Ę¤¤žěšç¤ĎĄ˘ÂżĘŹ°­¤¤Ľ×ĽíĽČĽł
+ Ľë¤ňÁŞÂň¤ˇ¤Ć¤¤¤ë¤Î¤Ç¤šĄŁ°Ű¤Ę¤ëĽ×ĽíĽČĽłĽë¤ňťî¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ şÇśá¤ÎËؤɤμ޼ŚĽš¤Ď Microsoft Ľ×ĽíĽČĽłĽë¤ňťČ¤Ă¤Ć¤¤¤ĆĄ˘źĄ¤ËËؤɤμ޼Ś
+ Ľš¤Ď MouseSystems Ľ×ĽíĽČĽłĽë¤ňťČ¤Ă¤Ć¤¤¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽŢĽŚĽš¤ĎΞĘý¤â¤Ă
+ ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎÍÍ¤Ę Ćó˝ĹĽ×ĽíĽČĽłĽë ( dual-protocol ) ¤ÎĽŢĽŚĽš¤ĎÍÍ
+ Ąš¤ĘĘýËĄ¤ÇŁ˛¤Ä¤ÎĽ×ĽíĽČĽłĽë¤ňŔÚ¤ęÂؤ¨¤Ţ¤šĄŁĽŢĽŚĽšËÜÂΤËŔÚÂؤ¨ĽšĽ¤ĽĂĽÁ¤Ź
+ ¤Ä¤¤¤Ć¤¤¤ë¤â¤Î¤â¤˘¤ę¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽŢĽŚĽš¤Îžěšç¤ĎĄ˘ĽŢĽŚĽš¤Č¤ÎŔÜÂł¤ňťĎ
+ ¤á¤żťţ¤Ë°ěÄę¤ÎżŽšć¤ňĽŢĽŚĽš¤ËÁ÷żŽ¤ˇ¤ĆŔÚ¤ęÂؤ¨¤Ţ¤šĄŁ¤˝¤ÎżŽšć¤Ď
+ 'ClearDTR' ¤Č¤˝¤Îž¤ÎĽŢĽŚĽš¤Ç¤ĎĽŢĽŚĽš¤Č¤ÎŔÜÂłťţ (ĽŢĽŚĽšĽÉĽéĽ¤ĽĐ¤Ź
+ şÇ˝é¤ËÄĚżŽ¤ˇ¤č¤Ś¤Č¤ˇ¤Ţ¤š) ¤ËĽÜĽżĽó¤Ź˛Ą¤ľ¤ě¤Ć¤¤¤ë¤ŤÄ´şş¤š¤ë¤â¤Î¤â¤˘
+ ¤ę¤Ţ¤šĄŁťČÍѤˇ¤ż¤¤ĽŢĽŚĽš¤Ź¤ł¤Îźď¤Î¤â¤Î¤Ę¤é¤ĐĹŹŔڤʼܼżĽó¤ň˛Ą¤ľ¤¨¤Ę¤Ź¤é
+ ÁŞÂňťţ¤Ë ('a' ¤ň˛Ą¤ˇ¤Ć) ĹŹÍѤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽŢĽŚĽš¤ÎĽŤĄźĽ˝Ľë¤ŹŔľ¤ˇ¤Ż°ÜĆ°¤ˇ¤ż¤éĄ˘Łł¤Ä¤ÎĽÜĽżĽó¤ŹĹŹŔÚ¤ËĆŻ¤Ż¤ŤĽĆĽšĽČ¤ˇ
+ ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁŁ˛ĽÜĽżĽóĽŢĽŚĽš¤Îžěšç¤Ď 'Emulate3Buttons' ¤ňÁŞÂň¤ˇ¤ĆŁ˛ĽÜĽż
+ ĽóĽŢĽŚĽš¤ËĚľ¤¤żż¤óĂć¤ÎĽÜĽżĽó¤ÎÂĺ¤ď¤ę¤ËŁ˛¤Ä¤ÎĽÜĽżĽó¤ňĆąťţ¤Ë˛Ą¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁÁ´¤Ć¤ÎĽÜĽżĽó¤ŹĆ°şî¤ˇ¤Ę¤¤žěšç¤ĎĄ˘Ľ×ĽíĽČĽłĽë¤Č¤˝¤Ă¤Ż¤ę¤Îť÷¤Ć¤¤¤ëĽ×Ľí
+ ĽČĽłĽë¤ÎŔßÄę¤ň¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 3.2.2. Ľ­ĄźĽÜĄźĽÉ
+
+ ¸˝şß¤ÎŔßÄꤏŔľ¤ˇ¤Ż¤Ę¤¤žěšçĄ˘Ľ­ĄźĽÜĄźĽÉ¤ÎˇżĚž¤ČĽ­ĄźÇŰÎó¤ňÁŞÂň¤š¤ë (ĹŹÍŃ
+ (apply) ¤ň˛Ą¤š) ÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁĽ­ĄźĽÜĄźĽÉ¤ÎĚĎź°żŢÉ˝ź¨¤ŹÁŞÂň¤ˇ¤żĽ­ĄźĽÜ
+ ĄźĽÉ¤Î¤â¤Î¤ËĆţ¤ěÂؤď¤ę¤Ţ¤šĄŁ
+
+ Ľ˘ĽáĽęĽŤ°Ęł°¤ÎĽ­ĄźĽÜĄźĽÉ¤ÎžěšçĄ˘°ěÍ÷¤ÎÁŞÂňťč (¸˝şß¤ÎÁŞÂňťč¤Ď
+ nodeadkeys>¤ÎŁą¤Ä¤ˇ¤Ť¤˘¤ę¤Ţ¤ť¤ó) ¤Ť¤éŔßÄꤡ¤ż¤¤¤â¤Î¤ňÁޤó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤Ţ¤żĄ˘ĽŞĽ×ĽˇĽçĽó¤ÎĂ植¤éŔľ¤ˇ¤¤¤â¤Î¤ňÁޤ֤ł¤Č¤â˝ĐÍč¤Ţ¤šĄŁ
+
+ 3.2.3. ĽÓĽÇĽŞĽŤĄźĽÉ
+
+ °ěÍ÷¤Ť¤éĽÓĽÇĽŞĽŤĄźĽÉ¤ňÁޤó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤ËÉŐ°¤š¤ë README ĽŐĽĄĽ¤Ľë¤Ź¤˘¤ě¤Đ 'Read README file' ¤ÎĽÜ
+ ĽżĽó¤ň˛Ą¤ť¤Đ (¤ż¤Ŕ¤ˇłĽż§¤Ë¤Ę¤Ă¤Ć¤¤¤Ę¤ą¤ě¤Đ) Ćɤळ¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤Ź°ěÍ÷¤Ë¤Ę¤ą¤ě¤ĐĄ˘¤Ţ¤ż¤Ď README ĽŐĽĄĽ¤Ľë¤ÎĂć¤ËĽÓĽÇĽŞĽŤĄźĽÉ
+ ¤Ë´Ř¤ˇ¤ĆĆĂĘ̤ĘŔßÄꤏɏÍפǤ˘¤ë¤Č˝ń¤Ť¤ě¤Ć¤¤¤ëžěšçĄ˘¤ł¤Č¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ¤â¤ˇ¤˝¤Ś¤Ç¤Ę¤Ť¤Ă¤ż¤éĄ˘ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎŔßÄę¤Ď˝ŞÎť¤Ç¤šĄŁ
+
+ Ŕ褺şÇ˝é¤ËĽÓĽÇĽŞĽŤĄźĽÉ¤ËÂĐąţ¤ˇ¤żĽľĄźĽĐ¤ňÁŞÂň¤ˇ¤Ţ¤šĄŁ¤˝¤ě¤Ť¤éÁŞÂň¤ˇ¤żĽľ
+ ĄźĽĐ¤ËÂĐąţ¤š¤ë README ĽŐĽĄĽ¤Ľë¤ň 'Read README file' ĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆĆɤó
+ ¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ(README ĽŐĽĄĽ¤Ľë¤ŹĚľ¤¤žěšç¤Ď˛ż¤â¤š¤ë¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ)
+
+ Âł¤¤¤ĆĄ˘README ĽŐĽĄĽ¤Ľë¤ËťŘź¨¤ľ¤ě¤Ć¤¤¤ëžěšç¤ĎĄ¤ĽÁĽĂĽ×ĽťĽĂĽČ¤Č Ramdac
+ ¤ňťŘÄꤡ¤Ţ¤šĄŁËؤɤΞěšçĄ˘źŤĆ°ĹޤËĂľĂÎ (¸Ą˝Đ) ¤ľ¤ě¤ë¤Î¤Ç¤ł¤ě¤é¤ňÁŞÂň¤š
+ ¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ĎÄ̞︥˝Đ¤Ç¤­¤Ţ¤ť¤ó¤Î¤ÇĄĘ¤ż¤Ŕ¤ˇÂž¤ÎĽÁĽĂĽ×¤ËÁȤߚţ¤Ţ¤ě¤Ć
+ ¤¤¤ëžěšç¤ň˝ü¤­¤Ţ¤šĄËĄ˘°ěČĚĹŞ¤Ë¤ĎťŘÄꤡ¤Ć¤Ş¤ŻÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ ÉŹÍ×¤ĘĽŞĽ×ĽˇĽçĽó¤Ď°ěÄ̤ęÁŞÂň¤ˇ¤Ć¤Ş¤­¤Ţ¤ˇ¤ç¤Ś( README ¤Ë˝ž¤Ă¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤)ĄŁ
+
+ ¤Ţ¤żĄ˘Ramdac ¤ÎşÇšâźţÇČżô¤ňŔßÄę˝ĐÍč¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î Ramdac ¤ĎÍÍĄš¤Ęźţ
+ ÇČżô¤ňťČ¤Ś¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁĽľĄźĽĐ¤ĎşÇšâÂŽĹ٤ňĂľĂνĐÍč¤Ę¤¤¤Î¤ÇĄ˘ťŘÄꤡ¤Ę
+ ¤Ť¤Ă¤żžěšç¤ĎťŘÄꤡ¤ż Ramdac ¤ÎşÇÄăÂŽĹ٤ňťČÍѤˇ¤Ţ¤šĄŁ
+
+ ¤ľ¤é¤ËĄ˘ĽľĄźĽĐ¤ŹÄĚžďĽáĽâĽęÍĆÎ̤ňĂľĂνĐÍč¤ë¤Ë¤â¤Ť¤Ť¤ď¤é¤şĄ˘ĽÓĽÇĽŞĽŤĄźĽÉ
+ ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëĽáĽâĽę¤ÎÍĆÎ̤â¤Ţ¤żťŘÄę˝ĐÍč¤Ţ¤šĄŁ
+
+ 3.2.4. ĽâĽËĽż
+
+ ĽâĽËĽżĄź¤ŹĽľĽÝĄźĽČ¤š¤ëżĺĘż¤ČżâÄž¤ÎĆą´üźţÇČżôÂÓ°č¤ň˛čĚ̤Ξĺ¤ÎÂĐąţ¤š¤ëĆţ
+ ÎĎÎΰč¤ËĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ°ěÄę¤ÎźţÇČżô¤ŤźţÇČżô¤ÎČϰϤň (ĽĎĽ¤ĽŐĽó¤Çśč
+ ŔڤäĆ) ťŘÄę¤Ç¤­¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î°Ű¤Ę¤ëźţÇČżô¤Ţ¤ż¤ĎČϰϤňĽľĽÝĄźĽČ¤š¤ë¤Č
+ ¤­¤Ë¤ĎĄ˘Ę¤٤ƼŤĽóĽŢ¤ÇśčŔڤäƤŻ¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽâĽËĽżĄź¤ÎĽŢĽËĽĺĽ˘Ľë¤ËĆą´üźţÇČżô¤Ë´Ř¤š¤ëžđĘ󤏸Ť¤Ä¤ą¤é¤ě¤Ę¤¤žěšç¤ĎĄ˘°ě
+ ČĚĹŞ¤ĘĽâĽËĽżĄź¤ÎĆĂŔ­ĂͤΰěÍ÷¤Ť¤é°ě¤ÄÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ě¤ž¤ě¤ÎźţÇČżô
+ ¤Ëšľ¤¨ĚܤοôĂͤňĽľĄźĽĐ¤ŹťČÍѤš¤ë¤Î¤ÇĄ˘¤â¤Ă¤ČÎɤ¤Ŕ­Ç˝¤ŹÍߤˇ¤¤¤Ę¤é¤ĐĄ˘Ľâ
+ ĽËĽżĄź¤ÎĽŢĽËĽĺĽ˘Ľë¤Ť¤éŔľ¤ˇ¤¤żôĂͤňĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 3.2.5. ¤˝¤Îž
+
+ ¿ʏĄ˘¤ł¤ł¤ĎĆɤßČô¤Đ¤ˇ¤Ć¤â¤¤¤¤¤Ť¤âĄŁ
+
+ 3.2.6. š˝ŔŽÄęľÁ¤ÎťĹžĺ¤˛
+
+ žĺľ­¤ňÁ´Éô˝ŞÎť¤ˇ¤ż¤éĄ˘'Done' ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć 'Okay' ĽÜĽżĽó¤Ź˝Đ¤ż¤é˛Ą¤ˇ
+ ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 3.3. ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤ë
+
+ ŔßÄꤡ¤żÁ´¤Ć¤Îžňˇď¤ÇĽÓĽÇĽŞĽŤĄźĽÉ¤ËÂĐąţ¤ˇ¤żĽľĄźĽĐ¤ÎľŻĆ°¤ňťî¤ß¤Ţ¤šĄŁ¤¤¤Ż
+ ¤Ä¤Ť¤ÎÍýÍł¤ÇĽľĄźĽĐ¤ŹľŻĆ°˝ĐÍč¤Ę¤¤žěšç¤ĎĄ˘ÁŞÂň¤ˇ¤Ć¤¤¤ëšç¤Ă¤Ć¤¤¤Ę¤¤ŔßÄę¤ň
+ Ä´¤Ůš˝ŔŽÄęľÁ˛čĚ̤ËĚá¤Ă¤Ć¤â¤Ś°ěĹٝ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 3.4. Â裲ĽľĄźĽĐ
+
+ ťÄÇ°¤Ę¤Ź¤éĄ˘ĽľĄźĽĐ¤ŹľŻĆ°¤ˇ¤ż¤ą¤ě¤É¤â˛čĚ̤ŹĆɤߤˤŻ¤¤žěšç¤ĎĄ˘(ĽĆĽóĽ­Ąź
+ ¤ÎĄÜ¤ňťČ¤Ă¤Ć) Ctrl-Alt-+ ¤ň˛Ą¤ˇ¤Ć°Ű¤Ę¤ëĽÓĽÇĽŞĽâĄźĽÉ¤ËŔÚ¤ęÂؤ¨¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ĆţÎĎÎΰč¤ČŁł¤Ä¤ÎĽÜĽżĽó¤Ź˛čĚ̤ËÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁ
+
+ şÇ˝é¤ÎĽÜĽżĽó¤ĎĽÓĽÇĽŞĽâĄźĽÉ¤ňÄ´Ŕ°¤š¤ë xvidtune ¤ňľŻĆ°¤ˇ¤Ţ¤šĄŁ xvidtune
+ ¤ňťČ¤Ś¤Č¤­¤ËłĐ¤¨¤Ć¤Ş¤Ż¤Ů¤­˝ĹÍפʝö¤Ď xvidtune ¤ÎźÂšÔĂć¤Ď Ctrl-Alt-+ ¤Ç
+ ĽÓĽÇĽŞĽâĄźĽÉ¤ňŔÚ¤ęÂؤ¨¤ë¤ł¤Č¤Ź˝ĐÍč¤Ę¤¤ťö¤Ç¤šĄŁ¤č¤Ă¤ĆĄ˘ĽŢĽŚĽš¤ň¤ł¤ě¤é¤Î
+ ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć¤¤¤ë¤Č¤­¤Ë°ÜĆ°¤ˇ¤Ę¤¤¤č¤Ś¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁśöÁł¤ËĄ˘ĽâĽË
+ ĽżĄź¤Ë¸Ť¤ä¤š¤¤˛čĚ̤ňÉ˝ź¨¤ˇ¤Ę¤¤¤č¤Ś¤ĘĽÓĽÇĽŞĽâĄźĽÉ¤ËŔÚ¤ęÂؤ¨¤ż¤Č¤­¤ĎĄ˘¤â
+ ¤Ś°ěĹŮĽŢĽŚĽšĽÜĽżĽó¤ň˛Ą¤š¤ČźĄ¤ÎĽâĄźĽÉ (¤Ś¤Ţ¤Ż¤¤¤ą¤Đ¸Ť¤ä¤š¤¤ĽâĄźĽÉ) ¤Ë°Ü
+ Ć°¤š¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ Ł˛ČÖĚܤμܼżĽó¤ÇĆţÎĎÎΰč¤ËŔßÄęžđĘó¤ň˝ń¤­šţ¤ŕĽŐĽĄĽ¤ĽëĚž¤ňĆţÎϤš¤ë¤ł¤Č¤Ź
+ ¤Ç¤­¤Ţ¤šĄŁŔßÄęžđĘó¤ňłĘÇź¤ˇ¤ż¤Č¤¤¤ŚĽáĽĂĽťĄźĽ¸¤ŹÉ˝ź¨¤ľ¤ě¤ż¤éşîśČ¤Î˝ŞÎť¤Î
+ šçżŢ¤Ç¤šĄŁ'Okay' ĽÜĽżĽó¤ň˛Ą¤ˇ¤ż¤é¤Ş¤ˇ¤Ţ¤¤¤Ç¤šĄŁ
+
+ ¤˝¤ˇ¤ĆŁłČÖĚܤμܼżĽó¤ĎŔßÄęžđĘó¤ňłĘÇź¤ˇ¤Ę¤¤¤ÇĽ×ĽíĽ°ĽéĽŕ¤ň˝ŞÎť¤ˇ¤Ţ¤šĄŁ
+
+ 3.5. şÇ¸ĺ¤Ë
+
+ ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤Ă¤ż¤é `Configuration complete.' ¤Č¤¤¤ŚĽáĽĂĽťĄźĽ¸¤ň
+ É˝ź¨¤ˇ¤Ţ¤šĄŁ¤ľ¤ĆĄ˘ťČ¤¨¤ëš˝ŔŽžđĘó¤ňźę¤Ë¤ˇ, X ĽľĄźĽĐ¤ňť×¤¤Ä̤ę¤ÎĘýËĄ
+ ('startx' ĽłĽŢĽóĽÉ¤Č¤Ť 'xdm' ˇĐÍł ) ¤ÇľŻĆ°˝ĐÍč¤Ţ¤šĄŁ
+
+ 4. xf86config¤ňźÂšÔ¤š¤ë
+
+ ĽĆĽ­ĽšĽČ˛čĚ̤Ť¤é xf86config ¤Č¤¤¤ŚĽ×ĽíĽ°ĽéĽŕ¤ňźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎĽ×Ľí
+ Ľ°ĽéĽŕ¤Ď root ¤Ë¤Ę¤Ă¤Ć (ŔäÂФËÉŹżÜ¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘xf86config ¤Ź
+ ¤č¤ęÂż¤Ż¤ÎťĹťö¤ň¤ˇ¤Ţ¤š) źÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĂćťßʸťú (Ä̞異Control-C Ľ­
+ Ąźźă¤ˇ¤Ż¤Ď Delete Ľ­Ąź¤Ç¤š) ¤ňĽ×ĽíĽ°ĽéĽŕ¤ňťß¤á¤ż¤¤¤Čť×¤Ă¤ż¤éĄ˘¤¤¤Ä¤Ç¤â
+ ˛Ą¤š¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ¤š¤°¤Ë¤ä¤ęÄž¤ˇ¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ xf86config ¤ĎÉŹÍפʺîśČ¤ň˛čĚ̤ËÉ˝ź¨¤š¤ëťČÍŃËĄ¤ňÄ󜥤ˇ¤Ţ¤šĄŁźĄ¤Îʸ˝ń¤Ď
+ şîśČ¤Î˛áÄř¤Îż§Ąš¤ĘĂĘłŹ¤Ç¤ÎĂí°Őťöšŕ¤Ç¤šĄŁ¤ł¤Îʸ˝ń¤Ë¤ĎşîśČ¤ňźęÁ᤯šÔ¤¨Ą˘
+ Ľ×ĽíĽ°ĽéĽŕ¤ňźÂšÔ¤š¤ëÁ°¤Ë˛ż¤Źˇë˛Ě¤Č¤ˇ¤ĆĆŔ¤é¤ě¤ë¤Ť¤ňĂΤꤿ¤¤żÍ¸ţ¤ą¤Ë˝ń¤¤
+ ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 4.1. şÇ˝é¤Î˛čĚĚ
+
+ ¤Ţ¤şşÇ˝é¤ËĄ˘xf86config ¤Ď XF86Config ĽŐĽĄĽ¤Ľë¤ňŔßÄꤚ¤ë¤Î¤Ë˝ő¤ą¤Ë¤Ę¤ë
+ ťöĄ˘¤Ţ¤ż¤ĎĽ¨ĽÇĽŁĽż¤ÇźęşîśČ¤ÇšÔ¤Śťö¤ňžŻ¤ˇÉ˝ź¨¤ˇ¤Ţ¤šĄŁ˛ż¤ňź¨¤ˇ¤Ć¤¤¤ë¤ŤĆÉ
+ ¤ó¤Ŕ¤é Enter ¤ň˛Ą¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 4.2. Ŕľ¤ˇ¤¤ PATH ¤ňĆŔ¤ë
+
+ Ľ×ĽíĽ°ĽéĽŕ¤ĎźĄ¤Ë /usr/X11R6 ¤Č¤¤¤ŚĽÇĽŁĽěĽŻĽČĽę (ɸ˝ŕĆłĆţĽÇĽŁĽěĽŻĽČĽę)
+ ¤ŹĽˇĽšĽĆĽŕ¤Ë¤˘¤ë¤ŤÄ´¤Ů PATH ´Äś­ĘŃżô¤ËÄɲ䚤ëÉŹÍפŹ¤˘¤ë¤ł¤Č¤ňÉ˝ź¨¤ˇ¤Ţ
+ ¤šĄŁ
+
+ XFree86 (3.0 ¤č¤ęÁ°) ¤ŹťČ¤Ă¤Ć¤¤¤ż /usr/X386 ĽÇĽŁĽěĽŻĽČĽę¤Ź¤˘¤ë¤Ť¤âÄ´¤Ů
+ ¤Ţ¤šĄŁśöÁł¤Ë¸Ť¤Ä¤Ť¤Ă¤żžěšçĄ˘ /usr/X386 ¤ÎÁ°¤Ë /usr/X11R6 ¤ň PATH ¤ËÄę
+ ľÁ¤š¤ë¤č¤Ś¤ËˇŮšđ¤ˇ¤Ţ¤šĄŁ
+
+ Á´¤Ć¤ŹÂçžćÉפʤé¤ĐĄ˘Enter ¤ň˛Ą¤ˇ¤ĆźĄ¤Ë¤¤¤­¤Ţ¤ˇ¤ç¤ŚĄŁ¤ľ¤â¤Ę¤ą¤ě¤ĐĄ˘
+ Control-C ¤ň˛Ą¤ˇ¤Ć˝ŞÎť¤ˇ¤ĆÉŹÍפĘĘŃšš¤ň¤ˇ¤Ć xf86config ¤ňşĆľŻĆ°¤ˇ¤Ć¤Ż¤Ŕ
+ ¤ľ¤¤ĄŁ
+
+ 4.3. ĽŢĽŚĽš¤ÎŔßÄę
+
+ ĽáĽËĽĺĄź¤Ť¤éĽŢĽŚĽš¤ÎĽżĽ¤Ľ×¤ňÁޤó¤ÇŔÜÂł¤ˇ¤Ć¤¤¤ëĽŢĽŚĽš¤ÎĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ
+ Ěž¤ňÄžŔÜĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Xserver ¤ŹťČ¤ŚĽŢĽŚĽšĽÉĽéĽ¤ĽĐ¤ňĆ⢤ˇ¤Ć¤¤¤ë OS (Î㤨¤Đ SVR4, SCO) ¤ň
+ ťČ¤Ă¤Ć¤¤¤ëžěšç¤ĎĄ˘ĽŢĽŚĽš¤ÎŔßÄę¤Ď XF86Config ĽŐĽĄĽ¤Ľë¤ňĘÔ˝¸¤ˇ¤ĆĽŢĽŚĽš¤ň
+ ŔßÄꤡ¤Ę¤ą¤ě¤ĐÉŹÍפŹ¤˘¤ë¤Î¤ÇĄ˘ĹŹĹö¤ĘĽŢĽŚĽš¤ň°ěÍ÷¤Ť¤éÁŞÂň¤ˇĽÇĽĐĽ¤ĽšĽÉĽé
+ Ľ¤ĽĐĚž¤ÎąţĹú¤Ď Ľ¨ĽóĽżĄźĽ­Ąź¤ň˛Ą¤ˇ¤Ć¤Ş¤­¤Ţ¤ˇ¤ç¤Ś
+
+ ĽŢĽŚĽš¤Ź¤É¤ÎĽ×ĽíĽČĽłĽë¤ňťČ¤Ă¤Ć¤¤¤ë¤ŤĂΤé¤Ę¤¤žěšçĄ˘żäÂŹ¤ˇ¤Ć (xf86config
+ ¤ĎÂçÂÎť÷¤ż¤â¤Î¤Î¤¤¤Ż¤Ä¤ŤĽŇĽóĽČ¤ň˝Đ¤ˇ¤Ţ¤š)˛ź¤ľ¤¤ĄŁ¤˝¤ě¤Ť¤éĽľĄźĽĐ¤ňľŻĆ°
+ ¤ˇ¤żťţĽŢĽŚĽš¤ŹĆ°¤Ť¤Ę¤¤žěšçĄ˘ĽČĽéĽÖĽëĽˇĽĺĄźĽĆĽŁĽóĽ°¤ÎžĎ¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 4.4. Ľ­ĄźĽÜĄźĽÉ¤ÎŔßÄę
+
+ Ľ­ĄźĽÜĄźĽÉ¤ÎŔßÄę¤Ë´Ř¤ˇ¤Ć¤ĎĂą¤ËźÁĚä¤Ë yes ¤ČĹú¤¨¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ˛ż¤ŤÂž¤ÎĘŞ¤Î°Ů¤ËąŚĽŞĽëĽżĽÍĄźĽČĽ­Ąź¤ČĽłĽóĽČĽíĄźĽëĽ­Ąź¤ČťČ¤ŚÉŹÍפŹ¤˘¤ë¤Č
+ ¤­¤Ď no ¤ňĹú¤¨¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ 4.5. ĽâĽËĽż¤ÎŔßÄę
+
+ ĽâĽËĽż¤ÎťĹÍͤȡżĚž¤ČŔ˝Â¤˛ńźŇ¤Ë°ěĂפš¤ëšŕĚܤňŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ şÇ˝é¤Ëżĺʿƹ´üźţÇČżô¤ňÄ´¤Ů¤Ţ¤ˇ¤ç¤ŚĄŁĽŢĽËĽĺĽ˘Ľë¤ň¸Ť¤ĆŔľ¤ˇ¤¤żôĂͤňĆţÎϤš
+ ¤ë¤ł¤Č¤Ď ÂçĘŃ ˝ĹÍפǤšĄŁĽâĽËĽż¤ÎźţÇČżô¤ČĆţÎĎźţÇČżô¤ÎČϰϤΤɤ줍¤Ź¤Ő¤ľ
+ ¤ď¤ˇ¤¤žěšçĄ˘¤˝¤ě¤ňÁŞÂň¤ˇĄ˘¤ľ¤â¤Ę¤ą¤ě¤Đ custom ¤ňÁŞÂň¤ˇ¤ĆĽŢĽËĽĺĽ˘Ľë¤Ëľ­
+ şÜ¤ľ¤ě¤Ć¤¤¤ëżôĂͤňĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ źĄ¤ËżâĞƹ´üźţÇČżô¤Ç¤šĄŁ¤ł¤ě¤âŔľłÎ¤ËťŘÄꤚ¤ëťö¤Ď ÂçĘŃ˝ĹÍפǤšĄŁżĺʿƹ
+ ´üźţÇČżô¤ČĆą¤¸ĘýËĄ¤ÇĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤¤¤ş¤ě¤Ť¤ÎźţÇČżô¤ň´Ö°ă¤¨¤ĆŔßÄꤡ¤żžěšçĄ˘ĽâĽËĽż¤ňÄˤá¤ëžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ şÇ¸ĺ¤ËĄ˘"źąĘĚĚž" ("identifier")¤Č¤ˇ¤ĆĽâĽËĽż¤ÎŔ˝Â¤˛ńźŇ¤ČˇżĚž¤ňÄ´¤Ů¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤é¤ňźęÁ᤯ĆţÎϤˇ¤ĆĽ¨ĽóĽżĄźĽ­Ąź¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ 4.6. ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎÁŞÂň
+
+ źĄ¤ËĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽÇĄźĽżĽŮĄźĽš¤ň¸Ť¤ż¤¤¤ŤĘš¤¤¤Ć¤­¤Ţ¤šĄŁ°ěÍ÷¤Ť¤éĽÓĽÇĽŞĽŤ
+ ĄźĽÉ¤ňÁŞ¤Ö¤ČźĄ¤ÎŁ˛¤Ä¤ÎžĎ¤ÎźÁĚä¤ËĹú¤¨¤Ćľ­Ćţ¤š¤ë¤ł¤Č¤Çťţ´Ö¤ŹžŻ¤ˇŔáĚó¤Ç¤­
+ ¤Ţ¤šĄŁ
+
+ °ěÍ÷¤ËĽÓĽÇĽŞĽŤĄźĽÉ¤Ź¸ŤĹö¤ż¤é¤Ę¤¤žěšç¤Ď q ˛Ą¤ˇ¤ĆĽ¨ĽóĽżĄźĽ­Ąź¤ň˛Ą¤ˇ¤ĆźĄ
+ ¤ÎĂĘłŹ¤ňČô¤Đ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ˇ¤ĆźŤĘŹ¤ÇĚäÂę¤ËĹú¤¨¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ 4.7. ĽľĄźĽĐ¤ÎÁŞÂň
+
+ Á°¤ÎĂĘłŹ¤ÇĽÓĽÇĽŞĽŤĄźĽÉ¤ňÁŞÂň¤ˇ¤żžěšçĄ˘ĽľĄźĽĐ¤ÎÁŞÂň¤ĎÍưפǤšĄŁĽÇĄźĽżĽŮ
+ ĄźĽš¤Ť¤é¤ÎżäÁŚ¤ľ¤ě¤ż¤â¤Î¤ňťČ¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĆĂÄę¤ÎĽľĄźĽĐ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ(Mach8, Mach32, Mach64, AGX/XGA, 8514/A, S3,
+ ET4000/W32, I128, P9000)¤ÎĆ⥢ĽÓĽÇĽŞĽŤĄźĽÉ¤Ź¤É¤ě¤Ť¤Ę¤é¤Đ accel ĽŞĽ×
+ ĽˇĽçĽó¤ňÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤â¤ˇ¤˝¤Ś¤Ç¤Ę¤Ť¤Ă¤ż¤é¿ʏ SVGA ĽľĄźĽĐ¤ňťČÍѤˇ¤ż¤¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ źĄ¤ËĄ˘ĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ňŔßÄꤡ¤ż¤¤ĽľĄźĽĐ¤Ź¤˘¤ëžěšçĄ˘Ľ×ĽíĽ°ĽéĽŕ¤ŹĘš¤¤
+ ¤Ć¤­¤ż¤é yes ¤ňĹú¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁaccel ĽŞĽ×ĽˇĽçĽó¤ňÁŞÂň¤ˇ¤żžěšç¤ĎĄ˘ĽęĽó
+ ĽŻ¤š¤ëĆĂÄę¤ÎĽ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐ¤ňťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 4.8. ĽšĽŻĽęĄźĽó/ĽÓĽÇĽŞĽŤĄźĽÉ¤Îš˝ŔŽ
+
+ ĽáĽâĽęÎ̤ȡżĚž°ěÍ÷¤Ť¤éĽÓĽÇĽŞĽŤĄźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëĹŹŔÚ¤ĘĽŞĽ×ĽˇĽçĽó¤ňÁŞÂň
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤˝¤Î¤Č¤­Íż¤¨¤ëĽÓĽÇĽŞĽŤĄźĽÉ¤ÎźąĘĚĚžĄ˘Ŕ˝Â¤˛ńźŇ¤ČˇżĚž¤ňĹú¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł
+ ¤ÎŔßÄę¤ňČô¤Đ¤ˇ¤ż¤¤¤Č¤­¤ĎĄ˘¤ż¤ŔĽ¨ĽóĽżĄźĽ­Ąź¤ň˛Ą¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+ źĄ¤ËĽÓĽÇĽŞĽŤĄźĽÉ¤Î RAMDAC ¤ČĽÁĽĂĽ×ĽťĽĂĽČ¤ÎˇżĚž¤ňĹú¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽÇĄźĽż
+ ĽŮĄźĽš¤ËĽÓĽÇĽŞĽŤĄźĽÉ¤Ź¤˘¤ëžěšç¤ĎĽÇĄźĽżĽŮĄźĽš¤Î¸Ąş÷ˇë˛Ě¤ňťŘÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ĽÓĽÇĽŞĽŤĄźĽÉ¤Î RAMDAC ¤ČĽÁĽĂĽ×ĽťĽĂĽČ¤Ź°ěÍ÷¤Ë¤Ę¤Ť¤Ă¤żžěšçĄ˘ˇżĚž¤ňĘš¤¤¤Ć
+ ¤­¤ż¤Č¤ł¤í¤Ç¤ż¤ŔĄ˘Ľ¨ĽóĽżĄźĽ­Ąź¤ň˛Ą¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤Î
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ňťý¤Ă¤Ć¤¤¤Ę¤¤žěšçĄ˘Ľ×ĽíĽ°ĽéĽŕ¤ŹĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ŹĽľĽÝĄźĽČ¤ˇ
+ ¤Ć¤¤¤ëźţÇČżô¤ňĂľ¤š¤č¤Ś¤ËĂľĂΤˇ¤č¤Ś¤Č¤ˇ¤Ţ¤šĄŁ
+
+ 4.9. ĽâĄźĽÉ¤ÎÁŞÂň
+
+ ¤ľ¤Ć¤É¤ó¤ĘĽÓĽÇĽŞĽâĄźĽÉ¤ňźÂšÔ¤ˇ¤ż¤¤¤Î¤Ť¤ňĽ×ĽíĽ°ĽéĽŕ¤Ëśľ¤¨¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ Ľ×ĽíĽ°ĽéĽŕ¤ĎĽÓĽÇĽŞĽŤĄźĽÉ¤ŹĆ°şî¤š¤ë°ěČĚĹŞ¤ĘĽÓĽÇĽŞĽâĄźĽÉ¤ňÉ˝ź¨¤ˇ¤Ţ
+ ¤šĄŁ(¤Şźę¸ľ¤ÎĽâĽËĽżĄź¤Ç¤Ď¤¤¤Ż¤Ä¤Ť¤ÎĽâĄźĽÉ¤ĎĆ°şî¤ˇ¤Ę¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤ó
+ ¤ŹĄ˘ĽâĽËĽż¤ÎĆą´üźţÇČżô¤ňŔľ¤ˇ¤ŻŔßÄꤚ¤ě¤ĐĄ˘X ĽľĄźĽĐ¤ŹźÂšÔťţ¤ËĆ°¤Ť¤Ę¤¤Ľâ
+ ĄźĽÉ¤ňĚľťë¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ)
+
+ şŁ¤Ţ¤Ç¤ÎŔßÄę¤ňźő¤ąĆţ¤ě¤Ć¤â˝ç˝ř¤ňĆţ¤ěÂؤ¨¤ż¤¤¤Čť×¤Ś¤Ç¤ˇ¤ç¤ŚĄŁÎ㤨¤Đ 1
+ ĽáĽŹĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĽÓĽÇĽŞĽŤĄźĽÉ¤Źťý¤Ă¤Ć¤¤¤żžěšçĄ˘ĽÓĽÇĽŞĽâĄźĽÉ¤ň
+
+ "640x480" "800x600" "1024x768" ¤ň 8bpp ÂĐąţ¤Ë
+
+ ŔßÄꤡ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 1 ¤ňÁŞÂň¤š¤ë¤Č 8bpp ¤ÎŔßÄę¤ňĘŃšš¤ˇ¤ĆĄ˘432 ¤ČĆţÎϤš¤ë¤ČľŐ˝ç¤ňÁŞÂň¤š¤ë¤ł
+ ¤Č¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ ŔßÄꤡ¤ż¤¤˝ç˝ř¤ÎĽÓĽÇĽŞĽâĄźĽÉ¤ňÁŞÂň¤ˇ¤ż¤¤ťţ¤Ď 4 ¤ňÁŞÂň¤ˇ¤ĆÂł¤ą¤Ţ¤ˇ¤ç
+ ¤ŚĄŁ
+
+ 4.10. XF86Config ĽŐĽĄĽ¤Ľë¤ÎşîŔŽ
+
+ ŔßÄꤡ¤żš˝ŔŽžđĘó¤ň XF86Config ĽŐĽĄĽ¤Ľë¤Ë˝ń¤­šţ¤ŕ¤Č¤­¤ËĽ×ĽíĽ°ĽéĽŕ¤ŹĘš¤¤
+ ¤Ć¤­¤Ţ¤š¤Î¤Ç yes ¤ňĹú¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 4.11. şÇ˝ŞĂí°Őťöšŕ
+
+ şÇ¸ĺ¤Ë¤ł¤ÎşîśČ¤ň˝ŞÎť¤š¤ëłÎǧ¤Čš˝ŔŽžđĘóĽŐĽĄĽ¤Ľë¤ňłÎǧ¤ˇ¤Ć¤Ť¤éťČÍѤš¤ë¤ł
+ ¤Č¤ÎĂéšđ¤ňÉ˝ź¨¤ˇ¤Ţ¤šĄŁźĄ¤ÎžĎ¤ÇÉŹÍפĘĘŃšššŕĚܤˤĤ¤¤ĆŔâĚŔ¤ˇ¤Ţ¤šĄŁ
+
+ 5. XF86Config ĽŐĽĄĽ¤Ľë¤Î˝¤Ŕľ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤ňĽ¨ĽÇĽŁĽż¤ÇłŤ¤¤¤Ć¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĘŃšš¤š¤ëÉŹÍפŹ¤˘¤ë
+ ÉôĘŹ¤Ź¤˘¤ę¤Ţ¤šĄŁ:
+
+ o ĽŢĽŚĽšĽÉĽéĽ¤ĽĐ¤ňĆ⢤ˇ¤Ć¤¤¤ëĽŞĽÚĽěĄźĽĆĽŁĽóĽ°ĽˇĽšĽĆĽŕ¤ňťČÍѤˇ¤Ć¤¤¤ë
+ žěšçĄ˘Pointer Ŕá¤ňĘŃšš¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁĆä˥˘Protocol ¤ň OSMouse
+ (SCO ¤Îžěšç) ¤Ë¤Ţ¤ż¤ĎĄ˘Xqueue(SVR4, ¤¤¤Ż¤Ä¤Ť¤Î SVR3 ¤Îžěšç) ¤ËŔßÄę
+ ¤ˇ¤Ć Device šÔ¤ňşď˝ü¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o Xqueue Ľ¤ĽŮĽóĽČĽÉĽéĽ¤ĽĐźă¤Ż¤Ďť÷¤ż¤č¤Ś¤ĘĽÉĽéĽ¤ĽĐ¤ňťČÍѤˇ¤Ć¤¤¤ëĽˇĽšĽĆ
+ Ľŕ¤ň˛ÔĆŻťČÍѤˇ¤Ć¤¤¤ëžěšçĄ˘ Keyboard Ŕá¤Î Protocol ¤ÎŔßÄę¤ň Xqueue
+ ¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ °ěĂśĄ˘š˝ŔŽžđĘó¤ŹŔľ¤ˇ¤¤¤ČËţ­¤ˇ¤ż¤éĄ˘XF86Config ĽŐĽĄĽ¤Ľë¤ň
+ /usr/X11R6/lib/X11 ¤ËĽłĽÔĄź¤ˇ¤Ć 'startx' ĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ¤ľ¤Ć X ĽľĄźĽĐ¤Ź˛ÔĆŻ¤ˇ¤Ţ¤ˇ¤żĄŁX ĽľĄźĽĐ¤Ź˛ÔĆŻ¤ˇ¤ż¤ą¤ě¤Éť×¤Ă¤ż¤č¤ęÎɤ¤É˝
+ ź¨˛čĚ̤ǤϤʤ¤ (Î㤨¤ĐÁ´˛čĚĚÉ˝ź¨¤Ë¤Ę¤Ă¤Ć¤¤¤Ę¤¤¤Č¤ŤĄ˘Ăćąű¤Ť¤é¤Ď¤ş¤ě¤Ć¤¤
+ ¤ë¤Č¤ŤĄ˘ĎƤ˲ö¤ęšţ¤ó¤Ç¤¤¤ëĹů) žěšçĄ˘ xvidtune ¤ÎžĎ¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤Î
+ ž¤ÎĚäÂꤏ¤˘¤ëžěšçĄ˘ĽČĽéĽÖĽëĽˇĽĺĄźĽĆĽŁĽóĽ°¤ÎžĎ¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6. xvidtune ¤ňźÂšÔ¤š¤ë
+
+ ˛čĚĚÉ˝ź¨¤ňÄ´Ŕ°¤ˇ¤ż¤¤žěšçĄ˘xvidtune ĽłĽŢĽóĽÉ¤ŹťČ¤¨¤Ţ¤šĄŁ
+
+ xterm ¤ÎĽˇĽ§ĽëĽ×ĽíĽóĽ×ĽČ¤Ť¤éĂą¤Ë xvidtune ¤ČĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁˇŮšđ¤ňĆÉ
+ ¤ó¤Ç OK ¤ňĽŻĽęĽĂĽŻ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁźĄ¤Ë Auto ĽÜĽżĽó¤ňĽŻĽęĽĂĽŻ¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ žĺ/˛ź/ş¸/ąŚ (Up/Down/Left/Right) ¤ä˝ÄžŽ/˝ÄÂç/˛ŁÂç/˛ŁžŽ
+ (Shorter/Taller/Wider/Narrower) ¤ňÁȤߚç¤ď¤ť¤Ćť×¤Ă¤ż¤Č¤Ş¤ę¤ÎÉ˝ź¨¤ËÄ´Ŕ°
+ ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ şÇśá¤Î S3 ĹëşÜ¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤Ç¤Ď¤¤¤Ż¤Ä¤Ť¤ÎĘ̤μܼżĽó¤ČĆţÎĎšŕĚÜ
+ (InvertVCLK, EarlySC ¤Č Blank Delays) ¤Ź˛čĚ̤βź¤Î¤Ű¤Ś¤Ë¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+ żôĽÔĽŻĽťĽë¤Î˛čĚ̤βö¤ęšţ¤ß¤ÎĚäÂę¤ň˛ňˇč¤š¤ëĘä˝ő¤Ë¤Ę¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ °ěĂś¤Á¤ă¤ó¤Č˛čĚ̤ňÄ´Ŕᤡ¤ż¤éĄ˘show ĽÜĽżĽó¤ň˛Ą¤ˇ¤ĆŔľ¤ˇ¤¤ ModeLine ¤ň°ő
+ şţ¤ˇ¤ĆĄ˘¸˝şß¤Î˛čĚ̤ÎŔßÄę¤ňžďťţťČ¤Ś¤č¤Ś¤Ë XF86Config ĽŐĽĄĽ¤Ľë¤ËŔß
+ Äꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ¸˝şß¤Î˛čĚĚžđĘó¤ň XF86Config ĽŐĽĄĽ¤Ľë¤ËĽłĽÔĄź¤š¤ë´ĘĂą¤ĘĘý
+ ËĄ¤ĎĄ˘¸˝şß¤Î modeline ¤ÎŔßÄę¤ňĽ¨ĽÇĽŁĽż¤ÎĘý¤ËĽÚĽ¤ĽšĽČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ž¤ÎĽÓĽÇĽŞĽâĄźĽÉ¤ňÄ´Ŕ°¤ˇ¤ż¤¤žěšç¤ĎĄ˘Next ¤Č Prev ĽÜĽżĽó¤ňĽŻĽęĽĂĽŻ¤ˇ¤Ć
+ ĽÓĽÇĽŞĽâĄźĽÉ¤ňŔÚ¤ęÂؤ¨¤Ć˛ź¤ľ¤¤ĄŁ
+
+ xvidtune ¤ň˝Ş¤ď¤ę¤ż¤¤¤Č¤­¤ĎĂą¤Ë Quit ĽÜĽżĽó¤ň˛Ą¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7. ĽČĽéĽÖĽëĽˇĽĺĄźĽĆĽŁĽóĽ°
+
+ ¤ł¤ł¤Ţ¤ÇĆɤó¤Ç¤¤¤ë¤Î¤ĎĄ˘˛ż¤ŤËž¤ó¤ŔÄ̤ę¤Îˇë˛Ě¤ŹĆŔ¤é¤ě¤Ć¤¤¤Ę¤¤ĄĘ¤Ţ¤ż¤ĎĄ˘
+ łÚ¤ˇ¤ó¤ÇĆɤó¤Ç¤¤¤ż¤Ŕ¤¤¤Ć¤¤¤ëĄË¤Î¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ °Ę˛ź¤Ď°ěÍ÷¤Ë¤Ę¤Ă¤ż¤¤¤Ż¤Ä¤Ť¤Î°ěČĚĹŞ¤ĘŔßÄęşîśČĂć¤ËÎɤŻŔ¸¤¸¤ëĚäÂę¤ä˛ňˇč¤Î
+ ĽŇĽóĽČ¤Ç¤šĄŁ¤ˇ¤Ť¤ˇ¤Ę¤Ź¤éĄ˘ĽĎĄźĽÉĽŚĽ§Ľ˘¤ČĽ˝ĽŐĽČĽŚĽ§Ľ˘¤ÎŔßÄę¤ÎËÄÂç¤ĘÁȤß
+ šç¤ď¤ť¤Ź¤˘¤ęĄ˘¤˝¤ł¤ÇĄ˘ËÄÂç¤ĘÉÔśńšç¤ŹŔ¸¤¸¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ¤ł¤Îʸ˝ń¤Č
+ ĽÄĄźĽë¤Îʸ˝ń¤Ç¤ĎÁ´¤Ć¤Îžěšç¤Ë¤Ä¤¤¤Ć¸ŔľÚ˝ĐÍč¤Ţ¤ť¤óĄŁ
+
+ Á°¤ÎžĎ¤ÇťîšÔ¤ˇ¤żşîśČ¤Č¤ł¤ÎžĎ¤Ç¤ÎĽŇĽóĽČ¤ňłÎǧ¤ˇ¤ż¸ĺ¤ÇĄ˘ĽˇĽšĽĆĽŕ¤Ź˛ÔĆŻ¤ˇ
+ ¤Ę¤¤žěšç¤ĎĄ˘Á´¤Ć¤Îʸ˝ń¤ňĆɤŕÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤Şźę¸ľ¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤Č OS
+ (¤â¤ˇ¤˘¤ě¤Đ) ¤ËÂĐąţ¤ˇ¤Ć¤¤¤ë README ĽŐĽĄĽ¤Ľë ¤Č ĄÖXFree86 ¤ÎŔßÄę¤Ë¤Ä¤¤
+ ¤ĆĄ× (XFree86 Configuration Guide : README.Config) ¤Č XF86Config ĽŞĽó
+ ĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë ¤ňĆɤó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĆäˤŤ¤Ę¤ężˇ¤ˇ¤¤ĽÓĽÇĽŞĽŤĄźĽÉ¤Ë¤Ä¤¤¤Ć¤ÎşÇżˇ¤ÎžđĘó¤Ď the XFree86 FAQ
+ <http://www.XFree86.org/FAQ> ¤âĄ˘¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Á´ÁłÂĚĚܤʞěšç¤ĎĄ˘comp.windows.x.i386unix ¤Ť comp.os.linux.x ¤Ëľ­ťö¤ň
+ ĹęšĆ¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤Ţ¤ż¤Ď XFree86@XFree86.org ¤ËĹŝҼᥟĽë¤ňÁ÷¤Ă¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁĚőĂí : ąŃ¸ě¤Ç¤Ş´ę¤¤¤ˇ¤Ţ¤š:-)
+
+ 7.1. ĽŢĽŚĽš¤Ź¤Á¤ă¤ó¤ČĆ°¤Ť¤Ę¤¤ĄŁ¤Ä¤Ţ¤ę˛čĚ̤ËÄĽ¤ęÉŐ¤¤¤ż¤Ţ¤ŢĆ°¤Ť¤Ę¤¤ĄŁ
+
+ ÁŞÂň¤ˇ¤żĽŢĽŚĽš¤ÎĽ×ĽíĽČĽłĽë¤ŹÎɤŻ¤˘¤ę¤Ţ¤ť¤óĄŁ°ă¤ŚĽ×ĽíĽČĽłĽë¤ňťî¤ˇ¤Ć¤ß¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ
+
+ 7.2. ĽľĄźĽĐ¤ŹľŻĆ°¤ˇ¤Ę¤¤ĄŁ¤ł¤ÎťţĽŢĽŚĽš¤ŹťČÍѺѤߤǤ˘¤ë¤ČÉ˝ź¨¤ľ¤ě¤ëĄŁ
+
+ ¤ľ¤ĆĄ˘¤ł¤ÎżÇĂǤĎ¿ʏŔľ¤ˇ¤¤¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤Î¸˝žÝ¤Ď Linux ĽˇĽšĽĆĽŕ¤Ç gpm ¤Ź
+ Ć°şî¤ˇ¤Ć¤¤¤ëťţ¤ËÎɤŻľŻ¤ł¤ę¤Ţ¤šĄŁgpm Ľ×ĽíĽťĽš¤ňťß¤á¤Ć startx ¤ň¤â¤Ś°ěĹŮ
+ źÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7.3. żż¤óĂć¤ÎĽÜĽżĽó¤ŹťČÍŃ˝ĐÍč¤Ę¤¤ĄŁ
+
+ ¤ł¤Î¸˝žÝ¤Ď´ĘĂą¤Ę˛ňˇčşö¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ż¤Ż¤ľ¤óťîšÔşř¸í¤ŹÉŹÍפǤšĄŁĽŢĽŚĽš
+ ¤ÎĽ×ĽíĽČĽłĽë¤ŹŔľ¤ˇ¤¤¤ŤłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Âż¤Ż¤ÎŁłĽÜĽżĽóĽŢĽŚĽš¤ĎŁ˛ĽÜĽżĽóĽâĄźĽÉ¤ČŁłĽÜĽżĽóĽâĄźĽÉ¤Î "ΞĘý¤ÎĽ×ĽíĽČĽł
+ Ľë" ¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁŁłĽÜĽżĽóĽâĄźĽÉ¤Ř¤ÎŔÚ¤ęÂؤ¨ĘýËĄ (ÄĚžď MouseSystems
+ Ľ×ĽíĽČĽłĽë¤ňÍѤ¤¤Ţ¤š) ¤ĎĽŢĽŚĽš¤ÎźďÎŕ¤Ë¤č¤Ă¤Ćż§Ąš¤Ç¤šĄŁ
+
+ ĽľĄźĽĐ¤ÎľŻĆ°ťţ¤ËĽŢĽŚĽš¤ËÉŐ¤¤¤Ć¤¤¤ëĽšĽ¤ĽĂĽÁ¤ňĆ°¤Ť¤š¤ŤĄ˘żż¤óĂć¤ÎĽÜĽżĽó¤ň
+ ˛Ą¤ˇÂł¤ą¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁÂž¤ÎĽâĄźĽÉŔÚ¤ęÂؤ¨¤ÎĽľĄźĽĐÂŚ¤ÇšÔ¤ŚĘýËĄ¤ĎĄ˘ĽŢ
+ ĽŚĽš¤ÎŔßÄę¤ÎÁȤߚç¤ď¤ť¤ňŔľ¤ˇ¤ŻšÔ¤ď¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ´°ŕú¤ĘŔßÄę¤Î°ěÍ÷
+ ¤Ź XF86Config ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Î Pointer ¤ÎžĎ¤Ë¤˘¤ë¤Î¤Ç¤ß¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7.4. ˛čĚ̤Źžĺ˛źş¸ąŚ¤ËĘŇ´ó¤ëĄŁ
+
+ xvidtune ¤ÎžĎ¤ň¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7.5. xf86config ¤Ţ¤ż¤Ď xvidtune ¤ŹĽˇĽšĽĆĽŕ¤ÎĂć¤Ë¸Ť¤Ä¤ą¤é¤ě¤Ę¤¤ĄŁ
+
+ ¤ŚĄź¤óĄŁŁł¤Ä¤Î˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ 1. 3.1.2 ¤č¤ę¸Ĺ¤¤ĽĐĄźĽ¸ĽçĽó¤Î XFree86 ¤ňťČ¤Ă¤Ć¤¤¤ëĄŁÂżĘŹĄ˘¤ł¤Îʸ˝ń°Ęł°
+ ¤ňĆɤó¤Ç¤¤¤Ę¤¤žěšç¤Ď 3.1.2 ¤Č¤˝¤ě¤č¤ęÁ°¤ÎĽĐĄźĽ¸ĽçĽó¤Ë¤Ď xf86config
+ ¤Ţ¤ż¤Ď xvidtune ¤Ď´Ţ¤Ţ¤ě¤Ć¤¤¤Ę¤¤¤Ť¤é¤Ç¤šĄŁşÇżˇĽĐĄźĽ¸ĽçĽó¤Ëššżˇ¤ˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. PATH ¤ŹŔľ¤ˇ¤ŻŔßÄꤾ¤ě¤Ć¤¤¤Ę¤¤ĄŁXFree86 ¤ÎĽĐĽ¤ĽĘĽę¤Î bin ĽÇĽŁĽěĽŻĽČ
+ Ľę¤ň´Ţ¤ó¤Ç¤¤¤ë¤ŤłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ(ÄĚžď¤Ď /usr/X11R6/bin¤Ç¤š)
+
+ 3. XFree86 ¤ň´°Á´¤ËĆłĆţ¤ˇ¤Ć¤¤¤Ę¤¤ĄŁ XFree86 ¤ňĆţźę¤ˇ¤ż¤Č¤ł¤í¤ŘĚá¤Ă¤ĆĄ˘
+ ťÄ¤é¤şĆţźę¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml,v 3.2 1996/08/27 03:21:12 dawes Exp
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml,v
+ 3.2 1996/08/27 03:21:12 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/QStart.sgml,v 3.3 1996/11/26 23:10:07 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.FreeBSD b/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.FreeBSD
new file mode 100644
index 000000000..536870667
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.FreeBSD
@@ -0,0 +1,665 @@
+
+
+
+
+
+
+ README for XFree86 3.1.2 on FreeBSD 2.0.5
+ Rich Murphey, David Dawes Ăř
+ 1995ÇŻ7ˇî24Ćü
+ Takefumi Tsukada(ÄÍĹÄšäʸ) Ěő
+
+ ¤ł¤Îʸ˝ń¤ĎXFree86 3.1.2¤Ë´Ţ¤Ţ¤ě¤ëĄ˘README.FreeBSD¤ňĆüËܸěĚő¤ˇ¤ż¤â¤Î¤Ç
+ ¤šĄŁĆâÍƤ˴ؤˇ¤Ć¤Ď¤Ű¤Č¤ó¤É˝¤Ŕľ¤ˇ¤Ć¤¤¤Ţ¤ť¤ó¤Î¤Ç¸Ĺ¤¤ĆâÍƤâťÄ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ 1. XFree86¤Č¤Ď
+
+ XFree86¤ĎĄ˘żôĄš¤ÎĽĐĄźĽ¸ĽçĽó¤ÎĽ¤ĽóĽĆĽëĽŮĄźĽš¤ÎUNIX¤ňĽľĽÝĄźĽČ¤š¤ëĄ˘X11R6
+ ¤Î°Üż˘ĘޤǤšĄŁ¤˝¤ÎľŻ¸ť¤ĎX11R5¤ČśŚ¤ËÇŰÉۤľ¤ě¤żXĽľĄźĽĐ¤Ç¤˘¤ëX386 1.2¤ËÁĚ
+ ¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁËÜĽęĽęĄźĽš¤ĎÂż¤Ż¤ÎĽĐĽ°FIX¤Ŕ¤ą¤Ç¤Ę¤ŻĄ˘Âż¤Ż¤ÎżˇľĄÇ˝
+ ĄŚŔ­Ç˝˛ţÁą¤Ë¤č¤ęš˝ŔŽ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁËÜĽęĽęĄźĽš¤ĎĄ˘XĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤ÎX11R6
+ ¤ËÂФš¤ëĽ˝ĄźĽšĽŃĽĂĽÁ¤Č¤ˇ¤ĆĄ˘¤Ţ¤żĄ˘Âż¤Ż¤ÎĽ˘ĄźĽ­ĽĆĽŻĽÁĽăÍѤ˼м¤ĽĘĽęĽłĄź
+ ĽÉ¤Č¤ˇ¤ĆĆţźę˛ÄÇ˝¤Ç¤šĄŁ
+
+ Ăřşî¸˘šđĂΤˤĤ¤¤Ć¤ĎĄ˘Copyright Notice (COPYRIGHT.html) ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁ
+
+ XFree86¤ÎĽ˝ĄźĽšĽłĄźĽÉ¤Ď°Ę˛ź¤Îanonymous FTPĽľĽ¤ĽČ¤č¤ęĆţźę˛ÄÇ˝¤Ç¤šĄŁ
+
+ ftp.XFree86.org:/pub/XFree86/current
+ (ftp://ftp.XFree86.org/pub/XFree86/current)
+
+ XFree86¤ÎFreeBSDÍŃĽĐĽ¤ĽĘĽęĽłĄźĽÉ¤Ď°Ę˛ź¤Îanonymous FTPĽľĽ¤ĽČ¤č¤ęĆţźę˛Ä
+ Ç˝¤Ç¤šĄŁ
+
+ ftp.XFree86.org:/pub/XFree86/current/binaries/FreeBSD-2.0.5
+ (ftp://ftp.XFree86.org/pub/XFree86/current/binaries/FreeBSD-2.0.5)
+
+ XFree86.cdrom.com:/pub/XFree86/current/binaries/FreeBSD-2.0.5
+ (ftp://XFree86.cdrom.com/pub/XFree86/current/binaries/FreeBSD-2.0.5)
+
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ë´Ř¤ˇ¤ĆĄ˘ĽłĽáĽóĽČ¤äÄó°Ć¤Ź¤˘¤ëžěšç¤Ë¤ĎĄ˘ Rich-
+ Murphey@Rice.edu ¤Ţ¤ż¤ĎĄ˘XFree86@XFree86.org ¤ËE-Mail¤ňÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+ ¤˝¤ě¤ňČżąÇ¤ľ¤ť¤ë¤ł¤Č¤Ź¤Ç¤­¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+
+ 2. ĽĐĽ¤ĽĘĽęĽłĄźĽÉ¤ÎĽ¤ĽóĽšĽČĄźĽë
+
+ ĽÇĽŁĽšĽŻÍĆÎ̤ňŔáĚ󤡤ż¤¤žěšç¤ĎĄ˘¤Ţ¤şĄ˘Ĺ¸łŤ¤š¤ëĽ˘ĄźĽŤĽ¤ĽÖ¤ňÁŞÂň¤ˇ¤Ţ¤šĄŁ
+ ¤É¤ě¤ňŸłŤ¤š¤Ů¤­¤Ť¤ď¤Ť¤é¤şĄ˘¤Ť¤ÄĄ˘52MĽĐĽ¤ĽČ°Ęžĺ¤Î¤ÎĽÇĽŁĽšĽŻÍĆÎ̤Ź¤˘¤ë
+ žěšç¤ĎĄ˘Á´¤ĆŸłŤ¤š¤ë¤Î¤ŹłÎźÂ¤Ç¤šĄŁ
+
+ şÇÄă¸ÂĄ˘X312*.tgz¤Î¤Ś¤ÁĄ˘'ÉŹżÜĽ˘ĄźĽŤĽ¤ĽÖ'¤Ë˛Ă¤¨Ą˘žŻ¤Ę¤Ż¤Č¤â°ě¤ÄĄ˘ťČÍŃ
+ ¤š¤ëVGAĽŤĄźĽÉ¤ËĹŹšç¤š¤ëXĽľĄźĽĐ¤ňŸłŤ¤š¤ë¤ł¤Č¤ŹÉŹÍפǤšĄŁşÇÄă¸ÂÉŹÍפʟÂ
+ šÔÍŃĽĐĽ¤ĽĘĽę¤Î¤ß¤ňĽ¤ĽóĽšĽČĄźĽë¤š¤ëžěšçĄ˘9MĽĐĽ¤ĽČ¤ÎĽÇĽŁĽšĽŻÍĆÎ̤ŹÉŹÍפÇ
+ ¤šĄŁ
+
+
+ ÉŹżÜĽ˘ĄźĽŤĽ¤ĽÖ(6.7Mb):
+
+ X312bin.tgz
+ Á´¤Ć¤ÎźÂšÔ˛ÄÇ˝¤ĘX¤ÎĽŻĽéĽ¤Ľ˘ĽóĽČĽ˘Ľ×ĽęĽąĄźĽˇĽçĽóĽ˝ĽŐĽČ¤ČśŚÍ­Ľé
+ Ľ¤ĽÖĽéĽę
+
+ X312fnts.tgz
+
+ 75 dpiĽŐĽŠĽóĽČž
+
+ X312lib.tgz
+ źÂšÔťţ¤ËÉŹÍפʼǥźĽżĽŐĽĄĽŁĽë
+
+ ĽŤĽšĽżĽŢĽ¤ĽşşŃ¤ß¤ÎÄęľÁĽŐĽĄĽ¤Ľë¤Ź¤Ę¤¤žěšçÉŹÍפʼ˘ĄźĽŤĽ¤ĽÖ:
+
+ X312xicf.tgz
+ xinitźÂšÔťţ¤Ëť˛žČ¤ľ¤ě¤ëĽŤĽšĽżĽŢĽ¤ĽşÍŃÄęľÁĽŐĽĄĽ¤Ľë
+
+ X312xdcf.tgz
+ xdmźÂšÔťţ¤Ëť˛žČ¤ľ¤ě¤ëĽŤĽšĽżĽŢĽ¤ĽşÍŃÄęľÁĽŐĽĄĽ¤Ľë
+
+
+ ĽľĄźĽĐĽ˘ĄźĽŤĽ¤ĽÖ(žŻ¤Ę¤Ż¤Č¤â°ě¤ÄÁŞÂň) (~2.3Mb):
+
+ X3128514.tgz
+ IBM 8514 ¤Ş¤č¤Ó´°Á´¸ß´šĽÁĽĂĽ×ÍŃ8-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312AGX.tgz
+ AGX,XGAĽÜĄźĽÉÍŃ 8,16-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312Ma32.tgz
+ ATI Mach32ĽÜĄźĽÉÍŃ 8,16-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312Ma64.tgz
+ ATI Mach64ĽÜĄźĽÉÍŃ 8,16,24-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312Ma8.tgz
+ ATI Mach8ĽÜĄźĽÉÍŃ 8-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312Mono.tgz
+ VGA,Super-VGA,Hercules,¤˝¤Îž¤ÎĽÜĄźĽÉÍŃ1-bitĽâĽÎĽŻĽíĽľĄźĽĐ
+
+ X312P9K.tgz
+ Weitek P9000ĽÜĄźĽÉ(Diamond Viper)ÍŃ 8,16,24-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312S3.tgz
+ S3 ĽÜĄźĽÉ(#9 GXE,Actix GE32,SPEA Mercury,STB Pegasus)ÍŃ
+ 8,16,24-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312SVGA.tgz
+ Super-VGAĽŤĄźĽÉÍŃ 8-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312VG16.tgz
+ VGA,Super-VGAĽŤĄźĽÉÍŃ 4-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312W32.tgz
+ ET4000/W32,/W32i,W32pĽŤĄźĽÉÍŃ 8-bitĽŤĽéĄźĽľĄźĽĐ
+
+ X312nest.tgz
+ ž¤Îdisplayžĺ¤ÇĽŻĽéĽ¤Ľ˘ĽóĽČwindow¤Č¤ˇ¤ĆĆ°şî¤š¤ëĽÍĽšĽČĄĘ¤¤¤ě
+ ťŇĄËĽľĄźĽĐ
+
+
+ ĽŞĽ×ĽˇĽçĽĘĽë:
+
+
+ X312doc.tgz
+
+ (.5Mb) READMEs
+
+
+ X312man.tgz
+ (1.7Mb) man pages
+
+ X312f100.tgz
+ (1.8Mb)100dpiĽŐĽŠĽóĽČ
+
+ X312fscl.tgz
+ (1.6Mb)Speedo,Type1 ĽŐĽŠĽóĽČ
+
+ X312fnon.tgz
+ (3.3Mb)ĆüËܸ쥢Ăćšń¸ěĄ˘¤˝¤Îž¤ÎČóąŃ¸ěÍŃĽŐĽŠĽóĽČ
+
+ X312fcyr.tgz
+ (.4Mb)Ľ­ĽęĽëʸťúĽŐĽŠĽóĽČ
+
+ X312fsrv.tgz
+ (.3Mb)ĽŐĽŠĽóĽČĽľĄźĽĐ¤Č¤˝¤Îman page
+
+ X312prog.tgz
+ (3.9Mb)ĽłĽóĽŃĽ¤Ľëťţ¤Ë¤Î¤ßÉŹÍפĘconfig,lib*.a,*.hĽŐĽĄĽ¤Ľë
+
+ X312link.tgz
+ (7.8Mb)XĽľĄźĽĐ¤ÎşĆš˝ŔŽĽ­ĽĂĽČ
+
+ X312pex.tgz
+ (.5Mb)PEXĽ˘Ľ×ĽęĽąĄźĽˇĽçĽó¤ÇÉŹÍפĘPEX ĽŐĽŠĽóĽČ,śŚÍ­ĽéĽ¤ĽÖĽéĽę
+
+ X312lbx.tgz
+ (.2Mb)śšÂÓ°čX proxy ĽľĄźĽĐ¤Č¤˝¤ÎĽéĽ¤ĽÖĽéĽę
+
+ ĆČΊ¤ˇ¤żxdmĽ˘ĄźĽŤĽ¤ĽÖ¤ĎĚľ¤Ż¤Ę¤Ă¤ż¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁFreeBSD-2.0¤ä¤˝
+ ¤ě°Ęšß¤Ç¤ĎĄ˘¤ł¤ě¤ňśŚÍ­ĽéĽ¤ĽÖĽéĽę¤Ç°ˇ¤Ă¤Ć¤¤¤ë¤ż¤áĄ˘xdmĽĐĽ¤ĽĘĽęźŤżČ¤Ë¤Ď
+ des¤Ď´Ţ¤Ţ¤ě¤şĄ˘ĆČΊ¤ˇ¤żtarĽ˘ĄźĽŤĽ¤ĽÖ¤Č¤ˇ¤ĆÄ󜥤š¤ëÉŹÍפŹĚľ¤Ż¤Ę¤ę¤Ţ¤ˇ
+ ¤żĄŁ
+
+
+ 2.1. ĽŐĽëĽ¤ĽóĽšĽČĄźĽë
+
+
+ 1. ¤¤¤Ż¤Ä¤Ť¤ÎźÂšÔ˛ÄÇ˝ĽŐĽĄĽ¤Ľë¤Ďset-user-id¤ľ¤ě¤ë¤Î¤ÇĽ˘ĄźĽŤĽ¤ĽÖ¤ňŸłŤ¤š
+ ¤ë¤ż¤á¤ËÉŹ¤şroot¤ÇĽíĽ°Ľ¤Ľó¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁroot¤Ç¤Ę¤ŻÄĚžďĽćĄź
+ Ľś¤ÇŸłŤ¤š¤ë¤ČĽľĄźĽĐ¤Ď°Űžď˝ŞÎť¤š¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ¤Ţ¤żĄ˘XĽľĄźĽĐ¤Ď
+ ĆĂĘ̤ʼѥźĽßĽĂĽˇĽçĽóĄĘĽŐĽĄĽ¤Ľë°Ŕ­ĄË¤ňÉŹÍפȤš¤ë¤Î¤Ç``umask''¤ÎĂͤň
+ 022 ¤ËŔßÄꤡ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ
+
+
+ % su
+ # umask 022
+
+
+
+ 2. /usrĽŃĄźĽĆĽŁĽˇĽçĽó¤Ë52Mb°Ęžĺ¤Îśő¤­ÍĆÎ̤Ź¤˘¤ëžěšçĄ˘ ``cd /usr''¤Č¤ˇ
+ ¤ĆĄ˘Łł¤ËĽšĽ­ĽĂĽ×¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĚľ¤¤žěšç¤ĎĄ˘Âž¤ÎĽŃĄźĽĆĽŁĽˇĽçĽó¤ËĽÇĽŁĽě
+ ĽŻĽČĽę¤ňşî¤ęĄ˘/usr¤ÎĂć¤ŘĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ň¤Ď¤ę¤Ţ¤šĄŁ
+
+
+
+
+ # cd /usr/local
+ # mkdir X11R6
+ # ln -s /usr/local/X11R6 /usr/X11R6
+
+
+
+ 3. Á´Ľ˘ĄźĽŤĽ¤ĽÖ¤ňŸłŤ
+
+ sh¤ňťČ¤Ă¤Ć¤¤¤ëžěšçĄĘroot¤ĎÂż¤Ż¤Îžěšç¤ł¤Á¤éĄË:
+
+
+
+ # for i in X312*.tgz; do
+ # tar -xzf $i
+ # done
+
+
+
+ ¤Ţ¤ż¤Ďcsh¤ňťČ¤Ă¤Ć¤¤¤ëžěšç:(ĚőĂí:¸˝şß¤ÎFreeBSD¤Ç¤Ďroot¤âɸ˝ŕ¤Çcsh)
+
+
+
+ % foreach i (X312*.tgz)
+ % tar -xzf $i
+ % end
+
+
+
+
+ 4. ťČÍѤˇ¤Ć¤¤¤ëĽÓĽÇĽŞĽÜĄźĽÉ¤ËĹŹšç¤š¤ëĽľĄźĽĐ¤ňťŘ¤ˇź¨¤š¤č¤Ś¤Ë``X'' ¤Č¤¤
+ ¤ŚĚžÁ°¤ÇĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ňşîŔŽ¤ˇ¤Ţ¤šĄŁ¤˝¤ě¤ž¤ě¤ÎĽľĄźĽĐ¤Ź¤É¤ÎĽÓĽÇ
+ ĽŞĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤š¤ë¤Ť¤ĎĄ˘XF86_* ¤Îman pages¤Ëź¨¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤ż
+ ¤Č¤¨¤ĐĄ˘ET4000ĽŮĄźĽš¤ÎĽŤĄźĽÉ¤Îžěšç¤ĎĄ˘XF86_SVGAĽľĄźĽĐ¤ňťČÍѤˇ¤Ţ¤šĄŁ
+
+
+
+
+ # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
+
+
+
+ 2.2. şÇžŽĽ¤ĽóĽšĽČĄźĽë
+
+ şÇ˝é¤Ëžĺľ­¤Î1,2¤ňźÂšÔ¤ˇ¤Ţ¤šĄŁ¤˝¤ˇ¤ĆĄ˘ÉŹżÜĽ˘ĄźĽŤĽ¤ĽÖ¤ňŸłŤ¤ˇ¤Ţ¤šĄŁ
+
+
+
+ # for i in bin fnts lib xicf; do
+ # tar -xzf X312$i.tgz
+ # done
+
+
+ ťČÍѤˇ¤Ć¤¤¤ëvgaĽŤĄźĽÉ¤ËĹŹšç¤š¤ëĽľĄźĽĐĽ˘ĄźĽŤĽ¤ĽÖ¤ňŸłŤ¤ˇ¤Ţ¤šĄŁ¤˝¤ě¤ž¤ě
+ ¤ÎĽľĄźĽĐ¤Ź¤É¤ÎĽÓĽÇĽŞĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤š¤ë¤Ť¤ĎĄ˘ĽľĄźĽĐ¤Î¤Îman pages
+ X11R6/man/man1/XF86_*ź¨¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤ż¤Č¤¨¤ĐĄ˘ET4000ĽŮĄźĽš¤ÎĽŤĄźĽÉ¤Î
+ žěšç¤ĎĄ˘XF86_SVGAĽľĄźĽĐ¤ňťČÍѤˇ¤Ţ¤šĄŁ
+
+
+
+
+ # tar -xzf X312SVGA.tgz
+ # cd /usr/X11R6/bin; rm X; ln -s XF86_SVGA X
+
+
+
+ 2.3. ĽŐĽëĽ¤ĽóĽšĽČĄźĽëĄ˘¤Ţ¤ż¤ĎşÇžŽĽ¤ĽóĽšĽČĄźĽë¸ĺ¤Ë¤š¤ë¤ł¤Č:
+
+ ¤Ţ¤ŔšÔ¤ď¤ě¤Ć¤¤¤Ę¤¤žěšç¤ĎĄ˘sh¤Î¤ż¤á¤Ë/etc/profileĆâ¤ÎĽÇĽŐĽŠĽëĽČ¤ÎĽŃĽš
+ ¤ËĄ˘¤Ţ¤żĄ˘csh¤Î¤ż¤á¤Ë/etc/csh.login¤Ë/usr/X11R6/bin¤ňÄɲ䡤ޤšĄŁ
+
+
+
+ # echo 'set path = ($path /usr/X11R6/bin)' >>/etc/csh.login
+ # echo 'PATH=$PATH:/usr/X11R6/bin' >>/etc/profile
+
+
+ ¤Ţ¤ż¤ĎĄ˘X¤ňťČÍѤš¤ëÁ´ĽćĄźĽś¤ÎĽˇĽ§Ľë¤Î``path''ĘŃżô¤Ë/usr/X11R6/bin ¤ŹĆţ
+ ¤ë¤č¤Ś¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ ¤˝¤Î¸ĺĽęĽÖĄźĽČ¤š¤ë¤ŤĄ˘root¤Ë¤Ę¤Ă¤ĆśŚÍ­ĽéĽ¤ĽÖĽéĽę¤Źld.so¤ÎĽ­ĽăĽĂĽˇĽĺ¤Ë
+ Ćţ¤ë¤č¤Ś¤Ëldconfig¤ňźÂšÔ¤ˇ¤Ţ¤šĄŁ
+
+
+
+ # ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib
+
+
+ ŔßÄęşŃ¤ß¤ÎX11R6/lib/X11/xinit/xinitrc¤Ţ¤ż¤ĎĄ˘ X11R6/lib/X11/xdm/* ¤Ź¤˘
+ ¤ëžěšçĄ˘xinit-config¤Ţ¤ż¤Ď xdm-config¤ÎĽ˘ĄźĽŤĽ¤ĽÖ¤ňžĘÎŹ¤š¤ë¤ŤĄ˘Ę̤ˤÎ
+ žě˝ę¤ËŸłŤ¤ˇĄ˘ÉŹÍפĘŔßÄę¤Ëąţ¤¸¤ĆĽŢĄźĽ¸¤ˇ¤Ţ¤šĄŁ
+
+ fscl¤Čf100Ľ˘ĄźĽŤĽ¤ĽÖ¤ĎĽŞĽ×ĽˇĽçĽĘĽë¤ÇĄ˘ĽÇĽŁĽšĽŻÍĆÎ̤ňŔáĚ󤡤ż¤¤žěšç¤Ë¤Ď
+ žĘÎŹ˛ÄÇ˝¤Ç¤šĄŁ¤Ţ¤żĄ˘ĽŞĽ×ĽˇĽçĽĘĽë¤ĘlinkĽ˘ĄźĽŤĽ¤ĽÖ¤ĎXĽľĄźĽĐ¤ÎĽęĽłĽóĽŐĽŁ
+ Ľ°¤äĽŤĽšĽżĽŢĽ¤Ľş¤ň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁĽŞĽ×ĽˇĽçĽĘĽë¤ĘprogĽ˘ĄźĽŤĽ¤ĽÖ¤ĎĄ˘ŁŘ¤ÎĽ˘
+ Ľ×ĽęĽąĄźĽˇĽçĽóĽ˝ĽŐĽČ¤ňşîŔŽ¤ˇ¤ż¤ęĽłĽóĽŃĽ¤Ľë¤š¤ëžěšç¤Ë¤Î¤ßÉŹÍפǤšĄŁĽŞĽ×
+ ĽˇĽçĽĘĽë¤ĘpexĽ˘ĄźĽŤĽ¤ĽÖ¤ĎpexĽŻĽéĽ¤Ľ˘ĽóĽČ¤ä3DĽ°ĽéĽŐĽŁĽĂĽŻĽ˘Ľ×ĽęĽąĄźĽˇĽç
+ ĽóĽ˝ĽŐĽČ¤ÎşîŔŽ¤Î¤ż¤á¤ÎĽéĽ¤ĽÖĽéĽę¤ň´Ţ¤ß¤Ţ¤šĄŁ
+
+
+ Note: ĽŐĽŠĽóĽČĽŐĽĄĽŁĽë¤Ďuncompress¤š¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘¤â
+ ¤ˇĄ˘¤˝¤ě¤é¤ň uncompress¤š¤ëžěšç¤ĎĄ˘łşĹö¤š¤ëĽÇĽŁĽěĽŻĽČĽę¤ÇĄ˘
+ mkfontdir¤ňźÂšÔ¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ¤˝¤ě¤ňšÔ¤ď¤Ę¤¤¤ČĄ˘
+ ``could not open dfault font 'fixed' '' ¤ČĽáĽĂĽťĄźĽ¸¤ň˝ĐÎϤˇ
+ ¤ĆĄ˘ĽľĄźĽĐ¤Ď°Űžď˝ŞÎť¤ˇ¤Ţ¤šĄŁ
+
+
+ ɸ˝ŕĹŞ¤ĘFreeBSD 1.1.5ĽˇĽšĽĆĽŕ¤ÇťČÍѤš¤ëžěšçĄ˘¤ł¤ÎžĎ¤ÎťÄ¤ę¤ÎÉôĘŹ¤ňžĘÎŹ
+ ¤Ç¤­¤Ţ¤šĄŁ¤˝¤ě°Ęł°¤ÎžěšçĄ˘login process(getty)¤ŹĆ°şî¤ˇ¤Ć¤¤¤ëĄ˘Í˝Č÷¤Î˛ž
+ ÁŰĽłĽóĽ˝ĄźĽë¤Ź¤˘¤ë¤ŤłÎǧ¤ˇ¤Ţ¤šĄŁ¤Ţ¤şĄ˘¤¤¤Ż¤Ä¤Î˛žÁŰĽłĽóĽ˝ĄźĽë¤Ź¤˘¤ë¤ŤłÎ
+ ǧ¤ˇ¤Ţ¤šĄŁ
+
+
+
+ % dmesg|grep sc
+ sc0 at 0x60-0x6f irq 1 on motherboard
+ sc0: VGA color <8 virtual consoles>
+
+
+
+ ¤˝¤ˇ¤ĆĄ˘getty¤ŹÍ­¸ú˛˝¤ľ¤ě¤Ć¤¤¤Ę¤¤ttyv?ĽÇĽĐĽ¤Ľš¤ŹžŻ¤Ę¤Ż¤Č¤âŁą¤Ä¤˘¤ë¤ŤĄ˘
+ /etc/ttys¤ňłÎǧ¤ˇ¤Ţ¤šĄŁFreeBSD 1.1.5¤Ç¤ĎĄ˘şÇ˝é¤Î3¤Ä¤Ź``on''¤ÇşÇ¸ĺ¤Î1
+ ¤Ä¤Ź``off''¤Ë¤Ę¤Ă¤Ć¤¤¤ĆĄ˘3¤Ä¤Ŕ¤ągetty¤ŹźÂšÔ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+
+
+
+ % grep ttyv /etc/ttys
+ ttyv0 "/usr/libexec/getty Pc" cons25 on secure
+ ttyv1 "/usr/libexec/getty Pc" cons25 on secure
+ ttyv2 "/usr/libexec/getty Pc" cons25 on secure
+ ttyv3 "/usr/libexec/getty Pc" cons25 off secure
+
+
+ ĽŤĄźĽÍĽë¤ËžŻ¤Ę¤Ż¤Č¤â4¤Ä¤Î˛žÁŰĂźËö(VT)¤Ź¤˘¤ęĄ˘3¤Ä¤Ŕ¤ągetty¤ŹźÂšÔ¤ľ¤ě¤Ć
+ ¤¤¤ëžěšçĄ˘¤ł¤ě¤Ď¤ż¤¤¤Ř¤óĹŹĹö¤ĘŔßÄę¤Ç¤šĄŁ˛žÁŰĂźËö¤ŹÉÔ­¤ˇ¤Ć¤¤¤ëžěšçĄ˘
+ /etc/ttys¤Ç``on''¤Ť¤é``off''¤ËĘŃšš¤ˇĄ˘getty¤ň1¤ÄĚľ¸ú˛˝¤š¤ë¤ŤĄ˘˛źľ­¤ÇŔâ
+ ĚŔ¤š¤ë¤č¤Ś¤ËĄ˘¤č¤ęÂż¤Ż¤Î˛žÁŰĂźËö(VT)¤ňťČ¤¨¤ë¤č¤Ś¤Ëżˇ¤ż¤ĘĽŤĄźĽÍĽë¤ňš˝ŔŽ
+ ¤ˇ¤Ţ¤šĄŁ
+
+
+ 3. ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă(xdm)¤ÎĽ¤ĽóĽšĽČĄźĽë
+
+ ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă¤Ë¤č¤Ă¤ĆĄ˘PC¤ňXĂźËö¤Î¤č¤Ś¤ËťČÍѤš¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ
+ ¤šĄŁĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă¤ĎĄ˘X˛ź¤ÇĆ°şî¤š¤ëĽíĽ°Ľ¤ĽóĽšĽŻĽęĄźĽó¤ňÄ󜥤ˇ
+ ¤Ţ¤šĄŁ
+
+ şÇ¤â´ĘĂą¤ËĄ˘ĽÖĄźĽČťţ¤ËĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă¤ňźŤĆ°ĹŞ¤ËľŻĆ°¤š¤ë¤Ë¤ĎĄ˘ťČ
+ ÍѤľ¤ě¤Ć¤¤¤Ę¤¤˛žÁŰĂźËö¤ËÂФˇ¤ĆĄ˘/etc/ttys¤Ë°Ę˛ź¤Î1šÔ¤ňÄɲ䡤ޤšĄŁ
+
+
+
+ ttyv4 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
+
+
+ /usr/X11R6/bin/X¤ŹťČÍѤˇ¤Ć¤¤¤ëĽÓĽÇĽŞĽŤĄźĽÉ¤ËĹŹšç¤š¤ëXĽľĄźĽĐ¤Ř¤ÎĽˇĽóĽÜ
+ ĽęĽĂĽŻĽęĽóĽŻ¤Ë¤Ę¤Ă¤Ć¤¤¤ë¤ł¤Č¤ňłÎǧ¤š¤ë¤ŤĄ˘¤Ţ¤ż¤ĎĄ˘
+ /usr/X11R6/lib/X11/xdmĆâ¤Î Xservers¤Č¤¤¤ŚĽŐĽĄĽŁĽë¤ÇĄ˘XĽľĄźĽĐ¤ÎĽŃĽšĚž¤ň
+ ťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ /etc/ttys¤ÎĘŃšš¤ĎĄ˘ĽęĽÖĄźĽČ¤š¤ë¤ŤĄ˘``kill -HUP 1''¤Č¤ˇ¤Ćinitd ¤ËÂФˇ¤Ć
+ śŻŔŠĹޤË/etc/ttys¤ÎşĆĆÉšţ¤ňšÔ¤ď¤ť¤Ę¤¤¤Č¸ú˛Ě¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ¤Ţ¤żĄ˘root¤Ç
+ ĽíĽ°Ľ¤Ľó¤ˇĄ˘ĽłĽóĽ˝ĄźĽëžĺ¤ÇźęĆ°¤Ë¤č¤ę``xdm -nodaemon''¤Č¤ˇ¤ĆĽÇĽŁĽšĽ×Ľě
+ Ľ¤ĽŢĽÍĄźĽ¸Ľă¤ňĽĆĽšĽČ¤š¤ë¤ł¤Č¤â¤Ç¤­¤Ţ¤šĄŁ
+
+
+ 4. ĽĎĄźĽÉĽŚĽ¨Ľ˘¤Ëšç¤ď¤ť¤żX¤ÎŔßÄę
+
+ ¤É¤ó¤ĘĽâĽËĽżĄ˘ĽÓĽÇĽŞĽŤĄźĽÉĄ˘ĽŢĽŚĽš¤ÇťČÍѤš¤ë¤ŤĄ˘XF86Config¤ÇXĽľĄźĽĐ¤Ë
+ ťŘź¨¤ˇ¤Ţ¤šĄŁťČÍѤš¤ëŔľłÎ¤ĘĽĎĄźĽÉĽŚĽ¨Ľ˘¤ňťŘź¨¤Ç¤­¤ë¤č¤Ś¤ËXF86Config ¤ň
+ ÉŹ¤şşîŔŽ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ XFree86-3.1¤Ďżˇ¤ˇ¤¤ĽŐĽĄĽ¤ĽëĽŐĽŠĄźĽŢĽĂĽČ¤ňťČÍѤˇ¤Ć¤¤¤Ţ¤šĄŁXF86Config¤Î
+ man page¤ČĄ˘°ěČĚĹŞ¤ĘĆâÍƤÎINSTALL (INSTALL.html)ĽŐĽĄĽ¤Ľë¤ňŔâĚŔ˝ń¤Č¤ˇ¤Ć
+ ť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XF86Config¤ňŔ¸ŔŽ¤š¤ë``xf86config''¤ňťČÍѤš¤ë¤ł¤Č¤ňśŻ¤Ż¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ
+ ĄĘĚőĂíĄ§PC98¤Ç¤Ď``xf86config''¤ňťČÍѤˇ¤Ę¤¤¤ÇĽľĽóĽ×Ľë¤ÎXF86Config.98¤ň
+ ť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĄË
+
+ XFree86 2.xÍѤÎXconfig¤Ź¤˘¤ëžěšçĄ˘reconfig¤ňťČÍѤˇ¤Ć¤˝¤Î°ěÉôĘŹ¤ňżˇ¤ˇ¤¤
+ ĽŐĽŠĄźĽŢĽĂĽČ¤ËĘŃ´š¤Ç¤­¤Ţ¤šĄŁ
+
+
+
+ # reconfig <Xconfig >XF86Config
+
+
+ ¤˝¤ˇ¤ĆĄ˘XF86Config(4)¤Îman page¤äĽĆĽóĽ×ĽěĄźĽČ¤Č¤ˇ¤ĆXF86Config.eg ¤ňť˛
+ žČ¤ˇ¤ĆťÄ¤ę¤ÎÉôĘŹ¤ň´°ŔŽ¤ľ¤ť¤Ţ¤šĄŁ
+
+ ĽĎĄźĽÉĽŚĽ¨Ľ˘¤ÎÂť˝ý¤Ť¤éĘݸ¤ë¤ż¤áĄ˘¸˝şß¤Ç¤Ď°ěČ̼楟Ľś¤ÎĽŰĄźĽŕĽÇĽŁĽěĽŻ
+ ĽČĽę¤ÎXF86ConfigĽŐĽĄĽ¤Ľë¤ňĆɤޤşĄ˘/etc/XF86Config,
+ /usr/X11R6/lib/X11/XF86Config.hostname, /usr/X11R6/lib/X11/XF86Config
+ ¤Ë¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ
+
+ ťČÍŃĽĎĄźĽÉĽŚĽ¨Ľ˘¤Î°Ę˛ź¤ÎžđĘó¤ŹÉŹÍפǤšĄŁ
+
+ + ĽŢĽŚĽš¤ÎĽżĽ¤Ľ×Ą˘ĽÜĄźĽěĄźĽČĄ˘ťČÍѤš¤ë/dev¤ÎĽ¨ĽóĽČĽę
+
+ + ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎťČÍŃĽÁĽĂĽ×ĽťĽĂĽČ(Îă:ET4000,S3,etc)
+
+ + ĽâĽËĽż¤ÎĆą´üźţÇČżô
+
+ ĽŢĽŚĽš¤Ź¤É¤ÎĽÇĽĐĽ¤Ľš¤ËŔÜÂł¤ľ¤ě¤Ć¤¤¤ë¤ŤĂΤëşÇ¤â´ĘĂą¤ĘĘýËĄ¤ĎĄ˘``cat''¤ä
+ ``kermit''¤ňťČÍѤˇ¤ĆĄ˘ĽŢĽŚĽš¤Î˝ĐÎϤňÄ´¤Ů¤ë¤ł¤Č¤Ç¤šĄŁĽŢĽŚĽš¤ňŔÜÂł¤ˇĄ˘ĽŢ
+ ĽŚĽš¤ňĆ°¤Ť¤ˇ¤ż¤ęĽŻĽęĽĂĽŻ¤ˇ¤ż¤Č¤­¤Ë˝ĐÎϤŹ¤˘¤ë¤ŤłÎ¤Ť¤á¤Ţ¤šĄŁ
+
+
+
+ % cat < /dev/tty00
+
+
+ Ŕľ¤ˇ¤¤ĽŢĽŚĽš¤ÎĽÇĽĐĽ¤Ľš¤Ź¤ď¤Ť¤é¤Ę¤¤žěšç¤ĎĄ˘``dmesg|grep sio''¤Č¤ˇ¤ĆĄ˘
+ ĽÖĄźĽČťţ¤Ëǧźą¤ľ¤ě¤żĽÇĽĐĽ¤Ľš¤ÎĽęĽšĽČ¤ňźčĆŔ¤ˇ¤Ţ¤šĄŁ
+
+
+
+ % dmesg|grep sio
+ sio0 at 0x3f8-0x3ff irq 4 on isa
+
+
+ ¤˝¤ˇ¤ĆĄ˘¤˝¤ÎĽÇĽĐĽ¤Ľš¤ËĹŹšç¤š¤ë/devĽ¨ĽóĽČĽę¤ň¤ľ¤é¤ËłÎǧ¤ˇ¤Ţ¤šĄŁĽ¨ĽóĽČĽę
+ ¤ŹĚľ¤¤žěšç¤ĎĄ˘/dev/MAKEDEVĽšĽŻĽęĽ×ĽČ¤ňťČ¤Ă¤Ćşî¤ę¤Ţ¤šĄŁ
+
+
+
+ % cd /dev
+ % sh MAKEDEV tty00
+
+
+ ĽâĽËĽżžĺ¤Î˛čĚ̤ÎÂ礭¤ľ¤ä°ĚĂÖ¤ň´°Á´¤ËÄ´Ŕ°¤š¤ë¤Ë¤ĎĄ˘ĽâĽËĽż¤ÎŔâĚŔ˝ń¤Ť¤éĄ˘
+ Ćą´üźţÇČżô¤Ë´Ř¤š¤ëžđĘó¤ňĆţźę¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+
+
+
+ 5. X¤ÎźÂšÔ
+
+
+ X¤ňźÂšÔ¤š¤ë¤Ë¤ĎĄ˘şÇžŽ8Mb¤ÎĽáĽâĽę¤Ź¤˘¤ë¤ł¤Č¤ňżäžŠ¤ˇ¤Ţ¤šĄŁĽľĄźĽĐ¤ČĽŚĽ¤Ľó
+ ĽÉĽŚĽŢĽÍĄźĽ¸ĽăĄ˘ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸ĽăĄ˘1¤Ä¤Îxterm¤ÇĄ˘Ěó8Mb¤Î˛žÁŰĽáĽâ
+ Ľę¤ňťČÍѤˇ¤Ţ¤šĄŁ
+
+ ¤Ť¤ę¤ËžďĂ󤚤ëÉôĘŹ¤ÎĽľĽ¤Ľş¤ĎžŽ¤ľ¤¤¤Č¤ˇ¤Ć¤âĄ˘8Mb ¤ÎĽˇĽšĽĆĽŕ¤Ç¤Ďgcc ¤Î¤č
+ ¤Ś¤ËżôMĽĐĽ¤ĽČ¤ň´üÂÔ¤ˇ¤Ć¤¤¤ë¤č¤Ś¤ĘĽ˘Ľ×ĽęĽąĄźĽˇĽçĽó¤Ë˝˝ĘŹ¤ĘĽšĽÚĄźĽš¤ĎťÄ
+ ¤ę¤Ţ¤ť¤óĄŁ
+
+ R6¤ÎĽľĄźĽĐ¤Ď4Mb¤ÎĽáĽâĽę¤Ç¤âĆ°şî¤š¤ë˛ÄÇ˝Ŕ­¤Ď¤˘¤ę¤Ţ¤š¤ŹĄ˘X˛ź¤Ç¤ÎĽłĽóĽŃĽ¤
+ Ľë¤Ë¤ĎĄ˘ÄęžďĹŞ¤ĘĽÚĄźĽ¸ĽóĽ°¤Ë¤č¤ę5,10ÇܤΝţ´Ö¤Ź¤Ť¤Ť¤ę¤Ţ¤šĄŁ
+
+ żˇ¤ˇ¤¤ĽćĄźĽś¤ŹXĽŚĽŁĽóĽÉĽŚ¤ňľŻĆ°¤š¤ëşÇ¤â´ĘĂą¤ĘĘýËĄ¤ĎĄ˘ ``startx >&
+ startx.log''¤ČĆţÎϤš¤ë¤ł¤Č¤Ç¤šĄŁĽ¨ĽéĄźĽáĽĂĽťĄźĽ¸¤ĎĽęĽŔĽ¤ĽěĽŻĽČ¤ˇ¤Ę¤¤
+ ¤ČĄ˘ĽľĄźĽĐ¤ŹĽšĽŻĽęĄźĽóžĺ¤Ëžĺ˝ń¤­¤ˇĄ˘¸Ť¤¨¤Ę¤Ż¤Ę¤Ă¤Ć¤ˇ¤Ţ¤¤¤Ţ¤šĄŁ
+
+ XĽŚĽŁĽóĽÉĽŚ¤Ť¤éČ´¤ą¤ë¤Ë¤ĎĄ˘ĽłĽóĽ˝ĄźĽë¤Č¤ˇ¤ĆĆ°şî¤ˇ¤Ć¤¤¤ëxtermĂć¤Ç
+ ``exit'' ¤ČĆţÎϤˇ¤Ţ¤šĄŁxinit,startx¤Îman page¤ňť˛žČ¤ˇĄ˘ĽŰĄźĽŕĽÇĽŁĽěĽŻ
+ ĽČĽę¤ËĄ˘.xinitrc,.xserverrc,.twmrc¤ÎĽŐĽĄĽ¤Ľë¤ňşîŔŽ¤š¤ë¤ł¤Č¤ÇĄ˘ X¤ňĽŤĽš
+ ĽżĽŢĽ¤Ľş¤Ç¤­¤Ţ¤šĄŁ
+
+
+ 6. XĽľĄźĽĐÍŃĽŤĄźĽÍĽë¤ÎşĆš˝ĂŰ
+
+
+ FreeBSD-2.0,2.0.5¤ÎGENERICĽŤĄźĽÍĽë¤ĎĄ˘Á´¤Ż˝¤Ŕľ¤š¤ë¤ł¤Č¤Ę¤ˇ¤ËXFree86¤ň
+ ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ˛ż¤éGENERICĽŤĄźĽÍĽë¤ÎĘŃšš¤äĄ˘ĆĂĘ̤ʼŤĄźĽÍĽë¤ňš˝ĂŰ
+ ¤š¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ°ěČĚĹŞ¤ĘĄ˘BSDĽŤĄźĽÍĽë¤Îš˝Ăۤ˴ؤš¤ëŔâĚŔ¤ĎĄ˘
+ smm.02.config.ps.Z
+ (ftp://gatekeeper.dec.com/pub/BSD/manuals/smm.02.config.ps.Z) ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ě¤ĎĄ˘ĽˇĽšĽĆĽŕ´ÉÍýĽŢĽËĽĺĽ˘Ľë¤ÎĽŤĄźĽÍĽëš˝Ăۤ˴ؤš¤ëžĎ¤ÇĄ˘¤˝¤Î¤Ţ¤Ţ
+ °őşţ¤Ç¤­¤ëĽÝĽšĽČĽšĽŻĽęĽ×ĽČ˝ĐÎϤǤšĄŁ
+
+ ĽŤĄźĽÍĽëĽłĽóĽŐĽŁĽ°ĽěĄźĽˇĽçĽóĽŐĽĄĽ¤Ľë¤ňşď¸ş¤ˇ¤ż¤¤žěšç¤Ç¤âĄ˘
+ (/usr/src/sys/i386/conf/GENERICĂć¤Ë¤˘¤ë)°Ę˛ź¤Î¤č¤Ś¤Ę2šÔ¤ňžĂ¤ˇ¤Ć¤Ď¤¤¤ą
+ ¤Ţ¤ť¤óĄŁ¤É¤Á¤é¤âXĽľĽÝĄźĽČ¤Î¤ż¤á¤ËÉŹÍפǤšĄŁ
+
+
+
+ options XSERVER #Xserver
+ options UCONSOLE #X Console support
+
+
+ FreeBSD 2.0,2.0.5¤ÎGENERICĽŤĄźĽÍĽë¤Ç¤ĎĄ˘ĽÇĽŐĽŠĽëĽČ¤ÇsysconsĽÉĽéĽ¤ĽĐ¤Ź
+ ŔßÄꤾ¤ě¤Ć¤¤¤Ţ¤šĄŁĽŤĄźĽÍĽë¤ňşĆš˝Ăۤš¤ëžěšçĄ˘
+ /usr/src/sys/i386/conf/GENERIC¤ÎĂć¤Ë¤˘¤ë°Ę˛ź¤Î¤č¤Ś¤ĘšÔ¤ŹÉŹÍפǤšĄŁ
+
+
+
+ device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
+
+
+ ˛žÁŰĂźËö¤Îżô¤ĎĄ˘NCONS ĽŞĽ×ĽˇĽçĽó¤ÇťŘÄę¤Ç¤­¤Ţ¤šĄŁ
+
+
+
+ options "NCONS=4" #4 virtual consoles
+
+
+ ¤ł¤ÎšÔ¤Ź¤Ę¤¤žěšç¤ĎĽÇĽŐĽŠĽëĽČ¤Î12¤Ë¤Ę¤ę¤Ţ¤šĄŁ3žĎ¤Î˝Ş¤ď¤ę¤Ëľ­˝Ň¤ˇ¤ż¤č¤Ś
+
+ ¤Ëgetty ¤Îżô¤č¤ęÂż¤Ż¤Î˛žÁŰĂźËö¤ŹÉŹÍפǥ˘4¤ŹšçÍýĹŞ¤ĘşÇžŽĂͤǤšĄŁ
+
+ ĽľĄźĽĐ¤ĎĄ˘pccons,syscons,pcvt¤Ę¤É¤¤¤Ż¤Ä¤Ť¤ÎĽłĽóĽ˝ĄźĽëĽÉĽéĽ¤ĽĐ¤ňĽľĽÝĄź
+ ĽČ¤ˇ¤Ţ¤šĄŁ syscons¤ĎĄ˘FreeBSD 1.1.5¤Č¤˝¤ě°Ęšß¤ÇĽÇĽŐĽŠĽëĽČ¤Ç¤šĄŁ¤ł¤ě¤é
+ ¤ĎźÂšÔťţ¤Ë¸Ą˝Đ¤ľ¤ě¤ë¤Î¤ÇĄ˘Ćä˼ľĄźĽĐ¤ËŔßÄꤚ¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ pcvtĽłĽóĽ˝ĄźĽëĽÉĽéĽ¤ĽĐ¤ĎFreeBSD 1.0.2°Ęšß¤Î/usr/port/util/pcvt¤ËĽĐĽóĽÉ
+ Ľë¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤Ţ¤żĄ˘°Ę˛ź¤Ť¤éFTP¤ÇĆţźę¤Ç¤­¤Ţ¤šĄŁ
+
+ FreeBSD.cdrom.com:/pub/FreeBSD/FreeBSD-1.1/ports/util/pcvt
+ (ftp://FreeBSD.cdrom.com/pub/FreeBSD/FreeBSD-1.1/ports/util/pcvt)
+
+ README.FreeBSD (ftp://FreeBSD.cdrom.com/pub/FreeBSD/FreeBSD-
+ 1.1/ports/util/pcvt/README.FreeBSD) ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ¤ł¤ě¤Ë¤Ď´°Á´¤ĘĽ¤ĽóĽšĽČĄźĽëźę˝ç¤Źź¨¤ˇ¤Ć¤˘¤ę¤Ţ¤šĄŁ
+
+ XFree86ĽľĄźĽĐ¤ĎĄ˘MIT-SHM extension¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁGENERICĽŤĄźĽÍ
+ Ľë¤ĎĄ˘¤ł¤ě¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę¤¤¤Î¤ÇĄ˘¤ł¤ě¤é¤ňťČÍѤˇ¤ż¤¤žěšç¤ĎĄ˘SYSVśŚÍ­
+ ĽáĽâĽęĽľĽÝĄźĽČ¤ňÍ­¸ú¤Ë¤ˇ¤Ćš˝Ăۤˇ¤Ţ¤šĄŁ¤˝¤ě¤Ë¤ĎĄ˘ĽŤĄźĽÍĽëĽłĽóĽŐĽŁĽ°ĽěĄź
+ ĽˇĽçĽóĽŐĽĄĽ¤Ľë¤Ë°Ę˛ź¤ÎšÔ¤ň˛Ă¤¨¤Ţ¤šĄŁ
+
+
+
+ options SYSVSHM # System V shared memory
+ options SYSVSEM # System V semaphores
+ options SYSVMSG # System V message queues
+
+
+ SoundBlaster 16¤ňIRQ 2(9)¤ÇťČÍѤš¤ëžěšçĄ˘sb16_dsp.c¤ËĽŃĽĂĽÁ¤ŹÉŹÍפÇ
+ ¤šĄŁ¤˝¤Ś¤ˇ¤Ę¤¤¤ČSoundBlaster¤ňÍ­¸ú¤Ë¤ˇ¤żĽŤĄźĽÍĽë¤ĎĄ˘IRQ9¤ŹÂ¸şß¤ˇ¤Ę¤¤¤Č
+ Ľ¨ĽéĄź¤ň˝Đ¤ˇĄ˘XĽľĄźĽĐ¤ŹĽíĽĂĽŻĽ˘ĽĂĽ×¤ˇ¤Ć¤ˇ¤Ţ¤¤¤Ţ¤šĄŁ
+
+ IOĽ˘ĽÉĽěĽš¤Ź˝Ĺ¤Ę¤ë¤Î¤ÇĄ˘S3ĽŤĄźĽÉ¤ČĽˇĽęĽ˘ĽëĽÝĄźĽČ¤ÎCOM4¤ÎΞĘý¤ňĂą°ěĽˇĽš
+ ĽĆĽŕžĺ¤ÇťČÍѤš¤ë¤ł¤Č¤Ď¤Ç¤­¤Ţ¤ť¤óĄŁ
+
+
+ 7. XFree86¤ÎşĆš˝ĂŰ
+
+ XĽľĄźĽĐĽęĽóĽŻĽ­ĽĂĽČ¤ĎĄ˘şÇžŽ¸Â¤ÎĽÇĽŁĽšĽŻÍĆÎ̤ÇXĽľĄźĽĐ¤Îš˝Ăۤň˛ÄÇ˝¤Ë¤ˇ¤Ţ
+ ¤šĄŁĂą¤ËŸłŤ¤ˇ¤ĆĄ˘xf86sire.def¤ňĹŹĹö¤ËĘŃšš¤ˇĄ˘``./mkmf'', ``make''¤Č¤ˇ
+ ¤ĆĽęĽóĽŻ¤ˇ¤Ţ¤šĄŁžÜ¤ˇ¤Ż¤ĎĄ˘ README.LinkKit (LinkKit.html) ¤ňť˛žČ¤ˇ¤Ć˛ź
+ ¤ľ¤¤ĄŁ
+
+ Ľ˝ĄźĽšĽÄĽęĄź¤ĎĄ˘ĽłĽóĽŃĽ¤ĽëÁ°¤ËĚó114MbĄ˘``make World''¸ĺ¤Ď¤ľ¤é¤Ë100Mb¤Î
+ ĽÇĽŁĽšĽŻÍĆÎ̤ŹÉŹÍפǤšĄŁĽłĽóĽŃĽ¤ĽëÁ°¤ËĄ˘xc/config/cfĆâ¤Î
+ xf86site.def,site.def¤ňĘÔ˝¸¤ˇĄ˘ÇŰÉŰĘŞ¤ňŔßÄꤡ¤Ţ¤šĄŁĽÇĽŐĽŠĽëĽČ¤ÇĽłĽó
+ ĽŐĽŁĽ°ĽŐĽĄĽŁĽë¤ĎśŚÍ­ĽéĽ¤ĽÖĽéĽę¤ňš˝Ăۤš¤ë¤č¤Ś¤ËŔßÄꤾ¤ě¤Ć¤¤¤Ţ¤šĄŁśŚÍ­Ľé
+ Ľ¤ĽÖĽéĽę¤ŹĽľĽÝĄźĽČ¤ľ¤ě¤Ę¤¤FreeBSD¤ÎĽĐĄźĽ¸ĽçĽó¤ňťČÍѤˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘°Ę
+ ˛ź¤ÎšÔ¤ňsite.def¤ËÄɲ䡤ޤšĄŁ
+
+
+
+ #define BuildBsdSharedLibs NO
+
+
+ ¤Ţ¤żĄ˘ťČÍѤˇ¤Ć¤¤¤ëĽˇĽšĽĆĽŕ¤ŹSYSVśŚÍ­ĽáĽâĽę¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤Ę¤¤žěšçĄĘ¤ż¤Č
+ ¤¨¤ĐĄ˘ <sys/shm.h>ĽŘĽĂĽŔĄź¤Ź¤Ę¤¤žěšçĄËĄ˘°Ę˛ź¤ÎšÔ¤ňsite.def¤ËÄɲ䡤ƥ˘
+ MIT-SHM extension¤ňĚľ¸ú¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+
+ #define HasShm NO
+
+
+ FreeBSD-1.1°Ęšß¤ÇĽłĽóĽŃĽ¤Ľë¤š¤ëžěšçĄ˘xc/config/cf/FreeBSD.cf¤ňĘÔ˝¸¤ˇ
+ ¤ĆĄ˘OSĽĐĄźĽ¸ĽçĽó¤ÎĽŃĽéĽáĄźĽż¤ňŔľ¤ˇ¤ŻŔßÄꤡ¤Ţ¤šĄŁ¤˝¤ˇ¤ĆĄ˘°Ę˛ź¤Î¤č¤Ś¤ËĆţ
+ ÎϤˇ¤Ţ¤šĄŁ
+
+
+
+ make World
+
+
+ ľěĽĐĄźĽ¸ĽçĽó¤ÎFreeBSD(1.1¤č¤ęÁ°)¤ÇťČÍѤš¤ëžěšçĄ˘°Ę˛ź¤Î¤č¤Ś¤ËĆţÎϤˇ¤Ţ
+ ¤šĄŁ
+
+
+
+ make World BOOTSTRAPCFLAGS=-D__FreeBSD__
+
+
+
+
+ 8. ž¤ÎXĽŻĽéĽ¤Ľ˘ĽóĽČ¤Îš˝ĂŰ
+
+ żˇ¤ˇ¤¤ĽŻĽéĽ¤Ľ˘ĽóĽČ(X Ľ˘Ľ×ĽęĽąĄźĽˇĽçĽó)¤ňš˝Ăۤš¤ëşÇ¤â´ĘĂą¤ĘĘýËĄ¤ĎĄ˘
+ Imakefile¤Ź¤˝¤ÎĂć¤Ë´Ţ¤Ţ¤ě¤Ć¤¤¤ëžěšçĄ˘xmkmf¤ňťČ¤Ś¤ł¤Č¤Ç¤šĄŁ ``xmkmf
+ -a'' ¤ČĆţÎϤˇĄ˘Makefile¤ňşîŔŽ¤ˇĄ˘``make''¤ČĆţÎϤˇ¤Ţ¤šĄŁżˇ¤ˇ¤Żman page
+ ¤ňÄɲ䡤ż¤Č¤­¤Ď¤Ť¤Ę¤é¤şĄ˘ ``makewhatis /usr/X11R6/man''¤ňźÂšÔ¤ˇ¤Ć
+ whatis.db¤ňĽ˘ĽĂĽ×ĽÇĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ FreeBSD 1.0°ĘÁ°¤ÎĽˇĽšĽĆĽŕ¤Ç¤ĎĄ˘ĽłĽóĽŃĽ¤ĽëĂ楢cc¤Î``Virtual memory
+ exhausted'' ¤Č¤¤¤ŚĽáĽĂĽťĄźĽ¸¤ňČň¤ą¤ë¤ż¤á¤ËĄ˘ĽÇĄźĽż¤ČĽšĽżĽĂĽŻĽľĽ¤Ľş¤ÎŔŠ
+ ¸Â¤ň°ú¤­žĺ¤˛¤Ţ¤šĄŁ (csh¤Ç¤Ď``limit datasize 32M'',``limit stacksize
+ 16M''¤ČĆţÎϤˇ¤Ţ¤šĄŁ) FreeBSD 2.0°Ęšß¤Ç¤ĎĄ˘ĽÇĽŐĽŠĽëĽČ¤Ź˝˝ĘŹÂ礭¤¤¤Î¤ÇĄ˘
+ ¤ł¤ě¤é¤ÎÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ Note: XFree86 2.1¤ČFreeBSD 1.1¤Ť¤éĄ˘__386BSD__¤ÎĽˇĽóĽÜĽë¤ĎĽłĽóĽŃĽ¤Ľé¤Ç
+ ¤âX¤ÎĽłĽóĽŐĽŁĽ°ĽŐĽĄĽ¤Ľë¤Ç¤âÄęľÁ¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁĽŻĽéĽ¤Ľ˘ĽóĽČ¤ňBSDĽˇĽšĽĆ
+ Ľŕ¤Ë°Üż˘¤š¤ëžěšçĄ˘´°Á´¤ËBSDťĹÍͤμłĄźĽÉ¤Ë¤Ę¤ë¤č¤Ś¤ËĽˇĽóĽÜĽë BSD¤ňťČÍŃ
+ ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ÎĽˇĽóĽÜĽë¤ÎĂͤǥ˘°Ű¤Ę¤Ă¤żBSDĽęĽęĄźĽš¤ňźąĘ̤š¤ë¤ł¤Č¤Ź¤Ç
+ ¤­¤Ţ¤šĄŁ¤ż¤Č¤¨¤ĐĄ˘Net-2¤ä¤˝¤ě°Ęšß¤ÎĽęĽęĄźĽš¤Ë°Í¸¤š¤ë¤Îžěšç¤Ë¤Ď°Ę˛ź¤Î
+ ¤č¤Ś¤ËťČÍѤǤ­¤Ţ¤šĄŁ
+
+
+ #if (BSD >= 199103)
+
+ ¤ł¤ÎĽˇĽóĽÜĽëBSD¤ŹŔľ¤ˇ¤ŻÄęľÁ¤ľ¤ě¤ë¤č¤Ś¤ËĄ˘¤ł¤ě¤ŹÉŹÍפʼ˝ĄźĽš¤ÎĂć¤Ç
+ <<sys/param.h> ¤ňĽ¤ĽóĽŻĽëĄźĽÉ¤š¤ë¤č¤Ś¤Ë¤ˇ¤Ţ¤šĄŁXFree86 3.1.1°ĘšßĄ˘*BSD
+ ĽˇĽšĽĆĽŕ¤Ç¤ĎĄ˘ĽˇĽóĽÜĽë CSRG_BASED¤ŹÄęľÁ¤ľ¤ě¤Ć¤¤¤ë¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁ¤ł¤ě¤ĎĄ˘ <sys/param.h> ¤ÎĽ¤ĽóĽŻĽëĄźĽÉ¤ňĘݸ¤ë¤ż¤á¤ËťČ¤ď¤ě¤Ţ¤šĄŁ
+
+ źÂşÝ¤Ë¤ĎĆĂÄę¤Îi386 BSDÇÉŔ¸OS¤Ë°Í¸¤ˇ¤żĽłĄźĽÉ¤Ç¤ĎĄ˘
+
+ FreeBSDÍѤË__FreeBSD__Ą˘ NetBSDÍѤË__NetBSD__Ą˘ 386BSDÍѤË
+ __386BSD__Ą˘BSD/386ÍѤË__bsdi__ ¤ŹťČ¤ď¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+
+
+
+ 9. źŐź­
+
+ °Ę˛ź¤ÎĘýĄš¤Ë´śźŐ¤¤¤ż¤ˇ¤Ţ¤šĄŁ
+
+
+ + Pace Willison (şÇ˝é¤Ë*BSD¤ŘÂĐąţ)
+
+ + Amancio Hasty (386BSDĽŤĄźĽÍĽë¤ČS3ĽÁĽĂĽ×ĽťĽĂĽČ¤Ř¤ÎÂĐąţ)
+
+ + David Greenman, Nate Williams, Jordan Hubbard (FreeBSDĽŤĄźĽÍĽë¤Ř¤Î
+ ÂĐąţ)
+
+ + Rod Grimes, Jordan Hubbard,Jack Velte (Walnut Creek Cdrom¤ÎľĄşŕ¤ÎÍř
+ ÍŃ)
+
+ + Orest Zborowski, Simon Cooper ,Dirk Hohndel (Linux¤ÎÇŰÉŰĘŞ¤Ť¤éĽ˘Ľ¤
+ ĽÇĽ˘¤ÎÄóśĄ)
+
+
+ ¤Ţ¤żĄ˘ĆüËܸěĚő¤Ë¤˘¤ż¤ęĽ˘ĽÉĽĐĽ¤Ľš¤ň¤¤¤ż¤Ŕ¤¤¤żFreeBSD PC98°Üż˘ĽÁĄźĽŕ¤Î
+ ĘýĄš¤Ë´śźŐ¤¤¤ż¤ˇ¤Ţ¤šĄŁĆüËܸěĚő¤Ë´Ř¤š¤ëĽłĽáĽóĽČ¤Ď
+ <tsuka@kawalab.dnj.ynu.ac.jp>¤Ţ¤Ç¤Ş´ę¤¤¤ˇ¤Ţ¤šĄŁ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.Mach64 b/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.Mach64
new file mode 100644
index 000000000..8d23f55cf
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/READ.Mach64
@@ -0,0 +1,324 @@
+ Mach64 X ĽľĄźĽĐ ¤ÎĽęĽęĄźĽšĽÎĄźĽČ
+ Kevin E. Martin (martin@cs.unc.edu) Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 23 Ćü
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤ż ĽŤĄźĽÉ, RAMDAC ¤Č ĽÔĽŻĽťĽëĹö¤ę¤ÎĽÓĽĂĽČżô
+
+ 2. Mach64 X ĽľĄźĽĐ¤ÎÉ˝ź¨ÂŽĹ٤κÇĹŹ˛˝
+
+ 3. XF86Config ĽŞĽ×ĽˇĽçĽó
+
+ 4. ´űĂΤÎĚäÂę¤ČĽĐĽ°Ęóšđ
+ ______________________________________________________________________
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤ż ĽŤĄźĽÉ, RAMDAC ¤Č ĽÔĽŻĽťĽëĹö¤ę¤ÎĽÓĽĂĽČżô
+
+ Mach64 X ĽľĄźĽĐ¤Ď Á´¤Ć¤Î Mach64 ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉžĺ¤Ç 80MHz °Ęžĺ¤ÎĽÉĽĂ
+ ĽČĽŻĽíĽĂĽŻ¤Ç 8bpp ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ ËؤɤμŤĄźĽÉ¤Ç¤Ď¤â¤Ă¤Čšâ¤¤ĽÉĽĂĽČ
+ ĽŻĽíĽĂĽŻ¤Čž¤Îżź¤ľ¤ŹťČÍѲÄÇ˝¤Ç¤šĄĘ˛ź¤ÎÉ˝¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁĽŤĄźĽÉžĺ
+ ¤Î RAMDAC ¤Ç˛ż¤ŹĽľĽÝĄźĽČ¤ľ¤ě¤Ć¤¤¤ë¤ŤĘŹ¤Ť¤ę¤Ţ¤šĄŁ
+
+ RAMDAC şÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ żź¤ľ şÇÂç˛ňÁüĹŮ Í׾áĽÓĽÇĽŞĽáĽâĽę
+ -------- ------------------ ---- ---------- ----------------
+ ATI68860 135MHz 8 1280x1024 2Mb
+ ATI68860 135MHz 16 1280x1024 4Mb
+ ATI68860 80MHz 32 1024x768 4Mb
+
+ ATI68875 80MHz 32 1024x768 4Mb
+
+ CH8398 135MHz 8 1280x1024 2Mb
+ CH8398 80MHz 16 1024x768 2Mb
+ CH8398 40MHz 32 800x600 2Mb
+
+ STG1702 135MHz 8 1280x1024 2Mb
+ STG1702 80MHz 16 1024x768 2Mb
+ STG1702 50MHz 32 800x600 2Mb
+
+ STG1703 135MHz 8 1280x1024 2Mb
+ STG1703 80MHz 16 1024x768 2Mb
+ STG1703 50MHz 32 800x600 2Mb
+
+ AT&T20C408 135MHz 8 1280x1024 2Mb
+ AT&T20C408 80MHz 16 1024x768 2Mb
+ AT&T20C408 40MHz 32 800x600 2Mb
+
+ Internal 135MHz 8 1280x1024 2Mb
+ Internal 80MHz 16 1024x768 2Mb
+ Internal 40MHz 32 800x600 2Mb
+
+ IBM RGB514 220MHz 8 1600x1200 2Mb
+ IBM RGB514 220MHz 16 1600x1200 4Mb
+ IBM RGB514 135MHz 32 1024x768 4Mb
+
+ ¤˝¤Îž[*] 80MHz 8 1280x1024 2Mb
+
+ [*] - ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ň 80MHz ¤ËŔŠ¸Â¤ˇĄ˘bpp ¤ň 8 ¤ËŔŠ¸Â¤ˇ¤Ţ¤šĄŁžĺľ­¤ÎÉ˝
+ ¤ĎşÇÂç˛ňÁüĹ٤Ȥ˝¤ÎşÇÂç˛ňÁüĹ٤ňťČ¤Ś¤Î¤ËÉŹÍ×¤ĘĽÓĽÇĽŞĽáĽâĽę¤ňź¨¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ¤č¤ęžŽ¤ľ¤¤˛ňÁüĹ٤ˤϤč¤ęžŻ¤Ę¤¤ĽÓĽÇĽŞĽáĽâĽę¤ÇÂçžćÉפǤšĄŁ
+
+ "-probeonly" ĽłĽŢĽóĽÉšÔĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤Ć Mach64 X ĽľĄźĽĐ¤ňźÂšÔ¤ˇ¤ż¤Č
+ ¤­ RAMDAC ¤Ź˛ż¤Ť¤ňÄ´¤Ů¤Ţ¤šĄŁÁ´¤Ć¤Î Mach64 ĽŤĄźĽÉ¤Ç¤Ď RAMDAC ¤ĎŔľ¤ˇ¤ŻÄ´
+ ¤Ů¤é¤ě¤Ţ¤šĄŁÄ´¤Ů¤żˇë˛Ě¤ň XF86Config ¤ËťŘÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ˇ¤Ť¤ˇĄ˘
+ probeonly ¤Îˇë˛Ě¤ŹŔľ¤ˇ¤Ż¤Ę¤¤žěšç¤ĎťŘÄꤡ¤Ę¤¤¤č¤Ś¤ËĄŁ XF86Config ¤Ë
+ RAMDAC ¤ňťŘÄꤚ¤ëÁ°¤Ë Mach64 ĽŤĄźĽÉ¤ňĚܤǸŤ¤Ć¤Î¤É¤ó¤Ę RAMDAC ¤ŹĹëşÜ¤ľ
+ ¤ě¤Ć¤¤¤ë¤ŤłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁprobeonly ¤Î˝ĐÎϡë˛Ě¤Î RAMDAC ¤ČĽÜĄźĽČžĺ¤Î
+ ĽÁĽĂĽ×¤Č¤Ď¤Ă¤­¤ę¤Č°ă¤ŚžěšçĄ˘RAMDAC ¤ÎšÔ¤ňĽłĽáĽóĽČ¤Ë¤ˇ¤Ć¤â¤Ś°ěĹŮ
+ "-probeonly" ¤ňÉŐ¤ą¤Ć Mach64 X ĽľĄźĽĐ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤Ç¤â¤Ţ¤Ŕ
+ ´Ö°ă¤Ă¤Ć¤¤¤ë RAMDAC ¤ňĘóšđ¤š¤ëžěšç¤Ď XFree86@XFree86.Org ¤ËĽĐĽ°ĽěĽÝĄź
+ ĽČ¤ňÁ÷¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ °ěČĚ¤Ë ATI Graphics Pro Turbo ¤Č ATI WinTurbo ĽŤĄźĽÉ¤Ë¤Ď ATI68860 ¤Č
+ ATI68880 RAMDAC ¤ŹĹëşÜ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁIBM RGB514 RAMDAC ¤Ď ATI Graphics
+ Pro Turbo 1600 ĽŤĄźĽÉ¤ËĹëşÜ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ°ěČĚ¤Ë ATI Graphics
+ Xpression, ATI Video Xpression ¤Č ATI 3d Xpression ĽŤĄźĽÉ¤Ë¤Ďž¤Î
+ RAMDAC ¤ŹĹëşÜ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁMach64 CT, ET, VT, GT (3D Rage) ¤Č 3D Rage
+ II ĽÁĽĂĽ×¤Ď "Ćâ¢" RAMDAC (Î㤨¤Đ Mach64 ĽÁĽĂĽ×¤ËÁȤߚţ¤ó¤Ç) ¤Ë¤Ę¤Ă¤Ć
+ ¤¤¤Ţ¤šĄŁ
+
+ Mach64 Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ĎĆĂĘ̤Ę(ĽŃĽĂĽŻĽÉĽÔĽŻĽťĽë) 24bpp ĽâĄźĽÉ ¤ŹťČ
+ ÍѲÄÇ˝¤ČŔëĹÁ¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘¤ł¤ÎĽâĄźĽÉ¤Ď¸˝şßĄ˘Mach64 ¤Ç¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤
+ ¤Ţ¤ť¤óĄŁ¤ł¤ě¤Ť¤é˝Đ¤ëĽĐĄźĽ¸ĽçĽó¤ÇĽľĽÝĄźĽČ¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Mach64 X ĽľĄźĽĐ¤ŹŔľłÎ¤ËľĄÇ˝¤š¤ë¤Ë¤ĎĽÓĽÇĽŞĽáĽâĽę¤Îˇä´Ö¤ŹÉŹÍפǤšĄŁ¤ł¤ě
+ ¤Ď ISA Mach64 ĽŤĄźĽÉ ¤ČĽˇĽšĽĆĽŕ¤ÎĽáĽ¤ĽóĽáĽâĽę¤Ë 12M ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽáĽâĽę
+ ¤Ź¤˘¤ë¤ČĆ°şî¤ˇ¤Ę¤¤¤ł¤Č¤ňź¨¤ˇ¤Ţ¤šĄŁPCI ¤Î Mach64 ĽŤĄźĽÉ¤Ţ¤ż¤Ď VLB ¤Î
+ Mach64 ĽŤĄźĽÉ¤Îžěšç¤ËĄ˘ Mach64 X ĽľĄźĽĐ¤ĎĽáĽ¤ĽóĽáĽâĽę¤Î°ěÉô¤ňťČ¤Ă¤ĆĆ°
+ şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 2. Mach64 X ĽľĄźĽĐ¤ÎÉ˝ź¨ÂŽĹ٤κÇĹŹ˛˝
+
+ Mach64 X ĽľĄźĽĐ¤ÎÉ˝ź¨ÂŽĹ٤κÇĹŹ˛˝¤Î°Ů¤ËĄ˘źĄ¤ÎşÇšâ¤Î˛ňÁüĹ٤ňťČÍѤš¤ë¤ł
+ ¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁĽŐĽŠĽóĽČ¤ČĽÔĽŻĽšĽŢĽĂĽ×Ľ­ĽăĽĂĽˇĽĺ¤ČĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝
+ Ľë¤ňťČ¤ŚÍžÍľ¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ şÇÂç˛ňÁüĹŮ żź¤ľ ĽÓĽÇĽŞĽáĽâĽę
+ -------------- --- ---------
+ 1280x1024 8 4Mb
+ 1280x1024 16 4Mb
+ 1024x767 32 4Mb
+
+ 1280x1024 8 2Mb
+ 1024x767 16 2Mb
+ 800x600[*] 32 2Mb
+
+ 1024x767 8 1Mb
+ 800x600[*] 16 1Mb
+
+ [*] - 2M ĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤Ç¤ĎĄ˘ 640x480 ĽâĄźĽÉ¤Ë¤Ş¤¤¤Ć 1024x480 ¤Î
+ ˛žÁ۲ňÁüĹ٤ňťČ¤Ś¤ż¤á¤Ë¤ĎĽŐĽŠĽóĽČ¤ČĽÔĽŻĽšĽŢĽĂĽ×¤ÎĽ­ĽăĽĂĽˇĽĺ¤ŹÍŁ°ě¤ÎĘýËĄ
+ ¤Ç¤šĄŁĽ­ĽăĽĂĽˇĽĺ¤Ť¤éĆŔ¤é¤ě¤ëÉ˝ź¨ÂŽĹ٤θú˛Ě¤ňĆŔ¤ë¤Ë¤ĎşÇÂç˛čĚĚĽľĽ¤Ľş¤ň
+ 800x600 ¤Ë¤š¤ë¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁĆą¤¸Íýśţ¤Ç 16bpp ¤Ç 1M ĽĐĽ¤ĽČ¤ÎĽáĽâ
+ Ľę¤ÎĽŤĄźĽÉ¤ŹĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ 1M ĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽáĽâĽę¤Ç¤Ď 32bpp ¤Ç¤Î
+ Ć°şî¤Ď˝ĐÍč¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ žĺľ­¤ÎŔâĚŔ¤Îľť˝ŃĹŞ¤ĘŔâĚŔ¤Ď: Mach64 X ĽľĄźĽĐ¤Ď˛čĚ̤ÎÉý¤Ź 1024 °Ęžĺ¤Îťţ
+ ¤Ë¤Î¤ßĽŐĽŠĽóĽČ¤ČĽÔĽŻĽšĽŢĽĂĽ×Ľ­ĽăĽĂĽˇĽĺ¤ŹÍ­¸ú¤Ë¤Ę¤ë¤Ť¤é¤Ç¤šĄŁ¤ł¤ÎŔŠ¸Â¤Ď
+ ž­Íč¤Î X ĽľĄźĽĐ¤ÎĽĐĄźĽ¸ĽçĽó¤Ç¤ĎĚľ¤Ż¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁĽÓĽÇĽŞĽŤĄźĽÉ¤ÎşÇÂçÉ˝
+ ź¨Ŕ­Ç˝¤ň°ú¤­˝Đ¤š¤Ë¤ĎĄ˘(şÇÄă 1024x256 ¤Î)Ľ­ĽăĽĂĽˇĽĺÍѤÎČóÉ˝ź¨Îΰč¤ň˝źĘŹ
+ ¤ËłÎĘÝ˝ĐÍč¤ëťö¤ňłÎǧ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁĽ­ĽăĽĂĽˇĽĺ¤Ë¤Ä¤¤¤ĆÉŐ¤ą˛Ă¤¨¤ě
+ ¤ĐĄ˘ Mach64 ¤ĎşÇ¸ĺ¤ÎĽáĽâĽę¤Îˇä´Ö 1024 ĽĐĽ¤ĽČ¤ňĽáĽâĽęĽŢĽĂĽ×ĽÉĽěĽ¸ĽšĽż¤Ë
+ łä¤ęÉŐ¤ą¤Ţ¤šĄŁĽÓĽÇĽŞĽáĽâĽę¤Ť¤éž¤ÎŔţ¤ňźč¤ę˝ü¤­¤Ţ¤šĄŁ¤ł¤ÎťţĄ˘şÇÄă
+ 1024x257 ¤ÎĽÓĽÇĽŞĽáĽâĽęÎΰ褏ɏÍפˤʤę¤Ţ¤šĄŁ
+
+ 3. XF86Config ĽŞĽ×ĽˇĽçĽó
+
+ Mach64 X ĽľĄźĽĐÍŃ¤Ë "Device" Ŕá¤Ç¤¤¤Ż¤Ä¤Ť¤ÎĽŞĽ×ĽˇĽçĽó¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤
+ ¤Ć¤¤¤Ţ¤šĄŁÉ¸˝ŕ¤Ç Mach64 X ĽľĄźĽĐ¤Ď BIOS ¤Ť¤é RAMDAC ¤Îˇż¤ňǧźą¤ˇ¤Ţ¤šĄŁ
+ ɸ˝ŕ¤Î RAMDAC ¤Îˇż¤ňžĺ˝ń¤­¤ˇ¤ż¤¤žěšç¤ĎĄ˘(BIOS ¤Ź´Ö°ă¤Ă¤ż RAMDAC ¤ÎĘóšđ
+ ¤ň¤ˇ¤Ę¤¤¸Â¤ę¤Ş´Ť¤á¤ˇ¤Ţ¤ť¤ó¤Ź) XF86Config ĽŐĽĄĽ¤Ľë¤Î "Ramdac" ¤ÎšŕĚܤË
+ RAMDAC ¤Îˇż¤ňťŘÄꤚ¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁMach64 X ĽľĄźĽĐ¤ŹĆąÍÍ¤Ë BIOS ¤Ť¤é
+ ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ÎĽŻĽíĽĂĽŻ¤ňĆɤ߽Фš¤Č¤­¤ÎĚäÂꤏ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁÉ¸˝ŕ¤ÎĽŻ
+ ĽíĽĂĽŻĽÁĽĂĽ×¤Îˇż¤ňžĺ˝ń¤­¤ˇ¤ż¤¤žěšç¤ĎĄ˘(BIOS ¤Ź´Ö°ă¤Ă¤żĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Î
+ Ęóšđ¤ň¤ˇ¤Ę¤¤¸Â¤ę¤Ş´Ť¤á¤ˇ¤Ţ¤ť¤ó¤Ź) XF86Config ĽŐĽĄĽ¤Ľë¤Î "ClockChip" ¤Î
+ šŕĚܤ˼ŻĽíĽĂĽŻĽÁĽĂĽ×¤Îˇż¤ňťŘÄꤚ¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁťöÁ°¤ËÁȤߚţ¤Ţ¤ě¤żĽŻ
+ ĽíĽĂĽŻ¤ňťČ¤¤¤ż¤¤žěšç¤Ď "no_program_clocks" ĽŞĽ×ĽˇĽçĽó¤ňťŘÄꤡ¤ĆĽŻĽíĽĂ
+ ĽŻÁȤߚţ¤ß¤ňťß¤á¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎžěšçĄ˘ Mach64 X ĽľĄźĽĐ¤Ď BIOS ¤Ť¤éĽŻ
+ ĽíĽĂĽŻ¤ňĆɤߚţ¤ß¤Ţ¤šĄŁÄ̞異XF86Config ĽŐĽĄĽ¤Ľë¤Î "Clocks" šÔ¤Ď
+ "no_bios_clocks" ĽŞĽ×ĽˇĽçĽó¤ŹÍż¤¨¤é¤ě¤Ę¤¤¸Â¤ęĚľťë¤ˇ¤Ţ¤šĄŁ
+
+ "sw_cursor" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤Î¤Ť¤ď¤ę¤ËĽ˝ĽŐĽČĽŚĽ§Ľ˘ĽŤĄźĽ˝
+ Ľë¤ňťČÍѲÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ "hw_cursor" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňťČÍѲÄÇ˝¤Ë¤ˇ¤Ţ
+ ¤šĄŁ"sw_cursor" ĽŞĽ×ĽˇĽçĽó¤ŹťŘÄꤾ¤ě¤Ć¤¤¤ëžěšç¤ň˝ü¤¤¤ĆĽĎĄźĽÉĽŚĽ§
+ Ľ˘ĽŤĄźĽ˝Ľë¤ňɸ˝ŕ¤ÇťČ¤Śťţ¤ĎÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ "composite" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽłĽóĽÝĽ¸ĽĂĽČĆą´üÂĐąţ¤ÎĽâĽËĽżĄź¤ÎŔßÄę¤ňšÔ¤¤¤Ţ¤šĄŁ
+
+ "dac_8_bit" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď RGB Ĺö¤ę 8 ĽÓĽĂĽČ¤ÎĂͤň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁ Chrontel
+ 8398 RAMDAC ¤Ç¤Ď¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĆ°şî¤ˇ¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ Chrontel 8398 RAMDAC ¤ň˝ü¤Ż Mach64 X ĽľĄźĽĐ¤Îɸ˝ŕĂÍ¤Ď RGB
+ Ĺö¤ę 8 ĽÓĽĂĽČ¤Ę¤Î¤Ç¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ "dac_6_bit" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď RGB Ĺö¤ę 6 ĽÓĽĂĽČ¤ÎĂͤň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ "override_bios" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽÓĽÇĽŞĽÜĄźĽÉ¤Î BIOS ¤Ç¤ĎÉÔŔľ¤ČšÍ¤¨¤é¤ě¤Ć¤¤¤ëĆĂĘĚ
+ ¤ĘĽÓĽÇĽŞĽâĄźĽÉ¤ň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î BIOS ¤Ź´Ö°ă¤Ă¤żşÇÂç˛ňÁü
+ Ĺ٤Ť¤ÄĄż¤Ţ¤ż¤ĎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Îžĺ¸Â¤ň¤â¤Ă¤Ć¤¤¤Ţ¤šĄŁČóžď¤ËĂí°Ő¤ˇ¤Ć
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňťČÍѤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĆĂĘĚ¤ĘĽÓĽÇĽŞĽâĄźĽÉ¤ĎĽŤĄźĽÉ¤äĽâ
+ ĽËĽżĄź¤ňÄˤá¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ "no_block_write" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽÖĽíĽĂĽŻ˝ń¤­šţ¤ßĽâĄźĽÉ¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁĽÖĽíĽĂĽŻ˝ń
+ ¤­šţ¤ßĽâĄźĽÉ¤ĎĹŹŔÚ¤Ę VRAM ¤ÎĽŤĄźĽÉ¤Ç¤Î¤ßĆ°şî¤ˇĄ˘¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď
+ DRAM ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁxmag ¤ÇŔÚ¤ęźč¤Ă¤ż˛čĚ̤˼μ¤Ľş
+ ¤ŹÉ˝ź¨¤ľ¤ě¤ż¤éĄ˘ĽÖĽíĽĂĽŻ˝ń¤­šţ¤ßĽâĄźĽÉ¤ÎĚäÂꤏšÍ¤¨¤é¤ě¤Ţ¤šĄŁ¤ł¤Î
+ "ĽÎĽ¤Ľş" ¤Ď°ěČ̤˼ŚĽ¤ĽóĽÉĽŚ¤äĽáĽËĽĺĄź¤ňˇŤ¤ęĘÖ¤ˇ˛čĚ̤ËÉ˝ź¨¤ˇ¤ż¤Č
+ ¤­Ĺů¤Ë¸Ť¤é¤ě¤Ţ¤šĄŁ
+
+ "block_write" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ďžď¤ËĽÖĽíĽĂĽŻ˝ń¤­šţ¤ßĽâĄźĽÉ¤ňÍ­¸ú¤Ë¤ˇ¤Ţ¤šĄŁĽÖĽíĽĂ
+ ĽŻ˝ń¤­šţ¤ßĽâĄźĽÉ¤ĎĹŹŔÚ¤Ę VRAM ¤ÎĽŤĄźĽÉ¤Ç¤Î¤ßĆ°şî¤ˇĄ˘¤ł¤ÎĽŞĽ×ĽˇĽç
+ Ľó¤Ď DRAM ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁĂľşş¤ˇ¤ż˝é´üĂͤňžĺ˝ń¤­¤ˇ
+ ¤ż¤¤žěšç¤ĎĄ˘¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňťČ¤Ś¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď
+ ˛čĚĚ¤Ë "ĽÎĽ¤Ľş" ¤ňÉ˝ź¨¤š¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ "power_saver" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽšĽŻĽęĄźĽóĽťĄźĽĐĄź¤ŹÍ­¸ú¤Ë¤Ę¤Ă¤Ć¤¤¤ëťţ˛čĚ̤ň°Ĺ¤Ż
+ ¤š¤ëÂĺ¤ď¤ę¤ËĹŹŔÚ¤Ë "green" ĽâĽËĽżĄź¤ÎžĘĹĹÎĎľĄÇ˝¤ňĽľĄźĽĐ¤ËťČÍѲÄ
+ Ç˝¤Ë¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď̤¤ŔźÂ¸łĂć¤Ç¤šĄŁĚőĂí: "green" ĽâĽËĽż
+ Ąź¤Č¤Ď´Äś­¤ËÍĽ¤ˇ¤¤ĽâĽËĽżĄź¤Ç¤ˇ¤ç¤Ś:-)
+
+ "no_program_clocks" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎžďťţĽŻĽíĽĂĽŻĽ×ĽíĽ°ĽéĽßĽóĽ°¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁÄĚžď
+ Mach64 ĽľĄźĽĐ¤Ď¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ŹÍż¤¨¤é¤ě¤Ę¤¤žěšçĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Î
+ ĽŻĽíĽĂĽŻ¤Ť¤é¤ÎĽŻĽíĽĂĽŻ¤ÇĽ×ĽíĽ°ĽéĽŕ¤š¤ëĘýź°¤ň¤Č¤Ă¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎĽŞ
+ Ľ×ĽˇĽçĽó¤ňÉŐ¤ą¤ë¤ČĽŻĽíĽĂĽŻ¤ň BIOS ¤Ť¤éĆɤ߽ФˇĄ˘
+ "no_bios_clocks" ¤ňŔßÄꤚ¤ë¤ČĽŻĽíĽĂĽŻšÔ¤Ť¤éŔßÄꤚ¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ
+
+ "no_bios_clocks" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽÓĽÇĽŞĽŤĄźĽÉ¤Î BIOS ¤Ť¤éĆɤ߽Фˇ¤żĽŻĽíĽĂĽŻ¤Č
+ XF86Config ĽŐĽĄĽ¤Ľë¤Î Clocks šÔ¤Îžĺ˝ń¤­¤ňÍ­¸ú¤Ë¤ˇ¤Ţ
+ ¤šĄŁ"no_program_clocks" ĽŞĽ×ĽˇĽçĽó¤ňŔßÄꤚ¤ëžěšç¤ň˝ü¤¤¤ĆÄĚžď
+ Mach64 ĽľĄźĽĐ¤Ď BIOS ¤ÎĽŻĽíĽĂĽŻ¤Č Clocks šÔ¤ňĚľťë¤ˇ¤Ţ¤š(žĺľ­ť˛
+ žČ)ĄŁ
+
+ "no_font_cache" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎžďťţĽŐĽŠĽóĽČĽ­ĽăĽĂĽˇĽĺ¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁÉ¸˝ŕ¤Ç¤Ďżĺ
+ Ęż˛ňÁüĹ٤Ź 1024 ĽÔĽŻĽťĽë¤Ť¤˝¤ě°Ęžĺ¤Îžěšç¤ČĽ­ĽăĽĂĽˇĽĺ¤ËťČ¤ŚÉ˝ź¨¤ľ
+ ¤ě¤Ę¤¤ĽÓĽÇĽŞĽáĽâĽę¤Ź˝˝ĘŹ¤Ë¤˘¤ëžěšç¤ËÍ­¸ú¤Ç¤šĄŁ
+
+ "no_pixmap_cache" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎžďťţĽÔĽŻĽšĽŢĽĂĽ×Ľ­ĽăĽĂĽˇĽĺ¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁÉ¸˝ŕ¤Ç
+ ¤Ď¤ĎżĺĘż˛ňÁüĹ٤Ź 1024 ĽÔĽŻĽťĽë¤Ť¤˝¤ě°Ęžĺ¤Îžěšç¤ČĽ­ĽăĽĂĽˇĽĺ¤ËťČ¤Ś
+ É˝ź¨¤ľ¤ě¤Ę¤¤ĽÓĽÇĽŞĽáĽâĽę¤Ź˝˝ĘŹ¤Ë¤˘¤ëžěšç¤ËÍ­¸ú¤Ç¤šĄŁ
+
+ MemBase ´đÄ켢ĽÉĽěĽš
+ ¤ł¤ÎŔßÄę¤ĎĽáĽâĽę¤Îˇä´Ö¤ÎĽ˘ĽÉĽěĽš¤ÎťŘÄę¤Ç¤šĄŁÉ¸˝ŕ¤ÇĄ˘ˇä´Ö¤ÎĽ˘ĽÉĽě
+ Ľš¤ĎźŤĆ°ĹޤËǧźą¤ľ¤ě¤ë¤Î¤ÇÉŹÍפ˘¤ę¤Ţ¤ť¤ó¤ŹĄŁ Mach64 X ĽľĄźĽĐ¤ŹĽť
+ Ľ°ĽáĽóĽČÎăł°¤Çťß¤Ţ¤ëžěšç¤ĎĄ˘ˇä´Ö¤ÎĽ˘ĽÉĽěĽš¤ŹŔľ¤ˇ¤ŻÇ§źą˝ĐÍč¤Ć¤¤¤Ţ
+ ¤ť¤óĄŁ¤ł¤ÎĚäÂę¤ň˛ňˇč¤š¤ë¤Ë¤Ďˇä´Ö¤ÎĽ˘ĽÉĽěĽš¤ňž¤Îžě˝ę¤ËÂ夨¤Ć¤ß¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ
+
+ ClockChip ¤Î "ˇż"
+ ¤ł¤ÎšŕĚܤǤϼŻĽíĽĂĽŻĽÁĽĂĽ×¤Îˇż¤ňťŘÄꤡ¤Ţ¤šĄŁźĄ¤Î˛Á¤Ď ˇż¤ËÍ­¸ú¤Ę
+ ¤â¤Î¤Ç¤š :
+
+ o ati18818
+
+ o att20c408
+
+ o ch8398
+
+ o ibm_rgb514
+
+ o ics2595
+
+ o stg1703
+
+ Ramdac ¤Î "ˇż"
+ ¤ł¤ÎšŕĚÜ¤Ď Ramdac ¤Îˇż¤ňťŘÄꤡ¤Ţ¤šĄŁźĄ¤Î˛Á¤Ď ˇż¤ËÍ­¸ú¤Ę¤â¤Î¤Ç¤š
+ :
+
+ o ati68860
+
+ o ati68860b
+
+ o ati68860c
+
+ o ati68875
+
+ o att20c408
+
+ o ch8398
+
+ o ibm_rgb514
+
+ o internal
+
+ o stg1702
+
+ o stg1703
+
+ o tlc34075
+
+ 4. ´űĂΤÎĚäÂę¤ČĽĐĽ°Ęóšđ
+
+ ¸˝şß¤Î Mach64 X ĽľĄźĽĐ¤Ç¤Ď¤¤¤Ż¤Ä¤Ť¤Î´űĂΤÎĚäÂꤏ¤˘¤ę¤Ţ¤šĄŁ¤˝¤ě¤Ď:
+
+ o °ěÄę¤Î Mach64 CT ĽŤĄźĽÉ¤Ç 16bpp ¤Č 32bpp ĽâĄźĽÉ¤Ç¤Î˛čĚ̤ν֤­¤ĎÄž¤Ă
+ ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ o Ćó˝ĹĽšĽ­ĽăĽóĽâĄźĽÉ¤ÇĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ÎžĺȞʏ¤ˇ¤ŤÉ˝ź¨¤ˇ¤Ţ¤ť¤óĄŁ
+ ž¤ÎÁ´¤Ć¤ÎĽâĄźĽÉ¤Ç¤Ď¤Ś¤Ţ¤ŻĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ o 3D Rage II ¤ň´đ¤Ë¤ˇ¤ż Mach64 ĽŤĄźĽÉ¤ĎŔľ¤ˇ¤Ż˝é´ü˛˝˝ĐÍč¤Ţ¤ť¤óĄŁ
+
+ o ¤¤¤Ż¤Ä¤Ť¤Î RAMDAC ¤Ď BIOS ¤Ç¤Ď´Ö°ă¤Ă¤ĆĘóšđ¤ˇ¤Ć¤ˇ¤Ţ¤¤¤Ţ¤šĄŁ
+ XF86Config ĽŐĽĄĽ¤Ľë¤Ç RAMDAC ¤ňĚŔź¨ĹŞ¤ËťŘÄꤡ¤Ć¤ä¤ě¤Đźč¤ę°ˇ¤¨¤Ţ¤šĄŁ
+ ¤ł¤Ś¤š¤ě¤ĐĚäÂę¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ o 12M ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽáĽ¤ĽóĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż ISA ĽŤĄźĽÉ¤ĎĽÓĽÇĽŞĽáĽâĽę¤Îˇä
+ ´Ö¤Ź¤Č¤ě¤Ę¤¤¤Î¤ÇĽľĄźĽĐ¤ŹĆ°şî¤ˇ¤Ţ¤ť¤óĄŁ¤ł¤ě¤ĎÂçťĹťö¤Ç¤šĄŁ
+
+ ĚäÂę¤Ë˝Đ˛ń¤Ă¤ż¤éĄ˘¤Ţ¤şşÇ˝é¤Ë(ĽŮĄźĽżČǤâ´Ţ¤ó¤Ç)ÍřÍѲÄÇ˝¤ĘşÇżˇČǤňťČ¤Ă¤Ć
+ ¤¤¤ë¤ŤłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁÇŻ´Ö¤ňÄ̤¸¤Ć ATI ¤Ďżˇ¤ˇ¤¤ĽŤĄźĽÉ¤ňČŻÉ˝¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁżˇ¤ˇ¤¤ĽŤĄźĽÉ¤ŹĹëşÜ¤ˇ¤Ć¤¤¤ëżˇ¤ˇ¤¤ Mach64 ĽÁĽĂĽ×Ą˘RAMDAC ¤äĽŻĽíĽĂĽŻ
+ ĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤š¤ë¤ż¤á¤ËĄ˘¤ł¤Î¤˝¤ě¤ž¤ě¤Îżˇ¤ˇ¤¤ĽŤĄźĽÉ¤Ë¤ĎĽ×ĽíĽ°ĽéĽŕ¤Î
+ ÄɲäŹÉŹÍפŔ¤Ť¤é¤Ç¤šĄŁ
+
+ Ł˛ČÖĚܤ˥˘RELNOTES ¤Č README ĽŐĽĄĽ¤Ľë¤ň(¤˝¤ÎĽĐĄźĽ¸ĽçĽó¤Çźę¤Ë¤Ď¤¤¤ëž¤Î
+ ʸ˝ń¤â)¤ňÄ´¤Ů¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁŁłČÖĚÜ¤Ë XF86Config ĽŐĽĄĽ¤Ľë¤Ë Ramdac,
+ ClockChip ¤Ţ¤ż¤Ď Clocks šÔ¤Ź¤Ę¤¤¤ł¤Č¤ňłÎǧ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ě¤é¤Ď Mach64
+ ĽľĄźĽĐ¤ŹźŤĆ°ĹޤËĂľĂΤˇ¤Ţ¤šĄŁ
+
+ ¤Ţ¤ŔĚäÂꤏ¤˘¤ëžěšç¤ĎĄ˘XFree86@XFree86.org ¤Ţ¤ÇĹŝҼᥟĽë¤ňÁ÷¤ë¤Ť
+ comp.windows.x.i386unix ¤Č¤¤¤ŚĽËĽĺĄźĽšĽ°ĽëĄźĽ×¤ËĹęšĆ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ XFree86@XFree86.org ¤ËĹŝҼᥟĽë¤ňÁ÷¤Ă¤ĆËؤɤÎĚäÂę¤Î˛óĹú¤ňłŤČŻźÔ¤ŹĹú¤¨
+ ¤ëĘý¤ŹÎɤ¤¤Î¤ČĄ˘ťä(ĂřźÔ)¤Ź¤ď¤ş¤Ť¤ĘźŤÍłťţ´Ö¤ň X ĽľĄźĽĐ¤Ëżˇ¤ˇ¤¤ľĄÇ˝łČÄĽ
+ ¤ÎşîśČ¤ËťČ¤¤¤ż¤¤¤Î¤ÇĄ˘ťä(ĂřźÔ)¤ËĹŝҼᥟĽë¤ňÁ÷¤é¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ¤É¤Ś¤â
+ ¤˘¤ę¤Ź¤Č¤ŚĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Mach64.sgml,v 3.12 1996/10/24 12:30:19 dawes Exp
+
+ $XConsortium: Mach64.sgml /main/5 1995/12/29 15:59:01 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/Mach64.sgml,v
+ 3.12 1996/10/24 12:30:19 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/Mach64.sgml,v 3.13 1996/12/09 05:13:55 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README
new file mode 100644
index 000000000..9d0788c34
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README
@@ -0,0 +1,1128 @@
+ XFree86[TM] 3.2 ¤Î¤ż¤á¤Î README
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ
+
+ Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 26 Ćü
+
+ XFree86 ¤Č¤ĎĽ¤ĽóĽĆĽëžĺ¤ÇĆ°¤Ż¤¤¤Ż¤Ä¤Ť¤ÎĽĐĄźĽ¸ĽçĽó¤Î Unix ¤Č Unix ¤Ëť÷¤Ć
+ ¤¤¤ëĽŞĽÚĽěĄźĽĆĽŁĽóĽ°ĽˇĽšĽĆĽŕ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë X11R6.1 ¤Ë°Üż˘¤ˇ¤ż¤â¤Î
+ ¤Ç¤šĄŁşŁ˛ó¤ÎČǤǤϥ˘Âż¤Ż¤ÎĽĐĽ°¤Î˝¤Ŕľ¤ČĆąťţ¤Ëżˇ¤ˇ¤¤ľĄÇ˝¤ÎÄɲääŔ­Ç˝¤Î¸ţ
+ žĺ¤ňżŢ¤ę¤Ţ¤ˇ¤żĄŁXFree86 ¤ĎÂż¤Ż¤ÎĽ˘ĄźĽ­ĽĆĽŻĽÁĽăÍѤμм¤ĽĘĽęÇŰÉŐĘŞ¤ČĆąÍÍ
+ ¤Ë X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î X11R6.1 ¤ÎĽ˝ĄźĽšĽłĄźĽÉ¤ËÂФˇ¤Ć¤ÎĽŃĽĂĽÁĽÇĄźĽż¤Č¤ˇ
+ ¤ĆĆţźę˛ÄÇ˝¤Ç¤šĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. XFree86 3.2 ¤Ç˛ż¤Źżˇ¤ˇ¤Ż¤Ę¤Ă¤ż¤Ť ?
+
+ 2. XFree86 ¤ÎĽĆĽšĽČ¤ňšÔ¤Ă¤żĽˇĽšĽĆĽŕ Ăí°Ő: ¸˝şß¤ÎĽĐĄźĽ¸ĽçĽó¤Ď¤ł¤ł
+ ¤Ë°ěÍ÷¤Ë¤ˇ¤żÁ´¤Ć¤ÎĽˇĽšĽĆĽŕ¤ÇĽĆĽšĽČ¤ˇ¤Ć¤Ď¤¤¤Ţ¤ť¤óĄŁ
+
+ 3. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ
+
+ 4. šš¤ËÂż¤Ż¤ÎžđĘó¤Ď¤É¤ł¤Ë¤˘¤ë¤Ť
+
+ 5. ś¨ÎĎźÔĄ˘Ä󜥟ԤˤĤ¤¤Ć
+
+ 6. ϢÍížđĘó
+
+ 7. XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ
+
+ 8. Ľ˝ĄźĽš¤ČĽĐĽ¤ĽĘĽęĽŐĽĄĽ¤Ľë¤Î¤˘¤ëĽľĽ¤ĽČ
+ ______________________________________________________________________
+
+ 1. XFree86 3.2 ¤Ç˛ż¤Źżˇ¤ˇ¤Ż¤Ę¤Ă¤ż¤Ť ?
+
+ źĄ¤ÎšŕĚܤň1995 ÇŻ 8ˇî ¤Ë¸řłŤ¤ˇ¤ż XFree86 3.1.2 ¤ËľĄÇ˝Äɲ䡤ޤˇ¤żĄŁ:
+
+ 1. XFree86 3.2 ¤Ď X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î X11R6.1 ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ 2. OS/2 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3. DEC Alpha/AXP ¤Ç Linux/AXP (ECOFF ¤Č ELF ¤ÎΞĘý)¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ
+
+ 4. Linux/m68k ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 5. ĆüËܤΠPC98 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 6. żˇ¤ˇ¤¤Ľ°ĽéĽŐĽŁĽĂĽŻŔßÄęĽćĄźĽĆĽŁĽęĽĆĽŁ¤Î XF86Setup
+
+ 7. S3 Trio64V+ ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 8. S3 ViRGE ¤Č ViRGE/VX ÍѤοˇ¤ˇ¤¤ĽľĄźĽĐ (XF86_S3V)
+
+ 9. S3 868, 968 ¤Č Trio64V+ ĽÁĽĂĽ×ĽťĽĂĽČÂĐąţĽÉĽéĽ¤ĽĐ "newmmio" ÍѤΠS3
+ ĽľĄźĽĐ ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 10.
+ Mach64 ĽŤĄźĽÉ (GX rev 3, CT, VT, GT) ¤ňÄɲüľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 11.
+ ET6000 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 12.
+ ¤¤¤Ż¤Ä¤Ť¤Îżˇ¤ˇ¤¤ Cirrus ĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 13.
+ Trident TGUI ĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 14.
+ Number Nine Imagine 128 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 15.
+ Matrox Millennium ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 16.
+ NVidia NV1 / SGS Thomson STG2000 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 17.
+ ¤¤¤Ż¤Ä¤Ť¤Î SiS ĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 18.
+ Chips & Technologies ĽÁĽĂĽ×¤ňÄɲüľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 19.
+ DEC 21030 (aka DEC TGA; Linux/AXP ¤Î¤ß)¤ňÄɲüľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 20.
+ DGA ĽľĄźĽĐ ľĄÇ˝łČÄĽĄŁ
+
+ 21.
+ XInput ľĄÇ˝łČÄĽ¤ňźÂÁő¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ ¤ľ¤é¤Ę¤ëžđĘó¤ĎRELNOTE ĽŐĽĄĽ¤Ľë¤Ë¤˘¤ę¤Ţ¤šĄŁĘŃšš¤ÎžÜşŮ¤Ę°ěÍ÷¤ĎĽ˝ĄźĽšÇŰÉŰ
+ ĘŞ¤Ë¤˘¤ë CHANGELOG ĽŐĽĄĽ¤Ľë¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. Ăí°Ő: ¸˝şß¤ÎĽĐĄźĽ¸ĽçĽó¤Ď¤ł¤ł¤Ë°ěÍ÷¤Ë¤ˇ¤żÁ´¤Ć¤ÎĽˇĽšĽĆĽŕ¤ÇĽĆĽšĽČ¤ˇ¤Ć
+ ¤Ď¤¤¤Ţ¤ť¤óĄŁ XFree86 ¤ÎĽĆĽšĽČ¤ňšÔ¤Ă¤żĽˇĽšĽĆĽŕ
+
+ SVR4.0:
+
+ o Esix: 4.0.3A, 4.0.4, 4.0.4.1
+
+ o Microport: 2.2, 3.1, 4.1, 4.2
+
+ o Dell: 2.1, 2.2, 2.2.1
+
+ o UHC: 2.0, 3.6
+
+ o Consensys: 1.2
+
+ o MST: 4.0.3 (Load 2.07 and Load 3.02)
+
+ o ISC: 4.0.3
+
+ o AT&T: 2.1, 4.0
+
+ o NCR: MP-RAS
+
+ o SunSoft: Solaris x86 2.1, 2.4, 2.5
+
+ o PANIX 5.0 for AT
+
+ SVR4.2:
+
+ o Consensys
+
+ o Novell UnixWare
+
+ SVR3:
+
+ o SCO: 3.2.2, 3.2.4
+
+ o ISC: 3.0, 4.0, 4.1
+
+ Others:
+
+ o NetBSD 1.0, 1.1, 1.2
+
+ o OpenBSD 2.0
+
+ o FreeBSD 1.1.5.1, 2.0.5, 2.1, 2.1.5, 2.2-current
+
+ o BSD/386 1.1, BSD/OS 2.0
+
+ o Mach 386
+
+ o Linux (Intel x86, DEC Alpha/AXP ¤Č m68k)
+
+ o Amoeba
+
+ o Minix-386
+
+ o LynxOS AT 2.2.1, 2.3.0, 2.4.0
+
+ o LynxOS microSPARC 2.4.0
+
+ PC98:
+
+ o FreeBSD(98) 2.0.5, 2.1, 2.1.5, 2.2-current
+
+ o NetBSD/pc98 (NetBSD 1.2 ¤ň´đ¤Ë¤ˇ¤ż)
+
+ o 98 ÍŃ PANIX 5.0
+
+ 3. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ
+
+ ¸˝şßĄ˘XFree86 3.2 ¤ĎźĄ¤ÎĽ˘ĽŻĽťĽéĽěĄźĽżĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤š:
+
+ 8514/A
+ (¤ČĄ˘¤˝¤Î¤˝¤Ă¤Ż¤ę¤ľ¤ó)
+
+ ATI
+ Mach8, Mach32, Mach64
+
+ Cirrus
+ CLGD5420, CLGD5422, CLGD5424, CLGD5426, CLGD5428, CLGD5429,
+ CLGD5430, CLGD5434 CLGD5436, CLGD5440, CLGD5446, CLGD5462,
+ CLGD5464
+ S3 86C911, 86C924, 86C801, 86C805, 86C805i, 86C928, 86C864, 86C964,
+ 86C732, 86C764, 86C765, 86C868, 86C968, 86C325, 86C988
+
+ Western Digital
+ WD90C31, WD90C33, WD90C24A
+
+ Weitek
+ P9000
+
+ IIT
+ AGX-014, AGX-015, AGX-016
+
+ IBM
+ XGA-2
+
+ Tseng
+ ET4000/W32, ET4000/W32i, ET4000/W32p, ET6000
+
+ Oak Technologies Inc
+ OTI087
+
+ Ark Logic
+ ARK1000PV, ARK1000VL, ARK2000PV, ARK2000MT
+
+ Matrox
+ MGA2064W
+
+ Number Nine
+ I128 (not accelerated yet)
+
+ Cirrus, Western Digital, Oak, ARK, Chips & Technologies ¤Č Matrox Ľ˘ĽŻ
+ ĽťĽéĽěĄźĽż¤Ď SVGA ĽľĄźĽĐ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤˝¤Îž¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď¤˝
+ ¤ěźŤżČÍѤμľĄźĽĐ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ ˛Ă¤¨¤ĆĄ˘źĄ¤Î SVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ Tseng
+ ET3000, ET4000AX, ET4000/W32, ET6000
+
+ Western Digital/Paradise
+ PVGA1
+
+ Western Digital
+ WD90C00, WD90C10, WD90C11, WD90C24, WD90C24A, WD90C30, WD90C31,
+ WD90C33
+
+ Genoa
+ GVGA
+
+ Trident
+ TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000,
+ TVGA9000i, TVGA9100B, TVGA9200CX, TVGA9320, TVGA9400CX,
+ TVGA9420, TGUI9420DGi, TGUI9430DGi, TGUI9440AGi, TGUI9660XGi,
+ TGUI9680
+
+ ATI
+ 18800, 18800-1, 28800-2, 28800-4, 28800-5, 28800-6, 68800-3,
+ 68800-6, 68800AX, 68800LX, 88800GX-C, 88800GX-D, 88800GX-E,
+ 88800GX-F, 88800CX, 264CT, 264ET, 264VT, 264VT2, 264GT
+
+ NCR
+ 77C22, 77C22E, 77C22E+
+
+ Cirrus Logic
+ CLGD5420, CLGD5422, CLGD5424, CLGD5426, CLGD5428, CLGD5429,
+ CLGD5430, CLGD5434, CLGD5436, CLGD5440, CLGD5446, CLGD5462,
+ CLGD5464, CLGD6205, CLGD6215, CLGD6225, CLGD6235, CLGD6410,
+ CLGD6412, CLGD6420, CLGD6440
+
+ OAK
+ OTI067, OTI077, OTI087
+
+ Avance Logic
+ ALG2101, ALG2228, ALG2301, ALG2302, ALG2308, ALG2401
+
+ Chips & Technologies
+ 65520, 65530, 65540, 65545, 65520, 65530, 65540, 65545, 65546,
+ 65548, 65550, 65554
+
+ MX MX68000, MX680010
+
+ Video 7/Headland Technologies
+ HT216-32
+
+ SiS
+ 86C201, 86C202, 86C205
+
+ ARK Logic
+ ARK1000PV, ARK1000VL, ARK2000PV, ARK2000MT
+
+ RealTek
+ RTG3106
+
+ Alliance
+ AP6422
+
+ Matrox
+ MGA2064W
+
+ NVidia/SGS Thomson
+ NV1, STG2000
+
+ žĺľ­¤ÎÁ´¤Ć¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĄ˘256 ż§¤ČÇňšő¤ÎΞĘý¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘
+ ¤¤¤Ż¤Ä¤Ť¤ĎÇňšő¤Č 16 ż§¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ ¤ł¤ě¤é¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ňťČ¤Ś°Ů¤ÎĄ˘¤č¤ęÂż¤Ż¤ÎžđĘó¤ĎĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¸ÇÍ­¤Î
+ README ĽŐĽĄĽ¤ĽëĄĘ¸˝şß¤Ď Tseng, Western Digital, ATI, ARK, Trident,
+ Oak, Matrox, NVidia ¤Č Video 7 ¤ŹłşĹö¤ˇ¤Ţ¤šĄË¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ 64k ¤ÎĽˇĽóĽ°ĽëĽĐĽóĽŻ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ňťČÍѤˇ¤Ć¤¤¤ë°ěČĚĹŞ¤Ę VGA ĽŤĄźĽÉ
+ ĄĘ¸˝ÂĺĄĘ Hyundai ĄËHGC1280Ą˘Sigma LaserView Visa ÇňšőĽŤĄźĽÉ¤Č Apollo
+ ÇňšőĽŤĄźĽÉĄË¤ňĄ˘ÇňšőĽľĄźĽĐĄź¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ64k ĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽá
+ ĽâĽę¤Ŕ¤ą¤ňťý¤Ă¤Ć¤¤¤ë Compaq AVGA ¤âÇňšőĽľĄźĽĐĄź¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤š
+ ¤ŹĄ˘64k ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽÓĽÇĽŞĽáĽâĽę¤Ç¤ĎĄ˘GVGA ¤Ď̤¤ŔĽĆĽšĽČ¤ˇ¤Ć¤Ţ¤ť¤óĄŁ
+
+ VGA16 ĽľĄźĽĐĄź¤Ď 1MB ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ňĹëşÜ¤ˇ¤żťţĄ˘Ěó 1600x1200 °Ęžĺ¤Î˛ž
+ Á۲čĚĚÉ˝ź¨¤Ź˛ÄÇ˝¤Ę ET4000Ą˘TridentĄ˘ATIĄ˘NCRĄ˘OAK ¤Č Cirrus 6420 ¤ňŔŃ
+ ¤ó¤ŔĽáĽâĽęĽĐĽóĽŻ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁÂž¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Îžěšç¤ĎĄ˘˛čĚ̤ÎÂ礭
+ ¤ľ¤ĎĚó 800X600 ¤ËŔŠ¸Â¤ľ¤ě¤Ţ¤šĄŁ
+
+ Ăí°Ő : Diamond źŇ¤Ź ET4000 ¤ňťČ¤Ă¤Ć¤¤¤ë¤Č¤ˇ¤Ć¤âĄ˘Diamond SpeedStar 24
+ ĽÜĄźĽÉ¤ĎĄĘ¿ʏ¤¤¤Ż¤Ä¤Ť¤Î¤Î SpeedStar+ ¤âĄËĽľĽÝĄźĽČ¤ˇ¤Ţ¤ť¤óĄŁ
+ ET4000/W32p ¤ňťČ¤Ă¤Ć¤¤¤ë Stealth 32 ¤âÁ´ľĄÇ˝¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ť¤óĄŁ
+
+ ĄĘ Diamond Viper Pro ¤Č Viper SE ĽÜĄźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëĄËWeitek 9100 ¤Č
+ 9130 ¤ĎĽľĽÝĄźĽČ¤ˇ¤Ţ¤ť¤óĄŁËؤɤΤ˝¤Îž¤Î Diamond źŇ¤ÎĽÜĄźĽÉ¤Ď¤ł¤ÎČǤÎ
+ XFree86 ¤Ç˛ÔĆŻ¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁDiamond źŇ¤Ď XFree86 Project źŇ ¤ňŔŃśËĹŞ¤Ë
+ ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 4. šš¤ËÂż¤Ż¤ÎžđĘó¤Ď¤É¤ł¤Ë¤˘¤ë¤Ť
+
+ XFree86(1žĎ), XF86Config(4žĎ/5žĎ), XF86_SVGA(1žĎ), XF86_Mono(1žĎ),
+ XF86_VGA16(1žĎ), XF86_Accel(1žĎ) XF86Setup(1) ¤Č xvidtune(1žĎ) ¤ÎĽŞĽó
+ ĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňÄɲ䡤Ƥ¤¤Ţ¤šĄŁ¤ľ¤é¤ËĄ˘¤¤¤Ż¤Ä¤Ť¤Î README ĽŐĽĄĽ¤Ľë¤Č
+ ˛ňŔâ¤ňśĄľë¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ě¤é¤ĎĄ˘ĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤Ç¤ĎĄ˘
+ /usr/X11R6/lib/X11/doc ¤ÎĄ˘¤Ţ¤żĽ˝ĄźĽšÇŰÉŐĘŞ¤Ç¤Ď
+ xc/programs/Xserver/hw/xfree86/doc ¤ÎĽÇĽŁĽěĽŻĽČĽę¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ README.Config ¤Č VideoModes.doc ¤ÎĽŐĽĄĽ¤Ľë¤Ď XFree86 ĽľĄźĽĐĄź¤ň¤É¤Ś
+ ¤ä¤Ă¤ĆŔßÄꤚ¤ë¤Ť¤Ë¤Ä¤¤¤Ćť˛šÍžđĘó¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁXFree86 ĽÁĄźĽŕ ¤ËťŮąç
+ ¤ÎϢÍí¤ňźč¤ëÁ°¤ËĄ˘Ä󜥤ˇ¤żÁ´¤Ć¤ÎʸžĎ¤ČĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňĄ˘Ćɤó¤Ç˛ź
+ ¤ľ¤¤ĄŁ QuickStart.doc ¤Č README.Config ¤ÎĽŐĽĄĽ¤Ľë¤Ď XFree86 ĽľĄźĽĐĄź¤ň
+ ¤É¤Ś¤ä¤Ă¤ĆŔßÄꤚ¤ë¤Ť¤Ë¤Ä¤¤¤Ćť˛šÍžđĘó¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁXFree86 ĽÁĄźĽŕ ¤Ë
+ ťŮąç¤ÎϢÍí¤ňźč¤ëÁ°¤ËĄ˘Ä󜥤ˇ¤żÁ´¤Ć¤ÎʸžĎ¤ČĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë
+ ¤ČXFree86 FAQ <http://www.XFree86.org/FAQ>¤ňĄ˘Ćɤó¤Ç˛ź¤ľ¤¤ĄŁ
+
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎłŤČŻ¤Ë¤Ä¤¤¤Ć¤Îʸ˝ń¤ĎĄ˘ĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤Ç
+ ¤ĎĄ˘/usr/X11R6/lib/Server/VGADriverDoc ¤ËĄ˘Ľ˝ĄźĽšÇŰÉŐĘŞ¤Ç
+ ¤ĎĄ˘xc/programs/Xserver/hw/xfree86/VGADriverDoc ¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ Á´¤ŻĘŹ¤Ť¤é¤Ę¤¤žěšç¤ĎĄ˘<XFree86@XFree86.Org> ¤Ë¤¤¤ë XFree86 ĽľĽÝĄźĽČĽÁ
+ ĄźĽŕ¤ËϢÍí¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĎ˘Íí¤ň¤Č¤ëÁ°¤ËĄ˘şÇżˇČǤΠXFree86 ¤ňťČ¤Ă¤Ć¤¤¤ë¤ł
+ ¤Č¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁftp://ftp.xfree86.org/pub/XFree86 ¤ËˇÇşÜ¤ˇ¤Ć¤¤¤ë
+ ĽĐĄźĽ¸ĽçĽó¤ňÄ´¤Ů¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Usenet ĽËĽĺĄźĽšĽ°ĽëĄźĽ×¤Ç¤˘¤ë comp.windows.x.i386unix ¤Ç¤ĎĄ˘¤ż¤¤¤Ć¤¤¤Î
+ XFree86 ¤ČĄ˘XFree86 ¤Ë´Řˇ¸¤š¤ëĎĂÂę¤Ë¤Ä¤¤¤ĆľÄĎŔ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁËؤɤΟÁĚä
+ ¤Ď¤˝¤ł¤Ç˛óĹú¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ´đËÜĹŞ¤ĘźÁĚä¤Î˛óĹú¤ĎĄ˘ĆâÍƤËÁęĹö¤š¤ë FAQ ¤Ç
+ ¸Ť¤Ä¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 5. ś¨ÎĎźÔĄ˘Ä󜥟ԤˤĤ¤¤Ć
+
+ XFree86 ¤ÎłŤČŻ¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ÇťĎ¤á¤Ţ¤ˇ¤żĄŁ:
+
+ o David Dawes <dawes@XFree86.org>
+
+ o Glenn Lai <glenn@cs.utexas.edu>
+
+ o Jim Tsillas <jtsilla@ccs.neu.edu>
+
+ o David Wexelblat <dwex@XFree86.org>
+
+ X11R6 ĽŃĽĂĽąĄźĽ¸¤Ë XFree86 ¤ňĹýšç¤š¤ëşîśČ¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ÇšÔ¤Ę¤Ă¤Ć¤¤¤Ţ
+ ¤šĄŁ:
+
+ o Stuart Anderson <anderson@metrolink.com>
+
+ o Doug Anson <danson@lgc.com>
+
+ o Gertjan Akkerman <akkerman@dutiba.twi.tudelft.nl>
+
+ o Mike Bernson <mike@mbsun.mlb.org>
+
+ o Robin Cutshaw <robin@XFree86.org>
+
+ o David Dawes <dawes@XFree86.org>
+
+ o Marc Evans <marc@XFree86.org>
+
+ o Pascal Haible <haible@izfm.uni-stuttgart.de>
+
+ o Matthieu Herrb <Matthieu.Herrb@laas.fr>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ o David Holland <davidh@use.com>
+
+ o Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ o Jeffrey Hsu <hsu@soda.berkeley.edu>
+
+ o Glenn Lai <glenn@cs.utexas.edu>
+
+ o Ted Lemon <mellon@ncd.com>
+
+ o Rich Murphey <rich@XFree86.org>
+
+ o Hans Nasten <nasten@everyware.se>
+
+ o Mark Snitily <mark@sgcs.com>
+
+ o Randy Terbush <randyt@cse.unl.edu>
+
+ o Jon Tombs <tombs@XFree86.org>
+
+ o Kees Verstoep <versto@cs.vu.nl>
+
+ o Paul Vixie <paul@vix.com>
+
+ o Mark Weaver <Mark_Weaver@brown.edu>
+
+ o David Wexelblat <dwex@XFree86.org>
+
+ o Philip Wheatley <Philip.Wheatley@ColumbiaSC.NCR.COM>
+
+ o Thomas Wolfram <wolf@prz.tu-berlin.de>
+
+ o Orest Zborowski <orestz@eskimo.com>
+
+ 386BSD, FreeBSD, NetBSD ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Rich Murphey <Rich@XFree86.org>
+
+ NetBSD, OpenBSD ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Matthieu Herrb <Matthieu.Herrb.@laas.fr>
+
+ źĄ¤ÎĽáĽóĽĐĄź¤ŹşÇ˝é¤Ë 386BSD ¤Ë°Üż˘¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Pace Willison,
+
+ o Amancio Hasty Jr <hasty@netcom.com>
+
+ Mach 386 ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
+
+ Linux ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Orest Zborowski <orestz@eskimo.com>
+
+ SCO Unix ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o David McCullough <davidm@stallion.oz.au>
+
+ Amoeba ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Kees Verstoep <versto@cs.vu.nl>
+
+ Minix-386 ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Philip Homburg <philip@cs.vu.nl>
+
+ OSF/1 ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Marc Evans <Marc@XFree86.org>
+
+ BSD/OS ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Hans Nasten <nasten@everyware.se>,
+
+ o Paul Vixie <paul@vix.com>
+
+ Solaris ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Doug Anson <danson@lgc.com>,
+
+ o David Holland <davidh@use.com>
+
+ ISC SVR3 ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Michael Rohleder <michael.rohleder@stadt-frankfurt.de>
+
+ LynxOS ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Thomas Mueller <tm@systrix.de>
+
+ Linux ÍŃśŚÍ­ĽéĽ¤ĽÖĽéĽę¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Orest Zborowski <orestz@eskimo.com>,
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ PC98 ÍѤϟĄ¤ÎĽáĽóĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ:
+
+ o Toyonori Fujiura <toyo@ibbsal.or.jp>,
+
+ o Hiroyuki Aizu <aizu@jaist.ac.jp>,
+
+ o Tetsuya Kakefuda <kakefuda@tag.iijnet.or.jp>,
+
+ o Takefumi Tsukada <tsuka@linkt.imasy.or.jp>,
+
+ o H.Komatsuzaki,
+
+ o Naoki Katsurakawa <katsura@prc.tsukuba.ac.jp>,
+
+ o Shuichiro Urata <s-urata@nmit.tmg.nec.co.jp>,
+
+ o Yasuyuki Kato <yasuyuki@acaets0.anritsu.co.jp>,
+
+ o Michio Jinbo <karl@pms.nagaokaut.ac.jp>,
+
+ o Tatsuya Koike <koiket@focus.rim.or.jp>,
+
+ o Koichiro Suzuki <ksuzuki@cc.tuat.ac.jp>,
+
+ o Tsuyoshi Tamaki <tamaki@sail.t.u-tokyo.ac.jp>,
+
+ o Isao Ohishi <ohishi@hf.rim.or.jp>,
+
+ o Kohji Ohishi <atena@njk.co.jp>,
+
+ o Shin'ichi Yairo <QZR00522@niftyserve.or.jp>,
+
+ o Kazuo Ito <ft4k-itu@asahi-net.or.jp>,
+
+ o Jun Sakuma <i931361@jks.is.tsukuba.ac.jp>,
+
+ o Shuichi Ueno <uenos@ppp.bekkoame.or.jp>,
+
+ o Ishida Kazuo <ishidakz@obp.cl.nec.co.jp>,
+
+ o Takaaki Nomura <tnomura@sfc.keio.ac.jp>,
+
+ o Tadaaki Nagao <nagao@cs.titech.ac.jp>,
+
+ o Minoru Noda <mnoda@cv.tottori-u.ac.jp>,
+
+ o Naofumi Honda <honda@Kururu.math.hokudai.ac.jp>,
+
+ o Akio Morita <amorita@bird.scphys.kyoto-u.ac.jp>,
+
+ o Takashi Sakamoto <sakamoto@yajima.kuis.kyoto-u.ac.jp>,
+
+ o Yasuhiro Ichikawa <cs94006@mbox.sist.ac.jp>,
+
+ o Kazunori Ueno <g540012@komaba.ecc.u-tokyo.ac.jp>,
+
+ o Yasushi Suzuki <suz@d2.bs1.fc.nec.co.jp>,
+
+ o Masato Yoshida (Contributor of PW805i support)
+
+ şÇ˝é¤ËĽ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹťĎ¤á¤Ţ¤ˇ¤żĄŁ:
+
+ o Kevin Martin <martin@cs.unc.edu>,
+
+ o Rik Faith <faith@cs.unc.edu>,
+
+ o Jon Tombs <tombs@XFree86.org>
+
+ S3 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Jon Tombs <tombs@XFree86.org>,
+
+ o Harald Koenig <koenig@tat.physik.uni-tuebingen.de>,
+
+ o David Wexelblat <dwex@XFree86.org>,
+
+ o David Dawes <dawes@XFree86.org>,
+
+ o Robin Cutshaw <robin@XFree86.org>,
+
+ o Amancio Hasty <hasty@netcom.com>,
+
+ o Norbert Distler <Norbert.Distler@physik.tu-muenchen.de>,
+
+ o Leonard N. Zubkoff <lnz@dandelion.com>,
+
+ o Bernhard Bender <br@elsa.mhs.compuserve.com>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ o Joe Moss <joe@XFree86.org>
+
+ S3V Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Harald Koenig <koenig@tat.physik.uni-tuebingen.de>,
+
+ Mach32 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Kevin Martin <martin@cs.unc.edu>,
+
+ o Rik Faith <faith@cs.unc.edu>,
+
+ o Mike Bernson <mike@mbsun.mlb.org>,
+
+ o Mark Weaver <Mark_Weaver@brown.edu>,
+
+ o Craig Groeschel <craig@metrolink.com>
+
+ o Bryan Feir <jenora@istar.ca>
+
+ Mach64 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Kevin Martin <martin@cs.unc.edu>,
+
+ Mach8Ą˘8514 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ:
+
+ o Kevin Martin <martin@cs.unc.edu>,
+
+ o Rik Faith <faith@cs.unc.edu>,
+
+ o Tiago Gons <tiago@comosjn.hobby.nl>,
+
+ o Hans Nasten <nasten@everyware.se>,
+
+ o Scott Laird <scott@laird.com>
+
+ Cirrus Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Simon Cooper <scooper@vizlab.rutgers.edu>,
+
+ o Harm Hanemaayer <H.Hanemaayer@inter.nl.net>,
+
+ o Bill Reynolds <bill@goshawk.lanl.gov>,
+
+ o Corin Anderson <corina@bdc.cirrus.com>
+
+ Western Digital Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ
+ ¤ˇ¤ż
+ ĄŁ: "
+
+ o Mike Tierney <floyd@pepsi.eng.umd.edu>,
+
+ o Bill Conn <conn@bnr.ca>
+
+ P9000 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Erik Nygren <nygren@mit.edu>,
+
+ o Harry Langenbacher <harry@brain.jpl.nasa.gov>
+
+ o Chris Mason <mason@mail.csh.rit.edu>
+
+ o Henrik Harmsen <harmsen@eritel.se>
+
+ AGX Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Henry Worth <henry.worth@amail.amdahl.com>,
+
+ ET4000/W32 Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ: <
+ /tag>"
+
+ o Glenn Lai <glenn@cs.utexas.edu>,
+
+ ET6000 SVGA ¤Č Ľ˘ĽŻĽťĽéĽěĄźĽż¤Ď(ΞĘý¤Č¤â´ű¸¤ÎW32¤ň´đ¤Ë¤ˇ¤Ć) źĄ¤ÎĽá
+ ĽóĽĐ
+ Ąź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ: "
+
+ o Koen Gadeyne <koen.gadeyne@barco.com>,
+
+ Oak Technologies Inc. Ľ˘ĽŻĽťĽéĽěĄźĽżĽ×ĽíĽ°ĽéĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤Źşî
+ ŔŽ¤ˇ
+ ¤Ţ¤ˇ¤żĄŁ: "
+
+ o Jorge Delgado <ernar@dit.upm.es>,
+
+ 16 ż§¤Î VGA ĽľĄźĽĐĄź¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Gertjan Akkerman <akkerman@dutiba.twi.tudelft.nl>
+
+ 2 ż§ VGA ¤Č Čó VGA Çňšő ĽľĄźĽĐĄź¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Pascal Haible <haible@izfm.uni-stuttgart.de>
+
+ ATI SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Per Lindqvist <pgd@compuram.bbt.se> ¤Č Doug Evans
+ <dje@cygnus.com>.
+
+ o Rik Faith <faith@cs.unc.edu>¤Ë¤č¤Ă¤Ć X11R5 ¤Ë°Üż˘¤ľ¤ě¤Ţ¤ˇ¤żĄŁ
+
+ o Marc La France <Marc.La-France@ualberta.ca>¤Ź˝ń¤­´š¤¨¤Ţ¤ˇ¤żĄŁ
+
+ WD90C24 ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Brad Bosch <brad@lachman.com>
+
+ Trident SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ SiS SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ DEC 21030 (TGA) ĽľĄźĽĐ¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ o Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+
+ NCR SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Stuart Anderson <anderson@metrolink.com> NCR źŇ¤ÎžľÂú¤ňĆŔ¤Ć¤¤¤Ţ
+ ¤šĄŁ
+
+ Cirrus SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Bill Reynolds <bill@goshawk.lanl.gov>,
+
+ o Hank Dietz <hankd@ecn.purdue.edu>,
+
+ o Simon Cooper <scooper@vizlab.rutgers.edu>,
+
+ o Harm Hanemaayer <H.Hanemaayer@inter.nl.net>,
+
+ o Corin Anderson <corina@bdc.cirrus.com>
+
+ Cirrus CL64xx ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Manfred Brands <mb@oceonics.nl>
+
+ o Randy Hendry <randy@sgi.com>
+
+ o Jeff Kirk <jeff@bambam.dsd.ES.COM>
+
+ Compaq SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Hans Oey <hans@mo.hobby.nl>
+
+ Oak SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Steve Goldman <sgoldman@encore.com>
+
+ o Jorge Delgado <ernar@dit.upm.es>
+
+ ARK Logic SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Harm Hanemaayer <H.Hanemaayer@inter.nl.net>
+
+ o Leon Bottou <bottou@laforia.ibp.fr>
+
+ AL2101 SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Paolo Severini <lendl@dist.dist.unige.it>
+
+ Avance Logic ``ali'' SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Ching-Tai Chiu <cchiu@netcom.com>
+
+ Chips & Technologies SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Regis Cridlig <cridlig@dmi.ens.fr>
+
+ o Jon Block <block@frc.com>
+
+ o Mike Hollick <hollick@graphics.cis.upenn.edu>
+
+ o Nozomi Ytow
+
+ o Egbert Eich <Egbert.Eich@Physik.TH-Darmstadt.DE>
+
+ o David Bateman <dbateman@ee.uts.edu.au>
+
+ o Xavier Ducoin <xavier@rd.lectra.fr>
+
+ MX SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Frank Dikker <dikker@cs.utwente.nl>
+
+ Video7 SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Craig Struble <cstruble@acm.vt.edu>
+
+ RealTek SVGA ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Peter Trattler <peter@sbox.tu-graz.ac.at>
+
+ Apollo Çňšő ĽÉĽéĽ¤ĽĐ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Hamish Coleman <hamish@zot.apana.org.au>
+
+ XFree86-VidMode ľĄÇ˝łČÄĽ ¤Č xvidtune ĽŻĽéĽ¤Ľ˘ĽóĽČ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤Ź
+ şîŔŽ
+ ¤ˇ¤Ţ¤ˇ¤żĄŁ: "
+
+ o Kaleb S. Keithley <kaleb@x.org>
+
+ o David Dawes <dawes@XFree86.org>
+
+ o Jon Tombs <tombs@XFree86.org>
+
+ o Joe Moss <joe@XFree86.org>
+
+ XFree86-Misc ľĄÇ˝łČÄĽ¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Joe Moss <joe@XFree86.org>
+
+ o David Dawes <dawes@XFree86.org>
+
+ XFree86-DGA ľĄÇ˝łČÄĽ¤ĎźĄ¤ÎĽáĽóĽĐĄź¤ŹşîŔŽ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Jon Tombs <tombs@XFree86.org>
+
+ o Mark Vojkovich <mvojkovi@ucsd.edu>
+
+ o Harm Hanemaayer <H.Hanemaayer@inter.nl.net>,
+
+ o David Dawes <dawes@XFree86.org>
+
+ XInput ĹýšçşîśČ¤Č ĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤ČĽŻĽéĽ¤Ľ˘ĽóĽČ¤ÎşîŔŽ¤ĎźĄ¤ÎĽáĽóĽĐ
+ Ąź¤Ź¤ˇ¤Ţ
+ ¤ˇ¤żĄŁ: "
+
+ o Frederic Lepied <lepied@XFree86.Org> (XInput integration, Wacom
+ ĽżĽÖĽěĽĂĽČ, Ľ¸ĽçĽ¤ĽšĽĆĽŁĽĂĽŻ ¤Č łČÄĽĽŢĽŚĽšĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ,
+ xsetpointer ¤Č xsetmode ĽŻĽéĽ¤Ľ˘ĽóĽČ)
+
+ o Patrick Lecoanet <lecoanet@cena.dgac.fr> (Elographics ĽżĽĂĽÁĽšĽŻ
+ ĽęĄźĽóĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ)
+
+ o Steven Lang <tiger@tyger.org> (Summagraphics ĽżĽÖĽěĽĂĽČ ĽÇĽĐĽ¤Ľš
+ ĽÉĽéĽ¤ĽĐ)
+
+ ¤˝¤Îž¤Îš×¸ĽźÔ:
+
+ o Joerg Wunsch <joerg_wunsch@uriah.sax.de> (ET3000 ¤ÎĽĐĽóĽŻĽáĽâĽę
+ ¤ÎÇňšőĽľĄźĽĐĄźĂ´Ĺö),
+
+ o Eric Raymond <esr@snark.thyrsus.com> (żˇ¤ˇ¤¤ĽÓĽÇĽŞĽâĄźĽÉ¤ÎʸžĎĂ´
+ Ĺö),
+
+ o ¤˝¤ˇ¤ĆĄ˘Ŕ¤łŚĂć¤ÎÁ´¤Ć¤ÎĽŮĄźĽżĽĆĽšĽČ¤ňšÔ¤Ę¤Ă¤Ć¤Ż¤ě¤żÂż¤Ż¤ÎżÍĄšĄŞ
+
+ 6. ϢÍížđĘó
+
+ łŤČŻˇ×˛č¤ČĽľĽÝĄźĽČ¤Ď XFree86 ĽłĽ˘ĽÁĄźĽŕ¤Ë¤č¤Ă¤ĆżäżĘ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¸˝şßĄ˘
+ ĽłĽ˘ĽÁĄźĽŕ¤ĎĄ˘źĄ¤ÎĽáĽóĽĐĄź¤Çš˝ŔŽ¤ˇ¤Ć¤¤¤Ţ¤šĄŁĄĘ˝çÉÔĆąĄË:
+
+ o Robin Cutshaw <robin@XFree86.org>
+
+ o David Dawes <dawes@XFree86.org>
+
+ o Marc Evans <marc@XFree86.org>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ o Harald Koenig <koenig@XFree86.org>
+
+ o Rich Murphey <rich@XFree86.org>
+
+ o Jon Tombs <tombs@XFree86.org>
+
+ o David Wexelblat <dwex@XFree86.org>
+
+ ĽłĽ˘ĽÁĄźĽŕ¤Ř¤ÎϢÍí¤Ď <Core@XFree86.org> °¸¤Ć¤ËĹŝҼᥟĽë¤ňÁ÷żŽ¤ˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁĽľĽÝĄźĽČ¤Ë´Ř¤š¤ëźÁĚä¤Ď <XFree86@XFree86.org> °¸¤Ć¤ËĹŝҼá
+ ĄźĽë¤ňÁ÷żŽ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7. XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ
+
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤ĎŁ˛¤Ä¤ÎÂ礭¤ĘĚÜɸ¤ňŔŽ¤ˇżë¤˛¤ë°Ů¤ËĄ˘ˇëŔŽ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ:
+
+ 1. XFree86 ¤ň X ĽŚĽŁĽóĽÉĽŚĽˇĽšĽĆĽŕ¤ÎŔߡץ˘łŤČŻ¤ČÄ󜥤ËŔŐǤ¤ňťý¤Ä X Ľł
+ ĽóĽ˝ĄźĽˇĽ˘Ľŕ¤ÎĂć¤ÇĄ˘ÂĺÉ˝¤Ç¤­¤ë¤č¤Ś¤ĘĽ˝ĽŐĽČ¤Ë¤š¤ëźęĂʤňśĄľë¤š¤ë¤ł¤Č
+
+ 2. XFree86 ¤ÎłŤČŻ¤ňżäżĘ¤š¤ëżÍşŕ¤ČĄ˘źç¤Č¤ˇ¤Ćżˇ¤ˇ¤¤É˝ź¨ÁőĂ֤ȴđÁĂĹŞ¤ĘĹĹ
+ ťť˝čÍýŔßČ÷¤ňĆţźę¤š¤ë¤ż¤á¤ÎĄ˘¤¤¤Ż¤é¤Ť¤Î´đËܤȤʤë´đśâ¤ň˝¸¤áĄ˘Ä󜥤š
+ ¤ë¤ł¤Č
+
+ °ě¤ÄĚܤÎĚÜɸ¤ŹÂč°ě¤ÎĆ°ľĄ¤Ç¤ˇ¤żĄŁťä¤ż¤Á¤ĎĄ˘´Ë¤ä¤Ť¤ËÁČżĽ˛˝¤ľ¤ě¤żĽŐĽę
+ ĄźĽ˝ĽŐĽČĽ×ĽíĽ¸Ľ§ĽŻĽČ¤Ź X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤ÎĂć¤ÇČŻ¸Ŕ¸˘¤ňťý¤Ć¤ë¤č¤Ś¤ĘČ´
+ ¤ąĆť¤Ď¤Ę¤¤¤â¤Î¤Ť¤ČĄ˘˛żĽŤˇî¤â ĂdzŪ¤Ëś¨ľÄ¤ň˝Ĺ¤Í¤Ć¤­¤Ţ¤ˇ¤żĄŁĽłĽóĽ˝Ąź
+ ĽˇĽ˘Ľŕ¤ÎĆ⾏¤Ç¤ĎĄ˘´Ë¤ä¤Ť¤ËÁČżĽ˛˝¤ľ¤ě¤żĽŐĽęĄźĽ˝ĽŐĽČĽ×ĽíĽ¸Ľ§ĽŻĽČ¤Î¤č
+ ¤Ś¤ĘÁČżĽ¤Ďǧ¤á¤é¤ě¤Ţ¤ť¤ó¤Ç¤ˇ¤żĄŁťä¤ż¤Á¤Ď´đśâĘ罸¤Ë´Ř¤ˇ¤ĆĽłĽóĽ˝ĄźĽˇ
+ Ľ˘Ľŕ¤ÎĆ⾏¤ÎÍ׾á¤ňËţ¤ż¤ˇĄ˘ÉŹÍפʴđśâ¤ňłÍĆŔ¤š¤ë¤ż¤á¤ËĄ˘ËĄżÍ¤ÎˇÁÂÖ¤ň
+ źč¤ë¤ł¤Č¤ËˇčÄꤡ¤Ţ¤ˇ¤żĄŁ
+
+ ËĄżÍ˛˝¤ˇ¤ż¤ł¤Č¤ÇĄ˘X11R6 ¤ÎĽŮĄźĽżĽĆĽšĽČ¤Ëť˛˛Ă¤Ź˛ÄÇ˝¤Č¤Ę¤ęĄ˘XFree86 ¤ÎĽł
+ Ľ˘¤ÎÁęĹöÉôĘŹ¤ň X11R6 ¤Č X11R6.1 ¤ËÄ󜥤Ǥ­¤Ţ¤ˇ¤żĄŁ˝é¤á¤Ć¤Î X11R6 ¤ÎĽł
+ Ľ˘ĽęĽęĄźĽšÂĐąţ¤ÎşÇ˝é¤Î XFree86 ¤ĎĽĐĄźĽ¸ĽçĽó 3.0 ¤Ç¤šĄŁ¸˝şß¤Î X11R6.1
+ ¤Î XFree86 ¤ĎĽĐĄźĽ¸ĽçĽó 3.1.2C ¤Ç¤šĄŁ [ ĚőĂíĄ§X11R6.1 ¤ÎĽŃĽĂĽÁČǤÎ
+ XFree86 ¤ĎĽĐĄźĽ¸ĽçĽó 3.1.2C ¤Ç¤šĄŁ3.2 ¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁX11R6.1 ĆâÉô¤Ç¤Ď
+ ĽĐĄźĽ¸ĽçĽó 3.1.2C ¤ÇĄ˘¸řłŤ¤ˇ¤żĽĐĄźĽ¸ĽçĽó¤Ź 3.2 ¤Ŕ¤Č¤¤¤Ś¤ł¤Č¤Ç¤šĄŁ]
+
+ ËĄżÍÁČżĽ¤Č¤ˇ¤ż¤ł¤Č¤Ë¤č¤ë¤â¤Ś°ě¤Ä¤ÎÍřĹŔ¤ĎĄ˘XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤ŹĄ˘ťä
+ ¤ż¤Á¤ÎťĹťö¤Î°Ů¤ËĄ˘ł°Éô¤Ť¤é¤Îťńśâąç˝ő¤ňłÍĆŔ¤ˇ¤żťö¤Ë¤˘¤ę¤Ţ¤šĄŁ¤ł¤ě¤Ë¤č¤Ă
+ ¤ĆĄ˘´ę¤ď¤Ż¤Đ¤â¤Ă¤ČŔŃśËĹŞ¤Ëżˇ¤ˇ¤¤ĽÓĽÇĽŞ´ŘϢ¤ÎľĄşŕ¤ňĆłĆţ¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę
+ ¤ęĄ˘¤č¤ę¤č¤¤Ŕ˝Éʤň¤č¤ę¤Ď¤ä¤ŻĽęĽęĄźĽš¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę¤ë¤Ť¤Čť×¤¤¤Ţ¤šĄŁźŤĘŹ
+ ¤Ť¤éĆ°¤¤¤ĆÉŹÍפʤâ¤Î¤ňźę¤ËĆţ¤ěĄ˘¤˝¤ˇ¤Ć¤˝¤ě¤ňźÂşÝ¤ÎłŤČŻşîśČ¤Ë¤ż¤ş¤ľ¤ď¤ë
+ żÍĄš¤ËÄ󜥤š¤ë¤ł¤Č¤Ź˛ÄÇ˝¤Č¤Ę¤ë¤Ť¤é¤Ç¤šĄŁ
+
+ ¸˝şß¤ÎXFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤ÎźčÄůĚň˛ń¤Č´´ťö˛ń¤ĎĄ˘°Ę˛ź¤ÎÄ̤ę:
+
+ o David Dawes, President and Secretary
+
+ o Dirk Hohndel, Vice-President
+
+ o Glenn Lai, Director
+
+ o Rich Murphey, Treasurer
+
+ o Jim Tsillas, Director
+
+ o Jon Tombs, Director
+
+ o David Wexelblat, Director
+
+ źčÄůĚň˛ń¤Ř¤ÎϢÍí¤Ď <BOD@XFree86.org> ¤Ţ¤ÇĹŝҼᥟĽë¤ňÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ĘŔźŇ¤ÎĆ⾏¤ĎĄ˘XFree86 ¤Ź¸˝şß¤âĄ˘¤˝¤ˇ¤Ćž­Íč¤â¤ş¤Ă¤ČĄ˘ĽŐĽęĄźĽ˝ĽŐĽČĽŚĽ§Ľ˘
+ Ľ×ĽíĽ¸Ľ§ĽŻĽČ¤Ç¤˘¤ęÂł¤ą¤ë¤ł¤Č¤ňĘÝžÚ¤š¤ë¤č¤Ś¤ĘˇÁ¤ÇľŻÁ𤾤ě¤Ć¤¤¤Ţ¤šĄŁĽłĽ˘
+ ĽÁĄźĽŕ¤ÎĽáĽóĽĐĄźËô¤ĎĄ˘¤˝¤Îž¤Î XFree86 ´Řˇ¸źÔ¤ÎĂŻ¤Ë¤Č¤Ă¤Ć¤âĄ˘¸ÄżÍĹŞ¤Ę
+ śâÁŹĹŞÍřą×¤ŹĚľ¤¤¤č¤Ś¤ËÇŰθ¤ˇ¤Ţ¤ˇ¤żĄŁÁ´¤Ć¤Î˛ńźŇ¤Îťńťş¤Ď˛ńźŇ¤Î°Ů¤ËťÄ¤ˇĄ˘
+ ˛ńźŇ¤Î˛ňťś¤Îťţ¤Ë¤ĎĄ˘Á´¤Ć¤Îťńťş¤ň X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Ë°Ńžů¤š¤ëÍ˝Äę¤Ç¤šĄŁ
+ ¤ł¤Î¤č¤Ś¤ĘˇÁź°¤ň¤Č¤ë¤ł¤Č¤ÇĄ˘ĘŔźŇ¤Ź¤ł¤ě¤Ţ¤Ç¤ÎłčĆ°¤ňĂą¤ËˇÁź°˛˝¤ˇ¤ż¤â¤Î¤Č
+ ¤Ę¤ë¤ł¤Č¤ň´őËž¤ˇ¤Ć¤¤¤Ţ¤šĄŁ˝žÍč¤ÎłčĆ°¤Č¤Ţ¤Ă¤ż¤Ż¤Á¤Ź¤Ă¤ż¤â¤Î¤Ë¤Ę¤ë¤Ä¤â¤ę
+ ¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ¤ł¤ł¤ËĄ˘XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤ÎĽšĽÝĽóĽľĄź¤Č¤Ę¤ęĄ˘śâÁŹ¤ÎÄóśĄËô¤ĎľĄşŕ¤Č
+ ťń¸ť¤ÎÄ󜥤ň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤Ă¤żÁČżĽ¤Č¸ÄżÍ¤ÎĘý¤ň°ěÍ÷¤ËĂפˇ¤Ţ¤šĄŁXFree86 Ľ×Ľí
+ Ľ¸Ľ§ĽŻĽČźŇ¤ĎČŕ¤é¤ËÂçĘŃ´śźŐ¤ˇĄ˘Ľ¤ĽóĽżĄźĽÍĽĂĽČźŇ˛ńÁ´ÂΤβţÁą¤Î°Ů¤ËšâÉĘźÁ
+ ¤ĘĽŐĽęĄźĽ˝ĽŐĽČĽŚĽ§Ľ˘¤ňˇŃÂł¤ˇ¤ĆÄ󜥤š¤ë¤ł¤Č¤ÇĄ˘Čŕ¤é¤Î´üÂԤ˹褨¤ë¤ł¤Č¤ň
+ ´ę¤Ă¤Ć¤Ş¤ę¤Ţ¤šĄŁ
+
+ o UUNET Communications Services, Inc. <http://www.uu.net/>
+
+ UUNET Communications Services, Inc ¤ĎĄ˘ĆĂĘ̤ËĚžÁ°¤ňľó¤˛¤ż¤¤¤Čť×¤¤¤Ţ
+ ¤šĄŁ¤ł¤Î˛ńźŇ¤ĎŔŃśËĹŞ¤ËĄ˘¤¤¤ÁÁ᤯1994 ÇŻ¤Î X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤ÎÇŻ˛ńČń
+ Á´¤Ć¤ň´óÉŐ¤ˇ¤Ć¤Ż¤ě¤Ţ¤ˇ¤żĄŁ¤ł¤Î°ě˛ó¤ÎťńśâÄ󜥤ˤč¤ęĄ˘X11R6 ¤ň
+ XFree86 ¤Ë´Ź¤­šţ¤ŕťö¤ŹłÎźÂ¤Ë¤Ę¤Ă¤ż¤Î¤Ç¤šĄŁ
+
+ o GUUG -- Â裹˛óĽÉĽ¤ĽÄ Linux ˛ńľÄĄĘ1st German Linux CongressĄË
+
+ ¤Ţ¤żĄ˘ĹöÁłĆĂĘ̤ËĚžÁ°¤ňľó¤˛¤ë¤Ů¤­¤ĎĽĎĽóĽÖĽëĽ°¤ÇłŤşĹ¤ľ¤ě¤żÂ裹˛óĽÉĽ¤
+ ĽÄ Linux ˛ńľÄĄĘ1st German Linux CongressĄË¤ÎłŤşĹźÔ¤Čť˛˛ĂźÔ¤Îł§¤ľ¤ó
+ ¤Ç¤šĄŁÂż¤Ż¤Îťńśâ¤ň XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČ¤Ë˛ńľÄ¤ÎźýĆţ¤Ť¤éÄ󜥤ˇ¤Ć¤¤¤ż
+ ¤Ŕ¤­¤Ţ¤ˇ¤żĄŁ
+
+ o AIB Software Corporation <http://www.aib.com/>, Herndon, VA
+
+ o Roland Alder, Armin Fessler, Patrick Seemann, Martin Wunderli
+
+ o American Micro Group
+
+ o AT&T Global Information Services <http://www.attgis.com/> (formerly
+ NCR)
+
+ o Andrew Burgess
+
+ o ATI Technologies Inc <http://www.atitech.ca/>
+
+ o Berkeley Software Design, Inc <http://www.bsdi.com/>, Falls Church,
+ VA
+
+ o Caldera, Inc. <http://www.caldera.com/>
+
+ o Delix Computer GmbH <http://www.delix.de/>, Stuttgart, Germany
+
+ o The Destek Group, Inc. <http://www.destek.net/Destek/>, Nashua, NH
+ (formerly Synergytics)
+
+ o Diamond Multimedia Systems, Inc. <http://www.diamondmm.com/>
+
+ o Digital Equipment Corporation <http://www.digital.com/>
+
+ o Elsa GmbH <http://www.elsa.de/>, Aachen, Germany
+
+ o Genoa Systems Corporation
+
+ o Helius, Inc. <http://www.helius.com/>
+
+ o Hercules Computer Technology, Inc. <http://www.hercules.com/>
+
+ o Ralf Hockens
+
+ o Dirk Hohndel
+
+ o InfoMagic <http://www.infomagic.com/>, Flagstaff, AZ
+
+ o Daniel Kraemer
+
+ o Frank & Paige McCormick
+
+ o Linux International
+
+ o Linux Support Team, Erlangen, Germany
+
+ o LunetIX Softfair <http://www.lunetix.de>, Berlin, Germany
+
+ o Morse Telecommunications <http://www.morse.net>, Long Beach, NY
+
+ o MIRO Computer Products AG, Braunschweig, Germany
+
+ o Rich & Amy Murphey
+
+ o Brett Neumeier
+
+ o Number Nine, Lexington, MA
+
+ o Kazuyuki Okamoto, Japan
+
+ o Prime Time Freeware <http://www.ptf.com/>, San Bruno, CA
+
+ o Red Hat Software <http://www.redhat.com/>, Chapel Hill, NC
+
+ o Norbert Reithinger
+
+ o SPEA Software AG, Starnberg, Germany
+
+ o STB Systems
+
+ o Clifford M Stein
+
+ o Joel Storm
+
+ o S.u.S.E. GmbH <http://www.suse.de>, Fuerth, Germany
+
+ o Tekelec Airtronic GmbH <http://www.tekelec.com>, Muenchen, Germany
+
+ o Jim Tsillas
+
+ o Trans-Ameritech Enterprises, Inc., Santa Clara, CA
+
+ o Unifix Software GmbH, Braunschweig, Germany
+
+ o Vixie Enterprises <http://www.vix.com/>, La Honda, CA
+
+ o Walnut Creek CDROM <http://www.cdrom.com/>, Concord, CA
+
+ o Xtreme s.a.s. <http://www.xfree86.org/xtreme>, Livorno, Italy
+
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ď´đśâ¤ČľĄşŕĄ˘Ëô¤Ď¤É¤Á¤é¤Ť¤ÎÄɲôóÂŁ¤ň´żˇŢĂ×
+ ¤ˇ¤Ţ¤šĄŁ¤ł¤Î¤č¤Ś¤Ę´óÂŁ¤ĎĄ˘˝ęĆŔŔǤΚľ˝üÂОݤȤʤë*¤Ď¤ş*¤Ç¤šĄĘ¤Ź¤Ţ¤Ŕ
+ łÎÄę¤Ď¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄËĄŁťä¤ż¤Á¤ÎĘ۸îťÎ¤Ź˝ńÎŕşîśČ¤ň˝Ş¤¨źĄÂ襢¤ł¤ÎĹŔ¤Ď
+ ¤Ď¤Ă¤­¤ę¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁžÜşŮ¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇĄ˘
+ <BOD@XFree86.org> ¤Ţ¤ÇĄŁ
+
+ 8. Ľ˝ĄźĽš¤ČĽĐĽ¤ĽĘĽęĽŐĽĄĽ¤Ľë¤Î¤˘¤ëĽľĽ¤ĽČ
+
+ X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ ¤Î X11R6.1 PL1 ¤Ť¤é XFree86 3.2 ¤Ř¤ÎĽ˝ĄźĽš¤ÎĽĐĄźĽ¸Ľç
+ ĽóĽ˘ĽĂĽ×ÍŃĽŃĽĂĽÁ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁĽ˝ĄźĽš¤Ř¤ÎĽŃĽĂĽÁ¤ČÍÍĄš¤Ę OS ÍѤμм¤ĽĘ
+ Ľę¤Ď°Ę˛ź¤Îƿ̞ FTP ĽľĽ¤ĽČˇĐÍł¤Çźę¤ËĆţ¤ę¤Ţ¤š:
+
+ o ftp://ftp.XFree86.org/pub/XFree86
+
+ ¤Ţ¤żĄ˘źĄ¤ÎĽßĽéĄźĽľĽ¤ĽČ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ:
+
+ o ËĚĘĆ:
+
+ o ftp://XFree86.cdrom.com/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.redhat.com/pub/mirrors/ftp.xfree86.org (Ľ˝ĄźĽš ¤Č Linux
+ ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.rge.com/pub/X/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.iastate.edu/pub/XFree86/XFree86-3.2 (Ľ˝ĄźĽš ĽŃĽĂĽÁ ¤Č
+ NetBSD ĽĐĽ¤ĽĘĽę)
+ (Also via AFS: /afs/iastate.edu/public/ftp/pub/XFree86/XFree86-3.2)
+
+ o ftp://tsx-11.mit.edu/pub/linux/packages/X11/XFree86-3.2 (Linux ĽĐĽ¤
+ ĽĘĽę ¤Č Ľ˝ĄźĽš)
+
+ o ftp://ftp.eecs.umich.edu/BSD/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.cs.umn.edu/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://despair.capecod.net/pub/XFree86 (Linux, NetBSD ¤Č FreeBSD ĽĐ
+ Ľ¤ĽĘĽę)
+
+ o ĽčĄźĽíĽĂĽŃ:
+
+ o ftp://fvkma.tu-graz.ac.at/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://sunsite.mff.cuni.cz/X11/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.fee.vutbr.cz/pub/XFree86 (Ľ˝ĄźĽš ĽŃĽĂĽÁ ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.gwdg.de/pub/xfree86/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.uni-erlangen.de/pub/Linux/MIRROR.xfree86 (Ľ˝ĄźĽš ĽŃĽĂĽÁ
+ ¤Č Linux ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.uni-stuttgart.de/pub/X11/Xfree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.funet.fi/pub/X11/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.calvacom.fr/pub/unix/X/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.ibp.fr/pub/X11/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.laas.fr/pub/ii/NetBSD/XFree86-3.2 (NetBSD ĽĐĽ¤ĽĘĽę only)
+
+ o ftp://ftp.pvv.unit.no/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://sunsite.doc.ic.ac.uk/packages/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o Ľ˘Ľ¸Ľ˘/ĽŞĄźĽšĽČĽéĽęĽ˘:
+
+ o ftp://x.physics.usyd.edu.au/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.iij.ad.jp/pub/X/XFree86/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.sf.co.kr/pub/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ o ftp://ftp.nectec.or.th/pub/mirrors/XFree86 (Ľ˝ĄźĽš ĽŃĽĂĽÁ ¤Č ĽĐĽ¤ĽĘ
+ Ľę)
+
+ o ftp://ftp.edu.tw/X/XFree86 (Ľ˝ĄźĽš ¤Č ĽĐĽ¤ĽĘĽę)
+
+ ÇŰÉŐĘŞ¤Ť¤é XFree86 ¤ňşîŔŽ¤š¤ë¤Î¤ËÉŹÍפʞđĘó¤ĎĄ˘ĆĂÄę¤ÎĽÇĽŁĽěĽŻĽČĽę¤Î˛ź
+ ¤Ë¤˘¤ë README ĽŐĽĄĽ¤Ľë¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Ćţźę¤ˇ¤ż XFree86 3.1.2 ¤ň¤č¤ŻłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽľĽ¤ĽČ¤ĎĄ˘¸Ĺ
+ ¤¤ČǤΠXFree86 ¤ňłĘÇź¤ˇ¤Ć¤¤¤ë¤ł¤Č¤Ź¤č¤Ż¤˘¤ę¤Ţ¤šĄŁłĆĄš¤ÎĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ
+ ¤Ë¤ĎĄ˘ RELNOTE ¤ËłĘÇźžě˝ę¤Ť¤éĽŔĽŚĽó¤š¤ëÉŹÍפΤ˘¤ëĽŐĽĄĽ¤Ľë¤Ë¤Ä¤¤¤Ćľ­şÜ
+ ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.64
+ 1996/10/26 09:38:53 dawes Exp
+
+ $XConsortium: README.sgml /main/15 1996/01/30 15:13:03 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v
+ 3.64 19 96/10/26 09:38:53 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/README.sgml,v
+ 3.65 1995/11/10 20:29:00 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Config b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Config
new file mode 100644
index 000000000..a02cc61a3
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Config
@@ -0,0 +1,565 @@
+ ĂĘłŹĹŞĽŹĽ¤ĽÉ
+
+ XFree86 ¤ÎŔßÄę¤Ë¤Ä¤¤¤Ć
+ David Wexelblat ¤Č XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ
+
+ Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1994 ÇŻ 10 ÇŻ 05 Ćü
+
+ ¤ł¤Îʸ˝ń¤Ď XFree86 ĽľĄźĽĐĄź¤ň¤É¤Ś¤ä¤Ă¤ĆŔßÄꤚ¤ë¤Ť¤Ë¤Ä¤¤¤Ć¤ČĄ˘ XF86Con-
+ fig ĽŐĽĄĽ¤Ľë¤ňľĄ´ďš˝ŔŽ¤Ë°ěĂפľ¤ť¤ëťö¤Ë¤Ä¤¤¤Ć˝ń¤¤¤Ć¤¤¤Ţ¤šĄŁ¤ł¤Îʸ˝ń¤Îźę
+ ˝ç¤É¤Ş¤ę¤ËşîśČ¤š¤ě¤ĐĄ˘ĚäÂęĚľ¤ŻĽľĄźĽĐĄź¤Ź˝ŕČ÷¤Ç¤­Ą˘¤š¤°¤ËźÂšÔ¤Ç¤­¤ë¤č¤Ś
+ ¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤ł¤Îʸ˝ń¤ĎČĆÍѤˤʤë¤č¤Ś¤ËŔߡפľ¤ě¤Ć¤¤¤Ţ¤šĄŁŔßÄęÂĐžÝ OS ¸Ç
+ Í­¤Î README ĽŐĽĄĽ¤ĽëĄĘÎ㤨¤ĐĄ˘ README.SVR4ĄË¤ČĄ˘ŔßÄęÂĐžÝĽÓĽÇĽŞĽŤĄź
+ ĽÉ/ĽÁĽĂĽ×ĽťĽĂĽČ¸ÇÍ­¤Î READMEĽŐĽĄĽ¤ĽëĄĘÎ㤨¤ĐĄ˘ README.tridentĄË¤ňÉŹ¤ş
+ ť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤é¸ÇÍ­¤ÎĽŐĽĄĽ¤Ľë¤ČČĆÍѤˤʤäƤ¤¤ëĽŐĽĄĽ¤Ľë¤Č¤Ç̡˝â
+ ¤ňŔ¸¤¸¤ëžěšç¤ĎĄĘÁ´Éô¤Îžěšç¤Ź¤˝¤Ś¤Ç¤˘¤ë¤Č¤Ď¸Â¤ę¤Ţ¤ť¤ó¤ŹĄËĄ˘¸ÇÍ­¤ÎĽŐĽĄĽ¤
+ Ľë¤Îźę˝ç¤Ë˝ž¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. źę˝çłľÍ×
+
+ 2. Ŕľ¤ˇ¤¤É¸˝ŕĽľĄźĽĐĄź¤ÎŔßÄę
+
+ 3. XF86Config ¤Î°×¤ˇ¤¤ÉôĘŹ
+
+ 4. ĽÓĽÇĽŞĽÜĄźĽÉ¤ÎŔßÄę¤Ë¤Ä¤¤¤Ć
+
+ 5. ĽâĽËĽżĄź¤Č¤˝¤ÎĽâĄźĽÉ¤ÎŔßÄę¤Ë¤Ä¤¤¤Ć
+
+ 6. ĽÓĽÇĽŞĽÜĄźĽÉ¤ČĽâĽËĽżĄźĽÇĄźĽż¤ÎÁȤߚç¤ď¤ť¤Ë¤Ä¤¤¤Ć
+
+ 7. ČĆÍŃĽÓĽÇĽŞĽâĄźĽÉ¤Ë¤Ä¤¤¤Ć
+ ______________________________________________________________________
+
+ 1. źę˝çłľÍ×
+
+ ˝ŕČ÷¤ČźÂšÔ¤ĎŁ˛¤Ä¤ÎĂĘłŹ¤ÇšÔ¤Ę¤¤¤Ţ¤šĄŁ¤Ţ¤şşÇ˝é¤ËĄ˘ťČÍѤˇ¤ż¤¤ĹŹŔڤʼľĄźĽĐ
+ Ąź¤ňÁŞÂň¤ˇ¤ĆĄ˘˝é´üĂͤΤޤŢŔßÄꤡ¤Ţ¤šĄŁźĄ¤ËĄ˘ XF86Config ĽŐĽĄĽ¤Ľë¤ňŔßÄę
+ ¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽŐĽĄĽ¤Ľë¤ĎĽľĄźĽĐĄź¤ËĄ˘˛čĚ̝؟¨ÁőĂÖĄĘÎ㤨¤ĐĄ˘ĽŢĽŚĽš¤äĽČĽéĽĂ
+ ĽŻĽÜĄźĽëĄËĄ˘ĽÓĽÇĽŞĽŤĄźĽÉ¤äĽâĽËĽżĄźĹůĄ˘¤˝¤ÎžžŻ¤ˇ¤ÎľĄ´ď¤Ë¤Ä¤¤¤ĆŔßÄꤚ¤ë
+ ¤â¤Î¤Ç¤šĄŁ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Ď¤¤¤Ż¤Ä¤Ť¤ÎšŕĚܤǚ˝ŔŽ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ě¤é¤ÎźęÂł¤­
+ ¤Ď¤˝¤ě¤ž¤ě¤ÎÉôĘŹ¤ň˝ń¤­šţ¤ŕ¤ł¤Č¤ÇĄ˘źŤÁł¤ËĆł¤¤¤Ć¤Ż¤ě¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+ /usr/X11R6/lib/X11/XF86Config.sample ¤Č¤¤¤ŚĄ˘˝é´üĂͤμľĽóĽ×Ľë¤Č¤ˇ¤Ć
+ XF86Config ĽŐĽĄĽ¤Ľë¤Ź¤˘¤ę¤Ţ¤šĄŁ¤ł¤ÎĽŐĽĄĽ¤Ľë¤ň
+ /usr/X11R6/lib/X11/XF86Config.sample ¤ËĽłĽÔĄź¤ˇ¤ĆŔßÄęÂОݾĄ´ďš˝ŔŽ¤Ë¸Ç
+ Í­¤ĘÉôĘŹ¤ň˝¤Ŕľ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁXF86ConfigĄĘ4 žĎ / 5 žĎĄË¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺ
+ Ľ˘Ľë¤Ë XF86Config ĽŐĽĄĽ¤Ľë¤ÎĂćżČ¤ČĽŞĽ×ĽˇĽçĽó¤ÎžÜşŮ¤Ź˝ń¤Ť¤ě¤Ć¤Ţ¤šĄŁ¤Şźę
+ ¸ľ¤Î XF86Config ĽŐĽĄĽ¤Ľë¤ň˝ń¤­šţ¤ŕ¤ż¤á¤ËĄ˘ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňÄĚĆɤˇ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤ÎłĆŔá¤ĎźĄ¤ÎÄ̤ę¤Ç¤šĄŁ:
+
+ Files
+ ɸ˝ŕĽŐĽŠĽóĽČ¤Č RGB ĽÇĄźĽżĽŮĄźĽš¤ÎĽŃĽš¤ňŔßÄꤡ¤Ţ¤šĄŁ
+
+ Server Flags
+ °ěČĚĹŞ¤ĘĽľĄźĽĐĄź¤ÎžŻÎĚ¤ÎĽŞĽ×ĽˇĽçĽó¤ňŔßÄꤡ¤Ţ¤šĄŁ¤ł¤ě¤é¤Ë¤Ä¤¤¤ĆĘŮ
+ śŻ¤ˇ¤ż¤¤žěšç¤ĎĄ˘ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Keyboard
+ Ľ­ĄźĽÜĄźĽÉÁőĂÖ¤ňŔßÄꤡ¤Ţ¤šĄŁžŻÎĚ¤ÎĽŞĽ×ĽˇĽçĽóĽŃĽéĽáĄźĽż¤ňŔßÄꤡ¤Ţ
+ ¤šĄŁ
+
+ Pointer
+ ˛čĚ̝؟¨ÁőĂÖ¤ňŔßÄꤡ¤Ţ¤šĄŁžŻÎĚ¤ÎĽŞĽ×ĽˇĽçĽóĽŃĽéĽáĄźĽż¤ňŔßÄꤡ¤Ţ
+ ¤šĄŁ
+
+ Monitor
+ ĽľĄźĽĐĄź¤ËÂФˇ¤ĆĽâĽËĽżĄźĄĘĘŁżôĄË¤ňľ­˝Ň¤ˇ¤Ţ¤šĄŁ
+
+ Graphics Device
+ ĽľĄźĽĐĄź¤ËÂФˇ¤ĆĽÓĽÇĽŞĽŤĄźĽÉ¤ňľ­˝Ň¤ˇ¤Ţ¤šĄŁ
+
+ Screen.
+ ĽâĽËĽżĄź¤ČĽÓĽÇĽŞĽŤĄźĽÉ¤É¤Î¤č¤Ś¤ËťČÍѤš¤ë¤Ů¤­¤Ťľ­˝Ň¤ˇ¤Ţ¤šĄŁ
+
+ 2. Ŕľ¤ˇ¤¤É¸˝ŕĽľĄźĽĐĄź¤ÎŔßÄę
+
+ ɸ˝ŕĽľĄźĽĐĄź¤ÎĚžÁ°¤Ď /usr/X11R6/bin/X¤Ç¤šĄŁ¤ł¤ě¤Ď/usr/X11R6/bin/¤Ë¤˘¤ë
+ ĆĂÄę¤ÎĽľĄźĽĐĄź¤ÎĽĐĽ¤ĽĘĽęĽŐĽĄĽ¤Ľë¤Ç¤˘¤ë XF86_xxxx ĽęĽóĽŻĽŐĽĄĽ¤Ľë¤Ç¤šĄŁ
+ X ¤ŹťČ¤¤¤ż¤¤ĽľĄźĽĐĄź¤ÎĽęĽóĽŻĽŐĽĄĽ¤Ľë¤Ë¤Ę¤Ă¤Ć¤¤¤ë¤ŤłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁŔľ¤ˇ
+ ¤¤ĽęĽóĽŻĽŐĽĄĽ¤Ľë¤Ë¤Ę¤Ă¤Ć¤¤¤Ę¤¤¤Č¤­¤ĎĄ˘X ¤ňşď˝ü¤ˇ¤ĆŔľ¤ˇ¤¤ĽľĄźĽĐĄź¤Îżˇ¤ˇ
+ ¤¤ĽęĽóĽŻĽŐĽĄĽ¤Ľë¤ňşî¤Ă¤Ć˛ź¤ľ¤¤ĄŁĽľĄźĽĐĄź¤ÎĽĐĽ¤ĽĘĽęĽŐĽĄĽ¤Ľë¤ĎźĄ¤ÎÄ̤ę¤Ç
+ ¤šĄŁ:
+
+ XF86_SVGA:
+ Super-VGA ĽľĄźĽĐĄźĄŁ Cirrus 542{0,2,4,6,8,9}Ą˘543{0,4}
+ ¤ČWestern Digital 90C3{1,3} ¤Č Oak Technologies Inc. OTI087 ¤Î
+ ĽÁĽĂĽ×ĽťĽĂĽČÂĐąţ¤ÎĽ˘ĽŻĽťĽéĽěĄźĽż¤ČťÄ¤ę¤ÎĽÁĽĂĽ×ĽťĽĂĽČÂĐąţ¤ÎČ󼢼Ż
+ ĽťĽéĽěĄźĽż¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ XF86_Mono:
+ ĽŞĽ×ĽˇĽçĽó¤Ç Hercules ¤Ţ¤ż¤Ďž¤ÎÇňšőĽÓĽÇĽŞĽŤĄźĽÉ¤ňĽľĽÝĄźĽČ¤š¤ë
+ (S)VGA ÇňšőĽľĄźĽĐĄź¤ŹĆţ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ XF86_VGA16:
+ ČĆÍŃ VGA 16 ż§ĽľĄźĽĐĄźĄŁ
+
+ XF86_S3:
+ S3 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_Mach32:
+ ATI Mach32 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_Mach64:
+ ATI Mach64 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_Mach8:
+ ATI Mach8 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_8514:
+ 8514/A Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_P9000:
+ P9000 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_AGX:
+ AGX Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ XF86_W32:
+ ET4000/W32 ¤ČET6000 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄźĄŁ
+
+ ¤˝¤ě¤ž¤ě¤ÎĽľĄźĽĐĄźÂĐąţ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Ź¤˘¤ę¤Ţ¤š¤Î¤ÇĄ˘ĽľĽÝĄźĽČ¤ˇ
+ ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¸ÇÍ­¤ÎžÜşŮ¤ČĽľĄźĽĐĄź¸ÇÍ­¤Îš˝ŔŽ¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽŞĽóĽéĽ¤
+ ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ LinkKit ¤Ë¤ĆĽľĄźĽĐĄź¤ËĽÉĽéĽ¤ĽĐĄź¤ňÁȤߚţ¤ßĄ˘ĘŃšš¤š¤ëžěšç¤ËĂí°Őťöšŕ¤Ź¤˘
+ ¤ę¤Ţ¤šĄŁÇŰÉŐĘŞ¤Ź¤É¤Ś¤ć¤ŚÉ÷¤ËÁȤßΊ¤Ć¤é¤ě¤Ć¤¤¤ë¤Ť¤Ë¤č¤ę¤Ţ¤š¤ŹĄ˘ĽľĄźĽĐĄź
+ ¤ÎĽĐĽ¤ĽĘĽęĽŐĽĄĽ¤Ľë¤Ë¤ĎťČÍѲÄÇ˝¤ĘÁ´¤Ć¤ÎĽÉĽéĽ¤ĽĐĄź¤Ď´Ţ¤Ţ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁÁČ
+ ¤ßšţ¤Ţ¤ě¤Ć¤¤¤ëĽÉĽéĽ¤ĽĐĄź¤Î°ěÍ÷¤ňĆŔ¤ë¤Ë¤ĎĄ˘ /usr/X11R6/bin/X
+ -showconfig ¤ňźÂšÔ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽľĄźĽĐĄź¤ňşĆĽęĽóĽŻ¤š¤ëÉŹÍפŹ¤˘¤ëžěšç¤ĎĄ˘
+ ¸ÇÍ­¤ÎžđĘó¤Ë¤Ä¤¤¤Ć LinkKit ¤Î <tt>README.LinkKit</tt> <LinkKit.html>
+ ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ 3. XF86Config ¤Î°×¤ˇ¤¤ÉôĘŹ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Î "Files" ¤ÎŔá¤ĎĄ˘RGB (ŔÖÎĐŔÄ) ¤ÎĽÇĄźĽżĽŮĄźĽšĽŐĽĄ
+ Ľ¤ĽëĄĘ°ěČ̤˥˘¤ł¤ě¤ňĘŃšš¤š¤ë¤Ů¤­¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄË¤Ř¤ÎĽŃĽš¤ČĄ˘É¸˝ŕĽŐĽŠĽó
+ ĽČ¤ÎĽŃĽš¤ňĆ⢤ľ¤ť¤ë¤ł¤Č¤Ç¤šĄŁĘŁżô¤Î FontPath šÔ¤ň XF86Config ¤Ë˝ń¤¤¤Ć
+ ¤˘¤ëžěšç¤ĎĄ˘FontPath ¤ňˇëšç¤ˇ¤ĆťČÍѤǤ­¤Ţ¤šĄŁ¤˝¤ě¤ž¤ě¤Î FontPath ¤Î
+ ĽÇĽŁĽěĽŻĽČĽę¤ŹÂ¸şß¤š¤ë¤ł¤Č¤ČĄ˘¤Á¤ă¤ó¤ČĽŐĽŠĽóĽČ¤ŹťČ¤¨¤ë¤ł¤Č¤ňłÎǧ¤ˇ¤Ć˛ź
+ ¤ľ¤¤ĄŁĽľĄźĽĐĄź¤Ź "Can't open default font 'fixed'"ĄĘɸ˝ŕ¤Î'¸ÇÄęÉý'ĽŐĽŠ
+ ĽóĽČ¤ŹÍ­¤ę¤Ţ¤ť¤óĄË¤Č¸Ŕ¤Ă¤Ć¤­¤ż¤éĄ˘¤˝¤ě¤ĎĽŐĽŠĽóĽČ¤ÎĹĐĎż¤ŹŔľ¤ˇ¤Ż¤Ę¤¤¤Ť¤é
+ ¤Ç¤šĄŁ¤˝¤ě¤ž¤ě¤ÎĽŐĽŠĽóĽČ¤ÎĹĐĎż¤ňŔľ¤ˇ¤Ż¤ˇ¤ż¤¤¤Ę¤éĄ˘¤˝¤ě¤ž¤ě¤ÎĽŐĽŠĽóĽČ¤Î
+ ĽÇĽŁĽěĽŻĽČĽę¤Î˝ę¤Ç `mkfontdir' ĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤Ć¤ß¤Ć˛ź¤ľ
+ ¤¤ĄŁXF86Config ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Î 4 žĎ / 5 žĎ¤ËĄ˘XF86Config ĽŐĽĄ
+ Ľ¤Ľë¤ÎşÇ˝é¤ÎÉôĘŹ¤Îž¤ÎĽŃĽéĽáĽż¤Ë¤Ä¤¤¤Ćľ­˝Ň¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ źĄ¤Ď "Keyboard" ¤ÎŔá¤Ç¤šĄŁ ¤ł¤ÎŔá¤Ë¤ĎĄ˘Ľ­ĄźĽÜĄźĽÉ¤ÎÄĚżŽźę˝çĄĘXqu eue
+ ¤Ţ¤ż¤Ď NormalĄËĄ˘Ľ­Ąź¤ÎˇŤ¤ęĘÖ¤ˇ¤ÎÂŽĹ٤䤤¤Ż¤Ä¤Ť¤Î˝¤žţĽ­Ąź¤Îɸ˝ŕĹŞ¤Ęłä
+ ¤ęÉŐ¤ą¤Ë¤Ä¤¤¤ĆŔßÄę¤Ç¤­¤Ţ¤šĄŁ°ěČ̤ˤł¤ł¤ĎĘŃšš¤š¤ëÉŹÍפĎĚľ¤¤¤Ç¤ˇ¤ç¤ŚĄŁąŃ
+ ¸ěÍѤǤʤ¤Ľ­ĄźĽÜĄźĽÉ¤ÎĽćĄźĽśĄź¤Ď˝¤žţĽ­Ąź¤ÎÄęľÁ¤ňĘѤ¨¤ż¤¤¤ł¤Č¤Ç¤ˇ¤ç¤ŚĄŁ
+ žÜşŮ¤Ď XF86Config ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Î 4 žĎ / 5 žĎ¤ň¸Ť¤Ć˛ź¤ľ¤¤ĄŁ [
+ ĚőĂíĄ§˝¤žţĽ­Ąź = ž¤ÎĽ­Ąź¤Č°ě˝ď¤Ë˛Ą¤šĄ˘ĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź(Alt)Ą˘ĽłĽóĽČĽí
+ ĄźĽëĽ­Ąź(Cntl)¤äĽˇĽŐĽČĽ­Ąź(Shift) Ĺů˛Ą¤ˇ¤Ć¤âťú¤Î˝Đ¤Ę¤¤Ľ­Ąź¤Îťö¤Ç¤ˇ¤ç¤Ś
+ ]
+
+ źĄ¤Ď "Pointer" ¤ÎŔá¤Ç¤šĄŁ¤ł¤ÎŔá¤Ç¤Ď˛čĚ̝؟¨ÁőĂÖ¤ÎÄĚżŽźę˝ç¤ČÁőĂ֤ˤĤ¤
+ ¤ĆťŘÄę¤Ç¤­¤Ţ¤šĄŁÄĚżŽźę˝çĚžžÎ¤ĎŔ˝Â¤źÔĚžžÎ¤Ç¤Ď¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+ Î㤨¤ĐĄ˘¤¤¤Ż¤Ä¤Ť¤Î Logitech ¤ÎĽŢĽŚĽšĄĘĆä˿ˇ¤ˇ¤¤¤â¤ÎĄË¤ÎžěšçĄ˘Logitech
+ ¤ÎÄĚżŽźę˝çĚžžÎ¤Ç¤Ď¤Ę¤Ż MouseMan ¤Ţ¤ż¤Ď Microsoft ¤ÎÄĚżŽźę˝çĚžžÎ¤ňÍѤ¤
+ ¤Ţ¤šĄŁ¤˝¤Îž¤ÎĽŢĽŚĽš¤ÎĽŃĽéĽáĽż¤Ď¤ł¤ÎŔá¤ÇĄ˘Ä´Ŕ°¤Ç¤­¤Ţ¤šĄŁŁ˛ĽÜĽżĽóĽŢĽŚĽš
+ ¤ňťČ¤Ă¤Ć¤¤¤ë¤Č¤­¤ĎĄ˘Emulate3Buttons ¤Č¤¤¤ŚĽ­ĄźĽďĄźĽÉ¤ňĽłĽáĽóĽČ¤Ë¤ˇ¤Ę¤¤
+ ¤Ç˛ź¤ľ¤¤ĄŁ Emulate3Buttons ĽâĄźĽÉ¤ÇťČ¤Ś¤Č¤­¤ĎĄ˘Ćąťţ¤ËŁ˛¤Ä¤ÎĽÜĽżĽó¤ň˛Ą
+ ¤š¤ł¤Č¤ÇĄ˘ĽľĄźĽĐĄź¤Ëżż¤óĂć¤ÎĽÜĽżĽó¤ň˛Ą¤ˇ¤ż¤ł¤Č¤ňĂΤ餝¤ë¤ł¤Č¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ
+
+ ĽľĄźĽĐĄź¤ŹĽŢĽŚĽšĽÇĽĐĽ¤Ľš¤ňǧźą¤ˇ¤Ę¤¤Ą˘¤Čʸśç¤ň¸Ŕ¤Ś¤Č¤­¤Ď¤˝¤ě¤ĎĽľĄźĽĐĄź
+ ¤ÎĚäÂę¤Ç¤Ď¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤˝¤ě¤Ď¤č¤ŻľŻ¤ł¤ëŔßÄęĽßĽš¤Ç¤˘
+ ¤ęĄ˘99.999% ¤ÎłÎΨ¤Ç OS ¤ËĽÇĽĐĽ¤Ľš¤ŹŔľ¤ˇ¤ŻŔßÄꤾ¤ě¤Ć¤¤¤Ę¤¤ťö¤ŹÍýÍł¤ÇĄ˘
+ ¤¤¤Ż¤Ä¤Ť¤Î OS ¤Ç¤ĎĽ¨ĽéĄź¤Č¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤˝¤ě¸ÎĄ˘OS ĽěĽŮĽë¤Ç¤ÎĽľĽÝĄźĽČ
+ ¤ŹŔľ¤ˇ¤¤¤ł¤Č¤ň¤č¤ŻÄ´¤Ů¤ë¤Ţ¤Ç¤ĎĄ˘˛ćĄš¤ËĽĐĽ°Ęóšđ¤ň¤ˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤ĄŁ
+
+ 4. ĽÓĽÇĽŞĽÜĄźĽÉ¤ÎŔßÄę¤Ë¤Ä¤¤¤Ć
+
+ "Device" ¤ÎŔá¤Ç¤ĎĽÓĽÇĽŞĽÜĄźĽÉ¤Ë¤Ä¤¤¤Ćľ­˝Ň¤ˇ¤Ţ¤šĄŁĘŁżô¤ÎľĄ´ď¤ÎŔá¤ň˝ń¤Ż
+ ¤ł¤Č¤ňľö¤ˇ¤Ć¤Ş¤ęĄ˘¤˝¤ě¤ž¤ě¤ÎŔᤴ¤Č¤ËŁą¤Ä¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤ňľ­˝Ň¤ˇ¤Ţ¤šĄŁ
+
+ ŔßÄꤡ¤č¤Ś¤Č¤ˇ¤Ć¤¤¤ëČĆÍѤǤʤ¤žđĘó¤Ë¤Ä¤¤¤ĆĄ˘ĽľĄźĽĐĄź¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺ
+ Ľ˘Ľë¤ČĽÁĽĂĽ×ĽťĽĂĽČ¸ÇÍ­¤Î README ĽŐĽĄĽ¤Ľë¤ňĆɤó¤ÇłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Device ¤ÎŔá¤ň˝ń¤Ż¤ż¤á¤ËĄ˘ŔßÄęÂĐžÝÁőĂ֤μǥźĽż¤ň˝¸¤á¤ëÉŹÍפŹ¤˘¤ęĄ˘ŔßÄę
+ ĘýżË¤ňˇč¤á¤Ć˛ź¤ľ¤¤ĄŁÉŹÍפĘÁőĂ֤μǥźĽż¤ĎźĄ¤Î¤Č¤Ş¤ę¤Ç¤šĄŁ:
+
+ o ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎźďĘĚ
+
+ o É˝ź¨ÍŃĽáĽâĽę¤ÎÎĚ
+
+ o ťČÍѲÄÇ˝¤ĘĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÎĂÍĄĘĽ×ĽíĽ°ĽéĽŕ˛ÄÇ˝¤ĘžěšçĄË
+
+ o Ramdac ¤ÎźďĘĚĄĘ´ö¤Ä¤Ť¤ÎĽľĄźĽĐĄźÍŃĄË
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤ÎĂć¤ÇÁ´¤ĆťŘÄę¤ÎĂͤňËä¤ášţ¤ó¤Ç¤Ş¤Ż¤č¤ę¤ĎĄ˘Ä̞異
+ ĽľĄźĽĐĄź¤ËźŤĘŹźŤżČ¤ÇÁőĂ֤μǥźĽż¤ňźč¤ęšţ¤Ţ¤ť¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Ç¤ˇ¤ç¤ŚĄŁ
+ ¤˝¤ÎĘý¤Ź´Ö°ă¤¤¤Ę¤ŻŔßÄę¤Ç¤­¤Ţ¤šĄŁ'Chipset' ¤ĎŔßÄꤡ¤Ć¤¤¤ëĽÉĽéĽ¤ĽĐ
+ ĄĘ'X -showconfig'¤ňźÂšÔ¤š¤ě¤ĐÉ˝ź¨¤Ç¤­¤Ţ¤šĄËÂĐąţ¤ÎĽ­ĄźĽďĄźĽÉ¤ÎŁą¤Ä¤Ç
+ ¤šĄŁĽ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐĄź¤Ç¤ĎĄ˘¸˝şßĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĽľĄźĽĐĄź¤ŹĽÁĽĂĽ×
+ ĽťĽĂĽČĽÉĽéĽ¤ĽĐ¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁĽáĽâĽę¤ÎÎ̤ϼ­ĽíĽĐĽ¤ĽČĂą°Ě¤ÇťŘÄꤡ¤Ţ
+ ¤š¤Î¤ÇĄ˘ŁąĽáĽŹĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤Îžěšç¤Ď 1024 ¤ČťŘÄꤡ¤Ţ¤šĄŁ
+
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ĎĽ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤ÎŔßÄę¤Ë¤Ş¤¤¤Ć°ěČÖĘŁť¨¤ĘÉôĘŹ¤Ç¤šĄŁšŹ
+ ąż¤Ë¤âĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ň˝¸¤á¤żÂ礭¤ĘĽÇĄźĽżĽŮĄźĽš¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ¤¤¤Ż¤Ä¤Ť
+ ¤ÎĽ°ĽéĽŐĽŁĽŻĽÜĄźĽÉÂĐąţ¤Î Device ¤ÎĽÇĄźĽż¤Î°ěÍ÷¤Ź `Devices' ĽŐĽĄĽ¤Ľë¤Ë
+ ¤˘¤ę¤Ţ¤šĄŁ¤˘¤Ę¤ż¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤Ź¸Ť¤Ä¤Ť¤ě¤ĐĄ˘¤˝¤ÎĽÇĄźĽż¤Ť¤éťĎ¤á¤ë
+ ¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ modeDB.txt ĽŐĽĄĽ¤Ľë¤ÎşÇ˝é¤ÎÉôĘŹ¤ĎĚľżô¤Î SVGA ĽŤĄźĽÉ¤Î
+ žđĘ󤏰ěÍ÷¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ¤šĄŁĽ˘ĽŻĽťĽéĽěĄźĽżĽŤĄźĽÉ¤Ç¤ĎĄ˘`AccelCards' ĽŐĽĄ
+ Ľ¤Ľë¤ň¸Ť¤Ć˛ź¤ľ¤¤ĄŁšŹąż¤Ę¤é¤ĐĄ˘źŤĘŹ¤ÎĽŤĄźĽÉ¤Ź˛ż˝č¤Ť¤Ë¸Ť¤Ä¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+ ¤â¤ˇĽŤĄźĽÉ¤Ź¸Ť¤Ä¤Ť¤Ă¤ż¤éĄ˘ XF86Config ĽŐĽĄĽ¤Ľë¤Î Clocks šÔ¤ËĽÇĄźĽżĽŮĄź
+ Ľš¤Ť¤éżôÎó¤ňĄ˘ĽÇĄźĽżĽŮĄźĽš¤ËÉ˝ź¨¤ľ¤ě¤Ć¤¤¤ë¤˝¤Î¤Ţ¤Ţ¤ňʤŮÂؤ¨¤ż¤ę¤ˇ¤Ę¤¤
+ ¤ÇťÄ¤ľ¤şĽłĽÔĄź¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁżˇ¤ˇ¤¤Ľ˘ĽŻĽťĽéĽěĄźĽżĽŤĄźĽÉ¤ĎĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻ
+ ĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňťČ¤Ă¤Ć¤¤¤ë¤Î¤Ç XF86Config ĽŐĽĄĽ¤Ľë¤Î ClockChip šÔ
+ ¤Ë°úÍŃÉäĄĘ"ĄËÉŐ¤­¤ÇĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤Îˇżź°¤Ź˝ń¤¤¤Ć¤˘¤ë¤ł¤Č¤ËĂí°Ő¤ˇ
+ ¤Ć˛ź¤ľ¤¤ĄŁĄĘÎ㤨¤ĐĄ˘#9 GXe ¤ňťČ¤Ś¤Ę¤é¤ĐĄ˘ `ClockChip "icd2061a"' ¤ÎÍÍ
+ ¤Ë˝ń¤¤¤Ć¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄËĄŁ
+
+ Ľ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤Ź°ěÍ÷¤Ë¸Ť¤Ä¤Ť¤é¤Ę¤¤¤Č¤­¤ĎĄ˘ĽľĄźĽĐĄź¤ËĽ°ĽéĽŐĽŁĽĂĽŻĽÜ
+ ĄźĽÉ¤Î¸Ą˝Đ¤ňǤ¤ť¤Ć¤ˇ¤Ţ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁsh Ëô¤Ď ksh ¤Îžěšç¤ĎĄ˘ `X -probeonly
+ >/tmp/out 2>&1'Ą˘csh ¤Îžěšç¤ĎĄ˘`X -probeonly >&/tmp/out' ¤ČĽłĽŢĽóĽÉ¤ň
+ źÂšÔ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎťţĄ˘XF86Config ĽŐĽĄĽ¤Ľë¤Ë Clocks šÔ¤ň˝ń¤Ť¤Ę¤¤¤Ç¤Ş
+ ¤¤¤Ć˛ź¤ľ¤¤ĄŁĽłĽŢĽóĽÉ¤ňźÂšÔ¤ˇ¤ż¤éĄ˘ĽľĄźĽĐĄź¤ŹÁÇÂŽ¤ŻĽŻĽíĽĂĽŻ¤ň˝ä˛ó¤ˇ¤ĆÄ´
+ ¤Ů¤ë´ÖĄ˘żôÉĂ´Ö˛čĚ̤Ź°Ĺ¤Ż¤Ę¤ę¤Ţ¤šĄŁÄ´¤Ů¤ë¤ł¤Č¤ÇĽâĽËĽżĄź¤ňÄˤá¤ë¤ł¤Č¤Ď¤˘
+ ¤ę¤Ţ¤ť¤ó¤ŹĄ˘É˝ź¨ťĹÍÍ°Ęžĺ¤Ç¸Ąşş¤ň¤š¤ëžěšç¤Ź¤˘¤ë¤ż¤áĄ˘żˇ¤ˇ¤¤ĽâĽËĽżĄź¤Îžě
+ šç¤ĎźŤĆ°Ĺޤˤ˝¤ěźŤżČ¤ÇĽâĽËĽżĄź¤ÎĹŸť¤ňÍî¤Č¤ˇ¤Ć¤ˇ¤Ţ¤Śžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁ¤Č
+ ¤Ë¤Ť¤ŻĄ˘Ä´şş¤Ź˝Ş¤ď¤Ă¤ż¤éĄ˘ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Î¸Ą˝Đˇë˛Ě¤Î/tmp/out ĽŐĽĄĽ¤Ľë
+ ¤ň¸Ť¤Ţ¤ˇ¤ç¤ŚĄŁ/tmp/out ¤ÎżôÎó¤ň¤˝¤Î¤Ţ¤Ţ XF86Config ĽŐĽĄĽ¤Ľë¤Î Clocks
+ šÔ¤ËĽłĽÔĄź¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁĘ¤ÓĘѤ¨¤ż¤ęĄ˘¤¤¤Ť¤Ę¤ëĘŃšš¤â¤ˇ¤Ć¤Ď¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ Ľ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤ŹĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňťý¤Ă¤Ć¤¤¤ë˛ÄÇ˝
+ Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ¤ł¤Îžěšç¤ĎĄ˘2Ą˘3¸Ä¤ÎĽŻĽíĽĂĽŻ¤Ŕ¤ąĂͤňťý¤ÁĄ˘ťÄ¤ę¤ŹÁ´¤ĆĽźĽí
+ ¤Ë¤Ę¤Ă¤Ć¤¤¤ë¤ł¤Č¤Ç¤ˇ¤ç¤ŚĄŁ¤â¤ˇĄ˘ĽÜĄźĽÉ¤ŹĽÇĄźĽżĽŮĄźĽš¤ÎĂć¤Ë¸ŤĹö¤ż¤é¤Ę
+ ¤Ť¤Ă¤ż¤éĄ˘ XFree86 ĽÁĄźĽŕ¤ËϢÍí¤ňźč¤ë¤ŤĄ˘ comp.windows.x.i386unix ¤Ë
+ ĽáĽĂĽťĄźĽ¸¤ňĽÝĽšĽČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁËؤɤΞěšç Diamond źŇ¤ÎÁőĂÖ¤Ź¤ł¤Îźď¤ÎĘŹ
+ Îŕ¤Ë¤Ę¤ę¤Ţ¤š¤ŹĄ˘ Diamond źŇ ¤ĎĽ×ĽíĽ°ĽéĽŕ¤ÎžÜşŮ¤ň¸řłŤ¤ˇ¤Ć¤Ż¤ě¤Ţ¤ť¤ó¤Î
+ ¤ÇĄ˘˛ćĄš¤Ď˝ő¤ą¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤ť¤óĄŁĽÍĽĂĽČĽËĽĺĄźĽš¤Ç¤ĎĄ˘ÎŃÍýĹŞ¤ËĚäÂę¤Î¤˘
+ ¤ë˛ňˇčşö¤ŹÍřÍѲÄÇ˝¤Ç¤š¤ŹĄ˘˛ćĄš¤Ď¤ł¤ÎĘýËĄ¤ňÄ󞧽ĐÍč¤Ţ¤ť¤ó¤Î¤ÇĄ˘¤ł¤ÎĘýËĄ
+ ¤Ë¤Ä¤¤¤Ć˛ćĄš¤ËϢÍí¤ˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤ĄŁ
+
+ ¤¤¤Ż¤Ä¤Ť¤ÎĽľĄźĽĐĄź (S3 ¤Č AGX) ¤Ë¤Ď RAMDAC ¤Îˇżź°¤ČÂŽĹ٤ŹĄ˘¤˝¤Îž¤ÎÁő
+ Ă֤ΞđĘó¤ňźč¤ę˝Đ¤š¤ż¤á¤ËÉŹÍפˤʤę¤Ţ¤šĄŁ¤ł¤ÎťŘÄę¤Ď 'Ramdac' ¤Č
+ 'DacSpeec' ¤Č¤¤¤Śľ­şÜ¤ňÄɲ䡤ƚԤʤ¤¤Ţ¤šĄŁĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë RAMDAC ¤Î
+ žÜşŮ¤ĎĄ˘ĹŹŔڤʼľĄźĽĐĄź¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ°ĘÁ°¤Î
+ XFree86 ¤ÎĽĐĄźĽ¸ĽçĽó¤Ç¤ĎĄ˘RAMDAC ¤Îˇżź°¤ĎĽŞĽ×ĽˇĽçĽóĽŐĽéĽ°¤ÇŔßÄꤡ¤Ć¤¤
+ ¤ż¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ źŤĘŹ¤ÎÁőĂ֤˚ç¤ď¤ť¤ĆĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĽŞĽ×ĽˇĽçĽóĽŐĽéĽ°¤ňťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ë¤Ç
+ ¤ˇ¤ç¤ŚĄŁĽľĄźĽĐĄź¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Ë¤ł¤ě¤é¤ÎĽŞĽ×ĽˇĽçĽó¤Ë¤Ä¤¤¤Ćľ­˝Ň
+ ¤Ź¤˘¤ęĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¸ÇÍ­¤Î README ĽŐĽĄĽ¤Ľë¤Ë¤Şźę¸ľ¤ÎĽÜĄźĽÉ¤Î°Ů¤Ë¤Ę¤Ë¤Ź
+ ÉŹÍפŤ˝ń¤¤¤Ć¤ę¤Ţ¤šĄŁ
+
+ 5. ĽâĽËĽżĄź¤Č¤˝¤ÎĽâĄźĽÉ¤ÎŔßÄę¤Ë¤Ä¤¤¤Ć
+
+ ĽâĽËĽżĄźĽâĄźĽÉ¤ÎŔßÄę¤ĎĄ˘ĽâĽËĽżĄźÁőĂÖ¤Îɸ˝ŕ˛˝¤Ź˝˝ĘŹ¤Ç¤Ę¤¤¤Î¤ÇĄ˘ťÄÇ°¤Ę¤Ź
+ ¤éĄ˘źÂ¸ł¤ÎˇŤ¤ęĘÖ¤ˇ¤ÇˇčÄꤡ¤Ţ¤šĄŁĆĂÄę¤ÎĽâĽËĽżĄźžđĘó¤ňĽÇĄźĽżĽŮĄźĽš¤Ëźý˝¸
+ ¤š¤ë¤ł¤Č¤Ë¤č¤ęĄ˘¤ł¤ÎźÂ¸łşîśČ¤ň´ĘĂą¤Ë¤š¤ëťö¤ČĄ˘ËؤɤμâĽËĽżĄź¤Ë¤Ť¤Ę¤ę°ě
+ Ăפš¤ëľĄÇ˝¤ň˝¸¤áĄ˘ČĆÍѼ⥟ĽÉ¤ÎÁȤߚç¤ď¤ť¤ň¤Ţ¤Č¤á¤ëťö¤ňťî¤ß¤Ć¤¤¤Ţ¤šĄŁˇě
+ ¤Î¤Ë¤¸¤ŕ¤č¤Ś¤ĘĹŘÎϤǽĐÍ褿Á´¤Ć¤ÎĽâĽËĽżĄźĽâĄźĽÉ¤ÎşîŔŽ¤Č˛ţÎɤˤĤ¤¤Ć¤ÎžÜ
+ şŮ¤ĎĄ˘Eric Raymond ťá¤Ź˝ń¤¤¤ż VideoModes.doc <VidModes.html> ¤ňť˛žČ¤ˇ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Î "Monitor" Ŕá¤ËĽâĽËĽżĄź¤ÎťĹÍÍ¤ČĽÓĽÇĽŞ¤ÎĽâĄźĽÉ¤ňľ­
+ ˝Ň¤ˇ¤Ţ¤šĄŁMonitor ¤ÎŔá¤ň˝ń¤Ż¤ż¤á¤ËĄ˘źŤĘŹ¤ÎĽâĽËĽżĄź¤ÎťĹÍͤňĂΤëÉŹÍפŹ¤˘
+ ¤ę¤Ţ¤šĄŁĆä˥˘ĽâĽËĽżĄź¤ÎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëżĺʿƹ´üżŽšć¤ČżâÄžĽęĽŐĽěĽĂĽˇĽĺ
+ żŽšć¤ÎÂŽĹŮ¤ČĽÓĽÇĽŞżŽšć¤ÎÂÓ°č¤Ë¤Ä¤¤¤ĆĂΤëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ÎžđĘó¤ĎĽâĽË
+ ĽżĄź¤ÎĽćĄźĽś ĄźĽŢĽËĽĺĽ˘Ľë¤Ë˝ń¤¤¤Ć¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤Ţ¤żĄ˘ źŤĘŹ¤ÎĽâĽËĽżĄź¤Î
+ ľ­şÜ¤Ź¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ę¤¤¤Î¤Ç 'Monitors' ĽŐĽĄĽ¤Ľë¤ň¸Ť¤ĆĄ˘łÎǧ¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁMoniter ¤ÎŔá¤Ë¤ł¤ÎžđĘó¤ň¤É¤Ś¤ä¤Ă¤ĆĹĐĎż¤š¤ë¤Ť¤ÎžÜşŮ¤Ď XF86Config ¤Î
+ ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Î 4 žĎ / 5 žĎ¤ň¸Ť¤Ć˛ź¤ľ¤¤ĄŁ
+
+ źĄ¤ËĄ˘ĽâĽËĽżĄź¤Ëšç¤ď¤ť¤żĽÓĽÇĽŞ¤ÎĽâĄźĽÉ¤ÎÁȤňÍż¤¨¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤Ţ¤ş
+ şÇ˝é¤Ë'Monitors' ¤Č modeDB.txt ĽŐĽĄĽ¤Ľë¤ÎĂć¤ËźŤĘŹ¤ÎťŘÄꤚ¤ëĽâĽËĽżĄź¤Ë
+ ÂĐąţ¤š¤ëĽâĄźĽÉ¤Ź°ěÍ÷¤Ë¤˘¤ë¤ŤłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤˘¤Ă¤żžěšç¤ĎĄ˘XF86Config
+ ĽŐĽĄĽ¤Ľë¤Î ModeDB ¤ÎŔá¤Ë¤˝¤ě¤é¤ÎĽâĄźĽÉ¤ňĽłĽÔĄź¤ˇ¤Ć˛ź¤ľ¤¤ĄŁXF86Config
+ ĽŐĽĄĽ¤Ľë¤Î Clocks šÔ¤Ë¤˘¤ëĽŻĽíĽĂĽŻ¤ČĄ˘łĆĽâĄźĽÉ¤ÎšÔ¤ÎŁ˛ČÖĚܤμѼéĽáĄźĽż
+ ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ź°ěĂפˇ¤Ć¤¤¤ë¤ŤłÎǧ¤ˇ¤ĆĄ˘źŤĘŹ¤ÎĽŤĄźĽÉ¤ÎĽŻĽíĽĂĽŻ¤Č°ěĂ×
+ ¤ˇ¤Ę¤¤ĽâĄźĽÉ¤ÎšÔ¤ĎžĂ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤˝¤ˇ¤ĆĽâĄźĽÉ¤ŹťÄ¤Ă¤żťţ¤ĎĄ˘Îɤ¤žőÂ֤ˤĘ
+ ¤ę¤Ţ¤šĄŁ
+
+ ĆĂÄę¤ÎĽâĄźĽÉ¤Ź¸Ť¤Ä¤Ť¤é¤Ę¤¤¤ŤĄ˘¤â¤Ă¤ČťČ¤¤¤ż¤¤˛ňÁüĹ٤μ⥟ĽÉ¤ŹĂΤꤿ¤¤¤Č
+ ¤­¤ĎĄ˘¸ĺ˝Ň¤š¤ëČĆÍŃĽÓĽÇĽŞĽâĄźĽÉ¤Î°ěÍ÷¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽâĽËĽżĄź¤ÎťĹÍͤË
+ ÂФˇ¤ĆŔßÄꤚ¤ëĽâĄźĽÉ¤ÎťĹÍͤňšç¤ď¤ť¤Ţ¤ˇ¤ç¤Ś; ťĹÍÍĆâ¤Ç°ěČ֚⤤ĽęĽŐĽěĽĂ
+ ĽˇĽĺĽâĄźĽÉ¤ňźč¤ę˝Đ¤ˇ¤ĆĄ˘Clocks šÔ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ëšç¤Ă¤Ć¤¤¤ë¤ł¤Č¤ňłÎ
+ ǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ˛ňÁüĹ٤Ź°ěĂפš¤ë¸ňÂĺ (Alternate) ĽâĄźĽÉ¤ËŔÚ¤ęÂؤ¨¤ëÁ°¤Ë
+ VESA ĽâĄźĽÉ¤ňťî¤ˇ¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄŁŔßÄę¤ňšç¤ď¤ť¤żĽâĄźĽÉ¤ň XF86Config ĽŐĽĄ
+ Ľ¤Ľë¤Î Monitor ¤ÎŔá¤ËĽłĽÔĄź¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤é¤ÎĽâĄźĽÉ¤ĎşÇĹŹ¤ĘĂͤǤϤĘ
+ ¤¤ťö¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤é¤Ď´°ŕú¤Ę˛čĚĚĽľĽ¤Ľş¤Ç¤Ď¤Ę¤¤¤Ç¤ˇ¤ç¤Ś¤ˇĄ˘żż¤ó
+ Ăć¤ËÉ˝ź¨¤ľ¤ě¤Ć¤Ď¤¤¤Ę¤¤¤Ç¤ˇ¤ç¤ŚĄŁ¤ˇ¤Ť¤ˇĄ˘Ä´Ŕ°˛ÄÇ˝¤Ç¤šĄŁŔßÄęÂОݤμâĽËĽż
+ Ąź¤Ëšç¤ď¤ť¤ĆĽâĄźĽÉ¤ňČůÄ´Ŕ°¤ˇ¤ż¤¤žěšç¤ĎĄ˘VideoModes.doc ĽŐĽĄĽ¤Ľë¤Î 'É˝
+ ź¨¤ÎĚäÂ꽤Ŕľ' ¤ÎŔá¤ňĆɤó¤Ç˛ź¤ľ¤¤ĄŁ
+
+ ČůÄ´Ŕ°¤ňšÔ¤Ę¤Ś¤Ë¤˘¤ż¤ęĄ˘Ăí°Őťöšŕ¤Ź¤˘¤ę¤Ţ¤šĄŁXF86Config ĽŐĽĄĽ¤Ľë¤Î M
+ onitor ¤ÎŔá¤ËĆą¤¸ĽâĄźĽÉ¤ÎĚžÁ°¤ŹŁ˛¤Ä°ĘžĺÄęľÁ¤ľ¤ě¤Ć¤¤¤ëžěšç¤ËĄ˘ĽľĄźĽĐĄź
+ ¤ĎĽŻĽíĽĂĽŻ¤Î°ěĂפš¤ëşÇ˝é¤ÎĽâĄźĽÉ¤ňťČÍѤˇ¤Ţ¤šĄŁ°ěČĚĹŞ¤ËĄ˘XF86Config
+ ĽŐĽĄĽ¤Ľë¤ËĆą¤¸ĽâĄźĽÉ¤ÎĚžÁ°¤ňŁ˛¤Ä°ĘžĺÄęľÁ¤š¤ë¤ł¤Č¤Ď°­¤¤šÍ¤¨¤Ŕ¤Čť×¤¤¤Ţ
+ ¤šĄŁ
+
+ 6. ĽÓĽÇĽŞĽÜĄźĽÉ¤ČĽâĽËĽżĄźĽÇĄźĽż¤ÎÁȤߚç¤ď¤ť¤Ë¤Ä¤¤¤Ć
+
+ °ěĂśĄ˘ĽľĄźĽĐ¤ŹŔßÄęÂОݤμâĽËĽżĄź¤ČĽ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤ň¤É¤Î¤č¤Ś¤ËťČ¤Ś¤Ť
+ ľ­˝Ň¤ˇ¤ĆťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ě¤ň XF86Config ĽŐĽĄĽ¤Ľë¤Î "Screen"
+ ¤ÎŔá¤ÇšÔ¤Ę¤¤¤Ţ¤šĄŁťČÍѤˇ¤ż¤¤ĽľĄźĽĐĄź¤ÎĽÉĽéĽ¤ĽĐĄź¤Îˇżź°¤Î¤˝¤ě¤ž¤ě¤ň
+ Screen Ŕá¤ÇÍż¤¨¤Ţ¤šĄŁĽÉĽéĽ¤ĽĐĄź¤Îˇżź°¤Ď "SVGA" ¤ÎŔá¤Ç¤Ď (XF86_SVGA)Ą˘
+ "VGA16" ¤ÎŔá¤Ç¤Ď (XF86_VGA16)Ą˘"VGA2" ¤ÎŔá¤Ç¤Ď (XF86_Mono)Ą˘"MONO" ¤Î
+ Ŕá¤Ç¤Ď (XF86_Mono, XF86_VGA16) ¤Č "ACCEL" ¤ÎŔá¤Ç¤Ď (XF86_S3,
+ XF86_Mach32, XF86_Mach8, XF86_Mach64, XF86_8514, XF86_P9000, XF86_AGX,
+ XF86_W32) ¤Ç¤šĄŁ¤˝¤ě¤ž¤ě¤Î Screen Ŕá¤ĎťČÍѤš¤ëĽâĽËĽżĄź(Monitor) ¤Îľ­˝Ň
+ ¤ČĽÇĽĐĽ¤Ľš(Device) ¤Îľ­˝Ň¤ňťŘÄꤡ¤Ţ¤šĄŁ
+
+ Screen Ŕá¤ĎŁą¤Ä¤Ţ¤ż¤ĎĘŁżô¤Î "Display" ¤Îšŕ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁŁą¤Ä¤Î
+ Display šŕ¤ĎĽľĄźĽĐĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë¤˝¤ě¤ž¤ě¤Îżź¤ľ¤ňÍż¤¨¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+ [ ĚőĂíĄ§żź¤ľ¤Č¤Ďż§żô¤äłŹÄ´żô¤ňÉ˝¤ď¤š¤Î¤ËÉŹÍפʼӼüȿô¤Ç¤šĄŁ] Display
+ šŕ¤Ç¤ĎĄ˘ťČ¤¤¤ż¤¤ĽľĄźĽĐĄź¤Î˛žÁŰĽšĽŻĽęĄźĽó¤ÎÂ礭¤ľ¤ňťŘÄę¤Ç¤­¤Ţ¤šĄŁ˛žÁŰĽš
+ ĽŻĽęĄźĽó¤ĎĽâĽËĽżĄź¤ËÉ˝ź¨¤Ç¤­¤ëĽšĽŻĽęĄźĽó¤ÎÂ礭¤ľ¤č¤ę¤âĄ˘Â礭¤¤ĽëĄźĽČ
+ ĽŚĽŁĽóĽÉĽŚ ("root window")¤ňťý¤Ä¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄĘÎ㤨¤Đ 800x600 ¤ÎĽÇĽŁ
+ ĽšĽ×ĽěĽ¤¤Ç1280x1024 ¤ÎÂ礭¤ľ¤Î˛žÁŰĽšĽŻĽęĄźĽó¤ňťČ¤¨¤Ţ¤šĄËĄŁVirtual ¤Č¤¤
+ ¤ŚĽ­ĄźĽďĄźĽÉ¤ň˛žÁŰĽšĽŻĽęĄźĽó¤ÎÂ礭¤ľ¤ňťŘÄꤚ¤ë¤Î¤ËťČ¤¤¤Ţ¤šĄŁÂż¤Ż¤Îżˇ¤ˇ
+ ¤¤Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐ¤ĎÉ˝ź¨¤ËťČ¤ď¤ě¤Ę¤¤ĽáĽâĽę¤ňĽ­ĽăĽĂĽˇĽĺ¤ËťČ¤Ś¤ł¤Č¤Ë
+ Ăí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽ­ĽăĽĂĽˇĽĺ¤ĎĽáĽâĽę¤ÎÁ´¤Ć¤ň˛žÁŰĽÇĽŁĽšĽ×ĽěĽ¤¤ËťČ¤Ś¤č¤Ś¤Ę
+ ĚĽÎϤϤ˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘Ľ­ĽăĽĂĽˇĽĺ¤ËĽáĽâĽę¤ňťÄ¤ľ¤Ę¤¤¤č¤Ś¤Ë¤ˇ¤ĆĄ˘ĽáĽâĽę¤ÎÁ´
+ ¤Ć¤ň˛žÁŰĽÇĽŁĽšĽ×ĽěĽ¤¤ËťČ¤Ś¤ČĽľĄźĽĐĄź¤ÎŔ­Ç˝¤Î 30 ¤Ť¤é 40% ¤Ű¤É¤ňžĂČń¤ˇ
+ ¤Ţ¤šĄŁ
+
+ şÇ¸ĺ¤ËĄ˘Display Ŕá¤ÎŔßÄę¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĽâĄźĽÉŔßÄę¤Ç¤šĄŁĽľĄźĽĐĄź¤ÎťČÍŃ
+ ¤ˇ¤č¤Ś¤Č¤ˇ¤Ć¤¤¤ëĘŞÍýĹŞ¤ĘĽÇĽŁĽšĽ×ĽěĽ¤¤Î˛ňÁüĹ٤ΝŘÄꤏ¤˘¤ę¤Ţ¤šĄŁ¤˝¤ÎĚžÁ°
+ ¤ĎǤ°Ő¤Ç¤š¤ŹĄ˘Monitor Ŕá¤Ë¤˘¤ë¤É¤ě¤Ť¤Č°ěĂפˇ¤Ć¤¤¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ°ě
+ Č̤˥˘¤ł¤ě¤é¤ÎĚžÁ°¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Î˛ňÁüĹŮĄĘÎ㤨¤Đ "1024x768" ĄË¤Ë¤Ę¤Ă¤Ć
+ ¤¤¤ë¤Ç¤ˇ¤ç¤Ś¤ŹĄ˘¤˝¤ÎÄ̤ę¤Ç¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ę¤¤Ěő¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁÉŹÍפʿô¤Ŕ
+ ¤ą°ěÍ÷ˇÁź°¤ÇťŘÄꤡ¤Ţ¤šĄŁ¤Ţ¤şşÇ˝é¤ÎÄęľÁ¤ŹÉ¸˝ŕ¤ÇľŻĆ°¤ľ¤ě¤ë˛čĚ̤ˤʤꥢ˛ň
+ ÁüĹ٤ΰěÍ÷¤ĎĽłĽóĽČĽíĄźĽëĽ­Ąź (Ctrl) Ą˘ĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź (Alt) Ą˘ĽĆĽóĽ­
+ Ąź¤Î + ¤ňĆąťţ¤Ë˛Ą¤š¤ŤĄ˘ĽłĽóĽČĽíĄźĽëĽ­Ąź (Ctrl) Ą˘ĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź
+ (Alt) Ą˘ĽĆĽóĽ­Ąź¤Î - ¤ňĆąťţ¤Ë˛Ą¤š¤ł¤Č¤Ç˝ä˛ó¤Ç¤­¤ë˛čĚ̤ÎÄęľÁ¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ
+
+ °Ęžĺ¤ÇŔßÄę¤Ď˝Ş¤ď¤ę¤Ç¤šĄŁ¤ľ¤˘Ą˘żˇ¤ˇ¤¤ XFree86 ¤ÎĆłĆţĽĆĽšĽČ¤ň¤š¤ë˝ŕČ÷¤Ź
+ ˝ĐÍč¤Ţ¤ˇ¤żĄŁ
+
+ 7. ČĆÍŃĽÓĽÇĽŞĽâĄźĽÉ¤Ë¤Ä¤¤¤Ć
+
+ [ ĚőĂí : ¤ł¤ł¤ĎĽÇĄźĽż¤ÎşĆÍřÍѤΤż¤á¤ËËÝĚő¤Ď¤ˇ¤Ţ¤ť¤óĄŁ ¤ż¤Č¤¨Ą˘ĽłĽáĽóĽČ
+ ¤Ë¤Ç¤â´Áťú¤ŹşŽ¤¸¤Ă¤Ć¸íĆ°şî¤ňľŻ¤ł¤š¤ł¤Č¤ĎĚľ¤¤¤ČĄ˘żŽ¤¸¤Ć¤¤¤Ţ¤š¤Ź¤Á¤ç¤Ă¤Č
+ Éݤ¤:-) ]
+
+ ______________________________________________________________________
+ #
+ # Mode Refresh Hor. Sync Dot-clock Interlaced? VESA?
+ # ------------------------------------------------------------
+ # 640x480 60Hz 31.5k 25.175M No No
+ # 640x480 60Hz 31.5k 25.175M No No
+ # 640x480 63Hz 32.8k 28.322M No No
+ # 640x480 70Hz 36.5k 31.5M No No
+ # 640x480 72Hz 37.9k 31.5M No Yes
+ # 800x600 56Hz 35.1k 36.0M No Yes
+ # 800x600 56Hz 35.4k 36.0M No No
+ # 800x600 60Hz 37.9k 40.0M No Yes
+ # 800x600 60Hz 37.9k 40.0M No No
+ # 800x600 72Hz 48.0k 50.0M No Yes
+ # 1024x768i 43.5Hz 35.5k 44.9M Yes No
+ # 1024x768 60Hz 48.4k 65.0M No Yes
+ # 1024x768 60Hz 48.4k 62.0M No No
+ # 1024x768 70Hz 56.5k 75.0M No Yes
+ # 1024x768 70Hz 56.25k 72.0M No No
+ # 1024x768 76Hz 62.5k 85.0M No No
+ # 1280x1024i 44Hz 51kHz 80.0M Yes No
+ # 1280x1024i 44Hz 47.6k 75.0M Yes No
+ # 1280x1024 59Hz 63.6k 110.0M No No
+ # 1280x1024 61Hz 64.24k 110.0M No No
+ # 1280x1024 74Hz 78.85k 135.0M No No
+
+ #
+ # 640x480@60Hz Non-Interlaced mode
+ # Horizontal Sync = 31.5kHz
+ # Timing: H=(0.95us, 3.81us, 1.59us), V=(0.35ms, 0.064ms, 1.02ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 664 760 800 480 491 493 525
+
+ #
+ # Alternate 640x480@60Hz Non-Interlaced mode
+ # Horizontal Sync = 31.5kHz
+ # Timing: H=(1.27us, 3.81us, 1.27us) V=(0.32ms, 0.06ms, 1.05ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 672 768 800 480 490 492 525
+
+ #
+ # 640x480@63Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync = 32.8kHz
+ # Timing: H=(1.41us, 1.41us, 5.08us) V=(0.24ms, 0.092ms, 0.92ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 28.322 640 680 720 864 480 488 491 521
+
+ #
+ # 640x480@70Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync = 36.5kHz
+ # Timing: H=(1.27us, 1.27us, 4.57us) V=(0.22ms, 0.082ms, 0.82ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 680 720 864 480 488 491 521
+
+ #
+ # VESA 640x480@72Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(0.76us, 1.27us, 4.06us) V=(0.24ms, 0.079ms, 0.74ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 664 704 832 480 489 492 520
+
+ #
+ # VESA 800x600@56Hz Non-Interlaced mode
+ # Horizontal Sync = 35.1kHz
+ # Timing: H=(0.67us, 2.00us, 3.56us) V=(0.03ms, 0.063ms, 0.70ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 36 800 824 896 1024 600 601 603 625
+
+ #
+ # Alternate 800x600@56Hz Non-Interlaced mode
+ # Horizontal Sync = 35.4kHz
+ # Timing: H=(0.89us, 4.00us, 1.11us) V=(0.11ms, 0.057ms, 0.79ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 36 800 832 976 1016 600 604 606 634
+
+ #
+ # VESA 800x600@60Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(1.00us, 3.20us, 2.20us) V=(0.03ms, 0.106ms, 0.61ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+
+ #
+ # Alternate 800x600@60Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(1.20us, 3.80us, 1.40us) V=(0.13ms, 0.053ms, 0.69ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 40 800 848 1000 1056 600 605 607 633
+
+ #
+ # VESA 800x600@72Hz Non-Interlaced mode
+ # Horizontal Sync = 48kHz
+ # Timing: H=(1.12us, 2.40us, 1.28us) V=(0.77ms, 0.13ms, 0.48ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+
+ #
+ # 1024x768@43.5Hz, Interlaced mode (8514/A standard)
+ # Horizontal Sync = 35.5kHz
+ # Timing: H=(0.54us, 1.34us, 1.25us) V=(0.23ms, 0.23ms, 0.93ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
+
+ #
+ # VESA 1024x768@60Hz Non-Interlaced mode
+ # Horizontal Sync = 48.4kHz
+ # Timing: H=(0.12us, 2.22us, 2.58us) V=(0.06ms, 0.12ms, 0.60ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+
+ #
+ # 1024x768@60Hz Non-Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync = 48.4kHz
+ # Timing: H=(0.65us, 2.84us, 0.65us) V=(0.12ms, 0.041ms, 0.66ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1064 1240 1280 768 774 776 808
+
+ #
+ # VESA 1024x768@70Hz Non-Interlaced mode
+ # Horizontal Sync=56.5kHz
+ # Timing: H=(0.32us, 1.81us, 1.92us) V=(0.05ms, 0.14ms, 0.51ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+
+ #
+ # 1024x768@70Hz Non-Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync=56.25kHz
+ # Timing: H=(0.44us, 1.89us, 1.22us) V=(0.036ms, 0.11ms, 0.53ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 72 1024 1056 1192 1280 768 770 776 806 -hsync -vsync
+
+ #
+ # 1024x768@76Hz Non-Interlaced mode
+ # Horizontal Sync=62.5kHz
+ # Timing: H=(0.09us, 1.41us, 2.45us) V=(0.09ms, 0.048ms, 0.62ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+
+ #
+ # 1280x1024@44Hz, Interlaced mode
+ # Horizontal Sync=51kHz
+ # Timing: H=(0.02us, 2.7us, 0.70us) V=(0.02ms, 0.24ms, 2.51ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+
+ #
+ # Alternate 1280x1024@44Hz, Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync=47.6kHz
+ # Timing: H=(0.42us, 2.88us, 0.64us) V=(0.08ms, 0.12ms, 0.96ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024i" 75 1280 1312 1528 1576 1024 1028 1034 1080 Interlace
+
+ #
+ # 1280x1024@59Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync=63.6kHz
+ # Timing: H=(0.36us, 1.45us, 2.25us) V=(0.08ms, 0.11ms, 0.65ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1320 1480 1728 1024 1029 1036 1077
+
+ #
+ # 1280x1024@61Hz, Non-Interlaced mode
+ # Horizontal Sync=64.25kHz
+ # Timing: H=(0.44us, 1.67us, 1.82us) V=(0.02ms, 0.05ms, 0.41ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+
+ #
+ # 1280x1024@74Hz, Non-Interlaced mode
+ # Horizontal Sync=78.85kHz
+ # Timing: H=(0.24us, 1.07us, 1.90us) V=(0.04ms, 0.04ms, 0.43ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+
+ ______________________________________________________________________
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Config.sgml,v 3.8
+ 1996/08/13 11:30:51 dawes Exp
+
+ $XConsortium: Config.sgml /main/5 1995/11/12 19:59:22 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/Config.sgml,v
+ 3.8 199 6/08/13 11:30:51 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/Config.sgml,v
+ 3.9 1996/11/09 16:05:33 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Linux b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Linux
new file mode 100644
index 000000000..b7eca7a83
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.Linux
@@ -0,0 +1,296 @@
+ Linux ¤ňťČÍѤˇ¤Ć¤¤¤ëżÍ¤Î¤ż¤á¤ÎžđĘó
+ Orest Zborowski, Dirk Hohndel Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 20 Ćü
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. XFree86 ¤ŹĽĆĽšĽČ¤ľ¤ě¤ż Linux ¤ÎĽĐĄźĽ¸ĽçĽó
+
+ 2. Á°¤ÎĽĐĄźĽ¸ĽçĽó¤Č¤Î¸ß´šŔ­
+
+ 3. XFree86 ¤ňĆłĆţ¤š¤ë¤Ë¤Ď
+
+ 4. XFree86 ¤ňĆ°şî¤ľ¤ť¤ë¤Ë¤Ď
+
+ 5. ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă Xdm ¤ÎĆłĆţ
+
+ 6. xterm
+
+ 7. ĆţÎĎľĄ´ď
+
+ 7.1. PEX ¤Č XIE ľĄÇ˝łČÄĽ¤ÎŔßÄę
+
+ 8. XFree86 ¤ňĽłĽóĽŃĽ¤Ľë¤š¤ë¤Ë¤Ď
+
+ 9. ĽĐĽ°¤ÎšđĂΤˤĤ¤¤Ć
+ ______________________________________________________________________
+
+ 1. XFree86 ¤ŹĽĆĽšĽČ¤ľ¤ě¤ż Linux ¤ÎĽĐĄźĽ¸ĽçĽó
+
+ XFree86 ¤Ď Linux ¤ÎĽĐĄźĽ¸ĽçĽó 2.0.19 ¤ÇĽĆĽšĽČşŃ¤ß¤Ç¤šĄŁ 1.0 °Ęšß¤ÎĽĐĄź
+ Ľ¸ĽçĽó¤Ç¤ĎĄ˘XFree86 ¤ËĘŃšš¤Ź¤Ę¤ą¤ě¤ĐĆ°¤Ż¤Ç¤ˇ¤ç¤ŚĄŁĽĐĽ¤ĽĘĽę¤ČĽéĽ¤ĽÖĽéĽę
+ ¤Ď 5.2.18 Elf C ĽéĽ¤ĽÖĽéĽę¤Č 1.7.14 ¤ÎĽŔĽ¤ĽĘĽßĽĂĽŻĄŚĽęĽóĽŤĄź ld.so ¤ň
+ ´đ¤Ë¤ˇ¤Ć¤¤¤Ţ¤šĄŁ DLL X ĽéĽ¤ĽÖĽéĽę¤Ď Eric Youngdale ťá¤Ë¤č¤Ă¤Ć 2.16
+ DLL-tools ¤ňťČÍѤˇ¤ĆşîŔŽ¤ľ¤ě¤Ţ¤ˇ¤żĄŁ
+
+ 2. Á°¤ÎĽĐĄźĽ¸ĽçĽó¤Č¤Î¸ß´šŔ­
+
+ X11R6 ¤Ď X11R5 ¤Ť¤éÂ礭¤Żššżˇ¤ˇ¤ż¤â¤Î¤Č¤Ę¤Ă¤Ć¤¤¤Ţ¤š¤Î¤ÇĄ˘XFree86-3.1
+ °Ęšß¤ÎśŚÍ­ĽéĽ¤ĽÖĽéĽę¤ĎĄ˘XFree86-2.1.1 °ĘÁ°¤Î¸Ĺ¤¤ĽéĽ¤ĽÖĽéĽę¤Č¤Ď¸ß´šŔ­¤Ź
+ ¤˘¤ę¤Ţ¤ť¤óĄŁX11R5 ¤ÎĽ˘Ľ×ĽęĽąĄźĽˇĽçĽó¤ňźÂšÔ¤š¤ë¤Ë¤ĎĄ˘ĽŢĽˇĽó¤Î˛ż˝č¤Ť¤Ë¸Ĺ
+ ¤¤ĽéĽ¤ĽÖĽéĽę¤ňĘݸ¤ˇ¤Ć¤Ş¤Ť¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ¸Ĺ¤¤ĽéĽ¤ĽÖĽéĽę
+ ¤Ď/usr/X386/lib ¤Ť¤é˛ż˝č¤Ť¤Ř°ÜĆ°¤š¤ě¤Đ¤¤¤¤¤Î¤Ç¤š¤ŹĄ˘/etc/ld.so.conf ¤Ď
+ ššżˇ¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁÁ´¤Ć¤Î X11R5 ¤ÎĽ˘Ľ×ĽęĽąĄźĽˇĽçĽó¤ĎĚäÂęĚľ¤Ż
+ X11R6 ¤ÎĽľĄźĽĐĄź¤Č°ě˝ď¤ËĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ X11R6.1 ¤ĎX11R6 ¤Î¤â¤Ś°ě¤Ä¤ÎşÇżˇČǤǤšĄŁ ¤¤¤Ż¤Ä¤Ť¤ÎĽéĽ¤ĽÖĽéĽę¤ÎĽŢĽ¤ĽĘ
+ ĄźČ֚椏¸ß´šŔ­¤Ź¤˘¤ë¤ČšÍ¤¨¤Ţ¤šĄŁ
+
+ XFree86-1.2Ą˘XFree86-1.3 ¤Ţ¤ż¤Ď XFree86-2.0 ĽéĽ¤ĽÖĽéĽę¤Č´ŘϢ¤Î¤˘¤ë¸Ĺ¤¤
+ ĽĐĽ¤ĽĘĽę¤Ď°ú¤­Âł¤­Ć°şî¤ˇ¤Ţ¤š¤ŹĄ˘/lib/libX{11,t,aw}.so.3
+ /usr/X386/lib/libX{11,t,aw}.so.3 ¤ŘĚŔłÎ¤ËĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ňÄĽ¤ëÉŹÍ×
+ ¤Ź¤˘¤ę¤Ţ¤šĄŁXView3L5 ÇŰÉŐĘŞ¤ËÂФˇ¤Ć ld.so ¤ňĽęĽóĽŻ¤š¤ëťţ¤ĎĄ˘XView ĽéĽ¤
+ ĽÖĽéĽę¤Ë ld.so ¤ŹĆ°şî¤ˇ¤Ę¤¤¤č¤Ś¤ËśŚÍ­Ľ¤ĽáĄźĽ¸¤Ř¤ÎŔäÂĐĽŃĽš¤ň´Ţ¤Ţ¤ť¤Ę¤¤
+ ¤ČĄ˘1.3 °ĘÁ°¤ÎĽĐĄźĽ¸ĽçĽó¤Î ld.so ¤Č¤ĎĚäÂę¤ňŔ¸¤¸¤ë¤Ç¤ˇ¤ç¤ŚĄŁťĂÄęĹŞÂĐşö
+ ¤ĎĄ˘/ĄĘĽëĄźĽČĽÇĽŁĽěĽŻĽČĽęĄË¤ň /etc/ld.so.config ¤ËĆţ¤ě¤ë¤ł¤Č¤Ç¤š¤ŹĄ˘¤č
+ ¤ęÎɤŻ¤š¤ë¤Ę¤éĄ˘XView ¤ňÁęÂм鼤ĽÖĽéĽęĚž¤ČĽęĽóĽŻ¤š¤ë¤ŤĄ˘¤č¤ężˇ¤ˇ¤¤
+ ld.so ¤ňźę¤ËĆţ¤ě¤ë¤ł¤Č¤Ç¤šĄŁ
+
+ 3. XFree86 ¤ňĆłĆţ¤š¤ë¤Ë¤Ď
+
+ ĽĐĄźĽ¸ĽçĽó 3.0 ¤Ť¤éťĎ¤á¤ë¤Ę¤éĄ˘XFree86 ¤ň /usr/X11R6 ¤ËĆłĆţ¤ˇ¤Ţ
+ ¤šĄŁX11R5 ¤Č X11R6 ¤ÎΞĘý¤ňĆłĆţ¤š¤ë˝˝ĘŹ¤ĘĽÇĽŁĽšĽŻÍĆÎ̤ŹĚľ¤¤žěšç
+ ¤ĎĄ˘X11R5 ¤ÎÉŹÍפÎĚľ¤¤ÉôĘŹ¤ňźÎ¤Ć¤ëťö¤ÇĽÇĽŁĽšĽŻÍĆÎ̤ňłÎĘݤˇ¤Ţ¤ˇ¤ç¤ŚĄŁĆĂ
+ ¤ËĄ˘ĽŐĽŠĽóĽČ¤Č¸Ĺ¤¤ X11R5 ¤ÎĽĐĽ¤ĽĘĽę¤ĎĄ˘žĂľî˝ĐÍč¤Ţ¤šĄŁĽŔĽ¤ĽĘĽßĽĂĽŻĽęĽó
+ ĽŻ¤ňťČ¤Ś X11R5 ¤ÎĽĐĽ¤ĽĘĽę¤ňĆ°şî¤ľ¤ť¤ë¤Ë¤ĎśŚÍ­ĽéĽ¤ĽÖĽéĽę¤ňźč¤Ă¤Ć¤Ş¤¤¤Ć
+ ˛ź¤ľ¤¤ĄŁ
+
+ XFree86 3.X ¤Î¤˝¤ě¤ž¤ě¤ÎĽĐĽ¤ĽĘĽęÇŰÉŐĘŞ¤Ë¤ĎĄ˘ÂĐąţ¤š¤ëČǤΞܺ٤ĘĆłĆţ¤Ë´Ř
+ ¤š¤ëʸ˝ń¤ŹÉŐ°¤ˇ¤Ć¤¤¤Ţ¤šĄŁËؤɤκǿˇ¤ÎžđĘ󤏤˝¤Îʸ˝ń¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘¤ł¤Î
+ ʸ˝ń¤Ë Linux ¤ÇĆ°¤Ż XFree86 3.X ¤Î´đËÜĹŞ¤ĘľĄÇ˝¤ČĽ˝ĄźĽš¤ň¤É¤Ś¤ä¤Ă¤ĆĽłĽó
+ ĽŃĽ¤Ľë¤š¤ë¤Ť¤ňľ­˝Ň¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 4. XFree86 ¤ňĆ°şî¤ľ¤ť¤ë¤Ë¤Ď
+
+ XFree86 ¤ňĆ°şî¤ľ¤ť¤ë¤ż¤á¤Ë¤Ď 4MB ¤Î˛žÁŰĽáĽâĽę¤ŹÉŹÍפǤš¤ŹĄ˘˛÷ĹŹ¤ËĆ°şî
+ ¤ľ¤ť¤ëşÇžŽ¤Î´Äś­¤Č¤ˇ¤Ć¤ĎĄ˘ÂżĘŹ 8MB ¤ÎźÂľ­˛ą¤Ź¤˘¤Ă¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Ç¤ˇ¤ç
+ ¤ŚĄŁ386 Ľ×ĽíĽťĽĂĽľ¤Ë¤Č¤Ă¤Ć 387 ĽłĽ×ĽíĽťĽĂĽľ¤ĎĄ˘Í­¸ú¤Ç¤š¤ŹĄ˘ĘŞÍýĹŞ¤ĘĽá
+ ĽâĽę¤ňÁýŔߤˇ¤ż¤Ű¤Ś¤ŹÂĐĎĂ˝čÍý¤ÎÂŽĹ٤ϳĘĂʤ˸ţžĺ¤ˇ¤Ţ¤šĄŁ¤Ţ¤żĄ˘šâÂŽ¤ĘĽ°Ľé
+ ĽŐĽŁĽĂĽŻĽŤĄźĽÉĄ˘ĽĐĽš¤Ţ¤ż¤ĎĽáĽâĽę¤ŹĽľĄźĽĐĄź¤ÎŔ­Ç˝¤ň¸ţžĺ¤ľ¤ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ tar ĽŐĽĄĽ¤Ľë¤ňŸłŤ¤ˇ¤ż¤éĄ˘/etc/ld.so.conf ¤ÎĂ植ĄĘ˝é´üĂͤˤč¤Ă¤Ć´ű¤Ë¤˝
+ ¤ŚÄęľÁ¤ľ¤ě¤Ć¤¤¤ë¤Ď¤ş¤Ç¤šĄËĄ˘LD_LIBRARY_PATH ´Äś­ĘŃżô¤ÎĂć¤Ë
+ /usr/X11R6/lib ¤ňÄęľÁ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤Ţ¤żĄ˘š˝ŔŽÄęľÁĽŐĽĄĽ¤Ľë¤Ç¤˘¤ë
+ README.Config ¤ňťŘżË¤Č¤ˇĄ˘XF86Config.eg ¤ňÎăÂę¤Ë¤ˇ¤Ć /etc/XF86Config
+ ¤Ţ¤ż¤Ď /usr/X11R6/lib/X11/XF86Config¤ňĽŰĽšĽČ¤Îš˝ŔŽ¤ňŔľłÎ¤Ëľ­Ćţ¤ˇ¤Ę¤ą¤ě
+ ¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ´Ö°ă¤Ă¤ż XF86Config ¤ňťČ¤Ś¤ČĽĎĄźĽÉĽŚĽ§Ľ˘¤ňÄˤá¤ëžěšç¤Ź¤˘
+ ¤ë¤Î¤ÇĄ˘ÎɤŻĘ¸žĎ¤ňĆɤó¤Ç˛ź¤ľ¤¤ĄŁĆĂ¤ËĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Č
+ /usr/X11R6/lib/X11/doc ¤Ë¤˘¤ë¤˝¤Îž¤Î README ĽŐĽĄĽ¤Ľë¤ňÎɤŻĆɤó¤Ç˛ź¤ľ
+ ¤¤ĄŁ
+
+ XFree86-3.1.2F ¤Ť¤é¤Ď¤¸¤á¤ë¤Ę¤é¤ĐÇŰÉŰĘŞ¤ËĆţ¤Ă¤Ć¤¤¤ëżˇ¤ˇ¤¤ŔßÄęĽćĄźĽĆĽŁ
+ ĽęĽĆĽŁ¤Ç¤˘¤ë XF86Setup ¤Ź¤˘¤ę¤Ţ¤šĄŁXF86Config ¤ňŔßÄꤚ¤ë¤ł¤ÎĽÄĄźĽë¤ňťČ
+ ÍѤš¤ë¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁĹŹŔÚ¤Ęʸ˝ń¤ň¤ŞĆɤߤŻ¤Ŕ¤ľ¤¤ĄŁ
+
+ XFree86 ¤ĎĄ˘X ĽľĄźĽĐĄź¤Č¤Î´Ö¤ÇÁĐĘý¸ţ¤Ë˛žÁŰĂźËö (VT) ŔÚ¤ęÂؤ¨ĄĘĽľĄźĽĐĄź
+ ¤Ť¤é˛žÁŰĂźËö¤ŘĄ˘˛žÁŰĂźËö¤Ť¤éĽľĄźĽĐĄź¤ŘŔÚ¤ęÂؤ¨¤ëĄË¤ň¤š¤ëľĄÇ˝¤Ź¤˘¤ę¤Ţ
+ ¤šĄŁ˝é¤á¤ĆľŻĆ°¤š¤ë¤Č¤­¤ĎĄ˘XFree86 ¤ŹĄ˘Ŕ褺˛žÁŰĂźËöĄĘťČÍѲÄÇ˝¤Ęž¤ÎĽ×Ľí
+ ĽťĽš¤ËłŤ¤Ť¤ě¤Ć¤¤¤Ę¤¤¤â¤ÎĄË¤ňźŤĆ°ĹޤËĂľ¤ˇ¤ĆĄ˘¤˝¤Î˛žÁŰĂźËö¤ÇľŻĆ°¤ˇ¤Ţ¤šĄŁ
+ ¤˝¤Î˛žÁŰĂźËö¤ŹťČÍŃÉԲĤΞěšçĄ˘Ľ¨ĽéĄźĽáĽĂĽťĄźĽ¸¤ň˝Đ¤ˇ¤Ć XFree86 ¤Ď˝ŞÎť
+ ¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ ``vt<nn>'' ¤Č¤¤¤ŚĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ë¤ł¤Č¤Ë¤č¤Ă¤ĆĄ˘ĽľĄźĽĐ
+ Ąź¤ňťŘÄꤚ¤ë˛žÁŰĂźËö¤ÇźÂšÔ¤ľ¤ť¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ¤ł¤ł¤Ç <nn> ¤ĎťČÍѲÄÇ˝
+ ¤Ę˛žÁŰĂźËöČÖšćĄĘ1 ¤Ť¤éťĎ¤Ţ¤ę¤Ţ¤šĄË¤Ç¤šĄŁśő¤¤¤Ć¤¤¤ë˛žÁŰĂźËö¤Ź¤Ę¤¤¤Č¤­
+ ¤ĎĄ˘XFree86 ¤ĎľŻĆ°ÉÔÇ˝¤Ç¤šĄŁ include/linux/tty.h ¤ÎĂć¤Î NR_CONSOLES ¤Î
+ żô¤ňÁý¤ä¤ˇ¤ĆĽŤĄźĽÍĽë¤ňĽłĽóĽŃĽ¤Ľë¤š¤ě¤ĐĄ˘ťČÍѲÄÇ˝¤Ę˛žÁŰĂźËö¤Îżô¤ňÁý¤ä¤š
+ ¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ
+
+ °ěĂśĄ˘XFree86 ¤ŹĆ°şî¤ˇ¤Ć¤ˇ¤Ţ¤¨¤ĐĄ˘ĽłĽóĽČĽíĄźĽëĽ­Ąź <Ctrl> ¤ČĽŞĽëĽżĽÍĽ¤
+ ĽČĽ­Ąź <Alt> ¤ČĽŐĽĄĽóĽŻĽˇĽçĽóĽ­Ąź <Fnn> ¤ňĆąťţ¤Ë˛Ą¤š¤ł¤Č¤ÇĄ˘Âž¤Î˛žÁŰĂź
+ Ëö¤ËŔÚ¤ęÂؤ¨¤é¤ě¤Ţ¤šĄŁ¤ł¤ł¤Î nn ¤ĎŔÚ¤ęÂؤ¨¤ż¤¤˛žÁŰĂźËöČÖšć¤Ç
+ ¤šĄŁXFree86 ĽľĄźĽĐĄź¤ËĚᤚ¤Č¤­¤ĎĄ˘ĽľĄźĽĐĄź¤ŹÉ¸˝ŕ¤ÇťČ¤Ă¤Ć¤¤¤ë˛žÁŰĂźËöČÖ
+ šć¤ňÉ˝¤ď¤šŔľ¤ˇ¤¤Ľ­Ąź¤ÎÁȤߚç¤ď¤ť¤ň˛Ą¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁŔľ¤ˇ¤¤Ľ­Ąź¤ÎÁȤߚç¤ď¤ť
+ ¤Č¤ĎĄ˘ĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź <Alt> ¤ČĽŐĽĄĽóĽŻĽˇĽçĽóĽ­Ąź <Fmm> ¤Ç¤šĄŁ¤ł¤ł
+ ¤ÇĄ˘mm ¤ĎĽľĄźĽĐĄź¤ŹĆ°¤¤¤Ć¤¤¤ë˛žÁŰĂźËö¤ÎČÖšć¤Ç¤šĄŁĄĘ¤ł¤ÎČÖšć¤ĎĽľĄźĽĐĄź
+ ¤ŹľŻĆ°¤š¤ë¤Č¤­¤ËÉ˝ź¨¤ľ¤ě¤Ţ¤šĄŁĄË´ű¤ËľŻĆ°¤ˇ¤Ć¤¤¤ëĽľĄźĽĐĄź¤Ť¤éľŻĆ°¤ˇ¤ż˛ž
+ ÁŰĂźËö¤Ç¤Ď¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Ăí°Ő: kbd-0.81.tar.gz °Ęšß¤ÎĽĐĄźĽ¸ĽçĽó¤ÎĂć¤Ë¤˘¤ë `loadkeys' ĽłĽŢĽóĽÉ
+ ¤ÇĄ˘ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ÎĽ­ĄźłäĹö¤ňşĆÄęľÁ¤Ç¤­¤Ţ¤šĄŁ¤ł¤ě¤ňťČ¤¨¤ĐĄ˘Î㤨¤ĐĄ˘Ľł
+ ĽóĽČĽíĄźĽëĽ­Ąź <Ctrl> ¤ČĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź <Alt> ¤ČĽŐĽĄĽóĽŻĽˇĽçĽóĽ­Ąź
+ <Fmm> ¤ňĆąťţ¤ËťČÍѤˇ¤Ć X ĽľĄźĽĐĄź˛ź¤Ť¤é°ÜĆ°¤š¤ë¤Î¤ČĆą¤¸¤č¤Ś¤ĘĽ­ĄźÁŕşî
+ ¤ÇĄ˘˛žÁŰĂźËö¤ÎĽĆĽ­ĽšĽČĽâĄźĽÉ¤Ť¤éĄ˘°ÜĆ°¤š¤ëťö¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ ĽľĄźĽĐĄź¤ň˝ŞÎť¤ľ¤ť¤ë¤ČĽľĄźĽĐĄź¤ňľŻĆ°¤ˇ¤ż˛žÁŰĂźËö¤ËĚá¤ę¤Ţ¤š¤ŹĄ˘¤â¤ˇĽľĄź
+ ĽĐĄź¤ňľŻĆ°¤ˇ¤ż˛žÁŰĂźËö¤Źťŕ¤ó¤Ç¤ˇ¤Ţ¤Ă¤ż¤Č¤­¤ĎĄ˘źęĆ°¤ÇĚ᤾¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ
+ ¤ť¤óĄŁ XFree86 ¤Ť¤éĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤ëťţ¤ËĄ˘Ě¤¤Ŕ˛čĚ̤βóÉü¤ËĚäÂꤏ¤˘
+ ¤ë¤Î¤ĎĄ˘Ľ°ĽéĽŐĽŁĽĂĽŻĽŤĄźĽÉ¤ČĽŢĽśĄźĽÜĄźĽÉ¤ÎÁęŔ­¤Ź°­¤¤¤Î¤Ŕ¤Čť×¤ď¤ě¤Ţ¤šĄŁ
+ ¤ł¤ó¤Ęťţ¤ĎĄ˘ svgalib ¤Č¤¤¤ŚÇŰÉŐĘŞ¤ËĆţ¤Ă¤Ć¤¤¤ë runx ¤Č¤¤¤ŚĽšĽŻĽęĽ×ĽČ¤ň
+ źÂšÔ¤š¤ě¤ĐĄ˘˛ňžĂ¤Ç¤­¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ľŻĆ°ťţ¤ËĄ˘XFree86 ĽľĄźĽĐĄź¤ĎĽŤĄźĽÍĽë¤ËÂФˇ¤ĆĽ­Ąźłä¤ęÉŐ¤ą¤ňłÍĆŔ¤š¤ë¤ł¤Č
+ ¤ňÍ׾ᤡ¤Ţ¤šĄŁ¤ł¤Îłä¤ęÉŐ¤ą¤ĎĽŤĄźĽÍĽë¤ňĽłĽóĽŃĽ¤Ľë¤ˇ¤ż¤Č¤­ŔßÄꤾ¤ě¤ë˝é´ü
+ ĂͤŤ¤Ţ¤ż¤ĎĄ˘`loadkeys' ĽćĄźĽĆĽŁĽęĽĆĽŁ¤Ë¤č¤Ă¤Ć˝ń¤­Âؤ¨¤żĂͤˤʤę¤Ţ¤šĄŁ
+ ĽľĄźĽĐĄź¤Ç¤ĎĄ˘ĽŤĄźĽÍĽë¤Ë°Í¸¤ˇ¤ż¤â¤ÎĄ˘ĘŁżô¤ÎĽ­ĄźÁȤߚç¤ď¤ť¤äĚľ¸ú¤ĘĽ­Ąź
+ ¤Ďłä¤ęÉŐ¤ą˝ĐÍč¤Ţ¤ť¤óĄŁ¤˝¤Îž¤ÎĽ­Ąź¤Ď X śŚÄ̤ËĘŃ´š¤ľ¤ě¤Ţ¤šĄŁX ĽľĄźĽĐĄź
+ ¤ĎĽˇĽŐĽČ¤ˇ¤Ć¤Ę¤¤žőÂÖĄ˘ĽˇĽŐĽČžőÂÖĄ˘ĽâĄźĽÉĽšĽ¤ĽĂĽÁ¤ň˛Ą¤ˇ¤Ć¤¤¤Ę¤¤žőÂ֤ȥ˘
+ ĽâĄźĽÉĽšĽ¤ĽĂĽÁ¤ň˛Ą¤ˇ¤Ć¤¤¤ëžőÂ֤Σ´źďÎड¤ŤĘŃ´šĽĆĄźĽÖĽë¤ňťý¤Ă¤Ć¤¤¤Ę¤¤¤ł
+ ¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽâĄźĽÉĽšĽ¤ĽĂĽÁ¤Ź¤É¤ó¤ĘĽ­Ąź¤Ť¤Ë¤č¤ę¤Ţ¤šĄĘ¤ł¤ě¤Ď
+ XF86Config ¤ÇŔßÄę˛ÄÇ˝¤Ç¤šĄŁ˝é´üĂÍ¤ĎĽŞĽëĽżĽÍĽ¤ĽČĽ­Ąź <Alt> ¤Ç¤šĄŁĄË
+ ¤ŹĄ˘XFree86 ¤ĎĽ­ĄźĽŢĽĂĽ×¤ÎĂć¤ËĘŃ´šĽĆĄźĽÖĽë¤ňĆɤߚţ¤ß¤Ţ¤šĄŁ¤ł¤Îťö
+ ¤ĎĄ˘Linux ¤ÎĽâĄźĽÉĽšĽ¤ĽĂĽÁ¤Ëş¸ĽłĽóĽČĽíĄźĽëĽ­Ąź¤ÎÍͤĘĆĂÄę¤ÎĽ­Ąź¤ňłä¤ęĹö
+ ¤Ć¤é¤ě¤Ę¤¤ťö¤ň°ŐĚŁ¤ˇ¤Ţ¤šĄŁ
+
+ š˝ŔŽ¤Ë¤č¤Ă¤Ć¤ĎĄ˘Ä´ťŇ¤Ź°­¤Ż¤Ę¤Ă¤Ć˝¤Ŕľ¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤¤¤ł¤Č¤Ź¤˘¤ë¤Ç¤ˇ¤ç
+ ¤ŚĄŁ˛áľî¤ËĄ˘Linux ¤Î xload ĽłĽŢĽóĽÉ¤ŹĄ˘Ć°şîĂć¤ÎĽŤĄźĽÍĽë¤Ť¤éĄ˘Éé˛ŮĘżśŃ
+ ¤ňźč¤ę˝Đ¤š¤Î¤Ë BSD ¤ÎĘýËĄ¤ňťČ¤Ă¤żťö¤Ź¤˘¤ę¤Ţ¤šĄŁXFree86-1.3 ČǤǤϥ˘ĽŤ
+ ĄźĽÍĽë¤Îž­Íč¤ÎČǤǤθߴšŔ­¤ňšÍθ¤ˇ¤ĆĄ˘Ć°şîĂć¤ÎĽŤĄźĽÍĽë¤Ť¤éÉé˛ŮĘżśŃ¤ňźč
+ ¤ę˝Đ¤šÂĺ¤ď¤ę¤ËĄ˘ /proc/loadavg ¤Ť¤éźč¤ę˝Đ¤šĘýËĄ¤ËĘѤ¨¤Ţ¤ˇ¤żĄŁXman ¤â
+ BSD ¤Î nroff ĽŐĽĄĽßĽęĄź¤ÎÂĺ¤ď¤ę¤Ë GNU groff ĽŐĽĄĽßĽęĄź¤ňĽľĽÝĄźĽČ¤š¤ë¤č
+ ¤Ś¤ËĘŃšš¤ľ¤ě¤Ţ¤ˇ¤żĄŁ¤Á¤ç¤Ă¤ČĘÔ˝¸¤ˇ¤ĆşĆĽłĽóĽŃĽ¤Ľë¤š¤ě¤Đ˝žÍč¤Î BDS ¤Î
+ nroff ¤ÎĘý¤ňĽľĽÝĄźĽČ¤š¤ë¤č¤Ś¤ËĚᤝ¤Ţ¤šĄŁĽŻĽéĽ¤Ľ˘ĽóĽČ¤ËĄ˘˛žÁŰĂźËö¤ÇĆ°şî
+ ¤ˇ¤Ć¤¤¤ż¤Î¤ČĆąĹů¤Ę¤č¤ęÎɤ¤ĽłĽóĽ˝ĄźĽëŔÚ¤ęÂؤ¨¤ňÄ󜥤š¤ë¤ż¤á¤ËĄ˘
+ /dev/console ¤Č /dev/tty0 ¤Î˝ęÍ­¸˘¤ČśŚ¤ËĽľĄźĽĐĄź¤ŹĘŃšš¤ľ¤ě¤Ţ¤ˇ¤ż¤ŹĄ˘¤˝
+ ¤Î¤ż¤á¤Ë root ¤Î setuid °Ŕ­¤ňÉŐ¤ą¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤Ż¤Ę¤ę¤Ţ¤ˇ¤żĄŁĆąÍÍ
+ ¤ËĄ˘xterm ¤Č xconsole ¤Ë¤â root ¤Î setuid °Ŕ­¤ňÉŐ¤ą¤ëÉŹÍפŹ¤˘¤ę¤Ţ
+ ¤šĄŁxconsole ¤Ď root ¤Î setuid °Ŕ­¤ňÉŐ¤ą¤ĆĆ°şî¤š¤ë¤č¤Ś¤Ë¤ĎŔߡפľ¤ě¤Ć
+ ¤Ę¤¤¤Î¤ÇĄ˘¤ł¤ě¤Ď°ÂÁ´žĺĄ˘Â礭¤ĘĚäÂꤏŔ¸¤¸¤ë¤Čť×¤ď¤ě¤Ţ¤šĄŁ
+
+ 5. ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă Xdm ¤ÎĆłĆţ
+
+ xdm ¤ĎĆ°ĹŞ¤ËĽęĽóĽŻ¤ˇ¤Ć¤¤¤ë¤Î¤ÇĄ˘xdm ¤ÎĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ÎĽ˘ĽáĽęĽŤšńł°¤Ř¤Î
+ ͢˝ĐŔŠ¸Â¤ĎĚäÂę¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ł¤ě¤Ď DES °Ĺšć˛˝Ľ×ĽíĽ°ĽéĽŕ¤ň´Ţ¤ó¤Ç¤¤¤Ę¤¤
+ ťö¤Ť¤é¤Ç¤šĄŁ˝ž¤Ă¤Ć¸˝şßĄ˘ĽĐĽ¤ĽĘĽęĽŃĽĂĽąĄźĽ¸¤Ë xdm ¤Ź´Ţ¤Ţ¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+ xc/lib/Xdmcp/WrapHelp.c ¤Č¤¤¤ŚĽŐĽĄĽ¤Ľë¤Ź XFree86-3.2 ¤ÎĽ˝ĄźĽš¤Ë´Ţ¤Ţ¤ě
+ ¤Ć¤¤¤Ę¤¤¤Î¤ÇĄ˘XDM-AUTHORIZATION-1 ¤ĎĽľĽÝĄźĽČ¤ˇ¤Ţ¤ť¤óĄŁWrapHelp.c ¤ňĆţ
+ źę¤ˇ¤Ć xf86site.def ¤ÎĂć¤Ë HasXdmAuth ¤ňŔßÄꤡ¤ż¸ĺ¤Ç xdm ¤ňşĆš˝Ăۤš¤ë
+ ÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ WrapHelp.c ¤ĎĽ˘ĽáĽęĽŤšńĆâ¤Ë¤˘¤ę¤Ţ¤šĄŁžÜşŮ¤Ď ftp.x.org:/pub/R6/xdm-
+ auth/README ¤ň¤´Í÷¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽÇĽŁĽšĽ×ĽěĽ¤ĽŢĽÍĄźĽ¸Ľă¤ňľŻĆ°¤š¤ëÁ°¤ËĄ˘ĽëĄźĽČ (root) ¤ÇĽíĽ°Ľ¤Ľó¤ˇ¤ĆĽłĽó
+ Ľ˝ĄźĽë¤Ť¤é ``xdm -nodaemon'' ¤ČĆţÎϤˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ console getty ¤ňĚľ¸ú¤Ë¤ˇ¤ĆĄ˘ /etc/inittab ¤ňĘŃšš¤š¤ë¤ł¤Č¤Ë¤č¤ęĽÖĄźĽČťţ
+ ¤ËźŤĆ°ĹŞ¤Ë xdm ¤ňľŻĆ°˝ĐÍč¤Ţ¤šĄŁžÜşŮ¤ĎťČ¤Ş¤Ś¤Č¤š¤ë Linux ÇŰÉŰĘŞ¤Î xdm
+ ¤ÎŔßÄę¤Ë°Í¸¤ˇ¤Ţ¤š¤Î¤Ç¤ł¤ł¤Ë¤˘¤ëʸ˝ń¤ňłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ xdm ĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ĎĽˇĽăĽÉĽŚĽŃĽšĽďĄźĽÉ¤ČÉáÄ̤μѼšĽďĄźĽÉ¤ÎĽˇĽšĽĆĽŕ¤ÎΞ
+ Ęý¤ÇĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 6. xterm
+
+ XFree86-3.2 ĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤Ď libtermcap ¤ČŔĹĹŞ¤ËĽęĽóĽŻ¤ˇ¤Ć¤¤¤ë xterm
+ ĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁxterm ¤Ď libtermcap ¤Č libncurses ¤Î¤É¤Á
+ ¤é¤Ë¤Ç¤â´ŘϢ¤Î¤˘¤ëĽ×ĽíĽ°ĽéĽŕ¤ÎÁ´¤Ć¤ÎÇŰÉŰĘŞ¤ÇŔľ¤ˇ¤ŻĆ°şî¤š¤ëłÎǧ¤ň¤ˇ¤Ć¤¤
+ ¤Ţ¤šĄŁľŐ¤Ë XFree86-3.1.2 ¤ËÉŐ°¤š¤ë¤¤¤Ż¤Ä¤Ť¤ÎĽŮĄźĽżČǤΠxterm ĽĐĽ¤ĽĘĽę
+ ÇŰÉŰĘŞ¤ĎĆłĆţ¤ˇ¤żşÇżˇ¤Î libncurses ¤Č¤Ď´ŘϢ¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 7. ĆţÎĎľĄ´ď
+
+ şŁ˛óĄ˘XInput ľĄÇ˝łČÄĽ¤ňťČ¤Ă¤żł°ÉôĆţÎĎľĄ´ďĽÉĽéĽ¤ĽĐ¤ÎĽŔĽ¤ĽĘĽßĽĂĽŻĽíĄź
+ ĽÇĽŁĽóĽ°¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ¸˝şßźĄ¤ÎľĄ´ď¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ o Ľ¸ĽçĽ¤ĽšĽĆĽŁĽĂĽŻ (xf86Jstk.so)
+
+ o Wacom ĽżĽÖĽěĽĂĽČ (Wacom IV Ľ×ĽíĽČĽłĽë¤Ë¸ÂÄę, xf86Wacom.so)
+
+ o SummaSketch ĽżĽÖĽěĽĂĽČ (xf86Summa.so)
+
+ o Elographics ĽżĽĂĽÁĽšĽŻĽęĄźĽó (xf86Elo.so)
+
+ ĆĂÄę¤ÎľĄ´ď¤ňťČÍѤš¤ë¤Ë¤ĎĄ˘źĄ¤ÎšÔ¤ň XF86Config ¤Î Module ¤ËÄɲ䡤ƤŻ¤Ŕ
+ ¤ľ¤¤ĄŁ¤ł¤ł¤Ç module ¤Ď ľĄ´ď¤ËÂĐąţ¤š¤ë.so ĽŐĽĄĽ¤Ľë¤ÎĚžžÎ¤Ç¤šĄŁ
+
+ load "module"
+
+ ¤Ţ¤żĄ˘XF86Config ¤Î XInput ¤ÎÉôĘŹ¤ňŔßÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁŔßÄęźę˝ç¤Î
+ žÜşŮ¤Ë¤Ä¤¤¤Ć¤Ď XF86Config(5) ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ xsetpointer(1) ĽłĽŢĽóĽÉ¤ňťČ¤Ă¤Ć X ¤ÎĽŤĄźĽ˝Ľë¤ňśîĆ°¤š¤ëťČÍѤˇ¤ż¤¤ľĄ´ď¤Ë
+ ĘŃšš˝ĐÍč¤Ţ¤šĄŁ
+
+ Ľ¸ĽçĽ¤ĽšĽĆĽŁĽĂĽŻ¤ňťČ¤Ś¤Ë¤ĎĽŤĄźĽÍĽë¤ËĽ¸ĽçĽ¤ĽšĽĆĽŁĽĂĽŻ¤ÎĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ
+ ¤ňÁȤߚţ¤ŕÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 7.1. PEX ¤Č XIE ľĄÇ˝łČÄĽ¤ÎŔßÄę
+
+ ¸˝şßĄ˘PEX ¤Č XIE ľĄÇ˝łČÄĽ¤Ďł°ÉôĽâĽ¸ĽĺĄźĽë¤Č¤ˇ¤ĆĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤Î
+ ľĄÇ˝łČÄĽ¤ňťČ¤¤¤ż¤¤žěšç¤ĎĄ˘źĄ¤ÎšÔ¤ň XF86Config ¤Î Module ¤ËÄɲ䡤ƤŻ¤Ŕ
+ ¤ľ¤¤
+
+ load "pex5.so"
+ load "xie.so"
+
+ 8. XFree86 ¤ňĽłĽóĽŃĽ¤Ľë¤š¤ë¤Ë¤Ď
+
+ XFree86 ¤Î´°Á´ČǤμ˝ĄźĽš¤Ŕ¤ą¤ĎĚľÎÁ¤Ç¸řłŤ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁşÇżˇ¤Î XFree86
+ ¤Î´°Á´ČÇ¤Ď 3.2 ¤Ç¤šĄŁ
+
+ XFree86 ¤ňĽłĽóĽŃĽ¤Ľë¤š¤ë¤ż¤á¤Ë¤ĎĆĂĘ̤ʟę˝ç˝ń¤ĎÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁ¤ł¤ÎĽĐĄź
+ Ľ¸ĽçĽó¤Î XFree86 ¤Ď gcc-2.7.2 Ą˘Elf ĽéĽ¤ĽÖĽéĽę¤Î 5.2.18 ¤ČśŚÍѼ鼤ĽÖĽé
+ Ľę¤Î1.7.14 Ą˘ĽŔĽ¤ĽĘĽßĽĂĽŻĄŚĽęĽóĽŤ ld.so ¤Č¤ÇĽłĽóĽŃĽ¤Ľë¤ˇ¤Ć¤¤¤Ţ¤šĄŁĽľĄź
+ ĽĐĄź¤Ď 486 Ľ×ĽíĽťĽĂĽľÍѤ˺ÇĹŹ˛˝¤š¤ë°Ů¤ËĄ˘-m486 ĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ĆĽłĽó
+ ĽŃĽ¤Ľë¤ľ¤ě¤Ć¤¤¤Ţ¤š¤ŹĄ˘ĽĐĽ¤ĽĘĽę¤Ď 386 Ľ×ĽíĽťĽĂĽľ¤ÇĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁĄĘ
+ -m486 ¤ňÉŐ¤ą¤ĆĽłĽóĽŃĽ¤Ľë¤ˇ¤ż¤â¤Î¤ĎĄ˘-m386 ¤ňÉŐ¤ą¤ĆĽłĽóĽŃĽ¤Ľë¤ˇ¤ż¤â¤Î¤č
+ ¤ęžŻĄšĽŐĽĄĽ¤ĽëĽľĽ¤Ľş¤ŹÂ礭¤Ż¤Ę¤Ă¤Ć¤¤¤Ţ¤š¤ŹĄ˘Ŕ­Ç˝¤ÎÂťźş¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁĄË
+
+ Á´¤Ć¤ÎľĄÇ˝łČÄĽ¤ČĽŻĽéĽ¤Ľ˘ĽóĽČ¤Ď°Üż˘¤ČĽĆĽšĽČ¤Ź˝Ş¤ď¤Ă¤Ć¤¤¤Ţ¤šĄŁÉ¸˝ŕ¤Ç¤ĎĄ˘
+ ĽľĄźĽĐĄź¤Ďł°ÉôľĄÇ˝łČÄĽ (PEX, XIE Ĺů) Ěľ¤ˇ¤ÇĽłĽóĽŃĽ¤Ľë¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘¤ł
+ ¤ě¤é¤Îł°ÉôľĄÇ˝łČÄĽ¤ÎĽéĽ¤ĽÖĽéĽę¤Ď´ű¤ËŔ¸ŔŽşŃ¤ß¤Ç¤šĄŁł°ÉôľĄÇ˝łČÄĽ¤ĎźÂšÔťţ
+ ¤ËĽíĄźĽÇĽŁĽóĽ°¤ľ¤ě¤Ţ¤šĄŁžÜşŮ¤Ď XFree86 ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤ˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ site.def ¤ňĘŃšš¤š¤ě¤ĐĄ˘ł°ÉôľĄÇ˝łČÄĽ¤ňĽłĽóĽŃĽ¤Ľë¤ˇ¤ĆĽľĄźĽĐĄź
+ ¤ËÁȤߚţ¤á¤Ţ¤šĄŁźă¤ˇ¤Ż¤ĎĄ˘ĽęĽóĽŻĽ­ĽĂĽČ¤ŹĽľĄźĽĐĄź¤ňĘŃšš¤Ç¤­¤Ţ¤šĄŁ
+
+ ÇŰÉŐĘŞ¤ĎÂçĘŃÂ礭¤¤¤â¤Î¤Ç¤š¤ŹĄ˘ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘ĽëĄ˘PEX ¤äÂ礭¤ĘĽŻĽéĽ¤
+ Ľ˘ĽóĽČ¤ňžĂľî¤š¤ëĹů¤ˇ¤ĆĽ˝ĄźĽš¤ňĂí°Őżź¤ŻŔ°Íý¤š¤ě¤ĐĄ˘XFree86 ¤Ď 64MB ¤ÎĽŃ
+ ĄźĽĆĽŁĽˇĽçĽóŁą¤Ä¤ÇĄ˘ĽłĽóĽŃĽ¤Ľë˝ĐÍč¤Ţ¤šĄŁ Makefile ¤ňşîŔŽ¤š¤ë¤Ë¤ĎĄ˘Ăą¤Ë
+ ``make Makefiles'' ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽŐĽĄĽ¤Ľë¤ŹźŤĆ°ĹŞ¤ËşîŔŽ¤ľ¤ěĄ˘źÂ
+ šÔ¤Ď˝ŞÎť¤ˇ¤Ţ¤šĄŁĽÇĽŁĽšĽŻ¤ňŔáĚ󤚤ë¤Ę¤é¤ĐĄ˘``make depend'' ¤ĎźÂšÔ¤š¤ëÉŹ
+ ÍפϤʤ¤¤Ç¤ˇ¤ç¤ŚĄŁ 100MB ¤Îśő¤­ĽÇĽŁĽšĽŻ¤Ź¤˘¤ě¤ĐĄ˘¤â¤Ă¤ČÍĆ°×¤Ë XFree86
+ ¤ňĽłĽóĽŃĽ¤Ľë¤Ç¤­¤Ţ¤šĄŁĽľĄźĽĐĄźÁ´¤Ć¤ňĽłĽóĽŃĽ¤Ľë¤š¤ë¤Ë¤ĎĄ˘Ěó 10MB ¤Î˛žÁŰ
+ ĽáĽâĽę¤ŹÉŹÍפǤˇ¤ç¤ŚĄŁ
+
+ XFree86 ¤Î aout ČǤňŔ¸ŔŽ¤ˇ¤ż¤ęĽŃĽĂĽÁ¤ŹĽéĽ¤ĽÖĽéĽę¤Ë˝ĹÍפĘĘŃšš¤ňšÔ¤Ę¤Śžě
+ šç¤ĎĄ˘ššżˇ¤ˇ¤ż jump_xxx ¤ŹÉŹÍפǤˇ¤ç¤ŚĄŁDLL tools ĽŃĽĂĽąĄźĽ¸¤ËÉŐ°¤š¤ë
+ źę˝ç¤ÇĽŃĽĂĽÁ¤ŹŔ¸ŔŽ¤Ç¤­Ą˘XFree86 ¤ÎĽŃĽĂĽÁ¤ňĹö¤Ć¤ë¤Î¤ËÉŹÍפǤˇ¤ç¤ŚĄŁ
+
+ Î㤨¤ĐĄ˘Xaw3d ¤Î¤č¤Ś¤Ęł°Éô X śŚÍ­ĽéĽ¤ĽÖĽéĽę¤â X ĽéĽ¤ĽÖĽéĽę¤ňĽłĽóĽŃĽ¤Ľë
+ ¤š¤ë¤č¤Ś¤ËĄ˘ X ĽéĽ¤ĽÖĽéĽę¤ňÄęľÁ¤š¤ë JUMP_xxx ¤ÇÄęľÁ¤ˇ¤ĆĽłĽóĽŃĽ¤Ľë˝ĐÍč
+ ¤Ţ¤šĄŁžÜşŮ¤Ęźę˝ç¤Ë¤Ä¤¤¤Ć¤ĎĄ˘X ĽéĽ¤ĽÖĽéĽę¤ÎÄęľÁÎă¤ňĄ˘
+ /usr/X11R6/lib/X11/config/lnxLib.rules ¤ËÄ󜥤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ Orest Zborowski (orestz@eskimo.com) ťá¤ŹłŤČŻ¤ˇ¤żşÇżˇ¤ÎĘýËĄ¤ÇĄ˘Á´¤Ć¤ÎžÜ
+ şŮŔâĚŔĽŐĽĄĽ¤Ľë¤ň˝ń¤­Ą˘˝é¤á¤Ć XFree86 DLL ĽéĽ¤ĽÖĽéĽę¤ňşîŔŽ¤ˇ¤Ć¤Ż¤ě¤ż
+ Dirk Hohndel (hohndel@aib.com) ťá¤Ë´śźŐ¤ˇ¤Ţ¤šĄŁ
+
+ 9. ĽĐĽ°¤ÎšđĂΤˤĤ¤¤Ć
+
+ ĽĐĽ°Ęóšđ¤Ď XFree86@XFree86.org ¤ËÁ÷¤ë¤Ť comp.windows.x.i386unix ¤ÎĽËĽĺ
+ ĄźĽšĽ°ĽëĄźĽ×¤ËĹęšĆ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Linux.sgml,v 3.9 1996/10/20 13:33:12 dawes Exp
+
+ $XConsortium: Linux.sgml /main/3 1995/11/12 19:59:39 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/Linux.sgml,v
+ 3.9 1996/10/20 13:33:12 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/Linux.sgml,v 3.10 1995/11/15 07:38:32 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.S3 b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.S3
new file mode 100644
index 000000000..7e95f5631
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.S3
@@ -0,0 +1,670 @@
+ S3 ĽÁĽĂĽ×ĽťĽĂĽČťČÍџԤΤż¤á¤ÎžđĘó
+ XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇĂř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 1 ˇî 15 Ćü
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽĎĄźĽÉĽŚĽ§Ľ˘
+
+ 2. 16bpp ¤Č 32bpp
+
+ 3. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Î°ěÍ÷
+
+ 4. ÄɲĂĂí°Őťöšŕ
+
+ 5. IBM RGB 5xx RAMDAC ¤ÎĽŻĽíĽĂĽŻĂͤňť˛žČ¤š¤ë¤Ë¤Ď
+
+ 6. Ľ°ĽéĽŐĽŁĽĂĽŻ˛čĚĚÁŕşîťţĄ˘``Ŕ㤏šß¤ë'' ¸˝žÝ¤Î˛óČňşö
+ ______________________________________________________________________
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽĎĄźĽÉĽŚĽ§Ľ˘
+
+ ¸˝šÔ¤Î S3 ĽľĄźĽĐ¤Ď 911, 924, 801/805, 928, 732 (Trio32), 764 (Trio64),
+ 864, 868, 964 ¤Č 968 ¤ÎĆţźę˛ÄÇ˝¤Ę S3 ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁS3 ĽľĄźĽĐ¤Ď 866 ¤âǧźą¤ˇ¤Ţ¤š¤ŹĄ˘¤ł¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď̤¤ŔĽĆĽšĽČ¤ˇ¤Ć¤Ţ
+ ¤ť¤óĄŁ¤ł¤ě¤é¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ç˛ż¤ŤĚäÂꤏ¤˘¤Ă¤ż¤Č¤ŤĄ˘¤Ś¤Ţ¤ŻĆ°şî¤ˇ¤ż¤Č¤Ť
+ ¤ňĄ˘˛ćĄš¤ËĘóšđ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ¤ˇ¤Ť¤ˇĄ˘¤˝¤ě¤é¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëÁ´¤Ć¤ÎĽÓĽÇĽŞĽÜĄźĽÉ¤ň˝˝ĘŹĽľĽÝ
+ ĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁĆ°şîłÎǧ¤ň¤ˇ¤żĽÓĽÇĽŞĽÜĄźĽÉ¤Î¤¤¤Ż¤Ä¤Ť¤ňźĄ¤Î°ěÍ÷¤Ëź¨¤ˇ
+ ¤Ţ¤šĄŁźŤĘŹ¤ÎĽŤĄźĽÉ¤Ëť÷¤żĽŤĄźĽÉ¤Ź°ěÍ÷¤ÎĂć¤Ë¤˘¤ëžěšç¤ĎĄ˘¤˝¤ÎĽŤĄźĽÉ¤âĆ°şî
+ ¤š¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁĚőĂíĄ§bpp (bit per pixel) ¤ĎŁąĽÔĽŻĽťĽë(˛čÁÇ) ¤ň
+ É˝¸˝¤š¤ëĽÓĽĂĽČżô
+
+ S3 801/805, AT&T 20C490 (¤Ţ¤ż¤Ď ¤˝¤Ă¤Ż¤ę¤ľ¤ó) RAMDAC
+
+ o Orchid Fahrenheit 1280+ VLB
+
+ o Actix GE32
+
+ 8 ¤Č 15/16 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ăí°Ő: ËÜĘŞ¤Î AT&T20C490 RAMDAC ¤ĎĽľĄźĽĐ¤ÇźŤĆ°Ç§źą˝ĐÍč¤Ţ¤šĄŁ¤˝¤Î
+ ¸ß´šĽÁĽĂĽ×ĽťĽĂĽČ¤Îžěšç¤Ď XF86Config ¤Ë `Ramdac "att20c490"'¤ČĚŔ
+ ľ­¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ËÜĘŞ¤Î AT&T 20C490 ¤Č 20C491 RAMDAC ¤Ď "dac_8_bit" ¤Č¤¤¤ŚĽŞĽ×
+ ĽˇĽçĽó¤ňÉŐ¤ą¤ĆĆ°şî¤ˇ¤Ţ¤šĄŁĄĘWinbond 82C490 ¤Î¤č¤Ś¤ĘĄË¤¤¤Ż¤Ä¤Ť¤Î
+ ¤˝¤Ă¤Ż¤ę¤ľ¤ó¤Ë¤ĎĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Orchid Fahrenheit 1280+ VLB ¤Ë¤Ď `Option "nolinear"' ¤ŹÉŹÍפÇ
+ ¤šĄŁ
+
+ S3 805 VLB, S3 GENDAC (RAMDAC + ĽŻĽíĽĂĽŻĽˇĽóĽťĽľĽ¤ĽśĄź)
+
+ o MIRO 10SD (VLB ¤Č PCI ÍѤŹÍřÍѲÄÇ˝) Á´¤Ć¤Î10SD ¤Ź S3 GENDAC ¤ňĹë
+ şÜ¤ˇ¤Ć¤¤¤ë¤Ť¤É¤Ś¤Ť¤Ď¤ď¤Ť¤ę¤Ţ¤ť¤óĄŁ
+
+ 8 ¤Č 15/16 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ClockChip "s3gendac"
+ RamDac "s3gendac"
+
+ S3 801/805, AT&T 20C490 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o STB PowerGraph X.24 S3 (ISA)
+
+ 8 ¤Č 15/16 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ăí°Ő: ËÜĘŞ¤Î AT&T20C490 RAMDAC ¤ĎĽľĄźĽĐ¤ÇźŤĆ°Ç§źą˝ĐÍč¤Ţ¤šĄŁ¤˝¤Î
+ ¸ß´šĽÁĽĂĽ×ĽťĽĂĽČ¤Îžěšç¤Ď XF86Config ¤Ë`Ramdac "att20c490"'¤ČĚŔľ­
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+ RamDac "att20c490"
+ Option "dac_8_bit
+
+ S3 805, Diamond SS2410 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Diamond Stealth 24 VLB
+
+ 8 ¤Č 15bpp(*) ¤Î¤ß¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ `Option "nolinear"' ¤Č¤¤¤ŚĽŞĽ×ĽˇĽçĽó¤ŹÉŹÍפǤšĄŁ
+
+ (*) SS2410 RAMDAC ¤Ď AT&T20C490 ¤Č15 bpp ĽâĄźĽÉ¤Ç¤Ď¸ß´šŔ­¤Ź¤˘¤ë
+ ¤ł¤Č¤ŹĘóšđ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤˝¤ÎĽÁĽĂĽ×¤ň AT&T20C490 ¤Č¤ß¤Ę¤ˇ¤ĆĽľĄźĽĐ
+ ¤ňŔ¸ŔŽ¤ˇ¤żžěšçĄ˘XF86Config ¤Ë `Ramdac "att20c490"' ¤Č˝ń¤ŻÉŹÍפŹ
+ ¤˘¤ę¤Ţ¤šĄŁ
+
+ S3 801/805, Chrontel 8391 ĽŻĽíĽĂĽŻĽÁĽĂĽ×/Ramdac
+
+ o JAX 8241
+
+ o SPEA Mirage
+
+ 8 ¤Č 15/16 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 8391 ¤Ď AT&T 20C490 RAMDAC ¤Č¸ß´šŔ­¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ ClockChip "ch8391"
+ Ramdac "ch8391"
+ Option "dac_8_bit"
+
+ S3 928, AT&T 20C490 RAMDAC
+
+ o Actix Ultra
+
+ 8 ¤Č 15/16 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ăí°Ő: ËÜĘŞ¤Î AT&T20C490 RAMDAC ¤ĎĽľĄźĽĐ¤ÇźŤĆ°Ç§źą˝ĐÍč¤Ţ¤šĄŁ¤˝¤Î
+ ¸ß´šĽÁĽĂĽ×ĽťĽĂĽČ¤Îžěšç¤Ď XF86Config ¤Ë `Ramdac "att20c490"'¤ČĚŔ
+ ľ­¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤Ţ¤żĄ˘ĽľĄźĽĐ¤Î RAMDAC ĂľşşĘóšđ¤ŹĹÁ¤¨¤ë¤Č¤ł¤í¤Ë¤č
+ ¤ě¤Đ´ö¤Ä¤Ť¤ÎĽÜĄźĽÉ¤ÇĚäÂꤏŔ¸¤¸Ą˘RamDac ¤ÎŔßÄꤏþşş¤Ť¤éĚľťë¤ľ¤ě
+ ¤Ţ¤šĄŁ
+
+ ËÜĘŞ¤Î AT&T 20C490 ¤Č 20C491 RAMDAC ¤Ď "dac_8_bit" ¤Č¤¤¤ŚĽŞĽ×
+ ĽˇĽçĽó¤ňÉŐ¤ą¤ĆĆ°şî¤ˇ¤Ţ¤šĄŁĄĘWinbond 82C490 ¤Î¤č¤Ś¤ĘĄË¤¤¤Ż¤Ä¤Ť¤Î
+ ¤˝¤Ă¤Ż¤ę¤ľ¤ó¤Ë¤ĎĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ S3 928, Sierra SC15025 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o ELSA Winner 1000 ISA/EISA (``TwinBus'' ¤Ď Winner1000ISA ¤Ç¤Ď¤˘¤ę
+ ¤Ţ¤ť¤ó!!)
+
+ o ELSA Winner 1000 VL
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ 8bpp ¤Ç¤Ď 8ĽÓĽĂĽČ/ĽÔĽŻĽťĽë RGB ¤ňĽľĽÝĄźĽČ¤ˇĄ˘15/16 ¤Č 24bpp ĽâĄź
+ ĽÉ¤Ç¤ĎĽŹĽóĽŢĘäŔľ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ ĽŻĽíĽĂĽŻ¤Ź 30 MHz ¤Î¸ÂłŚśá¤Ż¤Ç¤˘¤ëžěšç¤ËĄ˘ 24 bpp ¤Ç¤Ď ``Ŕ㤏
+ šß¤Ă¤ż¤č¤Ś¤Ë'' ¤Ę¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ¤ł¤ě¤Ź´í¸ą¤Ç¤˘¤ë¤ČšÍ¤¨¤Ć¤Ď¤¤
+ ¤Ţ¤ť¤ó¤ŹĄ˘ 24bpp ¤ÎťČÍѤǤ­¤ëžĺ¸Â¤Ŕ¤Čť×¤¤¤Ţ¤šĄŁ
+
+ D-ĂĘłŹ (Ëô¤Ď°Ęšß¤Î) ĽÁĽĂĽ×¤Ď 1152 ĽÉĽĂĽČ¤Î˛čĚĚÉý¤ňťČ¤Ś¤ł¤Č¤Ď˝ĐÍč
+ ¤Ę¤¤¤Î¤ÇĄ˘ 1 MB ¤ÎĽÜĄźĽÉ¤Ç¤Î¤â¤Ă¤Č¤âÍ­¸ú¤ĘĽâĄźĽÉ¤Ď 1088x800x8 ¤Ç
+ ¤š(¤ł¤ě¤Ď 2 MB ¤Îťţ¤Î 1088x800x16 ¤ČĆąÍͤǤšĄËĄŁ
+
+ ClockChip "icd2061a"
+
+ S3 928, Bt9485 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o STB Pegasus VL
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ "sync_on_green" ĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ĆĄ˘¤Ť¤Ä BNC ĽłĽÍĽŻĽż¤Ë˝ĐÎϤš¤ë
+ ¤č¤Ś¤ËĽÜĄźĽÉžĺ¤ÎĽ¸ĽăĽóĽŃĽšĽ¤ĽĂĽÁ¤ňŔßÄꤡ¤żžěšç¤ËĄ˘ÎĐżŽšćĆą´ü¤ňťČ
+ ÍѤˇ¤ż RBG ˝ĐÎϤňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ VLB ĽęĽËĽ˘ Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ĎĽ˘ĽÉĽěĽš 0x7FCxxxxx ¤Ç Ľ˘ĽŻĽťĽš¤ˇ¤Ţ¤š
+ ¤Î¤ÇĄ˘ 64MB ¤Ť¤˝¤ě°Ęžĺ¤ÎĽáĽ¤ĽóĽáĽâĽę¤Ź¤˘¤ě¤ĐĽęĽËĽ˘ĽŐĽěĄźĽŕĽĐĽĂ
+ ĽŐĽĄ¤ňźş¤Śťö¤Ę¤ˇ¤ËĽľĽÝĄźĽČ˝ĐÍč¤Ţ¤šĄŁ
+
+ ClockChip "icd2061a"
+ Option "stb_pegasus"
+
+ S3 928, Bt485 RAMDAC, SC11412 ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o SPEA Mercury 2MB VL
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "SC11412"
+ Option "SPEA_Mercury"
+
+ S3 928, Bt485 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o #9 GXE Level 10, 11, 12
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 928, Ti3020 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o #9 GXE Level 14, 16
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ÎĐżŽšćĆą´ü¤ňťČÍѤˇ¤ż RBG ˝ĐÎϤňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 864, AT&T20C498, ICS2494 ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o MIRO 20SD (BIOS 1.xx)
+
+ ICS2494 ¤Ď¸ÇÄęźţÇČżô¤ÎĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ÇĄ˘ĄĘXF86Config ĽŐĽĄĽ¤Ľë¤Ë
+ Clocks šÔ¤ň˝ń¤Ť¤ş¤ËĄËX -probeonly ¤ňźÂšÔ¤š¤ë¤ČŔľ¤ˇ¤¤ĽŻĽíĽĂĽŻ¤ŹĆŔ
+ ¤é¤ě¤Ţ¤šĄŁ
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ S3 864, AT&T20C498 ¤Ţ¤ż¤Ď STG1700 RAMDAC, ICD2061A ¤Ţ¤ż¤Ď ICS9161
+ ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Elsa Winner1000PRO VLB
+
+ o Elsa Winner1000PRO PCI
+
+ o MIRO 20SD (BIOS 2.xx)
+
+ o Actix GraphicsENGINE 64 VLB/2MB
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+
+ S3 864, 20C498 or 21C498 RAMDAC, ICS2595 ĽÁĽĂĽ×ĽťĽĂĽČ
+
+ o SPEA MirageP64 2MB DRAM (BIOS 3.xx)
+
+ 8, 15/16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ¤ł¤ÎĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Ď̤¤ŔĂÇĘŇĹŞ¤ĘĽľĽÝĄźĽČ¤ÇĄ˘¤Ť¤Ä´ö¤Ä¤Ť¤ÎĽŢĽˇĽóžĺ
+ ¤Ç¤Ď XF86_S3 ľŻĆ°ťţ¤Î˝é´ü˛čĚĚĄ˘¤Ţ¤ż¤Ď˛žÁŰĂźËö(VT) ¤Ť¤éĚá¤Ă¤żÄž¸ĺ
+ ¤Î˛čĚ̤ËĚäÂꤏ¤˘¤ę¤Ţ¤š¤ŹĄ˘ CTRL+ALT+``KP+'' ¤ÇźĄ¤ÎĽâĄźĽÉ¤ËŔÚ¤ęÂŘ
+ ¤¨¤ż¤ęĄ˘Ěá¤Ă¤ż¤ę¤š¤ëžěšç¤ÎĚäÂę¤Ď˛ňˇčşŃ¤ß¤Čť×¤ď¤ě¤Ţ¤šĄŁ
+
+ Ľ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ĎŔľ¤ˇ¤ŻĆ°şî¤ˇ¤Ţ¤ť¤óĄŁ
+
+ Mirage P64 with BIOS 4.xx ¤Ď S3 SDAC ¤ňťČÍѤˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ ClockChip "ics2595"
+
+ S3 864, S3 86C716 SDAC RAMDAC ¤ČĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Elsa Winner1000PRO
+
+ o MIRO 20SD (BIOS 3.xx)
+
+ o SPEA MirageP64 2MB DRAM (BIOS 4.xx)
+
+ o Diamond Stealth 64 DRAM
+
+ 8, 15/16 ¤Č 24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ S3 864, ICS5342 RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Diamond Stealth 64 DRAM (Ćą¤¸ĽŤĄźĽÉ¤Î¤ß)
+
+ 8, 15/16 ¤Č 24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ClockChip "ics5342"
+ Ramdac "ics5342"
+
+ S3 864, AT&T21C498-13 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o #9 GXE64 - PCI
+
+ 8, 15/16, 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 964, AT&T 20C505 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Miro Crystal 20SV
+
+ 8, 15/16, 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+ Ramdac "att20c505"
+
+ S3 964, Bt485 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Diamond Stealth 64
+
+ 8, 15/16, 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+
+ S3 964, Bt9485 or AT&T 20C505 RAMDAC, ICS9161a ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o SPEA Mercury 64
+
+ 8, 15/16, 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "ics9161a"
+ Option "SPEA_Mercury"
+
+ S3 964, Ti3020 RAMDAC, ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Elsa Winner2000PRO PCI
+
+ 8, 15/16, 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ ClockChip "icd2061a"
+
+ S3 964, Ti3025 RAMDAC, Ti3025 ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Miro Crystal 40SV
+
+ o #9 GXE64 Pro VLB
+
+ o #9 GXE64 Pro PCI
+
+ 8 bpp, 15, 16 ¤Č 24(32) bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ GXE64 Pro ¤Ç 15/16/24 bpp ¤Îžěšç¤Ë˛čÁü¤ŹĘФ俤ę/˛ó¤ęšţ¤ó¤Ŕ¤ę¤š
+ ¤ëĹůĄ˘´ö¤Ä¤Ť¤ÎĚäÂęĹŔ¤Ź¤ď¤Ť¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ ´ű¤Ë #9 ¤Ź 1600x1200 ¤ň GXE64 Pro ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę¤¤ťö¤ňĂΤäĆ
+ ¤¤¤Ţ¤šĄŁ¤ą¤ě¤É¤âž¤ÎĽÜĄźĽÉ¤Ç 135MHz ¤Ç ¤˘¤ë RAMDAC ¤ň 220MHz ¤Î
+ RAMDAC ¤ËĂÖ¤­´š¤¨¤ż GXE64Pro-1600 ¤Č¸Ć¤Đ¤ě¤ëżˇ¤ˇ¤¤ĄĘ¤˝¤ˇ¤Ć¤č¤ęšâ
+ ˛Á¤ĘĄËĽÜĄźĽÉ¤ňłŤČŻ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ S3 764 (Trio64)
+
+ o SPEA Mirage P64 (BIOS 5.xx)
+
+ o Diamond Stealth 64 DRAM
+
+ o #9 GXE64 Trio64
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ Ăí°Ő: Trio64 ¤Ď RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĆ⢤ˇ¤Ć¤¤¤ë¤Î¤ÇĄ˘ĽľĄź
+ ĽĐ¤ĎÁ´¤Ć¤Î Trio64 ¤ÇĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤Ŕ¤Ť¤é XF86Config ĽŐĽĄĽ¤Ľë
+ ¤Ë RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ĎťŘÄꤚ¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ S3 732 (Trio32)
+
+ o Diamond Stealth 64 DRAM SE
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ăí°Ő: Trio32 ¤Ď RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĆ⢤ˇ¤Ć¤¤¤ë¤Î¤ÇĄ˘ĽľĄź
+ ĽĐ¤ĎÁ´¤Ć¤Î Trio32 ¤ÇĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤Ŕ¤Ť¤é XF86Config ĽŐĽĄĽ¤Ľë
+ ¤Ë RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ĎťŘÄꤚ¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ S3 868, S3 86C716 SDAC RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o ELSA Winner 1000AVI
+
+ o Diamond Stealth Video DRAM
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ S3 868, AT&T 20C409 RAMDAC ¤Č ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o ELSA Winner 1000AVI
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ Ăí°Ő: ĽÔĽŻĽťĽëÂż˝Ĺ˛˝¤Ď̤¤ŔĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ˝ž¤Ă¤Ć 8bpp ¤Ç¤Î
+ şÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ĎŔŠ¸Â¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁşÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ď¸˝şßĄ˘
+ 67.5MHz ¤Ç¤š¤ŹĄ˘pixmux ¤Î˝¤Ŕľ¤Ź¸řłŤ¤č¤ę¤âÍĽŔ褾¤ě¤Ę¤¤¤ČĄ˘ĘŃšš¤ˇ
+ ¤ż¤Č¤ł¤í¤Ç 100MHz Ëř¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ S3 968, Ti3026 RAMDAC, Ti3026 ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Elsa Winner 2000PRO/X-2 ¤Č /X-4 (˛ţĘŃ F °Ęžĺ)
+
+ o Elsa Winner 2000AVI-2 ¤Č -4
+
+ o Diamond Stealth 64 VIDEO VRAM
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ S3 968, Ti3026 RAMDAC, ICS9161A ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Elsa Winner 2000PRO/X-2 ¤Č /X-4 (˛ţĘŃ G)
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁ
+
+ Ăí°Ő: ÇÜĽŻĽíĽĂĽŻľĄÇ˝¤Ď̤¤ŔĆ°şî¤ˇ¤Ţ¤ť¤ó¤ŹĄ˘şÇšâĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Îžĺ
+ ¸Â¤Ď 120MHz ÄřĹ٤ޤǝČÍŃ˝ĐÍč¤Ţ¤šĄŁ
+
+ S3 964, IBM RGB 514/524/525/528 RAMDAC & ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Hercules Graphics Terminator 64
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ s3RefClk 50
+ DACspeed 170
+ Option "slow_vram"
+
+ S3 968, IBM RGB 514/524/525/528 RAMDAC & ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+
+ o Genoa Genoa VideoBlitz III AV
+
+ s3RefClk 50
+ DACspeed 170
+
+ o Hercules Graphics Terminator Pro 64
+
+ s3RefClk 16
+ DACspeed 220
+
+ ¤ł¤ÎĽŤĄźĽÉ¤Ë¤ĎźĄ¤ÎšÔ¤ňĚŔľ­¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ:
+
+ Invert_VCLK "*" 0
+
+ ¤ł¤ě¤ňłĆĄš¤Î Display ĽľĽÖĽťĽŻĽˇĽçĽó¤ËĚŔľ­¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o STB Velocity 64
+
+ s3RefClk 24
+ DACspeed 220
+
+ o Number Nine FX Motion 771
+
+ s3RefClk 16
+ DACspeed 220
+
+ ¤ł¤ÎĽŤĄźĽÉ¤Ë¤ĎźĄ¤ÎšÔ¤ňĚŔľ­¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ:
+
+ Invert_VCLK "*" 0
+
+ ¤ł¤ě¤ňłĆĄš¤Î Display ĽľĽÖĽťĽŻĽˇĽçĽó¤ËĚŔľ­¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 8/15/16/24 bpp ¤ŹÍřÍѲÄÇ˝¤Ç¤šĄŁźĄ¤Î¤č¤Ś¤ËŔßÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. 16bpp ¤Č 32bpp
+
+ ĄĘFarenheit 1280+ VLB ¤Î¤č¤Ś¤ĘĄË 801/805 ¤Č AT&T490 ¤ÎĽŤĄźĽÉ¤Ç¤Ď 15 ¤Č
+ 16bpp ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎˇĎÎó¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ç¤Ď 32bpp ¤ňťČÍѤÇ
+ ¤­¤Ţ¤ť¤óĄŁĄĘMS Windows ¤Ç¤Ď 24 ĽÓĽĂĽČĽâĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤Ţ¤š¤ŹĄ˘¤ł¤ě¤Ď
+ 32bpp ¤Îż§żô¤ňžŻ¤Ę¤Ż¤ˇ¤ż (sparse) ĽâĄźĽÉ¤Ç¤Ď¤Ę¤ŻĄ˘ËÜĹö¤Ë 3 ĽĐĽ¤ĽČ/ĽÔĽŻ
+ ĽťĽë¤ňÍѤ¤¤żĽâĄźĽÉ¤Ç¤šĄŁ¤ł¤ÎĽâĄźĽÉ¤ň XFree86 ¤ÇźÂÁő¤š¤ë¤Î¤ĎÍưפǤϤ˘
+ ¤ę¤Ţ¤ť¤óĄŁĄË
+
+ 3. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Î°ěÍ÷
+
+ ICD2061A ==> ClockChip "icd2061a"
+ ICS9161A (ICD2061A ¸ß´š) ==> ClockChip "ics9161a"
+ DCS2824-0 (Diamond, ICD2061A ¸ß´š) ==> ClockChip "dcs2824"
+
+ S3 86c708 GENDAC ==> ClockChip "s3gendac"
+ ICS5300 GENDAC (86c708 ¸ß´š) ==> ClockChip "ics5300"
+
+ S3 86c716 SDAC ==> ClockChip "s3_sdac"
+ ICS5342 GENDAC ==> ClockChip "ics5342"
+ STG 1703 ==> ClockChip "stg1703"
+
+ Sierra SC11412 ==> ClockChip "sc11412"
+ ICS2595 ==> ClockChip "ics2595"
+ TI3025 ==> ClockChip "ti3025"
+ TI3026 ==> ClockChip "ti3026"
+ IBM RGB 5xx ==> ClockChip "ibm_rgb5xx"
+
+ Chrontel 8391 ==> ClockChip "ch8391"
+
+ AT&T 20C409 ==> ClockChip "att20c409"
+ AT&T 20C499 (̤ĽĆĽšĽČ) ==> ClockChip "att20c499"
+
+ 4. ÄɲĂĂí°Őťöšŕ
+
+ ¤ł¤Î°ěÍ÷¤Ëľ­şÜ¤ľ¤ě¤Ć¤¤¤Ę¤¤ RAMDAC ¤ňťý¤Ă¤Ć¤¤¤ëžěšç¤ĎĄ˘XF86_S3 ¤ňťČÍѤš
+ ¤ëşÝ RAMDAC ¤ÎźţÇČżô¤ňžĺ¤˛˛á¤Ž¤Ę¤¤¤č¤Ś¤Ë˝˝ĘŹĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁXF86_S3 ¤Ź
+ ĽÜĄźĽÉ¤ňÄˤá¤Ę¤¤¤č¤Ś¤ËĄ˘Ŕ褺 XFree86 ĽÁĄźĽŕ¤ËłÎǧ¤ÎϢÍí¤ňźč¤Ă¤ż¤Ű¤Ś¤Ź
+ Îɤ¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ËÁ¸ą¤ˇ¤č¤Ś¤Čť×¤Ś¤Ę¤éĄ˘ĽłĽóĽÔĽĺĄźĽżĄź¤Îł¸¤ňłŤ¤ą¤Ć RAMDAC ¤ňÇÁ¤¤¤Ć¤ß¤Ć˛ź
+ ¤ľ¤¤ĄŁ RAMDAC ¤ĎÉáÄĚĽÓĽÇĽŞĽÜĄźĽÉžĺ¤ÇÂ礭¤¤ĽÁĽĂĽ×ĄĘŁ˛ČÖĚܤŤŁłČÖĚܤËÂ礭
+ ¤¤ĽÁĽĂĽ×¤Ď EPROM ¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄË¤Ç¤šĄŁÄ̞異¤˝¤ł¤Ë¤ĎźĄ¤Î¤č¤Ś¤Ë˝ń¤Ť¤ě
+ ¤Ć¤¤¤Ţ¤šĄŁ
+
+ <˛ńźŇ¤ÎĽíĽ´>
+
+ <˛ńźŇ¤ÎźąĘĚťŇ><ÉôÉĘČÖšć>-<źţÇČżô¤ÎžĘÎŹˇÁ>
+ <Ŕ˝Â¤˝ľ><Ŕ˝Â¤ÇŻ>
+ <ĽíĽĂĽČČÖšć><¤˝¤Îž¤Î°ŐĚŁÉÔĚŔ¤Ężôťú>
+
+ Î㤨¤Đ:
+
+ @@
+ @@ AT&T
+
+ ATT20C490-11
+ 9339S ES
+ 9869874
+
+ ¤ł¤ě¤ĎĆ°şîźţÇČżô 110 MHz ¤Î AT&T 20C490 ¤Ç¤šĄŁ¤ł¤Îťö¤Ď XF86Config ĽŐĽĄ
+ Ľ¤Ľë¤Ë `DacSpeed 110' ¤Čľ­Ćţ¤š¤ë¤ł¤Č¤ňťŘ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ´ö¤Ä¤Ť¤Î RAMDAC ¤Ď
+ ¤˝¤ě¤ž¤ě¤ÎĽâĄźĽÉ¤Ë¤č¤Ă¤Ć°Ű¤Ę¤ëźţÇČżô¤Îžĺ¸Â¤ňťý¤Ă¤Ć¤¤¤ëťö¤ňÎɤŻšÍ¤¨¤Ć˛ź
+ ¤ľ¤¤ĄŁŔ˝Â¤˛ńźŇ¤Ď¤¤¤Ä¤â¤˝¤ÎĽÁĽĂĽ×¤Îťý¤Ć¤ëşÇšâŔ­Ç˝¤ÎźţÇČżô¤ňĚžÁ°¤ËÉŐ¤ą¤ë
+ ¤Î¤ÇĄ˘˝˝ĘŹĂí°Ő¤ˇ¤Ć˛ź¤ľ¤¤ĄŁS3 ĽľĄźĽĐ¤ĎŔľ¤ˇ¤ŻťŘÄꤾ¤ě¤ż DacSpeed ¤ÎĂͤň
+ ÍѤ¤¤ĆËؤɤΠRAMDAC ¤ÎźţÇČżô¤Îžĺ¸Â¤ň¤É¤Î¤č¤Ś¤Ë°ˇ¤¨¤ĐÎɤ¤¤Ť¤ňĂΤäƤ¤¤Ţ
+ ¤šĄŁ
+
+ chips labeled -80 or -8 should use `DacSpeed 80' in the device
+ section ĽÁĽĂĽ×¤Ë -80 ¤Ţ¤ż¤Ď -8 ¤Č¤ŤÉŐ¤¤¤Ć¤¤¤ż¤éĄ˘ĽÇĽĐĽ¤ĽšŔá¤Ë
+ `DacSpeed 80' ¤ČĚŔľ­¤š¤ë¤Ů¤­¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ S3 86C716-ME SDAC ==> DacSpeed 110
+ SC15025-8 ==> DacSpeed 80
+ ATT20C490-80 ==> DacSpeed 80
+
+ IBM 8190429 ==> DacSpeed 170
+ IBM 03H5428 ==> DacSpeed 170
+ IBM 03H6447 ==> DacSpeed 170
+ IBM 03H6448 ==> DacSpeed 220
+ IBM 03H5319 ==> DacSpeed 220
+ IBM 63G9902 ==> DacSpeed 250
+
+ IBM 37RGB514CF17 ==> DacSpeed 170
+ IBM 37RGB524CF22 ==> DacSpeed 220
+ ^^
+
+ ĄĘTi3025 ¤Î¤č¤Ś¤ĘĄË´ö¤Ä¤Ť¤Î RAMDAC ¤ĎĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ŹŔľ¤ˇ¤ŻĆ°şî
+ ¤š¤ë¤č¤Ś¤Ë´ö¤Ä¤Ť¤ÎĽâĄźĽÉ¤ÎÄ´Ŕ°¤ËÇŰθ¤ŹÉŹÍפǤšĄŁTi3025 ¤ĎşÇÄă 80 ĽÔĽŻ
+ ĽťĽëĘŹ¤Î͞;¤ŹÉŹÍפǤšĄŁŔßÄꤏÎɤŻ¤Ę¤Ť¤Ă¤ż¤Č¤­¤ÎžÉžő¤Ď˛čĚ̤ιŚĂź¤Ëśá¤¤
+ ¤Č¤ł¤í¤ŘĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňśáÉŐ¤ą¤ë¤ČžĂ¤¨¤ë¤č¤Ś¤Ë¤Ę¤ë¤ł¤Č¤Ç¤šĄŁ
+
+ 5. IBM RGB 5xx RAMDAC ¤ÎĽŻĽíĽĂĽŻĂͤňť˛žČ¤š¤ë¤Ë¤Ď
+
+ IBM RGB5xx RAMDAC ¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëĽŤĄźĽÉ¤ĎĄ˘ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ÎĽŻĽíĽĂĽŻ¤Îžđ
+ Ęó¤ň˝ü¤¤¤ĆĂľşş¤š¤ë¤ł¤Č¤Ź˝ĐÍč¤Ę¤¤ĽŻĽíĽĂĽŻĽˇĽóĽťĽľĽ¤ĽśĄź¤Ë¤¤¤Ż¤Ä¤Ť°Ű¤Ę¤ë
+ źţÇČżô¤ňÍż¤¨¤ĆĆ°şî¤ˇ¤Ţ¤šĄĘɸ˝ŕ¤Ç¤Ę¤¤ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤Ë´Ö
+ °ă¤Ă¤ż˛žÄę¤ň¤š¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄËĄŁźĄ¤ËĆţÎĎźţÇČżô¤ňĂľ¤šźę˝ç¤ňź¨¤ˇ¤Ţ
+ ¤šĄŁ:
+
+ Ŕ褺źĄ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ X -probeonly >& outfile
+
+ ¤˝¤ˇ¤ĆĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ÎĂľşşˇë˛Ě¤Î outfile ¤ËźĄ¤Î¤č¤Ś¤Ë¤Ę¤Ă¤Ć¤¤¤ëťö¤ňłÎ
+ ǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ:
+
+ (--) S3: Using IBM RGB52x programmable clock (MCLK 66.000 MHz)
+ (--) S3: with refclock 16.000 MHz (probed 15.952 & 16.041)
+ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
+
+ ťČÍѤš¤ëźţÇČżô¤Čłç¸Ě¤ÎĂć¤ÎĆó¤Ä¤ÎĂľşş¤ˇ¤żźţÇČżô¤Ď 25MHz ¤Č 28MHz ¤ÎĽĆĽ­
+ ĽšĽČĽâĄźĽÉ¤ÎĽŻĽíĽĂĽŻ¤ň´đ˝ŕ¤Č¤ˇ¤ż "Îɤ¤Í˝ÁۤÎ" ĂͤǤˇ¤ç¤ŚĄŁÉáÄ̤Π80x25
+ ¤Ţ¤ż¤Ď 80x28 ¤ÎĽĆĽ­ĽšĽČĽâĄźĽÉ¤ÇźÂšÔ¤ˇ¤żžěšç¤Î¤ßĄ˘¤ł¤ÎĂľşş¤ĎĆ°şî˛ÄÇ˝¤Ç
+ ¤šĄŞĄŁ
+
+ ť˛žČźţÇČżô¤ÎĂͤĎÂçÂÎźĄ¤Î¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤š:
+
+ STB Velocity 64 24 Mhz
+ Genoa VideoBlitz II AV 50 MHz
+ Hercules S3 964 50 MHz
+ Hercules S3 968 16 MHz
+ #9 Motion 771 16 MHz
+
+ ¤ł¤ě¤é¤ÎĂͤϼŤĄźĽÉ¤Îżĺž˝ČŻżśťŇ¤Č¿ʏ Genoa ĽŤĄźĽÉ¤ËĹëşÜ¤ľ¤ě¤Ć¤¤¤ë
+ ĄĘ14.3 MHz ¤ÎĄËÄɲüŻĽíĽĂĽŻĽÁĽĂĽ×Ĺů¤ÎÍͤĘž¤ÎľĄÇ˝¤Ë°Í¸¤ˇ¤Ţ¤šĄŁ
+
+ 16MHz ¤ÎĽŤĄźĽÉ¤Ź 50MHz ¤ňźÂşÝ¤ËťČ¤Śťö¤Ë¤Ę¤ë¤Î¤ĎĄ˘Á´¤Ć¤ÎĽÔĽŻĽťĽëĽŻĽíĽĂ
+ ĽŻ¤ĎĽŤĄźĽÉ¤ÎźţÇČżô¤Îť°Çܤˤʤ뤍¤é¤Ç 25MHz ¤Î 640x480 ĽâĄźĽÉ¤Ç¤Ď 75MHz
+ ¤ÎĽÔĽŻĽťĽëĽŻĽíĽĂĽŻ¤Ë¤Ę¤ę¤Ţ¤š¤Î¤Ç˝˝ĘŹĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ŕľ¤ˇ¤¤ť˛žČźţÇČżô¤Ź¸Ť¤Ä¤Ť¤Ă¤ż¤éĄ˘ŔßÄęĽŐĽĄĽ¤ĽëĄĘ¤Î device Ŕá¤ËĄË¤ËĆţ¤ě¤Ţ
+ ¤ˇ¤ç¤ŚĄŁÎ㤨¤ĐźĄ¤Î¤č¤Ś¤ËĆţ¤ě¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ s3RefClk 16
+
+ ¤Ţ¤ż¤Ď
+
+ s3RefClk 50
+
+ ¤ł¤ÎĂͤˤĤ¤¤ĆĄ˘Âž¤ÎĽĆĽ­ĽšĽČĽâĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤ĆĂľşş¤ËźşÇÔ¤ˇ¤Ć¤¤¤ë¤Č¤­
+ ¤ĎĄ˘¤ł¤Î¸Â¤ę¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŞĄŁ
+
+ 6. Ľ°ĽéĽŐĽŁĽĂĽŻ˛čĚĚÁŕşîťţĄ˘``Ŕ㤏šß¤ë'' ¸˝žÝ¤Î˛óČňşö
+
+ S3 Vision864 ĽÁĽĂĽ×ĹëşÜ¤ÎĽŤĄźĽÉ¤Ç¤ĎĄ˘ĽÔĽŻĽťĽëĽŻĽíĽĂĽŻ¤Č S3 ĽÁĽĂĽ×¤ňÁŕ
+ şî¤š¤ëĽáĽâĽęĽŻĽíĽĂĽŻ MCLK ¤Ë°Í¸¤ˇ¤żźŤĆ°ÄűŔľľĄÇ˝¤Ź¤˘¤ę¤Ţ¤šĄŁËؤɤμŻ
+ ĽíĽĂĽŻĽÁĽĂĽ×¤Ç¤ĎĽŻĽíĽĂĽŻ¤ÎĆɤ߽Фˇ¤Ď˝ĐÍč¤Ţ¤ť¤óĄĘŔΤŤ¤é S3 SDAC ¤Ŕ¤ą¤Ď
+ ĽáĽâĽęĽŻĽíĽĂĽŻ¤ÎĂͤňĆɤ߽Фť¤Ţ¤ˇ¤żĄË¤Î¤ÇĄ˘¤ł¤ÎĂͤϿäÄꤚ¤ë¤ŤĽćĄźĽśĄź¤Ź
+ ťŘÄꤡ¤Ć¤¤¤Ţ¤ˇ¤żĄĘ˝é´üĂÍ¤Ď 60 [MHz]ĄËĄŁ
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Řżˇ¤ˇ¤¤ `s3MCLK' ¤ÎŔßÄę¤ň¤š¤ë¤Ę¤éĄ˘źĄ¤ÎÎă¤Î¤č¤Ś¤Ë
+ ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ With the new `s3MCLK' entry for your XF86Config file now
+ you can specify e.g.
+
+ s3MCLK 55
+
+ 55 MHz ¤ËĽáĽâĽęĽŻĽíĽĂĽŻ¤ňŔßÄꤚ¤ë¤ČŔă¤ÎÎ̤Ź¸ş¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤č¤ęžŽ¤ľ¤¤Ľá
+ ĽâĽęĽŻĽíĽĂĽŻ¤ĎŔ­Ç˝¤ňźă´łÍî¤Č¤ˇ¤Ţ¤š¤Î¤ÇĄ˘Ä㤚¤Ž¤ëĂͤϝČÍѤˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤
+ ĄĘËؤɤΞěšç 55 ¤Ť 50 ÄřĹ٤ÎĂͤŹÎɤ¤¤Čť×¤¤¤Ţ¤šĄËĄŁ
+
+ źĄ¤ĎĽáĽâĽęĽŻĽíĽĂĽŻ¤ÎłľťťĂÍĄĘĚó +/- 1 ¤Ť¤é 2 MHz ¤Î¸íşš¤Ź¤˘¤ę¤Ţ¤šĄË¤ňˇč
+ ¤á¤ë¤Î¤ËÍ­¸ú¤ĘžŽ¤ľ¤ĘĽˇĽ§ĽëĽšĽŻĽęĽ×ĽČ¤Ç¤šĄŁ¤ł¤ÎĽšĽŻĽęĽ×ĽČ¤ňźÂšÔ¤š¤ëÁ°¤Ë
+ źĄ¤ÎšÔ
+
+ s3MNadjust -31 255
+
+ ¤ň XF86Config ĽŐĽĄĽ¤Ľë¤ÎĽÇĽĐĽ¤ĽšŔá¤ËÄɲäˇ X ĽŚĽŁĽóĽÉĽŚ¤ňşĆťĎĆ°¤š¤ëÉŹ
+ ÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ÎĄĘĽĆĽšĽČ¤ČĽÇĽĐĽĂĽ°ŔěÍŃ¤ÎĄËĽŞĽ×ĽˇĽçĽó¤ÇČáť´¤ĘÉ˝ź¨¤Î¤Á
+ ¤é¤Ä¤­¤ČšßŔă¤ňÂôťł¸Ť¤ë¤Ç¤ˇ¤ç¤Ś¤ŹĄ˘°Ęšß¤ÎĽĆĽšĽČĽšĽŻĽęĽ×ĽČ¤ňźÂšÔ¤š¤ě¤ĐÄž
+ ¤Á¤ËşĆ¤Óźč¤ę˝ü¤Ż¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ ¤ł¤ÎĽšĽŻĽęĽ×ĽČ¤Ď xbench ¤Ť¤Ä/Ëô¤Ď x11perf ¤ňźÂšÔ¤ˇ¤ĆĽáĽâĽęĽŻĽíĽĂĽŻ ¤ň
+ MHz Ăą°Ě¤ÇÉ˝ź¨¤ˇˇčÄꤚ¤ë¸Ąşş¤ňšÔ¤¤¤Ţ¤šĄŁ4 ¤Ä°Ęžĺ¤ÎĽĆĽšĽČ¤ňźÂšÔ¤ˇ¤ż
+ ¤éĄ˘4 ¤Ä°Ęžĺ¤ÎżäÄęĂͥʺǽé¤ÎżäÄęĂͤŹ°ěČÖŔľłÎ¤Ç¤ˇ¤ç¤ŚĄË¤ň¸Ť¤ë¤ł¤Č¤Ź˝ĐÍč
+ ¤Ţ¤šĄŁ
+
+ ______________________________________________________________________
+ #!/bin/sh
+
+ exec 2> /dev/null
+
+ scale=2
+
+ calc() {
+ m=`awk 'BEGIN{printf "%.'$scale'f\n",'"( $1 + $2 ) / $3; exit}" `
+ [ -z "$m" ] && m=` echo "scale=$scale; ( $1 + $2 ) / $3" | bc `
+ [ -z "$m" ] && m=` echo "$scale $1 $2 + $3 / pq" | dc `
+ echo $m
+ }
+
+ run_xbench() {
+ r=` ( echo 1; echo 2; echo 3; echo 4 ) | xbench -only $1 | grep rate `
+ [ -z "$r" ] && return
+ cp="$2 $3"
+ set $r
+ calc $3 $cp
+ }
+
+ run_x11perf() {
+ r=` x11perf $1 | grep trep | tr '(/)' ' ' `
+ [ -z "$r" ] && return
+ cp="$2 $3"
+ set $r
+ calc `calc 1000 0 $4` $cp
+ }
+
+ run_x11perf "-rect500 -rop GXxor" 3.86 5.53 # 0 1 # 4.11 5.52 #
+ run_xbench invrects500 4.63 5.48 # 0 1 # 4.69 5.48 #
+
+ run_x11perf "-rect500 -rop GXcopy" -16.42 13.90 # 0 1 # -14.99 13.88 #
+ run_xbench fillrects500 -7.81 13.57 # 0 1 # -8.53 13.58 #
+
+ exit
+ ______________________________________________________________________
+
+ $XConsortium: S3.sgml,v 1.6 95/01/27 16:14:30 kaleb Exp $
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml,v 3.25 1995/07/24 11:17:14 dawes Exp
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/ doc/sgml/S3.sgml,v 3.26
+ 1995/07/30 04:15:58 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.1.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź
+ ¤Ş¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹ
+ ťŇĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę
+ ¤Ţ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š
+ ¤ŹĄ˘¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/S3.sgml,v 3.4 1995/09/16 08:31:55 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.ati b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.ati
new file mode 100644
index 000000000..b7c551f14
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.ati
@@ -0,0 +1,285 @@
+ ATI Ľ˘ĽŔĽ×Ľż¤Î README
+ Marc Aurele La France Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 3 ˇî 23 Ćü
+
+ ËÜ˝ń¤Ď XF86_Mono, XF86_VGA16 ¤Č XF86_SVGA ĽľĄźĽĐ¤ÇťČÍѤˇ¤Ć¤¤¤ë XFree86
+ ATI VGA ĽÉĽéĽ¤ĽĐ¤Ë´Ř¤š¤ë README ¤Ç¤šĄŁ Mach8, Mach32 źă¤Ż¤Ď Mach64 Ľ˘
+ ĽŻĽťĽéĽěĄźĽż¤ŹĹëşÜ¤ľ¤ě¤Ć¤¤¤ë ATI Ľ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤ÎťČÍџԤϼ˘ĽŻĽťĽé
+ ĽěĄźĽżĽľĄźĽĐ (XF86_Mach8,XF86_Mach32 źă¤Ż¤Ď XF86_Mach64) ¤ňťČÍѤš¤ë¤Ů
+ ¤­¤Ç¤šĄŁČ󼢼ŻĽťĽéĽěĄźĽżĽľĄźĽĐ (XF86_Mono, XF86_VGA16 ¤Č XF86_SVGA) ¤â
+ ˛ÔĆŻ¤ˇ¤Ţ¤š¤ŹĄ˘¤˝¤ÎÇ˝ÎϤňŔ¸¤Ť¤ˇŔÚ¤ě¤Ţ¤ť¤óĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. ATI VGA ĽÉĽéĽ¤ĽĐ¤Č¤Ď˛ż¤Ť ?
+
+ 2. ATI VGA Wonder ĽÉĽéĽ¤ĽĐ ¤Ç¤Ď *˝ĐÍč¤Ę¤¤ťö* ¤Ď˛ż¤ŤĄŠ
+
+ 3. ¤É¤Î¤č¤Ś¤ĘĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ÇĽÉĽéĽ¤ĽĐ¤ŹĆ°şî¤š¤ë¤ŤĄŠ
+
+ 4. XF86Config ĽŐĽĄĽ¤Ľë¤Ë˛ż¤ň˝ń¤¤¤ż¤éÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŠ
+
+ 5. ĽÉĽéĽ¤ĽĐ¤ÎÍúÎň¤ĎĄŠ
+
+ 6. źďĄš¤ÎĂí°Őťöšŕ
+ ______________________________________________________________________
+
+ 1. ATI VGA ĽÉĽéĽ¤ĽĐ¤Č¤Ď˛ż¤Ť ?
+
+ ATI VGA ĽÉĽéĽ¤ĽĐ¤Ď XFree86 ÍѤΠ256 ż§, 16 ż§¤ČÇňšő¤ÎĽÉĽéĽ¤ĽĐ¤Ç¤šĄŁ¤ł
+ ¤ÎĽÉĽéĽ¤ĽĐ¤Ď SuperVGA ¤Č¤ˇ¤ĆĆŻ¤Ť¤Ę¤¤¤â¤Î(¤¤¤Ż¤Ä¤Ť¤Î˝é´ü¤Î Mach8 ¤Č
+ Mach32 Ľ˘ĽŔĽ×Ľż) ¤ň˝ü¤¤¤żÁ´¤Ć¤Î ATI ĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁźĄ
+ ¤Î¤Ş¤Ş¤č¤˝¤Î (x/y = (1 + sqrt(5))/2 ¤Ę¤ë˛ŤśâĘŹłäČć¤ň´đ¤Ë¤ˇ¤ż) şÇÂç˛ňÁü
+ Ĺ٤ϼܥźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤ëťČÍѲÄÇ˝¤ĘĽÓĽÇĽŞĽáĽâĽęĄĘ¤ČĽâĽËĽżĄź¤ÎÇ˝Îϥˤ˰Í
+ ¸¤ˇ¤Ţ¤šĄŁ:
+
+ 256k 640x409x256 896x585x16
+ 512k 896x585x256 1280x819x16
+ 1M 1280x819x256 1824x1149x16
+
+ ÇňšőĽľĄźĽĐ¤ĎťČÍѲÄÇ˝¤ĘĽÓĽÇĽŞĽáĽâĽę¤ÎşÇÂç¤Î 1/4 ¤ňťČÍѤš¤ë¤Î¤ÇĄ˘Çňšő¤Ç
+ ¤ÎşÇÂç˛ňÁüĹŮ¤Ď 16 ż§ĽâĄźĽÉ¤ČĆą¤¸¤Ę¤Î¤Ç¤šĄŁ
+
+ 2. ATI VGA Wonder ĽÉĽéĽ¤ĽĐ ¤Ç¤Ď *˝ĐÍč¤Ę¤¤ťö* ¤Ď˛ż¤ŤĄŠ
+
+ ¤ł¤ÎĽÉĽéĽ¤ĽĐ¤ĎĽÔĽŻĽťĽë¤˘¤ż¤ę 8 ĽÓĽĂĽČ°Ęžĺ¤Îżź¤ľ¤ň̤¤ŔĽľĽÝĄźĽČ¤ˇ¤Ć¤Ţ¤ť
+ ¤óĄŁ¤Şźę¸ľ¤ÎĽŢĽËĽĺĽ˘Ľë¤ËĽ°ĽéĽŐĽŁĽĂĽŻĽ˘ĽŔĽ×Ľż¤Ź 256 ż§°Ęžĺ¤ÎĽâĄźĽÉ¤ňĽľ
+ ĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë¤Čľ­şÜ¤Ź¤˘¤Ă¤Ć¤âĄ˘ATI VGA Wonder ĽÉĽéĽ¤ĽĐ¤Ź 256 ż§°Ęžĺ¤Î
+ ĽâĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤Ę¤¤¤Î¤Ç¤šĄŁ
+
+ ATI VGA ĽÉĽéĽ¤ĽĐ¤ĎĽ˘ĽŻĽťĽéĽěĄźĽżĽÉĽéĽ¤ĽĐ¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤Şźę¸ľ¤ÎĽÉĽéĽ¤
+ ĽĐ¤Ź Mach8, Mach32 ¤Ţ¤ż¤Ď Mach64 ĽÓĽÇĽŞĽłĽóĽČĽíĄźĽé¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëžě
+ šçĄ˘ĽÉĽéĽ¤ĽĐ¤ĎĽ°ĽéĽŐĽŁĽĂĽŻĽÜĄźĽÉ¤ÎĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ňťČÍѤˇ¤Ţ¤ť¤óĄŁ
+ (Mach32 ÍŃ¤Č Mach64 ÍѤμ˘ĽŻĽťĽéĽěĄźĽż¤ËĹýšç¤ľ¤ě¤Ć¤¤¤ë) ĽÉĽéĽ¤ĽĐ¤Ď VGA
+ ĽÜĄźĽÉ¤Ŕ¤ą¤ňťČÍѤˇ¤Ţ¤šĄŁ¤ł¤ÎÎă¤ĎĘŹ¤Ť¤ę¤Ë¤Ż¤¤¤Ç¤š¤ŹĄ˘˛ż¤Č¤ŤĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ 3. ¤É¤Î¤č¤Ś¤ĘĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ÇĽÉĽéĽ¤ĽĐ¤ŹĆ°şî¤š¤ë¤ŤĄŠ
+
+ źĄ¤Î ATI ĽÓĽÇĽŞĽłĽóĽČĽíĄźĽéĽÁĽĂĽ×¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë¤Ű¤Č¤ó¤É¤ÎĽÉĽéĽ¤ĽĐ¤Ç¤ł
+ ¤ÎĽÉĽéĽ¤ĽĐ¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ VGA Wonder ˇĎÎó: 18800, 18800-1, 28800-2, 28800-4, 28800-5, 28800-6
+ Mach32 ˇĎÎó: 68800-3, 68800-6, 68800AX, 68800LX
+ Mach64 ˇĎÎó: 88800GX-C, 88800GX-D, 88800GX-E, 88800GX-F, 88800CX,
+ 264CT, 264ET, 264VT, 264VT2, 264GT
+
+ 264xT ĽˇĽęĄźĽş¤ĎĆ⢠RAMDAC ¤ČĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë¤Î¤ÇĹý
+ šçĽłĽóĽČĽíĄźĽé¤Ç¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î˝é´üˇż¤Î Mach32 Ľ˘ĽŔĽ×Ľż¤Ź¤ł¤ÎĽÉĽéĽ¤ĽĐ¤Ç
+ Ć°şî¤ˇ¤Ę¤¤¤Î¤ĎĄ˘VGA ľĄÇ˝¤ňťý¤Ă¤Ć¤¤¤Ę¤¤¤Ť¤é¤Ç¤šĄŁ¤Ţ¤żĆąÍͤÎÍýÍł¤ÇĄ˘ VGA
+ Wonder ˇĎÎ󤍤éĽÓĽÇĽŞĽłĽóĽČĽíĄźĽé¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëĽÜĄźĽÉĄĘ¤Ţ¤ż¤Ď VGA ĽŃĽš
+ ĽšĽëĄźĽłĽÍĽŻĽż¤Ť¤éŔÜÂł¤š¤ëžěšçĄË¤ň˝ü¤¤¤Ć˝é´üˇż¤Î Mach8 Ľ˘ĽŔĽ×Ľż¤âĆ°şî
+ ¤ˇ¤Ţ¤ť¤óĄŁ
+
+ ¤ł¤ě¤é¤ÎĽ˘ĽŔĽ×Ľż¤Ç¤ĎÍÍĄš¤ĘĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤Č RAMDAC ¤ŹťČÍѲÄÇ˝¤Ç
+ ¤šĄŁžÜşŮ¤Ď°Ęšß¤Î XF86Config ¤ÎŔá¤ň¤´Í÷¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤é¤ÎĽ˘ĽŔĽ×Ľż¤ĎĽŢĽŚ
+ Ľš¤Ź¤˘¤Ă¤Ć¤â¤Ę¤Ż¤Ć¤âťČÍѲÄÇ˝¤Ç¤šĄŁ VGA Wonder V3 Ľ˘ĽŔĽ×Ľż¤Ď 18800 ĽÓĽÇ
+ ĽŞĽłĽóĽČĽíĄźĽé¤ňĹëşÜ¤ˇĄ˘żĺž˝ČŻżśťŇ¤Ë¤č¤Ă¤ĆĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňŔ¸ŔŽ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ VGA Wonder V4 Ľ˘ĽŔĽ×Ľż¤Ď 18800-1 ¤Č¤ł¤Á¤é¤âżĺž˝ČŻżśťŇ¤ňĹëşÜ¤ˇ¤Ć¤¤
+ ¤Ţ¤šĄŁ VGA Wonder V5 Ľ˘ĽŔĽ×Ľż¤â¤Ţ¤ż 18800-1 ¤ňĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘18810
+ ĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ VGA Wonder+ Ľ˘ĽŔĽ×Ľż¤Ď 28800-2
+ ¤Č 18810 ¤ňĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤˝¤Îž¤Î ATI ¤ÎĽ˘ĽŔĽ×Ľż¤ÎĚžžÎ¤Îˇč¤áĘý¤Î´ˇ˝Ź
+ ĄĘŔΤŤ¤é¤˘¤Ă¤ż¤â¤ÎĄË¤Ç¤ĎĚžÁ°¤Î°ěÉôĘŹ¤ňžĘÎŹ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ VGA Wonder ˇĎÎó¤Ď¤Ţ¤żĄ˘ATI ¤Î OEM Ŕ褍¤é VGA1024 ¤Č¤¤¤ŚĚžžÎ¤ÇČŻÇ䤡¤Ć
+ ¤¤¤Ţ¤šĄŁ˝ž¤Ă¤ĆĄ˘ATI VGA ĽÉĽéĽ¤ĽĐ¤Ď VGA1024, VGA1024D, VGA1024XL,
+ VGA1024DXL ¤Č VGA1024VLB ĽÜĄźĽÉ¤ä¤˝¤ÎÎŕ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 4. XF86Config ĽŐĽĄĽ¤Ľë¤Ë˛ż¤ň˝ń¤¤¤ż¤éÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŠ
+
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤Źš˝ŔŽ¤ňźŤĆ°¸Ą˝Đ¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤ÎĽÉĽéĽ¤ĽĐ¤Ç¤ÎĽÁĽĂĽ×ĽťĽĂĽČ
+ ¤ÎĚžžÎ¤Ď "ati" ¤Ç¤šĄŁ¤Ţ¤żĄ˘ĽÉĽéĽ¤ĽĐ¤Ď "vgawonder", "mach8", "mach32"
+ ¤Č "mach64" ¤Î¤č¤Ś¤ĘĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĚžžÎ¤Ç¤âǧźą¤Ç¤­¤Ţ¤šĄŁ¤ł¤ÎĽĐĄźĽ¸ĽçĽó
+ ¤ÎĽÉĽéĽ¤ĽĐ¤Ç¤Ď¤š¤Ů¤Ć¤ÎĚžžÎ¤ĎĆąĹů¤Ç¤šĄŁž­Íč¤ÎĽĐĄźĽ¸ĽçĽó¤Ç¤˝¤ě¤ž¤ě¤ÎĚžžÎ
+ ¤Ď°Ű¤Ę¤Ă¤ż°ŐĚŁ¤ňťý¤Ä¤ł¤Č¤ň¤˝¤Î¤Č¤­Ę¸˝ń˛˝¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Á´¤Ć¤ÎĽ˘ĽŔĽ×Ľż¤ÇĄ˘źĄ¤ÎĆâ¤Î°ě¤Ä¤ÎĽŻĽíĽĂĽŻĄĘ¤Ţ¤ż¤Ď¤˝¤ě¤é¤ÎşÇ˝é¤ÎÉôĘŹĄË¤Î
+ ŔßÄę¤ĎĽ˘ĽŔĽ×Ľż¤ŹŔ¸ŔŽ¤š¤ëĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ë°Í¸¤ˇ¤ż¤â¤Î¤Ë¤Ę¤ę¤Ţ¤šĄŁ:
+
+ żĺž˝ČŻżśťŇ (VGA Wonder V3 ¤Č V4 Ľ˘ĽŔĽ×Ľż ¤Î¤ß):
+
+ Clocks 50.000 56.644 0.000 44.900 44.900 50.000 0.000 36.000
+ 25.000 28.322 0.000 22.450 22.450 25.000 0.000 18.000
+ 16.667 18.881 0.000 14.967 14.967 16.667 0.000 12.000
+ 12.500 14.161 0.000 11.225 11.225 12.500 0.000 9.000
+
+ ATI 18810 ĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż:
+
+ Clocks 30.240 32.000 37.500 39.000 42.954 48.771 0.000 36.000
+ 40.000 56.644 75.000 65.000 50.350 56.640 0.000 44.900
+ 15.120 16.000 18.750 19.500 21.477 24.386 0.000 18.000
+ 20.000 28.322 37.500 32.500 25.175 28.320 0.000 22.450
+ 10.080 10.667 12.500 13.000 14.318 16.257 0.000 12.000
+ 13.333 18.881 25.000 21.667 16.783 18.880 0.000 14.967
+ 7.560 8.000 9.375 9.750 10.739 12.193 0.000 9.000
+ 10.000 14.161 18.750 16.250 12.586 14.160 0.000 11.225
+
+ ATI 18811-0 ¤Č ATI 18812-0 ĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż:
+
+ Clocks 30.240 32.000 110.000 80.000 42.954 48.771 92.400 36.000
+ 39.910 44.900 75.000 65.000 50.350 56.640 0.000 44.900
+ 15.120 16.000 55.000 40.000 21.477 24.386 46.200 18.000
+ 19.955 22.450 37.500 32.500 25.175 28.320 0.000 22.450
+ 10.080 10.667 36.667 26.667 14.318 16.257 30.800 12.000
+ 13.303 14.967 25.000 21.667 16.783 18.880 0.000 14.967
+ 7.560 8.000 27.500 20.000 10.739 12.193 23.100 9.000
+ 9.978 11.225 18.750 16.250 12.588 14.160 0.000 11.225
+
+ ATI 18811-1 ¤Č ATI 18811-2 ĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż:
+
+ Clocks 135.000 32.000 110.000 80.000 100.000 126.000 92.400 36.000
+ 39.910 44.900 75.000 65.000 50.350 56.640 0.000 44.900
+ 67.500 16.000 55.000 40.000 50.000 63.000 46.200 18.000
+ 19.955 22.450 37.500 32.500 25.175 28.320 0.000 22.450
+ 45.000 10.667 36.667 26.667 33.333 42.000 30.800 12.000
+ 13.303 14.967 25.000 21.667 16.783 18.880 0.000 14.967
+ 33.750 8.000 27.500 20.000 25.000 31.500 23.100 9.000
+ 9.978 11.225 18.750 16.250 12.588 14.160 0.000 11.225
+
+ Mach32 ¤Č Mach64 ¤ňťý¤Ă¤Ć¤¤¤ëżÍ¤ĎşÇ˝é¤Î 32 ¸Ä¤ÎźţÇČżô¤Ŕ¤ą¤ňťŘÄꤡ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ şÇ¤â¸Ĺ¤¤ Mach64 Ľ˘ĽŔĽ×Ľż¤Ďžĺľ­¤ÎĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ÎĆâ¤Î°ě¤Ä¤ňťČ¤Ă¤Ć
+ ¤¤¤Ţ¤šĄŁ¤Ţ¤żĄ˘Mach64 Ľ˘ĽŔĽ×Ľż¤ĎĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ň
+ ťČ¤Ă¤Ć¤¤¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁĽÖĄźĽČťţ¤ËĄ˘ĽÓĽÇĽŞ BIOS ¤Î˝é´ü˛˝¤ĎźţÇČżô¤Î
+ şÇ˝é¤ÎŔßÄęĂͤňÁȤߚţ¤ß¤Ţ¤šĄŁĽâĄźĽÉ¤ňŔßÄꤚ¤ëŁ˛¤Ä¤ÎźţÇČżô¤Ď¤ł¤ÎşÇ˝é¤ÎŔß
+ ÄęĂͤǝȤď¤Ę¤¤¤č¤Ś¤ËÍ˝Ě󤡤Ƥ˘¤ę¤Ţ¤šĄŁÍ˝Ě󤡤żĆâ¤Î°ě¤Ä¤Ď BIOS ĽâĄźĽÉŔß
+ Äę¤ÇťČÍѤˇĄ˘ťÄ¤ę¤ĎĆĂÄę¤Î (MS-Windows, AutoCAD, X, Ĺů) ĽÉĽéĽ¤ĽĐ¤ŹťČÍѤˇ
+ ¤Ţ¤šĄŁ¤ł¤ÎĘýËĄ¤ÇÍ˝Ě󤡤Ƥ¤¤ëĽŻĽíĽĂĽŻ¤ÎżôĂͤϼ˘ĽŔĽ×Ľż¤ÇťČ¤ŚĆĂÄę¤ÎĽŻĽíĽĂ
+ ĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤Ë°Í¸¤ˇ¤Ţ¤šĄŁ
+
+ ĽÉĽéĽ¤ĽĐ¤ŹĽ˘ĽŔĽ×Ľż¤ÎĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę¤¤žěšçĄ˘źĄ¤Î
+ ŔßÄęĂͤÎĂ植¤éĹŹšç¤š¤ëĽŻĽíĽĂĽŻ¤ňÁޤó¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎĹŹšçşîśČ¤Ď
+ XF86Config ĽŐĽĄĽ¤Ľë¤ËĽŻĽíĽĂĽŻ¤ňŔßÄꤡ¤Ć¤â¤ˇ¤Ę¤Ż¤Ć¤âČŻŔ¸¤ˇ¤Ţ¤šĄŁ
+
+ BIOS ¤ÎŔßÄę 1:
+
+ Clocks 0.000 110.000 126.000 135.000 50.350 56.640 63.000 72.000
+ 0.000 80.000 75.000 65.000 40.000 44.900 49.500 50.000
+ 0.000 55.000 63.000 67.500 25.180 28.320 31.500 36.000
+ 0.000 40.000 37.500 32.500 20.000 22.450 24.750 25.000
+
+ BIOS ¤ÎŔßÄę 2:
+
+ Clocks 0.000 110.000 126.000 135.000 25.180 28.320 31.500 36.000
+ 0.000 80.000 75.000 65.000 40.000 44.900 49.500 50.000
+ 0.000 55.000 63.000 67.500 12.590 14.160 15.750 18.000
+ 0.000 40.000 37.500 32.500 20.000 22.450 24.750 25.000
+
+ BIOS ¤ÎŔßÄę 3:
+
+ Clocks 0.000 0.000 0.000 0.000 25.180 28.320 0.000 0.000
+ 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
+ 0.000 0.000 0.000 0.000 12.590 14.160 0.000 0.000
+ 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
+
+ ĽÉĽéĽ¤ĽĐ¤Źžĺ¤ÎŁłČÖĚܤÎŔßÄę¤Č°ěĂפˇ¤żžěšç¤Ď(ĽÉĽéĽ¤ĽĐ¤Ź´°Á´¤ËĆ°şî¤š¤ë¤Ë
+ ¤Ď) ľĄÇ˝ĹŞ¤Ë *¤Č¤Ć¤â* ¸ÂÄꤾ¤ě¤Ţ¤šĄŁ ATI Ľ˘ĽŔĽ×ĽżĄĘ¤Č¤˝¤ÎĽ˝ĽĂĽŻĽę¤ľ¤ó
+ Á´¤ĆĄË¤ËĹëşÜ¤ˇ¤Ć¤¤¤ë¤˝¤Îž¤ÎĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤Ďžĺľ­¤ÇĽźĽí¤Ë¤Ę¤Ă¤Ć¤¤
+ ¤ëÉôĘŹ¤ŹĽźĽí¤Ç¤Ę¤¤ĂͤˤʤëĄĘËô¤Ď¤˝¤ÎľŐĄË¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ¤ł¤ÎĽŻĽíĽĂĽŻ¤Î˝çČÖ¤ĎČóžď¤Ë *˝ĹÍ×* ¤Ç¤š¤ŹĄ˘ĽÉĽéĽ¤ĽĐ¤ŹĹŞłÎ¤Ë¤Ę¤ë¤č¤Ś¤ËĽŻ
+ ĽíĽĂĽŻ¤Î˝ç˝ř¤ňĘѤ¨¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ Mach32 ¤Č Mach64 ¤ň˝ęÍ­¤ˇ¤Ć¤¤¤ëżÍ
+ ¤ĎĽŻĽíĽĂĽŻ¤Î˝çČÖ¤ŹĽ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐÍѤ˝ȤŚĽŻĽíĽĂĽŻ¤Î˝çČ֤Ȥϰۤʤë
+ ¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽÉĽéĽ¤ĽĐ¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ňĂľĂΤˇ¤ż
+ ¤éĄ˘ XF86Config ¤ÎĽŻĽíĽĂĽŻŔßÄę¤ňĚľťë¤ˇ¤Ć X ĽťĽĂĽˇĽçĽó¤ÇťČÍѤš¤ëĽâĄźĽÉ
+ ¤ňÁȤߚţ¤ß¤Ţ¤šĄŁ
+
+ "X -probeonly" ĽłĽŢĽóĽÉ¤ÇĂľşş¤ˇ¤żĽŻĽíĽĂĽŻ¤Ď¤˝¤ÎĽ˘ĽŔĽ×Ľż¤Źžĺľ­¤ÎĽ˘ĽŔĽ×
+ Ľż¤Î¤Ś¤Á¤Î¤É¤ě¤Ç¤˘¤ë¤Ť¤ňČ˝Äꤚ¤ë˝ő¤ą¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁĽľĄźĽĐ¤Ź°ě´Ó¤ˇ¤ĆĂÎ
+ ¤é¤Ę¤¤ĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤Ç¤˘¤ë¤ČĂΤ餝¤Ć¤Ż¤ëžěšç¤ĎĄ˘É¸˝ŕĽ¨ĽéĄź˝ĐÎϤÎ
+ ĆâÍƤňĹŝҼᥟĽë¤ÇÁ÷ÉŐ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽâĄźĽÉ¤Ď XFree86 ¤Îʸ˝ńĽÇĽŁĽěĽŻĽČĽę¤ËĆţ¤Ă¤Ć¤¤¤ëžđĘ󤍤é°ú¤­˝Đ¤ˇ¤Ć¤­¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ XF86Config ¤ÎłşĹö¤š¤ëĽšĽŻĽęĄźĽó (screen) ĽťĽŻĽˇĽçĽó¤ÎĽÇĽŁĽšĽ×
+ ĽěĽ¤ (display) ĽľĽÖĽťĽŻĽˇĽçĽó¤Ë "modes" šÔ¤ňťŘÄꤡ¤Ę¤¤žěšç¤ËĽÉĽéĽ¤ĽĐĄź
+ ¤Ďɸ˝ŕĂͤμ⥟ĽÉ¤ňŔ¸ŔŽ¤ˇĄ˘ťČÍѤˇ¤č¤Ś¤Č¤ˇ¤Ţ¤šĄŁÉ¸˝ŕĽâĄźĽÉ¤ÎÄ´Ŕ°ÍŃżôĂͤĎ
+ ťöźÂžĺĽľĄźĽĐ¤ŹľŻĆ°¤ˇ¤żĽâĄźĽÉĄĘÄĚžďĽĆĽ­ĽšĽČĽâĄźĽÉĄË¤ÎĂͤŤ¤é°ú¤­˝Đ¤ˇ¤Ć¤­
+ ¤Ţ¤šĄŁ
+
+ 5. ĽÉĽéĽ¤ĽĐ¤ÎÍúÎň¤ĎĄŠ
+
+ ĽÉĽéĽ¤ĽĐ¤Î´°Á´¤ĘÍúÎň¤Ď¤˘¤Ţ¤ęÄꤍ¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁźĄ¤Îľ­˝Ň¤ĎÉÔ´°Á´¤Ť¤ÄÉÔ
+ ŔľłÎ¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ Per Lindqvist (pgd@compuram.bbt.se) ťá¤ŹşÇ˝é¤Ë ATI VGA Wonder XL ĽÉĽé
+ Ľ¤ĽĐ¤ň˝é´üˇż¤Î ATI ĽŤĄźĽÉÍŃ¤Ë X386 1.1a žĺ¤Ë°Üż˘¤ˇ¤ż¤é¤ˇ¤¤¤Ç¤šĄŁ¤ł¤ÎşÇ
+ ˝é¤ÎĽÉĽéĽ¤ĽĐ¤Ď Roell ťá¤Ë¤č¤Ă¤Ć˝ń¤Ť¤ě¤ż ATI ¤Ç¤ĎĆ°şî¤ˇ¤Ę¤¤ĽÉĽéĽ¤ĽĐ¤ňźÂ
+ şÝ¤Ë´đ¤Ë¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤˝¤ˇ¤Ć Doug Evans (dje@cygnus.com) ťá¤Ź ¤˝¤Îž¤ÎÁ´
+ ¤Ć¤Î ATI ĽŤĄźĽÉ¤ÇĽÉĽéĽ¤ĽĐ¤ŹĆ°şî¤š¤ë¤Ť¤É¤Ś¤ŤłÎǧ¤ˇ¤Ę¤Ź¤éĄ˘ATI VGA
+ Wonder XL ĽÉĽéĽ¤ĽĐ¤ň°Üż˘¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ Rik Faith (faith@cs.unc.edu) ťá¤Ď Doug Evans ťá¤Î X11R4 ÍѤμɼ鼤ĽĐ¤ň
+ 1992 ÇŻĄ˘˛Ć¤Ëźę¤Ë¤¤¤ěĄ˘X11R5 ¤Î°ěÉô¤Î X386 ¤ËĽ×ĽíĽ°ĽéĽŕ¤ň°Üż˘¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ¤ł¤ě¤ň XFree86 ¤Î°ěÉô¤Ř°ú¤­ˇŃ¤Ž¤Ţ¤ˇ¤żĄŁ
+
+ ĂřźÔ(Marc La France) ¤Ď Rik ťá¤Î VGA Wander ĽŤĄźĽÉÍѤμɼ鼤ĽĐ¤ň 1993
+ ÇŻ˝Š¤Ë°ú¤­ˇŃ¤Ž¤Ţ¤ˇ¤żĄŁ
+
+ 6. źďĄš¤ÎĂí°Őťöšŕ
+
+ ËؤɤμłĽóĽČĽíĄźĽé¤Ç 80MHz °Ęžĺ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤Ś¤Ë¤Ď VGA Wonder
+ ĽłĽóĽČĽíĄźĽé¤ŹĽÔĽŻĽťĽëÂż˝Ĺ¤ňšÔ¤Ś¤č¤Ś¤Ë¤ˇ¤Ę¤ą¤ě¤Đ˝ĐÍč¤Ţ¤ť¤óĄŁ
+
+ 8bpp ż§°Ęžĺ¤Îżź¤ľ¤ňĽľĽÝĄźĽČ¤š¤ë¤Ë¤Ď¸˝žő¤Î RAMDAC ¤ÎťČ¤¤Ęý¤ňťß¤á¤ĆĄ˘ĽĐ
+ ĽóĽŻ˛˝¤ˇ¤żĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽ×ĽíĽ°ĽéĽŕ¤Ź 8bpp °Ęžĺ¤ňĽľĽÝĄźĽČ¤ˇ¤Ę¤ą¤ě¤Đ¤¤
+ ¤ą¤Ţ¤ť¤óĄŁ
+
+ V3, V4 ¤Č V5 Ľ˘ĽŔĽ×Ľż¤ÎĽÓĽÇĽŞĽáĽâĽę¤ÎĽĐĽóĽŻ˛˝¤Ď 16 ż§¤ČÇňšőĽľĄźĽĐ¤ÇĆ°
+ şî¤ˇ¤Ţ¤ť¤óĄŁ
+
+ V3, V4 ¤Č V5 Ľ˘ĽŔĽ×Ľż¤ÎĽâĄźĽÉ´Ö¤ÎŔÚ¤ęÂؤ¨¤Ë¤č¤Ă¤ĆĽÓĽÇĽŞĽáĽâĽę¤ÎÂÄÍ
+ ̤¤ŔľŻ¤­¤Ţ¤šĄŁ
+
+ ¤ł¤ÎÂÄÍžÝ¤ĎĽĆĽ­ĽšĽČĽâĄźĽÉ¤ËĚá¤Ă¤ż¤Č¤­¤Îˇç¤ą¤żĽŐĽŠĽóĽČ¤ČĽ°ĽéĽŐĽŁĽĂĽŻ
+ ĽâĄźĽÉ¤ËşÇ˝é¤ËĆţ¤Ă¤ż¤Č¤­¤ÎÍÍĄš¤ĘČżąţ(Ŕ㤏šß¤Ă¤ż¤ęĄ˘Ăť¤¤Ŕţ¤Ź˝Đ¤ż¤ęĹů)
+ ¤Č¤ˇ¤Ć¸˝¤ď¤ě¤Ţ¤šĄŁşÇ˝é¤ÎĚäÂę¤Îžěšç¤ĎĄ˘ÂĐşö¤Ďž¤ÎĘýËĄ¤ÇĽĆĽ­ĽšĽČĽŐĽŠĽóĽČ
+ ¤ň˛óÉü¤š¤ë¤ł¤Č¤Ç¤šĄŁ Linux ¤Ç¤Ď kbd ¤Ţ¤ż¤Ď svgalib ĽŃĽĂĽąĄźĽ¸¤Č°ě˝ď¤Ë
+ ˛ňˇč¤ˇ¤Ţ¤ˇ¤żĄŁĆóČÖĚܤÎĚäÂę¤Îžěšç¤ĎĄ˘°ěČĚ¤Ë xrefresh ¤Ź˛čÁü¤ň¤­¤ě¤¤¤Ë¤š
+ ¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 1024 ĽÔĽŻĽťĽë¤č¤ęš­¤¤˛žÁ۲čĚ̤βŁÉý¤ň 28800-x Ľ˘ĽŔĽ×Ľżžĺ¤ÎÇňšőĽľĄźĽĐ¤Ç
+ ¤ĎĽ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ĎĆ°şî¤ˇ¤Ţ¤ť¤óĄŁ
+
+ 264xT Ľ˘ĽŔĽ×Ľżžĺ¤Ç¤Ď¤¤¤Ż¤Ä¤Ť¤Î(ĆäËÄă˛ňÁüĹŮ) Ľ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ĎĆ°
+ şî¤ˇ¤Ţ¤ť¤óĄŁ
+
+ 1M ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ňťČÍѤˇ¤ż˛žÁ۲ňÁüĹ٤Ď̤¤Ŕ´°ŕú¤Ç¤Ď¤˘¤ę¤Ţ¤ť
+ ¤ó¤ŹĄ˘¤Ű¤Ť¤Î Mach64 Ľ˘ĽŔĽ×Ľż¤Ç¤Ď¤˝¤Ś¤Ç¤Ď¤Ę¤¤¤Č¤¤¤Ś¤ł¤Č¤Ç¤šĄŁ
+
+ 264xT Ľ˘ĽŔĽ×Ľż¤Ç 135MHz ¤č¤ęšâ¤¤ĽŻĽíĽĂĽŻ¤ŹťČ¤¨¤ë¤ŤČݤŤ¤Ë¤Ä¤¤¤Ć¤¤¤Ż¤Ä¤Ť
+ ľÄĎŔ¤Ź¤˘¤ę¤Ţ¤šĄŁ¸˝şß¤Ç¤ĎĄ˘É¸˝ŕ¤Ç 135MHz ¤Źžĺ¸Â¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤Îžĺ¸Â¤Ď
+ XF86Config ¤Ë DACSpeed ĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ë¤ł¤Č¤Ë¤č¤ę(ĽÉĽéĽ¤ĽĐ¤Źˇ×ťť˝ĐÍč
+ ¤ëŔäÂĐĹŞ¤ĘşÇÂçĂÍ°Ęžĺ) Áý˛Ă¤ľ¤ť¤ë¤ł¤Č¤Ŕ¤ą¤Ź˝ĐÍč¤Ţ¤šĄŁ¤ł¤ě¤ĎĽĆĽšĽČ¤ˇ¤Ć¤¤
+ ¤Ę¤¤¤ł¤Č¤ČĽ˘ĽŔĽ×Ľż¤ËÂť˝ý¤ňÍż¤¨¤ë¤Ť¤â¤ˇ¤ě¤Ę¤¤¤ł¤Č¤ň°Őźą¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ž­Íč¤ÎłŤČŻˇ×˛č¤Ďžĺľ­¤ÎĚäÂę¤Ë¸ţ¤ą¤ë¤ł¤Č¤ČĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ňťČ¤Ś¤ł¤Č¤Ç
+ ¤šĄŁ
+
+ ĽĐĽ°ĽěĽÝĄźĽČ¤äĽłĽáĽóĽČ¤Ę¤É¤ň Marc Aurele La France,
+ <<it>tsi@ualberta.ca</it>> <mailto:tsi@ualberta.ca>¤Ţ¤ÇĹŝҼᥟĽë¤ň˛ź
+ ¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.12 1996/05/10 06:58:31 dawes Exp
+ $XConsortium: ati.sgml /main/3 1995/11/12 20:00:33 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.12
+ 1996/05/10 06:58:31 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/ati.sgml,v 3.13 1996/12/03 23:48:24 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.cirrus b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.cirrus
new file mode 100644
index 000000000..0beece595
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README.cirrus
@@ -0,0 +1,810 @@
+ Cirrus ĽÁĽĂĽ×ĽťĽĂĽČĽćĄźĽś¤Î¤ż¤á¤ÎžđĘó
+ Harm Hanemaayer (H.Hanemaayer@inter.nl.net), Randy Hendry
+ (randy@sgi.com), Corin Anderson (corina@bdc.cirrus.com) Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1996 ÇŻ 10 ˇî 9 Ćü
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ
+
+ 2. ´đËÜš˝ŔŽ
+
+ 3. XF86Config ĽŞĽ×ĽˇĽçĽó
+
+ 4. ĽâĄźĽÉ ¤Ë´Ř¤š¤ëľÄĎŔ
+
+ 5. ĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ° ¤Č 16bpp/32bpp ĽâĄźĽÉ
+
+ 6. "cl64xx" ĽÉĽéĽ¤ĽĐ
+
+ 7. "cirrus" ĽÉĽéĽ¤ĽĐ¤Ç¤Îžăł˛ÂĐşö¤Î¤Ţ¤Č¤á
+
+ 8. ĽĆĽšĽČ¤ˇ¤żľĄ´ďš˝ŔŽ
+
+ 9. ĽÉĽéĽ¤ĽĐ¤ÎĘŃššĹŔ
+ ______________________________________________________________________
+
+ 1. ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ
+
+ Cirrus ¤ÎĽÁĽĂĽ×ĽťĽĂĽČÍѤˤϥ˘"cirrus"¤Č"cl64xx"¤Č¸Ć¤Đ¤ě¤ëŁ˛¤Ä¤Î°Ű¤Ę¤ë
+ SVGA ĽľĄźĽĐ¤Ź¤˘¤ę¤Ţ¤šĄŁ "cirrus" ĽÉĽéĽ¤ĽĐ¤Ď 256 ż§¤ÎĄĘĽ˘ĽŻĽťĽéĽěĄźĽżÉŐ
+ ¤­ĄËSVGA ĽľĄźĽĐ¤ČĄĘĽ˘ĽŻĽťĽéĽěĄźĽżĚľ¤ˇĄËÇňšőĽľĄźĽĐ¤ÇÍѤ¤¤é¤ě¤Ć¤¤¤Ţ
+ ¤šĄŁSVGA ĽľĄźĽĐ¤Ď 16, 24 ¤Č 32 ĽÔĽŻĽťĽëĹö¤ęĽÓĽĂĽČżô ¤ňĽľĽÝĄźĽČ¤ˇĄ˘¤ł¤Î
+ š˝ŔŽ¤ÇšÁłż§ (truecolor) ĽâĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ "cl64xx" ĽÉĽéĽ¤
+ ĽĐ¤Ď 256 ż§ SVGA, 16 ż§ ¤Č Çňšő ĽľĄźĽĐ¤ÇÍѤ¤¤é¤ě¤Ć¤¤¤Ţ¤šĄŁ¤É¤Á¤é¤Ź°ÂÄę
+ ¤ˇ¤Ć¤¤¤ë¤Č¤Ť¤Ď¤ł¤ł¤Ç¤ĎľÄĎŔ¤ˇ¤Ţ¤ť¤ó¤ŹĄ˘¤ł¤Îʸ˝ń¤Ç¤Ď "cirrus" ĽÉĽéĽ¤ĽĐ¤Ë
+ ¤Ä¤¤¤Ćźç¤Ë¸ŔľÚ¤ˇ¤Ţ¤šĄŁźĄ¤ÎCirrus Logic ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤
+ ¤Ţ¤šĄŁ:
+
+ CL-GD5420
+ ISA SVGA ĽÁĽĂĽ×ĽťĽĂĽČ, 1MĽĐĽ¤ĽČ; şÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ď 45 MHz
+ (256 ż§ĽľĄźĽĐ)ĄŁłČÄĽ˝ń¤­šţ¤ßĽâĄźĽÉ¤Ë¤č¤ëĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝ĄĘ¤ł¤Î
+ ĽľĄźĽĐ¤Ç¤ĎĽšĽŻĽíĄźĽë¤ČĽŮĽżĹɤę¤Ä¤Ö¤ˇ¤ËÍѤ¤¤Ć¤¤¤ëĄËĄŁ¤ł¤ÎĽÁĽĂĽ×
+ ĽťĽĂĽČ¤Ď 256 ż§¤Î 1024x768 ĽÎĽóĽ¤ĽóĽżĄźĽěĄźĽš ¤ĎĽľĽÝĄźĽČ¤ˇ¤Ţ¤ť
+ ¤óĄŁ
+
+ CL-GD5422
+ 5420¤Î˛ţÎÉČÇ (32 ĽÓĽĂĽČĆâ¢ĽáĽâĽęĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš)ĄŁşÇÂçĽÉĽĂĽČĽŻ
+ ĽíĽĂĽŻ¤Ď 80 MHzĄŁ
+
+ CL-GD6205/6215/6225/6235
+ 5420 ¤Ë¤Ű¤Ü¸ß´šŔ­¤Î¤˘¤ëĽéĽĂĽ×ĽČĽĂĽ×ÍŃĽÁĽĂĽ×ĽťĽĂĽČĄŁĽÉĽĂĽČĽŻĽíĽĂ
+ ĽŻ¤Ď 25 MHz ¤Î¤ßĽľĽÝĄźĽČ¤š¤ëĄĘł°ÉôĽÇĽŁĽšĽ×ĽěĽ¤¤Ď¤˝¤ě°Ęžĺ˛ÄÇ˝ĄËĄŁ
+ "noaccel" ĽŞĽ×ĽˇĽçĽó¤ŹÉŹÍפʤΤÇĂí°Ő¤ÎťöĄŁ
+
+ CL-GD6420/6440
+ ¤ł¤ě¤é¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď 542x ĽˇĽęĄźĽş¤Č¤Ď¸ß´šŔ­¤Ď¤˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘
+ "cl64xx" ĽÉĽéĽ¤ĽĐ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ĎşÇśá¤ÎĽéĽĂ
+ Ľ×ĽČĽĂĽ×¤ËĹëşÜ¤ľ¤ě¤Ć¤Ş¤ęĄ˘ŔΤΠCirrus ĽÁĽĂĽ×ĽťĽĂĽČ(5410/AVGA2)¤Č
+ ĆąÍͤËĆ⢤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎĽÉĽéĽ¤ĽĐ¤Ďž¤Î 64xx ĽÁĽĂĽ×ĽťĽĂĽČ¤Ç¤â˛Ô
+ ĆŻ¤ˇ¤Ć¤¤¤Ţ¤šĄŁš˝ŔŽžĺ¤ÎźąĘĚťŇ¤Ď "cl6420" ¤Č "cl6440" ¤Ç¤šĄŁ¤ł¤ÎĽÉ
+ ĽéĽ¤ĽĐ¤Ë¤Ä¤¤¤Ć¤Ď ``cl64xx ĽÉĽéĽ¤ĽĐ'' ¤ÎŔá¤ÇžÜşŮ¤Ë˝Ň¤Ů¤Ţ¤šĄŁ
+
+ CL-GD5424
+ ´đËÜĹŞ¤Ë 5422 ¤Î VLB ČǤǤš¤ŹĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĹŔ¤Ç 5426 ¤Ëť÷¤Ć¤¤¤Ţ
+ ¤šĄŁ
+
+ CL-GD5426
+ ISA ĽĐĽš¤Č VLB ΞĘý¤Î 2M ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż¤â¤Î¤ňĽľĽÝ
+ ĄźĽČ¤ˇ¤Ţ¤šĄŁ¤č¤ę¤č¤¤Ľ˘ĽŻĽťĽéĽěĄźĽż¤ňľá¤á¤ë¤Ę¤é BitBLT Ľ¨ĽóĽ¸Ľó¤ň
+ ĹëşÜ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤(BitBLT¤Ď˛čÁüĹžÁ÷¤ČĽĆĽ­ĽšĽČÉ˝ź¨¤ËÍ­¸ú)ĄŁĽÉĽĂĽČĽŻ
+ ĽíĽĂĽŻ¤Îžĺ¸Â¤Ď 85 MHzĄŁ
+
+ CL-GD5428
+ 5426 ¤Î˛ţÎÉČÇĄŁ
+
+ CL-GD5429
+ 5428 ¤Î˛ţÎÉČǤǥ˘¤č¤ęšâ¤¤ MCLK ¤ň¸řź°¤ËĽľĽÝĄźĽČ¤ˇĄ˘ĽáĽâĽęĽŢĽĂĽ×
+ ĽÉ I/O ¤ňĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ CL-GD5430
+ 5429 ¤Ëť÷¤Ć¤¤¤Ţ¤š¤ŹĄ˘´đ¤Ď 543x (32 ĽÓĽĂĽČĽŰĽšĽČĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš)
+ ¤Ç¤šĄŁ64 ĽÓĽĂĽČĽáĽâĽęĽâĄźĽÉ¤Ďťý¤Ă¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ CL-GD5434
+ 64 ĽÓĽĂĽČĆâ¢ĽáĽâĽęĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš¤ňťý¤Ă¤ż `Alpine' ¤ÎˇĎÎó¤Î
+ ĽÁĽĂĽ×¤Ç¤šĄŁ¤ł¤ÎĽÁĽĂĽ×¤Ď 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż¤Č¤­ 64 ĽÓĽĂ
+ ĽČĽâĄźĽÉ¤Î¤ßĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ1M ĽĐĽ¤ĽČĽáĽâĽę¤Î¤ß¤Î¤ÎĽŤĄźĽÉ¤Ç¤Ď¸ˇ
+ ¤ˇ¤¤¸ÂłŚ¤Ź¤˘¤ę¤Ţ¤šĄŁ110 MHz °Ęžĺ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤š
+ ĄĘżˇ¤ˇ¤¤ĽÁĽĂĽ×ĽťĽĂĽČ¤Ď 135 MHz ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄËĄŁ
+
+ CL-GD5436
+ šâĹ٤˺ÇĹŹ˛˝¤ˇ¤ż 5434.
+
+ CL-GD5440
+ CL-GD5430 ¤Ëť÷¤Ć¤¤¤Ţ¤š¤Î¤Ç¤˝¤Î¤č¤Ś¤ËĂľĂΤľ¤ě¤Ţ¤šĄŁ
+
+ CL-GD5446
+ Ł˛źĄ¸ľĽ˘ĽŻĽťĽéĽěĄźĽż¤Î Alpine ˇĎÎó¤ÎĆâ¤Î°ě¤Ä¤ÇĄ˘CL-GD5436 ¤Ëť÷¤Ć
+ ¤¤¤Ţ¤šĄŁ
+
+ CL-GD546X
+ Ł˛źĄ¸ľĽ˘ĽŻĽťĽéĽěĄźĽż¤Î Laguna VisualMedia ˇĎÎó¤Ç¤šĄŁ¤ł¤ě¤éŁł¤Ä¤Î
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤Ď Rambus RDRAM ĽáĽâĽę¤ňťČ¤Ă¤Ć¤¤¤Ţ¤šĄŁĽÓĽÇĽŞĽŚĽŁĽóĽÉ
+ ĽŚ(¸˝şß¤ÎĽľĄźĽĐ¤Ç¤ĎťČÍѤˇ¤Ć¤¤¤Ţ¤ť¤ó) ¤ČĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňĆâ
+ ¢¤ˇ¤Ć¤¤¤Ţ¤šĄŁÇňšőĽâĄźĽÉ¤ĎĽĆĽšĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁCL-GD5464 ¤Ď
+ Laguna ˇĎÎó¤ÎźĄŔ¤Âĺ¤ÎĽÁĽĂĽ×¤ÇĄ˘ĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤ż¤ŹĽĆĽšĽČ¤ˇ¤Ć¤¤¤Ţ
+ ¤ť¤óĄŁ
+
+ CL-GD7541/7542/7543/7548
+ 5428/3x ¤ČÂçÂθߴšŔ­¤Î¤˘¤ëĽéĽĂĽ×ĽČĽĂĽ×ÍѤμÁĽĂĽ×ĽťĽĂĽČ¤Ç¤šĄŁLCD
+ ¤ŹĽŞĽó¤Îťţ¤ĎşÇÂç¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ď 44MHz ¤Ç¤šĄŁ¤ł¤ÎČǤǤϤł¤ě¤é
+ ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď¤Ş¤Ť¤ˇ¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁĘóšđ¤ň¤ŞÂÔ¤Á¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ łĆĄš¤ÎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëżź¤ľËč¤ËşÇÂç¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ň°ěÍ÷¤Ë¤ˇ¤Ţ¤šĄŁ:
+
+ mono 8 bpp (256c) 16 bpp 24 bpp 32 bpp
+ CL-GD62x5 45 MHz 45 MHz
+ CL-GD5420 80 MHz 45 MHz (1)
+ CL-GD542x/512K 80 MHz 45 MHz
+ CL-GD5422/24 80 MHz 80 MHz 40 MHz 27 MHz
+ CL-GD5426/28 85 MHz 85 MHz 45 MHz (2) 28 MHz
+ CL-GD5429 85 MHz 85 MHz 50 MHz 28 MHz
+ CL-GD5430 85 MHz 85 MHz 45 MHz (2) 28 MHz
+ CL-GD5434/1Mb 85 MHz 85 MHz 42 MHz 28 MHz
+ CL-GD5434/2Mb 85 MHz 110/135 MHz 85 MHz 28 MHz 45/50 MHz (2)
+ CL-GD5436/1Mb 85 MHz 110 MHz (3) 60 MHz (3) 40 MHz (3)
+ CL-GD5436/2Mb 85 MHz 135 MHz 85 MHz 85 MHz (3) 60 MHz (3)
+ CL-GD5446/1Mb 85 MHz 110 MHz (3) 60 MHz (3) 40 MHz (3)
+ CL-GD5446/2Mb 85 MHz 135 MHz 85 MHz 85 MHz (3) 60 MHz (3)
+ CL-GD546X 170 MHz 170 Mhz 170 MHz 170 MHz 170 MHz
+ CL-GD754x 80 MHz 80 MHz 40 MHz (4) (5)
+
+ (1) 512K ĽáĽâĽę¤Ç¤šĄŁ
+ (2) šâ¤¤ MCLK ¤ňŔßÄꤚ¤ë¤Č 50 MHzĄŁ
+ (3) ĽáĽâĽęĽŻĽíĽĂĽŻ¤Ë°Í¸¤ˇ¤Ţ¤šĄŁ
+ (4) ¿ʏĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ë¤ĎÄ㤚¤Ž¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+ (5) ¿ʏĄ˘Í­¸ú¤Ë¤ˇ¤ĆĽĆĽšĽČ¤ňšÔ¤¨¤Đ¤ł¤Îżź¤ľ¤ĎźÂşÝ¤ËĆ°şî¤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Âç¤Ţ¤Ť¤Ë¸Ŕ¤Ă¤Ć ˛žÁŰĹŞ/ĘŞÍýĹŞ¤Ę˛čĚ̲ňÁüĹŮ¤ĎĽÓĽÇĽŞĽáĽâĽę¤ÎÎ̤ΰ㤤¤ËŔŠĚó
+ ¤ľ¤ě¤Ţ¤šĄŁ
+
+ mono 8 bpp 16 bpp 24 bpp 32 bpp
+ 256K 800x600 640x400
+ 512K 1152x900 800x600 640x400
+ 1024K 1600x1200 1152x900 800x600 680x510
+ 2048K 2304x1728 1600x1200 1152x900 960x720 800x600
+ 4096K 2304x1728 2272x1704 1600x1200 1360x1020 1152x900
+
+ 546x ĽÁĽĂĽ×¤Ç¤Ď˛žÁ۲čĚ̤ÎÉý¤ĎǤ°Ő¤Ç¤šĄŁ¤ˇ¤Ť¤ˇĄ˘˛čĚ̤μԼüÁ(pitch) ¤ň
+ źĄ¤ÎÉ˝¤ÎşÇ¤âśá¤¤˛Á¤ËŔÚ¤ęžĺ¤˛¤Ţ¤ˇ¤ç¤ŚĄŁ˝ž¤Ă¤ĆĄ˘˛čĚĚžĺ¤ÎłĆĄš¤ÎŔţ¤ĎĽÓĽÇĽŞ
+ ĽáĽâĽę¤ň¤É¤ě¤Ż¤é¤¤žĂČń¤š¤ë¤Ť¤č¤ę¤âĂą¤ËÉ˝ź¨¤ˇ¤ż¤¤Äš¤ľ¤Ë¤Ę¤ę¤Ţ¤šĄŁĽÓĽÇĽŞ
+ ĽáĽâĽę¤ňĚÜ°ěÇ՝ȤŚ¤Ë¤ĎĄ˘źĄ¤ÎÉ˝¤ÎĽÔĽŻĽťĽëżô¤Ť¤é˛žÁŰĽÇĽšĽŻĽČĽĂĽ×¤ÎÉý¤ňÁŞ
+ Âň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ:
+
+ 8bpp: 640, 1024, 1280, 1664, 2048, 2560, 3328, 4096, 5120, 6656
+ 16bpp: 320, 512, 640, 832, 1024, 1280, 1664, 2048, 2560, 3328
+ 24bpp: 640, 1024, 1280, 1664, 2048, 2560, 3328, 4096, 5120, 6656
+ 32bpp: 160, 256, 320, 416, 512, 640, 832, 1024, 1280, 1664
+
+ ž¤Î Cirrus ĽÁĽĂĽ×ĽťĽĂĽČ¤Ç¤ĎĄ˘Ľ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ňťČ¤Ă¤żžěšçĄ˘˛žÁ۲čĚĚ
+ ¤ÎÉý¤Ď 32 ¤ÎÇÜżô¤Ë¤Ę¤ę¤Ţ¤šĄŁĽâĽËĽżĄź¤ÎżĺĘżĘý¸ţ¤ÎÄ´Ŕ°żôĂÍ¤Ď 2048 °Ę˛ź¤Ë
+ ¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ ¤č¤ęšâ¤¤ż§¤Îżź¤ľ¤Ç XF86_SVGA ¤ňĆ°şî¤ľ¤ť¤ë¤Ë¤ĎĄ˘źĄ¤ÎĽŞĽ×ĽˇĽçĽó¤ň X ĽľĄź
+ ĽĐ¤ËÉղ䡤Ʋź¤ľ¤¤ĄŁ
+
+ startx -- -bpp 16 5-6-5 RGB ('64K color', XGA)
+ startx -- -bpp 16 -weight 555 5-5-5 RGB ('Hicolor') (5462 ¤Ç¤Ď¤Ę¤Ż)
+ startx -- -bpp 24 8-8-8 RGB truecolor
+ startx -- -bpp 32 8-8-8 XRGB truecolor (543X/46/6X)
+
+ 2. ´đËÜš˝ŔŽ
+
+ `XF86Setup' ¤ä`xf86config' Ľ×ĽíĽ°ĽéĽŕ¤ňťČÍѤˇ¤Ć XF86Config ĽŐĽĄĽ¤Ľë¤ň
+ Ŕ¸ŔŽ¤š¤ë¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘¤ł¤ÎĽ×ĽíĽ°ĽéĽŕ¤Ď˛ÔĆŻ˛ÄÇ˝¤Ęšâ˛ňÁüĹ٤Î
+ 8bpp ¤Îš˝ŔŽ¤ňşîŔŽ¤ˇ¤Ţ¤šĄŁťČÍѤš¤ëĽâĽËĽżĄź¤ËĄ˘¤č¤ęĹŹąţ¤ˇ¤żĽâĄźĽÉÄ´Ŕ°ĂÍ
+ ¤ň Monitor Ŕá¤Ëľ­Ćţ¤ˇ¤ż¤Ż¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁĽÉĽéĽ¤ĽĐ¤ÎĽŞĽ×ĽˇĽçĽó¤Ë¤Ä¤¤¤Ć¤Ď
+ źĄ¤ÎŔá¤ÇžÜşŮ¤Ë˝Ň¤Ů¤Ţ¤š¤Î¤ÇĄ˘¤ł¤ł¤Ç¤ĎˇÚ¤Żż¨¤ě¤ë¤Ŕ¤ą¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ Á´¤Ć¤Î¤ÎĽÁĽĂĽ×ĽťĽĂĽČÍŃ¤Ë Clockchip "cirrus" šÔ¤ň Device Ŕá¤Ë˝ń¤­¤Ţ¤ˇ¤ç
+ ¤ŚĄŁ¤ł¤Ś¤ä¤Ă¤Ć¤Ş¤Ż¤ČĽľĄźĽĐ¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëÂĐşöşŃ¤ß¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Î
+ ÁȤߚç¤ď¤ť¤ÎĂ植¤éĹŹŔڤʼɼüȼŻĽíĽĂĽŻ¤ňťČÍѲÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁÄă˛ňÁüĹ٤μâ
+ ĽËĽżĄźÂĐąţ¤Ç 12.6 MHz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤¤¤ż¤¤žěšç¤ËÉŹÍפˤʤę¤Ţ¤šĄŁ
+ ¤ˇ¤Ť¤ˇĄ˘¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňťČÍѤš¤ë¤ČĄ˘ĘѤď¤Ă¤ż¸˝žÝ¤ň°ú¤­ľŻ¤ł¤šĽŻĽíĽĂĽŻźţ
+ ÇČżô¤ŹÉÔ°ÂÄę¤Ë¤Ę¤ë¤Î¤ÇĄ˘ŔäÂФËÉŹÍפʝţ¤Ŕ¤ąťČÍѤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Ľ°ĽéĽŐĽŁĽĂĽŻ˛čĚ̤κĆÉÁ˛č¤Ź¤Ś¤Ţ¤ŻĆ°şî¤ˇ¤Ę¤¤žěšç¤ĎĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤Ź
+ BitBLT Ľ¨ĽóĽ¸Ľó¤ňťý¤Ă¤Ć¤¤¤ëžěšç¤ËŔ褺"no_bitblt" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤Ź¤Ś¤Ţ¤ŻĆ°şî¤ˇ¤Ę¤¤¤Č¤­¤Ď "noaccel" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤ß¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁÁ´¤Ć¤ÎĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁ"no_imageblt" ĽŞĽ×
+ ĽˇĽçĽó¤Ç˝źĘŹ¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ 16bpp ¤Ť 32bpp ¤Îżź¤ľ¤ÇźÂšÔ¤š¤ë¤ŤĄ˘8bpp ¤ÇŔ­Ç˝¤ň¸ţžĺ¤ľ¤ť¤ë¤Ë¤ĎĽęĽËĽ˘Ľ˘
+ ĽÉĽěĽĂĽˇĽóĽ°ľĄÇ˝¤ňťČ¤¨¤ë¤č¤Ś¤Ë¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁĽíĄźĽŤĽëĽĐĽš¤Î
+ 543x ĽŤĄźĽÉ¤Ţ¤ż¤ĎĄ˘ĽáĽâĽę¤Ź 16M ĽĐĽ¤ĽČ°Ę˛ź¤ÎĽˇĽšĽĆĽŕ¤ÇĽíĄźĽŤĽëĽĐĽš¤Î
+ 542x ĽŤĄźĽÉ¤â¤ˇ¤Ż¤Ď ISA ¤Î 543x ĽŤĄźĽÉ¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë¤Č¤­¤Ë°ěČ̤˝ČÍѲÄ
+ Ç˝¤Ç¤šĄŁ "linear" ĽŞĽ×ĽˇĽçĽó¤ŹÉŹżÜ¤ÇĄ˘¤Ş¤˝¤é¤Ż Membase¤ÇĽ˘ĽÉĽěĽš¤ňťŘÄę
+ ¤š¤ëÉŹÍפŹ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ°Ęšß¤ÎŔá¤ÇžÜşŮ¤ËŔâĚŔ¤ˇ¤Ţ¤šĄŁ
+
+ ¤Ţ¤żĄ˘ 534x ¤Ç ĽÇĽĐĽ¤ĽšŔá¤Ë "mmio" ĽŞĽ×ĽˇĽçĽó¤ň˝ń¤¤¤Ć¤Ş¤Ż¤Čšš¤ËÎÉšĽ¤Ę
+ Ľ˘ĽŻĽťĽéĽěĄźĽż¤Ë¤Ę¤ę¤Ţ¤š < ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď 5429 ¤Ç¤âĹŹÍѲÄÇ˝¤Čť×¤¤¤Ţ
+ ¤š¤ŹĄ˘Ě¤¤ŔĽĆĽšĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤ó >ĄŁ
+
+ şÇ¸ĺ¤ËĄ˘546X ĽÁĽĂĽ×¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤Ď PCI ĽĐĽšžĺ¤ËĹëşÜ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤ł
+ ¤Î¤č¤Ś¤Ęžěšç¤ĎĄ˘ĽáĽâĽęĽŢĽĂĽ× I/O ¤ä ĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽ˘ĽÉĽěĽšśő´Ö¤ŹĽˇĽš
+ ĽĆĽŕĽáĽâĽę¤ËČô¤Ó˝Đ¤ˇ¤Ć¤¤¤Ć¤âĚäÂꤢ¤ę¤Ţ¤ť¤óĄŁPCI śő´Ö¤Ď 4GB śá¤Ż¤ÎĽ˘ĽÉ
+ ĽěĽš¤ňłä¤ęÉŐ¤ą¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ¤ˇ¤ż¤Ź¤Ă¤Ć mmio ¤ČĽęĽËĽ˘ĽŐĽěĄźĽŕĽĐĽĂ
+ ĽŐĽĄ¤ĎĽˇĽšĽĆĽŕžĺ¤Çž×Ćͤš¤ë¤ł¤Č¤ĎÁ´Áł¤Ę¤¤¤Î¤Ç"linear",
+ Membase¤Č"mmio"ĽŞĽ×ĽˇĽçĽó¤ĎĚľťë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 3. XF86Config ĽŞĽ×ĽˇĽçĽó
+
+ `Clocks' ĽłĽŢĽóĽÉ¤ĎťČ¤ď¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁĄĘ¤Ä¤Ţ¤ęĄ˘Ăľşş¤ˇ¤Ę¤¤¤ÇĄËĽŻĽíĽĂ
+ ĽŻ¤ň˝¤Ŕľ¤ˇ¤żžěšçĄ˘ĄĘłĆĄš¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëşÇÂ缯ĽíĽĂĽŻ°Ę
+ ł°¤ÎĄËĽŤĄźĽÉËč¤Î°ă¤¤¤ĎČżąÇ¤Ç¤­¤Ţ¤ť¤óĄŁ
+
+ °Ęšß¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĆĂ¤Ë Cirrus ĽÉĽéĽ¤ĽĐ¤Ç¤Ď˝ĹÍפǤšĄŁłĆĄš¤ÎĽŞĽ×ĽˇĽçĽó¤Ď
+ XF86Config ¤Î `svga' ĽÉĽéĽ¤ĽĐŔá¤Ë Screen šŕ¤ÎĂć¤ËĹŹąţ¤š¤ëÁ´¤Ć¤Îżź¤ľ¤ň
+ ťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄĘDevice Ŕá¤ËÁ´¤Ć¤Î Screen ¤ňťŘÄꤚ¤ë¤ł¤Č¤Ź˛ÄÇ˝
+ ¤Ç¤šĄËĄŁ
+
+ "noaccel" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽ˘ĽŻĽťĽżĽěĄźĽżľĄÇ˝¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁDRAM ¤ÎÂŽĹ٤ä
+ šâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤äĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ÎÉÔśńšç¤Ë¤č¤ëĚäÂę¤ň˛ňˇč¤š
+ ¤ëťŮąç¤ň¸úΨÎɤŻĄĘĽíĄźĽŤĽëĽĐĽš¤Ç¤Ď°ěĂʤČÂĹĹö¤ËĄËšÔ¤¤¤Ţ¤šĄŁ
+
+ "fast_dram" "med_dram" "slow_dram" (5424/6/8/9, 543x) ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ě¤é¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĆâ¢ĽáĽâĽęĽŻĽíĽĂĽŻ(MCLK) ĽěĽ¸ĽšĽż¤Ëž¤ÎżôĂÍ
+ ¤ňĘŃšš¤š¤ë¤â¤Î¤Ç¤šĄŁÉ¸˝ŕĂÍ¤Ď BIOS ¤ËÁȤߚţ¤Ţ¤ě¤Ć¤¤¤ëžěšç¤ĎÂçžćÉ×
+ ¤Ç¤š¤ŹĄ˘śŻ¤ŻÍ׾᤾¤ě¤Ę¤¤¸Â¤ę¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ÇĚľĂă¤ň¤ˇ¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ "fast_dram" ĽŞĽ×ĽˇĽçĽó¤ĎĽÓĽÇĽŞĽÜĄźĽÉ¤ÎĆâ¢ĽáĽâĽęĽŻĽíĽĂĽŻ(MCLK)
+ ĽěĽ¸ĽšĽż¤Ë¤č¤ęšâ¤¤ĂͤňŔßÄꤡ¤Ţ¤š (şÇśá¤ÎĽÁĽĂĽ×¤Ďɸ˝ŕ¤Ç˝˝ĘŹ¤č¤ęšâ
+ ¤¤˛Á¤ňťČ¤Ă¤Ć¤¤¤Ţ¤š)ĄŁ
+
+ Ä̞異¤ł¤ÎĽěĽ¸ĽšĽż¤Ď¤¤¤¸¤ë¤ł¤Č¤Ď¤Ę¤¤¤Î¤Ç¤š¤ŹĄ˘É¸˝ŕ¤Î CL-GD542x
+ BIOS ¤Î˝é´ü˛˝¤Ë¤č¤Ă¤Ćšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻĽâĄźĽÉ¤Ç¤ÎŔ­Ç˝¤ËÎɤŻ¤Ę¤¤
+ ąĆśÁ¤ňÍż¤¨¤ë¤č¤Ś¤ĘĄĘĽÁĽĂĽ×ĽťĽĂĽČ¤ÎťĹÍͤËŔŠ¸Â¤ľ¤ě¤żĄËÄ㤤Ęý¤ÎĂͤË
+ ŔßÄꤾ¤ě¤Ţ¤šĄŁ¤ł¤ě¤ĎłČÄĽ RAS Ä´Ŕ°¤ňťČ¤Śžěšç¤Ë¤ĎĆä˹ƜÁ¤ňźő¤ą¤Ţ
+ ¤šĄĘ¤ł¤ě¤ĎĽľĄźĽĐĄź¤ÎĂľşş¤ÇťŘĹŚ¤ľ¤ě¤Ţ¤šĄËĄŁ
+
+ DRAM ¤ÎźÂşÝ¤ÎÂŽĹ٤Ϥł¤ÎĽŞĽ×ĽˇĽçĽó¤ŹĹŹŔÚ¤Ŕ¤í¤Ś¤Č¤Ę¤Ť¤í¤Ś¤ČĽŤĄźĽÉ
+ ǧźą¤Ë¤Ş¤¤¤Ć´í¸ą¤ĘÍ×ÁǤˤϤʤę¤Ţ¤ť¤óĄŁ80ns ¤Î DRAM ¤ňĹëşÜ¤ˇ¤Ć¤¤
+ ¤ë CL-GD5426 ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤ŹłČÄĽ RAS Ä´Ŕ°¤ňťČ¤Ă¤Ć DOS ¤Î ĽÉĽé
+ Ľ¤ĽĐĽćĄźĽĆĽŁĽęĽĆĽŁ¤Ç MCLK ¤ň (0x22) ¤Î¤č¤Ś¤ĘĂͤËŔßÄꤡ¤żžěšç¤Ďšâ
+ ¤¤ MCLK ¤Ç°ÂÄꤡ¤ĆĆ°şî¤ˇ¤Ć¤¤¤ëÍͤ˸Ť¤¨¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ĽŤĽšĽżĽŢĽ¤Ľş¤ľ¤ě¤ż BIOS ¤Ź¤č¤ęšâ¤¤É¸˝ŕĂÍ°Ęł°¤ÎĂͤ˽é´ü˛˝¤ˇ¤żĄĘźç
+ ¤ËÍ­Ěž¤É¤ł¤í¤ÎĄËĽŤĄźĽÉ¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ "slow_dram" ĽŞĽ×ĽˇĽçĽó¤Ď MCLK ¤ňɸ˝ŕ¤Î CL-GD542x BIOS ¤ÎĂÍ
+ (0x1c) ¤ËŔßÄꤡ¤Ţ¤šĄŁšâ¤š¤Ž¤ë MCLK ¤ÎĂͤϿâÄžĘý¸ţ¤Î˛čĚ̤ΤÁ¤é¤Ä
+ ¤ŻÂÓĄ˘ĽĆĽ­ĽšĽČ¤Ë¸í¤Ă¤ż˛čÁÇĄ˘ĽĆĽ­ĽšĽČĽâĄźĽÉ¤Î˛čÁǤÎČ´¤ą¤ň X ¤ÎĆ°
+ şî¸ĺ¤Ë°ú¤­ľŻ¤ł¤ˇ¤Ţ¤šĄĘMCLK ¤ÎŔßÄꤏÄ㤚¤Ž¤ëžěšç¤âĆąÍͤθ˝žÝ¤ňľŻ
+ ¤ł¤ˇ¤Ţ¤š¤Î¤ÇĂí°Ő¤ˇ¤Ţ¤ˇ¤ç¤ŚĄËĄŁ
+
+ łŤťĎťţ¤ËĄ˘ĽÉĽéĽ¤ĽĐĄź¤Ď MCLK ¤ÎĂͤňÉ˝ź¨¤š¤ë¤Ç¤ˇ¤ç¤ŚĄĘŔ褺Ą˘¤ł¤ě¤ň
+ łÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄËĄ˘¤˝¤ˇ¤Ć¤ł¤ÎĂͤϼ⥟ĽÉ¤Ë¤č¤Ă¤ĆĘѲ˝¤ˇ¤Ţ¤šĄŁ
+
+ ĹľˇżĹŞ¤Ę MCLK ¤ÎĂÍ:
+
+ 0x1c (50 MHz)
+ ¤ł¤ě¤Ď BIOS ¤Îɸ˝ŕĂͤÇÍѤ¤¤é¤ě¤Ţ¤šĄŁ "slow_dram" ĽŞĽ×ĽˇĽçĽó¤Ç
+ śŻŔŠťŘÄę¤Ç¤­¤Ţ¤šĄŁ
+
+ 0x1f (55 MHz)
+ "med_dram" ĽŞĽ×ĽˇĽçĽó¤ÇťČÍѤš¤ëĂͤǤšĄŁ 542x ¤ňťČ¤Ă¤Ć¤¤¤ëĽŤĄź
+ ĽÉ¤Ç¤ÎşÇšâ¤ÎĂͤϼęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ŹÍ­¸ú¤Ë¤Ę¤Ă¤Ć¤¤¤Ę¤¤¤Č°ˇ
+ ¤¨¤Ę¤¤¤č¤Ś¤Ç¤šĄŁ
+
+ 0x22 (60 MHz)
+ ËؤɤΥʳČÄĽ RASĄË 542x ĽŤĄźĽÉ¤Ç¤Ď "fast_dram" ĽŞĽ×ĽˇĽçĽó¤ňťČ
+ ¤Ś¤ČÍ­¸ú¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¸řź°¤Ę 542x ĽÁĽĂĽ×¤ÎşÇÂçźţÇČżô¤Ď 50 MHz ¤Ç¤šĄŁ 5434 ¤Î¸řź°ťĹÍͤĎ
+ ¤Ţ¤ż 50 MHz (0x1c) ¤ÇĄ˘5429 ¤Č 5430 ¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽâĄźĽÉ¤Ç¤Ď 60
+ MHz (0x22) ¤Î MCLK ¤ňĽľĽÝĄźĽČ¤ˇĄ˘ĽÉĽéĽ¤ĽĐ¤ĎźŤĆ°Ĺޤˤł¤ě¤ňÁȤߚţ
+ ¤ß¤Ţ¤šĄŁ¤ł¤ě¤ŹĚäÂę¤ň°ú¤­ľŻ¤ł¤ˇ¤żžěšç¤Ď "slow_dram" ĽŞĽ×ĽˇĽçĽó¤ň
+ ťČÍѤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽÉĽéĽ¤ĽĐ¤Ďǧźą¤ˇ¤ż DRAM ÂÓ°čÉý¤ÎĽŻĽíĽĂĽŻ¤Îžĺ¸Â¤ň MCLK ¤Ëźč¤ęšţ¤ß
+ ¤Ţ¤šĄŁ
+
+ Ćä˥ʚ⤤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÇŔ­Ç˝¤ä°ÂÄęĹ٤ΥËĚäÂꤏ¤Ę¤Ť¤Ă¤ż¤éĄ˘
+ DRAM ĽŞĽ×ĽˇĽçĽó¤ňťČ¤ŚÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ "no_bitblt" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ň 5426/28/29/3x/46/6x/754x ¤ÇťČÍѤš¤ëžěšçĄ˘Ľ˘ĽŻĽť
+ ĽéĽěĄźĽżľĄÇ˝¤ňĘÝťý¤š¤ë´ÖĄ˘ĄĘ5424 ¤Ç¤Ďťý¤Ă¤Ć¤¤¤Ę¤¤ĄËBitBLT Ľ¨ĽóĽ¸
+ Ľó¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁBitBLT Ľ¨ĽóĽ¸Ľó¤ňťČÍѤš¤ë¤ł¤Č¤Ë´ŘϢ¤ˇ¤ĆŔ¸¤¸¤ë
+ ľĄÇ˝žĺ¤ÎĚäÂę¤ËÂФˇ¤ĆÍ­¸ú¤Ç¤šĄŁŔ­Ç˝¤Ď¤Ť¤Ę¤ęĂř¤ˇ¤ŻÍî¤Á¤Ţ¤šĄŁ
+
+ "no_imageblt" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ň 5426/28/29/3x/46/6x/754x ¤ÇťČÍѤš¤ëžěšçĄ˘ĽˇĽšĽĆ
+ ĽŕĽáĽâĽę¤Ť¤éĽÓĽÇĽŞĽáĽâĽę¤ËĹžÁ÷¤š¤ë BitBLT ľĄÇ˝¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁĆĂ
+ ¤ËÂŽ¤¤ CPU ¤Ç VLB 5426 ¤Č 5434 ¤ňťČ¤Ă¤ż¤¤¤Ż¤Ä¤Ť¤ÎĽˇĽšĽĆĽŕš˝ŔŽ¤Ç
+ ǧ¤á¤é¤ě¤Ć¤¤¤ëĄ˘˛čĚ̤κ¸žĺ¤š¤ß¤ÎžŽ¤ľ¤¤Çň¤¤Ŕţźă¤Ż¤ĎĽľĄźĽĐ¤ËĚá¤Ă¤ż
+ ¸ĺ¤ÎĎĤó¤Ŕ˛čÁü¤ÎÍͤʲčÁü˝ń¤­šţ¤ß¤ÎĚäÂę¤ËÍ­¸ú¤Ç¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó
+ ¤ňťČ¤Ś¤ČŔ­Ç˝¤ŹÄ㲟¤ˇ¤Ţ¤š¤Î¤ÇĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ "clgd54xx" ĽÁĽĂĽ×ĽťĽĂĽČ
+ ĹëşÜ¤ľ¤ě¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤ňśŻŔŠĂľşş¤ľ¤ť¤Ţ¤šĄŁĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹŔľłÎ¤Ëǧźą¤ľ¤ě¤Ę¤¤¤Č¤ŤĄ˘ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę¤¤ĽÁĽĂĽ×
+ ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¸ß´šÉʤȤˇ¤Ćǧźą¤ľ¤ť¤ż¤¤žěšç
+ ¤ËÍ­¸ú¤Ç¤šĄŁ
+
+ videoram 1024 (Ëô¤Ďž¤ÎĂÍ)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽÓĽÇĽŞĽáĽâĽę¤ÎĂľşşĹëşÜÎ̤ΜŻŔŠťŘÄę¤Č¸˝šÔ¤ÎĽŤĄźĽÉ
+ ¤ËĽáĽâĽę¤ňÄɲ䚤ë¤Ő¤ę¤ň¤š¤ëžěšç¤ËťŘÄꤡ¤Ţ¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď
+ 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽęš˝ŔŽťţ¤ËĽÉĽéĽ¤ĽĐ¤ÎÍ׾áĽáĽâĽęÎ̤ȸߴšŔ­¤ŹĘݤƤĘ
+ ¤¤žěšç¤ËŁąMB °Ęžĺ¤ň¸Ť¤ť¤ż¤Ż¤Ę¤¤Ą˘¤Č¤ŤĽáĽâĽę¤ÎĂľşş¤Ź¤Ś¤Ţ¤ŻĆ°şî¤ˇ
+ ¤Ę¤¤¤Č¤­¤ËÍ­¸ú¤Ç¤šĄŁ¤ł¤ě¤Ď Device Ŕá¤ËÉŹ¤şťŘÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ "fifo_conservative" ĽŞĽ×ĽˇĽçĽó (5424/6/8/9/3x/46/6x/754x ¤Îžěšç¤ËťŘ
+ Äę)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď CRT FIFO ¤ÎÉßľďĂͤňšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Îšľ¤¨ĚܤĘ
+ ĂÍ (>= 65 MHz) ¤Ë ŔßÄꤚ¤ë¤â¤Î¤ÇĄ˘`śÚĄŚ°đşĘ'(`streaks') , `Ľ¸ĽĂ
+ ĽżĄŚÉÔ°ÂÄę'(`jitter') źă¤Ż¤Ď˛čĚ̤οĺĘżÎΰč¤ÎˇŤ¤ęĘÖ¤ˇÉ˝ź¨ (ĆäË
+ BitBLT Áŕşî¤ňšÔ¤Ă¤ż¤Č¤­,Î㤨¤ĐĽšĽŻĽíĄźĽë)¤ČˇÁÍƤľ¤ě¤ëĚäÂę¤ňŔ­Ç˝
+ ¤ŹÍî¤Č¤ˇ¤Ć¤âˇÚ¸ş¤ˇ¤ż¤¤žěšç¤ËÍ­¸ú¤Ç¤šĄŁ
+
+ "fifo_aggressive" ĽŞĽ×ĽˇĽçĽó (5424/6/8/9/3x/46/6x/754x ¤Îžěšç¤ËťŘ
+ Äę)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď CRT FIFO ¤ÎÉßľďĂͤňšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÎŔŃśËĹŞ¤Ę
+ ĂͤËŔßÄꤚ¤ë¤â¤Î¤ÇĄ˘Ä㤤Ęý¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻÍѤ˝ČÍѤš¤ë¤â¤Î¤ČĆą¤¸
+ ¤Ç¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ďšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤ÎŔ­Ç˝¤ň¸ţžĺ¤ľ¤ť¤Ţ¤šĄŁ
+
+ "no_2mb_banksel" ĽŞĽ×ĽˇĽçĽó (542x ¤Îžěšç¤ËťŘÄę)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤żĽŤĄźĽÉ¤Ç 1M ĽĐĽ¤ĽČ°Ę
+ žĺ¤ÎĽáĽâĽę¤ňÍ­¸ú¤Ë¤š¤ë `DRAM bank select' ĽÓĽĂĽČ¤ňŔßÄꤡ¤Ę¤¤¤â¤Î
+ ¤Ç¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď 512Kx8 ¤Î DRAM š˝ŔŽ¤ÇÍ­¸ú¤ÇĄ˘1M ĽĐĽ¤ĽČ°Ę
+ žĺ¤ň˛žÁ۲čĚ̤˝ȤäƤ¤¤ë 256Kx4/16 ¤Î DRAM š˝ŔŽ¤Îžěšç¤ĎĚľ¸ú¤Ç
+ ¤šĄŁ
+
+ "probe_clocks" ĽŞĽ×ĽˇĽçĽó
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽŤĄźĽÉ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňśŻŔŠĂľşş¤ˇ¤Ţ¤šĄŁĽŻĽíĽĂĽŻ
+ ¤Ź¸ÇÄę¤ÇÁ´¤Ć¤Î Cirrus ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÇĆą¤¸¤Ę¤éÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁ¤ˇ
+ ¤Ť¤ˇ¸˝žőɸ˝ŕ¤Î 14.31818 MHz ¤ÎźţÇČżô¤ňĽĐĽš¤ËśĄľë¤š¤ëĽŢĽśĄźĽÜĄźĽÉ
+ ¤Ë°Í¸¤ˇ¤Ţ¤šĄŁ´Ö°ă¤Ă¤ĆŔߡפľ¤ě¤ż VLB ¤ÎĽŢĽśĄźĽÜĄźĽÉ¤ĎĹŹŔľ¤ĘĽĐĽš
+ źţÇČżô¤Î¤ż¤á¤Î¤ł¤ÎźţÇČżô¤ňŔľ¤ˇ¤ŻśĄľë¤ˇ¤Ţ¤ť¤óĄĘÎ㤨¤Đ 33 MHz ¤Ť¤é
+ łČÄĽ¤ˇ¤ż¤â¤ÎĄËĄŁ¤â¤ˇ´Ö°ă¤Ă¤Ć¤¤¤ż¤éĄ˘¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤Ć`X
+ -probeonly ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽŻĽíĽĂĽŻ¤ŹźĄ¤Ëź¨¤šŔľ¤ˇ¤¤ĽŻĽíĽĂĽŻ
+ ¤Ť¤é¤Č¤Ć¤â°Ű¤Ę¤Ă¤Ć¤¤¤żžěšçĄ˘ XF86Config ¤Î Clocks šÔ¤Ë ĘФäƤ¤
+ ¤ëĘý¤ÎĽŻĽíĽĂĽŻ¤ňľ­Ćţ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎžěšçĄ˘MCLK ¤âĚň¤Ë¤ż¤Á¤Ţ¤ť
+ ¤óĄŁ
+
+ Ŕľ¤ˇ¤¤ĽŻĽíĽĂĽŻ:
+
+ 25.2 28.3 41.1 36.1 31.5 40.0 45.1 49.9
+ 65.0 72.2 75.0 80.0 85.2
+
+ "cirrus" ĽŻĽíĽĂĽŻĽÁĽĂĽ×
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤ň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁDevice Ŕá
+ ¤ËťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤ë¤ČĄ˘ĽŻĽíĽĂĽŻĽâĄź
+ ĽÉ¤ŹźŤĆ°¤ÇÁŞÂň¤ľ¤ě¤Ţ¤šĄŁClocks šÔ¤Ďľ­Ćţ¤ˇ¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎĽŞ
+ Ľ×ĽˇĽçĽó¤Ď 320x200 ¤ÎĽŔĽÖĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤Î¤ż¤á¤Î 12.5 MHz ¤ÎĽŻ
+ ĽíĽĂĽŻ¤ň˛ÄÇ˝¤Ë¤ˇ¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎźţÇČżô¤ĎÉÔ°ÂÄę¤Ë¤Ę¤ë¤Ť¤â¤ˇ¤ě¤Ę¤¤
+ ĄĘ`ÇČÂǤÄ' ˛čĚ̤Ź˝Đ¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄË¤Î¤ÇĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁťî¤ˇ
+ ¤ĆĄ˘ĽĆĽšĽČ¤ˇ¤żźţÇČżôĄĘɸ˝ŕĂͤΤ褌¤ËĄË¤Ŕ¤ą¤Ź°ÂÄę¤Ę¤Î¤ĎĘÝžÚ¤ˇ¤Ţ
+ ¤šĄŁ
+
+ "linear" ĽŞĽ×ĽˇĽçĽó (542x/6/8/9/3x/46/754x ¤Îžěšç¤ËťŘÄę)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď SVGA ĽĐĽóĽŻŔÚ¤ęÂؤ¨¤Ç¤ĎÉŹÍפΤʤ¤Á´ĽŐĽěĄźĽŕĽĐĽĂ
+ ĽŐĽĄ¤ňĽˇĽšĽĆĽŕĽáĽâĽę¤ÎČϰϤňÄś¤¨¤żšâ°Ě¤ÎĽ˘ĽÉĽěĽš¤Ţ¤Çłä¤ęÉŐ¤ą¤ëĽę
+ ĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ňÍ­¸ú¤Ë¤ˇ¤Ţ¤šĄŁ256 ż§ťţ¤ÎŔ­Ç˝¤Ź¸ţžĺ¤ˇ 16bpp
+ ¤Č 32bpp ¤Ç¤ĎÉŹżÜ¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ¤šĄŁžÜşŮ¤Ď ``ĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°
+ ¤Č 16bpp/32bpp ĽâĄźĽÉ''¤ÎŔá¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Membase 0x00e00000 (Ëô¤Ď°Ű¤Ę¤ëĽ˘ĽÉĽěĽš) (542x/6/8/9/3x/46/754x ¤Îžě
+ šç¤ËťŘÄę)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĘŞÍýĹŞ¤ĘĽęĽËĽ˘ĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄ¤ÎĽáĽâĽę´đÄ켢ĽÉĽě
+ Ľš¤ňŔßÄꤡ¤Ţ¤šĄŁ¤ł¤ě¤Ď Device Ŕá¤ËťŘÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁČó PCI
+ ¤ÎĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤Îš˝ŔŽ¤ËÉŹÍפǤšĄŁ
+
+ "favour_bitblt" ĽŞĽ×ĽˇĽçĽó (5426 ¤Î¤ß)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď BitBLT Ľ¨ĽóĽ¸Ľó ¤ňÍ­¸ú¤Ë¤ˇ¤ĆĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄ¤Î
+ ż§żô¤ňÁý¤ä¤šľĄÇ˝¤ň°ěČĚĹŞ¤ËÂŽ¤Ż¤š¤ë¤Î¤ËÍѤ¤¤Ţ¤šĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤Ď
+ CPU ¤ËÉé˛Ů¤Î¤Ť¤Ť¤Ă¤żĽˇĽšĽĆĽŕĄĘÎ㤨¤ĐĄ˘gcc ¤Čž¤ÎĽ×ĽíĽ°ĽéĽŕ¤ŹĆąťţ
+ ¤ËźÂšÔ¤ˇ¤Ć¤¤¤ëžěšç¤Ę¤ÉĄËĹůĄ˘°ěÄę¤Îžňˇď¤ÇŔ­Ç˝¤Î¸ţžĺ¤ň¤Ď¤Ť¤ę¤Ţ¤šĄŁ
+
+ "mmio" ĽŞĽ×ĽˇĽçĽó (5429/3x/46/754x)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎžŻ¤ˇÂŽ¤Ż¤Ę¤ëĽáĽâĽęĽŢĽĂĽ×ĽÉ I/O ¤ňťČ¤Ś 543x/5429
+ žĺ¤Î BitBLT Ľ¨ĽóĽ¸Ľó¤Č¤ÎŔÜÂł¤ňÍ­¸ú¤Ë¤ˇ¤Ţ¤šĄŁÉտ嵐¤ĆĽáĽâĽęĽŢĽĂĽ×
+ ĽÉ I/O ¤ňťČ¤ŚĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤âÍ­¸ú¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤ł¤ÎÉղþĄÇ˝¤Ď
+ BitBLT Ľ¨ĽóĽ¸Ľó¤ňťČ¤ď¤Ę¤¤¤Č¤­ĄĘÎ㤨¤ĐĄ˘"no_bitblt" ¤ňťČ¤Ă¤żžě
+ šçĄË¤Ď¸ú˛Ě¤Ź¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ "sw_cursor" ĽŞĽ×ĽˇĽçĽó (5429/3x/46/754x)
+ ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ĎĽÁĽĂĽ×¤ŹÄ󜥤š¤ëĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňĚľ¸ú¤Ë¤ˇ¤Ţ
+ ¤šĄŁĽŤĄźĽ˝Ľë¤ËĚäÂꤏ¤˘¤ë¤Č¤­¤Ëťî¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĆä˥˘5434/6 ¤Ç 85
+ MHz °Ęžĺ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤Ś¤Č¤­¤ËÍ­¸ú¤Ç¤š¤ŹĄ˘¤ł¤ě¤é¤ÎĽÁĽĂĽ×¤Ź
+ ¤˝¤ÎĽŻĽíĽĂĽŻ¤ÇĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ÎÁ´¤Ć¤ÎľĄÇ˝¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę
+ ¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ "clgd6225_lcd" ĽŞĽ×ĽˇĽçĽó
+ ¤¤¤Ż¤Ä¤Ť¤Î 62x5 ĽéĽĂĽ×ĽČĽĂĽ×ÍŃĽÁĽĂĽ×ĽťĽĂĽČ¤ÇşÇ¤âÇň¤¤ż§¤ň LCD ˛č
+ Ě̤ËÉ˝ź¨¤š¤ë¤Č¤­¤ÎĚäÂę¤ËÂФš¤ëÂĐşö¤ňÄ󜥤ˇ¤Ţ¤šĄŁ
+
+ 4. ĽâĄźĽÉ ¤Ë´Ř¤š¤ëľÄĎŔ
+
+ 256 ż§Ľ˘ĽŻĽťĽéĽěĄźĽżĽÉĽéĽ¤ĽĐ¤ĎĽÓĽÇĽŞĽáĽâĽęĆâ¤Î 256 ĽĐĽ¤ĽČĄ˘ĽĎĄźĽÉĽŚĽ§
+ Ľ˘ĽŤĄźĽ˝Ľë¤Ď 1K ĽĐĽ¤ĽČ ('6X ¤Ç¤Ď 2K ĽĐĽ¤ĽČ) ¤ňşîśČÎΰč¤ËťČ¤¤¤Ţ¤šĄŁ
+
+ ĆĂ¤Ë BitBlt ¤ňÉÁ˛čÍŃ¤ÎĽÓĽÇĽŞĽáĽâĽęÉý¤ŹžŽ¤ľ¤¤žěšç¤ËťČÍѤˇ¤ż¤Č¤­Ą˘¤č¤ęšâ
+ ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻźţÇČżô¤ĎĽ°ĽéĽŐĽŁĽĂĽŻÁŕşî¤ÎŔ­Ç˝¤ËČÝÄęĹŞ¤Ę¸ú˛Ě¤ňľÚ¤Ü¤ˇ¤Ţ
+ ¤šĄĘ542x/3x/46 ĽÁĽĂĽ×¤Ç¤ĎźţÇČżô¤ĎľŻĆ°ťţ¤ËÉ˝ź¨¤ľ¤ě¤Ţ¤šĄËĄŁ 542x/3x/46
+ ĽÁĽĂĽ×¤Ç¤ĎĄ˘É¸˝ŕ¤Î MCLK ¤ÎŔßÄę (0x1c) ¤Č 32-ĽÓĽĂĽČĽáĽâĽęĽ¤ĽóĽżĄźĽŐĽ§Ąź
+ Ľš¤ňťČÍѤˇ¤ż¤Č¤­Ą˘65 MHz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤ÎŔ­Ç˝¤Ď 25 MHz ¤ÎĽÉĽĂĽČĽŻ
+ ĽíĽĂĽŻťţ¤ÎŔ­Ç˝¤ÎȞʏ¤Ë¤Ę¤ëžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁĽáĽâĽęÉý¤ŹžŻ¤Ę¤¤¤Č¤­Ą˘¤Č¤Ć¤â
+ Ă٤Ż´ś¤¸¤ż¤éĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňşÇ¤âĂ٤¤ÍĆǧ¤Ç¤­¤ëĂͤˤˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁÎă
+ ¤¨¤Đšâ¤¤şĆÉÁ˛čÂŽĹŮĄĘ 50MHz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻĄË¤ňťČ¤Ă¤Ć 14" Ëô¤Ď 15" ¤Î
+ ĽâĽËĽżĄź¤ËÂ礭¤Ę˛žÁ۲čĚĚ¤Ç 800x600 ¤Î˛čĚ̤ňÉ˝ź¨¤š¤ë¤Î¤Ď¤˝¤ó¤Ę¤Ë°­¤Ż¤˘
+ ¤ę¤Ţ¤ť¤óĄŁ
+
+ 1024x768 ¤Ç şÇ¤âšâ¤¤ĽŻĽíĽĂĽŻ (85 MHz) ¤ň 542x ¤Î 76 Hz ¤ÇťČÍѤˇ¤żžě
+ šçĄ˘Ŕ­Ç˝¸ţžĺťŘ¸ţ¤Ë¤Ď¤Ę¤ę¤Ţ¤ť¤óĄŁĽŤĄźĽÉ¤ĎÂçÄńÄäťß¤ˇ¤Ţ¤šĄŁ75 MHz ¤ÎĽÉĽĂ
+ ĽČĽŻĽíĽĂĽŻ ¤ň 70 Hz ¤ÇťČ¤Ă¤żžěšç¤ĎËţ­¤Ç¤­¤ë¤Ç¤ˇ¤ç¤ŚĄŁ85 MHz ¤ÎĽÉĽĂĽČ
+ ĽŻĽíĽĂĽŻ¤Ë¤Ş¤¤¤Ć 76 Hz ¤Ç 1024x768 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽâĽËĽżĄź¤ňťý¤Ă¤Ć
+ ¤¤¤ëžěšç¤ĎĄ˘É¸˝ŕĹŞ¤Ę 5426/5428 ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤Č¤ĎÁęŔ­¤ŹÎɤŻ¤Ę¤¤¤Ç
+ ¤ˇ¤ç¤ŚĄŁ
+
+ 2M ¤ÎĽáĽâĽę¤ňŔѤó¤Ŕ 5434 ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤Ďšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ČÁęŔ­¤Ź
+ ÎɤŻĄ˘542x ĽˇĽęĄźĽş¤ËČć¤Ů DRAM Éý¤Ď´đËÜĹŞ¤Ë 2 Çܤ˘¤ę¤Ţ¤šĄŁËôĄ˘543x
+ ĽÁĽĂĽ×¤ÎÎŕ¤ĎťČÍѲÄÇ˝¤Ę DRAM Éý¤Ź°ěĂʤȸú˛ĚĹŞ¤ËłÎĘݤǤ­¤Ţ¤šĄŁ
+
+ 5. ĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ° ¤Č 16bpp/32bpp ĽâĄźĽÉ
+
+ ¸˝şßĄ˘SVGA ĽľĄźĽĐ¤ŹČ󼢼ŻĽťĽéĽěĄźĽż¤Î 16-ĽÓĽĂĽČ¤Č 32-ĽÓĽĂĽČĽÔĽŻĽťĽë¤ň
+ ĽľĽÝĄźĽČ¤š¤ë¤Ë¤ĎĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ŹÉŹżÜ¤Ç¤šĄŁ¤ł¤ÎŔŠĚó¤Ď¤Ś¤Ţ¤Ż¤¤¤ą¤Đ
+ ž­ÍčĹŞ¤Ë¤Ď¤ş¤ľ¤ě¤ë¤Ç¤ˇ¤ç¤ŚĄŁ"linear" ĽŞĽ×ĽˇĽçĽó ¤Ďżź¤ľ¤ňťŘÄꤚ¤ë
+ screen Ŕá¤ÇťŘÄꤚ¤ë¤ł¤Č¤ÇĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ňÍ­¸ú¤Ë¤ˇĄ˘Ëô MemBase ¤ň
+ (device Ŕá¤Ç) ŔßÄꤚ¤ëÉŹÍפŹ¤˘¤ë¤Ç¤ˇ¤ç¤Ś(¤ą¤ě¤É¤â 5446, 546x ¤Č ¤¤¤Ż¤Ä
+ ¤Ť¤Î 5436 ¤ň´đ¤Ë¤ˇ¤żĽÓĽÇĽŞĽŤĄźĽÉ¤Î¤č¤Ś¤Ę PCI ĽŤĄźĽÉ¤Ç¤ĎźŤĆ°ĹޤËÁŞÂň¤ľ
+ ¤ě¤Ţ¤š)ĄŁĽŤĄźĽÉ¤Ë¤č¤Ă¤Ć°Ű¤Ę¤ëš˝ŔŽ¤Ź¤¤¤Ż¤Ä¤â¤˘¤ę¤Ţ¤šĄŁ
+
+ ISA ĽĐĽšÍѤΠ542x/543x ¤Č 16M ĽĐĽ¤ĽČ¤Ť¤˝¤ě°Ęžĺ¤ÎĽˇĽšĽĆĽŕĽáĽâĽę¤Îžěšç¤Ď
+ ĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ĎÉÔ˛ÄÇ˝¤Ç¤šĄŁ16bpp ¤ĎťČ¤¨¤Ţ¤ť¤óĄ˘¤š¤¤¤Ţ¤ť¤óĄŁ14M
+ ĽĐĽ¤ĽČ°Ę˛ź¤ÎĽáĽâĽę¤Îžěšç¤Ď `MemBase 0x00e00000' ¤ňťČ¤Ś¤ł¤Č¤ÇĽŐĽěĄźĽŕ
+ ĽĐĽĂĽŐĽĄ¤ň 14M ĽĐĽ¤ĽČ¤Ëłä¤ęÉŐ¤ą¤ë¤ł¤Č¤Ź˛ÄÇ˝¤Ç¤šĄŁ`e' ¤Î¸ĺ¤í¤ËĽźĽí¤ňŁľ
+ ¤ÄÉŐ¤ą¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁťÄÇ°¤Ę¤Ź¤éÂż¤Ż¤Î ISA ĽŤĄźĽÉ¤ĎĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ň
+ ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ VESA ĽíĄźĽŤĽëĽĐĽšÍѤΠ5424/26/28/29 ¤Îžěšç¤ĎĄ˘žőśˇ¤Ď¤â¤Ă¤ČÉüť¨¤Ç¤šĄŁĽę
+ ĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤Ë¤Ä¤¤¤ĆŁ˛źďÎŕ¤Î°Ű¤Ę¤ëĽżĽ¤Ľ×¤ÎĽŤĄźĽÉ¤Ź¤˘¤ę¤Ţ¤š:
+
+ o ISA ĽĐĽšžĺ¤ÎĽŤĄźĽÉ¤Î¤č¤Ś¤Ë 16M ĽĐĽ¤ĽČ°Ę˛ź¤Ëłä¤ęÉŐ¤ą¤ëĽŤĄźĽÉĄŁËؤɤł
+ ¤Î¤č¤Ś¤ĘĽŤĄźĽÉ¤Ç¤ˇ¤ç¤ŚĄŁĆąÍͤĘŔŠĚóĄĘÎ㤨¤Đ 16M ĽĐĽ¤ĽČ¤č¤ęžŻ¤Ę¤¤ĽáĽâ
+ Ľę¤Ç¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ę¤¤ĄË¤ŹĹŹÍѤľ¤ě¤Ţ¤šĄŁ
+
+ o A26 ¤ÎĽ˘ĽÉĽěĽšĽéĽ¤Ľó¤ËŔÜÂł¤ˇ 64M ĽĐĽ¤ĽČ + 14M ĽĐĽ¤ĽČ¤â¤ˇ¤Ż¤Ď 64M ĽĐ
+ Ľ¤ĽČ¤Ëžď¤Ëłä¤ęÉŐ¤ą¤ëĽŤĄźĽÉĄŁ¤ł¤ÎžěšçĄ˘`MemBase 0x04e00000' ¤ŤËô¤Ď
+ `MemBase 0x04000000' ¤ňťŘÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁA26 ¤ň ťý¤Ă¤Ć¤¤¤ë VLB ĽŢĽśĄź
+ ĽÜĄźĽÉ¤ň˛žÄꤡ¤Ć¤¤¤Ţ¤šĄŁ¤Ţ¤ż¤ĎĽŤĄźĽÉ¤Ź 0x2000000 ¤Ëłä¤ęÉŐ¤ą¤ë¤Č¤ŤĄ˘
+ 5429 ¤Î¤č¤Ś¤ĘşÇśá¤ÎĽŤĄźĽÉ¤ĎÄĚžď 0x03e00000 (62M ĽĐĽ¤ĽČ) ¤Ëłä¤ęÉŐ¤ą
+ ¤Ć¤¤¤Ţ¤šĄŁ
+
+ ¿ʏĄ˘ťîšÔşř¸í¤ËÍę¤é¤Ę¤¤¤Č¤¤¤ą¤Ę¤¤¤Ç¤ˇ¤ç¤ŚĄŁ16M ĽĐĽ¤ĽČ¤č¤ęžŻ¤Ę¤¤Ľá
+ ĽâĽę¤Ę¤é¤Đ `¸í¤Ă¤ż' membase ¤ňŔßÄꤚ¤ë¤ČĽ°ĽéĽŐĽŁĽĂĽŻ˛čĚ̤ĎÉ˝ź¨¤Ç¤­
+ ¤Ţ¤ť¤ó¤ŹĄ˘ÂżĘŹĽłĽóĽČĽíĄźĽëĄÜĽŞĽëĽżĽÍĄźĽČĄÜĽĐĽĂĽŻĽšĽÚĄźĽš¤ňĆąťţ¤Ë˛Ą
+ ¤š¤ČĚá¤Ă¤Ć¤ł¤ě¤Ţ¤šĄŁ
+
+ 16M ĽĐĽ¤ĽČ°Ęžĺ¤ÎĽáĽâĽę¤Îžěšç¤ĎĄ˘şÇ˝é¤ÎĽżĽ¤Ľ×¤ÎĽŤĄźĽÉĄĘ¤Č´ÖČ´¤ą¤Ę VLB
+ ĽŢĽśĄźĽÜĄźĽÉ¤ÎŁ˛ČÖĚܤμżĽ¤Ľ×¤âĄË¤ÇĽĎĽóĽ°¤ˇ¤Ţ¤šĄĘ¿ʏĽĎĄźĽÉĽęĽÖĄźĽČ¤ŹźŤ
+ ČŻĹŞ¤ËľŻ¤ę¤Ţ¤šĄËĄŁ
+
+ ĽŤĄźĽÉ¤ÎĽżĽ¤Ľ×¤ĎĚܤdzÎǧ¤ˇ¤ĆĘŹ¤Ť¤ę¤Ţ¤šĄŁĽŤĄźĽÉ¤Ë A26 ĽÔĽó¤Ź¤˘¤ě¤ĐĄ˘64M
+ ĽĐĽ¤ĽČ°Ęžĺ¤Ëłä¤ęÉŐ¤ą¤ë¤â¤Î¤Ç¤ˇ¤ç¤ŚĄŁłÎǧ¤ňšÔ¤Ś¤Ë¤ĎĄ˘ĽŤĄźĽÉ¤ňČ´¤¤¤Ć˛ź¤ľ
+ ¤¤ĄŁVESA ĽíĄźĽŤĽëĽĐĽš¤ÎĽÔĽóĄĘĽŤĄźĽÉ¤ÎĽšĽíĽĂĽČ¤Ç¤Ę¤¤ÂŚ¤Ť¤é¸Ť¤ĆĽłĽÍĽŻĽż
+ ĽÔĽó¤ÎžŽ¤ľ¤¤Ęý¤ÎşŮÄš¤¤žŽĘҥˤǥ˘ąŚÂŚĄĘÁ´¤Ć¤ÎĽÁĽĂĽ×¤ŹźÂÁő¤ľ¤ě¤Ć¤¤¤ëĚĚĄË
+ ¤ňžÜ¤ˇ¤Ż¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ł¤Ë 45 ¸Ä¤ÎĽÔĽó¤Ź¤˘¤ę¤Ţ¤šĄŁĆâÂŚ¤Ť¤é 1 ¤Ť¤é 45
+ ¤Ţ¤ÇČÖšć¤ňżś¤ę¤Ţ¤šĄĘĽŤĄźĽÉ¤ÎĂź¤ÎĘý¤Ź45 Č֤ǤšĄËĄŁĆâÂŚ¤Ť¤éżô¤¨¤ĆĄ˘17 ČÖ
+ ĚܤμԼó¤ŹĚľ¤ŻĄ˘18 ČÖĚܤŤ¤é 20 ČÖĚܤޤǤϤ˘¤ë¤Čť×¤¤¤Ţ¤šĄŁ21 ČÖĚܤŹ A30
+ ¤ÇĄ˘22 ČÖĚܤŹ A28 Ą˘23 ČÖĚܤŹ A26 ¤Ç¤šĄŁ¤˝¤ˇ¤ĆĄ˘21 ČÖĚܤŤ¤é 23 ČÖĚܤÎ
+ ĽÔĽó¤ŹĚľ¤¤žěšçĄ˘ĽŤĄźĽÉ¤Ď 64M ĽĐĽ¤ĽČ°Ęžĺ¤Ëłä¤ęÉŐ¤ą¤ë¤ł¤Č¤Ď˝ĐÍč¤Ţ¤ť
+ ¤óĄŁ21 ČÖĚÜ¤Č 22 ČÖĚܤŹśő¤¤¤Ć¤¤¤ĆĄĘ¤Ţ¤ż¤ĎΞĘý¤˘¤ęĄËłî¤Ä 23 ČÖĚܤŹĽÔĽó
+ ¤Ź¤˘¤ëžěšçĄ˘64M ĽĐĽ¤ĽČ°Ęžĺ¤Ë¿ʏłä¤ęĹö¤Ć¤Ţ¤šĄŁĽŤĄźĽÉžĺ¤ÎĽÔĽó¤Î¤˝¤Đ¤ËžŽ
+ ¤ľ¤Ę˛óĎŠ¤Ź¤˘¤ëžěšçĄ˘¤Ť¤Ę¤ę¸Ťšţ¤ß¤Ź¤˘¤ë¤Čť×¤¤¤Ţ¤šĄŁ
+
+ ĽíĄźĽŤĽëĽĐĽšžĺ¤Î 543x ĽŤĄźĽÉ¤Ď¤č¤ęĂą˝ăĄĘCirrus Logic źŇ¤Î winsows ¤ÎĽÉ
+ ĽéĽ¤ĽĐ¤Ź¤ł¤ě¤ň¤Ä¤Ť¤Ă¤Ć¤¤¤Ţ¤šĄË¤Ç¤š¤ŹĄ˘ĚäÂꤏ̾¤¤¤ď¤ą¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ PCI ĽĐĽšžĺ¤ÎĽŤĄźĽÉ¤Ç¤ĎĄ˘PCI ĽŤĄźĽÉ¤ňĂľşş¤ˇ¤ż¤Č¤­¤ËźŤĆ°ĹŞ¤ËĽÉĽéĽ¤ĽĐ¤ŹĆÉ
+ ¤ßšţ¤ŕĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄ¤Î´đÄ켢ĽÉĽěĽš¤ňłĘÇź¤ˇ¤Ć¤¤¤ë PCI š˝ŔŽĽěĽ¸ĽšĽż¤ň
+ ťý¤Ă¤Ć¤¤¤Ţ¤šĄŁ`scanpci' Ľ×ĽíĽ°ĽéĽŕ¤Ď PCI š˝ŔŽ¤ňĆɤ߽Фˇ´đÄ켢ĽÉĽěĽš¤ň
+ ¸Ť¤Ţ¤šĄŁ
+
+ VESA ĽíĄźĽŤĽëĽĐĽšžĺ¤Ç¤ĎĄ˘ËؤɤΠ543x ĽŤĄźĽÉ¤Ď 64M ĽĐĽ¤ĽČ¤Îɸ˝ŕĹŞ¤Ęłä¤ę
+ ÉŐ¤ąĽ˘ĽÉĽěĽš¤ňťý¤Ă¤Ć¤¤¤ĆĄ˘ĽŞĽ×ĽˇĽçĽó¤Ç 2048M ĽĐĽ¤ĽČ ¤Č 32M ĽĐĽ¤ĽČ¤ň
+ Ľ¸ĽăĽóĽŃĽÔĽó¤ÇŔßÄꤡ¤Ţ¤šĄŁ¤ł¤ě¤ĎĽŤĄźĽÉ¤ËĆąş­¤ÎťńÎÁ¤Ë˝ń¤Ť¤ě¤Ć¤¤¤ë
+ ¤ŤĄ˘MS- Windows ¤Î system.ini ĽŐĽĄĽ¤Ľë¤Ë (linearaddr = <offset in
+ megabytes > Ĺů¤Č) ˝ń¤Ť¤ě¤Ć¤¤¤ë¤Ç¤ˇ¤ç¤ŚĄŁCirrus Logic ¤ŹÂż¤Ż¤Î VLB ĽŢĽś
+ ĄźĽÜĄźĽÉ¤ÎźÂÁőžőśˇ¤ňÄ´şş¤ˇ˛Ă¤¨¤ż¤â¤Î¤ÇĄ˘¤ł¤ě¤é¤Č°Ű¤Ę¤ëĽ˘ĽÉĽěĽšĽÔĽó¤Ë¤Ď
+ źÂÁő¤ˇ¤Ę¤¤¤Î¤Ç¤šĄŁĽÉĽéĽ¤ĽĐ¤Ď MemBase ¤ÎťŘÄꤏ̾¤¤žěšç¤Ďɸ˝ŕ¤Î 64M ĽĐĽ¤
+ ĽČ¤ň˛žÄꤡ¤Ţ¤šĄŁMemBase ¤ÎÎă¤ňžŻ¤ˇź¨¤ˇ¤Ţ¤š:
+
+ MemBase 0x02000000 32Mb
+ MemBase 0x04000000 64Mb
+ MemBase 0x80000000 2048Mb
+
+ şÇ¸ĺ¤ËĄ˘546X ĽÓĽÇĽŞĽŤĄźĽÉ¤Îžěšç¤ĎĽéĽĂĽ­Ąź¤Ť¤âĄŁż´Çۤš¤ë¤č¤Ś¤Ę "ş¤Ćń"
+ ¤Ď¤Ę¤¤¤Ç¤ˇ¤ç¤ŚĄŁ'6X ¤Ďžď¤ËĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ČĽáĽâĽęĽŢĽĂĽ×ĽÉ I/O ¤Č
+ 4GB śá¤¤ĽáĽâĽęĽ˘ĽÉĽěĽš¤ňťČÍŃ˝ĐÍč¤Ţ¤šĄŁPCI ¤ň¤É¤Ś¤žĄŞ
+
+ 16bpp ¤Č 32bpp ĽâĄźĽÉ¤ĎĄĘĽšĽŻĽíĄźĽëĄ˘ĽĆĽ­ĽšĽČĄ˘Ĺɤę¤Ä¤Ö¤ˇĄË¤Ë¸ÂÄꤡ¤ż
+ Ľ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤Ź¤˘¤ę¤Ţ¤š¤Ź¤˝¤ě¤Ç¤âĂ٤¤¤Č´ś¤¸¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤Ç¤âĄ˘
+ ĄĘ543x ¤Źťý¤Ă¤Ć¤¤¤ë¤č¤Ś¤ĘĄËÍĽ˝¨¤ĘĽíĄźĽŤĽëĽĐĽšĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš¤Ź˝˝ĘŹ˝ő
+ ¤ą¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁÉ¸˝ŕ¤Î fbc ĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽ×ĽíĽ°ĽéĽŕ¤ĎÇňšő¤ÎĹŔÉÁ¤Č
+ ĽÓĽĂĽČĽŢĽĂĽ×¤Ç¤Ď¤Č¤Ć¤âĂ٤¤¤Ç¤ˇ¤ç¤ŚĄŁ 32bpp ĽâĄźĽÉ¤ĎşÇÄă 2M ĽĐĽ¤ĽČ¤ÎĽá
+ ĽâĽę¤ňĹëşÜ¤ˇ¤ż°ěÉô¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤Ç¤Î¤ßĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ XF86Config ¤Î "Screen" Ŕá¤Î¤Ę¤Ť¤ÎĄ˘ "Display" šŕ(subsection) ¤Ë Modes
+ ¤Č ˛žÁ۲čĚ̤ÎÂ礭¤ľ¤ňĘŹ¤ą¤ĆĆ°¤Ť¤ˇ¤ż¤¤żź¤ľËč¤ËÄęľÁ¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť
+ ¤óĄŁÎăĄĘ2M ĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ÎžěšçĄË¤Ď:
+
+ Section "screen"
+ SubSection "Display"
+ Depth 8
+ Virtual 1280 1024
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ Option "linear"
+ EndSubSection
+ SubSection "Display"
+ Depth 16
+ Virtual 1024 992
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ Option "linear"
+ EndSubSection
+ SubSection "Display"
+ Depth 32
+ Virtual 832 600
+ ViewPort 0 0
+ Modes "640x480" "800x600"
+ Option "linear"
+ EndSubSection
+ EndSection
+
+ 6. "cl64xx" ĽÉĽéĽ¤ĽĐ
+
+ cl64xx ĽÉĽéĽ¤ĽĐ¤ĎÂż¤Ż¤ÎĽéĽĂĽ×ĽČĽĂĽ×ÍѤΠcl-gd6440 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁÎă
+ ¤¨¤ĐĄ˘Sager, ProStar Ĺů ¤Č Texas Instruments TI4000 ĽˇĽęĄźĽş¤Ë OEM Äó
+ śĄ¤ľ¤ě¤Ć¤¤¤ë Nan Tan ĽłĽóĽÔĽĺĄźĽż¤Î NP9200,NP3600 Ĺů¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ
+ ĽÉĽéĽ¤ĽĐ¤Ď LCD ŔěÍѼ⥟ĽÉĄ˘ CRT ŔěÍѼ⥟ĽÉ¤Č LCD ¤Čł°Éô CRT ĽÇĽŁĽšĽ×Ľě
+ Ľ¤¤ňĆąťţ¤ËťČ¤¨¤ë¤č¤Ś¤Ë¤š¤ëĽÁĽĂĽ×¤Îťý¤Ä SimulScan ĽâĄźĽÉ¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁ
+ LCD ¤Č SimulScan ĽâĄźĽÉ¤Î˛ňÁüĹŮ¤Ď 640x480 ¤ŹĄ˘CRT ŔěÍѼ⥟ĽÉ¤Ç¤Ď
+ 640x480, 600x800 ¤Č 1024x768 ¤Î ɸ˝ŕ VESA ĽâĄźĽÉ¤ŹĽĆĽšĽČşŃ¤ß¤Ç¤šĄŁ
+ 1024x768 Ľ¤ĽóĽżĽěĄźĽšĽâĄźĽÉ¤ĎĽÇĽĐĽĂĽ°¤ˇ¤Ć¤Ţ¤ť¤ó¤ˇĄ˘ĽĆĽšĽČÍŃľĄ¤Ç¤âĆ°şî
+ ¤ˇ¤Ć¤Ţ¤ť¤óĄŁ
+
+ ťńÎÁ¤Ë¤Ę¤Ă¤Ć¤¤¤ëśîĆ°ĹĹ°ľ¤Ë°Í¸¤š¤ëĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÎşÇÂç˛ÔĆŻžĺ¸Â¤Ź¤˘¤ę¤Ţ
+ ¤šĄŁĆĂ¤Ë 5.0V ¤Ç¤ÎşÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ď 65MHz ¤Ç 3.3V ¤Ç¤ÎşÇÂçĽÉĽĂĽČĽŻ
+ ĽíĽĂĽŻ¤Ď 40MHz ¤Ç¤šĄŁĽÉĽéĽ¤ĽĐ¤ĎśîĆ°ĹĹ°ľ¤ňłÎǧ¤ˇ¤ĆĹŹŔľ¤ĘĂͤ˺ÇÂçĽÉĽĂĽČ
+ ĽŻĽíĽĂĽŻ¤ňŔŠ¸Â¤ˇ¤Ţ¤šĄŁ¤ł¤ě¤Ź 60Hz ¤ÎşĆÉÁ˛čÂŽĹŮťţ¤ÎĚó 1024x768 ¤ÎşÇÂç˛ň
+ ÁüĹ٤ËĘŃ´š¤ľ¤ě¤Ţ¤šĄŁĆâ¢ȯżś´ď(frequency generator) ¤Ď¤ł¤ě¤é¤Îžĺ¸Â¤č¤ę
+ šâ¤¤ĂÍ¤ËĽ×ĽíĽ°ĽéĽŕ¤ľ¤ě¤Ć¤¤¤ĆĄ˘ĽľĄźĽĐ¤ÎľŻĆ°ťţ¤Ë˝Ö´ÖĹŞ¤ËĽÁĽĂĽ×¤Î˛ÔĆŻžĺ¸Â
+ ¤ňÄś¤¨¤ë¤č¤Ś¤ĘĽŻĽíĽĂĽŻ¤ňĂľşş¤ľ¤ť¤Ţ¤šĄŁ°ěÜͭ¸ú¤ĘĽŻĽíĽĂĽŻ¤ÎÁȤߚç¤ď¤ť¤Ź
+ ĆŔ¤é¤ě¤ż¤éĄ˘XF86Config ¤Î Clocks šÔ¤Ë˝ń¤¤¤Ć¤Ş¤Ż¤ł¤Č¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ¤ł
+ ¤ě¤ňšÔ¤Ś¤ČľŻĆ°¤Ë¤Ť¤Ť¤ëťţ´Ö¤ŹĂř¤ˇ¤Ż¸şžŻ¤ˇ¤Ţ¤šĄŁĽŻĽíĽĂĽŻ¤Ď X ĽľĄźĽĐĄź¤Ë
+ -probeonly ¤ňÉŐ¤ą¤ĆźÂšÔ¤š¤ëťö¤Ë¤č¤Ă¤ĆĆŔ¤é¤ě¤Ţ¤šĄĘ-probeonly ¤Ë¤Ä¤¤¤Ćžđ
+ Ęó¤ň¤â¤Ă¤ČĂΤꤿ¤¤žěšç¤Ď XFree86 ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ¤Î¤ł
+ ¤ČĄËĄŁ
+
+ ĽÇĄźĽżĽÖĽĂĽŻ¤Ë¤ĎĽÁĽĂĽ×¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë 1 ĽáĽŹĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽáĽâĽę¤Î
+ š˝ŔŽ¤Ŕ¤ą¤Źź¨¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎÂ礭¤ľ¤ĎĽÉĽéĽ¤ĽĐ¤ÇÄžŔÜŔßÄꤡ¤Ć¤¤¤Ţ¤šĄŁÉŹ
+ Íפ˹ţ¤¸¤ĆĄ˘˝é´üĂͤμáĽâĽęĽľĽ¤Ľş¤ň XF86Config ¤Ë˝ń¤¤¤Ć¤Ş¤Ż¤ł¤Č¤â˝ĐÍč¤Ţ
+ ¤šĄŁ¤Ţ¤żĄ˘1M ĽĐĽ¤ĽČ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ÇÎ㤨¤Đ 1024x1024 ¤Î¤č¤Ś¤ĘÂ礭¤ľ¤Î˛ž
+ Á۲čĚ̤ňťý¤Ä¤ł¤Č¤Ź¤Ç¤­Ą˘¤ł¤ě¤Ď CRT ŔěÍѤβčĚ̼⥟ĽÉ¤ÇťČÍѲÄÇ˝¤Ç¤šĄŁ¤ˇ
+ ¤Ť¤ˇĄ˘LCD (LCD ¤Č SimulScan) ¤ňťČ¤Ś¤Č¤­¤Ď¤¤¤Ä¤Ç¤âĽÁĽĂĽ×¤ĎĽÓĽÇĽŞĽáĽâĽę
+ ¤Îžĺ°Ě¤Î°ěÉô¤ň¤˝¤ěźŤżČ¤ÎĆâÉô¤Î˛ĂÂŽ˝čÍý¤Î¤ż¤á¤ËťČÍѤˇ¤Ţ¤šĄŁ˝ž¤Ă¤ĆĄ˘ LCD
+ ĽâĄźĽÉ¤Ç˛žÁ۲čĚ̤ňťČÍѤš¤ë¤Č¤­¤ÎşÇÂç¤ÎĽÓĽÇĽŞĽáĽâĽę¤ĎĚó 0.75M ĽĐĽ¤ĽČ¤Ę
+ ¤Î¤ÇÎ㤨¤Đ 1024x768 ¤Î¤č¤Ś¤Ę˛ňÁüĹ٤ˤʤë¤Î¤Ç¤šĄŁžĺľ­¤Î¤č¤Ś¤Ę˛žÁ۲ňÁüĹŮ
+ ¤ňŔßÄꤡ¤żžěšç¤ËžŽ¤ľ¤ŻŔÚ¤ęźč¤é¤ě¤ż˛čĚ̤˲ĂÂŽ˛˝¤ľ¤ě¤żÎΰ褏ɽź¨¤ľ¤ě¤Ţ
+ ¤šĄŁ
+
+ ¸˝şßĄ˘LCD, CRT ¤Č SimulScan ¤ÎłĆ˛čĚ̼⥟ĽÉ´Ö¤ÎŔÚ¤ęÂؤ¨¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤
+ ¤Ţ¤ť¤ó¤ŹĄ˘žŻ¤Ę¤Ż¤Č¤â NP9200 ¤Ç¤Ď OS ¤ÎĽÖĄźĽČťţĄĘÎ㤨¤Đ Linux ¤Î LILO
+ ¤ÇĄËBIOS ¤ŹĚ¤¤ŔťĎĆ°¤š¤ëÁ°¤ËĽâĄźĽÉ¤ÎÁŞÂň¤Ź˝ĐÍč¤ë¤č¤Ś¤Ë¤Ę¤Ă¤Ć¤Ţ
+ ¤šĄŁXF86Config ¤ËModeLine ĽŞĽ×ĽˇĽçĽó¤ňÄɲ䚤ě¤Đ˛čĚ̼⥟ĽÉ¤ÎÁŞÂň¤Ź X
+ ĽľĄźĽĐ¤ÎĆâÉô¤Ť¤éĆ°ĹŞ¤Ë˛ÄÇ˝¤Ë¤Ę¤ę¤Ţ¤šĄŁşÇ¸ĺ¤ËĄ˘ĽÉĽéĽ¤ĽĐ¤Ď¸˝žő¤ÇĽÁĽĂĽ×¤Î
+ ÄăžĂČńĹĹÎĎľĄÇ˝¤ČĽšĽŻĽęĄźĽóĽťĄźĽĐĄź¤Ë¤č¤Ă¤Ć˛čĚ̤ŹžĂ¤¨¤Ć¤¤¤ë¤Č¤­¤Î LCD
+ ¤ÎĽĐĽĂĽŻĽéĽ¤ĽČ¤ÎžĂĹô¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁž­Íč¤ÎĽĐĄźĽ¸ĽçĽó¤Ç¤ł¤ě¤éÁ´
+ ¤Ć¤ÎľĄÇ˝¤ŹźÂ¸˝¤š¤ë¤ł¤Č¤ň´üÂÔ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ CL-GD6420 ¤Ë´Ř¤š¤ëĂí°Őťöšŕ:
+
+ ĽÓĽÇĽŞĽáĽâĽę¤ÎÎ̤ŹťţĄšŔľ¤ˇ¤ŻĂľşş¤Ç¤­¤Ę¤¤žěšç¤Ź¤˘¤ę¤Ţ¤šĄŁŁ˛¤Ä¤Î˛ňˇčĘýËĄ
+ ¤ŹĽÉĽéĽ¤ĽĐ¤ÎĽ˝ĄźĽšĽłĄźĽÉ¤Ë¤˘¤ęĄ˘Łą¤Ä¤ĎÄęľÁ¤ˇ¤Ć¤ˇ¤Ţ¤Ś¤ł¤Č¤Ç¤šĄŁ¤â¤Ă¤ČÎÉ
+ ¤¤ĘýËĄ¤Ď Device Ŕá¤Î VideoRam šÔ¤ËĽÓĽÇĽŞĽáĽâĽę¤ÎÎ̤ňťŘÄꤚ¤ë¤ł¤Č¤Ç¤šĄŁ
+ CRT Ëô¤Ď SIMulscan ĽâĄźĽÉ¤Ç¤Ďɸ˝ŕĹŞ¤Ę 640x480 60Mhz ¤Ç 25.175 MHz ¤Î
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤Îɸ˝ŕĽâĄźĽÉÄ´Ŕ°¤ňšÔ¤Ă¤Ć˛ź¤ľ¤¤ĄŁLCD ŔěÍѤμ⥟ĽÉ¤Ç¤ĎĆą
+ Íͤμ⥟ĽÉÄ´Ŕ°¤ňšÔ¤¨¤Ţ¤š¤ŹĄ˘16.257 MHz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňÍѤ¤¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁÉ¸˝ŕ¤Î 56 Hz 800x600 ¤â CRT ¤ÇĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ "cl64xx" ĽÉĽéĽ¤ĽĐ¤Ç¤Î cl6440 ¤Ë´Ř¤š¤ëĚäÂę¤ĎRandy Hendry
+ <randy@sgi.com> ťá¤Ţ¤ÇŔ褺şÇ˝é¤ËϢÍí¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7. "cirrus" ĽÉĽéĽ¤ĽĐ¤Ç¤Îžăł˛ÂĐşö¤Î¤Ţ¤Č¤á
+
+ Ŕ褺şÇ˝é¤ËĄ˘XF86Config ¤ÇÁŞÂň¤ˇ¤żĽâĄźĽÉ¤ňĽâĽËĽżĄź¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë¤ł
+ ¤ČĄ˘¤Ä¤Ţ¤ężĺʿƹ´ü¤Îžĺ¸Â¤ŹŔľ¤ˇ¤¤¤ł¤Č¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ25.175 MHz ¤Î
+ ĽŻĽíĽĂĽŻ¤Çɸ˝ŕĹŞ¤Ę 640x480x256 ĄĘĂą°ě¤Îżĺʿƹ´ü¤ň 31.5 ¤ËťŘÄꤡ¤żžě
+ šçĄË¤Źš˝ŔŽžĺĽÉĽéĽ¤ĽĐ¤ŹĆ°şî¤š¤ë¤ł¤Č¤ÎłÎǧ¤Ť¤é¤Ď¤¸¤á¤ë¤Î¤Ź¤Ş´Ť¤á¤Ç¤šĄŁ
+ timing Ŕá¤Ë¤ł¤Î˛ňÁüĹŮÍѤκǚâ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňĂÖ¤¤¤ĆĄ˘mode šÔ¤ÎşÇ˝é¤Ë
+ ˝ń¤¤¤żĽâĄźĽÉ¤Źžď¤Ë˝é´üĂͤμ⥟ĽÉ¤Č¤ˇ¤ĆÍѤ¤¤é¤ě¤Ţ¤šĄŁ
+
+ ¤¤¤Ż¤Ä¤Ť¤Î VESA ɸ˝ŕĽâĄźĽÉ¤ÎÄ´Ŕ°¤Ź¤¤¤Ż¤Ä¤Ť¤ÎĽâĽËĽżĄź¤ÇĚäÂę¤ňľŻ¤ł¤ˇ¤Ţ¤š
+ ¤Î¤ÇĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄĘżĺʿƹ´üżŽšć¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤Ä¤Ţ¤ężż¤óĂć¤Î
+ Ł˛¤Ä¤ÎżôĂͤκš¤ňš­¤˛¤ëĄ˘źă¤Ż¤ĎÁ´¤Ć¤Îżĺʿƹ´ü¤ÎÄ´Ŕ°żôĂͤň 16 Ëô¤Ď 32 ¤Î
+ ÇÜżô¤Ë¤Ę¤ë¤č¤Ś¤ËÁý¤ä¤šĄËĄŁ
+
+ ĽÓĽÇĽŞżŽšć¤ŹĆϤ¤¤Ć¤¤¤ë¤ŹĄ˘˛čĚ̤ŹĆą´ü˝ĐÍč¤Ę¤¤žěšçĄŁ
+ ĽâĽËĽżĄź¤Ź°ˇ¤¨¤Ę¤¤ĽâĄźĽÉ¤ňťČ¤Ă¤Ć¤¤¤ë¤Î¤Ç¤šĄŁÉ¸˝ŕ¤Ç¤Ę¤¤ĽâĄźĽÉ¤ň
+ ťČ¤Ă¤Ć¤¤¤ëžěšçĄ˘žŻ¤ˇżôĂͤňÄž¤šÉŹÍפŹ¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁĽâĽËĽżĄź
+ ¤Źźč¤ę°ˇ¤¨¤ëɸ˝ŕĽâĄźĽÉ¤Čɸ˝ŕźţÇČżô¤ÎžěšçĄ˘ť÷¤ż¤č¤Ś¤ĘĽâĄźĽÉ¤ČźţÇČ
+ żô¤Ç°Ű¤Ę¤ëżôĂͤÎÁȤߚç¤ď¤ť¤ň¸Ť¤Ä¤ą¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ šâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤Î żĺĘżĽ¸ĽĂĽżĄĘÉÔ°ÂÄę´śĄË
+ Ćä˞ĺ¤ËĽšĽŻĽíĄźĽë¤š¤ë¤č¤Ś¤ĘÉÁ˛čÁŕşî¤ňšÔ¤Śťţ¤Ë¤ł¤ÎĚäÂꤏ¸Ť¤é¤ě¤Ţ
+ ¤šĄŁ542x/3x/46/6x ¤ňťČ¤Śžěšç¤Ď "fifo_conservative" ĽŞĽ×ĽˇĽçĽó¤ň
+ ťî¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤ŹźşÇÔ¤ˇ¤ż¤Č¤­¤ĎĄ˘"fast_dram" ĽŞĽ×ĽˇĽçĽó¤ňťî
+ ¤š¤ŤĄ˘¤č¤ęÄ㤤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤Ă¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤Ç¤âËţ­¤¤
+ ¤Ť¤Ę¤¤žěšç¤ĎĄ˘"noaccel" ĽŞĽ×ĽˇĽçĽó¤ŤĄ˘"no_bitblt" ĽŞĽ×ĽˇĽçĽó¤ŹÂż
+ ĘŹ˝ő¤ą¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ `ÇČÂǤÄ'(`Wavy') ˛čĚĚĄŁ
+ ˛čĚ̤οĺĘżÍɤěËô¤ĎÁ´ÂΤμ¸ĽĂĽż¤ŹĄĘÉÁ˛čÁŕşî¤Ë°Í¸¤ˇ¤Ę¤¤¤ÇĄË´ÖĂǤĘ
+ Âł¤Ż¸˝žÝ¤Ç¤šĄŁÂżĘŹĄ˘šâ¤š¤Ž¤ëĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤Ă¤Ć¤¤¤ë¤ť¤¤¤ÇĄ˘śá
+ ¤¤źţÇČżô¤Î MCLK ¤Č´łžÄ¤ŹľŻ¤­¤Ć¤¤¤ë˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁ¤â¤Ă¤ČÄ㤤
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťî¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤Ţ¤żĄ˘ĽâĄźĽÉ¤ÎżôĂÍÄ´Ŕ°¤ňšÔ¤Ă¤ĆĄ˘Ł˛
+ ČÖĚܤοĺĘżĘý¸ţ¤Îżôťú¤ň¤¤¤Ż¤é¤ŤÁý¤ä¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁźĄ¤Ď 65MHz
+ ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç 1024x768 ĄĘĚó 60 HzĄË¤ÎĽâĄźĽÉ¤Ź˝ő¤ą¤Ë¤Ę¤ë¤Ď¤ş
+ ¤Ç¤šĄŁ:
+
+ "1024x768" 65 1024 1116 1228 1328 768 783 789 818
+
+ Clockchip "cirrus" ¤ňÍѤ¤¤ĆĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤ňťČÍѤˇ¤Ć¤¤¤ëžěšç
+ ¤ĎĄ˘¤ł¤ě¤ňĚľ¸ú¤Ë¤ˇ¤Ćɸ˝ŕĂͤμŻĽíĽĂĽŻ¤ÎÁȤߚç¤ď¤ť¤ňťČ¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ľŻĆ°¤ˇ¤ż¸ĺ¤Ç˛čĚ̤ŹĘř¤ě¤ëĄ˘ťß¤Ţ¤ëĄĘ˛čĚ̤Źżż¤Ă°Ĺ¤Ë¤Ę¤ë¤Ť¤âĄËĄŁ
+ "noaccel" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁ¤â¤ˇĆ°¤Ť¤Ę¤Ť¤Ă¤żžěšçĄ˘¤¤
+ ¤Ż¤é¤ŤŔ­Ç˝¸ţžĺ¤Î°Ů¤Ë "no_bitblt" ¤ňťî¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ BIOS ¤Î
+ ŔßÄꤏÂçžćÉפŤ¤É¤Ś¤ŤłÎǧ¤ˇ¤ĆĄ˘ĆĂ¤Ë 0xa0000-0xaffff ¤ňĽ­ĽăĽĂĽˇĽó
+ Ľ°¤ˇ¤Ę¤¤¤č¤Ś¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁÎ˘ DRAM ¤Îššżˇ(hidden DRAM refresh)
+ ¤ňĚľ¸ú¤Ë¤ˇ¤Ć¤âÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Ľ°ĽéĽŐĽŁĽĂĽŻÁŕşî¤Î¸ĺ¤Î˛čĚ̤ŹĘř¤ě¤ëĄ˘ťß¤Ţ¤ëËô¤Ď¤´¤ß¤ŹťÄ¤ëĄŁ
+ Ľ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤Î°ě¤ÄĄ˘Ëô¤Ď BitBLT ľĄÇ˝¤ňťČ¤Ă¤ż¤Č¤­¤ÎĽ×ĽíĽ°Ľé
+ Ľŕ¤ÎĽĐĽ°¤Ë´ŘϢ¤ˇ¤Ć¤¤¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ"noaccel" ĽŞĽ×ĽˇĽçĽóËô¤Ď
+ "no_bitblt" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤Ţ¤żĄ˘BIOS ¤ÎŔßÄę¤ň
+ łÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽľĄźĽĐ¤Ź `Blitter timeout' ¤Č¤¤¤ŚĽáĽĂĽťĄźĽ¸¤ň˝ĐÎϤš¤ëĄŁ
+ Ćą¤¸ŔßÄꤏĽŔĽÖ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ ˛čĚ̤ŹżâÄžĘý¸ţ¤Ëźţ¤ęšţ¤ó¤Ç (`wrapped') ¤¤¤ëĄŁ (542x/3x/46 ¤Îžěšç)
+ DRAM š˝ŔŽ¤ËĚäÂꤏ¤˘¤ë¤ł¤Č¤ňź¨¤ˇ¤Ć¤¤¤Ţ¤šĄŁĽŤĄźĽÉ¤ËŁ˛ĽáĽŹĽĐĽ¤ĽČ¤Î
+ ĽáĽâĽę¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘"no_2mb_banksel" ĽŞĽ×ĽˇĽçĽó¤ŤĄ˘ŁąĽá
+ ĽŹĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤Ŕ¤ą¤ň˛žÁ۲čĚ̤˝ȤŚžěšçĄ˘ videoram "1024" ¤ňťî
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĂźËöĽŚĽŁĽóĽÉĽŚ¤Îʸťú¤Ź¤Ë¤¸¤ŕĄŁ
+ ɸ˝ŕ¤Ç¤Ę¤¤ĽÓĽÇĽŞ¤ÎźÂÁő¤Ë¤ĆĘóšđ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ "no_bitblt" ĽŞĽ×
+ ĽˇĽçĽó¤ňťČ¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ĽéĽĂĽ×ĽČĽĂĽ×ÍŃĽÁĽĂĽ×ĽťĽĂĽČ¤Ç°đşĘ¤ŹÁö¤ëËô¤Ďťß¤Ţ¤ë
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Źšâ¤š¤Ž¤ë¤ż¤áĄ˘ÉÁ˛čÍѤÎÂÓ°čÉý¤Ź¤Č¤Ć¤âžŻ¤Ę¤Ż¤Ę¤Ă¤Ć
+ ĄĘÎ㤨¤ĐĄ˘512K ĽĐĽ¤ĽČ¤ÎĽŤĄźĽÉ¤Ç 40MHz ¤ňťČ¤ŚžěšçĄË¤¤¤ë¤ŤĄ˘ĄĘ
+ 5422 ¤Î¤č¤Ś¤ĘĄËĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤ËľŻ¤ł¤ę¤Ţ¤šĄŁ
+
+ ťţĄšĘ¸ťú¤ÎĽÉĽĂĽČ¤ŹČ´¤ą¤ëĄ˘ÁëĎȤňĆ°¤Ť¤š¤ČĽÉĽĂĽČ¤Î¤´¤ß¤Ź˝Đ¤ëĄŁ
+ ¿ʏĄ˘šâ¤š¤Ž¤ë MCLK ¤ÎŔßÄꤏ´Řˇ¸¤ˇ¤Ć¤¤¤Ţ¤šĄĘĽĐĽóĽŻĽâĄźĽÉ¤ŹÂçžćÉ×
+ ¤Ç¤âĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤Ź°ú¤­ľŻ¤ł¤š¤Ç¤ˇ¤ç¤ŚĄËĄŁ
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹÇ§źą¤Ç¤­¤Ę¤¤ĄŁ
+ ťČ¤Ş¤Ś¤Č¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Ëť÷¤ż¤â¤Î¤ňśŻŔŠťŘÄꤚ¤ë¤ł¤Č¤ňťî¤ˇ¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ
+
+ ťţĄšĄ˘´Ö°ă¤Ă¤żžŽ¤ľ¤¤ŔţĘŹĄĘËؤɤŹÇň¤¤ĄË¤Ź¸˝¤ď¤ě¤ë
+ ĽˇĽšĽĆĽŕ¤Ť¤éĽÓĽÇĽŞĽáĽâĽę¤Ř¤Î BitBLT Áŕşî¤Ë´Ř¤š¤ëĚäÂę¤Ë´Řˇ¸¤ˇ¤Ć¤¤
+ ¤Ţ¤šĄŁ¤¤¤é¤¤¤é¤š¤ëžěšç¤Ď "no_imageblt" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤ß¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ
+
+ ĽĆĽ­ĽšĽČĽâĄźĽÉ¤ŹĹŹŔڤ˲óÉü¤ˇ¤Ę¤¤
+ ¤¤¤Ż¤Ä¤Ť¤Îš˝ŔŽ¤ÇĘóšđ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁXFree86 3.1 ¤Î SVGA ĽľĄźĽĐ¤ÎĂľ
+ şş¤ŹĄ˘Chipset šÔ¤ÇÍ׾ᤡ¤ż 543x ¤ÎĽěĽ¸ĽšĽż¤ÎĆâÍƤň˛ő¤ˇ¤ż¤Ť¤â¤ˇ¤ě
+ ¤Ţ¤ť¤óĄŁÉáÄ̤ϼ楟ĽĆĽŁĽęĽĆĽŁ ( Linux ¤Î setfont, runx,
+ restorefont) ¤ÇĽĆĽ­ĽšĽČĽâĄźĽÉ¤Ď˛óÉü˛ÄÇ˝¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Čóžď¤Ëšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÇťśĚĄ¤ĘĽˇĽšĽĆĽŕľóĆ°¤ňľŻ¤š
+ ĽŤĄźĽÉłî¤ÄĄżËô¤ĎĽŢĽśĄźĽÜĄźĽÉ¤ÎŔߡפËÉÔÎɤΤ˘¤ëžěšçĄ˘ĽÓĽÇĽŞĽŤĄźĽÉ
+ žĺ¤Îšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ČĽˇĽšĽĆĽŕĆâ¤Îž¤ÎÉôĘŹĄĘÎ㤨¤Đ ĽÇĽŁĽšĽŻ
+ I/OĄË¤Č¤ÎĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš¤Ź¤Ś¤Ţ¤Ż¤¤¤Ť¤Ę¤¤ťţ¤ËČŻŔ¸¤š¤ë˛ÄÇ˝Ŕ­¤Ź¤˘
+ ¤ę¤Ţ¤šĄŁĄĘ¤´¤Ż¤Ţ¤ě¤ËĄ˘ 5428 ĽÁĽĂĽ×¤Ź PCI ¤ňĽľĽÝĄźĽČ¤ˇ¤Ę¤¤ťţ¤ËĄË
+ ¤¤¤Ż¤Ä¤Ť¤Î PCI¤Î 5428 ¤ň´đ¤Ë¤ˇ¤żĽŤĄźĽÉ¤Ç´ŃÂŹ¤ľ¤ě¤Ţ¤šĄŁ
+
+ ¤˝¤Îž¤Î˛čĚĚÉÁ˛č¤Ë´Ř¤š¤ëĚäÂꤏŔ¸¤¸¤żžěšç¤ĎĄ˘ ( "no_bitblt" ¤Ź˝ő¤ą¤Ë¤Ę
+ ¤é¤Ę¤¤žěšç¤Ë) "noaccel" ĽŞĽ×ĽˇĽçĽó¤ňťî¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ¤ł¤Îʸ˝ń¤Ëľ­˝Ň¤ÎĚľ¤¤ĽÉĽéĽ¤ĽĐ¤Ë´Ř¤š¤ëĚäÂꥢËô¤ĎĽ˘ĽŻĽťĽéĽěĄźĽżľĄÇ˝¤Ë¤Ä¤¤
+ ¤ĆĽĐĽ°¤ňČŻ¸Ť¤ˇ¤żžěšç¤Ď XFree86 ĽÁĄźĽŕĄĘ¸˝şßĄ˘ĽÉĽéĽ¤ĽĐ¤ÎĘÝźé¤Ď
+ H.Hanemaayer@inter.nl.net ¤ÇšÔ¤Ă¤Ć¤¤¤Ţ¤šĄË¤ËϢÍí¤ň˛ź¤ľ¤ë¤ŤĄ˘
+ "comp.windows.x.i386unix" ¤Č¤¤¤ŚĽËĽĺĄźĽšĽ°ĽëĄźĽ×¤ËĹęšĆ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ źÂşÝĄ˘Ćä˼ƼšĽČ¤ˇ¤Ć¤¤¤Ę¤¤š˝ŔŽ¤Ç¤Î (ŔŽ¸ů¤äźşÇÔ¤Î) Ęóšđ¤ň´żˇŢ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁĽŮĄźĽżĽěĽÝĄźĽČ (BetaReport) ÍŃťć¤ňťČ¤Ă¤Ć (report@XFree86.org ¤ËĽá
+ ĄźĽë¤Ç) Ęóšđ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁwww.xfree86.org ¤Ť¤é¤Îżˇ´ŠÍ˝Äę¤ÎĽŮĄźĽżČǤˤ´
+ ´üÂÔ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 8. ĽĆĽšĽČ¤ˇ¤żľĄ´ďš˝ŔŽ
+
+ ¸˝šÔ¤Î XFree86 3.2 ¤ÇžŇ˛đ¤ˇ¤ż¤Ň¤Č¤ÄËô¤Ď¤˝¤ě°Ęžĺ¤ÎĘŃšš¤ÎĽĆĽšĽČˇë˛Ě¤ňźő
+ ¤ąźč¤Ă¤żľĄ´ďš˝ŔŽ¤Î°ěÍ÷¤ňź¨¤ˇ¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎľĄ´ďš˝ŔŽ¤Ç¤ÎĽĆĽšĽČˇë˛Ě¤ÎÎĚ
+ ¤Ď¤Č¤Ć¤âžŻ¤Ę¤ŻĄ˘¤Ţ¤Č¤á¤ĎÉÔ´°Á´¤Ç¤šĄŁš×¸Ľ˝ĐÍč¤ëťţ¤ĎĄ˘¤Ş´ę¤¤¤ˇ¤Ţ¤šĄŁşÇżˇ
+ žđĘó¤Ď www.xfree86.org ¤Ë¤˘¤ë¤ł¤Îʸ˝ń¤ÎşÇżˇČǤňÄ´¤Ů¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ VL ĽĐĽšžĺ¤Î CL-GD5426
+
+ VL ĽĐĽšžĺ¤Î CL-GD5429
+ BitBLT Áŕşî¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ MMIO ¤Ë¤Ä¤¤¤Ć¤ĎşîśČ¤ˇ¤Ć¤Ţ¤ť¤óĄŁ
+
+ VL ĽĐĽšžĺ¤Î 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5434
+ MMIO operation is supported.
+
+ PCI ĽĐĽšžĺ¤Î 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5434
+ 8bpp, 16pp ¤Č 24bpp ¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ 16bpp ¤ĎşÇÁá "ŔĹĹŞ¤Ę" ĚäÂę¤Ď
+ ¤˘¤ę¤Ţ¤ť¤óĄŁ MMIO Áŕşî¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ PCI ĽĐĽšžĺ¤Î 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5446
+ 32bpp ¤Ď¿ʏưşî¤ˇ¤Ţ¤ť¤óĄŁ 8bpp ¤Č 16bpp ¤Ď FIFO ¤Ë´ŘϢ¤ˇ¤żĚäÂę
+ ¤Č "fifo_conservative" ¤ŹÉŹÍפʤł¤Č¤ň˝ü¤¤¤ĆĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ PCI ĽĐĽšžĺ¤Î 2M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5462
+
+ PCI ĽĐĽšžĺ¤Î 4M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5462
+
+ PCI ĽĐĽšžĺ¤Î 4M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5464
+ 8bpp, 16bpp, 24bpp ¤Č 32bpp¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ ISA ĽĐĽšžĺ¤Î CL-GD6440
+
+ PCI ĽĐĽšžĺ¤Î CL-GD7543
+ ¤ł¤ÎČǤǤϸŤ¤ż¤Č¤ł¤íĆ°şî¤ˇ¤Ţ¤ť¤óĄŁ800x600 É˝ź¨¤ÇĄ˘żäžŠĽÉĽĂĽČĽŻ
+ ĽíĽĂĽŻ¤Ď TFT ¤Ç¤Ď 40 MHzĄ˘DSTN ¤Ç¤Ď 33.7 MHz ¤ÇĹŹšç¤š¤ëżĺʿƹ´ü
+ źţÇČżô¤Ď TFT ¤Ç¤Ď 33.7 khz ¤Ç DSTN ¤Ç¤Ď 38.6 khz ¤Ç¤šĄŁ
+
+ şÇżˇ¤Ç¤Ď¤Ę¤¤ĽĆĽšĽČ¤ˇ¤ż¤¤¤Ż¤Ä¤Ť¤ÎľĄ´ďš˝ŔŽ¤Ź¤˘¤ę¤Ţ¤š:
+
+ 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5430, CL-GD5436 ¤Č CL-GD5446
+ ¤ł¤ě¤é¤ÎĽÁĽĂĽ×¤ň 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤Ź¤˘¤ë CL-GD5434 ¤Č¤ˇ¤Ć 16bpp
+ ¤Ç¤É¤Śźč¤ę°ˇ¤Ś¤Ť¤É¤Ś¤Ť¤ňĂΤë¤Î¤ËÁÇŔ˛¤ˇ¤¤¤Ç¤šĄŁ CL-GD754x ˇĎÎó¤Ë
+ ¤âĹŹąţ˝ĐÍč¤Ţ¤šĄŁ
+
+ 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤ż CL-GD5436 ¤Č CL-GD5446
+ Ćäˤł¤Îš˝ŔŽ¤Ç¤Î FIFO ¤ÎŔßÄę¤ĎÉÔ°ÂÄę¤Ç¤šĄŁ
+
+ CL-GD754x
+ 3.1.2G ¤Ç¤Ď¤ł¤ě¤é¤ÎĽÁĽĂĽ×¤Ç¤ĎĆ°şî¤ˇ¤Ţ¤ť¤ó¤ŹĄ˘¤¤¤Ż¤Ä¤Ť¤Îžěšç¤Ç
+ 7548 ¤ĎĆ°şî¤ˇ¤ż¤ČĘóšđ¤Ź¤˘¤ę¤Ţ¤ˇ¤żĄŁ
+
+ 9. ĽÉĽéĽ¤ĽĐ¤ÎĘŃššĹŔ
+
+ XFree86 3.1.2 ¤Ť¤éźĄ¤ÎĽĐĽ°¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤ż:
+
+ o 16bpp ¤Ç 1M ĽĐĽ¤ĽČ¤ňĹëşÜ¤ˇ¤ż CL-GD5434 ¤ÇľŻ¤ł¤ëşĆÉ˝ź¨¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ
+ ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽáĽâĽęĽŢĽĂĽ×ĽÉ I/O Áŕşî¤ÇľŻ¤ł¤ëĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽÓĽĂĽČĽŢĽĂĽ×¤ŹŔ°Îó¤Ç¤­¤Ę¤¤ĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 5436/46 ¤Ç¤Î CRT FIFO ¤ÎŔßÄę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 16/24/32bpp ¤Ç¤ÎÉÔĆŠĚŔ¤ĘĽŚĽŁĽóĽÉĽŚ¤Î°ÜĆ°¤ňšâÂŽ˛˝¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ XFree86 3.2 ¤Ç¤ÎżˇľĄÇ˝:
+
+ o źç¤Ę¤â¤Î¤ĎĽéĽĂĽ×ĽČĽĂĽ×ÍŃĽÁĽĂĽ×¤Î CL-GD754x ˇĎÎóÂĐąţ¤Î̤ĽĆĽšĽČ¤ÎĽ˘ĽŻ
+ ĽťĽéĽěĄźĽż¤ÎĽľĽÝĄźĽČ
+
+ o 5446 ĽÁĽĂĽ×¤ÎĽľĽÝĄźĽČ
+
+ o 546x ĽÁĽĂĽ×¤ÎĽ˘ĽŻĽťĽéĽěĄźĽż¤ÎĽľĽÝĄźĽČ
+
+ o 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤żËؤɤμÁĽĂĽ×¤ÇĽŃĽĂĽŻĽČ 24 bpp ¤ÎĽľĽÝĄźĽČ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/cirrus.sgml,v 3.17 1996/10/26 09:38:57 dawes Exp
+
+ $XConsortium: cirrus.sgml /main/6 1995/11/12 20:00:36 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/cirrus.sgml,v
+ 3.17 1996/10/26 09:38:57 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/cirrus.sgml,v 3.18 1996/12/02 06:08:05 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98 b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98
new file mode 100644
index 000000000..26d952b27
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98
@@ -0,0 +1,193 @@
+ XFree86 PC98 Dependent Information
+ The XFree86 Project Inc. and X98 CORE TEAM Ăř
+ 1999 ÇŻ 7 ˇî 19 Ćü
+
+ ¤ł¤ÎĽÉĽ­ĽĺĽáĽóĽČ¤Ç¤ĎĄ˘PC98 ¸ÇÍ­¤Îťöšŕ¤Ë¤Ä¤¤¤Ć˛ňŔ⤡¤Ţ¤šĄŁPC/AT ¸ß´šľĄ
+ ¤ČśŚÄ̤Νöšŕ¤Ë¤Ä¤¤¤Ć¤ĎĄ˘śŚÄ̤μɼ­ĽĺĽáĽóĽČ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ 1. ËÜĽęĽęĄźĽš¤Ë¤Ä¤¤¤Ć
+
+ ËÜĽęĽęĄźĽš¤Ç¤ĎĄ˘PC98 ÍŃ X ĽľĄźĽĐ¤Ď PC/AT ¸ß´šľĄÍŃ X ĽľĄźĽĐ¤ČĹýšç (ĽŐĽĄ
+ Ľ¤ĽëĚž: XFree86) ¤ľ¤ě¤Ć¤Ş¤ęĄ˘˝žÍč¤ÎĽÜĄźĽÉ / ĽÁĽĂĽ×ĽťĽĂĽČËč¤ÎĽľĄźĽĐ¤â¤Ę
+ ¤Ż¤Ę¤ę¤Ţ¤ˇ¤żĄŁ¤Ţ¤żĄ˘łĆĽÉĽéĽ¤ĽĐ¤Ď¤š¤Ů¤Ć SVGA ĽŮĄźĽš¤ÇĄ˘XF86_S3 ĽŮĄźĽš¤Î
+ ĽÉĽéĽ¤ĽĐ¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¸˝şß¤Î¤Č¤ł¤íĄ˘PC98 ¤ÇĆ°şî¤ˇ¤Ć¤¤¤ë¤Î¤ĎĄ˘mga ĽÉĽé
+ Ľ¤ĽĐ¤Î¤ß¤Ç¤šĄŁMillenniumĄ˘Mystique ¤ÎĽÜĄźĽÉ¤ň¤Şťý¤Á¤ÎĘý°Ęł°¤ĎĄ˘3.3 ĽŮĄź
+ Ľš (ex. 3.3.3.1, 3.3.4) ¤Î´Äś­¤ň¸ćÍřÍѲź¤ľ¤¤ĄŁEGC ¤ä PEGC ¤š¤éÍřÍѤÇ
+ ¤­¤Ţ¤ť¤óĄŁłŤČŻĽáĽóĽĐ¤ŹČóžď¤ËžŻ¤Ę¤Ż¤Ę¤Ă¤Ć¤¤¤ë¤Î¤ÇĄ˘łŤČŻ¤Ëś˝ĚŁ¤Ź¤Ş¤˘¤ę¤Î
+ Ęý¤Ď X98 Core Team ¤Ţ¤ÇĄ˘¸ćϢÍí˛ź¤ľ¤¤ĄŁ
+
+ XF86Config ¤äľŻĆ°ťţ¤ÎĽŞĽ×ĽˇĽçĽóĹů¤ÎĘŃšš¤Ë¤Ä¤¤¤Ć¤ĎĄ˘RELNOTES ¤ËžÜ¤ˇ¤Ż˝ń
+ ¤¤¤Ć¤˘¤ę¤Ţ¤š¤Î¤ÇĄ˘ť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ/usr/X11R6/lib/X11/XF86Config.98
+ ¤ŹĄ˘PC98 ÍѤΠXF86Config ¤Îż÷ˇż¤Ç¤šĄŁ
+
+ 2. ĽľĽÝĄźĽČžőśˇ
+
+ Ĺýšç X ĽľĄźĽĐ (XFree86) ¤ĎĄ˘°Ę˛ź¤ÎłČÄĽĽÓĽÇĽŞĽÜĄźĽÉĄ˘Ćâ¢ĽÓĽÇĽŞĽˇĽšĽĆĽŕ
+ ¤ËÂĐąţ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¸ÄĄš¤ÎÂĐąţĄ˘Ć°şîžőśˇ¤Ë¤Ä¤¤¤Ć¤Ď VideoBoard98 ¤ňť˛žČ¤ˇ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ 2.1. ĽľĽÝĄźĽČĽŤĄźĽÉ°ěÍ÷
+
+ ĽŮĽóĽŔĄź ĽŤĄźĽÉĚžžÎ ĽľĄźĽĐ
+ ------------- ----------------------------------------------- -------
+ NEC ĽŐĽëĽŤĽéĄźĽŚĽŁĽóĽÉĽŚĽ˘ĽŻĽťĽéĽěĄźĽżĽÜĄźĽÉ X2 XFree86
+ Matrox MGA Millennium(PC/AT ¸ß´šľĄÍŃ) XFree86
+
+ 2.2. ĽľĽÝĄźĽČĆâ¢ĽÓĽÇĽŞĽˇĽšĽĆĽŕ°ěÍ÷
+
+ ĽŮĽóĽŔĄź ĽÁĽĂĽ×ĽťĽĂĽČ ĽľĄźĽĐ
+ ------------- ----------------------------------------------- -------
+ NEC MGA Millennium/Mystique XFree86
+
+ 3. śŚÄĚťöšŕ
+
+ PC98 ¤ÎťŘÄę
+ Ĺýšç X ĽľĄźĽĐ¤Ç¤ĎĄ˘ĘŞÍýĽ˘ĽÉĽěĽš 0xf8e80 ¤Ť¤é¤Î 2 ĽĐĽ¤ĽČ¤ňť˛žČ
+ ¤ˇĄ˘0x98Ą˘0x21 ¤ÎĽÇĄźĽż¤Ź¤˘¤ě¤Đ PC98 ¤ČźŤĆ°Ç§źą¤ˇĄ˘ľŻĆ°ťţ¤ÎĽíĽ°
+ ¤Ë
+
+ (--) Japanese PC98 architecture
+
+ ¤Č˝ĐÎϤˇ¤Ţ¤šĄŁÂçÂżżô¤Î PC98(Millennium,Mystique ¤ňÍřÍѤǤ­¤ëľĄźď
+ ¤Ç¤Ď 100%) ¤Ź¤ł¤ě¤Çǧźą¤ľ¤ě¤ëČŚ¤Ç¤š¤ŹĄ˘Ëü°ěžĺľ­¤ÎÉ˝ź¨¤Ź¤ľ¤ě¤Ę
+ ¤Ť¤Ă¤żžěšç¤ĎĄ˘XF86Config ¤Î Section "ServerFlags" ¤ËĄ˘
+
+ Option "PC98"
+
+ ¤ÎťŘÄę¤ňĆţ¤ě¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤Ç PC98 ¤Čǧźą¤ľ¤ěĄ˘ĽíĽ°¤Ë
+
+ (**) Japanese PC98 architecture
+ ¤Č˝ĐÎϤľ¤ě¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ xf86config
+ PC98 ÍѤ˰ܿ˘¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁ/usr/X11R6/lib/X11/XF86Config.98 ¤ň
+ XF86Config ¤ČĽęĽÍĄźĽŕ¤ˇ¤ĆťČÍѤˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ xvidtune
+ ¸ˇłĘ¤ĘĆ°şîłÎǧ¤ňšÔ¤Ă¤Ć¤¤¤Ţ¤ť¤ó¤ŹĄ˘Ć°şî¤š¤ë¤č¤Ś¤Ç¤šĄŁ
+
+ SuperProbe
+ °Üż˘¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁĽĎĽóĽ°Ľ˘ĽĂĽ×¤äĽÓĽÇĽŞĽÜĄźĽÉ¤ň˛ő¤šś˛¤ě¤Ź¤˘¤ë¤Î
+ ¤ÇŔäÂФ˝ČÍѤˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤ĄŁ
+
+ XF86Setup
+ PC/AT ¸ß´šľĄ¤ň´Ţ¤áĄ˘ËÜĽęĽęĄźĽš¤Ç¤ĎĽľĽÝĄźĽČ¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁ
+ /usr/X11R6/lib/X11/XF86Config.98 ¤ň XF86Config ¤ČĽęĽÍĄźĽŕ¤ˇ¤ĆťČ
+ ÍѤˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ scanpci
+ ¸ˇłĘ¤ĘĆ°şîłÎǧ¤ňšÔ¤Ă¤Ć¤¤¤Ţ¤ť¤ó¤ŹĄ˘Ć°şî¤š¤ë¤č¤Ś¤Ç¤šĄŁ
+
+ ĽÇĽŐĽŠĽëĽČ¤ÎĽłĽóĽŃĽ¤Ľëťţ¤ÎŔßÄę
+ ŔΤΠPC98 ÍŃĽľĄźĽĐ¤Č°Ű¤Ę¤ęĄ˘XFree86 ¤ĎĄ˘GetValuesBC
+ NO,BuildPexExt YES,BuildXIE YES ¤ČÄęľÁ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ¤´Ăí°Ő˛ź¤ľ
+ ¤¤ĄŁxengine Ĺů¤Ç¤Ď GetValues ¤Ë¤Ä¤¤¤ĆĽ˝ĄźĽš¤Î˝¤Ŕľ¤ŹÉŹÍפǤšĄŁ
+
+ 16MB ĽˇĽšĽĆĽŕśő´Ö¤ÎŔßÄę
+ ĽÜĄźĽÉ / ĽÁĽĂĽ×ĽťĽĂĽČ¤Ë¤č¤Ă¤Ć¤ĎĄ˘15M-16M ¤ÎÎΰč¤ňťČÍѤš¤ëĘŞ¤Ź¤˘
+ ¤ę¤Ţ¤šĄŁ¤˝¤ÎÍͤʼܥźĽÉ¤ňťČÍѤˇ¤Ć¤¤¤ëžěšçĄ˘ĽˇĽšĽĆĽŕĽťĽĂĽČĽ˘ĽĂĽ×Ľá
+ ĽËĽĺĄź¤ÇĄ˘16MB ĽˇĽšĽĆĽŕśő´Ö¤ňĄÖŔÚ¤ęÎĽ¤šĄ×¤Ë¤ˇ¤ĆĽľĄźĽĐ¤ňľŻĆ°¤š¤ë
+ ¤ČĄ˘ĽĎĽóĽ°Ľ˘ĽĂĽ×Ĺů¤ň°ú¤­ľŻ¤ł¤š˛ÄÇ˝Ŕ­¤Ź¤˘¤ę¤Ţ¤šĄŁMillennium ¤ä
+ Mystique ¤Ë´Ř¤ˇ¤Ć¤Ď¤ł¤Îśő´Ö¤ňťČÍѤˇ¤Ţ¤ť¤ó¤ŹĄ˘¤ł¤Îśő´Ö¤ňťČÍѤˇ¤Ę
+ ¤¤¤Č¤Ď¤Ă¤­¤ęĘŹ¤Ť¤ë¤â¤Î°Ęł°¤ňťČ¤Śžěšç¤ĎĄ˘¤Ť¤Ę¤é¤şĄÖťČÍѤš¤ëĄ×¤Ë¤ˇ
+ ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XKB
+ XF86Config ¤Î Section "InputDevice" ¤ÇĄ˘
+
+ XkbRules "xfree86"
+ XkbModel "pc98"
+ XkbLayout "nec/jp"
+
+ ¤ÎťŘÄę¤ň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ BusID
+ XF86Config ¤Î Section "Device" ¤ÇĄ˘ÉŹ¤ş
+
+ BusID "0:10:0"
+
+ ¤Î¤č¤Ś¤ĘťŘÄę¤ň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĽíĽ°¤Ë
+
+ (--) PCI: (0:7:0) NEC unknown chipset (0x0009) rev 2
+ (--) PCI: (0:12:0) S3 968 rev 0, Mem @ 0x24000000/25
+ (--) PCI: (0:14:0) Matrox MGA 2064W rev 1, Mem @ 0x20004000/14, 0x21000000/23
+
+ ¤Î¤č¤Ś¤Ë˝Đ¤Ć¤¤¤ĆĄ˘Millennium ¤ňťČÍѤš¤ëžěšç¤ĎĄ˘"0:14:0" ¤ňťŘÄꤡ¤Ţ
+ ¤šĄŁS3 968 ¤ĎťČÍѤǤ­¤Ţ¤ť¤óĄŁÇ°¤Î°ŮĄŁ
+
+ VT switch
+ FreeBSD(98) ¤Ç¤Ď¤Ç¤­¤Ę¤Ż¤Ę¤Ă¤Ć¤¤¤ë¤č¤Ś¤Ç¤šĄŁPANIX for 98 ¤Ç¤â¤Ç
+ ¤­¤Ţ¤ť¤óĄŁ
+
+ CTRL,GRPH,+/- ¤Ë¤č¤ë˛ňÁüĹŮŔÚÂؤ¨
+ ¤Ç¤­¤Ę¤Ż¤Ę¤Ă¤Ć¤¤¤ë¤č¤Ś¤Ç¤šĄŁ
+
+ 4. ĽÉĽéĽ¤ĽĐ¤Ë¤Ä¤¤¤Ć
+
+ 4.1. mga ĽÉĽéĽ¤ĽĐ
+
+ NEC ¤ÎĆâ¢Ľ˘ĽŻĽťĽéĽěĄźĽż (Matrox Millennium/Mystique), PC/AT ¸ß´šľĄÍŃ
+ Millennium ¤ÇĆ°şî¤š¤ëĽÉĽéĽ¤ĽĐ¤Ç¤šĄŁ
+
+ 4.1.1. XF86Config ¤ÎŔßÄę
+
+ README.MGA Ćâ¤Ë˛ňŔ⤾¤ě¤Ć¤¤¤ëĽŞĽ×ĽˇĽçĽó¤ňťŘÄę¤Ç¤­¤Ţ¤šĄŁÄĚžď¤ĎĆä˲ż¤â
+ ťŘÄꤚ¤ëÉŹÍ×Ěľ¤¤ČŚ¤Ç¤šĄŁ
+
+ 4.1.2. Ęóšđ¤ľ¤ě¤Ć¤¤¤ëĚäÂę
+
+ o Millennium ¤Ç¤ĎĄ˘Modeline ¤ÎŔßÄę¤Ë¤č¤Ă¤Ć¤Ď 24bpp ¤Ç˝Ä¤ËŔţ¤˘¤ë¤¤¤ĎźĘ
+ ĚĎÍͤμμ¤Ľş¤Ź˝Đ¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ o Millennium ¤Ç¤ĎĄ˘˝é´ü˛˝¤ŹÉÔ´°Á´¤Ę¤ż¤áĄ˘ťČÍŃÁ°¤Ë 3.3 ĽŮĄźĽš¤ÎĽľĄźĽĐ
+ ¤ňľŻĆ°¤ˇ¤Ć¤Ş¤Ť¤Ę¤¤¤ČĽĎĽóĽ°Ľ˘ĽĂĽ×¤š¤ë¤ł¤Č¤Ź¤˘¤ę¤Ţ¤šĄŁ°ěĂśľŻĆ°¤š¤ě¤Đ
+ ĹŸť¤ň OFF ¤Ë¤š¤ë¤Ţ¤Ç¤ĎŔľžď¤ËĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ o Linux/98 ¤Ç¤ĎĄ˘beta 14 °Ęšß¤ÎĽŤĄźĽÍĽë¤Ç¤Ę¤¤¤ČťČÍŃĂć¤ËĽĎĽóĽ°Ľ˘ĽĂĽ×¤š
+ ¤ë¤ł¤Č¤Ź¤˘¤ę¤Ţ¤šĄŁ¤ł¤ě¤ňČň¤ą¤ë¤Ë¤ĎĄ˘root ¸˘¸Â¤Ë¤Ć dmesg -n 1 ¤ňźÂšÔ
+ ¤š¤ë¤Č¤¤¤¤¤č¤Ś¤Ç¤šĄŁ
+
+ 4.1.3. ¤˝¤Îž
+
+ o PC/AT ¸ß´šľĄÍѤΠMillennium ¤ňťČÍѤš¤ëžěšç¤ĎĄ˘VGA ¤ň disable ¤ˇ¤Ć˛ź
+ ¤ľ¤¤ĄŁ
+
+ o PC/AT ¸ß´šľĄÍѤΠMillennium II, Mystique, G100, G200 Ĺů¤ĎĄ˘VGA ¤ň
+ disable ¤Ç¤­¤Ę¤¤¤Î¤ÇĄ˘ťČÍѤǤ­¤Ţ¤ť¤óĄŁ
+
+ o 3.3 ĽŮĄźĽš¤Î X ĽľĄźĽĐ¤Ç¸şß¤ˇ¤Ć¤¤¤żĄ˘Mystique ¤ňťČÍѤˇ¤Ć¤¤¤ëžěšç¤Ď
+ Windows ¤ňťöÁ°¤ËľŻĆ°¤ˇ¤Ć¤Ş¤Ť¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤¤¤Č¤¤¤ŚĚäÂę¤ä 8bpp ¤Ç¤Î
+ É˝ź¨¤Ź¤Ş¤Ť¤ˇ¤¤¤Č¤¤¤ŚĚäÂę¤Ď˛ňžĂ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+ o ¤Ţ¤Ŕ˝˝ĘŹ¤ĘĽĆĽšĽČ¤ŹšÔ¤ď¤ě¤Ć¤¤¤Ę¤¤¤Î¤ÇĆ°şîĽěĽÝĄźĽČ¤ň¤Ş´ę¤¤¤ˇ¤Ţ¤šĄŁ
+
+ 4.1.4. ´ŘϢ
+
+ README.MGAĄ˘XF86_SVGA man page
+
+ 4.2. apm ĽÉĽéĽ¤ĽĐ
+
+ (ž­ÍčĹŞ¤Ë¤Ď)IO-DATA ¤Î GA-RUSH6/PCI ¤Ç¤âĆ°şî¤š¤ë (Í˝Äę¤Î) ĽÉĽéĽ¤ĽĐ¤Ç
+ ¤šĄŁ
+
+ 4.2.1. XF86Config ¤ÎŔßÄę
+
+ README.MGA Ćâ¤Ë˛ňŔ⤾¤ě¤Ć¤¤¤ëĽŞĽ×ĽˇĽçĽó¤ňťŘÄę¤Ç¤­¤Ţ¤šĄŁÄĚžď¤ĎĆä˲ż¤â
+ ťŘÄꤚ¤ëÉŹÍ×Ěľ¤¤ČŚ¤Ç¤šĄŁ
+
+ 4.2.2. Ęóšđ¤ľ¤ě¤Ć¤¤¤ëĚäÂę
+
+ o 8bpp °Ęł°¤Ç¤Ď¤Ţ¤Ă¤ż¤ŻĆą´ü¤Źźč¤ě¤Ţ¤ť¤óĄŁ8bpp ¤Îžěšç¤Ç¤âĆą´ü¤Ź¤Ş¤Ť¤ˇ
+ ¤Ż¤ĆĆą¤¸ĘޤŹ 3 ¤ÄÉ˝ź¨¤ľ¤ě¤ż¤ę¤ˇ¤Ţ¤šĄŁ
+
+ o XF86Config ¤Ç¤ÎĽŞĽ×ĽˇĽçĽóťŘÄę¤Ë¤č¤Ă¤Ć¤ĎĽĎĽóĽ°Ľ˘ĽĂĽ×¤ˇ¤ż¤ę¤š¤ë¤ł¤Č¤â
+ ¤˘¤ę¤Ţ¤šĄŁ
+
+ 4.2.3. ¤˝¤Îž
+
+ o ¤Ţ¤Ŕ PC-98 ÂĐąţşîśČ¤ŹËؤɽĐÍč¤Ć¤¤¤Ţ¤ť¤óĄŁźÂÍѤˤĎÂѤ¨¤Ę¤¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 4.2.4. ´ŘϢ
+
+ XF86_SVGA man page
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98.1st b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98.1st
new file mode 100644
index 000000000..35a071187
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/README98.1st
@@ -0,0 +1,141 @@
+ XFree86 PC98 General Information
+ The XFree86 Project Inc. / X98 CORE TEAM Ăř
+ 1999 ÇŻ 7 ˇî 19 Ćü
+
+ 1. ¤Ď¤¸¤á¤Ë
+
+ XFree86 ¤ĎĄ˘NEC PC98 ¤Ş¤č¤Ó¸ß´šľĄ¤ÇĆ°şî¤š¤ë FreeBSD(98)Ą˘NetBSD/pc98
+ (based on NetBSD 1.3.2) °ĘšßĄ˘PANIX Ver.5.0 for 98Ą˘Linux/98 ¤ňĽľĽÝĄź
+ ĽČ¤ˇ¤Ţ¤šĄŁPC98 ¤ÎĽ˘ĄźĽ­ĽĆĽŻĽÁĽă¤Ď XFree86 ¤ÎĽ˝ĄźĽšĽÄĽęĄź¤ÇĽľĽÝĄźĽČ¤ľ
+ ¤ěĄ˘¤˝¤ÎłŤČŻ¤ČĽłĄźĽÉ¤ÎĘÝźé¤ĎĄ˘The XFree86 Project Inc ¤Č X98 CORE TEAM
+ ¤ŹšÔ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ PC98 ÍŃĽÉĽ­ĽĺĽáĽóĽČ¤Ç¤ĎĄ˘źç¤Ë PC98 ĆĂÍ­¤Îťöšŕ¤Ë¤Ä¤¤¤ĆŔâĚŔ¤ˇ¤Ţ¤šĄŁ¤˝¤Î
+ ž¤Îťö¤Ë¤Ä¤¤¤Ć¤ĎĄ˘PC/AT ¸ß´šľĄČǤȤΜŚÄĚĽÉĽ­ĽĺĽáĽóĽČ¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+ Âż¤Ż¤ÎĽÉĽ­ĽĺĽáĽóĽČ¤ŹĆüËܸ첽¤ľ¤ě¤Ć¤¤¤Ţ¤š¤Î¤ÇĄ˘¤˝¤ě¤é¤ňť˛žČ¤š¤ëťö¤ň¤Ş´Ť
+ ¤á¤ˇ¤Ţ¤šĄŁ
+
+ 2. žđĘ󸝥żĎ˘ÍíŔč
+
+ XFree86 ¤ÎÁíšçĹŞ¤ĘĽľĽÝĄźĽČ¤Ë¤Ä¤¤¤Ć¤ĎĄ˘<XFree86@XFree86.Org> ¤ŘąŃ¸ě¤ÇĽł
+ ĽóĽżĽŻĽČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁPC98 ĆĂÍ­¤ÎĚäÂę¤Ë¤Ä¤¤¤Ć¤ĎĄ˘ĆüËܸě¤ÇłŤČŻźÔĽáĄźĽęĽó
+ Ľ°ĽęĽšĽČ <x98@mech.titech.ac.jp> ¤ŘĽłĽóĽżĽŻĽČ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ Ć°şîĘóšđ¤äĽĐĽ°žđĘ󥢼ѼüÁ¤Ę¤É¤ĎĚľžňˇď¤Ë´żˇŢ¤¤¤ż¤ˇ¤Ţ¤š¤Î¤ÇĄ˘ľš¤ˇ¤Ż¤Ş´ę
+ ¤¤¤¤¤ż¤ˇ¤Ţ¤šĄŁformat ¤ĎĚ䤤¤Ţ¤ť¤ó¤ŹĄ˘ĽÉĽ­ĽĺĽáĽóĽČ¤Ëľ­˝Ň¤Ź¤˘¤ëĆâÍƤˤÄ
+ ¤¤¤Ć¤ÎźÁĚäĹů¤Ď¤´ąóθ˛ź¤ľ¤¤ĄŁ
+
+ NetNews ¤Î fj.windows.xĄ˘fj.os.bsd.*Ą˘NIFTY-SERVE(FUNIX, FEPSONX,
+ SAISAP)Ą˘PC-VAN(JUNIX, JSPUNIX)Ą˘FreeBSD-users-jp MLĄ˘FreeBSD kit MLĄ˘
+ FreeBSD98-testers MLĄ˘FreeBSD98-hackers MLĄ˘seraphim-bugs MLĄ˘
+ seraphim-beta ML ¤ÇÂż¤Ż¤ÎľÄĎŔĄ˘źÁľżąţĹú¤ŹšÔ¤ď¤ě¤Ć¤¤¤Ţ¤šĄŁPC98 ¤Ë¤Ä¤¤¤Ć
+ ¤ÎžđĘó¤Ë¤Ä¤¤¤Ć¤Ď¤ł¤ě¤é¤Îžě¤ÇÄ󜥤ˇ¤Ţ¤š¤Î¤ÇĄ˘ť˛˛Ă¤š¤ëťö¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ
+
+ 3. PC98 ¸ÇÍ­¤ÎĽÉĽ­ĽĺĽáĽóĽČ
+
+ o README98.1st łľÍ× (¤ł¤ÎĽŐĽĄĽ¤Ľë)
+
+ o README98 PC98 ¤Ë´Ř¤š¤ëŔâĚŔ
+
+ o XF86Config.98 ɸ˝ŕĹŞ¤Ę PC98 ÍŃ XF86Config
+
+ o VideoBoard98 ÂĐąţĽÓĽÇĽŞĽÜĄźĽÉ¤Ë´Ř¤š¤ëžđĘó
+
+ 4. ĽŻĽěĽ¸ĽĂĽČ
+
+ PC98 ÍŃĽłĄźĽÉ¤Ď The XFree86 Project Inc ¤Č°Ę˛ź¤Î X98 CORE TEAMĄ˘¤Ş¤č¤Ó
+ ¤˝¤Îž¤Îś¨ÎϟԤˤč¤ęşîŔŽ¤ľ¤ě¤Ţ¤ˇ¤żĄŁ
+
+ X98 CORE TEAM
+
+ o ˛ńÄĹš¨šŹ <aizu@jaist.ac.jp>
+
+ o ŔĐĹÄĎÂŔ¸ <ishidakz@obp.cl.nec.co.jp>
+
+ o ťÔŔšŔ <cs94006@mbox.sist.ac.jp>
+
+ o °ËĆŁĎÂÍş <ft4k-itu@asahi-net.or.jp>
+
+ o žĺĚîĎÂľŞ <jagarl@creator.club.or.jp>
+
+ o žĺĚ°ě <uenos@ppp.bekkoame.or.jp>
+
+ o ą§ĚîĎÂɧ <Kazuhiko.Uno@softvision.co.jp>
+
+ o ąşĹÄ˝¤°ěĎş <s-urata@nmit.tmg.nec.co.jp>
+
+ o ÂçŔСŽ <ohishi@hf.rim.or.jp>
+
+ o ÂçŔĐšŔĆó <atena@njk.co.jp>
+
+ o łÝťĽĹŻĚé <kakefuda@tag.iijnet.or.jp>
+
+ o ˛ĂĆŁšŻÇˇ <yasuyuki@acaets0.anritsu.co.jp>
+
+ o ĚÚÂźÁď <KFB03633@nifty.ne.jp>
+
+ o žŽĂÓĂŁĚé <koiket@focus.rim.or.jp>
+
+ o H.Komatsuzaki
+
+ o şäËÜżň <sakamoto@yajima.kuis.kyoto-u.ac.jp>
+
+ o ş´ľ×´Ö˝ß <i931361@jks.is.tsukuba.ac.jp>
+
+ o żŔĘÝĆťÉ× <karl@spnet.ne.jp>
+
+ o ÎëĚÚš§°ěĎş <s-koichi@nims.nec.co.jp>
+
+ o ÎëĚÚĂθŤ <suzuki@grelot.elec.ryukoku.ac.jp>
+
+ o ÎëĚÚšŻťĘ <suz@d2.bs1.fc.nec.co.jp>
+
+ o ÂěžĺÉŮŔ˛ <takigami@elsd.mt.nec.co.jp>
+
+ o ÄÍĹÄšäʸ <tsuka@linkt.imasy.or.jp>
+
+ o ąĘČřÄ÷ˇź <nagao@cs.titech.ac.jp>
+
+ o ĚîĹÄĚ­ <mnoda@cv.tottori-u.ac.jp>
+
+ o ĚîÂźšâĚŔ <amadeus@yk.rim.or.jp>
+
+ o ĆŁąşË­ĆÁ <toyo@ibbsal.or.jp>
+
+ o ËÜÂżž°Ę¸ <honda@Kururu.math.hokudai.ac.jp>
+
+ o żšĹÄžźÉ× <amorita@bird.scphys.kyoto-u.ac.jp>
+
+ o ČŹż§ż­°ě <QZR00522@nifty.ne.jp>
+
+ o ČŹĚÚ˝Óɧ <j2297222@ed.kagu.sut.ac.jp>
+
+ o °ÂĹÄŔť <yasuda@cc.hit-u.ac.jp>
+
+ ¤˝¤Îž¤Îś¨ÎĎźÔ
+
+ o ťłËÜšŔ (x98ML ľě´ÉÍýźÔ)
+
+ o ĂćĹçľá (x98ML ´ÉÍýźÔ)
+
+ o ľČĹÄŔľżÍ (PowerWindow805i ÂĐąţĽłĄźĽÉÄóśĄ)
+
+ o ť°ąşĆŘťĘ (PW928II ÂßÍż)
+
+ o ŔžÄÍÇîʸ (Linux/98 ÂĐąţ)
+
+ o °ć°ËÎźÂŔ (Ćąžĺ)
+
+ o PC-VAN(JUNIX, JSPUNIX), NIFTY-SERVE(FUNIX, FEPSONX, SAISAP), fj,
+ x98 ML, FreeBSD-users-jp ML, FreeBSD kit ML, FreeBSD98-testers ML,
+ FreeBSD98-hackers ML, seraphim-bugs ML, seraphim-beta ML ¤ÇĆ°şîĘóšđ
+ ¤ň¤Ż¤Ŕ¤ľ¤Ă¤żĘýĄš
+
+ o ľţÂçĽŢĽ¤ĽłĽóĽŻĽéĽÖ
+
+ o FreeBSD PC98 °Üż˘ĽÁĄźĽŕ
+
+ o NetBSD/pc98 Core Team
+
+ o Ľ¨ĄźĄŚĽ˘Ľ¤ĄŚĽ˝ĽŐĽČłôź°˛ńźŇ
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/Japanese/RELNOTES
new file mode 100644
index 000000000..e38496346
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/RELNOTES
@@ -0,0 +1,850 @@
+ XFree86[TM] 3.2 ĽęĽęĄźĽšĽÎĄźĽČ
+ The XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ
+
+ Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto (ikko-@pacific.rim.or.jp) Ěő
+ 1996/10/26
+
+ ¤ł¤Îʸ˝ń¤Ď XFree86 3.2 ¤Ë¤Ä¤¤¤ĆÁ°˛ó¤Î´°Á´ĽĐĄźĽ¸ĽçĽó 3.1.2 ¤ČČć¤Ů¤Ćżˇ¤ˇ
+ ¤¤ľĄÇ˝¤ňŔâĚŔ¤š¤ë¤â¤Î¤Ç¤šĄŁ¤Ţ¤żĄ˘ĽĐĽ¤ĽĘĽęÇŰÉŰĘŞ¤ÎÁȤߚţ¤ßźę˝ç¤â´Ţ¤Ţ¤ě¤Ć
+ ¤¤¤Ţ¤šĄŁ
+ ______________________________________________________________________
+
+ Table of Contents:
+
+ 1. XFree86 ¤Č X11R6.1
+
+ 2. OS ¤ËÍłÍ褚¤ëšŕĚÜ
+
+ 3. 3.2 ¤Ç¤ÎżˇľĄÇ˝
+
+ 3.1. Á´ČĚ
+
+ 3.2. X ĽľĄźĽĐ Á´Č̤ÎĘŃšššŕĚÜ
+
+ 3.3. XF86Setup ¤Ë¤Ä¤¤¤Ć
+
+ 3.4. PC98 ¤ÎĽľĽÝĄźĽČ
+
+ 3.5. XInput ľĄÇ˝łČÄĽ
+
+ 3.6. S3 ĽľĄźĽĐ
+
+ 3.7. Mach64 ĽľĄźĽĐ
+
+ 3.8. Mach32 ĽľĄźĽĐ
+
+ 3.9. W32 ĽľĄźĽĐ
+
+ 3.10. AGX ĽľĄźĽĐ
+
+ 3.11. I128 ĽľĄźĽĐ
+
+ 3.12. TGA ĽľĄźĽĐ
+
+ 3.13. SVGA/VGA16/Mono ĽľĄźĽĐ
+
+ 3.14. VGA16 ĽľĄźĽĐ
+
+ 3.15. ET3000 ĽÉĽéĽ¤ĽĐ (VGA16 ĽľĄźĽĐ)
+
+ 3.16. Trident ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.17. Ark ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.18. ET6000 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.19. Alliance ProMotion ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.20. NVidia NV1 / SGS Thomson STG2000 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.21. Matrox Millennium ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.22. Cirrus ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.23. SiS ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.24. Chips ¤Č Technologies ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.25. ALI ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.26. ATI ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.27. WD90C24 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.28. Compaq AVGA ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ 3.29. Hercules mono ĽÉĽéĽ¤ĽĐ
+
+ 3.30. ĽŻĽéĽ¤Ľ˘ĽóĽČ/ĽéĽ¤ĽÖĽéĽę¤ÎĘŃššĹŔ
+
+ 3.31. xf86config ĽćĄźĽĆĽŁĽęĽĆĽŁ
+
+ 3.32. SuperProbe
+
+ 3.33. ĽŐĽŠĽóĽČ
+
+ 4. XFree86 3.2 ¤ÎĆłĆţ
+ ______________________________________________________________________
+
+ 1. XFree86 ¤Č X11R6.1
+
+ X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î X11R6.1 ¤ň´đ¤Ë¤ˇ¤ż XFree86 3.1.2D ĽŮĄźĽżČÇ ¤Ť¤éťĎ¤Ţ
+ ¤ę¤Ţ¤ˇ¤żĄŁ R6.1 ¤Ď R6 ¤ÎşÇżˇČǤǥ˘Ľ˝ĄźĽš¤ČĽ×ĽíĽČĽłĽë¤Ç R6 ¤Č¸ß´šŔ­¤Ź¤˘
+ ¤ę¤Ţ¤šĄŁĽĐĽ¤ĽĘĽę¤Ďžĺ°Ě¸ß´š¤Ç¤šĄŁ X11R6.1 ¤Ď DOUBLE-BUFFER, XKEYBOARD
+ ¤Č RECORD ¤Č¤¤¤Śżˇ¤ˇ¤¤ X ĽľĄźĽĐľĄÇ˝łČÄĽ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁLBX ¤Ď R6.1 ¤Ť
+ ¤éĚľ¤Ż¤Ę¤ę¤Ţ¤ˇ¤żĄŁ˝ž¤Ă¤Ć XFree86 ¤Ť¤é¤âĚľ¤Ż¤Ę¤ę¤Ţ¤ˇ¤żĄŁž­Í貿¤Ť¤ÎˇÁ¤Ç
+ ¤ÎşĆĹĐžě¤ň´üÂÔ¤ˇ¤Ţ¤šĄŁ
+
+ 2. OS ¤ËÍłÍ褚¤ëšŕĚÜ
+
+ ĆĂĘ̤ĘÍ׾áťöšŕ¤äˇŮšđ¤Ë´Ř¤š¤ë OS ĆĂÍ­¤Î README ĽŐĽĄĽ¤Ľë¤ňžď¤ËłÎǧ¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ Ľ¤ĽóĽĆĽëžĺ¤Ç Linux/Elf ¤ň˛ÔĆŻ¤ľ¤ť¤ëžěšç¤Ď ld.so-1.7.14 ¤ňĆţźę¤š¤ëÉŹÍ×
+ ¤Ź¤˘¤ë¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎĽéĽ¤ĽÖĽéĽę¤Ď
+ tsx-11.mit.edu:pub/linux/packages/GCC
+ <ftp://tsx-11.mit.edu/pub/linux/packages/GCC> ¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ 3. 3.2 ¤Ç¤ÎżˇľĄÇ˝
+
+ ¤ľ¤¤ĄŁ
+
+ 3.1. Á´ČĚ
+
+ o XFree86 3.2 ¤Ď X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î X11R6.1 ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ o XFree86-3.2 Linux/m68k ÍѤÎÁ´ÇŰÉŰĘŞ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ o XFree86-3.2 Linux/Alpha ÍѤÎÁ´ÇŰÉŰĘŞ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ o XFree86-3.2 OS/2 ÍѤÎÁ´ÇŰÉŰĘŞ¤ň´Ţ¤ó¤Ç¤¤¤Ţ¤šĄŁ
+
+ 3.2. X ĽľĄźĽĐ Á´Č̤ÎĘŃšššŕĚÜ
+
+ o `DefaultColorDepth' ¤Č¤¤¤ŚšŕĚܤň XF86Config ĽŐĽĄĽ¤Ľë¤Î Screen Ŕá¤Ë
+ bpp ¤Îɸ˝ŕĂͤŹťŘÄę˝ĐÍč¤ë¤č¤Ś¤ËÄɲ䡤ޤˇ¤żĄŁ
+ o `-nolock' ¤Č¤¤¤Ś X ĽľĄźĽĐ¤ÎĽŞĽ×ĽˇĽçĽó¤ŹĽľĄźĽĐ¤Î˛čĚĚĽíĽĂĽŻľĄš˝¤ňĚľ¸ú
+ ¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ o ĘŹÎĽĽŻĽíĽĂĽŻĽÁĽĂĽ×ĽťĽĂĽČ (ClockChip ¤Ç¤â ClockProg ¤Ç¤â¤Ę¤Ż) ¤ňĹëşÜ
+ ¤ˇ¤Ć¤¤¤ëÁ´¤Ć¤Î VGA ĽÓĽÇĽŞĽŤĄźĽÉ¤Ç clocks šÔ¤Ç 2 ¤Çłä¤Ă¤żĽŻĽíĽĂĽŻźţ
+ ÇČżô¤ňťŘÄę¤Ç¤­¤ë¤č¤Ś¤Ë¤â¤Ę¤ę¤Ţ¤ˇ¤żĄŁ¤ł¤ě¤Ë¤č¤ęĽľĄźĽĐ¤ÇÇܤμŻĽíĽĂĽŻ
+ ťŘÄęˇÁź°¤ňÁŞÂň¤Ç¤­¤Ţ¤šĄŁ XF86Config ĽŐĽĄĽ¤Ľë¤Î "Device" Ŕá¤Ë
+ "clkdiv2" ĽŞĽ×ĽˇĽçĽó¤ňÄɲ䚤ë¤Č˛ÄÇ˝¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ o ĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňťČ¤Ă¤Ć¤¤¤ëĽľĄźĽĐ¤ÎĽŤĽéĄź˛˝¤ˇ¤żĽŤĄźĽ˝Ľë¤ÎĽĐĽ°
+ ¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o X ĽľĄźĽĐ¤ÎĽíĽĂĽŻĽŐĽĄĽ¤Ľë¤Ë´Ř¤š¤ëĘݰžĺ¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘É¸˝ŕ¤Ç (xvidtune ¤ÇťČÍѤˇ¤Ć¤¤¤ë) VidMode ľĄš˝łČÄĽ¤ĎĽíĄźĽŤĽëŔÜ
+ Âł¤ÎĽŻĽéĽ¤Ľ˘ĽóĽČ¤Ť¤éĽÓĽÇĽŞĽâĄźĽÉ¤ňĘŃšš˝ĐÍč¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛ó "XFree86-Misc" ¤Č¸Ć¤Öżˇ¤ˇ¤¤ĽľĄźĽĐ¤ÎľĄÇ˝łČÄĽ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł
+ ¤ÎľĄÇ˝łČÄĽ¤Îźç¤ż¤ëĚÜĹŞ¤ĎĽľĄźĽĐ¤Î˛ÔĆŻĂć¤Ë¤¤¤Ż¤Ä¤Ť¤ÎĽŃĽéĽáĄźĽż¤ňşĆš˝
+ ŔŽ˝ĐÍč¤ë¤č¤Ś¤Ë¤š¤ë¤â¤Î¤Ç¤šĄŁ°ĘÁ°¤Î VidMode ľĄÇ˝łČÄĽ¤Î¤¤¤Ż¤Ä¤Ť¤Î (Ľš
+ ĽęĄźĽóĽťĄźĽĐľĄÇ˝¤ÎÍͤĘ) ľĄÇ˝¤Ď¤ł¤Îżˇ¤ˇ¤¤ľĄÇ˝łČÄĽ¤Ë°ÜĆ°¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ALPS GlidePoint ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁĽŃĽĂĽÉ¤ňĽżĽĂĽ×¤š¤ëťö¤ňÂ裴¤ÎĽÜ
+ ĽżĽó¤Č¤ˇ¤ĆťČÍŃ˝ĐÍč¤Ţ¤šĄŁĚőĂí : ĽżĽĂĽ×¤Č¤ĎĽÝĽóĽÝĽó¤ČĂĄ¤Żťö
+
+ o X11R6.1 ¤Î°ěÉô¤Ç¤˘¤ë XKEYBOARD ľĄÇ˝łČÄĽ¤ňĽľĄźĽĐ¤Ë´Ţ¤á¤Ţ¤ˇ¤żĄŁÉ¸˝ŕ¤Ç
+ ťČÍѲÄÇ˝¤Ç¤š¤ŹĄ˘ĽłĽŢĽóĽÉšÔ¤Ť¤é (Xserver ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤ňť˛žČ)
+ ¤Ţ¤ż¤Ď XF86Config ĽŐĽĄĽ¤Ľë¤Ť¤é (XF86Config ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Î
+ XkbDisable ¤ňť˛žČ) Ěľ¸ú¤Ë˝ĐÍč¤Ţ¤šĄŁ¤ł¤ÎľĄÇ˝łČÄĽ¤ňÍ­¸ú¤Ë¤š¤ë¤ČĄ˘Ľ­Ąź
+ ĽÜĄźĽÉ¤ÎĽ­Ąźłä¤ęÉŐ¤ą¤Ź¤¤¤Ż¤Ä¤Ť°Ű¤Ę¤ëťö¤ŹĘŹ¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ o şŁ˛óĄ˘XFree86-DGA ¤Č¸Ć¤Đ¤ě¤ëżˇ¤ˇ¤¤ľĄÇ˝łČÄĽ¤ňÄ󜥤ˇ¤Ţ¤šĄŁ¤ł¤ÎľĄÇ˝łČ
+ ÄĽ¤Ë¤č¤Ă¤ĆĽŻĽéĽ¤Ľ˘ĽóĽČĽ×ĽíĽ°ĽéĽŕ¤ŹÄžŔÜĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽáĽâĽę¤ËĽ˘ĽŻĽť
+ Ľš˝ĐÍč¤Ţ¤šĄŁËؤɤμľĄźĽĐ/ĽŻĽéĽ¤Ľ˘ĽóĽČ¤ÇÍřÍѲÄÇ˝¤Ç¤šĄŁĽíĄźĽŤĽëŔÜÂłˇż
+ (Î㤨¤Đ DISPLAY=":0") ¤ÎĽŻĽéĽ¤Ľ˘ĽóĽČ¤Î¤ß¤Ç¤šĄŁĽŻĽéĽ¤Ľ˘ĽóĽČÂŚ¤Î API
+ ¤ÎžÜşŮ¤Ë¤Ä¤¤¤Ć¤ĎĄ˘XF86DGA(3) ¤ÎĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë¤Č README.DGA ¤ň
+ ť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o şŁ˛óĄ˘XInput ľĄÇ˝łČÄĽ¤ÎźÂÁő¤ň´Ţ¤á¤Ţ¤ˇ¤żĄŁ¤ł¤ÎľĄÇ˝łČÄĽ¤ĎźĄ¤ÎĽÇĽĐĽ¤Ľš
+ ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ:
+
+ o Ľ¸ĽçĽ¤ĽšĽĆĽŁĽĂĽŻ (Linux, FreeBSD, NetBSD ¤Č OpenBSD ¤Î¤ß)
+
+ o Wacom ĽżĽÖĽěĽĂĽČ (Wacom IV Ľ×ĽíĽČĽłĽë ¤Î¤ß)
+
+ o Elographics ĽżĽĂĽÁĽšĽŻĽęĄźĽó
+
+ o SummaSketch ĽżĽÖĽěĽĂĽČ
+
+ o ĽŢĽŚĽš
+
+ š˝ŔŽÄęľÁ¤Ë¤Ä¤¤¤Ć¤Ď XF86Config(4/5) ¤Č xinput document ¤ňť˛žČ¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁ
+
+ o şŁ˛óĄ˘É¸˝ŕ¤Îšő¤ČÇň¤ÎĽÔĽŻĽťĽë¤ÎżôĂͤĎÁ´¤Ć¤ÎĽľĄźĽĐ¤Çšő = 0 ¤ČÇň = 1
+ ¤Ç¤šĄŁ¤ł¤ě¤ňĆţ¤ěÂؤ¨¤ë¤Ë¤Ď `-flipPixels' ¤ÎĽłĽŢĽóĽÉšÔĽŞĽ×ĽˇĽçĽó¤ňťČ
+ ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ o şŁ˛óĄ˘˛źŔţʸťú¤Ď XF86Config ĽŐĽĄĽ¤ĽëĆâ¤Î Options ¤Č Ľ­ĄźĽďĄźĽÉ¤Ç¤Ď
+ Ěľťë¤ľ¤ě¤Ţ¤šĄŁ
+
+ o ɸ˝ŕ¤Ç X ĽľĄźĽĐĆ⢤Πmalloc ¤ňťČ¤¤¤Ţ¤šĄŁ
+
+ o ĽÓĽĂĽČĽŢĽĂĽ×ĽŐĽŠĽóĽČĽŃĽšÍ×ÁÇ¤Ë ":unscaled" ¤ňÄɲ䚤ë¤ČĽŐĽŠĽóĽČ¤ňłČ
+ Âç˝ĚžŽ˝ĐÍč¤Ę¤¤Íͤ˽ĐÍč¤Ţ¤šĄŁ¤ł¤ě¤ĎĽŐĽŠĽóĽČĽľĄźĽĐ (xfs) ¤Ç¤âĆ°şî¤ˇ¤Ţ
+ ¤šĄŁ
+ o *şŁ˛óĄ˘PEX ¤Č XIE ĽľĄźĽĐľĄÇ˝łČÄĽ¤Ź Linux/ELF, FreeBSD, NetBSD ¤Č
+ OpenBSD ¤Ç¤ĎĆ°ĹŞ¤ËĽíĄźĽÉ˝ĐÍč¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤ˇ¤żĄŁ
+
+ 3.3. XF86Setup ¤Ë¤Ä¤¤¤Ć
+
+ o `XF86Setup' ¤Č¸Ć¤Ö X ĽľĄźĽĐ¤Îš˝ŔŽžđĘóÄęľÁ¤Îżˇ¤ˇ¤¤Ľ°ĽéĽŐĽŁĽĂĽŻĽ¤ĽóĽż
+ ĽŐĽ§ĄźĽš¤ÎĽćĄźĽĆĽŁĽęĽĆĽŁ¤ň 3.2 ¤Ë´Ţ¤ß¤Ţ¤ˇ¤żĄŁĂí°Őťöšŕ: VGA ĽľĄźĽĐ¤Ź
+ ĆłĆţşŃ¤ÇĽÓĽÇĽŞĽŤĄźĽÉ¤Ëšç¤ď¤ť¤ĆŔßÄęşŃ¤ŹÁ°Äó¤Ç¤šĄŁ
+
+ 3.4. PC98 ¤ÎĽľĽÝĄźĽČ
+
+ o PC98 ĽŃĽ˝ĽłĽó¤ňÄɲüľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ÎĽŃĽ˝ĽłĽó¤ĎĽ¤ĽóĽĆĽë¤ňťČ¤Ă¤ż
+ ĽŃĽ˝ĽłĽó¤ÇĆüËܤÇÉáľÚ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ o PANIX-PC98 SVR4.0 ¤Č¤¤¤Ś OS ÂĐąţ¤ÇÄɲ䡤ޤˇ¤żĄŁ
+
+ o źĄ¤Î PC-98 ĆĂÍ­¤Î X ĽľĄźĽĐ¤Ź´Ţ¤Ţ¤ě¤Ć¤¤¤Ţ¤šĄŁ
+
+ o XF98_NECS3 PC98 NEC(S3) ĽľĄźĽĐĄŁ
+
+ o XF98_PWSKB SKB-PowerWindow(S3) ĽľĄźĽĐĄŁ
+
+ o XF98_PWLB PC98 PowerWindowLB(S3) ĽľĄźĽĐĄŁ
+
+ o XF98_GA968 GA-968V4/PCI(S3 968)ĄŁ
+
+ o XF98_TGUI Cyber9320 and TGUI9680ĄŁ
+
+ o XF98_NKVNEC NKV-NEC(cirrus) ĽľĄźĽĐĄŁ
+
+ o XF98_WABS WABS(cirrus) ĽľĄźĽĐĄŁ
+
+ o XF98_GANBWAP GANB-WAP(cirrus) ĽľĄźĽĐĄŁ
+
+ o XF98_WABEP WAB-EP(cirrus) ĽľĄźĽĐĄŁ
+
+ o XF98_WSNA WSN-A2F(cirrus) ĽľĄźĽĐĄŁ
+
+ o XF98_EGC EGC(generic vga16) ĽľĄźĽĐĄŁ
+
+ o XF98_NEC480 PEGC-480(generic vga256) ĽľĄźĽĐĄŁ
+
+ 3.5. XInput ľĄÇ˝łČÄĽ
+
+ o XInput ĽÇĽĐĽ¤ĽšÂĐąţ¤ÎąÇÁüˇż¤ÎÁŕşîÍúÎň(ĽâĄźĽˇĽçĽóĽŇĽšĽČĽę: motion
+ history) ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘XInput ĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤Ď Linux/ELF, FreeBSD ¤Č NetBSD¤Ç¤ĎĆ°
+ ĹŞ¤ËĽíĄźĽÇĽŁĽóĽ°¤ľ¤ě¤Ţ¤šĄŁ
+
+ o ĘŁżô¤Î XInput ĽÇĽĐĽ¤Ľš¤ňťŘÄę¤Ç¤­¤Ţ¤šĄŁ
+
+ 3.6. S3 ĽľĄźĽĐ
+
+ o S3 Trio64V+ ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ o *S3 ViRGE ¤Č ViRGE/VX ÂĐąţ¤Îżˇ¤ˇ¤¤ĽľĄźĽĐ (XF86_S3V) ĄŁ¤ł¤ÎĽľĄźĽĐ¤Ď
+ ÂçĘŃżˇ¤ˇ¤¤¤Î¤Ç "ĽŮĄźĽżČÇ" ¤Čť×¤Ă¤ĆĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤ÇľŻ¤­¤ż¤É
+ ¤ó¤ĘĚäÂę¤Ç¤âĘóšđ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o AT&T 20C409 ¤Č 20C499 RAMDAC ÂĐąţ¤Î S3 ĽľĄźĽĐĄŁ
+
+ o Ľ˘ĽŻĽťĽéĽěĄźĽż¤ÇČŻŔ¸¤ˇ¤Ś¤ëŔřşßĹŞ¤ĘĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o żˇ¤ˇ¤¤ MMIO ĽâĄźĽÉ¤ňťČ¤Ś 868/968/Trio64V+ ÂĐąţ¤Îżˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ň S3
+ ĽľĄźĽĐ¤ËÄɲ䡤ޤˇ¤żĄŁ¤ł¤Îżˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ĎĽ¤ĽóĽĆĽëľĄ¤Î¤ł¤ě¤é¤ÎĽÁĽĂ
+ Ľ×ÂĐąţ¤Çɸ˝ŕ¤ËťČ¤¤¤Ţ¤šĄŁĽ˘ĽëĽŐĽĄľĄÂĐąţ¤Ç¤ĎźĄ¤Î¤č¤Ś¤ËťŘÄꤚ¤ë¤ČťČÍŃ
+ ¤Ç¤­¤Ţ¤šĄŁ
+
+ Chipset "NewMMio"
+
+ żˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤Ç˛ż¤ŤĚäÂꤏľŻ¤­¤ż¤éĄ˘ťä¤ż¤Á¤Ë¤ŞĂΤ餝¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤Îżˇ¤ˇ
+ ¤¤ĽÉĽéĽ¤ĽĐ¤ŹťČ¤¨¤Ę¤¤žěšç¤Č¤Ť¸Ĺ¤¤ĽÉĽéĽ¤ĽĐ¤Ç¤Ď°Ę˛ź¤Î¤č¤Ś¤Ë Device Ŕá¤ÇťŘ
+ Äꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ:
+
+ Chipset "mmio_928"
+
+ żˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ňĚľ¸ú¤ËŔßÄꤚ¤ëÁ°¤ËĽĆĽšĽČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˛ż¤ŤĚäÂꤏľŻ¤­¤ż
+ ¤éĄ˘¸Ĺ¤¤ĽÉĽéĽ¤ĽĐ¤Ç¤âĚäÂꤏşĆ¸˝¤š¤ë¤Ťťî¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁˇë˛Ě¤ňťä¤ż¤Á¤Ë
+ śľ¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ(¸Ĺ¤¤ĽÉĽéĽ¤ĽĐ¤Ç¤ĎĚäÂę¤Ď˝¤Ŕľ¤ˇ¤Ć¤¤¤ë¤Ď¤ş¤Ę¤Î¤Ç¤š¤ŹĄŞ)
+
+ o ¤¤¤Ż¤Ä¤Ť¤Î VideoLogic ĽÓĽÇĽŞĽŤĄźĽÉ¤ÇČŻŔ¸¤š¤ë˝é´ü˛˝¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ
+ ¤ˇ¤żĄŁ
+
+ o ELSA Winner 2000PRO/X rev G ¤Č ELSA Gloria-8 (GLint 300SX 3D ĽÁĽĂĽ×
+ ¤ň˝ü¤Ż) ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o S3 ĽľĄźĽĐ¤ÎşŮ¤Ť¤ĘŔţ¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ¤¤¤Ż¤Ä¤Ť¤ÎĽ¤ĽŤ¤ě¤żĽÓĽÇĽŞĽŤĄźĽÉ¤ÇÉ˝ź¨žĺ¤ÎĽÔĽŻĽťĽëĽ¨ĽéĄź¤ň˛óČň¤š¤ë¤ż
+ ¤á "slow_dram" ¤Č "slow_edodram" ĽŞĽ×ĽˇĽçĽó¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o ¤¤¤Ż¤Ä¤Ť¤Î SPEA ĽÓĽÇĽŞĽŤĄźĽÉ¤ÇČŻŔ¸¤š¤ë Ti3026 ¤ÎĽŻĽíĽĂĽŻ¤ÎĚäÂę¤ň˝¤
+ Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽŐĽŠĽóĽČĽ­ĽăĽĂĽˇĽĺ¤ÎĚäÂę¤ňľŻ¤ł¤š Trio32 ¤ÎĽĐĽ°¤ňźŤĆ°Ĺޤ˸Ą˝Đ¤š¤ëĽ×
+ ĽíĽ°ĽéĽŕ¤ňÄɲ䡤ޤˇ¤żĄŁ¸Ą˝Đ¤ˇ¤żžěšçĄ˘˛óÉüşîśČ¤ŹłčĆ°¤ˇ¤Ţ¤šĄŁ
+
+ o ¤¤¤Ż¤Ä¤Ť¤Î 1MB Trio64 VLB ĽÓĽÇĽŞĽŤĄźĽÉ¤Ç¤ÎĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽ˘ĽÉĽěĽš
+ ¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ICS5342 ĽŻĽíĽĂĽŻ¤Î˛ź¸Â¤ÎŔŠ¸Â¤ňĚľ¤Ż¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o Diamond S3 ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĂľĂΤň˛ţÎɤˇ¤Ţ¤ˇ¤żĄŁ°ĘÁ°¤ÎĽĐĄźĽ¸ĽçĽó¤ÇČŻŔ¸
+ ¤ˇ¤Ć¤¤¤ż˛čĚ̤βö¤ęšţ¤ß¤ň˛óČň¤š¤ë "diamond" ĽŞĽ×ĽˇĽçĽó¤ňťČ¤ŚÉŹÍפŹĚľ
+ ¤¤žěšç¤Ďźč¤ę˝ü¤¤¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˛ż¤ŤĚäÂꤏ¤˘¤ëžěšç¤Ďťä¤ż¤Á¤ËϢÍí¤ň
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o 2MB Trio64 ĽÓĽÇĽŞĽŤĄźĽÉÍѤμáĽâĽęĽŃĽéĽáĽż¤Îˇ×ťť¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ°ĘÁ°
+ ¤ÎĽĐĄźĽ¸ĽçĽó¤Ç XF86Config ĽŐĽĄĽ¤Ľë¤ËÄɲ䚤ëÉŹÍפŹ¤˘¤Ă¤ż "S3MClk
+ 170" ¤ÎÍͤʼѼéĽáĽż¤ĎĄ˘şŁ˛ó¤Ť¤éźč¤ę˝ü¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o IBM ¤Î Ramdac ¤ňťČ¤Ă¤Ć¤¤¤ëĽÓĽÇĽŞĽŤĄźĽÉ¤Î XF86Config ¤ÎŔßÄę¤Ç¤Î
+ S3RefClk ¤Îźč°ˇ¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽŔĽÖĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤Ç¤Î S3 ¤Č Bt485 ¤ÎĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňĽľĽÝĄź
+ ĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o Ľ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ČĽŔĽÖĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤Ç¤Î IBM RGB Ramdac ¤ÎĽĎ
+ ĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤Î°ĚĂÖˇč¤á¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤ż(ĽŤĄźĽ˝Ľë¤ÎˇÁžő¤Ď¤Ţ¤Ŕ
+ Ŕľ¤ˇ¤Ż¤Ę¤¤¤ą¤É)ĄŁ
+
+ o PCI ĽÓĽÇĽŞĽŤĄźĽÉÂĐąţ¤ÎĽęĽËĽ˘ĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄ¤Î¸Ą˝Đ¤ŹżĘĘ⤡¤Ţ¤ˇ¤żĄŁ
+ şŁ¤Ţ¤Ç°ěÇŐ¸°¤ŹłÝ¤Ť¤Ă¤Ć¤¤¤ĆťČ¤¨¤Ę¤¤¤ČĘóšđ¤ľ¤ě¤Ć¤¤¤ëĄ˘ĽęĽËĽ˘ĽŐĽěĄźĽŕ
+ ĽĐĽĂĽŐĽĄ¤ňťČ¤Ă¤Ć¤¤¤ëËؤɤΠTrio64V+ ¤ÇťČ¤¨¤Ţ¤šĄŁ
+
+ o ICS9161A ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Î¤ß¤Ę¤é¤ş Ti3026 RAMDAC ¤ňĹëşÜ¤ˇ¤ż ELSA
+ Elsa Winner2000PRO/X-2,4 Rev.G ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤š(̤¤ŔÇÜĽŻĽíĽĂĽŻľť˝Ń
+ ¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤ó)ĄŁ
+
+ o #9 Motion 771 ĽÓĽÇĽŞĽŤĄźĽÉ¤Č Hercules Terminator 64 Pro ĽÓĽÇĽŞĽŤĄź
+ ĽÉÂĐąţ¤Îɸ˝ŕ InvertVCLK ¤ÎŔßÄę¤ňĘŃšš¤ˇ¤Ţ¤ˇ¤żĄŁĽĐĄźĽ¸ĽçĽó 3.1.2 ¤Ç˛č
+ Ě̤βö¤ęšţ¤ß¤ňËɝߤš¤ë¤ż¤á¤Ë Invert_VCLK šÔ¤ň XF86Config ĽŐĽĄĽ¤Ľë¤Ë
+ Äɲ䡤Ƥˇ¤Ć¤¤¤ëžěšç¤ËĄ˘¤ł¤ÎĽĐĄźĽ¸ĽçĽó¤ňĽĆĽšĽČ¤š¤ëťţ¤Ďźč¤ę˝ü¤¤¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁżˇ¤ˇ¤¤É¸˝ŕĂͤDzż¤ŤĚäÂꤏ¤˘¤Ă¤ż¤éĄ˘ťä¤ż¤Á¤ËĘóšđ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ o *ĽĆĽ­ĽšĽČŔÚ¤ęźč¤ę(ĽŻĽęĽĂĽÔĽóĽ°) ¤ÎŔ­Ç˝¤ň¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.7. Mach64 ĽľĄźĽĐ
+
+ o block_write ¤Îźč¤ę°ˇ¤¤¤ÎËؤɤÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ¤˝¤ě¤Ë¤â¤Ť¤Ť¤ď¤é
+ ¤şĄ˘BIOS ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Î˝é´ü˛˝¤ŹŔľ¤ˇ¤ŻšÔ¤ď¤ě¤Ę¤¤žěšç¤ĎĄ˘ÁęĘѤď¤é¤ş
+ XF86Config ¤Ë "no_block_write" ĽŞĽ×ĽˇĽçĽó¤ňÄɲ䚤ëÉŹÍפŹ¤˘¤ë¤Ť¤â¤ˇ
+ ¤ě¤Ţ¤ť¤óĄŁ
+
+ o 16bpp ¤Č 32bpp ĽâĄźĽÉ¤Ç Mach64 CT ĽÓĽÇĽŞĽŤĄźĽÉ¤ň˛ÔĆŻ¤š¤ëžěšçĄ˘˛čĚĚ
+ ¤Ź°Ĺ¤Ż¤Ę¤ëĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁCT ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤Î¤¤¤Ż¤Ä¤Ť¤Î˛ţÄűČǤÇ
+ ¤ĎĚäÂꤏťÄ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ o Mach64 ĽľĄźĽĐ¤Ď VT ¤Č GT ĽÁĽĂĽ×ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁGT ĽÁĽĂĽ×
+ ĽťĽĂĽČ¤Ď "3D Rage" ¤Č¤ˇ¤Ć¤âĂΤé¤ě¤Ć¤¤¤Ţ¤šĄŁ¤č¤ężˇ¤ˇ¤¤ 3D Rage II ¤Ď
+ ̤¤ŔĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ o olvwm ¤ÎĽ˘Ľ¤ĽłĽó¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ghostview ¤ÎĽšĽŻĽíĄźĽëĽĐĄź¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤Î˝¤Ŕľ¤ĎĘóšđ¤Ź
+ ¤˘¤Ă¤ż¤¤¤Ż¤Ä¤Ť¤Î Netscape ¤ÎĽŐĽŠĽóĽČ¤ÎĚäÂę¤â˛ňˇč¤ˇ¤Ţ¤šĄŁ
+
+ o (264CT ¤Ţ¤ż¤Ď 215CT22200 ¤Č¤ˇ¤ĆĂΤé¤ě¤Ć¤¤¤ë) Mach64 CT ĽÁĽĂĽ×ĽťĽĂĽČ
+ ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď RAMDAC ¤ČĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĹý
+ šç¤ˇ¤ż¤â¤Î¤ÇĄ˘¤¤¤Ż¤Ä¤Ť¤Î Graphics Xpression ¤Č WinBoost ĽÓĽÇĽŞĽŤĄź
+ ĽÉ¤ŹĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ o şŁ˛óĄ˘Mach64 GX-F (GX rev 3) ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘(ATI Graphics Turbo Pro 1600 ¤ŹĹëşÜ¤ˇ¤Ć¤¤¤ë) IBM RGB514
+ RAMDAC ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘VLB ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĽáĽâĽę´đÄ켢ĽÉĽěĽš¤ňŔľ¤ˇ¤ŻĂľĂΤš¤ë¤č¤Ś¤Ë¤Ę
+ ¤ę¤Ţ¤ˇ¤żĄŁÁ°¤ÎĽĐĄźĽ¸ĽçĽó¤Ç XF86Config ¤Ë `MemBase' šÔ¤ňÄɲ䚤ëÉŹÍ×
+ ¤Ź¤˘¤Ă¤żžěšçĄ˘şď˝ü¤ˇ¤Ć¤ß¤ĆĄ˘ĚäÂꤏ¤˘¤ě¤Đťä¤ż¤Á¤Ëśľ¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o ¤¤¤Ż¤Ä¤Ť¤Î RAMDAC ¤ň 16bpp/32bpp ¤ÇĆ°şî¤ľ¤ť¤ż¤Č¤­¤ÎĽŤĄźĽ˝Ľë¤Îż§¤ÎĚä
+ Âę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘CH8398 ¤Î¤č¤Ś¤Ę¤¤¤Ż¤Ä¤Ť¤Î RAMDAC ¤ÎĂľĂΤΝţ¤ÎĽ¨ĽéĄź¤ň˝¤Ŕľ¤ˇ¤Ţ
+ ¤ˇ¤żĄŁ
+
+ o RAMDAC ¤Ź 8bpp ¤ÇźÂšÔ¤ˇ¤ż¤Č¤­¤Î RGB Ĺö¤ż¤ę 8 ĽÓĽĂĽČ¤ÎĽâĄźĽÉ¤ňĽľĽÝĄź
+ ĽČ¤ˇ¤Ć¤¤¤ë¤Č¤­¤Ď¤˝¤ÎĽâĄźĽÉ¤ňɸ˝ŕĂͤˤˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝ĽëĽŢĽšĽŻ¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o AT&T 20C408 RAMDAC/ĽÁĽĂĽ×ĽťĽĂĽČ ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o Ǥ°Ő¤ÎĽŻĽíĽĂĽŻźţÇČżô¤Ź˛ÄÇ˝¤ĘĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĹëşÜ¤ˇ¤Ć¤¤¤ëËؤɤμӼÇ
+ ĽŞĽŤĄźĽÉ¤ÎĽŻĽíĽĂĽŻ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤šĄŁ
+
+ o 16bpp ¤Č 32bpp ĽâĄźĽÉ¤Ç¤Î Mach64 CT, VT ¤Č GT ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽĎĄźĽÉ
+ ĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤Îż§¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o VT ¤Č GT ĽÁĽĂĽ×ĽťĽĂĽČ¤ÇĽŔĽÖĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁĽŔĽÖ
+ ĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤Ç¤ĎĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ĎŔľ¤ˇ¤ŻÉ˝ź¨¤ľ¤ě¤Ţ¤ť¤ó¤ŹĄ˘
+ ľĄÇ˝¤ĎŔľ¤ˇ¤ŻĆ°şî¤ˇ¤Ţ¤šĄŁ¤˝¤Îž¤Î Mach64 ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĽ˘ĽŻĽťĽéĽěĄź
+ ĽżĽŔĽÖĽëĽšĽ­ĽăĽóĽâĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ o ËŘ¤É¤ÎĽÓĽÇĽŞĽÜĄźĽÉ¤ÎËż CT, VT ¤Č GT ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽÓĽÇĽŞĽÎĽ¤Ľş¤Ď˝ü
+ ľîĄ˘¤Ţ¤ż¤ĎËż CT ĽÁĽĂĽ×ĽťĽĂĽČ¤ňĹëşÜ¤ˇ¤żĽÓĽÇĽŞĽÜĄźĽÉ¤Ç¤Ď˛ÄÇ˝¤Ę¸Â¤ęˇÚ
+ ¸ş¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o CT, ET, VT ¤Č GT ¤ňĹëşÜ¤ˇ¤żĽÓĽÇĽŞĽÜĄźĽÉ¤ÇĽŻĽíĽĂĽŻĽÁĽĂĽ×Ľ×ĽíĽ°ĽéĽŕĘý
+ ËĄ¤ÎŔşĹ٤Ź¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ÎĘýËĄ¤Ç¤Ď°ĘÁ°¤ÎĘýËĄ¤ĎÉ˝ź¨˝ĐÍč¤Ę¤¤ĽâĄźĽÉ
+ ¤ňÉ˝ź¨¤š¤ë¤č¤Ś¤ËŔßÄę˝ĐÍč¤Ţ¤šĄŁxvidtune Ľ×ĽíĽ°ĽéĽŕ¤Ç¤ĎĄ˘şŁ˛ó¤ÎŔľ¤ˇ¤¤
+ ĽŻĽíĽĂĽŻĽ×ĽíĽ°ĽéĽŕĘýËĄ¤Ë¤č¤ęĄ˘˛ÔĆŻ¤š¤ë¤č¤Ś¤Ę˛čĚ̤ňÄ´Ŕ°˝ĐÍč¤Ţ¤šĄŁ
+
+ o *Mach64 ¤ÎĂľşşĽ×ĽíĽ°ĽéĽŕ¤ÎżŽÍęŔ­¤Ź¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.8. Mach32 ĽľĄźĽĐ
+
+ o ĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝ĽëĽŢĽšĽŻ¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *AT&T 20C490 ¤Č Bt481 RAMDAC ¤Ë 16bpp ĽâĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *¤¤¤Ż¤Ä¤Ť¤Î VT ŔÚ¤ęÂؤ¨¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.9. W32 ĽľĄźĽĐ
+
+ o ET6000 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o (Diamond Stealth 32 ¤ÇťČÍѤľ¤ě¤Ć¤¤¤ë)ICD2061A ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĽľĽÝ
+ ĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽľĄźĽĐ¤ŹĘóšđ¤š¤ë RGB Ĺö¤ż¤ę¤Î bit żô¤Î˛ňÁüĹ٤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o STG1703 RAMDAC/ĽŻĽíĽĂĽŻĽÁĽĂĽ×¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁĽŻĽíĽĂĽŻ¤ň 135MHz
+ ¤Ţ¤Çžĺ¤˛¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤ňťČ¤Ś¤Ë¤Ď
+ XF86Config ¤Î Device Ŕá¤ËźĄ¤ÎšÔ¤ňÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁ
+
+ ClockChip "stg1703"
+
+ o PCI ĽĐĄźĽšĽČĽâĄźĽÉ¤Č W32 Ľ¤ĽóĽżĄźĽęĄźĽÖ¤ňĆţ¤ě¤ż¤ęŔڤ俤ꤚ¤ëĽŞĽ×
+ ĽˇĽçĽó¤ňÄɲ䡤ޤˇ¤żĄŁXF86Config ¤Î Device Ŕá¤ËźĄ¤ÎšŕĚܤňťŘÄę˝ĐÍč¤Ţ
+ ¤šĄŁ
+
+ Option "pci_burst_on"
+ Option "pci_burst_off"
+ Option "w32_interleave_on"
+ Option "w32_interleave_off"
+
+ o ICS5341 Ľ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ě¤ňÍ­¸ú¤Ë¤š¤ë
+ ¤Ę¤é¤Đ XF86Config ĽŐĽĄĽ¤Ľë¤Î Device Ŕá¤ËźĄ¤ÎšŕĚܤňÄɲ䡤ƤŻ¤Ŕ¤ľ
+ ¤¤ĄŁ:
+
+ Ramdac "ics5341"
+ ClockChip "ics5341"
+
+ o W32 ĽľĄźĽĐ¤ÎłŤťĎťţľÚ¤Ó˝ŞÎťťţ¤Ë¸Ç¤Ţ¤Ă¤Ć¤ˇ¤Ţ¤ŚĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *¤¤¤Ż¤Ä¤Ť¤ÎÉÁ˛č¤ÎĽĐĽ°¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.10. AGX ĽľĄźĽĐ
+
+ o AGX-010 ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽŻĽíĽĂĽŻ¤ÎĂľşş¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.11. I128 ĽľĄźĽĐ
+
+ o Number Nine Imagine 128 ĽÓĽÇĽŞĽÜĄźĽÉÂĐąţ¤Îżˇ¤ˇ¤¤ĽľĄźĽĐ¤ňÄɲ䡤ޤˇ
+ ¤żĄŁ¤ł¤ÎĽľĄźĽĐ¤Ď¸˝şßšâÂŽ˛˝¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ o Series 2 ¤ÎĽÓĽÇĽŞĽÜĄźĽÉ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o 8MB ¤ÎĽÓĽÇĽŞĽÜĄźĽÉ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ 3.12. TGA ĽľĄźĽĐ
+
+ o *DEC 21030 (TGA) ÂĐąţ¤Îżˇ¤ˇ¤¤ĽľĄźĽĐ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł¤ÎĽľĄźĽĐ¤Ď
+ Alpha ĽŃĽ˝ĽłĽó¤Ç¤Î¤ßťČÍѲÄÇ˝¤Ç¤šĄŁ¤ł¤ÎĽľĄźĽĐ¤Ď¸˝şßšâÂŽ˛˝¤ˇ¤Ć¤¤¤Ţ¤ť
+ ¤óĄŁ
+
+ 3.13. SVGA/VGA16/Mono ĽľĄźĽĐ
+
+ o ¤ł¤ě¤é¤ÎĽľĄźĽĐ¤Ë PCI ¤ňĂľĂΤš¤ë¤ł¤Č¤ňÄɲ䡤ޤˇ¤żĄŁĚäÂꤏŔ¸¤¸¤żžěšç
+ ¤ĎźĄ¤ÎšÔ¤ň XF86Config ĽŐĽĄĽ¤Ľë¤Î Device Ŕá¤ËÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁ:
+
+ Option "no_pci_probe"
+
+ 3.14. VGA16 ĽľĄźĽĐ
+
+ o StaticGray É˝ź¨¤Ź˝ĐÍč¤Ę¤Ť¤Ă¤żĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.15. ET3000 ĽÉĽéĽ¤ĽĐ (VGA16 ĽľĄźĽĐ)
+
+ o ET3000 ĽÉĽéĽ¤ĽĐ ¤ň VGA16 ĽľĄźĽĐ¤ËÄɲ䡤ޤˇ¤żĄŁ
+
+ 3.16. Trident ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o şŁ˛óĄ˘SVGA ĽľĄźĽĐ ¤Ç TGUI9440 ¤ň´°Á´¤ËĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o trident ˇĎĹý¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎËؤɤËÂçÉý¤ĘĘŃšš¤ň¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘TGUI9660/9680 ĽÁĽĂĽ×ĽťĽĂĽČ¤ň´°Á´¤ËĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ¤ł¤ÎČǤΞܺ٤ˤĤ¤¤Ć¤Ď README.trident ¤ň¤´Í÷¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 3.17. Ark ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o Ark ĽÉĽéĽ¤ĽĐ¤ŹşŁ˛ó ARK2000MT ¤ňĂľĂΤš¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤ˇ¤ż¤ŹĄ˘
+ ARK2000PV ¤Č¤ß¤Ę¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ o XF86Config ĽŐĽĄĽ¤Ľë¤Ë Ramdac ¤ÎťŘÄꤏ¤Ę¤¤¤Č¤­¤ËĽľĄźĽĐ¤ŹĆ°şî¤ˇ¤Ę¤¤Ěä
+ Âę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o Diamond Stealth64 Graphics 2001 ĽˇĽęĄźĽş¤ŹÍ׾ᤡ¤Ć¤š¤ë ICS5342 ĽŻ
+ ĽíĽĂĽŻĽÁĽĂĽ×ĽťĽĂĽČ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł¤ě¤ňÍ­¸ú¤Ë¤š¤ë¤Ë¤Ď XF86Config
+ ĽŐĽĄĽ¤Ľë¤Î Device Ŕá¤ËźĄ¤ÎšÔ¤ňÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁ:
+
+ Ramdac "ics5342"
+ ClockChip "ics5342"
+
+ XF86Config ĽŐĽĄĽ¤Ľë¤Ë Clocks šÔ¤ňĆţ¤ě¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o 2MB ¤ÎĽÓĽÇĽŞĽáĽâĽę¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë ARK2000PV ĽÓĽÇĽŞĽŤĄźĽÉ¤Ç˛čĚ̤Źžĺ˛ź
+ ş¸ąŚ¤ËĆ°¤ŻĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *´đËÜĹŞ¤Ę BitBlt Ľ˘ĽŻĽťĽéĽěĄźĽż¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o *¤¤¤Ż¤Ä¤Ť¤ÎĽÓĽÇĽŞĽŤĄźĽÉ/RAMDAC ¤Ë 24bpp ¤ÎĽŃĽĂĽŻĽČĽÔĽŻĽťĽë¤ňÄɲäˇ
+ ¤Ţ¤ˇ¤żĄŁ
+
+ o *ĽáĽâĽę¤ÎÂÓ°čÉý¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *ĽĎĄźĽÉĽŚĽ§Ľ˘ĽŤĄźĽ˝Ľë¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ 3.18. ET6000 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o *¤ł¤ÎĽÉĽéĽ¤ĽĐ¤ĎĽęĽËĽ˘ĽáĽâĽę¤Č16bpp, 24bpp ¤Č 32bpp ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ¸˝şß W32 Ľ˘ĽŻĽťĽéĽěĄźĽżĽľĄźĽĐ¤Ç¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ
+ ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĄŁ
+
+ 3.19. Alliance ProMotion ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o (Alliance Semiconductor ¤Ź) Alliance ProMotion 6442 ĽÉĽéĽ¤ĽĐ¤ňÄɲĂ
+ ¤ˇ¤Ţ¤ˇ¤żĄŁÄ̤ˇ¤ĆĽĆĽšĽČ¤ˇ¤żĚő¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 3.20. NVidia NV1 / SGS Thomson STG2000 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o *NV1/STG2000 ĽÉĽéĽ¤ĽĐ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď Diamond
+ Edge 3D ĽÓĽÇĽŞĽŤĄźĽÉ¤ËĹëşÜ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎĽÉĽéĽ¤ĽĐ¤Ď¤Č¤Ć¤âżˇ¤ˇ¤¤¤ż
+ ¤á "ĽŮĄźĽżČÇ" ¤Čť×¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ 8bpp ¤Č 16bpp ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ
+
+ 3.21. Matrox Millennium ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o *Matrox Millennium (mga2064w) ĽÉĽéĽ¤ĽĐ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł¤ÎĽÉĽéĽ¤ĽĐ
+ ¤Ď¤Č¤Ć¤âżˇ¤ˇ¤¤¤ż¤á "ĽŮĄźĽżČÇ" ¤Čť×¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ8bpp, 16bpp, 24bpp
+ ¤Č 32bpp ¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ÎĂĘłŹ¤Ç¤Ď¤ł¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎšâÂŽ˛˝
+ ľĄÇ˝¤Î¤Č¤Ć¤â¸ÂÄꤡ¤żľĄÇ˝¤Ŕ¤ą¤ňťČ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ 3.22. Cirrus ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o CL-GD5446, CL-GD5462 ¤Č CL-GD5464 ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o CL-GD7543 ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o ĽéĽĂĽ×ĽČĽĂĽ×ÍѤμÁĽĂĽ×ĽťĽĂĽČ¤Î CL-GD754x ˇĎĹý¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤ż¤Ź¤ł
+ ¤ÎČǤǤĎĆ°¤Ť¤Ę¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ o ÉÔ°ÂÄę¤ĘŔßÄę¤ňČň¤ą¤ë¤ż¤á¤ËĽ×ĽíĽ°ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻ¤ÎĽ×ĽíĽ°ĽéĽŕ¤ňŔ­Ç˝
+ ¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *¤¤¤Ż¤Ä¤Ť¤Î FIFO ¤ÎŔßÄę¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o *54xx ÂĐąţ¤ËĽŃĽĂĽŻĽČĽÔĽŻĽťĽë 24bpp ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o *1MB 5434 ÂĐąţ¤Î 16bpp ¤ÇŔ¸¤¸¤Ć¤¤¤ż¤¤¤Ż¤Ä¤Ť¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.23. SiS ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o SiS 86C201 PCI Ľ°ĽéĽŐĽŁĽĂĽŻĽÓĽÇĽŞĽŤĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 256 ż§¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽÁĽĂĽ×ĽťĽĂĽČ¤Ë "sis86c201" ¤ČťŘÄꤡ¤żžěšç¤Ë SiS 86c202 ¤Č 86c205 ¤Ď
+ ¤Ę¤ó¤Č¤ŤĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ 3.24. Chips ¤Č Technologies ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o ¤ł¤ÎĽÉĽéĽ¤ĽĐ¤Ď¤Ť¤Ę¤ęĂř¤ˇ¤Żşî¤ęÄž¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 65546, 65548, 65550 ¤Č 65554 ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 65530 ¤Čžĺľ­ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽęĽËĽ˘Ľ˘ĽÉĽěĽĂĽˇĽóĽ°¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 65545 ¤Čžĺľ­ĽÁĽĂĽ×ĽťĽĂĽČ¤Î 16bpp ¤Č 24bpp (ĽŃĽĂĽŻĽČĽÔĽŻĽťĽë) ¤ňĽľĽÝ
+ ĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o 65545, 65546, 65548 ¤Č 65550 ¤Î BitBLT ¤Č¤˝¤Îž¤ÎšâÂŽ˛˝¤ňšÔ¤¤¤Ţ¤ˇ
+ ¤żĄŁ
+
+ 3.25. ALI ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o şŁ˛óĄ˘¤ł¤ÎĽÉĽéĽ¤ĽĐ¤ÇĽ¤ĽóĽżĽěĄźĽšĽâĄźĽÉ¤ŹĆ°şî¤ˇ¤Ţ¤šĄŁ
+
+ 3.26. ATI ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o Mach64 ¤ÎĽľĽÝĄźĽČ¤ň˛ţÎɤˇ¤Ţ¤ˇ¤żĄŁ
+
+ o ĽÉĽéĽ¤ĽĐĚžžÎ¤ň "vgawonder" ¤Ť¤é "ati" ¤ËĚᤡ¤Ţ¤ˇ¤żĄŁ
+
+ o ËؤɤΠşÇśá¤Î Mach64 ĽÓĽÇĽŞĽŤĄźĽÉ¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o "undoc_clocks" ĽŞĽ×ĽˇĽçĽó¤ňşď˝ü¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ÎĽŞĽ×ĽˇĽçĽó¤ňťČÍѤˇ¤Ć¤¤
+ ¤ëžěšç¤Ď XF86Config ĽŐĽĄĽ¤Ľë¤Ť¤éşď˝ü¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o VGA Wonder V3 ĽÓĽÇĽŞĽÜĄźĽÉ¤ÎĽŤĽéĄźĽŢĽĂĽ×¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.27. WD90C24 ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o šâ¤¤ĽŻĽíĽĂĽŻ¤ÇľŻ¤ł¤ëŔă¤Îšß¤ëĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.28. Compaq AVGA ĽÉĽéĽ¤ĽĐ (SVGA ĽľĄźĽĐ)
+
+ o ¤ł¤ÎČÇ¤Ç¤Ď Compaq AVGA ĽÉĽéĽ¤ĽĐ¤ĎťČÍŃ˝ĐÍč¤Ţ¤ť¤óĄŁ¤Č¤¤¤Ś¤Î¤ĎĆ°şî¤ˇ¤Ę
+ ¤¤¤Î¤ČĄ˘ĂŻ¤â¤ł¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤ż¤Ź¤é¤Ę¤¤¤Ť¤é¤Ç¤šĄŁ
+
+ 3.29. Hercules mono ĽÉĽéĽ¤ĽĐ
+
+ o Hercules mono ĽÉĽéĽ¤ĽĐ ¤ĎťČÍŃ˝ĐÍč¤Ţ¤ť¤óĄŁ¤Č¤¤¤Ś¤Î¤ĎĚäÂꤏ¤˘¤Ă¤ĆĄ˘¤š
+ ¤°¤Ë˝¤Ŕľ˝ĐÍč¤ë¸Ťšţ¤ß¤Ź¤Ę¤¤¤Ť¤é¤Ç¤šĄŁ
+
+ 3.30. ĽŻĽéĽ¤Ľ˘ĽóĽČ/ĽéĽ¤ĽÖĽéĽę¤ÎĘŃššĹŔ
+
+ o xterm ¤Ë vt220/vt320 ¤ÎËؤɤμ¨ĽšĽąĄźĽ×ĽˇĄźĽąĽóĽš¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o xterm ¤Ë ddterm ¤ÎĽ¨ĽšĽąĄźĽ×ĽˇĄźĽąĽóĽš¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o żˇľĄÇ˝¤ÎšÔ¤Î°Ů¤Ë xterm ¤Î termcap ¤Č terminfo ¤ÎšŕĚܤňššżˇ¤ˇ¤Ţ¤ˇ
+ ¤żĄŁ¤ł¤ě¤é¤ÎšŕĚܤϰĘÁ°¤Î xterm ¤Č´°Á´¤Ę¸ß´šŔ­¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ o BSD OS ¤Ç¤Î xdm ĽťĽĂĽˇĽçĽó¤Îźč¤ę°ˇ¤¤¤Ë¤Ä¤¤¤Ć˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o libXt ¤Č libX11 ¤ÇĘݰžĺ¤ÎĚäÂę¤ň°ú¤­ľŻ¤ł¤šĽĐĽĂĽŐĽĄ¤Î¤˘¤Ő¤ě¤ÎĚäÂę¤ň
+ ˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ě¤é¤ÎĚäÂę¤ÎĆâ¤ÎŁą¤Ä¤Ď setuid xterm ¤ňÍřÍѤš¤ë¤ł¤Č
+ ¤Ç¤šĄŁ
+
+ o ËؤɤΠBSD ĽˇĽšĽĆĽŕ¤Ç xterm ¤Ë POSIX termios ¤ňÄɲ䡤ޤˇ¤żĄŁ¤ł¤ě¤Ë
+ ¤č¤ę COMPAT_4 ĽŞĽ×ĽˇĽçĽó¤ňÉŐ¤ą¤Ć BSD ĽŤĄźĽÍĽë¤ňŔ¸ŔŽ¤š¤ëÉŹÍפŹĚľ¤Ż¤Ę
+ ¤ę¤Ţ¤šĄŁ
+
+ o X11R6.1 ¤ÎĘŃššĹŔ¤Î°ěÉô¤Ç¤˘¤ë libX11, libXaw, libXext ¤Č libXtst ¤Î
+ śŚÍ­ĽéĽ¤ĽÖĽéĽę¤ÎČǤň 6.1 ¤ËÁý¤ä¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o XFree86 ľĄÇ˝łČÄĽ¤ČĽšĽŻĽęĄźĽóĽťĄźĽĐĄźľĄÇ˝łČÄĽ¤ÎĽŻĽéĽ¤Ľ˘ĽóĽČÂŚĽéĽ¤ĽÖ
+ ĽéĽę¤Ďł°ÉôĽéĽ¤ĽÖĽéĽę¤Ë°ÜĆ°¤ˇ¤Ţ¤ˇ¤żĄŁ¸Ĺ¤¤ libXExExt ¤Ďşď˝ü¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o şŁ˛óĄ˘xterm ¤Ëɸ˝ŕ¤ÇĽŤĽéĄźÉ˝ź¨¤ňĽľĽÝĄźĽČ¤ˇ¤Ţ¤ˇ¤żĄŁxterm ¤Ë (X11R6.1
+ ¤ÎÉôĘŹ¤Č¤ˇ¤Ć) I18N ľĄÇ˝¤Ź¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ°ĘÁ°¤Îż§Ąš¤Ę "color_xterm"¤Î
+ ÇÉŔ¸¤ÎŁą¤Ä¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤ĎĄ˘¤ł¤Î xterm ¤ňťî¤ˇ¤ĆĚäÂꤏ¤˘¤Ă¤żťţ¤Ëťä
+ ¤ż¤Á¤Ë¤ŞĂΤ餝¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ o xdpyinfo ¤ň Xinput ľĄÇ˝łČÄĽ¤Č XFree86 ľĄÇ˝łČÄĽ¤Ë´Ř¤š¤ë¤č¤ęžÜşŮ¤Ęžđ
+ Ęó¤ňÄ󜥤š¤ë¤č¤Ś¤Ëššżˇ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o łČÄĽ¤ˇ¤żĽšĽŻĽęĄźĽóĽťĄźĽĐĄź¤ÎĽŃĽéĽáĄźĽż¤ÎŔßÄę/ĽĆĽšĽČ¤ň xset ¤ËÄɲäˇ
+ ¤Ţ¤ˇ¤ż(xvidtune ¤ÇťČ¤¤¤Ţ¤ˇ¤ż)ĄŁşŁ˛óĄ˘xset ¤ĎĽ­ĄźĽÜĄźĽÉ¤ÎˇŤ¤ęĘÖ¤ˇĆţ
+ ÎϤμѼéĽáĄźĽż¤ÎŔßÄę¤Ë¤âťČÍŃ˝ĐÍč¤Ţ¤šĄŁ
+
+ o źĄ¤Îżˇ¤ˇ¤¤ĽŻĽéĽ¤Ľ˘ĽóĽČ¤ňÄɲ䡤ޤˇ¤żĄ˘
+
+ o dga -- XFree86-DGA ľĄÇ˝łČÄĽ¤ÎĽĆĽšĽČÍŃĽ×ĽíĽ°ĽéĽŕĄŁ
+
+ o xsetmode, xsetpointer -- XInput ľĄÇ˝łČÄĽ¤ČśŚ¤ËťČÍѤš¤ëĽ×ĽíĽ°ĽéĽŕĄŁ
+
+ o X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î R6 fix-13 ¤Ť¤é¤Î xdm ¤ÎĘݰžĺ¤Î˝¤Ŕľ¤ňźč¤ęĆţ¤ě¤Ţ
+ ¤ˇ¤żĄŁ
+
+ o Unixware 2.x ÂĐąţ¤Ë xconsole ¤ňššżˇ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o XNLS ¤Ë KOI8-R ¤ňÄɲ䡤ޤˇ¤żĄŁ
+
+ o xrdb ¤ĎʸťúÎóÎΰč¤ňÎΰ褢¤Ő¤ě¤ňČň¤ą¤ë¤č¤Ś¤ËĆ°ĹŞłä¤ęĹö¤Ć¤ˇ¤Ţ¤šĄŁ
+
+ o xterm ¤ÎĽáĽâĽę¤˘¤Ő¤ě¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o "AllowNullPasswd" ĽęĽ˝ĄźĽš¤ň xdm ¤ËÄɲ䡤ޤˇ¤żĄŁ
+
+ o X ĽłĽóĽ˝ĄźĽˇĽ˘Ľŕ¤Î R6 fix-13 ¤Ť¤é¤Î libXt ¤ÎĽĐĽ°¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.31. xf86config ĽćĄźĽĆĽŁĽęĽĆĽŁ
+
+ o IBM Ramdac ¤ÎŔľ¤ˇ¤Ż¤Ę¤¤źč¤ę°ˇ¤¤¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 3.32. SuperProbe
+
+ o C&T 65548, Cirrus CL-GD7543/1, AT&T20C409, AT&T20C499 ¤ÎĂľĂΤňÄɲĂ
+ ¤ˇĄ˘Ŕľ¤ˇ¤Ż¤Ę¤¤ ET4000/W32 ¤ÎĂľşş¤ÎĚäÂę¤ň˝¤Ŕľ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o Mach64 ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĂľĂΤňÂż¤¤¤Ë¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o Trident ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĂľĂΤň¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ o SiS, ARK, S3 ViRGE ĽÓĽÇĽŞĽŤĄźĽÉ¤ÎĂľĂΤňÄɲ䡤ޤˇ¤żĄŁ
+
+ 3.33. ĽŐĽŠĽóĽČ
+
+ o Ľ­ĽęĽëʸťúĽŐĽŠĽóĽČ¤ňššżˇ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 4. XFree86 3.2 ¤ÎĆłĆţ
+
+ XFree86 3.2 ĽĐĽ¤ĽĘĽęČǤϲţÄűČǤȤˇ¤Ć¤Ç¤Ď¤Ę¤Ż´°Á´ČǤȤˇ¤ĆÇŰÉۤˇ¤Ţ¤šĄŁ
+
+ XFree86 3.2 ¤Îš˝ŔŽÍ×ÁǤΰěÍ÷¤ĎźĄ¤ÎÄ̤ę¤Ç¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î OS Ëč¤ËÁę°ă¤Ź¤˘
+ ¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ źĄ¤ĎÁ´¤Ć¤ňĆłĆţ¤š¤ë¤Î¤ËÉŹÍפǤšĄŁ:
+
+ preinst.sh ĆłĆţÁ°ĽšĽŻĽęĽ×ĽČ
+ postinst.sh ĆłĆţ¸ĺĽšĽŻĽęĽ×ĽČ
+ X32bin.tgz ĽŻĽéĽ¤Ľ˘ĽóĽČĄ˘ĽéĽóĽżĽ¤ĽŕĽéĽ¤ĽÖĽéĽę¤ČĽ˘Ľ×ĽęĽąĄźĽˇĽçĽó¤Î
+ ɸ˝ŕĂÍĽŐĽĄĽ¤Ľë
+ X32doc.tgz ʸ˝ń
+ X32fnts.tgz 75dpi, źţĘŐĽŐĽĄĽ¤Ľë¤Č PEX ĽŐĽŠĽóĽČ
+ X32lib.tgz źÂšÔťţ¤ËÉŹÍפʼǥźĽżĽŐĽĄĽ¤Ľë
+ X32man.tgz ĽŞĽóĽéĽ¤ĽóĽŢĽËĽĺĽ˘Ľë
+ X32set.tgz XF86Setup ĽćĄźĽĆĽŁĽęĽĆĽŁ
+ X32VG16.tgz 16 ż§ VGA ĽľĄźĽĐ(XF86Setup ¤Ź¤ł¤ÎĽľĄźĽĐ¤ňÉŹÍפȤˇ¤Ć¤¤¤Ţ¤š)
+
+ ˝é¤á¤Ć¤ÎĆłĆţ¤Ë¤ĎźĄ¤ŹÉŹÍפǥ˘´ű¤ËĆłĆţ¤ˇ¤Ć¤¤¤ëžěšç¤Ë¤ĎÄɲúîśČ¤Ź¤˘¤ę¤Ţ
+ ¤šĄŁ:
+
+ X32cfg.tgz xinit, xdm ¤ÎŔßÄęĽŐĽĄĽ¤Ľë¤ÎÎăÂę
+
+ Ăí°ŐĄ§xinit ¤ä xdm ¤ÎŔßÄęĽŐĽĄĽ¤Ľë¤ňĘŃšš¤ˇ¤Ć¤¤¤ë´ű¤ËĆłĆţ¤ˇ¤Ć¤¤¤ë˝ę¤Ë
+ X32cfg.tgz ¤ňžĺ˝ń¤­¤š¤ë¤Č¤­¤Ď˝˝ĘŹĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁX32cfg.tgz ¤ňĆłĆţ¤š
+ ¤ë¤Č´ű¤Ë¸şß¤š¤ëĽŐĽĄĽ¤Ľë¤ň˝ń¤­´š¤¨¤Ć¤ˇ¤Ţ¤¤¤Ţ¤šĄŁĽŐĽĄĽ¤Ľë¤ňĘŃšš¤ˇ¤Ć¤¤¤ë
+ žěšç¤Ď X32cfg.tgz ¤ňĆłĆţ¤š¤ëÉŹÍפϤ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ źĄ¤Î X ĽľĄźĽĐ¤Ď PC/AT ľĄÍѤǤšĄŁľĄşŕ¤Ë°ěĂפš¤ë¤â¤Î¤ň VGA16 ĽľĄźĽĐźă¤Ż
+ ¤Ď¤¤¤Ĺ¤ě¤ŤŁą¤ÄÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁVGA16 ĽľĄźĽĐ¤Ďżˇ¤ˇ¤¤š˝ŔŽžđĘóŔßÄęĽćĄź
+ ĽĆĽŁĽęĽĆĽŁ(XF86Setup) ¤ËÉŹÍפǤšĄŁ
+
+ X328514.tgz 8514/A ĽľĄźĽĐ
+ X32AGX.tgz AGX ĽľĄźĽĐ
+ X32I128.tgz I128 ĽľĄźĽĐ
+ X32Ma32.tgz Mach 32 ĽľĄźĽĐ
+ X32Ma64.tgz Mach 64 ĽľĄźĽĐ
+ X32Ma8.tgz Mach 8 ĽľĄźĽĐ
+ X32Mono.tgz Mono ĽľĄźĽĐ
+ X32P9K.tgz P9000 ĽľĄźĽĐ
+ X32S3.tgz S3 ĽľĄźĽĐ
+ X32S3V.tgz S3 ViRGE ĽľĄźĽĐ
+ X32SVGA.tgz SVGA ĽľĄźĽĐ
+ X32VG16.tgz 16 colour VGA ĽľĄźĽĐ (XF86Setup ¤Ď¤ł¤ÎĽľĄźĽĐ¤ŹÉŹÍפǤš)
+ X32W32.tgz ET4000/W32, ET6000 ĽľĄźĽĐ
+
+ źĄ¤Ď Alpha ľĄÍŃ X ĽľĄźĽĐ¤Ç¤šĄŁ
+
+ X32TGA.tgz DEC 21030 (TGA) ĽľĄźĽĐ
+
+ źĄ¤Ď PC98 ľĄÍѤΠX ĽľĄźĽĐ¤Ç¤šĄŁPC98 ľĄ¤ň¤â¤Ă¤Ć¤¤¤ëžěšç¤Ď¤Şźę¸ľ¤ÎľĄşŕ¤Ë
+ šç¤Ă¤Ć¤¤¤ë¤â¤Î¤ňÁŞÂň¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁPC98 ľĄ¤Ź˛ż¤ŤĂΤé¤Ę¤¤žěšç¤ĎĄ˘¤¤¤ş¤ě
+ ¤âÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁ
+
+ X329NS3.tgz PC98 NEC(S3) ĽľĄźĽĐ
+ X329SPW.tgz PC98 PCSKB-PowerWindow(S3) ĽľĄźĽĐ
+ X329LPW.tgz PC98 PowerWindowLB(S3) ĽľĄźĽĐ
+ X329EGC.tgz PC98 EGC(generic) ĽľĄźĽĐ
+ X329GA9.tgz PC98 GA-968V4/PCI(S3 968) ĽľĄźĽĐ
+ X329GAN.tgz PC98 GANB-WAP(cirrus) ĽľĄźĽĐ
+ X329480.tgz PC98 PEGC-480(generic) ĽľĄźĽĐ
+ X329NKV.tgz PC98 NKV-NEC(cirrus) ĽľĄźĽĐ
+ X329WS.tgz PC98 WABS(cirrus) ĽľĄźĽĐ
+ X329WEP.tgz PC98 WAB-EP(cirrus) ĽľĄźĽĐ
+ X329WSN.tgz PC98 WSN-A2F(cirrus) ĽľĄźĽĐ
+ X329TGU.tgz PC98 TGUI ĽľĄźĽĐ
+
+ źĄ¤ĎĽŞĽ×ĽˇĽçĽó¤Ç¤šĄŁ
+
+ X32f100.tgz 100dpi ĽŐĽŠĽóĽČ
+ X32fcyr.tgz Ľ­ĽęĽëʸťúĽŐĽŠĽóĽČ
+ X32fnon.tgz ¤˝¤Îž¤ÎĽŐĽŠĽóĽČ (Ăćšń¸ě, ĆüËܸě, ´Úšń¸ě, ĽŘĽÖĽéĽ¤¸ě)
+ X32fscl.tgz ĽšĽąĄźĽéĽÖĽëĽŐĽŠĽóĽČ (Speedo ¤Č Type1)
+ X32fsrv.tgz ĽŐĽŠĽóĽČĽľĄźĽĐ¤ČŔßÄęĽŐĽĄĽ¤Ľë
+ X32prog.tgz X ĽŘĽĂĽŔĽŐĽĄĽ¤Ľë, ŔßÄęĽŐĽĄĽ¤Ľë¤ČĽłĽóĽŃĽ¤Ľë¤ËÉŹÍפʼ鼤ĽÖĽéĽę
+ X32lkit.tgz X ĽľĄźĽĐĽęĽóĽŻĽ­ĽĂĽČ
+ X32lk98.tgz PC98 X ĽľĄźĽĐĽęĽóĽŻĽ­ĽĂĽČ
+ X32nest.tgz ĽÍĽšĽČ¤ˇ¤ż X ĽľĄźĽĐ
+ X32vfb.tgz ˛žÁۼռ쥟ĽŕĽĐĽĂĽŐĽĄ¤ňťČ¤Ś X ĽľĄźĽĐ
+ X32ps.tgz ʸ˝ń¤ÎĽÝĽšĽČĽšĽŻĽęĽ×ĽČČÇ
+ X32html.tgz ʸ˝ń¤Î HTML ČÇ
+
+ ´ű¤Ë XFree86 ¤Î¤¤¤ş¤ě¤Ť¤ňĆłĆţşŃ¤ß¤Îžěšç¤ĎĄ˘Âž¤Îťö¤ňšÔ¤ŚÁ°¤Ë /usr/X11R6
+ ¤ÎĽĐĽĂĽŻĽ˘ĽĂĽ×¤ňźč¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁÉ¸˝ŕ¤ÎĆłĆţźę˝ç¤Ç¤ĎĄ˘¤˝¤ł¤Ë¤˘¤ë XFree86
+ ¤ňžĺ˝ń¤­¤ˇ¤Ţ¤šĄŁ
+
+ żˇľŹ¤ËĆłĆţ¤š¤ëžěšç¤Ď /usr/X11R6 ¤Č¤¤¤ŚĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤ĆĄ˘¤˝¤ˇ¤Ć
+ .tgz ĽŐĽĄĽ¤Ľë¤ňż­ÄĽ (extract) ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁżˇľŹĆłĆţ¤ňšÔ¤Ś¤Î¤Ë /usr ¤Ë
+ ˝˝ĘŹ¤Ęśő¤Ź¤Ę¤¤žěšç¤ĎĄ˘¤É¤ł¤ŤÂž¤ËĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤Ć /usr/ ¤ËĽˇĽóĽÜ
+ ĽęĽĂĽŻĽęĽóĽŻ¤ňşîŔŽ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁÎ㤨¤ĐĄ˘/home ¤ËĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤š¤ë
+ žěšç¤ĎźĄ¤Î¤č¤Ś¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ:
+
+ mkdir /home/X11R6
+ ln -s /home/X11R6 /usr
+
+ źĄ¤ÎĂĘłŹ¤ĎĆłĆţÁ°ĽšĽŻĽęĽ×ĽČ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ÎĽšĽŻĽęĽ×ĽČ¤ĎĽˇĽšĽĆĽŕ
+ ¤Î¤¤¤Ż¤Ä¤Ť¤ÎÍ˝Č÷Ä´şş¤ňšÔ¤¤¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤Î OS ¤Ç¤ĎĆłĆţÁ°ĽšĽŻĽęĽ×ĽČ¤Źżˇ
+ ¤ˇ¤¤ĽˇĽšĽĆĽŕš˝ŔŽÍ×ÁǤňĆłĆţ¤š¤ë¤ŤĆłĆţÁ°¤ËĘš¤¤¤Ć¤­¤Ţ¤šĄŁ¤ł¤ÎĽšĽŻĽęĽ×ĽČ¤Ď
+ ĚäÂę¤ňľŻ¤ł¤ˇ¤˝¤Ś¤ĘĄ˘¸Ĺ¤Ż¤Ę¤Ă¤żĽŐĽĄĽ¤Ľë¤ČĽˇĽóĽÜĽęĽĂĽŻĽęĽóĽŻ¤ň°ĘÁ°¤ÎĆłĆţ
+ ¤ˇ¤ż¤â¤Î¤Ť¤éşď˝ü¤ˇ¤Ţ¤šĄŁ preinst.sh ¤ň /var/tmp ¤ËĽłĽÔĄź¤ˇ¤ĆĄ˘¤˝¤ě¤Ť¤é
+ /usr/X11R6 ¤Ë°ÜĆ°¤ˇ¤ĆĽšĽŻĽęĽ×ĽČ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ:
+
+ cd /usr/X11R6
+ sh /var/tmp/preinst.sh
+
+ ¤ňż­ÄĽ¤ˇ¤ż¤é /usr/X11R6 ¤Ë°ÜĆ°¤ˇ¤Ć root ¤Ë¤Ę¤Ă¤ĆźĄ¤ÎÉŹÍפʼռĄĽ¤Ľë¤ňźÂ
+ šÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ gzip -d < X32file.tgz | tar vxf -
+
+ ¤¤¤Ż¤Ä¤Ť¤Î OS ¤Ç¤ĎĄ˘¤¤¤Ż¤Ä¤Ť "Broken Pipe" ¤Č¤¤¤ŚĽáĽĂĽťĄźĽ¸¤Ź˝ĐÎϤľ¤ě
+ ¤Ţ¤šĄŁ¤ł¤ÎĽáĽĂĽťĄźĽ¸¤Ë´ŘϢ¤ˇ¤żÂž¤ÎĽáĽĂĽťĄźĽ¸¤Ź¤Ę¤¤žěšçĄ˘Ěľťë¤ˇ¤Ć¤âˇëš˝
+ ¤Ç¤šĄŁĂí°Őťöšŕ: ¤ł¤ÎĆłĆţşîśČĂć¤Ë X ¤ňľŻĆ°¤ˇ¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄŁĆłĆţ¤ËťŮžă
+ ¤ň¤­¤ż¤šÍÍĄš¤Ęťö¤ŹľŻ¤ł¤Ă¤ż¤ęĄ˘X ĽťĽĂĽˇĽçĽó¤Ź˝ŞÎť¤ˇ¤ż¤ę¤ˇ¤Ţ¤šĄŁ
+
+ NetBSD ¤Ţ¤ż¤Ď FreeBSD ¤ňťČÍѤˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘¤č¤ęłÎźÂ¤Ę(¤Ť¤ÄśŻ¤Ż¤Ş´Ť¤á
+ ¤š¤ë) ĆłĆţĘýËĄ¤Ď .tgz ĽŐĽĄĽ¤Ľë¤ňźĄ¤Î¤č¤Ś¤Ëż­ÄĽ¤š¤ë¤ł¤Č¤Ç¤šĄŁ:
+
+ gzip -d < X32file.tgz | tar -v -x --unlink -f -
+
+ GNU cpio (Linux ¤Ďťý¤Ă¤Ć¤¤¤Ţ¤š) ¤Ţ¤ż¤Ď SVR4 cpio ¤ňťý¤Ă¤Ć¤¤¤ë¤Ę¤é¤ĐĄ˘
+ ¤č¤ęłÎźÂ¤Ę(¤Ť¤ÄśŻ¤Ż¤Ş´Ť¤á¤š¤ë) ĆłĆţĘýËĄ¤Ď .tgz ĽŐĽĄĽ¤Ľë¤ňźĄ¤Î¤č¤Ś¤Ëż­
+ ÄĽ¤š¤ë¤ł¤Č¤Ç¤šĄŁ:
+
+ gzip -d < X32file.tgz | cpio -i -v -d -u -H ustar
+
+ ÉŹÍ×¤Ę .tgz ĽŐĽĄĽ¤Ľë¤Źż­ÄĽ¤Ç¤­¤ż¤éĄ˘postinst.sh ĽšĽŻĽęĽ×ĽČ¤ň /var/tmp
+ ¤ËĽłĽÔĄź¤ˇ¤ĆĄ˘¤˝¤ˇ¤Ć /usr/X11R6 ¤Ë°ÜĆ°¤ˇ¤ĆĽšĽŻĽęĽ×ĽČ¤ňźÂšÔ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ:
+
+ cd /usr/X11R6
+ sh /var/tmp/postinst.sh
+
+ Linux, FreeBSD ¤Č NetBSD ¤Î¤č¤Ś¤Ę ldconfig ¤ňťČÍѤš¤ë OS ¤Ç
+ ¤ĎĄ˘ldconfig ¤ňźÂšÔ¤š¤ë¤ŤşĆΊ¤Ážĺ¤˛¤ňšÔ¤¨¤ĐĆłĆţ¤Ď´°Îť¤ˇ¤Ţ¤šĄŁĆä˥˘şÇ
+ Äă /usr/lib ¤Č /usr/X11R6/lib ¤ňĽłĽŢĽóĽÉĽéĽ¤Ľó¤Ť¤éÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁľŻ
+ Ć°ťţ¤Ë¤É¤Î¤č¤Ś¤Ë ldconfig ¤ňźÂšÔ¤ˇ¤Ć¤¤¤ë¤Ť /etc/rc ¤ňÄ´şş¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTE.sgml,v 3.47 1996/10/26 09:38:54 dawes Exp
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTE.sgml,v
+ 3.47 1996/10/26 09:38:54 ¤ňĄ˘˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/RELNOTE.sgml,v 3.48 1996/11/26 23:06:30 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/VGADriver.doc b/xc/programs/Xserver/hw/xfree86/doc/Japanese/VGADriver.doc
new file mode 100644
index 000000000..30ef65c18
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/VGADriver.doc
@@ -0,0 +1,966 @@
+ 1996 ÇŻ 01 ˇî 07 Ćü XFree86 ¤Ř (S)VGA ĽÉĽéĽ¤ĽĐ¤ňÄɲ䚤ëĘýËĄ
+ Copyright (c) 1993, 1994 David E. Wexelblat
+ <dwex@XFree86.org> Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ 1.3 šć - 1994 ÇŻ 5 ˇî 29 Ćü
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. ˝řʸ
+
+ 2. ťĎ¤á¤Ë
+
+ 3. ĽÇĽŁĽěĽŻĽČĽęš˝Â¤
+
+ 4. Ŕ¸ŔŽžđĘó¤ÎŔßÄę
+
+ 5. ĽĐĽóĽŻŔÚ¤ęÂؤ¨ľĄÇ˝
+
+ 6. ĽÉĽéĽ¤ĽĐźŤżČ¤Ë¤Ä¤¤¤Ć
+
+ 6.1. ĘŁżô¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ČĽŞĽ×ĽˇĽçĽó
+
+ 6.2. ĽÇĄźĽżš˝Â¤
+
+ 6.3. Ident() ´Řżô
+
+ 6.4. ClockSelect() ´Řżô
+
+ 6.5. Probe() ´Řżô
+
+ 6.6. EnterLeave() ´Řżô
+
+ 6.7. Restore() ´Řżô
+
+ 6.8. Save() ´Řżô
+
+ 6.9. Init() ´Řżô
+
+ 6.10. Adjust() ´Řżô
+
+ 6.11. ValidMode() ´Řżô
+
+ 6.12. SaveScreen() ´Řżô
+
+ 6.13. GetMode() ´Řżô
+
+ 6.14. FbInit() ´Řżô
+
+ 7. żˇĽľĄźĽĐĄź¤ÎŔ¸ŔŽ
+
+ 8. ĽÇĽĐĽĂĽ°
+
+ 9. Ľ˘ĽÉĽĐĽ¤Ľš
+
+ 10. šâĹ٤ĘĎĂÂę
+
+ 11. ť˛šÍʸ¸Ľ
+
+ 12. ĽŮĽóĽŔĄźĎ˘ÍíŔčžđĘó
+ ______________________________________________________________________
+
+ 1. ˝řʸ
+
+ XFree86 ¤Ëżˇ¤ˇ¤¤ SVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽľĽÝĄźĽČ¤ňÄɲ䚤뤳¤Č¤ĎĽĎĄźĽÉĽŚĽ§
+ Ľ˘¤ËĚŠĂ夡¤żĽ×ĽíĽ°ĽéĽßĽóĽ°¤Ë¤Ä¤¤¤ĆłŘ˝Ź¤ˇ¤ż¤¤żÍ¤Ë¤Č¤Ă¤Ćźę¤´¤ż¤¨¤Î¤˘¤ëşî
+ śČ¤Ç¤šĄŁ¤ł¤Î¤č¤Ś¤ĘşîśČ¤Ë¤Ď´í¸ą¤Ź°ěÇդǤšĄŁĆä˥˘ĽŢĽˇĽó¤ŹĽĎĽóĽ°Ľ˘ĽĂĽ×¤ˇ
+ ¤Ć¤ˇ¤Ţ¤Ś¤č¤Ś¤Ę¤ł¤Č¤ĎĆüžďĂăČÓťö¤Ç¤šĄŁ¤˝¤ě¤Ç¤âşÇ˝ŞĹŞ¤ËĄ˘ĽľĄźĽĐĄź¤ŹÎŠ¤Ážĺ
+ ¤Ź¤Ă¤Ć¤Ś¤Ţ¤ŻĆ°¤¤¤Ć¤Ż¤ě¤żťţ¤ĎĄ˘ÄěĂΤě¤ĚËţ­´ś¤Ë¤Ň¤ż¤ě¤Ţ¤šĄŁ
+
+ SVGA ĽÁĽĂĽ×ĽťĽĂĽČÂĐąţ¤ÎĽÉĽéĽ¤ĽĐ¤ňÄɲ䚤뤳¤Č¤ĎĽľĄźĽĐĄź¤Î´đËÜľĄÇ˝¤ňĘŃ
+ šš¤š¤ë¤â¤Î¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ż¤ŔĄ˘256 ż§ĆąťţČŻż§¤ÎĽŤĽéĄźĽľĄźĽĐĄź¤ŤĽâĽÎĽŻ
+ ĽíĽľĄźĽĐĄź¤Ź˝ĐÍč¤ë¤Ŕ¤ą¤Ç¤šĄŁżˇ¤ˇ¤¤ĽĎĄźĽÉĽŚĽ§Ľ˘ĄĘÎ㤨¤ĐĽ˘ĽŻĽťĽéĽěĄźĽż
+ ĽÁĽĂĽ×ĄË¤ňÄɲ䚤뤳¤Č¤Ď˝ĹÍפʝŝö¤ÇĄ˘Ę¸˝ń˛˝˝ĐÍč¤ë¤č¤Ś¤ĘÄ꡿ŪşîśČ¤Ë¤Ď
+ Äřąó¤¤¤â¤Î¤Ç¤šĄŁ
+
+ ¤˝¤ě¤Ë¤â¤Ť¤Ť¤ď¤é¤şĄ˘¤ł¤ł¤ÇšÔ¤ŚĽÉĽéĽ¤ĽĐ¤ň˝ń¤Ż¤č¤Ś¤ĘĽ×ĽíĽ°ĽéĽßĽóĽ°¤ĎÎɤ¤
+ ĆţĚç¤Č¤Ę¤ę¤Ţ¤šĄŁĽ˘ĽŻĽťĽéĽěĄźĽżĽÁĽĂĽ×ĽťĽĂĽČ¤ňÄɲ䚤ëşÇ˝é¤ÎĂĘłŹ¤Ç¤Ď
+ SVGA ¤Îžĺ°Ě¸ß´š¤Č¤ˇ¤Ć¤ÎĽÉĽéĽ¤ĽĐ¤ňÄɲ䚤ë¤Î¤ŹÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁłşĹö¤š¤ë
+ ĽÁĽĂĽ×ÂĐąţ¤Î SVGA ¤ÎĽÉĽéĽ¤ĽĐĄź¤ň˝ń¤Ż¤ł¤Č¤Ďżˇ¤ˇ¤¤ľĄÇ˝¤ňÄɲ䚤ë¤Č¤­¤Î°Â
+ Äꤡ¤żłŤČŻ´Äś­¤ňš˝Ăۤš¤ë¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄĘźÂşÝĄ˘XFree86 2.0 ÂĐąţ¤ËĆâÉô¤Ç
+ łŤČŻ¤ľ¤ě¤ż S3, Cirrus ¤ä WD ¤ÎĽ˘ĽŻĽťĽżĽěĄźĽżĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽÉĽéĽ¤ĽĐ¤Ç¤Ď
+ ¤˝¤Ś¤Ç¤ˇ¤żĄËĄŁ
+
+ ¤ľ¤˘Ą˘ÎăÂę¤ÎĽ˝ĄźĽš¤ňźę¤Ë¤¤¤ě¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤Îʸ˝ń¤Ë˛Ă¤¨¤ĆĄ˘ĽšĽżĽÖĽÉĽéĽ¤ĽĐ
+ ¤ňÄ󜥤ˇ¤Ţ¤šĄŁ¤ł¤ě¤Ďżˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ÎĹ°Ä줡¤żšüÁȤߤȤˇ¤ĆÄ󜥤š¤ë¤â¤Î¤Ç
+ ¤šĄŁ¤ł¤Îʸ˝ń¤ŹÂ礭¤¤¤Ť¤é¤Č¤¤¤Ă¤ĆşîśČ¤Ź˛áĹ٤ËĆń¤ˇ¤¤¤Čť×¤ď¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁËؤɤκîśČ¤ň˝ĐÍč¤ë¸Â¤ę¤ł¤Îʸ˝ń¤Ëąč¤Ă¤ĆżĘ¤á¤ë¤Ę¤é¤ĐĄ˘şŁČդΤŚ¤Á¤ËÍý
+ ĎŔĹŞ¤Ë¤Ď¤ł¤Îʸ˝ń¤ňÎÁÍý¤ÎËܤΤ褌¤ËťČ¤¤Ą˘şÇ¸ĺ¤Ë¤ĎĆ°¤ŻĽÉĽéĽ¤ĽĐ¤Ź˝ĐÍč¤ë¤Ç
+ ¤ˇ¤ç¤ŚĄŁ
+
+ 2. ťĎ¤á¤Ë
+
+ żˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ňşî¤ëşÇ˝é¤ÎĂĘłŹ¤Ď¤˝¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ë´Ř¤š¤ëťńÎÁ¤ň˝¸¤á¤ë¤ł
+ ¤Č¤Ç¤šĄŁ¤ď¤ż¤ˇ¤Î˝¸¤á¤żĽŮĽóĽŔĄź¤ÎϢÍíŔčžđĘó¤Î°ěÍ÷¤ň¤ł¤Îʸ˝ń¤ËĆţ¤ě¤Ć¤¤¤Ţ
+ ¤šĄĘ´°ŕú¤Č¤Ď¸Ŕ¤¨¤Ę¤¤¤â¤Î¤Ç¤š¤Î¤Ç¤ł¤Î°ěÍ÷¤ËĚľ¤¤¤â¤Î¤ÇĂΤäƤ¤¤ë¤â¤Î¤Ź¤˘
+ ¤ę¤Ţ¤ˇ¤ż¤éĂřźÔ¤Ţ¤ÇÁ÷¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽÇĄźĽżĽÖĽĂĽŻ¤ňźę¤ËĆţ
+ ¤ě¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁĽěĽ¸ĽšĽż¤ňÄžŔÜÁŕşî¤š¤ëĽ×ĽíĽ°ĽéĽßĽóĽ°¤Ź¤ˇ¤ż¤¤¤ČĽŮĽó
+ ĽŔĄź¤ÎżÍ¤ČĎäšľĄ˛ń¤ËłÎǧ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĄĘ¤˝¤Ś¤ˇ¤Ę¤¤¤Č EE ˇÁź°¤ÎĽÇĄźĽżĽˇĄź
+ ĽČ¤ňÁ÷ÉŐ¤ˇ¤Ć¤Ż¤ě¤Ţ¤ť¤óĄËĄŁ˛ż¤ŤĽľĽóĽ×ĽëĽ×ĽíĽ°ĽéĽŕ¤ŤłŤČŻźÔÍѤμ­ĽĂĽČĹů¤Ë
+ ¤Ä¤¤¤ĆĚ䤤šç¤ď¤ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĂřźÔ¤Ź°ěČĚĹŞ¤Ę SVGA ¤Ë¤Ä¤¤¤ĆžÜ¤ˇ¤ŻłŘ˝Ź¤ˇ¤ż
+ ¤Č¤­¤ĎĄ˘ĽěĽ¸ĽšĽż¤Ë¤Ä¤¤¤ĆĂΤꤿ¤¤ËؤɤΝö¤ŹĽÇĄźĽżĽˇĄźĽČ¤Ë°ěÍ÷¤äľ­ťö¤Ë¤˘
+ ¤ę¤Ţ¤ˇ¤żĄŁ
+
+ VGA ĽěĽ¸ĽšĽż¤ňÄžŔÜÁŕşî¤š¤ë¤č¤Ś¤ĘĽ×ĽíĽ°ĽéĽßĽóĽ°¤Ë´ˇ¤ě¤Ć¤¤¤Ę¤¤žěšç¤Ď
+ Richard Ferraro ¤ÎÉŹĆÉ˝ń¤ňĆţźę¤ˇ¤ĆĄĘŔ§ČóĆɤó¤ÇĄŞĄË˛ź¤ľ¤¤ĄĘ°Ęšß¤ÎĄÖť˛šÍ
+ ʸ¸ĽĄ×¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁĽľĄźĽĐĄź¤Ç˛ż¤ŹľŻ¤Ă¤Ć¤¤¤ë¤Ť¤ňÍý˛ň¤š¤ëşÇÎɤÎĘýËĄ
+ ¤ĎĽâĽÎĽŻĽí¤Î ``generic'' ĽľĄźĽĐĄź¤ÎĆ°şî¤ňÄ´¤ŮĄ˘Ferraro ¤ÎËܤ˽ń¤Ť¤ě¤Ć
+ ¤¤¤ëžđĘó¤ČČćłÓ¤ˇ¤Ć˛ź¤ľ¤¤ĄĘËܤ˞Ż¤ˇ´Ö°ă¤¤¤Ź¤˘¤ë¤ł¤Č¤Ëľ¤ÉŐ¤Ż¤Ç¤ˇ¤ç
+ ¤ŚĄËĄŁgeneric ¤Ę VGA ĽěĽ¸ĽšĽż¤ň°ˇ¤Ś´Řżô¤ň ``vgaHW.c'' ĽŐĽĄĽ¤Ľë¤Ë¸Ť¤Ä¤ą
+ ¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ generic ¤ĘĽľĄźĽĐĄź¤Ç˛ż¤ŹľŻ¤Ă¤Ć¤¤¤ë¤ŤÍý˛ň¤ˇ¤ż¤éĄ˘°ě¤Ä¤Ť¤˝¤ě°Ęžĺ¤Î´ű¸¤Î
+ SVGA ĽľĄźĽĐĄź¤Ë¤Ä¤¤¤ĆÄ´¤Ů¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë SVGA ĽÁĽĂĽ×¤ÎĽÇ
+ ĄźĽżĽÖĽĂĽŻ¤ňĆţźę¤ˇ¤ĆĽ×ĽíĽ°ĽéĽŕ¤ňÄɤ¤¤Ę¤Ź¤éʸ˝ń¤ňÄ´şş¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁgeneric ¤Ę VGA ¤Ť¤é˛ż¤ŹťĹÍͤňÄś¤¨¤Ć¤¤¤Ć˛ż¤ŹťĹÍͤ˟ý¤Ţ¤Ă¤Ć¤¤¤ë¤ŤÎÉ
+ ¤ŻÍý˛ň¤ˇ¤ż¤éĄ˘żˇ¤ˇ¤¤ĽÁĽĂĽ×¤Ë¤Ä¤¤¤ĆĽÇĄźĽżĽÖĽĂĽŻ¤Ť¤é¤É¤ó¤ĘžđĘó¤ňĆŔ¤ě¤Đ¤č
+ ¤¤¤ŤĘŹ¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤ÎžđĘó¤ňźý˝¸¤ˇ¤ż¤éĄ˘żˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐĄź¤Ëźč¤ę¤Ť¤Ť¤ë
+ ˝ŕČ÷¤Ź˝ĐÍč¤Ţ¤ˇ¤żĄŁ
+
+ 3. ĽÇĽŁĽěĽŻĽČĽęš˝Â¤
+
+ ¤ł¤ł¤Ç¤ĎĽ˝ĄźĽš¤ÎĽÇĽŁĽěĽŻĽČĽęš˝Â¤¤ÎłľÍפňŔâĚŔ¤ˇ¤Ţ¤šĄŁ˝ń¤ł¤Ś¤Č¤ˇ¤Ć¤¤¤ëĽÉ
+ ĽéĽ¤ĽĐ¤Ë´ŘϢ¤š¤ëĽÇĽŁĽěĽŻĽČĽęĄżĽŐĽĄĽ¤Ľë¤Ď´űĂΤȤˇ¤Ţ¤šĄŁĽęĽóĽŻĽ­ĽĂĽČ¤Îš˝
+ ¤¤Ď°Ęšß¤Çź¨¤ˇ¤Ţ¤šĄŁ
+
+ xc/config/cf/
+
+ site.def
+ ĽíĄźĽŤĽë¤Ęš˝ŔŽ¤ÎĽŤĽšĽżĽŢĽ¤Ľş
+
+ xf86site.def
+ XFree86 ¤ÎĽíĄźĽŤĽë¤Ęš˝ŔŽ¤ÎĽŤĽšĽżĽŢĽ¤Ľş
+
+ xc/programs/Xserver/hw/xfree86/
+ ĽľĄźĽĐĄź¤ÎĽ˝ĄźĽš
+
+ common/
+ Á´ĽľĄźĽĐĄź¤ËśŚÄ̤ʼռĄĽ¤Ľë (XF86Config ¤ÎĽŃĽéĽáĄźĽż˛ňŔĎ/ĽŃĄź
+ Ľľ, I/O ĽÇĽĐĽ¤ĽšĽĎĽóĽÉĽéĹů)
+
+ xf86.h
+ `ScrnInfoRec' ĽÇĄźĽżš˝Â¤¤ň´Ţ¤ŕ
+
+ xf86_Option.h
+ ĽŞĽ×ĽˇĽçĽóĽŐĽéĽ°¤ň´Ţ¤ŕ
+
+ compiler.h
+ Ľ¤ĽóĽéĽ¤ĽóĽ˘ĽťĽóĽÖĽéĽŢĽŻĽí¤ČĽćĄźĽĆĽŁĽęĽĆĽŁ´Řżô¤ň´Ţ¤ŕ
+
+ os-support/
+ OS ĽľĽÝĄźĽČÁŘ
+
+ assyntax.h
+ ĽŢĽŻĽí˛˝¤ˇ¤żĽ˘ĽťĽóĽÖĽéĽËĽâĽËĽĂĽŻ¤ň´Ţ¤ŕ
+
+ xf86_OSlib.h
+ OS ¤ŹĽľĽÝĄźĽČ¤š¤ë include, define ¤Č Ľ×ĽíĽČĽżĽ¤Ľ×
+
+ LinkKit/
+
+ site.def.LK
+ ĽęĽóĽŻĽ­ĽĂĽČ¤Î site.def ÍѤμƼóĽ×ĽěĄźĽČ
+
+ vga256/
+ 256 ż§ VGA ĽľĄźĽĐĄź¤ÎĽÇĽŁĽěĽŻĽČĽę
+
+ vga/
+ generic ¤Ę VGA ¤ňźč¤ę°ˇ¤ŚĽ×ĽíĽ°ĽéĽŕ
+
+ vga.h
+ `vgaVideoChipRec' ¤Č `vgaHWRec' ĽÇĄźĽżš˝Â¤¤ň´Ţ¤ŕ
+
+ vgaHW.c
+ generic ¤Ę VGA ĽěĽ¸ĽšĽż¤ňźč¤ę°ˇ¤Ś´Řżô vgaHWInit(),
+ vgaHWSave() ¤Č vgaHWRestore()¤ň´Ţ¤ŕĄŁ
+
+ drivers/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽę¤ň´Ţ¤ŕĄŁłĆĄšĄ˘ĽÉĽéĽ¤ĽĐÍŃ
+ Imakefile, .c ĽŐĽĄĽ¤Ľë¤ČĽĐĽóĽŻŔÚ¤ęÂؤ¨´ŘżôÍѤΠ.s ĽŐĽĄĽ¤Ľë
+ ¤ň´Ţ¤ŕ
+
+ vga2/
+ ĽâĽÎĽŻĽí¤Î vga ĽľĄźĽĐĄź¤ÎĽÇĽŁĽěĽŻĽČĽęĄŁvga256 ¤ËĽęĽóĽŻ¤š¤ë
+ ĽŐĽĄĽ¤Ľë¤ČžňˇďĽłĽóĽŃĽ¤Ľë¤ÇťČÍѤš¤ëşšĘŹĄŁ
+
+ drivers/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽęĄŁ`generic' ¤Ę VGA ĽÉĽéĽ¤ĽĐ
+ ¤â¤ł¤ł¤ËÇŰĂÖ¤š¤ëĄŁ
+
+ vga16/
+ 16 ż§ vga ĽľĄźĽĐĄź¤ÎĽÇĽŁĽěĽŻĽČĽęĄŁvga256 ¤ËĽęĽóĽŻ¤š¤ëËؤɤÎ
+ ĽŐĽĄĽ¤Ľë¤ČžňˇďĽłĽóĽŃĽ¤Ľë¤ÇťČÍѤš¤ëşšĘŹĄŁ
+
+ drivers/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽęĄŁ
+
+ VGADriverDoc/
+ ¤ł¤Îʸ˝ń¤ČĽšĽżĽÖĽÉĽéĽ¤ĽĐĄŁ
+
+ ĽęĽóĽŻĽ­ĽĂĽČ¤ĎÄĚžď /usr/X11R6/lib/Server ¤ËĆłĆţ¤ˇ¤Ţ¤šĄŁĽęĽóĽŻĽ­ĽĂĽČ¤Ď
+ ĽľĄźĽĐĄź¤ÎşĆĽęĽóĽŻ¤ňšÔ¤Ś¤Î¤ËÉŹÍפĘÁ´¤Ć¤Î¤â¤Î¤Ź´Ţ¤Ţ¤ě¤Ć¤¤¤Ţ¤šĄŁżˇ¤ˇ¤¤ĽÉ
+ ĽéĽ¤ĽĐ¤ň˝ń¤Ż¤Î¤ČĽľĄźĽĐĄź¤ÎĽ˝ĄźĽš¤ÎĆłĆţ¤Ę¤ˇ¤Ëżˇ¤ˇ¤¤ĽľĄźĽĐĄź¤ňŔ¸ŔŽ¤š¤ë¤Î
+ ¤ËÉŹÍפǤšĄŁ
+
+ Server/
+
+ site.def
+ ĽíĄźĽŤĽë¤Ęš˝ŔŽ¤ÎĽŤĽšĽżĽŢĽ¤Ľş
+
+ include/
+ žĺľ­ `common' ĽÇĽŁĽěĽŻĽČĽę˛ź¤Ë¤˘¤ëÁ´¤Ć¤Î include ĽŐĽĄĽ¤Ľë
+
+ drivers/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎÁ´¤Ć
+
+ vga2/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽęĄŁ
+
+ vga16/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽęĄŁ
+
+ vga256/
+ SVGA ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽęĄŁ
+
+ VGADriverDoc/
+ ¤ł¤Îʸ˝ń¤ČĽšĽżĽÖĽÉĽéĽ¤ĽĐ¤ÎĽÇĽŁĽěĽŻĽČĽęĄŁ`vgaHW.c' ¤Ď¤ł¤ł¤Ë¤â
+ ĽłĽÔĄź¤ľ¤ěť˛žČ¤ľ¤ě¤Ţ¤šĄĘĽęĽóĽŻĽ­ĽĂĽČ¤Î°ěÉô¤Č¤ˇ¤Ć¤ĎŔ¸ŔŽ¤ˇ¤Ţ¤ť
+ ¤óĄËĄŁ
+
+ 4. Ŕ¸ŔŽžđĘó¤ÎŔßÄę
+
+ ¤ł¤ÎŔá¤Ç¤Ďżˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐÍŃŔßÄę¤ňšÔ¤Ę¤Ś°Ů¤ÎźţĘդΚ˝ŔŽĘŃšš¤ČŔ¸ŔŽĂĘłŹ¤Ë¤Ä
+ ¤¤¤ĆŔâĚŔ¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĂĘłŹ¤Ç¤ĎĽ˝ĄźĽš¤Ť¤éŔ¸ŔŽ¤š¤ë¤ŤĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éŔ¸ŔŽ¤š
+ ¤ë¤Ť¤Ë¤Ť¤Ť¤ď¤é¤şĆąÍͤǥ˘¤ż¤ŔĽŐĽĄĽ¤Ľë¤ÎÇŰĂÖ¤Ź°Ű¤Ę¤Ă¤Ć¤¤¤ë¤Ŕ¤ą¤Î¤ł¤Č¤Ç
+ ¤šĄŁ°Ę˛ź¤Ëš˝ŔŽĘŃšš¤Ë¤Ä¤¤¤ĆŔâĚŔ¤ˇ¤Ţ¤š:
+
+ 1. ĽÉĽéĽ¤ĽĐ¤ÎĽľĽÖĽÇĽŁĽěĽŻĽČĽę¤ČĽÇĄźĽżš˝Â¤¤ňˇčÄꤡ¤Ć˛ź¤ľ¤¤ĄŁĂą°ě¤ÎĽÉĽé
+ Ľ¤ĽĐĆâ¤Ë¤˝¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ë´ŘϢ¤š¤ëĘŁżô¤ÎĽÉĽéĽ¤ĽĐ¤ňźÂÁő¤š¤ë¤ł¤Č¤Ź¸˝
+ žő¤ÎĽÉĽéĽ¤ĽĐ¤Ëľö¤ľ¤ě¤ë¤Ę¤é¤ĐĄĘźÂşÝ¤Ë¤ĎžŠÎ夾¤ě¤Ć¤¤¤Ţ¤šĄËĄ˘ÄĚžďĽÁĽĂ
+ Ľ×ĽťĽĂĽČ¤ÎĽĐĄźĽ¸ĽçĽó¤č¤ę¤ĎĽŮĽóĽŔĄźĚžžÎ¤ňťČÍѤš¤ë¤Î¤ŹÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁ
+ ŔΤΠXFree86 ¤ÎĽÉĽéĽ¤ĽĐ¤Ď¤ł¤Î´ˇ˝Ź¤ňşÎÍѤˇ¤Ć¤¤¤Ę¤Ť¤Ă¤ż¤Ç¤š¤Ź¸˝şß¤ĎËŘ
+ ¤É¤ÎĽÉĽéĽ¤ĽĐ¤ŹĽÉĽéĽ¤ĽĐ¤ÎĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš¤ň˝ŔĆđłî¤ÄłČÄĽ˛ÄÇ˝¤Ë¤Ę¤ë¤č
+ ¤Ś¤Ë¤ł¤Î´ˇ˝Ź¤ňťČÍѤˇ¤Ć¤¤¤Ţ¤š¤Î¤ÇĽŮĽóĽŔĄźĚžžÎ¤ňťČ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ¤ł¤Îʸ˝ń¤Ç¤Ď SuperDuper Chips ¤Č¤¤¤ŚĽŮĽóĽŔĄź¤ňÎă¤Ëźč¤ęľó¤˛¤Ţ¤šĄŁ°Ę
+ šßĄ˘ĽÉĽéĽ¤ĽĐ¤ÎĚžžÎ¤Ë `sdc' ¤ňÍѤ¤¤Ţ¤šĄŁ
+
+ 2. ĽŤĽéĄźĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤š¤ë¤ŤĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤š¤ë¤ŤËô¤Ď
+ ΞĘýĽľĽÝĄźĽČ¤š¤ë¤Î¤ŤˇčÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤Îʸ˝ń¤Ç¤ĎĄ˘ĽŤĽéĄź¤ČĽâĽÎĽŻ
+ ĽíΞĘý¤ÎĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤š¤ë¤č¤Ś¤Ë˛žÄꤡ¤Ć¤¤¤Ţ¤šĄŁĽŤĽéĄźĽľĄźĽĐĄź
+ ¤Ŕ¤ą¤ňĽľĽÝĄźĽČ¤ˇ¤ż¤¤¤Čť×¤Śžěšç¤ĎĽâĽÎĽŻĽí¤ÎĽľĄźĽĐĄź¤ňźÂ¸˝¤š¤ëĂĘłŹ¤ň
+ Ěľťë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽâĽÎĽŻĽíĽľĄźĽĐĄź¤Ŕ¤ą¤ňĽľĽÝĄźĽČ¤ˇ¤ż¤¤žěšç¤ĎĽŤĽéĄź
+ ĽľĄźĽĐĄź¤ÎĂĘłŹ¤Ç°ěÍ÷¤Ë¤˘¤ë˛ÄÇ˝¤ĘĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ňźÂ¸˝¤ľ¤ťĄ˘ĽâĽÎĽŻ
+ ĽíĽľĄźĽĐĄź¤ÎĂĘłŹ¤ĎĚľťë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¸˝Â¸¤š¤ëËؤɤμɼ鼤ĽĐĄź¤ĎĽŤĽé
+ Ąź¤Î¤ß¤ŤĄ˘ÎžĘý¤ÎĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ĆĄ˘``generic'' ¤ĘĽÉĽéĽ¤ĽĐ
+ Ąź¤ĎĄĘ¸˝şß¤ĎĄËĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ 3. ĽÉĽéĽ¤ĽĐĄź¤ÎĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤:
+
+ o Ľ˝ĄźĽš¤Ť¤éşîśČ¤š¤ëžěšç¤ĎĄ˘źĄ¤ÎĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤:
+
+ xc/programs/Xserver/hw/xfree86/vga256/drivers/sdc
+ xc/programs/Xserver/hw/xfree86/vga16/drivers/sdc
+ xc/programs/Xserver/hw/xfree86/vga2/drivers/sdc
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éşîśČ¤š¤ëžěšç¤ĎźĄ¤ÎĽÇĽŁĽěĽŻĽČĽę¤ňşîŔŽ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤:
+
+ /usr/X11R6/lib/Server/drivers/vga256/sdc
+ /usr/X11R6/lib/Server/drivers/vga16/sdc
+ /usr/X11R6/lib/Server/drivers/vga2/sdc
+
+ 4. ĽÉĽéĽ¤ĽĐĄź¤ňŔ¸ŔŽ¤š¤ë°Ů¤Î Imakefiel ĽŃĽéĽáĽż¤ňŔßÄꤡ¤Ţ¤ˇ¤ç¤Ś:
+
+ o Ľ˝ĄźĽš¤Ť¤éşîśČ¤š¤ë¤Ę¤é:
+
+ a. xc/config/cf/xfree86.cf ¤ňĘÔ˝¸¤ˇ¤Ć `sdc' ¤ň `XF86Vga256Drivers',
+ `XF86Vga16Drivers' ¤Č `XF86Vga2Drivers' ¤ÎÄęľÁ¤Î°ěÍ÷¤ËÄɲ䡤ƤŻ
+ ¤Ŕ¤ľ¤¤ĄŁ°ěÍ÷¤Î `generic' ¤ÎÄžÁ°ĄĘÎ㤨¤ĐşÇ¸ĺ¤Ť¤éĆóČÖĚÜĄË¤Ë `sdc'
+ ¤ňÄɲäˇ `sdc' ¤ňž¤ÎĽÉĽéĽ¤ĽĐĄź¤ÎĂľşş¤ŹÉÔŔľ¤Ë `sdc' ĽÁĽĂĽ×ĽťĽĂĽČ
+ ¤ň¸ĄĂΤˇ¤Ę¤¤¤č¤Ś¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ b. xc/config/cf/xf86site.def ¤ňĘÔ˝¸¤ˇ¤Ć¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ë¤¤¤Ż¤Ä¤Ť¤ÎšŕĚÜ
+ ¤ňÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄĘ¤ł¤ě¤Ďɸ˝ŕĂͤÎŔßÄę¤ÎşîśČ¤Ç¤šĄËĄŁ
+
+ c. xc/programs/Xserver/hw/xfree86/LinkKit/ ¤Ë¤˘¤ë site.def.LK ĽŐĽĄ
+ Ľ¤Ľë¤ňĘÔ˝¸¤ˇ¤Ć¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ë¤¤¤Ż¤Ä¤Ť¤ÎšŕĚܤňÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁ¤ł
+ ¤ě¤ĎĽęĽóĽŻĽ­ĽĂĽČ¤Ë´Ţ¤Ţ¤ě¤ë `site.def' ĽŐĽĄĽ¤Ľë¤Îż÷ˇż¤Ç¤šĄŁ
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éşîśČ¤ň¤š¤ë¤Ę¤éĄ˘/usr/X11R6/lib/Server/site.def ¤ňĘÔ
+ ˝¸¤ˇ¤Ć`sdc' ¤ň `XF86Vga256Drivers', `XF86Vga16Drivers' ¤Č
+ `XF86Vga2Drivers' ¤ÎÄęľÁ¤ËşÇ˝é¤Ë˝ń¤¤¤żÍͤËÄɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁ
+
+ 5. ¤ľ¤Ćżˇ¤ˇ¤¤ĽÇĽŁĽěĽŻĽČĽę¤Ëż÷ˇż¤ÎĽŐĽĄĽ¤Ľë¤ňĽłĽÔĄź¤ˇ¤Ţ¤ˇ¤ç¤Ś:
+
+ o Ľ˝ĄźĽš¤Ť¤éşîśČ¤š¤ë¤Ę¤éĄ˘`stub' ĽŐĽĄĽ¤Ľë¤ňźĄ¤Î¤č¤Ś¤ËĽłĽÔĄź¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄĘĽÇĽŁĽěĽŻĽČĽę¤Ď xc/programs/Xserver ¤Î˛ź¤Ç¤šĄË:
+
+ Imakefile.stub =>
+ hw/xfree86/vga256/drivers/sdc/Imakefile
+
+ stub_driver.c =>
+ hw/xfree86/vga256/drivers/sdc/sdc_driver.c
+
+ stub_bank.s =>
+ hw/xfree86/vga256/drivers/sdc/sdc_bank.s
+
+ Imakefile.stub =>
+ hw/xfree86/vga16/drivers/sdc/Imakefile ĄĘ¤˝¤ˇ¤Ć Imakefile ¤ňĘÔ˝¸
+ ¤ˇ¤ĆĽłĽáĽóĽČ¤Ë˝ž¤Ă¤ĆĘŃšš¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁ
+
+ Imakefile.stub =>
+ ĄĘ¤˝¤ˇ¤Ć Imakefile ¤ňĘÔ˝¸¤ˇ¤ĆĽłĽáĽóĽČ¤Ë˝ž¤Ă¤ĆĘŃšš¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄËĄŁ
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éşîśČ¤š¤ë¤Ę¤éĄ˘`stub' ĽŐĽĄĽ¤Ľë¤ňźĄ¤Î¤č¤Ś¤ËĽłĽÔĄź¤ˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤:
+
+ Imakefile.stub =>
+ /usr/X11R6/lib/Server/drivers/vga256/sdc/Imakefile
+
+ stub_driver.c =>
+ /usr/X11R6/lib/Server/drivers/vga256/sdc/sdc_driver.c
+
+ stub_bank.s =>
+ /usr/X11R6/lib/Server/drivers/vga256/sdc/sdc_bank.s
+
+ Imakefile.stub =>
+ /usr/X11R6/lib/Server/drivers/vga16/sdc/Imakefile ĄĘ¤˝¤ˇ¤Ć
+ Imakefile ¤ňĘÔ˝¸¤ˇ¤ĆĽłĽáĽóĽČ¤Ë˝ž¤Ă¤ĆĘŃšš¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁ
+
+ Imakefile.stub =>
+ /usr/X11R6/lib/Server/drivers/vga2/sdc/Imakefile ĄĘ¤˝¤ˇ¤Ć
+ Imakefile ¤ňĘÔ˝¸¤ˇ¤ĆĽłĽáĽóĽČ¤Ë˝ž¤Ă¤ĆĘŃšš¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄËĄŁ
+
+ 6. ¤ż¤Ă¤żşŁĽłĽÔĄź¤ˇ¤żłĆĄš¤ÎĽŐĽĄĽ¤Ľë¤ňĘÔ˝¸¤ˇ¤Ć `stub' ¤ň `sdc'
+ ¤ËĄ˘`STUB' ¤ň `SDC' ¤ËÁ´¤ĆĂÖ¤­´š¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ÉŹÍפʽŕČ÷şîśČ¤Ď°Ęžĺ¤Ç¤šĄŁ¤ł¤ě¤ÇźÂşÝ¤ÎĽÉĽéĽ¤ĽĐ¤ňşîŔŽ¤š¤ëşîśČ¤Ź˝ĐÍč
+ ¤Ţ¤šĄŁ
+
+ 5. ĽĐĽóĽŻŔÚ¤ęÂؤ¨ľĄÇ˝
+
+ ÉáÄ̤ΠVGA ĽáĽâĽęĽŢĽĂĽ×¤Ď 0xA0000 ¤Ť¤éťĎ¤Ţ¤ë 64k ¤Ç¤šĄŁ64k ¤č¤ęÂ礭¤Ę
+ ĽáĽâĽę¤ËĽ˘ĽŻĽťĽš¤š¤ë¤Ë¤ĎĄ˘``ĽĐĽóĽŻŔÚ¤ęÂؤ¨ľĄÇ˝(bank switching)'' - šâ
+ °Ě¤ÎĽ˘ĽÉĽěĽšĽÓĽĂĽČ¤ňĽáĽâĽę¤ÎĽĐĽóĽŻÁŞÂň¤ËťČ¤Ś¤č¤Ś¤ĘÁŕşî¤ËĂÖ¤­´š¤¨¤ëľĄÇ˝
+ ¤ňźÂ¸˝¤ˇ¤Ć¤¤¤ëSuperVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹÉŹÍפǤšĄŁĽľĽ¤Ľş¤Čżô¤ÎĽĐĽóĽŻ¤ĎĘŃ
+ ˛˝¤ˇĄ˘¤˝¤ÎĚžžÎ¤ĎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎťńÎÁ¤Ëľ­şÜ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĽĐ
+ ĽóĽŻĽěĽ¸ĽšĽżĚľ¤ˇ¤Ť°ě¤Ä¤ŤĆó¤Ä¤ÎĽĐĽóĽŻĽěĽ¸ĽšĽż¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁĽĐĽóĽŻĽěĽ¸
+ ĽšĽż¤Ę¤ˇ¤Îžěšç¤Ď generic ¤Ę VGA *¤Ŕ¤ą* ¤Ç¤š¤Î¤ÇĄ˘´Řˇ¸¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ żˇ¤ˇ¤¤ĽÁĽĂĽ×ĽťĽĂĽČĄĘÎ㤨¤Đ Trident 8900CL, CirrusŔ˝ĄË¤ĎĽÓĽÇĽŞĽáĽâĽę¤ň
+ ĽęĽËĽ˘¤Ëłä¤ęĹö¤Ć¤ëťö¤Ź˝ĐÍč¤ëťö¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤Î¤ä¤ęĘý¤ňťČ¤Śžěšç
+ ¤ĎĽľĄźĽĐĄź¤ÎŔ­Ç˝¤ň¸ţžĺ¤ľ¤ť¤Ţ¤š¤ŹĄ˘¸˝şß¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁ¸Î¤Ëżˇ¤ˇ
+ ¤¤ĽÁĽĂĽ×ĽťĽĂĽČ¤Î¤ł¤ÎľĄÇ˝¤ĎťČÍŃ˝ĐÍč¤Ţ¤ť¤óĄŁ
+
+ ËؤɤΠSVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĆó¤Ä¤ÎĽĐĽóĽŻĽěĽ¸ĽšĽż¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁĽÇĄźĽż¤ň
+ ˛čĚ̤Τ˘¤ëÎΰ褍¤éž¤ÎÎΰč¤ËĂą˝ă¤Ë 'mov' ĚżÎá¤Ç°ÜĆ°˝ĐÍč¤ë¤Î¤ÇČóžď¤ËËž
+ ¤Ţ¤ˇ¤¤š˝Â¤¤Ç¤šĄĘ¤É¤ó¤ĘĽĐĽóĽŻš˝Â¤¤â ``Ëž¤Ţ¤ˇ¤¤'' ¤Č¸Ć¤ó¤Ç¤¤¤Ţ¤šĄËĄŁĆó˝Ĺ
+ ˛˝ĽĐĽóĽ­ĽóĽ°(dual-banking) ¤ĎĆó¤Ä¤ÎĘýź°¤Ź¤˘¤ęĄ˘°ěĘý¤ĎĆɤߚţ¤ßŔěÍŃĽĐĽó
+ ĽŻ¤Č˝ń¤­šţ¤ßŔěÍѼм󼯤ÎĆó¤Ä¤ÎĽĐĽóĽŻÁŕşî¤ÇĄ˘¤â¤Ś°ěĘý¤ĎĆó¤Ä¤Î˝ń¤­šţ¤ßĄż
+ Ćɤߚţ¤ßˇóÍŃÁë¤Ç¤šĄŁşÇ˝é¤ÎĘýź°¤ĎÁ´¤Ć¤Î SVGA ĽáĽâĽęÁë¤ňĆɤߚţ¤ß¤Č˝ń¤­šţ
+ ¤ßΞĘý¤ËťČ¤¤Ą˘Ćó¤Ä¤ÎĽĐĽóĽŻĽěĽ¸ĽšĽż¤Ď¤É¤Á¤é¤ÎĽĐĽóĽŻ¤ňźÂşÝ¤ËťČ¤Ś¤Î¤ŤĄĘÎă
+ ¤¨¤ĐET3000, ET4000 ¤Ç¤ĎĄËˇčÄꤚ¤ë¤Î¤ËťČÍѤˇ¤Ć¤¤¤Ţ¤šĄŁĆóČÖĚܤÎĘýź°¤Ç¤Ď
+ SVGA ĽáĽâĽęÁë¤ňĆɤߚţ¤ßĄż˝ń¤­šţ¤ß˛ÄÇ˝¤ĘĆó¤Ä¤ÎĽĐĽóĽŻ¤ËĘŹ¤ą¤É¤Á¤é¤Ť¤ÎĽĐ
+ ĽóĽŻĽÝĽ¤ĽóĽż¤Ź°ě¤Ä¤ÎÁë¤ňŔŠ¸ć¤š¤ë¤č¤Ś¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ¤šĄŁ¤ł¤Îžěšç°ě¤Ä¤ÎÁ뤏
+ Ćɤߚţ¤ßÁŕşî¤ňšÔ¤Ś¤Č¤­¤Ďž¤ÎÁ뤏˝ń¤­šţ¤ßÁŕşî¤ňĄĘÎ㤨¤Đ PVGA1/Western
+ Digital, Cirrus ¤Ç¤ĎĄËšÔ¤Ś¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ Ăą°ě¤ÎĽĐĽóĽŻĽěĽ¸ĽšĽż¤ňťý¤Ă¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Ď°ě¤Ä¤ÎĽĐĽóĽŻ¤Ř¤ÎĆɤߚţ¤ß
+ ¤Č˝ń¤­šţ¤ß¤ÎΞĘý¤ÎĽ˘ĽŻĽťĽš¤ňšÔ¤¤¤Ţ¤šĄŁ˛čĚ̤ΰěÉô¤ÎžđĘó¤ňž¤ÎÉôĘŹ¤ŘĽłĽÔ
+ Ąź¤š¤ëťö¤ĎĽÇĄźĽż¤ňĆɤߚţ¤ßĄ˘Ăߤ¨Ą˘¤˝¤ě¤Ť¤é˝ń¤­˝Đ¤š¤Č¤¤¤Śźę˝ç¤ŹÍ׾᤾¤ě
+ ¤ë¤ż¤áş¤Ćń¤Ç¤šĄŁšŹąż¤Ë¤âĄ˘ĽľĄźĽĐĄź¤Ď°ě¤Ä¤ÎĽĐĽóĽŻ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ČĆó¤Ä¤Î
+ ĽĐĽóĽŻ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎΞĘý¤ň°ˇ¤¨Ą˘¤˝¤ÎľóĆ°¤ňźĄ¤ËŔâĚŔ¤š¤ëĽÉĽéĽ¤ĽĐĽÇĄźĽż
+ š˝Â¤¤ÎšŕĚÜÄęľÁ¤ÇˇčÄꤡ¤Ţ¤šĄŁ
+
+ ĽÉĽéĽ¤ĽĐ¤Ë¤Ď`sdc_bank.s' ĽŐĽĄĽ¤ĽëĆâ¤Îť°¤Ä¤ÎĽ˘ĽťĽóĽÖĽé¸Ŕ¸ě¤Ç˝ń¤¤¤Ć¤˘¤ë
+ ´Řżô¤ŹÉŹÍפǤšĄŁ¤ł¤ě¤é¤Î´Řżô¤ĎĽĐĽóĽŻĆɤߚţ¤ßŔßÄę - SDCSetRead(), ĽĐĽó
+ ĽŻ˝ń¤­šţ¤ß - SDCSetWrite() ¤Č ΞĽĐĽóĽŻŔßÄę - SDCSetReadWrite() ¤Ç¤šĄŁ
+ °ě¤Ä¤ÎĽĐĽóĽŻ¤Ŕ¤ą¤ÎĽÁĽĂĽ×ĽťĽĂĽČÍѤ˝°¤ÄÁ´¤Ć¤Î´Řżô¤ÎĆţ¤ę¸ýĹŔ¤ňĆą¤¸´Řżô¤Ë
+ Ŕë¸Ŕ¤Ç¤­¤ë¤Ç¤ˇ¤ç¤Ś(``tvga8900'' ĽÉĽéĽ¤ĽĐ¤ňÎă¤Č¤ˇ¤Ćť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤)ĄŁ
+
+ ´Řżô¤Ď¤Ť¤Ę¤ęĂą˝ă¤Ç - ĽĐĽóĽŻČÖšć¤ň´Řżô¤Î %al ĽěĽ¸ĽšĽż¤ŘĹϤˇĄ˘´Řżô¤ĎĽˇĽŐ
+ ĽČ¤äĽÓĽĂĽČĽŢĽšĽŻĹůšÔ¤¤Ŕľ¤ˇ¤¤ˇÁź°¤ÇĽĐĽóĽŻČÖšć¤ňĽěĽ¸ĽšĽżĽŘĘݸ¤ˇĄ˘Ŕľ¤ˇ¤¤
+ I/O ĽÝĄźĽČ¤Ř˝ń¤­šţ¤ß¤Ţ¤šĄŁĆó¤Ä¤ÎĽĐĽóĽŻ¤ŹĆɤߚţ¤ßŔěÍѤȽń¤­šţ¤ßŔěÍѤË
+ ¤Ę¤Ă¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤ÎžěšçĄ˘°ě˛ó¤Ĺ¤ÄłĆĄš¤ÎĽĐĽóĽŻ¤ËĄ˘ˇ×Ćó˛ó
+ SetReadWrite()´Řżô¤ňźÂšÔ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁĆó¤Ä¤ÎĆČΊ¤ĘĆɤߚţ¤ßĄż˝ń¤­
+ šţ¤ßÁë¤Ë¤Ę¤Ă¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤ÎžěšçĄ˘ SetReadWrite() ´Řżô¤ň
+ SetWrite() ´Řżô¤ÎÂĺ¤ď¤ę¤ËĆą¤¸ĽĐĽóĽŻ¤ËźÂšÔ¤š¤ë¤Ů¤­¤Ç¤šĄŁ
+
+ ĆĂĘ̤ĘĂí°Ő¤Č¤ˇ¤ĆĄ˘¤ł¤ě¤é¤Î´Řżô¤Ď ``assyntax.h'' ĽŐĽĄĽ¤Ľë¤ËÄęľÁ¤ˇ¤Ć¤¤¤ë
+ ĽŢĽŻĽíĽ˘ĽťĽóĽÖĽé¤Î˝ńź°¤Ç˝ń¤ŻÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ě¤Ď OS ¤Ë´Řˇ¸¤Ę¤ŻŔľ¤ˇ¤¤
+ Ľ˘ĽťĽóĽÖĽéĽłĄźĽÉ¤ňŔ¸ŔŽ¤š¤ë¤ł¤Č¤ňĘÝžÚ¤š¤ë°Ů¤Ç¤šĄŁ¸˝şßĄ˘¤ł¤ÎĽŢĽŻĽíˇÁź°¤Ď
+ USL, GNU ¤Č Ľ¤ĽóĽĆĽë¤ÎĽ˘ĽťĽóĽÖĽé¤Î˝ńź°¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ °Ęžĺ¤ŹĽĐĽóĽŻľĄÇ˝¤Ë´Ř¤š¤ëşîśČ¤Ç¤šĄŁÉáÄĚĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤Îť˛šÍ˝ń¤Ź¤ł¤ÎĽ×Ľí
+ Ľ°ĽéĽŕ¤ÎÎăÂę¤ňˇÇşÜ¤ˇ¤Ć¤¤¤Ţ¤š¤ŹĄ˘¤˝¤Ś¤Ç¤Ę¤¤žěšç¤Ç¤âž¤ÎĽÉĽéĽ¤ĽĐ¤ÎÎă¤ňÍŃ
+ ¤¤¤ě¤ĐÁŰÁü¤š¤ë¤Î¤ĎĆń¤ˇ¤Ż¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 6. ĽÉĽéĽ¤ĽĐźŤżČ¤Ë¤Ä¤¤¤Ć
+
+ ¤ľ¤ĆĄ˘ËÜÍč¤ÎşîśČ¤Ç¤˘¤ëËؤɤμɼ鼤ĽĐ¤ÎľĄÇ˝¤ň sdc_driver.c ĽŐĽĄĽ¤Ľë¤Ë˝ń
+ ¤ŻĂĘłŹ¤ËÍč¤Ţ¤ˇ¤żĄŁŔ褺Ą˘ĽÉĽéĽ¤ĽĐ¤Îźç¤ĘľĄÇ˝¤ÎłľÍפϟĄ¤Î¤Č¤Ş¤ę:
+
+ 1. ĽľĄźĽĐĄź¤ÎĽÁĽĂĽ×ĽťĽĂĽČľ­˝ŇťŇ¤ÎĽÇĄźĽżš˝Â¤¤ňÄ󜥤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽÇĄźĽżš˝
+ ¤¤ĎĽÉĽéĽ¤ĽĐ´Řżô¤Ř¤ÎĽÝĽ¤ĽóĽż¤Č¤¤¤Ż¤Ä¤Ť¤ÎĽÇĄźĽżš˝Â¤¤Î˝é´üĂͤâ´Ţ¤ß¤Ţ
+ ¤šĄŁ
+
+ 2. ĽÉĽéĽ¤ĽĐ¸ÇÍ­¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽěĽ¸ĽšĽż¤ÎĽÇĄźĽżš˝Â¤¤ňÄ󜥤ˇ¤Ţ¤šĄŁ¤ł¤Î
+ ĽÇĄźĽżš˝Â¤¤Ë¤Ď°ěČĚĹŞ¤ĘÉôĘŹ¤ČĽÉĽéĽ¤ĽĐ¸ÇÍ­¤ÎÉôĘŹ¤Ź¤˘¤ę¤Ţ¤šĄŁĽÁĽĂĽ×
+ ĽťĽĂĽČ¤Î˝é´üžőÂÖ¤ňĘݸ¤ˇ¤ż¤ęĄ˘Âž¤ÎĽâĄźĽÉ¤ËĽÁĽĂĽ×ĽťĽĂĽČ¤ňĘѤ¨¤ë¤Č¤­
+ ¤Ë˝é´ü˛˝¤š¤ë¤Î¤ËÍѤ¤¤Ţ¤šĄŁ
+
+ 3. ĽÉĽéĽ¤ĽĐ¤ŹĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Î°ěÍ÷¤ň¸Ć¤Ó˝Đ¤ť¤ë¤č¤Ś¤ĘźąĘĚ
+ ľĄÇ˝¤ňÄ󜥤ˇ¤Ţ¤šĄŁ
+
+ 4. ž¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Č°Ű¤Ę¤ë¤Č¤¤¤Ś¤ł¤Č¤ňǧźą¤ˇ¤ĆĽÉĽéĽ¤ĽĐ¤Ź¤˝¤ÎĽÁĽĂĽ×
+ ĽťĽĂĽČ¤ňĽľĽÝĄźĽČ¤ˇĽ¤ĽóĽšĽČĄźĽë¤ˇ¤Ć¤˘¤ě¤ĐŔľ¤ÎąţĹú¤ň¤ˇĄ˘¤˝¤Ś¤Ç¤Ę¤ą¤ě
+ ¤ĐÉé¤ÎąţĹú¤ň¤š¤ëĂľşşľĄÇ˝¤ňÄ󜥤ˇ¤Ţ¤šĄŁ
+
+ 5. ĽÜĄźĽÉ¤Ç˛ÄÇ˝¤ĘĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňÁŞÂň¤š¤ëľĄÇ˝¤ňÄ󜥤ˇ¤Ţ¤šĄŁ
+
+ 6. ĽÉĽéĽ¤ĽĐ¤Ë°Í¸¤š¤ëĽÇĄźĽżš˝Â¤¤ňĘݸĄ˘˛óÉüĄ˘˝é´ü˛˝¤š¤ëľĄÇ˝¤ňÄ󜥤ˇ¤Ţ
+ ¤šĄŁ
+
+ 7. ĽÓĽÇĽŞĽáĽâĽęĆâ¤ËĽÇĽŁĽšĽ×ĽěĽ¤¤ÎłŤťĎĽ˘ĽÉĽěĽš¤ňŔßÄꤚ¤ëľĄÇ˝¤ňÄ󜥤ˇ¤Ţ
+ ¤šĄŁ¤ł¤ě¤ĎĽľĄźĽĐĄź¤Ë˛žÁŰĽšĽŻĽęĄźĽó¤ňźÂ¸˝¤ˇ¤Ţ¤šĄŁ
+
+ 8. VT ŔÚ¤ęÂؤ¨¤ňšÔ¤ŚľĄÇ˝¤ňÄ󜥤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 9. ĽâĄźĽÉ¤ŹĽÁĽĂĽ×ĽťĽĂĽČ¤ÎťČÍѤš¤ëłĆĄš¤ÎĽâĄźĽÉ¤Ë°ěĂפš¤ë¤ŤĽÁĽ§ĽĂĽŻ¤š¤ë
+ ľĄÇ˝¤ňÄ󜥤š¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ žÜşŮ¤ËĽÉĽéĽ¤ĽĐĄź¤ÎĽŐĽĄĽ¤Ľë¤ňÄɤ¤¤Ť¤ą¤ëÁ°¤ËĄ˘˝ĹÍפʞđĘ󤏤ł¤ł¤Ë¤˘¤ę¤Ţ
+ ¤š:
+
+ 1. ĽÉĽéĽ¤ĽĐ¤ŹĽŤĽéĄź¤ČĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ÎΞĘý¤ňĽľĽÝĄźĽČ¤š¤ëžěšçĄ˘°ě¤Ä¤Î
+ ĽŐĽĄĽ¤Ľë¤ËΞĘý¤ÎťöÎ㤏´Ţ¤Ţ¤ě¤Ć¤¤¤ë¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤é¤Ď
+ ËؤÉĆą¤¸¤Ç¤š¤ŹĄ˘MONOVGA ¤ň #define ¤ˇ¤Ć¤˘¤ë˝ę¤ÇΞźÔ¤ňśčĘ̤š¤ë¤ł¤Č¤Ź
+ ˝ĐÍč¤Ţ¤šĄŁ16 ż§ĽľĄźĽĐĄź¤ňĽľĽÝĄźĽČ¤š¤ëžěšçĄ˘XF86VGA16 ¤Î #define ¤Ź
+ Í­¸ú¤Ë¤Ę¤ë¤č¤Ś¤ËĽ×ĽíĽ°ĽéĽŕ¤ËťŘÄꤡ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁËؤɤΞěšçĄ˘źĄ¤ň
+ stub_driver.c ĽŐĽĄĽ¤Ľë¤ÎŔčĆŹśá¤Ż¤ËťŘÄꤚ¤ëťö¤Ç˝źĘŹ¤Ç¤šĄŁ
+
+ #ifdef XF86VGA16
+ #define MONOVGA
+ #endif
+
+ 2. ĽŤĽéĄźĽľĄźĽĐĄź¤Ď SVGA ¤Î 8-ĽÓĽĂĽČĽŃĽĂĽŻĽČĽÔĽŻĽťĽëĽâĄźĽÉ¤ňťČÍѤˇ¤Ţ
+ ¤šĄŁĽâĽÎĽŻĽí¤Č vga16 ĽľĄźĽĐĄź¤Ď VGA ¤Î 16-ż§ĽâĄźĽÉĄĘ4 ĽÓĽĂĽČĽ×ĽěĄź
+ ĽóĄË¤ňťČÍѤˇ¤Ţ¤šĄŁĽâĽÎĽŻĽíĽľĄźĽĐĄź¤Ç¤Ď 1 Ľ×ĽěĄźĽó¤Ŕ¤ąťČÍѤˇ¤Ţ¤šĄŁĚő
+ Ăí : ĽŃĽĂĽŻĽČĽÔĽŻĽťĽëĄ§ 1 ĽÉĽĂĽČ¤ÎĽÔĽŻĽťĽëĄĘ˛čĚĚžĺ¤ÎĹŔĄË¤ňÉ˝¸˝¤š¤ë
+ ¤Î¤ËĄ˘Ď˘Âł¤ˇ¤ż 8 ĽÓĽĂĽČ¤ň 4 ¤Äʤ٤ĆÉ˝¤ď¤šĘýź°ĄŁ 4 ĽÓĽĂĽČĽ×ĽěĄźĽóĄ§
+ 1 ĽÉĽĂĽČ¤ňÉ˝¤ď¤š¤Î¤ËĄ˘¤˝¤ě¤ž¤ě¤Îż§Ëč¤ËĽ×ĽěĄźĽó¤ňťý¤ÁłĆĽ×ĽěĄźĽóžĺ¤Î
+ Ϣ³¤ˇ¤Ę¤¤ 8 ĽÓĽĂĽČ 4 ¤Ä¤ňťČ¤Ă¤ĆÉ˝¤ď¤šĘýź°ĄŁ
+
+ 3. ĽĐĽóĽŻŔÚ¤ęÂؤ¨¤ňťČ¤ď¤Ę¤¤¤č¤Ś¤ËĄ˘ĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ňŔßÄę¤Ç¤­¤Ţ¤šĄŁ¤ł
+ ¤ě¤ĎÉ˝ź¨Îΰč¤ÎĽáĽâĽę¤ň¤ż¤Ă¤ż 64k ¤Ë˝ĐÍč¤ëťö°Ęł°¤ĎĆäËĚĽÎĎĹŞ¤Ç¤Ď¤˘¤ę
+ ¤Ţ¤ť¤óĄŁ
+
+ ¤ł¤ě¤é¤ňƧ¤Ţ¤¨¤ĆĄ˘˝ęÄę¤ÎľĄÇ˝¤ňŔŠ¸ć¤š¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Ť¤éĽěĽ¸ĽšĽż¤ňĂľ
+ ¤šÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁĆä˥˘ĽěĽ¸ĽšĽż¤Ď°Ę˛ź¤ňŔŠ¸ć¤ˇ¤Ţ¤š:
+
+ 1. ĽŻĽíĽĂĽŻÁŞÂňĽÓĽĂĽČĄŁÄă°Ě¤Î 2 ĽÓĽĂĽČ¤Ďɸ˝ŕ¤ÎĄĘËؤɤΠSVGA ĽÁĽĂĽ×ĽťĽĂ
+ ĽČ¤Ź 1 źă¤Ż¤Ď 2 ĽÓĽĂĽČ°Ęžĺťý¤Ă¤Ć¤¤¤ëĄËźţĘŐľĄ´ď˝ĐÎϼ켸Ľš
+ Ľż(Miscellaneous Output Register) ¤Î°ěÉô¤ÇĄ˘8 ¤Ť 16 ¤ËĘŹ˛ň¤ˇ¤żĽŻ
+ ĽíĽĂĽŻ¤ňťČ¤Ś¤č¤Ś¤ËŔßÄꤡ¤Ţ¤šĄŁ
+
+ 2. ĽĐĽóĽŻÁŞÂňĄŁĆɤ߽ń¤­¤š¤ëĽĐĽóĽŻÁŞÂň¤ÎŔŠ¸ć¤ňšÔ¤ŚĽěĽ¸ĽšĽż¤ň SVGA ĽÁĽĂ
+ Ľ×ĽťĽĂĽČ¤Ď°ě¤Ä¤ŤĆó¤Äťý¤Ă¤Ć¤¤¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 3. CRTC ľĄÇ˝łČÄĽĄŁÉ¸˝ŕĹŞ¤Ę VGA ĽěĽ¸ĽšĽż¤ĎÂ礭¤ĘÉ˝ź¨¤ňšÔ¤Ś¤Î¤Ë˝˝ĘŹ¤Ę
+ ĽÓĽĂĽČżô¤ňťý¤Ă¤Ć¤¤¤Ţ¤ť¤óĄŁ¸Î¤Ë SVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎłČÄĽ¤ˇ¤żĽÓĽĂĽČżô
+ ¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ 4. Ľ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉĄŁÉ¸˝ŕĹŞ¤Ę VGA ¤ĎĽ¤ĽóĽżĄźĽěĄźĽšÉ˝ź¨¤ňĽľĽÝĄźĽČ¤ˇ
+ ¤Ć¤¤¤Ţ¤ť¤óĄŁ¸Î¤Ë SVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĽ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ňŔŠ¸ć¤š¤ë
+ ĽÓĽĂĽČ¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁĽ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉŔŠ¸ćÍѤÎŔßÄę¤ňšÔ¤ŚĽěĽ¸Ľš
+ Ľż¤ňÄɲ䡤Ƥ¤¤ë¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ 5. łŤťĎĽ˘ĽÉĽěĽšĄŁÉ¸˝ŕĹŞ¤Ę VGA ¤Ŕ¤ą¤ĎÉ˝ź¨ÍŃĽáĽâĽę¤ÎłŤťĎĽ˘ĽÉĽěĽš¤ňťŘÄꤚ
+ ¤ë¤Î¤Ë 16 ĽÓĽĂĽČ¤ÎĽ˘ĽÉĽěĽš¤ňťČ¤¤¤Ţ¤šĄŁ¤ł¤ě¤Ď˛žÁŰĽšĽŻĽęĄźĽóľĄÇ˝¤ÇťČ
+ ¤ŚĽšĽŻĽęĄźĽó¤ÎĽľĽ¤Ľş¤ňŔŠ¸Â¤ˇ¤Ţ¤šĄŁSVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎÄĚžď°ě¤Ä¤Ť¤˝¤ě
+ °Ęžĺ¤ÎłČÄĽĽÓĽĂĽČ¤ňťý¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ 6. ĽěĽ¸ĽšĽżĽíĽĂĽŻĄŁËؤɤΠSVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĽěĽ¸ĽšĽż¤ňşÇ˝é¤Ë
+ ``unlocked'' ¤Ë¤ˇ¤Ę¤¤¸Â¤ęłČÄĽĽěĽ¸ĽšĽż¤Îššżˇ¤ňËɝߤˇ¤Ţ¤šĄŁ˛ż¤Ť°ŐżŢ¤ň
+ ťý¤Ă¤ĆĽěĽ¸ĽšĽż¤ÎĘݸî¤ňĚľ¸ú¤Ë¤ˇ¤ż¤¤ťţ¤ËÉŹÍפˤʤę¤Ţ¤šĄŁ
+
+ 7. ¤˝¤Îž¤ÎľĄÇ˝ĄŁÎ㤨¤ĐĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ŹłČÄĽ VGA ĽáĽâĽę¤ň
+ ĄĘIBM-ɸ˝ŕ¤Î 265k ¤ňÄś¤¨¤ĆĄËĽ˘ĽŻĽťĽš¤ˇ¤ż¤¤ťţĄ˘Ŕľ¤ˇ¤¤ĽÓĽĂĽČ¤ňŔßÄꤚ
+ ¤ëÉŹÍפŹ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤Ţ¤ż¤ĎÁ´¤Ć¤ÎłČÄĽĽěĽ¸ĽšĽż¤ÎĆâÍƤňĆɤߟč¤ë¤Č
+ ¤ŤĄ˘ĚܤËÎą¤Ţ¤Ă¤ż˝ĹÍפʲż¤Ť¤ň¸Ť¤ëĹů¤Îž¤ÎľĄÇ˝¤Ź¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ąż¤Ź¤č¤ą¤ě¤ĐĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽŮĽóĽŔĄź¤ÎĽÇĄźĽżĽÖĽĂĽŻ¤ËÍÍĄš¤Ę BIOS ĽâĄźĽÉ
+ ÍѤμ켸ĽšĽż¤ÎŔßÄę¤ÎÉ˝¤ŹˇÇşÜ¤ľ¤ě¤Ć¤¤¤ë¤Ç¤ˇ¤ç¤ŚĄŁÍÍĄš¤Ę BIOS ĽâĄźĽÉ¤Ç¤É
+ ¤ó¤ĘÁŕşî¤Ź˛ÄÇ˝¤Ç¤˘¤ë¤ŤłŘ˝Ź¤š¤ë¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ
+
+ 6.1. ĘŁżô¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ČĽŞĽ×ĽˇĽçĽó
+
+ Ćą¤¸ĽŮĽóĽŔĄź¤Ť¤é˝Đ˛Ů¤ˇ¤Ć¤¤¤ëĘŁżô¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĂą°ě¤ÎĽÉĽéĽ¤ĽĐ¤ÇĽľĽÝĄź
+ ĽČ˛ÄÇ˝¤ÇĄ˘źÂşÝĚĽÎĎĹŞ¤Ç¤šĄŁĘŁżô¤ÎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Ź¤˘¤ëžě
+ šçĄ˘°ěϢ¤ÎÂĐąţ¤š¤ë #define ¤ČĽÉĽéĽ¤ĽĐ¤ňźąĘ̤š¤ë°Ů¤ÎĘŃżô¤Î `SDCchipset'
+ ¤ňĘÝťý¤ˇ¤Ć˛ź¤ľ¤¤ĄŁTrident ¤Č PVGA1/WD ¤ňÎăÂę¤Č¤ˇ¤Ć¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄĘTseng
+ ET3000 ¤Č ET4000¤ĎľŐ¤Î°ŐĚŁ¤Ç¤ÎÎăÂę¤Ç¤šĄŁ¤Ä¤Ţ¤ęĘŁżô¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ËÂĐąţ
+ ¤ˇ¤żĽÉĽéĽ¤ĽĐĽ¤ĽóĽżĄźĽŐĽ§ĄźĽš¤ŹłŤČŻ¤ľ¤ě¤ëÁ°¤ËźÂ¸˝¤ˇ¤Ć¤ˇ¤Ţ¤¤¤Ţ¤ˇ¤żĄŁ˝ž¤Ă
+ ¤Ć¤ł¤Îžěšç¤Ď¤â¤ŚĽŐĽŠĽíĄź˝ĐÍč¤Ţ¤ť¤óĄŁĄËĄŁÄɲ䚤ëĽÉĽéĽ¤ĽĐ¤Ď¤ł¤ě¤é¤Č°Ű¤Ę
+ ¤ë¤č¤Ś¤ËşîśČ¤ň¤š¤ë¤Č¤­¤ĎĽĐĄźĽ¸ĽçĽó¤ň°Őźą¤š¤ë¤Ŕ¤ą¤ÇÎɤ¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż
+ ¤Ŕ¤ľ¤¤ĄŁÎ㤨¤ĐĄ˘SDC ĽÉĽéĽ¤ĽĐ¤Ź SDC-1a,SDC-1b ¤Č SDC-2 ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ň
+ ĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë¤Č˛žÄꤡ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤Î -1a ¤Č-1b ¤ĎËÜźÁĹŞ¤Ë¤ĎĆą°ě¤Ç¤š
+ ¤ŹĄ˘-2 ¤Č¤Ď°Ű¤Ę¤ę¤Ţ¤šĄŁÄɲ䚤ëĽÉĽéĽ¤ĽĐ¤Ź -1 ¤Č -2 ¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ňĽľ
+ ĽÝĄźĽČ¤š¤ě¤ĐĄ˘-1a ¤Č -1b ¤Î°ă¤¤¤ň°Őźą¤ˇ¤Ę¤Ż¤Ć¤âÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤Îťö¤Ď
+ Ľ¨ĽóĽÉĽćĄźĽś¤ÎşîśČ¤ň´ĘĂą¤Ë¤ˇ¤Ţ¤šĄŁ
+
+ ĽćĄźĽś¤ËĽÉĽéĽ¤ĽĐ¤ÎľóĆ°¤ňŔŠ¸ć¤ľ¤ť¤ë¤ŤĄ˘ĽćĄźĽś¤Î˛đĆţĚľ¤ˇ¤ËĽÉĽéĽ¤ĽĐ¤ňˇčÄę
+ ¤Ç¤­¤Ę¤¤žěšç¤ĎĄ˘``option'' ¤ňťČ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁSDC ĽÁĽĂĽ×ĽťĽĂĽČ¤ňťČÍѤˇ¤Ć
+ ¤¤¤ëĽÜĄźĽÉĽŮĽóĽŔĄź¤Ď 8 ¸Ä¤Ť 16 ¸Ä¤ÎĽŻĽíĽĂĽŻĽŃĽéĽáĄźĽż¤ňĽŞĽ×ĽˇĽçĽó¤ÇÍż
+ ¤¨¤Ć¤Ę¤ľ¤¤¤Č¸Ŕ¤Ś¤Ç¤ˇ¤ç¤ŚĄŁĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĂľşş¤Îˇë˛Ě¤Ť¤éˇčÄꤚ¤ë¤ˇ¤ŤĘýËĄ
+ ¤ĎĚľ¤¤¤Î¤Ç XF86Config ĽŐĽĄĽ¤Ľë ¤Ť¤éĽćĄźĽś¤ŹĽŞĽ×ĽˇĽçĽó¤ÇľóĆ°¤ňÁŞÂň¤Ç¤­
+ ¤ë¤č¤Ś¤ËÄ󜥤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁĽŞĽ×ĽˇĽçĽó¤Ď ``xf86_option.h'' ĽŐĽĄĽ¤Ľë¤ËÄęľÁ
+ ¤ˇ¤Ţ¤šĄŁşĆÍřÍѲÄÇ˝¤ĘĽŞĽ×ĽˇĽçĽó¤Ź´ű¤Ë¤˝¤ł¤Ë¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁşĆÍřÍѲÄ
+ Ç˝¤Ęžěšç¤ĎÄɲ䚤ëĽÉĽéĽ¤ĽĐ¤ËťČ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁşĆÍřÍѲÄÇ˝¤ÇĚľ¤¤žěšç¤Ďżˇ¤ż¤Ë
+ #define ¤ňÄɲ䡥˘¤˝¤ÎĽŐĽĄĽ¤Ľë¤Ë ʸťúÎó->ĽˇĽóĽÜĽë¤Îłä¤ęĹö¤Ć¤ňÉ˝ˇÁź°¤Ç
+ ÄęľÁ¤ˇ¤Ţ¤šĄŁĽŞĽ×ĽˇĽçĽó¤ÎťČ¤¤Ęý¤ňÍý˛ň¤š¤ë¤Ë¤Ď ET4000, PVGA1/WD ¤Č
+ Trident ¤ÎĽÉĽéĽ¤ĽĐ¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6.2. ĽÇĄźĽżš˝Â¤
+
+ žĺľ­¤ÎŔâĚŔ¤Ť¤é˛ż¤ŹÉŹÍפʤΤŤÍý˛ň¤ˇ¤ż¤éĄ˘ĽÉĽéĽ¤ĽĐ¤ÎĽÇĄźĽżš˝Â¤¤ňľ­Ćţ¤š¤ë
+ ĂĘłŹ¤Ç¤šĄŁşÇ˝é¤Ë `vgaSDCRec' ¤Îš˝Â¤¤Ëźč¤ęłÝ¤Ť¤ę¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎĽÇĄźĽżš˝
+ ¤¤Ď SVGA ¤ÎžőÂÖžđĘó¤ňĘÝťý¤š¤ëĽÉĽéĽ¤ĽĐĆĂÍ­¤ÎĽÇĄźĽżš˝Â¤¤Ç¤šĄŁ¤ł¤ÎĽÇĄźĽż
+ š˝Â¤¤ÎşÇ˝é¤ÎšŕĚܤϞď¤Ë `vgaHWRec std' ¤Ç¤šĄŁ¤ł¤ÎšŕĚܤĎČĆÍŃ VGA ¤Î°ěÉô
+ ĘŹ¤ÎžđĘó¤ňĘÝťý¤ˇ¤Ţ¤šĄŁ¤˝¤ě°Ęšß¤ËÄɲ䚤ëĽÉĽéĽ¤ĽĐ¤ŹÁŕşî¤š¤ëĽěĽ¸ĽšĽżËč¤Ë
+ °ě¤Ä¤Î `unsigned char' ¤ÎÎΰč¤ňźč¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ł¤ě¤ŹşÇ˝é¤ÎĽÇĄźĽżš˝Â¤
+ ¤ÎÁ´¤Ć¤Ç¤šĄŁ
+
+ źĄ¤Ë `SDC' š˝Â¤(`vgaVideoChipRec' ˇż) ¤Î˝é´ü˛˝¤ň¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+ ¤ł¤ě¤ĎÄɲ䚤ëĽÉĽéĽ¤ĽĐ¤ňĽľĄźĽĐĄź¤ËźąĘ̤ľ¤ť¤ëĽ°ĽíĄźĽĐĽë¤Ęš˝Â¤ÂΤǤšĄŁ¤˝
+ ¤ÎĚžžÎ¤Ď¤š¤Ů¤ĆÂçʸťú¤Ç `SDC' ¤Č¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ¤Ä¤Ţ¤ęĄ˘Äɲ䚤ë
+ ĽÉĽéĽ¤ĽĐ¤Î¤˘¤ëĽÇĽŁĽěĽŻĽČĽę¤ÎĚžžÎ¤Č°ěĂפˇ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ¤ł¤Îťö¤ĎĽę
+ ĽóĽŻĽ­ĽĂĽČ¤ÎşĆš˝ŔŽ¤ňšÔ¤Śťţ¤ËÉŹÍפʼǼŁĽěĽŻĽČĽę¤ČĽ°ĽíĄźĽĐĽë¤ĘĽÇĄźĽżš˝Â¤
+ ¤ÎÁ´¤Ć¤ňłÎǧ¤š¤ë¤ł¤Č¤ŹÉŹżÜ¤Ç¤šĄŁ
+
+ ¤ł¤Îš˝Â¤ÂΤΝϤá¤ÎÉôĘŹ¤ĎĽÉĽéĽ¤ĽĐ´Řżô¤Ř¤ÎĽÝĽ¤ĽóĽż¤ňĂą¤ËĘÝťý¤ˇ¤Ţ¤šĄŁ
+
+ źĄ¤ĎĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹĽĐĽóĽŻŔÚ¤ęÂؤ¨¤ň¤É¤Ś¤š¤ë¤Ť¤Ë¤Ä¤¤¤Ć¤ÎžđĘó¤ň˝é´ü˛˝¤ˇ
+ ¤Ţ¤šĄŁ°Ęšß¤ÎÎΰč¤ĎźĄ¤Î¤č¤Ś¤Ëľ­Ćţ¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤ó:
+
+ 1. ChipMapSize - ĽľĄźĽĐĄź¤ÎĽ˘ĽÉĽěĽšśő´Ö¤Ëłä¤ęÉŐ¤ą¤ëĽáĽâĽęÎĚĄŁ¤Ű¤ÜÄĚžď
+ 64k (0xA0000 ¤Ť¤é 0xAFFFF ¤Ţ¤Ç) ¤Ç¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ď 128k
+ ¤ňťČ¤¤¤Ţ¤š (0xA0000 ¤Ť¤é 0xBFFFF ¤Ţ¤Ç)ĄŁÄɲ䚤ëĽÁĽĂĽ×ĽťĽĂĽČ¤ËĽŞĽ×
+ ĽˇĽçĽó¤ňÉղ䚤ë¤ČĄ˘64k ¤ÎÁë¤ň 128k ¤ÎÁë¤Ë¤ˇ¤Ć Hercules ¤Ţ¤ż¤ĎĽâĽÎ
+ ĽŻĽí ĽÇĽŁĽšĽ×ĽěĽ¤ Ľ˘ĽŔĽ×ĽżĽŤĄźĽÉ¤Ç SVGA ¤Č¤ˇ¤ĆťČÍŃ˝ĐÍč¤Ţ¤šĄŁ
+
+ 2. ChipSegmentSize - ChipMapSize ¤ÎÁëĆâ¤ÎĽĐĽóĽŻ¤ÎÂ礭¤ľĄŁ¤ł¤ě¤â¤Ţ¤żÄĚ
+ žď 64k ¤Ç¤š¤ŹĄ˘¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ďłä¤ęÉŐ¤ą¤é¤ě¤żÁë¤ňĆɤߚţ¤ßÉô
+ ĘŹ¤Č˝ń¤­šţ¤ßÉôĘŹ¤ËĘŹłä¤ˇ¤Ţ¤šĄĘÎ㤨¤Đ PVGA1/Western Digita ĽÁĽĂĽ×
+ ĽťĽĂĽČĄËĄŁ
+
+ 3. ChipSegmentShift - ĽĐĽóĽŻČÖšć¤ňĽŢĽšĽŻ¤š¤ë¤Č¤­¤ÎĽ˘ĽÉĽěĽš¤ňąŚĽˇĽŐĽČ¤š
+ ¤ëşÝ¤ÎĽÓĽĂĽČżôĄŁ¤ł¤ě¤Ď ChipSegmentSize ¤Î 2 ¤ňÄě¤Č¤ˇ¤ż log ¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ
+
+ 4. ChipSegmentMask - Íż¤¨¤é¤ě¤żĽĐĽóĽŻ¤ÎĽ˘ĽÉĽěĽš¤ňĽŢĽšĽŻĽŞĽŐ¤š¤ë¤Č¤­¤Î
+ ĽÓĽĂĽČĽŢĽšĽŻĄŁ¤ł¤ě¤Ď (ChipSegmentSize-1) ¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ 5. ChipReadBottom,ChipReadTop - Ćɤߚţ¤ßÁŕşî¤ňšÔ¤Ă¤ż¤Č¤­¤Îłä¤ęÉŐ¤ą¤é¤ě
+ ¤żÁë¤ÎĽ˘ĽÉĽěĽšĄŁ¤ŹĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹĘŹłä¤ľ¤ě¤żĆɤߚţ¤ß¤Č˝ń¤­šţ¤ß¤ÎÁë
+ ¤ňťý¤Ă¤Ć¤¤¤ëžěšç¤ň˝ü¤¤¤ĆĄ˘ÄĚžď¤Ď¤Ş¤Î¤Ş¤Î 0 ¤Č 64k ¤Ç¤šĄŁ
+
+ 6. ChipWriteBottom,ChipWriteTop - ˝ń¤­šţ¤ßÁŕşî¤Ë¤Ş¤¤¤Ćžĺľ­¤ČĆąÍͤǤšĄŁ
+
+ 7. ChipUse2Banks - łşĹöĽÁĽĂĽ×ĽťĽĂĽČ¤Ź°ě¤ÄËô¤ĎĆó¤Ä¤ÎĽĐĽóĽŻĽěĽ¸ĽšĽż¤ň
+ ťý¤Ă¤Ć¤¤¤ë¤ŤĄ˘¤¤¤Ę¤¤¤Ť¤Ë´Ř¤ď¤é¤Ę¤¤ĽÖĄźĽęĽ˘ĽóĂÍĄŁ¤ł¤ě¤ĎĽšĽŻĽęĄźĽó¤Ť
+ ¤éĽšĽŻĽęĄźĽó¤Ř¤ÎÁŕşî¤ÎŔßÄę¤ËĹŹŔľ¤ËÍѤ¤¤é¤ě¤Ţ¤šĄŁ
+
+ ¤ľ¤é¤Ë 3 ¸Ä¤ÎÎΰč¤ňľ­Ćţ¤ˇ¤Ţ¤ˇ¤ç¤Ś:
+
+ 1. ChipInterlaceType - VGA_NO_DIVIDE_VERT ¤Ţ¤ż¤Ď VGA_DIVIDE_VERT ¤Î¤É
+ ¤Á¤é¤Ť¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĽ¤ĽóĽżĽěĄźĽšĽâĄźĽÉÍѤ˿â
+ ÄžĘý¸ţ¤ÎÄ´Ŕ°żôĂͤň 2 ¤Çłä¤Ă¤ż¤â¤Î¤ňÉŹÍפȤˇ¤Ţ¤šĄŁ¤˝¤Î¤ż¤áĄ˘¤ł¤ÎŔßÄę
+ ¤Ë¤ĎĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. ChipOptionFlags - ĽÇĄźĽżš˝Â¤¤Î˝é´ü˛˝¤Ç¤ĎÄĚžď `{0,}' ¤Ë¤ˇ¤Ţ¤šĄŁ¤ł¤ě
+ ¤Ď¤ł¤ÎĽÉĽéĽ¤ĽĐ¤ÇÍ­¸ú¤Ę ĽŞĽ×ĽˇĽçĽó ¤ň´Ţ¤ó¤ŔĽÓĽĂĽČÎó¤Ç¤šĄŁĂľşş´Řżô¤Î
+ ˝ŞÎťťţ¤ËĹŹŔľ¤ĘĽÓĽĂĽČÎó¤Ë˝é´ü˛˝¤ľ¤ě¤Ţ¤šĄŁ
+
+ 3. ChipRounding - 256 ż§ĽľĄźĽĐĄźÍѤ˲žÁŰĽšĽŻĽęĄźĽó¤ÎÉý¤ň¤ł¤ÎĂͤÎÇÜżô¤Ë
+ ¤Ę¤ë¤č¤Ś¤Ë´Ý¤á¤ë¤Î¤ËÍѤ¤¤ë¤ż¤áŔßÄꤡ¤Ţ¤šĄŁ¤ł¤ÎĂͤĎÄĚžď¤Ď 8 ¤Ç¤š¤ŹĄ˘
+ ¤¤¤Ż¤Ä¤Ť¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ç¤Ď 4 ¤Č¤Ť 16 ¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ 6.3. Ident() ´Řżô
+
+ Ident() ´Řżô¤ĎÂçĘŃĂą˝ă¤Ę´Řżô¤Ç¤šĄŁĽľĄźĽĐĄź¤Ź¤ł¤Î´Řżô¤ň NULL ¤ňľ˘¤š¤Ţ¤Ç
+ ˇŤ¤ęĘÖ¤ˇ¸Ć¤Ó˝Đ¤ˇ¤ż¤Č¤­¤ËĄ˘ÁȤߚţ¤Ţ¤ě¤Ć¤¤¤ëĽÉĽéĽ¤ĽĐ¤Î°ěÍ÷¤ň˝ĐÎϤˇ¤Ţ
+ ¤šĄŁIdent() ´Řżô¤ĎĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĚžžÎ¤ňĘÖ¤ˇ¤Ţ¤šĄŁ¤ł¤Î´Ř
+ żô¤ĎłĆĄš¤ÎˇŤ¤ęĘÖ¤ˇ¤Ç 0 ¤Ť¤éÁý˛Ă¤š¤ëżôĂͤňĹϤˇ¤Ţ¤šĄŁ
+
+ 6.4. ClockSelect() ´Řżô
+
+ ClockSelect() ´Řżô¤ĎĽŻĽíĽĂĽŻ¤ÎĂľşş¤ň¤š¤ë¤Č¤­¤ËĄĘÎ㤨¤Đ `Clocks' šÔ¤ň
+ XF86Config ĽŐĽĄĽ¤Ľë¤ÇťŘÄꤡ¤Ę¤Ť¤Ă¤żžěšçĄËÁŞÂň¤ˇ¤żĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňĽŃĽé
+ ĽáĽż¤Çźő¤ąźč¤ë¤Î¤ËÍѤ¤¤Ţ¤šĄŁźő¤ąźč¤Ă¤żżôĂͤˤč¤Ă¤Ć´Řżô¤ĎĽÁĽĂĽ×ĽťĽĂĽČ¤Î
+ clock-select ĽÓĽĂĽČ¤ňŔßÄꤡ¤Ţ¤šĄŁ (CLK_REG_SAVE, CLK_SAVE_RESTORE) ¤Î
+ ¤č¤Ś¤ĘĂͤĎĆó¤Ä¤ÎĽŔĽßĄź¤Č¤ˇ¤Ćźő¤ąźč¤ëžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁCLK_REG_SAVE ¤ňźő
+ ¤ąźč¤Ă¤żťţ¤ĎĄ˘´Řżô¤ŹĽŻĽíĽĂĽŻÁŞÂňĹÓĂć¤ËĘŃšš¤ˇ¤żĽěĽ¸ĽšĽż¤ÎźĚ¤ˇ¤ŹĘݸ¤ľ¤ě
+ ¤Ć¤¤¤Ţ¤šĄŁCLK_REG_RESTORE ¤ňźő¤ąźč¤Ă¤żťţ¤ĎĄ˘´Řżô¤ŹĽěĽ¸ĽšĽż¤ň˛óÉü¤ˇ¤Ţ¤ˇ
+ ¤żĄŁĽŻĽíĽĂĽŻĂľşş¤ŹĽěĽ¸ĽšĽż¤ÎĆâÍƤňÇ˲ő¤ˇ¤Ę¤Ť¤Ă¤ż¤ł¤Č¤ňĘÝžÚ¤ˇ¤Ţ¤šĄŁ
+
+ źő¤ąźč¤Ă¤żĽ¤ĽóĽÇĽĂĽŻĽš¤ÎĂͤŹÉÔŔľ¤ŤĄ˘¤â¤ˇ¤Ż¤ĎĽŻĽíĽĂĽŻ¤ŹÉÔŔľ¤ÇŔßÄę˝ĐÍč¤Ę
+ ¤Ť¤Ă¤żžěšçĄ˘¤ł¤Î´Řżô¤Ď FALSE ¤ňĘÖ¤ˇ¤Ţ¤š
+
+ 6.5. Probe() ´Řżô
+
+ Probe() ´Řżô¤ĎĽÉĽéĽ¤ĽĐ¤ÎĂć¤Ç¿ʏşÇ¤â˝ĹÍפǤŤ¤ÄşÇ¤âÄž´śĹޤÇĚľ¤¤´Řżô¤Ç
+ ¤ˇ¤ç¤ŚĄŁProbe ´Řżô¤ĎÁ´¤Ć¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤Ë°Í¸¤ť¤ş¤ËĽÁĽĂĽ×ĽťĽĂĽČ¤ňźąĘ̤ˇ
+ ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁXF86Config ĽŐĽĄĽ¤Ľë¤Ë `Chipset' šÔ¤ňťŘÄꤡ¤żťţ¤ËĄ˘
+ Ăą˝ă¤ĘʸťúÎóČćłÓ¤ňšÔ¤¤¤Ţ¤šĄŁąż¤Ź¤č¤ą¤ě¤ĐĄ˘ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎǧźąľĄš˝(źą
+ ĘĚ/ĽĐĄźĽ¸ĽçĽó ĽěĽ¸ĽšĽż, Ĺů)¤Ź¤˘¤Ă¤ĆĄ˘¤˝¤ě¤ŹĽÇĄźĽżĽÖĽĂĽŻ¤ËˇÇşÜ¤ľ¤ě¤Ć¤¤
+ ¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤ľ¤â¤Ę¤ą¤ě¤ĐĄ˘°Ę˛ź¤Ë˝Ň¤Ů¤ë¤č¤Ś¤Ę˛ż¤é¤Ť¤Îźę˝ç¤Ë¤č¤Ă¤Ćǧźą¤ˇ
+ ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ
+
+ ¤č¤ŻĽěĽ¸ĽšĽż¤ËĆĂÍ­¤ÎĽŃĽżĄźĽó¤äĄ˘°ěÄę¤ÎłČÄĽĽěĽ¸ĽšĽż¤ňĂľ¤ˇ¤Ćǧźą¤ˇ¤Ţ¤šĄŁ
+ Ëô¤Ď¤¤¤Ż¤Ä¤Ť¤ÎĽÜĄźĽÉ¤äĽÁĽĂĽ×ĽťĽĂĽČ¤Ç¤ĎĄ˘ÉŹÍפʞđĘó¤Ď°ěÄę¤Î˝đ̞ʸťúÎó¤ň
+ BIOS¤Ť¤éĆɤߤŔ¤ˇ¤ĆłÍĆŔ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ´ű¸¤ÎĂľşş´Řżô¤ňĘŮśŻ¤š¤ëťö¤Čť˛šÍʸ¸Ľ
+ ¤ňť˛žČ¤š¤ëťö¤ňśŻ¤Ż¤ŞÁŚ¤á¤ˇ¤Ţ¤šĄŁÄɲ䚤ëĂľşş¤ŹČóÇ˲ő¤ÇšÔ¤ď¤ě¤Ć¤¤¤ë¤ł¤Č
+ ¤ňłÎǧ¤ˇ¤ĆĄ˘ĽěĽ¸ĽšĽż¤ňššżˇ¤š¤ë¤Ę¤é¤ĐĄ˘ššżˇÁ°¤ËĘݸ¤ˇ¤ĆĄ˘ššżˇ¸ĺ¤Ë˛óÉü¤ˇ
+ ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ŹÇ§źą¤Ç¤­¤ż¤éĄ˘Probe() ´Řżô¤Ď¤¤¤Ż¤Ä¤Ť¤Îž¤Î˝é´ü˛˝¤ňšÔ¤ŚÉŹ
+ ÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 1. XF86Config ĽŐĽĄĽ¤Ľë¤Ë `VideoRam' ĽŃĽéĽáĽż¤ňťŘÄꤡ¤Ę¤¤žěšç¤ĎĄ˘ĹëşÜ¤ˇ
+ ¤Ć¤¤¤ëĽáĽâĽęÎ̤ňĆĂÄꤡ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ 2. XF86Config ĽŐĽĄĽ¤Ľë¤Ë `Clocks' ĽŃĽéĽáĽż¤ňťŘÄꤡ¤Ę¤¤žěšç¤ĎĄ˘˛ÄÇ˝¤Ę
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÎĂͤňĆĂÄꤡ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁvgaGetClocks() ´Řżô¤ň
+ ¸Ć¤Ö¤ł¤Č¤ÇĄ˘˛ÄÇ˝¤ĘĽŻĽíĽĂĽŻ¤ÎĂͤČClockSelect() ¤Ř¤ÎĽÝĽ¤ĽóĽż¤ňźő¤ąźč
+ ¤ě¤Ţ¤šĄŁ
+
+ 3. ĽľĄźĽĐĄź¤Î `vga256InfoRec' š˝Â¤ÂΤΠ`maxClock' Îΰč¤ňĽÁĽĂĽ×ĽťĽĂĽČ¤Ç
+ ¤Î˛ÄÇ˝¤ĘşÇÂçĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ň (KHz Ăą°Ě¤Ç) ťŘÄꤚ¤ë¤ł¤Č¤ň¤ŞÁŚ¤á¤ˇ¤Ţ
+ ¤šĄŁĂľşşťţ¤Ë¤ł¤ł¤ňľ­Ćţ¤ˇ¤Ę¤¤¤ČĄ˘É¸˝ŕĂÍ (¸˝şß¤Ď 99MHz ) ¤ňťČÍѤˇ¤Ţ
+ ¤šĄŁ
+
+ 4. ĽľĄźĽĐĄź¤Î `vga256InfoRec' š˝Â¤ÂΤΠ`chipset' Îΰč¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĚžžÎ¤Ç˝é´ü˛˝¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 5. ĽâĽÎĽŻĽíĽľĄźĽĐĄź¤ÇĽÉĽéĽ¤ĽĐ¤ŹťČÍѤľ¤ě¤ë¤Ę¤é¤ĐĄ˘ĽľĄźĽĐĄź¤Î
+ `vga256InfoRec' š˝Â¤ÂΤΠ`bankedMono' Îΰč¤ËĽâĽÎĽŻĽíĽÉĽéĽ¤ĽĐ¤ŹĽĐĽó
+ ĽŻŔÚ¤ęÂؤ¨¤ňĽľĽÝĄźĽČ¤ˇ¤Ć¤¤¤ë¤Ť¤É¤Ś¤Ť¤ňťŘÄꤡ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ 6. Äɲ䚤뼾ĄźĽĐĄź¤ŹÂž¤ÎĽŞĽ×ĽˇĽçĽó¤ňĽľĽÝĄźĽČ¤š¤ëžěšçĄ˘
+ `vgaVideoChipRec' ˇż¤Î `ChipOptionFlags'š˝Â¤ÂΤň OFLG_SET() ĽŢĽŻĽí
+ ¤ňÍѤ¤¤ĆĽŞĽ×ĽˇĽçĽó¤ÎťČÍŃľö˛Ä¤ň˝é´üŔßÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 6.6. EnterLeave() ´Řżô
+
+ EnterLeave() ´Řżô¤ĎĽľĄźĽĐĄźžĺ¤Î˛žÁŰĽłĽóĽ˝ĄźĽë¤ËĆţ¤Ă¤ż¤ę˝Đ¤ż¤ę¤š¤ëĹ٤Ë
+ ¸Ć¤Đ¤ě¤Ţ¤š(˛žÁŰĽłĽóĽ˝ĄźĽë¤ÎĚľ¤¤ OS ¤Ç¤ĎĄ˘¤ł¤Î´Řżô¤ĎĽľĄźĽĐĄź¤ÎłŤťĎťţ¤Ë
+ ¸Ć¤Đ¤ěĄ˘˝ŞÎťťţ¤Ë¤â¤Ś°ěĹٸƤФě¤Ţ¤š)ĄŁ¤ł¤Î´Řżô¤ÎĚÜĹŞ¤Ď I/O ¤Î¸˘¸Â¤ň(OS
+ ¤ŹÍ׾ᤚ¤ë¤č¤Ś¤Ë)žůĹϤˇ¤ż¤ęÇíĂĽ¤ˇ¤ż¤ę¤š¤ëťö¤Ë¤˘¤ë°Ů¤Č ĽÉĽéĽ¤ĽĐ¤ŹÁŕşî¤ˇ
+ ¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤¤``Ęݸ¤ě¤ż''ĽěĽ¸ĽšĽż¤Ř¤ÎĽíĽĂĽŻ˛ň˝ü¤ČşĆĽíĽĂĽŻĽ˘ĽŻĽťĽš
+ ¤ň¤š¤ë°Ů¤Ç¤šĄŁ¤ł¤ě¤ĎĄ˘¤Č¤Ć¤âžŽ¤ľ¤Ę´Řżô¤Ç¤š¤Ź°Ęšß¤ÎĽšĽżĽÖĽÉĽéĽ¤ĽĐ¤ÎĽłĽá
+ ĽóĽČ¤Ë¤˘¤ë¤č¤Ś¤ËźÂ¸˝¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 6.7. Restore() ´Řżô
+
+ Restore() ´Řżô¤ĎĘݸ¤ľ¤ě¤żĽÓĽÇĽŞžőÂÖ¤ň˛óÉü¤š¤ë¤Î¤ËÍѤ¤¤Ţ¤šĄŁrestore ¤Č
+ ¤¤¤ŚĚžžÎ¤ĎžŻ¤ˇ¸í¤Ă¤żĚžžÎ¤ÇĄ˘¤ł¤Î´Řżô¤ĎĘݸ¤ľ¤ě¤żžőÂÖ¤ň˛óÉü¤š¤ëťö¤ČĽľĄź
+ ĽĐĄź¤ŹżˇľŹ¤ËşîŔŽ¤ˇ¤żžőÂÖ¤ňĘݸ¤š¤ëťö¤ÎΞĘý¤ËťČÍѤˇ¤Ţ¤šĄŁRestore() ´Řżô
+ ¤ĎźĄ¤ÎźęÂł¤­¤ň¤Ő¤ŕÉŹÍפŹ¤˘¤ę¤Ţ¤š:
+
+ 1. ĽĐĽóĽŻ 0 ¤ňÁŞÂň¤ˇĄ˘żˇľŹžőÂ֤νĐÎϤËŔč¤Ŕ¤Ă¤ĆÍ׾᤾¤ě¤żĽĐĽóĽŻ 0 ¤Î¤˝
+ ¤Îž¤ÎžőÂÖžđĘó¤ŹŔßÄęşŃ¤ß¤Ç¤˘¤ëťö¤ňłÎǧ¤š¤ëĄŁ
+
+ 2. vgaHWRestore() ¤ňžőÂÖžđĘó¤ÎČĆÍŃ VGA ÉôĘŹ¤ň˛óÉü¤š¤ë°Ů¤Ë¸Ć¤ÖĄŁ¤ł¤Î´Ř
+ żô¤Ď vgaHW.c ĽŐĽĄĽ¤Ľë¤ÎĂć¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ 3. žőÂÖžđĘó¤ÎĽÁĽĂĽ×ĽťĽĂĽČĆĂÍ­ÉôĘŹ¤ň˛óÉü¤š¤ëĄŁ¤ł¤ě¤ĎĂą˝ă¤ËĽěĽ¸ĽšĽż¤Ë˝ń
+ ¤­šţ¤ŕ¤ŤĄ˘ĘŃšš¤š¤Ů¤­ĹŹŔľ¤ĘĽÓĽĂĽČ¤Ŕ¤ą¤Ë read/modify/write Áŕşî¤ňšÔ
+ ¤ŚĄŁĽŻĽíĽĂĽŻÁŞÂňĽÓĽĂĽČ¤Î°ˇ¤¤¤ňÇĄ˛ż¤ËšÔ¤Ś¤Ť¤Ë¤Ä¤¤¤ĆĄ˘ĽÉĽéĽ¤ĽĐ¤ÎÎăÂę
+ ¤ÎĂć¤ÎĽłĽáĽóĽČ¤ËĂí°Őťöšŕ¤ň˝ń¤¤¤ż¤Î¤ÇłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6.8. Save() ´Řżô
+
+ Save() ´Řżô¤ĎĽľĄźĽĐĄźłŤťĎťţ¤Ë˝é´üĽÓĽÇĽŞžőÂÖžđĘó¤ňźč¤ę˝Đ¤š¤Î¤ËťČÍѤš
+ ¤ëĄŁSave() ´Řżô¤ĎźĄ¤ÎźęÂł¤­¤ň¤Ő¤ŕÉŹÍפŹ¤˘¤ę¤Ţ¤š:
+
+ 1. ĽĐĽóĽŻ 0 ¤ňÁŞÂň¤ˇ¤ż¤ł¤Č¤ňłÎǧ¤š¤ëĄŁ
+
+ 2. vgaHWSave() ¤ňžőÂÖžđĘó¤ÎČĆÍŃ VGA ÉôĘŹ¤ňźč¤ę˝Đ¤š°Ů¤Ë¸Ć¤ÖĄŁ¤ł¤Î´Řżô¤Ď
+ vgaHW.c ĽŐĽĄĽ¤Ľë¤ÎĂć¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ 3. žőÂÖžđĘó¤ÎĽÁĽĂĽ×ĽťĽĂĽČĆĂÍ­ÉôĘŹ¤ňźč¤ę˝Đ¤šĄŁ
+
+ 6.9. Init() ´Řżô
+
+ Init() ´Řżô¤ĎĽÉĽéĽ¤ĽĐ¤ÎĂć¤Ç (Probe() ´Řżô¤ÎźĄ¤Ë) ĆóČÖĚܤ˽ĹÍפǤšĄŁĽľ
+ ĄźĽĐĄź¤ÎĂć¤ËÄęľÁ¤ľ¤ě¤żÉ˝ź¨ĽâĄźĽÉłĆĄš¤Ë¤Ä¤¤¤ĆĽÇĄźĽżš˝Â¤¤ň˝é´ü˛˝¤ˇ¤Ţ¤šĄŁ
+ ¤ł¤Î´Řżô¤Ď SVGA ĽÁĽĂĽ×ĽťĽĂĽČ¤ËÉŹÍפʞőÂÖ¤Ë `vgaSDCRec' ĽÇĄźĽżš˝Â¤Á´ÂÎ
+ ¤ň˝é´ü˛˝¤š¤ë¤Î¤ËťČ¤¤¤Ţ¤šĄŁš˝Â¤ÂΤÎČĆÍŃ VGA ÉôĘŹ¤Ď (¤ł¤ě¤â vgaHW.c Ćâ¤Ë
+ ¤˘¤ë) vgaHWInit() ¤ň¸Ć¤Ö¤ł¤Č¤Ë¤č¤ę˝é´ü˛˝¤ˇ¤Ţ¤šĄŁ
+
+ ČĆÍѤÎÉôĘŹ¤ň˝é´ü˛˝¤ˇ¤ż¤éĄ˘ÉŹÍפʤé Init() ´Řżô¤ŹČĆÍѼ켸ĽšĽż¤Î¤¤¤Ż¤Ä¤Ť
+ ¤Î˝é´ü˛˝¤ňšÔ¤¤¤Ţ¤šĄŁŔľ¤ˇ¤¤˝é´ü˛˝¤Ë¤č¤Ă¤Ć¤˝¤ÎžÁ´¤Ć¤ÎÎΰ褏Ëä¤á¤é¤ě¤Ţ
+ ¤šĄŁ˝é´ü˛˝¤ˇ¤żĆĂÍ­¤ÎĽâĄźĽÉ¤ÎžđĘó¤Ď `mode' ĽŃĽéĽáĽż¤Ç¤˘
+ ¤ë`DisplayModeRec' š˝Â¤ÂΤؤμݼ¤ĽóĽż¤Çźő¤ąźč¤ę¤Ţ¤šĄŁ
+
+ ĽěĽ¸ĽšĽż¤ÎĹŹŔľ¤ĘĽÓĽĂĽČ¤Î˝é´ü˛˝¤ÎĘýËĄ¤ŹĘŹ¤Ť¤Ă¤Ć¤¤¤ëžěšç¤Ď¤ł¤ł¤Ç˝é´ü˛˝¤ˇ
+ ¤Ţ¤ˇ¤ç¤ŚĄŁRestore() ´Řżô¤Ç¤ˇ¤Ť¤˝¤ÎĽÓĽĂĽČ¤ň read/modify/write ˝ĐÍč¤Ę¤¤
+ ťö¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6.10. Adjust() ´Řżô
+
+ Adjust() ´Řżô¤ĎČćłÓĹŞşŹËÜĹŞ¤Ę´Řżô¤Ç¤šĄŁ˛žÁŰĽšĽŻĽęĄźĽó¤ÎĽšĽŻĽíĄźĽë¤äÉ˝
+ ź¨˛ňÁüĹ٤ÎĘŃšš¤Ë¤č¤Ă¤ĆĄ˘ĽľĄźĽĐĄź¤ŹĽÓĽÇĽŞĽáĽâĽę¤ÎÉ˝ź¨ÍŃÎΰč¤ÎłŤťĎĹŔ¤ňÄ´
+ Ŕ°¤š¤ëÉŹÍפΤ˘¤ë¤Č¤­¤Ď¤¤¤Ä¤â¸Ć¤Đ¤ě¤Ţ¤šĄŁËč˛óĄ˘ťŘÄꤡ¤żşÂɸ¤Ëšç¤ď¤ť¤Ć
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤ÎłŤťĎĽ˘ĽÉĽěĽš¤ňŔßÄꤡ¤Ţ¤šĄŁ¤ł¤ě¤ňźÂ¸˝¤š¤ëĘýËĄ¤ÎžÜşŮ¤ĎĽšĽż
+ ĽÖĽÉĽéĽ¤ĽĐ¤ÎĂć¤ÎĽłĽáĽóĽČ¤Ë˝ž¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 6.11. ValidMode() ´Řżô
+
+ ValidMode() ´Řżô¤ĎÉŹżÜ¤Ç¤šĄŁ˛ż¸ÎĽ°ĽéĽŐĽŁĽĂĽŻĽâĄźĽÉ¤ŹÂĹĹö¤ÇĚľ¤¤¤Î¤ŤĄ˘
+ ĽÁĽĂĽ×ĽťĽĂĽČ¤Ë°Í¸¤ˇ¤żÍýÍł¤ňÄ´şş¤š¤ë¤Î¤ËťČÍѤˇ¤Ţ¤šĄŁ Probe() źÂšÔ¸ĺ¤Î
+ Ľ×ĽíĽ°ĽéĽŕ¤Î¤č¤ęžĺ°Ě¤ÎĽ×ĽíĽ°ĽéĽŕ¤Ť¤é¸Ć¤Đ¤ě¤Ţ¤šĄŁÂż¤Ż¤ÎžěšçĄ˘ĆĂĘ̤ĘÄ´şş
+ ¤ĎÉŹÍפʤŻ¤ł¤Î´Řżô¤ĎÄ̞異ù¤Ë TRUE ¤ňĘÖ¤ˇ¤Ţ¤šĄŁ
+
+ 6.12. SaveScreen() ´Řżô
+
+ SaveScreen() ´Řżô¤ĎËؤɤμÁĽĂĽ×ĽťĽĂĽČ¤Ç¤ĎÉŹÍפ˘¤ę¤Ţ¤ť¤óĄŁÄɲ䚤ëĽÉĽé
+ Ľ¤ĽĐ¤ŹĆą´üĽęĽťĽĂĽČ¤ňĽÁĽĂĽ×ĽťĽĂĽČ¤ÇźÂšÔ¤š¤ëžěšçĄ˘łČÄĽĽěĽ¸ĽšĽż¤ňššżˇ¤š¤ë
+ ¤Î¤Ç¤ł¤Î´Řżô¤ŹÉŹÍפˤʤę¤Ţ¤šĄĘĽÇĄźĽżĽÖĽĂĽŻ¤ËžÜşŮ¤Ëľ­şÜ¤Ź¤˘¤ę¤Ţ¤šĄËĄŁ¤ł
+ ¤Î´Řżô¤ŹÉŹÍ×*Ěľ¤¤*¤Č¤­Ą˘ĆäËÄęľÁ¤ĎÉŹÍ×Ěľ¤ŻĄ˘ vgaVideoChipRec š˝Â¤ÂΡż
+ ¤Ç˝é´ü˛˝¤ˇ¤ż `NoopDDA' ¤ňĂÖ¤­¤Ţ¤ˇ¤ç¤ŚĄĘNoopDDA ¤ĎČĆÍѤΜő¤Î´Řżô¤Ç
+ ¤šĄËĄŁ
+
+ ¤ł¤Î´Řżô¤Ź*ÉŹÍ×*¤Ę¤é¤ĐĄ˘ČćłÓĹŞĂą˝ă¤ĘźĄ¤ÎşîśČ¤ňšÔ¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĆó˛ó¸Ć¤Ó
+ ˝Đ¤š¤Î¤Ç¤š¤ŹĄ˘°ě˛óĚܤϼ꼝ĽĂĽČÁ°¤ČĆó˛óĚܤϼ꼝ĽĂĽČ¸ĺ¤Ë¸Ć¤Ó˝Đ¤ˇ¤Ţ¤šĄŁÁ°
+ źÔ¤Îžěšç¤Ď °úżô¤ËSS_START ¤ňĹϤˇĄ˘¸ĺźÔ¤Ç¤Ď SS_FINISH ¤ňĹϤˇ¤Ć˛ź¤ľ¤¤ĄŁ
+ Ëč˛óĄ˘SS_START ¤Ç¸Ć¤Ó˝Đ¤ˇ¤żžěšç¤ĎĽęĽťĽĂĽČ¤Ë¤č¤Ă¤ĆąĆśÁ¤Î¤˘¤ëĽěĽ¸ĽšĽż¤ň
+ łĘÇź¤ˇĄ˘SS_FINISH ¤Ç¸Ć¤Ó˝Đ¤ˇ¤żžěšç¤Ď¤˝¤ě¤ň˛óÉü¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 6.13. GetMode() ´Řżô
+
+ GetMode() ´Řżô¤Ď XFree86 1.3 Ëř¤ĎťČ¤Ă¤Ć¤¤¤Ţ¤ť¤ó¤ˇĄ˘¤ł¤ě¤Ď
+ vgaVideoChipRec ˇż¤Ç `NoopDDA' ¤ň˝é´ü˛˝¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+
+ ž­Í襢¤¤¤Ż¤Ä¤Ť¤ÎĹŔ¤Ç¤ł¤Î´Řżô¤ĎĽľĄźĽĐĄź¤ÎĽÉĽéĽ¤ĽĐĽéĽ¤ĽÖĽéĽę¤ňťČ¤ŚĽľĄźĽĐ
+ Ąźłî¤ÄĄżËô¤ĎĽšĽżĽóĽÉĽ˘ĽíĄźĽó¤ÎĽ×ĽíĽ°ĽéĽŕ¤ÎÂĐĎáżĽÓĽÇĽŞĽâĄźĽÉÄ´Ŕá¤ËťČÍŃ
+ ˛ÄÇ˝¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤Î´Řżô¤Ď SVGA ĽěĽ¸ĽšĽż¤ňĆɤߚţ¤ß¸˝şß¤ÎĽÓĽÇĽŞĽâĄź
+ ĽÉ¤Î DisplayModeRec š˝Â¤ÂΤ˽ń¤­šţ¤ß¤Ţ¤šĄŁ
+
+ 6.14. FbInit() ´Řżô
+
+ FbInit() ´Řżô¤ĎĽ˘ĽŻĽťĽéĽěĄźĽżĽ°ĽéĽŐĽŁĽĂĽŻĽš¤ňĽľĽÝĄźĽČ¤š¤ëĽÉĽéĽ¤ĽĐ¤ËÉŹ
+ żÜ¤Ç¤šĄŁĽ˘ĽŻĽťĽéĽěĄźĽżĽÁĽĂĽ×¸ÇÍ­¤ÎĽĐĄźĽ¸ĽçĽó¤Ç¤Ďɸ˝ŕ¤Ç cfb.banked ´Řżô
+ ¤ňĂÖ¤­´š¤¨¤ĆťČÍѤˇ¤Ţ¤šĄŁvga256LowlevFuncs ¤ĎĂÖ¤­´š¤¨˛ÄÇ˝¤Ę´Řżô¤Î°ěÍ÷¤ň
+ ´Ţ¤ŕš˝Â¤ÂΤǤšĄŁ¤ł¤Îš˝Â¤ÂÎ¤Ď vga256.h ¤ÇÄęľÁ¤ˇ¤Ć¤¤¤Ţ¤šĄŁFbInit() ´Řżô
+ ¤ÎÎă¤Ď et4000, pvga1 ¤Čcirrus ¤ÎĽÉĽéĽ¤ĽĐ¤Ë¤˘¤ę¤Ţ¤šĄŁ
+
+ ¤ł¤Î´Řżô¤ŹÉŹÍפʤ¤žěšçĄ˘Ăą¤ËÄęľÁ¤ň¤ˇ¤Ę¤¤¤ÇĄ˘vgaVideoChipRec ˇż¤Ç˝é´ü˛˝
+ ¤ˇ¤ż `NoopDDA' ¤ňĂÖ¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 7. żˇĽľĄźĽĐĄź¤ÎŔ¸ŔŽ
+
+ ¤ł¤ÎŔßÄęşîśČ¤ĎĄ˘Ľ˝ĄźĽšĽŐĽĄĽ¤Ľë¤Ť¤é¤ŤĄ˘ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤é¤Ť¤Ë¤č¤é¤şĽľĄźĽĐ
+ Ąź¤ňŔ¸ŔŽ¤š¤ëĂĘłŹ¤ÎşîśČ¤ňšÔ¤¤¤Ţ¤šĄŁ
+
+ o Ľ˝ĄźĽšĽŐĽĄĽ¤Ľë¤Ť¤éşîśČ¤ň¤ˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘źĄ¤Îźę˝ç¤ÇšÔ¤Ă¤Ć˛ź¤ľ¤¤:
+
+ xc/programs/Xserver ¤Ë°ÜĆ°¤ˇ¤ĆĄ˘ `make Makefile' ¤ČĆţÎϤˇ¤ż¤é `make
+ Makefiles depend all' ¤ČĆţÎϤˇ¤Ţ¤šĄŁ
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éşîśČ¤ň¤ˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘źĄ¤Îźę˝ç¤ÇšÔ¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤:
+
+ 1. /usr/X11R6/lib/Server ¤Ř°ÜĆ°¤ˇ¤ĆĄ˘ `./mkmf' ¤ČĆţÎϤˇ¤ż¤é
+
+ 2. Ćą¤¸ĽÇĽŁĽěĽŻĽČĽę¤ÇĄ˘`make' ¤ČĆţÎϤˇ¤Ţ¤šĄŁ
+
+ şÇ˝é¤ÎŔ¸ŔŽ¤Î¸ĺ¤ÇĽľĄźĽĐĄź¤ÎşĆŔ¸ŔŽ¤ňšÔ¤Ś¤Ę¤é¤ĐĄĘÎ㤨¤ĐÄɲ䚤ëĽÉĽéĽ¤
+ ĽĐ¤ËĘŃšš¤ˇ¤Ć¤Ť¤éĄË:
+
+ o Ľ˝ĄźĽšĽŐĽĄĽ¤Ľë¤Ť¤éşîśČ¤ň¤ˇ¤Ć¤¤¤ëžěšç¤ĎĄ˘źĄ¤Îźę˝ç¤ÇšÔ¤Ă¤Ć˛ź¤ľ¤¤:
+
+ 1. ĹŹŔÚ¤Ę drivers/ ˛ź¤Î ĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤ĆĄĘÎ㤨¤Đ
+ xc/programs/Xserver/hw/xfree86/vga256/driversĄËĄ˘¤˝¤ˇ¤Ć `make'
+ ¤ČĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. xc/programs/Xserver ¤Ř°ÜĆ°¤ˇ¤ĆĄ˘źĄ¤ňĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ `make
+ loadXF86_SVGA' (ĽŤĽéĄźĽľĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ), `make loadXF86_VGA16'
+ (16 ż§ĽľĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ) Ëô¤Ď `make loadXF86_Mono' (ĽâĽÎĽŻĽíĽľ
+ ĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ)ĄŁ
+
+ o ĽęĽóĽŻĽ­ĽĂĽČ¤Ť¤éşîśČ¤ňšÔ¤Ă¤Ć¤¤¤ëžěšç¤ĎĄ˘źĄ¤Îźę˝ç¤ÇšÔ¤Ă¤Ć˛ź¤ľ¤¤:
+
+ 1. ĹŹŔڤʼɼ鼤ĽĐ¤ÎĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤ĆĄ˘¤˝¤ˇ¤Ć `make' ¤ČĆţÎϤˇ¤Ć
+ ¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. /usr/X11R6/lib/server ¤Ë°ÜĆ°¤ˇ¤ĆĄ˘źĄ¤ňĆţÎϤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ `make
+ loadXF86_SVGA' (ĽŤĽéĄźĽľĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ), Ëô¤Ď `make
+ loadXF86_VGA16' (16 ż§ĽľĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ) Ëô¤Ď `make
+ loadXF86_Mono' (ĽâĽÎĽŻĽíĽľĄźĽĐĄź¤Ř¤ÎĽęĽóĽŻ)ĄŁ
+
+ 8. ĽÇĽĐĽĂĽ°
+
+ ťÄÇ°¤Ę¤Ź¤éżˇ¤ˇ¤¤ĽÉĽéĽ¤ĽĐ¤ÎĽÇĽĐĽĂĽ°¤ĎżÉ¤¤¤â¤Î¤Ç¤šĄŁÎ㤨¤Đ SVGA ĽÁĽĂĽ×
+ ĽťĽĂĽČ¤ÎĽ×ĽíĽ°ĽéĽŕ¤Ź´Ö°ă¤Ă¤żžěšçĽŢĽˇĽó¤Ź¸Ç¤Ţ¤Ă¤Ć¤ˇ¤Ţ¤Ś¤Ç¤ˇ¤ç¤ŚĄŁĽÇĽŁĽš
+ Ľ×ĽěĽ¤¤ÎÉ˝ź¨¤ŹžĂ¤¨¤ż¤ę¤š¤ë¤Î¤ÇĄ˘¤â¤ˇ¤Ť¤š¤ë¤ČŔľžď¤ËĚᤚ¤ż¤á¤ËşĆΊ¤Ážĺ¤˛
+ ¤ň¤š¤ëÉŹÍפŹ¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤óĄŁł°ÉôĂźËö¤ňˇŇ¤°¤ŤĄ˘ĽÍĽĂĽČĽďĄźĽŻ¤Ť¤éĽíĽ°
+ Ľ¤Ľó¤š¤ë¤ł¤Č¤ň*śŻ¤Ż*¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁĽľĄźĽĐĄź¤ÇĽÇĽĐĽĂĽŹ¤ŹĆ°şî¤š¤ëžěšç¤ËĄ˘
+ ÍŁ°ěšçÍýĹŞ¤ĘĘýËĄ¤Ç¤šĄŁĘŁżô¤Î VT ¤ňťČ¤¤¤Ę¤Ź¤é¤ÎĽÇĽĐĽĂĽ°¤Ď´đËÜĹŞ¤Ëťţ´Ö¤Î
+ ĚľÂ̤ǤšĄŁ
+
+ ĽŢĽˇĽó¤Ź¸Ç¤Ţ¤Ă¤Ć¤ˇ¤Ţ¤Śžěšç¤ĎĄ˘ĽľĄźĽĐĄź¤ňľŻĆ°¤š¤ëÁ°¤Ë°ě¤Ä¤ŤĆó¤Ä¤Î `Ćą
+ ´ü'¤ňźč¤ëťö¤ňť×¤¤˝Đ¤š¤ł¤Č¤Ď*¤Č¤Ć¤â*Îɤ¤¤Čť×¤¤¤Ţ¤šĄŁ˛Ă¤¨¤ĆĄ˘ĽÇĽĐĽĂĽ°¤ň
+ ťĎ¤á¤ëÁ°¤ËÉŹÍפΤʤ¤ĽŐĽĄĽ¤ĽëĽˇĽšĽĆĽŕ¤ňĽ˘ĽóĽŢĽŚĽóĽČĄĘÉŹÍפΤʤ¤ fsck ¤Ź
+ źÂšÔ¤ľ¤ě¤Ę¤¤¤č¤Ś¤ËĄË¤ˇ¤Ć¤Ş¤­¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ɸ˝ŕ¤Ç¤ĎĽľĄźĽĐĄź¤ĎĽÇĽĐĽĂĽ°ÍѤμˇĽóĽÜĽë¤ŹÉŐ°¤ˇ¤Ć¤¤¤Ţ¤ť¤óĄŁĽÇĽĐĽĂĽ°¤Ç¤­
+ ¤ë¤č¤Ś¤Ë¤ˇ¤żĽľĄźĽĐĄź¤Ď*¤Č¤Ć¤â*Â礭¤Ę¤â¤Î¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤Ç¤š¤ŹĽÇĽĐĽĂĽ°¤Î°Ů
+ ¤ÎĽľĄźĽĐĄź¤ňşĆš˝Ăۤš¤ë¤ł¤Č¤Ď´ĘĂą¤Ç¤šĄŁźĄ¤Îźę˝ç¤ÇšÔ¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤:
+
+ 1. ĽÉĽéĽ¤ĽĐ¤ÎĽÇĽŁĽěĽŻĽČĽę¤Ř°ÜĆ°¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 2. Makefile ¤ňĘÔ˝¸¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ `CDEBUGFLAGS' ¤Î *ĆóČÖĚÜ*¤ÎÄęľÁ¤ňĂľ¤ˇ
+ ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁźĄ¤Î¤č¤Ś¤Ë˝¤Ŕľ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ CDEBUGFLAGS = -g -DNO_INLINE
+
+ (¤ł¤ě¤ĎĽÇĽĐĽĂĽ°ÍŃĽˇĽóĽÜĽë¤ňÍ­¸ú¤Ë¤ˇĄ˘ĽˇĽóĽ°ĽëĽšĽĆĽĂĽ×źÂšÔťţ¤Î°­Ě´¤ň°ú
+ ¤­ľŻ¤ł¤š´Řżô¤ÎĽ¤ĽóĽéĽ¤ĽóŸłŤ¤ňĚľ¸ú¤Ë¤ˇ¤Ţ¤šĄŁ)
+
+ 3. `sdc_driver.o' ĽŐĽĄĽ¤Ľë¤ňžĂ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 4. žĺľ­¤Îźę˝ç¤ËĂíĚܤˇ¤ĆĽľĄźĽĐĄź¤ňşĆš˝Ăۤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ (Ëô¤ĎĄ˘¸Ĺ¤¤ .o ĽŐĽĄĽ¤Ľë¤ňžĂ¤ˇ¤ż¸ĺ¤Ç Makefile ¤ň˝¤Ŕľ¤š¤ëÂĺ¤ď¤ę¤ËĄ˘Ăą
+ ¤Ë `make CDEBUGFLAGS="-g -DNO_INLINE"' ¤ňźÂšÔ¤ˇ¤Ćžĺľ­¤Îźę˝ç¤ÇĽľĄźĽĐ
+ Ąź¤ňşĆš˝Ăۤˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ)
+
+ ¤ł¤ě¤ňšÔ¤Ś¤ł¤Č¤Ë¤č¤Ă¤ĆĽÉĽéĽ¤ĽĐ¤Î´Řżô¤ËĽÖĽěĄźĽŻĽÝĽ¤ĽóĽČ¤ňŔßÄꤡĽˇĽóĽ°Ľë
+ ĽšĽĆĽĂĽ×źÂšÔ¤ňĽľĄźĽĐĄź¤ÇšÔ¤Ś¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁĽ˝ĄźĽš¤Ť¤éşîśČ¤ňšÔ¤¤Ą˘SVGA
+ Ľ×ĽíĽ°ĽéĽßĽóĽ°¤ňłŘ˝Ź¤ˇťĎ¤á¤ż¤Đ¤Ť¤ę¤Ę¤é¤ĐĄ˘vgaHW.c ¤ňşĆš˝ĂۤˇĽÇĽĐĽĂĽ°¤š
+ ¤ë¤Î¤Ź¤Á¤ç¤Ś¤ÉÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 9. Ľ˘ĽÉĽĐĽ¤Ľš
+
+ Á´¤Ć¤ÎÍřÍѲÄÇ˝¤Ęť˛šÍʸ¸Ľ¤Č¸şß¤š¤ëĽ×ĽíĽ°ĽéĽŕ¤ňÄ´¤Ů¤ĆĄ˘˛ż¤ŹľŻ¤Ă¤Ć¤¤¤ë¤Î
+ ¤ŤĘŹ¤Ť¤ë¤č¤Ś¤Ë¤Ę¤ë¤Ţ¤Ç¤Ť¤Ę¤ęĽšĽČĽěĽš¤ň´ś¤¸¤Ţ¤šĄŁĽÉĽéĽ¤ĽĐ¤ň˝ń¤­ťĎ¤á
+ ¤ë*Á°¤Ë*Ä´şş¤ňšÔ¤Ă¤Ć˛ź¤ľ¤¤ĄŁ¤Ť¤Ę¤ęĆŹÄˤň¸ş¤é¤š¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄŁ˛ÄÇ˝¤Ę¤é
+ ¤ĐĄ˘¤ł¤ě¤Ť¤éÄɲ䡤褌¤Č¤š¤ëĽÁĽĂĽ×ĽťĽĂĽČ¤Ëť÷¤żĽÁĽĂĽ×ĽťĽĂĽČ¤ÎĽÉĽéĽ¤ĽĐ¤ň
+ Ăľ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎÎăÂꤍ¤éÇÉŔ¸¤ľ¤ť¤ĆĽÉĽéĽ¤ĽĐ¤ňşîŔŽ¤Ç¤­¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť
+ ¤óĄŁ
+
+ ĽÇĽĐĽĂĽ°Ăć¤Ď°Ĺ¤Żť×¤¤ľÍ¤á¤Ć¤Ď¤¤¤ą¤Ţ¤ť¤óĄŁ¤Ď¤¸¤á¤Î¤Ś¤ÁĄĘťä¤â¤Ţ¤Ŕ¤˝¤Ś¤Ç
+ ¤šĄËĄ˘ÂżĘŹĚäÂę¤ňĘú¤¨¤Ć¤¤¤ë¤Č¤­¤ĎĂí°Őżź¤Żżľ˝Ĺ¤ËĽÇĽĐĽĂĽ°¤š¤ë¤Î¤Çż×ÂŽ¤ËŔŽ
+ ˛Ě¤Źžĺ¤Ź¤ę¤Ţ¤šĄŁ¤˝¤ě¤ĎĽÁĽĂĽ×ĽťĽĂĽČ¤Ë¤Ä¤¤¤Ć¤ÎÍý˛ň¤ňšâ¤á°ěĆü¤ŤĆóĆü¤ÎĆâ¤Ë
+ ĽÉĽéĽ¤ĽĐ¤Ź˝ń¤­žĺ¤Ź¤ęĽÇĽĐĽĂĽ°˝ĐÍč¤Ţ¤šĄŁ¤ł¤Îźď¤ÎĽ×ĽíĽ°ĽéĽßĽóĽ°¤ňłŘ˝Ź¤ˇťĎ
+ ¤á¤żżÍ¤Ç¤Ď°ě˝ľ´Ö¤â¤˘¤ě¤Đ¤č¤ęÂĹĹö¤ĘŔţ¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 10. šâĹ٤ĘĎĂÂę
+
+ żˇ¤ˇ¤¤ĽÁĽĂĽ×ĽťĽĂĽČ¤ĎĆó¤Ä¤ÎšâĹ٤ʾť˝ŃÎΰč¤ňźč¤ęÁȤߤޤˇ¤ż: ¤˝¤ě¤ĎĽ×ĽíĽ°
+ ĽéĽŢĽÖĽëĽŻĽíĽĂĽŻĽ¸Ľ§ĽÍĽěĄźĽż¤ČĽ˘ĽŻĽťĽéĽěĄźĽż¤ÎłĆźďĆĂŔ­(BitBlt, line
+ drawing, HW ĽŤĄźĽ˝Ľë) ¤Ç¤šĄŁ¤ł¤ě¤é¤Ďżˇ¤ˇ¤¤ľť˝ŃÎΰč¤ÇĄ˘Ŕľź°¤ĘĽ¤ĽóĽżĄź
+ ĽŐĽ§ĄźĽš¤Ď̤¤ŔÄęľÁ¤ľ¤ě¤Ć¤¤¤Ţ¤ť¤óĄŁ¤ł¤ě¤é¤Îżˇ¤ˇ¤¤ľť˝ŃÎΰč¤Ë¤Ä¤¤¤ĆşîśČ¤ˇ
+ ¤ż¤¤žěšç¤ĎĄ˘XFree86 ĽÁĄźĽŕ¤ČϢÍí¤ňźč¤Ă¤ĆłŤČŻ/ĽŮĄźĽżĽĆĽšĽČĽÁĄźĽŕ¤Ëť˛˛č
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ 11. ť˛šÍʸ¸Ľ
+
+ o Programmer's Guide to the EGA and VGA Cards, 3rd ed.
+ Richard Ferraro
+ Addison-Wesley, 1990
+ ISBN 0-201-57025-4
+ (¤ł¤ě¤Ď SVGA Ľ×ĽíĽ°ĽéĽßĽóĽ°¤ÎÉŹĆÉ˝ń¤Ç¤šĄŁ¤Á¤ç¤Ă¤ČĽ¨ĽéĄź¤Ź¤˘¤ë¤Î¤ÇĂí
+ °Ő¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁÂč 3 ČǤǤ⼢ĽŻĽťĽéĽěĄźĽżĽÓĽÇĽŞĽŤĄźĽÉ¤Ë¸ŔľÚ¤ˇ¤Ć¤¤¤Ţ
+ ¤šĄŁ)
+
+ o vgadoc4.zip
+ Finn Thoegersen
+ (SVGA ¤Č¤˝¤Îž¤ÎĽÁĽĂĽ×ĽťĽĂĽČ¤ÎťńÎÁ¤ň˝¸¤á¤ż¤â¤Î¤Ç¤šĄŁwuarchive ¤ň´Ţ
+ ¤ŕ FTP ¤Ť¤éźč¤ę´ó¤ť˛ÄÇ˝¤ÇËؤɤΠMS-DOS/Windows ¤Ç¸Ť¤ë¤ł¤Č¤Ź˛ÄÇ˝¤Ç
+ ¤šĄŁDOS/BIOS ¤Ë°Í¸¤ˇ¤ż¤â¤Î¤Ç¤š¤ŹĄ˘Ăľşş´Řżô¤ňłŤČŻ¤š¤ëťţ¤Ë¤Č¤Ć¤âÍ­ÍŃ
+ ¤Ç¤šĄŁ)
+
+ 12. ĽŮĽóĽŔĄźĎ˘ÍíŔčžđĘó
+
+ ATI Technologies (VGA-Wonder, Mach8, Mach32)
+ 33 Commerce Valley Drive East" Thornhill, Ontario
+ Canada L3T 7N6
+ (905) 882-2600 (sales)
+ (905) 882-2626 (tech support)
+ (905) 764-9404 (BBS)
+ (905) 882-0546 (fax)
+
+ Chips & Technologies
+ ???
+
+ Cirrus Logic (SVGA, Accelerators - CL-GD5426)
+ 3100 West Warren Ave.
+ Fremont, CA 94538
+ (510) 623-8300 (N. CA, USA)
+ (49) 8152-40084 (Germany)
+ (44) 0727-872424 (UK)
+
+ Genoa Systems (GVGA)
+ 75 E. Trimble Road
+ San Jose, CA 95131
+ (408) 432-9090 (sales)
+ (408) 432-8324 (tech support)
+
+ Headland Technologies, Inc (Video-7 VGA 1024i, VRAM II)
+ 46221 Landing Parkway
+ Fremont, CA 94538
+ (415) 623-7857
+
+ Oak Technology, Inc (OTI-067,OTI-077)
+ 139 Kifer Ct.
+ Sunnyvale, CA 94086
+ (408) 737-0888
+ (408) 737-3838 (fax)
+
+ S3 (911, 924, 801/805, 928, 864, 868, 964, 968, 764, 765)
+ (408) 980-5400
+
+ Trident Microsystems Inc (8800, 8900, 9000)
+ 205 Ravendale Dr
+ Mountainside, CA 94043
+ (415) 691-9211
+
+ Tseng Labs Inc,
+ 6 Terry Drive
+ Newtown, PA 18940
+ (215) 968-0502
+
+ Weitek (Power9000, 5186)
+ 1060 E. Arques Ave,
+ Sunnyvale, CA 94086
+ (408) 738-5765
+
+ Western Digital
+ (714) 932-4900
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VGADriv.sgml,v 3.10 1996/10/23 13:10:05 dawes Exp
+
+ $XConsortium: VGADriv.sgml /main/6 1996/01/10 11:12:02 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/VGADriv.sgml,v
+ 3.10 1996/10/23 13:10:05 ¤ňĄ˘ ˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/VGADriv.sgml,v
+ 3.11 1996/12/09 12:35:25 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Japanese/VideoModes.doc b/xc/programs/Xserver/hw/xfree86/doc/Japanese/VideoModes.doc
new file mode 100644
index 000000000..2cea03a81
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Japanese/VideoModes.doc
@@ -0,0 +1,1158 @@
+ X386/XFree86 ¤ÎĽÓĽÇĽŞžđĘóÄ´Ŕ°¤ňźŤĘŹ¤ÇšÔ¤Ę¤Ś¤ż¤á¤Îźę°ú¤­
+ (¤Ţ¤ż¤ĎźńĚŁ¤ČźÂą×¤Î¤ż¤á¤ÎĽâĽËĽżĄźÄ´Ŕ°¤Îźę°ú¤­)
+ Eric S. Raymond esr@snark.thyrsus.com (¸śĂř¤Ď Chin Fang
+ fangchin@leland.stanford.edu; ťá¤Ź˝ń¤­¤Ţ¤ˇ¤żĄŁ Bob Crosson
+ crosson@cam.nist.gov,ťá¤ŹĽĎĽŚĽÄĄź¤Ť¤éÇÉŔ¸ÉôĘŹ¤ň˝ń¤­¤Ţ¤ˇ¤żĄŁ)
+ Ăř
+ ˛ŹËÜ °ěšŹ Kazuyuki Okamoto <ikko-@pacific.rim.or.jp> Ěő
+ ¤ł¤ě¤ĎĽĐĄźĽ¸ĽçĽó 1.0, 1993 ÇŻ 1 ˇî 8 Ćü ¤Ç¤šĄŁ
+ ____________________________________________________________
+
+ Table of Contents:
+
+ 1. ˝řʸ
+
+ 2. ĽÓĽÇĽŞĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĆ°şî¸śÍý
+
+ 3. ĽÇĽŁĽšĽ×ĽěĽ¤¤ČĽ˘ĽŔĽ×Ľż¤Ë¤Ä¤¤¤Ć¤Î´đÁĂĂÎźą
+
+ 4. ´đËÜťĹÍͤÎĆɤßĘý
+
+ 5. ĽˇĽšĽĆĽŕ¤Îš˝ŔŽ¤Ë¤Ş¤ą¤ëĽČĽěĄźĽÉĽŞĽŐ
+
+ 6. Í׾áĽáĽâĽęÎĚ
+
+ 7. ĽŐĽěĄźĽŕĽľĽ¤Ľş¤Îˇ×ťť
+
+ 8. šőËâ˝Ń¤ČĆą´üżŽšć
+
+ 9. Á´ÂΤΤޤȤá
+
+ 10. źÁľżąţĹú
+
+ 11. Ćó¤Ä¤ÎÎăÂę
+
+ 12. É˝ź¨¤ÎĚäÂ꽤Ŕľ
+ ______________________________________________________________________
+
+ 1. ˝řʸ
+
+ ˛ţÎɤΤż¤á¤ÎΨĞ¤Ę¤´°Ő¸ŤĄ˘¤´ČăÉž¤Č¤´Äó°Ć¤Ď esr@snark.thyrsus.com °¸¤Ć
+ ¤ËÁ÷¤Ă¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ [ĚőĂí: ĚŢĎŔĄ˘ËÜ˝ń¤ÎĆüËܸěČǤËÂФš¤ë˛ţÎɤΤż¤á¤ÎΨĞ
+ ¤Ę¤´°Ő¸ŤĄ˘¤´ČăÉž¤Č¤´Äó°Ć¤Ď <ikko-@pacific.rim.or.jp>
+ <mailto:ikko-@pacific.rim.or.jp> °¸¤Ć¤ËÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ]
+
+ ĽćĄźĽśĄź¤Ď XFree86 ĽľĄźĽĐĄź¤ňźŤĘŹ¤ÎĽÓĽÇĽŞ¤Ëšç¤ď¤ť¤ĆĽĎĄźĽÉĽŚĽ§Ľ˘¤ňťČ¤¤
+ ¤ł¤Ę¤š¤č¤Ś¤Ëš˝ŔŽ˝ĐÍč¤Ţ¤šĄŁ¤ł¤Îźę°ú¤­˝ń¤ĎźŤĘŹźŤżČ¤ÎĽÓĽÇĽŞĽŤĄźĽÉ¤ČĽâĽËĽż
+ ¤ÎşÇĹŹ¤Ęťţ´ÖÄ´Ŕá¤ÎżôĂͤňĄ˘ÇĄ˛ż¤ËŔ¸ŔŽ¤š¤ë¤ŤĘŮśŻ¤š¤ë˝ő¤ą¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ¤ł¤ł¤Ç¤Ď¤Ţ¤ş XFree86 ĽľĄźĽĐĄź¤ň˛ż¤Č¤ŤĆ°¤Ť¤š¤ż¤á¤ÎĘýËĄ¤ňÄ󟨤ˇĄ˘¤˝¤ě¤ň
+ ĽŮĄźĽš¤ËźÂ¸ł¤ň¤ˇ¤Ę¤Ź¤é¤¤¤í¤¤¤í¤ČŔßÄę¤ňĘŃšš¤ˇ¤ĆźŤĘŹ¤ÎšĽ¤ß¤Ëšç¤ď¤ť¤ë¤ż¤á
+ ¤Î¤ä¤ęĘý¤ňŔâĚŔ¤ˇ¤Ţ¤šĄŁ
+
+ ¤Ű¤Č¤ó¤ÉĆ°şî¤ˇ¤Ć¤¤¤ëĽâĄźĽÉ¤ňťý¤Ă¤Ć¤¤¤ëžěšç¤ĎĄĘĆä˥˘Á°¤â¤Ă¤ĆŔßÄꤡ¤Ć¤¤
+ ¤ë VESA ĽâĄźĽÉ¤Ďş¸ąŚ¤ËĘŇ´ó¤Ă¤ż¤ęĄ˘žŽ¤ľ¤š¤Ž¤ż¤ęĄ˘Â礭¤š¤Ž¤ż¤ę¤š¤ë¤Ç¤ˇ¤ç
+ ¤Ś¤ŹĄ˘°ÂÄꤡ¤Ć¤¤¤ë¤Ç¤ˇ¤ç¤ŚĄËĄ˘¤ľ¤Ă¤˝¤ŻĚäÂ꽤Ŕľ¤ÎŔᤍ¤éťĎ¤á¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+ ¤ł¤ÎŔá¤ĎÄ´Ŕ°żôĂͤň¤Á¤ç¤Ś¤ÉÎɤ¤żôĂͤ˜á¤Ĺ¤ą¤ëĘýËĄ¤ňśľ¤¨¤Ć¤Ż¤ě¤ë¤Ç¤ˇ¤ç
+ ¤ŚĄŁ
+
+ XFree86 ¤ĎĽŰĽĂĽČĽ­Ąź¤Ç XF86Config ĽŐĽĄĽ¤Ľë ¤ËÄęľÁ¤ľ¤ě¤Ć¤¤¤ë°Ű¤Ę¤ëĽâĄź
+ ĽÉ´Ö¤ň°ÜĆ°¤Ç¤­¤Ţ¤šĄĘžÜşŮ¤Ë¤Ä¤¤¤Ć¤Ď XF86Config.man ¤ňť˛žČ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄËĄŁ¤ł¤ě¤Ď¤Č¤Ć¤âĘŘÍř¤ĘľĄÇ˝¤Ç¤šĄŁżˇ¤ˇ¤¤ĽâĄźĽÉ¤ňťî¤ˇ¤Ć¤ß¤ż¤Ż¤Ę¤Ă¤ż¤éĄ˘
+ żˇ¤ˇ¤¤ĽâĄźĽÉ¤ň˝ĹĘŁ¤ˇ¤Ę¤¤ĽâĄźĽÉĽéĽŮĽë¤ňÉŐ¤ą¤ĆĽŰĽĂĽČĽ­ĄźĽęĽšĽČ¤Î end ¤Ë
+ Äɲ䡤ƤŻ¤Ŕ¤ľ¤¤ĄŁżˇ¤ˇ¤¤ĽâĄźĽÉ¤ŹĆ°¤Ť¤Ę¤Ť¤Ă¤ż¤Č¤­¤ÎĘݸą¤ËĄ˘´ű¤ËĆ°¤¤¤Ć¤¤
+ ¤ëĽâĄźĽÉ¤Ďɸ˝ŕĂͤȤˇ¤ĆťÄ¤ˇ¤Ć¤Ş¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĄÖĆó¤Ä¤ÎÎăÂęĄ×žĎ¤ÎşÇ¸ĺ¤Î
+ Xconfig Ŕá¤ňĆɤá¤ĐĄ˘¤š¤ß¤ä¤Ť¤ËĚäÂę¤ň˛ňˇč¤š¤ë¤ż¤á¤Ë¤Ď¤É¤Î¤č¤Ś¤ËźÂ¸ł¤ňľ­
+ Ďż¤š¤ě¤Đ¤č¤¤¤ŤĄ˘ť˛šÍ¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ şÇ˝é¤Ë lib/X11/doc ¤Ë¤˘¤ë Monitors ĽŐĽĄĽ¤Ľë¤ňłÎǧ¤ˇ¤ĆźŤĘŹ¤ÎĽâĽËĽżĄź¤Ź
+ ĽÇĄźĽżĽŮĄźĽš¤ÎĂć¤Ë¤˘¤ě¤ĐĄ˘ÂżĘŹ¤ł¤Îʸ˝ń¤ÎťÄ¤ę¤ÎÉôĘŹ¤ĎČô¤Đ¤ˇ¤Ćš˝¤¤¤Ţ¤ť
+ ¤óĄŞĽÇĄźĽżĽŮĄźĽš¤ËźŤĘŹ¤ÎĽŤĄźĽÉ¤ŹťČÍѤš¤ëĽâĄźĽÉ¤ŹĚľ¤Ť¤Ă¤żžěšçĄ˘¤¤¤Ż¤Ä¤Ť
+ ¤Îťţ´ÖÄ´Ŕá¤ÎżôĂͤňÂŹÄꤚ¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤š¤ŹĄ˘´ĘĂą¤ĘşîśČ¤Ç¤šĄŁ
+
+ 2. ĽÓĽÇĽŞĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĆ°şî¸śÍý
+
+ ĽÓĽÇĽŞĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĆ°şî¸śÍý¤ňĂΤ뤳¤Č¤Ď Xconfig ĽŐĽĄĽ¤Ľë¤Îż§Ąš¤Ęžě˝ę
+ ¤Ë¤É¤ó¤Ężôťú¤ňĆţ¤ě¤ë¤Ť¤ňÍý˛ň¤š¤ëžĺ¤Ç˝ĹÍפǤšĄŁ¤ł¤ě¤é¤ÎĂÍ¤Ď XFree86 Ľľ
+ ĄźĽĐĄź¤ŹĽÇĽŁĽšĽ×ĽěĽ¤¤ňĽĎĄźĽÉĽŚĽ§Ľ˘ĽěĽŮĽë¤ÇŔŠ¸ć¤š¤ë¤Î¤ËťČÍѤľ¤ě¤Ţ¤šĄŁ
+
+ ĽÇĽŁĽšĽ×ĽěĽ¤¤ĎĽÉĽĂĽČ¤Î˝¸¤Ţ¤ę¤Ť¤é˛čÁü¤ňÉ˝ź¨¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽÉĽĂĽČ¤ňş¸¤Ť¤éąŚ
+ ¤Řʤ٤ĆŔţ¤ňşî¤ę¤Ţ¤šĄŁ¤ł¤ÎŔţ¤ňžĺ¤Ť¤é˛ź¤Řʤ٤ƲčÁü¤ňşî¤ę¤Ţ¤šĄŁĽÉĽĂĽČ¤Ď
+ ĽÇĽŁĽšĽ×ĽěĽ¤ĆâÉô¤Ť¤é¤ÎĹŝҼӥźĽŕ¤ÇĂĄ¤Ť¤ě¤ż¤Č¤­ČŻ¸÷¤ˇ¤Ţ¤šĄŁ¤˝¤ě¤ž¤ě¤Î
+ ĽÉĽĂĽČ¤ËśŃ°ě¤ËĹŝҼӥźĽŕ¤ňĹö¤Ć¤ë¤ż¤á¤ËĄ˘°ěÄę¤ÎĽŃĽżĄźĽó¤ÇĽÇĽŁĽšĽ×ĽěĽ¤žĺ
+ ¤ňÁöşş¤ˇ¤Ţ¤šĄŁ
+
+ ¤˝¤ÎĽŃĽżĄźĽó¤ĎĽšĽŻĽęĄźĽó¤Îş¸žĺ¤Ť¤éťĎ¤Ţ¤ęĄ˘ąŚ¤ŘżżÄž¤°ĽšĽŻĽęĄźĽó¤ň˛ŁŔÚ¤ë
+ ¤č¤Ś¤ËÁö¤ęĄ˘ĽšĽŻĽęĄźĽó¤ÎąŚĂź¤Ç°ěĂśÄäťß¤ˇ¤Ţ¤šĄŁ¤˝¤ˇ¤ĆĹŝҼӥźĽŕ¤ĎĽÇĽŁĽš
+ Ľ×ĽěĽ¤¤Îş¸Ăź¤Ë°ÜĆ°¤ˇĄ˘°ěËܲź¤Ë°ÜĆ°¤ˇ¤Ţ¤šĄŁżˇ¤ˇ¤¤Ŕţ¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Îş¸¤Ť
+ ¤éąŚ¤ŘşÇ˝é¤ÎŔţ¤ň°ú¤¤¤ż¤č¤Ś¤ËÁöşş¤ˇ¤Ţ¤šĄŁ¤ł¤ÎĽŃĽżĄźĽó¤ňĽÇĽŁĽšĽ×ĽěĽ¤¤Î°ě
+ ČÖ˛ź¤Ţ¤ÇˇŤ¤ęĘÖ¤ˇ¤Ţ¤šĄŁ¤˝¤ě¤Ť¤éĹŝҼӥźĽŕ¤ŹĽÇĽŁĽšĽ×ĽěĽ¤¤Îş¸žĺ¤Ť¤éąŚ˛ź¤Ţ
+ ¤Ç°ÜĆ°¤ˇ¤ż¤éĄ˘¤Ţ¤żşÇ˝é¤Ť¤éˇŤ¤ęĘÖ¤ˇ¤Ţ¤šĄŁ
+
+ ĽŐĽěĄźĽŕ¤ÎťĎ¤Ţ¤ę¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Îş¸žĺ¤ÎĹŝҼӥźĽŕ¤ÎłŤťĎĹŔ¤Ç¤šĄŁĹŝҼӥź
+ Ľŕ¤ŹĽÇĽŁĽšĽ×ĽěĽ¤¤ÎąŚ˛źśů¤Ţ¤ÇĆϤ¤¤Ć¤Ť¤éş¸žĺśů¤ËşĆ¤ÓĚá¤Ă¤Ć¤Ż¤ëťţ¤ŹĽŐĽěĄź
+ Ľŕ¤Î˝ŞÎťĹŔ¤Ç¤šĄŁĽŐĽěĄźĽŕ¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Î°ěČ֞复¤é°ěČÖ˛ź¤Ţ¤Ç¤ÎÁ´¤Ć¤ÎĹĹ
+ ťŇĽÓĄźĽŕ¤ÎŔţ¤Ç˝ĐÍč¤Ć¤¤¤Ţ¤šĄŁ
+
+ ¤â¤ˇĹŝҼӥźĽŕ¤ŹĽŐĽěĄźĽŕ¤ň°ÜĆ°¤ˇ¤Ć¤¤¤ë´Ö¤ş¤Ă¤ČĄÖĽŞĽóĄ×¤Ŕ¤Ă¤ż¤éĄ˘ĽÇĽŁĽš
+ Ľ×ĽěĽ¤¤ÎÁ´¤Ć¤ÎĽÉĽĂĽČ¤ĎĹŔĹô¤ˇ¤Ć¤ˇ¤Ţ¤¤Ą˘ĽÇĽŁĽšĽ×ĽěĽ¤¤Îąď¤Ë¤Ďšő¤¤ÉôĘŹ¤Ď¤Ę
+ ¤Ż¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤˝¤ˇ¤ĆĽÇĽŁĽšĽ×ĽěĽ¤¤Îąď¤Ç¤ĎĄ˘ĹŝҼӥźĽŕ¤ÎŔŠ¸ć¤ŹĆń¤ˇ¤¤¤Î
+ ¤Ç˛čÁü¤ŹĎĜʤˇ¤Ć¤ˇ¤Ţ¤Ś¤Ç¤ˇ¤ç¤ŚĄŁ¤ł¤ÎĎĤߤň¸ş¤é¤š¤ż¤áĄ˘ĽÇĽŁĽšĽ×ĽěĽ¤¤Îąď
+ ¤ÎĽÉĽĂĽČ¤Ë¤ĎĄ˘ĹŝҼӥźĽŕ¤ŹĆϤ¤¤Ć¤âĄ˘ĽÉĽĂĽČ¤Źľą¤Ť¤Ę¤¤¤č¤Ś¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ
+ ¤šĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤ÎźÂşÝ¤ËÉ˝ź¨¤ľ¤ě¤ëÎΰ褏žŽ¤ľ¤Ż¤Ę¤Ă¤Ć¤¤¤ë¤Î¤ĎĄ˘¤ł¤Ś¤¤¤Ś
+ ¤ď¤ą¤Ę¤Î¤Ç¤šĄŁ
+
+ ¤â¤Ś°ě¤ÄÍý˛ň¤ˇ¤Ć¤Ű¤ˇ¤¤¤Î¤ĎĄ˘É˝ź¨¤ľ¤ě¤ëÎΰč¤ňÉÁ˛č¤ˇ¤Ć¤¤¤Ę¤¤ťţ¤ËĹŝҼӥź
+ Ľŕ¤Ź¤É¤Ś¤Ę¤Ă¤Ć¤¤¤ë¤Ť¤Č¤¤¤Ś¤ł¤Č¤Ç¤šĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤Î˛ŁĂź¤ňÉÁ˛č¤š¤ë¤ż¤á¤Ë
+ ťČ¤ď¤ě¤ë¤Ď¤ş¤Ŕ¤Ă¤żťţ´Ö¤ĎĄ˘ĹŝҼӥźĽŕ¤ňąŚ¤ÎĂź¤Ť¤éş¸¤ÎĂź¤Ţ¤ÇĚᤡĄ˘°ě¤Ä˛ź
+ ¤ÎźĄ¤ÎĽéĽ¤Ľó¤Ë°ÜĆ°¤š¤ë¤ż¤á¤ËťČ¤ď¤ě¤Ţ¤šĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤ÎžĺĂź¤Ş¤č¤Ó˛źĂź¤ň
+ ÉÁ˛č¤š¤ë¤ż¤á¤ËłÝ¤Ť¤ë¤Ď¤ş¤Ŕ¤Ă¤żťţ´Ö¤ĎĄ˘ĹŝҼӥźĽŕ¤ňĽÇĽŁĽšĽ×ĽěĽ¤¤ÎąŚ˛źśů
+ ¤Ť¤éş¸žĺśů¤Ţ¤Ç°ÜĆ°¤š¤ë¤ż¤á¤ËťČ¤ď¤ě¤Ţ¤šĄŁ
+
+ Ľ˘ĽŔĽ×ĽżĽŤĄźĽÉ¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĹŝҽƤňĹŔĹô¤ľ¤ťÁ´¤Ć¤ÎĽÉĽĂĽČ¤Ç˛čÁü¤ňŔ¸ŔŽ
+ ¤š¤ë¤č¤Ś¤ĘżŽšć¤ňşîŔŽ¤ˇ¤Ţ¤šĄŁ¤Ţ¤żĄ˘ĽŤĄźĽÉ¤ĎĹŝҼӥźĽŕ¤ŹąŚ¤Ť¤éş¸¤Ë°ÜĆ°¤ˇ
+ ¤Ć°ěËܲź¤Ź¤ë¤Č¤­¤Ëżĺʿƹ´üżŽšć¤Č¸Ć¤Đ¤ě¤ëżŽšć¤ňşîŔŽ¤ˇ¤Ţ¤šĄŁ¤š¤Ů¤Ć¤ÎĽéĽ¤
+ Ľó¤ÎşÇ¸ĺ¤Ë°ě¤Ä¤Îżĺʿƹ´üżŽšć¤ŹČŻŔ¸¤ˇ¤Ţ¤šĄŁ¤ľ¤é¤ËĄ˘Ľ˘ĽŔĽ×ĽżĽŤĄźĽÉ¤ĎĹĹťŇ
+ ĽÓĄźĽŕ¤ňĽÇĽŁĽšĽ×ĽěĽ¤¤Îş¸žĺśů¤Ë°ÜĆ°¤š¤ë¤ż¤á¤ÎżâĞƹ´üżŽšć¤âŔ¸ŔŽ¤ˇ¤Ţ¤šĄŁ
+ żâĞƹ´üżŽšć¤ĎÁ´¤Ć¤ÎĽŐĽěĄźĽŕ¤Î˝Ş¤ď¤ęśá¤Ż¤ËşîŔŽ¤ľ¤ě¤Ţ¤šĄŁ
+
+ ĽÇĽŁĽšĽ×ĽěĽ¤¤Ë¤ĎĄ˘ĹŝҼӥźĽŕ¤Î°ĚĂÖ¤ň°ÂÄꤾ¤ť¤ë¤ż¤áĄ˘żĺʿƹ´üżŽšć¤ČżâÄž
+ Ćą´üżŽšć¤ÎÁ°¸ĺ¤ËĂťťţ´Ö¤Î͞;¤ŹÉŹÍפǤšĄŁĹŝҼӥźĽŕ¤Î°ÂÄ경¤Ź˝ĐÍč¤Ę¤¤
+ ¤ČĄ˘˛čÁü¤Ź¤ˇ¤Ă¤Ť¤ę¤ˇ¤Ţ¤ť¤óĄŁ
+
+ °Ęšß¤ÎŔá¤ÇĄ˘ÄęľÁĄ˘¸řź°¤ČÎăÂę¤ÎĘä˝ő¤Î¤ż¤á¤ËĄ˘¤ł¤ě¤é¤Î´đËܤËĚá¤ë¤Ç¤ˇ¤ç
+ ¤ŚĄŁ
+
+ 3. ĽÇĽŁĽšĽ×ĽěĽ¤¤ČĽ˘ĽŔĽ×Ľż¤Ë¤Ä¤¤¤Ć¤Î´đÁĂĂÎźą
+
+ Xconfig ¤ÎŔßÄęšŕĚܤň¤ľ¤ď¤ëÁ°¤ËĄ˘°Ę˛ź¤Î´đÁĂĹŞ¤Ęťöšŕ¤ňĂÎ¤Ă¤Ć¤Ş¤ŻÉŹÍפŹ¤˘
+ ¤ę¤Ţ¤šĄŁ
+
+ 1. ĽâĽËĽżĄź¤Îżĺʿƹ´üżŽšć¤ČżâĞƹ´üżŽšć¤ÎźţÇČżô
+
+ 2. ĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ÎĆ°şîĽŻĽíĽĂĽŻźţÇČżôĄ˘¤Ţ¤ż¤Ď"ĽÉĽĂĽČĽŻĽíĽĂĽŻ"
+
+ 3. ĽâĽËĽżĄź¤ÎźţÇČżôÂÓÉý
+
+ ¤Ç¤šĄŁ
+
+ ĽâĽËĽżĄź¤ÎĆą´üźţÇČżô :
+
+ ĽâĽËĽżĄź¤Îżĺʿƹ´üźţÇČżô¤ĎĄ˘¤˝¤ÎĽâĽËĽżĄź¤ŹŁąÉô֤˽ń¤ą¤ëżĺĘżÁöşşŔţ¤Îżô
+ ¤Î¤ł¤Č¤ÇĄ˘¤ł¤ě¤ĎĽâĽËĽżĄź¤Ë¤Ä¤¤¤ĆşÇ¤â˝ĹÍפĘĹýˇ×ĂͤǤšĄŁżâĞƹ´üźţÇČżô
+ ¤ĎĄ˘¤˝¤ÎĽâĽËĽżĄź¤ŹŁąÉĂ´Ö¤ËĹŝҼӥźĽŕ¤ň˝ÄĘý¸ţ¤ËÄ̲᤾¤ť¤ë¤ł¤Č¤Î¤Ç¤­¤ë˛ó
+ żô¤Î¤ł¤Č¤Ç¤šĄŁ
+
+ Ćą´üźţÇČżô¤ĎÉáÄĚĄ˘ĽâĽËĽżĄź¤ÎĽŢĽËĽĺĽ˘Ľë¤ÎťĹÍͤÎĘǤ˰ěÍ÷¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+ żâĞƹ´üźţÇČżô¤ÎżôĂͤϰěČĚĹŞ¤Ë HzĄĘÉĂĹö¤ż¤ę¤ÎĂą°Ěźţ´üĄË¤ÇĄ˘żĺʿƹ´üźţ
+ ÇČżô¤Ď KHzĄĘÉĂĹö¤ż¤ę¤ÎŔéĂą°Ěźţ´üĄË¤Çˇ×ÂŹ¤ľ¤ě¤Ć¤¤¤Ţ¤šĄŁÄĚžď¤ÎČϰϤϿâÄž
+ ¤Ë¤Ä¤¤¤Ć¤Ď 50 ¤Ť¤é 80HzĄ˘żĺĘż¤Ë¤Ä¤¤¤Ć¤Ď 31 ¤Ť¤é 135KHz ÄřĹ٤ǤšĄŁ
+
+ ĽŢĽëĽÁĽšĽ­ĽăĽóĽâĽËĽżĄź¤ÎžěšçĄ˘¤˝¤ÎźţÇČżô¤ĎÉý¤Î¤˘¤ëĂͤȤˇ¤ĆÉ˝ź¨¤ľ¤ě¤Ć¤¤
+ ¤Ţ¤šĄŁĽíĄźĽ¨ĽóĽÉ¤Î¤â¤Î¤ËÂż¤¤¤Î¤Ç¤š¤ŹĄ˘ĘŁżô¤Î¸ÇÄꤡ¤żźţÇČżô¤ňťý¤Ă¤Ć¤¤¤ë
+ ĽâĽËĽżĄź¤â¤˘¤ę¤Ţ¤šĄŁ¤ł¤Î¤č¤Ś¤ĘĽâĽËĽżĄź¤âÉáÄ̤μâĽËĽżĄź¤ČĆąÍͤËŔßÄę¤Ď˝Đ
+ Íč¤Ţ¤š¤ŹĄ˘ĽâĽËĽżĄź¤Îťý¤ÄĆĂħ¤Ë¸ˇ¤ˇ¤ŻŔŠ¸Â¤ľ¤ě¤Ć¤ˇ¤Ţ¤Ś¤Ç¤ˇ¤ç¤ŚĄŁşÇšâ¤Î˛ň
+ ÁüĹ٤ŹĆŔ¤é¤ě¤ë¤č¤Ś¤ĘşÇ¤âšâ¤¤żĺʿƹ´ü¤ČżâĞƹ´üźţÇČżô¤ÎÁȤߚç¤ď¤ť¤ňÁŞÂň
+ ¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ˇ¤ĆĄ˘¸ÇÄęźţÇČżôĽâĽËĽżĄź¤Ç¤ĎŔߡ×Ăͤč¤ęšâ¤¤źţÇČżô¤ňÍż¤¨
+ ¤ë¤ČĽâĽËĽżĄź¤ňÄˤá¤ë¤Ş¤˝¤ě¤Ź¤˘¤ë¤Î¤ÇĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ĽŤĄźĽÉ¤ÎĆ°şîźţÇČżô :
+
+ ĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ÎťĹÍÍ˝ń¤ËĽŤĄźĽÉ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ź¤˘¤ę¤Ţ¤šĄĘĽÉĽĂĽČĽŻĽíĽĂ
+ ĽŻ¤Č¤Ď˛čĚ̤أąÉĂ´Ö¤ËĹŔ¤ňÉ˝ź¨¤Ç¤­¤ëÁíżô¤Ç¤šĄËĄŁ¤ł¤ÎžđĘó¤ŹĚľ¤¤žěšç¤ĎĄ˘X
+ ĽľĄźĽĐĄź¤Ź¤˝¤ě¤ňźč¤Ă¤Ć¤­¤Ţ¤šĄŁX ¤ŹĽâĽËĽżĄź¤ň¸Ç¤á¤Ć¤ˇ¤Ţ¤Ă¤żžěšç¤Ç¤âĄ˘ĽŻ
+ ĽíĽĂĽŻ¤Č¤˝¤Îž¤ÎžđĘó¤ňɸ˝ŕ˝ĐÎϤËĹǤ­˝Đ¤ˇ¤Ţ¤šĄŁ¤ł¤ÎžđĘó¤ňĽŐĽĄĽ¤Ľë¤ËĽęĽŔ
+ Ľ¤ĽěĽŻĽČ¤ˇ¤żžěšçĄ˘ĽłĽóĽ˝ĄźĽë¤ŘĚá¤Ă¤ĆşĆΊ¤Ážĺ¤˛¤ˇ¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤Ż¤Ę¤Ă¤Ć
+ ¤âĽŐĽĄĽ¤Ľë¤ËĘݸ¤ľ¤ě¤Ţ¤šĄŁ
+
+ SGCS X ¤ňťČ¤Ă¤Ć¤¤¤ëžěšç¤ĎĄ˘źĄ¤ÎÎă¤Î¤č¤Ś¤ĘšÔ¤ňĽíĄźĽŤĽëĽĐĽšŔÜÂł¤Î S3 Ľ˘
+ ĽŔĽ×Ľż¤Î Swan ¤Ť¤éźý˝¸¤ˇ¤Ţ¤šĄŁXFree86 ¤Ď¤Á¤ç¤Ă¤ČĆń¤ˇ¤¤ĘŁżôšÔ¤Ë¤ď¤ż¤ë˝ń
+ ź°¤ňťČ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ WGA: 86C911 (mem: 1024k clocks: 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71)
+ --- ------ ----- --------------------------------------------
+ | | | Ć°şî˛ÄÇ˝¤ĘźţÇČżô¤ň MHz ¤ÇÉ˝¤ď¤ˇ¤Ţ¤šĄŁ
+ | | +-- ĽÜĄźĽÉžĺ¤ÎĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽáĽâĽę¤ÎÂ礭¤ľ
+ | +-- ĽÁĽĂĽ×¤Îˇżź°
+ +-- ĽľĄźĽĐĄź¤ÎźďÎŕ
+
+ Ăí°Ő: ¤Ę¤ë¤Ů¤Ż¤ł¤ÎşîśČ¤ĎĽŢĽˇĽó¤ÎÉé˛Ů¤ŹÄ㤤ťţ¤ËšÔ¤Ę¤Ă¤Ć˛ź¤ľ¤¤ĄŁX ¤ĎĽ˘Ľ×
+ ĽęĽąĄźĽˇĽçĽó¤Ç¤š¤Ť¤éĄ˘ĽÇĽŁĽšĽŻ¤ÎĆ°şî¤Čťţ´ÖÄ´Ŕá¤ÎĽëĄźĽ×¤Źž×Ćͤš¤ë¤ČĄ˘žĺ
+ ľ­¤Îżôťú¤ĎÉÔŔľłÎ¤Ë¤Ę¤ę¤Ţ¤šĄŁ˛ż˛ó¤ŤˇŤ¤ęĘÖ¤ˇźÂšÔ¤ˇĄ˘żôťú¤ŹÂ礭¤ŻĘŃĆ°¤ˇ¤Ę
+ ¤¤¤ł¤Č¤ňłÎ¤Ť¤á¤Ć˛ź¤ľ¤¤ĄŁ¤â¤ˇĘŃĆ°¤ŹÂ礭¤¤žěšç¤Ë¤ĎĄ˘°ÂÄꤚ¤ë¤Ţ¤ÇĽ×ĽíĽťĽš
+ ¤ňťŚ¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁSVr4ĄĘĽˇĽšĽĆĽŕ V ĽęĽęĄźĽš 4ĄË ¤ňťČÍѤˇ¤Ć¤¤¤ëżÍ
+ ¤Ř: mousemgrĄĘĽŢĽŚĽšĽŢĽÍĄźĽ¸ĽăĄźĄËĽ×ĽíĽťĽš¤ĎĆä˺ŽÍđ¤Î¸ľ¤Ç¤šĄŁ
+
+ ¤ł¤Î¤č¤Ś¤ĘÉÔŔľłÎ¤ľ¤ňČň¤ą¤ë¤ż¤áĄ˘ĆŔ¤é¤ě¤żĽŻĽíĽĂĽŻ¤Îżôťú¤ň¤˝¤Î¤Ţ¤Ţ
+ Clocks Ľ×ĽíĽŃĽĆĽŁ¤ÎĂͤȤˇ¤Ć Xconfig ¤Ëźč¤ęšţ¤ó¤Ç˛ź¤ľ¤¤ĄŁ¤ł¤ě¤Ďťţ´ÖÄ´Ŕá
+ ¤ÎĽëĄźĽ×¤ňÍޝߤˇĄ˘X ¤Źťî¤ˇ¤Ć¤ß¤ë¤ł¤Č¤Î¤Ç¤­¤ëĽŻĽíĽĂĽŻ¤ÎĂͤÎŔľłÎ¤Ę°ěÍ÷¤ň
+ Íż¤¨¤ë¤ż¤á¤Ç¤šĄŁžĺľ­¤ÎÎă¤ÎĽÇĄźĽż¤ňťČ¤Ś¤ČĄ˘źĄ¤Î¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ wga
+ Clocks 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71
+
+ šâ¤ŻĘѤď¤ę¤ä¤š¤¤Éé˛Ů¤ŹłÝ¤Ť¤Ă¤żĽˇĽšĽĆĽŕ¤Ç¤ĎĄ˘¤ł¤ÎĘýËĄ¤Ď X ¤ÎľŻĆ°ťţ¤Ë´Ů
+ ¤ë¤ł¤Č¤Ź¤˘¤ëÉԝ׾ĤʟşÇÔ¤ň˛óČň¤š¤ë˝ő¤ą¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁX ¤ŹľŻĆ°¤ˇ¤żťţĽˇ
+ ĽšĽĆĽŕ¤ÎÉé˛Ů¤Î¤ť¤¤¤Ç´Ö°ă¤Ă¤żĂͤňĆŔ¤Ć¤ˇ¤Ţ¤¤Ą˘config ĽÇĄźĽżĽŮĄźĽš¤Ť¤éĂú
+ Ĺ٤¤¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ň¸Ť¤Ä¤ą¤ë¤ł¤Č¤Ź˝ĐÍč¤Ę¤Ť¤Ă¤ż¤ęĄ˘´Ö°ă¤Ă¤ż¤â¤Î¤ň¸Ť¤Ä
+ ¤ą¤Ć¤ˇ¤Ţ¤Ś¤ł¤Č¤Ź¤˘¤ęĆŔ¤ë¤Î¤Ç¤šĄŁ
+
+ The monitor's video bandwidth:
+
+ ĽâĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý :
+
+ ĽâĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý¤ňĂÎ¤Ă¤Ć¤Ş¤Ż¤ł¤Č¤ĎĄ˘ťČÍѤǤ­¤ëşÇ¤âšâ¤¤ĽÉĽĂĽČ
+ ĽŻĽíĽĂĽŻ¤Î¤Ş¤Ş¤č¤˝¤ÎĂͤňĂΤë¤Î¤ËÍ­ÍѤǤšĄŁ¤ˇ¤Ť¤ˇĄ˘¤ł¤ÎĂͤϽŔĆđŔ­¤ËÉ٤ó
+ ¤Ç¤¤¤Ţ¤šĄŁÎ㤨¤ĐĄ˘ĚžĚÜžĺ¤ÎÂÓ°čÉý¤Î 30% Áý¤ˇ¤ÇĆ°şî¤Ç¤­¤ëĽâĽËĽżĄź¤â¤˘¤ę
+ ¤Ţ¤šĄŁ
+
+ ÂÓ°čÉý¤ňĂΤ뤳¤Č¤Ď˛ÄÇ˝¤Ęš˝ŔŽÄęľÁ¤Ť¤é¤č¤ę¸­¤¤ÁŞÂň¤Ź¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ¤˘¤Ę¤ż¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎÉ˝ź¨ÉĘźÁĄĘĆä˚âŔşşŮ¤Î¤ż¤á¤ÎĽˇĽăĄźĽ×¤ľĄË¤ËąĆ
+ śÁ¤ňľÚ¤Ü¤ˇ¤Ţ¤šĄŁ
+
+ ĽâĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý¤ĎĽŢĽËĽĺĽ˘Ľë¤ÎťĹÍͤÎĘǤ˺ܤäƤ¤¤Ţ¤šĄŁĚľ¤Ť¤Ă
+ ¤żžěšç¤ĎĄ˘ĽâĽËĽżĄź¤ÎşÇ¤âšâ¤¤˛ňÁüĹ٤ΤȤł¤í¤ň¸Ť¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˛ňÁüĹ٤Ť¤éÂÓ
+ °čÉýĄĘ¤Ä¤Ţ¤ęťČÍѤǤ­¤ëĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÎÂç¤Ţ¤Ť¤Ęžĺ¸ÂĂͥˤňżäÄꤚ¤ë¤ż¤á¤Î
+ ˇĐ¸łÂ§¤ň˛ź¤Ëź¨¤ˇ¤Ţ¤šĄŁ
+
+ 640x480 25
+ 800x600 36
+ 1024x768 65
+ 1024x768 interlaced 45
+ 1280x1024 110
+
+ ¤Č¤ł¤í¤ÇĄ˘¤ł¤ÎÉ˝¤ĎŔäÂĐĹŞ¤Ę¤â¤Î¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ł¤ě¤é¤Îżôťú¤Ďɸ˝ŕĹŞ¤Ę
+ XFree86 ĽâĄźĽÉĽÇĄźĽżĽŮĄźĽš¤Ç¤Î˛ňÁüĹŮËč¤ÎşÇ¤âÄ㤤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤šĄŁĽâ
+ ĽËĽżĄź¤ÎÂÓ°čÉý¤Ď°ěČÖžĺ¤Î˛ňÁüĹ٤ËÍ׾᤾¤ě¤ëşÇžŽ¤ÎÂÓ°čÉý¤č¤ęšâ¤¤¤Ç¤ˇ¤ç¤Ś
+ ¤Ť¤éĄ˘ś˛¤ě¤ş¤ËĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňżô MHz šâ¤á¤Ëťî¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤Ţ¤żĄ˘ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ź 65MHz °Ě¤č¤ęÄ㤤žěšç¤Ë¤ĎÂÓ°čÉý¤Ď¤Ű¤Č¤ó¤ÉĚäÂę¤Ë
+ ¤Ę¤é¤Ę¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁSVGA ¤ä¤Ű¤Č¤ó¤É¤Îšâ˛ňÁüĹ٤μâĽËĽżĄź¤Ç
+ ¤ĎĄ˘¤ł¤ě¤ĎĽâĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý¤Î¸ÂłŚ¤č¤ę¤â¤Ď¤ë¤Ť¤ËÄ㤤źţÇČżô¤Ç¤š
+ ¤Ť¤éĄŁźĄ¤ËÎă¤ňź¨¤ˇ¤Ţ¤šĄŁ:
+
+ ĽÖĽéĽóĽÉĚž ĽÓĽÇĽŞżŽšćÂÓ°čÉý
+ ---------- ----------------
+ NEC 4D 75Mhz
+ Nano 907a 50Mhz
+ Nano 9080i 60Mhz
+ Mitsubishi HL6615 110Mhz
+ Mitsubishi Diamond Scan 100Mhz
+ IDEK MF-5117 65Mhz
+ IOCOMM Thinksync-17 CM-7126 136Mhz
+ HP D1188A 100Mhz
+ Philips SC-17AS 110Mhz
+ Swan SW617 85Mhz
+
+ °ěČÖ˛ź¤ÎĽŻĽéĽš¤ÎĽâĽËĽżĄź¤Ç¤âĄ˘˛ňÁüĹ٤˴ؤˇ¤ĆČóžď¤ËĽÓĽÇĽŞżŽšćÂÓ°čÉý¤ËŔŠ
+ Ěó¤ňźő¤ą¤ë¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁNEC ĽŢĽëĽÁĽˇĽóĽŻ II ¤ŹÎɤ¤Îă¤Ç¤šĄĘťĹÍͤˤč
+ ¤ě¤Đ 800x600¤ĎÉ˝ź¨˝ĐÍč¤Ę¤¤ĄËĄŁ¤˝¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤Ď 800x560 ¤Î¤ßÉ˝ź¨¤Ç¤­
+ ¤Ţ¤šĄŁ¤ł¤Î¤č¤Ś¤ĘÄă˛ňÁüĹ٤Ξěšç¤ĎĄ˘šâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤äÂ礭¤ĘĽÓĽÇĽŞżŽšć
+ ÂÓ°čÉý¤ňÉŹÍפȤˇ¤Ę¤ŻĄ˘ÂżĘŹ 32Mhz ¤Ť 36Mhz ¤Ç˝˝ĘŹ¤ÇĄ˘ÎžĘý¤ÎźţÇČżô¤Č¤âĽâ
+ ĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý¤Ç¤˘¤ë30Mhz ¤Ť¤é¤˝¤ěÄř¤Ť¤ąÎĽ¤ě¤żĂͤǤϤ˘¤ę¤Ţ¤ť
+ ¤óĄŁ
+
+ ¤ł¤ě¤é 2 ¤Ä¤ÎĆ°şîźţÇČżô¤Ç¤ĎĄ˘ĽÇĽŁĽšĽ×ĽěĽ¤¤Îťý¤Ă¤Ć¤¤¤ëŔ­Ç˝¤č¤ę¤Ż¤Ă¤­¤ę
+ ¤ČÉ˝ź¨¤ˇ¤Ę¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤ó¤ŹĄ˘¤Ç¤â¤Ť¤Ę¤ę¤ÎÉĘźÁ¤Ŕ¤Č¸Ŕ¤¤ŔڤäƤ⤤¤¤¤Ç
+ ¤ˇ¤ç¤ŚĄŁĚŢĎŔĄ˘NEC ĽŢĽëĽÁĽˇĽóĽŻ II ¤Ź¤â¤Ă¤Čšâ¤¤Ą˘Î㤨¤Đ 36MHz ĽÓĽÇĽŞżŽ
+ šćÂÓ°čÉý¤ňťý¤Ă¤Ć¤¤¤ë¤ËąŰ¤ˇ¤ż¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ˇ¤Ť¤ˇĄ˘Â礭¤Ż˛čÁü¤ŹĎĤŕ
+ ÄřźţÇČżô¤Ź¤Ť¤ąÎĽ¤ě¤Ć¤¤¤Ę¤ą¤ě¤ĐĄ˘Ę¸žĎ¤ňĘÔ˝¸¤š¤ëĹů¤Î°ěČĚĹŞ¤ĘşîśČ¤Ë¤ĎĚäÂę
+ ¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁĄĘ¤â¤ˇ˛čÁü¤ÎĎĤߤŹ¤˘¤Ţ¤ę¤Ë¤âÂ礭¤¤žěšç¤Ë¤ĎĄ˘ĚܤǸŤ¤Ć¤š¤°
+ ¤ď¤Ť¤ë¤Ç¤ˇ¤ç¤ŚĄËĄŁ
+
+ ¤É¤Ś¤ä¤Ă¤ĆŔŠ¸ć¤š¤ë¤Ť :
+
+ ĽâĽËĽżĄź¤ÎĆą´üżŽšćÂÓ°čÉý¤ĎĄ˘ĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ČśŚ¤ËĄ˘É˝ź¨
+ ¤Ç¤­¤ëşÇšâ¤Î˛ňÁüĹ٤ňˇčÄꤡ¤Ţ¤šĄŁ¤ˇ¤Ť¤ˇĽĎĄźĽÉĽŚĽ§Ľ˘¤ÎŔ­Ç˝¤ň°ú¤­˝Đ¤š¤Î¤Ď
+ ĽÉĽéĽ¤ĽĐĄź¤Ç¤šĄŁ¤É¤ó¤Ę¤ËÍĽ¤ě¤żĽÓĽÇĽŞĽ˘ĽŔĽ×Ľż¤äĽâĽËĽżĄź¤Ç¤âĄ˘Îɤ¤ĽÇĽĐĽ¤
+ ĽšĽÉĽéĽ¤ĽĐĄź¤Ź¤Ę¤ą¤ě¤ĐĘő¤Îťý¤ÁÉĺ¤ě¤Ë¤Ę¤Ă¤Ć¤ˇ¤Ţ¤¤¤Ţ¤šĄŁ°ěĘýĄ˘Í­Ç˝¤Ç¤Ę¤¤
+ ĽĎĄźĽÉ¤Ç¤âÂżĚÜĹŞ¤ËťČÍѤǤ­¤ëĽÇĽĐĽ¤ĽšĽÉĽéĽ¤ĽĐ¤Ź¤˘¤ě¤Đ˝˝ĘŹĚň¤ËΊ¤Á¤Ţ¤šĄŁ
+ ¤ł¤ě¤Ź XFree86 ¤ÎŔߡ×ĹŻłŘ¤Ç¤šĄŁ
+
+ 4. ´đËÜťĹÍͤÎĆɤßĘý
+
+ ¤ł¤ÎŔá¤Ç¤ĎťĹÍͤŹ˛ż¤ň°ŐĚŁ¤š¤ë¤Ť¤ČĄ˘¤˝¤ÎžĂΤé¤Ę¤ą¤ě¤Đ¤Ę¤é¤Ę¤¤¤ł¤Č¤ňŔâĚŔ
+ ¤ˇ¤Ţ¤šĄŁŔ褺şÇ˝é¤ËĄ˘ÄęľÁ¤ň¤ˇ¤Ţ¤šĄŁźĄ¤Ëˇ×ťť¤ň¤š¤ëťţ¤ËťČ¤ŚĘŃżôĚž¤ňłç¸ĚĆâ
+ ¤Çź¨¤ˇ¤Ţ¤šĄŁ [ĚőĂíĄ§¤ł¤ÎÄęľÁ¤Ŕ¤ą¤ĎÂĐĚőÉ÷¤Ë¤ˇ¤Ţ¤šĄŁ]
+
+ horizontal sync frequency (HSF)
+ Horizontal scans per second (see above).
+
+ żĺʿƹ´üźţÇČżô (HSF)
+ ËčÉäοĺĘżÁöşşżôĄĘžĺľ­ť˛žČĄËĄŁ
+
+ vertical sync frequency (VSF)
+ Vertical scans per second (see above). Mainly important as the
+ upper limit on your refresh rate.
+
+ żâĞƹ´üźţÇČżô (VSF)
+ ËčÉäοâÄžÁöşşżôĄĘžĺľ­ť˛žČĄËĄŁźç¤ËşĆÉÁ˛čÂŽĹ٤Ξĺ¸Â¤Č¤ˇ¤Ć˝ĹÍץŁ
+
+ dot clock (DCF)
+ More formally, `driving clock frequency'; sometimes loosely
+ called `bandwidth'. The frequency of the crystal or VCO on your
+ adaptor --- the maximum dots-per-second it can emit.
+
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ (DCF)
+ ¤č¤ęŔľź°¤Ë¤ĎĄ˘`śîĆ°ĽŻĽíĽĂĽŻźţÇČżô'; ťţĄšĹŹĹö¤Ë`ÂÓ°čÉý'¤Č¸Ć¤ÖĄŁĽ˘
+ ĽŔĽ×Ľż¤ÎČŻżŽťŇ¤Ţ¤ż¤Ď VCO ¤ÎźţÇČżô --- ËčÉĂÉÁ˛č˛ÄÇ˝ĽÉĽĂĽČżô¤ÎşÇ
+ Â祣
+
+ video bandwidth (VB)
+ The highest frequency at which your monitor's video signal can
+ change. This constrains the highest dot clock you can use and
+ the overall sharpness of fine details in the video image.
+
+ ĽÓĽÇĽŞżŽšćÂÓ°čÉý (VB)
+ ĽâĽËĽżĄź¤ÎĽÓĽÇĽŞżŽšć¤ŹĘѲ˝¤Ç¤­¤ëşÇšâ¤ÎźţÇČżôĄŁ¤ł¤ě¤ĎşÇÂç¤ÎĽÉĽĂĽČ
+ ĽŻĽíĽĂĽŻ¤Č˛čÁüÁ´ÂΤ˞ܺŮÉ˝ź¨¤ˇ¤żťţ¤ÎĽˇĽăĄźĽ×¤ľ¤ňŔŠĚ󤡤ޤšĄŁ
+
+ frame length (HFL, VFL)
+ Horizontal frame length (HFL) is the number of dot-clock ticks
+ needed for your monitor's electron gun to scan one horizontal
+ line, *including the inactive left and right borders*. Vertical
+ frame length (VFL) is the number of scan lines in the *entire*
+ image, including the inactive top and bottom borders.
+
+ ĽŐĽěĄźĽŕÄš (HFL, VFL)
+ żĺĘżĽŐĽěĄźĽŕÄš (HFL) ¤ĎĽâĽËĽżĄź¤ÎĹŝҽƤŹŁą¤Ä¤ÎĄöťČ¤ď¤ě¤Ć¤¤¤Ę¤¤
+ ş¸ąŚ¤Îś­łŚ¤ň´Ţ¤ŕĄöżĺĘżŔţ¤ňÁöşş¤š¤ë¤Î¤ËÉŹÍפʼɼüȼŻĽíĽĂĽŻ¤ÎżôĄŁ
+ żâÄžĽŐĽěĄźĽŕÄš (VFL)¤ĎťČ¤ď¤ě¤Ć¤¤¤Ę¤¤žĺ¤Č˛ź¤Îś­łŚ¤ň´Ţ¤ŕĄö´°Á´¤ĘĄö
+ ˛čĚ̤ÎÁöşşŔţ¤Îżô¤Ç¤šĄŁ
+
+ screen refresh rate (RR)
+ The number of times per second your screen is repainted. Higher
+ frequencies are better, as they reduce flicker. 60Hz is good,
+ VESA-standard 72Hz is better. Compute it as
+
+ RR = DCF / (HFL * VFL)
+
+ ˛čĚĚşĆÉÁ˛čÂŽĹŮ (RR)
+ ËčÉäβčĚĚşĆÉÁ˛č˛óżôĄŁšâ¤¤¤Ű¤Ś¤Ź¤Á¤é¤Ä¤­¤ňÄ㸺¤ˇ¤Ţ¤šĄŁ60Hz¤ÇÎÉ
+ ¤ŻĄ˘ VESA ɸ˝ŕ¤Î 72Hz ¤ÎĘý¤Ź¤č¤ęÎɤ¤¤Ç¤ˇ¤ç¤ŚĄŁˇ×ťť¤Ď¤ł¤Î¤č¤Ś¤Ë¤ˇ
+ ¤Ţ¤šĄŁ
+
+ RR = DCF / (HFL * VFL)
+
+ Note that the product in the denominator is *not* the same as
+ the monitor's visible resolution, but typically somewhat larger.
+ We'll get to the details of this below. ĘŹĘě¤Ë¤˘¤ëŔѤϼâĽËĽżĄź
+ ¤ËÉ˝ź¨¤ľ¤ě¤ë˛ňÁüĹ٤Ǥϥö¤Ę¤ŻĄöĄ˘´ö¤é¤ŤÂ礭¤¤¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁ¤ł¤ě¤Ë¤Ä¤¤¤Ć¤Ď°Ęšß¤ÇžÜşŮ¤ËŔâĚŔ¤ˇ¤Ţ¤šĄŁ
+
+ ÂÓ°čÉý¤Ë¤Ä¤¤¤Ć :
+
+ ĽâĽËĽżĄźŔ˝Â¤˛ńźŇ¤ĎÂÓ°čÉý¤Ź˛čĚ̤ÎÇ÷ÎϤȿ§ĘѲ˝¤ÎĽˇĽăĄźĽ×¤ľ¤ňŔŠĚ󤚤ë¤Î¤Ç
+ šâÂÓ°čÉý¤Ç¤˘¤ë¤ł¤Č¤ňŔëĹÁ¤ˇ¤Ţ¤šĄŁÂÓ°čÉý¤ŹÂ礭¤¤¤Ű¤ÉĄ˘¤č¤ęşŮ¤Ť¤¤˛čÁü¤ňÉ˝
+ ź¨¤š¤ë¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ
+
+ ĽâĽËĽżĄź¤ĎĹĹľ¤żŽšć¤ňÍѤ¤¤Ć˛čÁü¤ňÉ˝ź¨¤ˇ¤Ţ¤šĄŁżŽšć¤Ď°ěĂśĽÇĽ¸ĽżĽë¤Ť¤éĽ˘ĽĘ
+ ĽíĽ°¤Ř¤ČĘŃ´š¤ľ¤ě¤ë¤ČĄ˘¤Ä¤Í¤ËĽ˘ĽĘĽíĽ°ÇȡÁ¤Č¤ˇ¤Ćźč¤ę°ˇ¤ď¤ě¤Ţ¤šĄŁ¤˝¤ě¤ĎÂż
+ ¤Ż¤ÎĄ˘¸ÇÄꤡ¤żźţÇČżô¤ÎĂą˝ă¤ĘÇȡÁ¤ÎÁȚ礝¤Ç¤˘¤ë¤ČšÍ¤¨¤é¤ěĄ˘¤˝¤ě¤é¤ÎÂż¤Ż
+ ¤Ď MHz ¤ÎČϰϤÇÎ㤨¤Đ 20MHzĄ˘40MHzĄ˘¤ľ¤é¤Ë 70MHz ¤Ŕ¤Ă¤ż¤ę¤ˇ¤Ţ¤šĄŁĽâĽË
+ ĽżĄź¤ÎĽÓĽÇĽŞżŽšćÂÓ°čÉý¤ĎťöźÂžĺĎĤߤŹĚľ¤Ż°ˇ¤¨¤ëšâźţÇȤμ˘ĽĘĽíĽ°żŽšć¤Ç
+ ¤šĄŁ
+
+ ťäĂŁ¤ÎĚÜĹŞ¤Î¤ż¤á¤Ë¤ĎĄ˘ÂÓ°čÉý¤Ďźç¤ËťČÍѲÄÇ˝¤ĘĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Î¤Ş¤Ş¤č¤˝¤Î
+ žĺ¸Â¤Č¤ˇ¤Ć˝ĹÍפǤšĄŁ
+
+ Ćą´üźţÇČżô¤ČşĆÉÁ˛čÂŽĹŮ :
+
+ ˛čĚĚžĺ¤ÎżĺĘżÁöşşŔţ¤ĎĽŐĽěĄźĽŕÄšÁöşş¤ÎĂć¤ÇźÂşÝ¤ËÉ˝ź¨¤ľ¤ě¤ëÉôĘŹ¤Ç¤šĄŁ¤˝¤ě
+ ¤ž¤ě¤Î˝Ö´Ö¤Ë¤ĎËÜĹö¤Ď¤ż¤Ă¤ż°ě¤Ä¤ÎĹŔ¤Ź˛čĚ̤˾ą¤¤¤Ć¤¤¤ë¤Î¤Ç¤š¤ŹĄ˘şĆÉÁ˛čÂŽ
+ Ĺ٤Ź˝˝ĘŹÂŽ¤¤¤Î¤ÇĚܤˤĎŔ䤨´ÖĚľ¤ŻÁ´¤Ć¤Î˛čÁü¤Ź"¸Ť¤¨¤ë"¤Č¤¤¤ŚĚő¤Ç¤šĄŁ
+
+ ¤ł¤ł¤Ç¤¤¤Ż¤Ä¤Ť¤Îł¨¤Ç˛ňŔ⤡¤Ţ¤š :
+
+ _______________________
+ | | żĺĘżĽŐĽěĄźĽŕÄš¤ĎĹŝҼӥźĽŕ
+ |->->->->->->->->->->-> | ¤Ź¤ł¤Î¤č¤Ś¤ĘĽŃĽżĄźĽó¤ňÉÁ¤Ż
+ | )| ťţ´Ö¤ňĽÉĽĂĽČĽŻĽíĽĂĽŻĂą°Ě¤Ç
+ |<-----<-----<-----<--- | É˝¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+ | |
+ | |
+ | |
+ | |
+ |_______________________|
+
+ _______________________
+ | ^ | żâÄžĽŐĽěĄźĽŕÄš¤ĎĹŝҼӥźĽŕ
+ | ^ | | ¤Ź¤ł¤Î¤č¤Ś¤ĘĽŃĽżĄźĽó¤ňÉÁ¤Ż
+ | | v | ťţ´Ö¤ňĽÉĽĂĽČĽŻĽíĽĂĽŻĂą°Ě¤Ç
+ | ^ | | É˝¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+ | | | |
+ | ^ | |
+ | | v |
+ | ^ | |
+ |_______|_v_____________|
+
+ źÂşÝ¤ÎĽéĽšĽżĄźÁöşş¤Ď¤Č¤Ć¤âşŮ¤Ť¤¤Ľ¸Ľ°ĽśĽ°ˇż¤ÎĽŃĽżĄźĽó¤ň¤ˇ¤Ć¤¤¤ĆĄ˘ş¸ąŚ¤Ë
+ ĹŝҼӥźĽŕ¤ŹĆ°¤¤¤ĆĆąťţ¤Ëžĺ˛ź¤Ë¤âĆ°¤¤¤Ć¤¤¤Ţ¤šĄŁ
+
+ ¤ľ¤ĆĄ˘ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ČĽŐĽěĄźĽŕ¤ÎÂ礭¤ľ¤ĎşĆÉÁ˛čÂŽĹ٤˴ء¸¤Ź¤˘¤ë¤Č¤¤¤Ś¤ł
+ ¤Č¤ŹĘŹ¤Ť¤ę¤Ţ¤šĄŁÄęľÁžĺĄ˘ŁąĽŘĽëĽÄ (hz) ¤ĎŁąÉäˣąźţ´ü¤Ç¤šĄŁ¤˝¤ě¤Ť¤éĄ˘żĺ
+ ĘżĽŐĽěĄźĽŕÄš¤ň HFL ¤Č¤ˇżâÄžĽŐĽěĄźĽŕÄš¤ň VFL ¤Č¤ˇ¤żžěšç¤ËÁ´¤Ć¤Î˛čĚ̤ňʤ
+ ¤Ś¤Ë¤Ď (HFL * VFL) ˛óĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ŹÉŹÍפǤšĄŁĽŤĄźĽÉ¤ĎÄęľÁ¤Ť¤éËčÉĂ
+ DCF ˛óżŽšć¤ň˝Đ¤ˇ¤Ć¤¤¤Ţ¤š¤Î¤ÇĄ˘ĚŔ¤é¤Ť¤ËĽâĽËĽżĄź¤ÎĹŝҽƤϺ¸¤Ť¤éąŚĄ˘Ěá¤Ă
+ ¤ĆĄ˘˛ź¤Ť¤éžĺ¤ŘĄ˘Ěá¤Ă¤Ć¤ňËčÉĂ DCF / (HFL * VFL) ˛óĄ˘˛čĚĚžĺ¤ňĆ°¤­˛ó¤ě¤ë
+ Ěő¤Ç¤šĄŁ¤ł¤ě¤ĎËčÉòż˛ó˛čĚ̤ňÉÁ¤­Äž¤ˇ¤Ć¤¤¤ë¤Ť¤ňÉ˝¤ď¤ˇ¤Ć¤¤¤ë¤Î¤ÇĄ˘˛čĚ̤Î
+ şĆÉÁ˛čÂŽĹ٤ʤΤǤšĄŁ
+
+ ˛ňÁüĹ٤ȤÁ¤é¤Ä¤­¤Î´Řˇ¸¤ŹĽČĽěĄźĽÉĽŞĽŐ¤Î´Řˇ¸¤Ë¤˘¤ë¤Î¤ÇĄ˘źŤĘŹ¤ÎÍ׾á¤Ëąţ¤¸
+ ¤ĆŔßÄę¤ňšÔ¤Ę¤Ś¤ż¤á¤Ë¤ł¤ÎłľÇ°¤ňÍý˛ň¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ 5. ĽˇĽšĽĆĽŕ¤Îš˝ŔŽ¤Ë¤Ş¤ą¤ëĽČĽěĄźĽÉĽŞĽŐ
+
+ Á°¤Ëź¨¤ˇ¤ż¸řź°¤ĎĄ˘¤ł¤Î¤č¤Ś¤ËĘѡÁ¤Ç¤­¤Ţ¤šĄŁ
+
+ DCF = RR * HFL * VFL
+
+ ¤Ä¤Ţ¤ęĄ˘ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ź°ěÄę¤Ŕ¤Č¤š¤ë¤ČĄ˘°ěÉô֤ˤł¤ě¤Ŕ¤ą¤ÎĽÉĽĂĽČżô¤ňşĆ
+ ÉÁ˛čÂŽĹŮĄ˘żĺĘż˛ňÁüĹ٤ޤż¤ĎżâÄž˛ňÁüĹ٤˿ś¤ęĘŹ¤ą¤ë¤ł¤Č¤Ź¤Ç¤­¤ë¤Č¤¤¤Ś¤ł¤Č
+ ¤Ç¤šĄŁ¤ł¤ě¤é¤Îżôťú¤Î°ě¤Ä¤ňÁý¤ä¤š¤Čž¤Îżôťú¤ň¸ş¤é¤ľ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŁ
+
+ ¤ˇ¤Ť¤ˇĄ˘şĆÉÁ˛čÂŽĹ٤ϼâĽËĽżĄź¤ÎşÇÂçżâĞƹ´üźţÇČżô¤ňÄś¤¨¤ë¤ł¤Č¤Ď˝ĐÍč¤Ţ¤ť
+ ¤ó¤Î¤ÇĄ˘Ăí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˝ž¤Ă¤ĆÍż¤¨¤é¤ě¤żĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ÇÍż¤¨¤é¤ě¤żĽâ
+ ĽËĽżĄź¤Ç¤ĎĄ˘źŤĘŹ¤ÇśŻŔŠ˝ĐÍč¤Ę¤¤ĽŐĽěĄźĽŕÄš¤ÎŔѤκǞŽ°Ę˛ź¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ źŤĘŹ¤ÎŔßÄę¤ňÁŞ¤Öťţ¤ËĄ˘RR ¤ŹÄ㤚¤Ž¤ëžěšçĄ˘˛čĚ̤ΤÁ¤é¤Ä¤­¤Ç´é¤ň¤ˇ¤Ť¤á¤ë
+ ¤ł¤Č¤ňłĐ¤¨¤Ć¤Ż¤Ŕ¤ľ¤¤
+
+ ¿ʏĄ˘şĆÉÁ˛čÂŽĹ٤ň 60Hz °Ę˛ź¤Ë˛ź¤˛¤ż¤Ż¤ĎĚľ¤¤¤Ç¤ˇ¤ç¤ŚĄŁˇÖ¸÷Ĺő¤Î¤Á¤é¤Ä¤Ż
+ ÂŽ¤ľ¤Ç¤š¤Î¤ÇĄ˘¤Á¤é¤Ä¤­¤ËÉŇ´ś¤Ęžěšç¤Ď VESA żÍ´ÖšŠłŘɸ˝ŕ¤Î 72MHz ¤ËĘݤÄ
+ ÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ ¤Á¤é¤Ä¤­¤ĎÂçĘŃĚܤ˿ɤ¤¤â¤Î¤Ç¤š¤ŹĄ˘¤ˇ¤Ť¤ˇżÍ´Ö¤ÎĚܤĎĹŹąţ¤ˇżÍĄš¤Î¤Á¤é¤Ä¤­
+ ¤ËÂФš¤ëÂŃŔ­¤Ď¤Ť¤Ę¤ęš­ČϰϤǤšĄŁ˛čĚ̤Π90% ¤Ź¸Ť¤¨¤ëłŃĹ٤ǼâĽËĽżĄź¤Ë¸ţ
+ ¤­šç¤Ă¤Ć¤¤¤ëžěšç¤ËĄ˘°Ĺ¤¤ÇءʤČÎɤ¤ĽłĽóĽČĽéĽšĽČ¤Îż§¤ňÁ°ˇĘ¤ËťČ¤¤Ą˘ľąĹ٤ň
+ Ä㤍¤éĂć¤ËÄ´Ŕ°¤š¤ë¤Ę¤é¤ĐĄ˘Ąö¤ż¤Ö¤óĄö 45Hz °Ě¤ËžŽ¤ľ¤Ż¤Ć¤â˛÷ĹŹ¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ¸ˇĚŠ¤ĘĽĆĽšĽČ¤Î¤ä¤ęĘý¤ĎźĄ¤ÎÄ̤ę¤Ç¤š : xterm -bg white -fg black ¤Çżż¤Ă
+ Çň¤ĘÇءʤ˚ő¤ÎÁ°ˇĘ¤Î xterm ¤ňłŤ¤¤¤ĆĄ˘É˝ź¨˛ÄÇ˝¤ĘÎΰčÁ´¤Ć¤ňąŁ¤š¤°¤é¤¤¤Î
+ Â礭¤ľ¤Ë¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤˝¤ˇ¤ĆĽâĽËĽżĄź¤ÎĚŔ¤Ť¤ë¤ľ¤ňşÇÂç¤ÎŔßÄęĂͤΠ3/4 ¤ËŔß
+ Äꤡ¤ĆĄ˘ĽâĽËĽżĄź¤Ť¤é´é¤ň¤˝¤ŕ¤ą¤ĆĄ˘ĽâĽËĽżĄź¤ň˛ŁĚܤÇÇÁ¤¤¤Ć¤ß¤Ć˛ź¤ľ¤¤ĄĘ¤ł
+ ¤ě¤ĎĄ˘¤č¤ęÉŇ´ś¤ĘťëĚîźţĘŐÉô¤ÎşŮËŚ¤ňĆŻ¤Ť¤ť¤ë¤ż¤á¤Ç¤šĄËĄŁ¤Ę¤ó¤Ë¤â¤Á¤é¤Ä¤­
+ ¤ň´ś¤¸¤Ę¤¤žěšçźă¤ˇ¤Ż¤Ďľö¤ť¤ëČϰϤʤé¤ĐĄ˘¤˘¤Ę¤ż¤Ë¤Č¤Ă¤Ć¤˝¤ÎşĆÉÁ˛čÂŽĹ٤Ď
+ ĂúĹŮÎɤ¤¤Î¤Ç¤šĄŁ¤â¤ˇ¤˝¤Ś¤Ç¤Ę¤Ť¤Ă¤ż¤éĄ˘°ě¸ŤÂçžćÉפʤ褌¤Ë¸Ť¤¨¤Ć¤âĄ˘ĚŔ¤é
+ ¤Ť¤Ë¤ĎČ˝¤Ť¤é¤Ę¤¤¤č¤Ś¤Ę¤Á¤é¤Ä¤­¤Ë¤č¤Ă¤Ć¤Ň¤É¤ŻĚܤŹČčĎŤ¤ˇĆŹÄˤňľŻ¤ł¤ˇ¤Ţ¤š
+ ¤Î¤ÇĄ˘ÉáÄ̤˸Ť¤¨¤ëÍͤˤʤëËřĄ˘¤č¤ęšâ¤¤şĆÉÁ˛čÂŽĹ٤ËÄ´Ŕ°¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ¤ł¤Î¤č¤Ś¤Ë¤ˇ¤ĆşÇžŽ¤ÎľöÍƤǤ­¤ëşĆÉÁ˛čÂŽĹ٤ňÁޤ֤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁHFL ¤Č
+ VFL ¤ňÁŞÂň¤š¤ë¤ż¤á¤Ë¤ĎĄ˘ÂżžŻ¤ÎşîŔď¤ÎÍžĂϤŹ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 6. Í׾áĽáĽâĽęÎĚ
+
+ źŤĘŹ¤ŹźÂ¸˝¤ˇ¤č¤Ś¤Č¤ˇ¤Ć¤¤¤ëĽŤĽéĄź¤äĽ°ĽěĄźĽšĽąĄźĽëĽÇĽŁĽšĽ×ĽěĽ¤¤Î˛ňÁüĹ٤Ď
+ ťČÍѲÄÇ˝¤ĘĽŐĽěĄźĽŕĽĐĽĂĽŐĽĄĽáĽâĽę¤ÎÎ̤ÇŔŠ¸Â¤ľ¤ě¤Ţ¤šĄŁ2 ż§ĄĘÇňšőĄË¤ÇĽ°Ľě
+ ĄźĽšĽąĄźĽë¤Ç¤Ę¤¤ĘŞ¤Îžěšç¤ĎĄ˘ŔŠ¸Â¤ňźő¤ą¤ë¤ł¤Č¤Ď¿ʏ¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 256 ż§¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤Îžěšç¤ĎĄ˘ĽÓĽÇĽŞĽáĽâĽę¤ÎĽĐĽ¤ĽČżô¤ĎÉ˝ź¨¤ľ¤ě¤ëĽÉĽĂĽČ
+ ¤Îżô¤Ŕ¤ąÉŹÍפǤšĄŁ¤ł¤ÎĽĐĽ¤ĽČżô¤ĎŔÖÎĐŔĤŤ¤éŔŽ¤ë˝¸šç¤ÎĹŔ¤ňŁąĹŔ¤Č¤ˇ¤żżô¤Ç
+ ¤šĄŁÉŹÍפʼáĽâĽęÎ̤ňĆŔ¤ë¤Ë¤ĎĄ˘ŔţŁąËÜĹö¤ż¤ę¤ËÉ˝ź¨¤ľ¤ě¤ëĹŔ¤Îżô¤ËÉ˝ź¨¤ľ¤ě
+ ¤ëŔţ¤Îżô¤ňłÝ¤ą¤Ć˛ź¤ľ¤¤ĄŁ800x600 ¤Î˛ňÁüĹ٤ňťý¤ÄĽÇĽŁĽšĽ×ĽěĽ¤¤Îžěšç¤ĎĄ˘
+ ĽÇĽŁĽšĽ×ĽěĽ¤¤ËÉ˝ź¨¤š¤ëĹŔ¤Îżô¤Ď 800 x 600 = 480,000 ¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤Ţ¤żĄ˘
+ ŁąĽÉĽĂĽČ¤ŹŁąĽĐĽ¤ĽČ¤ËŔŽ¤ë¤Î¤ÇĄ˘Ľ˘ĽŔĽ×ĽżĽŤĄźĽÉ¤ËĆą¤¸ĽĐĽ¤ĽČżô¤ÎĽÓĽÇĽŞĽáĽâ
+ Ľę¤ŹÉŹÍפǤšĄŁ
+
+ ˝ž¤Ă¤ĆĄ˘ĽáĽâĽęÎ̤ϥ˘°ěČĚ¤Ë (HR * VR)/1024 ¤ňĽ­ĽíĽĐĽ¤ĽČĂą°Ě¤ËŔÚ¤ęžĺ¤˛¤ż
+ ĘŞ¤ŹÉŹÍפǤšĄŁÎă¤ňľó¤˛¤ě¤ĐĄ˘ (936 * 702)/1024 = 642K ĽĐĽ¤ĽČ¤Č¤Ę¤ę¤Ţ
+ ¤šĄŁ˝ž¤Ă¤Ć 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤Ź¤˘¤ě¤ĐĄ˘Íž¤ę¤ň˛žÁŰĽšĽŻĽęĄźĽó¤Ëłä¤ęĹö¤Ć¤Ć
+ ĽšĽŻĽíĄźĽë˝ĐÍč¤Ţ¤šĄŁ
+
+ ¤Č¤ł¤í¤ŹĄ˘ĽÜĄźĽÉ¤Ë 512K ¤ˇ¤ŤĚľ¤¤žěšç¤Ď¤ł¤Î˛ňÁüĹ٤ϝȤ¨¤Ţ¤ť¤óĄŁÎɤ¤ĽâĽË
+ ĽżĄź¤ňťý¤Ă¤Ć¤¤¤ż¤Č¤ˇ¤Ć¤âĄ˘˝˝ĘŹ¤ĘĽÓĽÇĽŞĽáĽâĽę¤ŹĚľ¤ˇ¤Ë¤ĎĽâĽËĽżĄź¤ÎŔ­Ç˝¤ň
+ łč¤Ť¤š¤ł¤Č¤Ď˝ĐÍč¤Ţ¤ť¤óĄŁ¤Ţ¤ż°ěĘý¤ÇĄ˘SVGA ĽŤĄźĽÉ¤Ź 1M ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ň
+ ťý¤Ă¤Ć¤¤¤ż¤Č¤ˇ¤Ć¤âĄ˘ĽâĽËĽżĄź¤ŹşÇšâ¤Ç 800x600 ¤ˇ¤ŤÉ˝ź¨¤Ç¤­¤Ę¤¤¤Ę¤é¤ĐĄ˘
+ ¤ł¤ě°Ęžĺ¤Îšâ˛ňÁüĹ٤ϤɤŚ¤ä¤Ă¤Ć¤âĚľÍý¤Č¤¤¤Ś¤â¤Î¤Ç¤šĄŁ
+
+ Í׾áÎ̤č¤ęÂż¤¤ĽáĽâĽę¤ňťý¤Ă¤Ć¤¤¤Ć¤âż´Çۤˇ¤Ę¤¤¤Ç˛ź¤ľ¤¤ĄŁXFree86 ¤ĎÍž¤Ă¤ż
+ ĽáĽâĽę¤ÇÉ˝ź¨Îΰč¤ňĽšĽŻĽíĄźĽë¤Ç¤­¤ë¤č¤Ś¤Ë¤ˇ¤Ţ¤šĄĘ˛žÁŰĽšĽŻĽęĄźĽó¤ÎÂ礭¤ľ
+ ¤ÎĽŃĽéĽáĄźĽż¤Ë¤Ä¤¤¤Ć¤Î Xconfig ĽŐĽĄĽ¤Ľë¤Îʸ˝ń¤ňť˛žČ¤ˇ¤Ć˛ź¤ľ¤¤ĄËĄŁ¤Ţ
+ ¤żĄ˘512K ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ňĹëşÜ¤ˇ¤żĽŤĄźĽÉ¤Ď 512,000 ĽĐĽ¤ĽČ¤Ç¤Ď¤Ę¤ŻĄ˘ËÜĹö
+ ¤Ď 512 x 1024 = 524,288 ĽĐĽ¤ĽČ¤ÎĽáĽâĽę¤ŹĹëşÜ¤ľ¤ě¤Ć¤¤¤ë¤ł¤Č¤ňłĐ¤¨¤Ć¤¤¤Ć
+ ˛ź¤ľ¤¤ĄŁ
+
+ S3 ĽŤĄźĽÉ¤Ç SGCS X ¤ŹĆ°şî¤ˇ¤Ć¤¤¤ĆĄ˘¤Ť¤Ä 16 ż§ĄĘ 1 ĽÔĽŻĽťĽëĹö¤ż¤ę 4
+ ĽÓĽĂĽČĄË¤ÎžěšçĄ˘Xconfig ĽŐĽĄĽ¤Ľë¤Ç żź¤ľ 4 ¤ČŔßÄꤚ¤ě¤ĐĄ˘ĽŤĄźĽÉ¤ĎÇܤβň
+ ÁüĹ٤ňťČ¤¨¤Ţ¤šĄŁÎ㤨¤ĐĄ˘S3 ĽŤĄźĽÉ¤ĎÄĚžď 1024x768x256 ĄĘ1024x768 ¤Î˛ňÁü
+ ĹŮ¤Ç 256 ż§ĄË¤Ç¤š¤ŹĄ˘żź¤ľ 4 ¤Ë¤š¤ě¤Đ 1280x1024x16 ĄĘ1280x1024 ¤Î˛ňÁüĹŮ
+ ¤Ç 16 ż§ĄË¤ŹťČ¤¨¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ [ĚőĂí : żź¤ľ¤Č¤Ďż§żô¤äĽ°ĽěĄźĽšĽąĄź
+ Ľë¤ňÉ˝¸˝¤š¤ëĽÓĽĂĽČżô¤Ç¤šĄŁ]
+
+ 7. ĽŐĽěĄźĽŕĽľĽ¤Ľş¤Îˇ×ťť
+
+ ˇŮšđ : ¤ł¤ÎĘýËĄ¤ĎĽŢĽëĽÁĽˇĽóĽŻĽâĽËĽżĄź¤Î¤ż¤á¤ËłŤČŻ¤ˇ¤Ţ¤ˇ¤żĄŁÂżĘŹĄ˘¤ł¤Î
+ ĘýËĄ¤Ď¸ÇÄęźţÇČżôĽâĽËĽżĄź¤Ç¤Ś¤Ţ¤ŻšÔ¤Ż¤Ť¤âĂΤě¤Ţ¤ť¤ó¤ŹĄ˘ĘݞڤǤ­¤Ţ¤ť¤óĄŁ
+
+ şÇ˝é¤ËşÇÂç¤ÎťČÍѲÄÇ˝¤Ę HSF ¤Ç DCF ¤ňłä¤Ă¤ĆĄ˘żĺĘżÁöşş˛ÄÇ˝˛óżô¤ňˇ×ťť¤ˇ¤Ć
+ ˛ź¤ľ¤¤ĄŁ
+
+ Î㤨¤ĐĄ˘ 65MHz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Î Sigma Legend SVGA ĽŤĄźĽÉ¤ČĄ˘55KHz ¤Î
+ żĺĘżÁöşşźţÇČżô¤ÎĽâĽËĽżĄź¤ňťČ¤Ă¤Ć¤¤¤ë¤Č˛žÄꤡ¤Ţ¤šĄŁDCF / HSF ¤ňˇ×ťť¤š¤ë
+ ¤Č 1181 ¤Č¤¤¤ŚÎ̤ŹĆŔ¤é¤ě¤Ţ¤šĄŁ
+
+ ¤ľ¤˘Ą˘şÇ˝é¤ÎšőËâ˝Ń¤Îľť¤ÎĘŇÎÚ¤ňťČ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤Îź°¤ÎĹú¤¨¤ň¤â¤Ă¤Č¤âśá¤¤
+ 8 ¤ÎÇÜżô¤Ë´Ý¤á¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤Ď 8 ĽÓĽĂĽČĽěĽ¸ĽšĽż¤ňťý¤ÁĄ˘ş¸¤Ë 3 ĽÓĽĂĽČ¤ş
+ ¤é¤ˇ¤Ć 11 ĽÓĽĂĽČ¤ÎĂͤňĆŔ¤ë¤č¤Ś¤Ę SVGA ¤Č S3 ¤Î VGA ŔŠ¸ćÁőĂ֤ˤޤ¤¤ĆÍ­
+ ¸ú¤Ç¤šĄŁ ATI 8514/A ¤Î¤č¤Ś¤Ęž¤ÎĽŤĄźĽÉ¤Ç¤Ď¤ł¤Î¤č¤Ś¤ĘÍ׾á¤Ď¤Ę¤¤¤Ť¤âĂΤě
+ ¤Ţ¤ť¤ó¤ŹĄ˘˛ćĄš¤ĎŔľłÎ¤ĘĂÎźą¤ňťý¤Ášç¤ď¤ť¤Ć¤Ď¤¤¤Ţ¤ť¤ó¤ˇĄ˘´Ý¤á¤Ë¤č¤Ă¤ĆÉÔĹÔ
+ šç¤Ę¤ł¤Č¤ŹŔ¸¤¸¤ë¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ˝ž¤Ă¤ĆżĺĘżÁöşş˛ÄÇ˝˛óżô¤ň 1176 ¤Ë´Ý¤á
+ ¤Ţ¤šĄŁ
+
+ ¤ł¤ÎżôťúĄĘDCF / HSF ¤ň 8 ¤ÎÇÜżô¤Ë´Ý¤á¤ż¤â¤ÎĄË¤ĎşÇžŽ¤Î HFL ¤Č¤ˇ¤ĆÍѤ¤¤ë
+ ¤ł¤Č¤Ź˝ĐÍč¤Ţ¤šĄŁ¤č¤ęÄ㤤 HSF ¤ÇĆą´üżŽšć¤ňŔßÄꤚ¤ě¤ĐĄ˘¤â¤Ă¤ČÄš¤¤ HFL
+ ĄĘ¤Ä¤Ţ¤ęĄ˘ÂżĘŹ¤č¤ęÂż¤Ż¤Î˛čĚ̤οĺĘżĘý¸ţ¤ÎĽÉĽĂĽČżôĄË¤ŹĆŔ¤é¤ě¤Ţ¤šĄŁ¤ˇ¤Ť
+ ¤ˇĄ˘Ă٤Ż¤Ć¤č¤ęÂż¤Ż¸Ť¤¨¤ë¤Á¤é¤Ä¤­¤ÎÂŽĹ٤ËÉü˝˛¤ľ¤ě¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ˇĐ¸łĹޤĘ˥§¤Ç¤ĎĄ˘żĺĘżĽŐĽěĄźĽŕÄš¤Î 80% ¤ŹżĺĘż˛ňÁüĹ٤Ȥˇ¤ĆťČÍѲÄÇ˝¤ÇĄ˘
+ żĺĘżÁöşşŔţ¤ÎÉ˝ź¨¤ľ¤ě¤ëÉôĘŹĄĘ¤ł¤ě¤ĎÂçÂÎĄ˘ś­łŚ¤ČĹŝҼӥźĽŕ¤Ź˛čĚ̤ιŚĂź¤Ť
+ ¤éźĄ¤ÎÁöşşŔţ¤Îş¸Ăź¤ŘĚá¤Ă¤Ć¤Ż¤ëťţ´Ö¤ňşš¤ˇ°ú¤¤¤ż¤â¤ÎĄË¤Ç¤šĄŁ¤ł¤ÎÎă¤Ç
+ ¤ĎĄ˘944 ¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¤ľ¤ĆĄ˘ÄĚžď¤Î˛čĚ̤μ˘ĽšĽÚĽŻĽČČćĄĘ˛Ł˝ÄČćĄË4:3 ¤ňĆŔ¤ë¤ż¤áĄ˘şŁˇ×ťť¤ˇ¤żżĺĘż
+ ˛ňÁüĹ٤Π3/4 ¤Ë¤Ę¤ë¤č¤Ś¤ËżâÄž˛ňÁüĹ٤ňŔßÄꤡ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎÎă¤Ç¤ĎĄ˘708
+ ¤Ë¤Ę¤ę¤Ţ¤šĄŁźÂşÝ¤Î VFL ¤ňĆŔ¤ë¤Ë¤ĎĄ˘1.05 ¤ňłÝ¤ą¤Ć 743 ¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¤ł¤Î 4:3 ¤Ë¤Ä¤¤¤Ć --- É˝ź¨žĺ¤ÎÉý¤Čšâ¤ľ¤Ź 4:3 ¤ÎČćΨ¤ĎÂçÂβŤśâĘŹłäČć¤Î
+ ĂÍĄ˘ (1 + sqrt(5))/2 ¤Ëśá¤¤ĂͤǤšĄŁżÍ´Ö¤Ď¤ł¤Îźď¤ÎśëˇÁ¤ň¸Ť¤ĆšĽ¤Ţ¤ˇ¤¤¤Č
+ ť×¤Ś¤č¤Ś¤Ë¤Ç¤­¤Ć¤¤¤ë¤č¤Ś¤Ç¤šĄŁ¤˝¤Î¤ż¤áĽÖĽéĽŚĽó´É¤ä 800x600, 640x480 ¤˝
+ ¤ˇ¤Ć 1024x768 ¤Č¤¤¤ŚÉ¸˝ŕĹŞ¤Ę˛ňÁüĹ٤Ϥߤʤł¤Î˛ŤśâĘŹłäČć¤Îśáť÷ĂͤˤʤäĆ
+ ¤¤¤Ţ¤šĄŁ¤ˇ¤Ť¤ˇ¤ł¤ě¤Ďż´ÍýłŘĹŞ¤ĘÍ׾á¤Ç¤˘¤Ă¤ĆĄ˘ľť˝ŃĹŞ¤ĘÍ׾á¤Ç¤Ď¤˘¤ę¤Ţ¤ť
+ ¤óĄŁ¤â¤ˇ¤˝¤ÎĘý¤Ź˛čĚ̤ÎÂ礭¤ľ¤ňÍ­¸ú¤ËłčÍѤǤ­¤ë¤Î¤Ç¤˘¤ě¤ĐĄ˘Č󲍜âĘŹłäČć
+ ¤ňťČ¤Ś¤ł¤Č¤ň¤ż¤á¤é¤ŚÍýÍł¤Ď˛ż¤â¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ˇëśÉĄ˘HFL=1176 ¤Č VFL=743 ¤Č¤ˇ¤Ţ¤ˇ¤żĄŁ65MHz ¤ň¤ł¤Î 2 ¤Ä¤Îżôťú¤ÎŔѤdzä
+ ¤ë¤ČĄ˘˝˝ĘŹ¤Ëšâ¤Ż¤ĆˇňšŻ¤ËÎɤ¤ 74.4Hz ¤ÎşĆÉÁ˛čÂŽĹ٤ŹĆŔ¤é¤ě¤Ţ¤šĄŁÁÇŔ˛¤é¤ˇ
+ ¤¤ĄŞ VESA ɸ˝ŕ¤č¤ęΊÇɤǤˇ¤ç¤ŚĄŞ ¤Ş¤Ţ¤ą¤ËĄ˘¤Ş¤˝¤é¤ŻÍ˝Áۤˇ¤Ć¤¤¤ż
+ 800x600 ¤č¤ę¤âšâ¤¤ 944x708 ¤Č¤¤¤Ś˛ňÁüĹ٤ŹĆŔ¤é¤ě¤ż¤Î¤Ç¤šĄŁËÜĹö¤ËÁÇŔ˛¤é
+ ¤ˇ¤¤ĄŞ
+
+ ¤ľ¤é¤ËĄĘÂçÂÎ 76 Hz ËřĄËşĆÉÁ˛čÂŽĹ٤ň˛ţÎɤš¤ë¤ł¤Č¤â˛ÄÇ˝¤Ç¤šĄŁ¤ł¤ě¤Ë¤ĎĄ˘
+ ÄęłĘ¤č¤ę¤â 2 KHz ¤Ż¤é¤¤šâ¤¤żĺʿƹ´üźţÇČżô¤Ç¤âĆ°¤ŻĽâĽËĽżĄź¤ŹÂż¤¤¤Č¤¤¤Ś
+ ťöźÂ¤ČĄ˘ VFL ¤ň´ö¤é¤Ť˛ź¤˛¤ëĄĘ¤Ä¤Ţ¤ęĄ˘žĺ¤ÎÎă¤Ç¸Ŕ¤Ś¤Č 944 ¤Î 75% ¤č¤ę¤â
+ žŽ¤ľ¤Ż¤š¤ëĄË¤ł¤Č¤ňÍřÍѤˇ¤Ţ¤šĄŁ¤ˇ¤Ť¤ˇ¤ł¤Î "ĽŞĄźĽĐĄźĽÉĽéĽ¤ĽÖ" şîŔď¤ňťî¤ˇ
+ ¤Ć¤ß¤ëÁ°¤ËĄ˘¤˘¤Ę¤ż¤ÎĽâĽËĽżĄź¤ÎĹŝҽƤŹżâĞƹ´ü¤ň 76 Hz °Ęžĺ¤Ç¤Ç¤­¤ë¤ł
+ ¤Č¤ňĄöłÎǧĄö¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĄĘÎ㤨¤ĐĄ˘żÍľ¤¤Î¤˘¤ë NEC 4D ¤Ç¤Ď¤ł¤ě¤Ď˝ĐÍč¤Ţ
+ ¤ť¤óĄŁ¤ł¤ě¤Ď 75 Hz Ëř¤Î VSF ¤Î¤ß¤ŹÍřÍѤǤ­¤Ţ¤šĄŁĄË
+
+ °Ęžĺ¤ŹĄ˘ĽéĽšĽżĄźÉ˝ź¨¤Ë¤Ä¤¤¤Ć¤ÎĂą˝ă¤Ęˇ×ťť¤Č´đËÜĹŞ¤ĘťöĘÁ¤Î¤Ű¤Č¤ó¤É¤Ç¤šĄŁ
+ ¤Ű¤Č¤ó¤ÉšőËâ˝Ń¤Ç¤â˛ż¤Ç¤âĚľ¤¤¤Ç¤š¤ÍĄŁ
+
+ 8. šőËâ˝Ń¤ČĆą´üżŽšć
+
+ ¤ľ¤˘Ą˘źŤĘŹ¤ÇÁޤó¤ŔĽÉĽĂĽČĽŻĽíĽĂĽŻÂĐąţ¤Ëˇ×ťť¤ˇ¤ż HFL/VFL ¤Îżôťú¤Ź¤˘¤ęĄ˘
+ ĚľĆń¤ĘşĆÉÁ˛čÂŽĹ٤Ź¸Ť¤Ä¤Ť¤ęĄ˘˝˝ĘŹ¤Ę VRAM ĄĘĽÓĽÇĽŞĽáĽâĽęĄË¤Ź¤˘¤ë¤ł¤Č¤ňłÎ
+ ǧ¤ˇ¤Ţ¤ˇ¤żĄŁ¤ł¤ě¤Ť¤é¤ŹËÜĹö¤ÎšőËâ˝Ń¤Ç¤š -- ¤¤¤Ä¤É¤ł¤ÇĆą´üżŽšć¤ň˝Đ¤š¤Ť¤ň
+ ĂΤëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ
+
+ Ćą´üżŽšć¤ŹźÂşÝ¤ËĽâĽËĽżĄź¤ÎżĺĘżľÚ¤ÓżâÄž¤ÎÁöşşźţÇČżô¤ňŔŠ¸ć¤ˇ¤Ć¤¤¤Ţ¤šĄŁťĹ
+ ÍÍÉ˝¤Ť¤é°ú¤Ă¤Ń¤ę˝Đ¤ˇ¤Ć¤­¤ż HSF ¤Č VSF ¤ĎÄęłĘžĺ¤ÎşÇÂçĆą´üźţÇČżô¤ÎżäÄęĂÍ
+ ¤Ç¤šĄŁĽ˘ĽŔĽ×ĽżĽŤĄźĽÉ¤Ť¤é¤ÎżŽšć¤ÎĂć¤ÎĆą´üżŽšć¤ĎĽâĽËĽżĄź¤Ë¤É¤ě¤Ż¤é¤¤ÂŽ¤Ż
+ źÂşÝ¤ËĆ°şî¤š¤ë¤ŤĹÁ¤¨¤Ţ¤šĄŁ
+
+ žĺľ­¤Î 2 ¤Ä¤Îł¨¤ňť×¤¤˝Đ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁĚܤ˸Ť¤¨¤ë˛čÁüĄĘ¤˘¤Ę¤ż¤ÎÁޤó¤Ŕ˛ňÁü
+ Ĺ٥ˤňÉ˝ź¨¤š¤ë¤ż¤á¤ËťČ¤ď¤ě¤ë¤Î¤ĎĄ˘ĽŐĽěĄźĽŕ¤ňĽéĽšĽżĄźÁöşş¤š¤ë¤ż¤á¤ËÉŹÍ×
+ ¤Ęťţ´Ö¤Î°ěÉô¤Ŕ¤ą¤Ç¤šĄŁ
+
+ żĺʿƹ´ü :
+
+ Á°¤ÎÄęľÁ¤Ë¤č¤ě¤ĐĄ˘ŁąËܤοĺĘżÁöşşŔţ¤ň¤ż¤É¤ë¤Î¤Ë¤Ď HFL ĘŹ¤Îťţ´ÖłÝ¤Ť¤ę¤Ţ
+ ¤šĄŁÉ˝ź¨¤ľ¤ě¤ëÉôĘŹ¤ÎĽŻĽíĽĂĽŻ˛óżôĄĘżĺĘżĽšĽŻĽęĄźĽó˛ňÁüĹ٥ˤň HR ¤Č¸Ć¤Ó¤Ţ
+ ¤ˇ¤ç¤ŚĄŁ¤˝¤Îťţ¤ĎĚŔ¤é¤Ť¤ËĄ˘ÄęľÁ¤Ť¤é HR < HFL ¤Č¤Ę¤ę¤Ţ¤šĄŁśńÂÎĹŞ¤ËΞĘý¤Ź
+ Ćąťţ¤ËłŤťĎ¤ˇ¤ż¤Č˛žÄꤡ¤ĆźĄ¤Ëź¨¤ˇ¤Ţ¤š :
+
+ |___ __ __ __ __ __ __ __ __ __ __ __ __
+ |_ _ _ _ _ _ _ _ _ _ _ _ |
+ |_______________________|_______________|_____
+ 0 ^ ^ Ăą°Ě: 1ĽŻĽíĽĂĽŻ
+ | ^ ^ |
+ HR | | HFL
+ | |<----->| |
+ |<->| HSP |<->|
+ HGT1 HGT2
+
+ ¤ł¤ł¤ÇĄ˘žĺ¤Ë¤˘¤ë¤č¤Ś¤ËÉ˝ź¨ĽÇĄźĽż¤ÎĽŻĽíĽĂĽŻ˝ŞÎť¤ČĽŐĽěĄźĽŕÁ´ÂΤμŻĽíĽĂĽŻ
+ ˝ŞÎť¤Î´Ö¤Ë HSP ¤ÎĆą´üżŽšćÄš¤ňÇŰĂÖ¤ˇ¤Ţ¤šĄŁ˛ż¸Î¤˝¤Ś¤š¤ë¤Î¤ŤĄŠ ¤˝¤ě¤Ď¤ł¤Ś
+ ¤š¤ë¤ČĄ˘˛čĚĚÉ˝ź¨¤Źş¸ąŚ¤Ë°ÜĆ°¤ˇ¤Ę¤Ż¤Ę¤ë¤Ť¤é¤Ç¤šĄŁÉ˝ź¨¤ňĽšĽŻĽęĄźĽóžĺ¤ÇÉ˝
+ ź¨¤ľ¤ě¤ë¤Ů¤­žě˝ęĄ˘¤Ä¤Ţ¤ęĽâĽËĽżĄź¤ÎÉ˝ź¨˛ÄÇ˝ÎΰčĆâ¤Ë¤­¤Ă¤Á¤ę¤Č¤Ş¤ľ¤á¤ë¤ż
+ ¤á¤Ç¤šĄŁ
+
+ ¤˝¤ÎžĺĄ˘Ćą´üżŽšć¤ÎΌ¤Ë "Ëɸćťţ´Ö" ¤Č¤ˇ¤ĆĚó 30 ĽŻĽíĽĂĽŻÉŹÍפǤšĄŁHGT1
+ ¤Č HGT2 ¤ÇÉ˝¤ď¤ˇ¤Ć¤¤¤Ţ¤šĄŁ°ěČĚĹŞ¤Ë¤Ď HGT1 ¤Ď HGT2 ¤ČĹů¤ˇ¤Ż¤˘¤ę¤Ţ¤ť¤ó
+ ¤ŹĄ˘¤ˇ¤Ť¤ˇżż¤Ă¤ľ¤é¤ÎžőÂÖ¤Ť¤éŔßÄę¤ňšÔ¤Ś¤Ę¤é¤ĐĄ˘2 ¤Ä¤ňĹů¤ˇ¤Ż¤ˇ¤ĆźÂ¸ł¤ňťĎ
+ ¤á¤ż¤éÎɤ¤¤Ç¤ˇ¤ç¤ŚĄĘ¤˝¤ě¤ĎĆą´üżŽšć¤ňĂćąű¤ËĂÖ¤Ż¤ł¤Č¤Ë¤Ę¤ę¤Ţ¤šĄËĄŁ
+
+ Ćą´üżŽšć¤ÎĂÖ¤­°ă¤¨¤ÎžÉžő¤ĎĄ˘1 ¤Ä¤Îś­łŚ¤ŹśËĂź¤Ëš­¤Ż¤Ę¤Ă¤Ć˛čÁü¤Îž¤ÎÂŚ¤Ź
+ ˛čĚ̤ÎĂź¤Ť¤é˛ó¤ęšţ¤ó¤Ŕ¤ęĄ˘Çň¤¤Ăź¤ÎŔţ¤Č"¤Ş˛˝¤ą˛čÁü"¤ÎÂӤˤʤ俤ꥢ˛čĚĚ
+ ¤Î˛čÁüÉ˝ź¨¤Î¤ş¤ě¤Č¤ˇ¤Ć¸˝¤ď¤ě¤Ţ¤šĄŁżâĞƹ´üżŽšćČ´¤ą¤ĎżâÄžĘÝťý¤ŹÄ´ŔáÉÔČ÷
+ ¤Ë¤Ę¤Ă¤Ć¤¤¤ë TV ¤ÎÍͤ˟ºݤ˽ļšĽŻĽíĄźĽë¤ˇ¤Ţ¤šĄĘťöźÂĄ˘Ćą¤¸¸˝žÝ¤ŹľŻ¤ł¤ę
+ ¤Ţ¤šĄËĄŁ
+
+ šŹąż¤Ę¤é¤ĐĄ˘ĽâĽËĽżĄź¤ÎĆą´üżŽšć¤ÎÉý¤Ź¤˝¤ÎťĹÍÍ˝ń¤Ëľ­şÜ¤ľ¤ě¤Ć¤¤¤ë¤Ç¤ˇ¤ç
+ ¤ŚĄŁľ­şÜ¤Ź¤Ę¤¤žěšç¤Ë¤ĎĄ˘¤ł¤ł¤Ť¤é¤ŹËÜĹö¤ÎšőËâ˝Ń¤ÎťĎ¤Ţ¤ęĄ˘Ą˘Ą˘
+ ¤ł¤ł¤Ç¤ĎžŻ¤ˇťîšÔşř¸í¤ňšÔ¤ŚÉŹÍפŹ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁ¤ˇ¤Ť¤ˇ¤Ű¤Č¤ó¤É¤Îžěšç¤Ë
+ ¤ĎĄ˘Ćą´üżŽšć¤ňĚó 3.5 ¤Ť¤é 4.0 ĽŢĽ¤ĽŻĽíÉäȲžÄꤚ¤ě¤Đ°ÂÁ´¤Ç¤šĄŁ
+
+ śńÂÎĹŞ¤Ë¤ĎĄ˘HSP ¤ň 3.8 ĽŢĽ¤ĽŻĽíÉäˤˇ¤Ţ¤ˇ¤ç¤ŚĄĘ¤ł¤ÎĂͤϟ¸ł¤ňťĎ¤á¤ë¤Ë
+ Ĺö¤ż¤Ă¤Ć¤Ď°­¤¤ĂͤǤϤ˘¤ę¤Ţ¤ť¤óĄËĄŁ
+
+ ¤ľ¤ĆĄ˘Ŕč¤Ű¤É 65Mhz ¤ňĽŻĽíĽĂĽŻ¤ËťČ¤¤¤Ţ¤ˇ¤ż¤Ť¤éĄ˘HSP ¤ň 247 ĽŻĽíĽĂĽŻĘŹ¤Č
+ Ĺů¤ˇ¤Ż¤š¤ě¤Đ¤č¤¤¤ł¤Č¤Ź¤ď¤Ť¤ę¤Ţ¤šĄŁ( 247 = 65x10**6 * 3.8 *10**(-6))
+ [ĽáĽŹ=10**6, ĽŢĽ¤ĽŻĽí=10**(-6) ¤Ç¤˘¤ëťö¤ňť×¤¤˝Đ¤ˇ¤Ć˛ź¤ľ¤¤]
+
+ żâĞƹ´ü :
+
+ Á°¤Îł¨¤ËĚá¤Ă¤ĆĄ˘247 ĽŻĽíĽĂĽŻĘŹ¤ňł¨¤ÎĂć¤Ç¤É¤Î¤č¤Ś¤ËĂÖ¤¤¤ż¤é¤¤¤¤¤Ç¤ˇ¤ç
+ ¤ŚĄŠ
+
+ ¤ł¤ÎÎă¤Ç¤ĎĄ˘HR ¤Ď 944 ¤Ç HFL ¤Ď 1176 ¤Ç¤šĄŁ¤ł¤Î 2 ¤Ä¤ÎÎă¤Îşš¤Ď
+ 1176-944=232 < 247¤Ç¤š! ĚŔ¤é¤Ť¤Ë¤ł¤Î°ă¤¤¤ňÄ´Ŕ°¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ˛ż
+ ¤Ź¤Ç¤­¤ë¤Ç¤ˇ¤ç¤Ś¤ŤĄŠ
+
+ şÇ˝é¤Ë 1176 ¤Ď 1184 ¤Řžĺ¤˛¤ĆĄ˘ 944 ¤Ď 936 ¤Ř˛ź¤˛¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤ľ¤ĆĄ˘°ă¤¤
+ ¤Ď 1184-936= 248 ¤Ë¤Ę¤ę¤Ţ¤ˇ¤żĄŁ¤ŚĄÁ¤óĄ˘śá¤Ĺ¤­¤Ţ¤ˇ¤ż¤ÍĄŁ
+
+ źĄ¤Ď HSP ¤ňˇ×ťť¤š¤ë¤Î¤Ë 3.8 ¤ÎÂĺ¤ď¤ę¤ËĄ˘3.5 ¤ňťČ¤Ś¤č¤Ś¤Ë¤š¤ë¤ČĄ˘
+ 65*3.5=227 ¤Č¤Ę¤ę¤Ţ¤šĄŁ¤Ť¤Ę¤ęÎɤŻ¤Ę¤ę¤Ţ¤ˇ¤żĄŁ¤ˇ¤Ť¤ˇ 248 ¤Ď 227 ¤č¤ę¤˝
+ ¤ě¤Ű¤ÉÂ礭¤Ż¤˘¤ę¤Ţ¤ť¤óĄŁHR ¤Č SP ¤ÎłŤťĎĹŔ¤Î´Ö¤Č SP ¤Î˝ŞÎťĹŔ¤Č HFL ¤Î´Ö
+ ¤Ë 30 ¤Ť¤˝¤ě¤°¤é¤¤¤˘¤ą¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤˝¤ˇ¤ĆĄ˘¤˝¤ě¤é¤Ď 8 ¤ÎÇÜżô¤Ë¤ˇ
+ ¤Ę¤ą¤ě¤Đ¤Ę¤ę¤Ţ¤ť¤óĄŞ˛ćĄš¤Ď¤ł¤ł¤ÇšÔ¤­ľÍ¤Ţ¤Ă¤Ć¤ˇ¤Ţ¤Ă¤ż¤Î¤Ç¤ˇ¤ç¤Ś¤ŤĄŠ
+
+ ¤¤¤¤¤¨ĄŞ ¤ł¤Ś¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘936% 8==0 ¤Ç¤šĄ˘¤Ţ¤ż (936+32)% 8==0 ¤Ç
+ ¤šĄŁ¤ˇ¤Ť¤ˇĄ˘936+32=968Ą˘968+227=1195Ą˘1195+32=1227 ¤Č¤Ę¤ę¤Ţ¤šĄŁ¤Ő¤ŕ¤Ő
+ ¤ŕĄ˘¤˝¤ó¤Ę¤Ë°­¤Ż¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ¤ˇ¤Ť¤ˇĄ˘8 ¤ÎÇÜżô¤Ë¤Ď¤Ę¤Ă¤Ć¤¤¤Ţ¤ť¤ó¤Î
+ ¤ÇĄ˘1232 ¤Ë´Ý¤á¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ¤ˇ¤Ť¤ˇĄ˘Ćą´üżŽšć¤ň HR ¤Č HFL ¤Î¤Á¤ç¤Ś¤Éżż¤óĂć¤ËĂÖ¤Ż¤ł¤Č¤Ź˝ĐÍč¤Ę¤¤¤Č¤¤
+ ¤ŚŔřşßĹŞ¤Ęş¤Ćń¤Ź¤˘¤ę¤Ţ¤šĄŁšŹ¤¤¤Ë¤âĄ˘1232-32=1200 ¤â 8 ¤ÎÇÜżô¤Ç¤˘¤ëťö
+ ¤ČĄ˘ (1232-32)-968=232 ¤Ď 3.57 ĽŢĽ¤ĽŻĽíÉĂ (232/65) ¤Č¤¤¤ŚÂĹĹö¤ĘÄš¤ľ¤Î
+ Ćą´üżŽšć¤ËÂĐąţ¤š¤ë¤ł¤Č¤Źˇ×ťť¤Ç¤ď¤Ť¤ę¤Ţ¤šĄŁ
+
+ ¤ľ¤é¤ËĄ˘ 936/1232 ¤ĎÂçÂÎ 0.76 ¤Ä¤Ţ¤ę 76%, ¤Ç¤š¤ŹĄ˘80% ¤Ť¤é¤˝¤Śąó¤Ż¤Ę¤¤
+ ¤Î¤Ç¤Ţ¤˘ÂçžćÉפǤˇ¤ç¤ŚĄŁ
+
+ ¤˝¤ÎžĺĄ˘¸˝şß¤ÎżĺĘżĽŐĽěĄźĽŕÄš¤ňťČ¤Ś¤Ę¤éĄ˘´đËÜĹŞ¤Ë¤ĎĽâĽËĽżĄź¤Ź¤˝¤ÎÇ˝ÎĎĆâ
+ ¤Ç 52.7KHz(=65MHz/1232) ¤Ë¤Ş¤¤¤ĆĆą´ü¤Źźč¤ě¤ë¤Ť¤É¤Ś¤ŤÄ´¤Ů¤Ţ¤ˇ¤ç¤ŚĄŁĚäÂę
+ ¤ĎĚľ¤¤¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ ˇĐ¸łÂ§¤Ť¤éĄ˘žĺľ­¤Î 936*75%=702 ¤ňżˇ¤ˇ¤¤żâÄž˛ňÁüĹ٤ˤˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+ 702*1.05=737 ¤Źżˇ¤ˇ¤¤żâÄžĽŐĽěĄźĽŕÄš¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ ˛čĚĚşĆÉÁ˛čÂŽĹŮ¤Ď 65Mhz/(737*1232)=71.6 Hz ¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤˝¤ě¤Ç¤âÁÇŔ˛¤é¤ˇ
+ ¤¤¤Ç¤š¤ÍĄŁ
+
+ ĆąÍͤ˿âĞƹ´üżŽšć¤ÎÇŰĂÖ¤ňżŢ˛ň¤ˇ¤Ţ¤š :
+
+ |___ __ __ __ __ __ __ __ __ __ __ __ __
+ |_ _ _ _ _ _ _ _ _ _ _ _ |
+ |_______________________|_______________|_____
+ 0 VR VFL Ăą°Ě:1 żâÄžĽŻĽíĽĂĽŻ
+ ^ ^ ^
+ | | |
+ |<->|<----->|
+ VGT VSP
+
+ żâĞɽź¨ĽÇĄźĽż¤Î˝ŞÎťťţ¤­¤Ă¤Ť¤ę¤ËĆą´üżŽšć¤ňČŻżŽ¤ˇ¤Ţ¤šĄŁVGT ¤ĎĆą´üżŽšć¤Î
+ żâÄžËɸćťţ´Ö¤Ç¤šĄŁ¤Ű¤Č¤ó¤É¤ÎĽâĽËĽżĄź¤Ď VGT Ěľ¤ˇĄĘËɸćťţ´ÖĚľ¤ˇĄË¤Ç˛÷ĹŹ
+ ¤ËĆ°şî¤ˇĄ˘ÎăÂę¤Ç¤âËɸćťţ´ÖĚľ¤ˇ¤Ç¤šĄŁ2,3 ĽŻĽíĽĂĽŻ¤ÎËɸćťţ´Ö¤ŹÉŹÍפʤâ¤Î
+ ¤â¤˘¤ę¤Ţ¤š¤ŹĄ˘Ëɸćťţ´Ö¤ňĆţ¤ě¤ĆÉÔĹԚ礏Ŕ¸¤¸¤ë¤ł¤Č¤ĎÉáÄ̤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ ÎăÂę¤ËĚá¤ę¤Ţ¤ˇ¤ç¤Ś : ĽŐĽěĄźĽŕÄš¤ÎÄęľÁ¤Ť¤éĄ˘żâÄžĽŻĽíĽĂĽŻ¤ĎÁ´ĄöżĺĘżĄöĽŐ
+ ĽěĄźĽŕ¤ňĂŠ¤ëťţ´Ö¤Ç¤š¤Î¤ÇĄ˘ÎăÂę¤Ç¤Ď 1232/65Mhz=18.95 ĽŢĽ¤ĽŻĽíÉäˤʤę¤Ţ
+ ¤šĄŁ
+
+ źÂ¸ł¤Ë¤č¤ě¤ĐżâĞƹ´ü¤ÎĽŃĽëĽšÉý¤Ď 50 ĽŢĽ¤ĽŻĽíÉ䍤é 300 ĽŢĽ¤ĽŻĽíÉäÎČĎ
+ °Ď¤ËŔßÄꤚ¤Ů¤­¤Ç¤šĄŁÎăÂę¤Ç¤Ď 8 żâÄžĽŻĽíĽĂĽŻĘŹĄ˘150 ĽŢĽ¤ĽŻĽíÉäňťČÍѤˇ
+ ¤Ţ¤š (150 ĽŢĽ¤ĽŻĽíÉĂ / 18.95 ĽŢĽ¤ĽŻĽíÉĂ 8)ĄŁ
+
+ 9. Á´ÂΤΤޤȤá
+
+ Xconfig ĽŐĽĄĽ¤Ľë¤ÎĽÓĽÇĽŞĽâĄźĽÉ ( Video Modes ) É˝¤ĎżôšÔ¤ÎżôÎó¤Ç˝ĐÍč¤Ć
+ ¤¤¤ĆĄ˘¤˝¤ě¤ž¤ě¤ÎšÔ¤Ď X ĽľĄźĽĐĄź¤ŹťČÍѤš¤ëŁą¤Ä¤ÎĽâĄźĽÉ¤Î´°Á´¤ĘťĹÍͤňÉ˝
+ ¤ď¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤˝¤ÎšŕĚܤĎĚžžÎŔᥢĽÉĽĂĽČĽŻĽíĽĂĽŻŔᥢżĺĘżŔᥢżâÄžŔá¤Î 4
+ ¤Ä¤ÎŔá¤ËĘŹ¤ą¤é¤ě¤Ţ¤šĄŁ
+
+ ĚžžÎŔá¤ĎŁąšŕĚܤǥ˘šÔ¤ÎťÄ¤ę¤ÇťŘÄꤡ¤Ć¤¤¤ëĽÓĽÇĽŞĽâĄźĽÉ¤ÎĚžžÎ¤Ç¤šĄŁ¤ł¤ÎĚž
+ žÎ¤ĎĄ˘ Xconfig ĽŐĽĄĽ¤Ľë¤ÎĽ°ĽéĽŐĽŁĽĂĽŻĽÉĽéĽ¤ĽĐŔßÄęŔá¤Î "Modes" šÔ¤Çť˛žČ
+ ¤ľ¤ě¤Ţ¤šĄŁ¸˝şß¤ÎšÔ¤ŹÁ°¤ÎšÔ¤ČĆą¤¸ĚžžÎ¤Ę¤é¤ĐĚžžÎ¤ĎžĘÎŹ˝ĐÍč¤Ţ¤šĄŁ
+
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻŔá¤ĎĽÓĽÇĽŞĽâĄźĽÉšÔ¤ÎšŕĚÜ¤Ë DCF ¤Č¸Ć¤ó¤Ç¤¤¤żĽÉĽĂĽČĽŻĽíĽĂ
+ ĽŻ¤Î¤ß¤ň˝ń¤­¤Ţ¤šĄŁźĄ¤ÎŔá¤ÇşîŔŽ¤š¤ëżôťú¤ňĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Č¤ˇ¤Ć¤ł¤ÎšŕĚܤË
+ ˝ń¤­¤Ţ¤šĄŁ
+
+ żĺĘżŔá¤Ď¤˝¤ě¤ž¤ě¤ÎżĺĘżŔţ¤ň˛čĚ̤Ξĺ¤Ç¤É¤Î¤č¤Ś¤ËşîŔŽ¤š¤ë¤Ť¤ň 4 šŕĚܤǽń
+ ¤­¤Ţ¤šĄŁşÇ˝é¤ÎšŕĚÜ¤Ď HR ¤Č¸Ć¤ó¤Ç¤¤¤żąÇÁü¤ňš˝ŔŽ¤š¤ëľą¤ŻŁąËܤŹ˛żĽÉĽĂĽČ¤Ç
+ ¤˘¤ë¤Ť¤ň˝ń¤­¤Ţ¤šĄŁ 2 ČÖĚܤΚŕĚܤϤɤμɼüȤŤ¤éżĺʿƹ´üżŽšć¤ŹťĎ¤Ţ¤ë¤Ť
+ ¤ňź¨¤ˇ¤Ţ¤šĄŁ 3 ČÖĚܤΚŕĚܤϤɤμɼüȤǿĺʿƹ´üżŽšć¤Ź˝Ş¤ď¤ë¤Ť¤ňź¨¤ˇ¤Ţ
+ ¤šĄŁ 4 ČÖĚܤΚŕĚܤĎÁ´żĺĘżĽŐĽěĄźĽŕÄš (HFL) ¤ňťŘÄꤡ¤Ţ¤šĄŁ
+
+ żâÄžŔá¤â 4 šŕĚܤǽń¤­¤Ţ¤šĄŁşÇ˝é¤ÎšŕĚܤϲčĚĚžĺ¤ËÉ˝ź¨¤ľ¤ě¤ëÁöşşŔţ¤Îżô¤ň
+ ˝ń¤­¤Ţ¤š (VR)ĄŁ 2 ČÖĚܤΚŕĚܤϿâĞƹ´üżŽšć¤Ź˛żČÖĚܤÎŔţ¤Ť¤éťĎ¤Ţ¤ë¤Ť¤ň˝ń
+ ¤­¤Ţ¤šĄŁ 3 ČÖĚܤΚŕĚܤϿâĞƹ´üżŽšć¤Ź˛żČÖĚܤÎŔţ¤Ç˝Ş¤ď¤ë¤Ť¤ň˝ń¤­¤Ţ¤šĄŁ4
+ ČÖĚܤΚŕĚܤĎÁ´żâÄžĽŐĽěĄźĽŕÄš¤ň˝ń¤­¤Ţ¤šĄŁ
+
+ Îă :
+
+ #ĚžžÎŔá ĽâĄźĽÉĽŻĽíĽĂĽŻŔá żĺĘżŔá(1¤Ť¤é4) żâÄžŔá(1¤Ť¤é4)
+ #Modename clock horizontal timing vertical timing
+
+ "752x564" 40 752 784 944 1088 564 567 569 611
+ 44.5 752 792 976 1240 564 567 570 600
+
+ ĄĘĂí°Ő : ɸ˝ŕĹŞ¤Ę X11R5 ¤˝¤Î¤Ţ¤Ţ¤Ç¤Ď žŽżô¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ĎťČ¤¨¤Ţ¤ť
+ ¤óĄŁĄË
+
+ Xconfig ¤Ç¤ĎĄ˘Ŕţžĺ¤Çľą¤¤¤Ć¤¤¤ëĽÉĽĂĽČ¤ÎżôĄ˘ľą¤¤¤Ć¤¤¤ëĽÉĽĂĽČ¤Ť¤éĆą´üżŽšć
+ ¤ÎłŤťĎĹŔ¤Ţ¤Ç¤ÎĽÉĽĂĽČżôĄ˘Ćą´üżŽšć¤ÎťýÂłťţ´ÖĘŹ¤ÎĽÉĽĂĽČżô¤ČĆą´üżŽšć¤Î˝ŞÎť
+ ĹŔ¤Ť¤é¸ĺ¤ÎĽÉĽĂĽČżôĄ˘¤ł¤ě¤é¤ň­¤ˇšç¤ď¤ť¤ë¤ČŁąËÜĹö¤ż¤ę¤ÎĽÉĽĂĽČżô¤Źˇ×ťť¤Ç
+ ¤­¤Ţ¤šĄŁżĺĘżĘý¸ţ¤ÎĽÉĽĂĽČżô¤Ď°ěΧ¤Ë 8 ¤Çłä¤ęŔÚ¤ě¤ëżôĂͤǤʤą¤ě¤Đ¤¤¤ą¤Ţ
+ ¤ť¤óĄŁ
+
+ Îă :
+
+ żĺĘżĘý¸ţ¤ÎżôĂÍ : 800 864 1024 1088
+
+ ¤ł¤ÎÎă¤Ďľą¤¤¤Ć¤¤¤ëĽÉĽĂĽČżô (800)Ą˘Âł¤¤¤ĆĆą´üłŤťĎĹŔ¤ÎĽÉĽĂĽČ (864)Ą˘¤˝¤Î
+ źĄ¤ŹĆą´ü˝ŞÎťĹŔ¤ÎĽÉĽĂĽČ (1024)Ą˘źĄ¤ĎżĺĘżŔţ¤ÎşÇ¸ĺ¤ÎĽÉĽĂĽČ (1088) ¤Č¤Ę¤ę
+ ¤Ţ¤šĄŁ
+
+ Á´¤Ć¤ÎżĺĘżĘý¸ţ¤Îżôťú (800Ą˘864Ą˘1024 ¤Č 1088) ¤Ď 8 ¤Çłä¤ęŔÚ¤ě¤ëťö¤Ë¤â
+ ¤Ś°ěĹŮĂí°Ő¤ň¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤ł¤ě¤ĎżâÄžĘý¸ţ¤Îżôťú¤Ë¤ĎĹö¤Ć¤Ď¤Ţ¤ę¤Ţ¤ť¤óĄŁ
+
+ ˛čĚ̤Ξ复¤é˛ź¤Ţ¤Ç¤ÎŔţ¤Îżô¤ŹĽŐĽěĄźĽŕ¤ňš˝ŔŽ¤ˇ¤Ţ¤šĄŁĽŐĽěĄźĽŕ¤Î´đËÜĹŞ¤Ęťţ
+ ´ÖÄ´Ŕ°¤ĎŔţ¤ÇšÔ¤Ę¤¤¤Ţ¤šĄŁŔţ¤ÎÂż¤Ż¤Ď˛čÁü¤ňÉ˝ź¨¤š¤ë¤ż¤á¤ËťČ¤ď¤ě¤Ţ¤šĄŁşÇ¸ĺ
+ ¤ÎČŻ¸÷¤š¤ëŔţ¤ňÉ˝ź¨¤ˇ¤ż¸ĺ¤ÇĄ˘żôËÜĘŹĂٹ䤏ÁŢĆţ¤ľ¤ěĄ˘¤˝¤Î¸ĺżâĞƹ´üżŽšć¤Ź
+ Ŕ¸ŔŽ¤ľ¤ě¤Ţ¤šĄŁ¤˝¤ˇ¤ĆĆą´üżŽšć¤ĎżôËÜĘŹ¤Ŕ¤ąťýÂł¤ˇĄ˘ĽŐĽěĄźĽŕ¤ÎşÇ¸ĺ¤ËĆą´üżŽ
+ šć¤Î¸ĺ¤ÇÉŹÍפĘĂٹ䤏Ŕ¸ŔŽ¤ľ¤ě¤Ţ¤šĄŁ¤ł¤ÎĆ°şîĽâĄźĽÉ¤ňľŹÄꤚ¤ëżôĂͤϥ˘źĄ¤Î
+ Îă¤Î¤č¤Ś¤ËĆţÎϤˇ¤Ţ¤šĄŁ
+
+ Îă :
+
+ żâÄžĘý¸ţ¤ÎżôĂÍ : 600 603 609 630
+
+ ¤ł¤ÎÎă¤ĎĽÇĽŁĽšĽ×ĽěĽ¤¤Ë 600 ËܤÎŔţ¤ŹÉ˝ź¨¤ľ¤ěĄ˘603 ČÖĚܤÎŔţ¤Ť¤éżâĞƹ´ü
+ ¤ŹťĎ¤Ţ¤ę 609 ČÖĚÜ¤Ç˝Ş¤ď¤ëťöĄ˘¤˝¤ˇ¤ĆÁ´Éô¤Ç 630 ËܤÎŔţ¤ňťČÍѤš¤ë¤ł¤Č¤ňÉ˝
+ ¤ď¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ żâÄžĘý¸ţ¤ÎżôĂÍ¤Ď 8 ¤Çłä¤ęŔÚ¤ě¤ëĂͤǤʤŻ¤Ć¤âš˝¤¤¤Ţ¤ť¤óĄŁ
+
+ ÎăÂę¤ËĚá¤ę¤Ţ¤ˇ¤ç¤ŚĄŁžĺľ­¤Ë¤č¤Ă¤ĆĄ˘Xconfig ¤Ř˝ń¤­šţ¤ŕÉŹÍפĘÁ´¤Ć¤ÎĂͤϟĄ
+ ¤ÎÍͤǤš:
+
+ < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
+
+ ¤ł¤ł¤Ç SH1 ¤Ďżĺʿƹ´üżŽšć¤ÎłŤťĎĽŻĽíĽĂĽŻ¤ÇĄ˘SH2 ¤Ď¤˝¤Î˝ŞÎťĽŻĽíĽĂĽŻ¤Ë¤Ę
+ ¤ęĄ˘ĆąÍÍ¤Ë SV1 ¤ĎżâĞƹ´üżŽšć¤ÎłŤťĎĽŻĽíĽĂĽŻ¤ÇĄ˘SV2 ¤Ď¤˝¤Î˝ŞÎťĽŻĽíĽĂĽŻ
+ ¤Ç¤šĄŁ
+
+ #ĚžžÎŔá ĽâĄźĽÉĽŻĽíĽĂĽŻŔá żĺĘżŔá(1¤Ť¤é4) żâÄžŔá(1¤Ť¤é4) ĽŞĽ×ĽˇĽçĽó
+ #name clock horizontal timing vertical timing flag
+ 936x702 65 936 968 1200 1232 702 702 710 737
+
+ ĆĂĘĚ¤ĘĽŞĽ×ĽˇĽçĽó¤ĎÉŹÍ×Ěľ¤ŻĄ˘¤ł¤ě¤ĎĽÎĽóĽ¤ĽóĽżĄźĽěĄźĽšĽâĄźĽÉ¤ÇĆ°şî¤ˇ¤Ţ
+ ¤šĄŁ¤ł¤ě¤Ç´°Îť¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ 10. źÁľżąţĹú
+
+ Q. ¤ł¤ł¤Ë¤˘¤ëÎăÂę¤Ďɸ˝ŕĹŞ¤Ę˛čĚĚĽľĽ¤Ľş¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤ó¤ŹĄ˘ťČ¤Ă¤Ć¤â¤č¤¤¤Ç
+ ¤š¤ŤĄŠ
+
+ A. ĚŢĎŔ¤Ç¤šĄŁ¤Ę¤Ë¤Ź¤Ę¤ó¤Ç¤â 640x480, 800x600 ¤Č¤Ť 1024x768 ¤ňťČ¤ď¤Ę¤ą
+ ¤ě¤Đ¤Ę¤é¤Ę¤¤ÍýÍł¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁXFree86 ĽÉĽéĽ¤ĽĐ¤ĎĽĎĄźĽÉĽŚĽ§Ľ˘¤ňźŤÍł¤ËŔß
+ Äę¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę¤Ă¤Ć¤¤¤Ţ¤šĄŁ°ěČ̤ËŔľ¤ˇ¤¤ŔßÄę¤Ď 2 Ą˘3 ĘŹ¤Ç¤Ç¤­¤ë¤č¤Ś¤Ë
+ ¤Ę¤ę¤Ţ¤šĄŁŔľ¤ˇ¤¤ŔßÄę¤ňĹö¤Ć¤ë¤Î¤Ë˝ĹÍפĘĘŞ¤Ďšâ¤¤şĆÉÁ˛čÂŽĹ٤ČÂĹĹö¤ĘÉ˝ź¨ÎÎ
+ °č¤Ç¤šĄŁšâ˛ňÁüĹ٤Ŕ¤ą¤ňÄɾᤡ¤ĆÎŢĚܤňÍś¤Ś¤Á¤é¤Ä¤­¤ËÂĺ˝ţ¤ňʧ¤Ś¤ł¤Č¤Î¤Ę¤¤
+ ¤č¤Ś¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ Q. 65Mhz ¤ÎĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Č 55Khz ¤Î HSF ¤ÇĆŔ¤é¤ě¤ë˛ňÁüĹ٤Ϥł¤ěĄö¤Ŕ¤ą
+ Ąö¤Ç¤š¤ŤĄŠ
+
+ A. ŔäÂФ˝¤ó¤Ę¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŞ °ěČĚĹŞ¤Ęźę˝ç¤Ë˝ž¤Ă¤ĆşîśČ¤ňšÔ¤¤Ą˘ËÜĹö¤Ë
+ šĽ¤ß¤ÎŔßÄę¤Ë¤ż¤É¤ęĂ夯¤ż¤áĄ˘žŻ¤ˇ¤ÎťîšÔ¤ÎˇŤ¤ęĘÖ¤ˇ¤ň¤Ş´Ť¤á¤ˇ¤Ţ¤šĄŁ źÂ¸ł
+ ¤Ď¤Č¤Ă¤Ć¤âłÚ¤ˇ¤¤¤â¤Î¤Ç¤šĄŁ ¤Ű¤Č¤ó¤É¤ÎŔßÄę¤ĎĽÓĽÇĽŞÉ˝ź¨¤ŹÍđ¤ě¤Ć¤Á¤ă¤ó¤Č
+ ŔßÄę¤Ç¤­¤Ę¤¤¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤ó¤ŹĄ˘ĽŢĽëĽÁĽˇĽóĽŻĽâĽËĽżĄź¤ňĄĘÂÓ°čÉý¤č¤ę¤â¤Ď¤ë
+ ¤Ť¤Ëšâ¤¤źţÇČżô¤ÎĽŻĽíĽĂĽŻ¤ň˝ĐÎϤľ¤ť¤č¤Ś¤Č¤ˇ¤Ę¤¤¸Â¤ę¤Ď --- ĽâĽËĽżĄź¤ÎŔâ
+ ĚŔ˝ń¤Ë˝ń¤Ť¤ě¤Ć¤¤¤ëşÇÂç˛ňÁüĹ٤˜ᤤĂͤňźé¤Ă¤Ć¤¤¤ëžěšç¤ĎĄËÄˤá¤ë¤ł¤Č¤Ď¤˘
+ ¤ę¤Ţ¤ť¤óĄŁ¸ÇÄęźţÇČżô¤ÎĽâĽËĽżĄź¤Ë¤ĎĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁźţÇČżôÄ´Ŕ°¤Ď¸ÇÄęźţ
+ ÇČżô¤ÎĽâĽËĽżĄź¤ňÄˤá¤ëĄö¤Ť¤âĄö¤ˇ¤ě¤Ţ¤ť¤óĄŁ
+
+ Q. Ćó¤Ä¤Îɸ˝ŕĹŞ¤Ę˛ňÁüĹ٤ňľ­şÜ¤ˇ¤Ć¤Ţ¤š¤ÍĄŁ Xconfig ¤ÎĂć¤Ç¤Ďż§ĄšÉ¸˝ŕĹŞ¤Ę
+ ˛ňÁüĹ٤Ź¤˘¤ę¤Ţ¤š¤ŹĄ˘ťţ´ÖÄ´Ŕá¤ÎżôĂͤňÄ´Ŕ°¤š¤ëžěšç¤ÎĽÝĽ¤ĽóĽČ¤ňśľ¤¨¤Ć¤Ż¤Ŕ
+ ¤ľ¤¤ĄŁ
+
+ A. ĚŢĎŔśľ¤¨¤Ţ¤ˇ¤ç¤ŚĄŞ ¸˝şß¤Î Xconfig ¤Ë¤˘¤ë "ɸ˝ŕĹŞ¤Ę" 640x480 ¤ňÎăÂę
+ ¤Ëźč¤ęžĺ¤˛¤Ţ¤šĄŁ¤ł¤ÎžěšçĄ˘Ć°şîźţÇČżô¤Ź 25MHz Ą˘ĽŐĽěĄźĽŕÄš¤Ź 800 ¤Č 525
+ ¤Îťţ¤ËĚó 59.5Hz ¤Î˛čĚĚşĆÉÁ˛čźţÇČżô¤ŹťČ¤¨¤Ţ¤šĄŁ °­¤ŻĚľ¤¤¤Ç¤ˇ¤çĄŠ ¤ˇ¤Ť¤ˇ
+ °ěČĚĹŞ¤ËÂż¤Ż¤Î SVGA ĽÜĄźĽÉ¤ÎĆ°şîźţÇČżô¤Ď 28MHz ¤ňťČ¤¨¤Ţ¤šĄŁ28MHz ¤Ç
+ 640x480 ¤ňťČ¤ŚžěšçĄ˘°ĘÁ°¤ËŔâĚŔ¤ˇ¤żźę˝ç¤Ë˝ž¤¨¤ĐĄ˘ĽŐĽěĄźĽŕÄš¤Ď 812 ¤Č
+ 505 ¤ËŔßÄę¤Ç¤­¤Ţ¤šĄŁ¤ł¤ł¤ÇşĆÉÁ˛čźţÇČżô¤Ď 68MHz ¤Ţ¤Ç°ú¤­žĺ¤˛¤é¤ěĄ˘É¸˝ŕ
+ Ăͤč¤ę¤Ť¤Ę¤ę¸ţžĺ¤ˇ¤Ţ¤ˇ¤żĄŁ
+
+ Q. ¤Č¤ł¤í¤ÇĽ¤ĽóĽżĄźĽěĄźĽš¤ČĽÎĽóĽ¤ĽóĽżĄźĽěĄźĽš¤Ë¤Ä¤¤¤Ć¤Ď¤É¤Ś¤Ç¤š¤ŤĄŠ
+
+ A. ¸ÇÄęĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ç¤ĎĄ˘ĽÎĽóĽ¤ĽóĽżĄźĽěĄźĽš¤Î¤Á¤é¤Ä¤­¤č¤ęĽ¤ĽóĽżĄźĽě
+ ĄźĽš¤Î¤Á¤é¤Ä¤­¤ÎĘý¤Źšó¤¤¤Î¤ÇĄ˘Ľ¤ĽóĽżĄźĽěĄźĽš¤ĎťÔžě¤Ť¤éžĂ¤¨¤Ä¤Ä¤˘¤ę¤Ţ
+ ¤šĄŁĽŐĽęĽĂĽŤĄź¤ŹÁý¤¨¤ëÂĺ¤ď¤ę¤ËĄ˘Ă٤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Çšâ˛ňÁüĹ٤ňźÂ¸˝¤š¤ë
+ ¤ł¤Č¤Ź¤Ç¤­¤Ţ¤šĄŁ DCF ¤Ź˝˝ĘŹÂŽ¤¤žěšç¤Ë¤Ď (Î㤨¤Đ 90MHz ¤Č¤Ť¤˝¤ě°Ęžĺ) Ľ¤
+ ĽóĽżĄźĽěĄźĽš¤Ç¤â¤Á¤é¤Ä¤­¤ĎČŻŔ¸¤ˇ¤Ţ¤ť¤ó¤ŹĄ˘¸˝şß¤ÎĽšĽÔĄźĽÉ¤Ç¤ĎĽ¤ĽóĽżĄźĽě
+ ĄźĽšĽâĽËĽżĄź¤Ď X ¤Ë¸ţ¤¤¤Ć¤¤¤Ţ¤ť¤óĄŁ
+
+ Q. şŁ¤Ţ¤Ç¤ÎľÄĎŔ¤ň¤Ţ¤Č¤á¤Ć¤â¤é¤¨¤Ţ¤š¤ŤĄŠ
+
+ A. Í×Ě󤡤ƸŔ¤¨¤Đ :
+
+ 1. Ǥ°Ő¤Î¸ÇÄę¤ÎĆ°şîźţÇČżô¤Ç¤ĎĄ˘şÇšâ¤Î˛ňÁüĹ٤˚â¤á¤ě¤ĐşĆÉÁ˛čÂŽĹ٤ň˛ź¤˛
+ ¤Ę¤ą¤ě¤Đ¤Ę¤é¤şĄ˘¤ˇ¤ż¤Ź¤Ă¤Ć¤Á¤é¤Ä¤­¤ŹÁý¤¨¤ë¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ 2. šâ˛ňÁüĹ٤ň´őËž¤ˇĽâĽËĽżĄź¤Ź¤˝¤ě¤ňĽľĽÝĄźĽČ¤š¤ë¤Č¤­¤ĎĄ˘¤˝¤ě¤Ëšç¤ŚĽÉĽĂ
+ ĽČĽŻĽíĽĂĽŻĄ˘¤Ä¤Ţ¤ę DCF ¤ňśĄľë¤š¤ë SVGA ĽŤĄźĽÉ¤ňźę¤ËĆţ¤ě¤Ć˛ź¤ľ¤¤ĄŁ
+ ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ďšâ¤¤¤ËąŰ¤ˇ¤ż¤ł¤Č¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁ
+
+ 11. Ćó¤Ä¤ÎÎăÂę
+
+ ¤ł¤ł¤ÇĘ̤βžÄę¤ň¤ˇ¤Ţ¤šĄŁ:
+
+ ¤˘¤ëĽ˘ĽŔĽ×ĽżĄźĽŤĄźĽÉ¤Ď 40 MHz ¤ÎĽŻĽíĽĂĽŻ¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁ¤˘¤ëĽÇĽŁĽšĽ×ĽěĽ¤
+ ¤Ď 30 KHz ¤Ť¤é37 KHz ¤ÎČϰϤοĺʿƹ´üżŽšć¤ÇĆ°şî¤ˇ¤Ţ¤šĄŁ¤ł¤Îťţ¤ÎŁą¤Ä¤Î
+ ŔţĹö¤ż¤ę¤ÎĽÉĽĂĽČ¤ÎşÇžŽżô¤Ď 40,000,000/37,000 = 1,081.081 ¤č¤ęĄ˘Ěó
+ 1,081 ĽÉĽĂĽČ/Ŕţ¤Č¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¤ł¤ÎŁąËÜĹö¤ż¤ę¤ÎĽÉĽĂĽČżô¤ň¤ł¤ě¤Ť¤é¤Îˇ×ťť¤ÇťČ¤¤¤Ţ¤šĄŁ¤Ŕ¤Ť¤éĄ˘ĽÇĽŁĽšĽ×Ľě
+ Ľ¤žĺ¤Î¤˝¤ě¤ž¤ě¤ÎŔţ¤ĎşÇžŽ¤Ç 1081 ĽÉĽĂĽČ¤˘¤ę¤Ţ¤šĄŁ¤ł¤ÎżôĂͤň 8 ¤Çłä¤ęŔÚ
+ ¤ě¤ëżô¤Ë´Ý¤á¤Ć 1088 ¤ËŔÚ¤ęžĺ¤˛¤Ţ¤šĄŁ¤ł¤ł¤Ç¤Ďżĺʿƹ´üżŽšćÄš¤Ë 3.8 ĽŢĽ¤
+ ĽŻĽíÉäňťČ¤Ś¤ł¤Č¤ň˛žÄꤡ¤Ć¤¤¤Ţ¤šĄŁ 3.8 ĽŢĽ¤ĽŻĽíÉäοŽšć¤ňşî¤ë¤Î¤Ë˛ż
+ ĽÉĽĂĽČÉŹÍפʤΤŤ¤ň¸Ť¤Ä¤ą¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁŔ褺ŁąĽÉĽĂĽČ¤Ź˛żĽŢĽ¤ĽŻĽíÉäĘ
+ ¤Î¤Ť¤ňĂľ¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁËčÉĂ 40,000,000 ĽÉĽĂĽČ¤Ę¤Î¤ÇĄ˘1/40,000,000 ¤ŹĽÉĽĂ
+ ĽČĹö¤ż¤ę¤ÎÉĂżô¤Ç¤šĄŁ¤Ä¤Ţ¤ę
+
+ 1/40,000,000 = .000000025 = ĽÉĽĂĽČĹö¤ż¤ę .025 ĽŢĽ¤ĽŻĽíÉĂ
+
+ ¤Č¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¤ł¤Îťţ 3.8 ĽŢĽ¤ĽŻĽíÉäÎĆą´üżŽšć¤ňš˝ŔŽ¤š¤ëĽÉĽĂĽČżô D ¤Ď
+
+ 3.8 ĽŢĽ¤ĽŻĽíÉĂ = D ĽÉĽĂĽČ x .025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ
+
+ ¤Ä¤Ţ¤ę
+
+ D ĽÉĽĂĽČ = (3.8 ĽŢĽ¤ĽŻĽíÉĂ) / (.025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ) = 152 ĽÉĽĂĽČ¤Ç
+ ¤šĄŁ
+
+ ŔţĹö¤ż¤ę 1088 ĽÉĽĂĽČ¤ÎťţĄ˘152 ĽÉĽĂĽČ¤ňĆą´üżŽšć¤ËťČÍѤˇ¤ĆĄ˘800 ĽÉĽĂĽČ¤Ź
+ ľą¤¤¤Ć¸Ť¤¨¤Ć¤¤¤ë¤ď¤ą¤Ç¤šĄŁĄĘ152 ¤Ď 8 ¤Çłä¤ęŔÚ¤ě¤ë¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć˛ź¤ľ
+ ¤¤ĄŁłä¤ęŔÚ¤ě¤Ę¤¤žěšç¤Ďłä¤ęŔÚ¤ě¤ë¤č¤Ś¤ËŔÚ¤ęžĺ¤˛¤Ć˛ź¤ľ¤¤ĄŁĄË¤ł¤ł¤ÇĽÇĽŁĽš
+ Ľ×ĽěĽ¤¤Î¤ż¤á¤ËÉŹÍפĘĆą´üżŽšć¤ÎÁ°¸ĺ¤Îťţ´Ö¤ňˇ×ťť¤š¤ëťĹťö¤ŹťÄ¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+
+ ˇĐ¸łÂ§¤Ë¤č¤ęĄ˘Ëɸćťţ´Ö¤ÎĚó 30 Ăą°Ě¤ŹÉŹÍפǤšĄŁžÜ¤ˇ¤Ż˝Ň¤Ů¤ë¤ČĄ˘32 ĽÉĽĂ
+ ĽČ¤ňłä¤ęĹö¤Ć¤ë¤ČĹԚ礏Îɤ¤¤Î¤ĎĄ˘Âž¤ÎÁ´¤Ć¤ÎżôĂͤŹ 8 ¤Çłä¤ęŔÚ¤ě¤Ć¤¤¤ë¤Ť
+ ¤é¤Ç¤šĄŁÉ˝ź¨Îΰč¤Ë 800 ĽÉĽĂĽČĄ˘Ćą´üżŽšć¤Ë 152 ĽÉĽĂĽČťČ¤Ă¤żˇë˛ĚĄ˘1088 -
+ (800 + 152) = 136 ¤Č¤Ę¤ęĄ˘136 ĽÉĽĂĽČ¤Ź 2 ¤Ä¤Îťţ´Ö¤Î´Ö¤ňĘŹ¤ą¤Ć¤¤¤Ţ
+ ¤šĄŁ136 ¤ÎȞʏ¤Î 68 ĽÉĽĂĽČ¤Źľą¤¤¤Ć¤¤¤ëĽÉĽĂĽČ¤ČĆą´üżŽšć¤Î´Ö¤ËĂÖ¤Ť¤ě
+ ¤ĆĄ˘68 ĽÉĽĂĽČ¤ŹĆą´üżŽšć¤Î¸ĺ¤ËĂÖ¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁXconfig ĽŐĽĄĽ¤Ľë¤ÎżĺĘżĘý
+ ¸ţ¤ÎżôĂͤϟĄ¤Î¤č¤Ś¤Ë˝ń¤­¤Ţ¤šĄŁ
+
+ 800 (800+68) (800+68+152) (800+68+152+68)
+
+ ¤Ä¤Ţ¤ę
+
+ 800 868 1020 1088 ¤Č¤Ę¤ę¤Ţ¤šĄŁ
+
+ şŁĹ٤ϿâÄžĘý¸ţ¤ÎżôĂͤňˇ×ťť¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁĹö˝é¤Ť¤éżâÄžĘý¸ţ¤ÎżôĂͤ˼ɼüȤŔ
+ ¤Č¤ŤĽÉĽĂĽČĹö¤ż¤ę¤ÎĽŢĽ¤ĽŻĽíÉäȤŤ¤ÎĂą°Ě¤ňťČ¤ď¤ş¤ËŔţ¤Îżô¤ňťČ¤Ă¤Ć¤¤¤żťö¤ň
+ ť×¤¤˝Đ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ¤č¤Ă¤ĆĄ˘1 ËܤÎŔţ¤ňÉ˝ź¨¤š¤ë¤Î¤Ë¤É¤ě¤Ż¤é¤¤¤Îťţ´Ö¤ŹłÝ¤Ť
+ ¤ë¤Ť¤ňˇ×ťť¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤ł¤Îˇ×ťť¤Ď¤˝¤ě¤ž¤ě¤ÎŔţ¤Ź 1088 ĽÉĽĂĽČ¤Ç¤˝
+ ¤ě¤ž¤ě¤ÎĽÉĽĂĽČ¤Ď
+
+ (1088 ĽÉĽĂĽČ/Ŕţ) x (.025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ) = 27.2 ĽŢĽ¤ĽŻĽíÉĂ/Ŕţ¤Čˇ×ťť
+ ¤Ç¤­¤Ţ¤šĄŁ
+
+ ŔţĹö¤ż¤ę 800 ĽÉĽĂĽČÉ˝ź¨˛ÄÇ˝¤ňÁŞÂň¤ˇ¤ż¤Î¤ÇĄ˘Ľ˘ĽšĽÚĽŻĽČČ椏 4 ÂĐ 3 ¤Ë¤Ę
+ ¤ë¤č¤Ś¤ËŔţ¤Îżô¤ňÁŞÂň¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤ł¤ÎťţĄ˘800 ¤Ď 4 x 200 ¤Ę¤Î¤Ç˝ÄĘý¸ţ¤Î
+ Ŕţ¤Îżô¤Ď 3 x 200 = 600 ¤Ë¤Ę¤ë¤Ç¤ˇ¤ç¤ŚĄŁĚÜɸ˛ňÁüĹŮ¤Ď 800x600 ¤Ç¤šĄŁ
+
+ żâĞƹ´üżŽšć¤ÎČĎ°Ď¤Ď 50 ¤Ť¤é 300 ĽŢĽ¤ĽŻĽíÉäǤ˘¤ë¤ł¤Č¤ŹĘŹ¤Ť¤Ă¤Ć¤¤¤Ţ
+ ¤šĄŁÂĺɽŪ¤ĘĆą´üżŽšć¤Č¤ˇ¤Ć 150 ĽŢĽ¤ĽŻĽíÉäňÁŞÂň¤ˇ¤żžěšç¤ËĄ˘150 ĽŢĽ¤ĽŻ
+ ĽíÉäň 27.2 ĽŢĽ¤ĽŻĽíÉädzä¤ě¤Đ 1 Ćą´üżŽšćĹö¤ż¤ę¤ÎËÜżô¤Źˇ×ťť¤Ç¤­¤Ţ¤šĄŁ
+
+ (150 ĽŢĽ¤ĽŻĽíÉĂ/Ćą´üżŽšć) / (27.2 ĽŢĽ¤ĽŻĽíÉĂ/ËÜ) = 5.51 ËÜ/Ćą´üżŽšć
+
+ ¤ł¤ě¤ň 6 ËÜ/Ćą´üżŽšć¤ËŔÚ¤ęžĺ¤˛¤ë¤ł¤Č¤ÇĄĘŔÚ¤ęźÎ¤Ć¤Ď¤ˇ¤Ę¤¤¤Ç¤Ż¤Ŕ¤ľ¤¤ĄËĄ˘
+ żâĞƹ´üżŽšćÉý¤Źľá¤Ţ¤ę¤Ţ¤ˇ¤żĄŁ
+
+ ĽŐĽěĄźĽŕ¤ÎŔţ¤ÎĄĘľą¤¤¤Ć¤¤¤ëŔţ¤Čźţ°Ď¤Ë¤˘¤ëľą¤¤¤Ć¤¤¤Ę¤¤Ŕţ¤ň˛Ă¤¨¤żĄËšçˇ×ËÜ
+ żô¤ňĄĘ"ĽÓĽÇĽŞÄ´Ŕ°..." ¤Ť¤éĄËĄ˘É˝ź¨˛ÄÇ˝¤ĘŔţ¤ÎËÜżô¤č¤ę 5% Áý¤ˇ¤Îšçˇ×ËÜżô
+ ¤Č¤ˇ¤Ćͽ¤Ç¤­¤Ţ¤šĄŁ¤č¤Ă¤ĆĄ˘Ŕţ¤Îšçˇ×ËÜżô¤ĎźĄ¤Î¤č¤Ś¤Ëˇ×ťť¤ˇ¤Ţ¤šĄŁ
+
+ (600 ËÜ) x (1.05) = 630 (ĽŐĽěĄźĽŕĹö¤ż¤ę¤Îšçˇ×ËÜżô)
+
+ ¤ľ¤Ć¤ł¤ł¤ÇĄ˘ľą¤¤¤Ć¤¤¤ëŔţ (°Ę˛źĄ˘ľąŔţ) ¤Î˝Ş¤ď¤ę¤ČĽŐĽěĄźĽŕ¤Î˝Ş¤ď¤ę¤Î´Ö¤Ë
+ Ćą´üżŽšć¤ňĂÖ¤Ť¤Ę¤¤¤Č¤¤¤ą¤Ţ¤ť¤óĄŁšçˇ×¤Ç 630 ËÜĄ˘ľąŔţ¤Ź 600 ËÜĄ˘Ćą´üżŽšć
+ ¤Ë 6 Ëܤ˘¤ë¤Î¤ÇĄ˘
+
+ 630 - 600 - 6 = 24 ËܝĤę¤Ţ¤šĄŁ
+
+ ´ö¤Ä¤Ť¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ĎľąŔţ¤ÎÄž¸ĺ¤ËĆą´üżŽšć¤ňČŻšÔ¤ˇ¤Ć¤âĚäÂꤢ¤ę¤Ţ¤ť¤ó
+ ¤ŹĄ˘Âž¤Î´ö¤Ä¤Ť¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤Ç¤ĎĄ˘ľąŔţ¤ÎşÇ¸ĺ¤ČĆą´üżŽšć¤ÎşÇ˝é¤Î´Ö¤Ë 1
+ ËܤŤ 2 ËÜĘŹ´ÖłÖ¤ňĂÖ¤Ż¤Ů¤­¤Ç¤ˇ¤ç¤ŚĄŁ°ÂÁ´¤Î¤ż¤á¤Ë͞;¤ňťý¤Ă¤ĆĄ˘ľąŔţ¤ÎşÇ
+ ¸ĺ¤ČĆą´üżŽšć¤ÎşÇ˝é¤Î´Ö¤Ë 3 ËÜĘŹÄɲ䡤ޤšĄŁťÄ¤ę¤ÎËÜżô¤ňĆą´üżŽšć¤Î¸ĺ¤í
+ ¤ËÄɲ䡤ޤšĄŁżâĞƹ´üÄ´Ŕ°¤ÎżôĂͤϟĄ¤Î¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ 600 (600+3) (600+3+6) (600+3+6+21)
+
+ ¤Ä¤Ţ¤ę
+
+ 600 603 609 630
+
+ ¤Č¤Ë¤Ť¤ŻşîśČ¤ňšÔ¤Ę¤ŚÁ°¤ËĄ˘Ŕţ 1 ËÜĹö¤ż¤ę 27.2 ĽŢĽ¤ĽŻĽíÉäΝţ¤ËĽŐĽěĄźĽŕ
+ Ĺö¤ż¤ę 630 ËܤňĽÇĽŁĽšĽ×ĽěĽ¤¤ŹÉ˝ź¨¤Ç¤­¤ë¤ł¤Č¤ňłÎǧ¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť
+ ¤óĄŁŔßÄꤡ¤č¤Ś¤Č¤ˇ¤Ć¤¤¤ëš˝ŔŽ¤ÇËčÉòżĽŐĽěĄźĽŕÉ˝ź¨¤š¤ë¤Ťˇ×ťť¤ˇĄ˘ĽÇĽŁĽšĽ×
+ ĽěĽ¤¤ÎĽŢĽËĽĺĽ˘Ľë¤ÎżâĞƹ´üÂŽĹ٤˴ؤš¤ëľ­şÜ¤Č¸ŤČć¤Ů¤ë¤ł¤Č¤Ë¤č¤Ă¤ĆłÎǧ¤Ç
+ ¤­¤Ţ¤šĄŁŔţ 1 ËÜĹö¤ż¤ę 27.2 ĽŢĽ¤ĽŻĽíÉäΝţ¤ËĽŐĽěĄźĽŕĹö¤ż¤ę 630 ËÜÉ˝ź¨¤š
+ ¤ë¤ż¤á¤Ë¤ĎĄ˘630 x 27.2 = 17,136 ĽŢĽ¤ĽŻĽíÉĂ/ĽŐĽěĄźĽŕ ÉŹÍפǤšĄŁ17,136
+ ĽŢĽ¤ĽŻĽíÉĂ/ĽŐĽěĄźĽŕ ¤Ď 0.017136 ÉĂ/ĽŐĽěĄźĽŕ ¤Ä¤Ţ¤ę 1/0.017136 ĽŐĽěĄź
+ Ľŕ/ÉĂ ¤Ç¤šĄŁ
+
+ 1 / (0.017136 ÉĂ/ĽŐĽěĄźĽŕ ) = 58.4 ĽŐĽěĄźĽŕ/ÉĂ
+
+ ĽŢĽËĽĺĽ˘Ľë¤ËżâĞƹ´üÂŽĹ٤Ź 58.4 Hz ¤Č˝ń¤Ť¤ě¤Ć¤¤¤żžěšçĄ˘źă¤ˇ¤Ż¤Ď 58.4
+ Hz ¤ŹĽÇĽŁĽšĽ×ĽěĽ¤¤ÎżâĞƹ´ü˛ÄÇ˝¤ĘźţÇČżôÂÓ°č¤Ë¤˘¤ëžěšç¤ĎĚäÂꤢ¤ę¤Ţ¤ť
+ ¤óĄŁĽÇĽŁĽšĽ×ĽěĽ¤¤Ź¤ł¤ÎÂŽĹ٤ň°ˇ¤¨¤Ę¤¤žěšç¤ĎĄ˘Á´¤Ć¤Îżôťú¤ňČćÎ㤾¤ť¤ĆĽŐĽě
+ ĄźĽŕĹö¤ż¤ę¤ÎŔţ¤ÎËÜżô¤ňĘŃšš¤ˇ¤Ę¤ą¤ě¤Đ¤¤¤ą¤Ţ¤ť¤óĄŁ
+
+ ¤ľ¤Ć Xconfig ¤ÎĽĆĽšĽČš˝ŔŽ¤ňşîŔŽ¤š¤ë¤ż¤á¤Ë˛ňÁüĹ٤ȼŻĽíĽĂĽŻ¤ňšç¤ď¤ť¤Ćżĺ
+ Ęż¤ČżâÄž¤ÎÄ´Ŕ°żôĂͤňÁȚ礝¤Ţ¤ˇ¤ç¤ŚĄŁÄęľÁ¤š¤ëšÔ¤ĎźĄ¤Î¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ "800x600" 40 800 868 1020 1088 600 603 609 630
+
+ ¤ł¤ě¤Ç XFree86 ¤Îš˝ŔŽ¤Ź˝ĐÍčžĺ¤Ź¤ę¤Ţ¤ˇ¤żĄŁ¤ł¤ł¤Ç¤¤¤Ż¤Ä¤Ť˛žÄꤡ¤ż¤ł¤Č¤Ź
+ ¤Č¤Ć¤â¤Ő¤ľ¤ď¤ˇ¤Ż¤Ę¤Ż¤Ć¤Ś¤Ţ¤ŻĆ°şî¤ˇ¤Ę¤¤žěšç¤Ź¤˘¤ë¤Ť¤â¤ˇ¤ě¤Ţ¤ť¤ó¤ŹĄ˘¤Ű¤Č
+ ¤ó¤É¤ÎžěšçžŻ¤Ę¤Ż¤Č¤â°ÂÄꤡ¤żÉ˝ź¨¤Ź¤Ç¤­¤ë¤č¤Ś¤Ë¤Ę¤ę¤Ţ¤šĄŁ¤ľ¤˘Ą˘˛÷ĹŹ¤Ë¤š
+ ¤ë¤ż¤á¤Ë¤Á¤ç¤Ă¤Č¤ˇ¤żźÂ¸ł¤ň¤ä¤Ă¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ źÂşÝ¤Îˇ×ťť
+
+ ťä¤ÎĽ˘ĽŔĽ×ĽżĄźĽŤĄźĽÉ¤Ź 40 MHz ¤Îżĺž˝ČŻżŽťŇ¤ňĹëşÜ¤ˇ¤Ć¤¤¤ë¤Î¤ÇĄ˘źţÇČżô¤ň
+ 40 MHz ¤Ť¤éťĎ¤á¤Ţ¤ˇ¤ç¤ŚĄŁťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎşÇšâżĺʿƹ´üźţÇČżô¤Ź 37 KHz
+ ¤Ę¤é¤ĐĄ˘ŔţĹö¤ę¤ÎşÇžŽĽÉĽĂĽČĽŻĽíĽĂĽŻ¤Ď 40,000,000/37,000 = 1081 ¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎżâĞƹ´üźţÇČżô¤Ď 50 Hz ¤Ť¤é 90 Hz ¤Ţ¤Ç¤ÎČϰϤÇ
+ ¤šĄŁ
+
+ ťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĽŢĽËĽĺĽ˘Ľë¤Ë¤č¤ě¤ĐşÇÂç¤Îżĺʿƹ´üżŽšć¤Ď 3.92 ĽŢĽ¤ĽŻĽí
+ ÉäǤšĄŁĽÉĽĂĽČĹö¤ę 0.025 ĽŢĽ¤ĽŻĽíÉäΞěšçĄ˘żŽšć¤Ď
+
+ (3.92 ĽŢĽ¤ĽŻĽíÉĂ) / (.025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ) = 156.8 ĽÉĽĂĽČ¤Ë¤Ę¤ę¤Ţ
+ ¤šĄŁ
+
+ ¤ł¤ě¤ňşÇ¤âśá¤¤ 8 ¤ÎÇÜżô¤ËŔÚ¤ęžĺ¤˛¤ĆĄ˘160 ĽÉĽĂĽČ¤Ë¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤Ţ¤żĽŢĽËĽĺĽ˘Ľë¤Ë¤č¤ě¤ĐşÇ¸ĺ¤Ëľą¤¤¤żĽÉĽĂĽČ¤ČĆą´üżŽšć¤ÎťĎ¤Ţ¤ę¤Î´Ö¤ËşÇÄă
+ 0.67 ĽŢĽ¤ĽŻĽíÉĂ´ÖłÖ¤ňĂÖ¤Ż¤Ů¤­¤Č˛ňŔ⤡¤Ć¤¤¤Ţ¤šĄŁ 40 MHz ¤Îťţ 0.67 ĽŢĽ¤
+ ĽŻĽíÉäǽФť¤ëĽÉĽĂĽČżô DĄĘ 40 MHz ¤Ď .025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ¤Ç¤˘¤ë¤ł¤Č
+ ¤ňłĐ¤¨¤Ć¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄË¤Ď
+
+ D ĽÉĽĂĽČ = (0.67 ĽŢĽ¤ĽŻĽíÉĂ) / (.025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ) = 26.8 ĽÉĽĂĽČ
+ ¤Ë¤Ę¤ę¤Ţ¤šĄŁ
+
+ 26.8 ¤Ď 8 ¤ÎÇÜżô¤Ç¤Ď¤Ę¤¤¤Î¤ÇĄ˘32 ĽÉĽĂĽČ¤ËŔÚ¤ęžĺ¤˛¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĽŢĽËĽĺĽ˘Ľë¤Ë¤č¤ě¤ĐĆą´üżŽšć¤Î¸ĺ¤Î´ÖłÖ¤ň 3.56 ĽŢĽ¤ĽŻĽí
+ É䍤˝¤ě°ĘžĺĂÖ¤Ż¤Ů¤­¤Ç¤˘¤ë¤Č˝ń¤¤¤Ć¤¤¤Ţ¤šĄŁ3.56 ĽŢĽ¤ĽŻĽíÉäǤμɼüȿô
+ D ¤Ď
+
+ D ĽÉĽĂĽČ = (3.56 ĽŢĽ¤ĽŻĽíÉĂ) / (.025 ĽŢĽ¤ĽŻĽíÉĂ/ĽÉĽĂĽČ) = 142.4 ĽÉĽĂĽČ
+
+ 8 ¤ÎÇÜżô¤Ë¤Ę¤ë¤č¤Ś¤Ë 142.4 ¤ň 144 ¤ËŔÚ¤ęžĺ¤˛¤Ć˛ź¤ľ¤¤ĄŁ
+
+ żĺĘżŔţ¤Î¤ż¤á¤Ë 800 ¤Îľą¤ŻĽÉĽĂĽČĄ˘ľą¤ŻĽÉĽĂĽČ¤ČĆą´üżŽšć¤Î´Ö¤Ë 32 ĽÉĽĂ
+ ĽČĄ˘Ćą´üżŽšć¤Î¤ż¤á¤Î 152 ĽÉĽĂĽČĄ˘Ćą´üżŽšć¤Î¸ĺ¤Ë 144 ĽÉĽĂĽČ¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ 800 + 32 + 160 + 144 = 1136
+
+ 1 ËܤÎŔţ¤Ë 1136 ĽÉĽĂĽČťČ¤Ă¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ě¤ĎÁ°¤Ëˇ×ťť¤ˇ¤ż 1088 ¤č¤ęÂ礭¤¤
+ ¤Ç¤š¤ŹĄ˘1088 ¤ĎŔţ¤ňşî¤ëĽÉĽĂĽČżô¤Î *şÇžŽ¤Î* żô¤Ç¤˘¤ë¤ł¤Č¤ňť×¤¤˝Đ¤ˇ¤Ć˛ź
+ ¤ľ¤¤ĄŁ¤Ç¤š¤Ť¤éŔţĹö¤ę 1136 ĽÉĽĂĽČ¤ĎÂč°ěĘâ¤Č¤ˇ¤Ć¤Ď¤¤¤¤¤Č¤ł¤í¤Ç¤ˇ¤ç¤ŚĄŁ
+
+ Xconfig ¤Ëľ­Ćţ¤š¤ëżôĂͤϥ˘źĄ¤Î¤č¤Ś¤Ë
+
+ "800x?" 40 800 (800+32) (800+32+160) (800+32+160+144)...
+
+ ¤Ţ¤ż¤Ď
+
+ "800x?" 40 800 832 992 1136... ¤Č¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ 28.4 ĽŢĽ¤ĽŻĽíÉóݤŤ¤ë¤ł¤Č¤ňÉ˝¤ˇ¤Ć¤¤¤Ţ¤šĄŁ
+
+ żĺĘż˛ňÁüĹŮ¤Ë 800 ĽÉĽĂĽČ/ËÜ ¤ňˇč¤á¤ż¤Î¤ÇĄ˘żâÄž˛ňÁüĹŮ¤Ë 600 ËÜ/ĽŐĽěĄźĽŕ
+ ¤ňˇč¤á¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤ÎĽŢĽËĽĺĽ˘Ľë¤Ë¤č¤ë¤ČżâĞƹ´üżŽšć¤ĎşÇÄă 64 ĽŢĽ¤ĽŻĽíÉĂÉŹ
+ ÍפȽń¤¤¤Ć¤¤¤Ţ¤šĄŁ 64 ĽŢĽ¤ĽŻĽíÉäÇŔţ¤ň°ú¤Ż¤ČËÜżô¤Ď
+
+ (64 ĽŢĽ¤ĽŻĽíÉĂ/Ćą´üżŽšć) / (28.4 ĽŢĽ¤ĽŻĽíÉĂ/ËÜ) = 2.25 ËÜ/Ćą´üżŽšć¤Č¤Ę
+ ¤ę¤Ţ¤šĄŁ
+
+ żâĞƹ´üżŽšć¤Î¤ż¤á¤Ë 2.25 ¤ň 3 ËܤËŔÚ¤ęžĺ¤˛¤Ć˛ź¤ľ¤¤ĄŁ
+
+ ĽŢĽËĽĺĽ˘Ľë¤Ë¤č¤ě¤ĐşÇ¸ĺ¤ËÉ˝ź¨¤ˇ¤żŔţ¤ČĆą´üżŽšć¤ÎłŤťĎĹŔ¤Î´Ö¤ËşÇÄă 318 ĽŢ
+ Ľ¤ĽŻĽíÉĂĄ˘Ćą´üżŽšć¤Î˝ŞÎť¸ĺ¤ÎĂŮąä¤ňşÇÄă 630 ĽŢĽ¤ĽŻĽíÉäδֳ֤ňĂÖ¤Ż¤č¤Ś
+ ¤Ë˝ń¤Ť¤ě¤Ć¤¤¤Ţ¤šĄŁ¤˝¤ě¤ž¤ě¤Îśč´Ö¤Ç˛żËÜĄ˘Ŕţ¤Ź°ú¤ą¤ë¤Ť¤ňźĄ¤Ëˇ×ťť¤ˇ¤Ţ¤šĄŁ
+
+ (318 ĽŢĽ¤ĽŻĽíÉĂ) / (28.4 ĽŢĽ¤ĽŻĽíÉĂ/ËÜ) = 11.20 ËÜ
+
+ (630 ĽŢĽ¤ĽŻĽíÉĂ) / (28.4 ĽŢĽ¤ĽŻĽíÉĂ/ËÜ) = 22.18 ËÜ
+
+ Ćą´üżŽšć¤ÎÁ°¤Î´ÖłÖ¤ň 12 ËÜĄ˘¸ĺ¤Î´ÖłÖ¤ň 23 Ëܤ˴ݤá¤Ţ¤šĄŁ¤ł¤ě¤ÇżâĞĴŔ°
+ ¤ÎżôĂͤŹˇčÄꤡ¤Ţ¤ˇ¤żĄŁ
+
+ 600 (600+12) (600+12+3) (600+12+3+23)
+
+ ¤š¤Ę¤ď¤Á
+
+ 600 612 615 638 ¤Č¤Ę¤ę¤Ţ¤šĄŁ
+
+ ¤ł¤ÎĽŐĽěĄźĽŕźţÇČżô¤ŹĽÇĽŁĽšĽ×ĽěĽ¤¤ÎÇ˝ÎϤ˚ç¤Ă¤Ć¤¤¤ë¤ł¤Č¤ňłÎ¤Ť¤á¤ë¤ż¤áĄ˘
+ ĽŐĽěĄźĽŕźţÇČżô¤ŹĄ˘ 28.4 ĽŢĽ¤ĽŻĽíÉĂ/ËܤΝţ 638 ËÜ/ĽŐĽěĄźĽŕ¤Ď 18,119 ĽŢ
+ Ľ¤ĽŻĽíÉĂ/ ĽŐĽěĄźĽŕ¤Ç¤˘¤ęĄ˘55.19 ĽŐĽěĄźĽŕ/Éäˤʤ뤳¤Č¤ňłÎǧ¤ˇ¤Ć¤Ż¤Ŕ¤ľ
+ ¤¤ĄŁťä¤ÎĽÇĽŁĽšĽ×ĽěĽ¤¤Ď 50 Hz ¤Ť¤é 90 Hz ¤Ţ¤Ç¤ÎÁ´¤Ć¤ÎźţÇČżô¤ň°ˇ¤¨¤ë¤Î¤Ç
+ ĚäÂꤢ¤ę¤Ţ¤ť¤óĄŁ
+
+ ˛ňÁüĹŮĄ˘ĽŻĽíĽĂĽŻĄ˘żĺĘżĘý¸ţ¤ČżâÄžĘý¸ţ¤ÎÄ´Ŕ°żôĂͤň Xconfig ĽŐĽĄĽ¤Ľë¤ÎĽÓ
+ ĽÇĽŞĽâĄźĽÉ¤ÎšÔ¤ËźĄ¤ÎÍͤ˾­Ćţ¤ˇ¤Ć˛ź¤ľ¤¤ĄŁ
+
+ "800x600" 40 800 832 992 1136 600 612 615 638
+
+ ¤ł¤ě¤Źťä¤Źťî¤ˇ¤żşÇ˝é¤ÎĽÓĽÇĽŞĽâĄźĽÉ¤Ç¤šĄŁ¤Á¤é¤Ä¤­¤Ź¤Ň¤É¤š¤Ž¤ĆĄ˘¤Č¤Ć¤âËţ
+ ­¤Ç¤­¤ë¤â¤Î¤Ç¤Ď¤Ę¤¤¤Î¤Çťß¤á¤Ţ¤ˇ¤żĄŁ¤ł¤ÎŔßÄę¤ÎÄ´Ŕ°żôĂͤňžĺ¤˛¤ż¤ę˛ź¤˛¤ż
+ ¤ę¤š¤ëÎă¤ňźĄ¤Ť¤éŔâĚŔ¤ˇ¤Ţ¤šĄŁ¤Á¤é¤Ä¤­¤Č˛ňÁüĹ٤δ֤ÎŔޤęšç¤¤¤ň¤Ä¤ą¤ĆşÇ˝Ş
+ ĹŞ¤Ë "784x614" ¤ËŔßÄꤡ¤Ţ¤ˇ¤żĄŁ
+
+ ¤Ű¤Č¤ó¤ÉÁ´¤Ć¤ÎĽŻĽíĽĂĽŻ¤ÎźţÇČżô¤Ď 40 MHz ¤Ç¤˘¤ë¤ł¤Č¤ËĂí°Ő¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+ źÂ¸ł¤ňÄ̤ˇ¤Ć¤č¤ęšâ¤¤źţÇČżô¤Ďťä¤ÎĽ˘ĽŔĽ×ĽżĄźĽŤĄźĽÉ¤ÎÇ˝ÎϤňÄś¤¨¤Ć¤Ş¤ęĄ˘¤č
+ ¤ęÄ㤤źţÇČżô¤Ďťä¤ÎËž¤ŕ˛ňÁüĹ٤ňÍż¤¨¤ë¤â¤Î¤Ç¤Ď¤Ę¤¤¤Č¤¤¤Ś¤ł¤Č¤ŹĘŹ¤Ť¤ę¤Ţ¤ˇ
+ ¤żĄŁ
+
+ Îă : ťä¤Źťî¤ˇ¤żżôĂͤǤš :
+
+ # źĄ¤ÎšÔ¤ĎĆ°¤Ż¤ą¤ě¤ÉĂćż´¤Ť¤éąŚ¤Ë´ó¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+ "752x564" 40 752 784 944 1088 564 567 569 611
+ # 44.5 752 792 976 1240 564 567 570 600
+ #
+ # ¤ł¤ÎšÔ¤ĎÁ°¤ÎšÔ¤Ç¤˘¤Ă¤żĚäÂę¤ň˝¤Ŕľ¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+ #"752x564" 40 752 816 976 1088 564 567 569 611
+ #
+ # żâÄžĘý¸ţ¤ÎÉ˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ #"752x614" 40 752 816 976 1088 614 617 619 661
+ #
+ # żĺĘżĘý¸ţ¤ÎÉ˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ #"784x564" 40 784 816 976 1088 564 567 569 611
+ #
+ # źĄ¤âĆ°¤­¤Ţ¤š¤ŹĄ˘Ăćż´¤Ť¤éąŚ¤Ë´ó¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+ #"784x614" 40 784 816 976 1088 614 617 619 661
+ #
+ # ÄžÁ°¤ÎÎă¤ÎĂćż´¤Ë¤­¤Ć¤¤¤Ę¤¤ĚäÂę¤ň˝¤Ŕľ¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+ "784x614" 40 784 848 1008 1088 614 617 619 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤Ś
+ # źĄ¤âĆ°¤­¤Ţ¤š¤ŹĄ˘Ăćż´¤Ť¤é¤ď¤ş¤Ť¤Ëş¸¤Ë´ó¤Ă¤Ć¤¤¤Ţ¤šĄŁ
+ #"800x614" 40 800 864 1024 1088 614 617 619 661
+ #
+ # ÄžÁ°¤ÎŔßÄę¤ÎĂćż´¤Ë¤­¤Ć¤¤¤Ę¤¤ĚäÂę¤ň˝¤Ŕľ¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ
+ "800x614" 40 800 864 1024 1104 614 617 619 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ "816x614" 40 816 880 1040 1120 614 617 619 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ "800x620" 40 800 864 1024 1104 620 623 625 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ "816x620" 40 816 880 1040 1120 620 623 625 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňÁý¤ä¤ˇ¤Ć¤ß¤Ţ¤ˇ¤ç¤ŚĄ˘¤ł¤ě¤ĎĆ°şî¤ˇ¤Ţ¤šĄŁ
+ "832x630" 40 832 896 1056 1136 630 633 635 661
+ #
+ # É˝ź¨¤ÎÂ礭¤ľ¤ňĘѤ¨¤Ţ¤ˇ¤żĄ˘Ć°¤­¤Ţ¤š¤Źˇă¤ˇ¤Ż¤Á¤é¤Ä¤­¤Ţ¤šĄŁ
+ "848x618" 40 848 912 1072 1152 618 621 623 661
+
+ 12. É˝ź¨¤ÎĚäÂ꽤Ŕľ
+
+ ¤ľ¤˘Ą˘ X ¤Îš˝ŔŽÄęľÁ¤ÎżôĂͤňźę¤ËĆţ¤ě¤Ţ¤ˇ¤żĄŁXconfig ¤Ë ¤˝¤ÎżôĂͤňĽĆĽšĽČ
+ Ăć¤ÎĽłĽáĽóĽČ¤ň¤Ä¤ą¤Ć˝ń¤­¤Ţ¤ˇ¤żĄŁX ¤ňΊ¤Á¤˘¤˛Ą˘ĽŰĽĂĽČĽ­Ąź¤Çżˇ¤ˇ¤¤ĽâĄźĽÉ
+ ¤ËŔÚ¤ęÂؤ¨¤Ć¤ß¤Ţ¤ˇ¤ż ... ¤ˇ¤Ť¤ˇ˛čÁü¤ŹĘѤǤšĄŁ¤ł¤Ś¤¤¤ŚžěšçĄ˘¤É¤Ś¤š¤ě¤Đ
+ ¤¤¤¤¤Î¤Ç¤ˇ¤ç¤ŚĄŠ°ěČĚĹŞ¤ĘĚäÂę¤Č˛ňˇčşö¤ň¤ł¤ł¤Ëľó¤˛¤Ţ¤šĄŁ
+
+ Ćą´üżŽšć¤ÎÄ´Ŕ°¤ňĘѤ¨¤Ć˛čÁü¤ň *°ÜĆ°* ¤ˇ¤Ć¤ß¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁĽŐĽěĄźĽŕÄš¤ňĘѤ¨
+ ¤Ć˛čÁü¤ň *łČÂç˝ĚžŽ* ¤ˇ¤Ć˛ź¤ľ¤¤ĄĘÁęÂĐĹŞ¤Ę°ĚĂÖ¤ň¤˝¤Î¤Ţ¤Ţ¤ËĆą´üżŽšć¤ň°ÜĆ°
+ ¤š¤ëÉŹÍפŹ¤˘¤ę¤Ţ¤šĄŁ¤˝¤Ś¤ˇ¤Ę¤¤¤ČłČÂç˝ĚžŽ¤ČĆąťţ¤Ë˛čÁü¤Î°ÜĆ°¤âľŻ¤ł¤Ă¤Ć¤ˇ
+ ¤Ţ¤¤¤Ţ¤šĄËĄŁ¤â¤ŚžŻ¤ˇ¸ÄĘ̤ÎÂĐ˝čĘýËĄ¤ňźĄ¤Ëź¨¤ˇ¤Ţ¤šĄŁ:
+
+ żĺĘż¤ČżâÄž¤ÎÉ˝ź¨°ĚĂÖ¤ĎĆČΊ¤ˇ¤Ć¤¤¤Ţ¤šĄŁ¤ł¤ě¤Ď˛čÁü¤ňżĺĘż¤Ë°ÜĆ°¤ľ¤ť¤Ć¤âżâ
+ Äž°ĚĂ֤ˤϹƜÁ¤Ź¤Ę¤ŻĄ˘¤Ţ¤żľŐ¤âĆą¤¸¤Č¤¤¤Ś¤ł¤Č¤Ç¤šĄŁ¤Č¤ł¤í¤ŹłČÂç˝ĚžŽ¤Ç¤Ď
+ ÉŹ¤ş¤ˇ¤â¤˝¤Ś¤Ç¤Ď¤˘¤ę¤Ţ¤ť¤óĄŁżĺĘżĘý¸ţ¤ÎÂ礭¤ľ¤ňĘѤ¨¤Ć¤âżâÄžĘý¸ţ¤ÎÂ礭¤ľ
+ ¤Ë¤Ď˛ż¤âąĆśÁ¤ňÍż¤¨¤şĄ˘ľŐ¤âĆą¤¸¤Ç¤š¤ŹĄ˘˝Ä˛ŁÎžĘý¤ÎĘŃššÎ̤Κçˇ×¤Ď¸ÂÄꤾ¤ě
+ ¤Ć¤¤¤Ţ¤šĄŁĆä˥˘˝Ä˛Ł¤ËÂ礭˛á¤Ž¤żžěšç¤Ď¤č¤ęšâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ËĘŃšš¤ˇ¤Ć
+ ˝¤Ŕľ¤š¤ëÉŹÍפŹ¤˘¤ë¤Ç¤ˇ¤ç¤ŚĄŁťČÍѲÄÇ˝¤Ę˛ňÁüĹ٤ň°ú¤­žĺ¤˛¤ë¤ł¤Č¤Ë¤Ę¤ë¤ż
+ ¤áĄ˘¤ł¤ě¤Ď¤á¤Ă¤ż¤ËĚäÂę¤Č¤Ď¤Ę¤ę¤Ţ¤ť¤óĄŁ
+
+ ˛čÁü¤Źş¸¤ŤąŚ¤Ë¤ş¤ě¤Ć¤¤¤ëžěšç
+
+ ¤ł¤ě¤ň˝¤Ŕľ¤š¤ë¤ż¤á¤Ëżĺʿƹ´üżŽšć¤ň°ÜĆ°¤ˇ¤Ţ¤ˇ¤ç¤ŚĄŁ¤˝¤ě¤Ďżĺʿƹ´üżŽšć¤Î
+ łŤťĎĂź¤Č˝ŞÎťĂź¤ňÄęľÁ¤ˇ¤Ć¤¤¤ëżĺʿĴŔ°ÉôĘŹ¤Î 2 ¤Ä¤ÎżôĂͤοż¤óĂć¤ÎżôĂͤň
+ ĄĘ 8 ¤ÎÇÜżô¤ş¤ÄĄËÁý¸ş¤ľ¤ť¤ĆšÔ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ˛čÁü¤Źş¸¤Ë¤ş¤ě¤Ć¤¤¤ëĄĘąŚ¤Îąď¤ÎÉôĘŹ¤ŹÂ礭¤š¤Ž¤ĆĄ˘ąŚ¤Ř˛čÁü¤ň°ÜĆ°¤ˇ¤ż¤¤ĄË
+ ťţ¤ĎĄ˘żôĂͤňÁý¤ä¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˛čÁü¤ŹąŚ¤Ë¤ş¤ě¤Ć¤¤¤ëĄĘş¸¤Îąď¤ÎÉôĘŹ¤ŹÂ礭
+ ¤š¤Ž¤ĆĄ˘ş¸¤Ř˛čÁü¤ň°ÜĆ°¤ˇ¤ż¤¤ĄËťţ¤ĎĄ˘Ćą´üżŽšć¤ň¸ş¤é¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ˛čÁü¤Źžĺ˛ź¤ËĆ°¤¤¤Ć¤¤¤ëžěšç
+
+ ¤ł¤ě¤ň˝¤Ŕľ¤š¤ë¤ż¤á¤ËżâĞƹ´üżŽšć¤ň°ÜĆ°¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ě¤ĎżâĞƹ´üżŽšć
+ ¤ÎłŤťĎĂź¤Č˝ŞÎťĂź¤ňÄęľÁ¤ˇ¤Ć¤¤¤ëżâĞĴŔ°ÉôĘŹ¤Î 2 ¤Ä¤ÎżôĂͤοż¤óĂć¤ÎżôĂÍ
+ ¤ňÁý¸ş¤ľ¤ť¤ĆšÔ¤¤¤Ţ¤ˇ¤ç¤ŚĄŁ
+
+ ˛čÁü¤Źžĺ¤Ë¤ş¤ě¤Ć¤¤¤ëĄĘ˛ź¤Îąď¤ÎÉôĘŹ¤ŹÂ礭¤š¤Ž¤ĆĄ˘˛ź¤Ë˛čÁü¤ň°ÜĆ°¤ˇ¤ż¤¤ĄË
+ ťţ¤ĎĄ˘żôĂͤň¸ş¤é¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ˛čÁü¤Ź˛ź¤Ë¤ş¤ě¤Ć¤¤¤ëĄĘžĺ¤Îąď¤ÎÉôĘŹ¤ŹÂ礭
+ ¤š¤Ž¤ĆĄ˘žĺ¤Ř˛čÁü¤ň°ÜĆ°¤ˇ¤ż¤¤ĄËťţ¤ĎĄ˘żôĂͤňÁý¤ä¤ˇ¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ˛čÁü¤ŹżĺĘżĘý¸ţ¤Ëš­¤š¤Ž¤ëĄĘśš¤š¤Ž¤ëĄËžěšç
+
+ ¤ł¤ě¤ň˝¤Ŕľ¤š¤ë¤ż¤á¤Ë¤ĎżĺĘżĽŐĽěĄźĽŕÄš¤ňÁý¤ä¤ˇĄĘ¸ş¤é¤ˇĄË¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ě
+ ¤ĎşÇ˝é¤ÎÄ´Ŕ°ÉôĘŹ¤Î 4 ČÖĚܤοôĂͤňĘѤ¨¤ĆšÔ¤¤¤Ţ¤šĄŁ˛čÁü¤Ź°ÜĆ°¤š¤ë¤Î¤ň˛ó
+ Čň¤š¤ë¤ż¤áĄ˘Ćą´üżŽšćĄĘ 2 ČÖĚÜ¤Č 3 ČÖĚܤοôĂͥˤ⤽¤ÎȞʏ¤Ŕ¤ą°ÜĆ°¤ˇĄ˘Ćą
+ ¤¸ÁęÂĐ°ĚĂÖ¤ňĘݸ¤ˇ¤Ć¤Ş¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ˛čÁü¤ŹżâÄžĘý¸ţ¤ËËĤé¤ó¤Ç¤¤¤ëĄĘÁ餝¤Ć¤¤¤ëĄËžěšç
+
+ ¤ł¤ě¤ň˝¤Ŕľ¤š¤ë¤ż¤á¤Ë¤ĎżâÄžĽŐĽěĄźĽŕÄš¤ň¸ş¤é¤ˇĄĘÁý¤ä¤ˇĄË¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ¤˝¤ě
+ ¤Ď 2 ČÖĚܤÎÄ´Ŕ°ÉôĘŹ¤Î 4 ČÖĚܤοôĂͤňĘѤ¨¤ĆšÔ¤¤¤Ţ¤šĄŁ˛čÁü¤Ź°ÜĆ°¤š¤ë¤Î¤ň
+ ˛óČň¤š¤ë¤ż¤áĄ˘Ćą´üżŽšćĄĘ 2 ČÖĚÜ¤Č 3 ČÖĚܤοôĂͤǥˤ⤽¤ÎȞʏ¤Ŕ¤ą°ÜĆ°
+ ¤ˇĄ˘Ćą¤¸ÁęÂĐ°ĚĂÖ¤ňĘݸ¤ˇ¤Ć¤Ş¤¤¤Ć¤Ż¤Ŕ¤ľ¤¤ĄŁ
+
+ ¤ł¤ě¤é¤Îľť˝Ń¤ÎÁȚ礝¤Ç¤âźč¤ě¤Ę¤¤Âž¤ÎĎĤߤĎ¿ʏ¤â¤Ă¤Č´đËÜĹŞ¤ĘÉôĘŹ¤Ź°ă¤Ă
+ ¤Ć¤¤¤ëĄ˘Î㤨¤Đˇ×ťť°ă¤¤¤Č¤ŤĽâĽËĽżĄź¤ÇťČ¤¨¤Ę¤¤šâ¤¤ĽÉĽĂĽČĽŻĽíĽĂĽŻ¤ňťČ¤Ă¤Ć
+ ¤¤¤ë¤č¤Ś¤Ęžěšç¤Ź¤˘¤ę¤Ţ¤šĄŁ
+
+ şÇ¸ĺ¤ËĄ˘ĽŐĽěĄźĽŕÄš¤Î¤É¤Á¤é¤Ť¤ÎżôĂͤňÁý¤ä¤ť¤ĐşĆÉÁ˛čÂŽĹ٤ŹÄ㲟¤ˇ¤Ć¤ˇ¤Ţ¤Ś
+ ¤ł¤ČĄ˘¤Ţ¤ż¤˝¤ÎľŐ¤â¸Ŕ¤¨¤ë¤ł¤Č¤ňłĐ¤¨¤Ć¤Ş¤¤¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.8 1996/02/04 09:08:28 dawes Exp
+
+ $XConsortium: VidModes.sgml /main/6 1995/11/12 20:00:16 kaleb $
+
+ ______________________________________________________________________
+
+ ¤ł¤ÎĽŐĽĄĽ¤Ľë¤Ď xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v
+ 3.8 1996/02/04 09:08:28 ¤ňĄ˘ ˛ŹËÜ °ěšŹ ( Kazuyuki Okamoto
+ <ikko-@pacific.rim.or.jp> <mailto:ikko-@pacific.rim.or.jp> ) ¤Ź
+ XFree86 3.2 ¤ňĆüËܤǼ¤ĽóĽšĽČĄźĽë¤š¤ëżÍ¸ţ¤ą¤ËĎÂĚő¤ˇ¤ż¤â¤Î¤Ç¤šĄŁ¤ł¤ł¤Ź¤Ş
+ ¤Ť¤ˇ¤¤¤Č¤ŤĄ˘¤ł¤ł¤Ď¤ł¤Ś¤ˇ¤ż¤Ű¤Ś¤Ź¤¤¤¤¤Č¤¤¤Ă¤ż¤´°Ő¸Ť¤Ź¤˘¤ę¤Ţ¤ˇ¤ż¤éĄ˘ĹĹťŇ
+ ĽáĄźĽë¤Ç¤ŞĂΤ餝˛ź¤ľ¤¤ĄŁ¸śĘ¸¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Ë¤˘¤ę¤Ţ
+ ¤šĄŁ¤ł¤ÎĎÂĚő¤ÎĂřşî¸˘¤Ď XFree86 Ľ×ĽíĽ¸Ľ§ĽŻĽČźŇ¤Č˛ŹËÜ °ěšŹ¤Ë¤˘¤ę¤Ţ¤š¤ŹĄ˘
+ ¤ł¤ÎĎÂĚő¤ÎÉÔśńšç¤Ďťä¤ËĄ˘ĹŝҼᥟĽë¤ÇÁ÷¤Ă¤Ć˛ź¤ľ¤¤ĄŁ
+
+ XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Japanese/VidModes.sgml,v 3.9 1996/11/10 20:37:59 dawes Exp
+
+ ______________________________________________________________________
+
+ [EOF]
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/LICENSE b/xc/programs/Xserver/hw/xfree86/doc/LICENSE
new file mode 100644
index 000000000..95cf9e47c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/LICENSE
@@ -0,0 +1,558 @@
+ Licenses
+
+ The XFree86 Project
+
+ 1999
+
+1. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following copy-
+right/license:
+
+Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from the XFree86
+Project.
+
+2. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights:
+
+2.1 X Consortium
+
+Copyright (C) 1996 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+2.2 Berkeley-based copyrights:
+
+2.2.1 General
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
+CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+2.2.2 UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software devel-
+oped by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without modifica-
+tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes soft-
+ ware developed by the University of California, Berkeley and its con-
+ tributors.
+
+ 4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
+CLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+2.3 NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as
+design patents pending on the design and interface of the NV chips. Users
+and possessors of this source code are hereby granted a nonexclusive, roy-
+alty-free copyright and design patent license to use this code in individual
+and commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S.
+and foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WAR-
+RANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAM-
+AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.
+
+2.4 GLX Public License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge, pub-
+lish, distribute, sublicense and/or sell copies of Subject Software (defined
+below), and to permit persons to whom the Subject Software is furnished in
+accordance with this License to do the same, subject to all of the following
+terms and conditions, which Recipient accepts by engaging in any such use,
+copying, modifying, merging, publishing, distributing, sublicensing or sell-
+ing:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code
+ which is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the sub-
+ stance or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of
+ files, a Modification means (i) any addition to or deletion from
+ the contents of a file containing Original Software or previous
+ Modifications and (ii) any new file that contains any part of the
+ Original Code or previous Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications
+ or the combination of the Original Software and Modifications, or
+ portions of any of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising
+ rights under, and complying with all of the terms of, this License.
+ For legal entities, "Recipient" includes any entity which controls,
+ is controlled by, or is under common control with Recipient. For
+ purposes of this definition, "control" of an entity means (a) the
+ power, direct or indirect, to direct or manage such entity, or (b)
+ ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's
+choice, which may contain terms different from this License, provided that
+(i) Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13
+of this License, which terms may not be modified or superseded by any other
+terms of such license. If Recipient distributes the source code version under
+a different license Recipient must make it absolutely clear that any terms
+which differ from this License are offered by Recipient alone, not by SGI.
+Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as
+a result of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes
+the user's rights relating to the Subject Software. Recipient may distribute
+the executable version of Subject Software under a license of Recipient's
+choice, which may contain terms different from this License, provided that
+(i) Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other
+terms of such license. If Recipient distributes the executable version under
+a different license Recipient must make it absolutely clear that any terms
+which differ from this License are offered by Recipient alone, not by SGI.
+Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as
+a result of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to
+cure such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to
+the OpenGL API or to any software or hardware implementation thereof or to
+any other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original Soft-
+ware at all times remains with SGI. All rights in the Original Software not
+expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of
+the Subject Software, including but not limited to, all export and import
+control laws and regulations of the U.S. government and other countries.
+Recipient may not distribute Subject Software that (i) in any way infringes
+(directly or contributorily) the rights (including patent, copyright, trade
+secret, trademark or other intellectual property rights of any kind) of any
+other person or entity or (ii) breaches any representation or warranty,
+express, implied or statutory, which under any applicable law it might be
+deemed to have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribu-
+tion, import or sale of Subject Software (including particular functionality
+or code incorporated in Subject Software) infringes the third party's intel-
+lectual property rights, Recipient must place in a well-identified web page
+bearing the title "LEGAL" a description of each such claim and a description
+of the party making each such claim in sufficient detail that a user of the
+Subject Software will know whom to contact regarding the claim. Also, upon
+gaining such knowledge of any such claim, Recipient must conspicuously
+include the URL for such web page in the Exhibit A notice required under Sec-
+tions 2 and 3, above, and in the text of any related documentation, license
+agreement or collateral in which Recipient describes end user's rights relat-
+ing to the Subject Software. If Recipient obtains such knowledge after it
+makes Subject Software available to any other person or entity, Recipient
+shall take other steps (such as notifying appropriate mailing lists or news-
+groups) reasonably calculated to inform those who received the Subject Soft-
+ware that new knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER-
+CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER-
+VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THE-
+ORY, WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIA-
+BILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR
+ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES,
+SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc.
+from and against any loss, liability, damages, costs or expenses (including
+the payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End
+Users acquire only the rights set forth in this License and are subject to
+the terms of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be unen-
+forceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a con-
+tract shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and
+13 of the GLX Public License Version 1.0 (the "License"). You may not use
+this file except in compliance with those sections of the License. You may
+obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services,
+2011 N. Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis.
+ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February,
+1999. The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are Copy-
+right (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+
+2.5 CID Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge, pub-
+lish, distribute, sublicense and/or sell copies of Subject Software (defined
+below) in both source code and executable form, and to permit persons to whom
+the Subject Software is furnished in accordance with this License to do the
+same, subject to all of the following terms and conditions, which Recipient
+accepts by engaging in any such use, copying, modifying, merging, publica-
+tion, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code
+ that is described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the sub-
+ stance or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of
+ files, a Modification means (i) any addition to or deletion from
+ the contents of a file containing Original Software or previous
+ Modifications and (ii) any new file that contains any part of the
+ Original Code or previous Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications
+ or the combination of the Original Software and Modifications, or
+ portions of any of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising
+ rights under the terms of this License. For legal entities, "Recip-
+ ient" includes any entity that controls, is controlled by, or is
+ under common control with Recipient. For purposes of this defini-
+ tion, "control" of an entity means (i) the power, direct or indi-
+ rect, to direct or manage such entity, or (ii) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial own-
+ ership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to
+ this License.
+
+ f. "Accompanying Technology" means any software or other technology
+ that is not a Modification and that is distributed or made publicly
+ available by Recipient with the Subject Software. Separate soft-
+ ware files that do not contain any Original Software or any previ-
+ ous Modification shall not be deemed a Modification, even if such
+ software files are aggregated as part of a product, or in any
+ medium of storage, with any file that does contain Original Soft-
+ ware or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made sub-
+ject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying Tech-
+nology are described. Distributions of Subject Software in source code form
+must also include the Required Notice in every file distributed. In addition,
+a ReadMe file entitled "Important Legal Notice" must be distributed with each
+distribution of one or more files that incorporate Subject Software. That
+file must be included with distributions made in both source code and exe-
+cutable form. A copy of the License and the Required Notice must be included
+in that file. Recipient may distribute Accompanying Technology under a
+license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms
+of this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the distri-
+bution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to
+cure such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or ser-
+vice mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the Origi-
+nal Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of
+the Subject Software, including but not limited to, all export and import
+control laws and regulations of the U.S. government and other countries.
+Recipient may not distribute Subject Software that (i) in any way infringes
+(directly or contributorily) the rights (including patent, copyright, trade
+secret, trademark or other intellectual property rights of any kind) of any
+other person or entity, or (ii) breaches any representation or warranty,
+express, implied or statutory, which under any applicable law it might be
+deemed to have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribu-
+tion, import or sale of Subject Software (including particular functionality
+or code incorporated in Subject Software) infringes the third party's intel-
+lectual property rights, Recipient must place in a well-identified web page
+bearing the title "LEGAL" a description of each such claim and a description
+of the party making each such claim in sufficient detail that a user of the
+Subject Software will know whom to contact regarding the claim. Also, upon
+gaining such knowledge of any such claim, Recipient must conspicuously
+include the URL for such web page in the Required Notice, and in the text of
+any related documentation, license agreement or collateral in which Recipient
+describes end user's rights relating to the Subject Software. If Recipient
+obtains such knowledge after it makes Subject Software available to any other
+person or entity, Recipient shall take other steps (such as notifying appro-
+priate mailing lists or newsgroups) reasonably calculated to provide such
+knowledge to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER-
+CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER-
+VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of (Recipi-
+ent's use, modification, reproduction and distribution of the Subject Soft-
+ware or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the
+terms of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be unen-
+forceable by any judicial or administrative authority having proper jurisdic-
+tion with respect thereto, such provision shall be reformed so as to achieve
+as nearly as possible the same economic effect as the original provision and
+the remainder of this License will remain in effect. This License shall be
+governed by and construed in accordance with the laws of the United States
+and the State of California as applied to agreements entered into and to be
+performed entirely within California between California residents. Any liti-
+gation relating to this License shall be subject to the exclusive jurisdic-
+tion of the Federal Courts of the Northern District of California (or, absent
+subject matter jurisdiction in such courts, the courts of the State of Cali-
+fornia), with venue lying exclusively in Santa Clara County, California, with
+the losing party responsible for costs, including without limitation, court
+costs and reasonable attorneys fees and expenses. The application of the
+United Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation that provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis.
+ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software
+(as defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.]
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.5 1999/07/19 13:36:21 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.5 1999/07/19 14:44:19 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/LbxproxyOnly b/xc/programs/Xserver/hw/xfree86/doc/LbxproxyOnly
new file mode 100644
index 000000000..5c3d29d74
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/LbxproxyOnly
@@ -0,0 +1,54 @@
+** This document is out of date **
+
+The following is a list of files/directories required for a self-contained
+cut-down source tree suitable for building the lbxproxy server. When
+using this cut-down tree, set BuildLBXProxyOnly to YES in
+xc/config/cf/xf86site.def.
+
+xc/Imakefile
+xc/Makefile
+xc/Makefile.ini
+xc/RELNOTES.TXT
+xc/bug-report
+xc/config/
+xc/include/
+xc/lib/Imakefile
+xc/lib/X11/
+xc/lib/XExExt/
+xc/lib/Xau/
+xc/lib/Xbsd/
+xc/lib/Xdmcp/
+xc/lib/Xext/
+xc/lib/xtrans/
+xc/programs/Xserver/include/
+xc/registry
+xc/workInProgress/Imakefile
+xc/workInProgress/lbx/Imakefile
+xc/workInProgress/lbx/README
+xc/workInProgress/lbx/include/
+xc/workInProgress/lbx/lib/
+xc/workInProgress/lbx/programs/Imakefile
+xc/workInProgress/lbx/programs/lbxproxy/
+
+Notes:
+
+1. To start the build, run the following from the 'xc' directoty:
+
+ make -f Makefile.ini World
+
+For some OSs you may need to set BOOTSTRAPCFLAGS.
+
+
+2. If your system uses shared libraries, and you have the latest patchlevel
+of X11R6 installed, you can set DynamicLBXProxyOnly to YES in
+xc/config/cf/xf86site.def to have lbxproxy dynamically linked instead of
+statically linked against the X libraries.
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/LbxproxyOnly,v 3.3 1996/12/26 07:00:12 dawes Exp $
+
+
+
+
+
+$XConsortium: LbxproxyOnly /main/3 1996/02/21 17:42:14 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/Monitors b/xc/programs/Xserver/hw/xfree86/doc/Monitors
new file mode 100644
index 000000000..19e084e7a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/Monitors
@@ -0,0 +1,1386 @@
+#From: jos@chopin.muc.de (Jochen Schwenk)
+#Date: Sat, 24 Dec 1994 02:59:00 +0100
+Section "Monitor"
+ Identifier "AOC-15"
+ VendorName "Unknown"
+ ModelName "Unknown"
+ BandWidth 135
+ HorizSync 23.5-86
+ VertRefresh 50-120
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+ ModeLine "1152x900" 110 1152 1284 1416 1536 900 902 905 941
+ ModeLine "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+EndSection
+
+#Date: Fri, 16 Sep 1994 23:16:32 -0700
+#From: "Leonard N. Zubkoff" <lnz@dandelion.com>
+Section "Monitor"
+ Identifier "Apollo 1280x1024-68Hz"
+ VendorName "Apollo"
+ ModelName "010700-005"
+ BandWidth 125
+ HorizSync 73.702
+ VertRefresh 68.24
+ Mode "1280x1024"
+ DotClock 124.996
+ HTimings 1280 1312 1504 1696 VTimings 1024 1027 1030 1080
+ EndMode
+EndSection
+
+#Date: Fri, 16 Sep 1994 23:16:32 -0700
+#From: "Leonard N. Zubkoff" <lnz@dandelion.com>
+Section "Monitor"
+ Identifier "Apollo 1280x1024-70Hz"
+ VendorName "Apollo"
+ ModelName "010700-005"
+ BandWidth 125
+ HorizSync 75.118
+ VertRefresh 70.07
+ Mode "1280x1024"
+ DotClock 124.996
+ HTimings 1280 1312 1472 1664 VTimings 1024 1027 1030 1072
+ EndMode
+EndSection
+
+#From: peterc@a3.ph.man.ac.uk (Peter Chang)
+#Date: Fri, 23 Sep 1994 17:40:40 +0100
+Section "Monitor"
+ Identifier "Chuntex CTX CPS-1560/LR"
+ VendorName "Chuntex"
+ ModelName "CTX CPS-1560/LR"
+ Bandwidth 75.0
+ HorizSync 30.00-60.00
+ VertRefresh 50.00-100.00
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "800x600"
+ DotClock 50
+ HTimings 800 856 976 1040 VTimings 600 637 643 666
+ Flags "+HSync" "+VSync"
+ EndMode
+ Mode "1024x768"
+ DotClock 75
+ HTimings 1024 1048 1184 1328 VTimings 768 771 777 806
+ Flags "-HSync" "-VSync"
+ EndMode
+EndSection
+
+#From: dlj0@chern.math.lehigh.edu (DAVID L. JOHNSON)
+#Date: Fri, 23 Sep 1994 23:23:18 -0400
+Section "Monitor"
+ Identifier "Compudyne KD-1500N"
+ VendorName "Compudyne"
+ ModelName "KD-1500N"
+ Bandwidth 74.8
+ HorizSync 30.00-66
+ VertRefresh 50-90
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "1024x768"
+ DotClock 74.8
+ HTimings 1024 1056 1256 1328 VTimings 768 776 786 806
+ EndMode
+EndSection
+
+#From: forsse@meaddata.com (Steve Forsythe)
+#Date: Sun, 18 Sep 94 3:27:15 EDT
+Section "Monitor"
+ Identifier "CTX-1561"
+ VendorName "CTX"
+ ModelName "CMS-1561"
+ BandWidth 100
+ HorizSync 30-60
+ VertRefresh 50-90
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600" 40 800 872 1000 1056 600 601 605 628
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 75 1024 1072 1216 1352 768 769 775 806
+EndSection
+
+#Date: Wed, 21 Sep 1994 14:22:23 -0700 (PDT)
+#From: James Dooley <jdooley@ugcs.caltech.edu>
+#Updated Date: Date: Mon, 3 Oct 94 22:03:47 EST
+#Updated From: "Bill C. Riemers" <bcr@physics.purdue.edu>
+Section "Monitor"
+ Identifier "CrystalScan 1572FS"
+ VendorName "CrystalScan"
+ ModelName "1572FS"
+ Bandwidth 110
+ HorizSync 30.00-60.00
+ VertRefresh 50.00-100.00
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "1024x768"
+ DotClock 80
+ HTimings 1024 1136 1340 1432 VTimings 768 770 774 805
+ EndMode
+ ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+ Mode "1280x1024"
+ DotClock 80
+ HTimings 1280 1296 1512 1568 VTimings 1024 1025 1037 1165
+ Flags "Interlace"
+ EndMode
+EndSection
+
+#Date: Fri, 16 Sep 1994 11:42:19 +0100
+#From: Doug Rabson <dfr@render.com>
+#Note: Two submissions by the same author? Be careful.
+Section "Monitor"
+ Identifier "Dell VS17"
+ VendorName "Dell"
+ ModelName "VS17"
+ BandWidth 78.0
+ HorizSync 30.0-62.0
+ VertRefresh 50-90
+ ModeLine "640x480" 28.3 640 680 720 864 480 488 491 521
+ ModeLine "1024x768" 60 1024 1128 1240 1344 768 770 775 788
+EndSection
+
+#From: Doug Rabson <dfr@render.com>
+#Date: Sat, 24 Sep 1994 14:54:58 +0100
+#Note: display shifted to the left.
+#Note: Two submissions by the same author? Be careful.
+Section "Monitor"
+ Identifier "DELL VS17"
+ VendorName "DELL"
+ ModelName "VS17"
+ Bandwidth 25.2 mhz
+ HorizSync 30-62
+ VertRefresh 50-90
+ # Refresh rate = 73.46Hz ; Horizontal Frequency = 59.29KHz
+ Mode "1024x768"
+ DotClock 81
+ HTimings 1024 1120 1272 1368
+ VTimings 768 788 801 847
+ EndMode
+EndSection
+
+#Date: Fri, 16 Sep 1994 12:58:21 +0200 (MET DST)
+#From: kiwi@belly.in-berlin.de (Axel Habermann)
+Section "Monitor"
+ Identifier "EIZO FlexScan T660"
+ VendorName "EIZO"
+ ModelName "FlexScan T660i-T/TCO"
+ BandWidth 135.0
+ HorizSync 30.0-82.0
+ VertRefresh 55.0-90.0
+ ModeLine "1536x1152" 168 1536 1616 1760 2048 1152 1154 1158 1188
+ ModeLine "1280x1024" 135 1280 1328 1408 1688 1024 1025 1026 1060
+ ModeLine "1024x768" 80 1024 1088 1152 1280 768 770 772 778
+EndSection
+
+#Date: Sat, 30 Sep 1995 17:25:00 EDT
+#From: David E. Wexelblat <dwex@xfree86.org>
+Section "Monitor"
+ Identifier "EIZO/Nanao FlexScan 9070u"
+ VendorName "EIZO/Nanao"
+ ModelName "FlexScan 9070u"
+ BandWidth 50.0
+ HorizSync 20.0-50.0
+ VertRefresh 50.0-105.0 #Out of spec, but it works
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "640x480" 36 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 45 800 848 960 1008 600 603 620 640
+ ModeLine "1024x768" 65 1024 1088 1224 1304 768 772 788 824
+ ModeLine "1152x900i" 75 1152 1224 1384 1504 900 905 923 965 interlace
+EndSection
+
+#Date: Mon, 26 Sep 1994 23:30:00 -1000 (EST)
+#From: dawes@XFree86.org (David Dawes)
+Section "Monitor"
+ Identifier "EIZO FlexScan 9080i"
+ VendorName "EIZO"
+ ModelName "FlexScan 9080i"
+ BandWidth 60.0
+ HorizSync 30.0-64.0
+ VertRefresh 50.0-90.0
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "640x480" 28 640 672 768 800 480 490 492 525
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "800x600" 40 800 864 896 1008 600 600 606 624
+ ModeLine "800x600" 36 800 816 952 1056 600 608 610 633
+ ModeLine "1024x768i" 45 1024 1064 1224 1264 768 777 783 815 interlace
+ ModeLine "1024x768i" 44 1024 1064 1224 1264 768 777 785 817 interlace
+ ModeLine "1024x768" 80 1024 1032 1152 1360 768 784 787 823
+ ModeLine "1152x900" 80 1152 1152 1368 1400 900 912 929 945
+ ModeLine "1280x1024i" 80 1280 1296 1412 1632 1024 1025 1037 1165 interlace
+EndSection
+
+#From: Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>
+#Date: Wed, 21 Sep 1994 23:48:57 +0200 (MET DST)
+Section "Monitor"
+ Identifier "ELSA GDM-17E40"
+ VendorName "ELSA GmbH"
+ ModelName "GDM-17E40"
+ BandWidth 135
+ HorizSync 29-82
+ VertRefresh 50-150
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "800x600x32" 45 800 820 904 964 600 601 604 621
+ ModeLine "1024x768x16" 78.7 1024 1044 1140 1264 768 770 773 796
+ ModeLine "1152x875" 135 1152 1416 1456 1664 875 875 877 906
+ ModeLine "1152x900" 135 1152 1400 1440 1648 900 901 905 935
+ ModeLine "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 interlace
+ ModeLine "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+ ModeLine "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+EndSection
+
+#From: wolff@dutecai.et.tudelft.nl (Rogier Wolff)
+#Date: Sat, 24 Sep 1994 17:27:09 +0200 (MET DST)
+Section "Monitor"
+ Identifier "ESCOM MONO-LCD-screen"
+ VendorName "ESCOM"
+ ModelName "Unknown"
+ BandWidth 28
+ HorizSync 30-36
+ VertRefresh 43-72
+ ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+EndSection
+
+#From: Alan Hourihane <alanh@fairlite.demon.co.uk>
+#Date: Mon, 26 Sep 1994 21:04:34 +0000 (GMT)
+Section "Monitor"
+ Identifier "Gateway 2000 CrystalScan 1776LE"
+ VendorName "Gateway 2000"
+ ModelName "CrystalScan 1776LE"
+ BandWidth 110
+ HorizSync 30-64
+ VertRefresh 50-120
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+ ModeLine "1024x768i" 44 1024 1040 1216 1264 768 777 785 817 interlace
+ ModeLine "1024x768" 75 1024 1072 1184 1328 768 768 770 800 -hsync -vsync
+ ModeLine "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 interlace
+ ModeLine "1280x1024" 110 1280 1360 1428 1720 1024 1025 1036 1065
+EndSection
+
+#From: David Dawes <dawes@XFree86.org>
+#Date: Fri, 16 Sep 1994 12:40:08 +1000 (EST)
+# GJA -- Changed dotclock from 25 to 25.2
+Section "Monitor"
+ Identifier "Generic Monitor"
+ VendorName "Unknown"
+ ModelName "Unknown"
+ Bandwidth 25.2
+ HorizSync 31.5
+ VertRefresh 60
+ Mode "640x480"
+ DotClock 25.2
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+EndSection
+
+#Date: Fri, 16 Sep 1994 23:16:32 -0700
+#From: "Leonard N. Zubkoff" <lnz@dandelion.com>
+Section "Monitor"
+ Identifier "HP 1280x1024-72Hz"
+ VendorName "Hewlett-Packard"
+ ModelName "A1097A"
+ BandWidth 135
+ HorizSync 78.125
+ VertRefresh 72.008
+ Mode "1280x1024"
+ DotClock 135.00
+ HTimings 1280 1344 1536 1728 VTimings 1024 1027 1030 1085
+ EndMode
+EndSection
+
+#From: Gertjan Akkerman <akkerman@dutiba.twi.tudelft.nl>
+#Date: Tue, 20 Sep 1994 11:45:21 +0200 (MET DST)
+Section "Monitor"
+ Identifier "Highscreen LE 1024"
+ VendorName "Vobis"
+ ModelName "LE 1024"
+ BandWidth 45 # MHz
+ HorizSync 31.4-31.6, 35.1-35.2, 35.5-35.6 # KHz
+ VertRefresh 50-87 # Hz
+ ModeLine "640x480" 25.2 640 664 760 800 480 491 493 525
+ ModeLine "800x600" 36.0 800 824 896 1024 600 601 603 625
+ ModeLine "1024x768i" 44.9 1024 1040 1216 1264 768 777 785 817 interlace
+EndSection
+
+#From: rich@id.slip.bcm.tmc.edu (Rich Murphey)
+#Date: Thu, 15 Sep 1994 23:30:52 -0501
+Section "Monitor"
+ Identifier "Hitachi SuperScan 20S"
+ VendorName "Hitachi"
+ ModelName "SuperScan 20S model no. CM2095MU"
+ BandWidth 100.0
+ HorizSync 30-69
+ VertRefresh 50-100
+ ModeLine "1152x90085" 85 1152 1192 1384 1480 900 905 923 955
+EndSection
+
+#From: wolff@dutecai.et.tudelft.nl (Rogier Wolff)
+#Date: Sat, 24 Sep 1994 17:27:09 +0200 (MET DST)
+# This monitor does the VESA 640x480@60Hz, 800x600@58Hz and 1024x768i@43Hz.
+Section "Monitor"
+ Identifier "Hyundai hcm-421E"
+ VendorName "Hyundai"
+ ModelName "421E"
+ BandWidth 110
+ HorizSync 30-36
+ VertRefresh 43-72
+ ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+EndSection
+
+#Date: Thu, 22 Sep 1994 01:38:45 -0400
+#From: Chris Mason <mason@mail.csh.rit.edu>
+Section "Monitor"
+ Identifier "IDEK VisionMaster 17 (1)"
+ # was: "IDEK 8617"
+ VendorName "IDEK"
+ ModelName "8617"
+ BandWidth 135
+ HorizSync 31.5-85.0
+ VertRefresh 60-80
+ ModeLine "800x600" 49 800 816 932 996 600 607 612 635
+ ModeLine "1024x768" 85 1024 1028 1196 1348 768 769 775 804
+ ModeLine "1280x1024.1" 135 1280 1296 1456 1726 1024 1025 1028 1066
+ ModeLine "1280x1128.1" 135 1280 1284 1456 1661 1128 1129 1132 1161
+EndSection
+
+#Date: Wed, 21 Sep 1994 22:22:42 +0100
+#From: Andrew Dyer <adyer@zarniwoop.chi.il.us>
+Section "Monitor"
+ Identifier "IDEK VisionMaster 17 (2)"
+ # was: "IDEK MF-8617"
+ VendorName "Idek"
+ ModelName "MF-8617"
+ Bandwidth 135.0
+ HorizSync 23.5-86.0
+ VertRefresh 50-120
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "1024x768"
+ DotClock 75
+ HTimings 1024 1056 1192 1280 VTimings 768 770 776 806
+ Flags "-vsync" "-hsync"
+ EndMode
+EndSection
+
+#Date: Mon, 19 Sep 1994 20:37:05 +0200
+#From: eddy@dutecae.et.tudelft.nl (J.G.E. Olk)
+Section "Monitor"
+ Identifier "IDEK VisionMaster 17 (3)"
+ VendorName "IDEK"
+ ModelName "MF-8617"
+ BandWidth 135
+ HorizSync 23.5-86
+ VertRefresh 50-120
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+ ModeLine "1152x900" 110 1152 1284 1416 1536 900 902 905 941
+ ModeLine "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+EndSection
+
+#From: Richard Coley <rcoley@pyra.co.uk>
+#Date: Thu, 15 Sep 1994 12:29:10 +0100 (BST)
+Section "Monitor"
+ Identifier "IDEK Vision Master 17 (4)"
+ VendorName "LIYAMA"
+ ModelName "Vision Master 17 (MF8617)"
+ BandWidth 135.0
+ HorizSync 23.5-86.0
+ VertRefresh 50-120
+ ModeLine "1024x768" 80 1024 1032 1216 1344 768 768 773 805
+ ModeLine "800x600" 32 800 832 976 1016 600 604 606 634 +hsync +vsync
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525 -hsync -vsync
+EndSection
+
+#From: Bob Mende Pie <mende@piecomputer.rutgers.edu>
+#Date: Fri, 23 Sep 1994 22:51:51 -0400
+Section "Monitor"
+ Identifier "IDEK Vision Master 17 (5)"
+ #Was: "Idek 8617"
+ VendorName "Idek"
+ ModelName "8617"
+ BandWidth 135.0 # EDIT THIS!
+ HorizSync 23.5-86 # EDIT THIS!
+ VertRefresh 50-120 # EDIT THIS!
+
+ ModeLine "640x480" 28 640 656 752 792 480 490 492 519
+ ModeLine "800x600" 40 800 840 968 1032 600 601 605 625
+ ModeLine "1024x768" 75.0 1024 1088 1240 1368 768 770 777 800
+ ModeLine "1152x900" 95.0 1152 1232 1384 1528 900 914 917 943
+ -hsync -vsync
+ ModeLine "1280x1024" 135 1280 1320 1536 1704 1024 1027 1030 1073
+ -hsync -vsync
+EndSection
+
+#Date: Mon, 19 Sep 1994 13:37:39 +0100
+#From: Charles Hawkins <ceh@eng.cam.ac.uk>
+Section "Monitor"
+ Identifier "Lite-On CM1414E"
+ VendorName "Lite-On Technology"
+ ModelName "CM1414E"
+ BandWidth 45.0
+ HorizSync 30-40 # actually 31.5,35.5, but this avoids comma bug
+ VertRefresh 40.0-87.0 # actually spec'd at 50.0-87.0
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 509
+ ModeLine "800x600" 35 800 824 920 968 600 601 603 624
+ Mode "1024x768i"
+ DotClock 45
+ HTimings 1024 1040 1210 1267 VTimings 768 777 785 817
+ Flags "Interlace"
+ EndMode
+EndSection
+
+#From: Farrell.McKay@nms.otc.com.au (Farrell McKay)
+#Date: Mon, 26 Sep 1994 10:05:03 +1000 (EST)
+Section "Monitor"
+ Identifier "MAG MX15F (1)"
+ VendorName "MAG"
+ ModelName "MX15F"
+ BandWidth 100 MHz
+ HorizSync 30-65 KHz
+ VertRefresh 50-120 Hz
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ +hsync +vsync
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+ -hsync -vsync
+ ModeLine "1280x1024" 110 1280 1320 1480 1728 1024 1029 1036 1077
+EndSection
+
+#From: "M{kinen Sami J." <sjm@cs.tut.fi>
+#Date: Mon, 19 Sep 1994 23:47:01 +0300
+Section "Monitor"
+ Identifier "MAG MX15F (2)"
+ VendorName "MAG"
+ ModelName "MX15F"
+ Bandwidth 100.0
+ HorizSync 30.00-65.00
+ VertRefresh 40.00-120.00
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "1024x768"
+ DotClock 80
+ HTimings 1024 1128 1300 1400 VTimings 768 770 774 800
+ EndMode
+EndSection
+
+#Date: Tue, 20 Sep 94 08:32:45 EDT
+#From: bremner@muff.cs.mcgill.ca (David BREMNER)
+Section "Monitor"
+ Identifier "MegaImage 17"
+ VendorName "MegaImage"
+ ModelName "S17MGP"
+ BandWidth 106
+ HorizSync 30-64
+ VertRefresh 50-100
+ ModeLine "1152x864" 92 1152 1192 1352 1440 864 865 875 895
+ ModeLine "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+EndSection
+
+#From: erik@kroete2.freinet.de (Erik Corry)
+#Date: Wed, 8 Feb 1995 02:03:20 +0100 (MET)
+Section "Monitor"
+ Identifier "Miro 20inch CAD Monitor"
+ VendorName "Miro"
+ ModelName "Unknown-model-name"
+ BandWidth 100.0 # Actually about 64
+ HorizSync 47-49 # Actually fixed sync at ca. 48KHz
+ VertRefresh 58-62 # Actually fixed at ca. 60Hz
+ ModeLine "1096x776" 65 1096 1162 1326 1344 776 779 785 806 +vsync -hsync
+EndSection
+
+#From: ciotti@nas.nasa.gov (Robert B. Ciotti)
+#Date: Fri, 30 Sep 1994 10:34:37 -0700
+Section "Monitor"
+ Identifier "AUM1371A"
+ VendorName "Mitsubishi"
+ ModelName "DiamondScan"
+ BandWidth 30
+ HorizSync 15-38
+ VertRefresh 40-90 # monitor Spec
+ #VertRefresh 40-92 # pushed from spec to support 1000x750
+ ModeLine "1000x750" 45 1000 1040 1208 1248 750 750 756 788 interlace
+ ModeLine "800x600" 36 800 851 987 1056 600 608 610 633
+ ModeLine "vesa640x480a" 25.175 640 664 760 800 480 491 493 525
+ ModeLine "vesa640x480b" 25.175 640 672 768 800 480 490 492 525
+ ModeLine "vesa640x480c" 31.5 640 664 704 832 480 489 492 520
+EndSection
+
+#Date: Mon, 26 Sep 1994 23:30:00 -1000 (EST)
+#From: dawes@XFree86.org (David Dawes)
+Section "Monitor"
+ Identifier "NED 3D"
+ VendorName "NEC"
+ ModelName "MultiSync 3D"
+ BandWidth 45.0
+ HorizSync 15.5-38.0
+ VertRefresh 50.0-90.0
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 45 800 840 1224 1264 600 600 606 624
+ ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
+ ModeLine "1024x768i" 46 1024 1064 1224 1264 768 777 785 817 interlace
+EndSection
+
+#Date: Sun, 18 Sep 1994 16:00:53 +1000
+#From: Stephen Hocking <sysseh@devetir.qld.gov.au>
+Section "Monitor"
+ Identifier "NEC 4D"
+ VendorName "NEC"
+ ModelName "4D"
+ BandWidth 75
+ HorizSync 30-57
+ VertRefresh 50-90
+ ModeLine "640x480" 25.175 640 672 768 800 480 490 492 525
+ ModeLine "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+ ModeLine "1024x768i" 44.9 1024 1064 1224 1264 768 777 785 817 interlace
+ ModeLine "1024x768" 64 1024 1144 1208 1320 768 778 782 808
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync +vsync
+EndSection
+
+#Date: Sat, 17 Sep 1994 00:50:57 -0400
+#From: Erik Nygren <nygren@mit.edu>
+Section "Monitor"
+ Identifier "NEC MultiSync 4FGe"
+ VendorName "NEC"
+ ModelName "MultiSync 4FGe"
+ BandWidth 80Mhz #\
+ HorizSync 27-62KHz #> from monitor documentation
+ VertRefresh 55-90Hz #/
+ ModeLine "640x480" 31 640 680 704 832 480 489 492 520
+ ModeLine "800x600" 50 800 864 976 1040 600 637 643 666
+ ModeLine "1024x768" 81 1024 1068 1204 1324 768 776 782 807
+EndSection
+
+#From: Hans Nasten <nasten@everyware.se>
+#Date: Tue, 27 Sep 1994 10:18:05 +0100 (MET)
+Section "Monitor"
+ Identifier "NEC 5FG"
+ VendorName "NEC"
+ ModelName "5FG"
+ BandWidth 135.0
+ HorizSync 27-79
+ VertRefresh 55-90
+ ModeLine "640x480" 28 640 664 704 832 480 489 492 520
+ ModeLine "640x480" 32 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+ ModeLine "1152x900" 90 1152 1176 1234 1464 900 906 914 943 -hsync -vsync
+ ModeLine "1280x1024" 115 1280 1276 1372 1664 1024 1028 1035 1062
+ -hsync -vsync
+EndSection
+
+#From: karlcz@uclink.berkeley.edu (Karl Frederick Czajkowski)
+#Date: Thu, 15 Sep 1994 23:14:30 -0700
+Section "Monitor"
+ Identifier "Nanao F340i-W"
+ VendorName "Nanao"
+ ModelName "F340i-W"
+ BandWidth 75.0
+ HorizSync 27-61
+ VertRefresh 55-90
+ ModeLine "1024x768" 80 1024 1048 1192 1344 768 772 780 821 +hsync +vsync
+ ModeLine "1024x768" 72 1024 1056 1129 1280 768 770 776 806 -hsync -vsync
+ ModeLine "1024x768" 85 1024 1032 1152 1360 768 784 787 823 +hsync +vsync
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+ ModeLine "640x480" 32 640 664 704 832 480 489 492 520
+ ModeLine "LowRes" 25 400 416 512 560 300 396 398 498
+EndSection
+
+#From: Mark_Weaver@brown.edu (Mark_Weaver@brown.edu)
+#Date: Mon, 19 Sep 1994 14:59:09 -0400
+Section "Monitor"
+ Identifier "Nanao F550i"
+ VendorName "Nanao"
+ ModelName "F550i"
+ BandWidth 100.0 # Just a guess
+ HorizSync 30-66 # WARNING: not correct, be careful
+ VertRefresh 40-130 # WARNING: not correct, be careful
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "640x480" 40 640 704 832 904 480 530 542 615
+ ModeLine "800x600" 45 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768s" 65 1024 1032 1176 1344 768 771 777 806
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+ ModeLine "1152x900s" 65 1152 1168 1312 1400 900 901 907 935 Interlace
+ ModeLine "1152x900i" 80 1152 1168 1384 1440 900 901 907 945 interlace
+ ModeLine "1280x1024i" 110 1280 1328 1482 1682 1024 1025 1035 1085 interlace
+ ModeLine "1280x1024" 110 1280 1328 1482 1682 1024 1025 1028 1054
+EndSection
+
+#Date: Sun, 18 Sep 1994 22:55:32 -0700 (PDT)
+#From: Shyam Subramanyan <shyam@crl.com>
+Section "Monitor"
+ Identifier "Nanao F550i-w"
+ VendorName "Nanao"
+ ModelName "F550i-w"
+ BandWidth 80
+ HorizSync 27-65
+ VertRefresh 55-90
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 45 800 856 976 1040 600 637 643 666
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+EndSection
+
+#From: Ted.Goldblatt@telematics.com (Ted Goldblatt)
+#Date: Fri, 23 Sep 1994 11:52:28 +0500
+Section "Monitor"
+ Identifier "Nokia 445X"
+ VendorName "Nokia"
+ ModelName "445X"
+ Bandwidth 200
+ HorizSync 30-102
+ VertRefresh 50-120
+ ModeLine "1600x1200" 188.58 1600 1792 1856 2208 1200 1202 1205 1256
+ ModeLine "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+ ModeLine "1152x900" 95 1152 1152 1192 1472 900 900 931 939
+EndSection
+
+#From: J Wunsch <joerg_wunsch@uriah.sax.de>
+#Date: Fri, 23 Sep 1994 09:28:58 +0200 (MET DST)
+Section "Monitor"
+ Identifier "Nokia 447B (1)"
+ VendorName "Nokia"
+ ModelName "Multigraph 447B"
+ BandWidth 110 # MHz
+ HorizSync 30-64 # kHz
+ VertRefresh 48-100 # Hz
+ # "fast" 640x480, 39.17 kHz H, 76 Hz V
+ ModeLine "640x480" 31.96 640 684 756 816 480 486 489 515
+ # 800 x 600, 40.08 kHz H, 63 Hz V
+ ModeLine "800x600" 42 800 868 1008 1048 600 609 613 636
+ # 1024 x 768, 61.96 kHz H, 76 Hz V
+ ModeLine "1024x768" 80.8 1024 1048 1200 1304 768 777 785 817
+ # 1088 x 800, 63.26 kHz H (near limit!), 76 Hz V (still excellent)
+ ModeLine "1088x800" 87.04 1088 1120 1264 1376 800 806 816 834
+EndSection
+
+#Date: Wed, 21 Sep 94 16:11:47 PDT
+#From: eh@c-cube.com (Ernest Hua)
+Section "Monitor"
+ Identifier "Nokia 447B (2)"
+ VendorName "Nokia"
+ ModelName "447B"
+ Bandwidth 110
+ HorizSync 30-64
+ VertRefresh 48-100
+ Mode "640x480@60Hz" # Horizontal Sync = 31.5kHz
+ DotClock 25.175
+ HTimings 640 672 768 800 VTimings 480 490 492 525
+ EndMode
+ Mode "640x480@72Hz" # Horizontal Sync = 37.9kHz
+ DotClock 31.5
+ HTimings 640 664 704 832 VTimings 480 489 492 520
+ EndMode
+ Mode "800x600@72Hz" # Horizontal Sync = 48kHz
+ DotClock 50
+ HTimings 800 856 976 1040 VTimings 600 637 643 666
+ EndMode
+ Mode "1024x768@76Hz" # Horizontal Sync = 62.5kHz
+ DotClock 85
+ HTimings 1024 1032 1152 1360 VTimings 768 784 787 823
+ EndMode
+ Mode "1280x1024@61Hz" # Horizontal Sync = 64.25kHz
+ DotClock 110
+ HTimings 1280 1328 1512 1712 VTimings 1024 1025 1028 1054
+ EndMode
+EndSection
+
+#From: Orest Zborowski <orestz@eskimo.com>
+#Date: Tue, 27 Sep 1994 01:23:59 -0700 (PDT)
+Section "Monitor"
+ Identifier "Philips 1764DC"
+ VendorName "Philips"
+ ModelName "1764DC"
+ BandWidth 110
+ HorizSync 30-66
+ VertRefresh 50-100
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 65 1024 1048 1192 1344 768 771 777 806
+ ModeLine "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+EndSection
+
+#Date: Sun, 18 Sep 1994 16:00:53 +1000
+#From: Stephen Hocking <sysseh@devetir.qld.gov.au>
+Section "Monitor"
+ Identifier "PHILIPS 7BM749"
+ VendorName "PHILIPS"
+ ModelName "7BM749"
+ BandWidth 28
+ HorizSync 30-33
+ VertRefresh 55-70
+ ModeLine "704x480m" 28 704 720 832 864 480 480 488 488
+ ModeLine "704x504m" 28 704 736 856 888 504 504 542 554
+ ModeLine "680x510m" 28 680 688 800 864 510 512 518 542 -hsync -vsync
+ ModeLine "688x516m" 28 688 720 832 864 516 516 522 542 -hsync -vsync
+ ModeLine "640x350" 25 640 672 768 800 350 387 389 449 +hsync -vsync
+ ModeLine "640x400" 25 640 672 768 800 400 412 414 449 -hsync +vsync
+ ModeLine "640x480" 25 640 672 768 800 480 480 486 504
+EndSection
+
+#From: "william (w.f.) conn" <conn@bnr.ca>
+#Date: Sun, 25 Sep 1994 19:51:00 -0500
+Section "Monitor"
+ Identifier "Quantex TE1564M, Super View 1280"
+ VendorName "Quantex"
+ ModelName "TE1564M"
+ BandWidth 75
+ HorizSync 30-64
+ VertRefresh 50-100
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
+ ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806
+ ModeLine "1280x1024i" 80 1280 1352 1384 1568 1024 1024 1036 1164 interlace
+EndSection
+
+#Date: Wed, 21 Sep 1994 19:54:08 -0400 (EDT)
+#From: Andrew Robinson <robinson@cnj.digex.net>
+Section "Monitor"
+ Identifier "Relisys RE1564"
+ VendorName "Relisys"
+ ModelName "RE1564"
+ Bandwidth 80.0
+ HorizSync 30-64
+ VertRefresh 50-100
+ ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+ ModeLine "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165
+ Interlace
+EndSection
+
+#From: matthieu@laas.fr (Matthieu Herrb)
+#Date: Tue, 27 Sep 1994 10:05:24 +0100
+Section "Monitor"
+ Identifier "Sampo alphascan-17"
+ ModelName "AlphaScan 17"
+ BandWidth 95MHz
+ HorizSync 30-77kHz
+ VertRefresh 20-105Hz
+ ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 40 800 840 968 1056 600 601 605 628
+ ModeLine "1024x768" 80 1024 1056 1096 1374 768 774 776 800
+ ModeLine "1024x768i" 40 1024 1064 1224 1264 768 773 781 813 interlace
+ ModeLine "1152x900" 94.6 1152 1160 1400 1536 900 906 914 954
+ ModeLine "1152x900i" 80 1152 1184 1480 1496 900 912 950 1024 interlace
+ ModeLine "1280x1024i" 80 1280 1288 1408 1624 1024 1026 1032 1076 interlace
+ ModeLine "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+EndSection
+
+#Date: Fri, 6 Oct 1995 15:55:25 -0600
+#From: kop@acm.org (Karl O. Pinc)
+Section "Monitor"
+ Identifier "Samtron SC 428-TX"
+ VendorName "Samtron"
+ ModelName "SC 428-TX"
+ HorizSync 31.5, 35.2, 35.5, 37.8, 48
+ VertRefresh 56, 60, 70, 43.5, 72
+ Mode "640x480"
+ DotClock 25.175
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+# Mode "1064x759"
+# DotClock 65.028
+# Htimings 1064 1096 1328 1360
+# Vtimings 759 762 768 797
+# EndMode
+# Mode "1064x650"
+# DotClock 65.028
+# Htimings 1064 1120 1352 1360
+# Vtimings 650 653 659 683
+# EndMode
+EndSection
+
+#Date: Mon, 23 Jan 1995 09:50:44 -0800
+#From: "Leonard N. Zubkoff" <lnz@dandelion.com>
+Section "Monitor"
+ Identifier "Sony CPD-1430"
+ VendorName "Sony"
+ ModelName "CPD-1430"
+ BandWidth 75.0
+ HorizSync 28.0-58.0
+ VertRefresh 55.0-110.0
+ Mode "640x480-72Hz"
+ DotClock 31.150
+ HTimings 640 672 712 832
+ VTimings 480 488 491 520
+ EndMode
+ Mode "800x600-72Hz"
+ DotClock 50.000
+ HTimings 800 864 984 1040
+ VTimings 600 637 643 666
+ EndMode
+ Mode "1024x768i-45Hz"
+ DotClock 44.900
+ HTimings 1024 1032 1208 1264
+ VTimings 768 769 773 817
+ Flags "Interlace"
+ EndMode
+ Mode "1024x768-71Hz"
+ DotClock 75.267
+ HTimings 1024 1056 1152 1312
+ VTimings 768 773 775 808
+ EndMode
+ Mode "1152x900-60Hz"
+ DotClock 80.352
+ HTimings 1152 1184 1248 1440
+ VTimings 900 900 903 930
+ EndMode
+EndSection
+
+#From: koenig@nova.tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Date: Mon, 26 Sep 94 20:33:07 MEZ
+Section "Monitor"
+ Identifier "Sony Multiscan 15sf"
+ VendorName "Sony"
+ ModelName "CPD-15SF1"
+ BandWidth 110 MHz
+ HorizSync 31.5-64 kHz
+ VertRefresh 50-120 Hz
+#
+# here are some VESA modes to start with
+#
+ ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
+ ModeLine "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+ ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+EndSection
+
+#From: koenig@nova.tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Date: Mon, 26 Sep 94 20:33:07 MEZ
+Section "Monitor"
+ Identifier "Sony Multiscan 17se"
+ VendorName "Sony"
+ ModelName "GDM-17SE1T"
+ BandWidth 135 MHz
+ HorizSync 31.5-82 kHz
+ VertRefresh 50-150 Hz
+ ModeLine "640x480" 25 640 672 768 800 480 490 492 525
+ ModeLine "1024x768" 76 1024 1024 1088 1168 768 768 779 806
+ ModeLine "1280x1024" 110 1280 1340 1444 1582 1024 1024 1048 1070
+ ModeLine "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+#
+# here are some more VESA modes to start with
+#
+ ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520
+ ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
+ ModeLine "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+ ModeLine "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+ ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+EndSection
+
+#From: Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de>
+#Date: Wed, 21 Sep 1994 23:48:57 +0200 (MET DST)
+Section "Monitor"
+ Identifier "TARGA TM 1710 D"
+ VendorName "TARGA by SONY"
+ ModelName "TM 1710 D"
+ Bandwidth 100
+ HorizSync 30-65
+ VertRefresh 50-90
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "640x480" 31 640 664 704 832 480 489 492 520
+ ModeLine "800x600x32" 45 800 820 904 964 600 601 604 621
+ ModeLine "1024x768x16" 78.7 1024 1044 1140 1264 768 770 773 796
+ ModeLine "1024x768" 80 1024 1048 1184 1296 768 771 784 797
+ ModeLine "1024x768" 85 1024 1032 1152 1336 768 784 800 813
+ ModeLine "1152x800" 90 1152 1200 1312 1520 800 805 816 849
+ ModeLine "1152x800" 95 1152 1200 1320 1496 800 805 816 849
+ ModeLine "1152x800" 97 1152 1200 1296 1496 800 805 816 849
+EndSection
+
+#From: koenig@tat.physik.uni-tuebingen.de (Harald Koenig)
+#Date: Sat, 17 Sep 1994 15:46:10 +0200 (MET DST)
+Section "Monitor"
+ Identifier "TAXAN 875"
+ VendorName "TAXAN"
+ ModelName "MultiVision 875 PLUS LR"
+ BandWidth 130 MHz
+ HorizSync 30-78 kHz
+ VertRefresh 50-90 Hz
+ #
+ # the TAXAN 875 PLUS LR detects the following factory preset video modes
+ # (see App. 2 in the Owner's Guide). At least for some S3 Vision864 and
+ # some other S3 cards you may have to use "800x600x32" instead of "800x600"
+ # for 24/32bpp mode.
+ #
+ ModeLine "640x350" 25.175 640 664 688 800 350 395 411 449 +hsync -vsync
+ ModeLine "640x400" 25.175 640 664 688 800 400 414 430 449 -hsync +vsync
+ ModeLine "640x480" 25.175 640 664 688 800 480 498 500 525 -hsync -vsync
+ ModeLine "800x600" 50.350 800 872 920 1048 600 636 642 668 +hsync +vsync
+ ModeLine "800x600x32" 49.197 800 856 880 1024 600 636 642 668 +hsync +vsync
+ ModeLine "1024x768" 75 1024 1048 1120 1336 768 768 774 804 -hsync -vsync
+ ModeLine "1024x768" 75 1024 1048 1120 1296 768 771 777 806 -hsync -vsync
+ ModeLine "1024x768" 80 1024 1048 1128 1304 768 783 792 807 +hsync +vsync
+ ModeLine "1280x1024" 110 1280 1312 1416 1712 1024 1030 1040 1071
+ -hsync -vsync
+ ModeLine "1280x1024" 125 1280 1296 1552 1680 1024 1024 1032 1062
+ -hsync -vsync
+ ModeLine "1152x900" 105 1152 1176 1234 1464 900 906 914 943 -hsync -vsync
+ #
+ # other tested, usefull modes:
+ #
+ ModeLine "1024x768@82" 99.8 1024 1124 1288 1512 768 771 786 805
+ ModeLine "1024x768@93" 110 1024 1048 1128 1464 768 768 772 809
+ ModeLine "1280x1024@71" 135 1280 1488 1544 1824 1024 1029 1030 1042
+ ModeLine "1280x1024@74" 135 1280 1488 1544 1744 1024 1029 1030 1042
+EndSection
+
+#From: wolff@dutecai.et.tudelft.nl (Rogier Wolff)
+#Date: Sat, 24 Sep 1994 17:27:09 +0200 (MET DST)
+ # It seems I've been watching a horribly slow-refresh 54Hz screen for
+ # quite a while.... The monitor is spec-ed to do 60 Hz. I'll figure out
+ # how to adjust these later on.
+Section "Monitor"
+ Identifier "Unisys-19"
+ VendorName "Unisys"
+ ModelName "Unknown"
+ BandWidth 110
+ HorizSync 57-65
+ VertRefresh 55-65
+ ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+ ModeLine "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 interlace
+ ModeLine "1176x1024" 95 1176 1400 1504 1616 1024 1032 1040 1070
+ -hsync +vsync
+ ModeLine "1176x950" 95 1176 1400 1504 1616 950 958 964 994
+ -hsync +vsync
+ ModeLine "1280x1024" 110 1280 1584 1704 1872 1024 1032 1040 1070
+ -hsync +vsync
+ ModeLine "640x1024" 110 640 1584 1704 1872 1024 1032 1040 1070
+ -hsync +vsync
+EndSection
+
+#Date: Mon, 19 Sep 94 17:50:04 +0200
+#From: Didier Poirot <dp@chorus.fr>
+Section "Monitor"
+ Identifier "ViewSonic 17"
+ VendorName "ViewSonic"
+ ModelName "17"
+ BandWidth 75.0
+ HorizSync 30-82
+ VertRefresh 50-90
+ ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+ Modeline "1024x768a" 65 1024 1032 1208 1288 768 768 773 798
+ Modeline "1024x768b" 65 1024 1080 1224 1344 768 776 778 808
+EndSection
+
+#Date: Sat, 30 Sep 1995 17:25:00 EDT
+#From: David E. Wexelblat <dwex@xfree86.org>
+Section "Monitor"
+ Identifier "ViewSonic17"
+ VendorName "ViewSonic"
+ ModelName "17"
+ BandWidth 135.0
+ HorizSync 30.0-82.0
+ VertRefresh 50-160
+ ModeLine "640x480@62Hz" 25.175 640 664 760 800 480 491 493 525
+ ModeLine "640x480@76Hz" 31.500 640 660 684 812 480 485 488 508
+ ModeLine "800x600@65Hz" 40.000 800 804 932 980 600 605 609 624
+ ModeLine "800x600@77Hz" 50.000 800 820 940 1024 600 605 611 634
+ ModeLine "1024x768@62Hz" 65.000 1024 1042 1180 1308 768 775 781 798
+ ModeLine "1024x768@72Hz" 75.000 1024 1044 1180 1292 768 771 777 806
+ ModeLine "1152x900@79Hz" 110.000 1152 1180 1468 1484 900 902 905 941
+ ModeLine "1280x1024@76Hz" 135.000 1280 1328 1472 1648 1024 1031 1034 1076
+EndSection
+
+#Date: Wed, 21 Sep 1994 22:47:06 -0700
+#From: "Brett J. Vickers" <bvickers@rumba.ICS.UCI.EDU>
+Section "Monitor"
+ Identifier "ViewSonic 5e"
+ VendorName "ViewSonic"
+ ModelName "5e"
+ Bandwidth 25.2 mhz
+ HorizSync 30-60
+ VertRefresh 50-90
+ # Refresh rate = 73.46Hz ; Horizontal Frequency = 59.29KHz
+ Mode "1024x768"
+ DotClock 81
+ HTimings 1024 1120 1272 1368 VTimings 768 788 801 847
+ EndMode
+ # Refresh rate = 63.87Hz ; Horizontal Frequency = 57.99KHz
+ Mode "1152x864"
+ DotClock 90
+ HTimings 1152 1248 1472 1552 VTimings 864 864 876 908
+ EndMode
+ # Refresh rate = 63.87Hz ; Horizontal Frequency = 57.99KHz
+ Mode "1152x900"
+ DotClock 90
+ HTimings 1152 1248 1472 1552 VTimings 900 900 914 946
+ EndMode
+ # Refresh rate = 59.43Hz ; Horizontal Frequency = 59.91KHz
+ Mode "1280x960"
+ DotClock 104
+ HTimings 1280 1376 1672 1736 VTimings 960 960 973 1008
+ EndMode
+EndSection
+
+#Date: 22 Sep 1994 10:25:06 -0700 (PDT)
+#From: Ken Latta <klatta@pkdla5.syntex.com>
+Section "Monitor"
+ Identifier "ViewSonic 6"
+ VendorName "ViewSonic"
+ ModelName "6"
+ Bandwidth 80.0
+ HorizSync 30.00-57.00
+ VertRefresh 43.00-70.04
+ Mode "640x480"
+ DotClock 25
+ HTimings 640 664 760 800 VTimings 480 491 493 525
+ EndMode
+ Mode "1024x768"
+# DotClock 80
+ DotClock 65
+ HTimings 1024 1080 1304 1328 VTimings 768 768 776 792
+# HTimings 1024 1136 1340 1432 VTimings 768 770 774 805
+ EndMode
+EndSection
+
+#From: haw30@eng.amdahl.com (Henry A Worth )
+#Date: Tue, 27 Sep 94 22:10:01 PDT
+Section "Monitor"
+ Identifier "ViewSonic-7"
+ VendorName "ViewSonic"
+ ModelName "ViewSonic-7"
+ BandWidth 110
+ HorizSync 30.0-64.0
+ VertRefresh 50.0-90.0
+ ModeLine "1152x900" 85 1152 1218 1328 1456 900 902 912 943
+ ModeLine "1024x768" 80 1024 1032 1216 1344 768 768 773 805
+ ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 802
+ ModeLine "1024x768" 65 1024 1032 1208 1288 768 768 773 798
+ ModeLine "800x600" 45 800 808 920 1000 600 605 615 635
+ ModeLine "640x480" 30 640 664 728 800 480 484 490 507
+ ModeLine "640x480" 28 640 664 728 792 480 484 490 505
+EndSection
+
+#From: koen.gadeyne@barco.com (Koen Gadeyne)
+#Date: Sun, 29 Sep 96 12:54:10 CET
+Section "Monitor"
+ Identifier "MAG MagicView II"
+ VendorName "MAG"
+ ModelName "PMV1448"
+ BandWidth 65.0
+ HorizSync 30-33,45-51
+ VertRefresh 45.0-90.0
+ ModeLine "640x480" 40 640 672 712 824 480 480 482 505 +hsync -vsync
+ ModeLine "800x600" 50 800 816 848 1016 600 600 606 630 -hsync +vsync
+ ModeLine "1024x768" 65 1024 1040 1064 1306 768 768 770 795
+EndSection
+
+#From: abair@comland.com (Alan Bair)
+#Date: Wed, 21 May 1997 22:00:00 AEST
+Section Monitor
+ Identifier "CBM1950"
+ VendorName "Commodore"
+ ModelName "1950"
+ HorizSync 15-35 # multisync
+ VertRefresh 50-80 # multisync
+ Mode "640x480"
+ DotClock 25.175
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+EndSection
+
+#From: Richard Gooch <rgooch@atnf.csiro.au>
+#Date: Wed, 21 May 1997 22:00:00 AEST
+Section "Monitor"
+ Identifier "MAG MXP-17F"
+ VendorName "MAG"
+ ModelName "MXP-17F"
+ Bandwidth 130.1
+ HorizSync 30-82.1
+ VertRefresh 50-120
+
+ ModeLine "640x480@60Hz" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600@72Hz" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1024x768@68Hz" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900@66Hz" 90 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@65Hz" 92 1152 1184 1312 1504 900 902 906 937 +HSync +VSync # Sun
+ ModeLine "1152x900@70Hz" 95 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@73Hz" 99 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@81Hz" 110 1152 1176 1234 1472 900 900 911 925
+ ModeLine "1152x900@87Hz" 130 1152 1152 1168 1616 900 900 911 925
+ ModeLine "1152x900i@53Hz" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+ ModeLine "1280x1024@59Hz" 110 1280 1320 1480 1728 1024 1029 1036 1077
+ ModeLine "1280x1024@70Hz" 130 1280 1320 1480 1728 1024 1029 1036 1077
+ ModeLine "1280x1024@75Hz" 140 1280 1320 1480 1728 1024 1029 1036 1077
+EndSection
+
+Section "Monitor"
+ Identifier "MAG MX-17H"
+ VendorName "MAG"
+ ModelName "MX-17H"
+ Bandwidth 100.1
+ HorizSync 30-68.1
+ VertRefresh 50-120
+
+ ModeLine "640x480@60Hz" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600@72Hz" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1024x768@68Hz" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900@66Hz" 90 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@65Hz" 92 1152 1184 1312 1504 900 902 906 937 +HSync +VSync # Sun
+ ModeLine "1152x900@70Hz" 95 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@73Hz" 99 1152 1216 1280 1472 900 900 911 925
+ ModeLine "1152x900i@53Hz" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+EndSection
+
+Section "Monitor"
+ Identifier "Samsung SyncMaster 17GLsi"
+ VendorName "Samsung"
+ ModelName "SyncMaster 17GLsi"
+ Bandwidth 135.1
+ HorizSync 30-85.1
+ VertRefresh 50-120
+
+ ModeLine "640x480@60Hz" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600@72Hz" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1024x768@68Hz" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900@66Hz" 90 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@65Hz" 92 1152 1184 1312 1504 900 902 906 937 +HSync +VSync # Sun
+ ModeLine "1152x900@70Hz" 95 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@73Hz" 99 1152 1152 1192 1472 900 900 911 925
+ ModeLine "1152x900@81Hz" 110 1152 1176 1234 1472 900 900 911 925
+ ModeLine "1152x900@87Hz" 130 1152 1152 1168 1616 900 900 911 925
+ ModeLine "1152x900i@53Hz" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+EndSection
+
+Section "Monitor"
+ Identifier "KTX-15"
+ VendorName "KTX"
+ ModelName "15"
+ Bandwidth 80.1
+ HorizSync 30-60
+ VertRefresh 40-110
+
+ ModeLine "640x480@60Hz" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600@72Hz" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1024x768@68Hz" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900@58Hz" 80 1152 1200 1308 1460 900 900 931 939
+ ModeLine "1152x900i@53Hz" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+EndSection
+
+Section "Monitor"
+ Identifier "MAGTRON BMC-15FX"
+ VendorName "MAGTRON"
+ ModelName "BMC-15FX/LR"
+ Bandwidth 65.1
+ HorizSync 30-58.1
+ VertRefresh 50-90
+
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "1024x768" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900i" 56 1152 1200 1308 1440 900 900 905 925 Interlace
+EndSection
+
+Section "Monitor"
+ Identifier "Videocom DCM-1588"
+ VendorName "Videocom"
+ ModelName "DCM-1588"
+ Bandwidth 75.1
+ HorizSync 30-65
+ VertRefresh 50-100
+
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "1152x900i" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+ ModeLine "1152x900" 65 1152 1200 1308 1460 900 900 931 939
+EndSection
+
+Section "Monitor"
+ Identifier "NEC 5FG"
+ VendorName "NEC"
+ ModelName "5FG"
+ Bandwidth 100.1
+ HorizSync 30-68.1
+ VertRefresh 50-120
+
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "1152x900" 95 1152 1152 1192 1472 900 900 931 939
+EndSection
+
+Section "Monitor"
+ Identifier "Videocom DCM-1488"
+ VendorName "Videocom"
+ ModelName "DCM01488"
+ Bandwidth 75.1
+ HorizSync 30-50.1
+ VertRefresh 30-100
+
+ ModeLine "640x480" 25 640 664 760 800 480 491 493 525
+ ModeLine "1024x768" 50 1024 1092 1220 1344 768 786 791 810
+ ModeLine "1152x900i" 50 1152 1200 1308 1440 900 900 905 949 Interlace
+EndSection
+
+Section "Monitor"
+ Identifier "Toshiba Tecra 500CDT"
+ VendorName "Toshiba"
+ ModelName "Tecra 500CDT"
+ Bandwidth 110.1
+ HorizSync 30-82.1
+ VertRefresh 50-120
+
+ ModeLine "640x480@68Hz" 28 640 656 752 792 480 490 492 519
+ ModeLine "800x600@87Hz" 60 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+EndSection
+
+#From: koen.gadeyne@barco.com (Koen Gadeyne)
+#Date: 21 May 1997, 22:00:00 AEST
+
+Section "Monitor"
+ Identifier "SMILE CA1716CL/SMILE CA1718CL"
+ VendorName "SMILE"
+ ModelName "CA1716CL/CA1718CL"
+ BandWidth 75
+ HorizSync 30-65
+ VertRefresh 40-110
+
+ ModeLine "640x480@60Hz" 25 640 664 760 800 480 491 493 525
+ ModeLine "800x600@72Hz" 50 800 856 976 1040 600 637 643 666
+ ModeLine "1024x768@53Hz" 55 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1024x768@68Hz" 70 1024 1048 1208 1264 768 776 784 817
+ ModeLine "1152x900@58Hz" 80 1152 1200 1308 1460 900 900 931 939
+ ModeLine "1152x900i@53Hz" 72 1152 1200 1308 1440 900 900 905 949 Interlace
+EndSection
+
+#From: jestabro@amt.tay1.dec.com (Jay Estabrook)
+#Date: 21 May 1997, 22:00:00 AEST
+
+Section "Monitor"
+ Identifier "DEC VRC16"
+ VendorName "DEC"
+ ModelName "VRC16-LEM"
+ HorizSync 30-78
+ VertRefresh 50-90
+EndSection
+
+Section "Monitor"
+ Identifier "DEC VRC17"
+ VendorName "DEC"
+ ModelName "VRC17-Jx"
+ HorizSync 30-86
+ VertRefresh 50-152
+EndSection
+
+Section "Monitor"
+ Identifier "DEC VRC21-Hx"
+ VendorName "DEC"
+ ModelName "VRC21-Hx"
+ HorizSync 30-85
+ VertRefresh 50-152
+EndSection
+
+Section "Monitor"
+ Identifier "DEC VRC21-Kx/Wx"
+ VendorName "DEC"
+ ModelName "VRC21-Kx/Wx"
+ HorizSync 30-94
+ VertRefresh 50-152
+EndSection
+
+Section "Monitor"
+ Identifier "DEC VRT17"
+ VendorName "DEC"
+ ModelName "VRT17-Hx"
+ HorizSync 29-82
+ VertRefresh 50-150
+EndSection
+
+Section "Monitor"
+ Identifier "DEC VRC20"
+ VendorName "DEC"
+ ModelName "VRC20-Hx"
+ HorizSync 30-82
+ VertRefresh 50-90
+EndSection
+
+Section "Monitor"
+ Identifier "DEC PCXBV-KA/KB"
+ VendorName "DEC"
+ ModelName "PCXBV-KA/KB"
+ HorizSync 30-66
+ VertRefresh 50-130
+EndSection
+
+#From: andrew.van.der.stock@member.sage-au.org.au (Andrew van der Stock)
+#Date: 21 May 1997, 22:00:00 AEST
+
+Section "Monitor"
+ Identifier "Hewlett Packard D2818A/D2819A"
+ VendorName "HP"
+ ModelName "D2818A/D2819A"
+ HorizSync 30-65
+ VertRefresh 50-120
+ Modeline "1280x1024" 110.00 1280 1328 1512 1712 1024 1025 1028 1054
+ Modeline "1152x864" 92.00 1152 1208 1368 1474 864 865 875 895
+ Modeline "1024x768" 85.00 1024 1032 1152 1360 768 784 787 823
+ Modeline "800x600" 60.75 800 864 928 1088 600 616 621 657 -hsync -vsync
+ Modeline "640x480" 36.00 640 696 752 832 480 481 484 509 -hsync -vsync
+ Modeline "640x400" 31.50 640 672 736 832 400 401 404 445 -hsync +vsync
+ Modeline "512x384" 22.00 512 528 592 640 384 385 388 404 -hsync -vsync
+ Modeline "480x300" 29.95 480 504 584 624 300 319 322 333 doublescan
+ Modeline "400x300" 25.00 400 424 488 520 300 319 322 333 doublescan
+ Modeline "320x240" 15.75 320 336 384 400 240 244 246 262 doublescan
+ Modeline "320x200" 12.59 320 336 384 400 200 204 205 225 doublescan
+EndSection
+
+#From: hohndel@XFree86.Org (Dirk Hohndel)
+#Date: 31 July 1997, 12:18:28 MEST
+
+Section "Monitor"
+ Identifier "Elsa 24"
+ VendorName "Elsa"
+ ModelName "24H96
+ HorizSync 30-96
+ VertRefresh 50-160
+ # 640x480@60Hz
+ Modeline "640x480" 25.200 640 656 720 840 480 481 484 500
+ # 800x600@90Hz
+ Modeline "800x600" 59.400 800 816 896 1056 600 601 604 625
+ # 1024x768@90Hz
+ Modeline "1024x768" 94.464 1024 1040 1136 1312 768 769 772 800
+ # 1152x864@90Hz
+ Modeline "1152x864" 120.528 1152 1168 1280 1488 864 865 868 900
+ # 1280x1024@90Hz
+ Modeline "1280x1024" 161.947 1280 1296 1440 1688 1024 1025 1028 1066
+ # 1600x1000@90Hz
+ Modeline "1600x1000" 194.875 1600 1616 1744 2080 1000 1001 1004 1041
+ # 1600x1024@90Hz
+ Modeline "1600x1024" 201.090 1600 1616 1760 2096 1024 1025 1028 1066
+ # 1600x1200@75Hz
+ Modeline "1600x1200" 198.000 1600 1616 1776 2112 1200 1201 1204 1250
+ # 1792x1120@75Hz
+ Modeline "1792x1120" 204.983 1792 1808 1952 2344 1120 1121 1124 1166
+ # 1920x1200@75Hz
+ Modeline "1920x1200" 237.000 1920 1936 2096 2528 1200 1201 1204 1250
+ # 1920x1280@70Hz
+ Modeline "1920x1280" 235.357 1920 1936 2096 2528 1280 1281 1284 1330
+ # 2048x1280@60Hz
+ Modeline "2048x1280" 243.139 2048 2064 2576 3016 1280 1281 1284 1333
+EndSection
+
+
+# $XFree86: xc/programs/Xserver/hw/xfree86/doc/Monitors,v 3.17 1997/07/31 10:30:12 hohndel Exp $
+# $XConsortium: Monitors /main/13 1996/10/25 14:11:55 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes b/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes
new file mode 100644
index 000000000..538a9beaf
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/OS2.Notes
@@ -0,0 +1,227 @@
+ Notes on Rebuilding XFree86/OS2 from Scratch
+
+ Holger Veit
+
+ Last modified August 1st, 1999
+
+1. Preface
+
+X11 and XFree86 were initially developed on Unix-based systems. Usually Unix
+systems provide a rich number of tools and utilities to get certain things
+done. Under OS/2, these tools are not installed, but ports are available
+which are sometimes functionally equivalent to Unix utilities with the same
+name, but also differ sometimes in a subtle way. This guide will give you
+hints if you intend to rebuild the system from scratch under OS/2.
+
+Please also read README.OS2 for end-user information, and set at least the
+environment variables described there.
+
+At the current time, the most recent version available is XFree86-3.3.5.
+This is a full and unrestricted version which comes with complete source
+code. 3.3.5 is not only a bugfix release, but also supports new hardware,
+some of which might not even supported by OS/2 itself. See the RELEASE NOTES
+document for details.
+
+If you want to join the XFree86 developer team, e.g. to add support for cer-
+tain hardware, please send a request to BOD@XFree86.org. Please think about
+such a step carefully before, though, since much work is involved. Please use
+the XFree86-3.3.5 source code as a test example how to compile the system.
+The ability to manage that is a basic requirement for becoming a developer.
+
+2. Tools required
+
+I have tried to reduce the number of external tools, but when looking back it
+seems I were not very successful. At least I managed to get everything work-
+ing with the native CMD.EXE shell only. However, there is still plenty of
+software required. Most of this software is available from hobbes.nmsu.edu
+or ftp.leo.org via anonymous FTP. The following shopping list shows what you
+will need:
+
+ o gcc EMX/gcc emx 0.9C patch4 or later (0.9d preferred!)
+
+ o gzip GNU zip/unzip
+
+ o tar GNU tar
+
+ o patch Larry Wall's patch utility (attention: incompatible tool with
+ same name in OS/2)
+
+ o install BSD/GNU install
+
+ o rm,mv,cp GNU file utilities
+
+ o tee,.. GNU shell utilities
+
+ o groff GNU nroff/troff
+
+ o sed GNU sed stream editor
+
+ o grep GNU grep
+
+ o gawk GNU awk
+
+ o make GNU make 3.71/3.72 (use the one from Xprog.zip!)
+
+ o flex GNU flex
+
+ o bison GNU bison
+
+ o find GNU find (attention: incompatible tool with the same name in
+ OS/2)
+
+If there is no version number given, any new version will do. Particularly
+critical is only EMX/gcc and GNU make. Note that the second GCC implementa-
+tion which might still be available from some archives is NOT compatible.
+
+Furthermore, you need the XFree86 sources. These are available from the com-
+mon XFree86 repositories. Look into a directory which is often named
+/pub/XFree86/3.3.5/source.
+
+3. Compiling and Installing
+
+You need about 300MB of free HPFS space for the whole system. This does not
+include space for the postscript and troff documentation files. I have never
+installed them. Nor did I install the test subtree.
+
+ 1. Install all the above utilities. Refer to the corresponding documenta-
+ tion. Verify that everything works well, particularly EMX.
+
+ 2. It is a good idea to use the same or a similar structure I have. I
+ have made a directory \x11 on the partition for compiling and have put
+ everything below this tree. I found that a clean tree occupies less
+ than the half space of the disk, this gives me the opportunity to
+ rename this tree to \x11old and copy a new version to the same disk to
+ produce diffs. Last time the complete tree was arranged under the root
+ directory xc, this would become \x11\xc then.
+
+ 3. To unpack the files you would usually execute the command
+
+ gzip -dc file.tar.gz | tar xvf -
+
+ in the \x11 directory. At the end you will usually see the irritating,
+ but non-fatal message "gzip: stdout Broken pipe". Ignore it.
+
+ 4. After that, is is likely necessary to apply some patches, either from
+ the XConsortium or from the XFree86 project. Before you do this, enter
+
+ chmod -R a+rw \x11\xc
+
+ to make certain files in the tree writable.
+
+ 5. There should be a file added-XXX accompanying the patch file which
+ lists the files that are newly created. The patch program has a problem
+ with creating new directories, so we need to create them on advance.
+ For each added-XXX file you find, execute from \x11
+
+ xc\config\util\added added-XXX
+
+ If there is no added-XXX file available, you can make one with the fol-
+ lowing instructions:
+
+ grep "\*\*\* xc/" patchfile >added-file
+
+ Edit added-file with a text editor and remove the *** at the beginning
+ and the time stamp at the end (search for a TAB and erase to the end of
+ the line). You get a list of file paths, one in a line, which is the
+ input to the added utility.
+
+ 6. After that you can apply the patches in the right order. Usually this
+ is done by a command
+
+ patch -p -E <patchfile 2>&1 | tee patchlog
+
+ from the \x11 directory. Be aware to use the right patch - OS/2 has a
+ utility with the same name and different functionality. Don't use the
+ recommended -s option, this makes patch quiet, and you won't see prob-
+ lems in the patchlog file. Use
+
+ find \x11 -name *.rej -print
+ find \x11 -name *# -print
+
+ to find any rejects and unapplied patches (attention: yet another OS/2
+ program with wrong functionality). Normally there shouldn't be any
+ problems of this kind, else you have made a mistake. Finally remove the
+ original files with
+
+ find \x11 -name *.orig -print -exec rm {} ;
+
+ 7. Go to the xc/config/cf directory and edit the xf86site.def file to
+ match your requirements (you probably don't want to compile all X
+ servers). Certain changes must be set to the following values:
+
+ o Disable if not already done any PC98 server; PC98 (Japanese
+ XFree86) does not work yet. Porters from Japan are welcome!
+
+ o #define WacomSupport NO #define ElographicsSupport
+ NO Both options are not yet supported.
+
+ o Tcl* and Tk* don't need to be set explicitly. Reasonable defaults
+ are in the other config files, provided you have a complete
+ XFree86/OS2 binary tree with the tcl/tk runtime support installed.
+
+ o #define BuildDynamicLoading NO This does not work.
+
+ 8. Go to the directory xc\util\compress and make compress.exe there.
+ Install the program produced there in your path. I stumbled more than
+ once on half-ported compress programs on OS/2 ftp servers that are
+ defective w.r.t. reading and writing stdin/stdout. In some stage (font
+ compression) otherwise you will get a core dump of mkfontdir, because
+ all compressed fonts are corrupt.
+
+ 9. Set the environment variable X11ROOT to something different than it is;
+ otherwise the installation process will overwrite your original
+ XFree86/OS2 installation. If you have not set this variable, go back to
+ the prefix section of this document: you have forgotten something.
+
+ 10. Copy the file xc/pro-
+ grams/Xserver/hw/xfree86/etc/bindist/OS2/host.def.os2 to the location
+ xc/config/cf/host.def. Use this file to do any specific modifications
+ to imake variables, rather than editing the file xfree86.cf,
+ imake.tmpl, or os2.cf directly.
+
+ 11. Copy the file xc/config/util/buildos2.cmd into the xc directory. If
+ this is a second or later attempt, you might need to copy the saved
+ toplevel Makefile.os2 back to Makefile.
+
+ 12. Execute this buildos2.cmd command in the xc directory; it will produce
+ a logfile buildxc.log in this directory.
+
+ 13. Go have a bucket of coffee, or better, buy new coffee - in Colombia!
+ The compile will need between 2 and 20 hours, depending on your selec-
+ tions, and the horse power of your hardware.
+
+ 14. When finished, view the logfile for errors, and fix the problems if
+ there are some. I have managed to compile the whole system flawlessly,
+ so there is at least one configuration that works.
+
+ 15. Finally, from the xc dir, execute
+
+ xmake install
+ xmake install.man
+
+ 16. There are a few minor glitches in the installation:
+
+ 1. The xdm and linkkit directories will fail in compile and instal-
+ lation. This is no problem and has no effect on the rest of the
+ system.
+
+ 2. The imake.exe which is installed in \XFree86\bin is usually
+ defective. The one which was built initially and installed in
+ the root directory of the drive where you have the source tree is
+ okay. So simply copy this \imake.exe to the \XFree86\bin direc-
+ tory manually. Some day this might be fixed.
+
+ 3. XF86Setup is not ported yet and won't work with the tcl/tk port
+ available for XFree86/OS2. My idea was to replace this by some
+ native installation tool, which I didn't find the time to do yet.
+ Feel free to spend a bit of time to play with XF86Setup if you
+ like.
+
+Well, you see, this was quite easy :-)
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml,v 3.6 1999/08/23 06:38:50 dawes Exp $
+
+ $XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.12 1999/08/23 07:03:40 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/QuickStart.doc b/xc/programs/Xserver/hw/xfree86/doc/QuickStart.doc
new file mode 100644
index 000000000..e795fb8cc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/QuickStart.doc
@@ -0,0 +1,554 @@
+ Quick-Start Guide to XFree86 Setup
+
+ Joe Moss
+
+ 26 August 1996
+
+ Abstract
+
+ Current releases of XFree86 include several tools that can
+ help to automate the process of server configuration. Much of the
+ existing documentation, however, describes how to do the job manu-
+ ally, including many technical details. For those users with
+ esoteric hardware or with the desire to get their hands dirty under
+ the hood, this is great, but many users are using common hardware
+ and just want to get X up and running quickly. This guide is for
+ them.
+
+1. Before You Start
+
+There are a few bits of information that you will need to have before you can
+setup the server:
+
+ The model name of your video card
+ Make sure you know the exact model name of the card. It may help
+ to also know the graphics chipset, RAMDAC, and clock chip used on
+ your card.
+
+ The amount of memory on your video card
+ Find out how many megabytes of RAM are on your video card.
+
+ Whether or not your card is VGA compatible
+ Most cards these days are VGA compatible, but for example, if you
+ have and older monochrome card, it might not be.
+
+ Your monitor's specifications
+ Specifically, you need to know the horizontal sync rate(s), and
+ vertical refresh rate(s). These are important! Consult your
+ monitor's manual.
+
+ The protocol used by your mouse
+ It will help speed up the process, if you know which protocol is
+ used by your mouse to communicate. Some mice are capable of using
+ two different protocols, although the method of switching between
+ them varies.
+
+2. What to Do - An Overview
+
+There are three tools that can be used to set up XFree86:
+
+ o XF86Setup
+
+ o xf86config
+
+ o xvidtune
+
+XF86Setup primarily uses a graphical user interface and is the preferred tool
+for initial setup, but there are a few cases where it can't be used. If you
+are using a card that is not VGA compatible, have a fixed-frequency monitor,
+or are running OS/2, you'll not be able to use XF86Setup, read about xf86con-
+fig instead. If you have limited RAM or a slow system, you might be better
+off using xf86config as well.
+
+The xf86config program is text based only, but works for almost any hardware
+combination. If you have a fixed frequency monitor that won't work with
+standard text modes, you will have to read the necessary documentation and do
+the configuration manually.
+
+To get things looking just right, you may need to use xvidtune, a program
+that allows you to make adjustments to the displayed image (e.g. make it
+wider, move it a little to the left, etc.). XF86Setup will allow you to run
+xvidtune at the appropriate time; if you use xf86config, you can use xvidtune
+afterwards.
+
+ All of these are explained in detail in the following sections. If
+you're the type that doesn't like to read the documentation, but would rather
+just try and figure your way through things, you can just type XF86Setup now.
+If you have problems, the documentation will still be here.
+
+Although it is possible to use XF86Setup from within X to make changes to
+your existing configuration, such use is not specifically documented here.
+These instructions are primarily for those initially setting up XFree86 on
+their system.
+
+3. Using XF86Setup
+
+XF86Setup will first check around to make sure certain files are installed
+and that you are running as root. If a problem is found, it will display a
+message and exit. Correct the problem (e.g. install the missing files) and
+run it again.
+
+3.1 Initial questions
+
+If you have an existing XF86Config file, you will be asked if you would like
+to use it to set the default values of various configuration settings. If
+you've already got an (at least somewhat) working configuration you will want
+to do this.
+
+If you are running on an OS which has a mouse driver in the kernel (e.g. SCO
+or SVR4), you may be asked if you'd like to use it.
+
+Once the questions (if any) are completed, you will see a message indicating
+that the program is ready to switch into graphics mode. Just press Enter.
+If you don't get a graphics screen saying Welcome to XFree86 Setup within a
+minute, something has probably hung, you can try pressing Ctrl-Alt-Backspace
+to switch back to text mode and you'll probably have to use xf86config
+instead of XF86Setup.
+
+3.2 Configuration areas
+
+Once the VGA16 server is started, and once the program has finished loading,
+you will see a screen with five buttons along the top and three along the
+bottom. The buttons along the top correspond to the general categories of
+configuration settings. They can be done in any order. Each of these areas
+is explained in detail below. The bottom row consists of the Abort, Done,
+and Help buttons.
+
+Abort does as it name implies. It exits the program without saving any
+changes that have been made. The one possible exception is the link to the
+mouse device. Any change to that is made as soon as Apply is selected.
+
+Done should be selected when you've finished configuration in each of the
+various categories.
+
+The Help can be pressed at any time to get on-line help regarding the current
+configuration screen.
+
+You should start with configuring your mouse as it will make things a lot
+easier to perform the configuration of other categories.
+
+3.2.1 Mouse
+
+The mouse configuration screen is used to get the mouse working properly.
+There are key bindings for everything so that you can easily configure the
+mouse, if it's not already working.
+
+The screen includes a representation of a white mouse with three buttons. As
+you move your mouse it should show the pointer coordinates on the mouse and
+the buttons should turn black as you press the corresponding button on your
+mouse. If that is not happening, then your mouse is not correctly config-
+ured.
+
+Along the top is a row of buttons corresponding to the various possible pro-
+tocols. There will also be several buttons and a couple of sliders for other
+settings, a visual representation of the mouse, and a button to apply any
+changes. There may also be an entry box in which the device can be set along
+with a list of possible devices.
+
+First try moving your mouse around and see if the pointer moves correctly.
+If so, try testing that the buttons are working properly. If those are work-
+ing as desired, go ahead and go on to another configuration area.
+
+If the mouse pointer doesn't move at all, you need to fix either the mouse
+device or the protocol (or both). You can press 'n' followed by a Tab, to
+move to the list of mouse devices and select a different one. Pressing 'p'
+will pick the next available protocol on the list. After changing these,
+press 'a' to apply the changes and try again. Repeat the process until you
+are getting some response from your mouse.
+
+If the mouse pointer or button indicators do something when you move the
+mouse, but the pointer is not moving properly, you probably have the wrong
+protocol selected. Try with a different one.
+
+Most mice these days use the Microsoft protocol, the second most common is
+MouseSystems. Some mice do both. These dual-protocol mice have various
+methods of switching between the two protocols. Some have a switch on the
+mouse itself. Some are switched by sending a certain signal to the mouse
+when opening a connection to the mouse. These signals can be controlled by
+using different combinations of the 'ClearDTR' and 'ClearRTS' settings.
+Other mice require a button to be depressed when the mouse is opened (when
+the mouse driver first tries to talk to it). If your mouse uses this method,
+hold down the appropriate button while selecting apply (pressing 'a').
+
+Once the mouse pointer is moving correctly, test that all three buttons are
+working properly. If your mouse only has two buttons, select 'Emulate3But-
+tons' and you should be able to press both buttons simultaneously to emulate
+the missing middle button. If not all of the buttons are working, try chang-
+ing the 'ChordMiddle' setting or you may be using a protocol that is similar
+to that of your mouse, but not quite right.
+
+3.2.2 Keyboard
+
+You need to specify the model and layout of your keyboard (and press apply)
+if they are not already correct. The graphical representation of the key-
+board will be updated when you choose a different model.
+
+For non-U.S. keyboards you may wish to choose a variant from the list (at
+this time there is only one available variant: nodeadkeys>).
+
+You can also pick from the options to the right, if you wish.
+
+3.2.3 Card
+
+Pick your card from the list.
+
+If there are README files that may pertain to your card the 'Read README
+file' button will then be usable (i.e. not greyed out). Please read them.
+
+If your card is not in the list, or if there are any special settings listed
+in the README file as required by your card, you can press the 'Detailed
+Setup' button to make sure that the required settings are selected. Other-
+wise, you're finished with configuring your card.
+
+To use 'Detailed Setup': First select the appropriate server for your card.
+Then read the README file corresponding to the selected server by pressing
+the 'Read README file' button (it won't do anything, if there is no README).
+
+Next, pick the chipset, and Ramdac of your card, if directed by the README
+file. In most cases, you don't need to select these, as the server will
+detect (probe) them automatically.
+
+The clockchip should generally be picked, if your card has one, as these are
+often impossible to probe (the exception is when the clockchip is built into
+one of the other chips).
+
+Choose whatever options are appropriate (again, according to the README).
+
+You can also set the maximum speed of your Ramdac. Some Ramdacs are avail-
+able with various speed ratings. The max speed cannot be detected by the
+server so it will use the speed rating of the slowest version of the speci-
+fied Ramdac, if you don't specify one.
+
+Additionally, you can also specify the amount of RAM on your card, though the
+server will usually be able to detect this.
+
+3.2.4 Monitor
+
+Enter the horizontal and vertical frequency ranges that your monitor supports
+in the corresponding entry boxes near the top of the screen. You can enter
+specific frequencies or ranges of frequencies (separated by hyphens). If the
+monitor supports several different frequencies or ranges, list them all, sep-
+arated by commas.
+
+If you can not find this information in you monitor's manual, pick one of the
+choices from the list of common monitor capabilities. The program will use
+conservative values for each of these, so you'll get better performance if
+you type in the correct values from your monitor manual.
+
+3.2.5 Other
+
+You can probably just skip this one.
+
+3.2.6 Completing the configuration
+
+Once you've finished with the above, press the 'Done' button and then the
+'Okay' button which will appear. You will then be switched back to text mode.
+
+3.3 Back to text mode
+
+The program will now attempt to start the appropriate server for your card,
+with all of the configuration settings you selected. If for some reason it
+is unable to start the server, you have likely selected an improper setting
+and will be asked if you would like to return to the graphical configuration
+screen and try again.
+
+3.4 The second server
+
+This is unlikely to happen, but if when the server starts, the display is
+unreadable, try pressing Ctrl-Alt-+ (using the plus on the numeric keypad) to
+switch to a different video mode.
+
+The display will show an entry box and three buttons.
+
+The first button allows you to run xvidtune to adjust your video modes. One
+important point to keep in mind when using xvidtune is that switching video
+modes with Ctrl-Alt-+ is disabled while xvidtune is running. You must use
+the 'Next' and 'Prev' buttons to switch modes. Because of this, you should
+be careful not to move the mouse when pressing either of these. If by some
+chance the mode you switch to doesn't produce a readable display on your mon-
+itor, you can then just press the mouse button again to move to the next
+(hopefully readable) mode.
+
+The second button causes the settings you've made to be written to the file-
+name given in the entry box. After saving the settings a message will appear
+indicating that it has finished. Just press the 'Okay' button and you're
+done.
+
+And the third button causes the program to exit without saving any of the
+configuration settings.
+
+3.5 Ending text
+
+You are returned to text mode and the program will print a `Configuration
+complete.' message. You should now have a usable configuration file and can
+start the X server by whichever method you wish (usually either the 'startx'
+command or via 'xdm').
+
+4. Running xf86config
+
+From a text screen, run the xf86config program. This program should be run
+as root (although not absolutely necessary, it will allow xf86config to do
+more of the work for you). You can press your interrupt character (usually
+Control-C or perhaps Delete), at any time to stop the program, if you need
+to. You can just start it over again.
+
+The xf86config program provides instructions on screen as to what you need to
+do. Following are some notes that document the various stages in the pro-
+cess. They should help you get through the process quickly and provide some
+documentation for those people who like to know what they're getting them-
+selves into, before running a program.
+
+4.1 The intro screen
+
+First, xf86config begins by telling you a few things like the fact that it
+can help you setup an XF86Config file or that you can do the job yourself
+with an editor. Just read what it says and press Enter when done.
+
+4.2 Getting your PATH right
+
+The program will next check that you have the directory /usr/X11R6 (the stan-
+dard installation directory) on your system and tell you that it needs to be
+in your PATH environment variable.
+
+It will also check if you have the /usr/X386 directory as used by older (pre
+3.0) versions of XFree86. If by chance you do, it will warn you that
+/usr/X11R6 must be before /usr/X386 in your PATH.
+
+If everything is okay, just press Enter and go on, otherwise press Control-C
+to exit and make any necessary changes and restart xf86config.
+
+4.3 Mouse setup
+
+Pick the mouse type from the menu and enter the name of the device to which
+mouse is connected, as directed.
+
+If you are using an OS (e.g. SVR4, SCO) that has a built in mouse driver that
+the Xserver could use, you'll need to edit the XF86Config file to setup your
+mouse, so just pick any mouse from the list and press enter when asked for
+the device.
+
+If you don't know which protocol your mouse uses, you'll just have to guess
+(the xf86config program will give you some hints as to which might be most
+likely) and then see the troubleshooting section if it doesn't work when you
+run the server.
+
+4.4 Keyboard setup
+
+Simply answer yes to the question regarding keyboard setup.
+
+If there is some reason you need to use the right-alt and control keys for
+something else, you can enter no.
+
+4.5 Monitor setup
+
+Setting up a monitor consists of entering the specifications of your monitor
+and a description of the model and manufacturer.
+
+You are first asked for the horizontal sync rate. It is VERY important to
+enter the correct value(s) from the manual. If one of the ranges given
+matches the rate of your monitor, then pick it, otherwise pick custom and
+enter the values from your manual.
+
+Next is the vertical refresh rate. Again, it is VERY important that this
+parameter be specified correctly. Enter it in a manner similar to the hori-
+zontal sync rate.
+
+If either rate is mis-specified, it can result in damage to your monitor.
+
+Finally, you are asked for an "identifier", your monitor manufacturer, and
+model. You can just press enter to get through these quickly.
+
+4.6 Selecting your card
+
+You are next asked if you would like to view the database of cards. Picking
+your card from the list will cause the answers to the questions in the next
+two sections to be filled in for you and so can save a little time.
+
+If your card does not appear in the list, just press q and enter to skip on
+to the next step - where you'll have to answer the questions yourself.
+
+4.7 Server selection
+
+If you selected your card in the previous step, then server selection is easy
+- just use the recommendation from the database.
+
+If you have a card which uses one of the chipsets for which a specific server
+exists (Mach8, Mach32, Mach64, AGX/XGA, 8514/A, S3, I128, P9000) you'll want
+to pick the accel option.
+
+Otherwise you'll probably want to use the SVGA server.
+
+Next, answer yes when the program asks if you want it to set the symbolic
+link for you. If you picked the accel option, you'll also need to indicate
+which particular accelerated server to link to.
+
+4.8 Screen/Video configuration
+
+Pick the appropriate option from the list to indicate the amount of memory on
+your video card.
+
+Then you are asked to provide and identifier, the manufacturer, and the model
+of your card. You can just press enter to skip through these, if you wish.
+
+Next, the program will ask for the type of RAMDAC and Clockchip on your card.
+If your card was in the database, you should just to tell it to use the val-
+ues from the database.
+
+If you don't have one of the listed RAMDACs or Clockchips on your card, just
+press enter when asked what type you have. If you do not have a programmable
+clock chip, the program will next attempt to probe to find out what clock
+rates are supported by your clock chip.
+
+4.9 Mode Selection
+
+Now you get to tell the program which video modes you would like to be able
+to run.
+
+The program will show you the common modes that should work with your card
+(some might not work with your monitor, but if you've correctly specified the
+monitor's sync rates, the X server will just ignore them when it runs).
+
+You could just accept the settings as they are given, but you'll probably
+wish to reverse the order. For example, if you have a card with 1 Meg RAM,
+it will list the modes
+
+ "640x480" "800x600" "1024x768" for 8bpp
+
+Select 1 to change the settings for 8bpp and the type 432 to select the
+reverse order.
+
+When you've select the modes, in the order you wish, select option 4 to con-
+tinue.
+
+4.10 Creating the XF86Config file
+
+The program will now ask if you would like to write the configuration set-
+tings you've selected to the file XF86Config. Answer yes.
+
+4.11 Some final notes
+
+Lastly, the program tells you that it's finished its part of this process and
+counsels you to check the file before using it. The next section covers the
+changes that are most likely to be needed.
+
+5. Fixing the XF86Config file
+
+Use an editor to look at the XF86Config file. Here are some things that may
+need to be changed:
+
+ o If you are running an operating system which has built-in mouse support,
+ you'll want to change the Pointer section. Specifically, you should set
+ the Protocol to OSMouse (SCO) or Xqueue (SVR4, some SVR3) and you should
+ remove the Device line.
+
+ o If you are running a system with the Xqueue event driver and would like
+ to use it, change the Protocol setting in the Keyboard section to
+ Xqueue.
+
+Once you are satisfied that the configuration is correct, copy the XF86Config
+file to /usr/X11R6/lib/X11 and run the 'startx' command.
+
+You should now have a running X server. If it's running but the display
+doesn't look as good as you think it should (i.e. it doesn't fill the whole
+screen, it's off-center, it's wrapping around on one side, etc.) see the sec-
+tion on xvidtune. If there is some other problem, see the troubleshooting
+section.
+
+6. Running xvidtune
+
+If you need to make adjustments to the video display, xvidtune is the tool to
+use.
+
+Simply enter the command xvidtune from a shell prompt within an xterm. Read
+the warning and click on OK. Next click on the Auto button.
+
+Now click on whatever combination of Up/Down/Left/Right
+Shorter/Taller/Wider/Narrower is need to adjust the display to your liking.
+
+If you are using a recent S3-based card there will be some extra buttons and
+entries at the bottom (InvertVCLK, EarlySC, and Blank Delays). These can help
+solve problems of the display wrapping around a few pixels.
+
+Once the display has been adjusted properly, press the show button to print-
+out the correct ModeLine to put in the XF86Config to make the server always
+use the current display settings. To aid in copying this information to your
+XF86Config file, the modeline is also made the current selection allowing you
+to just paste it into your editor.
+
+If you would like to adjust your other modes, you can click on the Next and
+Prev buttons to switch modes.
+
+When you are through using xvidtune simply press on the Quit button.
+
+7. Troubleshooting
+
+Since you're reading this, something must not have gone the way you had hoped
+(or else you just really enjoy reading).
+
+Below are listed some common problems that may occur during configuration and
+some hints for solving them. However, there are just too many different com-
+binations of hardware and software configurations, and, well, just too many
+things that can go wrong, for this document and the tools it documents, to
+cover every case.
+
+If after trying the steps in the previous sections and checking the hints in
+this section, you still are unable to get your system working, you'll have to
+read the full documentation. Read the README file for your card and OS (if
+they exist), the XFree86 Configuration Guide (README.Config), and the
+XF86Config man page.
+
+You should also look at the XFree86 FAQ <URL:http://www.XFree86.org/FAQ> for
+more up-to-date information, especially if you are trying to configure a
+fairly new card.
+
+If all else fails, you can try posting a message to comp.windows.x.i386unix
+or comp.os.linux.x or send email to XFree86@XFree86.org.
+
+7.1 The mouse doesn't move correctly, it stays in one area of the screen
+
+You've selected the wrong protocol for your mouse. Try a different one.
+
+7.2 The server doesn't start, it says the mouse is busy.
+
+Well, it's probably right. This most often happens on Linux systems that
+have gpm running. Kill the gpm process and try startx again.
+
+7.3 The middle button doesn't work.
+
+There's no easy answer to this one. It's a lot of trial and error. You need
+to make sure you're running the right protocol for your mouse.
+
+Many three button mice are "dual protocol" which means that they have both a
+2-button and 3-button mode. The way to get the mouse to switch into 3-button
+mode (which usually then uses MouseSystems protocol) varies between different
+models.
+
+You may need to slide a switch on the mouse or hold down the middle button
+when starting the server. Other methods of switching modes can be done by
+the server, you just have to find the right combination of settings for your
+mouse. See the Pointer section of the XF86Config man page for a complete
+list of settings.
+
+7.4 The display is shifted to the left/right/top/bottom
+
+See the section on xvidtune.
+
+7.5 I don't appear to have xf86config or xvidtune on my system
+
+Hmmm. Three possibilities:
+
+ 1. You have a version of XFree86 that is older than 3.1.2. If this is the
+ case then you probably aren't reading this document either, because it
+ wasn't included in 3.1.2 and earlier releases. Please upgrade to the
+ latest version.
+
+ 2. Your PATH is not set correctly. Make sure it includes the bin directory
+ for the XFree86 binaries (usually, /usr/X11R6/bin
+
+ 3. You don't have a complete installation of XFree86. Go back to wherever
+ you got XFree86 and get the missing pieces.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml,v 3.6 1998/04/12 12:43:41 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/QuickStart.doc,v 3.10 1999/04/15 03:34:45 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/READ.Mach32 b/xc/programs/Xserver/hw/xfree86/doc/READ.Mach32
new file mode 100644
index 000000000..c523017b9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/READ.Mach32
@@ -0,0 +1,166 @@
+ Notes for Mach32 X Server
+
+ Bryan Feir (jenora@istar.ca)
+
+ 2 July 1997
+
+1. Supported Cards, RAMDACs, and Bits Per Pixel
+
+The base support in the Mach32 X server is for 8 bpp, with a dot clock of up
+to 80 MHz. At present 15/16 bpp is supported on only three of the many RAM-
+DACs; however those three cover the most commonly sold cards.
+
+ RAMDAC Max Dot Clock BPP Max Resolution Video RAM Required
+ -------- ------------- --- -------------- ------------------
+ Default 80MHz 8 1280x1024i 2Mb
+ Default 80MHz 8 1024x768 1Mb
+
+ ATI68875 135MHz 8 1280x1024 2Mb
+ ATI68875 80MHz 16 1024x768 2Mb
+
+ AT&T20C49x 80MHz 8 1024x768 1Mb
+ AT&T20C49x 40MHz 16 800x600 2Mb
+
+ BT481 80MHz 8 1024x768 1Mb
+ BT481 40MHz 16 800x600 2Mb
+
+The RAMDAC is reported when you run the Mach32 X server with the "-probeonly"
+command line option, or can be specified in the XF86Config file.
+
+The ATI68875 (or the TLC34075) is used on the Graphics Ultra + and the Graph-
+ics Ultra Pro. The Brooktree 481 is used on most Graphics Wonder cards. The
+AT&T20C491 is used on many of the OEM cards that are built into component
+systems.
+
+The BIOS detection unfortunately lumps the BT481 and the AT&T20C49x together,
+while they require different configuration controls in 16 bit mode. Super-
+Probe can tell the difference, and will report which it finds. In the server
+itself, the BT481 is considered the default value. If you have an AT&TC49x
+RAMDAC on your card you will have to include the Ramdac entry in the XF86Con-
+fig file as below.
+
+2. XF86Config options
+
+Several options are supported in the "Device" section for the Mach32 X
+server. Most of them should be auto-detected if needed, but a few may need
+to be deliberately set. For example, the "Clocks" entry should almost cer-
+tainly be set after first running the server with the -probeonly option, so
+as to avoid the probe in later runs.
+
+ Option "composite"
+ This option will set the composite sync for monitors that require
+ this.
+
+ Option "dac_8_bit"
+ This option enables 8 bits per RGB value. Note this option does
+ not work with all RAMDACs, and is not considered supported by the
+ Mach32 itself.
+
+ Option "ast_mach32"
+ This option sets some special handling for the AST version of the
+ Mach32 card that comes soldered in to some of their motherboards.
+ This card will lock up without this option.
+
+ Option "intel_gx"
+ This option sets the memory aperture address to the hardwired
+ value for the Intel GX Pro. It is equivalent to setting Membase
+ to 0x78000000.
+
+ Option "no_linear"
+ This option disables the use of the linear mapped framebuffer.
+ This should be auto-detected.
+
+ Option "sw_cursor"
+ This option allows you to use the software cursor instead of the
+ hardware cursor.
+
+ MemBase baseaddress
+ This entry specifies the video memory aperture address. Normally
+ the aperture address is automatically determined, but on some
+ VESA Local Bus systems the address chosen will not work. If the
+ Mach32 X server is dying with a seg. fault, then try setting the
+ aperture address to another location.
+
+ Clocks clock ...
+ This entry gives the clock rates for the server to use.
+
+ Ramdac "type"
+ This entry specifies the RAMDAC type. The following values are
+ valid for type:
+
+ o ati68830
+
+ o sc11483
+
+ o sc11486
+
+ o sc11488
+
+ o ims_g173
+
+ o mu9c4870
+
+ o ati68875*
+
+ o bt885
+
+ o tlc34075*
+
+ o bt476
+
+ o bt478
+
+ o inmos176
+
+ o inmos178
+
+ o bt481*
+
+ o bt482
+
+ o ims_g174
+
+ o mu9c1880
+
+ o mu9c4910
+
+ o sc15025
+
+ o sc15026
+
+ o att20c490*
+
+ o ati68860
+
+ o stg1700
+
+ o sc15021
+
+ o stg1702
+
+ o att21c498
+
+ Only the ones marked with [*] have an effect yet.
+
+3. Known Problems and Bug Reports
+
+There are several known problems with the current version of the Mach32 X
+server. They include:
+
+ o Not all RAMDACs are supported at higher colour ranges, and not all that
+ are can be detected properly. In fact most of the RAMDAC values above
+ have no effect except to block higher bit modes.
+
+ o Sixteen bit character support (e.g., Chinese and Japanese character
+ sets) has been known to lose parts of characters. While this should be
+ fixed, if it occurs try running the server with Option "no_linear".
+
+Bug reports should be sent to XFree86@XFree86.org or posted to the comp.win-
+dows.x.i386unix newsgroup.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Mach32.sgml,v 3.7 1997/07/10 08:17:25 hohndel Exp $
+
+ $XConsortium: Mach32.sgml /main/4 1996/10/28 04:47:43 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/READ.Mach32,v 3.11 1999/04/15 03:34:46 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/READ.Mach64 b/xc/programs/Xserver/hw/xfree86/doc/READ.Mach64
new file mode 100644
index 000000000..c2cd28aba
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/READ.Mach64
@@ -0,0 +1,387 @@
+ Mach64 X Server Release Notes
+
+ Kevin E. Martin (martin@cs.unc.edu)
+
+ 1999 June 28
+
+1. Supported Cards, RAMDACs, and Bits Per Pixel
+
+The Mach64 X server supports 8bpp with a dot clock up to 80MHz on all Mach64
+based cards. On most cards, higher dot clocks and additional depths are
+available (see the table below). What determines this support is the RAMDAC
+on your card.
+
+ RAMDAC Max Dot Clock BPP Max Resolution Video RAM Required
+ -------- ------------- --- -------------- ------------------
+ ATI68860 135MHz 8 1280x1024 2Mb
+ ATI68860 135MHz 16 1280x1024 4Mb
+ ATI68860 80MHz 32 1024x768 4Mb
+
+ ATI68875 80MHz 32 1024x768 4Mb
+
+ CH8398 135MHz 8 1280x1024 2Mb
+ CH8398 80MHz 16 1024x768 2Mb
+ CH8398 40MHz 32 800x600 2Mb
+
+ STG1702 135MHz 8 1280x1024 2Mb
+ STG1702 80MHz 16 1024x768 2Mb
+ STG1702 50MHz 32 800x600 2Mb
+
+ STG1703 135MHz 8 1280x1024 2Mb
+ STG1703 80MHz 16 1024x768 2Mb
+ STG1703 50MHz 32 800x600 2Mb
+
+ AT&T20C408 135MHz 8 1280x1024 2Mb
+ AT&T20C408 80MHz 16 1024x768 2Mb
+ AT&T20C408 40MHz 32 800x600 2Mb
+
+ 3D Rage II 170MHz 8 1600x1200 4Mb
+ 3D Rage II 170MHz 16 1600x1200 4Mb
+ 3D Rage II 170MHz 32 1024x768 4Mb
+
+ 3D Rage II+DVD 200MHz 8 1600x1200 4Mb
+ 3D Rage II+DVD 200MHz 16 1600x1200 4Mb
+ 3D Rage II+DVD 200MHz 32 1024x768 4Mb
+
+ Rage Pro 230MHz 8 1600x1200 8Mb
+ Rage Pro 230MHz 16 1600x1200 8Mb
+ Rage Pro 230MHz 32 1600x1200 8Mb
+
+ Internal 135MHz 8 1280x1024 2Mb
+ Internal 80MHz 16 1024x768 2Mb
+ Internal 40MHz 32 800x600 2Mb
+
+ IBM RGB514 220MHz 8 1600x1200 2Mb
+ IBM RGB514 220MHz 16 1600x1200 4Mb
+ IBM RGB514 135MHz 32 1024x768 4Mb
+
+ All Others[*] 80MHz 8 1280x1024 2Mb
+
+[*] - The dot clocks are limited to 80MHz and the bpp is limited to 8.
+
+The table above specifies the maximum resolution and the video memory
+required to run this maximum resolution. Smaller resolutions will require
+less video memory.
+
+The RAMDAC is reported when you run the Mach64 X server with the "-probeonly"
+command line option. The RAMDAC reported should be correct for all Mach64
+cards. It can also be specified in the XF86Config file, but this is not rec-
+ommended unless the RAMDAC reported in the probeonly output is incorrect.
+Before specifying the RAMDAC in your XF86Config file visually verify which
+RAMDAC is on your Mach64 card. If the RAMDAC reported in the probeonly out-
+put is definitely different than what you see on the card, then check to see
+if you have a RAMDAC specified in your XF86Config file. If you do, comment
+this line out and re-run the Mach64 X server with the "-probeonly". If it
+still reports the incorrect RAMDAC, please send in a bug report to
+XFree86@XFree86.Org.
+
+The ATI68860 RAMDACs are usually found on ATI Graphics Pro Turbo and ATI Win-
+Turbo cards. The IBM RGB514 RAMDAC is found on the ATI Graphics Pro Turbo
+1600 card. The other RAMDACs are usually found on ATI Graphics Xpression,
+ATI Video Xpression and ATI 3d Xpression cards. Mach64 CT, ET, VT, VT3, VT4,
+LT, GT (3D Rage), 3D Rage II, 3D Rage IIC, 3D Rage II+DVD, Rage Pro, and Rage
+LT Pro chips have an "Internal" RAMDAC (i.e., it is built into the Mach64
+chip).
+
+As advertised, Mach64 graphics cards can use a special 24bpp mode (packed
+pixel mode), but this is not currently supported in the Mach64 X server.
+This will be added in the next major release.
+
+The Mach64 X server requires the video memory aperture to function properly.
+This means that ISA Mach64 cards in systems with more than 12Mb of main mem-
+ory will not work. If you have a PCI based Mach64 card or a VLB based Mach64
+card, then the Mach64 X server will work with any amount of main memory.
+
+Accelerated doublescan modes are supported on VT, VT3, VT4, LT, GT, Rage II,
+Rage IIC, Rage II+DVD, Rage Pro and Rage LT Pro based Mach64 cards. Mach64
+cards with other chips cannot handle accelerated double scan modes due to a
+hardware limitation. Non-accelerated doublescan modes should work with the
+ATI driver in the SVGA X server for all Mach64 cards.
+
+2. Optimizing the speed of the Mach64 X server
+
+To maximize the speed of the Mach64 X server, I suggest that you use the fol-
+lowing maximum resolutions. This will allow room for the font and pixmap
+caches and a hardware cursor.
+
+ Max Resolution BPP Video RAM
+ -------------- --- ---------
+ 1600x1200 8 8Mb
+ 1600x1200 16 8Mb
+ 1280x1024 32 8Mb
+
+ 1280x1024 8 4Mb
+ 1280x1024 16 4Mb
+ 1024x767 32 4Mb
+
+ 1280x1024 8 2Mb
+ 1024x767 16 2Mb
+ 800x600[*] 32 2Mb
+
+ 1024x767 8 1Mb
+ 800x600[*] 16 1Mb
+
+[*] - With a 2MB video card, the only way to use the font and pixmap caches
+is to have a virtual resolution of 1024x480 with a 640x480 mode. I suggest
+using 800x600 to maximize your screen size at the cost of the speed gained
+from the caches. The same argument can be made for 1MB video cards running
+in 16bpp mode. Note that it is not possible to run in 32bpp mode with 1MB of
+video memory.
+
+Technical explanation for the above suggestions: The Mach64 X server uses a
+font and pixmap cache that is only available at a screen width of 1024 or
+greater. This restriction will be removed in a future version of the X
+server. To obtain the best performance from your video card, you need to
+make sure that there is enough room off-screen for the caches (at least
+1024x256). In addition to the cache, the Mach64 uses memory mapped registers
+which are mapped to the last 1024 bytes of the memory aperture. This takes
+away another line from video memory. Thus, you need at least a video memory
+area of 1024x257.
+
+3. XF86Config options
+
+Several options are supported in the "Device" section for the Mach64 X
+server. By default, the Mach64 X server will determine the RAMDAC type from
+the BIOS. If you wish to override the default RAMDAC type (not recommended
+unless the BIOS incorrectly reports your RAMDAC type), you can specify the
+RAMDAC type in the XF86Config file with the "Ramdac" entry. The Mach64 X
+server will also program the clocks based on the clock chip read from the
+BIOS. If you wish to override the default clock chip type (not recommended
+unless the BIOS incorrectly reports your clock chip type), you may specify
+the clock chip in the XF86Config file with the "ClockChip" entry. If, how-
+ever, you wish to use the preprogrammed clocks, you can turn off the clock
+programming with the "no_program_clocks" option. In this case, the Mach64 X
+server reads the Clocks from the BIOS. The "Clocks" lines in the XF86Config
+file are normally ignored by the Mach64 X server unless the "no_bios_clocks"
+option is given. Note on newer Mach64 cards (CT, ET, VT, GT, 3D Rage II, 3D
+Rage II+DVD and Rage Pro) the "Ramdac", "ClockChip" and "Clocks" lines have
+no meaning and should not be included in your XF86Config file.
+
+ Option "sw_cursor"
+ This option allows you to use the software cursor instead of the
+ hardware cursor.
+
+ Option "hw_cursor"
+ This option turns on the hardware cursor. This should not be
+ necessary since the hardware cursor is used by default unless the
+ "sw_cursor" option is specified.
+
+ Option "composite"
+ This option will set the composite sync for monitors that require
+ this.
+
+ Option "dac_8_bit"
+ This option enables 8 bits per RGB value. Note that this does
+ not work with the Chrontel 8398 RAMDAC. This options is not nec-
+ essary since 8 bits per RGB value is the default for the Mach64 X
+ server for all Mach64 cards except those with the Chrontel 8398
+ RAMDAC.
+
+ Option "dac_6_bit"
+ This option enables 6 bits per RGB value.
+
+ Option "override_bios"
+ This option allows you to specify a video mode that the video
+ card's BIOS believes to be illegal. Some BIOSs have incorrect
+ maximum resolution and/or dot clock limitations. Use this option
+ with extreme care. It is possible to specify a video mode that
+ can damage your card or monitor.
+
+ Option "no_block_write"
+ This option allows you to turn off block write mode. Block write
+ mode only works on certain types of VRAM cards. This option has
+ no effect on DRAM based cards. If you see noise on the screen
+ that can be captured via xmag, then it is probably a problem with
+ block write mode being turned on when it should not. This
+ ``noise'' usually looks like bits of windows/menus repeated on
+ the screen.
+
+ Option "block_write"
+ This option allows you to turn on block write mode. Block write
+ mode only works on certain types of VRAM cards, and this option
+ has no effect on DRAM based cards. If you want to override the
+ probed default, you can use this option. Note that this may
+ result in ``noise'' appearing on the screen.
+
+ Option "power_saver"
+ This option allows the server to use the power saving features of
+ certain "green" monitors instead of blanking when the screen
+ saver is activated. This option is still experimental.
+
+ Option "no_program_clocks"
+ This option allows you to disable the clock programming. Nor-
+ mally the Mach64 server will program the clocks based on the
+ clock chip type unless this option is given. With this option,
+ the clocks are either read from the BIOS or, if the
+ "no_bios_clocks" option is set, set from the Clocks line.
+
+ Option "no_bios_clocks"
+ This option allows you to override the clocks read from the video
+ card's BIOS and use the clocks specified in the Clocks line in
+ your XF86Config file. Normally the Mach64 server will ignore
+ both the BIOS clocks and the clocks specified in the Clocks line
+ unless the "no_program_clocks" options is set (see above).
+
+ Option "no_font_cache"
+ This option allows you to disable the font cache. By default the
+ font cache is turned on if the horizontal resolution is 1024 pix-
+ els or greater and there is enough off-screen video memory to
+ hold the cache.
+
+ Option "no_pixmap_cache"
+ This option allows you to disable the pixmap cache. By default
+ the pixmap cache is turned on if the horizontal resolution is
+ 1024 pixels or greater and there is enough off-screen video mem-
+ ory to hold the cache.
+
+ Option "fifo_conservative"
+ This option allows you to use a more conservative display fifo
+ value. If you are experiencing snow or vertical banding on the
+ screen, try adding this option to see if it fixes the problem.
+
+ MemBase baseaddress
+ This entry specifies the video memory aperture address. By
+ default the aperture address is automatically determined and this
+ option should not be necessary. If the Mach64 X server is dying
+ with a seg. fault, then the memory aperture might not be cor-
+ rectly determined. To fix this try setting the aperture address
+ to another location.
+
+ ClockChip "type"
+ This entry specifies the clock chip type. The following values
+ are valid for type:
+
+ o ati18818
+
+ o att20c408
+
+ o ch8398
+
+ o ibm_rgb514
+
+ o ics2595
+
+ o stg1703
+
+ Ramdac "type"
+ This entry specifies the RAMDAC type. The following values are
+ valid for type:
+
+ o ati68860
+
+ o ati68860b
+
+ o ati68860c
+
+ o ati68875
+
+ o att20c408
+
+ o ch8398
+
+ o ibm_rgb514
+
+ o internal
+
+ o stg1702
+
+ o stg1703
+
+ o tlc34075
+
+ DacSpeed "MHz"
+ This entry allows you to override the default maximum dot clock.
+ Use this option with extreme caution. If you specify a MHz value
+ too large for your card, you can damage it.
+
+4. Enhancements for this release
+
+With this release, the following enhancements have been made:
+
+ o Proper identification of all current Mach64 chips
+
+ o Support for VT4 and Rage IIC based cards
+
+ o Improved timing calculation for video FIFOs
+
+ o Fixed timing bug in font code
+
+ o Fixed VGA font restoration bug when exiting the X server
+
+5. Cards known to work with this release
+
+The following is a list of cards that have been tested with this release.
+Many other cards should work including All-In-Wonder and All-In-Wonder Pro
+cards as well as motherboards with Mach64, 3D Rage II and Rage Pro included
+on them. If you have a new card that does not appear to work, see the Known
+Problems and Bug Reports section below.
+
+ ATI Xpert@Play 98 4MB 3D Rage Pro (AGP)
+ ATI Xpert 98 4MB 3D Rage Pro (PCI)
+ ATI Xpert XL 4MB 3D Rage Pro (AGP)
+ ATI Rage IIC 4MB 3D Rage IIC (AGP)
+ ATI Xpert@Play 8MB 3D Rage Pro (AGP/PCI)
+ ATI Xpert@Work 2MB 3D Rage Pro (PCI)
+ ATI Pro Turbo+PC2TV 4MB 3D Rage II+DVD (rev 154)
+ ATI 3D Xpression+ 4MB 3D Rage II (GT-B, SGRAM, rev 65)
+ ATI 3D Xpression+ 2MB 3D Rage II (GT-B, SDRAM, rev 65)
+ ATI 3D Xpression 2MB 3D Rage (GT-A, rev 72)
+ ATI Video Xpression+ 2MB Mach64 VT-A3 (rev 8)
+ ATI Video Xpression 2MB Mach64 VT-A4 (rev 72)
+ ATI Graphics Xpression 2MB Mach64 CT (rev 9)
+ ATI Graphics Xpression 2MB Mach64 CT-C (rev 65)
+ ATI Graphics Xpression 2MB Mach64 CT-D (rev 10)
+ ATI Graphics Xpression 2MB Mach64 GX (rev 1) with Chrontel8398 RAMDAC
+ ATI Graphics Pro Turbo 2MB Mach64 GX (rev 0) with 68860-B RAMDAC
+ ATI Graphics Pro Turbo 2MB Mach64 CX (rev 1) with AT&T20C408 RAMDAC
+ ATI WinTurbo 2MB Mach64 GX (rev 1) with 68860-C RAMDAC
+
+6. Known Problems and Bug Reports
+
+There are several known problems with the current version of the Mach64 X
+server. They include:
+
+ o Gamma correction is not currently supported. It will be supported in a
+ future release.
+
+ o Screen blanking in 16bpp and 32bpp modes on certain Mach64 CT cards does
+ not work.
+
+ o In doublescan modes, only the top half of the hardware cursor is dis-
+ played. The hardware cursor works fine in all other modes.
+
+ o With high refresh rates on certain cards (VT-A3 and CT-D) noise can
+ become a problem in 32bpp mode. This usually only happens with refresh
+ rates of 85Hz or greater and can be fixed by using a lower refresh rate
+ (e.g., 72Hz or 75Hz).
+
+ o ISA cards with more than 12Mb of main memory cannot use the server due
+ to the requirement of a video memory aperture. This a major project.
+
+If you are experiencing problems, first check to make sure that you have the
+very latest available release (including beta releases). ATI releases new
+cards throughout the year. Each of these new cards require additional pro-
+gramming to support the new Mach64 chips, RAMDACs and clock chips that appear
+on them. The most recent release is most likely to support your video card.
+
+Second, please check the RELNOTES and README files (as well as the other doc-
+umentation available with the release). Third, make sure you do not have any
+Ramdac, ClockChip or Clocks lines in your XF86Config file (all of these are
+automatically detected by the Mach64 X server). The "Device" section should
+only contain the Identifier, VendorName and BoardName. All other options
+should be automatically detected.
+
+If you are still experiencing problems, please send e-mail to
+XFree86@XFree86.org or post to the comp.windows.x.i386unix newsgroup.
+
+Please do NOT send e-mail to me since the developers who answer e-mail sent
+to XFree86@XFree86.org are better able to answer most questions and I would
+like to spend my minimal free time working on new enhancements to the X
+server. Thanks!
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Mach64.sgml,v 3.16 1999/08/23 06:38:48 dawes Exp $
+
+ $XConsortium: Mach64.sgml /main/8 1996/10/28 05:23:52 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/READ.Mach64,v 3.13 1999/08/23 07:03:40 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README b/xc/programs/Xserver/hw/xfree86/doc/README
new file mode 100644
index 000000000..1f020e4d5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README
@@ -0,0 +1,92 @@
+ README for XFree86[tm] 3.9.16
+
+ The XFree86 Project, Inc
+
+ 31 August 1999
+
+ Abstract
+
+ XFree86 is a port of X11R6.4 that supports several UNIX(R) and
+ UNIX-like operating systems on Intel and other platforms.
+
+1. What is XFree86 3.9.16?
+
+XFree86 3.9.16 is a ``work in progress'' snapshot of the XFree86 4.0 develop-
+ment code. It is one of in a series of snapshot releases leading up the the
+4.0 release. The plan is to release a new snapshot every four to six weeks.
+The target audience for this release is developers and others who are com-
+fortable on the bleeding edge. This release is not targeted at beginners.
+Also, most end users will find life easier using our latest 3.3.x release.
+While we welcome bug reports and feedback about this release, we don't have
+the resources to provide user-level support for it. If you're not comfort-
+able dealing with those sorts of things yourself, then the snapshot releases
+are probably not for you.
+
+This code is very much work in progress. Many of the interfaces may change
+without notice between now and the 4.0 release. The driver design has
+changed significantly compared with the 3.3.x versions, and only a small num-
+ber of drivers have been converted so far. That means that this release does
+not support a wide range of video hardware. Some of the drivers and new fea-
+tures are well developed and reasonably stable, while others are not.
+
+Information on this release's features and their status can be found in the
+Release Notes.
+
+2. Redistribution of the Snapshots
+
+While the XFree86 License doesn't prohibit vendors and others redistributing
+binaries of this release, we don't recommend it. We ask that if you do dis-
+tribute such binaries, you make it clear that people using then should con-
+tact you for support and not XFree86.
+
+3. Developers
+
+If you would like to work on the development on XFree86 4.0, then it is rec-
+ommended that you join the XFree86 development team
+<URL:http://www.xfree86.org:/developer.html>. That way you will have access
+to the latest source and to other developers.
+
+4. How to get XFree86 3.9.16
+
+XFree86 3.9.16 can be found at the XFree86 ftp server
+<URL:ftp://ftp.xfree86.org/pub/XFree86/snapshots/3.9.16/>, and at mirrors of
+this server. This snapshot is available primarily in source form. Binaries
+for some platforms may be made available at a later time.
+
+The source for version 3.9.16 is split into three tarballs: X3916src-1.tgz,
+X3916src-2.tgz, X3916src-3.tgz. The first contains everything except the
+fonts and general X11 documentation. It is sufficient for building XFree86
+is you already have a set of fonts. The second contains the fonts and the
+source for the general X11 documentation. The third contains the general X11
+documentation in hardcopy format.
+
+A source patch relative to version 3.9.15 is also available. Because of its
+size, it is split into two parts. The patch files are 3.9.15-3.9.16.diff1.gz
+and 3.9.15-3.9.16.diff2.gz. These patches should be applied to a clean
+3.9.15 source tree, working from the directory containing the xc/ directory.
+The patches should be applied by running:
+
+ gunzip < 3.9.15-3.9.16.diff1.gz | patch -p0 -E
+ gunzip < 3.9.15-3.9.16.diff2.gz | patch -p0 -E
+ rm -fr xc/fonts/scaled/Type1/latin2
+
+The contrib part of the distribution can be found in the following tarball:
+X3916contrib.tgz.
+
+To format the XFree86 documentation, the latest version of our doctools pack-
+age. That is available as doctools-1.1.tgz.
+
+5. Reporting Bugs
+
+Bugs should be reported to <XFree86@XFree86.org>. Before reporting bugs,
+please check the X server log file, which can be found at
+/var/log/XFree86.0.log on most platforms. If you can't resolve the problem
+yourself, send the entire log file with your bug report. Please don't edit
+out what you think might not be important. The information contained in the
+log file is there to make it easier for the developers to determine what is
+going wrong when there are problems.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.98 1999/08/31 09:09:56 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.99 1999/08/31 09:11:05 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.3Dlabs b/xc/programs/Xserver/hw/xfree86/doc/README.3Dlabs
new file mode 100644
index 000000000..d054aca09
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.3Dlabs
@@ -0,0 +1,99 @@
+ Information for 3DLabs Chipset Users
+
+ The XFree86 Project Inc.
+
+ 25 June 1999
+
+1. Supported hardware
+
+This server supports the following 3DLabs chipsets:
+
+ o GLINT 500TX with IBM RGB526 RAMDAC
+
+ o GLINT MX plus Delta with IBM RGB526 and IBM RGB640 RAMDAC
+
+ o GLINT MX plus Gamma with IBM RGB526 and IBM RGB640 RAMDAC
+
+ o Permedia with IBM RGB526 RAMDAC
+
+ o Permedia 2 (classic, 2a, 2v)
+
+2. Features
+
+ o accelerated
+
+ o hardware cursor
+
+ o DPMS support
+
+ o supported color depths
+
+ o GLINT MX/500TX: 8/16/32 bpp
+
+ o Permedia: 8/16/32 bpp
+
+ o Permedia 2: 8/16/24/32 bpp
+
+3. XF86Config Option
+
+ Option "sw_cursor"
+ disable the hardware cursor.
+
+ Option "no_pixmap_cache"
+ disables use of the pixmap cache. Might be useful if drawing
+ errors occur.
+
+ Option "no_accel"
+ completely disables acceleration. Usually not recommended.
+
+ Option "pci_retry"
+ stall the PCI bus while the graphics engine is busy. While this
+ might give slightly higher performance, you run the risk of dis-
+ turbing other devices that are waiting to be serviced by the pro-
+ cessor. This option may cause problems with SCSI cards, serial
+ connections, sound cards, etc.
+
+ Option "firegl_3000"
+ needed for the Diamond Fire GL 3000 in order to use the primary
+ output on that card. The second screen is currently not sup-
+ ported.
+
+ Option "overclock_mem"
+ Run the memory at a higher clock. Useful on some cards with dis-
+ play glitches at higher resolutions. But adds the risk to damage
+ the hardware. Use with caution.
+
+4. Bugs and Limitations
+
+ o The 500TX and MX chipsets cannot switch modes, therefore only the first
+ mode on the modes line is available.
+
+ o In some color depths without acceleration there are color problems.
+
+ o While the server is accelerated, there is room for improvement. As our
+ development is focusing on XFree86-4.0 we are not planning to change
+ that in the 3.3.x branch. XFree86-4.0 will include a significantly
+ faster server.
+
+5. Authors
+
+ o Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ o Stefan Dirsch <sndirsch@suse.de>
+
+ o Helmut Fahrion <hf@suse.de>
+
+ o Special thanks to Elsa AG, Aachen for making it possible for us to
+ develop this server and furnishing us with plenty of boards and informa-
+ tion to help us on the way
+
+ o Very special thanks to SuSE GmbH, Nuernberg for allowing some of us to
+ work on this server on paid time, thereby financing development of this
+ server.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/3Dlabs.sgml,v 1.2 1999/08/24 02:01:07 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.3Dlabs,v 1.2 1999/08/28 11:22:55 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.Bsdi b/xc/programs/Xserver/hw/xfree86/doc/README.Bsdi
new file mode 100644
index 000000000..e9d79fa06
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.Bsdi
@@ -0,0 +1,596 @@
+
+
+
+
+
+
+
+
+
+ README for XFree86 3.1.2 on BSD/OS 2.0
+
+ Hans Nasten
+
+ 24 July 1995
+
+
+
+THIS DOCUMENT IS OUT OF DATE
+
+
+1. What and Where is XFree86?
+
+XFree86 3.1.2 is a port of X11R6 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improvements
+as well as many bug fixes. The release is available as source patches against
+the X Consortium X11R6 code, as well as binary distributions for many architec­
+tures.
+
+The sources for XFree86 are available by anonymous ftp from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current
+
+Binaries for BSD/OS 2.0 will be available from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/Bsdi
+
+If you're running a earlier version of BSD/OS, you'll have to build the distri­
+bution from source. Building the distribution on BSD/386 1.1 and 1.0 is
+untested, but believed to work correctly. If you run into trouble building on a
+earlier release, please let us know so that we can correct any incompatibili­
+ties. If you've done it and want to share your binaries, please let the Bsdi
+mailing list know. The binaries are built using gcc 2.6.3 as distributed with
+BSD/OS 2.0. If you build the distribution from source using a gcc compiler
+built using the generic gcc source code, you may run into problems using the
+binaries on a 386/486 not equipped with a math coprocessor.
+
+
+2. Bug Reports for This Document
+
+Send email to nasten@Everyware.SE (Hans Nasten) or XFree86@XFree86.org if you
+have comments or suggestions about this file and we'll revise it.
+
+
+3. Installing the Binaries
+
+The binary distribution is composed of a number of gzipped tar archives which
+contains the executables, servers, fonts, libraries, include files, man pages,
+config files, and the server link kit. All tar archives should be extracted as
+root with / as the default directory. The full distribution takes over 40MB of
+disk space. The file names are converted to be compatible with CD-rom
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+conventions.
+
+Note that many clients were moved from the X11R6 distribution to the `contrib'
+area. However, they are still distributed with the XFree86 binary distribution.
+
+The contents of the archives are:
+
+ REQUIRED:
+
+ X312doc.tgz
+ READMEs and XFree86 specific man pages.
+
+ X312bin.tgz
+ all of the executable X client applications.
+
+ X312fnts.tgz
+ all fonts except the cyrillic fonts
+
+ X312lib.tgz
+ data files needed at runtime
+
+ Choose at least one of the following to match your hardware:
+
+ X312SVGA.tgz
+ the 8-bit pseudo-color X server for Super VGA cards
+
+ X312VG16.tgz
+ the 4-bit pseudo-color X server for VGA & SVGA cards.
+
+ X312Mono.tgz
+ the Monochrome X Server
+
+ X3128514.tgz
+ the X server for IBM 8514/A and compatible boards
+
+ X312AGX.tgz
+ the X server for AGX boards
+
+ X312Ma8.tgz
+ the X server for ATI Mach8 boards
+
+ X312Ma32.tgz
+ the X server for ATI Mach32 boards
+
+ X312Ma64.tgz
+ the X server for ATI Mach64 boards
+
+ X312P9K.tgz
+ the X server for P9000 based boards
+
+ X312S3.tgz
+ the X server for S3 based boards
+
+
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+ X312W32.tgz
+ the X server for ET4000/W32 and ET6000 based boards
+
+ OPTIONAL:
+
+ X312fsrv.tgz
+ the font server with man pages.
+
+ X312cfnt.tgz
+ cyrillic fonts
+
+ X312prog.tgz
+ the include/X11 header files and static libraries
+ needed only for compiling other X applications
+
+ X312man.tgz
+ all man pages
+
+ X312link.tgz
+ the server reconfiguration kit.
+
+If this is your first time, then you should be able to safely install all of
+the packages. As a minimal install, you'll need doc, bin, fonts lib and one X
+server.
+
+To unpack and install the archives:
+
+ 1. create some destination directory in which you'd like the X distribution
+ to live. /usr/X11R6 is recommended, but if that partition is full (as it
+ is on my machine), then just create an alternate directory, and sym-link
+ /usr/X11R6 to this place.
+
+ ie, on my machine, I do the following:
+
+
+ % cd /usr/local
+ % mkdir X11R6
+ % ln -s /usr/local/X11R6 /usr/X11R6
+
+
+
+ 2. You must be logged in as root to unpack the archives and use a `umask'
+ value of 022. Typing `umask 022' sets it. Caution: If you do not
+ extract the files as user `root' with the correct umask you may not be
+ able to run XFree86 3.1.2. The X server needs special permissions that
+ are only granted to the root user. You must also cd to / before extract­
+ ing the archives.
+
+ 3. Create a symbolic link in /usr/X11R6/bin named `X' that points to the
+ server that matches your video card: See the XF86_* man pages for hard­
+ ware details. For example, if you have an ET4000 based SVGA card:
+
+ cd /usr/X11R6/bin
+ rm -f X
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+ ln -s XF86_SVGA X
+
+
+Note: you don't need to uncompress the fonts files in lib/X11/fonts. If you
+want to uncompress them anyway, don't forget to run `mkfontdir' in each direc­
+tory after that.
+
+
+4. Installing Xdm, the display manager
+
+The display manager makes your PC look like an X terminal. That is, it pre­
+sents you with a login screen that runs under X. To start the display manager,
+log in as root on the console and type `xdm -nodaemon'.
+
+You can start xdm automatically on bootup by disabling the console getty and
+adding the following code to /etc/rc.local:
+
+ if [ -x /usr/X11R6/bin/xdm ]; then
+ echo -n ' xdm'; /usr/X11R6/bin/xdm
+ fi
+
+To disable the console getty, change `on' to `off' in the console entry in
+/etc/ttys:
+
+ console "/usr/libexec/getty std.9600" ibmpc3 off secure
+
+
+5. Configuring X for Your Hardware
+
+The XF86Config file tells the X server what kind of monitor, video card and
+mouse you have. You must create it to tell the server what specific hardware
+you have.
+
+XFree86 3.1 and later releases uses a new configuration file format. Consult
+the XF86Config man page and the general INSTALL file for instructions.
+
+If you have a Xconfig file for XFree86 2.x, use reconfig to translate part of
+it into the new format:
+
+ # reconfig <Xconfig >XF86Config
+
+
+and complete the rest according to the XF86Config man page and the XF86Con­
+fig.sample file as a template.
+
+In order to protect your hardware from damage, the server will no longer read
+XF86Config files from a user's home directory, but requires that it be in
+/etc/XF86Config, /usr/X11R6/lib/X11/XF86Config.hostname or
+/usr/X11R6/lib/X11/XF86Config.
+
+You'll need info on your hardware:
+
+ o Your mouse type, baud rate and its /dev entry.
+
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+ o The video card's chipset (e.g. ET4000, S3, etc).
+
+ o Your monitor's sync frequencies.
+
+The easiest way to find which device your mouse is plugged into is to use `cat'
+or `kermit' to look at the output of the mouse. Connect to it and just make
+sure that it generates output when the mouse is moved or clicked:
+
+ % cat < /dev/tty00
+
+
+If you can't find the right mouse device then use `dmesg|grep com' to get a
+list of devices that were detected upon booting:
+
+ % dmesg|grep com
+ com0 at isa0 iobase 0x3f8 irq 4
+
+
+com0 is the hardware port used for /dev/tty00 and com1 is /dev/tty01. If you
+plan to fine tune the screen size or position on your monitor you'll need the
+specs for sync frequencies from your monitor's manual.
+
+
+6. Running X
+
+8mb of memory is a recommended minimum for running X. The server, window man­
+ager and an xterm take about 4 Mb of memory themselves. On a 4Mb system that
+would leave nothing left over for the kernel and other applications like gcc
+that expect a few meg free.
+
+The easiest way for new users to start X windows is to type `xinit >&
+xinit.log'. Error messages are lost unless you redirect them because the
+server takes over the screen.
+
+To get out of X windows, type `exit' in the console xterm. You can customize
+your X by creating .xinitrc, .xserverrc, and .twmrc files in your home direc­
+tory as described in the xinit and startx man pages.
+
+
+7. Rebuilding the XFree86 Distribution
+
+The server link kit allows you to rebuild just the X server with a minimum
+amount of disk space. Just unpack it, make the appropriate changes to the
+site.def, type `./mkmf' and `make' to link the server. See
+/usr/X11R6/lib/Server/README for more info.
+
+See /usr/X11R6/lib/X11/etc/INSTALL for instructions on unbundling and building
+the source distribution. You will need about 250Mb free for the sources,
+objects and binaries during the build.
+
+You should configure the distribution by editing xc/config/cf/xf86site.def
+before compiling. To compile the sources, invoke
+
+ make World
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+in the xc directory.
+
+
+8. Building New X Clients
+
+The easiest way to build a new client (X application) is to use xmkmf if an
+Imakefile is included in the sources. Type `xmkmf' to create the Makefiles,
+check the configuration if necessary and type `make'. Whenever you install
+additional man pages you should update whatis.db by running `makewhatis
+/usr/X11R6/man'. To avoid the `Virtual memory exhausted' message from cc while
+compiling, increase the data and stack size limits (in csh type `limit datasize
+32M' and `limit stacksize 16M').
+
+Note: Starting with XFree86 2.1, the symbol ``__386BSD__'' no longer gets
+defined or via the X config files for *BSD systems. When porting clients to
+*BSD systems, make use of the symbol ``BSD'' for code which is truly BSD-spe­
+cific. The value of the symbol can be used to distinguish different BSD
+releases. For example, code specific to the Net-2 and later releases can use:
+
+
+ #if (BSD >= 199103)
+
+
+To ensure that this symbol is correctly defined, include <sys/param.h> in the
+source that requires it. Note that the symbol CSRG_BASED is defined for *BSD
+systems in XFree86 3.1.1 and later. This should be used to protect the inclu­
+sion of <sys/param.h>.
+
+For code that really is specific to a particular i386 BSD port, use __FreeBSD__
+for FreeBSD, __NetBSD__ for NetBSD, __OpenBSD__ for OpenBSD, __386BSD__ for
+386BSD, and __bsdi__ for BSD/OS.
+
+
+9. Linear access to the frame buffer using BSD/386 1.1
+
+The stock BSD/386 1.1 kernel has problems when trying to mmap the frame buffer
+as a linear ( unbanked ) memory area in high memory. This patch removes the
+check in /sys/i386/isa/vga.c that disables mmapping the frame buffer in linear
+mode. Please consult the BSD/386 1.1 release notes for instructions on how to
+build a new kernel. This patch is not needed on BSD/OS 2.0.
+
+ o save the patch below in a separate file.
+
+ o cd to /sys/i386/isa.
+
+ o apply the patch with ``patch -p <the_separate_patch_file''
+
+ o rebuild and install the new kernel.
+
+ o reboot.
+
+vga.c patch:
+
+
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+ *** vga.c.orig Sun Dec 19 09:35:01 1993
+ --- vga.c Mon Oct 24 01:38:44 1994
+ ***************
+ *** 159,165 ****
+ #if 0
+ if (off + NBPG > vgap->vga_mem_size)
+ return (-1);
+ ! #else
+ if (off + NBPG > IOM_END)
+ return (-1);
+ #endif
+ --- 159,165 ----
+ #if 0
+ if (off + NBPG > vgap->vga_mem_size)
+ return (-1);
+ ! /*#else*/
+ if (off + NBPG > IOM_END)
+ return (-1);
+ #endif
+
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Bsdi,v 3.26 1997/01/27 22:12:34 dawes Exp $
+
+
+
+
+
+ $XConsortium: Bsdi.sgml /main/8 1996/10/27 11:05:51 kaleb $
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+README for XFree86 3.1.2 on BSD/OS 2.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CONTENTS
+
+
+
+1. What and Where is XFree86? .............................................. 1
+
+2. Bug Reports for This Document ........................................... 1
+
+3. Installing the Binaries ................................................. 1
+
+4. Installing Xdm, the display manager ..................................... 4
+
+5. Configuring X for Your Hardware ......................................... 4
+
+6. Running X ............................................................... 5
+
+7. Rebuilding the XFree86 Distribution ..................................... 5
+
+8. Building New X Clients .................................................. 6
+
+9. Linear access to the frame buffer using BSD/386 1.1 ...................... 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ i
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Bsdi,v 3.26 1997/01/27 22:12:34 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.Config b/xc/programs/Xserver/hw/xfree86/doc/README.Config
new file mode 100644
index 000000000..ab35f2a4b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.Config
@@ -0,0 +1,493 @@
+ Configuring XFree86: A Step-By-Step Guide
+
+ David Wexelblat and The XFree86 Project, Inc
+
+ 5 October 1994
+
+ Abstract
+
+ This document describes how to set up your XFree86 server and
+ the corresponding XF86Config configuration file. If you follow the
+ procedures in this document, you should have no problems getting
+ your server up and running quickly. This document is designed
+ to be generic. Be certain to refer to the operating system spe-
+ cific README file for your OS (e.g. README.SVR4) and the
+ card/chipset specific README file for you video card (e.g.
+ README.trident). Where these specific files contradict this
+ generic file, you should follow the specific instructions (there
+ shouldn't be much of that, though).
+
+1. Procedure Overview
+
+There are two steps to getting things up and running. The first is to select
+the appropriate server that you will be using and set it up as the default
+server. The second step is to set up the XF86Config file. This file is used
+to configure the server for your pointer device (e.g. mouse, trackball),
+video card, and monitor, as well as a few other things.
+
+The XF86Config file contains several sections; these procedures will lead you
+through filling out each part. There is a default/sample XF86Config file in
+/usr/X11R6/lib/X11/XF86Config.sample; you should copy this to
+/usr/X11R6/lib/X11/XF86Config, and edit that file to your specific configura-
+tion. The XF86Config(4/5) manual page describes the XF86Config file contents
+and options in detail. Be sure to read through that manual page as you fill
+in your XF86Config file.
+
+The sections of the XF86Config file are:
+
+ Files
+ Sets the default font and RGB paths.
+
+ Server Flags
+ Sets a few general server options. Refer to the manual page to
+ learn about these.
+
+ Keyboard
+ Sets up keyboard devices, and sets a few optional parameters.
+
+ Pointer
+ Sets up the pointer devices, and sets a few optional parameters.
+
+ Monitor
+ Describes your monitor(s) to the server.
+
+ Graphics Device
+ Describes your video hardware to the server.
+
+ Screen.
+ Describes how the monitor and video hardware should be used.
+
+2. Setting Up The Correct Default Server
+
+The default server name is /usr/X11R6/bin/X. This is a link to a specific
+server binary XF86_xxxx, located in /usr/X11R6/bin/. You should check which
+server the X link is connected to. If it is not correct, remove it and make
+a new link to the correct binary. The server binaries are:
+
+ XF86_SVGA:
+ Super-VGA server. Contains accelerated support for Cirrus
+ 542{0,2,4,6,8,9}, 543{0,4} and Western Digital 90C3{1,3} and Oak
+ Technologies Inc. OTI087 chipsets, unaccelerated for the rest of
+ the supported chipsets.
+
+ XF86_Mono:
+ (S)VGA monochrome, optionally Hercules or other monochrome hard-
+ ware support is linked in.
+
+ XF86_VGA16:
+ Generic VGA 16-color server.
+
+ XF86_S3:
+ S3 accelerated server.
+
+ XF86_Mach32:
+ ATI Mach32 accelerated server.
+
+ XF86_Mach64:
+ ATI Mach64 accelerated server.
+
+ XF86_Mach8:
+ ATI Mach8 accelerated server.
+
+ XF86_8514:
+ 8514/A accelerated server.
+
+ XF86_P9000:
+ P9000 accelerated server.
+
+ XF86_AGX:
+ AGX accelerated server.
+
+There is a manual page for each of these servers; refer to the manual page
+for specific details on supported chipsets and server-specific configuration
+options.
+
+Note that it is possible to modify the drivers configured into a server via
+the LinkKit; the server binary may not contain all of the possible drivers,
+depending on how the distribution was assembled. You can run
+/usr/X11R6/bin/X -showconfig to get a printout of the configured drivers. If
+you need to relink your server, refer to the README file in the LinkKit for
+specific information.
+
+3. The Easy Parts of XF86Config
+
+The "Files" section of the XF86Config file contains the path to the RGB
+database file (which should, in general, never need to be changed), and the
+default font path. You can have multiple FontPath lines in your XF86Config;
+they are concatenated. Ensure that each directory listed exists and is a
+valid font directory. If the server complains about "Can't open default font
+'fixed'", it is because there is an invalid entry in your font path. Try
+running the 'mkfontdir' command in each directory if you are certain that
+each one is correct. The XF86Config(4/5) manual page describes other parame-
+ters that may be in this section of the file.
+
+Next comes the "Keyboard" section. In this section, you can specify the key-
+board protocol (Xqueue or Normal), the repeat rate, and the default mapping
+of some of the modifier keys. In general, nothing will need to be modified
+here. Users of non-English keyboards might want to change the definitions of
+the modifier keys. See the XF86Config(4/5) man page for details.
+
+After this comes the "Pointer" section. In this section you can specify the
+pointer protocol and device. Note that the protocol name does not always
+match the manufacturer's name. For example, some Logitech mice (especially
+newer ones) require either the MouseMan or Microsoft protocols, not the Log-
+itech protocol. Some other mouse parameters can be adjusted here. If you
+are using a two-button mouse, uncomment the Emulate3Buttons keyword - in this
+mode, pressing both mouse buttons simultaneously causes the server to report
+a middle button press.
+
+Note that if the server complains about being unable to open your mouse
+device, this is NOT a server problem. It has been a very common misconfigu-
+ration error on several of the OSs, and 99.999% of the time it is because the
+device is not correctly configured in the OS. Hence don't bug us until after
+you prove that your OS level support is correct.
+
+4. Configuring the Video Hardware
+
+The video hardware is described in the "Device" sections. Multiple device
+sections are permitted, and each section describes a single graphics board.
+
+Be sure to read the server manual pages and the chipset-specific README files
+for any non-generic information that may apply to your setup.
+
+To create a Device section you need to collect the data for your hardware,
+and make some configuration decisions. The hardware data you need is:
+
+ o Chipset
+
+ o Amount of video memory
+
+ o Dot-clocks available or clock chip used (if programmable)
+
+ o Ramdac type (for some servers)
+
+The server, in general, is capable of filling these on its own, but it is
+best to fully specify things in the XF86Config file, so that no mistakes are
+made. The 'Chipset' is one of the keyword strings for a configured driver
+(which can be displayed by running 'X -showconfig'). Of the accelerated
+servers, only some have chipset drivers currently. The amount of memory is
+specified in KBytes, so 1M of memory would be specified as 1024.
+
+The dot-clocks are the trickiest part of card configuration. Fortunately a
+large database of collected dot-clocks is available. A list of Device
+entries for some graphics boards can be found in the `Devices' file. If you
+find one for your card, you can start with that. Also, the first part of the
+modeDB.txt file lists information for a myriad of SVGA cards. For acceler-
+ated cards, you can also look in the `AccelCards' file. If you are fortu-
+nate, your card is listed in one place or the other. If you find your card,
+copy the numbers from the database to the Clocks line in your XF86Config
+file, exactly as they appear in the database, without sorting, and leaving
+any duplicates. Note that some of the newer accelerated cards use a pro-
+grammable clock generator, in which case a ClockChip line is used in your
+XF86Config file to identify the type of clock generator. (e.g. 'ClockChip
+"icd2061a"', which would be used for a #9 GXe board).
+
+If you can't find a listing for your board, you can attempt to have the
+server detect them. Run the command 'X -probeonly >/tmp/out 2>&1' (for sh or
+ksh) or 'X -probeonly >&/tmp/out' (for csh). Be sure that the XF86Config file
+does not contain a Clocks line at this point. Running this will cause your
+monitor to freak out for a couple of seconds, as the server cycles through
+the clocks rapidly. It should not damage your monitor, but some newer moni-
+tors may shut themselves off because things may go out of spec. Anyhow, when
+this gets done, look in the file /tmp/out for the detected dot-clocks. Copy
+these to the Clocks line in your XF86Config file, exactly as they appear in
+/tmp/out. Don't sort them or rearrange them in any way.
+
+It is possible that your board has a programmable clock generator. A symptom
+of this will be a printout of only 2 or 3 clock values, with the rest all
+zeros. If you run into this, and your board is not listed in the databases,
+contact the XFree86 team for help, or post a message to comp.win-
+dows.x.i386unix. Note that most current Diamond hardware falls into this
+category, and Diamond will not release the programming details, so we can't
+help you. There are some ethically questionable solutions available that you
+can inquire about on netnews; we do not advocate these methods, so do not
+contact us about them.
+
+Some servers (S3 and AGX) require you to identify the type and speed of the
+RAMDAC your board uses in order to get the most out of the hardware. This is
+done by adding 'Ramdac' and 'DacSpeec' entries. For details of the supported
+RAMDACs, refer to the appropriate server manual page. Note, in previous ver-
+sions of XFree86 the RAMDAC type was specified with an Option flag.
+
+You may need to specify some Option flags for your hardware The server manual
+pages will describe these options, and the chipset-specific README files will
+tell you if any are required for your board.
+
+5. Configuring the Monitor and its Modes
+
+Configuring monitor modes can be a trying experience, unfortunately, because
+of the lack of standardization in monitor hardware. We have attempted to
+simplify this by collecting databases of specific monitor information, and
+assembling a set of "generic" modes that should get pretty much any monitor
+up and functional. For all the gory details of mode generation and tuning,
+refer to the `VideoModes.doc' document by Eric Raymond.
+
+The monitor specs and video modes are described in the "Monitor" sections in
+the XF86Config file. To create a Monitor section, you need to know your mon-
+itor's specifications. In particular, you need to know what range of hori-
+zontal sync and vertical sync (refresh) rates it supports and what its video
+bandwidth is. This information should be available in the monitor's user
+manual. Also check the 'Monitors' file to see if it has an entry for your
+monitor. See the XF86Config(4/5) manual page for details of how this infor-
+mation is entered into the Monitor section.
+
+Next, you need to provide a set of video modes that are suitable for the mon-
+itor. The first step is to check in the 'Monitors' and modeDB.txt files to
+see if there is a listing of modes for your specific monitor. If there is,
+copy those modes to the Monitor section of your XF86Config file. Verify that
+there is a clock listed on the Clocks line in your XF86Config that matches
+the dot-clock in the 2nd parameter of each mode line; delete any mode line
+that does not have a matching clock on your card. If you still have modes
+left, you are in good shape.
+
+If you don't find any specific modes, or need more modes for the resolutions
+you want to use, refer to the Generic Video Modes listing below. Match the
+mode specification against your monitor's specifications; pick the highest-
+refresh mode that is within specs, and make sure you have a matching dot-
+clock on your Clocks line. Try the VESA modes before any corresponding
+alternate mode setting. Copy the mode specification to the Monitor section
+of your XF86Config file. Note that these modes are likely not optimal; they
+may not be sized perfectly, or may not be correctly centered. But they
+should get you up and running. If you want to tune the mode to your monitor,
+you can read the 'Fixing Problems with the Image' section of the Video-
+Modes.doc file.
+
+A note before you are done. If the same mode name occurs more than once in
+the Monitor section of the XF86Config file, the server will use the first
+mode with a matching clock. It is generally considered a bad idea to have
+more than one mode with the same name in your XF86Config file.
+
+6. Combining the Video Hardware and Monitor Data
+
+Once you have given a description of your monitor and graphics hardware you
+need to specify how they are to be used by the servers. This is done with
+the "Screen" sections in the XF86Config file. You need to supply a Screen
+section for each of the server driver types you will be using. The driver
+types are "SVGA" (XF86_SVGA), "VGA16" (XF86_VGA16), "VGA2" (XF86_Mono),
+"MONO" (XF86_Mono, XF86_VGA16), and "ACCEL" (XF86_S3, XF86_Mach32,
+XF86_Mach8, XF86_Mach64, XF86_8514, XF86_P9000, XF86_AGX). Each Screen sec-
+tion specifies which Monitor description and Device description are to be
+used.
+
+The Screen sections include one or more "Display" subsections. One Display
+subsection may be provided for each depth that the server supports. In the
+Display subsection you can specify the size of the virtual screen the server
+will use. The virtual screen allows you to have a "root window" larger than
+can be displayed on your monitor (e.g. you can have an 800x600 display, but
+a 1280x1024 virtual size). The Virtual keyword is used to specify this size.
+Note that many of the new accelerated server use non-displayed memory for
+caching. It is not desirable to use all of your memory for virtual display,
+as this leaves none for caching, and this can cost as much as 30-40% of your
+server performance.
+
+The last thing you specify in Display subsection is the display modes. These
+are the physical display resolutions that the server will use. The name is
+arbitrary, but must match something in the appropriate Monitor section. In
+general, these names are the display resolution (e.g. "1024x768"), but need
+not be. You can list as many as desired; the first is the default/starting
+display, and you can cycle through the list with Ctrl-Alt-Keypad+ or Ctrl-
+Alt-Keypad- hotkey sequences.
+
+That's it. Now you're ready to test out your new XFree86 installation.
+
+7. Generic Video Modes
+
+ #
+ # Mode Refresh Hor. Sync Dot-clock Interlaced? VESA?
+ # ------------------------------------------------------------
+ # 640x480 60Hz 31.5k 25.175M No No
+ # 640x480 60Hz 31.5k 25.175M No No
+ # 640x480 63Hz 32.8k 28.322M No No
+ # 640x480 70Hz 36.5k 31.5M No No
+ # 640x480 72Hz 37.9k 31.5M No Yes
+ # 800x600 56Hz 35.1k 36.0M No Yes
+ # 800x600 56Hz 35.4k 36.0M No No
+ # 800x600 60Hz 37.9k 40.0M No Yes
+ # 800x600 60Hz 37.9k 40.0M No No
+ # 800x600 72Hz 48.0k 50.0M No Yes
+ # 1024x768i 43.5Hz 35.5k 44.9M Yes No
+ # 1024x768 60Hz 48.4k 65.0M No Yes
+ # 1024x768 60Hz 48.4k 62.0M No No
+ # 1024x768 70Hz 56.5k 75.0M No Yes
+ # 1024x768 70Hz 56.25k 72.0M No No
+ # 1024x768 76Hz 62.5k 85.0M No No
+ # 1280x1024i 44Hz 51kHz 80.0M Yes No
+ # 1280x1024i 44Hz 47.6k 75.0M Yes No
+ # 1280x1024 59Hz 63.6k 110.0M No No
+ # 1280x1024 61Hz 64.24k 110.0M No No
+ # 1280x1024 74Hz 78.85k 135.0M No No
+
+ #
+ # 640x480@60Hz Non-Interlaced mode
+ # Horizontal Sync = 31.5kHz
+ # Timing: H=(0.95us, 3.81us, 1.59us), V=(0.35ms, 0.064ms, 1.02ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 664 760 800 480 491 493 525
+
+ #
+ # Alternate 640x480@60Hz Non-Interlaced mode
+ # Horizontal Sync = 31.5kHz
+ # Timing: H=(1.27us, 3.81us, 1.27us) V=(0.32ms, 0.06ms, 1.05ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 672 768 800 480 490 492 525
+
+ #
+ # 640x480@63Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync = 32.8kHz
+ # Timing: H=(1.41us, 1.41us, 5.08us) V=(0.24ms, 0.092ms, 0.92ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 28.322 640 680 720 864 480 488 491 521
+
+ #
+ # 640x480@70Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync = 36.5kHz
+ # Timing: H=(1.27us, 1.27us, 4.57us) V=(0.22ms, 0.082ms, 0.82ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 680 720 864 480 488 491 521
+
+ #
+ # VESA 640x480@72Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(0.76us, 1.27us, 4.06us) V=(0.24ms, 0.079ms, 0.74ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 664 704 832 480 489 492 520
+
+ #
+ # VESA 800x600@56Hz Non-Interlaced mode
+ # Horizontal Sync = 35.1kHz
+ # Timing: H=(0.67us, 2.00us, 3.56us) V=(0.03ms, 0.063ms, 0.70ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 36 800 824 896 1024 600 601 603 625
+
+ #
+ # Alternate 800x600@56Hz Non-Interlaced mode
+ # Horizontal Sync = 35.4kHz
+ # Timing: H=(0.89us, 4.00us, 1.11us) V=(0.11ms, 0.057ms, 0.79ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 36 800 832 976 1016 600 604 606 634
+
+ #
+ # VESA 800x600@60Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(1.00us, 3.20us, 2.20us) V=(0.03ms, 0.106ms, 0.61ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+
+ #
+ # Alternate 800x600@60Hz Non-Interlaced mode
+ # Horizontal Sync = 37.9kHz
+ # Timing: H=(1.20us, 3.80us, 1.40us) V=(0.13ms, 0.053ms, 0.69ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 40 800 848 1000 1056 600 605 607 633
+
+ #
+ # VESA 800x600@72Hz Non-Interlaced mode
+ # Horizontal Sync = 48kHz
+ # Timing: H=(1.12us, 2.40us, 1.28us) V=(0.77ms, 0.13ms, 0.48ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+
+ #
+ # 1024x768@43.5Hz, Interlaced mode (8514/A standard)
+ # Horizontal Sync = 35.5kHz
+ # Timing: H=(0.54us, 1.34us, 1.25us) V=(0.23ms, 0.23ms, 0.93ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
+
+ #
+ # VESA 1024x768@60Hz Non-Interlaced mode
+ # Horizontal Sync = 48.4kHz
+ # Timing: H=(0.12us, 2.22us, 2.58us) V=(0.06ms, 0.12ms, 0.60ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+
+ #
+ # 1024x768@60Hz Non-Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync = 48.4kHz
+ # Timing: H=(0.65us, 2.84us, 0.65us) V=(0.12ms, 0.041ms, 0.66ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1064 1240 1280 768 774 776 808
+
+ #
+ # VESA 1024x768@70Hz Non-Interlaced mode
+ # Horizontal Sync=56.5kHz
+ # Timing: H=(0.32us, 1.81us, 1.92us) V=(0.05ms, 0.14ms, 0.51ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+
+ #
+ # 1024x768@70Hz Non-Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync=56.25kHz
+ # Timing: H=(0.44us, 1.89us, 1.22us) V=(0.036ms, 0.11ms, 0.53ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 72 1024 1056 1192 1280 768 770 776 806 -hsync -vsync
+
+ #
+ # 1024x768@76Hz Non-Interlaced mode
+ # Horizontal Sync=62.5kHz
+ # Timing: H=(0.09us, 1.41us, 2.45us) V=(0.09ms, 0.048ms, 0.62ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+
+ #
+ # 1280x1024@44Hz, Interlaced mode
+ # Horizontal Sync=51kHz
+ # Timing: H=(0.02us, 2.7us, 0.70us) V=(0.02ms, 0.24ms, 2.51ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+
+ #
+ # Alternate 1280x1024@44Hz, Interlaced mode (non-standard dot-clock)
+ # Horizontal Sync=47.6kHz
+ # Timing: H=(0.42us, 2.88us, 0.64us) V=(0.08ms, 0.12ms, 0.96ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024i" 75 1280 1312 1528 1576 1024 1028 1034 1080 Interlace
+
+ #
+ # 1280x1024@59Hz Non-Interlaced mode (non-standard)
+ # Horizontal Sync=63.6kHz
+ # Timing: H=(0.36us, 1.45us, 2.25us) V=(0.08ms, 0.11ms, 0.65ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1320 1480 1728 1024 1029 1036 1077
+
+ #
+ # 1280x1024@61Hz, Non-Interlaced mode
+ # Horizontal Sync=64.25kHz
+ # Timing: H=(0.44us, 1.67us, 1.82us) V=(0.02ms, 0.05ms, 0.41ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+
+ #
+ # 1280x1024@74Hz, Non-Interlaced mode
+ # Horizontal Sync=78.85kHz
+ # Timing: H=(0.24us, 1.07us, 1.90us) V=(0.04ms, 0.04ms, 0.43ms)
+ #
+ # name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Config.sgml,v 3.13 1998/04/12 12:43:41 dawes Exp $
+
+ $XConsortium: Config.sgml /main/7 1996/10/19 18:03:03 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Config,v 3.24 1999/04/15 03:34:48 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DECtga b/xc/programs/Xserver/hw/xfree86/doc/README.DECtga
new file mode 100644
index 000000000..aac134c92
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DECtga
@@ -0,0 +1,57 @@
+ Information for DEC 21030 Users (aka TGA)
+
+ The XFree86 Project, Inc.
+
+ April 29th, 1999
+
+1. DEC 21030
+
+ o The DEC 21030 is supported by XFree86 3.9.15. The driver is now par-
+ tially accelerated. The built-in graphics on the Multia is supported in
+ 8-plane mode, and PCI cards with 8 or 16 MB framebuffers are supported
+ in 24-plane mode.
+
+ o Current Known Problems
+
+ 1. Virtual desktops and multiple modelines do not work. You should
+ specify only one modeline.
+
+ 2. Hardware cursor is only supported on systems with the BT485 ram-
+ dac, ie the Multia.
+
+ 3. After the server has been run using the hardware cursor, the Linux
+ TGA console cursor (which also uses the hardware cursor) is
+ shifted down by one pixel.
+
+ o The following options may be specified for the 21030 driver:
+
+ BusID "PCI:?:??:?"
+ Currently it is necessary to specify the BusID so that the
+ server will find the card. Check /proc/pci and look for the
+ bus, device, and function numbers in the 21030 section. On
+ a Multia, this should be "PCI:0:11:0".
+
+ MemBase "0x???????"
+ If the server does not detect the base address of the 21030,
+ then check /proc/pci for the 21030 and look for the
+ "Prefetchable 32 bit memory at 0x???????" and enter this as
+ your MemBase setting.
+
+ Option "NoAccel"
+ Disables acceleration.
+
+ Option "swcursor"
+ Disables the hardware cursor.
+
+2. Authors
+
+ o Matthew Grossman, <mattg@oz.net>
+
+ o Alan Hourihane, <alanh@fairlite.demon.co.uk>
+
+ o Tim Rowley, <tor@cs.brown.edu>
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DECtga.sgml,v 3.8 1999/07/19 13:36:20 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.12 1999/07/19 14:44:21 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DGA b/xc/programs/Xserver/hw/xfree86/doc/README.DGA
new file mode 100644
index 000000000..330030936
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DGA
@@ -0,0 +1,103 @@
+
+ XFree86-DGA Extension
+
+The XFree86-DGA extension is an X server extension for allowing client
+programs direct access to the video frame buffer.
+
+This is a brief description of the programming interface for the
+XFree86-DGA extension. This describes version 1.0, which is the first
+official version. The interface should remain compatible in future
+versions. The functions described here are found in the library
+libXxf86dga.a.
+
+Prototypes for these functions can be found in <X11/extensions/xf86dga.h>
+
+ XF86DGAQueryVersion(Display *display, int *majorVersion, int *minorVersion)
+
+ query the XFree86-DGA version
+
+
+ XF86DGAQueryExtension(Display *display, int *eventBase, int *errorBase)
+
+ returns the eventBase and errorBase for the XFree86-DGA extension
+
+
+ XF86DGAQueryDirectVideo(Display *display, int screen, int *flags)
+
+ Query the DirectVideo capabilities of the graphics device. Flags
+ are returned, which may be interpreted as follows (bit masks):
+
+ XF86DGADirectPresent DirectVideo support is present
+
+
+ XF86DGAGetVideo(Display *display, int screen, char **addr, int *width,
+ int *bankSize, int *memSize);
+
+ returns a pointer to the start of the video framebuffer (*addr),
+ the line width (*width), memory bank size (*bankSize) and total
+ memory size (*memSize). Mapping the video framebuffer is a
+ privileged operation on most OSs (usually mmap of /dev/mem),
+ so a program using this must usually be setuid (or perhaps setgid)
+ at least up until the point the function is called.
+
+
+ XF86DGAGetViewPortSize(Display *display, int screen, int *width,
+ int *height)
+
+ Returns the width (*width) and height (*height) of the view port,
+ which is the part of the framebuffer that is visible on the monitor.
+
+
+ XF86DGADirectVideo(Display *display, int screen, int flags)
+
+ enables/disables Direct Video mode. When Direct Video mode is
+ enabled, the X server gives up control of the framebuffer to the
+ client. When flags is zero, Direct Video mode is disabled. flags
+ may be a bit-wise combination of the following:
+
+ XF86DGADirectGraphics enable Direct Video mode
+ XF86DGADirectMouse enable reporting of pointer movement
+ as relative motion
+ XF86DGADirectKeyb enable direct reporting of keyboard
+ events
+
+
+ XF86DGASetVidPage(Display *display, int screen, int page)
+
+ Set the framebuffer page. This is only required for hardware which
+ has a banked memory layout (ie, bankSize < memSize).
+
+
+ XF86DGASetViewPort(Display *display, int screen, int x, int y)
+
+ Set the coordinates of the upper-left corner of the view port to (x,y).
+
+
+ Bool XF86DGAViewPortChanged(Display *display, int screen, int n)
+
+ Checks whether a previous SetViewPort command has been performed
+ by the hardware, that is, whether a vertical retrace has occurred
+ since a previous SetViewPort. This can (must, in fact) be used
+ with page-flipping; you can start writing to the next page only when
+ this function returns TRUE. For some devices this will be the
+ case immediately after SetViewPort, however this may be changed in
+ in the future. The number of pages used is specified with n; it
+ should be 2 for simple page flipping. If n is greater than two
+ (triple or multi-buffering), the function checks whether the
+ (n - 2)-before-last SetViewPort has been performed.
+
+
+ XF86DGAInstallColormap(Display *display, int screen, Colormap cmap)
+
+ Set the current colormap of the display to cmap. XF86DGADirectGraphics
+ must be active on the display/screen before calling
+ XF86DGAInstallColormap or it will produce the error XF86DGAScreenNotActive
+ or XF86DGADirectNotActivated.
+
+
+ int XF86DGAForkApp(int screen)
+
+ Fork the app, parent process hangs around to return non DGA mode should
+ the child exit for any reason. Returns 0, or error returned by fork().
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DGA,v 3.5 1996/10/18 15:03:04 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DGux b/xc/programs/Xserver/hw/xfree86/doc/README.DGux
new file mode 100644
index 000000000..8daf55d75
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DGux
@@ -0,0 +1,694 @@
+ Instructions for Building XFree86 on an Intel Pentium Aviion machine with
+ DG/ux R4.20MU04
+
+ Takis Psarogiannakopoulos
+
+ July 27, 1999
+
+1. Whats new
+
+July 27, 1999
+
+DG has fix the streams bug in /usr/lib/tcpip.so . (Read below) The workaround
+in the July 25 source code has been removed. I've been told from DG that BSD
+sockets perform better in DGUX than SVR4 native STREAMS. From R4.20MU06 DG/ux
+will have the correct tcpip.so lib (no bug in STREAMS). If you have MU05,MU04
+and you want for some reason STREAMS definitely conntact DG for an upated
+/usr/lib/tcpip.so in /usr/lib (patch for your MU04,5).
+
+DG/ux at the moment lacks the sysi86 syscall and the definition of SYSI86IOPL
+(that is in <sys/sysi86.h> but guarded by a UNIXWARE defintion that of course
+cannot be applicable to DG/ux). Until this header is accessible by a simple
+-DDGUX , and _sysi86, sysi86 subroutines added to libc (or some other extra
+library) we need to define the DG_NO_SYSI86 to be 1. If DG makes the above
+modifications , you will need to manually edit the files (before building)
+ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_DGUX.c
+ xc/programs/Xserver/hw/xfree86/etc/scanpci.c
+ xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c
+and eliminate DG_NO_SYSI86 flag by changing DG_NO_SYSI86 1-->0.
+
+July 25, 1999
+
+A major bug has now been corrected in this release. According to this since
+the STREAMS interface of DG/ux were broken the server was listening not to
+port 6000 (= 0x1770) but to 0x7017. All binaries that you have from 3.3.3.1,
+3.3.3 they will work locally (if you run them in the same machine) but NOT
+remotely because they use an Xlib that tries to connect to port 28365. If
+you want to run them remotely YOU MUST recompile them! Steve thank you for
+bringing this to my attension initially but was too bussy then to look at it
+in detail... Perhaps I should have...
+
+We now use sockets intead of ioctls. But I 've fix and tested the STREAMS
+also.
+
+David thanks for making me realize that this was indeed a problem in DG/ux.
+
+I 've also take the trouble to port gdb-4.17/8 and ddd (X inter) in
+pub/XFree86/3.3.5/binaries/DGUX-ix86/GDB_BETA (both binaries and source code)
+in order to be able to send me traces of core files produced by Xservers. Try
+
+ gdb /usr/X11R6/bin/X location of core/core
+ gdb: where
+
+and send me what you see. (I suppose that the Xserver executable is in
+/usr/X11R6.3/bin)
+
+From 3.3.3.1: Several bugs are now fixed. DG/ux support is on this official
+patch. All configuration is in xc/config/cf/DGUX.cf and in xf86site.def. Also
+Imake autodetects (thanks to David Dawes) the DGUX OS (including Release ver-
+sion). So only a simple "make World" is needed anymore to build in ix86
+DG/ux. Usually the process to build is (after unpacking and patching the
+source "xc" tree) to go to xc/config/cf copy the file xf86site.def to
+site.def and edit the files DGUX.cf ,site.def for whatever changes you need
+to do.
+
+Default ProjectRoot in 3.3.5 is /usr/X11R6 (except if you set this specifi-
+cally in DGUX.cf either as /usr/X11R6.3-- --my choice, or in whatever you
+like).
+
+From: December 1, 1998 IMPORTANT: PLEASE READ THE FILE README-GCC-2.8.1 GCC
+VERSION 2.8.1 is recommended for the DGUX build of X11R6.3 You can ignore
+below the _old_ converstation about gcc compiler if you already run a
+gcc-2.8.1 in your machine.
+
+2. GENERAL:
+
+Get from ftp.xfree86.org the XFree 3.3.x source code:
+
+ ftp ftp.xfree86.org
+ login: ftp
+ passwd: your e-mail address
+ cd pub/XFree86/3.3.5/source
+ You need the files:
+ X335src-1.tgz
+ X335src-2.tgz
+ X335src-3.tgz
+
+Get also the contributed X software
+
+ cd /pub/XFree86/3.3.5/source
+ X335contrib.tgz
+
+If you have the source tarballs of 3.3.3 go to /pub/XfFree86/3.3.5/bina-
+ries/DGUX-ix86/SOURCE get the DGUX source patch
+
+ 3.3.3-3.3.5-DGUX.diff.gz
+ X335contrib-DGUX.diff.gz (patch for the contrib software).
+
+to avoid downloading all the source code again.
+
+Sorry some DGUX changes they didnt make in time for the official release date
+of 3.3.4... I do this for free, so some times I may be excused for something
+like this...
+
+To build X11R6.3 you need also the tools for DG/ux (see discussion below).
+They will be in ftp dpmms.cam.ac.uk (University of Cambridge,Department of
+Pure Mathematics) in /pub/takis/DGUX-Tools/BuildXtools.tar.gz (anonymous ftp)
+or in the ftp.xfree86.org ... (pub/XFree86/3.3.5/binaries/DGUX-
+ix86/SOURCE/BUILD-TOOLS/ BuildXtools.tar.gz).
+
+Using a big filesytem (I use a virtual disk "xf86work" mounted on /xf86work
+of size 1400000 blocks) copy the source as:
+
+ cp X335src-1.tgz /xf86work/X335src-1.tar.gz
+ cp X335src-2.tgz /xf86work/X335src-2.tar.gz
+ cp X335src-3.tgz /xf86work/X335src-3.tar.gz
+
+(or X333src-1,2,3.tar.gz as above plus the DG/ux patch to 3.3.5 i.e. the file
+3.3.3-3.3.5-DGUX.diff.gz)
+
+And maybe the contributed software:
+
+ cp X335contrib.tgz /xf86work
+
+ (cp X335contrib-DGUX.diff.gz /xf86work).
+
+If you get the patches from DGUX-ix86, to build from source 3.3.3 your first
+problem is that in order to apply the source patch you need "patch" a very
+common GNU program that DG/ux doesnt have!? This program is in BuildX-
+tools.tar.gz (or ftp prep.ai.mit.edu cd/pub/gnu get patch-2.5.tar.gz) So lets
+speak about these tools before anything else: Using "sysadm" mount a filesys-
+tem usr_local under /usr/local with size 200000 blocks. Then copy the BuildX-
+tools file in /usr and give:
+
+ gzip -d < BuildXtools.tar.gz | tar xvf -
+
+It will unfold in the new filesytem /usr/local. Then go to your ".profile"
+(in your Home dir , mine eg is /admin) and add the /usr/local/bin in your
+path and the /usr/local/lib in your lib-path.
+
+What you need is like that: (vi .profile)
+
+ PATH=/usr/local/bin:/sbin:/usr/sbin:/usr/bin
+ if [ -d /usr/opt/X11/bin ]
+ then
+ PATH=$PATH:/usr/opt/X11/bin
+ fi
+ export PATH
+ (/usr/local/bin is before any other path!)
+
+ LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/ccs/lib
+ export LD_LIBRARY_PATH
+
+then exit and re-login so that your new modified .profile will take effect.
+
+Now do the following:
+
+ cd /usr/sbin
+ cp install install_dg
+ rm install
+ cp /usr/local/bin
+ cp install /usr/bin *(make the GNU install the default install)*
+ (DG/ux install is useless)
+ (Look also the file xc/config/cf/DGUX.cf , below).
+
+ (Or get GNU make-3.77 and copy install.sh (or -sh) to a /usr/bin/install)
+
+ cd /usr/bin
+ cp true /usr/local/bin
+ cd /usr/local/bin
+ ln -s true ranlib (Install true as ranlib in the DG/ux system)
+
+Usually giving -v,-V or --version will give you build info on all the tools
+in /usr/local/bin (try it).
+
+**Look the discussion for gcc before you build (below)**
+
+Now untarr the source tree: In /xf86work (or whatever name you gave to the
+big filesystem for the build)
+
+ gzip -d < X335src-1.tar.gz | tar xvf -
+ gzip -d < X335src-2.tar.gz | tar xvf -
+ gzip -d < X335src-3.tar.gz | tar xvf -
+
+(If you have X-3.3.3 do the same for the 3.3.3 sources and then apply the
+3.3.5-DGUX source patch
+
+ gzip -d < 3.3.3-3.3.5-DGUX.diff.gz | patch -p0 -E).
+
+The directory xc in now present in your build filesystem.
+
+3. Configuration for the build:
+
+Almost all you need is in "DGUX.cf" located in xc/config/cf. Edit the file
+DGUX.cf and site.def and change what ever you need. Remember DGUX.cf over-
+writes site.def. The default ProjectRoot for XFree86-3.3.5 is now /usr/X11R6
+(located in site.def). If you want to change this to whatever you like (I
+prefer /usr/X11R6.3 and a link in /usr X11R6->X11R6.3) edit DGUX.cf and
+locate the entry:
+
+ #if 0
+ #define ProjectRoot /usr/X11R6.3
+ #endif
+
+Eliminate the #if 0 , #endif. Then change this to whatever you prefer. (I
+prefer the above for the precompiled binaries)
+
+The DG/ux malloc is crap and keeps bringing problems with some X software so
+I dont use it. Instead there is a port of GNU malloc in /usr/local (it came
+with the BuildXtools file). Dont try to build with the /lib/libmalloc.a of
+DG/ux and then send me e-mails that some programs they dont work properly.
+In my build I use tcl8.0 and tk8.0 since the xconfig of R4.20MU03 is report-
+ing incorrect values for the monitors and XF86Setup need to be build in order
+to manage to adjust the display. If you dont have this (or dont want this)
+comment out the lines about tcl,tk, (in DGUX.cf)
+
+ /*******TCL TK DEFINITIONS ***********/
+ #define HasTk YES-->NO
+ ...
+ #define HasTcl YES-->NO
+
+Also 'GNU make' is required for the correct X11R6.3 build. (it is in Buildx-
+tools file). If you decide yes to tcl,tk obtain the files
+
+ tcl8.0.3.tar.gz
+ tk8.0.3.tar.gz (from some ftp)
+
+(or newer versions) and compile them before the building of X11R6.3 (Build
+first tcl8.0.3 then tk8.0.3).
+
+4. DISCUSSION ABOUT GCC
+
+There are so much things that I can say for the system gcc of DG/ux. If I was
+keeping track for the programs that fail using this compiler I will certainly
+have fill a book (conveniently for the DG of course). But my work is not to
+correct bugs for the DG/ux compiler or anything else) , and in particular to
+collect reports for the genius of DG. (DG:Sorry guys nothing personal. I am
+a pure Mathematician , I am doing all this work for pleasure, I dont want any
+money from DG or anybody else , I am not looking to become a employer of
+DG,and I am NOT a trouble shooter of the DG/ux in general. But maybe some
+times if you help I may be able to help you also).
+
+What I wanted to do is to build X11. Thats why you will find in BuildXtools a
+new gcc. This gcc is build for DG/ux R4.20MU02. so you have to upgrade your
+DG/ux OS version to the above. But it is solid to build not only X11 but
+whatever else you want. DO NOT use gcc of DG/ux. If you do I cannot tell you
+anything about any problems that you have. To complete the installation of
+this new gcc do the following:
+
+ cp -r /usr/local/gcc-dgux /usr/opt/sdk/sde/ix86dgux/usr/lib
+ cd /usr/opt/sdk/sde/ix86dgux/usr/lib
+ rm gcc
+ ln -s gcc-dgux gcc (set link gcc--->gcc-dgux)
+
+ cd /usr/local
+ cp -r /usr/local/gcc-dgux /usr/sde/ix86dgux/usr/lib
+ cd /usr/sde/ix86dgux/usr/lib
+ rm gcc
+ ln -s gcc-dgux gcc (set link gcc-->gcc-dgux)
+
+To come back to your old DG/ux gcc just change the above two links gcc-->gcc-
+dgux to gcc-->gcc-2 with the command: (in both the above two dirs)
+
+ rm gcc
+ ln -s gcc-2 gcc
+
+/usr/bin/gcc -v should report the version that you have. To build succes-
+fully this version of X11 gcc is a *MUST*.
+
+Dynamic loading Servers: Edit xc/config/cf/DGUX.cf and change the entry
+
+#ifndef BuildDynamicLoading #define BuildDynamicLoading NO --->YES. #endif
+
+Remeber when you build you will see lots of errors and the servers will NOT
+build! This is because the dynamic linker doesnt know the locatios of the
+newly created R6 libX's. So after the (seem faulty) building do a
+
+make DESTDIR=ProjectRoot/lib install
+
+(look below for install, ProjectRoot the location that you choose in the file
+xc/config/cf/DGUX.cf above)
+
+So that all your new libXR6 libraries will go there. (do a cd Project-
+Root/lib to make sure).
+
+Then go to your home dir and declare the path ProjectRoot/lib dir in you
+LD_LIBRARY_PATH (your profile) as:
+
+LD_LIBRARY_PATH=ProjectRoot/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH
+
+Then relogin!
+
+Now just _rebuild_ A FULL XFree86-3.3.5 with the entry
+
+#define BuildDynamicLoading YES in your DGUX.cf.
+
+This time you will build _all_ XFree86-3.3.5 correctly.
+
+5. BUILD
+
+In the usual X11R5 of DG (mwm) open an xterm and give: (/bin/sh = Bourne
+shell)
+
+ cd xc
+ make World > Build-dg.log
+
+In that way you will get all the error meggages in your screen. Dont worry
+with messages about -znodefs.
+
+Note: the old command
+
+ make World BOOTSTRAPCFLAGS="-DDGUX" > Build-dg.log
+
+is no longer needed since imake will detect the DGUX OS (in Version =>
+3.3.3.1) and set up things. However this command will also work.
+
+And in another xterm give cd xc tail -f Build-dg.log to watch the building
+progress.
+
+To install X11R6.3 XFree version 3.3.5 after the build you must have a
+filesystem say usr_X11R6.3 mounted to the directory /usr/X11R6 size 350000
+blocks. (or whatever you choose to be your ProjectRoot, if you modify
+DGUX.cf for another ProjectRoot than the default /usr/X11R6 in site.def).
+Then give
+
+ make install
+ make install.man (install the man pages)
+
+The installation will not put an XF86Config in your /usr/X11R6.3/lib/X11/ and
+so if you give startx the new X11 will not start. Read the file README-
+X3331.DGUX in this ftp site (located in the binaries) about the whole instal-
+lation procedure of X11R6.3. Or quickly you can do: (I remind: DG/ux mouse
+device "/dev/mouse") cd /usr/X11R6.3/bin ln -s XF86_VGA16 X Then put in your
+.profile the path /usr/X11R6.3/bin and run the XF86Setup program. Ajust first
+the mouse device then everything else. (You need to read really the file
+README-DGUX.INSTALL-> look in the end of this file).
+
+To build the contributed software with XFree86-3.3.5 get the X335contrib.tgz
+and do
+
+ gzip -d < X335contrib.tgz | tar xvf -
+
+(Or for 3.3.3 sources unpack X333contrib.tgz and apply the DGUX patch as
+
+ gzip -d < X335contrib-DGUX.diff.gz | patch -p0 -E ).
+
+Please note: You must have already install and active the X11R6.3 that you
+build so that the imake is working properly for your system. Read below for
+how to install this Xwindow system. After that you could do:
+
+ cd contrib
+ xmkmf -a
+ make
+ make install
+ make install.man (for installing the man pages)
+
+6. INSTALLATION OF THE BINARY:
+
+NOTE:This executable has been compiled with the macro -DPENTIUM_CHANGE (that
+all the new Aviion machines support). If you have an old i486 (rather
+unlikely) the executable will NOT RUN correctly. But we havent use
+-mcpu=pentiumpro, so the executable will work on ALL PENTIUM machines.
+
+ o About Project Root: I choose as ProjectRoot for ix86 DG/ux the location
+ /usr/X11R6.3. The default (in 3.3.5 sources) is the /usr/X11R6. To cover
+ this we make a link in /usr as X11R6->X11R6.3 (read below) ;so dont for-
+ get to do this link. I dont like the location /usr/opt/X11 (default
+ location of DG X11) that some of you have suggested to me, I believe it
+ is a good idea to keep the original X11 as is for several reasons.
+
+ o Make a filesystem,using sysadm, mounted under "/usr/X11R6.3". This is
+ the default location of X11R6.3 , you cannot change this except if you
+ recompile the whole source of X. (Please dont send e-mails about this).
+ The size of this filesystem should be around 175 MB(350000 blocks).
+
+ The list of files is:
+
+ X3353DL.tgz 3D_Labs XServer ... etc
+ X3358514.tgz
+ X335AGX.tgz
+ X335I128.tgz
+ X335Ma32.tgz Mach32 Xserver
+ X335Ma64.tgz Mach64 Xserver
+ X335Ma8.tgz
+ X335Mono.tgz
+ X335P9K.tgz
+ X335S3.tgz
+ X335S3V.tgz
+ X335SVGA.tgz SuperVGA Xserver (Supports AV3700 Cirrus)
+ X335VG16.tgz VGA16 Xserver (needed by XF86Setup)
+ X335W32.tgz
+ X335bin.tgz BIN (you must have this)
+ X335cfg.tgz
+ X335doc.tgz
+ X335f100.tgz
+ X335fcyr.tgz
+ X335fnon.tgz
+ X335fnts.tgz
+ X335fscl.tgz
+ X335fsrv.tgz
+ X335lib.tgz LIB (you must have this)
+ X335lkit.tgz Linkkit (X development)
+ X335man.tgz Man pages
+ X335nest.tgz
+ X335prog.tgz
+ X335prt.tgz
+ X335set.tgz
+ X335vfb.tgz
+ preinst.sh Install script
+ extract The XFree86 extract program (for ix86 DG/ux)
+
+ SUMS.md5 CheckSums for the integrity of the files
+
+ (Try compile the GNU textutils-1.22.tar.gz from prep.ai.mit.edu
+ /pub/gnu. md5sum is there).
+
+ You need at least:
+
+ X335bin.tgz
+ X335lib.tgz
+
+ And the correct Xserver for your machine/Graphics card. In my opinion
+ take all files , in the future you may need to switch to another graph-
+ ics device etc ... (mget *). Generally it is good to have the full dis-
+ tribution of the X11R6.3 window system ,it should make life easier in
+ DG/ux.
+
+ (Trivial:you must have root privilege).
+
+ o Unpack the *.tgz files in your / so that it will go directly inside to
+ the new filesystem /usr/X11R6.3. After you do that cd /usr and do a link
+ : ln -s X11R6.3 X11R6. (Use the install script). This link will indi-
+ cate in XF86 programs like XF86Setup where the new X11 window system is.
+
+ o cd your home dir and backup your .profile as "cp .profile myprofile".
+ Then cd /usr/X11R6.3. Copy the file HOME.profile-X11R6.3 to your home
+ dir as "cp HOME.profile-X11R6.3 your home dir/.profile" ,then cd your
+ home dir and "chmod 644 .profile" to make sure that the new profile is
+ active. This is because you need to tell to the system to look for the X
+ software in a different location than the usual /usr/bin/X11 of DG/ux.
+ Also you need to tell to the system that the new X libraries are in
+ /usr/X11R6.3/lib.
+
+ **You NEED to re-login in order to make the new .profile active !** **
+ DO NOT GIVE "startx" AFTER THAT, READ Configuration below !**
+
+ o About Configuration: DG/ux has a program (actually a script) called
+ xconfig that makes the configuration for you. Usually when you run xcon-
+ fig in the DG/ux-X11R5 it creates a file XdgConfig in /var/X11/Xserver
+ which is the corresponding of the XF86-configuration file located in
+ /usr/X11R6.3/lib/X11/XF86Config. This file ,in the section monitor, has
+ all values for your monitor. Please Note: Unfortunately in DG/ux
+ R4.20MU02 things change. Instead of going forwards we going backwards...
+ xconfig reports crazy values for my DG-DA1765VA monitor. So if you have
+ a CDROM of DG/ux R4.11MU02,or MU03 use it to find an xconfig that will
+ give you reliable values for your monitor.
+
+ Your best bet is to use XF86Setup for correct adjustments.
+
+ Thats the reason that in this binary there is a mininum tcl,tk(version
+ 8.0). Before you run XF86Setup read the relevant documents found in
+ www.xfree86.org. (Or read below for a hand-made configuration).
+
+ Notice about XF86Setup: You will will see the message "The program is
+ running on a different virtual" "Please switch to the correct virtual
+ terminal"
+
+ DG/ux does NOT have any virtual terminals. But XF86Setup uses a script
+ that doesnt checks for this. So it is printing this message anyway.
+ Ignore it and dont send e-mails asking how to set the virtual terminal!
+ XF86Setup WORKS for SURE (if you use it correctly) to set your configu-
+ ration. Just remember:
+
+ 1. make a link in /usr/X11R6.3/bin: ln -s XF86_VGA16 X
+
+ 2. set mouse device in your XF86Config to /dev/mouse (this the mouse
+ in DGUX)
+
+ 3. set the correct mouse protocol. (usually for a typical AViiON
+ PS/2).
+
+ Or just cd /usr/X11R6.3/lib/X11 and copy XF86Config.eg.dgux to XF86Con-
+ fig (it is for a PS/2 protocol mouse that almost all AViiON's have) ,
+ then run XF86Setup and choose to use this XF86Config file as default (so
+ mouse works).
+
+ Alternatively, you can run xf86config, a non-graphical configuration
+ utility but you will need to enter manually the values for your monitor.
+ If you have the small booklet that came with the monitor they are
+ inside.
+
+ Hand made configuration: I have an DG/ux Medium resolution (1280x1024)
+ 17 inch DG-26059,DA1765VA. ONLY IF YOU HAVE THE ***EXACT SAME*** MONI-
+ TOR USE THE FILE XF86Config_SVGA_DGUX that you will find in
+ /usr/X11R6.3/. IT IS IN YOUR OWN RISK IF YOU DECIDE TO USE THIS FILE
+ WHEN YOU DONT HAVE THE SAME MOTINOR AS MINE. YOU CAN DAMAGE YOUR VIDEO
+ MONITOR OR YOUR GRAPHICS CARD.
+
+ An examble of how to use the Accel Servers (eg ATI=XF86_Mach64) is in
+ the file XF86Config_ATI_DGUX. Again remember: I have an DG/ux Medium
+ resolution (1280x1024) 17 inch DG-26059,DA1765VA. ONLY IF YOU HAVE THE
+ ***EXACT SAME*** MONITOR USE THE FILE XF86Config_ATI_DGUX that you will
+ find in /usr/X11R6.3/. IT IS IN YOUR OWN RISK IF YOU DECIDE TO USE THIS
+ FILE WHEN YOU DONT HAVE THE SAME MOTINOR AS MINE. YOU CAN DAMAGE YOUR
+ VIDEO MONITOR.
+
+ Start with the file XF86Config.eg as a prototype. READ the REAME.Config
+ . In Cirrus chips you need to read the file README.cirrus located in
+ /usr/X11R6.3 There is a problem with the accelarated XAA code ,so you
+ need to try to put the following option in your XF86Config:
+
+ Option "no_mmio" (in Section Screen ,subsection display).
+
+ Look in the XF86Config_SVGA_DGUX to see how this can be done . If this
+ doesnt work (it will probably) try Option "noaccel" or "no_bitblt".Again
+ READ the file README.cirrus (and README.Config). I suggest to print (in
+ paper) the file XdgConfig and have a look in it. Then it should be quite
+ trivial to figure out what you have to do with the XF86 file ie XF86Con-
+ fig in the sections mouse, keyboard, screen ... After you have a cor-
+ rect XF86Config in /usr/X11R6.3/lib/X11 give
+
+ chmod 444 XF86Config.
+
+ Supposing that you have already re-login so that the new .profile is
+ active and you have the correct XF86Config file (as your XdgConfig sug-
+ gest) (DO not forget for a cirrus to put the Option "no_mmio" in section
+ screen !), give startx and the new X11 will start . Remember: You can
+ shut down at any point the Xserver by pressing CONTROL+ALT+BACKSPACE (if
+ something goes wrong). Also Xservers dont produce messages unless to
+ want them to do so. This is because the DG/ux console driver some times
+ causes corruption of the screen if you print text during the startup of
+ the Xserver. If you require messages try in bash shell to give: (bash#
+ )
+
+ X -verbose >& info1 or even
+ X -verbose -verbose >& info2 for more messages.
+
+ Then when the server is up press CONTROL+ALT+BACKSPACE to shutdown the
+ Xserver. File info1 (or info2) have all relevant info about your graph-
+ ics card , display memory etc ... I suggest you do that at least one
+ time before start using the new X11R6.3. Read this info file to see if
+ all ok. If not try change settings in your XF86Config to make thinks
+ correct.
+
+ If you have an ATI Rage II (or RageII+) use the server XF86_Mach64 (make
+ a link link X--->XF86_MACH64, or run xf86config, or use XF86Setup
+ above).
+
+ o If you want to compile programs with the X11R6.3 the headers in
+ /usr/include /X11 pointing to /usr/opt/X11 of DG/ux is a problem . Do:
+
+ a): unmounting the /usr/opt/X11 will prevent the sysadm to use the X
+ graphical interface. But this will be the only thing that you loose.
+ The correct thing to do for X11R6.3 is to delete the filesystem
+ /usr/opt/X11 and make a link /usr/opt/X11--->/usr/X11R6.3 , so that the
+ libraries from dglib and /usr/lib point correctly to the new ones in
+ /usr/X11r6.3/lib. Before you unmount this filesystem you need to do
+ this:
+
+ cd /usr/opt/X11/include
+ cp -r Mrm /usr/X11R6.3/include
+ cp -r uil /usr/X11R6.3/include
+ cp -r Xm /usr/X11R6.3/include
+ cd /usr/X11R6.3/include
+ ln -s uil Uil
+
+ LIBRARIES:
+
+ and cd /usr/opt/X11/lib
+ cp libXm.a /usr/X11R6.3/lib
+
+ and similarly copy the following libraries:
+
+ libX11.so.2, libX11.so.5, libXIM.so.1, libXaw.so.1, libXaw.so.2,
+ libXext.so.2, libXi.so.2, libXimp.so.1, libXm.so.2, libXmu.so.2,
+ libXsess.so.1, libXsi.so.1, libXt.so.2, libXt.so.5.0, libMrm.a,
+ libUil.a, libX11_s, libXR4sco_s
+
+ into /usr/X11R6.3/lib.
+
+ Then cd /usr/X11R6.3/lib and make links:
+
+ ln -s libXm.so.2 libXm.so
+ ln -s libXm.so.2 libXm.so.1
+ ln -s libXm.so.2 libXm.so.5.0
+
+ ln -s libX11.so.5.0 libX11.so.1
+
+ ln -s libXIM.so.1 libXIM.so.5.0
+
+ ln -s libXaw.so.2 libXaw.so.5.0
+
+ ln -s libXext.so.2 libXext.so.5.0
+ ln -s libXext.so.2 libXext.so.1
+
+ ln -s libXi.so.2 libXi.so.1
+ ln -s libXi.so.2 libXi.so.5.0
+
+ ln -s libXimp.so.1 libXimp.so.5.0
+
+ ln -s libXmu.so.2 libXmu.so.5.0
+
+ ln -s libXt.so.2 libXt.so.5.0
+
+ ln -s libXsi.so.1 libXi.so.5.0
+
+ cd /usr/X11R6.3/lib
+ rm libXmu.so (to avoid undefs when building X software)
+
+ Also you need to correct the links in /usr/dglib at least! (the correct
+ thing to do is modify also /usr/lib links to /usr/opt/X11 libs). Try
+
+ cd /usr/
+ tar -cvf dglib-orig.tar dglib
+ gzip dglib-orig.tar
+
+ (to minimize the space dglib-backup takes) then
+
+ cd /usr/dglib
+
+ and delete ALL links to libraries in /usr/opt/X11. Then copy the script
+ create_new_links_in_dglib (found in /usr/X11R6.3 to /usr/dglib and cd
+ /usr/dglib execute script. This will create all new links with the
+ X11R6.3 X window system.
+
+ But remember to do in the end :
+
+ cd /usr/dglib
+ rm *.a (no static libs links in dglib)
+
+ Then unmount (delete) the old X11 by giving "umount /usr/opt/X11".
+
+ NOTE: If you compile programs in the X11R6 make sure that you unmount
+ /usr/opt/X11 or you eliminate the links in /usr/lib to the OLD libX's in
+ /usr/opt/X11/lib. Otherwise gcc will link these old libraries! and the
+ binary will not run correctly. Always after an R6 compilation do "ldd
+ prog" to make sure that the binary loads only R6 version libraries
+ (except maybe the motif library libXm.so.2), --if you dont use the
+ static libXm.a
+
+ b:)
+
+ cd /usr/include
+ tar -cvf old-X11headers.tar X11
+ gzip old-X11headers.tar
+
+ so that you store your old headers in /usr/include.
+
+ Then cd /usr/include/ and delete
+
+ rm -r X11
+ rm Xm
+ rm Mrm
+ rm Uil
+ rm uil
+ Make new links as:
+ cd /usr/include
+ ln -s ../X11R6.3/include/X11 X11
+ ln -s ../X11R6.3/include/uil Uil
+ ln -s ../X11R6.3/include/uil uil
+ ln -s ../X11R6.3/include/Xm Xm
+ ln -s ../X11R6.3/include/Mrm Mrm
+
+7. What is about:
+
+This new X11R6 are not simply an upgrade of the servers to the latest ones.
+It is a new programming platform in your DG/ux system to allow you to import
+all this *FREE* or not software for the X window system. This software will
+not compile in the old (and ungly) X11 of Data General. The imake command
+that is implemented in almost all the (source) software for X11 (free or not)
+will not work with the totally broken "imake" command of /usr/opt/X11 of
+DG/ux.
+
+The imake of DG/ux X11R5 is badly broken: I have seen DG/ux releases
+R4.11,MU01, ...MU04, R420, R4.20MU02 ,R4.20MU03 and nobody bother to look in
+all these releases the imake command...
+
+While until now DG was rather hostile to the prospect of a new X11 in DG/ux
+some new folks there they have turn their interest in X11R6 (XFree86) these
+days. That is good of cource because the ultimate target is to make XFree86
+(3.3.5 or whatever version) to run in _their_ DG/ux Unix! I will be able to
+make a much better X11 in DG/ux if I could had some access to DG/ux sources
+(i.e. the original R5 sources , but not only --eg kernel driver sources as
+for examble the DG/ux kernel console driver sources).
+
+I have compile almost anything that runs for Linux in DG/ux using this X11.
+In doing this work in XFree86 I would like to express my thanks to David
+Dawes that he help me all the time with several techical questions. Also D.T.
+is one of the people that offer valuable help. Finally I want to express my
+thanks to John H. for enlight me in some syscall issues.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DGux.sgml,v 1.1.2.2 1999/07/26 06:54:45 hohndel Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DGux,v 1.2 1999/08/23 06:54:16 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
new file mode 100644
index 000000000..85048b17d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI
@@ -0,0 +1,115 @@
+Direct Rendering Infrastructure Alpha release
+---------------------------------------------
+
+Patches for the final sample implementation (SI) of Precision Insight's
+Direct Rendering Infrastructure (DRI) have been submitted to XFree86.
+
+
+
+Please direct all comments about this release to glx@xfree86.org.
+
+
+
+
+* What comes with this release?
+
+ There are four main parts of this patch:
+
+ 1. the client- and server-side DRI,
+ 2. a 2D DDX driver for 3Dlabs' GMX2000,
+ 3. an OpenGL client side direct rendering driver for the GMX2000, and
+ 4. a generic kernel driver for Linux 2.2.x (x <= 10) and Linux 2.3.y (y
+ <= 8).
+
+ The DRI handles the communication and synchronization between the X
+ server, the client driver and the kernel driver.
+
+ The 3Dlabs XFree86 DDX driver has been enhanced to support the
+ GMX2000. It has also been extended to communicate with and provide
+ callbacks for the DRI.
+
+ The client driver implements a subset of OpenGL. The subset required
+ for id Software's Quake 2 was chosen to demonstrate the capabilities
+ of the DRI. This driver communicates with the device by filling DMA
+ buffers and sending them to the kernel driver. Note that the Gamma
+ chip implements OpenGL 1.1 in hardware, and therefore, does not use
+ the Mesa internals at this time. However, support for the majority of
+ current generation of 3D hardware devices will require integration
+ with Mesa, so an example DRI driver using the Mesa software-only
+ pipeline was implemented (and is mostly complete for the alpha
+ release).
+
+ The generic kernel driver handles the allocation of the DMA buffers,
+ distribution of the buffers to the clients, sending the buffers to the
+ device, and the management of synchronization between the client
+ driver, the X server, and the kernel driver (this includes the device
+ lock and a shared memory region). Note that hardware that does not
+ support DMA or that does support special synchronization methods will
+ only make use of a subset of these capabilities.
+
+* What changed between the alpha release and the sample implementation?
+
+ - Dynamic loading of the OpenGL client driver is implemented
+ - 3D client death while holding the drawable lock does not cause deadlock
+ - The kernel module works with Linux 2.2.x [x <= 10] and 2.3.y [y <= 8]
+ - A better authentication mechanism has been implemented
+ - XF86Config options for the DRI are supported
+
+* What are the known problems and/or limitations of the sample
+ implementation?
+
+ Here are other problems that we did not have time to fix for the SI.
+ However, we and other open source developers could continue developing
+ and extending the DRI in follow-on projects.
+
+ - The X server seg faults due to a context switching bug when there
+ are 10 or more 3D clients running simultaneously
+ - A better DMA buffer queuing algorithm needs to be implemented
+ - A device specific shared memory region needs to be added to SAREA
+ - The DRI protocol request for the framebuffer layout needs to be
+ extended to support FB width and depth information (for 24 vs. 32
+ bpp, 8+24 layouts, etc)
+ - Direct rendering to a pixmap is not supported
+ - A more sophisticated texture management routine is required to
+ handle texture swapping efficiently
+ - Multi-threaded OpenGL clients are not supported
+ - glXCopyContext and glXUseXFont are not supported in the DRI
+ - SwapBuffers does not wait on vertical retrace
+ - Support wait for vertical retrace in kernel driver
+ - Handling overlays is not currently supported
+ - Integrate with DBE
+ - Completing the software-only Mesa example driver
+ - Completing the other OpenGL paths for the GMX2000
+ - Support for video modes other than 640x480 in both the GMX2000 2D
+ DDX driver and the 3D client driver
+ - More than minimal 2D acceleration of the GMX2000 2D DDX driver
+ should be implemented
+ - Implement finer grained locking scheme in X server to improve
+ interactivity
+ - Only grab the drawable lock and update the drawable stamp when a 3D
+ window is altered
+ - The viewport does not scale properly when a 3D window is resized
+ - Double buffered 3D windows are not clipped to the screen
+ - glXSwapBuffers is not clipped to the client's viewport
+ - Only one client is allowed to use texture memory
+ - glFinish does not wait until the HW completes processing the
+ outstanding DMA buffers
+ - Version numbers of the DDX and kernel driver are not verified
+ - Make lock available during SIGSTOP
+ - Make drmFinish work while holding the device lock
+ - Improve /proc/drm
+ - Improve documentation
+ - Improve example device-specific kernel driver (not used for SI)
+
+* Where can I get more information?
+
+ We have made our design and implementation documents available on our
+ website:
+
+ http://www.precisioninsight.com/piinsights.html
+
+ More documentation will be available with the SI release.
+
+* Where should I send comments?
+
+ Please send all comments and questions to the glx@xfree86.org list
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.FreeBSD b/xc/programs/Xserver/hw/xfree86/doc/README.FreeBSD
new file mode 100644
index 000000000..29e75f95e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.FreeBSD
@@ -0,0 +1,291 @@
+ README for XFree86 on FreeBSD
+
+ Rich Murphey, David Dawes
+
+ 8 November 1998
+
+1. What and Where is XFree86?
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes.
+
+For further details about this release, including installation instructions,
+please refer to the Release Notes.
+
+See the Copyright Notice.
+
+Binaries for XFree86 on FreeBSD 2.2.x and 3.0 are available from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/
+
+Send email to Rich-Murphey@Rice.edu or XFree86@XFree86.org if you have com-
+ments or suggestions about this file and we'll revise it.
+
+2. FreeBSD 3.0 and ELF
+
+The FreeBSD-3.0 binary distribution is ELF only. The Xbin.tgz tarball con-
+tains a.out libraries for compatibility purposes.
+
+3. Installing The Display Manager (xdm)
+
+The display manager makes your PC look like an X terminal. That is, it pre-
+sents you with a login screen that runs under X.
+
+The easiest way to automatically start the display manager on boot is to add
+a line in /etc/ttys to start it on one of the unoccupied virtual terminals:
+
+ ttyv4 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
+
+You should also make sure that /usr/X11R6/bin/X is a symbolic link to the
+Xserver that matches your video card or edit the file Xservers in
+/usr/X11R6/lib/X11/xdm to specify the pathname of the X server.
+
+The change to /etc/ttys won't take effect until you either reboot or ``kill
+-HUP 1'' to force initd to reread /etc/ttys. You can also test the display
+manager manually by loging in as root on the console and typing ``xdm -nodae-
+mon''.
+
+4. Configuring X for Your Hardware
+
+The XF86Config file tells the X server what kind of monitor, video card and
+mouse you have. You must create it to tell the server what specific hardware
+you have.
+
+It is strongly recommended that you read through the QuickStart guide, and
+use either the `XF86Setup' utility (which requires the VGA16 server to be
+installed), or the `xf86config' utility to generate an XF86Config file.
+
+When you run the `XF86Setup' utility, do NOT touch the mouse until you are
+finished with mouse set up. Otherwise, the VGA16 server and the mouse device
+driver may get confused and you may experience mouse and/or keyboard input
+problems.
+
+If you are running ``moused'' (see the man page for moused(8)) in FreeBSD
+versions 2.2.1 or later, you MUST specify SysMouse as the mouse protocol type
+and /dev/sysmouse as the mouse device name, regardless of the brand and model
+of your mouse.
+
+If you are NOT running ``moused'', you need to know the interface type of
+your mouse, /dev entry and the protocol type to use.
+
+The interface type can be determined by looking at the connector of the
+mouse. The serial mouse has a D-Sub female 9- or 25-pin connector. The bus
+mouse has either a D-Sub male 9-pin connector or a round DIN 9-pin connector.
+The PS/2 mouse is equipped with a small, round DIN 6-pin connector. Some
+mice come with adapters with which the connector can be converted to another.
+If you are to use such an adapter, remember the connector at the very end of
+the mouse/adapter pair is what matters.
+
+The next thing to decide is a /dev entry for the given interface. For the
+bus and PS/2 mice, there is little choice: the bus mouse always use
+/dev/mse0, and the PS/2 mouse is always at /dev/psm0. There may be more than
+one serial port to which the serial mouse can be attached. Many people often
+assign the first, built-in serial port /dev/cuaa0 to the mouse.
+
+If you are not sure which serial device your mouse is plugged into, the easi-
+est way to find out the device is to use ``cat'' or ``kermit'' to look at the
+output of the mouse. Connect to it and just make sure that it generates out-
+put when the mouse is moved or clicked:
+
+ % cat < /dev/tty00
+
+If you can't find the right mouse device then use ``dmesg|grep sio'' to get a
+list of serial devices that were detected upon booting:
+
+ % dmesg|grep sio
+ sio0 at 0x3f8-0x3ff irq 4 on isa
+
+Then double check the /dev entries corresponding to these devices. Use the
+script /dev/MAKEDEV to create entries if they don't already exist:
+
+ % cd /dev
+ % sh MAKEDEV tty00
+
+You may want to create a symbolic link /dev/mouse pointing to the real port
+to which the mouse is connected, so that you can easily distinguish which is
+your ``mouse'' port later.
+
+The next step is to guess the appropriate protocol type for the mouse. In
+FreeBSD 2.2.6 or later, the X server may be able to automatically determine
+the appropriate protocol type, unless your mouse is of a relatively old
+model. Use the ``Auto'' protocol in these versions.
+
+In other versions of FreeBSD or if the ``Auto'' protocol doesn't work in
+2.2.6, you have to guess a protocol type and try.
+
+There is rule of thumb:
+
+ 1. The bus mice always use the ``BusMouse'' protocol regardless of the
+ brand of the mouse.
+
+ 2. The ``PS/2'' protocol should always be specified for the PS/2 mouse
+ regardless of the brand of the mouse.
+
+ NOTE: There are quite a few PS/2 mouse protocols listed in
+ the man page for XF86Config. But, ``PS/2'' is the only PS/2
+ mouse protocol type useful in XF86Config for FreeBSD. The
+ other PS/2 mouse protocol types are not supported in FreeBSD.
+ FreeBSD version 2.2.6 and later directly support these proto-
+ col types in the PS/2 mouse driver psm and it is not neces-
+ sary to tell the X server which PS/2 mouse protocol type is
+ to be used; ``Auto'' should work, otherwise use ``PS/2''.
+
+ 3. The ``Logitech'' protocol is for old mouse models from Logitech. Mod-
+ ern Logitech mice use either the ``MouseMan'' or ``Microsoft'' proto-
+ col.
+
+ 4. Most 2-button serial mice support the ``Microsoft'' protocol.
+
+ 5. 3-button serial mice may work with the ``MouseSystems'' protocol. If it
+ doesn't, it may work with the ``Microsoft'' protocol although the third
+ (middle) button won't function. 3-button serial mice may also work
+ with the ``MouseMan'' protocol under which the third button may func-
+ tion as expected.
+
+ 6. 3-button serial mice may have a small switch to choose between ``MS''
+ and ``PC'', or ``2'' and ``3''. ``MS'' or ``2'' usually mean the
+ ``Microsoft'' protocol. ``PC'' or ``3'' will choose the ``MouseSys-
+ tems'' protocol.
+
+ 7. If the serial mouse has a roller or a wheel, it may be compatible with
+ the ``IntelliMouse'' protocol.
+
+5. Running X
+
+8mb of memory is a recommended minimum for running X. The server, window
+manager, display manager and an xterm take about 8Mb of virtual memory them-
+selves. Even if their resident set size is smaller, on a 8Mb system that
+leaves very space for other applications such as gcc that expect a few meg
+free. The R6 X servers may work with 4Mb of memory, but in practice compila-
+tion while running X can take 5 or 10 times as long due to constant paging.
+
+The easiest way for new users to start X windows is to type ``startx >&
+startx.log''. Error messages are lost unless you redirect them because the
+server takes over the screen.
+
+To get out of X windows, type: ``exit'' in the console xterm. You can cus-
+tomize your X by creating .xinitrc, .xserverrc, and .twmrc files in your home
+directory as described in the xinit and startx man pages.
+
+6. Rebuilding Kernels for X
+
+The GENERIC FreeBSD kernels support XFree86 without any modifications
+required. You do not need to make any changes to the GENERIC kernel or any
+kernel configuration which is a superset.
+
+For a general description of BSD kernel configuration get smm.02.config.ps.Z
+<URL:ftp://gatekeeper.dec.com/pub/BSD/manuals/smm.02.config.ps.Z>. It is a
+ready-to-print postscript copy of the kernel configuration chapter from the
+system maintainers manual.
+
+If you do decide to reduce your kernel configuration file, do not remove the
+line below (in /sys/arch/i386/conf). It is required for X support:
+
+ options UCONSOLE #X Console support
+
+The generic FreeBSD kernels are configured by default with the syscons
+driver. To configure your kernel similarly it should have a line like this
+in /usr/src/sys/i386/conf/GENERIC:
+
+ device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
+
+The number of virtual consoles can be set using the MAXCONS option:
+
+ options "MAXCONS=4" #4 virtual consoles
+
+Otherwise, the default without a line like this is 16. You must have more
+VTs than gettys as described in the end of section 3, and 4 is a reasonable
+minimum.
+
+The server supports two console drivers: syscons and pcvt. The syscons
+driver is the default in FreeBSD 1.1.5 and higher. They are detected at run-
+time and no configuration of the server itself is required.
+
+If you intend to use pcvt as the console driver, be sure to include the fol-
+lowing option in your kernel configuration file.
+
+ options XSERVER #Xserver
+
+The number of virtual consoles in pcvt can be set using the following option:
+
+ options "PCVT_NSCREENS=10" #10 virtual consoles
+
+The bus mouse driver and the PS/2 mouse driver may not be included, or may be
+included but disabled in your kernel. If you intend to use these mice, ver-
+ify the following lines in the kernel configuration file:
+
+ device mse0 at isa? port 0x23c tty irq 5 vector mseintr
+ device psm0 at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr
+
+The mse0 device is for the bus mouse and the psm device is for the PS/2
+mouse. Your bus mouse interface card may allow you to change IRQ and the
+port address. Please refer to the manual of the bus mouse and the manual
+page for mse(4) for details. There is no provision to change IRQ and the
+port address of the PS/2 mouse.
+
+The XFree86 servers include support for the MIT-SHM extension. The GENERIC
+kernel does not support this, so if you want to make use of this, you will
+need a kernel configured with SYSV shared memory support. To do this, add
+the following line to your kernel config file:
+
+ options SYSVSHM # System V shared memory
+ options SYSVSEM # System V semaphores
+ options SYSVMSG # System V message queues
+
+If you are using a SoundBlaster 16 on IRQ 2 (9), then you need a patch for
+sb16_dsp.c. Otherwise a kernel configured with the SoundBlaster driver will
+claim interrupt 9 doesn't exist and X server will lock up.
+
+S3 cards and serial port COM 4 cannot be installed together on a system
+because the I/O port addresses overlap.
+
+7. Building X Clients
+
+The easiest way to build a new client (X application) is to use xmkmf if an
+Imakefile is included with it. Type ``xmkmf -a'' to create the Makefiles,
+then type ``make''. Whenever you install additional man pages you should
+update whatis.db by running ``makewhatis /usr/X11R6/man''.
+
+Note: Starting with XFree86 2.1 and FreeBSD 1.1, the symbol __386BSD__ no
+longer gets defined either by the compiler or via the X config files for
+FreeBSD systems. When porting clients to BSD systems, make use of the symbol
+BSD for code which is truly BSD-specific. The value of the symbol can be
+used to distinguish different BSD releases. For example, code specific to
+the Net-2 and later releases can use:
+
+ #if (BSD >= 199103)
+
+To ensure that this symbol is correctly defined, include <sys/param.h> in the
+source that requires it. Note that the symbol CSRG_BASED is defined for *BSD
+systems in XFree86 3.1.1 and later. This should be used to protect the
+inclusion of <sys/param.h>.
+
+For code that really is specific to a particular i386 BSD port, use
+__FreeBSD__ for FreeBSD, __NetBSD__ for NetBSD, __OpenBSD__ for OpenBSD,
+__386BSD__ for 386BSD, and __bsdi__ for BSD/386.
+
+8. Thanks
+
+Many thanks to:
+
+ o Pace Willison for providing initial *BSD support.
+
+ o Amancio Hasty for 386BSD kernel and S3 chipset support.
+
+ o David Greenman, Nate Williams, Jordan Hubbard for FreeBSD kernel sup-
+ port.
+
+ o Rod Grimes, Jordan Hubbard and Jack Velte for the use of Walnut Creek
+ Cdrom's hardware.
+
+ o Orest Zborowski, Simon Cooper and Dirk Hohndel for ideas from the Linux
+ distribution.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/FreeBSD.sgml,v 3.29 1999/08/23 06:38:46 dawes Exp $
+
+ $XConsortium: FreeBSD.sgml /main/12 1996/10/28 05:43:08 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.FreeBSD,v 1.3 1999/08/23 07:03:41 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.I128 b/xc/programs/Xserver/hw/xfree86/doc/README.I128
new file mode 100644
index 000000000..3cc943101
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.I128
@@ -0,0 +1,95 @@
+ Information for Number Nine I128 Users
+
+ The XFree86 Project Inc.
+
+ 24 October 1998
+
+1. Supported hardware
+
+The current accelerated I128 server supports
+
+ o Imagine 128 (I128 with Texas Instruments TVP3025 or IBM528 RAMDAC). It
+ has been tested with with 4MB of VRAM.
+
+ o Imagine 128 Ticket 2 Ride (I128-T2R with IBM526 or 528 RAMDAC). It has
+ been tested with 4 MB and 8 MB of VRAM and DRAM.
+
+ o Imagine 128 Revolution 3D (I128-R3D with IBM526 RAMDAC). It has been
+ tested with 4 MB, 8 MB, and 16 MB of WRAM or SGRAM.
+
+ o Imagine 128 Revolution IV (I128-R4 with SILVERHAMMER RAMDAC). It has
+ been tested with 32 MB.
+
+2. Features:
+
+ o uses linear frame buffer
+
+ o Resolutions up to the maximum supported by the card should be possible.
+
+ o 8 bpp, 16 bpp (depth 15 and 16), and 32 bpp (depth 24, sparse) are sup-
+ ported.
+
+ o supports RGB Sync-on-Green
+
+ o Makes use of the graphics accelerator.
+
+3. Configuration:
+
+The I128 driver should auto-detect all supported hardware so you needn't have
+anything other than the Identifier in the Section "Device" of the XF86Config
+file. When running the XF86Setup or xf86config programs one merely needs to
+select an I128 card so that the correct server will be used. One need not
+and should not specify a RAMDAC, clockchip or allow the setup program to
+probe for clocks. The driver will auto-detect the amount of video ram pre-
+sent.
+
+The following Section "Device" options are supported by the MGA driver:
+
+ o Option "dac_8_bit"
+
+ Will enable 8-bit DAC support.
+
+ o Option "no_accel"
+
+ Will disable all hardware acceleration.
+
+ o Option "sync_on_green"
+
+ Will enable syncing on green for sync-on-green monitors (these are typi-
+ cally fixed frequency workstation monitors).
+
+4. Mode lines for the Silicon Graphics flat panel display:
+
+ o These mode lines are required for use with the T2R4 (Rev 4) and the Sil-
+ icon Graphics Flat Panel display.
+
+ o Modeline "1600x1024d32" 103.125 1600 1600 1656 1664 1024 1024 1029 1030
+ HSkew 7 +Hsync +Vsync
+
+ o Modeline "1600x1024d16" 103.125 1600 1600 1656 1664 1024 1024 1029 1030
+ HSkew 5 +Hsync +Vsync
+
+ o Modeline "1600x1024d08" 103.125 1600 1600 1656 1664 1024 1024 1029 1030
+ HSkew 1 +Hsync +Vsync
+
+ o Modeline "800x512d32" 54.375 800 800 840 848 512 512 514 515 HSkew 7
+ DoubleScan +Hsync +Vsync
+
+ o Modeline "800x512d16" 54.375 800 800 840 848 512 512 514 515 HSkew 5
+ DoubleScan +Hsync +Vsync
+
+ o Modeline "800x512d08" 54.375 800 800 840 848 512 512 514 515 HSkew 1
+ DoubleScan +Hsync +Vsync
+
+5. Author(s)
+
+Robin Cutshaw, robin@XFree86.Org
+
+and special help from:
+
+ o Galen Brooks, galen@nine.com
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/I128.sgml,v 1.3 1999/08/28 10:43:32 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.4 1999/08/28 11:22:55 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.Linux b/xc/programs/Xserver/hw/xfree86/doc/README.Linux
new file mode 100644
index 000000000..0c70b7546
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.Linux
@@ -0,0 +1,128 @@
+ Information for Linux Users
+
+ Orest Zborowski, Dirk Hohndel
+
+ June 25, 1999
+
+1. Linux versions on which XFree86 has been tested
+
+XFree86 has been tested with Linux version 2.0.36, 2.2.7 and several 2.3.x
+kernels. It should work with any version since 1.0 without change. Binaries
+both against libc5 and libc6 are available.
+
+2. Backwards Compatibility
+
+X11R6 is considered a major update from X11R5, so the shared libraries in
+XFree86 3.1 and later are not compatible with XFree86 2.1.1 and older
+libraries. To continue to run X11R5 applications, you must keep the old
+libraries somewhere on your machine. They can be moved from /usr/X386/lib
+elsewhere, but /etc/ld.so.conf must be updated. All X11R5 applications
+should work with the X11R6 servers without problems.
+
+X11R6.1 is yet another update to X11R6. While the minor number for some
+libraries has been increased to '1' it is believed to be fully compatible
+with X11R6 based applications.
+
+X11R6.3 is yet another update to X11R6.1. While the minor number for some
+libraries has been increased to '3' it is believed to be fully compatible
+with X11R6 based applications.
+
+Very old binaries (linked to XFree86-1.2, XFree86-1.3 or XFree86-2.0
+libraries) will continue to work, but may need an explicit symlink from
+/lib/libX{11,t,aw}.so.3 to /usr/X386/lib/libX{11,t,aw}.so.3.
+
+3. Installing XFree86
+
+Starting with version 3.0, XFree86 is installed in /usr/X11R6. The installa-
+tion details are provided in the RELNOTES.
+
+4. Running XFree86
+
+XFree86 requires about 4mb of virtual memory to run, although having 16mb of
+RAM is probably the minimum comfortable configuration. A 387 coprocessor is
+helpful for 386 machines, although greater gains in interactive performance
+are obtained with an increase in physical memory. Also, a faster graphics
+card, bus or RAM, will improve server performance.
+
+After unpacking the tar files, you need to include /usr/X11R6/lib in
+/etc/ld.so.conf (where it should already be by default) or in your
+LD_LIBRARY_PATH environment variable. Also, the configuration file
+/etc/XF86Config or /usr/X11R6/lib/X11/XF86Config must be properly filled out
+based on the host setup. Ideally this is done using XF86Setup or (if for some
+reason this doesn't work) using xf86config. If you really insist in hand-cre-
+ating your config file use XF86Config.eg as a starting point and README.Con-
+fig as guideline. You may damage your hardware if you use a wrong XF86Config
+file, so read the docs, especially the man pages and the other README files
+in /usr/X11R6/lib/X11/doc.
+
+XFree86 has the ability to perform VT switching to and from the X server.
+When first started, XFree86 will automatically locate the first available VT
+(one that hasn't been opened by any process), and run on that VT. If there
+isn't one available, XFree86 will terminate with an error message. The
+server can be run on a specific VT by using the ``vt<nn>'' option, where <nn>
+is the number of an available VT (starting from 1). If you don't have a free
+VT XFree86 cannot run. Normally you can simply disable one of the getty pro-
+grams in /etc/inittab, but if this is not an option, you can increase the
+number of available VTs by increasing the value of NR_CONSOLES in
+include/linux/tty.h and recompiling the kernel.
+
+Once running inside X, switching to another VT is accomplished by pressing
+Ctrl-Alt-<Fnn> where nn is the number of the VT to switch to. To return to
+the server, press the proper key-combination that moves you back to the VT
+that XFree86 is using: by default, this is Alt-<Fmm>, where mm is the number
+of the VT the server is running on (this number is printed when the server is
+started). Note that this is NOT the VT from which the server was started.
+
+NOTE: you can redefine the text-mode keybindings with the `loadkeys' command
+found in the kbd-0.81.tar.gz archive (or a later version thereof). With
+this, you can (for example) make Ctrl-Alt-<Fmm> work from text mode the same
+way it works under the XFree86 server.
+
+When the server is exited, it will return to the original VT it was started
+from, unless it dies unexpectedly, when the switch must be done manually.
+There still seem to be weird combinations of graphic cards and motherboards
+that have problems to restore the textfont when returning from XFree86 to the
+text mode. In these cases using the runx script from the svgalib distribution
+might help.
+
+The XFree86 server now queries the kernel to obtain the key binding in effect
+at startup. These bindings are either the default map in place when the ker-
+nel was compiled, or reloaded using the `loadkeys' utility. Not all keys are
+bound: kernel-specific, multiple keysym, and dead keys are not handled by the
+server. All others are translated to their X equivalents. Note that the
+XFree86 server only allows for four modifier maps: unshifted, shifted, mod-
+eswitch unshifted and modeswitch shifted. Depending on what the modeswitch
+key is (it is configurable in your XF86Config and defaults to Alt), XFree86
+will read those tables into its keymaps. This means if you use certain keys,
+like left-Control, for Linux modeswitch, that will not be mappable to X.
+
+5. Installing Xdm, the display manager
+
+Since xdm is dynamically linked, there's no issue on export restriction out-
+side US for this binary distribution of xdm: it does not contain the DES
+encryption code. So it's now included in the bin package.
+
+However the file xc/lib/Xdmcp/WrapHelp.c is not included in the XFree86-3.3
+source, so support for XDM-AUTHORIZATION-1 is not included here. You'll have
+to get WrapHelp.c and rebuild xdm after having set HasXdmAuth in
+xf86site.def.
+
+The file is available within the US; for details see ftp.x.org:/pub/R6/xdm-
+auth/README.
+
+To start the display manager, log in as root on the console and type: ``xdm
+-nodaemon''.
+
+You can start xdm automatically on bootup by disabling the console getty and
+modifying /etc/inittab. Details about this setup depend on the Linux distri-
+bution that you use, so check the documentation provided there.
+
+The xdm binary provided should run with both shadow- and non-shadow password
+systems.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Linux.sgml,v 3.14 1999/08/23 06:38:46 dawes Exp $
+
+ $XConsortium: Linux.sgml /main/6 1996/10/28 04:47:37 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Linux,v 3.24 1999/08/23 07:03:41 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS b/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS
new file mode 100644
index 000000000..6c23d62a6
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.LynxOS
@@ -0,0 +1,494 @@
+ README for XFree86 on LynxOS
+
+ Thomas Mueller
+
+ Last modified on: 30 May 1999
+
+1. What and Where is XFree86?
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes. The release is available as source patches
+against the X Consortium X11R6.3 code, as well as binary distributions for
+many architectures.
+
+See the Copyright Notice in Copyright Notice.
+
+The sources for XFree86 are available by anonymous ftp from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current
+
+Binaries of XFree86 for LynxOS AT are available from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/LynxOS
+
+The binaries were built on `LynxOS x86 3.0.1'. Because of changes made to the
+object format they don't run on LynxOS versions earlier than 3.0.0.
+
+Building of this XFree86 version has never been tested on LynxOS versions
+earlier than 2.4.0. Binaries built on LynxOS 2.4.0 are expected to run on
+2.3.0 as well.
+
+XFree86 supports LynxOS on the AT, on the microSPARC and on the PowerPC plat-
+form. X servers are currently available on the AT and microSPARC platform.
+Refer to section Building on microSPARC and PowerPC (section 7., page 1) for
+details on XFree86 on the non-AT platforms.
+
+If you need binaries for other platforms than the one on the XFree86 FTP
+server contact me (tmueller@sysgo.de).
+
+Send email to tmueller@sysgo.de (Thomas Mueller) or XFree86@XFree86.org if
+you have comments or suggestions about this file and we'll revise it.
+
+2. Installing the Binaries
+
+Please refer to section "Installing the XFree86 3.3.4 Release" of the Release
+Notes for detailed installation instructions.
+
+If you plan to install XF86Setup you'll have to install X333prog as well
+since XF86Setup checks for the existence of a certain file name pattern which
+is satisfied only if you install the library files from X333prog.
+
+It may be necessary to increase the process stack limit in order to run
+XFree86 on your system. Edit /etc/startab and reboot your system to make the
+changes active before you begin the installation.
+
+Also, be sure to include /usr/X11R6/bin in your PATH environment variable.
+
+Refer to the next section Running XFree86 (section 3., page 1) for further
+information on necessary configuration steps before running XFree86 on
+LynxOS.
+
+3. Running XFree86
+
+This section describes the changes to the LynxOS environment which may be
+necessary to successfully run XFree86.
+
+Read Quick-Start Guide to XFree86 Setup to learn more about how to configure
+XFree86 for your hardware.
+
+3.1 System requirements
+
+A minimum of 16MB of memory is required to run X. If you want to run real-
+world applications you should think of upgrading to 32MB (or more).
+
+3.2 System tuning
+
+3.2.1 Tunable parameters
+
+To reasonably run XFree86 you may have to adjust a few system parameters.
+
+On LynxOS 2.5.x and 3.0.x include a line
+
+ #define X_WINDOWS
+
+in /sys/lynx.os/uparam.h.
+
+For earlier versions you'll have to edit /usr/include/param.h:
+
+ Tunable Old New
+ USR_NFDS number of open files per process 20 64
+ NPROC number of tasks 50 150
+ NFILES number of open files in system 100 250
+ NINODES number of incore inodes (same value as NFILES)
+ QUANTUM clock ticks until preemption 64 20
+ CACHEBLKS number of cache memory blocks 202 >= 4096
+
+The new values are those suggested by the LynxOS documentation for their X
+Window package.
+
+3.2.2 Adjustment for Riva 128 and Riva TNT driver>
+
+If you're using the nVidia driver (Riva 128, TNT, TNT2) of the SVGA server,
+you will have to increase the value of the SMEMS parameter in
+/sys/lynx.os/uparam.h from 10 to 20."
+
+3.2.3 Increase number of ptys
+
+You should also increase the number of ptys to be able run a couple more
+xterms. You may replace /sys/lynx.os/pty.cfg with
+/usr/X11R6/lib/X11/etc/pty.cfg.
+
+3.2.4 Kernel build
+
+If you plan to use PS/2 or Bus mice refer to the following section before
+rebuilding the kernel, if not, you should rebuild the kernel now:
+
+ # cd /sys/lynx.os
+ # make install
+ # reboot -N
+
+3.3 Mouse support in XFree86
+
+XFree86 includes support for PnP mice (see also Mouse Support in XFree86).
+The current LynxOS TTY device driver doesn't allow the necessary manipulation
+of the RTS line and therefore the support for PnP mice has been disabled for
+LynxOS.
+
+3.4 Bus mouse drivers
+
+Starting with LynxOS AT 2.4.0 LynxOS includes a PS/2 mouse driver. Currently
+this driver is not fully supported by XFree86 (you'll probably have to spec-
+ify the mouse type as Microsoft regardless of real mouse type and in some
+cases you won't have all mouse buttons supported).
+/usr/X11R6/lib/X11/etc/BM-Lynx.shar contains a LynxOS port of the Linux bus
+mouse drivers. To install the drivers unpack the shar archive
+
+ # cd /
+ # bash /usr/X11R6/lib/X11/etc/BM-Lynx.shar
+
+and follow the notes in /BMOUSE.Readme for further installation and configu-
+ration notes.
+
+The XFree86 PS/2 mouse driver works also with MetroLink X 2.3.3.1 as shipped
+with LynxOS AT 2.4.0 unless you have the LynxOS patch 000055-00 installed.
+
+3.5 ATC console driver and VT switching
+
+The XFree86 servers will only run with the default LynxOS console driver,
+sorry for those of you who use the alternative vdt console driver. Currently
+there is no support for virtual terminal switching once the server has
+started.
+
+You will need a free console which the X server will use for keyboard input.
+You must disable login on at least one of the four virtual terminals in
+/etc/ttys, e.g. /dev/atc3:
+
+change
+
+ /dev/atc3:1:default:vt100at:/bin/login
+
+to
+
+ /dev/atc3:0:default:vt100at:/bin/login
+ ^
+
+3.6 X Server debug diagnostics output and other VT peculiarities
+
+The XFree86 X servers will produce a lot of diagnostics output on stderr dur-
+ing startup. This output will be lost after the server reached a certain
+point in its console initialization process. You should redirect stdout and
+stderr if you want to analyze the diagnostics produced by the server.
+
+When the X server is running output made to other consoles will be lost.
+After server shutdown the screen contents of other consoles may be inconsis-
+tent with what one would expect (i.e. random).
+
+4. Installing XFree86 manual pages
+
+LynxOS uses cat-able manual pages, and because a doc preparation system is
+definitely not a vital component of a real-time operating system you must
+first install groff-1.09 (or newer). Starting with LynxOS 2.3.0 it should
+compile right out of the box (or better tar archive).
+
+XFree86 manual pages may be installed using
+
+ make install.man
+
+The index and whatis database for the XFree86 manual pages will be created
+automatically. If you already have a whatis database or index file in the
+destination directories you should perform a sort/uniq operation to remove
+duplicate entries:
+
+ for i in 1 3 5
+ do
+ rm -f /tmp/tmpfile
+ sort /usr/X11R6/man/cat$i/LIST$i | uniq > /tmp/tmpfile
+ mv /tmp/tmpfile /usr/X11R6/man/cat$i/LIST$i
+ done
+ sort /usr/X11R6/man/whatis | uniq > /tmp/tmpfile
+ mv /tmp/tmpfile /usr/X11R6/man/whatis
+
+With LynxOS 2.3.0 you should include /usr/X11R6/man in the MANPATH environ-
+ment variable.
+
+ bash: MANPATH=$MANPATH:/usr/X11R6/man
+
+The man command of LynxOS 2.2.1 does not support the MANPATH environment
+variable properly. The XFree86 manual pages must be copied (or linked) to the
+standard manual page locations (/usr/man/catx) in order to be read the man
+command:
+
+ for i in 1 3 5
+ do
+ ln -s /usr/X11R6/man/cat$i/*.* /usr/man/cat$i
+ cat /usr/X11R6/man/cat$i/LIST$i >> /usr/man/cat$i/LIST$i
+ sort -o /usr/man/cat$i/LIST$i /usr/man/cat$i/LIST$i
+ cat /usr/X11R6/man/cat$i/whatis$i >> /usr/man/whatis
+ done
+
+5. Using XFree86 with Motif
+
+The Motif libraries shipped with LynxOS AT 2.3.0 and 2.4.0 can be used with
+the XFree86 libraries. Follow the steps outlined below after you have
+installed XFree86 and LynxOS Motif on your system.
+
+5.1 Copy Motif files
+
+You must create symbolic links for the Motif libraries and utilities in the
+/usr/X11R6 directory tree.
+
+ ln -s /usr/bin/X11/uil /usr/X11R6/bin
+ ln -s /usr/lib/libUil.a /usr/X11R6/lib
+ ln -s /usr/lib/libMrm.a /usr/X11R6/lib
+ ln -s /usr/lib/libXm.a /usr/X11R6/lib
+ ln -s /usr/lib/X11/uid /usr/X11R6/lib/X11
+ ln -s /usr/include/Xm /usr/X11R6/include
+ ln -s /usr/include/Mrm /usr/X11R6/include
+ ln -s /usr/include/uil /usr/X11R6/include
+
+The Motif imake-configuration files are part of the LynxOS X Window package.
+They must be copied to the /usr/X11R6 directory tree.
+
+ cp /usr/lib/X11/config/Motif.* /usr/X11R6/lib/X11/config
+
+5.2 Motif library patch for LynxOS AT 2.3.0
+
+The XFree86 libraries are compiled with the -mposix compiler option while the
+Motif libraries shipped with LynxOS AT 2.3.0 are not. This incompatibility
+will cause Motif XmFileSelection widgets to be linked with the wrong (i.e.
+POSIX) directory routines. To circumvent this problem apply the following
+patch to the library:
+
+ cp /usr/lib/libXm.a /usr/X11R6/lib
+ ar x /usr/X11R6/lib/libXm.a Xmos.o
+ ar x /lib/libc.a directory.s.o
+ ld -r -o x.o Xmos.o directory.s.o
+ mv x.o Xmos.o
+ ar r /usr/X11R6/lib/libXm.a Xmos.o
+
+This patch is not necessary for LynxOS revisions after 2.3.0.
+
+5.3 X11R6 config file patch
+
+Edit /usr/X11R6/lib/X11/config/lynx.cf and change the definition of HasMotif
+from
+
+ #define HasMotif NO
+
+to
+
+ #define HasMotif YES
+
+5.4 Motif config file patch
+
+The file Motif.tmpl shipped with LynxOS Motif must be modified to work with
+XFree86. In every reference to UnsharedLibReferences the first argument must
+be changed from
+
+ UnsharedLibReferences(<Something>LIB, Arg2, Arg3)
+
+to
+
+ UnsharedLibReferences(<Something>, Arg2, Arg3)
+
+Be sure to apply the change to the file copied to /usr/X11R6/lib/X11/config.
+
+6. Compiling the XFree86 Distribution
+
+Before trying to rebuild XFree86 from source read Building XFree86 for a
+detailed description of the build process. The next sections contain LynxOS
+specific notes with respect to the build process.
+
+6.1 Disk space requirements
+
+Currently there is no support for shared libraries in the LynxOS XFree86
+port. A complete binary installation along with manual pages will require
+approximately 90-100 MBytes of disk space. To compile the system you will
+need at least 230 MBytes of free disk space.
+
+6.2 Changes to system environment (LynxOS AT)
+
+Before compiling the XFree86 distribution you will have to make a few little
+adjustments to your system:
+
+ LynxOS AT 2.5
+
+ o Create a shell script named /lib/cpp as follows:
+
+ #!/bin/sh
+ /usr/lib/gcc-lib/i386-unknown-lynxos2.5/2.7-96q1/cpp \
+ -traditional "$@"
+
+ On other platforms than the AT the paths for the compiler
+ support programs are different. You may use
+
+ gcc -v
+
+ to find out the correct path. Set the file mode of /lib/cpp
+ with
+
+ # chown root /lib/cpp
+ # chmod 755 /lib/cpp
+
+ o Modify /lib/liblynx.a. The X servers need the smem_create()
+ system call to map the frame buffer into their address
+ space. The system call is in liblynx library along with
+ other Lynx proprietary calls which (unfortunately) overlap
+ with calls in libc. To reduce confusion you should modify
+ liblynx as follows:
+
+ # mv /lib/liblynx.a /lib/liblynx.a.ORG
+ # mkdir /tmp/xx; cd /tmp/xx
+ # ar xv /lib/liblynx.a.ORG
+ # ar rv /lib/liblynx.a *smem*
+ # ranlib /lib/liblynx.a
+
+ LynxOS AT 2.4
+
+ o Use the CYGNUS GNU-C Compiler to build XFree86. With LynxOS
+ 2.4.0 you must execute the shell script /CYGNUS.bash to
+ apply the necessary changes to your environment.
+
+ o Create a shell script named /lib/cpp as follows:
+
+ #!/bin/sh
+ /cygnus/94q4-lynxos-x86/lib/gcc-lib/i386-lynx/2.6-94q4/cpp \
+ -traditional "$@"
+
+ It is possible that future releases use a different path for
+ the CYGNUS compiler support programs. You may use
+
+ gcc -v
+
+ to find out the correct path. Set the file mode of /lib/cpp
+ with
+
+ # chown root /lib/cpp
+ # chmod 755 /lib/cpp
+
+ LynxOS AT 2.3
+ This has actually not been tested, but the steps for described
+ for 2.4 should apply to 2.3 as well.
+
+ LynxOS AT 2.2.1
+ This has actually never been tested, be prepared that the build
+ will fail somewhere!
+
+ o Create a shell script named /lib/cpp as follows:
+
+ #!/bin/sh
+ /usr/local/lib/gcc-cpp -traditional "$@"
+
+ o The loader /bin/ld of LynxOS 2.2.1 does not support the -L
+ option which is heavily used by X11R6 makefiles. To work
+ around this problem you must install a small wrapper program
+ which replaces the original /bin/ld program. Use the follow-
+ ing steps to install it:
+
+ # cd xc/programs/Xserver/hw/xfree/etc
+ # cc -o ld ld-wrapper.c
+ # mv /bin/ld /bin/ld.org
+ # mv ld /bin/ld
+ # chmod 511 /bin/ld
+ # chown root /bin/ld
+
+ o Modify system header files as follows:
+
+ /usr/include/uio.h
+ surrounded by
+
+ #ifndef _UIO_H
+ #define _UIO_H
+ ...
+ #endif
+
+ /usr/include/utmp.h
+ surrounded by
+
+ #ifndef _UTMP_H
+ #define _UTMP_H
+ ...
+ #endif
+
+ /usr/include/unistd.h
+ add
+
+ extern int read();
+
+6.3 make World
+
+Read Building XFree86 before trying to rebuild XFree86 from the source dis-
+tribution.
+
+You may then issue a
+
+ make World
+
+to compile XFree86. After a few hours (and hopefully a successful build of
+the XFree86 system) you can install the software using
+
+ make install
+
+You must be logged in as super-user (root) when you invoke `make install'.
+Be sure to set your environment to use the same compiler (LynxOS 2.3.0/2.4.0,
+CYGNUS GNU-C) as you did during the `make World'. To install the LinkKit use
+
+ make install.linkkit
+
+With LynxOS 2.2.1 programs will not be stripped during installation. This is
+due to a problem with the strip program which shows up when installing across
+file system boundaries.
+
+Refer to section Installing XFree86 manual pages (section 4., page 1) for
+manual page installation.
+
+On LynxOS AT 2.5.0 you may encounter problems with make in deeply nested sub-
+directories (eg core dumps, hangups). In this case update to GNU make version
+3.75 or higher.
+
+7. Building on microSPARC and PowerPC
+
+XFree86 3.3 compiles on LynxOS microSPARC and on LynxOS PPC as well. On the
+microSPARC there is X server support for the colour frame buffers CG3 and CG6
+while on the PPC there is no X server available at this time. Before you
+start the build (on versions earlier than 2.5.0) you must create a symbolic
+link from the CYGNUS gcc to a file named cc somewhere in a directory included
+in your PATH environment variable.
+
+7.1 Console driver patch for microSPARC
+
+Before building on the microSPARC you should install the patch for the con-
+sole driver supplied in xc/programs/Xserver/hw/sunLynx/patch.Console.
+(xc/programs/Xserver/hw/sunLynx/patch.Console-2.4.0 for LynxOS revisions ear-
+lier than 2.5.0). The patch fixes minor problems in the original LynxOS
+driver and adds functionalities to detect the keyboard type and control the
+key click. To create a backup of the original driver and install the patch
+issue the commands
+
+ # cd /
+ # tar cf /sys/drivers/console.tar /sys/drivers/console
+ # patch -p -E < xc/programs/Xserver/hw/sunLynx/patch.Console
+ # cd /sys/drivers/console
+ # make install
+ # cd /sys/lynx.os
+ # make install
+ # reboot -a
+
+If you opt not to install the patch you must edit xc/config/cf/lynx.cf and
+change the definition of SparcConsoleDefines from
+
+ #define SparcConsoleDefines -DPATCHED_CONSOLE
+
+to
+
+ #define SparcConsoleDefines /* -DPATCHED_CONSOLE */
+
+7.2 Known Bug of the microSPARC server
+
+On the first start of the X server on the microSPARC you will notice that the
+pointer follows mouse movements with a certain delay (especially if you're
+moving the mouse real fast). You will also notice that moving windows with
+certain window managers (eg mwm) is not working correctly. These effects
+should go away on the next server start.
+
+The server for monochrome cards builds properly if you enable it in lynx.cf
+but it has never been tested (reports are welcome).
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LynxOS.sgml,v 3.17 1999/08/23 06:38:47 dawes Exp $
+
+ $XConsortium: LynxOS.sgml /main/10 1996/10/28 05:13:07 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.23 1999/08/23 07:03:42 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.MGA b/xc/programs/Xserver/hw/xfree86/doc/README.MGA
new file mode 100644
index 000000000..2b98be35c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.MGA
@@ -0,0 +1,198 @@
+ Information for Matrox Users
+
+ The XFree86 Project Inc.
+
+ 30 December 1998
+
+1. Supported hardware
+
+The current MGA driver in the SVGA server supports
+
+ o Matrox Millennium (MGA2064W with Texas Instruments TVP3026 RAMDAC). It
+ has been tested with 175, 220MHz, and 250MHz cards with 2MB, 4MB and 8MB
+ WRAM.
+
+ o Millennium II both PCI and AGP (MGA2164W with Texas Instruments TVP3026
+ RAMDAC). It has been tested with 4 MB, 8 MB and 16 MB WRAM.
+
+ o Matrox Mystique (Both MGA1064SG and MGA1164SG with integrated RAMDACs)
+ 170 MHz and 220 MHz (Mystique 220) versions should work.
+
+ o Millennium G200 with SGRAM and SDRAM (Millennium G200-SD), with 8MB RAM.
+
+ o Mystique G200 (but no TVout support)
+
+ o Productiva G100 with SGRAM and SDRAM. 4MB and 8MB versions have been
+ tested.
+
+ o Matrox G400 (only the first head and no TVout support).
+
+1.1 What's not supported
+
+ o Chipsets other than those listed above. We are still interested in
+ providing support for the other Matrox chipsets including the Impres-
+ sion, Atlas, Genesis etc... but at this time have not been able to
+ obtain documentation for them.
+
+ o MGA2064W and MGA2164W based cards with ramdacs other than the TVP3026
+ RAMDAC (like the Matrox Corona) are not supported.
+
+2. Features:
+
+ o uses linear frame buffer
+
+ o Resolutions up to the maximum supported by the card should be possible.
+
+ o 8 bpp, 16 bpp (depth 15 and 16), 24 bpp (depth 24, packed) and 32 bpp
+ (depth 24, sparse) are all supported.
+
+ o supports VESA Display Power Management Signaling (DPMS)
+
+ o supports RGB Sync-on-Green
+
+ o supports the XF86_DGA extension
+
+ o Makes extensive use of the graphics accelerator. This server is very
+ well accelerated, and is one of the fastest XFree86 X servers.
+
+3. Configuration:
+
+The MGA driver should auto-detect all supported hardware so you needn't have
+anything other than the Identifier in the Section "Device" of the XF86Config
+file. When running the XF86Setup or xf86config programs one merely needs to
+select a Matrox card so that the correct server will be used. One need not
+and should not specify a RAMDAC, clockchip or allow the setup program to
+probe for clocks. The driver will auto-detect the amount of video ram pre-
+sent, however, due to some hardware problems this is not detected for the
+MGA2164W (Millennium II) or G100/G200. In this case users should specify the
+amount of video ram in the Section "Device" of the XF86Config file. eg:
+
+ VideoRam 4096
+ or
+ VideoRam 8192
+ or
+ VideoRam 16384
+
+as appropriate so that the server doesn't have to probe for it.
+
+The following Section "Device" options are supported by the MGA driver:
+
+ o Option "sw_cursor"
+
+ Will disable the hardware cursor on the Millennium and Millennium II.
+
+ o Option "no_accel"
+
+ Will disable all hardware acceleration (oh my!).
+
+ o Option "no_pixmap_cache"
+
+ Will disable caching of pixmaps in offscreen video memory.
+
+ o Option "sync_on_green"
+
+ Will enable syncing on green for sync-on-green monitors (these are typi-
+ cally fixed frequency workstation monitors).
+
+ o Option "pci_retry"
+
+ This will allow the MGA hardware to generate a pci_disconnect based on
+ accelerator FIFO status. This can yield large performance boosts for
+ some graphics operations but has a tendency to hog the PCI bus so it is
+ turned off by default.
+
+ o Option "mga_sdram"
+
+ This will force the server to disable sgram features such as block mode
+ fills and hardware planemasks.
+
+4. Known solutions for some problems:
+
+ o Temporary loss of monitor sync when the cursor shape changes on Millen-
+ nium and Millennium II. The hardware cursor has been enabled by default
+ in 3.3.3.1. This seems to cause some problems on a minority of systems.
+ If you experience problems with this on your system, please put:
+
+ Option "sw_cursor"
+
+ in the Section "Device" of the XF86Config file to disable the hardware
+ cursor.
+
+ o Garbage in the cursor instead of the normal cursor image. A bug in the
+ driver will cause this when less than 1K of video memory is left unused
+ and the hardware cursor is enabled for some cards. If you experience
+ this problem, please put:
+
+ Option "sw_cursor"
+
+ in the Section "Device" of the XF86Config file to disable the hardware
+ cursor. This should be fixed in XFree86 3.3.3.1 as in cases like this
+ the software cursor should be used automatically.
+
+ o the driver doesn't support some values of HTotal parameter in Modelines
+ in the XF86Config file. If you get flickering vertical stripes on the
+ screen, try to change this parameter +/- 8.
+
+ o On some Millennium II cards the driver shows severe distortions with
+ 24bpp in modes above about 1024x768. We hope to have automated the
+ detection and fix of this problem. If it still occurs, putting
+
+ Option "mga_24bpp_fix"
+
+ in the Device Section may fix the problem.
+
+ o On some MGA cards the amount of memory is mis-detected, on others prob-
+ ing for the amount of memory can cause a lockup in the system so memory
+ probing is not done on those hardware (Millennium II, G100/G200). If
+ the default of 4MB RAM (Millennium II) or 8MB RAM (G100/G200) is not
+ correct, specify the amount of video ram in the Section "Device" of the
+ XF86Config file as described in section 3 above.
+
+ o If you Millennium II card that worked fine with XFree86-3.3.2.3 and ear-
+ lier now shows pixel errors and strange effects when returning to the
+ text console, make sure that the amount of memory that the server
+ reports is correct. See item above for details.
+
+ o With virtual screens that use 8MB of memory or more (e.g., 2048x2048 at
+ 16bpp) there can be cursor distortions when panning the screen verti-
+ cally. If that occurs, please put
+
+ Option "sw_cursor"
+
+ in the Section "Device" of the XF86Config file to disable the hardware
+ cursor.
+
+5. Authors
+
+Radoslaw Kapitan, kapitan@student.uci.agh.edu.pl
+
+Mark Vojkovich, mvojkovi@sdcc10.ucsd.edu
+
+and:
+
+ o Andrew Vanderstock, vanderaj@mail2.svhm.org.au
+
+ o Angsar Hockmann, Ansgar.Hockmann@hrz.uni-dortmund.de
+
+ o Michael Will, Michael.Will@student.uni-tuebingen.de
+
+ o Andrew Mileski, aem@ott.hookup.net
+
+ o Stephen Pitts, pitts2@memphisonline.com
+
+ o Dirk Hohndel, hohndel@XFree86.Org
+
+ o Leonard N. Zubkoff, lnz@dandelion.com
+
+ o Harm Hanemaayer, H.Hanemaayer@inter.nl.net
+
+ o Guy Desbief, g.desbief@aix.pacwan.net
+
+ o Takaaki Nomura, tnomura@sfc.keio.ac.jp
+
+ o Doug Merritt, doug@netcom.com
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/MGA.sgml,v 3.8 1999/08/23 06:38:47 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.MGA,v 3.11 1999/08/23 07:03:43 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NV1 b/xc/programs/Xserver/hw/xfree86/doc/README.NV1
new file mode 100644
index 000000000..47bc43707
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.NV1
@@ -0,0 +1,42 @@
+ Information for NVidia NV1 / SGS-Thomson STG2000 Users
+
+ David McKay
+
+ 20th March 1997
+
+1. XFree driver for NVidia NV1 / SGS-Thomson STG2000 v1.0
+
+This driver now accelerates bitblits and filled rectangles. It also support a
+hardware cursor. More graphic acceleration is planned. There is no plan to
+support the audio functionality of the chip.
+
+1.1 Notes
+
+ o THE DRIVER DOES NOT SUPPORT THE VIRTUAL DESKTOP FEATURES OF XFREE86 This
+ is because the NV1 does not have the necessary hardware to support this
+ feature. If you want to change resolutions, you will have to modify your
+ config file. Comment out all but the mode you wish to use.
+
+ o The generic VGA16 server will not work with the NV1. For this reason
+ XF86Setup cannot be used to configure the server. Use xf86config
+ instead. Select `Diamond Edge 3D' as your board, and select only ONE
+ mode for each of 8bpp and 16bpp. Do not select a virtual desktop.
+ Also, make sure you don't select a RAMDAC or clock chip.
+
+ o The NV1 only supports a 555 RGB Weight in 16 bpp, the hardware does not
+ do 565. You must put a Weight 555 in the Display section.
+
+ o 24/32 bpp mode is not yet supported.
+
+1.2 Known Bugs
+
+ o The driver should force Weight 555 in 16 bpp mode
+
+ o The hardware cursor doesn't work if an doublescan mode is selected.
+
+ o Screen blanking doesn't work, nor does DPMS.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NV1.sgml,v 3.3 1997/03/22 09:35:30 hohndel Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NV1,v 3.7 1999/04/15 03:34:51 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NVIDIA b/xc/programs/Xserver/hw/xfree86/doc/README.NVIDIA
new file mode 100644
index 000000000..ea346605c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.NVIDIA
@@ -0,0 +1,57 @@
+ Information for NVidia NV1 / SGS-Thomson STG2000, Riva 128 and Riva TNT and
+ TNT2 Users
+
+ David McKay, Dirk Hohndel
+
+ June 25 1999
+
+1. Supported hardware
+
+This driver supports good acceleration for the NV1/STG2000 as well as the
+Riva128, Riva TNT and Riva TNT2.
+
+2. Notes
+
+ o On the NV1/STG2000, the driver does not support the virtual desktop fea-
+ tures of xfree86. This is because the NV1 does not have the necessary
+ hardware to support this feature. If you want to change resolutions, you
+ will have to modify your config file. Comment out all but the mode you
+ wish to use.
+
+ o The generic VGA16 server will not work with the NV1. For this reason
+ XF86Setup cannot be used to configure the server for NV1 based cards.
+ Use xf86config instead. Select `Diamond Edge 3D' as your board, and
+ select only ONE mode for each of 8bpp and 16bpp. Do not select a vir-
+ tual desktop. Also, make sure you don't select a RAMDAC or clock chip.
+ This does not apply if you own a Riva128 or RIVA TNT card, as the VGA16
+ server works just fine on that.
+
+ o Both the NV1 and the Riva128 only support a 555 RGB Weight in 16 bpp,
+ the hardware does not do 565. If you run into problems with some window
+ managers in 16bpp, try putting a Weight 555 in the Display section.
+
+ o 24 bpp is not supported.
+
+ o In some modes the hardware cursor gets out of sync with the display.
+ Use Option "sw_cursor" to work around this problem.
+
+ o There are modelines that confuse the Riva128 chip. This results in a
+ greenish display. Slightly modifying the modeline usually fixes the
+ problem. In most cases all that is needed is to reduce the HTotal. You
+ can use xvidtune to do that.
+
+ o The low maximum dot clocks for the Riva 128 have been fixed. The driver
+ should now utilize the Riva 128 to its full capabilities.
+
+3. Authors
+
+ o David McKay
+
+ o David Schmenk <dschmenk@nvidia.com>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NVIDIA.sgml,v 1.2 1999/08/23 06:18:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NVIDIA,v 1.3 1999/08/23 07:03:43 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD
new file mode 100644
index 000000000..1e8cf6280
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD
@@ -0,0 +1,489 @@
+ README for XFree86 on NetBSD
+
+Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb
+
+ Last modified on: 25 June 1999
+
+1. What and Where is XFree86?
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes. The release is available as source patches
+against the X Consortium X11R6.3 code, as well as binary distributions for
+many architectures.
+
+See the Copyright Notice.
+
+The sources for XFree86 are available by anonymous ftp from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current
+
+Binaries for NetBSD 1.2 are available from:
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/NetBSD-1.2
+
+Binaries for NetBSD 1.4 and later are available from:
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/NetBSD-1.4
+
+A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR-
+RORS
+
+Other NetBSD versions:
+
+These binaries are not compatible with earlier NetBSD versions. If you're
+still running NetBSD 0.9, 1.0 or 1.1, you should think about upgrading to a
+newer version of NetBSD first.
+
+If you don't upgrade, you'll have to build XFree86 from the sources. XFree86
+should compile cleanly under earlier versions of NetBSD, although this has
+not been tested.
+
+XFree86 also builds on NetBSD/sparc. See section Building on other architec-
+tures (section 8.5, page 1) for details.
+
+The client side of XFree86 also builds on NetBSD/alpha and many other archi-
+tecture supported by NetBSD.
+
+XFree86 also supports NetBSD on PC98 machines.
+
+2. Bug Reports for This Document
+
+Send email to matthieu@laas.fr (Matthieu Herrb) or XFree86@XFree86.org if you
+have comments or suggestions about this file and we'll revise it.
+
+3. New features in this release
+
+ o The maximum number of open connections in the server has been raised to
+ 128,
+
+ o support for the wsmouse mouse protocol included in NetBSD 1.4 has been
+ added.
+
+See the Release Notes for non-OS dependent new features in XFree86 3.3.4.
+
+4. Installing the Binaries
+
+Refer to section 5 of the Release Notes for detailed installation instruc-
+tions.
+
+5. Configuring X for Your Hardware
+
+The /etc/XF86Config file tells the X server what kind of monitor, video card
+and mouse you have. You must create it to tell the server what specific
+hardware you have.
+
+The easiest way to create this file is to run the XF86Setup utility as root.
+Refer to QuickStart.doc for details about its use.
+
+You'll need info on your hardware:
+
+ o Your mouse type, baud rate and its /dev entry.
+
+ o The video card's chipset (e.g. ET4000, S3, etc).
+
+ o Your monitor's sync frequencies.
+
+The recommended way to generate an XF86Config file is to use the XF86Setup
+utility. The xf86config text utility is still there for the (few) cases
+where XF86Setup can't be used. Also, there is a sample file installed as
+/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point.
+
+For details about the XF86Config file format, refer to the XF86Config(5) man-
+ual page.
+
+Once you've set up a XF86Config file, you can fine tune the video modes with
+the xvidtune utility.
+
+5.1 About mouse configuration
+
+If your serial mouse does not work try using kermit or tip to connect to the
+mouse serial port and verify that it does indeed generate characters.
+
+The NetBSD pms mouse driver handles PS/2 style mice as Busmouse. Specify the
+protocol as ``busmouse'' in the mouse section of your XF86Config file if
+you're using a PS/2 mouse.
+
+Only standard PS/2 mice are supported by this driver. Newest PS/2 mice that
+send more than three bytes at a time (especially Intellimouse, or MouseMan+
+with a ``3D'' roller) are not supported yet.
+
+XFree86 3.3.4 also has support for the mouse driver included in the new
+wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the
+protocol and ``/dev/wsmouse0'' as the device in /etc/XF86Config if you're
+using NetBSD 1.4 with wscons.
+
+See README.mouse for general instruction on mouse configuration in XFree86.
+
+5.2 Other input devices
+
+XFree86 supports the dynamic loading of drivers for external input devices
+using the XInput extension. Currently supported devices are:
+
+ o Joystick (xf86Jstk.so)
+
+ o Wacom tablets (Wacom IV protocol only, xf86Wacom.so)
+
+ o SummaSketch tablets (xf86Summa.so)
+
+ o Elographics touchscreen (xf86Elo.so)
+
+To use a specific device, add the line
+
+ load "module"
+
+in the Module section of XF86Config, where module is the name of the .so file
+corresponding to your device. You also need to set up a XInput section in
+XF86Config. Refer to the XF86Config(5) man page for detailed configuration
+instructions.
+
+You can then change the device used to drive the X pointer with the xset-
+pointer(1) command.
+
+For joystick support, you'll need to install the joystick device driver in
+the kernel. It is included in NetBSD 1.2. See joy(4) for details.
+
+5.3 Configuring PEX and XIE extensions
+
+The PEX and XIE extensions are supported as external modules. If you want
+to have access to these extensions, add the following lines to the Module
+section of XF86Config:
+
+ load "pex5.so"
+ load "xie.so"
+
+6. Running X
+
+8mb of memory is a recommended minimum for running X. The server, window
+manager and an xterm take about 4 Mb of memory themselves. On a 4Mb system
+that would leave nothing left over for other applications like gcc that
+expect a few meg free. X will work with 4Mb of memory, but in practice com-
+pilation while running X can take 5 or 10 times as long due to constant pag-
+ing.
+
+The easiest way for new users to start X windows is to type:
+
+ startx >& startx.log
+
+Error messages are lost unless you redirect them because the server takes
+over the screen.
+
+To get out of X windows, type: ``exit'' in the console xterm. You can cus-
+tomize your X by creating .xinitrc, .xserverrc, and .twmrc files in your home
+directory as described in the xinit and startx man pages.
+
+6.1 Starting Xdm, the display manager
+
+To start the display manager, log in as root on the console and type: ``xdm
+-nodaemon''.
+
+You can start xdm automatically on bootup by disabling the console getty and
+adding the following code to /etc/rc.local:
+
+ if [ -x /usr/X11R6/bin/xdm ]; then
+ echo -n ' xdm'; /usr/X11R6/bin/xdm
+ fi
+
+To disable the console getty, change ``on'' to ``off'' in the console entry
+in /etc/ttys:
+
+ ttyv0 "/usr/libexec/getty Pc" pc off secure
+
+Under NetBSD 1.4 with the wscons console driver, you must enable a virtual
+console for the X server first. To do this follow these steps:
+
+ o Make sure the device file exists. If not, ``cd /dev ; ./MAKEDEV
+ wscons''.
+
+ o Next, make sure your kernel wants to do wscons. (see below (section 7.1,
+ page 1)).
+
+ o Next, make sure ``wscons=YES'' in /etc/rc.conf.
+
+ o Next, make sure /etc/wscons.conf exists. The relevant bits:
+
+ #screen 0 - vt100
+ screen 1 - vt100
+ screen 2 - vt100
+ screen 3 - vt100
+ screen 4 - -
+ screen 5 - vt100
+
+(Thanks to Mason Loring Bliss <mason@acheron.middleboro.ma.us> for this
+explanation)
+
+Note that the binary distributions of XFree86 for NetBSD don't include sup-
+port for the XDM-AUTHORIZATION-1 protocol.
+
+7. Kernel Support for X
+
+To make sure X support is enabled under NetBSD, the following line must be in
+your config file in /sys/arch/i386/conf:
+
+ options XSERVER, UCONSOLE
+
+7.1 Console drivers
+
+The server supports the standard NetBSD/i386 console drivers: pccons, pcvt
+and wscons (in pcvt compatibility mode). They are detected at runtime and no
+configuration of the server itself is required.
+
+The pccons driver is the most widely tested and is the console driver con-
+tained in the NetBSD binary distribution's kernels.
+
+The pcvt console driver is bundled with NetBSD. The pcvt X mode is compatible
+with the pccons driver X mode. It offers several virtual consoles and inter-
+national keyboard support. In order to use this driver, change the line:
+
+ device pc0 at isa? port "IO_KBD" irq 1
+
+to
+
+ device vt0 at isa? port "IO_KBD" irq 1
+
+in your kernel config file, and rebuild and install your kernel.
+
+XFree86 will also run with the wscons console driver in NetBSD 1.4. For now,
+it uses the pcvt compatibility mode, so be sure to have the lines:
+
+ options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
+ options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
+ options WSDISPLAY_COMPAT_USL # VT handling
+ options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
+
+in your kernel configuration file if you're using wscons. Refer to the
+wscons(4) and wsmouse(4) manual pages for informations on how to configure
+wscons into the kernel.
+
+7.2 Aperture Driver
+
+By default NetBSD 0.9C and higher include the BSD 4.4 kernel security feature
+that disable access to the /dev/mem device when in multi-users mode. But
+XFree86 servers can take advantage (or require) linear access to the display
+memory.
+
+Moset recent accelerated servers require linear memory access, some other can
+take advantage of it, but do not require it.
+
+There are two ways to allow XFree86 to access linear memory:
+
+The first way is to disable the kernel security feature by adding `option
+INSECURE' in the kernel configuration file and build a new kernel.
+
+The second way is to install the aperture driver: You can get the aperture
+driver sources from ftp://ftp.netbsd.org/pub/NetBSD/arch/i386/apNetBSD.shar.
+
+How to activate it is highly dependent from your exact operating system ver-
+sion:
+
+ o NetBSD 1.0, 1.1, 1.2, 1.2.1:
+
+ Add the following lines to the end of /etc/rc.local:
+
+ KERNDIR=/usr/X11R6/lib/X11/kernel
+ if [ -f ${KERNDIR}/ap.o ]; then
+ modload -o ${KERNDIR}/ap -e ap -p ${KERNDIR}/apinstall ${KERNDIR}/ap.o
+ fi
+
+ o NetBSD 1.2D and later
+
+ Add the following line to /etc/lkm.conf:
+
+ /usr/X11R6/lib/X11/kernel/ap.o - ap /usr/X11R6/lib/X11/kernel/apinstall -
+
+ o NetBSD 1.2G, 1.3 and later
+
+ The lkm.conf format changed in 1.2G. Add the following line to
+ /etc/lkm.conf:
+
+ /usr/X11R6/lib/X11/kernel/ap.o - ap /usr/X11R6/lib/X11/kernel/apinstall - -AFTERMOUNT
+
+Reboot your system. XFree86 will auto-detect the aperture driver if avail-
+able.
+
+Warning: if you boot another kernel than /netbsd or /bsd, loadable kernel
+modules can crash your system. Always boot in single user mode when you want
+to run another kernel.
+
+ Caveat: the aperture driver only allows one access at a time (so
+ that the system is in the same security state once X is launched).
+ This means that if you run multiple servers on multiples VT, only
+ the first one will have linear memory access. Use 'option INSE-
+ CURE' if you need more that one X server at a time.
+
+7.3 MIT-SHM
+
+NetBSD 1.0 and later supports System V shared memory. If XFree86 detects this
+support in your kernel, it will support the MIT-SHM extension.
+
+To add support for system V shared memory to your kernel add the lines:
+
+ # System V-like IPC
+ options SYSVMSG
+ options SYSVSEM
+ options SYSVSHM
+
+to your kernel config file.
+
+8. Rebuilding the XFree86 Distribution
+
+The server link kit allow you to rebuild just the X server with a minimum
+amount of disk space. Just unpack it, make the appropriate changes to the
+xf86site.def, type ``./mkmf'' and ``make'' to link the server. See
+/usr/X11R6/lib/Server/README for more info.
+
+See INSTALL for instructions on unbundling and building the source distribu-
+tion.
+
+You should configure the distribution by editing xc/config/cf/host.def
+before compiling. To compile the sources, invoke ``make World'' in the xc
+directory.
+
+8.1 Console drivers
+
+XFree86 has a configuration option to select the console drivers to use in
+xf86site.def:
+
+ o if you're using pccons put:
+
+ #define XFree86ConsoleDefines -DPCCONS_SUPPORT
+
+ o if you're using pcvt put:
+
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT
+
+ o if you're using syscons put:
+
+ #define XFree86ConsoleDefines -DSYSCONS_SUPPORT
+
+ o if you're running codrv put:
+
+ #define XFree86ConsoleDefines -DCODRV_SUPPORT
+
+If you don't define XFree86ConsoleDefines in xf86site.def the pccons and pcvt
+drivers will be supported by default.
+
+Syscons and codrv are not bundled with NetBSD. They are available by anony-
+mous FTP from a number of sites. They are not supported by the XFree86 binary
+distribution anymore.
+
+8.2 pcvt_ioctl.h file:
+
+XFree86's default configuration includes support for the PCVT console driver.
+Unfortunately, NetBSD versions before 19980413 don't install the pcvt_ioctl.h
+file in /usr/include/machine. If you want to build XFree86 with PCVT support,
+execute the following command as root before starting make World:
+
+ cp /usr/src/sys/arch/i386/isa/pcvt/pcvt_ioctl.h /usr/include/machine
+
+If you don't have kernel sources, you can grab this file from ftp.netbsd.org
+or one of its mirrors. If you're not running PCVT, you can remove -DPCVT_SUP-
+PORT from XFree86ConsoleDefines in xf86site.def too.
+
+8.3 console.h and ioctl_pc.h files:
+
+If you want to build a server supporting codrv and you don't already have the
+corresponding header file ioctl_pc.h installed in /usr/include/machine, then
+install the copy that is supplied in xc/programs/Xserver/hw/xfree86/etc. If
+you run NetBSD-current you probably want to install it in
+/usr/src/sys/arch/i386/include too, so that it get reinstalled each time you
+run make includes.
+
+If you have installed the codrv console driver, this file should be taken
+from your installed version of the driver.
+
+The console.h file for syscons isn't distributed with XFree86 anymore. You
+should get it from the syscons distribution.
+
+8.4 Support for shared libs under NetBSD 1.0 and later
+
+By default XFree86 builds for NetBSD with shared libraries support. If you're
+building on 0.9 or don't want shared libraries add the following line to
+host.def:
+
+ #define BuildBsdSharedLibs NO
+
+8.5 Building on other architectures
+
+XFree86 also compiles on NetBSD/sparc. The Sun server patches from Dennis
+Ferguson and Matthew Green have been integrated in xc/pro-
+grams/Xserver/hw/sun. Small modifications to xf86site.def are needed:
+
+ o Set all variables defining the servers to build to NO. (The variables
+ controlling the Sun servers to build Xsun24Server, XsunServer and Xsun-
+ MonoServer are defined at the end of NetBSD.cf.)
+
+ o Set ServerToInstall to the sun server of your choice. (Xsun or Xsun-
+ Mono).
+
+ o Look at other applicable options in the INSTALL document.
+
+Problems with this port should be reported to the port-sparc@NetBSD.Org mail-
+ing list or directly to me matthieu@laas.fr rather than to the xfree86 mail-
+ing list.
+
+Note that the NetBSD project has now its own source tree, based on the
+XFree86 source tree, with some local modifications. You may want to start
+with this tree to rebuild from sources. The NetBSD xsrc source tree is
+available at: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/xsrc/
+
+9. Building New X Clients
+
+The easiest way to build a new client (X application) is to use xmkmf if an
+Imakefile is included in the sources. Type ``xmkmf -a'' to create the Make-
+files, check the configuration if necessary and type ``make''. Whenever you
+install additional man pages you should update whatis.db by running ``make-
+whatis /usr/X11R6/man''.
+
+To avoid the ``Virtual memory exhausted'' message from cc while compiling,
+increase the data and stack size limits (in csh type ``limit datasize 32M''
+and ``limit stacksize 16M'').
+
+Note: Starting with XFree86 2.1 and NetBSD 0.9A, the symbol __386BSD__ no
+longer gets defined either by the compiler or via the X config files for *BSD
+systems. When porting clients to *BSD systems, make use of the symbol BSD
+for code which is truly BSD-specific. The value of the symbol can be used to
+distinguish different BSD releases. For example, code specific to the Net-2
+and later releases can use:
+
+ #if (BSD >= 199103)
+
+To ensure that this symbol is correctly defined, include <sys/param.h> in the
+source that requires it. Note that the symbol CSRG_BASED is defined for *BSD
+systems in XFree86 3.1.1 and later. This should be used to protect the
+inclusion of <sys/param.h>.
+
+For code that really is specific to a particular i386 BSD port, use
+__FreeBSD__ for FreeBSD, __NetBSD__ for NetBSD, __OpenBSD__ for OpenBSD,
+__386BSD__ for 386BSD, and __bsdi__ for BSD/386.
+
+Another note: If you get the message:
+
+ ld.so: undefined symbol _XtCvtStringToFont
+
+at run-time, you've stumbled on a semantic weakness of the NetBSD dynamic
+linker. Applications that use libXmu also need libXt. If the client uses a
+standard Imakefile, this dependency will probably by included in the Makefile
+automagically -- you'll not see the problem. Otherwise, just add ``-lXt'' to
+your library list in the Imakefile or Makefile and relink.
+
+10. Thanks
+
+Many thanks to:
+
+ o Pace Willison for providing the initial port to 386BSD.
+
+ o Amancio Hasty for fixing cursor restoration, mouse bugs and many others.
+
+ o Christoph Robitschko for fixing com.c and thus select().
+
+ o Nate Williams for the patchkit support for X.
+
+ o Rod Grimes and Jack Velte of Walnut Creek Cdrom for use of their
+ machines in preparing the FreeBSD binary release.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.49 1999/08/23 06:38:48 dawes Exp $
+
+ $XConsortium: NetBSD.sgml /main/26 1996/10/28 05:43:20 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.63 1999/08/23 07:03:44 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OS2 b/xc/programs/Xserver/hw/xfree86/doc/README.OS2
new file mode 100644
index 000000000..0b820262f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.OS2
@@ -0,0 +1,689 @@
+ README for XFree86 on OS/2
+
+ Holger Veit
+
+ Last modified on: August 1st, 1999
+
+1. Introductory Note about the release 3.3.5
+
+Before looking into this file, please check for any LATEST.OS2 files that may
+come with the binary distribution. Please also check out the following
+XFree86/OS2 WWW pages:
+
+ o http://set.gmd.de/~veit/os2/xf86os2.html
+
+ o http://set.gmd.de/~veit/os2/xf86bugs.html
+
+ o http://set.gmd.de/~veit/os2/x11os2faq.html
+
+before you claim to have found any problems.
+
+This version of the code is called XFree86/OS2 3.3.5. This is a bugfix
+release for 3.3.3.1 (3.3.4 was never released for XFree86/OS2) which also
+adds hardware support for some newer cards, including AGP boards.
+XFree86-3.3.5 contains all security fixes that were released for earlier ver-
+sions. See the RELNOTES document for details.
+
+XFree86/OS2-3.3.5 is a full, unrestricted version which does not expire, and
+for which the complete source code is available. In contrast to beta ver-
+sions, we consider this code as sufficiently stable for use by an end user.
+Since there have been numerous bugfixes, we recommend this version, even if
+you had XFree86/OS2 3.3.x before and it worked satisfyingly with your hard-
+ware. By the time 3.3.5 is released, the older version 3.3 will be withdrawn,
+and archives will be updated to this version. There may still be references
+to 3.3 or 3.3.x still in documents; these apply to 3.3.5 as well, unless oth-
+erwise noted.
+
+Previous versions have been tested in a large number of configurations and
+have been found to be working, with some bugs left, rather flawlessly.
+
+This release is almost complete (with a few exceptions) regarding the X11R6.3
+``core'' distribution. A subset of the ``contrib'' distribution is available
+from the ported software page http://set.gmd.de/~veit/os2/xf86ported.html
+
+In the past beta testing, it has been found that the software itself is
+rather stable and does not damage hardware - provided the user does not try
+to push the builtin limits and change certain configuration parameters which
+could operate the video hardware out of specs.
+
+However,
+
+ o even with a code we consider stable there is no explicit or implicit
+ warranty that certain code works correctly or works at all
+
+ o although no damage reports are known, it does not mean that it is impos-
+ sible to damage hardware with this code; some deeply hidden bugs may
+ still be present in the software.
+
+It is recommended that you backup essential data of your system before
+installing this software, but this should be your general precautions before
+ANY installation. No reports exist that a crashing X server itself actively
+destroys or modifies data, but it is possible in rare cases that the system
+is left in an unusable state (video display mode garbled or system unrespon-
+sive, not reacting to mouse or keyboard actions). If you then hard reset or
+switch off the system, file caches of the operating system might not be writ-
+ten correctly back to disk, thus causing data loss.
+
+2. What and Where is XFree86?
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes. The release is available as source patches
+against the X Consortium X11R6 code, as well as binary distributions for many
+architectures.
+
+XFree86/OS2 is the name of the implementation of XFree86 on OS/2 based sys-
+tems.
+
+See the Copyright Notice.
+
+Binaries for OS/2 Warp and Merlin are available from:
+ftp.XFree86.org:/pub/XFree86/3.3.5/OS2
+
+The WWW page http://borneo.gmd.de/~veit/os2/xf86os2.html will usually show
+more references to FTP or WWW sites to retrieve sources or binaries.
+
+Other versions:
+
+XFree86/OS2 will run on all dialects of Warp 3, including Warp "red spine
+box", Warp "blue spine box", Warp Connect, Warp Server, and Warp 4.
+
+For Warp 3 installing fixpack level 17 or later is strongly recommended.
+There have been a few reports that the installation of FP26 causes XFree86 no
+longer to work, but I am not sure about a real reason. Current fixpacks for
+Warp 3, like FP36, seem to work well also.
+
+Warp 4 may be used with or without the recent public fixpack.
+
+Please check in all cases a LATEST.OS2 file.
+
+OS/2 2.11 is not supported any longer with this release, due to lack of a
+working test environment. Consequently, OS/2 SMP 2.11 is not supported
+either. Warp Server SMP is supported, but SMP does not give significant
+advantage, other than the general speedup because of multiple processors
+working. OS/2 versions 1.X are definitely not supported and will never be.
+
+It is possible to build XFree86/OS2 from the sources. Read about this in the
+document OS2.NOTES.
+
+3. Bug Reports for This Document
+
+Send email to Holger.Veit@gmd.de (Holger Veit) or XFree86@XFree86.org if you
+have comments or suggestions about this file and we'll revise it.
+
+4. Hardware and Software Requirements
+
+4.1 Supported, Required, and Recommended Hardware
+
+ o At least a 486DX33 with 16MB RAM is required. A Pentium or Pentium Pro
+ and more main memory is recommended. A 386 or a system with 8MB or less
+ memory is an insufficient configuration.
+
+ o There are no specific requirements concerning network cards, disk types,
+ or CD ROM equipment; of course the more powerful, the better.
+
+ o Depending on the packages installed, a disk space of 20-55MB on a HPFS
+ formatted partition (or a NFS or ext2fs partition natively allowing long
+ filenames) is required. XFree86/OS2 will not run on FAT partitions.
+
+ o You need a video card that is supported by XFree86. Refer to the general
+ README document for a list of supported cards. Note that the sets of
+ video cards supported by XFree86 on one hand and OS/2 on the other hand
+ overlap, but do not match exactly, i.e. the fact that your card is sup-
+ ported by OS/2 does not mean it works with XFree86 as well, and vice
+ versa. XFree86 does not use the video services of the OS/2 operating
+ system.
+
+4.2 Required Software
+
+ o Any version of Warp 3 with at least fixpack 17, or Warp 4 is required
+
+ o XFree86/OS2-3.3.5 may use a local named-pipe connection or a TCP/IP
+ based network connection.
+
+ 1. Warp comes with the Internet Access Kit (IAK), which is suffi-
+ cient. Warp Connect and Warp Server come with a full version of
+ TCP/IP (3.0). Use of this software is preferred over IAK then.
+
+ 2. Warp 4 comes with TCP/IP 4.0 which should also work.
+
+ 3. There are reports that with EMX 0.9 fix 4, you can also use the
+ new 32 bit IBM TCP/IP 4.1 product.
+
+ 4. The old IBM TCP/IP 2.0, that comes with the IBM PMX product may be
+ used with Warp as well, although it is no longer supported by IBM.
+ Please ensure that you have the latest CSDs installed.
+
+ Other versions of TCP/IP, such as FTP's, DEC's, or Hummingbird's TCP/IP
+ versions, as well as IBM TCP/IP 1.X are not supported. Nor does any net-
+ working support from DOS (packet drivers, winsock), Netware, or NetBIOS
+ work, and I won't to provide support for that in the future.
+
+ o If you want to write or port applications for XFree86, you are encour-
+ aged to do so. You will need a complete installation of EMX/gcc 0.9C
+ fix4 or later for doing so. Neither the second (obsolete) implementation
+ of gcc, nor any commercial package, including Cset/2, VAC++, Borland
+ C++/OS2, Watcom C++, Metaware C, and others, is suitable for porting,
+ because various parts of the X DLLs rely on certain features only pre-
+ sent with EMX.
+
+5. Installing the System
+
+The binary distribution is composed of a number of zip archives which are the
+executables, servers, fonts, libraries, include files, man pages, and config
+files. The full distribution requires about 40-55MB of disk space.
+
+All archives of this alpha version are packed with the info-zip utility,
+which is available under the name UNZ512X2.EXE (or a later version) from many
+OS/2 archives. Please obtain a native OS/2 version of this unpacker. DOS
+PKUNZIP does not work, because it cannot unpack long file names and extended
+attributes.
+
+At this moment, the distribution covers only the ``core'' distribution which
+somewhat reduces the usability. Refer to WWW sites and archives listed in the
+XFree86/OS2 FAQ and elsewhere to obtain pre-built X clients which were ported
+to XFree86.
+
+The contents of the packages are:
+
+ REQUIRED:
+
+ Xbase
+ A special device driver and the SuperProbe program
+
+ Xdoc
+ READMEs and XFree86 specific man pages.
+
+ Xbin
+ all of the executable X client applications and
+ shared libs
+
+ Xfnts
+ the misc and 75dpi fonts
+
+ emxrt
+ Runtime libraries of EMX
+
+ Choose at least one of the following to match your hardware:
+
+ X8514
+ the X server for IBM 8514/A and compatible boards
+
+ XAGX
+ the X server for AGX boards
+
+ XGlnt
+ the X server for Permedia / GLINT boards
+
+ XI128
+ the X server for #9 Imagination 128 boards
+
+ XMa32
+ the X server for ATI Mach32 graphics boards
+
+ XMa64
+ the X server for ATI Mach64 graphics boards
+
+ XMa8
+ the X server for ATI Mach8 graphics boards
+
+ XMono
+ the Monochrome X Server
+
+ XP9K
+ the X server for P9000 based boards
+
+ XS3
+ the X server for S3 based boards (excluding S3 ViRGE)
+
+ XS3V
+ the X server for S3 ViRGE based boards
+
+ XSVGA
+ the 8-bit pseudo-color X server for Super VGA cards
+
+ XVG16
+ the 4-bit pseudo-color X server for VGA & SVGA cards.
+
+ XW32
+ the X server for et4000w32 based boards
+
+ OPTIONAL:
+
+ Xman
+ pre-formatted man pages for the X11 interface and
+ clients
+
+ Xf100
+ 100dpi fonts
+
+ Xfscl
+ Speedo and Type1 fonts
+
+ Xfnon
+ Japanese, Chinese and other fonts
+
+ Xfcyr
+ Cyrillic fonts
+
+ Xfsrv
+ the font server with man pages.
+
+ Xprog
+ the X11 header files and programmer's utilities for
+ compiling other X applications
+
+ Xpex
+ PEX fonts and libraries required for PEX applications
+
+In order to save space on your disk and reduce net bandwidth, choose the
+software to obtain carefully. Each X server is an archive of about 1.2MB and
+occupies 3.0MB on the disk. You won't normally need more than the single
+Xserver tailored to your video card.
+
+If it is your first time install, get the Xbase archive before any of the
+other packages. This package contains a driver and a test program, which ana-
+lyzes your video hardware. If this program fails or reports an incompatible
+hardware, it makes no sense to obtain the other packages in the hope that
+they would magically work.
+
+6. Troubleshooting
+
+Surprised to see this section directly in the beginning? We have put it here
+because chances are best here not to overlook it. This does not mean that you
+will necessarily encounter trouble when installing XFree86, but be warned:
+the following sections are IMPORTANT and neglecting one or more things out of
+impatience or sloppiness will leave you with a non-working X11 system and us
+with unnecessary problems.
+
+Still, due to the incredibly large number of hardware configurations, there
+may be some special situations and configurations where the below description
+is not successful. If this happens, read - I repeat READ - the list of ``fre-
+quently asked questions'' (FAQ) which has meanwhile evolved to a trou-
+bleshooting guide. The latest version is always at
+http://set.gmd.de/~veit/os2/x11os2faq.html .
+
+Maybe - but we found you must be very creative - you find a bug. Consult the
+page http://set.gmd.de/~veit/os2/xf86bugs.html whether it is already known.
+If not, you have a case and should report it to XFree86
+(xfree86@xfree86.org). Please refer to the FAQ about the information to be
+provided for a complete problem report.
+
+The recommended newsgroup for setup questions is comp.os.os2.setup.misc. I
+read this group, so it won't speed up the process or enforce anything if you
+post to other groups, or forward the report to my mail address as well or to
+xfree86@xfree86.org.
+
+So, not to discourage you completely, the setup section begins:
+
+7. Checking Compatibility of Video Hardware
+
+In the following, we assume that you want to install XFree86/OS2 on a disk
+drive with the letter Y: (which you probably don't have). Change the letter
+in all commands accordingly.
+
+ 1. Obtain the package Xbase and install it from the root directory of the
+ Y: drive, by entering the following commands:
+
+ [C:\] Y:
+ [Y:\] cd \
+ [Y:\] unzip \path_of_package\Xbase.zip
+
+ 2. Edit your CONFIG.SYS file to contain the following line somewhere:
+
+ DEVICE=Y:\XFree86\lib\xf86sup.sys
+
+ Of course replace ``Y:'' with the correct drive letter.
+
+ 3. At this point, you may consider to add the variables required for
+ XFree86/OS2 as well, which will save you from one additional reboot.
+ Refer to section Adding Variables to CONFIG.SYS (section 9., page 1)
+ below.
+
+ 4. After adding the device driver entry to the CONFIG.SYS file, you must
+ reboot to install the driver. XFree86/OS2 will not work without this
+ driver.
+
+ 5. Start a full screen OS/2 CMD session and enter the following command:
+
+ [C:\] Y:\XFree86\bin\SuperProbe
+
+ 6. This command will (normally) report important information about your
+ video configuration, i.e. the type of chipset, the available video mem-
+ ory and the RAMDAC circuit available. Please write this down or redi-
+ rect the output of ``SuperProbe'' into a file by entering:
+
+ [C:\] Y:\XFree86\bin\SuperProbe >filename
+
+ 7. SuperProbe can identify many more video cards than are supported by
+ XFree86. In some cases, SuperProbe unfortunately detects a wrong card,
+ often it claims to have seen a MCGA card which is some sort of a fall-
+ back. Generally, if it is approximately right, there are only few rea-
+ sons for doubts; if it is totally off (e.g. saying it has seen a
+ ET4000, and you have a Cirrus card), you should report a mis-detection
+ as a bug to the given address. In all cases, please take the few min-
+ utes and check the accompanying README.* files to check for special
+ precautions, options, or features of the card.
+
+ 8. If the README files tell you that your hardware is supported, please
+ obtain the rest of the software.
+
+8. Installing the packages
+
+XFree86/OS2 assumes a directory hierarchy starting from drive:\XFree86. This
+can be changed, but is strictly discouraged.
+
+ 1. Choose a HPFS partition with sufficient free space.
+
+ 2. For each package to install, go to the root directory of this drive,
+ and type:
+
+ drive:> cd \
+ drive:> unzip \path_of_packages\Xxxxx.zip
+
+ 3. You might encounter that some packages report duplicate files, e.g.
+ the X server packages install corresponding README files, which are
+ also in the Xdoc package. This is okay, the files are the same. Let
+ unzip replace the files.
+
+ 4. No special sequence to unpack the files is required.
+
+9. Adding Variables to CONFIG.SYS
+
+XFree86/OS2 requires a number of settings in the CONFIG.SYS file to work cor-
+rectly. Please add the following settings, and in particular take care to set
+forward versus backward slashes correctly:
+
+ TERM
+ Set the preferred terminal type for the xterm or editor to be
+ used. Some programs need this setting. I have my type set to
+
+ SET TERM=ansi
+
+ \XFree86\lib\X11\etc\termcap.x11 contains a suitable termcap
+ which can be used in place of termcap files that come with EMX,
+ EMACS, or other ported software.
+
+ TERMCAP
+ This variable must be set to the location where the termcap file
+ used for the above TERM variable is searched. My setting, for
+ instance, is:
+
+ SET TERMCAP=D:/EMX/ETC/TERMCAP.X11
+
+ Note that forward ``/'' is used as a directory separator.
+
+ ETC
+ Set to an ETC directory. Normally, this is already set to the ETC
+ directory of the TCP/IP code, such as
+
+ SET ETC=C:\TCPIP\ETC
+
+ TMP
+ Set to an TMP directory. Normally, this is already set to the TMP
+ directory of the TCP/IP code, such as
+
+ SET TMP=C:\TCPIP\TMP
+
+ HOSTNAME
+ Set to the internet hostname. Normally, this is already set by
+ the TCP/IP installation program, such as
+
+ SET HOSTNAME=myhost
+
+ With IAK, you would normally run a loopback configuration Network
+ configuration (section 10., page 1) and would then set this to
+
+ SET HOSTNAME=localhost
+
+ USER
+
+ LOGNAME
+ Set both to a username. Currently, they are there just to make
+ some programs happy; in the future, this variable might be set by
+ a login shell of a multiuser configuration. My variable, for
+ instance, is set to
+
+ SET USER=holger
+ SET LOGNAME=holger
+
+ HOME
+ Set this to an existing directory that is supposed to be a home
+ directory of a user. Some utilities place temporary and init
+ files here. This is also future investment for a multiuser con-
+ figuration, but must still be there. For instance, this variable
+ might be set to
+
+ SET HOME=H:\user\holger
+
+ X11ROOT
+ This is one of the most important settings, it determines the
+ root of the XFree86 directory tree. Normally, you will set this
+ to the drive letter of the partition where the \XFree86 tree
+ resides, such as in
+
+ SET X11ROOT=Y:
+
+ You may try to move the tree to another subdirectory, e.g. to
+ K:\OS2\X11\XFree86... and would then have to change this to
+
+ SET X11ROOT=K:/OS2/X11
+
+ , but this is discouraged, since some utilities might not accept
+ this. Note the forward ``/'' as a directory separator here.
+
+ DISPLAY
+ This variable may be set to the display to be used for displaying
+ clients. Normally you will set this variable to the same value as
+ the HOSTNAME variable and simply add a :0.0 after it, such as
+
+ SET DISPLAY=myhost:0.0
+
+ Read the X11 man page on the exact meaning of these postfixes and
+ other options.
+
+ XSERVER
+ Set this to the executable name of the X server to be used. This
+ must be a complete path. My setting is as follows:
+
+ SET XSERVER=D:/XFree86/bin/XF86_Mach64.exe
+
+ PATH
+ Add the binary directory for the X11 utilities to your search
+ PATH. This is normally the directory (adjust the letter)
+
+ Y:\XFree86\bin
+
+ It is possible to move the binaries to another directory in the
+ search path; for maintenance reasons and clarity of the struc-
+ ture, this is not recommended, though.
+
+ LIBPATH
+ Add the DLL directory for the X11 utilities to the LIBPATH. This
+ is normally the directory (adjust the letter)
+
+ Y:\XFree86\lib
+
+ It is possible to move the DLLs to another directory in the
+ library path; for maintenance reasons and clarity of the struc-
+ ture, this is not recommended, though. Note that Y:\XFree86\lib
+ has several other subdirectories; these may not be moved else-
+ where, rather they must stay there, because most utilities form a
+ path to these directories by using %X11ROOT%\XFree86\lib as a
+ base.
+
+The recent version of XFree86/OS2 has a REXX script named checkinstall.cmd
+which you can (and should) use to check whether you have entered most things
+correctly. This is not bullet-proof, but prevents the most obvious setup
+problems. Also, the X server itself will do some checking and will refuse to
+start if something is wrong.
+
+10. Remarks on the Network Configuration
+
+It is beyond the scope of this document to even give an introduction about
+the correct installation of the TCP/IP networking system. You must do this
+yourself or seek assistance elsewhere. It is only possible to say here that a
+PC working well in a TCP/IP based LAN network will also work with XFree86/OS2
+(when all other prerequisites are matched as well).
+
+With IAK, there is a special configuration necessary, unless you want to use
+XFree86/OS2 only during a hot link to your Internet provider, the so called
+``localhost'' or ``loopback'' configuration. This is a local network inter-
+face which ``loops'' back to the same host. The following settings are neces-
+sary for this:
+
+ 1. Create a file \tcpip\etc\hosts with the following content:
+
+ 127.0.0.1 localhost
+
+ 2. Add the following line to your \tcpip\bin\tcpstart.cmd:
+
+ ifconfig lo 127.0.0.1 up
+
+ If you don't have such a tcpstart.cmd file (Warp 4 calls this file
+ \MPTN\BIN\MPTSTART.CMD), create one, and add a line like the following
+ to your config.sys file: CALL=C:\OS2\CMD.EXE /Q /C C:\tcpip\bin\tcp-
+ start.cmd >NUL: (implying that your bootdrive is C:).
+
+ 3. Set the HOSTNAME environment variable to localhost as described in the
+ last section.
+
+ 4. Add the following line to CONFIG.SYS:
+
+ SET USE_HOSTS_FIRST=1
+
+ 5. After rebooting, verify that the following command works:
+
+ [C:\] ping localhost
+
+You don't need this ``loopback'' interface if your PC is connected to a LAN
+(either directly or through SLIP/PPP).
+
+In case of a SLIP/PPP line, you have to establish this connection BEFORE you
+start XFree86.
+
+The checkinstall.cmd script coming with XFree86/OS2 gives some advice on the
+configuration as well.
+
+If you have problems to get this or other basic networking things running,
+seek assistance elsewhere.
+
+11. Configuring X for Your Hardware
+
+After you have added the required settings and setup a working network, run
+the xf86config program to create a standard configuration file in
+Y:\XFree86\lib\X11\XF86Config from a windowed or full screen OS/2 text ses-
+sion:
+
+ [C:\] xf86config
+
+The xf86config program will ask a number of questions. You will need the
+information obtained from the SuperProbe program here. The program should be
+self explanatory; if you have problems to understand something though, seek
+assistance in the newsgroups.
+
+It is possible, but strongly discouraged for the non-expert, to edit the
+XF86Config file with a text editor. In a few situations as described in the
+FAQ, however, this might even be mandatory. This file is not a hacker's area,
+such as the Win95 registry, but it has in common with it that you can easily
+cause damage.
+
+For details about the XF86Config file format, refer to the XF86Config(4/5)
+manual page.
+
+If you know the configuration process from Linux or other XFree86 platform,
+you will encounter a few differences:
+
+ o There is no configuration for the mouse type or device. The mouse device
+ name is fixed to OSMOUSE, and this cannot be changed. If you have a
+ three-button-mouse, install the correct OS/2 driver for it, such as
+
+ DEVICE=D:\OS2\BOOT\PCLOGIC.SYS SERIAL=COM1
+ DEVICE=D:\OS2\BOOT\MOUSE.SYS TYPE=PCLOGIC$
+
+ for a MouseSystems compatible mouse, for instance.
+
+ o The X server does not read the native OS/2 keyboard map, but the new XKB
+ server extension might already give you a correct keyboard layout, pro-
+ vided your language was selectable in the xf86config program. If you
+ encounter incorrect settings, please send a mail to XFree86@XFree86.org
+ describing in detail what is wrong. Even with XKB, you have the option
+ to replace some key settings with a xmodmap file. See the man page for
+ xmodmap for details (or use some available xmodmap file from Linux -
+ they are the same).
+
+ o There is no support for the Wacom and Elographics input devices yet.
+
+In most cases, an existing XF86Config file for the same XFree86 version from
+Linux or another platform may be used without changes. There is one prominent
+exception: some S3 805 based VLB cards put their video memory in odd loca-
+tions. The X server can search for this memory by experimentally mapping and
+unmapping possible memory regions. In XFree86/OS2, the OS may run out of mem-
+ory tiles during this process. If this happens, you must find out the loca-
+tion of the memory yourself and add it as an option
+
+ MemBase 0x12345678
+
+to the XF86Config file.
+
+Once you've set up a XF86Config file, you can fine tune the video modes with
+the xvidtune utility.
+
+12. Running X
+
+16mb of memory is a recommended minimum for running the network software, X
+and the presentation manager in parallel. The server, window manager and an
+xterm take about 4-6 Mb of memory themselves. X will start up on a system
+with 8MB or less, but the performance will severely suffer from heavy disk
+swapping. Your mileage may vary, though, so some people might consider this
+still tolerable.
+
+The easiest way for new users to start X windows is to type:
+
+ [C:\] startx
+
+.
+
+To get out of X windows, type: ``exit'' in the console xterm. You can cus-
+tomize your X by creating .xinitrc, .xserverrc, and .twmrc files in the
+directory that the HOME environment variable points to. These files are
+described in the xinit and startx man pages.
+
+By default, the systemwide xinitrc file (in Y:/XFree86/lib/X11/xinit/xini-
+trc.cmd) installs the rather simplistic twm window manager. You can find bet-
+ter window managers on the ported software page at
+http://set.gmd.de/~veit/os2/xf86ported.html .
+
+13. Rebuilding the XFree86 Distribution
+
+Do you really want to rebuild XFree86/OS2 from source? Read the file
+OS2.Notes on details to recompile XFree86/OS2 from scratch.
+
+14. Building New X Clients
+
+The easiest way to build a new client (X application) is to use xmkmf if an
+Imakefile is included in the sources. Type ``xmkmf -a'' to create the Make-
+files, check the configuration if necessary and type ``xmake''. ``xmake'' is
+a wrapper for the GNU make program which defeats the improper SHELL setting
+typically found in a Makefile generated from an Imakefile. Also see the
+XFree86/OS2 FAQ for more hints about porting X clients.
+
+15. Acknowledgements
+
+Many thanks to:
+
+ o Sebastien Marineau for his great work on getting the server code
+ debugged
+
+ o Eberhard Mattes for the wonderful base platform EMX which this port
+ heavily relies on
+
+ o ME - no, no, forget this: I won't praise myself :-)
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2.sgml,v 3.13 1999/08/23 06:38:49 dawes Exp $
+
+ $XConsortium: OS2.sgml /main/4 1996/03/11 10:46:06 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OS2,v 3.19 1999/08/23 07:03:45 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.Oak b/xc/programs/Xserver/hw/xfree86/doc/README.Oak
new file mode 100644
index 000000000..ef16b0e5c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.Oak
@@ -0,0 +1,171 @@
+ Information for Oak Technologies Inc. Chipset Users
+
+ Jorge F. Delgado Mendoza (delgadomendoza.j@pg.com)
+
+ 17 August 1999
+
+1. Supported chipsets
+
+The driver is used in the 8-bit / 256-color SVGA server and the mono server.
+The following chipsets for Oak Tech. Inc. are supported:
+
+ OTI037C
+ 8-bit VGA chipset, with up to 256Kbytes of DRAM. All the boards I
+ have seen are only able to do standard VGA modes. (ie. up to
+ 320x200x256 and up to 640x480x16). Currently the probe for this
+ chip is disabled, so use the generic VGA driver instead.
+
+ OTI067
+ ISA SVGA chipset, up to 512Kbytes of DRAM (usually 70/80 ns).
+
+ OTI077
+ Enhanced version of the 067, with support for 1Mbyte and up to 65
+ Mhz dot-clock. This chipset is capable of resolutions up to
+ 1024x768x256 colors in Non-Interlaced mode, and up to
+ 1280x1024x16 colors Interlaced.
+
+ OTI087
+ One of the first VLB chipsets available, it has a 16-bit external
+ data path, and a 32-bit internal memory-controller data path. It
+ features some acceleration hardware: register-based color expan-
+ sion, hardware cursor, a primitive BitBlt engine, a 64 bit
+ graphic latch and some other new (on its time) features. Maximum
+ BIOS resolutions are 1024x768x256 Non-Interlaced and
+ 1280x1024x256 interlaced. Maximum Dot-Clock is 80Mhz, but is usu-
+ ally coupled with the OTI068 clock generator capable of frequen-
+ cies up to 78Mhz. This chipset supports up to 2MBytes of 70/70R
+ ns DRAM.
+
+ OTI107 and OTI111
+ These are new, PCI chipsets by Oak Tech. Inc. Support is not
+ included for them, as they are very rare and I haven't had the
+ chance to look at one of these boards. We have been unable to
+ locate 107's. If anybody has such a board and can donate it to
+ XFree86, we would be more than glad to add support for them.
+
+ An OTI111 is now available and we are working on support for it.
+
+All the chipsets up to the OTI087 are "Backwards compatible", in fact some
+early drivers for the OTI087 based chipsets were those made for the 077.
+
+Accelerated support is included only for OTI087 chipsets, also Mono server is
+only included for 067/077 chipsets.
+
+2. XF86Config options
+
+The following options are of particular interest to the Oak driver. Each of
+them must be specified in the 'svga' driver section of the XF86Config file,
+within the Screen subsections to which they are applicable (you can enable
+options for all depths by specifying them in the Device section).
+
+ Option "linear" (OTI087)
+ This option enables a linear framebuffer at 0xE00000 (14Mb) for
+ cards recognized as ISA by the probe. Cards that are VLB will
+ map the framebuffer at 0x4E00000. The aperture depends on the
+ VideoRam parameter in the XF86Config file or on the probed value
+ for the board. It will speed up performance by about 15% on a
+ VLB-based boards for a DX2-66 486.
+
+ Sometimes a motherboard will not be able to map at 0x4E00000, and
+ then linear mode will not work with more than 14 Mbytes of main
+ RAM. I know this because mine doesn't.
+
+ Option "fifo_aggressive" (OTI087)
+ This option will cause the command FIFO threshold of the chipset
+ to be set at 0 instructions, which should be optimal for 16-bit
+ data transfers, as empirical use of different thresholds, with
+ xbench, show. Expect a 5-10% of performance boost on a DX2-66
+ 486.
+
+ Option "fifo_conservative" (OTI087)
+ This option will set the FIFO to a safe value of 14, slowing the
+ board by a 50%, use this only if you experience streaks or anoma-
+ lies on the screen.
+
+ Option "enable_bitblt" (OTI087)
+ This option will enable an internal cache on the board that will
+ be used as a rudimentary bitblt engine. Performance boost is more
+ or less 100%, (double BlitStones on xbench). Most OTI087 boards
+ seem to have this feature broken, corrupting text from xterms and
+ leaving mouse droppings throughout the screen. As a rule of
+ thumb, enable it, if it works badly, disable it.
+
+ Option "clock_50" (OTI087)
+ This one will force the internal speed to 50 Mhz.
+
+ Option "clock_66" (OTI087)
+ This one will force the internal speed to 66 Mhz, speeding up
+ performance of the chipset.
+
+ Option "no_wait" (OTI087)
+ Sets the VLB interface to no wait states. On a medium VLB board
+ (mine is VLB/PCI, so its not a very fast one) in VLB transparent
+ mode, it manages up to 16 Mbytes/second transfer rate through the
+ bus.
+
+ Option "first_wait" (OTI087)
+ Makes the VLB interface to add one wait state to the first read
+ or write of a given burst.
+
+ Option "first_wwait" (OTI087)
+ Similar to the previous one, this only inserts a wait state in
+ the first 'write' of a given burst. reads are not affected. This
+ is the default behaviour of the server.
+
+ Option "write_wait" (OTI087)
+ This configures the VLB interface to add one wait state to each
+ write cycle.
+
+ Option "read_wait" (OTI087)
+ This configures the VLB interface to add one wait state to each
+ read cycle.
+
+ Option "all_wait" (OTI087)
+ Enables the slowest VLB transfer adding wait states in all cases.
+ Hopefully, no board will need this enabled.
+
+ Option "one_wait" (OTI087)
+ Sets the VLB interface to at least one wait state.
+
+ Option "noaccel" (OTI087)
+ One accelerated routine has been lately added to the driver,
+ allowing it to draw solid fills quite faster. This routine only
+ works (up to date) on segmented addressing, and only if the vir-
+ tual width is 1024. This option is automatically enabled by the
+ driver. Use this option if you want to disable it.
+
+As a rule of thumb, use the option "no_wait", and if it doesn't result in
+corrupting text, lucky you. If not, try "first_wwait", and downwards. ISA
+card owners should not use these options.
+
+3. Mode issues
+
+The use of very high dot-clocks has a REAL negative effect on the performance
+of the boards, due to its limited 80Mbit/sec, higher dot clocks limit its
+ability to draw data into the framebuffer. Thus expect better performance of
+a 72Mhz based mode than on a 78Mhz based one (for example) where more band-
+width is required for screen refresh.
+
+It does not make much sense to use the highest clock (78 MHz) for 1024x768 at
+76 Hz on a OTI087; the card will almost come to a standstill. A 72 MHz dot
+clock results in 70 Hz which should be acceptable. If you have a monitor that
+supports 1024x768 at 76 Hz with a 78 MHz dot clock, a standard OTI087 based
+card is a poor match anyway.
+
+4. Linear addressing
+
+Linear addressing is hardwired to 14 Mbytes for ISA boards and 78 Mbytes for
+VLB boards, thus if you have more than that on your board you shouldn't
+enable it. The aperture is selected from the VideoRam parameter of the
+XF86Config or from the amount of memory that is detected if VideoRam is not
+found.
+
+I hope (because I have not tested it very thoroughly) that linear addressing
+will work on all ISA boards, VLB ones work flawlessly.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Oak.sgml,v 3.13 1999/08/23 06:38:50 dawes Exp $
+
+ $XConsortium: Oak.sgml /main/8 1996/05/12 20:58:00 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Oak,v 3.20 1999/08/23 07:03:45 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD
new file mode 100644
index 000000000..f3c6dfa85
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD
@@ -0,0 +1,336 @@
+ README for XFree86 on OpenBSD
+
+ Matthieu Herrb
+
+ Last modified on: 25 June 1999
+
+1. What and Where is XFree86?
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2, which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes. The release is available as source patches
+against the X Consortium X11R6.3 code, as well as binary distributions for
+many architectures.
+
+See the Copyright Notice.
+
+The sources for XFree86 are available by anonymous ftp from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current
+
+Binaries for OpenBSD 2.5 and later are available from:
+
+ftp://ftp.XFree86.org/pub/XFree86/current/binaries/OpenBSD
+
+A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR-
+RORS
+
+XFree86 also builds on other OpenBSD architectures. See section Building on
+other architectures (section 8.2, page 1) for details.
+
+2. Bug Reports for This Document
+
+Send email to matthieu@laas.fr (Matthieu Herrb) or XFree86@XFree86.org if you
+have comments or suggestions about this file and we'll revise it.
+
+3. New features in this release
+
+ o The maximum number of open connections in the server has been raised to
+ 128,
+
+ o the resize utility was fixed.
+
+See the Release Notes for non-OS dependent new features in XFree86 3.3.4.
+
+4. Installing the Binaries
+
+Refer to section 5 of the Release Notes for detailed installation instruc-
+tions.
+
+5. Configuring X for Your Hardware
+
+The /etc/XF86Config file tells the X server what kind of monitor, video card
+and mouse you have. You must create it to tell the server what specific
+hardware you have.
+
+The easiest way to create this file is to run the XF86Setup utility as root.
+Refer to QuickStart.doc for details about its use.
+
+You'll need info on your hardware:
+
+ o Your mouse type, baud rate and its /dev entry.
+
+ o The video card's chipset (e.g. ET4000, S3, etc).
+
+ o Your monitor's sync frequencies.
+
+The recommended way to generate an XF86Config file is to use the XF86Setup
+utility. The xf86config text utility is still there for the (few) cases
+where XF86Setup can't be used. Also, there is a sample file installed as
+/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point.
+
+For details about the XF86Config file format, refer to the XF86Config(5) man-
+ual page.
+
+Once you've set up a XF86Config file, you can fine tune the video modes with
+the xvidtune utility.
+
+5.1 About mouse configuration
+
+If your serial mouse does not work try using kermit or tip to connect to the
+mouse serial port and verify that it does indeed generate characters.
+
+The OpenBSD pms driver provides both ``raw'' and ``cooked'' (translated)
+modes. ``raw'' mode does not do protocol translation, so XFree86 would use
+the PS/2 protocol for talking to the device in that mode. ``Cooked'' mode is
+the old BusMouse translation. The driver runs in ``raw'' mode when using the
+/dev/psm0 device name.
+
+On OpenBSD 2.2, only standard PS/2 mice are supported by this driver.
+
+On OpenBSD 2.3 and later include there is support for recent PS/2 mice that
+send more than three bytes at a time (especially intellimouse, or mouseman+
+with a "3D" roller).
+
+See README.mouse for general instruction on mouse configuration in XFree86.
+
+5.2 Other input devices
+
+XFree86 supports the dynamic loading of drivers for external input devices
+using the XInput extension. Currently supported devices are:
+
+ o Joystick (xf86Jstk.so)
+
+ o Wacom tablets (Wacom IV protocol only, xf86Wacom.so)
+
+ o SummaSketch tablets (xf86Summa.so)
+
+ o Elographics touchscreen (xf86Elo.so)
+
+To use a specific device, add the line
+
+ load "module"
+
+in the Module section of XF86Config, where module is the name of the .so file
+corresponding to your device. You also need to set up a XInput section in
+XF86Config. Refer to the XF86Config(5) man page for detailed configuration
+instructions.
+
+You can then change the device used to drive the X pointer with the xset-
+pointer(1) command.
+
+For joystick support, you'll need to enable the joystick device driver in the
+kernel. See joy(4) for details.
+
+5.3 Configuring PEX and XIE extensions
+
+The PEX and XIE extensions are supported as external modules. If you want
+to have access to these extensions, add the following lines to the Module
+section of XF86Config:
+
+ load "pex5.so"
+ load "xie.so"
+
+6. Running X
+
+8mb of memory is a recommended minimum for running X. The server, window
+manager and an xterm take about 4 Mb of memory themselves. On a 4Mb system
+that would leave nothing left over for other applications like gcc that
+expect a few meg free. X will work with 4Mb of memory, but in practice com-
+pilation while running X can take 5 or 10 times as long due to constant pag-
+ing.
+
+6.1 Starting xdm, the display manager
+
+To start the display manager, log in as root on the console and type: ``xdm
+-nodaemon''.
+
+You can start xdm automatically on bootup un-commenting the following code in
+/etc/rc.local:
+
+ if [ -x /usr/X11R6/bin/xdm ]; then
+ echo -n ' xdm'; /usr/X11R6/bin/xdm
+ fi
+
+On the default OpenBSD 2.2 installation, you will need to create the virtual
+console device for the X server:
+
+ cd /dev
+ ./MAKEDEV ttyC5
+
+Note that the binary distributions of XFree86 for OpenBSD don't include sup-
+port for the XDM-AUTHORIZATION-1 protocol.
+
+6.2 Running X without the display manager
+
+The easiest way for new users to start X windows is to type: ``startx >&
+startx.log''. Error messages are lost unless you redirect them because the
+server takes over the screen.
+
+To get out of X windows, type: ``exit'' in the console xterm. You can cus-
+tomize your X by creating .xinitrc, .xserverrc, and .twmrc files in your home
+directory as described in the xinit and startx man pages.
+
+7. Kernel Support for X
+
+To make sure X support is enabled under OpenBSD, the following line must be
+in your config file in /sys/arch/i386/conf:
+
+ options XSERVER
+
+7.1 Console drivers
+
+The server supports the two standard OpenBSD/i386 console drivers: pccons
+and pcvt. They are detected at runtime and no configuration of the server
+itself is required.
+
+The pcvt console driver is the default in OpenBSD. It offers several virtual
+consoles and international keyboard support.
+
+7.2 Aperture Driver
+
+By default OpenBSD includes the BSD 4.4 kernel security feature that disable
+access to the /dev/mem device when in multi-users mode. But XFree86 servers
+can take advantage (or require) linear access to the display memory.
+
+The P9000, Mach64 and AGX servers require linear memory access, other accel-
+erated servers can take advantage of it, but do not require it. Some drivers
+in the SVGA server require linear memory access too, notably the Matrox
+driver.
+
+The preferred way to allow XFree86 to access linear memory is to use the
+aperture driver
+
+Ths step is highly dependent from your exact operating system version:
+
+ o OpenBSD 2.0
+
+ Use the aperture driver from /usr/lkm:
+
+ add the following lines to the end of /etc/rc.local:
+
+ KERNDIR=/usr/lkm
+ if [ -f ${KERNDIR}/ap.o ]; then
+ modload -o ${KERNDIR}/ap -e ap -p \
+ ${KERNDIR}/apinstall ${KERNDIR}/ap.o
+ fi
+
+ o OpenBSD 2.1, 2.2
+
+ Uncomment the lines loading the aperture driver from /etc/rc.securelevel
+
+ o OpenBSD 2.3
+
+ The aperture driver is part of the kernel. Add 'option APERTURE' to
+ your kernel configuration file, build and install the new kernel and run
+ ./MAKEDEV std in /dev. Edit /etc/sysctl.conf to set the variable
+ machdep.allowaperture to 1.
+
+ o OpenBSD 2.4 and later
+
+ OpenBSD now requires the aperture driver to be enabled for all X
+ servers, because the aperture driver also controls access to the I/O
+ ports of the video boards.
+
+After doing that, reboot your system. XFree86 will auto-detect the aperture
+driver if available.
+
+Warning: if you boot another kernel than /bsd, loadable kernel modules can
+crash your system. Always boot in single user mode when you want to run
+another kernel.
+
+ Caveat: the aperture driver only allows one access at a time (so
+ that the system is in the same security state once X is launched).
+ This means that if you run multiple servers on multiples VT, only
+ the first one will have linear memory access. Use 'option INSE-
+ CURE' if you need more that one X server at a time.
+
+Another (less recommended) way to enable linear memory access is to disable
+the kernel security feature by adding ``option INSECURE'' in your kernel con-
+figuration file and build a new kernel. In OpenBSD 2.2 and later, you will
+also need to comment out the line initializing securelevel to 1 in
+/etc/rc.securelevel.
+
+7.3 MIT-SHM
+
+OpenBSD supports System V shared memory. If XFree86 detects this support in
+your kernel, it will support the MIT-SHM extension.
+
+To add support for system V shared memory to your kernel add the lines:
+
+ # System V-like IPC
+ options SYSVMSG
+ options SYSVSEM
+ options SYSVSHM
+
+to your kernel config file.
+
+8. Rebuilding the XFree86 Distribution
+
+The server link kit allow you to rebuild just the X server with a minimum
+amount of disk space. Just unpack it, make the appropriate changes to the
+xf86site.def, type ``./mkmf'' and ``make'' to link the server. See
+/usr/X11R6/lib/Server/README for more info.
+
+See INSTALL for instructions on unbundling and building the source distribu-
+tion.
+
+You should configure the distribution by editing xc/config/cf/host.def
+before compiling. To compile the sources, invoke ``make World'' in the xc
+directory.
+
+8.1 Console drivers
+
+XFree86 has a configuration option to select the console drivers to use in
+xf86site.def:
+
+ o if you're using pccons only put:
+
+ #define XFree86ConsoleDefines -DPCCONS_SUPPORT
+
+ o if you're using pcvt only put:
+
+ #define XFree86ConsoleDefines -DPCVT_SUPPORT
+
+If you don't define XFree86ConsoleDefines in xf86site.def the pccons and pcvt
+drivers will be supported.
+
+8.2 Building on other architectures
+
+XFree86 also compiles on other OpenBSD architectures.
+
+The XFree86 servers can also been built on OpenBSD/mips. The S3 server has
+been tested on an Acer Mips system with a S3/928 board. Contact Per Fogel-
+strom (pefo@OpenBSD.org) for details.
+
+The Xsun server patches from Dennis Ferguson and Matthew Green for NetBSD
+have been integrated in xc/programs/Xserver/hw/sun. The Xsun server can be
+built on the sparc and the sun3.
+
+The client side of XFree86 also builds on the alpha, pmax, amiga, mac68k and
+mvme68k architectures.
+
+Problems with this port should be reported directly to the OpenBSD mailing
+lists rather than to the xfree86 mailing list.
+
+Note that OpenBSD project has now its own source tree, based on the XFree86
+source tree, with some local modifications. You may want to start with this
+tree to rebuild from sources. The OpenBSD X11 source tree is available by
+anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon-
+cvs.html for details on anoncvs.
+
+9. Building New X Clients
+
+The easiest way to build a new client (X application) is to use xmkmf if an
+Imakefile is included in the sources. Type ``xmkmf -a'' to create the Make-
+files, check the configuration if necessary and type ``make''. Whenever you
+install additional man pages you should update whatis.db by running ``make-
+whatis /usr/X11R6/man''.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.3 1999/08/23 06:38:50 dawes Exp $
+
+ $XConsortium$
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.5 1999/08/23 07:03:46 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.P9000 b/xc/programs/Xserver/hw/xfree86/doc/README.P9000
new file mode 100644
index 000000000..89cf0d0ea
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.P9000
@@ -0,0 +1,472 @@
+ XFree86 P9000 Server Release Notes
+
+ Erik Nygren (nygren@mit.edu)
+
+ 1998 December 29
+
+1. Change Log
+
+ 1998.10.13:
+
+ o Fixed a bug that would cause the server to crash when it
+ tried to enable or disable the screen saver while at a VT
+ (Erik Nygren)
+
+ 1997.01.30:
+
+ o Added probing for MemBase and IOBase on Diamond Viper PCI
+ cards (Karl Anders Řygard)
+
+ o Added support for DPMI screen saving (Karl Anders Řygard)
+
+ 1996.03.31:
+
+ o Added support for the XFree86-DGA extension (Erik Nygren)
+
+ 1995.05.24:
+
+ o Added p9000frect.c: Accelerated solid rectangle fills at
+ 8/16bpp (Henrik Harmsen)
+
+ o Added stipple fills to p9000frect.c, and a stub for tile
+ fills when p9000ImageFill is fixed (Chris Mason)
+
+ o Added p9000pntwin.c: Accelerated paint window at 8/16/32bpp
+ (Henrik Harmsen)
+
+ o Added p9000gc16.c and p9000gc32.c for the higher bpp drawing
+ functions (Henrik Harmsen)
+
+ o Additions to p9000im.c: p9000Image[Op]Stipple. And
+ p9000ImageFill. Currently, there are small problems with
+ ImageFill, and it is not being used. (Chris Mason)
+
+ o Added p9000PixAlu and p9000PixOpAlu. miniterm->alu transla-
+ tion for pixel1 opaque and transparent operations. (Chris
+ Mason)
+
+ o Added p9000text.c: Non-cached poly text and image text func-
+ tions. Image text functions are not used because they are
+ too slow :( (Chris Mason)
+
+ 1995.05.21:
+
+ o Fixed p9000init.c to properly deal with the vram_128 option.
+ This should allow the driver to work properly with all
+ Viper's with 1 MB of memory. (Erik Nygren)
+
+ 1995.01.29:
+
+ o Updated P9000.sgml to mention using Robin's scanpci rather
+ than PCIDUMP.EXE.
+
+ 1995.01.15:
+
+ o Fixed problem with line capping in accelerated line drawing.
+ (Chris Mason)
+
+ o Fixed p9000QuadAlu[GXset] to be ~0 rather than 1. (Erik
+ Nygren)
+
+ 1995.01.14:
+
+ o Clocks line is no longer used in XF86Config file. Operation
+ should now be consistent with the operation of the other
+ servers which use programmable clocks. (Erik Nygren)
+
+ o Users with 1MB cards can now explicitly specify videoRam in
+ the XF86Config file when autoprobing fails. The new
+ vram_128 option may also be used to force the detection of
+ 128Kx8 SIMM's. (Erik Nygren)
+
+ o Added p9000line.c and p9000seg.c for accelerated line draw-
+ ing code using the p9000 quad/clipping engine. Blazingly
+ fast for 1 clipping rectangle, could be made faster for mul-
+ tiple clipping regions by using software clipping. There is
+ still a bug which causes xtest to report Cap style incorrect
+ for thin line and CapNotLast for the XDrawLines tests but
+ not for the XDrawLine or XDrawSegments tests [fixed in
+ 1995.01.15 patch]. (Chris Mason)
+
+ o Changed p9000blt.c, and p9000win.c to wait for the quad/blit
+ engine to be free. Before a quad/blit, check SR_ISSUE_QBN,
+ then blit, then when all blits are done, do a p9000QBNot-
+ Busy. (Chris Mason)
+
+ o Changed p9000init.c to clear the screen using the quad meta
+ coord drawing mode. Appears the rect mode does not update
+ the CINDEX register correctly. Changed the color to 1
+ (black) from 0. (Chris)
+
+ o Added p9000QuadAlu. When drawing a quad, the p9000 equiva-
+ lent to X's source is the foreground mask. When blit-
+ ing/pixel8ing/pixel1ing, it is the p9000 source mask and the
+ p9000alu lookup table should be used. (Chris Mason)
+
+ o Added some more registers to p9000reg.h. (Chris Mason)
+
+ 1994.09.20:
+
+ o Fixed problem which prevented 16 bpp modes from working
+ (Erik Nygren)
+
+ 1994.09.16:
+
+ o Added screen blanking support for 16 bpp and 32 bpp modes.
+ Screen blanking now powers down the RAMDAC rather than just
+ changing the planemask. (Chris Mason, Erik Nygren)
+
+ o Fixed more problems caused by switch to XF86Config (Erik
+ Nygren)
+
+ o Possible fix to maxclock for Orchid P9000 (Harry Langen-
+ bacher, Erik Nygren)
+
+ 1994.09.15:
+
+ o Now almost always works with XF86Config changes (Erik
+ Nygren)
+
+ o Cursor code looks at VTSema before writing to RAMDAC. This
+ had been causing the x11perf server crash (Erik Nygren)
+
+ 1994.09.08:
+
+ o Fixed problem with xdm and restarting the server (Erik
+ Nygren)
+
+ o Fixed and enabled ImageRead in CopyArea (Chris Mason)
+
+ o Made informational comments conform to standard :-) (Erik
+ Nygren)
+
+ 1994.09.05:
+
+ o Fixed BIOS probe for Viper PCI (Bob Hollinger)
+
+ o Fixes to Orchid P9000 support (Harry Langenbacher)
+
+ o Changing of datatypes in clock code (Harry Langenbacher)
+
+ o Fixed clock and misc reg restoration so now works fine with
+ svgalib (Chris Mason, Harry, Erik)
+
+ 1994.08.29:
+
+ o Increased number of memory regions in xf86_OSlib.h from 2 to
+ 3 as needed by the Viper PCI (Erik Nygren)
+
+ o Changed method of short pauses in p9000vga.c to outb(0x80,0)
+ (Erik)
+
+ o Rewrote routines to determine sysconfig from horizontal res-
+ olution. Also added check for valid hres to probe. (Erik
+ Nygren)
+
+ o Added MoveWindow acceleration for all depths. Opaque move
+ even looks nice at 32bpp now! (Chris Mason)
+
+ o Minor fixes to acceleration. Acceleration is now enabled by
+ default (Chris Mason)
+
+ o Added "noaccel" option (Erik Nygren)
+
+ o Added some fixes for Viper PCI (Matt Thomas)
+
+ 1994.07.21:
+
+ o Preliminary Viper PCI support - totally untested so disabled
+ (Erik Nygren)
+
+ o Preliminary Orchid P9000 support - incomplete and totally
+ untested so disabled (Erik Nygren)
+
+ o Preliminary accelerated support - incomplete and not fully
+ tested so disabled (Erik Nygren and Chris Mason)
+
+ 1994.07.08:
+
+ o 16 and 32 bpp TrueColor support (Erik Nygren)
+
+ o Color restoration hopefully fixed (Erik Nygren)
+
+ o Changes to how "Modes" line in Xconfig is processed
+
+ o Removed banking support :-(
+
+2. Supported Cards
+
+2.1 Diamond Viper VLB
+
+All Viper VLB's should work with this server, hopefully... :-) Due to Dia-
+mond's putting the same BIOS in some Viper VLB's as are used in Viper PCI's,
+the probe may detect you have a Viper PCI when you really have a Viper VLB.
+If this happens, put chipset "vipervlb" into your XF86Config file.
+
+2.2 Diamond Viper PCI
+
+You may need to specify the chipset "viperpci" in your XF86Config file.
+
+Previously you had to find out the values for MemBase and IOBase by yourself.
+These are now autodetected.
+
+3. Orchid P9000 and random clones
+
+The Orchid P9000 and other cards based on the Weitek board design (such as
+the STAR 2000) should now work. Talk to harry@brain.jpl.nasa.gov if you have
+problems with this. Specify the chipset "orchid_p9000" in the Device section
+of XF86Config
+
+4. Viper Pro and other P9100 and P9130 cards (UNSUPPORTED!!!)
+
+These are NOT supported yet by this server, but are supported in the p9x00
+driver of the SVGA server.
+
+5. Acceleration
+
+Some of the acceleration code is working, but there are probably still bugs.
+Only a very small number of accelerated features have been implemented.
+Before working on any acceleration, please contact nygren@mit.edu so we don't
+duplicate efforts. Acceleration may be turned off with the "noaccel" option.
+The following things are now accelerated:
+
+ o Hardware cursor (8/16/32bpp)
+
+ o MoveWindow (8/16/32bpp)
+
+ o CopyArea (8bpp)
+
+6. XFree86-DGA Extension Support
+
+The XFree86-DGA extension is now supported. Note that XF86DGASetViewPort
+command is not fully implemented due to hardware limitations of the P9000.
+The SetViewPort and SetVidPage commands have been hacked to allow double
+buffering under certain conditions.
+
+For cards with 1MB or modes where xres*yres*Bpp > 1024K, no double buffering
+is supported. In this case, the bank size returned is equal to the amount of
+video memory. Using the XF86DGASetViewPort and XF86DGASetVidPage commands
+have no results.
+
+For cards with 2MB and for modes where virtualX*virtualY*Bpp < 1024K, the
+behaviors of SetViewPort and SetVidPage are modified to allow double buffer-
+ing. The bank size returned by XF86DGAGetVideo is equal to xres*yres*Bpp.
+In this mode, there are two buffers which can be written to, read from, and
+displayed. The XF86DGASetVidPage command can be used to switch between
+buffers 0 and 1 for I/O. Whichever buffer is selected will be available
+through the linear aperture with no offset. If XF86DGASetViewPort is called
+with ypos < yres, it will cause buffer 0 to be displayed. If ypos >= yres,
+buffer 1 will be displayed. The result of this behavior is that programs
+which switch banks as necessary and which use two vertically adjacent banks
+should work with no P9000-specific changes.
+
+7. High Color and TrueColor
+
+Support for 16 and 24 bit truecolor is now supported. Note that 24 bit color
+is really 32 bits per pixel. Use the -bpp option when starting the server.
+Examples:
+
+ startx -- -bpp 32
+ startx -- -bpp 16
+ startx -- -bpp 16 -weight 555
+ startx -- -bpp 16 -weight 565
+
+Note that many programs do not yet work properly with these modes. Don't
+tell me. Tell the authors unless they've already fixed it. It's their
+fault... :-)
+
+Example problems:
+
+ xv 3.00
+ Works fine in 32 bpp and in 16 bpp with 24 bit images. Has prob-
+ lems with colors in 8 bit images in 8 bpp mode.
+
+ Mosaic 2.1
+ Has problems with colormap in both 16 bpp and 32 bpp. Newer ver-
+ sions of Mosaic such as 2.4 do work.
+
+ mpeg_play
+ Doesn't work at all in 16 bpp mode. Works fine 24 bpp mode when
+ compiled with -DRS6000 and when run with ``-dither color''
+
+ xpaint 2.1
+ Works great in both modes but has a bug in the color requester
+ for the selection tool. I think later versions may have fixed
+ this.
+
+8. Random Notes
+
+Text restoration should now be fixed. Color restoration should also be
+fixed. You can now even run the server at the same time as svgalib pro-
+grams!!!
+
+Diamond has actually been fairly open and helpful. No NDA's were signed by
+anyone who wrote code and Diamond claims that none of the information they
+provided is proprietary.
+
+One unresolved issue is the maximum clock speed. It is currently set to 135
+MHz with a warning printed over 110 MHz. Diamond claims that this is the max
+in their docs, but examination has shown some Viper's to contain 110 MHz
+bt485's. Without 135 MHz, it is not possible for people to with large moni-
+tors to run at 1280x1024. Diamond claims that all Vipers have 135MHz bt485's
+or compatibles. If you have something slower, call their tech support and
+they will send you a RMA to get the board replaced.
+
+9. Operating System Notes
+
+Any operating system that can memory map linear regions in really high memory
+should work. This should include Linux, FreeBSD, SVR4, and more.
+
+9.1 NetBSD
+
+If you have NetBSD, you will need to install the aperture driver. Extract
+the file apNetBSD.shar (in xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar)
+and read the README contained therein.
+
+10. XF86Config
+
+The modes line in the XF86Config file is now handled differently. The vir-
+tual line is now ignored entirely. Each mode on the mode line is looked at
+and the first usable mode is selected (ie the first one which works with
+available memory, etc). Any other modes which are valid and have the same
+dimensions are also used. And other modes are ignored.
+
+The current supported keywords in the Device section of the XF86Config file
+are:
+
+ VideoRAM
+ 1024 or 2048 (use 2048 for ``3MB'' Orchid P9000's)
+
+ ChipSet
+ "vipervlb" or "viperpci" or "orchid_p9000"
+
+ MemBase
+
+ Viper VLB:
+ 0xA0000000 or 0x20000000 or 0x80000000 (0x80000000 is
+ default if none spec'd)
+
+ Orchid P9000:
+ 0xC0000000 or 0xD0000000 or 0xE0000000 (this MUST be
+ set to correspond to the jumpers)
+
+ Viper PCI:
+ any value corresponding to the output of PCIDUMP.EXE
+
+ IOBase
+
+ Viper PCI:
+ any value corresponding to the output of PCIDUMP.EXE
+
+ Others:
+ unused
+
+ Clocks
+ any values between 25 and 135 corresponding to the clocks for the
+ mode entries being used. This line may now be omitted and clocks
+ will be matched automatically.
+
+ Option
+
+ "sw_cursor"
+ use software cursor
+
+ "vram_128"
+ use if you have 1024K VRAM in 128Kx8 SIMMS
+
+ "sync_on_green"
+ generate sync pulses on the green signal. Most
+ (all?) P9000 based boards don't support this.
+
+ "noaccel"
+ do not do hardware acceleration if it's causing prob-
+ lems for you
+
+ Modes
+ almost any valid mode (there are constraints on the horiz res so
+ not all values are possible)
+
+The current supported keywords in the Display section of the XF86Config file
+are:
+
+ Depth
+
+ 8:
+ use 8 bits per pixel for 256 colors (default)
+
+ 15 or 16:
+ use 16 bits per pixel for up to 65K colors
+
+ 24 or 32:
+ use 32 bits per pixel (sparse 24 bpp) for up to 16
+ million colors
+
+ Weight
+ 555 or 565 if Depth is 15 or 16. Otherwise this is ignored.
+ These are the Red, Green, and Blue bits per pixel (default=565)
+
+Here's a portion of a sample XF86Config file for the Viper VLB:
+
+ Section "Device"
+ Identifier "ViperVLB"
+ VendorName "Diamond"
+ BoardName "Viper VLB"
+ Videoram 2048 # This is mandatory
+ Membase 0x80000000 # This is mandatory on non-ViperVLB's
+ IOBase 0xe000 # Use this ONLY on ViperPCI's
+ EndSection
+
+ Section "Screen"
+ Driver "accel"
+ Device "ViperVLB"
+ Monitor "NEC4FGe"
+ Subsection "Display"
+ Depth 8 # This line is optional
+ Modes "1024x768" "800x600"
+ EndSubsection
+ EndSection
+
+11. Known Bugs
+
+There are currently problems with the server when used in conjunction with
+xdm, olvwm, and VT switching under Linux.
+
+If the cursor changes while you're in a VT, the cursor won't look right when
+you return from the VT until it is moved between windows (and changes color
+and shape).
+
+Memory probing does not work. You will need to explicitly specify the amount
+of memory you have. If you have a 1 MB card, try put VideoRAM 1024 into the
+Device section of your XF86Config file. If this doesn't work, try adding
+Option "vram_128" to the Device section.
+
+12. Credits
+
+Major contributors to P9000 code:
+
+ o Erik Nygren (nygren@mit.edu)
+
+ o Harry Langenbacher (harry@brain.jpl.nasa.gov)
+
+ o Chris Mason (clmtch@osfmail.isc.rit.edu)
+
+ o Henrik Harmsen (harmsen@eritel.se)
+
+Thanks to Matt Thomas (thomas@lkg.dec.com) and Bob Hollinger (bob@interac-
+cess.com) for helping to get the Viper PCI server working.
+
+Special thanks to David Moews (dmoews@xraysgi.ims.uconn.edu) whose banking
+patch could unfortunately not be included.
+
+Thanks to Andy, David, Dave, Jon, Michael, Bob, all the XFree86 core team
+people, and everyone else!
+
+During the course of the next few months, people will be working on accelera-
+tion, etc. Please send any patches to me (nygren@mit.edu).
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/P9000.sgml,v 3.22 1999/08/23 06:38:51 dawes Exp $
+
+ $XConsortium: P9000.sgml /main/9 1996/05/12 20:58:05 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.P9000,v 3.38 1999/08/23 07:03:46 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.S3 b/xc/programs/Xserver/hw/xfree86/doc/README.S3
new file mode 100644
index 000000000..fd9c5cdd7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.S3
@@ -0,0 +1,813 @@
+ Information for S3 Chipset Users
+
+ The XFree86 Project Inc.
+
+ 27 February 1998
+
+1. Supported hardware
+
+The current S3 Server supports the following S3 chipsets: 911, 924, 801/805,
+928, 732 (Trio32), 764, 765, 775, 785 (Trio64*), 864, 868, 964, 968 and M65
+(Aurora64V+). The S3 server will also recognise the 866, but it has not been
+tested with this chipset. If you have any problems or success with these,
+please report it to us.
+
+Nevertheless, this is not enough to support every board using one of these
+chipsets. The following list contains some data points on boards that are
+known to work. If your card is similar to one of the described ones, chances
+are good it might work for you, too.
+
+ S3 801/805, AT&T 20C490 (or similar) RAMDAC
+
+ o Orchid Fahrenheit 1280+ VLB
+
+ o Actix GE32
+
+ 8 and 15/16 bpp
+
+ Note: Real AT&T20C490 RAMDACs should be automatically detected by
+ the server. For others which are compatible, you need to provide
+ a `Ramdac "att20c490"' entry in your XF86Config.
+
+ Real AT&T 20C490 or 20C491 RAMDACs work with the "dac_8_bit"
+ option. Some clones (like the Winbond 82C490) do not.
+
+ The Orchid Fahrenheit 1280+ VLB may require `Option "nolinear"'.
+
+ S3 805 VLB, S3 GENDAC (RAMDAC + clock synthesizer)
+
+ o MIRO 10SD (available for VLB and PCI) It is not known
+ whether all 10SDs use the S3 GENDAC.
+
+ 8 and 15/16 bpp
+
+ ClockChip "s3gendac"
+ RamDac "s3gendac"
+
+ S3 801/805, AT&T 20C490 RAMDAC, ICD2061A Clockchip
+
+ o STB PowerGraph X.24 S3 (ISA)
+
+ 8 and 15/16 bpp
+
+ Note: Real AT&T20C490 RAMDACs should be automatically detected by
+ the server. For others which are compatible, you need to provide
+ a `Ramdac "att20c490"' entry in your XF86Config.
+
+ ClockChip "icd2061a"
+ RamDac "att20c490"
+ Option "dac_8_bit
+
+ S3 805, Diamond SS2410 RAMDAC, ICD2061A Clockchip
+
+ o Diamond Stealth 24 VLB
+
+ 8 and 15bpp(*) only.
+
+ requires `Option "nolinear"'
+
+ (*) The SS2410 RAMDAC is reportedly compatible with the
+ AT&T20C490 in 15bpp mode. To make the server treat it as an
+ AT&T20C490, you need to provide a `Ramdac "att20c490"' entry in
+ your XF86Config.
+
+ S3 801/805, Chrontel 8391 Clockchip/Ramdac
+
+ o JAX 8241
+
+ o SPEA Mirage
+
+ 8 and 15/16 bpp.
+
+ The 8391 is compatible with the AT&T 20C490 RAMDAC
+
+ ClockChip "ch8391"
+ Ramdac "ch8391"
+ Option "dac_8_bit"
+
+ S3 928, AT&T 20C490 RAMDAC
+
+ o Actix Ultra
+
+ 8 and 15/16 bpp
+
+ Note: Real AT&T20C490 RAMDACs should be automatically detected by
+ the server. For others which are compatible, you need to provide
+ a `Ramdac "att20c490"' entry in your XF86Config. Also, the
+ server's RAMDAC probe reportedly causes problems with some of
+ these boards, and a RamDac entry should be used to avoid the
+ probe.
+
+ Real AT&T 20C490 or 20C491 RAMDACs work with the "dac_8_bit"
+ option. Some clones (like the Winbond 82C490) do not.
+
+ S3 928, Sierra SC15025 RAMDAC, ICD2061A Clockchip
+
+ o ELSA Winner 1000 ISA/EISA (``TwinBus'', not Winner1000ISA!!)
+
+ o ELSA Winner 1000 VL
+
+ 8, 15/16 and 24(32) bpp
+
+ Supports 8bit/pixel RGB in 8bpp and gamma correction for 15/16
+ and 24bpp modes
+
+ 24 bpp might get ``snowy'' if the clock is near the limit of
+ 30MHz. This is not considered dangerous, but limits the usability
+ of 24 bpp.
+
+ D-step (or below) chips cannot be used with a line width of 1152;
+ hence the most effective mode for a 1 MB board is about
+ 1088x800x8 (similar to 2 MB, 1088x800x16).
+
+ ClockChip "icd2061a"
+
+ S3 928, Bt9485 RAMDAC, ICD2061A Clockchip
+
+ o STB Pegasus VL
+
+ 8, 15/16 and 24(32) bpp
+
+ Supports RGB with sync-on-green if "sync_on_green" option is pro-
+ vided and board jumper is set for BNC outputs.
+
+ VLB linear addressing now occurs at 0x7FCxxxxx so that 64MB or
+ more main memory can be supported without losing linear frame
+ buffer access.
+
+ ClockChip "icd2061a"
+ Option "stb_pegasus"
+
+ S3 928, Bt485 RAMDAC, SC11412 Clockchip
+
+ o SPEA Mercury 2MB VL
+
+ 8, 15/16 and 24(32) bpp
+
+ ClockChip "SC11412"
+ Option "SPEA_Mercury"
+
+ S3 928, Bt485 RAMDAC, ICD2061A Clockchip
+
+ o #9 GXE Level 10, 11, 12
+
+ 8, 15/16 and 24(32) bpp
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 928, Ti3020 RAMDAC, ICD2061A Clockchip
+
+ o #9 GXE Level 14, 16
+
+ 8, 15/16 and 24(32) bpp
+
+ Supports RGB with sync-on-green
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 864, AT&T20C498, ICS2494 Clockchip
+
+ o MIRO 20SD (BIOS 1.xx)
+
+ The ICS2494 is a fixed frequency clockchip, you have to use X
+ -probeonly (without a Clocks line in XF86Config) to get the cor-
+ rect clock values.
+
+ 8, 15/16 and 24(32) bpp
+
+ S3 864, AT&T20C498 or STG1700 RAMDAC, ICD2061A or ICS9161 Clockchip
+
+ o Elsa Winner1000PRO VLB
+
+ o Elsa Winner1000PRO PCI
+
+ o MIRO 20SD (BIOS 2.xx)
+
+ o Actix GraphicsENGINE 64 VLB/2MB
+
+ 8, 15/16 and 24(32) bpp
+
+ ClockChip "icd2061a"
+
+ S3 864, 20C498 or 21C498 RAMDAC, ICS2595 Clockchip
+
+ o SPEA MirageP64 2MB DRAM (BIOS 3.xx)
+
+ 8, 15/16 and 24(32) bpp
+
+ Clockchip support is still sometimes flaky and on some machines
+ problems with the first mode after startup of XF86_S3 or after
+ switching back from VT have been seen; switching to next mode
+ with CTRL+ALT+``KP+'' and back seems to solve this problem.
+
+ Interlaced modes don't work correctly.
+
+ Mirage P64 with BIOS 4.xx uses the S3 SDAC.
+
+ ClockChip "ics2595"
+
+ S3 864, S3 86C716 SDAC RAMDAC and Clockchip
+
+ o Elsa Winner1000PRO
+
+ o MIRO 20SD (BIOS 3.xx)
+
+ o SPEA MirageP64 2MB DRAM (BIOS 4.xx)
+
+ o Diamond Stealth 64 DRAM
+
+ 8, 15/16 and 24 bpp
+
+ S3 864, ICS5342 RAMDAC and Clockchip
+
+ o Diamond Stealth 64 DRAM (only some cards)
+
+ 8, 15/16 and 24 bpp
+
+ ClockChip "ics5342"
+ Ramdac "ics5342"
+
+ S3 864, AT&T21C498-13 RAMDAC, ICD2061A Clockchip
+
+ o #9 GXE64 - PCI
+
+ 8, 15/16, 24(32) bpp
+
+ ClockChip "icd2061a"
+ Option "number_nine"
+
+ S3 964, AT&T 20C505 RAMDAC, ICD2061A Clockchip
+
+ o Miro Crystal 20SV
+
+ 8, 15/16, 24(32) bpp
+
+ ClockChip "icd2061a"
+ Ramdac "att20c505"
+
+ S3 964, Bt485 RAMDAC, ICD2061A Clockchip
+
+ o Diamond Stealth 64
+
+ 8, 15/16, 24(32) bpp
+
+ ClockChip "icd2061a"
+
+ S3 964, Bt9485 or AT&T 20C505 RAMDAC, ICS9161a Clockchip
+
+ o SPEA Mercury 64
+
+ 8, 15/16, 24(32) bpp
+
+ ClockChip "ics9161a"
+ Option "SPEA_Mercury"
+
+ S3 964, Ti3020 RAMDAC, ICD2061A Clockchip
+
+ o Elsa Winner2000PRO PCI
+
+ 8, 15/16, 24(32) bpp
+
+ ClockChip "icd2061a"
+
+ S3 964, Ti3025 RAMDAC, Ti3025 Clockchip
+
+ o Miro Crystal 40SV
+
+ o #9 GXE64 Pro VLB
+
+ o #9 GXE64 Pro PCI
+
+ 8 bpp, 15, 16 and 24(32) bpp
+
+ There are some known problems with the GXE64 Pro support, includ-
+ ing some image shifting/wrapping at 15/16/24 bpp.
+
+ We have found that #9 no longer support the GXE64 Pro at
+ 1600x1200. They do however have a new (and more expensive) board
+ called the GXE64Pro-1600 which uses a 220MHz RAMDAC instead of
+ 135MHz part used on the other boards.
+
+ S3 764 (Trio64)
+
+ o SPEA Mirage P64 (BIOS 5.xx)
+
+ o Diamond Stealth 64 DRAM
+
+ o #9 GXE64 Trio64
+
+ 8/15/16/24 bpp
+
+ Note: The Trio64 has a builtin RAMDAC and clockchip, so the
+ server should work with all Trio64 cards, and there is no need to
+ specify the RAMDAC or clockchip in the XF86Config file.
+
+ S3 732 (Trio32)
+
+ o Diamond Stealth 64 DRAM SE
+
+ 8/15/16/24 bpp
+
+ Note: The Trio32 has a builtin RAMDAC and clockchip, so the
+ server should work with all Trio32 cards, and there is no need to
+ specify the RAMDAC or clockchip in the XF86Config file.
+
+ S3 868, S3 86C716 SDAC RAMDAC and Clockchip
+
+ o ELSA Winner 1000AVI
+
+ o Diamond Stealth Video DRAM
+
+ 8/15/16/24 bpp
+
+ S3 868, AT&T 20C409 RAMDAC and Clockchip
+
+ o ELSA Winner 1000AVI
+
+ 8/15/16/24 bpp
+
+ Note: pixelmultiplexing is not supported yet, therefore limited
+ maximum dot clock for 8bpp (currently 67.5MHz, should be changed
+ to 100MHz if pixmux isn't fixed prior to release)
+
+ S3 968, Ti3026 RAMDAC, Ti3026 Clockchip
+
+ o Elsa Winner 2000PRO/X-2 and /X-4 (Revsions <= F)
+
+ o Elsa Winner 2000AVI-2 and -4
+
+ o Diamond Stealth 64 VIDEO VRAM
+
+ 8/15/16/24 bpp
+
+ S3 968, Ti3026 RAMDAC, ICS9161A Clockchip
+
+ o Elsa Winner 2000PRO/X-2 and /X-4 (Revision G)
+
+ 8/15/16/24 bpp
+
+ Note: clock doubling doesn't work, yet, therefore the maximum
+ usable dot clock is limited to about 120MHz.
+
+ S3 964, IBM RGB 514/524/525/528 RAMDAC & Clockchip
+
+ o Hercules Graphics Terminator 64
+
+ 8/15/16/24 bpp
+
+ s3RefClk 50
+ DACspeed 170
+ Option "slow_vram"
+
+ S3 968, IBM RGB 514/524/525/528 RAMDAC & Clockchip
+
+ o Genoa Genoa VideoBlitz III AV
+
+ s3RefClk 50
+ DACspeed 170
+
+ o Hercules Graphics Terminator Pro 64
+
+ s3RefClk 16
+ DACspeed 220
+
+ This card may require the line:
+
+ Invert_VCLK "*" 0
+
+ in each Display subsection.
+
+ o STB Velocity 64
+
+ s3RefClk 24
+ DACspeed 220
+
+ o Number Nine FX Motion 771
+
+ s3RefClk 16
+ DACspeed 220
+
+ This card may require the line:
+
+ Invert_VCLK "*" 0
+
+ in each Display subsection.
+
+ o MIRO 80SV
+
+ s3RefClk 16
+ DACspeed 250
+
+ 8/15/16/24 bpp
+
+ ELSA Winner 2000PRO/X-8 (S3 968, 8MB VRAM, 220MHz for 32bpp)
+ The server has only been tested for "revision C" of this card
+ (guess the serial number should start with C, but not sure since
+ mine says Ser.No. A-0000.000.000;) which have an IBM RGB528A
+ note the A; can't be probed though)
+
+ depending on the mode line etc there may be some display distor-
+ tions like:
+
+ 1. many long horizontal lines/stripes
+
+ 2. pixel jitter or short horizontal stripes like snow all over
+ the screen
+
+ 3. Like 2., but only when doing graphics ops (like opaque move
+ of windows).
+
+ 4. additional pixel at the left display edge and some missing
+ pixels at the right edge.
+
+ All of these problems can be fixed by small adjustments to the
+ mode line (best to run `xvidtune' and make these adjustments
+ interactively). E.g., for the first three problems, shift the
+ display left or right a few steps. For the last problem,
+ increasing HSyncEnd (making the hsync pulse longer) solves the
+ problem. In some cases, a significant increase in the sync pulse
+ width is needed, and rarely, it needs to be shortened (by
+ decreasing HSyncEnd).
+
+ In rare cases, InvertVCLK and/or EarlySC may need to be adjusted,
+ followed by an adjustment of BlankDelay (see the bottom line of
+ xvidtune).
+
+ If you see any of these problems, please contact
+ koenig@XFree86.org, and send details of:
+
+ o Original mode showing the problem,
+
+ o Tuned/fixed mode, including all flags from the bottom line
+ of xvidtune,
+
+ o Colour depth used for this tuned mode line,
+
+ o Full server startup output.
+
+2. 16bpp and 32bpp
+
+On 801/805 + AT&T490 Cards (like the Fahrenheit 1280+ VLB) only 15 and 16bpp
+are supported. 32bpp isn't available on this type of card. (There is a 24 bit
+mode under MS Windows, but it's not a 32bpp sparse mode but a real 3
+bytes/pixel mode).
+
+3. List of Supported Clock Chips
+
+ ICD2061A ==> ClockChip "icd2061a"
+ ICS9161A (ICD2061A compatible) ==> ClockChip "ics9161a"
+ DCS2824-0 (Diamond, ICD2061A comp.) ==> ClockChip "dcs2824"
+
+ S3 86c708 GENDAC ==> ClockChip "s3gendac"
+ ICS5300 GENDAC (86c708 compatible) ==> ClockChip "ics5300"
+
+ S3 86c716 SDAC ==> ClockChip "s3_sdac"
+ ICS5342 GENDAC ==> ClockChip "ics5342"
+ STG 1703 ==> ClockChip "stg1703"
+
+ Sierra SC11412 ==> ClockChip "sc11412"
+ ICS2595 ==> ClockChip "ics2595"
+ TI3025 ==> ClockChip "ti3025"
+ TI3026 ==> ClockChip "ti3026"
+ IBM RGB 5xx ==> ClockChip "ibm_rgb5xx"
+
+ Chrontel 8391 ==> ClockChip "ch8391"
+
+ AT&T 20C409 ==> ClockChip "att20c409"
+ AT&T 20C499 (untested) ==> ClockChip "att20c499"
+
+4. List of Supported RAMDAC Chips
+
+If you have a RAMDAC that is not listed here, be VERY careful not to over-
+drive it using XF86_S3. Better contact the XFree86 team first to verify that
+running XF86_S3 will not damage your board.
+
+RAMDACs that are grouped together below are treated as compatible with each
+other as far as the server is concerned. For example, the server will report
+"bt485" when you actually specify RAMDAC "bt9485", or "s3_gendac" when you
+specify RAMDAC "ics5300".
+
+ ATT20C409 ==> RAMDAC "att20c409"
+
+ ATT20C490 ==> RAMDAC "att20c490"
+ ATT20C491 ==> RAMDAC "att20c491"
+ CH8391 ==> RAMDAC "ch8391"
+
+ ATT20C498 ==> RAMDAC "att20c498"
+ ATT21C498 ==> RAMDAC "att21c498"
+
+ ATT22C498 ==> RAMDAC "att22c498"
+
+ ATT20C505 ==> RAMDAC "att20c505"
+
+ BT485 ==> RAMDAC "bt485"
+ BT9485 ==> RAMDAC "bt9485"
+
+ IBMRGB514 ==> RAMDAC "ibm_rgb514"
+ IBMRGB525 ==> RAMDAC "ibm_rgb525"
+
+ IBMRGB524 ==> RAMDAC "ibm_rgb524"
+ IBMRGB526 ==> RAMDAC "ibm_rgb526"
+
+ IBMRGB528 ==> RAMDAC "ibm_rgb528"
+
+ S3_GENDAC ==> RAMDAC "s3gendac"
+ ICS5300 ==> RAMDAC "ics5300"
+
+ S3_SDAC ==> RAMDAC "s3_sdac"
+ ICS5342 ==> RAMDAC "ics5342"
+
+ S3_TRIO32 ==> RAMDAC "s3_trio32"
+
+ S3_TRIO64 ==> RAMDAC "s3_trio64"
+ S3_TRIO64 ==> RAMDAC "s3_trio"
+
+ SC11482 ==> RAMDAC "sc11482"
+ SC11483 ==> RAMDAC "sc11483"
+ SC11484 ==> RAMDAC "sc11484"
+
+ SC11485 ==> RAMDAC "sc11485"
+ SC11487 ==> RAMDAC "sc11487"
+ SC11489 ==> RAMDAC "sc11489"
+
+ SC15025 ==> RAMDAC "sc15025"
+
+ STG1700 ==> RAMDAC "stg1700"
+
+ STG1703 ==> RAMDAC "stg1703"
+
+ TI3020 ==> RAMDAC "ti3020"
+
+ TI3025 ==> RAMDAC "ti3025"
+
+ TI3026 ==> RAMDAC "ti3026"
+
+ None of the above ==> RAMDAC "normal"
+
+If you feel adventurous you could also open up your computer and have a peek
+at your RAMDAC. The RAMDAC is usually one of the larger chips (second or
+third largest chip that is NOT an EPROM) on the board. The markings on it
+are usually
+
+ <Company logo>
+
+ <company identifier><part number>-<speed grade>
+ <manufacturing week><manufacturing year>
+ <lot number><other funny numbers>
+
+For example:
+
+ @@
+ @@ AT&T
+
+ ATT20C490-11
+ 9339S ES
+ 9869874
+
+This is an AT&T 20C490 with a speed grade of 110 MHz. This would then mean
+that you put a `DacSpeed 110' line in your XF86Config file. Be advised that
+some RAMDACs have different modes that have different limits. The manufac-
+turer will always mark the chip naming the higher limits, so you should be
+careful. The S3 server knows how to handle the limits for most of the RAM-
+DACs it supports providing the DacSpeed is specified correctly.
+
+Chips labeled -80 or -8 should use `DacSpeed 80' in the device section.
+
+ S3 86C716-ME SDAC ==> DacSpeed 110
+ SC15025-8 ==> DacSpeed 80
+ ATT20C490-80 ==> DacSpeed 80
+
+ IBM 8190429 ==> DacSpeed 170
+ IBM 03H5428 ==> DacSpeed 170
+ IBM 03H6447 ==> DacSpeed 170
+ IBM 03H6448 ==> DacSpeed 220
+ IBM 03H5319 ==> DacSpeed 220
+ IBM 63G9902 ==> DacSpeed 250
+
+ IBM 37RGB514CF17 ==> DacSpeed 170
+ IBM 37RGB524CF22 ==> DacSpeed 220
+ ^^
+
+5. Additional Notes
+
+Note that the Sierra SC1148{5,7,9} will not be distinguished from the Sierra
+SC1148{2,3,4} by the probe. The only difference between the two series as far
+as the server is concerned is that the {2,3,4} is capable of 15bpp, while the
+{5,7,9} is capable of 16bpp. So if you have a SC1148{5,7,9} and want to use
+16bpp instead of 15bpp, you will have to specify a RAMDAC "sc11485" line as
+shown above.
+
+Some RAMDACs (like the Ti3025) require some mode timing consideration for
+their hardware cursor to work correctly. The Ti3025 requires that the mode
+have a back porch of at least 80 pixel-clock cycles. A symptom of this not
+being correct is the HW cursor being chopped off when positioned close to the
+right edge of the screen.
+
+6. Reference clock value for IBM RGB 5xx RAMDACs
+
+Cards with IBM RGB5xx RAMDACs use several different input frequencies for the
+clock synthesizer which can't be probed without some knowledge of the text
+mode clocks (which may be a wrong assumption if you're using non-standard
+text modes). Here is the procedure you should use to find out the input fre-
+quency:
+
+First run
+
+ X -probeonly >& outfile
+
+and check the output for the probed clock chip which might look like this:
+
+ (--) S3: Using IBM RGB52x programmable clock (MCLK 66.000 MHz)
+ (--) S3: with refclock 16.000 MHz (probed 15.952 & 16.041)
+ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
+
+there will be a "good guessed" value which will be used and two probed values
+in brackets based on the 25MHz and 28MHz text clocks. This probing can only
+work if you run a normal 80x25 or 80x28 text mode!
+
+The refclock values known so far are:
+
+ STB Velocity 64 24 Mhz
+ Genoa VideoBlitz II AV 50 MHz
+ Hercules S3 964 50 MHz
+ Hercules S3 968 16 MHz
+ #9 Motion 771 16 MHz
+
+depending on the quartz on your card and maybe other features like an addi-
+tional clock chip on the Genoa card (which as a 14.3MHz quartz).
+
+If you claim that your card has a 16MHz clock, but it really uses 50MHz, all
+pixel clocks will be tripled and a 640x480 mode with 25MHz will use a 75MHz
+pixel clock, so be very careful.
+
+If you found the right refclock, you should set it in the config file (device
+section) e.g. with
+
+ s3RefClk 16
+
+or
+
+ s3RefClk 50
+
+so that that this value will be used even if you use another text mode and
+probing fails!
+
+7. Hints for LCD configuration (S3 Aurora64V+)
+
+If LCD is active the CRT will always output 1024x768 (or whatever is the
+_physical_ LCD size) and smaller modes are zoomed to fit on the LCD unless
+you specify Option "lcd_center" in the device section.
+
+The pixel clock for this physical size (e.g. 1024x768) mode...
+
+ o ...can explicitly set in the config file (device section) with e.g.
+ `Set_LCDClk 70' (resulting 70 MHz pixel clock being used for all modes
+ when LCD is on)
+
+ o ...is taken from the _first_ mode in the modes line iff this mode's dis-
+ play size is the same as the physical LCD size
+
+ o ...the default LCD pixel clock of BIOS initialisation setup is used.
+ This value is output at server startup in the line `LCD size ...' unless
+ you're specifying a value using `Set_LCDClk ...'
+
+If LCD is _not_ active, the normal mode lines and pixel clocks are used for
+the VGA output.
+
+Whenever you switch output sources with Fn-F5, the Xserver won't get informed
+and pixel clock and other settings are wrong. Because of this you have to
+switch modes _after_ switch output sources! Then the server will check which
+outputs are active and select the correct clocks etc. So the recommended key
+sequence to switch output is
+
+Fn-F5 Ctrl-Alt-Plus Ctrl-Alt-Minus
+
+and everything should be ok..
+
+on the Toshiba keypad you can first hold down Ctrl-Alt, then press `Fn' addi-
+tionally before pressing Plus/Minus too to avoid to explicitly enable/disable
+the numeric keypad for mode switching.
+
+8. How to avoid ``snowing'' display while performing graphics operations
+
+For cards with the S3 Vision864 chip, there is an automatic correction which
+depends on the pixel clock and the memory clock MCLK at which the S3 chip
+operates. For most clock chips this value can't be read (only the S3 SDAC
+allows reading the MCLK value so far), so this value has to be estimated and
+specified by the user (the default is 60 [MHz]).
+
+With the new `s3MCLK' entry for your XF86Config file, now you can specify
+e.g.
+
+ s3MCLK 55
+
+for a 55 MHz MCLK which will reduce snowing. Smaller MCLK values will reduce
+performance a bit so you shouldn't use a too low value (55 or 50 should be a
+good guess in most cases).
+
+Below is a small shell script which might be useful to determine the approxi-
+mate value for MCLK (about +/- 1-2 MHz error). Before running this script you
+have to add the line
+
+ s3MNadjust -31 255
+
+to the device section in your XF86Config file and restart X Windows. With
+this option (which is for testing and debugging only) you'll get lots of dis-
+astrous display flickering and snowing, so it should be removed again immedi-
+ately after running the test script below.
+
+Running this script will use xbench and/or x11perf to run a test to determine
+the MLCK value, which is printed in MHz. Up to 4 tests are run, so you'll get
+up to 4 estimates (where the first might be the most accurate one).
+
+ #!/bin/sh
+
+ exec 2> /dev/null
+
+ scale=2
+
+ calc() {
+ m=`awk 'BEGIN{printf "%.'$scale'f\n",'"( $1 + $2 ) / $3; exit}" `
+ [ -z "$m" ] && m=` echo "scale=$scale; ( $1 + $2 ) / $3" | bc `
+ [ -z "$m" ] && m=` echo "$scale $1 $2 + $3 / pq" | dc `
+ echo $m
+ }
+
+ run_xbench() {
+ r=` ( echo 1; echo 2; echo 3; echo 4 ) | xbench -only $1 | grep rate `
+ [ -z "$r" ] && return
+ cp="$2 $3"
+ set $r
+ calc $3 $cp
+ }
+
+ run_x11perf() {
+ r=` x11perf $1 | grep trep | tr '(/)' ' ' `
+ [ -z "$r" ] && return
+ cp="$2 $3"
+ set $r
+ calc `calc 1000 0 $4` $cp
+ }
+
+ run_x11perf "-rect500 -rop GXxor" 3.86 5.53 # 0 1 # 4.11 5.52 #
+ run_xbench invrects500 4.63 5.48 # 0 1 # 4.69 5.48 #
+
+ run_x11perf "-rect500 -rop GXcopy" -16.42 13.90 # 0 1 # -14.99 13.88 #
+ run_xbench fillrects500 -7.81 13.57 # 0 1 # -8.53 13.58 #
+
+ exit
+
+9. New S3 SVGA driver
+
+There is a new experimental S3 driver for non-ViRGE S3 chipsets in the
+XF86_SVGA server. This is definitely an ALPHA quality driver and hasn't been
+well tested, and has some known problems. Because of this, the configuration
+programs will install XF86_S3 by default rather than this one. But if you're
+adventurous or had some problems with XF86_S3, you might want to give it a
+try.
+
+The driver includes generic S3 support which should work on all non-ViRGE S3
+chips (in theory, that is). It also has improved support for chips that sup-
+port S3's new style memory mapped I/O. These chips include the 868, 968 and
+recent Trio64 variants (not the plain old Trio64s). Chips that are capable
+of using the new style MMIO will use it automatically. The option "NO_MMIO"
+can be used to turn this off.
+
+Performance for chips using the new style MMIO is expected to be better than
+XF86_S3, especially on a PCI bus. Performance without MMIO, however, is
+expected to be roughly comparable to XF86_S3 (faster in some areas, slower in
+others).
+
+All color depths achievable with XF86_S3 should be possible with these
+drivers. Additionally, packed 24 bpp "sort of" works for the 868 and 968.
+Your results may vary.
+
+Nearly all the options and features supported by XF86_S3 are supported by
+this driver. Additionally, the standard XAA/SVGA server options such as
+NO_ACCEL, SW_CURSOR, and NO_PIXMAP_CACHE are also supported. XF86_S3 fea-
+tures which are NOT supported in this driver are DPMS support and gamma cor-
+rection.
+
+The driver supports the PCI_RETRY option when using MMIO and a PCI card.
+This option can give large performance boosts for some operations, but has a
+tendency to hog the bus. Because of this, the option is not set by default.
+Most hardware combinations may not have any problems using this option, but
+sound card glitches during intensive graphics operations have been reported
+on some.
+
+One shortcoming worth noting is that this driver does not yet contain the
+work-around for some S3 PCI BIOSs that report their memory usage incorrectly.
+This can result in conflicting address spaces. If this is the case on your
+hardware you should run XF86_S3 once and write down the address that your
+card is relocated to (as printed out in the server output). Then you can
+force the server to use this address with the MemBase field in the XF86Config
+(see the man page on XF86Config).
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/S3.sgml,v 3.38 1999/08/23 06:38:52 dawes Exp $
+
+ $XConsortium: S3.sgml /main/14 1996/02/21 17:45:58 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.S3,v 3.54 1999/08/23 07:03:47 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.SCO b/xc/programs/Xserver/hw/xfree86/doc/README.SCO
new file mode 100644
index 000000000..3dcc5cb97
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.SCO
@@ -0,0 +1,552 @@
+ Information for SCO Users
+
+ J. Kean Johnston (hug@netcom.com)
+
+ 30 November 1996
+
+1. Binary Distribution
+
+The following files are provided in the binary distribution:
+
+ README.SCO
+ This file.
+
+ gunzip.Z
+ The GNU uncompress utility.
+
+ *X312Xdoc.tgz
+ The XFree86 specific documentation.
+
+ X312Mono.tgz
+ The Mono server
+
+ X312VG16.tgz
+ The 16 colour VGA server
+
+ X312SVGA.tgz
+ The Super VGA server
+
+ X312S3.tgz
+ The S3 server
+
+ X3128514.tgz
+ The 8514 server
+
+ X312AGX.tgz
+ The AGX server
+
+ X312Mc32.tgz
+ The Mach 32 server
+
+ X312Mc64.tgz
+ The Mach 64 server
+
+ X312Mc8.tgz
+ The Mach 8 server
+
+ X312P9k.tgz
+ The P9000 server
+
+ *X312cfg.tgz
+ The local configuration files for xdm/fs/xinit.
+
+ *X312bin.tgz
+ The bin directory, contains most executables.
+
+ *X312lib.tgz
+ The shared and unshared libraries.
+
+ *X312fnt1.tgz
+ 75dpi and misc fonts.
+
+ X312fnt2.tgz
+ 100dpi and Speedo fonts.
+
+ *X312inc.tgz
+ The X11 include files.
+
+ X312man.tgz
+ The formatted man pages.
+
+ X312lkit.tgz
+ The server link kit (all drivers + PEX).
+
+ X312util.tgz
+ Lots of PD utilities provided as is.
+
+ X312pex.tgz
+ All files relating to PEX including libraries and
+ header files. The LinkKit is required to obtain
+ servers capable of running PEX.
+
+To obtain a minimum XFree86 installation you will require the archives marked
+with a `*' above, the server binary best suited to your machine and option-
+ally "gunzip.Z". All the files are compressed with "gzip" except of course
+"gunzip.Z" which is compressed using the conventional compress program.
+
+To install the XFree86 binaries just follow these steps.
+
+ 1. Obtain the files you require.
+
+ The rest of this procedure must be done as root. If you do not run the
+ extraction as root the permissions on the files will not be correct.
+ For example, the `X' server is s-bit root and will not function cor-
+ rectly if extracted as an ordinary user.
+
+ 2. create a directory /usr/X11R6, permissions 755 should do nicely.
+
+ 3. cd /usr/X11R6
+
+ 4. extract the archives, for example:
+
+ gunzip < X312bin.tgz | tar xvpf -
+
+ 5. if you have installed man pages see the later section on setting up man
+ pages.
+
+ 6. Look through /usr/X11R6/lib/X11/doc/INSTALL, especially section 2 on
+ configuring and using XFree86. This should allow you to get a server
+ up and running. Before starting the server check in the later section
+ Before Running XFree86 (section 3., page 1), in this document, to see
+ if there are any system requirements you have to make for the server to
+ operate correctly.
+
+2. Source Distribution
+
+The SCO port comes as part of the standard XFree86 distribution. Consult the
+XFree86 README for more information on the location of sources.
+
+Please note that as of XFree86 3.2, Only SCO Open Server Release 5 and
+onwards are supported. If you are using a previous version of SCO UNIX and
+you want to use XFree86, use the 3.1 series, or be prepared for build fail-
+ures.
+
+For people who want and need to look around the source, there are now two
+files in ``xc/config/cf''. Firstly, ``sco.cf'' is the old original SCO con-
+figuration file, and ``sco5.cf'', which is the currently used configuration
+file.
+
+3. Before Running XFree86
+
+The SCO xterm terminfo description is not compatible with the xterm in the R5
+distribution.
+
+To use a Bus/Keyboard or PS2 mouse you should configure the mouse drivers
+under SCO as above using 'mkdev mouse'. You may then use the OsMouse option
+in your XF86Config to specify that XFree86 should use the SCO mouse drivers.
+To do this, set the Protocol to "OsMouse" in the Pointer section of your
+XF86Config file. You can also use "OsMouse" for your serial mouse, espe-
+cially if you are having trouble getting your mouse to work using the XFree86
+mouse drivers.
+
+If you do not have the SCO TCP/IP package installed do not panic. XFree86
+will work fine without TCP/IP but you will most likely have to do some or all
+of these things:
+
+ o Do not worry about errors from the X server complaining about
+ ``/dev/socksys''. The X server is configured to run on systems with and
+ without TCP/IP. This error is just pointing out that you do not have
+ TCP/IP and that this method of connecting to the server has been dis-
+ abled.
+
+ o Do worry about errors involving ``/dev/spx'' or the ``sco'' connection
+ type. This means something is wrong with the streams pipes that are
+ used for connections on the local machine. First be sure that your
+ server has the ``s-bit'' set. You can do this by running this command
+ for the X server you are using:
+
+ ls -al /usr/X11R6/bin/XF86_XXXXXX
+
+ The output should contain the `s' character instead of the `x' charac-
+ ter. For example:
+
+ -rwsr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3
+
+ is correct while:
+
+ -rwxr-xr-x 1 root bin 1074060 Jul 24 11:54 XF86_S3
+
+ is not.
+
+ o you may have to install streams into the kernel with ``mkdev streams''
+ Check the SCO Manuals for more information on this.
+
+ o you may have to configure some devices in /dev, check in the "Trouble
+ Shooting" section of this document for the entry which comments on
+ ``/dev/spx'' and ``Xsco''.
+
+ o Your streams resources may be configured too low. You should check your
+ streams parameters against the following values, if the are higher then
+ you do not need to changes them. To check these values, login as root,
+ change directory to ``/etc/conf/cf.d'' and then run ``./configure''.
+
+ Once you are running configure, choose the ``Streams Data'' option and
+ step through the entries. Just press <ENTER> at each prompt unless you
+ want to change a value. The values to look for, and their minimum val-
+ ues, are:
+
+ NSTREAM 128
+ NQUEUE 512
+ NBLK4096 4
+ NBLK2048 32
+ NBLK1024 32
+ NBLK512 32
+ NBLK256 64
+ NBLK128 256
+ NBLK64 256
+ NBLK16 256
+ NBLK4 128
+ NUMSP 128
+
+ You will not normally need to change any of these, if however you do
+ have to change some, configure will confirm that you want to save the
+ changes before exiting, and will give you further instructions on
+ rebuilding the unix kernel.
+
+4. Switching Consoles
+
+XFree86 uses similar console switching keys as the SCO R4 and R5 servers.
+That is, Ctrl-PrntScr takes you to the next console along from the one X is
+running on. If this is the last console it will take you to console 1. Ctrl-
+Alt-FXX, where XX is a function key between F1 and F12 will switch you to the
+console number assigned to that function key. F1 corresponds to tty01 (or
+console 1), F2 corresponds to tty02 (or console 2) etc. Those interested in
+modifying the console switching should look in xc/pro-
+grams/Xserver/hw/xfree86/common/xf86Events.c.
+
+5. Setting up Man Pages
+
+After compiling the tree, or after installing the binary distribution you can
+get man to recognise the XFree86 man pages by adding /usr/X11R6/man to the
+MANPATH in /etc/default/man, the line should look similar to:
+
+ MANPATH=/usr/man:/usr/X11R6/man
+
+This allows all users to view the X man pages. You may change your own MAN-
+PATH environment variable if you do not want everyone to access the man
+pages.
+
+By default the man pages are compressed using ``compress'' to conserve space.
+If you do not want to compress the man pages change CompressManPages to NO in
+your ``xf86site.def'' file. Those using the binary distribution can use
+``uncompress'' to uncompress the man pages.
+
+6. Using SCO binaries/servers.
+
+XFree86 will accept connections from SCO binaries (R3 upwards) and the SCO R5
+server will also accept connections from XFree86 binaries. This means you may
+mix and match the two if you have ODT. For example you may still use the
+Motif window manager (mwm) if you prefer.
+
+7. Compiling XFree86 under Open Server 5
+
+As of GCC version 2.8.0, Open Server is supported. Configure it by using the
+following:
+
+ ./configure i486-sco3.2v5.0
+
+There is no reason to modify gcc in any way. It compiles cleanly on Open
+Server 5.
+
+SCO Open Server 5.0 is recognised automatically by XFree86. You do not need
+to specify any BOOTSTRAPCFLAGS parameters when doing a make World. You can
+ignore the warning message about BOOTSTRAPCFLAGS at the very beginning of a
+make World.
+
+ 1. Fine tune ``site.def/xf86site.def''
+
+ Use GCC if you can. XFree should compile with the DevSys cc, but GCC
+ has better optimizations, and is guaranteed to work.
+
+ 2. SCO Open Server comes with Visual TCL, which is an old (and incompati-
+ ble) version of TCL. If you want to use XF86Setup you will have to com-
+ pile Tcl and Tk yourself. Both are supported well on SCO Open Server 5.
+ Tcl 7.6 and Tk 4.2 are available from ftp://ftp.smli.com/pub/tcl.
+
+ 3. You may want to disable dynamic loading support. Several users have
+ reported trouble with this. XIE and PEX5 definitely do not work. If you
+ want to experiment, try enabling this. Please report successes or fail-
+ ures to me.
+
+ 4. Do not enable the HasSVR3mmapDrv as you may have done in older versions
+ of SCO. Open Server 5 has full mmap() support, and this is used for
+ direct frame buffer access.
+
+ 5. If you know you will not ever be using COFF binaries, and you are short
+ of space, set ForceNormalLib to NO. Doing this will cause only the ELF
+ versions of the libraries to be built. ``sco5.cf'' sets this to YES by
+ default, so you must explicitly set it to NO in ``xf86site.def''. All
+ binaries are compiled in ELF mode to reduce space.
+
+8. Relevant Documentation
+
+Some relevant documentation for SCO Users and Developers can be found in the
+following files.
+
+ README
+ the standard XFree86 README (/usr/X11R6/lib/X11/doc)
+
+ README.SVR3
+ Although a lot of this readme is based on Interactive a substan-
+ tial proportion is still relevant.
+
+ All of the VGA/Config documentation.
+ /usr/X11R6/lib/X11/doc/VideoModes.doc and the README files for
+ particular video cards.
+
+9. Known Problems
+
+ o After running the server you may see some strange characters in your
+ input to the shell. This is due to some unprocessed scancodes and is of
+ no concern. This will be fixed in a future release.
+
+ o Not all of the applications in /usr/X11R6/bin have been debugged.
+
+10. Trouble Shooting
+
+ Problem:
+
+ The server does not start up, and I cannot tell what
+ is going wrong as it did not print any error messages.
+
+ Causes:
+
+ There can be any number of causes why the server
+ doesn't start. The first step is to find out what the
+ server has to say. To do this we have to catch the
+ error output of the server into a file. This output
+ contains a log of what the server is finding/doing as
+ it starts up. To get this output run:
+
+ startx 2> /tmp/errs
+
+ The output of the server will now be in "/tmp/errs".
+ You should look through this output for possible prob-
+ lems, and then check here in this document for any
+ references to the problems you are seeing.
+
+ Problem:
+
+ The server starts up, the screen goes blank, and I
+ never see anything else. It appears that my machine
+ has hung.
+
+ Causes:
+
+ Again this can have many causes. Most likely your
+ XF86Config is wrong. You should be able to kill the
+ server by typing Ctrl-Alt-BackSpace, if it is still
+ running. If this does not restore your display then
+ you may have to drive your system blind. Always keep
+ another login running at the shell prompt so that you
+ may switch to that screen and run commands even if you
+ cannot see anything on the screen. Try these things,
+ usually in the order given:
+
+ o log out of the login where you started ``X'' and
+ then change consoles. This will cause the SCO
+ screen switching code to try to reset the card.
+
+ o run ``vidi v80x25'', this command will also try
+ to set your card into a viewable mode.
+
+ o shutdown the machine cleanly with ``shutdown'' and
+ try again.
+
+ When first trying to get XFree86 to run, be sure to
+ use a simple setup. Get 640x480 working first then
+ move on to higher resolutions. Always trap the output
+ of the server as shown earlier. Once you have the
+ valid clocks for your video card (as provided in the
+ server output), hard code them into your XF86Config as
+ this will take some strain off your monitor during
+ XFree86 startup where it usually probes the various
+ clock frequencies. Getting the ``X'' screen to appear
+ can be a painfully slow task. Be patient and read as
+ much of the doco as you can handle. You will get it to
+ work.
+
+ Problem:
+
+ Fatal server error:
+ xf86MapVidMem:No class map defined for (XXXXX,XXXXX)
+
+ Causes:
+
+ 1. Your system does not have the correct
+ /etc/conf/pack.d/cn/class.h, You can confirm this
+ by editing the file and looking for the string
+ "SVGA", if it is not there then you should re-
+ install this file from the "Extended Utilities"
+ diskettes provided with your OS. If this is not
+ possible then installing the "dmmap" driver from
+ the distribution may allow the server to operate
+ correctly.
+
+ Problem:
+
+ xf86install does not work.
+
+ Causes:
+
+ You should not be running xf86install when using the
+ XFree86 server under SCO. It is used for Interactive
+ (ISC) installations.
+
+ Problem:
+
+ The server starts but the screen is not aligned cor-
+ rectly or is shaky and impossible to view.
+
+ Causes:
+
+ This is most likely due to an incorrect XF86Config
+ setup. Look for the files README.Config Video-
+ Modes.doc (in /usr/X11R6/lib/X11/doc with the binary
+ distribution). These files explains how to fix up your
+ video modes.
+
+ Problem:
+
+ 1. Can only run a limited number of xterms.
+
+ 2. xterm does not work but other programs like xclock do work.
+
+ Causes:
+
+ Not enough or no pseudo ttys devices are present on
+ your system. Run "mkdev ptty" and increase the number
+ of ptty's.
+
+ Problem:
+
+ When running curses/termcap applications in an xterm
+ the output gets corrupted especially when scrolling.
+
+ Causes:
+
+ 1. You are running an original 1.3 distribution of XFree86.
+ Update to the latest version (3.2 or greater).
+
+ 2. You have resized the window and not ran "eval `resize`"
+ before using your application. The SCO operating system
+ does not support dynamic resizing of xterms fully so this
+ command must be run after resizing an xterm in order for
+ curses/termcap applications to operate correctly.
+
+ Problem:
+
+ 1. When starting X it dies with an error "Cannot access a
+ needed shared library".
+
+ 2. When starting an X application is dies with the above
+ error.
+
+ Causes:
+
+ 1. You do not have the binaries installed in the correct
+ directory. Check that they are in /usr/X11R6
+
+ 2. You have upgraded to a new binary distribution which has a
+ new version of the shared libraries which are not compati-
+ ble with your old binaries. To fix this you will need to
+ re-install the old shared libraries or recompile your
+ application against the new libraries.
+
+ Problem:
+
+ When linking against the SCO motif library I get an
+ unresolved external for "XtDisplayStringConversionWarn-
+ ing" when using gcc.
+
+ Causes:
+
+ The SCO library is compiled with limited length identi-
+ fiers. To work around this add the following code to
+ your application when compiling under XFree86 with gcc
+ and SCO motif.
+
+ #ifdef SCO
+ void XtDisplayStringConversionWarnin(dpy, from, toType)
+ Display* dpy;
+ String from;
+ String toType;
+ { XtDisplayStringConversionWarning(dpy, from, toType); }
+ #endif
+
+ Problem:
+
+ The server fails to run and prints out a line similar
+ to:
+
+ XFree86: Cannot open /dev/spx for ???? listener: No
+ such file or directory
+
+ Causes:
+
+ All SCO unix installations appear to have the Streams
+ pseudo tty driver installed, but not all the devices
+ are present.
+
+ 1. there should be a /etc/conf/pack.d/sp directory,
+
+ 2. /etc/conf/sdevice.d/sp should have a 'Y' in it.
+
+ 3. You need a file in /etc/conf/node.d which con-
+ tains something like:
+
+ clone spx c sp
+ sp X0S c 127
+ sp X0R c 126
+ sp X1S c 125
+ sp X1R c 124
+ sp X2S c 123
+ sp X2R c 122
+ sp X3S c 121
+ sp X3R c 120
+ sp X4S c 119
+ sp X4R c 118
+ sp X5S c 117
+ sp X5R c 116
+ sp X6S c 115
+ sp X6R c 114
+ sp X7S c 113
+ sp X7R c 112
+
+ if you don't have something like this (maybe called
+ "Xsco") then create one and that should fix your prob-
+ lem. As far as I can tell the streams pseudo tty
+ driver should be there.
+
+ The simplest way to get the devices if you had to cre-
+ ate this file is to rebuild the kernel and the environ-
+ ment. If you don't want to do this then:
+
+ touch /etc/.new_unix
+ cd /etc/conf/bin
+ ./idmkenv
+
+ and try it out.
+
+11. Acknowledgements
+
+Thanks to the Core team for their previous and continuing help with the SCO
+work. Many thanks to Stacey Campbell at SCO for all the advice and insights
+provided. Thanks to SCO in general for making information available for
+XFree86 development.
+
+Thanks also to Peter Eubert (peter.eubert@iwb.mw.tu-muenchen.dbp.de) and Kent
+Hamilton (kenth@stl.scscom.COM) for input on compiling under 3.2.4 systems.
+Larry Plona (faxi@world.std.com) and Didier Poirot (dp@chorus.fr) for their
+input on xdm and 3.2.4 compilation under 3.1. And of course the beta list
+for its input on everything.
+
+Special thanks to Jerry Whelan (guru@stasi.bradley.edu) for providing an ftp
+site for the binary distribution.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SCO.sgml,v 3.17 1997/12/05 22:01:38 hohndel Exp $
+
+ $XConsortium: SCO.sgml /main/11 1996/10/23 11:45:55 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SCO,v 3.29 1999/04/15 03:34:55 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.SOLX86 b/xc/programs/Xserver/hw/xfree86/doc/README.SOLX86
new file mode 100644
index 000000000..da019cc99
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.SOLX86
@@ -0,0 +1,231 @@
+ Information for Solaris for x86 Users
+
+ David Holland
+
+ 25 Feb 1998
+
+1. What is XFree86
+
+XFree86 is a port of X11R6.3 that supports several versions of Intel-based
+Unix. It is derived from X386 1.2 which was the X server distributed with
+X11R5. This release consists of many new features and performance improve-
+ments as well as many bug fixes. The release is available as source patches
+against the X Consortium code, as well as binary distributions for many
+architectures.
+
+The sources for XFree86 are available by anonymous ftp from:
+
+ ftp://ftp.XFree86.org/pub/XFree86/current
+
+Solaris binaries for XFree86 are available for anonymous ftp from:
+
+ ftp://ftp.XFree86.org/pub/XFree86/current/binaries/Solaris
+
+2. Solaris for x86, versions on which XFree86 3.3.3 has been tested
+
+XFree86 3.3.2 has been actively tested on:
+
+ o Solaris 2.5.1 for x86
+
+ o Solaris 2.6 for x86
+
+3. The VT-switching sub-system in Solaris x86
+
+The virtual terminal sub-system is a undocumented, and unsupported feature of
+Solaris x86. Therefore if you use Virtual Terminals, you do so at YOUR OWN
+RISK.
+
+The virtual terminals of Solaris work basically the same way as most other
+Intel based SVR4 VT sub-systems. However, there are a number of limitations
+documented below.
+
+First, if you are running a Solaris 2.4 x86 system, and you want VT's, you
+will have to create the necessary devices first, so become root.
+
+First verify the chanmux device driver's major number is 100:
+
+ # grep -i chanmux /etc/name_to_major
+ chanmux 100
+ #
+
+If the number after 'chanmux' is anything but 100, I would suggest you imme-
+diately abort your attempt to create virtual terminals, and learn to live
+without them.
+
+However, if it is 100, then as root type the following commands to create the
+maximum allowable number of virtual terminals.
+
+ # cd /dev
+ # mknod vt01 c 100 1
+ # mknod vt02 c 100 2
+ # mknod vt03 c 100 3
+ # mknod vt04 c 100 4
+ # mknod vt05 c 100 5
+ # mknod vt06 c 100 6
+ # mknod vt07 c 100 7
+
+There is no need for a reconfiguration boot.
+
+Secondly, for both 2.1, and 2.4 x86 systems, add a few lines to the inittab
+to enable logins on them.
+
+(Note, do NOT make a mistake here, you could lock yourself out of the system)
+
+ --------------------->Snip Snip<-----------------------------------------------
+ v1:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT01 login: " -T AT386 -d /dev/vt01 -l console
+ v2:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT02 login: " -T AT386 -d /dev/vt02 -l console
+ v3:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT03 login: " -T AT386 -d /dev/vt03 -l console
+ v4:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` VT04 login: " -T AT386 -d /dev/vt04 -l console
+ ---------------------->End Here<-----------------------------------------------
+
+These four lines enable four VT's on Alt-SysReq-F1 through Alt-SysReq-F4.
+
+Then execute the command 'init q' to immediately enable the virtual termi-
+nals.
+
+The keys used for VT switching are as follows:
+
+ Alt-SysReq-F1 through Alt-SysReq-F7 enable VT screens 1-7 respec-
+ tively (if the VT is active).
+
+ Alt-SysReq-n enables the next active VT screen.
+
+ Alt-SysReq-p enables the previous active VT screen.
+
+ Alt-SysReq-h returns to the console.
+
+If you are using virtual terminals, you must leave at least one free for use
+by the Xserver.
+
+Limitations of the virtual terminal sub-system under Solaris x86:
+
+There are only a total of 8 available VT's (7 normal VT's + 1 console) not
+the usual 15. If you have all 8 allocated, and you attempt to allocate a
+additional VT you will panic the system. (This bug is worked around in the
+Solaris XFree86 Xserver.)
+
+From a programming stand point, they work pretty much as documented in the
+AT&T Unix System V/386 Release 4 Integrated Software Development Guide, how-
+ever a number of ioctl() calls are broken.
+
+4. Notes for building XFree86 on Solaris x86
+
+ 1. The majority of all modifications you will need to make are now in
+ ~xc/config/cf/xf86site.def.
+
+ 2. Both Gcc, and ProWorks are supported by XFree86. Gcc-2.5.8 or
+ gcc-2.7.2.3 are suggested, Gcc-2.6.0 is known not to work. You also
+ need to set HasGcc2 correctly in ~xc/config/cf/xf86site.def.
+
+ You should also make certain your version of GCC predefines `sun'.
+ 2.4.5 is known NOT to by default. If needed edit /usr/local/lib/gcc-
+ lib/*/*/specs, and modify the *predefines: line.
+
+ Note: A Threaded Xlib compiled with GCC has subtle problems. It'll
+ work 98% of the time, however clients will occasionally exhibit strange
+ hangs. Most notably image viewers such as xv-3.10 exhibit this problem.
+
+ It is recommended that you set ThreadedX in ~xc/config/cf/sun.cf to NO,
+ if you are using GCC. ProWorks does not have this problem.
+
+ 3. To build XFree86 with gcc you need gcc and (optionally) c++filt from
+ GNU binutils. Don't install gas or ld from GNU binutils, use the one
+ provided by Sun.
+
+ With XFree86 3.3.2, you will need to setup a /opt/SUNWspro/bin direc-
+ tory containing symbolic links named cc, CC, and c++filt pointing
+ respectively to the actual gcc, g++ and c++filt commands.
+
+ 4. If you don't have c++filt or if you have troubles in making World with
+ c++filt, you need to set UseExportLists to NO in ~xc/con-
+ fig/cf/host.def.
+
+ 5. If you are using ProWorks to compile the XFree86 distribution, you need
+ to modify your PATH appropriately so the ProWorks tools are available.
+ Normally, they should be in /opt/SUNWspro/bin
+
+ 6. You MUST put /usr/ccs/bin at the front of your PATH. There are known
+ problems with some GNU replacements for the utilities found there. So
+ the /usr/ccs/bin versions of these programs must be found before any
+ other possible GNU versions. (Most notably GNU 'ar' does not work dur-
+ ing the build).
+
+ 7. If you wish to use the "memory aperture" feature of the S3, and Mach32
+ servers, you need to compile, and install the Solaris x86 aperture
+ driver for memory mapped I/O support. This driver is REQUIRED for the
+ I128, P9000 and Mach 64 servers.
+
+ You need to set HasSolx86apertureDrv to YES in ~xc/con-
+ fig/cf/xf86site.def.
+
+ to enable the aperture driver.
+
+ Under Solaris 2.5 and later, there's a system driver (/dev/xsvc that
+ provides this functionality. It will be detected automatically by the
+ server, so you don't need to install the driver.
+
+ For Solaris 2.1 and 2.4, the source for this driver is included in
+ ~xc/programs/Xserver/hw/xfree86/etc/apSolx86.shar. Building, and
+ installing the driver is relatively straight forward. Please read its
+ accompanying README file.
+
+5. Notes for running XFree86 on Solaris x86
+
+ 1. If you have not made the Virtual Terminal devices, you will need to
+ specify the terminal device to run the Xserver on. The correct device
+ is vt00 so your xinit command would look like so:
+
+ xinit -- vt00
+
+ If you have made the virtual terminal devices you do not need to spec-
+ ify the VT to run the Xserver on.
+
+ To be able to run XF86Setup, you must at least create /dev/vt01. Other-
+ wise XF86Setup won't start.
+
+ 2. For Solaris you will probably want to set your LD_LIBRARY_PATH to
+ /usr/X11R6/lib:/usr/openwin/lib:/usr/dt/lib. Including /usr/X11R6/lib
+ in your LD_LIBRARY_PATH is probably not necessary, however it doesn't
+ hurt. :)
+
+ Including /usr/openwin/lib in the LD_LIBRARY_PATH is recommended
+ because some Sun supplied binaries were not compiled with LD_RUN_PATH
+ set properly at compile time.
+
+ Motif and CDE applications may require /usr/dt/lib in your
+ LD_LIBRARY_PATH too.
+
+ 3. Xqueue is NOT supported under Solaris. The includes necessary for
+ Xqueue are available, however the driver does not seem to be in the
+ kernel. (Go figure)
+
+ 4. If you want to use xdm with Solaris, extract the files from the shar
+ file in /usr/X11R6/lib/X11/etc/XdmConf.svr4 into a temporary directory.
+ The README file tells where the individual files need to be installed.
+ Be sure to read through each file and make any site-specific changes
+ that you need.
+
+6. Known bugs, and work arounds with Solaris x86
+
+ 1. The Solaris 2.1 for x86 OpenWindows filemgr does not work against a
+ X11R5 Xserver, it probably will also not work against a X11R6 Xserver.
+ Attempting to 'Drag and Drop' a file causes the filemgr to abort with a
+ 'X error'
+
+ Solaris 2.4 does not have this problem.
+
+ There is no known work around.
+
+7. Bug Notification
+
+Bug reports need to be sent to XFree86@XFree86.org, or posted to the
+comp.windows.x.i386unix newsgroup. Questions or comments about the Solaris
+support, or the Solaris distribution need to be made to davidh@use.com, or
+danson@lgc.com.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SOLX86.sgml,v 3.15 1999/08/23 06:38:52 dawes Exp $
+
+ $XConsortium: SOLX86.sgml /main/7 1996/10/28 05:43:28 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SOLX86,v 3.25 1999/08/23 07:03:49 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.SVR4 b/xc/programs/Xserver/hw/xfree86/doc/README.SVR4
new file mode 100644
index 000000000..253d6798f
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.SVR4
@@ -0,0 +1,408 @@
+ Information for SVR4 Users
+
+ The XFree86 Project, Inc
+
+ 27 Feb 1998
+
+ Abstract
+
+ NOTE: If you intend to use any of the accelerated servers, read
+ section 10 and follow the instructions. Otherwise the X server
+ will crash when exiting, restarting, or switching VTs.
+
+1. SVR4 versions on which XFree86 has been tested
+
+XFree86 has been tested on the following versions of SVR4.0:
+
+ o Microport: 2.2, 3.1, 4.1, 4.2
+
+ o Esix: 4.0.3A, 4.0.4, 4.0.4.1
+
+ o Dell: 2.1, 2.2, 2.2.1
+
+ o UHC: 2.0, 3.6
+
+ o Consensys: 1.2
+
+ o MST: 4.0.3
+
+ o AT&T: 2.1, 4.0
+
+ o ISC: 4.0.3
+
+ o NCR: MP-RAS
+
+ o PANIX: 5.0
+
+and the following versions of SVR4.2:
+
+ o Consensys
+
+ o Novell/SCO UnixWare 1.x and 2.0
+
+Basically, we believe that XFree86 binaries will run unmodified on any ISA,
+EISA, or MCA platform version version of SVR4.0 (Solaris 2.x is an excep-
+tion), or SVR4.2. If you run XFree86 on another version of SVR4 that's not
+in this list, please let us know about it.
+
+2. How to cope with VT-switching hotkeys
+
+Some versions of SVR4 (Esix and Microport) have mechanisms for enabling two-
+key sequences for VT switching (Alt-Fn). The standard SVR4 mechanism is Alt-
+SysReq-Fn, which all versions we know use. Running under X, the Alt-Fn
+sequences are stolen by the driver before the server can see them, so you
+can't use them for X applications. So you want to switch back to the stan-
+dard 3-key sequences while you are running X. Here's how to do it:
+
+ Microport
+ Microport makes this very simple. The 2-key mode is called
+ "Microport Mode", and the 3-key mode is called "Compatible Mode".
+ You enter Microport Mode by pressing Alt-SysReq-m. You enter
+ Compatible Mode by pressing Alt-SysReq-c. So all you need to do
+ is press Alt-SysReq-c after starting the X server to allow X
+ clients access to the Alt-Fn sequences.
+
+ Esix
+ Esix has no keyboard-driven way to switch modes. There are two
+ levels at which this can be handled:
+
+ 1. There is a kernel tunable that determines which mode is the
+ default. The tunable is the initialisation of kd_2keysw in
+ /etc/conf/pack.d/kd/space.c. When set to 1 (the default),
+ 2-key mode is enabled. When set to 0 it is disabled.
+
+ 2. The mode can be changed for individual VTs programatically
+ by an ioctl(). To make life easier for XFree86 users, a
+ program called `2key' is provided (in xc/pro-
+ grams/Xserver/hw/xfree86/etc/ in the source tree, and in
+ /usr/X11R6/lib/X11/etc/ in the binary kit). You can com-
+ pile and install this program. Then to make use of it, add
+ the line `VTInit "2key off"' to the Keyboard section of
+ your XF86Config file to cause the program to be run auto-
+ matically when the server starts up. Doing this means that
+ 2-key switching will be turned off while in the server's
+ VT, but will still be on for the other VTs.
+
+ For further details, refer to the keyboard(7) man page included
+ with the release notes (the on-line man page doesn't have this
+ information).
+
+3. Running SVR3 binaries on SVR4.0.4 and SVR4.2
+
+SVR4.0.4 added the `Advanced Compatibility Package', which provides iBCS-2
+compliance for running SVR3 binaries. These facilities are also present in
+SVR4.2. XFree86 makes use of this to accept local connections from SVR3
+clients. The XFree86 binary distribution is built to use these capabilities.
+You need to install the `Advanced Compatibility Package', if you have not
+done so already.
+
+We have found that SVR4.0.4 is not able to run all SCO, and perhaps not many
+ISC SVR3 binaries. This is not a failing of XFree86, but of SVR4 itself.
+One particular example is that many SVR3 programs are ignorant of the UFS
+filesystem, and attempt to read directories as files, rather than using the
+system call that is defined for the purpose. This will fail for obvious rea-
+sons. The SVR4.0.4 release notes from USL (which you should have gotten from
+your vendor) have lots of suggestions for how to improve compatibility.
+
+That said, we have had luck with several SCO binaries right out of the box.
+No changes are needed - just go to an xterm window and run the program.
+
+ISC users will need a binary editor before they can attempt to run their
+binaries. ISC, for whatever reason, put the pipe for local connections in
+/tmp/.X11-unix/Xn. This unfortunately is the same place as the X Consortium
+X server puts the Unix-domain socket normally used for local connections.
+The XFree86 server was modified to use /dev/X/ISCCONN/Xn for local connec-
+tions to ISC clients. So what you must do is use a binary editor to edit
+your client program. Search for /tmp/.X11-unix, and change it to /dev/X/ISC-
+CONN. Now you just have to worry about base-OS compatibility.
+
+4. Notes for building XFree86 on SVR4
+
+ 1. If you are using gcc with SVR4, we highly recommend that you use
+ gcc-2.4.5 (or a later stable release). Version 2.6.0 has some problems
+ on i386 platforms and is not recommended.
+
+ 2. It is recommended that you increase the UFSNINODE (for a UFS filesys-
+ tem) and/or the S5NINODE (for an S5 filesystem) kernel parameter to
+ about 650 before attempting to build the distribution. See the "Notes
+ for running XFree86 on SVR4" section for some other parameters you may
+ want to change.
+
+ 3. The BOOTSTRAPCFLAGS required are:
+
+ For Unixware: "-DUSL"
+
+ For NCR: "-DNCR"
+
+ For other SVR4: "-DSVR4 -Di386"
+
+5. Notes for running XFree86 on SVR4
+
+NOTE: If you intend to use any of the accelerated servers, read section 10
+and follow the instructions. Otherwise the X server will crash when exiting,
+restarting, or switching VTs.
+
+ 1. For SVR4, you may also need to add /usr/X11R6/lib to your
+ LD_LIBRARY_PATH, but this is not required for running properly built
+ clients.
+
+ 2. You may want to increase some kernel parameters (either by running
+ idtune, or editing /etc/conf/cf.d/stune, and rebuilding the kernel with
+ idbuild):
+
+ [HS]FNOLIM hard/soft limit for number of open files
+
+ MAXUP max number of processes per user
+
+ ARG_MAX max length of an arg list
+
+ SHMMAX max size of shared memory segment(in
+ bytes)
+
+ 3. Choose which mouse driver you will use. For SVR4 the best choice
+ depends on which version you are using. If you have a bus mouse then
+ Xqueue is probably the only option. For a serial mouse the options are
+ as follows:
+
+ Esix 4.0.3
+ Xqueue works. It is also possible to use the standard asy
+ driver directly, but the mouse operation is "jerky".
+
+ Microport SVR4 [34].1
+ Xqueue works fine, and the asy driver can also be used
+ directly giving smooth mouse operation.
+
+ To use Xqueue, set the Protocol to Xqueue in both the Keyboard and
+ Pointer sections of your XF86Config file, and You must have the mouse
+ driver package installed, and must run mouseadmin to set it up for your
+ mouse. If mouseadmin won't work try doing `touch /dev/gmse' before
+ running it. (Note that mouseadmin will need to be rerun after rebuild-
+ ing a kernel unless you add an appropriate entry to
+ /etc/conf/node.d/gmse.)
+
+ NOTE: Many of the accelerated server/drivers have problems when using a
+ HW cursor and Xqueue together. If you have a serial mouse, you can
+ work around this by not using Xqueue. Otherwise the only workaround is
+ to disable the HW cursor. This is done by adding the line:
+
+ Option "sw_cursor"
+
+ to the Device section of your XF86Config file. The S3 server is the
+ only one known to not have this problem.
+
+ If you have problems with both Xqueue and your standard asy driver with
+ SVR4, then you should install SAS. When using SAS, set up XF86Config
+ as you would for the standard driver.
+
+ SAS is available from ftp.physics.su.oz.au. When using SAS for a
+ serial mouse, you will get smoother operation if you change EVENT_TIME
+ from 80 to 30 in sas.h. A couple of details which aren't spelled out
+ in the SAS README are:
+
+ - An example of the line you should add to /etc/ap/chan.ap is:
+
+ MAJOR 0 255 ldterm ttcompat
+
+ where MAJOR is replaced by the major number used for SAS devices. To
+ determine what that is, check /etc/conf/cf.d/mdevice after rebuilding
+ the kernel. The major number is the sixth field in the line starting
+ with `sas'. This file must be updated before rebooting with the new
+ kernel.
+
+ - The installation instructions omit the following:
+
+ 3a) Disable the asy driver by either running `kconfig' or
+ editing /etc/conf/sdevice.d/asy.
+
+ 3b) Rebuild the kernel by running /etc/conf/bin/idbuild
+
+ 4. If you want to use xdm with SVR4, extract the files from the shar file
+ in /usr/X11R6/lib/X11/etc/XdmConf.svr4 into a temporary directory. The
+ README file tells where the individual files should be installed. Be
+ sure to read through each file and make any site-specific changes that
+ you need.
+
+ NOTE: Some SVR4 versions (one example is Esix 4.0.3) have a default
+ inittab which runs `vtgetty' on the console. This does not work well
+ when starting xdm at boot time. The problem is that when you logout
+ from a vtgetty session it wants to close all the VTs -- including the
+ one xdm is using for the server. It is recommended that you use
+ `getty'. If you change /etc/inittab, remember to also change
+ /etc/conf/cf.d/init.base or you will lose the changes when you next
+ rebuild the kernel.
+
+ 5. If you want to change the number of VTs available on SVR4, just edit
+ the file /etc/default/workstations and change the number there. The
+ device nodes will be created/deleted next time you reboot.
+
+ 6. The default local connection types have changed in X11R6. Unix domain
+ sockets are no longer treated as a "local" connection type. This means
+ that a client connecting to :0 will use not use a Unix socket for the
+ connection. To use the Unix socket connection, the client must connect
+ to unix:0.
+
+ The local connection types available are "NAMED" (named streams pipe),
+ "PTS" (old-stype USL streams pipe), "SCO" (SCO Xsight streams pipe),
+ and "ISC" (ISC streams pipe). The XLOCAL environment variable can be
+ used to set which types of local connection should be used in order of
+ preference. The default setting is PTS:NAMED:ISC:SCO. It is recom-
+ mended that NAMED be used in most cases because it is faster than the
+ default PTS, and because using PTS can cause you to run out of
+ /dev/pts/ devices (each client using PTS requires a /dev/pts device).
+ To set up the default local connection type, make sure that XLOCAL is
+ set and exported in your .xinitrc file (when using xinit or startx) or
+ your /usr/X11R6/lib/xdm/Xsession script (when using xdm).
+
+6. Building non-core clients with SVR4
+
+ 1. A lot of clients (even some which have explicit SVR4 support) require
+ -DSYSV when building under SVR4. This will not be set when using the
+ default configuration. A quick fix is to add something like the fol-
+ lowing to the client's Imakefile:
+
+ #if SystemV4
+ DEFINES = -DSYSV OTHER_CLIENT_DEPENDENT_DEFINES
+ #endif
+
+ The best solution is to modify the code so it compiles correctly with-
+ out -DSYSV.
+
+7. Using DOS/Merge 2.2 with XFree86
+
+It is possible to use the Locus DOS/Merge 2.2 X clients with XFree86. You
+need to do a couple of things for this to work, though. One change is a
+generic problem with the X client and X11R5/6; the others are to work with
+some things that are specific to the XFree86 servers. Here are the things
+you need to do:
+
+ 1. Set and export $XMERGE in your .xinitrc and/or .xsession files. In
+ general, you should set XMERGE=vga.
+
+ 2. You MUST use the "xqueue" driver instead of the server's native key-
+ board and mouse driver, if you intend to use the "zoom" feature of the
+ `dos' client. Otherwise the mouse will cease to function after the
+ first time you "zoom" (because the `dos' client uses the native driver,
+ and the server will not be able to access the mouse after the zoom
+ ends). The only other alternative is to use separate mice on separate
+ devices.
+
+ 3. You need to install the `dos' client fonts in the XFree86 font directo-
+ ries. Locate the BDF files (search for files with names matching the
+ pattern `*pc???.bdf'). These will likely be /usr/lib/X11/fonts/misc.
+ Go to the directory where these files are located, and execute the fol-
+ lowing (using `sh' or `ksh'):
+
+ for i in *pc???.bdf
+ do
+ /usr/X11R6/bin/bdftopcf $i > \
+ /usr/X11R6/lib/X11/fonts/misc/`basename $i .bdf`.pcf
+ done
+ cd /usr/X11R6/lib/X11/fonts/misc
+ /usr/X11R6/bin/mkfontdir
+ # Do this only if the server is already running.
+ /usr/X11R6/bin/xset fp rehash
+
+ 4. The `dos' client program uses a translation table to map from an inter-
+ nal key representation to the X keymap. It is likely that the table
+ supplied with Merge 2.2 use the mapping for SCO's server. A correct
+ mapping table is available in /usr/X11R6/lib/X11/etc/xcode.xfree86.
+ This file should be installed in /usr/lib/merge/xc. In addition, you
+ must add the following resource to the `dos' client's application-
+ defaults file (usually in /usr/lib/X11/app-defaults/DOS):
+
+ dos*xcodetable: /usr/lib/merge/xc/xcode.xfree86
+
+ It will be obvious if this new code table is needed, as the arrow keys
+ on the keypad will fail to function in the `dos' client if the wrong
+ table is installed.
+
+ 5. For the "zoom" feature to work correctly, you must run `dos' with $DIS-
+ PLAY set to "unix:N" or "host_name:N". If you use just ":0", the
+ client will not function properly. `dos' does not accept a `-display'
+ parameter. Hence it is probably a good idea to replace the `dos' pro-
+ gram with something like this:
+
+ #!/usr/bin/ksh
+ if [ "X${DISPLAY}" != "X" ]
+ then
+ case ${DISPLAY} in
+ :*)
+ DISPLAY=unix${DISPLAY}
+ ;;
+ esac
+ fi
+ /usr/bin/dos.real "$@"
+
+8. Keyboard mapping problems with some Esix systems
+
+One of the console driver patches for Esix 4.0.3A causes the XFree86 server's
+default keymap to be corrupted. If you are being affected by this problem it
+will be obvious because few (if any) of the keys will be mapped correctly.
+There are two solutions to this. One is to remove the console driver patch
+which introduced the problem. The second is to use xmodmap(1) to reset the
+default mapping after server startup. The default mapping is provided in the
+file /usr/X11R6/lib/X11/etc/xmodmap.std, and can be installed automatically
+by adding the line:
+
+ xmodmap /usr/X11R6/lib/X11/etc/xmodmap.std
+
+to your .xinitrc file (or your Xsetup file if using xdm).
+
+9. 106 Japanese keyboard problem on PANIX
+
+PANIX for PC-AT uses Japanese keycodes standardized by DICOP(Desktop UNIX for
+Intel Cooperative Promotion Group) in Japan. Therefore keycode confliction
+occurs with 106 Japanese keyboard in XFree86. To avoid it, specify the key-
+word "panix106" in XF86Config like this:
+
+ Section "Keyboard"
+ Protocol "Standard"
+ Autorepeat 500 5
+ XkbModel "jp106"
+ XkbLayout "jp"
+ panix106
+ EndSection
+
+10. A kernel patch that is required for accelerated servers
+
+SVR4.0 has a bug handling programs that access extended I/O registers (above
+0x3FF). Boards like S3 and 8514/A use these extended I/O registers. XFree86
+supports boards that tickle this bug. In preparation for using these
+servers, we have produced a kernel patch that works around the problem, and
+provided scripts for you that will both install and back out the patch. You
+must install this if you intend to use the S3, 8514, Mach8, Mach32, P9000,
+AGX or W32 servers.
+
+Dell 2.2 is known to not need the patch, because Thomas Roell found and fixed
+the bug while he was working for Dell. Microport has fixed this in their 4.0
+v4.2 release. Also, SVR4.2 does not need this patch, as the problem has been
+fixed by USL.
+
+The patch scripts are located in xc/programs/Xserver/hw/xfree86/etc in the
+source tree, and /usr/X11R6/lib/X11/etc in the binary distribution. The
+files are `svr4_patch' to install the patch, and `svr4_patch_rem' to back it
+out. The file that is being patched is /etc/conf/pack.d/kernel/os.o. The
+patch script verifies the presence of the bug before patching, and will tell
+you whether or not it succeeded in patching. You need to run the
+`svr4_patch' script as root, obviously. The original os.o file, as well as
+the patching program, and a copy of the removal script are stored in the
+directory /etc/conf/pack.d/kernel/.xfree86
+
+Thanks to John M. Sully of Microport for helping us find a simple workaround
+for this problem, and giving us permission to release the information.
+
+11. Other problems
+
+Some accelerated drivers may cause the machine to lockup when starting up the
+server on some versions of SVR4.0. The problem seems to be related to the
+kernel checking for the presence of physical memory when mmaping /dev/pmem.
+This can cause problems when mapping memory mapped registers. This was known
+to be a problem with the MGA driver in the SVGA server. Some other drivers
+may be affected too. The problem with the MGA driver is now fixed.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SVR4.sgml,v 3.16 1999/08/23 06:38:52 dawes Exp $
+
+ $XConsortium: SVR4.sgml /main/8 1996/10/27 11:06:06 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SVR4,v 3.27 1999/08/23 07:03:50 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.SiS b/xc/programs/Xserver/hw/xfree86/doc/README.SiS
new file mode 100644
index 000000000..897c4cf5a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.SiS
@@ -0,0 +1,117 @@
+ Information for SiS Users
+
+ Juanjo Santamarta (santamarta@ctv.es)
+
+ 17 April 1999
+
+1. Introduction
+
+This driver was primarily written for the SiS6326 and SiS530 by Alan Houri-
+hane. It also works on 5597/5598 chips, and probably on older SiS862XX fam-
+ily.
+
+The driver supports :
+
+ o Linear Addressing
+
+ o 8/15/16/24 bits per pixel
+
+ o Fully programmable clocks are supported
+
+ o H/W acceleration and cursor support
+
+ o XAA support (XFree86 Acceleration Architecture)
+
+2. Supported chips
+
+ SiS 530, SiS 86c201, SiS 86c202, SiS 86c2x5, SiS 5597/5598, SiS
+ 6326
+
+Color expansion is not supported by the engine in 16M-color graphic mode.
+
+3. XF86Config Options
+
+The following options are of particular interest for the SiS driver. Each of
+them must be specified in the `svga' driver section of the XF86Config file,
+within the Screen subsections of the depths to which they are applicable (you
+can enable options for all depths by specifying them in the Device section).
+
+ Option "SetMclk"
+ This option lets you to modify the memory clocking of your card.
+ (only for 5597 and 6326) Modifying the memory timings can destroy
+ the device, but usually the only ill effects of overclocking is
+ to have some noise an drawing errors, but BE CAREFUL. Usually a
+ little increment can improve the drawing speed, and allows also
+ higher dotclocks. The server reports default memclock on start-
+ ing messages, so take it as a base. Units are in KHZ.
+
+ Option "DacSpeed"
+ This option lets you to modify the maximum allowed dotclock).
+
+ Option "sw_cursor", "hw_cursor"
+ The default is for using the hardware cursor.
+
+ Option "Turboqueue"
+ 5597/8 and 6326 have the option to extend the engine command
+ queue on VRAM. With extended queue length, the driver only checks
+ queue status on some color-expansion commands. This gives some
+ performance improvement, but is possible to lose some commands,
+ corrupting screen output. As the size of extended command queue
+ is 16-32K, the probability is very low, but exists. The perfor-
+ mance gain observed is around 8-10%. Currently, using this option
+ will occasionally freeze the acceleration engine, causing weird
+ image display.
+
+ Option "FastVram"
+ Enables 1 cycle memory access. Try it. Increased memory bandwidth
+ reduces the possibility of glitches and noise on high resolution
+ modes.
+
+4. Modelines
+
+When constructing a modeline for use with the Sis driver you'll need to con-
+sider several points:
+
+ o H/W Acceleration. The H/W cursor, and fill operations currently allo-
+ cate memory of the video ram for there own use. If this is not avail-
+ able these functions will automatically be disabled. Also, Turboqueue
+ allocate 32k of Vram.
+
+ o Dot Clock. SiS documents the following video modes to work with 6326.
+ The max dot clock allowable for your 6326 based board depends also on
+ the memory installed on it. Option FastVram can be needed for high dot
+ clocks to work. Of course, the memory installed must allow 1 cycle R/W.
+
+ SiS recommended video modes for 6326:
+
+ 640x480 :
+ 4, 8, 15, 16, 24 bpp at 85Hz Non-interlaced
+
+ 800x600 :
+ 4, 8, 15, 16, 24 bpp at 85Hz Non-interlaced
+
+ 1024x768 :
+ 4, 8, 15, 16, 24 bpp at 85Hz Non-interlaced
+
+ 1280x1024 :
+ 4, 8, 15, 16, 24 bpp at 75Hz Non-interlaced
+
+ 1600x1200 :
+ 4, 8 bpp at 65Hz Non-interlaced
+
+5. Troubleshooting
+
+6326 based cards with more than 4Mb of RAM probably don't work.
+
+The generic VGA driver don't work with 6326, so XF86Setup can't be used for
+this card. Please use xf86config instead.
+
+Some video modes with high dot-clocks don't work at all, resulting on black
+screen. Lowering dotclock in that case could solve the problem.
+
+Document based on 3.3 version written by Xavier Ducoin.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SiS.sgml,v 3.5 1999/07/19 13:36:21 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.10 1999/07/19 14:44:23 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.Video7 b/xc/programs/Xserver/hw/xfree86/doc/README.Video7
new file mode 100644
index 000000000..a55fd4b32
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.Video7
@@ -0,0 +1,102 @@
+ README.VIDEO7
+
+ Craig Struble
+
+ 17 May 1994
+
+1. The Driver:
+
+The Video7 driver has only been tested on a Headland Technologies HT216-32
+chip, but should work on other Video 7/Headland Technologies chips as well.
+
+Currently this implementation of the video7 driver only supports single bank
+mode, which can cause performance degradation, and makes no attempt to dis-
+tinguish between the different video7 chips.
+
+It also does not probe for memory, so in your XF86Config file, make sure that
+you use the following line:
+
+ Videoram XXX
+
+Where XXX is the amount of RAM in your card. Most of them have at least 512k,
+so this is a good value to start with.
+
+Also, the clock probing function of XFree86 doesn't seem to correctly get the
+clocks. The documentation I used (vgadoc3) suggests using the following val-
+ues for the Clocks line in your XF86Config file:
+
+ Clocks 25.175 28.322 30.000 32.514 34.000 36.000 38.000 40.000
+
+For 800x600 mode, use a dot clock of 38 instead of 36 or 40 as suggested in
+most of the sample XF86Config files and modeDB.txt. This seems to be what is
+used in the BIOS mode (0x69) which is the 800x600 in 256 colors.
+
+2. Known bugs and What's been tested:
+
+2.1 Known bugs:
+
+ 1. No video ram probing. Only known way to get this info is through an INT
+ 10 call, but you can't do this in a user process.
+
+ 2. Clock probing. I'm not sure the docs in vgadoc3 are correct.
+
+ 3. Random lockups with the SVGA server
+
+2.2 What's been tested:
+
+ 1. An HT216-32 chip.
+
+ 2. 800x600 mode and 640x480 mode
+
+ 3. Mode switching and switching to text mode through CTRL-ALT-F1
+
+ 4. Only been tested on Linux.
+
+3. Who to contact:
+
+Craig Struble (cstruble@acm.vt.edu) Video 7 driver
+
+4. Acknowledgments
+
+4.1 Thanks to:
+
+ o Cara Cocking for loving me and supporting me. Without her I'd be a bowl
+ of jello.
+
+ o XFree86 team for the great stub code that allowed me to get this going.
+
+ o Finn Thoegersen for compiling vgadoc3. Without this I would not have had
+ a clue.
+
+ o Harm Hanemaayer for the vga.c program in svgalib. Without this I would
+ not have had the breakthroughs I needed to get the thing up and running.
+
+4.2 Other things I've already done:
+
+ For Linux, I have a small patch to get the extended text modes to
+ work on the Video 7 card.
+
+4.3 Things to do:
+
+ o Try dual banking mode.
+
+ o Write an svgalib driver.
+
+ o Go back to graduate school. (I'm a glutton for punishment.)
+
+4.4 Disclaimer:
+
+ CRAIG STRUBLE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFT-
+ WARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+ NESS. IN NO EVENT SHALL CRAIG STRUBLE BE LIABLE FOR ANY SPECIAL,
+ INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULT-
+ ING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CON-
+ TRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Video7.sgml,v 3.5 1997/01/24 09:32:34 dawes Exp $
+
+ $XConsortium: Video7.sgml /main/3 1996/02/21 17:46:22 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Video7,v 3.17 1999/04/15 03:34:57 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.WstDig b/xc/programs/Xserver/hw/xfree86/doc/README.WstDig
new file mode 100644
index 000000000..a4e3b4e4e
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.WstDig
@@ -0,0 +1,196 @@
+ Information for Western Digital Chipset Users
+
+ The XFree86 Project, Inc.
+
+ 14 July 1995
+
+1. Supported chipsets
+
+XFree86 supports the following Western Digital SVGA chipsets: PVGA1, WD90C00,
+WD90C10, WD90C11, WD90C24, WD90C30, WD90C31, WD90C33. Note that the rest of
+the WD90C2x series of LCD-controller chipsets are still not supported. The
+WD90C24 family is now supported including acceleration, adjustable clocks and
+a full 1MB video ram even on dual scan systems (in CRT mode). If you have
+trouble with the new WD90C24 support (not that we expect you will), try spec-
+ifying "wd90c30" or "wd90c31" on the `Chipset' line in your XF86Config file.
+The WD90C24, WD90C31 and WD90C33 are supported as an accelerated chipset in
+the SVGA server; the accelerated features are automatically activated when a
+WD90C24, WD90C31 or WD90C33 is detected, or specified in the XF86Config file.
+
+2. Special considerations
+
+All of the Western Digital chipsets after the PVGA1 support the ability to
+use the memory-refresh clock as an alternate dot-clock for video timing.
+Hence for all of these chipsets, the server will detect one more clocks than
+``normal''. What this means is that if you have an old `Clocks' line in your
+XF86Config file, you should comment it out, and rerun the server with the
+`-probeonly' option to find all of the clock values. All but the last should
+be the same as what you had before; the last will be new.
+
+For the WD90C00 chipset, the chipset will only support 640x480 in 256-color
+mode. Even though 512k of memory should allow better than 800x600, the
+chipset itself cannot do this. This is stated in the databook (which lists
+1024x768x16 and 640x480x256 for specifications). We have also witnessed this
+behavior.
+
+The server will detect 17 clocks for the WD90C24, WD90C30 and WD90C31
+chipsets. If you have one of these chipsets, you should let the server re-
+probe the clocks and update your XF86Config.
+
+There is an `Option' flag available for the XF86Config file that is specific
+to the Western Digital chipsets (except the WD90C24). This option is
+"swap_hibit". We have determined via experimentation that the WD90C1x and
+WD90C3x chipsets need the high-order clock-select bit inverted, and the PVGA1
+and WD90C00 need it non-inverted. This is hardcoded into the driver. Since
+our sample-set was rather small, we have provided the "swap_hibit" option to
+invert this behavior. If the clocks detected by the server show a very low
+last clock (under 28Mhz), then this option is likely needed.
+
+3. WD90C24 features
+
+These next three sections apply only if you have a WD90C24, WD90C24a, or
+WD90C24a2 and don't specify some other chipset in your XF86Config file. The
+SVGA pvga1 driver now recognizes the wd90c24 family as different from the
+WD90C30 and seems to resolve most of the problems people encountered when
+these chips were treated as WD90C3X. The new code has the following fea-
+tures:
+
+ o Locks the shadow registers at appropriate times; This should prevent
+ scrambled displays after exiting X with dual scan screens when simulta-
+ neous or LCD display mode is selected. The code does depend somewhat on
+ the behavior of the BIOS regarding when it locks the shadow registers,
+ etc.
+
+ o Allows (forces) the use of a full 1 Meg VRAM for dual scan systems when
+ the server is started while external CRT only display is in operation.
+ This allows 1024x768x8 resolution.
+
+ o If the XF86Config file specifies a virtual screen size which requires
+ more than 512 K VRAM when the server is started on a Dual Scan LCD, the
+ driver will force the virtual size to 640x480. This eliminates the need
+ to edit the XF86Config file when you switch from 1024x resolution on the
+ CRT, to or from the LCD screen. If no virtual size is specified, the
+ result will be 800x600 virtual in LCD modes and 1024x768 in CRT only
+ mode (so you have a choice).
+
+ o Note that on dual scan systems, you must still exit X, switch displays,
+ and restart X to change to/from CRT only with 1 Meg videoram. This is
+ because once the server starts, you can't change the virtual screen
+ size. There is no way around this with the current server and the
+ WD90C24 with dual scan displays. The WD90C24 requires half the videoram
+ be used for a ``Frame buffer'' when the dual scan LCD is in use.
+
+ o The new server uses the accelerated features of the WD90C24a. It is not
+ clear from the data book if the WD90C24 also supports ALL the required
+ features. Several people have stated that the WD90C24 is not acceler-
+ ated, but the differences section of the WD90c24a data book implies that
+ they ARE all three accelerated. The differences documented with regard
+ to acceleration are with the type of line drawing the hardware does;
+ Only the newer chips support the type of line drawing that MS windows
+ wants. This may be what has caused the confusion since the accelerated
+ windows drivers may only support the WD90c24a chips. If this turns out
+ to be a problem with the WD90C24, acceleration can be disabled by adding
+ the line:
+
+ Option "noaccel"
+
+ to the Device section of the XF86Config file.
+
+ o Although the new server does not support programmable clocks in the same
+ way as some of the other servers, 8 of the 17 clocks may be set to
+ (almost) any value via the Clocks line. It also supports options for
+ adjusting the VRAM clock.
+
+4. WD90C24 clocks
+
+Here are some more details on the adjustable clocks:
+
+The VRAM clock (Mclk) is adjusted by adding ONE of the following option lines
+to the Device section of the XF86Config:
+
+ Option "slow_dram" # Set Mclk to 47.429 MHz
+ Option "med_dram" # Set Mclk to 49.219 MHz
+ Option "fast_dram" # Set Mclk to 55.035 MHz
+
+The default is to leave Mclk as the BIOS sets it. This is 44.297 on many
+systems. Some systems may not work properly with any of these options. If
+you experience ``bit errors'' on your display, reduce the Mclk speed, or
+don't use any of these options. The Mclk is not reset on server exit.
+
+The data book says that the maximum pixel clock is 1.6 times Mclk so you may
+want to experiment with higher Mclk rates if you have a fast monitor. It
+also says a 44.297MHz Mclk and 65MHz pixel clock is the fastest the WD90C24A2
+is designed to go. However, some success has been reported with faster
+clocks. Don't expect all the clocks the chip can provide to work properly.
+
+The second and fourth group of 4 clocks are adjustable. That is, clocks 5,
+6, 7, 8 and 13, 14, 15, 16 (counting from 1). These clocks are set by the
+Clocks line. Be sure to adjust the 17th (last) clock to match your Mclk.
+Here is a sample set of clocks lines with some clocks defined which are not
+directly provided by the chip. The NON-programmable clocks (1-4 and 9-12)
+MUST be set as indicated here.
+
+ Clocks 25.175 28.322 65 36 # These are *not* programmable
+
+ Clocks 29.979 77.408 62.195 59.957 # these are programmable
+ Clocks 31.5 35.501 75.166 50.114 # these are *not* programmable
+ Clocks 39.822 72.038 44.744 80.092 # these are programmable
+ Clocks 44.297 # Change this if you change
+ # Mclk above.
+
+You can program the clocks in increments of .447443 MHz. The server will
+warn you and adjust to the nearest increment if you specify a clock which
+does not fit this formula. Clocks 1-4 and 9-12 (the fixed clocks) are not
+constrained to this multiple, but instead are used to provide standard clocks
+which are not a multiple by .447443 MHz.
+
+If you probe for clocks (for example to find your Mclk), do it in CRT only
+mode and then add clocks lines in your XF86Config file. Clocks will not
+probe correctly in LCD mode on most systems.
+
+The BIOS on some systems may not allow switching from CRT to LCD unless the
+correct clock and/or mode is used. Try the following mode line for 640x480
+LCD displays.
+
+ ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525 #CRT/LCD
+
+The following modelines have been tested with the above Clocks lines on some
+systems, and are provided here as examples. Some testers have experienced
+minor problems (snow) with the fixed 65 and 75.166 MHz dot clocks. The mode-
+lines below have been reported to circumvent these problems. Do not assume
+your monitor will not be damaged by any of these.
+
+ # VESA 800x600@72Hz Non-Interlaced mode
+ ModeLine "800x600.50" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+
+ # 1024x768 Interlaced mode
+ ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 +hsync +vsync Interlace
+
+ # 1024x768@60Hz Non-interlaced Mode
+ # One of the dram options may be necessary
+ ModeLine "1024x768.65" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+
+ # 1024x768@60Hz Non-Interlaced mode (non-standard dot-clock)
+ # Seems to work without dram options
+ ModeLine "1024x768.62" 62 1024 1064 1240 1280 768 774 776 808
+
+ # 1024x768@70Hz Non-Interlaced mode (non-standard dot-clock)
+ # May need fast_dram option
+ ModeLine "1024x768.72" 72 1024 1056 1192 1280 768 770 776 806 -hsync -vsync
+
+5. Additional WD90C24 information
+
+Standard disclaimers apply. Use this driver at your own risk. If you need
+additional information on using XFree86 with the WD90C24 family however, you
+might try Darin Ernst's home page <URL:http://www.castle.net/~darin>. Darin
+maintains a mini-HOWTO on ``X and the WD90C24''. He was the first tester of
+the WD90C24 code and provided many good ideas and encouragement. You can
+reach Darin at darin@castle.net or dernst@pppl.gov. I only provided the
+WD90C24 specific code. You can reach me (Brad Bosch) at brad@Lachman.com.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/WstDig.sgml,v 3.6 1997/01/24 09:32:38 dawes Exp $
+
+ $XConsortium: WstDig.sgml /main/5 1996/02/21 17:46:29 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.WstDig,v 3.19 1999/04/15 03:34:58 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.agx b/xc/programs/Xserver/hw/xfree86/doc/README.agx
new file mode 100644
index 000000000..b2f66f103
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.agx
@@ -0,0 +1,537 @@
+ Notes on the AGX Server
+
+ Henry Worth
+
+ 24 June 1995
+
+1. General Notes
+
+This server currently supports the IIT AGX-016, AGX-015, AGX-014 and XGA-2
+chipsets. The AGX chipset is based on XGA architecture, but is missing sev-
+eral features and differs on others. There's also untested support for the
+XGA-1 and AGX-010 chipsets. Pixel depths of 8bpp, 15bpp, 16bpp are generally
+supported. Unpacked 24bpp (RGBX 32bpp) is not yet stable enough to release.
+
+RAMDACs currently supported are the Brooktree (BT481, BT482, and BT485) and
+AT&T (20C505) RAMDACs used by the Hercules Graphite series, and Sierra RAM-
+DACs (15025 and 15021), and Generic VGA RAMDAC. Untested support has been
+added for the AT&T 20C490 series.
+
+The current driver has a number of acceleration routines: solid and dashed
+zero-width lines (except AGX-014), bitblt fills, tiles, and stipples, solid
+arc and polygon fills, character glyphs and font cache for 8-bit characters.
+
+Boards that have had some testing include ISA and VLB versions of most of the
+Hercules Graphite series, Spider Black Widow VLB and Black Widow Plus VLB,
+Boca Vortek VL, CatsEye/X XGA-2, and the PS/2-57 planar XGA-2. The Orchid
+Celsius is very similar to the Spider and Boca boards, except some batches
+may use one of the AT&T 20C490 series RAMDACs, instead of the Sierra 15025.
+There has also been a report of a generic board that uses a UMC RAMDAC that
+may be an AT&T 20C490 Clone.
+
+2. Acknowledgments
+
+First, to Hercules Customer Support for providing a loaner board to get
+things started.
+
+Second, to the XFree86 team, and those who who have contributed to their
+efforts to the project, for the foundation of work that provided a basis for
+bootstrapping this server.
+
+3. Known Problems
+
+ o The accelerated line routines don't match lines written by the mi/cfb
+ routines. This is noticeable when switching between virtual consoles
+ while running routines that draw and erase lines. Seems to have been
+ reduced/fixed in previous releases but need more testing.
+
+ o Some special-case speedup added to cached font rendering in 3.1.1 has
+ been disabled as is over-aggressive in some cases. This cuts the perfor-
+ mance on terminal-fonts in half, and font performance is already low for
+ the AGX chips compared to their contemporaries.
+
+ o As in all software, needs more testing.
+
+4. ToDo
+
+ o Address the above known problems.
+
+ o Additional acceleration routines and general performance improvements.
+ Many existing acceleration routines are Q&D adaptations of existing rou-
+ tines from other servers that support graphics chips that differ signif-
+ icantly, architecturally, from that XGA and are undoubtedly less than
+ optimal. In particular some of the general per-operation overhead to
+ set-up the graphics context should be moved to the ValidateGC() rou-
+ tines.
+
+ o Complete HW cursor support, most of the code is done (or borrowed from
+ other servers). There just remains a little setup code and then finding
+ a lot of time to debug and test the numerous permutations.
+
+ o Complete support for the Graphite Pro's 84-pin RAMDAC. (the 2MB version
+ of the Graphite Pro has both RAMDACs, the 1Mb only the 44-pin RAMDAC).
+ Currently, the 84-pin RAMDAC is only supported in clock-doubled pixmux
+ mode, the server will switch between RAMDACs as required by the video
+ mode In >8bpp modes this switching does not occur.
+
+ o Implement more HW probing, this will be difficult as it appears some
+ (all?) AGX-based vendors don't implement the VESA VXE POS registers,
+ although the AGX chip does support it (and some vendors claim VXE com-
+ pliance...). There are a few rev/vendor registers in the AGX chip but
+ they are not documented. Note: SuperProbe also does not support probing
+ for AGX/XGA chips. ISA POS probing is supported for the XGA chips and
+ some code for EISA POS is also included but not tested.
+
+ o Micro-optimizations, in particularly reducing processing overhead for
+ common special cases that don't require full generality.
+
+5. XF86Config
+
+Device Section Entries and Options Currently Supported:
+
+The minimum that must be specified in the XF86Config device section for the
+AGX-014, AGX-015, AGX-016, and ISA-based XGA-1 and XGA-2 is the Chipset. How-
+ever to get full capability out of the AGX-01[456] chips, the RAMDAC should
+be specified. Other parms may select additional capabilities, or may used to
+override the defaults or reduce start-up time be suppressing probing. XGA
+specific configuration is covered at the end of this document. The XGA
+entries can generally be used to override defaults for the AGX-01[456] as
+well.
+
+ Ramdac
+ Be sure to check the clock rating of the RAMDAC(s) on your video
+ board and don't exceed that rating even if the server allows it,
+ overclocking RAMDACs will damage them.
+
+ The clock rating generally appears as a suffix to the part num-
+ ber, may only have the most significant digit(s), and may be
+ mixed with other codes (e.g. package type). For example, an 85MHz
+ Bt481 in a plastic J-lead package has a part number of Bt481KPJ85
+ and a 135MHz AT&T20C505 has a part number of ATT20C505-13. Sierra
+ stamps the rated speed below the part numbers in a dark ink.
+
+ "normal"
+ normal VGA style RAMDAC (6-bit DAC), default if none
+ specified. Most boards should work with this parm,
+ but some capabilities will be unavailable. Only 8bpp
+ is available.
+
+ "bt481"
+ bt481 RAMDAC (supports 8-bit DAC)
+
+ "bt482"
+ bt482 RAMDAC (supports 8-bit DAC) The Hercules
+ Graphite HG210 uses the BT481 or BT482, the only dif-
+ ference between these two is the BT482's HW cursor
+ (not yet supported). The BT481/2 are limited to
+ 85Mhz. 8bpp, 15bpp, 16bpp are supported.
+
+ "ATT20c490"
+ AT&T490 RAMDAC (includes 49[123] - supports 8-bit
+ DAC). Limited to 110Mhz at 8bpp. 8bpp, 15bpp, and
+ 16bpp are supported.
+
+ "SC15025"
+ Sierra SC15025 and SC15021 RAMDAC (support 8-bit
+ DAC). The SC15025 is limited to 125Mhz, and the
+ SC15021 135Mhz. Check the RAMDAC's actual rating,
+ some SC15025's used in AGX based boards are only
+ rated to 110Mhz. 8bpp, 15bpp, and 16bpp are sup-
+ ported.
+
+ "herc_dual_dac"
+ Hercules Graphite Pro RAMDAC probe. If the 84-pin
+ Big-RAMDAC is installed (2MB models), will use the
+ Big RAMDAC, but only clocks-doubled, pixel- multi-
+ plexed modes (higher clock values only!). Lower
+ clocks and resolutions in 8bpp mode are supported by
+ switching to the Small 44-pin RAMDAC. 15bpp and 16bpp
+ are supported.
+
+ There has been one report of the "dac-8-bit" option
+ not working with a Graphite Pro equipped with a BT485
+ RAMDAC, puzzling since it should be identical to the
+ AT&T20C505 in this regard. No startup messages or
+ XF86Config were submitted to aid problem isolation.
+
+ Not supported by the HG210 Graphite.
+
+ "herc_small_dac"
+ Hercules Graphite Pro RAMDAC probe. Forces use of
+ only the BT481/482 RAMDAC. 8bpp, 15bpp, 16bpp, and
+ unpacked 24/32bpp are supported.
+
+ Not supported by the HG210 Graphite.
+
+ "xga"
+ To allow overriding the default VGA style RAMDAC con-
+ trol for the AGX-010.
+
+ Ramdac related Option Flags:
+
+ "dac_6_bit"
+ Sets RAMDAC to VGA default 6-bit DAC mode (default
+ for "normal").
+
+ "dac_8_bit"
+ Sets supported RAMDAC's to 8-bit DAC mode (default
+ for all but "normal").
+
+ "sync_on_green"
+ Composite sync on green for RAMDAC's that support
+ this feature (BT481/481 and AT&T20c490). However,
+ whether any boards have necessary traces and glue
+ logic is doubtful.
+
+ Chipset:
+ Must be specified, possible values: "AGX-016", "AGX-015",
+ "AGX-014", "AGX-010", "XGA-2", or "XGA-1". Some AGX vendors place
+ stickers over the chip, in general, if it's a VLB board it's
+ probably an AGX-015 and if it's an ISA board it may be an
+ AGX-014. The Hercules Graphite Power Pro and Spider Black Widow
+ Plus use the AGX-016 chipset. In general, specifying a lower
+ revision in the AGX-0{14,15,16} series does not seem to causes
+ problems (except lower performance from the AGX-014's non-accel-
+ erated line drawing).
+
+ Note: Only the AGX-016, AGX-015, AGX-014 and XGA-2 have had any
+ testing. Most of the development has been with an AGX-015 based
+ 2MB Hercules Graphite VL PRO (HG720) and most of testers for pre-
+ vious releases had AGX-014 based 1MB Hercules Graphite (HG210).
+
+ The limited documentation I have for the AGX-010 is that is is a
+ clone of the XGA architecture with a few additional configuration
+ registers. What is not clear is whether to use XGA or extended-
+ VGA RAMDAC control registers. The post-3.1.1 default is now VGA
+ control registers, but XGA control registers can be forced with
+ the XGA RAMDAC parm. Likewise the configuration parms described
+ in the XGA section can be used to override the AGX defaults for
+ I/O and memory addresses.
+
+ VideoRam:
+ Will be probed if not specified. The startup will be a little
+ faster if specified.
+
+ Tuning Option flags:
+
+ Bus I/O interface:
+
+ "8_bit_bus"
+ Force 8-bit I/O bus.
+
+ "wait_state", "no_wait_state"
+ Set or clear CPU access wait state,
+ default is the POST setting.
+
+ "fifo_conserv"
+ Disable Memory I/O Buffer, AGX-015 and
+ AGX-016. MS-Windows driver default.
+ Required by some VLB systems with
+ `aggressive timing'. The default for
+ this server is to disable the buffer.
+
+ "fifo_moderate"
+ Enable the AGX-015/016's Memory I/O
+ buffer.
+
+ "fifo_aggressive"
+ Enable the AGX-016's extra-large buffer.
+ Either option may result in garbage being
+ left about the screen, disabled by
+ default. A good test is the xbench or
+ x11perf dashed lines tests, if random
+ dots are drawn, fifo_conserv is required.
+ So far, no boards have been reported that
+ worked correctly with the buffers
+ enabled.
+
+ Memory Timing:
+ POST defaults should be ok.
+
+ "vram_delay_latch", "vram delay_ras", "vram_extend_ras"
+ Vram timing options.
+
+ "slow_vram", "slow_dram"
+ Set all of the vram timing options.
+
+ "med_dram"
+ Set vram latch delay, clear others.
+
+ "fast_vram",
+ "fast_dram"" All of the vram timing
+ options are cleared. Should be specified
+ if directly specifying VRAM options in
+ order to clear POST settings.
+
+ Debugging:
+ These shouldn't generally be required:
+
+ "noaccel"
+ (AGX,XGA) Disable Font Cache.
+
+ "crtc_delay"
+ (AGX) Force XGA mode CRTC delay.
+
+ "engine_delay"
+ AGX-015 only? adds additional VLB wait
+ state.
+
+ "vram_128", "vram_256"
+ Sets VRAM shift frequency, vram_128 is
+ for 128Kx8 VRAM. Default is to leave this
+ bit unchanged from POST setting.
+
+ "refresh_20", "refresh_25"
+ Number of clock cycles between screen
+ refreshes. Default is to leave this bit
+ unchanged from POST setting.
+
+ "screen_refresh"
+ Disable screen refresh during non-blanked
+ intervals, AGX-016. Default is leave them
+ enabled.
+
+ "vlb_a", "vlb_b"
+ VLB transaction type, default is to leave
+ this bit unchanged from POST value.
+
+ Virtual resolution:
+ The server now accepts any virtual width, however the actual
+ usable CRTC line width is restricted when using the graphics
+ engine and depends upon the chip revision. The CRTC line width
+ and not the virtual width determine the amount of memory used.
+ The server currently does not make use of any of the unused CRTC
+ line's memory. CRTC line width is restricted by the following
+ rules:
+
+ AGX-014 : 512, 1024 and 2048. (also AGX-010)
+
+ AGX-015 : 512, 1024, 1280, and 2048.
+
+ AGX-016 : 512, 640, 800, 1024, 1280, and 2048.
+
+ XGA,AGX-010 : 512, 640, 800, 1024, 1280, 1152, and
+ 2048.
+
+ When panning I occasionally get streaks if the virtual resolution
+ is much greater than the physical resolution. Moving the mouse a
+ little makes it disappear. The Hercules manual indicates this
+ also happens with the MS-Windows drivers.
+
+ The server requires at least a 64KB scratchpad (16KB for XGA's).
+ Additional memory is useful for font cache and a larger scratch-
+ pad.
+
+ AGX Clocks:
+ Probing is supported, but of course the usual warnings and dis-
+ claimers apply. Probing may momentarily subject your monitor to
+ sweep frequencies in excess of its rating. The cautious may wish
+ to turn off the monitor while the probe is running.
+
+ Once clocks are known, they can be entered into XF86Config, then
+ subsequent runs won't probe clocks and will be quicker to
+ startup. For the clock probe it is recommended that the X server
+ be run with the -probeonly option. The values in the clocks
+ statement are the hardware input clocks and correspond to the
+ pixel clock only at 8bpp in direct-clocking RAMDAC modes. The
+ server will divide/multiply those values as appropriate for the
+ RAMDAC modes available at the current pixel depth. The available
+ pixel clocks will be displayed in the startup messages.
+
+ For the 2MB Hercules Graphites, with the "herc-dual-dac" RAMDAC
+ specified, earlier versions of the server generated an additional
+ 16 clocks with values doubled and some zeroed. Those are no
+ longer needed and you should re-probe and re-enter the clock val-
+ ues to ensure all clocks are available to you.
+
+ The AGX-015 2MB Hercules Graphite VL Pro with an ICS1494M
+ 9251-516 clock chip has probed clock values of:
+
+ 25.18 28.80 32.70 36.00 40.00 45.00 50.40 64.70
+ 70.10 76.10 80.60 86.30 90.40 95.90 100.70 109.40
+
+ Actual values according to Hercules are:
+
+ 25.175 28.322 32.512 36.000 40.00 44.90 50.35 65.00
+ 70.00 75.00 80.00 85.00 90.00 95.00 100.0 108.0
+
+ These are the values to be used in the clock statement if speci-
+ fying the "normal", "bt481", or "herc_small_dac" RAMDAC in your
+ XF86Config and your clockchip matches that above.
+
+ Clock probing assumes that the first clock is 25.175Mhz and uses
+ that to derive the rest. A warning is displayed if the second is
+ not near 28.322Mhz. If this warning appears, you should not use
+ the probed clock values without additional verification from
+ other sources.
+
+ In the case of the AGX-014 and later AGX's, only the external
+ clock select lines are used, this means the clock values corre-
+ spond to the values of the video board's clock chip.
+
+ For the AGX-010, the first 8 clocks use the standard XGA internal
+ clock selects and the second 8 are based on AGX extensions. For
+ the XGA-1 only 8 clocks are available. The XGA-2 uses a pro-
+ grammable clock and no clocks or clockchip line is required.
+
+ The maximum pixel clock generally allowed is 85MHz, but some RAM-
+ DACs support higher values. In any case you, should check your
+ RAMDAC, some RAMDACs used on AGX based boards are produced in
+ versions rated to lesser values than the server assumes. You
+ should check the rating and limit yourself to that value.
+
+ Modes:
+ One difference I've noted from the Mach8, is that the AGX's CRTC
+ doesn't like the start of the horizontal sync to be equal to
+ horiz blank start (vert sync may have the same problem, I need to
+ test some more). Interlaced and +/-sync flags are supported but
+ have had very little testing. For interlaced modes make sure the
+ number of lines is an odd number.
+
+ The doublescan flag is now supported, however the minimum clock
+ supported is generally 25MHz, so resolutions of less than 400x300
+ are not likely to be supported by most monitors. In creating
+ doublescan mode timings, the vertical timings will match the
+ apparent resolutions, e.g. for 400x300 the timings should
+ describe 300 lines, not 600.
+
+ Examples:
+
+ For the Hercules HG720 (2MB VLB AGX-015, with BT481 and
+ AT&T20C5050 RAMDACs), I use the following XF86Config "Device"
+ section:
+
+ Section "Device"
+ Identifier "HG720"
+ VendorName "Hercules"
+ BoardName "Graphite VL Pro"
+ Chipset "AGX-015"
+ Clocks 25.2 28.3 32.5 36.0 40.0 45.0 50.4 65.0
+ 70.00 75.00 80.00 85.00 90.00 95.00 100.0 108.0
+ Videoram 2048
+ RamDac "herc_dual_dac"
+ Option "dac_8_bit"
+ Option "no_wait_state"
+ EndSection
+
+ For the Spider Black Widow Plus (2MB VLB AGX-016, with Sierra
+ SC15021 RAMDAC):
+
+ Section "Device"
+ Identifier "SBWP"
+ VendorName "Spider"
+ BoardName "Black Widow Plus"
+ Chipset "AGX-016"
+ Clocks 25.2 28.3 39.9 72.2 50.0 76.9 36.1 44.8
+ 89.0 119.8 79.9 31.5 110.0 64.9 74.9 94.9
+ Videoram 2048
+ RamDac "SC15025"
+ Option "dac_8_bit"
+ Option "no_wait_state"
+ EndSection
+
+6. Xga configuration
+
+ This server now has tested support for XGA-2 compatible boards
+(aka. XGA-NI). The main issue for XGA-1 support is whether clock probing
+works. At this time probing for board configuration is limited and detailed
+configuration may need to be done manually.
+
+ By default the ISA POS register will be performed. If the XGA Instance
+number is specified the scope of probing will be narrowed a bit. To override
+or disable probing, a minimum of the Instance, COPbase, and MEMbase must be
+specified in the XF86Config device section for the XGA card. MCA probing is
+not supported.
+
+ Instance nn
+ XGA instance number (0-7).
+
+ IObase nnnn
+ The I/O address of the the XGA general control registers. The
+ standard, and default, is 0x21i0, where i is the instance number.
+
+ MEMbase nnnn
+ The XGA display memory address (the address the XGA coprocessor
+ uses for video memory). This is also the system memory address of
+ the linear aperture on boards that support it.
+
+ POS register 4 bits 7-1 contains bits 31-25 of the XGA's display
+ memory address. Bits 24-22 of of the display memory address con-
+ tains the XGA instance number. Bit 0 of POS register 4 is not
+ used by this server as the XGA's linear aperture is not used.
+ However, the coprocessor must still be configured with this.
+
+ The AGX-01[456] chips have a fixed display memory address.
+
+ COPbase nnnnnn
+ Address of the graphics engine's memory mapped control registers.
+
+ Typically:
+
+ 0xC1C00 + (ext_mem_addr * 0x2000) + (instance * 0x80)
+
+ where ext_mem_addr is the high order 4-bits of POS register 2
+ (0-16 the server assumes zero).
+
+ The AGX-01[456] chips support 0xB1F00 (default) and 0xD1F00.
+
+ BIOSbase nnnnnn
+ Address of the XGA BIOS (not VGA BIOS). Can be specified as an
+ alternate to COPbase.
+
+ Typically:
+
+ 0xC0000 + (ext_mem_addr * 0x2000)
+
+ where ext_mem_addr is the high order 4-bits of POS register 2
+ (0-16 -- the server assumes zero).
+
+ VGAbase nnnn
+ Can be used to override the default 0xA0000 address for the 64KB
+ video memory address used by the server. The only values accept-
+ able are 0xA0000 and 0xB0000. VGA text mode restore does not work
+ under Linux if 0xB0000 is specified.
+
+ AGX-01[456] also default to 0xA0000.
+
+ POSbase nnnn
+ Can be used to specify an alternate POS register probe address
+ base from the ISA default of 0x100. The VESA VXE standard for
+ EISA is 0xzC80, where z is the slot number).
+
+ A value of zero will disable POS register probing (required for
+ MCA).
+
+ DACspeed nnnn
+ Can be used to override the servers default maximum Pixel Clock
+ for XGA-2 of 80Mhz. The limit can be raised as high as 90Mhz, or
+ set to lower values.
+
+ An alternate way to determine the POS register values is with the
+setup/diag programs that should have been included with your video board, or
+possibly from jumper values.
+
+The XGA-2 has programmable clocks up to 90MHz, however at 1024x768, 72MHz is
+generally the max that will produce a stable display with the CatsEye/XGA-2
+used for testing (IBM coprocessor and INMOS RAMDAC/serializer). Higher clocks
+will often generate artifacts at the top and left edges of the screen. Such
+artifacts can sometimes be tuned out by increasing the vertical and horizon-
+tal blanking intervals or slightly changing the clock. At pixel clock rates
+above 80Mhz I have seen the chip lose sync after running for several minutes,
+so 80Mhz has been set as the default limit for XGA-2 pixel clocks. I don't
+have specs on actual limits, and as there are a number of different XGA
+chipsets, you should use the modes documented in your owner's manual as a
+guide to max refresh rates. No clocks or clockchip parm are required to spec-
+ify use of programmable clocks for the XGA-2.
+
+8bpp and 16bpp are supported for the XGA-2.
+
+For XGA-1 cards the clocks must be specified as for the AGX chips, it is not
+known whether the clockprobing will work. Some XGA-1 chips may support 16bpp.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/agx.sgml,v 3.19 1997/01/25 03:22:19 dawes Exp $
+
+ $XConsortium: agx.sgml /main/9 1996/10/19 18:03:50 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.agx,v 3.39 1999/04/15 03:34:58 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.apm b/xc/programs/Xserver/hw/xfree86/doc/README.apm
new file mode 100644
index 000000000..2a3f61876
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.apm
@@ -0,0 +1,68 @@
+ Information for Alliance Promotion chipset users
+
+ Henrik Harmsen (Henrik.Harmsen@erv.ericsson.se)
+
+ 23 February 1998
+
+1. Support chipsets
+
+The apm driver in the SVGA server is for Alliance Promotion (www.alsc.com)
+graphics chipsets. The following chipsets are supported:
+
+ o 6422
+
+ Old chipset without color expansion hardware (text accel).
+
+ o AT24
+
+ As found in Diamond Stealth Video 2500. Quite similar to AT3D.
+
+ o AT25, AT3D
+
+ AT3D is found in Hercules Stingray 128/3D. Most other Voodoo Rush based
+ cards use the AT25 which is identical except it doesn't have the 3D
+ stuff in it.
+
+2. Acceleration
+
+The apm driver uses the XAA (XFree86 Acceleration Architecture) in the SVGA
+server. It has support for the following acceleration:
+
+ o Bitblts (rectangle copy operation)
+
+ o Lines (solid, single pixel)
+
+ o Filled rectangles
+
+ o CPU->Screen colour expansion (text accel). Not for 6422.
+
+ o Hardware cursor
+
+All in 8, 16 and 32 bpp modes. No 24bpp mode is supported. Also VESA DPMS
+power save mode is fully supported with "standby", "suspend" and "off" modes
+(set with with the "xset dpms" command).
+
+3. Configuration
+
+First: Please run the XF86Setup program to create a correct configuration.
+
+You can turn off hardware cursor by inserting the following line in the
+Device section of the XF86Config file:
+
+Option "sw_cursor"
+
+Or turn off hardware acceleration:
+
+Option "noaccel"
+
+Please don't specify the amount of video RAM you have or which chipset you
+have in the config file, let the driver probe for this. Also please don't put
+any "clocks" line in the device section since these chips have a fully pro-
+grammable clock that can take (almost) any modeline you throw at it. It might
+fail at some specific clock values but you should just try a slightly differ-
+ent clock and it should work.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/apm.sgml,v 1.2 1999/08/23 06:18:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.3 1999/08/23 07:03:50 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ark b/xc/programs/Xserver/hw/xfree86/doc/README.ark
new file mode 100644
index 000000000..5f42bede1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.ark
@@ -0,0 +1,208 @@
+ Information for ARK Logic Chipset Users
+
+ Harm Hanemaayer (H.Hanemaayer@inter.nl.net)
+
+ 17 January 1997
+
+1. Supported chipsets
+
+The "ark" driver in the SVGA server is for ARK Logic graphics chipsets. The
+following chipsets are supported:
+
+ ARK1000PV (ark1000pv)
+ Chipset with 32-bit DRAM interface, supports fast DRAM timing,
+ for VESA and PCI bus. Has powerful "coprocessor" for graphics
+ acceleration. The max supported resolution/refresh depends on
+ the RAMDAC used on the card; expect 256 colors up to 80 or 110
+ MHz dot clock; 16bpp is also supported, as is 24bpp (packed).
+
+ ARK1000VL (ark1000vl)
+ Older chip, VLB only. More or less compatible with ARK1000PV. It
+ has is not been tested. You may have to disable acceleration and
+ linear addressing.
+
+ ARK2000PV (ark2000pv)
+ 64-bit version of the ARK1000PV. Note that an ARK2000PV equipped
+ with 1Mb of DRAM is about equivalent to the same card with an
+ ARK1000PV chip; 2Mb is required for 64-bit operation. Again the
+ RAMDAC used on the card determines the max supported dot clocks.
+ At 8bpp, multiplexing over a 16-bit RAMDAC path is not yet sup-
+ ported so expect dot clocks up to 110 MHz; 16bpp and 32bpp are
+ supported, as well as experimental packed 24bpp, depending on the
+ RAMDAC.
+
+ ARK2000MT (ark2000mt)
+ This is a newer chip, compatible with the AR2000PV.
+
+The ARK2000MI is not yet supported.
+
+The chipset may not be detected automatically. In this case use a line like
+Chipset "ark1000pv" in the Device section of the XF86Config file. Any options
+must also be specified in this section.
+
+2. Supported RAMDACs
+
+If no RAMDAC is specified, a standard RAMDAC supporting 256 colors up to 80
+MHz dot clock frequency is assumed. The following RAMDAC types can be speci-
+fied in the Device section of the XF86Config file (e.g. Ramdac "att20c490"):
+
+ att20c490
+ Industry-standard 8-bit RAMDAC. The RAMDAC used on the basic Her-
+ cules Stingray Pro is compatible. 16bpp color depth is supported
+ up to 40 or 55 MHz, depending on the DAC speed rating. Packed
+ 24bpp is supported up to about 36 MHz.
+
+ att20c498
+ Industry-standard 16-bit RAMDAC. The RAMDAC used on the Hercules
+ Stingray Pro/V and the Stingray 64/V is compatible. 16bpp is sup-
+ ported up to 80 MHz or 110 MHz dot clock frequency, 32bpp is sup-
+ ported up to 40 or 55 MHz.
+
+ zoomdac
+ This is the actual DAC used by the Hercules Stingray Pro/V and
+ 64/V. It is treated mostly as an ATT20C498, but with dot clock
+ limits set correctly (16bpp up to 55 MHz with ARK1000PV, up to at
+ least 110 MHz with ARK2000PV). In addition, packed 24bpp is sup-
+ ported (up to 36 MHz with ARK1000PV, not yet on the ARK2000PV),
+ and 32bpp is also supported on the ARK2000PV (up to 55 MHz) This
+ RAMDAC should be auto-detected.
+
+ stg1700
+ Completely untested.
+
+ ics5342
+ This is a clockchip/RAMDAC combination and is used on the Diamond
+ Stealth 64 Graphics 2001 and newer Hercules cards that use the
+ ARK2000MT. It is supported at 16bpp and 32bpp in addition to 256
+ color mode. 32bpp mode may not work.
+
+The Dacspeed keyword can be used to indicate the speed rating of the RAMDAC,
+but it must be used with care. The raw clock frequency may exceed 80 MHz.
+Both the ARK chips and some of the RAMDACs are specified for raw speeds up to
+120 MHz, but this might violate FCC regulations or otherwise be unstable.
+High dot clock 8bpp modes (e.g. 135 MHz) are normally achieved by sending 2
+pixels at at time over a 16-bit DAC path (the raw clock would be 67.5 MHz for
+135 MHz dot clock), a mode of operation that is not yet supported by this
+driver. No high-dot clock configurations have been tested.
+
+The driver now limits the maximum dot clocks according to the DRAM speed
+(bandwidth). Because it is not possible to determine the memory clock speed
+(except on the ICS5342), the driver assumes a default of 60 MHz. On an
+ARK1000PV, that allows 8bpp up to 109 MHz, 16bpp up to 55 MHz, 24bpp up to 36
+MHz, and 32bpp up to 27 MHz. On an ARK2000PV with 2MB memory, it allows 16bpp
+up to 110 MHz, 24bpp up to 72 MHz, and 32bpp up to 55 MHz. If you know what
+your real memory clock is, you can specify it with the MCLK keyword, for
+example MCLK 70.
+
+To run XF86_SVGA at 16 bpp, pass options to the X server as follows:
+
+ startx -- -bpp 16 5-6-5 RGB ('64K color', XGA)
+ startx -- -bpp 16 -weight 555 5-5-5 RGB ('Hicolor')
+ startx -- -bpp 24 8-8-8 RGB (packed 24-bit truecolor)
+ startx -- -bpp 32 8-8-8 RGB (32-bit pixel truecolor)
+
+3. Acceleration
+
+The driver takes full advantage of the new XAA (XFree86 Acceleration Archi-
+tecture) in the SVGA server. In fact the ARK driver was the initial XAA
+development platform. Most common graphics operations are accelerated,
+including most types of rectangular and non-rectangular filling, screen-to-
+screen BitBLTs, line drawing, and text and bitmap expansion. Expect over 300k
+xstones on a 2MB ARK2000PV/MT.
+
+At 24bpp, acceleration is less complete, but curiously, greyscale colors per-
+mit faster drawing. If you suspect a problem with acceleration, use the
+"noaccel" option. If text or bitmaps do not seem to be rendered correctly,
+you could try the "xaa_no_col_exp" option. To disable the pixmap cache, use
+"no_pixmap_cache".
+
+The hardware cursor is disabled by default. With unmodified mode timings,
+there used to be two horizontal lines and a band following the mouse pointer
+over the screen. The driver now automatically modifies the mode timing to
+eliminate this effect; this has not been tested on all possible configura-
+tions. Use the "hw_cursor" option to enable the hardware cursor.
+
+Linear addressing is the default mode of operation. If the server does not
+start correctly, you may want to try the "no_linear" option.
+
+The older ARK1000VL is probably not compatible with acceleration. Use the
+"noaccel" and "no_linear" options.
+
+4. Basic configuration
+
+It is recommended that you generate an XF86Config file using the `XF86Setup'
+or `xf86config' programs, which should produce a working high-resolution 8bpp
+configuration, although the modelines might need reshuffling for optimal
+screen refresh. You may want to include mode timings in the Monitor section
+that better fit your monitor (e.g. 1152x864 modes).
+
+In order to prevent stress on your monitor, it is recommended that you turn
+off your monitor during clock probing (X -probeonly), which also happens if
+you start the server with no Clocks line present in the Device section of the
+XF86Config. The following Clocks line can be used for the Hercules Stingray
+Pro, Pro/V and older 64/V using an ARK Logic clock generator (so there's no
+need to probe clocks for this card, just insert the following line in the
+Device section of the XF86Config file):
+
+ Clocks 25.175 28.3 40 72 50 77 36 44.9
+ Clocks 128.43 118.8 80 31.5 110 63.96 74.19 95
+
+The higher frequencies have not been tested, there might be a mismatch in the
+60-80 MHz range.
+
+5. Features that may be expected in upcoming beta releases
+
+ o Support for high dot clocks (>80 MHz, up to 135 MHz) at 8bpp by sending
+ two pixels at a time over a 16-bit RAMDAC path on an ARK2000PV/MT with
+ supported RAMDAC.
+
+ o Support for packed-24bpp mode up to 72 MHz on an ARK2000PV with ZoomDAC.
+
+ o The acceleration may be further optimized and stabilized.
+
+ o Existing problems may be fixed.
+
+ o Support for the ARK2000MI, if it materializes.
+
+6. Tested configurations.
+
+ Hercules Stringray Pro (ARK1000PV + ATT20C490-compatible RAMDAC)
+ Supported at 8bpp, 16bpp and 24bpp. Fixed set of clocks. There
+ seems to be a restriction to the mode timings at 24bpp; the last
+ horizontal number (HTotal) must be divisible by 4 but not by 8.
+ If the modeline is wrong, the colors would be incorrect. The
+ driver automatically corrects the mode timing.
+
+ Hercules Stingray Pro/V (ARK1000PV + IC Works ZoomDAC)
+ Supported at 8bpp, 16bpp and 24bpp. Fixed set of clocks. The
+ same restrictions above exist for the 24bpp mode. Problems with
+ textmode restoration have been reported on some OS's.
+
+ Hercules Stingray 64/V (ARK2000PV + IC Works ZoomDAC)
+ Supported at 8bpp, 16bpp and 32bpp. Fixed set of clocks. Prob-
+ lems with textmode restoration have been reported on some OS's.
+
+ Hercules Stingray 64 with ARK2000MT + ICS5342 Clockchip/RAMDAC
+ This may also apply to other cards with the ICS5342, such as the
+ Diamond Stealth 64 Graphics 2001. Use RAMDAC "ics5342". Pro-
+ grammable clockchip (don't specify any Clocks lines). Supported
+ at 8bpp, 16bpp and 32bpp. 32bpp has been reported not to work.
+ This configuration has not been tested with a post-3.2 server.
+
+If are having driver-related problems that are not addressed by this docu-
+ment, you can try contacting the XFree86 team (the current driver maintainer
+can be reached at H.Hanemaayer@inter.nl.net), or post in the Usenet newsgroup
+comp.windows.x.i386unix.
+
+In fact, reports (success or failure) are very welcome, especially on config-
+urations that have not been tested. You can do this via the bug report form
+<URL:http://www.xfree86.org/cgi-bin/bugform.cgi> (or send mail to
+XFree86@XFree86.org). You may want to keep an eye on forthcoming beta
+releases at the XFree86 web site <URL:http://www.xfree86.org>.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ark.sgml,v 3.9 1997/01/25 03:22:20 dawes Exp $
+
+ $XConsortium: ark.sgml /main/6 1996/10/28 05:24:04 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ark,v 3.16 1999/04/15 03:34:59 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati
new file mode 100644
index 000000000..5b0ddf734
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.ati
@@ -0,0 +1,548 @@
+ ATI Adapters README file
+
+ Marc Aurele La France
+
+ 1999 July 8
+
+ Abstract
+
+ This is the README for the XFree86 ATI driver included in this
+ release.
+
+1. Statement of intent
+
+Generally speaking, the driver is intended for all ATI video adapters, pro-
+viding maximum video function within hardware limitations. The driver is
+also intended to optionally provide the same level of support for generic VGA
+or 8514/A adapters. This driver is still being actively developed, meaning
+that it currently does not yet fully meet these goals.
+
+The driver will provide
+
+ o accelerated support if an ATI accelerator is detected and the user has
+ not requested that this support be disabled; otherwise
+
+ o accelerated support if a non-ATI 8514/A-capable adapter is detected and
+ the user has requested such support; otherwise
+
+ o unaccelerated SuperVGA support if an ATI VGA-capable adapter is
+ detected; otherwise
+
+ o generic VGA support if a non-ATI VGA-capable adapter is detected and the
+ user has requested such support.
+
+Thus, the support provided not only depends on what the driver detects in the
+system, but also, on what the user specifies in the XF86Config file. See the
+``XF86Config specifications'' section below for details.
+
+If none of the above conditions are met, the ATI driver will essentially dis-
+able itself to allow other drivers to examine the system.
+
+2. A note on acceleration
+
+The meaning of ``acceleration'', as used in this document, needs to be clari-
+fied. Two of the many components in an accelerator are the CRT controller
+(CRTC) and the Draw Engine. This is in addition to another CRTC that, gener-
+ally, is also present in the system (often in the same chip) and typically
+provides EGA, VGA or SuperVGA functionality.
+
+A CRTC is the component of a graphics controller that is responsible for
+reading video memory for output to the screen. A Draw Engine is an accelera-
+tor component that can be programmed to manipulate video memory contents,
+thus freeing the CPU for other tasks.
+
+When the VGA CRTC is used, all drawing operations into video memory are the
+responsibility of the system's CPU, i.e. no Draw Engine can be used. On the
+other hand, if the accelerator's CRTC is chosen to drive the screen, the Draw
+Engine can also be used for drawing operations, although the CPU can still be
+used for this purpose if it can access the accelerator's video memory.
+
+Video acceleration refers to the programming of an accelerator's Draw Engine
+to offload drawing operations from the CPU, and thus also implies the use of
+the accelerator's CRTC.
+
+3. Current implementation for ATI adapters
+
+The driver currently supports the SuperVGA capabilities of all ATI adapters
+except some early Mach8 and Mach32 adapters that do not provide the required
+functionality. This support works for monochrome, 16-colour and 256-colour
+video modes, if one of the following ATI graphics controller chips is pre-
+sent:
+
+ VGAWonder series: 18800, 18800-1, 28800-2, 28800-4, 28800-5, 28800-6
+ Mach32 series: 68800-3, 68800-6, 68800AX, 68800LX
+ Mach64 series: 88800GX-C, 88800GX-D, 88800GX-E, 88800GX-F, 88800CX,
+ 264CT, 264ET, 264VT, 264GT (3D Rage), 264VT-B, 264VT3,
+ 264VT4, 264GT-B (3D Rage II), 3D Rage IIc, 3D Rage Pro,
+ 3D Rage LT, 3D Rage LT Pro, 3D Rage XL, 3D Rage XC
+
+The driver also supports 32K, 64K and 16M-colour modes on the 264xT and 3D
+Rage series of adapters using the accelerator CRTC (but not the VGA CRTC).
+This support is as yet unaccelerated.
+
+The newer Rage 128 chips are not yet supported.
+
+Adapters based on the above chips have been marketed under a rather large
+number of names over the years. Among them are:
+
+ VGAWonder series: VGAWonder V3, VGAWonder V4, VGAWonder V5, VGAWonder+,
+ VGAWonder XL, VGAWonder XL24, VGAWonder VLB, VGA Basic,
+ VGA Basic 16, VGA Edge, VGA Edge 16, VGA Integra,
+ VGA Charger, VGAStereo F/X, VGA 640, VGA 800, VGA 1024,
+ VGA 1024D, VGA 1024 XL, VGA 1024 DXL, VGA 1024 VLB
+ Mach8 series: Graphics Ultra, Graphics Vantage, VGAWonder GT
+ (None of the 8514/Ultra and 8514 Vantage series is
+ supported at this time)
+ Mach32 series: Graphics Ultra+, Graphics Ultra Pro, Graphics Wonder,
+ Graphics Ultra XLR, Graphics Ultra AXO, VLB mach32-D,
+ PCI mach32-D, ISA mach32
+ Mach64 series: Graphics Xpression, Graphics Pro Turbo, WinBoost,
+ WinTurbo, Graphics Pro Turbo 1600, Video Xpression,
+ 3D Xpression, Video Xpression+, 3D Xpression+,
+ 3D Charger, Video Charger, WinCharger, All-In-Wonder,
+ All-In-Wonder PRO, 3D Pro Turbo, XPERT@Play,
+ XPERT@Play 98, XPERT@Work, XPERT 98, XPERT LCD,
+ XPERT XL
+
+VGAWonder, Mach8 and Mach32 ISA adapters are available with or without a
+mouse.
+
+These adapters are available with a variety of clock generators and RAMDACs.
+The 264xT and 3D Rage series of chips are integrated controllers, meaning
+that they include a programmable clock generator and a RAMDAC.
+
+This driver still does not provide support for accelerated drawing to the
+screen. This means that all drawing is done by the CPU, rather than by any
+accelerator present in the system. This can make opaque moves, for example,
+quite ``jerky''. Also, given that IBM 8514/A and ATI Mach8 do not allow CPU
+access to their frame buffer, the driver will currently ignore these acceler-
+ators. Most Mach32 adapters provide both accelerated function and VGA func-
+tionality, but the driver currently only uses the VGA.
+
+The driver does however support the accelerator CRTC present in all ATI
+Mach64 adapters. For 256-colour, and higher depth modes, this support will
+be used by default, although an XF86Config option can be specified to use the
+SuperVGA CRTC instead. A linear video memory aperture is also available in
+256-colour and higher depth modes and enabled by default if a 264xT or 3D
+Rage controller is detected or, on 88800 controllers, if the accelerator CRTC
+is used. An XF86Config option is available to disable this aperture, or (on
+non-PCI adapters) enable it or move it to some other address.
+
+4. Current implementation of generic VGA support for non-ATI adapters
+
+Support for generic VGA with non-ATI adapters is also implemented, but has
+undergone only limited testing. The driver will intentionally disallow the
+use of this support with ATI adapters. This support must be explicitly
+requested through an XF86Config ChipSet specification. This prevents the
+current generic driver from being disabled.
+
+This driver's generic VGA support is intended as an extension of that pro-
+vided by the current generic driver. Specifically, within the architectural
+bounds defined by IBM's VGA standard, this driver will allow the use of any
+256-colour mode, and any dot clock frequencies both of which allow for many
+more mode possibilities.
+
+The driver will enforce the following limitations derived from IBM's original
+VGA implementation:
+
+ o There can only be a set of four (non-programmable) clocks to choose
+ from.
+
+ o Video memory is limited to 256kB in monochrome and 16-colour modes.
+
+ o Video memory is limited to 64kB in 256-colour modes.
+
+ o Interlaced modes are not available.
+
+5. XF86Config specifications
+
+The driver recognizes a number of XF86Config options. In general, all such
+options should be specified in a ``Device'' section, and affect only that
+``Device'' section.
+
+Those options that affect how the driver associates adapters with ``Device''
+sections are described first. The driver will ignore (with a message) a
+``Device'' section if the section cannot be associated with exactly one
+adapter in the system. Similarly, the driver will ignore, or disable, (with
+a message) any adapter that cannot be associated with exactly one ``Device''
+section. Thus, these options will be required in those uncommon cases where
+such unique associations cannot automatically be made by the driver.
+
+Other options affect the driver's operation once an adapter has been assigned
+to the ``Device'' section which contains them.
+
+5.1 Driver ``ati''
+
+The use of this specification is highly recommended if the ``Device'' section
+is to be recognized by the driver. In fact, it is almost (but not quite)
+mandatory, particularly when using the loader server as it indicates what
+driver is to be loaded and associated with the ``Device'' section.
+
+5.2 ChipSet ``name''
+
+The default ChipSet name for this driver is ``ati''. In this case, any ATI
+adapter can be associated with the ``Device'' section. If an ATI accelerator
+is detected and the driver supports it, the accelerator's CRTC will be used
+to drive the screen. Otherwise, the driver will programme the adapter's
+SuperVGA CRTC.
+
+If ``ativga'' is specified instead, the driver will ignore any ATI accelera-
+tor it detects, but otherwise operate as if ``ati'' had been specified.
+
+A ChipSet name of ``ibmvga'' causes any VGA-capable adapter in the system to
+be associated with the ``Device'' section. It enables the driver's generic
+VGA support, but only for non-ATI adapters. If an ATI adapter is associated
+with the ``Device'' section, the driver will operate as if ``ativga'' had
+been specified instead.
+
+A ChipSet name of ``vgawonder'' is equivalent to ``ativga'', except that only
+VGAWonder-capable adapters can be assigned to the ``Device'' section. This
+specifically excludes newer Mach64's with integrated controllers.
+
+In some PCI or AGP systems, the driver will not, by default, probe for non-
+PCI Mach32's or Mach64's. This is because, before doing any such probe, the
+driver attempts to determine if the probe can cause a lockup. If the driver
+has enough information to determine that a lockup would occur, it will skip
+the probe. In some situations, this determination cannot be accurate, and
+the driver will err on the side of caution, skipping the probe. Specifying a
+ChipSet name of ``mach32'' or ``mach64'', as appropriate, will force the
+driver to probe for the non-PCI adapter. These ChipSet names should, there-
+fore, only be used when there is in fact such an adapter in the system. They
+are otherwise equivalent to ``ati''.
+
+5.3 ChipID & ChipRev specifications
+
+These specifications will cause the driver to associate the ``Device'' sec-
+tion only with an adapter having the same attributes, or an adapter whose PCI
+device ID the driver does not recognize. In the second case, these options
+cause the driver to treat the adapter as if it was one with the specified PCI
+device ID or revision. ChipID can only be used with Mach32 or Mach64
+adapters. ChipRev is meaningful only with Mach64 adapters.
+
+5.4 IOBase
+
+This option limits the adapters that can be associated with the ``Device''
+section to those with the specified I/O base. This option only applies to
+Mach64 adapters.
+
+5.5 BusID
+
+This option limits the adapters that can be associated with the ``Device''
+section to those with the specified PCI Bus ID.
+
+5.6 Clocks
+
+For the purpose of specifying a clock line in your XF86Config, one of four
+different situations can occur, as follows.
+
+Those configuring the driver's generic VGA support for a non-ATI adapter, can
+skip ahead to the ``Clocks for non-ATI adapters'' section below. Those not
+trying to configure the driver for a Mach64 adapter, can skip ahead to the
+``Clocks for fixed clock generators on ATI adapters'' section below.
+
+The very earliest Mach64 adapters use fixed (i.e. non-programmable) clock
+generators. Very few of these (mostly prototypes) are known to exist, but if
+you have one of these, you can also skip ahead to the ``Clocks for fixed
+clock generators on ATI adapters'' section below.
+
+The two cases that are left deal with programmable clock generators, which
+are used on the great majority of Mach64 adapters.
+
+If you are uncertain which situation applies to your adapter, you can run a
+clock probe with the command ``X -probeonly''.
+
+5.6.1 Clocks for supported programmable clock generators
+
+At bootup, video BIOS initialization programmes an initial set of frequen-
+cies. Two of these are reserved to allow the setting of modes that do not
+use a frequency from this initial set. One of these reserved slots is used
+by the BIOS mode set routine, the other by the particular driver used (e.g.
+MS-Windows, AutoCAD, X, etc.). The clock numbers reserved in this way are
+dependent on the particular clock generator used by the adapter.
+
+The driver currently supports all programmable clock generators known to
+exist on Mach64 adapters. In this case, the driver will completely ignore
+any XF86Config clock specification, and programme the clock generator as
+needed by the modes used during the X session.
+
+5.6.2 Clocks for unsupported programmable clock generators
+
+This case is unlikely to occur, but is documented for the sake of complete-
+ness.
+
+In this situation, the driver will probe the adapter for clock frequencies
+unless XF86Config clocks are already specified. In either case, the driver
+will then attempt to normalize the clocks to one of the following specifica-
+tions:
+
+ BIOS setting 1:
+
+ Clocks 0.000 110.000 126.000 135.000 50.350 56.640 63.000 72.000
+ 0.000 80.000 75.000 65.000 40.000 44.900 49.500 50.000
+ 0.000 55.000 63.000 67.500 25.180 28.320 31.500 36.000
+ 0.000 40.000 37.500 32.500 20.000 22.450 24.750 25.000
+
+ BIOS setting 2:
+
+ Clocks 0.000 110.000 126.000 135.000 25.180 28.320 31.500 36.000
+ 0.000 80.000 75.000 65.000 40.000 44.900 49.500 50.000
+ 0.000 55.000 63.000 67.500 12.590 14.160 15.750 18.000
+ 0.000 40.000 37.500 32.500 20.000 22.450 24.750 25.000
+
+ BIOS setting 3:
+
+ Clocks 0.000 0.000 0.000 0.000 25.180 28.320 0.000 0.000
+ 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
+ 0.000 0.000 0.000 0.000 12.590 14.160 0.000 0.000
+ 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
+
+If the driver matches the clocks to the third setting above, functionality
+will be extremely limited (assuming the driver works at all).
+
+5.6.3 Clocks for fixed clock generators on ATI adapters
+
+This section applies to all VGAWonder and Mach32 adapters, and to early
+Mach64 prototypes.
+
+One of the following clocks specifications (or an initial subset thereof) can
+be used depending on what the adapter uses to generate dot clocks:
+
+ Crystals (VGA Wonder V3 and V4 adapters only):
+
+ Clocks 50.000 56.644 0.000 44.900 44.900 50.000 0.000 36.000
+ 25.000 28.322 0.000 22.450 22.450 25.000 0.000 18.000
+ 16.667 18.881 0.000 14.967 14.967 16.667 0.000 12.000
+ 12.500 14.161 0.000 11.225 11.225 12.500 0.000 9.000
+
+ ATI 18810 clock generator:
+
+ Clocks 30.240 32.000 37.500 39.000 42.954 48.771 0.000 36.000
+ 40.000 0.000 75.000 65.000 50.350 56.640 0.000 44.900
+ 15.120 16.000 18.750 19.500 21.477 24.386 0.000 18.000
+ 20.000 0.000 37.500 32.500 25.175 28.320 0.000 22.450
+ 10.080 10.667 12.500 13.000 14.318 16.257 0.000 12.000
+ 13.333 0.000 25.000 21.667 16.783 18.880 0.000 14.967
+ 7.560 8.000 9.375 9.750 10.739 12.193 0.000 9.000
+ 10.000 0.000 18.750 16.250 12.586 14.160 0.000 11.225
+
+ ATI 18811-0 and ATI 18812-0 clock generators:
+
+ Clocks 30.240 32.000 110.000 80.000 42.954 48.771 92.400 36.000
+ 39.910 44.900 75.000 65.000 50.350 56.640 0.000 44.900
+ 15.120 16.000 55.000 40.000 21.477 24.386 46.200 18.000
+ 19.955 22.450 37.500 32.500 25.175 28.320 0.000 22.450
+ 10.080 10.667 36.667 26.667 14.318 16.257 30.800 12.000
+ 13.303 14.967 25.000 21.667 16.783 18.880 0.000 14.967
+ 7.560 8.000 27.500 20.000 10.739 12.193 23.100 9.000
+ 9.978 11.225 18.750 16.250 12.588 14.160 0.000 11.225
+
+ ATI 18811-1 and ATI 18811-2 clock generators:
+
+ Clocks 135.000 32.000 110.000 80.000 100.000 126.000 92.400 36.000
+ 39.910 44.900 75.000 65.000 50.350 56.640 0.000 44.900
+ 67.500 16.000 55.000 40.000 50.000 63.000 46.200 18.000
+ 19.955 22.450 37.500 32.500 25.175 28.320 0.000 22.450
+ 45.000 10.667 36.667 26.667 33.333 42.000 30.800 12.000
+ 13.303 14.967 25.000 21.667 16.783 18.880 0.000 14.967
+ 33.750 8.000 27.500 20.000 25.000 31.500 23.100 9.000
+ 9.978 11.225 18.750 16.250 12.588 14.160 0.000 11.225
+
+VGAWonder VLB, VGA 1024 VLB, Mach32 and Mach64 owners should only specify up
+to the first 32 frequencies.
+
+Other clock generators that have been used on ATI adapters (which can all be
+said to be clones of one of the above) might generate non-zero frequencies
+for those that are zero above, or vice-versa.
+
+The order of the clocks is very important, although the driver will reorder
+the clocks if it deems it appropriate to do so. Mach32 and Mach64 owners
+should note that this order is different than what they would use for previ-
+ous XFree86 accelerated servers.
+
+5.6.4 Clocks for non-ATI adapters
+
+If no clocks are specified in the XF86Config, the driver will probe for four
+clocks, the second of which will be assumed to be 28.322MHz. You can include
+up to four clock frequencies in your XF86Config to specify the actual values
+used by the adapter. Any more will be ignored.
+
+5.7 Option ``nolinear''
+
+By default, the driver will enable a linear video memory aperture for
+256-colour and higher depth modes if it is also using a Mach64 accelerator
+CRTC or an integrated Mach64 graphics chip. This option disables this linear
+aperture.
+
+5.8 MemBase address
+
+This specification is only effective for non-PCI Mach64 adapters, and is used
+to override the CPU address at which the adapter will map its video memory.
+Normally, for non-PCI adapters, this address is set by a DOS install utility
+provided with the adapter. The MemBase option can also be used to enable the
+linear aperture in those cases where ATI's utility was not, or can not be,
+used.
+
+For PCI adapters, this address is determined at system bootup according to
+the PCI Plug'n'Play specification which arbitrates the resource requirements
+of most devices in the system. This means the driver can not easily change
+the linear aperture address.
+
+6. Known problems and limitations
+
+There are several known problems or limitations related to the XFree86 ATI
+driver. They include:
+
+ o A number of system lockups and blank screens have been reported when
+ using PCI Mach64 adapters. The great majority of these problems have
+ been found to be due to system aspects that are unrelated to this
+ driver. As of this writing, these problems can be divided into three
+ general areas:
+
+ Improper mouse protocol specification with some recent mice. Try dif-
+ ferent protocol specifications or another mouse.
+
+ A system conflict with APM. This problem is Linux-specific. There is a
+ bug in kernels 2.0.31 or earlier that prevents proper APM operation.
+ Upgrade to a more recent kernel or disable APM support.
+
+ The TV port on some Mach64 adapters needs to be disabled using an ATI
+ utility that might or might not be supplied with the adapter. This
+ problem is still under investigation. The only known workaround is to
+ ensure no cable is connected to the adapter's TV connector on bootup.
+
+ o When using a Mach64's accelerator CRTC, the virtual resolution must be
+ less than 8192 pixels wide. The VGA CRTC further limits the virtual
+ resolution width to less than 4096 pixels, or to less than 2048 pixels
+ for adapters based on 18800-x's (with 256kB of memory) and on Mach64
+ integrated controllers. These are hardware limits that cannot be cir-
+ cumvented.
+
+ o Virtual resolutions requiring more than 1MB of video memory (256kB in
+ the monochrome case) are not supported by the VGA CRTC on 88800GX and
+ 88800CX adapters. This is a hardware limit that cannot be circumvented.
+
+ o Due to hardware limitations, doublescanned modes are not supported by
+ the accelerator CRTC in 88800GX, 88800CX, 264CT and 264ET adapters.
+
+ o The ``VScan'' modeline parameter is only supported when using the VGA
+ CRTC.
+
+ o Interlaced modes are not supported on 18800-x and 28800-x adapters when
+ using a virtual resolution that is 2048 pixels or wider. This is yet
+ another hardware limitation that cannot be circumvented. For now, the
+ driver prevents the occurrence of this problem by restricting virtual
+ resolutions to be less than 2048 pixels wide, even when no interlaced
+ modes are specified.
+
+ o Video memory banking does not work in monochrome and 16-colour modes on
+ 18800-x adapters. This appears to be another hardware limit, but this
+ conclusion cannot be confirmed at this time. The driver's default
+ behaviour in this case is to limit video memory to 256kB.
+
+ o Video memory corruption can still occur during mode switches on 18800-x
+ adapters. Symptoms of this problem include garbled fonts on return to
+ text mode, and various effects (snow, dashed lines, etc) on initial
+ entry into a graphics mode. In the first case, the workaround is to use
+ some other means of restoring the text font. On Linux, this can be
+ accomplished with the kbd or svgalib packages. In the second case, xre-
+ fresh(1) will usually clean up the image. No complete solution to this
+ problem is currently known. It appears this corruption occurs due to
+ either video memory bandwidth or RAMDAC limitations, and so the driver
+ will limit mode clocks to 40MHz.
+
+ o There is some controversy over what the maximum allowed clock frequency
+ should be on 264xT and 3D Rage adapters. For now, clocks will, by
+ default, be limited to 80MHz, 135MHz, 170MHz, 200MHz or 230MHz, depend-
+ ing on the specific controller. This limit can only be increased (up to
+ a driver-calculated absolute maximum) through the DACSpeed specification
+ in XF86Config. Be aware however that doing so is untested and might
+ damage the adapter.
+
+ o Except as in the previous items, clocks are limited to 80MHz on most
+ adapters, although many are capable of higher frequencies. This will be
+ fixed in a future release.
+
+Support for the following will be added in a future release:
+
+ o Mach32 accelerator's CRTC. This support is the first step towards
+ accelerated support for Mach32's, Mach8's, 8514/A's and other clones.
+
+ o Colour depth greater than 8, where permitted by the hardware.
+
+ o Mach64, Mach32, Mach8 and 8514/A Draw Engines.
+
+ o Hardware cursors.
+
+7. Reporting problems
+
+If you are experiencing problems that are not already recorded in this docu-
+ment, first ensure that you have the latest current release of this driver
+and XFree86. Check the server's stderr output and
+ftp://ftp.xfree86.org/pub/XFree86 if you are uncertain.
+
+Secondly, please check XFree86's doc directory for additional information.
+
+Thirdly, do not forget to read http://www.xfree86.org/FAQ.
+
+Fourth, a scan through the comp.windows.x.i386unix and comp.os.linux.x news-
+groups using your favourite archiving service can also prove useful in
+resolving problems.
+
+If you are still experiencing problems, you can send me e-mail at <tsi@ual-
+berta.ca>. Please be as specific as possible when describing the problem(s),
+and include an unedited copy of the server's stderr and the XF86Config file
+used.
+
+8. Driver history
+
+The complete history of the driver is rather cloudy. The following is more
+than likely to be incomplete and inaccurate.
+
+Apparently, Per Lindqvist first got a driver working with an early ATI
+adapter under X386 1.1a. This original driver might have actually been based
+on a non-functional ATI driver written by Thomas Roell (currently of Xi
+Graphics).
+
+Then Doug Evans (dje@cygnus.com) added support for the ATI VGA Wonder XL,
+trying in the process to make the driver work with all other ATI adapters
+available at the time.
+
+Rik Faith (faith@cs.unc.edu) obtained the X11R4 driver from Doug Evans in the
+summer of 1992 and ported the code to the X386 part of X11R5. This subse-
+quently became part of XFree86.
+
+I (Marc Aurele La France) took over development and maintenance of the driver
+in the fall of 1993 after Rik got rid of his VGA Wonder adapter.
+
+9. Driver versions
+
+Due to the introduction of loadable drivers in XFree86 4.0, it has become
+necessary to track driver versions separately. With this release of the
+driver, I am introducing the following version numbering scheme.
+
+Version 1 of this driver is the one I inherited from Rik Faith. This is the
+version found in XFree86 2.0 and 2.1.
+
+Version 2 is my first rewrite of this code which only ended up being a par-
+tially unsuccessful attempt at generalizing the driver for all VGA Wonder,
+Mach32, and early Mach64 adapters. Various releases of this version of the
+driver can be found in XFree86 2.1.1, 3.1, 3.1.1 and 3.1.2.
+
+Version 3 represents my second rewrite (although a rather lame one as
+rewrites go). Into version 3, I introduced clock programming for Mach64
+adapters and merged in the old ati_test debugging tool. This is the version
+found in XFree86 3.2, 3.3 and 3.3.1.
+
+Version 4 is a rather major restructuring of version 3, which became larger
+than I could comfortably handle in one source file. This version will make
+it quite a bit easier to introduce new function such as acceleration, addi-
+tional colour depths, and so on. This is the version found in XFree86 3.3.2,
+3.3.3, 3.3.3.1, 3.3.3.2 and 3.3.4.
+
+Version 5 is an almost complete restructuring of version 4 to fit in the new
+driver API of XFree86 4.0.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.25 1999/08/21 13:48:29 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.40 1999/08/22 05:35:49 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.chips b/xc/programs/Xserver/hw/xfree86/doc/README.chips
new file mode 100644
index 000000000..6541d678a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.chips
@@ -0,0 +1,864 @@
+ Information for Chips and Technologies Users
+
+ David Bateman (dbateman@eng.uts.edu.au),
+ Egbert Eich (Egbert.Eich@Physik.TH-Darmstadt.DE)
+
+ 19th July 1999
+
+1. Introduction
+
+With the release of XFree86 version 3.9.16, the Chips and Technologies driver
+has been extensively rewritten and contains many new features. This driver
+must be considered work in progress, and those users wanting stability are
+encouraged to use the older XFree86 3.3.x versions. However this version of
+the Chips and Technologies driver has many new features and bug fixes that
+might make users prefer to use this version. These features include
+
+ o The long standing black/blue screen problem that some people have had
+ should be fixed.
+
+ o Hardware/Software cursor switching on the fly, that should fix many of
+ the known hardware cursor problems.
+
+ o Gamma correction at all depths and DirectColor visuals for depths of 15
+ or greater with the HiQV series of chipsets.
+
+ o Supports PsuedoColor overlays on 16bpp TrueColor screens for HiQV.
+
+ o 32bpp pixmaps while using a framebuffer in 24bpp packed pixel mode.
+
+ o Heaps more acceleration.
+
+ o 1/4bpp support.
+
+ o Multihead
+
+ o Much more...
+
+This document attempts to discuss the features of this driver, the options
+useful in configuring it and the known problems. Most of the Chips and Tech-
+nologies chipsets are supported by this driver to some degree.
+
+2. Supported Chips
+
+The Chips and Technologies chipsets supported by this driver have one of
+three basic architectures. A basic architecture, the WinGine architecture
+which is a modification on this basic architecture and a completely new HiQV
+architecture.
+
+2.1 Basic architecture
+
+ ct65520
+ (Max Ram: 1Mb, Max Dclk: 68MHz@5V)
+
+ ct65525
+ This chip is basically identical to the 65530. It has the same ID
+ and is identified as a 65530 when probed. See ct65530 for
+ details.
+
+ ct65530
+ This is a very similar chip to the 65520. However it additionally
+ has the ability for mixed 5V and 3.3V operation and linear
+ addressing of the video memory. (Max Ram: 1Mb, Max Dclk:
+ 56MHz@3.3V, 68MHz@5V)
+
+ ct65535
+ This is the first chip of the ct655xx series to support fully
+ programmable clocks. Otherwise it has the the same properties as
+ the 65530.
+
+ ct65540
+ This is the first version of the of the ct655xx that was capable
+ of supporting Hi-Color and True-Color. It also includes a fully
+ programmable dot clock and supports all types of flat panels.
+ (Max Ram: 1Mb, Max Dclk: 56MHz@3.3V, 68MHz@5V)
+
+ ct65545
+ The chip is very similar to the 65540, with the addition of H/W
+ cursor, pop-menu acceleration, BitBLT and support of PCI Buses.
+ PCI version also allow all the BitBLT and H/W cursor registers to
+ be memory mapped 2Mb above the Base Address. (Max Ram: 1Mb, Max
+ Dclk: 56MHz@3.3V,68MHz@5V)
+
+ ct65546
+ This chip is specially manufactured for Toshiba, and so documen-
+ tation is not widely available. It is believed that this is
+ really just a 65545 with a higher maximum dot-clock of 80MHz.
+ (Max Ram: 1Mb?, Max Dclk: 80MHz?)
+
+ ct65548
+ This chip is similar to the 65545, but it also includes XRAM sup-
+ port and supports the higher dot clocks of the 65546. (Max Ram:
+ 1Mb, Max Dclk: 80MHz)
+
+2.2 WinGine architecture
+
+ ct64200
+ This chip, also known as the WinGine, is used in video cards for
+ desktop systems. It often uses external DAC's and programmable
+ clock chips to supply additional functionally. None of these are
+ currently supported within the driver itself, so many cards will
+ only have limited support. Linear addressing is not supported for
+ this card in the driver. (Max Ram: 2Mb, Max Dclk: 80MHz)
+
+ ct64300
+ This is a more advanced version of the WinGine chip, with speci-
+ fication very similar to the 6554x series of chips. However there
+ are many differences at a register level. A similar level of
+ acceleration to the 65545 is included for this driver. (Max Ram:
+ 2Mb, Max Dclk: 80MHz)
+
+2.3 HiQV Architecture
+
+ ct65550
+ This chip includes many new features, including improved BitBLT
+ support (24bpp color expansion, wider maximum pitch, etc), Multi-
+ media unit (video capture, zoom video port, etc) and 24bpp uncom-
+ pressed true color (i.e 32bpp mode). Also memory mapped I/O is
+ possible on all bus configurations. (Max Ram: 2Mb, Max Dclk:
+ 80MHz@3.3V,100MHz@5V)
+
+ ct65554
+ This chip is similar to the 65550 but has a 64bit memory bus as
+ opposed to a 32bit bus. It also has higher limits on the maximum
+ memory and pixel clocks (Max Ram: 4Mb, Max Dclk: 100MHz@3.3V)
+
+ ct65555
+ Similar to the 65554 but has yet higher maximum memory and pixel
+ clocks. It also includes a new DSTN dithering scheme that
+ improves the performance of DSTN screens. (Max Ram: 4Mb, Max
+ Dclk: 110MHz@3.3V)
+
+ ct68554
+ Similar to the 65555 but also incorporates "PanelLink" drivers.
+ This serial link allows an LCD screens to be located up to 100m
+ from the video processor. Expect to see this chip soon in LCD
+ desktop machines (Max Ram: 4Mb, Max Dclk: 110MHz@3.3V)
+
+ ct69000
+ Similar to the 65555 but incorporates 2Mbytes of SGRAM on chip.
+ It is the first Chips and Technologies chipset where all of the
+ registers are accessible through MMIO, rather than just the Bit-
+ Blt registers. (Max Ram: 2Mb Only, Max Dclk: 130MHz@3.3V)
+
+ ct69030
+ Similar to the 69000 but incorporates 4Mbytes of SGRAM on chip
+ and has faster memory and pixel clock limits. Also includes a
+ second display channel so that the CRT can display independently
+ of the LCD. (Max Ram: 4Mb Only, Max Dclk: 170MHz@3.3V)
+
+3. XF86Config Options
+
+The following options are of particular interest to the Chips and Technolo-
+gies driver. It should be noted that the options are case insensitive, and
+that white space and "_" characters are ignored. There are therefore a wide
+variety of possible forms for all options. The forms given below are the
+preferred forms.
+
+Options related to drivers can be present in the Screen, Device and Monitor
+sections and the Display subsections. The order of precedence is Display,
+Screen, Monitor, Device.
+
+ Option "NoAccel"
+ This option will disable the use of any accelerated functions.
+ This is likely to help with some problems related to DRAM timing,
+ high dot clocks, and bugs in accelerated functions, at the cost
+ of performance (which will still be reasonable on VLB/PCI).
+
+ VideoRam 1024 (or another value)
+ This option will override the detected amount of video memory,
+ and pretend the given amount of memory is present on the card.
+
+ Option "NoLinear"
+ By default linear addressing is used on all chips where it can be
+ set up automatically. The exception is for depths of 1 or 4bpp
+ where linear addressing is turned off by default. It is possible
+ to turn the linear addressing off with this option. Note that H/W
+ acceleration is only supported with linear addressing.
+
+ Option "Linear"
+ When the chipset is capable of linear addressing and it has been
+ turned off by default, this option can be used to turn it back
+ on. This is useful for the 65530 chipset where the base address
+ of the linear framebuffer must be supplied by the user, or at
+ depths 1 and 4bpp. Note that linear addressing at 1 and 4bpp is
+ not guaranteed to work correctly.
+
+ MemBase 0x03b00000 (or a different address)
+ This sets the physical memory base address of the linear frame-
+ buffer. Typically this is probed correctly, but if you believe it
+ to be mis-probed, this option might help. Also for non PCI
+ machines specifying this force the linear base address to be this
+ value, reprogramming the video processor to suit. Note that for
+ the 65530 this is required as the base address can't be correctly
+ probed.
+
+ Option "HWcursor"
+ For chipsets that support hardware cursors, this option enforces
+ their use, even for cases that are known to cause problems on
+ some machines. Note that it is overridden by the "SWcursor"
+ option. Hardware cursors effectively speeds all graphics opera-
+ tions as the job of ensuring that the cursor remains on top is
+ now given to the hardware. It also reduces the effect of cursor
+ flashing during graphics operations.
+
+ Option "SWcursor"
+ This disables use of the hardware cursor provided by the chip.
+ Try this if the cursor seems to have problems.
+
+ Option "STN"
+ The server is unable to differentiate between SS STN and TFT dis-
+ plays. This forces it to identify the display as a SS STN rather
+ than a TFT.
+
+ Option "UseModeline"
+ The flat panel timings are related to the panel size and not the
+ size of the mode specified in XF86Config. For this reason the
+ default behaviour of the server is to use the panel timings
+ already installed in the chip. The user can force the panel tim-
+ ings to be recalculated from the modeline with this option. How-
+ ever the panel size will still be probed.
+
+ Option "FixPanelSize"
+ For some machines the LCD panel size is incorrectly probed from
+ the registers. This option forces the LCD panel size to be over-
+ ridden by the modeline display sizes. This will prevent the use
+ of a mode that is a different size than the panel. Before using
+ this check that the server reports an incorrect panel size. This
+ option can be used in conjunction with the option "UseModeline"
+ to program all the panel timings using the modeline values.
+
+ Option "NoStretch"
+ When the size of the mode used is less than the panel size, the
+ default behaviour of the server is to stretch the mode in an
+ attempt to fill the screen. A "letterbox" effect with no stretch-
+ ing can be achieved using this option.
+
+ Option "LcdCenter"
+ When the size of the mode used is less than the panel size, the
+ default behaviour of the server is to align the left hand edge of
+ the display with the left hand edge of the screen. Using this
+ option the mode can be centered in the screen. This option is
+ reported to have problems with some machines at 16/24/32bpp, the
+ effect of which is that the right-hand edge of the mode will be
+ pushed off the screen.
+
+ Option "HWclocks"
+ For the chips either using the WinGine or basic architectures,
+ the chips generates a number of fixed clocks internally. With the
+ chips 65535 and later or the 64300, the default is to use the
+ programmable clock for all clocks. It is possible to use the
+ fixed clocks supported by the chip instead by using this option.
+ Typically this will give you some or all of the clocks 25.175,
+ 28.322, 31.000 and 36.000MHz. The current programmable clock will
+ be given as the last clock in the list. On a cold-booted system
+ this might be the appropriate value to use at the text console
+ (see the "TextClockFreq" option), as many flat panels will need a
+ dot clock different than the default to synchronise. The pro-
+ grammable clock makes this option obsolete and so it's use isn't
+ recommended. It is completely ignored for HiQV chipsets.
+
+ Option "UseVclk1"
+ The HiQV series of chips have three programmable clocks. The
+ first two are usually loaded with 25.175 and 28.322MHz for VGA
+ backward compatibility, and the third is used as a fully pro-
+ grammable clock. On at least one system (the Inside 686 LCD/S
+ single board computer) the third clock is unusable. This option
+ forces the use of VClk1 as the programmable clock.
+
+ TextClockFreq 25.175
+ Except for the HiQV chipsets, it is impossible for the server to
+ read the value of the currently used frequency for the text con-
+ sole when using programmable clocks. Therefore the server uses a
+ default value of 25.175MHz as the text console clock. For some
+ LCDs, in particular DSTN screens, this clock will be wrong. This
+ allows the user to select a different clock for the server to use
+ when returning to the text console.
+
+ Option "FPClock8" "65.0"
+ Option "FPClock16" "65.0" Option "FPClock24" "65.0" Option
+ "FPClock32" "65.0"" In general the LCD panel clock should be set
+ independently of the modelines supplied. Normally the chips BIOS
+ set the flat panel clock correctly and so the default behaviour
+ with HiQV chipset is to leave the flat panel clock alone, or
+ force it to be 90% of the maximum allowable clock if the current
+ panel clock exceeds the dotclock limitation due to a depth
+ change. This option allows the user to force the server the
+ reprogram the flat panel clock independently of the modeline with
+ HiQV chipset. The four options are for 8bpp or less, 16, 24 or
+ 32bpp LCD panel clocks, where the options above set the clocks to
+ 65MHz.
+
+ Option "MMIO"
+ This has a different effect depending on the hardware on which it
+ is used. For the 6554x machines MMIO is only used to talk to the
+ BitBLT engine and is only usable with PCI buses. It is enabled
+ by default for 65545 machines since the blitter can not be
+ used otherwise. The HiQV series of chipsets must use MMIO with
+ their BitBLT engines, and so this is enabled by default. However
+ the 690xx chipsets can use MMIO for all communications with the
+ video processor. So using this option on a 690xx chipset forces
+ them to use MMIO for all communications. This only makes sense
+ when the 690xx is on a PCI bus so that normal PIO can be dis-
+ abled. (WARNING!! 690xx MMIO is untested)
+
+ Option "SuspendHack"
+ This option sets the centering and stretching to the BIOS default
+ values. This can fix suspend/resume problems on some machines. It
+ overrides the options "LcdCenter" and "NoStretch".
+
+ Option "18bitBus" (Chips 65540/45/46/48)
+ For 24bpp on TFT screens, the server assumes that a 24bit bus is
+ being used. This can result in a reddish tint to 24bpp mode.
+ This option, selects an 18 bit TFT bus. For other depths this
+ option has no effect.
+
+ Chipset "ct65546" (or some other chip)
+ It is possible that the chip could be misidentified, particular
+ due to interactions with other drivers in the server. It is pos-
+ sible to force the server to identify a particular chip with this
+ option.
+
+ Option "SyncOnGreen"
+ Composite sync on green. Possibly useful if you wish to use an
+ old workstation monitor. The HiQV internal RAMDAC's supports this
+ mode of operation, but whether a particular machine does depends
+ on the manufacturer.
+
+ DacSpeed 80.000
+ The server will limit the maximum dotclock to a value as speci-
+ fied by the manufacturer. This might make certain modes impossi-
+ ble to obtain with a reasonable refresh rate. Using this option
+ the user can override the maximum dot-clock and specify any value
+ they prefer. Use caution with this option, as driving the video
+ processor beyond its specifications might cause damage.
+
+ Option "SetMClk" "38.000MHz"
+ Option "SetMClk" "38000kHz"" This option sets the internal memory
+ clock (MCLK) registers of HiQV chipsets to 38MHz or some other
+ value. Use caution as excess heat generated by the video proces-
+ sor if its specifications are exceeded might cause damage. How-
+ ever careful use of this option might boost performance. This
+ option might also be used to reduce the speed of the memory clock
+ to preserve power in modes that don't need the full speed of the
+ memory to work correctly. This option might also be needed to
+ reduce the speed of the memory clock with the "Overlay" option.
+
+ Option "RGBbits" "8"
+ By default it is assumed that there are 6 significant bits in the
+ RGB representation of the colours in 4bpp and above. If the
+ colours seem darker than they should be, perhaps your ramdac is
+ has 8 significant bits. This option forces the server to assume
+ that there are 8 significant bits.
+
+ Option "ShowCache"
+ This is a debugging option and general users have no need of it.
+ Using this option, when the virtual desktop is scrolled away from
+ the zero position, the pixmap cache becomes visible. This is use-
+ ful to see that pixmaps, tiles, etc have been properly cached.
+
+ Option "ShadowFB"
+ This option is only useful when acceleration can't be used and
+ linear addressing can be used. With this option all of the graph-
+ ics are rendered into a copy of the framebuffer that is keep in
+ the main memory of the computer, and the screen is updated from
+ this copy. In this way the expensive operation of reading back to
+ contents of the screen is never performed and the performance is
+ improved. Because the rendering is all done into a virtual frame-
+ buffer acceleration can not be used.
+
+ Option "Overlay"
+ The HiQV chipsets contain a multimedia engine that allow a 16bpp
+ window to be overlayed on the screen. This driver uses this capa-
+ bility to include a 16bpp framebuffer on top of an 8bpp frame-
+ buffer. In this way PseudoColor and TrueColor visuals can be used
+ on the same screen. XFree86 believes that the 8bpp framebuffer
+ is overlayed on the 16bpp framebuffer. Therefore to use this
+ option the server must be started in either 15 or 16bpp depth.
+ Also the maximum size of the desktop with this option is
+ 1024x1024, as this is the largest window that the HiQV multimedia
+ engine can display. Note that this option using the multimedia
+ engine to its limit, and some manufacturers have set a default
+ memory clock that will cause pixel errors with this option. If
+ you get pixel error with this option try using the "SetMClk"
+ option to slow the memory clock.
+
+ Option "ColorKey" "255"
+ Normally the color transparency key for the overlay is the 8bpp
+ lookup table entry 255. This might cause troubles with some
+ applications, and so this option allows the color transparency
+ key to be set to some other value. Legal values are 2 to 255
+ inclusive.
+
+ Option "XaaNoScreenToScreenCopy",
+ Option "XaaNoSolidFillRect", Option "XaaNoSolidHorVertLine",
+ Option "XaaNoMono8x8PatternFillRect", Option "XaaNoColor8x8Pat-
+ ternFillRect", Option "XaaNoCPUToScreenColorExpandFill", Option
+ "XaaNoScreenToScreenColorExpandFill", Option "XaaNoIm-
+ ageWriteRect", Option "XaaNoImageReadRect", Option "XaaNoPixmap-
+ Cache", Option "XaaNoOffscreenPixmaps" " These option individu-
+ ally disable the features of the XAA acceleration code that the
+ Chips and Technologies driver uses. If you have a problem with
+ the acceleration and these options will allow you to isolation
+ the problem. This information will be invaluable in debugging any
+ problems.
+
+4. Modelines
+
+When constructing a modeline for use with the Chips and Technologies driver
+you'll needed to considered several points
+
+ * Virtual Screen Size
+ It is the virtual screen size that determines the amount of mem-
+ ory used by a mode. So if you have a virtual screen size set to
+ 1024x768 using a 800x600 at 8bpp, you use 768kB for the mode.
+ Further to this some of the XAA acceleration requires that the
+ display pitch is a multiple of 64 pixels. So the driver will
+ attempt to round-up the virtual X dimension to a multiple of 64,
+ but leave the virtual resolution untouched. This might further
+ reduce the available memory.
+
+ * 16/24/32 Bits Per Pixel
+ Hi-Color and True-Color modes are implemented in the server. The
+ clocks in the 6554x series of chips are internally divided by 2
+ for 16bpp and 3 for 24bpp, allowing one modeline to be used at
+ all depths. The effect of this is that the maximum dot clock
+ visible to the user is a half or a third of the value at 8bpp.
+ The HiQV series of chips doesn't need to use additional clock
+ cycles to display higher depths, and so the same modeline can be
+ used at all depths, without needing to divide the clocks. Also
+ 16/24/32 bpp modes will need 2 , 3 or 4 times respectively more
+ video ram.
+
+ * Frame Acceleration
+ Many DSTN screens use frame acceleration to improve the perfor-
+ mance of the screen. This can be done by using an external frame
+ buffer, or incorporating the framebuffer at the top of video ram
+ depending on the particular implementation. The Xserver assumes
+ that the framebuffer, if used, will be at the top of video ram.
+ The amount of ram required for the framebuffer will vary depend-
+ ing on the size of the screen, and will reduce the amount of
+ video ram available to the modes. Typical values for the size of
+ the framebuffer will be 61440 bytes (640x480 panel), 96000 bytes
+ (800x600 panel) and 157287 bytes (1024x768 panel).
+
+ * H/W Acceleration
+ The H/W cursor will need 1kB for the 6554x and 4kb for the 65550.
+ On the 64300 chips the H/W cursor is stored in registers and so
+ no allowance is needed for the H/W cursor. In addition to this
+ many graphics operations are speeded up using a "pixmap cache".
+ Leaving too little memory available for the cache will only have
+ a detrimental effect on the graphics performance.
+
+ * PseudoColor Overlay
+ If you use the "overlay" option, then there are actually two
+ framebuffers in the video memory. An 8bpp one and a 16bpp one.
+ The total memory requirements in this mode of operation is there-
+ fore similar to a 24bpp mode. The overlay consumes memory band-
+ width, so that the maximum dotclock will be similar to a 24bpp
+ mode.
+
+ * VESA like modes
+ We recommend that you try and pick a mode that is similar to a
+ standard VESA mode. If you don't a suspend/resume or LCD/CRT
+ switch might mess up the screen. This is a problem with the video
+ BIOS not knowing about all the funny modes that might be
+ selected.
+
+ * Dot Clock
+ For LCD screens, the lowest clock that gives acceptable contrast
+ and flicker is usually the best one. This also gives more memory
+ bandwidth for use in the drawing operations. Some users prefer to
+ use clocks that are defined by their BIOS. This has the advantage
+ that the BIOS will probably restore the clock they specified
+ after a suspend/resume or LCD/CRT switch. For a complete discus-
+ sion on the dot clock limitations, see the next section.
+
+The driver is capable of driving both a CRT and a flat panel display. In fact
+the timing for the flat panel are dependent on the specification of the panel
+itself and are independent of the particular mode chosen. For this reason it
+is recommended to use one of the programs that automatically generate
+XF86Config files, such as "xf86config" or "XF86Setup".
+
+However there are many older machines, particularly those with 800x600 screen
+or larger, that need to reprogram the panel timings. The reason for this is
+that the manufacturer has used the panel timings to get a standard EGA mode
+to work on flat panel, and these same timings don't work for an SVGA mode.
+For these machines the "UseModeline" and/or possibly the "FixPanelSize"
+option might be needed. Some machines that are known to need these options
+include.
+
+ Modeline "640x480@8bpp" 25.175 640 672 728 816 480 489 501 526
+ Modeline "640x480@16bpp" 25.175 640 672 728 816 480 489 501 526
+ Options: "UseModeline"
+ Tested on a Prostar 8200, (640x480, 65548, 1Mbyte)
+
+ Modeline "800x600@8bpp" 28.322 800 808 848 936 600 600 604 628
+ Options: "FixPanelSize", "UseModeline"
+ Tested on a HP OmniBook 5000CTS (800x600 TFT, 65548, 1Mbyte)
+
+ Modeline "800x600@8bpp" 30.150 800 896 960 1056 600 600 604 628
+ Options: "FixPanelSize", "UseModeline"
+ Test on a Zeos Meridan 850c (800x600 DSTN, 65545, 1Mbyte)
+
+The NEC Versa 4080 just needs the "FixPanelSize" option. To the best of my
+knowledge no machine with a HiQV needs the "UseModeline" or "FixPanelSize"
+options.
+
+5. The Full Story on Clock Limitations
+
+There has been much confusion about exactly what the clock limitations of the
+Chips and Technologies chipsets are. Hence I hope that this section will
+clear up the misunderstandings.
+
+In general there are two factors determining the maximum dotclock. There is
+the limit of the maximum dotclock the video processor can handle, and there
+is another limitation of the available memory bandwidth. The memory bandwidth
+is determined by the clock used for the video memory. For chipsets incapable
+of colour depths greater that 8bpp like the 65535, the dotclock limit is
+solely determined by the highest dotclock the video processor is capable of
+handling. So this limit will be either 56MHz or 68MHz for the 655xx chipsets,
+depending on what voltage they are driven with, or 80MHz for the 64200
+WinGine machines.
+
+The 6554x and 64300 WinGine chipsets are capable of colour depths of 16 or
+24bpp. However there is no reliable way of probing the memory clock used in
+these chipsets, and so a conservative limit must be taken for the dotclock
+limit. In this case the driver divides the video processors dotclock limita-
+tion by the number of bytes per pixel, so that the limitations for the vari-
+ous colour depths are
+
+ 8bpp 16bpp 24bpp
+ 64300 85 42.5 28.33
+ 65540/65545 3.3v 56 28 18.67
+ 65540/65545 5v 68 34 22.67
+ 65546/65548 80 40 26.67
+
+For a CRT or TFT screen these limitations are conservative and the user might
+safely override them with the "DacSpeed" option to some extent. However these
+numbers take no account of the extra bandwidth needed for DSTN screens.
+
+For the HiQV series of chips, the memory clock can be successfully probed.
+Hence you will see a line like
+
+ (--) CHIPS(0): Probed memory clock of 40.090 MHz
+
+in your startx log file. Note that many chips are capable of higher memory
+clocks than actually set by BIOS. You can use the "SetMClk" option in your
+XF86Config file to get a higher MClk. However some video ram, particularly
+EDO, might not be fast enough to handle this, resulting in drawing errors on
+the screen. The formula to determine the maximum usable dotclock on the HiQV
+series of chips is
+
+ Max dotclock = min(MaxDClk, 0.70 * 4 * MemoryClk / (BytesPerPixel +
+ (isDSTN == TRUE ? 1 : 0)))
+
+which says that there are two limits on the dotclock. One the overall maxi-
+mum, and another due to the available memory bandwidth of the chip. For the
+memory bandwidth 4 bytes are transfered every clock cycle (Hence the 4), but
+after accounting for the RAS/CAS signaling only about 70% of the bandwidth is
+available. The whole thing is divided by the bytes per pixel, plus an extra
+byte if you are using a DSTN. The extra byte with DSTN screens is used for
+the frame buffering/acceleration in these screens. So for the various Chips
+and Technologies chips the maximum specifications are
+
+ Max DClk MHz Max Mem Clk MHz
+ 65550 rev A 3.3v 80 38
+ 65550 rev A 5v 110 38
+ 65550 rev B 95 50
+ 65554 94.5 55
+ 65555 110 55
+ 68554 110 55
+ 69000 135 83
+ 69030 170 100
+
+Note that all of the chips except the 65550 rev A are 3.3v only. Which is the
+reason for the drop in the dot clock. Now the maximum memory clock is just
+the maximum supported by the video processor, not the maximum supported by
+the video memory. So the value actually used for the memory clock might be
+significantly less than this maximum value. But assuming your memory clock is
+programmed to these maximum values the various maximum dot clocks for the
+chips are
+
+ ------CRT/TFT------- --------DSTN--------
+ 8bpp 16bpp 24bpp 8bpp 16bpp 24bpp
+ 65550 rev A 3.3v 80 53.2 35.47 53.2 35.47 26.6
+ 65550 rev A 5v 106.2 53.2 35.47 53.2 35.47 26.6
+ 65550 rev B 95 70 46.67 70 46.67 35.0
+ 65554 94.5 77 51.33 77 51.33 38.5
+ 65555 110 77 51.33 77 51.33 38.5
+ 68554 110 77 51.33 77 51.33 38.5
+ 69000 135 116.2 77.47 116.2 77.47 58.1
+ 69030 170 140 93.33 140 93.33 70
+
+If you exceed the maximum set by the memory clock, you'll get corruption on
+the screen during graphics operations, as you will be starving the HW BitBlt
+engine of clock cycles. If you are driving the video memory too fast (too
+high a MemClk) you'll get pixel corruption as the data actually written to
+the video memory is corrupted by driving the memory too fast. You can proba-
+bly get away with exceeding the Max DClk at 8bpp on TFT's or CRT's by up to
+10% or so without problems, it will just generate more heat, since the 8bpp
+clocks aren't limited by the available memory bandwidth.
+
+If you find you truly can't achieve the mode you are after with the default
+clock limitations, look at the options "DacSpeed" and "SetMClk". Using these
+should give you all the capabilities you'll need in the server to get a par-
+ticular mode to work. However use caution with these options, because there
+is no guarantee that driving the video processor beyond it capabilities won't
+cause damage.
+
+6. Troubleshooting
+
+ The cursor appears as a white box, after switching modes
+ There is a known bug in the H/W cursor, that sometimes causes the
+ cursor to be redrawn as a white box, when the mode is changed.
+ This can be fixed by moving the cursor to a different region,
+ switching to the console and back again, or if it is too annoying
+ the H/W cursor can be disabled by removing the "HWcursor" option.
+
+ The cursor hot-spot isn't at the same point as the cursor
+ With modes on the 6555x machines that are stretched to fill the
+ flat panel, the H/W cursor is not correspondingly stretched. This
+ is a small and long-standing bug in the current server. You can
+ avoid this by either using the "NoStretch" option or removing the
+ HWcursor" option.
+
+ The lower part of the screen is corrupted
+ Many DSTN screens use the top of video ram to implement a frame
+ accelerator. This reduces the amount of video ram available to
+ the modes. The server doesn't prevent the user from specifying a
+ mode that will use this memory, it prints a warning on the con-
+ sole. The effect of this problem will be that the lower part of
+ the screen will reside in the same memory as the frame accelera-
+ tor and will therefore be corrupt. Try reducing the amount of
+ memory consumed by the mode.
+
+ There is a video signal, but the screen doesn't sync.
+ You are using a mode that your screen cannot handle. If it is a
+ non-standard mode, maybe you need to tweak the timings a bit. If
+ it is a standard mode and frequency that your screen should be
+ able to handle, try to find different timings for a similar mode
+ and frequency combination. For LCD modes, it is possible that
+ your LCD panel requires different panel timings at the text con-
+ sole than with a graphics mode. In this case you will need the
+ "UseModeline" and perhaps also the "FixPanelSize" options to
+ reprogram the LCD panel timings to sensible values.
+
+ `Wavy' screen.
+ Horizontal waving or jittering of the whole screen, continuously
+ (independent from drawing operations). You are probably using a
+ dot clock that is too high (or too low); it is also possible that
+ there is interference with a close MCLK. Try a lower dot clock.
+ For CRT's you can also try to tweak the mode timings; try
+ increasing the second horizontal value somewhat.
+
+ Crash or hang after start-up (probably with a black screen).
+ Try the "NoAccel" or one of the XAA acceleration options dis-
+ cussed above. Check that the BIOS settings are OK; in particular,
+ disable caching of 0xa0000-0xaffff. Disabling hidden DRAM refresh
+ may also help.
+
+ Hang as the first text is appearing on the screen on SVR4 machines.
+ This problem has been reported under UnixWare 1.x, but not
+ tracked down. It doesn't occur under UnixWare 2.x and only occurs
+ on the HiQV series of chips. It might affect some other SVR4
+ operating systems as well. The workaround is to turn off the use
+ of CPU to screen acceleration with the "XaaNoCPUToScreenCol-
+ orExapndFill" option.
+
+ Crash, hang, or trash on the screen after a graphics operation.
+ This may be related to a bug in one of the accelerated functions,
+ or a problem with the BitBLT engine. Try the "NoAccel" or one of
+ the XAA acceleration options discussed above. Also check the BIOS
+ settings. It is also possible that with a high dot clock and
+ depth on a large screen there is very little bandwidth left for
+ using the BitBLT engine. Try reducing the clock.
+
+ Chipset is not detected.
+ Try forcing the chipset to a type that is most similar to what
+ you have.
+
+ The screen is blank when starting X
+ One possible cause of this problem with older linux kernels is
+ that the "APM_DISPLAY_BLANK" option didn't work correct. Either
+ upgrade your kernel or rebuild it with the "APM_DISPLAY_BLANK"
+ option disabled. If the problem remains, or you aren't using
+ linux, a CRT/LCD or switch to and from the virtual console will
+ often fix it.
+
+ Textmode is not properly restored
+ This has been reported on some configurations. Many laptops use
+ the programmable clock of the 6554x chips at the console. It is
+ not always possible to find out the setting that is used for this
+ clock if BIOS has written the MClk after the VClk. Hence the
+ server assumes a 25.175MHz clock at the console. This is correct
+ for most modes, but can cause some problems. Usually this is
+ fixed by switching between the LCD and CRT. Alternatively the
+ user can use the "TextClockFreq" option described above to select
+ a different clock for the text console. Another possible cause of
+ this problem is if linux kernels are compiled with the "APM_DIS-
+ PLAY_BLANK" option. As mentioned before, try disabling this
+ option.
+
+ I can't display 640x480 on my 800x600 LCD
+ The problem here is that the flat panel needs timings that are
+ related to the panel size, and not the mode size. There is no
+ facility in the current Xservers to specify these values, and so
+ the server attempts to read the panel size from the chip. If the
+ user has used the "UseModeline" or "FixPanelSize" options the
+ panel timings are derived from the mode, which can be different
+ than the panel size. Try deleting theses options from XF86Config
+ or using an LCD/CRT switch.
+
+ I can't get a 320x240 mode to occupy the whole 640x480 LCD
+ There is a bug in the 6554x's H/W cursor for modes that are dou-
+ bled vertically. The lower half of the screen is not accessible.
+ The servers solution to this problem is not to do doubling verti-
+ cally. Which results in the 320x240 mode only expanded to
+ 640x360. If this is a problem, a work around is to remove the
+ "HWcursor" option. The server will then allow the mode to occupy
+ the whole 640x480 LCD.
+
+ After a suspend/resume my screen is messed up
+ During a suspend/resume, the BIOS controls what is read and writ-
+ ten back to the registers. If the screen is using a mode that
+ BIOS doesn't know about, then there is no guarantee that it will
+ be resumed correctly. For this reason a mode that is as close to
+ VESA like as possible should be selected. It is also possible
+ that the VGA palette can be affected by a suspend/resume. Using
+ an 8bpp, the colour will then be displayed incorrectly. This
+ shouldn't affect higher depths, and is fixable with a switch to
+ the virtual console and back.
+
+ The right hand edge of the mode isn't visible on the LCD
+ This is usually due to a problem with the "LcdCenter" option. If
+ this option is removed form XF86Config, then the problem might go
+ away. Alternatively the manufacturer could have incorrectly pro-
+ grammed the panel size in the EGA console mode. The "FixPanel-
+ Size" can be used to force the modeline values into the panel
+ size registers. Two machines that are known to have this problem
+ are the "HP OmniBook 5000" and the "NEC Versa 4080".
+
+ My TFT screen has a reddish tint in 24bpp mode
+ For 6554x chipsets the server assumes that the TFT bus width is
+ 24bits. If this is not true then the screen will appear to have a
+ reddish tint. This can be fixed by using the "18BitBus" option.
+ Note that the reverse is also true. If the "18BitBus" is used and
+ the TFT bus width is 24bpp, then the screen will appear reddish.
+ Note that this option only has an effect on TFT screens.
+
+ SuperProbe won't work with my chipset
+ At least one non-PCI bus system with a HiQV chipset has been
+ found to require the "-no_bios" option for SuperProbe to cor-
+ rectly detect the chipset with the factory default BIOS settings.
+ The server itself can correctly detect the chip in the same situ-
+ ation.
+
+ My 690xx machine lockups when using the "MMIO" option
+ The 690xx MMIO mode has been implemented entirely from the manual
+ as I don't have the hardware to test it on. At this point no
+ testing has been done and it is entirely possible that the "MMIO
+ option will lockup your machine. You have been warned! However if
+ you do try this option and are willing to debug it, I'd like to
+ hear from you.
+
+ My TrueColor windows are corrupted when using the "Overlay" option
+ Chips and Technologies specify that the memory clock used with
+ the multimedia engine running should be lower than that used
+ without. As use of the HiQV chipsets multimedia engine was sup-
+ posed to be for things like zoomed video overlays, its use was
+ supposed to be occasional and so most machines have their memory
+ clock set to a value that is too high for use with the "Overlay"
+ option. So with the "Overlay" option, using the "SetMClk" option
+ to reduce the speed of the memory clock is recommended.
+
+ I can't start X-windows with 16, 24 or 32bpp
+ Firstly, is your machine capable of 16/24/32bpp with the mode
+ specified. Many LCD displays are incapable of using a 24bpp mode.
+ Also you need at least a 65540 to use 16/24bpp and at least a
+ 65550 for 32bpp. The amount of memory used by the mode will be
+ doubled/tripled/quadrupled. The correct options to start the
+ server with these modes are
+
+ startx -- -depth 16 5-6-5 RGB ('64K color', XGA)
+ startx -- -depth 15 5-5-5 RGB ('Hicolor')
+ startx -- -depth 24 8-8-8 RGB truecolor
+
+ or with the HiQV series of chips you might try
+
+ startx -- -depth 24 -fbbpp 32 8-8-8 RGB truecolor
+
+ however as XFree86 version 3.9.16 allows 32bpp pixmaps to be used
+ with framebuffers operating in 24bpp, this mode of operating will
+ cost performance for no gain in functionality.
+
+ Note that the "-bpp" option has been removed and replaced with a
+ "-depth" and "-fbbpp" option because of the confusion between the
+ depth and number of bits per pixel used to represent to frame-
+ buffer and the pixmaps in the screens memory.
+
+A general problem with the server that can manifested in many way such as
+drawing errors, wavy screens, etc is related to the programmable clock. Many
+potential programmable clock register setting are unstable. However luckily
+there are many different clock register setting that can give the same or
+very similar clocks. The clock code can be fooled into giving a different and
+perhaps more stable clock by simply changing the clock value slightly. For
+example 65.00MHz might be unstable while 65.10MHz is not. So for unexplained
+problems not addressed above, please try to alter the clock you are using
+slightly, say in steps of 0.05MHz and see if the problem goes away. Alterna-
+tively, using the "UseVClk1" option with HiQV chips might also help.
+
+For other screen drawing related problems, try the "NoAccel" or one of the
+XAA acceleration options discussed above. A useful trick for all laptop com-
+puters is to switch between LCD/CRT (usually with something like Fn-F5), if
+the screen is having problems.
+
+If you are having driver-related problems that are not addressed by this doc-
+ument, or if you have found bugs in accelerated functions, you can try con-
+tacting the XFree86 team (the current driver maintainer can be reached at
+dbateman@eng.uts.edu.au or Egbert.Eich@Physik.TH-Darmstadt.DE), or post in
+the Usenet newsgroup "comp.windows.x.i386unix".
+
+7. Disclaimer
+
+XFree86, allows the user to do damage to their hardware with software.
+Although the authors of this software have tried to prevent this, they dis-
+claim all responsibility for any damage caused by the software. Use caution,
+if you think the Xserver is frying your screen, TURN THE COMPUTER OFF!!
+
+8. Acknowledgement
+
+The authors of this software wish to acknowledge the support supplied by
+Chips and Technologies during the development of this software.
+
+9. Authors
+
+Major Contributors (In no particular order)
+
+ o Nozomi Ytow
+
+ o Egbert Eich
+
+ o David Bateman
+
+ o Xavier Ducoin
+
+Contributors (In no particular order)
+
+ o Ken Raeburn
+
+ o Shigehiro Nomura
+
+ o Marc de Courville
+
+ o Adam Sulmicki
+
+ o Jens Maurer
+
+We also thank the many people on the net who have contributed by reporting
+bugs and extensively testing this server.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.29 1999/08/28 11:18:16 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.27 1999/08/28 11:22:55 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.cirrus b/xc/programs/Xserver/hw/xfree86/doc/README.cirrus
new file mode 100644
index 000000000..598b778f2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.cirrus
@@ -0,0 +1,890 @@
+ Information for Cirrus Chipset Users
+
+ Harm Hanemaayer (H.Hanemaayer@inter.nl.net), Randy Hendry (randy@sgi.com)
+ (64xx), Corin Anderson (corina@the4cs.com)
+
+ 5 November 1998
+
+1. Supported chipsets
+
+There are two different SVGA drivers for Cirrus chipsets, one called ``cir-
+rus'' and one called ``cl64xx''. The ``cirrus'' driver is used in the
+256-color SVGA server (with acceleration) and the mono server (without accel-
+eration). The SVGA server supports 16, 24, and 32 bits-per-pixel truecolor
+modes on some configurations. The ``cl64xx'' driver is used in the 256-color
+SVGA, 16-color and mono servers. Note that except where stated otherwise,
+this document is referring to the ``cirrus'' driver. The following chipsets
+by Cirrus Logic are supported:
+
+ CL-GD5420
+ ISA SVGA chipset, 1Mbyte; maximum dot clock is 45 MHz (256 color
+ server). Acceleration with extended write modes (used for
+ scrolling and solid filling in this driver). This chipset can not
+ support 1024x768 non-interlaced in 256 colors.
+
+ CL-GD5422
+ Enhanced version of the 5420 (32-bit internal memory interface).
+ Maximum dot clock is 80 MHz.
+
+ CL-GD6205/6215/6225/6235
+ Laptop chipsets more or less compatible with the 5420. The only
+ dot clock supported is 25 MHz (more on an external display). Some
+ problems have been reported with these chipsets (especially on
+ external displays). Take note of the "noaccel" option.
+
+ CL-GD6420/6440
+ These chipsets are not compatible with the 542x series, but are
+ supported by the ``cl64xx'' driver. It is used in recent laptops,
+ and bears some similarity to old Cirrus chipsets (5410/AVGA2).
+ The driver may also work for other 64xx chips. The configuration
+ identifiers for this driver are "cl6420" and "cl6440". This
+ driver is discussed in detail in section The cl64xx Driver (sec-
+ tion 6., page 1).
+
+ CL-GD5424
+ Basically VLB version of the 5422, but resembles the 5426 in some
+ respects.
+
+ CL-GD5426
+ Supports both ISA bus and VLB, and up to 2Mbyte of memory. Has
+ BitBLT engine for improved acceleration (BitBlt, image transfer,
+ text). Dot clock limit is 85 MHz.
+
+ CL-GD5428
+ Enhanced version of the 5426.
+
+ CL-GD5429
+ Enhanced version of the 5428; officially supports higher MCLK and
+ has memory-mapped I/O.
+
+ CL-GD5430
+ Similar to 5429, but with 543x core (32-bit host interface).
+ Does not have 64-bit memory mode.
+
+ CL-GD5434
+ `Alpine' family chip with 64-bit internal memory interface. The
+ chip can only support 64-bit mode if equipped with 2 Mbytes of
+ memory; cards with only 1 Mbyte are severely limited. Supports
+ dot clocks up to 110 MHz (later chips support 135 MHz).
+
+ CL-GD5436
+ Highly optimized 5434.
+
+ CL-GD5440
+ Similar to the CL-GD5430, and detected as such.
+
+ CL-GD5446
+ Another member of the Alpine family of 2D accelerators; similar
+ to the CL-GD5436.
+
+ CL-GD5480
+ Newer Alpine family chip that support synchronous graphics RAM
+ (SGRAM).
+
+ CL-GD5462, CL-GD5464 and CL-GD5465
+ The Laguna VisualMedia family of 2D Accelerators. These chips
+ use Rambus RDRAM memory. The '62 is a 64-bit 2D accelerator,
+ including a BitBlit engine, video windows (not currently used by
+ the server), and 64x64 HW cursor. Mono modes have not been
+ tested. The CL-GD5464 is the next chip in the Laguna family, and
+ the CL-GD5465 is the latest member, both have been tested.
+
+ CL-GD7541/7542/7543/7548
+ Laptop chipsets more or less compatible with the 5428/3x. While
+ has it been tested on some configurations, not all configuration
+ may work correctly.
+
+ CL-GD7555
+ Limited untested support, without auto-detection, has been pro-
+ vided for this chip which is a 64-bit extension of the 754x fam-
+ ily. Use a Chipset "clgd7555" line.
+
+Here's a list of maximum dot clocks for each supported depth:
+
+ mono 8 bpp (256c) 16 bpp 24 bpp 32 bpp
+ CL-GD62x5 45 MHz 45 MHz
+ CL-GD5420 80 MHz 45 MHz (1)
+ CL-GD542x/512K 80 MHz 45 MHz
+ CL-GD5422/24 80 MHz 80 MHz 40 MHz 27 MHz
+ CL-GD5426/28 85 MHz 85 MHz 45 MHz (2) 28 MHz
+ CL-GD5429 85 MHz 85 MHz 50 MHz 28 MHz
+ CL-GD5430 85 MHz 85 MHz 45 MHz (2) 28 MHz
+ CL-GD5434/1Mb 85 MHz 85 MHz 42 MHz 28 MHz
+ CL-GD5434/2Mb 85 MHz 110/135 MHz 85 MHz 28 MHz 45/50 MHz (2)
+ CL-GD5436/1Mb 85 MHz 110 MHz (3) 60 MHz (3) 40 MHz (3)
+ CL-GD5436/2Mb 85 MHz 135 MHz 85 MHz 85 MHz (3) 60 MHz (3)
+ CL-GD5446/1Mb 85 MHz 110 MHz (3) 60 MHz (3) 40 MHz (3)
+ CL-GD5446/2Mb 85 MHz 135 MHz 85 MHz 85 MHz (3) 60 MHz (3)
+ CL-GD5462 170 MHz 170 Mhz 170 MHz 170 MHz 135 MHz
+ CL-GD5464/65 170 MHz 230 Mhz 170 MHz 170 MHz 135 MHz
+ CL-GD5480 85 MHz 200 MHz 100 MHz 100 MHz 50 MHz
+ CL-GD754x 80 MHz 80 MHz 40 MHz (4) (5)
+
+ (1) with 512K memory.
+ (2) 50 MHz with high MCLK setting.
+ (3) Depends on memory clock.
+ (4) This may be too low for some chips.
+ (5) This depth may actually work if it is enabled and tested.
+
+Rough virtual/physical screen resolution limits for different amounts of
+video memory:
+
+ mono 8 bpp 16 bpp 24 bpp 32 bpp
+ 256K 800x600 640x400
+ 512K 1152x900 800x600 640x400
+ 1024K 1600x1200 1152x900 800x600 680x510
+ 2048K 2304x1728 1600x1200 1152x900 960x720 800x600
+ 4096K 2304x1728 2272x1704 1600x1200 1360x1020 1152x900
+
+For 546x chips, the above table isn't quite accurate. While the virtual
+width may be any size, the screen pitch will be rounded up to the nearest
+value in the table below. Thus, each line on the screen will take more video
+memory than just what is displayed. To maximize video memory, then, choose
+the virtual desktop width from the table of pixel widths below:
+
+ 8bpp: 640, 1024, 1280, 1664, 2048, 2560, 3328, 4096, 5120, 6656
+ 16bpp: 320, 512, 640, 832, 1024, 1280, 1664, 2048, 2560, 3328
+ 24bpp: 640, 1024, 1280, 1664, 2048, 2560, 3328, 4096, 5120, 6656
+ 32bpp: 160, 256, 320, 416, 512, 640, 832, 1024, 1280, 1664
+
+For other Cirrus chips, it's advisable to have a virtual width that is a mul-
+tiple of 32 if acceleration is used. The horizontal monitor timings must be
+below 2048.
+
+To run XF86_SVGA at a higher color depth, pass options to the X server as
+follows:
+
+ startx -- -bpp 16 5-6-5 RGB ('64K color', XGA)
+ startx -- -bpp 16 -weight 555 5-5-5 RGB ('Hicolor') (not on 5462)
+ startx -- -bpp 24 8-8-8 RGB truecolor
+ startx -- -bpp 32 8-8-8 XRGB truecolor (543X/46/6X only)
+
+2. Basic configuration
+
+It is recommended that you generate an XF86Config file using the `XF86Setup'
+or `xf86config' program, which should produce a working high-resolution 8bpp
+configuration. You may want to include mode timings in the Monitor section
+that better fit your monitor (e.g 1152x900 modes). The driver options are
+described in detail in the next section; here the basic options are hinted
+at.
+
+For all chipsets, a Clockchip "cirrus" line in the Device section can be use-
+ful. This allows the use of any dot clocks, instead of one out of the fixed
+set of dot clocks supported by the driver. This is required if you want a
+12.6 MHz dot clock for low-resolution modes. However, when this option used,
+clock frequencies be unstable leading to strange effects, so only use it if
+absolutely required.
+
+For any chip with a BitBLT engine, the new XAA (XFree86 Acceleration Archi-
+tecture) is used. This code is new and still in a beta stage. If graphics
+redrawing goes wrong, try the "noaccel" option; if it is using memory-mapped
+I/O, "no_mmio" might be sufficient.
+
+In order to be able to run at a depth of 16bpp, 24bpp, or 32bpp, and to
+improve performance at 8bpp, linear addressing must be enabled. This is gen-
+erally
+
+In order to be able to run at a depth of 16bpp, 24bpp or 32bpp, and to
+improve performance at 8bpp, linear addressing must be enabled. Linear
+addressing is the default mode of operation on any PCI-bus configuration; use
+"nolinear" to disable it. For other bus types, it is generally possible on
+543x local bus cards, and if you have less than 16Mb of system memory, on
+local bus 542x cards and ISA 543x cards. You must specify the "linear" option
+and possibly a Membase address. See the following sections for a detailed
+description.
+
+Memory-mapped I/O is the default mode of operation for any Alpine family
+chip. For the 5429, the "mmio" option may be used to enable it, but it has
+not been tested.
+
+Finally, if you have 546X chip, it will be on either a PCI or AGP bus. As
+such, there is no problem about memory mapped I/O or linear frame buffer
+address spaces running into system memory. The PCI spaces are mapped way up
+near the 4GB point. Because the mmio and linear frame buffer don't conflict
+at all on the system, the "linear", Membase, and "mmio" options are ignored
+(memory mapped I/O and linear addressing are always used).
+
+3. XF86Config options
+
+Don't use the `Clocks' command. The clocks are fixed (i.e. not probed), and
+there should be no variation between cards (other than the maximum supported
+clock for each chipset).
+
+The following options are of particular interest to the Cirrus driver. Each
+of them must be specified in the `svga' driver section of the XF86Config
+file, within the Screen subsections of the depths to which they are applica-
+ble (you can enable options for all depths by specifying them in the Device
+section).
+
+ Option "noaccel"
+ This option will disable the use of any accelerated functions.
+ This is likely to help with problems related to bugs in accelera-
+ tion functions, and perhaps high dot clocks and DRAM timing, at
+ the cost of performance (which will still be reasonable on a
+ local bus).
+
+ Option "fast_dram" "med_dram"
+ "slow_dram" (5424/6/8/9, 543x, 5446, 546x)" These options set the
+ internal memory clock (MCLK, or BCLK for the 546x) register to
+ another value. The default value programmed by the BIOS is usu-
+ ally OK, don't mess with these options unless absolutely
+ required.
+
+ The "fast_dram" option will cause the driver to set the internal
+ memory clock (MCLK) register of the video card to a higher value
+ (recent chips use an even higher value by default). Normally,
+ this register is not touched but it appears that the standard CL-
+ GD542x BIOS initializes it to a value that is somewhat on the low
+ side (limited by the chip specification), which has a negative
+ influence on performance of high dot clock modes. This is espe-
+ cially true if extended RAS timing is being used (this is indi-
+ cated in the server probe). The actual speed of DRAM is not a
+ critical factor in the determining whether this option is
+ appropriate; one CL-GD5426-based card with 80ns DRAM using
+ Extended RAS timing, which came with a DOS driver utility to set
+ the MCLK to this value (0x22), seems to run stable at higher
+ MCLK.
+
+ There are also (mainly brand name) cards whose customized BIOS
+ does initialize to a higher non-standard value.
+
+ The "slow_dram" option will set the MCLK to the value used by the
+ standard CL-GD542x BIOS (0x1c). Symptoms of a MCLK that is too
+ high can be vertical bands of flickering pixels on the screen,
+ erroneous pixels appearing in text, and loosing pixels in the
+ textmode font after running X (note that very similar effects can
+ be caused by an MCLK setting that is too low).
+
+ Upon start-up, the driver will report the value of the MCLK reg-
+ ister (check this first), and also any changes that are made.
+
+ Typical MCLK values:
+
+ 0x1c (50 MHz)
+ This is usually the BIOS default. It is forced by
+ the "slow_dram" option.
+
+ 0x1f (55 MHz)
+ Value used by the "med_dram" option. Highest value
+ that 542x based cards seem to be able to handle with
+ linear addressing enabled.
+
+ 0x22 (60 MHz)
+ Value that most (Extended RAS) 542x cards seem to be
+ able to handle, used by the "fast_dram" option.
+
+ The official maximum of the 542x chips is 50 MHz. The official
+ spec. for the 5434 is also 50 MHz (0x1c) and that for the 5429
+ and 5430 is probably 60 MHz (0x22). Current revisions of the 5434
+ (E and greater) support 60 MHz MCLK in graphics modes, and the
+ driver will program this automatically. If it causes problems,
+ use the "slow_dram" option.
+
+ The driver takes the MCLK into account for clock limits that are
+ determined by DRAM bandwidth.
+
+ For the 546x chips, the BCLK is the Rambus access clock. Typical
+ values live in the range of 258 MHz to 300 MHz. If you have
+ troubles, such as a black checkerboard pattern on the screen, try
+ using the "med_dram" or "slow_dram" options.
+
+ In all cases, if you are not having any problems (performance or
+ stability at high dot clocks), it is best not to use any of the
+ DRAM options.
+
+ Option "no_bitblt"
+ This option, when used with a 5426/28/29/3x/46/6x/754x, will have
+ the effect of disabling the use of the BitBLT engine (which the
+ 5424 does not have), while retaining some acceleration. This will
+ be useful for problems related to functions that use the BitBLT
+ engine. Performance is significantly decreased.
+
+ Option "no_imageblt"
+ This option is now obsolete. The "xaa_no_color_exp" option has a
+ somewhat similar effect.
+
+ chipset "clgd54xx"
+ Force detection of the given chipset. Useful if you have a sup-
+ ported chipset that is not properly detected, or if you have an
+ unsupported chip that might be compatible with a supported one.
+
+ videoram 1024 (or another value)
+ This option will override the detected amount of video memory,
+ and pretend the given amount of memory is present on the card.
+ This is useful on cards with 2Mbyte of memory whose DRAM configu-
+ ration is not compatible with the way the driver enables the
+ upper megabyte of memory, or if the memory detection goes wrong.
+ It must be specified in the Device section.
+
+ Option "fifo_conservative" (5424/6/8/9/3x/46/6x/754x)
+ This option will set the CRT FIFO threshold to a conservative
+ value for high dot clocks (>= 65 MHz), reducing performance but
+ hopefully alleviating problems with what can be described as
+ flashing `streaks', `jitter' or horizontally repeated display
+ areas on the screen (especially when a BitBLT operation is in
+ progress, e.g. scrolling).
+
+ Option "fifo_aggressive" (5424/6/8/9/3x/46/6x/754x)
+ This option will set the CRT FIFO threshold to an aggressive
+ value; it will be the same as that used for lower dot clocks.
+ Theoretically it improves performance at high dot clocks, but it
+ does not help in the vast majority of cases. In some cases with
+ 546x chips, however, this option can help reduce horizontal
+ streaks or otherwise fix abnormal display problems (display
+ shifted to the left, etc.).
+
+ Option "no_2mb_banksel" (542x)
+ This option will cause the driver not to set the `DRAM bank
+ select' bit to enable the upper megabyte of memory on a 2Mbyte
+ card. This should be helpful with cards equipped with 512Kx8
+ DRAMs, as opposed to 256Kx4/16 DRAMs, when using a virtual screen
+ configuration that uses more than 1Mbyte of memory.
+
+ Option "probe_clocks"
+ This option will force probing of dot clocks on the card. This
+ should not be necessary, since the clocks are fixed and the same
+ for all Cirrus chipsets.
+
+ Clockchip "cirrus"
+ This enables programmable clocks. It must be specified in the
+ Device section. With this option, the clocks the modes use will
+ be automatically selected. Do not specify any Clocks line. This
+ option makes a 12.5 MHz clock possible for a 320x200 Doublescan
+ mode. Note that some frequencies may be unstable (resulting in a
+ `wavy' screen). Only tried and tested frequencies (like the
+ default clocks) are guaranteed to be stable.
+
+ Option "linear" (542x/6/8/9/3x/754x on VL-bus)
+ This enables linear addressing, which is the mapping of the
+ entire framebuffer to a high address beyond system memory, so
+ that SVGA bank switching is not necessary. It enhances perfor-
+ mance at 256 colors, and is currently required for 16bpp, 24bpp,
+ and 32bpp. See section 4 for details.
+
+ Option "nolinear" (542x/6/8/9/3x/754x on PCI bus)
+ Linear addressing is the default mode of operation on any PCI-bus
+ chip. For these configurations, this option disables linear
+ addressing.
+
+ Membase 0x00e00000 (or a different address) (542x/6/8/9/3x/46/754x)
+ This sets the physical memory base address of the linear frame-
+ buffer. It must be specified in the Device section. It is
+ required for non-PCI linear addressing configurations.
+
+ Option "favour_bitblt" (5426 only)
+ This option is now obsolete.
+
+ Option "mmio" (5429, 7548)
+ This enables the use of memory-mapped I/O to talk to the BitBLT
+ engine on the 543x/5429, which is a bit faster. This is option
+ has no effect when not using the BitBLT engine (e.g. when using
+ "no_bitblt").
+
+ Option "no_mmio" (543x/4x)
+ This disables the use of memory-mapped I/O to talk to the BitBLT
+ engine on any chip for which it is the default mode of operation.
+
+ Option "sw_cursor" (542x/3x/46/6x)
+ This disables use of the hardware cursor provided by the chip.
+ Try this if the cursor seems to have problems. In particular, use
+ this when using dot clocks greater than 85 MHz on the 5434/6
+ since those chips don't fully support the hardware cursor at
+ those clocks.
+
+ Option "clgd6225_lcd"
+ Provides a work-around for problems on the LCD screen of some
+ 62x5 laptop chipsets with maximum white colors.
+
+ Option "no_pixmap_cache"
+ When XAA is used (on any BitBLT chip), this option disables the
+ use of a pixmap cache in XAA. It could help with certain drawing
+ bugs.
+
+ Option "xaa_no_color_exp"
+ When XAA is used, this option disables the use of hardware color
+ expansion features by XAA. Again, this might help with certain
+ drawing bugs.
+
+ Option "no_stretch" (754x)
+ Disable automatic stretching (horizontal and vertical expansion)
+ of 640x480 on a 800x600 LCD.
+
+ Option "pci_retry" (546x)
+ Enables a performance feature for PCI based cards. When this
+ feature is enabled, the driver code will attempt to transmit data
+ on the PCI bus as fast as possible. For the most part, this
+ option is safe, but may cause trouble with other PCI devices such
+ as PCI network cards, sound cards, SCSI controllers, etc. When
+ this option is not selected, a safer approach (polling the VGA's
+ command queue) is taken.
+
+4. Mode issues
+
+The accelerated 256-color driver uses 16K bytes of scratch space in video
+memory, and the hardware cursor also uses 1K (2K on the '6X). Consequently, a
+1024x1024 virtual resolution should not be used with a 1Mbyte card.
+
+On older chips, the use of a higher dot clock frequencies has a negative
+effect on the performance of graphics operations, especially BitBlt, when
+little video memory bandwidth is left for drawing (the amount is displayed
+during start-up for 542x/3x/46/6x chips). For the 542x/3x chips, with
+default MCLK setting (0x1c) and a 32-bit memory interface, performance with a
+65 MHz dot clock can be half of that with a dot clock of 25 MHz. So if you
+are short on memory bandwidth and experience blitting slowness, try using the
+lowest dot clock that is acceptable; for example, on a 14" or 15" screen
+800x600 with high refresh (50 MHz dot clock) is not so bad, with a large vir-
+tual screen.
+
+5434-based cards with 2Mbyte of memory do much better at high dot clocks; the
+DRAM bandwidth is basically double that of the 542x series. The 543x chips
+also make more efficient use of the available DRAM bandwidth. The same goes
+for the 544x.
+
+5. Linear addressing and 16bpp/24bpp/32bpp modes
+
+Currently the framebuffer code 16-bit, 24-bit, and 32-bit pixels in the SVGA
+server requires linear addressing. Option "linear" can be specified in a
+depth-specific screen section to enable linear addressing; a MemBase setting
+(in the device section) is probably also required (although they are both
+automatically selected with PCI cards, like 5446, 546x, and some 543x based
+cards). There are a number of different card configurations.
+
+If you have a 542x/543x on the ISA bus, and you have 16Mb or more of system
+memory, linear addressing is impossible. 16bpp is out, sorry. If you have
+less than 14Mb of memory, you may be able to map the framebuffer at 14Mb,
+using `MemBase 0x00e00000'. That's five zeros after the `e'. Unfortunately
+many ISA cards don't support linear addressing.
+
+If you have a 5424/26/28/29 on VESA local bus, the situation is more compli-
+cated. There are two different types of cards w.r.t. linear addressing:
+
+ o Cards that can only map in the lower 16Mb, like cards on the ISA bus.
+ This is the case with most cards. The same restrictions apply (i.e. you
+ must have less than 16Mb of memory).
+
+ o Cards that connect address line A26 and always map at 64Mb + 14Mb or
+ 64Mb. In this case specify `MemBase 0x04e00000' or `MemBase 0x04000000'.
+ This assumes you have a VLB motherboard implementation that implements
+ A26. Alternatively the card may map to 0x2000000, and recent cards like
+ the 5429 usually map to 0x03e00000 (62Mb).
+
+You will probably have to rely on trial and error. If you have less than 16Mb
+memory, the `wrong' membase setting will result in no graphics being dis-
+played, but you can probably exit with ctrl-alt-backspace.
+
+If you have >= 16Mb memory, the first type of card (and even the second type
+with a stupid VLB motherboard) will result in a crash (probably a spontaneous
+hard reboot).
+
+It may be possible to find out the type by visual inspection. If the card has
+a pin at A26, it is likely to map beyond 64Mb. To do this, take the card out.
+At the VESA local bus pins (this is the smaller strip of connector pins at
+the non-slot side of the card), consider the right side (this is the side of
+the board where all the chips are mounted). There are 45 pins here. They are
+numbered 1 to 45, from the inside (i.e. the one nearest to the card end is
+45). Counting from the inside, the 17th pin is probably not present, then
+there are pins at 18-20. The 21st is A30, the 22nd is A28 and the 23rd is
+A26. So, if we have no pins at at 21-23, the card doesn't map beyond 64Mb. If
+there's only a gap of two pins at 21 and 22 (or they are both present) and
+there's a pin at 23, the card does probably map beyond 64Mb. If there's a
+little logic near that pin on the card, it's more likely.
+
+With a 543x on the local bus things are simpler (the Cirrus Logic windows
+drivers use it), but it is not quite without problems.
+
+With a card on the PCI bus, there is a PCI configuration register that holds
+the framebuffer base address, which is read automatically by the driver if a
+PCI card is detected. The `scanpci' program can read out the PCI configura-
+tion and show the base address.
+
+On the VESA local bus, most 543x cards have a default mapping address of
+64Mb, with jumper options for 2048Mb and 32Mb. This is probably described in
+the documentation that came with the card, or look in the MS-Windows sys-
+tem.ini file (something with linearaddr = <offset in megabytes>). These dif-
+ferent settings were added by Cirrus Logic after finding that many VLB moth-
+erboard implementations don't implement different address pins. The driver
+assumes a default of 64Mb if MemBase isn't specified. A few examples for Mem-
+Base:
+
+ MemBase 0x02000000 32Mb
+ MemBase 0x04000000 64Mb
+ MemBase 0x80000000 2048Mb
+
+Finally, for 546X cards, you are in luck: there are no "issues" to worry
+about. The '6X will always use linear addressing and memory-mapped I/O, and
+will use the memory addresses up near 4GB. Yay for PCI!
+
+The 16bpp and 32bpp modes are now fully accelerated, thanks to XAA. On more
+recent chips like the 5436/46 and the 546X, 24bpp is also fully accelerated.
+So although there are now up to 4 times as many bits to display, the X server
+shouldn't feel overly sluggish. Note also that the 24bpp and 32bpp modes are
+only supported on a limited set of cards, and with at least 2Mb of memory.
+
+In the XF86Config "Screen" section, a "Display" subsection must be defined
+for each depth that you want to run, with separate Modes and virtual screen
+size. Example (2Mb of video memory):
+
+ Section "screen"
+ SubSection "Display"
+ Depth 8
+ Virtual 1280 1024
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ Option "linear"
+ EndSubSection
+ SubSection "Display"
+ Depth 16
+ Virtual 1024 992
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ Option "linear"
+ EndSubSection
+ SubSection "Display"
+ Depth 32
+ Virtual 832 600
+ ViewPort 0 0
+ Modes "640x480" "800x600"
+ Option "linear"
+ EndSubSection
+ EndSection
+
+6. The ``cl64xx'' Driver
+
+The cl64xx driver supports the cl-gd6440 found in many laptops. For example,
+Nan Tan Computer's NP9200, NP3600, etc., which are OEM-ed by Sager, ProStar,
+etc. and Texas Instruments TI4000 series are supported.
+
+The driver works in LCD-only, CRT-only, and the chip's SimulScan mode which
+allows one to use both the LCD and external CRT displays simultaneously. The
+LCD and Simulscan modes' resolution is 640x480 while, for CRT-only, the stan-
+dard VESA modes of 640x480, 600x800, and 1024x768 have been tested. Inter-
+laced 1024x768 mode has never been debugged and does not work on the machines
+tested.
+
+The chip has a documented maximum operating limit for its dot clock that is
+related to its core voltage. Specifically, for 5.0V the maximum dot clock is
+65MHz and for 3.3V the maximum dot clock is 40MHz. The driver checks the
+core voltage and limits the maximum dot clock to the corresponding value.
+This translates to a maximum resolution of about 1024x768 at a 60Hz refresh
+rate. The internal frequency generator can be programmed higher than these
+limits and is done so during server startup when the clocks are probed which
+momentarily exceeding the chip's operating limit. Once a set of valid clocks
+is obtained, I would recommend using Clocks lines in XF86Config. Doing so
+will also decrease startup time significantly. The clocks may be obtained by
+running the X server -probeonly (see the XFree86 man page for more informa-
+tion about -probeonly).
+
+The data book indicates that only a configuration of one megabyte of video
+memory is supported by the chip. This size has been directly set in the
+driver. If one finds a need, one should be able to override the default size
+in XF86Config. Also, with 1MB of video memory, one should be able to have a
+virtual screen size of e.g. 1024x1024 and this is possible in CRT-only screen
+mode. However, whenever the LCD is in use (LCD and SimulScan), the chip uses
+a portion of upper video ram for its own internal acceleration purposes.
+Thus, the maximum video memory available for virtual resolution in LCD modes
+is about 0.75MB e.g. 1024x768. If you set the virtual resolution above
+this, you will see what might be described as a compressed aliased band when
+the accelerated area is displayed.
+
+Currently, the driver does not support switching of screen modes among LCD,
+CRT, and SimulScan, and, at least on the NP9200, the mode must be chosen at
+OS boot time (e.g. Linux's LILO) while the BIOS is still active. It should
+be possible to add screen mode type selection as a ModeLine flag option in
+XF86Config to allow for dynamic screen mode selection from within the X
+server. Finally, the driver does not currently support any of the powerdown
+saving features of the chip nor does it shut off the LCD's backlight on
+screen blank. I hope to implement all these features in future releases.
+
+Some notes regarding the CL-GD6420:
+
+The amount of video memory may not always be detected correctly. The driver
+source code includes two methods, one defined out. Better specify the amount
+of video memory with a VideoRam line in the Device section. Use the standard
+640x480 60 Hz standard mode timing with 25.175 MHz dot clock for CRT or
+SIMulscan mode; for LCD-only operation, use the same mode timing but with a
+dot clock of 16.257 MHz. Standard 56 Hz 800x600 is also supported on the CRT.
+
+The primary contact for the cl6440 problems with ``cl64xx'' driver is Randy
+Hendry <randy@sgi.com>.
+
+7. Trouble shooting with the ``cirrus'' driver
+
+First of all, make sure that the default modes selected from your XF86Config
+is supported by your monitor, i.e. make sure the horizontal sync limit is
+correct. It is best to start with standard 640x480x256 with a 25.175 MHz
+clock (by specifying a single horizontal sync of 31.5) to make sure the
+driver works on your configuration. The default mode used will always be the
+first mode listed in the modes line, with the highest dot clock listed for
+that resolution in the timing section.
+
+Note that some VESA standard mode timings may give problems on some monitors
+(try increasing the horizontal sync pulse, i.e. the difference between the
+middle two horizontal timing values, or try multiples of 16 or 32 for all of
+the horizontal timing parameters).
+
+ There is a video signal, but the screen doesn't sync.
+ You are using a mode that your monitor cannot handle. If it is a
+ non-standard mode, maybe you need to tweak the timings a bit. If
+ it is a standard mode and frequency that your monitor should be
+ able to handle, try to find different timings for a similar mode
+ and frequency combination.
+
+ Horizontal jitter at high dot clocks.
+ This problem shows especially when drawing operations such as
+ scrolling are in progress. If you're using a 542x/3x/46/6x/754x,
+ try the "fifo_conservative" option. Failing that, you can try the
+ "fast_dram" option, or use a lower dot clock. If that is not
+ sufficient, the "noaccel" option or "no_bitblt" will probably
+ help. When using a 546x, option "fifo_aggressive" can also be
+ tried.
+
+ `Wavy' screen.
+ Horizontal waving or jittering of the whole screen, continuously
+ (independent from drawing operations). You are probably using a
+ dot clock that is too high; it is also possible that there is
+ interference with a close MCLK. Try a lower dot clock. You can
+ also try to tweak the mode timings; try increasing the second
+ horizontal value somewhat. Here's a 65 MHz dot clock 1024x768
+ mode (about 60 Hz) that might help:
+
+ "1024x768" 65 1024 1116 1228 1328 768 783 789 818
+
+ If you are using programmable clocks with Clockchip "cirrus", try
+ disabling it and using the default set of clocks.
+
+ Crash or hang after start-up (probably with a black screen).
+ Try the "noaccel" option. If that works, try Option "no_bitblt"
+ for somewhat better performance. Check that the BIOS settings are
+ OK; in particular, disable caching of 0xa0000-0xaffff. Disabling
+ hidden DRAM refresh may also help.
+
+ Crash, hang, or trash on the screen after a graphics operation.
+ This may be related to a bug in one of the accelerated functions,
+ or a problem with the BitBLT engine. Try the "noaccel" option, or
+ the "no_bitblt" option. Also check the BIOS settings.
+
+ `Blitter timeout' messages from the server.
+ Same as for the above entry.
+
+ Screen is `wrapped' vertically. (542x/3x/46)
+ This indicates a DRAM configuration problem. If your card has two
+ megabytes of memory, try the "no_2mb_banksel" option, or use
+ videoram "1024" if you only use 1 Mbyte for the virtual screen.
+
+ Corrupted text in terminal window.
+ This has been reported on non-standard video implementations.
+ Use the "no_bitblt" option.
+
+ Streaks or hangs with laptop chipset
+ This can happen if the dot clock is high enough to leave very
+ little bandwidth for drawing (e.g. 40 MHz on a 512K card), and
+ (5422-style) acceleration is used.
+
+ Occasional erroneous pixels in text, pixel dust when moving window-frame
+ Probably related to MCLK setting that is too high (can happen
+ with linear addressing even though banked mode runs OK).
+
+ Chipset is not detected.
+ Try forcing the chipset to a type that is most similar to what
+ you have.
+
+ Incorrect little lines (mostly white) appear occasionally
+ This may be related to a problem with system-to-video-memory Bit-
+ BLT operations. Try the "no_imageblt" option if it annoys you.
+
+ Textmode is not properly restored
+ This has been reported on some configurations. In XFree86 3.1 the
+ SVGA server probe would corrupt a register on the 543x, requiring
+ a Chipset line. Normally you should be able to restore the
+ textmode font using a utility that sets it (setfont, runx,
+ restorefont on Linux).
+
+ Erratic system behaviour at very high dot clocks
+ It is possible that high dot clocks on the video card interfere
+ with other components in the system (e.g. disk I/O), because of a
+ bad card and/or motherboard design. It has been observed on some
+ PCI 5428-based cards (which are very rare, since the 5428 chip
+ doesn't support PCI).
+
+ No mouse cursor, or cursor appears twice on screen
+ With high dot clocks, the graphics card's hardware cursor doesn't
+ operate correctly. Try option "sw_cursor" or use a lower screen
+ refresh.
+
+ Random/garbage pixels on far right or bottom of screen (546x)
+ This problem is usually associated with using a virtual screen
+ size larger than the screen display size. The garbage pixels are
+ unused portions of the frame buffer that result from padding each
+ scanline to an integral number of memory tiles. To eliminate the
+ extra pixels, use a screen display mode whose pixel width is
+ evenly divisible by 128 / bits per pixel.
+
+ Screen is wrapped horizontally on right side (546x)
+ Same as above entry.
+
+ The screen is initially displayed correctly, but then turns all
+ white. (546x)" This problem usually happens at high bit depths
+ and while the screen is changing rapidly (catting a long file or
+ dragging a large window around). The RamBus memory is being
+ overdriven. Use Option "med_dram", or, if the problem persists,
+ Option "slow_dram".
+
+For other screen drawing related problems, try the "noaccel" option (if
+"no_bitblt" doesn't help).
+
+If are having driver-related problems that are not addressed by this docu-
+ment, or if you have found bugs in accelerated functions, you can try con-
+tacting the XFree86 team (the current driver maintainer, Corin Anderson, can
+be reached at corina@the4cs.com), or post in the Usenet newsgroup "comp.win-
+dows.x.i386unix".
+
+In fact, reports (success or failure) are very welcome, especially on config-
+urations that have not been tested. You can do this via the BetaReport form
+(mail to report@XFree86.org). You may want to keep an eye on forthcoming beta
+releases at www.xfree86.org.
+
+8. Tested Configurations
+
+Version 3.3.3 has had the following configurations tested:
+
+ CL-GD5446 with 2MB memory on PCI bus
+
+ CL-GD5464 with 2MB memory on PCI bus
+
+ CL-GD5465 with 4MB memory on PCI bus
+
+ CL-GD5480 with 4MB memory on PCI bus
+
+ CL-GD5465 with 4MB memory on AGP bus
+
+For version 3.3, the following configurations have received a certain amount
+of testing:
+
+ CL-GD5446 with 2MB memory on PCI bus
+ Support for dot clocks > 85 MHz has been fixed. At 16bpp, it has
+ been reported that some stippled edges of window frames may be
+ corrupted or show the wrong colors. The option
+ "xaa_no_pixmap_cache" eliminates the problem.
+
+ CL-GD5464 with 4MB memory on PCI bus
+
+ CL-GD7543 on PCI bus
+
+This is a list of configurations that has received testing with one or more
+of the changes introduced in version XFree86 3.2A. The amount of testing is
+very small for some of the configurations, and the summaries may be incom-
+plete. If you can contribute, please do so. For the latest information check
+the latest version of this document on www.xfree86.org.
+
+ CL-GD5426 on VL-bus
+ This configuration was only tested with an early version of the
+ XAA code.
+
+ CL-GD5434 with 2MB memory on VL-bus
+ MMIO operation is supported. This configuration was only tested
+ with an early version of the XAA code.
+
+ CL-GD5436 with 2MB memory on PCI-bus
+ Works OK. Non-MMIO operation might have problems.
+
+ CL-GD5446 with 2MB memory on PCI bus
+ Works OK in MMIO mode. 32bpp probably doesn't work. The support
+ for dot clocks > 85 MHz at 8bpp may or may not work.
+
+ CL-GD5462 with 2MB memory on PCI bus
+
+ CL-GD5462 with 4MB memory on PCI bus
+
+ CL-GD5464 with 4MB memory on PCI bus
+ Works OK at 8bpp, 16bpp, 24bpp and 32bpp. CL-GD5464 works OK at
+ 16bpp, -weight 555.
+
+ CL-GD7543 on PCI bus
+ Works for 8bpp, 16bpp on TFT display (TI TravelMate 5000).
+ Although the previous version, 3.2, was reported to broken, on
+ some configurations it worked, while others were reported not to
+ work correctly. On 800x600 displays, the recommended dot clock is
+ 40 MHz for TFT and 33.7 MHz for a DSTN panel, with corresponding
+ horizontal syncs of 33.7 kHz for TFT and 38.6 kHz for DSTN. How-
+ ever, reports indicate that the VESA standard 40 MHz 800x600 tim-
+ ing may cause problems. The solution is decrease the fourth hori-
+ zontal timing number or use a dot clock of 36 MHz.
+
+Some configurations for which no up-to-date testing data is available:
+
+ CL-GD5429 on VL-bus
+ BitBLT operation should be fixed in 3.2. MMIO does not work, but
+ not tested with with 3.2 or 3.2A.
+
+ CL-GD5430 on PCI-bus
+ Works OK. 24bpp was broken, but should be fixed in later versions
+ (3.2A).
+
+ CL-GD5430, and CL-GD5436 and CL-GD5446 with 1MB memory
+ It would be nice to know whether these chips needs the same
+ treatment at 16bpp as the CL-GD5434 with 1MB memory does.
+
+ CL-GD5434 with 1MB memory on PCI bus
+ 8bpp, 16pp and 24bpp work OK. 16bpp no longer has "static" prob-
+ lems. MMIO operation is supported.
+
+ CL-GD5436 and CL-GD5446 with 1MB memory
+ In particular the FIFO settings for this configuration are uncer-
+ tain.
+
+ CL-GD7541
+
+ CL-GD7548
+ Should be compatible with 7543, but untested. Reports indicate
+ that it worked with 3.2, and there's no reason why it shouldn't
+ work with 3.2A.
+
+9. Driver Changes
+
+Changes since XFree86 3.3.2:
+
+ o Fix transparent screen-to-screen copies on 546x.
+
+ o The built-in screen saver now correctly blanks the screen on 546x chips.
+
+ o Driver prevents the use of the HW cursor on the 546x when the screen
+ height is greater than 1023 scanlines (fix to double pointer problem).
+
+ o CPU-to-screen BitBLT transfers disabled on the 5465. This fix should
+ prevent 5465 AGP lockups.
+
+ o Fixed mode display problem with 5480 at high resolutions.
+
+Changes since XFree86 3.2A:
+
+ o A bug that caused a server crash with memory-mapped I/O operation on
+ some chips has been fixed.
+
+ o Correct handling of dot clocks > 85 MHz on the 5436 and 5446.
+
+ o Preliminary support for the CL-GD7555 (no detection yet).
+
+ o Support has been added for the CL-GD5480 and CL-GD5465.
+
+ o 32bpp mode has been fixed on some Alpine family chips.
+
+ o Support for dot clocks up to 230 MHz has been added for Laguna family
+ chips.
+
+Changes since XFree86 3.2:
+
+ o Enhanced acceleration using XAA on all chips with a BitBLT engine.
+
+ o Enhanced acceleration using XAA for the Laguna series (546x).
+
+ o 24bpp mode on 5430 is fixed.
+
+ o Improved support for 754x, including support for LCD stretching/center-
+ ing.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/cirrus.sgml,v 3.25 1999/08/23 06:38:53 dawes Exp $
+
+ $XConsortium: cirrus.sgml /main/12 1996/10/28 05:43:32 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cirrus,v 3.39 1999/08/23 07:03:51 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.cyrix b/xc/programs/Xserver/hw/xfree86/doc/README.cyrix
new file mode 100644
index 000000000..4102121ea
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.cyrix
@@ -0,0 +1,80 @@
+ Information for Cyrix Chipset Users
+
+ The XFree86 Project Inc.
+
+ 22 June 1999
+
+1. Supported hardware
+
+This driver (as used in the SVGA (VGA256), VGA16 and VGA_Mono servers) sup-
+ports a single chipset `mediagx' that should work on the following Cyrix CPUs
+with integrated graphics:
+
+ o MediaGX
+
+ o MediaGXi
+
+ o MediaGXm
+
+2. Features
+
+ o accelerated
+
+ o hardware cursor
+
+ o support color depths 1, 4, 8 and 16
+
+3. XF86Config Option
+
+ Option "sw_cursor"
+ disable the hardware cursor.
+
+ Option "no_accel"
+ completely disables acceleration. Usually not recommended.
+
+4. Bugs and Limitations
+
+ o On some older chipsets, the driver may trigger an illegal instruction
+ just after probing for the ``scratchpad size''. If this is the case,
+ email to hecker@cat.dfrc.nasa.gov with the output of
+
+ XF86_SVGA -probeonly -verbose
+
+ and this will be fixed.
+
+ o There are limitations to the modeline values that can be specified.
+ Particularly, the difference between the first two horizontal timings
+ (e.g. 640 656, 1024 1048) must be at least 16 and at most 24. The mode-
+ line values are not used in the 3.3.4 server since there is a static
+ array used to load the registers. The modeline only identifies that a
+ particular resolution is desired. The standard VESA modes up to
+ 1280x768 are supported. For more specific information, consult the
+ source code.
+
+ o The 4 colour server is slow due to the VGA banking mode used. Moreover,
+ it does not work the way it is run by XF86Setup, which is probably due
+ to the timing limitations.
+
+ o The 3.3.4 server MAY totally hang the machine at times. It is reported
+ to be stable on a BSD platform using twm. It has crashed when using
+ resolutions greater than 800x600 on a Linux (Debian based) system using
+ wm as the window manager. The safest course is to use the 3.3.3.1
+ server instead. Efforts are under way to resolve this issue and provide
+ a more robust server under the 4.x release.
+
+5. Authors
+
+ o Annius Groenink <Annius.Groenink@cwi.nl>
+
+ o Dirk Hohndel <hohndel@XFree86.org>
+
+ o Brian Falardeau
+
+ o Special thanks to Cyrix and Wyse for helping us with the development of
+ this server. Brian, a Cyrix employee, made the 3.3.4 update possible
+ since the new 4.0 server has been our top priority.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/cyrix.sgml,v 1.2 1999/08/23 06:18:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.3 1999/08/23 07:03:52 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.epson b/xc/programs/Xserver/hw/xfree86/doc/README.epson
new file mode 100644
index 000000000..1def6fc76
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.epson
@@ -0,0 +1,134 @@
+ Information for EPSON SPC8110 Users
+
+ Thomas Mueller (tmueller@sysgo.de)
+
+ October 15, 1998
+
+1. General Notes
+
+This server provides support for the Seiko/EPSON SPC8110F0A LCD VGA con-
+troller chip.
+
+The driver was developed and tested using an EPSON 486D4 CardPC using CRT
+display mode. LCD operation was successfully tested using an earlier release
+of this driver.
+
+The current driver has support for linear mapping of the frame buffer, sup-
+ports the hardware cursor and uses the Bitblt engine for basic operations
+such as CopyArea and solid fills.
+
+2. XF86Config options
+
+The driver should be able to probe the presence of a SPC8110 chip. If the
+driver fails to probe the chip correctly define the chip explicitly in the
+screen section.
+
+Device Section Entries and Options Currently Supported:
+
+ Chipset "spc8110"
+ May be specified if probing fails or to accelerate server
+ startup. The value must be "spc8110".
+
+ VideoRam kilobytes
+ If specified the value (in kilobytes) will be used, otherwise the
+ amount of memory will be probed on startup.
+
+ Option "sw_cursor"
+ Disables the use of the hardware cursor. The hardware cursor
+ requires one Kbyte of video memory as pattern storage area. If
+ you need the full amount of video memory you may want to disable
+ the hardware cursor using this option. Also the hardware cursor
+ code was not tested with cursor images larger than 64 pixels
+ (high or wide), so if you use large images you may have to dis-
+ able the hardware cursor.
+
+ Option "no_linear"
+ Disables the use of the linear aperture. If this option is set
+ the driver will use the standard VGA memory window at 0xa0000
+ otherwise it will map the whole video memory.
+
+ Membase baseaddress
+ In VLB/486LB configuration the linear aperture address will be
+ set to 0x03E0.0000, in PCI configuration the address will be read
+ from the PCI configuration space. The base address in VLB/486LB
+ systems may be set to any value using the "Membase" definition.
+
+ Option "noaccel"
+ Disables the use of the Bitblt engine. Normally the driver accel-
+ erates screen-to-screen copy operations and solid fills.
+
+ Since the SPC8110 puts certain restrictions on the use of the
+ Bitblt engine you will notice different performance between cer-
+ tain operations (eg window movement). If this is a problem for
+ your application you may want to disable the accelerator.
+
+ Option "fifo_moderate"
+
+ Option "fifo_conservative"
+ Usually the driver computes the FIFO threshold values for the
+ SPC8110's write buffer correctly. However for certain modes (eg
+ the 832x624 mode shown below) the FIFO is programmed too aggres-
+ sively which leads to streaks in the display during screen
+ updates. With option "fifo_moderate" the computed FIFO low
+ request level is incremented by one with "fifo_conservative" it
+ is incremented by two.
+
+3. Video modes
+
+The driver probes whether the chip is configured for CRT only or LCD/simulta-
+neous mode of operation. In the former case it will enable clock programming
+and will support any mode which is within the limits of the hardware. If the
+chip is configured for LCD/simultaneous operation mode the driver will
+respect the settings of the BIOS and allow only one video mode conforming
+with the panel size.
+
+The driver does not support interlaced or double scan modes.
+
+3.1 Clocks
+
+Probing is supported, but of course the usual warnings and disclaimers apply.
+Probing may momentarily subject your monitor/panel to sweep frequencies in
+excess of its rating. The cautious may wish to turn off the monitor while
+the probe is running. In CRT mode the driver may produce video timings inade-
+quate for your monitor, handle with care!
+
+As with many integrated designs the speed of the graphics operations depend
+very much of the refresh rate you use. Higher refresh rates yield lower per-
+formance.
+
+3.2 Example Modes
+
+The following XF86Config "Device" section should work for all configurations:
+
+ Section "Device"
+ Identifier "CardPC"
+ VendorName "EPSON"
+ BoardName "CardPC"
+ Chipset "spc8110"
+ Option "sw_cursor"
+ Membase 0x03e00000
+ Option "no_linear"
+ Option "noaccel"
+ Option "fifo_moderate"
+ EndSection
+
+This Modeline was tested in a 640x480 panel configuration:
+
+ Modeline "640x480" 28.36 640 672 768 800 480 490 492 525
+
+These Modelines were tested in a CRT configuration:
+
+ Modeline "640x480" 25.175 640 664 760 800 480 491 493 525
+ Modeline "800x600" 36 800 824 896 1024 600 601 603 625
+ ModeLine "832x624" 40 832 873 1001 1090 624 625 627 651
+ Modeline "640x400" 25.175 640 664 760 800 400 409 411 450
+
+4. Acknowledgments
+
+Thanks to Epson Europe Electronics and ProBIT GmbH, Berlin for providing a
+loaner system and documentation to get things started.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/epson.sgml,v 1.3 1999/08/28 10:43:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.epson,v 1.4 1999/08/28 11:22:56 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fbdev b/xc/programs/Xserver/hw/xfree86/doc/README.fbdev
new file mode 100644
index 000000000..ddb2311b9
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.fbdev
@@ -0,0 +1,341 @@
+ The Linux/m68k Frame Buffer Device
+
+ Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
+
+ 7 November 1998
+
+1. Introduction
+
+The frame buffer device provides an abstraction for the graphics hardware. It
+represents the frame buffer of some video hardware and allows application
+software to access the graphics hardware through a well-defined interface, so
+the software doesn't need to know anything about the low-level (hardware reg-
+ister) stuff.
+
+The device is accessed through special device nodes, usually located in the
+/dev directory, i.e. /dev/fb*.
+
+2. User's View of /dev/fb*
+
+From the user's point of view, the frame buffer device looks just like any
+other device in /dev. It's a character device using major 29, the minor spec-
+ifies the frame buffer number.
+
+By convention, the following device nodes are used (numbers indicate the
+device minor numbers):
+
+ 0 = /dev/fb0
+ First frame buffer
+
+ 32 = /dev/fb1
+ Second frame buffer
+
+ ...
+
+ 224 = /dev/fb7
+ 8th frame buffer
+
+For backwards compatibility, you may want to create a symbolic link from
+/dev/fb0current to fb0.
+
+The frame buffer devices are also `normal' memory devices, this means, you
+can read and write their contents. You can, for example, make a screen snap-
+shot by
+
+ cp /dev/fb0 myfile
+
+There also can be more than one frame buffer at a time, e.g. if you have a
+graphics card in addition to the built-in hardware. The corresponding frame
+buffer devices (/dev/fb0 and /dev/fb1 etc.) work independently.
+
+Application software that uses the frame buffer device (e.g. the X server)
+will use /dev/fb0 by default (older software uses /dev/fb0current). You can
+specify an alternative frame buffer device by setting the environment vari-
+able $FRAMEBUFFER to the path name of a frame buffer device, e.g. (for
+sh/bash users):
+
+ export FRAMEBUFFER=/dev/fb1
+
+or (for csh users):
+
+ setenv FRAMEBUFFER /dev/fb1
+
+After this the X server will use the second frame buffer.
+
+3. Programmer's View of /dev/fb*
+
+As you already know, a frame buffer device is a memory device like /dev/mem
+and it has the same features. You can read it, write it, seek to some loca-
+tion in it and mmap() it (the main usage). The difference is just that the
+memory that appears in the special file is not the whole memory, but the
+frame buffer of some video hardware.
+
+/dev/fb* also allows several ioctls on it, by which lots of information about
+the hardware can be queried and set. The color map handling works via ioctls,
+too. Look into <linux/fb.h> for more information on what ioctls exist and on
+which data structures they work. Here's just a brief overview:
+
+ o You can request unchangeable information about the hardware, like name,
+ organization of the screen memory (planes, packed pixels, ...) and
+ address and length of the screen memory.
+
+ o You can request and change variable information about the hardware, like
+ visible and virtual geometry, depth, color map format, timing, and so
+ on. If you try to change that informations, the driver maybe will round
+ up some values to meet the hardware's capabilities (or return EINVAL if
+ that isn't possible).
+
+ o You can get and set parts of the color map. Communication is done with
+ 16 bit per color part (red, green, blue, transparency) to support all
+ existing hardware. The driver does all the computations needed to bring
+ it into the hardware (round it down to less bits, maybe throw away
+ transparency).
+
+All this hardware abstraction makes the implementation of application pro-
+grams easier and more portable. E.g. the X server works completely on
+/dev/fb* and thus doesn't need to know, for example, how the color registers
+of the concrete hardware are organized. XF68_FBDev is a general X server for
+bitmapped, unaccelerated video hardware. The only thing that has to be built
+into application programs is the screen organization (bitplanes or chunky
+pixels etc.), because it works on the frame buffer image data directly.
+
+For the future it is planned that frame buffer drivers for graphics cards and
+the like can be implemented as kernel modules that are loaded at runtime.
+Such a driver just has to call register_framebuffer() and supply some func-
+tions. Writing and distributing such drivers independently from the kernel
+will save much trouble...
+
+4. Frame Buffer Resolution Maintenance
+
+Frame buffer resolutions are maintained using the utility fbset. It can
+change the video mode properties of a frame buffer device. Its main usage is
+to change the current video mode, e.g. during boot up in one of your
+/etc/rc.* or /etc/init.d/* files.
+
+Fbset uses a video mode database stored in a configuration file, so you can
+easily add your own modes and refer to them with a simple identifier.
+
+5. The X Server
+
+The X server (XF68_FBDev) is the most notable application program for the
+frame buffer device. Starting with XFree86 release 3.2, the X server is part
+of XFree86 and has 2 modes:
+
+ o If the Display subsection for the fbdev driver in the /etc/XF86Config
+ file contains a
+
+ Modes "default"
+
+ line, the X server will use the scheme discussed above, i.e. it will
+ start up in the resolution determined by /dev/fb0 (or $FRAMEBUFFER, if
+ set). You still have to specify the color depth (using the Depth key-
+ word) and virtual resolution (using the Virtual keyword) though. This is
+ the default for the configuration file supplied with XFree86. It's the
+ most simple configuration, but it has some limitations.
+
+ o Therefore it's also possible to specify resolutions in the /etc/XF86Con-
+ fig file. This allows for on-the-fly resolution switching while retain-
+ ing the same virtual desktop size. The frame buffer device that's used
+ is still /dev/fb0 (or $FRAMEBUFFER), but the available resolutions are
+ defined by /etc/XF86Config now. The disadvantage is that you have to
+ specify the timings in a different format (but fbset -x may help).
+
+To tune a video mode, you can use fbset or xvidtune. Note that xvidtune
+doesn't work 100% with XF68_FBDev: the reported clock values are always
+incorrect.
+
+6. Video Mode Timings
+
+A monitor draws an image on the screen by using an electron beam (3 electron
+beams for color models, 1 electron beam for monochrome monitors). The front
+of the screen is covered by a pattern of colored phosphors (pixels). If a
+phosphor is hit by an electron, it emits a photon and thus becomes visible.
+
+The electron beam draws horizontal lines (scanlines) from left to right, and
+from the top to the bottom of the screen. By modifying the intensity of the
+electron beam, pixels with various colors and intensities can be shown.
+
+After each scanline the electron beam has to move back to the left side of
+the screen and to the next line: this is called the horizontal retrace. After
+the whole screen (frame) was painted, the beam moves back to the upper left
+corner: this is called the vertical retrace. During both the horizontal and
+vertical retrace, the electron beam is turned off (blanked).
+
+The speed at which the electron beam paints the pixels is determined by the
+dotclock in the graphics board. For a dotclock of e.g. 28.37516 MHz (millions
+of cycles per second), each pixel is 35242 ps (picoseconds) long:
+
+1/(28.37516E6 Hz) = 35.242E-9 s
+
+If the screen resolution is 640x480, it will take
+
+ 640*35.242E-9 s = 22.555E-6 s
+
+to paint the 640 (xres) pixels on one scanline. But the horizontal retrace
+also takes time (e.g. 272 `pixels'), so a full scanline takes
+
+ (640+272)*35.242E-9 s = 32.141E-6 s
+
+We'll say that the horizontal scanrate is about 31 kHz:
+
+ 1/(32.141E-6 s) = 31.113E3 Hz
+
+A full screen counts 480 (yres) lines, but we have to consider the vertical
+retrace too (e.g. 49 `pixels'). So a full screen will take
+
+ (480+49)*32.141E-6 s = 17.002E-3 s
+
+The vertical scanrate is about 59 Hz:
+
+ 1/(17.002E-3 s) = 58.815 Hz
+
+This means the screen data is refreshed about 59 times per second. To have a
+stable picture without visible flicker, VESA recommends a vertical scanrate
+of at least 72 Hz. But the perceived flicker is very human dependent: some
+people can use 50 Hz without any trouble, while I'll notice if it's less than
+80 Hz.
+
+Since the monitor doesn't know when a new scanline starts, the graphics board
+will supply a synchronization pulse (horizontal sync or hsync) for each scan-
+line. Similarly it supplies a synchronization pulse (vertical sync or vsync)
+for each new frame. The position of the image on the screen is influenced by
+the moments at which the synchronization pulses occur.
+
+The following picture summarizes all timings. The horizontal retrace time is
+the sum of the left margin, the right margin and the hsync length, while the
+vertical retrace time is the sum of the upper margin, the lower margin and
+the vsync length.
+
+ +----------+---------------------------------------------+----------+-------+
+ | | x | | |
+ | | |upper_margin | | |
+ | | x | | |
+ +----------###############################################----------+-------+
+ | # x # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | left # | # right | hsync |
+ | margin # | xres # margin | len |
+ |<-------->#<---------------+--------------------------->#<-------->|<----->|
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # |yres # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # | # | |
+ | # x # | |
+ +----------###############################################----------+-------+
+ | | x | | |
+ | | |lower_margin | | |
+ | | x | | |
+ +----------+---------------------------------------------+----------+-------+
+ | | x | | |
+ | | |vsync_len | | |
+ | | x | | |
+ +----------+---------------------------------------------+----------+-------+
+
+The frame buffer device expects all horizontal timings in number of dotclocks
+(in picoseconds, 1E-12 s), and vertical timings in number of scanlines.
+
+7. Converting XFree86 timing values into frame buffer device timings
+
+An XFree86 mode line consists of the following fields:
+
+ "800x600" 50 800 856 976 1040 600 637 643 666
+ < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
+
+The frame buffer device uses the following fields:
+
+ pixclock
+ pixel clock in ps (pico seconds)
+
+ left_margin
+ time from sync to picture
+
+ right_margin
+ time from picture to sync
+
+ upper_margin
+ time from sync to picture
+
+ lower_margin
+ time from picture to sync
+
+ hsync_len
+ length of horizontal sync
+
+ vsync_len
+ length of vertical sync
+
+ Pixelclock
+
+ o xfree: in MHz
+
+ o fb: In Picoseconds (ps)
+
+ o pixclock = 1000000 / DCF
+
+ Horizontal timings
+
+ o left_margin = HFL - SH2
+
+ o right_margin = SH1 - HR
+
+ o hsync_len = SH2 - SH1
+
+ Vertical timings
+
+ o upper_margin = VFL - SV2
+
+ o lower_margin = SV1 - VR
+
+ o vsync_len = SV2 - SV1
+
+Good examples for VESA timings can be found in the XFree86 source tree, under
+xc/programs/Xserver/hw/xfree86/doc/modeDB.txt.
+
+8. References
+
+For more specific information about the frame buffer device and its applica-
+tions, please refer to the following documentation:
+
+ o The manual pages for fbset: fbset(8), fb.modes(5)
+
+ o The manual pages for XFree86: XF68_FBDev(1), XF86Config(4/5)
+
+ o The mighty kernel sources:
+
+ o linux/drivers/video/
+
+ o linux/include/linux/fb.h
+
+ o linux/include/video/
+
+9. Downloading
+
+All necessary files can be found at
+
+ ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/680x0/
+
+and on its mirrors.
+
+10. Credits
+
+This readme was written by Geert Uytterhoeven, partly based on the original
+X-framebuffer.README by Roman Hodek and Martin Schaller. Section `Converting
+XFree86 timing values into frame buffer device timings' was provided by Frank
+Neumann.
+
+The frame buffer device abstraction was designed by Martin Schaller.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fbdev.sgml,v 1.2 1999/08/23 06:38:53 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fbdev,v 1.3 1999/08/23 07:03:52 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fonts b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
new file mode 100644
index 000000000..0c8126619
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.fonts
@@ -0,0 +1,696 @@
+ Fonts in XFree86
+
+ Juliusz Chroboczek, jec@dcs.ed.ac.uk
+
+ 26 May 1999
+
+This version of XFree86 includes a number of improvements to the handling of
+fonts, including
+
+ o new Unicode-encoded bitmap fonts;
+
+ o internationalisation of the scalable font backends (Type 1, Speedo, and
+ TrueType);
+
+ o support for TrueType fonts;
+
+ o support for CID-keyed fonts.
+
+This document describes these improvements. It does not attempt to describe
+the standard support for fonts in X11; the reader is referred to the X(1),
+Xserver(1), and mkfontdir(1) manpages.
+
+1. Background and terminology
+
+1.1 Characters and glyphs
+
+A character is an abstract unit of a writing system. Examples of characters
+include the Latin capital letter A, the Arabic letter jim, and the dingbat
+black scissors.
+
+A glyph is a shape that may represent one or many characters when displayed
+by a window system or printed by a printer.
+
+While glyphs roughly correspond to characters in most cases, this correspon-
+dence is not, in general, one to one. For example, a font may have many vari-
+ant forms of the capital letter A; a single fi ligature may correspond to the
+letters f and i.
+
+A coded character set is a set of characters together with a mapping from
+integer codes -- known as codepoints -- to characters. Examples of coded
+character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990).
+
+A coded character set need not use 8-bit integers to index characters. Many
+early mainframes used 6-bit character sets, while 16-bit (or more) character
+sets are necessary for ideographic writing systems.
+
+1.2 Font files, fonts, and XLFD
+
+Traditionally, typographers speak about typefaces and founts (we use the tra-
+ditional British spelling to distinguish founts from digital fonts). A type-
+face is a particular style or design, such as Times Italic, while a fount is
+a molten-lead incarnation of a given typeface at a given size.
+
+Digital fonts come in font files. A font file contains all the information
+necessary for generating glyphs of a given typeface, and applications using
+font files may access glyph information in arbitrary order.
+
+Digital fonts may consist of bitmap data, in which case they are said to be
+bitmap fonts. They may also consist of a mathematical description of glyph
+shapes, in which case they are said to be scalable fonts. Common formats for
+scalable font files are Type 1 (sometimes incorrectly called ATM fonts or
+PostScript fonts), and TrueType.
+
+The glyph data in a digital font needs to be indexed somehow. How this is
+done depends on the font file format. In the case of Type 1 fonts, glyphs
+are identified by glyph names. In the case of TrueType fonts, glyphs are
+indexed by integers corresponding to one of a number of indexing schemes
+(usually Unicode --- see below).
+
+The X11 system uses the data in font file to generate font instances, which
+are collections of glyphs at a given size indexed according to a given encod-
+ing. X11 font instances are specified using a notation known as the X Logi-
+cal Font Description (XLFD). An XLFD starts with a dash `-', and consists of
+fourteen fields separated by dashes, for example
+
+ -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
+
+Or particular interest are the last two fields `iso8859-1', which specify the
+font instance's encoding.
+
+1.3 Unicode
+
+Unicode (<URL:http://www.unicode.org>) is a coded character set with the goal
+of uniquely identifying all characters for all scripts, current and histori-
+cal. While Unicode was explicitly not designed as a glyph encoding scheme,
+it can often be used as such for a large number of scripts.
+
+Unicode is an open character set, in that codepoint assignments may be added
+to Unicode at any time (once specified, though, an assignment can never be
+changed). For this reason, a Unicode font will be sparse, and only define
+glyphs for a subset of the character registry of Unicode.
+
+The Unicode standard is defined in parallel with ISO 10646. Assignments in
+the two standards are always equivalent, and this document uses the terms
+``Unicode'' and ``ISO 10646'' interchangeably.
+
+When used in X11, Unicode-encoded fonts should have the last two fields of
+their XLFD set to `iso10646-1'.
+
+2. Unicode-encoded bitmap fonts
+
+XFree86 includes two new Unicode-encoded fonts with a large collection of
+non-ideographic glyphs. While it is possible to use these fonts as main
+fonts, applications are expected to use them as fallbacks when a given glyph
+is not available in the current font.
+
+2.1 The Unicode `fixed' font
+
+The font file
+
+ /usr/X11/lib/X11/fonts/misc/6x13.pcf.gz
+
+with XLFD
+
+ -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
+
+is a Unicode-encoded version of the standard `fixed' font with added support
+for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA and other scripts
+plus numerous technical symbols. It contains over 2800 characters, covering
+all characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European
+IBM and Microsoft code pages, KOI8, WGL4, and the repertoires of many other
+character sets. This font is compatible with the standard 8-bit fixed font
+and therefore also includes the DEC line-drawing glyphs in the range 0x00 to
+0x1F, which are not part of Unicode or ISO 10646-1.
+
+XFree86 changes the standard aliases `fixed' and `6x13' to stand for this new
+Unicode-encoded font. The old ISO 8859-1 encoded `fixed' font is still
+available under its full XLFD name
+
+ -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
+
+in the file
+
+ /usr/X11/lib/X11/fonts/misc/6x13-L1.pcf.gz
+
+2.2 The ClearlyU Unicode font
+
+The ClearlyU font set of fonts provides a set of 12pt, 100dpi proportional
+fonts with many of the glyphs needed for Unicode text. Together, the fonts
+contain over 4000 glyphs.
+
+The main ClearlyU font has XLFD name
+
+ -mutt-ClearlyU-medium-r-normal--17-120-100-100-p-101-iso10646-1
+
+and resides in the font file
+
+ /usr/X11/lib/X11/fonts/misc/cu12.pcf.gz
+
+Additional ClearlyU fonts include
+
+ -mutt-ClearlyU Alternate Glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1
+ -mutt-ClearlyU Arabic Extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0
+ -mutt-ClearlyU Ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0
+ -mutt-ClearlyU PUA-medium-r-normal--17-120-100-100-p-111-iso10646-1
+
+3. Internationalisation of scalable font backends.
+
+The scalable font backends (Type 1, Speedo, TrueType) can now automatically
+re-encode fonts to the encoding specified in the XLFD in `fonts.dir'. For
+example, a `fonts.dir' file can now contain entries for the Type 1 Courier
+font such as
+
+ cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
+ cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2
+
+which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2
+respectively.
+
+3.1 The `fontenc' layer
+
+Three of the scalable backends (Type 1, Speedo, and the `xfsft' TrueType
+backend) use a common `fontenc' layer for font re-encoding. This allows
+those backends to share their encoding data, and allows simple configuration
+of new locales independently of font type.
+
+Please note: the X-TrueType (X-TT) backend does not use the `fontenc' layer,
+but instead uses its own method for font reencoding. Readers only interested
+in X-TT may want to skip to Using Symbol Fonts (section 3.5, page 1), as the
+intervening information does not apply to X-TT. X-TT itself is described in
+more detail in X-TrueType (section 4.1.2, page 1).
+
+In the `fontenc' layer, an encoding is defined by a name (such as
+`iso8859-1'), eventually a number of aliases (alternate names), and an
+ordered collection of mappings. A mapping defines the way the encoding can
+be mapped into one of the ``target'' encodings known to the `fontenc' layer;
+currently, those consist of Unicode, Adobe glyph names, and arbitrary True-
+Type `cmap's.
+
+A number of encodings are hardwired into `fontenc', and are therefore always
+available; the hardcoded encodings cannot easily be redefined. These
+include:
+
+ o `iso10646-1': Unicode;
+
+ o `iso8859-1': ISO Latin-1 (Western Europe);
+
+ o `iso8859-2': ISO Latin-2 (Eastern Europe);
+
+ o `iso8859-3': ISO Latin-3 (Southern Europe);
+
+ o `iso8859-4': ISO Latin-4 (Northern Europe);
+
+ o `iso8859-5': ISO Cyrillic;
+
+ o `iso8859-6': ISO Arabic;
+
+ o `iso8859-7': ISO Greek;
+
+ o `iso8859-8': ISO Hebrew;
+
+ o `iso8859-9': ISO Latin-5 (Turkish);
+
+ o `iso8859-10': ISO Latin-6 (Nordic);
+
+ o `iso8859-15': ISO Latin-9, or Latin-0 (Revised Western-European);
+
+ o `koi8-r': KOI8 Russian;
+
+ o `koi8-u': KOI8 Ukrainian (see RFC 2319);
+
+ o `koi8-ru': KOI8 Russian/Ukrainian
+
+ o `koi8-uni': KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian);
+
+ o `koi8-e': KOI8 `European', ISO-IR-111, or ECMA-Cyrillic;
+
+ o `microsoft-symbol' and `apple-roman': these are only likely to be use-
+ ful with TrueType symbol fonts.
+
+New encodings can be added by defining encoding files. When a font encoding
+is requested that the `fontenc' layer doesn't know about, the backend checks
+the directory in which the font file resides (not the directory with
+`fonts.dir'!) for a file named `encodings.dir'. If found, this file is
+scanned for the unknown encoding, and the requested encoding definition file
+is read in. The mkfontdir(1) utility, when invoked with the `-e' option fol-
+lowed by the name of a directory containing encoding files, can be used to
+automatically build `encodings.dir' files. See the mkfontdir(1) manpage for
+more details.
+
+A number of predefined encoding files have been included with the distribu-
+tion. Information on writing new encoding files can be found in Format of
+encodings directory files (section 3.3, page 1) and Format of encodings files
+(section 3.4, page 1).
+
+3.2 Backend-specific notes about fontenc
+
+3.2.1 Type 1
+
+The Type 1 backend first searches for a mapping with a target of PostScript.
+If one is found, it is used. If none is found, the backend searches for a
+mapping with target Unicode, which is then composed with a built-in table
+mapping codes to glyph names. Note that this table only covers part of the
+Unicode code points that have been assigned names by Adobe.
+
+If neither a PostScript or Unicode mapping is found, the backend defaults to
+ISO 8859-1.
+
+Specifying an encoding value of `adobe-fontspecific' disables the encoding
+mechanism. This is useful with symbol and wrongly encoded fonts (see below).
+
+The Type 1 backend currently limits all encodings to 8-bit codes.
+
+3.2.2 Speedo
+
+The Speedo backend searches for a mapping with a target of Unicode, and uses
+it if found. If none is found, the backend defaults to ISO 8859-1.
+
+The Speedo backend limits all encodings to 8-bit codes.
+
+3.2.3 The `xfsft' TrueType backend
+
+The TrueType backend scans the mappings in order. Mappings with a target of
+PostScript are ignored; mappings with a TrueType or Unicode target are
+checked against all the cmaps in the file. The first applicable mapping is
+used.
+
+Authors of encoding files to be used with the TrueType backend should ensure
+that mappings are mentioned in decreasing order of preference.
+
+3.3 Format of encodings directory files
+
+In order to use a font in an encoding that the font backend does not know
+about, you need to have a `encodings.dir' file in the same directory as the
+font file used. `encodings.dir' has the same format as `fonts.dir'. Its
+first line specifies the number of encodings, while every successive line has
+two columns, the name of the encoding, and the name of the encoding file;
+this can be relative to the current directory, or absolute. Every encoding
+name should agree with the encoding name defined in the encoding file. For
+example,
+
+ 3
+ mulearabic-0 encodings/mulearabic-0.enc
+ mulearabic-1 encodings/mulearabic-1.enc
+ mulearabic-2 encodings/mulearabic-2.enc
+
+Note that the name of an encoding must be specified in the encoding file's
+STARTENCODING or ALIAS line. It is not enough to create an `encodings.dir'
+entry.
+
+If your platform supports it (it probably does), encoding files may be com-
+pressed or gzipped.
+
+`encoding.dir' files are best maintained by the mkfontdir(1) utility. Please
+see the mkfontdir(1) manpage for more information.
+
+3.4 Format of encoding files
+
+The encoding files are ``free form,'' i.e. any string of whitespace is equiv-
+alent to a single space. Keywords are parsed in a non-case-sensitive manner,
+meaning that `size', `SIZE', and `SiZE' all parse as the same keyword; on the
+other hand, case is significant in glyph names.
+
+Numbers can be written in decimal, as in `256', in hexadecimal, as in
+`0x100', or in octal, as in `0400'.
+
+Comments are introduced by a hash sign `#'. A `#' may appear at any point in
+a line, and all characters following the `#' are ignored, up to the end of
+the line.
+
+The encoding file starts with the definition of the name of the encoding, and
+eventually its alternate names (aliases):
+
+ STARTENCODING mulearabic-0
+ ALIAS arabic-0
+ ALIAS something-else
+
+The names of the encoding should be suitable for use in an XLFD font name,
+and therefore contain exactly one dash `-'.
+
+The encoding file may then optionally declare the size of the encoding. For
+a linear encoding (such as Mule Arabic, or ISO 8859-1), the SIZE line speci-
+fies the maximum code plus one:
+
+ SIZE 0x2B
+
+For a matrix encoding, it should specify two numbers. The first is the num-
+ber of the last row plus one, the other, the highest column number plus one.
+For example, in the case of `jisx0208.1990-0' (JIS X 0208(1990), double-byte
+encoding, high bit clear), it should be
+
+ SIZE 0x75 0x80
+
+Codes outside the region defined by the size line are supposed to be unde-
+fined. Encodings default to linear encoding with a size of 256 (0x100).
+This means that you must declare the size of all 16 bit encodings.
+
+What follows is one or more mapping sections. A mapping section starts with
+a `STARTMAPPING' line stating the target of the mapping. The target may be
+one of:
+
+ o Unicode (ISO 10646):
+
+ STARTMAPPING unicode
+
+ o a given TrueType `cmap':
+
+ STARTMAPPING cmap 3 1
+
+ o PostScript glyph names
+
+ STARTMAPPING postscript
+
+Every line in a mapping section maps one from the encoding being defined to
+the target of the mapping. In mappings with a Unicode or TrueType mapping,
+codes are mapped to codes:
+
+ 0x21 0x0660
+ 0x22 0x0661
+ ...
+
+As an abbreviation, it is possible to map a contiguous range of codes in a
+single line. A line consisting of three integers
+
+ start end target
+
+is an abbreviation for the range of lines
+
+ start target
+ start+1 target+1
+ ...
+ end target+end-start
+
+For example, the line
+
+ 0x2121 0x215F 0x8140
+
+is an abbreviation for
+
+ 0x2121 0x8140
+ 0x2122 0x8141
+ ...
+ 0x215F 0x817E
+
+Codes not listed are assumed to map through the identity (i.e. to the same
+numerical value). In order to override this default mapping, you may specify
+a range of codes to be undefined by using an `UNDEFINE' line:
+
+ UNDEFINE 0x00 0x2A
+
+or, for a single code
+
+ UNDEFINE 0x1234
+
+This works because later values override earlier one.
+
+PostScript mappings are different. Every line in a PostScript mapping maps a
+code to a glyph name
+
+ 0x41 A
+ 0x42 B
+ ...
+
+and codes not explicitly listed are undefined.
+
+A mapping section ends with an ENDMAPPING line
+
+ ENDMAPPING
+
+After all the mappings have been defined, the file ends with an ENDENCODING
+line
+
+ ENDENCODING
+
+Lines of the form
+
+ UNASSIGNED 0x00 0x1F
+
+or
+
+ UNASSIGNED 0x1234
+
+are ignored by the server, but may be used by supporting utilities.
+
+In order to make future extensions to the format possible, lines starting
+with an unknown keyword are ignored, as are mapping sections with an unknown
+target.
+
+3.5 Using symbol fonts
+
+Type 1 symbol fonts should be installed using the `adobe-fontspecific' encod-
+ing.
+
+In an ideal world, all TrueType symbol fonts would be installed using one of
+the `microsoft-symbol' and `apple-roman' encodings. A number of symbol fonts,
+however, are not marked as such; such fonts should be installed using
+`microsoft-cp1252', or, for older fonts, `microsoft-win3.1'.
+
+In order to guarantee consistent results (especially between Type 1 and True-
+Type versions of the same font), it is possible to define a special encoding
+for a given font. This has already been done for the `ZapfDingbats' font; see
+the file `encodings/adobe-dingbats.enc'.
+
+3.6 Using badly encoded font files
+
+A number of text fonts are incorrectly encoded. Incorrect encoding is some-
+times done by design, in order to make a font for an exotic script appear
+like an ordinary Western text font. It is often due to the font designer's
+laziness or incompetence; in particular, most people seem to find it easier
+to invent idiosyncratic glyph names rather than follow the Adobe glyph list.
+
+There are two ways of dealing with such fonts: using them with the encoding
+they were designed for, and creating an ad hoc encoding file.
+
+Of course, most of the time the proper fix would be to hit the font designer
+very hard on the head with the PLRM (preferably the first edition, as it was
+published in hardcover).
+
+3.6.1 Using fonts with the designer's encoding
+
+In the case of Type 1 fonts, the font designer can specify a default encod-
+ing; this encoding is requested by using the `adobe-fontspecific' encoding in
+the XLFD name. Sometimes, the font designer omitted to specify a reasonable
+default encoding; in this case, you should experiment with `adobe-standard',
+`iso8859-1', `microsoft-cp1252', and `microsoft-win3.1', (`microsoft-symbol'
+doesn't make sense for Type 1 fonts).
+
+TrueType fonts do not have a default encoding, and use of the Microsoft Sym-
+bol encoding yields strange results with text fonts on some (non-X11) plat-
+forms. However, most TrueType fonts are designed with either Microsoft or
+Apple platforms in mind, so one of `microsoft-cp1252', `microsoft-win3.1', or
+`apple-roman' should yield reasonable results.
+
+3.6.2 Specifying an ad hoc encoding file
+
+It is always possible to define an encoding file to put the glyphs in a font
+in any desired order. Again, see the `encodingsadobe-dingbats.enc/' file to
+see how this is done.
+
+3.6.3 Specifying font aliases
+
+By following the directions above, you will find yourself with a number of
+fonts with unusual names -- specifying encodings such as `adobe-fontspe-
+cific', `microsoft-win3.1' etc. In order to use these fonts with standard
+applications, it may be useful to remap them to their proper names.
+
+This is done by writing a `fonts.alias' file. The format of this file is sim-
+ilar to the format of the `fonts.dir' file, except that it maps XLFD names to
+XLFD names. A `fonts.alias' file might look as follows:
+
+ 1
+ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \
+ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific"
+
+(both XLFD names on a single line). The syntax of the `fonts.alias' file is
+described in the mkfontdir(1) manual page.
+
+4. New font backends
+
+4.1 New TrueType backends
+
+This version of XFree86 comes with two TrueType backends, known as `xfsft'
+and `X-TrueType' (`X-TT' for short). Those two backends are incompatible, in
+that only one can be used at any one time. Users are invited to chose
+whichever backend they find more useful and stick to it.
+
+Both TrueType backends delay glyph rasterisation to the time at which a glyph
+is first used. For this reason, they only provide an approximate value for
+the `average width' font property. Users are warned not to rely on the aver-
+age width of a font having an accurate value.
+
+Both backends also support an optimisation for character-cell fonts (fonts
+with all glyph metrics equal, or terminal fonts). A font with an XLFD speci-
+fying a character-cell spacing `c', as in
+
+ -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+
+will not rasterise glyphs at metrics computation time, but instead trust the
+font really to be a character-cell font. Users are encouraged to make use of
+this optimisation when useful, but be warned that not all monospaced fonts
+are character-cell fonts.
+
+4.1.1 The `xfsft' TrueType backend
+
+The `xfsft' backend is a backend based on the FreeType library (see
+www.freetype.org) with support for the `fontenc' style of internationalisa-
+tion (see The fontenc layer (section 3.1, page 1)). This backend supports
+TrueType Font files (*.ttf) and TrueType Collections (*.ttc).
+
+In order to access the faces in a TrueType Collection file, the face number
+must be specified in the fonts.dir file before the filename within colons.
+For example,
+
+ :2:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+
+refers to face 2 in the `mincho.ttc' TrueType Collection file.
+
+4.1.2 The `X-TrueType' TrueType backend
+
+The `X-TrueType' backend is another backend based on the FreeType library.
+X-TrueType doesn't use the `fontenc' layer for managing font encodings, but
+instead uses its own database of encodings. However, X-TrueType includes a
+large number of encodings, and any encoding you need is likely to be present
+in X-TrueType.
+
+X-TrueType extends the `fonts.dir' syntax with a number of options, known as
+`TTCap'. A `TTCap' entry follows the general syntax
+
+ :option=value:
+
+and should be specified before the filename.
+
+The most useful TTCap option is used to specify the face number to use with
+TTCs; it carries the name `fn'. This means that face 2 of font file `min-
+cho.ttc' is specified using:
+
+ :fn=2:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+
+More information on the TTCap syntax, and on X-TrueType in general, may be
+found on
+
+ <URL:http://hawk.ise.chuo-u.ac.jp/student/person/tshiozak/x-tt/index-eng.html>
+
+4.2 Support for CID-keyed fonts
+
+The CID-keyed font format was designed by Adobe Systems for fonts with large
+character sets. It is described in the Adobe Technical Notes nr. 5092,
+"Overview of the CID-Keyed Font Technology," nr. 5014, "CMap and CIDFont File
+Format Specification," and others, available from
+
+ <URL:http://partners.adobe.com/supportservice/devrelations/typeforum/cidfonts.html>
+
+Sample CID-keyed fonts can be found at:
+
+ <URL:ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/>
+
+Support for CID-keyed fonts in XFree86 is controlled by the two switches
+`BuildCID' and BuildCIDFonts. Make sure that those switches are turned on
+(in the directory xc/config/cf) when XFree86 is built. By default, they
+should be set to YES, unless you are building XFree86 for a small memory
+footprint, in which case they should be set to NO.
+
+The CID-keyed font backend does not use the `fontenc' layer, but instead uses
+the standard `CMap' method of recoding CID-keyed fonts.
+
+4.2.1 Using CID-keyed fonts
+
+As shown in the sample install file /usr/X11R6/lib/X11/XF86Config.eg, the
+font directory CID should be specified as part of the XFree86 font path:
+
+ FontPath "/usr/X11R6/lib/X11/fonts/CID/"
+
+in the `XF86Config' file. When the CID font directory is on the font path it
+must contain at least the empty files fonts.dir and fonts.scale. Sample
+`fonts.dir' and `fonts.scale' files, with 0 entries, are installed by
+default.
+
+A sample CID-keyed font is provided in the file:
+
+ test/xsuite/xtest/CID
+
+The test directory was given the same name as the CID font directory, because
+it shows how a CID-keyed font should be installed. It contains a number of
+subdirectories, and any CID font directory should have the same directory
+structure.
+
+When installing CID-keyed fonts, the empty fonts.scale and fonts.dir files in
+the directory:
+
+ xc/fonts/scaled/CID
+
+should be replaced by fonts.scale and fonts.dir files with a number of
+entries of the form:
+
+ 1
+ Adobe-Korea1/Munhwa-Regular--Adobe-Korea1-0.cid \
+ -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-adobe.korea1-0
+
+(the font file name and the XLFD name should be on the same line). Note that
+the first column does not specify an actual filename; instead, it specifies
+the PostScript name of the CID-keyed font, followed by the extension `.cid'.
+The actual names of the files used will be derived from this PostScript name.
+
+CID-keyed fonts are divided in groups by character collection. For example,
+the Korean font:
+
+ Munhwa-Regular--Adobe-Korea1-0
+
+is in a subdirectory `Adobe-Korea1'.
+
+The PostScript name of a CID-keyed font consists of two parts, the CIDFont-
+Name and the CMapName, separated by two dashes. For instance, in the case of
+the font name
+
+ Munhwa-Regular--Adobe-Korea1-0
+
+the CIDFontName is `Munhwa-Regular' while the CMapName is `Adobe-Korea1'.
+
+Each CID-keyed font consist of a CIDFont file and one or more CMap files.
+The CIDFont file contains the description of each character in a font. It is
+stored in the subdirectory CIDFont of the Adobe-Korea1 directory. The direc-
+tory structure looks as following:
+
+ CID/Adobe-Korea1/CIDFont/Munhwa-Regular
+ CID/Adobe-Korea1/CMap/Adobe-Korea1-0
+ CID/Adobe-Korea1/AFM/Munhwa-Regular.afm
+ CID/Adobe-Korea1/CFM
+ CID/fonts.dir
+ CID/fonts.scale
+
+The file `Munhwa-Regular.afm' is an Adobe Font Metric File (AFM). The direc-
+tory `CFM' will be used for summaries of that font metric file, which will be
+computed later.
+
+When the CID-keyed files are installed you can run the utility
+
+ /usr/X11R6/bin/mkcfm
+
+to create the summaries of font metric file (*.cfm), and to put them in
+appropriate subdirectories. By default, the program works on the directory:
+
+ /usr/X11R6/lib/X11/fonts/CID
+
+A different directory can be specified on the command line of `mkcfm.'
+
+`mkcfm' should be run as root, as it needs to write its output to a system
+directory. If the program determines that it cannot write in the designated
+`CFM' subdirectories, it will display a message, and switch to current direc-
+tory.
+
+Unless `mkcfm' is run, opening large CID-keyed fonts will take a significant
+amount of time. `mkcfm' should be run again whenever a change is made to any
+of the CID-keyed fonts, or when the CID-keyed fonts are copied to a machine
+with a different architecture.
+
+4.2.2 Limitations
+
+The current version of the CID-keyed fonts backend only supports the CMaps
+used for horizontal text (e.g. the CMap `KSC-EUC-H' will be used, but not
+`KSC-EUC-V'). This limitation is due to the fact that the core X11 protocol
+only provides support for horizontal writing.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.4 1999/08/28 10:43:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.4 1999/08/28 11:22:57 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.i740 b/xc/programs/Xserver/hw/xfree86/doc/README.i740
new file mode 100644
index 000000000..c3fa6b9a1
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.i740
@@ -0,0 +1,172 @@
+ Information for i740 Users
+
+ Precision Insight, Inc.
+
+ 18 February 1999
+
+1. Supported Hardware
+
+ o Intel 740 based cards
+
+2. Features
+
+ o Full support for 8, 15, 16, 24 and 32 bit per pixel depths.
+
+ o Hardware cursor support to reduce sprite flicker.
+
+ o Hardware accelerated 2D drawing engine support for 8, 15, 16 and 24 bit
+ per pixel depths.
+
+ o Support for high resolution video modes up to 1600x1200.
+
+ o Support for doublescan video modes (e.g., 320x200 and 320x240).
+
+ o Support for gamma correction at all pixel depths.
+
+ o Fully programmable clock supported.
+
+ o Robust text mode restore for VT switching.
+
+3. Technical Notes
+
+ o Hardware acceleration is not possible in 32 bit per pixel depth.
+
+ o Interlace modes cannot be supported.
+
+4. Reported Working Video Cards
+
+ o Real3D Starfighter AGP
+
+ o Real3D Starfighter PCI
+
+ o Diamond Stealth II/G460 AGP
+
+ o 3DVision-i740 AGP
+
+ o ABIT G740 8MB SDRAM
+
+ o Acorp AGP i740
+
+ o AGP 2D/3D V. 1N, AGP-740D
+
+ o AOpen AGP 2X 3D Navigator PA740
+
+ o ARISTO i740 AGP (ART-i740-G)
+
+ o ASUS AGP-V2740
+
+ o Atrend (Speedy) 3DIO740 AGP (ATC-2740)
+
+ o Chaintech AGP-740D
+
+ o EliteGroup(ECS) 3DVision-i740 AGP
+
+ o EONtronics Picasso 740
+
+ o EONtronics Van Gogh
+
+ o Everex MVGA i740/AG
+
+ o Flagpoint Shocker i740 8MB
+
+ o Gainward CardExpert 740 8MB
+
+ o Genoa Systems Phantom 740
+
+ o Gigabyte Predator i740 8MB AGP
+
+ o Hercules Terminator 128 2X/i AGP
+
+ o HOT-158 (Shuttle)
+
+ o Intel Express 3D AGP
+
+ o Jaton Video-740 AGP 3D
+
+ o Jetway J-740-3D 8MB AGP, i740 AGP 3D
+
+ o Joymedia Apollo 7400
+
+ o Leadtek Winfast S900
+
+ o Machspeed Raptor i740 AGP 4600
+
+ o Magic-Pro MP-740DVD
+
+ o MAXI Gamer AGP 8 MB
+
+ o Palit Daytona AGP740
+
+ o PowerColor C740 (SG/SD) AGP
+
+ o QDI Amazing I
+
+ o Soyo AGP (SY-740 AGP)
+
+ o Spacewalker Hot-158
+
+ o VideoExcel AGP 740
+
+ o ViewTop ZeusL 8MB
+
+ o Winfast S900 i740 AGP 8MB
+
+5. Configuration
+
+The driver auto-detects all device information necessary to initialize the
+card. The only lines you need in the "Device" section of your XF86Config
+file are:
+
+ Section "Device"
+ Identifier "i740"
+ EndSection
+
+or let xf86config or XF86Setup do this for you.
+
+However, if you have problems with auto-detection, you can specify:
+
+ o VideoRam - in kilobytes
+
+ o DacSpeed - in MHz
+
+ o MemBase - physical address of the linear framebuffer
+
+ o IOBase - physical address of the memory mapped IO registers
+
+6. Driver Options
+
+ o "hw_cursor" - request hardware cursor (default)
+
+ o "sw_cursor" - software cursor only
+
+ o "no_accel" - software rendering only
+
+ o "sgram" - force the use of SGRAM timing info
+
+ o "sdram" - force the use of SDRAM timing info
+
+Note: the i740 X server should automatically detect whether your card has
+SGRAM or SDRAM. Use the "sgram" and "sdram" options if it is incorrectly
+detected.
+
+7. Known Limitations
+
+ o Certain drawing operations are very slow when using 24 bit per pixel
+ depth mode. We hope to fix this in a future release.
+
+8. Author
+
+ o Kevin E. Martin <kevin@precisioninsight.com>
+
+This driver was donated to The XFree86 Project by:
+
+ Precision Insight, Inc.
+ Cedar Park, TX
+ USA
+
+http://www.precisioninsight.com
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i740.sgml,v 1.2 1999/08/23 06:18:34 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.3 1999/08/23 07:03:52 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.isc b/xc/programs/Xserver/hw/xfree86/doc/README.isc
new file mode 100644
index 000000000..5f894ad0c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.isc
@@ -0,0 +1,556 @@
+ Information for ISC Users
+
+ Michael Rohleder
+
+ 06 March 1999
+
+1. X11R6/XFree86 on Interactive Unix
+
+This document provides some additional information about compiling and using
+X11R6 and XFree86 on your Interactive Unix, also referred to as ISC.
+
+If you have any suggestions, comments, fixes or ideas regarding X11R6/XFree86
+on Interactive Unix, send e-mail to
+
+<michael.rohleder@stadt-frankfurt.de>
+
+Bug Reports should be sent to
+
+<XFree86@XFree86.Org>
+
+Questions or anything else should be posted to the NewsGroup
+
+comp.windows.x.i386unix
+
+There is currently no support for shared Libraries so it will be filespace
+consuming if you want to build X11-clients with X11R6. Best you mix X11R6
+Server with X11R5 and X11R4 clients. And only compile clients who need the
+new facilities provided in the X11R6 Libraries against them.
+
+2. Things needed for compiling the sources
+
+ gcc
+ Use the highest number for x you found. Fresco will only build
+ 2.6.3 and later. I'd tried gcc Version 2.5.8, 2.6.0, 2.6.2,
+ 2.6.3 and 2.7.2. Current: 2.8.1
+
+ Since 2.6.3 the current source tree should be able to compile
+ with a little bit more Optimization:
+ #define DefaultCDebugFlags -O3 -fomit-frame-pointer inside
+ xf86site.def to overwrite the default -O2.
+
+ With 2.7.x you must specify #define UsePosix YES
+ inside xf86site.def. This is necessary to build the sources suc-
+ cessfully. Versions prior to 2.7.0 could define it, but don't
+ need it for a clean build.
+
+ With 2.8.1 on Pentium CPU we can use special 586 Optimization.
+ Try the following define inside your host.def.
+
+ #define DefaultGcc2i386Opt \
+ -O2 -march=pentium -mpentium -Wall -Wno-implicit-int \
+ -fno-strength-reduce
+ /* default with 2.8.1, so not really needed
+ -malign-loops=2 -malign-jumps=2 -malign-functions=2
+ */
+
+ libg++-2.x.x
+ The needed g++ Libraries for use with g++ 2.x.x. As this is only
+ necessary for Fresco, it isn't needed anymore since X11R6.1.
+
+ binutils
+ You could use the assembler and linker the assembler is most pre-
+ ferred,and the linker is needed at least if you want to link
+ libFresco.a within a Program. Don't use strip and ar/ranlib, the
+ first generates buggy binaries when stripping (at least on my
+ machines) and the last requires the use of ranlib after creating
+ an archive, this is not configured. Current: 2.8.1.0.15 (Used:
+ as, ld, ar, strip)
+
+ gnu-malloc
+ Due to better memory usage we should use GNU's malloc library on
+ systems where possible.
+
+ Enable #define UseGnuMalloc YES inside xf86site.def or within the
+ Linkkit site.def.
+
+ Enable and set #define GnuMallocLibrary to your needs, if it
+ isn't like the default -L/usr/local/lib -lgmalloc.
+
+ inline-math (optional)
+ This is the "original" inline-math package available at your
+ favorite Linux Mirror.
+
+ Use #define UseInlineMath YES inside host.def to enable it.
+ Please note the changes section what else to do, to use this
+ package.
+
+3. Changes to the System Header Files
+
+You have to change some of the standard header files supplied with your ver-
+sion of Interactive. You also need to change some of the include files in the
+gcc-lib/include directory.
+
+Let us say the gcc-files are in directory
+
+/usr/local/lib/gcc-lib/i[345]86-isc[34].[0-9]/2.6.x
+
+referred to as "gcc-lib"
+
+3.1 /usr/include/sys/limits.h
+
+and gcc-lib/include/sys/limits.h
+
+ #ifndef OPEN_MAX
+ #ifdef ISC
+ #define OPEN_MAX 256
+ #else
+ #define OPEN_MAX 20
+ #endif
+ #endif
+
+OPEN_MAX had to be increased to prevent Xlib Errors (max no. of clients
+reached).
+
+3.2 /usr/include/sys/ioctl.h
+
+surrounded by
+
+ #ifndef _IOCTL_H
+ #define _IOCTL_H
+ ...
+ #endif
+
+to prevent multiple includes.
+
+3.3 /usr/include/errno.h
+
+(and the corresponding gcc-include-file) add
+
+ #include <net/errno.h>
+
+because of EWOULDBLOCK undefined in several places regarding lbx. Surround
+/usr/include/net/errno.h with
+
+ #ifndef _NET_ERRNO_H
+ #define _NET_ERRNO_H
+ ...
+ #endif
+
+to prevent multiple includes were <net/errno.h> is explicit included from the
+sources.
+
+3.4 /usr/include/rpc/types.h
+
+copy this file to gcc-lib/include/rpc/types.h and change the declaration of
+malloc() to
+
+ #if !defined(__cplusplus)
+ extern char *malloc();
+ #endif
+
+Note that this is only necessary if you want to build Fresco
+
+3.5 /usr/include/sys/un.h
+
+such a file does not exist on Interactive. You may like to generate it, if
+you don't like a warning from depend. It isn't needed to compile the sources
+successfully.
+
+You could use the following to produce it:
+
+ #ifndef X_NO_SYS_UN
+ struct sockaddr_un {
+ short sun_family; /* AF_UNIX */
+ char sun_path[108]; /* path name (gag) */
+ };
+ #endif
+
+3.6 /usr/include/math.h
+
+To use the Inline Math package you have to change your existing math.h.
+Please note, the way I include the new Header file, is different than sug-
+gested in inline-math's README.
+
+Please add the following at the bottom of math.h, before the last #endif
+
+ #if defined(UseInlineMath)
+
+ /* Needed on ISC __CONCAT, PI */
+ #ifndef __CONCAT
+ /*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments. __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+ #if defined(__STDC__) || defined(__cplusplus)
+ #define __CONCAT(x,y) x ## y
+ #define __STRING(x) #x
+ #else /* !(__STDC__ || __cplusplus) */
+ #define __CONCAT(x,y) x/**/y
+ #define __STRING(x) "x"
+ #endif /* !(__STDC__ || __cplusplus) */
+ #endif
+
+ #ifndef PI
+ #define PI M_PI
+ #endif
+
+ #include "/usr/local/include/i386/__math.h"
+ #endif
+
+4. make World
+
+ BOOTSTRAPCFLAGS="-DISC [-DISC30 | -DISC40] -DSYSV [-Di386]"
+
+ -DISC -DISC30
+ these two defines are necessary to build the release I don't know
+ if the build will succeed for ISC versions prior than 3.x
+
+ -DISC40
+ are only for getting the ISC version and therefore set the Has-
+ SymLinks to Yes ('cause symbolic linking were only supported from
+ Version 4.x using the S5L Filesystem)
+
+ If you could use long filenames, you could enable the installa-
+ tion of expanded Manual Pages by including
+ #define ExpandManNames YES inside xf86site.def.
+
+ A build on ISC 4.x only needs -DISC40 defined in the BOOT-
+ STRAPCFLAGS ( -DISC30 will be included automatically ).
+
+ Note: due to some incompatibilities between ISC 4.0 and 4.1, the
+ default is to build for ISC4.0, even if you build on 4.1. If you
+ want to build only for 4.1 you should set #define IscCompileVer-
+ sion 410 inside your host.def.
+
+ (the fchmod function isn't available on 4.0, so it won't compile,
+ and binaries from 4.1 won't run cause of the unsupported System
+ call The libraries build for 4.1 couldn't be used with 4.0 Sys-
+ tems, due to some functions not available on 4.0)
+
+ -DSYSV [-Di386]
+ standard defines for SystemV Release3 on x86 platform. You don't
+ need to explicitly define -Di386 because this is pre-defined in
+ /lib/cpp.
+
+5. linear Addressing
+
+ o Compiling ...
+
+ You need the mmap-2.2.3 driver installed on your system. If you don't
+ have the mmap-2.2.3 driver installed, you could use the driver source in
+ the file
+
+ xc/programs/Xserver/hw/xfree86/etc/mmapSVR3.shar
+
+ or
+
+ /usr/X11R6/lib/X11/etc/mmapSVR3.shar
+
+ Build and install the driver as instructed. You'll need the file
+ /usr/include/sys/mmap.h for compiling the X11R6/XFree86 source tree,
+ with linear addressing enabled.
+
+ The new loadable X Server is not tested to work without linear addressing.
+
+ o Using ...
+
+ To use the linear address-mapping of the framebuffer you need the mmap
+ Driver by Thomas Wolfram (Version 2.2.3) installed in your Kernel. If
+ you have installed it, most servers will use linear addressing by
+ default. Others may require setting the
+
+ Option "linear"
+
+ in your XF86Config. Check the appropriate manual pages for details.
+ Maybe you need also the MemBase specified in XF86Config. Please refer to
+ the appropriate README of your Card/Server, for How to use...
+
+ I could only test these cards on Interactive UNIX
+
+ o Spea/V7 Vega - clgd5428 - VLB - (old)
+
+ with 32MB MainMemory installed I couldn't use it. My tests with
+ different mappings into the address space results in no Graphics
+ displayed or a spontaneous reboot.
+
+ o ATI GUP - mach32 - VLB - (old)
+
+ with 32MB MainMemory installed I could map the CardMemory at Mem-
+ Base 0x07c00000. I could work with all clients until I try to acti-
+ vate a Motif 1.1.1 InputField inside a Motif Client like Mosaic-2.4
+ or xplan. This results in a crash of the XServer.
+
+ !!! You could work around this !!!
+
+ Expand your .Xdefaults with
+
+ *blinkRate: 0
+ *cursorPositionVisible: false
+
+ This bug seems to be fixed since 3.1.2, and therefore the
+ workaround is not needed anymore.
+
+ o ELSA Winner 2000PRO/X Revision G
+
+ if you experience a Problem with this Card you could try to use the
+ older Chipset Driver instead "newmmio".
+
+ If you declare
+
+ Chipset "mmio_928"
+
+ inside your XF86Config, it may be alright again.
+
+ With the current XF86_S3 I don't encounter any problem.
+
+ o Diamond FireGL 1000
+
+ 3Dlabs GLINT Permedia rev 1
+ 3Dlabs GLINT Delta rev 1
+
+6. XKeyboard Extension
+
+ o Sample Setup ...
+
+ Here is a sample XKeyboard Definition to include inside the Keyboard
+ Section of your XF86Config File.
+
+ Xkbkeycodes "xfree86"
+ /* XkbSymbols "us(pc101)+de_nodead" */
+ /* This has changed between 3.1.2E and 3.1.2F */
+ /* it is now: */
+ XkbSymbols "us(pc102)+de(nodeadkeys)"
+ XkbTypes "default"
+ XkbCompat "default"
+ XkbGeometry "pc"
+
+ or you could use this one with the new Options:
+
+ XkbRules "xfree86"
+ XkbModel "pc102"
+ XkbLayout "de"
+ XkbVariant "nodeadkeys"
+
+7. Multibuffer Extension
+
+This is an obsolete Extension. Anyway, if you want to include this Extension
+inside your build, you have to add: #define BuildMultibuffer YES
+inside xf86site.def Please note, this Extension should be disabled when
+building the Loader Server.
+
+8. Default Definitions
+
+These are default options defined inside isc.cf. You can redefine them
+inside host.def.
+
+ /* Disable the use of /var/X11 */
+ #ifndef HasVarDirectory
+ #define HasVarDirectory NO
+ #endif
+
+ /* Use mmap Driver */
+ #ifndef HasSVR3mmapDrv
+ # define HasSVR3mmapDrv YES
+ #endif
+
+ /* Use inline Math from linux ;-) package inline-math-2.6.tar.gz */
+ /* should be available on your favorite linux ftp */
+ #ifndef UseInlineMath
+ # define UseInlineMath YES
+ #endif
+
+ /* Use cbrt from liboptm.a (Interactive icc Compiler) */
+ #ifndef HasCbrt
+ # define HasCbrt YES
+ #endif
+
+ /* Use GNUs MallocLibrary (and the Location for the Lib) */
+ #ifndef UseGnuMalloc
+ # define UseGnuMalloc YES
+ #endif
+
+ /* Install Zlib Headers - used in lib/zlib/Imakefile */
+ #ifndef OsNeedZlibHeaders
+ # define OsNeedZlibHeaders YES
+ #endif
+
+ /* Expand Manual Pages (needs S5L) */
+ #ifndef ExpandManNames
+ # define ExpandManNames YES
+ #endif
+
+ /* if you have groff or the TextProcessingWorkbench - don't preformat*/
+ #ifndef FormattedManPages
+ # define FormattedManPages NO
+ #endif
+
+ #ifndef HasSgmlFmt /* HasLinuxDoc */
+ # define HasSgmlFmt YES
+ #endif
+
+ /* XF86Setup Util */
+ #ifndef HasTk
+ #define HasTk YES
+ #define HasTcl YES
+ #endif
+
+ #ifndef HasPosixRegex /* Need extra/regex since 3.9Ns */
+ #define HasPosixRegex NO
+ #endif
+
+ #ifndef DoLoadableServer
+ #define DoLoadableServer YES
+ #endif
+
+ #ifndef CpuOption
+ #define CpuOption -mpentium
+ #endif
+
+9. Installation
+
+After your make World BOOTSTRAPCFLAGS="... succeed,
+
+ make install
+
+to install in /usr/X11R6. Make sure you have enough space, and /usr/X11R6
+exists either as a directory or a symlink to another directory maybe in
+another filesystem.
+
+ make install.man
+
+to install the compressed nroff versions of the manual pages into
+/usr/X11R6/man. This directory will be generated if it doesn't exist.
+
+ make install.linkkit
+
+to install the server binary LinkKit into /usr/X11R6/lib/Server.
+
+ You should tune the Kernel using the command-file
+
+ /usr/X11R6/lib/X11/etc/xf86install
+
+ This will increase the available pseudo devices,
+ some Tunable Parameters and install some files
+ to use inside sysadm. You could also install
+ some additional Fonts and Terminal files.
+
+This is now a menu driven config tool for XFree86 on IUS For the first setup
+you should go from 1 to x step by step. Here is its main screen
+
+ X11R6 XFree86 Version (version)
+ -------------------------------------------------------------------------------
+
+ Check dependencies: 1
+ Make XFree86 Label 2
+ Install Remove script 3
+ Setup node.d + sdevice.d Files 4
+ Tune Kernel Variables 5
+ Tune PseudoTerminals 6
+ Install xterm terminal entries 7
+ Install VGA font 8
+ Save current KernelConfig 9
+
+ Exit X
+
+ Your Choice [1-9]?<enter>:
+
+You also should increase MAXUMEM to its maximum, else programs may die with:
+
+ X Error of failed request: BadAlloc (insufficient resources for operation)
+ Major opcode of failed request: 53 (X_CreatePixmap)
+ Serial number of failed request: 37791
+ Current serial number in output stream: 37822
+ Widget hierarchy of resource: unknown
+
+You could do this automatically with menu entry no. 5.
+
+10. Using ...
+
+ o Xprt:
+
+ The new Xprint Server is configured to use lpr as its print helper so
+ you have to install and configure lpr to use Xprt.
+
+ o Keyboard:
+
+ You don't need any modmap-File to get your keyboard working with any
+ iso-8859-1 Font. Simply enable
+
+ o LeftAlt Meta
+
+ o RightAlt ModeShift
+
+ o RightCtl Compose
+
+ in your XF86Config - Section "Keyboard"
+
+ o xpcterm:
+
+ if you want to get the German 'Umlaut' inside your ISC X11R4 client xpc-
+ term when you are using the ega/vga font. Set up the user's .Xdefaults
+ to contain:
+
+ XEga*AT386.Translations: #override \
+ Shift<Key>odiaeresis: string(0x99) \n\
+ <Key>odiaeresis: string(0x94) \n\
+ Shift<Key>adiaeresis: string(0x8e) \n\
+ <Key>adiaeresis: string(0x84) \n\
+ Shift<Key>udiaeresis: string(0x9a) \n\
+ <Key>udiaeresis: string(0x81) \n\
+ Shift<Key>ssharp: string(0x3f) \n\
+ Meta<Key>ssharp: string(0x5c) \n\
+ <Key>ssharp: string(0xe1)
+
+ The only disadvantage is that you have to use Alt instead of AltGr to
+ get the \ Backslash (on a German Keyboard)
+
+ You have to call your xpcterm with the option -name XEga -fn ega
+
+ o Switching between X11R5 and X11R6 configuration
+
+ to compile X11-Clients as either R6 or R5 clients, should be as easy as
+ you only switch the PATH components so that either /usr/X11R6/bin/xmkmf
+ or /usr/X386/bin/xmkmf would make the new Makefile.
+
+ o ISC Streams Pipes
+
+ The old path to the pipes on ISC's R4 /tmp/.X11-unix has changed to
+ /dev/X/ISCCONN. For compatibility reasons on ISC, the pipes in the new
+ directory will be linked to a file inside the old. This will normally
+ be a hard link, so it can't go across filesystems. On ISC Version 4.x
+ this is now allowed. But you should use the new S5L on both filesystems.
+ ISC30 systems should take care that the two directories are on the same
+ FS. Else if you are using a ISC40 compiled binary, the Server could
+ maybe abort due to a SIGSYS. We tried to catch this signal, so if it
+ dumps please send me a note.
+
+ o Warnings you may see:
+
+ o Since 3.2A, you could see a warning from pre X11R6.3 clients.
+
+ Warning: Unable to load any usable fontset
+
+ The case are the new gzipped fonts, but the Warning isn't serious.
+
+ o If you start a server you may see the following message:
+
+ _XSERVTransOpen: transport open failed for named/enigma:0
+ _XSERVTransMakeAllCOTSServerListeners: failed to open listener for named
+
+ This message either isn't critical. Interactive doesn't support
+ this kind of connection.
+
+11. Acknowledgements
+
+All thanks should go to the members of the XFree86 Team for their great work
+and the X Consortium for their Public Release of X11R6, as to all who con-
+tribute to this excellent piece of free software.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/isc.sgml,v 3.22 1999/08/28 10:43:33 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.33 1999/08/28 11:22:57 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.mouse b/xc/programs/Xserver/hw/xfree86/doc/README.mouse
new file mode 100644
index 000000000..49ace5b16
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.mouse
@@ -0,0 +1,614 @@
+ Mouse Support in XFree86
+
+ Kazutaka Yokota
+
+ 4 July 1999
+
+1. Introduction
+
+This document describes mouse support in XFree86 3.9.16.
+
+Mouse configuration has often been mysterious task for novice users. How-
+ever, once you learn several basics, it is straightforward to write the mouse
+"InputDevice" section in the XF86Config file by hand.
+
+2. Supported Hardware
+
+The XFree86 X server supports three classes of mice: serial, bus and PS/2
+mice.
+
+ Serial mouse
+ The serial mouse has been the most popular pointing device for
+ PCs. There have been numerous serial mouse models from a number
+ of manufactures. Despite the wide range of variations, there
+ have been relatively few protocols (data format) with which the
+ serial mouse talks to the host computer.
+
+ The modern serial mouse conforms to the PnP COM device specifica-
+ tion so that the host computer can automatically detect the mouse
+ and load an appropriate driver. The XFree86 X server supports
+ this specification and can detect popular PnP serial mouse models
+ on most platforms.
+
+ Bus mouse
+ The bus mouse connects to a dedicated interface card in an expan-
+ sion slot. Some video cards, notably those from ATI, and inte-
+ grated I/O cards may also have a bus mouse connector. Some bus
+ mice are known as `InPort mouse'.
+
+ Note that some mouse manufactures have sold a package including a
+ serial mouse and a serial interface card. Don't confuse this
+ type of products with the genuine bus mouse.
+
+ PS/2 mouse
+ They are sometimes called `Mouse-port mouse'. The PS/2 mouse is
+ becoming increasingly common and popular.
+
+ The PS/2 mouse is an intelligent device and may have more than
+ three buttons and a wheel or a roller. The PS/2 mouse is usually
+ compatible with the original PS/2 mouse from IBM immediately
+ after power up. The PS/2 mouse with additional features requires
+ a specialized initialization procedure to enable these features.
+ Without proper initialization, it behaves as though it were an
+ ordinary two or three button mouse.
+
+Many mice nowadays can be used both as a serial mouse and as a PS/2 mouse.
+They has a logic to distinguish which interface it is connected to. However,
+the mouse which is not marketed as compatible with both serial and PS/2 mouse
+interface lacks this logic and cannot be used in such a way, even if you can
+find an appropriate adapter with which you can connect the PS/2 mouse to a
+serial port or visa versa.
+
+XFree86 supports the mouse with a wheel, a roller or a knob. Its action is
+detected as the Z (third) axis motion of the mouse. As the X server or
+clients normally do not use the Z axis movement of the pointing device, a
+configuration option, "ZAxisMapping", is provided to assign the Z axis move-
+ment to another axis or a pair of buttons (see below).
+
+3. OS Support for Mice
+
+3.1 Summary of Supported Mouse Protocol Types
+
+ Protocol Types
+ serial PnP BusMouse PS/2 Extended PS/2
+ OS platforms protocols serial protocol protocol protocols
+ "Auto" "BusMouse" "PS/2" "xxxPS/2"
+ --------------------------------------------------------------------
+ BSD/OS Ok ? ? ? ?
+ FreeBSD Ok Ok Ok Ok SP*1
+ FreeBSD(98) Ok ? Ok NA NA
+ Interactive Unix Ok NA ?*1 ?*1 NA
+ Linux Ok Ok Ok Ok Ok
+ Linux/98 Ok ? Ok NA NA
+ LynxOS Ok NA Ok Ok NA
+ NetBSD Ok Ok Ok SP*1 SP*1
+ NetBSD/pc98 Ok ? Ok NA NA
+ OpenBSD Ok Ok Ok Ok*1 OK*1
+ OS/2 SP*2 SP*2 SP*2 SP*2 SP*2
+ SCO Ok ? SP*1 SP*1 NA
+ Solaris 2.x Ok NA*1 ?*1 Ok Ok
+ SVR4 Ok NA*1 SP*1 SP*1 NA
+ PANIX Ok ? SP*1 SP*1 NA
+
+ Ok: support is available, NA: not available, ?: untested or unknown.
+ SP: support is available in a different form
+
+ *1 Refer to the following sections for details.
+ *2 XFree86/OS2 will support any type of mouse that the OS supports,
+ whether it is serial, bus mouse, or PnP type.
+
+3.2 BSD/OS
+
+No testing has been done with BSD/OS.
+
+3.3 FreeBSD
+
+FreeBSD supports the "SysMouse" protocol which must be specified when the
+moused daemon is running in versions 2.2.1 or later.
+
+FreeBSD versions 2.2.6 or later include the kernel-level support for extended
+PS/2 mouse protocols and there is no need to specify the exact protocol name
+to the X server. Instead specify the "PS/2" or "Auto" protocol and the X
+server will automatically make use of the kernel-level support.
+
+In fact, "Auto" protocol support is really efficient in these versions. You
+may always specify "Auto" to any mouse, serial, bus or PS/2, unless the mouse
+is an old serial model which doesn't support PnP.
+
+FreeBSD versions 2.2.5 or earlier do not support extended PS/2 mouse proto-
+cols ("xxxPS/2"). Always specify the "PS/2" protocol for any PS/2 mouse in
+these versions regardless of the brand of the mouse.
+
+3.4 FreeBSD(98)
+
+The PS/2 mouse is not supported.
+
+3.5 Interactive Unix
+
+The PnP serial mouse support (the "Auto" protocol) is not supported for the
+moment.
+
+The bus mouse and PS/2 mouse should be supported by using the appropriate
+device drivers. Use /dev/mouse for the "BusMouse" protocol and /dev/kdmouse
+for the "PS/2" protocol. These protocols are untested but may work. Please
+send success/failure reports to <michael.rohleder@stadt-frankfurt.de>.
+
+3.6 Linux
+
+All protocol types should work.
+
+3.7 Linux/98
+
+The PS/2 mouse is not supported.
+
+3.8 LynxOS
+
+The PnP serial mouse support (the "Auto" protocol) is disabled in LynxOS,
+because of limited TTY device driver functionality.
+
+3.9 NetBSD
+
+NetBSD 1.3.x and former does not support extended PS/2 mouse protocols
+("xxxPS/2"). The PS/2 mouse device driver /dev/pms emulates the bus mouse.
+Therefore, you should always specify the "BusMouse" protocol for any PS/2
+mouse regardless of the brand of the mouse.
+
+The "wsmouse" protocol introduced in NetBSD 1.4 along with the wscons console
+driver is supported. You need to run binaries compiled on NetBSD 1.4 to have
+support for it though. Use "/dev/wsmouse0" for the device. Refer to the
+wsmouse(4) manual page for kernel configuration informations.
+
+3.10 NetBSD/pc98
+
+The PS/2 mouse is not supported.
+
+3.11 OpenBSD
+
+The raw PS/2 mouse device driver /dev/psm0 uses the raw PS/2 mouse protocol.
+
+OpenBSD 2.2 and earlier does not support extended PS/2 mouse protocols
+("xxxPS/2") . Therefore, you should specify the "PS/2" protocol for any PS/2
+mouse regardless of the brand of the mouse.
+
+OpenBSD 2.3 and later support all extended PS/2 mouse protocols. You can
+select the "Auto" protocol for PnP PS/2 mice or any specific extended
+("xxxPS/2") protocol for non PnP mice.
+
+There is also a cooked PS/2 mouse device driver /dev/pms0 which emulates the
+bus mouse. Specify the "BusMouse" protocol for any PS/2 mouse regardless of
+the brand of the mouse when using this device.
+
+3.12 OS/2
+
+XFree86/OS2 always uses the native mouse driver of the operating system and
+will support any type of pointer that the OS supports, whether it is serial,
+bus mouse, or PnP type. If the mouse works under Presentation Manager, it
+will also work under XFree86/OS2.
+
+Always specify "OSMouse" as the protocol type.
+
+3.13 SCO
+
+The bus and PS/2 mouse are supported with the "OSMouse" protocol type.
+
+The "OSMouse" may also be used with the serial mouse.
+
+3.14 Solaris
+
+Testing has been done with Solaris 2.5.1 and 2.6. Logitech and Microsoft bus
+mice have not been tested, but might work with the /dev/logi and /dev/msm
+devices. Standard 2 and 3 button PS/2 mice work with the "PS/2" protocol
+type and the /dev/kdmouse device. The PnP serial mouse support (the "Auto"
+protocol) has been tested and does not work.
+
+3.15 SVR4
+
+The bus and PS/2 mouse may be supported with the "Xqueue" protocol type.
+
+The "Xqueue" may also be used with the serial mouse.
+
+The PnP serial mouse support (the "Auto" protocol) is not tested.
+
+3.16 PANIX
+
+The PC/AT version of PANIX supports the bus and PS/2 mouse with the "Xqueue"
+protocol type. The PC-98 version of PANIX supports the bus mouse with the
+"Xqueue" protocol type.
+
+4. Configuring Your Mouse
+
+Before using the xf86config program to set up mouse configuration, you must
+identify the interface type, the device name and the protocol type of your
+mouse. Blindly trying every possible combination of mouse settings will lead
+you nowhere.
+
+The first thing you need to know is the interface type of the mouse you are
+going to use. It can be determined by looking at the connector of the mouse.
+The serial mouse has a D-Sub female 9- or 25-pin connector. The bus mice
+have either a D-Sub male 9-pin connector or a round DIN 9-pin connector. The
+PS/2 mouse is equipped with a small, round DIN 6-pin connector. Some mice
+come with adapters with which the connector can be converted to another. If
+you are to use such an adapter, remember that the connector at the very end
+of the mouse/adapter pair is what matters.
+
+The next thing to decide is a device node to use for the given interface.
+For the bus and PS/2 mice, there is little choice; your OS most possibly
+offers just one device node each for the bus mouse and PS/2 mouse. There may
+be more than one serial port to which the serial mouse can be attached.
+
+The next step is to guess the appropriate protocol type for the mouse. The X
+server may be able to select a protocol type for the given mouse automati-
+cally in some cases. Otherwise, the user has to choose one manually. Follow
+the guidelines below.
+
+ Bus mouse
+ The bus and InPort mice always use "BusMouse" protocol regardless
+ of the brand of the mouse.
+
+ Some OSs may allow you to specify "Auto" as the protocol type for
+ the bus mouse.
+
+ PS/2 mouse
+ The "PS/2" protocol should always be tried first for the PS/2
+ mouse regardless of the brand of the mouse. Any PS/2 mouse
+ should work with this protocol type, although wheels and other
+ additional features are unavailable in the X server.
+
+ After verifying the mouse works with this protocol, you may
+ choose to specify one of "xxxPS/2" protocols so that extra fea-
+ tures are made available in the X server. However, support for
+ these PS/2 mice assumes certain behavior of the underlying OS and
+ may not always work as expected. Support for some PS/2 mouse
+ models may be disabled all together for some OS platforms for
+ this reason.
+
+ Some OSs may allow you to specify "Auto" as the protocol type for
+ the PS/2 mouse and the X server will automatically adjust itself.
+
+ Serial mouse
+ The XFree86 server supports a wide range of mice, both old and
+ new. If your mouse is of a relatively new model, it may conform
+ to the PnP COM device specification and the X server may be able
+ to detect an appropriate protocol type for the mouse automati-
+ cally.
+
+ Specify "Auto" as the protocol type and start the X server. If
+ the mouse is not a PnP mouse, or the X server cannot determine a
+ suitable protocol type, the server will print the following error
+ message and abort.
+
+ <mousename>: cannot determine the mouse protocol
+
+ If the X server generates the above error message, you need to
+ manually specify a protocol type for your mouse. Choose one from
+ the following list:
+
+ o GlidePoint
+
+ o IntelliMouse
+
+ o Logictech
+
+ o Microsoft
+
+ o MMHittab
+
+ o MMSeries
+
+ o MouseMan
+
+ o MouseSystems
+
+ o ThinkingMouse
+
+ When you choose, keep in mind the following rule of thumb:
+
+ 1. "Logitech" protocol is for old serial mouse models from
+ Logitech. Modern Logitech mice use either "MouseMan" or
+ "Microsoft" protocol.
+
+ 2. Most 2-button serial mice support the "Microsoft" protocol.
+
+ 3. 3-button serial mice may work with the "Mousesystems" pro-
+ tocol. If it doesn't, it may work instead with the
+ "Microsoft" protocol although the third (middle) button
+ won't function. 3-button serial mice may also work with
+ the "Mouseman" protocol under which the third button may
+ function as expected.
+
+ 4. 3-button serial mice may have a small switch at the bottom
+ of the mouse to choose between ``MS'' and ``PC'', or ``2''
+ and ``3''. ``MS'' or ``2'' usually mean the "Microsoft"
+ protocol. ``PC'' or ``3'' will choose the "MouseSystems"
+ protocol.
+
+ 5. If the serial mouse has a roller or a wheel, it may be com-
+ patible with the "IntelliMouse" protocol.
+
+ 6. If the serial mouse has a roller or a wheel and it doesn't
+ work with the "IntelliMouse" protocol, you have to use it
+ as a regular 2- or 3-button serial mouse.
+
+ If the "Auto" protocol is specified and the mouse seems working,
+ but you find that not all features of the mouse is available,
+ that is because the X server does not have native support for
+ that model of mouse and is using a ``compatible'' protocol
+ according to PnP information.
+
+ If you suspect this is the case with your mouse, please send a
+ report to <XFree86@XFree86.Org>.
+
+ Standardized protocols
+ Mouse device drivers in your OS may use the standardized protocol
+ regardless of the model or the class of the mouse. For example,
+ SVR4 systems may support "Xqueue" protocol. In FreeBSD the sys-
+ tem mouse device /dev/sysmouse uses the "SysMouse" protocol.
+ Please refer to the OS support section of this file for more
+ information.
+
+5. XF86Config Options
+
+The old Pointer section has been replaced by a more general InputDevice sec-
+tion. The following is a minimal example of an InputDevice section for a
+mouse:
+
+ Section "InputDevice"
+ Identifier "Mouse 1"
+ Driver "mouse"
+ Option "Device" "/dev/mouse"
+ Option "Protocol" "Auto"
+ EndSection
+
+The mouse driver supports the following config file options:
+
+5.1 Buttons
+
+This option tells the X server the number of buttons on the mouse. Currently
+there is no reliable way to automatically detect the correct number. This
+option is the only means for the X server to obtain it. The default value is
+three.
+
+ Option "Buttons" "N"
+
+5.2 ZAxisMappping
+
+This option maps the Z axis (wheel) motion to a pair of buttons or to another
+axis.
+
+ Option "ZAxisMapping" "X"
+ Option "ZAxisMapping" "Y"
+ Option "ZAxisMapping" "N M"
+
+The first example will map the Z axis motion to the X axis motion. Whenever
+the user moves the wheel/roller, its movement is reported as the X axis
+motion. When the wheel/roller stays still, the real X axis motion is
+reported as is. The last example will map negative Z axis motion to the but-
+ton N and positive Z axis motion to the button M. If this option is used and
+the buttons N or M actually exists in the mouse, their actions won't be
+detected by the X server.
+
+5.3 Resolution
+
+The following option will set the mouse device resolution to N counts per
+inch, if possible:
+
+ Option "Resolution" "N"
+
+Not all mice and OSs can support this option.
+
+6. Mouse Gallery
+
+In all of the examples below, it is assumed that /dev/mouse is a link to the
+appropriate serial port or PS/2 mouse device.
+
+6.1 MS IntelliMouse (serial, PS/2)
+
+The wheel movement is recognized as the Z axis motion. This behavior is not
+compatible with XFree86 versions prior to 3.3.2, but is more consistent with
+the support for other mice with wheels or rollers. If you want to make the
+wheel behave like before, you can use the "ZAxisMapping" option as described
+above.
+
+IntelliMouse supports the PnP COM device specification.
+
+To use this mouse as a serial device:
+
+ Option "Protocol" "Auto"
+
+or:
+
+ Option "Protocol" "IntelliMouse"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "IMPS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the wheel won't work in this case):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.2 Kensington Thinking Mouse (serial, PS/2)
+
+This mouse has four buttons. Thinking Mouse supports the PnP COM device
+specification.
+
+To use this mouse as a serial device:
+
+ Option "Protocol" "Auto"
+
+or:
+
+ Option "Protocol" "ThinkingMouse"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "ThinkingMousePS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the third and the fourth buttons act as though they were the
+first and the second buttons):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.3 Genius NetScroll (PS/2)
+
+This mouse has four buttons and a roller. The roller movement is recognized
+as the Z axis motion.
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "NetScrollPS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the roller and the fourth button won't work):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.4 Genius NetMouse and NetMouse Pro (serial, PS/2)
+
+These mice have a "magic button" which is used like a wheel or a roller. The
+"magic button" action is recognized as the Z axis motion. NetMouse Pro is
+identical to NetMouse except that it has the third button on the left hand
+side.
+
+NetMouse and NetMouse Pro support the PnP COM device specification. When
+used as a serial mouse, they are compatible with MS IntelliMouse.
+
+To use these mice as a serial device:
+
+ Option "Protocol" "Auto"
+
+or:
+
+ Option "Protocol" "IntelliMouse"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "NetMousePS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the "magic button" and the third button won't work):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.5 ALPS GlidePoint (serial, PS/2)
+
+The serial version of this pad device has been supported since XFree86 3.2.
+`Tapping' action is interpreted as the fourth button press. (IMHO, the
+fourth button of GlidePoint should always be mapped to the first button in
+order to make this pad behave like the other pad products.)
+
+To use this pad as a serial device:
+
+ Option "Protocol" "GlidePoint"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "GlidePointPS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization:
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.6 ASCII MieMouse (serial, PS/2)
+
+This mouse appears to be OEM from Genius. Although its shape is quite dif-
+ferent, it works like Genius NetMouse Pro. This mouse has a "knob" which is
+used like a wheel or a roller. The "knob" action is recognized as the Z axis
+motion.
+
+MieMouse supports the PnP COM device specification. When used as a serial
+mouse, it is compatible with MS IntelliMouse.
+
+To use this mouse as a serial device:
+
+ Option "Protocol" "Auto"
+
+or:
+
+ Option "Protocol" "IntelliMouse"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "NetMousePS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the knob and the third button won't work):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+6.7 Logitech MouseMan+ and FirstMouse+ (serial, PS/2)
+
+MouseMan+ has two buttons on top, one side button and a roller. FirstMouse+
+has two buttons and a roller. The roller movement is recognized as the Z
+axis motion. The roller also acts as the third button. The side button is
+recognized as the fourth button.
+
+MouseMan+ and FirstMouse+ support the PnP COM device specification. They
+have MS IntelliMouse compatible mode when used as a serial mouse.
+
+To use these mice as a serial device:
+
+ Option "Protocol" "Auto"
+
+or:
+
+ Option "Protocol" "IntelliMouse"
+
+To use this mouse as the PS/2 device and the OS supports PS/2 mouse initial-
+ization:
+
+ Option "Protocol" "MouseManPlusPS/2"
+
+To use this mouse as the PS/2 device but the OS does not support PS/2 mouse
+initialization (the wheel and the fourth button won't work):
+
+ Option "Protocol" "PS/2"
+
+To use this mouse as the PS/2 device and the OS supports automatic PS/2 mouse
+detection:
+
+ Option "Protocol" "Auto"
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.7 1999/08/28 10:43:34 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.5 1999/08/28 11:22:58 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.neomagic b/xc/programs/Xserver/hw/xfree86/doc/README.neomagic
new file mode 100644
index 000000000..6eab26152
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.neomagic
@@ -0,0 +1,198 @@
+ Information for NeoMagic Users NeoMagic Driver Version 2.0.0
+
+ The XFree86 Project Inc.
+
+ 4 November 1998
+
+1. Supported hardware
+
+ o NeoMagic 2200 (MagicMedia256AV)
+
+ o NeoMagic 2160 (MagicGraph128XD)
+
+ o NeoMagic 2097 (MagicGraph128ZV+)
+
+ o NeoMagic 2093 (MagicGraph128ZV)
+
+ o NeoMagic 2090 (MagicGraph128V)
+
+ o NeoMagic 2070 (MagicGraph128)
+
+2. Features
+
+ o Full support for internal flat panels, external monitors, and simulta-
+ neous internal/external displays.
+
+ o Complete set of Panel Resolutions supported including stretch and cen-
+ tering modes for running lower resolutions on fixed resolution panels.
+
+ o Support for depths of 8, 15, 16 and 24 bits per pixel.
+
+ o Hardware Cursor support to reduce sprite flicker.
+
+ o Hardware accelerated drawing engine for 8, 15 and 16 bit per pixel
+ modes.
+
+ o Fully programmable clocks supported in external monitor only mode.
+
+ o Robust text mode restore for VT switching.
+
+3. Technical Notes
+
+ o Enable both internal "intern_disp" and external "extern_disp" options
+ to get simultaneous panel/CRT support.
+
+4. Reported Working Laptops
+
+ o Acer Travelmate 7120T
+
+ o Acer Extensa 367, 367D & 710TE
+
+ o Actebis TN559Pro
+
+ o Asus P6300
+
+ o CTX EzBook 700 & 77X series
+
+ o Compaq Presario 1080, 1210, 1215, 1220, 1610, 1611, 1620, 1621 & 1640
+
+ o Dell Inspiron 3000 & 3200
+
+ o Dell Latitude CP, CPi, LM & XPi
+
+ o Digital VP HiNote 575, 703, 717 & 720
+
+ o FIC DESIGNote 5550
+
+ o Fujitsu LifeBook 420D & 656Tx
+
+ o Gateway 2000 Solo 2300XL, 2500LS & 5150
+
+ o Highscreen XD Advance II 21,1" TFT
+
+ o Hi-Grade Notino AS6000 pII/266Mhz
+
+ o Hitachi VisionBook Plus 5000
+
+ o HP Omnibook 800, 3000, 3100, 4100 & Sojourn
+
+ o IBM ThinkPad 380D, 380E, 380ED, 380XD, 385XD, 560X & 600
+
+ o LEO DESIGNote 5550
+
+ o Micron Transport XKE
+
+ o NEC Ready 330T
+
+ o NEC Versa 2780 MT, 5060X, 5080X, 6060 & 6230
+
+ o NEC MB12C/UV (mobio NX)
+
+ o OPTI Phoenix
+
+ o Panasonic CF_S21, CF-25 MKIII & CF-35
+
+ o Quantex H-1330
+
+ o Sceptre 4500
+
+ o SEH DESIGNote 5550
+
+ o Siemens Nixdorf Scenic 510
+
+ o Sony PCG-505, PCG-705, PCG-717, PCG-719 & PCG-731
+
+ o TI Extensa 660 CDT
+
+ o Toshiba Libretto 100CT
+
+ o Toshiba Protege SS3000
+
+ o UMAX 520T
+
+5. Configuration
+
+The driver auto-detects all device info included memory size, so use the fol-
+lowing device section in your XF86Config file:
+
+ Section "Device"
+ Identifier "NeoMagic"
+ EndSection
+
+or let xf86config or XF86Setup do this for you.
+
+But if you have problems with auto-detection, you can specify:
+
+ VideoRam - in kilobytes
+ DacSpeed - in MHz
+ MemBase - physical address of the linear framebuffer
+ MMIOBase - physical address of the memory mapped IO registers
+
+6. Driver Options
+
+ o "linear" - linear framebuffer mode (default)
+
+ o "no_linear" - banked framebuffer mode
+
+ o "no_accel" - software rendering only
+
+ o "hw_cursor" - hardware cursor requested (default)
+
+ o "sw_cursor" - software cursor only
+
+ o "mmio" - use I/O space via memory map (default)
+
+ o "no_mmio" - use I/O space directly
+
+ o "intern_disp" - enable internal display (default)
+
+ o "extern_disp" - enable external display
+
+ o "no_stretch" - disable stretching of lower resolution modes on panel
+
+ o "lcd_center" - center lower resolution modes on panel
+
+NOTE: Stretching of panel image is on by default for lower panel resolutions.
+
+Options useful for special lcd mode setting (should not be needed):
+
+ o "prog_lcd_mode_regs" - set special lcd mode registers (2070
+ default)
+
+ o "no_prog_lcd_mode_regs" - don't set lcd mode registers (non-2070
+ default)
+
+ o "prog_lcd_mode_stretch" - force lcd mode regs if stretching is
+ enabled
+
+ o "no_prog_lcd_mode_stretch" - no lcd mode regs if stretching (default)
+
+Option for subnotebooks and other laptops with uncommon size panels:
+
+ o "override_validate_mode" - disable LCD mode checking
+
+WARNING: Disabling mode checking will allow for invalid modes that could dam-
+age your LCD.
+
+7. Known Limitations
+
+ o External monitor support on the NM2070.
+
+ o Banked, or no_linear mode on the NM2070.
+
+ o Horizontal centering for lower than panel resolution on NM2070.
+
+8. Authors
+
+Jens Owen jens@precisioninsight.com Kevin E. Martin kevin@precisionin-
+sight.com
+
+This driver was donated to The XFree86 Project by Precision Insight, Inc.
+Cedar Park, TX USA
+
+http://www.precisioninsight.com
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/neomagic.sgml,v 1.1 1999/08/23 06:59:39 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.neomagic,v 1.1 1999/08/23 07:03:53 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.rendition b/xc/programs/Xserver/hw/xfree86/doc/README.rendition
new file mode 100644
index 000000000..288b3043a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.rendition
@@ -0,0 +1,104 @@
+ Information for Rendition Users
+
+ The XFree86 Project Inc.
+
+ 1 August 1999
+
+1. Supported hardware
+
+All cards based on the V1000 or the V2x00 should be supported. The server was
+tested on a miroCRYSTAL VRX (V1000), Intergraph Intense-100 3D (V1000), Dia-
+mond Stealth II S220 (V2100), Hercules Thriller3D (V2200) and Innovision War-
+rior3D (V2200).
+
+2. Important notices
+
+V1000 cards can only work as primary display card due to hardware limita-
+tions.
+
+Some V1000-based video cards are known to lock up the computer if you have
+write-combine activated. Disabling it removes the problem. Look for settings
+in the motherboards BIOS and disable ALL settings that has to do with write-
+combine (usually called USWC or just WC for short).
+
+The "chipset" option is now implemented and honored when used. Unfortunately
+some legacy-code in the driver is preventing it from working with any cards
+but the primary display card.
+
+If you have problems with hardware cursor use the "sw_cursor" option to
+revert back to software cursor.
+
+3. Features
+
+ o Unaccelerated
+
+ o Hardware cursor
+
+ o Supported color depths
+
+ o 8 bits per pixel (256 pseudo colour)
+
+ o 15 bits per pixel (actually 16-bits with RGB-weight 555, 32768 col-
+ ors)
+
+ o 16 bits per pixel (high colour, RGB-weight 565, 65536 colors)
+
+ o 32 bits per pixel (true colour, sparse 24bit, 16M colors)
+
+4. XF86Config Option
+
+ Option "sw_cursor"
+ Disables use of the hardware cursor.
+
+ Option "overclock_mem"
+ Run the memory at a higher clock. Useful on some cards with dis-
+ play glitches at higher resolutions. But adds the risk to damage
+ the hardware. Use with caution.
+
+ DacSpeed "MHz"
+ Set custom ramdac limit. We have currently no way of knowing if
+ the v2x00 chip is a v2100 (170MHz) or v2200 (203MHz and 230MHz)
+ so we assume the lowest. Use this option to manually override the
+ value.
+
+5. News in this release
+
+ o Hardware-cursor on V2x00 cards.
+
+6. Major fixes in this release
+
+ o Depth 15 works on V1000 cards.
+
+ o Bandwidth limits are now included. Can be overridden with DacSpeed
+ option.
+
+7. Known problems in current driver
+
+ o Displays with depth 15 ("-bpp 15" or "-bpp 16 -weight 555") has problems
+ on V2x00 cards.
+
+ o Switching from display to VC and back to display can lock up V2x00
+ cards.
+
+ o When scrolling the virtual display on a V1000 card parts of the screen
+ will become distorted. Problem disappears when you continue moving
+ around. V2x00 does not exhibit this problem. Probably a bug in the
+ driver rather than a limitation of the chip.
+
+ o Option "chipset" is honored. Unfortunately the driver still has problems
+ and will only work if the rendition card is the primary display card in
+ the system.
+
+ o If an incorrect mode was given, the server does not restore console to
+ correct state.
+
+8. Work in progress (not finished in time for release)
+
+ o Acceleration for V1000 chipset. Some bugs to clear out.
+
+ o Acceleration for V2100 and V2200 chipset. Not ready for general use.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/rendition.sgml,v 1.3 1999/08/28 10:43:34 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.4 1999/08/28 11:22:58 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.s3virge b/xc/programs/Xserver/hw/xfree86/doc/README.s3virge
new file mode 100644
index 000000000..af3cec3ef
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.s3virge
@@ -0,0 +1,65 @@
+ Information for S3 ViRGE Users
+
+ The XFree86 Project Inc.
+
+ 10 Jul 1999
+
+1. Supported hardware
+
+The s3virge driver in XFree86 3.9.15 supports the S3 ViRGE, ViRGE DX, GX, MX,
+MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, mak-
+ing them the most stable to date. This release has improved support for 24
+bit color depths and resolves all the known issues with Netscape and other
+applications supporting 24 bit color.
+
+This driver is moderately stable, however please use caution with any new
+install. Please report any problems to <XFree86@Xfree86.org> using the
+appropriate bug report sheet.
+
+2. Features:
+
+ o Fully accelerated support for S3 ViRGE family video adapters
+
+ o uses linear frame buffer
+
+ o supports resolutions up to 2048x2048
+
+ o supports color depths of 8, 15, 16, 24.
+
+ o full use of video card memory for acceleration caching when visible
+ framebuffer leaves extra memory
+
+3. Configuration:
+
+The driver auto-detects RAM size, RAMDAC and ClockChip. Do not bother putting
+these in your "Device" section.
+
+4. Documentation:
+
+The driver has several supported options which are documented in the s3virge
+man page. Please refer to it for additional details about XF86Config
+options.
+
+5. Support:
+
+For support with XFree86 video drivers please refer to our web site at
+XFree86 <URL:http://www.XFree86.org>. The web page has a FAQ and bug report-
+ing form available. For problems not addressed in the web page please con-
+tact our support email address <XFree86@Xfree86.org>
+
+6. Authors
+
+ o Mark Vojkovich <mvojkovi@ucsd.edu>
+
+ o Sebastien Marineau
+
+ o Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
+
+ o Matt Grossman <mattg@oz.net>
+
+ o Kevin Brosius <Cobra@compuserve.com>
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.2 1999/07/10 12:17:25 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.2 1999/07/10 14:42:51 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.trident b/xc/programs/Xserver/hw/xfree86/doc/README.trident
new file mode 100644
index 000000000..b123ae2a8
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.trident
@@ -0,0 +1,180 @@
+ Information for Trident Chipset Users
+
+ The XFree86 Project, Inc.
+
+ June 25 1999
+
+1. Supported chipsets
+
+The Trident driver has undergone some slight work for XFree86 3.3.3. Because
+of this work, all of the Trident SVGA chipsets, except the very first one,
+are supported by both the color and monochrome servers.
+
+ 8800CS 8200LX 8900B 8900C 8900CL/D 9000 9000i 9100B 9200CXr 9320LCD
+ 9400CXi 9420 9420DGi 9430DGi 9440AGi 9660XGi 9680 ProVidia9682 Pro-
+ Vidia9685 Cyber9382 Cyber9385 Cyber9385-1 Cyber9388 Cyber9397
+ Cyber9520 Cyber9525 3DImage975(PCI) 3DImage975(AGP) 3DImage985(AGP)
+ Blade3D CyberBlade
+
+It must be noted that the 9000i chipset is treated as a 9000 by the server.
+Additionally the 9100B is treated as a Trident 8900CL. Therefore it is equiv-
+alent to putting `Chipset "tvga8900cl"' or `Chipset "tvga9000"' in the
+XF86Config file. Also, note that the 9000i, 9100B have not been tested with
+the server, but should work in this way according to the chipset documenta-
+tion.
+
+ NOTES:
+
+ o The chipset keyword changed in XFree86 v3.3.2 and now you no longer
+ specify 'tgui96xx' as the generic keyword, but you actually specify your
+ chip. i.e. Chipset 'tgui9685' will set a ProVidia9685 chip.
+
+ o The Cyber9388/9397, 3DImage975 and 3DImage985 cards are fixed in
+ XFree86 v3.3.3, these chipsets have some acceleration now too. This
+ acceleration has been disabled by default for the Cyber9388/9397 because
+ there have been problems, but it can be re-enabled with the "accel"
+ option (see below).
+
+ o 24bpp is all drivers remains unaccelerated, this will change in a
+ future version, although 32bpp acceleration is supported for all TGUI
+ based chipset except the 9440 which doesn't have the capability.
+
+ o 16bpp is now supported for the Cyber9320 chipset.
+
+ Option "nolinear"
+ Turn off linear mapping
+
+ Option "linear"
+ Force linear mapping. Use this if you have a non-PCI card
+ and require 16bpp support. Note: ISA cards can only access
+ up to 16MB of memory, so be sure you have less than this or
+ it could cause a system hang.
+
+ MemBase 0x???????
+ This option may be used to specify the start address of the
+ linear frame buffer. By default for VLBus/EISA cards it is
+ at 60MB. For the 8900CL/D, it is at 15MB.
+
+ Option "no_mmio"
+ This option turns off Memory Mapped IO support. MMIO is
+ enabled by default when acceleration is enabled. Accelera-
+ tion doesn't work well when MMIO is disabled.
+
+ Option "tgui_pci_read_on"
+ Turn on PCI burst read mode.
+
+ Option "tgui_pci_write_on"
+ Turn on PCI burst write mode.
+
+ Option "pci_burst_on"
+ Turn on PCI burst (read and write)
+
+ Option "pci_burst_off"
+ Turn off PCI burst (read and write)
+
+ NOTE: PCI burst modes are now OFF by default for TGUI9440
+ cards because it often upsets its Graphics Accelerator. It
+ can be turned it back on as may improve performance. PCI
+ burst modes are ON by default for all other PCI/AGP cards.
+
+ ClockChip "tgui"
+ Turn on programmable clocks. This is the default for TGUIs.
+
+ Option "no_program_clocks"
+ Turn off programmable clock. Use fixed VGA clocks only.
+ Useful for fixed frequency monitors - usually used for VGA
+ monitors - not SVGA.
+
+ Option "noaccel"
+ Turn off XAA acceleration.
+
+ Option "accel"
+ Enable acceleration for the Cyber9388/9397.
+
+ Option "xaa_no_color_exp"
+ Disable color expansion.
+
+ Option "no_stretch"
+ Disable LCD stretching on Cyber 938x based chips.
+
+ Option "lcd_center"
+ Enable LCD centering on Cyber 938x based chips.
+
+ Option "cyber_shadow"
+ Enable Shadow registers, might be needed for some Cyber
+ chipsets. (laptop machines)
+
+ Option "tgui_mclk_66"
+ Pushes the Memory Clock from its default value to 66MHz.
+ Increases graphics speed dramatically, but use entirely at
+ your own risk, as it may damage the video card. If snow
+ appears, disable. Only tested on the 9440.
+
+The original Trident chipset, 8800BR, cannot be supported as an SVGA chipset
+by either the color or monochrome servers. The chip is supported, however,
+by the ``generic'' driver for the monochrome server.
+
+2. Special considerations for 512k boards
+
+There are no longer any special considerations for 512k Trident boards. The
+driver is now configured so that they can use modes with normal timings. The
+available pixel clocks are halved compared with those specified on the Clocks
+line
+
+Be aware that older Trident chipsets support a maximum clock of 65Mhz. Hence
+the best actual clock available to the color server is 32.5Mhz. This means,
+in broad terms, that the color server will require an interlaced mode to be
+defined for resolutions above 640x480. Newer chipsets (8900CL, 9000, 9000i,
+9100B, 9200CX and 9420) support up to 16 clocks, and can support much higher
+clocks, which will allow 800x600 modes, non-interlaced.
+
+3. Additional Notes
+
+We have had reports of the server failing to detect the amount of installed
+memory and the correct dot-clocks on older TVGA8900 boards. If the server
+fails to detect the correct amount of memory, use the "Videoram" keyword in
+your XF86Config file to specify it. (e.g. Videoram 512 or Videoram 1024).
+If the server has problems detecting the dot-clocks, try adding the following
+line to your XF86Config file:
+
+ Clocks 25 28 45 36 57 65 50 40
+
+This line gives the clock values provided by older Trident clock synthesizer
+chipsets. This also appears to be the standard first 8 clocks for the newer
+clock synthesizers, but you should have no problems on newer boards.
+
+Some newer Trident 8900B/C boards are apparently being built with the clock
+synthesizers used on the 9000 and 8900CL boards. If your board has a chip
+labeled "Trident TCK900x" ("x" has been seen as 2 or 4; there may be others),
+your board may actually have a 4th clock select bit. The 9002 has twelve
+distinct clocks (the other 4 are duplicates); the 9004 has 16 clocks (the
+same 12 as the 9002 + 4 others). If you see such a chip on a board with an
+8900B or 8900C, put the following line in the Device section of your XF86Con-
+fig file:
+
+ Option "16clocks"
+
+This will cause the same clock selection code as is used for the 8900CL to be
+used for the board.
+
+While developing the Trident driver, an interesting and perturbing hardware
+phenomenon was discovered. When using the default board jumper configura-
+tion, dot-clocks above 57Mhz would frequently lock up the machine. There
+appear to be jumpers on all of the Trident boards that determine whether the
+board will operate in zero-wait-state mode on the ISA bus. Disabling the
+zero-wait-state mode via jumpers cured the lockups, but at the expense of
+performance. Whether or not a given system will experience this problem is
+likely a combination of (a) bus speed, (b) video memory speed, and (c) dot
+clock speed. So be prepared for this phenomenon to occur, and have the board
+documentation handy.
+
+NOTE: VLBus cards are also subject to the above. By specifying the Clocks in
+the XF86Config file, these lockups are overcome. But it may be worth checking
+wait states etc. on the card and in the BIOS setup.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/trident.sgml,v 3.24 1999/08/23 06:38:54 dawes Exp $
+
+ $XConsortium: trident.sgml /main/11 1996/10/28 04:24:08 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.trident,v 3.36 1999/08/23 07:03:53 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.tseng b/xc/programs/Xserver/hw/xfree86/doc/README.tseng
new file mode 100644
index 000000000..23f0d3274
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/README.tseng
@@ -0,0 +1,1017 @@
+ Information for Tseng Chipset Users
+
+ The XFree86 Project, Inc. Dirk H. Hohndel, Koen Gadeyne and others.
+
+ 03 Nov 1998
+
+1. Supported chipsets
+
+The Tseng chipsets supported by XFree86 are ET3000, ET4000, ET4000/W32 and
+ET6000. Accelerated features of the ET4000/W32, W32i, W32p and ET6000 are
+supported by the SVGA driver. For details about the separate accelerated 8bpp
+(=256 color) ET4000/W32 and ET6000 server, refer to README.W32.
+
+Note that you should NOT be using XF86_W32 unless XF86_SVGA doesn't work on
+your hardware. No further development is being done on the W32 server; all
+new efforts go into the SVGA server.
+
+Some ET4000W32 ISA cards are known NOT to work with the SVGA server in this
+version (XFree86 3.3.1): they hang the machine... Use the W32 server XF86_W32
+for these cards!
+
+2. Terminology
+
+In the rest of this document, "8bpp" is short for "8 bits per pixel", which
+means a 256-color mode. Similarly, 15bpp refers to 32768 colors, 16bpp to
+65536 colors , 24bpp to a "packed" 16 million color mode, and 32bpp to a
+"sparse" 16 million color mode (at 32bpp, only 24 of the 32 bits are actually
+used, hence the "sparse").
+
+15bpp is only used here to differentiate it from 16bpp, but they are both
+normally referred to as 16bpp. 15bpp is actually 16bpp with a 5-5-5 color
+weight (wasting one bit per pixel), while 16bpp is, well, 16bpp, with 5-6-5
+color weight.
+
+3. ET4000 driver features
+
+The SVGA driver for ET4000 chipsets supports all color depths (8, 15, 16, 24
+and 24 bpp) on most ET4000 chips starting with the ET4000W32i. The ET4000W32
+only supports 8bpp. Depending on the RAMDAC and the support code in the SVGA
+server, some cards may only support a few of these color depths, or even only
+8bpp.
+
+On W32i and W32p chips all color depths are supported on the supported RAM-
+DACs (currently ICS5341, STG170x and Chrontel CH8398). These modes are also
+accelerated.
+
+Some W32p board implementations are limited to 1 MB of video memory in linear
+memory modes. This is a hardware limitation that cannot be solved in the
+driver. Since XFree86 requires linear memory for 16/24/32 bpp modes, the use-
+fulness of these cards for highcolor and truecolor applications is severely
+limited (those modes mostly use a lot of video memory).
+
+In addition, those cards also don't support acceleration in linear mode.
+This is a design choice in the driver code: if acceleration were to be sup-
+ported in linear mode, you'd only be able to use 768 kb of video memory, and
+the driver code would be twice as complex.
+
+Cards with a RAMDAC that is not yet supported will be limited in a similar
+manner as the older cards, i.e. to a maximum pixel clock of 86 MHz, whilst
+they actually might be able to go up to 135 MHz. As a result, 1280x1024 modes
+will only be possible when using interlacing, and non-interlaced modes are
+limited to about 1024x768 at 75 Hz refresh.
+
+For a non-interlaced 1280x1024x(256 colors) at say 135-MHz on a W32-type
+card, you need a w32p (with its 16-bit RAMDAC bus) with a multiplexing RAMDAC
+so that the w32p sees only (135/2 = 67.5) MHz, not 135 MHz. This requires
+special code only provided for cards using the ICS5341 GENDAC, the STG170x or
+the CH8398. This code seems to work fine for most people, except, with the
+ICS5341, for a small band of frequencies around 90MHz.
+
+Linear memory mode (especially important for some DGA clients, like
+xf86quake) is supported on all ET4000W32i and ET4000W32p cards, but not on
+the ET4000W32. See the section on linear memory for more information. There
+are some important issues related to linear memory.
+
+For the higher color depths (16, 24 and 32 bpp), linear memory mode is
+REQUIRED. It is enabled by default in these modes. There is no need to spec-
+ify that in the XF86Config file. Please read the section on linear memory
+below: it contains some vital information on how to avoid serious problems.
+
+To force "banked" mode in 8bpp modes (where linear memory mode is the
+default), put the following in the Device section of your XF86Config:
+
+ Option "no_linear"
+
+Acceleration support is present, and enabled by default, for all W32 and
+ET6000 family chips. This is based on the new XFree86 acceleration interface
+(XAA).
+
+If you have problems with acceleration, acceleration can be disabled by
+putting the following in the Device section of your XF86Config:
+
+ Option "noaccel"
+
+On some PCI systems (i.e. only on the ET6000 and the ET4000W32p), accelera-
+tion may cause occasional font corruption. This is probably caused by a badly
+written system BIOS that ignores the fact that the Tseng PCI devices have
+their "non-prefetchable" attribute set. On such a BIOS, a PCI feature called
+"write combining" (or "byte merging") is enabled for the Tseng video card,
+although it is not permitted. Some systems allow you to manually enable or
+disable the Write Combining feature in the BIOS setup (sometimes abbreviated
+to WC). Make sure WC is disabled for the VGA memory aperture.
+
+If you experience font corruption on your system and are unable to manually
+disable WC in your BIOS, font acceleration may be disabled using the follow-
+ing in the Device section of your XF86Config:
+
+ Option "xaa_no_color_exp"
+
+Note that this will reduce the performance of the X server.
+
+4. ET6000 driver features
+
+In addition to the features in the ET4000 driver, the SVGA ET6000 server sup-
+ports all possible color depths in the SVGA server: 8bpp, 16bpp (both at
+5-5-5 and 5-6-5 color resolutions), 24bpp and 32 bpp.
+
+Linear memory mode (as opposed to the VGA default, banked memory layout) is
+supported. It is required and enabled by default for the 16/24/32 bpp modes.
+For 8bpp, the default is linear mode for PCI cards and banked mode for
+ISA/VLB cards.
+
+To force linear memory at 8bpp, put the following in the SVGA section of your
+XF86Config:
+
+ Option "linear"
+
+Acceleration is supported and is enabled by default, and accelerates all
+color depths on the ET6000. Acceleration can be disabled by adding the fol-
+lowing in the Device section of your XF86Config:
+
+ Option "noaccel"
+
+The hardware cursor is supported in all color depths. Due to a hardware limi-
+tation in the ET6000, only a limited set of colors is supported (2 signifi-
+cant bits per color component). This may cause some (small) cursor color
+errors. If absolute cursor color accuracy is required, the hardware cursor
+should not be enabled. However, in most applications, this will not be a
+problem. The hardware cursor can be enabled using
+
+ Option "hw_cursor"
+
+There is a problem with the hardware cursor at high dotclocks (above approx.
+110MHz) at which point the cursor does strange things when partly off the
+left-hand side of the screen.
+
+On older ET6000 chip revisions, DoubleScan modes currently don't work with
+the hardware cursor: only the top half of the cursor is visible. If you want
+to use DoubleScan modes (320x200 is a popular one), then do not enable the
+hardware cursor. Most recent ET6000 cards and the ET6100 do not exhibit this
+problem.
+
+On some PCI systems, acceleration may cause occasional font corruption. As
+described above, this is caused by a bug in your system BIOS or a wrong set-
+ting of the write combining feature in that BIOS. If you are unable to fix
+the BIOS or force the option off, font acceleration may be disabled using the
+following in the Device section of your XF86Config:
+
+ Option "xaa_no_color_exp"
+
+When using accelerated high color-depths (24bpp and 32bpp), high-resolution
+modes (starting somewhere around 800x600) may cause temporary "garbage" lines
+to the right of the screen while the accelerator is busy. The garbage should
+not be persistent: it should go away as soon as the server is left alone.
+This is a memory bandwidth problem, and thus cannot be resolved (except by
+not allowing such modes at all, which is what is done in the current driver).
+
+Ignoring it is one option (it isn't destructive). Disabling acceleration in
+the Device section of the XF86Config file is another option: since the accel-
+erator is not being used, there is ample bandwidth to avoid such problems.
+
+5. Clock selection problems with some ET4000 boards
+
+XFree86 has some problems getting the clock selection right with some ET4000
+boards when the server is started from a high-resolution text mode. The
+clock selection is always correct when the server is started from a standard
+80x25 text mode.
+
+This problem is indicated when the reported clocks are different when the
+server is started from the high-resolution text mode from what they are when
+it is started from the 80x25 text mode. To allow the server to work cor-
+rectly from the high-resolution text mode, there are some Option flags that
+may be set in XF86Config. To find out which flags to set, start the server
+with the -probeonly flag from an 80x25 text mode and look at the information
+printed by the server. If the line:
+
+ VGAXXX: ET4000: Initial hibit state: low
+
+is printed, put the following in the SVGA, VGA16 and VGA2 sections of your
+XF86Config:
+
+ Option "hibit_low"
+
+If the line:
+
+ VGAXXX: ET4000: Initial hibit state: high
+
+is printed, put the following in the SVGA, VGA16 and VGA2 sections of your
+XF86Config:
+
+ Option "hibit_high"
+
+6. Text mode restore problems
+
+In XFree86 1.3, an option flag ``force_bits'' was provided as an experiment
+to attempt to alleviate text-restoration problems that some people experi-
+enced. We have now made the behavior of this option the default, hence the
+flag has been removed. Hopefully the past text-restoration problems are
+alleviated in XFree86 2.0.
+
+7. Basic configuration
+
+It is recommended that you generate an XF86Config file using the XF86Setup'
+or xf86config' program, which should produce a working high-resolution 8bpp
+configuration. You may want to include mode timings in the Monitor section
+that better fit your monitor (e.g 1152x864 modes). The driver options are
+described in detail in the next section; here the basic options are hinted
+at.
+
+If graphics redrawing goes wrong on accelerated chips (ET4000W32 and ET6000),
+first try the "noaccel" option, which disables all accelerated functions.
+
+8. general options in the XF86Config file
+
+The following options are of particular interest to the Tseng driver. Each of
+them must be specified in the svga' driver section of the XF86Config file,
+within the Screen subsections of the depths to which they are applicable (you
+can enable options for all depths by specifying them in the Device section).
+
+ Option "noaccel"
+ (ET4000W32p, et6000) This option will disable the use of any
+ accelerated functions. This is likely to help with some problems
+ related to DRAM timing, high dot clocks, and bugs in accelerated
+ functions, at the cost of performance (which will still be rea-
+ sonable on a local or PCI bus). This option applies only to
+ those chips where acceleration is supported.
+
+ Option "fast_dram" "slow_dram"
+ These options set the DRAM speed of certain cards where it
+ applies.
+
+ The "slow_dram" option is always enabled on ET4000, and
+ ET4000W32. If enabled, it slows down DRAM timing, which may avoid
+ some memory-related problems. If your card starts up with a black
+ screen (and possibly a system hang), this option might be needed.
+
+ The "fast_dram" option will cause the driver to speed up DRAM
+ timings, which may also avoid screen-related problems (streaking,
+ stripes, garbage, ...). It may also increase those very same
+ effects.
+
+ All in all, these are potentially dangerous options: they could
+ crash your machine as soon as you start the server. Use them with
+ caution.
+
+ option "w32_interleave_off" "w32_interleave_on" (W32i, W32p)
+ Force memory interleaving off or on. W32i and W32p chips can
+ increase memory bandwidth when they have 2MB or more video mem-
+ ory. Normally the VGA BIOS sets the W32i or W32p chip to the
+ correct mode. If you suspect problems with memory sizing or
+ interleaving, fooling around with these options may improve the
+ situation. It may also make things worse. These options are not
+ normally needed: the server will use the correct value automati-
+ cally. Setting this option the wrong way will result in a com-
+ pletely distorted display.
+
+ option "pci_burst_off" "pci_burst_on" (W32p)
+ This option disables or enables PCI bursts on the W32p chip if
+ it's a PCI card. Normally, a good BIOS will set the motherboard
+ and the VGA card to the same setting, but if both don't match,
+ you may experience garbage on the screen (e.g. mouse droppings).
+ These options allow you to match the W32p burst setting to the
+ motherboard setting.
+
+ videoram 1024 (or another value) (all chips)
+ This option will override the detected amount of video memory,
+ and pretend the given amount of memory is present on the card.
+ This is useful on cards with 2Mbyte of memory whose DRAM configu-
+ ration is not compatible with the way the driver enables the
+ upper megabyte of memory, or if the memory detection goes wrong.
+ It must be specified in the Device section.
+
+ Clockchip "et6000" (et6000)
+ This enables programmable clocks, but obviously only on the
+ et6000. It must be specified in the Device section. Normally the
+ server will automatically use this feature when it detects an
+ ET6000. Use it only when you suspect auto-detection is not work-
+ ing. Note that some frequencies may be unstable (resulting in a
+ `Wavy' screen). Only tried and tested frequencies (like the
+ default clocks) are guaranteed to be stable. If this happens, try
+ a slightly different frequency in the modeline (like 0.5 MHz more
+ or less). The monitor should still be capable of syncing to this
+ frequency, but the clockchip may already be outside an unstable
+ region.
+
+ Option "linear" (ET4000W32i, ET4000W32p, ET6000)
+ This enables linear addressing, which is the mapping of the
+ entire framebuffer to a high address beyond system memory, making
+ the full length of the framebuffer directly accessible. In this
+ way, slow SVGA bank switching (where only a small fraction of the
+ framebuffer is visible at one time) is not necessary. It enhances
+ performance at 256 colors, and is currently required for 16bpp,
+ 24bpp, and 32bpp.
+
+ MemBase 0xE0000000. (or a different address) (ET4000W32, ET6000)
+ This sets the physical memory base address of the linear frame-
+ buffer. It must be specified in the Device section. It may be
+ required for non-PCI linear addressing configurations, and might
+ be useful for PCI-based systems where auto-detection fails. How-
+ ever, almost all PCI systems will not need this.
+
+ Read the section on linear memory base address issues below!
+
+ Read the section on linear memory base address issues below!
+ (Message repeated for a very good reason)
+
+ Use this option ONLY if you have trouble with the default MemBase
+ used by the server, or if the server explicitly states that you
+ must provide one.
+
+ Option "pci_retry" (ET4000W32p on PCI bus, ET6000)
+ This enables the PCI bus retry function, which is a performance
+ enhancing mode for local bus or PCI bus-based systems, where the
+ VGA controller will put the bus in a hold state (sort of like
+ wait-states) when the server tries to start a new accelerated
+ operation but the accelerator is still busy with the previous
+ operation.
+
+ This is the fastest way to drive a VGA card (no busy-waiting
+ loops needed), but it also stresses some hardware that is timing-
+ dependent (tape drives, sound cards, etc). See also the trouble
+ shooting section.
+
+9. linear memory base address (MemBase) issues
+
+First a WARNING: defining a bad MemBase may cause serious injury or death (to
+your operating system, of course). Especially defining the MemBase to be
+inside the range of system memory is a ticket to hell.
+
+9.1 What you should know BEFORE trying another MemBase
+
+Rule #1: first, let the server find a memory base by itself, without specify-
+ing it. Make sure you "sync" all files to disk and close all critical appli-
+cations. Make sure nothing bad will happen to your filesystems if you have to
+jump for the power switch soon.
+
+The most critical cards are the ET4000W32p rev a and rev b on VESA local bus
+(VLB). The server will autodetect a linear base address that doesn't work on
+all systems.
+
+The least critical cards are PCI-bus cards. The PCI BIOS normally takes care
+of assigning a good MemBase, and you should never have to deal with all the
+mumbo-jumbo below.
+
+If the server gets it wrong, you may end up with a severe system crash (e.g.
+if it maps the video memory right on top of your system memory). If this hap-
+pens, RESET IMMEDIATELY. Do not try to shut down cleanly, because the X-
+server, thinking it writes to the VGA memory, will write to system memory
+instead, and you'll be writing corrupted data to disk. If you did a sync
+prior to starting the server, there will be no harm done (only a filesystem
+check which should end up clean). DO NOT attempt to redirect the server out-
+put to a file on the system you're testing on (that will write data after you
+synced).
+
+These are worst-case scenarios, and it is very unlikely this will happen to
+you. The text above is to make sure you are properly prepared, so that noth-
+ing serious happens.
+
+When the server can't find a working linear memory base, it's time to experi-
+ment. The rest of this section deals with that.
+
+9.2 Choosing a MemBase
+
+Choosing a suitable MemBase can be quite tricky. If you have no way of deter-
+mining the MemBase your card uses, trying to put it a few Mb above the system
+memory is a good first guess. E.g. if you have 16 Mb of RAM, defining MemBase
+0x01000000 (=16M) or 0x01400000 (=20M) may work.
+
+However, this may only work on non-PCI systems, as PCI systems mostly map all
+hardware above the 2GB mark. But then again, on PCI systems the server is
+almost always able to detect the correct linear memory base address. The only
+exception are those systems with more than one PCI VGA card.
+
+On most VESA local bus (VLB) boards, there is an additional problem with
+address decoding. Most motherboards only decode the first 32, 64 or 128 MB of
+address space (a good pointer is to check the amount of DRAM that can be
+installed on the board: it will at least decode as much address space as it
+supports DRAM).
+
+On such boards, you MUST specify a MemBase inside that range, or the actual
+address may wrap back onto system memory: if your system only decodes 128MB
+of addresses, and you set the MemBase to 128 MB, it will actually be decoded
+as being on address 0, which is probably exactly where your kernel memory is
+located. That is why the general guideline of putting the MemBase just above
+the system memory is a sound one: it stands most chance of actually being
+inside the decoded address range of the board. Unless your motherboard's
+entire memory space is filled with RAM.
+
+9.3 An alternative approach
+
+If you don't know how much memory address space your motherboard decodes (and
+who does?), try using a "non-trivial" address, like 0x1FC00000, which has
+enough bits set to "1" to work on any motherboard, even if a few are not
+decoded. Keep in mind that using for example 0x10000000 may end up right on
+top of your system memory if the motherboard doesn't decode all upper address
+bits. You will only do that once.
+
+9.4 When all else fails...
+
+Some other VLB boards can only map the linear framebuffer above the 1GB mark
+(0x80000000 and up), so you must use a MemBase that is higher or equal to
+0x80000000.
+
+Some other VLB boards can only map the linear framebuffer BELOW the 16 MB
+mark. So you may want to try booting your system with up to 12 MB of memory
+(some operating systems allow you to supply a boot-time parameter that limits
+the memory to a certain amount, so you don't have to open your computer to
+try this), and set the MemBase to 0x00C00000 (=12M).
+
+Unfortunately, there is no easy way to tell what system you have (these
+details are mostly not in the motherboard manuals). Trial and error is the
+only road to success here. The server code will provide a default that works
+on most boards... but yours won't be one of those, of course.
+
+9.5 Restrictions
+
+There are some limits as to where the linear memory base may be put. On any
+ET4000W32, it must have a 4MB granularity (i.e. it can be put at 16M or at
+20M, but not at 18M). On ET6000, it needs a 16M granularity (note: the ET6000
+driver should be able to determine the linear memory base automatically, so
+you should never need to define MemBase in the first place).
+
+On ET4000W32i, things are worse: the linear address base is hardwired on the
+card, and there is no reliable way to read it back from the card. You need to
+know the address in some way, and specify it. The current code does an intel-
+ligent guess at it, but this is no guarantee.
+
+On ISA cards, things are much more simple: ISA only uses 24 address lines,
+and hence the linear memory MUST lie within the 16 MB boundary. Together with
+the 4MB granularity of the linear memory base address on ET4000 cards, this
+means that you cannot have more than 12 MB of system memory in the machine if
+you want to use linear memory. Hence, the only realistic MemBase for ISA
+cards is 0x00C00000. This is also what the server will automatically choose
+if it detects an ISA W32 card.
+
+WARNING: you must not have over 12 MB of system memory in this case. Or if
+you have it, you must disable access to all memory above the 12 MB mark.
+Some operating systems allow you to specify at startup how much memory it is
+allowed to use, so you don't have to unplug some memory each time you want to
+use linear memory.
+
+9.6 Some boards simply cannot work in linear mode
+
+Yes, and in that case, you're out of luck.
+
+There can be at least two reasons for this.
+
+The first is the most common: the board manufacturer has left out the neces-
+sary connections and hardware to be able to use linear addressing. This means
+that no coding effort on this planet can help you with your problem: it is
+physically impossible to use linear addressing.
+
+The second reason is that the current XFree86 Tseng linear addressing code is
+incompatible with the way your board is designed. The XFree86 Tseng code
+assumes a 1:1 mapping of the address lines from the bus (either ISA, VLB or
+PCI) to the address lines on the Tseng VGA chip. As unlikely as it may sound,
+this may NOT be the case!
+
+Some very rare boards do not have such a 1:1 mapping (e.g. two address lines
+swapped). It is possible to support this type of hardware, but at this
+moment, this has not been implemented yet.
+
+Other boards use external address decoding hardware that combines a number of
+address lines on the bus to a (smaller) number of address lines to the VGA
+chip. One such board for example uses three NOR gates (one 74F02 chip) to
+combine the 6 upper address lines to three address pins on the W32i chip.
+Obviously, this represents a 2:1 mapping, and not a 1:1 mapping. Therefor,
+this board is not "compatible" with the way XFree86 implements linear mode.
+
+9.7 How can I see if the linear address is wrong?
+
+Simple: nothing works, or your machine locks solid, or it crashes, or a zil-
+lion of other things.
+
+However, sometimes it is not always as obvious. Sometimes nothing bad hap-
+pens: you just get a black screen, or a screen with rubbish on it, but noth-
+ing is drawn on it. Sometimes you get a core dump when the first application
+starts.
+
+If acceleration is enabled in those cases, you will almost always see multi-
+ple "WAIT_ACL: timeout" messages in the server output. That is because the
+accelerator registers are also mapped in the linear memory, and if linear
+memory doesn't work, then also the accelerator doesn't work.
+
+NOTE however that a WAIT_ACL message doesn't necessarily mean the linear mem-
+ory address is bad. There are a number of other reasons for this message as
+well. But if you never saw these messages at 8bpp banked, then there's a good
+chance you have a linear memory problem ("banked" is the opposite of "lin-
+ear", and is the default mode when "option linear" is not in the XF86Config
+file).
+
+10. Mode issues
+
+The accelerated driver on ET4000W32/W32i/W32p and ET6000 needs at least 1K
+bytes of scratch space in video memory. Consequently, if you want accelera-
+tion, a 1024x1024 virtual resolution should not be used with a 1Mbyte card.
+This also means that a 1024x768 mode at 24bpp on a 2.25 MB ET6000 card cannot
+be accelerated, since you've used up all the memory for the display.
+
+The same thing goes for the ET6000 hardware cursor: it also requires 1kb of
+free video memory. If that memory is not available, the hardware cursor can-
+not be used.
+
+The use of a higher dot clock frequencies has a negative effect on the per-
+formance of graphics operations on non-et6000 cards (the effect is much less,
+or even non-existing, on ET6000 cards), especially BitBlt, when little video
+memory bandwidth is left for drawing. Memory bandwidth is the speed at which
+data can be pumped into the memory while the RAMDAC is pulling it out to dis-
+play it on the screen.
+
+Higher dot-clocks (mostly related to higher resolutions) consume more band-
+width, so that less of it is left for drawing into the framebuffer. With a
+working accelerator, things become increasingly crammed, because modern
+accelerators can consume huge amounts of bandwidth (but they also give you
+high speeds in return). High color depths also need extra bandwidth.
+
+If you are short on memory bandwidth (see the separate section on this) and
+experience blitting slowness or screen "glitches", try using the lowest dot
+clock that is acceptable; for example, on a 14" or 15" screen 800x600 with
+high refresh (50 MHz dot clock) is not so bad, with a large virtual screen.
+
+Tseng chips are mostly known for their (very) good memory bandwidth, so you
+should only start to see problems in the higher regions.
+
+It does not make much sense performance-wise to use the highest clock (85
+MHz) for 1024x768 at 76 Hz on a 1 MB ET4000W32; the card will very slow,
+because there is almost no bandwidth left for drawing. A 75 MHz dot clock
+results in 70 Hz which should be acceptable. If you have a monitor that sup-
+ports 1024x768 at 76 Hz with a 85 MHz dot clock, an 1MB card is a poor match
+anyway.
+
+The ET4000W32i and ET4000W32p have a special feature that almost doubles mem-
+ory bandwidth (+70%) using "interleaving" between the two banks. Upgrading
+to 2MB is a real bonus on these cards. This is not true for W32 cards or for
+ET6000 cards.
+
+11. Acceleration issues
+
+The XFree Acceleration Architecture makes extensive use of the unused video
+memory on the VGA card. If there is not enough free video memory, some accel-
+eration features will be disabled or crippled, resulting in less performance.
+
+To avoid this from happening, try to keep an absolute minimum of 16 kb of
+free memory, in addition to the 1kb already reserved by the accelerator.
+
+In practice, this small amount of memory should not be a problem. Most cards
+nowadays have 2 MB of video memory, and running 1280x1024 still leaves plenty
+of memory unused. Even a 1600x1200 desktop will leave over 170kb unused,
+which will then be used by the accelerator to enhance performance.
+
+Most 1MB cards cannot display modes larger than 1024x768 with a decent
+refresh rate, leaving 256kb unused.
+
+The order in which free memory is used to accelerate certain features is as
+follows.
+
+If no video memory is unused (i.e. all of it is used for display memory), no
+acceleration can be used at all -- not even a hardware cursor on the ET6000.
+
+If the hardware cursor is enabled (ET6000 only) and there's at least 1kb of
+free video memory, 1kb is used for that.
+
+If there is at least 1kb of free memory remaining after this, most accelera-
+tion features are enabled as well, reserving an extra 1kb of video memory.
+
+If there's still some free memory, some extra acceleration features are
+enabled. These require more free video memory, depending on the virtual
+screen width and the color depth (bpp). The server will print out how much
+memory it used if it could.
+
+If there's still some free video memory, it is used as a pixmap cache. This
+way, small patterns and images can be kept in the video memory so that they
+don't need to be transferred into the video memory each time they're needed.
+This is beneficial because transferring an image over the bus to the video
+memory takes a lot more time than letting the accelerator blit it from the
+pixmap cache to the display memory.
+
+12. ET6000 memory size facts and fiction
+
+The ET6000 uses a special kind of video memory called MDRAM (multi-bank
+DRAM). It may have a non-power-of-two amount of MDRAM: 2.25 or even 4.50 MB.
+Especially 2.25 MB MDRAM is popular, since this can support 1024x768 at 24bpp
+without needing 4MB of RAM.
+
+There are a few less intuitive problems with this.
+
+First of all, All memory above the 4 MB limit is a waste of money, because
+the ET6000 cannot use this memory for anything at all. There are boards with
+4.5 MB around, but that extra 0.5 MB is a waste. The ET6000 can only refresh
+4 MB of (M)DRAM (refresh register). It can only access 64 banks of 64KB in
+VGA mode (bank select register). All accelerated commands use a 22-bit
+address (=4MB) inside the video memory. You get the idea... There is no way
+for the ET6000 to use anything above the 4Mb limit.
+
+And Secondly (more importantly): you may not have 2.25 MB at all! There have
+been several reports about ET6000 cards that were sold with (supposedly) 2.25
+MB of MDRAM, but which turned out to be standard 2MB MDRAM cards. People
+have been having trouble with these all along, since sometimes the X-server
+used to detect this as 2.25 MB (or even 2.5 MB) due to internal chip design
+and also due to faulty BIOSs. This memory detection problem has been fixed
+now, and the server should detect the correct amount of memory.
+
+Do NOT define the amount of memory in the XF86Config yourself, unless you are
+absolutely sure about the amount.
+
+There is a simple way to determine the amount of MDRAM on your card beyond
+doubt.
+
+Look at the video card. There is one large chip with 204 pins on it, which is
+the ET6000. One socketed rectangular chip, mostly with a sticker on it,is the
+BIOS. The remaining big chips are (mostly) 2 or 4 other large square chips on
+it with the following markings:
+
+MDRAM MD9xy ("xy" is a two-digit number) SJ-5-100 (this may differ, but
+it will have the same layout)
+
+and a nice logo next to all that with 4 diamonds and the name "MoSys" under-
+neath.
+
+The "xy" number tells you how much MEGABITS there are in that one chip.
+
+The amount of RAM on the card is then:
+
+("xy" * number_of_MDRAM_chips) / 8 Mbytes
+
+On my board, there are two MD908 chips, which means I have
+
+(08 * 2) / 8 = 2 MB of MDRAM.
+
+Boards with two MD909 chips have 2.25 MB, etc.
+
+Current MDRAM chips are MD904, MD906, MD908, MD909, MD910, MD916, MD918 and
+MD920.
+
+13. ET6000 memory bandwidth hype and the impact on video modes
+
+Tseng has always had wet dreams about memory bandwidth, and their press
+announcements about the ET6000 memory bandwidth are no exception.
+
+They claim the ET6000 using MDRAM is capable of reaching an incredible 1.2
+Gbytes/sec of bandwidth. That would surpass just about everything on the mar-
+ket (even SGI).
+
+And that would be true, _if_ they actually used the fastest available MDRAMs
+on their boards, which they don't. The stunning 1.2 GByte mark is only
+reached when using 4 MDRAM chips at their max clock rate of 166 MHz. But due
+to design limitations, the first-generation ET6000 can only drive the memo-
+ries at 92 MHz (that will change when the ET6100 and ET6300 hit the streets).
+
+This means the max. theoretical bandwidth available on current ET6000 boards
+is "only" 360 MB/sec on boards with 2 MDRAM chips, and 720 MB/sec on boards
+with 4 MDRAM chips. And this assumes a best-case situation (=extremely long
+bursts -- the MDRAMs use a shared address/data bus, much like the PCI bus
+does). In the real world, unaligned accesses both from the PCI bus and the
+accelerator will reduce the effective available bandwidth. The current ET6000
+boards peak out at about 225 MB/sec, with 2 or 4 MDRAMs.
+
+Whatever you may have read in press releases, the ET6000 has a 32-bit memory
+bus (not 128 bits; that's only the accelerator data path within the chip, if
+anything). That means that, with their 16-bit busses, 2 MDRAM chips already
+use the full bus capacity. Having 4 memory chips on an ET6000 board will not
+give you extra memory bandwidth.
+
+Memory bandwidth limits the maximum resolution you can use at a given color
+depth. The ET6000 RAMDAC can cope with 135 MHz in any situation. But the RAM
+cannot. At 32bpp (sparse 16M color mode), using a 135 MHz pixel clock would
+require a memory bandwidth of 135*4 = 540 MB/sec, which the current ET6000
+boards simply cannot cope with. And then you still need some spare bandwidth
+for the PCI bus and the accelerator.
+
+That is why some modes will be refused, depending on your MDRAM memory lay-
+out, even if the amount of memory would permit such a mode. See also the
+trouble shooting section to see what can happen if too little memory band-
+width is available.
+
+14. Linear addressing and 16bpp/24bpp/32bpp modes
+
+Currently the 16-bit (32768 or 65536 colors), 24-bit (16M colors, packed
+pixel), and 32-bit (16M colors, sparse) pixel support in the SVGA server
+requires linear addressing. This restriction may be removed in a future ver-
+sion, but with nearly all new cards using the PCI bus (where linear address-
+ing poses no problem), removing the linear addressing requirement presently
+has a lower priority than other features. Option "linear" can be specified in
+a depth-specific screen section to enable linear addressing; a MemBase set-
+ting (in the device section) is probably also required on non-PCI based sys-
+tems, and optionally on PCI systems that have trouble finding out for them-
+selves where the MemBase is.
+
+Non-PCI cards are not (or not well) supported in linear memory mode at this
+moment. Some of them don't support it at all, and some of the ones that do
+have so many address decoding bugs that it isn't feasible to provide a work-
+ing solution.
+
+For the most part, many of the accelerated features in the 8bpp server have
+been implemented to support 16, 24, and 32 bpp modes for the W32 and the
+ET6000. So although there are now up to 4 times as many bits to display, the
+X server shouldn't feel overly sluggish. Note also that the 24bpp and 32bpp
+modes are only supported on a limited set of cards, and with at least 2Mb of
+memory.
+
+An ET6000 with 2.25 MB MDRAM is cheap-and-sound, since it can support exactly
+1024x768 at 24bpp (using all available video memory). On all other video
+cards, you need at least 4MB of video memory to do this. With only 2MB of
+(M)DRAM, 960x720 is the best you can hope for.
+
+In the XF86Config "Screen" section, a "Display" subsection must be defined
+for each depth that you want to run, with separate Modes and virtual screen
+size. Example (2Mb of video memory):
+
+ Section "screen"
+ SubSection "Display"
+ Depth 8
+ Virtual 1280 1024
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ EndSubSection
+ SubSection "Display"
+ Depth 16
+ Virtual 1024 992
+ ViewPort 0 0
+ Modes "640x480" "800x600" "1024x768"
+ EndSubSection
+ SubSection "Display"
+ Depth 24
+ Virtual 960 720
+ ViewPort 0 0
+ Modes "640x480" "800x600"
+ EndSubSection
+ SubSection "Display"
+ Depth 32
+ Virtual 832 600
+ ViewPort 0 0
+ Modes "640x480" "800x600"
+ EndSubSection
+ EndSection
+
+15. Trouble shooting with the SVGA Tseng driver
+
+First of all, make sure that the default modes selected from your XF86Config
+are supported by your monitor, i.e. make sure the horizontal sync limit is
+correct. It is best to start with standard 640x480x256 with a 25.175 MHz
+clock (by specifying a single horizontal sync of 31.5) to make sure the
+driver works on your configuration. The default mode used will always be the
+first mode listed in the modes line, with the highest dot clock listed for
+that resolution in the timing section.
+
+Some general hints:
+
+ o Put Option "slow_dram" in the Device Section.
+
+ o Put Option "pci_burst_off" in the Device Section.
+
+ o Put Option "w32_interleave_off" in the Device Section.
+
+ o Take out the Hercules monochrome adapter, if you have one. Many config-
+ urations of the ET4000/W32 series do not allow one in the system.
+
+ o Get a motherboard with its local bus running at 33 MHz. Many, if not
+ all, ET4000/W32 boards will surely behave in a funny way on a 50-MHz
+ bus. You may have to use a wait state or two, but first try without
+ any.
+
+ o Cold-boot your machine. Do not run anything that messes with the video
+ hardware, including other X servers, before running XF86_SVGA.
+
+ o In case of an ET6000 card, try specifying chipset "et6000" in the Device
+ Section. The card normally auto-probes from the PCI bus, but on some
+ systems, another on-board VGA card, although disabled, may cause the
+ ET6000 server to want to use the other card.
+
+Note that some VESA standard mode timings may give problems on some monitors
+(try increasing the horizontal sync pulse, i.e. the difference between the
+middle two horizontal timing values, or try multiples of 16 or 32 for all of
+the horizontal timing parameters).
+
+ There is a video signal, but the screen doesn't sync.
+ You are using a mode that your monitor cannot handle. If it is a
+ non-standard mode, maybe you need to tweak the timings a bit. If
+ it is a standard mode and frequency that your monitor should be
+ able to handle, try to find different timings for a similar mode
+ and frequency combination.
+
+ Horizontal jitter at high dot clocks.
+ This problem shows up especially when drawing operations such as
+ scrolling or blitting are in progress. There is currently no easy
+ fix for this, You can try the "fast_dram" option, or use a lower
+ dot clock. If that is not sufficient, the "noaccel" option will
+ almost always help (it leaves more bandwidth for the RAMDAC). In
+ most cases, this is caused by the video memory not being able to
+ provide pixel data to the RAMDAC fast enough, so it gets fed with
+ garbage.
+
+ `Wavy' screen.
+ Horizontal waving or jittering of the whole screen, continuously
+ (independent from drawing operations). You are probably using a
+ dot clock that is too high; it is also possible that there is
+ interference with a close MCLK. Try a lower dot clock (sometimes
+ even dropping it by 0.5 MHz may work). You can also try to tweak
+ the mode timings; try increasing the second horizontal value
+ somewhat. Here's a 65 MHz dot clock 1024x768 mode (about 60 Hz)
+ that might help:
+
+ "1024x768" 65 1024 1116 1228 1328 768 783 789 818
+
+ Crash or hang after start-up (probably with a black screen).
+ Try the "noaccel" option. Check that the BIOS settings are OK; in
+ particular, disable caching of 0xa0000-0xaffff. Disabling hidden
+ DRAM refresh may also help.
+
+ On Linux systems, if "APM" (power management) support is enabled
+ in the kernel, the server may start up in power-save mode or with
+ a black screen. Rebuild your kernel with APM support disabled.
+
+ Crash, hang, or trash on the screen after a graphics operation.
+ This may be related to a bug in one of the accelerated functions,
+ or a problem with the BitBLT engine. Try the "noaccel" option.
+ Also check the BIOS settings.
+
+ `ACL: TIMEOUT' messages from the server.
+ Same as for the above entry. However, on some systems, the prob-
+ lem will not go away no matter what you do. It may be related to
+ the operating system you use (it has only been seen on Linux sys-
+ tems, and even then it depends on the kernel versions). Some-
+ times, choosing another MemBase may help.
+
+ Occasional erroneous pixels in text, pixel dust when moving window-frame
+ Probably related to MCLK setting that is too high (can happen
+ with linear addressing even though banked mode runs OK). Most (if
+ not all) ET6000 cards are sold with the MCLK slightly over
+ clocked for performance (the current norm is 90 or 92 MHz), which
+ may cause these problems. There is currently no fix for this. If
+ the pixel dust is only temporary (it disappears as soon as noth-
+ ing moves on the screen anymore), then memory bandwidth is proba-
+ bly the cause. The only solution is to disable acceleration, or,
+ if that doesn't help, using a lower pixel clock.
+
+ Textmode is not properly restored
+ This has been reported on some configurations. Sometimes a
+ Chipset line will fix this. Normally you should be able to
+ restore the textmode font using a utility that sets it (setfont,
+ runx, restorefont on Linux).
+
+ Mostly black or blue screen when using accelerated driver features
+ If you are seeing a mostly black or blue screen, with only a few
+ icons (pixmaps) displayed, this section applies to you.
+
+ There can be several causes for this.
+
+ One is if the amount of memory is not detected (or specified)
+ correctly. If the server's autodetection mechanism detects too
+ much memory, accelerated features will not work. Define the
+ amount of memory in the XF86Config file. This seems to happen
+ sometimes on some 2.25 MB ET6000 cards, where the server detects
+ 2.5 MB instead (add videoram "2304" in this particular case).
+
+ If that doesn't help, disabling acceleration (option "noaccel")
+ is the only solution.
+
+ Problems with DMA hardware (floppy, tape)
+ On some systems, the accelerated server will interfere with other
+ hardware that uses ISA DMA. Most notably is the PC floppy con-
+ troller and sound cards. The floppy interface cannot cope with
+ inordinately long bus-holds, which may occur during large accel-
+ erated operations. The Linux-ftape module for example (a floppy-
+ tape driver) will generate lots of "write error" messages when
+ running a backup or restore operation while the X-server is in
+ use. These errors should not be fatal, but that all depends on
+ how well the operating system handles these conditions. Linux
+ seems to cope.
+
+ There are two possible solutions: disable acceleration using the
+ "noaccel" option, or disable PCI-retry (which is causing the
+ large bus delays) by removing the "pci_retry" option. This will
+ cause a very small slowdown of accelerated operations.
+
+ The "pci_retry" option applies not only to the PCI bus systems,
+ but has a similar effect on other busses.
+
+ "Cannot read colourmap from VGA. Will restore with default"
+ If this error occurs, the server was unable to properly initial-
+ ize the RAMDAC, and tries to restore a default color map. On some
+ unsupported RAMDACs, this will have the adverse effect of remov-
+ ing all color altogether, leaving you with a bunch of weird col-
+ ors, or with a completely black screen. If that happens, add the
+ ramdac "normal" statement to the Device section in your XF86Con-
+ fig file. In most cases, this will solve the color problem.
+
+ Why does the server report my ModeLine with only half the pixel clock?
+ For ET4000W32p cards at 8bpp, some modes using a clock over 75
+ MHz (e.g. a 1152x910 mode with 95 MHz pixel clock) will produce
+ the following message in the Xserver output:
+
+ (--) SVGA: Mode "1152x910" will use pixel multiplexing
+
+ And later, when the accepted modelines are reported:
+
+ (**) SVGA: Mode "1152x910": mode clock = 47.500
+
+ This is normal, because with pixel multiplexing, only half the
+ clock is needed as two pixels are sent to the RAMDAC per clock
+ pulse.
+
+For other screen drawing related problems, try the "noaccel" option.
+
+If you are having driver-related problems that are not addressed by this doc-
+ument, or if you have found bugs in accelerated functions, you can try con-
+tacting the XFree86 team.
+
+In fact, reports (success or failure) are very welcome, especially on config-
+urations that have not been tested. You can do this via the BetaReport form
+(mail it to report@XFree86.org). You may want to keep an eye on forthcoming
+beta releases at www.xfree86.org.
+
+16. Acknowledgments
+
+Most of these stem from the old XF86_W32 server. That code was used exten-
+sively for getting the SVGA server to work on all the Tseng cards, so they
+are still somewhat valid.
+
+Glenn G. Lai wrote the original XF86_W32 server. It was modified by Dirk
+Hohndel and Koen Gadeyne to support some more hardware.
+
+Jerry J. Shekhel (jerry@msi.com) gave me (GGL) the 1-M Mirage ET4000/W32 VLB
+board on which the initial development (X_W32) was done.
+
+X11R6 and The XFree86 Project provide the base code for XF86_W32.
+
+Hercules Computer Technology Inc. lent me (GGL) a 2-M Hercules Dynamite Pro
+VLB board for the development that led to XF86_W32. They donated a Dynamite
+Power PCI to The XFree86 Project, that was used by DHH to extend the server.
+
+Tseng Labs kindly donated (KMG) an ET6000-based board (a Jazz Multimedia G-
+Force 128), which spurred the development of the ET6000 code. They also pro-
+vided an ET6100 evaluation board.
+
+Heiko Eissfeldt provided an ET4000W32p_rev_b board which allowed us to get
+better support for those rev_a and rev_b boards.
+
+Gyorgy Krajcsovits donated an ET4000W32p + CH8398 board. A Really Good Move!
+
+Numerous testers have given me feedback for X_W32 and later XF86_W32. I
+apologize for my failure to keep track of the people who tested X_W32, but
+the names of the people involved with the XF86_W32 testing are listed below:
+
+ Linux:
+ bf11620@coewl.cen.uiuc.edu (Byron Thomas Faber)
+
+ dlj0@chern.math.lehigh.edu (David Johnson)
+
+ peterc@a3.ph.man.ac.uk (Peter Chang)
+
+ dmm0t@rincewind.mech.virginia.edu (David Meyer)
+
+ nrh@philabs.Philips.COM (Nikolaus R. Haus)
+
+ jdooley@dbp.caltech.edu (James Dooley)
+
+ thumper@hitchcock.eng.uiowa.edu (Timothy Paul Schlie)
+
+ klatta@pkdla5.syntex.com (Ken Latta)
+
+ robinson@cnj.digex.net (Andrew Robinson)
+
+ reggie@phys.washington.edu (Reginald S. Perry)
+
+ sjm@cs.tut.fi (M{kinen Sami J)
+
+ engel@yacc.central.de (C. Engelmann) use cengelm@gwdg.de
+
+ postgate@cafe.net (Richard Postgate)
+
+ are1@cec.wustl.edu (Andy Ellsworth)
+
+ bill@celtech.com (Bill Foster)
+
+ FreeBSD:
+ ljo@ljo-slip.DIALIN.CWRU.Edu (L Jonas Olsson)
+
+Several people have developed code for the SVGA Tseng driver (this list is
+incomplete):
+
+ o Glenn G. Lai
+
+ o Dirk H. Hohndel
+
+ o Koen Gadeyne
+
+ o OEyvind Aabling
+
+ o Dejan Ilic
+
+ o Mark Vojkovich
+
+ o Harald Nordgard Hansen
+
+ o David Bateman
+
+ o Gyorgy Krajcsovits
+
+ o Kurt Olsen
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/tseng.sgml,v 3.32 1999/08/23 06:38:54 dawes Exp $
+
+ $XConsortium: tseng.sgml /main/6 1996/10/27 11:06:09 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.tseng,v 3.39 1999/08/23 07:03:54 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES
new file mode 100644
index 000000000..81c795b44
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES
@@ -0,0 +1,855 @@
+ Release Notes for XFree86[tm] 3.9.16
+
+ The XFree86 Project, Inc
+
+ 31 August 1999
+
+ Abstract
+
+ This document contains some information about the features present
+ in XFree86 3.9.16 and their status.
+
+1. Summary of new features in 3.9.16 compared with 3.9.15.
+
+This section contains a brief summary of what has changed since the previous
+snapshot. Unfortunately, only a small number of changes are listed here.
+For detailed information, refer to the CHANGELOG file in the xc/pro-
+grams/Xserver/hw/xfree86 directory in the source tree. The sections that
+follow this one have details of features that are new to the pre-4.0 snapshot
+series.
+
+ o The "apm" driver has been updated. See the APM section (section 2.11.1,
+ page 1) below.
+
+ o A driver for NVIDIA chipsets is now included. The driver is called
+ "nv". Some very basic information can be found in the nv(4) man page.
+
+ o The default xdm config file now has a line to disable listening for
+ XDMCP requests. This is fine when xdm is only managing a local X
+ server. The line must be commented out when xdm is used to manage
+ external X servers (e.g., X terminals).
+
+ o New driver for Intel i740. The driver is called "i740".
+
+ o New driver for 3Dfx Banshee and Voodoo 3. The driver is called "tdfx".
+
+ o Some work on adding WYSIWYG capabilities to the Xaw text widget.
+
+ o Some preliminary support for programming modes has been added to xedit.
+
+2. X server
+
+Unlike XFree86 3.3.x where there are multiple X server binaries, each of
+which drive different hardware, XFree86 3.9.16 has a single X server binary
+(called XFree86). This binary can either have one or more video drivers
+linked in statically, or, more usually, dynamically load the video drivers
+and other modules that are needed.
+
+XFree86 3.9.16 has X server support for most UNIX(R) and UNIX-like operating
+systems on Intel/x86 platforms, plus support for Linux on Alpha and PowerPC
+platforms. Support for additional architectures and operating systems is
+planned for future releases.
+
+2.1 Loader and Modules
+
+The XFree86 X server has a built-in run-time loader, donated by Metro Link
+<URL:http://www.metrolink.com>. This loader can load normal object files and
+libraries in most of the commonly used formats. Since the loader doesn't
+rely on an operating system's native dynamic loader support, it works on
+platforms that don't provide this feature, and makes it possible for the mod-
+ules to be operating system independent (although not, of course, independent
+of CPU architecture). This means that, for example, a module compiled on
+Linux/x86 can be loaded by an X server running on Solaris/x86, or FreeBSD, or
+even OS/2. One of the main benefits of this is that when modules are
+updated, they don't need to be recompiled for each different operating sys-
+tem.
+
+The loader in version 3.9.16 has support for Intel (x86), Alpha and PowerPC
+platforms. It also has preliminary support for Sparc platforms.
+
+The X server makes use of modules for video drivers, X server extensions,
+font rasterisers, input device drivers, framebuffer layers (like mfb, cfb,
+etc), and internal components used by some drivers (like XAA),
+
+The module interfaces (API and ABI) used in the snapshot releases are subject
+to change without notice. This means that there is no guarantee that modules
+built for one snapshot release will function with another snapshot release.
+As of the 4.0 release we plan to make every effort to provide backward com-
+patibility for the module interfaces (that means older modules working with
+newer core X server binaries).
+
+Note about module security
+
+ The XFree86 X server runs with root privileges, which means that
+ the X server loadable modules also run with these privileges. For
+ this reason we recommend that all users be careful to only use
+ loadable modules from reliable sources. By the time that XFree86
+ 4.0 is released, we hope to have implemented a method for sign-
+ ing/verifying modules that we provide.
+
+2.2 Configuration File
+
+The X server configuration file format has been extended to handle some of
+the new functionality. The xf86config utility can be used to generate a
+basic config file, that may require some manual editing. Alternatively, the
+sample config file XF86Config.eg that is installed in /usr/X11R6/lib/X11 may
+be used as a starting point. The XF86Setup utility is currently not usable,
+but work is continuing in this area.
+
+The main changes are:
+
+ o The Module section is used to load server extension modules and font
+ modules, but not XInput drivers. The .so suffix should no longer be
+ specified with module names. Options may be supplied for modules by
+ loading the module via a SubSection instead of the usual Load keyword.
+ The bitmap module is the only font module that is loaded by default. No
+ server extensions are loaded by default, but some are built-in to the
+ server. The following example shows how to load all the server exten-
+ sions plus the Type1 and TrueType fonts support, and a commented example
+ that shows how to pass options to an extension (this one is for loading
+ the misc extensions (extmod) with the XFree86-VidModeExtension dis-
+ abled):
+
+ Section "Module"
+
+ Load "dbe"
+ Load "record"
+ Load "glx"
+ Load "pex5"
+ Load "xie"
+ Load "extmod"
+
+ Load "type1"
+ Load "freetype"
+
+ # SubSection "extmod"
+ # Option "Omit XFree86-VidModeExtension"
+ # EndSubSection
+
+ EndSection
+
+ o Option flags have been extended and are now used more widely in the con-
+ fig file. Options flags come in two main types. The first type is
+ exactly like the old form:
+
+ Option "name"
+
+ where the option just has a name specified. The name is case insensi-
+ tive, and white space and underscore characters are ignored. The second
+ type consists of a name and a value:
+
+ Option "name" "value"
+
+ The value is passed transparently as a string to the code that uses the
+ option. Common value formats are integer, boolean, real, string and
+ frequency. The following boolean option values are recognised as mean-
+ ing TRUE: "true", "yes", "on", "1", and no value. The values recognised
+ as FALSE are "false", "no", "off", "0". In addition to this, "no" may
+ be prepended to the name of a boolean option to indicate that it is
+ false. Frequency options can have the strings Hz, kHz, or MHz appended
+ to the numerical value specified.
+
+ Note: the value must always be enclosed in double quotes (").
+
+ o The ServerFlags section now accepts its parameters as Options instead of
+ as special keywords. The older keyword format is still recognised for
+ compatibility purposes, but is deprecated and support for it will likely
+ be dropped in a future release. The DPMS and screen save timeout values
+ are now specified in the ServerFlags section rather than elsewhere
+ (because they are global parameters, not screen-specific). This example
+ shows the defaults for these:
+
+ Option "blank time" "10"
+ Option "standby time" "20"
+ Option "suspend time" "30"
+ Option "off time" "60"
+
+ o The Keyboard, Pointer and XInput sections have been replaced by a more
+ general InputDevice section. The old Keyboard and Pointer sections are
+ still recognised for compatibility purposes, but they are deprecated and
+ support for them may be dropped in future releases. The keywords from
+ the old sections are expressed as Options in the InputDevice sections.
+ The following example shows typical InputDevice sections for the core
+ mouse and keyboard.
+
+ Section "InputDevice"
+ Identifier "Keyboard 1"
+ Driver "keyboard"
+ Option "AutoRepeat" "500 5"
+ Option "XkbModel" "pc104"
+ Option "XkbLayout" "us"
+ EndSection
+
+ Section "InputDevice"
+ Identifier "Mouse 1"
+ Driver "mouse"
+ Option "Protocol" "PS/2"
+ Option "Device" "/dev/mouse"
+ EndSection
+
+ o The Monitor section is mostly unchanged. The main difference is that a
+ set of VESA modes is defined internally in the server, and so for most
+ monitors, it isn't necessary to specify any modes explicitly in the Mon-
+ itor section. The Monitor section may also include Options. Options
+ that are monitor-specific, like the "DPMS" and "Sync on Green" options
+ are best specified in the Monitor sections.
+
+ o The Device sections are mostly unchanged. The main difference is the
+ new (and mandatory) Driver keyword, that specifies which video driver
+ should be loaded to drive the video card. Another difference is the
+ BusID keyword that is used to specify which of possibly multiple video
+ cards the Device section is for. The following is an example for a
+ Matrox card:
+
+ Section "Device"
+ Identifier "MGA 1"
+ Driver "mga"
+ BusID "PCI:1:0:0"
+ Option "PCI Retry"
+ EndSection
+
+ o The Screen sections are mostly unchanged. The old Driver keyword is no
+ longer used, and a mandatory Identifier keyword has been added. The
+ DefaultColorDepth keyword has been renamed to DefaultDepth.
+
+ o A new section called ServerLayout has been added to allow the layout of
+ the screens and the selection of input devices to be specified. The
+ ServerLayout sections may also include options that are normally found
+ in the ServerFlags section. Multiple ServerLayout sections may be pre-
+ sent, and selected from the command line. The following example shows a
+ ServerLayout section for a dual-headed configuration with two Matrox
+ cards, and two mice:
+
+ Section "ServerLayout"
+ Identifier "Layout 1"
+ Screen "MGA 1"
+ Screen "MGA 2"
+ InputDevice "Keyboard 1" "CoreKeyboard"
+ InputDevice "Mouse 1" "CorePointer"
+ InputDevice "Mouse 2" "SendCoreEvents"
+ Option "BlankTime" "5"
+ EndSection
+
+The config file search patch has been extended, with the directories /etc/X11
+and /usr/X11R6/etc being added.
+
+2.3 Command Line Options
+
+The following new X server command line options have been added:
+
+ -depth n
+
+ This specifies the colour depth that the server is run-
+ ning at. The default is 8 for most drivers. Most
+ drivers support the values 8, 15, 16 and 24. Some
+ drivers also support the values 1 and 4. Some drivers
+ may also support other depths. Note that the depth is
+ different from the ``bpp'' that was specified with previ-
+ ous versions. The depth is the number of bits in each
+ pixel that are significant in determining the pixel's
+ value. The bpp is the total size occupied by each pixel,
+ including bits that are not used. The old -bpp option is
+ no longer recognised because it isn't a good way of spec-
+ ifying the server behaviour.
+
+ -fbbpp n
+
+ This specifies the bpp format to use for the framebuffer.
+ This may be used in 24-bit mode to force a framebuffer
+ format that is different from what the driver chooses by
+ default. In most cases there should be no need to use
+ this option.
+
+ -pixmap24
+
+ This specifies that the client-side pixmap format should
+ be the packed 24-bit format that was often used by the
+ 3.3.x servers. The default is the more common 32-bit
+ format. There should normally be no need to use this
+ option.
+
+ -pixmap32
+
+ This specifies that the client-side pixmap format should
+ be the sparse 32-bit format. This is the default, so
+ there should normally be no need to use this option.
+
+ -layout name
+
+ This specifies which ServerLayout section in the config
+ file to use. When this option is not specified, the
+ first ServerLayout section is used. When there is no
+ ServerLayout section, the first Screen section is used.
+
+ -screen name
+
+ This specifies which Screen section in the config file to
+ use. When this option is not specified, the first
+ ServerLayout section is used. When there is no Server-
+ Layout section, the first Screen section is used.
+
+ -keyboard name
+
+ This specifies which InputDevice section in the config
+ file to use for the core keyboard. This option may be
+ used in conjunction with the -screen option.
+
+ -pointer name
+
+ This specifies which InputDevice section in the config
+ file to use for the core pointer. This option may be
+ used in conjunction with the -screen option.
+
+ -modulepath path
+
+ This specifies the module search path. The path should
+ be a comma-separated list of absolute directory paths to
+ search for server modules. When specified here, it over-
+ rides the value specified in the config file. This
+ option is only available when the server is started by
+ the root user.
+
+ -logfile file
+
+ This specifies the log file name. When specified here,
+ it overrides the value specified in the config file.
+ This option is only available when the server is started
+ by the root user.
+
+ -scanpci
+
+ This specifies that the scanpci module should be loaded
+ and executed. This does a scan of the PCI bus. This
+ option is only available when the server is started by
+ the root user.
+
+ -logverbose [n]
+
+ This options specifies the verbosity level to use for the
+ log file. The default is 3.
+
+The following X server command line options have been changed since 3.3.x:
+
+ -verbose [n]
+
+ This option specifies the verbosity level to use for the
+ server messages that get written to stderr. It may be
+ specified multiple times to increase the verbosity level
+ (as with 3.3.x), or the verbosity level may be specified
+ explicitly as a number. The default verbosity level is
+ 1.
+
+ -xf86config filename
+
+ This option has been extended to allow non-root users to
+ specify a relative config file name. The config file
+ search path will be used to locate the file in this case.
+ This makes it possible for users to choose from multiple
+ config files that the the sysadmin has provided.
+
+2.4 XAA
+
+The XFree86 Acceleration Architecture (XAA) has been completely rewritten
+from scratch. Most drivers implement acceleration by making use of the XAA
+module.
+
+2.5 Multi-head
+
+Some multi-head configurations are supported in this release, primarily with
+multiple PCI/AGP cards. However, this is an area that is still being worked
+on, and we expect that the range of configurations for which it works well
+will increase in future snapshots. A configuration that is known to work
+well in most cases is multiple (supported) Matrox cards.
+
+One of the main problems is with drivers not sufficiently initialising cards
+that were not initialised at boot time. Normally only the primary video card
+gets initialised at boot time. Some combinations can be made to work better
+by changing which card is the primary card (either by using a different PCI
+slot, or by changing the system BIOS's preference for the primary card). We
+are investigating options for ``soft-booting'' secondary video cards to deal
+with this problem, and we've had some very encouraging results.
+
+2.6 Xinerama
+
+Xinerama is an X server extension that allows multiple physical screens to
+behave as a single screen. With traditional multi-head in X11, windows can-
+not span or cross physical screens. Xinerama removes this limitation. Xin-
+erama does, however, require that the physical screens all have the same root
+depth, so it isn't possible, for example, to use an 8-bit screen together
+with a 16-bit screen in Xinerama mode.
+
+Xinerama is not enabled by default, and can be enabled with the +xinerama
+command line option for the X server.
+
+Xinerama was included with X11R6.4. The version included in this snapshot
+contains many bug fixes. This is an area that we are still working on, and
+we expect it to be improved further in future snapshots.
+
+Known problems:
+
+ o The Xinerama layout doesn't match the layout specified in the config
+ file's ServerLayout section.
+
+ o It appears that there are still some bugs that cause unexpected
+ behaviour from time to time.
+
+ o Most (all?) window managers are not Xinerama-aware, and so some opera-
+ tions like window placement and resizing might not behave in an ideal
+ way. This is an issue that needs to be dealt with in the individual
+ window managers, and isn't specifically an XFree86 problem.
+
+2.7 DGA version 2
+
+The DGA extension has been reworked. The version present in this snapshot is
+preliminary, not documented, not implemented by many drivers, and subject to
+further change without notice. Compatibility with version 1.0 is provided.
+
+2.8 DDC
+
+The VESA(R) Display Data Channel (DDC[tm]) standard (related to, but separate
+from, the VESA(R) Plug and Display standard) allows the monitor to tell the
+video card (or on some cases the computer directly) about itself; particu-
+larly the supported screen resolutions and refresh rates.
+
+Partial or complete DDC support is available in the following hardware mod-
+ules (this list needs to be verified):
+
+ o APM
+
+ o Chips
+
+ o Cirrus
+
+ o Glint
+
+ o MGA
+
+ o Neomagic
+
+ o S3 ViRGE
+
+ o SIS
+
+ o Trident
+
+DDC is enabled by default, but can be disabled with a "Device" section entry:
+Option "NoDDC". We have support for DDC versions 1 and 2; these can be dis-
+abled independently with Option "NoDDC1" and Option "NoDDC2".
+
+At startup the server prints out DDC information from the display, but it
+does not yet use it the determine modelines.
+
+Changed behavior caused by DDC. Several drivers uses DDC information to set
+the monitor gamma (brightness) curve, and the screen size and pitch.
+
+ o The gamma is particularly noticeable; every monitor I have tried has a
+ gamma setting > 2, which means that the picture is much lighter than
+ under 3.3.x or without DDC. To revert to the previous behavior put
+
+ Gamma 1.0 1.0 1.0
+
+ in the appropriate "Monitor" section of the config file.
+
+ o Similarly, you can override the DDC probed "dpi" value by explicitly
+ resetting it to the 3.3.x and non-DDC default value 75 with the -dpi 75
+ command line option for the X server, or by specifying appropriate
+ screen dimensions with the "DisplaySize" keyword in the "Monitor" sec-
+ tion of the config file.
+
+2.9 GLX and the Direct Rendering Infrastructure (DRI)
+
+Precision Insight <URL:http://www.precisioninsight.com> has been provided
+with funding and support from Red Hat <URL:http://www.redhat.com> and SGI
+<URL:http://www.sgi.com> to integrate the GLX extension for 3D rendering in
+an X11 window. The 3D core rendering component is the Mesa
+<URL:http://www.mesa3d.org> library. SGI has released the sources to the
+extension framework under an open license, which essentially provides the
+glue between the 3D library and this windowing system. Precision Insight has
+integrated these components into this XFree86 X Server and added a Direct
+Rendering Infrastructure. Direct Rendering provides a highly optimized path
+for sending 3D data directly to the graphics hardware. This release demon-
+strates a sample implementation of direct rendering <URL:http://www.preci-
+sioninsight.com/demo.html> by providing a single path of 3D hardware acceler-
+ated rendering for the GMX2000 graphics card. Future releases will support
+much broader implementations of hardware accelerated direct rendering on a
+wide range of 3D capable graphics devices.
+
+2.10 Other extensions
+
+The XFree86-Misc extension has not been fully ported to the new server archi-
+tecture yet. This should be completed in a future snapshot.
+
+The XFree86-VidModeExtension extension has been updated, and mostly ported to
+the new server architecture. The area of mode validation needs further work,
+and the extension should be used with care. This extension has support for
+changing the gamma setting at run-time, for modes where this is possible.
+The new xgamma utility makes use of this feature. Compatibility with the
+3.3.x version of the extension is provided. The missing parts of this exten-
+sion and some new features should be completed in a future snapshot.
+
+2.11 Drivers
+
+XFree86 3.9.16 includes the following drivers:
+
+ +------------+----------------------+
+ |Driver Name | Description |
+ +------------+----------------------+
+ |apm | Alliance Pro Motion |
+ |ati | ATI |
+ |chips | Chips & Technologies |
+ |cirrus | Cirrus Logic |
+ |fbdev | Linux fbdev |
+ |glide | Glide2x (3Dfx) |
+ |glint | 3Dlabs |
+ |i740 | Intel i740 |
+ |mga | Matrox |
+ |neomagic | NeoMagic |
+ |nv | NVIDIA |
+ |rendition | Rendition |
+ |s3virge | S3 ViRGE |
+ |sis | SiS |
+ |tdfx | 3Dfx |
+ |tga | DEC TGA |
+ |trident | Trident |
+ |tseng | Tseng Labs |
+ |vga | Generic VGA |
+ +------------+----------------------+
+
+2.11.1 APM
+
+The driver apm is for Alliance AT3D/AT25 based boards. The driver is still
+in development. I hope to be able to correct the errors I find. The Rush
+extension should be ready for the next snapshot; I can do better memory man-
+agement, but I'll need time. If someone can help me, feel free to drop an
+email to <grenie@lami.univ-evry.fr>
+
+2.11.2 Chips & Technologies
+
+Information about the C&T driver can be found in README.chips.
+
+2.11.3 s3virge
+
+The s3virge driver is a port of the 3.3.3.1 SVGA S3 ViRGE driver. As such it
+should be as stable and functional as previous XFree86 releases. There are a
+couple additional benefits included primarily due to common enhancements:
+
+ o Depth 24 problems resolved with clients using 24/32 bpp pixmaps.
+
+ o Our common acceleration architecture (XAA) has been re-written, as has
+ the ViRGE acceleration code. You should find this version has better
+ performance than prior releases.
+
+ o Multi-head is reported to work.
+
+ o The s3virge man page lists options and has configuration notes for this
+ release of the driver.
+
+Outstanding items not implemented or fully tested:
+
+ o DGA support is implemented, but preliminary and untested.
+
+ o ViRGE MX Melco BIOS support has not been ported yet.
+
+2.11.4 TGA
+
+The TGA driver is now accelerated and supports both 8 and 32 plane frame-
+buffers. It is known to work under Linux/Alpha. Please see the
+README.DECtga file for further information.
+
+2.11.5 Matrox
+
+The MGA driver supports the same range or hardware as XFree86 3.3.4, but has
+a number of enhancements including multi-head support and support for over-
+lays (8-bit + 24-bit).
+
+Option "overlay" when the server is started in 32bpp (-fbbpp 32) will enable
+the 8+24 mode. The current implementation doesn't optimize away unnecessary
+exposures yet so the performance of this option will be better in future
+snapshots. The option is not supported on the G100 due to a missing hardware
+feature. By default, the color key for the overlays is 255, but this can be
+changed with the "ColorKey" option to work around problems in specific pro-
+grams. Valid values for the key are 2-255.
+
+Option "OverclockMem" will raise the memory clock on the G200. Matrox
+doesn't recommend deviating from the BIOS defaults but we find that some
+hardware shows static during graphics operations in high resolutions/depths
+when run at the regular clocks so this option is needed for some cards (it
+also improves performance). Beware, some hardware experiences difficultly
+restoring the console when this option is used.
+
+Further information can be found in the mga man page.
+
+2.11.6 ATI
+
+Information about the ATI driver can be found in README.ati <URL:ati.html>.
+The current version is not accelerated. Acceleration support is planned for
+a future snapshot.
+
+3. X libraries and clients
+
+3.1 Xaw
+
+Two versions of the Xaw library are provided in this release. A version with
+bug fixes and a few binary compatible improvements and a new version with
+several new features.
+
+New features:
+
+ o A displayList resource is available to all Xaw widgets. It basically
+ consists of a list of drawing commands, fully described in the Xaw(3)
+ manual page, that enables a integration of Xaw programs with the new
+ window/desktop managers that allows for configurable themes.
+
+ o Some new actions were added to all Xaw widgets, to allow more config-
+ urable control of the widgets, and to allow setting resources at run
+ time.
+
+ o Since Xpm was integrated into XFree86, programs linked with the new Xaw
+ library will also link with Xpm. This allows for color background
+ pixmaps, and also for shaped widgets.
+
+ o The text widget is the widget that will present more changes. These
+ include:
+
+ o Block cursor.
+
+ o Compile time limit of 16384 undo/redo levels (that will automati-
+ cally grow if the text is not saved when this mark is reached).
+
+ o Overwrite mode.
+
+ o Text killed is inserted in a kill ring list, this text is not for-
+ gotten, pressing M-y allows traversing the kill ring list.
+
+ o International support for latin languages is available even if the
+ international resource is not set. Users will need to properly set
+ the locale environment to make complete use of this feature.
+
+ o A better multiply interface is provided. Pressing C-u,<number>
+ (where number can be negative) allows passing parameters for text
+ actions.
+
+ o Text can be formatted to have left, right, center or full justifi-
+ cation.
+
+ o Text indentation support is also available.
+
+ o This snapshot shows the current state of the work to add to the Xaw text
+ widget WYSIWYG capabilities. The state is very initial, and can be seen
+ as a candidate to a candidate to a very early alpha snapshot. There is
+ no public interface for programming yet, because the current one is very
+ likely to change before ready to use.
+
+Bug fixes:
+
+ o The simple menu widget geometry management code was improved to solve
+ problems with menu entries not visible in the screen.
+
+ o The form widget geometry code was changed to solve problems with integer
+ round problems in the child widgets geometry when resizing the parent
+ form widget.
+
+ o Several bugs were fixed in the text code, while some code was rewritten
+ from scratch.
+
+3.2 Xpm
+
+Version 3.4k of the Xpm (X pixmap) library is now integrated into XFree86.
+
+3.3 xterm
+
+New Features:
+
+ o Support Unix98 PTY's.
+
+ o Support Unicode using UTF-8 input and output. There are a few limita-
+ tions, this work is still in progress:
+
+ o You must use the -u8 command line option to use this feature, as
+ well as compile with the OPT_WIDE_CHARS definition. (The feature
+ is compiled when using imake).
+
+ o Input (from keyboard) and output (select/paste) are in UTF-8 form.
+ There is no support in Xlib for UTF-8; xterm uses a lookup table to
+ map keysym codes. Select/paste is done either via STRING or using
+ the new atom UTF8_STRING.
+
+ o Add optional feature (resource and command-line options) to make xterm
+ use the PTY's sense of erase character on startup, rather than requiring
+ it to be \177, or set the PTY's erase character to match xterm's config-
+ uration. Note that while $TERMCAP is modified to reflect the actual
+ configuration, the terminfo kdch1 string is not. (This feature is also
+ in XFree86 3.3.4).
+
+ o Revised keyboard handling, making two modes (VT220 and Sun/PC) which are
+ switched by popup menu. This makes the numeric keypad work as expected.
+ Codes sent by the backarrow and delete keys also are affected.
+
+ o Add parameters to function key escape sequences to indicate if shift,
+ control or alt are set. This works for Sun/PC keyboard mode.
+
+ o Separated command-line and menu settings for reverse video from that
+ done under program control. This is a problem which was introduced by
+ X11R6. Though correct, most users are confused by allowing the reset
+ command to undo the effect of the command-line -rv option.
+
+ o Blinking cursor can be specified by resource or popup menu.
+
+ o New control sequences for switching between normal and alternate screens
+ maintain separate cursor-save locations for the two screens, avoiding
+ incorrect cursor placement on exit from vi.
+
+ o Support line-drawing characters when the font does not include them by
+ drawing them.
+
+ o Add support for switching font sizes, by stepping through the font menu
+ using shifted keypad plus and minus.
+
+ o New resource trimSelection allows xterm to trim trailing blanks from
+ selected lines.
+
+ o Provide user applications a means of determining the version of xterm
+ for feature comparison by returning the patch number (e.g., 111) in the
+ secondary DA response.
+
+Bug fixes/improvements:
+
+ o If colorMode is enabled by default, compile-in default resources to
+ match the colors listed in XTerm-col.ad.
+
+ o Deprecate DA answerback string, making it settable via a resource value
+ for applications which may need this.
+
+ o Input characters which are mapped when in vt220 National Replacement
+ Character mode.
+
+ o Completed support for double size characters.
+
+ o Remove kfnd/kll/kslt strings from terminfo, because curses applications
+ do not necessarily return khome/kend pairs.
+
+ o Corrected ifdef's for menus, which did not allow tek4014 to be sup-
+ pressed properly.
+
+ o Improved tests for determining if xterm should use overstriking to simu-
+ late bold fonts.
+
+ o Add test/demo scripts for double size characters, font switching, screen
+ resizing and colors.
+
+3.4 xedit
+
+Xedit have been changed to use most of the new features added to the new ver-
+sion of the Xaw library, and some xedit only features were added. Emacs users
+will find that several of the emacs key bindings work with the new version of
+xedit. These include:
+
+ o File name tab completion. Including a Emacs dired like window, that will
+ be shown when there are more than one match, when C-x,d is pressed, or
+ when a directory name is specified.
+
+ o An unlimited number of files can be edited at the same time. Including
+ multiple views of the same or different files.
+
+ o The line number of the cursor position is always visible. It can also be
+ customized to show the column number, the position offset and the cur-
+ rent size of the file.
+
+ o There is an autoReplace resource, that enables automatic text replace-
+ ment at the time text is typed. This feature is useful to create simple
+ macros, or to correct common spelling errors.
+
+ o A fully featured ispell interface is also available. This interface is
+ expected to provide most of the features of the terminal interface of
+ the ispell program, with some extra features that include:
+
+ o A compile time limit of 16 undo levels.
+
+ o Terse mode switch.
+
+ o Dictionary change.
+
+ o The interface also checks for repeated words.
+
+ o A first tentative to add programming modes was done. Currently, there
+ are two modes:
+
+ o C-mode: this mode is expected to be stable, and fully usable.
+
+ o Html-mode: a lot of work needs to be done yet. It is included in
+ this snapshot only to show what the new text widget capabilities
+ can do.
+
+4. Fonts and Internationalisation
+
+Details about the font support in this version of XFree86 can be found in the
+README.fonts document.
+
+4.1 TrueType support
+
+This version of XFree86 comes with two TrueType backends, known as `xfsft'
+(the "freetype" module) and `X-TrueType' (the "xtt" module). Both of these
+backends are based on the FreeType library.
+
+4.2 CID font support
+
+Support for CID-keyed fonts is included in this version of XFree86. The CID-
+keyed font format was designed by Adobe Systems <URL:http://www.adobe.com>
+for fonts with large character sets. The CID-keyed font support in XFree86
+was donated by SGI <URL:http://www.sgi.com>. See the LICENSE document for a
+copy of the CID Font Code Public License.
+
+4.3 Internationalisation of the scalable font backends
+
+A new ``fontenc'' layer has been added to allow the scalable font backends to
+use a common method of font re-encoding. This re-encoding makes it possible
+to uses fonts in encodings other than their their native encoding. This
+layer is used by the Type1 and Speedo backends and the `xfsft' version of the
+TrueType backend. The `X-TrueType' version of the TrueType backend uses a
+different re-encoding method based on loadable encoding modules.
+
+4.4 Unicode support
+
+What is included:
+
+ o ISO 10646-1 extension of ``fixed'' BDF fonts added that cover over 2000
+ characters including all Latin, Greek, Cyrillic, Armenian, and Gregorian
+ characters, plus numerous scientific and technical symbols (further
+ fonts are under preparation).
+
+ o Mark Leisher's ClearlyU proportional font (similar to Computer Modern).
+
+ o ISO 10646/Unicode UTF-8 Level 1 support added to xterm (enabled with the
+ -u8 option).
+
+ o Both the xfsft (the "freetype" module) and the X-TrueType (the "xtt"
+ module) TrueType font backends support Unicode-encoded fonts.
+
+Known problems:
+
+ o Xlib does not yet support UTF-8 as a locale, which means that xterm
+ UTF-8 keyboard support is at the moment a temporary hack.
+
+ o ISO 10646-1 cell-spaced fonts such as ``fixed'' work nicely, but mono-
+ spaced and proportional fonts are handled inefficiently by the X proto-
+ col, resulting in metrics for 64k glyphs even if only 2000 glyphs are
+ used.
+
+ o ISO 10646 Level 2 combining characters not yet supported by xterm (will
+ be needed for instance for the Thai script).
+
+5. Miscellaneous
+
+5.1 Directory rearrangements
+
+Some changes to the installed XFree86 directory structure have been planned
+for 4.0. Not all of these changes have been implemented in this snapshot,
+and they will appear in a future snapshot. One important change that has
+been implemented is a modified search path for the X server's XF86Config
+file. The details of this can be found above in the Configuration File (sec-
+tion 2.2, page 1) section.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.18 1999/08/31 08:39:09 dawes Exp $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.70 1999/08/31 08:42:05 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/ServersOnly b/xc/programs/Xserver/hw/xfree86/doc/ServersOnly
new file mode 100644
index 000000000..bdcdd15a5
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/ServersOnly
@@ -0,0 +1,72 @@
+The following is a list of files/directories required when using a
+cut-down source tree to build only the X servers. When using this
+cut-down tree, set BuildServersOnly to YES and XnestServer to NO in
+xc/config/cf/xf86site.def.
+
+xc/Imakefile
+xc/Makefile
+xc/Makefile.ini
+xc/RELNOTES.TXT
+xc/bug-report
+xc/config/
+xc/include/
+xc/lib/Imakefile
+xc/lib/X11/
+xc/lib/Xau/
+xc/lib/Xdmcp/
+xc/lib/font/
+xc/lib/xtrans/
+xc/programs/Imakefile
+xc/programs/Xserver/Xserver.man
+xc/programs/Xserver/Imakefile
+xc/programs/Xserver/Xext/
+xc/programs/Xserver/cfb/
+xc/programs/Xserver/cfb16/
+xc/programs/Xserver/cfb32/
+xc/programs/Xserver/dix/
+xc/programs/Xserver/hw/xfree86/
+xc/programs/Xserver/include/
+xc/programs/Xserver/mfb/
+xc/programs/Xserver/mi/
+xc/programs/Xserver/os/
+xc/registry
+
+To include PEX support in the server, the following directory is also required:
+
+xc/programs/Xserver/PEX
+
+To include XIE support in the server, the following directory is also required:
+
+xc/programs/Xserver/XIE
+
+
+Notes:
+
+1. the Xnest server cannot be built with this cut-down tree since it
+requires libX11.
+
+2. To get a cut-down source tree when starting form the full source tree,
+do the following:
+
+cd xc
+rm -fr doc fonts test util
+rm -fr lib/FS lib/ICE lib/PEX5 lib/SM lib/XIE
+rm -fr lib/Xaw lib/Xbsd lib/Xext lib/Xi lib/Xmu lib/Xt lib/Xtst lib/oldX
+rm -fr programs/[a-z]*
+rm -fr programs/Xserver/hw/[a-wy-z]*
+
+3. To start the build, run:
+
+ make World
+
+For some OSs you need to set BOOTSTRAPCFLAGS. Refer to the appropriate
+OS-specific README for information about this.
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/ServersOnly,v 3.7 1996/12/23 06:45:18 dawes Exp $
+
+
+
+
+
+$XConsortium: ServersOnly /main/5 1996/02/21 17:44:35 kaleb $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/VideoBoard98 b/xc/programs/Xserver/hw/xfree86/doc/VideoBoard98
new file mode 100644
index 000000000..82082a76a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/VideoBoard98
@@ -0,0 +1,387 @@
+DATE:990718
+ XFree86 PC98 Server
+ Video System List
+
+
+STATUS MEM(Video RAM) HiC(High Color support)
+ O : Working(Very fine) q : 256KB O : Working
+ o : Working(with small problems) h : 512KB X : Not supported
+ U : Working(Unstable) 1 : 1MB
+ X : Not Working/Not supported 2 : 2MB
+ o? : Probably work 3 : 3MB
+ x? : Probably NOT work 4 : 4MB
+ D : Developping 8 : 8MB
+ ? : Unknown
+
+
+NEC
++------------------------+---------------+-------+--------+-+-------+-+
+| | | | |M| |H|
+| MODEL | CHIP | DAC | CLOCK |E|STATUS |i|
+| | | | |M| |C|
++------------------------+---------------+-------+--------+-+-------+-+
+|EGC |EGC | B/I | B/I | | X |X|
+|PEGC |PEGC | B/I | B/I | | X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+|WAB-A (PC-9821A-E01) |S3-928 |Bt481 |ICS2494 |1| X | |
+|WAB-A2 (PC-9821A-E11) |MGA II | | |2| X | |
+|WAB-B (PC-9801-85) |S3-928 |Bt481 |ICS2494 |1| X | |
+|WAB-B3 (PC-9801-96) |CLGD5428 | B/I | B/I |1| X |X|
+|FC-WAB-A (PC-9821A-E09) |S3-928 |Bt485 |ICS2494 |2| X | |
+|FC-WAB-B (PC-9801-91) |S3-928 |Bt485 |ICS2494 |2| X | |
+|FC-WAB-X (PC-9821X-B01) |MGA II | | |2| X | |
+|FC-WAB-X2(PC-9821X-B03) |MGA2064W |Ti3026 |Ti3026 |2| o? |O|
+|MSWIN KIT(PC-9801B3-E02)|CLGD5428 | B/I | B/I |1| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821As2/U7W/U8W |S3-928E | | |1| X | |
+|PC9821As3 |S3-864 |S3-SDAC|S3-SDAC |2| X |O|
+|PC9821Ap2/U8W/C9W |S3-928E | | |1| X | |
+|PC9821Ap2/C9T |MGA II | | |2| X | |
+|PC9821Ap3 |S3-864 |S3-SDAC|S3-SDAC |2| X |O|
+|PC9821Af/M9W/U9W |S3-928 |Bt485 |ICS2494 |2| X | |
+|PC9821An/U8W |S3-928 |Bt485 |ICS2494 |2| X | |
+|PC9821An/C9T |MGA II | | |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Bf/U8W |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Bp/U8W/U7W |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Bs/U7W |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Be/U7W |CLGD5428 | B/I | B/I |1| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9801BA3/U2/W |CLGD5428 | B/I | B/I |1| X |X|
+|PC9801BX3/U2/W |CLGD5428 | B/I | B/I |1| X |X|
+|PC9801BX4/U2 |CLGD5430 | B/I | B/I |1| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Xt |MGA II | | |4| X | |
+|PC9821Xt13 |MGA2064W |Ti3026 |Ti3026 |4| o? |O|
+|PC9821Xt16 |MGA2064W |Ti3026 |Ti3026 |4| o? |O|
+|PC9821St15 |MGA2064W |Ti3026 |Ti3026 |4| o? |O|
+|PC9821St20 |MGA2064W |Ti3026 |Ti3026 |4| o? |O|
+|PC9821Xa |MGA II | | |2| X | |
+|PC9821Xa7/C,K |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa9/C,K |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa10/C,K |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa12/C,K |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa13/C,K |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa13/W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Xa16/R |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xa16/W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Xa20/D,W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Xa200/D,W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Xb10 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Xc13/M,S |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xc13/S5 |CLGD5446 | B/I | B/I |1| X |X|
+|PC9821Xc16/M,S |CLGD5446 | B/I | B/I |2| X |X|
+|PC9821Xc200/M,S |CLGD5446 | B/I | B/I |2| X |X|
+|PC9821Xa7e |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Xn |S3-864 |S3-SDAC|S3-SDAC |2| X | |
+|PC9821Xf |MGA II | | |2| X | |
+|PC9821Xp |S3-864 |S3-SDAC|S3-SDAC |2| X |O|
+|PC9821Xs |S3-864 |S3-SDAC|S3-SDAC |2| X |O|
+|PC9821Xe |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Xe10 |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Xv13/R |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821Xv13/W |MGA2064W |Ti3026 |Ti3026 |2| o? |O|
+|PC9821Xv20/W |MGA2064W |Ti3026 |Ti3026 |4| o? |O|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821V7/C |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V10/C,S |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V12/S |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V13/S |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V16/S |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V16/S5V,P |CLGD5446 | B/I | B/I |2| X |X|
+|PC9821V20/S7 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821V13/M7 |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821V16/M7 |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821V20/M7 |TGUI9680 | B/I | B/I |2| X |O|
+|PC9821V166/S |MGA1064SG | B/I | B/I |2| O? |O|
+|PC9821V200/S |MGA1064SG | B/I | B/I |2| O? |O|
+|PC9821V200/M7 |MGA1064SG | B/I | B/I |4| O |O|
+|PC9821V200/MZ |MGA1064SG | B/I | B/I |4| O |O|
+|PC9821V200/M7C2,M7D2 |MGA1064SG | B/I | B/I |4| O |O|
+|PC9821V233/M7 |MGA1064SG | B/I | B/I |2| O? |O|
+|PC9821V233/M7V |MGA1064SG | B/I | B/I |4| O? |O|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Ce |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Ce2 |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Cs |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Cs2 |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821Cf |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Cx |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Cx2 |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Cx3 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Cb |CLGD5430 | B/I | B/I |1| X |X|
+|PC9821Cb3 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Cx13 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Cu10 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Cu10/D |CLGD5446 | B/I | B/I |1| X |X|
+|PC9821Cr13 |CLGD5440 | B/I | B/I |1| X |X|
+|PC9821Ct16 |CLGD5446 | B/I | B/I |2| X |X|
+|PC9821Cu13/E,T |ProVidia9685 | B/I | B/I |2| X |X|
+|PC9821Cu16/H |ProVidia9685 | B/I | B/I |2| X |X|
+|PC9821Ct20/A |ProVidia9685 | B/I | B/I |2| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Ra18/N |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Ra20/N |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Ra266/D,N,W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821Rv20/N20 |MGA2064W |Ti3026 |Ti3026 |4| o |O|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821RaII23/N,W |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821RvII26/N20 |MGA2064W |Ti3026 |Ti3026 |4| o |O|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Rs20/B20 |TGUI9682 | B/I | B/I |2| X |O|
+|PC9821RsII26/B40 |TGUI9682 | B/I | B/I |2| X |O|
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821C166/C |3Dimage975 | | |4| X | |
+|PC9821C166/D |ProVidia9685 | B/I | B/I |2| X | |
+|PC9821C200/C,V |ProVidia9685 | B/I | B/I |2| X | |
+|PC9821C233/V |3Dimage975 | | |4| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Es |CLGD5428 | B/I | B/I |1| X |X|
+|PC9821F200/X20 |ProVidia9685 | B/I | B/I |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Ne2 |CLGD5428 | B/I | B/I |1| X | |
+|PC9821Np |CLGD5428 | B/I | B/I |1| X | |
+|PC9821Nf |CLGD5428 | B/I | B/I |1| X | |
+|PC9821Ns |CLGD5428 | B/I | B/I |1| X | |
+|PC9821Nd |CLGD5428 | B/I | B/I |1| X | |
+|PC9821Ne3 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Nd2 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Na7/HC,H |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Na9/H |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Na12 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Na12/S |CLGD7548 | B/I | B/I |1| X | |
+|PC9821Na13/H,C |CLGD7548 | B/I | B/I |1| X | |
+|PC9821Na15/X |Cyber9382 | B/I | B/I |2| X | |
+|PC9821Nb7 |CLGD7543 | B/I | B/I |1| X | |
+|PC9821Nb7/C,D |CLGD7543 | B/I | B/I |1| X | |
+|PC9821Nb10 |CLGD7548 | B/I | B/I |1| X | |
+|PC9821Nx/3,C7 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821Nr12 |CLGD7555 | B/I | B/I |2| X | |
+|PC9821Nr13/D10 |CLGD7555 | B/I | B/I |2| X | |
+|PC9821Nr13/D14,S14 |CLGD7556 | B/I | B/I |2| X | |
+|PC9821Nr15 |Cyber9385 | B/I | B/I |2| X | |
+|PC9821Nr150 |Cyber9385 | B/I | B/I |2| X | |
+|PC9821Nr150/S20 |Cyber9385-1 | B/I | B/I |2| X | |
+|PC9821Nr166 |Cyber9385 | B/I | B/I |2| X | |
+|PC9821Nw133 |Cyber9385-1 | B/I | B/I |2| X | |
+|PC9821Nw150 |Cyber9385-1 | B/I | B/I |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Lt2 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821La7 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821La10 |Cyber9320 | B/I | B/I |1| X | |
+|PC9821La13 |CLGD7555 | B/I | B/I |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821Ls12 |CLGD7555 | B/I | B/I |2| X | |
+|PC9821Ls13 |CLGD7555 | B/I | B/I |2| X | |
+|PC9821Ls13 |CLGD7556 | B/I | B/I |2| X | |
+|PC9821Ls150 |CLGD7555 | B/I | B/I |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+EPSON
++------------------------+---------------+-------+--------+-+-------+-+
+|PCSKB |S3-911 |Bt478 | |h| X |X|
+|PCSKB |S3-911 |Bt478 | |1| X |X|
+|PCSKB |S3-924 |Bt478 | |h| X |X|
+|PCSKB |S3-924 |Bt478 | |1| X |X|
+|PCSKB2 |S3-924 |Bt478 | |1| X |X|
+|PCSKB3 |S3-928 |20c491 | |1| X |X|
+|PCSKB4 |S3-928 |20c491 | |1| X | |
+|PCSKB4 |S3-928 |Bt485 | |2| X | |
+|PCSKB4 |S3-928 |Bt485 | |4| X | |
+|PCSKB5 |S3-964 | | | | X | |
+|PCPKB4 |S3-928 |20c491 | |1| X | |
+|PCPKB4 |S3-928 |Bt485 | |2| X | |
+|PCPKB4 |S3-928 |Bt485 | |4| X | |
+|PCPKB5 |S3-964 | | |2| X | |
+|PCHKB |S3-911 |Bt478 | |h| X | |
+|PCHKB |S3-911 |Bt478 | |1| X | |
+|PCHKB |S3-924 |Bt478 | |h| X | |
+|PCHKB |S3-924 |Bt478 | |1| X | |
+|PCHKB2 |S3-924 |Bt478 | |1| X | |
+|PCHKB4 |S3-928 | | |1| X | |
+|PCLKB |WD90C24 | B/I | |1| X | |
+|PCLKB2 |WD90C24 | B/I | |1| X | |
+|PCLSV |WD90C24 | B/I | |1| X | |
+|PCLSV2 |WD90C24 | B/I | |1| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC586RA |S3-964 | | |1| X | |
+|PC586RX |S3-964 | | |1| X | |
+|PC586RT |S3-964 | | |1| X | |
+|PC586RJ |S3-964 | | |1| X | |
+|PC586RV |CLGD5429 | B/I | B/I |1| X |X|
+|PC586MV |CLGD5428 | B/I | B/I |1| X |X|
+|PC486MU |CLGD5429 | B/I | B/I |1| X |X|
+|PC486MS |CLGD5428 | B/I | B/I |1| X |X|
+|PC486MR |CLGD5428 | B/I | B/I |1| X |X|
+|PC486MV |CLGD5428 | B/I | B/I |1| X |X|
+|PC486ME |TGUI9660 | B/I | B/I |1| X | |
+|PC486HA3/JW |S3-964 | | |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+|PC486NAT |CLGD7543 | B/I | B/I |1| X | |
+|PC586NAT |CLGD7543 | B/I | B/I |1| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+Frontier Kojiro
++------------------------+---------------+-------+--------+-+-------+-+
+|PC9821As2 HYPER |S3-928E | | |1| X | |
+|PC9821Bs HYPER |CLGD5428 | B/I | B/I |1| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+
+Canopus
++------------------------+---------------+-------+--------+-+-------+-+
+|Power Window |S3-924 |SC11487|ICS2494M|1| X | |
+|Power WindowNP |S3-924 | | |1| X | |
+|Power Window801 |S3-801 |SC15026|ICD2051A|1| X | |
+|Power Window801G |S3-801 |SC15026|ICD2051A|1| X | |
+|Power Window801+ |S3-801 |SC15026|ICD2051A|1| X | |
+|Power Window801+ |S3-801 |SC15026|ICD2051A|2| X | |
+|Power Window805i |S3-805i |S3-SDAC|S3-SDAC |2| X | |
+|Power Window928 |S3-928D |SC15026|ICD2051A|1| X |O|
+|Power Window928 |S3-928D |SC15026|ICD2051A|2| X |O|
+|Power Window928G |S3-928G |SC15026|ICD2051A|1| X |O|
+|Power Window928G |S3-928G |SC15026|ICD2051A|2| X |O|
+|Power Window928II |S3-928G |Bt485 |ICD2051A|2| X |O|
+|Power Window928II |S3-928D |20c505 |ICD2051A|2| X |O|
+|Power Window928GLB |S3-928G |SC15026|ICD2051A|1| X |O|
+|Power Window928GLB |S3-928G |SC15026|ICD2051A|2| X |O|
+|Power Window928IILB |S3-928G |Bt485 |ICD2051A|2| X | |
+|Power Window928IILB |S3-928 |20c505 |ICD2051A|2| X | |
+|Power Window964LB |S3-964 |Ti3025 | |2| X |O|
+|Power Window964LB |S3-964 |Ti3025 | |4| X |O|
+|Power Window968 |S3-968 | | |2| X | |
+|Power Window968 |S3-968 | | |4| X | |
+|Power Window9100PCI |Powe9100 |20c505 |ICD2061A|2| X | |
+|Power Window9100PCI |Powe9100 |RGB525 |RGB525 |4| X | |
+|Power Window9130C-PCI |Powe9100 | | |4| X | |
+|Power WindowT64EL |S3-Trio64 | B/I | B/I | | X | |
+|Power WindowT64S |S3-Trio64 | B/I | B/I |2| X | |
+|Power WindowT64V Card |S3-Trio64V+ | B/I | B/I |2| X | |
+|Power Window6410VA |PM6410 | B/I | B/I |1| X | |
+|Power Window6410VA |PM6410 | B/I | B/I |2| X | |
+|Power WindowDX |S3-ViRGE/DX | B/I | B/I |4| X | |
+|Power WindowDX/4MC |S3-ViRGE/DX | B/I | B/I |4| X | |
+|Power WindowGX/4VC |S3-ViRGE/GX | B/I | B/I |4| X | |
+|Power WindowGMX |GLINT MX |RGB526 | |8| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+MELCO
++------------------------+---------------+-------+--------+-+-------+-+
+|WAB-S |CLGD5426 | B/I | B/I |1| X |X|
+|WAB-S |CLGD5428 | B/I | B/I |1| X |X|
+|WAB-1000 |CLGD5428 | B/I | B/I |1| X |X|
+|WAB-2000 |CLGD5428 | B/I | B/I |2| X |X|
+|WAB-EP |CLGD5428 | B/I | B/I |1| X |X|
+|WSR-E |CLGD5428 | B/I | B/I |1| X |X|
+|WSR-G |CLGD5428 | B/I | B/I |1| X |X|
+|NMB-S |CLGD5428 | B/I | B/I |1| X |X|
+|NMG-G (note) |CLGD5428 | B/I | B/I |1| X |X|
+|NMG-S4F(note) |CLGD5428 | B/I | B/I |1| X |X|
+|WSP-L |Power9000 | | | | X | |
+|WAP-2000 |CLGD5434 | B/I | B/I |2| X |X|
+|WAP-4000 |CLGD5434 | B/I | B/I |4| X |X|
+|WSN-A2F |CLGD5434 | B/I | B/I |2| X |X|
+|WSN-V2 |S3-Trio64V+ | B/I | B/I |2| X | |
+|WSN-DX2 |S3-Trio64V2/DX | B/I | B/I |2| X | |
+|WSN-DX4 |S3-Trio64V2/DX | B/I | B/I |4| X | |
+|WGN-A2 |CLGD5434 | B/I | B/I |2| X |X|
+|WGN-A4 |CLGD5434 | B/I | B/I |4| X |X|
+|WGN-V2 |S3-Trio64V+ | B/I | B/I |2| X | |
+|WGN-DX2 |S3-Trio64V2/DX | B/I | B/I |2| X | |
+|WGN-DX4 |S3-Trio64V2/DX | B/I | B/I |4| X | |
+|WAP-2EP |CLGD5434 | B/I | B/I |2| X |X|
+|WAP-4EP |CLGD5434 | B/I | B/I |4| X |X|
+|WGP-VG2 |S3-ViRGE | B/I | B/I |2| X | |
+|WGP-VG4 |S3-ViRGE | B/I | B/I |4| X | |
+|WGP-VG2DX |S3-ViRGE/DX | B/I | B/I |2| X | |
+|WGP-VG4DX |S3-ViRGE/DX | B/I | B/I |4| X | |
+|WGP-VX8 |S3-ViRGE/VX | B/I | B/I |8| X | |
+|WHP-PS8 |PERMEDIA2 | | |8| X | |
+|WHP-PS4 |PERMEDIA2 | | |4| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+IO DATA
++------------------------+---------------+-------+--------+-+-------+-+
+|GA-1024/A/AL/NL |ORIGINAL | | |1| X | |
+|GA-1280/AL |ORIGINAL | | |2| X | |
+|GA-98NBI/C,SB16-GA98 |CLGD5434 | B/I | B/I |1| X |X|
+|GA-98NB II |CLGD5434 | B/I | B/I |2| X |X|
+|GA-98NB IV |CLGD5434 | B/I | B/I |4| X |X|
+|GA-DR2/98 |TGUI9660 | B/I | B/I |2| X |X|
+|GA-DR4/98 |TGUI9660 | B/I | B/I |4| X |X|
+|GA-DR2/PCI |TGUI9660 | B/I | B/I |2| X | |
+|GA-DR4/PCI |TGUI9660 | B/I | B/I |4| X | |
+|GA-DRV2/98 |TGUI9680 | B/I | B/I |2| X |X|
+|GA-DRV4/98 |TGUI9680 | B/I | B/I |4| X |X|
+|GA-DRV2/PCI |TGUI9680 | B/I | B/I |2| X | |
+|GA-DRV4/PCI |TGUI9680 | B/I | B/I |4| X | |
+|GA-DRTV2/98PCI |TGUI9682 | B/I | B/I |2| X | |
+|GA-DRTV4/98PCI |TGUI9682 | B/I | B/I |4| X | |
+|GA-968V2/98PCI |S3-968 |RGB524 | RGB524 |2| X |O|
+|GA-968V4/98PCI |S3-968 |RGB524 | RGB524 |4| X |O|
+|GA-PGDX2/98PCI |S3-ViRGE/DX | B/I | B/I |2| X | |
+|GA-PGDX4/98PCI |S3-ViRGE/DX | B/I | B/I |4| X | |
+|GA-PG3D2/98PCI |S3-ViRGE | B/I | B/I |2| X | |
+|GA-PG3D4/98PCI |S3-ViRGE | B/I | B/I |4| X | |
+|GA-PG3DVX4/98PCI |S3-ViRGE/VX | B/I | B/I |4| X | |
+|GA-PG3DVX8/98PCI |S3-ViRGE/VX | B/I | B/I |8| X | |
+|GA-PII8/PCI |PERMEDIA2 | | |8| X | |
+|GA-PIIH8/PCI |PERMEDIA2 | | |8| X | |
+|GA-RUSH6/PCI |Promotion AT25 | | |4| D | |
+| |Voodoo RUSH | | |2| | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+ICM
++------------------------+---------------+-------+--------+-+-------+-+
+|GI-5434-2M |CLGD5434 | B/I | B/I |2| X |X|
+|GI-5434-4M |CLGD5434 | B/I | B/I |4| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+MIDORI
++------------------------+---------------+-------+--------+-+-------+-+
+|GAB-981 |CLGD5428 | B/I | B/I |1| X |X|
+|GAB-982-00 |CLGD5428 | B/I | B/I |1| X |X|
+|GAB-983-00 |CLGD5428 | B/I | B/I |1| X |X|
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+Q-Vision
++------------------------+---------------+-------+--------+-+-------+-+
+|WinNote98 |CLGD5428 | B/I | B/I |1| X |X|
+|WinDuo |S3-Trio64 | B/I | B/I |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+Sapiens
++------------------------+---------------+-------+--------+-+-------+-+
+|SuperCube/C4 type A |S3-928 | | |3| X | |
+|SuperCube/C4 type B |S3-928 | | |3| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+Hachinohe Firmware System(HFS)
++------------------------+---------------+-------+--------+-+-------+-+
+|HighResoStation(note) | | | | | X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+
+Sumitomo Kinzoku
++------------------------+---------------+-------+--------+-+-------+-+
+|MGA98 W2 |MGA II | | |2| X | |
+|MGA98 W3 |MGA II | | |3| X | |
+|MGA98 3D,3DH |MGA II | | | | X | |
+|MGA98-PCI/2 |MGA II | | |2| X | |
+|MGA98-PCI/4 |MGA II | | |4| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+Force
++------------------------+---------------+-------+--------+-+-------+-+
+|WinFrame |TMS34020 | | | | X | |
+|WinFrame928 |S3-928 | | |2| X | |
++------------------------+---------------+-------+--------+-+-------+-+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/doc/VideoBoard98,v 1.2 1999/07/19 13:36:17 dawes Exp $ */
diff --git a/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc b/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc
new file mode 100644
index 000000000..25690d4fc
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc
@@ -0,0 +1,1322 @@
+ XFree86 Video Timings HOWTO
+
+ Eric S. Raymond <esr@thyrsus.com>
+
+ Version 3.0, 8 Aug 1997
+
+ Abstract
+
+ How to compose a mode line for your card/monitor combination under
+ XFree86. The XFree86 distribution now includes good facilities for
+ configuring most standard combinations; this document is mainly
+ useful if you are tuning a custom mode line for a high-performance
+ monitor or very unusual hardware. It may also help you in using
+ xvidtune to tweak a standard mode that is not quite right for your
+ monitor.
+
+1. Disclaimer
+
+You use the material herein SOLELY AT YOUR OWN RISK. It is possible to harm
+both your monitor and yourself when driving it outside the manufacturer's
+specs. Read Overdriving Your Monitor (section 11., page 1) for detailed cau-
+tions. Any damages to you or your monitor caused by overdriving it are your
+problem.
+
+The most up-to-date version of this HOWTO can be found at the Linux Documen-
+tation Project <URL:http://sunsite.unc.edu/LDP> web page.
+
+Please direct comments, criticism, and suggestions for improvement to
+esr@snark.thyrsus.com. Please do not send email pleading for a magic solution
+to your special monitor problem, as doing so will only burn up my time and
+frustrate you -- everything I know about the subject is already in here.
+
+2. Introduction
+
+The XFree86 server allows users to configure their video subsystem and thus
+encourages best use of existing hardware. This tutorial is intended to help
+you learn how to generate your own timing numbers to make optimum use of your
+video card and monitor.
+
+We'll present a method for getting something that works, and then show you
+how you can experiment starting from that base to develop settings that opti-
+mize for your taste.
+
+Starting with XFree86 3.2, XFree86 provides an XF86Setup(1) program that
+makes it easy to generate a working monitor mode interactively, without mess-
+ing with video timing number directly. So you shouldn't actually need to
+calculate a base monitor mode in most cases. Unfortunately, XF86Setup(1) has
+some limitations; it only knows about standard video modes up to 1280x1024.
+If you have a very high-performance monitor capable of 1600x1200 or more you
+will still have to compute your base monitor mode yourself.
+
+Recent versions of XFree86 provide a tool called xvidtune(1) which you will
+probably find quite useful for testing and tuning monitor modes. It begins
+with a gruesome warning about the possible consequences of mistakes with it.
+If you pay careful attention to this document and learn what is behind the
+pretty numbers in xvidtune's boxes, you will become able to use xvidtune
+effectively and with confidence.
+
+If you already have a mode that almost works (in particular, if one of prede-
+fined VESA modes gives you a stable display but one that's displaced right or
+left, or too small, or too large) you can go straight to the section on Fix-
+ing Problems with the Image (section 14., page 1). This will enlighten you
+on ways to tweak the timing numbers to achieve particular effects.
+
+If you have xvidtune(1), you'll be able to test new modes on the fly, without
+modifying your X configuration files or even rebooting your X server. Other-
+wise, XFree86 allows you to hot-key between different modes defined in Xcon-
+fig (see XFree86.man for details). Use this capabilty to save yourself has-
+sles! When you want to test a new mode, give it a unique mode label and add
+it to the end of your hot-key list. Leave a known-good mode as the default
+to fall back on if the test mode doesn't work.
+
+3. How Video Displays Work
+
+Knowing how the display works is essential to understanding what numbers to
+put in the various fields in the file Xconfig. Those values are used in the
+lowest levels of controlling the display by the XFree86 server.
+
+The display generates a picture from a series of dots. The dots are arranged
+from left to right to form lines. The lines are arranged from top to bottom
+to form the picture. The dots emit light when they are struck by the elec-
+tron beam inside the display. To make the beam strike each dot for an equal
+amount of time, the beam is swept across the display in a constant pattern.
+
+The pattern starts at the top left of the screen, goes across the screen to
+the right in a straight line, and stops temporarily on the right side of the
+screen. Then the beam is swept back to the left side of the display, but
+down one line. The new line is swept from left to right just as the first
+line was. This pattern is repeated until the bottom line on the display has
+been swept. Then the beam is moved from the bottom right corner of the dis-
+play to the top left corner, and the pattern is started over again.
+
+There is one variation of this scheme known as interlacing: here only every
+second line is swept during one half-frame and the others are filled in in
+during a second half-frame.
+
+Starting the beam at the top left of the display is called the beginning of a
+frame. The frame ends when the beam reaches the the top left corner again as
+it comes from the bottom right corner of the display. A frame is made up of
+all of the lines the beam traced from the top of the display to the bottom.
+
+If the electron beam were on all of the time it was sweeping through the
+frame, all of the dots on the display would be illuminated. There would be
+no black border around the edges of the display. At the edges of the display
+the picture would become distorted because the beam is hard to control there.
+To reduce the distortion, the dots around the edges of the display are not
+illuminated by the beam even though the beam may be pointing at them. The
+viewable area of the display is reduced this way.
+
+Another important thing to understand is what becomes of the beam when no
+spot is being painted on the visible area. The time the beam would have been
+illuminating the side borders of the display is used for sweeping the beam
+back from the right edge to the left and moving the beam down to the next
+line. The time the beam would have been illuminating the top and bottom bor-
+ders of the display is used for moving the beam from the bottom-right corner
+of the display to the top-left corner.
+
+The adapter card generates the signals which cause the display to turn on the
+electron beam at each dot to generate a picture. The card also controls when
+the display moves the beam from the right side to the left and down a line by
+generating a signal called the horizontal sync (for synchronization) pulse.
+One horizontal sync pulse occurs at the end of every line. The adapter also
+generates a vertical sync pulse which signals the display to move the beam to
+the top-left corner of the display. A vertical sync pulse is generated near
+the end of every frame.
+
+The display requires that there be short time periods both before and after
+the horizontal and vertical sync pulses so that the position of the electron
+beam can stabilize. If the beam can't stabilize, the picture will not be
+steady.
+
+In a later section, we'll come back to these basics with definitions, formu-
+las and examples to help you use them.
+
+4. Basic Things to Know about your Display and Adapter
+
+There are some fundamental things you need to know before hacking an Xconfig
+entry. These are:
+
+ o your monitor's horizontal and vertical sync frequency options
+
+ o your video adapter's driving clock frequency, or "dot clock"
+
+ o your monitor's bandwidth
+
+The monitor sync frequencies:
+
+The horizontal sync frequency is just the number of times per second the mon-
+itor can write a horizontal scan line; it is the single most important
+statistic about your monitor. The vertical sync frequency is the number of
+times per second the monitor can traverse its beam vertically.
+
+Sync frequencies are usually listed on the specifications page of your moni-
+tor manual. The vertical sync frequency number is typically calibrated in Hz
+(cycles per second), the horizontal one in KHz (kilocycles per second). The
+usual ranges are between 50 and 150Hz vertical, and between 31 and 135KHz
+horizontal.
+
+If you have a multisync monitor, these frequencies will be given as ranges.
+Some monitors, especially lower-end ones, have multiple fixed frequencies.
+These can be configured too, but your options will be severely limited by the
+built-in monitor characteristics. Choose the highest frequency pair for best
+resolution. And be careful --- trying to clock a fixed-frequency monitor at
+a higher speed than it's designed for can easily damage it.
+
+Earlier versions of this guide were pretty cavalier about overdriving multi-
+sync monitors, pushing them past their nominal highest vertical sync fre-
+quency in order to get better performance. We have since had more reasons
+pointed out to us for caution on this score; we'll cover those under Over-
+driving Your Monitor (section 11., page 1) below.
+
+The card driving clock frequency:
+
+Your video adapter manual's spec page will usually give you the card's dot
+clock (that is, the total number of pixels per second it can write to the
+screen). If you don't have this information, the X server will get it for
+you. Even if your X locks up your monitor, it will emit a line of clock and
+other info to standard output. If you redirect this to a file, it should be
+saved even if you have to reboot to get your console back. (Recent versions
+of the X servers allsupport a --probeonly option that prints out this infor-
+mation and exits without actually starting up X or changing the video mode.)
+
+Your X startup message should look something like one of the following exam-
+ples:
+
+If you're using XFree86:
+
+ Xconfig: /usr/X11R6/lib/X11/Xconfig
+ (**) stands for supplied, (--) stands for probed/default values
+ (**) Mouse: type: MouseMan, device: /dev/ttyS1, baudrate: 9600
+ Warning: The directory "/usr/andrew/X11fonts" does not exist.
+ Entry deleted from font path.
+ (**) FontPath set to "/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/"
+ (--) S3: card type: 386/486 localbus
+ (--) S3: chipset: 924
+ ---
+ Chipset -- this is the exact chip type; an early mask of the 86C911
+
+ (--) S3: chipset driver: s3_generic
+ (--) S3: videoram: 1024k
+ -----
+ Size of on-board frame-buffer RAM
+
+ (**) S3: clocks: 25.00 28.00 40.00 3.00 50.00 77.00 36.00 45.00
+ (**) S3: clocks: 0.00 0.00 79.00 31.00 94.00 65.00 75.00 71.00
+ ------------------------------------------------------
+ Possible driving frequencies in MHz
+
+ (--) S3: Maximum allowed dot-clock: 110MHz
+ ------
+ Bandwidth
+ (**) S3: Mode "1024x768": mode clock = 79.000, clock used = 79.000
+ (--) S3: Virtual resolution set to 1024x768
+ (--) S3: Using a banksize of 64k, line width of 1024
+ (--) S3: Pixmap cache:
+ (--) S3: Using 2 128-pixel 4 64-pixel and 8 32-pixel slots
+ (--) S3: Using 8 pages of 768x255 for font caching
+
+If you're using SGCS or X/Inside X:
+
+ WGA: 86C911 (mem: 1024k clocks: 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71)
+ --- ------ ----- --------------------------------------------
+ | | | Possible driving frequencies in MHz
+ | | +-- Size of on-board frame-buffer RAM
+ | +-- Chip type
+ +-- Server type
+
+Note: do this with your machine unloaded (if at all possible). Because X is
+an application, its timing loops can collide with disk activity, rendering
+the numbers above inaccurate. Do it several times and watch for the numbers
+to stabilize; if they don't, start killing processes until they do. SVr4
+users: the mousemgr process is particularly likely to mess you up.
+
+In order to avoid the clock-probe inaccuracy, you should clip out the clock
+timings and put them in your Xconfig as the value of the Clocks property ---
+this suppresses the timing loop and gives X an exact list of the clock values
+it can try. Using the data from the example above:
+
+ wga
+ Clocks 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71
+
+On systems with a highly variable load, this may help you avoid mysterious X
+startup failures. It's possible for X to come up, get its timings wrong due
+to system load, and then not be able to find a matching dot clock in its con-
+fig database --- or find the wrong one!
+
+4.1 The monitor's video bandwidth:
+
+If you're running XFree86, your server will probe your card and tell you what
+your highest-available dot clock is.
+
+Otherwise, your highest available dot clock is approximately the monitor's
+video bandwidth. There's a lot of give here, though --- some monitors can
+run as much as 30% over their nominal bandwidth. The risks here have to do
+with exceeding the monitor's rated vertical-sync frequency; we'll discuss
+them in detail below.
+
+Knowing the bandwidth will enable you to make more intelligent choices
+between possible configurations. It may affect your display's visual quality
+(especially sharpness for fine details).
+
+Your monitor's video bandwidth should be included on the manual's spec page.
+If it's not, look at the monitor's higest rated resolution. As a rule of
+thumb, here's how to translate these into bandwidth estimates (and thus into
+rough upper bounds for the dot clock you can use):
+
+ 640x480 25
+ 800x600 36
+ 1024x768 65
+ 1024x768 interlaced 45
+ 1280x1024 110
+ 1600x1200 185
+
+BTW, there's nothing magic about this table; these numbers are just the low-
+est dot clocks per resolution in the standard XFree86 Modes database (except
+for the last, which I interpolated). The bandwidth of your monitor may actu-
+ally be higher than the minimum needed for its top resolution, so don't be
+afraid to try a dot clock a few MHz higher.
+
+Also note that bandwidth is seldom an issue for dot clocks under 65MHz or so.
+With an SVGA card and most hi-res monitors, you can't get anywhere near the
+limit of your monitor's video bandwidth. The following are examples:
+
+ Brand Video Bandwidth
+ ---------- ---------------
+ NEC 4D 75Mhz
+ Nano 907a 50Mhz
+ Nano 9080i 60Mhz
+ Mitsubishi HL6615 110Mhz
+ Mitsubishi Diamond Scan 100Mhz
+ IDEK MF-5117 65Mhz
+ IOCOMM Thinksync-17 CM-7126 136Mhz
+ HP D1188A 100Mhz
+ Philips SC-17AS 110Mhz
+ Swan SW617 85Mhz
+ Viewsonic 21PS 185Mhz
+
+Even low-end monitors usually aren't terribly bandwidth-constrained for their
+rated resolutions. The NEC Multisync II makes a good example --- it can't
+even display 800x600 per its spec. It can only display 800x560. For such
+low resolutions you don't need high dot clocks or a lot of bandwidth; proba-
+bly the best you can do is 32Mhz or 36Mhz, both of them are still not too far
+from the monitor's rated video bandwidth of 30Mhz.
+
+At these two driving frequencies, your screen image may not be as sharp as it
+should be, but definitely of tolerable quality. Of course it would be nicer
+if NEC Multisync II had a video bandwidth higher than, say, 36Mhz. But this
+is not critical for common tasks like text editing, as long as the difference
+is not so significant as to cause severe image distortion (your eyes would
+tell you right away if this were so).
+
+4.2 What these control:
+
+The sync frequency ranges of your monitor, together with your video adapter's
+dot clock, determine the ultimate resolution that you can use. But it's up
+to the driver to tap the potential of your hardware. A superior hardware
+combination without an equally competent device driver is a waste of money.
+On the other hand, with a versatile device driver but less capable hardware,
+you can push the hardware's envelope a little. This is the design philosophy
+of XFree86.
+
+5. Interpreting the Basic Specifications
+
+This section explains what the specifications above mean, and some other
+things you'll need to know. First, some definitions. Next to each in parens
+is the variable name we'll use for it when doing calculations
+
+ horizontal sync frequency (HSF)
+ Horizontal scans per second (see above).
+
+ vertical sync frequency (VSF)
+ Vertical scans per second (see above). Mainly important as the
+ upper limit on your refresh rate.
+
+ dot clock (DCF)
+ More formally, `driving clock frequency'; The frequency of the
+ crystal or VCO on your adaptor --- the maximum dots-per-second it
+ can emit.
+
+ video bandwidth (VB)
+ The highest frequency you can feed into your monitor's video
+ input and still expect to see anything discernible. If your adap-
+ tor produces an alternating on/off pattern, its lowest frequency
+ is half the DCF, so in theory bandwidth starts making sense at
+ DCF/2. For tolerately crisp display of fine details in the video
+ image, however, you don't want it much below your highest DCF,
+ and preferably higher.
+
+ frame length (HFL, VFL)
+ Horizontal frame length (HFL) is the number of dot-clock ticks
+ needed for your monitor's electron gun to scan one horizontal
+ line, including the inactive left and right borders. Vertical
+ frame length (VFL) is the number of scan lines in the entire
+ image, including the inactive top and bottom borders.
+
+ screen refresh rate (RR)
+ The number of times per second your screen is repainted (this is
+ also called "frame rate"). Higher frequencies are better, as
+ they reduce flicker. 60Hz is good, VESA-standard 72Hz is better.
+ Compute it as
+
+ RR = DCF / (HFL * VFL)
+
+ Note that the product in the denominator is not the same as the
+ monitor's visible resolution, but typically somewhat larger.
+ We'll get to the details of this below.
+
+ The rates for which interlaced modes are usually specified (like
+ 87Hz interlaced) are actually the half-frame rates: an entire
+ screen seems to have about that flicker frequency for typical
+ displays, but every single line is refreshed only half as often.
+
+ For calculation purposes we reckon an interlaced display at its
+ full-frame (refresh) rate, i.e. 43.5Hz. The quality of an inter-
+ laced mode is better than that of a non-interlaced mode with the
+ same full-frame rate, but definitely worse then the non-inter-
+ laced one corresponding to the half-frame rate.
+
+5.1 About Bandwidth:
+
+Monitor makers like to advertise high bandwidth because it constrains the
+sharpness of intensity and color changes on the screen. A high bandwidth
+means smaller visible details.
+
+Your monitor uses electronic signals to present an image to your eyes. Such
+signals always come in in wave form once they are converted into analog form
+from digitized form. They can be considered as combinations of many simpler
+wave forms each one of which has a fixed frequency, many of them are in the
+Mhz range, eg, 20Mhz, 40Mhz, or even 70Mhz. Your monitor video bandwidth is,
+effectively, the highest-frequency analog signal it can handle without dis-
+tortion.
+
+For our purposes, bandwidth is mainly important as an approximate cutoff
+point for the highest dot clock you can use.
+
+5.2 Sync Frequencies and the Refresh Rate:
+
+Each horizontal scan line on the display is just the visible portion of a
+frame-length scan. At any instant there is actually only one dot active on
+the screen, but with a fast enough refresh rate your eye's persistence of
+vision enables you to "see" the whole image.
+
+Here are some pictures to help:
+
+ _______________________
+ | | The horizontal sync frequency
+ |->->->->->->->->->->-> | is the number of times per
+ | )| second that the monitor's
+ |<-----<-----<-----<--- | electron beam can trace
+ | | a pattern like this
+ | |
+ | |
+ | |
+ |_______________________|
+ _______________________
+ | ^ | The vertical sync frequency
+ | ^ | | is the number of times per
+ | | v | second that the monitor's
+ | ^ | | electron beam can trace
+ | | | | a pattern like this
+ | ^ | |
+ | | v |
+ | ^ | |
+ |_______|_v_____________|
+
+Remember that the actual raster scan is a very tight zigzag pattern; that is,
+the beam moves left-right and at the same time up-down.
+
+Now we can see how the dot clock and frame size relates to refresh rate. By
+definition, one hertz (hz) is one cycle per second. So, if your horizontal
+frame length is HFL and your vertical frame length is VFL, then to cover the
+entire screen takes (HFL * VFL) ticks. Since your card emits DCF ticks per
+second by definition, then obviously your monitor's electron gun(s) can sweep
+the screen from left to right and back and from bottom to top and back DCF /
+(HFL * VFL) times/sec. This is your screen's refresh rate, because it's how
+many times your screen can be updated (thus refreshed) per second!
+
+You need to understand this concept to design a configuration which trades
+off resolution against flicker in whatever way suits your needs.
+
+For those of you who handle visuals better than text, here is one:
+
+ RR VB
+ | min HSF max HSF |
+ | | R1 R2 | |
+ max VSF -+----|------------/----------/---|------+----- max VSF
+ | |:::::::::::/::::::::::/:::::\ |
+ | \::::::::::/::::::::::/:::::::\ |
+ | |::::::::/::::::::::/:::::::::| |
+ | |:::::::/::::::::::/::::::::::\ |
+ | \::::::/::::::::::/::::::::::::\ |
+ | \::::/::::::::::/::::::::::::::| |
+ | |::/::::::::::/:::::::::::::::| |
+ | \/::::::::::/:::::::::::::::::\|
+ | /\:::::::::/:::::::::::::::::::|
+ | / \:::::::/::::::::::::::::::::|\
+ | / |:::::/:::::::::::::::::::::| |
+ | / \::::/::::::::::::::::::::::| \
+ min VSF -+----/-------\--/-----------------------|--\--- min VSF
+ | / \/ | \
+ +--/----------/\------------------------+----\- DCF
+ R1 R2 \ | \
+ min HSF | max HSF
+ VB
+
+This is a generic monitor mode diagram. The x axis of the diagram shows the
+clock rate (DCF), the y axis represents the refresh rate (RR). The filled
+region of the diagram describes the monitor's capabilities: every point
+within this region is a possible video mode.
+
+The lines labeled `R1' and `R2' represent a fixed resolutions (such as
+640x480); they are meant to illustrate how one resolution can be realized by
+many different combinations of dot clock and refresh rate. The R2 line would
+represent a higher resolution than R1.
+
+The top and bottom boundaries of the permitted region are simply horizontal
+lines representing the limiting values for the vertical sync frequency. The
+video bandwidth is an upper limit to the clock rate and hence is represented
+by a vertical line bounding the capability region on the right.
+
+Under Plotting Monitor Capabilities (section 15., page 1)) you'll find a pro-
+gram that will help you plot a diagram like this (but much nicer, with X
+graphics) for your individual monitor. That section also discusses the
+interesting part; the derivation of the boundaries resulting from the limits
+on the horizontal sync frequency.
+
+6. Tradeoffs in Configuring your System
+
+Another way to look at the formula we derived above is
+
+ DCF = RR * HFL * VFL
+
+That is, your dot clock is fixed. You can use those dots per second to buy
+either refresh rate, horizontal resolution, or vertical resolution. If one
+of those increases, one or both of the others must decrease.
+
+Note, though, that your refresh rate cannot be greater than the maximum ver-
+tical sync frequency of your monitor. Thus, for any given monitor at a given
+dot clock, there is a minimum product of frame lengths below which you can't
+force it.
+
+In choosing your settings, remember: if you set RR too low, you will get
+mugged by screen flicker.
+
+You probably do not want to pull your refresh rate below 60Hz. This is the
+flicker rate of fluorescent lights; if you're sensitive to those, you need to
+hang with 72Hz, the VESA ergonomic standard.
+
+Flicker is very eye-fatiguing, though human eyes are adaptable and peoples'
+tolerance for it varies widely. If you face your monitor at a 90% viewing
+angle, are using a dark background and a good contrasting color for fore-
+ground, and stick with low to medium intensity, you *may* be comfortable at
+as little as 45Hz.
+
+The acid test is this: open a xterm with pure white back-ground and black
+foreground using xterm -bg white -fg black and make it so large as to cover
+the entire viewable area. Now turn your monitor's intensity to 3/4 of its
+maximum setting, and turn your face away from the monitor. Try peeking at
+your monitor sideways (bringing the more sensitive peripheral-vision cells
+into play). If you don't sense any flicker or if you feel the flickering is
+tolerable, then that refresh rate is fine with you. Otherwise you better
+configure a higher refresh rate, because that semi-invisible flicker is going
+to fatigue your eyes like crazy and give you headaches, even if the screen
+looks OK to normal vision.
+
+For interlaced modes, the amount of flicker depends on more factors such as
+the current vertical resolution and the actual screen contents. So just
+experiment. You won't want to go much below about 85Hz half frame rate,
+though.
+
+So let's say you've picked a minimum acceptable refresh rate. In choosing
+your HFL and VFL, you'll have some room for maneuver.
+
+7. Memory Requirements
+
+Available frame-buffer RAM may limit the resolution you can achieve on color
+or gray-scale displays. It probably isn't a factor on displays that have
+only two colors, white and black with no shades of gray in between.
+
+For 256-color displays, a byte of video memory is required for each visible
+dot to be shown. This byte contains the information that determines what mix
+of red, green, and blue is generated for its dot. To get the amount of mem-
+ory required, multiply the number of visible dots per line by the number of
+visible lines. For a display with a resolution of 800x600, this would be 800
+x 600 = 480,000, which is the number of visible dots on the display. This is
+also, at one byte per dot, the number of bytes of video memory that are nec-
+essary on your adapter card.
+
+Thus, your memory requirement will typically be (HR * VR)/1024 Kbytes of
+VRAM, rounded up. If you have more memory than strictly required, you'll
+have extra for virtual-screen panning.
+
+However, if you only have 512K on board, then you can't use this resolution.
+Even if you have a good monitor, without enough video RAM, you can't take
+advantage of your monitor's potential. On the other hand, if your SVGA has
+one meg, but your monitor can display at most 800x600, then high resolution
+is beyond your reach anyway (see Using Interlaced Modes (section 12., page 1)
+for a possible remedy).
+
+Don't worry if you have more memory than required; XFree86 will make use of
+it by allowing you to scroll your viewable area (see the Xconfig file docu-
+mentation on the virtual screen size parameter). Remember also that a card
+with 512K bytes of memory really doesn't have 512,000 bytes installed, it has
+512 x 1024 = 524,288 bytes.
+
+If you're running SGCS X (now called X/Inside) using an S3 card, and are
+willing to live with 16 colors (4 bits per pixel), you can set depth 4 in
+Xconfig and effectively double the resolution your card can handle. S3
+cards, for example, normally do 1024x768x256. You can make them do
+1280x1024x16 with depth 4.
+
+8. Computing Frame Sizes
+
+Warning: this method was developed for multisync monitors. It will probably
+work with fixed-frequency monitors as well, but no guarantees!
+
+Start by dividing DCF by your highest available HSF to get a horizontal frame
+length.
+
+For example; suppose you have a Sigma Legend SVGA with a 65MHz dot clock, and
+your monitor has a 55KHz horizontal scan frequency. The quantity (DCF / HSF)
+is then 1181 (65MHz = 65000KHz; 65000/55 = 1181).
+
+Now for our first bit of black magic. You need to round this figure to the
+nearest multiple of 8. This has to do with the VGA hardware controller used
+by SVGA and S3 cards; it uses an 8-bit register, left-shifted 3 bits, for
+what's really an 11-bit quantity. Other card types such as ATI 8514/A may
+not have this requirement, but we don't know and the correction can't hurt.
+So round the usable horizontal frame length figure down to 1176.
+
+This figure (DCF / HSF rounded to a multiple of 8) is the minimum HFL you can
+use. You can get longer HFLs (and thus, possibly, more horizontal dots on
+the screen) by setting the sync pulse to produce a lower HSF. But you'll pay
+with a slower and more visible flicker rate.
+
+As a rule of thumb, 80% of the horizontal frame length is available for hori-
+zontal resolution, the visible part of the horizontal scan line (this allows,
+roughly, for borders and sweepback time -- that is, the time required for the
+beam to move from the right screen edge to the left edge of the next raster
+line). In this example, that's 944 ticks.
+
+Now, to get the normal 4:3 screen aspect ratio, set your vertical resolution
+to 3/4ths of the horizontal resolution you just calculated. For this exam-
+ple, that's 708 ticks. To get your actual VFL, multiply that by 1.05 to get
+743 ticks.
+
+The 4:3 is not technically magic; nothing prevents you from using a non-
+Golden-Section ratio if that will get the best use out of your screen real
+estate. It does make figuring frame height and frame width from the diagonal
+size convenient, you just multiply the diagonal by by 0.8 to get width and
+0.6 to get height.
+
+So, HFL=1176 and VFL=743. Dividing 65MHz by the product of the two gives us
+a nice, healthy 74.4Hz refresh rate. Excellent! Better than VESA standard!
+And you got 944x708 to boot, more than the 800 by 600 you were probably
+expecting. Not bad at all!
+
+You can even improve the refresh rate further, to almost 76 Hz, by using the
+fact that monitors can often sync horizontally at 2khz or so higher than
+rated, and by lowering VFL somewhat (that is, taking less than 75% of 944 in
+the example above). But before you try this "overdriving" maneuver, if you
+do, make sure that your monitor electron guns can sync up to 76 Hz vertical.
+(the popular NEC 4D, for instance, cannot. It goes only up to 75 Hz VSF).
+(See Overdriving Your Monitor (section 11., page 1) for more general discus-
+sion of this issue. )
+
+So far, most of this is simple arithmetic and basic facts about raster dis-
+plays. Hardly any black magic at all!
+
+9. Black Magic and Sync Pulses
+
+OK, now you've computed HFL/VFL numbers for your chosen dot clock, found the
+refresh rate acceptable, and checked that you have enough VRAM. Now for the
+real black magic -- you need to know when and where to place synchronization
+pulses.
+
+The sync pulses actually control the horizontal and vertical scan frequebcies
+of the monitor. The HSF and VSF you've pulled off the spec sheet are nomi-
+nal, approximate maximum sync frequencies. The sync pulse in the signal from
+the adapter card tells the monitor how fast to actually run.
+
+Recall the two pictures above? Only part of the time required for raster-
+scanning a frame is used for displaying viewable image (ie. your resolution).
+
+9.1 Horizontal Sync:
+
+By previous definition, it takes HFL ticks to trace the a horizontal scan
+line. Let's call the visible tick count (your horizontal screen resolution)
+HR. Then Obviously, HR < HFL by definition. For concreteness, let's assume
+both start at the same instant as shown below:
+
+ |___ __ __ __ __ __ __ __ __ __ __ __ __
+ |_ _ _ _ _ _ _ _ _ _ _ _ |
+ |_______________________|_______________|_____
+ 0 ^ ^ unit: ticks
+ | ^ ^ |
+ HR | | HFL
+ | |<----->| |
+ |<->| HSP |<->|
+ HGT1 HGT2
+
+Now, we would like to place a sync pulse of length HSP as shown above, ie,
+between the end of clock ticks for display data and the end of clock ticks
+for the entire frame. Why so? because if we can achieve this, then your
+screen image won't shift to the right or to the left. It will be where it
+supposed to be on the screen, covering squarely the monitor's viewable area.
+
+Furthermore, we want about 30 ticks of "guard time" on either side of the
+sync pulse. This is represented by HGT1 and HGT2. In a typical configura-
+tion HGT1 != HGT2, but if you're building a configuration from scratch, you
+want to start your experimentation with them equal (that is, with the sync
+pulse centered).
+
+The symptom of a misplaced sync pulse is that the image is displaced on the
+screen, with one border excessively wide and the other side of the image
+wrapped around the screen edge, producing a white edge line and a band of
+"ghost image" on that side. A way-out-of-place vertical sync pulse can actu-
+ally cause the image to roll like a TV with a mis-adjusted vertical hold (in
+fact, it's the same phenomenon at work).
+
+If you're lucky, your monitor's sync pulse widths will be documented on its
+specification page. If not, here's where the real black magic starts...
+
+You'll have to do a little trial and error for this part. But most of the
+time, we can safely assume that a sync pulse is about 3.5 to 4.0 microsecond
+in length.
+
+For concretness again, let's take HSP to be 3.8 microseconds (which btw, is
+not a bad value to start with when experimenting).
+
+Now, using the 65Mhz clock timing above, we know HSP is equivalent to 247
+clock ticks (= 65 * 10**6 * 3.8 * 10^-6) [recall M=10^6, micro=10^-6]
+
+Some makers like to quote their horizontal framing parameters as timings
+rather than dot widths. You may see the following terms:
+
+ active time (HAT)
+ Corresponds to HR, but in milliseconds. HAT * DCF = HR.
+
+ blanking time (HBT)
+ Corresponds to (HFL - HR), but in milliseconds. HBT * DCF = (HFL
+ - HR).
+
+ front porch (HFP)
+ This is just HGT1.
+
+ sync time
+ This is just HSP.
+
+ back porch (HBP)
+ This is just HGT2.
+
+9.2 Vertical Sync:
+
+Going back to the picture above, how do we place the 247 clock ticks as shown
+in the picture?
+
+Using our example, HR is 944 and HFL is 1176. The difference between the two
+is 1176 - 944=232 < 247! Obviously we have to do some adjustment here. What
+can we do?
+
+The first thing is to raise 1176 to 1184, and lower 944 to 936. Now the dif-
+ference = 1184-936= 248. Hmm, closer.
+
+Next, instead using 3.8, we use 3.5 for calculating HSP; then, we have
+65*3.5=227. Looks better. But 248 is not much higher than 227. It's nor-
+mally necessary to have 30 or so clock ticks between HR and the start of SP,
+and the same for the end of SP and HFL. AND they have to be multiple of
+eight! Are we stuck?
+
+No. Let's do this, 936 % 8 = 0, (936 + 32) % 8 = 0 too. But 936 + 32 = 968,
+968 + 227 = 1195, 1195 + 32 = 1227. Hmm.. this looks not too bad. But it's
+not a multiple of 8, so let's round it up to 1232.
+
+But now we have potential trouble, the sync pulse is no longer placed right
+in the middle between h and H any more. Happily, using our calculator we
+find 1232 - 32 = 1200 is also a multiple of 8 and (1232 - 32) - 968 = 232
+corresponding using a sync pulse of 3.57 micro second long, still reasonable.
+
+In addition, 936/1232 ~ 0.76 or 76%, still not far from 80%, so it should be
+all right.
+
+Furthermore, using the current horizontal frame length, we basically ask our
+monitor to sync at 52.7khz (= 65Mhz/1232) which is within its capability. No
+problems.
+
+Using rules of thumb we mentioned before, 936*75%=702, This is our new verti-
+cal resolution. 702 * 1.05 = 737, our new vertical frame length.
+
+Screen refresh rate = 65Mhz/(737*1232)=71.6 Hz. This is still excellent.
+
+Figuring the vertical sync pulse layout is similar:
+
+ |___ __ __ __ __ __ __ __ __ __ __ __ __
+ |_ _ _ _ _ _ _ _ _ _ _ _ |
+ |_______________________|_______________|_____
+ 0 VR VFL unit: ticks
+ ^ ^ ^
+ | | |
+ |<->|<----->|
+ VGT VSP
+
+We start the sync pulse just past the end of the vertical display data ticks.
+VGT is the vertical guard time required for the sync pulse. Most monitors
+are comfortable with a VGT of 0 (no guard time) and we'll use that in this
+example. A few need two or three ticks of guard time, and it usually doesn't
+hurt to add that.
+
+Returning to the example: since by the defintion of frame length, a vertical
+tick is the time for tracing a complete HORIZONTAL frame, therefore in our
+example, it is 1232/65Mhz=18.95us.
+
+Experience shows that a vertical sync pulse should be in the range of 50us
+and 300us. As an example let's use 150us, which translates into 8 vertical
+clock ticks (150us/18.95us~8).
+
+Some makers like to quote their vertical framing parameters as timings rather
+than dot widths. You may see the following terms:
+
+ active time (VAT)
+ Corresponds to VR, but in milliseconds. VAT * VSF = VR.
+
+ blanking time (VBT)
+ Corresponds to (VFL - VR), but in milliseconds. VBT * VSF = (VFL
+ - VR).
+
+ front porch (VFP)
+ This is just VGT.
+
+ sync time
+ This is just VSP.
+
+ back porch (VBP)
+ This is like a second guard time after the vertical sync pulse.
+ It is often zero.
+
+10. Putting it All Together
+
+The Xconfig file Table of Video Modes contains lines of numbers, with each
+line being a complete specification for one mode of X-server operation. The
+fields are grouped into four sections, the name section, the clock frequency
+section, the horizontal section, and the vertical section.
+
+The name section contains one field, the name of the video mode specified by
+the rest of the line. This name is referred to on the "Modes" line of the
+Graphics Driver Setup section of the Xconfig file. The name field may be
+omitted if the name of a previous line is the same as the current line.
+
+The dot clock section contains only the dot clock (what we've called DCF)
+field of the video mode line. The number in this field specifies what dot
+clock was used to generate the numbers in the following sections.
+
+The horizontal section consists of four fields which specify how each hori-
+zontal line on the display is to be generated. The first field of the sec-
+tion contains the number of dots per line which will be illuminated to form
+the picture (what we've called HR). The second field of the section indi-
+cates at which dot the horizontal sync pulse will begin. The third field
+indicates at which dot the horizontal sync pulse will end. The fourth field
+specifies the toal horzontal frame length (HFL).
+
+The vertical section also contains four fields. The first field contains the
+number of visible lines which will appear on the display (VR). The second
+field indicates the line number at which the vertical sync pulse will begin.
+The third field specifies the line number at which the vertical sync pulse
+will end. The fourth field contains the total vertical frame length (VFL).
+
+Example:
+
+ #Modename clock horizontal timing vertical timing
+
+ "752x564" 40 752 784 944 1088 564 567 569 611
+ 44.5 752 792 976 1240 564 567 570 600
+
+(Note: stock X11R5 doesn't support fractional dot clocks.)
+
+For Xconfig, all of the numbers just mentioned - the number of illuminated
+dots on the line, the number of dots separating the illuminated dots from the
+beginning of the sync pulse, the number of dots representing the duration of
+the pulse, and the number of dots after the end of the sync pulse - are added
+to produce the number of dots per line. The number of horizontal dots must
+be evenly divisible by eight.
+
+Example horizontal numbers: 800 864 1024 1088
+
+This sample line has the number of illuminated dots (800) followed by the
+number of the dot when the sync pulse starts (864), followed by the number of
+the dot when the sync pulse ends (1024), followed by the number of the last
+dot on the horizontal line (1088).
+
+Note again that all of the horizontal numbers (800, 864, 1024, and 1088) are
+divisible by eight! This is not required of the vertical numbers.
+
+The number of lines from the top of the display to the bottom form the frame.
+The basic timing signal for a frame is the line. A number of lines will con-
+tain the picture. After the last illuminated line has been displayed, a
+delay of a number of lines will occur before the vertical sync pulse is gen-
+erated. Then the sync pulse will last for a few lines, and finally the last
+lines in the frame, the delay required after the pulse, will be generated.
+The numbers that specify this mode of operation are entered in a manner simi-
+lar to the following example.
+
+Example vertical numbers: 600 603 609 630
+
+This example indicates that there are 600 visible lines on the display, that
+the vertical sync pulse starts with the 603rd line and ends with the 609th,
+and that there are 630 total lines being used.
+
+Note that the vertical numbers don't have to be divisible by eight!
+
+Let's return to the example we've been working. According to the above, all
+we need to do from now on is to write our result into Xconfig as follows:
+
+ <name> DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
+
+where SH1 is the start tick of the horizontal sync pulse and SH2 is its end
+tick; similarly, SV1 is the start tick of the vertical sync pulse and SV2 is
+its end tick.
+
+ #name clock horizontal timing vertical timing flag
+ 936x702 65 936 968 1200 1232 702 702 710 737
+
+No special flag necessary; this is a non-interlaced mode. Now we are really
+done.
+
+11. Overdriving Your Monitor
+
+You should absolutely not try exceeding your monitor's scan rates if it's a
+fixed-frequency type. You can smoke your hardware doing this! There are
+potentially subtler problems with overdriving a multisync monitor which you
+should be aware of.
+
+Having a pixel clock higher than the monitor's maximum bandwidth is rather
+harmless, in contrast. (Note: the theoretical limit of discernable features
+is reached when the pixel clock reaches double the monitor's bandwidth. This
+is a straightforward application of Nyquist's Theorem: consider the pixels as
+a spatially distributed series of samples of the drive signals and you'll see
+why.)
+
+It's exceeding the rated maximum sync frequencies that's problematic. Some
+modern monitors might have protection circuitry that shuts the monitor down
+at dangerous scan rates, but don't rely on it. In particular there are older
+multisync monitors (like the Multisync II) which use just one horizontal
+transformer. These monitors will not have much protection against overdriving
+them. While you necessarily have high voltage regulation circuitry (which
+can be absent in fixed frequency monitors), it will not necessarily cover
+every conceivable frequency range, especially in cheaper models. This not
+only implies more wear on the circuitry, it can also cause the screen phos-
+phors to age faster, and cause more than the specified radiation (including
+X-rays) to be emitted from the monitor.
+
+Another importance of the bandwidth is that the monitor's input impedance is
+specified only for that range, and using higher frequencies can cause reflec-
+tions probably causing minor screen interferences, and radio disturbance.
+
+However, the basic problematic magnitude in question here is the slew rate
+(the steepness of the video signals) of the video output drivers, and that is
+usually independent of the actual pixel frequency, but (if your board manu-
+facturer cares about such problems) related to the maximum pixel frequency of
+the board.
+
+So be careful out there...
+
+12. Using Interlaced Modes
+
+(This section is largely due to David Kastrup <dak@pool.informatik.rwth-
+aachen.de>)
+
+At a fixed dot clock, an interlaced display is going to have considerably
+less noticable flicker than a non-interlaced display, if the vertical cir-
+cuitry of your monitor is able to support it stably. It is because of this
+that interlaced modes were invented in the first place.
+
+Interlaced modes got their bad repute because they are inferior to their non-
+interlaced companions at the same vertical scan frequency, VSF (which is what
+is usually given in advertisements). But they are definitely superior at the
+same horizontal scan rate, and that's where the decisive limits of your moni-
+tor/graphics card usually lie.
+
+At a fixed refresh rate (or half frame rate, or VSF) the interlaced display
+will flicker more: a 90Hz interlaced display will be inferior to a 90Hz non-
+interlaced display. It will, however, need only half the video bandwidth and
+half the horizontal scan rate. If you compared it to a non-interlaced mode
+with the same dot clock and the same scan rates, it would be vastly superior:
+45Hz non-interlaced is intolerable. With 90Hz interlaced, I have worked for
+years with my Multisync 3D (at 1024x768) and am very satisfied. I'd guess
+you'd need at least a 70Hz non-interlaced display for similar comfort.
+
+You have to watch a few points, though: use interlaced modes only at high
+resolutions, so that the alternately lighted lines are close together. You
+might want to play with sync pulse widths and positions to get the most sta-
+ble line positions. If alternating lines are bright and dark, interlace will
+jump at you. I have one application that chooses such a dot pattern for a
+menu background (XCept, no other application I know does that, fortunately).
+I switch to 800x600 for using XCept because it really hurts my eyes other-
+wise.
+
+For the same reason, use at least 100dpi fonts, or other fonts where horizon-
+tal beams are at least two lines thick (for high resolutions, nothing else
+will make sense anyhow).
+
+And of course, never use an interlaced mode when your hardware would support
+a non-interlaced one with similar refresh rate.
+
+If, however, you find that for some resolution you are pushing either monitor
+or graphics card to their upper limits, and getting dissatisfactorily flick-
+ery or outwashed (bandwidth exceeded) display, you might want to try tackling
+the same resolution using an interlaced mode. Of course this is useless if
+the VSF of your monitor is already close to its limits.
+
+Design of interlaced modes is easy: do it like a non-interlaced mode. Just
+two more considerations are necessary: you need an odd total number of verti-
+cal lines (the last number in your mode line), and when you specify the
+"interlace" flag, the actual vertical frame rate for your monitor doubles.
+Your monitor needs to support a 90Hz frame rate if the mode you specified
+looks like a 45Hz mode apart from the "Interlace" flag.
+
+As an example, here is my modeline for 1024x768 interlaced: my Multisync 3D
+will support up to 90Hz vertical and 38kHz horizontal.
+
+ ModeLine "1024x768" 45 1024 1048 1208 1248 768 768 776 807 Interlace
+
+Both limits are pretty much exhausted with this mode. Specifying the same
+mode, just without the "Interlace" flag, still is almost at the limit of the
+monitor's horizontal capacity (and strictly speaking, a bit under the lower
+limit of vertical scan rate), but produces an intolerably flickery display.
+
+Basic design rules: if you have designed a mode at less than half of your
+monitor's vertical capacity, make the vertical total of lines odd and add the
+"Interlace" flag. The display's quality should vastly improve in most cases.
+
+If you have a non-interlaced mode otherwise exhausting your monitor's specs
+where the vertical scan rate lies about 30% or more under the maximum of your
+monitor, hand-designing an interlaced mode (probably with somewhat higher
+resolution) could deliver superior results, but I won't promise it.
+
+13. Questions and Answers
+
+Q. The example you gave is not a standard screen size, can I use it?
+
+A. Why not? There is NO reason whatsover why you have to use 640x480,
+800x600, or even 1024x768. The XFree86 servers let you configure your hard-
+ware with a lot of freedom. It usually takes two to three tries to come up
+the right one. The important thing to shoot for is high refresh rate with
+reasonable viewing area. not high resolution at the price of eye-tearing
+flicker!
+
+Q. It this the only resolution given the 65Mhz dot clock and 55Khz HSF?
+
+A. Absolutely not! You are encouraged to follow the general procedure and do
+some trial-and-error to come up a setting that's really to your liking.
+Experimenting with this can be lots of fun. Most settings may just give you
+nasty video hash, but in practice a modern multi-sync monitor is usually not
+damaged easily. Be sure though, that your monitor can support the frame rates
+of your mode before using it for longer times.
+
+Beware fixed-frequency monitors! This kind of hacking around can damage them
+rather quickly. Be sure you use valid refresh rates for every experiment on
+them.
+
+Q. You just mentioned two standard resolutions. In Xconfig, there are many
+standard resolutions available, can you tell me whether there's any point in
+tinkering with timings?
+
+A. Absolutely! Take, for example, the "standard" 640x480 listed in the cur-
+rent Xconfig. It employes 25Mhz driving frequency, frame lengths are 800 and
+525 => refresh rate ~ 59.5Hz. Not too bad. But 28Mhz is a commonly available
+driving frequency from many SVGA boards. If we use it to drive 640x480, fol-
+lowing the procedure we discussed above, you would get frame lengths like 812
+and 505. Now the refresh rate is raised to 68Hz, a quite significant
+improvement over the standard one.
+
+Q. Can you summarize what we have discussed so far?
+
+A. In a nutshell:
+
+ 1. for any fixed driving frequency, raising max resolution incurs the
+ penalty of lowering refresh rate and thus introducing more flicker.
+
+ 2. if high resolution is desirable and your monitor supports it, try to
+ get a SVGA card that provides a matching dot clock or DCF. The higher,
+ the better!
+
+14. Fixing Problems with the Image.
+
+OK, so you've got your X configuration numbers. You put them in Xconfig with
+a test mode label. You fire up X, hot-key to the new mode, ... and the image
+doesn't look right. What do you do? Here's a list of common problems and
+how to fix them.
+
+(Fixing these minor distortions is where xvidtune(1) really shines.)
+
+You move the image by changing the sync pulse timing. You scale it by chang-
+ing the frame length (you need to move the sync pulse to keep it in the same
+relative position, otherwise scaling will move the image as well). Here are
+some more specific recipes:
+
+The horizontal and vertical positions are independent. That is, moving the
+image horizontally doesn't affect placement vertically, or vice-versa. How-
+ever, the same is not quite true of scaling. While changing the horizontal
+size does nothing to the vertical size or vice versa, the total change in
+both may be limited. In particular, if your image is too large in both
+dimensions you will probably have to go to a higher dot clock to fix it.
+Since this raises the usable resolution, it is seldom a problem!
+
+14.1 The image is displaced to the left or right
+
+To fix this, move the horizontal sync pulse. That is, increment or decrement
+(by a multiple of 8) the middle two numbers of the horizontal timing section
+that define the leading and trailing edge of the horizontal sync pulse.
+
+If the image is shifted left (right border too large, you want to move the
+image to the right) decrement the numbers. If the image is shifted right
+(left border too large, you want it to move left) increment the sync pulse.
+
+14.2 The image is displaced up or down
+
+To fix this, move the vertical sync pulse. That is, increment or decrement
+the middle two numbers of the vertical timing section that define the leading
+and trailing edge of the vertical sync pulse.
+
+If the image is shifted up (lower border too large, you want to move the
+image down) decrement the numbers. If the image is shifted down (top border
+too large, you want it to move up) increment the numbers.
+
+14.3 The image is too large both horizontally and vertically
+
+Switch to a higher card clock speed. If you have multiple modes in your clock
+file, possibly a lower-speed one is being activated by mistake.
+
+14.4 The image is too wide (too narrow) horizontally
+
+To fix this, increase (decrease) the horizontal frame length. That is,
+change the fourth number in the first timing section. To avoid moving the
+image, also move the sync pulse (second and third numbers) half as far, to
+keep it in the same relative position.
+
+14.5 The image is too deep (too shallow) vertically
+
+To fix this, increase (decrease) the vertical frame length. That is, change
+the fourth number in the second timing section. To avoid moving the image,
+also move the sync pulse (second and third numbers) half as far, to keep it
+in the same relative position.
+
+Any distortion that can't be handled by combining these techniques is proba-
+bly evidence of something more basically wrong, like a calculation mistake or
+a faster dot clock than the monitor can handle.
+
+Finally, remember that increasing either frame length will decrease your
+refresh rate, and vice-versa.
+
+15. Plotting Monitor Capabilities
+
+To plot a monitor mode diagram, you'll need the gnuplot package (a freeware
+plotting language for UNIX-like operating systems) and the tool modeplot, a
+shell/gnuplot script to plot the diagram from your monitor characteristics,
+entered as command-line options.
+
+Here is a copy of modeplot:
+
+ #!/bin/sh
+ #
+ # modeplot -- generate X mode plot of available monitor modes
+ #
+ # Do `modeplot -?' to see the control options.
+ #
+ # ($Id: VideoModes.doc,v 1.1 1999/12/05 01:16:52 daryll Exp $)
+
+ # Monitor description. Bandwidth in MHz, horizontal frequencies in kHz
+ # and vertical frequencies in Hz.
+ TITLE="Viewsonic 21PS"
+ BANDWIDTH=185
+ MINHSF=31
+ MAXHSF=85
+ MINVSF=50
+ MAXVSF=160
+ ASPECT="4/3"
+ vesa=72.5 # VESA-recommended minimum refresh rate
+
+ while [ "$1" != "" ]
+ do
+ case $1 in
+ -t) TITLE="$2"; shift;;
+ -b) BANDWIDTH="$2"; shift;;
+ -h) MINHSF="$2" MAXHSF="$3"; shift; shift;;
+ -v) MINVSF="$2" MAXVSF="$3"; shift; shift;;
+ -a) ASPECT="$2"; shift;;
+ -g) GNUOPTS="$2"; shift;;
+ -?) cat <<EOF
+ modeplot control switches:
+
+ -t "<description>" name of monitor defaults to "Viewsonic 21PS"
+ -b <nn> bandwidth in MHz defaults to 185
+ -h <min> <max> min & max HSF (kHz) defaults to 31 85
+ -v <min> <max> min & max VSF (Hz) defaults to 50 160
+ -a <aspect ratio> aspect ratio defaults to 4/3
+ -g "<options>" pass options to gnuplot
+
+ The -b, -h and -v options are required, -a, -t, -g optional. You can
+ use -g to pass a device type to gnuplot so that (for example) modeplot's
+ output can be redirected to a printer. See gnuplot(1) for details.
+
+ The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on
+ analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de>
+
+ This is modeplot $Revision: 1.1 $
+ EOF
+ exit;;
+ esac
+ shift
+ done
+
+ gnuplot $GNUOPTS <<EOF
+ set title "$TITLE Mode Plot"
+
+ # Magic numbers. Unfortunately, the plot is quite sensitive to changes in
+ # these, and they may fail to represent reality on some monitors. We need
+ # to fix values to get even an approximation of the mode diagram. These come
+ # from looking at lots of values in the ModeDB database.
+ F1 = 1.30 # multiplier to convert horizontal resolution to frame width
+ F2 = 1.05 # multiplier to convert vertical resolution to frame height
+
+ # Function definitions (multiplication by 1.0 forces real-number arithmetic)
+ ac = (1.0*$ASPECT)*F1/F2
+ refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf)
+ dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr)
+ resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2)
+
+ # Put labels on the axes
+ set xlabel 'DCF (MHz)'
+ set ylabel 'RR (Hz)' 6 # Put it right over the Y axis
+
+ # Generate diagram
+ set grid
+ set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left
+ set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead
+ set label "max VSF" at 1, $MAXVSF-1.5
+ set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead
+ set label "min VSF" at 1, $MINVSF-1.5
+ set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead
+ set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right
+ set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right
+ set label "VESA $vesa" at 1, $vesa-1.5
+ set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1
+ plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \
+ refresh($MINHSF, dcf) notitle with lines 1, \
+ refresh($MAXHSF, dcf) notitle with lines 1, \
+ resolution(640*480, dcf) title "640x480 " with points 2, \
+ resolution(800*600, dcf) title "800x600 " with points 3, \
+ resolution(1024*768, dcf) title "1024x768 " with points 4, \
+ resolution(1280*1024, dcf) title "1280x1024" with points 5, \
+ resolution(1600*1280, dcf) title "1600x1200" with points 6
+
+ pause 9999
+ EOF
+
+Once you know you have modeplot and the gnuplot package in place, you'll need
+the following monitor characteristics:
+
+ o video bandwidth (VB)
+
+ o range of horizontal sync frequency (HSF)
+
+ o range of vertical sync frequency (VSF)
+
+The plot program needs to make some simplifying assumptions which are not
+necessarily correct. This is the reason why the resulting diagram is only a
+rough description. These assumptions are:
+
+ 1. All resolutions have a single fixed aspect ratio AR = HR/VR. Standard
+ resolutions have AR = 4/3 or AR = 5/4. The modeplot programs assumes
+ 4/3 by default, but you can override this.
+
+ 2. For the modes considered, horizontal and vertical frame lengths are
+ fixed multiples of horizontal and vertical resolutions, respectively:
+
+ HFL = F1 * HR
+ VFL = F2 * VR
+
+As a rough guide, take F1 = 1.30 and F2 = 1.05 (see frame (section 8., page
+1) "Computing Frame Sizes").
+
+Now take a particular sync frequency, HSF. Given the assumptions just pre-
+sented, every value for the clock rate DCF already determines the refresh
+rate RR, i.e. for every value of HSF there is a function RR(DCF). This can
+be derived as follows.
+
+The refresh rate is equal to the clock rate divided by the product of the
+frame sizes:
+
+ RR = DCF / (HFL * VFL) (*)
+
+On the other hand, the horizontal frame length is equal to the clock rate
+divided by the horizontal sync frequency:
+
+ HFL = DCF / HSF (**)
+
+VFL can be reduced to HFL be means of the two assumptions above:
+
+ VFL = F2 * VR
+ = F2 * (HR / AR)
+ = (F2/F1) * HFL / AR (***)
+
+Inserting (**) and (***) into (*) we obtain:
+
+ RR = DCF / ((F2/F1) * HFL**2 / AR)
+ = (F1/F2) * AR * DCF * (HSF/DCF)**2
+ = (F1/F2) * AR * HSF**2 / DCF
+
+For fixed HSF, F1, F2 and AR, this is a hyperbola in our diagram. Drawing
+two such curves for minimum and maximum horizontal sync frequencies we have
+obtained the two remaining boundaries of the permitted region.
+
+The straight lines crossing the capability region represent particular reso-
+lutions. This is based on (*) and the second assumption:
+
+ RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR)
+
+By drawing such lines for all resolutions one is interested in, one can imme-
+diately read off the possible relations between resolution, clock rate and
+refresh rate of which the monitor is capable. Note that these lines do not
+depend on monitor properties, but they do depend on the second assumption.
+
+The modeplot tool provides you with an easy way to do this. Do modeplot -?
+to see its control options. A typical invocation looks like this:
+
+ modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58
+
+The -b option specifies video bandwidth; -v and -h set horizontal and verti-
+cal sync frequency ranges.
+
+When reading the output of modeplot, always bear in mind that it gives only
+an approximate description. For example, it disregards limitations on HFL
+resulting from a minimum required sync pulse width, and it can only be accu-
+rate as far as the assumptions are. It is therefore no substitute for a
+detailed calculation (involving some black magic) as presented in Putting it
+All Together (section 10., page 1). However, it should give you a better
+feeling for what is possible and which tradeoffs are involved.
+
+16. Credits
+
+The original ancestor of this document was by Chin Fang
+<fangchin@leland.stanford.edu>.
+
+Eric S. Raymond <esr@snark.thyrsus.com> reworked, reorganized, and massively
+rewrote Chin Fang's original in an attempt to understand it. In the process,
+he merged in most of a different how-to by Bob Crosson
+<crosson@cam.nist.gov>.
+
+The material on interlaced modes is largely by David Kastrup <dak@pool.infor-
+matik.rwth-aachen.de>
+
+Martin Lottermoser <Martin.Lottermoser@mch.sni.de> contributed the idea of
+using gnuplot to make mode diagrams and did the mathematical analysis behind
+modeplot. The distributed modeplot was redesigned and generalized by ESR
+from Martin's original gnuplot code for one case.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.14 1997/11/16 10:52:47 dawes Exp $
+
+ $XConsortium: VidModes.sgml /main/7 1996/02/21 17:46:17 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/VideoModes.doc,v 3.18 1999/04/15 03:35:09 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/doc/modeDB.txt b/xc/programs/Xserver/hw/xfree86/doc/modeDB.txt
new file mode 100644
index 000000000..1643ce460
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/modeDB.txt
@@ -0,0 +1,2456 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/doc/modeDB.txt,v 3.8 1997/12/20 14:20:57 hohndel Exp $
+#
+#
+#
+#
+# $XConsortium: modeDB.txt /main/6 1996/02/21 17:44:44 kaleb $
+#
+# XFree86/X386 Mode database
+# Compiled by David Wexelblat [dwex@xfree86.org]
+# Huge Contributions to v2.0 from Thomas Roell [roell@xinside.com]
+#
+# Version 3.9
+# August 28, 1994
+#
+# ACCELERATED CARD NOTE:
+# Refer to the AccelCards file for real details on accelerated cards
+# supported by XFree86. Accelerated cards include ATI Mach8/Mach32,
+# 8514/A, S3, Cirrus 5426/5428, and WD90C31.
+#
+# NOTE:
+# The information in this file was provided to the compiler by the
+# individuals listed with each entry. No effort has been made to
+# validate the correctness of the information. If you have problems
+# with a specific entry, you should contact the contributor at the
+# address provided.
+#
+# NOTE 2:
+# This database contains information for cards compatible with servers
+# derived from X386 1.1, including X386 1.2 (X11R5), XFree86, and XS3.
+# Hence not all of the cards listed here work with all of the various
+# X386 derivatives.
+#
+# HOW TO USE THIS FILE:
+# The information in this file is presented in the format used for the
+# Xconfig file for X386 1.1b (X11R4), as this version requires a more
+# verbose format and more detailed information that X386 1.2 (X11R5).
+# The information is applicable to both versions, however, for X386 1.2,
+# you will need to specify information in the format described in the
+# manual page provided with that release.
+#
+# Several ET4000 entries have 16 clocks. If you are using X386 1.1b
+# 1.1b or 1.2, only the first 8 clocks are usable. If you are using
+# X386 1.2E or XFree86, all 16 are usable.
+#
+# XFree86 1.2 adds the ability to report and support fractional dot
+# clocks. If you are using an earlier version of X386 or XFree86,
+# and want to use a card entry with fractional dot-clocks, round
+# the specified dot-clock values to integers. If you want to use
+# a monitor entry that has a fractional dot-clock, round the clock
+# value, and scale the other numbers as described below.
+#
+# First, locate your VGA card in the first section of this file. Note
+# that some cards have more than one entry. Where possible, these are
+# distinguished by some identifying characteristic (e.g. board date code).
+# This was not always possible, however.
+#
+# If your card is not listed below, you can use the the startup information
+# from X386 1.2, X386 1.2E, or XFree86 to get the clock information. Note
+# that the clock listing must be in the exact order reported by these
+# sources - don't sort them.
+#
+# Once you have identified your card, you can locate entries for your
+# monitor. At the beginning of the monitor section is a listing of the
+# VESA standard and other generic definitions. You should attempt to use
+# these entries, if possible, even if there are specific entries for your
+# monitor in the database.
+#
+# If you find a set of monitor resolutions that fit your monitor and the
+# clocks available from your VGA card, you are pretty much all set. If
+# not, don't give up hope. See the references listed below for details
+# of how to create your own entries.
+#
+# As a quick starting point, if your monitor is listed, but the specified
+# resolutions don't match your available clocks, you can start by scaling
+# a close value to an available one (e.g. an entry for 62 is specified,
+# but your card has 65). Simply scale the 2nd, 3rd, and 4th numbers in
+# the horizontal and vertical groups of 4 by the ratio of your clock
+# divided by the given clock (in our example, multiply by 65/62). Note
+# that the horizontal numbers should be rounded to the nearest multiple
+# of 8 (otherwise the server will truncate them). This is not required
+# for the vertical numbers.
+#
+# FEEDBACK:
+# The compiler of this database welcomes feedback on and contributions to
+# this database. Send electronic mail to dwex@xfree86.org
+#
+# REFERENCES:
+# 1) The XFree86 README.Config file.
+# 2) The VideoModes.doc file provided with XFree86 1.2 contains a very
+# complete and detailed tutorial by Eric Raymond [esr@snark.thrysus.com].
+# 3) The CONFIG file provided with X386 1.1b and X386 1.2 contains a
+# detailed tutorial on monitor timing by Chin Fang
+# [fangchin@leland.stanford.edu]
+# 4) Another tutorial was posted to the UseNet newsgroup comp.unix.sysv386
+# by Bob Crosson [crosson@cam.nist.gov].
+
+###############################################################################
+#
+# VGA CARD SECTION
+#
+###############################################################################
+# Card: 2-the-MAX VGA 4000
+# Contributor: E.J.McKernan [ejm@datalog.com]
+# Last Edit Date: 12/16/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 33 36 39 45 56 65 "800x600"
+
+###############################################################################
+# Card: 2-the-MAX VGA 4032
+# Contributor: Nils Rennebarth [nils@sonya.exp-math.uni-essen.de]
+# Last Edit Date: 4/7/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 1024 25 28 26 36 40 45 51 64 "1024x768"
+ 50 56 65 72 80 105 100 128
+
+###############################################################################
+# Card: 2-the-MAX VGA 4000S (hicolor)
+# Contributor: Nathan Laredo [nathan@eas.gatech.edu]
+# Last Edit Date: 12/9/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 1024 25 28 33 36 40 45 32 38 "1024x768i"
+ 50 57 65 72 80 90 63 76
+
+###############################################################################
+# Card: Actix GraphicsEngine32+ 2Meg
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 8/29/93
+#
+# chip ram virtual clocks default-mode flags
+ S3 2048 1280 1024 25.2 28.3 40.0 0.0 "1024x768"
+ 50.0 77.0 36.0 44.9
+ 130.0 120.0 80.0 31.5
+ 110.0 65.0 75.0 94.5
+
+###############################################################################
+# Card: ATI Graphics Ultra Pro (VLB)
+# Contributor: Bill C. Riemers [bcr@physics.purdue.edu]
+# Last Edit Date: 5/4/93
+#
+# chip ram virtual clocks default-mode flags
+ ATI 1024 1152 910 51 36 126 25 80 65 45 40 "1152x910"
+ 135 32 110 80 45 40 75 65
+
+###############################################################################
+# Card: ATI mach32 (VLB)
+# Contributor: Craig E. Groeschel [craig@adikia.sccsi.com]
+# Last Edit Date: 11/18/93
+#
+# chip ram virtual clocks default-mode flags
+ mach32 2048 1152 900 100 126 92.4 36 50.35 56.64 0 44.9 "1024x768"
+ 135 32 110 80 39.91 44.9 75 65
+ 50 63 46.2 18 25.175 28.32 0 22.45
+ 67.5 16 55 40 19.955 22.45 37.5 32.5
+
+###############################################################################
+# Card: ATI VGAWonder series
+# Contributor: Marc Aurele La France [tsi@ualberta.ca]
+# Last Edit Date: 1994.06.07
+#
+# See file README.ati for clock information for these cards.
+
+###############################################################################
+# Card: BOCA Research with 1M for interlaced monitor
+# or with 512K
+# Contributor: [ilan343@violet.berkeley.edu]
+# Contributor: Alfonso Marmora [ajm@icc.com]
+# Last Edit Date: 12/12/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 36 40 50 45 65 0 "1024x768i"
+ ET4000 512 840 624 25 28 36 40 50 45 65 0 "840x624"
+
+###############################################################################
+# Card: Boca Reasearch SVGAX2
+# Contributor: Steve Kump [skump@panix.com]
+# Last Edit Date: 11/04/93
+#
+# chip ram virtual clocks default-mode flags
+ clgd5422 1024 1152 900 25.23 28.32 41.16 36.08 "1024x768i"
+ 31.50 39.99 45.08 49.87
+ 64.98 72.16 75.00 80.01
+
+###############################################################################
+# Card: Cardinal 700, 1M
+# Contributor: [hedrick@cs.rutgers.edu]
+# Last Edit Date: 8/29/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 32 36 40 44 31 37 "1024x768"
+ 0 55 64 59 79 89 62 74
+
+###############################################################################
+# Card: Cardinal ET4000, 1M
+# Contributor: Tom Lang [lang@hal.com]
+# Last Edit Date: 1/8/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 38 36 40 45 32 0 "1024x768" Legend
+
+###############################################################################
+# Card: Cirrus 5422/AVGA3
+# Contributor: Ari Lemmke [arl@cs.hut.fi]
+# Last Edit Date: 8/22/93
+#
+# chip ram virtual clocks default-mode flags
+ clgd5426 1024 1152 900 25.23 28.32 41.16 36.08 "1152x900"
+ 31.50 39.99 45.08 49.87
+ 64.98 72.16 75.00 80.01
+
+###############################################################################
+# Card: Cirrus 5426 (e.g. Diamond SpeedStar Pro)
+# Contributor: Chris Metcalf [metcalf@lcs.mit.edu]
+# Last Edit Date: 7/22/93
+#
+# chip ram virtual clocks default-mode flags
+ clgd5426 1024 1152 900 25.23 28.32 41.16 36.08 "1152x900"
+ 31.50 39.99 45.08 49.87
+ 64.98 72.16 75.00 80.01
+
+###############################################################################
+# Card: Color Design Local Bus (AT&T 20C491 24-bit RAMDAC)
+# Contributor: Rich Braun [richb@rkbhome.jti.com]
+# Last Edit Date: 3/7/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25.2 28.3 32.4 36.0 "1024x768"
+ 39.9 44.7 31.4 38.4
+ 50.2 56.6 66.0 71.7
+ 79.9 89.7 63.0 74.8
+
+###############################################################################
+# Card: CompuAdd HiRez, 1 Meg
+# Contributor: Rick Calder [rick@rick.att.com]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 33 36 40 45 56 65 "1024x768i"
+
+###############################################################################
+# Card: Diamond Speedstar with HIcolor
+# Contributor: Arthur W. Neilson III [art@pilikia.pegasus.com]
+# Last Edit Date: 1/20/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 75 72 80 45 50 63 "1024x768"
+
+###############################################################################
+# Card: Diamond Speedstar II+ (Direct from Gateway 2000)
+# Contributor: Thomas Naughton [naughton@chinet.chi.il.us]
+# Last Edit Date: 10/17/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 57 72 78 68 50 62 "1152x900"
+
+###############################################################################
+# Card: Diamond SpeedStar Plus w/ 1M
+# Contributor: Scott Everden [scott@unixland.natick.ma.us]
+# Last Edit Date: 10/20/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 65 72 79 59 50 64 "1024x768"
+
+###############################################################################
+# Card: Diamond SpeedStar Plus, High Color
+# Contributor: Peter Ziobrzynski [peter@modtor.uucp]
+# Last Edit Date: 10/16/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 50 57 62 66 72 78 "1024x768"
+
+###############################################################################
+# Card: Diamond SpeedStar Plus, High Color (1M)
+# Contributor: Jeff Coffler [coffler@jeck.mv.com]
+# Last Edit Date: 1/27/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 75 72 80 45 50 65 "1024x768"
+
+###############################################################################
+# Card: Diamond SpeedStar Pro
+#
+# See entry under "Cirrus 5426" above
+
+###############################################################################
+# Card: Diamond Stealth(S3 924)
+# Contributor: Keishi Manabe [manabe@zephyrus.tutics.tut.ac.jp]
+# Last Edit Date: 2/16/93
+#
+# chip ram virtual clocks default-mode flags
+ s3 1024 1024 768 25 36 50 80 "800x600"
+
+###############################################################################
+# Card: EDGE(ECS) V24(S3-924)
+# Contributor: Analytical Methods [ami@nwnet.net]
+# Last Edit Date: 2/9/93
+#
+# chip ram virtual clocks default-mode flags
+ s3 1024 1024 768 25 28 40 71 50 77 36 45 "1024x768"
+ 130 120 80 32 110 65 75 72
+
+###############################################################################
+# Card: EIZO VA41 1Mb
+# Contributor: Steinthor Bjarnason [stb@isbank.is]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 65 72 62 36 0 0 0 45 "1024x768"
+
+###############################################################################
+# Card: EIZO VA41 1Mb
+# Contributor: Arnd Gehrmann [arnd@zeus.informatik.rwth-aachen.de]
+# Last Edit Date: 9/6/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 20 33 16 34 43 40 "1024x768"
+ 63 57 41 62 0 61 77 76
+
+###############################################################################
+# Card: Everex Viewpoint NI with 512K
+# Contributor: Dan Ellison [dan@dribble.c-mols.siu.edu]
+# Last Edit Date: 2/20/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 512 832 624 25 28 36 40 50 45 0 61 "832x624""
+
+###############################################################################
+# Card: GA-200 Local Bus ET4000 Card
+# Contributor: Brian Smith [brians@rigel.cs.pdx.edu]
+# Last Edit Date: 6/24/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 50 57 65 72 80 90 101 127 "1152x900"
+
+###############################################################################
+# Card: GA-200 Local Bus ET4000
+# Contributor: Neville H. Chandler [nhc@mtdcr.mt.att.com]
+# Last Edit Date: 10/13/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 36 43 45 48 65 "1024x768"
+ 50 60 0 72 90 0 101 130
+
+###############################################################################
+# Card: Genoa Super VGA, Model 7800
+# Contributor: Michael Hirsch [mike@rolivaw.pr.net.ch]
+# Last Edit Date: 3/22/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25.2 28.3 32.6 36.1 "1024x768"
+ 40.1 45.1 31.5 37.7
+ 50.3 56.7 65.3 72.2
+ 80.3 90.2 63.1 75.5
+
+###############################################################################
+# Card: Micro-Labs, Inc Ultimate VGA/HiColor 2.0
+# Contributor: Matti Aarnio [mea@utu.fi, mea@nic.funet.fi]
+# Last Edit Date: 1/6/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 910 46 53 60 66 72 82 90 91 "1152x910"
+
+###############################################################################
+# Card: OAK Technology OTI-077
+# Contributor: Pedro R. Benito da Rocha [pedro@luna.gui.uva.es]
+# Last Edit Date: 4/27/94
+#
+# chip ram virtual clocks default-mode flags
+ OTI077 1024 1024 768 25.40 28.32 65.40 45.20 "800x600"
+ 14.20 18.10 40.30 36.20
+
+###############################################################################
+# Card: Optima VGA
+# Contributor: Holger Veit [veit@du9ds3.uni-duisburg.de]
+# Last Edit Date: 9/22/92
+#
+# chip ram virtual clocks default-mode flags
+ ET3000 512 800 600 25 28 41 45 33 29 0 0 "800x600"
+
+###############################################################################
+# Card: Optima MEGA VGA-Sync (H3Z 3081)
+# Contributor: J. Schnitter [josch@pc.chemie.th-darmstadt.de]
+# Last Edit Date: 5/6/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 910 25 28 45 36 0 0 0 62 "1040x772"
+
+###############################################################################
+# Card: Orchid F1280(S3 911)
+# Contributor: Shin Seto[sseto@auspex.com]
+# Last Edit Date: 2/16/93
+#
+# chip ram virtual clocks default-mode flags
+ s3 1024 768 25 28 32 36 40 44 50 65 "1024x768"
+ 78 56 63 75 80 89 100 31
+
+###############################################################################
+# Card: Orchid Prodesigner II
+# Contributor: John LoSecco [losecco@undpdk.hep.nd.edu]
+# Last Edit Date: 10/20/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 36 40 45 50 65 "800x600"
+
+###############################################################################
+# Card: Orchid Prodesigner II
+# Contributor: Jeff Michaud [michaud@cdsmn.mn.org]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 1024 25 28 36 40 45 62 0 0 "800x600"
+
+###############################################################################
+# Card: Orchid Prodesigner II
+# Contributor: Wei Jen Ye [yeh@cs.purdue.edu]
+# Last Edit Date: 5/21/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 800 600 25 28 40 36 45 0 0 62 "800x600"
+
+###############################################################################
+# Card: Orchid ProDesigner IIs
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 10/14/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 36 40 45 75 65 "1024x768"
+
+###############################################################################
+# Card: Orchid ProDesigner IIs - board date code 12/91
+# Contributor: Fan Jiao [fanj@remb6489.wpd.sgi.com
+# Last Edit Date: 4/13/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 36 40 45 80 65 "1024x768"
+
+###############################################################################
+# Card: Orchid VA(S3 801)
+# Contributor: Shin Seto[sseto@auspex.com]
+# Last Edit Date: 2/16/93
+#
+# chip ram virtual clocks default-mode flags
+ s3 1024 768 25 28 53 63 57 88 41 51 "1024x768"
+ 148 136 91 36 125 75 85 108
+
+###############################################################################
+# Card: Puretek ET4000 SVGA
+# Contributor: Dave Barker [dbarker@mulga.awadi.com.au]
+# Last Edit Date: 4/7/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 40 34 0 0 0 60 "1152x900i"
+
+###############################################################################
+# Card: Rainbow SVGA with 1M for interlaced monitor
+# Contributor: Geraldo Veiga [ilan343@violet.berkeley.edu]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 36 40 25 28 45 62 "1024x768i"
+
+###############################################################################
+# Card: Sigma Legend II
+# Contributor: Rui Salgueiro [rps@mat.uc.pt]
+# Last Edit Date: 5/4/93
+#
+# chip ram virtual clocks
+ ET4000 1024 1160 903 25 28 0 40 36 40 45 58 "816x612" legend
+ 32 36 31 35 50 48 33 65
+
+###############################################################################
+# Card: STB Powergraph, 1 Meg
+# Contributor: Jeff Jennings [jennings@stortek.com]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 37 45 40 32 0 63 "1024x768i"
+
+###############################################################################
+# Card: STB Powergraph, 1 Meg
+# Contributor: Tim Peiffer [peiffer@cs.umn.edu]
+# Last Edit Date: 1/27/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 37 45 40 33 50 65 "1024x768i"
+
+###############################################################################
+# Card: STB Powergraph ERGO, 1 Meg
+# Contributor: Rick Calder [rick@rick.att.com]
+# Last Edit Date: 12/9/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 59 48 40 0 50 66 "1024x768"
+
+###############################################################################
+# Card: Swan SVGA Adapter, Model VGA/16, 1 Meg
+# (Non-VCO - uses 5 crystals)
+# Contributor: Shaun T. Erickson [ste@alux2.att.com]
+# Last Edit Date: 1/21/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 40 36 0 0 0 45 "1024x768i"
+
+###############################################################################
+# Card: SWAN sVGA (with VCO chip)
+# Contributor: Steve Hite [shite@sinkhole.unf.edu]
+# Creator: Chin Fang [fangchin@leland.stanford.edu]
+# Last Edit Date: 10/15/91
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 36 40 45 75 65 "1024x768"
+
+###############################################################################
+# Card: Trident Generic 8900CL (TCK9004N clock chip)
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 4/18/93
+#
+# chip ram virtual clocks default-mode flags
+ TVGA8900CL
+ 1024 1024 768 25 28 45 36 57 65 50 40 "1024x768"
+ 88 98 119 108 72 77 80 75
+
+###############################################################################
+# Card: Trident JAX-8212B (TCK9002NP clock chip)
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 4/18/93
+#
+# chip ram virtual clocks default-mode flags
+ TVGA8900C 512 1024 768 25.2 28.3 45.0 36.0 "800x600"
+ 57.3 65.0 50.5 40.0
+ 0.0 0.0 0.0 0.0
+ 72.0 77.0 80.0 75.0
+
+###############################################################################
+# Card: Trident JAX-8214
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 9/5/92
+#
+# chip ram virtual clocks default-mode flags
+ TVGA8900C 1024 1024 768 25 28 45 36 57 65 50 40 "1024x768"
+
+###############################################################################
+# Card: Tseng et4000 UN-4010
+# Contributor: Al Petrofsky [al@imdvlf.acuson.com]
+# Last Edit Date: 6/11/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 24 28 32 36 40 45 56 65 "1024x768"
+
+###############################################################################
+# Card: Tseng Labs ET4000
+# Contributor: David McCullough [davidm@stallio.oz.au]
+# Last Edit Date: 11/19/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25.2 28.3 32.5 36.0 "1024x768"
+ 40.0 44.9 31.5 37.5
+ 50.3 56.6 65.0 72.0
+ 80.0 89.8 63.0 75.0
+
+###############################################################################
+# Card: Tseng Labs ET4000/W32 VLB
+# Contributor: Georges Tomazi [tomazi@kralizec.zeta.org.au]
+# Last Edit Date: 12/19/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 32 36 40 34 32 38 "1024x768"
+ 50 56 65 72 80 90 63 75
+
+###############################################################################
+# Card: Tseng Highcolor 72Mhz
+# Contributor: Tom Hoople [hooplet@ucsu.Colorado.EDU]
+# Last Edit Date: 3/18/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 0 45 65 72 0 0 0 0 "1024x768"
+
+###############################################################################
+# Card: Tseng Labs International: MegaEva/1024
+# Contributor: Nicolai Langfeldt [janl@ifi.uio.no]
+# Last Edit Date: 8/11/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1144 858 25 28 42 0 33 35 22 26 "1144x858"
+ 56 62 82 0 65 70 45 52
+
+###############################################################################
+# Card: Tseng Labs MegaEva/2
+# Contributor: Richard Brown [rab@tauon.ph.unimelb.edu.au]
+# Last Edit Date: 5/25/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25.2 28.3 37.9 22.8 "1024x768"
+ 29.5 32.0 40.0 47.5
+ 50.4 56.6 75.8 45.5
+ 59.0 64.0 80.0 95.0
+
+###############################################################################
+# Card: Tseng Labs International: VGA ultra
+# Contributor: Nicolai Langfeldt [janl@ifi.uio.no]
+# Comments: Clocks higher than 72MHz are useless
+# Last Edit Date: 8/11/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1120 840 25 28 32 36 40 45 31 38 "1120x840"
+ 50 57 52 72 80 91 63
+
+###############################################################################
+# Card: VGA4031
+# Contributor: Nicolai Langfeldt [janl@ifi.uio.no]
+# Comments: Buggy, workable under X386
+# Last Edit Date: 8/11/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1120 840 25 28 32 36 40 45 50 65 "1120x840"
+ 0 57 0 72 80 108 101 130
+
+###############################################################################
+# Card: VGA4031
+# Contributor: Stephen Hocking [sgccseh@citecuc.citec.oz.au]
+# Last Edit Date: 8/12/92
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 32 36 40 45 50 65 "1024x768"
+ 0 57 0 72 80 124 101 129
+
+###############################################################################
+# Card: VGA4031
+# Contributor: Hartmut Kuehn Allgemeine Box IET
+# [KUEHNNTE@Rcms1.urz.tu-dresden.de]
+# Last Edit Date: 1/13/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1152 900 25 28 32 35 40 45 31 37 "1024x768"
+ 50 57 65 72 80 89 62 75
+
+###############################################################################
+# Card: VGA MENTOR
+# Contributor: Jun Arihara[j_ariha@hoffman.cc.sophia.ac.jp]
+# Last Edit Date: 2/20/93
+#
+# chip ram virtual clocks default-mode flags
+ ET4000 1024 1024 768 25 28 33 36 40 45 32 38 "800x600"
+
+
+###############################################################################
+#
+# MONITOR SECTION
+#
+###############################################################################
+#
+# OFFICIAL VESA Monitor timings + IBM Standards + other generic modes -
+# TRY THESE FIRST
+# Contributor: Thomas Roell [roell@xinside.com]
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 10/7/93
+#
+# Mode Refresh Hor. Sync Dot-clock Interlaced? VESA?
+# ------------------------------------------------------------
+# 640x480 60Hz 31.5k 25.175M No No
+# 640x480 60Hz 31.5k 25.175M No No
+# 640x480 63Hz 32.8k 28.322M No No
+# 640x480 70Hz 36.5k 31.5M No No
+# 640x480 72Hz 37.9k 31.5M No Yes
+# 800x600 56Hz 35.1k 36.0M No Yes
+# 800x600 56Hz 35.4k 36.0M No No
+# 800x600 60Hz 37.9k 40.0M No Yes
+# 800x600 60Hz 37.9k 40.0M No No
+# 800x600 72Hz 48.0k 50.0M No Yes
+# 1024x768i 43.5Hz 35.5k 44.9M Yes No
+# 1024x768 60Hz 48.4k 65.0M No Yes
+# 1024x768 60Hz 48.4k 62.0M No No
+# 1024x768 70Hz 56.5k 75.0M No Yes
+# 1024x768 70Hz 56.25k 72.0M No No
+# 1024x768 76Hz 62.5k 85.0M No No
+# 1280x1024i 44Hz 51kHz 80.0M Yes No
+# 1280x1024i 44Hz 47.6k 75.0M Yes No
+# 1280x1024 59Hz 63.6k 110.0M No No
+# 1280x1024 61Hz 64.24k 110.0M No No
+# 1280x1024 74Hz 78.85k 135.0M No No
+#
+###############################################################################
+#
+# 640x480@60Hz Non-Interlaced mode
+# Horizontal Sync = 31.5kHz
+# Timing: H=(0.95us, 3.81us, 1.59us), V=(0.35ms, 0.064ms, 1.02ms)
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 664 760 800 480 491 493 525
+#
+# Alternate 640x480@60Hz Non-Interlaced mode
+# Horizontal Sync = 31.5kHz
+# Timing: H=(1.27us, 3.81us, 1.27us) V=(0.32ms, 0.06ms, 1.05ms)
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 672 768 800 480 490 492 525
+#
+# 640x480@63Hz Non-Interlaced mode (non-standard)
+# Horizontal Sync = 32.8kHz
+# Timing: H=(1.41us, 1.41us, 5.08us) V=(0.24ms, 0.092ms, 0.92ms)
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28.322 640 680 720 864 480 488 491 521
+#
+# 640x480@70Hz Non-Interlaced mode (non-standard)
+# Horizontal Sync = 36.5kHz
+# Timing: H=(1.27us, 1.27us, 4.57us) V=(0.22ms, 0.082ms, 0.82ms)
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 680 720 864 480 488 491 521
+#
+# VESA 640x480@72Hz Non-Interlaced mode
+# Horizontal Sync = 37.9kHz
+# Timing: H=(0.76us, 1.27us, 4.06us) V=(0.24ms, 0.079ms, 0.74ms)
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 664 704 832 480 489 492 520
+#
+# VESA 800x600@56Hz Non-Interlaced mode
+# Horizontal Sync = 35.1kHz
+# Timing: H=(0.67us, 2.00us, 3.56us) V=(0.03ms, 0.063ms, 0.70ms)
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 36 800 824 896 1024 600 601 603 625
+#
+# Alternate 800x600@56Hz Non-Interlaced mode
+# Horizontal Sunc = 35.4kHz
+# Timing: H=(0.89us, 4.00us, 1.11us) V=(0.11ms, 0.057ms, 0.79ms)
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 36 800 832 976 1016 600 604 606 634
+#
+# VESA 800x600@60Hz Non-Interlaced mode
+# Horizontal Sync = 37.9kHz
+# Timing: H=(1.00us, 3.20us, 2.20us) V=(0.03ms, 0.106ms, 0.61ms)
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+#
+# Alternate 800x600@60Hz Non-Interlaced mode
+# Horizontal Sync = 37.9kHz
+# Timing: H=(1.20us, 3.80us, 1.40us) V=(0.13ms, 0.053ms, 0.69ms)
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 848 1000 1056 600 605 607 633
+#
+# VESA 800x600@72Hz Non-Interlaced mode
+# Horizontal Sync = 48kHz
+# Timing: H=(1.12us, 2.40us, 1.28us) V=(0.77ms, 0.13ms, 0.48ms)
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+#
+# 1024x768@43.5Hz, Interlaced mode (8514/A standard)
+# Horizontal Sync = 35.5kHz
+# Timing: H=(0.54us, 1.34us, 1.25us) V=(0.23ms, 0.23ms, 0.93ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
+#
+# VESA 1024x768@60Hz Non-Interlaced mode
+# Horizontal Sync = 48.4kHz
+# Timing: H=(0.12us, 2.22us, 2.58us) V=(0.06ms, 0.12ms, 0.60ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+#
+# 1024x768@60Hz Non-Interlaced mode (non-standard dot-clock)
+# Horizontal Sync = 48.4kHz
+# Timing: H=(0.65us, 2.84us, 0.65us) V=(0.12ms, 0.041ms, 0.66ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1064 1240 1280 768 774 776 808
+#
+# VESA 1024x768@70Hz Non-Interlaced mode
+# Horizontal Sync=56.5kHz
+# Timing: H=(0.32us, 1.81us, 1.92us) V=(0.05ms, 0.14ms, 0.51ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+#
+# 1024x768@70Hz Non-Interlaced mode (non-standard dot-clock)
+# Horizontal Sync=56.25kHz
+# Timing: H=(0.44us, 1.89us, 1.22us) V=(0.036ms, 0.11ms, 0.53ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 72 1024 1056 1192 1280 768 770 776 806 -hsync -vsync
+#
+# 1024x768@76Hz Non-Interlaced mode
+# Horizontal Sync=62.5kHz
+# Timing: H=(0.09us, 1.41us, 2.45us) V=(0.09ms, 0.048ms, 0.62ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+#
+# 1280x1024@44Hz, Interlaced mode
+# Horizontal Sync=51kHz
+# Timing: H=(0.02us, 2.7us, 0.70us) V=(0.02ms, 0.24ms, 2.51ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+#
+# Alternate 1280x1024@44Hz, Interlaced mode (non-standard dot-clock)
+# Horizontal Sync=47.6kHz
+# Timing: H=(0.42us, 2.88us, 0.64us) V=(0.08ms, 0.12ms, 0.96ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024i" 75 1280 1312 1528 1576 1024 1028 1034 1080 Interlace
+#
+# 1280x1024@59Hz Non-Interlaced mode (non-standard)
+# Horizontal Sync=63.6kHz
+# Timing: H=(0.36us, 1.45us, 2.25us) V=(0.08ms, 0.11ms, 0.65ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1320 1480 1728 1024 1029 1036 1077
+#
+# 1280x1024@61Hz, Non-Interlaced mode
+# Horizontal Sync=64.25kHz
+# Timing: H=(0.44us, 1.67us, 1.82us) V=(0.02ms, 0.05ms, 0.41ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+#
+# 1280x1024@74Hz, Non-Interlaced mode
+# Horizontal Sync=78.85kHz
+# Timing: H=(0.24us, 1.07us, 1.90us) V=(0.04ms, 0.04ms, 0.43ms)
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+###############################################################################
+
+###############################################################################
+# Monitor: Acer Computer GmbH, Mod. No. 7033
+# (14" 8514/A compatible)
+# Contributor: Michael Riepe [riepe@ifwsn4.ifw.uni-hannover.de]
+# Last Edit Date: 11/20/1993
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25.175 640 672 768 800 480 490 492 525
+ "800x600" 36 800 832 976 1016 600 604 606 634
+ "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
+
+###############################################################################
+# Monitor: AcerView 25 uvga (also ViewSonic 5e)
+# Contributor: Thomas Dunbar [tdunbar@vtaix.cc.vt.edu]
+# Last Edit Date: 5/1/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 78 1024 1056 1336 1368 768 768 776 790
+
+###############################################################################
+# Monitor: AcerView 25 uvga (also ViewSonic 5e)
+# Contributor: Richard Brown [rab@tauon.ph.unimelb.edu.au]
+# Last Edit Date: 5/25/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 491 493 525
+ "800x600" 38 800 840 912 1024 600 601 603 625
+ "1024x768" 64 1024 1032 1176 1312 768 768 769 806
+ 80 1024 1104 1228 1360 768 768 769 802
+
+###############################################################################
+# Monitor: AcerView 25 uvga (also ViewSonic 5e)
+# Contributor: Craig E. Groeschel [craig@adikia.sccsi.com]
+# Last Edit Date: 11/18/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x400" 28.32 640 664 712 808 400 400 402 417 -hsync -vsync
+ "672x448" 28.32 672 712 760 864 448 451 454 466 -hsync -vsync
+ "680x510" 32 680 736 792 904 510 513 516 530 +hsync +vsync
+ "800x600" 40 800 848 1000 1056 600 603 606 621 +hsync +vsync
+ "920x690" 65 920 984 1024 1272 690 696 699 720 -hsync -vsync
+ "1024x768" 75 1024 1120 1256 1440 768 768 770 800 -hsync -vsync
+ 80 1024 1144 1296 1464 768 774 777 801 -hsync -vsync
+
+###############################################################################
+# Monitor: Addonics C172/LR Ultra 1280
+# Contributor: Joergen Haegg [jh@efd.lth.se]
+# Last Edit Date: 11/20/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+
+###############################################################################
+# Monitor: AOC CM-337
+# Contributor: Michael Schmidt [michael@amigo.guug.de]
+# Last Edit Date: 5/3/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 72 1024 1096 1272 1328 768 776 778 808
+
+###############################################################################
+# Monitor: AT&T CRT-329D
+# Contributor: Jerry Whelan [guru@stasi.bradley.edu]
+# Last Edit Date: 6/8/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "900x620" 40 900 928 1114 1140 620 628 639 643
+
+###############################################################################
+# Monitor: AT&T CRT-365 (Iocomm 16")
+# Contributor: Rick Calder [rick@rick.att.com]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 496 492 525
+ 28 640 672 768 800 480 490 492 525
+ "800x600" 36 800 816 952 1056 600 608 610 633
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+
+###############################################################################
+# Monitor: Compudyne KD-1450
+# Contributor: Rich Braun [richb@rkbhome.jti.com]
+# Last Edit Date: 3/7/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1096 1240 1344 768 771 777 806
+ 75 1024 1176 1312 1424 768 771 777 806
+
+###############################################################################
+# Monitor: CONRAC 7351
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1472 1568 1728 1024 1026 1029 1061
+
+###############################################################################
+# Monitor: CTX CMS-1561
+# Contributor: Steve Forsythe (forsse@meaddata.com)
+# Last Edit Date: 11/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ "1024x768" 75 1024 1072 1216 1352 768 769 775 806
+
+###############################################################################
+# Monitor: CTX 1760DF
+# Contributor: Thomas Dunbar [tdunbar@vtaix.cc.vt.edu]
+# Last Edit Date: 5/1/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x800" 80 1024 1048 1296 1320 800 800 808 818
+
+###############################################################################
+# Monitor: CTX SVGA model CVP-5468
+# Contributor: Tim Peiffer [peiffer@cs.umn.edu]
+# Last Edit Date: 1/27/92
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768i" 40 1024 1064 1224 1264 768 777 785 817 Interlace
+
+###############################################################################
+# Monitor: CTX SVGA model CVP-5468
+# Contributor: Bruce A Morley [bam@world.std.com]
+# Last Edit Date: 5/28/93
+#
+# name clock horizontal timing vertical timing flags
+ "512x384" 25.2 512 528 624 648 384 384 390 415
+ "560x420" 28.3 560 592 712 744 420 420 425 452
+ "624x468" 28.3 624 632 728 744 468 468 470 490
+ "760x570" 28.3 760 776 912 952 570 570 570 590
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+
+###############################################################################
+# Monitor: CTX SVGA CVP-5468
+# Contributor: Kent Hamilton [kenth@hns.st-louis.mo.US]
+# Last Edit Date: 11/18/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768i" 40 1024 1064 1224 1264 768 773 781 813 Interlace
+
+###############################################################################
+# Monitor: CTX SVGA model CVP-5468NI
+# Contributor: Brendan Boerner [bboerner@novell.com]
+# Last Edit Date: 10/29/92
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1072 1296 1328 768 773 780 806
+
+###############################################################################
+# Monitor: CTX SVGA model CVP-546NI
+# Contributor: Al Petrofsky [al@imdvlf.acuson.com]
+# Last Edit Date: 6/11/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ 40 800 840 968 1056 600 601 605 628
+ "1024x768" 65 1024 1088 1200 1328 768 783 789 818
+
+###############################################################################
+# Monitor: Data General 6628
+# Contributor: J"org Wunsch [joerg_wunsch@uriah.sax.de]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480t" 25 640 680 768 800 480 491 493 525
+ "640x480+" 28 640 672 760 816 480 491 493 525
+
+###############################################################################
+# Monitor: DEC PC7XV-DE
+# Contributor: Eric Hvozda [ack@clark.net]
+# Last Edit Date: 2/20/94
+#
+# name clock horizontal timing vertical timing flags
+ "640x350" 25 640 656 784 800 350 385 386 449
+ "640x400" 25 640 648 776 800 400 412 416 449
+ "640x480" 31 640 664 704 832 480 489 492 520
+ "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+ "1024x768" 75 1024 1048 1184 1320 768 771 790 811 -hsync -vsync
+
+###############################################################################
+# Monitor: DEC VR290-DA
+# Contributor: Paul Nixon [pnixon@ccd.harris.com]
+# Last Edit Date: 12/13/93
+#
+# name clock horizontal timing vertical timing flags
+ 1024x768 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+
+###############################################################################
+# Monitor: DEC VRC16
+# Contributor: Jack Coyote [uphrrmk@gemini.oscs.montana.edu]
+# Last Edit Date: 6/15/93
+#
+# name clock horizontal timing vertical timing flags
+ "904x675" 45 904 951 1124 1192 675 690 693 729
+
+###############################################################################
+# Monitor: DEC VRC16
+# Contributor: Peter Brouwer [pb@idca.tds.philips.nl]
+# Last Edit Date: 6/18/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "984x731" 62 984 992 1080 1280 731 735 739 767
+ "984x762" 62 984 1040 1104 1280 762 790 800 820
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+ "1024x768" 62 1024 1096 1160 1328 768 776 778 808
+ "1088x768" 62 1088 1224 1288 1328 768 776 778 808
+
+###############################################################################
+# Monitor: Dell VC-10C
+# Contributor: Adam Harris [harris@cs.uchicago.edu]
+# Last Edit Date: 10/17/93
+#
+# name clock horizontal timing vertical timing flags
+"640x480" 45 640 672 722 832 480 485 487 505
+"640x490" 45 640 672 722 832 490 490 492 512
+"712x544" 45 712 778 840 912 544 554 557 580
+"728x546" 45 728 760 864 928 546 548 551 570
+
+###############################################################################
+# Monitor: Dell UltraScan FS17-EZ Model VC7EN
+# Contributor: James Hawtin [J.W.Hawtin@lut.ac.uk]
+# Last Edit Date: 4/13/94
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 664 704 832 480 489 492 520
+ "800x600" 40 800 848 1000 1056 600 605 607 633
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+ "1152x900" 80 1152 1200 1280 1528 900 900 903 930
+
+###############################################################################
+# Monitor: EDGE/MAG 1564NI
+# Contributor: Analytical Methods [ami@nwnet.net]
+# Last Edit Date: 2/9/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ "1024x768" 80 1024 1072 1296 1320 768 772 774 803
+
+###############################################################################
+# Monitor: EIZO/Nanao 8060i
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1040 1048 1296 768 781 792 826
+
+###############################################################################
+# Monitor: EIZO/Nanao 8060s
+# Contributor: Holger Veit [veit@du9ds3.uni-duisburg.de]
+# Last Edit Date: 9/22/92
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 41 800 904 1064 1168 600 603 609 630
+ "848x600" 41 848 878 1040 1120 600 604 611 630
+
+###############################################################################
+# Monitor: EIZO/Nanao 9070s
+# Contributor: Steinthor Bjarnason [stb@isbank.is]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1072 1176 1272 768 778 779 804
+ 75 1024 1072 1176 1272 768 778 779 804
+ "1152x900i" 75 1152 1184 1288 1360 900 898 929 939 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao 9070s
+# Contributor: Arnd Gehrmann [arnd@zeus.informatik.rwth-aachen.de]
+# Last Edit Date: 9/6/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 40 640 672 768 800 480 490 492 525
+ "800x600" 43 800 840 976 1010 600 610 643 650
+ "1024x768" 63 1024 1096 1100 1280 768 791 795 829
+ "1024x768i" 63 1024 1096 1100 1280 768 775 795 829 Interlace
+ "1152x900i" 63 1152 1170 1370 1380 900 890 929 939 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao 9070s
+# Contributor: Paul De Bra [debra@win.tue.nl]
+# Last Edit Date: 8/28/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28 640 672 768 784 480 490 492 525
+ "800x600" 45 800 832 942 966 600 600 609 631
+ "1024x768i" 62 1024 1064 1224 1240 768 777 785 817 Interlace
+ "1024x768" 62 1024 1100 1204 1304 768 778 783 810
+ "1152x900i" 62 1152 1192 1296 1408 900 909 917 961 Interlace
+ "1280x1024i" 62 1280 1320 1440 1540 1024 1025 1037 1065 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao 9070u
+# Contributor: David Wexelblat [dwex@xfree86.org]
+# Last Edit Date: 10/14/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 40 640 672 768 800 480 490 492 525
+ "800x600" 45 800 848 960 1008 600 603 620 640
+ "1024x768" 65 1024 1088 1224 1304 768 772 788 824
+ "1152x900i" 75 1152 1224 1384 1504 900 905 923 965 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao 9070u
+# Contributor: Thomas M. Hoberg [tmh@first.gmd.de]
+# Last Edit Date: 2/23/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "1024x768" 65 1024 1088 1224 1304 768 772 788 824
+ "1152x900i" 65 1152 1192 1296 1408 900 909 917 961 Interlace
+ "1280x1024i" 65 1280 1320 1440 1540 1024 1025 1037 1065 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao 9080i
+# Contributor: Scott Everden [scott@unixland.natick.ma.us]
+# Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28 640 672 768 800 480 490 492 525
+ "800x600" 50 800 820 860 1028 600 608 610 633
+ "1024x768" 72 1024 1064 1176 1300 768 778 793 806
+ 85 1024 1040 1112 1328 768 804 809 859
+ "1152x900i" 64 1152 1184 1288 1400 900 904 933 943 Interlace
+ "1280x1024" 110 1280 1296 1408 1696 1024 1034 1044 1081
+
+###############################################################################
+# Monitor: EIZO/Nanao 9400i
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 63 1024 1064 1104 1280 768 780 795 829
+ 85 1024 1072 1120 1328 768 796 801 853
+ "1280x1024" 110 1280 1328 1392 1712 1024 1027 1032 1071
+
+###############################################################################
+# Monitor: EIZO/Nanao 9500
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1072 1088 1280 768 787 798 832
+ "1280x1024" 110 1280 1312 1408 1696 1024 1043 1053 1081
+
+###############################################################################
+# Monitor: EIZO/Nanao 550i
+# Contributor: Bill Broadley [broadley@neurocog.lrdc.pitt.edu]
+# Last Edit Date: 11/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 80 1024 1040 1080 1374 768 769 771 790
+
+###############################################################################
+# Monitor: EIZO/Nanao F550i
+# Contributor: Mark Weaver [Mark_Weaver@brown.edu]
+# Last Edit Date: 11/24/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 45 800 856 976 1040 600 637 643 666
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806
+ "1152x900i" 80 1152 1168 1384 1440 900 901 907 945 Interlace
+ "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+
+###############################################################################
+# Monitor: EIZO/Nanao F550i-M
+# Contributor: Michael Hirsch [mike@rolivaw.pr.net.ch]
+# Last Edit Date: 3/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 50 800 816 912 976 600 610 614 628
+ "1024x768" 80 1024 1088 1216 1344 768 778 782 806
+ "1152x900" 80 1152 1200 1312 1528 900 910 916 930
+
+###############################################################################
+# Monitor: EIZO/Nanao T550i-M
+# Contributor: Holger Wirtz [chick@midips.in-berlin.de]
+# Last Edit Date: 02/25/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1120 1304 1328 768 771 777 806
+
+###############################################################################
+# Monitor: EIZO/Nanao T560i
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 63 1024 1096 1136 1280 768 791 795 829
+ 85 1024 1112 1168 1328 768 804 809 853
+ "1280x1024" 110 1280 1424 1488 1712 1024 1038 1043 1071
+ 135 1280 1424 1504 1704 1024 1028 1033 1056
+
+###############################################################################
+# Monitor: EIZO/Nanao T560i
+# Contributor: Ronald D. Hindmarsh [ronald@cs.tu-berlin.de]
+# Last Edit Date: 5/1/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 509
+ "1024x768" 80 1024 1056 1080 1328 768 776 786 800
+ 120 1024 1056 1080 1328 768 776 786 800
+
+###############################################################################
+# Monitor: EIZO/Nanao T560i
+# Contributor: Raymond Nijssen [raymond@woensel.es.ele.tue.nl]
+# Last Edit Date: 11/23/93
+#
+# name clock horizontal timing vertical timing flags
+ "1152x910" 89.8 1152 1256 1272 1424 910 907 912 929
+
+###############################################################################
+# Monitor: EIZO/Nanao T560iT92
+# Contributor: Norbert Distler [norbert@physik.tu-muenchen.de]
+# Last Edit Date: 11/24/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 56 800 856 976 1040 600 637 643 666
+
+###############################################################################
+# Monitor: EIZO/Nanao T660i
+# Contributor: Ng Pheng Siong [ngps@stargate.np.ac.sg]
+# Last Edit Date: 3/20/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 80 1024 1088 1216 1344 768 777 782 810
+
+###############################################################################
+# Monitor: ESCOMM 15"
+# Contributor: Hartmut Kuehn Allgemeine Box IET
+# [KUEHNNTE@Rcms1.urz.tu-dresden.de]
+# Last Edit Date: 1/13/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 648 696 776 480 490 492 525
+ 28 640 672 808 832 480 490 492 525
+ "800x600" 35 800 896 984 992 600 608 610 633
+ 40 800 848 984 1032 600 608 610 633
+ 45 800 896 984 1000 600 608 610 633
+ "816x607" 50 816 824 960 1040 607 608 610 633
+ "1024x768i" 45 1024 1248 1312 1328 768 771 777 807 Interlace
+ "1024x768" 65 1024 1048 1304 1356 768 771 777 806
+ 72 1024 1112 1256 1296 768 771 777 806
+ "1096x822" 80 1096 1112 1368 1384 822 830 840 876
+
+###############################################################################
+# Monitor: ESCOM CSU5977L-E
+# Contributor: Paul Seelig <pseelig@goofy.zdv.Uni-Mainz.de>
+# Last Edit Date: 97-10-20
+#
+# name clock horizontal timing vertical timing flags
+ "888x664" 72.16 888 936 1072 1216 664 668 675 695
+ "920x690" 64.98 920 984 1024 1192 690 692 695 716 -hsync -vsync
+ "920x690" 65.03 920 980 1020 1188 690 692 695 712 -hsync -vsync
+ "1152x864" 50 1152 1188 1372 1388 864 865 874 899 interlace
+ "1152x900" 65 1152 1172 1316 1436 900 901 907 947 interlace
+
+###############################################################################
+# Monitor: ESCOM (Liberty?) 20" ES8923MNR
+# Contributor: Guido Kueppers ^[Kueppers@uni-bonn.de|
+# Last Edit Date: 11/17/93
+#
+# name clock horizontal timing vertical timing flags
+ "1152x900" 80 1152 1184 1264 1408 900 905 908 936
+ "1184x884" 80 1184 1216 1296 1460 884 884 888 913
+
+###############################################################################
+# Monitor: Everex Eversync/VGA
+# Contributor: Dan Ellison [dan@dribble.c-mols.siu.edu]
+# Last Edit Date: 2/20/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ 30 640 664 704 832 480 489 492 520
+ "800x600" 36 800 816 952 1056 600 608 610 633
+ 36 800 832 966 966 600 600 609 631
+ 40 800 864 896 1008 600 600 606 624
+ 40 800 872 968 1104 600 600 606 624
+ "808x608" 40 808 849 977 1066 606 607 609 634
+ "832x624" 40 832 873 1001 1090 624 625 627 651
+
+###############################################################################
+# Monitor: Gateway 2000 Crystal Scan NI (Mag Computronics 1448)
+# Contributor: Thomas Naughton [naughton@chinet.chi.il.us]
+# Last Edit Date: 10/17/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 50 800 864 970 1056 600 608 615 633
+ "1152x900i" 68 1152 1172 1288 1368 900 909 933 937 Interlace
+
+###############################################################################
+# Monitor: Gateway 2000 Crystal Scan NI (Mag Computronics 1448)
+# Contributor: Jim Bray [jb@tinuviel.cs.wcu.edu[
+# Last Edit Date: 6/16/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1064 1272 1304 768 768 789 789
+
+###############################################################################
+# Monitor: Gateway 2000 Crystal Scan
+# Contributor: John LoSecco [losecco@undpdk.hep.nd.edu]
+# Last Edit Date: 10/20/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 656 752 800 480 490 492 525
+ "800x600" 36 800 808 944 984 600 608 612 633
+ "1024x768i" 50 1024 1024 1216 1312 768 768 779 809 Interlace
+ "1152x900i" 65 1152 1200 1448 1664 900 900 912 947 Interlace
+
+###############################################################################
+# Monitor: Gateway 2000 Crystal Scan 1024NI
+# Contributor: [reinert@lilac.cs.odu.edu]
+# Last Edit Date: 5/4/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 50 800 856 976 1040 600 600 606 625
+ "1024x768" 65 1024 1096 1264 1344 768 771 777 806
+
+###############################################################################
+# Monitor: Gateway 2000 Crystal Scan 1024NI
+# Contributor: Kent Hamilton [kenth@hns.st-louis.mo.US]
+# Last Edit Date: 11/18/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1088 1256 1328 768 771 777 806
+ "1120x840i" 50 1120 1152 1325 1440 840 859 893 915
+
+###############################################################################
+# Monitor: Gateway 2000 (MAG) Crystal Scan 1572 FS
+# Contributor: Bill C. Riemers [bcr@physics.purdue.edu]
+# Last Edit Date: 5/4/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 51 800 800 1000 1000 600 600 606 616
+ 65 800 824 944 1032 600 600 606 624
+ "1024x768" 65 1024 1024 1264 1264 768 770 788 792
+ 75 1024 1048 1184 1288 768 773 777 806
+ "1152v910" 80 1152 1176 1424 1424 910 910 924 936
+ 80 1152 1176 1272 1432 910 920 930 950
+
+###############################################################################
+# Monitor: GraphTEC CD2060
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1440 1568 1696 1024 1027 1029 1081
+
+###############################################################################
+# Monitor: Hitachi 20MVX
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1296 1512 1664 1024 1032 1038 1072
+
+###############################################################################
+# Monitor: Hitachi CM2073A-301
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x960" 110 1280 1464 1616 1728 960 969 985 1061
+
+###############################################################################
+# Monitor: Hitachi 20S
+# Contributor: Rich Murphey [rich@rice.edu]
+# Contributor: Rod Grimes [rgrimes@freefall.cdrom.com]
+# Contributor: David Greenman [davidg%implode@percy.rain.com]
+# Last Edit Date: 11/20/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 74 1024 1040 1200 1300 768 772 777 809
+ "1152x900" 85 1152 1184 1376 1464 900 905 923 955
+ "1280x960" 108 1280 1288 1400 1620 960 961 979 1012
+ "1280x1024" 110 1280 1288 1500 1688 1024 1026 1031 1077
+
+###############################################################################
+# Monitor: Hitachi HM-4119
+# Contributor: Todd Pfaff [todd@flex.eng.mcmaster.ca]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 80 1024 1104 1232 1328 768 769 777 817 -hsync -vsync
+ composite
+ "1152x900" 92 1152 1232 1376 1456 900 901 909 945 -hsync -vsync
+ composite
+
+###############################################################################
+# Monitor: IBM 8514-001
+# Contributor: Mark Petrovic [petrovic@watson.ibm.com]
+# Last Edit Date: 5/11/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "1024x768i" 45 1024 1040 1184 1272 768 774 776 813 Interlace
+
+###############################################################################
+# Monitor: IDEKIiyama
+# Contributor: Nicolai Langfeldt [janl@ifi.uio.no]
+# Comments: Max 57KHz horizontal refresh
+# Last Edit Date: 8/11/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 35 640 664 760 800 480 491 493 525
+ "1024x768" 70 1024 1056 1232 1264 768 768 772 806
+ 72 1024 1056 1232 1264 768 768 772 806
+ "1272x824" 91 1272 1432 1520 1600 824 824 830 865
+ "1120x753" 80 1120 1184 1264 1400 753 753 757 791
+ "1120x840" 80 1120 1184 1264 1400 840 840 844 882
+ "1144x858" 82 1144 1184 1264 1432 858 858 862 900
+ "1152x900" 80 1152 1200 1280 1440 900 900 903 930
+ "1184x884" 80 1184 1216 1296 1460 884 884 888 913
+
+###############################################################################
+# Monitor: IDEKIiyama MF-5217
+# Contributor: Jun Arihara[j_ariha@hoffman.cc.sophia.ac.jp]
+# Takahiro Noguchi[Takahiro.Noguchi@Japan.Sun.COM]
+# Last Edit Date: 2/20/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ 25 640 672 768 800 480 490 492 525
+ 28 640 672 768 800 480 490 492 525
+ 31 640 664 704 832 480 489 492 520
+ "800x600" 36 800 816 952 1056 600 608 610 633
+ 39 800 864 896 1008 600 600 606 624
+ 40 800 840 968 1056 600 601 605 628
+ 45 800 824 960 976 600 600 602 612
+ 50 800 856 976 1040 600 637 643 666
+ "920x690" 62 920 952 1088 1168 690 688 718 724
+ "1024x768i" 44 1024 1040 1216 1264 768 777 785 817 Interlace
+ 44 1024 1064 1224 1264 768 777 785 817 Interlace
+ 45 1024 1064 1224 1264 768 777 785 817 Interlace
+ 50 1024 1064 1224 1264 768 776 778 808 Interlace
+ "1024x768" 44 1024 1040 1216 1264 768 777 785 817
+ 44 1024 1064 1224 1264 768 777 785 817
+ 45 1024 1064 1224 1264 768 776 778 808
+ 50 1024 1064 1224 1264 768 776 778 808
+ 50 1024 1072 1176 1272 768 778 779 804
+ 62 1024 1096 1272 1328 768 776 778 808
+ 62 1024 1072 1176 1272 768 778 779 804
+ 62 1024 1092 1220 1344 768 786 791 810
+ 62 1024 1072 1200 1240 768 766 782 786
+ 65 1024 1032 1176 1344 768 771 777 806
+ 85 1024 1032 1152 1360 768 784 787 823
+ "1152x900i" 62 1152 1184 1288 1360 900 898 929 939 Interlace
+ "1280x1024i" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+ "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+ 135 1280 1312 1456 1712 1024 1027 1030 1064
+
+###############################################################################
+# Monitor: IDEK MC 2185
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1280 1408 1680 1024 1029 1032 1071
+ 144 1280 1312 1456 1760 1024 1036 1039 1091
+
+###############################################################################
+# Monitor: IDEK MF 5421
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1024 1160 1280 768 798 807 831
+ 85 1024 1032 1160 1328 768 807 822 853
+ "1280x1024" 110 1280 1328 1520 1728 1024 1022 1033 1061
+ 135 1280 1344 1424 1688 1024 1028 1037 1066
+ 144 1280 1312 1456 1760 1024 1036 1039 1091
+
+###############################################################################
+# Monitor: IDEK Iiyama MF-8617 Vision Master
+# Contributor: Gunar Schorcht [schorcht@theoinf.tu-ilmenau.de]
+# Comments: max 86kHz horizontal refresh
+# Last Edit Date: 07/14/94
+#
+# Mode Refresh(Hz) Hor.Sync(kHz) Clock(MHz)
+# ------------------------------------------------------------------------
+# 640x480 72 37.9 31.5
+# 800x600 71 50.0 50.0
+# 1024x768 75 62.5 85.0
+# 1152x900 75 71.0 110.0
+# 1280x1024 61 64.3 110.0
+# 1280x1024 74 78.8 135.0
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 664 704 832 480 489 492 520
+ "800x600" 50 800 840 960 1000 600 637 643 700
+ "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+ "1152x900" 110 1152 1212 1500 1552 900 910 915 945
+ "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+ 135 1280 1312 1456 1712 1024 1027 1030 1064
+
+###############################################################################
+# Monitor: IIYAMA Vision Master 500 (MF-8721)
+# Contributor: Gaetan Soltesz <sg907924@stmail.staffs.ac.uk>
+# Last Edit Date: 97-11-10
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync
+ "800x600" 69.65 800 864 928 1088 600 604 610 640 +HSync +VSync
+ "1024x768" 115.5 1024 1056 1248 1440 768 771 781 802 +HSync +VSync
+ "1152x864" 137.65 1152 1184 1312 1536 864 866 885 902 +HSync +VSync
+ "1280x1024" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 +HSync +VSync
+ "1600x1200" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync
+
+###############################################################################
+# Monitor: Interquadram CA2020
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1512 1640 1736 1024 1032 1046 1056
+
+###############################################################################
+# Monitor: INTRA CM-14[2-3]3
+# Contributor: Yasunari Momoi[s905571@educ.info.kanagawa-u.ac.jp]
+# Last Edit Date: 2/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "888x618" 40 888 912 1072 1152 618 621 623 661
+
+###############################################################################
+# Monitor: Kuo Feng Corporation CK-1405
+# Contributor: Brad Midgley [bmidgley@peruvian.cs.utah.edu]
+# Last Edit Date: 5/1/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 480 484 504
+ "744x558" 32 744 776 896 928 558 558 563 585
+ "824x618" 36 824 856 1000 1032 618 618 623 648
+ "1024x768" 65 1024 1092 1220 1344 768 786 791 810
+ "1080x810" 65 1080 1096 1336 1352 810 810 817 850
+
+###############################################################################
+# Monitor: Leading Edge CMC-1414BA
+# Contributor: Keith Walker [kew@timesink.spk.wa.us]
+# Last Edit Date: 5/17/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1056 1208 1272 768 774 777 802
+ "1108x796" 65 1108 1136 1288 1344 796 796 799 814
+
+###############################################################################
+# Monitor: MAG15F
+# Contributor: John Brezak [brezak@apollo.hp.com]
+# Last Edit Date: 12/6/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ 31 640 664 704 832 480 489 492 520
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ 40 800 840 968 1056 600 601 605 628
+ 50 800 856 976 1040 600 637 643 666
+ "1024x768i" 44 1024 1040 1216 1264 768 777 785 817 Interlace
+ "1024x768" 75 1024 1056 1204 1324 768 774 803 806
+
+###############################################################################
+# Monitor: MAG 1564NI
+#
+# See entry under "EDGE/MAG 1564NI" above.
+
+###############################################################################
+# Monitor: MAG Innovision LX1564 15"
+# Contributor: Chris Metcalf [metcalf@lcs.mit.edu]
+# Last Edit Date: 7/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 41 640 656 680 792 480 480 481 500
+ "800x600" 45 800 808 840 992 600 601 603 619
+ "1024x768" 80 1024 1040 1080 1374 768 769 771 790
+ "1152x900" 80 1152 1184 1224 1448 900 901 903 922
+ 90 1152 1216 1256 1480 900 900 901 925
+
+###############################################################################
+# Monitor: MAG MX-17H
+# Contributor: Richard Gooch [rgooch@atnf.csiro.au]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "1152x900" 95 1152 1152 1168 1472 900 900 931 939
+ "1152x900" 95 1152 1152 1192 1472 900 900 911 925
+ "1152x900f" 110 1152 1152 1168 1616 900 900 911 925
+
+###############################################################################
+# Monitor: MAG MX-17H
+# Contributor: Dave Truckenmiller [trucken@cs.umn.edu]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 47 800 800 944 1016 600 600 603 617
+
+###############################################################################
+# Monitor: MAG MX-17H
+# Contributor: Jordan K. Hubbard [jkh@whisker.lotus.ie]
+# Last Edit Date: 11/23/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 74 1024 1040 1200 1300 768 772 777 809
+ "1200x900" 105 1200 1208 1364 1572 900 905 923 955
+
+###############################################################################
+# Monitor: Mag Technology Co. PMV1448
+# Contributor: Mark Petrovic [petrovic@watson.ibm.com]
+# Last Edit Date: 5/12/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 752 800 480 481 483 520
+ "1024x768" 65 1024 1120 1328 1360 768 769 772 796
+
+###############################################################################
+# Monitor: Magnavox CM9089-BE41
+# Contributor: Joseph P. DeCello III [jpd@cad.msu.edu]
+# Last Edit Date: 5/2/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+
+###############################################################################
+# Monitor: MediaScan 5A
+# Contributor: Neville H. Chandler [nhc@mtdcr.mt.att.com]
+# Last Edit Date: 10/13/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "840x615" 36 840 840 992 1024 615 617 620 630
+ "1024x593" 45 1024 1040 1216 1280 593 596 602 610
+ "1024x768" 65 1024 1032 1176 1344 768 771 777 806
+
+###############################################################################
+# Monitor: MICROVITEC Definition 20
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1176 1224 1336 768 770 774 798
+ "1280x1024" 110 280 1504 1600 1696 1024 1034 1036 1081
+
+###############################################################################
+# Monitor: Mitsubishi Diamond Scan
+# Contributor: Wei Jen Yeh [yeh@cs.purdue.edu]
+# Last Edit Date: 5/21/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 851 987 1056 600 608 610 633
+ "1000x750i" 45 1000 1040 1208 1248 750 750 756 788 Interlace
+
+###############################################################################
+# Monitor: Mitsubishi HL 6915
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 63 1024 1080 1208 1336 768 772 776 796
+ "1280x1024" 110 1280 1344 1536 1744 1024 1031 1034 1060
+
+###############################################################################
+# Monitor: Mitsubishi HL 6915
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1072 1088 1280 768 787 798 832
+ "1280x1024" 110 1280 1312 1408 1696 1024 1043 1053 1081
+
+###############################################################################
+# Monitor: Mitsubishi HL 7925
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1312 1408 1728 1024 1026 1029 1054
+
+###############################################################################
+# Monitor: Mitsubishi HL 7955
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 63 1024 1072 1120 1280 768 785 795 829
+ 85 1024 1112 1168 1328 768 798 809 853
+ "1280x1024" 110 1280 1408 1488 1712 1024 1029 1043 1071
+ 135 1280 1312 1456 1704 1024 1028 1033 1056
+
+###############################################################################
+# Monitor: Moniterm/Amtron CD19
+# Contributor: Ari Lemke [arl@cs.hut.fi]
+# Last Edit Date: 8/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "1136x766" 72.16 1136 1216 1312 1480 766 769 772 812
+
+###############################################################################
+# Monitor: MTC EM 1428
+# Contributor: Steven Hessing [stevenh@sci.kun.nl]
+# Last Edit Date: 2/15/93
+#
+# name clock horizontal timing vertical timing flags
+ "832x624" 38 832 864 1016 1048 624 624 630 655
+
+###############################################################################
+# Monitor: Nanao 8060i
+# Monitor: Nanao 9070s
+# Monitor: Nanao 9070u
+# Monitor: Nanao 9080i
+# Monitor: Nanao 9400i
+# Monitor: Nanao 9500
+# Monitor: Nanao F550i
+# Monitor: Nanao F550i-M
+# Monitor: Nanao T550i-M
+# Monitor: Nanao T560i
+# Monitor: Nanao T560iT92
+# Monitor: Nanao T660i
+#
+# See entries under "EIZO" above.
+
+###############################################################################
+# Monitor: NEC 2A
+# Contributor: Jui-Lin Lu [jlu@cs.umr.edu]
+# Last Edit Date: 10/6/92
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 892 1044 1136 600 603 609 630
+
+###############################################################################
+# Monitor: NEC 2A
+# Contributor: Jim Niemira [niemira@fstrf.org]
+# Last Edit Date: 5/1/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28 640 676 776 812 480 480 485 505
+
+###############################################################################
+# Monitor: NEC 3D
+# Contributor: Michael Umansky [misha@stratus.swdc.com]
+# Last Edit Date: 10/30/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x500" 32 640 728 768 800 500 506 492 533
+ "800x600" 45 800 912 974 998 600 600 609 631
+ "840x640" 45 840 936 942 1038 640 624 625 639
+ "900x690" 60 900 1024 1080 1112 690 690 695 720
+ "1056x792i" 45 1056 1072 1224 1264 792 785 785 817 Interlace
+
+###############################################################################
+# Monitor: NEC 3D
+# Contributor: Alfonso Marmora [ajm@icc.com]
+# Last Edit Date: 12/12/91
+#
+# name clock horizontal timing vertical timing flags
+ "496x372" 25 496 568 576 624 372 372 378 390
+ "552x414" 28 552 632 640 696 414 414 420 434
+ "712x534" 36 712 808 824 896 534 534 535 560
+ "800x600" 40 800 904 920 1000 600 600 601 630
+ "896x672" 45 896 1008 1032 1120 672 672 674 705
+ "992x744" 50 992 1112 1152 1248 744 744 746 781
+ "1296x972" 65 1296 1448 1496 1624 972 972 972 1020
+
+###############################################################################
+# Monitor: NEC 3D
+# Contributor: Kevin Cummings [cummings@kjc386.framingham.ma.us]
+# Last Edit Date: 8/25/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "704x528" 28 704 744 848 888 528 534 536 554
+ "728x534" 28 728 752 856 888 534 534 536 554
+ "800x600" 36 800 824 896 1024 600 601 603 625
+
+###############################################################################
+# Monitor: NEC 3FGx
+# Contributor: Rik Faith [faith@cs.unc.edu]
+# Last Edit Date: 3/27/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 50 800 856 976 1040 600 637 643 693
+ "1024x768" 65 1024 1048 1184 1344 768 771 777 806
+
+###############################################################################
+# Monitor: NEC 4D
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1144 1208 1320 768 778 782 808
+ 85 1024 1200 1280 1424 768 793 814 851
+
+###############################################################################
+# Monitor: NEC 4D
+# Contributor: Dave Barker [dbarker@mulga.awadi.com.au]
+# Last Edit Date: 4/7/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 60 800 868 1050 1056 600 600 603 636
+ "1024x768" 60 1024 1056 1294 1296 768 776 778 808
+ "1152x900i" 60 1152 1232 1408 1456 900 908 912 965 Interlace
+
+###############################################################################
+# Monitor: NEC 4DS
+# Contributor: Jim Bray [jb@cw.wcu.edu]
+# Last Edit Date: 6/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 72 1024 1088 1264 1272 768 768 771 804
+ 75 1024 1080 1264 1288 768 768 771 805
+ 80 1024 1072 1288 1328 768 768 771 807
+ "1152x900" 80 1152 1216 1288 1416 900 900 903 920
+
+###############################################################################
+# Monitor: NEC 4FG
+# Contributor: Gerco Ballintijn [bcballi@cs.vu.nl]
+# Last Edit Date: 5/3/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 40 800 840 968 1056 600 601 605 628 -hsync +vsync
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 +hsync +vsync
+ "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync +vsync
+
+###############################################################################
+# Monitor: NEC 5D
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 3/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 64 1024 1144 1208 1320 768 778 782 808
+ 85 1024 1104 1200 1328 768 800 806 853
+ "1280x1024" 110 1280 1504 1608 1720 1024 1024 1029 1066
+
+###############################################################################
+# Monitor: NEC 5FG
+# Contributor: Rick Richardson [rick@digibd.com]
+# Last Edit Date: 3/12/92
+#
+# name clock horizontal timing vertical timing flags
+ "1152x900" 80 1152 1184 1264 1408 900 905 908 936
+ 80 1152 1164 1244 1408 900 900 903 936
+
+###############################################################################
+# Monitor: NEC 5FG
+# Contributor: Brian Smith [brians@rigel.cs.pdx.edu]
+# Last Edit Date: 6/24/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 50 640 672 768 850 480 550 650 650
+ "1024x768" 72 1024 1032 1264 1272 768 786 791 810
+ "1152x900" 80 1152 1160 1376 1416 900 900 940 948
+
+###############################################################################
+# Monitor: NEC 5FG
+# Contributor: [hedrick@cs.rutgers.edu]
+# Last Edit Date: 8/29/92
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 56 800 800 800 980 600 603 609 625
+ "1024x768" 80 1024 1024 1024 1260 768 768 773 790
+
+###############################################################################
+# Monitor: NEC 5FG
+# Contributor: [tim@hecate.astro.cf.ac.uk]
+# Last Edit Date: 6/15/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1065 1065 1260 768 787 792 810
+
+###############################################################################
+# Monitor: NEC 5FG.
+# Contributor: Hans Nasten [nasten@everyware.se]
+# Last Edit Date: 11/18/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 32 640 684 724 832 480 489 492 520
+ "800x600" 50 800 856 976 1040 600 637 643 666
+ "1024x768" 75 1024 1032 1264 1272 768 786 791 810
+
+###############################################################################
+# Monitor: NEC 5FG (also works with MAG MX-17H)
+# Contributor: Richard Gooch [rgooch@atnf.csiro.au]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "1152x900" 95 1152 1152 1192 1472 900 900 931 939
+
+###############################################################################
+# Monitor: NEC 5FGe
+# Contributor: [skelton%jdp.uucp@dragon.com]
+# Last Edit Date: 11/29/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28.322 640 680 720 864 480 488 491 521
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+
+###############################################################################
+# Monitor: NEC 5FGp
+# Contributor: Steven King [king@wildebeest.cig.mot.com]
+# Last Edit Date: 3/7/94
+#
+# name clock horizontal timing vertical timing flags
+ "1152x900" 90 1152 1152 1208 1448 900 900 940 948
+
+###############################################################################
+# Monitor: NEC Multisync JC-14O1P3ED
+# Contributor: Dirk Hohndel [hohndel@xfree86.org]
+# Last Edit Date: 05/11/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 832 984 1016 600 600 608 630
+ "880x540" 45 880 896 1040 1144 540 546 548 561
+ "912x684" 45 912 944 1112 1144 684 684 691 718
+ "980x596" 50 984 1000 1160 1272 596 600 602 618
+ "976x560" 50 976 992 1160 1272 560 562 564 582
+ "1024x768i" 45 1024 1064 1224 1264 768 789 799 817 Interlace
+
+###############################################################################
+# Monitor: NEC Multisync II
+# Contributor: Steve Hite [shite@sinkhole.unf.edu]
+# Creator: Chin Fang [fangchin@leland.stanford.edu]
+# Last Edit Date: 10/15/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28 640 676 776 812 480 480 485 505
+ "752x564" 36 752 788 916 952 564 564 569 594
+ "800x600" 40 800 864 1000 1056 600 600 605 631
+
+###############################################################################
+# Monitor: NEC Multisync II
+# Contributor: Steven H. Izen [steve@pitacat.math.cwru.edu]
+# Last Edit Date: 1/26/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 816 944 1056 600 601 605 628
+
+###############################################################################
+# Monitor: ViewSonic 17
+# Contributor: Steven Wallace [swallace@ece.uci.edu]
+# Last Edit Date: 11/22/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1056 1296 1328 768 768 778 807
+ "1024x800" 94.6 1152 1184 1544 1576 800 801 808 845
+
+###############################################################################
+# Monitor: Packard Bell (model unknown)
+# Contributor: E.J.McKernan [ejm@datalog.com]
+# Last Edit Date: 12/16/91
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 36 800 820 952 1000 600 610 617 633
+
+###############################################################################
+# Monitor: Panasonic Panasync 1381
+# Contributor: Jeff Michaud [michaud@cdsmn.mn.org]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 40 800 824 1008 1016 600 608 610 631
+
+###############################################################################
+# Monitor: Panasonic PanaSync C1381
+# Contributor: Shaun T. Erickson [ste@alux2.att.com]
+# Last Edit Date: 1/21/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 680 776 800 480 491 493 525
+ "800x600" 36 800 848 920 1024 600 601 603 625
+ 40 800 832 960 1056 600 601 605 628
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+
+###############################################################################
+# Monitor: Panasonic PanaSync C1391
+# Contributor: Nathan Laredo [nathan@eas.gatech.edu]
+# Last Edit Date: 12/9/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 688 760 800 480 491 493 525
+ "800x600" 40 800 840 968 1056 600 601 605 628
+ "1024x768i" 45 1024 1072 1176 1264 768 770 772 813 Interlace
+ "1024x1024i" 45 1024 1104 1176 1360 1024 1025 1029 1063 Interlace
+
+###############################################################################
+# Monitor: Panasonic TX 2002
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 100 1280 1488 1592 1744 1024 1027 1029 1051
+
+###############################################################################
+# Monitor: Philips 7CM3279 14" Super VGA 1024x768 interlaced
+# Contributor: Rui Salgueiro [rps@mat.uc.pt]
+# Last Edit Date: 29/12/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 680 776 800 480 491 493 525
+ 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 848 920 1024 600 601 603 625
+ "840x630" 36 840 848 920 1024 630 631 633 655
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+ "1032x774i" 45 1032 1064 1224 1264 774 783 791 823 Interlace
+
+###############################################################################
+# Monitor: Philips 8CM3279 14" Super VGA 1024x768 NI
+# Contributor: Rui Salgueiro [rps@mat.uc.pt]
+# Last Edit Date: 5/4/93
+#
+# name clock horizontal timing vertical timing flags
+ "648x486" 25 648 672 768 800 486 496 498 525
+ "728x546" 45 728 784 904 928 546 557 560 592
+ 45 728 784 904 928 546 548 551 570
+ "816x612" 50 816 880 1008 1040 612 623 626 658
+ "952x600b" 58 952 1032 1184 1200 600 611 614 646
+ "1064x796" 65 1064 1104 1280 1352 796 807 811 843
+ "1072x600" 65 1072 1144 1320 1352 600 611 614 646
+ "1072x804" 65 1072 1104 1280 1352 804 814 824 856
+ "1160x486" 45 1160 1208 1384 1440 486 496 498 525
+
+###############################################################################
+# Monitor: Philips C2064
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1520 1632 1720 1024 1031 1033 1066
+
+###############################################################################
+# Monitor: Philips PRO 7BM749 14" Mono VGA
+# Contributor: Stephen Hocking [sgccseh@citecuc.citec.oz.au]
+# Last Edit Date: 1/9/92
+#
+# name clock horizontal timing vertical timing flags
+"704x480m" 28 704 784 792 888 480 484 512 536
+
+###############################################################################
+# Monitor: Qume QM835
+# Contributor: Geraldo Veiga [ilan343@violet.berkeley.edu]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768i" 40 1024 1064 1224 1264 768 777 785 817 Interlace
+
+###############################################################################
+# Monitor: Royal Information Electronics XGA Multiscan CN-1470A
+# Contributor: John Henders [jhenders@jonh.wimsey.bc.ca]
+# Last Edit Date: 5/28/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 816 952 1056 600 608 610 633
+ "912x684" 45 912 944 1112 1144 684 684 691 718
+ "1024x768i" 44 1024 1064 1224 1264 768 777 785 817 Interlace
+ "1024x768" 64 1024 1030 1196 1264 768 778 779 804
+
+###############################################################################
+# Monitor: Royal Information Electronics DM1564
+# Contributor: Georges Tomazi [tomazi@kralizec.zeta.org.au]
+# Last Edit Date: 12/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 680 720 864 480 488 491 521
+ "800x600" 50 800 880 1000 1040 600 637 643 666 +hsync +vsync
+ "1024x768i" 44.9 1024 1056 1216 1264 768 776 784 817 Interlace
+ "1024x768" 72 1024 1048 1184 1280 768 778 784 806 -hsync -vsync
+
+###############################################################################
+# Monitor: Sampo AlphaScan Plus
+# Contributor: Glenn Lai [glenn@cs.utexas.edu]
+# Last Edit Date: 5/11/92
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1064 1128 1280 768 772 776 808
+
+###############################################################################
+# Monitor: Samsung Sync Master 3 (14inch)
+# Contributor: Pedro A.M. Vazquez [vazquez@iqm.unicamp.br]
+# Last Edit Date: 12/12/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 36 800 816 996 1020 600 604 634 638
+ "1024x730" 50 1024 1040 1172 1320 730 731 735 755
+
+###############################################################################
+# Monitor: Samsung Sync Master 4 (17inch), Model CSA7571
+# Contributor: Rick Calder [rick@rick.att.com]
+# Peter Ziobrzynski [peter@modtor.uucp]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ 28 640 672 768 800 480 490 492 525
+ "800x600" 40 800 816 952 1056 600 608 610 633
+ "1024x768" 59 1024 1096 1272 1380 768 776 778 808
+ 78 1024 1112 1298 1386 768 776 784 800
+
+###############################################################################
+# Monitor: SANTEC DMC2185
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1280 1408 1680 1024 1029 1032 1071
+ 144 1280 1312 1456 1760 1024 1036 1039 1091
+
+###############################################################################
+# Monitor: Seiko CM 1440
+# Contributor: Jeff Jennings [jennings@stortek.com]
+# Last Edit Date: 12/9/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768i" 45 1024 1064 1224 1264 768 777 785 817 Interlace
+ "1152x900i" 45 1152 1184 1288 1360 900 898 929 939 Interlace
+
+###############################################################################
+# Monitor: Seiko CM 1450
+# Contributor: Les Johnson [les@ulysses.att.com]
+# Last Edit Date: 5/11/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25.2 640 664 760 800 480 491 493 525
+ "800x600" 40 800 840 968 1056 600 601 605 628
+ "1024x768i" 44.9 1024 1040 1216 1264 768 777 785 817 Interlace
+ 62 1024 1032 1168 1344 768 771 780 815 Interlace
+ "1024x768" 62 1024 1040 1184 1328 768 783 789 829
+
+###############################################################################
+# Monitor: Seiko CM 1450
+# Contributor: Steve Kump [skump@panix.com]
+# Last Edit Date: 11/04/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 31.5 640 680 720 832 480 489 491 519
+ "800x600" 50 800 816 936 1024 600 611 617 655
+ "1024x768i" 50 1024 1040 1200 1264 768 773 781 817 Interlace
+ "1024x900i" 65 1024 1074 1248 1392 900 901 905 955 Interlace
+ "1152x900i" 65 1152 1192 1402 1512 900 901 913 947 Interlace
+
+###############################################################################
+# Monitor: Seiko Instruments CM1760LR
+# Contributor: Ed Hall [edhall@rand.org]
+# Last Edit Date: 11/24/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 28 640 660 712 784 480 480 483 496
+ "800x600" 44 800 856 928 992 600 600 607 621
+ "1024x768" 72 1024 1072 1184 1306 768 771 777 796
+ "1152x900" 85 1152 1184 1296 1456 900 908 929 939
+
+###############################################################################
+# Monitor: Siemens C79145
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1472 1568 1728 1024 1027 1029 1061
+
+###############################################################################
+# Monitor: Sony CPD-1304
+# Contributor: Mathew S Hayashi [mhayashi@ecn.purdue.edu]
+# Last Edit Date: 3/3/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 45 800 840 992 1016 600 600 606 622
+ "1024x768" 62 1024 1032 1096 1272 768 768 772 792
+
+###############################################################################
+# Monitor: Sony CPD-1304
+# Contributor: Alexander-James Annala [merlin@neuro.usc.edu]
+# Last Edit Date: Jan 1, 1994
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75.40 1024 1032 1096 1272 768 768 772 792
+
+###############################################################################
+# Monitor: Sony CPD-1304
+# Contributor: Ron Prichett [prichet@usceast.cs.scarolina.edu]
+# Last Edit Date: 4/13/94
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 500 502 555
+ "800x600" 39 800 832 904 1008 600 610 612 655
+ "1024x768" 65 1024 1080 1258 1348 768 776 778 808
+
+###############################################################################
+# Monitor: Sony CPD-1404E (14") in AUTO LOCK mode
+# Contributor: J. Schnitter [josch@pc.chemie.th-darmstadt.de]
+# Last Edit Date: 5/6/92
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 672 768 800 480 490 492 525
+ "800x600" 36 800 825 900 985 600 600 609 631
+ "1024x768" 62 1024 1096 1272 1328 768 776 778 808
+ "1040x772" 62 1040 1110 1272 1328 772 780 780 820
+
+###############################################################################
+# Monitor: Sony CPD-1404S
+# Contributor: Nils Rennebarth [nils@sonya.exp-math.uni-essen.de]
+# Last Edit Date: 4/7/93
+#
+# name clock horizontal timing vertical timing flags
+ "800x600" 45 800 808 908 1000 600 607 612 645
+ "1024x768" 80 1024 1040 1288 1376 768 768 780 800
+
+###############################################################################
+# Monitor: Sony CPD-1430
+# Contributor: Jerod Tufte [jet@b62528.studnet.cwru.edu]
+# Last Edit Date: 4/13/94
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1060 1300 1364 768 768 780 808
+ "1152x900" 80 1152 1176 1256 1440 900 900 903 930
+
+###############################################################################
+# Monitor: Sony CPD-1604S
+# Contributor: Arthur W. Neilson III [art@pilikia.pegasus.com]
+# Last Edit Date: 1/20/92
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1096 1232 1312 768 768 776 808
+
+###############################################################################
+# Monitor: Sony GDM 1901
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1408 1600 1736 1024 1027 1030 1056
+
+###############################################################################
+# Monitor: Sony GDM 1932
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 85 1024 1096 1144 1416 768 799 807 856
+
+###############################################################################
+# Monitor: Sony GDM 1934
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 135 1280 1312 1408 1704 1024 1032 1035 1071
+ 144 1280 1344 1488 1808 1024 1025 1028 1062
+
+###############################################################################
+# Monitor: Sony GDM 1950
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 85 1024 1032 1104 1360 768 786 790 832
+ "1280x1024" 110 1280 1344 1472 1728 1024 1035 1038 1061
+
+###############################################################################
+# Monitor: SuperView DX15F
+# Contributor: Frode Roervik [froder@ifi.uio.no]
+# Last Edit Date: 1/25/94
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 75 1024 1096 1232 1312 768 768 776 808
+ 75 1024 1048 1184 1328 768 771 777 806 -hsync +vsync
+ 75 1024 1048 1184 1288 768 773 777 806
+ 80 1024 1072 1288 1328 768 768 771 807
+
+###############################################################################
+# Monitor: SYNCO CM-14XV
+# Contributor: Pedro R. Benito da Rocha [pedro@luna.gui.uva.es]
+# Last Edit Date: 4/27/94
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ 28 640 648 752 784 480 488 496 508
+ "800x600" 36 800 816 976 1008 600 602 610 628
+ "1024x768i" 44.9 1024 1048 1208 1264 768 776 784 817 interlace
+
+###############################################################################
+# Monitor: TARGA 1710 D
+# Contributor: Helmut Geyer [geyer@kalliope.iwr.uni-heidelberg.de]
+# Last Edit Date: 19/10/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 87 1024 1032 1152 1360 768 784 787 823
+ "1152x800" 97 1152 1200 1296 1496 800 805 816 849
+
+###############################################################################
+# Monitor: TATUNG CM-1498X
+# Contributor: Per Lindqvist [pgd@compuram.bbt.se]
+# Last Edit Date: 9/21/91
+#
+# name clock horizontal timing vertical timing flags
+ "640x400" 25 640 648 768 800 400 412 414 449
+ "640x480" 25 640 648 768 800 480 487 492 525
+ "800x600" 36 800 816 976 1008 600 602 610 628
+ "800x655" 36 800 816 976 1008 655 658 660 687
+
+###############################################################################
+# Monitor: Tatung CM14UAS
+# Contributor: David McCullough [davidm@stallio.oz.au]
+# Last Edit Date: 11/19/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 40 800 840 968 1056 600 601 605 628
+ "1024x768" 65 1024 1152 1184 1360 768 766 772 806
+
+###############################################################################
+# Monitor: TAXAN 990
+# Contributor: Thomas Roell [roell@xinside.com]
+# Last Edit Date: 03/29/91
+#
+# name clock horizontal timing vertical timing flags
+ "1280x1024" 110 1280 1472 1568 1728 1024 1026 1029 1061
+
+###############################################################################
+# Monitor: Taxan MultiVision 875 plus LR
+# Contributor: Harald Koenig [koenig@tat.physik.uni-tuebingen.de]
+# Last Edit Date: 11/25/93
+#
+# Horizontal frequency: 71990 Hz, vertical frequency: 90.7 Hz
+# name clock horizontal timing vertical timing flags
+ "1024x768" 110 1024 1024 1104 1528 768 768 772 794
+
+###############################################################################
+# Monitor: TAXAN Ultravision 1095
+# Contributor: Matti Aarnio [mea@utu.fi, mea@nic.funet.fi]
+# Last Edit Date: 1/6/92
+#
+# name clock horizontal timing vertical timing flags
+ "1152x910" 72 1152 1240 1312 1544 910 925 940 955 -hsync -vsync
+
+###############################################################################
+# Monitor: ViewSonic 4
+# Contributor: Scott Mitchell [smitchel@credit.erin.utoronto.ca]
+# Last Edit Date: 12/3/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 656 752 800 480 490 492 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+
+###############################################################################
+# Monitor: ViewSonic 5e
+#
+# See entry for "AcerView 25 uvga" above.
+
+###############################################################################
+# Monitor: ViewSonic 6
+# Contributor: [afgun@engin.umich.edu]
+# Last Edit Date: 12/10/93
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 25 640 656 752 800 480 490 492 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ "1024x768" 65 1024 1063 1271 1344 768 771 774 805
+
+###############################################################################
+# Monitor: ViewSonic 6e
+# Contributor: Dennis T. Flahert [dennisf@denix.elk.miles.com]
+# Last Edit Date: 5/10/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65.1 1024 1024 1168 1256 768 768 774 812
+
+###############################################################################
+# Monitor: ViewSonic 7
+# Contributor: Karel Zuiderveld [karel@cv.ruu.nl]
+# Last Edit Date: 4/8/92
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 62 1024 1064 1182 1238 768 776 778 808
+
+###############################################################################
+# Monitor: ViewSonic 7
+# Contributor: Joe Kelsey [zircon!joe@uunet.uu.net]
+# Last Edit Date: 5/4/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 65 1024 1080 1224 1344 768 776 778 808
+
+###############################################################################
+# Monitor: ViewSonic 7
+# Contributor: Henry A Worth [haw30@ras.amdahl.com]
+# Last Edit Date: 3/4/94
+#
+# name clock horizontal timing vertical timing flags
+ "640x480" 30 640 664 728 784 480 480 484 507
+ "800x600" 50 800 808 920 1032 600 600 610 635
+ "1024x768" 65 1024 1032 1208 1288 768 768 773 798
+ 75 1024 1048 1184 1328 768 771 777 802
+ 80 1024 1032 1216 1344 768 768 773 805
+
+###############################################################################
+# Monitor: ViewSonic 15
+# Contributor: Frank Mayhar
+# Last Edit Date: 12/13/93
+#
+# name clock horizontal timing vertical timing flags
+ "1024x768" 95 1024 1144 1264 1384 768 770 774 809
+ "1152x900" 110 1152 1284 1416 1536 900 902 905 941
+ "1280x1024" 110 1280 1416 1552 1696 1024 1026 1029 1061
+
+###############################################################################
+# Monitor: "Vobis"? Highscreen LE1024
+# Contributor: Gertjan Akkerman ( akkerman@dutiba.twi.tudelft.nl )
+# Last Edit Date: 11/19/1993
+#
+ name clock horizontal timing vertical timing flags
+ "640x480" 25 640 664 760 800 480 491 493 525
+ "800x600" 36 800 824 896 1024 600 601 603 625
+ "1024x768i" 44 1024 1040 1216 1264 768 777 785 817 Interlace
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/xinput b/xc/programs/Xserver/hw/xfree86/doc/xinput
new file mode 100644
index 000000000..d9cf9422b
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/doc/xinput
@@ -0,0 +1,242 @@
+ Information about the XInput extension in XFree86[tm]
+
+ Frédéric Lepied
+
+ 2 November 1998
+
+1. Introduction
+
+This document provides some information about the XInput extension imple-
+mented in XFree86[tm].
+
+If you have any suggestions, comments, fixes or ideas regarding the XInput
+extension in XFree86[tm] or about this document, send e-mail to
+
+lepied@XFree86.Org
+
+Bug Reports should be sent to
+
+XFree86@XFree86.Org
+
+Questions or anything else should be posted to the NewsGroup
+
+comp.windows.x.i386unix
+
+2. Description
+
+The XInput extension is a standard X Consortium extension. The goal of this
+extension is to allow additional input devices management to the X Window
+System. The documentation could be found in the X Consortium distribution
+under xc/doc/hardcopy/Xi.
+
+3. XFree86 implementation
+
+The XFree86 implementation contains 2 parts : the server part and two clients
+(xsetpointer and xsetmode).
+
+3.1 Server side
+
+The server supports the following extended devices :
+
+ o Joystick (only on supported systems ie. Linux, FreeBSD and NetBSD).
+ Features :
+
+ o Relative mode.
+
+ o 2 valuators (x and y axis).
+
+ o 2 buttons.
+
+ o Elographics touchscreen. Features :
+
+ o Absolute mode.
+
+ o 2 valuators (x and y axis).
+
+ o 1 button.
+
+ o Stylus on MicroTouch touchscreen. Features :
+
+ o Absolute mode.
+
+ o 2 valuators (x and y axis).
+
+ o 1 button.
+
+ o Finger on MicroTouch touchscreen. Features :
+
+ o Absolute mode.
+
+ o 2 valuators (x and y axis).
+
+ o 1 button.
+
+ o Mouse. Features :
+
+ o Relative mode.
+
+ o 2 valuators (x and y axis).
+
+ o up to 4 buttons.
+
+ o Wacom stylus. Features :
+
+ o Absolute or relative modes.
+
+ o 6 valuators :
+
+ 1. X axis.
+
+ 2. Y axis.
+
+ 3. pressure.
+
+ 4. X tilt.
+
+ 5. Y tilt.
+
+ 6. wheel.
+
+ o 3 buttons.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o Macro/function buttons are reported as keys.
+
+ o Wacom eraser. Features :
+
+ o Absolute or relative modes.
+
+ o 6 valuators :
+
+ 1. X axis.
+
+ 2. Y axis.
+
+ 3. pressure.
+
+ 4. X tilt.
+
+ 5. Y tilt.
+
+ 6. wheel.
+
+ o 1 button.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o Macro/function buttons are reported as keys.
+
+ o Wacom cursor. Features :
+
+ o Absolute or relative modes.
+
+ o 6 valuators :
+
+ 1. X axis.
+
+ 2. Y axis.
+
+ 3. pressure.
+
+ 4. X tilt.
+
+ 5. Y tilt.
+
+ 6. wheel.
+
+ o 16 buttons.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o Macro/function buttons are reported as keys.
+
+ o SummaSketch tablet. Features :
+
+ o Absolute or relative modes.
+
+ o 2 valuators (x and y axis).
+
+ o 2 buttons stylus or 4 buttons puck.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o AceCad tablet. Features :
+
+ o Absolute or relative modes.
+
+ o 2 valuators (x and y axis).
+
+ o 2 buttons stylus or 4 buttons puck.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o Calcomp DrawingBoard tablet. Features :
+
+ o Absolute or relative modes.
+
+ o 2 valuators (x and y axis).
+
+ o 4 buttons stylus or 16 buttons puck.
+
+ o Proximity report.
+
+ o Motion history capability.
+
+ o SWITCH virtual device. Features :
+
+ o Absolute mode.
+
+ o 1 valuator (device id) which reports the id of the device control-
+ ling the core pointer (works with the AlwaysCore feature see bel-
+ low).
+
+ o SGI button box. Features :
+
+ o Absolute or relative modes.
+
+ o 8 valuators.
+
+ o 32 buttons.
+
+ o Motion history capability.
+
+To enable an extended device, you must add en entry in the
+XF86Config file. Consult to the XF86Config man pages to see the
+details.
+
+The XFree86 implementation supports a non standard feature called
+AlwaysCore which enables an XInput device to send both core and extended
+events at the same time. To enable it you have to add the AlwaysCore keyword
+to the subsection describing your device in the XF86Config file. The
+SWITCH virtual device reports a Motion event when another device takes over
+the control of the core pointer. The id of the new device is reported in the
+first valuator of the event.
+
+3.2 Clients
+
+xsetpointer is used to change the device controlling the core pointer and to
+list available extended devices.
+
+xsetmode is used to change the mode (absolute or relative) of an extended
+device. The device has to support relative and absolute modes and the
+device must not control the core pointer.
+
+Consult the man pages for details.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/xinput.sgml,v 3.7 1999/08/23 06:38:55 dawes Exp $
+
+ $XConsortium: xinput.sgml /main/3 1996/10/27 11:06:13 kaleb $
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/xinput,v 3.9 1999/08/23 07:03:55 dawes Exp $
diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h
new file mode 100644
index 000000000..d3d2a7652
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h
@@ -0,0 +1,23 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.393 1999/08/30 02:34:15 dawes Exp $ */
+
+#define XF86_VERSION " 3.9.16 "
+
+/* The finer points in versions... */
+#define XF86_VERSION_MAJOR 3
+#define XF86_VERSION_MINOR 9
+#define XF86_VERSION_SUBMINOR 16
+#define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */
+#define XF86_VERSION_ALPHA 0 /* 0="", 1="a", 2="b", etc... */
+
+#define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \
+ ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
+#define XF86_VERSION_CURRENT \
+ XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \
+ XF86_VERSION_MINOR, \
+ XF86_VERSION_SUBMINOR, \
+ XF86_VERSION_BETA, \
+ XF86_VERSION_ALPHA)
+
+#define XF86_DATE "31 August 1999"
+
+/* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */
diff --git a/xc/programs/Xserver/lmfcfb/Imakefile b/xc/programs/Xserver/lmfcfb/Imakefile
new file mode 100644
index 000000000..8c71c6bbc
--- /dev/null
+++ b/xc/programs/Xserver/lmfcfb/Imakefile
@@ -0,0 +1,294 @@
+XCOMM $TOG: Imakefile /main/2 1997/11/17 10:57:31 msr $
+XCOMM $XFree86: xc/programs/Xserver/lmfcfb/Imakefile,v 1.3 1999/04/18 14:52:37 dawes Exp $
+
+#include <Server.tmpl>
+
+#ifndef PixelSize
+#define PixelSize 8
+#endif
+
+#if PixelSize == 8
+/* cfb8cppl.c MUST come last to avoid confusing makedepend */
+PSZSRCS = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c cfb8cppl.c
+PSZOBJS = cfb8bit.o cfbteblt8.o cfbglrop8.o cfbpush8.o cfbrctstp8.o cfb8cppl.o
+#ifdef MipsArchitecture
+#ifndef Mips64Architecture
+STIPPLESRC = stipmips.s stipmipste.s
+STIPPLEOBJ = stipmips.o stipmipste.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+#ifdef SparcArchitecture
+STIPPLESRC = stipsparc.s stipsparcte.s
+STIPPLEOBJ = stipsparc.o stipsparcte.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+
+#if PixelSize == 32
+#ifdef SparcArchitecture
+STIPPLESRC = stipsprc32.s stipsprcte32.s
+STIPPLEOBJ = stipsprc32.o stipsprcte32.o
+STIPPLEDEF = -DHAS_STIPPLE_CODE
+#endif
+#endif
+
+
+MFBSRCS = maskbits.c mfbgc.c mfbfont.c \
+ mfbscrinit.c mfbpixmap.c mfbmisc.c \
+ mfbbitblt.c mfbclip.c mfbgetsp.c \
+ mfbfillsp.c mfbpawhite.c mfbsetsp.c \
+ mfbpablack.c mfbpainv.c \
+ mfbplywhite.c mfbplyblack.c mfbplyinv.c \
+ mfbigbwht.c mfbigbblak.c \
+ mfbpgbblak.c mfbpgbwht.c mfbpgbinv.c \
+ mfbtewhite.c mfbteblack.c \
+ mfbfillrct.c mfbtileC.c mfbtileG.c
+
+MFBOBJS = maskbits.o mfbgc.o mfbfont.o \
+ mfbscrinit.o mfbpixmap.o mfbmisc.o \
+ mfbbitblt.o mfbclip.o mfbgetsp.o \
+ mfbfillsp.o mfbpawhite.o mfbsetsp.o \
+ mfbpablack.o mfbpainv.o \
+ mfbplywhite.o mfbplyblack.o mfbplyinv.o \
+ mfbigbwht.o mfbigbblak.o \
+ mfbpgbblak.o mfbpgbwht.o mfbpgbinv.o \
+ mfbtewhite.o mfbteblack.o \
+ mfbfillrct.o mfbtileC.o mfbtileG.o
+
+
+SRCS = cfbgc.c cfbrrop.c cfbwindow.c \
+ cfbpntwin.c cfbmskbits.c cfbpixmap.c cfbbitblt.c \
+ cfbfillsp.c cfbsetsp.c cfbscrinit.c cfballpriv.c \
+ cfbgetsp.c cfbfillrct.c \
+ cfbsolidC.c cfbsolidX.c cfbsolidG.c \
+ cfbtileoddC.c cfbtileoddG.c cfbtile32C.c cfbtile32G.c \
+ cfbcmap.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \
+ cfbfillarcC.c cfbfillarcG.c \
+ cfbigblt8.c cfbglblt8.c cfbtegblt.c cfbbstore.c \
+ cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c \
+ cfbpolypnt.c \
+ cfbbres.c cfbline.c cfbhrzvert.c cfbbresd.c cfbimage.c cfbseg.c \
+ cfb8lineCO.c cfb8lineX.c cfb8lineG.c cfb8lineCP.c \
+ cfb8segC.c cfb8segX.c cfb8segG.c cfb8segCS.c \
+ cfbply1rctC.c cfbply1rctG.c $(PSZSRCS) $(MFBSRCS)
+
+OBJS = cfbgc.o cfbrrop.o cfbwindow.o \
+ cfbgetsp.o cfbfillrct.o \
+ cfbsolidC.o cfbsolidX.o cfbsolidG.o \
+ cfbtileoddC.o cfbtileoddG.o cfbtile32C.o cfbtile32G.o \
+ cfbfillsp.o cfbsetsp.o cfbscrinit.o cfballpriv.o \
+ cfbpntwin.o cfbmskbits.o cfbpixmap.o \
+ cfbcmap.o cfbzerarcC.o cfbzerarcX.o cfbzerarcG.o \
+ cfbfillarcC.o cfbfillarcG.o \
+ cfbigblt8.o cfbglblt8.o cfbtegblt.o cfbbstore.o \
+ cfbpolypnt.o \
+ cfbbres.o cfbline.o cfbhrzvert.o cfbbresd.o cfbimage.o cfbseg.o \
+ cfb8lineCO.o cfb8lineX.o cfb8lineG.o cfb8lineCP.o \
+ cfb8segCS.o cfb8segX.o cfb8segG.o cfb8segC.o \
+ cfbbitblt.o cfbbltC.o cfbbltX.o cfbbltO.o cfbbltG.o \
+ cfbply1rctC.o cfbply1rctG.o $(PSZOBJS) $(STIPPLEOBJ) $(MFBOBJS)
+
+ INCLUDES = -I. -I../cfb -I../mfb -I../mi -I../include -I$(XINCLUDESRC) \
+ -I$(FONTINCSRC)
+ LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln \
+ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln
+ DEFINES = -DPSZ=PixelSize
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(cfb,$(OBJS))
+LintLibraryTarget(cfb,$(SRCS))
+
+NormalLintTarget($(SRCS))
+
+LinkSourceFile(cfb.h,../cfb)
+LinkSourceFile(cfbmap.h,../cfb)
+LinkSourceFile(cfballpriv.c,../cfb)
+LinkSourceFile(cfbbitblt.c,../cfb)
+LinkSourceFile(cfbblt.c,../cfb)
+LinkSourceFile(cfbbres.c,../cfb)
+LinkSourceFile(cfbbresd.c,../cfb)
+LinkSourceFile(cfbbstore.c,../cfb)
+LinkSourceFile(cfbcmap.c,../cfb)
+LinkSourceFile(cfbfillarc.c,../cfb)
+LinkSourceFile(cfbfillrct.c,../cfb)
+LinkSourceFile(cfbfillsp.c,../cfb)
+LinkSourceFile(cfbgc.c,../cfb)
+LinkSourceFile(cfbgetsp.c,../cfb)
+LinkSourceFile(cfbhrzvert.c,../cfb)
+LinkSourceFile(cfbimage.c,../cfb)
+LinkSourceFile(cfbline.c,../cfb)
+LinkSourceFile(cfb8line.c,../cfb)
+LinkSourceFile(cfbmskbits.c,../cfb)
+LinkSourceFile(cfbmskbits.h,../cfb)
+LinkSourceFile(cfbpixmap.c,../cfb)
+LinkSourceFile(cfbply1rct.c,../cfb)
+LinkSourceFile(cfbpntwin.c,../cfb)
+LinkSourceFile(cfbpolypnt.c,../cfb)
+LinkSourceFile(cfbrrop.c,../cfb)
+LinkSourceFile(cfbrrop.h,../cfb)
+LinkSourceFile(cfbscrinit.c,../cfb)
+LinkSourceFile(cfbsetsp.c,../cfb)
+LinkSourceFile(cfbsolid.c,../cfb)
+LinkSourceFile(cfbigblt8.c,../cfb)
+LinkSourceFile(cfbglblt8.c,../cfb)
+LinkSourceFile(cfbtegblt.c,../cfb)
+LinkSourceFile(cfbtileodd.c,../cfb)
+LinkSourceFile(cfbtile32.c,../cfb)
+LinkSourceFile(cfbwindow.c,../cfb)
+LinkSourceFile(cfbzerarc.c,../cfb)
+LinkSourceFile(cfb8bit.h,../cfb)
+#if PixelSize == 8
+LinkSourceFile(cfb8bit.c,../cfb)
+LinkSourceFile(cfb8cppl.c,../cfb)
+LinkSourceFile(cfbpush8.c,../cfb)
+LinkSourceFile(cfbrctstp8.c,../cfb)
+LinkSourceFile(cfbteblt8.c,../cfb)
+#ifdef MipsArchitecture
+LinkSourceFile(stipmips.s,../cfb)
+#endif
+#ifdef SparcArchitecture
+LinkSourceFile(stipsparc.s,../cfb)
+#endif
+#endif
+#if PixelSize == 32
+#ifdef SparcArchitecture
+LinkSourceFile(stipsprc32.s,LinkDirectory)
+#endif
+#endif
+
+LinkSourceFile(maskbits.c,../mfb)
+LinkSourceFile(mfbgc.c,../mfb)
+LinkSourceFile(mfbfont.c,../mfb)
+LinkSourceFile(mfbscrinit.c,../mfb)
+LinkSourceFile(mfbpixmap.c,../mfb)
+LinkSourceFile(mfbmisc.c,../mfb)
+LinkSourceFile(mfbbitblt.c,../mfb)
+LinkSourceFile(mfbclip.c,../mfb)
+LinkSourceFile(mfbgetsp.c,../mfb)
+LinkSourceFile(mfbfillsp.c,../mfb)
+LinkSourceFile(mfbsetsp.c,../mfb)
+LinkSourceFile(mfbpntarea.c,../mfb)
+LinkSourceFile(mfbply1rct.c,../mfb)
+LinkSourceFile(mfbimggblt.c,../mfb)
+LinkSourceFile(mfbplygblt.c,../mfb)
+LinkSourceFile(mfbtegblt.c,../mfb)
+LinkSourceFile(mfbfillrct.c,../mfb)
+LinkSourceFile(mfbtile.c,../mfb)
+
+ObjectFromSpecialSource(cfbseg,cfbline,-DPOLYSEGMENT)
+
+ObjectFromSpecialSource(cfbfillarcC,cfbfillarc,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbfillarcG,cfbfillarc,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbzerarcC,cfbzerarc,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbzerarcX,cfbzerarc,-DRROP=GXxor)
+ObjectFromSpecialSource(cfbzerarcG,cfbzerarc,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbbltC,cfbblt,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbbltX,cfbblt,-DMROP=Mxor)
+ObjectFromSpecialSource(cfbbltO,cfbblt,-DMROP=Mor)
+ObjectFromSpecialSource(cfbbltG,cfbblt,-DMROP=0)
+
+ObjectFromSpecialSource(cfbsolidC,cfbsolid,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbsolidX,cfbsolid,-DRROP=GXxor)
+ObjectFromSpecialSource(cfbsolidG,cfbsolid,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfbtileoddC,cfbtileodd,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbtileoddG,cfbtileodd,-DMROP=0)
+
+ObjectFromSpecialSource(cfbtile32C,cfbtile32,-DMROP=Mcopy)
+ObjectFromSpecialSource(cfbtile32G,cfbtile32,-DMROP=0)
+
+ObjectFromSpecialSource(cfb8lineCO,cfb8line,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfb8lineCP,cfb8line,-DRROP=GXcopy -DPREVIOUS)
+ObjectFromSpecialSource(cfb8lineX,cfb8line,-DRROP=GXxor)
+ObjectFromSpecialSource(cfb8lineG,cfb8line,-DRROP=GXset)
+
+ObjectFromSpecialSource(cfb8segCS,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT -DWIDTH_SHIFT)
+ObjectFromSpecialSource(cfb8segC,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT)
+ObjectFromSpecialSource(cfb8segX,cfb8line,-DRROP=GXxor -DPOLYSEGMENT)
+ObjectFromSpecialSource(cfb8segG,cfb8line,-DRROP=GXset -DPOLYSEGMENT)
+
+ObjectFromSpecialSource(cfbply1rctC,cfbply1rct,-DRROP=GXcopy)
+ObjectFromSpecialSource(cfbply1rctG,cfbply1rct,-DRROP=GXset)
+
+ObjectFromSpecialSource(mfbpawhite,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidWhiteArea -DMFBSTIPPLEFILLAREA=mfbStippleWhiteArea -DOPEQ=MFB_OPEQ_WHITE -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE)
+
+ObjectFromSpecialSource(mfbpablack,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidBlackArea -DMFBSTIPPLEFILLAREA=mfbStippleBlackArea -DOPEQ=MFB_OPEQ_BLACK -DEQWHOLEWORD=MFB_EQWHOLEWORD_BLACK)
+
+ObjectFromSpecialSource(mfbpainv,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidInvertArea -DMFBSTIPPLEFILLAREA=mfbStippleInvertArea -DOPEQ=MFB_OPEQ_INVERT -DEQWHOLEWORD=MFB_EQWHOLEWORD_INVERT)
+
+ObjectFromSpecialSource(mfbplywhite,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyWhite -DOPEQ=MFB_OPEQ_WHITE -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE)
+
+ObjectFromSpecialSource(mfbplyblack,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyBlack -DOPEQ=MFB_OPEQ_BLACK -DEQWHOLEWORD=MFB_EQWHOLEWORD_BLACK)
+
+ObjectFromSpecialSource(mfbplyinv,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyInvert -DOPEQ=MFB_OPEQ_INVERT -DEQWHOLEWORD=MFB_EQWHOLEWORD_INVERT)
+
+ObjectFromSpecialSource(mfbigbwht,mfbimggblt,-DMFBIMAGEGLYPHBLT=mfbImageGlyphBltWhite -DOPEQ=MFB_OPEQ_WHITE)
+
+ObjectFromSpecialSource(mfbigbblak,mfbimggblt,-DMFBIMAGEGLYPHBLT=mfbImageGlyphBltBlack -DOPEQ=MFB_OPEQ_BLACK)
+
+ObjectFromSpecialSource(mfbpgbwht,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltWhite -DOPEQ=MFB_OPEQ_WHITE)
+
+ObjectFromSpecialSource(mfbpgbblak,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltBlack -DOPEQ=MFB_OPEQ_BLACK)
+
+ObjectFromSpecialSource(mfbpgbinv,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltInvert -DOPEQ=MFB_OPEQ_INVERT)
+
+ObjectFromSpecialSource(mfbtewhite,mfbtegblt,-DMFBTEGLYPHBLT=mfbTEGlyphBltWhite -DOP=MFB_OP_WHITE -DCLIPTETEXT=mfbImageGlyphBltWhite)
+
+ObjectFromSpecialSource(mfbteblack,mfbtegblt,-DMFBTEGLYPHBLT=mfbTEGlyphBltBlack -DOP=MFB_OP_BLACK -DCLIPTETEXT=mfbImageGlyphBltBlack)
+
+ObjectFromSpecialSource(mfbtileC,mfbtile,-DMROP=Mcopy)
+
+ObjectFromSpecialSource(mfbtileG,mfbtile,-DMROP=0)
+
+SpecialCObjectRule(cfbglblt8,$(_NOOP_),$(STIPPLEDEF))
+SpecialCObjectRule(cfbpixmap,$(ICONFIGFILES),$(_NOOP_))
+
+#if PixelSize == 8
+ObjectFromSpecialSource(cfbglrop8,cfbglblt8,-DGLYPHROP)
+
+#ifdef MipsArchitecture
+stipmipste.s: stipmips.s
+ $(RM) $@
+ $(LN) stipmips.s stipmipste.s
+clean::
+ $(RM) stipmipste.s
+
+stipmipste.o: stipmipste.s
+ $(AS) -o $@ -DTETEXT stipmipste.s
+#endif
+
+#ifdef SparcArchitecture
+stipsparcte.s: stipsparc.s
+ $(RM) $@
+ $(LN) stipsparc.s stipsparcte.s
+clean::
+ $(RM) stipsparcte.s
+
+stipsparc.o: stipsparc.s
+ $(CPP) stipsparc.s | $(AS) -o $@ -
+
+stipsparcte.o: stipsparcte.s
+ $(CPP) -DTETEXT stipsparcte.s | $(AS) -o $@ -
+#endif
+#endif
+
+#if PixelSize == 32
+#ifdef SparcArchitecture
+stipsprcte32.s: stipsprc32.s
+ $(RM) $@
+ $(LN) stipsprc32.s stipsprcte32.s
+clean::
+ $(RM) stipsprcte32.s
+
+stipsprc32.o: stipsprc32.s
+ $(CPP) stipsprc32.s | $(AS) -o $@ -
+
+stipsprcte32.o: stipsprcte32.s
+ $(CPP) -DTETEXT stipsprcte32.s | $(AS) -o $@ -
+#endif
+#endif
+
+DependTarget()